This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "FreeSWITCH". The branch, master has been updated discards 15e65cfafb8a46caca8bb8a63d55edf817f17f2d (commit) via 89253a139117b32fa0a6dc101e53e9b830361048 (commit) via 0e0431ecc66d04236cf4940b65977bad424fdc86 (commit) via 7c624767116b30dc9074c1cfbbe7c3a5771950f9 (commit) via 83d5cd6ff6f2f6e23c09ee387098a59d7764a84f (commit) via 4b731fd64c1bf16a0da20f1c10de8d382faed3a4 (commit) via 636c1ecb4e9cace5967390a8a8125fa783f6d0b9 (commit) via 02d1af647bac6b937de02608d53ea1831f51b968 (commit) via 28465f38a08df99a76864bbf6a9ae5e4e7bcd720 (commit) via d164a79764c49dd11bbffcd26d6ca98770181c67 (commit) via e78f2bfb5d5f17d0646f0bc2a9fad03546eac646 (commit) via 9509befbfa43810dcde11532663561838d267f2c (commit) via 0d098a5110e095bb9334196978289e081d5a022b (commit) via 80a6279993f2369e79e70bc9b61bfcaf2f3e5f4c (commit) via 7ce63feadf86bf4321aa184311996d010aab59f8 (commit) via 6477d3f87e32cc623638073fc1983ebfc4fa54cd (commit) via 24bcd10582193ef6dac5a124ad03323066e355f8 (commit) via 4eb5bbf41c3fcb6bfd33704a18bd2e7e52acd437 (commit) via 976859bb45f08382424c9c4b0dbf6acb3fba64fb (commit) via a8f5bf60a87fb27420846bd9d9af5e61f1f947d6 (commit) via 6e4c30ea377728107e0747d614565eca964fa1d3 (commit) via 7a1dcb69581ba593f3dc3868c94c1124c41e64f3 (commit) via 6294bc1620c94785f23bf6ae6966aaa67cf34c7f (commit) via 0e37dcb5db19592d28eb771edb4a0d394f5275ac (commit) via b88cd3457a847cf05564df51bd8a60036b15bfd8 (commit) via 9adac7c6988df8436c634edaaa13ae39067f8df7 (commit) via 5316bcd9dc648b3874ebddea75ed6f34431c7f35 (commit) via 9fe440b2fe63935331b148ffc1d3c7a5ddffa20b (commit) via 8d6d52e015411649e0591eb7ad667885523b99c3 (commit) via 4eccdfef58a64652ae2a1f0a7a1f11ae55346420 (commit) via f5dafc9911eb892e0ac557bc892638cc9fb67014 (commit) via e0ed0008b1712d00f21d8fedce32eeb531e5da82 (commit) via 3fa3e11ca23f788841e00aef8342e1718675477d (commit) via 3dd9d5c0a399757059c60d9d8c751b97383da676 (commit) via 1cf79386c80712311c656a166b9dec5847857266 (commit) via e086b80632bad6c3afb24320d2fcb74304897a9c (commit) via accc28528009361b4b1e268431d6e2b94112020a (commit) via 6e2b1bd328607b2f0d5175b57389dfd2c3c62066 (commit) via c91b409caa37a115a46f60f7b3725d7dd1b3c50e (commit) via 1561ad2ca695058c79183c07c59fe1dab825deff (commit) via 74de704973086d5cf360578ad9eac5977cfa4770 (commit) via 2e18c5b4d9fc583b76b4c8e4470579b1a21845ae (commit) via 7fbc47f83a5bf455b6ece49deb7771d144bbce4c (commit) via 1c95ad98cd1c0e966b738796e74923db8919b754 (commit) via fd984d03bb629d08ac4192c5a1d3432e94ceb3d5 (commit) via 70700617d3d6bd45904a81be443fe28aa7fd0387 (commit) via d743baefedfbe679a647013adc2718defef90718 (commit) via 1da8339ffb5719ba92ececeb27b6c335f3e6b4aa (commit) via 0cf1d54a05319be2f388e5f2dbb1bfd75a2a9043 (commit) via 978cb111e7971eceb238d396124e10424b148a6c (commit) via 9bb344783d39da5dc3e57d48b59f551ba9a2fa4d (commit) via 7d13655b747ef6f3577138f55ed48ec8c2fa11a5 (commit) via 0fdc272b25c7918359ae5b0f27277ff1926bcb75 (commit) via 7fb1abf7583a22d88f91b2c933a6a379970efbcc (commit) via 6fd468043b284ee30085cf86be16ba99725d6462 (commit) via bc2d331feb7c7e736f2d1289a11518053177a6f4 (commit) via 5ffc6b437d86c800519432359277afb39e604c5e (commit) via 1fcffcfbc3fe6c2f21e5767fc760fdbc0c89aa68 (commit) via ea9021a24a6ce0606a2c12f3cab8f2bf0fc12db3 (commit) via afc027473f7fc8a3ec233fb1848f728fc94f56b6 (commit) via bd39ad2269d302748fd55e96431b221ba6c7be6b (commit) via 54c0d6f7c41d3bc882ff339af8c01545e03606a9 (commit) via 9c8ce46b908e78662d970ce20fa38c2f7b710df1 (commit) via 163dd056605065b2f8221e95a75e422c0f034f05 (commit) via c64f4753b3003a1b091678850f272669926ff12c (commit) via 137de401218c834262b0941e8b47de600a2c9052 (commit) via 9a545bd0c9534eb6e6f7579a1b5f0e57d0a7ee6c (commit) via 51985ca69a1f050b3c724043e01582500882882c (commit) via 44ac5d8b99e035b14a0eac9943dff5886c061017 (commit) via 07fa8a4a72460bf77eac238de0b634896f8d90ca (commit) via 4c5426f2fbf65d1130fee044f4e4acd83f0a4fc7 (commit) via 0a38d7761e1099b4e369da8948f22ac7c0c8d184 (commit) via 1db40e60e4675ce363855ba429ceadd90e800f1c (commit) via 190bd61d8a74678135396f28940655114d9b6513 (commit) via b683bb6585165c29ef883b41b97400d8ebc550df (commit) via 90e87a481145242bf661de4a96a7ccda1476034e (commit) via 10b38944f6e51f33e3d0092ea1dcf3e88538a5a7 (commit) via 54879c381e287b6cf0344c08086bf9d8faf686de (commit) via af0dc500ae8639d2b19c9a1a55937e7bb6f27db2 (commit) via 7438e24d1ab38317d73ace94150573fb84778f59 (commit) via de49305ad501b4bba758679be7b5e80b68eba1cf (commit) via 99cab144b5bc0d7b304a490f27bab6a28cead815 (commit) via f3082c7d75926e77062bc83c0318979e89ad0857 (commit) via 6fc0bb088654437771b89e42c90f6196d14acad6 (commit) via 585cb68ad4ecf011380d35199bd4609a36b503cd (commit) via 6734fe711bbc69dc999f237a1865a3013a1d762b (commit) via 018a3800b4cec46e0cebb6707497bac8045d654b (commit) via a020724030c651aed8e427511b8dc79c4ae7a661 (commit) via cc06fdb5fae26a01914cbbeb8ae306bd17ab01b2 (commit) via 7eceff48a2b8fc9590816748c63f9563e7929488 (commit) via 68bf642c1134c63e89c204bd953c30381de8488d (commit) via e6a25e85783cf7bfc21f45c8fb6802bd2dd40546 (commit) via 245b88578cd3d7065bd96641fe09acc0c93e3e72 (commit) via a41974e580d7d73b7e22e9f927a75e84d3cdafd0 (commit) via f06298f163fd29e3a27f3088d77da645b11bcf6f (commit) via 04d565281938ca24ffe5c82cda177624f221cd30 (commit) via 029d68ce47c5990d809716b88c65e924259e1f68 (commit) via ecfa33e9e4b3b10b0535dc7fd52bd69be43269fb (commit) via 73110296854d38bbb1bce0f016668a04b3b7f871 (commit) via a4df823c3df6fd456b2c75d0945ffc60c8259239 (commit) via 7b01cbbca406aa4d11fd12de56d3310a16033b1f (commit) via 57b410eba6247b7a2805d9588963435946512a0c (commit) via 4ee4c67003b7b0159ae5b980dc1ae1fb7a335f5d (commit) via 33bb9b834d4a563413e52b6010de8fe7555716d3 (commit) via 6126383ca47ace0ae6497cf9efd4cc41e87dd11a (commit) via 7a04104d6f748ab2ed8bb880cad8b47fbaefe580 (commit) via dff01c07f14a5c78048a7b71f64bb56fb353b46b (commit) via e6e6ba9f3861fabf0153568f13d577731a0c82a8 (commit) via bba8aefca0b4b2eb7ccf86c2958b6cad397403ab (commit) via 03ae958ce40b529709dbaf4a304be2ba3f6454b1 (commit) via b2359797668addf5e79ce4de36f1cf62cc93136d (commit) via c6bdb303d43383f4d3474f54e5dbf2b6d699f2bd (commit) via 2e0747272fcc686851efb2fd804ee2bf78960f5d (commit) via 8458adebbb814ed3a38493bbd5af6b5a7531939e (commit) via d9c5634507118428b27dea28bb3950beb4da9741 (commit) via a6db66ef36c05d0989343fdb8dd5bd8860754839 (commit) via 9c7b507d06123aedd5842e2d7bc8eae42bd5e566 (commit) via fe1711fdbab9ccf7c1565c0309fe7609fcfe1afc (commit) via 1b91f811bdba30759946c23132579fc55f3579a1 (commit) via 138fdc83c6a4f614b657629b2937f78485a78a26 (commit) via a10125b8c3661123d99ed77cb3224eb4fdee5854 (commit) via fb017a52d183ded3db8e01eec5e29b127ccb2ad0 (commit) via 159ae98979fcfe78f497dc38e2f6daad8a1d87cd (commit) via 54de293b0582bde9db579bc8de8ce8d6ab4750d2 (commit) via 7d1e664dc86c1b533bf70ad688fc58bbc0438073 (commit) via d2c34232ab046c9d8a004d8a1d919731a94cc70a (commit) via 1d6d9601d0dc0e8ba7d3136e700c0f899baf330c (commit) via 771caca78d5964486dad09c0f9f93fc08cf76785 (commit) via eb88304a1680890d2644a3f0d14f38896e164e33 (commit) via 3594419622409870f8ea947101452f4169d3546e (commit) via 946f47f1899203e3c8e1d1470b8708260c1b4538 (commit) via 8a26a6f6d2ab7f8964c5199723d02507d2292415 (commit) via cf253c35bc8de814e7c5b3f5e88bd9988556dbdb (commit) via 45340d8017c1915e4353961022e8c08d1f1eb7a8 (commit) via 316963c5941d387b12de505d2e418c1788018b09 (commit) via 10109165b75dacb1a53fee2da0d4fa232abaeef0 (commit) via 85e107a56e1cab1658fb6b0c8e04b9dbe8514d61 (commit) via ef880c53b2dc730e212af914e1ac4fc9753eb5d2 (commit) via f5c5fd9cc34dfad048b9f1218a36a1d5f165ae27 (commit) via d41e6498f19e100eb8e9241784bb271b1e66c831 (commit) via a9eb0aa6efd0aff8ab64e597429757fdf1939c46 (commit) via 54421f591015496fd3c0c3da7a5221a84ab7c8e3 (commit) via 6f103acd796ebcd7c0001a8d58568a3d77d2b3e6 (commit) via b55db357d93c72ca712feb1e3ee91b60f026bdbf (commit) via 4fd043e3fb69a55dee43353547f2fb1fa24e7788 (commit) via fcc912a991a9513cc605ea0f3a24f96c2c4ccdfd (commit) via 62941f69d8d3f32856e136e49eff7f5c5f4135bd (commit) via f8cb2961826c053cd168e4b440c44bd52c7af5d2 (commit) via baac734ec4b9088c69f87170b3a63f9f0257983d (commit) via 74a01d23bc4661e2a4dfc1eca5df62a735332072 (commit) via 21f8605d6871680e90a8eee76be1abb2a52e2761 (commit) via e42c423c9275ec5aec8499c4035978087fc84c02 (commit) via a9366e4485c2990c394e86d9de3a9c9e098e4aba (commit) via 29daaa07b0cdab12ce856c7520cde5270c68effc (commit) via 3f1a7dc5b530f843df84348f80a03f5439f71c99 (commit) via 22ba5b35602df8b210732330ebe1cfdc7fa71002 (commit) via a95a4eeee8910f87f0ea1156148834a56e4e6edf (commit) via 83ce26b226416b20416eeff70aaabade876920b8 (commit) via 719416f66b1757d33364b6ffb37119e29596a5ae (commit) via 300348916ed9417dd16e7fa041ba56676ae08f1b (commit) via a8b2840f2b3a634ebda4a601700c8502c2611045 (commit) via 285ac684d7f5f9e8367d292d0c7f43a6a61705e3 (commit) via 01024acee13d2d6343bee07f8b6de3e8a1efeb82 (commit) via b3fc001e6cfcfd9219374d13f996981405506118 (commit) via 2cfd09c35c65f181822e9e3cbe797118a45a84a3 (commit) via 40aa1d90f33ed122ae2b228ab02948145b54bf7c (commit) via a743263afbcbf30e6345e4cceded760579680760 (commit) via 545ba61226d0ae2a581a89d60435ae5621c4ebc9 (commit) via cd13030f25cc66b56edeb80c6631920a9aa970ff (commit) via 1a08df9b20d4b5c0e5bfc0ffe6d0b8d380aefd72 (commit) via 85c22d10e2dc8f2d8303e4fd11219d9c4b09ccb5 (commit) via 9462f53c90beec68111bcd137f9415532aad5509 (commit) via 0132cd3fc7dad74f480f01694d8db89207707020 (commit) via 70697b8835145a800f035c667f5c0f7defdc97ca (commit) via 3018400461fb6e162bef812e00dc321d0e638c90 (commit) via 81f01f0ee7ed5bef174ee5e47e3932192b74f805 (commit) via a3499c534383dbd62df150b78b815719fedbf16a (commit) via 46853d7f3d08b20ba518d7b596e6082a2d8d9945 (commit) via b09c32c19a04a82a81c1bd532fe59dcb6a923f73 (commit) via 309ced0eace881a2cddcf6807fe467c914ac9bb9 (commit) via 4272dcbff507adbb02a4d6f56375420f58cfb510 (commit) via 2091e33dbe7b6b24251833ffd7d3a5c73d61e50d (commit) via b262f44ce241f84f9616cf92f2072fd7612cc944 (commit) via 27869d7a265aacdee54933fce0aff5cb0d404d11 (commit) via 96ac90adce931a3a28c768e102b863637c8ba98d (commit) via 231fbe5e7ac693fd3d05fd0c65aecc2a98416580 (commit) via d3e7c2a63d8bccaf21ee54abe1f2c05e9beca7ae (commit) via 422ee12aaa0802f3de6e23c21baae9d9b4a9372c (commit) via 181b543b0ca349a8a081eab141ed7077467cedea (commit) via e06feedd9e478defd1b9a897245f54e896fc8608 (commit) via ae70ea0c13dbccc1842bfb8b1708e705a8f9d662 (commit) via 32b8f1008eedbafb7210164fdebf80c98c9911a4 (commit) via becf16c58ce72445cfc81ece0e29c10627f417ab (commit) via ac736e4e45e735479465a53c807530356ea6e667 (commit) via ca6327fa456f7a9a299a44420c71548b5e2cc944 (commit) via eb84fc772fb1ec44de8b5c6ab0ebbc912f2705fa (commit) via d79cf48475f2bbfd3c28c7931d22b2e2736e9ebe (commit) via 5bb525e1eaf65a9784e97e9929b98ac846703e4d (commit) via 2c595a6ce04c714b51fc8986315ff68cd463fb35 (commit) via 2f7caaf2cb10e1cad8cad5ccf27dddf0fa97ed99 (commit) via 4b04032bd8c984c4cf4cc6dbcebe9144d7eed853 (commit) via f574db09583479fb85dbbbfb9a376843c700669b (commit) via 98fa4a914c83228a8ac6c29d93839713a39a3392 (commit) via 8f9ddb5a8966602810a5a49aba70723f13b8393d (commit) via 3734f4cd441a6bc9595e83338cf29c5af24ed9c7 (commit) via 1aa6bc6eec5be2cc16ef5b130a5cc213bff634be (commit) via 23d9a237dcf72b8e65376ae8f547dc1ad5939719 (commit) via 35776314d0a073775f5dbba1e81362d3e012d507 (commit) via 342678698c137f2df295efee88f4b0a0f91b734d (commit) via 9ee13b723e0ec150e03dae569c71f370b4491405 (commit) via 5254df0466fd8213905b52f7f6a0ab6c2c8cc862 (commit) via a90b4fea347b4705a40a6ff3fefc0014fee0b33f (commit) via 7c3fd20104a5ec2a7bedfc2893c33259f894b68c (commit) via a390e046b7d9e67e2fac8adcfd6c47c1011c01bb (commit) via b9a446c54ed6e16c52a71f89ce3029c9e906cdb0 (commit) via 47c1b6d96ab853341efea272efe0ae5a60e97634 (commit) via 1334d02ac0913370a5ee77d63dd7b64fbb0a3f89 (commit) via 5c02639b5acf48ead80045f50e841c1c43f36d34 (commit) via 4a6b4e86f16a25074cc0f77fc7ddbda36f5cbfc4 (commit) via e6070feeab6940a3566a59a7802f003fa4181093 (commit) via fc77d19b7bc6c64eadbd37f9715a79431f897379 (commit) via 8b7fd76d3de084e581e994ffa171d1f6653a4d55 (commit) via df090a2a6b1042b8c575ecce241c021e16a792be (commit) via 66ce95a93049404324a382d307730c3aa4a1e443 (commit) via a3d66bb4f075cb8b073aac6a84f3651ebec9aadd (commit) via 7b28994121b820e24c48e80c11ff5149f16245d3 (commit) via 80f3281c095f772b32eb1e042d267a089204b8e5 (commit) via aab453f52a37cfc43230e67c713ff7d605e7dd16 (commit) via 93bbbe96af98a6e4ab2ae5a48e68690b44bc103c (commit) via 935f2c42141eb78c3fd13ace50900bd99b905dd0 (commit) via 8ecf30807556ee3f614f4f2e5181dc5bbfbfdf81 (commit) via 2632af929d8c63447a482e16ca92f6d2c5dc1ebf (commit) via 09e6fd3f4ee5069491034fb150405fe7ad61fe3f (commit) via 45a32dda3d09878fe07659002fd192ed8dca3575 (commit) via ced63c35167d5f6c52583b5e70da1b2cf669c8ef (commit) via ec57dc7ab76e5765bbd50905e47a1cac2aad38ba (commit) via 6f5a0e9ff5984aed4b99b7a04a6cb1339b86e3b1 (commit) via 2be3175ae91924a3e7460f67f0aecd927d6f2661 (commit) via 9ab7473cb97248efa46acda5a44f0e1a1207c646 (commit) via fe0d8d1ec508d96d6edc08ec610f142633e896bf (commit) via f79f9766ba35f8d488b4ba33c7814fc3c30de7f7 (commit) via e897646e1557282d6cfbf6c0c66d048222f7942e (commit) via 24febbea8e29c75d6dcfaea6d7bd871c0592d207 (commit) via 39d58e0452f9af4b67f4c9d1056a49cc765ef000 (commit) via 0e31a974d4d4f2ac881a51c04ccd17a64d38eb0b (commit) via a0d36d8f9d77af56925b90eee70ec5955e33e58a (commit) via 0f95b870358742aed11e43fffb958251c8e19994 (commit) via 18feeb106786fd38616c18387da024baaf0b31ab (commit) via 5401c604935c496892875411cdeb53d32ac246ea (commit) via cc198a6e91ee0314b6121433ac4828970d18be54 (commit) via 05a82ca61866638ffb6ddceaefd61f2a5057f788 (commit) via 25bc8fe3e88d66070ff1ddcebf67f125ac16f617 (commit) via f625fe3b01666817859a761e9386a6dcccbfe940 (commit) via 10257c7d5d6b8f15c2e57af2c9c096e48a3877dd (commit) via 97a68c50d91b115e4cec42ea5a060470c88f5a23 (commit) via 903d13648184bbc94030ce381ffbf9b7702e7dce (commit) via c4e350ab0cfec3c7500cf196b712874f90d562b0 (commit) via 0920645d1f1b7f647a9849b6bbdaffeb07c162b1 (commit) via 534d3bcb2990503d8a739fcbc3362457fcc55568 (commit) via 39ff276c1c495e303e9dfcd70e2169950af3cc04 (commit) via 4f4294327d2941b0634cb4acaa7f35288a9b1f09 (commit) via 08955a2b29f50aea6fd2391d6064ad76208743f2 (commit) via 650393fb90f79cfbbe9bc4b89f0d0dbdd9e9c3da (commit) via 55da2afa7f1395c3ec20a6ac5836955264bb0162 (commit) via 6fb1e5d9c1221d4943b52a284668c7435596268f (commit) via c854fe518adb53683cb0336a9f1f722b9208e42c (commit) via 090864fa3997cf697f046200e1ea813464ec79d8 (commit) via 81608da0067cb1bca2f718e4973e83af9371a659 (commit) via 1d8a9297118f86ba40c0d2cc9f86b32552191acd (commit) via 86e7cdc5d1c6d8d8f173d4e5c921c9588f75679f (commit) via 49a524b79ba74a8bb37092a7b8bf60821fe8e3ba (commit) via 479f3de26be7267368a3ea912b0b52085884c55e (commit) via 0b8a9049f58bdb5ba224f74095fada7af4689ac6 (commit) via 844ac2201c4e98f19de695328334e7288197df65 (commit) via f6eab64c5c8eb76484f0502eb99c4dbefbbda7ef (commit) via 27f5340d6ddda512f7d5d12b088f177e6aa38d28 (commit) via 903b2901dbd09e9ebbc6dffced4faa8cda166a11 (commit) via 5eb951aa302676d2bebd74f630fece440db3b32f (commit) via 430dfdacabcb07feb4f4c1aa6ad5a57e97a3e250 (commit) via 7f81c3cc3c44ecba08bf58d219740190de3f55e9 (commit) via 4e95227f39b3af92e03eab1e7808eb2d031dbdff (commit) via 93630948e4efac18ad3f065365831a3cdb7407bd (commit) via 5d5485708d614c16740b48919f85dafc014cd14f (commit) via d24af1e1c2c49bd8486ec8b29a12a6e11565feaa (commit) via 4268bf84b06a66c98803e4998116390ea5d24da7 (commit) via 55dbbcf195b9ad150cf0d77c39693fe1e5f1009e (commit) via 82297de7532cbc6043d77f541772f942cde2039f (commit) via 836604cfd3bc5c0990961a14a22c31baeef0c9fe (commit) via da5b3822a4decadd818b1b493b78635eef4067a4 (commit) via c06a835822049c32a043d2824fe0c8cd05ed7524 (commit) via 08769e97b2344682a6ce856b2a69ea2e1bc34b37 (commit) via cd28c4fc98d8d59fe5c9537d3a4288d5ec89a8a6 (commit) via 568013bc6085d17a97db07822ff26df40cab3788 (commit) via fa5ec0e553cdf8d41018e1a14a62613134624678 (commit) via 75198fe4cb130f3d6d0d43f50882188879a59f6f (commit) via 656ecc1bc06ec99182a6b7dfb516c8ff14c3b84e (commit) via d8c7913b98c9309e5a12eeac52620696d8bf231c (commit) via a797a93feb8cc0f746f0dba404b9c9bc2dbb8f62 (commit) via 4098b4e289115440a7baa1bdd889d27bece2caf7 (commit) via 9be9d799f388a8b146f65fb272f5fe3d58993a1c (commit) via 40aa182e3083f6d418da46ec2ae3e6853f5c9c14 (commit) via 03f5d55fc95d9c3ea2516e8d7a852d1a73cc0eac (commit) via 34a0ca50960a152c3ca9cee5099f6aa9109f7735 (commit) via 751e0291ee9bb99119fec0c1cb5814919ec5d8f7 (commit) via 7e880ee33e35986a7435d9e1bfc6e2558b2a9e56 (commit) via ad1d1d2bab2716b9f7f4b7de2922dc2fb242780c (commit) via 3910889aec891e96179a8f748e594857588fb389 (commit) via 3e32e6ad7b63a16135bf0b2355608e86a46b9795 (commit) via 5b752c54a7c6c6368c97cf458340c71634c3ab39 (commit) via bc0414a8b533568bdbc84bdd78d288f056e8b231 (commit) via 818887f9d3d5095f6a5e29c0d72b0bd9385707e4 (commit) via 248fe20dcc59a38afea330b39ceb8f4aeb248b94 (commit) via 3a8ce05cc667dce575eec4d4aad8ea36cc62b877 (commit) via eaf9a41f52c5b88db7004baa03edc13a07fca0a2 (commit) via 358a3192c55816d012a2d727a88924788ea1afb8 (commit) via 4f89b514cd5c71e43e44a20a0da7ca58bedff5b1 (commit) via 525b0978caebd16184020edc935a60832095e9e9 (commit) via 0ab67997f9a267d53c1a40ccdfc86b8cfbf840a0 (commit) via b61f72906882b0f1d1538c1e21502e0fc5581282 (commit) via 90e58696fec3dc29f64eb43aa872a5ae9081e6e3 (commit) via a971e7de708d954db27ab8a8dfdcca2fbc7e077f (commit) via fe005bddd7eaf6bb2f8e3569b5f7563265c00052 (commit) via b49c366efb37d9eebd9f597d2bafb27d3709115f (commit) via 48ed9c2c5d5a5833096ca9f476b40d997dcefd6f (commit) via 651acc62f7ddcab09992ba9f98f66ae8303e7d93 (commit) via 4d7e4f1ec20bb0091ac3a978d3927c0191f93ccd (commit) via 638cbf16ccf1403db0c39104d18fc5d8ea194273 (commit) via a3ea8a8f201ed18e87d4693bccbf298a1abfbdc4 (commit) via 54359f1b7846819e1fb12fb580ce8c5ee69d74ba (commit) via a1e425029c3a123d1b77d8e81acea873af81961e (commit) via e80a40cf6835052ccf9750b6c89cd2fa4b776584 (commit) via a3b01c195be3c1454c60e634477d8c825c60ac77 (commit) via 665b12b1f534ab477b173eecfb05904f43e9cea7 (commit) via ebb613352939291463cb84ea931e6e260de601da (commit) via cdfa8bf7aec16823ec402254a185920e47582f5c (commit) via fcd7515cb2b0fc641e34ff04dd31baa9d851e9b5 (commit) via 723a598c24ffd6b70b67e1ee1864a87ba33ed1ce (commit) via 7732a675988694f3f8c182b2dec51481e1652efd (commit) via 94bd1a7f26df0f59652364e33f9e9b46729b036a (commit) via f5c36acfe2437835254210061030f179050f62b2 (commit) via e085fea23ec990470dd83d654c6639ed526420c7 (commit) via 1d7a1bd1311fe633669c7d48ba65e51ccbff24db (commit) via 4f9dd5e164b355d8b116a5f3cb0f0271c3366d10 (commit) via 1b1dea020675d588053f0051b5236dd60d115b08 (commit) via d29d83d74323fda1d8c6c50627dab5504c8441b8 (commit) via 4f9bbdc41b587dba82a93b7937847a99666e6263 (commit) via 4551ae51c3dcac7588962221d2dcbabe6792572c (commit) via c2d7957142fbead7b71f2d183f5de2e6893ab874 (commit) via 4144d518c60cd215915d9ab07a49425bbe701286 (commit) via 092d22a2142e00245c93f9a5a6592176c00188a8 (commit) via f804c75d99598cfce0d4e09c0fcef40bd8827f9d (commit) via 38968d15fe3250bb86751ebb099fd6844c6346d3 (commit) via a78922a21221b1c88ebfe0093c7a55bb4bfd6be7 (commit) via 82ad5278b3fac8adeebbb32bf155d024d423c43c (commit) via cfd6876c2127bd64b7c2ced80407b5b9f962549b (commit) via b5b2f6134dcc06ba994b1f71d619b8b4a5626b1e (commit) via a1a710482b8533d181bbf29eb67d2646036614ee (commit) via 34690e47ff48f5c52b13cfb7b2c0226f3c0dc92e (commit) via 11a7b1f9a0af11620eeda79ad0009df8bc65ee5a (commit) via f4d52d4caae78359b59d97bf596a269e47f4def3 (commit) via 9b70d9a7a565b7af2f6ee4511f687316d1ba5a48 (commit) via 709c4e5f9729dfad0862fa2daaf2f0687d04a56f (commit) via 1c4c84fc0ffdba48fd42154e7f0e85ddbb1c5ede (commit) via b84b71defa49a715d04d9776a5f0c7040103d6db (commit) via 299c139c3ec6c9b276cefce4d6f1568d0d7100dc (commit) via dd4bad220ca1f4ddcacfe69e720e7d32b744b6f9 (commit) via fcd6c54162a6270554de3b037c03398d7655732c (commit) via 1f26f2f86ad63865a13df010cc3c62e34a2d6d55 (commit) via 282b156207ccae94c8d80efec72c106cf7e3b4f2 (commit) via 87818abeddf0bf47c32392ce0806965536a0f8dc (commit) via 6fe762727acf216682470927a84023fbc559f0f7 (commit) via 2b0bba8e94fd352904e5bc46c802488aa1d538ce (commit) via 6066993d21568fa60b5319943f58931767513d99 (commit) via aa69927b8fec99064da113bd6181dd38e82e0d46 (commit) via a1a50c87ece4c26a389a8a879a04d4616a2c9e0f (commit) via 57e1c4a8e89fb3abdac3ce523b384a79f91275a2 (commit) via d349290f7b3f61e87bf47a683bffe9b056bd89f4 (commit) via a5fa887259d895c83361a26ab072251f61afb6f7 (commit) via f7f7b8096366fd892c5858358e8c1654326cb3c4 (commit) via c81a94485765bd1a5a437c2d1e0d318733677786 (commit) via 7c74af682e1c5b063aee1f1451692c2713742157 (commit) via 2343708a9c13f942d0db94281a953215297d5b39 (commit) via 668763f4907b1b6115827160037b867800224df6 (commit) via ab0a2bfa034aa535de9dae1cf7cbf03224ad2bf3 (commit) via 257c7edaf7d7e6151d11e5ef924d87a77f2c369b (commit) via 6e2f07f1e63a3bba9721ccaebf2a4d03e02edc9b (commit) via 9fd1c71b4bcd2f9bc0038fa576dc89688ecba9f3 (commit) via ee562c82e1e3e321c2ece3b5970114a31b693f33 (commit) via 1e0df408cfb343599e30df7ed41137431cdf4a51 (commit) via 8f452bc5199c6964518f9b505fa904493b3814e9 (commit) via 6b522089574944f85c94825f3b0bbc3ebfe8a715 (commit) via bad1eb118358e0b814cde075388c4e342992e4bf (commit) via 764b990849af53e9122bb513ce775df4c270eb14 (commit) via 27ea959b4b3418cea08594ff2e31e9ae6ad10e09 (commit) via d3a24be0baa8a98eabacef7b0ee7b3d088ada316 (commit) via c2262aba2be55a9df2a14be5560ac0227516cd49 (commit) via 917879fe65e0c7e438ea352bb6b87725edbd75d5 (commit) via ae7279f1741234e4c3209c7eec9e743791df1087 (commit) via 0f91359f3aec468fe5f3673c1048e8dc22556b9f (commit) via 11642cce3cc7222514f32397549354bb9e217688 (commit) via 0f937ca13415ee60fb636cdbb6e6e5121d4fcb63 (commit) via 9db4a8265c8e43d36a3333f96e4cc13a8fc1c37c (commit) via 6e24e8e67b345878553531205fbf0a2225f32349 (commit) via a134136ee715f6b392ec8bf3c5b3e31af7953c18 (commit) via 6014178b5b751c0d35a18f293fe1dec37fcf000d (commit) via d6ec16804a62e15aad034d6c6e226748ca522817 (commit) via 48a1ae3896561a0f57b0f362266b44526930b5f1 (commit) via 43dd86fb96f8a20b405df6f6fda932ad6cc2e017 (commit) via 7b1de56baa504c97cd42790fa3defc9f2182f9c1 (commit) via 6b66a0516bcc4d7bd9461366ea7bf958b4ef9aeb (commit) via dcce6bb510ccc2096350abba07ff9f9efb8e6b9f (commit) via 37753892f1033f90bae6cbbfcedcd88d660fee9f (commit) via a082c9e913bb3d777d29e4692a8a6e8afcd552e2 (commit) via dfdf4e1e23e527e82c6bd1c44870fbe59d1db312 (commit) via 871c871b80d314b08bdf82e40e5ea04193c0f5a6 (commit) via 526436fd1f8c15b5a8bb82557245d56a5587c536 (commit) via 2800ea199d6c233fe0aeee91de3be33dfee19607 (commit) via 2081bf97b9836f5299c22edbb1ead077842ea2bc (commit) via c44b7a74651d2b7ae896a9180ce1f84433c540ed (commit) via 3ff07445d4846f5b6c7b5338b396e60d330074fd (commit) via 43393f26d102ef63b24e776d33f53b5f44b84d3c (commit) via 93cc3dc556939a99288b50d8324d0299d0c61b86 (commit) via 00046ee0f232cdd4dd9b98c376ad849cbbb90147 (commit) via 47c9773048f134eff7517ed73295deb34c671aeb (commit) via ccbc2ed93c10ab5f791b2ae15cf68435bc1bb7fc (commit) via c602e04ff6c96450bda06718505989931d128d9b (commit) via 53346e494876aaa5af9b9adf39e7f510cac938ad (commit) via a24b9c9f68709dcf7cdf226aa75eecdaaaad7b5c (commit) via dd345b913bcec51f247da22bba045a227e7db320 (commit) via 72f99898d2dc3dc3bdd7365d1c113462d4d139cb (commit) via bb8d901c4f437c57b1c349575d5d93eea4fb4203 (commit) via 715d250e171a94736b19019ac742f739899ad997 (commit) via 20ba5da47991e2b00854ffb66985ce9388d412b2 (commit) via dcdbeff9d80202ef8ab0c9a3aff73a09f407b53d (commit) via a95af703237509fa55c07df6e381dd6b19550665 (commit) via 0235f0ba0ef9822d9e289f17360ebdf8b7980824 (commit) via ea2b4774441a594e71ad921fe4721318fa200159 (commit) via 8e62bfcb95fb3f0eb68214c8cb2586a3cfe8de8e (commit) via 102640ad7be96a2f23194cefbb1ca824416576dd (commit) via 416f6388c3756b92b99bd36ab12de957cf55409b (commit) via 2c8d5d8ec9833f02f6a7b58079dbeb71da0e2456 (commit) via 8bb15b270c635a75f2bed3d007454171e7dbc73b (commit) via 5fd5ee0d4889440f443446994dc74be157f78653 (commit) via 3085523f568cad7c9cc720d1899783fd33128bb9 (commit) via c4154633cca4b5b9764e192770d08c04f71a6970 (commit) via e9958c5b0c37b44ff4dd644245412a526ba6118f (commit) via 2324c299177be42375610c4928a3b77e60a8bf10 (commit) via eafd7e5e15b2a5b6b28d75e107a1490e60e64563 (commit) via f93897390bfc89ca54c35b6df0924c59e5d8aeca (commit) via 1c01144c207d7462e93a6955a5cf129373e84df3 (commit) via c6417fa2b389364f83e6bad6fdd4ff9f059b589e (commit) via e5855be613158491cc3b29778c76bc4ff021a3d0 (commit) via 56515c3a643eda32d8d527a215d4934e521e5e07 (commit) via 1d668e25ab8bfbf92bdaebf11a2b756f22895b33 (commit) via 6c6eab8c13d2d7dddcd078a25f8d64bf94cfa910 (commit) via 905fdcc2488dfa0b8cc8bb4d2f0f199704a943b8 (commit) via 36b2346445188c279b8d3da2c139a0ca862f2511 (commit) via 739ac99e3b80a15c81def7f65e24b035a96b3602 (commit) via 7997d24f33eaab50ed1e9068f8326e6e0dd706cf (commit) via 6e310ef8fc0d5b7e00460b7603f6b5854aa61db1 (commit) via 0e83cbe5cae49a326ce687d1079471dd072b915b (commit) via 7e047c3fd12cf3d6a4fae02021ea561512041d8f (commit) via d11c83b16e79f20d00082633d03c68fd0c6c0930 (commit) via 7f8ba794c9d60d560968f8f61680d2fffd6c1b31 (commit) via 0ca7930fa3270bd71e5781539afa7af8b9c975a4 (commit) via 2e51b571b08d6573936ee787088a72df64d37f65 (commit) via 28cab5ed46a140b70d92ea27214f445dfbd26467 (commit) via cfeae1ba99b9c6a545a9c7608eca4b7ba1f22192 (commit) via a2faee2023041cfc0cf41965b4a2447eb6d2c75a (commit) via 321013efe74037a098e261bf805a426c27b75dbf (commit) via 84c7fa2fbc43fadd37f406dc7cd6f20db1221386 (commit) via cb2d073632211b8459ca29aba4785c875bbfc8ec (commit) via dfecc914876b164ce64c53c4f048aa38ed65d9c5 (commit) via 3a645dee60b50ee188cb3b0a34866c728003059e (commit) via 6d21b59fee891e343e963e2dd13018f005bbdffb (commit) via ce25c9186f38b75bcf9d4967210a8c07020cb0c4 (commit) via b2a3bbff9bf470d4376680535150ee8cede158ff (commit) via f87a32c66a059474f160a9055e7d582c424c152b (commit) via 19c0026581f8bffc7fed0b97e31c7067475e7a65 (commit) via e8792d0ad3742f5babdde4e1ec62cf97cc5deb66 (commit) via 2f0105d0506a0101f546c8f27c4cb0d1a766ee5d (commit) via 7b59313902498fa061bbb6b096ddd9fb3094774e (commit) via 577d7b5538f3ce2017092cfec54532a10d3382b9 (commit) via 009c41d460f1356c67240ff5ead72376f532a709 (commit) via ee5d1c4dcf134a78756c74e2c3a91172f48bc240 (commit) via 349e9d5913f953ec6a40b24b9ea4866cfd2eef43 (commit) via dc5b964bb12b0a019f3f58fe7cc67ac3976b6d80 (commit) via 55203ed0d72d28df807ea9f8d326e00cd77f5ee4 (commit) via 19d1385714600212c47f06e8f4f0c7fa06e18c29 (commit) via b7c80a8490e00ef1c76dc9eeb8627f92ffb18d48 (commit) via c312454f0c3045ac34a1c0eeab0506b2230daafb (commit) via d5470961642db233aba14432a66195b4acef370f (commit) via bbf1cd1f437d4a90b2b8bf7b9017c3786b2777f5 (commit) via ff07022c264c4414c5a51299b71429f8da2f37fa (commit) via 1347983883fa8bc90400878af68b31f80242363c (commit) via 6fdba3452a737d0385085ad7abe89b299d6f301c (commit) via 666e9fc2c652ffac2c13a2959ee04f9bd34d5082 (commit) via fb9a1b05accf3fb8a6eb3daa288fa3ffad822dd5 (commit) via c5e2fc1571827e7bd861ce69a6878102fe16ef13 (commit) via 98ed05cc9800c205389b0f286afddea923cab757 (commit) via e96d8f163012d52314a966128dc9f63cc2430538 (commit) via a94bbfe1df3e7498d3246096da510bd8c52d9917 (commit) via e9dc863e21635111f6fdcc8c2d0c4fd6ab2f8e14 (commit) via 8c057921f3e5c889cd148e461ffb67932dd78fbb (commit) via ff455e63f2eaf9140894be1b45e1801d402fb0c3 (commit) via 002181e143e5c56c554abeeb37c7611dcdad8536 (commit) via 3406d05ba7fafb8e20f69bede72db3564bf8b198 (commit) via 0b716f21b4caac60d01c58ef5471c97421fc2685 (commit) via 86c484c134ca46edd572c3b46c6480ac9011292b (commit) via fced79a4933560500a5710af3c48019da700948b (commit) via 1a730cb715af3dd52e93c6680d63d04a0ebfd703 (commit) via 6e24f55859138d092ac38506085676078162d0a3 (commit) via c6e7988bf87c910ce19366c40694f1e14fd58cb3 (commit) via 38ca557ad931559b4d58d8fc4de986a4ed1405ad (commit) via 8016813234b471e5636bcff963f5a4ed3391d972 (commit) via 7b371be267ebd4dd3b74b6a1d21304c0ac527731 (commit) via d3ddd29e8bfc2b36f8c7c2d475c1d4cf630c8388 (commit) via 502116e4a08d518cc119785e44049aa9e6a8059a (commit) via 5ab19aaa23dac4771baadd1f2a2b874c8c630154 (commit) via 3c747978f4b1dc395846e90f613fbf2acb6324db (commit) via cfd4d52dd07085c2dab6e89f4c7be9a7b4f4287d (commit) via a15f51d5772c47fe3a3e49542d227dad5e7e9944 (commit) via e680c821297c26530b118ab4ef77f030b1f6e365 (commit) via 36a84423e7c788a73348420ebcd9dcee95d34fd3 (commit) via fa05585f1a55255ec937ed2cb3eb52743613b972 (commit) via 87bb33ae3a79c7c6abb61d3e7b74c84b3562f30e (commit) via 499eafb2e02f7d5359dc7d09aa635c7f4dbd3c69 (commit) via 515e0ad175bbf5ec847669b3bd50fd46c9bdeea8 (commit) via b02682bdbee84142708b4a8b97ca67ad4131ac9e (commit) via 1ee94f343a5ae31e1d484ed51fc5b6dbc5f1e941 (commit) via 5aba96e382793c2c4440a658f7c1797b6c8c2809 (commit) via 14113f23b187bd1d25122544033b52c94d0ad905 (commit) via 648a124c3f777bd79635ddf8e1d57b6c4c741cfc (commit) via 997151838426d4f2de8c6f81a836fd0323cad17d (commit) via 18299684bf953f6cc635938a2084bb333ab275ac (commit) via 315441d219fa3accb4ad159e3e33226523b59cdd (commit) via fc2f2790c0acc23d98e05fa8237052789990a72e (commit) via bc44d99a45d816ed2787bd1b1dc7a586ddb1e5b7 (commit) via 68cad2aa950472b209350febcf76c0d4f9c5ee99 (commit) via e6250bcb9493aae8a3e8afdf1502c8417b110072 (commit) via 972500fcc93f816e0a70fa7b64da6636607167e4 (commit) via de23c6d375cef19961bcc82b9c3f79d32a95190f (commit) via d6583acd3bd4992798092b32cd07679b3d6f18bf (commit) via 15d18e7a15a80b6aa6f60ccc8c9fd49bf38659d0 (commit) via 71a902d258cbea2302faf75b3bfa058567c49200 (commit) via 32e28540db33d19109d32247d2395bb749cacf1b (commit) via 72bcc01b1d975c6d2667cd4762addcff50f1b140 (commit) via 37cdd5b93466811988b6a413165d579a9fa548f0 (commit) via d25cb0282b1d6db944cd27eb7e87de484eab8225 (commit) via 10885336264f64ad8b737b313aeb70089cd6e57b (commit) via 60cb91b042cf62186a9f967ab668dfc6c919f6ae (commit) via 6a36b8f33faa20d4c4b1aa516feb0c6bf30be429 (commit) via 179fa43c9ea1f7d03a17a6cf1c56fb8c0e4c387e (commit) via a40f92674f8fc7c07d531c5d6d11688c4b2aec05 (commit) via 96e4a6b7d658c76592a97ae2ee755ba9025c0e5e (commit) via b4cb165115eec01a83cd2ce9c00cb1b8cefd5e20 (commit) via 5d288a9a4f3feee2eb2bcb536a6a131309d2c71d (commit) via ceaa7b1c33beb255b371f5c942c6467ed74caedb (commit) via d4f512083f14b0ff7058df292a16424be758d3ac (commit) via 673fcb6572401d909a44f0a0d4bda9ee819a9027 (commit) via 9350fb96265961fd87c1bcecdb4e0123cf77234f (commit) via 34e44f92a193291a4a7303cd6f3e0b96e79ab080 (commit) via b49072aed6847fcb74a157657f2773c5d29a6e94 (commit) via 55229829360ba09ac30b45d2c1c364440dc0be8c (commit) via 22df1818c4b15fc50a6a3050bc5123423fcf0fd3 (commit) via de758ca22ae3fac9de2fb915fac5ddff00c86c19 (commit) via 430556697e38ac616ca14fd73fe7bd08e2eeea93 (commit) via 004cc9d7aa52ee541514490c66c5e517830be8b9 (commit) via e37ce444dddf2764d40c22a35983edb7c55ce94f (commit) via c05cae9f0a005a5bf43bbfe131ac5d82338935ee (commit) via 3284c76150b383ba9b690c8519b75e6a5719cbfd (commit) via 8f2ee97ed1d19b3985742a53e232ce5184458f61 (commit) via e85ef4cebb9528cfad4cc31ea16743c6c293755f (commit) via 7aa72b67df8beec7996e3f7532a234cb61e6e26b (commit) via 3501087b4d314d7f194f3e705fde989d502a229b (commit) via fdc31908faf217d2e3bd011ef84aaba2bbbe0680 (commit) via 6e05e90caf09721a55deccff5f80ae8ad5a78a11 (commit) via 50f2686fa1532158cb12d8b8f60dc04060f7ac53 (commit) via 8b80661e405441761cf1525ed95d03069a2e03df (commit) via 9cf15ac04b6f47ced2e6be14690301f73bbb76e8 (commit) via f41ff727909317e2e3d4c11c5bccd8129d455ab6 (commit) via a9af077eb5e9ff40dec23b9046829332dc73dbde (commit) via 8d57adfc61a6a03594893441e5f2e3854331565b (commit) via 74f34db2d5f1ea67cf9b6159190ab86b4c6a2e30 (commit) via b156f4d03f6d3a65a59fe7d6f0217fca2c8fdf60 (commit) via 5d7c09ed779cb5ee6c97ba75652d25e28f878fc3 (commit) via 1e3a86310f2382664061d9e3b3540f20d93c2599 (commit) via 1c636e800389c65b119e40193ac85354ac88194e (commit) via a024f006de31afcf1b09845597d300f6cf4248ec (commit) via c75e5150d11728372b4bbe335109aa0183ba7bf6 (commit) via e505884e6cc007a1b962e2711fb9c961d064cf0c (commit) via 230cef0fd1e1d81948faa57623c9ca0bd04b7a17 (commit) via f5a9adae92e3ccf32c2a02dc32a182184c4b05d1 (commit) via d6d6a9ed9e0db9a067e061fa73eada17b53cc760 (commit) via dae177ec30bd62a59f3bff8423963ccb3160073d (commit) via 8dd33bc8ccd25a227285627101f28305510086c0 (commit) via 6faa4c91c32028476f5df9af271fd4c7447f2f64 (commit) via 8cf1501203de1481089d3576333fe10278da23fe (commit) via cf7d91a769c06accad064a1b41a98a28d4b138b9 (commit) via 59ea4a1b9cf788f20166708ea02c33568acf93bd (commit) via 7dbb4834e4654b7a0574b3da6337c4216edab9ea (commit) via e0048ed24e7eee9cbfd07b7a9afc1d97941cd270 (commit) via eab0318b7aae921520b974d2aa44081866fc04b6 (commit) via a440210f44d2785ca795bae069e3fe1809738170 (commit) via 2673bb77a0f4e4c2336e038a41f622a7af0f0bd8 (commit) via 60ab93e36c95d28530434810962ef8b102c8691c (commit) via d0f403b114d2d446cc7def0ed5acccd9b4b5280a (commit) via 90b0718d5e3248413ac2a74b8bc7d81b3e925dfe (commit) via 980692ba9496fc2329389d85c4347cbfae6a35bf (commit) via 3dca1cb33209a00fb41dec062f79dee7ffac9b12 (commit) via 1e2ce092b30f9c8abeda9237e2c63c16dd08f577 (commit) via de66ad246f076e85ccbab4f1df0fbb23a9c86957 (commit) via 12fc65f7a38d47c2ca2df24b5f0993ad40a3d4d9 (commit) via 7039ba47a19c02907ce8b180739676eb7c5f42f7 (commit) via 540d486fd05778575acda7cd743ad28a8e25b895 (commit) via 04a092fab5232ab0ae0b3f7b2f2e913851a27fab (commit) via 383395d12509d35b85dcd8383e53370247596544 (commit) via 3dc8d5b09a8aefd19951f54ddbad153b3fb27877 (commit) via 87d582614250e45c7a6834ffbf58911a34d0b674 (commit) via 7dcddfa8817545833b39a53486e9fdc4e510e8b7 (commit) via 71e8ed8180d50227cf324c218cd13039c51a51dd (commit) via e1efaca21f344459a84ba5e0140b0f58df068b8e (commit) via a5a4a7337ae256b9e7751fa1380e6991c0f1affc (commit) via 13e8de4abaf594e90d795480f4d22fc5e61f7ed7 (commit) via 5df1683c38851b71ac0f74fbf058e32437140c55 (commit) via 1b7e4a0df9b886c42ca517c7577c88a763b8a075 (commit) via 85d2395d26135a862b3bed07b316c0ebbf14b725 (commit) via 6b52a43314824943a3ef19b86bd577d5729416eb (commit) via 9d021b8dc4340e4f99f94984c8c7717d513d2e9c (commit) via ca28a80658d50a9fab14f3022c40536b385b6b9b (commit) via 43c91d5fce868bc7a6b9055494cd3e0d46ade964 (commit) via 1cad9ed8a9a958080afaf7dd692520c4112d48ee (commit) via 1ba98b02b9b2a44d1504f5c4546a7088907ed4eb (commit) via 6b611662c26fbdd1ae96d71dadd243c48b725ab6 (commit) via 92f43440729f16831fa9a3e840843486a942906e (commit) via 2343f68597f7f5d2986aeef1f85f579add45b0c4 (commit) via bc34a24d4c7a70f5b526252495a19ba5f3d2de86 (commit) via 77a7f93d6799ebf7cfb433af7a78b2c7b6ace60d (commit) via 82394b37687cb43ae3805d14a7ed9ca20da95a63 (commit) via a669f76f786e2a74d3621cf5d4f9b0ad30d7e89a (commit) via 35ba58e64994efa0a2c97a08b5164a5ea9f20679 (commit) via b6d024eae617ac8fbc6330eda26435e2823f8d34 (commit) via 086245a70103f87fc16eb294e23738cca95b1817 (commit) via a1d6596ea627285828e5425282c60052c4a88b27 (commit) via f0d15785924faa8a3de2fd9c3105a274e73b748b (commit) via 15b5170b14396e1e17b6f75a3da01695cb49eff3 (commit) via c4369fc84dc00348169f0e7adc9a0169d864ac96 (commit) via 3d9ed976cd7fada0b0dc89cc3bff84c7d11a4419 (commit) via cefedc0da9a8248cbebde655ecc73701d7cfcd1d (commit) via 4fb2c5ca666692bd25428ba0210562808cc4ab47 (commit) via 1f329ad521926c5af22a710a7e473daec0177f3e (commit) via 93ab7fa91e652f4b7018f6f82e878864a965622c (commit) via e3b070c88fa02406890b35e554f5c0ac1ad6aa36 (commit) via 3caeb58533226ef42283e1709fa2d24295bfa3c9 (commit) via 3934682e9b616f9117d70f05965e8c5f3bbc3269 (commit) via a27bdf3f5b083f65aa1a7dbe66023e930cb59979 (commit) via 302d5bb18f5604c180d1eb3c48b80929e1b306ae (commit) via 5b15e03f30eabcba91b0c1bec09a489221bbaaaa (commit) via 2a00d3ea1300ed918d713840c99b9313981f0799 (commit) via ef4a4ed03498769c34bfbb22fce1e100a3e3b5e8 (commit) via 469728a8656431e334e77d92d398cca05fa6c4a0 (commit) via 006b3165cf7d0e512e4b3d7ed23c92f2bedb1d22 (commit) via a523e7755c111023ec767e298206fd7657693b94 (commit) via 136fc8aa954cf7154b75a72297e76b94cb92e3c3 (commit) via bce61e7f926ca424c04340d217ac5ee3246fe454 (commit) via 8b0421ff6815457ac9b21223db2bbe338cd782f0 (commit) via 7630d47e0e9efb0cea1f2a2ae7f908fee43d80a3 (commit) via ed5266d3ca944036165a26d06eac3a3fcd0b88a5 (commit) via 74f04959b4e27f4af677c960c82637e874920395 (commit) via 9a25519496cf5299b0d4d59ea1ca9da56b008432 (commit) via 2572621bc914e30cc22e79749264d67882d0aaf8 (commit) via ac2998b61f74e06100ca988eefdb608d312d1098 (commit) via 8825b6eac893b8280e7323133469eb24b79ed8db (commit) via 9a9373c0bb42cf0e57c1b08e661a14b2a7760369 (commit) via 80174cf39fa6b29c45232b231f7f169224f975a7 (commit) via f7279386e423d7f525211f9f929242ca1e4baf1b (commit) via 7a7a387f551a8b2a52a64dd3590f73e29ee5112e (commit) via 0b7a2d4c92501980983bd71365f339a674a86a3c (commit) via d53db202435868cfac98ed0ce6fe537d84a4947d (commit) via 8fd62850e4ba65a249900c044bdbf057e1117477 (commit) via 17fc3bd62b640196825f3002732affaa9b22da85 (commit) via 546a2961cb5fa1cf056b682c1a4553381d9ec75a (commit) via 894dea2803a66ad933899b4377a9154ee3f16394 (commit) via 2b126a1510abae4364341d29d49cb31711f2119b (commit) via 80031c3e17d78c50d533644bd4bbbbbc181d6252 (commit) via ef8682507650792e6a3c38b9a5612526ab0b1ecb (commit) via 86657a6c0aefb1cb52f47c77aae38415bc584dfe (commit) via 599a200509e4f164aa494e1798f61e8138d5d20a (commit) via c7aefe934fc6d603b7756406528f6881af198b0b (commit) via 54a3c95cb0aeb52ca1b8f6cbb80ca0e5d0afdf39 (commit) via ca2370d0a6bd88a1121f242cf854dbb8c636a734 (commit) via 1bd4de4fd95c4dc33a379f537f93ab36f4134d5f (commit) via 5c747b699cfe3b2e19a3dc66a815cf7bfc9574a0 (commit) via 2973776b6480309a5fe95aa8b2a3ba5151288c6b (commit) via b8fb8acca152a5850b4a0fa4c0625f0094909059 (commit) via 1b3c306636af7d136514e64c286219d9dfecf95e (commit) via 3b0911aaf367fdd459c7ac6490d3328c8e241f09 (commit) via 39155c614cc133e363f8fd91ff68c76a67615090 (commit) via c9fa092a9ef7a48ee702a729da2d8c30f62e7d65 (commit) via 535a578ef6bcb3e40aa9da3e87dcad59c751a003 (commit) via 7433a1e5786f91f07f3b13f392596943062b4a13 (commit) via ffbded67fdd5dc177d950be82951d3fa6208cf24 (commit) via d32be19c00308d97821ee8e9cdad48a8b7f53228 (commit) via 78036cdcecee3c585b54e819e4519b3b51ad8012 (commit) via 597aa087db0633cea368360fdb3b552283ea3c7d (commit) via e79488cf49c70b8d4a73b2c68934565d8427a07f (commit) via c1e79295e4ff1b37147f97f866bc71a43464f443 (commit) via c842466a6845ed3e81b292c67e456c006b72bc89 (commit) via b7c82d4c2efa974e8c867826253732139f9fb385 (commit) via c57c17604c175e9c154d2552c608087a4e98807d (commit) via 37ce4003e129097e179f213c86e00b3307cc1738 (commit) via 75bd5642105532f80101fc84849b96996d710a04 (commit) via 6a9a27b791a231b970b37eadb1ebf927b0c30bea (commit) via 143949941c6a1e4ae68c7ebd86957525caf2242a (commit) via f987903e5ee275ff4afd27245f322e4b8d9eb8f3 (commit) via 8b0e7d2496e53fd78aae4764c222e2dddfc4bc2a (commit) via 9fbecc60bee1601cf7a53775ecaa7e97229cca43 (commit) via 5eb172d9f3b3e718ac6e2ac3a61cf2412b82be61 (commit) via b814dc17ce5aefded953fc7e30db257088f70475 (commit) via 2b0189becad007b0683272a0a3d46a952cc520ed (commit) via a5d53b8a38b770f702fa55d72e996ed54a32f181 (commit) via 03dc3b7b8d734e5a916c0dd48c408e78e6f66f55 (commit) via b017931c5eb6ea4065060e9b7f22e28274c87c15 (commit) via 8b61fe440031ae1c66729c3d9f611a91511c8c8e (commit) via a697462a589cab5f70e5608e33837bd6e4ada14c (commit) via 17efb68d1d31deb7cc8d6fcabfc145e4d65da3f1 (commit) via d73cd50e99529ad9572b5d2892736db292d8367f (commit) via 6a948bd98bc29156774d09210fe07548fed3388b (commit) via 4bdcebde822e58c9a5a15598619cbdfd87133a18 (commit) via 473a04651c3971883cc413b1ee53f4c1ee3135ce (commit) via e82828231e7634a06d0230df865bbcf5496f57b7 (commit) via 89245dc5a1f6c4938fff0d760c4660e0bf7974c5 (commit) via 364c156cdc3f078ba423208bc5c6bf0af85a471c (commit) via 61bc810bf8f252bb33946cb23a8d66a78036569b (commit) via dad92067daa6d882a640cccfbf503ec2f800085d (commit) via 0bd8d187e0a58c708667416f63f30e30c344c295 (commit) via ab246b9b58e1b1f1b511514511ea3ba49c1d94af (commit) via 1526f83c091a549bd758b86b2237500e88db70e5 (commit) via 9f183fa4b15ec9e5d2249f5da63dc2af3a25d9d2 (commit) via 58c28aabc8c0ef3cd00087dbd67640cc85d34a71 (commit) via 6e07995bee1b75c3d7f9e87baf2bb5377fdfee20 (commit) via eb109a85d5b54b47e54567893cd714b857865984 (commit) via 72710484b55f3dfe7c759c318dfd131d6c7542e3 (commit) via 10cb487cb02917dfb563872a8146a67af88b20d9 (commit) via c059649f8f9d812ec284150f410c0a6d0c77b2d7 (commit) via e1e8417fde16bef30a79d96ed556d6ce986d17c4 (commit) via 2f08cb6ad0ea966ac51e62d7f8dae8ef1d5088ed (commit) via ce67a4d39b995398cb9899b5b4152560a48b45f8 (commit) via 4a6be5477aaf72d732292b50674ce2d83947e8fd (commit) via 05b3b327a4e89a410ad8e4f50fe8790a2942cbb3 (commit) via 21c2a74840ee5413b822b254786310a14f2100f2 (commit) via 8966b4ba6e84f54b8b8262d5cf30a65b686c136e (commit) via 2f2ebb73c94dbe4e79a032f8937781fc30e53de4 (commit) via 8aae09127344f4a518f8b3a30d9ddd6401aa59af (commit) via af5f0a4acd0426d63791d8f1c7a18608de3955ff (commit) via 04e854136675ba1369a73af712b12971d4ee9c69 (commit) via 38f994206f075acf461b399f0e512ec5795b0083 (commit) via ec8f2c2bc2b65457ab6c6684769463f54125d62e (commit) via c109a89e4e81c57963c3cde28774243fce4203ed (commit) via 89dbe0b0a09fa52f47f24884c969d1ed3ef6b6e8 (commit) via 87edbed6bbcdb351b9502f66e78b01116ae1ab00 (commit) via 22047f93377fac0c763934603001085428f74d3e (commit) via cf398e1a442bc54c05d68837fcad6258cecc7dfe (commit) via 8e142ff22abf13f98eb4355eb98ecc14eb6ce10f (commit) via 0d87954a46b6fc98ebf29d5cf761a1e011ba48df (commit) via 90c156243c89f582d242f13f332a6360659812e6 (commit) via f1789ed5a23a8684a384ec6ce39f003716edfe2d (commit) via 6dfd39c5f3186000b08a1fa500a98a4a04d65724 (commit) via a9a31041d47b89c7837ea3bca705da91b40f6d48 (commit) via 53c41c0463a332447fd5cf1007265dc45446beec (commit) via 5973679e3536e50175176b26e29177a409580147 (commit) via f61051af9118ffb67679b8f5634b318194cdbd88 (commit) via 6c4f49a888f5953f977816fc9e2a9ce4ec8e1400 (commit) via 2783face5ffe68b235e3a3be699bcacf1e56280a (commit) via c74573cb16f8892666f16d36dbdc1fe1c5ef7c46 (commit) via 5c128405b836188ba02f989c0c682fb77c6de2f9 (commit) via 553255c63195ecbc87cdaa72394e425bc6a0f52a (commit) via 15d02eb930b4b4673767581bb60c3ac115b5ecc8 (commit) via 67fa716bfd78e7a0c78dbe817c8c33ebae4ebd1b (commit) via 995c25051829899f64a6cb495b7913f0d78b2183 (commit) via b004916036465d145d0388a1afb24d5471b48f64 (commit) via 8c9f23ea566ac746eb4ed40cdd7816309dffaa45 (commit) via d2fd5ba0aa2a968031dc0719576da3f9d63bcf31 (commit) via 3c76811f0c41998069d21955a306baf3944c8ed0 (commit) via de417e99f0c41421f701f86ee5e4e507868be81f (commit) via 42a4a3dedfe762268d935e5fd5e5de6e0f1d024a (commit) via 0a11b9b4333eb960038feca7972470f3770a5cce (commit) via d96eb988ff7422dc72662b51ce1d0cbb036138e0 (commit) via d4138959b2eac09313c420e158f2488ece7080d8 (commit) via ad7c7f1323d64c255b88f13610fc9c0341f86dc1 (commit) via 86509640e343da132c0a06461c0b9bdde7e6309c (commit) via de7a9843996f31e29a08fa93e2bf7b600e76cad0 (commit) via 5e562ed55fc48514f0d223b2e2076f84099f7a00 (commit) via 4d41a0f3a2ddd74e0a95b31f3766a71f80d1045c (commit) via 180f58a677a2ef49f71cbbe377f9eb177e6574e5 (commit) via b32ceb3c228b33d5640cc5253f6e88d7b98baa60 (commit) via b517ddd6d3f1090fec83fe91c508b5f8bb19dd2a (commit) via fee2f1b701c5d454caf2e1ade91f75d7d234087a (commit) via 5d28a8fa057d948464588226598e94f2c905d20f (commit) via 05d1fd2a66e6acb73937a0adae23563f6ee6fae0 (commit) via 1c1df1f77239b32701cdcabc9eb63f4974210d53 (commit) via 5486b8c74d9b853cd74229689dc67800cd722c65 (commit) via 21e1f69b982682c8d135a52193dee3450f9d53a4 (commit) via 8be0cef9079ca3e2935798412739e7b83b1cc42c (commit) via 4f343bf892d75f00d58d3886d07c937888dfe4f5 (commit) via 9257e0f34459f6087d37843defdfadf75c72ac39 (commit) via a9b2ced2aaa56311237c8437efde13f3d5342600 (commit) via 055c78e61eb4a4de76404d11c221654dda2b301d (commit) via c5070aaf52bb37ec63731e82be04f8e78057df21 (commit) via 65be57d212e601de396d57821bb499a4d802a1c7 (commit) via 0b377051af622ac8974e990f9244e9f69bee90ce (commit) via 525f399812e389ec40556f8b4a9d1c9e5fe5d2a8 (commit) via 68f18efe37248bd6797b055b31711ae1c7f2e782 (commit) via 3acc5fdb642832bf2b91c06fadcd221660f6e6ae (commit) via fcaf2677574df7fde795bb4e11f8d843ab383442 (commit) via 97056b24c0fc975ac7a92d344992e13e6c0d320d (commit) via a2add139638907d3c36ee935c2f0b51db7821fd0 (commit) via b1e773e7873345ce327e9e736b2aec9e6cb69901 (commit) via 9fa6fb5e022397c72e0f49511a89119e412b8558 (commit) via 6cfce6f43d48867fcc601eba500253c631df906c (commit) via caacb24500b1294a93cea6fa5345bd9605492c99 (commit) via f3e55a26ef069a6ba5c3574b6c31a00d0299bbec (commit) via 97c65a004ee9e9b88dad7ff4ac1b2ec893b8c5ba (commit) via db91f0e81ff9cd6705f51dd58582d393aeeae267 (commit) via 6941c6eb71cdb38fbcacae03c00a65d0b0c6724f (commit) via 04e57577b3561e2fa76f86ff4053fad6b0f9c6b7 (commit) via 0eb33e57617079f0d3d9a8891f99439d45ffd29a (commit) via a09bce346eec10bd282385100dc1ec9733ba3c2e (commit) via ced7c9ae43af218f2e02bf44032916498f7b90ab (commit) via e98b4a6b8dccbd22e2bcccb04ae992633f7fee3c (commit) via c1517e99d196754bd4089bfc4cdd344c126530e9 (commit) via 0286af421bb0ff4f391f56938ebbb25e99e84b46 (commit) via 96b0ef9ce9ac14fadace32dd3a087d37b34c1c05 (commit) via e17201bbac873aa79679fd0ca14f1edaa0747eff (commit) via 4f4aee4f07e2cd748b5625b92ddded79ad779a18 (commit) via b0cca151e60063868b929b5826533850569d718b (commit) via 47af9933c425e2921d4350dfc78206b27ca01be7 (commit) via c12f81cd0f24a8ea5cf7ce26cf83f88e3ffcd4a4 (commit) via b160942bc0e3c9d8c2a7d4f377c2295d3d5ff655 (commit) via 197e4b71d6eff64a8d3843d58ba99ead4fca970f (commit) via 025c82e76f296253a112896471f54fac9d14d5d5 (commit) via d0b6117325ded66fdbcb8a8c3630386e671675f9 (commit) via eeaab3a02e507f273bf140845a1962b4c757895d (commit) via b2f80417907503d55bdc0857a2c9e7e9edc0771f (commit) via 0100eff6352f26627acf4c22cd1ce108b475c86f (commit) via 1e777c2ce9c70e34bbb27968f4727a92a4f0f249 (commit) via e0961aee3a46001633c51053f6fca71317d2265b (commit) via cd95138427e1ad55641fadd60c161e3899c2b98f (commit) via 3be3cd762acdd9750c2b7efe0855c201112ff723 (commit) via f079f898cb4c0ead58f1e668b711e0fef640e1a4 (commit) via 70dca6dd4b05092a5564bba916b66a3f7b27e7dc (commit) via 8b68da37ae026257c9b3ca4f1595f1e839756b02 (commit) via 93aa30076b01be366f8f1c487b7b561f5bd7e074 (commit) via 086c397cdc920b67382c3c35be3d9c10c4ff0fd3 (commit) via 588a5cee03c497b2715a68037a424976a76f015f (commit) via 6cbf8a0167d9a3d79ff3846e14bc90dbf4fe7371 (commit) via a2e16ce83c4a4adb81ae1b24361a57f7004de01f (commit) via 9ff4cfd5699f4f9c6fc6ae0c60c5114ee9557069 (commit) via b278dd2379e455ef1f256b703fdec1c292bf4179 (commit) via ca8c23361bd365dd180a35c4d50241c53c08f246 (commit) via 1074f006a06c09719319797aad6dbee4b837d087 (commit) via 3df1476a6d8d66b21f1802628bcb747f476c879a (commit) via f331303404a854d2ea9970bdb3cc2023002744e4 (commit) via 42edb9cfe9a238b355e89afd7b80eedb1fe3738a (commit) via 6be15e958e3257a5e4efd6ad6fec3b8115104957 (commit) via d7a136cd1a836c4172a16dad2a0000fe5464794d (commit) via d872408922ad785b5f2b9a05cffc26e83d61adee (commit) via 180feff1f4be0cc80f65b921d81ca25ce91fe3b8 (commit) via cc8d790cfd207e313effff4e4b38646b0c0b52eb (commit) via b1cf0d9a156fec620ca5d34d3f9a678b131cc046 (commit) via 31cc2502f7ae9adbfbd541d63eeac7651afeb7e5 (commit) via c9db28c25ff1d6d8e680b74ac6ddbc83eb029c9d (commit) via a0b164c1322e1d08e3d3a707d8d3ae53551772e1 (commit) via 28f5d287d44035da561d44825318d449a33c54d6 (commit) via 4eef1522502d3b510b22e96bd76612290336f5f9 (commit) via 8d66f382129d7fa041a41f3c6d6d8a4d110a5771 (commit) via 7bd0a5a63d353c77c2ecfc2921af0cf956bcc043 (commit) via 794db40e526a22d8c8f5a4ebf322bf1de2b5d5fa (commit) via 633599021a71f2e61646200c69a9713dae369a9a (commit) via dd4fb5bee5641fd2ce5da04979240cc7cff2fc9e (commit) via 3885eea76520bb3cf293e4419889db86be45c313 (commit) via ff7a617098756610f3e5564d04affc8d48b4652f (commit) via 648eb58fc18c12d29648456a92911a6e905b31c0 (commit) via b36869498f392044859d864ef5973ec496e4851c (commit) via 49b6237ed2dc0b536ffd8114e0c5f233e133e3ff (commit) via f53ce50a4caca7e5e63fa4cc4bf376fd2cb77fd6 (commit) via 0a8c1a04c48f409e827b80ccb8ea562bdca8a9fb (commit) via adc26e63165aa22f8ddc580d7462703e67e0ee1b (commit) via 25c56f6dc9eaa46a6c5b33f357b618f596bc905b (commit) via 5875905285309a89d1e83463560d8ba93f247512 (commit) via 10119e9e88b0021c36558172cce1f3a7da0c88d5 (commit) via 4bbd9a4c0fd9ad4c23921197dc92a63c75656f21 (commit) via 0a0e79e1fe75307956f4410ab6c61205c0649e28 (commit) via 9e40c23cdb233bfd67d3ab25f3deba35e96ffb25 (commit) via b7d92655621e5d2d3542fa945adf6c75946522e5 (commit) via 55975c7f3c1cc8eb581b3ffad489698bec88f88b (commit) via c57d5452a4a8674928953fce3c0cbd51689efb32 (commit) via ab87f627f77be6fb1453ac1c91b8c896a2f36469 (commit) via 428d05349a343339820b16d65c742515885e2e49 (commit) via 81515b7bd84247e2005b5a34505bc937fe527711 (commit) via 78eff1d82195bcf72614d62776a72e6770e05e78 (commit) via dc2a28c27c6ccb2e8f55edbd1d10685f92349b0c (commit) via 6e217401d93091729a7fd7dd22a36a822e6eacb4 (commit) via 46a9fa3910fa594188cb49b50b014e1ff6a1d403 (commit) via b0e622987a6242156ed9009a4f555deb6d882943 (commit) via 583c96af5b31ee14413274add24142dcf5943f09 (commit) via b9391cffc2e82c27184e81cd8723677d9e100ce2 (commit) via 1627f6a541239d14db1db6cefd781c4f8aebd127 (commit) via 6ca919be615a2a6db1a3096e5068b9b9265ad28a (commit) via 30fb69bbabab3ce098638642680976c463593238 (commit) via 3d5ccf055d90134c48bcbe697daea19d5acafa81 (commit) via 6787710b0064729c866a2339f0b7abe5ef005e50 (commit) via 21418b083d59206b390d18ba010e72bf719a348c (commit) via b912935c6c5322c1b26bfd127222b7cdc339190d (commit) via 77e7f589866a850a4873abfbd04e8dfaf37224ff (commit) via 40ac860aaa836d5822bad804b91059ac43fb5246 (commit) via e0c37c1f6ec06b44bba38a0370c48d7a275898e8 (commit) via f69f4a77477d59ee2734dce74f5c984bd9a4d678 (commit) via fdd9944ed5b98565d830b6f6f6e03a203ae4c706 (commit) via 8315b954fd22d42547ab72c1f7eb854136998928 (commit) via 957262fac1c3da9f2f6face0c929db55ac5a3230 (commit) via 145d64b623d7dbfc629d38da1aa3b6254c5ffa12 (commit) via 7217b9dc7c141fee27f92d3c23a68a5f8709c8b6 (commit) via 5a8695d942ba106ed9864daa38c9068411491209 (commit) via 7dafe4e2c7019be291bd029d7efd9e64cdf51927 (commit) via dcdd38119550b861a45fc34d92e7f93d0a23e7ca (commit) via 2e3163e2bf8098ac4bb41386e59344ef96971344 (commit) via d205755ae082f9dcf854d836b31d5cd0e5f87e86 (commit) via 56f58c298312c27d23c45ce31efb5e815f5eb115 (commit) via 20c2740c641ead4f7bef8ba105d02ba3d8523745 (commit) via 2043d5a67120d94dc1daab4a9a14a496f6a75735 (commit) via e5b891eed18d8c6783cdf4a6f234c3cdae02a81b (commit) via fc4d290cb76192fd3847b8d9c003d2ed7167922b (commit) via 4706d3946d146ef3b4c2bec0ceb916b24445cfb7 (commit) via df52cc09524e6a24e7fe72c2bac784e2b9f534c7 (commit) via 97d80d924a2cbad347453a066e7b602fd122a050 (commit) via 2a1efb288fe33d5915ddb8f467a8208880371172 (commit) via f3ae4d10d78b08a4e1a2e25844251b7f41481f8f (commit) via 039e4297ac2447029221be27a2e25b05ea9f7c89 (commit) via dcb416e4fbe60d7e2f3a50ca3362747644c29ec5 (commit) via 04f9b8c6f483408314c320558bb5bdddd0bad513 (commit) via 35676e7e0461b0d9bb82c9b6021e04cb54c3d6aa (commit) via 78f05aef773384a1afb9c6d017a37b6bf67a603d (commit) via cda952083fa6fa3bbdd90a20b062f1ddf9f97e65 (commit) via 5f91e46914359248f62c25f7cb427ec279b2e0f5 (commit) via faa16369057de24ace0c3c9ae4135514c0c35ec4 (commit) via 454c238e584f3c5204c9fce3689b50ae81abcd90 (commit) via 7ac78ac21a9ae91461258cb15647e83fb275c162 (commit) via 1970ec1d816102d3b67a97a2e1d9ed9013b576dc (commit) via cc1e83397b38d23b4c9b0128993e1a3820f02998 (commit) via 3428bd3d43199631f00cea23c1d0c1637b1bae75 (commit) via 1d2b5e304c1780d7bba7fa4f692d9d6b5c7d0cdb (commit) via 1b0ec75568cb08e0e1ea6d3459406b40db2eb0eb (commit) via 3e33540a816ba714610be7d736415d176a946e14 (commit) via 81a038690aca1da42b1f656b7a9cf48291b427d4 (commit) via e86af7d7301165c9c2dde4f74b20ab84c0f78d3c (commit) via 402e383bd759a1c041b39ce63632cd4d65dd0d12 (commit) via 68abb39eb33fa95d656dc1312acecf7c11a57145 (commit) via 90781424bf9ff165ad24062bcaee8fb47a10c384 (commit) via 1d5aa062ee5593de671dcaad5b25a6cc319b7847 (commit) via 3b92f04b8583cd096a0a27bde7aa2de02f2949ad (commit) via e2a565412a7d13d063ba06527f9abe8a79c283e4 (commit) via b4562522ed65f61ff429a4bca7a4a6e45c3f9e67 (commit) via d2e255192a6f778def60cafed826a4aa66d40fb6 (commit) via d40bb064009539533220a729975b6d160abf3565 (commit) via 23d5fc1900d06354b4ad9df21fdf02f256f40e13 (commit) via 3c66b497d66ae180de30bffe449d0421f5d16221 (commit) via e866e7a1361f7796192fd2974cc055b7196d80a4 (commit) via 5d647d2c42e3c4833153b5260100baf56a39a85f (commit) via 6f2ccbae21199c8ef786903f1ef83f67d9efe4a0 (commit) via 6737ae52d9a7ea4ee1b20e12de28ad4903400133 (commit) via 3a3c5d261f6b1a84d0b024893115ef5ccdb026e0 (commit) via aea12d1f9ff5ba1ea54c517755762a45cd86221c (commit) via 182da3c128879026e25b10f1f0e26eaf220053d0 (commit) via 38215f9d5c22b31aeca4f5b0e79979d4d50d2eb9 (commit) via bc067ebc69341693f6970cfc43926f88f2971d3d (commit) via f4a6a07edccdbf914fa4a65982d6a62270cbba37 (commit) via 43aeb3b858d98af26053397c073b26427ee41ab6 (commit) via 6cfdddef6a4da30419c2e52930d8926c5d6f61eb (commit) via 5fe38d5f88991bd99088a27d64662c027165085a (commit) via bc84eb339ceb17f09f0d6d236224fba5137e6c28 (commit) via 3ad8a33b622b1bbcd7a27c969ac13ddcb2a2dad2 (commit) via 19325c43693b6050a1515375eddede4119491502 (commit) via 3d547b1c64fd27dd323e5372d39cf518b1381afb (commit) via 28d02700c8ef8c42cd44adcdf0e92184301f24fb (commit) via 8bb4d0d413ede1b4b56711b5b67b3a269c1a64b1 (commit) via a1ada3e2a929d775bf96085668cd9df207b14cc3 (commit) via 99ada6bdbafda2dc1bd797041dff20c7c5e32f3e (commit) via 91230e01f9b72d7e05f95d64faee7855330dbead (commit) via 6ae933a2e9fea6a1e27f6cec442b97b368260821 (commit) via 5472923024aba61f99edafddc3493d472823668d (commit) via a5045b1ab02105ea8cc6865482be5abdf04a15e3 (commit) via 99b14db491884cfe81b3fecd4da52348b4b7849f (commit) via 145a7a4b3125bf1cd11161bb3c1fb5f2e15d6145 (commit) via 0499be4acd76baefb1267803fd2013954012e16c (commit) via 01d0f1bd2ac4c073a0d5be93fbb764e7c3de98a2 (commit) via 5d03777fe59ecf841f392348edb150037ad5755a (commit) via 758254ad420b28d8e5539cca0138b9c6d2c0dd6f (commit) via 9274deeabbc2f976772cf48a1cd41dc82c430572 (commit) via 7d7f23cebbf490db04e9baa93d61477d24c5eba9 (commit) via 994cdbd183db25e993b61bd1101666cd7d6b31d9 (commit) via 01fb67aeca21a0e277958439496a4dd188253f9e (commit) via f04322e9bb708fcc105c77e3e0cf699625a1597e (commit) via 7fce3995df517890340d1b050c67fb62ea7a79af (commit) via b639aebd621d1ab8d978333867dc8ce86a20e725 (commit) via 17ac6ba9c63d117956e48178f86866019ba32001 (commit) via e10bc0a9656bcf5f44bf4f8ffd80da2c0937c0fb (commit) via 08d2ea9d9605249968dd3eeaf14fc6bb5f2fff86 (commit) via 9d087d457efb756c886ef779fa49df19d9fb07fa (commit) via 1f0b951019b90822af33e2e36574533b027557fc (commit) via 03d29a772b553f823d70ebf57b63eee5b12893d4 (commit) via 07adca56cc8ba4a7d5703c920515ec7f4bd3dc66 (commit) via daa08ecd09c3d9314e5eb26314f5a4fcc24a4c1d (commit) via 09dc7c32f05359e58d26a1ba554431567ec04969 (commit) via a30800632e83bb227660100e81a691b15438f1cf (commit) via 9a0f638d1914b112b2990407a254afcd86d52bbc (commit) via 9b3a48e5ce8b4f84259e200e5a2236d2dd52bfc7 (commit) via be43052c50ac0d06e5581ac1509583ab7093bacd (commit) via d09e6c60d985574ea64f3d7eb07a73311ae7d709 (commit) via cd736a1c777a53d4bed7a62fb06aece8d901708b (commit) via 59d3b84defc23b36f7f9f2036b15c2b78c02f29b (commit) via 1a1881e80cf698dec5992333ec326f67357d4509 (commit) via 742da182180a3bd479828d2477d7263001f77d09 (commit) via 1ef3fc9a1b90bb7c57984522397955aa68536a75 (commit) via 15070162ffa5dc956b6b0a2026abb2fc434a28e0 (commit) via 917ebfe3350844dfc7384cb72ca2a643c785a21f (commit) via 28c827abd61eb212c4444abe426ac1349879d3ea (commit) via 6a83988674ec62870f0efac85c428d2b6a238354 (commit) via 564940c27432a34eb4cb94e9a94d9828af39e4a3 (commit) via 9241a35e61163f6d07cffb03bcd452fa0e773f36 (commit) via 3a4759869520615c3517b1afcd0c156545687a1c (commit) via 7d7d66342f86d90370519ec369b2f3e130443292 (commit) via 918705530182133db11d9d0eb589eab970a6d213 (commit) via 13d8d33e3d46cc9d9c865af024136155e3990485 (commit) via da9742d8fa8e71e4b8fffb2e012a0bab7884f774 (commit) via f3aecdc9ee24b8899406b5256b5ff4d5e971a40f (commit) via 83c8c1254bc651d8e7b17bc6990aed782bd99354 (commit) via 1166f8d0ded8745800ef57115bb5896808f68a5f (commit) via 564dc7e493c2ebbe86019e73cfbb0877d52197fc (commit) via 4cf58428363255d9dd05e196cf308ca5cd4e2582 (commit) via 180c179c7fc474b5310683106ec933ac9774c789 (commit) via d2ca8d40466d244011a60c2198fb645ceb1fa983 (commit) via fd1736b38fe16131a5496ff7a6866e084d354c32 (commit) via b430da35849396ad777f6459dfb1d3bc02c771f8 (commit) via df005951ebbbd0e25551158bfcb0f87ee27dfc6f (commit) via c423e2096c4b71a51abd74ceec0d66f07061ccb1 (commit) via cf5c1d216af6dcd4382ffc906511c725c613a4c9 (commit) via 51ec6b8845f3aa23ac9b05d6fdc9b14557522516 (commit) via 268bbf093aa922c84093c1ee8da8264d045c6c72 (commit) via a4f1cbe5f4a49fbb1624506c0dd8cbe3b05f2894 (commit) via f0f2dfc5ace0ba634651cd0a6f99c65a01db8acc (commit) via c64f0b80ef3e0bf632302d9694f579fd0b9b7166 (commit) via 23180c18e1a95f30c6016a76ae741f8170385a7f (commit) via 4f817aea4c258eb47aaf2b4c49f7dd4838349c17 (commit) via 31a4a7f245c07c3db3ecc5fc8c8cf63bc4c4e911 (commit) via 1cabe8830253de26fbed53fa3cb3b2d9bc8c4a06 (commit) via 3baa433e0ba3227e06cd0dd00532d7acd5c6c437 (commit) via ad74326b3f005bb97c3ed0e1bf783c8357b31cf1 (commit) via 36851a90b72292446b1e55257e15415da6dd3350 (commit) via 567dab937657cc8b01e4e19211ff554bd92ba7a8 (commit) via 355c0dbb8feeb89aa6cd3c6199e93725d13adde9 (commit) via 118403c5bfe111614eca66afba0cfd1aa45c9d54 (commit) via ee051faef39ff78d7805f1eb8c9f6330a4258032 (commit) via 31b235f16a4ba49048740d3c99a81f80fd0366e4 (commit) via 4e0399d05ff51178967374d5cadc3ab99e80cd7f (commit) via 107199f0da19fd14a61b7970ac8b436660a60e80 (commit) via d2691a7ff53cd36ddad01abeadf405b627800c24 (commit) via 45a0fb7b23665ecf5540bbe1eb5d43cf6a613e15 (commit) via 5fea197b78c7bbefe399241f3aaa78731503902a (commit) via fcf027550c824bc49c55b79ff07abe14b328f368 (commit) via 8366b54d096a7c506c95d7aca1cbdb878f37cb3d (commit) via 4f6871698f788d1f0c9dff9c75732bee7ca5751e (commit) via f8d8a395cc80784438a0bb670f04716bc71121b7 (commit) via 1ffff099c164244b25429a0b726639c167d179f1 (commit) via afb00ef5a11cb78d0c62a23e4856289a5d475f25 (commit) via 81a9f8ef1e216edaece16a765f1dfa98807f02ff (commit) via dc40a7789c5edbcded79b14a57e8527beb5a0426 (commit) via 4680cbb2dd95472ffa4f4cd34e0fb6cff28109ad (commit) via 094ffe37ccbead1e98a69da0306ae8d2e7f3978f (commit) via f6f123025970e0c3b204dd6ddbc7393bc68122b1 (commit) via f87dd96375448ae1d038708ff55743e24b451eaf (commit) via 6772c795e029639e48fc0b6e2248de5c919f9c41 (commit) via afaf1fac0527ff6bff70120a309c94eb6494b28e (commit) via 9ccf10282df8bf66b10e68c3908b19d5f52123c0 (commit) via 743c87883b9125f6f60dd52ff94e82371ec06ea3 (commit) via 89351e02528f7048306923ae57566f62f6c9d3fb (commit) via b2d9e55c27c934eb19f348377001cd4beecf218d (commit) via bbba1148ab93b41502d39f989ca2104f831185ef (commit) via e5459d34bf368791a31cac5bbe6ed96d6a88c26b (commit) via ca94fb2beaa66bece9a4a261a798905a77b3829a (commit) via a4aa5ceb2ea13e692f2458ad5666ccda01a22b2c (commit) via 880ab2c0b49e7d58d4c82a892fbeaade473e134c (commit) via 471d717d82dd0de84c2961522dd679c0eb2babdd (commit) via ddf34ab39a0e4987b60135478f4e1a1b4d4e3185 (commit) via faffbaaadb9d1588de332520c3848d2677b3966b (commit) via 9686a38f92414dd0a7f01e684195a24c898cbb31 (commit) via 33ea6e9c8fda0aa084733c2996aacd394f901787 (commit) via 9eb57ee5219b45e70796a3383e26fdcb3bfc8a06 (commit) via 374d13e7b6df41ed17c39260fbb9e17c3f2912ff (commit) via 0c89de8fb6367e296849c1fe408c10e735b50763 (commit) via e0632e64982ca433c46912818229748e2f16f6f9 (commit) via ce3055e65aed26ae73c4aadc12cd6101230fd429 (commit) via 364e78e29286a6ca4ac84083f4f979ef557e1c4e (commit) via 45fb4d271e6b2c6f0aff6d13ea51e4e54b7244d3 (commit) via b98401c9903374e2b9a5f5469d87805427343664 (commit) via 1368684460de9bbb25e91e2e17b3e127855d7fed (commit) via df5b3498ed0fe9d8f0bbdfcff15daf0544dbf153 (commit) via 484e0abe7a02e604efba883a8482762e548cd045 (commit) via fe9921c9b0371d7836624c14779b3f9f67d76847 (commit) via f6bcf830112e9778a2b79471810e7fc3fbf3dad6 (commit) via 4d5389bd94438b4cdd3bd2389804a79dd9bfcc79 (commit) via ac19f73cc4c965413821b0432bdff5e908e0593f (commit) via 2fe0e00e4556a34bd5cc2873ad57afbbc9691b4d (commit) via 1752405754633af7282af3b82043487d567fed7e (commit) via 5b7ba536d70cd0e4f312063b71abc33e5b8c30bd (commit) via 3da5dd0e362256f4550ff35c3da6ec9312060058 (commit) via a346530fa42b1e128538b61ace8ec73a845470ac (commit) via ea5a8c91f6427a3f12048609ec95000ecbab9b30 (commit) via 38a64b696d674e415934d1f269468d0465a09bf1 (commit) via b63767bcb8a02c9542c072c722d72b04d20eae2f (commit) via db9c8c9db6ecfc6dd196c377dd91ccbd604d445b (commit) via eb10a9ef8df21fc0e0064fae58bb43a401085a83 (commit) via 60c21ddbc2b682fb1c41c7826969de112dd15b19 (commit) via 36f8385bc85b4a34a9787fc0fde7c9c8f0b987e9 (commit) via c4d1df76191fd4562d5e2fb202fb8ffe39437f38 (commit) via 16b3218ebe9cdcb51a4a2f60862ddd3bfd761da9 (commit) via c465c435dcf0b9c0b52ec5249247534b2cfbc4b4 (commit) via 0559cc50da3dd8e7aa74eb6276e732c08d6cf8b9 (commit) via dfa78985b4f6994f43b877b96d0a6dcb81cfdc01 (commit) via 3cd8766b9c9bc04002e2b9d62bec852364ad2314 (commit) via fe638ad614f6ac632da23caca430a76e27ca1e98 (commit) via 4eb3ec14488275e63a223441a021d2ee65574c70 (commit) via f42c90365cb253a7956e90e5620a0074e5712936 (commit) via 54dcb64a4dd2b4e9a20c7d7eaed23e6465570b02 (commit) via c0190847e32fb35170ece910812e51bfb33829ba (commit) via 93c2ed941a5c659f701dd8987e23dbb3156f1daa (commit) via fee4f5507b31e76040533489c7ed4b52352deb66 (commit) via ffd28c193079a1e720a32b85b0a4727bcc869f92 (commit) via 4e5911c2914392c2c2b5fa2d22773064bc9177fb (commit) via 890871ba4d564fb8940e927b0733e57e894808a7 (commit) via 70d592aeba20e74a17480a548db3d217d94b5283 (commit) via 4b86794dea0406ea09c6fc92911c48d87d7c1f4b (commit) via cd124ad802326bcad36c2342b46b65e6290c50ae (commit) via 6e06ba09eb808f8a439b1bad3ef1d334537d6a2d (commit) via 70964c3a2c137f608cf0e756377c8471f7d5d82b (commit) via 3eab7f5a8945cdd65c7e1a0c96cf1f80147a9bf2 (commit) via 18131a58a54d10b10b5cbc80ab983dcbcffb3021 (commit) via 3c4d7f1d48d15c815055eb343de1a9fb48a75a72 (commit) via 69555111d740458207f72f33a25478f249de6c59 (commit) via b9a8bcd5c3d2fa0be826cac19c24d4a13a9bb0bc (commit) via c25476b5687402312533d40f546775bd2919de8a (commit) via 19e86f7c24ca3c302e261f3f683f8f98d9bf3d9a (commit) via 89b1760159ab644277baf14068032ba6f57d7c01 (commit) via c1d41dd989539b8dfdaa19aaf21adf73eaf8b15a (commit) via 42f534fa6ac5de9e21e54fdd95d12b3d060e537d (commit) via ef1114dd178e5930ba69841b0f1120787fd0ef60 (commit) via 14361c09074f43ca87484d87212c5f24055a9769 (commit) via ec9fddacceaf86ebddc32095e458aceb832333db (commit) via 20d17baae2cf9cbe39b60d3b4942f9433139c919 (commit) via c0fddf054c2c7fe0bb077293808f2046521ee305 (commit) via 57cd1c98503496b458614e462f51a8b904ccf709 (commit) via bac79ba18c9e008f0f85b959716ec99599c27dfb (commit) via 4b6ef3021831b98dcd2cb1905b17dc876cf94da4 (commit) via 5b2664c0a9bc1d43a0b4bf808ce492a90deabec5 (commit) via a82d424fbf320556a15923afb5059bcc5613ddf5 (commit) via 1a4ee982fbf3bcfd348c8928d85dd4410aa3d48c (commit) via 55960b558c1264ca10080162c39a33919a7eea42 (commit) via 4be25000bf2246f57f1dbc2189930e5f19bf192a (commit) via 37298f56bd85e16922b774cf6fc2a48c88b880d7 (commit) via 4a3c726affd569ebeec6013ee146eaf637a14095 (commit) via e3c427ad288e41485c32a96c56e682b1566837be (commit) via fdba0e07faafafe90be5336626b1ca8ec8d98bf0 (commit) via f13fa0c1a59a0b343c848abc23bdc4a3d8acaf3e (commit) via 1d921b1cfae8567a6467e2dd25515efefd1453d7 (commit) via 8a7f8cd22ee4b9d367cd1c18d80f9a351f3ecc93 (commit) via 413dcc4cd29be42c421a81453d0e36d783f17d72 (commit) via 9537197b4df5011fdf5c31638b8eba041f903b77 (commit) via 82f268cce628c205573ae6a77a477c9d961d7844 (commit) via 3cead32f1305660731127091dfcba692cf87637f (commit) via 53be013a5d2539918829938770486d76b48e8443 (commit) via 4455d5812f4d5bb5ec90e47dc2e4a8e56ce59034 (commit) via f499c0cdd7af66b9166eaa16cb190122f19d57b2 (commit) via 761cec8fb1e40ff816bcfb8acd044d0018c70ef6 (commit) via 3bd09b34c512ee2338dfbd277123a60cc9e16ec1 (commit) via 430fb980507cf47cc9f1f97a00f1a7c284801dba (commit) via 6c4cb07bac6dd8ecb18759bf71fd911752bc1e08 (commit) via fc55997b9e4c903ceb0ac1eb080a0defef70a26a (commit) via 16b971f9688126aeb1620fb19f27bd1167c786c6 (commit) via dc4d19e9f6507cbcc39c1a517b54ed1fae9cfa3e (commit) via 8f13eb89666585cc05eae62c788629c33db9f251 (commit) via 3bb90ac41c5a6d0cf446cb43afc6b78a077ee036 (commit) via fadcbd9268ed00ab444a3e2583d14ed193397dea (commit) via 51cc00a5f9e943b759eb2f85358ddaa75a7256b0 (commit) via fea856b67c3bd29c840faad2c28cc76fa7c99a18 (commit) via 3bae1e7ab2805042c35570c268e7b8e49d6fccac (commit) via e9c190de6280eec4b81c53d0d24bf3dfe6239857 (commit) via 02ccd111fa2e5c1d5e72bf03bbe9f08bef4388cf (commit) via 3716cf6f791b59ac8f9a566c724e493ab2f4d315 (commit) via 7d3c3c843729fa1c6e3766bd5664acdbf4fa16ac (commit) via ad714c5adad5e640863ec13cc206f5dba4a4d7b6 (commit) via a85254c4d75914b920a91a8858aa71963362b31d (commit) via 156f1b41c7a5fdc1740b05eef89dc84e5f0ccaac (commit) via e3587c36a22a7847940c9c66b420ba02e11d31ea (commit) via d427b3df774b19c895ee0a21f0259d9a7a143d6a (commit) via 7be271cfec0eedad1839d579871a08bcbcfdbf59 (commit) via c9ab6f3355a41373dfabe854a90fa20cfb1d40f8 (commit) via 80883ebeb81c73a3dc5c4ee65050d57e2c6ccf00 (commit) via 748b82f640fdd674f6d5eaf7f7b63c500a7a33f4 (commit) via b24231587c8035bf080e3c15b50ed443b2fe1afd (commit) via e7cafae29d0720f06280255a55cc94548e7e12a4 (commit) via f6d4714b7f22d467fb6500fc77adf2d968f14c5c (commit) via c91d81a483232d0592502b94afa3468c26e79123 (commit) via 4f414765ee55a59ecd408a774aadf04fdaa83f28 (commit) via be3d61dead30742a3d941ae6351568f800148e03 (commit) via 7f3319dc1160c6533081a853a682480dc8fed02d (commit) via 094d8f9599c2b5fa365dc175b360288c2b588bae (commit) via 0ca8d88ed49aaa03d32997ba7a2c5cfdac934b55 (commit) via dc0f761b1492a0911f66b664a2a7ede5ad548638 (commit) via 757e9e20bdac33e6e368254c125d6fd12a9cbc75 (commit) via 6e14d6f5b2e8e8ebf26eb61d5b06d8593dc3785b (commit) via dac27bbaa699ba548fbd442ee4b88a6d73a6734d (commit) via a46902c4cc33eb0ae4ae7ac8d0a6447c4f14fdaa (commit) via c701d41c3cbb28bd3eef3aca0184c49add37659b (commit) via e11550e7614b0a048e5668c715c0ca9b3f7d7ce1 (commit) via 82c4c4cc67adbfebbd4a2a83dfcfb3f98764d3cb (commit) via 9b14bd5dbd43efe2f42a35d4095807817c8867d1 (commit) via e2b85e946aade5c4debe952439bbe9b835bf5b0e (commit) via ad0298f7f912caa5692e2ddc6503260f1a4900f8 (commit) via c569fb0f2942a3d33f1b4cf8f150f515d84b05cb (commit) via f288e3c38dc26ab8c36a73ed8eaa128e0be056ea (commit) via 8bd35134615a32d27d28537190d75b0b55fd353c (commit) via 4aa9a83898cf6b78e564164a7411b59410afc8f7 (commit) via ecf4e9abcc221dac4a9c6307c63819dbcdb1a22f (commit) via 6741f3502837d8a5fd1204afea7bb74e3e757774 (commit) via 589502d3d998d18d846f635961e1e28c17ffd893 (commit) via 56f8c11f0b476b0a9e2a26b2cac941e47b3f2a5d (commit) via 76a065ec8b7492d3303b37455d132f7092092645 (commit) via 8cedafc80bb6e43be6f8d235e1c44f59c4149faa (commit) via 6937ca39da7f0f03589a7ccd820503f6aabfe063 (commit) via 588eea410f19745b584c9a000bba832af9736232 (commit) via 5655fbd58b0f6cd0f70afc8ba381668225e88bf8 (commit) via 48a9e9a5ac3a48165c91aa9e34cd27057e298927 (commit) via c87b60278e5cff1d946e1711a06cac6b3b29cc09 (commit) via 2bcca2429f4ad6171d8d2d8f3d1ed27e9f9f0d9e (commit) via 41bb745c2a73964671eaa4bf59307937ca5c19f3 (commit) via 758f3831fdb72ffe6a1fbe4067cb8872be32ff0f (commit) via f8c9ef5f9deca6345f3d598c4f511b4a21f237bb (commit) via 400c785d4e4e94738f5b11cd95e4edd56f41f93d (commit) via 03e74c51f9c326258c82e579754d9ec4c99bd4c2 (commit) via 23f71563fb4aece0ae2b1e27bf09eaf596d8bc61 (commit) via b96f854803bb74ccb0ee9de6a181528934bf6027 (commit) via 00207cede371ace29a746864fde5bc13d7159819 (commit) via ff8f468d3eeef264f67ec725dc9eb10a26f9b5f1 (commit) via 3cf08d88b50186984d1eab2ddd2bd75e60413af3 (commit) via 4013fb510f6ab573b402ebc33e9cf5e157686d4d (commit) via 68dab14e98f4b3484585c5cc1d81c173243e2970 (commit) via e946da9a7d85aaf39053c1119b98f52a02d0acf1 (commit) via 952c7abb893c8081875a1590ee5ba5e82f02c67c (commit) via 633f193daeaf6299620497929f24078219981d38 (commit) via f126b92e2e8c123868217929b3bca0280438195b (commit) via bcd31ecaf3146a9a2c87a7d8c1c1d882e6a98148 (commit) via 5a42adf40dec8dd084273d1d75f4ceb9f6317b2e (commit) via 45ecbc2f6144872ed2335fb724639145f2852815 (commit) via 38e0bfb5a86e91f7bde8920c8b4ab17aadf304af (commit) via 1af641feac4cff3ccb372da90e997f371540061d (commit) via 84a383fe0fcc0ff93b70c21380c4b0702c55e6f9 (commit) via e9ab5368f1d1b7701812e47aa12468d95548cb33 (commit) via 27096d4512ef6bf21403aa0f466908d940db0078 (commit) via ba5a250cc80ada70049cf2c292786de226f85380 (commit) via 7577b8aae8d19e61bb2f4412ac2f2ff5eef0da26 (commit) via b6a81ba7fdb0875f04fddb74b33415c6e8afc507 (commit) via fa711796a81ba5d502e2d8711b5047fca41f75f6 (commit) via a9600a45e0666a432e5be02d30c214fba6088c88 (commit) via caec99adace3ca24f2bec287a0295328c8775e23 (commit) via c2cba3634e5240cdfc0cf9312ecb136645f975f7 (commit) via 3551cc639f4a5613f04e8ae01737b92e56cf5144 (commit) via fe82c1c1433d0518ddc6a58d38d621cc58a998ec (commit) via 04aa7ef90c582bdb0cb9956fedf059f241a5bd7e (commit) via 2cb2d3bde4564d0cdfd8795548608376f5fd9f22 (commit) via 3fee704d668e7d09fb764b4578020f684bd9901f (commit) via fb71965fd2fa1ce653994c91440b5e3c7843e946 (commit) via 45e2b99dab4796f63ae49ee5c875fe12aa98a708 (commit) via 7310c2c5530b3cdf671effc260cbf70733066213 (commit) via bdcad14a4630b312ed32740d60b8bbe99a599e87 (commit) via 85b0e1b9c985b0969fc9debe43bdf0705f5048a0 (commit) via 280e894d172ea442be8113fe3bc2fdcb1d959485 (commit) via ba59c51d607b16c18a4f8a04344af6638f1355d3 (commit) via 426a448f503200dc11a0873163fc9643b9886317 (commit) via 6c1070ea505530c488708291a6dc334e4ea83b80 (commit) via 721c80198c61664e621c767ebfe05cbee4ac097f (commit) via dc06a03995e8ba20debc7f4e909062d0b06313c2 (commit) via 828960adf80c6e7b6ffff7361e505c09b69dbdc3 (commit) via bc30415380cbcc2f7229ea0d35e6ccde830ee383 (commit) via d018fa489aab152d797eb7e41a8038b2520d64e6 (commit) via b2fd42ef09901d84fffe9d7cba3af64b4a825605 (commit) via 90861ea075e1467f084f77fcb7a696c14e459030 (commit) via c928a99e07497a80af9ec295cfb2d0ca9852b354 (commit) via f1ecda66b6c61451a53ceb935852b80231168697 (commit) via dd529b0e3abcd72cea921068377f2abfd7b28d5e (commit) via 75e22758d49460ce35863ca716e9dc1b43eaae93 (commit) via e7b9790733aeed1324e029eff73df99dac46eb89 (commit) via ed708bff3ebd1fd22906f447cc50ab225523376f (commit) via 5db55ae49081ba63054416149c925500c560f89e (commit) via abb8f08bbbf7d22a96f876a3ca7029fa1c63a93a (commit) via 55757c4f776068edcbd3c81e740d561bc3a2413f (commit) via 54bf6575027c558e2ad668b3727eea20e9e0e3fb (commit) via 73e6e03d371a7ef3d0cb8d798554df6338f29cbb (commit) via 8f731f42e291871aaa7b48bc7a3b3399ff121ae9 (commit) via 4865e38d319212b1d22f626082cf3e0b8ef91c45 (commit) via 562ac0efe3ef5bf955edb0399913a1c1cdf3db18 (commit) via 25ddef504d4db096160527e8209bc25e7d1a3a5f (commit) via f5e7284d396a21d0740820230dbfaea324efa087 (commit) via cfa30468e89788d220ad9fbc07ab1ae3406cf3fa (commit) via f825d1b0adae20e4ccb351b9655ab3da260643a7 (commit) via b4548a606ee98c29df8cdffb6fe0966843dcbbcb (commit) via 89d99a919608d52cc3811da82ac22379eb8ebbc7 (commit) via 1c9fe263d67c0828615857e4dfd8c40dad61f295 (commit) via 9fc6b2087a08b9deb560d36ac30c0ca25e2692e2 (commit) via 4f46bb91fc142b4115509790b6669b8e559d6208 (commit) via a9446ac12e9fc0a30c3b1638b9567824d1083824 (commit) via f37729152d625e24c4a6303be2bad8a8245765c2 (commit) via 0cc28f37fb7c37e743d3263a9cac55f74578d430 (commit) via 2293f09da43d054658439b02496e82aea370e050 (commit) via d9fece6c0e325ee0a5394807395f2b2e2bf68f20 (commit) via 640b81a27c6cffa927e9fd36bb3c0a9c3b0c4bfe (commit) via b02c69bba9f46cad37225a0986cae068f24dcd81 (commit) via cc42515e9f9428dbcef11d081f3396e3c6b46fd8 (commit) via 3548168d8ff14630914b79645f22433c2a5243ca (commit) via ed01944c15d93885aed94bd9e4f9cee86d8b4c86 (commit) via b36d015f0960107a43bc0683b46cf42e5df4df7f (commit) via b6a533ee9a6676e708325762661dc3560198c230 (commit) via 72baaf6d231c69bbfbb015b2908c17a9005001e6 (commit) via 30b2c6fe905b8ee2b477bb0a99bd67112d572bcf (commit) via 29ea6e296f0991e81b358c7941eb0f940a9eda0b (commit) via c236541e29b022d4fef66958ce796165ab15ea44 (commit) via 4999723687be066188ffe02311e6ca7e7f944e21 (commit) via 132795af795399e7d716a9606b284dd4172f8377 (commit) via 50e377dc94f8bd3f266040cad61d76b7973474b5 (commit) via 5e60c62e08d055f11adb7a4bc73e08af668ba7f9 (commit) via c296179535d66a28fe18b6bae2969447ab447348 (commit) via 62b55523c279d8d38e65eadd46a8909e45361007 (commit) via 549b2356d6c08ac9eb63eee0432805df5d5411f1 (commit) via e1fb79a17956f2f82ee26fd9bf2d81a7b02ca0b5 (commit) via 4ea1595481b5bba91352c5f94d4c08f65cb31b96 (commit) via a329bf12b70e5c06c496c60f2f71e1d3d42bb7c8 (commit) via a6e502bedf08cb94e06c48ae34d20bba24492bef (commit) via 5aa13f13e79697a5947a9181139ec12b8bdf0332 (commit) via ef773e0762ed7f511b4abf3d0225624a597fca6d (commit) via d093a4a4c641f60b06d23b14109a29b7f95f56f9 (commit) via 04ca07512d76c57d166daa91fd68110939d0605f (commit) via f7d16ecd3b387491db04bb0df82a1c2ff9dab9a0 (commit) via baead3ddf0abc03c7986ebfd33ecfbfd304781d7 (commit) via b3f9bfcba56c42480e61d9b9a02a0996a02cf87d (commit) via 696becc093a8faf05ac398d8e1a2d433abbbf6f7 (commit) via df63657e619a8863398981416ef001ae9eed392a (commit) via 56c717d7f65b110ccee04610892afdf65c7e477a (commit) via 5e3377c7a46fb479e1501ac884e29658e40a2ee2 (commit) via 09fa66787ec26d523b286e4e4d7e3846effc6394 (commit) via 3b04608c2e09f858ba1f0a5b0b4ffe4ea0669719 (commit) via 6b77b4ec0771e034b3919d6bd29abe5c7b66e473 (commit) via 108ae5c48a0f74f0f5c2725aa95145867426a7c8 (commit) via 184f395553c12ace7c613e9b302879cd12ee063e (commit) via 95cf2209fe50c127e88d0021ac93b36c73a407c5 (commit) via 0748711434e937aa903536bcec46d9d997f92af1 (commit) via b834a0e5d06ddd8f88bd5d33f6f957a4614a059d (commit) via 7d84351de9cba0f95f76396f08104441cc22739b (commit) via d5239be7515143866ee5573f4ad378caf33ef2ca (commit) via be2b5777ae47046f2346e77e05e3ade5648839ea (commit) via bd24aa6d795e74fa6398122c5a1e7a20055bb8d8 (commit) via ce01c76c56cbb8b28307f37e0bb502a8e777e7d2 (commit) via 62d275dd9d0cd7cd20fe4b3e346e7b158ef41b0b (commit) via 4e41e4c584a1208c96ca69b250e4df002952376a (commit) via 0477cb67f5a454367f4b5208bdee6d849d64495c (commit) via 445731eea186ffd2fa7ac2b268180a5ebd6438b5 (commit) via 07ec7867db580faef8eb120ed5e1b991c06a5b2d (commit) via 1c76ca4d72df8faf698edcea32b17f33f5009533 (commit) via 6235f7435531bf253e2af845859da5f10b633d91 (commit) via d7c5cb2e33bce05ba5e96df12c73813ef020a88b (commit) via ff37e9de9ae625597041ca13dd36935976a5cf4c (commit) via 59ec8ced59266a852c3b7bd5a6dce071294c5fb1 (commit) via c9fcce0869c37b4248ecf56944aefed4fa3ee3e5 (commit) via 4ab8fa13e126ef3beeba88fffd4a5a0e81f069a8 (commit) via 7112c94e295833779060c86375ba4bd3daee394a (commit) via 765cd2b7e21588bb0c95ced9fcd1445b4f4bcf0b (commit) via 6068167208d99a6e0bd54332758b9f4c7a77661b (commit) via d4a0132415ea461501255906b7455279ac6b71f4 (commit) via 42c9df72ce2c1653b4c7def98336d848dacfb2c5 (commit) via 83da7bd3188ddcb92b10ddc4e07792c40aa4885f (commit) via a045519f6b07186b9d4c524d2bdad827b189f02c (commit) via 19dc1ab0f207d20a0934cd0c15b1e7757070be25 (commit) via 401b23549ef108acc18e1d417ea74ad6d1665d05 (commit) via 94cf078a4d41b8a97c1f1d3d630a93f02387837c (commit) via c8a897b90c5d64a08a758dfca3c2b2f56f163465 (commit) via 7d5ca1c08601694be0effa41965d9f2d8299a8ec (commit) via 8726104aa3ffa9f542d0b64b4fb43e6acdcaff77 (commit) via 0d0b4b4383fcd24a3339f8d5c647cc1aee46e8f7 (commit) via 4e567a28a209a2037d88af51c04b75cdec1214cc (commit) via 3eb35a57bf702f9289dca66d913b285888c1aabe (commit) via 6a0f7f4ae8d0005cb9fdc3286537b9b60b50a592 (commit) via 04b52156465f4b0199adcee6181a613303749073 (commit) via 486dcc631aeaac7b8f36acc4269531ab21be5ace (commit) via 134b78c1038c8968f10a0e7bed97e73f7fd85699 (commit) via 9c22b0d0f44cfc62c64fdbd60d1d0c1672ceab22 (commit) via 9835395c73ed58957ffe3170bfed85d8a6aa2382 (commit) via 283b7a85b825febf2bda0d650505d400816ab178 (commit) via 4d29df1fe49fbcd8226b0b492831b1e6b22ee16c (commit) via 54ba998f6c6564c9ea9efb8832c0bcbd61e834e4 (commit) via 6e23f3bef611c974433ed98348affde23f732b2b (commit) via ef79535c45fde4a01e6df7e7ca28633649949c7b (commit) via 8ea90fb17aa89af353e7ddf16b908436780f2322 (commit) via 51df54ece3c49584315a45e5ebe2e9b7cd0ebaba (commit) via 0ee84ea57b9dc9609d20d72e2b92972bd56ee331 (commit) via 5812c5fd53322940c5627703d57dd3d1d22ed6e5 (commit) via d31c24dcb3f4ebbdcaaa2744657f61680fa8d02d (commit) via 74430cb3c6e298d07b43ad152ffaeee56a722312 (commit) via 6f2c455f929946c1eb5310e8f0df3b8cffd911ac (commit) via 5219ab8c6330a4e00eb4c1262906b39044d89496 (commit) via b77518685cffcf59a4a26ae3bcde9b0d7a5cb75b (commit) via 0279261b0bf468f6d36bec6fa5bb359d2c3f17c2 (commit) via 66cec884baae60692f041aab6f73806b4a906a3d (commit) via a53933eddb2ef33af0b7e4b972744b862eaaeaf4 (commit) via 403bf6af1c4f0a86424a2f433592f920e3b1c033 (commit) via 5f012813efd18fe7e46a359fe80d2c5287a6c6da (commit) via 5be58aac1b545e191b4e27e4b0cec7b7ea5c0585 (commit) via a2e5f07c4d6d8fa947bda216c7f1940acb7fa12b (commit) via d47d32e035bc9036c32d3497c96cfe2e4f098584 (commit) via bddec41f438352063e33c70f13899b978584d627 (commit) via a1eb601b197fc0fb3eb724768c22f920ee7b471c (commit) via 7cb6b4b3e141772d1c3196560d7c268cabd2a24c (commit) via c9e780b9b68c298687748c23818002511381ee3c (commit) via 9fbe363a86217b1b8a99553dbf8933414ebf26ac (commit) via 8370f0c23319dc41410507754ac8571b1cac42c4 (commit) via 507b73070b65e0d28c4ce4714bb6d64d4cbff7f4 (commit) via bc2638334bca11e79b24ad1e44df9af09acbd0f7 (commit) via f30a1cc6882e9e9d1c83c69f0866ec728e406e3b (commit) via fb48d5ca9d2a1266a1ddd1714285d4c0b61db77e (commit) via d5ff3e04ab34475a66b75363db921b6100b6c257 (commit) via 5bb007889c0713eb42cc93050995b50fa8bd7c6f (commit) via e6d6045ba611785e0e2126fdcfb2daf9c641e260 (commit) via 5680d93a2243cf06a41e2f79f257cb65d53fcfd6 (commit) via 83aeda7956943bff4556202dc182d59b8e96a83a (commit) via 1a75821df8477cb3a7d959034f3d550076ffcbca (commit) via 163ca31f2c0e7bb4f3e71806fac8147f3c426fc4 (commit) via 29843a6e4ad565c03bfc525c13eafdf4d0aa2c36 (commit) via 71f142744714968acf672da37a3308dc3d6ce284 (commit) via f9d44d3bfd6d6026cb1e3216e965a7e233e69a0f (commit) via 7eae2b629e43a6ddf48657286895588689057494 (commit) via 05eb47abf1e1f31d118bf7d3b87cd1d8248b44ac (commit) via 402f2391dc15152f96619c9bfb21809b13ccc46d (commit) via 87db11afe02ebaaa898f3b4b76258ca8ff6f60f3 (commit) via 53d00f6947129979b0515e1d3e6850c55a041715 (commit) via c4324d5af4a5ca8fafe34879dbf7af04325f1143 (commit) via e7fecd0ff9bf86fe0cbf8bfd7878cf40337d3be5 (commit) via 5a6f0f5c37939b29ae40f6a9c3e454639d4e8dfc (commit) via eaeabc7b04b09a38d0df17576b551d94aa6485dd (commit) via 28046a89de50f8cc87159d4824aeb946e64dfaf9 (commit) via 646a5609a19416a4d0203a0e2d8395ed128b8dfc (commit) via 2befa393a63df5fa35af1f089eab7c404a4d6490 (commit) via 42c307253bc88621254fc9bd92f6364ca088c5da (commit) via 77671c049bca64a54c82917bf3bf7b093ff30655 (commit) via 6875a9718d701ef9f312c677e85bd4675eb2abfd (commit) via 20ec962a066533e6e0169d4ad4254c5d2c1bc8a7 (commit) via f777b36e4f9f0864ce475becea8d2b590184eb42 (commit) via fcdc147e0489a8524b927d093f5016758b651e07 (commit) via 4526ba30c6ec71e56cefb798c16d3867197f2989 (commit) via d18c3a8a60bac15869fcf76cb3a93c238fa7f071 (commit) via 977a8ad7ce7e72eca118df331ab0c53fda7b3a03 (commit) via f3c6512ca08c3d4aac9c266e89929f8ab2a6d8d4 (commit) via 4d448c979eadb63578ab7fc07949ac7aff9ec144 (commit) via 84ee0ae61be9c88267e818685df3d7743a050881 (commit) via aa7c9b898a292a461347cb9191361f918e89e654 (commit) via dc51ccbec18a223beccfc5f8cbde063e6950e0bd (commit) via 86de47ff3140d2d04e72c9977a3b3fc21cff54d0 (commit) via 4d3357e18cee30293a77fdf7f4ba8fcc9df9a2c5 (commit) via 381233ae0becc99ee1a4801883f94b704f1e2bc9 (commit) via ac20528816a74aa2a7619a2425edd5a389161d13 (commit) via 3482f95e72934dd96f80188cc04b008308bf73db (commit) via 8114b3f18d4a6e8ec396774bd78cb50145b91158 (commit) via f708ee1a0bb2a66b6e87e6fd0e0c496092eb1494 (commit) via 9a8bd09360dff4d80a0f1eae2e127109f8bb4e5f (commit) via a13cfa488bb2fd39f0e83e277709c9bee7b3271a (commit) via c219a73c0634a4b93e021e984589da5dc8f3b2b4 (commit) via b76e7f1812a59642d579866a8a060243fc396c50 (commit) via 7fd0f84cce13dd94da7b88a66742eac95e1c60e7 (commit) via 2f3187e47060a45d8e3bf8581582344d9cccbf17 (commit) via 26f2e095efbc9b5aee04906dd5983858e8c29eb8 (commit) via 68d1c32ad145c712c1d7939e5649a0f187f20170 (commit) via e3eff8165e64804ea0e2819bdd0fce58bfb3a9a5 (commit) via be00609aab7a51a15794c2712dee78263105f5dc (commit) via 35fd2bc9e744c39aee91e8d7bd39ac6fcb262f4f (commit) via ba3a6ad6c8b268b064a11ec0f51f5b2c5e32a303 (commit) via 07c3c94d7a9de90c42ce48a97cbcf61682633358 (commit) via f5a6831ffcd01ce948edea25197b8d920fec1f07 (commit) via 690ae1b313074efe8948faa539b6335c3140ca6b (commit) via 8381a4f3cf941aba8d2ba8b031ad9774ad05096f (commit) via 0be95658aff1ee11daf97f8e41a63e4f1c1a1b41 (commit) via 2d3d8c8ddd2b810a8328cf80c08c10926a2015da (commit) via 73e1ec5e46d7521aceaba30a111cfeaad950a739 (commit) via d7141be3bc08b9b3216048c73952582f6451c7e1 (commit) via 461db7573e63eec8b10309b1d633156719f3354c (commit) via 2f01722ebadcb049c1080c545073fed226a3af3e (commit) via 3e1ae21d5d6f51518f99d82205fb1cbc74e075e4 (commit) via 71fd30d40e5d0c87575a4e95cce1890950bdbc3d (commit) via 4ee68141d794dd4a296792e0b81c5a20a95d5d89 (commit) via 5ce37cbed81837a13e28c8e4b3a49665bd550b78 (commit) via a70192f2c7dd0f0dd1100b157522dd7871b17dc7 (commit) via bb980fdef54cdbe4de0a42a75f8ff8c181f6e383 (commit) via 4fbef45522f4346f31452ba18eb50212003301e8 (commit) via b762a0aa7f2cfa24889cc308680d97a672591e0d (commit) via 66e166d3e2f295668422cdfa970a9cff2f87b69b (commit) via 772a3f815a66f9d9affd7111bbef4befd00c2d72 (commit) via 09a8f6b19af9b444f84b197b4e4c8fe402b1d556 (commit) via a8ad3da74e626177159bb81e0272ea5f767b0dd0 (commit) via ceddc5b84fd9241df8ec725b07a4c8cf708ff301 (commit) via 01d839eb64410908dcb7d4e2a913664b4b849608 (commit) via a5cd2df89a99ce4cce16499a272be108c6b094b4 (commit) via af3285ab61bca7fb5f8db1b53d53ddf3d4944bb0 (commit) via 70b0e4bd512db4ca4f1c80ebe5de38a93f1c2bbd (commit) via 16d918d025d7de09d7d564d249bba9604f8e53a6 (commit) via ca481842569116305d1aad2fcb29ec2ebedbfac2 (commit) via 11361f69a45f83b0c60fda9094b76978790d5497 (commit) via 2066322891f64b31bdd300e5151ac677c689d7e1 (commit) via 82db6c4fe3eb7a9671ae0420d0fc3264a310a930 (commit) via 7c0b748737f138b85df15074d6e72255b742a07b (commit) via 4da5c5cfa2d7410ec53757df69d6f2d2640c1309 (commit) via cc722c64f324504317b5790d0483d2621e620af9 (commit) via 2002f38b4cb4b36c7c9be94865a67b5a75668fdc (commit) via cd0cc2e4a30398b3a2e1eb8f5e10c2df3e041fa0 (commit) via e4b5c49fc105c3f13c31db8dd5be0c5cd8a8c655 (commit) via 3f3d412b4b4ebdec6a699d19e08d8aede5880bb9 (commit) via 6eca0263429902853acf3647503424446f52f3a8 (commit) via 874aaf1f861f7b586c89b2cc8eaa8a2c9674bbd2 (commit) via ecfc4714e352d90e9eafeffd0daa8d734b41ebaf (commit) via a6e7bd534dc67d06c68206151690f13a4b8168e4 (commit) via a278b6b403cc58e65dae32ca7ded444746e0cab3 (commit) via d68a12188c2937b2945f592671fa1c21b551b732 (commit) via f8daa1126a11f528e97514f16229b34d9e55f804 (commit) via 4a7425efd8889d5c12adacf26ce9c1819c450063 (commit) via f65a85106d61e6d024b2ac6a3a42ecb82001a682 (commit) via 5a0114a16f7493b6d67e23bdb6ff1b69a2fe323d (commit) via 8dbd62ff178e6dc63ebd532526a843fd19dce4a5 (commit) via 8a6d0f68105496517a828a700dd97c267ecfb0ac (commit) via abb342f4305fd2eca9f92b046400a513664f7b68 (commit) via 9af30563e29bc250d2ef75d06e593774811e4699 (commit) via ba0a2a32ba29d19cbb21f17ad31b42a093398d7d (commit) via 432e9cdf5b1606cd81cc1e78d5958ccaf7ed1d7c (commit) via e15d52bd80b29327617b52c7f382f3f4cb8f7228 (commit) via e3b9db88947df3ae21ca1e20b24d84d230bb059a (commit) via 65ce3554c8fcc0d75b0472470b3fd8dab58853b1 (commit) via 75145c9db522edcc200129aa44e6858cc15db194 (commit) via 7a2c0c339b9798294a1a9af27fba8bb7f8bf3f52 (commit) via 749dc86410f738178414e4013cc9737f1ea1d334 (commit) via ce34d86c704e7f4bf95cc2a6a1beebf872c96901 (commit) via f790cbf20c99a36c633ffff8c7f70b0a12ff0db4 (commit) via 4fc415b6e893660cca6354e12417f2924d581dc9 (commit) via 05ab7e8de634f0a9da26fcc3dc730bce2b1a34a4 (commit) via c6a4ddd0baa7c699b96d2590fd581dc4cf1374d7 (commit) via b7c23acd40b6f69a2aca4d564cea9468c5cf2052 (commit) via e90ccb151e336e50a7083bd5e6d35e82128151a9 (commit) via 3a35139a3212d4d07da3c0f391b00f2e1daa2fa3 (commit) via f7669283a69f4fa60f37ff59b0ac63ebee461999 (commit) via def3e0b3862896b02514b643fa47d4e84576772b (commit) via a3b2e91ebfdbddcf5281d21597988b76c28b92fc (commit) via 6216d5df07876843127bb0f3e08ae30282fcac74 (commit) via 6c9e6be255c4229931b333af114fb98a96d22ac2 (commit) via 7c2cbf407362313dde3dfd0f87f2df41b1692b91 (commit) via c443641a731eac9a15118b0f2a761c9d759bd6e6 (commit) via 32cc2402f4c25369ed8f2b954a00b6049a3c48f7 (commit) via 291adb56862ebd36298dde9a460f785fad61ac65 (commit) via 4552c69a7b687f3a32c983081c90ce08b0b416d1 (commit) via 9a26e0cc2bbf153610eaf45d9ea72045aa29f2fb (commit) via 80363af69716e951a4918a22ee93176676f4cda6 (commit) via e8958479bb24e6a7cb35b27db2ef6853f5900e0d (commit) via 161da3306a6e7a65f947a1b356621ee4ca37bd20 (commit) via 3e2056833b71af27bd6bdfbe1ab39b36af497cb6 (commit) via ce352bccc573589d3b92042014931e17efa5ff48 (commit) via 70331e88bdf782c5374f61cb1f121fcd6c924cb4 (commit) via 96525d4f63a0f5bb2b7e7f9e70469d86fe401406 (commit) via 2ea5e1cd8911805d226ad5c245899e4cac4a0528 (commit) via 9099e3b85ec2a7a31ca413fa2091903fa345c667 (commit) via 99b3d675bb475055b7802f85344a2265282c960a (commit) via 53561eaa9a3113f9ccfc11f6826130cfd9131b33 (commit) via 68d74c31c38e2b274235d38d3277c50b96a535f2 (commit) via 72e5a7068ccbd4ed5036926e3125e9ab07253d8b (commit) via 67edfdcb376197ce6bee8d52764e63cfeab904de (commit) via 99ff200dbf0642e9084fa0b10dae711f2f890876 (commit) via 08d6b4339ce8eb5dcf9504e78a22a022fb1ecddc (commit) via 04b9b3e2a6093b2a7f2cae8267d73ae25dcc282a (commit) via 2e8ece4fbaeb060b9443387c4ad940d51afac0a9 (commit) via f6065262ffe0fcf923cffba23d991d5ee1d45b8b (commit) via 57c726f130750de316f47a4b32eaea65f9c06b81 (commit) via 67845680ba7d415801c4ff5db97c228890001f34 (commit) via 830f24e8ea964efdf943c111cc9959cdc5e7ffaa (commit) via 540ee0123de4119b1df10ce752a5891248215a8b (commit) via e0d4c195ef88c0b892f704076670f12ef90ac9f9 (commit) via ef14b78a8a219bd1d1a39b12f1c0d4118288d744 (commit) via 04b1f8d8a59909d66938d209fc3d64c334c0ab3b (commit) via 9b33bd1c1c558c8192c8f03478a191756154a7ef (commit) via 37c224670e1e847de2be0b75fa7a5ab4d06f0010 (commit) via 3be9460406361cfd286b657dc4502e4008043964 (commit) via 7df3e18c6aa58fc3b804376ffaed2269c68c1e70 (commit) via 2a730984d2989d943a839594e059f914fd1b9085 (commit) via f26a69724292636f19aa651eb2569b41031ed726 (commit) via 6fe6e67573e8247e7e5b508fe852c4aae8aea64e (commit) via 46c6650a947a4d1733058ecfb2e7f9e098f847aa (commit) via ab2529d4e1e33f01f87bb9db97e6c5883b5f4705 (commit) via 6558276a83af5630c7b8d40b93717009bc94d0ea (commit) via 86c9bed758e2542ed0d496644eecf22ac6c53b4e (commit) via be36f97e03f6b85a67f5619bd01991cfb817f924 (commit) via 84b1e2f805107391e660ce2133036d2a71f4912d (commit) via e96a9cf63f2affe08ba9314bf13866bd817d703a (commit) via 0a6ae735c747ae52e3ace461472fb6b563fee5d7 (commit) via 83a5342bfab646c3f0c2a2c7623d949b3fa23f7e (commit) via 89216756680a56196771dd3139d6f5e38908c0eb (commit) via 2aac00ef819361d25b4c3cbc21cd257c88db8f53 (commit) via f34b76c5e63f85a9ccd416c8d403eb576069bcc1 (commit) via dc69c2ac962e097cc055d302232327cfd4c94aaf (commit) via c4a9f9e78b088000c6d51bad21d497206e4a7b09 (commit) via 8ec9e21490d4145c9393bcae3f2a1712ec247bde (commit) via 812a275f47c3abc256ab01e8414092d215ac5325 (commit) via facf09b83938d37fd1024e8c52c92beb121bc909 (commit) via 0ea84c869c05d54f3b5e29b29b96b6dc727397e4 (commit) via 62206e3d436f82b4b7ea6b241845e5baf77c327d (commit) via e5aef4cd9a6f55a776d07e4e3424a4e68654ec1e (commit) via a873b3841a04e0a2e0da535b8af648f017fadb29 (commit) via 362eade2dc9b429eb047607755cdd6df355326cf (commit) via a62e2cf7bc55a7a6b03f5667bec0dc8c2866f013 (commit) via 44b7864ec3383f07341facba0ca3a3cb499e039f (commit) via 7642dd2c88ea16c18fb70e73ee58b00b26017501 (commit) via 6d74d7ab663ce166a6fa2e5ff45079244e4f53e6 (commit) via 705dd237def5b93cb7b2986ae65a250ff38dc67a (commit) via fcd8df0af73ae7eaad33c69a86104736f21acd8b (commit) via 252aebf881cecaa5500219d97c252adb89a00a6e (commit) via af100fd1563aa6e6c335c11482f1e3d0de336dd2 (commit) via 79ced283b366eb8d608f83c6687e51fbabf84208 (commit) via 3798c391777d0edd0984b270891f96d4707f8399 (commit) via 6fc68a4aa9ff34c43c05980172dc7aef57654e75 (commit) via 121e57a1db243aee9c24f5ec3f16b55e5d30614a (commit) via 5ef61c961f5e226fb7a9d649d1f225c08a6ea3be (commit) via c0d51b83f42a7b0161aa84f3b146db846e9f49ec (commit) via 46dd24c2e9fa9f115710afe0b4036d9ac0202a51 (commit) via a55b9d07a8265e51ea913e0897af8febb8ff6ca8 (commit) via b5205c0bc0f3c6a0c834679f4abff0a3297f2bc5 (commit) via 2ddbc457a1c6e1604c50e90b0213ad02ba98aab8 (commit) via 84c2d80964a8d5a80877d0030176cc7c8a573856 (commit) via 072bf5ad14c0430828cff305b5eaa53e6d881139 (commit) via 77e2dccf720aba4c9fb2170fd103cddbf15bb075 (commit) via 3867828816933c1af24e368a444092f5ad149bcb (commit) via 8082aa987e27c9c5a8c6b4f4b9f8fdeff37dcfa6 (commit) via 4d2cc185b0666618f59a57746813e2c92cf96ec5 (commit) via 5481d9a98cd8c415e61d14b8327f1db22d2025db (commit) via 7f075c0c28e7c1342bd2616fc0e2792ab2ce039c (commit) via 0a9f6041dc6193e8704008964e00602588468513 (commit) via 1977aa868452e67bed5a5ee5526cae0d5a032b92 (commit) via 18695c75f2b2cd41ce8c7e7893913e4c3c091f68 (commit) via 1abe3b9337e11d4c37303b3cfda22022477b53bb (commit) via b38909af0efe948d93e4e691d501036cbe33cbd8 (commit) via f1aead3174a0efe8862b9f2c314912efb33cf90d (commit) via 96b790fa2ec59c2958fa904b7a04df93d1217447 (commit) via 00b514033c829933000958e518d3a41d126ee64d (commit) via 437c7805367e4ab8c2a4098623cd706408b4ffa9 (commit) via a64061a24c1216b21c1b76c3d0f313783a9d9f54 (commit) via c47d1ef81ce262e9e98220af0f56e3f7b1deeb38 (commit) via e4f90584a76c701e8ff67461814092c28310d34f (commit) via ada25f7261aab652b0f15907412955f6b25f2dc8 (commit) via c44a097156b98074863b77d78809f32c076d8e68 (commit) via c3c9bff7b323a45d61982ffe30bc2e61059ef14c (commit) via 5f763d0d1bc2724024934b03114d87070b623a29 (commit) via 1413a9d5db3c761f2053526133142b596435553b (commit) via 28fdc32317b12e06bcc9bf806f4b19a902303c79 (commit) via 93b313909296b16feb7de444478e0fc3f09c2768 (commit) via 6626211ab67c978aacf4418fa2a84ed5720a1a16 (commit) via 58ec9a311f4ea8f1f18d703f201e4f9c2a8660a4 (commit) via 2843f1ad00238159e36af8e98a4f1e1fa49e8e18 (commit) via 5c93d44094e9a8fc181a44948fa1c437afb2daf4 (commit) via 0d95f63d745d28aa61fa330bb13670defa34a651 (commit) via a1f19d9123c3b8a86b7ef16b875dd6f5332e050c (commit) via 92d324d3aa071845b425bd9a6f6b1ad34d505250 (commit) via 336f0b4eda4cafd1ccc2696bdbfef93d7ef9ec33 (commit) via d26ddd55f7231ecc348454c26c075b5db665d1a9 (commit) via 9ad509c29a83eaebbe90b905917617cbc448dfa3 (commit) via b0de3585ea04057c16c8281fe83de74138e903ef (commit) via 6cdd3e2a2e4677b061b9fbb9ee516fae9601cd16 (commit) via d6eb7562e535137bddf8cf9df864ea40360997bc (commit) via dbe62c25e96502585f059722f60cba199dc9b8e2 (commit) via bfa414cb0fd783857d20faf9e30db5afe010a6c7 (commit) via 6980305f3a8c72fdd4c98d9756baad1864d67a29 (commit) via 42436e270cc5cf0c76ee51f75d0f701a811bd0bb (commit) via 1666783cf80b776c61bda68a9effbf54f6d1a72f (commit) via 7cefb22751ddde881d2061efea3a4b26ea8e02c8 (commit) via fea3008454a9a0290bd57db967afba7e9c980df9 (commit) via 3eafca602943d9b51cfd2190e9a031d261cf9dc4 (commit) via 45c6c4d3e42e3c114b47d52ca2e9fca6b1be8090 (commit) This update added new revisions after undoing existing revisions. That is to say, the old revision is not a strict subset of the new revision. This situation occurs when you --force push a change and generate a repository containing something like this: * -- * -- B -- O -- O -- O (15e65cfafb8a46caca8bb8a63d55edf817f17f2d) \ N -- N -- N (89253a139117b32fa0a6dc101e53e9b830361048) When this happens we assume that you've already had alert emails for all of the O revisions, and so we here report only the revisions in the N branch from the common base, B. Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 89253a139117b32fa0a6dc101e53e9b830361048 Merge: 0e0431e 92a9bac Author: Luke Dashjr <luke@openmethods.com> Date: Wed Jan 26 14:54:36 2011 -0600 MERGE: OpenMethods ASR enhancements: multiple concurrent grammars and dialplan access to start-input-timers diff --cc src/mod/applications/mod_dptools/mod_dptools.c index 5a3be03,fe089a6..928a9b8 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@@ -95,181 -96,7 +96,181 @@@ SWITCH_STANDARD_DIALPLAN(inline_dialpla return extension; } +struct action_binding { + char *realm; + char *input; + char *string; + char *value; + switch_core_session_t *session; +}; + +static switch_status_t digit_nomatch_action_callback(switch_ivr_dmachine_match_t *match) +{ + switch_core_session_t *session = (switch_core_session_t *) match->user_data; + switch_channel_t *channel = switch_core_session_get_channel(session); + char str[DMACHINE_MAX_DIGIT_LEN + 2]; + switch_event_t *event; + switch_status_t status; + + switch_channel_set_variable(channel, "last_non_matching_digits", match->match_digits); + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Digit NOT match binding [%s]\n", + switch_channel_get_name(channel), match->match_digits); + + if (switch_event_create_plain(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "digits", match->match_digits); + + if ((status = switch_core_session_queue_event(session, &event)) != SWITCH_STATUS_SUCCESS) { + switch_event_destroy(&event); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s event queue faiure.\n", + switch_core_session_get_name(session)); + } + } + + /* send it back around flagged to skip the dmachine */ + switch_snprintf(str, sizeof(str), "!%s", match->match_digits); + + switch_channel_queue_dtmf_string(channel, str); + + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match) +{ + struct action_binding *act = (struct action_binding *) match->user_data; + switch_event_t *event; + switch_status_t status; + int exec = 0; + char *string = act->string; + switch_channel_t *channel = switch_core_session_get_channel(act->session); + + switch_channel_set_variable(channel, "last_matching_digits", match->match_digits); + + if (switch_event_create_plain(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(act->session), SWITCH_LOG_DEBUG, "%s Digit match binding [%s][%s]\n", + switch_channel_get_name(channel), act->string, act->value); + + if (!strncasecmp(string, "exec:", 5)) { + string += 5; + exec = 1; + } + + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, string, act->value); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "digits", match->match_digits); + + if (exec) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute", exec == 2 ? "non-blocking" : "blocking"); + } + + if ((status = switch_core_session_queue_event(act->session, &event)) != SWITCH_STATUS_SUCCESS) { + switch_event_destroy(&event); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(act->session), SWITCH_LOG_WARNING, "%s event queue faiure.\n", + switch_core_session_get_name(act->session)); + } + } + + if (exec) { + char *cmd = switch_core_session_sprintf(act->session, "%s::%s", string, act->value); + switch_ivr_broadcast_in_thread(act->session, cmd, SMF_ECHO_ALEG|SMF_HOLD_BLEG); + } + + return SWITCH_STATUS_SUCCESS; +} + +#define CLEAR_DIGIT_ACTION_USAGE "<realm>|all" +SWITCH_STANDARD_APP(clear_digit_action_function) +{ + //switch_channel_t *channel = switch_core_session_get_channel(session); + switch_ivr_dmachine_t *dmachine; + char *realm = (char *) data; + + if ((dmachine = switch_core_session_get_dmachine(session))) { + if (zstr(realm) || !strcasecmp(realm, "all")) { + switch_core_session_set_dmachine(session, NULL); + switch_ivr_dmachine_destroy(&dmachine); + } else { + switch_ivr_dmachine_clear_realm(dmachine, realm); + } + } +} + +#define DIGIT_ACTION_SET_REALM_USAGE "<realm>" +SWITCH_STANDARD_APP(digit_action_set_realm_function) +{ + switch_ivr_dmachine_t *dmachine; + char *realm = (char *) data; + + if (zstr(data)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Syntax Error, USAGE %s\n", DIGIT_ACTION_SET_REALM_USAGE); + return; + } + + if ((dmachine = switch_core_session_get_dmachine(session))) { + switch_ivr_dmachine_set_realm(dmachine, realm); + } + +} + +#define BIND_DIGIT_ACTION_USAGE "<realm>,<digits|~regex>,<string>,<value>" +SWITCH_STANDARD_APP(bind_digit_action_function) +{ + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_ivr_dmachine_t *dmachine; + char *mydata; + int argc = 0; + char *argv[4] = { 0 }; + struct action_binding *act; + + if (zstr(data)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Syntax Error, USAGE %s\n", BIND_DIGIT_ACTION_USAGE); + return; + } + + mydata = switch_core_session_strdup(session, data); + + argc = switch_separate_string(mydata, ',', argv, (sizeof(argv) / sizeof(argv[0]))); + + if (argc < 4 || zstr(argv[0]) || zstr(argv[1]) || zstr(argv[2]) || zstr(argv[3])) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Syntax Error, USAGE %s\n", BIND_DIGIT_ACTION_USAGE); + return; + } + + + if (!(dmachine = switch_core_session_get_dmachine(session))) { + uint32_t digit_timeout = 1500; + uint32_t input_timeout = 0; + const char *var; + uint32_t tmp; + + if ((var = switch_channel_get_variable(channel, "bind_digit_digit_timeout"))) { + tmp = (uint32_t) atol(var); + if (tmp < 0) tmp = 0; + digit_timeout = tmp; + } + + if ((var = switch_channel_get_variable(channel, "bind_digit_input_timeout"))) { + tmp = (uint32_t) atol(var); + if (tmp < 0) tmp = 0; + input_timeout = tmp; + } + + switch_ivr_dmachine_create(&dmachine, "DPTOOLS", NULL, digit_timeout, input_timeout, NULL, digit_nomatch_action_callback, session); + switch_core_session_set_dmachine(session, dmachine); + } + + + act = switch_core_session_alloc(session, sizeof(*act)); + act->realm = argv[0]; + act->input = argv[1]; + act->string = argv[2]; + act->value = argv[3]; + act->session = session; + + switch_ivr_dmachine_bind(dmachine, act->realm, act->input, 0, digit_action_callback, act); +} + + - #define DETECT_SPEECH_SYNTAX "<mod_name> <gram_name> <gram_path> [<addr>] OR grammar <gram_name> [<path>] OR nogrammar <gram_name> OR pause OR resume OR stop OR param <name> <value>" + #define DETECT_SPEECH_SYNTAX "<mod_name> <gram_name> <gram_path> [<addr>] OR grammar <gram_name> [<path>] OR nogrammar <gram_name> OR grammaron/grammaroff <gram_name> OR grammarsalloff OR pause OR resume OR start_input_timers OR stop OR param <name> <value>" SWITCH_STANDARD_APP(detect_speech_function) { char *argv[4]; commit 0e0431ecc66d04236cf4940b65977bad424fdc86 Author: Daniel Swarbrick <daniel@seventhsignal.de> Date: Wed Jan 26 20:05:16 2011 +0100 update mod_sofia management interface OID diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index eb5e2ad..6c91ce1 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -4850,7 +4850,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) sofia_endpoint_interface->state_handler = &sofia_event_handlers; management_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_MANAGEMENT_INTERFACE); - management_interface->relative_oid = "1"; + management_interface->relative_oid = "1001"; management_interface->management_function = sofia_manage; SWITCH_ADD_API(api_interface, "sofia", "Sofia Controls", sofia_function, "<cmd> <args>"); commit 7c624767116b30dc9074c1cfbbe7c3a5771950f9 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Jan 25 14:13:15 2011 -0600 revert change from 2800ea199d6c233fe0aeee91de3be33dfee19607 and add disconnect packet on listener kill diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index 344b0ee..f3a2c92 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -32,7 +32,7 @@ #include <switch.h> #define CMD_BUFLEN 1024 * 1000 #define MAX_QUEUE_LEN 25000 -#define MAX_MISSED 2000 +#define MAX_MISSED 500 SWITCH_MODULE_LOAD_FUNCTION(mod_event_socket_load); SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_event_socket_shutdown); SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_socket_runtime); @@ -143,7 +143,7 @@ static const char *format2str(event_format_t format) } static void remove_listener(listener_t *listener); -static void kill_listener(listener_t *l); +static void kill_listener(listener_t *l, const char *message); static void kill_all_listeners(void); static uint32_t next_id(void) @@ -170,7 +170,7 @@ static switch_status_t socket_logger(const switch_log_node_t *node, switch_log_l if (switch_test_flag(l, LFLAG_LOG) && l->level >= node->level) { switch_log_node_t *dnode = switch_log_node_dup(node); - if (switch_queue_push(l->log_queue, dnode) == SWITCH_STATUS_SUCCESS) { + if (switch_queue_trypush(l->log_queue, dnode) == SWITCH_STATUS_SUCCESS) { if (l->lost_logs) { int ll = l->lost_logs; switch_event_t *event; @@ -184,7 +184,7 @@ static switch_status_t socket_logger(const switch_log_node_t *node, switch_log_l } else { switch_log_node_free(&dnode); if (++l->lost_logs > MAX_MISSED) { - kill_listener(l); + kill_listener(l, "Disconnected due to log queue failure.\n"); } } } @@ -366,7 +366,7 @@ static void event_handler(switch_event_t *event) if (send) { if (switch_event_dup(&clone, event) == SWITCH_STATUS_SUCCESS) { - if (switch_queue_push(l->event_queue, clone) == SWITCH_STATUS_SUCCESS) { + if (switch_queue_trypush(l->event_queue, clone) == SWITCH_STATUS_SUCCESS) { if (l->lost_events) { int le = l->lost_events; l->lost_events = 0; @@ -379,7 +379,7 @@ static void event_handler(switch_event_t *event) } } else { if (++l->lost_events > MAX_MISSED) { - kill_listener(l); + kill_listener(l, "Disconnected due to event queue failure.\n"); } switch_event_destroy(&clone); } @@ -579,8 +579,41 @@ static void remove_listener(listener_t *listener) switch_mutex_unlock(globals.listener_mutex); } -static void kill_listener(listener_t *l) +static void send_disconnect(listener_t *listener, const char *message) { + + char disco_buf[512] = ""; + switch_size_t len, mlen; + + if (zstr(message)) { + message = "Disconnected.\n"; + } + + mlen = strlen(message); + + if (listener->session) { + switch_snprintf(disco_buf, sizeof(disco_buf), "Content-Type: text/disconnect-notice\n" + "Controlled-Session-UUID: %s\n" + "Content-Disposition: disconnect\n" "Content-Length: %d\n\n", switch_core_session_get_uuid(listener->session), mlen); + } else { + switch_snprintf(disco_buf, sizeof(disco_buf), "Content-Type: text/disconnect-notice\nContent-Length: %d\n\n", mlen); + } + + len = strlen(disco_buf); + switch_socket_send(listener->sock, disco_buf, &len); + if (len > 0) { + len = mlen; + switch_socket_send(listener->sock, message, &len); + } +} + +static void kill_listener(listener_t *l, const char *message) +{ + + if (message) { + send_disconnect(l, message); + } + switch_clear_flag(l, LFLAG_RUNNING); if (l->sock) { switch_socket_shutdown(l->sock, SWITCH_SHUTDOWN_READWRITE); @@ -595,7 +628,7 @@ static void kill_all_listeners(void) switch_mutex_lock(globals.listener_mutex); for (l = listen_list.listeners; l; l = l->next) { - kill_listener(l); + kill_listener(l, "The system is being shut down.\n"); } switch_mutex_unlock(globals.listener_mutex); } @@ -1233,7 +1266,7 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event, if (switch_channel_get_state(chan) < CS_HANGUP && switch_channel_test_flag(chan, CF_DIVERT_EVENTS)) { switch_event_t *e = NULL; while (switch_core_session_dequeue_event(listener->session, &e, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) { - if (switch_queue_push(listener->event_queue, e) != SWITCH_STATUS_SUCCESS) { + if (switch_queue_trypush(listener->event_queue, e) != SWITCH_STATUS_SUCCESS) { switch_core_session_queue_event(listener->session, &e); break; } @@ -2540,22 +2573,7 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) } if (listener->sock) { - char disco_buf[512] = ""; - const char message[] = "Disconnected, goodbye.\nSee you at ClueCon! http://www.cluecon.com/\n"; - int mlen = strlen(message); - - if (listener->session) { - switch_snprintf(disco_buf, sizeof(disco_buf), "Content-Type: text/disconnect-notice\n" - "Controlled-Session-UUID: %s\n" - "Content-Disposition: disconnect\n" "Content-Length: %d\n\n", switch_core_session_get_uuid(listener->session), mlen); - } else { - switch_snprintf(disco_buf, sizeof(disco_buf), "Content-Type: text/disconnect-notice\nContent-Length: %d\n\n", mlen); - } - - len = strlen(disco_buf); - switch_socket_send(listener->sock, disco_buf, &len); - len = mlen; - switch_socket_send(listener->sock, message, &len); + send_disconnect(listener, "Disconnected, goodbye.\nSee you at ClueCon! http://www.cluecon.com/\n"); close_socket(&listener->sock); } commit 83d5cd6ff6f2f6e23c09ee387098a59d7764a84f Author: Daniel Swarbrick <daniel@seventhsignal.de> Date: Tue Jan 25 20:04:29 2011 +0100 whoops, tab craziness diff --git a/src/mod/event_handlers/mod_snmp/subagent.h b/src/mod/event_handlers/mod_snmp/subagent.h index 72dbeeb..3315378 100644 --- a/src/mod/event_handlers/mod_snmp/subagent.h +++ b/src/mod/event_handlers/mod_snmp/subagent.h @@ -2,15 +2,15 @@ #define subagent_H /* .1.3.6.1.4.1.27880.1.1 */ -#define ID_VERSION_STR 1 -#define ID_UUID 2 +#define ID_VERSION_STR 1 +#define ID_UUID 2 /* .1.3.6.1.4.1.27880.1.2 */ -#define SS_UPTIME 1 +#define SS_UPTIME 1 #define SS_SESSIONS_SINCE_STARTUP 2 -#define SS_CURRENT_SESSIONS 3 -#define SS_MAX_SESSIONS 4 -#define SS_CURRENT_CALLS 5 +#define SS_CURRENT_SESSIONS 3 +#define SS_MAX_SESSIONS 4 +#define SS_CURRENT_CALLS 5 #define SS_SESSIONS_PER_SECOND 6 #define SS_MAX_SESSIONS_PER_SECOND 7 commit 4b731fd64c1bf16a0da20f1c10de8d382faed3a4 Author: Daniel Swarbrick <daniel@seventhsignal.de> Date: Tue Jan 25 20:00:32 2011 +0100 tidy up subagent and #defines diff --git a/src/mod/event_handlers/mod_snmp/mod_snmp.c b/src/mod/event_handlers/mod_snmp/mod_snmp.c index 79ccd16..0310637 100644 --- a/src/mod/event_handlers/mod_snmp/mod_snmp.c +++ b/src/mod/event_handlers/mod_snmp/mod_snmp.c @@ -101,8 +101,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_snmp_load) SWITCH_MODULE_RUNTIME_FUNCTION(mod_snmp_runtime) { if (!globals.shutdown) { - /* Block on select() */ switch_mutex_lock(globals.mutex); + /* Block on select() */ agent_check_and_process(1); switch_mutex_unlock(globals.mutex); } diff --git a/src/mod/event_handlers/mod_snmp/subagent.c b/src/mod/event_handlers/mod_snmp/subagent.c index ad36624..2da9ebe 100644 --- a/src/mod/event_handlers/mod_snmp/subagent.c +++ b/src/mod/event_handlers/mod_snmp/subagent.c @@ -37,31 +37,12 @@ #include "subagent.h" -static oid identity_oid[] = { 1,3,6,1,4,1,27880,1,1 }; -static oid systemStats_oid[] = { 1,3,6,1,4,1,27880,1,2 }; - -/* identity sub-IDs - these must match MIB */ -enum { - versionString_oid = 1, - uuid_oid -}; - - -/* systemStats sub-IDs - these must match MIB */ -enum { - uptime_oid = 1, - sessionsSinceStartup_oid, - currentSessions_oid, - maxSessions_oid, - currentCalls_oid, - sessionsPerSecond_oid, - maxSessionsPerSecond_oid -}; - - void init_subagent(void) { - DEBUGMSGTL(("init_nstAgentSubagentObject", "Initializing\n")); + static oid identity_oid[] = { 1,3,6,1,4,1,27880,1,1 }; + static oid systemStats_oid[] = { 1,3,6,1,4,1,27880,1,2 }; + + DEBUGMSGTL(("init_subagent", "Initializing\n")); netsnmp_register_scalar_group(netsnmp_create_handler_registration("identity", handle_identity, identity_oid, OID_LENGTH(identity_oid), HANDLER_CAN_RONLY), 1, 2); netsnmp_register_scalar_group(netsnmp_create_handler_registration("systemStats", handle_systemStats, systemStats_oid, OID_LENGTH(systemStats_oid), HANDLER_CAN_RONLY), 1, 7); @@ -70,28 +51,26 @@ void init_subagent(void) int handle_identity(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests) { - static char const version[] = SWITCH_VERSION_FULL; - char uuid[40] = ""; netsnmp_request_info *request = NULL; oid subid; + static char const version[] = SWITCH_VERSION_FULL; + char uuid[40] = ""; switch(reqinfo->mode) { case MODE_GET: - for (request = requests; request; request = request->next) { - subid = request->requestvb->name[reginfo->rootoid_len - 2]; - - switch (subid) { - case versionString_oid: - snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) &version, strlen(version)); - break; - case uuid_oid: - strncpy(uuid, switch_core_get_uuid(), sizeof(uuid)); - snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) &uuid, strlen(uuid)); - break; - default: - snmp_log(LOG_WARNING, "Unregistered OID-suffix requested (%d)\n", (int) subid); - netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT); - } + subid = requests->requestvb->name[reginfo->rootoid_len - 2]; + + switch (subid) { + case ID_VERSION_STR: + snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) &version, strlen(version)); + break; + case ID_UUID: + strncpy(uuid, switch_core_get_uuid(), sizeof(uuid)); + snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) &uuid, strlen(uuid)); + break; + default: + snmp_log(LOG_WARNING, "Unregistered OID-suffix requested (%d)\n", (int) subid); + netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT); } break; @@ -114,47 +93,45 @@ int handle_systemStats(netsnmp_mib_handler *handler, netsnmp_handler_registratio switch(reqinfo->mode) { case MODE_GET: - for (request = requests; request; request = request->next) { - subid = request->requestvb->name[reginfo->rootoid_len - 2]; - - switch (subid) { - case uptime_oid: - uptime = switch_core_uptime() / 10000; - snmp_set_var_typed_value(requests->requestvb, ASN_TIMETICKS, (u_char *) &uptime, sizeof(uptime)); - break; - case sessionsSinceStartup_oid: - int_val = switch_core_session_id() - 1; - snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER, (u_char *) &int_val, sizeof(int_val)); - break; - case currentSessions_oid: - int_val = switch_core_session_count(); - snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val)); - break; - case maxSessions_oid: - switch_core_session_ctl(SCSC_MAX_SESSIONS, &int_val);; - snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val)); - break; - case currentCalls_oid: - /* - * This is zero for now, since there is no convenient way to get total call - * count (not to be confused with session count), without touching the - * database. - */ - int_val = 0; - snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val)); - break; - case sessionsPerSecond_oid: - switch_core_session_ctl(SCSC_LAST_SPS, &int_val); - snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val)); - break; - case maxSessionsPerSecond_oid: - switch_core_session_ctl(SCSC_SPS, &int_val); - snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val)); - break; - default: - snmp_log(LOG_WARNING, "Unregistered OID-suffix requested (%d)\n", (int) subid); - netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT); - } + subid = requests->requestvb->name[reginfo->rootoid_len - 2]; + + switch (subid) { + case SS_UPTIME: + uptime = switch_core_uptime() / 10000; + snmp_set_var_typed_value(requests->requestvb, ASN_TIMETICKS, (u_char *) &uptime, sizeof(uptime)); + break; + case SS_SESSIONS_SINCE_STARTUP: + int_val = switch_core_session_id() - 1; + snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER, (u_char *) &int_val, sizeof(int_val)); + break; + case SS_CURRENT_SESSIONS: + int_val = switch_core_session_count(); + snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val)); + break; + case SS_MAX_SESSIONS: + switch_core_session_ctl(SCSC_MAX_SESSIONS, &int_val);; + snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val)); + break; + case SS_CURRENT_CALLS: + /* + * This is zero for now, since there is no convenient way to get total call + * count (not to be confused with session count), without touching the + * database. + */ + int_val = 0; + snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val)); + break; + case SS_SESSIONS_PER_SECOND: + switch_core_session_ctl(SCSC_LAST_SPS, &int_val); + snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val)); + break; + case SS_MAX_SESSIONS_PER_SECOND: + switch_core_session_ctl(SCSC_SPS, &int_val); + snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val)); + break; + default: + snmp_log(LOG_WARNING, "Unregistered OID-suffix requested (%d)\n", (int) subid); + netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT); } break; diff --git a/src/mod/event_handlers/mod_snmp/subagent.h b/src/mod/event_handlers/mod_snmp/subagent.h index 8a57d8a..72dbeeb 100644 --- a/src/mod/event_handlers/mod_snmp/subagent.h +++ b/src/mod/event_handlers/mod_snmp/subagent.h @@ -1,6 +1,20 @@ #ifndef subagent_H #define subagent_H +/* .1.3.6.1.4.1.27880.1.1 */ +#define ID_VERSION_STR 1 +#define ID_UUID 2 + +/* .1.3.6.1.4.1.27880.1.2 */ +#define SS_UPTIME 1 +#define SS_SESSIONS_SINCE_STARTUP 2 +#define SS_CURRENT_SESSIONS 3 +#define SS_MAX_SESSIONS 4 +#define SS_CURRENT_CALLS 5 +#define SS_SESSIONS_PER_SECOND 6 +#define SS_MAX_SESSIONS_PER_SECOND 7 + + void init_subagent(void); Netsnmp_Node_Handler handle_identity; Netsnmp_Node_Handler handle_systemStats; commit 636c1ecb4e9cace5967390a8a8125fa783f6d0b9 Author: Daniel Swarbrick <daniel@seventhsignal.de> Date: Tue Jan 25 19:19:17 2011 +0100 wrap potentially non-threadsafe snmp operations in mutex; support snmpwalk in subagent diff --git a/src/mod/event_handlers/mod_snmp/mod_snmp.c b/src/mod/event_handlers/mod_snmp/mod_snmp.c index 36a133c..79ccd16 100644 --- a/src/mod/event_handlers/mod_snmp/mod_snmp.c +++ b/src/mod/event_handlers/mod_snmp/mod_snmp.c @@ -38,6 +38,7 @@ static struct { switch_memory_pool_t *pool; + switch_mutex_t *mutex; int shutdown; } globals; @@ -55,27 +56,13 @@ static int snmp_callback_log(int major, int minor, void *serverarg, void *client } -static switch_state_handler_table_t state_handlers = { - /*.on_init */ NULL, - /*.on_routing */ NULL, - /*.on_execute */ NULL, - /*.on_hangup */ NULL, - /*.on_exchange_media */ NULL, - /*.on_soft_execute */ NULL, - /*.on_consume_media */ NULL, - /*.on_hibernate */ NULL, - /*.on_reset */ NULL, - /*.on_park */ NULL, - /*.on_reporting */ NULL -}; - - static switch_status_t load_config(switch_memory_pool_t *pool) { switch_status_t status = SWITCH_STATUS_SUCCESS; memset(&globals, 0, sizeof(globals)); globals.pool = pool; + switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool); return status; } @@ -87,7 +74,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_snmp_load) load_config(pool); - switch_core_add_state_handler(&state_handlers); *module_interface = switch_loadable_module_create_module_interface(pool, modname); /* Register callback function so we get Net-SNMP logging handled by FreeSWITCH */ @@ -114,9 +100,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_snmp_load) SWITCH_MODULE_RUNTIME_FUNCTION(mod_snmp_runtime) { - while (!globals.shutdown) { + if (!globals.shutdown) { /* Block on select() */ + switch_mutex_lock(globals.mutex); agent_check_and_process(1); + switch_mutex_unlock(globals.mutex); } return SWITCH_STATUS_SUCCESS; @@ -126,9 +114,12 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_snmp_runtime) SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_snmp_shutdown) { globals.shutdown = 1; - switch_core_remove_state_handler(&state_handlers); + switch_mutex_lock(globals.mutex); snmp_shutdown("mod_snmp"); + switch_mutex_unlock(globals.mutex); + + switch_mutex_destroy(globals.mutex); return SWITCH_STATUS_SUCCESS; } diff --git a/src/mod/event_handlers/mod_snmp/subagent.c b/src/mod/event_handlers/mod_snmp/subagent.c index 8a9f2da..ad36624 100644 --- a/src/mod/event_handlers/mod_snmp/subagent.c +++ b/src/mod/event_handlers/mod_snmp/subagent.c @@ -63,8 +63,8 @@ void init_subagent(void) { DEBUGMSGTL(("init_nstAgentSubagentObject", "Initializing\n")); - netsnmp_register_handler(netsnmp_create_handler_registration("identity", handle_identity, identity_oid, OID_LENGTH(identity_oid), HANDLER_CAN_RONLY)); - netsnmp_register_handler(netsnmp_create_handler_registration("systemStats", handle_systemStats, systemStats_oid, OID_LENGTH(systemStats_oid), HANDLER_CAN_RONLY)); + netsnmp_register_scalar_group(netsnmp_create_handler_registration("identity", handle_identity, identity_oid, OID_LENGTH(identity_oid), HANDLER_CAN_RONLY), 1, 2); + netsnmp_register_scalar_group(netsnmp_create_handler_registration("systemStats", handle_systemStats, systemStats_oid, OID_LENGTH(systemStats_oid), HANDLER_CAN_RONLY), 1, 7); } @@ -76,33 +76,29 @@ int handle_identity(netsnmp_mib_handler *handler, netsnmp_handler_registration * oid subid; switch(reqinfo->mode) { - case MODE_GET: - for (request = requests; request; request = request->next) { - subid = request->requestvb->name[OID_LENGTH(systemStats_oid)]; - - switch (subid) { - case versionString_oid: - snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) &version, strlen(version)); - break; - case uuid_oid: - strncpy(uuid, switch_core_get_uuid(), sizeof(uuid)); - snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) &uuid, strlen(uuid)); - break; - default: - snmp_log(LOG_WARNING, "Unregistered OID-suffix requested (%d)\n", (int) subid); - netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT); - } + case MODE_GET: + for (request = requests; request; request = request->next) { + subid = request->requestvb->name[reginfo->rootoid_len - 2]; + + switch (subid) { + case versionString_oid: + snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) &version, strlen(version)); + break; + case uuid_oid: + strncpy(uuid, switch_core_get_uuid(), sizeof(uuid)); + snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) &uuid, strlen(uuid)); + break; + default: + snmp_log(LOG_WARNING, "Unregistered OID-suffix requested (%d)\n", (int) subid); + netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT); } - break; + } + break; - case MODE_GETNEXT: - snmp_log(LOG_ERR, "MODE_GETNEXT not supported (yet)\n"); - break; - - default: - /* we should never get here, so this is a really bad error */ - snmp_log(LOG_ERR, "Unknown mode (%d) in handle_versionString\n", reqinfo->mode ); - return SNMP_ERR_GENERR; + default: + /* we should never get here, so this is a really bad error */ + snmp_log(LOG_ERR, "Unknown mode (%d) in handle_identity\n", reqinfo->mode ); + return SNMP_ERR_GENERR; } return SNMP_ERR_NOERROR; @@ -117,59 +113,55 @@ int handle_systemStats(netsnmp_mib_handler *handler, netsnmp_handler_registratio uint32_t int_val; switch(reqinfo->mode) { - case MODE_GET: - for (request = requests; request; request = request->next) { - subid = request->requestvb->name[OID_LENGTH(systemStats_oid)]; - - switch (subid) { - case uptime_oid: - uptime = switch_core_uptime() / 10000; - snmp_set_var_typed_value(requests->requestvb, ASN_TIMETICKS, (u_char *) &uptime, sizeof(uptime)); - break; - case sessionsSinceStartup_oid: - int_val = switch_core_session_id() - 1; - snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER, (u_char *) &int_val, sizeof(int_val)); - break; - case currentSessions_oid: - int_val = switch_core_session_count(); - snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val)); - break; - case maxSessions_oid: - switch_core_session_ctl(SCSC_MAX_SESSIONS, &int_val);; - snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val)); - break; - case currentCalls_oid: - /* - * This is zero for now, since there is no convenient way to get total call - * count (not to be confused with session count), without touching the - * database. - */ - int_val = 0; - snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val)); - break; - case sessionsPerSecond_oid: - switch_core_session_ctl(SCSC_LAST_SPS, &int_val); - snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val)); - break; - case maxSessionsPerSecond_oid: - switch_core_session_ctl(SCSC_SPS, &int_val); - snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val)); - break; - default: - snmp_log(LOG_WARNING, "Unregistered OID-suffix requested (%d)\n", (int) subid); - netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT); - } + case MODE_GET: + for (request = requests; request; request = request->next) { + subid = request->requestvb->name[reginfo->rootoid_len - 2]; + + switch (subid) { + case uptime_oid: + uptime = switch_core_uptime() / 10000; + snmp_set_var_typed_value(requests->requestvb, ASN_TIMETICKS, (u_char *) &uptime, sizeof(uptime)); + break; + case sessionsSinceStartup_oid: + int_val = switch_core_session_id() - 1; + snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER, (u_char *) &int_val, sizeof(int_val)); + break; + case currentSessions_oid: + int_val = switch_core_session_count(); + snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val)); + break; + case maxSessions_oid: + switch_core_session_ctl(SCSC_MAX_SESSIONS, &int_val);; + snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val)); + break; + case currentCalls_oid: + /* + * This is zero for now, since there is no convenient way to get total call + * count (not to be confused with session count), without touching the + * database. + */ + int_val = 0; + snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val)); + break; + case sessionsPerSecond_oid: + switch_core_session_ctl(SCSC_LAST_SPS, &int_val); + snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val)); + break; + case maxSessionsPerSecond_oid: + switch_core_session_ctl(SCSC_SPS, &int_val); + snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val)); + break; + default: + snmp_log(LOG_WARNING, "Unregistered OID-suffix requested (%d)\n", (int) subid); + netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT); } - break; - - case MODE_GETNEXT: - snmp_log(LOG_ERR, "MODE_GETNEXT not supported (yet)\n"); - break; + } + break; - default: - /* we should never get here, so this is a really bad error */ - snmp_log(LOG_ERR, "Unknown mode (%d) in handle_systemStats\n", reqinfo->mode); - return SNMP_ERR_GENERR; + default: + /* we should never get here, so this is a really bad error */ + snmp_log(LOG_ERR, "Unknown mode (%d) in handle_systemStats\n", reqinfo->mode); + return SNMP_ERR_GENERR; } return SNMP_ERR_NOERROR; commit 02d1af647bac6b937de02608d53ea1831f51b968 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Jan 25 11:26:32 2011 -0600 use switch_queue_trypop_timeout instead of a timer in mod_loopback to improve audio quality when not using bowout features diff --git a/src/mod/endpoints/mod_loopback/mod_loopback.c b/src/mod/endpoints/mod_loopback/mod_loopback.c index f875f6b..aa57668 100644 --- a/src/mod/endpoints/mod_loopback/mod_loopback.c +++ b/src/mod/endpoints/mod_loopback/mod_loopback.c @@ -77,11 +77,11 @@ struct private_object { switch_frame_t cng_frame; unsigned char cng_databuf[SWITCH_RECOMMENDED_BUFFER_SIZE]; - switch_timer_t timer; switch_caller_profile_t *caller_profile; int32_t bowout_frame_count; char *other_uuid; switch_queue_t *frame_queue; + switch_codec_implementation_t read_impl; }; typedef struct private_object private_t; @@ -111,7 +111,6 @@ static switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *ses int interval = 20; switch_status_t status = SWITCH_STATUS_SUCCESS; switch_channel_t *channel = switch_core_session_get_channel(session); - const switch_codec_implementation_t *read_impl; if (codec) { iananame = codec->implementation->iananame; @@ -166,15 +165,7 @@ static switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *ses switch_core_session_set_read_codec(session, &tech_pvt->read_codec); switch_core_session_set_write_codec(session, &tech_pvt->write_codec); - if (tech_pvt->flag_mutex) { - switch_core_timer_destroy(&tech_pvt->timer); - } - - read_impl = tech_pvt->read_codec.implementation; - - switch_core_timer_init(&tech_pvt->timer, "soft", - read_impl->microseconds_per_packet / 1000, read_impl->samples_per_packet * 4, switch_core_session_get_pool(session)); - + tech_pvt->read_impl = *tech_pvt->read_codec.implementation; if (!tech_pvt->flag_mutex) { switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session)); @@ -376,7 +367,6 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session) tech_pvt = switch_core_session_get_private(session); if (tech_pvt) { - switch_core_timer_destroy(&tech_pvt->timer); if (switch_core_codec_ready(&tech_pvt->read_codec)) { switch_core_codec_destroy(&tech_pvt->read_codec); @@ -568,12 +558,10 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch goto end; } - switch_core_timer_next(&tech_pvt->timer); - mutex = tech_pvt->mutex; - switch_mutex_lock(mutex); - if (switch_queue_trypop(tech_pvt->frame_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) { + + if (switch_queue_pop_timeout(tech_pvt->frame_queue, &pop, tech_pvt->read_impl.microseconds_per_packet) == SWITCH_STATUS_SUCCESS && pop) { if (tech_pvt->write_frame) { switch_frame_free(&tech_pvt->write_frame); } @@ -585,6 +573,8 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch switch_set_flag(tech_pvt, TFLAG_CNG); } + switch_mutex_lock(mutex); + if (switch_test_flag(tech_pvt, TFLAG_CNG)) { unsigned char data[SWITCH_RECOMMENDED_BUFFER_SIZE]; uint32_t flag = 0; @@ -775,8 +765,6 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s switch_frame_free(&frame); } - switch_core_timer_sync(&tech_pvt->timer); - } break; default: commit 28465f38a08df99a76864bbf6a9ae5e4e7bcd720 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Jan 25 11:12:16 2011 -0600 update syntax diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 1c12e1c..7771b09 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -2372,7 +2372,7 @@ SWITCH_STANDARD_API(uuid_media_function) return SWITCH_STATUS_SUCCESS; } -#define BROADCAST_SYNTAX "<uuid> <path> [aleg|bleg|both]" +#define BROADCAST_SYNTAX "<uuid> <path> [aleg|bleg|holdb|both]" SWITCH_STANDARD_API(uuid_broadcast_function) { char *mycmd = NULL, *argv[4] = { 0 }; commit d164a79764c49dd11bbffcd26d6ca98770181c67 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Jan 25 11:10:59 2011 -0600 add moh by default to uuid_broadcast when only broadcasting to A leg use aleg arg to disable this diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 15ac8ec..1c12e1c 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -2389,15 +2389,26 @@ SWITCH_STANDARD_API(uuid_broadcast_function) switch_media_flag_t flags = SMF_NONE; if (argv[2]) { - if (!strcasecmp(argv[2], "both")) { + if (switch_stristr("both", (argv[2]))) { flags |= (SMF_ECHO_ALEG | SMF_ECHO_BLEG); - } else if (!strcasecmp(argv[2], "aleg")) { + } + + if (switch_stristr("aleg", argv[2])) { flags |= SMF_ECHO_ALEG; - } else if (!strcasecmp(argv[2], "bleg")) { + } + + if (switch_stristr("bleg", argv[2])) { + flags &= ~SMF_HOLD_BLEG; flags |= SMF_ECHO_BLEG; } + + if (switch_stristr("holdb", argv[2])) { + flags &= ~SMF_ECHO_BLEG; + flags |= SMF_HOLD_BLEG; + } + } else { - flags |= SMF_ECHO_ALEG; + flags = SMF_ECHO_ALEG | SMF_HOLD_BLEG; } status = switch_ivr_broadcast(argv[0], argv[1], flags); commit e78f2bfb5d5f17d0646f0bc2a9fad03546eac646 Author: cypromis <michal.bielicki@seventhsignal.de> Date: Tue Jan 25 05:24:46 2011 +0100 not sure the stuff is needed in the core iksemel. this will take some more teting via hudson and some more comits, but hey, it does not have an impact on anythingbut solaris and derivates diff --git a/libs/iksemel/src/Makefile.am b/libs/iksemel/src/Makefile.am index 10236f6..9d3da69 100644 --- a/libs/iksemel/src/Makefile.am +++ b/libs/iksemel/src/Makefile.am @@ -25,5 +25,5 @@ libiksemel_la_SOURCES = \ base64.c libiksemel_la_LDFLAGS = -version-info 4:0:1 -no-undefined -libiksemel_la_CFLAGS = $(CFLAGS) $(LIBGNUTLS_CFLAGS) @SUNCFLAGS@ -libiksemel_la_LIBADD = $(LIBGNUTLS_LIBS) @SUNCFLAGS@ +libiksemel_la_CFLAGS = $(CFLAGS) $(LIBGNUTLS_CFLAGS) +libiksemel_la_LIBADD = $(LIBGNUTLS_LIBS) commit 9509befbfa43810dcde11532663561838d267f2c Author: cypromis <michal.bielicki@seventhsignal.de> Date: Tue Jan 25 04:54:33 2011 +0100 more sun fixes to libiksemel. diff --git a/libs/iksemel/configure.ac b/libs/iksemel/configure.ac index e00af1f..49d8621 100644 --- a/libs/iksemel/configure.ac +++ b/libs/iksemel/configure.ac @@ -83,9 +83,13 @@ AC_ARG_ENABLE(64, if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then if test "${enable_64}" = "yes"; then - CFLAGS="$CFLAGS -m64 -lgpg-error" - CXXFLAGS="$CXXFLAGS -m64 -lgpg-error" - SUNFLAGS="-lgpg.error" + CFLAGS="$CFLAGS -xc99=all -mt -m64 -lgpg-error" + CXXFLAGS="$CXXFLAGS -xc99=all -mt -m64 -lgpg-error" + SUNFLAGS="-xc99=all -mt -m64 -lgpg-error" + else + CFLAGS="$CFLAGS -xc99=all -mt -lgpg-error" + CXXFLAGS="$CXXFLAGS -xc99=all -mt -lgpg-error" + SUNFLAGS="-xc99=all -mt -lgpg-error" fi fi diff --git a/libs/iksemel/src/Makefile.am b/libs/iksemel/src/Makefile.am index 20ca263..10236f6 100644 --- a/libs/iksemel/src/Makefile.am +++ b/libs/iksemel/src/Makefile.am @@ -25,5 +25,5 @@ libiksemel_la_SOURCES = \ base64.c libiksemel_la_LDFLAGS = -version-info 4:0:1 -no-undefined -libiksemel_la_CFLAGS = $(CFLAGS) $(LIBGNUTLS_CFLAGS) -libiksemel_la_LIBADD = $(LIBGNUTLS_LIBS) +libiksemel_la_CFLAGS = $(CFLAGS) $(LIBGNUTLS_CFLAGS) @SUNCFLAGS@ +libiksemel_la_LIBADD = $(LIBGNUTLS_LIBS) @SUNCFLAGS@ commit 0d098a5110e095bb9334196978289e081d5a022b Author: Jeff Lenk <jeff@jefflenk.com> Date: Mon Jan 24 21:42:54 2011 -0600 revert till right solution found diff --git a/w32/Setup/Product.wxs b/w32/Setup/Product.wxs index 1de2ec2..2f072aa 100644 --- a/w32/Setup/Product.wxs +++ b/w32/Setup/Product.wxs @@ -57,9 +57,6 @@ WorkingDirectory="INSTALLLOCATION"/> <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/> <RegistryValue Root="HKCU" Key="Software\FreeSWITCH\FreeSWITCH" Name="installed" Type="integer" Value="1" KeyPath="yes"/> - <CreateFolder Directory="INSTALLLOCATION"> - <Permission User="Authenticated Users" GenericAll="yes" /> - </CreateFolder> </Component> <Component Id="FSCliShortcut" Guid="D209546C-C728-4d8f-BDB2-29AED8824282"> <Shortcut Id="FSCliStartMenuShortcut" @@ -68,9 +65,6 @@ Target="[INSTALLLOCATION]fs_cli.exe" WorkingDirectory="INSTALLLOCATION"/> <RegistryValue Root="HKCU" Key="Software\FreeSWITCH\FS_CLI" Name="installed" Type="integer" Value="1" KeyPath="yes"/> - <CreateFolder Directory="INSTALLLOCATION"> - <Permission User="Authenticated Users" GenericAll="yes" /> - </CreateFolder> </Component> </DirectoryRef> commit 80a6279993f2369e79e70bc9b61bfcaf2f3e5f4c Author: cypromis <michal.bielicki@seventhsignal.de> Date: Tue Jan 25 04:14:31 2011 +0100 explicitly add gpg-error if sun comiler, maybe that solves it finaly diff --git a/libs/iksemel/configure.ac b/libs/iksemel/configure.ac index 7761eb0..e00af1f 100644 --- a/libs/iksemel/configure.ac +++ b/libs/iksemel/configure.ac @@ -85,9 +85,12 @@ if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then if test "${enable_64}" = "yes"; then CFLAGS="$CFLAGS -m64 -lgpg-error" CXXFLAGS="$CXXFLAGS -m64 -lgpg-error" + SUNFLAGS="-lgpg.error" fi fi +AC_SUBST(SUNCFLAGS) + dnl Generating makefiles AC_CONFIG_FILES([ Makefile diff --git a/libs/iksemel/tools/Makefile.am b/libs/iksemel/tools/Makefile.am index ab81e66..b7d80e9 100644 --- a/libs/iksemel/tools/Makefile.am +++ b/libs/iksemel/tools/Makefile.am @@ -8,11 +8,11 @@ bin_PROGRAMS = ikslint iksroster iksperf noinst_HEADERS = perf.h -ikslint_LDADD = $(top_builddir)/src/libiksemel.la +ikslint_LDADD = $(top_builddir)/src/libiksemel.la @SUNCFLAGS@ ikslint_SOURCES = ikslint.c hash.c -iksroster_LDADD = $(top_builddir)/src/libiksemel.la +iksroster_LDADD = $(top_builddir)/src/libiksemel.la @SUNCFLAGS@ iksroster_SOURCES = iksroster.c -iksperf_LDADD = $(top_builddir)/src/libiksemel.la +iksperf_LDADD = $(top_builddir)/src/libiksemel.la @SUNCFLAGS@ iksperf_SOURCES = iksperf.c perf.c commit 7ce63feadf86bf4321aa184311996d010aab59f8 Author: cypromis <michal.bielicki@seventhsignal.de> Date: Tue Jan 25 03:24:35 2011 +0100 gpg-error is needed on c flags as well on solaris diff --git a/libs/iksemel/configure.ac b/libs/iksemel/configure.ac index 1b8af13..7761eb0 100644 --- a/libs/iksemel/configure.ac +++ b/libs/iksemel/configure.ac @@ -83,7 +83,7 @@ AC_ARG_ENABLE(64, if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then if test "${enable_64}" = "yes"; then - CFLAGS="$CFLAGS -m64" + CFLAGS="$CFLAGS -m64 -lgpg-error" CXXFLAGS="$CXXFLAGS -m64 -lgpg-error" fi fi commit 6477d3f87e32cc623638073fc1983ebfc4fa54cd Author: Daniel Swarbrick <daniel@seventhsignal.de> Date: Tue Jan 25 00:26:58 2011 +0100 make mod_snmp module unload more failsafe diff --git a/src/mod/event_handlers/mod_snmp/mod_snmp.c b/src/mod/event_handlers/mod_snmp/mod_snmp.c index 040e82b..36a133c 100644 --- a/src/mod/event_handlers/mod_snmp/mod_snmp.c +++ b/src/mod/event_handlers/mod_snmp/mod_snmp.c @@ -98,6 +98,13 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_snmp_load) netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE, 1); init_agent("mod_snmp"); + + /* + * Override master/subagent ping interval to 5s, to ensure that + * agent_check_and_process() never blocks for longer than that. + */ + netsnmp_ds_set_int(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_AGENTX_PING_INTERVAL, 5); + init_subagent(); init_snmp("mod_snmp"); @@ -107,8 +114,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_snmp_load) SWITCH_MODULE_RUNTIME_FUNCTION(mod_snmp_runtime) { - /* block on select() */ - agent_check_and_process(1); + while (!globals.shutdown) { + /* Block on select() */ + agent_check_and_process(1); + } return SWITCH_STATUS_SUCCESS; } commit 24bcd10582193ef6dac5a124ad03323066e355f8 Author: Mathieu Rene <mrene@avgs.ca> Date: Mon Jan 24 17:54:43 2011 -0500 don't hold loadable_modules.mutex while a module shutdown function is run, so that we do not prevent new channels from being created. diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 03858ac..d6796c8 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -1047,20 +1047,24 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_unload_module(char *dir, switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Module is not unloadable.\n"); *err = "Module is not unloadable"; status = SWITCH_STATUS_NOUNLOAD; - goto end; + goto unlock; } else { - if ((status = do_shutdown(module, SWITCH_TRUE, SWITCH_TRUE, !force, err) != SWITCH_STATUS_SUCCESS)) { - goto end; + /* Prevent anything from using the module while it's shutting down */ + switch_core_hash_delete(loadable_modules.module_hash, fname); + switch_mutex_unlock(loadable_modules.mutex); + if ((status = do_shutdown(module, SWITCH_TRUE, SWITCH_TRUE, !force, err)) != SWITCH_STATUS_SUCCESS) { + /* Something went wrong in the module's shutdown function, add it again */ + switch_core_hash_insert_locked(loadable_modules.module_hash, fname, module, loadable_modules.mutex); } + goto end; } - switch_core_hash_delete(loadable_modules.module_hash, fname); } else { *err = "No such module!"; status = SWITCH_STATUS_FALSE; } - end: +unlock: switch_mutex_unlock(loadable_modules.mutex); - + end: if (force) { switch_yield(1000000); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "PHEW!\n"); commit 4eb5bbf41c3fcb6bfd33704a18bd2e7e52acd437 Author: Jeff Lenk <jeff@jefflenk.com> Date: Mon Jan 24 14:48:44 2011 -0600 FS-3000 revert previous - flush digits after pin error diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index e6a47bf..472f2d9 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -5597,7 +5597,6 @@ SWITCH_STANDARD_APP(conference_function) char pin_buf[80] = ""; int pin_retries = 3; /* XXX - this should be configurable - i'm too lazy to do it right now... */ int pin_valid = 0; - int be_friendly = 0; switch_status_t status = SWITCH_STATUS_SUCCESS; char *supplied_pin_value; @@ -5632,23 +5631,19 @@ SWITCH_STANDARD_APP(conference_function) switch_status_t pstatus = SWITCH_STATUS_FALSE; /* be friendly */ - if (!be_friendly) { - if (conference->pin_sound) { - pstatus = conference_local_play_file(conference, session, conference->pin_sound, 20, pin_buf, sizeof(pin_buf)); - } else if (conference->tts_engine && conference->tts_voice) { - pstatus = - switch_ivr_speak_text(session, conference->tts_engine, conference->tts_voice, "please enter the conference pin number", NULL); - } else { - pstatus = switch_ivr_speak_text(session, "flite", "slt", "please enter the conference pin number", NULL); - } - - if (pstatus != SWITCH_STATUS_SUCCESS && pstatus != SWITCH_STATUS_BREAK) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Cannot ask the user for a pin, ending call"); - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - } + if (conference->pin_sound) { + pstatus = conference_local_play_file(conference, session, conference->pin_sound, 20, pin_buf, sizeof(pin_buf)); + } else if (conference->tts_engine && conference->tts_voice) { + pstatus = + switch_ivr_speak_text(session, conference->tts_engine, conference->tts_voice, "please enter the conference pin number", NULL); + } else { + pstatus = switch_ivr_speak_text(session, "flite", "slt", "please enter the conference pin number", NULL); } - be_friendly = 1; + if (pstatus != SWITCH_STATUS_SUCCESS && pstatus != SWITCH_STATUS_BREAK) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Cannot ask the user for a pin, ending call"); + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + } /* wait for them if neccessary */ if (strlen(pin_buf) < strlen(dpin)) { @@ -5665,12 +5660,14 @@ SWITCH_STANDARD_APP(conference_function) pin_valid = (status == SWITCH_STATUS_SUCCESS && strcmp(pin_buf, dpin) == 0); if (!pin_valid) { + /* zero the collected pin */ + memset(pin_buf, 0, sizeof(pin_buf)); + /* more friendliness */ if (conference->bad_pin_sound) { - conference_local_play_file(conference, session, conference->bad_pin_sound, 20, pin_buf, sizeof(pin_buf)); + conference_local_play_file(conference, session, conference->bad_pin_sound, 20, NULL, 0); } - /* zero the collected pin */ - memset(pin_buf, 0, sizeof(pin_buf)); + switch_channel_flush_dtmf(channel); } pin_retries--; } commit 976859bb45f08382424c9c4b0dbf6acb3fba64fb Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Jan 24 14:04:26 2011 -0600 fix unreachable condition with a null args to make any key stop playback/record etc without dequing and remove hard-coded flush digits in play_and_get_digits be sure to flush it yourself before using diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 496c29b..a40da1b 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -224,7 +224,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session, switch_ivr_parse_all_events(session); - if (args && (args->input_callback || args->buf || args->buflen || args->dmachine)) { + if (args) { switch_dtmf_t dtmf; /* diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 4e9e7b9..dc263e9 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -634,7 +634,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se break; } - if (args && (args->input_callback || args->buf || args->buflen || args->dmachine)) { + if (args) { /* dtmf handler function you can hook up to be executed when a digit is dialed during playback if you return anything but SWITCH_STATUS_SUCCESS the playback will stop. @@ -862,7 +862,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *sessi switch_ivr_parse_all_events(session); - if (args && (args->input_callback || args->buf || args->buflen || args->dmachine)) { + if (args) { /* dtmf handler function you can hook up to be executed when a digit is dialed during gentones if you return anything but SWITCH_STATUS_SUCCESS the playback will stop. @@ -1314,7 +1314,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess switch_ivr_parse_all_events(session); - if (args && (args->input_callback || args->buf || args->buflen || args->dmachine)) { + if (args) { /* dtmf handler function you can hook up to be executed when a digit is dialed during playback if you return anything but SWITCH_STATUS_SUCCESS the playback will stop. @@ -1875,7 +1875,7 @@ SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t switch_status_t status; memset(digit_buffer, 0, digit_buffer_length); - switch_channel_flush_dtmf(channel); + status = switch_ivr_read(session, min_digits, max_digits, prompt_audio_file, var_name, digit_buffer, digit_buffer_length, timeout, valid_terminators, digit_timeout); if (status == SWITCH_STATUS_TIMEOUT && strlen(digit_buffer) >= min_digits) { @@ -2037,7 +2037,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session switch_event_destroy(&event); } - if (args && (args->input_callback || args->buf || args->buflen || args->dmachine)) { + if (args) { /* dtmf handler function you can hook up to be executed when a digit is dialed during playback * if you return anything but SWITCH_STATUS_SUCCESS the playback will stop. */ commit a8f5bf60a87fb27420846bd9d9af5e61f1f947d6 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Jan 24 12:18:02 2011 -0600 fix proper display of meta digit in log lines diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 2c4de14..a1a93c6 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -192,7 +192,7 @@ static inline char switch_itodtmf(char i) r = i + 55; } - return r; + return r + 48; } static inline int switch_dtmftoi(char *s) commit 6e4c30ea377728107e0747d614565eca964fa1d3 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Jan 24 09:49:27 2011 -0600 update code in mod_celt to match API of 0.10.0 diff --git a/src/mod/codecs/mod_celt/mod_celt.c b/src/mod/codecs/mod_celt/mod_celt.c index 37983f3..8d36b6a 100644 --- a/src/mod/codecs/mod_celt/mod_celt.c +++ b/src/mod/codecs/mod_celt/mod_celt.c @@ -53,8 +53,8 @@ static switch_status_t switch_celt_init(switch_codec_t *codec, switch_codec_flag return SWITCH_STATUS_FALSE; } - context->mode_object = celt_mode_create(codec->implementation->actual_samples_per_second, codec->implementation->samples_per_packet, NULL); - + context->frame_size = codec->implementation->samples_per_packet; + context->mode_object = celt_mode_create(codec->implementation->actual_samples_per_second, context->frame_size, NULL); context->bytes_per_packet = (codec->implementation->bits_per_second * context->frame_size / codec->implementation->actual_samples_per_second + 4) / 8; /* @@ -106,15 +106,22 @@ static switch_status_t switch_celt_encode(switch_codec_t *codec, unsigned int *flag) { struct celt_context *context = codec->private_info; + int bytes = 0; if (!context) { return SWITCH_STATUS_FALSE; } - *encoded_data_len = (uint32_t) celt_encode(context->encoder_object, (void *) decoded_data, codec->implementation->samples_per_packet, - (unsigned char *) encoded_data, context->bytes_per_packet); + bytes = (uint32_t) celt_encode(context->encoder_object, (void *) decoded_data, codec->implementation->samples_per_packet, + (unsigned char *) encoded_data, context->bytes_per_packet); - return SWITCH_STATUS_SUCCESS; + if (bytes > 0) { + *encoded_data_len = (uint32_t) bytes; + return SWITCH_STATUS_SUCCESS; + } + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Encoder Error!\n"); + return SWITCH_STATUS_GENERR; } static switch_status_t switch_celt_decode(switch_codec_t *codec, @@ -152,23 +159,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_celt_load) SWITCH_ADD_CODEC(codec_interface, "CELT ultra-low delay"); - switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 114, /* the IANA code number */ - "CELT", /* the IANA code name */ - NULL, /* default fmtp to send (can be overridden by the init function) */ - 32000, /* samples transferred per second */ - 32000, /* actual samples transferred per second */ - 32000, /* bits transferred per second */ - 10000, /* number of microseconds per frame */ - 320, /* number of samples per frame */ - 640, /* number of bytes per frame decompressed */ - 0, /* number of bytes per frame compressed */ - 1, /* number of channels represented */ - 1, /* number of frames per network packet */ - switch_celt_init, /* function to initialize a codec handle using this implementation */ - switch_celt_encode, /* function to encode raw data into encoded data */ - switch_celt_decode, /* function to decode encoded data into raw data */ - switch_celt_destroy); /* deinitalize a codec handle using this implementation */ ms_per_frame = 2000; samples_per_frame = 96; bytes_per_frame = 192; commit 7a1dcb69581ba593f3dc3868c94c1124c41e64f3 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Jan 24 09:43:16 2011 -0600 add record_restart_time_limit_on_dtmf var diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 523dfde..4e9e7b9 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -372,6 +372,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se switch_event_t *event; int divisor = 0; int file_flags = SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT; + int restart_limit_on_dtmf = 0; const char *prefix; prefix = switch_channel_get_variable(channel, "sound_prefix"); @@ -528,6 +529,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se if (switch_test_flag(fh, SWITCH_FILE_NATIVE)) { asis = 1; } + + restart_limit_on_dtmf = switch_true(switch_channel_get_variable(channel, "record_restart_limit_on_dtmf")); if ((p = switch_channel_get_variable(channel, "RECORD_TITLE"))) { vval = switch_core_session_strdup(session, p); @@ -637,6 +640,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se if you return anything but SWITCH_STATUS_SUCCESS the playback will stop. */ if (switch_channel_has_dtmf(channel)) { + + if (limit && restart_limit_on_dtmf) { + start = switch_epoch_time_now(NULL); + } + if (!args->input_callback && !args->buf && !args->dmachine) { status = SWITCH_STATUS_BREAK; break; commit 6294bc1620c94785f23bf6ae6966aaa67cf34c7f Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Jan 24 09:41:53 2011 -0600 have samples_out reflect what was written to the FH not the file even with buffering diff --git a/src/switch_core_file.c b/src/switch_core_file.c index c00756f..19f2354 100644 --- a/src/switch_core_file.c +++ b/src/switch_core_file.c @@ -391,10 +391,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_write(switch_file_handle_t *fh, if ((status = fh->file_interface->file_write(fh, fh->pre_buffer_data, &blen)) != SWITCH_STATUS_SUCCESS) { *len = 0; } - fh->samples_out += blen; } } + fh->samples_out += orig_len; return status; } else { switch_status_t status; commit 0e37dcb5db19592d28eb771edb4a0d394f5275ac Author: Jeff Lenk <jeff@jefflenk.com> Date: Sun Jan 23 17:43:38 2011 -0600 windows - tweak installer permissions diff --git a/w32/Setup/Product.wxs b/w32/Setup/Product.wxs index 2f072aa..1de2ec2 100644 --- a/w32/Setup/Product.wxs +++ b/w32/Setup/Product.wxs @@ -57,6 +57,9 @@ WorkingDirectory="INSTALLLOCATION"/> <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/> <RegistryValue Root="HKCU" Key="Software\FreeSWITCH\FreeSWITCH" Name="installed" Type="integer" Value="1" KeyPath="yes"/> + <CreateFolder Directory="INSTALLLOCATION"> + <Permission User="Authenticated Users" GenericAll="yes" /> + </CreateFolder> </Component> <Component Id="FSCliShortcut" Guid="D209546C-C728-4d8f-BDB2-29AED8824282"> <Shortcut Id="FSCliStartMenuShortcut" @@ -65,6 +68,9 @@ Target="[INSTALLLOCATION]fs_cli.exe" WorkingDirectory="INSTALLLOCATION"/> <RegistryValue Root="HKCU" Key="Software\FreeSWITCH\FS_CLI" Name="installed" Type="integer" Value="1" KeyPath="yes"/> + <CreateFolder Directory="INSTALLLOCATION"> + <Permission User="Authenticated Users" GenericAll="yes" /> + </CreateFolder> </Component> </DirectoryRef> commit b88cd3457a847cf05564df51bd8a60036b15bfd8 Author: Jeff Lenk <jeff@jefflenk.com> Date: Sat Jan 22 22:51:48 2011 -0600 FS-3000 mod_conference: if more digits than the length of the correct pin the remaining digits are accounted for next retry diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 7f7ee83..e6a47bf 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -5597,6 +5597,7 @@ SWITCH_STANDARD_APP(conference_function) char pin_buf[80] = ""; int pin_retries = 3; /* XXX - this should be configurable - i'm too lazy to do it right now... */ int pin_valid = 0; + int be_friendly = 0; switch_status_t status = SWITCH_STATUS_SUCCESS; char *supplied_pin_value; @@ -5631,20 +5632,24 @@ SWITCH_STANDARD_APP(conference_function) switch_status_t pstatus = SWITCH_STATUS_FALSE; /* be friendly */ - if (conference->pin_sound) { - pstatus = conference_local_play_file(conference, session, conference->pin_sound, 20, pin_buf, sizeof(pin_buf)); - } else if (conference->tts_engine && conference->tts_voice) { - pstatus = - switch_ivr_speak_text(session, conference->tts_engine, conference->tts_voice, "please enter the conference pin number", NULL); - } else { - pstatus = switch_ivr_speak_text(session, "flite", "slt", "please enter the conference pin number", NULL); - } + if (!be_friendly) { + if (conference->pin_sound) { + pstatus = conference_local_play_file(conference, session, conference->pin_sound, 20, pin_buf, sizeof(pin_buf)); + } else if (conference->tts_engine && conference->tts_voice) { + pstatus = + switch_ivr_speak_text(session, conference->tts_engine, conference->tts_voice, "please enter the conference pin number", NULL); + } else { + pstatus = switch_ivr_speak_text(session, "flite", "slt", "please enter the conference pin number", NULL); + } - if (pstatus != SWITCH_STATUS_SUCCESS && pstatus != SWITCH_STATUS_BREAK) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Cannot ask the user for a pin, ending call"); - switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + if (pstatus != SWITCH_STATUS_SUCCESS && pstatus != SWITCH_STATUS_BREAK) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Cannot ask the user for a pin, ending call"); + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + } } + be_friendly = 1; + /* wait for them if neccessary */ if (strlen(pin_buf) < strlen(dpin)) { char *buf = pin_buf + strlen(pin_buf); @@ -5660,13 +5665,12 @@ SWITCH_STANDARD_APP(conference_function) pin_valid = (status == SWITCH_STATUS_SUCCESS && strcmp(pin_buf, dpin) == 0); if (!pin_valid) { - /* zero the collected pin */ - memset(pin_buf, 0, sizeof(pin_buf)); - /* more friendliness */ if (conference->bad_pin_sound) { conference_local_play_file(conference, session, conference->bad_pin_sound, 20, pin_buf, sizeof(pin_buf)); } + /* zero the collected pin */ + memset(pin_buf, 0, sizeof(pin_buf)); } pin_retries--; } commit 9adac7c6988df8436c634edaaa13ae39067f8df7 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Sun Jan 23 01:42:39 2011 +0100 [fsxs] Remove APR and APR-UTIL libraries from fsxs LIBS variable. "LIBS" in the final fsxs script will be empty now. We still link against libfreeswitch when building a module, but we don't explicitly list (some of) its dependency libs anymore (this list was not complete anyway). This fixes a bogus /path_to_source/expat.la entry in LIBS that came from "apu-config --libs". Tested on Gentoo x86_64 (binutils 2.20.1) and Centos 5.5 (binutils 2.17.50). Tested-by: Stefan Knoblich <s.knoblich@axsentis.de> Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/Makefile.am b/Makefile.am index 8d35068..37a01d2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -349,7 +349,7 @@ scripts/fsxs: scripts/fsxs.in -e "s|@INCLUDES\@|-I$(prefix)/include|" \ -e "s|@SOLINK\@|$(SOLINK)|" \ -e "s|@LDFLAGS\@|-L$(prefix)/lib|" \ - -e "s|@LIBS\@|`./libs/apr/apr-1-config --libs` `./libs/apr-util/apu-1-config --libs`|" \ + -e "s|@LIBS\@||" \ $(top_srcdir)/scripts/fsxs.in > scripts/fsxs ## commit 5316bcd9dc648b3874ebddea75ed6f34431c7f35 Author: Steve Underwood <steveu@coppice.org> Date: Sat Jan 22 13:36:16 2011 +0800 Typo in the spandsp .pc.in file fixed diff --git a/libs/spandsp/spandsp.pc.in b/libs/spandsp/spandsp.pc.in index 86a50ff..1a91ba0 100644 --- a/libs/spandsp/spandsp.pc.in +++ b/libs/spandsp/spandsp.pc.in @@ -1,5 +1,5 @@ prefix=@prefix@ -exec_prefix=@exec_prefix@ +exec_prefix=@prefix@ libdir=@libdir@ includedir=@includedir@ commit 9fe440b2fe63935331b148ffc1d3c7a5ddffa20b Author: Andrew Thompson <andrew@hijacked.us> Date: Fri Jan 21 21:53:03 2011 -0500 mod_erlang_event Add proper locking for the list of XML bindings diff --git a/src/mod/event_handlers/mod_erlang_event/handle_msg.c b/src/mod/event_handlers/mod_erlang_event/handle_msg.c index 9ae1527..87f91fc 100644 --- a/src/mod/event_handlers/mod_erlang_event/handle_msg.c +++ b/src/mod/event_handlers/mod_erlang_event/handle_msg.c @@ -778,7 +778,7 @@ static switch_status_t handle_msg_bind(listener_t *listener, erlang_msg * msg, e binding->process.pid = msg->from; binding->listener = listener; - switch_thread_rwlock_wrlock(globals.listener_rwlock); + switch_thread_rwlock_wrlock(globals.bindings_rwlock); for (ptr = bindings.head; ptr && ptr->next; ptr = ptr->next); @@ -789,7 +789,7 @@ static switch_status_t handle_msg_bind(listener_t *listener, erlang_msg * msg, e } switch_xml_set_binding_sections(bindings.search_binding, switch_xml_get_binding_sections(bindings.search_binding) | section); - switch_thread_rwlock_unlock(globals.listener_rwlock); + switch_thread_rwlock_unlock(globals.bindings_rwlock); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "sections %d\n", switch_xml_get_binding_sections(bindings.search_binding)); diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index 1a8bd00..900b965 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -90,7 +90,7 @@ static void remove_binding(listener_t *listener, erlang_pid * pid) { struct erlang_binding *ptr, *lst = NULL; - switch_thread_rwlock_wrlock(globals.listener_rwlock); + switch_thread_rwlock_wrlock(globals.bindings_rwlock); switch_xml_set_binding_sections(bindings.search_binding, SWITCH_XML_SECTION_MAX); @@ -100,7 +100,7 @@ static void remove_binding(listener_t *listener, erlang_pid * pid) if (ptr->next) { bindings.head = ptr->next; } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Removed all (only?) listeners\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Removed all (only?) binding\n"); bindings.head = NULL; break; } @@ -111,13 +111,13 @@ static void remove_binding(listener_t *listener, erlang_pid * pid) lst->next = NULL; } } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Removed listener\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Removed binding\n"); } else { switch_xml_set_binding_sections(bindings.search_binding, switch_xml_get_binding_sections(bindings.search_binding) | ptr->section); } } - switch_thread_rwlock_unlock(globals.listener_rwlock); + switch_thread_rwlock_unlock(globals.bindings_rwlock); } @@ -381,6 +381,8 @@ static switch_xml_t erlang_fetch(const char *sectionstr, const char *tag_name, c section = switch_xml_parse_section_string((char *) sectionstr); + switch_thread_rwlock_rdlock(globals.bindings_rwlock); + for (ptr = bindings.head; ptr; ptr = ptr->next) { if (ptr->section != section) continue; @@ -417,6 +419,8 @@ static switch_xml_t erlang_fetch(const char *sectionstr, const char *tag_name, c switch_mutex_unlock(ptr->listener->sock_mutex); } + switch_thread_rwlock_unlock(globals.bindings_rwlock); + ei_x_free(&buf); if (!p) { @@ -1638,6 +1642,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_erlang_event_load) memset(&prefs, 0, sizeof(prefs)); switch_thread_rwlock_create(&globals.listener_rwlock, pool); + switch_thread_rwlock_create(&globals.bindings_rwlock, pool); switch_mutex_init(&globals.fetch_reply_mutex, SWITCH_MUTEX_DEFAULT, pool); switch_mutex_init(&globals.listener_count_mutex, SWITCH_MUTEX_UNNESTED, pool); switch_core_hash_init(&globals.fetch_reply_hash, pool); diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h index dacfbd6..121e7b4 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h @@ -161,6 +161,7 @@ struct api_command_struct { struct globals_struct { switch_thread_rwlock_t *listener_rwlock; + switch_thread_rwlock_t *bindings_rwlock; switch_event_node_t *node; switch_mutex_t *ref_mutex; switch_mutex_t *fetch_reply_mutex; commit 8d6d52e015411649e0591eb7ad667885523b99c3 Author: Andrew Thompson <andrew@hijacked.us> Date: Fri Jan 21 21:50:02 2011 -0500 mod_conference Add energy level to conference_add_event_member_data This is useful when you want to find the energy a member joined with without having to pull the XML list diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 2d9341a..7f7ee83 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -477,6 +477,7 @@ static switch_status_t conference_add_event_member_data(conference_member_t *mem switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Mute-Detect", "%s", switch_test_flag(member, MFLAG_MUTE_DETECT) ? "true" : "false" ); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-Type", "%s", switch_test_flag(member, MFLAG_MOD) ? "moderator" : "member"); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Energy-Level", "%d", member->energy_level); return status; } commit 4eccdfef58a64652ae2a1f0a7a1f11ae55346420 Author: Andrew Thompson <andrew@hijacked.us> Date: Fri Jan 21 21:47:46 2011 -0500 mod_erlang_event: Don't urlencode events (and destroy an event after use) diff --git a/src/mod/event_handlers/mod_erlang_event/ei_helpers.c b/src/mod/event_handlers/mod_erlang_event/ei_helpers.c index a99b520..db4f778 100644 --- a/src/mod/event_handlers/mod_erlang_event/ei_helpers.c +++ b/src/mod/event_handlers/mod_erlang_event/ei_helpers.c @@ -111,6 +111,7 @@ void ei_encode_switch_event_headers(ei_x_buff * ebuf, switch_event_t *event) for (hp = event->headers; hp; hp = hp->next) { ei_x_encode_tuple_header(ebuf, 2); _ei_x_encode_string(ebuf, hp->name); + switch_url_decode(hp->value); _ei_x_encode_string(ebuf, hp->value); } diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index 8d3c594..1a8bd00 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -532,6 +532,7 @@ static switch_status_t notify_new_session(listener_t *listener, session_elem_t * session_element->uuid_str); } + switch_event_destroy(&call_event); ei_x_free(&lbuf); return SWITCH_STATUS_SUCCESS; } commit f5dafc9911eb892e0ac557bc892638cc9fb67014 Author: Daniel Swarbrick <daniel@seventhsignal.de> Date: Fri Jan 21 23:42:30 2011 +0100 add mod_snmp to modules.conf.in and modules.conf.xml (commented out) diff --git a/build/modules.conf.in b/build/modules.conf.in index 2be000f..84a9e9a 100644 --- a/build/modules.conf.in +++ b/build/modules.conf.in @@ -78,6 +78,7 @@ event_handlers/mod_cdr_sqlite #event_handlers/mod_cdr_pg_csv #event_handlers/mod_radius_cdr #event_handlers/mod_erlang_event +#event_handlers/mod_snmp formats/mod_native_file formats/mod_sndfile #formats/mod_shout diff --git a/conf/autoload_configs/modules.conf.xml b/conf/autoload_configs/modules.conf.xml index b7100bd..2e7ebfa 100644 --- a/conf/autoload_configs/modules.conf.xml +++ b/conf/autoload_configs/modules.conf.xml @@ -24,6 +24,7 @@ <load module="mod_event_socket"/> <!-- <load module="mod_zeroconf"/> --> <!-- <load module="mod_erlang_event"/> --> + <!-- <load module="mod_snmp"/> --> <!-- Directory Interfaces --> <!-- <load module="mod_ldap"/> --> commit e0ed0008b1712d00f21d8fedce32eeb531e5da82 Author: Brian West <brian@freeswitch.org> Date: Fri Jan 21 15:08:26 2011 -0600 Fix ZRTP diff --git a/src/switch_rtp.c b/src/switch_rtp.c index faf2868..4acadfe 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -2726,14 +2726,6 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ } } - if (bytes && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA) && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_UDPTL) && - rtp_session->recv_msg.header.pt != 13 && - rtp_session->recv_msg.header.pt != rtp_session->recv_te && - (!rtp_session->cng_pt || rtp_session->recv_msg.header.pt != rtp_session->cng_pt) && - rtp_session->recv_msg.header.pt != rtp_session->payload) { - /* drop frames of incorrect payload number and return CNG frame instead */ - return_cng_frame(); - } if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_ENABLE_RTCP) && rtp_session->rtcp_read_pollfd) { rtcp_poll_status = switch_poll(rtp_session->rtcp_read_pollfd, 1, &rtcp_fdr, 0); @@ -2812,6 +2804,15 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ goto end; } + if (bytes && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA) && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_UDPTL) && + rtp_session->recv_msg.header.pt != 13 && + rtp_session->recv_msg.header.pt != rtp_session->recv_te && + (!rtp_session->cng_pt || rtp_session->recv_msg.header.pt != rtp_session->cng_pt) && + rtp_session->recv_msg.header.pt != rtp_session->payload) { + /* drop frames of incorrect payload number and return CNG frame instead */ + return_cng_frame(); + } + if (!bytes && (io_flags & SWITCH_IO_FLAG_NOBLOCK)) { rtp_session->missed_count = 0; ret = 0; commit 3fa3e11ca23f788841e00aef8342e1718675477d Author: Michael Jerris <mike@jerris.com> Date: Fri Jan 21 16:03:19 2011 -0500 FS-3002: handle 2833 in do_flush instead of dropping valid dtmf diff --git a/src/switch_apr.c b/src/switch_apr.c index 4c99662..3798d6e 100644 --- a/src/switch_apr.c +++ b/src/switch_apr.c @@ -833,7 +833,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_recvfrom(switch_sockaddr_t *from, */ } - if (r == 35) { + if (r == 35 || r == 730035) { r = SWITCH_STATUS_BREAK; } diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 3ce7a07..faf2868 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -32,6 +32,7 @@ */ //#define DEBUG_2833 //#define RTP_DEBUG_WRITE_DELTA +//#define DEBUG_MISSED_SEQ #include <switch.h> #include <switch_stun.h> #undef PACKAGE_NAME @@ -245,6 +246,9 @@ struct switch_rtp { switch_time_t send_time; switch_byte_t auto_adj_used; uint8_t pause_jb; + uint16_t last_seq; + switch_time_t last_read_time; + switch_size_t last_flush_packet_count; }; struct switch_rtcp_senderinfo { @@ -256,6 +260,180 @@ struct switch_rtcp_senderinfo { unsigned oc:32; }; +typedef enum { + RESULT_CONTINUE, + RESULT_GOTO_END, + RESULT_GOTO_RECVFROM, + RESULT_GOTO_TIMERCHECK +} handle_rfc2833_result_t; + +static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_size_t bytes, int *do_cng) +{ +#ifdef DEBUG_2833 + if (rtp_session->dtmf_data.in_digit_sanity && !(rtp_session->dtmf_data.in_digit_sanity % 100)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "sanity %d\n", rtp_session->dtmf_data.in_digit_sanity); + } +#endif + + if (rtp_session->dtmf_data.in_digit_sanity && !--rtp_session->dtmf_data.in_digit_sanity) { + rtp_session->dtmf_data.last_digit = 0; + rtp_session->dtmf_data.in_digit_ts = 0; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed DTMF sanity check.\n"); + } + + /* RFC2833 ... like all RFC RE: VoIP, guaranteed to drive you to insanity! + We know the real rules here, but if we enforce them, it's an interop nightmare so, + we put up with as much as we can so we don't have to deal with being punished for + doing it right. Nice guys finish last! + */ + if (bytes > rtp_header_len && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA) && + !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833) && rtp_session->recv_te && rtp_session->recv_msg.header.pt == rtp_session->recv_te) { + switch_size_t len = bytes - rtp_header_len; + unsigned char *packet = (unsigned char *) rtp_session->recv_msg.body; + int end; + uint16_t duration; + char key; + uint16_t in_digit_seq; + uint32_t ts; + + if (!(packet[0] || packet[1] || packet[2] || packet[3]) && len >= 8) { + packet += 4; + len -= 4; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "DTMF payload offset by 4 bytes.\n"); + } + + if (!(packet[0] || packet[1] || packet[2] || packet[3])) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed DTMF payload check.\n"); + rtp_session->dtmf_data.last_digit = 0; + rtp_session->dtmf_data.in_digit_ts = 0; + } + + end = packet[1] & 0x80 ? 1 : 0; + duration = (packet[2] << 8) + packet[3]; + key = switch_rfc2833_to_char(packet[0]); + in_digit_seq = ntohs((uint16_t) rtp_session->recv_msg.header.seq); + ts = htonl(rtp_session->recv_msg.header.ts); + + if (in_digit_seq < rtp_session->dtmf_data.in_digit_seq) { + if (rtp_session->dtmf_data.in_digit_seq - in_digit_seq > 100) { + rtp_session->dtmf_data.in_digit_seq = 0; + } + } +#ifdef DEBUG_2833 + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "packet[%d]: %02x %02x %02x %02x\n", (int) len, (unsigned) packet[0], (unsigned) + packet[1], (unsigned) packet[2], (unsigned) packet[3]); +#endif + + if (in_digit_seq > rtp_session->dtmf_data.in_digit_seq) { + + rtp_session->dtmf_data.in_digit_seq = in_digit_seq; +#ifdef DEBUG_2833 + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "read: %c %u %u %u %u %d %d %s\n", + key, in_digit_seq, rtp_session->dtmf_data.in_digit_seq, + ts, duration, rtp_session->recv_msg.header.m, end, end && !rtp_session->dtmf_data.in_digit_ts ? "ignored" : ""); +#endif + + if (!rtp_session->dtmf_data.in_digit_queued && (rtp_session->rtp_bugs & RTP_BUG_IGNORE_DTMF_DURATION) && + rtp_session->dtmf_data.in_digit_ts) { + switch_dtmf_t dtmf = { key, switch_core_min_dtmf_duration(0) }; +#ifdef DEBUG_2833 + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Early Queuing digit %c:%d\n", dtmf.digit, dtmf.duration / 8); +#endif + switch_rtp_queue_rfc2833_in(rtp_session, &dtmf); + rtp_session->dtmf_data.in_digit_queued = 1; + } + + /* only set sanity if we do NOT ignore the packet */ + if (rtp_session->dtmf_data.in_digit_ts) { + rtp_session->dtmf_data.in_digit_sanity = 2000; + } + + if (rtp_session->dtmf_data.last_duration > duration && + rtp_session->dtmf_data.last_duration > 0xFC17 && ts == rtp_session->dtmf_data.in_digit_ts) { + rtp_session->dtmf_data.flip++; + } + + if (end) { + if (rtp_session->dtmf_data.in_digit_ts) { + switch_dtmf_t dtmf = { key, duration }; + + if (ts > rtp_session->dtmf_data.in_digit_ts) { + dtmf.duration += (ts - rtp_session->dtmf_data.in_digit_ts); + } + if (rtp_session->dtmf_data.flip) { + dtmf.duration += rtp_session->dtmf_data.flip * 0xFFFF; + rtp_session->dtmf_data.flip = 0; +#ifdef DEBUG_2833 + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "you're welcome!\n"); +#endif + } +#ifdef DEBUG_2833 + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "done digit=%c ts=%u start_ts=%u dur=%u ddur=%u\n", + dtmf.digit, ts, rtp_session->dtmf_data.in_digit_ts, duration, dtmf.duration); +#endif + + if (!(rtp_session->rtp_bugs & RTP_BUG_IGNORE_DTMF_DURATION) && !rtp_session->dtmf_data.in_digit_queued) { +#ifdef DEBUG_2833 + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Queuing digit %c:%d\n", dtmf.digit, dtmf.duration / 8); +#endif + switch_rtp_queue_rfc2833_in(rtp_session, &dtmf); + } + + rtp_session->dtmf_data.last_digit = rtp_session->dtmf_data.first_digit; + + rtp_session->dtmf_data.in_digit_ts = 0; + rtp_session->dtmf_data.in_digit_sanity = 0; + rtp_session->dtmf_data.in_digit_queued = 0; + *do_cng = 1; + } else { + if (!switch_rtp_ready(rtp_session)) { + return RESULT_GOTO_END; + } + switch_cond_next(); + return RESULT_GOTO_RECVFROM; + } + + } else if (!rtp_session->dtmf_data.in_digit_ts) { + rtp_session->dtmf_data.in_digit_ts = ts; + rtp_session->dtmf_data.first_digit = key; + rtp_session->dtmf_data.in_digit_sanity = 2000; + } + + rtp_session->dtmf_data.last_duration = duration; + } else { +#ifdef DEBUG_2833 + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "drop: %c %u %u %u %u %d %d\n", + key, in_digit_seq, rtp_session->dtmf_data.in_digit_seq, ts, duration, rtp_session->recv_msg.header.m, end); +#endif + switch_cond_next(); + return RESULT_GOTO_RECVFROM; + } + } + + if (bytes && rtp_session->dtmf_data.in_digit_ts) { + if (!switch_rtp_ready(rtp_session)) { + return RESULT_GOTO_END; + } + + if (!rtp_session->dtmf_data.in_interleaved && rtp_session->recv_msg.header.pt != rtp_session->recv_te) { + /* Drat, they are sending audio still as well as DTMF ok fine..... *sigh* */ + rtp_session->dtmf_data.in_interleaved = 1; + } + + if (rtp_session->dtmf_data.in_interleaved || (rtp_session->rtp_bugs & RTP_BUG_IGNORE_DTMF_DURATION)) { + if (rtp_session->recv_msg.header.pt == rtp_session->recv_te) { + return RESULT_GOTO_RECVFROM; + } + } else { + *do_cng = 1; + return RESULT_GOTO_TIMERCHECK; + } + } + + return RESULT_CONTINUE; +} + static int global_init = 0; static int rtp_common_write(switch_rtp_t *rtp_session, rtp_msg_t *send_msg, void *data, uint32_t datalen, switch_payload_t payload, uint32_t timestamp, switch_frame_flag_t *flags); @@ -2157,6 +2335,15 @@ static void do_flush(switch_rtp_t *rtp_session) bytes = sizeof(rtp_msg_t); status = switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock_input, 0, (void *) &rtp_session->recv_msg, &bytes); if (bytes) { + int do_cng = 0; + + /* Make sure to handle RFC2833 packets, even if we're flushing the packets */ + if (bytes > rtp_header_len && rtp_session->recv_te && rtp_session->recv_msg.header.pt == rtp_session->recv_te) { + handle_rfc2833(rtp_session, bytes, &do_cng); +#ifdef DEBUG_2833 + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "*** RTP packet handled in flush loop ***\n"); +#endif + } flushed++; @@ -2195,7 +2382,52 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t *bytes = sizeof(rtp_msg_t); status = switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock_input, 0, (void *) &rtp_session->recv_msg, bytes); ts = ntohl(rtp_session->recv_msg.header.ts); - + + if (*bytes ) { + uint16_t seq = ntohs((uint16_t) rtp_session->recv_msg.header.seq); + + if (rtp_session->last_seq && rtp_session->last_seq+1 != seq) { +#ifdef DEBUG_MISSED_SEQ + switch_size_t flushed_packets_diff = rtp_session->stats.inbound.flush_packet_count - rtp_session->last_flush_packet_count; + switch_size_t num_missed = (switch_size_t)seq - (rtp_session->last_seq+1); + + if (num_missed == 1) { /* We missed one packet */ + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missed one RTP frame with sequence [%d]%s. Time since last read [%d]\n", + rtp_session->last_seq+1, (flushed_packets_diff == 1) ? " (flushed by FS)" : " (missed)", + rtp_session->last_read_time ? switch_micro_time_now()-rtp_session->last_read_time : 0); + } else { /* We missed multiple packets */ + if (flushed_packets_diff == 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "Missed %d RTP frames from sequence [%d] to [%d] (missed). Time since last read [%d]\n", + num_missed, rtp_session->last_seq+1, seq-1, + rtp_session->last_read_time ? switch_micro_time_now()-rtp_session->last_read_time : 0); + } else if (flushed_packets_diff == num_missed) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "Missed %d RTP frames from sequence [%d] to [%d] (flushed by FS). Time since last read [%d]\n", + num_missed, rtp_session->last_seq+1, seq-1, + rtp_session->last_read_time ? switch_micro_time_now()-rtp_session->last_read_time : 0); + } else if (num_missed > flushed_packets_diff) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "Missed %d RTP frames from sequence [%d] to [%d] (%d packets flushed by FS, %d packets missed)." + " Time since last read [%d]\n", + num_missed, rtp_session->last_seq+1, seq-1, + flushed_packets_diff, num_missed-flushed_packets_diff, + rtp_session->last_read_time ? switch_micro_time_now()-rtp_session->last_read_time : 0); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "Missed %d RTP frames from sequence [%d] to [%d] (%d packets flushed by FS). Time since last read [%d]\n", + num_missed, rtp_session->last_seq+1, seq-1, + flushed_packets_diff, rtp_session->last_read_time ? switch_micro_time_now()-rtp_session->last_read_time : 0); + } + } +#endif + } + rtp_session->last_seq = seq; + } + + rtp_session->last_flush_packet_count = rtp_session->stats.inbound.flush_packet_count; + rtp_session->last_read_time = switch_micro_time_now(); + if (*bytes && (!rtp_session->recv_te || rtp_session->recv_msg.header.pt != rtp_session->recv_te) && ts && !rtp_session->jb && !rtp_session->pause_jb && ts == rtp_session->last_cng_ts) { /* we already sent this frame..... */ @@ -2836,173 +3068,20 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ bytes = sbytes; } -#ifdef DEBUG_2833 - if (rtp_session->dtmf_data.in_digit_sanity && !(rtp_session->dtmf_data.in_digit_sanity % 100)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "sanity %d\n", rtp_session->dtmf_data.in_digit_sanity); - } -#endif - - if (rtp_session->dtmf_data.in_digit_sanity && !--rtp_session->dtmf_data.in_digit_sanity) { - rtp_session->dtmf_data.last_digit = 0; - rtp_session->dtmf_data.in_digit_ts = 0; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed DTMF sanity check.\n"); - } - - /* RFC2833 ... like all RFC RE: VoIP, guaranteed to drive you to insanity! - We know the real rules here, but if we enforce them, it's an interop nightmare so, - we put up with as much as we can so we don't have to deal with being punished for - doing it right. Nice guys finish last! - */ - if (bytes > rtp_header_len && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA) && - !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833) && rtp_session->recv_msg.header.pt == rtp_session->recv_te) { - switch_size_t len = bytes - rtp_header_len; - unsigned char *packet = (unsigned char *) rtp_session->recv_msg.body; - int end; - uint16_t duration; - char key; - uint16_t in_digit_seq; - uint32_t ts; - - - if (!(packet[0] || packet[1] || packet[2] || packet[3]) && len >= 8) { - packet += 4; - len -= 4; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "DTMF payload offset by 4 bytes.\n"); - } - - if (!(packet[0] || packet[1] || packet[2] || packet[3])) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed DTMF payload check.\n"); - rtp_session->dtmf_data.last_digit = 0; - rtp_session->dtmf_data.in_digit_ts = 0; - } - - end = packet[1] & 0x80 ? 1 : 0; - duration = (packet[2] << 8) + packet[3]; - key = switch_rfc2833_to_char(packet[0]); - in_digit_seq = ntohs((uint16_t) rtp_session->recv_msg.header.seq); - ts = htonl(rtp_session->recv_msg.header.ts); - - if (in_digit_seq < rtp_session->dtmf_data.in_digit_seq) { - if (rtp_session->dtmf_data.in_digit_seq - in_digit_seq > 100) { - rtp_session->dtmf_data.in_digit_seq = 0; - } - } -#ifdef DEBUG_2833 - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "packet[%d]: %02x %02x %02x %02x\n", (int) len, (unsigned) packet[0], (unsigned) - packet[1], (unsigned) packet[2], (unsigned) packet[3]); -#endif - - if (in_digit_seq > rtp_session->dtmf_data.in_digit_seq) { - - rtp_session->dtmf_data.in_digit_seq = in_digit_seq; -#ifdef DEBUG_2833 - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "read: %c %u %u %u %u %d %d %s\n", - key, in_digit_seq, rtp_session->dtmf_data.in_digit_seq, - ts, duration, rtp_session->recv_msg.header.m, end, end && !rtp_session->dtmf_data.in_digit_ts ? "ignored" : ""); -#endif - - if (!rtp_session->dtmf_data.in_digit_queued && (rtp_session->rtp_bugs & RTP_BUG_IGNORE_DTMF_DURATION) && - rtp_session->dtmf_data.in_digit_ts) { - switch_dtmf_t dtmf = { key, switch_core_min_dtmf_duration(0) }; -#ifdef DEBUG_2833 - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Early Queuing digit %c:%d\n", dtmf.digit, dtmf.duration / 8); -#endif - switch_rtp_queue_rfc2833_in(rtp_session, &dtmf); - rtp_session->dtmf_data.in_digit_queued = 1; - } - - /* only set sanity if we do NOT ignore the packet */ - if (rtp_session->dtmf_data.in_digit_ts) { - rtp_session->dtmf_data.in_digit_sanity = 2000; - } - - if (rtp_session->dtmf_data.last_duration > duration && - rtp_session->dtmf_data.last_duration > 0xFC17 && ts == rtp_session->dtmf_data.in_digit_ts) { - rtp_session->dtmf_data.flip++; - } - - if (end) { - if (rtp_session->dtmf_data.in_digit_ts) { - switch_dtmf_t dtmf = { key, duration }; - - if (ts > rtp_session->dtmf_data.in_digit_ts) { - dtmf.duration += (ts - rtp_session->dtmf_data.in_digit_ts); - } - if (rtp_session->dtmf_data.flip) { - dtmf.duration += rtp_session->dtmf_data.flip * 0xFFFF; - rtp_session->dtmf_data.flip = 0; -#ifdef DEBUG_2833 - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "you're welcome!\n"); -#endif - } -#ifdef DEBUG_2833 - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "done digit=%c ts=%u start_ts=%u dur=%u ddur=%u\n", - dtmf.digit, ts, rtp_session->dtmf_data.in_digit_ts, duration, dtmf.duration); -#endif - - if (!(rtp_session->rtp_bugs & RTP_BUG_IGNORE_DTMF_DURATION) && !rtp_session->dtmf_data.in_digit_queued) { -#ifdef DEBUG_2833 - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Queuing digit %c:%d\n", dtmf.digit, dtmf.duration / 8); -#endif - switch_rtp_queue_rfc2833_in(rtp_session, &dtmf); - } - - rtp_session->dtmf_data.last_digit = rtp_session->dtmf_data.first_digit; - - rtp_session->dtmf_data.in_digit_ts = 0; - rtp_session->dtmf_data.in_digit_sanity = 0; - rtp_session->dtmf_data.in_digit_queued = 0; - do_cng = 1; - } else { - if (!switch_rtp_ready(rtp_session)) { - goto end; - } - switch_cond_next(); - goto recvfrom; - } - - } else if (!rtp_session->dtmf_data.in_digit_ts) { - rtp_session->dtmf_data.in_digit_ts = ts; - rtp_session->dtmf_data.first_digit = key; - rtp_session->dtmf_data.in_digit_sanity = 2000; - } - - rtp_session->dtmf_data.last_duration = duration; - } else { -#ifdef DEBUG_2833 - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "drop: %c %u %u %u %u %d %d\n", - key, in_digit_seq, rtp_session->dtmf_data.in_digit_seq, ts, duration, rtp_session->recv_msg.header.m, end); -#endif - switch_cond_next(); - goto recvfrom; - } - } - - if (rtp_session->dtmf_data.in_digit_ts) { - - } - - - if (bytes && rtp_session->dtmf_data.in_digit_ts) { - if (!switch_rtp_ready(rtp_session)) { - goto end; - } - if (!rtp_session->dtmf_data.in_interleaved && rtp_session->recv_msg.header.pt != rtp_session->recv_te) { - /* Drat, they are sending audio still as well as DTMF ok fine..... *sigh* */ - rtp_session->dtmf_data.in_interleaved = 1; - } - - if (rtp_session->dtmf_data.in_interleaved || (rtp_session->rtp_bugs & RTP_BUG_IGNORE_DTMF_DURATION)) { - if (rtp_session->recv_msg.header.pt == rtp_session->recv_te) { - goto recvfrom; - } - } else { - return_cng_frame(); - } + /* Handle incoming RFC2833 packets */ + switch (handle_rfc2833(rtp_session, bytes, &do_cng)) { + case RESULT_GOTO_END: + goto end; + case RESULT_GOTO_RECVFROM: + goto recvfrom; + case RESULT_GOTO_TIMERCHECK: + goto timer_check; + case RESULT_CONTINUE: + goto result_continue; } + result_continue: timer_check: if (do_cng) { commit 3dd9d5c0a399757059c60d9d8c751b97383da676 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Jan 21 14:35:23 2011 -0600 FS-3007 diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 94fef61..19125c6 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -630,6 +630,11 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) char *probe_user = NULL, *probe_euser, *probe_host, *p; struct dialog_helper dh = { { 0 } }; + if (strcasecmp(proto, SOFIA_CHAT_PROTO) != 0) { + goto done; + } + + if (!to || !(probe_user = strdup(to))) { goto done; } @@ -2405,6 +2410,20 @@ void sofia_presence_handle_sip_i_subscribe(int status, switch_event_fire(&sevent); } + } else if (to_user && (strcasecmp(proto, SOFIA_CHAT_PROTO) != 0)) { + if (switch_event_create(&sevent, SWITCH_EVENT_PRESENCE_PROBE) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "proto", proto); + switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "long", profile->name); + switch_event_add_header(sevent, SWITCH_STACK_BOTTOM, "from", "%s@%s", from_user, from_host); + switch_event_add_header(sevent, SWITCH_STACK_BOTTOM, "to", "%s%s%s@%s", proto, "+", to_user, to_host); + switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "proto-specific-event-name", event); + switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "expires", exp_delta_str); + switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "event_type", "presence"); + switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog"); + switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "expires", exp_delta_str); + switch_event_fire(&sevent); + + } } else { if (switch_event_create(&sevent, SWITCH_EVENT_PRESENCE_PROBE) == SWITCH_STATUS_SUCCESS) { switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); commit 1cf79386c80712311c656a166b9dec5847857266 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Jan 21 14:27:51 2011 -0600 FS-2917 diff --git a/src/switch_core.c b/src/switch_core.c index b531111..43fb36d 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -151,13 +151,21 @@ static void check_ip(void) SWITCH_STANDARD_SCHED_FUNC(heartbeat_callback) { send_heartbeat(); - check_ip(); /* reschedule this task */ task->runtime = switch_epoch_time_now(NULL) + 20; } +SWITCH_STANDARD_SCHED_FUNC(check_ip_callback) +{ + check_ip(); + + /* reschedule this task */ + task->runtime = switch_epoch_time_now(NULL) + 60; +} + + SWITCH_DECLARE(switch_status_t) switch_core_set_console(const char *console) { if ((runtime.console = fopen(console, "a")) == 0) { @@ -1357,6 +1365,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc switch_scheduler_add_task(switch_epoch_time_now(NULL), heartbeat_callback, "heartbeat", "core", 0, NULL, SSHF_NONE | SSHF_NO_DEL); + switch_scheduler_add_task(switch_epoch_time_now(NULL), check_ip_callback, "check_ip", "core", 0, NULL, SSHF_NONE | SSHF_NO_DEL | SSHF_OWN_THREAD); + switch_uuid_get(&uuid); switch_uuid_format(runtime.uuid_str, &uuid); commit e086b80632bad6c3afb24320d2fcb74304897a9c Merge: accc285 6e2b1bd Author: Moises Silva <moy@sangoma.com> Date: Fri Jan 21 15:29:28 2011 -0500 Merge branch 'master' of git.freeswitch.org:freeswitch commit accc28528009361b4b1e268431d6e2b94112020a Author: Moises Silva <moy@sangoma.com> Date: Fri Jan 21 15:29:07 2011 -0500 freetdm: ftmod_wanpipe dummy for disabling echotrain diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index 3b384cd..e08fd61 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -664,6 +664,8 @@ static FIO_COMMAND_FUNCTION(wanpipe_command) } } break; + case FTDM_COMMAND_DISABLE_ECHOTRAIN: { err = 0; } + break; case FTDM_COMMAND_ENABLE_DTMF_DETECT: { #ifdef WP_API_FEATURE_DTMF_EVENTS commit 6e2b1bd328607b2f0d5175b57389dfd2c3c62066 Author: Daniel Swarbrick <daniel@seventhsignal.de> Date: Fri Jan 21 21:05:01 2011 +0100 initial checkin of mod_snmp diff --git a/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB b/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB new file mode 100644 index 0000000..9584c8b --- /dev/null +++ b/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB @@ -0,0 +1,110 @@ +FREESWITCH-MIB DEFINITIONS ::= BEGIN + +IMPORTS + OBJECT-TYPE, MODULE-IDENTITY, + Integer32, Gauge32, Counter32, Counter64, TimeTicks, + enterprises, + FROM SNMPv2-SMI + + DisplayString + FROM SNMPv2-TC +; + + +freeswitch MODULE-IDENTITY + LAST-UPDATED "201101170000Z" + ORGANIZATION "www.freeswitch.org" + CONTACT-INFO + "Primary contact: Anthony Minessale II + Email: anthm@freeswitch.org" + DESCRIPTION + "This file defines the private FreeSWITCH SNMP MIB extensions." + REVISION "201101170000Z" + DESCRIPTION + "First draft by daniel.swarbrick@seventhsignal.de" + ::= { enterprises 27880 } + + +core OBJECT IDENTIFIER ::= { freeswitch 1 } +mod-sofia OBJECT IDENTIFIER ::= { freeswitch 1001 } +mod-skinny OBJECT IDENTIFIER ::= { freeswitch 1002 } + + +identity OBJECT IDENTIFIER ::= { core 1 } + +versionString OBJECT-TYPE + SYNTAX DisplayString + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "FreeSWITCH version as a string" + ::= { identity 1 } + +uuid OBJECT-TYPE + SYNTAX DisplayString + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "FreeSWITCH core UUID" + ::= { identity 2 } + + +systemStats OBJECT IDENTIFIER ::= { core 2 } + +uptime OBJECT-TYPE + SYNTAX TimeTicks + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "FreeSWITCH process uptime in hundredths of seconds" + ::= { systemStats 1 } + +sessionsSinceStartup OBJECT-TYPE + SYNTAX Counter32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Number of sessions since FreeSWITCH process was started" + ::= { systemStats 2 } + +currentSessions OBJECT-TYPE + SYNTAX Gauge32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Currently active sessions" + ::= { systemStats 3 } + +maxSessions OBJECT-TYPE + SYNTAX Gauge32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Maximum permissible active sessions" + ::= { systemStats 4 } + +currentCalls OBJECT-TYPE + SYNTAX Gauge32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Currently active calls" + ::= { systemStats 5 } + +sessionsPerSecond OBJECT-TYPE + SYNTAX Gauge32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Current sessions per second" + ::= { systemStats 6 } + +maxSessionsPerSecond OBJECT-TYPE + SYNTAX Gauge32 + MAX-ACCESS read-only + STATUS current + DESCRIPTION + "Maximum permissible sessions per second" + ::= { systemStats 7 } + +END diff --git a/src/mod/event_handlers/mod_snmp/Makefile b/src/mod/event_handlers/mod_snmp/Makefile new file mode 100644 index 0000000..1d8827d --- /dev/null +++ b/src/mod/event_handlers/mod_snmp/Makefile @@ -0,0 +1,7 @@ +include ../../../../build/modmake.rules + +LOCAL_CFLAGS=-I `net-snmp-config --cflags` +LOCAL_LDFLAGS=`net-snmp-config --agent-libs` +LOCAL_OBJS=subagent.o + +local_depend: $(LOCAL_OBJS) diff --git a/src/mod/event_handlers/mod_snmp/mod_snmp.c b/src/mod/event_handlers/mod_snmp/mod_snmp.c new file mode 100644 index 0000000..040e82b --- /dev/null +++ b/src/mod/event_handlers/mod_snmp/mod_snmp.c @@ -0,0 +1,138 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> + * + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (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.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * + * The Initial Developer of the Original Code is + * Anthony Minessale II <anthm@freeswitch.org> + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Daniel Swarbrick <daniel.swarbrick@seventhsignal.de> + * Stefan Knoblich <s.knoblich@axsentis.de> + * + * mod_snmp.c -- SNMP AgentX Subagent Module + * + */ +#include <switch.h> + +#include <net-snmp/net-snmp-config.h> +#include <net-snmp/net-snmp-includes.h> +#include <net-snmp/agent/net-snmp-agent-includes.h> + +#include "subagent.h" + +static struct { + switch_memory_pool_t *pool; + int shutdown; +} globals; + +SWITCH_MODULE_LOAD_FUNCTION(mod_snmp_load); +SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_snmp_shutdown); +SWITCH_MODULE_RUNTIME_FUNCTION(mod_snmp_runtime); +SWITCH_MODULE_DEFINITION(mod_snmp, mod_snmp_load, mod_snmp_shutdown, mod_snmp_runtime); + + +static int snmp_callback_log(int major, int minor, void *serverarg, void *clientarg) +{ + struct snmp_log_message *slm = (struct snmp_log_message *) serverarg; + switch_log_printf(SWITCH_CHANNEL_LOG, slm->priority, "%s", slm->msg); + return SNMP_ERR_NOERROR; +} + + +static switch_state_handler_table_t state_handlers = { + /*.on_init */ NULL, + /*.on_routing */ NULL, + /*.on_execute */ NULL, + /*.on_hangup */ NULL, + /*.on_exchange_media */ NULL, + /*.on_soft_execute */ NULL, + /*.on_consume_media */ NULL, + /*.on_hibernate */ NULL, + /*.on_reset */ NULL, + /*.on_park */ NULL, + /*.on_reporting */ NULL +}; + + +static switch_status_t load_config(switch_memory_pool_t *pool) +{ + switch_status_t status = SWITCH_STATUS_SUCCESS; + + memset(&globals, 0, sizeof(globals)); + globals.pool = pool; + + return status; +} + + +SWITCH_MODULE_LOAD_FUNCTION(mod_snmp_load) +{ + switch_status_t status = SWITCH_STATUS_SUCCESS; + + load_config(pool); + + switch_core_add_state_handler(&state_handlers); + *module_interface = switch_loadable_module_create_module_interface(pool, modname); + + /* Register callback function so we get Net-SNMP logging handled by FreeSWITCH */ + snmp_register_callback(SNMP_CALLBACK_LIBRARY, SNMP_CALLBACK_LOGGING, snmp_callback_log, NULL); + snmp_enable_calllog(); + + netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_PERSIST_STATE, 1); + netsnmp_ds_set_boolean(NETSNMP_DS_APPLICATION_ID, NETSNMP_DS_AGENT_ROLE, 1); + + init_agent("mod_snmp"); + init_subagent(); + init_snmp("mod_snmp"); + + return status; +} + + +SWITCH_MODULE_RUNTIME_FUNCTION(mod_snmp_runtime) +{ + /* block on select() */ + agent_check_and_process(1); + + return SWITCH_STATUS_SUCCESS; +} + + +SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_snmp_shutdown) +{ + globals.shutdown = 1; + switch_core_remove_state_handler(&state_handlers); + + snmp_shutdown("mod_snmp"); + + return SWITCH_STATUS_SUCCESS; +} + + + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4: + */ diff --git a/src/mod/event_handlers/mod_snmp/subagent.c b/src/mod/event_handlers/mod_snmp/subagent.c new file mode 100644 index 0000000..8a9f2da --- /dev/null +++ b/src/mod/event_handlers/mod_snmp/subagent.c @@ -0,0 +1,189 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> + * + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (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.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * + * The Initial Developer of the Original Code is + * Anthony Minessale II <anthm@freeswitch.org> + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Daniel Swarbrick <daniel.swarbrick@seventhsignal.de> + * Stefan Knoblich <s.knoblich@axsentis.de> + * + * mod_snmp.c -- SNMP AgentX Subagent Module + * + */ +#include <switch.h> +#include <switch_version.h> + +#include <net-snmp/net-snmp-config.h> +#include <net-snmp/net-snmp-includes.h> +#include <net-snmp/agent/net-snmp-agent-includes.h> +#include "subagent.h" + + +static oid identity_oid[] = { 1,3,6,1,4,1,27880,1,1 }; +static oid systemStats_oid[] = { 1,3,6,1,4,1,27880,1,2 }; + +/* identity sub-IDs - these must match MIB */ +enum { + versionString_oid = 1, + uuid_oid +}; + + +/* systemStats sub-IDs - these must match MIB */ +enum { + uptime_oid = 1, + sessionsSinceStartup_oid, + currentSessions_oid, + maxSessions_oid, + currentCalls_oid, + sessionsPerSecond_oid, + maxSessionsPerSecond_oid +}; + + +void init_subagent(void) +{ + DEBUGMSGTL(("init_nstAgentSubagentObject", "Initializing\n")); + + netsnmp_register_handler(netsnmp_create_handler_registration("identity", handle_identity, identity_oid, OID_LENGTH(identity_oid), HANDLER_CAN_RONLY)); + netsnmp_register_handler(netsnmp_create_handler_registration("systemStats", handle_systemStats, systemStats_oid, OID_LENGTH(systemStats_oid), HANDLER_CAN_RONLY)); +} + + +int handle_identity(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests) +{ + static char const version[] = SWITCH_VERSION_FULL; + char uuid[40] = ""; + netsnmp_request_info *request = NULL; + oid subid; + + switch(reqinfo->mode) { + case MODE_GET: + for (request = requests; request; request = request->next) { + subid = request->requestvb->name[OID_LENGTH(systemStats_oid)]; + + switch (subid) { + case versionString_oid: + snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) &version, strlen(version)); + break; + case uuid_oid: + strncpy(uuid, switch_core_get_uuid(), sizeof(uuid)); + snmp_set_var_typed_value(requests->requestvb, ASN_OCTET_STR, (u_char *) &uuid, strlen(uuid)); + break; + default: + snmp_log(LOG_WARNING, "Unregistered OID-suffix requested (%d)\n", (int) subid); + netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT); + } + } + break; + + case MODE_GETNEXT: + snmp_log(LOG_ERR, "MODE_GETNEXT not supported (yet)\n"); + break; + + default: + /* we should never get here, so this is a really bad error */ + snmp_log(LOG_ERR, "Unknown mode (%d) in handle_versionString\n", reqinfo->mode ); + return SNMP_ERR_GENERR; + } + + return SNMP_ERR_NOERROR; +} + + +int handle_systemStats(netsnmp_mib_handler *handler, netsnmp_handler_registration *reginfo, netsnmp_agent_request_info *reqinfo, netsnmp_request_info *requests) +{ + netsnmp_request_info *request = NULL; + oid subid; + switch_time_t uptime; + uint32_t int_val; + + switch(reqinfo->mode) { + case MODE_GET: + for (request = requests; request; request = request->next) { + subid = request->requestvb->name[OID_LENGTH(systemStats_oid)]; + + switch (subid) { + case uptime_oid: + uptime = switch_core_uptime() / 10000; + snmp_set_var_typed_value(requests->requestvb, ASN_TIMETICKS, (u_char *) &uptime, sizeof(uptime)); + break; + case sessionsSinceStartup_oid: + int_val = switch_core_session_id() - 1; + snmp_set_var_typed_value(requests->requestvb, ASN_COUNTER, (u_char *) &int_val, sizeof(int_val)); + break; + case currentSessions_oid: + int_val = switch_core_session_count(); + snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val)); + break; + case maxSessions_oid: + switch_core_session_ctl(SCSC_MAX_SESSIONS, &int_val);; + snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val)); + break; + case currentCalls_oid: + /* + * This is zero for now, since there is no convenient way to get total call + * count (not to be confused with session count), without touching the + * database. + */ + int_val = 0; + snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val)); + break; + case sessionsPerSecond_oid: + switch_core_session_ctl(SCSC_LAST_SPS, &int_val); + snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val)); + break; + case maxSessionsPerSecond_oid: + switch_core_session_ctl(SCSC_SPS, &int_val); + snmp_set_var_typed_value(requests->requestvb, ASN_GAUGE, (u_char *) &int_val, sizeof(int_val)); + break; + default: + snmp_log(LOG_WARNING, "Unregistered OID-suffix requested (%d)\n", (int) subid); + netsnmp_set_request_error(reqinfo, request, SNMP_NOSUCHOBJECT); + } + } + break; + + case MODE_GETNEXT: + snmp_log(LOG_ERR, "MODE_GETNEXT not supported (yet)\n"); + break; + + default: + /* we should never get here, so this is a really bad error */ + snmp_log(LOG_ERR, "Unknown mode (%d) in handle_systemStats\n", reqinfo->mode); + return SNMP_ERR_GENERR; + } + + return SNMP_ERR_NOERROR; +} + + + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4: + */ diff --git a/src/mod/event_handlers/mod_snmp/subagent.h b/src/mod/event_handlers/mod_snmp/subagent.h new file mode 100644 index 0000000..8a57d8a --- /dev/null +++ b/src/mod/event_handlers/mod_snmp/subagent.h @@ -0,0 +1,8 @@ +#ifndef subagent_H +#define subagent_H + +void init_subagent(void); +Netsnmp_Node_Handler handle_identity; +Netsnmp_Node_Handler handle_systemStats; + +#endif /* subagent_H */ commit c91b409caa37a115a46f60f7b3725d7dd1b3c50e Author: Mathieu Rene <mrene@avgs.ca> Date: Fri Jan 21 11:53:20 2011 -0500 Tricky preprocessor... try again diff --git a/src/mod/formats/mod_shout/mod_shout.c b/src/mod/formats/mod_shout/mod_shout.c index 0b73c66..377cfe5 100644 --- a/src/mod/formats/mod_shout/mod_shout.c +++ b/src/mod/formats/mod_shout/mod_shout.c @@ -584,8 +584,11 @@ static void launch_write_stream_thread(shout_context_t *context) } #define TC_BUFFER_SIZE 1024 * 32 -#define STR(_x) #_x -#define MPGERROR() {err = "MPG123 Error at " __FILE__ ":" STR(__LINE__) "."; mpg123err = mpg123_strerror(context->mh); goto error; } + +#define CONCAT_LOCATION(_x,_y) _x ":" #_y +#define MAKE_LOCATION(_x,_y) CONCAT_LOCATION(_x,_y) +#define HERE MAKE_LOCATION(__FILE__, __LINE__) +#define MPGERROR() {err = "MPG123 Error at " HERE "."; mpg123err = mpg123_strerror(context->mh); goto error; } static switch_status_t shout_file_open(switch_file_handle_t *handle, const char *path) { shout_context_t *context; commit 1561ad2ca695058c79183c07c59fe1dab825deff Author: Mathieu Rene <mrene@avgs.ca> Date: Fri Jan 21 11:38:56 2011 -0500 extra spaces </ocd> diff --git a/src/mod/formats/mod_shout/mod_shout.c b/src/mod/formats/mod_shout/mod_shout.c index 1542be4..0b73c66 100644 --- a/src/mod/formats/mod_shout/mod_shout.c +++ b/src/mod/formats/mod_shout/mod_shout.c @@ -585,7 +585,7 @@ static void launch_write_stream_thread(shout_context_t *context) #define TC_BUFFER_SIZE 1024 * 32 #define STR(_x) #_x -#define MPGERROR() {err = "MPG123 Error at " __FILE__ " : " STR(__LINE__) "."; mpg123err = mpg123_strerror(context->mh); goto error; } +#define MPGERROR() {err = "MPG123 Error at " __FILE__ ":" STR(__LINE__) "."; mpg123err = mpg123_strerror(context->mh); goto error; } static switch_status_t shout_file_open(switch_file_handle_t *handle, const char *path) { shout_context_t *context; commit 74de704973086d5cf360578ad9eac5977cfa4770 Author: Mathieu Rene <mrene@avgs.ca> Date: Fri Jan 21 11:32:14 2011 -0500 FS-2942 - At least display __FILE__ and __LINE__ properly so we can have more data diff --git a/src/mod/formats/mod_shout/mod_shout.c b/src/mod/formats/mod_shout/mod_shout.c index a4965c4..1542be4 100644 --- a/src/mod/formats/mod_shout/mod_shout.c +++ b/src/mod/formats/mod_shout/mod_shout.c @@ -584,7 +584,8 @@ static void launch_write_stream_thread(shout_context_t *context) } #define TC_BUFFER_SIZE 1024 * 32 -#define MPGERROR() {err = "MPG123 Error at __FILE__:__LINE__."; mpg123err = mpg123_strerror(context->mh); goto error; } +#define STR(_x) #_x +#define MPGERROR() {err = "MPG123 Error at " __FILE__ " : " STR(__LINE__) "."; mpg123err = mpg123_strerror(context->mh); goto error; } static switch_status_t shout_file_open(switch_file_handle_t *handle, const char *path) { shout_context_t *context; commit 2e18c5b4d9fc583b76b4c8e4470579b1a21845ae Author: Moises Silva <moy@sangoma.com> Date: Fri Jan 21 10:51:34 2011 -0500 freetdm: added threaded media to the TODO diff --git a/libs/freetdm/TODO b/libs/freetdm/TODO index 6b8ef8f..6b4cf71 100644 --- a/libs/freetdm/TODO +++ b/libs/freetdm/TODO @@ -11,3 +11,12 @@ cannot be shown to end users, we already provide extensive logging for problem troubleshooting. +- Implement threaded IO. + Currently IO modules only work on-demand, where the user (ie, FreeSWITCH) drives the read/write + of media. If the user stops reading, some functions are not possible + (DTMF detection or Hangup tone detection). It would be useful to implement a FreeTDM mode + where the media is driven by a group of threads that are always reading (and possibly writing) + then when the user does ftdm_channel_read(), the media would be read from the buffers filled + by the media thread and not from the underlying IO device, this gives a chance to FreeTDM to + still perform hangup detection or other media services even if the application is not reading. + commit 7fbc47f83a5bf455b6ece49deb7771d144bbce4c Author: Jeff Lenk <jeff@jefflenk.com> Date: Fri Jan 21 09:09:53 2011 -0600 FS-2973 Fix possible segfaults and memory leak during unload, and add new setting odbc-retries diff --git a/conf/autoload_configs/easyroute.conf.xml b/conf/autoload_configs/easyroute.conf.xml index 7cd4909..350a509 100644 --- a/conf/autoload_configs/easyroute.conf.xml +++ b/conf/autoload_configs/easyroute.conf.xml @@ -11,6 +11,9 @@ <!-- IP or Hostname of Default Route --> <param name="default-gateway" value="192.168.66.6"/> + <!-- Number of times to retry ODBC connection on connection problems, default is 120 --> + <param name="odbc-retries" value="120"/> + <!-- Customer Query. Use this with Care!!! We are not responsible if you mess This up!!! Query *MUST* return columns in the following order! gateway varchar(128) - contains destination gateway host:port pair (ex: 192.168.1.1:5060 ) diff --git a/src/mod/applications/mod_easyroute/mod_easyroute.c b/src/mod/applications/mod_easyroute/mod_easyroute.c index 481df95..75b4712 100644 --- a/src/mod/applications/mod_easyroute/mod_easyroute.c +++ b/src/mod/applications/mod_easyroute/mod_easyroute.c @@ -65,6 +65,7 @@ static struct { switch_mutex_t *mutex; char *custom_query; switch_odbc_handle_t *master_odbc; + int odbc_num_retries; } globals; SWITCH_MODULE_LOAD_FUNCTION(mod_easyroute_load); @@ -120,6 +121,8 @@ static switch_status_t load_config(void) set_global_default_gateway(val); } else if (!strcasecmp(var, "custom-query")) { set_global_custom_query(val); + } else if (!strcasecmp(var, "odbc-retries")) { + globals.odbc_num_retries = atoi(val); } } } @@ -143,6 +146,9 @@ static switch_status_t load_config(void) } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opened ODBC Database!\n"); } + if (globals.odbc_num_retries) { + switch_odbc_set_num_retries(globals.master_odbc, globals.odbc_num_retries); + } if (switch_odbc_handle_connect(globals.master_odbc) != SWITCH_ODBC_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n"); status = SWITCH_STATUS_FALSE; @@ -205,7 +211,7 @@ static switch_status_t route_lookup(char *dn, easyroute_results_t *results, int switch_mutex_lock(globals.mutex); } /* Do the Query */ - if (switch_odbc_handle_callback_exec(globals.master_odbc, sql, route_callback, &pdata, NULL) == SWITCH_ODBC_SUCCESS) { + if (globals.master_odbc && switch_odbc_handle_callback_exec(globals.master_odbc, sql, route_callback, &pdata, NULL) == SWITCH_ODBC_SUCCESS) { char tmp_profile[129]; char tmp_gateway[129]; @@ -418,7 +424,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_easyroute_load) SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_easyroute_shutdown) { - switch_odbc_handle_disconnect(globals.master_odbc); + if (globals.master_odbc) { + switch_odbc_handle_disconnect(globals.master_odbc); + switch_odbc_handle_destroy(&globals.master_odbc); + } switch_safe_free(globals.db_username); switch_safe_free(globals.db_password); switch_safe_free(globals.db_dsn); commit 1c95ad98cd1c0e966b738796e74923db8919b754 Author: Joao Mesquita <jmesquita@freeswitch.org> Date: Thu Jan 20 22:43:50 2011 -0300 Export the variables to the b leg as well diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 4141725..5a3be03 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -2982,6 +2982,8 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session, } } } + switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "dialed_user", user); + switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "dialed_domain", domain); if (!dest) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No dial-string available, please check your user directory.\n"); commit fd984d03bb629d08ac4192c5a1d3432e94ceb3d5 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Jan 20 17:52:54 2011 -0600 D'oh Over zealous packet eating diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 4e5450d..3ce7a07 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -2494,7 +2494,8 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ } } - if (rtp_session->recv_msg.header.pt != 13 && + if (bytes && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA) && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_UDPTL) && + rtp_session->recv_msg.header.pt != 13 && rtp_session->recv_msg.header.pt != rtp_session->recv_te && (!rtp_session->cng_pt || rtp_session->recv_msg.header.pt != rtp_session->cng_pt) && rtp_session->recv_msg.header.pt != rtp_session->payload) { commit 70700617d3d6bd45904a81be443fe28aa7fd0387 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Jan 20 13:52:00 2011 -0600 add execute_on_originate var '<app> <arg>' to run in origination thread or '<app>::<arg>' to run async. also originating_leg_uuid variable to show the uuid of the originating leg on an outbound channel diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index d156c70..78743e6 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -2755,6 +2755,26 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } } } + + if (session) { + switch_channel_set_variable(originate_status[i].peer_channel, "originating_leg_uuid", switch_core_session_get_uuid(session)); + } + + if ((vvar = switch_channel_get_variable_dup(originate_status[i].peer_channel, "execute_on_originate", SWITCH_FALSE))) { + char *app = switch_core_session_strdup(originate_status[i].peer_session, vvar); + char *arg = NULL; + + if (strstr(app, "::")) { + switch_core_session_execute_application_async(originate_status[i].peer_session, app, arg); + } else { + if ((arg = strchr(app, ' '))) { + *arg++ = '\0'; + } + + switch_core_session_execute_application(originate_status[i].peer_session, app, arg); + } + + } } if (table) { @@ -2773,7 +2793,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess *cause = SWITCH_CAUSE_SUCCESS; goto outer_for; } - + if (!switch_core_session_running(originate_status[i].peer_session)) { if (originate_status[i].per_channel_delay_start) { switch_channel_set_flag(originate_status[i].peer_channel, CF_BLOCK_STATE); commit d743baefedfbe679a647013adc2718defef90718 Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Jan 20 11:03:13 2011 -0500 freetdm: Fix for defaulting to wrong codec diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c index afba96a..bd5b13b 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c @@ -389,10 +389,11 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ } if (span->default_caller_data.bearer_layer1 == FTDM_INVALID_INT_PARM) { - if (signal_data->switchtype == SNGISDN_SWITCH_EUROISDN) { - span->default_caller_data.bearer_layer1 = IN_UIL1_G711ULAW; - } else { + if (signal_data->switchtype == SNGISDN_SWITCH_EUROISDN || + signal_data->switchtype == SNGISDN_SWITCH_QSIG) { span->default_caller_data.bearer_layer1 = IN_UIL1_G711ALAW; + } else { + span->default_caller_data.bearer_layer1 = IN_UIL1_G711ULAW; } } return FTDM_SUCCESS; commit 1da8339ffb5719ba92ececeb27b6c335f3e6b4aa Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Jan 20 10:42:28 2011 -0500 freetdm: added support for early-media-override diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index e7053c1..df528ae 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -676,6 +676,9 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm /*OUTBOUND...so we were told by the line of this so noifiy the user*/ sigev.event_id = FTDM_SIGEVENT_PROCEED; ftdm_span_send_signal(ftdmchan->span, &sigev); + if (sngisdn_test_flag(sngisdn_info, FLAG_MEDIA_READY)) { + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); + } } else { if (!sngisdn_test_flag(sngisdn_info, FLAG_SENT_PROCEED)) { /* By default, we do not send a progress indicator in the proceed */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 58fcc07..80dc73f 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -112,6 +112,11 @@ typedef enum { SNGISDN_OPT_FALSE = 2, } sngisdn_opt_t; +typedef enum { + SNGISDN_EARLY_MEDIA_ON_PROCEED = (1 << 0), + SNGISDN_EARLY_MEDIA_ON_PROGRESS = (1 << 1), + SNGISDN_EARLY_MEDIA_ON_ALERT= (1 << 2), +} sngisdn_early_media_opt_t; typedef enum { SNGISDN_AVAIL_DOWN = 1, @@ -188,7 +193,8 @@ typedef struct sngisdn_span_data { uint8_t span_id; uint8_t tei; uint8_t min_digits; - uint8_t trace_flags; /* TODO: change to flags, so we can use ftdm_test_flag etc.. */ + uint8_t trace_flags; /* TODO change to bit map of sngisdn_tracetype_t */ + uint8_t early_media_flags; /* bit map of ftdm_sngisdn_early_media_opt_t */ uint8_t overlap_dial; uint8_t setup_arb; uint8_t facility_ie_decode; @@ -196,10 +202,10 @@ typedef struct sngisdn_span_data { int8_t facility_timeout; uint8_t num_local_numbers; uint8_t ignore_cause_value; - uint8_t raw_trace_q931; - uint8_t raw_trace_q921; + uint8_t raw_trace_q931; /* TODO: combine with trace_flags */ + uint8_t raw_trace_q921; /* TODO: combine with trace_flags */ uint8_t timer_t3; - uint8_t restart_opt; + uint8_t restart_opt; char* local_numbers[SNGISDN_NUM_LOCAL_NUMBERS]; ftdm_sched_t *sched; ftdm_queue_t *event_queue; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c index aad68e1..afba96a 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c @@ -192,6 +192,24 @@ static ftdm_status_t parse_signalling(const char* signalling, ftdm_span_t *span) return FTDM_SUCCESS; } +static ftdm_status_t parse_early_media(const char* opt, ftdm_span_t *span) +{ + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data; + if (!strcasecmp(opt, "on-proceed")) { + signal_data->early_media_flags |= SNGISDN_EARLY_MEDIA_ON_PROCEED; + } else if (!strcasecmp(opt, "on-progress")) { + signal_data->early_media_flags |= SNGISDN_EARLY_MEDIA_ON_PROGRESS; + } else if (!strcasecmp(opt, "on-alert")) { + signal_data->early_media_flags |= SNGISDN_EARLY_MEDIA_ON_ALERT; + } else { + ftdm_log(FTDM_LOG_ERROR, "Unsupported early-media option %s\n", opt); + return FTDM_FAIL; + } + ftdm_log(FTDM_LOG_DEBUG, "Early media opt:0x%x\n", signal_data->early_media_flags); + return FTDM_SUCCESS; +} + + static ftdm_status_t set_switchtype_defaults(ftdm_span_t *span) { sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data; @@ -249,6 +267,7 @@ static ftdm_status_t set_switchtype_defaults(ftdm_span_t *span) return FTDM_SUCCESS; } + ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *span) { unsigned paramindex; @@ -351,10 +370,14 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ parse_yesno(var, val, &signal_data->raw_trace_q931); } else if (!strcasecmp(var, "q921-raw-trace")) { parse_yesno(var, val, &signal_data->raw_trace_q921); + } else if (!strcasecmp(var, "early-media-override")) { + if (parse_early_media(val, span) != FTDM_SUCCESS) { + return FTDM_FAIL; + } } else { ftdm_log(FTDM_LOG_WARNING, "Ignoring unknown parameter %s\n", ftdm_parameters[paramindex].var); } - } + } /* for (paramindex = 0; ftdm_parameters[paramindex].var; paramindex++) */ if (signal_data->switchtype == SNGISDN_SWITCH_INVALID) { ftdm_log(FTDM_LOG_ERROR, "%s: switchtype not specified", span->name); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 7b7c748..0b52011 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -167,12 +167,12 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) char retrieved_str[255]; ret_val = sng_isdn_retrieve_facility_caller_name(conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len, retrieved_str); - /* - return values for "sng_isdn_retrieve_facility_information_following": - If there will be no information following, or fails to decode IE, returns -1 - If there will be no information following, but current FACILITY IE contains a caller name, returns 0 - If there will be information following, returns 1 - */ + /* + return values for "sng_isdn_retrieve_facility_information_following": + If there will be no information following, or fails to decode IE, returns -1 + If there will be no information following, but current FACILITY IE contains a caller name, returns 0 + If there will be information following, returns 1 + */ if (ret_val == 1) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Expecting Caller name in FACILITY\n"); @@ -346,6 +346,7 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; CnStEvnt *cnStEvnt = &sngisdn_event->event.cnStEvnt; @@ -384,7 +385,7 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) case FTDM_CHANNEL_STATE_DIALING: case FTDM_CHANNEL_STATE_PROCEED: case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_RINGING: + case FTDM_CHANNEL_STATE_RINGING: if (cnStEvnt->progInd.eh.pres && cnStEvnt->progInd.progDesc.val == IN_PD_IBAVAIL) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Early media available\n"); sngisdn_set_flag(sngisdn_info, FLAG_MEDIA_READY); @@ -393,16 +394,34 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) } switch (evntType) { case MI_CALLPROC: + if (!sngisdn_test_flag(sngisdn_info, FLAG_MEDIA_READY) && + (signal_data->early_media_flags & SNGISDN_EARLY_MEDIA_ON_PROCEED)) { + + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Early media override on proceed\n"); + sngisdn_set_flag(sngisdn_info, FLAG_MEDIA_READY); + } if (ftdmchan->state == FTDM_CHANNEL_STATE_DIALING) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROCEED); } break; case MI_ALERTING: + if (!sngisdn_test_flag(sngisdn_info, FLAG_MEDIA_READY) && + (signal_data->early_media_flags & SNGISDN_EARLY_MEDIA_ON_ALERT)) { + + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Early media override on alert\n"); + sngisdn_set_flag(sngisdn_info, FLAG_MEDIA_READY); + } if (ftdmchan->state == FTDM_CHANNEL_STATE_PROCEED) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RINGING); } break; case MI_PROGRESS: + if (!sngisdn_test_flag(sngisdn_info, FLAG_MEDIA_READY) && + (signal_data->early_media_flags & SNGISDN_EARLY_MEDIA_ON_PROGRESS)) { + + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Early media override on progress\n"); + sngisdn_set_flag(sngisdn_info, FLAG_MEDIA_READY); + } if (sngisdn_test_flag(sngisdn_info, FLAG_MEDIA_READY)) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); } else if (ftdmchan->state != FTDM_CHANNEL_STATE_PROGRESS) { commit 0cf1d54a05319be2f388e5f2dbb1bfd75a2a9043 Merge: 978cb11 9bb3447 Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Jan 19 16:36:04 2011 -0500 Merge branch 'master' of git.freeswitch.org:freeswitch commit 978cb111e7971eceb238d396124e10424b148a6c Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Jan 19 16:35:55 2011 -0500 freetdm - improved default bearer-cap code diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 9c1b7ba..64147b7 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -881,18 +881,27 @@ ftdm_status_t set_bear_cap_ie(ftdm_channel_t *ftdmchan, BearCap *bearCap) bearCap->usrInfoLyr1Prot.pres = PRSNT_NODEF; bearCap->usrInfoLyr1Prot.val = sngisdn_get_usrInfoLyr1Prot_from_user(ftdmchan->caller_data.bearer_layer1); - if (signal_data->switchtype == SNGISDN_SWITCH_EUROISDN && - bearCap->usrInfoLyr1Prot.val == IN_UIL1_G711ULAW) { - - /* We are bridging a call from T1 */ - bearCap->usrInfoLyr1Prot.val = IN_UIL1_G711ALAW; - - } else if (bearCap->usrInfoLyr1Prot.val == IN_UIL1_G711ALAW) { - - /* We are bridging a call from E1 */ - bearCap->usrInfoLyr1Prot.val = IN_UIL1_G711ULAW; + switch (signal_data->switchtype) { + case SNGISDN_SWITCH_NI2: + case SNGISDN_SWITCH_4ESS: + case SNGISDN_SWITCH_5ESS: + case SNGISDN_SWITCH_DMS100: + case SNGISDN_SWITCH_INSNET: + if (bearCap->usrInfoLyr1Prot.val == IN_UIL1_G711ALAW) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Overriding bearer cap to u-law\n"); + bearCap->usrInfoLyr1Prot.val = IN_UIL1_G711ULAW; + } + break; + case SNGISDN_SWITCH_EUROISDN: + case SNGISDN_SWITCH_QSIG: + if (bearCap->usrInfoLyr1Prot.val == IN_UIL1_G711ULAW) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Overriding bearer cap to a-law\n"); + bearCap->usrInfoLyr1Prot.val = IN_UIL1_G711ALAW; + } + break; } + bearCap->lyr1Ident.pres = PRSNT_NODEF; bearCap->lyr1Ident.val = IN_L1_IDENT; } commit 9bb344783d39da5dc3e57d48b59f551ba9a2fa4d Author: Moises Silva <moy@sangoma.com> Date: Wed Jan 19 16:25:33 2011 -0500 freetdm: remove collision event string diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 8d67df3..aed4054 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -430,7 +430,7 @@ typedef enum { } ftdm_signal_event_t; #define SIGNAL_STRINGS "START", "STOP", "RELEASED", "UP", "FLASH", "PROCEED", "RINGING", "PROGRESS", \ "PROGRESS_MEDIA", "ALARM_TRAP", "ALARM_CLEAR", \ - "COLLECTED_DIGIT", "ADD_CALL", "RESTART", "SIGSTATUS_CHANGED", "COLLISION", "FACILITY", \ + "COLLECTED_DIGIT", "ADD_CALL", "RESTART", "SIGSTATUS_CHANGED", "FACILITY", \ "TRACE", "TRACE_RAW", "INDICATION_COMPLETED", "DIALING", "INVALID" /*! \brief Move from string to ftdm_signal_event_t and viceversa */ FTDM_STR2ENUM_P(ftdm_str2ftdm_signal_event, ftdm_signal_event2str, ftdm_signal_event_t) commit 7d13655b747ef6f3577138f55ed48ec8c2fa11a5 Merge: 0fdc272 7fb1abf Author: Moises Silva <moy@sangoma.com> Date: Wed Jan 19 15:53:28 2011 -0500 Merge branch 'master' of git.sangoma.com:smg_freeswitch commit 0fdc272b25c7918359ae5b0f27277ff1926bcb75 Author: Moises Silva <moy@sangoma.com> Date: Wed Jan 19 15:53:01 2011 -0500 freetdm: open wanpipe devices as non-exclusive if possible diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index e2b0825..3b384cd 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -239,7 +239,11 @@ static unsigned wp_open_range(ftdm_span_t *span, unsigned spanno, unsigned start ftdm_log(FTDM_LOG_ERROR, "span %d channel %d cannot be configured as smg_prid_nfas, you need to compile freetdm with newer libsangoma\n", spanno, x); #endif } else { +#ifdef LIBSANGOMA_VERSION + sockfd = __tdmv_api_open_span_chan(spanno, x); +#else sockfd = tdmv_api_open_span_chan(spanno, x); +#endif } if (sockfd == FTDM_INVALID_SOCKET) { commit 7fb1abf7583a22d88f91b2c933a6a379970efbcc Merge: bc2d331 6fd4680 Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Jan 19 14:48:59 2011 -0500 Merge branch 'master' of git://git.freeswitch.org/freeswitch commit 6fd468043b284ee30085cf86be16ba99725d6462 Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Jan 19 14:46:28 2011 -0500 freetdm: fix for closing d-channel when channel is already closed by freetdm core diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index f2afd1c..e7053c1 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -394,8 +394,7 @@ static void *ftdm_sangoma_isdn_dchan_run(ftdm_thread_t *me, void *obj) default: ftdm_log_chan_msg(dchan, FTDM_LOG_CRIT, "Unhandled IO event\n"); } - } - ftdm_channel_close(&dchan); + } return NULL; } commit bc2d331feb7c7e736f2d1289a11518053177a6f4 Merge: 54c0d6f 5ffc6b4 Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Jan 19 14:21:29 2011 -0500 Merge branch 'master' of git://git.freeswitch.org/freeswitch commit 5ffc6b437d86c800519432359277afb39e604c5e Merge: 1fcffcf ea9021a Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Jan 19 14:18:35 2011 -0500 Merge branch 'master' of git.freeswitch.org:freeswitch commit 1fcffcfbc3fe6c2f21e5767fc760fdbc0c89aa68 Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Jan 19 14:18:23 2011 -0500 added documentation diff --git a/libs/freetdm/docs/io_modules.txt b/libs/freetdm/docs/io_modules.txt new file mode 100644 index 0000000..a164bbb --- /dev/null +++ b/libs/freetdm/docs/io_modules.txt @@ -0,0 +1,13 @@ +Last Updated: Jan 19, 2011 + +== BACKGROUND == + +The IO module provides an abstracted IO interface to FreeTDM. + +== SHUTDOWN == +Upon global shutdown, for each channel FIO_CLOSE_FUNCTION will be called. +When FIO_CLOSE_FUNCTION is called, all waiters on this channel shall be signalled. +If FIO_WAIT_FUNCTION is called on a function that has already been closed, this function shall return FTDM_TIMEOUT without blocking. +FIO_CHANNEL_DESTROY will eventually be called, and IO module is responsible for clearing all internal states and free allocated memory upon channel destroy. + + commit ea9021a24a6ce0606a2c12f3cab8f2bf0fc12db3 Author: Brian West <brian@freeswitch.org> Date: Wed Jan 19 11:38:36 2011 -0600 FS-2998: prefix-a-leg not respected for url submission diff --git a/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c b/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c index a439ab8..78d97ce 100644 --- a/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c +++ b/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c @@ -340,7 +340,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) switch_yield(globals.delay * 1000000); } - destUrl = switch_mprintf("%s?uuid=%s", globals.urls[globals.url_index], switch_core_session_get_uuid(session)); + destUrl = switch_mprintf("%s?uuid=%s%s", globals.urls[globals.url_index], a_prefix, switch_core_session_get_uuid(session)); curl_easy_setopt(curl_handle, CURLOPT_URL, destUrl); if (!strncasecmp(destUrl, "https", 5)) { commit afc027473f7fc8a3ec233fb1848f728fc94f56b6 Author: Brian West <brian@freeswitch.org> Date: Wed Jan 19 11:35:48 2011 -0600 FS-2989: Places ;fs_path= within the contact string <...> when using NDLB-connectile-dysfunction-2.0, instead of just appending to the end of the contact string. diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index f644ff7..631cbdb 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1139,7 +1139,13 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand switch_url_encode(my_contact_str, path_encoded + 20, path_encoded_len - 20); reg_desc = "Registered(AUTO-NAT-2.0)"; exptime = 30; - switch_snprintf(contact_str + strlen(contact_str), sizeof(contact_str) - strlen(contact_str), "%s", path_encoded); + + /* place fs_path (the encoded path) inside the <...> of the contact string, if possible */ + if (contact_str[strlen(contact_str) - 1] == '>') { + switch_snprintf(contact_str + strlen(contact_str) - 1, sizeof(contact_str) - strlen(contact_str) + 1, "%s>", path_encoded); + } else { + switch_snprintf(contact_str + strlen(contact_str), sizeof(contact_str) - strlen(contact_str), "%s", path_encoded); + } free(path_encoded); } else { if (*received_data && sofia_test_pflag(profile, PFLAG_RECIEVED_IN_NAT_REG_CONTACT)) { commit bd39ad2269d302748fd55e96431b221ba6c7be6b Author: Brian West <brian@freeswitch.org> Date: Wed Jan 19 11:33:01 2011 -0600 FS-2995: sigh... mr collins you said you fixed this diff --git a/conf/lang/en/dir/sounds.xml b/conf/lang/en/dir/sounds.xml index 2bdc149..15ecec3 100644 --- a/conf/lang/en/dir/sounds.xml +++ b/conf/lang/en/dir/sounds.xml @@ -16,7 +16,7 @@ <match> <action function="play-file" data="directory/dir-to_search_by.wav"/> <action function="play-file" data="directory/dir-first_name.wav"/> - <action function="play-file" data="directory/dir-press.wav"/> + <action function="play-file" data="voicemail/vm-press.wav"/> <action function="say" data="$2" method="pronounced" type="name_spelled"/> </match> </input> @@ -24,7 +24,7 @@ <match> <action function="play-file" data="directory/dir-to_search_by.wav"/> <action function="play-file" data="directory/dir-last_name.wav"/> - <action function="play-file" data="directory/dir-press.wav"/> + <action function="play-file" data="voicemail/vm-press.wav"/> <action function="say" data="$2" method="pronounced" type="name_spelled"/> </match> </input> commit 54c0d6f7c41d3bc882ff339af8c01545e03606a9 Author: Moises Silva <moy@sangoma.com> Date: Wed Jan 19 11:38:27 2011 -0500 freetdm: workaround for Visual C++ 9.0 failing to compile ftdm feature macros diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index fbe42d3..7cf0934 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -132,8 +132,8 @@ extern "C" { #define ftdm_channel_test_feature(obj, flag) ((obj)->features & flag) -#define ftdm_channel_set_feature(obj, flag) (obj)->features |= (flag) -#define ftdm_channel_clear_feature(obj, flag) (obj)->features &= ~(flag) +#define ftdm_channel_set_feature(obj, flag) (obj)->features = (ftdm_channel_feature_t)((obj)->features | flag) +#define ftdm_channel_clear_feature(obj, flag) (obj)->features = (ftdm_channel_feature_t)((obj)->features & ( ~(flag) )) #define ftdm_channel_set_member_locked(obj, _m, _v) ftdm_mutex_lock(obj->mutex); obj->_m = _v; ftdm_mutex_unlock(obj->mutex) /*! commit 9c8ce46b908e78662d970ce20fa38c2f7b710df1 Merge: 163dd05 c64f475 Author: Moises Silva <moy@sangoma.com> Date: Tue Jan 18 16:20:33 2011 -0500 Merge branch 'netborder' commit 163dd056605065b2f8221e95a75e422c0f034f05 Author: Moises Silva <moy@sangoma.com> Date: Tue Jan 18 16:10:14 2011 -0500 freetdm: add ftdm_call_utils.h to the installed headers diff --git a/libs/freetdm/Makefile.am b/libs/freetdm/Makefile.am index 2ab5c29..96f1c9a 100644 --- a/libs/freetdm/Makefile.am +++ b/libs/freetdm/Makefile.am @@ -94,6 +94,7 @@ library_include_HEADERS = \ $(SRC)/include/ftdm_declare.h \ $(SRC)/include/ftdm_threadmutex.h \ $(SRC)/include/ftdm_os.h \ + $(SRC)/include/ftdm_call_utils.h \ $(SRC)/include/ftdm_dso.h lib_LTLIBRARIES = libfreetdm.la commit c64f4753b3003a1b091678850f272669926ff12c Author: David Yat Sin <dyatsin@sangoma.com> Date: Tue Jan 18 14:36:30 2011 -0500 freetdm: added missing cause enums from Q.850 diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 517d6b9..8d67df3 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -82,8 +82,12 @@ typedef enum { FTDM_CAUSE_UNALLOCATED = 1, FTDM_CAUSE_NO_ROUTE_TRANSIT_NET = 2, FTDM_CAUSE_NO_ROUTE_DESTINATION = 3, + FTDM_CAUSE_SEND_SPECIAL_INFO_TONE = 4, + FTDM_CAUSE_MISDIALED_TRUNK_PREFIX = 5, FTDM_CAUSE_CHANNEL_UNACCEPTABLE = 6, FTDM_CAUSE_CALL_AWARDED_DELIVERED = 7, + FTDM_CAUSE_PREEMPTION = 8, + FTDM_CAUSE_PREEMPTION_CIRCUIT_RESERVED = 9, FTDM_CAUSE_NORMAL_CLEARING = 16, FTDM_CAUSE_USER_BUSY = 17, FTDM_CAUSE_NO_USER_RESPONSE = 18, @@ -100,23 +104,38 @@ typedef enum { FTDM_CAUSE_NORMAL_UNSPECIFIED = 31, FTDM_CAUSE_NORMAL_CIRCUIT_CONGESTION = 34, FTDM_CAUSE_NETWORK_OUT_OF_ORDER = 38, + FTDM_CAUSE_PERMANENT_FRAME_MODE_CONNECTION_OOS = 39, + FTDM_CAUSE_PERMANENT_FRAME_MODE_OPERATIONAL = 40, FTDM_CAUSE_NORMAL_TEMPORARY_FAILURE = 41, FTDM_CAUSE_SWITCH_CONGESTION = 42, FTDM_CAUSE_ACCESS_INFO_DISCARDED = 43, FTDM_CAUSE_REQUESTED_CHAN_UNAVAIL = 44, FTDM_CAUSE_PRE_EMPTED = 45, + FTDM_CAUSE_PRECEDENCE_CALL_BLOCKED = 46, + FTDM_CAUSE_RESOURCE_UNAVAILABLE_UNSPECIFIED = 47, + FTDM_CAUSE_QOS_NOT_AVAILABLE = 49, FTDM_CAUSE_FACILITY_NOT_SUBSCRIBED = 50, - FTDM_CAUSE_OUTGOING_CALL_BARRED = 52, - FTDM_CAUSE_INCOMING_CALL_BARRED = 54, + FTDM_CAUSE_OUTGOING_CALL_BARRED = 53, + FTDM_CAUSE_INCOMING_CALL_BARRED = 55, FTDM_CAUSE_BEARERCAPABILITY_NOTAUTH = 57, FTDM_CAUSE_BEARERCAPABILITY_NOTAVAIL = 58, + FTDM_CAUSE_INCONSISTENCY_IN_INFO = 62, FTDM_CAUSE_SERVICE_UNAVAILABLE = 63, FTDM_CAUSE_BEARERCAPABILITY_NOTIMPL = 65, FTDM_CAUSE_CHAN_NOT_IMPLEMENTED = 66, FTDM_CAUSE_FACILITY_NOT_IMPLEMENTED = 69, + FTDM_CAUSE_ONLY_DIGITAL_INFO_BC_AVAIL = 70, FTDM_CAUSE_SERVICE_NOT_IMPLEMENTED = 79, FTDM_CAUSE_INVALID_CALL_REFERENCE = 81, + FTDM_CAUSE_IDENTIFIED_CHAN_NOT_EXIST = 82, + FTDM_CAUSE_SUSPENDED_CALL_EXISTS_BUT_CALL_ID_DOES_NOT = 83, + FTDM_CAUSE_CALL_ID_IN_USE = 84, + FTDM_CAUSE_NO_CALL_SUSPENDED = 85, + FTDM_CAUSE_CALL_WITH_CALL_ID_CLEARED = 86, + FTDM_CAUSE_USER_NOT_CUG = 87, FTDM_CAUSE_INCOMPATIBLE_DESTINATION = 88, + FTDM_CAUSE_NON_EXISTENT_CUG = 90, + FTDM_CAUSE_INVALID_TRANSIT_NETWORK_SELECTION = 91, FTDM_CAUSE_INVALID_MSG_UNSPECIFIED = 95, FTDM_CAUSE_MANDATORY_IE_MISSING = 96, FTDM_CAUSE_MESSAGE_TYPE_NONEXIST = 97, @@ -126,6 +145,7 @@ typedef enum { FTDM_CAUSE_WRONG_CALL_STATE = 101, FTDM_CAUSE_RECOVERY_ON_TIMER_EXPIRE = 102, FTDM_CAUSE_MANDATORY_IE_LENGTH_ERROR = 103, + FTDM_CAUSE_MSG_WITH_UNRECOGNIZED_PARAM_DISCARDED = 110, FTDM_CAUSE_PROTOCOL_ERROR = 111, FTDM_CAUSE_INTERWORKING = 127, FTDM_CAUSE_SUCCESS = 142, commit 137de401218c834262b0941e8b47de600a2c9052 Author: Moises Silva <moy@sangoma.com> Date: Tue Jan 18 14:09:42 2011 -0500 freetdm: ftmod_r2 - change warning to notice for hangup cause mapping diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 6e2b292..0217a51 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -295,7 +295,7 @@ static ftdm_call_cause_t ftdm_r2_cause_to_ftdm_cause(ftdm_channel_t *fchan, open case OR2_CAUSE_GLARE: return FTDM_CAUSE_REQUESTED_CHAN_UNAVAIL; } - ftdm_log_chan(fchan, FTDM_LOG_WARNING, "Mapping openr2 cause %d to unspecified\n", cause); + ftdm_log_chan(fchan, FTDM_LOG_NOTICE, "Mapping openr2 cause %d to unspecified\n", cause); return FTDM_CAUSE_NORMAL_UNSPECIFIED; } commit 9a545bd0c9534eb6e6f7579a1b5f0e57d0a7ee6c Author: Moises Silva <moy@sangoma.com> Date: Tue Jan 18 13:21:31 2011 -0500 freetdm: doh diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index be4e370..e2b0825 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -1267,11 +1267,11 @@ static __inline__ ftdm_status_t wanpipe_channel_process_event(ftdm_channel_t *fc switch(tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_link_status) { case WP_TDMAPI_EVENT_LINK_STATUS_CONNECTED: /* *event_id = FTDM_OOB_ALARM_CLEAR; */ - ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Ignoring wanpipe link connected event\n"); + ftdm_log_chan_msg(fchan, FTDM_LOG_DEBUG, "Ignoring wanpipe link connected event\n"); break; default: /* *event_id = FTDM_OOB_ALARM_TRAP; */ - ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Ignoring wanpipe link disconnected event\n"); + ftdm_log_chan_msg(fchan, FTDM_LOG_DEBUG, "Ignoring wanpipe link disconnected event\n"); break; }; /* The WP_API_EVENT_ALARM event should be used to clear alarms */ commit 51985ca69a1f050b3c724043e01582500882882c Author: Moises Silva <moy@sangoma.com> Date: Tue Jan 18 13:15:04 2011 -0500 freetdm: fix FTDM_IS_DCHAN macro diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 142dff8..517d6b9 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -171,7 +171,7 @@ FTDM_STR2ENUM_P(ftdm_str2ftdm_chan_type, ftdm_chan_type2str, ftdm_chan_type_t) #define FTDM_IS_VOICE_CHANNEL(fchan) ((fchan)->type != FTDM_CHAN_TYPE_DQ921 && (fchan)->type != FTDM_CHAN_TYPE_DQ931) /*! \brief Test if a channel is a D-channel */ -#define FTDM_IS_DCHAN(ftdm_chan) ((fchan)->type == FTDM_CHAN_TYPE_DQ921 || (fchan)->type == FTDM_CHAN_TYPE_DQ931) +#define FTDM_IS_DCHAN(fchan) ((fchan)->type == FTDM_CHAN_TYPE_DQ921 || (fchan)->type == FTDM_CHAN_TYPE_DQ931) /*! \brief Test if a channel is digital channel */ #define FTDM_IS_DIGITAL_CHANNEL(fchan) ((fchan)->span->trunk_type == FTDM_TRUNK_E1 || \ commit 44ac5d8b99e035b14a0eac9943dff5886c061017 Merge: 07fa8a4 4c5426f Author: Moises Silva <moy@sangoma.com> Date: Tue Jan 18 13:14:25 2011 -0500 Merge branch 'master' of git.sangoma.com:smg_freeswitch commit 07fa8a4a72460bf77eac238de0b634896f8d90ca Author: Moises Silva <moy@sangoma.com> Date: Tue Jan 18 13:13:30 2011 -0500 freetdm: fix windows ftmod_wanpipe bug on link connect/disconnect diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index 1f2ad84..d3e2116 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -1257,20 +1257,18 @@ static __inline__ ftdm_status_t wanpipe_channel_process_event(ftdm_channel_t *fc switch(tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_type) { case WP_API_EVENT_LINK_STATUS: { -#if 0 switch(tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_link_status) { case WP_TDMAPI_EVENT_LINK_STATUS_CONNECTED: - *event_id = FTDM_OOB_ALARM_CLEAR; + /* *event_id = FTDM_OOB_ALARM_CLEAR; */ + ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Ignoring wanpipe link connected event\n"); break; default: - *event_id = FTDM_OOB_ALARM_TRAP; + /* *event_id = FTDM_OOB_ALARM_TRAP; */ + ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Ignoring wanpipe link disconnected event\n"); break; }; -#else /* The WP_API_EVENT_ALARM event should be used to clear alarms */ - ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Ignoring wanpipe link status event\n", ftdm_oob_event2str(*event_id)); *event_id = FTDM_OOB_NOOP; -#endif } break; commit 4c5426f2fbf65d1130fee044f4e4acd83f0a4fc7 Merge: 0a38d77 190bd61 Author: Moises Silva <moy@sangoma.com> Date: Tue Jan 18 12:49:03 2011 -0500 Merge remote branch 'fsorig/master' commit 0a38d7761e1099b4e369da8948f22ac7c0c8d184 Author: Moises Silva <moy@sangoma.com> Date: Tue Jan 18 12:44:41 2011 -0500 freetdm: set explicit numbers for channel commands to aid debugging diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 2666a26..142dff8 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -574,84 +574,84 @@ typedef struct ftdm_iterator ftdm_iterator_t; /*! \brief Channel commands that can be executed through ftdm_channel_command() */ typedef enum { - FTDM_COMMAND_NOOP, - FTDM_COMMAND_SET_INTERVAL, - FTDM_COMMAND_GET_INTERVAL, - FTDM_COMMAND_SET_CODEC, - FTDM_COMMAND_GET_CODEC, - FTDM_COMMAND_SET_NATIVE_CODEC, - FTDM_COMMAND_GET_NATIVE_CODEC, - FTDM_COMMAND_ENABLE_DTMF_DETECT, - FTDM_COMMAND_DISABLE_DTMF_DETECT, - FTDM_COMMAND_SEND_DTMF, - FTDM_COMMAND_SET_DTMF_ON_PERIOD, - FTDM_COMMAND_GET_DTMF_ON_PERIOD, - FTDM_COMMAND_SET_DTMF_OFF_PERIOD, - FTDM_COMMAND_GET_DTMF_OFF_PERIOD, - FTDM_COMMAND_GENERATE_RING_ON, - FTDM_COMMAND_GENERATE_RING_OFF, - FTDM_COMMAND_OFFHOOK, - FTDM_COMMAND_ONHOOK, - FTDM_COMMAND_FLASH, - FTDM_COMMAND_WINK, - FTDM_COMMAND_ENABLE_PROGRESS_DETECT, - FTDM_COMMAND_DISABLE_PROGRESS_DETECT, + FTDM_COMMAND_NOOP = 0, + FTDM_COMMAND_SET_INTERVAL = 1, + FTDM_COMMAND_GET_INTERVAL = 2, + FTDM_COMMAND_SET_CODEC = 3, + FTDM_COMMAND_GET_CODEC = 4, + FTDM_COMMAND_SET_NATIVE_CODEC = 5, + FTDM_COMMAND_GET_NATIVE_CODEC = 6, + FTDM_COMMAND_ENABLE_DTMF_DETECT = 7, + FTDM_COMMAND_DISABLE_DTMF_DETECT = 8, + FTDM_COMMAND_SEND_DTMF = 9, + FTDM_COMMAND_SET_DTMF_ON_PERIOD = 10, + FTDM_COMMAND_GET_DTMF_ON_PERIOD = 11, + FTDM_COMMAND_SET_DTMF_OFF_PERIOD = 12, + FTDM_COMMAND_GET_DTMF_OFF_PERIOD = 13, + FTDM_COMMAND_GENERATE_RING_ON = 14, + FTDM_COMMAND_GENERATE_RING_OFF = 15, + FTDM_COMMAND_OFFHOOK = 16, + FTDM_COMMAND_ONHOOK = 17, + FTDM_COMMAND_FLASH = 18, + FTDM_COMMAND_WINK = 19, + FTDM_COMMAND_ENABLE_PROGRESS_DETECT = 20, + FTDM_COMMAND_DISABLE_PROGRESS_DETECT = 21, /*!< Start tracing input and output from channel to the given file */ - FTDM_COMMAND_TRACE_INPUT, - FTDM_COMMAND_TRACE_OUTPUT, + FTDM_COMMAND_TRACE_INPUT = 22, + FTDM_COMMAND_TRACE_OUTPUT = 23, /*!< Stop both Input and Output trace, closing the files */ - FTDM_COMMAND_TRACE_END_ALL, + FTDM_COMMAND_TRACE_END_ALL = 24, /*!< Enable DTMF debugging */ - FTDM_COMMAND_ENABLE_DEBUG_DTMF, + FTDM_COMMAND_ENABLE_DEBUG_DTMF = 25, /*!< Disable DTMF debugging (if not disabled explicitly, it is disabled automatically when calls hangup) */ - FTDM_COMMAND_DISABLE_DEBUG_DTMF, + FTDM_COMMAND_DISABLE_DEBUG_DTMF = 26, /*!< Start dumping all input to a circular buffer. The size of the circular buffer can be specified, default used otherwise */ - FTDM_COMMAND_ENABLE_INPUT_DUMP, + FTDM_COMMAND_ENABLE_INPUT_DUMP = 27, /*!< Stop dumping all input to a circular buffer. */ - FTDM_COMMAND_DISABLE_INPUT_DUMP, + FTDM_COMMAND_DISABLE_INPUT_DUMP = 28, /*!< Start dumping all output to a circular buffer. The size of the circular buffer can be specified, default used otherwise */ - FTDM_COMMAND_ENABLE_OUTPUT_DUMP, + FTDM_COMMAND_ENABLE_OUTPUT_DUMP = 29, /*!< Stop dumping all output to a circular buffer. */ - FTDM_COMMAND_DISABLE_OUTPUT_DUMP, + FTDM_COMMAND_DISABLE_OUTPUT_DUMP = 30, /*!< Dump the current input circular buffer to the specified FILE* structure */ - FTDM_COMMAND_DUMP_INPUT, + FTDM_COMMAND_DUMP_INPUT = 31, /*!< Dump the current output circular buffer to the specified FILE* structure */ - FTDM_COMMAND_DUMP_OUTPUT, - - FTDM_COMMAND_ENABLE_CALLERID_DETECT, - FTDM_COMMAND_DISABLE_CALLERID_DETECT, - FTDM_COMMAND_ENABLE_ECHOCANCEL, - FTDM_COMMAND_DISABLE_ECHOCANCEL, - FTDM_COMMAND_ENABLE_ECHOTRAIN, - FTDM_COMMAND_DISABLE_ECHOTRAIN, - FTDM_COMMAND_SET_CAS_BITS, - FTDM_COMMAND_GET_CAS_BITS, - FTDM_COMMAND_SET_RX_GAIN, - FTDM_COMMAND_GET_RX_GAIN, - FTDM_COMMAND_SET_TX_GAIN, - FTDM_COMMAND_GET_TX_GAIN, - FTDM_COMMAND_FLUSH_TX_BUFFERS, - FTDM_COMMAND_FLUSH_RX_BUFFERS, - FTDM_COMMAND_FLUSH_BUFFERS, - FTDM_COMMAND_FLUSH_IOSTATS, - FTDM_COMMAND_SET_PRE_BUFFER_SIZE, - FTDM_COMMAND_SET_LINK_STATUS, - FTDM_COMMAND_GET_LINK_STATUS, - FTDM_COMMAND_ENABLE_LOOP, - FTDM_COMMAND_DISABLE_LOOP, - FTDM_COMMAND_SET_RX_QUEUE_SIZE, - FTDM_COMMAND_SET_TX_QUEUE_SIZE, - FTDM_COMMAND_SET_POLARITY, + FTDM_COMMAND_DUMP_OUTPUT = 32, + + FTDM_COMMAND_ENABLE_CALLERID_DETECT = 33, + FTDM_COMMAND_DISABLE_CALLERID_DETECT = 34, + FTDM_COMMAND_ENABLE_ECHOCANCEL = 35, + FTDM_COMMAND_DISABLE_ECHOCANCEL = 36, + FTDM_COMMAND_ENABLE_ECHOTRAIN = 37, + FTDM_COMMAND_DISABLE_ECHOTRAIN = 38, + FTDM_COMMAND_SET_CAS_BITS = 39, + FTDM_COMMAND_GET_CAS_BITS = 40, + FTDM_COMMAND_SET_RX_GAIN = 41, + FTDM_COMMAND_GET_RX_GAIN = 42, + FTDM_COMMAND_SET_TX_GAIN = 43, + FTDM_COMMAND_GET_TX_GAIN = 44, + FTDM_COMMAND_FLUSH_TX_BUFFERS = 45, + FTDM_COMMAND_FLUSH_RX_BUFFERS = 46, + FTDM_COMMAND_FLUSH_BUFFERS = 47, + FTDM_COMMAND_FLUSH_IOSTATS = 48, + FTDM_COMMAND_SET_PRE_BUFFER_SIZE = 49, + FTDM_COMMAND_SET_LINK_STATUS = 50, + FTDM_COMMAND_GET_LINK_STATUS = 51, + FTDM_COMMAND_ENABLE_LOOP = 52, + FTDM_COMMAND_DISABLE_LOOP = 53, + FTDM_COMMAND_SET_RX_QUEUE_SIZE = 54, + FTDM_COMMAND_SET_TX_QUEUE_SIZE = 55, + FTDM_COMMAND_SET_POLARITY = 56, FTDM_COMMAND_COUNT, } ftdm_command_t; commit 1db40e60e4675ce363855ba429ceadd90e800f1c Author: Moises Silva <moy@sangoma.com> Date: Tue Jan 18 11:28:37 2011 -0500 freetdm: improved logic to enable/disable EC on call start/stop - MFC-R2 requires tone signaling that gets screwed sometimes if the EC is enabled during call setup. - EC is now enabled only when switching to a state requiring media (UP and PROGRESS_MEDIA) - The logic is aware of EC persist option in Wanpipe - Improved logging in ftmod_wanpipe to print EC state on startup diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index c13fe76..b5f9fab 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -404,39 +404,39 @@ static __inline__ void ftdm_std_free(void *pool, void *ptr) free(ptr); } -static void ftdm_set_echocancel_call_begin(ftdm_channel_t *chan) +FT_DECLARE(void) ftdm_set_echocancel_call_begin(ftdm_channel_t *chan) { ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); if (ftdm_channel_test_feature(chan, FTDM_CHANNEL_FEATURE_HWEC)) { if (ftdm_channel_test_feature(chan, FTDM_CHANNEL_FEATURE_HWEC_DISABLED_ON_IDLE)) { + /* If the ec is disabled on idle, we need to enable it unless is a digital call */ if (caller_data->bearer_capability != FTDM_BEARER_CAP_64K_UNRESTRICTED) { + ftdm_log_chan(chan, FTDM_LOG_DEBUG, "Enabling ec for call in channel state %s\n", ftdm_channel_state2str(chan->state)); ftdm_channel_command(chan, FTDM_COMMAND_ENABLE_ECHOCANCEL, NULL); } } else { + /* If the ec is enabled on idle, we do nothing unless is a digital call that needs it disabled */ if (caller_data->bearer_capability == FTDM_BEARER_CAP_64K_UNRESTRICTED) { + ftdm_log_chan(chan, FTDM_LOG_DEBUG, "Disabling ec for digital call in channel state %s\n", ftdm_channel_state2str(chan->state)); ftdm_channel_command(chan, FTDM_COMMAND_DISABLE_ECHOCANCEL, NULL); } } } } -static void ftdm_set_echocancel_call_end(ftdm_channel_t *chan) +FT_DECLARE(void) ftdm_set_echocancel_call_end(ftdm_channel_t *chan) { - ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); if (ftdm_channel_test_feature(chan, FTDM_CHANNEL_FEATURE_HWEC)) { if (ftdm_channel_test_feature(chan, FTDM_CHANNEL_FEATURE_HWEC_DISABLED_ON_IDLE)) { - if (caller_data->bearer_capability != FTDM_BEARER_CAP_64K_UNRESTRICTED) { - ftdm_channel_command(chan, FTDM_COMMAND_DISABLE_ECHOCANCEL, NULL); - } + ftdm_log_chan(chan, FTDM_LOG_DEBUG, "Disabling ec on call end in channel state %s\n", ftdm_channel_state2str(chan->state)); + ftdm_channel_command(chan, FTDM_COMMAND_DISABLE_ECHOCANCEL, NULL); } else { - if (caller_data->bearer_capability == FTDM_BEARER_CAP_64K_UNRESTRICTED) { - ftdm_channel_command(chan, FTDM_COMMAND_ENABLE_ECHOCANCEL, NULL); - } + ftdm_log_chan(chan, FTDM_LOG_DEBUG, "Enabling ec back on call end in channel state %s\n", ftdm_channel_state2str(chan->state)); + ftdm_channel_command(chan, FTDM_COMMAND_ENABLE_ECHOCANCEL, NULL); } } } - FT_DECLARE_DATA ftdm_memory_handler_t g_ftdm_mem_handler = { /*.pool =*/ NULL, @@ -5548,25 +5548,44 @@ FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t case FTDM_SIGEVENT_PROGRESS_MEDIA: { - ftdm_log_chan_msg(sigmsg->channel, FTDM_LOG_DEBUG, "Enabling echo cancellation on progress media\n"); - ftdm_set_echocancel_call_begin(sigmsg->channel); + /* test signaling module compliance */ + if (sigmsg->channel->state != FTDM_CHANNEL_STATE_PROGRESS_MEDIA) { + ftdm_log_chan(sigmsg->channel, FTDM_LOG_WARNING, "FTDM_SIGEVENT_PROGRESS_MEDIA sent in state %s\n", ftdm_channel_state2str(sigmsg->channel->state)); + } } break; - case FTDM_SIGEVENT_STOP: - if (!ftdm_test_flag(sigmsg->channel, FTDM_CHANNEL_CALL_STARTED)) { - /* this happens for FXS devices which blindly send SIGEVENT_STOP, we should fix it there ... */ - ftdm_log_chan_msg(sigmsg->channel, FTDM_LOG_DEBUG, "Ignoring SIGEVENT_STOP since user never knew about a call in this channel\n"); - goto done; - } - if (ftdm_test_flag(sigmsg->channel, FTDM_CHANNEL_USER_HANGUP)) { - ftdm_log_chan_msg(sigmsg->channel, FTDM_LOG_DEBUG, "Ignoring SIGEVENT_STOP since user already requested hangup\n"); - goto done; + case FTDM_SIGEVENT_UP: + { + /* test signaling module compliance */ + if (sigmsg->channel->state != FTDM_CHANNEL_STATE_UP) { + ftdm_log_chan(sigmsg->channel, FTDM_LOG_WARNING, "FTDM_SIGEVENT_UP sent in state %s\n", ftdm_channel_state2str(sigmsg->channel->state)); + } } - if (sigmsg->channel->state == FTDM_CHANNEL_STATE_TERMINATING) { - ftdm_log_chan_msg(sigmsg->channel, FTDM_LOG_DEBUG, "Scheduling safety hangup timer\n"); - /* if the user does not move us to hangup in 2 seconds, we will do it ourselves */ - ftdm_sched_timer(globals.timingsched, "safety-hangup", FORCE_HANGUP_TIMER, execute_safety_hangup, sigmsg->channel, &sigmsg->channel->hangup_timer); + break; + + case FTDM_SIGEVENT_STOP: + { + /* TODO: we could test for compliance here and check the state is FTDM_CHANNEL_STATE_TERMINATING + * but several modules need to be updated first */ + + /* if the call was never started, do not send SIGEVENT_STOP + this happens for FXS devices in ftmod_analog which blindly send SIGEVENT_STOP, we should fix it there ... */ + if (!ftdm_test_flag(sigmsg->channel, FTDM_CHANNEL_CALL_STARTED)) { + ftdm_log_chan_msg(sigmsg->channel, FTDM_LOG_DEBUG, "Ignoring SIGEVENT_STOP since user never knew about a call in this channel\n"); + goto done; + } + + if (ftdm_test_flag(sigmsg->channel, FTDM_CHANNEL_USER_HANGUP)) { + ftdm_log_chan_msg(sigmsg->channel, FTDM_LOG_DEBUG, "Ignoring SIGEVENT_STOP since user already requested hangup\n"); + goto done; + } + + if (sigmsg->channel->state == FTDM_CHANNEL_STATE_TERMINATING) { + ftdm_log_chan_msg(sigmsg->channel, FTDM_LOG_DEBUG, "Scheduling safety hangup timer\n"); + /* if the user does not move us to hangup in 2 seconds, we will do it ourselves */ + ftdm_sched_timer(globals.timingsched, "safety-hangup", FORCE_HANGUP_TIMER, execute_safety_hangup, sigmsg->channel, &sigmsg->channel->hangup_timer); + } } break; diff --git a/libs/freetdm/src/ftdm_state.c b/libs/freetdm/src/ftdm_state.c index 574d858..de62c0f 100644 --- a/libs/freetdm/src/ftdm_state.c +++ b/libs/freetdm/src/ftdm_state.c @@ -70,13 +70,13 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_complete_state(const char *file, const c if (state == FTDM_CHANNEL_STATE_PROGRESS) { ftdm_set_flag(fchan, FTDM_CHANNEL_PROGRESS); + } else if (state == FTDM_CHANNEL_STATE_PROGRESS_MEDIA) { + ftdm_set_flag(fchan, FTDM_CHANNEL_PROGRESS); + ftdm_test_and_set_media(fchan); } else if (state == FTDM_CHANNEL_STATE_UP) { ftdm_set_flag(fchan, FTDM_CHANNEL_PROGRESS); - ftdm_set_flag(fchan, FTDM_CHANNEL_MEDIA); ftdm_set_flag(fchan, FTDM_CHANNEL_ANSWERED); - } else if (state == FTDM_CHANNEL_STATE_PROGRESS_MEDIA) { - ftdm_set_flag(fchan, FTDM_CHANNEL_PROGRESS); - ftdm_set_flag(fchan, FTDM_CHANNEL_MEDIA); + ftdm_test_and_set_media(fchan); } else if (state == FTDM_CHANNEL_STATE_DIALING) { ftdm_sigmsg_t msg; memset(&msg, 0, sizeof(msg)); diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 4344177..6e2b292 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -647,9 +647,6 @@ static void ftdm_r2_on_call_init(openr2_chan_t *r2chan) return; } - /* mark the channel in use (so no outgoing calls can be placed here) */ - ftdm_channel_use(ftdmchan); - memset(ftdmchan->caller_data.dnis.digits, 0, sizeof(ftdmchan->caller_data.collected)); memset(ftdmchan->caller_data.ani.digits, 0, sizeof(ftdmchan->caller_data.collected)); diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index 1f2ad84..7bcb69c 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -230,6 +230,8 @@ static unsigned wp_open_range(ftdm_span_t *span, unsigned spanno, unsigned start ftdm_channel_t *chan; ftdm_socket_t sockfd = FTDM_INVALID_SOCKET; const char *dtmf = "none"; + const char *hwec_str = "none"; + const char *hwec_idle = "none"; if (!strncasecmp(span->name, "smg_prid_nfas", 8) && span->trunk_type == FTDM_TRUNK_T1 && x == 24) { #ifdef LIBSANGOMA_VERSION sockfd = __tdmv_api_open_span_chan(spanno, x); @@ -271,6 +273,8 @@ static unsigned wp_open_range(ftdm_span_t *span, unsigned spanno, unsigned start || type == FTDM_CHAN_TYPE_B) { int err; + hwec_str = "unavailable"; + hwec_idle = "enabled"; dtmf = "software"; err = sangoma_tdm_get_hw_coding(chan->sockfd, &tdm_api); @@ -289,6 +293,7 @@ static unsigned wp_open_range(ftdm_span_t *span, unsigned spanno, unsigned start err = sangoma_tdm_get_hw_ec(chan->sockfd, &tdm_api); if (err > 0) { + hwec_str = "available"; ftdm_channel_set_feature(chan, FTDM_CHANNEL_FEATURE_HWEC); } @@ -296,6 +301,7 @@ static unsigned wp_open_range(ftdm_span_t *span, unsigned spanno, unsigned start err = sangoma_tdm_get_hwec_persist_status(chan->sockfd, &tdm_api); if (err == 0) { ftdm_channel_set_feature(chan, FTDM_CHANNEL_FEATURE_HWEC_DISABLED_ON_IDLE); + hwec_idle = "disabled"; } #else if (span->trunk_type == FTDM_TRUNK_BRI || span->trunk_type == FTDM_TRUNK_BRI_PTMP) { @@ -365,7 +371,8 @@ static unsigned wp_open_range(ftdm_span_t *span, unsigned spanno, unsigned start ftdm_copy_string(chan->chan_number, number, sizeof(chan->chan_number)); } configured++; - ftdm_log_chan(chan, FTDM_LOG_INFO, "Configured wanpipe device fd:%d DTMF: %s\n", sockfd, dtmf); + ftdm_log_chan(chan, FTDM_LOG_INFO, "Configured wanpipe device FD: %d, DTMF: %s, HWEC: %s, HWEC_IDLE: %s\n", + sockfd, dtmf, hwec_str, hwec_idle); } else { ftdm_log(FTDM_LOG_ERROR, "ftdm_span_add_channel failed for wanpipe span %d channel %d\n", spanno, x); diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index 4fd8ec6..fbe42d3 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -622,6 +622,9 @@ FT_DECLARE(ftdm_status_t) ftdm_span_trigger_signals(const ftdm_span_t *span); /*! \brief clear the tone detector state */ FT_DECLARE(void) ftdm_channel_clear_detected_tones(ftdm_channel_t *ftdmchan); +/* start/stop echo cancelling at the beginning/end of a call */ +FT_DECLARE(void) ftdm_set_echocancel_call_begin(ftdm_channel_t *chan); +FT_DECLARE(void) ftdm_set_echocancel_call_end(ftdm_channel_t *chan); /*! \brief Assert condition @@ -677,6 +680,14 @@ FT_DECLARE(void) ftdm_channel_clear_detected_tones(ftdm_channel_t *ftdmchan); #define ftdm_span_lock(span) ftdm_mutex_lock(span->mutex) #define ftdm_span_unlock(span) ftdm_mutex_unlock(span->mutex) +#define ftdm_test_and_set_media(fchan) \ + do { \ + if (!ftdm_test_flag((fchan), FTDM_CHANNEL_MEDIA)) { \ + ftdm_set_flag((fchan), FTDM_CHANNEL_MEDIA); \ + ftdm_set_echocancel_call_begin((fchan)); \ + } \ + } while (0); + FT_DECLARE_DATA extern const char *FTDM_LEVEL_NAMES[9]; static __inline__ void ftdm_abort(void) diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index 3bc986d..9e8df1f 100644 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -227,16 +227,11 @@ typedef enum { #define FTDM_CHANNEL_OUTBOUND (1ULL << 18) #define FTDM_CHANNEL_SUSPENDED (1ULL << 19) #define FTDM_CHANNEL_3WAY (1ULL << 20) - -/* this 3 flags are really nonsense used by boost module only, as soon - * as we deprecate/delete boost module we can get rid of them - * ================== - * */ #define FTDM_CHANNEL_PROGRESS (1ULL << 21) +/*!< There is media on the channel already */ #define FTDM_CHANNEL_MEDIA (1ULL << 22) +/*!< The channel was answered */ #define FTDM_CHANNEL_ANSWERED (1ULL << 23) -/* ================== */ - #define FTDM_CHANNEL_MUTE (1ULL << 24) #define FTDM_CHANNEL_USE_RX_GAIN (1ULL << 25) #define FTDM_CHANNEL_USE_TX_GAIN (1ULL << 26) commit 190bd61d8a74678135396f28940655114d9b6513 Author: Michal Bielicki <michal.bielicki@seventhsignal.de> Date: Tue Jan 18 17:58:53 2011 +0300 typo in freeswitch.spec diff --git a/freeswitch.spec b/freeswitch.spec index c434af6..7fb9f80 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -89,7 +89,7 @@ BuildRequires: libtool >= 1.5.17 BuildRequires: ncurses-devel BuildRequires: openssl-devel BuildRequires: perl -% 0%{?fedora_version} >= 8 +%if 0%{?fedora_version} >= 8 BuildRequires: perl-ExtUtils-Embed %endif BuildRequires: pkgconfig commit b683bb6585165c29ef883b41b97400d8ebc550df Author: Michal Bielicki <michal.bielicki@seventhsignal.de> Date: Tue Jan 18 17:58:36 2011 +0300 final version I hope diff --git a/freeswitch-sounds-en-us-callie.spec b/freeswitch-sounds-en-us-callie.spec index 2dbb91a..c476457 100644 --- a/freeswitch-sounds-en-us-callie.spec +++ b/freeswitch-sounds-en-us-callie.spec @@ -46,10 +46,7 @@ BuildArch: noarch BuildRequires: sox Requires: freeswitch Requires: freeswitch-sounds-en-us-callie-48000 - -%if %{is_rhel5}0 -%BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -%endif +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %description FreeSWITCH 48kHz en-us Callie prompts plus, during the installation, @@ -111,9 +108,24 @@ FreeSWITCH Callie prompts package that pulls in the 8KHz, 16KHz, %prep %setup -b0 -q -n en - -# copy buildsounds-callie.sh script to working dir -%{__install} -m 0750 build/buildsounds-callie.sh ./us/callie +mkdir -p ./usr/callie +# create buildsounds-callie.sh script in working dir +echo '#!/bin/bash + +sounds_location=$1 +for rate in 32000 16000 8000 +do + for i in ascii base256 conference currency digits directory ivr misc phonetic-ascii time voicemail zrtp + do + mkdir -p $sounds_location/$i/$rate + for f in `find $sounds_location/$i/48000 -name \*.wav` + do + echo "generating" $sounds_location/$i/$rate/`basename $f` + sox $f -r $rate $sounds_location/$i/$rate/`basename $f` + done + done +done' > ./us/callie/buildsounds-callie.sh +%{__chmod} 0750 ./us/callie/buildsounds-callie.sh ############################################################################## # Build @@ -179,6 +191,7 @@ cd %{_prefix}/sounds/en/us/callie %attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/conference/8000 %attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/currency/8000 %attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/digits/8000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/directory/8000 %attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/ivr/8000 %attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/misc/8000 %attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/phonetic-ascii/8000 @@ -190,6 +203,7 @@ cd %{_prefix}/sounds/en/us/callie %attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/conference/8000/*.wav %attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/currency/8000/*.wav %attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/digits/8000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/directory/8000/*.wav %attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/ivr/8000/*.wav %attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/misc/8000/*.wav %attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/phonetic-ascii/8000/*.wav @@ -204,6 +218,7 @@ cd %{_prefix}/sounds/en/us/callie %attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/conference/16000 %attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/currency/16000 %attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/digits/16000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/directory/16000 %attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/ivr/16000 %attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/misc/16000 %attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/phonetic-ascii/16000 @@ -215,6 +230,7 @@ cd %{_prefix}/sounds/en/us/callie %attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/conference/16000/*.wav %attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/currency/16000/*.wav %attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/digits/16000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/directory/16000/*.wav %attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/ivr/16000/*.wav %attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/misc/16000/*.wav %attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/phonetic-ascii/16000/*.wav @@ -229,6 +245,7 @@ cd %{_prefix}/sounds/en/us/callie %attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/conference/32000 %attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/currency/32000 %attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/digits/32000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/directory/32000 %attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/ivr/32000 %attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/misc/32000 %attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/phonetic-ascii/32000 @@ -240,6 +257,7 @@ cd %{_prefix}/sounds/en/us/callie %attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/conference/32000/*.wav %attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/currency/32000/*.wav %attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/digits/32000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/directory/32000/*.wav %attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/ivr/32000/*.wav %attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/misc/32000/*.wav %attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/phonetic-ascii/32000/*.wav @@ -254,6 +272,7 @@ cd %{_prefix}/sounds/en/us/callie %attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/conference/48000 %attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/currency/48000 %attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/digits/48000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/directory/48000 %attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/ivr/48000 %attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/misc/48000 %attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/phonetic-ascii/48000 @@ -265,6 +284,7 @@ cd %{_prefix}/sounds/en/us/callie %attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/conference/48000/*.wav %attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/currency/48000/*.wav %attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/digits/48000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/directory/48000/*.wav %attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/ivr/48000/*.wav %attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/misc/48000/*.wav %attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/phonetic-ascii/48000/*.wav commit 90e87a481145242bf661de4a96a7ccda1476034e Author: Michal Bielicki <michal.bielicki@seventhsignal.de> Date: Tue Jan 18 15:27:57 2011 +0300 this file is not needed anymore, included in spec file for sounds diff --git a/build/buildsounds-callie.sh b/build/buildsounds-callie.sh deleted file mode 100755 index 06099e6..0000000 --- a/build/buildsounds-callie.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -sounds_location=$1 -for rate in 32000 16000 8000 -do - for i in ascii base256 conference currency digits ivr misc phonetic-ascii time voicemail zrtp - do - mkdir -p $sounds_location/$i/$rate - for f in `find $sounds_location/$i/48000 -name \*.wav` - do - echo "generating" $sounds_location/$i/$rate/`basename $f` - sox $f -r $rate $sounds_location/$i/$rate/`basename $f` - done - done -done commit 10b38944f6e51f33e3d0092ea1dcf3e88538a5a7 Author: cypromis <michal.bielicki@seventhsignal.de> Date: Tue Jan 18 11:40:37 2011 +0100 updated sounds version in version file diff --git a/build/sounds_version.txt b/build/sounds_version.txt index cb0c481..20cb29c 100644 --- a/build/sounds_version.txt +++ b/build/sounds_version.txt @@ -1,3 +1,3 @@ -en-us-callie 1.0.13 +en-us-callie 1.0.14 ru-RU-elena 1.0.12 commit 54879c381e287b6cf0344c08086bf9d8faf686de Author: cypromis <michal.bielicki@seventhsignal.de> Date: Tue Jan 18 11:21:35 2011 +0100 added rpm building for callie soundfiles diff --git a/build/buildsounds-callie.sh b/build/buildsounds-callie.sh new file mode 100755 index 0000000..06099e6 --- /dev/null +++ b/build/buildsounds-callie.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +sounds_location=$1 +for rate in 32000 16000 8000 +do + for i in ascii base256 conference currency digits ivr misc phonetic-ascii time voicemail zrtp + do + mkdir -p $sounds_location/$i/$rate + for f in `find $sounds_location/$i/48000 -name \*.wav` + do + echo "generating" $sounds_location/$i/$rate/`basename $f` + sox $f -r $rate $sounds_location/$i/$rate/`basename $f` + done + done +done diff --git a/freeswitch-sounds-en-us-callie.spec b/freeswitch-sounds-en-us-callie.spec new file mode 100644 index 0000000..2dbb91a --- /dev/null +++ b/freeswitch-sounds-en-us-callie.spec @@ -0,0 +1,319 @@ +############################################################################## +# Copyright and license +############################################################################## +# +# Spec file for package freeswitch-sounds-en-us-callie (version 1.0.12-8) +# +# Copyright (c) 2009 Patrick Laimbock +# Some fixes and additions (c) 2011 Michal Bielicki +# This file and all modifications and additions to the pristine +# package are under the same license as the package itself. +# + +############################################################################## +# Determine distribution +############################################################################## + +%define is_rhel5 %(test -f /etc/redhat-release && egrep -q 'release 5' /etc/redhat-release && echo 1 || echo 0) + +############################################################################## +# Set variables +############################################################################## + +%define version 1.0.14 +%define release 1 + +%define fsname freeswitch +# you could add a version number to be more strict + +%define prefix /opt/freeswitch +%define _prefix %{prefix} + +############################################################################## +# General +############################################################################## + +Summary: FreeSWITCH en-us Callie prompts +Name: freeswitch-sounds-en-us-callie +Version: %{version} +Release: %{release}%{?dist} +License: MPL +Group: Applications/Communications +Packager: Patrick Laimbock <vc-rpms@voipconsulting.nl> +URL: http://www.freeswitch.org +Source0:http://files.freeswitch.org/%{name}-48000-%{version}.tar.gz +BuildArch: noarch +BuildRequires: sox +Requires: freeswitch +Requires: freeswitch-sounds-en-us-callie-48000 + +%if %{is_rhel5}0 +%BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +%endif + +%description +FreeSWITCH 48kHz en-us Callie prompts plus, during the installation, +it will also install locally generated 8KHz, 16KHz and 32KHz prompts + +%package -n freeswitch-sounds-en-us-callie-8000 +Summary: FreeSWITCH 8kHz en-us Callie prompts +Group: Applications/Communications +BuildArch: noarch +Requires: %{fsname} + +%description -n freeswitch-sounds-en-us-callie-8000 +FreeSWITCH 8kHz en-us Callie prompts + +%package -n freeswitch-sounds-en-us-callie-16000 +Summary: FreeSWITCH 16kHz en-us Callie prompts +Group: Applications/Communications +BuildArch: noarch +Requires: %{fsname} + +%description -n freeswitch-sounds-en-us-callie-16000 +FreeSWITCH 16kHz en-us Callie prompts + +%package -n freeswitch-sounds-en-us-callie-32000 +Summary: FreeSWITCH 32kHz en-us Callie prompts +Group: Applications/Communications +BuildArch: noarch +Requires: %{fsname} + +%description -n freeswitch-sounds-en-us-callie-32000 +FreeSWITCH 32kHz en-us Callie prompts + +%package -n freeswitch-sounds-en-us-callie-48000 +Summary: FreeSWITCH 48kHz en-us Callie prompts +Group: Applications/Communications +BuildArch: noarch +Requires: %{fsname} + +%description -n freeswitch-sounds-en-us-callie-48000 +FreeSWITCH 48kHz en-us Callie prompts + +%package -n freeswitch-sounds-en-us-callie-all +Summary: FreeSWITCH en-us Callie prompts +Group: Applications/Communications +BuildArch: noarch +Requires: %{fsname} +Requires: freeswitch-sounds-en-us-callie-8000 = %{version} +Requires: freeswitch-sounds-en-us-callie-16000 = %{version} +Requires: freeswitch-sounds-en-us-callie-32000 = %{version} +Requires: freeswitch-sounds-en-us-callie-48000 = %{version} + +%description -n freeswitch-sounds-en-us-callie-all +FreeSWITCH Callie prompts package that pulls in the 8KHz, 16KHz, +32KHz and 48KHz RPMs + +############################################################################## +# Prep +############################################################################## + +%prep +%setup -b0 -q -n en + +# copy buildsounds-callie.sh script to working dir +%{__install} -m 0750 build/buildsounds-callie.sh ./us/callie + +############################################################################## +# Build +############################################################################## + +%build +# nothing to do here + +############################################################################## +# Install +############################################################################## + +%install +[ "%{buildroot}" != '/' ] && rm -rf %{buildroot} + +# create the sounds directories +%{__install} -d -m 0750 %{buildroot}%{_prefix}/sounds/en/us/callie + +pushd us/callie +# first install the 48KHz sounds +%{__cp} -prv ./* %{buildroot}%{_prefix}/sounds/en/us/callie +# now resample the 48KHz ones to 8KHz, 16KHz and 32KHz +./buildsounds-callie.sh %{buildroot}%{_prefix}/sounds/en/us/callie +popd + +############################################################################## +# Clean +############################################################################## + +%clean +[ "%{buildroot}" != '/' ] && rm -rf %{buildroot} + +############################################################################## +# Post +############################################################################## + +%post +# generate the 8KHz, 16KHz and 32KHz prompts from the 48KHz ones +cd %{_prefix}/sounds/en/us/callie +./buildsounds-callie.sh %{_prefix}/sounds/en/us/callie + +############################################################################## +# Postun +############################################################################## + +%postun +# you could check if there are sound files in 8000/ or +# 16000/ or 32000/ and remove them *only* if the files +# do not belong to an rpm + +############################################################################## +# Files +############################################################################## + +%files +%defattr(-,root,root) +%attr(0750,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/buildsounds-callie.sh + +%files -n freeswitch-sounds-en-us-callie-8000 +%defattr(-,root,root,-) +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/ascii/8000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/base256/8000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/conference/8000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/currency/8000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/digits/8000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/ivr/8000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/misc/8000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/phonetic-ascii/8000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/time/8000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/voicemail/8000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/zrtp/8000 +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/ascii/8000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/base256/8000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/conference/8000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/currency/8000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/digits/8000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/ivr/8000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/misc/8000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/phonetic-ascii/8000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/time/8000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/voicemail/8000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/zrtp/8000/*.wav + +%files -n freeswitch-sounds-en-us-callie-16000 +%defattr(-,root,root,-) +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/ascii/16000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/base256/16000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/conference/16000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/currency/16000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/digits/16000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/ivr/16000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/misc/16000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/phonetic-ascii/16000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/time/16000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/voicemail/16000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/zrtp/16000 +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/ascii/16000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/base256/16000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/conference/16000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/currency/16000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/digits/16000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/ivr/16000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/misc/16000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/phonetic-ascii/16000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/time/16000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/voicemail/16000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/zrtp/16000/*.wav + +%files -n freeswitch-sounds-en-us-callie-32000 +%defattr(-,root,root,-) +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/ascii/32000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/base256/32000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/conference/32000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/currency/32000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/digits/32000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/ivr/32000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/misc/32000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/phonetic-ascii/32000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/time/32000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/voicemail/32000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/zrtp/32000 +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/ascii/32000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/base256/32000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/conference/32000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/currency/32000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/digits/32000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/ivr/32000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/misc/32000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/phonetic-ascii/32000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/time/32000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/voicemail/32000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/zrtp/32000/*.wav + +%files -n freeswitch-sounds-en-us-callie-48000 +%defattr(-,root,root,-) +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/ascii/48000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/base256/48000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/conference/48000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/currency/48000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/digits/48000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/ivr/48000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/misc/48000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/phonetic-ascii/48000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/time/48000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/voicemail/48000 +%attr(0750,freeswitch,daemon) %dir %{_prefix}/sounds/en/us/callie/zrtp/48000 +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/ascii/48000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/base256/48000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/conference/48000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/currency/48000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/digits/48000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/ivr/48000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/misc/48000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/phonetic-ascii/48000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/time/48000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/voicemail/48000/*.wav +%attr(0640,freeswitch,daemon) %{_prefix}/sounds/en/us/callie/zrtp/48000/*.wav + +%files -n freeswitch-sounds-en-us-callie-all + +############################################################################## +# Changelog +############################################################################## + +%changelog +* Tue Jan 18 2011 Michal Bielicki <michal.bielicki@seventhsignal.de> - 1.0.14-1 +- bump up version +- include script into freeswitch core +- include specfile into freeswitch core +- runtime does not require sox, only building + +* Thu Dec 17 2009 Patrick Laimbock <vc-rpms@voipconsulting.nl> - 1.0.12-8 +- update perms and user/group to sync with the old situation + +* Wed Dec 16 2009 Patrick Laimbock <vc-rpms@voipconsulting.nl> - 1.0.12-7 +- make main package require freeswitch-sounds-en-us-callie-48000 and +- generate the 8KHz, 16KHz and 32KHz sounds from there +- add license to spec file + +* Wed Dec 16 2009 Patrick Laimbock <vc-rpms@voipconsulting.nl> - 1.0.12-5 +- put 48KHz in a separate package and let the main package Require 48KHz +- and then use the script to generate the 8KHz, 16KHz and 32KHz sounds + +* Wed Dec 16 2009 Patrick Laimbock <vc-rpms@voipconsulting.nl> - 1.0.12-4 +- add freeswitch-sounds-en-us-callie-all package that pulls in the 8KHz, +- 16KHz, 32KHz and 48KHz RPM packages + +* Tue Dec 15 2009 Patrick Laimbock <vc-rpms@voipconsulting.nl> - 1.0.12-3 +- override subpackage name with -n so it no longer builds an empty main RPM +- rework spec file +- add sox as a requirement +- run buildsounds-callie.sh in post to generate 8KHz, 16KHz and 32KHz prompts + +* Tue Dec 15 2009 Patrick Laimbock <vc-rpms@voipconsulting.nl> - 1.0.12-2 +- can't override Name in subpackage so put all versions in RPM subpackages +- with an empty main RPM package + +* Tue Dec 15 2009 Patrick Laimbock <vc-rpms@voipconsulting.nl> - 1.0.12-1 +- create spec file with the following requirement: +- source only contains the 48KHz sound prompts +- during build the 48KHz sound prompts are resampled to 8KHz, 16KHz and 32KHz +- the 8KHz, 16KHz, 32KHz and 48KHz sound prompts are packaged separately + commit af0dc500ae8639d2b19c9a1a55937e7bb6f27db2 Author: cypromis <michal.bielicki@seventhsignal.de> Date: Tue Jan 18 11:20:12 2011 +0100 more fedora fixes diff --git a/freeswitch.spec b/freeswitch.spec index cb83ffb..c434af6 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -89,11 +89,13 @@ BuildRequires: libtool >= 1.5.17 BuildRequires: ncurses-devel BuildRequires: openssl-devel BuildRequires: perl -%if %{_vendor} == redhat && 0%{?fedora} <= 8 +% 0%{?fedora_version} >= 8 BuildRequires: perl-ExtUtils-Embed %endif BuildRequires: pkgconfig +%if %{_vendor} == redhat && 0%{?fedora} <= 6 BuildRequires: termcap +%endif BuildRequires: unixODBC-devel BuildRequires: gdbm-devel BuildRequires: db4-devel @@ -954,6 +956,8 @@ fi # ###################################################################################################################### %changelog +* Tue Jan 18 2011 - michal.bielicki@seventhsignal.de +- Fedora adjustments * Fri Oct 15 2010 - michal.bielicki@seventhsignal.de - added mod_curl * Sat Oct 09 2010 - michal.bielicki@seventhsignal.de commit 7438e24d1ab38317d73ace94150573fb84778f59 Author: cypromis <michal.bielicki@seventhsignal.de> Date: Tue Jan 18 10:32:45 2011 +0100 fix a fedora dep and fix python path to be variable in sopec file diff --git a/freeswitch.spec b/freeswitch.spec index 66db65c..cb83ffb 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -53,7 +53,7 @@ Vendor: http://www.freeswitch.org/ # Source files and where to get them # ###################################################################################################################### -Source0: http://files.freeswitch.org/%{name}-%{version}.tar.bz2 +Source0: http://files.freeswitch.org/%{name}-%{version}.tar.bz2 Source1: http://files.freeswitch.org/downloads/libs/celt-0.7.1.tar.gz Source2: http://files.freeswitch.org/downloads/libs/flite-1.3.99-latest.tar.gz Source3: http://files.freeswitch.org/downloads/libs/lame-3.97.tar.gz @@ -89,6 +89,9 @@ BuildRequires: libtool >= 1.5.17 BuildRequires: ncurses-devel BuildRequires: openssl-devel BuildRequires: perl +%if %{_vendor} == redhat && 0%{?fedora} <= 8 +BuildRequires: perl-ExtUtils-Embed +%endif BuildRequires: pkgconfig BuildRequires: termcap BuildRequires: unixODBC-devel @@ -893,7 +896,7 @@ fi %files python %defattr(-,freeswitch,daemon) %{prefix}/mod/mod_python*.so* -%attr(0644, root, bin) /usr/lib/python2.4/site-packages/freeswitch.py* +%attr(0644, root, bin) /usr/lib/python*/site-packages/freeswitch.py* %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/autoload_configs %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/python.conf.xml commit de49305ad501b4bba758679be7b5e80b68eba1cf Author: Travis Cross <tc@traviscross.com> Date: Tue Jan 18 04:23:45 2011 +0000 let vmain-key and operator-key be set empty The defaults for these keys are empty. This change allows them to be set empty in the XML config without error. diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 1799e5c..76870f7 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -311,6 +311,7 @@ static void destroy_profile(const char *profile_name, switch_bool_t block) /* Static buffer, 2 bytes */ static switch_xml_config_string_options_t config_dtmf = { NULL, 2, "[0-9#\\*]" }; +static switch_xml_config_string_options_t config_dtmf_optional = { NULL, 2, "[0-9#\\*]?" }; static switch_xml_config_string_options_t config_login_keys = { NULL, 16, "[0-9#\\*]*" }; static switch_xml_config_string_options_t config_file_ext = { NULL, 10, NULL }; static switch_xml_config_int_options_t config_int_0_10000 = { SWITCH_TRUE, 0, SWITCH_TRUE, 10000 }; @@ -520,8 +521,8 @@ vm_profile_t *profile_set_config(vm_profile_t *profile) SWITCH_CONFIG_SET_ITEM(profile->config[i++], "urgent-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &profile->urgent_key, "*", &config_dtmf, NULL, NULL); SWITCH_CONFIG_SET_ITEM(profile->config[i++], "operator-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, - &profile->operator_key, "", &config_dtmf, NULL, NULL); - SWITCH_CONFIG_SET_ITEM(profile->config[i++], "vmain-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &profile->vmain_key, "", &config_dtmf, NULL, NULL); + &profile->operator_key, "", &config_dtmf_optional, NULL, NULL); + SWITCH_CONFIG_SET_ITEM(profile->config[i++], "vmain-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &profile->vmain_key, "", &config_dtmf_optional, NULL, NULL); SWITCH_CONFIG_SET_ITEM(profile->config[i++], "vmain-extension", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &profile->vmain_ext, "", &profile->config_str_pool, NULL, NULL); SWITCH_CONFIG_SET_ITEM(profile->config[i++], "forward-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, commit 99cab144b5bc0d7b304a490f27bab6a28cead815 Merge: f3082c7 6fc0bb0 Author: Moises Silva <moy@sangoma.com> Date: Mon Jan 17 19:15:34 2011 -0500 Merge branch 'master' of git.sangoma.com:smg_freeswitch commit f3082c7d75926e77062bc83c0318979e89ad0857 Author: Moises Silva <moy@sangoma.com> Date: Mon Jan 17 19:15:02 2011 -0500 freetdm: enable ec only upon SIGEVENT_PROGRESS_MEDIA diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 6bfa375..c13fe76 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2417,8 +2417,6 @@ static ftdm_status_t _ftdm_channel_call_place_nl(const char *file, const char *f ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "null channel"); ftdm_assert_return(ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND), FTDM_FAIL, "Call place, but outbound flag not set\n"); - ftdm_set_echocancel_call_begin(ftdmchan); - if (!ftdmchan->span->outgoing_call) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "outgoing_call method not implemented in this span!\n"); status = FTDM_ENOSYS; @@ -5548,6 +5546,13 @@ FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t } break; + case FTDM_SIGEVENT_PROGRESS_MEDIA: + { + ftdm_log_chan_msg(sigmsg->channel, FTDM_LOG_DEBUG, "Enabling echo cancellation on progress media\n"); + ftdm_set_echocancel_call_begin(sigmsg->channel); + } + break; + case FTDM_SIGEVENT_STOP: if (!ftdm_test_flag(sigmsg->channel, FTDM_CHANNEL_CALL_STARTED)) { /* this happens for FXS devices which blindly send SIGEVENT_STOP, we should fix it there ... */ commit 6fc0bb088654437771b89e42c90f6196d14acad6 Merge: 6734fe7 585cb68 Author: Moises Silva <moy@sangoma.com> Date: Mon Jan 17 18:21:56 2011 -0500 Merge remote branch 'fsorig/master' commit 585cb68ad4ecf011380d35199bd4609a36b503cd Author: David Yat Sin <dyatsin@sangoma.com> Date: Mon Jan 17 17:21:24 2011 -0500 freetdm: support parameters: outbound-bc-user-layer1 and outbound-bc-transfer-cap diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c index 100631f..aad68e1 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c @@ -326,9 +326,11 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ ftdm_set_ton(val, &span->default_caller_data.rdnis.type); } else if (!strcasecmp(var, "outbound-rdnis-npi")) { ftdm_set_npi(val, &span->default_caller_data.rdnis.plan); - } else if (!strcasecmp(var, "outbound-bearer_cap")) { + } else if (!strcasecmp(var, "outbound-bearer_cap") || + !strcasecmp(var, "outbound-bc-transfer-cap")) { ftdm_set_bearer_capability(val, (uint8_t*)&span->default_caller_data.bearer_capability); - } else if (!strcasecmp(var, "outbound-bearer_layer1")) { + } else if (!strcasecmp(var, "outbound-bearer_layer1") || + !strcasecmp(var, "outbound-bc-user-layer1")) { ftdm_set_bearer_layer1(val, (uint8_t*)&span->default_caller_data.bearer_layer1); } else if (!strcasecmp(var, "channel-restart-on-link-up")) { parse_yesno(var, val, &signal_data->restart_opt); commit 6734fe711bbc69dc999f237a1865a3013a1d762b Author: Moises Silva <moy@sangoma.com> Date: Mon Jan 17 15:42:36 2011 -0500 freetdm: General fixes for alarm handling and added MFCR2 suspend support - Clean up ftdm_channel_set_sig_status locking and sanity checks - Set FTDM_CHANNEL_SUSPENDED when delivering FTDM_SIGEVENT_SIGSTATUS changed to SUSPENDED - Clear FTDM_CHANNEL_SUSPENDED when delivering FTDM_SIGEVENT_SIGSTATUS changed to UP - Update ftmod_r2 to honor local suspend requests when returning from alarm state diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 6cd2a22..6bfa375 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2529,26 +2529,34 @@ done: return status; } -FT_DECLARE(ftdm_status_t) ftdm_channel_set_sig_status(ftdm_channel_t *ftdmchan, ftdm_signaling_status_t sigstatus) +FT_DECLARE(ftdm_status_t) ftdm_channel_set_sig_status(ftdm_channel_t *fchan, ftdm_signaling_status_t sigstatus) { - ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "Null channel\n"); - ftdm_assert_return(ftdmchan->span != NULL, FTDM_FAIL, "Null span\n"); + ftdm_status_t res; - if (sigstatus == FTDM_SIG_STATE_DOWN) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "The user is not allowed to set the signaling status to DOWN, valid states are UP or SUSPENDED\n"); - return FTDM_FAIL; + ftdm_assert_return(fchan != NULL, FTDM_FAIL, "Null channel\n"); + ftdm_assert_return(fchan->span != NULL, FTDM_FAIL, "Null span\n"); + ftdm_assert_return(fchan->span->set_channel_sig_status != NULL, FTDM_ENOSYS, "Not implemented\n"); + + ftdm_channel_lock(fchan); + + if (ftdm_test_flag(fchan, FTDM_CHANNEL_IN_ALARM)) { + ftdm_log_chan_msg(fchan, FTDM_LOG_WARNING, "You can not set the signaling status of an alarmed channel\n"); + res = FTDM_EINVAL; + goto done; } - if (ftdmchan->span->set_channel_sig_status) { - ftdm_status_t res; - ftdm_channel_lock(ftdmchan); - res = ftdmchan->span->set_channel_sig_status(ftdmchan, sigstatus); - ftdm_channel_unlock(ftdmchan); - return res; - } else { - ftdm_log(FTDM_LOG_ERROR, "set_channel_sig_status method not implemented!\n"); - return FTDM_FAIL; + if (sigstatus == FTDM_SIG_STATE_DOWN) { + ftdm_log_chan_msg(fchan, FTDM_LOG_WARNING, "You can not set the signaling status to DOWN, valid states are UP or SUSPENDED\n"); + res = FTDM_EINVAL; + goto done; } + + res = fchan->span->set_channel_sig_status(fchan, sigstatus); +done: + + ftdm_channel_unlock(fchan); + + return res; } FT_DECLARE(ftdm_status_t) ftdm_channel_get_sig_status(ftdm_channel_t *ftdmchan, ftdm_signaling_status_t *sigstatus) @@ -5505,8 +5513,14 @@ FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t { if (sigmsg->ev_data.sigstatus.status == FTDM_SIG_STATE_UP) { ftdm_set_flag(sigmsg->channel, FTDM_CHANNEL_SIG_UP); + ftdm_clear_flag(sigmsg->channel, FTDM_CHANNEL_SUSPENDED); } else { ftdm_clear_flag(sigmsg->channel, FTDM_CHANNEL_SIG_UP); + if (sigmsg->ev_data.sigstatus.status == FTDM_SIG_STATE_SUSPENDED) { + ftdm_set_flag(sigmsg->channel, FTDM_CHANNEL_SUSPENDED); + } else { + ftdm_clear_flag(sigmsg->channel, FTDM_CHANNEL_SUSPENDED); + } } } break; diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 2c9c42d..4344177 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -70,6 +70,7 @@ typedef struct ftdm_r2_call_t { int answer_pending:1; int disconnect_rcvd:1; int protocol_error:1; + int localsuspend_on_alarm:1; ftdm_size_t dnis_index; ftdm_size_t ani_index; char logname[255]; @@ -499,8 +500,16 @@ static ftdm_status_t ftdm_r2_stop(ftdm_span_t *span) static FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(ftdm_r2_get_channel_sig_status) { + openr2_chan_t *r2chan = R2CALL(ftdmchan)->r2chan; + openr2_cas_signal_t rxcas, txcas; + + /* get the current rx and tx cas bits */ + openr2_chan_get_cas(r2chan, &rxcas, &txcas); + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) { *status = FTDM_SIG_STATE_UP; + } else if (rxcas == OR2_CAS_BLOCK || txcas == OR2_CAS_BLOCK) { + *status = FTDM_SIG_STATE_SUSPENDED; } else { *status = FTDM_SIG_STATE_DOWN; } @@ -561,6 +570,11 @@ static FIO_SPAN_GET_SIG_STATUS_FUNCTION(ftdm_r2_get_span_sig_status) for (citer = chaniter; citer; citer = ftdm_iterator_next(citer)) { ftdm_channel_t *fchan = ftdm_iterator_current(citer); ftdm_channel_lock(fchan); + if (ftdm_test_flag(fchan, FTDM_CHANNEL_IN_ALARM)) { + *status = FTDM_SIG_STATE_DOWN; + ftdm_channel_unlock(fchan); + break; + } if (ftdm_test_flag(fchan, FTDM_CHANNEL_SIG_UP)) { *status = FTDM_SIG_STATE_UP; ftdm_channel_unlock(fchan); @@ -825,8 +839,11 @@ static void ftdm_r2_on_hardware_alarm(openr2_chan_t *r2chan, int alarm) ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Alarm notification %d when in state %s (sigstatus = %d)\n", alarm, ftdm_channel_state2str(fchan->state), ftdm_test_flag(fchan, FTDM_CHANNEL_SIG_UP) ? 1 : 0); - if (alarm && ftdm_test_flag(fchan, FTDM_CHANNEL_SIG_UP)) { - ftdm_r2_set_chan_sig_status(fchan, FTDM_SIG_STATE_DOWN); + if (alarm) { + R2CALL(fchan)->localsuspend_on_alarm = ftdm_test_flag(fchan, FTDM_CHANNEL_SUSPENDED) ? 1 : 0; + if (ftdm_test_flag(fchan, FTDM_CHANNEL_SIG_UP) || ftdm_test_flag(fchan, FTDM_CHANNEL_SUSPENDED)) { + ftdm_r2_set_chan_sig_status(fchan, FTDM_SIG_STATE_DOWN); + } } } @@ -881,18 +898,31 @@ static void ftdm_r2_on_line_blocked(openr2_chan_t *r2chan) { ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Far end blocked in state %s\n", ftdm_channel_state2str(ftdmchan->state)); - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) { + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP) + || !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SUSPENDED)) { ftdm_r2_set_chan_sig_status(ftdmchan, FTDM_SIG_STATE_SUSPENDED); } } static void ftdm_r2_on_line_idle(openr2_chan_t *r2chan) { + openr2_cas_signal_t rxcas, txcas; ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); + + /* get the current rx and tx cas bits */ + openr2_chan_get_cas(r2chan, &rxcas, &txcas); ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Far end unblocked in state %s\n", ftdm_channel_state2str(ftdmchan->state)); - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) { + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP) + && txcas == OR2_CAS_IDLE) { + /* if txcas is not idle, it means we're still blocked as far as the user is concerned, do not send SIGEVENT UP, + * it will be done when the user set the line to IDLE (if the remote is still also IDLE) */ ftdm_r2_set_chan_sig_status(ftdmchan, FTDM_SIG_STATE_UP); + } else if (txcas == OR2_CAS_BLOCK && R2CALL(ftdmchan)->localsuspend_on_alarm) { + /* the user requested to block, we do not notify about state up until the user set the bits to IDLE, however + * if we're just getting back from alarmed condition, we notify about suspended again */ + ftdm_r2_set_chan_sig_status(ftdmchan, FTDM_SIG_STATE_SUSPENDED); } + R2CALL(ftdmchan)->localsuspend_on_alarm = 0; } static void ftdm_r2_write_log(openr2_log_level_t level, const char *file, const char *function, int line, const char *message) @@ -2018,9 +2048,6 @@ static void __inline__ block_channel(ftdm_channel_t *fchan, ftdm_stream_handle_t if (fchan->state != FTDM_CHANNEL_STATE_DOWN) { stream->write_function(stream, "cannot block channel %d:%d because has a call in progress\n", fchan->span_id, fchan->chan_id); - } else if (ftdm_test_flag(fchan, FTDM_CHANNEL_SUSPENDED)) { - stream->write_function(stream, "cannot block channel %d:%d because is already blocked\n", - fchan->span_id, fchan->chan_id); } else { if (!openr2_chan_set_blocked(r2chan)) { ftdm_set_flag(fchan, FTDM_CHANNEL_SUSPENDED); @@ -2038,17 +2065,12 @@ static void __inline__ unblock_channel(ftdm_channel_t *fchan, ftdm_stream_handle { openr2_chan_t *r2chan = R2CALL(fchan)->r2chan; ftdm_mutex_lock(fchan->mutex); - if (ftdm_test_flag(fchan, FTDM_CHANNEL_SUSPENDED)) { - if (!openr2_chan_set_idle(r2chan)) { - ftdm_clear_flag(fchan, FTDM_CHANNEL_SUSPENDED); - stream->write_function(stream, "unblocked channel %d:%d\n", - fchan->span_id, fchan->chan_id); - } else { - stream->write_function(stream, "failed to unblock channel %d:%d\n", - fchan->span_id, fchan->chan_id); - } + if (!openr2_chan_set_idle(r2chan)) { + ftdm_clear_flag(fchan, FTDM_CHANNEL_SUSPENDED); + stream->write_function(stream, "unblocked channel %d:%d\n", + fchan->span_id, fchan->chan_id); } else { - stream->write_function(stream, "cannot unblock channel %d:%d because is not blocked\n", + stream->write_function(stream, "failed to unblock channel %d:%d\n", fchan->span_id, fchan->chan_id); } ftdm_mutex_unlock(fchan->mutex); diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index c73f0c7..1f2ad84 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -1257,6 +1257,7 @@ static __inline__ ftdm_status_t wanpipe_channel_process_event(ftdm_channel_t *fc switch(tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_type) { case WP_API_EVENT_LINK_STATUS: { +#if 0 switch(tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_link_status) { case WP_TDMAPI_EVENT_LINK_STATUS_CONNECTED: *event_id = FTDM_OOB_ALARM_CLEAR; @@ -1265,6 +1266,11 @@ static __inline__ ftdm_status_t wanpipe_channel_process_event(ftdm_channel_t *fc *event_id = FTDM_OOB_ALARM_TRAP; break; }; +#else + /* The WP_API_EVENT_ALARM event should be used to clear alarms */ + ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Ignoring wanpipe link status event\n", ftdm_oob_event2str(*event_id)); + *event_id = FTDM_OOB_NOOP; +#endif } break; @@ -1353,8 +1359,13 @@ static __inline__ ftdm_status_t wanpipe_channel_process_event(ftdm_channel_t *fc break; case WP_API_EVENT_ALARM: { - ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Got wanpipe alarms %d\n", tdm_api->wp_tdm_cmd.event.wp_api_event_alarm); - *event_id = FTDM_OOB_ALARM_TRAP; + if (tdm_api->wp_tdm_cmd.event.wp_api_event_alarm) { + ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Got Wanpipe alarms %d\n", tdm_api->wp_tdm_cmd.event.wp_api_event_alarm); + *event_id = FTDM_OOB_ALARM_TRAP; + } else { + ftdm_log_chan_msg(fchan, FTDM_LOG_DEBUG, "Wanpipe alarms cleared\n"); + *event_id = FTDM_OOB_ALARM_CLEAR; + } } break; case WP_API_EVENT_POLARITY_REVERSE: commit 018a3800b4cec46e0cebb6707497bac8045d654b Author: Michael Jerris <mike@jerris.com> Date: Mon Jan 17 13:10:53 2011 -0600 fix session timer failure when freeswitch is generating the sdp and there are enough dynamic codecs enabled to conflict with the 2833 pt (4 by default) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 8a8af67..dfd6a76 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -377,6 +377,13 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32 sofia_glue_check_dtmf_type(tech_pvt); + if (sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) || + ((val = switch_channel_get_variable(tech_pvt->channel, "supress_cng")) && switch_true(val)) || + ((val = switch_channel_get_variable(tech_pvt->channel, "suppress_cng")) && switch_true(val))) { + use_cng = 0; + tech_pvt->cng_pt = 0; + } + if (!tech_pvt->payload_space) { int i; @@ -388,6 +395,13 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32 tech_pvt->ianacodes[i] = imp->ianacode; if (tech_pvt->ianacodes[i] > 64) { + if (tech_pvt->dtmf_type == DTMF_2833 && tech_pvt->te > 95 && tech_pvt->te == tech_pvt->payload_space) { + tech_pvt->payload_space++; + } + if (!sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) && + tech_pvt->cng_pt && use_cng && tech_pvt->cng_pt == tech_pvt->payload_space) { + tech_pvt->payload_space++; + } tech_pvt->ianacodes[i] = tech_pvt->payload_space++; } } @@ -401,13 +415,6 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32 verbose_sdp = 1; } - if (sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) || - ((val = switch_channel_get_variable(tech_pvt->channel, "supress_cng")) && switch_true(val)) || - ((val = switch_channel_get_variable(tech_pvt->channel, "suppress_cng")) && switch_true(val))) { - use_cng = 0; - tech_pvt->cng_pt = 0; - } - if (!force && !ip && !sr && (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) || switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA))) { return; commit a020724030c651aed8e427511b8dc79c4ae7a661 Author: Moises Silva <moy@sangoma.com> Date: Mon Jan 17 12:44:52 2011 -0500 freetdm: add deprecate warning to get last error stuff that nobody sets anyways diff --git a/libs/freetdm/TODO b/libs/freetdm/TODO index 45b134b..6b8ef8f 100644 --- a/libs/freetdm/TODO +++ b/libs/freetdm/TODO @@ -5,5 +5,9 @@ then ftdm_event_t would be renamed to ftdm_oob_event_t and the enum_id renamed to type, then ftdm_span_next_event() will only return OOB events -- query span hw status (connected/disconnected) on startup +- Deprecate last_error members. + It requires a lot of discipline to set the last_error string for every failure. + It does not add much value to the user either, most of the errors are criptic and + cannot be shown to end users, we already provide extensive logging for problem + troubleshooting. diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 0b9c619..2666a26 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -1064,6 +1064,9 @@ FT_DECLARE(ftdm_codec_t) ftdm_channel_get_codec(const ftdm_channel_t *ftdmchan); /*! * \brief Get the last error string for the channel * + * \deprecated This API will disappear in the future and not every + * FreeTDM API set the last error value + * * \param ftdmchan The channel to get the error from * * \retval The error string (not thread-safe, the string is per channel, not per thread) @@ -1136,6 +1139,9 @@ FT_DECLARE(ftdm_status_t) ftdm_span_find(uint32_t id, ftdm_span_t **span); /*! * \brief Get the last error string for the given span * + * \deprecated This API will disappear in the future and not every + * FreeTDM API set the last error value + * * \param span The span to get the last error from * * \retval character string for the last error commit cc06fdb5fae26a01914cbbeb8ae306bd17ab01b2 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Jan 17 10:41:01 2011 -0600 FS-2992 diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index d17105a..d156c70 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -1705,6 +1705,16 @@ static void *SWITCH_THREAD_FUNC early_thread_run(switch_thread_t *thread, void * switch_channel_get_state(_peer) == CS_RESET || \ !switch_channel_test_flag(_peer, CF_ORIGINATING))) +static void wait_for_cause(switch_channel_t *channel) +{ + int sanity = 5; + + while (--sanity > 0 && peer_eligible(channel) && switch_channel_get_cause(channel) == SWITCH_CAUSE_NONE) { + switch_yield(10000); + } +} + + SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *session, switch_core_session_t **bleg, @@ -3271,7 +3281,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess if (i != oglobals.idx) { holding = NULL; - + if (oglobals.idx == IDX_TIMEOUT || to) { reason = SWITCH_CAUSE_NO_ANSWER; } else { @@ -3280,6 +3290,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } else { if (and_argc > 1) { reason = SWITCH_CAUSE_LOSE_RACE; + } else if (!switch_channel_ready(originate_status[i].peer_channel)) { + wait_for_cause(originate_status[i].peer_channel); + if (switch_channel_down(originate_status[i].peer_channel)) { + reason = switch_channel_get_cause(originate_status[i].peer_channel); + } } else { reason = SWITCH_CAUSE_NO_ANSWER; } @@ -3385,6 +3400,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } if (peer_channel) { + wait_for_cause(peer_channel); *cause = switch_channel_get_cause(peer_channel); } else { for (i = 0; i < and_argc; i++) { @@ -3435,6 +3451,19 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess *cause = switch_channel_get_cause(caller_channel); } else { *cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; + for (i = 0; i < and_argc; i++) { + if (!peer_eligible(originate_status[i].peer_channel)) { + continue; + } + + wait_for_cause(originate_status[i].peer_channel); + + if (switch_channel_down(originate_status[i].peer_channel)) { + *cause = switch_channel_get_cause(originate_status[i].peer_channel); + break; + } + + } } } @@ -3529,7 +3558,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess continue; } pchannel = switch_core_session_get_channel(originate_status[i].peer_session); - + wait_for_cause(pchannel); if (switch_channel_down(pchannel)) { cause_str = switch_channel_cause2str(switch_channel_get_cause(pchannel)); if (switch_stristr(cause_str, fail_on_single_reject_var)) { commit 7eceff48a2b8fc9590816748c63f9563e7929488 Author: Travis Cross <tc@traviscross.com> Date: Sun Jan 16 22:33:15 2011 +0000 update sofia usage string for flush_inbound_reg diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 8f01290..eb5e2ad 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3627,7 +3627,7 @@ SWITCH_STANDARD_API(sofia_function) "--------------------------------------------------------------------------------\n" "sofia help\n" "sofia profile <profile_name> [[start|stop|restart|rescan]|" - "flush_inbound_reg [<call_id>] [reboot]|" + "flush_inbound_reg [<call_id>|<[user]@domain>] [reboot]|" "[register|unregister] [<gateway name>|all]|" "killgw <gateway name>|" "[stun-auto-disable|stun-enabled] [true|false]]|" commit 68bf642c1134c63e89c204bd953c30381de8488d Author: Travis Cross <tc@traviscross.com> Date: Sun Jan 16 22:27:56 2011 +0000 fix sofia flush_inbound_reg to work when @domain is given Prior to this change, calling flush_inbound_reg with @domain will reboot all matching devices (if reboot is specified), but will not actually flush the matching registrations. diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 344e517..f644ff7 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -606,16 +606,16 @@ void sofia_reg_expire_call_id(sofia_profile_t *profile, const char *call_id, int sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,rpid,expires" ",user_agent,server_user,server_host,profile_name,network_ip" ",%d from sip_registrations where call_id='%q' %s", reboot, call_id, sqlextra); - switch_safe_free(sqlextra); switch_mutex_lock(profile->ireg_mutex); sofia_glue_execute_sql_callback(profile, NULL, sql, sofia_reg_del_callback, profile); switch_mutex_unlock(profile->ireg_mutex); switch_safe_free(sql); - sql = switch_mprintf("delete from sip_registrations where call_id='%q' or (sip_user='%q' and sip_host='%q')", call_id, user, host); + sql = switch_mprintf("delete from sip_registrations where call_id='%q' %s", call_id, sqlextra); sofia_glue_execute_sql_now(profile, &sql, SWITCH_FALSE); + switch_safe_free(sqlextra); switch_safe_free(sql); switch_safe_free(dup); commit e6a25e85783cf7bfc21f45c8fb6802bd2dd40546 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Jan 14 18:42:38 2011 -0600 FS-2984 diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index cabc366..8a8af67 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -4040,7 +4040,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s sdp_attribute_t *attr; int first = 0, last = 0; int ptime = 0, dptime = 0, maxptime = 0, dmaxptime = 0; - int sendonly = 0; + int sendonly = 0, recvonly = 0; int greedy = 0, x = 0, skip = 0, mine = 0; switch_channel_t *channel = switch_core_session_get_channel(session); const char *val; @@ -4108,7 +4108,11 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s if (!strcasecmp(attr->a_name, "sendonly") || !strcasecmp(attr->a_name, "inactive")) { sendonly = 1; + switch_channel_set_variable(tech_pvt->channel, "media_audio_mode", "recvonly"); } else if (!strcasecmp(attr->a_name, "recvonly")) { + switch_channel_set_variable(tech_pvt->channel, "media_audio_mode", "sendonly"); + recvonly = 1; + if (switch_rtp_ready(tech_pvt->rtp_session)) { switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, 0); tech_pvt->max_missed_hold_packets = 0; @@ -4126,6 +4130,11 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s } } + if (sendonly != 1 && recvonly != 1) { + switch_channel_set_variable(tech_pvt->channel, "media_audio_mode", NULL); + } + + if (sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_HOLD) || ((val = switch_channel_get_variable(tech_pvt->channel, "sip_disable_hold")) && switch_true(val))) { sendonly = 0; commit 245b88578cd3d7065bd96641fe09acc0c93e3e72 Merge: a41974e 029d68c Author: Moises Silva <moy@sangoma.com> Date: Fri Jan 14 18:55:55 2011 -0500 Merge branch 'master' of git.freeswitch.org:freeswitch commit a41974e580d7d73b7e22e9f927a75e84d3cdafd0 Merge: f06298f ecfa33e Author: Moises Silva <moy@sangoma.com> Date: Fri Jan 14 18:46:09 2011 -0500 Merge remote branch 'fsorig/master' commit f06298f163fd29e3a27f3088d77da645b11bcf6f Merge: 04d5652 4ee4c67 Author: Moises Silva <moy@sangoma.com> Date: Fri Jan 14 18:45:03 2011 -0500 Merge branch 'master' of git.sangoma.com:smg_freeswitch commit 04d565281938ca24ffe5c82cda177624f221cd30 Author: Moises Silva <moy@sangoma.com> Date: Fri Jan 14 18:43:42 2011 -0500 freetdm: fix incorrect alarm reporting due to Wanpipe bug proper alarm handling for R2 calls diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 1beb6cd..970cb5b 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -3763,9 +3763,7 @@ SWITCH_STANDARD_API(ft_function) flags = "call swap"; } fchan = ftdm_span_get_channel(SPAN_CONFIG[j].span, 1); - if (fchan) { - ftdm_channel_get_alarms(fchan, &alarmbits); - } + ftdm_channel_get_alarms(fchan, &alarmbits); if ((FTDM_SUCCESS == ftdm_span_get_sig_status(SPAN_CONFIG[j].span, &sigstatus))) { stream->write_function(stream, diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 4210910..8afe6e8 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -682,42 +682,53 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_get_alarms(ftdm_channel_t *ftdmchan, ftdm { ftdm_status_t status = FTDM_FAIL; - ftdm_assert_return(alarmbits != NULL, FTDM_FAIL, "null argument\n"); + ftdm_assert_return(alarmbits != NULL, FTDM_EINVAL, "null alarmbits argument\n"); + ftdm_assert_return(ftdmchan != NULL, FTDM_EINVAL, "null channel argument\n"); + ftdm_assert_return(ftdmchan->span != NULL, FTDM_EINVAL, "null span\n"); + ftdm_assert_return(ftdmchan->span->fio != NULL, FTDM_EINVAL, "null io\n"); *alarmbits = FTDM_ALARM_NONE; + if (!ftdmchan->span->fio->get_alarms) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "No get_alarms interface for this channel\n"); + return FTDM_ENOSYS; + } + + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_CONFIGURED)) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Cannot get alarms from an unconfigured channel\n"); + return FTDM_EINVAL; + } + ftdm_channel_lock(ftdmchan); - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_CONFIGURED)) { - if (ftdmchan->span->fio->get_alarms) { - if ((status = ftdmchan->span->fio->get_alarms(ftdmchan)) == FTDM_SUCCESS) { - *ftdmchan->last_error = '\0'; - *alarmbits = ftdmchan->alarm_flags; - if (ftdm_test_alarm_flag(ftdmchan, FTDM_ALARM_RED)) { - snprintf(ftdmchan->last_error + strlen(ftdmchan->last_error), sizeof(ftdmchan->last_error) - strlen(ftdmchan->last_error), "RED/"); - } - if (ftdm_test_alarm_flag(ftdmchan, FTDM_ALARM_YELLOW)) { - snprintf(ftdmchan->last_error + strlen(ftdmchan->last_error), sizeof(ftdmchan->last_error) - strlen(ftdmchan->last_error), "YELLOW/"); - } - if (ftdm_test_alarm_flag(ftdmchan, FTDM_ALARM_RAI)) { - snprintf(ftdmchan->last_error + strlen(ftdmchan->last_error), sizeof(ftdmchan->last_error) - strlen(ftdmchan->last_error), "RAI/"); - } - if (ftdm_test_alarm_flag(ftdmchan, FTDM_ALARM_BLUE)) { - snprintf(ftdmchan->last_error + strlen(ftdmchan->last_error), sizeof(ftdmchan->last_error) - strlen(ftdmchan->last_error), "BLUE/"); - } - if (ftdm_test_alarm_flag(ftdmchan, FTDM_ALARM_AIS)) { - snprintf(ftdmchan->last_error + strlen(ftdmchan->last_error), sizeof(ftdmchan->last_error) - strlen(ftdmchan->last_error), "AIS/"); - } - if (ftdm_test_alarm_flag(ftdmchan, FTDM_ALARM_GENERAL)) { - snprintf(ftdmchan->last_error + strlen(ftdmchan->last_error), sizeof(ftdmchan->last_error) - strlen(ftdmchan->last_error), "GENERAL"); - } - *(ftdmchan->last_error + strlen(ftdmchan->last_error) - 1) = '\0'; + if ((status = ftdmchan->span->fio->get_alarms(ftdmchan)) != FTDM_SUCCESS) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to get alarms from channel\n"); + goto done; + } - } - } else { - status = FTDM_NOTIMPL; - } + *ftdmchan->last_error = '\0'; + *alarmbits = ftdmchan->alarm_flags; + if (ftdm_test_alarm_flag(ftdmchan, FTDM_ALARM_RED)) { + snprintf(ftdmchan->last_error + strlen(ftdmchan->last_error), sizeof(ftdmchan->last_error) - strlen(ftdmchan->last_error), "RED/"); + } + if (ftdm_test_alarm_flag(ftdmchan, FTDM_ALARM_YELLOW)) { + snprintf(ftdmchan->last_error + strlen(ftdmchan->last_error), sizeof(ftdmchan->last_error) - strlen(ftdmchan->last_error), "YELLOW/"); } + if (ftdm_test_alarm_flag(ftdmchan, FTDM_ALARM_RAI)) { + snprintf(ftdmchan->last_error + strlen(ftdmchan->last_error), sizeof(ftdmchan->last_error) - strlen(ftdmchan->last_error), "RAI/"); + } + if (ftdm_test_alarm_flag(ftdmchan, FTDM_ALARM_BLUE)) { + snprintf(ftdmchan->last_error + strlen(ftdmchan->last_error), sizeof(ftdmchan->last_error) - strlen(ftdmchan->last_error), "BLUE/"); + } + if (ftdm_test_alarm_flag(ftdmchan, FTDM_ALARM_AIS)) { + snprintf(ftdmchan->last_error + strlen(ftdmchan->last_error), sizeof(ftdmchan->last_error) - strlen(ftdmchan->last_error), "AIS/"); + } + if (ftdm_test_alarm_flag(ftdmchan, FTDM_ALARM_GENERAL)) { + snprintf(ftdmchan->last_error + strlen(ftdmchan->last_error), sizeof(ftdmchan->last_error) - strlen(ftdmchan->last_error), "GENERAL"); + } + *(ftdmchan->last_error + strlen(ftdmchan->last_error) - 1) = '\0'; + +done: ftdm_channel_unlock(ftdmchan); diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 68754d7..2c9c42d 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -820,8 +820,14 @@ static void ftdm_r2_on_call_read(openr2_chan_t *r2chan, const unsigned char *buf static void ftdm_r2_on_hardware_alarm(openr2_chan_t *r2chan, int alarm) { - ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Alarm notification: %d\n", alarm); + ftdm_channel_t *fchan = openr2_chan_get_client_data(r2chan); + + ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Alarm notification %d when in state %s (sigstatus = %d)\n", + alarm, ftdm_channel_state2str(fchan->state), ftdm_test_flag(fchan, FTDM_CHANNEL_SIG_UP) ? 1 : 0); + + if (alarm && ftdm_test_flag(fchan, FTDM_CHANNEL_SIG_UP)) { + ftdm_r2_set_chan_sig_status(fchan, FTDM_SIG_STATE_DOWN); + } } static void ftdm_r2_on_os_error(openr2_chan_t *r2chan, int errorcode) @@ -875,14 +881,18 @@ static void ftdm_r2_on_line_blocked(openr2_chan_t *r2chan) { ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Far end blocked in state %s\n", ftdm_channel_state2str(ftdmchan->state)); - ftdm_r2_set_chan_sig_status(ftdmchan, FTDM_SIG_STATE_SUSPENDED); + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) { + ftdm_r2_set_chan_sig_status(ftdmchan, FTDM_SIG_STATE_SUSPENDED); + } } static void ftdm_r2_on_line_idle(openr2_chan_t *r2chan) { ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Far end unblocked in state %s\n", ftdm_channel_state2str(ftdmchan->state)); - ftdm_r2_set_chan_sig_status(ftdmchan, FTDM_SIG_STATE_UP); + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) { + ftdm_r2_set_chan_sig_status(ftdmchan, FTDM_SIG_STATE_UP); + } } static void ftdm_r2_write_log(openr2_log_level_t level, const char *file, const char *function, int line, const char *message) @@ -914,7 +924,7 @@ static void ftdm_r2_write_log(openr2_log_level_t level, const char *file, const static void ftdm_r2_on_context_log(openr2_context_t *r2context, const char *file, const char *function, unsigned int line, openr2_log_level_t level, const char *fmt, va_list ap) { -#define CONTEXT_TAG "Context -" +#define CONTEXT_TAG "Context - " char logmsg[256]; char completemsg[sizeof(logmsg) + sizeof(CONTEXT_TAG) - 1]; vsnprintf(logmsg, sizeof(logmsg), fmt, ap); @@ -1191,6 +1201,14 @@ static int ftdm_r2_io_get_oob_event(openr2_chan_t *r2chan, openr2_oob_event_t *e return 0; } +static int ftdm_r2_io_get_alarm_state(openr2_chan_t *r2chan, int *alarm) +{ + ftdm_channel_t *fchan = openr2_chan_get_fd(r2chan); + ftdm_assert_return(alarm, -1, "Alarm pointer is null\n"); + *alarm = ftdm_test_flag(fchan, FTDM_CHANNEL_IN_ALARM) ? 1 : 0; + return 0; +} + static openr2_io_interface_t ftdm_r2_io_iface = { /* .open */ ftdm_r2_io_open, /* never called */ /* .close */ ftdm_r2_io_close, /* never called */ @@ -1201,7 +1219,8 @@ static openr2_io_interface_t ftdm_r2_io_iface = { /* .read */ ftdm_r2_io_read, /* .setup */ ftdm_r2_io_setup, /* never called */ /* .wait */ ftdm_r2_io_wait, - /* .get_oob_event */ ftdm_r2_io_get_oob_event /* never called */ + /* .get_oob_event */ ftdm_r2_io_get_oob_event, + /* .get_alarm_state */ ftdm_r2_io_get_alarm_state }; /* resolve a loglevel string, such as "debug,notice,warning", to an openr2 log level integer */ diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index caabc93..c73f0c7 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -1179,7 +1179,7 @@ static FIO_GET_ALARMS_FUNCTION(wanpipe_get_alarms) unsigned int alarms = 0; int err; - memset(&tdm_api,0,sizeof(tdm_api)); + memset(&tdm_api, 0, sizeof(tdm_api)); #ifdef LIBSANGOMA_VERSION if ((err = sangoma_tdm_get_fe_alarms(ftdmchan->sockfd, &tdm_api, &alarms))) { @@ -1225,9 +1225,19 @@ static FIO_GET_ALARMS_FUNCTION(wanpipe_get_alarms) alarms &= ~WAN_TE_BIT_ALARM_RAI; } + if (!ftdmchan->alarm_flags) { + if (FTDM_IS_DIGITAL_CHANNEL(ftdmchan)) { + ftdm_channel_hw_link_status_t sangoma_status = 0; + /* there is a bug in wanpipe where alarms were not properly set when they should be + * on at application startup, until that is fixed we check the link status here too */ + ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_LINK_STATUS, &sangoma_status); + ftdmchan->alarm_flags = sangoma_status == FTDM_HW_LINK_DISCONNECTED ? 1 : 0; + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Link status is %d\n", sangoma_status); + } + } + if (alarms) { - /* FIXME: investigate what else does the driver report */ - ftdm_log(FTDM_LOG_DEBUG, "Unmapped wanpipe alarms: %d\n", alarms); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Unmapped wanpipe alarms: %d\n", alarms); } return FTDM_SUCCESS; diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 121aa18..dc26a5d 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -168,10 +168,17 @@ typedef enum { FTDM_STR2ENUM_P(ftdm_str2ftdm_chan_type, ftdm_chan_type2str, ftdm_chan_type_t) /*! \brief Test if a channel is a voice channel */ -#define FTDM_IS_VOICE_CHANNEL(ftdm_chan) ((ftdm_chan)->type != FTDM_CHAN_TYPE_DQ921 && (ftdm_chan)->type != FTDM_CHAN_TYPE_DQ931) +#define FTDM_IS_VOICE_CHANNEL(fchan) ((fchan)->type != FTDM_CHAN_TYPE_DQ921 && (fchan)->type != FTDM_CHAN_TYPE_DQ931) /*! \brief Test if a channel is a D-channel */ -#define FTDM_IS_DCHAN(ftdm_chan) ((ftdm_chan)->type == FTDM_CHAN_TYPE_DQ921 || (ftdm_chan)->type == FTDM_CHAN_TYPE_DQ931) +#define FTDM_IS_DCHAN(ftdm_chan) ((fchan)->type == FTDM_CHAN_TYPE_DQ921 || (fchan)->type == FTDM_CHAN_TYPE_DQ931) + +/*! \brief Test if a channel is digital channel */ +#define FTDM_IS_DIGITAL_CHANNEL(fchan) ((fchan)->span->trunk_type == FTDM_TRUNK_E1 || \ + (fchan)->span->trunk_type == FTDM_TRUNK_T1 || \ + (fchan)->span->trunk_type == FTDM_TRUNK_J1 || \ + (fchan)->span->trunk_type == FTDM_TRUNK_BRI || \ + (fchan)->span->trunk_type == FTDM_TRUNK_BRI_PTMP) /*! \brief Logging function prototype to be used for all FreeTDM logs * you should use ftdm_global_set_logger to set your own logger commit 029d68ce47c5990d809716b88c65e924259e1f68 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Jan 14 17:42:31 2011 -0600 disable media timeout when encountering a recvonly stream diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index bf7c1aa..cabc366 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -70,7 +70,7 @@ void sofia_glue_set_image_sdp(private_object_t *tech_pvt, switch_t38_options_t * port = tech_pvt->proxy_sdp_audio_port; } } - + if (!port) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "%s NO PORT!\n", switch_channel_get_name(tech_pvt->channel)); return; @@ -4108,6 +4108,15 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s if (!strcasecmp(attr->a_name, "sendonly") || !strcasecmp(attr->a_name, "inactive")) { sendonly = 1; + } else if (!strcasecmp(attr->a_name, "recvonly")) { + if (switch_rtp_ready(tech_pvt->rtp_session)) { + switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, 0); + tech_pvt->max_missed_hold_packets = 0; + tech_pvt->max_missed_packets = 0; + } else { + switch_channel_set_variable(tech_pvt->channel, "rtp_timeout_sec", "0"); + switch_channel_set_variable(tech_pvt->channel, "rtp_hold_timeout_sec", "0"); + } } else if (sendonly < 2 && !strcasecmp(attr->a_name, "sendrecv")) { sendonly = 0; } else if (!strcasecmp(attr->a_name, "ptime")) { commit ecfa33e9e4b3b10b0535dc7fd52bd69be43269fb Merge: 7311029 a4df823 Author: David Yat Sin <dyatsin@sangoma.com> Date: Fri Jan 14 16:10:25 2011 -0500 Merge branch 'master' of git.freeswitch.org:freeswitch commit 73110296854d38bbb1bce0f016668a04b3b7f871 Author: David Yat Sin <dyatsin@sangoma.com> Date: Fri Jan 14 16:10:13 2011 -0500 freetdm - adjusted loggign on channel_call_indicate diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 4210910..e82ef9d 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2283,13 +2283,13 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_indicate(const char *file, const ch ftdm_assert_return(ftdmchan, FTDM_FAIL, "Null channel\n"); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Indicating %s in state %s\n", + ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_DEBUG, "Indicating %s in state %s\n", ftdm_channel_indication2str(indication), ftdm_channel_state2str(ftdmchan->state)); ftdm_channel_lock(ftdmchan); if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_IND_ACK_PENDING)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Cannot indicate %s in channel with indication %s still pending in state %s\n", + ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_WARNING, "Cannot indicate %s in channel with indication %s still pending in state %s\n", ftdm_channel_indication2str(indication), ftdm_channel_indication2str(ftdmchan->indication), ftdm_channel_state2str(ftdmchan->state)); @@ -2303,14 +2303,14 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_indicate(const char *file, const ch } if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Cannot indicate %s in outgoing channel in state %s\n", + ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_WARNING, "Cannot indicate %s in outgoing channel in state %s\n", ftdm_channel_indication2str(indication), ftdm_channel_state2str(ftdmchan->state)); status = FTDM_EINVAL; goto done; } if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Ignoring indication %s because the call is in %s state\n", + ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_DEBUG, "Ignoring indication %s because the call is in %s state\n", ftdm_channel_indication2str(indication), ftdm_channel_state2str(ftdmchan->state)); status = FTDM_ECANCELED; goto done; @@ -2347,7 +2347,7 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_indicate(const char *file, const ch /* set state unlocks the channel so we need to re-confirm that the channel hasn't gone to hell */ if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring progress media because the call is terminating\n"); + ftdm_log_chan_ex_msg(ftdmchan, file, func, line, FTDM_LOG_LEVEL_DEBUG, "Ignoring progress media because the call is terminating\n"); goto done; } } diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index a5862e5..4fd8ec6 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -664,7 +664,11 @@ FT_DECLARE(void) ftdm_channel_clear_detected_tones(ftdm_channel_t *ftdmchan); } #define ftdm_log_chan_ex(fchan, file, func, line, level, format, ...) ftdm_log(file, func, line, level, "[s%dc%d][%d:%d] " format, fchan->span_id, fchan->chan_id, fchan->physical_span_id, fchan->physical_chan_id, __VA_ARGS__) + +#define ftdm_log_chan_ex_msg(fchan, file, func, line, level, msg) ftdm_log(file, func, line, level, "[s%dc%d][%d:%d] " msg, fchan->span_id, fchan->chan_id, fchan->physical_span_id, fchan->physical_chan_id) + #define ftdm_log_chan(fchan, level, format, ...) ftdm_log(level, "[s%dc%d][%d:%d] " format, fchan->span_id, fchan->chan_id, fchan->physical_span_id, fchan->physical_chan_id, __VA_ARGS__) + #define ftdm_log_chan_msg(fchan, level, msg) ftdm_log(level, "[s%dc%d][%d:%d] " msg, fchan->span_id, fchan->chan_id, fchan->physical_span_id, fchan->physical_chan_id) #define ftdm_log_chan_throttle(fchan, level, format, ...) ftdm_log_throttle(level, "[s%dc%d][%d:%d] " format, fchan->span_id, fchan->chan_id, fchan->physical_span_id, fchan->physical_chan_id, __VA_ARGS__) commit a4df823c3df6fd456b2c75d0945ffc60c8259239 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Jan 14 13:58:18 2011 -0600 add send-presence-on-register (true|false|first-only) param to sofia and api command sofia global debug [presence|sla|none] diff --git a/conf/sip_profiles/internal.xml b/conf/sip_profiles/internal.xml index d09ca79..426264a 100644 --- a/conf/sip_profiles/internal.xml +++ b/conf/sip_profiles/internal.xml @@ -114,6 +114,8 @@ <!-- 'true' means every time 'first-only' means on the first register --> <!--<param name="send-message-query-on-register" value="true"/>--> + <!-- 'true' means every time 'first-only' means on the first register --> + <!--<param name="send-presence-on-register" value="first-only"/> --> <!-- Caller-ID type (choose one, can be overridden by inbound call type and/or sip_cid_type channel variable --> commit 7b01cbbca406aa4d11fd12de56d3310a16033b1f Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Jan 14 13:57:58 2011 -0600 add send-presence-on-register (true|false|first-only) param to sofia and api command sofia global debug [presence|sla|none] diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 85b233d..8f01290 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3695,11 +3695,39 @@ SWITCH_STANDARD_API(sofia_function) int wdon = -1; if (argc > 1) { + if (!strcasecmp(argv[1], "debug")) { + + if (argc > 2) { + if (strstr(argv[2], "presence")) { + mod_sofia_globals.debug_presence = 1; + stream->write_function(stream, "+OK Debugging presence\n"); + } + + if (strstr(argv[2], "sla")) { + mod_sofia_globals.debug_sla = 1; + stream->write_function(stream, "+OK Debugging sla\n"); + } + + if (strstr(argv[2], "none")) { + stream->write_function(stream, "+OK Debugging nothing\n"); + mod_sofia_globals.debug_presence = 0; + mod_sofia_globals.debug_sla = 0; + } + } + + stream->write_function(stream, "+OK Debugging summary: presence: %s sla: %s\n", + mod_sofia_globals.debug_presence ? "on" : "off", + mod_sofia_globals.debug_sla ? "on" : "off"); + + goto done; + } + if (!strcasecmp(argv[1], "siptrace")) { if (argc > 2) { ston = switch_true(argv[2]); } } + if (!strcasecmp(argv[1], "watchdog")) { if (argc > 2) { wdon = switch_true(argv[2]); @@ -3714,7 +3742,7 @@ SWITCH_STANDARD_API(sofia_function) sofia_glue_global_watchdog(wdon); stream->write_function(stream, "+OK Global watchdog %s", wdon ? "on" : "off"); } else { - stream->write_function(stream, "-ERR Usage: siptrace <on|off>|watchdog <on|off>"); + stream->write_function(stream, "-ERR Usage: siptrace <on|off>|watchdog <on|off>|debug <sla|presence|none"); } goto done; @@ -4838,6 +4866,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) switch_console_set_complete("add sofia global siptrace ::[on:off"); switch_console_set_complete("add sofia global watchdog ::[on:off"); + switch_console_set_complete("add sofia global debug ::[presence:sla:none"); + + switch_console_set_complete("add sofia profile"); switch_console_set_complete("add sofia profile restart all"); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index b6ce97d..12148c0 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -225,6 +225,8 @@ typedef enum { PFLAG_DEL_SUBS_ON_REG, PFLAG_IGNORE_183NOSDP, PFLAG_PRESENCE_PROBE_ON_REGISTER, + PFLAG_PRESENCE_ON_REGISTER, + PFLAG_PRESENCE_ON_FIRST_REGISTER, PFLAG_NO_CONNECTION_REUSE, /* No new flags below this line */ PFLAG_MAX diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 1d8d6a9..643b3dd 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2419,6 +2419,17 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) } else { sofia_clear_pflag(profile, PFLAG_PRESENCE_PROBE_ON_REGISTER); } + + } else if (!strcasecmp(var, "send-presence-on-register")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_PRESENCE_ON_REGISTER); + } else if (!strcasecmp(val, "first-only")) { + sofia_clear_pflag(profile, PFLAG_PRESENCE_ON_REGISTER); + sofia_set_pflag(profile, PFLAG_PRESENCE_ON_FIRST_REGISTER); + } else { + sofia_clear_pflag(profile, PFLAG_PRESENCE_ON_REGISTER); + sofia_clear_pflag(profile, PFLAG_PRESENCE_ON_FIRST_REGISTER); + } } else if (!strcasecmp(var, "cid-in-1xx")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_CID_IN_1XX); @@ -3008,6 +3019,7 @@ switch_status_t config_sofia(int reload, char *profile_name) sofia_set_pflag(profile, PFLAG_PASS_CALLEE_ID); sofia_set_pflag(profile, PFLAG_MESSAGE_QUERY_ON_FIRST_REGISTER); sofia_set_pflag(profile, PFLAG_SQL_IN_TRANS); + sofia_set_pflag(profile, PFLAG_PRESENCE_ON_REGISTER); profile->shutdown_type = "false"; profile->local_network = "localnet.auto"; sofia_set_flag(profile, TFLAG_ENABLE_SOA); @@ -3090,6 +3102,16 @@ switch_status_t config_sofia(int reload, char *profile_name) } else { sofia_clear_pflag(profile, PFLAG_PRESENCE_PROBE_ON_REGISTER); } + } else if (!strcasecmp(var, "send-presence-on-register")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_PRESENCE_ON_REGISTER); + } else if (!strcasecmp(val, "first-only")) { + sofia_clear_pflag(profile, PFLAG_PRESENCE_ON_REGISTER); + sofia_set_pflag(profile, PFLAG_PRESENCE_ON_FIRST_REGISTER); + } else { + sofia_clear_pflag(profile, PFLAG_PRESENCE_ON_REGISTER); + sofia_clear_pflag(profile, PFLAG_PRESENCE_ON_FIRST_REGISTER); + } } else if (!strcasecmp(var, "cid-in-1xx")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_CID_IN_1XX); diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 2881918..344e517 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -875,9 +875,19 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand long reg_count = 0; int delete_subs; const char *agent = "unknown"; - + const char *pres_on_reg = NULL; + int send_pres = 0; + delete_subs = sofia_test_pflag(profile, PFLAG_DEL_SUBS_ON_REG); + if (v_event && *v_event) pres_on_reg = switch_event_get_header(*v_event, "send-presence-on-register"); + + if (!(send_pres = switch_true(pres_on_reg))) { + if (pres_on_reg && !strcasecmp(pres_on_reg, "first-only")) { + send_pres = 2; + } + } + /* all callers must confirm that sip, sip->sip_request and sip->sip_contact are not NULL */ switch_assert(sip != NULL && sip->sip_contact != NULL && sip->sip_request != NULL); @@ -1405,7 +1415,6 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand } } - if (send && switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", rpid); @@ -1493,27 +1502,31 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand } } - if (sofia_test_pflag(profile, PFLAG_PRESENCE_PROBE_ON_REGISTER)) { - if (switch_event_create(&s_event, SWITCH_EVENT_PRESENCE_PROBE) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); - switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "login", profile->name); - switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, sub_host); - switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "to", "%s@%s", to_user, sub_host); - switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "event_type", "presence"); - switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog"); - switch_event_fire(&s_event); + if (sofia_test_pflag(profile, PFLAG_PRESENCE_ON_REGISTER) || + (reg_count == 1 && sofia_test_pflag(profile, PFLAG_PRESENCE_ON_FIRST_REGISTER)) + || send_pres == 1 || (reg_count == 1 && send_pres == 2)) { + + if (sofia_test_pflag(profile, PFLAG_PRESENCE_PROBE_ON_REGISTER)) { + if (switch_event_create(&s_event, SWITCH_EVENT_PRESENCE_PROBE) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "login", profile->name); + switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, sub_host); + switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "to", "%s@%s", to_user, sub_host); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "event_type", "presence"); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog"); + switch_event_fire(&s_event); + } + } else { + if (switch_event_create(&s_event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "login", profile->name); + switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, sub_host); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "rpid", "unknown"); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "status", "Registered"); + switch_event_fire(&s_event); + } } - } else { - if (switch_event_create(&s_event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); - switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "login", profile->name); - switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, sub_host); - switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "rpid", "unknown"); - switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "status", "Registered"); - switch_event_fire(&s_event); - } } - } else { if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_UNREGISTER) == SWITCH_STATUS_SUCCESS) { switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "profile-name", profile->name); commit 57b410eba6247b7a2805d9588963435946512a0c Author: Brian West <brian@freeswitch.org> Date: Fri Jan 14 13:10:02 2011 -0600 docs for acl diff --git a/conf/autoload_configs/acl.conf.xml b/conf/autoload_configs/acl.conf.xml index a1708a5..0c117d0 100644 --- a/conf/autoload_configs/acl.conf.xml +++ b/conf/autoload_configs/acl.conf.xml @@ -21,7 +21,10 @@ digest authenticated. --> <list name="domains" default="deny"> + <!-- domain= is special it scans the domain from the directory to build the ACL --> <node type="allow" domain="$${domain}"/> + <!-- use cidr= if you wish to allow ip ranges to this domains acl. --> + <!-- <node type="allow" cidr="192.168.0.0/24"/> --> </list> </network-lists> commit 4ee4c67003b7b0159ae5b980dc1ae1fb7a335f5d Author: David Yat Sin <dyatsin@sangoma.com> Date: Fri Jan 14 12:52:37 2011 -0500 Removed unused SIGEVENT diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 121aa18..50ceee4 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -394,7 +394,6 @@ typedef enum { FTDM_SIGEVENT_ADD_CALL, /*!< New call should be added to the channel */ FTDM_SIGEVENT_RESTART, /*!< Restart has been requested. Typically you hangup your call resources here */ FTDM_SIGEVENT_SIGSTATUS_CHANGED, /*!< Signaling protocol status changed (ie: D-chan up), see new status in raw_data ftdm_sigmsg_t member */ - FTDM_SIGEVENT_COLLISION, /*!< Outgoing call was dropped because an incoming call arrived at the same time */ FTDM_SIGEVENT_FACILITY, /*!< In call facility event */ FTDM_SIGEVENT_TRACE, /*!<Interpreted trace event */ FTDM_SIGEVENT_TRACE_RAW, /*!<Raw trace event */ commit 33bb9b834d4a563413e52b6010de8fe7555716d3 Author: David Yat Sin <dyatsin@sangoma.com> Date: Fri Jan 14 10:48:09 2011 -0500 freetdm - ISDN Allowed state change from RING to PROGRESS_MEDIA diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index f1e0bf4..f2afd1c 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -120,7 +120,7 @@ ftdm_state_map_t sangoma_isdn_state_map = { ZSD_INBOUND, ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_RING, FTDM_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROCEED, FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_PROGRESS, FTDM_END} + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROCEED, FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_END} }, { ZSD_INBOUND, commit 6126383ca47ace0ae6497cf9efd4cc41e87dd11a Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Jan 13 18:41:43 2011 -0600 FS-2980 diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index a529844..bf7c1aa 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -2695,8 +2695,8 @@ switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force) SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE | tech_pvt->profile->codec_flags, NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Can't load codec?\n"); - switch_goto_status(SWITCH_STATUS_FALSE, end); switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION); + switch_goto_status(SWITCH_STATUS_FALSE, end); } if (switch_core_codec_init_with_bitrate(&tech_pvt->write_codec, commit 7a04104d6f748ab2ed8bb880cad8b47fbaefe580 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Jan 13 18:04:05 2011 -0600 FS-2975 (part deux) diff --git a/src/switch_utils.c b/src/switch_utils.c index 0c49252..850b07f 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -812,7 +812,7 @@ SWITCH_DECLARE(char *) switch_strip_whitespace(const char *str) size_t len; if (zstr(sp)) { - return (char *) sp; + return strdup(SWITCH_BLANK_STRING); } while ((*sp == 13 ) || (*sp == 10 ) || (*sp == 9 ) || (*sp == 32) || (*sp == 11) ) { @@ -820,7 +820,7 @@ SWITCH_DECLARE(char *) switch_strip_whitespace(const char *str) } if (zstr(sp)) { - return (char *) sp; + return strdup(SWITCH_BLANK_STRING); } s = strdup(sp); @@ -829,7 +829,7 @@ SWITCH_DECLARE(char *) switch_strip_whitespace(const char *str) if ((len = strlen(s)) > 0) { p = s + (len - 1); - while (p > s && ((*p == 13 ) || (*p == 10 ) || (*p == 9 ) || (*p == 32) || (*p == 11))) { + while ((p >= s) && ((*p == 13 ) || (*p == 10 ) || (*p == 9 ) || (*p == 32) || (*p == 11))) { *p-- = '\0'; } } @@ -844,7 +844,7 @@ SWITCH_DECLARE(char *) switch_strip_spaces(char *str, switch_bool_t dup) size_t len; if (zstr(sp)) { - return sp; + return dup ? strdup(SWITCH_BLANK_STRING) : sp; } while (*sp == ' ') { @@ -865,7 +865,7 @@ SWITCH_DECLARE(char *) switch_strip_spaces(char *str, switch_bool_t dup) if ((len = strlen(s)) > 0) { p = s + (len - 1); - while (p && *p && p > s && *p == ' ') { + while (p && *p && (p >= s) && *p == ' ') { *p-- = '\0'; } } commit dff01c07f14a5c78048a7b71f64bb56fb353b46b Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Thu Jan 13 23:09:51 2011 +0100 [ftmod_libpri] Use FTDM_SPAN_USE_PROCEED_STATE and rework state handling. - Use the newly introduced FTDM_SPAN_USE_PROCEED_STATE flag and FTDM_CHANNEL_STATE_PROCEED. - Update ftmod_libpri's state machine table (taken from ftmod_sangoma_isdn). - Move pri_destroycall() to HANGUP_COMPLETE state. - Try to get a little bit closer to the ISDN states by using pri_acknowledge() in RINGING, pri_progress() in PROGRESS and pri_proceeding() in PROCEED state. - Go to PROGRESS_MEDIA in on_progress() only if there is inband indication available, go to PROGRESS if not. - Go to RINGING state in on_ringing() and remove PROGRESS_MEDIA check. NOTE: One libpri error message and a VETO (PROGRESS -> RINGING) warning to investigate, but changes seem to work fine nonetheless. Tested-by: SparFux (#freeswitch / #freeswitch-de @ irc.freenode.net) Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 8be6d57..2f9c70a 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -406,25 +406,36 @@ static ftdm_state_map_t isdn_state_map = { ZSD_OUTBOUND, ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_DIALING, FTDM_END}, - {FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_END} + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, + FTDM_CHANNEL_STATE_PROCEED, FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_PROGRESS, + FTDM_CHANNEL_STATE_UP, FTDM_END} }, { ZSD_OUTBOUND, ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_PROGRESS, FTDM_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_UP, FTDM_END} + {FTDM_CHANNEL_STATE_PROCEED, FTDM_END}, + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, + FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_END}, }, { ZSD_OUTBOUND, ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_DOWN, FTDM_END} + {FTDM_CHANNEL_STATE_RINGING, FTDM_END}, + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, + FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_END}, }, { ZSD_OUTBOUND, ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_END}, + {FTDM_CHANNEL_STATE_PROGRESS, FTDM_END}, + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, + FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_UP, FTDM_END} + }, + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_END}, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_UP, FTDM_END} }, { ZSD_OUTBOUND, @@ -432,6 +443,24 @@ static ftdm_state_map_t isdn_state_map = { {FTDM_CHANNEL_STATE_UP, FTDM_END}, {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_END} }, + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_END}, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_END} + }, + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_END}, + {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_END}, + }, + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_END}, + {FTDM_CHANNEL_STATE_DOWN, FTDM_END}, + }, /****************************************/ { @@ -462,26 +491,33 @@ static ftdm_state_map_t isdn_state_map = { ZSD_INBOUND, ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_RING, FTDM_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_END} + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROCEED, FTDM_CHANNEL_STATE_RINGING, FTDM_END} }, { ZSD_INBOUND, ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_DOWN, FTDM_END}, + {FTDM_CHANNEL_STATE_PROCEED, FTDM_END}, + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_PROGRESS, + FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_END} }, { ZSD_INBOUND, ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_END}, + {FTDM_CHANNEL_STATE_RINGING, FTDM_END}, + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, + FTDM_CHANNEL_STATE_UP, FTDM_END} }, { ZSD_INBOUND, ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, - FTDM_CHANNEL_STATE_CANCEL, FTDM_CHANNEL_STATE_UP, FTDM_END}, + {FTDM_CHANNEL_STATE_PROGRESS, FTDM_END}, + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_END} + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_END}, + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_UP, FTDM_END} }, { ZSD_INBOUND, @@ -489,6 +525,24 @@ static ftdm_state_map_t isdn_state_map = { {FTDM_CHANNEL_STATE_UP, FTDM_END}, {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_END}, }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_END}, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_END}, + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_END}, + {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_END}, + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_END}, + {FTDM_CHANNEL_STATE_DOWN, FTDM_END}, + }, } }; @@ -533,8 +587,6 @@ static ftdm_status_t state_advance(ftdm_channel_t *chan) break; case FTDM_CHANNEL_STATE_PROGRESS: - /* RINGING is an alias for PROGRESS state in inbound calls ATM */ - case FTDM_CHANNEL_STATE_RINGING: { if (ftdm_test_flag(chan, FTDM_CHANNEL_OUTBOUND)) { sig.event_id = FTDM_SIGEVENT_PROGRESS; @@ -542,7 +594,23 @@ static ftdm_status_t state_advance(ftdm_channel_t *chan) ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP); } } else if (call) { - pri_progress(isdn_data->spri.pri, call, ftdm_channel_get_id(chan), 1); + pri_progress(isdn_data->spri.pri, call, ftdm_channel_get_id(chan), 0); + } else { + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART); + } + } + break; + + case FTDM_CHANNEL_STATE_RINGING: + { + if (ftdm_test_flag(chan, FTDM_CHANNEL_OUTBOUND)) { + sig.event_id = FTDM_SIGEVENT_RINGING; + if ((status = ftdm_span_send_signal(ftdm_channel_get_span(chan), &sig) != FTDM_SUCCESS)) { + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP); + } + } else if (call) { +// pri_progress(isdn_data->spri.pri, call, ftdm_channel_get_id(chan), 1); + pri_acknowledge(isdn_data->spri.pri, call, ftdm_channel_get_id(chan), 1); } else { ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART); } @@ -561,7 +629,26 @@ static ftdm_status_t state_advance(ftdm_channel_t *chan) if (!ftdm_test_flag(chan, FTDM_CHANNEL_OPEN)) { ftdm_channel_open_chan(chan); } - pri_proceeding(isdn_data->spri.pri, call, ftdm_channel_get_id(chan), 1); + pri_progress(isdn_data->spri.pri, call, ftdm_channel_get_id(chan), 1); + } else { + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART); + } + } + break; + + case FTDM_CHANNEL_STATE_PROCEED: + { + if (ftdm_test_flag(chan, FTDM_CHANNEL_OUTBOUND)) { + /* PROCEED from other end, notify user */ + sig.event_id = FTDM_SIGEVENT_PROCEED; + if ((status = ftdm_span_send_signal(ftdm_channel_get_span(chan), &sig) != FTDM_SUCCESS)) { + ftdm_log(FTDM_LOG_ERROR, "Failed to send PROCEED sigevent on Channel %d:%d\n", + ftdm_channel_get_span_id(chan), + ftdm_channel_get_id(chan)); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP); + } + } else if (call) { + pri_proceeding(isdn_data->spri.pri, call, ftdm_channel_get_id(chan), 0); } else { ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART); } @@ -572,11 +659,12 @@ static ftdm_status_t state_advance(ftdm_channel_t *chan) { /* * This needs more auditing for BRI PTMP: - * does pri_acknowledge() steal the call from other devices? + * does pri_acknowledge() steal the call from other devices? (yes, it does) */ if (!ftdm_test_flag(chan, FTDM_CHANNEL_OUTBOUND)) { if (call) { - pri_acknowledge(isdn_data->spri.pri, call, ftdm_channel_get_id(chan), 0); + pri_proceeding(isdn_data->spri.pri, call, ftdm_channel_get_id(chan), 0); +// pri_acknowledge(isdn_data->spri.pri, call, ftdm_channel_get_id(chan), 0); sig.event_id = FTDM_SIGEVENT_START; if ((status = ftdm_span_send_signal(ftdm_channel_get_span(chan), &sig) != FTDM_SUCCESS)) { ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP); @@ -690,15 +778,22 @@ static ftdm_status_t state_advance(ftdm_channel_t *chan) ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); pri_hangup(isdn_data->spri.pri, call, caller_data->hangup_cause); - pri_destroycall(isdn_data->spri.pri, call); +// pri_destroycall(isdn_data->spri.pri, call); chan->call_data = NULL; } - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_DOWN); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); } break; case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: + { + if (call) { + pri_destroycall(isdn_data->spri.pri, call); + chan->call_data = NULL; + } + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_DOWN); + } break; case FTDM_CHANNEL_STATE_TERMINATING: @@ -869,7 +964,7 @@ static int on_proceeding(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ } } ftdm_log(FTDM_LOG_DEBUG, "-- Proceeding on channel %d:%d\n", ftdm_span_get_id(span), pevent->proceeding.channel); - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_PROCEED); } else { ftdm_log(FTDM_LOG_DEBUG, "-- Proceeding on channel %d:%d but it's not in the span?\n", ftdm_span_get_id(span), pevent->proceeding.channel); @@ -909,9 +1004,12 @@ static int on_progress(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ev ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_TERMINATING); goto out; } + ftdm_log(FTDM_LOG_DEBUG, "-- Progress on channel %d:%d with media\n", ftdm_span_get_id(span), pevent->proceeding.channel); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); + } else { + ftdm_log(FTDM_LOG_DEBUG, "-- Progress on channel %d:%d\n", ftdm_span_get_id(span), pevent->proceeding.channel); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_PROGRESS); } - ftdm_log(FTDM_LOG_DEBUG, "-- Progress on channel %d:%d\n", ftdm_span_get_id(span), pevent->proceeding.channel); - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); } else { ftdm_log(FTDM_LOG_DEBUG, "-- Progress on channel %d:%d but it's not in the span?\n", ftdm_span_get_id(span), pevent->proceeding.channel); @@ -936,10 +1034,10 @@ static int on_ringing(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_eve ftdm_log(FTDM_LOG_DEBUG, "-- Ringing on channel %d:%d\n", ftdm_span_get_id(span), pevent->ringing.channel); /* we may get on_ringing even when we're already in FTDM_CHANNEL_STATE_PROGRESS_MEDIA */ - if (ftdm_channel_get_state(chan) == FTDM_CHANNEL_STATE_PROGRESS_MEDIA) { - /* dont try to move to STATE_PROGRESS to avoid annoying veto warning */ - return 0; - } +// if (ftdm_channel_get_state(chan) == FTDM_CHANNEL_STATE_PROGRESS_MEDIA) { +// /* dont try to move to STATE_PROGRESS to avoid annoying veto warning */ +// return 0; +// } /* Open channel if inband information is available */ if ((pevent->ringing.progressmask & PRI_PROG_INBAND_AVAILABLE) && !ftdm_test_flag(chan, FTDM_CHANNEL_OPEN)) { @@ -959,7 +1057,8 @@ static int on_ringing(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_eve goto out; } } - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_PROGRESS); +// ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_PROGRESS); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RINGING); } else { ftdm_log(FTDM_LOG_DEBUG, "-- Ringing on channel %d:%d but it's not in the span?\n", ftdm_span_get_id(span), pevent->ringing.channel); @@ -1913,6 +2012,9 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) span->get_channel_sig_status = isdn_get_channel_sig_status; span->get_span_sig_status = isdn_get_span_sig_status; + /* move calls to PROCEED state when they hit dialplan (ROUTING state in FreeSWITCH) */ + ftdm_set_flag(span, FTDM_SPAN_USE_PROCEED_STATE); + if ((isdn_data->opts & FTMOD_LIBPRI_OPT_SUGGEST_CHANNEL)) { span->channel_request = isdn_channel_request; ftdm_set_flag(span, FTDM_SPAN_SUGGEST_CHAN_ID); commit e6e6ba9f3861fabf0153568f13d577731a0c82a8 Merge: bba8aef b235979 Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Jan 13 16:28:39 2011 -0500 Merge branch 'master' of git.freeswitch.org:freeswitch commit bba8aefca0b4b2eb7ccf86c2958b6cad397403ab Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Jan 13 16:28:31 2011 -0500 freetdm: ISDN-Fix for d-channel indexing, causing improper configuration on non-consecutive logical spans diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c index 585f6d4..100631f 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c @@ -150,7 +150,7 @@ static ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span g_sngisdn_data.spans[signal_data->link_id] = signal_data; - ftdm_log(FTDM_LOG_DEBUG, "%s: cc_id:%d dchan_id:%d span_id:%d\n", span->name, signal_data->cc_id, signal_data->dchan_id, signal_data->span_id); + ftdm_log(FTDM_LOG_DEBUG, "%s: cc_id:%d dchan_id:%d span_id:%d link_id:%d\n", span->name, signal_data->cc_id, signal_data->dchan_id, signal_data->span_id, signal_data->link_id); chaniter = ftdm_span_get_chan_iterator(span, NULL); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c index de10a9f..a52a624 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c @@ -216,7 +216,7 @@ ftdm_status_t sngisdn_stack_cfg_phy_psap(ftdm_span_t *span) cfg.hdr.entId.inst = S_INST; cfg.hdr.elmId.elmnt = STPSAP; - cfg.hdr.elmId.elmntInst1 = signal_data->link_id; + cfg.hdr.elmId.elmntInst1 = signal_data->dchan_id; if (!signal_data->dchan) { ftdm_log(FTDM_LOG_ERROR, "%s:No d-channels specified\n", span->name); @@ -241,7 +241,8 @@ ftdm_status_t sngisdn_stack_cfg_phy_psap(ftdm_span_t *span) ftdm_log(FTDM_LOG_ERROR, "%s:Unsupported trunk type %d\n", span->name, span->trunk_type); return FTDM_FAIL; } - cfg.t.cfg.s.l1PSAP.spId = signal_data->link_id; + + cfg.t.cfg.s.l1PSAP.spId = signal_data->dchan_id; if (sng_isdn_phy_config(&pst, &cfg)) { return FTDM_FAIL; @@ -315,7 +316,7 @@ ftdm_status_t sngisdn_stack_cfg_q921_msap(ftdm_span_t *span) cfg.hdr.entId.inst = S_INST; cfg.hdr.elmId.elmnt = STMSAP; - cfg.t.cfg.s.bdMSAP.lnkNmb = signal_data->link_id; + cfg.t.cfg.s.bdMSAP.lnkNmb = signal_data->dchan_id; cfg.t.cfg.s.bdMSAP.maxOutsFrms = 24; /* MAC window */ cfg.t.cfg.s.bdMSAP.tQUpperTrs = 32; /* Tx Queue Upper Threshold */ @@ -408,7 +409,7 @@ ftdm_status_t sngisdn_stack_cfg_q921_dlsap(ftdm_span_t *span, uint8_t management cfg.hdr.entId.inst = S_INST; cfg.hdr.elmId.elmnt = STDLSAP; - cfg.t.cfg.s.bdDLSAP.lnkNmb = signal_data->link_id; + cfg.t.cfg.s.bdDLSAP.lnkNmb = signal_data->dchan_id; cfg.t.cfg.s.bdDLSAP.n201 = 1028; /* n201 */ if (span->trunk_type == FTDM_TRUNK_BRI_PTMP || @@ -613,9 +614,9 @@ ftdm_status_t sngisdn_stack_cfg_q931_dlsap(ftdm_span_t *span) cfg.hdr.response.selector=0; + cfg.t.cfg.s.inDLSAP.sapId = signal_data->dchan_id; + cfg.t.cfg.s.inDLSAP.spId = signal_data->dchan_id; - cfg.t.cfg.s.inDLSAP.sapId = signal_data->link_id; - cfg.t.cfg.s.inDLSAP.spId = signal_data->link_id; cfg.t.cfg.s.inDLSAP.swtch = sng_isdn_stack_switchtype(signal_data->switchtype); cfg.t.cfg.s.inDLSAP.n201 = 1024; @@ -876,8 +877,7 @@ ftdm_status_t sngisdn_stack_cfg_q931_lce(ftdm_span_t *span) cfg.hdr.response.selector=0; - cfg.t.cfg.s.inLCe.sapId = signal_data->link_id; - + cfg.t.cfg.s.inLCe.sapId = signal_data->dchan_id; cfg.t.cfg.s.inLCe.lnkUpDwnInd = TRUE; cfg.t.cfg.s.inLCe.tCon.enb = TRUE; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c index 225244f..2023f4c 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c @@ -146,7 +146,8 @@ ftdm_status_t sngisdn_deactivate_phy(ftdm_span_t *span) cntrl.t.cntrl.action = AUBND_DIS; cntrl.t.cntrl.subAction = SAELMNT; - cntrl.t.cntrl.sapId = signal_data->link_id; + + cntrl.t.cntrl.sapId = signal_data->dchan_id; if (sng_isdn_phy_cntrl(&pst, &cntrl)) { return FTDM_FAIL; @@ -180,7 +181,8 @@ ftdm_status_t sngisdn_wake_up_phy(ftdm_span_t *span) cntrl.t.cntrl.action = AENA; cntrl.t.cntrl.subAction = SAELMNT; - cntrl.t.cntrl.sapId = signal_data->link_id; + + cntrl.t.cntrl.sapId = signal_data->dchan_id; if (sng_isdn_phy_cntrl(&pst, &cntrl)) { return FTDM_FAIL; @@ -298,7 +300,8 @@ ftdm_status_t sngisdn_cntrl_q931(ftdm_span_t *span, uint8_t action, uint8_t suba if (action == AENA && subaction == SATRC) { cntrl.t.cntrl.trcLen = -1; /* Trace the entire message buffer */ } - cntrl.t.cntrl.sapId = signal_data->link_id; + + cntrl.t.cntrl.sapId = signal_data->dchan_id; cntrl.t.cntrl.ces = 0; if(sng_isdn_q931_cntrl(&pst, &cntrl)) { @@ -339,11 +342,11 @@ ftdm_status_t sngisdn_cntrl_q921(ftdm_span_t *span, uint8_t action, uint8_t suba cntrl.t.cntrl.subAction = subaction; #if (SMBD_LMINT3 || BD_LMINT3) - cntrl.t.cntrl.lnkNmb = signal_data->link_id; + cntrl.t.cntrl.lnkNmb = signal_data->dchan_id; cntrl.t.cntrl.sapi = NOTUSED; cntrl.t.cntrl.tei = NOTUSED; #else /* _LMINT3 */ - cntrl.hdr.elmId.elmntInst1 = signal_data->link_id; + cntrl.hdr.elmId.elmntInst1 = signal_data->dchan_id; cntrl.hdr.elmId.elmntInst2 = NOTUSED; cntrl.hdr.elmId.elmntInst3 = NOTUSED; #endif /* _LMINT3 */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 9b4b787..4b27f21 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -491,8 +491,8 @@ void sngisdn_snd_data(ftdm_channel_t *dchan, uint8_t *data, ftdm_size_t len) /* Should we trigger congestion here? */ l1_frame.flags |= SNG_L1FRAME_QUEUE_FULL; } - - sng_isdn_data_ind(signal_data->link_id, &l1_frame); + + sng_isdn_data_ind(signal_data->dchan_id, &l1_frame); } void sngisdn_snd_event(ftdm_channel_t *dchan, ftdm_oob_event_t event) @@ -506,11 +506,11 @@ void sngisdn_snd_event(ftdm_channel_t *dchan, ftdm_oob_event_t event) switch(event) { case FTDM_OOB_ALARM_CLEAR: l1_event.type = SNG_L1EVENT_ALARM_OFF; - sng_isdn_event_ind(signal_data->link_id, &l1_event); + sng_isdn_event_ind(signal_data->dchan_id, &l1_event); break; case FTDM_OOB_ALARM_TRAP: l1_event.type = SNG_L1EVENT_ALARM_ON; - sng_isdn_event_ind(signal_data->link_id, &l1_event); + sng_isdn_event_ind(signal_data->dchan_id, &l1_event); break; default: /* We do not care about the other OOB events for now */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c index a90968f..791b65f 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c @@ -662,7 +662,9 @@ void sngisdn_rcv_phy_ind(SuId suId, Reason reason) void sngisdn_rcv_q921_ind(BdMngmt *status) { ftdm_span_t *ftdmspan; - sngisdn_span_data_t *signal_data = g_sngisdn_data.spans[status->t.usta.lnkNmb]; + + sngisdn_span_data_t *signal_data = g_sngisdn_data.dchans[status->t.usta.lnkNmb].spans[1]; + if (!signal_data) { ftdm_log(FTDM_LOG_INFO, "Received q921 status on unconfigured span (lnkNmb:%d)\n", status->t.usta.lnkNmb); return; @@ -715,7 +717,7 @@ void sngisdn_rcv_q931_ind(InMngmt *status) case LCM_EVENT_DOWN: { ftdm_span_t *ftdmspan; - sngisdn_span_data_t *signal_data = g_sngisdn_data.spans[status->t.usta.suId]; + sngisdn_span_data_t *signal_data = g_sngisdn_data.dchans[status->t.usta.suId].spans[1]; if (!signal_data) { ftdm_log(FTDM_LOG_INFO, "Received q931 status on unconfigured span (lnkNmb:%d)\n", status->t.usta.suId); return; @@ -784,7 +786,8 @@ void sngisdn_rcv_q931_trace(InMngmt *trc, Buffer *mBuf) uint8_t data; ftdm_trace_dir_t dir; uint8_t tdata[1000]; - sngisdn_span_data_t *signal_data = g_sngisdn_data.spans[trc->t.trc.suId]; + + sngisdn_span_data_t *signal_data = g_sngisdn_data.dchans[trc->t.trc.suId].spans[1]; ftdm_assert(mBuf != NULLP, "Received a Q931 trace with no buffer"); mlen = ((SsMsgInfo*)(mBuf->b_rptr))->len; @@ -830,7 +833,8 @@ void sngisdn_rcv_q921_trace(BdMngmt *trc, Buffer *mBuf) uint8_t data; ftdm_trace_dir_t dir; uint8_t tdata[1000]; - sngisdn_span_data_t *signal_data = g_sngisdn_data.spans[trc->t.trc.lnkNmb]; + + sngisdn_span_data_t *signal_data = g_sngisdn_data.dchans[trc->t.trc.lnkNmb].spans[1]; if (trc->t.trc.evnt == TL2TMR) { return; @@ -879,7 +883,7 @@ int16_t sngisdn_rcv_l1_data_req(uint16_t spId, sng_l1_frame_t *l1_frame) { ftdm_status_t status; ftdm_wait_flag_t flags = FTDM_WRITE; - sngisdn_span_data_t *signal_data = g_sngisdn_data.spans[spId]; + sngisdn_span_data_t *signal_data = g_sngisdn_data.dchans[spId].spans[1]; ftdm_size_t length = l1_frame->len; ftdm_assert(signal_data, "Received Data request on unconfigured span\n"); @@ -912,8 +916,8 @@ int16_t sngisdn_rcv_l1_data_req(uint16_t spId, sng_l1_frame_t *l1_frame) } int16_t sngisdn_rcv_l1_cmd_req(uint16_t spId, sng_l1_cmd_t *l1_cmd) -{ - sngisdn_span_data_t *signal_data = g_sngisdn_data.spans[spId]; +{ + sngisdn_span_data_t *signal_data = g_sngisdn_data.dchans[spId].spans[1]; ftdm_assert(signal_data, "Received Data request on unconfigured span\n"); switch(l1_cmd->type) { commit 03ae958ce40b529709dbaf4a304be2ba3f6454b1 Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Jan 13 15:13:56 2011 -0500 freetdm; TON/NPI defaults to unknown for Euroisdn diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c index c979000..585f6d4 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c @@ -38,6 +38,7 @@ static ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span static ftdm_status_t parse_signalling(const char* signalling, ftdm_span_t *span); static ftdm_status_t add_local_number(const char* val, ftdm_span_t *span); static ftdm_status_t parse_yesno(const char* var, const char* val, uint8_t *target); +static ftdm_status_t set_switchtype_defaults(ftdm_span_t *span); extern ftdm_sngisdn_data_t g_sngisdn_data; @@ -191,6 +192,63 @@ static ftdm_status_t parse_signalling(const char* signalling, ftdm_span_t *span) return FTDM_SUCCESS; } +static ftdm_status_t set_switchtype_defaults(ftdm_span_t *span) +{ + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data; + switch(signal_data->switchtype) { + case SNGISDN_SWITCH_NI2: + case SNGISDN_SWITCH_5ESS: + case SNGISDN_SWITCH_4ESS: + case SNGISDN_SWITCH_DMS100: + if (span->default_caller_data.dnis.plan >= FTDM_NPI_INVALID) { + ftdm_set_npi("isdn", &span->default_caller_data.dnis.plan); + } + if (span->default_caller_data.dnis.type >= FTDM_TON_INVALID) { + ftdm_set_ton("national", &span->default_caller_data.dnis.type); + } + if (span->default_caller_data.cid_num.plan >= FTDM_NPI_INVALID) { + ftdm_set_npi("isdn", &span->default_caller_data.cid_num.plan); + } + if (span->default_caller_data.cid_num.type >= FTDM_TON_INVALID) { + ftdm_set_ton("national", &span->default_caller_data.cid_num.type); + } + if (span->default_caller_data.rdnis.plan >= FTDM_NPI_INVALID) { + ftdm_set_npi("isdn", &span->default_caller_data.rdnis.plan); + } + if (span->default_caller_data.rdnis.type >= FTDM_TON_INVALID) { + ftdm_set_ton("national", &span->default_caller_data.rdnis.type); + } + break; + case SNGISDN_SWITCH_EUROISDN: + case SNGISDN_SWITCH_QSIG: + case SNGISDN_SWITCH_INSNET: + if (span->default_caller_data.dnis.plan >= FTDM_NPI_INVALID) { + ftdm_set_npi("unknown", &span->default_caller_data.dnis.plan); + } + if (span->default_caller_data.dnis.type >= FTDM_TON_INVALID) { + ftdm_set_ton("unknown", &span->default_caller_data.dnis.type); + } + if (span->default_caller_data.cid_num.plan >= FTDM_NPI_INVALID) { + ftdm_set_npi("unknown", &span->default_caller_data.cid_num.plan); + } + if (span->default_caller_data.cid_num.type >= FTDM_TON_INVALID) { + ftdm_set_ton("unknown", &span->default_caller_data.cid_num.type); + } + if (span->default_caller_data.rdnis.plan >= FTDM_NPI_INVALID) { + ftdm_set_npi("unknown", &span->default_caller_data.rdnis.plan); + } + if (span->default_caller_data.rdnis.type >= FTDM_TON_INVALID) { + ftdm_set_ton("unknown", &span->default_caller_data.rdnis.type); + } + break; + case SNGISDN_SWITCH_INVALID: + default: + ftdm_log(FTDM_LOG_ERROR, "Unsupported switchtype[%d]\n", signal_data->switchtype); + return FTDM_FAIL; + } + return FTDM_SUCCESS; +} + ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *span) { unsigned paramindex; @@ -205,31 +263,19 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ signal_data->ignore_cause_value = SNGISDN_OPT_DEFAULT; signal_data->timer_t3 = 8; signal_data->restart_opt = SNGISDN_OPT_DEFAULT; - signal_data->link_id = span->span_id; - span->default_caller_data.bearer_capability = IN_ITC_SPEECH; + + span->default_caller_data.dnis.plan = FTDM_NPI_INVALID; + span->default_caller_data.dnis.type = FTDM_TON_INVALID; + span->default_caller_data.cid_num.plan = FTDM_NPI_INVALID; + span->default_caller_data.cid_num.type = FTDM_TON_INVALID; + span->default_caller_data.rdnis.plan = FTDM_NPI_INVALID; + span->default_caller_data.rdnis.type = FTDM_TON_INVALID; + span->default_caller_data.bearer_capability = IN_ITC_SPEECH; /* Cannot set default bearer_layer1 yet, as we do not know the switchtype */ span->default_caller_data.bearer_layer1 = FTDM_INVALID_INT_PARM; - if (span->trunk_type == FTDM_TRUNK_BRI || - span->trunk_type == FTDM_TRUNK_BRI_PTMP) { - - ftdm_set_npi("unknown", &span->default_caller_data.dnis.plan); - ftdm_set_ton("unknown", &span->default_caller_data.dnis.type); - ftdm_set_npi("unknown", &span->default_caller_data.cid_num.plan); - ftdm_set_ton("unknown", &span->default_caller_data.cid_num.type); - ftdm_set_npi("unknown", &span->default_caller_data.rdnis.plan); - ftdm_set_ton("unknown", &span->default_caller_data.rdnis.type); - } else { - ftdm_set_npi("isdn", &span->default_caller_data.dnis.plan); - ftdm_set_ton("national", &span->default_caller_data.dnis.type); - ftdm_set_npi("isdn", &span->default_caller_data.cid_num.plan); - ftdm_set_ton("national", &span->default_caller_data.cid_num.type); - ftdm_set_npi("isdn", &span->default_caller_data.rdnis.plan); - ftdm_set_ton("national", &span->default_caller_data.rdnis.type); - } - for (paramindex = 0; ftdm_parameters[paramindex].var; paramindex++) { ftdm_log(FTDM_LOG_DEBUG, "Sangoma ISDN key=value, %s=%s\n", ftdm_parameters[paramindex].var, ftdm_parameters[paramindex].val); var = ftdm_parameters[paramindex].var; @@ -239,6 +285,9 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ if (parse_switchtype(val, span) != FTDM_SUCCESS) { return FTDM_FAIL; } + if (set_switchtype_defaults(span) != FTDM_SUCCESS) { + return FTDM_FAIL; + } } else if (!strcasecmp(var, "signalling") || !strcasecmp(var, "interface")) { if (parse_signalling(val, span) != FTDM_SUCCESS) { commit b2359797668addf5e79ce4de36f1cf62cc93136d Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Jan 13 12:35:39 2011 -0600 <jedi wave>You don't need to see this patch</jedi wave> diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 5794ae7..4e5450d 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -2495,6 +2495,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ } if (rtp_session->recv_msg.header.pt != 13 && + rtp_session->recv_msg.header.pt != rtp_session->recv_te && (!rtp_session->cng_pt || rtp_session->recv_msg.header.pt != rtp_session->cng_pt) && rtp_session->recv_msg.header.pt != rtp_session->payload) { /* drop frames of incorrect payload number and return CNG frame instead */ commit c6bdb303d43383f4d3474f54e5dbf2b6d699f2bd Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Jan 13 10:58:53 2011 -0600 FS-2975 diff --git a/src/switch_utils.c b/src/switch_utils.c index 1578e63..0c49252 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -809,23 +809,29 @@ SWITCH_DECLARE(char *) switch_strip_whitespace(const char *str) { const char *sp = str; char *p, *s = NULL; + size_t len; - if (!sp) - return NULL; + if (zstr(sp)) { + return (char *) sp; + } while ((*sp == 13 ) || (*sp == 10 ) || (*sp == 9 ) || (*sp == 32) || (*sp == 11) ) { sp++; } + + if (zstr(sp)) { + return (char *) sp; + } s = strdup(sp); + switch_assert(s); - if (!s) - return NULL; - - p = s + (strlen(s) - 1); + if ((len = strlen(s)) > 0) { + p = s + (len - 1); - while ((*p == 13 ) || (*p == 10 ) || (*p == 9 ) || (*p == 32) || (*p == 11) ) { - *p-- = '\0'; + while (p > s && ((*p == 13 ) || (*p == 10 ) || (*p == 9 ) || (*p == 32) || (*p == 11))) { + *p-- = '\0'; + } } return s; @@ -835,9 +841,11 @@ SWITCH_DECLARE(char *) switch_strip_spaces(char *str, switch_bool_t dup) { char *sp = str; char *p, *s = NULL; + size_t len; - if (!sp) - return NULL; + if (zstr(sp)) { + return sp; + } while (*sp == ' ') { sp++; @@ -845,17 +853,21 @@ SWITCH_DECLARE(char *) switch_strip_spaces(char *str, switch_bool_t dup) if (dup) { s = strdup(sp); + switch_assert(s); } else { s = sp; } - if (!s) - return NULL; + if (zstr(s)) { + return s; + } - p = s + (strlen(s) - 1); + if ((len = strlen(s)) > 0) { + p = s + (len - 1); - while (*p == ' ') { - *p-- = '\0'; + while (p && *p && p > s && *p == ' ') { + *p-- = '\0'; + } } return s; commit 2e0747272fcc686851efb2fd804ee2bf78960f5d Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Jan 13 10:41:33 2011 -0600 fix regression in commit 98f74a5f FS-2965 diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 6bdb568..2d9341a 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -5046,7 +5046,7 @@ static switch_status_t conference_local_play_file(conference_obj_t *conference, goto done; } - if (conference->sound_prefix) { + if (!switch_is_file_path(path) && conference->sound_prefix) { if (!(dpath = switch_mprintf("%s%s%s", conference->sound_prefix, SWITCH_PATH_SEPARATOR, path))) { status = SWITCH_STATUS_MEMERR; goto done; @@ -5827,7 +5827,7 @@ SWITCH_STANDARD_APP(conference_function) toplay = conference->kicked_sound; } - if (conference->sound_prefix) { + if (!switch_is_file_path(toplay) && conference->sound_prefix) { dfile = switch_mprintf("%s%s%s", conference->sound_prefix, SWITCH_PATH_SEPARATOR, toplay); switch_assert(dfile); toplay = dfile; commit 8458adebbb814ed3a38493bbd5af6b5a7531939e Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Jan 13 10:30:29 2011 -0600 avoid scheduler caling a function on null hash during shutdown diff --git a/src/mod/applications/mod_hash/mod_hash.c b/src/mod/applications/mod_hash/mod_hash.c index d03ff92..e3f01ce 100644 --- a/src/mod/applications/mod_hash/mod_hash.c +++ b/src/mod/applications/mod_hash/mod_hash.c @@ -263,10 +263,14 @@ SWITCH_HASH_DELETE_FUNC(limit_hash_remote_cleanup_callback) SWITCH_STANDARD_SCHED_FUNC(limit_hash_cleanup_callback) { switch_thread_rwlock_wrlock(globals.limit_hash_rwlock); - switch_core_hash_delete_multi(globals.limit_hash, limit_hash_cleanup_delete_callback, NULL); + if (globals.limit_hash) { + switch_core_hash_delete_multi(globals.limit_hash, limit_hash_cleanup_delete_callback, NULL); + } switch_thread_rwlock_unlock(globals.limit_hash_rwlock); - - task->runtime = switch_epoch_time_now(NULL) + LIMIT_HASH_CLEANUP_INTERVAL; + + if (globals.limit_hash) { + task->runtime = switch_epoch_time_now(NULL) + LIMIT_HASH_CLEANUP_INTERVAL; + } } /* !\brief Releases usage of a limit_hash-controlled ressource */ @@ -991,7 +995,9 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_hash_shutdown) free(val); switch_core_hash_delete(globals.db_hash, key); } - + + switch_core_hash_destroy(&globals.limit_hash); + switch_core_hash_destroy(&globals.db_hash); switch_thread_rwlock_unlock(globals.limit_hash_rwlock); switch_thread_rwlock_unlock(globals.db_hash_rwlock); @@ -999,8 +1005,6 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_hash_shutdown) switch_thread_rwlock_destroy(globals.db_hash_rwlock); switch_thread_rwlock_destroy(globals.limit_hash_rwlock); - switch_core_hash_destroy(&globals.limit_hash); - switch_core_hash_destroy(&globals.db_hash); return SWITCH_STATUS_SUCCESS; } commit d9c5634507118428b27dea28bb3950beb4da9741 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Jan 13 10:03:00 2011 -0600 up assert vaule on header loop detection to 1 meeeeelyonne for hmmhesegs diff --git a/src/switch_event.c b/src/switch_event.c index 3941fab..003fc82 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -744,7 +744,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_del_header_val(switch_event_t *even tp = tp->next; x++; - switch_assert(x < 1000); + switch_assert(x < 1000000); hash = switch_ci_hashfunc_default(header_name, &hlen); if ((!hp->hash || hash == hp->hash) && !strcasecmp(header_name, hp->name) && (zstr(val) || !strcmp(hp->value, val))) { commit a6db66ef36c05d0989343fdb8dd5bd8860754839 Author: Brian West <brian@freeswitch.org> Date: Thu Jan 13 09:55:55 2011 -0600 http://jira.freeswitch.org/browse/FS-2976 diff --git a/libs/js/nsprpub/pr/src/md/unix/os_Linux_x86.s b/libs/js/nsprpub/pr/src/md/unix/os_Linux_x86.s index 743eff5..650aa2a 100644 --- a/libs/js/nsprpub/pr/src/md/unix/os_Linux_x86.s +++ b/libs/js/nsprpub/pr/src/md/unix/os_Linux_x86.s @@ -1,42 +1,42 @@ -/ -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- -/ -/ The contents of this file are subject to the Mozilla Public -/ License Version 1.1 (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.mozilla.org/MPL/ -/ -/ Software distributed under the License is distributed on an "AS -/ IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -/ implied. See the License for the specific language governing -/ rights and limitations under the License. -/ -/ The Original Code is the Netscape Portable Runtime (NSPR). -/ -/ The Initial Developer of the Original Code is Netscape -/ Communications Corporation. Portions created by Netscape are -/ Copyright (C) 2000 Netscape Communications Corporation. All -/ Rights Reserved. -/ -/ Contributor(s): -/ -/ Alternatively, the contents of this file may be used under the -/ terms of the GNU General Public License Version 2 or later (the -/ "GPL"), in which case the provisions of the GPL are applicable -/ instead of those above. If you wish to allow use of your -/ version of this file only under the terms of the GPL and not to -/ allow others to use your version of this file under the MPL, -/ indicate your decision by deleting the provisions above and -/ replace them with the notice and other provisions required by -/ the GPL. If you do not delete the provisions above, a recipient -/ may use your version of this file under either the MPL or the -/ GPL. -/ +// -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +// +// The contents of this file are subject to the Mozilla Public +// License Version 1.1 (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.mozilla.org/MPL/ +// +// Software distributed under the License is distributed on an "AS +// IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +// implied. See the License for the specific language governing +// rights and limitations under the License. +// +// The Original Code is the Netscape Portable Runtime (NSPR). +// +// The Initial Developer of the Original Code is Netscape +// Communications Corporation. Portions created by Netscape are +// Copyright (C) 2000 Netscape Communications Corporation. All +// Rights Reserved. +// +// Contributor(s): +// +// Alternatively, the contents of this file may be used under the +// terms of the GNU General Public License Version 2 or later (the +// "GPL"), in which case the provisions of the GPL are applicable +// instead of those above. If you wish to allow use of your +// version of this file only under the terms of the GPL and not to +// allow others to use your version of this file under the MPL, +// indicate your decision by deleting the provisions above and +// replace them with the notice and other provisions required by +// the GPL. If you do not delete the provisions above, a recipient +// may use your version of this file under either the MPL or the +// GPL. +// -/ PRInt32 _PR_x86_AtomicIncrement(PRInt32 *val) -/ -/ Atomically increment the integer pointed to by 'val' and return -/ the result of the increment. -/ +// PRInt32 _PR_x86_AtomicIncrement(PRInt32 *val) +// +// Atomically increment the integer pointed to by 'val' and return +// the result of the increment. +// .text .globl _PR_x86_AtomicIncrement .align 4 @@ -48,11 +48,11 @@ _PR_x86_AtomicIncrement: incl %eax ret -/ PRInt32 _PR_x86_AtomicDecrement(PRInt32 *val) -/ -/ Atomically decrement the integer pointed to by 'val' and return -/ the result of the decrement. -/ +// PRInt32 _PR_x86_AtomicDecrement(PRInt32 *val) +// +// Atomically decrement the integer pointed to by 'val' and return +// the result of the decrement. +// .text .globl _PR_x86_AtomicDecrement .align 4 @@ -64,25 +64,25 @@ _PR_x86_AtomicDecrement: decl %eax ret -/ PRInt32 _PR_x86_AtomicSet(PRInt32 *val, PRInt32 newval) -/ -/ Atomically set the integer pointed to by 'val' to the new -/ value 'newval' and return the old value. -/ -/ An alternative implementation: -/ .text -/ .globl _PR_x86_AtomicSet -/ .align 4 -/_PR_x86_AtomicSet: -/ movl 4(%esp), %ecx -/ movl 8(%esp), %edx -/ movl (%ecx), %eax -/retry: -/ lock -/ cmpxchgl %edx, (%ecx) -/ jne retry -/ ret -/ +// PRInt32 _PR_x86_AtomicSet(PRInt32 *val, PRInt32 newval) +// +// Atomically set the integer pointed to by 'val' to the new +// value 'newval' and return the old value. +// +// An alternative implementation: +// .text +// .globl _PR_x86_AtomicSet +// .align 4 +//_PR_x86_AtomicSet: +// movl 4(%esp), %ecx +// movl 8(%esp), %edx +// movl (%ecx), %eax +//retry: +// lock +// cmpxchgl %edx, (%ecx) +// jne retry +// ret +// .text .globl _PR_x86_AtomicSet .align 4 @@ -92,11 +92,11 @@ _PR_x86_AtomicSet: xchgl %eax, (%ecx) ret -/ PRInt32 _PR_x86_AtomicAdd(PRInt32 *ptr, PRInt32 val) -/ -/ Atomically add 'val' to the integer pointed to by 'ptr' -/ and return the result of the addition. -/ +// PRInt32 _PR_x86_AtomicAdd(PRInt32 *ptr, PRInt32 val) +// +// Atomically add 'val' to the integer pointed to by 'ptr' +// and return the result of the addition. +// .text .globl _PR_x86_AtomicAdd .align 4 @@ -109,5 +109,5 @@ _PR_x86_AtomicAdd: addl %edx, %eax ret -/ Magic indicating no need for an executable stack +// Magic indicating no need for an executable stack .section .note.GNU-stack, "", @progbits ; .previous diff --git a/libs/js/nsprpub/pr/src/md/unix/os_Linux_x86_64.s b/libs/js/nsprpub/pr/src/md/unix/os_Linux_x86_64.s index c62437b..230dd82 100644 --- a/libs/js/nsprpub/pr/src/md/unix/os_Linux_x86_64.s +++ b/libs/js/nsprpub/pr/src/md/unix/os_Linux_x86_64.s @@ -1,42 +1,42 @@ -/ -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- -/ -/ The contents of this file are subject to the Mozilla Public -/ License Version 1.1 (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.mozilla.org/MPL/ -/ -/ Software distributed under the License is distributed on an "AS -/ IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -/ implied. See the License for the specific language governing -/ rights and limitations under the License. -/ -/ The Original Code is the Netscape Portable Runtime (NSPR). -/ -/ The Initial Developer of the Original Code is Netscape -/ Communications Corporation. Portions created by Netscape are -/ Copyright (C) 2004 Netscape Communications Corporation. All -/ Rights Reserved. -/ -/ Contributor(s): -/ -/ Alternatively, the contents of this file may be used under the -/ terms of the GNU General Public License Version 2 or later (the -/ "GPL"), in which case the provisions of the GPL are applicable -/ instead of those above. If you wish to allow use of your -/ version of this file only under the terms of the GPL and not to -/ allow others to use your version of this file under the MPL, -/ indicate your decision by deleting the provisions above and -/ replace them with the notice and other provisions required by -/ the GPL. If you do not delete the provisions above, a recipient -/ may use your version of this file under either the MPL or the -/ GPL. -/ +// -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +// +// The contents of this file are subject to the Mozilla Public +// License Version 1.1 (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.mozilla.org/MPL/ +// +// Software distributed under the License is distributed on an "AS +// IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +// implied. See the License for the specific language governing +// rights and limitations under the License. +// +// The Original Code is the Netscape Portable Runtime (NSPR). +// +// The Initial Developer of the Original Code is Netscape +// Communications Corporation. Portions created by Netscape are +// Copyright (C) 2004 Netscape Communications Corporation. All +// Rights Reserved. +// +// Contributor(s): +// +// Alternatively, the contents of this file may be used under the +// terms of the GNU General Public License Version 2 or later (the +// "GPL"), in which case the provisions of the GPL are applicable +// instead of those above. If you wish to allow use of your +// version of this file only under the terms of the GPL and not to +// allow others to use your version of this file under the MPL, +// indicate your decision by deleting the provisions above and +// replace them with the notice and other provisions required by +// the GPL. If you do not delete the provisions above, a recipient +// may use your version of this file under either the MPL or the +// GPL. +// -/ PRInt32 _PR_x86_64_AtomicIncrement(PRInt32 *val) -/ -/ Atomically increment the integer pointed to by 'val' and return -/ the result of the increment. -/ +// PRInt32 _PR_x86_64_AtomicIncrement(PRInt32 *val) +// +// Atomically increment the integer pointed to by 'val' and return +// the result of the increment. +// .text .globl _PR_x86_64_AtomicIncrement .align 4 @@ -47,11 +47,11 @@ _PR_x86_64_AtomicIncrement: incl %eax ret -/ PRInt32 _PR_x86_64_AtomicDecrement(PRInt32 *val) -/ -/ Atomically decrement the integer pointed to by 'val' and return -/ the result of the decrement. -/ +// PRInt32 _PR_x86_64_AtomicDecrement(PRInt32 *val) +// +// Atomically decrement the integer pointed to by 'val' and return +// the result of the decrement. +// .text .globl _PR_x86_64_AtomicDecrement .align 4 @@ -62,11 +62,11 @@ _PR_x86_64_AtomicDecrement: decl %eax ret -/ PRInt32 _PR_x86_64_AtomicSet(PRInt32 *val, PRInt32 newval) -/ -/ Atomically set the integer pointed to by 'val' to the new -/ value 'newval' and return the old value. -/ +// PRInt32 _PR_x86_64_AtomicSet(PRInt32 *val, PRInt32 newval) +// +// Atomically set the integer pointed to by 'val' to the new +// value 'newval' and return the old value. +// .text .globl _PR_x86_64_AtomicSet .align 4 @@ -75,11 +75,11 @@ _PR_x86_64_AtomicSet: xchgl %eax, (%rdi) ret -/ PRInt32 _PR_x86_64_AtomicAdd(PRInt32 *ptr, PRInt32 val) -/ -/ Atomically add 'val' to the integer pointed to by 'ptr' -/ and return the result of the addition. -/ +// PRInt32 _PR_x86_64_AtomicAdd(PRInt32 *ptr, PRInt32 val) +// +// Atomically add 'val' to the integer pointed to by 'ptr' +// and return the result of the addition. +// .text .globl _PR_x86_64_AtomicAdd .align 4 @@ -90,5 +90,5 @@ _PR_x86_64_AtomicAdd: addl %esi, %eax ret -/ Magic indicating no need for an executable stack -/.section .note.GNU-stack, "", @progbits ; .previous +// Magic indicating no need for an executable stack +//.section .note.GNU-stack, "", @progbits ; .previous diff --git a/libs/js/nsprpub/pr/src/md/unix/os_SunOS_x86.s b/libs/js/nsprpub/pr/src/md/unix/os_SunOS_x86.s index a46c20f..6e94a73 100644 --- a/libs/js/nsprpub/pr/src/md/unix/os_SunOS_x86.s +++ b/libs/js/nsprpub/pr/src/md/unix/os_SunOS_x86.s @@ -1,36 +1,36 @@ -/ -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- -/ -/ The contents of this file are subject to the Mozilla Public -/ License Version 1.1 (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.mozilla.org/MPL/ -/ -/ Software distributed under the License is distributed on an "AS -/ IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -/ implied. See the License for the specific language governing -/ rights and limitations under the License. -/ -/ The Original Code is the Netscape Portable Runtime (NSPR). -/ -/ The Initial Developer of the Original Code is Netscape -/ Communications Corporation. Portions created by Netscape are -/ Copyright (C) 1998-2000 Netscape Communications Corporation. All -/ Rights Reserved. -/ -/ Contributor(s): -/ -/ Alternatively, the contents of this file may be used under the -/ terms of the GNU General Public License Version 2 or later (the -/ "GPL"), in which case the provisions of the GPL are applicable -/ instead of those above. If you wish to allow use of your -/ version of this file only under the terms of the GPL and not to -/ allow others to use your version of this file under the MPL, -/ indicate your decision by deleting the provisions above and -/ replace them with the notice and other provisions required by -/ the GPL. If you do not delete the provisions above, a recipient -/ may use your version of this file under either the MPL or the -/ GPL. -/ +// -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +// +// The contents of this file are subject to the Mozilla Public +// License Version 1.1 (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.mozilla.org/MPL/ +// +// Software distributed under the License is distributed on an "AS +// IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +// implied. See the License for the specific language governing +// rights and limitations under the License. +// +// The Original Code is the Netscape Portable Runtime (NSPR). +// +// The Initial Developer of the Original Code is Netscape +// Communications Corporation. Portions created by Netscape are +// Copyright (C) 1998-2000 Netscape Communications Corporation. All +// Rights Reserved. +// +// Contributor(s): +// +// Alternatively, the contents of this file may be used under the +// terms of the GNU General Public License Version 2 or later (the +// "GPL"), in which case the provisions of the GPL are applicable +// instead of those above. If you wish to allow use of your +// version of this file only under the terms of the GPL and not to +// allow others to use your version of this file under the MPL, +// indicate your decision by deleting the provisions above and +// replace them with the notice and other provisions required by +// the GPL. If you do not delete the provisions above, a recipient +// may use your version of this file under either the MPL or the +// GPL. +// .text @@ -56,31 +56,31 @@ _MD_FlushRegisterWindows: ret -/ -/ sol_getsp() -/ -/ Return the current sp (for debugging) -/ +// +// sol_getsp() +// +// Return the current sp (for debugging) +// .globl sol_getsp sol_getsp: movl %esp, %eax ret -/ -/ sol_curthread() -/ -/ Return a unique identifier for the currently active thread. -/ +// +// sol_curthread() +// +// Return a unique identifier for the currently active thread. +// .globl sol_curthread sol_curthread: movl %ecx, %eax ret -/ PRInt32 _MD_AtomicIncrement(PRInt32 *val) -/ -/ Atomically increment the integer pointed to by 'val' and return -/ the result of the increment. -/ +// PRInt32 _MD_AtomicIncrement(PRInt32 *val) +// +// Atomically increment the integer pointed to by 'val' and return +// the result of the increment. +// .text .globl _MD_AtomicIncrement .align 4 @@ -92,11 +92,11 @@ _MD_AtomicIncrement: incl %eax ret -/ PRInt32 _MD_AtomicDecrement(PRInt32 *val) -/ -/ Atomically decrement the integer pointed to by 'val' and return -/ the result of the decrement. -/ +// PRInt32 _MD_AtomicDecrement(PRInt32 *val) +// +// Atomically decrement the integer pointed to by 'val' and return +// the result of the decrement. +// .text .globl _MD_AtomicDecrement .align 4 @@ -108,25 +108,25 @@ _MD_AtomicDecrement: decl %eax ret -/ PRInt32 _MD_AtomicSet(PRInt32 *val, PRInt32 newval) -/ -/ Atomically set the integer pointed to by 'val' to the new -/ value 'newval' and return the old value. -/ -/ An alternative implementation: -/ .text -/ .globl _MD_AtomicSet -/ .align 4 -/_MD_AtomicSet: -/ movl 4(%esp), %ecx -/ movl 8(%esp), %edx -/ movl (%ecx), %eax -/retry: -/ lock -/ cmpxchgl %edx, (%ecx) -/ jne retry -/ ret -/ +// PRInt32 _MD_AtomicSet(PRInt32 *val, PRInt32 newval) +// +// Atomically set the integer pointed to by 'val' to the new +// value 'newval' and return the old value. +// +// An alternative implementation: +// .text +// .globl _MD_AtomicSet +// .align 4 +//_MD_AtomicSet: +// movl 4(%esp), %ecx +// movl 8(%esp), %edx +// movl (%ecx), %eax +//retry: +// lock +// cmpxchgl %edx, (%ecx) +// jne retry +// ret +// .text .globl _MD_AtomicSet .align 4 @@ -136,11 +136,11 @@ _MD_AtomicSet: xchgl %eax, (%ecx) ret -/ PRInt32 _MD_AtomicAdd(PRInt32 *ptr, PRInt32 val) -/ -/ Atomically add 'val' to the integer pointed to by 'ptr' -/ and return the result of the addition. -/ +// PRInt32 _MD_AtomicAdd(PRInt32 *ptr, PRInt32 val) +// +// Atomically add 'val' to the integer pointed to by 'ptr' +// and return the result of the addition. +// .text .globl _MD_AtomicAdd .align 4 diff --git a/libs/js/nsprpub/pr/src/md/unix/os_SunOS_x86_64.s b/libs/js/nsprpub/pr/src/md/unix/os_SunOS_x86_64.s index d4446a5..6d30bc5 100644 --- a/libs/js/nsprpub/pr/src/md/unix/os_SunOS_x86_64.s +++ b/libs/js/nsprpub/pr/src/md/unix/os_SunOS_x86_64.s @@ -1,42 +1,42 @@ -/ -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- -/ -/ The contents of this file are subject to the Mozilla Public -/ License Version 1.1 (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.mozilla.org/MPL/ -/ -/ Software distributed under the License is distributed on an "AS -/ IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -/ implied. See the License for the specific language governing -/ rights and limitations under the License. -/ -/ The Original Code is the Netscape Portable Runtime (NSPR). -/ -/ The Initial Developer of the Original Code is Netscape -/ Communications Corporation. Portions created by Netscape are -/ Copyright (C) 2004 Netscape Communications Corporation. All -/ Rights Reserved. -/ -/ Contributor(s): -/ -/ Alternatively, the contents of this file may be used under the -/ terms of the GNU General Public License Version 2 or later (the -/ "GPL"), in which case the provisions of the GPL are applicable -/ instead of those above. If you wish to allow use of your -/ version of this file only under the terms of the GPL and not to -/ allow others to use your version of this file under the MPL, -/ indicate your decision by deleting the provisions above and -/ replace them with the notice and other provisions required by -/ the GPL. If you do not delete the provisions above, a recipient -/ may use your version of this file under either the MPL or the -/ GPL. -/ +// -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +// +// The contents of this file are subject to the Mozilla Public +// License Version 1.1 (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.mozilla.org/MPL/ +// +// Software distributed under the License is distributed on an "AS +// IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +// implied. See the License for the specific language governing +// rights and limitations under the License. +// +// The Original Code is the Netscape Portable Runtime (NSPR). +// +// The Initial Developer of the Original Code is Netscape +// Communications Corporation. Portions created by Netscape are +// Copyright (C) 2004 Netscape Communications Corporation. All +// Rights Reserved. +// +// Contributor(s): +// +// Alternatively, the contents of this file may be used under the +// terms of the GNU General Public License Version 2 or later (the +// "GPL"), in which case the provisions of the GPL are applicable +// instead of those above. If you wish to allow use of your +// version of this file only under the terms of the GPL and not to +// allow others to use your version of this file under the MPL, +// indicate your decision by deleting the provisions above and +// replace them with the notice and other provisions required by +// the GPL. If you do not delete the provisions above, a recipient +// may use your version of this file under either the MPL or the +// GPL. +// -/ PRInt32 _MD_AtomicIncrement(PRInt32 *val) -/ -/ Atomically increment the integer pointed to by 'val' and return -/ the result of the increment. -/ +// PRInt32 _MD_AtomicIncrement(PRInt32 *val) +// +// Atomically increment the integer pointed to by 'val' and return +// the result of the increment. +// .text .globl _MD_AtomicIncrement .align 4 @@ -47,11 +47,11 @@ _MD_AtomicIncrement: incl %eax ret -/ PRInt32 _MD_AtomicDecrement(PRInt32 *val) -/ -/ Atomically decrement the integer pointed to by 'val' and return -/ the result of the decrement. -/ +// PRInt32 _MD_AtomicDecrement(PRInt32 *val) +// +// Atomically decrement the integer pointed to by 'val' and return +// the result of the decrement. +// .text .globl _MD_AtomicDecrement .align 4 @@ -62,11 +62,11 @@ _MD_AtomicDecrement: decl %eax ret -/ PRInt32 _MD_AtomicSet(PRInt32 *val, PRInt32 newval) -/ -/ Atomically set the integer pointed to by 'val' to the new -/ value 'newval' and return the old value. -/ +// PRInt32 _MD_AtomicSet(PRInt32 *val, PRInt32 newval) +// +// Atomically set the integer pointed to by 'val' to the new +// value 'newval' and return the old value. +// .text .globl _MD_AtomicSet .align 4 @@ -75,11 +75,11 @@ _MD_AtomicSet: xchgl %eax, (%rdi) ret -/ PRInt32 _MD_AtomicAdd(PRInt32 *ptr, PRInt32 val) -/ -/ Atomically add 'val' to the integer pointed to by 'ptr' -/ and return the result of the addition. -/ +// PRInt32 _MD_AtomicAdd(PRInt32 *ptr, PRInt32 val) +// +// Atomically add 'val' to the integer pointed to by 'ptr' +// and return the result of the addition. +// .text .globl _MD_AtomicAdd .align 4 commit 9c7b507d06123aedd5842e2d7bc8eae42bd5e566 Author: Jeff Lenk <jeff@jefflenk.com> Date: Wed Jan 12 23:10:29 2011 -0600 managed esl vs2010 converted from 2008 w/x64 lib support diff --git a/libs/esl/managed/ESL.2010.vcxproj b/libs/esl/managed/ESL.2010.vcxproj new file mode 100644 index 0000000..1656ddd --- /dev/null +++ b/libs/esl/managed/ESL.2010.vcxproj @@ -0,0 +1,195 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>ESL</ProjectName> + <ProjectGuid>{FEA2D0AE-6713-4E41-A473-A143849BC7FF}</ProjectGuid> + <RootNamespace>ESL</RootNamespace> + <Keyword>ManagedCProj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <CLRSupport>true</CLRSupport> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <CLRSupport>true</CLRSupport> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <CLRSupport>true</CLRSupport> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <CLRSupport>true</CLRSupport> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>..\src\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalDependencies>esl.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>..\..\..\libs\esl\src\$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <AssemblyDebug>true</AssemblyDebug> + <TargetMachine>NotSet</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <AdditionalIncludeDirectories>..\src\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalDependencies>esl.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>..\..\..\libs\esl\src\$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>..\src\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalDependencies>esl.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>..\..\..\libs\esl\src\$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <AssemblyDebug>true</AssemblyDebug> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <AdditionalIncludeDirectories>..\src\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalDependencies>esl.lib;Ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>..\..\..\libs\esl\src\$(Platform)\$(Configuration)\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <Reference Include="System"> + <CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies> + <ReferenceOutputAssembly>true</ReferenceOutputAssembly> + </Reference> + <Reference Include="System.Data"> + <CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies> + <ReferenceOutputAssembly>true</ReferenceOutputAssembly> + </Reference> + <Reference Include="System.Xml"> + <CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies> + <ReferenceOutputAssembly>true</ReferenceOutputAssembly> + </Reference> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\src\esl_oop.cpp" /> + <ClCompile Include="esl_wrap.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\src\include\esl_oop.h" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/libs/esl/managed/ESL.2010.vcxproj.filters b/libs/esl/managed/ESL.2010.vcxproj.filters new file mode 100644 index 0000000..0f46492 --- /dev/null +++ b/libs/esl/managed/ESL.2010.vcxproj.filters @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\src\esl_oop.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="esl_wrap.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\src\include\esl_oop.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/esl/managed/ManagedEsl.2010.csproj b/libs/esl/managed/ManagedEsl.2010.csproj new file mode 100644 index 0000000..7be21f4 --- /dev/null +++ b/libs/esl/managed/ManagedEsl.2010.csproj @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>9.0.30729</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{DEE5837B-E01D-4223-B351-EDF9418F3F8E}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>ManagedEsl</RootNamespace> + <AssemblyName>ManagedEsl</AssemblyName> + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <FileUpgradeFlags> + </FileUpgradeFlags> + <OldToolsVersion>3.5</OldToolsVersion> + <UpgradeBackupLocation /> + <PublishUrl>publish\</PublishUrl> + <Install>true</Install> + <InstallFrom>Disk</InstallFrom> + <UpdateEnabled>false</UpdateEnabled> + <UpdateMode>Foreground</UpdateMode> + <UpdateInterval>7</UpdateInterval> + <UpdateIntervalUnits>Days</UpdateIntervalUnits> + <UpdatePeriodically>false</UpdatePeriodically> + <UpdateRequired>false</UpdateRequired> + <MapFileExtensions>true</MapFileExtensions> + <ApplicationRevision>0</ApplicationRevision> + <ApplicationVersion>1.0.0.%2a</ApplicationVersion> + <IsWebBootstrapper>false</IsWebBootstrapper> + <UseApplicationTrust>false</UseApplicationTrust> + <BootstrapperEnabled>true</BootstrapperEnabled> + <TargetFrameworkProfile /> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="ESL.cs" /> + <Compile Include="ESLconnection.cs" /> + <Compile Include="ESLevent.cs" /> + <Compile Include="ESLPINVOKE.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="SWIGTYPE_p_esl_event_t.cs" /> + <Compile Include="SWIGTYPE_p_esl_priority_t.cs" /> + </ItemGroup> + <ItemGroup> + <BootstrapperPackage Include="Microsoft.Net.Client.3.5"> + <Visible>False</Visible> + <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName> + <Install>false</Install> + </BootstrapperPackage> + <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> + <Visible>False</Visible> + <ProductName>.NET Framework 3.5 SP1</ProductName> + <Install>true</Install> + </BootstrapperPackage> + <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1"> + <Visible>False</Visible> + <ProductName>Windows Installer 3.1</ProductName> + <Install>true</Install> + </BootstrapperPackage> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file diff --git a/libs/esl/managed/ManagedEslTest/ManagedEslTest.2010.csproj b/libs/esl/managed/ManagedEslTest/ManagedEslTest.2010.csproj new file mode 100644 index 0000000..8b97ffc --- /dev/null +++ b/libs/esl/managed/ManagedEslTest/ManagedEslTest.2010.csproj @@ -0,0 +1,98 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>9.0.30729</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{2321D01A-D64B-4461-9837-FACF38652212}</ProjectGuid> + <OutputType>Exe</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>ManagedEslTest</RootNamespace> + <AssemblyName>ManagedEslTest</AssemblyName> + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <FileUpgradeFlags> + </FileUpgradeFlags> + <OldToolsVersion>3.5</OldToolsVersion> + <UpgradeBackupLocation /> + <PublishUrl>publish\</PublishUrl> + <Install>true</Install> + <InstallFrom>Disk</InstallFrom> + <UpdateEnabled>false</UpdateEnabled> + <UpdateMode>Foreground</UpdateMode> + <UpdateInterval>7</UpdateInterval> + <UpdateIntervalUnits>Days</UpdateIntervalUnits> + <UpdatePeriodically>false</UpdatePeriodically> + <UpdateRequired>false</UpdateRequired> + <MapFileExtensions>true</MapFileExtensions> + <ApplicationRevision>0</ApplicationRevision> + <ApplicationVersion>1.0.0.%2a</ApplicationVersion> + <IsWebBootstrapper>false</IsWebBootstrapper> + <UseApplicationTrust>false</UseApplicationTrust> + <BootstrapperEnabled>true</BootstrapperEnabled> + <TargetFrameworkProfile /> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>..\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>..\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="Program.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\ManagedEsl.csproj"> + <Project>{DEE5837B-E01D-4223-B351-EDF9418F3F8E}</Project> + <Name>ManagedEsl</Name> + <Private>True</Private> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <BootstrapperPackage Include="Microsoft.Net.Client.3.5"> + <Visible>False</Visible> + <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName> + <Install>false</Install> + </BootstrapperPackage> + <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> + <Visible>False</Visible> + <ProductName>.NET Framework 3.5 SP1</ProductName> + <Install>true</Install> + </BootstrapperPackage> + <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1"> + <Visible>False</Visible> + <ProductName>Windows Installer 3.1</ProductName> + <Install>true</Install> + </BootstrapperPackage> + </ItemGroup> + <ItemGroup> + <None Include="app.config" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file diff --git a/libs/esl/managed/managed_esl.2010.sln b/libs/esl/managed/managed_esl.2010.sln new file mode 100644 index 0000000..3460af4 --- /dev/null +++ b/libs/esl/managed/managed_esl.2010.sln @@ -0,0 +1,74 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ESL", "ESL.2010.vcxproj", "{FEA2D0AE-6713-4E41-A473-A143849BC7FF}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ManagedEsl.2010", "ManagedEsl.2010.csproj", "{DEE5837B-E01D-4223-B351-EDF9418F3F8E}" + ProjectSection(ProjectDependencies) = postProject + {FEA2D0AE-6713-4E41-A473-A143849BC7FF} = {FEA2D0AE-6713-4E41-A473-A143849BC7FF} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ManagedEslTest.2010", "ManagedEslTest\ManagedEslTest.2010.csproj", "{2321D01A-D64B-4461-9837-FACF38652212}" + ProjectSection(ProjectDependencies) = postProject + {FEA2D0AE-6713-4E41-A473-A143849BC7FF} = {FEA2D0AE-6713-4E41-A473-A143849BC7FF} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Debug|Any CPU.ActiveCfg = Debug|Win32 + {FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Debug|Win32.ActiveCfg = Debug|Win32 + {FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Debug|Win32.Build.0 = Debug|Win32 + {FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Debug|x64.ActiveCfg = Debug|x64 + {FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Debug|x64.Build.0 = Debug|x64 + {FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Release|Any CPU.ActiveCfg = Release|Win32 + {FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Release|Mixed Platforms.Build.0 = Release|Win32 + {FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Release|Win32.ActiveCfg = Release|Win32 + {FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Release|Win32.Build.0 = Release|Win32 + {FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Release|x64.ActiveCfg = Release|x64 + {FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Release|x64.Build.0 = Release|x64 + {DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Debug|Win32.ActiveCfg = Debug|Any CPU + {DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Debug|x64.ActiveCfg = Debug|Any CPU + {DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Debug|x64.Build.0 = Debug|Any CPU + {DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Release|Any CPU.Build.0 = Release|Any CPU + {DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Release|Win32.ActiveCfg = Release|Any CPU + {DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Release|x64.ActiveCfg = Release|Any CPU + {DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Release|x64.Build.0 = Release|Any CPU + {2321D01A-D64B-4461-9837-FACF38652212}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2321D01A-D64B-4461-9837-FACF38652212}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2321D01A-D64B-4461-9837-FACF38652212}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {2321D01A-D64B-4461-9837-FACF38652212}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {2321D01A-D64B-4461-9837-FACF38652212}.Debug|Win32.ActiveCfg = Debug|Any CPU + {2321D01A-D64B-4461-9837-FACF38652212}.Debug|x64.ActiveCfg = Debug|Any CPU + {2321D01A-D64B-4461-9837-FACF38652212}.Debug|x64.Build.0 = Debug|Any CPU + {2321D01A-D64B-4461-9837-FACF38652212}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2321D01A-D64B-4461-9837-FACF38652212}.Release|Any CPU.Build.0 = Release|Any CPU + {2321D01A-D64B-4461-9837-FACF38652212}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {2321D01A-D64B-4461-9837-FACF38652212}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {2321D01A-D64B-4461-9837-FACF38652212}.Release|Win32.ActiveCfg = Release|Any CPU + {2321D01A-D64B-4461-9837-FACF38652212}.Release|x64.ActiveCfg = Release|Any CPU + {2321D01A-D64B-4461-9837-FACF38652212}.Release|x64.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal commit fe1711fdbab9ccf7c1565c0309fe7609fcfe1afc Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Jan 12 20:02:49 2011 -0600 eat rtp frames with the wrong payload type number diff --git a/src/switch_rtp.c b/src/switch_rtp.c index a56b5d1..5794ae7 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -2493,7 +2493,14 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ return_cng_frame(); } } - + + if (rtp_session->recv_msg.header.pt != 13 && + (!rtp_session->cng_pt || rtp_session->recv_msg.header.pt != rtp_session->cng_pt) && + rtp_session->recv_msg.header.pt != rtp_session->payload) { + /* drop frames of incorrect payload number and return CNG frame instead */ + return_cng_frame(); + } + if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_ENABLE_RTCP) && rtp_session->rtcp_read_pollfd) { rtcp_poll_status = switch_poll(rtp_session->rtcp_read_pollfd, 1, &rtcp_fdr, 0); commit 1b91f811bdba30759946c23132579fc55f3579a1 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Jan 12 19:34:19 2011 -0600 more diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 67a7a6e..1d8d6a9 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -7135,6 +7135,9 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ switch_channel_set_variable(channel, "sip_history_info", un->un_value); } } + } else if (!strcasecmp(un->un_name, "X-FS-Channel-Name") && !zstr(un->un_value)) { + switch_channel_set_name(channel, un->un_value); + switch_channel_set_variable(channel, "push_channel_name", "true"); } else if (!strcasecmp(un->un_name, "X-FS-Support")) { tech_pvt->x_freeswitch_support_remote = switch_core_session_strdup(session, un->un_value); } else if (!strncasecmp(un->un_name, "X-", 2) || !strncasecmp(un->un_name, "P-", 2)) { diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 822f404..d17105a 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -2604,10 +2604,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess if (caller_channel && switch_true(switch_channel_get_variable(caller_channel, "push_channel_name"))) { char *new_name = switch_core_session_sprintf(session, "%s__B", switch_channel_get_name(caller_channel)); - //switch_channel_set_variable(originate_status[i].peer_channel, "origination_channel_name", new_name); switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "origination_channel_name", new_name); new_name = switch_core_session_sprintf(session, "_%s", switch_channel_get_name(caller_channel)); - switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "sip_h_X-Channel-Name", new_name); + switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "sip_h_X-FS-Channel-Name", new_name); } /* make a special var event with mixture of the {} and the [] vars to pass down as global vars to the outgoing channel commit 138fdc83c6a4f614b657629b2937f78485a78a26 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Jan 12 18:06:01 2011 -0600 more from last commit diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 13d9506..822f404 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -2602,6 +2602,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } } + if (caller_channel && switch_true(switch_channel_get_variable(caller_channel, "push_channel_name"))) { + char *new_name = switch_core_session_sprintf(session, "%s__B", switch_channel_get_name(caller_channel)); + //switch_channel_set_variable(originate_status[i].peer_channel, "origination_channel_name", new_name); + switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "origination_channel_name", new_name); + new_name = switch_core_session_sprintf(session, "_%s", switch_channel_get_name(caller_channel)); + switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "sip_h_X-Channel-Name", new_name); + } + /* make a special var event with mixture of the {} and the [] vars to pass down as global vars to the outgoing channel so if something like the user channel does another originate our options will be passed down properly */ @@ -2690,7 +2698,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess if (switch_true(switch_channel_get_variable(originate_status[i].peer_channel, "leg_required"))) { originate_status[i].tagged = 1; } - + if ((vvar = switch_channel_get_variable(originate_status[i].peer_channel, "origination_channel_name"))) { switch_channel_set_name(originate_status[i].peer_channel, vvar); } commit a10125b8c3661123d99ed77cb3224eb4fdee5854 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Jan 12 17:48:49 2011 -0600 add origination_channel_name var for {} to choose the channel name value diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index f31d0f5..13d9506 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -2691,6 +2691,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess originate_status[i].tagged = 1; } + if ((vvar = switch_channel_get_variable(originate_status[i].peer_channel, "origination_channel_name"))) { + switch_channel_set_name(originate_status[i].peer_channel, vvar); + } + if ((vvar = switch_channel_get_variable(originate_status[i].peer_channel, "origination_callee_id_name"))) { switch_channel_set_profile_var(originate_status[i].peer_channel, "callee_id_name", vvar); } commit fb017a52d183ded3db8e01eec5e29b127ccb2ad0 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Jan 12 16:46:27 2011 -0600 clear last_transferred conference when you exit the conference app diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index a9da20e..6bdb568 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -5845,6 +5845,8 @@ SWITCH_STANDARD_APP(conference_function) if (rl) { switch_thread_rwlock_unlock(conference->rwlock); } + + switch_channel_set_variable(channel, "last_transfered_conference", NULL); } /* Create a thread for the conference and launch it */ commit 159ae98979fcfe78f497dc38e2f6daad8a1d87cd Author: Brian West <brian@freeswitch.org> Date: Wed Jan 12 16:27:56 2011 -0600 be more iOS friendly when using TCP or TLS because the phone never sleeps thus drains the battery diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 904f3ec..67a7a6e 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1477,8 +1477,6 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void TPTAG_TLS_VERIFY_POLICY(0)), TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), TPTAG_TLS_VERSION(profile->tls_version)), - TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), - TPTAG_KEEPALIVE(20000)), TAG_IF(!strchr(profile->sipip, ':'), NTATAG_UDP_MTU(65535)), TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_SRV), commit 54de293b0582bde9db579bc8de8ce8d6ab4750d2 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Jan 12 16:05:08 2011 -0600 fix seg related to ptime mismatch + CNG + PLC (if you ever get purple ptime mismatch warnings you want this patch) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index a0bcdbd..85b233d 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -43,8 +43,6 @@ SWITCH_MODULE_DEFINITION(mod_sofia, mod_sofia_load, mod_sofia_shutdown, NULL); struct mod_sofia_globals mod_sofia_globals; switch_endpoint_interface_t *sofia_endpoint_interface; -static switch_frame_t silence_frame = { 0 }; -static char silence_data[13] = ""; #define STRLEN 15 @@ -1094,8 +1092,10 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f sofia_glue_do_invite(session); } #endif - - *frame = &silence_frame; + *frame = &tech_pvt->read_frame; + switch_set_flag((*frame), SFF_CNG); + (*frame)->datalen = tech_pvt->read_impl.encoded_bytes_per_packet; + memset((*frame)->data, 0, (*frame)->datalen); return SWITCH_STATUS_SUCCESS; } @@ -4718,11 +4718,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) switch_management_interface_t *management_interface; struct in_addr in; - silence_frame.data = silence_data; - silence_frame.datalen = sizeof(silence_data); - silence_frame.buflen = sizeof(silence_data); - silence_frame.flags = SFF_CNG; - memset(&mod_sofia_globals, 0, sizeof(mod_sofia_globals)); mod_sofia_globals.destroy_private.destroy_nh = 1; mod_sofia_globals.destroy_private.is_static = 1; commit 7d1e664dc86c1b533bf70ad688fc58bbc0438073 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Jan 12 15:32:37 2011 -0600 let switch_end_paren work with delims of the same char diff --git a/src/switch_utils.c b/src/switch_utils.c index 3622442..1578e63 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -372,7 +372,7 @@ SWITCH_DECLARE(char *) switch_find_end_paren(const char *s, char open, char clos if (s && *s == open) { depth++; for (e = s + 1; e && *e; e++) { - if (*e == open) { + if (*e == open && open != close) { depth++; } else if (*e == close) { depth--; commit d2c34232ab046c9d8a004d8a1d919731a94cc70a Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Jan 12 15:32:05 2011 -0600 fix userauth issue diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index 0ebf6d5..344b0ee 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -1548,7 +1548,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even char api_reply[512] = "Allowed-API: all\n"; char log_reply[512] = ""; int allowed_log = 1; - + char *tmp; switch_clear_flag(listener, LFLAG_ALLOW_LOG); @@ -1564,8 +1564,9 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even *pass++ = '\0'; } - if ((pass = strchr(user, ':'))) { - *pass++ = '\0'; + if ((tmp = strchr(user, ':'))) { + *tmp++ = '\0'; + pass = tmp; } if (zstr(user) || zstr(domain_name)) { commit 1d6d9601d0dc0e8ba7d3136e700c0f899baf330c Merge: 771caca eb88304 Author: Moises Silva <moy@sangoma.com> Date: Wed Jan 12 15:11:42 2011 -0500 Merge remote branch 'fsorig/master' commit 771caca78d5964486dad09c0f9f93fc08cf76785 Author: Moises Silva <moy@sangoma.com> Date: Wed Jan 12 14:36:03 2011 -0500 freetdm: update glare.txt doc diff --git a/libs/freetdm/docs/glare.txt b/libs/freetdm/docs/glare.txt index d112aba..0753db8 100644 --- a/libs/freetdm/docs/glare.txt +++ b/libs/freetdm/docs/glare.txt @@ -1,29 +1,25 @@ Glare is a PITA. -Although configuration of ISDN links can be done to minimize glare, to be pedantic we must have a clear policy +Although configuration of ISDN links can be done to minimize glare, we also must have a clear policy on how the FreeTDM API is supposed to behave on glare across signaling modules. -There is a well-known race in the FreeTDM API since the beginning. When a user wants to place a call there is 2 APIs that -must be used: +There is a well-known race in the FreeTDM API since the beginning. When a user wants to place a call with +the old APIs: 1. ftdm_channel_open_xx (to hunt the channel by group, span or select a channel individually) 2. ftdm_channel_call_place() to place the actual call. Since the user has no access to channel locking, between opening a channel and placing a call, an incoming call could be -received. Therefore the user needs to be aware of the following: +received. Therefore things can get complicated and that is why you should STOP USING those 2 deprecated functions. -1. Between ftdm_channel_open_xx and ftdm_channel_call_place() a SIGEVENT_START can be received, if the user application -is smart enough, upon receive of SIGEVENT_START it can avoid doing anything else with the channel (from an outgoing call perspective) -since that channel is now a channel owned by the incoming call. It can for example hunt another channel using -ftdm_channel_open_xx again and avoid calling ftdm_channel_call_place. However, if the app is not smart enough and still calls -ftdm_channel_call_place even though already received FTDM_SIGEVENT_START on that channel, ftdm_channel_call_place will return -FTDM_BREAK to inform the user the outgoing call could not be placed and that there is already an incoming call on that channel. +The replacement is ftdm_call_place(). -2. If SIGEVENT_START was not received before calling ftdm_channel_call_place, it could still come while ftdm_channel_call_place() -is being executed, in such situation ftdm_channel_place_call() will return FTDM_BREAK to inform the user the call could -not be placed due to glare and the incoming call won the channel, he user should back off since the channel is -now owned by the incoming call (it can touch the channel having in mind there is now an incoming call on it) +ftdm_call_place receives the information required to hunt the channel and place the call. -3. After ftdm_channel_call_place returns, if glare is detected and the signaling stack decides to drop the local call, a regular +If glare is detected after placing the call and the signaling stack decides to drop the local call, a regular SIGEVENT_STOP will be sent with the hangup cause FTDM_CAUSE_REQUESTED_CHAN_UNAVAIL. +ftdm_call_place may return FTDM_BREAK if glare is detected while placing the call, in such cases you can try +calling ftdm_call_place again to hunt another channel. + + commit eb88304a1680890d2644a3f0d14f38896e164e33 Author: Joao Mesquita <jmesquita@freeswitch.org> Date: Wed Jan 12 16:24:04 2011 -0300 Small fix on ESL that cause event_id to be set wrong on headers that had value failure. diff --git a/libs/esl/src/esl.c b/libs/esl/src/esl.c index f5bab62..078c5de 100644 --- a/libs/esl/src/esl.c +++ b/libs/esl/src/esl.c @@ -1094,9 +1094,9 @@ ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, int check_q, esl_ esl_log(ESL_LOG_DEBUG, "RECV INNER HEADER [%s] = [%s]\n", hname, hval); if (!strcasecmp(hname, "event-name")) { esl_event_del_header(handle->last_ievent, "event-name"); + esl_name_event(hval, &handle->last_ievent->event_id); } esl_event_add_header_string(handle->last_ievent, ESL_STACK_BOTTOM, hname, hval); - esl_name_event(hval, &handle->last_ievent->event_id); } beg = c + 1; commit 3594419622409870f8ea947101452f4169d3546e Merge: 946f47f 45340d8 Author: Moises Silva <moy@sangoma.com> Date: Wed Jan 12 13:37:05 2011 -0500 Merge branch 'master' into moy.r2glare commit 946f47f1899203e3c8e1d1470b8708260c1b4538 Author: Moises Silva <moy@sangoma.com> Date: Wed Jan 12 13:16:45 2011 -0500 freetdm: fix wp config message diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index 9cbe9b3..caabc93 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -365,8 +365,7 @@ static unsigned wp_open_range(ftdm_span_t *span, unsigned spanno, unsigned start ftdm_copy_string(chan->chan_number, number, sizeof(chan->chan_number)); } configured++; - ftdm_log_chan(chan, FTDM_LOG_INFO, "configured wanpipe device s%dc%d as FreeTDM channel %d:%d fd:%d DTMF: %s\n", - spanno, x, chan->span_id, chan->chan_id, sockfd, dtmf); + ftdm_log_chan(chan, FTDM_LOG_INFO, "Configured wanpipe device fd:%d DTMF: %s\n", sockfd, dtmf); } else { ftdm_log(FTDM_LOG_ERROR, "ftdm_span_add_channel failed for wanpipe span %d channel %d\n", spanno, x); commit 8a26a6f6d2ab7f8964c5199723d02507d2292415 Author: Moises Silva <moy@sangoma.com> Date: Wed Jan 12 10:53:38 2011 -0500 freetdm: ftmod_r2 - map glare cause diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index df2e06d..68754d7 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -329,6 +329,9 @@ static openr2_call_disconnect_cause_t ftdm_r2_ftdm_cause_to_openr2_cause(ftdm_ch case FTDM_CAUSE_NORMAL_UNSPECIFIED: return OR2_CAUSE_UNSPECIFIED; + case FTDM_CAUSE_REQUESTED_CHAN_UNAVAIL: + return OR2_CAUSE_GLARE; + } ftdm_log_chan(fchan, FTDM_LOG_WARNING, "freetdm hangup cause %d mapped to openr2 cause %s\n", fchan->caller_data.hangup_cause, openr2_proto_get_disconnect_string(OR2_CAUSE_UNSPECIFIED)); commit cf253c35bc8de814e7c5b3f5e88bd9988556dbdb Author: Brian West <brian@freeswitch.org> Date: Tue Jan 11 15:31:33 2011 -0600 zrtp tweak for sas relay diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 1b7500d..a56b5d1 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -3261,21 +3261,25 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read_frame(switch_rtp_t *rtp switch_rtp_t *other_rtp_session = switch_channel_get_private(other_channel, "__zrtp_audio_rtp_session"); if (other_rtp_session) { - if (zrtp_status_ok == zrtp_session_get(other_rtp_session->zrtp_session, &zrtp_session_info)) { - if (rtp_session->zrtp_mitm_tries > ZRTP_MITM_TRIES) { - switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV); - switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND); - switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV); - switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND); - } else if (zrtp_status_ok == zrtp_resolve_mitm_call(other_rtp_session->zrtp_stream, rtp_session->zrtp_stream)) { - switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV); - switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND); - switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV); - switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND); - zrtp_verified_set(zrtp_global, &rtp_session->zrtp_session->zid, - &rtp_session->zrtp_session->peer_zid, zrtp_session_info.sas_is_verified ^ 1); - rtp_session->zrtp_mitm_tries++; + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) { + switch_mutex_lock(other_rtp_session->read_mutex); + if (zrtp_status_ok == zrtp_session_get(other_rtp_session->zrtp_session, &zrtp_session_info)) { + if (rtp_session->zrtp_mitm_tries > ZRTP_MITM_TRIES) { + switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV); + switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND); + switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV); + switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND); + } else if (zrtp_status_ok == zrtp_resolve_mitm_call(other_rtp_session->zrtp_stream, rtp_session->zrtp_stream)) { + switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV); + switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND); + switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV); + switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND); + zrtp_verified_set(zrtp_global, &rtp_session->zrtp_session->zid, + &rtp_session->zrtp_session->peer_zid, zrtp_session_info.sas_is_verified ^ 1); + rtp_session->zrtp_mitm_tries++; + } } + switch_mutex_unlock(other_rtp_session->read_mutex); } } commit 45340d8017c1915e4353961022e8c08d1f1eb7a8 Author: David Yat Sin <dyatsin@sangoma.com> Date: Tue Jan 11 16:20:05 2011 -0500 freetdm: added fix for hangup cause sometimes set to 0 during glare diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 2b43e9c..7b7c748 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -605,7 +605,7 @@ void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event) ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "cause:%d\n", ftdmchan->caller_data.hangup_cause); } else { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "RELEASE COMPLETE did not have a cause code\n"); - ftdmchan->caller_data.hangup_cause = 0; + ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_REQUESTED_CHAN_UNAVAIL; } sngisdn_set_flag(sngisdn_info, FLAG_REMOTE_ABORT); commit 316963c5941d387b12de505d2e418c1788018b09 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Jan 11 15:09:03 2011 -0600 treat EINTR returns as a BREAK (now mapped to SWITCH_STATUS_INTR), we appriciate the interrupted syscalls but we would like to continue working properly diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 9a5e09d..3972404 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -859,7 +859,7 @@ typedef enum { SWITCH_STATUS_FALSE, SWITCH_STATUS_TIMEOUT, SWITCH_STATUS_RESTART, - SWITCH_STATUS_TERM, + SWITCH_STATUS_INTR, SWITCH_STATUS_NOTIMPL, SWITCH_STATUS_MEMERR, SWITCH_STATUS_NOOP, @@ -876,6 +876,7 @@ typedef enum { SWITCH_STATUS_TOO_SMALL, SWITCH_STATUS_FOUND, SWITCH_STATUS_CONTINUE, + SWITCH_STATUS_TERM, SWITCH_STATUS_NOT_INITALIZED } switch_status_t; diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 4771dba..2c4de14 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -327,7 +327,7 @@ SWITCH_DECLARE(unsigned short) get_port(struct sockaddr *sa); */ SWITCH_DECLARE(int) switch_build_uri(char *uri, switch_size_t size, const char *scheme, const char *user, const switch_sockaddr_t *sa, int flags); -#define SWITCH_STATUS_IS_BREAK(x) (x == SWITCH_STATUS_BREAK || x == 730035 || x == 35) +#define SWITCH_STATUS_IS_BREAK(x) (x == SWITCH_STATUS_BREAK || x == 730035 || x == 35 || x == SWITCH_STATUS_INTR) /*! \brief Return a printable name of a switch_priority_t diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 038e1d9..1b7500d 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -2440,6 +2440,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ recvfrom: bytes = 0; read_loops++; + poll_loop = 0; if (!switch_rtp_ready(rtp_session)) { break; @@ -2466,21 +2467,27 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ status = read_rtp_packet(rtp_session, &bytes, flags); } else { if (!SWITCH_STATUS_IS_BREAK(poll_status) && poll_status != SWITCH_STATUS_TIMEOUT) { + char tmp[128] = ""; + strerror_r(poll_status, tmp, sizeof(tmp)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Poll failed with error: %d [%s]\n", poll_status, tmp); ret = -1; goto end; } poll_loop = 1; - rtp_session->missed_count += (poll_sec * 1000) / (rtp_session->ms_per_packet ? rtp_session->ms_per_packet / 1000 : 20); - bytes = 0; - if (rtp_session->max_missed_packets) { - if (rtp_session->missed_count >= rtp_session->max_missed_packets) { - ret = -2; - goto end; + if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_UDPTL)) { + rtp_session->missed_count += (poll_sec * 1000) / (rtp_session->ms_per_packet ? rtp_session->ms_per_packet / 1000 : 20); + bytes = 0; + + if (rtp_session->max_missed_packets) { + if (rtp_session->missed_count >= rtp_session->max_missed_packets) { + ret = -2; + goto end; + } } } - + if ((!(io_flags & SWITCH_IO_FLAG_NOBLOCK)) && (rtp_session->dtmf_data.out_digit_dur == 0 || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO))) { return_cng_frame(); commit 10109165b75dacb1a53fee2da0d4fa232abaeef0 Merge: 40aa1d9 ef880c5 Author: David Yat Sin <dyatsin@sangoma.com> Date: Tue Jan 11 15:42:54 2011 -0500 Merge branch 'master' of git://git.freeswitch.org/freeswitch commit 85e107a56e1cab1658fb6b0c8e04b9dbe8514d61 Author: Moises Silva <moy@sangoma.com> Date: Tue Jan 11 14:53:14 2011 -0500 freetdm: set channel name before caller profile otherwise the channel name is not set in 'show channels' diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 7ac1b28..a477be5 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1101,7 +1101,6 @@ static ftdm_status_t on_channel_found(ftdm_channel_t *fchan, ftdm_caller_data_t chan_id = ftdm_channel_get_id(fchan); tech_init(hdata->tech_pvt, hdata->new_session, fchan); - hdata->tech_pvt->caller_profile = hdata->caller_profile; snprintf(name, sizeof(name), "FreeTDM/%u:%u/%s", span_id, chan_id, caller_data->dnis.digits); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connect outbound channel %s\n", name); @@ -1110,6 +1109,9 @@ static ftdm_status_t on_channel_found(ftdm_channel_t *fchan, ftdm_caller_data_t switch_channel_set_variable_printf(channel, "freetdm_span_number", "%d", span_id); switch_channel_set_variable_printf(channel, "freetdm_chan_number", "%d", chan_id); + switch_channel_set_caller_profile(channel, hdata->caller_profile); + hdata->tech_pvt->caller_profile = hdata->caller_profile; + switch_channel_set_state(channel, CS_INIT); sess_uuid = switch_core_session_get_uuid(hdata->new_session); status = ftdm_channel_add_token(fchan, sess_uuid, ftdm_channel_get_token_count(fchan)); @@ -1395,7 +1397,6 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi if ((*new_session = switch_core_session_request(freetdm_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, flags, pool)) != 0) { private_t *tech_pvt; switch_caller_profile_t *caller_profile; - switch_channel_t *channel = switch_core_session_get_channel(*new_session); switch_core_session_add_stream(*new_session, NULL); if (!(tech_pvt = (private_t *) switch_core_session_alloc(*new_session, sizeof(private_t)))) { @@ -1408,7 +1409,6 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi caller_profile = switch_caller_profile_clone(*new_session, outbound_profile); caller_profile->destination_number = switch_core_strdup(caller_profile->pool, switch_str_nil(dest_num)); caller_profile->caller_id_number = switch_core_strdup(caller_profile->pool, switch_str_nil(callerid_num)); - switch_channel_set_caller_profile(channel, caller_profile); hunting.result_cb = on_channel_found; hunt_data.var_event = var_event; commit ef880c53b2dc730e212af914e1ac4fc9753eb5d2 Author: Brian West <brian@freeswitch.org> Date: Tue Jan 11 13:41:50 2011 -0600 Route is not an un-named header its named. Handled like full_via and full_from and such diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 9145d2a..904f3ec 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -161,6 +161,15 @@ static void extract_header_vars(sofia_profile_t *profile, sip_t const *sip, swit char *full; if (sip) { + if (sip->sip_route) { + if ((full = sip_header_as_string(profile->home, (void *) sip->sip_route))) { + const char *v = switch_channel_get_variable(channel, "sip_full_route"); + if (!v) { + switch_channel_set_variable(channel, "sip_full_route", full); + } + su_free(profile->home, full); + } + } if (sip->sip_via) { if ((full = sip_header_as_string(profile->home, (void *) sip->sip_via))) { const char *v = switch_channel_get_variable(channel, "sip_full_via"); @@ -7098,15 +7107,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ /* Loop thru unknown Headers Here so we can do something with them */ for (un = sip->sip_unknown; un; un = un->un_next) { - if (!strncasecmp(un->un_name, "Route", 5)) { - if (!zstr(un->un_value)) { - char *tmp_name; - if ((tmp_name = switch_mprintf("%s%s", SOFIA_SIP_HEADER_PREFIX, un->un_name))) { - switch_channel_set_variable(channel, tmp_name, un->un_value); - free(tmp_name); - } - } - } else if (!strncasecmp(un->un_name, "Diversion", 9)) { + if (!strncasecmp(un->un_name, "Diversion", 9)) { /* Basic Diversion Support for Diversion Indication in SIP */ /* draft-levy-sip-diversion-08 */ if (!zstr(un->un_value)) { commit f5c5fd9cc34dfad048b9f1218a36a1d5f165ae27 Author: Moises Silva <moy@sangoma.com> Date: Tue Jan 11 14:39:58 2011 -0500 freetdm: fix Windows compilation diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 3e0dfab..c0a7940 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2463,12 +2463,12 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_place(const char *file, const char FT_DECLARE(ftdm_status_t) _ftdm_call_place(const char *file, const char *func, int line, ftdm_caller_data_t *caller_data, ftdm_hunting_scheme_t *hunting) { - ftdm_assert_return(caller_data, FTDM_EINVAL, "Invalid caller data\n"); - ftdm_assert_return(hunting, FTDM_EINVAL, "Invalid hunting scheme\n"); - ftdm_status_t status = FTDM_SUCCESS; ftdm_channel_t *fchan = NULL; + ftdm_assert_return(caller_data, FTDM_EINVAL, "Invalid caller data\n"); + ftdm_assert_return(hunting, FTDM_EINVAL, "Invalid hunting scheme\n"); + if (hunting->mode == FTDM_HUNT_SPAN) { status = _ftdm_channel_open_by_span(hunting->mode_data.span.span_id, hunting->mode_data.span.direction, caller_data, &fchan); commit d41e6498f19e100eb8e9241784bb271b1e66c831 Author: Brian West <brian@freeswitch.org> Date: Tue Jan 11 12:25:41 2011 -0600 Set route header as a var on channel like Diversion header diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 381eb5d..9145d2a 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -7098,7 +7098,15 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ /* Loop thru unknown Headers Here so we can do something with them */ for (un = sip->sip_unknown; un; un = un->un_next) { - if (!strncasecmp(un->un_name, "Diversion", 9)) { + if (!strncasecmp(un->un_name, "Route", 5)) { + if (!zstr(un->un_value)) { + char *tmp_name; + if ((tmp_name = switch_mprintf("%s%s", SOFIA_SIP_HEADER_PREFIX, un->un_name))) { + switch_channel_set_variable(channel, tmp_name, un->un_value); + free(tmp_name); + } + } + } else if (!strncasecmp(un->un_name, "Diversion", 9)) { /* Basic Diversion Support for Diversion Indication in SIP */ /* draft-levy-sip-diversion-08 */ if (!zstr(un->un_value)) { commit a9eb0aa6efd0aff8ab64e597429757fdf1939c46 Author: Michael Jerris <mike@jerris.com> Date: Tue Jan 11 13:12:15 2011 -0500 attempt to quick fix solaris build diff --git a/Makefile.am b/Makefile.am index df1ee2e..8d35068 100644 --- a/Makefile.am +++ b/Makefile.am @@ -251,7 +251,8 @@ libfreeswitch_la_SOURCES = \ libs/miniupnpc/upnperrors.c \ libs/libnatpmp/natpmp.c \ libs/libnatpmp/getgateway.c\ - libs/spandsp/src/plc.c + libs/spandsp/src/plc.c \ + libs/spandsp/src/bit_operations.c if ENABLE_CPP libfreeswitch_la_SOURCES += src/switch_cpp.cpp commit 54421f591015496fd3c0c3da7a5221a84ab7c8e3 Author: Michael Jerris <mike@jerris.com> Date: Tue Jan 11 13:11:59 2011 -0500 mod_voicemail: add events for record/change greeting and record name diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 851ec77..1799e5c 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -1973,12 +1973,22 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) { TRY_CODE(switch_ivr_phrase_macro(session, VM_CHOOSE_GREETING_FAIL_MACRO, NULL, NULL, NULL)); } else { + switch_event_t *params; + TRY_CODE(switch_ivr_phrase_macro(session, VM_CHOOSE_GREETING_SELECTED_MACRO, input, NULL, NULL)); sql = switch_mprintf("update voicemail_prefs set greeting_path='%s' where username='%s' and domain='%s'", file_path, myid, domain_name); vm_execute_sql(profile, sql, profile->mutex); switch_safe_free(sql); + + switch_event_create_subclass(¶ms, SWITCH_EVENT_CUSTOM, VM_EVENT_MAINT); + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "VM-Action", "change-greeting"); + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "VM-Greeting-Path", file_path); + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "VM-User", myid); + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "VM-Domain", domain_name); + switch_channel_event_set_data(channel, params); + switch_event_fire(¶ms); } switch_safe_free(file_path); } else if (!strcmp(input, profile->record_greeting_key)) { @@ -1989,6 +1999,7 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p if (num < 1 || num > VM_MAX_GREETINGS) { TRY_CODE(switch_ivr_phrase_macro(session, VM_CHOOSE_GREETING_FAIL_MACRO, NULL, NULL, NULL)); } else { + switch_event_t *params; file_path = switch_mprintf("%s%sgreeting_%d.%s", dir_path, SWITCH_PATH_SEPARATOR, num, profile->file_ext); TRY_CODE(create_file(session, profile, VM_RECORD_GREETING_MACRO, file_path, &message_len, SWITCH_TRUE, NULL, NULL)); sql = @@ -1997,6 +2008,14 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p vm_execute_sql(profile, sql, profile->mutex); switch_safe_free(sql); switch_safe_free(file_path); + + switch_event_create_subclass(¶ms, SWITCH_EVENT_CUSTOM, VM_EVENT_MAINT); + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "VM-Action", "record-greeting"); + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "VM-Greeting-Path", file_path); + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "VM-User", myid); + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "VM-Domain", domain_name); + switch_channel_event_set_data(channel, params); + switch_event_fire(¶ms); } } else if (!strcmp(input, profile->change_pass_key)) { @@ -2027,12 +2046,21 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p switch_event_fire(¶ms); } else if (!strcmp(input, profile->record_name_key)) { + switch_event_t *params; file_path = switch_mprintf("%s%srecorded_name.%s", dir_path, SWITCH_PATH_SEPARATOR, profile->file_ext); TRY_CODE(create_file(session, profile, VM_RECORD_NAME_MACRO, file_path, &message_len, SWITCH_FALSE, NULL, NULL)); sql = switch_mprintf("update voicemail_prefs set name_path='%s' where username='%s' and domain='%s'", file_path, myid, domain_name); vm_execute_sql(profile, sql, profile->mutex); switch_safe_free(file_path); switch_safe_free(sql); + + switch_event_create_subclass(¶ms, SWITCH_EVENT_CUSTOM, VM_EVENT_MAINT); + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "VM-Action", "record-name"); + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "VM-Name-Path", file_path); + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "VM-User", myid); + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "VM-Domain", domain_name); + switch_channel_event_set_data(channel, params); + switch_event_fire(¶ms); } continue; } commit 6f103acd796ebcd7c0001a8d58568a3d77d2b3e6 Author: Jeff Lenk <jeff@jefflenk.com> Date: Tue Jan 11 09:40:59 2011 -0600 merge code from xml-rpc trunk - fix xml-rpc not terminating on windows on fs unload - only effect windows build diff --git a/libs/xmlrpc-c/lib/abyss/src/socket_win.c b/libs/xmlrpc-c/lib/abyss/src/socket_win.c index 92b2b99..d3f683a 100644 --- a/libs/xmlrpc-c/lib/abyss/src/socket_win.c +++ b/libs/xmlrpc-c/lib/abyss/src/socket_win.c @@ -9,8 +9,7 @@ #include <stdio.h> #include <string.h> #include <assert.h> -#include <winsock.h> -#include <errno.h> +#include <winsock2.h> #include "xmlrpc_config.h" #include "xmlrpc-c/util_int.h" @@ -249,6 +248,7 @@ struct socketWin { SOCKET winsock; bool userSuppliedWinsock; /* 'socket' was supplied by the user; it belongs to him */ + HANDLE interruptEvent; }; static @@ -322,6 +322,8 @@ channelDestroy(TChannel * const channelP) { if (!socketWinP->userSuppliedWinsock) closesocket(socketWinP->winsock); + CloseHandle(socketWinP->interruptEvent); + free(socketWinP); } @@ -430,9 +432,9 @@ channelWait(TChannel * const channelP, timedOut = TRUE; break; case -1: /* socket error */ - if (errno != EINTR) + if (WSAGetLastError() != WSAEINTR) failed = TRUE; - break; + break; default: if (FD_ISSET(socketWinP->winsock, &rfds)) readRdy = TRUE; @@ -460,7 +462,9 @@ channelInterrupt(TChannel * const channelP) { now or in the future. Actually, this is just a no-op because we don't yet know how to - accomplish that. + accomplish that. (But we could probably do it the same way + chanSwitchInterrupt() works -- no one has needed it enough yet to do that + work). -----------------------------------------------------------------------------*/ } @@ -484,7 +488,7 @@ ChannelWinGetPeerName(TChannel * const channelP, if (rc != 0) { int const lastError = WSAGetLastError(); - xmlrpc_asprintf(errorP, "getpeername() failed. WSAERROR = %d (%s)", + xmlrpc_asprintf(errorP, "getpeername() failed. WSA error = %d (%s)", lastError, getWSAError(lastError)); } else { if (addrlen != sizeof(sockAddr)) @@ -581,7 +585,8 @@ makeChannelFromWinsock(SOCKET const winsock, socketWinP->winsock = winsock; socketWinP->userSuppliedWinsock = TRUE; - + socketWinP->interruptEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + ChannelCreate(&channelVtbl, socketWinP, &channelP); if (channelP == NULL) @@ -591,8 +596,10 @@ makeChannelFromWinsock(SOCKET const winsock, *channelPP = channelP; *errorP = NULL; } - if (*errorP) + if (*errorP) { + CloseHandle(socketWinP->interruptEvent); free(socketWinP); + } } } @@ -632,7 +639,7 @@ ChannelWinCreateWinsock(SOCKET const fd, socklen_t peerAddrLen; int rc; - peerAddrLen = sizeof(peerAddrLen); + peerAddrLen = sizeof(peerAddr); rc = getpeername(fd, &peerAddr, &peerAddrLen); @@ -676,6 +683,8 @@ chanSwitchDestroy(TChanSwitch * const chanSwitchP) { if (!socketWinP->userSuppliedWinsock) closesocket(socketWinP->winsock); + CloseHandle(socketWinP->interruptEvent); + free(socketWinP); } @@ -711,6 +720,49 @@ chanSwitchListen(TChanSwitch * const chanSwitchP, +static void +createChannelForAccept(int const acceptedWinsock, + struct sockaddr const peerAddr, + TChannel ** const channelPP, + void ** const channelInfoPP, + const char ** const errorP) { + + struct abyss_win_chaninfo * channelInfoP; + makeChannelInfo(&channelInfoP, peerAddr, sizeof(peerAddr), errorP); + if (!*errorP) { + struct socketWin * acceptedSocketP; + + MALLOCVAR(acceptedSocketP); + + if (!acceptedSocketP) + xmlrpc_asprintf(errorP, "Unable to allocate memory"); + else { + TChannel * channelP; + + acceptedSocketP->winsock = acceptedWinsock; + acceptedSocketP->userSuppliedWinsock = FALSE; + acceptedSocketP->interruptEvent = + CreateEvent(NULL, FALSE, FALSE, NULL); + + ChannelCreate(&channelVtbl, acceptedSocketP, &channelP); + if (!channelP) + xmlrpc_asprintf(errorP, + "Failed to create TChannel object."); + else { + *errorP = NULL; + *channelPP = channelP; + *channelInfoPP = channelInfoP; + } + if (*errorP) { + CloseHandle(acceptedSocketP->interruptEvent); + free(acceptedSocketP); + } + } + } +} + + + static SwitchAcceptImpl chanSwitchAccept; static void @@ -728,7 +780,7 @@ chanSwitchAccept(TChanSwitch * const chanSwitchP, *channelPP == NULL. -----------------------------------------------------------------------------*/ struct socketWin * const listenSocketP = chanSwitchP->implP; - + HANDLE acceptEvent = WSACreateEvent(); bool interrupted; TChannel * channelP; @@ -736,46 +788,44 @@ chanSwitchAccept(TChanSwitch * const chanSwitchP, channelP = NULL; /* No connection yet */ *errorP = NULL; /* No error yet */ + WSAEventSelect(listenSocketP->winsock, acceptEvent, + FD_ACCEPT | FD_CLOSE | FD_READ); + while (!channelP && !*errorP && !interrupted) { + HANDLE interrupts[2] = {acceptEvent, listenSocketP->interruptEvent}; + int rc; struct sockaddr peerAddr; socklen_t size = sizeof(peerAddr); - int rc; + + rc = WaitForMultipleObjects(2, interrupts, FALSE, INFINITE); + if (WAIT_OBJECT_0 + 1 == rc) { + interrupted = TRUE; + continue; + }; rc = accept(listenSocketP->winsock, &peerAddr, &size); if (rc >= 0) { int const acceptedWinsock = rc; - struct socketWin * acceptedSocketP; - MALLOCVAR(acceptedSocketP); + createChannelForAccept(acceptedWinsock, peerAddr, + &channelP, channelInfoPP, errorP); - if (!acceptedSocketP) - xmlrpc_asprintf(errorP, "Unable to allocate memory"); - else { - acceptedSocketP->winsock = acceptedWinsock; - acceptedSocketP->userSuppliedWinsock = FALSE; - - *channelInfoPP = NULL; - - ChannelCreate(&channelVtbl, acceptedSocketP, &channelP); - if (!channelP) - xmlrpc_asprintf(errorP, - "Failed to create TChannel object."); - else - *errorP = NULL; - - if (*errorP) - free(acceptedSocketP); - } if (*errorP) closesocket(acceptedWinsock); - } else if (errno == EINTR) - interrupted = TRUE; - else - xmlrpc_asprintf(errorP, "accept() failed, errno = %d (%s)", - errno, strerror(errno)); + } else { + int const lastError = WSAGetLastError(); + + if (lastError == WSAEINTR) + interrupted = TRUE; + else + xmlrpc_asprintf(errorP, + "accept() failed, WSA error = %d (%s)", + lastError, getWSAError(lastError)); + } } *channelPP = channelP; + CloseHandle(acceptEvent); } @@ -787,15 +837,10 @@ chanSwitchInterrupt(TChanSwitch * const chanSwitchP) { /*---------------------------------------------------------------------------- Interrupt any waiting that a thread might be doing in chanSwitchAccept() now or in the future. - - Actually, this is just a no-op because we don't yet know how to - accomplish that. -----------------------------------------------------------------------------*/ - struct socketWin * const socketWinP = chanSwitchP->implP; - - if (!socketWinP->userSuppliedWinsock) - closesocket(socketWinP->winsock); + struct socketWin * const listenSocketP = chanSwitchP->implP; + SetEvent(listenSocketP->interruptEvent); } @@ -889,6 +934,7 @@ ChanSwitchWinCreate(uint16_t const portNumber, } else { socketWinP->winsock = winsock; socketWinP->userSuppliedWinsock = FALSE; + socketWinP->interruptEvent = CreateEvent(NULL, FALSE, FALSE, NULL); setSocketOptions(socketWinP->winsock, errorP); if (!*errorP) { @@ -899,8 +945,10 @@ ChanSwitchWinCreate(uint16_t const portNumber, chanSwitchPP); } - if (*errorP) + if (*errorP) { + CloseHandle(socketWinP->interruptEvent); closesocket(winsock); + } } if (*errorP) free(socketWinP); @@ -929,7 +977,8 @@ ChanSwitchWinCreateWinsock(SOCKET const winsock, socketWinP->winsock = winsock; socketWinP->userSuppliedWinsock = TRUE; - + socketWinP->interruptEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + ChanSwitchCreate(&chanSwitchVtbl, socketWinP, &chanSwitchP); if (chanSwitchP == NULL) @@ -939,8 +988,10 @@ ChanSwitchWinCreateWinsock(SOCKET const winsock, *chanSwitchPP = chanSwitchP; *errorP = NULL; } - if (*errorP) + if (*errorP) { + CloseHandle(socketWinP->interruptEvent); free(socketWinP); + } } } } commit b55db357d93c72ca712feb1e3ee91b60f026bdbf Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Jan 10 17:27:05 2011 -0600 add mod_fsk diff --git a/conf/autoload_configs/modules.conf.xml b/conf/autoload_configs/modules.conf.xml index 51c62f2..b7100bd 100644 --- a/conf/autoload_configs/modules.conf.xml +++ b/conf/autoload_configs/modules.conf.xml @@ -56,6 +56,7 @@ <load module="mod_fsv"/> <load module="mod_cluechoo"/> <load module="mod_valet_parking"/> + <!--<load module="mod_fsk"/>--> <!--<load module="mod_spy"/>--> <!-- SNOM Module --> commit 4fd043e3fb69a55dee43353547f2fb1fa24e7788 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Jan 10 17:27:01 2011 -0600 add mod_fsk diff --git a/build/modules.conf.in b/build/modules.conf.in index 69d90a8..2be000f 100644 --- a/build/modules.conf.in +++ b/build/modules.conf.in @@ -35,6 +35,7 @@ applications/mod_valet_parking #applications/mod_snapshot #applications/mod_snipe_hunt #applications/mod_callcenter +#applications/mod_fsk codecs/mod_g723_1 codecs/mod_amr #codecs/mod_amrwb commit fcc912a991a9513cc605ea0f3a24f96c2c4ccdfd Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Jan 10 17:26:14 2011 -0600 add mod_fsk diff --git a/src/mod/applications/mod_fsk/Makefile b/src/mod/applications/mod_fsk/Makefile new file mode 100644 index 0000000..620f3f7 --- /dev/null +++ b/src/mod/applications/mod_fsk/Makefile @@ -0,0 +1,6 @@ +BASE=../../../.. + +LOCAL_SOURCES=fsk.c uart.c fsk_callerid.c +LOCAL_OBJS=fsk.o uart.o fsk_callerid.o +include $(BASE)/build/modmake.rules + diff --git a/src/mod/applications/mod_fsk/fsk.c b/src/mod/applications/mod_fsk/fsk.c new file mode 100644 index 0000000..773b0de --- /dev/null +++ b/src/mod/applications/mod_fsk/fsk.c @@ -0,0 +1,351 @@ + +/* + * bell202.c + * + * Copyright (c) 2005 Robert Krten. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. + * + * This module contains a Bell-202 1200-baud FSK decoder, suitable for + * use in a library. The general style of the library calls is modeled + * after the POSIX pthread_*() functions. + * + * 2005 03 20 R. Krten created +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <math.h> + +#include "fsk.h" +#include "uart.h" + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +fsk_modem_definition_t fsk_modem_definitions[] = +{ + { /* FSK_V23_FORWARD_MODE1 */ 1700, 1300, 600 }, + { /* FSK_V23_FORWARD_MODE2 */ 2100, 1300, 1200 }, + { /* FSK_V23_BACKWARD */ 450, 390, 75 }, + { /* FSK_BELL202 */ 2200, 1200, 1200 }, +}; + +/* + * dsp_fsk_attr_init + * + * Initializes the attributes structure; this must be done before the + * attributes structure is used. +*/ + +void dsp_fsk_attr_init (dsp_fsk_attr_t *attr) +{ + memset(attr, 0, sizeof(*attr)); +} + +/* + * dsp_fsk_attr_get_bithandler + * dsp_fsk_attr_set_bithandler + * dsp_fsk_attr_get_bytehandler + * dsp_fsk_attr_set_bytehandler + * dsp_fsk_attr_getsamplerate + * dsp_fsk_attr_setsamplerate + * + * These functions get and set their respective elements from the + * attributes structure. If an error code is returned, it is just + * zero == ok, -1 == fail. +*/ + +bithandler_func_t dsp_fsk_attr_get_bithandler(dsp_fsk_attr_t *attr, void **bithandler_arg) +{ + *bithandler_arg = attr->bithandler_arg; + return attr->bithandler; +} + +void dsp_fsk_attr_set_bithandler(dsp_fsk_attr_t *attr, bithandler_func_t bithandler, void *bithandler_arg) +{ + attr->bithandler = bithandler; + attr->bithandler_arg = bithandler_arg; +} + +bytehandler_func_t dsp_fsk_attr_get_bytehandler(dsp_fsk_attr_t *attr, void **bytehandler_arg) +{ + *bytehandler_arg = attr->bytehandler_arg; + return attr->bytehandler; +} + +void dsp_fsk_attr_set_bytehandler(dsp_fsk_attr_t *attr, bytehandler_func_t bytehandler, void *bytehandler_arg) +{ + attr->bytehandler = bytehandler; + attr->bytehandler_arg = bytehandler_arg; +} + +int dsp_fsk_attr_get_samplerate (dsp_fsk_attr_t *attr) +{ + return attr->sample_rate; +} + +int dsp_fsk_attr_set_samplerate (dsp_fsk_attr_t *attr, int samplerate) +{ + if (samplerate <= 0) { + return -1; + } + attr->sample_rate = samplerate; + return 0; +} + +/* + * dsp_fsk_create + * + * Creates a handle for subsequent use. The handle is created to contain + * a context data structure for use by the sample handler function. The + * function expects an initialized attributes structure, and returns the + * handle or a NULL if there were errors. + * + * Once created, the handle can be used until it is destroyed. +*/ + +dsp_fsk_handle_t *dsp_fsk_create(dsp_fsk_attr_t *attr) +{ + int i; + double phi_mark, phi_space; + dsp_fsk_handle_t *handle; + + handle = malloc(sizeof(*handle)); + if (!handle) { + return NULL; + } + + memset(handle, 0, sizeof(*handle)); + + /* fill the attributes member */ + memcpy(&handle->attr, attr, sizeof(*attr)); + + /* see if we can do downsampling. We only really need 6 samples to "match" */ + if (attr->sample_rate / fsk_modem_definitions[FSK_BELL202].freq_mark > 6) { + handle->downsampling_count = attr->sample_rate / fsk_modem_definitions[FSK_BELL202].freq_mark / 6; + } else { + handle->downsampling_count = 1; + } + handle->current_downsample = 1; + + /* calculate the correlate size (number of samples required for slowest wave) */ + handle->corrsize = attr->sample_rate / handle->downsampling_count / fsk_modem_definitions[FSK_BELL202].freq_mark; + + /* allocate the correlation sin/cos arrays and initialize */ + for (i = 0; i < 4; i++) { + handle->correlates[i] = malloc(sizeof(double) * handle->corrsize); + if (handle->correlates[i] == NULL) { + /* some failed, back out memory allocations */ + dsp_fsk_destroy(&handle); + return NULL; + } + } + + /* now initialize them */ + phi_mark = 2. * M_PI / ((double) attr->sample_rate / (double) handle->downsampling_count / (double) fsk_modem_definitions[FSK_BELL202].freq_mark); + phi_space = 2. * M_PI / ((double) attr->sample_rate / (double) handle->downsampling_count / (double) fsk_modem_definitions[FSK_BELL202].freq_space); + + for (i = 0; i < handle->corrsize; i++) { + handle->correlates[0][i] = sin(phi_mark * (double) i); + handle->correlates[1][i] = cos(phi_mark * (double) i); + handle->correlates[2][i] = sin(phi_space * (double) i); + handle->correlates[3][i] = cos(phi_space * (double) i); + } + + /* initialize the ring buffer */ + handle->buffer = malloc(sizeof(double) * handle->corrsize); + if (!handle->buffer) { /* failed; back out memory allocations */ + dsp_fsk_destroy(&handle); + return NULL; + } + memset(handle->buffer, 0, sizeof(double) * handle->corrsize); + handle->ringstart = 0; + + /* initalize intra-cell position */ + handle->cellpos = 0; + handle->celladj = fsk_modem_definitions[FSK_BELL202].baud_rate / (double) attr->sample_rate * (double) handle->downsampling_count; + + /* if they have provided a byte handler, add a UART to the processing chain */ + if (handle->attr.bytehandler) { + dsp_uart_attr_t uart_attr; + dsp_uart_handle_t *uart_handle; + + dsp_uart_attr_init(&uart_attr); + dsp_uart_attr_set_bytehandler(&uart_attr, handle->attr.bytehandler, handle->attr.bytehandler_arg); + uart_handle = dsp_uart_create(&uart_attr); + if (uart_handle == NULL) { + dsp_fsk_destroy(&handle); + return NULL; + } + handle->attr.bithandler = dsp_uart_bit_handler; + handle->attr.bithandler_arg = uart_handle; + } + + return handle; +} + +/* + * dsp_fsk_destroy + * + * Destroys a handle, releasing any associated memory. Sets handle pointer to NULL + * so A destroyed handle can not be used for anything after the destroy. +*/ + +void dsp_fsk_destroy(dsp_fsk_handle_t **handle) +{ + int i; + + /* if empty handle, just return */ + if (*handle == NULL) { + return; + } + + for (i = 0; i < 4; i++) { + if ((*handle)->correlates[i] != NULL) { + free((*handle)->correlates[i]); + (*handle)->correlates[i] = NULL; + } + } + + if ((*handle)->buffer != NULL) { + free((*handle)->buffer); + (*handle)->buffer = NULL; + } + + if ((*handle)->attr.bytehandler) { + dsp_uart_handle_t** dhandle = (void *)(&(*handle)->attr.bithandler_arg); + dsp_uart_destroy(dhandle); + } + + free(*handle); + *handle = NULL; +} + +/* + * dsp_fsk_sample + * + * This is the main processing entry point. The function accepts a normalized + * sample (i.e., one whose range is between -1 and +1). The function performs + * the Bell-202 FSK modem decode processing, and, if it detects a valid bit, + * will call the bithandler associated with the attributes structure. + * + * For the Bell-202 standard, a logical zero (space) is 2200 Hz, and a logical + * one (mark) is 1200 Hz. +*/ + +void +dsp_fsk_sample (dsp_fsk_handle_t *handle, double normalized_sample) +{ + double val; + double factors[4]; + int i, j; + + /* if we can avoid processing samples, do so */ + if (handle->downsampling_count != 1) { + if (handle->current_downsample < handle->downsampling_count) { + handle->current_downsample++; + return; /* throw this sample out */ + } + handle->current_downsample = 1; + } + + /* store sample in buffer */ + handle->buffer[handle->ringstart++] = normalized_sample; + if (handle->ringstart >= handle->corrsize) { + handle->ringstart = 0; + } + + /* do the correlation calculation */ + factors[0] = factors[1] = factors[2] = factors[3] = 0; /* clear out intermediate sums */ + j = handle->ringstart; + for (i = 0; i < handle->corrsize; i++) { + if (j >= handle->corrsize) { + j = 0; + } + val = handle->buffer[j]; + factors[0] += handle->correlates[0][i] * val; + factors[1] += handle->correlates[1][i] * val; + factors[2] += handle->correlates[2][i] * val; + factors[3] += handle->correlates[3][i] * val; + j++; + } + + /* store the bit (bit value is comparison of the two sets of correlate factors) */ + handle->previous_bit = handle->current_bit; + handle->current_bit = (factors[0] * factors[0] + factors[1] * factors[1] > factors[2] * factors[2] + factors[3] * factors[3]); + + /* if there's a transition, we can synchronize the cell position */ + if (handle->previous_bit != handle->current_bit) { + handle->cellpos = 0.5; /* adjust cell position to be in the middle of the cell */ + } + handle->cellpos += handle->celladj; /* walk the cell along */ + + if (handle->cellpos > 1.0) { + handle->cellpos -= 1.0; + + switch (handle->state) { + case FSK_STATE_DATA: + { + + (*handle->attr.bithandler) (handle->attr.bithandler_arg, handle->current_bit); + } + break; + case FSK_STATE_CHANSEIZE: + { + + if (handle->last_bit != handle->current_bit) { + handle->conscutive_state_bits++; + } else { + handle->conscutive_state_bits = 0; + } + + if (handle->conscutive_state_bits > 15) { + handle->state = FSK_STATE_CARRIERSIG; + handle->conscutive_state_bits = 0; + } + } + break; + case FSK_STATE_CARRIERSIG: + { + if (handle->current_bit) { + handle->conscutive_state_bits++; + } else { + handle->conscutive_state_bits = 0; + } + + if (handle->conscutive_state_bits > 15) { + handle->state = FSK_STATE_DATA; + handle->conscutive_state_bits = 0; + } + } + break; + } + + handle->last_bit = handle->current_bit; + } +} + diff --git a/src/mod/applications/mod_fsk/fsk.h b/src/mod/applications/mod_fsk/fsk.h new file mode 100644 index 0000000..b098444 --- /dev/null +++ b/src/mod/applications/mod_fsk/fsk.h @@ -0,0 +1,113 @@ +/* + * bell202.h + * + * Copyright (c) 2005 Robert Krten. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. + * + * This module contains the manifest constants and declarations for + * the Bell-202 1200 baud FSK modem. + * + * 2005 03 20 R. Krten created +*/ + +#ifndef __FSK_H__ +#define __FSK_H__ +#include "uart.h" + +typedef struct { + int freq_space; /* Frequency of the 0 bit */ + int freq_mark; /* Frequency of the 1 bit */ + int baud_rate; /* baud rate for the modem */ +} fsk_modem_definition_t; + +/* Must be kept in sync with fsk_modem_definitions array in fsk.c */ +/* V.23 definitions: http://www.itu.int/rec/recommendation.asp?type=folders&lang=e&parent=T-REC-V... */ +typedef enum { + FSK_V23_FORWARD_MODE1 = 0, /* Maximum 600 bps for long haul */ + FSK_V23_FORWARD_MODE2, /* Standard 1200 bps V.23 */ + FSK_V23_BACKWARD, /* 75 bps return path for V.23 */ + FSK_BELL202 /* Bell 202 half-duplex 1200 bps */ +} fsk_modem_types_t; + +typedef enum { + FSK_STATE_CHANSEIZE = 0, + FSK_STATE_CARRIERSIG, + FSK_STATE_DATA +} fsk_state_t; + +typedef struct dsp_fsk_attr_s +{ + int sample_rate; /* sample rate in HZ */ + bithandler_func_t bithandler; /* bit handler */ + void *bithandler_arg; /* arbitrary ID passed to bithandler as first argument */ + bytehandler_func_t bytehandler; /* byte handler */ + void *bytehandler_arg; /* arbitrary ID passed to bytehandler as first argument */ +} dsp_fsk_attr_t; + +typedef struct +{ + fsk_state_t state; + dsp_fsk_attr_t attr; /* attributes structure */ + double *correlates[4]; /* one for each of sin/cos for mark/space */ + int corrsize; /* correlate size (also number of samples in ring buffer) */ + double *buffer; /* sample ring buffer */ + int ringstart; /* ring buffer start offset */ + double cellpos; /* bit cell position */ + double celladj; /* bit cell adjustment for each sample */ + int previous_bit; /* previous bit (for detecting a transition to sync-up cell position) */ + int current_bit; /* current bit */ + int last_bit; + int downsampling_count; /* number of samples to skip */ + int current_downsample; /* current skip count */ + int conscutive_state_bits; /* number of bits in a row that matches the pattern for the current state */ +} dsp_fsk_handle_t; + +/* + * Function prototypes + * + * General calling order is: + * a) create the attributes structure (dsp_fsk_attr_init) + * b) initialize fields in the attributes structure (dsp_fsk_attr_set_*) + * c) create a Bell-202 handle (dsp_fsk_create) + * d) feed samples through the handler (dsp_fsk_sample) +*/ + +void dsp_fsk_attr_init(dsp_fsk_attr_t *attributes); + +bithandler_func_t dsp_fsk_attr_get_bithandler(dsp_fsk_attr_t *attributes, void **bithandler_arg); +void dsp_fsk_attr_set_bithandler(dsp_fsk_attr_t *attributes, bithandler_func_t bithandler, void *bithandler_arg); +bytehandler_func_t dsp_fsk_attr_get_bytehandler(dsp_fsk_attr_t *attributes, void **bytehandler_arg); +void dsp_fsk_attr_set_bytehandler(dsp_fsk_attr_t *attributes, bytehandler_func_t bytehandler, void *bytehandler_arg); +int dsp_fsk_attr_get_samplerate(dsp_fsk_attr_t *attributes); +int dsp_fsk_attr_set_samplerate(dsp_fsk_attr_t *attributes, int samplerate); + +dsp_fsk_handle_t * dsp_fsk_create(dsp_fsk_attr_t *attributes); +void dsp_fsk_destroy(dsp_fsk_handle_t **handle); + +void dsp_fsk_sample(dsp_fsk_handle_t *handle, double normalized_sample); + +extern fsk_modem_definition_t fsk_modem_definitions[]; + +#endif + diff --git a/src/mod/applications/mod_fsk/fsk_callerid.c b/src/mod/applications/mod_fsk/fsk_callerid.c new file mode 100644 index 0000000..2146f66 --- /dev/null +++ b/src/mod/applications/mod_fsk/fsk_callerid.c @@ -0,0 +1,398 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> + * + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (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.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * + * The Initial Developer of the Original Code is + * Anthony Minessale II <anthm@freeswitch.org> + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Anthony Minessale II <anthm@freeswitch.org> + * + * mod_fsk -- FSK data transfer + * + */ + +#include "switch.h" +#include "fsk_callerid.h" + +void bitstream_init(bitstream_t *bsp, uint8_t *data, uint32_t datalen, endian_t endian, uint8_t ss) +{ + memset(bsp, 0, sizeof(*bsp)); + bsp->data = data; + bsp->datalen = datalen; + bsp->endian = endian; + bsp->ss = ss; + + if (endian < 0) { + bsp->top = bsp->bit_index = 7; + bsp->bot = 0; + } else { + bsp->top = bsp->bit_index = 0; + bsp->bot = 7; + } + +} + +int8_t bitstream_get_bit(bitstream_t *bsp) +{ + int8_t bit = -1; + + + if (bsp->byte_index >= bsp->datalen) { + goto done; + } + + if (bsp->ss) { + if (!bsp->ssv) { + bsp->ssv = 1; + return 0; + } else if (bsp->ssv == 2) { + bsp->byte_index++; + bsp->ssv = 0; + return 1; + } + } + + bit = (bsp->data[bsp->byte_index] >> (bsp->bit_index)) & 1; + + if (bsp->bit_index == bsp->bot) { + bsp->bit_index = bsp->top; + if (bsp->ss) { + bsp->ssv = 2; + goto done; + } + + if (++bsp->byte_index > bsp->datalen) { + bit = -1; + goto done; + } + + } else { + bsp->bit_index = bsp->bit_index + bsp->endian; + } + + + done: + return bit; +} + + + +static void fsk_byte_handler (void *x, int data) +{ + fsk_data_state_t *state = (fsk_data_state_t *) x; + uint8_t byte = (uint8_t)data; + + top: + + if (state->init == 3) { + return; + } + + if (state->dlen) { + goto add_byte; + } + + if (state->bpos == 1) { + state->blen = byte; + + if ((uint32_t)(state->dlen = state->bpos + byte + 2) > state->bufsize) { + state->dlen = state->bufsize; + } + goto top; + } + + add_byte: + + if (state->bpos <= state->dlen) { + state->buf[state->bpos++] = byte; + } else { + state->init = 3; + } +} + +switch_status_t fsk_data_init(fsk_data_state_t *state, uint8_t *data, uint32_t datalen) +{ + memset(state, 0, sizeof(*state)); + state->buf = data; + state->bufsize = datalen; + state->bpos = 2; + + return SWITCH_STATUS_SUCCESS; +} + +switch_status_t fsk_data_add_sdmf(fsk_data_state_t *state, const char *date, char *number) +{ + size_t dlen = strlen(date); + size_t nlen = strlen(number); + + state->buf[0] = CID_TYPE_SDMF; + memcpy(&state->buf[state->bpos], date, dlen); + state->bpos += dlen; + memcpy(&state->buf[state->bpos], number, nlen); + state->bpos += nlen; + + return SWITCH_STATUS_SUCCESS; +} + +switch_status_t fsk_data_add_mdmf(fsk_data_state_t *state, mdmf_type_t type, const uint8_t *data, uint32_t datalen) +{ + state->buf[0] = CID_TYPE_MDMF; + state->buf[state->bpos++] = type; + state->buf[state->bpos++] = (uint8_t)datalen; + memcpy(&state->buf[state->bpos], data, datalen); + state->bpos += datalen; + return SWITCH_STATUS_SUCCESS; +} + + +switch_status_t fsk_data_add_checksum(fsk_data_state_t *state) +{ + uint32_t i; + uint8_t check = 0; + + state->buf[1] = (uint8_t)(state->bpos - 2); + + for (i = 0; i < state->bpos; i++) { + check = check + state->buf[i]; + } + + state->checksum = state->buf[state->bpos] = (uint8_t)(256 - check); + state->bpos++; + + state->dlen = state->bpos; + state->blen = state->buf[1]; + + return SWITCH_STATUS_SUCCESS; +} + + +switch_status_t fsk_data_parse(fsk_data_state_t *state, size_t *type, char **data, size_t *len) +{ + + size_t i; + int sum = 0; + + top: + + if (state->checksum != 0 || state->ppos >= state->dlen - 1) { + return SWITCH_STATUS_FALSE; + } + + if (!state->ppos) { + for(i = 0; i < state->bpos; i++) { + sum += state->buf[i]; + } + state->checksum = sum % 256; + state->ppos = 2; + + if (state->buf[0] != CID_TYPE_MDMF && state->buf[0] != CID_TYPE_SDMF) { + state->checksum = -1; + } + goto top; + } + + if (state->buf[0] == CID_TYPE_SDMF) { + /* convert sdmf to mdmf so we don't need 2 parsers */ + if (state->ppos == 2) { + *type = MDMF_DATETIME; + *len = 8; + } else { + if (state->buf[state->ppos] == 'P' || state->buf[state->ppos] == 'O') { + *type = MDMF_NO_NUM; + *len = 1; + } else { + *type = MDMF_PHONE_NUM; + *len = state->blen - 8; + } + } + *data = (char *)&state->buf[state->ppos]; + state->ppos += *len; + return SWITCH_STATUS_SUCCESS; + } else if (state->buf[0] == CID_TYPE_MDMF) { + *type = state->buf[state->ppos++]; + *len = state->buf[state->ppos++]; + *data = (char *)&state->buf[state->ppos]; + state->ppos += *len; + return SWITCH_STATUS_SUCCESS; + } + + return SWITCH_STATUS_FALSE; +} + +switch_status_t fsk_demod_feed(fsk_data_state_t *state, int16_t *data, size_t samples) +{ + uint32_t x; + int16_t *sp = data; + + if (state->init == 3) { + return SWITCH_STATUS_FALSE; + } + + for (x = 0; x < samples; x++) { + dsp_fsk_sample (state->fsk1200_handle, (double) *sp++ / 32767.0); + if (state->dlen && state->bpos >= state->dlen) { + state->init = 3; + return SWITCH_STATUS_FALSE; + } + } + + return SWITCH_STATUS_SUCCESS; +} + +switch_status_t fsk_demod_destroy(fsk_data_state_t *state) +{ + dsp_fsk_destroy(&state->fsk1200_handle); + memset(state, 0, sizeof(*state)); + return SWITCH_STATUS_SUCCESS; +} + +int fsk_demod_init(fsk_data_state_t *state, int rate, uint8_t *buf, size_t bufsize) +{ + + dsp_fsk_attr_t fsk1200_attr; + + if (state->fsk1200_handle) { + dsp_fsk_destroy(&state->fsk1200_handle); + } + + memset(state, 0, sizeof(*state)); + memset(buf, 0, bufsize); + state->buf = buf; + state->bufsize = bufsize; + + dsp_fsk_attr_init (&fsk1200_attr); + dsp_fsk_attr_set_samplerate (&fsk1200_attr, rate); + dsp_fsk_attr_set_bytehandler (&fsk1200_attr, fsk_byte_handler, state); + state->fsk1200_handle = dsp_fsk_create (&fsk1200_attr); + + if (state->fsk1200_handle == NULL) { + return SWITCH_STATUS_FALSE; + } + + return SWITCH_STATUS_SUCCESS; +} + +size_t fsk_modulator_generate_bit(fsk_modulator_t *fsk_trans, int8_t bit, int16_t *buf, size_t buflen) +{ + size_t i; + + for(i = 0 ; i < buflen; i++) { + fsk_trans->bit_accum += fsk_trans->bit_factor; + if (fsk_trans->bit_accum >= FSK_MOD_FACTOR) { + fsk_trans->bit_accum -= (FSK_MOD_FACTOR + fsk_trans->bit_factor); + break; + } + + buf[i] = teletone_dds_state_modulate_sample(&fsk_trans->dds, bit); + } + + return i; +} + + +int32_t fsk_modulator_generate_carrier_bits(fsk_modulator_t *fsk_trans, uint32_t bits) +{ + uint32_t i = 0; + size_t r = 0; + int8_t bit = 1; + + for (i = 0; i < bits; i++) { + if ((r = fsk_modulator_generate_bit(fsk_trans, bit, fsk_trans->sample_buffer, sizeof(fsk_trans->sample_buffer) / 2))) { + if (fsk_trans->write_sample_callback(fsk_trans->sample_buffer, r, fsk_trans->user_data) != SWITCH_STATUS_SUCCESS) { + break; + } + } else { + break; + } + } + + return i; +} + + +void fsk_modulator_generate_chan_sieze(fsk_modulator_t *fsk_trans) +{ + uint32_t i = 0; + size_t r = 0; + int8_t bit = 0; + + for (i = 0; i < fsk_trans->chan_sieze_bits; i++) { + if ((r = fsk_modulator_generate_bit(fsk_trans, bit, fsk_trans->sample_buffer, sizeof(fsk_trans->sample_buffer) / 2))) { + if (fsk_trans->write_sample_callback(fsk_trans->sample_buffer, r, fsk_trans->user_data) != SWITCH_STATUS_SUCCESS) { + break; + } + } else { + break; + } + bit = !bit; + } + + +} + + +void fsk_modulator_send_data(fsk_modulator_t *fsk_trans) +{ + size_t r = 0; + int8_t bit = 0; + + while((bit = bitstream_get_bit(&fsk_trans->bs)) > -1) { + if ((r = fsk_modulator_generate_bit(fsk_trans, bit, fsk_trans->sample_buffer, sizeof(fsk_trans->sample_buffer) / 2))) { + if (fsk_trans->write_sample_callback(fsk_trans->sample_buffer, r, fsk_trans->user_data) != SWITCH_STATUS_SUCCESS) { + break; + } + } else { + break; + } + } +} + + +switch_status_t fsk_modulator_init(fsk_modulator_t *fsk_trans, + fsk_modem_types_t modem_type, + uint32_t sample_rate, + fsk_data_state_t *fsk_data, + float db_level, + uint32_t carrier_bits_start, + uint32_t carrier_bits_stop, + uint32_t chan_sieze_bits, + fsk_write_sample_t write_sample_callback, + void *user_data) +{ + memset(fsk_trans, 0, sizeof(*fsk_trans)); + fsk_trans->modem_type = modem_type; + teletone_dds_state_set_tone(&fsk_trans->dds, fsk_modem_definitions[fsk_trans->modem_type].freq_space, sample_rate, 0); + teletone_dds_state_set_tone(&fsk_trans->dds, fsk_modem_definitions[fsk_trans->modem_type].freq_mark, sample_rate, 1); + fsk_trans->bit_factor = (uint32_t)((fsk_modem_definitions[fsk_trans->modem_type].baud_rate * FSK_MOD_FACTOR) / (float)sample_rate); + fsk_trans->samples_per_bit = (uint32_t) (sample_rate / fsk_modem_definitions[fsk_trans->modem_type].baud_rate); + fsk_trans->est_bytes = (int32_t)(((fsk_data->dlen * 10) + carrier_bits_start + carrier_bits_stop + chan_sieze_bits) * ((fsk_trans->samples_per_bit + 1) * 2)); + fsk_trans->bit_accum = 0; + fsk_trans->fsk_data = fsk_data; + teletone_dds_state_set_tx_level(&fsk_trans->dds, db_level); + bitstream_init(&fsk_trans->bs, fsk_trans->fsk_data->buf, (uint32_t)fsk_trans->fsk_data->dlen, ENDIAN_BIG, 1); + fsk_trans->carrier_bits_start = carrier_bits_start; + fsk_trans->carrier_bits_stop = carrier_bits_stop; + fsk_trans->chan_sieze_bits = chan_sieze_bits; + fsk_trans->write_sample_callback = write_sample_callback; + fsk_trans->user_data = user_data; + return SWITCH_STATUS_SUCCESS; +} + diff --git a/src/mod/applications/mod_fsk/fsk_callerid.h b/src/mod/applications/mod_fsk/fsk_callerid.h new file mode 100644 index 0000000..9018201 --- /dev/null +++ b/src/mod/applications/mod_fsk/fsk_callerid.h @@ -0,0 +1,144 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> + * + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (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.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * + * The Initial Developer of the Original Code is + * Anthony Minessale II <anthm@freeswitch.org> + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Anthony Minessale II <anthm@freeswitch.org> + * + * mod_fsk -- FSK data transfer + * + */ +#ifndef __FSK_CALLER_ID_H +#define __FSK_CALLER_ID_H +SWITCH_BEGIN_EXTERN_C +#include "fsk.h" +#include "uart.h" + +#define FSK_MOD_FACTOR 0x10000 + +typedef enum { + ENDIAN_BIG = 1, + ENDIAN_LITTLE = -1 +} endian_t; + +typedef enum { + CID_TYPE_SDMF = 0x04, + CID_TYPE_MDMF = 0x80 +} cid_type_t; + +typedef enum { + MDMF_DATETIME = 1, + MDMF_PHONE_NUM = 2, + MDMF_DDN = 3, + MDMF_NO_NUM = 4, + MDMF_PHONE_NAME = 7, + MDMF_NO_NAME = 8, + MDMF_ALT_ROUTE = 9, + MDMF_NAME_VALUE = 10, + MDMF_INVALID = 11 +} mdmf_type_t; + +struct bitstream { + uint8_t *data; + uint32_t datalen; + uint32_t byte_index; + uint8_t bit_index; + int8_t endian; + uint8_t top; + uint8_t bot; + uint8_t ss; + uint8_t ssv; +}; + +struct fsk_data_state { + dsp_fsk_handle_t *fsk1200_handle; + uint8_t init; + uint8_t *buf; + size_t bufsize; + size_t blen; + size_t bpos; + size_t dlen; + size_t ppos; + int checksum; +}; + +typedef struct bitstream bitstream_t; +typedef struct fsk_data_state fsk_data_state_t; +typedef switch_status_t (*fsk_write_sample_t)(int16_t *buf, size_t buflen, void *user_data); + +struct fsk_modulator { + teletone_dds_state_t dds; + bitstream_t bs; + uint32_t carrier_bits_start; + uint32_t carrier_bits_stop; + uint32_t chan_sieze_bits; + uint32_t bit_factor; + uint32_t bit_accum; + uint32_t sample_counter; + int32_t samples_per_bit; + int32_t est_bytes; + fsk_modem_types_t modem_type; + fsk_data_state_t *fsk_data; + fsk_write_sample_t write_sample_callback; + void *user_data; + int16_t sample_buffer[64]; +}; + + +typedef int (*fsk_data_decoder_t)(fsk_data_state_t *state); + +typedef void (*logger_t)(const char *file, const char *func, int line, int level, const char *fmt, ...); +typedef struct fsk_modulator fsk_modulator_t; + +switch_status_t fsk_data_init(fsk_data_state_t *state, uint8_t *data, uint32_t datalen); +void bitstream_init(bitstream_t *bsp, uint8_t *data, uint32_t datalen, endian_t endian, uint8_t ss); +int8_t bitstream_get_bit(bitstream_t *bsp); +switch_status_t fsk_data_add_mdmf(fsk_data_state_t *state, mdmf_type_t type, const uint8_t *data, uint32_t datalen); +switch_status_t fsk_data_add_checksum(fsk_data_state_t *state); +switch_status_t fsk_data_parse(fsk_data_state_t *state, size_t *type, char **data, size_t *len); +switch_status_t fsk_demod_feed(fsk_data_state_t *state, int16_t *data, size_t samples); +switch_status_t fsk_demod_destroy(fsk_data_state_t *state); +int fsk_demod_init(fsk_data_state_t *state, int rate, uint8_t *buf, size_t bufsize); +size_t fsk_modulator_generate_bit(fsk_modulator_t *fsk_trans, int8_t bit, int16_t *buf, size_t buflen); +int32_t fsk_modulator_generate_carrier_bits(fsk_modulator_t *fsk_trans, uint32_t bits); +void fsk_modulator_generate_chan_sieze(fsk_modulator_t *fsk_trans); +void fsk_modulator_send_data(fsk_modulator_t *fsk_trans); +switch_status_t fsk_modulator_init(fsk_modulator_t *fsk_trans, + fsk_modem_types_t modem_type, + uint32_t sample_rate, + fsk_data_state_t *fsk_data, + float db_level, + uint32_t carrier_bits_start, + uint32_t carrier_bits_stop, + uint32_t chan_sieze_bits, + fsk_write_sample_t write_sample_callback, + void *user_data); + + +#define fsk_modulator_send_all(_it) fsk_modulator_generate_chan_sieze(_it); \ + fsk_modulator_generate_carrier_bits(_it, _it->carrier_bits_start); \ + fsk_modulator_send_data(_it); \ + fsk_modulator_generate_carrier_bits(_it, _it->carrier_bits_stop) + +SWITCH_END_EXTERN_C +#endif diff --git a/src/mod/applications/mod_fsk/mod_fsk.c b/src/mod/applications/mod_fsk/mod_fsk.c new file mode 100644 index 0000000..9802353 --- /dev/null +++ b/src/mod/applications/mod_fsk/mod_fsk.c @@ -0,0 +1,486 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> + * + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (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.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * + * The Initial Developer of the Original Code is + * Anthony Minessale II <anthm@freeswitch.org> + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Anthony Minessale II <anthm@freeswitch.org> + * + * mod_fsk.c -- FSK data transfer + * + */ +#include <switch.h> +#include "fsk_callerid.h" + +/* Prototypes */ +SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_fsk_shutdown); +SWITCH_MODULE_RUNTIME_FUNCTION(mod_fsk_runtime); +SWITCH_MODULE_LOAD_FUNCTION(mod_fsk_load); + +/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) + * Defines a switch_loadable_module_function_table_t and a static const char[] modname + */ +SWITCH_MODULE_DEFINITION(mod_fsk, mod_fsk_load, mod_fsk_shutdown, NULL); + +switch_status_t my_write_sample(int16_t *buf, size_t buflen, void *user_data) +{ + switch_buffer_t *buffer = (switch_buffer_t *) user_data; + + switch_buffer_write(buffer, buf, buflen * 2); + + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t write_fsk_data(uint32_t rate, int32_t db, switch_buffer_t *buffer, switch_event_t *event, const char *prefix) +{ + fsk_modulator_t fsk_trans; + fsk_data_state_t fsk_data = {0}; + uint8_t databuf[1024] = ""; + char time_str[9]; + struct tm tm; + time_t now; + switch_event_header_t *hp; + switch_size_t plen = 0; + + memset(&fsk_trans, 0, sizeof(fsk_trans)); + + time(&now); + localtime_r(&now, &tm); + strftime(time_str, sizeof(time_str), "%m%d%H%M", &tm); + + fsk_data_init(&fsk_data, databuf, sizeof(databuf)); + fsk_data_add_mdmf(&fsk_data, MDMF_DATETIME, (uint8_t *)time_str, strlen(time_str)); + + if (prefix) { + plen = strlen(prefix); + } + + + if (event) { + for (hp = event->headers; hp; hp = hp->next) { + char *packed; + char *name = hp->name; + + if (plen && strncasecmp(name, prefix, plen)) { + continue; + } + + name += plen; + + if (zstr(name)) { + continue; + } + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Encoding [%s][%s]\n", hp->name, hp->value); + + if (!strcasecmp(name, "phone_num")) { + fsk_data_add_mdmf(&fsk_data, MDMF_PHONE_NUM, (uint8_t *)hp->value, strlen(hp->value)); + } else if (!strcasecmp(name, "phone_name")) { + fsk_data_add_mdmf(&fsk_data, MDMF_PHONE_NAME, (uint8_t *)hp->value, strlen(hp->value)); + } else { + packed = switch_mprintf("%q:%q", name, hp->value); + fsk_data_add_mdmf(&fsk_data, MDMF_NAME_VALUE, (uint8_t *)packed, strlen(packed)); + free(packed); + } + } + } + + fsk_data_add_checksum(&fsk_data); + + fsk_modulator_init(&fsk_trans, FSK_BELL202, rate, &fsk_data, db, 180, 5, 300, my_write_sample, buffer); + fsk_modulator_send_all((&fsk_trans)); + + fsk_demod_destroy(&fsk_data); + + return SWITCH_STATUS_SUCCESS; +} + + +SWITCH_STANDARD_APP(fsk_send_function) { + switch_event_t *event = NULL; + switch_buffer_t *buffer; + switch_slin_data_t sdata = { 0 }; + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_frame_t *read_frame; + switch_status_t status; + + + if (data) { + switch_ivr_sleep(session, 1000, SWITCH_TRUE, NULL); + switch_core_session_send_dtmf_string(session, (const char *) data); + switch_ivr_sleep(session, 1500, SWITCH_TRUE, NULL); + } + + if (switch_core_session_set_codec_slin(session, &sdata) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), + SWITCH_LOG_ERROR, "FAILURE\n"); + return; + } + + switch_buffer_create_dynamic(&buffer, 1024, 2048, 0); + + switch_channel_get_variables(channel, &event); + + write_fsk_data(sdata.codec.implementation->actual_samples_per_second, -14, buffer, event, "fsk_"); + + while(switch_channel_ready(channel)) { + status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); + + if (!SWITCH_READ_ACCEPTABLE(status)) { + break; + } + + if ((sdata.write_frame.datalen = switch_buffer_read(buffer, sdata.write_frame.data, + sdata.codec.implementation->decoded_bytes_per_packet)) <= 0) { + break; + } + + + if (sdata.write_frame.datalen < sdata.codec.implementation->decoded_bytes_per_packet) { + memset((char *)sdata.write_frame.data + sdata.write_frame.datalen, 255, + sdata.codec.implementation->decoded_bytes_per_packet - sdata.write_frame.datalen); + sdata.write_frame.datalen = sdata.codec.implementation->decoded_bytes_per_packet; + } + sdata.write_frame.samples = sdata.write_frame.datalen / 2; + switch_core_session_write_frame(sdata.session, &sdata.write_frame, SWITCH_IO_FLAG_NONE, 0); + } + + switch_buffer_destroy(&buffer); + switch_core_codec_destroy(&sdata.codec); + switch_core_session_set_read_codec(session, NULL); + +} + +typedef struct { + switch_core_session_t *session; + fsk_data_state_t fsk_data; + uint8_t fbuf[512]; + int skip; +} switch_fsk_detect_t; + + + + +static switch_bool_t fsk_detect_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type) +{ + switch_fsk_detect_t *pvt = (switch_fsk_detect_t *) user_data; + //switch_frame_t *frame = NULL; + switch_channel_t *channel = switch_core_session_get_channel(pvt->session); + + switch (type) { + case SWITCH_ABC_TYPE_INIT: { + switch_codec_implementation_t read_impl = { 0 }; + switch_core_session_get_read_impl(pvt->session, &read_impl); + + if (fsk_demod_init(&pvt->fsk_data, read_impl.actual_samples_per_second, pvt->fbuf, sizeof(pvt->fbuf))) { + return SWITCH_FALSE; + } + + break; + } + case SWITCH_ABC_TYPE_CLOSE: + { + fsk_demod_destroy(&pvt->fsk_data); + } + break; + + case SWITCH_ABC_TYPE_WRITE_REPLACE: + case SWITCH_ABC_TYPE_READ_REPLACE: + { + switch_frame_t *rframe; + + if (type == SWITCH_ABC_TYPE_READ_REPLACE) { + rframe = switch_core_media_bug_get_read_replace_frame(bug); + } else { + rframe = switch_core_media_bug_get_write_replace_frame(bug); + } + + if (!pvt->skip && fsk_demod_feed(&pvt->fsk_data, rframe->data, rframe->datalen / 2) != SWITCH_STATUS_SUCCESS) { + char str[1024] = ""; + size_t type, mlen; + char *sp; + switch_event_t *event; + const char *app_var; + + switch_event_create_plain(&event, SWITCH_EVENT_CHANNEL_DATA); + + while(fsk_data_parse(&pvt->fsk_data, &type, &sp, &mlen) == SWITCH_STATUS_SUCCESS) { + char *varname = NULL, *val, *p; + + switch_copy_string(str, sp, mlen+1); + *(str+mlen) = '\0'; + switch_clean_string(str); + //printf("TYPE %u LEN %u VAL [%s]\n", (unsigned)type, (unsigned)mlen, str); + + val = str; + + switch(type) { + case MDMF_DATETIME: + varname = "fsk_datetime"; + break; + case MDMF_PHONE_NAME: + varname = "fsk_phone_name"; + break; + case MDMF_PHONE_NUM: + varname = "fsk_phone_num"; + break; + case MDMF_NAME_VALUE: + varname = switch_core_session_sprintf(pvt->session, "fsk_%s", val); + if ((p = strchr(varname, ':'))) { + *p++ = '\0'; + val = p; + } + break; + default: + break; + } + + if (varname && val) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_DEBUG, "%s setting FSK var [%s][%s]\n", + switch_channel_get_name(channel), varname, val); + switch_channel_set_variable(channel, varname, val); + if (event) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, varname, val); + } + } + } + + if (event) { + if (switch_core_session_queue_event(pvt->session, &event) != SWITCH_STATUS_SUCCESS) { + switch_event_destroy(&event); + } + } + + if ((app_var = switch_channel_get_variable(channel, "execute_on_fsk"))) { + char *app_arg; + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_DEBUG, "%s processing execute_on_fsk [%s]\n", + switch_channel_get_name(channel), app_var); + if ((app_arg = strchr(app_var, ' '))) { + *app_arg++ = '\0'; + } + switch_core_session_execute_application(pvt->session, app_var, app_arg); + } + + pvt->skip = 10; + } + + memset(rframe->data, 255, rframe->datalen); + + if (type == SWITCH_ABC_TYPE_READ_REPLACE) { + switch_core_media_bug_set_read_replace_frame(bug, rframe); + } else { + switch_core_media_bug_set_write_replace_frame(bug, rframe); + } + + if (pvt->skip && !--pvt->skip) { + return SWITCH_FALSE; + } + + } + break; + case SWITCH_ABC_TYPE_WRITE: + default: + break; + } + + return SWITCH_TRUE; +} + +switch_status_t stop_fsk_detect_session(switch_core_session_t *session) +{ + switch_media_bug_t *bug; + switch_channel_t *channel = switch_core_session_get_channel(session); + + if ((bug = switch_channel_get_private(channel, "fsk"))) { + switch_channel_set_private(channel, "fsk", NULL); + switch_core_media_bug_remove(session, &bug); + return SWITCH_STATUS_SUCCESS; + } + return SWITCH_STATUS_FALSE; +} + +switch_status_t fsk_detect_session(switch_core_session_t *session, const char *flags) +{ + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_media_bug_t *bug; + switch_status_t status; + switch_fsk_detect_t *pvt = { 0 }; + switch_codec_implementation_t read_impl = { 0 }; + int bflags = SMBF_READ_REPLACE; + + if (strchr(flags, 'w')) { + bflags = SMBF_WRITE_REPLACE; + } + + switch_core_session_get_read_impl(session, &read_impl); + + if (!(pvt = switch_core_session_alloc(session, sizeof(*pvt)))) { + return SWITCH_STATUS_MEMERR; + } + + pvt->session = session; + + + if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) { + return SWITCH_STATUS_FALSE; + } + + if ((status = switch_core_media_bug_add(session, "fsk_detect", NULL, + fsk_detect_callback, pvt, 0, bflags | SMBF_NO_PAUSE, &bug)) != SWITCH_STATUS_SUCCESS) { + return status; + } + + switch_channel_set_private(channel, "fsk", bug); + + return SWITCH_STATUS_SUCCESS; +} + + +SWITCH_STANDARD_APP(fsk_recv_function) +{ + fsk_detect_session(session, data); +} + +SWITCH_STANDARD_APP(fsk_display_function) +{ + /* expected to be called via 'execute_on_fsk' -- passes display update over FSK */ + + const char *cid_name, *cid_num; + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_core_session_message_t *msg; + switch_core_session_t *psession, *usession = NULL; + char *flags = (char *) data; + + cid_name = switch_channel_get_variable(channel, "fsk_phone_name"); + cid_num = switch_channel_get_variable(channel, "fsk_phone_num"); + + if (zstr(cid_name)) { + cid_name = cid_num; + } + + if (zstr(cid_num)) { + return; + } + + if (strchr(flags, 'b')) { + if (switch_core_session_get_partner(session, &psession) == SWITCH_STATUS_SUCCESS) { + usession = psession; + } + } + + if (!usession) { + usession = session; + } + + msg = switch_core_session_alloc(usession, sizeof(*msg)); + MESSAGE_STAMP_FFL(msg); + msg->message_id = SWITCH_MESSAGE_INDICATE_DISPLAY; + msg->string_array_arg[0] = switch_core_session_strdup(usession, cid_name); + msg->string_array_arg[1] = switch_core_session_strdup(usession, cid_num); + msg->from = __FILE__; + switch_core_session_queue_message(usession, msg); + + if (psession) { + switch_core_session_rwunlock(psession); + psession = NULL; + } +} + +SWITCH_STANDARD_APP(fsk_simplify_function) +{ + /* expected to be called via 'execute_on_fsk' -- redirects call to point-to-point and eliminates legs in the middle */ + switch_channel_t *channel = switch_core_session_get_channel(session); + const char *sip_uri, *fsk_simplify_profile, *fsk_simplify_context; + char *bridgeto; + + if (!(sip_uri = switch_channel_get_variable(channel, "fsk_uri"))) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s Missing URI field!\n", switch_channel_get_name(channel)); + } + + if (!(fsk_simplify_profile = switch_channel_get_variable(channel, "fsk_simplify_profile"))) { + fsk_simplify_profile = "internal"; + } + + fsk_simplify_context = switch_channel_get_variable(channel, "fsk_simplify_context"); + + if (!zstr(sip_uri)) { + switch_core_session_t *psession; + switch_channel_t *pchannel; + + bridgeto = switch_core_session_sprintf(session, "bridge:sofia/%s/sip:%s", fsk_simplify_profile, sip_uri); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s transfering to [%s]\n", + switch_channel_get_name(channel), bridgeto); + + + if (switch_core_session_get_partner(session, &psession) == SWITCH_STATUS_SUCCESS) { + pchannel = switch_core_session_get_channel(psession); + switch_channel_set_flag(pchannel, CF_REDIRECT); + switch_channel_set_flag(pchannel, CF_TRANSFER); + } + + switch_ivr_session_transfer(session, bridgeto, "inline", fsk_simplify_context); + + if (psession) { + switch_ivr_session_transfer(psession, "sleep:5000", "inline", NULL); + switch_core_session_rwunlock(psession); + } + } +} + +/* Macro expands to: switch_status_t mod_fsk_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool) */ +SWITCH_MODULE_LOAD_FUNCTION(mod_fsk_load) +{ + switch_application_interface_t *app_interface; + + /* connect my internal structure to the blank pointer passed to me */ + *module_interface = switch_loadable_module_create_module_interface(pool, modname); + + SWITCH_ADD_APP(app_interface, "fsk_send", "fsk_send", NULL, fsk_send_function, NULL, SAF_NONE); + SWITCH_ADD_APP(app_interface, "fsk_recv", "fsk_recv", NULL, fsk_recv_function, NULL, SAF_NONE); + SWITCH_ADD_APP(app_interface, "fsk_simplify", "fsk_simplify", NULL, fsk_simplify_function, NULL, SAF_NONE); + SWITCH_ADD_APP(app_interface, "fsk_display", "fsk_display", NULL, fsk_display_function, NULL, SAF_NONE); + + /* indicate that the module should continue to be loaded */ + return SWITCH_STATUS_SUCCESS; +} + +/* + Called when the system shuts down + Macro expands to: switch_status_t mod_fsk_shutdown() */ +SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_fsk_shutdown) +{ + /* Cleanup dynamically allocated config settings */ + + return SWITCH_STATUS_SUCCESS; +} + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4 + */ diff --git a/src/mod/applications/mod_fsk/uart.c b/src/mod/applications/mod_fsk/uart.c new file mode 100644 index 0000000..5e0dd85 --- /dev/null +++ b/src/mod/applications/mod_fsk/uart.c @@ -0,0 +1,124 @@ + +/* + * uart.c + * + * Copyright (c) 2005 Robert Krten. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. + * + * This module contains a simple 8-bit UART, which performs a callback + * with the decoded byte value. + * + * 2005 06 11 R. Krten created +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> + +#include "uart.h" + +/* + * dsp_uart_attr_init + * + * Initializes the attributes structure; this must be done before the + * attributes structure is used. +*/ + +void dsp_uart_attr_init (dsp_uart_attr_t *attr) +{ + memset (attr, 0, sizeof (*attr)); +} + +/* + * dsp_uart_attr_get_bytehandler + * dsp_uart_attr_set_bytehandler + * + * These functions get and set their respective elements from the + * attributes structure. If an error code is returned, it is just + * zero == ok, -1 == fail. +*/ + +bytehandler_func_t dsp_uart_attr_get_bytehandler(dsp_uart_attr_t *attr, void **bytehandler_arg) +{ + *bytehandler_arg = attr->bytehandler_arg; + return attr->bytehandler; +} + +void dsp_uart_attr_set_bytehandler(dsp_uart_attr_t *attr, bytehandler_func_t bytehandler, void *bytehandler_arg) +{ + attr->bytehandler = bytehandler; + attr->bytehandler_arg = bytehandler_arg; +} + +dsp_uart_handle_t *dsp_uart_create(dsp_uart_attr_t *attr) +{ + dsp_uart_handle_t *handle; + + handle = malloc(sizeof (*handle)); + if (handle) { + memset(handle, 0, sizeof (*handle)); + + /* fill the attributes member */ + memcpy(&handle->attr, attr, sizeof (*attr)); + } + return handle; +} + +void dsp_uart_destroy(dsp_uart_handle_t **handle) +{ + if (*handle) { + free(*handle); + *handle = NULL; + } +} + + +void dsp_uart_bit_handler(void *x, int bit) +{ + dsp_uart_handle_t *handle = (dsp_uart_handle_t *) x; + + if (!handle->have_start) { + if (bit) { + return; /* waiting for start bit (0) */ + } + handle->have_start = 1; + handle->data = 0; + handle->nbits = 0; + return; + } + + handle->data >>= 1; + handle->data |= 0x80 * !!bit; + handle->nbits++; + + if (handle->nbits == 8) { + handle->attr.bytehandler(handle->attr.bytehandler_arg, handle->data); + handle->nbits = 0; + handle->data = 0; + handle->have_start = 0; + } +/* might consider handling errors in the future... */ +} + diff --git a/src/mod/applications/mod_fsk/uart.h b/src/mod/applications/mod_fsk/uart.h new file mode 100644 index 0000000..89c3a13 --- /dev/null +++ b/src/mod/applications/mod_fsk/uart.h @@ -0,0 +1,76 @@ +/* + * uart.h + * + * Copyright (c) 2005 Robert Krten. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. + * + * This module contains the manifest constants and declarations for + * the UART module. + * + * 2005 06 19 R. Krten created +*/ + +#ifndef __UART_H__ +#define __UART_H__ + +typedef void (*bytehandler_func_t) (void *, int); +typedef void (*bithandler_func_t) (void *, int); + + +typedef struct dsp_uart_attr_s +{ + bytehandler_func_t bytehandler; /* byte handler */ + void *bytehandler_arg; /* arbitrary ID passed to bytehandler as first argument */ +} dsp_uart_attr_t; + +typedef struct +{ + dsp_uart_attr_t attr; + int have_start; /* wait for start bit to show up */ + int data; /* data buffer */ + int nbits; /* number of bits accumulated so far */ +} dsp_uart_handle_t; + +/* + * Function prototypes + * + * General calling order is: + * a) create the attributes structure (dsp_uart_attr_init) + * b) initialize fields in the attributes structure (dsp_uart_attr_set_*) + * c) create a Bell-202 handle (dsp_uart_create) + * d) feed bits through dsp_uart_bit_handler +*/ + +void dsp_uart_attr_init(dsp_uart_attr_t *attributes); + +bytehandler_func_t dsp_uart_attr_get_bytehandler(dsp_uart_attr_t *attributes, void **bytehandler_arg); +void dsp_uart_attr_set_bytehandler(dsp_uart_attr_t *attributes, bytehandler_func_t bytehandler, void *bytehandler_arg); + +dsp_uart_handle_t * dsp_uart_create(dsp_uart_attr_t *attributes); +void dsp_uart_destroy(dsp_uart_handle_t **handle); + +void dsp_uart_bit_handler(void *handle, int bit); + +#endif + commit 62941f69d8d3f32856e136e49eff7f5c5f4135bd Author: David Yat Sin <dyatsin@sangoma.com> Date: Mon Jan 10 17:46:18 2011 -0500 Added FTDM_SPAN_NON_STOPPABLE flag for signalling modules that do not support individual start/stop diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 430b58a..5e49fda 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -634,6 +634,10 @@ static ftdm_status_t ftdm_span_destroy(ftdm_span_t *span) ftdm_mutex_lock(span->mutex); /* stop the signaling */ + + /* This is a forced stopped */ + ftdm_clear_flag(span, FTDM_SPAN_NON_STOPPABLE); + ftdm_span_stop(span); /* destroy the channels */ @@ -739,6 +743,11 @@ FT_DECLARE(ftdm_status_t) ftdm_span_stop(ftdm_span_t *span) ftdm_status_t status = FTDM_SUCCESS; ftdm_mutex_lock(span->mutex); + + if (ftdm_test_flag(span, FTDM_SPAN_NON_STOPPABLE)) { + status = FTDM_NOTIMPL; + goto done; + } if (!ftdm_test_flag(span, FTDM_SPAN_STARTED)) { status = FTDM_EINVAL; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index c13f584..9765024 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -1094,6 +1094,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_isdn_span_config) ftdm_set_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE); ftdm_set_flag(span, FTDM_SPAN_USE_PROCEED_STATE); ftdm_set_flag(span, FTDM_SPAN_USE_SKIP_STATES); + ftdm_set_flag(span, FTDM_SPAN_NON_STOPPABLE); if (span->trunk_type == FTDM_TRUNK_BRI_PTMP || span->trunk_type == FTDM_TRUNK_BRI) { diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index d798357..3bc986d 100644 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -186,6 +186,9 @@ typedef enum { /* If this flag is set, the signalling module supports jumping directly to state up, without going through PROGRESS/PROGRESS_MEDIA */ FTDM_SPAN_USE_SKIP_STATES = (1 << 12), + /* If this flag is set, then this span cannot be stopped individually, it can only be stopped + on freetdm unload */ + FTDM_SPAN_NON_STOPPABLE = (1 << 13), } ftdm_span_flag_t; /*! \brief Channel supported features */ commit f8cb2961826c053cd168e4b440c44bd52c7af5d2 Author: Moises Silva <moy@sangoma.com> Date: Mon Jan 10 17:38:16 2011 -0500 freetdm: remove unused code for glare diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 822c17c..3e0dfab 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2410,14 +2410,6 @@ static ftdm_status_t _ftdm_channel_call_place_nl(const char *file, const char *f } if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_CALL_STARTED)) { - status = FTDM_BREAK; - /* we set the outbound flag when the user open a channel, but if the signaling stack sends an - * incoming call we clear it, which indicates the inbound call was received before we could try - * to place the outbound call */ - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Inbound call won the race, you should hunt in another channel!\n"); - goto done; - } ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Cannot place call in non outbound channel in state %s!\n", ftdm_channel_state2str(ftdmchan->state)); goto done; } commit baac734ec4b9088c69f87170b3a63f9f0257983d Author: Moises Silva <moy@sangoma.com> Date: Mon Jan 10 17:19:51 2011 -0500 freetdm: more R2 glare improvements diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index f111c8e..822c17c 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2152,7 +2152,7 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_answer(const char *file, const char } /* lock must be acquired by the caller! */ -static ftdm_status_t _ftdm_channel_call_hangup_nl(ftdm_channel_t *chan, const char *file, const char *func, int line) +static ftdm_status_t _ftdm_channel_call_hangup_nl(const char *file, const char *func, int line, ftdm_channel_t *chan) { ftdm_status_t status = FTDM_SUCCESS; @@ -2194,7 +2194,7 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_hangup_with_cause(const char *file, ftdmchan->caller_data.hangup_cause = cause; - status = _ftdm_channel_call_hangup_nl(ftdmchan, file, func, line); + status = _ftdm_channel_call_hangup_nl(file, func, line, ftdmchan); ftdm_channel_unlock(ftdmchan); return status; @@ -2208,7 +2208,7 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_hangup(const char *file, const char ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_CLEARING; - status = _ftdm_channel_call_hangup_nl(ftdmchan, file, func, line); + status = _ftdm_channel_call_hangup_nl(file, func, line, ftdmchan); ftdm_channel_unlock(ftdmchan); return status; @@ -2505,6 +2505,7 @@ FT_DECLARE(ftdm_status_t) _ftdm_call_place(const char *file, const char *func, i status = _ftdm_channel_call_place_nl(file, func, line, fchan); if (status != FTDM_SUCCESS) { + _ftdm_channel_call_hangup_nl(file, func, line, fchan); goto done; } @@ -2704,10 +2705,9 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_close(ftdm_channel_t **ftdmchan) ftdm_log_chan_msg(check, FTDM_LOG_WARNING, "Channel not opened, proceeding anyway\n"); } status = check->fio->close(check); - if (status == FTDM_SUCCESS) { - ftdm_channel_done(check); - *ftdmchan = NULL; - } + ftdm_assert(status == FTDM_SUCCESS, "Failed to close channel!\n"); + ftdm_channel_done(check); + *ftdmchan = NULL; check->ring_count = 0; ftdm_mutex_unlock(check->mutex); } @@ -5465,7 +5465,7 @@ static void execute_safety_hangup(void *data) fchan->hangup_timer = 0; if (fchan->state == FTDM_CHANNEL_STATE_TERMINATING) { ftdm_log_chan(fchan, FTDM_LOG_CRIT, "Forcing hangup since the user did not confirmed our hangup after %dms\n", FORCE_HANGUP_TIMER); - _ftdm_channel_call_hangup_nl(fchan, __FILE__, __FUNCTION__, __LINE__); + _ftdm_channel_call_hangup_nl(__FILE__, __FUNCTION__, __LINE__, fchan); } else { ftdm_log_chan(fchan, FTDM_LOG_CRIT, "Not performing safety hangup, channel state is %s\n", ftdm_channel_state2str(fchan->state)); } diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 82a1824..df2e06d 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -50,8 +50,6 @@ #include "freetdm.h" #include "private/ftdm_core.h" -typedef int openr2_call_status_t; - /* when the user stops a span, we clear FTDM_R2_SPAN_STARTED, so that the signaling thread * knows it must stop, and we wait for FTDM_R2_RUNNING to be clear, which tells us the * signaling thread is done. */ @@ -438,7 +436,7 @@ static __inline openr2_calling_party_category_t ftdm_r2_ftdm_cpc_to_openr2_cpc(f /* this function must be called with the chan mutex held! */ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(r2_outgoing_call) { - openr2_call_status_t callstatus; + int ret; ftdm_r2_data_t *r2data; openr2_calling_party_category_t category = OR2_CALLING_PARTY_CATEGORY_NATIONAL_SUBSCRIBER; @@ -458,13 +456,13 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(r2_outgoing_call) ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_OUTPUT_DUMP, &r2data->mf_dump_size); } - callstatus = openr2_chan_make_call(R2CALL(ftdmchan)->r2chan, + ret = openr2_chan_make_call(R2CALL(ftdmchan)->r2chan, ftdmchan->caller_data.cid_num.digits, ftdmchan->caller_data.dnis.digits, category, ftdmchan->caller_data.pres == FTDM_PRES_ALLOWED ? 0 : 1); - if (callstatus) { + if (ret) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Failed to make call in R2 channel, openr2_chan_make_call failed\n"); return FTDM_FAIL; } @@ -618,23 +616,7 @@ static void ftdm_r2_on_call_init(openr2_chan_t *r2chan) } if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)) { - if (ftdmchan->state == FTDM_CHANNEL_STATE_DOWN && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_CALL_STARTED)) { - /* The user requested this channel but has not yet placed a call on it, we can take it over - * and the user will receive FTDM_BREAK if attempts to place a call in the channel - * informing him that the channel was taken over by an incoming call, although he may know - * that already anyways since we sent a SIGEVENT_START on the channel */ - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND); - } else { - /* The user requested the channel and placed the call, apparently openr2 could not detect the - * glare on time, but this should not happen with our locking/thread model since we always - * check for state changes before processing network events (like CAS change) therefore - * openr2 should at this time be aware of the call that we placed on this channel and should - * have initiated the release of the call per ITU R2 spec */ - } - } else { - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Cannot start call when channel is in use (state = %s)\n", ftdm_channel_state2str(ftdmchan->state)); - } + ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Cannot start call when channel is in use (state = %s)\n", ftdm_channel_state2str(ftdmchan->state)); return; } commit 74a01d23bc4661e2a4dfc1eca5df62a735332072 Author: Moises Silva <moy@sangoma.com> Date: Mon Jan 10 16:49:58 2011 -0500 freetdm: Added FTDM_SIGEVENT_DIALING Added hunting scheme to support new ftdm_call_place API Make ftdm_channel_call_answer use ftdm_channel_call_indicate with FTDM_CHANNEL_INDICATE_ANSWER Updated doxygen docs in freetdm.h diff --git a/libs/freetdm/docs/async.txt b/libs/freetdm/docs/async.txt new file mode 100644 index 0000000..04069eb --- /dev/null +++ b/libs/freetdm/docs/async.txt @@ -0,0 +1,14 @@ +APIs that result in an event when the API returns FTDM_SUCCESS + +ftdm_channel_call_answer() +ftdm_channel_call_indicate() + FTDM_SIGEVENT_INDICATION_COMPLETED + *note that FTDM_SIGEVENT_INDICATION_COMPLETED has associated data to indicate the result of the indication + *note this event is only delivered on non-blocking channels + +ftdm_call_place + FTDM_SIGEVENT_DIALING + +ftdm_channel_call_hangup + FTDM_SIGEVENT_RELEASED + diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index f50d26c..7ac1b28 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1073,6 +1073,64 @@ static const char* channel_get_variable(switch_core_session_t *session, switch_e return NULL; } +typedef struct { + switch_event_t *var_event; + switch_core_session_t *new_session; + private_t *tech_pvt; + switch_caller_profile_t *caller_profile; +} hunt_data_t; + +static ftdm_status_t on_channel_found(ftdm_channel_t *fchan, ftdm_caller_data_t *caller_data) +{ + uint32_t span_id, chan_id; + const char *var; + char *sess_uuid; + char name[128]; + ftdm_status_t status; + hunt_data_t *hdata = caller_data->priv; + switch_channel_t *channel = switch_core_session_get_channel(hdata->new_session); + + if ((var = switch_event_get_header(hdata->var_event, "freetdm_pre_buffer_size"))) { + int tmp = atoi(var); + if (tmp > -1) { + ftdm_channel_command(fchan, FTDM_COMMAND_SET_PRE_BUFFER_SIZE, &tmp); + } + } + + span_id = ftdm_channel_get_span_id(fchan); + chan_id = ftdm_channel_get_id(fchan); + + tech_init(hdata->tech_pvt, hdata->new_session, fchan); + hdata->tech_pvt->caller_profile = hdata->caller_profile; + + snprintf(name, sizeof(name), "FreeTDM/%u:%u/%s", span_id, chan_id, caller_data->dnis.digits); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connect outbound channel %s\n", name); + switch_channel_set_name(channel, name); + switch_channel_set_variable(channel, "freetdm_span_name", ftdm_channel_get_span_name(fchan)); + switch_channel_set_variable_printf(channel, "freetdm_span_number", "%d", span_id); + switch_channel_set_variable_printf(channel, "freetdm_chan_number", "%d", chan_id); + + switch_channel_set_state(channel, CS_INIT); + sess_uuid = switch_core_session_get_uuid(hdata->new_session); + status = ftdm_channel_add_token(fchan, sess_uuid, ftdm_channel_get_token_count(fchan)); + switch_assert(status == FTDM_SUCCESS); + + if (SPAN_CONFIG[span_id].limit_calls) { + char spanresource[512]; + snprintf(spanresource, sizeof(spanresource), "span_%s_%s", ftdm_channel_get_span_name(fchan), + caller_data->dnis.digits); + ftdm_log(FTDM_LOG_DEBUG, "Adding rate limit resource on channel %d:%d (%s/%s/%d/%d)\n", + span_id, chan_id, FREETDM_LIMIT_REALM, + spanresource, SPAN_CONFIG[span_id].limit_calls, SPAN_CONFIG[span_id].limit_seconds); + if (switch_limit_incr("hash", hdata->new_session, FREETDM_LIMIT_REALM, spanresource, + SPAN_CONFIG[span_id].limit_calls, SPAN_CONFIG[span_id].limit_seconds) != SWITCH_STATUS_SUCCESS) { + return FTDM_BREAK; + } + } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Attached session %s to channel %d:%d\n", sess_uuid, span_id, chan_id); + return FTDM_SUCCESS; +} + /* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines that allocate memory or you will have 1 channel with memory allocated from another channel's pool! */ @@ -1081,13 +1139,11 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause) { - + hunt_data_t hunt_data; const char *dest = NULL; char *data = NULL; int span_id = -1, group_id = -1, chan_id = 0; - ftdm_channel_t *ftdmchan = NULL; switch_call_cause_t cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; - char name[128]; ftdm_status_t status; int direction = FTDM_TOP_DOWN; ftdm_caller_data_t caller_data = {{ 0 }}; @@ -1097,6 +1153,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi int argc = 0; const char *var; const char *dest_num = NULL, *callerid_num = NULL; + ftdm_hunting_scheme_t hunting; if (!outbound_profile) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing caller profile\n"); @@ -1125,7 +1182,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi if ((argc = switch_separate_string(data, '/', argv, (sizeof(argv) / sizeof(argv[0])))) < 2) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid dial string\n"); - return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; + return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; } if (switch_is_number(argv[0])) { @@ -1309,30 +1366,21 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi ftdm_set_string(caller_data.cid_name, outbound_profile->caller_id_name); ftdm_set_string(caller_data.cid_num.digits, switch_str_nil(outbound_profile->caller_id_number)); + memset(&hunting, 0, sizeof(hunting)); + if (group_id >= 0) { - status = ftdm_channel_open_by_group(group_id, direction, &caller_data, &ftdmchan); + hunting.mode = FTDM_HUNT_GROUP; + hunting.mode_data.group.group_id = group_id; + hunting.mode_data.group.direction = direction; } else if (chan_id) { - status = ftdm_channel_open(span_id, chan_id, &ftdmchan); + hunting.mode = FTDM_HUNT_CHAN; + hunting.mode_data.chan.span_id = span_id; + hunting.mode_data.chan.chan_id = chan_id; } else { - status = ftdm_channel_open_by_span(span_id, direction, &caller_data, &ftdmchan); + hunting.mode = FTDM_HUNT_SPAN; + hunting.mode_data.span.span_id = span_id; + hunting.mode_data.span.direction = direction; } - - if (status != FTDM_SUCCESS) { - if (caller_data.hangup_cause == SWITCH_CAUSE_NONE) { - caller_data.hangup_cause = SWITCH_CAUSE_NORMAL_CIRCUIT_CONGESTION; - } - return caller_data.hangup_cause; - } - - if ((var = switch_event_get_header(var_event, "freetdm_pre_buffer_size"))) { - int tmp = atoi(var); - if (tmp > -1) { - ftdm_channel_command(ftdmchan, FTDM_COMMAND_SET_PRE_BUFFER_SIZE, &tmp); - } - } - - span_id = ftdm_channel_get_span_id(ftdmchan); - chan_id = ftdm_channel_get_id(ftdmchan); for (h = var_event->headers; h; h = h->next) { if (!strncasecmp(h->name, FREETDM_VAR_PREFIX, FREETDM_VAR_PREFIX_LEN)) { @@ -1343,57 +1391,33 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi } } } - + if ((*new_session = switch_core_session_request(freetdm_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, flags, pool)) != 0) { private_t *tech_pvt; switch_caller_profile_t *caller_profile; switch_channel_t *channel = switch_core_session_get_channel(*new_session); switch_core_session_add_stream(*new_session, NULL); - if ((tech_pvt = (private_t *) switch_core_session_alloc(*new_session, sizeof(private_t))) != 0) { - tech_init(tech_pvt, *new_session, ftdmchan); - } else { + if (!(tech_pvt = (private_t *) switch_core_session_alloc(*new_session, sizeof(private_t)))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Hey where is my memory pool?\n"); switch_core_session_destroy(new_session); cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; goto fail; } - snprintf(name, sizeof(name), "FreeTDM/%u:%u/%s", span_id, chan_id, dest); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connect outbound channel %s\n", name); - switch_channel_set_name(channel, name); - switch_channel_set_variable(channel, "freetdm_span_name", ftdm_channel_get_span_name(ftdmchan)); - switch_channel_set_variable_printf(channel, "freetdm_span_number", "%d", span_id); - switch_channel_set_variable_printf(channel, "freetdm_chan_number", "%d", chan_id); - ftdm_channel_set_caller_data(ftdmchan, &caller_data); caller_profile = switch_caller_profile_clone(*new_session, outbound_profile); caller_profile->destination_number = switch_core_strdup(caller_profile->pool, switch_str_nil(dest_num)); caller_profile->caller_id_number = switch_core_strdup(caller_profile->pool, switch_str_nil(callerid_num)); switch_channel_set_caller_profile(channel, caller_profile); - tech_pvt->caller_profile = caller_profile; - - - switch_channel_set_state(channel, CS_INIT); - if (ftdm_channel_add_token(ftdmchan, switch_core_session_get_uuid(*new_session), ftdm_channel_get_token_count(ftdmchan)) != FTDM_SUCCESS) { - switch_core_session_destroy(new_session); - cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; - goto fail; - } + hunting.result_cb = on_channel_found; + hunt_data.var_event = var_event; + hunt_data.new_session = *new_session; + hunt_data.caller_profile = caller_profile; + hunt_data.tech_pvt = tech_pvt; + caller_data.priv = &hunt_data; - if (SPAN_CONFIG[span_id].limit_calls) { - char spanresource[512]; - snprintf(spanresource, sizeof(spanresource), "span_%s_%s", ftdm_channel_get_span_name(ftdmchan), caller_data.dnis.digits); - ftdm_log(FTDM_LOG_DEBUG, "Adding rate limit resource on channel %d:%d (%s/%s/%d/%d)\n", span_id, chan_id, FREETDM_LIMIT_REALM, - spanresource, SPAN_CONFIG[span_id].limit_calls, SPAN_CONFIG[span_id].limit_seconds); - if (switch_limit_incr("hash", *new_session, FREETDM_LIMIT_REALM, spanresource, SPAN_CONFIG[span_id].limit_calls, SPAN_CONFIG[span_id].limit_seconds) != SWITCH_STATUS_SUCCESS) { - switch_core_session_destroy(new_session); - cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; - goto fail; - } - } - - if ((status = ftdm_channel_call_place(ftdmchan)) != FTDM_SUCCESS) { + if ((status = ftdm_call_place(&caller_data, &hunting)) != FTDM_SUCCESS) { if (tech_pvt->read_codec.implementation) { switch_core_codec_destroy(&tech_pvt->read_codec); } @@ -1402,28 +1426,22 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi switch_core_codec_destroy(&tech_pvt->write_codec); } switch_core_session_destroy(new_session); - if (status == FTDM_BREAK) { /* glare, we don't want to touch the channel since is being used for incoming call now */ + if (status == FTDM_BREAK || status == FTDM_EBUSY) { cause = SWITCH_CAUSE_NORMAL_CIRCUIT_CONGESTION; - ftdmchan = NULL; } else { cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; } - goto fail; + goto fail; } - ftdm_channel_init(ftdmchan); + ftdm_channel_init(caller_data.fchan); return SWITCH_CAUSE_SUCCESS; } fail: - if (ftdmchan) { - ftdm_channel_call_hangup_with_cause(ftdmchan, FTDM_CAUSE_NORMAL_TEMPORARY_FAILURE); - } - return cause; - } static void ftdm_enable_channel_dtmf(ftdm_channel_t *fchan, switch_channel_t *channel) @@ -1645,6 +1663,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_common_signal) case FTDM_SIGEVENT_RELEASED: case FTDM_SIGEVENT_INDICATION_COMPLETED: + case FTDM_SIGEVENT_DIALING: { /* Swallow these events */ return FTDM_BREAK; diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index cce3963..f111c8e 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -1425,8 +1425,9 @@ static __inline__ int request_voice_channel(ftdm_channel_t *check, ftdm_channel_ * sometimes with the group or span lock held and were * blocking anyone hunting for channels available and * I believe teh channel_request() function may take - * a bit of time - * */ + * a bit of time. However channel_request is a callback + * used by boost and may be only a few other old sig mods + * and it should be deprecated */ ftdm_mutex_unlock(check->mutex); ftdm_set_caller_data(check->span, caller_data); status = check->span->channel_request(check->span, check->chan_id, @@ -1439,7 +1440,9 @@ static __inline__ int request_voice_channel(ftdm_channel_t *check, ftdm_channel_ if (status == FTDM_SUCCESS) { *ftdmchan = check; ftdm_set_flag(check, FTDM_CHANNEL_OUTBOUND); +#if 0 ftdm_mutex_unlock(check->mutex); +#endif return 1; } } @@ -1491,9 +1494,9 @@ static ftdm_status_t __inline__ get_best_rated(ftdm_channel_t **fchan, ftdm_chan } *fchan = best_rated; ftdm_set_flag(best_rated, FTDM_CHANNEL_OUTBOUND); - +#if 0 ftdm_mutex_unlock(best_rated->mutex); - +#endif return FTDM_SUCCESS; } @@ -1523,7 +1526,7 @@ FT_DECLARE(int) ftdm_channel_get_availability(ftdm_channel_t *ftdmchan) return availability; } -FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_group(uint32_t group_id, ftdm_direction_t direction, ftdm_caller_data_t *caller_data, ftdm_channel_t **ftdmchan) +static ftdm_status_t _ftdm_channel_open_by_group(uint32_t group_id, ftdm_direction_t direction, ftdm_caller_data_t *caller_data, ftdm_channel_t **ftdmchan) { ftdm_status_t status = FTDM_FAIL; ftdm_channel_t *check = NULL; @@ -1604,6 +1607,16 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_group(uint32_t group_id, ftdm_dir return status; } +FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_group(uint32_t group_id, ftdm_direction_t direction, ftdm_caller_data_t *caller_data, ftdm_channel_t **ftdmchan) +{ + ftdm_status_t status; + status = _ftdm_channel_open_by_group(group_id, direction, caller_data, ftdmchan); + if (status == FTDM_SUCCESS) { + ftdm_channel_t *fchan = *ftdmchan; + ftdm_channel_unlock(fchan); + } + return status; +} FT_DECLARE(ftdm_status_t) ftdm_span_channel_use_count(ftdm_span_t *span, uint32_t *count) { @@ -1626,7 +1639,8 @@ FT_DECLARE(ftdm_status_t) ftdm_span_channel_use_count(ftdm_span_t *span, uint32_ return FTDM_SUCCESS; } -FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_span(uint32_t span_id, ftdm_direction_t direction, ftdm_caller_data_t *caller_data, ftdm_channel_t **ftdmchan) +/* Hunt a channel by span, if successful the channel is returned locked */ +static ftdm_status_t _ftdm_channel_open_by_span(uint32_t span_id, ftdm_direction_t direction, ftdm_caller_data_t *caller_data, ftdm_channel_t **ftdmchan) { ftdm_status_t status = FTDM_FAIL; ftdm_channel_t *check = NULL; @@ -1724,6 +1738,17 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_span(uint32_t span_id, ftdm_direc return status; } +FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_span(uint32_t span_id, ftdm_direction_t direction, ftdm_caller_data_t *caller_data, ftdm_channel_t **ftdmchan) +{ + ftdm_status_t status; + status = _ftdm_channel_open_by_span(span_id, direction, caller_data, ftdmchan); + if (status == FTDM_SUCCESS) { + ftdm_channel_t *fchan = *ftdmchan; + ftdm_channel_unlock(fchan); + } + return status; +} + FT_DECLARE(ftdm_status_t) ftdm_channel_open_chan(ftdm_channel_t *ftdmchan) { ftdm_status_t status = FTDM_FAIL; @@ -1774,7 +1799,7 @@ done: return status; } -FT_DECLARE(ftdm_status_t) ftdm_channel_open(uint32_t span_id, uint32_t chan_id, ftdm_channel_t **ftdmchan) +static ftdm_status_t _ftdm_channel_open(uint32_t span_id, uint32_t chan_id, ftdm_channel_t **ftdmchan) { ftdm_channel_t *check = NULL; ftdm_span_t *span = NULL; @@ -1855,6 +1880,10 @@ openchan: ftdm_set_flag(check, FTDM_CHANNEL_INUSE); ftdm_set_flag(check, FTDM_CHANNEL_OUTBOUND); *ftdmchan = check; +#if 1 + /* we've got the channel, do not unlock it */ + goto done; +#endif unlockchan: ftdm_mutex_unlock(check->mutex); @@ -1868,6 +1897,17 @@ done: return status; } +FT_DECLARE(ftdm_status_t) ftdm_channel_open(uint32_t span_id, uint32_t chan_id, ftdm_channel_t **ftdmchan) +{ + ftdm_status_t status; + status = _ftdm_channel_open(span_id, chan_id, ftdmchan); + if (status == FTDM_SUCCESS) { + ftdm_channel_t *fchan = *ftdmchan; + ftdm_channel_unlock(fchan); + } + return status; +} + FT_DECLARE(uint32_t) ftdm_channel_get_id(const ftdm_channel_t *ftdmchan) { return ftdmchan->chan_id; @@ -2048,25 +2088,11 @@ FT_DECLARE(void) ftdm_ack_indication(ftdm_channel_t *fchan, ftdm_channel_indicat ftdm_span_send_signal(fchan->span, &msg); } -/*! \brief Answer call without locking the channel. The caller must have locked first - * \note This function was added because ftdm_channel_call_indicate needs to answer the call - * when its already locking the channel, ftdm_channel_set_state cannot be called with the same - * lock locked once or more (recursive lock) and wait for the result */ +/*! Answer call without locking the channel. The caller must have locked first */ static ftdm_status_t _ftdm_channel_call_answer_nl(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan) { ftdm_status_t status = FTDM_SUCCESS; - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - status = FTDM_EINVAL; - goto done; - } - - if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call is already TERMINATING\n"); - status = FTDM_ECANCELED; - goto done; - } - if (!ftdm_test_flag(ftdmchan->span, FTDM_SPAN_USE_SKIP_STATES)) { /* We will fail RFC's if we not skip states, but some modules apart from ftmod_sangoma_isdn * expect the call to always to go PROGRESS and PROGRESS MEDIA state before going to UP, so @@ -2116,13 +2142,12 @@ done: FT_DECLARE(ftdm_status_t) _ftdm_channel_call_answer(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan) { - ftdm_status_t status = FTDM_SUCCESS; - - ftdm_channel_lock(ftdmchan); + ftdm_status_t status; - status = _ftdm_channel_call_answer_nl(file, func, line, ftdmchan); + /* we leave the locking up to ftdm_channel_call_indicate, DO NOT lock here since ftdm_channel_call_indicate expects + * the lock recursivity to be 1 */ + status = _ftdm_channel_call_indicate(file, func, line, ftdmchan, FTDM_CHANNEL_INDICATE_ANSWER); - ftdm_channel_unlock(ftdmchan); return status; } @@ -2319,7 +2344,6 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_indicate(const char *file, const ch status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, 1); break; case FTDM_CHANNEL_INDICATE_ANSWER: - /* _ftdm_channel_call_answer takes care of the indication ack */ status = _ftdm_channel_call_answer_nl(file, func, line, ftdmchan); break; default: @@ -2365,7 +2389,7 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_reset(const char *file, const char *func return FTDM_SUCCESS; } -FT_DECLARE(ftdm_status_t) _ftdm_channel_call_place(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan) +static ftdm_status_t _ftdm_channel_call_place_nl(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan) { ftdm_status_t status = FTDM_FAIL; @@ -2374,8 +2398,6 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_place(const char *file, const char ftdm_set_echocancel_call_begin(ftdmchan); - ftdm_channel_lock(ftdmchan); - if (!ftdmchan->span->outgoing_call) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "outgoing_call method not implemented in this span!\n"); status = FTDM_ENOSYS; @@ -2427,8 +2449,6 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_place(const char *file, const char } done: - ftdm_channel_unlock(ftdmchan); - #ifdef __WINDOWS__ UNREFERENCED_PARAMETER(file); UNREFERENCED_PARAMETER(func); @@ -2437,6 +2457,64 @@ done: return status; } +FT_DECLARE(ftdm_status_t) _ftdm_channel_call_place(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan) +{ + ftdm_status_t status; + ftdm_channel_lock(ftdmchan); + + status = _ftdm_channel_call_place_nl(file, func, line, ftdmchan); + + ftdm_channel_unlock(ftdmchan); + return status; +} + +FT_DECLARE(ftdm_status_t) _ftdm_call_place(const char *file, const char *func, int line, + ftdm_caller_data_t *caller_data, ftdm_hunting_scheme_t *hunting) +{ + ftdm_assert_return(caller_data, FTDM_EINVAL, "Invalid caller data\n"); + ftdm_assert_return(hunting, FTDM_EINVAL, "Invalid hunting scheme\n"); + + ftdm_status_t status = FTDM_SUCCESS; + ftdm_channel_t *fchan = NULL; + + if (hunting->mode == FTDM_HUNT_SPAN) { + status = _ftdm_channel_open_by_span(hunting->mode_data.span.span_id, + hunting->mode_data.span.direction, caller_data, &fchan); + } else if (hunting->mode == FTDM_HUNT_GROUP) { + status = _ftdm_channel_open_by_group(hunting->mode_data.group.group_id, + hunting->mode_data.group.direction, caller_data, &fchan); + } else if (hunting->mode == FTDM_HUNT_CHAN) { + status = _ftdm_channel_open(hunting->mode_data.chan.span_id, hunting->mode_data.chan.chan_id, &fchan); + } else { + ftdm_log(FTDM_LOG_ERROR, "Cannot make outbound call with invalid hunting mode %d\n", hunting->mode); + return FTDM_EINVAL; + } + + if (status != FTDM_SUCCESS) { + return FTDM_EBUSY; + } + + /* we have a locked channel and are not afraid of using it! */ + status = hunting->result_cb(fchan, caller_data); + if (status != FTDM_SUCCESS) { + status = FTDM_ECANCELED; + goto done; + } + + ftdm_channel_set_caller_data(fchan, caller_data); + + status = _ftdm_channel_call_place_nl(file, func, line, fchan); + if (status != FTDM_SUCCESS) { + goto done; + } + + caller_data->fchan = fchan; +done: + ftdm_channel_unlock(fchan); + + return status; +} + FT_DECLARE(ftdm_status_t) ftdm_channel_set_sig_status(ftdm_channel_t *ftdmchan, ftdm_signaling_status_t sigstatus) { ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "Null channel\n"); diff --git a/libs/freetdm/src/ftdm_state.c b/libs/freetdm/src/ftdm_state.c index 593dc58..574d858 100644 --- a/libs/freetdm/src/ftdm_state.c +++ b/libs/freetdm/src/ftdm_state.c @@ -77,6 +77,12 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_complete_state(const char *file, const c } else if (state == FTDM_CHANNEL_STATE_PROGRESS_MEDIA) { ftdm_set_flag(fchan, FTDM_CHANNEL_PROGRESS); ftdm_set_flag(fchan, FTDM_CHANNEL_MEDIA); + } else if (state == FTDM_CHANNEL_STATE_DIALING) { + ftdm_sigmsg_t msg; + memset(&msg, 0, sizeof(msg)); + msg.channel = fchan; + msg.event_id = FTDM_SIGEVENT_DIALING; + ftdm_span_send_signal(fchan->span, &msg); } /* MAINTENANCE WARNING diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 5f61b0e..121aa18 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -321,8 +321,57 @@ typedef struct ftdm_caller_data { * should use the call_id from sigmsg otherwise */ uint32_t call_id; /*!< Unique call ID for this call */ ftdm_channel_t *fchan; /*!< FreeTDM channel associated (can be NULL) */ + void *priv; /*!< Private data for the FreeTDM user */ } ftdm_caller_data_t; +/*! \brief Hunting mode */ +typedef enum { + FTDM_HUNT_SPAN, /*!< Hunt channels in a given span */ + FTDM_HUNT_GROUP, /*!< Hunt channels in a given group */ + FTDM_HUNT_CHAN, /*!< Hunt for a specific channel */ +} ftdm_hunt_mode_t; + +/*! \brief Structure used for FTDM_HUNT_SPAN mode */ +typedef struct { + uint32_t span_id; + ftdm_direction_t direction; +} ftdm_span_hunt_t; + +/*! \brief Structure used for FTDM_HUNT_GROUP mode */ +typedef struct { + uint32_t group_id; + ftdm_direction_t direction; +} ftdm_group_hunt_t; + +/*! \brief Structure used for FTDM_HUNT_CHAN mode */ +typedef struct { + uint32_t span_id; + uint32_t chan_id; +} ftdm_chan_hunt_t; + +/*! \brief Function called before placing the call in the hunted channel + * The user can have a last saying in whether to proceed or abort + * the call attempt. Be aware that this callback will be called with + * the channel lock and you must not do any blocking operations during + * its execution. + * \param fchan The channel that will be used to place the call + * \param caller_data The caller data provided to ftdm_call_place + * \return FTDM_SUCCESS to proceed or FTDM_BREAK to abort the hunting + */ +typedef ftdm_status_t (*ftdm_hunt_result_cb_t)(ftdm_channel_t *fchan, ftdm_caller_data_t *caller_data); + +/*! \brief Channel Hunting provided to ftdm_call_place() */ +typedef struct { + ftdm_hunt_mode_t mode; + union { + ftdm_span_hunt_t span; + ftdm_group_hunt_t group; + ftdm_chan_hunt_t chan; + } mode_data; + ftdm_hunt_result_cb_t result_cb; +} ftdm_hunting_scheme_t; + + /*! \brief Tone type */ typedef enum { FTDM_TONE_DTMF = (1 << 0) @@ -335,7 +384,7 @@ typedef enum { FTDM_SIGEVENT_RELEASED, /*!< Channel is completely released and available */ FTDM_SIGEVENT_UP, /*!< Outgoing call has been answered */ FTDM_SIGEVENT_FLASH, /*!< Flash event (typically on-hook/off-hook for analog devices) */ - FTDM_SIGEVENT_PROCEED, /*!< Outgoing call got a response */ + FTDM_SIGEVENT_PROCEED, /*!< Outgoing call got an initial positive response from the other end */ FTDM_SIGEVENT_RINGING, /*!< Remote side is in ringing state */ FTDM_SIGEVENT_PROGRESS, /*!< Outgoing call is making progress */ FTDM_SIGEVENT_PROGRESS_MEDIA, /*!< Outgoing call is making progress and there is media available */ @@ -350,12 +399,13 @@ typedef enum { FTDM_SIGEVENT_TRACE, /*!<Interpreted trace event */ FTDM_SIGEVENT_TRACE_RAW, /*!<Raw trace event */ FTDM_SIGEVENT_INDICATION_COMPLETED, /*!< Last requested indication was completed */ + FTDM_SIGEVENT_DIALING, /* Outgoing call just started */ FTDM_SIGEVENT_INVALID, /*!<Invalid */ } ftdm_signal_event_t; #define SIGNAL_STRINGS "START", "STOP", "RELEASED", "UP", "FLASH", "PROCEED", "RINGING", "PROGRESS", \ "PROGRESS_MEDIA", "ALARM_TRAP", "ALARM_CLEAR", \ "COLLECTED_DIGIT", "ADD_CALL", "RESTART", "SIGSTATUS_CHANGED", "COLLISION", "FACILITY", \ - "TRACE", "TRACE_RAW", "INDICATION_COMPLETED", "INVALID" + "TRACE", "TRACE_RAW", "INDICATION_COMPLETED", "DIALING", "INVALID" /*! \brief Move from string to ftdm_signal_event_t and viceversa */ FTDM_STR2ENUM_P(ftdm_str2ftdm_signal_event, ftdm_signal_event2str, ftdm_signal_event_t) @@ -782,8 +832,10 @@ FT_DECLARE(ftdm_status_t) ftdm_global_set_queue_handler(ftdm_queue_handler_t *ha FT_DECLARE(int) ftdm_channel_get_availability(ftdm_channel_t *ftdmchan); /*! \brief Answer call. This can also be accomplished by ftdm_channel_call_indicate with FTDM_CHANNEL_INDICATE_ANSWER, in both - * cases you will get a FTDM_SIGEVENT_INDICATION_COMPLETED when the indication is sent (or an error occurs) - * \note Although this API will result in FTDM_SIGEVENT_INDICATION_COMPLETED event being delivered, + * cases you will get a FTDM_SIGEVENT_INDICATION_COMPLETED when the indication is sent (or an error occurs). + * Just as with ftdm_channel_call_indicate you won't receive FTDM_SIGEVENT_INDICATION_COMPLETED when this function + * returns anything else than FTDM_SUCCESS + * \note Although this API may result in FTDM_SIGEVENT_INDICATION_COMPLETED event being delivered, * there is no guarantee of whether the event will arrive after or before your execution thread returns * from ftdm_channel_call_answer */ @@ -792,12 +844,36 @@ FT_DECLARE(int) ftdm_channel_get_availability(ftdm_channel_t *ftdmchan); /*! \brief Answer call recording the source code point where the it was called (see ftdm_channel_call_answer for an easy to use macro) */ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_answer(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan); -/*! \brief Place an outgoing call */ +/*! \brief Place an outgoing call in the given channel + * \deprecated This macro is deprecated since leaves the door open to glare issues, use ftdm_call_place instead + */ #define ftdm_channel_call_place(ftdmchan) _ftdm_channel_call_place(__FILE__, __FUNCTION__, __LINE__, (ftdmchan)) -/*! \brief Place an outgoing call recording the source code point where it was called (see ftdm_channel_call_place for an easy to use macro) */ +/*! \brief Place an outgoing call recording the source code point where it was called (see ftdm_channel_call_place for an easy to use macro) + * \deprecated This function is deprecated since leaves the door open to glare issues, use ftdm_call_place instead + */ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_place(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan); +/*! \brief Place an outgoing call with the given caller data in a channel according to the hunting scheme provided */ +#define ftdm_call_place(callerdata, hunting) _ftdm_call_place(__FILE__, __FUNCTION__, __LINE__, (callerdata), (hunting)) + +/*! \brief Place an outgoing call with the given caller data in a channel according to the hunting scheme provided and records + * the place where it was called. See ftdm_call_place for an easy to use macro + * \return FTDM_SUCCESS if the call attempt was successful + * FTDM_FAIL if there was an unspecified error + * FTDM_EBUSY if the channel was busy + * FTDM_BREAK if glare was detected and you must try again + * \note Even when FTDM_SUCCESS is returned, the call may still fail later on due to glare, in such case FTDM_SIGEVENT_STOP + * will be sent with the hangup cause field set to FTDM_CAUSE_REQUESTED_CHAN_UNAVAIL + * + * \note When this function returns FTDM_SUCCESS, the member .fchan from caller_data will be set to the channel used to place the call + * and .call_id to the generated call id for that call + * + * \note When this function is successful you are guaranteed to receive FTDM_SIGEVENT_DIALING, this event could even be delivered + * before your execution thread returns from this function + */ +FT_DECLARE(ftdm_status_t) _ftdm_call_place(const char *file, const char *func, int line, ftdm_caller_data_t *caller_data, ftdm_hunting_scheme_t *hunting); + /*! \brief Indicate a new condition in an incoming call * * \note Every indication request will result in FTDM_SIGEVENT_INDICATION_COMPLETED event being delivered with @@ -1133,6 +1209,8 @@ FT_DECLARE(uint32_t) ftdm_group_get_id(const ftdm_group_t *group); /*! * \brief Open a channel specifying the span id and chan id (required before placing a call on the channel) * + * \warning Try using ftdm_call_place instead if you plan to place a call after opening the channel + * * \note You must call ftdm_channel_close() or ftdm_channel_call_hangup() to release the channel afterwards * Only use ftdm_channel_close if there is no call (incoming or outgoing) in the channel * @@ -1148,6 +1226,8 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open(uint32_t span_id, uint32_t chan_id, /*! * \brief Hunts and opens a channel specifying the span id only * + * \warning Try using ftdm_call_place instead if you plan to place a call after opening the channel + * * \note You must call ftdm_channel_close() or ftdm_channel_call_hangup() to release the channel afterwards * Only use ftdm_channel_close if there is no call (incoming or outgoing) in the channel * @@ -1164,6 +1244,8 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_span(uint32_t span_id, ftdm_direc /*! * \brief Hunts and opens a channel specifying group id * + * \warning Try using ftdm_call_place instead if you plan to place a call after opening the channel + * * \note You must call ftdm_channel_close() or ftdm_channel_call_hangup() to release the channel afterwards * Only use ftdm_channel_close if there is no call (incoming or outgoing) in the channel * @@ -1180,8 +1262,11 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_group(uint32_t group_id, ftdm_dir /*! * \brief Close a previously open channel * - * \note If you call ftdm_channel_call_hangup() you MUST NOT call this function, the signaling - * stack will close the channel. + * \warning FreeTDM is more and more a signaling API rather than just a plane IO API, unless you are using + * FreeTDM as a pure IO API without its signaling modules, you should not use this function + * + * \note If you placed a call in this channel use ftdm_channel_call_hangup(), you MUST NOT call this function, + * the signaling stack will close the channel when the call is done. * * \param ftdmchan pointer to the channel to close * @@ -1351,7 +1436,9 @@ FT_DECLARE(const char *) ftdm_channel_get_number(const ftdm_channel_t *ftdmchan) FT_DECLARE(uint32_t) ftdm_channel_get_ph_id(const ftdm_channel_t *ftdmchan); /*! - * \brief Configure span with a signaling type (deprecated use ftdm_configure_span_signaling instead) + * \brief Configure span with a signaling type + * + * \deprecated use ftdm_configure_span_signaling instead * * \note This function does the same as ftdm_configure_span_signaling * @@ -1552,7 +1639,7 @@ FT_DECLARE(const char *) ftdm_channel_get_last_state_str(const ftdm_channel_t *c FT_DECLARE(char *) ftdm_channel_get_history_str(const ftdm_channel_t *channel); /*! \brief Initialize channel state for an outgoing call - * \note This API will eventually be deprecated, is only needed if you use boost signaling + * \deprecated This API is only used for boost signaling */ FT_DECLARE(ftdm_status_t) ftdm_channel_init(ftdm_channel_t *ftdmchan); commit 21f8605d6871680e90a8eee76be1abb2a52e2761 Author: David Yat Sin <dyatsin@sangoma.com> Date: Mon Jan 10 16:42:47 2011 -0500 freetdm: fix for enabling DTMF detection on d-channel diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index f97029b..430b58a 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2923,23 +2923,27 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co case FTDM_COMMAND_ENABLE_DTMF_DETECT: { /* if they don't have thier own, use ours */ - if (!ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_DTMF_DETECT)) { - teletone_dtmf_detect_init (&ftdmchan->dtmf_detect, ftdmchan->rate); - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_DTMF_DETECT); - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_SUPRESS_DTMF); - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Enabled software DTMF detector\n"); - GOTO_STATUS(done, FTDM_SUCCESS); + if (FTDM_IS_VOICE_CHANNEL(ftdmchan)) { + if (!ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_DTMF_DETECT)) { + teletone_dtmf_detect_init (&ftdmchan->dtmf_detect, ftdmchan->rate); + ftdm_set_flag(ftdmchan, FTDM_CHANNEL_DTMF_DETECT); + ftdm_set_flag(ftdmchan, FTDM_CHANNEL_SUPRESS_DTMF); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Enabled software DTMF detector\n"); + GOTO_STATUS(done, FTDM_SUCCESS); + } } } break; case FTDM_COMMAND_DISABLE_DTMF_DETECT: { - if (!ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_DTMF_DETECT)) { - teletone_dtmf_detect_init (&ftdmchan->dtmf_detect, ftdmchan->rate); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_DTMF_DETECT); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_SUPRESS_DTMF); - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Disabled software DTMF detector\n"); - GOTO_STATUS(done, FTDM_SUCCESS); + if (FTDM_IS_VOICE_CHANNEL(ftdmchan)) { + if (!ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_DTMF_DETECT)) { + teletone_dtmf_detect_init (&ftdmchan->dtmf_detect, ftdmchan->rate); + ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_DTMF_DETECT); + ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_SUPRESS_DTMF); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Disabled software DTMF detector\n"); + GOTO_STATUS(done, FTDM_SUCCESS); + } } } break; commit e42c423c9275ec5aec8499c4035978087fc84c02 Author: Brian West <brian@freeswitch.org> Date: Mon Jan 10 14:44:54 2011 -0600 add tab completion stuffs diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index f50d26c..778c5f4 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -4177,6 +4177,19 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_freetdm_load) freetdm_endpoint_interface->state_handler = &freetdm_state_handlers; SWITCH_ADD_API(commands_api_interface, "ftdm", "FreeTDM commands", ft_function, FT_SYNTAX); + switch_console_set_complete("add ftdm start"); + switch_console_set_complete("add ftdm stop"); + switch_console_set_complete("add ftdm retart"); + switch_console_set_complete("add ftdm dump"); + switch_console_set_complete("add ftdm sigstatus get"); + switch_console_set_complete("add ftdm sigstatus set"); + switch_console_set_complete("add ftdm trace"); + switch_console_set_complete("add ftdm notrace"); + switch_console_set_complete("add ftdm q931_pcap"); + switch_console_set_complete("add ftdm gains"); + switch_console_set_complete("add ftdm dtmf on"); + switch_console_set_complete("add ftdm dtmf off"); + SWITCH_ADD_APP(app_interface, "disable_ec", "Disable Echo Canceller", "Disable Echo Canceller", disable_ec_function, "", SAF_NONE); SWITCH_ADD_APP(app_interface, "disable_dtmf", "Disable DTMF Detection", "Disable DTMF Detection", disable_dtmf_function, "", SAF_NONE); commit a9366e4485c2990c394e86d9de3a9c9e098e4aba Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Jan 10 13:20:38 2011 -0600 doh diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 04d5940..038e1d9 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -2968,7 +2968,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ } - if (rtp_session->dtmf_data.in_digit_ts) { + if (bytes && rtp_session->dtmf_data.in_digit_ts) { if (!switch_rtp_ready(rtp_session)) { goto end; } commit 29daaa07b0cdab12ce856c7520cde5270c68effc Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Jan 10 11:27:26 2011 -0600 FS-2960 diff --git a/src/include/switch_odbc.h b/src/include/switch_odbc.h index f763840..103fe0f 100644 --- a/src/include/switch_odbc.h +++ b/src/include/switch_odbc.h @@ -34,6 +34,8 @@ #include <switch.h> +#define DEFAULT_ODBC_RETRIES 120 + SWITCH_BEGIN_EXTERN_C struct switch_odbc_handle; typedef void *switch_odbc_statement_handle_t; @@ -50,6 +52,7 @@ typedef enum { } switch_odbc_status_t; SWITCH_DECLARE(switch_odbc_handle_t *) switch_odbc_handle_new(const char *dsn, const char *username, const char *password); +SWITCH_DECLARE(void) switch_odbc_set_num_retries(switch_odbc_handle_t *handle, int num_retries); SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_disconnect(switch_odbc_handle_t *handle); SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_connect(switch_odbc_handle_t *handle); SWITCH_DECLARE(void) switch_odbc_handle_destroy(switch_odbc_handle_t **handlep); diff --git a/src/switch_odbc.c b/src/switch_odbc.c index 48ba62c..a7c2153 100644 --- a/src/switch_odbc.c +++ b/src/switch_odbc.c @@ -57,6 +57,7 @@ struct switch_odbc_handle { char odbc_driver[256]; BOOL is_firebird; int affected_rows; + int num_retries; }; #endif @@ -90,6 +91,7 @@ SWITCH_DECLARE(switch_odbc_handle_t *) switch_odbc_handle_new(const char *dsn, c new_handle->env = SQL_NULL_HANDLE; new_handle->state = SWITCH_ODBC_STATE_INIT; new_handle->affected_rows = 0; + new_handle->num_retries = DEFAULT_ODBC_RETRIES; return new_handle; @@ -104,6 +106,15 @@ SWITCH_DECLARE(switch_odbc_handle_t *) switch_odbc_handle_new(const char *dsn, c return NULL; } +SWITCH_DECLARE(void) switch_odbc_set_num_retries(switch_odbc_handle_t *handle, int num_retries) +{ +#ifdef SWITCH_HAVE_ODBC + if (handle) { + handle->num_retries = num_retries; + } +#endif +} + SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_disconnect(switch_odbc_handle_t *handle) { #ifdef SWITCH_HAVE_ODBC @@ -133,6 +144,53 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_disconnect(switch_odbc_h #ifdef SWITCH_HAVE_ODBC +static switch_odbc_status_t init_odbc_handles(switch_odbc_handle_t *handle, switch_bool_t do_reinit) +{ + int result; + + if (!handle) { + return SWITCH_ODBC_FAIL; + } + + /* if handle is already initialized, and we're supposed to reinit - free old handle first */ + if (do_reinit == SWITCH_TRUE && handle->env != SQL_NULL_HANDLE) { + SQLFreeHandle(SQL_HANDLE_DBC, handle->con); + SQLFreeHandle(SQL_HANDLE_ENV, handle->env); + handle->env = SQL_NULL_HANDLE; + } + + if (handle->env == SQL_NULL_HANDLE) { + result = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &handle->env); + + if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error AllocHandle\n"); + handle->env = SQL_NULL_HANDLE; /* Reset handle value, just in case */ + return SWITCH_ODBC_FAIL; + } + + result = SQLSetEnvAttr(handle->env, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0); + + if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error SetEnv\n"); + SQLFreeHandle(SQL_HANDLE_ENV, handle->env); + handle->env = SQL_NULL_HANDLE; /* Reset handle value after it's freed */ + return SWITCH_ODBC_FAIL; + } + + result = SQLAllocHandle(SQL_HANDLE_DBC, handle->env, &handle->con); + + if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error AllocHDB %d\n", result); + SQLFreeHandle(SQL_HANDLE_ENV, handle->env); + handle->env = SQL_NULL_HANDLE; /* Reset handle value after it's freed */ + return SWITCH_ODBC_FAIL; + } + SQLSetConnectAttr(handle->con, SQL_LOGIN_TIMEOUT, (SQLPOINTER *) 10, 0); + } + + return SWITCH_ODBC_SUCCESS; +} + static int db_is_up(switch_odbc_handle_t *handle) { int ret = 0; @@ -143,12 +201,18 @@ static int db_is_up(switch_odbc_handle_t *handle) switch_odbc_status_t recon = 0; char *err_str = NULL; SQLCHAR sql[255] = ""; - int max_tries = 120; + int max_tries = DEFAULT_ODBC_RETRIES; int code = 0; SQLRETURN rc; SQLSMALLINT nresultcols; + if (handle) { + max_tries = handle->num_retries; + if (max_tries < 1) + max_tries = DEFAULT_ODBC_RETRIES; + } + top: if (!handle) { @@ -199,6 +263,13 @@ static int db_is_up(switch_odbc_handle_t *handle) error: err_str = switch_odbc_handle_get_error(handle, stmt); + + /* Make sure to free the handle before we try to reconnect */ + if (stmt) { + SQLFreeHandle(SQL_HANDLE_STMT, stmt); + stmt = NULL; + } + recon = switch_odbc_handle_connect(handle); max_tries--; @@ -228,11 +299,6 @@ static int db_is_up(switch_odbc_handle_t *handle) goto done; } - if (stmt) { - SQLFreeHandle(SQL_HANDLE_STMT, stmt); - stmt = NULL; - } - switch_safe_free(err_str); switch_yield(1000000); goto top; @@ -274,31 +340,8 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_connect(switch_odbc_hand SQLSMALLINT valueLength = 0; int i = 0; - if (handle->env == SQL_NULL_HANDLE) { - result = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &handle->env); + init_odbc_handles(handle, SWITCH_FALSE); /* Init ODBC handles, if they are already initialized, don't do it again */ - if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error AllocHandle\n"); - return SWITCH_ODBC_FAIL; - } - - result = SQLSetEnvAttr(handle->env, SQL_ATTR_ODBC_VERSION, (void *) SQL_OV_ODBC3, 0); - - if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error SetEnv\n"); - SQLFreeHandle(SQL_HANDLE_ENV, handle->env); - return SWITCH_ODBC_FAIL; - } - - result = SQLAllocHandle(SQL_HANDLE_DBC, handle->env, &handle->con); - - if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error AllocHDB %d\n", result); - SQLFreeHandle(SQL_HANDLE_ENV, handle->env); - return SWITCH_ODBC_FAIL; - } - SQLSetConnectAttr(handle->con, SQL_LOGIN_TIMEOUT, (SQLPOINTER *) 10, 0); - } if (handle->state == SWITCH_ODBC_STATE_CONNECTED) { switch_odbc_handle_disconnect(handle); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Re-connecting %s\n", handle->dsn); @@ -325,7 +368,9 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_connect(switch_odbc_hand SQLGetDiagRec(SQL_HANDLE_DBC, handle->con, 1, stat, &err, msg, 100, &mlen); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error SQLConnect=%d errno=%d %s\n", result, (int) err, msg); } - SQLFreeHandle(SQL_HANDLE_ENV, handle->env); + + /* Deallocate handles again, more chanses to succeed when reconnecting */ + init_odbc_handles(handle, SWITCH_TRUE); /* Reinit ODBC handles */ return SWITCH_ODBC_FAIL; } @@ -554,6 +599,7 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec_detailed(c } SQLFreeHandle(SQL_HANDLE_STMT, stmt); + stmt = NULL; /* Make sure we don't try to free this handle again */ if (!err_cnt) { return SWITCH_ODBC_SUCCESS; @@ -593,8 +639,10 @@ SWITCH_DECLARE(void) switch_odbc_handle_destroy(switch_odbc_handle_t **handlep) if (handle) { switch_odbc_handle_disconnect(handle); - SQLFreeHandle(SQL_HANDLE_DBC, handle->con); - SQLFreeHandle(SQL_HANDLE_ENV, handle->env); + if (handle->env != SQL_NULL_HANDLE) { + SQLFreeHandle(SQL_HANDLE_DBC, handle->con); + SQLFreeHandle(SQL_HANDLE_ENV, handle->env); + } switch_safe_free(handle->dsn); switch_safe_free(handle->username); switch_safe_free(handle->password); commit 3f1a7dc5b530f843df84348f80a03f5439f71c99 Merge: 22ba5b3 83ce26b Author: David Yat Sin <dyatsin@sangoma.com> Date: Mon Jan 10 12:04:03 2011 -0500 Merge branch 'master' of git.freeswitch.org:freeswitch commit 22ba5b35602df8b210732330ebe1cfdc7fa71002 Author: David Yat Sin <dyatsin@sangoma.com> Date: Mon Jan 10 12:03:49 2011 -0500 freetdm : Progress indicator not sent by default on outgoing calls diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 1591fb2..9b4b787 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -39,7 +39,7 @@ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) ConEvnt conEvnt; sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_ORIG_NISDN}; + ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_INVALID}; ftdm_assert((!sngisdn_info->suInstId && !sngisdn_info->spInstId), "Trying to call out, but call data was not cleared\n"); commit a95a4eeee8910f87f0ea1156148834a56e4e6edf Author: David Yat Sin <dyatsin@sangoma.com> Date: Mon Jan 10 11:29:55 2011 -0500 Freetdm: Added check for channel_on_routing called more than once on incoming calls diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index fb153c8..f97029b 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2281,7 +2281,8 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_indicate(const char *file, const ch status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_BUSY, 1); break; case FTDM_CHANNEL_INDICATE_PROCEED: - if (!ftdm_test_flag(ftdmchan->span, FTDM_SPAN_USE_PROCEED_STATE)) { + if (!ftdm_test_flag(ftdmchan->span, FTDM_SPAN_USE_PROCEED_STATE) || + ftdmchan->state == FTDM_CHANNEL_STATE_PROCEED) { ftdm_ack_indication(ftdmchan, indication, status); goto done; } commit 83ce26b226416b20416eeff70aaabade876920b8 Author: Brian West <brian@freeswitch.org> Date: Mon Jan 10 09:55:56 2011 -0600 FS-2972 diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 69dd217..851ec77 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -2337,6 +2337,7 @@ static switch_status_t deliver_vm(vm_profile_t *profile, const char *filename; switch_xml_t x_param, x_params; char *vm_email = NULL; + char *vm_email_from = NULL; char *vm_notify_email = NULL; char *email_addr = NULL; char *vm_timezone = NULL; @@ -2401,6 +2402,8 @@ static switch_status_t deliver_vm(vm_profile_t *profile, vm_email = switch_core_strdup(pool, val); } else if (!strcasecmp(var, "vm-notify-mailto")) { vm_notify_email = switch_core_strdup(pool, val); + } else if (!strcasecmp(var, "vm-mailfrom")) { + vm_email_from = switch_core_strdup(pool, val); } else if (!strcasecmp(var, "email-addr")) { email_addr = switch_core_strdup(pool, val); } else if (!strcasecmp(var, "vm-email-all-messages") && (send_main = switch_true(val))) { @@ -2544,7 +2547,9 @@ static switch_status_t deliver_vm(vm_profile_t *profile, switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_message_len", duration_str); - if (zstr(profile->email_from)) { + if (!zstr(vm_email_from)) { + from = switch_core_strdup(pool, vm_email_from); + } else if (zstr(profile->email_from)) { from = switch_core_sprintf(pool, "%s@%s", myid, domain_name); } else { from = switch_event_expand_headers(params, profile->email_from); commit 719416f66b1757d33364b6ffb37119e29596a5ae Author: Jeff Lenk <jeff@jefflenk.com> Date: Mon Jan 10 09:39:46 2011 -0600 mem leak diff --git a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c index be06b14..468190d 100644 --- a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c +++ b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c @@ -744,6 +744,7 @@ abyss_bool handler_hook(TSession * r) if (dateValue) { ResponseAddField(r, "Date", dateValue); + free(dateValue); } } commit 300348916ed9417dd16e7fa041ba56676ae08f1b Author: Andrew Thompson <andrew@hijacked.us> Date: Sun Jan 9 14:42:42 2011 -0500 Log error when there's no IVR menus configured when you call 'ivr' DP app diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 4602dd2..4141725 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -1485,6 +1485,8 @@ SWITCH_STANDARD_APP(ivr_application_function) } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Unable to find menu\n"); } + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No menus configured\n"); } switch_xml_free(cxml); } else { commit a8b2840f2b3a634ebda4a601700c8502c2611045 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Jan 7 17:53:09 2011 -0600 little more on the DTMF commit diff --git a/src/switch_rtp.c b/src/switch_rtp.c index eb8b6a1..04d5940 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -126,6 +126,7 @@ struct switch_rtp_rfc2833_data { uint16_t in_digit_seq; uint32_t in_digit_ts; uint32_t in_digit_sanity; + uint32_t in_interleaved; uint32_t timestamp_dtmf; uint16_t last_duration; uint32_t flip; @@ -2963,10 +2964,27 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ } if (rtp_session->dtmf_data.in_digit_ts) { + + } + + + if (rtp_session->dtmf_data.in_digit_ts) { if (!switch_rtp_ready(rtp_session)) { goto end; } - return_cng_frame(); + + if (!rtp_session->dtmf_data.in_interleaved && rtp_session->recv_msg.header.pt != rtp_session->recv_te) { + /* Drat, they are sending audio still as well as DTMF ok fine..... *sigh* */ + rtp_session->dtmf_data.in_interleaved = 1; + } + + if (rtp_session->dtmf_data.in_interleaved || (rtp_session->rtp_bugs & RTP_BUG_IGNORE_DTMF_DURATION)) { + if (rtp_session->recv_msg.header.pt == rtp_session->recv_te) { + goto recvfrom; + } + } else { + return_cng_frame(); + } } timer_check: @@ -3276,7 +3294,6 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read_frame(switch_rtp_t *rtp } frame->datalen = bytes; - return SWITCH_STATUS_SUCCESS; } commit 285ac684d7f5f9e8367d292d0c7f43a6a61705e3 Merge: 01024ac b3fc001 Author: David Yat Sin <dyatsin@sangoma.com> Date: Fri Jan 7 17:46:28 2011 -0500 Merge branch 'master' of git.freeswitch.org:freeswitch commit 01024acee13d2d6343bee07f8b6de3e8a1efeb82 Author: David Yat Sin <dyatsin@sangoma.com> Date: Fri Jan 7 17:46:17 2011 -0500 Freetdm - ISDN fix for ani2 not decoded properly diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 912d061..2b43e9c 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -133,13 +133,12 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) get_redir_num(ftdmchan, &conEvnt->redirNmb); get_calling_subaddr(ftdmchan, &conEvnt->cgPtySad); get_prog_ind_ie(ftdmchan, &conEvnt->progInd); - get_facility_ie(ftdmchan, &conEvnt->facilityStr); + get_facility_ie(ftdmchan, &conEvnt->facilityStr); if (get_calling_name_from_display(ftdmchan, &conEvnt->display) != FTDM_SUCCESS) { get_calling_name_from_usr_usr(ftdmchan, &conEvnt->usrUsr); } - ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Incoming call: Called No:[%s] Calling No:[%s]\n", ftdmchan->caller_data.dnis.digits, ftdmchan->caller_data.cid_num.digits); if (conEvnt->bearCap[0].eh.pres) { @@ -147,10 +146,17 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) ftdmchan->caller_data.bearer_capability = sngisdn_get_infoTranCap_from_stack(conEvnt->bearCap[0].infoTranCap.val); } - if (conEvnt->shift11.eh.pres && conEvnt->ni2OctStr.eh.pres) { if (conEvnt->ni2OctStr.str.len == 4 && conEvnt->ni2OctStr.str.val[0] == 0x37) { - snprintf(ftdmchan->caller_data.aniII, 5, "%.2d", conEvnt->ni2OctStr.str.val[3]); + uint8_t encoding = (conEvnt->ni2OctStr.str.val[2] >> 5); + if (encoding == 0 || encoding == 1) { + /* BCD even or BCD odd */ + uint8_t value = (conEvnt->ni2OctStr.str.val[3] & 0x0F)*10 + ((conEvnt->ni2OctStr.str.val[3] >> 4) & 0x0F); + snprintf(ftdmchan->caller_data.aniII, 5, "%.2d", value); + } else if (encoding == 2) { + /* IA 5 */ + snprintf(ftdmchan->caller_data.aniII, 5, "%c", conEvnt->ni2OctStr.str.val[3]); + } } } commit b3fc001e6cfcfd9219374d13f996981405506118 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Jan 7 16:04:24 2011 -0600 add rtp_bug IGNORE_DTMF_DURATION to speed up dtmf detection of RFC2833 on strange carriers diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 3fbf9c4..9a5e09d 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -632,9 +632,13 @@ typedef enum { This flag will never send any. Sheesh.... */ + RTP_BUG_IGNORE_DTMF_DURATION = (1 << 6) - - + /* + Guess Who? ... Yep, Sonus (and who know's who else) likes to interweave DTMF with the audio stream making it take + 2X as long as it should and sending an incorrect duration making the DTMF very delayed. + This flag will treat every dtmf as if it were 50ms and queue it on recipt of the leading packet rather than at the end. + */ } switch_rtp_bug_flag_t; diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index ffba5ff..a529844 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -6188,6 +6188,14 @@ void sofia_glue_parse_rtp_bugs(uint32_t *flag_pole, const char *str) if (switch_stristr("~NEVER_SEND_MARKER", str)) { *flag_pole &= ~RTP_BUG_NEVER_SEND_MARKER; } + + if (switch_stristr("IGNORE_DTMF_DURATION", str)) { + *flag_pole |= RTP_BUG_IGNORE_DTMF_DURATION; + } + + if (switch_stristr("~IGNORE_DTMF_DURATION", str)) { + *flag_pole &= ~RTP_BUG_IGNORE_DTMF_DURATION; + } } char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, sofia_nat_parse_t *np) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 41d5fc9..eb8b6a1 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -133,6 +133,7 @@ struct switch_rtp_rfc2833_data { char last_digit; switch_queue_t *dtmf_inqueue; switch_mutex_t *dtmf_mutex; + uint8_t in_digit_queued; }; struct switch_rtp { @@ -2479,7 +2480,8 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ } } - if ((!(io_flags & SWITCH_IO_FLAG_NOBLOCK)) && (rtp_session->dtmf_data.out_digit_dur == 0 || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO))) { + if ((!(io_flags & SWITCH_IO_FLAG_NOBLOCK)) && + (rtp_session->dtmf_data.out_digit_dur == 0 || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO))) { return_cng_frame(); } } @@ -2819,7 +2821,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ } #ifdef DEBUG_2833 if (rtp_session->dtmf_data.in_digit_sanity && !(rtp_session->dtmf_data.in_digit_sanity % 100)) { - printf("sanity %d\n", rtp_session->dtmf_data.in_digit_sanity); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "sanity %d\n", rtp_session->dtmf_data.in_digit_sanity); } #endif @@ -2869,7 +2871,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ } } #ifdef DEBUG_2833 - printf("packet[%d]: %02x %02x %02x %02x\n", (int) len, (unsigned) packet[0], (unsigned) + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "packet[%d]: %02x %02x %02x %02x\n", (int) len, (unsigned) packet[0], (unsigned) packet[1], (unsigned) packet[2], (unsigned) packet[3]); #endif @@ -2878,16 +2880,28 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ rtp_session->dtmf_data.in_digit_seq = in_digit_seq; #ifdef DEBUG_2833 - printf("read: %c %u %u %u %u %d %d %s\n", + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "read: %c %u %u %u %u %d %d %s\n", key, in_digit_seq, rtp_session->dtmf_data.in_digit_seq, ts, duration, rtp_session->recv_msg.header.m, end, end && !rtp_session->dtmf_data.in_digit_ts ? "ignored" : ""); #endif + + if (!rtp_session->dtmf_data.in_digit_queued && (rtp_session->rtp_bugs & RTP_BUG_IGNORE_DTMF_DURATION) && + rtp_session->dtmf_data.in_digit_ts) { + switch_dtmf_t dtmf = { key, switch_core_min_dtmf_duration(0) }; +#ifdef DEBUG_2833 + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Early Queuing digit %c:%d\n", dtmf.digit, dtmf.duration / 8); +#endif + switch_rtp_queue_rfc2833_in(rtp_session, &dtmf); + rtp_session->dtmf_data.in_digit_queued = 1; + } + /* only set sanity if we do NOT ignore the packet */ if (rtp_session->dtmf_data.in_digit_ts) { rtp_session->dtmf_data.in_digit_sanity = 2000; } - if (rtp_session->dtmf_data.last_duration > duration && rtp_session->dtmf_data.last_duration > 0xFC17 && ts == rtp_session->dtmf_data.in_digit_ts) { + if (rtp_session->dtmf_data.last_duration > duration && + rtp_session->dtmf_data.last_duration > 0xFC17 && ts == rtp_session->dtmf_data.in_digit_ts) { rtp_session->dtmf_data.flip++; } @@ -2902,18 +2916,26 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ dtmf.duration += rtp_session->dtmf_data.flip * 0xFFFF; rtp_session->dtmf_data.flip = 0; #ifdef DEBUG_2833 - printf("you're welcome!\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "you're welcome!\n"); #endif } #ifdef DEBUG_2833 - printf("done digit=%c ts=%u start_ts=%u dur=%u ddur=%u\n", + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "done digit=%c ts=%u start_ts=%u dur=%u ddur=%u\n", dtmf.digit, ts, rtp_session->dtmf_data.in_digit_ts, duration, dtmf.duration); #endif - switch_rtp_queue_rfc2833_in(rtp_session, &dtmf); + + if (!(rtp_session->rtp_bugs & RTP_BUG_IGNORE_DTMF_DURATION) && !rtp_session->dtmf_data.in_digit_queued) { +#ifdef DEBUG_2833 + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Queuing digit %c:%d\n", dtmf.digit, dtmf.duration / 8); +#endif + switch_rtp_queue_rfc2833_in(rtp_session, &dtmf); + } + rtp_session->dtmf_data.last_digit = rtp_session->dtmf_data.first_digit; rtp_session->dtmf_data.in_digit_ts = 0; rtp_session->dtmf_data.in_digit_sanity = 0; + rtp_session->dtmf_data.in_digit_queued = 0; do_cng = 1; } else { if (!switch_rtp_ready(rtp_session)) { @@ -2932,7 +2954,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ rtp_session->dtmf_data.last_duration = duration; } else { #ifdef DEBUG_2833 - printf("drop: %c %u %u %u %u %d %d\n", + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "drop: %c %u %u %u %u %d %d\n", key, in_digit_seq, rtp_session->dtmf_data.in_digit_seq, ts, duration, rtp_session->recv_msg.header.m, end); #endif switch_cond_next(); @@ -3540,7 +3562,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session, #ifdef RTP_DEBUG_WRITE_DELTA { int delta = (int) (now - rtp_session->send_time) / 1000; - printf("WRITE %d delta %d\n", (int) bytes, delta); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "WRITE %d delta %d\n", (int) bytes, delta); } #endif rtp_session->send_time = now; commit 2cfd09c35c65f181822e9e3cbe797118a45a84a3 Author: Moises Silva <moy@sangoma.com> Date: Fri Jan 7 16:00:06 2011 -0500 freetdm: initial glare handling code diff --git a/libs/freetdm/docs/glare.txt b/libs/freetdm/docs/glare.txt new file mode 100644 index 0000000..d112aba --- /dev/null +++ b/libs/freetdm/docs/glare.txt @@ -0,0 +1,29 @@ +Glare is a PITA. + +Although configuration of ISDN links can be done to minimize glare, to be pedantic we must have a clear policy +on how the FreeTDM API is supposed to behave on glare across signaling modules. + +There is a well-known race in the FreeTDM API since the beginning. When a user wants to place a call there is 2 APIs that +must be used: + +1. ftdm_channel_open_xx (to hunt the channel by group, span or select a channel individually) +2. ftdm_channel_call_place() to place the actual call. + +Since the user has no access to channel locking, between opening a channel and placing a call, an incoming call could be +received. Therefore the user needs to be aware of the following: + +1. Between ftdm_channel_open_xx and ftdm_channel_call_place() a SIGEVENT_START can be received, if the user application +is smart enough, upon receive of SIGEVENT_START it can avoid doing anything else with the channel (from an outgoing call perspective) +since that channel is now a channel owned by the incoming call. It can for example hunt another channel using +ftdm_channel_open_xx again and avoid calling ftdm_channel_call_place. However, if the app is not smart enough and still calls +ftdm_channel_call_place even though already received FTDM_SIGEVENT_START on that channel, ftdm_channel_call_place will return +FTDM_BREAK to inform the user the outgoing call could not be placed and that there is already an incoming call on that channel. + +2. If SIGEVENT_START was not received before calling ftdm_channel_call_place, it could still come while ftdm_channel_call_place() +is being executed, in such situation ftdm_channel_place_call() will return FTDM_BREAK to inform the user the call could +not be placed due to glare and the incoming call won the channel, he user should back off since the channel is +now owned by the incoming call (it can touch the channel having in mind there is now an incoming call on it) + +3. After ftdm_channel_call_place returns, if glare is detected and the signaling stack decides to drop the local call, a regular +SIGEVENT_STOP will be sent with the hangup cause FTDM_CAUSE_REQUESTED_CHAN_UNAVAIL. + diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index cbaff7b..cce3963 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2142,6 +2142,10 @@ static ftdm_status_t _ftdm_channel_call_hangup_nl(ftdm_channel_t *chan, const ch ftdm_sched_cancel_timer(globals.timingsched, chan->hangup_timer); } ftdm_set_flag(chan, FTDM_CHANNEL_USER_HANGUP); + /* if a state change requested by the user was pending, a hangup certainly cancels that request */ + if (ftdm_test_flag(chan, FTDM_CHANNEL_STATE_CHANGE)) { + ftdm_channel_cancel_state(file, func, line, chan); + } status = ftdm_channel_set_state(file, func, line, chan, FTDM_CHANNEL_STATE_HANGUP, 1); } else { /* the signaling stack did not touch the state, @@ -2372,19 +2376,57 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_place(const char *file, const char ftdm_channel_lock(ftdmchan); - if (ftdmchan->span->outgoing_call) { - status = ftdmchan->span->outgoing_call(ftdmchan); - } else { - status = FTDM_NOTIMPL; - ftdm_log(FTDM_LOG_ERROR, "outgoing_call method not implemented in this span!\n"); + if (!ftdmchan->span->outgoing_call) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "outgoing_call method not implemented in this span!\n"); + status = FTDM_ENOSYS; + goto done; } - if (status == FTDM_SUCCESS) { - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_CALL_STARTED); - ftdm_call_set_call_id(ftdmchan, &ftdmchan->caller_data); + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Cannot place call in channel that is not open!\n"); + goto done; + } + + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_CALL_STARTED)) { + status = FTDM_BREAK; + /* we set the outbound flag when the user open a channel, but if the signaling stack sends an + * incoming call we clear it, which indicates the inbound call was received before we could try + * to place the outbound call */ + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Inbound call won the race, you should hunt in another channel!\n"); + goto done; + } + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Cannot place call in non outbound channel in state %s!\n", ftdm_channel_state2str(ftdmchan->state)); + goto done; + } + + if (ftdmchan->state != FTDM_CHANNEL_STATE_DOWN) { + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Cannot place call in channel in state %s!\n", ftdm_channel_state2str(ftdmchan->state)); + goto done; + } + + status = ftdmchan->span->outgoing_call(ftdmchan); + if (status == FTDM_BREAK) { + /* the signaling module detected glare on time */ + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Glare detected, you should hunt in another channel!\n"); + goto done; + } + + if (status != FTDM_SUCCESS) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to place call!\n"); + goto done; + } + + /* in case of success, *before* unlocking the channel, we must set the call started flag and the call id + * that is a guarantee that signaling modules expect from us */ + ftdm_set_flag(ftdmchan, FTDM_CHANNEL_CALL_STARTED); + ftdm_call_set_call_id(ftdmchan, &ftdmchan->caller_data); + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_NONBLOCK)) { + /* be aware this waiting unlocks the channel and locks it back when done */ ftdm_wait_for_flag_cleared(ftdmchan, FTDM_CHANNEL_STATE_CHANGE, 100); } +done: ftdm_channel_unlock(ftdmchan); #ifdef __WINDOWS__ @@ -5355,7 +5397,10 @@ static void execute_safety_hangup(void *data) FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t *sigmsg) { if (sigmsg->channel) { - ftdm_mutex_lock(sigmsg->channel->mutex); + ftdm_mutex_lock(sigmsg->channel->mutex); + sigmsg->chan_id = sigmsg->channel->chan_id; + sigmsg->span_id = sigmsg->channel->span_id; + sigmsg->call_id = sigmsg->channel->caller_data.call_id; } /* some core things to do on special events */ @@ -5373,6 +5418,12 @@ FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t case FTDM_SIGEVENT_START: { + ftdm_assert(!ftdm_test_flag(sigmsg->channel, FTDM_CHANNEL_CALL_STARTED), "Started call twice!"); + + if (ftdm_test_flag(sigmsg->channel, FTDM_CHANNEL_OUTBOUND)) { + ftdm_log_chan_msg(sigmsg->channel, FTDM_LOG_WARNING, "Inbound call taking over outbound channel\n"); + ftdm_clear_flag(sigmsg->channel, FTDM_CHANNEL_OUTBOUND); + } ftdm_set_flag(sigmsg->channel, FTDM_CHANNEL_CALL_STARTED); ftdm_call_set_call_id(sigmsg->channel, &sigmsg->channel->caller_data); ftdm_set_echocancel_call_begin(sigmsg->channel); @@ -5410,9 +5461,6 @@ FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t } - if (sigmsg->channel) { - sigmsg->call_id = sigmsg->channel->caller_data.call_id; - } /* if the signaling module uses a queue for signaling notifications, then enqueue it */ if (ftdm_test_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE)) { ftdm_span_queue_signal(span, sigmsg); diff --git a/libs/freetdm/src/ftdm_state.c b/libs/freetdm/src/ftdm_state.c index 61cd003..593dc58 100644 --- a/libs/freetdm/src/ftdm_state.c +++ b/libs/freetdm/src/ftdm_state.c @@ -164,6 +164,59 @@ static int ftdm_parse_state_map(ftdm_channel_t *ftdmchan, ftdm_channel_state_t s return ok; } +FT_DECLARE(ftdm_status_t) ftdm_channel_cancel_state(const char *file, const char *func, int line, ftdm_channel_t *fchan) +{ + ftdm_time_t diff; + ftdm_channel_state_t state; + ftdm_channel_state_t last_state; + uint8_t hindex = 0; + + if (!ftdm_test_flag(fchan, FTDM_CHANNEL_STATE_CHANGE)) { + ftdm_log_chan(fchan, FTDM_LOG_WARNING, "Cannot cancel state change from %s to %s, it was already processed\n", + ftdm_channel_state2str(fchan->last_state), ftdm_channel_state2str(fchan->state)); + return FTDM_FAIL; + } + + if (fchan->state_status != FTDM_STATE_STATUS_NEW) { + ftdm_log_chan(fchan, FTDM_LOG_WARNING, "Failed to cancel state change from %s to %s, state is not new anymore\n", + ftdm_channel_state2str(fchan->last_state), ftdm_channel_state2str(fchan->state)); + return FTDM_FAIL; + } + + /* compute the last history index */ + hindex = (fchan->hindex == 0) ? (ftdm_array_len(fchan->history) - 1) : (fchan->hindex - 1); + diff = fchan->history[hindex].end_time - fchan->history[hindex].time; + + /* go back in time and revert the state to the previous state */ + state = fchan->state; + last_state = fchan->last_state; + + fchan->state = fchan->last_state; + fchan->state_status = FTDM_STATE_STATUS_COMPLETED; + fchan->last_state = fchan->history[hindex].last_state; + fchan->hindex = hindex; + + /* clear the state change flag */ + ftdm_clear_flag(fchan, FTDM_CHANNEL_STATE_CHANGE); + + /* ack any pending indications as cancelled */ + ftdm_ack_indication(fchan, fchan->indication, FTDM_ECANCELED); + + /* wake up anyone sleeping waiting for the state change to complete, it won't ever be completed */ + if (ftdm_test_flag(fchan, FTDM_CHANNEL_BLOCKING)) { + ftdm_clear_flag(fchan, FTDM_CHANNEL_BLOCKING); + ftdm_interrupt_signal(fchan->state_completed_interrupt); + } + + /* NOTE + * we could potentially also take out the channel from the pendingchans queue, but I believe is easier just leave it, + * the only side effect will be a call to ftdm_channel_advance_states() for a channel that has nothing to advance */ + ftdm_log_chan_ex(fchan, file, func, line, FTDM_LOG_LEVEL_DEBUG, "Cancelled state change from %s to %s in %llums\n", + ftdm_channel_state2str(last_state), ftdm_channel_state2str(state), diff); + + return FTDM_SUCCESS; +} + /* this function MUST be called with the channel lock held. If waitrq == 1, the channel will be unlocked/locked (never call it with waitrq == 1 with an lock recursivity > 1) */ #define DEFAULT_WAIT_TIME 1000 FT_DECLARE(ftdm_status_t) ftdm_channel_set_state(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_channel_state_t state, int waitrq) diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 79850a3..82a1824 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -71,7 +71,6 @@ typedef struct ftdm_r2_call_t { int accepted:1; int answer_pending:1; int disconnect_rcvd:1; - int ftdm_call_started:1; int protocol_error:1; ftdm_size_t dnis_index; ftdm_size_t ani_index; @@ -293,6 +292,9 @@ static ftdm_call_cause_t ftdm_r2_cause_to_ftdm_cause(ftdm_channel_t *fchan, open case OR2_CAUSE_FORCED_RELEASE: return FTDM_CAUSE_NORMAL_CLEARING; + + case OR2_CAUSE_GLARE: + return FTDM_CAUSE_REQUESTED_CHAN_UNAVAIL; } ftdm_log_chan(fchan, FTDM_LOG_WARNING, "Mapping openr2 cause %d to unspecified\n", cause); return FTDM_CAUSE_NORMAL_UNSPECIFIED; @@ -345,7 +347,6 @@ static void ft_r2_clean_call(ftdm_r2_call_t *call) call->accepted = 0; call->answer_pending = 0; call->disconnect_rcvd = 0; - call->ftdm_call_started = 0; call->protocol_error = 0; call->dnis_index = 0; call->ani_index = 0; @@ -443,13 +444,6 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(r2_outgoing_call) r2data = ftdmchan->span->signal_data; - if (ftdmchan->state != FTDM_CHANNEL_STATE_DOWN) { - /* collision, an incoming seized the channel between our take and use timing */ - ftdm_log_chan(ftdmchan, - FTDM_LOG_CRIT, "R2 cannot dial out in channel in state %s, try another channel!.\n", ftdm_channel_state2str(ftdmchan->state)); - return FTDM_FAIL; - } - ft_r2_clean_call(ftdmchan->call_data); if (ftdmchan->caller_data.cpc == FTDM_CPC_INVALID || ftdmchan->caller_data.cpc == FTDM_CPC_UNKNOWN) { @@ -475,7 +469,6 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(r2_outgoing_call) return FTDM_FAIL; } - R2CALL(ftdmchan)->ftdm_call_started = 1; ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DIALING); ftdm_channel_set_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS); @@ -625,7 +618,23 @@ static void ftdm_r2_on_call_init(openr2_chan_t *r2chan) } if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Cannot start call when channel is in use (state = %s)\n", ftdm_channel_state2str(ftdmchan->state)); + if (ftdmchan->state == FTDM_CHANNEL_STATE_DOWN && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_CALL_STARTED)) { + /* The user requested this channel but has not yet placed a call on it, we can take it over + * and the user will receive FTDM_BREAK if attempts to place a call in the channel + * informing him that the channel was taken over by an incoming call, although he may know + * that already anyways since we sent a SIGEVENT_START on the channel */ + ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND); + } else { + /* The user requested the channel and placed the call, apparently openr2 could not detect the + * glare on time, but this should not happen with our locking/thread model since we always + * check for state changes before processing network events (like CAS change) therefore + * openr2 should at this time be aware of the call that we placed on this channel and should + * have initiated the release of the call per ITU R2 spec */ + } + } else { + ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Cannot start call when channel is in use (state = %s)\n", ftdm_channel_state2str(ftdmchan->state)); + } return; } @@ -1007,8 +1016,19 @@ static void ftdm_r2_on_call_log_created(openr2_chan_t *r2chan, const char *logna snprintf(r2call->logname, sizeof(r2call->logname), "%s", logname); } +static void ftdm_r2_on_call_proceed(openr2_chan_t *r2chan) +{ + ftdm_sigmsg_t sigev; + ftdm_channel_t *fchan = openr2_chan_get_client_data(r2chan); + memset(&sigev, 0, sizeof(sigev)); + sigev.event_id = FTDM_SIGEVENT_PROCEED; + sigev.channel = fchan; + ftdm_span_send_signal(fchan->span, &sigev); +} + static openr2_event_interface_t ftdm_r2_event_iface = { /* .on_call_init */ ftdm_r2_on_call_init, + /* .on_call_proceed */ ftdm_r2_on_call_proceed, /* .on_call_offered */ ftdm_r2_on_call_offered, /* .on_call_accepted */ ftdm_r2_on_call_accepted, /* .on_call_answered */ ftdm_r2_on_call_answered, @@ -1691,8 +1711,7 @@ static ftdm_status_t ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) uint32_t interval = 0; ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_INTERVAL, &interval); ftdm_assert(interval != 0, "Invalid interval!"); - ftdm_log_chan(ftdmchan, - FTDM_LOG_DEBUG, "Starting processing of outgoing call in channel with interval %d\n", interval); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Starting outgoing call with interval %d\n", interval); openr2_chan_enable_read(r2chan); } break; @@ -1702,10 +1721,7 @@ static ftdm_status_t ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) /* notify the user about the new call */ sigev.event_id = FTDM_SIGEVENT_START; - ftdm_span_send_signal(ftdmchan->span, &sigev); - r2call->ftdm_call_started = 1; - break; /* the call is making progress */ @@ -1719,9 +1735,6 @@ static ftdm_status_t ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) } } else { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Notifying progress\n"); - sigev.event_id = FTDM_SIGEVENT_PROCEED; - ftdm_span_send_signal(ftdmchan->span, &sigev); - sigev.event_id = FTDM_SIGEVENT_PROGRESS_MEDIA; ftdm_span_send_signal(ftdmchan->span, &sigev); } @@ -1772,7 +1785,7 @@ static ftdm_status_t ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) case FTDM_CHANNEL_STATE_TERMINATING: { /* if the call has not been started yet we must go to HANGUP right here */ - if (!r2call->ftdm_call_started) { + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_CALL_STARTED)) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); } else { openr2_call_disconnect_cause_t disconnect_cause = ftdm_r2_ftdm_cause_to_openr2_cause(ftdmchan); diff --git a/libs/freetdm/src/include/private/ftdm_state.h b/libs/freetdm/src/include/private/ftdm_state.h index 7de015b..5672839 100644 --- a/libs/freetdm/src/include/private/ftdm_state.h +++ b/libs/freetdm/src/include/private/ftdm_state.h @@ -177,6 +177,12 @@ struct ftdm_state_map { }; typedef struct ftdm_state_map ftdm_state_map_t; +/*!\brief Cancel the state processing for a channel (the channel must be locked when calling this function) + * \note Only the core should use this function + */ +FT_DECLARE(ftdm_status_t) ftdm_channel_cancel_state(const char *file, const char *func, int line, + ftdm_channel_t *ftdmchan); + /*!\brief Set the state for a channel (the channel must be locked when calling this function) * \note Signaling modules should use ftdm_set_state macro instead * \note If this function is called with the wait parameter set to a non-zero value, the recursivity commit 40aa1d90f33ed122ae2b228ab02948145b54bf7c Merge: 545ba61 a743263 Author: Moises Silva <moy@sangoma.com> Date: Fri Jan 7 15:59:09 2011 -0500 Merge branch 'master' of git.sangoma.com:smg_freeswitch commit a743263afbcbf30e6345e4cceded760579680760 Author: David Yat Sin <dyatsin@sangoma.com> Date: Fri Jan 7 15:39:25 2011 -0500 freetdm: ISDN - fix for clearing internal states before receiving acknowledgement from remote side diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index c13f584..01b2890 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -788,21 +788,21 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm /* set the flag to indicate this hangup is started from the local side */ sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_REL); - /* If we never sent ack to incoming call, we need to send release instead of disconnect */ - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_RING || - ftdmchan->last_state == FTDM_CHANNEL_STATE_DIALING) { - - sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); - sngisdn_snd_release(ftdmchan, 0); - - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) { - sngisdn_set_span_avail_rate(ftdmchan->span, SNGISDN_AVAIL_DOWN); - } - } else { - sngisdn_snd_disconnect(ftdmchan); + switch(ftdmchan->last_state) { + case FTDM_CHANNEL_STATE_RING: + /* If we never sent PROCEED/ALERT/PROGRESS/CONNECT on an incoming call, we need to send release instead of disconnect */ + sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); + sngisdn_snd_release(ftdmchan, 0); + break; + case FTDM_CHANNEL_STATE_DIALING: + /* If we never received a PROCEED/ALERT/PROGRESS/CONNECT on an outgoing call, we need to send release instead of disconnect */ + sngisdn_snd_release(ftdmchan, 0); + break; + default: + sngisdn_snd_disconnect(ftdmchan); + break; } } - /* now go to the HANGUP complete state */ ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); } commit 545ba61226d0ae2a581a89d60435ae5621c4ebc9 Author: Moises Silva <moy@sangoma.com> Date: Fri Jan 7 14:15:24 2011 -0500 freetdm: only ack indications when the channel is nonblocking diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index fb153c8..cbaff7b 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2032,6 +2032,11 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_unhold(const char *file, const char FT_DECLARE(void) ftdm_ack_indication(ftdm_channel_t *fchan, ftdm_channel_indication_t indication, ftdm_status_t status) { ftdm_sigmsg_t msg; + + if (!ftdm_test_flag(fchan, FTDM_CHANNEL_IND_ACK_PENDING)) { + return; + } + ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Acknowledging indication %s in state %s (rc = %d)\n", ftdm_channel_indication2str(indication), ftdm_channel_state2str(fchan->state), status); ftdm_clear_flag(fchan, FTDM_CHANNEL_IND_ACK_PENDING); @@ -2255,7 +2260,9 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_indicate(const char *file, const ch } ftdmchan->indication = indication; - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_IND_ACK_PENDING); + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_NONBLOCK)) { + ftdm_set_flag(ftdmchan, FTDM_CHANNEL_IND_ACK_PENDING); + } if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Cannot indicate %s in outgoing channel in state %s\n", diff --git a/libs/freetdm/src/ftdm_state.c b/libs/freetdm/src/ftdm_state.c index f6c2c23..61cd003 100644 --- a/libs/freetdm/src/ftdm_state.c +++ b/libs/freetdm/src/ftdm_state.c @@ -79,13 +79,10 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_complete_state(const char *file, const c ftdm_set_flag(fchan, FTDM_CHANNEL_MEDIA); } - /* if there is a pending ack for an indication - * MAINTENANCE WARNING: we're assuming an indication performed - * via state change will involve a single state change - */ - if (ftdm_test_flag(fchan, FTDM_CHANNEL_IND_ACK_PENDING)) { - ftdm_ack_indication(fchan, fchan->indication, FTDM_SUCCESS); - } + /* MAINTENANCE WARNING + * we're assuming an indication performed + * via state change will involve a single state change */ + ftdm_ack_indication(fchan, fchan->indication, FTDM_SUCCESS); hindex = (fchan->hindex == 0) ? (ftdm_array_len(fchan->history) - 1) : (fchan->hindex - 1); commit cd13030f25cc66b56edeb80c6631920a9aa970ff Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Jan 6 23:17:08 2011 -0600 vs2010 reswig diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx index f5e9e31..9ebd6ff 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx @@ -1331,6 +1331,16 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_HOLD_MUSIC_VARIABLE_get() { } +SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_TEMP_HOLD_MUSIC_VARIABLE_get() { + char * jresult ; + char *result = 0 ; + + result = (char *)("temp_hold_music"); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_EXPORT_VARS_VARIABLE_get() { char * jresult ; char *result = 0 ; @@ -7112,6 +7122,20 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_dmachine(void * jar } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_set_codec_slin(void * jarg1, void * jarg2) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_slin_data_t *arg2 = (switch_slin_data_t *) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (switch_slin_data_t *)jarg2; + result = (switch_status_t)switch_core_session_set_codec_slin(arg1,arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_get_uuid() { char * jresult ; char *result = 0 ; @@ -10392,6 +10416,18 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_cache_db_execute_sql_callback(void * ja } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_cache_db_affected_rows(void * jarg1) { + int jresult ; + switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ; + int result; + + arg1 = (switch_cache_db_handle_t *)jarg1; + result = (int)switch_cache_db_affected_rows(arg1); + jresult = result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_status(void * jarg1) { switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0 ; @@ -11972,6 +12008,30 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_digit_string(char * jarg1) { } +SWIGEXPORT char SWIGSTDCALL CSharp_switch_itodtmf(char jarg1) { + char jresult ; + char arg1 ; + char result; + + arg1 = (char)jarg1; + result = (char)switch_itodtmf(arg1); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_dtmftoi(char * jarg1) { + int jresult ; + char *arg1 = (char *) 0 ; + int result; + + arg1 = (char *)jarg1; + result = (int)switch_dtmftoi(arg1); + jresult = result; + return jresult; +} + + SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_known_bitrate(unsigned char jarg1) { unsigned long jresult ; switch_payload_t arg1 ; @@ -22102,6 +22162,119 @@ SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_api_interface(void * jarg1) { } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_slin_data_session_set(void * jarg1, void * jarg2) { + switch_slin_data *arg1 = (switch_slin_data *) 0 ; + switch_core_session_t *arg2 = (switch_core_session_t *) 0 ; + + arg1 = (switch_slin_data *)jarg1; + arg2 = (switch_core_session_t *)jarg2; + if (arg1) (arg1)->session = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_slin_data_session_get(void * jarg1) { + void * jresult ; + switch_slin_data *arg1 = (switch_slin_data *) 0 ; + switch_core_session_t *result = 0 ; + + arg1 = (switch_slin_data *)jarg1; + result = (switch_core_session_t *) ((arg1)->session); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_slin_data_write_frame_set(void * jarg1, void * jarg2) { + switch_slin_data *arg1 = (switch_slin_data *) 0 ; + switch_frame_t *arg2 = (switch_frame_t *) 0 ; + + arg1 = (switch_slin_data *)jarg1; + arg2 = (switch_frame_t *)jarg2; + if (arg1) (arg1)->write_frame = *arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_slin_data_write_frame_get(void * jarg1) { + void * jresult ; + switch_slin_data *arg1 = (switch_slin_data *) 0 ; + switch_frame_t *result = 0 ; + + arg1 = (switch_slin_data *)jarg1; + result = (switch_frame_t *)& ((arg1)->write_frame); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_slin_data_codec_set(void * jarg1, void * jarg2) { + switch_slin_data *arg1 = (switch_slin_data *) 0 ; + switch_codec_t *arg2 = (switch_codec_t *) 0 ; + + arg1 = (switch_slin_data *)jarg1; + arg2 = (switch_codec_t *)jarg2; + if (arg1) (arg1)->codec = *arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_slin_data_codec_get(void * jarg1) { + void * jresult ; + switch_slin_data *arg1 = (switch_slin_data *) 0 ; + switch_codec_t *result = 0 ; + + arg1 = (switch_slin_data *)jarg1; + result = (switch_codec_t *)& ((arg1)->codec); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_slin_data_frame_data_set(void * jarg1, char * jarg2) { + switch_slin_data *arg1 = (switch_slin_data *) 0 ; + char *arg2 ; + + arg1 = (switch_slin_data *)jarg1; + arg2 = (char *)jarg2; + { + if(arg2) { + strncpy((char*)arg1->frame_data, (const char *)arg2, 4096-1); + arg1->frame_data[4096-1] = 0; + } else { + arg1->frame_data[0] = 0; + } + } +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_slin_data_frame_data_get(void * jarg1) { + char * jresult ; + switch_slin_data *arg1 = (switch_slin_data *) 0 ; + char *result = 0 ; + + arg1 = (switch_slin_data *)jarg1; + result = (char *)(char *) ((arg1)->frame_data); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_slin_data() { + void * jresult ; + switch_slin_data *result = 0 ; + + result = (switch_slin_data *)new switch_slin_data(); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_slin_data(void * jarg1) { + switch_slin_data *arg1 = (switch_slin_data *) 0 ; + + arg1 = (switch_slin_data *)jarg1; + delete arg1; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_timetable_profile_created_set(void * jarg1, void * jarg2) { switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ; switch_time_t arg2 ; @@ -22834,6 +23007,30 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_get_variable_partner(void * } +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_get_hold_music(void * jarg1) { + char * jresult ; + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + char *result = 0 ; + + arg1 = (switch_channel_t *)jarg1; + result = (char *)switch_channel_get_hold_music(arg1); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_get_hold_music_partner(void * jarg1) { + char * jresult ; + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + char *result = 0 ; + + arg1 = (switch_channel_t *)jarg1; + result = (char *)switch_channel_get_hold_music_partner(arg1); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_export_variable_var_check(void * jarg1, char * jarg2, char * jarg3, char * jarg4, int jarg5) { int jresult ; switch_channel_t *arg1 = (switch_channel_t *) 0 ; @@ -23079,6 +23276,20 @@ SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_channel_test_cap(void * jarg1 } +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_channel_test_cap_partner(void * jarg1, int jarg2) { + unsigned long jresult ; + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + switch_channel_cap_t arg2 ; + uint32_t result; + + arg1 = (switch_channel_t *)jarg1; + arg2 = (switch_channel_cap_t)jarg2; + result = (uint32_t)switch_channel_test_cap_partner(arg1,arg2); + jresult = (unsigned long)result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_set_flag_partner(void * jarg1, int jarg2) { int jresult ; switch_channel_t *arg1 = (switch_channel_t *) 0 ; @@ -28362,6 +28573,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_deactivate_jitter_buffer(void * jar } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_pause_jitter_buffer(void * jarg1, int jarg2) { + int jresult ; + switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; + switch_bool_t arg2 ; + switch_status_t result; + + arg1 = (switch_rtp_t *)jarg1; + arg2 = (switch_bool_t)jarg2; + result = (switch_status_t)switch_rtp_pause_jitter_buffer(arg1,arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_set_flag(void * jarg1, unsigned long jarg2) { switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; switch_rtp_flag_t arg2 ; @@ -33252,6 +33477,24 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_voice_name_get(void * jarg1) { } +SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_insertFile(void * jarg1, char * jarg2, char * jarg3, int jarg4) { + int jresult ; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + int arg4 ; + int result; + + arg1 = (CoreSession *)jarg1; + arg2 = (char *)jarg2; + arg3 = (char *)jarg3; + arg4 = (int)jarg4; + result = (int)(arg1)->insertFile((char const *)arg2,(char const *)arg3,arg4); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_Answer(void * jarg1) { int jresult ; CoreSession *arg1 = (CoreSession *) 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs index b792fb0..059fb89 100644 --- a/src/mod/languages/mod_managed/managed/swig.2010.cs +++ b/src/mod/languages/mod_managed/managed/swig.2010.cs @@ -224,6 +224,11 @@ public class CoreSession : IDisposable { } } + public int insertFile(string file, string insert_file, int sample_point) { + int ret = freeswitchPINVOKE.CoreSession_insertFile(swigCPtr, file, insert_file, sample_point); + return ret; + } + public int Answer() { int ret = freeswitchPINVOKE.CoreSession_Answer(swigCPtr); return ret; @@ -1362,6 +1367,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_core_session_set_codec_slin(SWIGTYPE_p_switch_core_session session, switch_slin_data data) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_codec_slin(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_slin_data.getCPtr(data)); + return ret; + } + public static string switch_core_get_uuid() { string ret = freeswitchPINVOKE.switch_core_get_uuid(); return ret; @@ -2338,6 +2348,11 @@ public class freeswitch { return ret; } + public static int switch_cache_db_affected_rows(switch_cache_db_handle_t dbh) { + int ret = freeswitchPINVOKE.switch_cache_db_affected_rows(switch_cache_db_handle_t.getCPtr(dbh)); + return ret; + } + public static void switch_cache_db_status(switch_stream_handle stream) { freeswitchPINVOKE.switch_cache_db_status(switch_stream_handle.getCPtr(stream)); } @@ -2732,6 +2747,16 @@ public class freeswitch { return ret; } + public static char switch_itodtmf(char i) { + char ret = freeswitchPINVOKE.switch_itodtmf(i); + return ret; + } + + public static int switch_dtmftoi(string s) { + int ret = freeswitchPINVOKE.switch_dtmftoi(s); + return ret; + } + public static uint switch_known_bitrate(byte payload) { uint ret = freeswitchPINVOKE.switch_known_bitrate(payload); return ret; @@ -3281,6 +3306,16 @@ public class freeswitch { return ret; } + public static string switch_channel_get_hold_music(SWIGTYPE_p_switch_channel channel) { + string ret = freeswitchPINVOKE.switch_channel_get_hold_music(SWIGTYPE_p_switch_channel.getCPtr(channel)); + return ret; + } + + public static string switch_channel_get_hold_music_partner(SWIGTYPE_p_switch_channel channel) { + string ret = freeswitchPINVOKE.switch_channel_get_hold_music_partner(SWIGTYPE_p_switch_channel.getCPtr(channel)); + return ret; + } + public static switch_status_t switch_channel_export_variable_var_check(SWIGTYPE_p_switch_channel channel, string varname, string val, string export_varname, switch_bool_t var_check) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_export_variable_var_check(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, val, export_varname, (int)var_check); return ret; @@ -3369,6 +3404,11 @@ public class freeswitch { return ret; } + public static uint switch_channel_test_cap_partner(SWIGTYPE_p_switch_channel channel, switch_channel_cap_t cap) { + uint ret = freeswitchPINVOKE.switch_channel_test_cap_partner(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)cap); + return ret; + } + public static switch_bool_t switch_channel_set_flag_partner(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flag) { switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_channel_set_flag_partner(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flag); return ret; @@ -4664,6 +4704,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_rtp_pause_jitter_buffer(SWIGTYPE_p_switch_rtp rtp_session, switch_bool_t pause) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_pause_jitter_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), (int)pause); + return ret; + } + public static void switch_rtp_set_flag(SWIGTYPE_p_switch_rtp rtp_session, uint flags) { freeswitchPINVOKE.switch_rtp_set_flag(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), flags); } @@ -5418,6 +5463,7 @@ public class freeswitch { public static readonly string SWITCH_PROXY_MEDIA_VARIABLE = freeswitchPINVOKE.SWITCH_PROXY_MEDIA_VARIABLE_get(); public static readonly string SWITCH_ENDPOINT_DISPOSITION_VARIABLE = freeswitchPINVOKE.SWITCH_ENDPOINT_DISPOSITION_VARIABLE_get(); public static readonly string SWITCH_HOLD_MUSIC_VARIABLE = freeswitchPINVOKE.SWITCH_HOLD_MUSIC_VARIABLE_get(); + public static readonly string SWITCH_TEMP_HOLD_MUSIC_VARIABLE = freeswitchPINVOKE.SWITCH_TEMP_HOLD_MUSIC_VARIABLE_get(); public static readonly string SWITCH_EXPORT_VARS_VARIABLE = freeswitchPINVOKE.SWITCH_EXPORT_VARS_VARIABLE_get(); public static readonly string SWITCH_BRIDGE_EXPORT_VARS_VARIABLE = freeswitchPINVOKE.SWITCH_BRIDGE_EXPORT_VARS_VARIABLE_get(); public static readonly string SWITCH_R_SDP_VARIABLE = freeswitchPINVOKE.SWITCH_R_SDP_VARIABLE_get(); @@ -6010,6 +6056,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_HOLD_MUSIC_VARIABLE_get")] public static extern string SWITCH_HOLD_MUSIC_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_TEMP_HOLD_MUSIC_VARIABLE_get")] + public static extern string SWITCH_TEMP_HOLD_MUSIC_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_EXPORT_VARS_VARIABLE_get")] public static extern string SWITCH_EXPORT_VARS_VARIABLE_get(); @@ -7474,6 +7523,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_dmachine")] public static extern IntPtr switch_core_session_get_dmachine(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_codec_slin")] + public static extern int switch_core_session_set_codec_slin(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_get_uuid")] public static extern string switch_core_get_uuid(); @@ -8218,6 +8270,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_execute_sql_callback")] public static extern int switch_cache_db_execute_sql_callback(HandleRef jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4, ref string jarg5); + [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_affected_rows")] + public static extern int switch_cache_db_affected_rows(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_status")] public static extern void switch_cache_db_status(HandleRef jarg1); @@ -8590,6 +8645,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_is_digit_string")] public static extern int switch_is_digit_string(string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_itodtmf")] + public static extern char switch_itodtmf(char jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_dtmftoi")] + public static extern int switch_dtmftoi(string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_known_bitrate")] public static extern uint switch_known_bitrate(byte jarg1); @@ -11149,6 +11210,36 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_api_interface")] public static extern void delete_switch_api_interface(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_slin_data_session_set")] + public static extern void switch_slin_data_session_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_slin_data_session_get")] + public static extern IntPtr switch_slin_data_session_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_slin_data_write_frame_set")] + public static extern void switch_slin_data_write_frame_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_slin_data_write_frame_get")] + public static extern IntPtr switch_slin_data_write_frame_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_slin_data_codec_set")] + public static extern void switch_slin_data_codec_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_slin_data_codec_get")] + public static extern IntPtr switch_slin_data_codec_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_slin_data_frame_data_set")] + public static extern void switch_slin_data_frame_data_set(HandleRef jarg1, string jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_slin_data_frame_data_get")] + public static extern string switch_slin_data_frame_data_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_slin_data")] + public static extern IntPtr new_switch_slin_data(); + + [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_slin_data")] + public static extern void delete_switch_slin_data(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_profile_created_set")] public static extern void switch_channel_timetable_profile_created_set(HandleRef jarg1, HandleRef jarg2); @@ -11311,6 +11402,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_variable_partner")] public static extern string switch_channel_get_variable_partner(HandleRef jarg1, string jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_hold_music")] + public static extern string switch_channel_get_hold_music(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_hold_music_partner")] + public static extern string switch_channel_get_hold_music_partner(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_export_variable_var_check")] public static extern int switch_channel_export_variable_var_check(HandleRef jarg1, string jarg2, string jarg3, string jarg4, int jarg5); @@ -11368,6 +11465,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_test_cap")] public static extern uint switch_channel_test_cap(HandleRef jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_test_cap_partner")] + public static extern uint switch_channel_test_cap_partner(HandleRef jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_flag_partner")] public static extern int switch_channel_set_flag_partner(HandleRef jarg1, int jarg2); @@ -12481,6 +12581,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_deactivate_jitter_buffer")] public static extern int switch_rtp_deactivate_jitter_buffer(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_pause_jitter_buffer")] + public static extern int switch_rtp_pause_jitter_buffer(HandleRef jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_flag")] public static extern void switch_rtp_set_flag(HandleRef jarg1, uint jarg2); @@ -13672,6 +13775,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_voice_name_get")] public static extern string CoreSession_voice_name_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_insertFile")] + public static extern int CoreSession_insertFile(HandleRef jarg1, string jarg2, string jarg3, int jarg4); + [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_Answer")] public static extern int CoreSession_Answer(HandleRef jarg1); @@ -21515,6 +21621,8 @@ public enum switch_channel_cap_t { CC_MEDIA_ACK = 1, CC_BYPASS_MEDIA, CC_PROXY_MEDIA, + CC_JITTERBUFFER, + CC_FS_RTP, CC_FLAG_MAX } @@ -29531,6 +29639,98 @@ public enum switch_signal_t { namespace FreeSWITCH.Native { +using System; +using System.Runtime.InteropServices; + +public class switch_slin_data : IDisposable { + private HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal switch_slin_data(IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new HandleRef(this, cPtr); + } + + internal static HandleRef getCPtr(switch_slin_data obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } + + ~switch_slin_data() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if (swigCPtr.Handle != IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_switch_slin_data(swigCPtr); + } + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + GC.SuppressFinalize(this); + } + } + + public SWIGTYPE_p_switch_core_session session { + set { + freeswitchPINVOKE.switch_slin_data_session_set(swigCPtr, SWIGTYPE_p_switch_core_session.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_slin_data_session_get(swigCPtr); + SWIGTYPE_p_switch_core_session ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false); + return ret; + } + } + + public switch_frame write_frame { + set { + freeswitchPINVOKE.switch_slin_data_write_frame_set(swigCPtr, switch_frame.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_slin_data_write_frame_get(swigCPtr); + switch_frame ret = (cPtr == IntPtr.Zero) ? null : new switch_frame(cPtr, false); + return ret; + } + } + + public switch_codec codec { + set { + freeswitchPINVOKE.switch_slin_data_codec_set(swigCPtr, switch_codec.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_slin_data_codec_get(swigCPtr); + switch_codec ret = (cPtr == IntPtr.Zero) ? null : new switch_codec(cPtr, false); + return ret; + } + } + + public string frame_data { + set { + freeswitchPINVOKE.switch_slin_data_frame_data_set(swigCPtr, value); + } + get { + string ret = freeswitchPINVOKE.switch_slin_data_frame_data_get(swigCPtr); + return ret; + } + } + + public switch_slin_data() : this(freeswitchPINVOKE.new_switch_slin_data(), true) { + } + +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.1 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + [System.Flags] public enum switch_speech_flag_enum_t { SWITCH_SPEECH_FLAG_NONE = 0, SWITCH_SPEECH_FLAG_HASTEXT = (1 << 0), commit 1a08df9b20d4b5c0e5bfc0ffe6d0b8d380aefd72 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Jan 6 17:41:17 2011 -0600 add function to help set session read codec to slinear diff --git a/src/include/switch_core.h b/src/include/switch_core.h index ff131ac..29e8b43 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -116,7 +116,6 @@ struct switch_core_session; struct switch_core_runtime; struct switch_core_port_allocator; - /*! \defgroup core1 Core Library \ingroup FREESWITCH @@ -713,6 +712,7 @@ SWITCH_DECLARE(void) switch_core_session_soft_lock(switch_core_session_t *sessio SWITCH_DECLARE(void) switch_core_session_soft_unlock(switch_core_session_t *session); SWITCH_DECLARE(void) switch_core_session_set_dmachine(switch_core_session_t *session, switch_ivr_dmachine_t *dmachine); SWITCH_DECLARE(switch_ivr_dmachine_t *) switch_core_session_get_dmachine(switch_core_session_t *session); +SWITCH_DECLARE(switch_status_t) switch_core_session_set_codec_slin(switch_core_session_t *session, switch_slin_data_t *data); /*! \brief Retrieve the unique identifier from the core diff --git a/src/include/switch_module_interfaces.h b/src/include/switch_module_interfaces.h index 1cf01c5..114e594 100644 --- a/src/include/switch_module_interfaces.h +++ b/src/include/switch_module_interfaces.h @@ -711,6 +711,14 @@ struct switch_api_interface { #define PROTECT_INTERFACE(_it) if (_it) {switch_mutex_lock(_it->reflock); switch_thread_rwlock_rdlock(_it->parent->rwlock); switch_thread_rwlock_rdlock(_it->rwlock); _it->refs++; _it->parent->refs++; switch_mutex_unlock(_it->reflock);} //if (!strcmp(_it->interface_name, "user")) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "+++++++++++LOCK %s %d/%d\n", _it->interface_name, _it->refs, _it->parent->refs); #define UNPROTECT_INTERFACE(_it) if (_it) {switch_mutex_lock(_it->reflock); switch_thread_rwlock_unlock(_it->rwlock); switch_thread_rwlock_unlock(_it->parent->rwlock); _it->refs--; _it->parent->refs--; switch_mutex_unlock(_it->reflock);} //if (!strcmp(_it->interface_name, "user")) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "---------UNLOCK %s %d/%d\n", _it->interface_name, _it->refs, _it->parent->refs); +#include "switch_frame.h" + +struct switch_slin_data { + switch_core_session_t *session; + switch_frame_t write_frame; + switch_codec_t codec; + char frame_data[SWITCH_RECOMMENDED_BUFFER_SIZE]; +}; SWITCH_END_EXTERN_C #endif diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 01f890d..3fbf9c4 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1817,6 +1817,8 @@ typedef struct switch_loadable_module_function_table { typedef int (*switch_modulename_callback_func_t) (void *user_data, const char *module_name); +typedef struct switch_slin_data switch_slin_data_t; + #define SWITCH_MODULE_DEFINITION_EX(name, load, shutdown, runtime, flags) \ static const char modname[] = #name ; \ SWITCH_MOD_DECLARE_DATA switch_loadable_module_function_table_t name##_module_interface = { \ diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 9319abc..4836aae 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -58,6 +58,39 @@ SWITCH_DECLARE(void) switch_core_session_soft_unlock(switch_core_session_t *sess session->soft_lock = 0; } +SWITCH_DECLARE(switch_status_t) switch_core_session_set_codec_slin(switch_core_session_t *session, switch_slin_data_t *data) + +{ + switch_codec_implementation_t read_impl = { 0 }; + int interval; + + switch_core_session_get_read_impl(session, &read_impl); + interval = read_impl.microseconds_per_packet / 1000; + data->session = session; + + if (switch_core_codec_init(&data->codec, + "L16", + NULL, + read_impl.actual_samples_per_second, + interval, + 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), + SWITCH_LOG_DEBUG, "Codec Activated L16@%uhz %dms\n", read_impl.actual_samples_per_second, interval); + + memset(&data->write_frame, 0, sizeof(data->write_frame)); + + data->write_frame.codec = &data->codec; + data->write_frame.data = data->frame_data; + data->write_frame.buflen = sizeof(data->frame_data); + data->write_frame.datalen = 0; + switch_core_session_set_read_codec(session, &data->codec); + return SWITCH_STATUS_SUCCESS; + } + + return SWITCH_STATUS_FALSE; +} + + #ifdef SWITCH_DEBUG_RWLOCKS SWITCH_DECLARE(switch_core_session_t *) switch_core_session_perform_locate(const char *uuid_str, const char *file, const char *func, int line) #else commit 85c22d10e2dc8f2d8303e4fd11219d9c4b09ccb5 Author: Brian West <brian@freeswitch.org> Date: Thu Jan 6 17:15:45 2011 -0600 Fix iLBC when using ep_codec_string diff --git a/src/mod/codecs/mod_ilbc/mod_ilbc.c b/src/mod/codecs/mod_ilbc/mod_ilbc.c index 4d52ba9..23ca642 100644 --- a/src/mod/codecs/mod_ilbc/mod_ilbc.c +++ b/src/mod/codecs/mod_ilbc/mod_ilbc.c @@ -163,7 +163,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_ilbc_load) "mode=30", /* default fmtp to send (can be overridden by the init function) */ 8000, /* samples transferred per second */ 8000, /* actual samples transferred per second */ - 13300, /* bits transferred per second */ + 13330, /* bits transferred per second */ 30000, /* number of microseconds per frame */ ILBC_BLOCK_LEN_30MS, /* number of samples per frame */ ILBC_BLOCK_LEN_30MS * 2, /* number of bytes per frame decompressed */ diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 715b70f..ffba5ff 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -3550,13 +3550,53 @@ void sofia_glue_set_r_sdp_codec_string(switch_core_session_t *session, const cha } if (match) { - if (ptime > 0) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",%s@%uh@%di", imp->iananame, (unsigned int) map->rm_rate, - ptime); + int codec_ms = ptime; + uint32_t map_bit_rate = 0; + char ptstr[20] = ""; + char ratestr[20] = ""; + char bitstr[20] = ""; + switch_codec_fmtp_t codec_fmtp = { 0 }; + + if (!codec_ms) { + codec_ms = switch_default_ptime(map->rm_encoding, map->rm_pt); + } + + map_bit_rate = switch_known_bitrate(map->rm_pt); + + if (!ptime && !strcasecmp(map->rm_encoding, "g723")) { + ptime = codec_ms = 30; + } + + if (zstr(map->rm_fmtp)) { + if (!strcasecmp(map->rm_encoding, "ilbc")) { + ptime = codec_ms = 30; + map_bit_rate = 13330; + } } else { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",%s@%uh", imp->iananame, (unsigned int) map->rm_rate); + if ((switch_core_codec_parse_fmtp(map->rm_encoding, map->rm_fmtp, map->rm_rate, &codec_fmtp)) == SWITCH_STATUS_SUCCESS) { + if (codec_fmtp.bits_per_second) { + map_bit_rate = codec_fmtp.bits_per_second; + } + if (codec_fmtp.microseconds_per_packet) { + codec_ms = (codec_fmtp.microseconds_per_packet / 1000); + } + } } - already_did[imp->ianacode] = 1; + + if (map->rm_rate) { + switch_snprintf(ratestr, sizeof(ratestr), "@%uh", (unsigned int) map->rm_rate); + } + + if (codec_ms) { + switch_snprintf(ptstr, sizeof(ptstr), "@%di", codec_ms); + } + + if (map_bit_rate) { + switch_snprintf(bitstr, sizeof(bitstr), "@%db", map_bit_rate); + } + + switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",%s%s%s%s", map->rm_encoding, ratestr, ptstr, bitstr); + break; } } @@ -4378,6 +4418,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s if (zstr(map->rm_fmtp)) { if (!strcasecmp(map->rm_encoding, "ilbc")) { ptime = codec_ms = 30; + map_bit_rate = 13330; } } else { if ((switch_core_codec_parse_fmtp(map->rm_encoding, map->rm_fmtp, map->rm_rate, &codec_fmtp)) == SWITCH_STATUS_SUCCESS) { @@ -4389,8 +4430,6 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s } } } - - for (i = first; i < last && i < tech_pvt->num_codecs; i++) { const switch_codec_implementation_t *imp = tech_pvt->codecs[i]; @@ -4401,7 +4440,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s } switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Audio Codec Compare [%s:%d:%u:%d:%u]/[%s:%d:%u:%d:%u]\n", - rm_encoding, map->rm_pt, (int) map->rm_rate, ptime, map_bit_rate, + rm_encoding, map->rm_pt, (int) map->rm_rate, codec_ms, map_bit_rate, imp->iananame, imp->ianacode, codec_rate, imp->microseconds_per_packet / 1000, bit_rate); if ((zstr(map->rm_encoding) || (tech_pvt->profile->ndlb & PFLAG_NDLB_ALLOW_BAD_IANANAME)) && map->rm_pt < 96) { match = (map->rm_pt == imp->ianacode) ? 1 : 0; commit 9462f53c90beec68111bcd137f9415532aad5509 Author: Michael Jerris <mike@jerris.com> Date: Thu Jan 6 16:01:07 2011 -0600 don't say we are not for polycom phones (safe rport) when its not really nat diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 0b7d0f3..2881918 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1078,7 +1078,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand if (exptime && v_event && *v_event) { char *exp_var; char *allow_multireg = NULL; - int force_connectile = 0; + int auto_connectile = 0; allow_multireg = switch_event_get_header(*v_event, "sip-allow-multiple-registrations"); if (allow_multireg && switch_false(allow_multireg)) { @@ -1097,11 +1097,26 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand if (profile->rport_level == 3 && sip->sip_user_agent && sip->sip_user_agent->g_string && !strncasecmp(sip->sip_user_agent->g_string, "Polycom", 7)) { - force_connectile = 1; + if (sip && sip->sip_via) { + const char *host = sip->sip_via->v_host; + const char *c_port = sip->sip_via->v_port; + int port = 0; + + if (c_port) port = atoi(c_port); + if (!port) port = 5060; + + if (host && strcmp(network_ip, host)) { + auto_connectile = 1; + } else if (port != network_port) { + auto_connectile = 1; + } + } else { + auto_connectile = 1; + } } - if ((v_contact_str = switch_event_get_header(*v_event, "sip-force-contact")) || force_connectile) { - if ((!strcasecmp(v_contact_str, "NDLB-connectile-dysfunction-2.0")) || force_connectile) { + if ((v_contact_str = switch_event_get_header(*v_event, "sip-force-contact")) || auto_connectile) { + if ((!strcasecmp(v_contact_str, "NDLB-connectile-dysfunction-2.0")) || auto_connectile) { char *path_encoded; size_t path_encoded_len; char my_contact_str[1024]; commit 0132cd3fc7dad74f480f01694d8db89207707020 Author: Michael Jerris <mike@jerris.com> Date: Thu Jan 6 15:35:12 2011 -0600 Fix routing behavior of inbound calls from gateways that only match gateway based on the gw request uri param we now honor the extension gateway param only if it is explicitly set, but will not route to the username param if extension is not set also, new special value for extension "auto" that should use the request uri unless it has gw+ and then it will use the to uri diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index df26796..b6ce97d 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -403,6 +403,7 @@ struct sofia_gateway { char *register_from; char *register_contact; char *extension; + char *real_extension; char *register_to; char *register_proxy; char *register_sticky_proxy; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 2643ceb..381eb5d 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2056,10 +2056,6 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag) from_user = username; } - if (zstr(extension)) { - extension = username; - } - if (zstr(proxy)) { proxy = realm; } @@ -2151,8 +2147,13 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag) sipip = profile->sipip; } - gateway->extension = switch_core_strdup(gateway->pool, extension); + if (zstr(extension)) { + extension = username; + } else { + gateway->real_extension = switch_core_strdup(gateway->pool, extension); + } + gateway->extension = switch_core_strdup(gateway->pool, extension); if (!strncasecmp(proxy, "sip:", 4)) { gateway->register_proxy = switch_core_strdup(gateway->pool, proxy); @@ -6222,6 +6223,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ char acl_token[512] = ""; sofia_transport_t transport; const char *gw_name = NULL; + const char *gw_param_name = NULL; char *call_info_str = NULL; nua_handle_t *bnh = NULL; char sip_acl_authed_by[512] = ""; @@ -6854,7 +6856,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ if (sip->sip_request->rq_url->url_params) { - gw_name = sofia_glue_find_parameter_value(session, sip->sip_request->rq_url->url_params, "gw="); + gw_param_name = sofia_glue_find_parameter_value(session, sip->sip_request->rq_url->url_params, "gw="); } if (strstr(destination_number, "gw+")) { @@ -6869,19 +6871,35 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ } } - if (gw_name) { - sofia_gateway_t *gateway; - if (gw_name && (gateway = sofia_reg_find_gateway(gw_name))) { + if (gw_name || gw_param_name) { + sofia_gateway_t *gateway = NULL; + char *extension = NULL; + + if (gw_name && ((gateway = sofia_reg_find_gateway(gw_name)))) { + gw_param_name = NULL; + extension = gateway->extension; + } + + if (!gateway && gw_param_name) { + gateway = sofia_reg_find_gateway(gw_param_name); + extension = gateway->real_extension; + } + + if (gateway) { context = switch_core_session_strdup(session, gateway->register_context); switch_channel_set_variable(channel, "sip_gateway", gateway->name); - if (gateway->extension) { - if (!strcasecmp(gateway->extension, "auto_to_user")) { + if (!zstr(extension)) { + if (!strcasecmp(extension, "auto_to_user")) { destination_number = sip->sip_to->a_url->url_user; + } else if (!strcasecmp(extension, "auto")) { + if (gw_name) { + destination_number = sip->sip_to->a_url->url_user; + } } else { - destination_number = switch_core_session_strdup(session, gateway->extension); + destination_number = switch_core_session_strdup(session, extension); } - } else { + } else if (!gw_param_name) { destination_number = sip->sip_to->a_url->url_user; } commit 70697b8835145a800f035c667f5c0f7defdc97ca Merge: 46853d7 3018400 Author: Moises Silva <moy@sangoma.com> Date: Thu Jan 6 15:00:51 2011 -0500 Merge remote branch 'smgfs/master' commit 3018400461fb6e162bef812e00dc321d0e638c90 Author: Moises Silva <moy@sangoma.com> Date: Thu Jan 6 14:54:19 2011 -0500 freetdm: only handle zt events when FTDM_CHANNEL_EVENT is set diff --git a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c index 6c6d6dd..1b55b73 100644 --- a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c +++ b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c @@ -1131,26 +1131,26 @@ FIO_SPAN_NEXT_EVENT_FUNCTION(zt_next_event) ftdm_channel_t *fchan = span->channels[i]; if (ftdm_test_flag(fchan, FTDM_CHANNEL_EVENT)) { ftdm_clear_flag(fchan, FTDM_CHANNEL_EVENT); - } - if (ioctl(fchan->sockfd, codes.GETEVENT, &zt_event_id) == -1) { - snprintf(span->last_error, sizeof(span->last_error), "%s", strerror(errno)); - return FTDM_FAIL; - } + if (ioctl(fchan->sockfd, codes.GETEVENT, &zt_event_id) == -1) { + snprintf(span->last_error, sizeof(span->last_error), "%s", strerror(errno)); + return FTDM_FAIL; + } - ftdm_channel_lock(fchan); - if ((zt_channel_process_event(fchan, &event_id, zt_event_id)) != FTDM_SUCCESS) { - ftdm_log_chan_msg(fchan, FTDM_LOG_ERROR, "Failed to process event from channel\n"); + ftdm_channel_lock(fchan); + if ((zt_channel_process_event(fchan, &event_id, zt_event_id)) != FTDM_SUCCESS) { + ftdm_log_chan_msg(fchan, FTDM_LOG_ERROR, "Failed to process event from channel\n"); + ftdm_channel_unlock(fchan); + return FTDM_FAIL; + } ftdm_channel_unlock(fchan); - return FTDM_FAIL; - } - ftdm_channel_unlock(fchan); - fchan->last_event_time = 0; - span->event_header.e_type = FTDM_EVENT_OOB; - span->event_header.enum_id = event_id; - span->event_header.channel = fchan; - *event = &span->event_header; - return FTDM_SUCCESS; + fchan->last_event_time = 0; + span->event_header.e_type = FTDM_EVENT_OOB; + span->event_header.enum_id = event_id; + span->event_header.channel = fchan; + *event = &span->event_header; + return FTDM_SUCCESS; + } } return FTDM_FAIL; commit 81f01f0ee7ed5bef174ee5e47e3932192b74f805 Author: Moises Silva <moy@sangoma.com> Date: Thu Jan 6 14:33:28 2011 -0500 freetdm: handle ZT_EVENT_NONE diff --git a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c index 5b507bd..6c6d6dd 100644 --- a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c +++ b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c @@ -1064,6 +1064,12 @@ static __inline__ ftdm_status_t zt_channel_process_event(ftdm_channel_t *fchan, fchan->rx_cas_bits = bits; } break; + case ZT_EVENT_NONE: + { + ftdm_log_chan_msg(fchan, FTDM_LOG_DEBUG, "No event\n"); + *event_id = FTDM_OOB_NOOP; + } + break; default: { ftdm_log_chan(fchan, FTDM_LOG_WARNING, "Unhandled event %d\n", zt_event_id); commit a3499c534383dbd62df150b78b815719fedbf16a Author: Moises Silva <moy@sangoma.com> Date: Thu Jan 6 13:50:26 2011 -0500 freetdm: fix wink/flash in ftmod_wanpipe diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index 2a203fa..9cbe9b3 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -1243,6 +1243,8 @@ static FIO_GET_ALARMS_FUNCTION(wanpipe_get_alarms) */ static __inline__ ftdm_status_t wanpipe_channel_process_event(ftdm_channel_t *fchan, ftdm_oob_event_t *event_id, wanpipe_tdm_api_t *tdm_api) { + ftdm_status_t status = FTDM_SUCCESS; + switch(tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_type) { case WP_API_EVENT_LINK_STATUS: { @@ -1260,13 +1262,15 @@ static __inline__ ftdm_status_t wanpipe_channel_process_event(ftdm_channel_t *fc case WP_API_EVENT_RXHOOK: { if (fchan->type == FTDM_CHAN_TYPE_FXS) { - *event_id = tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_hook_state & WP_TDMAPI_EVENT_RXHOOK_OFF ? FTDM_OOB_OFFHOOK : FTDM_OOB_ONHOOK; + *event_id = tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_hook_state + & WP_TDMAPI_EVENT_RXHOOK_OFF ? FTDM_OOB_OFFHOOK : FTDM_OOB_ONHOOK; + ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Got wanpipe %s\n", ftdm_oob_event2str(*event_id)); if (*event_id == FTDM_OOB_OFFHOOK) { if (ftdm_test_flag(fchan, FTDM_CHANNEL_FLASH)) { ftdm_clear_flag(fchan, FTDM_CHANNEL_FLASH); ftdm_clear_flag(fchan, FTDM_CHANNEL_WINK); *event_id = FTDM_OOB_FLASH; - goto event; + goto done; } else { ftdm_set_flag(fchan, FTDM_CHANNEL_WINK); } @@ -1275,12 +1279,14 @@ static __inline__ ftdm_status_t wanpipe_channel_process_event(ftdm_channel_t *fc ftdm_clear_flag(fchan, FTDM_CHANNEL_WINK); ftdm_clear_flag(fchan, FTDM_CHANNEL_FLASH); *event_id = FTDM_OOB_WINK; - goto event; + ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Wink flag is set, delivering %s\n", + ftdm_oob_event2str(*event_id)); + goto done; } else { ftdm_set_flag(fchan, FTDM_CHANNEL_FLASH); } } - break; + status = FTDM_BREAK; } else { ftdm_status_t status; wanpipe_tdm_api_t onhook_tdm_api; @@ -1355,8 +1361,8 @@ static __inline__ ftdm_status_t wanpipe_channel_process_event(ftdm_channel_t *fc } break; } -event: - return FTDM_SUCCESS; +done: + return status; } /** @@ -1385,12 +1391,16 @@ FIO_CHANNEL_NEXT_EVENT_FUNCTION(wanpipe_channel_next_event) } ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "read wanpipe event %d\n", tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_type); - if ((wanpipe_channel_process_event(ftdmchan, &event_id, &tdm_api)) != FTDM_SUCCESS) { + status = wanpipe_channel_process_event(ftdmchan, &event_id, &tdm_api); + if (status == FTDM_BREAK) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Ignoring event for now\n"); + } else if (status != FTDM_SUCCESS) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to process event from channel\n"); return FTDM_FAIL; + } else { + ftdmchan->last_event_time = 0; } - ftdmchan->last_event_time = 0; span->event_header.e_type = FTDM_EVENT_OOB; span->event_header.enum_id = event_id; span->event_header.channel = ftdmchan; @@ -1409,8 +1419,10 @@ FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_span_next_event) uint32_t i,err; ftdm_oob_event_t event_id; for(i = 1; i <= span->chan_count; i++) { + /* as a hack for wink/flash detection, wanpipe_poll_event overrides the timeout parameter + * to force the user to call this function each 5ms or so to detect the timeout of our wink/flash */ if (span->channels[i]->last_event_time && !ftdm_test_flag(span->channels[i], FTDM_CHANNEL_EVENT)) { - uint32_t diff = (uint32_t)(ftdm_current_time_in_ms() - span->channels[i]->last_event_time); + ftdm_time_t diff = ftdm_current_time_in_ms() - span->channels[i]->last_event_time; /* XX printf("%u %u %u\n", diff, (unsigned)ftdm_current_time_in_ms(), (unsigned)span->channels[i]->last_event_time); */ if (ftdm_test_flag(span->channels[i], FTDM_CHANNEL_WINK)) { if (diff > wp_globals.wink_ms) { @@ -1418,6 +1430,7 @@ FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_span_next_event) ftdm_clear_flag_locked(span->channels[i], FTDM_CHANNEL_FLASH); ftdm_set_flag_locked(span->channels[i], FTDM_CHANNEL_OFFHOOK); event_id = FTDM_OOB_OFFHOOK; + ftdm_log_chan(span->channels[i], FTDM_LOG_DEBUG, "Diff since last event = %llums, delivering %s now\n", diff, ftdm_oob_event2str(event_id)); goto event; } } @@ -1436,11 +1449,13 @@ FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_span_next_event) sangoma_tdm_txsig_onhook(ftdmchan->sockfd,&tdm_api); } + ftdm_log_chan(span->channels[i], FTDM_LOG_DEBUG, "Diff since last event = %llums, delivering %s now\n", diff, ftdm_oob_event2str(event_id)); goto event; } } } if (ftdm_test_flag(span->channels[i], FTDM_CHANNEL_EVENT)) { + ftdm_status_t status; wanpipe_tdm_api_t tdm_api; ftdm_channel_t *ftdmchan = span->channels[i]; memset(&tdm_api, 0, sizeof(tdm_api)); @@ -1448,18 +1463,22 @@ FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_span_next_event) err = sangoma_tdm_read_event(ftdmchan->sockfd, &tdm_api); if (err != FTDM_SUCCESS) { - snprintf(span->last_error, sizeof(span->last_error), "%s", strerror(errno)); + ftdm_log_chan(span->channels[i], FTDM_LOG_ERROR, "read wanpipe event got error: %s\n", strerror(errno)); return FTDM_FAIL; } ftdm_log_chan(span->channels[i], FTDM_LOG_DEBUG, "read wanpipe event %d\n", tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_type); ftdm_channel_lock(ftdmchan); - if ((wanpipe_channel_process_event(ftdmchan, &event_id, &tdm_api)) != FTDM_SUCCESS) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to process events from channel\n"); - ftdm_channel_unlock(ftdmchan); + status = wanpipe_channel_process_event(ftdmchan, &event_id, &tdm_api); + ftdm_channel_unlock(ftdmchan); + + if (status == FTDM_BREAK) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring event for now\n"); + continue; + } else if (status != FTDM_SUCCESS) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to process event from channel\n"); return FTDM_FAIL; } - ftdm_channel_unlock(ftdmchan); event: @@ -1471,7 +1490,7 @@ FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_span_next_event) return FTDM_SUCCESS; } } - return FTDM_FAIL; + return FTDM_BREAK; } /** commit 46853d7f3d08b20ba518d7b596e6082a2d8d9945 Author: Brian West <brian@freeswitch.org> Date: Thu Jan 6 11:38:36 2011 -0600 swigall and fix gitignore for new celt. diff --git a/libs/.gitignore b/libs/.gitignore index cc42ba4..b316465 100644 --- a/libs/.gitignore +++ b/libs/.gitignore @@ -1001,6 +1001,7 @@ /unimrcp/build/acmacros/lt~obsolete.m4 /*.tar.gz /celt-0.7.1/ +/celt-0.10.0/ /flite-1.3.99/ /freeradius-client-1.1.6/ /iksemel/test/tst-dom diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index d05f4f1..aa2a84f 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -1422,6 +1422,17 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_HOLD_MUSIC_VARIABLE_get() { } +SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_TEMP_HOLD_MUSIC_VARIABLE_get() { + char * jresult ; + char *result = 0 ; + + result = (char *) "temp_hold_music"; + + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_EXPORT_VARS_VARIABLE_get() { char * jresult ; char *result = 0 ; @@ -12304,6 +12315,30 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_digit_string(char * jarg1) { } +SWIGEXPORT char SWIGSTDCALL CSharp_switch_itodtmf(char jarg1) { + char jresult ; + char arg1 ; + char result; + + arg1 = (char)jarg1; + result = (char)switch_itodtmf(arg1); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_dtmftoi(char * jarg1) { + int jresult ; + char *arg1 = (char *) 0 ; + int result; + + arg1 = (char *)jarg1; + result = (int)switch_dtmftoi(arg1); + jresult = result; + return jresult; +} + + SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_known_bitrate(unsigned char jarg1) { unsigned long jresult ; switch_payload_t arg1 ; @@ -23501,6 +23536,30 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_get_variable_partner(void * } +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_get_hold_music(void * jarg1) { + char * jresult ; + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + char *result = 0 ; + + arg1 = (switch_channel_t *)jarg1; + result = (char *)switch_channel_get_hold_music(arg1); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_get_hold_music_partner(void * jarg1) { + char * jresult ; + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + char *result = 0 ; + + arg1 = (switch_channel_t *)jarg1; + result = (char *)switch_channel_get_hold_music_partner(arg1); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_export_variable_var_check(void * jarg1, char * jarg2, char * jarg3, char * jarg4, int jarg5) { int jresult ; switch_channel_t *arg1 = (switch_channel_t *) 0 ; @@ -23746,6 +23805,20 @@ SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_channel_test_cap(void * jarg1 } +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_channel_test_cap_partner(void * jarg1, int jarg2) { + unsigned long jresult ; + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + switch_channel_cap_t arg2 ; + uint32_t result; + + arg1 = (switch_channel_t *)jarg1; + arg2 = (switch_channel_cap_t)jarg2; + result = (uint32_t)switch_channel_test_cap_partner(arg1,arg2); + jresult = (unsigned long)result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_set_flag_partner(void * jarg1, int jarg2) { int jresult ; switch_channel_t *arg1 = (switch_channel_t *) 0 ; @@ -29077,6 +29150,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_deactivate_jitter_buffer(void * jar } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_pause_jitter_buffer(void * jarg1, int jarg2) { + int jresult ; + switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; + switch_bool_t arg2 ; + switch_status_t result; + + arg1 = (switch_rtp_t *)jarg1; + arg2 = (switch_bool_t)jarg2; + result = (switch_status_t)switch_rtp_pause_jitter_buffer(arg1,arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_set_flag(void * jarg1, unsigned long jarg2) { switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; switch_rtp_flag_t arg2 ; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index 849a6f6..5a2188a 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -2732,6 +2732,16 @@ public class freeswitch { return ret; } + public static char switch_itodtmf(char i) { + char ret = freeswitchPINVOKE.switch_itodtmf(i); + return ret; + } + + public static int switch_dtmftoi(string s) { + int ret = freeswitchPINVOKE.switch_dtmftoi(s); + return ret; + } + public static uint switch_known_bitrate(byte payload) { uint ret = freeswitchPINVOKE.switch_known_bitrate(payload); return ret; @@ -3281,6 +3291,16 @@ public class freeswitch { return ret; } + public static string switch_channel_get_hold_music(SWIGTYPE_p_switch_channel channel) { + string ret = freeswitchPINVOKE.switch_channel_get_hold_music(SWIGTYPE_p_switch_channel.getCPtr(channel)); + return ret; + } + + public static string switch_channel_get_hold_music_partner(SWIGTYPE_p_switch_channel channel) { + string ret = freeswitchPINVOKE.switch_channel_get_hold_music_partner(SWIGTYPE_p_switch_channel.getCPtr(channel)); + return ret; + } + public static switch_status_t switch_channel_export_variable_var_check(SWIGTYPE_p_switch_channel channel, string varname, string val, string export_varname, switch_bool_t var_check) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_export_variable_var_check(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, val, export_varname, (int)var_check); return ret; @@ -3369,6 +3389,11 @@ public class freeswitch { return ret; } + public static uint switch_channel_test_cap_partner(SWIGTYPE_p_switch_channel channel, switch_channel_cap_t cap) { + uint ret = freeswitchPINVOKE.switch_channel_test_cap_partner(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)cap); + return ret; + } + public static switch_bool_t switch_channel_set_flag_partner(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flag) { switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_channel_set_flag_partner(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flag); return ret; @@ -4664,6 +4689,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_rtp_pause_jitter_buffer(SWIGTYPE_p_switch_rtp rtp_session, switch_bool_t pause) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_pause_jitter_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), (int)pause); + return ret; + } + public static void switch_rtp_set_flag(SWIGTYPE_p_switch_rtp rtp_session, uint flags) { freeswitchPINVOKE.switch_rtp_set_flag(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), flags); } @@ -5418,6 +5448,7 @@ public class freeswitch { public static readonly string SWITCH_PROXY_MEDIA_VARIABLE = freeswitchPINVOKE.SWITCH_PROXY_MEDIA_VARIABLE_get(); public static readonly string SWITCH_ENDPOINT_DISPOSITION_VARIABLE = freeswitchPINVOKE.SWITCH_ENDPOINT_DISPOSITION_VARIABLE_get(); public static readonly string SWITCH_HOLD_MUSIC_VARIABLE = freeswitchPINVOKE.SWITCH_HOLD_MUSIC_VARIABLE_get(); + public static readonly string SWITCH_TEMP_HOLD_MUSIC_VARIABLE = freeswitchPINVOKE.SWITCH_TEMP_HOLD_MUSIC_VARIABLE_get(); public static readonly string SWITCH_EXPORT_VARS_VARIABLE = freeswitchPINVOKE.SWITCH_EXPORT_VARS_VARIABLE_get(); public static readonly string SWITCH_BRIDGE_EXPORT_VARS_VARIABLE = freeswitchPINVOKE.SWITCH_BRIDGE_EXPORT_VARS_VARIABLE_get(); public static readonly string SWITCH_R_SDP_VARIABLE = freeswitchPINVOKE.SWITCH_R_SDP_VARIABLE_get(); @@ -6006,6 +6037,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_HOLD_MUSIC_VARIABLE_get")] public static extern string SWITCH_HOLD_MUSIC_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_TEMP_HOLD_MUSIC_VARIABLE_get")] + public static extern string SWITCH_TEMP_HOLD_MUSIC_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_EXPORT_VARS_VARIABLE_get")] public static extern string SWITCH_EXPORT_VARS_VARIABLE_get(); @@ -8589,6 +8623,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_is_digit_string")] public static extern int switch_is_digit_string(string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_itodtmf")] + public static extern char switch_itodtmf(char jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_dtmftoi")] + public static extern int switch_dtmftoi(string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_known_bitrate")] public static extern uint switch_known_bitrate(byte jarg1); @@ -11310,6 +11350,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_variable_partner")] public static extern string switch_channel_get_variable_partner(HandleRef jarg1, string jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_hold_music")] + public static extern string switch_channel_get_hold_music(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_hold_music_partner")] + public static extern string switch_channel_get_hold_music_partner(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_export_variable_var_check")] public static extern int switch_channel_export_variable_var_check(HandleRef jarg1, string jarg2, string jarg3, string jarg4, int jarg5); @@ -11367,6 +11413,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_test_cap")] public static extern uint switch_channel_test_cap(HandleRef jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_test_cap_partner")] + public static extern uint switch_channel_test_cap_partner(HandleRef jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_flag_partner")] public static extern int switch_channel_set_flag_partner(HandleRef jarg1, int jarg2); @@ -12480,6 +12529,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_deactivate_jitter_buffer")] public static extern int switch_rtp_deactivate_jitter_buffer(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_pause_jitter_buffer")] + public static extern int switch_rtp_pause_jitter_buffer(HandleRef jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_flag")] public static extern void switch_rtp_set_flag(HandleRef jarg1, uint jarg2); @@ -21477,6 +21529,8 @@ public enum switch_channel_cap_t { CC_MEDIA_ACK = 1, CC_BYPASS_MEDIA, CC_PROXY_MEDIA, + CC_JITTERBUFFER, + CC_FS_RTP, CC_FLAG_MAX } commit b09c32c19a04a82a81c1bd532fe59dcb6a923f73 Author: Moises Silva <moy@sangoma.com> Date: Thu Jan 6 09:51:17 2011 -0500 freetdm: use /bin/sh and not /bin/bash in the bootstrap script diff --git a/libs/freetdm/bootstrap b/libs/freetdm/bootstrap index 8ca4856..247d396 100755 --- a/libs/freetdm/bootstrap +++ b/libs/freetdm/bootstrap @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh autoheader libtoolize --force --copy aclocal commit 309ced0eace881a2cddcf6807fe467c914ac9bb9 Merge: becf16c 4272dcb Author: Moises Silva <moy@sangoma.com> Date: Thu Jan 6 09:04:57 2011 -0500 Merge remote branch 'fsorig/master' commit 4272dcbff507adbb02a4d6f56375420f58cfb510 Author: Jeff Lenk <jeff@jefflenk.com> Date: Wed Jan 5 20:12:19 2011 -0600 trivial build fix for last commit diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 1483e88..4354f0d 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -3001,7 +3001,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_bind_dtmf_meta_session(switch_core_se md->sr[SWITCH_DTMF_RECV].map[key].flags |= SMF_HOLD_BLEG; md->sr[SWITCH_DTMF_RECV].map[key].bind_flags = bind_flags; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Bound A-Leg: %c%c %s\n", meta, switch_itodtmf(key), app); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Bound A-Leg: %c%c %s\n", meta, switch_itodtmf((char)key), app); } if ((bind_flags & SBF_DIAL_BLEG)) { md->sr[SWITCH_DTMF_SEND].meta = meta; @@ -3009,12 +3009,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_bind_dtmf_meta_session(switch_core_se md->sr[SWITCH_DTMF_SEND].map[key].app = switch_core_session_strdup(session, app); md->sr[SWITCH_DTMF_SEND].map[key].flags |= SMF_HOLD_BLEG; md->sr[SWITCH_DTMF_SEND].map[key].bind_flags = bind_flags; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Bound B-Leg: %c%c %s\n", meta, switch_itodtmf(key), app); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Bound B-Leg: %c%c %s\n", meta, switch_itodtmf((char)key), app); } } else { if ((bind_flags & SBF_DIAL_ALEG)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "UnBound A-Leg: %c%c\n", meta, switch_itodtmf(key)); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "UnBound A-Leg: %c%c\n", meta, switch_itodtmf((char)key)); md->sr[SWITCH_DTMF_SEND].map[key].app = NULL; } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "UnBound: B-Leg %c%d\n", meta, key); commit 2091e33dbe7b6b24251833ffd7d3a5c73d61e50d Author: Jeff Lenk <jeff@jefflenk.com> Date: Wed Jan 5 19:54:49 2011 -0600 windows update celt-0.10.0 diff --git a/libs/win32/Download CELT.vcproj b/libs/win32/Download CELT.vcproj index e32ebd4..cac1079 100644 --- a/libs/win32/Download CELT.vcproj +++ b/libs/win32/Download CELT.vcproj @@ -76,7 +76,7 @@ <Tool Name="VCCustomBuildTool" Description="Downloading CELT." - CommandLine="if not exist "$(ProjectDir)..\celt-0.7.1" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/downloads/libs/celt-0.7.1.tar.gz "$(ProjectDir).." xcopy "$(ProjectDir)\celt\config.h" "$(ProjectDir)..\celt-0.7.1\libcelt" /C /D /Y /S /I xcopy "$(ProjectDir)\celt\float_cast.h" "$(ProjectDir)..\celt-0.7.1\libcelt" /C /D /Y /S /I " + CommandLine="if not exist "$(ProjectDir)..\celt-0.10.0" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/downloads/libs/celt-0.10.0.tar.gz "$(ProjectDir).." xcopy "$(ProjectDir)\celt\config.h" "$(ProjectDir)..\celt-0.10.0\libcelt" /C /D /Y /S /I xcopy "$(ProjectDir)\celt\float_cast.h" "$(ProjectDir)..\celt-0.10.0\libcelt" /C /D /Y /S /I " Outputs="$(ProjectDir)..\CELT" /> </FileConfiguration> @@ -86,7 +86,7 @@ <Tool Name="VCCustomBuildTool" Description="Downloading CELT." - CommandLine="if not exist "$(ProjectDir)..\celt-0.7.1" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/downloads/libs/celt-0.7.1.tar.gz "$(ProjectDir).." xcopy "$(ProjectDir)\celt\config.h" "$(ProjectDir)..\celt-0.7.1\libcelt" /C /D /Y /S /I xcopy "$(ProjectDir)\celt\float_cast.h" "$(ProjectDir)..\celt-0.7.1\libcelt" /C /D /Y /S /I " + CommandLine="if not exist "$(ProjectDir)..\celt-0.10.0" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/downloads/libs/celt-0.10.0.tar.gz "$(ProjectDir).." xcopy "$(ProjectDir)\celt\config.h" "$(ProjectDir)..\celt-0.10.0\libcelt" /C /D /Y /S /I xcopy "$(ProjectDir)\celt\float_cast.h" "$(ProjectDir)..\celt-0.10.0\libcelt" /C /D /Y /S /I " Outputs="$(ProjectDir)..\CELT" /> </FileConfiguration> diff --git a/libs/win32/Download CELT.vcxproj b/libs/win32/Download CELT.vcxproj index af8c9aa..527ff5a 100644 --- a/libs/win32/Download CELT.vcxproj +++ b/libs/win32/Download CELT.vcxproj @@ -65,15 +65,15 @@ <CustomBuild Include="cleancount"> <FileType>Document</FileType> <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Downloading CELT.</Message> - <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">if not exist "$(ProjectDir)..\celt-0.7.1" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/downloads/libs/celt-0.7.1.tar.gz "$(ProjectDir).." -xcopy "$(ProjectDir)\celt\config.h" "$(ProjectDir)..\celt-0.7.1\libcelt" /C /D /Y /S /I -xcopy "$(ProjectDir)\celt\float_cast.h" "$(ProjectDir)..\celt-0.7.1\libcelt" /C /D /Y /S /I + <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">if not exist "$(ProjectDir)..\celt-0.10.0" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/downloads/libs/celt-0.10.0.tar.gz "$(ProjectDir).." +xcopy "$(ProjectDir)\celt\config.h" "$(ProjectDir)..\celt-0.10.0\libcelt" /C /D /Y /S /I +xcopy "$(ProjectDir)\celt\float_cast.h" "$(ProjectDir)..\celt-0.10.0\libcelt" /C /D /Y /S /I </Command> <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)..\CELT;%(Outputs)</Outputs> <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Downloading CELT.</Message> - <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">if not exist "$(ProjectDir)..\celt-0.7.1" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/downloads/libs/celt-0.7.1.tar.gz "$(ProjectDir).." -xcopy "$(ProjectDir)\celt\config.h" "$(ProjectDir)..\celt-0.7.1\libcelt" /C /D /Y /S /I -xcopy "$(ProjectDir)\celt\float_cast.h" "$(ProjectDir)..\celt-0.7.1\libcelt" /C /D /Y /S /I + <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">if not exist "$(ProjectDir)..\celt-0.10.0" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://files.freeswitch.org/downloads/libs/celt-0.10.0.tar.gz "$(ProjectDir).." +xcopy "$(ProjectDir)\celt\config.h" "$(ProjectDir)..\celt-0.10.0\libcelt" /C /D /Y /S /I +xcopy "$(ProjectDir)\celt\float_cast.h" "$(ProjectDir)..\celt-0.10.0\libcelt" /C /D /Y /S /I </Command> <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)..\CELT;%(Outputs)</Outputs> </CustomBuild> diff --git a/libs/win32/celt/libcelt.vcproj b/libs/win32/celt/libcelt.vcproj index 0533096..9a19d9e 100644 --- a/libs/win32/celt/libcelt.vcproj +++ b/libs/win32/celt/libcelt.vcproj @@ -44,7 +44,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories="..\..\celt-0.7.1\libcelt" + AdditionalIncludeDirectories="..\..\celt-0.10.0\libcelt" PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H" MinimalRebuild="true" BasicRuntimeChecks="3" @@ -107,7 +107,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories="..\..\celt-0.7.1\libcelt" + AdditionalIncludeDirectories="..\..\celt-0.10.0\libcelt" PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H;_AMD64_;_WIN64" MinimalRebuild="true" BasicRuntimeChecks="3" @@ -171,7 +171,7 @@ Name="VCCLCompilerTool" Optimization="2" EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories=""..\..\celt-0.7.1\libcelt"" + AdditionalIncludeDirectories=""..\..\celt-0.10.0\libcelt"" PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H" RuntimeLibrary="2" EnableFunctionLevelLinking="true" @@ -235,7 +235,7 @@ Name="VCCLCompilerTool" Optimization="2" EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories=""..\..\celt-0.7.1\libcelt"" + AdditionalIncludeDirectories=""..\..\celt-0.10.0\libcelt"" PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H;_AMD64_;_WIN64" RuntimeLibrary="2" EnableFunctionLevelLinking="true" @@ -281,71 +281,79 @@ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" > <File - RelativePath="..\..\celt-0.7.1\libcelt\bands.c" + RelativePath="..\..\celt-0.10.0\libcelt\bands.c" > </File> <File - RelativePath="..\..\celt-0.7.1\libcelt\celt.c" + RelativePath="..\..\celt-0.10.0\libcelt\celt.c" > </File> <File - RelativePath="..\..\celt-0.7.1\libcelt\cwrs.c" + RelativePath="..\..\celt-0.10.0\libcelt\cwrs.c" > </File> <File - RelativePath="..\..\celt-0.7.1\libcelt\entcode.c" + RelativePath="..\..\celt-0.10.0\libcelt\entcode.c" > </File> <File - RelativePath="..\..\celt-0.7.1\libcelt\entdec.c" + RelativePath="..\..\celt-0.10.0\libcelt\entdec.c" > </File> <File - RelativePath="..\..\celt-0.7.1\libcelt\entenc.c" + RelativePath="..\..\celt-0.10.0\libcelt\entenc.c" > </File> <File - RelativePath="..\..\celt-0.7.1\libcelt\header.c" + RelativePath="..\..\celt-0.10.0\libcelt\header.c" > </File> <File - RelativePath="..\..\celt-0.7.1\libcelt\kiss_fft.c" + RelativePath="..\..\celt-0.10.0\libcelt\kiss_fft.c" > </File> <File - RelativePath="..\..\celt-0.7.1\libcelt\laplace.c" + RelativePath="..\..\celt-0.10.0\libcelt\laplace.c" > </File> <File - RelativePath="..\..\celt-0.7.1\libcelt\mdct.c" + RelativePath="..\..\celt-0.10.0\libcelt\mathops.c" > </File> <File - RelativePath="..\..\celt-0.7.1\libcelt\modes.c" + RelativePath="..\..\celt-0.10.0\libcelt\mdct.c" > </File> <File - RelativePath="..\..\celt-0.7.1\libcelt\pitch.c" + RelativePath="..\..\celt-0.10.0\libcelt\modes.c" > </File> <File - RelativePath="..\..\celt-0.7.1\libcelt\quant_bands.c" + RelativePath="..\..\celt-0.10.0\libcelt\pitch.c" > </File> <File - RelativePath="..\..\celt-0.7.1\libcelt\rangedec.c" + RelativePath="..\..\celt-0.10.0\libcelt\plc.c" > </File> <File - RelativePath="..\..\celt-0.7.1\libcelt\rangeenc.c" + RelativePath="..\..\celt-0.10.0\libcelt\quant_bands.c" > </File> <File - RelativePath="..\..\celt-0.7.1\libcelt\rate.c" + RelativePath="..\..\celt-0.10.0\libcelt\rangedec.c" > </File> <File - RelativePath="..\..\celt-0.7.1\libcelt\vq.c" + RelativePath="..\..\celt-0.10.0\libcelt\rangeenc.c" + > + </File> + <File + RelativePath="..\..\celt-0.10.0\libcelt\rate.c" + > + </File> + <File + RelativePath="..\..\celt-0.10.0\libcelt\vq.c" > </File> </Filter> diff --git a/libs/win32/celt/libcelt.vcxproj b/libs/win32/celt/libcelt.vcxproj index 6abd099..b774320 100644 --- a/libs/win32/celt/libcelt.vcxproj +++ b/libs/win32/celt/libcelt.vcxproj @@ -68,7 +68,7 @@ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>..\..\celt-0.7.1\libcelt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\..\celt-0.10.0\libcelt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> @@ -82,7 +82,7 @@ </Midl> <ClCompile> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>..\..\celt-0.7.1\libcelt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\..\celt-0.10.0\libcelt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;HAVE_CONFIG_H;_AMD64_;_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> @@ -94,7 +94,7 @@ <ClCompile> <Optimization>MaxSpeed</Optimization> <IntrinsicFunctions>true</IntrinsicFunctions> - <AdditionalIncludeDirectories>..\..\celt-0.7.1\libcelt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\..\celt-0.10.0\libcelt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <FunctionLevelLinking>true</FunctionLevelLinking> @@ -108,7 +108,7 @@ <ClCompile> <Optimization>MaxSpeed</Optimization> <IntrinsicFunctions>true</IntrinsicFunctions> - <AdditionalIncludeDirectories>..\..\celt-0.7.1\libcelt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\..\celt-0.10.0\libcelt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;HAVE_CONFIG_H;_AMD64_;_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <FunctionLevelLinking>true</FunctionLevelLinking> @@ -116,23 +116,25 @@ </ClCompile> </ItemDefinitionGroup> <ItemGroup> - <ClCompile Include="..\..\celt-0.7.1\libcelt\bands.c" /> - <ClCompile Include="..\..\celt-0.7.1\libcelt\celt.c" /> - <ClCompile Include="..\..\celt-0.7.1\libcelt\cwrs.c" /> - <ClCompile Include="..\..\celt-0.7.1\libcelt\entcode.c" /> - <ClCompile Include="..\..\celt-0.7.1\libcelt\entdec.c" /> - <ClCompile Include="..\..\celt-0.7.1\libcelt\entenc.c" /> - <ClCompile Include="..\..\celt-0.7.1\libcelt\header.c" /> - <ClCompile Include="..\..\celt-0.7.1\libcelt\kiss_fft.c" /> - <ClCompile Include="..\..\celt-0.7.1\libcelt\laplace.c" /> - <ClCompile Include="..\..\celt-0.7.1\libcelt\mdct.c" /> - <ClCompile Include="..\..\celt-0.7.1\libcelt\modes.c" /> - <ClCompile Include="..\..\celt-0.7.1\libcelt\pitch.c" /> - <ClCompile Include="..\..\celt-0.7.1\libcelt\quant_bands.c" /> - <ClCompile Include="..\..\celt-0.7.1\libcelt\rangedec.c" /> - <ClCompile Include="..\..\celt-0.7.1\libcelt\rangeenc.c" /> - <ClCompile Include="..\..\celt-0.7.1\libcelt\rate.c" /> - <ClCompile Include="..\..\celt-0.7.1\libcelt\vq.c" /> + <ClCompile Include="..\..\celt-0.10.0\libcelt\bands.c" /> + <ClCompile Include="..\..\celt-0.10.0\libcelt\celt.c" /> + <ClCompile Include="..\..\celt-0.10.0\libcelt\cwrs.c" /> + <ClCompile Include="..\..\celt-0.10.0\libcelt\entcode.c" /> + <ClCompile Include="..\..\celt-0.10.0\libcelt\entdec.c" /> + <ClCompile Include="..\..\celt-0.10.0\libcelt\entenc.c" /> + <ClCompile Include="..\..\celt-0.10.0\libcelt\header.c" /> + <ClCompile Include="..\..\celt-0.10.0\libcelt\kiss_fft.c" /> + <ClCompile Include="..\..\celt-0.10.0\libcelt\laplace.c" /> + <ClCompile Include="..\..\celt-0.10.0\libcelt\mathops.c" /> + <ClCompile Include="..\..\celt-0.10.0\libcelt\mdct.c" /> + <ClCompile Include="..\..\celt-0.10.0\libcelt\modes.c" /> + <ClCompile Include="..\..\celt-0.10.0\libcelt\pitch.c" /> + <ClCompile Include="..\..\celt-0.10.0\libcelt\plc.c" /> + <ClCompile Include="..\..\celt-0.10.0\libcelt\quant_bands.c" /> + <ClCompile Include="..\..\celt-0.10.0\libcelt\rangedec.c" /> + <ClCompile Include="..\..\celt-0.10.0\libcelt\rangeenc.c" /> + <ClCompile Include="..\..\celt-0.10.0\libcelt\rate.c" /> + <ClCompile Include="..\..\celt-0.10.0\libcelt\vq.c" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\Download CELT.vcxproj"> diff --git a/libs/win32/celt/libcelt.vcxproj.filters b/libs/win32/celt/libcelt.vcxproj.filters index f3cb02a..2223656 100644 --- a/libs/win32/celt/libcelt.vcxproj.filters +++ b/libs/win32/celt/libcelt.vcxproj.filters @@ -15,55 +15,61 @@ </Filter> </ItemGroup> <ItemGroup> - <ClCompile Include="..\..\celt-0.7.1\libcelt\bands.c"> + <ClCompile Include="..\..\celt-0.10.0\libcelt\bands.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\..\celt-0.7.1\libcelt\celt.c"> + <ClCompile Include="..\..\celt-0.10.0\libcelt\celt.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\..\celt-0.7.1\libcelt\cwrs.c"> + <ClCompile Include="..\..\celt-0.10.0\libcelt\cwrs.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\..\celt-0.7.1\libcelt\entcode.c"> + <ClCompile Include="..\..\celt-0.10.0\libcelt\entcode.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\..\celt-0.7.1\libcelt\entdec.c"> + <ClCompile Include="..\..\celt-0.10.0\libcelt\entdec.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\..\celt-0.7.1\libcelt\entenc.c"> + <ClCompile Include="..\..\celt-0.10.0\libcelt\entenc.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\..\celt-0.7.1\libcelt\header.c"> + <ClCompile Include="..\..\celt-0.10.0\libcelt\header.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\..\celt-0.7.1\libcelt\kiss_fft.c"> + <ClCompile Include="..\..\celt-0.10.0\libcelt\kiss_fft.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\..\celt-0.7.1\libcelt\laplace.c"> + <ClCompile Include="..\..\celt-0.10.0\libcelt\laplace.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\..\celt-0.7.1\libcelt\mdct.c"> + <ClCompile Include="..\..\celt-0.10.0\libcelt\mdct.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\..\celt-0.7.1\libcelt\modes.c"> + <ClCompile Include="..\..\celt-0.10.0\libcelt\modes.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\..\celt-0.7.1\libcelt\pitch.c"> + <ClCompile Include="..\..\celt-0.10.0\libcelt\pitch.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\..\celt-0.7.1\libcelt\quant_bands.c"> + <ClCompile Include="..\..\celt-0.10.0\libcelt\quant_bands.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\..\celt-0.7.1\libcelt\rangedec.c"> + <ClCompile Include="..\..\celt-0.10.0\libcelt\rangedec.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\..\celt-0.7.1\libcelt\rangeenc.c"> + <ClCompile Include="..\..\celt-0.10.0\libcelt\rangeenc.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\..\celt-0.7.1\libcelt\rate.c"> + <ClCompile Include="..\..\celt-0.10.0\libcelt\rate.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\..\celt-0.7.1\libcelt\vq.c"> + <ClCompile Include="..\..\celt-0.10.0\libcelt\vq.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\celt-0.10.0\libcelt\mathops.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\celt-0.10.0\libcelt\plc.c"> <Filter>Source Files</Filter> </ClCompile> </ItemGroup> diff --git a/src/mod/codecs/mod_celt/mod_celt.vcproj b/src/mod/codecs/mod_celt/mod_celt.vcproj index 6eb457d..080f95e 100644 --- a/src/mod/codecs/mod_celt/mod_celt.vcproj +++ b/src/mod/codecs/mod_celt/mod_celt.vcproj @@ -42,7 +42,7 @@ /> <Tool Name="VCCLCompilerTool" - AdditionalIncludeDirectories="..\..\..\..\libs\celt-0.7.1\libcelt" + AdditionalIncludeDirectories="..\..\..\..\libs\celt-0.10.0\libcelt" UsePrecompiledHeader="0" /> <Tool @@ -108,7 +108,7 @@ /> <Tool Name="VCCLCompilerTool" - AdditionalIncludeDirectories="..\..\..\..\libs\celt-0.7.1\libcelt" + AdditionalIncludeDirectories="..\..\..\..\libs\celt-0.10.0\libcelt" UsePrecompiledHeader="0" /> <Tool @@ -172,7 +172,7 @@ /> <Tool Name="VCCLCompilerTool" - AdditionalIncludeDirectories="..\..\..\..\libs\celt-0.7.1\libcelt" + AdditionalIncludeDirectories="..\..\..\..\libs\celt-0.10.0\libcelt" UsePrecompiledHeader="0" /> <Tool @@ -238,7 +238,7 @@ /> <Tool Name="VCCLCompilerTool" - AdditionalIncludeDirectories="..\..\..\..\libs\celt-0.7.1\libcelt" + AdditionalIncludeDirectories="..\..\..\..\libs\celt-0.10.0\libcelt" UsePrecompiledHeader="0" /> <Tool diff --git a/src/mod/codecs/mod_celt/mod_celt.vcxproj b/src/mod/codecs/mod_celt/mod_celt.vcxproj index ee8a70c..d1f0705 100644 --- a/src/mod/codecs/mod_celt/mod_celt.vcxproj +++ b/src/mod/codecs/mod_celt/mod_celt.vcxproj @@ -65,7 +65,7 @@ </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> - <AdditionalIncludeDirectories>..\..\..\..\libs\celt-0.7.1\libcelt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\..\..\..\libs\celt-0.10.0\libcelt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PrecompiledHeader> </PrecompiledHeader> </ClCompile> @@ -80,7 +80,7 @@ <TargetEnvironment>X64</TargetEnvironment> </Midl> <ClCompile> - <AdditionalIncludeDirectories>..\..\..\..\libs\celt-0.7.1\libcelt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\..\..\..\libs\celt-0.10.0\libcelt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PrecompiledHeader> </PrecompiledHeader> </ClCompile> @@ -93,7 +93,7 @@ </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ClCompile> - <AdditionalIncludeDirectories>..\..\..\..\libs\celt-0.7.1\libcelt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\..\..\..\libs\celt-0.10.0\libcelt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PrecompiledHeader> </PrecompiledHeader> </ClCompile> @@ -108,7 +108,7 @@ <TargetEnvironment>X64</TargetEnvironment> </Midl> <ClCompile> - <AdditionalIncludeDirectories>..\..\..\..\libs\celt-0.7.1\libcelt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\..\..\..\libs\celt-0.10.0\libcelt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PrecompiledHeader> </PrecompiledHeader> </ClCompile> commit b262f44ce241f84f9616cf92f2072fd7612cc944 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Jan 5 18:58:56 2011 -0600 add temp_hold_music var that is only valid until you transfer the call and finishing touches on bind meta to A-D diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 7388094..4602dd2 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -2531,7 +2531,7 @@ SWITCH_STANDARD_APP(audio_bridge_function) camp_data = (char *) data; } - if (!(moh = switch_channel_get_variable(caller_channel, SWITCH_HOLD_MUSIC_VARIABLE))) { + if (!(moh = switch_channel_get_hold_music(caller_channel))) { moh = switch_channel_get_variable(caller_channel, "campon_hold_music"); } diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 1f9d9d6..2e07413 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -397,12 +397,12 @@ static switch_status_t on_dtmf(switch_core_session_t *session, void *input, swit const char *moh_a = NULL, *moh_b = NULL; if (!(moh_b = switch_channel_get_variable(bchan, "fifo_music"))) { - moh_b = switch_channel_get_variable(bchan, SWITCH_HOLD_MUSIC_VARIABLE); + moh_b = switch_channel_get_hold_music(bchan); } if (!(moh_a = switch_channel_get_variable(channel, "fifo_hold_music"))) { if (!(moh_a = switch_channel_get_variable(channel, "fifo_music"))) { - moh_a = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE); + moh_a = switch_channel_get_hold_music(channel); } } diff --git a/src/mod/applications/mod_spy/mod_spy.c b/src/mod/applications/mod_spy/mod_spy.c index 411ed09..9986703 100644 --- a/src/mod/applications/mod_spy/mod_spy.c +++ b/src/mod/applications/mod_spy/mod_spy.c @@ -83,7 +83,7 @@ static switch_status_t spy_on_exchange_media(switch_core_session_t *session) static switch_status_t spy_on_park(switch_core_session_t *session) { switch_channel_t *channel = switch_core_session_get_channel(session); - const char *moh = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE); + const char *moh = switch_channel_get_hold_music(channel); while (switch_channel_ready(channel) && switch_channel_get_state(channel) == CS_PARK) { if (moh) { diff --git a/src/mod/applications/mod_valet_parking/mod_valet_parking.c b/src/mod/applications/mod_valet_parking/mod_valet_parking.c index 369ae97..42ece97 100644 --- a/src/mod/applications/mod_valet_parking/mod_valet_parking.c +++ b/src/mod/applications/mod_valet_parking/mod_valet_parking.c @@ -234,7 +234,7 @@ SWITCH_STANDARD_APP(valet_parking_function) } if (!(tmp = switch_channel_get_variable(channel, "valet_hold_music"))) { - tmp = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE); + tmp = switch_channel_get_hold_music(channel); } if (tmp) music = tmp; diff --git a/src/mod/endpoints/mod_khomp/src/khomp_pvt_kxe1.cpp b/src/mod/endpoints/mod_khomp/src/khomp_pvt_kxe1.cpp index 0d3c3b3..997973b 100644 --- a/src/mod/endpoints/mod_khomp/src/khomp_pvt_kxe1.cpp +++ b/src/mod/endpoints/mod_khomp/src/khomp_pvt_kxe1.cpp @@ -2744,7 +2744,7 @@ bool BoardE1::KhompPvtFXS::transfer(std::string & context, bool blind) callFXS()->_uuid_other_session = getUUID(peer_session); const char *stream = NULL; - if (!(stream = switch_channel_get_variable(peer_channel, SWITCH_HOLD_MUSIC_VARIABLE))) + if (!(stream = switch_channel_get_hold_music(peer_channel))) { stream = "silence"; } diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 99c18cb..2643ceb 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -5560,7 +5560,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t switch_core_event_hook_add_state_change(a_session, xfer_hanguphook); switch_channel_set_variable(a_channel, "att_xfer_kill_uuid", switch_core_session_get_uuid(b_session)); - if ((tmp = switch_channel_get_variable(a_channel, SWITCH_HOLD_MUSIC_VARIABLE))) { + if ((tmp = switch_channel_get_hold_music(a_channel))) { moh = tmp; } diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 6b8521b..715b70f 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -3663,7 +3663,7 @@ void sofia_glue_toggle_hold(private_object_t *tech_pvt, int sendonly) switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_hold_packets); } - if (!(stream = switch_channel_get_variable(tech_pvt->channel, SWITCH_HOLD_MUSIC_VARIABLE))) { + if (!(stream = switch_channel_get_hold_music(tech_pvt->channel))) { stream = tech_pvt->profile->hold_music; } diff --git a/src/switch_channel.c b/src/switch_channel.c index f592158..918ad82 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -648,9 +648,9 @@ SWITCH_DECLARE(void) switch_channel_mark_hold(switch_channel_t *channel, switch_ SWITCH_DECLARE(const char *) switch_channel_get_hold_music(switch_channel_t *channel) { - const char *var = switch_channel_get_variable(channel, SWITCH_TEMP_HOLD_MUSIC_VARIABLE); + const char *var; - if (!var) { + if (!(var = switch_channel_get_variable(channel, SWITCH_TEMP_HOLD_MUSIC_VARIABLE))) { var = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE); } diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 5019e06..496c29b 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -540,8 +540,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se const char *stream; b_uuid = switch_core_session_strdup(session, b_uuid); - if (!(stream = switch_channel_get_variable_partner(channel, SWITCH_HOLD_MUSIC_VARIABLE))) { - stream = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE); + if (!(stream = switch_channel_get_hold_music_partner(channel))) { + stream = switch_channel_get_hold_music(channel); } if (stream && switch_is_moh(stream)) { @@ -1269,7 +1269,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_hold(switch_core_session_t *session, switch_core_session_receive_message(session, &msg); - if (moh && (stream = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE))) { + if (moh && (stream = switch_channel_get_hold_music(channel))) { if ((other_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) { switch_ivr_broadcast(other_uuid, stream, SMF_ECHO_ALEG | SMF_LOOP); } @@ -1514,6 +1514,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_ /* clear all state handlers */ switch_channel_clear_state_handler(channel, NULL); + /* reset temp hold music */ + switch_channel_set_variable(channel, SWITCH_TEMP_HOLD_MUSIC_VARIABLE, NULL); + if ((profile = switch_channel_get_caller_profile(channel))) { const char *var; diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index e987a46..1483e88 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -2825,11 +2825,11 @@ static switch_status_t meta_on_dtmf(switch_core_session_t *session, const switch } if (md->sr[direction].meta_on) { - if (dtmf->digit >= '0' && dtmf->digit <= '9') { + if (is_dtmf(dtmf->digit)) { int ok = 0; *digit = dtmf->digit; - dval = atoi(digit); - + dval = switch_dtmftoi(digit); + if (direction == SWITCH_DTMF_RECV && (md->sr[direction].map[dval].bind_flags & SBF_DIAL_ALEG)) { ok = 1; } else if (direction == SWITCH_DTMF_SEND && (md->sr[direction].map[dval].bind_flags & SBF_DIAL_BLEG)) { diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 7e5f71e..523dfde 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -2394,7 +2394,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_soft_hold(switch_core_session_t *sess if (moh_b) { moh = moh_b; } else { - moh = switch_channel_get_variable(other_channel, SWITCH_HOLD_MUSIC_VARIABLE); + moh = switch_channel_get_hold_music(other_channel); } if (!zstr(moh) && strcasecmp(moh, "silence") && !switch_channel_test_flag(other_channel, CF_BROADCAST)) { @@ -2405,7 +2405,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_soft_hold(switch_core_session_t *sess if (moh_a) { moh = moh_a; } else { - moh = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE); + moh = switch_channel_get_hold_music(channel); } if (!zstr(moh) && strcasecmp(moh, "silence")) { commit 27869d7a265aacdee54933fce0aff5cb0d404d11 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Jan 5 17:53:27 2011 -0600 add bind meta on A-D and refactor diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index 368b895..c0bef4b 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -256,6 +256,8 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_partner_var_check(sw const char *varname, const char *value, switch_bool_t var_check); SWITCH_DECLARE(const char *) switch_channel_get_variable_partner(switch_channel_t *channel, const char *varname); +SWITCH_DECLARE(const char *) switch_channel_get_hold_music(switch_channel_t *channel); +SWITCH_DECLARE(const char *) switch_channel_get_hold_music_partner(switch_channel_t *channel); #define switch_channel_set_variable(_channel, _var, _val) switch_channel_set_variable_var_check(_channel, _var, _val, SWITCH_TRUE) #define switch_channel_set_variable_partner(_channel, _var, _val) switch_channel_set_variable_partner_var_check(_channel, _var, _val, SWITCH_TRUE) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 98ac804..01f890d 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -156,6 +156,7 @@ SWITCH_BEGIN_EXTERN_C #define SWITCH_PROXY_MEDIA_VARIABLE "proxy_media" #define SWITCH_ENDPOINT_DISPOSITION_VARIABLE "endpoint_disposition" #define SWITCH_HOLD_MUSIC_VARIABLE "hold_music" +#define SWITCH_TEMP_HOLD_MUSIC_VARIABLE "temp_hold_music" #define SWITCH_EXPORT_VARS_VARIABLE "export_vars" #define SWITCH_BRIDGE_EXPORT_VARS_VARIABLE "bridge_export_vars" #define SWITCH_R_SDP_VARIABLE "switch_r_sdp" diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 259de0a..4771dba 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -184,6 +184,32 @@ static inline switch_bool_t switch_is_digit_string(const char *s) return SWITCH_TRUE; } +static inline char switch_itodtmf(char i) +{ + char r = i; + + if (i > 9 && i < 14) { + r = i + 55; + } + + return r; +} + +static inline int switch_dtmftoi(char *s) +{ + int r; + + switch_assert(s); + + if (!(r = atoi(s))) { + int l = tolower(*s); + if (l > 96 && l < 101) { + r = l - 87; + } + } + + return r; +} static inline uint32_t switch_known_bitrate(switch_payload_t payload) { diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index e5e4fe5..7388094 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -389,7 +389,7 @@ SWITCH_STANDARD_APP(dtmf_unbind_function) int kval = 0; if (key) { - kval = atoi(key); + kval = switch_dtmftoi(key); } switch_ivr_unbind_dtmf_meta_session(session, kval); @@ -405,7 +405,7 @@ SWITCH_STANDARD_APP(dtmf_bind_function) if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data)) && (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) == 4) { - int kval = atoi(argv[0]); + int kval = switch_dtmftoi(argv[0]); switch_bind_flag_t bind_flags = 0; if (strchr(argv[1], 'a')) { @@ -2531,7 +2531,7 @@ SWITCH_STANDARD_APP(audio_bridge_function) camp_data = (char *) data; } - if (!(moh = switch_channel_get_variable(caller_channel, "hold_music"))) { + if (!(moh = switch_channel_get_variable(caller_channel, SWITCH_HOLD_MUSIC_VARIABLE))) { moh = switch_channel_get_variable(caller_channel, "campon_hold_music"); } diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 570b2fd..1f9d9d6 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -397,12 +397,12 @@ static switch_status_t on_dtmf(switch_core_session_t *session, void *input, swit const char *moh_a = NULL, *moh_b = NULL; if (!(moh_b = switch_channel_get_variable(bchan, "fifo_music"))) { - moh_b = switch_channel_get_variable(bchan, "hold_music"); + moh_b = switch_channel_get_variable(bchan, SWITCH_HOLD_MUSIC_VARIABLE); } if (!(moh_a = switch_channel_get_variable(channel, "fifo_hold_music"))) { if (!(moh_a = switch_channel_get_variable(channel, "fifo_music"))) { - moh_a = switch_channel_get_variable(channel, "hold_music"); + moh_a = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE); } } diff --git a/src/mod/applications/mod_spy/mod_spy.c b/src/mod/applications/mod_spy/mod_spy.c index e6f3bef..411ed09 100644 --- a/src/mod/applications/mod_spy/mod_spy.c +++ b/src/mod/applications/mod_spy/mod_spy.c @@ -83,7 +83,7 @@ static switch_status_t spy_on_exchange_media(switch_core_session_t *session) static switch_status_t spy_on_park(switch_core_session_t *session) { switch_channel_t *channel = switch_core_session_get_channel(session); - const char *moh = switch_channel_get_variable(channel, "hold_music"); + const char *moh = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE); while (switch_channel_ready(channel) && switch_channel_get_state(channel) == CS_PARK) { if (moh) { diff --git a/src/mod/applications/mod_valet_parking/mod_valet_parking.c b/src/mod/applications/mod_valet_parking/mod_valet_parking.c index 4de727c..369ae97 100644 --- a/src/mod/applications/mod_valet_parking/mod_valet_parking.c +++ b/src/mod/applications/mod_valet_parking/mod_valet_parking.c @@ -234,7 +234,7 @@ SWITCH_STANDARD_APP(valet_parking_function) } if (!(tmp = switch_channel_get_variable(channel, "valet_hold_music"))) { - tmp = switch_channel_get_variable(channel, "hold_music"); + tmp = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE); } if (tmp) music = tmp; diff --git a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp index 3eb3ad2..fe1f7cb 100644 --- a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp +++ b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp @@ -1512,7 +1512,7 @@ static switch_status_t load_config(int reload_type) hotline = val; } else if (!strcasecmp(var, "dial_regex")) { dial_regex = val; - } else if (!strcasecmp(var, "hold_music")) { + } else if (!strcasecmp(var, SWITCH_HOLD_MUSIC_VARIABLE)) { hold_music = val; } else if (!strcasecmp(var, "fail_dial_regex")) { fail_dial_regex = val; diff --git a/src/switch_channel.c b/src/switch_channel.c index 9c69668..f592158 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -646,6 +646,30 @@ SWITCH_DECLARE(void) switch_channel_mark_hold(switch_channel_t *channel, switch_ } +SWITCH_DECLARE(const char *) switch_channel_get_hold_music(switch_channel_t *channel) +{ + const char *var = switch_channel_get_variable(channel, SWITCH_TEMP_HOLD_MUSIC_VARIABLE); + + if (!var) { + var = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE); + } + + return var; +} + +SWITCH_DECLARE(const char *) switch_channel_get_hold_music_partner(switch_channel_t *channel) +{ + switch_core_session_t *session; + const char *r = NULL; + + if (switch_core_session_get_partner(channel->session, &session) == SWITCH_STATUS_SUCCESS) { + r = switch_channel_get_hold_music(switch_core_session_get_channel(session)); + switch_core_session_rwunlock(session); + } + + return r; +} + SWITCH_DECLARE(const char *) switch_channel_get_variable_dup(switch_channel_t *channel, const char *varname, switch_bool_t dup) { const char *v = NULL, *r = NULL; diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index f476c8f..e987a46 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -2727,7 +2727,7 @@ typedef struct { } dtmf_meta_app_t; typedef struct { - dtmf_meta_app_t map[10]; + dtmf_meta_app_t map[14]; time_t last_digit; switch_bool_t meta_on; char meta; @@ -2974,14 +2974,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_bind_dtmf_meta_session(switch_core_se if (meta != '*' && meta != '#') { str[0] = meta; - if (atoi(str) == (int)key) { + if (switch_dtmftoi(str) == (char)key) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid key %u, same as META CHAR\n", key); return SWITCH_STATUS_FALSE; } } - if (key > 9) { + if (key > 13) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid key %u\n", key); return SWITCH_STATUS_FALSE; } @@ -3000,8 +3000,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_bind_dtmf_meta_session(switch_core_se md->sr[SWITCH_DTMF_RECV].map[key].app = switch_core_session_strdup(session, app); md->sr[SWITCH_DTMF_RECV].map[key].flags |= SMF_HOLD_BLEG; md->sr[SWITCH_DTMF_RECV].map[key].bind_flags = bind_flags; - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Bound A-Leg: %c%d %s\n", meta, key, app); + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Bound A-Leg: %c%c %s\n", meta, switch_itodtmf(key), app); } if ((bind_flags & SBF_DIAL_BLEG)) { md->sr[SWITCH_DTMF_SEND].meta = meta; @@ -3009,12 +3009,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_bind_dtmf_meta_session(switch_core_se md->sr[SWITCH_DTMF_SEND].map[key].app = switch_core_session_strdup(session, app); md->sr[SWITCH_DTMF_SEND].map[key].flags |= SMF_HOLD_BLEG; md->sr[SWITCH_DTMF_SEND].map[key].bind_flags = bind_flags; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Bound B-Leg: %c%d %s\n", meta, key, app); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Bound B-Leg: %c%c %s\n", meta, switch_itodtmf(key), app); } } else { if ((bind_flags & SBF_DIAL_ALEG)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "UnBound A-Leg: %c%d\n", meta, key); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "UnBound A-Leg: %c%c\n", meta, switch_itodtmf(key)); md->sr[SWITCH_DTMF_SEND].map[key].app = NULL; } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "UnBound: B-Leg %c%d\n", meta, key); diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index f254b67..7e5f71e 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -2394,7 +2394,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_soft_hold(switch_core_session_t *sess if (moh_b) { moh = moh_b; } else { - moh = switch_channel_get_variable(other_channel, "hold_music"); + moh = switch_channel_get_variable(other_channel, SWITCH_HOLD_MUSIC_VARIABLE); } if (!zstr(moh) && strcasecmp(moh, "silence") && !switch_channel_test_flag(other_channel, CF_BROADCAST)) { @@ -2405,7 +2405,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_soft_hold(switch_core_session_t *sess if (moh_a) { moh = moh_a; } else { - moh = switch_channel_get_variable(channel, "hold_music"); + moh = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE); } if (!zstr(moh) && strcasecmp(moh, "silence")) { commit 96ac90adce931a3a28c768e102b863637c8ba98d Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Jan 5 16:55:06 2011 -0600 reduce warnings to debug diff --git a/src/switch_channel.c b/src/switch_channel.c index 672c47d..9c69668 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -362,11 +362,11 @@ SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf(switch_channel_t *chan int x = 0; if (new_dtmf.duration > switch_core_max_dtmf_duration(0)) { - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_WARNING, "%s EXCESSIVE DTMF DIGIT [%c] LEN [%d]\n", + switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG1, "%s EXCESSIVE DTMF DIGIT [%c] LEN [%d]\n", switch_channel_get_name(channel), new_dtmf.digit, new_dtmf.duration); new_dtmf.duration = switch_core_max_dtmf_duration(0); } else if (new_dtmf.duration < switch_core_min_dtmf_duration(0)) { - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_WARNING, "%s SHORT DTMF DIGIT [%c] LEN [%d]\n", + switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG1, "%s SHORT DTMF DIGIT [%c] LEN [%d]\n", switch_channel_get_name(channel), new_dtmf.digit, new_dtmf.duration); new_dtmf.duration = switch_core_min_dtmf_duration(0); } else if (!new_dtmf.duration) { diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 3208654..decb587 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -1265,11 +1265,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_recv_dtmf(switch_core_sessio new_dtmf = *dtmf; if (new_dtmf.duration > switch_core_max_dtmf_duration(0)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s EXCESSIVE DTMF DIGIT [%c] LEN [%d]\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG1, "%s EXCESSIVE DTMF DIGIT [%c] LEN [%d]\n", switch_channel_get_name(session->channel), new_dtmf.digit, new_dtmf.duration); new_dtmf.duration = switch_core_max_dtmf_duration(0); } else if (new_dtmf.duration < switch_core_min_dtmf_duration(0)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s SHORT DTMF DIGIT [%c] LEN [%d]\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG1, "%s SHORT DTMF DIGIT [%c] LEN [%d]\n", switch_channel_get_name(session->channel), new_dtmf.digit, new_dtmf.duration); new_dtmf.duration = switch_core_min_dtmf_duration(0); } else if (!new_dtmf.duration) { commit 231fbe5e7ac693fd3d05fd0c65aecc2a98416580 Author: Brian West <brian@freeswitch.org> Date: Wed Jan 5 16:48:11 2011 -0600 correct please test diff --git a/src/mod/codecs/mod_celt/Makefile b/src/mod/codecs/mod_celt/Makefile index cdcc045..2d2e27f 100644 --- a/src/mod/codecs/mod_celt/Makefile +++ b/src/mod/codecs/mod_celt/Makefile @@ -1,6 +1,6 @@ BASE=../../../.. -CELT=celt-0.7.1 +CELT=celt-0.10.0 CELT_DIR=$(switch_srcdir)/libs/$(CELT) CELT_BUILDDIR=$(switch_builddir)/libs/$(CELT) diff --git a/src/mod/codecs/mod_celt/mod_celt.c b/src/mod/codecs/mod_celt/mod_celt.c index d65e095..37983f3 100644 --- a/src/mod/codecs/mod_celt/mod_celt.c +++ b/src/mod/codecs/mod_celt/mod_celt.c @@ -54,7 +54,7 @@ static switch_status_t switch_celt_init(switch_codec_t *codec, switch_codec_flag } context->mode_object = celt_mode_create(codec->implementation->actual_samples_per_second, codec->implementation->samples_per_packet, NULL); - celt_mode_info(context->mode_object, CELT_GET_FRAME_SIZE, &context->frame_size); + context->bytes_per_packet = (codec->implementation->bits_per_second * context->frame_size / codec->implementation->actual_samples_per_second + 4) / 8; /* @@ -111,7 +111,7 @@ static switch_status_t switch_celt_encode(switch_codec_t *codec, return SWITCH_STATUS_FALSE; } - *encoded_data_len = (uint32_t) celt_encode(context->encoder_object, (void *) decoded_data, NULL, + *encoded_data_len = (uint32_t) celt_encode(context->encoder_object, (void *) decoded_data, codec->implementation->samples_per_packet, (unsigned char *) encoded_data, context->bytes_per_packet); return SWITCH_STATUS_SUCCESS; @@ -130,7 +130,7 @@ static switch_status_t switch_celt_decode(switch_codec_t *codec, return SWITCH_STATUS_FALSE; } - if (celt_decode(context->decoder_object, encoded_data, encoded_data_len, decoded_data)) { + if (celt_decode(context->decoder_object, encoded_data, encoded_data_len, decoded_data, codec->implementation->samples_per_packet)) { return SWITCH_STATUS_GENERR; } commit d3e7c2a63d8bccaf21ee54abe1f2c05e9beca7ae Author: Brian West <brian@freeswitch.org> Date: Wed Jan 5 16:39:09 2011 -0600 Revert diff --git a/src/mod/codecs/mod_celt/Makefile b/src/mod/codecs/mod_celt/Makefile index 2d2e27f..cdcc045 100644 --- a/src/mod/codecs/mod_celt/Makefile +++ b/src/mod/codecs/mod_celt/Makefile @@ -1,6 +1,6 @@ BASE=../../../.. -CELT=celt-0.10.0 +CELT=celt-0.7.1 CELT_DIR=$(switch_srcdir)/libs/$(CELT) CELT_BUILDDIR=$(switch_builddir)/libs/$(CELT) commit 422ee12aaa0802f3de6e23c21baae9d9b4a9372c Author: Brian West <brian@freeswitch.org> Date: Wed Jan 5 16:37:46 2011 -0600 Bump celt to 0.10.0 diff --git a/src/mod/codecs/mod_celt/Makefile b/src/mod/codecs/mod_celt/Makefile index cdcc045..2d2e27f 100644 --- a/src/mod/codecs/mod_celt/Makefile +++ b/src/mod/codecs/mod_celt/Makefile @@ -1,6 +1,6 @@ BASE=../../../.. -CELT=celt-0.7.1 +CELT=celt-0.10.0 CELT_DIR=$(switch_srcdir)/libs/$(CELT) CELT_BUILDDIR=$(switch_builddir)/libs/$(CELT) commit 181b543b0ca349a8a081eab141ed7077467cedea Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Jan 5 16:25:07 2011 -0600 add auto-jitterbuffer-msec param and auto-disable the jitterbuffer when briding to another channel who also has a jitterbuffer so both legs will disable during a bridge diff --git a/conf/sip_profiles/internal.xml b/conf/sip_profiles/internal.xml index 3e756a8..d09ca79 100644 --- a/conf/sip_profiles/internal.xml +++ b/conf/sip_profiles/internal.xml @@ -337,6 +337,9 @@ A completed transaction is kept around for the duration of T4 in order to catch late responses. The T4 is the maximum duration for the messages to stay in the network and the duration of SIP timer K. --> <!-- <param name="timer-T4" value="4000" /> --> + + <!-- Turn on a jitterbuffer for every call --> + <!-- <param name="auto-jitterbuffer-msec" value="60"/> --> </settings> </profile> diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index ee9b397..368b895 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -344,6 +344,7 @@ SWITCH_DECLARE(void) switch_channel_set_cap_value(switch_channel_t *channel, swi SWITCH_DECLARE(void) switch_channel_clear_cap(switch_channel_t *channel, switch_channel_cap_t cap); SWITCH_DECLARE(uint32_t) switch_channel_test_cap(switch_channel_t *channel, switch_channel_cap_t cap); +SWITCH_DECLARE(uint32_t) switch_channel_test_cap_partner(switch_channel_t *channel, switch_channel_cap_t cap); /*! \brief Set given flag(s) on a given channel's bridge partner diff --git a/src/include/switch_rtp.h b/src/include/switch_rtp.h index a161d2a..27dacc7 100644 --- a/src/include/switch_rtp.h +++ b/src/include/switch_rtp.h @@ -237,6 +237,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t * SWITCH_DECLARE(switch_status_t) switch_rtp_debug_jitter_buffer(switch_rtp_t *rtp_session, const char *name); SWITCH_DECLARE(switch_status_t) switch_rtp_deactivate_jitter_buffer(switch_rtp_t *rtp_session); +SWITCH_DECLARE(switch_status_t) switch_rtp_pause_jitter_buffer(switch_rtp_t *rtp_session, switch_bool_t pause); /*! \brief Set an RTP Flag diff --git a/src/include/switch_types.h b/src/include/switch_types.h index d3aacca..98ac804 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1035,6 +1035,8 @@ typedef enum { CC_MEDIA_ACK = 1, CC_BYPASS_MEDIA, CC_PROXY_MEDIA, + CC_JITTERBUFFER, + CC_FS_RTP, /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ CC_FLAG_MAX } switch_channel_cap_t; diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index f7ce6fa..a0bcdbd 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1346,7 +1346,13 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi char *p; const char *s; - if (!strncasecmp(msg->string_arg, "debug:", 6)) { + if (!strcasecmp(msg->string_arg, "pause")) { + switch_rtp_pause_jitter_buffer(tech_pvt->rtp_session, SWITCH_TRUE); + goto end; + } else if (!strcasecmp(msg->string_arg, "resume")) { + switch_rtp_pause_jitter_buffer(tech_pvt->rtp_session, SWITCH_FALSE); + goto end; + } else if (!strncasecmp(msg->string_arg, "debug:", 6)) { s = msg->string_arg + 6; if (s && !strcmp(s, "off")) { s = NULL; @@ -1426,10 +1432,16 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi { sofia_glue_tech_simplify(tech_pvt); - + if (switch_rtp_ready(tech_pvt->rtp_session)) { const char *val; int ok = 0; + + if (switch_channel_test_flag(tech_pvt->channel, CF_JITTERBUFFER) && switch_channel_test_cap_partner(tech_pvt->channel, CC_FS_RTP)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, + "%s PAUSE Jitterbuffer\n", switch_channel_get_name(channel)); + switch_rtp_pause_jitter_buffer(tech_pvt->rtp_session, SWITCH_TRUE); + } if (sofia_test_flag(tech_pvt, TFLAG_PASS_RFC2833) && switch_channel_test_flag_partner(channel, CF_FS_RTP)) { switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833); @@ -1455,6 +1467,12 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi if (switch_rtp_ready(tech_pvt->rtp_session)) { const char *val; int ok = 0; + + if (switch_channel_test_flag(tech_pvt->channel, CF_JITTERBUFFER)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, + "%s RESUME Jitterbuffer\n", switch_channel_get_name(channel)); + switch_rtp_pause_jitter_buffer(tech_pvt->rtp_session, SWITCH_FALSE); + } if (switch_rtp_test_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s deactivate passthru 2833 mode.\n", diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index e1b1ff7..df26796 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -501,6 +501,7 @@ struct sofia_profile { char *challenge_realm; char *rtcp_audio_interval_msec; char *rtcp_video_interval_msec; + char *jb_msec; sofia_cid_type_t cid_type; sofia_dtmf_t dtmf_type; int auto_restart; @@ -1050,3 +1051,4 @@ void sofia_glue_build_vid_refresh_message(switch_core_session_t *session, const void sofia_glue_check_dtmf_type(private_object_t *tech_pvt); void sofia_glue_parse_rtp_bugs(uint32_t *flag_pole, const char *str); char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, sofia_nat_parse_t *np); +void sofia_glue_pause_jitterbuffer(switch_core_session_t *session, switch_bool_t on); diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 61ede0c..99c18cb 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2351,6 +2351,11 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) } else { sofia_clear_pflag(profile, PFLAG_DISABLE_HOLD); } + } else if (!strcasecmp(var, "auto-jitterbuffer-msec")) { + int msec = atoi(val); + if (msec > 19) { + profile->jb_msec = switch_core_strdup(profile->pool, val); + } } else if (!strcasecmp(var, "sip-trace")) { if (switch_true(val)) { sofia_set_flag(profile, TFLAG_TPORT_LOG); @@ -3089,6 +3094,11 @@ switch_status_t config_sofia(int reload, char *profile_name) } else { sofia_clear_pflag(profile, PFLAG_DISABLE_HOLD); } + } else if (!strcasecmp(var, "auto-jitterbuffer-msec")) { + int msec = atoi(val); + if (msec > 19) { + profile->jb_msec = switch_core_strdup(profile->pool, val); + } } else if (!strcasecmp(var, "dtmf-type")) { if (!strcasecmp(val, "rfc2833")) { profile->dtmf_type = DTMF_2833; diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index f4ec094..6b8521b 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -832,6 +832,8 @@ void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t * switch_channel_set_cap(tech_pvt->channel, CC_MEDIA_ACK); switch_channel_set_cap(tech_pvt->channel, CC_BYPASS_MEDIA); switch_channel_set_cap(tech_pvt->channel, CC_PROXY_MEDIA); + switch_channel_set_cap(tech_pvt->channel, CC_JITTERBUFFER); + switch_channel_set_cap(tech_pvt->channel, CC_FS_RTP); switch_core_session_set_private(session, tech_pvt); @@ -3152,8 +3154,8 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f } } - if ((val = switch_channel_get_variable(tech_pvt->channel, "jitterbuffer_msec"))) { - int len = atoi(val); + if ((val = switch_channel_get_variable(tech_pvt->channel, "jitterbuffer_msec")) || (val = tech_pvt->profile->jb_msec)) { + int jb_msec = atoi(val); int maxlen = 0; char *p; @@ -3162,13 +3164,13 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f maxlen = atoi(p); } - if (len < 20 || len > 10000) { + if (jb_msec < 20 || jb_msec > 10000) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, - "Invalid Jitterbuffer spec [%d] must be between 20 and 10000\n", len); + "Invalid Jitterbuffer spec [%d] must be between 20 and 10000\n", jb_msec); } else { int qlen, maxqlen = 50; - qlen = len / (tech_pvt->read_impl.microseconds_per_packet / 1000); + qlen = jb_msec / (tech_pvt->read_impl.microseconds_per_packet / 1000); if (maxlen) { maxqlen = maxlen / (tech_pvt->read_impl.microseconds_per_packet / 1000); @@ -3178,11 +3180,11 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f tech_pvt->read_impl.samples_per_packet, tech_pvt->read_impl.samples_per_second) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), - SWITCH_LOG_DEBUG, "Setting Jitterbuffer to %dms (%d frames)\n", len, qlen); + SWITCH_LOG_DEBUG, "Setting Jitterbuffer to %dms (%d frames)\n", jb_msec, qlen); switch_channel_set_flag(tech_pvt->channel, CF_JITTERBUFFER); } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), - SWITCH_LOG_WARNING, "Error Setting Jitterbuffer to %dms (%d frames)\n", len, qlen); + SWITCH_LOG_WARNING, "Error Setting Jitterbuffer to %dms (%d frames)\n", jb_msec, qlen); } } @@ -6065,6 +6067,19 @@ void sofia_glue_tech_simplify(private_object_t *tech_pvt) } } +void sofia_glue_pause_jitterbuffer(switch_core_session_t *session, switch_bool_t on) +{ + switch_core_session_message_t *msg; + msg = switch_core_session_alloc(session, sizeof(*msg)); + MESSAGE_STAMP_FFL(msg); + msg->message_id = SWITCH_MESSAGE_INDICATE_JITTER_BUFFER; + msg->string_arg = switch_core_session_strdup(session, on ? "pause" : "resume"); + msg->from = __FILE__; + + switch_core_session_queue_message(session, msg); +} + + void sofia_glue_build_vid_refresh_message(switch_core_session_t *session, const char *pl) { switch_core_session_message_t *msg; diff --git a/src/switch_channel.c b/src/switch_channel.c index e5d30ee..672c47d 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -1261,6 +1261,24 @@ SWITCH_DECLARE(uint32_t) switch_channel_test_cap(switch_channel_t *channel, swit return channel->caps[cap] ? 1 : 0; } +SWITCH_DECLARE(uint32_t) switch_channel_test_cap_partner(switch_channel_t *channel, switch_channel_cap_t cap) +{ + const char *uuid; + int r = 0; + + switch_assert(channel != NULL); + + if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) { + switch_core_session_t *session; + if ((session = switch_core_session_locate(uuid))) { + r = switch_channel_test_cap(switch_core_session_get_channel(session), cap); + switch_core_session_rwunlock(session); + } + } + + return r; +} + SWITCH_DECLARE(char *) switch_channel_get_flag_string(switch_channel_t *channel) { switch_stream_handle_t stream = { 0 }; diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 7448125..6f84de3 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -1142,7 +1142,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses if (switch_channel_test_flag(peer_channel, CF_ANSWERED) || switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA) || switch_channel_test_flag(peer_channel, CF_RING_READY)) { const char *app, *data; - + switch_channel_set_state(peer_channel, CS_CONSUME_MEDIA); if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_BRIDGE) == SWITCH_STATUS_SUCCESS) { diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 73c2f45..41d5fc9 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -242,6 +242,7 @@ struct switch_rtp { switch_time_t send_time; switch_byte_t auto_adj_used; + uint8_t pause_jb; }; struct switch_rtcp_senderinfo { @@ -1640,6 +1641,26 @@ static void jb_callback(stfu_instance_t *i, void *udata) } +SWITCH_DECLARE(switch_status_t) switch_rtp_pause_jitter_buffer(switch_rtp_t *rtp_session, switch_bool_t pause) +{ + + if (!switch_rtp_ready(rtp_session) || !rtp_session->jb) { + return SWITCH_STATUS_FALSE; + } + + if (!!pause == !!rtp_session->pause_jb) { + return SWITCH_STATUS_FALSE; + } + + if (rtp_session->pause_jb && !pause) { + stfu_n_reset(rtp_session->jb); + } + + rtp_session->pause_jb = pause ? 1 : 0; + + return SWITCH_STATUS_SUCCESS; +} + SWITCH_DECLARE(switch_status_t) switch_rtp_deactivate_jitter_buffer(switch_rtp_t *rtp_session) { @@ -2174,7 +2195,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t ts = ntohl(rtp_session->recv_msg.header.ts); if (*bytes && (!rtp_session->recv_te || rtp_session->recv_msg.header.pt != rtp_session->recv_te) && - ts && !rtp_session->jb && ts == rtp_session->last_cng_ts) { + ts && !rtp_session->jb && !rtp_session->pause_jb && ts == rtp_session->last_cng_ts) { /* we already sent this frame..... */ *bytes = 0; return SWITCH_STATUS_SUCCESS; @@ -2204,7 +2225,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t rtp_session->last_read_ts = ts; - if (rtp_session->jb && rtp_session->recv_msg.header.version == 2 && *bytes) { + if (rtp_session->jb && !rtp_session->pause_jb && rtp_session->recv_msg.header.version == 2 && *bytes) { if (rtp_session->recv_msg.header.m && rtp_session->recv_msg.header.pt != rtp_session->recv_te && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO) && !(rtp_session->rtp_bugs & RTP_BUG_IGNORE_MARK_BIT)) { stfu_n_reset(rtp_session->jb); @@ -2217,7 +2238,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t status = SWITCH_STATUS_FALSE; } - if (rtp_session->jb && !rtp_session->checked_jb) { + if (rtp_session->jb && !rtp_session->pause_jb && !rtp_session->checked_jb) { if ((jb_frame = stfu_n_read_a_frame(rtp_session->jb))) { memcpy(rtp_session->recv_msg.body, jb_frame->data, jb_frame->dlen); commit e06feedd9e478defd1b9a897245f54e896fc8608 Merge: ae70ea0 32b8f10 Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Jan 5 16:25:22 2011 -0500 Merge branch 'master' of git.freeswitch.org:freeswitch commit ae70ea0c13dbccc1842bfb8b1708e705a8f9d662 Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Jan 5 16:25:06 2011 -0500 Freetdm - ISDN:Fix for progress indicator not set properly. Allow state change from RINGING to PROGRESS diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 259bf18..214a83f 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -234,7 +234,7 @@ ftdm_state_map_t sangoma_isdn_state_map = { ZSD_OUTBOUND, ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_RINGING, FTDM_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_END}, + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_END}, }, { ZSD_OUTBOUND, diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 05b7158..f8a257e 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -372,7 +372,10 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) case FTDM_CHANNEL_STATE_PROGRESS: case FTDM_CHANNEL_STATE_RINGING: if (cnStEvnt->progInd.eh.pres && cnStEvnt->progInd.progDesc.val == IN_PD_IBAVAIL) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Early media available\n"); sngisdn_set_flag(sngisdn_info, FLAG_MEDIA_READY); + } else { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Early media not available\n"); } switch (evntType) { case MI_CALLPROC: @@ -387,10 +390,8 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) break; case MI_PROGRESS: if (sngisdn_test_flag(sngisdn_info, FLAG_MEDIA_READY)) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); } else if (ftdmchan->state != FTDM_CHANNEL_STATE_PROGRESS) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); } break; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index bb04f88..26d8bec 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -39,7 +39,7 @@ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) ConEvnt conEvnt; sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_NETE_ISDN}; + ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_ORIG_NISDN}; ftdm_assert((!sngisdn_info->suInstId && !sngisdn_info->spInstId), "Trying to call out, but call data was not cleared\n"); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index a2cf2ef..7e90ccd 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -789,7 +789,7 @@ ftdm_status_t set_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd, ftdm_s break; default: ftdm_log(FTDM_LOG_WARNING, "Invalid prog_ind location:%d\n", loc); - progInd->location.val = IN_PD_NOTETEISDN; + progInd->location.val = IN_LOC_USER; } return FTDM_SUCCESS; } commit 32b8f1008eedbafb7210164fdebf80c98c9911a4 Author: Brian West <brian@freeswitch.org> Date: Wed Jan 5 14:09:16 2011 -0600 more fixes from diego diff --git a/debian/freeswitch.init b/debian/freeswitch.init index 44d166d..283400a 100755 --- a/debian/freeswitch.init +++ b/debian/freeswitch.init @@ -9,7 +9,7 @@ # Description: An advanced platform for voice services ### END INIT INFO -# Author: Anthony Minesalle III <anthm@freeswitch.org> +# Author: Anthony Minesalle II <anthm@freeswitch.org> # # Do NOT "set -e" diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen.h b/src/mod/endpoints/mod_gsmopen/gsmopen.h index 05ef164..37eb157 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen.h +++ b/src/mod/endpoints/mod_gsmopen/gsmopen.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2005/2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * @@ -17,7 +17,7 @@ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * * The Initial Developer of the Original Code is - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. * diff --git a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp index 13e4335..3eb3ad2 100644 --- a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp +++ b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2005/2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * @@ -17,7 +17,7 @@ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * * The Initial Developer of the Original Code is - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. * diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index 56188a4..eac0a67 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2005/2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * @@ -17,7 +17,7 @@ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * * The Initial Developer of the Original Code is - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. * diff --git a/src/mod/endpoints/mod_skypopen/skypopen.h b/src/mod/endpoints/mod_skypopen/skypopen.h index 2f1c8e4..2be11bf 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen.h +++ b/src/mod/endpoints/mod_skypopen/skypopen.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2005/2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * @@ -17,7 +17,7 @@ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * * The Initial Developer of the Original Code is - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. * commit becf16c58ce72445cfc81ece0e29c10627f417ab Author: Moises Silva <moy@sangoma.com> Date: Wed Jan 5 13:38:25 2011 -0500 freetdm: fix warning diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c index 37f5b42..9feb5c8 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c @@ -228,7 +228,7 @@ void sngisdn_trace_raw_q931(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t d { uint8_t *raw_data; ftdm_sigmsg_t sigev; - ftdm_channel_t *ftdmchan; + ftdm_channel_t *ftdmchan = NULL; sngisdn_frame_info_t frame_info; memset(&sigev, 0, sizeof(sigev)); @@ -852,8 +852,8 @@ parse_ies_done: static ftdm_status_t sngisdn_map_call(sngisdn_span_data_t *signal_data, sngisdn_frame_info_t frame_info, ftdm_channel_t **found) { - ftdm_channel_t *ftdmchan; sngisdn_chan_data_t *sngisdn_info; + ftdm_channel_t *ftdmchan = NULL; ftdm_iterator_t *chaniter = NULL; ftdm_iterator_t *curr = NULL; ftdm_status_t status = FTDM_FAIL; commit ac736e4e45e735479465a53c807530356ea6e667 Merge: ca6327f 2f7caaf Author: Moises Silva <moy@sangoma.com> Date: Wed Jan 5 13:34:28 2011 -0500 Merge branch 'master' into netborder commit ca6327fa456f7a9a299a44420c71548b5e2cc944 Author: Moises Silva <moy@sangoma.com> Date: Wed Jan 5 13:27:42 2011 -0500 freetdm: update nbe branch FreeSWITCH .sln diff --git a/Freeswitch.2008.sln b/Freeswitch.2008.sln index d60de29..e171ffe 100644 --- a/Freeswitch.2008.sln +++ b/Freeswitch.2008.sln @@ -36,6 +36,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Default", "Default", "{3B08FEFD-4D3D-4C16-BA94-EE83509E32A0}" ProjectSection(SolutionItems) = preProject conf\freeswitch.xml = conf\freeswitch.xml + conf\vars.xml = conf\vars.xml EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Release", "Release", "{7BFD517E-7F8F-4A40-A78E-8D3632738227}" @@ -56,6 +57,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Build System", "_Build Sys bootstrap.sh = bootstrap.sh build\buildlib.sh = build\buildlib.sh configure.in = configure.in + Makefile.am = Makefile.am build\modmake.rules.in = build\modmake.rules.in build\modules.conf.in = build\modules.conf.in libs\win32\util.vbs = libs\win32\util.vbs @@ -90,12 +92,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "autoload_configs", "autoloa conf\autoload_configs\limit.conf.xml = conf\autoload_configs\limit.conf.xml conf\autoload_configs\local_stream.conf.xml = conf\autoload_configs\local_stream.conf.xml conf\autoload_configs\logfile.conf.xml = conf\autoload_configs\logfile.conf.xml + conf\autoload_configs\modules.conf.xml = conf\autoload_configs\modules.conf.xml conf\autoload_configs\openmrcp.conf.xml = conf\autoload_configs\openmrcp.conf.xml conf\autoload_configs\portaudio.conf.xml = conf\autoload_configs\portaudio.conf.xml conf\autoload_configs\rss.conf.xml = conf\autoload_configs\rss.conf.xml conf\autoload_configs\sofia.conf.xml = conf\autoload_configs\sofia.conf.xml conf\autoload_configs\spidermonkey.conf.xml = conf\autoload_configs\spidermonkey.conf.xml + conf\autoload_configs\switch.conf.xml = conf\autoload_configs\switch.conf.xml conf\autoload_configs\syslog.conf.xml = conf\autoload_configs\syslog.conf.xml + conf\autoload_configs\voicemail.conf.xml = conf\autoload_configs\voicemail.conf.xml conf\autoload_configs\wanpipe.conf.xml = conf\autoload_configs\wanpipe.conf.xml conf\autoload_configs\woomera.conf.xml = conf\autoload_configs\woomera.conf.xml conf\autoload_configs\xml_cdr.conf.xml = conf\autoload_configs\xml_cdr.conf.xml @@ -106,6 +111,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "autoload_configs", "autoloa EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dialplan", "dialplan", "{C7E2382E-2C22-4D18-BF93-80C6A1FFA7AC}" ProjectSection(SolutionItems) = preProject + conf\dialplan\default.xml = conf\dialplan\default.xml conf\dialplan\public.xml = conf\dialplan\public.xml EndProjectSection EndProject @@ -117,6 +123,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sip_profiles", "sip_profiles", "{8E2E8798-8B6F-4A55-8E4F-4E6FDE40ED26}" ProjectSection(SolutionItems) = preProject conf\sip_profiles\external.xml = conf\sip_profiles\external.xml + conf\sip_profiles\internal.xml = conf\sip_profiles\internal.xml conf\sip_profiles\nat.xml = conf\sip_profiles\nat.xml EndProjectSection EndProject @@ -301,6 +308,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "autoload_configs", "autoloa EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dialplan", "dialplan", "{23874F4B-C0AF-4587-9F7E-DB0F06DE8CB4}" + ProjectSection(SolutionItems) = preProject + conf\dialplan\default.xml = conf\dialplan\default.xml + EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "directory", "directory", "{19ED97F6-30D8-4FCE-AE1D-8B7FCB170D40}" ProjectSection(SolutionItems) = preProject @@ -1262,15 +1272,15 @@ Global {89385C74-5860-4174-9CAF-A39E7C48909C}.Release|Win32.Build.0 = Release|Win32 {89385C74-5860-4174-9CAF-A39E7C48909C}.Release|x64.ActiveCfg = Release|x64 {89385C74-5860-4174-9CAF-A39E7C48909C}.Release|x64.Build.0 = Release|x64 - {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|Win32.ActiveCfg = Release|Win32 - {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|Win32.Build.0 = Release|Win32 - {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|x64.ActiveCfg = Release|Win32 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|Win32.ActiveCfg = Release|x64 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|x64.ActiveCfg = Release|x64 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|x64.Build.0 = Release|x64 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|Win32.ActiveCfg = Debug|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|Win32.Build.0 = Debug|Win32 - {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|x64.ActiveCfg = Debug|Win32 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|x64.ActiveCfg = Debug|x64 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|Win32.ActiveCfg = Release|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|Win32.Build.0 = Release|Win32 - {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|x64.ActiveCfg = Release|Win32 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|x64.ActiveCfg = Release|x64 {692F6330-4D87-4C82-81DF-40DB5892636E}.All|Win32.ActiveCfg = Release|x64 {692F6330-4D87-4C82-81DF-40DB5892636E}.All|x64.ActiveCfg = Release|x64 {692F6330-4D87-4C82-81DF-40DB5892636E}.All|x64.Build.0 = Release|x64 commit eb84fc772fb1ec44de8b5c6ab0ebbc912f2705fa Merge: 9be9d79 f574db0 Author: Moises Silva <moy@sangoma.com> Date: Wed Jan 5 13:11:37 2011 -0500 Merge branch 'master' into netborder Conflicts: libs/freetdm/src/ftdm_io.c libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c libs/freetdm/src/include/freetdm.h diff --cc libs/freetdm/src/ftdm_io.c index 1fdb867,21354c4..076e8ba --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@@ -2478,9 -2383,7 +2386,6 @@@ FT_DECLARE(ftdm_status_t) _ftdm_channel UNREFERENCED_PARAMETER(func); UNREFERENCED_PARAMETER(line); #endif - ftdm_call_set_call_id(&ftdmchan->caller_data); - ftdm_wait_for_flag_cleared(ftdmchan, FTDM_CHANNEL_STATE_CHANGE, 100); - ftdm_channel_unlock(ftdmchan); - return status; } @@@ -5116,18 -5080,28 +5082,38 @@@ FT_DECLARE(ftdm_status_t) ftdm_configur FT_DECLARE(ftdm_status_t) ftdm_span_start(ftdm_span_t *span) { - if (span->start) { - /* check the alarms again before starting the signaling module - this works-around some I/O modules (netborder I/O module) that cannot - check the alarm status before during configuration because the spans are - not really started yet at the I/O level */ - if (ftdm_set_channels_alarms(span, 0) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "%d: Failed to set channel alarms\n", span->span_id); - return FTDM_FAIL; - } - return span->start(span); + ftdm_status_t status = FTDM_FAIL; + + ftdm_mutex_lock(span->mutex); + + if (ftdm_test_flag(span, FTDM_SPAN_STARTED)) { + status = FTDM_EINVAL; + goto done; } - return FTDM_FAIL; + + if (!span->start) { + status = FTDM_ENOSYS; + goto done; + } + ++ /* check the alarms again before starting the signaling module ++ this works-around some I/O modules (netborder I/O module) that cannot ++ check the alarm status before during configuration because the spans are ++ not really started yet at the I/O level */ ++ if (ftdm_set_channels_alarms(span, 0) != FTDM_SUCCESS) { ++ ftdm_log(FTDM_LOG_ERROR, "Failed to set channel alarms in span %s\n", span->name); ++ status = FTDM_FAIL; ++ goto done; ++ } ++ + status = span->start(span); + if (status == FTDM_SUCCESS) { + ftdm_set_flag_locked(span, FTDM_SPAN_STARTED); + } + + done: + ftdm_mutex_unlock(span->mutex); + return status; } FT_DECLARE(ftdm_status_t) ftdm_channel_add_to_group(const char* name, ftdm_channel_t* ftdmchan) diff --cc libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c index e63ed16,8c421b0..37f5b42 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c @@@ -232,28 -222,24 +233,29 @@@ void sngisdn_trace_raw_q931(sngisdn_spa memset(&sigev, 0, sizeof(sigev)); - sigev.span_id = signal_data->ftdm_span->span_id; - sigev.chan_id = signal_data->dchan->chan_id; - sigev.channel = signal_data->dchan; - sigev.event_id = FTDM_SIGEVENT_TRACE_RAW; - - sigev.ev_data.logevent.dir = dir; - sigev.ev_data.logevent.level = 3; - - /* TODO: Map trace to call ID here */ + /* Note: Mapped raw trace assume only exclusive b-channel selection is used. i.e the b-channel selected on outgoing SETUP is always used for the call */ - raw_data = ftdm_malloc(data_len); - ftdm_assert(raw_data, "Failed to malloc"); - - memcpy(raw_data, data, data_len); - sigev.raw.data = raw_data; - sigev.raw.len = data_len; - sigev.raw.autofree = 1; - ftdm_span_send_signal(signal_data->ftdm_span, &sigev); + if (sngisdn_get_frame_info(data, data_len, dir, &frame_info) == FTDM_SUCCESS) { + if (sngisdn_map_call(signal_data, frame_info, &ftdmchan) == FTDM_SUCCESS) { + sigev.call_id = ftdmchan->caller_data.call_id; + sigev.span_id = ftdmchan->physical_span_id; + sigev.chan_id = ftdmchan->physical_chan_id; + sigev.channel = ftdmchan; + } + sigev.event_id = FTDM_SIGEVENT_TRACE_RAW; + + sigev.ev_data.trace.dir = dir; + sigev.ev_data.trace.type = FTDM_TRACE_TYPE_Q931; + + raw_data = ftdm_malloc(data_len); + ftdm_assert(raw_data, "Failed to malloc"); + + memcpy(raw_data, data, data_len); - sigev.raw_data = raw_data; - sigev.raw_data_len = data_len; ++ sigev.raw.data = raw_data; ++ sigev.raw.len = data_len; ++ sigev.raw.autofree = 1; + ftdm_span_send_signal(signal_data->ftdm_span, &sigev); + } } void sngisdn_decode_q931(char* str, uint8_t* data, uint32_t data_len) diff --cc libs/freetdm/src/include/freetdm.h index 2fd821e,38bc611..5f61b0e --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@@ -415,9 -427,40 +437,40 @@@ FTDM_STR2ENUM_P(ftdm_str2ftdm_trace_typ typedef struct { /* Direction - incoming or outgoing */ ftdm_trace_dir_t dir; - uint8_t level; /* 1 for phy layer, 2 for q921/mtp2, 3 for q931/mtp3 */ + ftdm_trace_type_t type; } ftdm_event_trace_t; + typedef struct { + /* Digits collected */ + char digits[FTDM_DIGITS_LIMIT]; + } ftdm_event_collected_t; + + /*! \brief FreeTDM supported indications. + * This is used during incoming calls when you want to request the signaling stack + * to notify about indications occurring locally. See ftdm_channel_call_indicate for more info */ + typedef enum { + FTDM_CHANNEL_INDICATE_NONE, + FTDM_CHANNEL_INDICATE_RINGING, + FTDM_CHANNEL_INDICATE_PROCEED, + FTDM_CHANNEL_INDICATE_PROGRESS, + FTDM_CHANNEL_INDICATE_PROGRESS_MEDIA, + FTDM_CHANNEL_INDICATE_BUSY, + /* Using this indication is equivalent to call ftdm_channel_call_answer API */ + FTDM_CHANNEL_INDICATE_ANSWER, + FTDM_CHANNEL_INDICATE_INVALID, + } ftdm_channel_indication_t; + #define INDICATION_STRINGS "NONE", "RINGING", "PROCEED", "PROGRESS", "PROGRESS_MEDIA", "BUSY", "ANSWER", "INVALID" + + /*! \brief Move from string to ftdm_channel_indication_t and viceversa */ + FTDM_STR2ENUM_P(ftdm_str2channel_indication, ftdm_channel_indication2str, ftdm_channel_indication_t) + + typedef struct { + /* The indication that was completed */ + ftdm_channel_indication_t indication; + /* Completion status of the indication */ + ftdm_status_t status; + } ftdm_event_indication_completed_t; + /*! \brief Generic signaling message */ struct ftdm_sigmsg { ftdm_signal_event_t event_id; /*!< The type of message */ @@@ -427,10 -470,15 +480,15 @@@ uint32_t call_id; /*!< unique call id for this call */ union { ftdm_event_sigstatus_t sigstatus; /*!< valid if event_id is FTDM_SIGEVENT_SIGSTATUS_CHANGED */ - ftdm_event_trace_t logevent; /*!< valid if event_id is FTDM_SIGEVENT_TRACE or FTDM_SIGEVENT_TRACE_RAW */ + ftdm_event_trace_t trace; /*!< valid if event_id is FTDM_SIGEVENT_TRACE or FTDM_SIGEVENT_TRACE_RAW */ - }ev_data; + ftdm_event_collected_t collected; /*!< valid if event_id is FTDM_SIGEVENT_COLLECTED_DIGIT */ + ftdm_event_indication_completed_t indication_completed; /*!< valid if the event_id is FTDM_SIGEVENT_INDICATION_COMPLETED */ + } ev_data; + struct { + uint8_t autofree; /*!< Whether the freetdm core will free it after message delivery */ + uint32_t len; /*!< Data len */ + void *data; /*!< Signaling module specific data */ + } raw; }; /*! \brief Crash policy commit d79cf48475f2bbfd3c28c7931d22b2e2736e9ebe Author: Brian West <brian@freeswitch.org> Date: Wed Jan 5 11:45:48 2011 -0600 FS-2962 diff --git a/src/include/switch_core.h b/src/include/switch_core.h index d02018b..ff131ac 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -2162,6 +2162,13 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql(switch_cache_db_hand SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_callback(switch_cache_db_handle_t *dbh, const char *sql, switch_core_db_callback_func_t callback, void *pdata, char **err); +/*! + \brief Get the affected rows of the last performed query + \param [in] dbh The handle + \param [out] the number of affected rows +*/ +SWITCH_DECLARE(int) switch_cache_db_affected_rows(switch_cache_db_handle_t *dbh); + /*! \brief Provides some feedback as to the status of the db connection pool \param [in] stream stream for status diff --git a/src/include/switch_odbc.h b/src/include/switch_odbc.h index 0b5f904..f763840 100644 --- a/src/include/switch_odbc.h +++ b/src/include/switch_odbc.h @@ -92,6 +92,9 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec_detailed(c SWITCH_DECLARE(char *) switch_odbc_handle_get_error(switch_odbc_handle_t *handle, switch_odbc_statement_handle_t stmt); + +SWITCH_DECLARE(int) switch_odbc_handle_affected_rows(switch_odbc_handle_t *handle); + SWITCH_END_EXTERN_C #endif /* For Emacs: diff --git a/src/mod/languages/mod_lua/freeswitch.i b/src/mod/languages/mod_lua/freeswitch.i index cea764d..9ccaf8e 100644 --- a/src/mod/languages/mod_lua/freeswitch.i +++ b/src/mod/languages/mod_lua/freeswitch.i @@ -90,6 +90,7 @@ class Dbh { bool release(); bool connected(); bool query(char *sql, SWIGLUA_FN lua_fun); + int affected_rows(); }; } diff --git a/src/mod/languages/mod_lua/freeswitch_lua.cpp b/src/mod/languages/mod_lua/freeswitch_lua.cpp index aad87fa..1a170dc 100644 --- a/src/mod/languages/mod_lua/freeswitch_lua.cpp +++ b/src/mod/languages/mod_lua/freeswitch_lua.cpp @@ -384,3 +384,11 @@ bool Dbh::query(char *sql, SWIGLUA_FN lua_fun) } return false; } + +int Dbh::affected_rows() +{ + if (m_connected) { + return switch_cache_db_affected_rows(dbh); + } + return 0; +} diff --git a/src/mod/languages/mod_lua/freeswitch_lua.h b/src/mod/languages/mod_lua/freeswitch_lua.h index 3c43ebd..5f79662 100644 --- a/src/mod/languages/mod_lua/freeswitch_lua.h +++ b/src/mod/languages/mod_lua/freeswitch_lua.h @@ -63,6 +63,7 @@ namespace LUA { bool release(); bool connected(); bool query(char *sql, SWIGLUA_FN lua_fun); + int affected_rows(); }; } #endif diff --git a/src/mod/languages/mod_lua/mod_lua_wrap.cpp b/src/mod/languages/mod_lua/mod_lua_wrap.cpp index 4e29710..f10ed63 100644 --- a/src/mod/languages/mod_lua/mod_lua_wrap.cpp +++ b/src/mod/languages/mod_lua/mod_lua_wrap.cpp @@ -7296,6 +7296,31 @@ fail: } +static int _wrap_Dbh_affected_rows(lua_State* L) { + int SWIG_arg = -1; + LUA::Dbh *arg1 = (LUA::Dbh *) 0 ; + int result; + + SWIG_check_num_args("affected_rows",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("affected_rows",1,"LUA::Dbh *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Dbh,0))){ + SWIG_fail_ptr("Dbh_affected_rows",1,SWIGTYPE_p_LUA__Dbh); + } + + result = (int)(arg1)->affected_rows(); + SWIG_arg=0; + lua_pushnumber(L, (lua_Number) result); SWIG_arg++; + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + static void swig_delete_Dbh(void *obj) { LUA::Dbh *arg1 = (LUA::Dbh *) obj; delete arg1; @@ -7304,6 +7329,7 @@ static swig_lua_method swig_LUA_Dbh_methods[] = { {"release", _wrap_Dbh_release}, {"connected", _wrap_Dbh_connected}, {"query", _wrap_Dbh_query}, + {"affected_rows", _wrap_Dbh_affected_rows}, {0,0} }; static swig_lua_attribute swig_LUA_Dbh_attributes[] = { diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index 33ceb47..d05f4f1 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -10688,6 +10688,18 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_cache_db_execute_sql_callback(void * ja } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_cache_db_affected_rows(void * jarg1) { + int jresult ; + switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ; + int result; + + arg1 = (switch_cache_db_handle_t *)jarg1; + result = (int)switch_cache_db_affected_rows(arg1); + jresult = result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_status(void * jarg1) { switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index e51b050..849a6f6 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -2333,6 +2333,11 @@ public class freeswitch { return ret; } + public static int switch_cache_db_affected_rows(switch_cache_db_handle_t dbh) { + int ret = freeswitchPINVOKE.switch_cache_db_affected_rows(switch_cache_db_handle_t.getCPtr(dbh)); + return ret; + } + public static void switch_cache_db_status(switch_stream_handle stream) { freeswitchPINVOKE.switch_cache_db_status(switch_stream_handle.getCPtr(stream)); } @@ -8209,6 +8214,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_execute_sql_callback")] public static extern int switch_cache_db_execute_sql_callback(HandleRef jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4, ref string jarg5); + [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_affected_rows")] + public static extern int switch_cache_db_affected_rows(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_status")] public static extern void switch_cache_db_status(HandleRef jarg1); diff --git a/src/mod/languages/mod_perl/mod_perl_wrap.cpp b/src/mod/languages/mod_perl/mod_perl_wrap.cpp index c229052..e8a4b9f 100644 --- a/src/mod/languages/mod_perl/mod_perl_wrap.cpp +++ b/src/mod/languages/mod_perl/mod_perl_wrap.cpp @@ -9793,17 +9793,17 @@ XS(SWIG_init) { SWIG_TypeClientData(SWIGTYPE_p_IVRMenu, (void*) "freeswitch::IVRMenu"); SWIG_TypeClientData(SWIGTYPE_p_API, (void*) "freeswitch::API"); SWIG_TypeClientData(SWIGTYPE_p_input_callback_state, (void*) "freeswitch::input_callback_state_t"); - /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_HUP", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_HUP))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; - /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_FREE", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_FREE))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; - /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_RDLOCK", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_RDLOCK))); SvREADONLY_on(sv); diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index c32b406..4167b4a 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -573,6 +573,24 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql(switch_cache_db_hand } +SWITCH_DECLARE(int) switch_cache_db_affected_rows(switch_cache_db_handle_t *dbh) +{ + switch (dbh->type) { + case SCDB_TYPE_CORE_DB: + { + return switch_core_db_changes(dbh->native_handle.core_db_dbh); + } + break; + case SCDB_TYPE_ODBC: + { + return switch_odbc_handle_affected_rows(dbh->native_handle.odbc_dbh); + } + break; + } + return 0; +} + + SWITCH_DECLARE(char *) switch_cache_db_execute_sql2str(switch_cache_db_handle_t *dbh, char *sql, char *str, size_t len, char **err) { switch_status_t status = SWITCH_STATUS_FALSE; diff --git a/src/switch_odbc.c b/src/switch_odbc.c index 31fd8f5..48ba62c 100644 --- a/src/switch_odbc.c +++ b/src/switch_odbc.c @@ -56,6 +56,7 @@ struct switch_odbc_handle { switch_odbc_state_t state; char odbc_driver[256]; BOOL is_firebird; + int affected_rows; }; #endif @@ -88,6 +89,7 @@ SWITCH_DECLARE(switch_odbc_handle_t *) switch_odbc_handle_new(const char *dsn, c new_handle->env = SQL_NULL_HANDLE; new_handle->state = SWITCH_ODBC_STATE_INIT; + new_handle->affected_rows = 0; return new_handle; @@ -355,12 +357,15 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec_string(switch_odbc_ SQLCHAR name[1024]; SQLLEN m = 0; + handle->affected_rows = 0; + if (switch_odbc_handle_exec(handle, sql, &stmt, err) == SWITCH_ODBC_SUCCESS) { SQLSMALLINT NameLength, DataType, DecimalDigits, Nullable; SQLULEN ColumnSize; int result; SQLRowCount(stmt, &m); + handle->affected_rows = (int) m; if (m <= 0) { goto done; @@ -395,6 +400,9 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec(switch_odbc_handle_ SQLHSTMT stmt = NULL; int result; char *err_str = NULL; + SQLLEN m = 0; + + handle->affected_rows = 0; if (!db_is_up(handle)) { goto error; @@ -414,6 +422,9 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec(switch_odbc_handle_ goto error; } + SQLRowCount(stmt, &m); + handle->affected_rows = (int) m; + if (rstmt) { *rstmt = stmt; } else { @@ -462,6 +473,8 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec_detailed(c int err_cnt = 0; int done = 0; + handle->affected_rows = 0; + switch_assert(callback != NULL); if (!db_is_up(handle)) { @@ -486,6 +499,7 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec_detailed(c SQLNumResultCols(stmt, &c); SQLRowCount(stmt, &m); + handle->affected_rows = (int) m; while (!done) { @@ -621,6 +635,15 @@ SWITCH_DECLARE(char *) switch_odbc_handle_get_error(switch_odbc_handle_t *handle #endif } +SWITCH_DECLARE(int) switch_odbc_handle_affected_rows(switch_odbc_handle_t *handle) +{ +#ifdef SWITCH_HAVE_ODBC + return handle->affected_rows; +#else + return 0; +#endif +} + SWITCH_DECLARE(switch_bool_t) switch_odbc_available(void) { #ifdef SWITCH_HAVE_ODBC commit 5bb525e1eaf65a9784e97e9929b98ac846703e4d Author: Michael Jerris <mike@jerris.com> Date: Wed Jan 5 12:30:40 2011 -0500 set maximum query run time to 30 seconds at least on drivers that support SQL_ATTR_QUERY_TIMEOUT diff --git a/src/switch_odbc.c b/src/switch_odbc.c index 932d72e..31fd8f5 100644 --- a/src/switch_odbc.c +++ b/src/switch_odbc.c @@ -165,6 +165,8 @@ static int db_is_up(switch_odbc_handle_t *handle) goto error; } + SQLSetStmtAttr(stmt, SQL_ATTR_QUERY_TIMEOUT, (SQLPOINTER)30, 0); + if (SQLPrepare(stmt, sql, SQL_NTS) != SQL_SUCCESS) { code = __LINE__; goto error; commit 2c595a6ce04c714b51fc8986315ff68cd463fb35 Author: Brian West <brian@freeswitch.org> Date: Wed Jan 5 11:32:00 2011 -0600 FS-2961 diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index fddf1b7..0b7d0f3 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1314,7 +1314,9 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand if (sofia_reg_reg_count(profile, to_user, reg_host) == 1) { sql = switch_mprintf("delete from sip_presence where sip_user='%q' and sip_host='%q' and profile_name='%q' and open_closed='closed'", to_user, reg_host, profile->name); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DELETE PRESENCE SQL: %s\n", sql); + if (mod_sofia_globals.debug_presence > 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DELETE PRESENCE SQL: %s\n", sql); + } sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); } commit 2f7caaf2cb10e1cad8cad5ccf27dddf0fa97ed99 Merge: 4b04032 f574db0 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Wed Jan 5 15:27:52 2011 -0200 Merge branch 'master' of git@git.sangoma.com:smg_freeswitch commit 4b04032bd8c984c4cf4cc6dbcebe9144d7eed853 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Wed Jan 5 15:27:20 2011 -0200 freetdm: ftmod_r2 - set the FTDM_CHANNEL_USER_HANGUP flag right before changing chan state to FTDM_CHANNEL_STATE_HANGUP diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 21354c4..1b265e1 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2123,8 +2123,6 @@ static ftdm_status_t _ftdm_channel_call_hangup_nl(ftdm_channel_t *chan, const ch { ftdm_status_t status = FTDM_SUCCESS; - ftdm_set_flag(chan, FTDM_CHANNEL_USER_HANGUP); - ftdm_set_echocancel_call_end(chan); if (chan->state != FTDM_CHANNEL_STATE_DOWN) { @@ -2135,6 +2133,7 @@ static ftdm_status_t _ftdm_channel_call_hangup_nl(ftdm_channel_t *chan, const ch if (chan->hangup_timer) { ftdm_sched_cancel_timer(globals.timingsched, chan->hangup_timer); } + ftdm_set_flag(chan, FTDM_CHANNEL_USER_HANGUP); status = ftdm_channel_set_state(file, func, line, chan, FTDM_CHANNEL_STATE_HANGUP, 1); } else { /* the signaling stack did not touch the state, commit f574db09583479fb85dbbbfb9a376843c700669b Author: Moises Silva <moy@sangoma.com> Date: Wed Jan 5 12:23:09 2011 -0500 freetdm: clear blocking flag when failing to wait for state change diff --git a/libs/freetdm/src/ftdm_state.c b/libs/freetdm/src/ftdm_state.c index 0221fa2..f6c2c23 100644 --- a/libs/freetdm/src/ftdm_state.c +++ b/libs/freetdm/src/ftdm_state.c @@ -338,6 +338,7 @@ end: ftdm_mutex_lock(ftdmchan->mutex); if (status != FTDM_SUCCESS) { + ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_BLOCKING); ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_WARNING, "state change from %s to %s was most likely not completed after aprox %dms\n", ftdm_channel_state2str(ftdmchan->last_state), ftdm_channel_state2str(state), DEFAULT_WAIT_TIME); commit 98fa4a914c83228a8ac6c29d93839713a39a3392 Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Jan 5 12:02:24 2011 -0500 freetdm - ISDN:Fix for bearer Cap diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 6a440e4..59a20f1 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -470,11 +470,10 @@ ftdm_status_t set_restart_ind_ie(ftdm_channel_t *ftdmchan, RstInd *rstInd); ftdm_status_t set_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr); ftdm_status_t set_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, uint8_t *data_len); - -uint8_t sngisdn_get_infoTranCap_from_stack(ftdm_bearer_cap_t bearer_capability); -uint8_t sngisdn_get_usrInfoLyr1Prot_from_stack(ftdm_user_layer1_prot_t layer1_prot); -ftdm_bearer_cap_t sngisdn_get_infoTranCap_from_user(uint8_t bearer_capability); -ftdm_user_layer1_prot_t sngisdn_get_usrInfoLyr1Prot_from_user(uint8_t layer1_prot); +uint8_t sngisdn_get_infoTranCap_from_user(ftdm_bearer_cap_t bearer_capability); +uint8_t sngisdn_get_usrInfoLyr1Prot_from_user(ftdm_user_layer1_prot_t layer1_prot); +ftdm_bearer_cap_t sngisdn_get_infoTranCap_from_stack(uint8_t bearer_capability); +ftdm_user_layer1_prot_t sngisdn_get_usrInfoLyr1Prot_from_stack(uint8_t layer1_prot); static __inline__ uint32_t sngisdn_test_flag(sngisdn_chan_data_t *sngisdn_info, sngisdn_flag_t flag) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 7e9e360..05b7158 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -141,7 +141,7 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Incoming call: Called No:[%s] Calling No:[%s]\n", ftdmchan->caller_data.dnis.digits, ftdmchan->caller_data.cid_num.digits); if (conEvnt->bearCap[0].eh.pres) { - ftdmchan->caller_data.bearer_layer1 = sngisdn_get_infoTranCap_from_stack(conEvnt->bearCap[0].usrInfoLyr1Prot.val); + ftdmchan->caller_data.bearer_layer1 = sngisdn_get_usrInfoLyr1Prot_from_stack(conEvnt->bearCap[0].usrInfoLyr1Prot.val); ftdmchan->caller_data.bearer_capability = sngisdn_get_infoTranCap_from_stack(conEvnt->bearCap[0].infoTranCap.val); } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 28768a1..a2cf2ef 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -1033,7 +1033,7 @@ void get_memory_info(void) return; } -uint8_t sngisdn_get_infoTranCap_from_stack(ftdm_bearer_cap_t bearer_capability) +uint8_t sngisdn_get_infoTranCap_from_user(ftdm_bearer_cap_t bearer_capability) { switch(bearer_capability) { case FTDM_BEARER_CAP_SPEECH: @@ -1049,7 +1049,7 @@ uint8_t sngisdn_get_infoTranCap_from_stack(ftdm_bearer_cap_t bearer_capability) return FTDM_BEARER_CAP_SPEECH; } -uint8_t sngisdn_get_usrInfoLyr1Prot_from_stack(ftdm_user_layer1_prot_t layer1_prot) +uint8_t sngisdn_get_usrInfoLyr1Prot_from_user(ftdm_user_layer1_prot_t layer1_prot) { switch(layer1_prot) { case FTDM_USER_LAYER1_PROT_V110: @@ -1065,25 +1065,22 @@ uint8_t sngisdn_get_usrInfoLyr1Prot_from_stack(ftdm_user_layer1_prot_t layer1_pr return IN_UIL1_G711ULAW; } -ftdm_bearer_cap_t sngisdn_get_infoTranCap_from_user(uint8_t bearer_capability) +ftdm_bearer_cap_t sngisdn_get_infoTranCap_from_stack(uint8_t bearer_capability) { switch(bearer_capability) { case IN_ITC_SPEECH: - return FTDM_BEARER_CAP_SPEECH; - + return FTDM_BEARER_CAP_SPEECH; case IN_ITC_UNRDIG: - return FTDM_BEARER_CAP_64K_UNRESTRICTED; - + return FTDM_BEARER_CAP_64K_UNRESTRICTED; case IN_ITC_A31KHZ: return FTDM_BEARER_CAP_3_1KHZ_AUDIO; - default: return FTDM_BEARER_CAP_SPEECH; } return FTDM_BEARER_CAP_SPEECH; } -ftdm_user_layer1_prot_t sngisdn_get_usrInfoLyr1Prot_from_user(uint8_t layer1_prot) +ftdm_user_layer1_prot_t sngisdn_get_usrInfoLyr1Prot_from_stack(uint8_t layer1_prot) { switch(layer1_prot) { case IN_UIL1_CCITTV110: commit 8f9ddb5a8966602810a5a49aba70723f13b8393d Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Jan 5 10:42:33 2011 -0600 42 diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 74af6f7..570b2fd 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -978,6 +978,9 @@ static switch_status_t messagehook (switch_core_session_t *session, switch_core_ switch (msg->message_id) { case SWITCH_MESSAGE_INDICATE_BRIDGE: case SWITCH_MESSAGE_INDICATE_UNBRIDGE: + if (msg->numeric_arg == 42) { + goto end; + } if ((caller_session = switch_core_session_locate(msg->string_arg))) { caller_channel = switch_core_session_get_channel(caller_session); if (msg->message_id == SWITCH_MESSAGE_INDICATE_BRIDGE) { diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index ee7c127..7448125 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -315,6 +315,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) if (read_frame_count > DEFAULT_LEAD_FRAMES && switch_channel_media_ack(chan_a) && switch_core_session_private_event_count(session_a)) { switch_channel_set_flag(chan_b, CF_SUSPEND); + msg.numeric_arg = 42; msg.string_arg = data->b_uuid; msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE; msg.from = __FILE__; @@ -1184,6 +1185,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses } } + switch_channel_wait_for_flag(peer_channel, CF_BROADCAST, SWITCH_FALSE, 10000, caller_channel); + switch_ivr_parse_all_events(peer_session); + switch_ivr_parse_all_events(session); + msg.message_id = SWITCH_MESSAGE_INDICATE_BRIDGE; msg.from = __FILE__; msg.string_arg = switch_core_session_strdup(peer_session, switch_core_session_get_uuid(session)); commit 3734f4cd441a6bc9595e83338cf29c5af24ed9c7 Author: Brian West <brian@freeswitch.org> Date: Wed Jan 5 10:08:55 2011 -0600 bump copyright date and fix some email and typos from diego. diff --git a/conf/autoload_configs/switch.conf.xml b/conf/autoload_configs/switch.conf.xml index fba809b..8342f12 100644 --- a/conf/autoload_configs/switch.conf.xml +++ b/conf/autoload_configs/switch.conf.xml @@ -16,7 +16,7 @@ </cli-keybindings> <default-ptimes> - <!-- set this to overide the 20ms assumption of various codecs in the sdp with no ptime defined --> + <!-- set this to override the 20ms assumption of various codecs in the sdp with no ptime defined --> <!--<codec name="G729" ptime="40"/>--> </default-ptimes> diff --git a/debian/freeswitch.init b/debian/freeswitch.init index ddde2f5..44d166d 100755 --- a/debian/freeswitch.init +++ b/debian/freeswitch.init @@ -9,7 +9,7 @@ # Description: An advanced platform for voice services ### END INIT INFO -# Author: Anthony Minesalle III <anthmct@yahoo.com> +# Author: Anthony Minesalle III <anthm@freeswitch.org> # # Do NOT "set -e" diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index f12ed62..f50d26c 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * @@ -17,13 +17,13 @@ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * * The Initial Developer of the Original Code is - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. * * Contributor(s): * - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * Moises Silva <moy@sangoma.com> * David Yat Sin <dyatsin@sangoma.com> * diff --git a/libs/freetdm/src/include/private/libteletone.h b/libs/freetdm/src/include/private/libteletone.h index 7453be5..dc98c8c 100644 --- a/libs/freetdm/src/include/private/libteletone.h +++ b/libs/freetdm/src/include/private/libteletone.h @@ -1,6 +1,6 @@ /* * libteletone - * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * @@ -17,13 +17,13 @@ * The Original Code is libteletone * * The Initial Developer of the Original Code is - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. * * Contributor(s): * - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * * * libteletone.h -- Tone Generator/Detector diff --git a/libs/freetdm/src/include/private/libteletone_detect.h b/libs/freetdm/src/include/private/libteletone_detect.h index b2d43d1..71bf067 100644 --- a/libs/freetdm/src/include/private/libteletone_detect.h +++ b/libs/freetdm/src/include/private/libteletone_detect.h @@ -1,6 +1,6 @@ /* * libteletone - * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * libteletone_detect.c Tone Detection Code * diff --git a/libs/freetdm/src/include/private/libteletone_generate.h b/libs/freetdm/src/include/private/libteletone_generate.h index 2d47abd..6d71694 100644 --- a/libs/freetdm/src/include/private/libteletone_generate.h +++ b/libs/freetdm/src/include/private/libteletone_generate.h @@ -1,6 +1,6 @@ /* * libteletone - * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Copyright (c) 2007, Anthony Minessale II * All rights reserved. diff --git a/libs/freetdm/src/include/private/sangoma_tdm_api.h b/libs/freetdm/src/include/private/sangoma_tdm_api.h index 062d4e2..6438c99 100644 --- a/libs/freetdm/src/include/private/sangoma_tdm_api.h +++ b/libs/freetdm/src/include/private/sangoma_tdm_api.h @@ -1,7 +1,7 @@ /***************************************************************************** * sangoma_tdm_api.h Sangoma TDM API Portability functions * - * Author(s): Anthony Minessale II <anthmct@yahoo.com> + * Author(s): Anthony Minessale II <anthm@freeswitch.org> * Nenad Corbic <ncorbic@sangoma.com> * Michael Jerris <mike@jerris.com> * David Rokhvarg <davidr@sangoma.com> diff --git a/libs/freetdm/src/libteletone_detect.c b/libs/freetdm/src/libteletone_detect.c index 61fef90..0436c25 100644 --- a/libs/freetdm/src/libteletone_detect.c +++ b/libs/freetdm/src/libteletone_detect.c @@ -1,12 +1,12 @@ /* * libteletone - * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Much less efficient expansion interface was added to allow for the detection of * a single arbitrary tone combination which may also exceed 2 simultaneous tones. * (controlled by compile time constant TELETONE_MAX_TONES) * - * Copyright (C) 2006 Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2006 Anthony Minessale II <anthm@freeswitch.org> * * libteletone_detect.c Tone Detection Code * diff --git a/libs/freetdm/src/priserver.c b/libs/freetdm/src/priserver.c index b67fa04..4e5ec87 100644 --- a/libs/freetdm/src/priserver.c +++ b/libs/freetdm/src/priserver.c @@ -1,7 +1,7 @@ /***************************************************************************** * priserver.c Refactoring of pritest.c * - * Author(s): Anthony Minessale II <anthmct@yahoo.com> + * Author(s): Anthony Minessale II <anthm@freeswitch.org> * Nenad Corbic <ncorbic@sangoma.com> * * Copyright: (c) 2005 Anthony Minessale II diff --git a/libs/freetdm/src/sangoma_pri.c b/libs/freetdm/src/sangoma_pri.c index 402611e..4adcf01 100644 --- a/libs/freetdm/src/sangoma_pri.c +++ b/libs/freetdm/src/sangoma_pri.c @@ -1,7 +1,7 @@ /***************************************************************************** * sangoma_pri.c libpri Sangoma integration * - * Author(s): Anthony Minessale II <anthmct@yahoo.com> + * Author(s): Anthony Minessale II <anthm@freeswitch.org> * Nenad Corbic <ncorbic@sangoma.com> * * Copyright: (c) 2005 Anthony Minessale II diff --git a/libs/freetdm/src/sangoma_pri.h b/libs/freetdm/src/sangoma_pri.h index 2a1b2a2..d37622a 100644 --- a/libs/freetdm/src/sangoma_pri.h +++ b/libs/freetdm/src/sangoma_pri.h @@ -1,7 +1,7 @@ /***************************************************************************** * libsangoma.c AFT T1/E1: HDLC API Code Library * - * Author(s): Anthony Minessale II <anthmct@yahoo.com> + * Author(s): Anthony Minessale II <anthm@freeswitch.org> * Nenad Corbic <ncorbic@sangoma.com> * * Copyright: (c) 2005 Anthony Minessale II diff --git a/libs/libdingaling/src/ldl_compat.h b/libs/libdingaling/src/ldl_compat.h index b19137e..26ae586 100644 --- a/libs/libdingaling/src/ldl_compat.h +++ b/libs/libdingaling/src/ldl_compat.h @@ -1,6 +1,6 @@ /* * libDingaLing XMPP Jingle Library - * Copyright (C) 2005/2006, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/libs/libdingaling/src/libdingaling.c b/libs/libdingaling/src/libdingaling.c index 11a9a8a..44c4589 100644 --- a/libs/libdingaling/src/libdingaling.c +++ b/libs/libdingaling/src/libdingaling.c @@ -1,6 +1,6 @@ /* * libDingaLing XMPP Jingle Library - * Copyright (C) 2005/2006, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/libs/libdingaling/src/libdingaling.h b/libs/libdingaling/src/libdingaling.h index c32b936..f103327 100644 --- a/libs/libdingaling/src/libdingaling.h +++ b/libs/libdingaling/src/libdingaling.h @@ -1,6 +1,6 @@ /* * libDingaLing XMPP Jingle Library - * Copyright (C) 2005/2006, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/libs/libteletone/src/libteletone.h b/libs/libteletone/src/libteletone.h index 6e806ce..b54098c 100644 --- a/libs/libteletone/src/libteletone.h +++ b/libs/libteletone/src/libteletone.h @@ -1,6 +1,6 @@ /* * libteletone - * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * @@ -17,13 +17,13 @@ * The Original Code is libteletone * * The Initial Developer of the Original Code is - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. * * Contributor(s): * - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * * * libteletone.h -- Tone Generator/Detector diff --git a/libs/libteletone/src/libteletone_detect.c b/libs/libteletone/src/libteletone_detect.c index 3738e4c..ae95953 100644 --- a/libs/libteletone/src/libteletone_detect.c +++ b/libs/libteletone/src/libteletone_detect.c @@ -1,6 +1,6 @@ /* * libteletone - * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * @@ -32,7 +32,7 @@ * a single arbitrary tone combination which may also exceed 2 simultaneous tones. * (controlled by compile time constant TELETONE_MAX_TONES) * - * Copyright (C) 2006 Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2006 Anthony Minessale II <anthm@freeswitch.org> * * * libteletone_detect.c Tone Detection Code diff --git a/libs/libteletone/src/libteletone_detect.h b/libs/libteletone/src/libteletone_detect.h index a9fee6c..e2a8c20 100644 --- a/libs/libteletone/src/libteletone_detect.h +++ b/libs/libteletone/src/libteletone_detect.h @@ -1,6 +1,6 @@ /* * libteletone - * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * @@ -32,7 +32,7 @@ * a single arbitrary tone combination which may also exceed 2 simultaneous tones. * (controlled by compile time constant TELETONE_MAX_TONES) * - * Copyright (C) 2006 Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2006 Anthony Minessale II <anthm@freeswitch.org> * * * libteletone_detect.c Tone Detection Code diff --git a/libs/libteletone/src/libteletone_generate.c b/libs/libteletone/src/libteletone_generate.c index 3977ca5..ebf6282 100644 --- a/libs/libteletone/src/libteletone_generate.c +++ b/libs/libteletone/src/libteletone_generate.c @@ -1,6 +1,6 @@ /* * libteletone - * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * @@ -17,13 +17,13 @@ * The Original Code is libteletone * * The Initial Developer of the Original Code is - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. * * Contributor(s): * - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * * * libteletone.c -- Tone Generator diff --git a/libs/libteletone/src/libteletone_generate.h b/libs/libteletone/src/libteletone_generate.h index a6addc4..5e6444b 100644 --- a/libs/libteletone/src/libteletone_generate.h +++ b/libs/libteletone/src/libteletone_generate.h @@ -1,6 +1,6 @@ /* * libteletone - * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * @@ -17,13 +17,13 @@ * The Original Code is libteletone * * The Initial Developer of the Original Code is - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. * * Contributor(s): * - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * * * libteletone.h -- Tone Generator diff --git a/libs/openzap/mod_openzap/mod_openzap.c b/libs/openzap/mod_openzap/mod_openzap.c index 6a75dc8..3e5227e 100644 --- a/libs/openzap/mod_openzap/mod_openzap.c +++ b/libs/openzap/mod_openzap/mod_openzap.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * @@ -17,13 +17,13 @@ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * * The Initial Developer of the Original Code is - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. * * Contributor(s): * - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * Moises Silva <moy@sangoma.com> * * diff --git a/libs/openzap/src/include/libteletone.h b/libs/openzap/src/include/libteletone.h index 6e806ce..b54098c 100644 --- a/libs/openzap/src/include/libteletone.h +++ b/libs/openzap/src/include/libteletone.h @@ -1,6 +1,6 @@ /* * libteletone - * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * @@ -17,13 +17,13 @@ * The Original Code is libteletone * * The Initial Developer of the Original Code is - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. * * Contributor(s): * - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * * * libteletone.h -- Tone Generator/Detector diff --git a/libs/openzap/src/include/libteletone_detect.h b/libs/openzap/src/include/libteletone_detect.h index 3d0a513..c8c667d 100644 --- a/libs/openzap/src/include/libteletone_detect.h +++ b/libs/openzap/src/include/libteletone_detect.h @@ -1,6 +1,6 @@ /* * libteletone - * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * libteletone_detect.c Tone Detection Code * diff --git a/libs/openzap/src/include/libteletone_generate.h b/libs/openzap/src/include/libteletone_generate.h index fce19e7..1b77420 100644 --- a/libs/openzap/src/include/libteletone_generate.h +++ b/libs/openzap/src/include/libteletone_generate.h @@ -1,6 +1,6 @@ /* * libteletone - * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Copyright (c) 2007, Anthony Minessale II * All rights reserved. diff --git a/libs/openzap/src/include/sangoma_tdm_api.h b/libs/openzap/src/include/sangoma_tdm_api.h index 062d4e2..6438c99 100644 --- a/libs/openzap/src/include/sangoma_tdm_api.h +++ b/libs/openzap/src/include/sangoma_tdm_api.h @@ -1,7 +1,7 @@ /***************************************************************************** * sangoma_tdm_api.h Sangoma TDM API Portability functions * - * Author(s): Anthony Minessale II <anthmct@yahoo.com> + * Author(s): Anthony Minessale II <anthm@freeswitch.org> * Nenad Corbic <ncorbic@sangoma.com> * Michael Jerris <mike@jerris.com> * David Rokhvarg <davidr@sangoma.com> diff --git a/libs/openzap/src/libteletone_detect.c b/libs/openzap/src/libteletone_detect.c index 61fef90..0436c25 100644 --- a/libs/openzap/src/libteletone_detect.c +++ b/libs/openzap/src/libteletone_detect.c @@ -1,12 +1,12 @@ /* * libteletone - * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Much less efficient expansion interface was added to allow for the detection of * a single arbitrary tone combination which may also exceed 2 simultaneous tones. * (controlled by compile time constant TELETONE_MAX_TONES) * - * Copyright (C) 2006 Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2006 Anthony Minessale II <anthm@freeswitch.org> * * libteletone_detect.c Tone Detection Code * diff --git a/libs/openzap/src/priserver.c b/libs/openzap/src/priserver.c index 7a37357..080e5d4 100644 --- a/libs/openzap/src/priserver.c +++ b/libs/openzap/src/priserver.c @@ -1,7 +1,7 @@ /***************************************************************************** * priserver.c Refactoring of pritest.c * - * Author(s): Anthony Minessale II <anthmct@yahoo.com> + * Author(s): Anthony Minessale II <anthm@freeswitch.org> * Nenad Corbic <ncorbic@sangoma.com> * * Copyright: (c) 2005 Anthony Minessale II diff --git a/libs/openzap/src/sangoma_pri.c b/libs/openzap/src/sangoma_pri.c index 5cf6a5c..c160eed 100644 --- a/libs/openzap/src/sangoma_pri.c +++ b/libs/openzap/src/sangoma_pri.c @@ -1,7 +1,7 @@ /***************************************************************************** * sangoma_pri.c libpri Sangoma integration * - * Author(s): Anthony Minessale II <anthmct@yahoo.com> + * Author(s): Anthony Minessale II <anthm@freeswitch.org> * Nenad Corbic <ncorbic@sangoma.com> * * Copyright: (c) 2005 Anthony Minessale II diff --git a/libs/openzap/src/sangoma_pri.h b/libs/openzap/src/sangoma_pri.h index 5ea21eb..880fc85 100644 --- a/libs/openzap/src/sangoma_pri.h +++ b/libs/openzap/src/sangoma_pri.h @@ -1,7 +1,7 @@ /***************************************************************************** * libsangoma.c AFT T1/E1: HDLC API Code Library * - * Author(s): Anthony Minessale II <anthmct@yahoo.com> + * Author(s): Anthony Minessale II <anthm@freeswitch.org> * Nenad Corbic <ncorbic@sangoma.com> * * Copyright: (c) 2005 Anthony Minessale II diff --git a/scripts/c/socket2me/socket2me.c b/scripts/c/socket2me/socket2me.c index 5d6fceb..1b3aa0c 100644 --- a/scripts/c/socket2me/socket2me.c +++ b/scripts/c/socket2me/socket2me.c @@ -29,7 +29,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * - * Copyright (C) 2007, Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2007, Anthony Minessale II <anthm@freeswitch.org> */ #include <stdio.h> diff --git a/scripts/javascript/api.js b/scripts/javascript/api.js index 41b632e..47c5770 100644 --- a/scripts/javascript/api.js +++ b/scripts/javascript/api.js @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * @@ -17,13 +17,13 @@ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * * The Initial Developer of the Original Code is - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. * * Contributor(s): * - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * * * api.js Demo javascript FSAPI Interface diff --git a/scripts/javascript/js_modules/SpeechTools.jm b/scripts/javascript/js_modules/SpeechTools.jm index 6f9fb25..4e9628b 100644 --- a/scripts/javascript/js_modules/SpeechTools.jm +++ b/scripts/javascript/js_modules/SpeechTools.jm @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2005/2006, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * @@ -17,13 +17,13 @@ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * * The Initial Developer of the Original Code is - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. * * Contributor(s): * - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * * * SpeechTools.jm Speech Detection Interface diff --git a/scripts/javascript/pizza.js b/scripts/javascript/pizza.js index b665ca6..9807f5b 100644 --- a/scripts/javascript/pizza.js +++ b/scripts/javascript/pizza.js @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * @@ -17,13 +17,13 @@ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * * The Initial Developer of the Original Code is - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. * * Contributor(s): * - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * * * pizza.js ASR Demonstration Application diff --git a/scripts/javascript/ps_pizza.js b/scripts/javascript/ps_pizza.js index 50d3167..7fd405e 100644 --- a/scripts/javascript/ps_pizza.js +++ b/scripts/javascript/ps_pizza.js @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * @@ -17,13 +17,13 @@ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * * The Initial Developer of the Original Code is - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. * * Contributor(s): * - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * * * pizza.js ASR Demonstration Application diff --git a/scripts/perl/sendmail b/scripts/perl/sendmail index 1cf6f71..a89dce6 100644 --- a/scripts/perl/sendmail +++ b/scripts/perl/sendmail @@ -5,7 +5,7 @@ # voicemail gateway with no mail server> # # (c) 2005 Anthony Minessale II -# Anthony Minessale <anthmct@yahoo.com> +# Anthony Minessale <anthm@freeswitch.org> # ################################################################################ use Net::SMTP; diff --git a/scripts/python/freepy/__init__.py b/scripts/python/freepy/__init__.py index e23fc6f..cebe48a 100644 --- a/scripts/python/freepy/__init__.py +++ b/scripts/python/freepy/__init__.py @@ -1,6 +1,6 @@ """ FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application -Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> +Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> Version: MPL 1.1 @@ -17,7 +17,7 @@ License. The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application The Initial Developer of the Original Code is -Anthony Minessale II <anthmct@yahoo.com> +Anthony Minessale II <anthm@freeswitch.org> Portions created by the Initial Developer are Copyright (C) the Initial Developer. All Rights Reserved. diff --git a/scripts/python/freepy/fseventlistener.py b/scripts/python/freepy/fseventlistener.py index 8e1f118..6e3455f 100644 --- a/scripts/python/freepy/fseventlistener.py +++ b/scripts/python/freepy/fseventlistener.py @@ -1,6 +1,6 @@ """ FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application -Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> +Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> Version: MPL 1.1 @@ -17,7 +17,7 @@ License. The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application The Initial Developer of the Original Code is -Anthony Minessale II <anthmct@yahoo.com> +Anthony Minessale II <anthm@freeswitch.org> Portions created by the Initial Developer are Copyright (C) the Initial Developer. All Rights Reserved. diff --git a/scripts/python/freepy/fshelper.py b/scripts/python/freepy/fshelper.py index a06ed40..090abce 100644 --- a/scripts/python/freepy/fshelper.py +++ b/scripts/python/freepy/fshelper.py @@ -2,7 +2,7 @@ """ FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application -Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> +Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> Version: MPL 1.1 @@ -19,7 +19,7 @@ License. The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application The Initial Developer of the Original Code is -Anthony Minessale II <anthmct@yahoo.com> +Anthony Minessale II <anthm@freeswitch.org> Portions created by the Initial Developer are Copyright (C) the Initial Developer. All Rights Reserved. diff --git a/scripts/python/freepy/models.py b/scripts/python/freepy/models.py index 2b9de74..3dfb105 100644 --- a/scripts/python/freepy/models.py +++ b/scripts/python/freepy/models.py @@ -1,6 +1,6 @@ """ FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application -Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> +Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> Version: MPL 1.1 @@ -17,7 +17,7 @@ License. The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application The Initial Developer of the Original Code is -Anthony Minessale II <anthmct@yahoo.com> +Anthony Minessale II <anthm@freeswitch.org> Portions created by the Initial Developer are Copyright (C) the Initial Developer. All Rights Reserved. diff --git a/scripts/python/freepy/request.py b/scripts/python/freepy/request.py index f2c6e38..d76fe29 100644 --- a/scripts/python/freepy/request.py +++ b/scripts/python/freepy/request.py @@ -1,6 +1,6 @@ """ FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application -Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> +Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> Version: MPL 1.1 @@ -17,7 +17,7 @@ License. The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application The Initial Developer of the Original Code is -Anthony Minessale II <anthmct@yahoo.com> +Anthony Minessale II <anthm@freeswitch.org> Portions created by the Initial Developer are Copyright (C) the Initial Developer. All Rights Reserved. diff --git a/scripts/rss/rss2ivr.pl b/scripts/rss/rss2ivr.pl index f74a51c..ed5aabd 100755 --- a/scripts/rss/rss2ivr.pl +++ b/scripts/rss/rss2ivr.pl @@ -4,7 +4,7 @@ # # Copyright (C) 2006, Anthony Minessale # -# Anthony Minessale <anthmct@yahoo.com> +# Anthony Minessale <anthm@freeswitch.org> # # This program is free software, distributed under the terms of # Perl itself diff --git a/scripts/trace/sipgrep b/scripts/trace/sipgrep index e161675..7bd5dae 100755 --- a/scripts/trace/sipgrep +++ b/scripts/trace/sipgrep @@ -1,6 +1,6 @@ #!/usr/bin/perl # sipgrep version 0.2. Skin for ngrep. (C) 2005-2006 Alexandr Dubovikov <shurik@start4.info> -# Modified 2007 Anthony Minessale <anthmct@yahoo.com> +# Modified 2007 Anthony Minessale <anthm@freeswitch.org> use Term::ANSIColor; use Getopt::Std; diff --git a/src/fs_encode.c b/src/fs_encode.c index 9517802..bdaf1ec 100644 --- a/src/fs_encode.c +++ b/src/fs_encode.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index 422d5f2..30690b1 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/switch.h b/src/include/switch.h index 81684c5..ce2ba78 100644 --- a/src/include/switch.h +++ b/src/include/switch.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/switch_apr.h b/src/include/switch_apr.h index d89a13b..a196af7 100644 --- a/src/include/switch_apr.h +++ b/src/include/switch_apr.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/switch_bitpack.h b/src/include/switch_bitpack.h index f534ea6..3209cbc 100644 --- a/src/include/switch_bitpack.h +++ b/src/include/switch_bitpack.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/switch_buffer.h b/src/include/switch_buffer.h index 40c4c5a..75b5929 100644 --- a/src/include/switch_buffer.h +++ b/src/include/switch_buffer.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/switch_caller.h b/src/include/switch_caller.h index f77f1b0..bd53a04 100644 --- a/src/include/switch_caller.h +++ b/src/include/switch_caller.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index e726554..ee9b397 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/switch_config.h b/src/include/switch_config.h index 4115564..b0ef805 100644 --- a/src/include/switch_config.h +++ b/src/include/switch_config.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/switch_console.h b/src/include/switch_console.h index 31d5ebf..5585a04 100644 --- a/src/include/switch_console.h +++ b/src/include/switch_console.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/switch_core.h b/src/include/switch_core.h index bcd3c0a..d02018b 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/switch_core_db.h b/src/include/switch_core_db.h index 6be6e8e..6ea9b4a 100644 --- a/src/include/switch_core_db.h +++ b/src/include/switch_core_db.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/switch_core_event_hook.h b/src/include/switch_core_event_hook.h index 575786f..ff836b3 100644 --- a/src/include/switch_core_event_hook.h +++ b/src/include/switch_core_event_hook.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/switch_event.h b/src/include/switch_event.h index 41bc75c..56acbd3 100644 --- a/src/include/switch_event.h +++ b/src/include/switch_event.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/switch_frame.h b/src/include/switch_frame.h index 20103a1..edc4f8b 100644 --- a/src/include/switch_frame.h +++ b/src/include/switch_frame.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index da366c5..46c9c91 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/switch_limit.h b/src/include/switch_limit.h index e798f9c..4488b8c 100644 --- a/src/include/switch_limit.h +++ b/src/include/switch_limit.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/switch_loadable_module.h b/src/include/switch_loadable_module.h index 37c752b..7e4d617 100644 --- a/src/include/switch_loadable_module.h +++ b/src/include/switch_loadable_module.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/switch_log.h b/src/include/switch_log.h index 98d9448..170425a 100644 --- a/src/include/switch_log.h +++ b/src/include/switch_log.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/switch_module_interfaces.h b/src/include/switch_module_interfaces.h index ae0ce90..1cf01c5 100644 --- a/src/include/switch_module_interfaces.h +++ b/src/include/switch_module_interfaces.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/switch_nat.h b/src/include/switch_nat.h index 09118c1..bdbd51b 100644 --- a/src/include/switch_nat.h +++ b/src/include/switch_nat.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/switch_odbc.h b/src/include/switch_odbc.h index b8d4bc2..0b5f904 100644 --- a/src/include/switch_odbc.h +++ b/src/include/switch_odbc.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/switch_platform.h b/src/include/switch_platform.h index c1ad51f..15b3277 100644 --- a/src/include/switch_platform.h +++ b/src/include/switch_platform.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/switch_regex.h b/src/include/switch_regex.h index 4ee1fd5..96d6230 100644 --- a/src/include/switch_regex.h +++ b/src/include/switch_regex.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/switch_resample.h b/src/include/switch_resample.h index 55f1740..b38e094 100644 --- a/src/include/switch_resample.h +++ b/src/include/switch_resample.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/switch_rtp.h b/src/include/switch_rtp.h index c48a40e..a161d2a 100644 --- a/src/include/switch_rtp.h +++ b/src/include/switch_rtp.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/switch_scheduler.h b/src/include/switch_scheduler.h index d9fa565..8db9696 100644 --- a/src/include/switch_scheduler.h +++ b/src/include/switch_scheduler.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/switch_stun.h b/src/include/switch_stun.h index d5df57e..426eb49 100644 --- a/src/include/switch_stun.h +++ b/src/include/switch_stun.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/switch_types.h b/src/include/switch_types.h index bb5f598..d3aacca 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 3360f33..259de0a 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/switch_xml.h b/src/include/switch_xml.h index 9b0fbb4..bd9e6a0 100644 --- a/src/include/switch_xml.h +++ b/src/include/switch_xml.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/include/switch_xml_config.h b/src/include/switch_xml_config.h index 3e78f5f..49986c9 100644 --- a/src/include/switch_xml_config.h +++ b/src/include/switch_xml_config.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index ca92b17..d1de632 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_cidlookup/mod_cidlookup.c b/src/mod/applications/mod_cidlookup/mod_cidlookup.c index 230c48a..2ec41f1 100755 --- a/src/mod/applications/mod_cidlookup/mod_cidlookup.c +++ b/src/mod/applications/mod_cidlookup/mod_cidlookup.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_cluechoo/mod_cluechoo.c b/src/mod/applications/mod_cluechoo/mod_cluechoo.c index ab14b75..2699d82 100644 --- a/src/mod/applications/mod_cluechoo/mod_cluechoo.c +++ b/src/mod/applications/mod_cluechoo/mod_cluechoo.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 8daaace..15ac8ec 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 21feaa9..a9da20e 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_curl/mod_curl.c b/src/mod/applications/mod_curl/mod_curl.c index 4f6aefd..633e4c8 100644 --- a/src/mod/applications/mod_curl/mod_curl.c +++ b/src/mod/applications/mod_curl/mod_curl.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_db/mod_db.c b/src/mod/applications/mod_db/mod_db.c index 088d9d0..e611d03 100644 --- a/src/mod/applications/mod_db/mod_db.c +++ b/src/mod/applications/mod_db/mod_db.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_directory/mod_directory.c b/src/mod/applications/mod_directory/mod_directory.c index d929747..0127363 100644 --- a/src/mod/applications/mod_directory/mod_directory.c +++ b/src/mod/applications/mod_directory/mod_directory.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_distributor/mod_distributor.c b/src/mod/applications/mod_distributor/mod_distributor.c index f4070a9..b87b3ed 100644 --- a/src/mod/applications/mod_distributor/mod_distributor.c +++ b/src/mod/applications/mod_distributor/mod_distributor.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 6fbf70b..e5e4fe5 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_easyroute/mod_easyroute.c b/src/mod/applications/mod_easyroute/mod_easyroute.c index 8a21a22..481df95 100644 --- a/src/mod/applications/mod_easyroute/mod_easyroute.c +++ b/src/mod/applications/mod_easyroute/mod_easyroute.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_enum/mod_enum.c b/src/mod/applications/mod_enum/mod_enum.c index 1f00721..378c336 100644 --- a/src/mod/applications/mod_enum/mod_enum.c +++ b/src/mod/applications/mod_enum/mod_enum.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_esf/mod_esf.c b/src/mod/applications/mod_esf/mod_esf.c index 20cad68..a2f8ddb 100644 --- a/src/mod/applications/mod_esf/mod_esf.c +++ b/src/mod/applications/mod_esf/mod_esf.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_expr/mod_expr.c b/src/mod/applications/mod_expr/mod_expr.c index f761b3c..d562d8c 100644 --- a/src/mod/applications/mod_expr/mod_expr.c +++ b/src/mod/applications/mod_expr/mod_expr.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_fax/mod_fax.c b/src/mod/applications/mod_fax/mod_fax.c index da1a98e..a899d27 100644 --- a/src/mod/applications/mod_fax/mod_fax.c +++ b/src/mod/applications/mod_fax/mod_fax.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 140850b..74af6f7 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_fsv/mod_fsv.c b/src/mod/applications/mod_fsv/mod_fsv.c index 200706c..7b59796 100644 --- a/src/mod/applications/mod_fsv/mod_fsv.c +++ b/src/mod/applications/mod_fsv/mod_fsv.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_hash/mod_hash.c b/src/mod/applications/mod_hash/mod_hash.c index 2609b6c..d03ff92 100644 --- a/src/mod/applications/mod_hash/mod_hash.c +++ b/src/mod/applications/mod_hash/mod_hash.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_lcr/mod_lcr.c b/src/mod/applications/mod_lcr/mod_lcr.c index 5f70e0a..2f2bc7d 100644 --- a/src/mod/applications/mod_lcr/mod_lcr.c +++ b/src/mod/applications/mod_lcr/mod_lcr.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_limit/mod_limit.c b/src/mod/applications/mod_limit/mod_limit.c index 3378cfd..56da299 100644 --- a/src/mod/applications/mod_limit/mod_limit.c +++ b/src/mod/applications/mod_limit/mod_limit.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_memcache/mod_memcache.c b/src/mod/applications/mod_memcache/mod_memcache.c index 9aa0c97..6016639 100755 --- a/src/mod/applications/mod_memcache/mod_memcache.c +++ b/src/mod/applications/mod_memcache/mod_memcache.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_mp4/mod_mp4.cpp b/src/mod/applications/mod_mp4/mod_mp4.cpp index a1114d1..0d9eac1 100644 --- a/src/mod/applications/mod_mp4/mod_mp4.cpp +++ b/src/mod/applications/mod_mp4/mod_mp4.cpp @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_nibblebill/mod_nibblebill.c b/src/mod/applications/mod_nibblebill/mod_nibblebill.c index 42369f5..8487d0b 100755 --- a/src/mod/applications/mod_nibblebill/mod_nibblebill.c +++ b/src/mod/applications/mod_nibblebill/mod_nibblebill.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * @@ -17,7 +17,7 @@ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * * The Initial Developer of the Original Code is - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * * The Initial Developer of this module is * Darren Schreiber <d@d-man.org> diff --git a/src/mod/applications/mod_rad_auth/mod_rad_auth.c b/src/mod/applications/mod_rad_auth/mod_rad_auth.c index 1cb81b0..1dc6d6b 100644 --- a/src/mod/applications/mod_rad_auth/mod_rad_auth.c +++ b/src/mod/applications/mod_rad_auth/mod_rad_auth.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application -* Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> +* Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * @@ -17,13 +17,13 @@ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * * The Initial Developer of the Original Code is -* Anthony Minessale II <anthmct@yahoo.com> +* Anthony Minessale II <anthm@freeswitch.org> * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. * * Contributor(s): * -* Anthony Minessale II <anthmct@yahoo.com> +* Anthony Minessale II <anthm@freeswitch.org> * Neal Horman <neal at wanlink dot com> * Tihomir Culjaga <tculjaga@gmail.com> * diff --git a/src/mod/applications/mod_redis/mod_redis.c b/src/mod/applications/mod_redis/mod_redis.c index d20ab93..1e99967 100755 --- a/src/mod/applications/mod_redis/mod_redis.c +++ b/src/mod/applications/mod_redis/mod_redis.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_rss/mod_rss.c b/src/mod/applications/mod_rss/mod_rss.c index 2eaae2f..b85d86b 100644 --- a/src/mod/applications/mod_rss/mod_rss.c +++ b/src/mod/applications/mod_rss/mod_rss.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_skel/mod_skel.c b/src/mod/applications/mod_skel/mod_skel.c index c96d6b3..c5445f3 100644 --- a/src/mod/applications/mod_skel/mod_skel.c +++ b/src/mod/applications/mod_skel/mod_skel.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_snapshot/mod_snapshot.c b/src/mod/applications/mod_snapshot/mod_snapshot.c index 20b3110..854292c 100644 --- a/src/mod/applications/mod_snapshot/mod_snapshot.c +++ b/src/mod/applications/mod_snapshot/mod_snapshot.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_snipe_hunt/mod_snipe_hunt.c b/src/mod/applications/mod_snipe_hunt/mod_snipe_hunt.c index 387ee93..334a0c5 100644 --- a/src/mod/applications/mod_snipe_hunt/mod_snipe_hunt.c +++ b/src/mod/applications/mod_snipe_hunt/mod_snipe_hunt.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_snom/mod_snom.c b/src/mod/applications/mod_snom/mod_snom.c index 1a16dd9..3c50ea1 100644 --- a/src/mod/applications/mod_snom/mod_snom.c +++ b/src/mod/applications/mod_snom/mod_snom.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp b/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp index 17e6b1f..4b9c772 100644 --- a/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp +++ b/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.c b/src/mod/applications/mod_spandsp/mod_spandsp.c index ea53850..d9b9ff0 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.h b/src/mod/applications/mod_spandsp/mod_spandsp.h index fdd754b..09e8166 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.h +++ b/src/mod/applications/mod_spandsp/mod_spandsp.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_codecs.c b/src/mod/applications/mod_spandsp/mod_spandsp_codecs.c index 9852ac8..4e7f048 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_codecs.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_codecs.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c index f576b7d..b31f6e1 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 2787824..21c6a68 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_spy/mod_spy.c b/src/mod/applications/mod_spy/mod_spy.c index cb8981d..e6f3bef 100644 --- a/src/mod/applications/mod_spy/mod_spy.c +++ b/src/mod/applications/mod_spy/mod_spy.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_stress/mod_stress.cpp b/src/mod/applications/mod_stress/mod_stress.cpp index 37fe45e..d96739d 100644 --- a/src/mod/applications/mod_stress/mod_stress.cpp +++ b/src/mod/applications/mod_stress/mod_stress.cpp @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_valet_parking/mod_valet_parking.c b/src/mod/applications/mod_valet_parking/mod_valet_parking.c index b6f13a9..4de727c 100644 --- a/src/mod/applications/mod_valet_parking/mod_valet_parking.c +++ b/src/mod/applications/mod_valet_parking/mod_valet_parking.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index e939d7f..69dd217 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/asr_tts/mod_cepstral/mod_cepstral.c b/src/mod/asr_tts/mod_cepstral/mod_cepstral.c index 3cd9557..432a0b7 100644 --- a/src/mod/asr_tts/mod_cepstral/mod_cepstral.c +++ b/src/mod/asr_tts/mod_cepstral/mod_cepstral.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/asr_tts/mod_flite/mod_flite.c b/src/mod/asr_tts/mod_flite/mod_flite.c index c96164a..cd4bbfa 100644 --- a/src/mod/asr_tts/mod_flite/mod_flite.c +++ b/src/mod/asr_tts/mod_flite/mod_flite.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c b/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c index 2740b87..b257278 100644 --- a/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c +++ b/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/codecs/mod_amr/mod_amr.c b/src/mod/codecs/mod_amr/mod_amr.c index e8925c4..0523e64 100644 --- a/src/mod/codecs/mod_amr/mod_amr.c +++ b/src/mod/codecs/mod_amr/mod_amr.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/codecs/mod_amrwb/mod_amrwb.c b/src/mod/codecs/mod_amrwb/mod_amrwb.c index 73b1cec..d71953b 100644 --- a/src/mod/codecs/mod_amrwb/mod_amrwb.c +++ b/src/mod/codecs/mod_amrwb/mod_amrwb.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * @@ -17,7 +17,7 @@ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * * The Initial Developer of the Original Code is - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. * diff --git a/src/mod/codecs/mod_bv/mod_bv.c b/src/mod/codecs/mod_bv/mod_bv.c index 54158c2..d856009 100644 --- a/src/mod/codecs/mod_bv/mod_bv.c +++ b/src/mod/codecs/mod_bv/mod_bv.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/codecs/mod_celt/mod_celt.c b/src/mod/codecs/mod_celt/mod_celt.c index 0c66469..d65e095 100644 --- a/src/mod/codecs/mod_celt/mod_celt.c +++ b/src/mod/codecs/mod_celt/mod_celt.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/codecs/mod_codec2/mod_codec2.c b/src/mod/codecs/mod_codec2/mod_codec2.c index e7aa645..866a39c 100644 --- a/src/mod/codecs/mod_codec2/mod_codec2.c +++ b/src/mod/codecs/mod_codec2/mod_codec2.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c b/src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c index 55afff6..0553607 100644 --- a/src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c +++ b/src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/codecs/mod_g723_1/mod_g723_1.c b/src/mod/codecs/mod_g723_1/mod_g723_1.c index ac74746..cd5defb 100644 --- a/src/mod/codecs/mod_g723_1/mod_g723_1.c +++ b/src/mod/codecs/mod_g723_1/mod_g723_1.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/codecs/mod_g729/mod_g729.c b/src/mod/codecs/mod_g729/mod_g729.c index 468aac2..0b1d2ad 100644 --- a/src/mod/codecs/mod_g729/mod_g729.c +++ b/src/mod/codecs/mod_g729/mod_g729.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/codecs/mod_h26x/mod_h26x.c b/src/mod/codecs/mod_h26x/mod_h26x.c index 40952ae..7f9ec54 100644 --- a/src/mod/codecs/mod_h26x/mod_h26x.c +++ b/src/mod/codecs/mod_h26x/mod_h26x.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/codecs/mod_ilbc/mod_ilbc.c b/src/mod/codecs/mod_ilbc/mod_ilbc.c index 8529837..4d52ba9 100644 --- a/src/mod/codecs/mod_ilbc/mod_ilbc.c +++ b/src/mod/codecs/mod_ilbc/mod_ilbc.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/codecs/mod_mp4v/mod_mp4v.c b/src/mod/codecs/mod_mp4v/mod_mp4v.c index 5a8dc71..d4e0a1e 100644 --- a/src/mod/codecs/mod_mp4v/mod_mp4v.c +++ b/src/mod/codecs/mod_mp4v/mod_mp4v.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/codecs/mod_siren/mod_siren.c b/src/mod/codecs/mod_siren/mod_siren.c index 4646ffc..224a825 100644 --- a/src/mod/codecs/mod_siren/mod_siren.c +++ b/src/mod/codecs/mod_siren/mod_siren.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/codecs/mod_skel_codec/mod_skel_codec.c b/src/mod/codecs/mod_skel_codec/mod_skel_codec.c index d1a4b37..cab5c7e 100644 --- a/src/mod/codecs/mod_skel_codec/mod_skel_codec.c +++ b/src/mod/codecs/mod_skel_codec/mod_skel_codec.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/codecs/mod_speex/mod_speex.c b/src/mod/codecs/mod_speex/mod_speex.c index a951b12..6e21939 100644 --- a/src/mod/codecs/mod_speex/mod_speex.c +++ b/src/mod/codecs/mod_speex/mod_speex.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/codecs/mod_theora/mod_theora.c b/src/mod/codecs/mod_theora/mod_theora.c index 41871bf..f160143 100644 --- a/src/mod/codecs/mod_theora/mod_theora.c +++ b/src/mod/codecs/mod_theora/mod_theora.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.c b/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.c index e447d72..68bec65 100644 --- a/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.c +++ b/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c b/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c index 9ccaaad..5869d14 100644 --- a/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c +++ b/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c b/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c index ec22222..d28804e 100644 --- a/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c +++ b/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c b/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c index 4fc240d..929372b 100644 --- a/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c +++ b/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/directories/mod_ldap/mod_ldap.c b/src/mod/directories/mod_ldap/mod_ldap.c index b875c00..1bc9b9d 100644 --- a/src/mod/directories/mod_ldap/mod_ldap.c +++ b/src/mod/directories/mod_ldap/mod_ldap.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/endpoints/mod_alsa/mod_alsa.c b/src/mod/endpoints/mod_alsa/mod_alsa.c index 065386b..40c1362 100644 --- a/src/mod/endpoints/mod_alsa/mod_alsa.c +++ b/src/mod/endpoints/mod_alsa/mod_alsa.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index 75329a0..66f62b2 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/endpoints/mod_h323/mod_h323.cpp b/src/mod/endpoints/mod_h323/mod_h323.cpp index a31f9a8..44295f6 100644 --- a/src/mod/endpoints/mod_h323/mod_h323.cpp +++ b/src/mod/endpoints/mod_h323/mod_h323.cpp @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/endpoints/mod_h323/mod_h323.h b/src/mod/endpoints/mod_h323/mod_h323.h index 8127206..5477f9a 100644 --- a/src/mod/endpoints/mod_h323/mod_h323.h +++ b/src/mod/endpoints/mod_h323/mod_h323.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/endpoints/mod_loopback/mod_loopback.c b/src/mod/endpoints/mod_loopback/mod_loopback.c index 7c69ff2..f875f6b 100644 --- a/src/mod/endpoints/mod_loopback/mod_loopback.c +++ b/src/mod/endpoints/mod_loopback/mod_loopback.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/endpoints/mod_portaudio/mod_portaudio.c b/src/mod/endpoints/mod_portaudio/mod_portaudio.c index a4a380d..8978b85 100644 --- a/src/mod/endpoints/mod_portaudio/mod_portaudio.c +++ b/src/mod/endpoints/mod_portaudio/mod_portaudio.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/endpoints/mod_reference/mod_reference.c b/src/mod/endpoints/mod_reference/mod_reference.c index 385e293..f895e81 100644 --- a/src/mod/endpoints/mod_reference/mod_reference.c +++ b/src/mod/endpoints/mod_reference/mod_reference.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index ca1ddb1..f7ce6fa 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 8c6b1e0..e1b1ff7 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 9e412bb..61ede0c 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 4779ef1..f4ec094 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 04d5b01..94fef61 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 1589eeb..fddf1b7 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/endpoints/mod_sofia/sofia_sla.c b/src/mod/endpoints/mod_sofia/sofia_sla.c index ab8a822..05eba01 100644 --- a/src/mod/endpoints/mod_sofia/sofia_sla.c +++ b/src/mod/endpoints/mod_sofia/sofia_sla.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c b/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c index c1b4b77..c139c05 100644 --- a/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c +++ b/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c index 9cc1d8c..5227161 100644 --- a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c +++ b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * @@ -17,7 +17,7 @@ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * * The Initial Developer of the Original Code is - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. * diff --git a/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c b/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c index 1b91f12..9a286d4 100644 --- a/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c +++ b/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/event_handlers/mod_erlang_event/ei_helpers.c b/src/mod/event_handlers/mod_erlang_event/ei_helpers.c index aca2497..a99b520 100644 --- a/src/mod/event_handlers/mod_erlang_event/ei_helpers.c +++ b/src/mod/event_handlers/mod_erlang_event/ei_helpers.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/event_handlers/mod_erlang_event/handle_msg.c b/src/mod/event_handlers/mod_erlang_event/handle_msg.c index bb37cdd..9ae1527 100644 --- a/src/mod/event_handlers/mod_erlang_event/handle_msg.c +++ b/src/mod/event_handlers/mod_erlang_event/handle_msg.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index e375515..8d3c594 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h index eb36612..dacfbd6 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c index cb31aa2..5c4d11e 100644 --- a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c +++ b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index 9d575db..0ebf6d5 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/event_handlers/mod_event_test/mod_event_test.c b/src/mod/event_handlers/mod_event_test/mod_event_test.c index ba5a2aa..d960b08 100644 --- a/src/mod/event_handlers/mod_event_test/mod_event_test.c +++ b/src/mod/event_handlers/mod_event_test/mod_event_test.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c b/src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c index 92a5d67..c97ce1f 100644 --- a/src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c +++ b/src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c b/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c index 7115965..440cbf9 100644 --- a/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c +++ b/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/formats/mod_file_string/mod_file_string.c b/src/mod/formats/mod_file_string/mod_file_string.c index a222f7b..ca86cbd 100644 --- a/src/mod/formats/mod_file_string/mod_file_string.c +++ b/src/mod/formats/mod_file_string/mod_file_string.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/formats/mod_local_stream/mod_local_stream.c b/src/mod/formats/mod_local_stream/mod_local_stream.c index e7c130c..ea94bd1 100644 --- a/src/mod/formats/mod_local_stream/mod_local_stream.c +++ b/src/mod/formats/mod_local_stream/mod_local_stream.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/formats/mod_native_file/mod_native_file.c b/src/mod/formats/mod_native_file/mod_native_file.c index 272fc5d..d28b8dc 100644 --- a/src/mod/formats/mod_native_file/mod_native_file.c +++ b/src/mod/formats/mod_native_file/mod_native_file.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/formats/mod_portaudio_stream/mod_portaudio_stream.c b/src/mod/formats/mod_portaudio_stream/mod_portaudio_stream.c index ee32071..1ad1645 100644 --- a/src/mod/formats/mod_portaudio_stream/mod_portaudio_stream.c +++ b/src/mod/formats/mod_portaudio_stream/mod_portaudio_stream.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/formats/mod_shell_stream/mod_shell_stream.c b/src/mod/formats/mod_shell_stream/mod_shell_stream.c index 6e70ed4..57d4029 100644 --- a/src/mod/formats/mod_shell_stream/mod_shell_stream.c +++ b/src/mod/formats/mod_shell_stream/mod_shell_stream.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/formats/mod_shout/mod_shout.c b/src/mod/formats/mod_shout/mod_shout.c index 97f20b8..a4965c4 100644 --- a/src/mod/formats/mod_shout/mod_shout.c +++ b/src/mod/formats/mod_shout/mod_shout.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/formats/mod_sndfile/mod_sndfile.c b/src/mod/formats/mod_sndfile/mod_sndfile.c index 2b661ed..d2c53f0 100644 --- a/src/mod/formats/mod_sndfile/mod_sndfile.c +++ b/src/mod/formats/mod_sndfile/mod_sndfile.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/formats/mod_tone_stream/mod_tone_stream.c b/src/mod/formats/mod_tone_stream/mod_tone_stream.c index 6b04235..f02dc31 100644 --- a/src/mod/formats/mod_tone_stream/mod_tone_stream.c +++ b/src/mod/formats/mod_tone_stream/mod_tone_stream.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/languages/mod_lua/mod_lua.cpp b/src/mod/languages/mod_lua/mod_lua.cpp index b5a4999..56e49d5 100644 --- a/src/mod/languages/mod_lua/mod_lua.cpp +++ b/src/mod/languages/mod_lua/mod_lua.cpp @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/languages/mod_perl/mod_perl.c b/src/mod/languages/mod_perl/mod_perl.c index 716a6e3..55bc44f 100644 --- a/src/mod/languages/mod_perl/mod_perl.c +++ b/src/mod/languages/mod_perl/mod_perl.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/languages/mod_python/mod_python.c b/src/mod/languages/mod_python/mod_python.c index 7e15a52..bcaebd8 100644 --- a/src/mod/languages/mod_python/mod_python.c +++ b/src/mod/languages/mod_python/mod_python.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c index 16679d7..9eb2636 100644 --- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c +++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h index 1fbe066..aeb0245 100644 --- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h +++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey_core_db.c b/src/mod/languages/mod_spidermonkey/mod_spidermonkey_core_db.c index 2533314..e7a68a6 100644 --- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey_core_db.c +++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey_core_db.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey_curl.c b/src/mod/languages/mod_spidermonkey/mod_spidermonkey_curl.c index fe489af..5fb7b7f 100644 --- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey_curl.c +++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey_curl.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey_odbc.c b/src/mod/languages/mod_spidermonkey/mod_spidermonkey_odbc.c index c205e6e..e60d8ce 100644 --- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey_odbc.c +++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey_odbc.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey_skel.c b/src/mod/languages/mod_spidermonkey/mod_spidermonkey_skel.c index 9717ff8..7bc73d0 100644 --- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey_skel.c +++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey_skel.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey_teletone.c b/src/mod/languages/mod_spidermonkey/mod_spidermonkey_teletone.c index d68e87c..4f142db 100644 --- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey_teletone.c +++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey_teletone.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/languages/mod_yaml/mod_yaml.c b/src/mod/languages/mod_yaml/mod_yaml.c index 1571570..7142997 100644 --- a/src/mod/languages/mod_yaml/mod_yaml.c +++ b/src/mod/languages/mod_yaml/mod_yaml.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/loggers/mod_console/mod_console.c b/src/mod/loggers/mod_console/mod_console.c index 7a9c471..0695670 100644 --- a/src/mod/loggers/mod_console/mod_console.c +++ b/src/mod/loggers/mod_console/mod_console.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/say/mod_say_ru/mod_say_ru.c b/src/mod/say/mod_say_ru/mod_say_ru.c index 9b9fcda..21e3017 100644 --- a/src/mod/say/mod_say_ru/mod_say_ru.c +++ b/src/mod/say/mod_say_ru/mod_say_ru.c @@ -31,13 +31,13 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * The Initial Developer of the Original Code is - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. * * Contributor(s): * - * Anthony Minessale II <anthmct@yahoo.com> + * Anthony Minessale II <anthm@freeswitch.org> * Michael B. Murdock <mike@mmurdock.org> * Boris Buklov (BBV) <buklov@mail.ru> * diff --git a/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c b/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c index 84643dc..a439ab8 100644 --- a/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c +++ b/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c b/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c index e0cda42..9bf837e 100644 --- a/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c +++ b/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c b/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c index b374665..e58377e 100644 --- a/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c +++ b/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c index 2e9a1a3..be06b14 100644 --- a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c +++ b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch.c b/src/switch.c index b04243d..c922d27 100644 --- a/src/switch.c +++ b/src/switch.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_apr.c b/src/switch_apr.c index c0e51f9..4c99662 100644 --- a/src/switch_apr.c +++ b/src/switch_apr.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_buffer.c b/src/switch_buffer.c index 09d3219..39d7bf0 100644 --- a/src/switch_buffer.c +++ b/src/switch_buffer.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_caller.c b/src/switch_caller.c index 5d5d1ab..d0d242f 100644 --- a/src/switch_caller.c +++ b/src/switch_caller.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_channel.c b/src/switch_channel.c index aa7f669..e5d30ee 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_config.c b/src/switch_config.c index 5de08ba..9120940 100644 --- a/src/switch_config.c +++ b/src/switch_config.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_console.c b/src/switch_console.c index fdfb09b..41bbb91 100644 --- a/src/switch_console.c +++ b/src/switch_console.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_core.c b/src/switch_core.c index 0c1263a..b531111 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_core_asr.c b/src/switch_core_asr.c index fa4446e..a040366 100644 --- a/src/switch_core_asr.c +++ b/src/switch_core_asr.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_core_codec.c b/src/switch_core_codec.c index d6b6270..96f8d57 100644 --- a/src/switch_core_codec.c +++ b/src/switch_core_codec.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_core_db.c b/src/switch_core_db.c index 9f557cf..b3cd2ce 100644 --- a/src/switch_core_db.c +++ b/src/switch_core_db.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_core_directory.c b/src/switch_core_directory.c index 7d33008..5ff4e05 100644 --- a/src/switch_core_directory.c +++ b/src/switch_core_directory.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_core_event_hook.c b/src/switch_core_event_hook.c index 102ea20..9cfe1ac 100644 --- a/src/switch_core_event_hook.c +++ b/src/switch_core_event_hook.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_core_file.c b/src/switch_core_file.c index 76b6b29..c00756f 100644 --- a/src/switch_core_file.c +++ b/src/switch_core_file.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_core_hash.c b/src/switch_core_hash.c index 2b62258..8d04e9c 100644 --- a/src/switch_core_hash.c +++ b/src/switch_core_hash.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 49956b3..3208654 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_core_media_bug.c b/src/switch_core_media_bug.c index 21db3a9..1e7b260 100644 --- a/src/switch_core_media_bug.c +++ b/src/switch_core_media_bug.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_core_memory.c b/src/switch_core_memory.c index a63ce0d..dd87f8f 100644 --- a/src/switch_core_memory.c +++ b/src/switch_core_memory.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_core_port_allocator.c b/src/switch_core_port_allocator.c index 49a44b9..580e45b 100644 --- a/src/switch_core_port_allocator.c +++ b/src/switch_core_port_allocator.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_core_rwlock.c b/src/switch_core_rwlock.c index 57168d9..09c50cb 100644 --- a/src/switch_core_rwlock.c +++ b/src/switch_core_rwlock.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 252b5e2..9319abc 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_core_speech.c b/src/switch_core_speech.c index 81ce5d3..12b6053 100644 --- a/src/switch_core_speech.c +++ b/src/switch_core_speech.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index b561ebe..c32b406 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_core_state_machine.c b/src/switch_core_state_machine.c index ccd6dac..276acb8 100644 --- a/src/switch_core_state_machine.c +++ b/src/switch_core_state_machine.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_core_timer.c b/src/switch_core_timer.c index 8d563b0..1798442 100644 --- a/src/switch_core_timer.c +++ b/src/switch_core_timer.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_cpp.cpp b/src/switch_cpp.cpp index 88af242..bbcd05d 100644 --- a/src/switch_cpp.cpp +++ b/src/switch_cpp.cpp @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_event.c b/src/switch_event.c index dce42f8..3941fab 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 82c6ff4..5019e06 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 5d35524..f476c8f 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index aa5ddb9..ee7c127 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_ivr_menu.c b/src/switch_ivr_menu.c index 255ab61..c70db23 100644 --- a/src/switch_ivr_menu.c +++ b/src/switch_ivr_menu.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 28af589..f31d0f5 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index b983d5e..f254b67 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_ivr_say.c b/src/switch_ivr_say.c index 23be59e..9ba60fb 100644 --- a/src/switch_ivr_say.c +++ b/src/switch_ivr_say.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index c603e27..03858ac 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_log.c b/src/switch_log.c index c7307fd..d195b6e 100644 --- a/src/switch_log.c +++ b/src/switch_log.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_odbc.c b/src/switch_odbc.c index 5a88ba7..932d72e 100644 --- a/src/switch_odbc.c +++ b/src/switch_odbc.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_pcm.c b/src/switch_pcm.c index 8f8b06c..8fbfefe 100644 --- a/src/switch_pcm.c +++ b/src/switch_pcm.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_regex.c b/src/switch_regex.c index 38c527c..787ab0d 100644 --- a/src/switch_regex.c +++ b/src/switch_regex.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_resample.c b/src/switch_resample.c index 65ebe3c..10c633c 100644 --- a/src/switch_resample.c +++ b/src/switch_resample.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 5c4aa30..73c2f45 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_scheduler.c b/src/switch_scheduler.c index 93894b5..3268d27 100644 --- a/src/switch_scheduler.c +++ b/src/switch_scheduler.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_stun.c b/src/switch_stun.c index 89e42e0..0045feb 100644 --- a/src/switch_stun.c +++ b/src/switch_stun.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_swig.c b/src/switch_swig.c index d222b4e..c041e1b 100644 --- a/src/switch_swig.c +++ b/src/switch_swig.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_time.c b/src/switch_time.c index ad721be..dc428f1 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_utils.c b/src/switch_utils.c index 7331a97..3622442 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_xml.c b/src/switch_xml.c index 05cfe9f..fe6a199 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/switch_xml_config.c b/src/switch_xml_config.c index 288ff2d..b6b37bd 100644 --- a/src/switch_xml_config.c +++ b/src/switch_xml_config.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * diff --git a/src/tone2wav.c b/src/tone2wav.c index 8d4978a..403f45a 100644 --- a/src/tone2wav.c +++ b/src/tone2wav.c @@ -1,6 +1,6 @@ /* * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * Copyright (C) 2005-2011, Anthony Minessale II <anthm@freeswitch.org> * * Version: MPL 1.1 * commit 1aa6bc6eec5be2cc16ef5b130a5cc213bff634be Author: Jeff Lenk <jeff@jefflenk.com> Date: Wed Jan 5 09:56:44 2011 -0600 fix assert with standard code analysis macro diff --git a/libs/esl/src/esl_buffer.c b/libs/esl/src/esl_buffer.c index 7ba3d52..173c9cb 100644 --- a/libs/esl/src/esl_buffer.c +++ b/libs/esl/src/esl_buffer.c @@ -82,10 +82,7 @@ ESL_DECLARE(esl_status_t) esl_buffer_create(esl_buffer_t **buffer, esl_size_t bl ESL_DECLARE(esl_size_t) esl_buffer_len(esl_buffer_t *buffer) { - assert(buffer != NULL); - if (!buffer){ - return (esl_size_t)NULL; - } + esl_assert(buffer != NULL); return buffer->datalen; @@ -94,10 +91,7 @@ ESL_DECLARE(esl_size_t) esl_buffer_len(esl_buffer_t *buffer) ESL_DECLARE(esl_size_t) esl_buffer_freespace(esl_buffer_t *buffer) { - assert(buffer != NULL); - if (!buffer) { - return (esl_size_t)NULL; - } + esl_assert(buffer != NULL); if (buffer->max_len) { return (esl_size_t) (buffer->max_len - buffer->used); @@ -108,10 +102,7 @@ ESL_DECLARE(esl_size_t) esl_buffer_freespace(esl_buffer_t *buffer) ESL_DECLARE(esl_size_t) esl_buffer_inuse(esl_buffer_t *buffer) { - assert(buffer != NULL); - if (!buffer) { - return (esl_size_t)NULL; - } + esl_assert(buffer != NULL); return buffer->used; } @@ -120,10 +111,7 @@ ESL_DECLARE(esl_size_t) esl_buffer_seek(esl_buffer_t *buffer, esl_size_t datalen { esl_size_t reading = 0; - assert(buffer != NULL); - if (!buffer) { - return (esl_size_t)NULL; - } + esl_assert(buffer != NULL); if (buffer->used < 1) { buffer->used = 0; @@ -144,10 +132,7 @@ ESL_DECLARE(esl_size_t) esl_buffer_toss(esl_buffer_t *buffer, esl_size_t datalen { esl_size_t reading = 0; - assert(buffer != NULL); - if (!buffer) { - return (esl_size_t)NULL; - } + esl_assert(buffer != NULL); if (buffer->used < 1) { buffer->used = 0; @@ -188,11 +173,8 @@ ESL_DECLARE(esl_size_t) esl_buffer_read(esl_buffer_t *buffer, void *data, esl_si { esl_size_t reading = 0; - assert(buffer != NULL); - if (!buffer) { - return (esl_size_t)NULL; - } - assert(data != NULL); + esl_assert(buffer != NULL); + esl_assert(data != NULL); if (buffer->used < 1) { @@ -218,7 +200,7 @@ ESL_DECLARE(esl_size_t) esl_buffer_packet_count(esl_buffer_t *buffer) char *pe, *p, *e, *head = (char *) buffer->head; esl_size_t x = 0; - assert(buffer != NULL); + esl_assert(buffer != NULL); e = (head + buffer->used); @@ -241,8 +223,8 @@ ESL_DECLARE(esl_size_t) esl_buffer_read_packet(esl_buffer_t *buffer, void *data, char *pe, *p, *e, *head = (char *) buffer->head; esl_size_t datalen = 0; - assert(buffer != NULL); - assert(data != NULL); + esl_assert(buffer != NULL); + esl_assert(data != NULL); e = (head + buffer->used); @@ -268,12 +250,9 @@ ESL_DECLARE(esl_size_t) esl_buffer_write(esl_buffer_t *buffer, const void *data, { esl_size_t freespace, actual_freespace; - assert(buffer != NULL); - if (!buffer) { - return (esl_size_t)NULL; - } - assert(data != NULL); - assert(buffer->data != NULL); + esl_assert(buffer != NULL); + esl_assert(data != NULL); + esl_assert(buffer->data != NULL); if (!datalen) { return buffer->used; @@ -332,11 +311,8 @@ ESL_DECLARE(esl_size_t) esl_buffer_write(esl_buffer_t *buffer, const void *data, ESL_DECLARE(void) esl_buffer_zero(esl_buffer_t *buffer) { - assert(buffer != NULL); - if (!buffer) { - return; - } - assert(buffer->data != NULL); + esl_assert(buffer != NULL); + esl_assert(buffer->data != NULL); buffer->used = 0; buffer->actually_used = 0; commit 23d9a237dcf72b8e65376ae8f547dc1ad5939719 Author: Michael Jerris <mike@jerris.com> Date: Wed Jan 5 10:46:16 2011 -0500 don't seg in edge case error conditions diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index e2cdfad..140850b 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -973,6 +973,8 @@ static switch_status_t messagehook (switch_core_session_t *session, switch_core_ consumer_channel = switch_core_session_get_channel(consumer_session); outbound_id = switch_channel_get_variable(consumer_channel, "fifo_outbound_uuid"); + if (!outbound_id) return SWITCH_STATUS_SUCCESS; + switch (msg->message_id) { case SWITCH_MESSAGE_INDICATE_BRIDGE: case SWITCH_MESSAGE_INDICATE_UNBRIDGE: @@ -1028,7 +1030,6 @@ static switch_status_t messagehook (switch_core_session_t *session, switch_core_ switch_channel_get_variable(caller_channel, "fifo_import_prefix")); } - ced_name = switch_channel_get_variable(consumer_channel, "callee_id_name"); ced_number = switch_channel_get_variable(consumer_channel, "callee_id_number"); commit 35776314d0a073775f5dbba1e81362d3e012d507 Author: Moises Silva <moy@sangoma.com> Date: Wed Jan 5 10:39:25 2011 -0500 freetdm: Use proper screen and presentation definitions in mod_freetdm diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 7bbdef6..f12ed62 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1255,11 +1255,11 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi } if (switch_test_flag(outbound_profile, SWITCH_CPF_SCREEN)) { - caller_data.screen = 1; + caller_data.screen = FTDM_SCREENING_VERIFIED_PASSED; } if (switch_test_flag(outbound_profile, SWITCH_CPF_HIDE_NUMBER)) { - caller_data.pres = 1; + caller_data.pres = FTDM_PRES_RESTRICTED; } if ((var = channel_get_variable(session, var_event, "freetdm_bearer_capability"))) { commit 342678698c137f2df295efee88f4b0a0f91b734d Author: Michael Jerris <mike@jerris.com> Date: Wed Jan 5 10:17:31 2011 -0500 set tracking data before enabling hooks diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 3a6ef81..e2cdfad 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -2101,17 +2101,18 @@ SWITCH_STANDARD_APP(fifo_track_call_function) return; } - switch_core_event_hook_add_receive_message(session, messagehook); - switch_core_event_hook_add_state_run(session, hanguphook); - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s tracking call on uuid %s!\n", switch_channel_get_name(channel), data); + switch_channel_set_variable(channel, "fifo_outbound_uuid", data); + switch_channel_set_variable(channel, "fifo_track_call", "true"); add_bridge_call(data); switch_channel_set_app_flag_key(FIFO_APP_KEY, channel, FIFO_APP_TRACKING); - switch_channel_set_variable(channel, "fifo_outbound_uuid", data); - switch_channel_set_variable(channel, "fifo_track_call", "true"); + switch_core_event_hook_add_receive_message(session, messagehook); + switch_core_event_hook_add_state_run(session, hanguphook); + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s tracking call on uuid %s!\n", switch_channel_get_name(channel), data); + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { col1 = "manual_calls_in_count"; commit 9ee13b723e0ec150e03dae569c71f370b4491405 Author: Michael Jerris <mike@jerris.com> Date: Wed Jan 5 09:54:27 2011 -0500 don't seg in edge case error conditions diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index e9d7cfb..3a6ef81 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -582,6 +582,8 @@ static int check_caller_outbound_call(const char *key) { int x = 0; + if (!key) return x; + switch_mutex_lock(globals.caller_orig_mutex); x = !!switch_core_hash_find(globals.caller_orig_hash, key); switch_mutex_unlock(globals.caller_orig_mutex); @@ -592,6 +594,8 @@ static int check_caller_outbound_call(const char *key) static void add_caller_outbound_call(const char *key, switch_call_cause_t *cancel_cause) { + if (!key) return; + switch_mutex_lock(globals.caller_orig_mutex); switch_core_hash_insert(globals.caller_orig_hash, key, cancel_cause); switch_mutex_unlock(globals.caller_orig_mutex); @@ -599,6 +603,8 @@ static void add_caller_outbound_call(const char *key, switch_call_cause_t *cance static void del_caller_outbound_call(const char *key) { + if (!key) return; + switch_mutex_lock(globals.caller_orig_mutex); switch_core_hash_delete(globals.caller_orig_hash, key); switch_mutex_unlock(globals.caller_orig_mutex); @@ -608,6 +614,8 @@ static void cancel_caller_outbound_call(const char *key, switch_call_cause_t cau { switch_call_cause_t *cancel_cause = NULL; + if (!key) return; + switch_mutex_lock(globals.caller_orig_mutex); if ((cancel_cause = (switch_call_cause_t *) switch_core_hash_find(globals.caller_orig_hash, key))) { *cancel_cause = cause; @@ -624,6 +632,8 @@ static int check_bridge_call(const char *key) { int x = 0; + if (!key) return x; + switch_mutex_lock(globals.bridge_mutex); x = !!switch_core_hash_find(globals.bridge_hash, key); switch_mutex_unlock(globals.bridge_mutex); @@ -634,6 +644,8 @@ static int check_bridge_call(const char *key) static void add_bridge_call(const char *key) { + if (!key) return; + switch_mutex_lock(globals.bridge_mutex); switch_core_hash_insert(globals.bridge_hash, key, (void *)&marker); switch_mutex_unlock(globals.bridge_mutex); @@ -651,6 +663,8 @@ static int check_consumer_outbound_call(const char *key) { int x = 0; + if (!key) return x; + switch_mutex_lock(globals.consumer_orig_mutex); x = !!switch_core_hash_find(globals.consumer_orig_hash, key); switch_mutex_unlock(globals.consumer_orig_mutex); @@ -660,6 +674,8 @@ static int check_consumer_outbound_call(const char *key) static void add_consumer_outbound_call(const char *key, switch_call_cause_t *cancel_cause) { + if (!key) return; + switch_mutex_lock(globals.consumer_orig_mutex); switch_core_hash_insert(globals.consumer_orig_hash, key, cancel_cause); switch_mutex_unlock(globals.consumer_orig_mutex); @@ -667,6 +683,8 @@ static void add_consumer_outbound_call(const char *key, switch_call_cause_t *can static void del_consumer_outbound_call(const char *key) { + if (!key) return; + switch_mutex_lock(globals.consumer_orig_mutex); switch_core_hash_delete(globals.consumer_orig_hash, key); switch_mutex_unlock(globals.consumer_orig_mutex); @@ -676,6 +694,8 @@ static void cancel_consumer_outbound_call(const char *key, switch_call_cause_t c { switch_call_cause_t *cancel_cause = NULL; + if (!key) return; + switch_mutex_lock(globals.consumer_orig_mutex); if ((cancel_cause = (switch_call_cause_t *) switch_core_hash_find(globals.consumer_orig_hash, key))) { *cancel_cause = cause; @@ -1949,6 +1969,8 @@ static uint32_t fifo_add_outbound(const char *node_name, const char *url, uint32 priority = MAX_PRI - 1; } + if (!node_name) return 0; + switch_mutex_lock(globals.mutex); if (!(node = switch_core_hash_find(globals.fifo_hash, node_name))) { @@ -4166,6 +4188,8 @@ static void fifo_member_add(char *fifo_name, char *originate_string, int simo_co char *sql, *name_dup, *p; fifo_node_t *node = NULL; + if (!fifo_name) return; + if (switch_stristr("fifo_outbound_uuid=", originate_string)) { extract_fifo_outbound_uuid(originate_string, digest, sizeof(digest)); } else { @@ -4213,6 +4237,9 @@ static void fifo_member_del(char *fifo_name, char *originate_string) callback_t cbt = { 0 }; fifo_node_t *node = NULL; + if (!fifo_name) return; + + if (switch_stristr("fifo_outbound_uuid=", originate_string)) { extract_fifo_outbound_uuid(originate_string, digest, sizeof(digest)); } else { commit 5254df0466fd8213905b52f7f6a0ab6c2c8cc862 Author: Jeff Lenk <jeff@jefflenk.com> Date: Tue Jan 4 22:57:49 2011 -0600 FS-2957 esl lib on windows fails to build diff --git a/libs/esl/src/esl_buffer.c b/libs/esl/src/esl_buffer.c index 8032169..7ba3d52 100644 --- a/libs/esl/src/esl_buffer.c +++ b/libs/esl/src/esl_buffer.c @@ -83,6 +83,9 @@ ESL_DECLARE(esl_size_t) esl_buffer_len(esl_buffer_t *buffer) { assert(buffer != NULL); + if (!buffer){ + return (esl_size_t)NULL; + } return buffer->datalen; @@ -92,7 +95,9 @@ ESL_DECLARE(esl_size_t) esl_buffer_len(esl_buffer_t *buffer) ESL_DECLARE(esl_size_t) esl_buffer_freespace(esl_buffer_t *buffer) { assert(buffer != NULL); - + if (!buffer) { + return (esl_size_t)NULL; + } if (buffer->max_len) { return (esl_size_t) (buffer->max_len - buffer->used); @@ -104,6 +109,9 @@ ESL_DECLARE(esl_size_t) esl_buffer_freespace(esl_buffer_t *buffer) ESL_DECLARE(esl_size_t) esl_buffer_inuse(esl_buffer_t *buffer) { assert(buffer != NULL); + if (!buffer) { + return (esl_size_t)NULL; + } return buffer->used; } @@ -113,6 +121,9 @@ ESL_DECLARE(esl_size_t) esl_buffer_seek(esl_buffer_t *buffer, esl_size_t datalen esl_size_t reading = 0; assert(buffer != NULL); + if (!buffer) { + return (esl_size_t)NULL; + } if (buffer->used < 1) { buffer->used = 0; @@ -134,6 +145,9 @@ ESL_DECLARE(esl_size_t) esl_buffer_toss(esl_buffer_t *buffer, esl_size_t datalen esl_size_t reading = 0; assert(buffer != NULL); + if (!buffer) { + return (esl_size_t)NULL; + } if (buffer->used < 1) { buffer->used = 0; @@ -175,6 +189,9 @@ ESL_DECLARE(esl_size_t) esl_buffer_read(esl_buffer_t *buffer, void *data, esl_si esl_size_t reading = 0; assert(buffer != NULL); + if (!buffer) { + return (esl_size_t)NULL; + } assert(data != NULL); @@ -252,6 +269,9 @@ ESL_DECLARE(esl_size_t) esl_buffer_write(esl_buffer_t *buffer, const void *data, esl_size_t freespace, actual_freespace; assert(buffer != NULL); + if (!buffer) { + return (esl_size_t)NULL; + } assert(data != NULL); assert(buffer->data != NULL); @@ -313,6 +333,9 @@ ESL_DECLARE(esl_size_t) esl_buffer_write(esl_buffer_t *buffer, const void *data, ESL_DECLARE(void) esl_buffer_zero(esl_buffer_t *buffer) { assert(buffer != NULL); + if (!buffer) { + return; + } assert(buffer->data != NULL); buffer->used = 0; commit a90b4fea347b4705a40a6ff3fefc0014fee0b33f Author: Michal Bielicki <michal.bielicki@seventhsignal.de> Date: Tue Jan 4 23:51:47 2011 +0100 m3ua.conf is gone so remove it from spefile diff --git a/freeswitch.spec b/freeswitch.spec index 05401b8..66db65c 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -613,7 +613,6 @@ fi %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/*.ttml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/*.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/extensions.conf -%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/m3ua.conf %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/mime.types %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/acl.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/alsa.conf.xml commit 7c3fd20104a5ec2a7bedfc2893c33259f894b68c Merge: a390e04 b9a446c Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Tue Jan 4 20:10:41 2011 -0200 Merge branch 'master' of git@git.sangoma.com:smg_freeswitch commit a390e046b7d9e67e2fac8adcfd6c47c1011c01bb Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Tue Jan 4 20:07:22 2011 -0200 freetdm: ftmod_r2 - now locking the channel on main loop start and finish replaced calls to ftdm_mutex_lock() with ftdm_channel_lock() diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index f1ef61c..79850a3 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -1862,10 +1862,12 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) } for (i = 1, citer = chaniter; citer; citer = ftdm_iterator_next(citer), i++) { ftdmchan = ftdm_iterator_current(citer); + ftdm_channel_lock(ftdmchan); r2chan = R2CALL(ftdmchan)->r2chan; openr2_chan_set_span_id(r2chan, span->span_id); openr2_chan_set_idle(r2chan); openr2_chan_process_cas_signaling(r2chan); + ftdm_channel_unlock(ftdmchan); ftdm_channel_command(ftdmchan, FTDM_COMMAND_SET_TX_QUEUE_SIZE, &txqueue_size); } @@ -1947,7 +1949,7 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) for ( ; citer; citer = ftdm_iterator_next(citer)) { ftdmchan = ftdm_iterator_current(citer); - ftdm_mutex_lock(ftdmchan->mutex); + ftdm_channel_lock(ftdmchan); call = R2CALL(ftdmchan); @@ -1969,7 +1971,7 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) ftdm_set_flag(ftdmchan, FTDM_CHANNEL_TX_DISABLED); } - ftdm_mutex_unlock(ftdmchan->mutex); + ftdm_channel_unlock(ftdmchan); } } @@ -1977,8 +1979,10 @@ done: citer = ftdm_span_get_chan_iterator(span, chaniter); for ( ; citer; citer = ftdm_iterator_next(citer)) { ftdmchan = ftdm_iterator_current(citer); + ftdm_channel_lock(ftdmchan); r2chan = R2CALL(ftdmchan)->r2chan; openr2_chan_set_blocked(r2chan); + ftdm_channel_unlock(ftdmchan); } ftdm_iterator_free(chaniter); commit b9a446c54ed6e16c52a71f89ce3029c9e906cdb0 Merge: 47c1b6d e6070fe Author: Moises Silva <moy@sangoma.com> Date: Tue Jan 4 16:17:15 2011 -0500 Merge remote branch 'fsorig/master' commit 47c1b6d96ab853341efea272efe0ae5a60e97634 Author: Moises Silva <moy@sangoma.com> Date: Tue Jan 4 14:23:25 2011 -0500 freetdm: add validation to ftdm_span_start and ftdm_span_stop diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index efd5254..21354c4 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -733,11 +733,28 @@ static void ftdm_span_add(ftdm_span_t *span) FT_DECLARE(ftdm_status_t) ftdm_span_stop(ftdm_span_t *span) { - ftdm_status_t status = FTDM_FAIL; - if (span->stop) { - status = span->stop(span); - span->stop = NULL; + ftdm_status_t status = FTDM_SUCCESS; + + ftdm_mutex_lock(span->mutex); + + if (!ftdm_test_flag(span, FTDM_SPAN_STARTED)) { + status = FTDM_EINVAL; + goto done; + } + + if (!span->stop) { + status = FTDM_ENOSYS; + goto done; } + + status = span->stop(span); + if (FTDM_SUCCESS == status) { + ftdm_clear_flag(span, FTDM_SPAN_STARTED); + } + +done: + ftdm_mutex_unlock(span->mutex); + return status; } @@ -5063,11 +5080,28 @@ FT_DECLARE(ftdm_status_t) ftdm_configure_span_signaling(ftdm_span_t *span, const FT_DECLARE(ftdm_status_t) ftdm_span_start(ftdm_span_t *span) { - if (span->start) { - return span->start(span); + ftdm_status_t status = FTDM_FAIL; + + ftdm_mutex_lock(span->mutex); + + if (ftdm_test_flag(span, FTDM_SPAN_STARTED)) { + status = FTDM_EINVAL; + goto done; } - return FTDM_FAIL; + if (!span->start) { + status = FTDM_ENOSYS; + goto done; + } + + status = span->start(span); + if (status == FTDM_SUCCESS) { + ftdm_set_flag_locked(span, FTDM_SPAN_STARTED); + } + +done: + ftdm_mutex_unlock(span->mutex); + return status; } FT_DECLARE(ftdm_status_t) ftdm_channel_add_to_group(const char* name, ftdm_channel_t* ftdmchan) diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index 2d683e3..d798357 100644 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -168,7 +168,7 @@ typedef enum { typedef enum { FTDM_SPAN_CONFIGURED = (1 << 0), - FTDM_SPAN_READY = (1 << 1), + FTDM_SPAN_STARTED = (1 << 1), FTDM_SPAN_STATE_CHANGE = (1 << 2), FTDM_SPAN_SUSPENDED = (1 << 3), FTDM_SPAN_IN_THREAD = (1 << 4), commit 1334d02ac0913370a5ee77d63dd7b64fbb0a3f89 Merge: 836604c 5c02639 Author: Moises Silva <moy@sangoma.com> Date: Tue Jan 4 12:32:30 2011 -0500 Merge branch 'moy.nonblocking-api' Conflicts: libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c diff --cc libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 8792b51,37c760c..f1ef61c --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@@ -1656,183 -1627,161 +1653,173 @@@ static ftdm_status_t ftdm_r2_state_adva sigev.span_id = ftdmchan->span_id; sigev.channel = ftdmchan; - ret = 0; - - /* because we do not always acknowledge the state change (clearing the FTDM_CHANNEL_STATE_CHANGE flag) due to the accept - * procedure described below, we need the chanstate member to NOT process some states twice, so is valid entering this - * function with the FTDM_CHANNEL_STATE_CHANGE flag set but with a state that was already processed and is just waiting - * to complete (the processing is media-bound) - * */ - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE) - && (r2call->chanstate != ftdmchan->state)) { - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Executing state handler for %s\n", ftdm_channel_state2str(ftdmchan->state)); - r2call->chanstate = ftdmchan->state; - - if (IS_ACCEPTING_PENDING(ftdmchan)) { - /* - Moving to PROGRESS, PROGRESS_MEDIA or UP means that we must accept the call first, and accepting - the call in R2 means sending a tone, then waiting for the acknowledge from the other end, - since all of that requires sending and detecting tones, it takes a few milliseconds (I'd say around 100) - which means during that time the user should not try to perform any operations like answer, hangup or anything - else, therefore we DO NOT clear the FTDM_CHANNEL_STATE_CHANGE flag here, we rely on ftdm_io.c to block - the user thread until we're done with the accept (see on_call_accepted callback) and then we clear the state change flag, - otherwise we have a race condition between freetdm calling openr2_chan_answer_call and openr2 accepting the call first, - if freetdm calls openr2_chan_answer_call before the accept cycle completes, openr2 will fail to answer the call */ - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "State ack for state %s will have to wait a bit\n", ftdm_channel_state2str(ftdmchan->state)); - } else if (ftdmchan->state != FTDM_CHANNEL_STATE_DOWN){ - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE); - ftdm_channel_complete_state(ftdmchan); - } - - switch (ftdmchan->state) { - - /* starting an incoming call */ - case FTDM_CHANNEL_STATE_COLLECT: - { - uint32_t interval = 0; - ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_INTERVAL, &interval); - ftdm_assert(interval != 0, "Invalid interval!"); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Starting processing of incoming call with interval %d\n", interval); - openr2_chan_enable_read(r2chan); - } - break; - - /* starting an outgoing call */ - case FTDM_CHANNEL_STATE_DIALING: - { - uint32_t interval = 0; - ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_INTERVAL, &interval); - ftdm_assert(interval != 0, "Invalid interval!"); - ftdm_log_chan(ftdmchan, - FTDM_LOG_DEBUG, "Starting processing of outgoing call in channel with interval %d\n", interval); - openr2_chan_enable_read(r2chan); - } - break; + ret = FTDM_SUCCESS; + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Executing state handler for %s\n", ftdm_channel_state2str(ftdmchan->state)); + + if (IS_ACCEPTING_PENDING(ftdmchan)) { + /* + Moving to PROGRESS, PROGRESS_MEDIA or UP means that we must accept the call first, and accepting + the call in R2 means sending a tone, then waiting for the acknowledge from the other end, + since all of that requires sending and detecting tones, it takes a few milliseconds (I'd say around 100) + which means during that time the user should not try to perform any operations like answer, hangup or anything + else, therefore we DO NOT clear the FTDM_CHANNEL_STATE_CHANGE flag here, we rely on ftdm_io.c to block + the user thread until we're done with the accept (see on_call_accepted callback) and then we clear the state change flag, + otherwise we have a race condition between freetdm calling openr2_chan_answer_call and openr2 accepting the call first, + if freetdm calls openr2_chan_answer_call before the accept cycle completes, openr2 will fail to answer the call */ + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "State ack for state %s will have to wait a bit\n", ftdm_channel_state2str(ftdmchan->state)); + } else if (ftdmchan->state != FTDM_CHANNEL_STATE_DOWN){ + ftdm_channel_complete_state(ftdmchan); + } + + switch (ftdmchan->state) { + + /* starting an incoming call */ + case FTDM_CHANNEL_STATE_COLLECT: + { + uint32_t interval = 0; + ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_INTERVAL, &interval); + ftdm_assert(interval != 0, "Invalid interval!"); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Starting processing of incoming call with interval %d\n", interval); + openr2_chan_enable_read(r2chan); + } + break; - /* incoming call was offered */ - case FTDM_CHANNEL_STATE_RING: + /* starting an outgoing call */ + case FTDM_CHANNEL_STATE_DIALING: + { + uint32_t interval = 0; + ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_INTERVAL, &interval); + ftdm_assert(interval != 0, "Invalid interval!"); + ftdm_log_chan(ftdmchan, + FTDM_LOG_DEBUG, "Starting processing of outgoing call in channel with interval %d\n", interval); + openr2_chan_enable_read(r2chan); + } + break; - /* notify the user about the new call */ - sigev.event_id = FTDM_SIGEVENT_START; + /* incoming call was offered */ + case FTDM_CHANNEL_STATE_RING: - ftdm_span_send_signal(ftdmchan->span, &sigev); - r2call->ftdm_call_started = 1; + /* notify the user about the new call */ + sigev.event_id = FTDM_SIGEVENT_START; - break; + ftdm_span_send_signal(ftdmchan->span, &sigev); + r2call->ftdm_call_started = 1; - /* the call is making progress */ - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - { - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - if (!r2call->accepted) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Accepting call\n"); - ft_r2_accept_call(ftdmchan); - } - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Notifying progress\n"); - sigev.event_id = FTDM_SIGEVENT_PROCEED; - ftdm_span_send_signal(ftdmchan->span, &sigev); + break; - sigev.event_id = FTDM_SIGEVENT_PROGRESS_MEDIA; - ftdm_span_send_signal(ftdmchan->span, &sigev); - } + /* the call is making progress */ + case FTDM_CHANNEL_STATE_PROGRESS: + case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: + { + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + if (!r2call->accepted) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Accepting call\n"); + ft_r2_accept_call(ftdmchan); + } + } else { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Notifying progress\n"); + sigev.event_id = FTDM_SIGEVENT_PROCEED; + ftdm_span_send_signal(ftdmchan->span, &sigev); + + sigev.event_id = FTDM_SIGEVENT_PROGRESS_MEDIA; + ftdm_span_send_signal(ftdmchan->span, &sigev); } - break; + } + break; - /* the call was answered */ - case FTDM_CHANNEL_STATE_UP: - { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Call was answered\n"); - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - if (!r2call->accepted) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Call has not been accepted, need to accept first\n"); - // the answering will be done in the on_call_accepted handler - ft_r2_accept_call(ftdmchan); - r2call->answer_pending = 1; - } else { - ft_r2_answer_call(ftdmchan); - } + /* the call was answered */ + case FTDM_CHANNEL_STATE_UP: + { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Call was answered\n"); + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + if (!r2call->accepted) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Call has not been accepted, need to accept first\n"); + // the answering will be done in the on_call_accepted handler + ft_r2_accept_call(ftdmchan); + r2call->answer_pending = 1; } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Notifying of call answered\n"); - sigev.event_id = FTDM_SIGEVENT_UP; - ftdm_span_send_signal(ftdmchan->span, &sigev); + ft_r2_answer_call(ftdmchan); } + } else { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Notifying of call answered\n"); + sigev.event_id = FTDM_SIGEVENT_UP; + ftdm_span_send_signal(ftdmchan->span, &sigev); } - break; + } + break; - /* just got hangup */ - case FTDM_CHANNEL_STATE_HANGUP: - { - if (!r2call->disconnect_rcvd) { - openr2_call_disconnect_cause_t disconnect_cause = ftdm_r2_ftdm_cause_to_openr2_cause(ftdmchan); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Clearing call, cause = %s\n", openr2_proto_get_disconnect_string(disconnect_cause)); - /* this will disconnect the call, but need to wait for the call end before moving to DOWN */ - openr2_chan_disconnect_call(r2chan, disconnect_cause); - } else if (!r2call->protocol_error) { - /* just ack the hangup, on_call_end will be called by openr2 right after */ - openr2_chan_disconnect_call(r2chan, OR2_CAUSE_NORMAL_CLEARING); - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Clearing call due to protocol error\n"); - /* do not set to down yet, give some time for recovery */ - ftdm_sched_timer(r2data->sched, "protocolerr_recover", 100, - ftdm_r2_recover_from_protocol_error, r2chan, &r2call->protocol_error_recovery_timer); - } + /* just got hangup */ + case FTDM_CHANNEL_STATE_HANGUP: + { + if (!r2call->disconnect_rcvd) { + openr2_call_disconnect_cause_t disconnect_cause = ftdm_r2_ftdm_cause_to_openr2_cause(ftdmchan); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Clearing call, cause = %s\n", openr2_proto_get_disconnect_string(disconnect_cause)); + /* this will disconnect the call, but need to wait for the call end before moving to DOWN */ + openr2_chan_disconnect_call(r2chan, disconnect_cause); + } else if (!r2call->protocol_error) { + /* just ack the hangup, on_call_end will be called by openr2 right after */ + openr2_chan_disconnect_call(r2chan, OR2_CAUSE_NORMAL_CLEARING); + } else { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Clearing call due to protocol error\n"); + /* do not set to down yet, give some time for recovery */ + ftdm_sched_timer(r2data->sched, "protocolerr_recover", 100, + ftdm_r2_recover_from_protocol_error, r2chan, &r2call->protocol_error_recovery_timer); } - break; - - case FTDM_CHANNEL_STATE_TERMINATING: - { - /* if the call has not been started yet we must go to HANGUP right here */ - if (!r2call->ftdm_call_started) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); - } else { - openr2_call_disconnect_cause_t disconnect_cause = ftdm_r2_ftdm_cause_to_openr2_cause(ftdmchan); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Clearing call, cause = %s\n", openr2_proto_get_disconnect_string(disconnect_cause)); - /* notify the user of the call terminating and we wait for the user to move us to hangup */ - sigev.event_id = FTDM_SIGEVENT_STOP; - ftdm_span_send_signal(ftdmchan->span, &sigev); - } - } - break; + } + break; - /* finished call for good */ - case FTDM_CHANNEL_STATE_DOWN: - { - if (ftdmchan->last_state != FTDM_CHANNEL_STATE_RESET) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "R2 Call is down\n"); - } - ret = 1; + case FTDM_CHANNEL_STATE_TERMINATING: + { + /* if the call has not been started yet we must go to HANGUP right here */ + if (!r2call->ftdm_call_started) { + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); + } else { + openr2_call_disconnect_cause_t disconnect_cause = ftdm_r2_ftdm_cause_to_openr2_cause(ftdmchan); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Clearing call, cause = %s\n", openr2_proto_get_disconnect_string(disconnect_cause)); + /* notify the user of the call terminating and we wait for the user to move us to hangup */ + sigev.event_id = FTDM_SIGEVENT_STOP; + ftdm_span_send_signal(ftdmchan->span, &sigev); } - break; + } + break; - /* INDICATE_RINGING doesn't apply to MFC/R2. maybe we could generate a tone */ - case FTDM_CHANNEL_STATE_RINGING: - { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "RINGING indicated, ignoring it as it doesn't apply to MFC/R2\n"); + /* finished call for good */ + case FTDM_CHANNEL_STATE_DOWN: + { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "R2 Call is down\n"); ++ if (ftdmchan->last_state != FTDM_CHANNEL_STATE_RESET) { ++ ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "R2 Call is down\n"); ++ } else { ++ ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "R2 Reset Complete\n"); + } - break; + ret = FTDM_BREAK; + } + break; - /* put the r2 channel back to IDLE, close ftdmchan and set it's state as DOWN */ - case FTDM_CHANNEL_STATE_RESET: - { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "RESET indicated, putting the R2 channel back to IDLE\n"); - openr2_chan_set_idle(r2chan); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } - break; + /* INDICATE_RINGING doesn't apply to MFC/R2. maybe we could generate a tone */ + case FTDM_CHANNEL_STATE_RINGING: + { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "RINGING indicated, ignoring it as it doesn't apply to MFC/R2\n"); + } + break; - default: - { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Unhandled channel state change: %s\n", ftdm_channel_state2str(ftdmchan->state)); - } - break; ++ /* put the r2 channel back to IDLE, close ftdmchan and set it's state as DOWN */ ++ case FTDM_CHANNEL_STATE_RESET: ++ { ++ ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "RESET indicated, putting the R2 channel back to IDLE\n"); ++ openr2_chan_set_idle(r2chan); ++ ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); ++ } ++ break; + - } + default: + { + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Unhandled channel state change: %s\n", ftdm_channel_state2str(ftdmchan->state)); + } + break; - } - if (ret) { + if (ret == FTDM_BREAK) { ftdm_channel_t *closed_chan; closed_chan = ftdmchan; ftdm_channel_close(&closed_chan); commit 5c02639b5acf48ead80045f50e841c1c43f36d34 Author: Moises Silva <moy@sangoma.com> Date: Tue Jan 4 10:37:20 2011 -0500 freetdm: update ftmod_sangoma_ss7 to use new state advance API diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index 05a325b..9016771 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -46,7 +46,6 @@ ftdm_sngss7_data_t g_ftdm_sngss7_data; /* PROTOTYPES *****************************************************************/ static void *ftdm_sangoma_ss7_run (ftdm_thread_t * me, void *obj); -void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t *ftdmchan); static void ftdm_sangoma_ss7_process_stack_event (sngss7_event_data_t *sngss7_event); static ftdm_status_t ftdm_sangoma_ss7_stop (ftdm_span_t * span); @@ -308,9 +307,7 @@ static void *ftdm_sangoma_ss7_run(ftdm_thread_t * me, void *obj) ftdm_mutex_lock(ftdmchan->mutex); /* process state changes for this channel until they are all done */ - while (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { - ftdm_sangoma_ss7_process_state_change (ftdmchan); - } + ftdm_channel_advance_states(ftdmchan); /* unlock the channel */ ftdm_mutex_unlock (ftdmchan->mutex); @@ -403,9 +400,7 @@ static void ftdm_sangoma_ss7_process_stack_event (sngss7_event_data_t *sngss7_ev ftdm_mutex_lock(ftdmchan->mutex); /* while there's a state change present on this channel process it */ - while (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { - ftdm_sangoma_ss7_process_state_change(ftdmchan); - } + ftdm_channel_advance_states(ftdmchan); /* figure out the type of event and send it to the right handler */ switch (sngss7_event->event_id) { @@ -468,9 +463,7 @@ static void ftdm_sangoma_ss7_process_stack_event (sngss7_event_data_t *sngss7_ev } /* switch (sngss7_event->event_id) */ /* while there's a state change present on this channel process it */ - while (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { - ftdm_sangoma_ss7_process_state_change(ftdmchan); - } + ftdm_channel_advance_states(ftdmchan); /* unlock the channel */ ftdm_mutex_unlock(ftdmchan->mutex); @@ -479,7 +472,7 @@ static void ftdm_sangoma_ss7_process_stack_event (sngss7_event_data_t *sngss7_ev } /******************************************************************************/ -void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) +ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) { sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; sng_isup_inf_t *isup_intf = NULL; @@ -495,7 +488,7 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) SS7_DEBUG_CHAN(ftdmchan, "ftmod_sangoma_ss7 processing state %s\n", ftdm_channel_state2str (ftdmchan->state)); /* clear the state change flag...since we might be setting a new state */ - ftdm_clear_flag (ftdmchan, FTDM_CHANNEL_STATE_CHANGE); + ftdm_channel_complete_state(ftdmchan); /*check what state we are supposed to be in */ switch (ftdmchan->state) { @@ -1212,7 +1205,7 @@ suspend_goto_restart: /**************************************************************************/ }/*switch (ftdmchan->state) */ - return; + return FTDM_SUCCESS; } /******************************************************************************/ @@ -1476,6 +1469,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_ss7_span_config) span->get_channel_sig_status = ftdm_sangoma_ss7_get_sig_status; span->set_channel_sig_status = ftdm_sangoma_ss7_set_sig_status; span->state_map = &sangoma_ss7_state_map; + span->state_processor = ftdm_sangoma_ss7_process_state_change; span->signal_data = ss7_span_info; /* set the flag to indicate that this span uses channel state change queues */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index fe4b6f4..f28547f 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -452,7 +452,7 @@ extern int cmbLinkSetId; /* PROTOTYPES *****************************************************************/ /* in ftmod_sangoma_ss7_main.c */ -void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t *ftdmchan); +ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t *ftdmchan); /* in ftmod_sangoma_ss7_logger.c */ void handle_sng_log(uint8_t level, char *fmt,...); commit 4a6b4e86f16a25074cc0f77fc7ddbda36f5cbfc4 Author: Moises Silva <moy@sangoma.com> Date: Tue Jan 4 09:30:49 2011 -0500 freetdm: add non-locking answer function to handle answer indication export ftdm_current_time_in_ms to users update testr2 to test non-blocking API (no waiting on indications) diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index e55839a..b60e72f 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2032,22 +2032,22 @@ FT_DECLARE(void) ftdm_ack_indication(ftdm_channel_t *fchan, ftdm_channel_indicat ftdm_span_send_signal(fchan->span, &msg); } -FT_DECLARE(ftdm_status_t) _ftdm_channel_call_answer(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan) +/*! \brief Answer call without locking the channel. The caller must have locked first + * \note This function was added because ftdm_channel_call_indicate needs to answer the call + * when its already locking the channel, ftdm_channel_set_state cannot be called with the same + * lock locked once or more (recursive lock) and wait for the result */ +static ftdm_status_t _ftdm_channel_call_answer_nl(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan) { ftdm_status_t status = FTDM_SUCCESS; - ftdm_channel_lock(ftdmchan); + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + status = FTDM_EINVAL; + goto done; + } if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call is already TERMINATING\n"); status = FTDM_ECANCELED; - ftdm_ack_indication(ftdmchan, FTDM_CHANNEL_INDICATE_ANSWER, status); - goto done; - } - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - status = FTDM_EINVAL; - ftdm_ack_indication(ftdmchan, FTDM_CHANNEL_INDICATE_ANSWER, status); goto done; } @@ -2059,7 +2059,7 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_answer(const char *file, const char if (ftdmchan->state < FTDM_CHANNEL_STATE_PROGRESS) { status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS, 1); if (status != FTDM_SUCCESS) { - ftdm_ack_indication(ftdmchan, FTDM_CHANNEL_INDICATE_ANSWER, status); + status = FTDM_ECANCELED; goto done; } } @@ -2068,14 +2068,13 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_answer(const char *file, const char if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call has moved to TERMINATING while we're moving to PROGRESS\n"); status = FTDM_ECANCELED; - ftdm_ack_indication(ftdmchan, FTDM_CHANNEL_INDICATE_ANSWER, status); goto done; } if (ftdmchan->state < FTDM_CHANNEL_STATE_PROGRESS_MEDIA) { status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, 1); if (status != FTDM_SUCCESS) { - ftdm_ack_indication(ftdmchan, FTDM_CHANNEL_INDICATE_ANSWER, status); + status = FTDM_ECANCELED; goto done; } } @@ -2084,23 +2083,35 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_answer(const char *file, const char if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call has moved to TERMINATING while we're moving to UP\n"); status = FTDM_ECANCELED; - ftdm_ack_indication(ftdmchan, FTDM_CHANNEL_INDICATE_ANSWER, status); goto done; } } status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_UP, 1); if (status != FTDM_SUCCESS) { - ftdm_ack_indication(ftdmchan, FTDM_CHANNEL_INDICATE_ANSWER, status); + status = FTDM_ECANCELED; + goto done; } done: + + return status; +} + +FT_DECLARE(ftdm_status_t) _ftdm_channel_call_answer(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan) +{ + ftdm_status_t status = FTDM_SUCCESS; + + ftdm_channel_lock(ftdmchan); + + status = _ftdm_channel_call_answer_nl(file, func, line, ftdmchan); + ftdm_channel_unlock(ftdmchan); return status; } /* lock must be acquired by the caller! */ -static ftdm_status_t call_hangup(ftdm_channel_t *chan, const char *file, const char *func, int line) +static ftdm_status_t _ftdm_channel_call_hangup_nl(ftdm_channel_t *chan, const char *file, const char *func, int line) { ftdm_status_t status = FTDM_SUCCESS; @@ -2139,7 +2150,7 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_hangup_with_cause(const char *file, ftdmchan->caller_data.hangup_cause = cause; - status = call_hangup(ftdmchan, file, func, line); + status = _ftdm_channel_call_hangup_nl(ftdmchan, file, func, line); ftdm_channel_unlock(ftdmchan); return status; @@ -2153,7 +2164,7 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_hangup(const char *file, const char ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_CLEARING; - status = call_hangup(ftdmchan, file, func, line); + status = _ftdm_channel_call_hangup_nl(ftdmchan, file, func, line); ftdm_channel_unlock(ftdmchan); return status; @@ -2288,7 +2299,7 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_indicate(const char *file, const ch break; case FTDM_CHANNEL_INDICATE_ANSWER: /* _ftdm_channel_call_answer takes care of the indication ack */ - status = _ftdm_channel_call_answer(file, func, line, ftdmchan); + status = _ftdm_channel_call_answer_nl(file, func, line, ftdmchan); break; default: ftdm_log(file, func, line, FTDM_LOG_LEVEL_WARNING, "Do not know how to indicate %d\n", indication); @@ -5292,7 +5303,7 @@ static void execute_safety_hangup(void *data) fchan->hangup_timer = 0; if (fchan->state == FTDM_CHANNEL_STATE_TERMINATING) { ftdm_log_chan(fchan, FTDM_LOG_CRIT, "Forcing hangup since the user did not confirmed our hangup after %dms\n", FORCE_HANGUP_TIMER); - call_hangup(fchan, __FILE__, __FUNCTION__, __LINE__); + _ftdm_channel_call_hangup_nl(fchan, __FILE__, __FUNCTION__, __LINE__); } else { ftdm_log_chan(fchan, FTDM_LOG_CRIT, "Not performing safety hangup, channel state is %s\n", ftdm_channel_state2str(fchan->state)); } diff --git a/libs/freetdm/src/include/ftdm_os.h b/libs/freetdm/src/include/ftdm_os.h index f3ebee9..a4605c3 100644 --- a/libs/freetdm/src/include/ftdm_os.h +++ b/libs/freetdm/src/include/ftdm_os.h @@ -51,6 +51,9 @@ extern "C" { #include <unistd.h> #endif +/*! \brief time data type */ +typedef uint64_t ftdm_time_t; + /*! \brief sleep x amount of milliseconds */ #ifdef __WINDOWS__ #define ftdm_sleep(x) Sleep(x) @@ -114,6 +117,8 @@ FT_DECLARE(char *) ftdm_strdup(const char *str); /*! \brief Duplicate string with limit */ FT_DECLARE(char *) ftdm_strndup(const char *str, ftdm_size_t inlen); +/*! \brief Get the current time in milliseconds */ +FT_DECLARE(ftdm_time_t) ftdm_current_time_in_ms(void); #ifdef __cplusplus } /* extern C */ diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index 55fb8ba..a5862e5 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -556,7 +556,6 @@ FT_DECLARE(ftdm_status_t) ftdm_fsk_data_add_sdmf(ftdm_fsk_data_state_t *state, c FT_DECLARE(ftdm_status_t) ftdm_channel_send_fsk_data(ftdm_channel_t *ftdmchan, ftdm_fsk_data_state_t *fsk_data, float db_level); FT_DECLARE(ftdm_status_t) ftdm_span_load_tones(ftdm_span_t *span, const char *mapname); -FT_DECLARE(ftdm_time_t) ftdm_current_time_in_ms(void); FT_DECLARE(ftdm_status_t) ftdm_channel_use(ftdm_channel_t *ftdmchan); diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index 41711f7..2d683e3 100644 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -69,8 +69,6 @@ extern "C" { #define FTDM_END -1 #define FTDM_ANY_STATE -1 -typedef uint64_t ftdm_time_t; - typedef enum { FTDM_ENDIAN_BIG = 1, FTDM_ENDIAN_LITTLE = -1 diff --git a/libs/freetdm/src/testr2.c b/libs/freetdm/src/testr2.c index 8ac90c5..72d9802 100644 --- a/libs/freetdm/src/testr2.c +++ b/libs/freetdm/src/testr2.c @@ -2,78 +2,158 @@ #include <signal.h> #include <stdlib.h> -static int R = 0; -static ftdm_mutex_t *mutex = NULL; +static volatile int running = 0; +static ftdm_mutex_t *the_mutex = NULL; +static ftdm_channel_t *fchan = NULL; +static ftdm_channel_indication_t indication = FTDM_CHANNEL_INDICATE_NONE; static FIO_SIGNAL_CB_FUNCTION(on_r2_signal) { int chanid = ftdm_channel_get_ph_id(sigmsg->channel); - ftdm_log(FTDM_LOG_DEBUG, "Got R2 channel sig [%s] in channel\n", ftdm_signal_event2str(sigmsg->event_id), chanid); - return FTDM_SUCCESS; + ftdm_log(FTDM_LOG_DEBUG, "Got R2 channel sig [%s] in channel\n", ftdm_signal_event2str(sigmsg->event_id), chanid); + switch (sigmsg->event_id) { + case FTDM_SIGEVENT_START: + { + ftdm_mutex_lock(the_mutex); + if (!fchan) { + fchan = sigmsg->channel; + indication = FTDM_CHANNEL_INDICATE_PROCEED; + } + ftdm_mutex_unlock(the_mutex); + } + break; + case FTDM_SIGEVENT_INDICATION_COMPLETED: + { + ftdm_channel_indication_t ind = FTDM_CHANNEL_INDICATE_NONE; + if (sigmsg->ev_data.indication_completed.indication == FTDM_CHANNEL_INDICATE_PROCEED) { + ftdm_log(FTDM_LOG_DEBUG, "Proceed indication result = %d\n", sigmsg->ev_data.indication_completed.status); + ind = FTDM_CHANNEL_INDICATE_PROGRESS; + } else if (sigmsg->ev_data.indication_completed.indication == FTDM_CHANNEL_INDICATE_PROGRESS) { + ftdm_log(FTDM_LOG_DEBUG, "Progress indication result = %d\n", sigmsg->ev_data.indication_completed.status); + ind = FTDM_CHANNEL_INDICATE_PROGRESS_MEDIA; + } else if (sigmsg->ev_data.indication_completed.indication == FTDM_CHANNEL_INDICATE_PROGRESS_MEDIA) { + ftdm_log(FTDM_LOG_DEBUG, "Progress media indication result = %d\n", sigmsg->ev_data.indication_completed.status); + ind = FTDM_CHANNEL_INDICATE_ANSWER; + } else if (sigmsg->ev_data.indication_completed.indication == FTDM_CHANNEL_INDICATE_ANSWER) { + ftdm_log(FTDM_LOG_DEBUG, "Answer indication result = %d\n", sigmsg->ev_data.indication_completed.status); + } else { + ftdm_log(FTDM_LOG_DEBUG, "Unexpected indication, result = %d\n", sigmsg->ev_data.indication_completed.status); + exit(1); + } + ftdm_mutex_lock(the_mutex); + if (fchan) { + indication = ind; + } + ftdm_mutex_unlock(the_mutex); + } + break; + case FTDM_SIGEVENT_STOP: + { + ftdm_channel_call_hangup(sigmsg->channel); + } + break; + case FTDM_SIGEVENT_RELEASED: + { + ftdm_mutex_lock(the_mutex); + if (fchan && fchan == sigmsg->channel) { + fchan = NULL; + } + ftdm_mutex_unlock(the_mutex); + } + break; + default: + break; + } + return FTDM_SUCCESS; } -static void handle_SIGINT(int sig) +static void stop_test(int sig) { - ftdm_mutex_lock(mutex); - R = 0; - ftdm_mutex_unlock(mutex); - return; + running = 0; } int main(int argc, char *argv[]) { ftdm_span_t *span; - ftdm_mutex_create(&mutex); - - ftdm_global_set_default_logger(FTDM_LOG_LEVEL_DEBUG); + ftdm_conf_parameter_t parameters[20]; + + ftdm_mutex_create(&the_mutex); if (argc < 2) { printf("umm no\n"); - exit(-1); + exit(1); } + ftdm_global_set_default_logger(FTDM_LOG_LEVEL_DEBUG); + if (ftdm_global_init() != FTDM_SUCCESS) { fprintf(stderr, "Error loading FreeTDM\n"); - exit(-1); + exit(1); } + ftdm_global_configuration(); + printf("FreeTDM loaded\n"); - if (ftdm_span_find(atoi(argv[1]), &span) != FTDM_SUCCESS) { - fprintf(stderr, "Error finding FreeTDM span\n"); + if (ftdm_span_find_by_name(argv[1], &span) != FTDM_SUCCESS) { + fprintf(stderr, "Error finding FreeTDM span %s\n", argv[1]); goto done; } + /* testing non-blocking operation */ + //ftdm_span_set_blocking_mode(span, FTDM_FALSE); + + parameters[0].var = "variant"; + parameters[0].val = "br"; + + parameters[1].var = "max_ani"; + parameters[1].val = "4"; + parameters[2].var = "max_dnis"; + parameters[2].val = "4"; - if (ftdm_configure_span(span, "r2", on_r2_signal, - "variant", "mx", - "max_ani", 10, - "max_dnis", 4, - "logging", "all", - FTDM_TAG_END) == FTDM_SUCCESS) { - + parameters[3].var = "logging"; + parameters[3].val = "all"; + parameters[4].var = NULL; + parameters[4].val = NULL; + + if (ftdm_configure_span_signaling(span, "r2", on_r2_signal, parameters) == FTDM_SUCCESS) { ftdm_span_start(span); } else { fprintf(stderr, "Error starting R2 span\n"); goto done; } - signal(SIGINT, handle_SIGINT); - ftdm_mutex_lock(mutex); - R = 1; - ftdm_mutex_unlock(mutex); - while(R) { - ftdm_sleep(1 * 1000); + running = 1; + signal(SIGINT, stop_test); + while(running) { + ftdm_sleep(20); + if (fchan && indication != FTDM_CHANNEL_INDICATE_NONE) { + ftdm_channel_t *lchan = NULL; + ftdm_channel_indication_t ind = FTDM_CHANNEL_INDICATE_NONE; + ftdm_time_t start, stop, diff; + + ftdm_mutex_lock(the_mutex); + ind = indication; + indication = FTDM_CHANNEL_INDICATE_NONE; + lchan = fchan; + ftdm_mutex_unlock(the_mutex); + + start = ftdm_current_time_in_ms(); + ftdm_channel_call_indicate(lchan, ind); + stop = ftdm_current_time_in_ms(); + diff = stop - start; + ftdm_log(FTDM_LOG_DEBUG, "Setting indication %s took %llums\n", + ftdm_channel_indication2str(ind), diff); + } } - done: +done: ftdm_global_destroy(); - return 1; - + return 0; } /* For Emacs: commit e6070feeab6940a3566a59a7802f003fa4181093 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Jan 3 16:48:10 2011 -0600 cleanup diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 6829605..04d5b01 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -2645,14 +2645,7 @@ void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, n if (sofia_test_pflag(profile, PFLAG_MULTIREG) && !open) { - char buf[32] = ""; - - sql = switch_mprintf("select count(*) from sip_registrations where " - "sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%')", from_user, from_host, from_host); - - sofia_glue_execute_sql2str(profile, profile->ireg_mutex, sql, buf, sizeof(buf)); - switch_safe_free(sql); - count = atoi(buf); + count = sofia_reg_reg_count(profile, from_user, from_host); } commit fc77d19b7bc6c64eadbd37f9715a79431f897379 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Jan 3 16:40:49 2011 -0600 presence.... again.... diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 5fd6cd7..8c6b1e0 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -1035,6 +1035,7 @@ void sofia_profile_destroy(sofia_profile_t *profile); switch_status_t sip_dig_function(_In_opt_z_ const char *cmd, _In_opt_ switch_core_session_t *session, _In_ switch_stream_handle_t *stream); const char *sofia_gateway_status_name(sofia_gateway_status_t status); void sofia_reg_fire_custom_gateway_state_event(sofia_gateway_t *gateway, int status, const char *phrase); +uint32_t sofia_reg_reg_count(sofia_profile_t *profile, const char *user, const char *host); void sofia_glue_copy_t38_options(switch_t38_options_t *t38_options, switch_core_session_t *session); switch_t38_options_t *sofia_glue_extract_t38_options(switch_core_session_t *session, const char *r_sdp); char *sofia_glue_get_multipart(switch_core_session_t *session, const char *prefix, const char *sdp, char **mp_type); diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 961eaa3..1589eeb 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -817,6 +817,19 @@ void sofia_reg_auth_challenge(nua_t *nua, sofia_profile_t *profile, nua_handle_t switch_safe_free(auth_str); } +uint32_t sofia_reg_reg_count(sofia_profile_t *profile, const char *user, const char *host) +{ + char buf[32] = ""; + char *sql; + + sql = switch_mprintf("select count(*) from sip_registrations where profile_name='%q' and " + "sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%')", profile->name, user, host, host); + + sofia_glue_execute_sql2str(profile, profile->ireg_mutex, sql, buf, sizeof(buf)); + switch_safe_free(sql); + return atoi(buf); +} + uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sip_t const *sip, sofia_regtype_t regtype, char *key, uint32_t keylen, switch_event_t **v_event, const char *is_nat) { @@ -1298,6 +1311,12 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); } + if (sofia_reg_reg_count(profile, to_user, reg_host) == 1) { + sql = switch_mprintf("delete from sip_presence where sip_user='%q' and sip_host='%q' and profile_name='%q' and open_closed='closed'", + to_user, reg_host, profile->name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DELETE PRESENCE SQL: %s\n", sql); + sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); + } switch_mutex_unlock(profile->ireg_mutex); @@ -1361,8 +1380,16 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand } else { + int send = 1; - if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { + if (multi_reg) { + if (sofia_reg_reg_count(profile, to_user, sub_host) > 0) { + send = 0; + } + } + + + if (send && switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", rpid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->url); commit 8b7fd76d3de084e581e994ffa171d1f6653a4d55 Author: Daniel Swarbrick <daniel@seventhsignal.de> Date: Mon Jan 3 22:09:46 2011 +0100 use switch_zmalloc() instead of apr pools for short term storage, rename a couple of funcs to be clearer as to their purpose diff --git a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c index e515f8d..9cc1d8c 100644 --- a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c +++ b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c @@ -139,7 +139,7 @@ static void do_rotate(cdr_fd_t *fd) } -static void write_cdr(const char *path, const char *log_line) +static void spool_cdr(const char *path, const char *log_line) { cdr_fd_t *fd = NULL; char *log_line_lf = NULL; @@ -157,12 +157,11 @@ static void write_cdr(const char *path, const char *log_line) } if (end_of(log_line) != '\n') { - size_t len = strlen(log_line) + 2; - log_line_lf = switch_core_alloc(globals.pool, len); - switch_snprintf(log_line_lf, len, "%s\n", log_line); + log_line_lf = switch_mprintf("%s\n", log_line); } else { - log_line_lf = switch_core_strdup(globals.pool, log_line); + switch_strdup(log_line_lf, log_line); } + assert(log_line_lf); switch_mutex_lock(fd->mutex); bytes_out = (unsigned) strlen(log_line_lf); @@ -192,9 +191,10 @@ static void write_cdr(const char *path, const char *log_line) end: switch_mutex_unlock(fd->mutex); + switch_safe_free(log_line_lf); } -static switch_status_t save_cdr(const char * const template, const char * const cdr) +static switch_status_t insert_cdr(const char * const template, const char * const cdr) { char *columns, *values; char *p, *q; @@ -210,7 +210,7 @@ static switch_status_t save_cdr(const char * const template, const char * const } /* Build comma-separated list of field names by dropping $ { } ; chars */ - columns = strdup(template); + switch_strdup(columns, template); for (p = columns, q = columns; *p; ++p) { switch (*p) { case '$': case '"': case '{': case '}': case ';': @@ -226,7 +226,7 @@ static switch_status_t save_cdr(const char * const template, const char * const * for correct PostgreSQL syntax, and replace semi-colon with space to * prevent SQL injection attacks */ - values = strdup(cdr); + switch_strdup(values, cdr); for (p = values; *p; ++p) { switch(*p) { case '"': @@ -260,7 +260,7 @@ static switch_status_t save_cdr(const char * const template, const char * const nullCounter *= 4; vlen += nullCounter; - nullValues = (char *) malloc(strlen(values) + nullCounter + 1); + switch_zmalloc(nullValues, strlen(values) + nullCounter + 1); charCounter = 0; temp = nullValues; tp = nullValues; @@ -366,11 +366,11 @@ static switch_status_t save_cdr(const char * const template, const char * const if (!strcasecmp(globals.spool_format, "sql")) { path = switch_mprintf("%s%scdr-spool.sql", globals.log_dir, SWITCH_PATH_SEPARATOR); assert(path); - write_cdr(path, sql); + spool_cdr(path, sql); } else { path = switch_mprintf("%s%scdr-spool.csv", globals.log_dir, SWITCH_PATH_SEPARATOR); assert(path); - write_cdr(path, cdr); + spool_cdr(path, cdr); } switch_safe_free(path); @@ -433,7 +433,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) return SWITCH_STATUS_FALSE; } - save_cdr(template_str, expanded_vars); + insert_cdr(template_str, expanded_vars); if (expanded_vars != template_str) { switch_safe_free(expanded_vars); commit df090a2a6b1042b8c575ecce241c021e16a792be Author: Daniel Swarbrick <daniel@seventhsignal.de> Date: Mon Jan 3 21:39:36 2011 +0100 free() -> switch_safe_free() diff --git a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c index 9f4260d..e515f8d 100644 --- a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c +++ b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c @@ -121,7 +121,7 @@ static void do_rotate(cdr_fd_t *fd) p = switch_mprintf("%s.%s", fd->path, date); assert(p); switch_file_rename(fd->path, p, globals.pool); - free(p); + switch_safe_free(p); } do_reopen(fd); @@ -317,12 +317,12 @@ static switch_status_t save_cdr(const char * const template, const char * const *tp = 0; tp = values; values = nullValues; - free(tp); + switch_safe_free(tp); sql = switch_mprintf("INSERT INTO %s (%s) VALUES (%s);", globals.db_table, columns, values); assert(sql); - free(columns); - free(values); + switch_safe_free(columns); + switch_safe_free(values); if (globals.debug) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Query: \"%s\"\n", sql); @@ -349,7 +349,7 @@ static switch_status_t save_cdr(const char * const template, const char * const } PQclear(res); - free(sql); + switch_safe_free(sql); switch_mutex_unlock(globals.db_mutex); @@ -373,8 +373,8 @@ static switch_status_t save_cdr(const char * const template, const char * const write_cdr(path, cdr); } - free(path); - free(sql); + switch_safe_free(path); + switch_safe_free(sql); return SWITCH_STATUS_FALSE; } @@ -416,7 +416,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) switch_assert(buf); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "CHANNEL_DATA:\n%s\n", buf); switch_event_destroy(&event); - free(buf); + switch_safe_free(buf); } } @@ -436,7 +436,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) save_cdr(template_str, expanded_vars); if (expanded_vars != template_str) { - free(expanded_vars); + switch_safe_free(expanded_vars); } return status; diff --git a/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c b/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c index b3334fe..1b91f12 100644 --- a/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c +++ b/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c @@ -140,7 +140,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) switch_assert(buf); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "CHANNEL_DATA:\n%s\n", buf); switch_event_destroy(&event); - free(buf); + switch_safe_free(buf); } } @@ -160,7 +160,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) sql = switch_mprintf("INSERT INTO %s VALUES (%s)", globals.db_table, expanded_vars); assert(sql); write_cdr(sql); - free(sql); + switch_safe_free(sql); return status; } @@ -264,8 +264,8 @@ static switch_status_t load_config(switch_memory_pool_t *pool) /* Check if table exists (try SELECT FROM ...) and create table if query fails */ switch_cache_db_test_reactive(dbh, select_sql, NULL, create_sql); - free(select_sql); - free(create_sql); + switch_safe_free(select_sql); + switch_safe_free(create_sql); switch_cache_db_release_db_handle(&dbh); } commit 66ce95a93049404324a382d307730c3aa4a1e443 Author: Daniel Swarbrick <daniel@seventhsignal.de> Date: Mon Jan 3 19:10:15 2011 +0100 removing my debug :o diff --git a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c index fba5f86..9f4260d 100644 --- a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c +++ b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c @@ -160,7 +160,6 @@ static void write_cdr(const char *path, const char *log_line) size_t len = strlen(log_line) + 2; log_line_lf = switch_core_alloc(globals.pool, len); switch_snprintf(log_line_lf, len, "%s\n", log_line); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Adding LF to log_line.\n"); } else { log_line_lf = switch_core_strdup(globals.pool, log_line); } commit a3d66bb4f075cb8b073aac6a84f3651ebec9aadd Author: Daniel Swarbrick <daniel@seventhsignal.de> Date: Mon Jan 3 18:59:41 2011 +0100 mod_cdr_pg_csv: make disk spool format user-selectable diff --git a/conf/autoload_configs/cdr_pg_csv.conf.xml b/conf/autoload_configs/cdr_pg_csv.conf.xml index e178097..2f2efa9 100644 --- a/conf/autoload_configs/cdr_pg_csv.conf.xml +++ b/conf/autoload_configs/cdr_pg_csv.conf.xml @@ -9,6 +9,8 @@ <param name="default-template" value="example"/> <!-- 'cdr-pg-csv' will always be appended to log-base --> <!--<param name="log-base" value="/var/log"/>--> + <!-- Disk spool format if DB connection/insert fails - csv (default) or sql --> + <param name="spool-format" value="csv"/> <param name="rotate-on-hup" value="true"/> <!-- This is like the info app but after the call is hung up --> <!--<param name="debug" value="true"/>--> diff --git a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c index 9da7c9d..fba5f86 100644 --- a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c +++ b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c @@ -67,6 +67,7 @@ static struct { cdr_leg_t legs; char *db_info; char *db_table; + char *spool_format; PGconn *db_connection; int db_online; switch_mutex_t *db_mutex; @@ -141,6 +142,7 @@ static void do_rotate(cdr_fd_t *fd) static void write_cdr(const char *path, const char *log_line) { cdr_fd_t *fd = NULL; + char *log_line_lf = NULL; unsigned int bytes_in, bytes_out; int loops = 0; @@ -154,8 +156,17 @@ static void write_cdr(const char *path, const char *log_line) switch_core_hash_insert(globals.fd_hash, path, fd); } + if (end_of(log_line) != '\n') { + size_t len = strlen(log_line) + 2; + log_line_lf = switch_core_alloc(globals.pool, len); + switch_snprintf(log_line_lf, len, "%s\n", log_line); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Adding LF to log_line.\n"); + } else { + log_line_lf = switch_core_strdup(globals.pool, log_line); + } + switch_mutex_lock(fd->mutex); - bytes_out = (unsigned) strlen(log_line); + bytes_out = (unsigned) strlen(log_line_lf); if (fd->fd < 0) { do_reopen(fd); @@ -169,7 +180,7 @@ static void write_cdr(const char *path, const char *log_line) do_rotate(fd); } - while ((bytes_in = write(fd->fd, log_line, bytes_out)) != bytes_out && ++loops < 10) { + while ((bytes_in = write(fd->fd, log_line_lf, bytes_out)) != bytes_out && ++loops < 10) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Write error to file %s %d/%d\n", path, (int) bytes_in, (int) bytes_out); do_rotate(fd); switch_yield(250000); @@ -184,7 +195,7 @@ static void write_cdr(const char *path, const char *log_line) switch_mutex_unlock(fd->mutex); } -static switch_status_t save_cdr(const char * const template, const char * const cdr, const char * const log_dir) +static switch_status_t save_cdr(const char * const template, const char * const cdr) { char *columns, *values; char *p, *q; @@ -214,7 +225,7 @@ static switch_status_t save_cdr(const char * const template, const char * const /* * In the expanded vars, replace double quotes (") with single quotes (') * for correct PostgreSQL syntax, and replace semi-colon with space to - * prevent SQL injection attacks. + * prevent SQL injection attacks */ values = strdup(cdr); for (p = values; *p; ++p) { @@ -309,9 +320,7 @@ static switch_status_t save_cdr(const char * const template, const char * const values = nullValues; free(tp); - //----------------------------- END_OF_PATCH ------------------------------- - - sql = switch_mprintf("INSERT INTO %s (%s) VALUES (%s);\n", globals.db_table, columns, values); + sql = switch_mprintf("INSERT INTO %s (%s) VALUES (%s);", globals.db_table, columns, values); assert(sql); free(columns); free(values); @@ -355,22 +364,27 @@ static switch_status_t save_cdr(const char * const template, const char * const switch_mutex_unlock(globals.db_mutex); /* SQL INSERT failed for whatever reason. Spool the attempted query to disk */ - path = switch_mprintf("%s%scdr-spool.sql", log_dir, SWITCH_PATH_SEPARATOR); - assert(path); - write_cdr(path, sql); + if (!strcasecmp(globals.spool_format, "sql")) { + path = switch_mprintf("%s%scdr-spool.sql", globals.log_dir, SWITCH_PATH_SEPARATOR); + assert(path); + write_cdr(path, sql); + } else { + path = switch_mprintf("%s%scdr-spool.csv", globals.log_dir, SWITCH_PATH_SEPARATOR); + assert(path); + write_cdr(path, cdr); + } free(path); free(sql); return SWITCH_STATUS_FALSE; - } static switch_status_t my_on_reporting(switch_core_session_t *session) { switch_channel_t *channel = switch_core_session_get_channel(session); switch_status_t status = SWITCH_STATUS_SUCCESS; - const char *log_dir = NULL, *template_str = NULL; + const char *template_str = NULL; char *expanded_vars = NULL; if (globals.shutdown) { @@ -389,12 +403,8 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) } } - if (!(log_dir = switch_channel_get_variable(channel, "cdr_pg_csv_base"))) { - log_dir = globals.log_dir; - } - - if (switch_dir_make_recursive(log_dir, SWITCH_DEFAULT_DIR_PERMS, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating %s\n", log_dir); + if (switch_dir_make_recursive(globals.log_dir, SWITCH_DEFAULT_DIR_PERMS, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating %s\n", globals.log_dir); return SWITCH_STATUS_FALSE; } @@ -424,7 +434,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) return SWITCH_STATUS_FALSE; } - save_cdr(template_str, expanded_vars, log_dir); + save_cdr(template_str, expanded_vars); if (expanded_vars != template_str) { free(expanded_vars); @@ -528,6 +538,8 @@ static switch_status_t load_config(switch_memory_pool_t *pool) globals.db_table = switch_core_strdup(pool, val); } else if (!strcasecmp(var, "default-template")) { globals.default_template = switch_core_strdup(pool, val); + } else if (!strcasecmp(var, "spool-format")) { + globals.spool_format = switch_core_strdup(pool, val); } } } @@ -563,6 +575,9 @@ static switch_status_t load_config(switch_memory_pool_t *pool) globals.default_template = switch_core_strdup(pool, "default"); } + if (zstr(globals.spool_format)) { + globals.spool_format = switch_core_strdup(pool, "csv"); + } return status; } commit 7b28994121b820e24c48e80c11ff5149f16245d3 Author: Brian West <brian@freeswitch.org> Date: Mon Jan 3 10:44:28 2011 -0600 FS-502: gateway not identified when extension-in-contact is set diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 94eab68..9e412bb 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -6844,11 +6844,19 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ if (sip->sip_request->rq_url->url_params) { - gw_name = sofia_glue_find_parameter(sip->sip_request->rq_url->url_params, "gw="); + gw_name = sofia_glue_find_parameter_value(session, sip->sip_request->rq_url->url_params, "gw="); } if (strstr(destination_number, "gw+")) { - gw_name = destination_number + 3; + if (sofia_test_pflag(profile, PFLAG_FULL_ID)) { + char *tmp; + gw_name = switch_core_session_strdup(session, destination_number + 3); + if ((tmp = strchr(gw_name, '@'))) { + *tmp = '\0'; + } + } else { + gw_name = destination_number + 3; + } } if (gw_name) { commit 80f3281c095f772b32eb1e042d267a089204b8e5 Author: Daniel Swarbrick <daniel@seventhsignal.de> Date: Mon Jan 3 15:05:24 2011 +0100 whitespace fixups diff --git a/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c b/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c index efb544e..b3334fe 100644 --- a/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c +++ b/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c @@ -38,8 +38,8 @@ typedef enum { } cdr_leg_t; static char default_create_sql[] = - "CREATE TABLE %s (\n" - " caller_id_name VARCHAR,\n" + "CREATE TABLE %s (\n" + " caller_id_name VARCHAR,\n" " caller_id_number VARCHAR,\n" " destination_number VARCHAR,\n" " context VARCHAR,\n" @@ -77,8 +77,8 @@ SWITCH_MODULE_DEFINITION(mod_cdr_sqlite, mod_cdr_sqlite_load, mod_cdr_sqlite_shu switch_cache_db_handle_t *cdr_get_db_handle(void) { - switch_cache_db_connection_options_t options = { {0} }; - switch_cache_db_handle_t *dbh = NULL; + switch_cache_db_connection_options_t options = { {0} }; + switch_cache_db_handle_t *dbh = NULL; options.core_db_options.db_path = globals.db_name; if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_CORE_DB, &options) != SWITCH_STATUS_SUCCESS) @@ -89,22 +89,22 @@ switch_cache_db_handle_t *cdr_get_db_handle(void) static switch_status_t write_cdr(char *sql) { - switch_cache_db_handle_t *dbh = NULL; - switch_status_t status = SWITCH_STATUS_FALSE; + switch_cache_db_handle_t *dbh = NULL; + switch_status_t status = SWITCH_STATUS_FALSE; - if (!(dbh = cdr_get_db_handle())) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n"); - goto end; - } + if (!(dbh = cdr_get_db_handle())) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n"); + goto end; + } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Writing SQL to DB: %s\n", sql); - status = switch_cache_db_execute_sql(dbh, sql, NULL); + status = switch_cache_db_execute_sql(dbh, sql, NULL); end: - switch_cache_db_release_db_handle(&dbh); + switch_cache_db_release_db_handle(&dbh); - return status; + return status; } commit aab453f52a37cfc43230e67c713ff7d605e7dd16 Author: Daniel Swarbrick <daniel@seventhsignal.de> Date: Mon Jan 3 14:01:08 2011 +0100 tweak create.sql and config file diff --git a/conf/autoload_configs/cdr_pg_csv.conf.xml b/conf/autoload_configs/cdr_pg_csv.conf.xml index bddd387..e178097 100644 --- a/conf/autoload_configs/cdr_pg_csv.conf.xml +++ b/conf/autoload_configs/cdr_pg_csv.conf.xml @@ -1,8 +1,5 @@ <configuration name="cdr_pg_csv.conf" description="CDR PG CSV Format"> <settings> - <!-- 'cdr-pg-csv' will always be appended to log-base --> - <!--<param name="log-base" value="/var/log"/>--> - <param name="rotate-on-hup" value="true"/> <!-- Log a-leg (a), b-leg (b) or both (ab) --> <param name="legs" value="a"/> <!-- See parameters for PQconnectdb() at http://www.postgresql.org/docs/8.4/static/libpq-connect.html --> @@ -10,6 +7,9 @@ <!-- CDR table name --> <!--<param name="db-table" value="cdr"/>--> <param name="default-template" value="example"/> + <!-- 'cdr-pg-csv' will always be appended to log-base --> + <!--<param name="log-base" value="/var/log"/>--> + <param name="rotate-on-hup" value="true"/> <!-- This is like the info app but after the call is hung up --> <!--<param name="debug" value="true"/>--> </settings> @@ -17,4 +17,3 @@ <template name="example">"${local_ip_v4}","${caller_id_name}","${caller_id_number}","${destination_number}","${context}","${start_stamp}","${answer_stamp}","${end_stamp}","${duration}","${billsec}","${hangup_cause}","${uuid}","${bleg_uuid}","${accountcode}","${read_codec}","${write_codec}","${sip_hangup_disposition}","${ani}"</template> </templates> </configuration> - diff --git a/src/mod/event_handlers/mod_cdr_pg_csv/create.sql b/src/mod/event_handlers/mod_cdr_pg_csv/create.sql index 83cfec1..9a39b0b 100644 --- a/src/mod/event_handlers/mod_cdr_pg_csv/create.sql +++ b/src/mod/event_handlers/mod_cdr_pg_csv/create.sql @@ -1,5 +1,6 @@ +-- Sample CDR table schema -create table a ( +create table cdr ( id serial primary key, local_ip_v4 inet not null, caller_id_name varchar, @@ -20,26 +21,3 @@ create table a ( sip_hangup_disposition varchar, ani varchar ); - -create table g ( - id serial primary key, - local_ip_v4 inet not null, - caller_id_name varchar, - caller_id_number varchar, - destination_number varchar not null, - context varchar not null, - start_stamp timestamp with time zone not null, - answer_stamp timestamp with time zone, - end_stamp timestamp with time zone not null, - duration int not null, - billsec int not null, - hangup_cause varchar not null, - uuid uuid not null, - bleg_uuid uuid, - accountcode varchar, - read_codec varchar, - write_codec varchar, - sip_hangup_disposition varchar, - ani varchar -); - diff --git a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c index 45951f6..9da7c9d 100644 --- a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c +++ b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c @@ -457,7 +457,6 @@ static void event_handler(switch_event_t *event) PQfinish(globals.db_connection); globals.db_online = 0; } - } } commit 93bbbe96af98a6e4ab2ae5a48e68690b44bc103c Author: Daniel Swarbrick <daniel@seventhsignal.de> Date: Mon Jan 3 13:36:20 2011 +0100 Remove event_handler() altogether, since it was doing nothing anyway diff --git a/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c b/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c index 1eae1ab..efb544e 100644 --- a/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c +++ b/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c @@ -166,16 +166,6 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) } -static void event_handler(switch_event_t *event) -{ - const char *sig = switch_event_get_header(event, "Trapped-Signal"); - - if (globals.shutdown) { - return; - } -} - - static switch_state_handler_table_t state_handlers = { /*.on_init */ NULL, /*.on_routing */ NULL, @@ -290,11 +280,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_cdr_sqlite_load) load_config(pool); - if ((status = switch_event_bind(modname, SWITCH_EVENT_TRAP, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL)) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n"); - return status; - } - switch_core_add_state_handler(&state_handlers); *module_interface = switch_loadable_module_create_module_interface(pool, modname); @@ -305,7 +290,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_cdr_sqlite_load) SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cdr_sqlite_shutdown) { globals.shutdown = 1; - switch_event_unbind_callback(event_handler); switch_core_remove_state_handler(&state_handlers); return SWITCH_STATUS_SUCCESS; commit 935f2c42141eb78c3fd13ace50900bd99b905dd0 Author: Daniel Swarbrick <daniel@seventhsignal.de> Date: Mon Jan 3 13:25:46 2011 +0100 mod_cdr_sqlite has no need for (yet) for SIGHUP diff --git a/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c b/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c index 534f18f..1eae1ab 100644 --- a/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c +++ b/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c @@ -173,10 +173,6 @@ static void event_handler(switch_event_t *event) if (globals.shutdown) { return; } - - if (sig && !strcmp(sig, "HUP")) { - /* Should we do something on SIG_HUP? */ - } } commit 8ecf30807556ee3f614f4f2e5181dc5bbfbfdf81 Author: cypromis <michal.bielicki@seventhsignal.de> Date: Mon Jan 3 13:06:25 2011 +0100 fix basops32.c make the file contain something even if ifdefs fail (which makes suncc fail) diff --git a/libs/libg722_1/src/basop32.c b/libs/libg722_1/src/basop32.c index 210e129..3a51f45 100644 --- a/libs/libg722_1/src/basop32.c +++ b/libs/libg722_1/src/basop32.c @@ -17,9 +17,10 @@ #include <config.h> #endif +#include <inttypes.h> + #if defined(G722_1_USE_FIXED_POINT) -#include <inttypes.h> #include <stdlib.h> #include <stdio.h> commit 2632af929d8c63447a482e16ca92f6d2c5dc1ebf Author: Daniel Swarbrick <daniel@seventhsignal.de> Date: Mon Jan 3 12:52:11 2011 +0100 FS-2953 diff --git a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c index 275fec1..45951f6 100644 --- a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c +++ b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c @@ -213,7 +213,7 @@ static switch_status_t save_cdr(const char * const template, const char * const /* * In the expanded vars, replace double quotes (") with single quotes (') - * for corect PostgreSQL syntax, and replace semi-colon with space to + * for correct PostgreSQL syntax, and replace semi-colon with space to * prevent SQL injection attacks. */ values = strdup(cdr); @@ -231,7 +231,7 @@ static switch_status_t save_cdr(const char * const template, const char * const /* * Patch for changing empty strings ('') in the expanded variables to - * Postgresql null + * PostgreSQL null */ for (p = values; *p; ++p) { if (*p == ',') { commit 09e6fd3f4ee5069491034fb150405fe7ad61fe3f Author: Leon de Rooij <leon@toyos.nl> Date: Mon Jan 3 12:20:06 2011 +0100 Make dbh:connected accessible from Lua - thanks Grmt diff --git a/src/mod/languages/mod_lua/freeswitch.i b/src/mod/languages/mod_lua/freeswitch.i index 54bdb7b..cea764d 100644 --- a/src/mod/languages/mod_lua/freeswitch.i +++ b/src/mod/languages/mod_lua/freeswitch.i @@ -82,12 +82,13 @@ class Session : public CoreSession { class Dbh { private: switch_cache_db_handle_t *dbh; - bool connected; + bool m_connected; static int query_callback(void *pArg, int argc, char **argv, char **cargv); public: Dbh(char *dsn, char *user = NULL, char *pass = NULL); ~Dbh(); bool release(); + bool connected(); bool query(char *sql, SWIGLUA_FN lua_fun); }; diff --git a/src/mod/languages/mod_lua/freeswitch_lua.cpp b/src/mod/languages/mod_lua/freeswitch_lua.cpp index d60ae73..aad87fa 100644 --- a/src/mod/languages/mod_lua/freeswitch_lua.cpp +++ b/src/mod/languages/mod_lua/freeswitch_lua.cpp @@ -318,9 +318,9 @@ Dbh::Dbh(char *dsn, char *user, char *pass) options.odbc_options.pass = pass; if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_ODBC, &options) == SWITCH_STATUS_SUCCESS) { - connected = true; + m_connected = true; } else { - connected = false; + m_connected = false; } } @@ -331,14 +331,19 @@ Dbh::~Dbh() bool Dbh::release() { - if (connected) { + if (m_connected) { switch_cache_db_release_db_handle(&dbh); - connected = false; + m_connected = false; return true; } return false; } +bool Dbh::connected() +{ + return m_connected; +} + int Dbh::query_callback(void *pArg, int argc, char **argv, char **cargv) { SWIGLUA_FN *lua_fun = (SWIGLUA_FN *)pArg; @@ -366,7 +371,7 @@ int Dbh::query_callback(void *pArg, int argc, char **argv, char **cargv) bool Dbh::query(char *sql, SWIGLUA_FN lua_fun) { - if (connected) { + if (m_connected) { if (lua_fun.L) { if (switch_cache_db_execute_sql_callback(dbh, sql, query_callback, &lua_fun, NULL) == SWITCH_STATUS_SUCCESS) { return true; diff --git a/src/mod/languages/mod_lua/freeswitch_lua.h b/src/mod/languages/mod_lua/freeswitch_lua.h index a0780b1..3c43ebd 100644 --- a/src/mod/languages/mod_lua/freeswitch_lua.h +++ b/src/mod/languages/mod_lua/freeswitch_lua.h @@ -55,12 +55,13 @@ namespace LUA { class Dbh { protected: switch_cache_db_handle_t *dbh; - bool connected; + bool m_connected; static int query_callback(void *pArg, int argc, char **argv, char **cargv); public: Dbh(char *dsn, char *user = NULL, char *pass = NULL); ~Dbh(); bool release(); + bool connected(); bool query(char *sql, SWIGLUA_FN lua_fun); }; } diff --git a/src/mod/languages/mod_lua/mod_lua_wrap.cpp b/src/mod/languages/mod_lua/mod_lua_wrap.cpp index d326466..4e29710 100644 --- a/src/mod/languages/mod_lua/mod_lua_wrap.cpp +++ b/src/mod/languages/mod_lua/mod_lua_wrap.cpp @@ -7229,6 +7229,31 @@ fail: } +static int _wrap_Dbh_connected(lua_State* L) { + int SWIG_arg = -1; + LUA::Dbh *arg1 = (LUA::Dbh *) 0 ; + bool result; + + SWIG_check_num_args("connected",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("connected",1,"LUA::Dbh *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Dbh,0))){ + SWIG_fail_ptr("Dbh_connected",1,SWIGTYPE_p_LUA__Dbh); + } + + result = (bool)(arg1)->connected(); + SWIG_arg=0; + lua_pushboolean(L,(int)(result==true)); SWIG_arg++; + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + static int _wrap_Dbh_query(lua_State* L) { int SWIG_arg = -1; LUA::Dbh *arg1 = (LUA::Dbh *) 0 ; @@ -7277,6 +7302,7 @@ delete arg1; } static swig_lua_method swig_LUA_Dbh_methods[] = { {"release", _wrap_Dbh_release}, + {"connected", _wrap_Dbh_connected}, {"query", _wrap_Dbh_query}, {0,0} }; commit 45a32dda3d09878fe07659002fd192ed8dca3575 Author: cypromis <michal.bielicki@seventhsignal.de> Date: Mon Jan 3 11:58:15 2011 +0100 added -lgpg-error to sun compiler CXXFLAGS for iksemel library and tools to be build corretly in libiksemel configure.ac diff --git a/libs/iksemel/configure.ac b/libs/iksemel/configure.ac index f768792..1b8af13 100644 --- a/libs/iksemel/configure.ac +++ b/libs/iksemel/configure.ac @@ -84,7 +84,7 @@ AC_ARG_ENABLE(64, if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then if test "${enable_64}" = "yes"; then CFLAGS="$CFLAGS -m64" - CXXFLAGS="$CXXFLAGS -m64" + CXXFLAGS="$CXXFLAGS -m64 -lgpg-error" fi fi commit ced63c35167d5f6c52583b5e70da1b2cf669c8ef Author: cypromis <michal.bielicki@seventhsignal.de> Date: Mon Jan 3 11:40:49 2011 +0100 added postgresql cdr module to modules.conf.in (commented out ) added sqlite cdr module to modules.conf.in (built by default) diff --git a/build/modules.conf.in b/build/modules.conf.in index bd5d49a..69d90a8 100644 --- a/build/modules.conf.in +++ b/build/modules.conf.in @@ -73,6 +73,8 @@ endpoints/mod_loopback #event_handlers/mod_event_multicast event_handlers/mod_event_socket event_handlers/mod_cdr_csv +event_handlers/mod_cdr_sqlite +#event_handlers/mod_cdr_pg_csv #event_handlers/mod_radius_cdr #event_handlers/mod_erlang_event formats/mod_native_file commit ec57dc7ab76e5765bbd50905e47a1cac2aad38ba Author: Steve Underwood <steveu@coppice.org> Date: Sun Jan 2 19:30:00 2011 +0800 Added missing error codes when an ECM FAX is abandoned with the T30_ERR message diff --git a/libs/spandsp/src/t30.c b/libs/spandsp/src/t30.c index 45387b8..aba4eef 100644 --- a/libs/spandsp/src/t30.c +++ b/libs/spandsp/src/t30.c @@ -4275,6 +4275,7 @@ static void process_state_iv_eor(t30_state_t *s, const uint8_t *msg, int len) break; case T30_ERR: /* TODO: Continue with the next message if MPS or EOM? */ + s->current_status = T30_ERR_RETRYDCN; s->timer_t5 = 0; send_dcn(s); break; @@ -4319,6 +4320,7 @@ static void process_state_iv_eor_rnr(t30_state_t *s, const uint8_t *msg, int len break; case T30_ERR: /* TODO: Continue with the next message if MPS or EOM? */ + s->current_status = T30_ERR_RETRYDCN; s->timer_t5 = 0; send_dcn(s); break; commit 6f5a0e9ff5984aed4b99b7a04a6cb1339b86e3b1 Author: Moises Silva <moy@sangoma.com> Date: Fri Dec 31 15:06:49 2010 -0500 freetdm: typo diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index a1c5cee..e55839a 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -4234,7 +4234,7 @@ static void print_core_usage(ftdm_stream_handle_t *stream) stream->write_function(stream, "--------------------------------------------------------------------------------\n" "ftdm core state [!]<state_name> - List all channels in or not in the given state\n" - "ftdm core flag <flag-int-value> - List all channels with the fiven flag value set\n" + "ftdm core flag <flag-int-value> - List all channels with the given flag value set\n" "ftdm core calls - List all known calls to the FreeTDM core\n" "--------------------------------------------------------------------------------\n"); } commit 2be3175ae91924a3e7460f67f0aecd927d6f2661 Author: Daniel Swarbrick <daniel@seventhsignal.de> Date: Fri Dec 31 20:54:20 2010 +0100 mod_cdr_pg_csv now spools the attempted SQL to disk if DB insert fails, instead of writing CSV. This should make it simpler to import any failed inserts. diff --git a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c index f145210..275fec1 100644 --- a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c +++ b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c @@ -53,7 +53,7 @@ typedef struct cdr_fd cdr_fd_t; const char *default_template = "\"${local_ip_v4}\",\"${caller_id_name}\",\"${caller_id_number}\",\"${destination_number}\",\"${context}\",\"${start_stamp}\"," "\"${answer_stamp}\",\"${end_stamp}\",\"${duration}\",\"${billsec}\",\"${hangup_cause}\",\"${uuid}\",\"${bleg_uuid}\",\"${accountcode}\"," - "\"${read_codec}\",\"${write_codec}\"\n"; + "\"${read_codec}\",\"${write_codec}\""; static struct { switch_memory_pool_t *pool; @@ -184,17 +184,17 @@ static void write_cdr(const char *path, const char *log_line) switch_mutex_unlock(fd->mutex); } -static switch_status_t save_cdr(const char * const table, const char * const template, const char * const cdr) +static switch_status_t save_cdr(const char * const template, const char * const cdr, const char * const log_dir) { char *columns, *values; char *p, *q; unsigned vlen; - char *query; - PGresult *res; char *nullValues, *temp, *tp; int nullCounter = 0, charCounter = 0; + char *sql = NULL, *path = NULL; + PGresult *res; - if (!table || !*table || !template || !*template || !cdr || !*cdr) { + if (!template || !*template || !cdr || !*cdr) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Bad parameter\n"); return SWITCH_STATUS_FALSE; } @@ -311,13 +311,13 @@ static switch_status_t save_cdr(const char * const table, const char * const tem //----------------------------- END_OF_PATCH ------------------------------- - query = switch_mprintf("INSERT INTO %s (%s) VALUES (%s);", table, columns, values); - assert(query); + sql = switch_mprintf("INSERT INTO %s (%s) VALUES (%s);\n", globals.db_table, columns, values); + assert(sql); free(columns); free(values); if (globals.debug) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Query: \"%s\"\n", query); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Query: \"%s\"\n", sql); } switch_mutex_lock(globals.db_mutex); @@ -330,29 +330,40 @@ static switch_status_t save_cdr(const char * const table, const char * const tem globals.db_online = 1; } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Connection to database failed: %s", PQerrorMessage(globals.db_connection)); - PQfinish(globals.db_connection); - globals.db_online = 0; - switch_mutex_unlock(globals.db_mutex); - free(query); - return SWITCH_STATUS_FALSE; + goto error; } - res = PQexec(globals.db_connection, query); + res = PQexec(globals.db_connection, sql); if (PQresultStatus(res) != PGRES_COMMAND_OK) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "INSERT command failed: %s", PQresultErrorMessage(res)); PQclear(res); - PQfinish(globals.db_connection); - globals.db_online = 0; - switch_mutex_unlock(globals.db_mutex); - free(query); - return SWITCH_STATUS_FALSE; + goto error; } + PQclear(res); - free(query); + free(sql); switch_mutex_unlock(globals.db_mutex); return SWITCH_STATUS_SUCCESS; + + + error: + + PQfinish(globals.db_connection); + globals.db_online = 0; + switch_mutex_unlock(globals.db_mutex); + + /* SQL INSERT failed for whatever reason. Spool the attempted query to disk */ + path = switch_mprintf("%s%scdr-spool.sql", log_dir, SWITCH_PATH_SEPARATOR); + assert(path); + write_cdr(path, sql); + + free(path); + free(sql); + + return SWITCH_STATUS_FALSE; + } static switch_status_t my_on_reporting(switch_core_session_t *session) @@ -360,8 +371,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) switch_channel_t *channel = switch_core_session_get_channel(session); switch_status_t status = SWITCH_STATUS_SUCCESS; const char *log_dir = NULL, *template_str = NULL; - char *log_line, *path = NULL; - int saved = 0; + char *expanded_vars = NULL; if (globals.shutdown) { return SWITCH_STATUS_SUCCESS; @@ -407,24 +417,17 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) template_str = default_template; } - log_line = switch_channel_expand_variables(channel, template_str); + expanded_vars = switch_channel_expand_variables(channel, template_str); - if (!log_line) { + if (!expanded_vars) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error expanding CDR variables.\n"); return SWITCH_STATUS_FALSE; } - saved = save_cdr(globals.db_table, template_str, log_line); + save_cdr(template_str, expanded_vars, log_dir); - if (!saved) { - path = switch_mprintf("%s%sMaster.csv", log_dir, SWITCH_PATH_SEPARATOR); - assert(path); - write_cdr(path, log_line); - free(path); - } - - if (log_line != template_str) { - free(log_line); + if (expanded_vars != template_str) { + free(expanded_vars); } return status; @@ -535,13 +538,7 @@ static switch_status_t load_config(switch_memory_pool_t *pool) char *var = (char *) switch_xml_attr(param, "name"); if (var) { char *tpl; - size_t len = strlen(param->txt) + 2; - if (end_of(param->txt) != '\n') { - tpl = switch_core_alloc(pool, len); - switch_snprintf(tpl, len, "%s\n", param->txt); - } else { - tpl = switch_core_strdup(pool, param->txt); - } + tpl = switch_core_strdup(pool, param->txt); switch_core_hash_insert(globals.template_hash, var, tpl); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding template %s.\n", var); diff --git a/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c b/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c index ca92818..534f18f 100644 --- a/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c +++ b/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c @@ -113,7 +113,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) switch_channel_t *channel = switch_core_session_get_channel(session); switch_status_t status = SWITCH_STATUS_SUCCESS; const char *template_str = NULL; - char *expanded_vars, *sql = NULL; + char *expanded_vars = NULL, *sql = NULL; if (globals.shutdown) { return SWITCH_STATUS_SUCCESS; commit 9ab7473cb97248efa46acda5a44f0e1a1207c646 Author: Daniel Swarbrick <daniel@seventhsignal.de> Date: Fri Dec 31 20:13:19 2010 +0100 Drop a-table/g-table stuff, use single DB table. Filtering should be done by SQL diff --git a/conf/autoload_configs/cdr_pg_csv.conf.xml b/conf/autoload_configs/cdr_pg_csv.conf.xml index 69eb90c..bddd387 100644 --- a/conf/autoload_configs/cdr_pg_csv.conf.xml +++ b/conf/autoload_configs/cdr_pg_csv.conf.xml @@ -7,20 +7,14 @@ <param name="legs" value="a"/> <!-- See parameters for PQconnectdb() at http://www.postgresql.org/docs/8.4/static/libpq-connect.html --> <param name="db-info" value="host=localhost dbname=cdr connect_timeout=10" /> - <!-- Global CDR table --> - <!--<param name="g-table" value="g"/>--> - <!-- Per-accountcode CDR table --> - <!--<param name="a-table" value="a"/>--> + <!-- CDR table name --> + <!--<param name="db-table" value="cdr"/>--> <param name="default-template" value="example"/> <!-- This is like the info app but after the call is hung up --> <!--<param name="debug" value="true"/>--> </settings> <templates> - <template name="sql">INSERT INTO cdr VALUES ("${caller_id_name}","${caller_id_number}","${destination_number}","${context}","${start_stamp}","${answer_stamp}","${end_stamp}","${duration}","${billsec}","${hangup_cause}","${uuid}","${bleg_uuid}", "${accountcode}");</template> <template name="example">"${local_ip_v4}","${caller_id_name}","${caller_id_number}","${destination_number}","${context}","${start_stamp}","${answer_stamp}","${end_stamp}","${duration}","${billsec}","${hangup_cause}","${uuid}","${bleg_uuid}","${accountcode}","${read_codec}","${write_codec}","${sip_hangup_disposition}","${ani}"</template> - <template name="snom">"${caller_id_name}","${caller_id_number}","${destination_number}","${context}","${start_stamp}","${answer_stamp}","${end_stamp}","${duration}","${billsec}","${hangup_cause}","${uuid}","${bleg_uuid}", "${accountcode}","${read_codec}","${write_codec}","${sip_user_agent}","${call_clientcode}","${sip_rtp_rxstat}","${sip_rtp_txstat}","${sofia_record_file}"</template> - <template name="linksys">"${caller_id_name}","${caller_id_number}","${destination_number}","${context}","${start_stamp}","${answer_stamp}","${end_stamp}","${duration}","${billsec}","${hangup_cause}","${uuid}","${bleg_uuid}","${accountcode}","${read_codec}","${write_codec}","${sip_user_agent}","${sip_p_rtp_stat}"</template> - <template name="asterisk">"${accountcode}","${caller_id_number}","${destination_number}","${context}","${caller_id}","${channel_name}","${bridge_channel}","${last_app}","${last_arg}","${start_stamp}","${answer_stamp}","${end_stamp}","${duration}","${billsec}","${hangup_cause}","${amaflags}","${uuid}","${userfield}"</template> </templates> </configuration> diff --git a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c index 3317436..f145210 100644 --- a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c +++ b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c @@ -52,8 +52,8 @@ typedef struct cdr_fd cdr_fd_t; const char *default_template = "\"${local_ip_v4}\",\"${caller_id_name}\",\"${caller_id_number}\",\"${destination_number}\",\"${context}\",\"${start_stamp}\"," - "\"${answer_stamp}\",\"${end_stamp}\",\"${duration}\",\"${billsec}\",\"${hangup_cause}\",\"${uuid}\",\"${bleg_uuid}\", \"${accountcode}\"," - "\"${read_codec}\", \"${write_codec}\"\n"; + "\"${answer_stamp}\",\"${end_stamp}\",\"${duration}\",\"${billsec}\",\"${hangup_cause}\",\"${uuid}\",\"${bleg_uuid}\",\"${accountcode}\"," + "\"${read_codec}\",\"${write_codec}\"\n"; static struct { switch_memory_pool_t *pool; @@ -65,9 +65,8 @@ static struct { int rotate; int debug; cdr_leg_t legs; - char *a_table; - char *g_table; char *db_info; + char *db_table; PGconn *db_connection; int db_online; switch_mutex_t *db_mutex; @@ -185,7 +184,7 @@ static void write_cdr(const char *path, const char *log_line) switch_mutex_unlock(fd->mutex); } -static int save_cdr(const char * const table, const char * const template, const char * const cdr) +static switch_status_t save_cdr(const char * const table, const char * const template, const char * const cdr) { char *columns, *values; char *p, *q; @@ -197,7 +196,7 @@ static int save_cdr(const char * const table, const char * const template, const if (!table || !*table || !template || !*template || !cdr || !*cdr) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Bad parameter\n"); - return 0; + return SWITCH_STATUS_FALSE; } /* Build comma-separated list of field names by dropping $ { } ; chars */ @@ -212,7 +211,8 @@ static int save_cdr(const char * const table, const char * const template, const } *q = '\0'; - /* In the expanded vars, replace double quotes (") with single quotes (') + /* + * In the expanded vars, replace double quotes (") with single quotes (') * for corect PostgreSQL syntax, and replace semi-colon with space to * prevent SQL injection attacks. */ @@ -248,7 +248,6 @@ static int save_cdr(const char * const table, const char * const template, const nullCounter++; } - charCounter = 0; nullCounter *= 4; vlen += nullCounter; nullValues = (char *) malloc(strlen(values) + nullCounter + 1); @@ -335,7 +334,7 @@ static int save_cdr(const char * const table, const char * const template, const globals.db_online = 0; switch_mutex_unlock(globals.db_mutex); free(query); - return 0; + return SWITCH_STATUS_FALSE; } res = PQexec(globals.db_connection, query); @@ -346,21 +345,21 @@ static int save_cdr(const char * const table, const char * const template, const globals.db_online = 0; switch_mutex_unlock(globals.db_mutex); free(query); - return 0; + return SWITCH_STATUS_FALSE; } PQclear(res); free(query); switch_mutex_unlock(globals.db_mutex); - return 1; + return SWITCH_STATUS_SUCCESS; } static switch_status_t my_on_reporting(switch_core_session_t *session) { switch_channel_t *channel = switch_core_session_get_channel(session); switch_status_t status = SWITCH_STATUS_SUCCESS; - const char *log_dir = NULL, *accountcode = NULL, *a_template_str = NULL, *g_template_str = NULL; + const char *log_dir = NULL, *template_str = NULL; char *log_line, *path = NULL; int saved = 0; @@ -402,44 +401,20 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) } } - g_template_str = (const char *) switch_core_hash_find(globals.template_hash, globals.default_template); - - if ((accountcode = switch_channel_get_variable(channel, "ACCOUNTCODE"))) { - a_template_str = (const char *) switch_core_hash_find(globals.template_hash, accountcode); - } + template_str = (const char *) switch_core_hash_find(globals.template_hash, globals.default_template); - if (!g_template_str) { - g_template_str = "\"${accountcode}\",\"${caller_id_number}\",\"${destination_number}\",\"${context}\",\"${caller_id}\",\"${channel_name}\",\"${bridge_channel}\",\"${last_app}\",\"${last_arg}\",\"${start_stamp}\",\"${answer_stamp}\",\"${end_stamp}\",\"${duration}\",\"${billsec}\",\"${hangup_cause}\",\"${amaflags}\",\"${uuid}\",\"${userfield}\";"; + if (!template_str) { + template_str = default_template; } - if (!a_template_str) { - a_template_str = g_template_str; - } - - log_line = switch_channel_expand_variables(channel, a_template_str); - - saved = 1; // save_cdr(globals.a_table, a_template_str, log_line); - - if (!saved && accountcode) { - path = switch_mprintf("%s%s%s.csv", log_dir, SWITCH_PATH_SEPARATOR, accountcode); - assert(path); - write_cdr(path, log_line); - free(path); - } - - if (g_template_str != a_template_str) { - if (log_line != a_template_str) { - switch_safe_free(log_line); - } - log_line = switch_channel_expand_variables(channel, g_template_str); - } + log_line = switch_channel_expand_variables(channel, template_str); if (!log_line) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating cdr\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error expanding CDR variables.\n"); return SWITCH_STATUS_FALSE; } - saved = save_cdr(globals.g_table, g_template_str, log_line); + saved = save_cdr(globals.db_table, template_str, log_line); if (!saved) { path = switch_mprintf("%s%sMaster.csv", log_dir, SWITCH_PATH_SEPARATOR); @@ -448,7 +423,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) free(path); } - if (log_line != g_template_str) { + if (log_line != template_str) { free(log_line); } @@ -545,14 +520,12 @@ static switch_status_t load_config(switch_memory_pool_t *pool) globals.log_dir = switch_core_sprintf(pool, "%s%scdr-pg-csv", val, SWITCH_PATH_SEPARATOR); } else if (!strcasecmp(var, "rotate-on-hup")) { globals.rotate = switch_true(val); - } else if (!strcasecmp(var, "default-template")) { - globals.default_template = switch_core_strdup(pool, val); - } else if (!strcasecmp(var, "a-table")) { - globals.a_table = switch_core_strdup(pool, val); - } else if (!strcasecmp(var, "g-table")) { - globals.g_table = switch_core_strdup(pool, val); } else if (!strcasecmp(var, "db-info")) { globals.db_info = switch_core_strdup(pool, val); + } else if (!strcasecmp(var, "db-table") || !strcasecmp(var, "g-table")) { + globals.db_table = switch_core_strdup(pool, val); + } else if (!strcasecmp(var, "default-template")) { + globals.default_template = switch_core_strdup(pool, val); } } } @@ -578,27 +551,23 @@ static switch_status_t load_config(switch_memory_pool_t *pool) switch_xml_free(xml); } - - if (zstr(globals.default_template)) { - globals.default_template = switch_core_strdup(pool, "default"); - } - if (!globals.log_dir) { globals.log_dir = switch_core_sprintf(pool, "%s%scdr-pg-csv", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR); } - if (zstr(globals.a_table)) { - globals.a_table = switch_core_strdup(pool, "a"); + if (zstr(globals.db_info)) { + globals.db_info = switch_core_strdup(pool, "dbname=cdr"); } - if (zstr(globals.g_table)) { - globals.g_table = switch_core_strdup(pool, "g"); + if (zstr(globals.db_table)) { + globals.db_table = switch_core_strdup(pool, "cdr"); } - if (zstr(globals.db_info)) { - globals.db_info = switch_core_strdup(pool, "dbname = cdr"); + if (zstr(globals.default_template)) { + globals.default_template = switch_core_strdup(pool, "default"); } + return status; } commit fe0d8d1ec508d96d6edc08ec610f142633e896bf Author: Moises Silva <moy@sangoma.com> Date: Fri Dec 31 13:44:20 2010 -0500 freetdm: - updated all signaling modules (except for ftmod_isdn and ftmod_sangoma_ss7) to adapt to new core state processing - fixed bug in configure.ac to detect ftmod_pritap compilation - ignore FTDM_SIGEVENT_RELEASED and FTDM_SIGEVENT_INDICATION_COMPLETED in mod_freetdm - Destroy the state completed interrupt on channel destroy - Fix analog polarity reversal bug when using 3-way calling or call-swap diff --git a/libs/freetdm/configure.ac b/libs/freetdm/configure.ac index e26f10b..a070e99 100644 --- a/libs/freetdm/configure.ac +++ b/libs/freetdm/configure.ac @@ -160,7 +160,7 @@ AC_ARG_WITH([pritap], [AS_HELP_STRING([--with-pritap], [Install ftmod_pritap])], [case "${withval}" in no) enable_pritap="no" ;; - *) enable_pritab="yes" ;; + *) enable_pritap="yes" ;; esac], [enable_pritap="no"] ) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index e08d4c1..7bbdef6 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1642,6 +1642,14 @@ static FIO_SIGNAL_CB_FUNCTION(on_common_signal) } return FTDM_SUCCESS; } + + case FTDM_SIGEVENT_RELEASED: + case FTDM_SIGEVENT_INDICATION_COMPLETED: + { + /* Swallow these events */ + return FTDM_BREAK; + } + break; default: return FTDM_SUCCESS; break; @@ -1732,7 +1740,6 @@ static FIO_SIGNAL_CB_FUNCTION(on_fxo_signal) } } break; - case FTDM_SIGEVENT_RELEASED: { /* twiddle */ } break; case FTDM_SIGEVENT_SIGSTATUS_CHANGED: { /* twiddle */ } break; default: @@ -1788,7 +1795,6 @@ static FIO_SIGNAL_CB_FUNCTION(on_fxs_signal) } } break; - case FTDM_SIGEVENT_RELEASED: { /* twiddle */ } break; case FTDM_SIGEVENT_STOP: { @@ -2015,8 +2021,6 @@ static FIO_SIGNAL_CB_FUNCTION(on_r2_signal) } break; - case FTDM_SIGEVENT_RELEASED: { /* twiddle */ } break; - /* on DNIS received from the R2 forward side, return status == FTDM_BREAK to stop requesting DNIS */ case FTDM_SIGEVENT_COLLECTED_DIGIT: { @@ -2135,8 +2139,6 @@ static FIO_SIGNAL_CB_FUNCTION(on_clear_channel_signal) } break; - case FTDM_SIGEVENT_RELEASED: { /* twiddle */ } break; - case FTDM_SIGEVENT_STOP: case FTDM_SIGEVENT_RESTART: { diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 5c900b9..a1c5cee 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -615,6 +615,9 @@ static ftdm_status_t ftdm_channel_destroy(ftdm_channel_t *ftdmchan) ftdm_mutex_destroy(&ftdmchan->mutex); ftdm_mutex_destroy(&ftdmchan->pre_buffer_mutex); + if (ftdmchan->state_completed_interrupt) { + ftdm_interrupt_destroy(&ftdmchan->state_completed_interrupt); + } } return FTDM_SUCCESS; diff --git a/libs/freetdm/src/ftdm_state.c b/libs/freetdm/src/ftdm_state.c index 2f42282..0221fa2 100644 --- a/libs/freetdm/src/ftdm_state.c +++ b/libs/freetdm/src/ftdm_state.c @@ -103,7 +103,7 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_complete_state(const char *file, const c if (ftdm_test_flag(fchan, FTDM_CHANNEL_BLOCKING)) { ftdm_clear_flag(fchan, FTDM_CHANNEL_BLOCKING); - ftdm_interrupt_signal(fchan->state_change_notify); + ftdm_interrupt_signal(fchan->state_completed_interrupt); } return FTDM_SUCCESS; @@ -194,8 +194,8 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_set_state(const char *file, const char *f return FTDM_FAIL; } - if (!ftdmchan->state_change_notify) { - status = ftdm_interrupt_create(&ftdmchan->state_change_notify, FTDM_INVALID_SOCKET); + if (!ftdmchan->state_completed_interrupt) { + status = ftdm_interrupt_create(&ftdmchan->state_completed_interrupt, FTDM_INVALID_SOCKET); if (status != FTDM_SUCCESS) { ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_CRIT, "Failed to create state change interrupt when moving from %s to %s\n", ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state)); @@ -323,17 +323,23 @@ end: goto done; } + if (!waitrq) { + /* no waiting was requested */ + goto done; + } + + /* let's wait for the state change to be completed by the signaling stack */ ftdm_set_flag(ftdmchan, FTDM_CHANNEL_BLOCKING); ftdm_mutex_unlock(ftdmchan->mutex); - status = ftdm_interrupt_wait(ftdmchan->state_change_notify, waitms); + status = ftdm_interrupt_wait(ftdmchan->state_completed_interrupt, waitms); ftdm_mutex_lock(ftdmchan->mutex); if (status != FTDM_SUCCESS) { ftdm_log_chan_ex(ftdmchan, file, func, line, - FTDM_LOG_LEVEL_WARNING, "state change from %s to %s was most likely not processed after aprox %dms\n", + FTDM_LOG_LEVEL_WARNING, "state change from %s to %s was most likely not completed after aprox %dms\n", ftdm_channel_state2str(ftdmchan->last_state), ftdm_channel_state2str(state), DEFAULT_WAIT_TIME); ok = 0; goto done; @@ -437,6 +443,8 @@ FT_DECLARE(char *) ftdm_channel_get_history_str(const ftdm_channel_t *fchan) FT_DECLARE(ftdm_status_t) ftdm_channel_advance_states(ftdm_channel_t *fchan) { ftdm_channel_state_t state; + + ftdm_assert_return(fchan->span->state_processor, FTDM_FAIL, "Cannot process states without a state processor!\n"); while (fchan->state_status == FTDM_STATE_STATUS_NEW) { state = fchan->state; diff --git a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c index 981df5d..818f1c5 100644 --- a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c +++ b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c @@ -585,8 +585,8 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) if (done) { ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_STATE_CHANGE); ftdm_clear_flag_locked(ftdmchan->span, FTDM_SPAN_STATE_CHANGE); + ftdm_channel_complete_state(ftdmchan); ftdmchan->detected_tones[FTDM_TONEMAP_CALLWAITING_ACK] = 0; } } @@ -628,7 +628,6 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) break; } } else { - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_STATE_CHANGE); ftdm_clear_flag_locked(ftdmchan->span, FTDM_SPAN_STATE_CHANGE); ftdm_channel_complete_state(ftdmchan); indicate = 0; @@ -672,11 +671,12 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) && ftdm_test_flag(analog_data, FTDM_ANALOG_ANSWER_POLARITY_REVERSE)) { ftdm_polarity_t polarity = FTDM_POLARITY_REVERSE; - if (ftdmchan->polarity != FTDM_POLARITY_FORWARD) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Polarity is already reversed on answer??\n"); - } else { + if (ftdmchan->polarity == FTDM_POLARITY_FORWARD) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Reversing polarity on answer\n"); ftdm_channel_command(ftdmchan, FTDM_COMMAND_SET_POLARITY, &polarity); + } else { + /* the polarity may be already reversed if this is the second time we + * answer (ie, due to 2 calls being on the same line) */ } } @@ -1036,8 +1036,8 @@ static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *e if (event->channel->state != FTDM_CHANNEL_STATE_DOWN) { if (event->channel->state == FTDM_CHANNEL_STATE_HANGUP && ftdm_test_flag(event->channel, FTDM_CHANNEL_STATE_CHANGE)) { - ftdm_clear_flag(event->channel, FTDM_CHANNEL_STATE_CHANGE); /* we do not need to process HANGUP since the device also hangup already */ + ftdm_channel_complete_state(event->channel); } ftdm_set_state(event->channel, FTDM_CHANNEL_STATE_DOWN); } @@ -1052,8 +1052,8 @@ static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *e { if (event->channel->state == FTDM_CHANNEL_STATE_CALLWAITING) { ftdm_set_state(event->channel, FTDM_CHANNEL_STATE_UP); - ftdm_clear_flag(event->channel, FTDM_CHANNEL_STATE_CHANGE); ftdm_clear_flag(event->channel->span, FTDM_SPAN_STATE_CHANGE); + ftdm_channel_complete_state(event->channel); event->channel->detected_tones[FTDM_TONEMAP_CALLWAITING_ACK] = 0; } diff --git a/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c b/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c index 843ac48..31c2421 100644 --- a/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c +++ b/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c @@ -355,7 +355,6 @@ static void *ftdm_analog_em_channel_run(ftdm_thread_t *me, void *obj) break; } } else { - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_STATE_CHANGE); ftdm_clear_flag_locked(ftdmchan->span, FTDM_SPAN_STATE_CHANGE); ftdm_channel_complete_state(ftdmchan); indicate = 0; diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 1d3c76d..8be6d57 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -497,7 +497,7 @@ static ftdm_state_map_t isdn_state_map = { * \param ftdmchan Channel to handle * \note This function MUST be called with the channel locked */ -static __inline__ void state_advance(ftdm_channel_t *chan) +static ftdm_status_t state_advance(ftdm_channel_t *chan) { ftdm_libpri_data_t *isdn_data = chan->span->signal_data; q931_call *call = (q931_call *)chan->call_data; @@ -511,6 +511,8 @@ static __inline__ void state_advance(ftdm_channel_t *chan) sig.chan_id = ftdm_channel_get_id(chan); sig.span_id = ftdm_channel_get_span_id(chan); sig.channel = chan; + + ftdm_channel_complete_state(chan); switch (ftdm_channel_get_state(chan)) { case FTDM_CHANNEL_STATE_DOWN: @@ -625,7 +627,7 @@ static __inline__ void state_advance(ftdm_channel_t *chan) ftdm_channel_get_span_id(chan), ftdm_channel_get_id(chan)); /* TODO: set hangup cause? */ ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART); - return; + return FTDM_SUCCESS; } ton = caller_data->dnis.type; @@ -708,6 +710,7 @@ static __inline__ void state_advance(ftdm_channel_t *chan) default: break; } + return FTDM_SUCCESS; } /** @@ -723,13 +726,8 @@ static __inline__ void check_state(ftdm_span_t *span) for (j = 1; j <= ftdm_span_get_chan_count(span); j++) { ftdm_channel_t *chan = ftdm_span_get_channel(span, j); - ftdm_channel_lock(chan); - while (ftdm_test_flag(chan, FTDM_CHANNEL_STATE_CHANGE)) { - ftdm_clear_flag(chan, FTDM_CHANNEL_STATE_CHANGE); - state_advance(chan); - ftdm_channel_complete_state(chan); - } + ftdm_channel_advance_states(chan); ftdm_channel_unlock(chan); } } @@ -1910,6 +1908,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) span->outgoing_call = isdn_outgoing_call; span->state_map = &isdn_state_map; + span->state_processor = state_advance; span->get_channel_sig_status = isdn_get_channel_sig_status; span->get_span_sig_status = isdn_get_span_sig_status; diff --git a/libs/freetdm/src/ftmod/ftmod_pritap/ftmod_pritap.c b/libs/freetdm/src/ftmod/ftmod_pritap/ftmod_pritap.c index 27fbe21..48a2f01 100644 --- a/libs/freetdm/src/ftmod/ftmod_pritap/ftmod_pritap.c +++ b/libs/freetdm/src/ftmod/ftmod_pritap/ftmod_pritap.c @@ -265,7 +265,7 @@ static ftdm_state_map_t pritap_state_map = { } }; -static __inline__ void state_advance(ftdm_channel_t *ftdmchan) +static ftdm_status_t state_advance(ftdm_channel_t *ftdmchan) { ftdm_status_t status; ftdm_sigmsg_t sig; @@ -278,6 +278,8 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) sig.span_id = ftdmchan->span_id; sig.channel = ftdmchan; + ftdm_channel_complete_state(ftdmchan); + switch (ftdmchan->state) { case FTDM_CHANNEL_STATE_DOWN: { @@ -321,24 +323,20 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) break; } - return; + return FTDM_SUCCESS; } static __inline__ void pritap_check_state(ftdm_span_t *span) { - if (ftdm_test_flag(span, FTDM_SPAN_STATE_CHANGE)) { - uint32_t j; - ftdm_clear_flag_locked(span, FTDM_SPAN_STATE_CHANGE); - for(j = 1; j <= span->chan_count; j++) { - if (ftdm_test_flag((span->channels[j]), FTDM_CHANNEL_STATE_CHANGE)) { - ftdm_mutex_lock(span->channels[j]->mutex); - ftdm_clear_flag((span->channels[j]), FTDM_CHANNEL_STATE_CHANGE); - state_advance(span->channels[j]); - ftdm_channel_complete_state(span->channels[j]); - ftdm_mutex_unlock(span->channels[j]->mutex); - } - } - } + if (ftdm_test_flag(span, FTDM_SPAN_STATE_CHANGE)) { + uint32_t j; + ftdm_clear_flag_locked(span, FTDM_SPAN_STATE_CHANGE); + for(j = 1; j <= span->chan_count; j++) { + ftdm_mutex_lock(span->channels[j]->mutex); + ftdm_channel_advance_states(span->channels[j]); + ftdm_mutex_unlock(span->channels[j]->mutex); + } + } } static int pri_io_read(struct pri *pri, void *buf, int buflen) @@ -896,6 +894,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_pritap_configure_span) span->get_span_sig_status = pritap_get_span_sig_status; span->state_map = &pritap_state_map; + span->state_processor = state_advance; return FTDM_SUCCESS; } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c index 97e242d..d0bc14c 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c @@ -951,7 +951,6 @@ static void handle_call_answer(ftdm_span_t *span, sangomabc_connection_t *mcon, } } -static __inline__ void advance_chan_states(ftdm_channel_t *ftdmchan); static __inline__ void stop_loop(ftdm_channel_t *ftdmchan); /** @@ -1002,7 +1001,7 @@ tryagain: } else if (ftdmchan->state == FTDM_CHANNEL_STATE_IN_LOOP && retry) { retry = 0; stop_loop(ftdmchan); - advance_chan_states(ftdmchan); + ftdm_channel_advance_states(ftdmchan); goto tryagain; } else { ftdm_log(FTDM_LOG_ERROR, "s%dc%d: rejecting incoming call in channel state %s\n", @@ -1267,7 +1266,7 @@ static ftdm_channel_t* event_process_states(ftdm_span_t *span, sangomabc_short_e } ftdm_mutex_lock(ftdmchan->mutex); - advance_chan_states(ftdmchan); + ftdm_channel_advance_states(ftdmchan); return ftdmchan; } @@ -1354,11 +1353,11 @@ static int parse_sangoma_event(ftdm_span_t *span, sangomabc_connection_t *mcon, } if(ftdmchan != NULL) { - advance_chan_states(ftdmchan); + ftdm_channel_advance_states(ftdmchan); ftdm_mutex_unlock(ftdmchan->mutex); } - return 0; + return 0; } @@ -1366,7 +1365,7 @@ static int parse_sangoma_event(ftdm_span_t *span, sangomabc_connection_t *mcon, * \brief Handler for channel state change * \param ftdmchan Channel to handle */ -static __inline__ ftdm_status_t state_advance(ftdm_channel_t *ftdmchan) +static ftdm_status_t state_advance(ftdm_channel_t *ftdmchan) { ftdm_sangoma_boost_data_t *sangoma_boost_data = ftdmchan->span->signal_data; sangomabc_connection_t *mcon = &sangoma_boost_data->mcon; @@ -1374,12 +1373,6 @@ static __inline__ ftdm_status_t state_advance(ftdm_channel_t *ftdmchan) ftdm_status_t status; - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE); - } else { - return FTDM_SUCCESS; - } - ftdm_assert_return(ftdmchan->last_state != ftdmchan->state, FTDM_FAIL, "Channel state already processed\n"); ftdm_log(FTDM_LOG_DEBUG, "%d:%d PROCESSING STATE [%s]\n", ftdmchan->span_id, ftdmchan->chan_id, ftdm_channel_state2str(ftdmchan->state)); @@ -1389,6 +1382,8 @@ static __inline__ ftdm_status_t state_advance(ftdm_channel_t *ftdmchan) sig.span_id = ftdmchan->span_id; sig.channel = ftdmchan; + ftdm_channel_complete_state(ftdmchan); + switch (ftdmchan->state) { case FTDM_CHANNEL_STATE_DOWN: { @@ -1640,24 +1635,15 @@ static __inline__ ftdm_status_t state_advance(ftdm_channel_t *ftdmchan) default: break; } - ftdm_channel_complete_state(ftdmchan); return FTDM_SUCCESS; } -static __inline__ void advance_chan_states(ftdm_channel_t *ftdmchan) -{ - while (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { - state_advance(ftdmchan); - } -} - /** * \brief Initialises outgoing requests array */ static __inline__ void init_outgoing_array(void) { memset(&OUTBOUND_REQUESTS, 0, sizeof(OUTBOUND_REQUESTS)); - } /** @@ -1685,7 +1671,7 @@ static __inline__ void check_state(ftdm_span_t *span) if (susp && span->channels[j]->state != FTDM_CHANNEL_STATE_DOWN) { ftdm_set_state(span->channels[j], FTDM_CHANNEL_STATE_RESTART); } - state_advance(span->channels[j]); + ftdm_channel_advance_states(span->channels[j]); ftdm_mutex_unlock(span->channels[j]->mutex); } } @@ -1695,7 +1681,7 @@ static __inline__ void check_state(ftdm_span_t *span) * but without taking the chan out of the queue, so check th * flag before advancing the state */ ftdm_mutex_lock(ftdmchan->mutex); - state_advance(ftdmchan); + ftdm_channel_advance_states(ftdmchan); ftdm_mutex_unlock(ftdmchan->mutex); } } @@ -2687,6 +2673,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_boost_configure_span) span->get_span_sig_status = sangoma_boost_get_span_sig_status; span->set_span_sig_status = sangoma_boost_set_span_sig_status; span->state_map = &boost_state_map; + span->state_processor = state_advance; sangoma_boost_data->mcon.debuglevel = FTDM_LOG_LEVEL_DEBUG; sangoma_boost_data->pcon.debuglevel = FTDM_LOG_LEVEL_DEBUG; ftdm_clear_flag(span, FTDM_SPAN_SUGGEST_CHAN_ID); diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 3e8ad28..38bc611 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -583,10 +583,10 @@ typedef enum { FTDM_COMMAND_GET_LINK_STATUS, FTDM_COMMAND_ENABLE_LOOP, FTDM_COMMAND_DISABLE_LOOP, - FTDM_COMMAND_COUNT, FTDM_COMMAND_SET_RX_QUEUE_SIZE, FTDM_COMMAND_SET_TX_QUEUE_SIZE, FTDM_COMMAND_SET_POLARITY, + FTDM_COMMAND_COUNT, } ftdm_command_t; typedef enum { diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index 829b406..55fb8ba 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -462,7 +462,7 @@ struct ftdm_channel { ftdm_dtmf_debug_t dtmfdbg; ftdm_io_dump_t rxdump; ftdm_io_dump_t txdump; - ftdm_interrupt_t *state_change_notify; /*!< Notify when a state change is terminated */ + ftdm_interrupt_t *state_completed_interrupt; /*!< Notify when a state change is completed */ int32_t txdrops; int32_t rxdrops; }; commit f79f9766ba35f8d488b4ba33c7814fc3c30de7f7 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Dec 31 11:59:33 2010 -0600 don't let inherit_codec work when we have ep_codec_string set and the B-leg codec is not in that list since it will lead to failure diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 26d8374..28af589 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -384,8 +384,9 @@ static void inherit_codec(switch_channel_t *caller_channel, switch_core_session_ switch_codec_implementation_t video_impl = { 0 }; char tmp[128] = ""; - if (switch_core_session_get_read_impl(session, &impl) == SWITCH_STATUS_SUCCESS) { + const char *ep = switch_channel_get_variable(caller_channel, "ep_codec_string"); + if (switch_core_session_get_video_read_impl(session, &video_impl) == SWITCH_STATUS_SUCCESS) { switch_snprintf(tmp, sizeof(tmp), "%s@%uh@%ui,%s", impl.iananame, impl.samples_per_second, impl.microseconds_per_packet / 1000, @@ -394,9 +395,15 @@ static void inherit_codec(switch_channel_t *caller_channel, switch_core_session_ switch_snprintf(tmp, sizeof(tmp), "%s@%uh@%ui", impl.iananame, impl.samples_per_second, impl.microseconds_per_packet / 1000); } - switch_channel_set_variable(caller_channel, "absolute_codec_string", tmp); - switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(caller_channel), SWITCH_LOG_DEBUG, "Setting codec string on %s to %s\n", - switch_channel_get_name(caller_channel), tmp); + + if (ep && switch_stristr(impl.iananame, ep)) { + switch_channel_set_variable(caller_channel, "absolute_codec_string", tmp); + switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(caller_channel), SWITCH_LOG_DEBUG, "Setting codec string on %s to %s\n", + switch_channel_get_name(caller_channel), tmp); + } else { + switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(caller_channel), SWITCH_LOG_DEBUG, "Codec string %s not supported on %s, skipping inheritance\n", + tmp, switch_channel_get_name(caller_channel)); + } } else { switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(caller_channel), SWITCH_LOG_WARNING, "Error inheriting codec. Channel %s has no read codec yet.\n", commit e897646e1557282d6cfbf6c0c66d048222f7942e Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Dec 31 10:09:40 2010 -0600 make exact matches return sooner in dmachine diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 0459f2b..5d35524 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -282,9 +282,10 @@ static dm_match_t switch_ivr_dmachine_check_match(switch_ivr_dmachine_t *dmachin best = DM_MATCH_EXACT; exact_bp = bp; if (dmachine->cur_digit_len == dmachine->max_digit_len) break; - } + } - if (!(both_bp && partial_bp) && !strncmp(dmachine->digits, bp->digits, strlen(dmachine->digits))) { + if (!(both_bp && partial_bp) && strlen(bp->digits) != strlen(dmachine->digits) && + !strncmp(dmachine->digits, bp->digits, strlen(dmachine->digits))) { if (exact_bp) { best = DM_MATCH_BOTH; both_bp = bp; commit 24febbea8e29c75d6dcfaea6d7bd871c0592d207 Author: Michal Bielicki <michal.bielicki@seventhsignal.de> Date: Fri Dec 31 16:51:54 2010 +0100 added mod_cdr_sqlite to specfile diff --git a/freeswitch.spec b/freeswitch.spec index ceacfba..05401b8 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -379,7 +379,7 @@ ENDPOINTS_MODULES="endpoints/mod_dingaling endpoints/mod_loopback ../../libs/fre # Event Handlers # ###################################################################################################################### -EVENT_HANDLERS_MODULES="event_handlers/mod_cdr_csv event_handlers/mod_event_socket event_handlers/mod_event_multicast" +EVENT_HANDLERS_MODULES="event_handlers/mod_cdr_csv event_handlers/mod_cdr_sqlite event_handlers/mod_event_socket event_handlers/mod_event_multicast" ###################################################################################################################### # # File and Audio Format Handlers @@ -620,6 +620,7 @@ fi %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/callcenter.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/cdr_csv.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/cdr_pg_csv.conf.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/cdr_sqlite.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/cidlookup.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/conference.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/console.conf.xml @@ -746,6 +747,7 @@ fi %{prefix}/mod/mod_bv.so* %{prefix}/mod/mod_callcenter.so* %{prefix}/mod/mod_cdr_csv.so* +%{prefix}/mod/mod_cdr_sqlite.so* %{prefix}/mod/mod_celt.so* %{prefix}/mod/mod_cidlookup.so* %{prefix}/mod/mod_cluechoo.so* commit 39d58e0452f9af4b67f4c9d1056a49cc765ef000 Author: Moises Silva <moy@sangoma.com> Date: Fri Dec 31 09:42:15 2010 -0500 freetdm: - Update ftmod_sangoma_isdn to use core state advance - Added locking documentation (docs/locking.txt) - Updated core state advance to use state processor in span rather than pushing the processor in the function arguments diff --git a/libs/freetdm/docs/locking.txt b/libs/freetdm/docs/locking.txt new file mode 100644 index 0000000..851d045 --- /dev/null +++ b/libs/freetdm/docs/locking.txt @@ -0,0 +1,125 @@ +Last Updated: Fri 30 Dec, 2010 + +== Background == + +FreeTDM is a threaded library. As such, locking considerations must be taken when using it and when writing code inside the library. + +At the moment locks are not exposed to users. This means API users cannot acquire a lock on a channel or span structure. There is no +need for users to lock channels or spans since all their interactions with those structures should be done thru the FreeTDM API which +can (and in most cases must) internally lock on their behalf. + +Internally, locking can be done either by the core or the signaling modules. To better understand the locking considerations we must +understand first the threading model of FreeTDM. + +== Threading Model == + +At startup, when the user calls ftdm_global_init(), just one timing thread is created to dispatch internal timers. If you write +a signaling module or any other code using the scheduling API, you can choose to run your schedule in this timing thread or in +a thread of your choice. This is the only thread launched at initialization. + +If the application decides to use ftdm_global_configuration(), which reads freetdm.conf to create the spans and channels data +structures, then possibly another thread will be launched for CPU usage monitoring (only if enabled in the configuration cpu_monitor=yes +This thread sole purpose is to check the CPU and raise an alarm if reaches a configurable threshold, the alarm then is checked to avoid +placing or receiving further calls. + +At this point FreeTDM has initialized and configured its channels input output configuration. + +The user is then supposed to configure the signaling via ftdm_configure_span_signaling() and then start the signaling work +using ftdm_span_start(). This will typically launch at least 1 thread per span. Some signaling modules (actually just the analog one) +launches another thread per channel when receiving a call. The rest of the signaling modules currently launch only one thread per +span and the signaling for all channels within the span is handled in that thread. We call that thread 'the signaling thread'. + +At this point the user can start placing calls using the FreeTDM call API ftdm_channel_call_place(). Any of the possible threads in +which the user calls the FreeTDM API is called 'the user thread', depending on the application thread model (the application using FreeTDM) +this user thread may be different each time or the same all the time, we cannot make any assumptions. In the case of FreeSWITCH, the most +common user of FreeTDM, the user thread is most of the cases a thread for each new call leg. + +At this point we have identified 4 types of threads. + +1. The timing thread (the core thread that triggers timers). + Its responsibility is simply check for timers that were scheduled and trigger them when the time comes. This means that if you decide + to use the scheduling API in freerun mode (where you use the core timer thread) you callbacks will be executed in this global thread + and you MUST not block at all since there might be other events waiting. + +2. The CPU thread (we don't really care about this one as it does not interact with channels or spans). + +3. The signaling thread. + There is one thread of this per span. This thread takes care of reading signaling specific messages from the network (ISDN network, etc) and + changing the channel call state accordingly and processing state changes caused by user API calls (like ftdm_channel_call_hangup for example). + +4. The user thread. + This is a thread in which the user decides to execute FreeTDM APIs, in some cases it might even be the same than the signaling thread (because + most SIGEVENT notifications are delivered by the signaling thread, however we are advicing users to not use FreeTDM unsafe APIs from the + thread where they receive SIGEVENT notifications as some APIs may block for a few milliseconds, effectively blocking the whole signaling thread + that is servicing a span. + +== Application Locking == + +Users of the FreeTDM API will typically have locking of their own for their own application-specific data structures (in the case of FreeSWITCH, the +session lock for example). Other application-specific locks may be involved. + +== DeadLocks == + +As soon as we think of application locks, and we mix them with the FreeTDM internal locks, the possibility of deadlocks arise. + +A typical deadlock scenario when 2 locks are involved is: + +- User Thread - - Signaling Thread - +1. Application locks applock. 1. A network message is received for a channel. + +2. Aplication invokes a FreeTDM call API (ie: ftdm_channel_call_hangup()). 2. The involved channel is locked. + +3. The FreeTDM API attempts to acquire the channel lock and stalls because 3. The message processing results in a notification + the signaling thread just acquired it. to be delivered to the user via the callback function + provided for that purpose. The callback is then called. + +4. The thread is now deadlocked because the signaling thread will never 4. The application callback attempts to acquire its application + release the channel lock. lock but deadlocks because the user thread already has it. + +To avoid this signaling modules should not deliver signals to the user while holding the channel lock. An easy way to avoid this is +to not deliver signals while processing a state change, but rather defer them until the channel lock is released. Most new signaling modules +accomplish this by setting the span flag FTDM_SPAN_USE_SIGNALS_QUEUE, this flag tells the core to enqueue signals (ie FTDM_SIGEVENT_START) +when ftdm_span_send_signal() is called and not deliver them until ftdm_span_trigger_signals() is called, which is done by the signaling module +in its signaling thread when no channel lock is being held. + +== State changes while locking == + +Only 2 types of threads should be performing state changes. + +User threads. +The user thread is a random thread that was crated by the API user. We do not know what threading model users of FreeTDM will follow +and therefore cannot make assumptions about it. The user should be free to call FreeTDM APIs from any thread, except threads that +are under our control, like the signaling threads. Although it may work in most situations, is discouraged for users to try +to use FreeTDM APIs from the signaling thread, that is, the thread where the signaling callback provided during configuration +is called (the callback where FTDM_SIGEVENT_XXX signals are delivered). + +A user thread may request state changes implicitly through calls to FreeTDM API's. The idea of state changes is internal to freetdm +and should not be exposed to users of the API (except for debugging purposes, like the ftdm_channel_get_state, ftdm_channel_get_state_str etc) + +This is an example of the API's that implicitly request a state change. + +ftdm_channel_call_answer() + +Signaling modules should guarantee that upon releasing a lock on a channel, any state changes will be already processed and +not deferred to other threads, otherwise that leads to a situation where a state change requested by the signaling module is pending +to be serviced by another signaling module thread but a user thread wins the channel lock and attempts to perform a state change which will +fail because another state change is pending (and user threads are not meant to process signaling states). + +ONLY one signaling thread per channel should try to perform state changes and processing of the states, +otherwise complexity arises and is not worth it! + +At some point before we stablished this policies we could have 3 different threads doing state changes. + +1. A user random thread could implcitly try to change the state in response to a call API. +2. The ftmod signaling thread could try to change the state in response to other state changes. +3. The lower level signaling stack threads could try to change the state in response to stack events. + +As a result, lower level signaling stack thread could set a state and then let the signaling thread to +process it, but when unlocking the channel, the user thread may win the lock over the signaling thread and +may try to set a state change of its own and fail (due to the unprocessed state change)! + +The rule is, the signaling module should never unlock a channel with states pending to process this way the user, +when acquiring a channel lock (inside ftdm_channel_call_answer for example) it will always find a consistent state +for the channel and not in the middle of state processing. + + diff --git a/libs/freetdm/src/ftdm_state.c b/libs/freetdm/src/ftdm_state.c index 21bb3b4..2f42282 100644 --- a/libs/freetdm/src/ftdm_state.c +++ b/libs/freetdm/src/ftdm_state.c @@ -434,15 +434,14 @@ FT_DECLARE(char *) ftdm_channel_get_history_str(const ftdm_channel_t *fchan) return stream.data; } -FT_DECLARE(ftdm_status_t) ftdm_channel_advance_states(ftdm_channel_t *fchan, ftdm_channel_state_processor_t state_processor) +FT_DECLARE(ftdm_status_t) ftdm_channel_advance_states(ftdm_channel_t *fchan) { ftdm_channel_state_t state; - ftdm_channel_lock(fchan); while (fchan->state_status == FTDM_STATE_STATUS_NEW) { state = fchan->state; ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Executing state processor for %s\n", ftdm_channel_state2str(fchan->state)); - state_processor(fchan); + fchan->span->state_processor(fchan); if (state == fchan->state && fchan->state_status == FTDM_STATE_STATUS_NEW) { /* if the state did not change and is still NEW, the state status must go to PROCESSED * otherwise we don't touch it since is a new state and the old state was @@ -451,7 +450,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_advance_states(ftdm_channel_t *fchan, ftd fchan->state_status = FTDM_STATE_STATUS_PROCESSED; } } - ftdm_channel_unlock(fchan); + return FTDM_SUCCESS; } diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 530bb2b..37c760c 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -620,7 +620,7 @@ static void ftdm_r2_on_call_init(openr2_chan_t *r2chan) ftdm_sched_cancel_timer(r2data->sched, r2call->protocol_error_recovery_timer); ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Cancelled protocol error recovery timer\n"); ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - ftdm_channel_advance_states(ftdmchan, ftdm_r2_state_advance); + ftdm_channel_advance_states(ftdmchan); } } @@ -814,7 +814,7 @@ static void ftdm_r2_on_call_end(openr2_chan_t *r2chan) ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); /* in some circumstances openr2 can call on_call_init right after this, so let's advance the state right here */ - ftdm_channel_advance_states(ftdmchan, ftdm_r2_state_advance); + ftdm_channel_advance_states(ftdmchan); } static void ftdm_r2_on_call_read(openr2_chan_t *r2chan, const unsigned char *buf, int buflen) @@ -846,7 +846,7 @@ static void ftdm_r2_recover_from_protocol_error(void *data) goto done; } ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - ftdm_channel_advance_states(ftdmchan, ftdm_r2_state_advance); + ftdm_channel_advance_states(ftdmchan); done: ftdm_channel_unlock(ftdmchan); } @@ -1584,6 +1584,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) span->set_channel_sig_status = ftdm_r2_set_channel_sig_status; span->state_map = &r2_state_map; + span->state_processor = ftdm_r2_state_advance; /* use signals queue */ ftdm_set_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE); @@ -1917,12 +1918,12 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_RX_DISABLED); ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_TX_DISABLED); - ftdm_channel_advance_states(ftdmchan, ftdm_r2_state_advance); + ftdm_channel_advance_states(ftdmchan); r2chan = call->r2chan; openr2_chan_process_signaling(r2chan); - ftdm_channel_advance_states(ftdmchan, ftdm_r2_state_advance); + ftdm_channel_advance_states(ftdmchan); if (!call->accepted) { /* if the call is not accepted we do not want users reading */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index bb29b4f..259bf18 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -46,10 +46,9 @@ static ftdm_status_t ftdm_sangoma_isdn_stop(ftdm_span_t *span); static ftdm_status_t ftdm_sangoma_isdn_start(ftdm_span_t *span); ftdm_channel_t* ftdm_sangoma_isdn_process_event_states(ftdm_span_t *span, sngisdn_event_data_t *sngisdn_event); -static void ftdm_sangoma_isdn_advance_chan_states(ftdm_channel_t *ftdmchan); static void ftdm_sangoma_isdn_poll_events(ftdm_span_t *span); static void ftdm_sangoma_isdn_process_phy_events(ftdm_span_t *span, ftdm_oob_event_t event); -static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan); +static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan); static void ftdm_sangoma_isdn_process_stack_event (ftdm_span_t *span, sngisdn_event_data_t *sngisdn_event); static void ftdm_sangoma_isdn_wakeup_phy(ftdm_channel_t *dchan); static void ftdm_sangoma_isdn_dchan_set_queue_size(ftdm_channel_t *ftdmchan); @@ -270,13 +269,6 @@ ftdm_state_map_t sangoma_isdn_state_map = { } }; -static __inline__ void ftdm_sangoma_isdn_advance_chan_states(ftdm_channel_t *ftdmchan) -{ - while (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { - ftdm_sangoma_isdn_process_state_change(ftdmchan); - } -} - static void ftdm_sangoma_isdn_process_phy_events(ftdm_span_t *span, ftdm_oob_event_t event) { sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data; @@ -457,7 +449,7 @@ static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj) while ((ftdmchan = ftdm_queue_dequeue(span->pendingchans))) { /* double check that this channel has a state change pending */ ftdm_channel_lock(ftdmchan); - ftdm_sangoma_isdn_advance_chan_states(ftdmchan); + ftdm_channel_advance_states(ftdmchan); ftdm_channel_unlock(ftdmchan); } @@ -470,11 +462,11 @@ static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj) /* twiddle */ break; case FTDM_FAIL: - ftdm_log(FTDM_LOG_ERROR,"%s:ftdm_interrupt_wait returned error!\n", span->name); + ftdm_log(FTDM_LOG_ERROR, "%s: ftdm_interrupt_wait returned error!\n", span->name); break; default: - ftdm_log(FTDM_LOG_ERROR,"%s:ftdm_interrupt_wait returned with unknown code\n", span->name); + ftdm_log(FTDM_LOG_ERROR, "%s: ftdm_interrupt_wait returned with unknown code\n", span->name); break; } @@ -536,7 +528,7 @@ ftdm_channel_t* ftdm_sangoma_isdn_process_event_states(ftdm_span_t *span, sngisd break; } ftdm_channel_lock(ftdmchan); - ftdm_sangoma_isdn_advance_chan_states(ftdmchan); + ftdm_channel_advance_states(ftdmchan); return ftdmchan; } @@ -600,13 +592,14 @@ static void ftdm_sangoma_isdn_process_stack_event (ftdm_span_t *span, sngisdn_ev sngisdn_process_rst_ind(sngisdn_event); break; } - if(ftdmchan != NULL) { - ftdm_sangoma_isdn_advance_chan_states(ftdmchan); + if (ftdmchan != NULL) { + ftdm_channel_advance_states(ftdmchan); ftdm_channel_unlock(ftdmchan); } } -static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) +/* this function is called with the channel already locked by the core */ +static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) { ftdm_sigmsg_t sigev; ftdm_channel_state_t initial_state; @@ -618,13 +611,12 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) sigev.span_id = ftdmchan->span_id; sigev.channel = ftdmchan; - /*first lock the channel*/ - ftdm_channel_lock(ftdmchan); - /*clear the state change flag...since we might be setting a new state*/ - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE); + /* Acknowledge the state change */ + ftdm_channel_complete_state(ftdmchan); + #ifdef FTDM_DEBUG_CHAN_MEMORY if (ftdmchan->state == FTDM_CHANNEL_STATE_DIALING) { - ftdm_assert(mprotect(ftdmchan, sizeof(*ftdmchan), PROT_READ)==0, "Failed to mprotect"); + ftdm_assert(mprotect(ftdmchan, sizeof(*ftdmchan), PROT_READ) == 0, "Failed to mprotect"); } #endif @@ -879,11 +871,10 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) } #ifdef FTDM_DEBUG_CHAN_MEMORY if (ftdmchan->state == FTDM_CHANNEL_STATE_DIALING) { - ftdm_assert(mprotect(ftdmchan, sizeof(*ftdmchan), PROT_READ|PROT_WRITE)==0, "Failed to mprotect"); + ftdm_assert(mprotect(ftdmchan, sizeof(*ftdmchan), PROT_READ|PROT_WRITE) == 0, "Failed to mprotect"); } #endif - ftdm_channel_unlock(ftdmchan); - return; + return FTDM_SUCCESS; } static FIO_CHANNEL_SEND_MSG_FUNCTION(ftdm_sangoma_isdn_send_msg) @@ -1098,6 +1089,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_isdn_span_config) span->get_span_sig_status = ftdm_sangoma_isdn_get_span_sig_status; span->set_span_sig_status = ftdm_sangoma_isdn_set_span_sig_status; span->state_map = &sangoma_isdn_state_map; + span->state_processor = ftdm_sangoma_isdn_process_state_change; ftdm_set_flag(span, FTDM_SPAN_USE_CHAN_QUEUE); ftdm_set_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE); ftdm_set_flag(span, FTDM_SPAN_USE_PROCEED_STATE); diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index ff12963..3e8ad28 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -356,7 +356,6 @@ typedef enum { "PROGRESS_MEDIA", "ALARM_TRAP", "ALARM_CLEAR", \ "COLLECTED_DIGIT", "ADD_CALL", "RESTART", "SIGSTATUS_CHANGED", "COLLISION", "FACILITY", \ "TRACE", "TRACE_RAW", "INDICATION_COMPLETED", "INVALID" - /*! \brief Move from string to ftdm_signal_event_t and viceversa */ FTDM_STR2ENUM_P(ftdm_str2ftdm_signal_event, ftdm_signal_event2str, ftdm_signal_event_t) @@ -653,7 +652,20 @@ typedef ftdm_status_t (*fio_span_get_sig_status_t) FIO_SPAN_GET_SIG_STATUS_ARGS; typedef ftdm_status_t (*fio_span_poll_event_t) FIO_SPAN_POLL_EVENT_ARGS ; typedef ftdm_status_t (*fio_span_next_event_t) FIO_SPAN_NEXT_EVENT_ARGS ; typedef ftdm_status_t (*fio_channel_next_event_t) FIO_CHANNEL_NEXT_EVENT_ARGS ; + +/*! \brief Callback for signal delivery (FTDM_SIGEVENT_START and friends) + * \note This callback is provided by the user during ftdm_configure_span_signaling + * + * \note You must NOT do any blocking during this callback since this function is + * most likely called in an internal signaling thread that can potentially be + * shared for all the channels in a span and blocking will delay processing + * (sometimes even audio processing) for other channels + * + * \note Although some simple FreeTDM APIs can work (ie: ftdm_span_get_id etc), the + * use of any FreeTDM call API (ie ftdm_channel_call_answer) is discouraged + */ typedef ftdm_status_t (*fio_signal_cb_t) FIO_SIGNAL_CB_ARGS ; + typedef ftdm_status_t (*fio_event_cb_t) FIO_EVENT_CB_ARGS ; typedef ftdm_status_t (*fio_configure_span_t) FIO_CONFIGURE_SPAN_ARGS ; typedef ftdm_status_t (*fio_configure_t) FIO_CONFIGURE_ARGS ; diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index 3b69144..829b406 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -500,15 +500,15 @@ struct ftdm_span { ftdm_span_stop_t stop; ftdm_channel_sig_read_t sig_read; ftdm_channel_sig_write_t sig_write; - /* Private I/O data per span. Do not touch unless you are an I/O module */ - void *io_data; + ftdm_channel_state_processor_t state_processor; /*!< This guy is called whenever state processing is required */ + void *io_data; /*!< Private I/O data per span. Do not touch unless you are an I/O module */ char *type; char *dtmf_hangup; size_t dtmf_hangup_len; ftdm_state_map_t *state_map; ftdm_caller_data_t default_caller_data; - ftdm_queue_t *pendingchans; - ftdm_queue_t *pendingsignals; + ftdm_queue_t *pendingchans; /*!< Channels pending of state processing */ + ftdm_queue_t *pendingsignals; /*!< Signals pending from being delivered to the user */ struct ftdm_span *next; }; diff --git a/libs/freetdm/src/include/private/ftdm_state.h b/libs/freetdm/src/include/private/ftdm_state.h index 36dcc2b..7de015b 100644 --- a/libs/freetdm/src/include/private/ftdm_state.h +++ b/libs/freetdm/src/include/private/ftdm_state.h @@ -86,15 +86,21 @@ typedef struct { const char *file; const char *func; int line; - ftdm_channel_state_t state; - ftdm_channel_state_t last_state; - ftdm_time_t time; - ftdm_time_t end_time; + ftdm_channel_state_t state; /*!< Current state (processed or not) */ + ftdm_channel_state_t last_state; /*!< Previous state */ + ftdm_time_t time; /*!< Time the state was set */ + ftdm_time_t end_time; /*!< Time the state processing was completed */ } ftdm_state_history_entry_t; typedef ftdm_status_t (*ftdm_channel_state_processor_t)(ftdm_channel_t *fchan); -FT_DECLARE(ftdm_status_t) ftdm_channel_advance_states(ftdm_channel_t *fchan, ftdm_channel_state_processor_t processor); +/*! + * \brief Process channel states by invoking the channel state processing routine + * it will keep calling the processing routine while the state status + * is FTDM_STATE_STATUS_NEW, it will not do anything otherwise + */ +FT_DECLARE(ftdm_status_t) ftdm_channel_advance_states(ftdm_channel_t *fchan); + FT_DECLARE(ftdm_status_t) _ftdm_channel_complete_state(const char *file, const char *function, int line, ftdm_channel_t *fchan); #define ftdm_channel_complete_state(obj) _ftdm_channel_complete_state(__FILE__, __FUNCTION__, __LINE__, obj) FT_DECLARE(int) ftdm_check_state_all(ftdm_span_t *span, ftdm_channel_state_t state); @@ -171,16 +177,26 @@ struct ftdm_state_map { }; typedef struct ftdm_state_map ftdm_state_map_t; +/*!\brief Set the state for a channel (the channel must be locked when calling this function) + * \note Signaling modules should use ftdm_set_state macro instead + * \note If this function is called with the wait parameter set to a non-zero value, the recursivity + * of the channel lock must be == 1 because the channel will be unlocked/locked when waiting */ FT_DECLARE(ftdm_status_t) ftdm_channel_set_state(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_channel_state_t state, int wait); -/*!\brief Set the state of a channel immediately and implicitly complete the previous state */ +/*!\brief Set the state of a channel immediately and implicitly complete the previous state if needed + * \note FTDM_SIGEVENT_INDICATION_COMPLETED will be sent if the state change + * is associated to some indication (ie FTDM_CHANNEL_INDICATE_PROCEED) + * \note The channel must be locked when calling this function + * */ FT_DECLARE(ftdm_status_t) _ftdm_set_state(const char *file, const char *func, int line, ftdm_channel_t *fchan, ftdm_channel_state_t state); #define ftdm_set_state(obj, s) _ftdm_set_state(__FILE__, __FUNCTION__, __LINE__, obj, s); \ /*!\brief This macro is deprecated, signaling modules should always lock the channel themselves anyways since they must * process first the user pending state changes then set a new state before releasing the lock + * this macro is here for backwards compatibility, DO NOT USE IT in new code since it is *always* wrong to set + * a state in a signaling module without checking and processing the current state first (and for that you must lock the channel) */ #define ftdm_set_state_locked(obj, s) \ do { \ commit 0e31a974d4d4f2ac881a51c04ccd17a64d38eb0b Author: Daniel Swarbrick <daniel@seventhsignal.de> Date: Fri Dec 31 03:10:50 2010 +0100 Code cleanup, saner way of stripping chars from string diff --git a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c index 098239d..3317436 100644 --- a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c +++ b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c @@ -185,34 +185,37 @@ static void write_cdr(const char *path, const char *log_line) switch_mutex_unlock(fd->mutex); } -static int save_cdr(const char* const table, const char* const template, const char* const cdr) +static int save_cdr(const char * const table, const char * const template, const char * const cdr) { - char* columns; - char* values; - char* p; - unsigned clen; + char *columns, *values; + char *p, *q; unsigned vlen; - char* query; - const char* const query_template = "INSERT INTO %s (%s) VALUES (%s);"; - PGresult* res; - char *spaceColumns, *pt, *nullValues, *temp, *tp; - int spaceCounter = 0, nullCounter = 0, charCounter = 0; + char *query; + PGresult *res; + char *nullValues, *temp, *tp; + int nullCounter = 0, charCounter = 0; if (!table || !*table || !template || !*template || !cdr || !*cdr) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Bad parameter\n"); return 0; } + /* Build comma-separated list of field names by dropping $ { } ; chars */ columns = strdup(template); - for (p = columns; *p; ++p) { + for (p = columns, q = columns; *p; ++p) { switch (*p) { case '$': case '"': case '{': case '}': case ';': - *p = ' '; break; + default: + *q++ = *p; } } - clen = p - columns; + *q = '\0'; + /* In the expanded vars, replace double quotes (") with single quotes (') + * for corect PostgreSQL syntax, and replace semi-colon with space to + * prevent SQL injection attacks. + */ values = strdup(cdr); for (p = values; *p; ++p) { switch(*p) { @@ -227,31 +230,9 @@ static int save_cdr(const char* const table, const char* const template, const c vlen = p - values; /* - * Patch for changing spaces (; ;) in the template paterns to NULL - * (eg.) ; ; --PATCH--> null - * - added new functionality - space removing + * Patch for changing empty strings ('') in the expanded variables to + * Postgresql null */ - for (p = columns; *p; ++p) { - if (*p == ' ') { - spaceCounter++; - } - } - - spaceColumns = (char *) malloc(clen - spaceCounter + 1); - pt = spaceColumns; - - for (p = columns; *p; ++p) { - if (*p != ' ') { - *pt=*p; - pt++; - } - } - - *pt = 0; - pt = columns; - columns = spaceColumns; - free(pt); - for (p = values; *p; ++p) { if (*p == ',') { if (charCounter == 0) { @@ -331,8 +312,8 @@ static int save_cdr(const char* const table, const char* const template, const c //----------------------------- END_OF_PATCH ------------------------------- - query = malloc(strlen(query_template) - 6 + strlen(table) + clen + vlen + 1); - sprintf(query, query_template, table, columns, values); + query = switch_mprintf("INSERT INTO %s (%s) VALUES (%s);", table, columns, values); + assert(query); free(columns); free(values); commit a0d36d8f9d77af56925b90eee70ec5955e33e58a Author: Daniel Swarbrick <daniel@seventhsignal.de> Date: Fri Dec 31 01:30:09 2010 +0100 add mod_cdr_sqlite to modules.conf.xml, thanks intralanman for reminding me diff --git a/conf/autoload_configs/modules.conf.xml b/conf/autoload_configs/modules.conf.xml index 118d7c4..51c62f2 100644 --- a/conf/autoload_configs/modules.conf.xml +++ b/conf/autoload_configs/modules.conf.xml @@ -19,6 +19,7 @@ <!-- Event Handlers --> <load module="mod_cdr_csv"/> + <!-- <load module="mod_cdr_sqlite"/> --> <!-- <load module="mod_event_multicast"/> --> <load module="mod_event_socket"/> <!-- <load module="mod_zeroconf"/> --> commit 0f95b870358742aed11e43fffb958251c8e19994 Author: Daniel Swarbrick <daniel@seventhsignal.de> Date: Fri Dec 31 00:18:03 2010 +0100 Drop transaction BEGIN/END around INSERT. We're only executing one command, and autocommit will automatically rollback if the INSERT fails. Sync state_handlers with mod_cdr_csv. Minor libpq fixups. diff --git a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c index 02014e4..098239d 100644 --- a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c +++ b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c @@ -115,7 +115,7 @@ static void do_rotate(cdr_fd_t *fd) if (globals.rotate) { switch_time_exp_lt(&tm, switch_micro_time_now()); - switch_strftime(date, &retsize, sizeof(date), "%Y-%m-%d-%H-%M-%S", &tm); + switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d-%H-%M-%S", &tm); len = strlen(fd->path) + strlen(date) + 2; p = switch_mprintf("%s.%s", fd->path, date); @@ -143,6 +143,7 @@ static void write_cdr(const char *path, const char *log_line) { cdr_fd_t *fd = NULL; unsigned int bytes_in, bytes_out; + int loops = 0; if (!(fd = switch_core_hash_find(globals.fd_hash, path))) { fd = switch_core_alloc(globals.pool, sizeof(*fd)); @@ -169,11 +170,15 @@ static void write_cdr(const char *path, const char *log_line) do_rotate(fd); } - if ((bytes_in = write(fd->fd, log_line, bytes_out)) != bytes_out) { + while ((bytes_in = write(fd->fd, log_line, bytes_out)) != bytes_out && ++loops < 10) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Write error to file %s %d/%d\n", path, (int) bytes_in, (int) bytes_out); + do_rotate(fd); + switch_yield(250000); } - fd->bytes += bytes_in; + if (bytes_in > 0) { + fd->bytes += bytes_in; + } end: @@ -330,6 +335,7 @@ static int save_cdr(const char* const table, const char* const template, const c sprintf(query, query_template, table, columns, values); free(columns); free(values); + if (globals.debug) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Query: \"%s\"\n", query); } @@ -339,6 +345,7 @@ static int save_cdr(const char* const table, const char* const template, const c if (!globals.db_online || PQstatus(globals.db_connection) != CONNECTION_OK) { globals.db_connection = PQconnectdb(globals.db_info); } + if (PQstatus(globals.db_connection) == CONNECTION_OK) { globals.db_online = 1; } else { @@ -350,21 +357,9 @@ static int save_cdr(const char* const table, const char* const template, const c return 0; } - res = PQexec(globals.db_connection, "BEGIN"); - if (PQresultStatus(res) != PGRES_COMMAND_OK) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "BEGIN command failed: %s", PQerrorMessage(globals.db_connection)); - PQclear(res); - PQfinish(globals.db_connection); - globals.db_online = 0; - switch_mutex_unlock(globals.db_mutex); - free(query); - return 0; - } - PQclear(res); - res = PQexec(globals.db_connection, query); if (PQresultStatus(res) != PGRES_COMMAND_OK) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "INSERT command failed: %s", PQerrorMessage(globals.db_connection)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "INSERT command failed: %s", PQresultErrorMessage(res)); PQclear(res); PQfinish(globals.db_connection); globals.db_online = 0; @@ -373,26 +368,14 @@ static int save_cdr(const char* const table, const char* const template, const c return 0; } PQclear(res); - free(query); - res = PQexec(globals.db_connection, "END"); - if (PQresultStatus(res) != PGRES_COMMAND_OK) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "END command failed: %s", PQerrorMessage(globals.db_connection)); - PQclear(res); - PQfinish(globals.db_connection); - globals.db_online = 0; - switch_mutex_unlock(globals.db_mutex); - return 0; - } - PQclear(res); - switch_mutex_unlock(globals.db_mutex); return 1; } -static switch_status_t my_on_hangup(switch_core_session_t *session) +static switch_status_t my_on_reporting(switch_core_session_t *session) { switch_channel_t *channel = switch_core_session_get_channel(session); switch_status_t status = SWITCH_STATUS_SUCCESS; @@ -524,9 +507,14 @@ static switch_state_handler_table_t state_handlers = { /*.on_init */ NULL, /*.on_routing */ NULL, /*.on_execute */ NULL, - /*.on_hangup */ my_on_hangup, + /*.on_hangup */ NULL, /*.on_exchange_media */ NULL, - /*.on_soft_execute */ NULL + /*.on_soft_execute */ NULL, + /*.on_consume_media */ NULL, + /*.on_hibernate */ NULL, + /*.on_reset */ NULL, + /*.on_park */ NULL, + /*.on_reporting */ my_on_reporting }; @@ -638,19 +626,21 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_cdr_pg_csv_load) { switch_status_t status = SWITCH_STATUS_SUCCESS; - if (switch_event_bind(modname, SWITCH_EVENT_TRAP, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) != SWITCH_STATUS_SUCCESS) { + load_config(pool); + + if ((status = switch_dir_make_recursive(globals.log_dir, SWITCH_DEFAULT_DIR_PERMS, pool)) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating %s\n", globals.log_dir); + return status; + } + + if ((status = switch_event_bind(modname, SWITCH_EVENT_TRAP, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n"); - return SWITCH_STATUS_GENERR; + return status; } switch_core_add_state_handler(&state_handlers); *module_interface = switch_loadable_module_create_module_interface(pool, modname); - load_config(pool); - - if ((status = switch_dir_make_recursive(globals.log_dir, SWITCH_DEFAULT_DIR_PERMS, pool)) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating %s\n", globals.log_dir); - } return status; } commit 18feeb106786fd38616c18387da024baaf0b31ab Author: Daniel Swarbrick <daniel@seventhsignal.de> Date: Fri Dec 31 00:01:53 2010 +0100 Coding style, fix some C90 warnings about mixed decls/code diff --git a/src/mod/event_handlers/mod_cdr_pg_csv/Makefile b/src/mod/event_handlers/mod_cdr_pg_csv/Makefile index b2d393f..91c48be 100644 --- a/src/mod/event_handlers/mod_cdr_pg_csv/Makefile +++ b/src/mod/event_handlers/mod_cdr_pg_csv/Makefile @@ -8,6 +8,7 @@ else LOCAL_LDFLAGS=-L/usr/postgres/8.3/lib -R/usr/postgres/8.3/lib -lpq -static endif else +LOCAL_CFLAGS=-I/usr/include/postgresql LOCAL_LDFLAGS=-lpq -static endif include ../../../../build/modmake.rules diff --git a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c index ccd7478..02014e4 100644 --- a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c +++ b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c @@ -186,10 +186,12 @@ static int save_cdr(const char* const table, const char* const template, const c char* values; char* p; unsigned clen; - unsigned vlen; + unsigned vlen; char* query; const char* const query_template = "INSERT INTO %s (%s) VALUES (%s);"; PGresult* res; + char *spaceColumns, *pt, *nullValues, *temp, *tp; + int spaceCounter = 0, nullCounter = 0, charCounter = 0; if (!table || !*table || !template || !*template || !cdr || !*cdr) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Bad parameter\n"); @@ -199,9 +201,9 @@ static int save_cdr(const char* const table, const char* const template, const c columns = strdup(template); for (p = columns; *p; ++p) { switch (*p) { - case '$': case '"': case '{': case '}': case ';': - *p = ' '; - break; + case '$': case '"': case '{': case '}': case ';': + *p = ' '; + break; } } clen = p - columns; @@ -209,121 +211,121 @@ static int save_cdr(const char* const table, const char* const template, const c values = strdup(cdr); for (p = values; *p; ++p) { switch(*p) { - case '"': - *p = '\''; - break; - case ';': - *p = ' '; - break; + case '"': + *p = '\''; + break; + case ';': + *p = ' '; + break; } } vlen = p - values; -/* - Patch for changing spaces (; ;) in the template paterns to NULL (ex.) ; ; --PACH--> null - - added new functionality - space removing -*/ - char *spaceColumns; - int spaceCounter=0; - for (p=columns; *p; ++p) - { - if (*p==' ') - { + + /* + * Patch for changing spaces (; ;) in the template paterns to NULL + * (eg.) ; ; --PATCH--> null + * - added new functionality - space removing + */ + for (p = columns; *p; ++p) { + if (*p == ' ') { spaceCounter++; } } - spaceColumns = (char*)malloc(clen-spaceCounter+1); - char *pt=spaceColumns; - for (p=columns; *p; ++p) - { - if (*p!=' ') - { + + spaceColumns = (char *) malloc(clen - spaceCounter + 1); + pt = spaceColumns; + + for (p = columns; *p; ++p) { + if (*p != ' ') { *pt=*p; pt++; } } - *pt=0; - pt=columns; - columns=spaceColumns; + + *pt = 0; + pt = columns; + columns = spaceColumns; free(pt); - char *nullValues; - int nullCounter=0; - int charCounter=0; - for (p=values; *p; ++p) - { - if (*p==',') - { - if (charCounter==0) - { + + for (p = values; *p; ++p) { + if (*p == ',') { + if (charCounter == 0) { nullCounter++; } - charCounter=0; - } - else if (*p!=' ' && *p!='\'') - { + charCounter = 0; + } else if (*p != ' ' && *p != '\'') { charCounter++; } } - if (charCounter==0) - { + + if (charCounter == 0) { nullCounter++; } - charCounter=0; - nullCounter*=4; - vlen+=nullCounter; - nullValues=(char*)malloc(strlen(values)+nullCounter+1); - charCounter=0; - char *temp=nullValues; - char *tp=nullValues; - for (p=values; *p; ++tp,++p) - { - if (*p==',') - { - if (charCounter==0) - { + + charCounter = 0; + nullCounter *= 4; + vlen += nullCounter; + nullValues = (char *) malloc(strlen(values) + nullCounter + 1); + charCounter = 0; + temp = nullValues; + tp = nullValues; + + for (p = values; *p; ++tp, ++p) { + if (*p == ',') { + if (charCounter == 0) { + temp++; + *temp = 'n'; + temp++; + if (temp == tp) tp++; + *temp = 'u'; + temp++; + if (temp == tp) tp++; + *temp = 'l'; temp++; - *temp='n';temp++; - if (temp==tp) tp++; - *temp='u';temp++; - if (temp==tp) tp++; - *temp='l';temp++; - if (temp==tp) tp++; - *temp='l';temp++; - while (temp!=tp) - { - *temp=' ';temp++; + if (temp == tp) tp++; + *temp = 'l'; + temp++; + while (temp != tp) { + *temp = ' '; + temp++; } } - charCounter=0; - temp=tp; - } - else if (*p!=' ' && *p!='\'') - { + charCounter = 0; + temp = tp; + } else if (*p != ' ' && *p != '\'') { charCounter++; } - *tp=*p; + *tp = *p; } - if (charCounter==0) - { + + if (charCounter == 0) { temp++; - *temp='n';temp++; - if (temp==tp) tp++; - *temp='u';temp++; - if (temp==tp) tp++; - *temp='l';temp++; - if (temp==tp) tp++; - *temp='l';temp++; - while (temp!=tp) - { - *temp=' ';temp++; + *temp = 'n'; + temp++; + if (temp == tp) tp++; + *temp = 'u'; + temp++; + if (temp == tp) tp++; + *temp = 'l'; + temp++; + if (temp == tp) tp++; + *temp = 'l'; + temp++; + while (temp != tp) { + *temp = ' '; + temp++; } } - charCounter=0; - temp=tp; - *tp=0; - tp=values; - values=nullValues; + + charCounter = 0; + temp = tp; + *tp = 0; + tp = values; + values = nullValues; free(tp); -//-----------------------------END_OF_PATCH---------------------------------------------------------------- + + //----------------------------- END_OF_PATCH ------------------------------- + query = malloc(strlen(query_template) - 6 + strlen(table) + clen + vlen + 1); sprintf(query, query_template, table, columns, values); free(columns); commit 5401c604935c496892875411cdeb53d32ac246ea Author: Daniel Swarbrick <daniel@seventhsignal.de> Date: Thu Dec 30 23:43:03 2010 +0100 fix CR line endings diff --git a/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c b/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c index eeb5e48..c1b4b77 100644 --- a/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c +++ b/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c @@ -346,8 +346,8 @@ static switch_status_t load_config(switch_memory_pool_t *pool) } else if (!strcasecmp(var, "default-template")) { globals.default_template = switch_core_strdup(pool, val); } else if (!strcasecmp(var, "master-file-only")) { - globals.masterfileonly = switch_true(val); - } + globals.masterfileonly = switch_true(val); + } } } @@ -405,8 +405,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_cdr_csv_load) *module_interface = switch_loadable_module_create_module_interface(pool, modname); - - return status; } commit cc198a6e91ee0314b6121433ac4828970d18be54 Author: Daniel Swarbrick <daniel@seventhsignal.de> Date: Thu Dec 30 23:24:54 2010 +0100 Add mising params to config file diff --git a/conf/autoload_configs/cdr_pg_csv.conf.xml b/conf/autoload_configs/cdr_pg_csv.conf.xml index ec62053..69eb90c 100644 --- a/conf/autoload_configs/cdr_pg_csv.conf.xml +++ b/conf/autoload_configs/cdr_pg_csv.conf.xml @@ -2,15 +2,18 @@ <settings> <!-- 'cdr-pg-csv' will always be appended to log-base --> <!--<param name="log-base" value="/var/log"/>--> - <param name="default-template" value="example"/> - <!-- This is like the info app but after the call is hung up --> - <!--<param name="debug" value="true"/>--> <param name="rotate-on-hup" value="true"/> - <!-- may be a b or ab --> + <!-- Log a-leg (a), b-leg (b) or both (ab) --> <param name="legs" value="a"/> - <param name="debug" value="true"/> - <!-- The parameters for pqconnectdb(), see there --> + <!-- See parameters for PQconnectdb() at http://www.postgresql.org/docs/8.4/static/libpq-connect.html --> <param name="db-info" value="host=localhost dbname=cdr connect_timeout=10" /> + <!-- Global CDR table --> + <!--<param name="g-table" value="g"/>--> + <!-- Per-accountcode CDR table --> + <!--<param name="a-table" value="a"/>--> + <param name="default-template" value="example"/> + <!-- This is like the info app but after the call is hung up --> + <!--<param name="debug" value="true"/>--> </settings> <templates> <template name="sql">INSERT INTO cdr VALUES ("${caller_id_name}","${caller_id_number}","${destination_number}","${context}","${start_stamp}","${answer_stamp}","${end_stamp}","${duration}","${billsec}","${hangup_cause}","${uuid}","${bleg_uuid}", "${accountcode}");</template> commit 05a82ca61866638ffb6ddceaefd61f2a5057f788 Author: Michael S Collins <msc@freeswitch.org> Date: Thu Dec 30 13:34:44 2010 -0800 Update Changelog through Dec 30 diff --git a/docs/ChangeLog b/docs/ChangeLog index 0ca48c0..41f94d7 100644 --- a/docs/ChangeLog +++ b/docs/ChangeLog @@ -80,7 +80,6 @@ freeswitch (1.0.7) core: change channel app_flags to be realm specific and default old version to use __FILE__ as the realm name to avoid cross fire between apps using app flags (r:09c1815c) core: preanswer before getting variables to avoid crash (r:25fe16df) core: Windows: Don't report "unknown command" on console when empty command has been given (r:c8f9fb56/FSCORE-641) - embedded languages: Provide core level support for conditional Set Global Variable (r:c017c24b/FSCORE-612) core: Windows: Add start parameter -monotonic-clock, replaces build flag WIN32_MONOTONIC (r:3515c7a0/FSCORE-643) core: Improve RTP timing on playback of files (r:d6d7773c/FSCORE-639) core: Allows bind_meta_app to use chars other than * (r:fd254766/FSCORE-630) @@ -156,7 +155,19 @@ freeswitch (1.0.7) core: normalize tests for outbound channels to use switch_channel_direction instead of testing for CF_OUTBOUND (r:93cc3dc5) core: add CF_DIALPLAN (r:3ff07445) core: tweak on calle[re] id (r:9db4a826) + core: cid logic changes for calle[re] (r:8f452bc5) + core: change switch_strip_spaces to specify if you want it to dup the string or destroy the current buffer (r:4d7e4f1e) + core: fix secondary issue with min_digits = 0 and terminator key pressed to cancel (r:fe005bdd/FS-2789) + core: fix dtmf issue with jb on (r:90e58696) + core: fix ignore_early_media=ring_ready (r:5b752c54) + core: prevent race on execute_on_answer called from the B-leg of a call (r:751e0291) + core: drop rtp frame that was already replaced with a cng frame (r:34a0ca50) + core: fix partial match counting as exact match in dmachine (r:5eb951aa) + core: try to adjust the timer to be ok with the horrible 10000 microsecond kernel resolution on amazon ec3 but that doesn't mean it's not horribly wrong to run the kernel that slow (r:903b2901) + embedded languages: Provide core level support for conditional Set Global Variable (r:c017c24b/FSCORE-612) + embedded languages: add insertFile front end to switch_ivr_insert_file and reswig (r:c4e350ab) lang: Improve French phrase files (FSCONFIG-23) + lang: Update langs - Add pt_PT, update es to have es_ES and es_MX, update mod_say_es and add mod_say_pt (FS-2937) (r:c81a9448/FS-2937) libapr: Fix issue where after a bridge with a member, uuid of Agent is set to single quote character ' (r:3fee704d/FS-2738) libdingaling: fix race on shutdown causing crash (FSMOD-47) libdingaling: Fix crash in new GV interface when exceeding 24 calls (r:be00609a/FS-2171) @@ -176,9 +187,11 @@ freeswitch (1.0.7) libesl: allow fs_cli -x to have args up to 1024 chars (was 256) (r:7039ba47) libesl: Make last_event pointer last longer (r:a15f51d5/ESL-37) libesl: use a packet buffer for ESL (r:2081bf97) + libesl: Noevent/Noevents disparity (r:d29d83d7/ESL-53) libfreetdm: implemented freetdm config nodes and ss7 initial configuration libfreetdm: fix codec for CAS signaling (r:b76e7f18) libfreetdm: freetdm: ss7- added support for incoming group blocks, started adding support for ansi (r:c219a73c) + libg7221: A bunch of tweaks to the G.722.1 codec (r:5d548570) libgnutls: link to libgcrypt as well, please report any platforms this breaks, but it should be portable (r:c569fb0f/FS-1248) libopenzap: Add CLI tracing libs: Merged OpenZAP and FreeTDM into the FreeSWITCH tree. @@ -216,6 +229,8 @@ freeswitch (1.0.7) mod_callcenter: Fix bad return type so it compile on archlinux, thx bougyman (r:3a475986) mod_callcenter: Make callcenter_config agent get return the value of the item requested. Also added queue param max-wait-time-with-no-agent-time-reached: If the max-wai-time-with-no-agent is already reached for the queue, then new caller can wait for x amount of second before it kicked out of the queue rather than get rejected automatically. (r:81a03869) mod_callcenter: Add new event socket agent-offering. Plus some documentation and better handling of bad agent type -- FS-2869 (r:80174cf3/FS-2869) + mod_cdr_sqlite: initial commit (r:f625fe3b) + mod_cdr_sqlite: config file for mod_cdr_sqlite (r:25bc8fe3) mod_cidlookup: null xml is bad (r:095815f8) mod_cid_lookup: honor skipcitystate when using whitepages (r:a66654de/FSMOD-53) mod_commands: make break uuid_break and add cascade flag @@ -235,6 +250,8 @@ freeswitch (1.0.7) mod_commands: FS-2210 Add support for auto completion for uuid_simplify (r:72bcc01b/FS-2210) mod_commands: allow epoch in strftime_tz (r:bbf1cd1f) mod_commands: Dramatic jitterbuffer changes (r:d5470961) + mod_commands: add uuid_buglist to fetch the current media-bugs attached to a given session uuid (r:f6eab64c) + mod_commands: add recovery_refresh app and api and use it in mod_conference to send a message to the channel telling it to sync its recovery snapshot (r:650393fb) mod_conference: Fix reporting of volume up/down (MODAPP-419) mod_conference: add last talking time per member to conference xml list mod_conference: add terminate-on-silence conference param @@ -245,6 +262,9 @@ freeswitch (1.0.7) mod_conference: refactor conference to use switch_ivr_dmachine for the digit parsing controls are now bound to each member separately based on conference_controls channel var, then the caller-controls param in the profile or a default to "default" (r:ac19f73c) mod_conference: Fix crash on dtmf action (r:4d5389bd/FS-2781) mod_conference: revert to the last transfered conference on recover (r:d11c83b1) + mod_conference: Add a chan var conference_enter_sound to override conference enter-sound param on the profile (r:651acc62) + mod_conference: Add an unique id to the conference obj so that we can track conferences. (r:479f3de2) + mod_conference: Fix corrupted audio when playing "you are now (un)muted..." (r:10257c7d/FS-2768) mod_curl: use method=post when post requested (r:c6a4ddd0/FSMOD-69) mod_db: fix stack corruption (MODAPP-407) mod_dialplan_xml: Add in the INFO log the caller id number when processing a request (Currenly only show the caller name) (r:e1df5e13) @@ -280,6 +300,7 @@ freeswitch (1.0.7) mod_fifo: fix fifo race in use count dec (r:402e383b) mod_fifo: add outbound_ring_timeout param to mod_fifo (r:3885eea7) mod_fifo: add default_lag to fifo (r:dd4fb5be) + mod_fifo: Fix crash when using fifo_destroy_after_use (r:ee562c82/FS-2879) mod_freetdm: Fix for TON and NPI not passed through to channel variables on incoming calls mod_freetdm: add pvt data to freetdm channels fix fxs features (r:9d456900) mod_freetdm: export and import boost custom data (r:edb2d582) @@ -357,6 +378,7 @@ freeswitch (1.0.7) mod_lua: Add switch_core_sqldb functionality from inside Lua script (r:26f2e095/FS-1384) mod_lua: Made 2nd arg to freeswitch.Dbh:query (cb func) optional (r:87db11af) mod_lua: Added SAF_ROUTING_EXEC flag to lua app, so it can be run inline (r:7d5ca1c0) + mod_lua: spelling error in -ERR return code encounterd -> encountered (r:86e7cdc5/FS-2949) mod_managed: Added wrapper for switch_event_bind for .net (r:a5f07a80/MODLANG-165) mod_managed: add additional support (r:5be58aac) mod_managed: add mono 2.8 patch file see FS-2774 (r:6a948bd9/FS-2774) @@ -417,6 +439,7 @@ freeswitch (1.0.7) mod_skypopen: making XEvents to works when EARLYMEDIA, and correctly manage threads death mod_skypopen: now answer a call only when directed to do it (before was trying to answer any incoming call). Lot of changes to a messy part, so maybe some problem will come out... (r:45c6c4d3) mod_skypopen: ignore early media sent by channels to be bridged before our channel is answered (r:ef14b78a) + mod_snapshot: fix bad codepaths in mod_snapshot (r:844ac220) mod_sndfile: Add support for .alaw and .ulaw to mod_sndfile (r:facf09b8/MODFORM-41) mod_sndfile: return break in mod_sndfile when seek returns failure (r:564dc7e4) mod_sofia: Send SIP MESSAGE to unregistered users by prefixing sip: to user@domain @@ -521,6 +544,10 @@ freeswitch (1.0.7) mod_sofia: remove check for va_list completely in sofia since i don't even think it happens ever (r:dfecc914) mod_sofia: have mod_sofia always elect to be the session refresher so we know it will work, also make the session-expires set to 0 imply 100% disabled session timers (r:321013ef) mod_sofia: Do not set nat mode when the device's network_ip is within the acl also so if your FS is behind nat and your phone is too then it will still make the right decisions (r:6c6eab8c) + mod_sofia: prevent race on codec change mid-call (r:668763f4) + mod_sofia: improve fail2ban logging (r:f4d52d4c/FS-2943) + mod_sofia: refactor sofia_contact to try the profile_name first then the domain to resolve the profile then fall back to querying every profile to reduce confusion with multi-homers (d'oh) also special profile name * will force a search-all situation (r:81608da0) + mod_sofia: support allowing pidf-ful presence clients to share the same account and 'appear offline' without influencing each other =/ also refactor the contact generation string based on nat into a helper function (r:97a68c50) mod_spandsp: initial checkin of mod_fax/mod_voipcodecs merge into mod_spandsp (r:fa9a59a8) mod_spandsp: rework of new mod_spandsp to have functions broken up into different c files (r:65400642) mod_spandsp: improve duplicate digit detection and add 'min_dup_digit_spacing_ms' channel variable for use with the dtmf detector (r:eab4f246/FSMOD-45) commit 25bc8fe3e88d66070ff1ddcebf67f125ac16f617 Author: Daniel Swarbrick <daniel@seventhsignal.de> Date: Thu Dec 30 20:41:52 2010 +0100 config file for mod_cdr_sqlite diff --git a/conf/autoload_configs/cdr_sqlite.conf.xml b/conf/autoload_configs/cdr_sqlite.conf.xml new file mode 100644 index 0000000..872c04c --- /dev/null +++ b/conf/autoload_configs/cdr_sqlite.conf.xml @@ -0,0 +1,18 @@ +<configuration name="cdr_sqlite.conf" description="SQLite CDR"> + <settings> + <!-- SQLite database name (.db suffix will be automatically appended) --> + <!-- <param name="db-name" value="cdr"/> --> + <!-- CDR table name --> + <!-- <param name="db-table" value="cdr"/> --> + <!-- Log a-leg (a), b-leg (b) or both (ab) --> + <param name="legs" value="a"/> + <!-- Default template to use when inserting records --> + <param name="default-template" value="example"/> + <!-- This is like the info app but after the call is hung up --> + <!--<param name="debug" value="true"/>--> + </settings> + <templates> + <!-- Note that field order must match SQL table schema, otherwise insert will fail --> + <template name="example">"${caller_id_name}","${caller_id_number}","${destination_number}","${context}","${start_stamp}","${answer_stamp}","${end_stamp}",${duration},${billsec},"${hangup_cause}","${uuid}","${bleg_uuid}","${accountcode}"</template> + </templates> +</configuration> commit f625fe3b01666817859a761e9386a6dcccbfe940 Author: Daniel Swarbrick <daniel@seventhsignal.de> Date: Thu Dec 30 20:38:49 2010 +0100 Add SQLite CDR module diff --git a/src/mod/event_handlers/mod_cdr_sqlite/Makefile b/src/mod/event_handlers/mod_cdr_sqlite/Makefile new file mode 100644 index 0000000..c2baec8 --- /dev/null +++ b/src/mod/event_handlers/mod_cdr_sqlite/Makefile @@ -0,0 +1 @@ +include ../../../../build/modmake.rules diff --git a/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c b/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c new file mode 100644 index 0000000..ca92818 --- /dev/null +++ b/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c @@ -0,0 +1,329 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (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.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * + * The Initial Developer of the Original Code is + * Anthony Minessale II <anthm@freeswitch.org> + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Daniel Swarbrick <daniel.swarbrick@seventhsignal.de> + * + * mod_cdr_sqlite.c -- SQLite CDR Module + * + * Derived from: + * mod_cdr_csv.c -- Asterisk Compatible CDR Module + * + */ +#include <switch.h> + +typedef enum { + CDR_LEG_A = (1 << 0), + CDR_LEG_B = (1 << 1) +} cdr_leg_t; + +static char default_create_sql[] = + "CREATE TABLE %s (\n" + " caller_id_name VARCHAR,\n" + " caller_id_number VARCHAR,\n" + " destination_number VARCHAR,\n" + " context VARCHAR,\n" + " start_stamp DATETIME,\n" + " answer_stamp DATETIME,\n" + " end_stamp DATETIME,\n" + " duration INTEGER,\n" + " billsec INTEGER,\n" + " hangup_cause VARCHAR,\n" + " uuid VARCHAR,\n" + " bleg_uuid VARCHAR,\n" + " account_code VARCHAR\n" + ")\n"; + +const char *default_template = + "\"${caller_id_name}\",\"${caller_id_number}\",\"${destination_number}\",\"${context}\"," + "\"${start_stamp}\",\"${answer_stamp}\",\"${end_stamp}\",${duration},${billsec}," + "\"${hangup_cause}\",\"${uuid}\",\"${bleg_uuid}\",\"${accountcode}\""; + +static struct { + switch_memory_pool_t *pool; + char *db_name; + char *db_table; + cdr_leg_t legs; + int debug; + switch_hash_t *template_hash; + char *default_template; + int shutdown; +} globals; + +SWITCH_MODULE_LOAD_FUNCTION(mod_cdr_sqlite_load); +SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cdr_sqlite_shutdown); +SWITCH_MODULE_DEFINITION(mod_cdr_sqlite, mod_cdr_sqlite_load, mod_cdr_sqlite_shutdown, NULL); + + +switch_cache_db_handle_t *cdr_get_db_handle(void) +{ + switch_cache_db_connection_options_t options = { {0} }; + switch_cache_db_handle_t *dbh = NULL; + + options.core_db_options.db_path = globals.db_name; + if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_CORE_DB, &options) != SWITCH_STATUS_SUCCESS) + dbh = NULL; + return dbh; +} + + +static switch_status_t write_cdr(char *sql) +{ + switch_cache_db_handle_t *dbh = NULL; + switch_status_t status = SWITCH_STATUS_FALSE; + + if (!(dbh = cdr_get_db_handle())) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n"); + goto end; + } + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Writing SQL to DB: %s\n", sql); + status = switch_cache_db_execute_sql(dbh, sql, NULL); + + end: + + switch_cache_db_release_db_handle(&dbh); + + return status; +} + + +static switch_status_t my_on_reporting(switch_core_session_t *session) +{ + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_status_t status = SWITCH_STATUS_SUCCESS; + const char *template_str = NULL; + char *expanded_vars, *sql = NULL; + + if (globals.shutdown) { + return SWITCH_STATUS_SUCCESS; + } + + if (!((globals.legs & CDR_LEG_A) && (globals.legs & CDR_LEG_B))) { + if ((globals.legs & CDR_LEG_A)) { + if (switch_channel_get_originator_caller_profile(channel)) { + return SWITCH_STATUS_SUCCESS; + } + } else { + if (switch_channel_get_originatee_caller_profile(channel)) { + return SWITCH_STATUS_SUCCESS; + } + } + } + + if (globals.debug) { + switch_event_t *event; + if (switch_event_create_plain(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) { + char *buf; + switch_channel_event_set_data(channel, event); + switch_event_serialize(event, &buf, SWITCH_FALSE); + switch_assert(buf); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "CHANNEL_DATA:\n%s\n", buf); + switch_event_destroy(&event); + free(buf); + } + } + + template_str = (const char *) switch_core_hash_find(globals.template_hash, globals.default_template); + + if (!template_str) { + template_str = default_template; + } + + expanded_vars = switch_channel_expand_variables(channel, template_str); + + if (!expanded_vars) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error expanding CDR variables.\n"); + return SWITCH_STATUS_FALSE; + } + + sql = switch_mprintf("INSERT INTO %s VALUES (%s)", globals.db_table, expanded_vars); + assert(sql); + write_cdr(sql); + free(sql); + + return status; +} + + +static void event_handler(switch_event_t *event) +{ + const char *sig = switch_event_get_header(event, "Trapped-Signal"); + + if (globals.shutdown) { + return; + } + + if (sig && !strcmp(sig, "HUP")) { + /* Should we do something on SIG_HUP? */ + } +} + + +static switch_state_handler_table_t state_handlers = { + /*.on_init */ NULL, + /*.on_routing */ NULL, + /*.on_execute */ NULL, + /*.on_hangup */ NULL, + /*.on_exchange_media */ NULL, + /*.on_soft_execute */ NULL, + /*.on_consume_media */ NULL, + /*.on_hibernate */ NULL, + /*.on_reset */ NULL, + /*.on_park */ NULL, + /*.on_reporting */ my_on_reporting +}; + + +static switch_status_t load_config(switch_memory_pool_t *pool) +{ + char *cf = "cdr_sqlite.conf"; + switch_xml_t cfg, xml, settings, param; + switch_cache_db_handle_t *dbh = NULL; + char *select_sql = NULL, *create_sql = NULL; + switch_status_t status = SWITCH_STATUS_SUCCESS; + + memset(&globals, 0, sizeof(globals)); + switch_core_hash_init(&globals.template_hash, pool); + + globals.pool = pool; + + switch_core_hash_insert(globals.template_hash, "default", default_template); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding default template.\n"); + globals.legs = CDR_LEG_A; + + if ((xml = switch_xml_open_cfg(cf, &cfg, NULL))) { + + if ((settings = switch_xml_child(cfg, "settings"))) { + for (param = switch_xml_child(settings, "param"); param; param = param->next) { + char *var = (char *) switch_xml_attr_soft(param, "name"); + char *val = (char *) switch_xml_attr_soft(param, "value"); + if (!strcasecmp(var, "debug")) { + globals.debug = switch_true(val); + } else if (!strcasecmp(var, "db-name")) { + globals.db_name = switch_core_strdup(pool, val); + } else if (!strcasecmp(var, "db-table")) { + globals.db_table = switch_core_strdup(pool, val); + } else if (!strcasecmp(var, "legs")) { + globals.legs = 0; + + if (strchr(val, 'a')) { + globals.legs |= CDR_LEG_A; + } + + if (strchr(val, 'b')) { + globals.legs |= CDR_LEG_B; + } + } else if (!strcasecmp(var, "default-template")) { + globals.default_template = switch_core_strdup(pool, val); + } + } + } + + if ((settings = switch_xml_child(cfg, "templates"))) { + for (param = switch_xml_child(settings, "template"); param; param = param->next) { + char *var = (char *) switch_xml_attr(param, "name"); + if (var) { + char *tpl; + tpl = switch_core_strdup(pool, param->txt); + + switch_core_hash_insert(globals.template_hash, var, tpl); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding template %s.\n", var); + } + } + } + switch_xml_free(xml); + } + + if (zstr(globals.db_name)) { + globals.db_name = switch_core_strdup(pool, "cdr"); + } + + if (zstr(globals.db_table)) { + globals.db_table = switch_core_strdup(pool, "cdr"); + } + + if (zstr(globals.default_template)) { + globals.default_template = switch_core_strdup(pool, "default"); + } + + dbh = cdr_get_db_handle(); + + if (dbh) { + select_sql = switch_mprintf("SELECT * FROM %s LIMIT 1", globals.db_table); + assert(select_sql); + + create_sql = switch_mprintf(default_create_sql, globals.db_table); + assert(create_sql); + + /* Check if table exists (try SELECT FROM ...) and create table if query fails */ + switch_cache_db_test_reactive(dbh, select_sql, NULL, create_sql); + free(select_sql); + free(create_sql); + + switch_cache_db_release_db_handle(&dbh); + } + + return status; +} + + +SWITCH_MODULE_LOAD_FUNCTION(mod_cdr_sqlite_load) +{ + switch_status_t status = SWITCH_STATUS_SUCCESS; + + load_config(pool); + + if ((status = switch_event_bind(modname, SWITCH_EVENT_TRAP, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL)) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n"); + return status; + } + + switch_core_add_state_handler(&state_handlers); + *module_interface = switch_loadable_module_create_module_interface(pool, modname); + + return status; +} + + +SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cdr_sqlite_shutdown) +{ + globals.shutdown = 1; + switch_event_unbind_callback(event_handler); + switch_core_remove_state_handler(&state_handlers); + + return SWITCH_STATUS_SUCCESS; +} + + + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4: + */ commit 10257c7d5d6b8f15c2e57af2c9c096e48a3877dd Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Dec 30 11:47:15 2010 -0600 FS-2768 diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index ead0bea..21feaa9 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -2552,6 +2552,7 @@ static void conference_loop_output(conference_member_t *member) write_frame.datalen = bytes; write_frame.samples = samples; memset(write_frame.data, 255, write_frame.datalen); + write_frame.timestamp = timer.samplecount; member_add_file_data(member, write_frame.data, write_frame.datalen); if (switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); @@ -5812,22 +5813,29 @@ SWITCH_STANDARD_APP(conference_function) if (conference && switch_test_flag(&member, MFLAG_KICKED) && conference->kicked_sound) { char *toplay = NULL; char *dfile = NULL; + char *expanded = NULL; if (!strncasecmp(conference->kicked_sound, "say:", 4)) { if (conference->tts_engine && conference->tts_voice) { switch_ivr_speak_text(session, conference->tts_engine, conference->tts_voice, conference->kicked_sound + 4, NULL); } } else { + if ((expanded = switch_channel_expand_variables(switch_core_session_get_channel(session), conference->kicked_sound)) != conference->kicked_sound) { + toplay = expanded; + } else { + expanded = NULL; + toplay = conference->kicked_sound; + } + if (conference->sound_prefix) { - dfile = switch_mprintf("%s%s%s", conference->sound_prefix, SWITCH_PATH_SEPARATOR, conference->kicked_sound); + dfile = switch_mprintf("%s%s%s", conference->sound_prefix, SWITCH_PATH_SEPARATOR, toplay); switch_assert(dfile); toplay = dfile; - } else { - toplay = conference->kicked_sound; } switch_ivr_play_file(session, NULL, toplay, NULL); switch_safe_free(dfile); + switch_safe_free(expanded); } } commit 97a68c50d91b115e4cec42ea5a060470c88f5a23 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Dec 30 11:38:23 2010 -0600 support allowing pidf-ful presence clients to share the same account and 'appear offline' without influencing each other =/ also refactor the contact generation string based on nat into a helper function diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 61d1657..5fd6cd7 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -745,6 +745,14 @@ typedef struct { char *route_uri; } sofia_destination_t; +typedef struct { + char network_ip[80]; + int network_port; + const char *is_nat; + int is_auto_nat; +} sofia_nat_parse_t; + + #define sofia_test_pflag(obj, flag) ((obj)->pflags[flag] ? 1 : 0) #define sofia_set_pflag(obj, flag) (obj)->pflags[flag] = 1 #define sofia_set_pflag_locked(obj, flag) assert(obj->flag_mutex != NULL);\ @@ -1040,3 +1048,4 @@ switch_status_t sofia_glue_sdp_map(const char *r_sdp, switch_event_t **fmtp, swi void sofia_glue_build_vid_refresh_message(switch_core_session_t *session, const char *pl); void sofia_glue_check_dtmf_type(private_object_t *tech_pvt); void sofia_glue_parse_rtp_bugs(uint32_t *flag_pole, const char *str); +char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, sofia_nat_parse_t *np); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 029f60a..4779ef1 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -6136,6 +6136,129 @@ void sofia_glue_parse_rtp_bugs(uint32_t *flag_pole, const char *str) } } +char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, sofia_nat_parse_t *np) +{ + char *contact_str = NULL; + const char *contact_host, *contact_user; + sip_contact_t const *contact; + char *port; + const char *display = "\"user\""; + char new_port[25] = ""; + sofia_nat_parse_t lnp = { { 0 } }; + const char *ipv6; + sip_from_t const *from; + + if (!sip || !sip->sip_contact || !sip->sip_contact->m_url) { + return NULL; + } + + from = sip->sip_from; + contact = sip->sip_contact; + + if (!np) { + np = &lnp; + } + + sofia_glue_get_addr(nua_current_request(profile->nua), np->network_ip, sizeof(np->network_ip), &np->network_port); + + if (sofia_glue_check_nat(profile, np->network_ip)) { + np->is_auto_nat = 1; + } + + port = (char *) contact->m_url->url_port; + contact_host = sip->sip_contact->m_url->url_host; + contact_user = sip->sip_contact->m_url->url_user; + + display = contact->m_display; + + + if (zstr(display)) { + if (from) { + display = from->a_display; + if (zstr(display)) { + display = "\"user\""; + } + } + } else { + display = "\"user\""; + } + + if (sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION)) { + if (sip->sip_via) { + const char *v_port = sip->sip_via->v_port; + const char *v_host = sip->sip_via->v_host; + + if (v_host && sip->sip_via->v_received) { + np->is_nat = "via received"; + } else if (v_host && strcmp(np->network_ip, v_host)) { + np->is_nat = "via host"; + } else if (v_port && atoi(v_port) != np->network_port) { + np->is_nat = "via port"; + } + } + } + + if (!np->is_nat && sip && sip->sip_via && sip->sip_via->v_port && + atoi(sip->sip_via->v_port) == 5060 && np->network_port != 5060 ) { + np->is_nat = "via port"; + } + + if (!np->is_nat && profile->nat_acl_count) { + uint32_t x = 0; + int ok = 1; + char *last_acl = NULL; + + if (!zstr(contact_host)) { + for (x = 0; x < profile->nat_acl_count; x++) { + last_acl = profile->nat_acl[x]; + if (!(ok = switch_check_network_list_ip(contact_host, last_acl))) { + break; + } + } + + if (ok) { + np->is_nat = last_acl; + } + } + } + + if (np->is_nat && profile->local_network && switch_check_network_list_ip(np->network_ip, profile->local_network)) { + if (profile->debug) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IP %s is on local network, not seting NAT mode.\n", np->network_ip); + } + np->is_nat = NULL; + } + + if (zstr(contact_host)) { + np->is_nat = "No contact host"; + } + + if (np->is_nat) { + contact_host = np->network_ip; + switch_snprintf(new_port, sizeof(new_port), ":%d", np->network_port); + port = NULL; + } + + + if (port) { + switch_snprintf(new_port, sizeof(new_port), ":%s", port); + } + + ipv6 = strchr(contact_host, ':'); + if (contact->m_url->url_params) { + contact_str = switch_mprintf("%s <sip:%s@%s%s%s%s;%s>%s", + display, contact->m_url->url_user, + ipv6 ? "[" : "", + contact_host, ipv6 ? "]" : "", new_port, contact->m_url->url_params, np->is_nat ? ";fs_nat=yes" : ""); + } else { + contact_str = switch_mprintf("%s <sip:%s@%s%s%s%s>%s", + display, + contact->m_url->url_user, ipv6 ? "[" : "", contact_host, ipv6 ? "]" : "", new_port, np->is_nat ? ";fs_nat=yes" : ""); + } + + + return contact_str; +} diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 4b93492..6829605 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -289,7 +289,8 @@ void sofia_presence_cancel(void) if ((sql = switch_mprintf("select proto,sip_user,sip_host,sub_to_user,sub_to_host,event,contact,call_id,full_from," "full_via,expires,user_agent,accept,profile_name,network_ip" - ",-1,'unavailable','unavailable' from sip_subscriptions where expires > -1 and event='presence' and hostname='%q'", + ",-1,'unavailable','unavailable' from sip_subscriptions where version > -1 and " + "expires > -1 and event='presence' and hostname='%q'", mod_sofia_globals.hostname))) { switch_mutex_lock(mod_sofia_globals.hash_mutex); for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) { @@ -322,7 +323,7 @@ void sofia_presence_establish_presence(sofia_profile_t *profile) if (sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, "select sub_to_user,sub_to_host,'Online','unknown',proto from sip_subscriptions " - "where expires > -1 and proto='ext' or proto='user' or proto='conf'", + "where expires > -1 and version > -1 and proto='ext' or proto='user' or proto='conf'", sofia_presence_resub_callback, &h) != SWITCH_TRUE) { return; } @@ -435,12 +436,12 @@ static void actual_sofia_presence_mwi_event_handler(switch_event_t *event) if (for_everyone) { sql = switch_mprintf("select proto,sip_user,sip_host,sub_to_user,sub_to_host,event,contact,call_id,full_from," "full_via,expires,user_agent,accept,profile_name,network_ip" - ",'%q','%q' from sip_subscriptions where expires > -1 and event='message-summary' " + ",'%q','%q' from sip_subscriptions where version > -1 and expires > -1 and event='message-summary' " "and sub_to_user='%q' and (sub_to_host='%q' or presence_hosts like '%%%q%%')", stream.data, host, user, host, host); } else if (sub_call_id) { sql = switch_mprintf("select proto,sip_user,sip_host,sub_to_user,sub_to_host,event,contact,call_id,full_from," "full_via,expires,user_agent,accept,profile_name,network_ip" - ",'%q','%q' from sip_subscriptions where expires > -1 and event='message-summary' " + ",'%q','%q' from sip_subscriptions where version > -1 and expires > -1 and event='message-summary' " "and sub_to_user='%q' and (sub_to_host='%q' or presence_hosts like '%%%q%%' and call_id='%q')", stream.data, host, user, host, host, sub_call_id); } @@ -545,7 +546,8 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) "from sip_subscriptions left join sip_presence on " "(sip_subscriptions.sub_to_user=sip_presence.sip_user and sip_subscriptions.sub_to_host=sip_presence.sip_host and " "sip_subscriptions.profile_name=sip_presence.profile_name) " - "where sip_subscriptions.expires > -1 and sip_subscriptions.event='presence' and sip_subscriptions.full_from like '%%%q%%'", + "where sip_subscriptions.version > -1 and " + "sip_subscriptions.expires > -1 and sip_subscriptions.event='presence' and sip_subscriptions.full_from like '%%%q%%'", switch_str_nil(status), switch_str_nil(rpid), from); } else { sql = switch_mprintf("select sip_subscriptions.proto,sip_subscriptions.sip_user,sip_subscriptions.sip_host," @@ -557,7 +559,8 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) "from sip_subscriptions left join sip_presence on " "(sip_subscriptions.sub_to_user=sip_presence.sip_user and sip_subscriptions.sub_to_host=sip_presence.sip_host and " "sip_subscriptions.profile_name=sip_presence.profile_name) " - "where sip_subscriptions.expires > -1 and sip_subscriptions.event='presence'", switch_str_nil(status), + "where sip_subscriptions.version > -1 and " + "sip_subscriptions.expires > -1 and sip_subscriptions.event='presence'", switch_str_nil(status), switch_str_nil(rpid)); } @@ -833,7 +836,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) "(sip_subscriptions.sub_to_user=sip_presence.sip_user and sip_subscriptions.sub_to_host=sip_presence.sip_host and " "sip_subscriptions.profile_name=sip_presence.profile_name) " - "where sip_subscriptions.expires > -1 and " + "where sip_subscriptions.version > -1 and sip_subscriptions.expires > -1 and " "(event='%q' or event='%q') and sub_to_user='%q' " "and (sub_to_host='%q' or presence_hosts like '%%%q%%') " "and (sip_subscriptions.profile_name = '%q' or sip_subscriptions.presence_hosts != sip_subscriptions.sub_to_host) ", @@ -2009,13 +2012,13 @@ static void sync_sla(sofia_profile_t *profile, const char *to_user, const char * if (unseize) { sql = switch_mprintf("select call_id,expires,sub_to_user,sub_to_host,event " "from sip_subscriptions " - "where expires > -1 and hostname='%q' " + "where version > -1 and expires > -1 and hostname='%q' " "and sub_to_user='%q' and sub_to_host='%q' " "and (event='call-info' or event='line-seize')", mod_sofia_globals.hostname, to_user, to_host); } else { sql = switch_mprintf("select call_id,expires,sub_to_user,sub_to_host,event " "from sip_subscriptions " - "where expires > -1 and hostname='%q' " + "where version > -1 and expires > -1 and hostname='%q' " "and sub_to_user='%q' and sub_to_host='%q' " "and (event='call-info')", mod_sofia_globals.hostname, to_user, to_host); } @@ -2044,350 +2047,287 @@ static void sync_sla(sofia_profile_t *profile, const char *to_user, const char * } - void sofia_presence_handle_sip_i_subscribe(int status, char const *phrase, nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]) { - if (sip) { - long exp_abs, exp_delta; - char exp_delta_str[30] = ""; - sip_to_t const *to = sip->sip_to; - sip_from_t const *from = sip->sip_from; - sip_contact_t const *contact = sip->sip_contact; - const char *from_user = NULL, *from_host = NULL; - const char *to_user = NULL, *to_host = NULL; - char *my_to_user = NULL; - char *sql, *event = NULL; - char *proto = "sip"; - char *d_user = NULL; - char *contact_str = ""; - const char *call_id = NULL; - char *to_str = NULL; - char *full_from = NULL; - char *full_via = NULL; - char *full_agent = NULL; - char *sstr; - const char *display = "\"user\""; - switch_event_t *sevent; - int sub_state; - int sent_reply = 0; - int network_port = 0; - char network_ip[80]; - const char *contact_host, *contact_user; - char *port; - char new_port[25] = ""; - char *is_nat = NULL; - int is_auto_nat = 0; - const char *ipv6; - - if (!(contact && sip->sip_contact->m_url)) { - nua_respond(nh, 481, "INVALID SUBSCRIPTION", TAG_END()); - return; - } - sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), &network_port); + long exp_abs, exp_delta; + char exp_delta_str[30] = ""; + sip_to_t const *to; + const char *from_user = NULL, *from_host = NULL; + const char *to_user = NULL, *to_host = NULL; + char *my_to_user = NULL; + char *sql, *event = NULL; + char *proto = "sip"; + char *d_user = NULL; + char *contact_str = ""; + const char *call_id = NULL; + char *to_str = NULL; + char *full_from = NULL; + char *full_via = NULL; + char *full_agent = NULL; + char *sstr; + switch_event_t *sevent; + int sub_state; + int sent_reply = 0; + sip_contact_t const *contact; + const char *ipv6; + const char *contact_host, *contact_user; + sofia_nat_parse_t np = { { 0 } }; - if (sofia_glue_check_nat(profile, network_ip)) { - is_auto_nat = 1; - } + if (!sip) { + return; + } - tl_gets(tags, NUTAG_SUBSTATE_REF(sub_state), TAG_END()); + to = sip->sip_to; + contact = sip->sip_contact; - event = sip_header_as_string(profile->home, (void *) sip->sip_event); + if (!(contact_str = sofia_glue_gen_contact_str(profile, sip, &np))) { + nua_respond(nh, 481, "INVALID SUBSCRIPTION", TAG_END()); + return; + } - port = (char *) contact->m_url->url_port; - contact_host = sip->sip_contact->m_url->url_host; - contact_user = sip->sip_contact->m_url->url_user; + contact_host = sip->sip_contact->m_url->url_host; + contact_user = sip->sip_contact->m_url->url_user; - display = contact->m_display; + tl_gets(tags, NUTAG_SUBSTATE_REF(sub_state), TAG_END()); - if (zstr(display)) { - if (from) { - display = from->a_display; - if (zstr(display)) { - display = "\"user\""; - } - } - } else { - display = "\"user\""; - } + event = sip_header_as_string(profile->home, (void *) sip->sip_event); - if (sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION)) { - if (sip && sip->sip_via) { - const char *v_port = sip->sip_via->v_port; - const char *v_host = sip->sip_via->v_host; - if (v_host && sip->sip_via->v_received) { - is_nat = "via received"; - } else if (v_host && strcmp(network_ip, v_host)) { - is_nat = "via host"; - } else if (v_port && atoi(v_port) != network_port) { - is_nat = "via port"; - } + /* the following could be refactored back to the calling event handler in sofia.c XXX MTK */ + if (sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)) { + if (sip->sip_request->rq_url->url_user && !strncmp(sip->sip_request->rq_url->url_user, "sla-agent", sizeof("sla-agent"))) { + /* only fire this on <200 to try to avoid resubscribes. probably better ways to do this? */ + if (status < 200) { + sofia_sla_handle_sip_i_subscribe(nua, contact_str, profile, nh, sip, tags); } + switch_safe_free(contact_str); + return; } + } - if (!is_nat && sip && sip->sip_via && sip->sip_via->v_port && - atoi(sip->sip_via->v_port) == 5060 && network_port != 5060 ) { - is_nat = "via port"; - } + if (to) { + to_str = switch_mprintf("sip:%s@%s", to->a_url->url_user, to->a_url->url_host); + } - if (!is_nat && profile->nat_acl_count) { - uint32_t x = 0; - int ok = 1; - char *last_acl = NULL; + if (to) { + to_user = to->a_url->url_user; + to_host = to->a_url->url_host; + } - if (!zstr(contact_host)) { - for (x = 0; x < profile->nat_acl_count; x++) { - last_acl = profile->nat_acl[x]; - if (!(ok = switch_check_network_list_ip(contact_host, last_acl))) { - break; - } - } + if (profile->sub_domain) { + to_host = profile->sub_domain; + } - if (ok) { - is_nat = last_acl; - } - } - } + if (sip->sip_from) { + from_user = sip->sip_from->a_url->url_user; + from_host = sip->sip_from->a_url->url_host; + } else { + from_user = "n/a"; + from_host = "n/a"; + } - if (is_nat && profile->local_network && switch_check_network_list_ip(network_ip, profile->local_network)) { - if (profile->debug) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IP %s is on local network, not seting NAT mode.\n", network_ip); - } - is_nat = NULL; + if ((exp_delta = sip->sip_expires ? sip->sip_expires->ex_delta : 3600)) { + if (profile->force_subscription_expires) { + exp_delta = profile->force_subscription_expires; } + } - if (zstr(contact_host)) { - is_nat = "No contact host"; - } + if (exp_delta) { + exp_abs = (long) switch_epoch_time_now(NULL) + exp_delta; + } else { + exp_abs = 0; + sub_state = nua_substate_terminated; + } - if (is_nat) { - contact_host = network_ip; - switch_snprintf(new_port, sizeof(new_port), ":%d", network_port); - port = NULL; - } + switch_snprintf(exp_delta_str, sizeof(exp_delta_str), "%ld", exp_delta); - if (zstr(contact_host)) { - nua_respond(nh, 481, "INVALID SUBSCRIPTION", TAG_END()); - return; + if (to_user && strchr(to_user, '+')) { + char *h; + if ((proto = (d_user = strdup(to_user)))) { + if ((my_to_user = strchr(d_user, '+'))) { + *my_to_user++ = '\0'; + to_user = my_to_user; + if ((h = strchr(to_user, '+')) || (h = strchr(to_user, '@'))) { + *h++ = '\0'; + to_host = h; + } + } } - if (port) { - switch_snprintf(new_port, sizeof(new_port), ":%s", port); + if (!(proto && to_user && to_host)) { + nua_respond(nh, SIP_404_NOT_FOUND, NUTAG_WITH_THIS(nua), TAG_END()); + goto end; } + } - ipv6 = strchr(contact_host, ':'); - if (contact->m_url->url_params) { - contact_str = switch_mprintf("%s <sip:%s@%s%s%s%s;%s>%s", - display, contact->m_url->url_user, - ipv6 ? "[" : "", - contact_host, ipv6 ? "]" : "", new_port, contact->m_url->url_params, is_nat ? ";fs_nat=yes" : ""); - } else { - contact_str = switch_mprintf("%s <sip:%s@%s%s%s%s>%s", - display, - contact->m_url->url_user, ipv6 ? "[" : "", contact_host, ipv6 ? "]" : "", new_port, is_nat ? ";fs_nat=yes" : ""); - } + call_id = sip->sip_call_id->i_id; + full_from = sip_header_as_string(profile->home, (void *) sip->sip_from); + full_via = sip_header_as_string(profile->home, (void *) sip->sip_via); + if (sip->sip_expires && sip->sip_expires->ex_delta > 31536000) { + sip->sip_expires->ex_delta = 31536000; + } + if (sofia_test_pflag(profile, PFLAG_MULTIREG)) { + sql = switch_mprintf("delete from sip_subscriptions where call_id='%q' " + "or (proto='%q' and sip_user='%q' and sip_host='%q' " + "and sub_to_user='%q' and sub_to_host='%q' and event='%q' and hostname='%q' " + "and contact='%q')", + call_id, proto, from_user, from_host, to_user, to_host, event, mod_sofia_globals.hostname, contact_str); - /* the following could be refactored back to the calling event handler in sofia.c XXX MTK */ - if (sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)) { - if (sip->sip_request->rq_url->url_user && !strncmp(sip->sip_request->rq_url->url_user, "sla-agent", sizeof("sla-agent"))) { - /* only fire this on <200 to try to avoid resubscribes. probably better ways to do this? */ - if (status < 200) { - sofia_sla_handle_sip_i_subscribe(nua, contact_str, profile, nh, sip, tags); - } - switch_safe_free(contact_str); - return; - } - } + } else { + sql = switch_mprintf("delete from sip_subscriptions where " + "proto='%q' and sip_user='%q' and sip_host='%q' and sub_to_user='%q' and sub_to_host='%q' and event='%q' and hostname='%q'", + proto, from_user, from_host, to_user, to_host, event, mod_sofia_globals.hostname); + } + switch_mutex_lock(profile->ireg_mutex); + switch_assert(sql != NULL); + sofia_glue_actually_execute_sql(profile, sql, NULL); + switch_safe_free(sql); + if (sub_state == nua_substate_terminated) { + sstr = switch_mprintf("terminated"); + } else { + sip_accept_t *ap = sip->sip_accept; + char accept[256] = ""; + full_agent = sip_header_as_string(profile->home, (void *) sip->sip_user_agent); + while (ap) { + switch_snprintf(accept + strlen(accept), sizeof(accept) - strlen(accept), "%s%s ", ap->ac_type, ap->ac_next ? "," : ""); + ap = ap->ac_next; + } + + sql = switch_mprintf("insert into sip_subscriptions " + "(proto,sip_user,sip_host,sub_to_user,sub_to_host,presence_hosts,event,contact,call_id,full_from," + "full_via,expires,user_agent,accept,profile_name,hostname,network_port,network_ip) " + "values ('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q',%ld,'%q','%q','%q','%q','%d','%q')", + proto, from_user, from_host, to_user, to_host, profile->presence_hosts ? profile->presence_hosts : to_host, + event, contact_str, call_id, full_from, full_via, + //sofia_test_pflag(profile, PFLAG_MULTIREG) ? switch_epoch_time_now(NULL) + exp_delta : exp_delta * -1, + (long) switch_epoch_time_now(NULL) + (exp_delta * 2), + full_agent, accept, profile->name, mod_sofia_globals.hostname, np.network_port, np.network_ip); - if (to) { - to_str = switch_mprintf("sip:%s@%s", to->a_url->url_user, to->a_url->url_host); - } + switch_assert(sql != NULL); - if (to) { - to_user = to->a_url->url_user; - to_host = to->a_url->url_host; + if (mod_sofia_globals.debug_presence > 0 || mod_sofia_globals.debug_sla > 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "%s SUBSCRIBE %s@%s %s@%s\n%s\n", + profile->name, from_user, from_host, to_user, to_host, sql); } - if (profile->sub_domain) { - to_host = profile->sub_domain; - } - if (sip && sip->sip_from) { - from_user = sip->sip_from->a_url->url_user; - from_host = sip->sip_from->a_url->url_host; - } else { - from_user = "n/a"; - from_host = "n/a"; - } + sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); + sstr = switch_mprintf("active;expires=%ld", exp_delta); + } + + switch_mutex_unlock(profile->ireg_mutex); + + if (status < 200) { + char *sticky = NULL; + char *contactstr = profile->url, *cs = NULL; + char *p = NULL, *new_contactstr = NULL; - if ((exp_delta = sip->sip_expires ? sip->sip_expires->ex_delta : 3600)) { - if (profile->force_subscription_expires) { - exp_delta = profile->force_subscription_expires; + if (np.is_nat) { + char params[128] = ""; + if (contact->m_url->url_params) { + switch_snprintf(params, sizeof(params), ";%s", contact->m_url->url_params); } + ipv6 = strchr(np.network_ip, ':'); + sticky = switch_mprintf("sip:%s@%s%s%s:%d%s", contact_user, ipv6 ? "[" : "", np.network_ip, ipv6 ? "]" : "", np.network_port, params); } - if (exp_delta) { - exp_abs = (long) switch_epoch_time_now(NULL) + exp_delta; + if (np.is_auto_nat) { + contactstr = profile->public_url; } else { - exp_abs = 0; - sub_state = nua_substate_terminated; + contactstr = profile->url; } - switch_snprintf(exp_delta_str, sizeof(exp_delta_str), "%ld", exp_delta); - if (to_user && strchr(to_user, '+')) { - char *h; - if ((proto = (d_user = strdup(to_user)))) { - if ((my_to_user = strchr(d_user, '+'))) { - *my_to_user++ = '\0'; - to_user = my_to_user; - if ((h = strchr(to_user, '+')) || (h = strchr(to_user, '@'))) { - *h++ = '\0'; - to_host = h; - } - } + if (switch_stristr("port=tcp", contact->m_url->url_params)) { + if (np.is_auto_nat) { + cs = profile->tcp_public_contact; + } else { + cs = profile->tcp_contact; } - - if (!(proto && to_user && to_host)) { - nua_respond(nh, SIP_404_NOT_FOUND, NUTAG_WITH_THIS(nua), TAG_END()); - goto end; + } else if (switch_stristr("port=tls", contact->m_url->url_params)) { + if (np.is_auto_nat) { + cs = profile->tls_public_contact; + } else { + cs = profile->tls_contact; } } - call_id = sip->sip_call_id->i_id; - full_from = sip_header_as_string(profile->home, (void *) sip->sip_from); - full_via = sip_header_as_string(profile->home, (void *) sip->sip_via); - - if (sip && sip->sip_expires && sip->sip_expires->ex_delta > 31536000) { - sip->sip_expires->ex_delta = 31536000; + if (cs) { + contactstr = cs; } - if (sofia_test_pflag(profile, PFLAG_MULTIREG)) { - sql = switch_mprintf("delete from sip_subscriptions where call_id='%q' " - "or (proto='%q' and sip_user='%q' and sip_host='%q' " - "and sub_to_user='%q' and sub_to_host='%q' and event='%q' and hostname='%q' " - "and contact='%q')", - call_id, proto, from_user, from_host, to_user, to_host, event, mod_sofia_globals.hostname, contact_str); - - } else { - sql = switch_mprintf("delete from sip_subscriptions where " - "proto='%q' and sip_user='%q' and sip_host='%q' and sub_to_user='%q' and sub_to_host='%q' and event='%q' and hostname='%q'", - proto, from_user, from_host, to_user, to_host, event, mod_sofia_globals.hostname); + + if (nh && nh->nh_ds && nh->nh_ds->ds_usage) { + /* nua_dialog_usage_set_refresh_range(nh->nh_ds->ds_usage, exp_delta + SUB_OVERLAP, exp_delta + SUB_OVERLAP); */ + nua_dialog_usage_set_refresh_range(nh->nh_ds->ds_usage, exp_delta * 2, exp_delta * 2); } - switch_mutex_lock(profile->ireg_mutex); - switch_assert(sql != NULL); - sofia_glue_actually_execute_sql(profile, sql, NULL); - switch_safe_free(sql); - - if (sub_state == nua_substate_terminated) { - sstr = switch_mprintf("terminated"); - } else { - sip_accept_t *ap = sip->sip_accept; - char accept[256] = ""; - full_agent = sip_header_as_string(profile->home, (void *) sip->sip_user_agent); - while (ap) { - switch_snprintf(accept + strlen(accept), sizeof(accept) - strlen(accept), "%s%s ", ap->ac_type, ap->ac_next ? "," : ""); - ap = ap->ac_next; - } - - sql = switch_mprintf("insert into sip_subscriptions " - "(proto,sip_user,sip_host,sub_to_user,sub_to_host,presence_hosts,event,contact,call_id,full_from," - "full_via,expires,user_agent,accept,profile_name,hostname,network_port,network_ip) " - "values ('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q',%ld,'%q','%q','%q','%q','%d','%q')", - proto, from_user, from_host, to_user, to_host, profile->presence_hosts ? profile->presence_hosts : to_host, - event, contact_str, call_id, full_from, full_via, - //sofia_test_pflag(profile, PFLAG_MULTIREG) ? switch_epoch_time_now(NULL) + exp_delta : exp_delta * -1, - (long) switch_epoch_time_now(NULL) + (exp_delta * 2), - full_agent, accept, profile->name, mod_sofia_globals.hostname, network_port, network_ip); - - switch_assert(sql != NULL); - - if (mod_sofia_globals.debug_presence > 0 || mod_sofia_globals.debug_sla > 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "%s SUBSCRIBE %s@%s %s@%s\n%s\n", - profile->name, from_user, from_host, to_user, to_host, sql); + if (contactstr && (p = strchr(contactstr, '@'))) { + if (strrchr(p, '>')) { + new_contactstr = switch_mprintf("<sip:%s%s", to_user, p); + } else { + new_contactstr = switch_mprintf("<sip:%s%s>", to_user, p); } - - - sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); - sstr = switch_mprintf("active;expires=%ld", exp_delta); } - switch_mutex_unlock(profile->ireg_mutex); + nua_respond(nh, SIP_202_ACCEPTED, + TAG_IF(new_contactstr, SIPTAG_CONTACT_STR(new_contactstr)), + NUTAG_WITH_THIS(nua), + SIPTAG_SUBSCRIPTION_STATE_STR(sstr), SIPTAG_EXPIRES_STR(exp_delta_str), TAG_IF(sticky, NUTAG_PROXY(sticky)), TAG_END()); - if (status < 200) { - char *sticky = NULL; - char *contactstr = profile->url, *cs = NULL; - char *p = NULL, *new_contactstr = NULL; + switch_safe_free(new_contactstr); + switch_safe_free(sticky); + } - if (is_nat) { - char params[128] = ""; - if (contact->m_url->url_params) { - switch_snprintf(params, sizeof(params), ";%s", contact->m_url->url_params); - } - ipv6 = strchr(network_ip, ':'); - sticky = switch_mprintf("sip:%s@%s%s%s:%d%s", contact_user, ipv6 ? "[" : "", network_ip, ipv6 ? "]" : "", network_port, params); - } + if (sub_state == nua_substate_terminated) { + char *full_call_info = NULL; + char *p = NULL; - if (is_auto_nat) { - contactstr = profile->public_url; - } else { - contactstr = profile->url; + if (sip->sip_call_info) { + full_call_info = sip_header_as_string(profile->home, (void *) sip->sip_call_info); + if ((p = strchr(full_call_info, ';'))) { + p++; } + nua_notify(nh, + SIPTAG_EXPIRES_STR("0"), + SIPTAG_SUBSCRIPTION_STATE_STR(sstr), TAG_IF(full_call_info, SIPTAG_CALL_INFO_STR(full_call_info)), TAG_END()); - if (switch_stristr("port=tcp", contact->m_url->url_params)) { - if (is_auto_nat) { - cs = profile->tcp_public_contact; - } else { - cs = profile->tcp_contact; - } - } else if (switch_stristr("port=tls", contact->m_url->url_params)) { - if (is_auto_nat) { - cs = profile->tls_public_contact; - } else { - cs = profile->tls_contact; + + if (!strcasecmp(event, "line-seize")) { + if (mod_sofia_globals.debug_sla > 1) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "CANCEL LINE SEIZE\n"); } - } - if (cs) { - contactstr = cs; - } + sql = switch_mprintf("delete from sip_dialogs where ((sip_from_user='%q' and sip_from_host='%q') or presence_id='%q@%q') " + "and call_info_state='seized'", + to_user, to_host, to_user, to_host); - - if (nh && nh->nh_ds && nh->nh_ds->ds_usage) { - /* nua_dialog_usage_set_refresh_range(nh->nh_ds->ds_usage, exp_delta + SUB_OVERLAP, exp_delta + SUB_OVERLAP); */ - nua_dialog_usage_set_refresh_range(nh->nh_ds->ds_usage, exp_delta * 2, exp_delta * 2); - } - if (contactstr && (p = strchr(contactstr, '@'))) { - if (strrchr(p, '>')) { - new_contactstr = switch_mprintf("<sip:%s%s", to_user, p); - } else { - new_contactstr = switch_mprintf("<sip:%s%s>", to_user, p); + if (mod_sofia_globals.debug_sla > 1) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "CLEAR SQL %s\n", sql); } + sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); + + sync_sla(profile, to_user, to_host, SWITCH_FALSE, SWITCH_FALSE); } - nua_respond(nh, SIP_202_ACCEPTED, - TAG_IF(new_contactstr, SIPTAG_CONTACT_STR(new_contactstr)), - NUTAG_WITH_THIS(nua), - SIPTAG_SUBSCRIPTION_STATE_STR(sstr), SIPTAG_EXPIRES_STR(exp_delta_str), TAG_IF(sticky, NUTAG_PROXY(sticky)), TAG_END()); + su_free(profile->home, full_call_info); - switch_safe_free(new_contactstr); - switch_safe_free(sticky); } - - if (sub_state == nua_substate_terminated) { + + } else { + if (!strcasecmp(event, "line-seize")) { char *full_call_info = NULL; - char *p = NULL; + char *p; if (sip->sip_call_info) { full_call_info = sip_header_as_string(profile->home, (void *) sip->sip_call_info); @@ -2396,153 +2336,117 @@ void sofia_presence_handle_sip_i_subscribe(int status, } nua_notify(nh, - SIPTAG_EXPIRES_STR("0"), - SIPTAG_SUBSCRIPTION_STATE_STR(sstr), TAG_IF(full_call_info, SIPTAG_CALL_INFO_STR(full_call_info)), TAG_END()); + SIPTAG_EXPIRES_STR(exp_delta_str), + SIPTAG_SUBSCRIPTION_STATE_STR(sstr), + SIPTAG_EVENT_STR("line-seize"), TAG_IF(full_call_info, SIPTAG_CALL_INFO_STR(full_call_info)), TAG_END()); - if (!strcasecmp(event, "line-seize")) { - if (mod_sofia_globals.debug_sla > 1) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "CANCEL LINE SEIZE\n"); - } - sql = switch_mprintf("delete from sip_dialogs where ((sip_from_user='%q' and sip_from_host='%q') or presence_id='%q@%q') " - "and call_info_state='seized'", - to_user, to_host, to_user, to_host); + sql = switch_mprintf("delete from sip_dialogs where ((sip_from_user='%q' and sip_from_host='%q') or presence_id='%q@%q') " + "and call_info_state='seized'", + to_user, to_host, to_user, to_host); - if (mod_sofia_globals.debug_sla > 1) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "CLEAR SQL %s\n", sql); - } - sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); - - sync_sla(profile, to_user, to_host, SWITCH_FALSE, SWITCH_FALSE); + if (mod_sofia_globals.debug_sla > 1) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "CLEAR SQL %s\n", sql); } + sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); - su_free(profile->home, full_call_info); - - } - - } else { - if (!strcasecmp(event, "line-seize")) { - char *full_call_info = NULL; - char *p; - - if (sip->sip_call_info) { - full_call_info = sip_header_as_string(profile->home, (void *) sip->sip_call_info); - if ((p = strchr(full_call_info, ';'))) { - p++; - } - - nua_notify(nh, - SIPTAG_EXPIRES_STR(exp_delta_str), - SIPTAG_SUBSCRIPTION_STATE_STR(sstr), - SIPTAG_EVENT_STR("line-seize"), TAG_IF(full_call_info, SIPTAG_CALL_INFO_STR(full_call_info)), TAG_END()); - - - - sql = switch_mprintf("delete from sip_dialogs where ((sip_from_user='%q' and sip_from_host='%q') or presence_id='%q@%q') " - "and call_info_state='seized'", - to_user, to_host, to_user, to_host); - + sql = switch_mprintf("insert into sip_dialogs (sip_from_user,sip_from_host,call_info,call_info_state,hostname,expires) " + "values ('%q','%q','%q','seized','%q',%ld)", + to_user, to_host, switch_str_nil(p), mod_sofia_globals.hostname, switch_epoch_time_now(NULL) + exp_delta); - if (mod_sofia_globals.debug_sla > 1) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "CLEAR SQL %s\n", sql); - } - sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); - - sql = switch_mprintf("insert into sip_dialogs (sip_from_user,sip_from_host,call_info,call_info_state,hostname,expires) " - "values ('%q','%q','%q','seized','%q',%ld)", - to_user, to_host, switch_str_nil(p), mod_sofia_globals.hostname, switch_epoch_time_now(NULL) + exp_delta); - - if (mod_sofia_globals.debug_sla > 1) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SEIZE SQL %s\n", sql); - } - sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); - sync_sla(profile, to_user, to_host, SWITCH_FALSE, SWITCH_FALSE); - - su_free(profile->home, full_call_info); + if (mod_sofia_globals.debug_sla > 1) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SEIZE SQL %s\n", sql); } - } else if (!strcasecmp(event, "call-info")) { + sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); sync_sla(profile, to_user, to_host, SWITCH_FALSE, SWITCH_FALSE); + + su_free(profile->home, full_call_info); } + } else if (!strcasecmp(event, "call-info")) { + sync_sla(profile, to_user, to_host, SWITCH_FALSE, SWITCH_FALSE); } + } - sent_reply++; + sent_reply++; - switch_safe_free(sstr); + switch_safe_free(sstr); - if (!strcasecmp(event, "message-summary")) { - if ((sql = switch_mprintf("select proto,sip_user,'%q',sub_to_user,sub_to_host,event,contact,call_id,full_from," - "full_via,expires,user_agent,accept,profile_name,network_ip" - " from sip_subscriptions where expires > -1 and event='message-summary' and sip_user='%q' " - "and (sip_host='%q' or presence_hosts like '%%%q%%')", to_host, to_user, to_host, to_host))) { - sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_sub_reg_callback, profile); + if (!strcasecmp(event, "message-summary")) { + if ((sql = switch_mprintf("select proto,sip_user,'%q',sub_to_user,sub_to_host,event,contact,call_id,full_from," + "full_via,expires,user_agent,accept,profile_name,network_ip" + " from sip_subscriptions where version > -1 and " + "expires > -1 and event='message-summary' and sip_user='%q' " + "and (sip_host='%q' or presence_hosts like '%%%q%%')", to_host, to_user, to_host, to_host))) { + sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_sub_reg_callback, profile); - switch_safe_free(sql); - } + switch_safe_free(sql); } + } - end: + end: - if (to_user && (strstr(to_user, "ext+") || strstr(to_user, "user+"))) { - char protocol[80]; - char *p; + if (to_user && (strstr(to_user, "ext+") || strstr(to_user, "user+"))) { + char protocol[80]; + char *p; - switch_copy_string(protocol, to_user, sizeof(protocol)); - if ((p = strchr(protocol, '+'))) { - *p = '\0'; - } + switch_copy_string(protocol, to_user, sizeof(protocol)); + if ((p = strchr(protocol, '+'))) { + *p = '\0'; + } - if (switch_event_create(&sevent, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "proto", protocol); - switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "login", profile->name); - switch_event_add_header(sevent, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, to_host); - switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "rpid", "active"); - switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "status", "Click To Call"); - switch_event_fire(&sevent); - } + if (switch_event_create(&sevent, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "proto", protocol); + switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "login", profile->name); + switch_event_add_header(sevent, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, to_host); + switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "rpid", "active"); + switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "status", "Click To Call"); + switch_event_fire(&sevent); + } - } else { - if (switch_event_create(&sevent, SWITCH_EVENT_PRESENCE_PROBE) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); - switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "login", profile->name); - switch_event_add_header(sevent, SWITCH_STACK_BOTTOM, "from", "%s@%s", from_user, from_host); - switch_event_add_header(sevent, SWITCH_STACK_BOTTOM, "to", "%s@%s", to_user, to_host); - switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "proto-specific-event-name", event); - switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "expires", exp_delta_str); - switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "event_type", "presence"); - switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog"); - switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "expires", exp_delta_str); - switch_event_fire(&sevent); - } + } else { + if (switch_event_create(&sevent, SWITCH_EVENT_PRESENCE_PROBE) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); + switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "login", profile->name); + switch_event_add_header(sevent, SWITCH_STACK_BOTTOM, "from", "%s@%s", from_user, from_host); + switch_event_add_header(sevent, SWITCH_STACK_BOTTOM, "to", "%s@%s", to_user, to_host); + switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "proto-specific-event-name", event); + switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "expires", exp_delta_str); + switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "event_type", "presence"); + switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog"); + switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "expires", exp_delta_str); + switch_event_fire(&sevent); } + } - if (event) { - su_free(profile->home, event); - } + if (event) { + su_free(profile->home, event); + } - if (full_from) { - su_free(profile->home, full_from); - } - if (full_via) { - su_free(profile->home, full_via); - } - if (full_agent) { - su_free(profile->home, full_agent); - } + if (full_from) { + su_free(profile->home, full_from); + } + if (full_via) { + su_free(profile->home, full_via); + } + if (full_agent) { + su_free(profile->home, full_agent); + } - switch_safe_free(d_user); - switch_safe_free(to_str); - switch_safe_free(contact_str); + switch_safe_free(d_user); + switch_safe_free(to_str); + switch_safe_free(contact_str); - if (!sent_reply) { - nua_respond(nh, 481, "INVALID SUBSCRIPTION", TAG_END()); - } + if (!sent_reply) { + nua_respond(nh, 481, "INVALID SUBSCRIPTION", TAG_END()); } + } + sofia_gateway_subscription_t *sofia_find_gateway_subscription(sofia_gateway_t *gateway_ptr, const char *event) { sofia_gateway_subscription_t *gw_sub_ptr; @@ -2624,145 +2528,197 @@ void sofia_presence_handle_sip_r_subscribe(int status, } } +static int sofia_counterpath_crutch(void *pArg, int argc, char **argv, char **columnNames) +{ + nua_handle_t *nh; + sofia_profile_t *profile = (sofia_profile_t *) pArg; + char *call_id = argv[0]; + char *pl = argv[1]; + char *event_type = argv[2]; + long exp_delta = atol(argv[3]); + + if ((nh = nua_handle_by_call_id(profile->nua, call_id))) { + char sstr[128] = "", expstr[128] = ""; + switch_snprintf(expstr, sizeof(expstr), "%d", exp_delta); + switch_snprintf(sstr, sizeof(sstr), "active;expires=%u", exp_delta); + nua_notify(nh, + NUTAG_WITH_THIS(profile->nua), + SIPTAG_EXPIRES_STR(expstr), + SIPTAG_SUBSCRIPTION_STATE_STR(sstr), SIPTAG_EVENT_STR(event_type), + SIPTAG_CONTENT_TYPE_STR("application/pidf+xml"), SIPTAG_PAYLOAD_STR(pl), TAG_END()); + } + + return 0; +} + void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]) { - if (sip) { - sip_from_t const *from = sip->sip_from; - char *from_user = NULL; - char *from_host = NULL; - char *rpid = ""; - sip_payload_t *payload = sip->sip_payload; - char *event_type = NULL; - char etag[9] = ""; - char expstr[30] = ""; - long exp = 0, exp_delta = 3600; - char *pd_dup = NULL; - - /* the following could instead be refactored back to the calling event handler in sofia.c XXX MTK */ - if (sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)) { - /* also it probably is unsafe to dereference so many things in a row without testing XXX MTK */ - if (sip->sip_request->rq_url->url_user && !strncmp(sip->sip_request->rq_url->url_user, "sla-agent", sizeof("sla-agent"))) { - sofia_sla_handle_sip_i_publish(nua, profile, nh, sip, tags); - return; - } - } + + sip_from_t const *from; + char *from_user = NULL; + char *from_host = NULL; + char *rpid = ""; + sip_payload_t *payload; + char *event_type = NULL; + char etag[9] = ""; + char expstr[30] = ""; + long exp = 0, exp_delta = 3600; + char *pd_dup = NULL; + int count = 1; + char *contact_str; + int open = 1; - if (from) { - from_user = (char *) from->a_url->url_user; - from_host = (char *) from->a_url->url_host; + if (!sip) { + return; + } + + from = sip->sip_from; + payload = sip->sip_payload; + + /* the following could instead be refactored back to the calling event handler in sofia.c XXX MTK */ + if (sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)) { + /* also it probably is unsafe to dereference so many things in a row without testing XXX MTK */ + if (sip->sip_request->rq_url->url_user && !strncmp(sip->sip_request->rq_url->url_user, "sla-agent", sizeof("sla-agent"))) { + sofia_sla_handle_sip_i_publish(nua, profile, nh, sip, tags); + return; } + } + + contact_str = sofia_glue_gen_contact_str(profile, sip, NULL); + + if (from) { + from_user = (char *) from->a_url->url_user; + from_host = (char *) from->a_url->url_host; + } - - exp_delta = (sip->sip_expires ? sip->sip_expires->ex_delta : 3600); - if (profile->force_publish_expires) { - exp_delta = profile->force_publish_expires; - } + exp_delta = (sip->sip_expires ? sip->sip_expires->ex_delta : 3600); + if (profile->force_publish_expires) { + exp_delta = profile->force_publish_expires; + } - if (exp_delta < 0) { - exp = exp_delta; - } else { - exp = (long) switch_epoch_time_now(NULL) + exp_delta; - } + if (exp_delta < 0) { + exp = exp_delta; + } else { + exp = (long) switch_epoch_time_now(NULL) + exp_delta; + } - if (payload) { - switch_xml_t xml, note, person, tuple, status, basic, act; - switch_event_t *event; - char *sql; - char *full_agent = NULL; - int count = 1; + if (payload) { + switch_xml_t xml, note, person, tuple, status, basic, act; + switch_event_t *event; + char *sql; + char *full_agent = NULL; + + pd_dup = strdup(payload->pl_data); - pd_dup = strdup(payload->pl_data); + if ((xml = switch_xml_parse_str(pd_dup, strlen(pd_dup)))) { + char *open_closed = "", *note_txt = ""; - if ((xml = switch_xml_parse_str(pd_dup, strlen(pd_dup)))) { - char *open_closed = "", *note_txt = ""; + if (sip->sip_user_agent) { + full_agent = sip_header_as_string(profile->home, (void *) sip->sip_user_agent); + } - if (sip->sip_user_agent) { - full_agent = sip_header_as_string(profile->home, (void *) sip->sip_user_agent); - } + if ((tuple = switch_xml_child(xml, "tuple")) && (status = switch_xml_child(tuple, "status")) + && (basic = switch_xml_child(status, "basic"))) { + open_closed = basic->txt; + } - if ((tuple = switch_xml_child(xml, "tuple")) && (status = switch_xml_child(tuple, "status")) - && (basic = switch_xml_child(status, "basic"))) { - open_closed = basic->txt; - } + if ((person = switch_xml_child(xml, "dm:person")) && (note = switch_xml_child(person, "dm:note"))) { + note_txt = note->txt; + } - if ((person = switch_xml_child(xml, "dm:person")) && (note = switch_xml_child(person, "dm:note"))) { - note_txt = note->txt; + if (person && (act = switch_xml_child(person, "rpid:activities")) && act->child && act->child->name) { + if ((rpid = strchr(act->child->name, ':'))) { + rpid++; + } else { + rpid = act->child->name; } + } + + if (!(open = !strcasecmp(open_closed, "open"))) { + sql = switch_mprintf("update sip_subscriptions set version = -1 where contact='%q'", contact_str); + } else { + sql = switch_mprintf("update sip_subscriptions set version = 0 where contact='%q'", contact_str); + } + + sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); - if (person && (act = switch_xml_child(person, "rpid:activities")) && act->child && act->child->name) { - if ((rpid = strchr(act->child->name, ':'))) { - rpid++; - } else { - rpid = act->child->name; - } - } - if (sofia_test_pflag(profile, PFLAG_MULTIREG) && !strcasecmp(open_closed, "closed")) { - char buf[32] = ""; + if (sofia_test_pflag(profile, PFLAG_MULTIREG) && !open) { + char buf[32] = ""; - sql = switch_mprintf("select count(*) from sip_registrations where sip_user='%q' and orig_server_host='%q'", from_user, from_host); - sofia_glue_execute_sql2str(profile, profile->ireg_mutex, sql, buf, sizeof(buf)); - switch_safe_free(sql); - count = atoi(buf); - } + sql = switch_mprintf("select count(*) from sip_registrations where " + "sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%')", from_user, from_host, from_host); + + sofia_glue_execute_sql2str(profile, profile->ireg_mutex, sql, buf, sizeof(buf)); + switch_safe_free(sql); + count = atoi(buf); + } - /* if (count > 1) let's not and say we did or all the clients who subscribe to their own presence will think they selves is offline */ + /* if (count > 1) let's not and say we did or all the clients who subscribe to their own presence will think they selves is offline */ - if (count < 2) { - if ((sql = - switch_mprintf("delete from sip_presence where sip_user='%q' and sip_host='%q' " - " and profile_name='%q' and hostname='%q'", from_user, from_host, profile->name, mod_sofia_globals.hostname))) { - sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); - } + event_type = sip_header_as_string(profile->home, (void *) sip->sip_event); + + if (count < 2) { + if ((sql = + switch_mprintf("delete from sip_presence where sip_user='%q' and sip_host='%q' " + " and profile_name='%q' and hostname='%q'", from_user, from_host, profile->name, mod_sofia_globals.hostname))) { + sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); + } - if ((sql = - switch_mprintf("insert into sip_presence (sip_user, sip_host, status, rpid, expires, user_agent," - " profile_name, hostname, open_closed) " - "values ('%q','%q','%q','%q',%ld,'%q','%q','%q','%q')", - from_user, from_host, note_txt, rpid, exp, full_agent, profile->name, mod_sofia_globals.hostname, open_closed))) { + if ((sql = + switch_mprintf("insert into sip_presence (sip_user, sip_host, status, rpid, expires, user_agent," + " profile_name, hostname, open_closed) " + "values ('%q','%q','%q','%q',%ld,'%q','%q','%q','%q')", + from_user, from_host, note_txt, rpid, exp, full_agent, profile->name, mod_sofia_globals.hostname, open_closed))) { - sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); - } + sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); + } + } else if (contact_str) { + sql = switch_mprintf("select call_id,'%q','%q','%ld' from sip_subscriptions where sub_to_user='%q' and sub_to_host='%q' " + "and contact = '%q' ", payload->pl_data ? payload->pl_data : "", event_type, exp_delta, + from_user, from_host, contact_str); + sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_counterpath_crutch, profile); + switch_safe_free(sql); + } - event_type = sip_header_as_string(profile->home, (void *) sip->sip_event); - - if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", rpid); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->url); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "user-agent", full_agent); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", from_user, from_host); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", note_txt); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", event_type); - switch_event_fire(&event); - } - } - if (event_type) { - su_free(profile->home, event_type); - } + if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", rpid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->url); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "user-agent", full_agent); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", from_user, from_host); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", note_txt); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", event_type); + switch_event_fire(&event); + } - if (full_agent) { - su_free(profile->home, full_agent); - } + if (event_type) { + su_free(profile->home, event_type); + } - switch_xml_free(xml); + if (full_agent) { + su_free(profile->home, full_agent); } - } else { - char *sql = switch_mprintf("update sip_presence set expires=%ld where sip_user='%q' and sip_host='%q' and profile_name='%q' and hostname='%q'", - exp, from_user, from_host, profile->name, mod_sofia_globals.hostname); - sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); + + switch_xml_free(xml); } + } else { + char *sql = switch_mprintf("update sip_presence set expires=%ld where sip_user='%q' and sip_host='%q' and profile_name='%q' and hostname='%q'", + exp, from_user, from_host, profile->name, mod_sofia_globals.hostname); + sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); + } - switch_safe_free(pd_dup); + switch_safe_free(pd_dup); - switch_snprintf(expstr, sizeof(expstr), "%d", exp_delta); - switch_stun_random_string(etag, 8, NULL); - nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), SIPTAG_ETAG_STR(etag), SIPTAG_EXPIRES_STR(expstr), TAG_END()); - } + switch_snprintf(expstr, sizeof(expstr), "%d", exp_delta); + switch_stun_random_string(etag, 8, NULL); + nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), SIPTAG_ETAG_STR(etag), SIPTAG_EXPIRES_STR(expstr), TAG_END()); + + switch_safe_free(contact_str); } void sofia_presence_set_hash_key(char *hash_key, int32_t len, sip_t const *sip) commit 903d13648184bbc94030ce381ffbf9b7702e7dce Author: Moises Silva <moy@sangoma.com> Date: Thu Dec 30 10:23:56 2010 -0500 freetdm: remove busy-waiting and use ftdm interrupt to wait for state change completion diff --git a/libs/freetdm/src/ftdm_state.c b/libs/freetdm/src/ftdm_state.c index 12dc379..21bb3b4 100644 --- a/libs/freetdm/src/ftdm_state.c +++ b/libs/freetdm/src/ftdm_state.c @@ -101,8 +101,10 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_complete_state(const char *file, const c ftdm_channel_state2str(fchan->last_state), ftdm_channel_state2str(state), diff); - /* FIXME: broadcast condition to wake up anyone waiting on state completion if the channel - * is blocking (FTDM_CHANNEL_NONBLOCK is not set) */ + if (ftdm_test_flag(fchan, FTDM_CHANNEL_BLOCKING)) { + ftdm_clear_flag(fchan, FTDM_CHANNEL_BLOCKING); + ftdm_interrupt_signal(fchan->state_change_notify); + } return FTDM_SUCCESS; } @@ -169,6 +171,7 @@ static int ftdm_parse_state_map(ftdm_channel_t *ftdmchan, ftdm_channel_state_t s #define DEFAULT_WAIT_TIME 1000 FT_DECLARE(ftdm_status_t) ftdm_channel_set_state(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_channel_state_t state, int waitrq) { + ftdm_status_t status; int ok = 1; int waitms = DEFAULT_WAIT_TIME; @@ -191,6 +194,16 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_set_state(const char *file, const char *f return FTDM_FAIL; } + if (!ftdmchan->state_change_notify) { + status = ftdm_interrupt_create(&ftdmchan->state_change_notify, FTDM_INVALID_SOCKET); + if (status != FTDM_SUCCESS) { + ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_CRIT, + "Failed to create state change interrupt when moving from %s to %s\n", ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state)); + return status; + } + } + + if (ftdmchan->span->state_map) { ok = ftdm_parse_state_map(ftdmchan, state, ftdmchan->span->state_map); goto end; @@ -276,67 +289,54 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_set_state(const char *file, const char *f end: - if (ok) { - ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_DEBUG, "Changed state from %s to %s\n", ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state)); - ftdmchan->last_state = ftdmchan->state; - ftdmchan->state = state; - ftdmchan->state_status = FTDM_STATE_STATUS_NEW; - ftdmchan->history[ftdmchan->hindex].file = file; - ftdmchan->history[ftdmchan->hindex].func = func; - ftdmchan->history[ftdmchan->hindex].line = line; - ftdmchan->history[ftdmchan->hindex].state = ftdmchan->state; - ftdmchan->history[ftdmchan->hindex].last_state = ftdmchan->last_state; - ftdmchan->history[ftdmchan->hindex].time = ftdm_current_time_in_ms(); - ftdmchan->history[ftdmchan->hindex].end_time = 0; - ftdmchan->hindex++; - if (ftdmchan->hindex == ftdm_array_len(ftdmchan->history)) { - ftdmchan->hindex = 0; - } - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE); - - ftdm_mutex_lock(ftdmchan->span->mutex); - ftdm_set_flag(ftdmchan->span, FTDM_SPAN_STATE_CHANGE); - if (ftdmchan->span->pendingchans) { - ftdm_queue_enqueue(ftdmchan->span->pendingchans, ftdmchan); - } - ftdm_mutex_unlock(ftdmchan->span->mutex); - } else { + if (!ok) { ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_WARNING, "VETO state change from %s to %s\n", ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state)); goto done; } + ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_DEBUG, "Changed state from %s to %s\n", ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state)); + ftdmchan->last_state = ftdmchan->state; + ftdmchan->state = state; + ftdmchan->state_status = FTDM_STATE_STATUS_NEW; + ftdmchan->history[ftdmchan->hindex].file = file; + ftdmchan->history[ftdmchan->hindex].func = func; + ftdmchan->history[ftdmchan->hindex].line = line; + ftdmchan->history[ftdmchan->hindex].state = ftdmchan->state; + ftdmchan->history[ftdmchan->hindex].last_state = ftdmchan->last_state; + ftdmchan->history[ftdmchan->hindex].time = ftdm_current_time_in_ms(); + ftdmchan->history[ftdmchan->hindex].end_time = 0; + ftdmchan->hindex++; + if (ftdmchan->hindex == ftdm_array_len(ftdmchan->history)) { + ftdmchan->hindex = 0; + } + ftdm_set_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE); + + ftdm_mutex_lock(ftdmchan->span->mutex); + ftdm_set_flag(ftdmchan->span, FTDM_SPAN_STATE_CHANGE); + if (ftdmchan->span->pendingchans) { + ftdm_queue_enqueue(ftdmchan->span->pendingchans, ftdmchan); + } + ftdm_mutex_unlock(ftdmchan->span->mutex); + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_NONBLOCK)) { /* the channel should not block waiting for state processing */ goto done; } - /* there is an inherent race here between set and check of the change flag but we do not care because - * the flag should never last raised for more than a few ms for any state change */ - while (waitrq && waitms > 0) { - /* give a chance to the signaling stack to process it */ - ftdm_mutex_unlock(ftdmchan->mutex); + ftdm_set_flag(ftdmchan, FTDM_CHANNEL_BLOCKING); - ftdm_sleep(10); - waitms -= 10; + ftdm_mutex_unlock(ftdmchan->mutex); - ftdm_mutex_lock(ftdmchan->mutex); - - /* if the flag is no longer set, the state change was processed (or is being processed) */ - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { - break; - } + status = ftdm_interrupt_wait(ftdmchan->state_change_notify, waitms); - /* if the state is no longer what we set, the state change was - * obviously processed (and the current state change flag is for other state change) */ - if (ftdmchan->state != state) { - break; - } - } + ftdm_mutex_lock(ftdmchan->mutex); - if (waitms <= 0) { - ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_WARNING, "state change from %s to %s was most likely not processed after aprox %dms\n", + if (status != FTDM_SUCCESS) { + ftdm_log_chan_ex(ftdmchan, file, func, line, + FTDM_LOG_LEVEL_WARNING, "state change from %s to %s was most likely not processed after aprox %dms\n", ftdm_channel_state2str(ftdmchan->last_state), ftdm_channel_state2str(state), DEFAULT_WAIT_TIME); ok = 0; + goto done; } done: return ok ? FTDM_SUCCESS : FTDM_FAIL; diff --git a/libs/freetdm/src/ftdm_threadmutex.c b/libs/freetdm/src/ftdm_threadmutex.c index b1884ec..6efa277 100644 --- a/libs/freetdm/src/ftdm_threadmutex.c +++ b/libs/freetdm/src/ftdm_threadmutex.c @@ -56,7 +56,11 @@ struct ftdm_interrupt { /* for generic interruption */ HANDLE event; #else - /* for generic interruption */ + /* In theory we could be using thread conditions for generic interruption, + * however, Linux does not have a primitive like Windows WaitForMultipleObjects + * to wait for both thread condition and file descriptors, therefore we decided + * to use a dummy pipe for generic interruption/condition logic + * */ int readfd; int writefd; #endif @@ -243,6 +247,7 @@ FT_DECLARE(ftdm_status_t) _ftdm_mutex_unlock(ftdm_mutex_t *mutex) FT_DECLARE(ftdm_status_t) ftdm_interrupt_create(ftdm_interrupt_t **ininterrupt, ftdm_socket_t device) { + ftdm_status_t status = FTDM_SUCCESS; ftdm_interrupt_t *interrupt = NULL; #ifndef WIN32 int fds[2]; @@ -253,7 +258,7 @@ FT_DECLARE(ftdm_status_t) ftdm_interrupt_create(ftdm_interrupt_t **ininterrupt, interrupt = ftdm_calloc(1, sizeof(*interrupt)); if (!interrupt) { ftdm_log(FTDM_LOG_ERROR, "Failed to allocate interrupt memory\n"); - return FTDM_FAIL; + return FTDM_ENOMEM; } interrupt->device = device; @@ -261,11 +266,13 @@ FT_DECLARE(ftdm_status_t) ftdm_interrupt_create(ftdm_interrupt_t **ininterrupt, interrupt->event = CreateEvent(NULL, FALSE, FALSE, NULL); if (!interrupt->event) { ftdm_log(FTDM_LOG_ERROR, "Failed to allocate interrupt event\n"); + status = FTDM_ENOMEM; goto failed; } #else if (pipe(fds)) { ftdm_log(FTDM_LOG_ERROR, "Failed to allocate interrupt pipe: %s\n", strerror(errno)); + status = FTDM_FAIL; goto failed; } interrupt->readfd = fds[0]; @@ -287,7 +294,7 @@ failed: #endif ftdm_safe_free(interrupt); } - return FTDM_FAIL; + return status; } #define ONE_BILLION 1000000000 diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index 605ab8d..3b69144 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -462,6 +462,7 @@ struct ftdm_channel { ftdm_dtmf_debug_t dtmfdbg; ftdm_io_dump_t rxdump; ftdm_io_dump_t txdump; + ftdm_interrupt_t *state_change_notify; /*!< Notify when a state change is terminated */ int32_t txdrops; int32_t rxdrops; }; diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index c4d48a8..41711f7 100644 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -250,6 +250,8 @@ typedef enum { #define FTDM_CHANNEL_NONBLOCK (1ULL << 33) /*!< There is a pending acknowledge for an indication */ #define FTDM_CHANNEL_IND_ACK_PENDING (1ULL << 34) +/*!< There is someone blocking in the channel waiting for state completion */ +#define FTDM_CHANNEL_BLOCKING (1ULL << 35) #include "ftdm_state.h" commit c4e350ab0cfec3c7500cf196b712874f90d562b0 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Dec 29 15:09:57 2010 -0600 add insertFile front end to switch_ivr_insert_file and reswig diff --git a/src/include/switch_cpp.h b/src/include/switch_cpp.h index 0ede8e6..0bd2a8b 100644 --- a/src/include/switch_cpp.h +++ b/src/include/switch_cpp.h @@ -216,6 +216,7 @@ SWITCH_DECLARE(void) consoleCleanLog(char *msg); char *tts_name; char *voice_name; + SWITCH_DECLARE(int) insertFile(const char *file, const char *insert_file, int sample_point); SWITCH_DECLARE(int) answer(); SWITCH_DECLARE(int) preAnswer(); SWITCH_DECLARE(void) hangup(const char *cause = "normal_clearing"); diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java index e7bcb56..16421f1 100644 --- a/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java @@ -116,6 +116,10 @@ public class CoreSession { return freeswitchJNI.CoreSession_voice_name_get(swigCPtr, this); } + public int insertFile(String file, String insert_file, int sample_point) { + return freeswitchJNI.CoreSession_insertFile(swigCPtr, this, file, insert_file, sample_point); + } + public int answer() { return freeswitchJNI.CoreSession_answer(swigCPtr, this); } diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java index 206103c..f90a9cc 100644 --- a/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java @@ -101,6 +101,7 @@ class freeswitchJNI { public final static native String CoreSession_tts_name_get(long jarg1, CoreSession jarg1_); public final static native void CoreSession_voice_name_set(long jarg1, CoreSession jarg1_, String jarg2); public final static native String CoreSession_voice_name_get(long jarg1, CoreSession jarg1_); + public final static native int CoreSession_insertFile(long jarg1, CoreSession jarg1_, String jarg2, String jarg3, int jarg4); public final static native int CoreSession_answer(long jarg1, CoreSession jarg1_); public final static native int CoreSession_preAnswer(long jarg1, CoreSession jarg1_); public final static native void CoreSession_hangup(long jarg1, CoreSession jarg1_, String jarg2); diff --git a/src/mod/languages/mod_java/switch_swig_wrap.cpp b/src/mod/languages/mod_java/switch_swig_wrap.cpp index b275b17..720e757 100644 --- a/src/mod/languages/mod_java/switch_swig_wrap.cpp +++ b/src/mod/languages/mod_java/switch_swig_wrap.cpp @@ -1866,6 +1866,37 @@ SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1v } +SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1insertFile(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jint jarg4) { + jint jresult = 0 ; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + int arg4 ; + int result; + + (void)jenv; + (void)jcls; + (void)jarg1_; + arg1 = *(CoreSession **)&jarg1; + arg2 = 0; + if (jarg2) { + arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0); + if (!arg2) return 0; + } + arg3 = 0; + if (jarg3) { + arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0); + if (!arg3) return 0; + } + arg4 = (int)jarg4; + result = (int)(arg1)->insertFile((char const *)arg2,(char const *)arg3,arg4); + jresult = (jint)result; + if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2); + if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3); + return jresult; +} + + SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1answer(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_) { jint jresult = 0 ; CoreSession *arg1 = (CoreSession *) 0 ; diff --git a/src/mod/languages/mod_lua/mod_lua_wrap.cpp b/src/mod/languages/mod_lua/mod_lua_wrap.cpp index 5c189cd..d326466 100644 --- a/src/mod/languages/mod_lua/mod_lua_wrap.cpp +++ b/src/mod/languages/mod_lua/mod_lua_wrap.cpp @@ -4287,6 +4287,40 @@ fail: } +static int _wrap_CoreSession_insertFile(lua_State* L) { + int SWIG_arg = -1; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + int arg4 ; + int result; + + SWIG_check_num_args("insertFile",4,4) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("insertFile",1,"CoreSession *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("insertFile",2,"char const *"); + if(!lua_isstring(L,3)) SWIG_fail_arg("insertFile",3,"char const *"); + if(!lua_isnumber(L,4)) SWIG_fail_arg("insertFile",4,"int"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_insertFile",1,SWIGTYPE_p_CoreSession); + } + + arg2 = (char *)lua_tostring(L, 2); + arg3 = (char *)lua_tostring(L, 3); + arg4 = (int)lua_tonumber(L, 4); + result = (int)(arg1)->insertFile((char const *)arg2,(char const *)arg3,arg4); + SWIG_arg=0; + lua_pushnumber(L, (lua_Number) result); SWIG_arg++; + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + static int _wrap_CoreSession_answer(lua_State* L) { int SWIG_arg = -1; CoreSession *arg1 = (CoreSession *) 0 ; @@ -5864,6 +5898,7 @@ CoreSession *arg1 = (CoreSession *) obj; delete arg1; } static swig_lua_method swig_CoreSession_methods[] = { + {"insertFile", _wrap_CoreSession_insertFile}, {"answer", _wrap_CoreSession_answer}, {"preAnswer", _wrap_CoreSession_preAnswer}, {"hangup", _wrap_CoreSession_hangup}, diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index b7187d4..33ceb47 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -34037,6 +34037,24 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_voice_name_get(void * jarg1) { } +SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_insertFile(void * jarg1, char * jarg2, char * jarg3, int jarg4) { + int jresult ; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + int arg4 ; + int result; + + arg1 = (CoreSession *)jarg1; + arg2 = (char *)jarg2; + arg3 = (char *)jarg3; + arg4 = (int)jarg4; + result = (int)(arg1)->insertFile((char const *)arg2,(char const *)arg3,arg4); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_Answer(void * jarg1) { int jresult ; CoreSession *arg1 = (CoreSession *) 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index a79fde9..e51b050 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -220,6 +220,11 @@ public class CoreSession : IDisposable { } } + public int insertFile(string file, string insert_file, int sample_point) { + int ret = freeswitchPINVOKE.CoreSession_insertFile(swigCPtr, file, insert_file, sample_point); + return ret; + } + public int Answer() { int ret = freeswitchPINVOKE.CoreSession_Answer(swigCPtr); return ret; @@ -13658,6 +13663,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_voice_name_get")] public static extern string CoreSession_voice_name_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_insertFile")] + public static extern int CoreSession_insertFile(HandleRef jarg1, string jarg2, string jarg3, int jarg4); + [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_Answer")] public static extern int CoreSession_Answer(HandleRef jarg1); @@ -23203,6 +23211,7 @@ public enum switch_core_session_message_types_t { SWITCH_MESSAGE_INDICATE_UDPTL_MODE, SWITCH_MESSAGE_INDICATE_CLEAR_PROGRESS, SWITCH_MESSAGE_INDICATE_JITTER_BUFFER, + SWITCH_MESSAGE_INDICATE_RECOVERY_REFRESH, SWITCH_MESSAGE_INVALID } diff --git a/src/mod/languages/mod_perl/freeswitch.pm b/src/mod/languages/mod_perl/freeswitch.pm index 12419fd..cb31101 100644 --- a/src/mod/languages/mod_perl/freeswitch.pm +++ b/src/mod/languages/mod_perl/freeswitch.pm @@ -404,6 +404,7 @@ sub DESTROY { *swig_tts_name_set = *freeswitchc::CoreSession_tts_name_set; *swig_voice_name_get = *freeswitchc::CoreSession_voice_name_get; *swig_voice_name_set = *freeswitchc::CoreSession_voice_name_set; +*insertFile = *freeswitchc::CoreSession_insertFile; *answer = *freeswitchc::CoreSession_answer; *preAnswer = *freeswitchc::CoreSession_preAnswer; *hangup = *freeswitchc::CoreSession_hangup; diff --git a/src/mod/languages/mod_perl/mod_perl_wrap.cpp b/src/mod/languages/mod_perl/mod_perl_wrap.cpp index 370c88b..c229052 100644 --- a/src/mod/languages/mod_perl/mod_perl_wrap.cpp +++ b/src/mod/languages/mod_perl/mod_perl_wrap.cpp @@ -5282,6 +5282,66 @@ XS(_wrap_CoreSession_voice_name_get) { } +XS(_wrap_CoreSession_insertFile) { + { + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + int arg4 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int val4 ; + int ecode4 = 0 ; + int argvi = 0; + dXSARGS; + + if ((items < 4) || (items > 4)) { + SWIG_croak("Usage: CoreSession_insertFile(self,file,insert_file,sample_point);"); + } + res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_insertFile" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_insertFile" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_insertFile" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + ecode4 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(3), &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_insertFile" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + result = (int)(arg1)->insertFile((char const *)arg2,(char const *)arg3,arg4); + ST(argvi) = SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ; + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + + XSRETURN(argvi); + fail: + + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + + SWIG_croak_null(); + } +} + + XS(_wrap_CoreSession_answer) { { CoreSession *arg1 = (CoreSession *) 0 ; @@ -9361,6 +9421,7 @@ static swig_command_info swig_commands[] = { {"freeswitchc::CoreSession_tts_name_get", _wrap_CoreSession_tts_name_get}, {"freeswitchc::CoreSession_voice_name_set", _wrap_CoreSession_voice_name_set}, {"freeswitchc::CoreSession_voice_name_get", _wrap_CoreSession_voice_name_get}, +{"freeswitchc::CoreSession_insertFile", _wrap_CoreSession_insertFile}, {"freeswitchc::CoreSession_answer", _wrap_CoreSession_answer}, {"freeswitchc::CoreSession_preAnswer", _wrap_CoreSession_preAnswer}, {"freeswitchc::CoreSession_hangup", _wrap_CoreSession_hangup}, @@ -9732,17 +9793,17 @@ XS(SWIG_init) { SWIG_TypeClientData(SWIGTYPE_p_IVRMenu, (void*) "freeswitch::IVRMenu"); SWIG_TypeClientData(SWIGTYPE_p_API, (void*) "freeswitch::API"); SWIG_TypeClientData(SWIGTYPE_p_input_callback_state, (void*) "freeswitch::input_callback_state_t"); - /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_HUP", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_HUP))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; - /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_FREE", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_FREE))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; - /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_RDLOCK", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_RDLOCK))); SvREADONLY_on(sv); diff --git a/src/mod/languages/mod_python/freeswitch.py b/src/mod/languages/mod_python/freeswitch.py index e493757..03deb31 100644 --- a/src/mod/languages/mod_python/freeswitch.py +++ b/src/mod/languages/mod_python/freeswitch.py @@ -263,6 +263,7 @@ class CoreSession(_object): __swig_setmethods__["voice_name"] = _freeswitch.CoreSession_voice_name_set __swig_getmethods__["voice_name"] = _freeswitch.CoreSession_voice_name_get if _newclass:voice_name = _swig_property(_freeswitch.CoreSession_voice_name_get, _freeswitch.CoreSession_voice_name_set) + def insertFile(*args): return _freeswitch.CoreSession_insertFile(*args) def answer(*args): return _freeswitch.CoreSession_answer(*args) def preAnswer(*args): return _freeswitch.CoreSession_preAnswer(*args) def hangup(*args): return _freeswitch.CoreSession_hangup(*args) diff --git a/src/mod/languages/mod_python/mod_python_wrap.cpp b/src/mod/languages/mod_python/mod_python_wrap.cpp index 0907bec..3326a19 100644 --- a/src/mod/languages/mod_python/mod_python_wrap.cpp +++ b/src/mod/languages/mod_python/mod_python_wrap.cpp @@ -5892,6 +5892,61 @@ fail: } +SWIGINTERN PyObject *_wrap_CoreSession_insertFile(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + PyObject *resultobj = 0; + CoreSession *arg1 = (CoreSession *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + int arg4 ; + int result; + void *argp1 = 0 ; + int res1 = 0 ; + int res2 ; + char *buf2 = 0 ; + int alloc2 = 0 ; + int res3 ; + char *buf3 = 0 ; + int alloc3 = 0 ; + int val4 ; + int ecode4 = 0 ; + PyObject * obj0 = 0 ; + PyObject * obj1 = 0 ; + PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; + + if (!PyArg_ParseTuple(args,(char *)"OOOO:CoreSession_insertFile",&obj0,&obj1,&obj2,&obj3)) SWIG_fail; + res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); + if (!SWIG_IsOK(res1)) { + SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_insertFile" "', argument " "1"" of type '" "CoreSession *""'"); + } + arg1 = reinterpret_cast< CoreSession * >(argp1); + res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "CoreSession_insertFile" "', argument " "2"" of type '" "char const *""'"); + } + arg2 = reinterpret_cast< char * >(buf2); + res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3); + if (!SWIG_IsOK(res3)) { + SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "CoreSession_insertFile" "', argument " "3"" of type '" "char const *""'"); + } + arg3 = reinterpret_cast< char * >(buf3); + ecode4 = SWIG_AsVal_int(obj3, &val4); + if (!SWIG_IsOK(ecode4)) { + SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "CoreSession_insertFile" "', argument " "4"" of type '" "int""'"); + } + arg4 = static_cast< int >(val4); + result = (int)(arg1)->insertFile((char const *)arg2,(char const *)arg3,arg4); + resultobj = SWIG_From_int(static_cast< int >(result)); + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return resultobj; +fail: + if (alloc2 == SWIG_NEWOBJ) delete[] buf2; + if (alloc3 == SWIG_NEWOBJ) delete[] buf3; + return NULL; +} + + SWIGINTERN PyObject *_wrap_CoreSession_answer(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; CoreSession *arg1 = (CoreSession *) 0 ; @@ -8915,6 +8970,7 @@ static PyMethodDef SwigMethods[] = { { (char *)"CoreSession_tts_name_get", _wrap_CoreSession_tts_name_get, METH_VARARGS, NULL}, { (char *)"CoreSession_voice_name_set", _wrap_CoreSession_voice_name_set, METH_VARARGS, NULL}, { (char *)"CoreSession_voice_name_get", _wrap_CoreSession_voice_name_get, METH_VARARGS, NULL}, + { (char *)"CoreSession_insertFile", _wrap_CoreSession_insertFile, METH_VARARGS, NULL}, { (char *)"CoreSession_answer", _wrap_CoreSession_answer, METH_VARARGS, NULL}, { (char *)"CoreSession_preAnswer", _wrap_CoreSession_preAnswer, METH_VARARGS, NULL}, { (char *)"CoreSession_hangup", _wrap_CoreSession_hangup, METH_VARARGS, NULL}, diff --git a/src/switch_cpp.cpp b/src/switch_cpp.cpp index 1ba850d..88af242 100644 --- a/src/switch_cpp.cpp +++ b/src/switch_cpp.cpp @@ -576,6 +576,15 @@ SWITCH_DECLARE(int) CoreSession::answer() return status == SWITCH_STATUS_SUCCESS ? 1 : 0; } +SWITCH_DECLARE(int) CoreSession::insertFile(const char *file, const char *insert_file, int sample_point) +{ + switch_status_t status; + this_check(-1); + sanity_check(-1); + status = switch_ivr_insert_file(session, file, insert_file, (switch_size_t)sample_point); + return status == SWITCH_STATUS_SUCCESS ? 1 : 0; +} + SWITCH_DECLARE(int) CoreSession::preAnswer() { switch_status_t status; commit 0920645d1f1b7f647a9849b6bbdaffeb07c162b1 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Dec 29 15:04:19 2010 -0600 update diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 6dda4a7..ca1ddb1 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3498,6 +3498,10 @@ SWITCH_STANDARD_API(sofia_contact_function) if (zstr(domain)) { domain = profile->name; } + + if (!zstr(profile->domain_name) && !zstr(profile_name) && !strcmp(profile_name, profile->name)) { + domain = profile->domain_name; + } select_from_profile(profile, user, domain, concat, exclude_contact, &mystream); sofia_glue_release_profile(profile); @@ -3937,7 +3941,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session goto error; } - if (profile->domain_name && profile->domain_name != profile->name) { + if (profile->domain_name && strcmp(profile->domain_name, profile->name)) { profile_name = profile->domain_name; } commit 534d3bcb2990503d8a739fcbc3362457fcc55568 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Dec 29 14:44:05 2010 -0600 fix userauth for real diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index 5702d2c..9d575db 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -1452,7 +1452,7 @@ static switch_bool_t auth_api_command(listener_t *listener, const char *api_cmd, switch_bool_t ok = SWITCH_TRUE; top: - + if (!switch_core_hash_find(listener->allowed_api_hash, check_cmd)) { ok = SWITCH_FALSE; goto end; @@ -1556,12 +1556,16 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even user = cmd + 9; - if ((pass = strchr(user, ':'))) { + if ((domain_name = strchr(user, '@'))) { + *domain_name++ = '\0'; + } + + if ((pass = strchr(domain_name, ':'))) { *pass++ = '\0'; } - if ((domain_name = strchr(user, '@'))) { - *domain_name++ = '\0'; + if ((pass = strchr(user, ':'))) { + *pass++ = '\0'; } if (zstr(user) || zstr(domain_name)) { @@ -2044,21 +2048,31 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even char *arg = NULL; strip_cr(api_cmd); - if (!(acs.console_execute = switch_true(console_execute))) { - if ((arg = strchr(api_cmd, ' '))) { - *arg++ = '\0'; + if (listener->allowed_api_hash) { + char *api_copy = strdup(api_cmd); + char *arg_copy = NULL; + int ok = 0; + + if ((arg_copy = strchr(api_copy, ' '))) { + *arg_copy++ = '\0'; } - } + + ok = auth_api_command(listener, api_copy, arg_copy); + free(api_copy); - if (listener->allowed_api_hash) { - if (!auth_api_command(listener, api_cmd, arg)) { + if (!ok) { switch_snprintf(reply, reply_len, "-ERR permission denied"); status = SWITCH_STATUS_SUCCESS; goto done; } } - - + + if (!(acs.console_execute = switch_true(console_execute))) { + if ((arg = strchr(api_cmd, ' '))) { + *arg++ = '\0'; + } + } + acs.listener = listener; acs.api_cmd = api_cmd; acs.arg = arg; commit 39ff276c1c495e303e9dfcd70e2169950af3cc04 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Dec 29 14:13:06 2010 -0600 nm diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index 24530ed..5702d2c 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -1556,13 +1556,13 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even user = cmd + 9; - if ((domain_name = strchr(user, '@'))) { - *domain_name++ = '\0'; - } - if ((pass = strchr(user, ':'))) { *pass++ = '\0'; } + + if ((domain_name = strchr(user, '@'))) { + *domain_name++ = '\0'; + } if (zstr(user) || zstr(domain_name)) { switch_snprintf(reply, reply_len, "-ERR invalid"); commit 4f4294327d2941b0634cb4acaa7f35288a9b1f09 Author: Jeff Lenk <jeff@jefflenk.com> Date: Wed Dec 29 14:15:40 2010 -0600 vs2010 reswig diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx index 6ffeeed..f5e9e31 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx @@ -6298,6 +6298,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_remove_all(void * jarg1) } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_enumerate(void * jarg1, void * jarg2) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_stream_handle_t *arg2 = (switch_stream_handle_t *) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (switch_stream_handle_t *)jarg2; + result = (switch_status_t)switch_core_media_bug_enumerate(arg1,arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_read(void * jarg1, void * jarg2, int jarg3) { int jresult ; switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs index d0d09b6..b792fb0 100644 --- a/src/mod/languages/mod_managed/managed/swig.2010.cs +++ b/src/mod/languages/mod_managed/managed/swig.2010.cs @@ -1055,6 +1055,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_core_media_bug_enumerate(SWIGTYPE_p_switch_core_session session, switch_stream_handle stream) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_enumerate(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_stream_handle.getCPtr(stream)); + return ret; + } + public static switch_status_t switch_core_media_bug_read(SWIGTYPE_p_switch_media_bug bug, switch_frame frame, switch_bool_t fill) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_read(SWIGTYPE_p_switch_media_bug.getCPtr(bug), switch_frame.getCPtr(frame), (int)fill); return ret; @@ -7283,6 +7288,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_remove_all")] public static extern int switch_core_media_bug_remove_all(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_enumerate")] + public static extern int switch_core_media_bug_enumerate(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_read")] public static extern int switch_core_media_bug_read(HandleRef jarg1, HandleRef jarg2, int jarg3); @@ -21579,6 +21587,8 @@ public enum switch_channel_flag_t { CF_RECOVERED, CF_JITTERBUFFER, CF_DIALPLAN, + CF_BLOCK_BROADCAST_UNTIL_MEDIA, + CF_CNG_PLC, CF_FLAG_MAX } @@ -23269,6 +23279,7 @@ public enum switch_core_session_message_types_t { SWITCH_MESSAGE_INDICATE_UDPTL_MODE, SWITCH_MESSAGE_INDICATE_CLEAR_PROGRESS, SWITCH_MESSAGE_INDICATE_JITTER_BUFFER, + SWITCH_MESSAGE_INDICATE_RECOVERY_REFRESH, SWITCH_MESSAGE_INVALID } commit 08955a2b29f50aea6fd2391d6064ad76208743f2 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Dec 29 13:59:12 2010 -0600 fix userauth diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index 596a953..24530ed 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -1556,14 +1556,14 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even user = cmd + 9; - if ((pass = strchr(user, ':'))) { - *pass++ = '\0'; - } - if ((domain_name = strchr(user, '@'))) { *domain_name++ = '\0'; } + if ((pass = strchr(user, ':'))) { + *pass++ = '\0'; + } + if (zstr(user) || zstr(domain_name)) { switch_snprintf(reply, reply_len, "-ERR invalid"); switch_clear_flag_locked(listener, LFLAG_RUNNING); commit 650393fb90f79cfbbe9bc4b89f0d0dbdd9e9c3da Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Dec 29 13:15:14 2010 -0600 add recovery_refresh app and api and use it in mod_conference to send a message to the channel telling it to sync its recovery snapshot diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 830ea40..bb5f598 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -791,6 +791,7 @@ typedef enum { SWITCH_MESSAGE_INDICATE_UDPTL_MODE, SWITCH_MESSAGE_INDICATE_CLEAR_PROGRESS, SWITCH_MESSAGE_INDICATE_JITTER_BUFFER, + SWITCH_MESSAGE_INDICATE_RECOVERY_REFRESH, SWITCH_MESSAGE_INVALID } switch_core_session_message_types_t; diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 1c2e3eb..8daaace 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -2226,6 +2226,40 @@ SWITCH_STANDARD_API(uuid_deflect) return SWITCH_STATUS_SUCCESS; } +#define UUID_RECOVERY_REFRESH_SYNTAX "<uuid> <uri>" +SWITCH_STANDARD_API(uuid_recovery_refresh) +{ + switch_core_session_t *tsession = NULL; + char *uuid = NULL, *text = NULL; + + if (!zstr(cmd) && (uuid = strdup(cmd))) { + if ((text = strchr(uuid, ' '))) { + *text++ = '\0'; + } + } + + if (zstr(uuid) || zstr(text)) { + stream->write_function(stream, "-USAGE: %s\n", UUID_RECOVERY_REFRESH_SYNTAX); + } else { + if ((tsession = switch_core_session_locate(uuid))) { + switch_core_session_message_t msg = { 0 }; + + /* Tell the channel to recovery_refresh the call */ + msg.from = __FILE__; + msg.string_arg = text; + msg.message_id = SWITCH_MESSAGE_INDICATE_RECOVERY_REFRESH; + switch_core_session_receive_message(tsession, &msg); + stream->write_function(stream, "+OK:%s\n", msg.string_reply); + switch_core_session_rwunlock(tsession); + } else { + stream->write_function(stream, "-ERR No Such Channel %s!\n", uuid); + } + } + + switch_safe_free(uuid); + return SWITCH_STATUS_SUCCESS; +} + #define SCHED_TRANSFER_SYNTAX "[+]<time> <uuid> <extension> [<dialplan>] [<context>]" SWITCH_STANDARD_API(sched_transfer_function) { @@ -4858,6 +4892,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) SWITCH_ADD_API(commands_api_interface, "uuid_phone_event", "Send and event to the phone", uuid_phone_event_function, PHONE_EVENT_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_preprocess", "Pre-process Channel", preprocess_function, PREPROCESS_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_record", "session record", session_record_function, SESS_REC_SYNTAX); + SWITCH_ADD_API(commands_api_interface, "uuid_recovery_refresh", "Send a recovery_refresh", uuid_recovery_refresh, UUID_RECOVERY_REFRESH_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_recv_dtmf", "receive dtmf digits", uuid_recv_dtmf_function, UUID_RECV_DTMF_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_send_dtmf", "send dtmf digits", uuid_send_dtmf_function, UUID_SEND_DTMF_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_session_heartbeat", "uuid_session_heartbeat", uuid_session_heartbeat_function, HEARTBEAT_SYNTAX); @@ -4983,6 +5018,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) switch_console_set_complete("add uuid_phone_event ::console::list_uuid hold"); switch_console_set_complete("add uuid_preprocess ::console::list_uuid"); switch_console_set_complete("add uuid_record ::console::list_uuid ::[start:stop"); + switch_console_set_complete("add uuid_recovery_refresh ::console::list_uuid"); switch_console_set_complete("add uuid_recv_dtmf ::console::list_uuid"); switch_console_set_complete("add uuid_send_dtmf ::console::list_uuid"); switch_console_set_complete("add uuid_session_heartbeat ::console::list_uuid"); diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index bdf5659..ead0bea 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -4284,6 +4284,7 @@ static switch_status_t conf_api_sub_transfer(conference_obj_t *conference, switc switch_event_t *params = NULL; conference_obj_t *new_conference = NULL; int locked = 0; + switch_core_session_message_t msg = { 0 }; switch_assert(conference != NULL); switch_assert(stream != NULL); @@ -4409,6 +4410,11 @@ static switch_status_t conf_api_sub_transfer(conference_obj_t *conference, switc switch_channel_set_variable(channel, "last_transfered_conference", argv[2]); + /* Sync the recovery data */ + msg.from = __FILE__; + msg.message_id = SWITCH_MESSAGE_INDICATE_RECOVERY_REFRESH; + switch_core_session_receive_message(member->session, &msg); + unlock_member(member); stream->write_function(stream, "OK Member '%d' sent to conference %s.\n", member->id, argv[2]); diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index d5d0cb7..6fbf70b 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -1001,6 +1001,17 @@ SWITCH_STANDARD_APP(deflect_function) switch_core_session_receive_message(session, &msg); } +SWITCH_STANDARD_APP(recovery_refresh_function) +{ + switch_core_session_message_t msg = { 0 }; + + /* Tell the channel to recovery_refresh the call */ + msg.from = __FILE__; + msg.string_arg = data; + msg.message_id = SWITCH_MESSAGE_INDICATE_RECOVERY_REFRESH; + switch_core_session_receive_message(session, &msg); +} + SWITCH_STANDARD_APP(sched_cancel_function) { @@ -3547,6 +3558,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) SWITCH_ADD_APP(app_interface, "respond", "Send session respond", "Send a respond message to a session.", respond_function, "<respond_data>", SAF_SUPPORT_NOMEDIA); SWITCH_ADD_APP(app_interface, "deflect", "Send call deflect", "Send a call deflect.", deflect_function, "<deflect_data>", SAF_SUPPORT_NOMEDIA); + SWITCH_ADD_APP(app_interface, "recovery_refresh", "Send call recovery_refresh", "Send a call recovery_refresh.", recovery_refresh_function, "", SAF_SUPPORT_NOMEDIA); SWITCH_ADD_APP(app_interface, "queue_dtmf", "Queue dtmf to be sent", "Queue dtmf to be sent from a session", queue_dtmf_function, "<dtmf_data>", SAF_SUPPORT_NOMEDIA); SWITCH_ADD_APP(app_interface, "send_dtmf", "Send dtmf to be sent", "Send dtmf to be sent from a session", send_dtmf_function, "<dtmf_data>", diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index af7149b..6dda4a7 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1319,6 +1319,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi /* ones that do not need to lock sofia mutex */ switch (msg->message_id) { + case SWITCH_MESSAGE_INDICATE_RECOVERY_REFRESH: case SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC: { sofia_glue_tech_track(tech_pvt->profile, session); @@ -1335,6 +1336,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi } } break; + case SWITCH_MESSAGE_INDICATE_JITTER_BUFFER: { if (switch_rtp_ready(tech_pvt->rtp_session)) { commit 55da2afa7f1395c3ec20a6ac5836955264bb0162 Merge: 6fb1e5d c854fe5 Author: Moises Silva <moy@sangoma.com> Date: Wed Dec 29 14:08:57 2010 -0500 Merge branch 'moy.nonblocking-api' of git.sangoma.com:smg_freeswitch into moy.nonblocking-api commit 6fb1e5d9c1221d4943b52a284668c7435596268f Author: Moises Silva <moy@sangoma.com> Date: Wed Dec 29 14:08:18 2010 -0500 freetdm: free the iterator when setting channels to non-block diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 0c25054..5c900b9 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -1902,6 +1902,7 @@ FT_DECLARE(ftdm_status_t) ftdm_span_set_blocking_mode(const ftdm_span_t *span, f ftdm_set_flag_locked(fchan, FTDM_CHANNEL_NONBLOCK); } } + ftdm_iterator_free(citer); return FTDM_SUCCESS; } commit c854fe518adb53683cb0336a9f1f722b9208e42c Author: Moises Silva <moy@sangoma.com> Date: Wed Dec 29 14:04:31 2010 -0500 freetdm: update 2008 freetdm vcproj to include ftdm_state header and C file diff --git a/libs/freetdm/msvc/freetdm.2008.vcproj b/libs/freetdm/msvc/freetdm.2008.vcproj index c72891e..0539ff3 100644 --- a/libs/freetdm/msvc/freetdm.2008.vcproj +++ b/libs/freetdm/msvc/freetdm.2008.vcproj @@ -95,12 +95,11 @@ /> </Configuration> <Configuration - Name="Release|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" + Name="Debug|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" ConfigurationType="2" CharacterSet="2" - WholeProgramOptimization="1" BuildLogFile="$(IntDir)\BuildLog-freetdm.htm" > <Tool @@ -117,12 +116,16 @@ /> <Tool Name="VCMIDLTool" + TargetEnvironment="3" /> <Tool Name="VCCLCompilerTool" + Optimization="0" AdditionalIncludeDirectories="../src/include;../src/include/private;../src/isdn/include" - PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FREETDM_EXPORTS;TELETONE_EXPORTS" - RuntimeLibrary="2" + PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FREETDM_EXPORTS;TELETONE_EXPORTS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" DisableLanguageExtensions="false" RuntimeTypeInfo="false" UsePrecompiledHeader="0" @@ -143,6 +146,8 @@ /> <Tool Name="VCLinkerTool" + GenerateDebugInformation="true" + TargetMachine="17" /> <Tool Name="VCALinkTool" @@ -167,11 +172,12 @@ /> </Configuration> <Configuration - Name="Debug|x64" - OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" ConfigurationType="2" CharacterSet="2" + WholeProgramOptimization="1" BuildLogFile="$(IntDir)\BuildLog-freetdm.htm" > <Tool @@ -188,16 +194,12 @@ /> <Tool Name="VCMIDLTool" - TargetEnvironment="3" /> <Tool Name="VCCLCompilerTool" - Optimization="0" AdditionalIncludeDirectories="../src/include;../src/include/private;../src/isdn/include" - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FREETDM_EXPORTS;TELETONE_EXPORTS" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="3" + PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FREETDM_EXPORTS;TELETONE_EXPORTS" + RuntimeLibrary="2" DisableLanguageExtensions="false" RuntimeTypeInfo="false" UsePrecompiledHeader="0" @@ -218,8 +220,6 @@ /> <Tool Name="VCLinkerTool" - GenerateDebugInformation="true" - TargetMachine="17" /> <Tool Name="VCALinkTool" @@ -367,6 +367,10 @@ > </File> <File + RelativePath="..\src\include\private\ftdm_state.h" + > + </File> + <File RelativePath="..\src\include\ftdm_threadmutex.h" > </File> @@ -453,6 +457,10 @@ > </File> <File + RelativePath="..\src\ftdm_state.c" + > + </File> + <File RelativePath="..\src\ftdm_threadmutex.c" > </File> commit 090864fa3997cf697f046200e1ea813464ec79d8 Author: Moises Silva <moy@sangoma.com> Date: Wed Dec 29 13:38:43 2010 -0500 freetdm: completed most of the code for the new core state processing use new core state processing functions in ftmod_r2 diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index d9c26db..e08d4c1 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -421,16 +421,18 @@ static switch_status_t channel_on_routing(switch_core_session_t *session) private_t *tech_pvt = NULL; channel = switch_core_session_get_channel(session); - assert(channel != NULL); + switch_assert(channel != NULL); tech_pvt = switch_core_session_get_private(session); - assert(tech_pvt != NULL); + switch_assert(tech_pvt != NULL); - assert(tech_pvt->ftdmchan != NULL); + switch_assert(tech_pvt->ftdmchan != NULL); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL ROUTING\n", switch_channel_get_name(channel)); - ftdm_channel_call_indicate(tech_pvt->ftdmchan, FTDM_CHANNEL_INDICATE_PROCEED); + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) { + ftdm_channel_call_indicate(tech_pvt->ftdmchan, FTDM_CHANNEL_INDICATE_PROCEED); + } return SWITCH_STATUS_SUCCESS; } @@ -441,10 +443,10 @@ static switch_status_t channel_on_execute(switch_core_session_t *session) private_t *tech_pvt = NULL; channel = switch_core_session_get_channel(session); - assert(channel != NULL); + switch_assert(channel != NULL); tech_pvt = switch_core_session_get_private(session); - assert(tech_pvt != NULL); + switch_assert(tech_pvt != NULL); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL EXECUTE\n", switch_channel_get_name(channel)); @@ -2094,6 +2096,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_r2_signal) break; case FTDM_SIGEVENT_PROCEED:{} break; + case FTDM_SIGEVENT_INDICATION_COMPLETED:{} break; default: { diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 161ccdc..0c25054 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -1022,6 +1022,8 @@ FT_DECLARE(ftdm_status_t) ftdm_span_add_channel(ftdm_span_t *span, ftdm_socket_t } ftdm_set_flag(new_chan, FTDM_CHANNEL_CONFIGURED | FTDM_CHANNEL_READY); + new_chan->state = FTDM_CHANNEL_STATE_DOWN; + new_chan->state_status = FTDM_STATE_STATUS_COMPLETED; *chan = new_chan; return FTDM_SUCCESS; } @@ -2012,10 +2014,14 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_unhold(const char *file, const char return status; } -FT_DECLARE(void) ftdm_ack_indication(const ftdm_channel_t *fchan, ftdm_channel_indication_t indication, ftdm_status_t status) +FT_DECLARE(void) ftdm_ack_indication(ftdm_channel_t *fchan, ftdm_channel_indication_t indication, ftdm_status_t status) { ftdm_sigmsg_t msg; + ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Acknowledging indication %s in state %s (rc = %d)\n", + ftdm_channel_indication2str(indication), ftdm_channel_state2str(fchan->state), status); + ftdm_clear_flag(fchan, FTDM_CHANNEL_IND_ACK_PENDING); memset(&msg, 0, sizeof(msg)); + msg.channel = fchan; msg.event_id = FTDM_SIGEVENT_INDICATION_COMPLETED; msg.ev_data.indication_completed.indication = indication; msg.ev_data.indication_completed.status = status; @@ -2197,21 +2203,39 @@ FT_DECLARE(uint32_t) ftdm_channel_get_ph_span_id(const ftdm_channel_t *ftdmchan) /* * Every user requested indication *MUST* be acknowledged with the proper status (ftdm_status_t) - * If the indication fails before we notify the signaling stack, we *MUST* acknowledge ourselves, + * However, if the indication fails before we notify the signaling stack, we don't need to ack * but if we already notified the signaling stack about the indication, the signaling stack is - * responsible for the acknowledge. + * responsible for the acknowledge. Bottom line is, whenever this function returns FTDM_SUCCESS + * someone *MUST* acknowledge the indication, either the signaling stack, this function or the core + * at some later point * */ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_indicate(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_channel_indication_t indication) { ftdm_status_t status = FTDM_SUCCESS; + ftdm_assert_return(ftdmchan, FTDM_FAIL, "Null channel\n"); + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Indicating %s in state %s\n", + ftdm_channel_indication2str(indication), ftdm_channel_state2str(ftdmchan->state)); + ftdm_channel_lock(ftdmchan); + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_IND_ACK_PENDING)) { + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Cannot indicate %s in channel with indication %s still pending in state %s\n", + ftdm_channel_indication2str(indication), + ftdm_channel_indication2str(ftdmchan->indication), + ftdm_channel_state2str(ftdmchan->state)); + status = FTDM_EBUSY; + goto done; + } + + ftdmchan->indication = indication; + ftdm_set_flag(ftdmchan, FTDM_CHANNEL_IND_ACK_PENDING); + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Cannot indicate %s in outgoing channel in state %s\n", ftdm_channel_indication2str(indication), ftdm_channel_state2str(ftdmchan->state)); status = FTDM_EINVAL; - ftdm_ack_indication(ftdmchan, indication, status); goto done; } @@ -2219,7 +2243,6 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_indicate(const char *file, const ch ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Ignoring indication %s because the call is in %s state\n", ftdm_channel_indication2str(indication), ftdm_channel_state2str(ftdmchan->state)); status = FTDM_ECANCELED; - ftdm_ack_indication(ftdmchan, indication, status); goto done; } @@ -2228,15 +2251,9 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_indicate(const char *file, const ch * (particularly isdn stacks I think, we should emulate or just move to hangup with busy cause) */ case FTDM_CHANNEL_INDICATE_RINGING: status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_RINGING, 1); - if (status != FTDM_SUCCESS) { - ftdm_ack_indication(ftdmchan, indication, status); - } break; case FTDM_CHANNEL_INDICATE_BUSY: status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_BUSY, 1); - if (status != FTDM_SUCCESS) { - ftdm_ack_indication(ftdmchan, indication, status); - } break; case FTDM_CHANNEL_INDICATE_PROCEED: if (!ftdm_test_flag(ftdmchan->span, FTDM_SPAN_USE_PROCEED_STATE)) { @@ -2244,47 +2261,34 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_indicate(const char *file, const ch goto done; } status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROCEED, 1); - if (status != FTDM_SUCCESS) { - ftdm_ack_indication(ftdmchan, indication, status); - } break; case FTDM_CHANNEL_INDICATE_PROGRESS: status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS, 1); - if (status != FTDM_SUCCESS) { - ftdm_ack_indication(ftdmchan, indication, status); - } break; case FTDM_CHANNEL_INDICATE_PROGRESS_MEDIA: if (!ftdm_test_flag(ftdmchan->span, FTDM_SPAN_USE_SKIP_STATES)) { if (ftdmchan->state < FTDM_CHANNEL_STATE_PROGRESS) { status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS, 1); if (status != FTDM_SUCCESS) { - ftdm_ack_indication(ftdmchan, indication, status); goto done; } } /* set state unlocks the channel so we need to re-confirm that the channel hasn't gone to hell */ if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call has moved to TERMINATING while we're moving to PROGRESS\n"); - status = FTDM_ECANCELED; - ftdm_ack_indication(ftdmchan, indication, status); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring progress media because the call is terminating\n"); goto done; } } - ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, 1); - if (status != FTDM_SUCCESS) { - ftdm_ack_indication(ftdmchan, indication, status); - } + status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, 1); break; case FTDM_CHANNEL_INDICATE_ANSWER: - /* _ftdm_channel_call_indicate takes care of the indication ack */ + /* _ftdm_channel_call_answer takes care of the indication ack */ status = _ftdm_channel_call_answer(file, func, line, ftdmchan); break; default: ftdm_log(file, func, line, FTDM_LOG_LEVEL_WARNING, "Do not know how to indicate %d\n", indication); - status = FTDM_FAIL; - ftdm_ack_indication(ftdmchan, indication, status); + status = FTDM_EINVAL; break; } @@ -2463,6 +2467,7 @@ static ftdm_status_t ftdm_channel_done(ftdm_channel_t *ftdmchan) ftdmchan->init_state = FTDM_CHANNEL_STATE_DOWN; ftdmchan->state = FTDM_CHANNEL_STATE_DOWN; + ftdmchan->state_status = FTDM_STATE_STATUS_COMPLETED; ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_DEBUG_DTMF, NULL); ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_INPUT_DUMP, NULL); @@ -5023,7 +5028,7 @@ FT_DECLARE(ftdm_status_t) ftdm_configure_span_signaling(ftdm_span_t *span, const ftdm_assert_return(parameters != NULL, FTDM_FAIL, "No parameters"); if (!span->chan_count) { - ftdm_log(FTDM_LOG_WARNING, "Cannot configure signaling on span with no channels\n"); + ftdm_log(FTDM_LOG_WARNING, "Cannot configure signaling on span %s with no channels\n", span->name); return FTDM_FAIL; } diff --git a/libs/freetdm/src/ftdm_state.c b/libs/freetdm/src/ftdm_state.c index 2b54475..12dc379 100644 --- a/libs/freetdm/src/ftdm_state.c +++ b/libs/freetdm/src/ftdm_state.c @@ -37,6 +37,9 @@ FTDM_ENUM_NAMES(CHANNEL_STATE_NAMES, CHANNEL_STATE_STRINGS) FTDM_STR2ENUM(ftdm_str2ftdm_channel_state, ftdm_channel_state2str, ftdm_channel_state_t, CHANNEL_STATE_NAMES, FTDM_CHANNEL_STATE_INVALID) +FTDM_ENUM_NAMES(CHANNEL_STATE_STATUS_NAMES, CHANNEL_STATE_STATUS_STRINGS) +FTDM_STR2ENUM(ftdm_str2ftdm_state_status, ftdm_state_status2str, ftdm_state_status_t, CHANNEL_STATE_STATUS_NAMES, FTDM_STATE_STATUS_INVALID) + /* This function is only needed for boost and we should get rid of it at the next refactoring */ FT_DECLARE(ftdm_status_t) ftdm_channel_init(ftdm_channel_t *fchan) { @@ -54,12 +57,17 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_init(ftdm_channel_t *fchan) FT_DECLARE(ftdm_status_t) _ftdm_channel_complete_state(const char *file, const char *func, int line, ftdm_channel_t *fchan) { uint8_t hindex = 0; + ftdm_time_t diff = 0; ftdm_channel_state_t state = fchan->state; if (fchan->state_status == FTDM_STATE_STATUS_COMPLETED) { + ftdm_assert_return(!ftdm_test_flag(fchan, FTDM_CHANNEL_STATE_CHANGE), FTDM_FAIL, + "State change flag set but state is not completed\n"); return FTDM_SUCCESS; } + ftdm_clear_flag(fchan, FTDM_CHANNEL_STATE_CHANGE); + if (state == FTDM_CHANNEL_STATE_PROGRESS) { ftdm_set_flag(fchan, FTDM_CHANNEL_PROGRESS); } else if (state == FTDM_CHANNEL_STATE_UP) { @@ -71,19 +79,28 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_complete_state(const char *file, const c ftdm_set_flag(fchan, FTDM_CHANNEL_MEDIA); } - /* if there is a pending ack for an indication */ + /* if there is a pending ack for an indication + * MAINTENANCE WARNING: we're assuming an indication performed + * via state change will involve a single state change + */ if (ftdm_test_flag(fchan, FTDM_CHANNEL_IND_ACK_PENDING)) { ftdm_ack_indication(fchan, fchan->indication, FTDM_SUCCESS); - ftdm_clear_flag(fchan, FTDM_CHANNEL_IND_ACK_PENDING); } - ftdm_log_chan_ex(fchan, file, func, line, FTDM_LOG_LEVEL_DEBUG, "Completed state change from %s to %s\n", ftdm_channel_state2str(fchan->state), ftdm_channel_state2str(state)); - hindex = (fchan->hindex == 0) ? (ftdm_array_len(fchan->history) - 1) : (hindex - 1); + hindex = (fchan->hindex == 0) ? (ftdm_array_len(fchan->history) - 1) : (fchan->hindex - 1); ftdm_assert(!fchan->history[hindex].end_time, "End time should be zero!\n"); fchan->history[hindex].end_time = ftdm_current_time_in_ms(); + fchan->state_status = FTDM_STATE_STATUS_COMPLETED; + + diff = fchan->history[hindex].end_time - fchan->history[hindex].time; + + ftdm_log_chan_ex(fchan, file, func, line, FTDM_LOG_LEVEL_DEBUG, "Completed state change from %s to %s in %llums\n", + ftdm_channel_state2str(fchan->last_state), ftdm_channel_state2str(state), diff); + + /* FIXME: broadcast condition to wake up anyone waiting on state completion if the channel * is blocking (FTDM_CHANNEL_NONBLOCK is not set) */ @@ -93,9 +110,9 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_complete_state(const char *file, const c FT_DECLARE(ftdm_status_t) _ftdm_set_state(const char *file, const char *func, int line, ftdm_channel_t *fchan, ftdm_channel_state_t state) { - if (fchan->state_status == FTDM_STATE_STATUS_NEW) { - /* the current state is new, setting a new state from a signaling module - when the current state is new is equivalent to implicitly acknowledging + if (fchan->state_status != FTDM_STATE_STATUS_COMPLETED) { + /* the current state is not completed, setting a new state from a signaling module + when the current state is not completed is equivalent to implicitly acknowledging the current state */ _ftdm_channel_complete_state(file, func, line, fchan); } @@ -161,9 +178,11 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_set_state(const char *file, const char *f return FTDM_FAIL; } - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { - ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_ERROR, "Ignored state change request from %s to %s, the previous state change has not been processed yet\n", - ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state)); + if (ftdmchan->state_status != FTDM_STATE_STATUS_COMPLETED) { + ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_ERROR, + "Ignored state change request from %s to %s, the previous state change has not been processed yet (status = %s)\n", + ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state), + ftdm_state_status2str(ftdmchan->state_status)); return FTDM_FAIL; } @@ -422,9 +441,10 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_advance_states(ftdm_channel_t *fchan, ftd ftdm_channel_lock(fchan); while (fchan->state_status == FTDM_STATE_STATUS_NEW) { state = fchan->state; + ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Executing state processor for %s\n", ftdm_channel_state2str(fchan->state)); state_processor(fchan); - if (state == fchan->state) { - /* if the state did not change, the state status must go to PROCESSED + if (state == fchan->state && fchan->state_status == FTDM_STATE_STATUS_NEW) { + /* if the state did not change and is still NEW, the state status must go to PROCESSED * otherwise we don't touch it since is a new state and the old state was * already completed implicitly by the state_processor() function via some internal * call to ftdm_set_state() */ diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 3809b22..530bb2b 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -73,7 +73,6 @@ typedef struct ftdm_r2_call_t { int disconnect_rcvd:1; int ftdm_call_started:1; int protocol_error:1; - ftdm_channel_state_t chanstate; ftdm_size_t dnis_index; ftdm_size_t ani_index; char logname[255]; @@ -168,8 +167,7 @@ static ftdm_hash_t *g_mod_data_hash; /* IO interface for the command API */ static ftdm_io_interface_t g_ftdm_r2_interface; -static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan); -static void ftdm_r2_state_advance_all(ftdm_channel_t *ftdmchan); +static ftdm_status_t ftdm_r2_state_advance(ftdm_channel_t *ftdmchan); /* whether R2 call accept process is pending */ #define IS_ACCEPTING_PENDING(ftdmchan) \ @@ -349,7 +347,6 @@ static void ft_r2_clean_call(ftdm_r2_call_t *call) call->disconnect_rcvd = 0; call->ftdm_call_started = 0; call->protocol_error = 0; - call->chanstate = FTDM_CHANNEL_STATE_DOWN; call->dnis_index = 0; call->ani_index = 0; call->name[0] = 0; @@ -479,7 +476,6 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(r2_outgoing_call) } R2CALL(ftdmchan)->ftdm_call_started = 1; - R2CALL(ftdmchan)->chanstate = FTDM_CHANNEL_STATE_DOWN; ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DIALING); ftdm_channel_set_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS); @@ -624,7 +620,7 @@ static void ftdm_r2_on_call_init(openr2_chan_t *r2chan) ftdm_sched_cancel_timer(r2data->sched, r2call->protocol_error_recovery_timer); ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Cancelled protocol error recovery timer\n"); ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - ftdm_r2_state_advance_all(ftdmchan); + ftdm_channel_advance_states(ftdmchan, ftdm_r2_state_advance); } } @@ -658,7 +654,6 @@ static void ftdm_r2_on_call_init(openr2_chan_t *r2chan) ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_OUTPUT_DUMP, &r2data->mf_dump_size); } - R2CALL(ftdmchan)->chanstate = FTDM_CHANNEL_STATE_DOWN; ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); ftdm_channel_set_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS); ftdm_channel_command(ftdmchan, FTDM_COMMAND_FLUSH_TX_BUFFERS, NULL); @@ -708,12 +703,10 @@ static void ftdm_r2_on_call_offered(openr2_chan_t *r2chan, const char *ani, cons static void clear_accept_pending(ftdm_channel_t *fchan) { if (IS_ACCEPTING_PENDING(fchan)) { - ftdm_clear_flag(fchan, FTDM_CHANNEL_STATE_CHANGE); ftdm_channel_complete_state(fchan); } else if (ftdm_test_flag(fchan, FTDM_CHANNEL_STATE_CHANGE)) { ftdm_log_chan(fchan, FTDM_LOG_CRIT, "State change flag set in state %s, last state = %s\n", ftdm_channel_state2str(fchan->state), ftdm_channel_state2str(fchan->last_state)); - ftdm_clear_flag(fchan, FTDM_CHANNEL_STATE_CHANGE); ftdm_channel_complete_state(fchan); } } @@ -821,7 +814,7 @@ static void ftdm_r2_on_call_end(openr2_chan_t *r2chan) ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); /* in some circumstances openr2 can call on_call_init right after this, so let's advance the state right here */ - ftdm_r2_state_advance_all(ftdmchan); + ftdm_channel_advance_states(ftdmchan, ftdm_r2_state_advance); } static void ftdm_r2_on_call_read(openr2_chan_t *r2chan, const unsigned char *buf, int buflen) @@ -853,7 +846,7 @@ static void ftdm_r2_recover_from_protocol_error(void *data) goto done; } ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - ftdm_r2_state_advance_all(ftdmchan); + ftdm_channel_advance_states(ftdmchan, ftdm_r2_state_advance); done: ftdm_channel_unlock(ftdmchan); } @@ -1620,10 +1613,10 @@ fail: } /* the channel must be locked when calling this function */ -static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) +static ftdm_status_t ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) { ftdm_sigmsg_t sigev; - int ret; + ftdm_status_t ret; ftdm_r2_call_t *r2call = R2CALL(ftdmchan); openr2_chan_t *r2chan = r2call->r2chan; ftdm_r2_data_t *r2data = ftdmchan->span->signal_data; @@ -1633,172 +1626,161 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) sigev.span_id = ftdmchan->span_id; sigev.channel = ftdmchan; - ret = 0; - - /* because we do not always acknowledge the state change (clearing the FTDM_CHANNEL_STATE_CHANGE flag) due to the accept - * procedure described below, we need the chanstate member to NOT process some states twice, so is valid entering this - * function with the FTDM_CHANNEL_STATE_CHANGE flag set but with a state that was already processed and is just waiting - * to complete (the processing is media-bound) - * */ - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE) - && (r2call->chanstate != ftdmchan->state)) { - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Executing state handler for %s\n", ftdm_channel_state2str(ftdmchan->state)); - r2call->chanstate = ftdmchan->state; - - if (IS_ACCEPTING_PENDING(ftdmchan)) { - /* - Moving to PROGRESS, PROGRESS_MEDIA or UP means that we must accept the call first, and accepting - the call in R2 means sending a tone, then waiting for the acknowledge from the other end, - since all of that requires sending and detecting tones, it takes a few milliseconds (I'd say around 100) - which means during that time the user should not try to perform any operations like answer, hangup or anything - else, therefore we DO NOT clear the FTDM_CHANNEL_STATE_CHANGE flag here, we rely on ftdm_io.c to block - the user thread until we're done with the accept (see on_call_accepted callback) and then we clear the state change flag, - otherwise we have a race condition between freetdm calling openr2_chan_answer_call and openr2 accepting the call first, - if freetdm calls openr2_chan_answer_call before the accept cycle completes, openr2 will fail to answer the call */ - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "State ack for state %s will have to wait a bit\n", ftdm_channel_state2str(ftdmchan->state)); - } else if (ftdmchan->state != FTDM_CHANNEL_STATE_DOWN){ - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE); - ftdm_channel_complete_state(ftdmchan); - } - - switch (ftdmchan->state) { - - /* starting an incoming call */ - case FTDM_CHANNEL_STATE_COLLECT: - { - uint32_t interval = 0; - ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_INTERVAL, &interval); - ftdm_assert(interval != 0, "Invalid interval!"); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Starting processing of incoming call with interval %d\n", interval); - openr2_chan_enable_read(r2chan); - } - break; + ret = FTDM_SUCCESS; + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Executing state handler for %s\n", ftdm_channel_state2str(ftdmchan->state)); + + if (IS_ACCEPTING_PENDING(ftdmchan)) { + /* + Moving to PROGRESS, PROGRESS_MEDIA or UP means that we must accept the call first, and accepting + the call in R2 means sending a tone, then waiting for the acknowledge from the other end, + since all of that requires sending and detecting tones, it takes a few milliseconds (I'd say around 100) + which means during that time the user should not try to perform any operations like answer, hangup or anything + else, therefore we DO NOT clear the FTDM_CHANNEL_STATE_CHANGE flag here, we rely on ftdm_io.c to block + the user thread until we're done with the accept (see on_call_accepted callback) and then we clear the state change flag, + otherwise we have a race condition between freetdm calling openr2_chan_answer_call and openr2 accepting the call first, + if freetdm calls openr2_chan_answer_call before the accept cycle completes, openr2 will fail to answer the call */ + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "State ack for state %s will have to wait a bit\n", ftdm_channel_state2str(ftdmchan->state)); + } else if (ftdmchan->state != FTDM_CHANNEL_STATE_DOWN){ + ftdm_channel_complete_state(ftdmchan); + } + + switch (ftdmchan->state) { + + /* starting an incoming call */ + case FTDM_CHANNEL_STATE_COLLECT: + { + uint32_t interval = 0; + ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_INTERVAL, &interval); + ftdm_assert(interval != 0, "Invalid interval!"); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Starting processing of incoming call with interval %d\n", interval); + openr2_chan_enable_read(r2chan); + } + break; - /* starting an outgoing call */ - case FTDM_CHANNEL_STATE_DIALING: - { - uint32_t interval = 0; - ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_INTERVAL, &interval); - ftdm_assert(interval != 0, "Invalid interval!"); - ftdm_log_chan(ftdmchan, - FTDM_LOG_DEBUG, "Starting processing of outgoing call in channel with interval %d\n", interval); - openr2_chan_enable_read(r2chan); - } - break; + /* starting an outgoing call */ + case FTDM_CHANNEL_STATE_DIALING: + { + uint32_t interval = 0; + ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_INTERVAL, &interval); + ftdm_assert(interval != 0, "Invalid interval!"); + ftdm_log_chan(ftdmchan, + FTDM_LOG_DEBUG, "Starting processing of outgoing call in channel with interval %d\n", interval); + openr2_chan_enable_read(r2chan); + } + break; - /* incoming call was offered */ - case FTDM_CHANNEL_STATE_RING: + /* incoming call was offered */ + case FTDM_CHANNEL_STATE_RING: - /* notify the user about the new call */ - sigev.event_id = FTDM_SIGEVENT_START; + /* notify the user about the new call */ + sigev.event_id = FTDM_SIGEVENT_START; - ftdm_span_send_signal(ftdmchan->span, &sigev); - r2call->ftdm_call_started = 1; + ftdm_span_send_signal(ftdmchan->span, &sigev); + r2call->ftdm_call_started = 1; - break; + break; - /* the call is making progress */ - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - { - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - if (!r2call->accepted) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Accepting call\n"); - ft_r2_accept_call(ftdmchan); - } - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Notifying progress\n"); - sigev.event_id = FTDM_SIGEVENT_PROCEED; - ftdm_span_send_signal(ftdmchan->span, &sigev); + /* the call is making progress */ + case FTDM_CHANNEL_STATE_PROGRESS: + case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: + { + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + if (!r2call->accepted) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Accepting call\n"); + ft_r2_accept_call(ftdmchan); + } + } else { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Notifying progress\n"); + sigev.event_id = FTDM_SIGEVENT_PROCEED; + ftdm_span_send_signal(ftdmchan->span, &sigev); - sigev.event_id = FTDM_SIGEVENT_PROGRESS_MEDIA; - ftdm_span_send_signal(ftdmchan->span, &sigev); - } + sigev.event_id = FTDM_SIGEVENT_PROGRESS_MEDIA; + ftdm_span_send_signal(ftdmchan->span, &sigev); } - break; + } + break; - /* the call was answered */ - case FTDM_CHANNEL_STATE_UP: - { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Call was answered\n"); - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - if (!r2call->accepted) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Call has not been accepted, need to accept first\n"); - // the answering will be done in the on_call_accepted handler - ft_r2_accept_call(ftdmchan); - r2call->answer_pending = 1; - } else { - ft_r2_answer_call(ftdmchan); - } + /* the call was answered */ + case FTDM_CHANNEL_STATE_UP: + { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Call was answered\n"); + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + if (!r2call->accepted) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Call has not been accepted, need to accept first\n"); + // the answering will be done in the on_call_accepted handler + ft_r2_accept_call(ftdmchan); + r2call->answer_pending = 1; } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Notifying of call answered\n"); - sigev.event_id = FTDM_SIGEVENT_UP; - ftdm_span_send_signal(ftdmchan->span, &sigev); + ft_r2_answer_call(ftdmchan); } + } else { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Notifying of call answered\n"); + sigev.event_id = FTDM_SIGEVENT_UP; + ftdm_span_send_signal(ftdmchan->span, &sigev); } - break; + } + break; - /* just got hangup */ - case FTDM_CHANNEL_STATE_HANGUP: - { - if (!r2call->disconnect_rcvd) { - openr2_call_disconnect_cause_t disconnect_cause = ftdm_r2_ftdm_cause_to_openr2_cause(ftdmchan); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Clearing call, cause = %s\n", openr2_proto_get_disconnect_string(disconnect_cause)); - /* this will disconnect the call, but need to wait for the call end before moving to DOWN */ - openr2_chan_disconnect_call(r2chan, disconnect_cause); - } else if (!r2call->protocol_error) { - /* just ack the hangup, on_call_end will be called by openr2 right after */ - openr2_chan_disconnect_call(r2chan, OR2_CAUSE_NORMAL_CLEARING); - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Clearing call due to protocol error\n"); - /* do not set to down yet, give some time for recovery */ - ftdm_sched_timer(r2data->sched, "protocolerr_recover", 100, - ftdm_r2_recover_from_protocol_error, r2chan, &r2call->protocol_error_recovery_timer); - } + /* just got hangup */ + case FTDM_CHANNEL_STATE_HANGUP: + { + if (!r2call->disconnect_rcvd) { + openr2_call_disconnect_cause_t disconnect_cause = ftdm_r2_ftdm_cause_to_openr2_cause(ftdmchan); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Clearing call, cause = %s\n", openr2_proto_get_disconnect_string(disconnect_cause)); + /* this will disconnect the call, but need to wait for the call end before moving to DOWN */ + openr2_chan_disconnect_call(r2chan, disconnect_cause); + } else if (!r2call->protocol_error) { + /* just ack the hangup, on_call_end will be called by openr2 right after */ + openr2_chan_disconnect_call(r2chan, OR2_CAUSE_NORMAL_CLEARING); + } else { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Clearing call due to protocol error\n"); + /* do not set to down yet, give some time for recovery */ + ftdm_sched_timer(r2data->sched, "protocolerr_recover", 100, + ftdm_r2_recover_from_protocol_error, r2chan, &r2call->protocol_error_recovery_timer); } - break; + } + break; - case FTDM_CHANNEL_STATE_TERMINATING: - { - /* if the call has not been started yet we must go to HANGUP right here */ - if (!r2call->ftdm_call_started) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); - } else { - openr2_call_disconnect_cause_t disconnect_cause = ftdm_r2_ftdm_cause_to_openr2_cause(ftdmchan); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Clearing call, cause = %s\n", openr2_proto_get_disconnect_string(disconnect_cause)); - /* notify the user of the call terminating and we wait for the user to move us to hangup */ - sigev.event_id = FTDM_SIGEVENT_STOP; - ftdm_span_send_signal(ftdmchan->span, &sigev); - } + case FTDM_CHANNEL_STATE_TERMINATING: + { + /* if the call has not been started yet we must go to HANGUP right here */ + if (!r2call->ftdm_call_started) { + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); + } else { + openr2_call_disconnect_cause_t disconnect_cause = ftdm_r2_ftdm_cause_to_openr2_cause(ftdmchan); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Clearing call, cause = %s\n", openr2_proto_get_disconnect_string(disconnect_cause)); + /* notify the user of the call terminating and we wait for the user to move us to hangup */ + sigev.event_id = FTDM_SIGEVENT_STOP; + ftdm_span_send_signal(ftdmchan->span, &sigev); } - break; + } + break; - /* finished call for good */ - case FTDM_CHANNEL_STATE_DOWN: - { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "R2 Call is down\n"); - ret = 1; - } - break; + /* finished call for good */ + case FTDM_CHANNEL_STATE_DOWN: + { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "R2 Call is down\n"); + ret = FTDM_BREAK; + } + break; - /* INDICATE_RINGING doesn't apply to MFC/R2. maybe we could generate a tone */ - case FTDM_CHANNEL_STATE_RINGING: - { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "RINGING indicated, ignoring it as it doesn't apply to MFC/R2\n"); - } - break; + /* INDICATE_RINGING doesn't apply to MFC/R2. maybe we could generate a tone */ + case FTDM_CHANNEL_STATE_RINGING: + { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "RINGING indicated, ignoring it as it doesn't apply to MFC/R2\n"); + } + break; - default: - { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Unhandled channel state change: %s\n", ftdm_channel_state2str(ftdmchan->state)); - } - break; + default: + { + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Unhandled channel state change: %s\n", ftdm_channel_state2str(ftdmchan->state)); + } + break; - } } - if (ret) { + if (ret == FTDM_BREAK) { ftdm_channel_t *closed_chan; closed_chan = ftdmchan; ftdm_channel_close(&closed_chan); @@ -1807,20 +1789,6 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) return ret; } -/* the channel must be locked when calling this function */ -static void ftdm_r2_state_advance_all(ftdm_channel_t *ftdmchan) -{ - /* because we do not always acknowledge the state change (clearing the FTDM_CHANNEL_STATE_CHANGE flag) due to the accept - * procedure described below, we need the chanstate member to NOT process some states twice, so is valid entering this - * function with the FTDM_CHANNEL_STATE_CHANGE flag set but with a state that was already processed and is just waiting - * to complete (the processing is media-bound) - * */ - while (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE) - && (R2CALL(ftdmchan)->chanstate != ftdmchan->state)) { - ftdm_r2_state_advance(ftdmchan); - } -} - static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) { openr2_chan_t *r2chan = NULL; @@ -1949,12 +1917,12 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_RX_DISABLED); ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_TX_DISABLED); - ftdm_r2_state_advance_all(ftdmchan); + ftdm_channel_advance_states(ftdmchan, ftdm_r2_state_advance); r2chan = call->r2chan; openr2_chan_process_signaling(r2chan); - ftdm_r2_state_advance_all(ftdmchan); + ftdm_channel_advance_states(ftdmchan, ftdm_r2_state_advance); if (!call->accepted) { /* if the call is not accepted we do not want users reading */ diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 30fe6ca..ff12963 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -777,11 +777,17 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_answer(const char *file, const char FT_DECLARE(ftdm_status_t) _ftdm_channel_call_place(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan); /*! \brief Indicate a new condition in an incoming call + * * \note Every indication request will result in FTDM_SIGEVENT_INDICATION_COMPLETED event being delivered with - * the proper status that will inform you if the request was successful or not. - * Be aware there is no guarantee of whether the event will arrive after or before your execution thread returns - * from ftdm_channel_call_indicate. This means you could get FTDM_SIGEVENT_INDICATION_COMPLETED even before - * your execution thread returns from the ftdm_channel_call_indicate() API + * the proper status that will inform you if the request was successful or not. The exception is if this + * function returns something different to FTDM_SUCCESS, in which case the request failed right away and no + * further FTDM_SIGEVENT_INDICATION_COMPLETED will be delivered + * Be aware there is no guarantee of whether the completion event will arrive after or before your execution + * thread returns from ftdm_channel_call_indicate. This means you could get FTDM_SIGEVENT_INDICATION_COMPLETED + * even before your execution thread returns from the ftdm_channel_call_indicate() API + * + * \note You cannot send more than one indication at the time. You must wait for the completed event before + * calling this function again (unless the return code was different than FTDM_SUCCESS) */ #define ftdm_channel_call_indicate(ftdmchan, indication) _ftdm_channel_call_indicate(__FILE__, __FUNCTION__, __LINE__, (ftdmchan), (indication)) diff --git a/libs/freetdm/src/include/ftdm_declare.h b/libs/freetdm/src/include/ftdm_declare.h index 2e41281..88a7693 100644 --- a/libs/freetdm/src/include/ftdm_declare.h +++ b/libs/freetdm/src/include/ftdm_declare.h @@ -192,6 +192,7 @@ typedef enum { FTDM_EINVAL, /*!< Invalid argument */ FTDM_ECANCELED, /*!< Operation cancelled */ + FTDM_EBUSY, /*!< Device busy */ } ftdm_status_t; /*! \brief FreeTDM bool type. */ diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index 8f97456..605ab8d 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -583,7 +583,7 @@ FT_DECLARE(int) ftdm_vasprintf(char **ret, const char *fmt, va_list ap); FT_DECLARE(ftdm_status_t) ftdm_span_close_all(void); FT_DECLARE(ftdm_status_t) ftdm_channel_open_chan(ftdm_channel_t *ftdmchan); -FT_DECLARE(void) ftdm_ack_indication(const ftdm_channel_t *ftdmchan, ftdm_channel_indication_t indication, ftdm_status_t status); +FT_DECLARE(void) ftdm_ack_indication(ftdm_channel_t *ftdmchan, ftdm_channel_indication_t indication, ftdm_status_t status); /*! * \brief Retrieves an event from the span diff --git a/libs/freetdm/src/include/private/ftdm_state.h b/libs/freetdm/src/include/private/ftdm_state.h index 79a3df0..36dcc2b 100644 --- a/libs/freetdm/src/include/private/ftdm_state.h +++ b/libs/freetdm/src/include/private/ftdm_state.h @@ -138,8 +138,11 @@ FT_DECLARE(int) ftdm_check_state_all(ftdm_span_t *span, ftdm_channel_state_t sta typedef enum { FTDM_STATE_STATUS_NEW, FTDM_STATE_STATUS_PROCESSED, - FTDM_STATE_STATUS_COMPLETED + FTDM_STATE_STATUS_COMPLETED, + FTDM_STATE_STATUS_INVALID } ftdm_state_status_t; +#define CHANNEL_STATE_STATUS_STRINGS "NEW", "PROCESSED", "COMPLETED", "INVALID" +FTDM_STR2ENUM_P(ftdm_str2ftdm_state_status, ftdm_state_status2str, ftdm_state_status_t) typedef enum { ZSM_NONE, commit 81608da0067cb1bca2f718e4973e83af9371a659 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Dec 29 12:28:12 2010 -0600 refactor sofia_contact to try the profile_name first then the domain to resolve the profile then fall back to querying every profile to reduce confusion with multi-homers (d'oh) also special profile name * will force a search-all situation diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 8aa37b9..af7149b 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3395,6 +3395,36 @@ SWITCH_STANDARD_API(sofia_count_reg_function) return SWITCH_STATUS_SUCCESS; } +static void select_from_profile(sofia_profile_t *profile, + const char *user, + const char *domain, + const char *concat, + const char *exclude_contact, + switch_stream_handle_t *stream) +{ + struct cb_helper cb; + char *sql; + + cb.row_process = 0; + + cb.profile = profile; + cb.stream = stream; + + if (exclude_contact) { + sql = switch_mprintf("select contact, profile_name, '%q' " + "from sip_registrations where sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%') " + "and contact not like '%%%s%%'", (concat != NULL) ? concat : "", user, domain, domain, exclude_contact); + } else { + sql = switch_mprintf("select contact, profile_name, '%q' " + "from sip_registrations where sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%')", + (concat != NULL) ? concat : "", user, domain, domain); + } + + switch_assert(sql); + sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, contact_callback, &cb); + switch_safe_free(sql); +} + SWITCH_STANDARD_API(sofia_contact_function) { char *data; @@ -3406,6 +3436,7 @@ SWITCH_STANDARD_API(sofia_contact_function) sofia_profile_t *profile = NULL; const char *exclude_contact = NULL; char *reply = "error/facility_not_subscribed"; + switch_stream_handle_t mystream = { 0 }; if (!cmd) { stream->write_function(stream, "%s", ""); @@ -3440,76 +3471,70 @@ SWITCH_STANDARD_API(sofia_contact_function) } } - if (!profile_name && domain) { - profile_name = domain; + if (zstr(domain)) { + domain = switch_core_get_variable("domain"); } - if (user && profile_name) { - char *sql; + if (!user) goto end; - if (!(profile = sofia_glue_find_profile(profile_name))) { - profile_name = domain; - domain = NULL; - } - - if (!profile && profile_name) { + if (zstr(profile_name) || strcmp(profile_name, "*") || zstr(domain)) { + if (!zstr(profile_name)) { profile = sofia_glue_find_profile(profile_name); } - - if (profile) { - struct cb_helper cb; - switch_stream_handle_t mystream = { 0 }; - - cb.row_process = 0; - - if (!domain || (!strchr(domain, '.') && strcmp(profile_name, domain))) { - domain = profile->name; - } - - SWITCH_STANDARD_STREAM(mystream); - switch_assert(mystream.data); - cb.profile = profile; - cb.stream = &mystream; - - if (exclude_contact) { - sql = switch_mprintf("select contact, profile_name, '%q' " - "from sip_registrations where sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%') " - "and contact not like '%%%s%%'", (concat != NULL) ? concat : "", user, domain, domain, exclude_contact); - } else { - sql = switch_mprintf("select contact, profile_name, '%q' " - "from sip_registrations where sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%')", - (concat != NULL) ? concat : "", user, domain, domain); - } - - switch_assert(sql); - sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, contact_callback, &cb); - switch_safe_free(sql); - reply = (char *) mystream.data; - if (!zstr(reply) && end_of(reply) == ',') { - end_of(reply) = '\0'; - } - - if (zstr(reply)) { - reply = "error/user_not_registered"; - } - - stream->write_function(stream, "%s", reply); - reply = NULL; - - switch_safe_free(mystream.data); + + if (!profile) { + profile = sofia_glue_find_profile(domain); } } - if (reply) { - stream->write_function(stream, "%s", reply); + if (profile || !zstr(domain)) { + SWITCH_STANDARD_STREAM(mystream); + switch_assert(mystream.data); } - switch_safe_free(data); - if (profile) { + if (zstr(domain)) { + domain = profile->name; + } + + select_from_profile(profile, user, domain, concat, exclude_contact, &mystream); sofia_glue_release_profile(profile); + + } else if (!zstr(domain)) { + switch_mutex_lock(mod_sofia_globals.hash_mutex); + if (mod_sofia_globals.profile_hash) { + switch_hash_index_t *hi; + const void *var; + void *val; + + for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) { + switch_hash_this(hi, &var, NULL, &val); + if ((profile = (sofia_profile_t *) val) && !strcmp((char *)var, profile->name)) { + select_from_profile(profile, user, domain, concat, exclude_contact, &mystream); + profile = NULL; + } + } + } + switch_mutex_unlock(mod_sofia_globals.hash_mutex); + } + + reply = (char *) mystream.data; + + end: + + if (zstr(reply)) { + reply = "error/user_not_registered"; + } else if (end_of(reply) == ',') { + end_of(reply) = '\0'; } + stream->write_function(stream, "%s", reply); + reply = NULL; + + switch_safe_free(mystream.data); + + switch_safe_free(data); + return SWITCH_STATUS_SUCCESS; } commit 1d8a9297118f86ba40c0d2cc9f86b32552191acd Author: Brian West <brian@freeswitch.org> Date: Tue Dec 28 14:00:17 2010 -0600 little note of warning for some folks just in case we had a question about the math lesson diff --git a/conf/autoload_configs/switch.conf.xml b/conf/autoload_configs/switch.conf.xml index 896dd0e..fba809b 100644 --- a/conf/autoload_configs/switch.conf.xml +++ b/conf/autoload_configs/switch.conf.xml @@ -23,7 +23,13 @@ <settings> <!--Colorize the Console --> <param name="colorize-console" value="true"/> - <!--Most channels to allow at once --> + <!-- + Max number of sessions to allow at any given time. + + NOTICE: If you're driving 28 T1's in a single box you should set this to 644*2 or 1288 + this will ensure you're able to use the entire DS3 without a problem. Otherwise you'll + be 144 channels short of always filling that DS3 up which can translate into waste. + --> <param name="max-sessions" value="1000"/> <!--Most channels to create per second --> <param name="sessions-per-second" value="30"/> commit 86e7cdc5d1c6d8d8f173d4e5c921c9588f75679f Author: Jeff Lenk <jeff@jefflenk.com> Date: Tue Dec 28 11:23:39 2010 -0600 FS-2949 spelling error in -ERR return code encounterd -> encountered diff --git a/src/mod/languages/mod_lua/mod_lua.cpp b/src/mod/languages/mod_lua/mod_lua.cpp index cf9b373..b5a4999 100644 --- a/src/mod/languages/mod_lua/mod_lua.cpp +++ b/src/mod/languages/mod_lua/mod_lua.cpp @@ -450,7 +450,7 @@ SWITCH_STANDARD_API(lua_api_function) if (switch_event_get_header(stream->param_event, "http-host")) { stream->write_function(stream, "Content-Type: text/html\n\n<H2>Error Executing Script</H2>"); } else { - stream->write_function(stream, "-ERR encounterd\n"); + stream->write_function(stream, "-ERR encountered\n"); } } lua_uninit(L); commit 49a524b79ba74a8bb37092a7b8bf60821fe8e3ba Merge: 479f3de 0b8a904 Author: Joao Mesquita <jmesquita@freeswitch.org> Date: Mon Dec 27 21:31:40 2010 -0300 Merge branch 'master' of git@git.freeswitch.org:freeswitch Conflicts: src/mod/applications/mod_conference/mod_conference.c diff --cc src/mod/applications/mod_conference/mod_conference.c index c6a409e,fef64d5..bdf5659 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@@ -5993,8 -5984,10 +5992,12 @@@ static conference_obj_t *conference_new char *verbose_events = NULL; char *auto_record = NULL; char *terminate_on_silence = NULL; + char uuid_str[SWITCH_UUID_FORMATTED_LENGTH+1]; + switch_uuid_t uuid; + switch_codec_implementation_t read_impl = { 0 }; + switch_channel_t *channel = NULL; + const char *force_rate = NULL, *force_interval = NULL; + uint32_t force_rate_i = 0, force_interval_i = 0; /* Validate the conference name */ if (zstr(name)) { commit 479f3de26be7267368a3ea912b0b52085884c55e Author: Joao Mesquita <jmesquita@freeswitch.org> Date: Mon Dec 27 21:23:42 2010 -0300 Add an unique id to the conference obj so that we can track conferences. diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index fa1f12c..c6a409e 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -287,6 +287,7 @@ typedef struct conference_obj { uint32_t avg_itt; uint32_t avg_tally; switch_time_t run_time; + char *uuid_str; } conference_obj_t; /* Relationship with another member */ @@ -440,6 +441,7 @@ static switch_status_t conference_add_event_data(conference_obj_t *conference, s switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Size", "%u", conference->count); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Conference-Profile-Name", conference->profile_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Conference-Unique-ID", conference->uuid_str); return status; } @@ -2779,6 +2781,12 @@ static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *th switch_core_file_close(&fh); } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Recording of %s Stopped\n", rec->path); + if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) { + conference_add_event_data(conference, event); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "stop-recording"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Path", rec->path); + switch_event_fire(&event); + } if (rec->pool) { switch_memory_pool_t *pool = rec->pool; @@ -5985,7 +5993,9 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m char *verbose_events = NULL; char *auto_record = NULL; char *terminate_on_silence = NULL; - + char uuid_str[SWITCH_UUID_FORMATTED_LENGTH+1]; + switch_uuid_t uuid; + /* Validate the conference name */ if (zstr(name)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Record! no name.\n"); @@ -6315,6 +6325,12 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m conference->verbose_events = 1; } + /* Create the conference unique identifier */ + switch_uuid_get(&uuid); + switch_uuid_format(uuid_str, &uuid); + conference->uuid_str = switch_core_strdup(conference->pool, uuid_str); + + /* Activate the conference mutex for exclusivity */ switch_mutex_init(&conference->mutex, SWITCH_MUTEX_NESTED, conference->pool); switch_mutex_init(&conference->flag_mutex, SWITCH_MUTEX_NESTED, conference->pool); commit 0b8a9049f58bdb5ba224f74095fada7af4689ac6 Author: Brian West <brian@freeswitch.org> Date: Mon Dec 27 17:39:29 2010 -0600 swigall diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index 2c88f65..b7187d4 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -6588,6 +6588,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_remove_all(void * jarg1) } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_enumerate(void * jarg1, void * jarg2) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_stream_handle_t *arg2 = (switch_stream_handle_t *) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (switch_stream_handle_t *)jarg2; + result = (switch_status_t)switch_core_media_bug_enumerate(arg1,arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_read(void * jarg1, void * jarg2, int jarg3) { int jresult ; switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index 502ac01..a79fde9 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -1045,6 +1045,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_core_media_bug_enumerate(SWIGTYPE_p_switch_core_session session, switch_stream_handle stream) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_enumerate(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_stream_handle.getCPtr(stream)); + return ret; + } + public static switch_status_t switch_core_media_bug_read(SWIGTYPE_p_switch_media_bug bug, switch_frame frame, switch_bool_t fill) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_read(SWIGTYPE_p_switch_media_bug.getCPtr(bug), switch_frame.getCPtr(frame), (int)fill); return ret; @@ -7269,6 +7274,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_remove_all")] public static extern int switch_core_media_bug_remove_all(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_enumerate")] + public static extern int switch_core_media_bug_enumerate(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_read")] public static extern int switch_core_media_bug_read(HandleRef jarg1, HandleRef jarg2, int jarg3); commit 844ac2201c4e98f19de695328334e7288197df65 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Dec 27 17:41:26 2010 -0600 fix bad codepaths in mod_snapshot diff --git a/src/mod/applications/mod_snapshot/mod_snapshot.c b/src/mod/applications/mod_snapshot/mod_snapshot.c index 2001ebd..20b3110 100644 --- a/src/mod/applications/mod_snapshot/mod_snapshot.c +++ b/src/mod/applications/mod_snapshot/mod_snapshot.c @@ -188,10 +188,12 @@ static switch_status_t do_snap(switch_core_session_t *session) switch_core_file_close(&fh); switch_core_set_variable("file", file); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Wrote %s\n", file); + return SWITCH_STATUS_SUCCESS; } - return SWITCH_STATUS_SUCCESS; - + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s Bug is not attached.\n", switch_channel_get_name(channel)); + return SWITCH_STATUS_FALSE; + } #define SNAP_SYNTAX "start <sec> <read|write>" @@ -249,7 +251,7 @@ SWITCH_STANDARD_APP(snapshot_app_function) } -#define SNAP_API_SYNTAX "<uuid> <warning>" +#define SNAP_API_SYNTAX "<uuid> snap|start [<sec> read|write <base>]" SWITCH_STANDARD_API(snapshot_function) { char *mycmd = NULL, *argv[5] = { 0 }; @@ -260,7 +262,7 @@ SWITCH_STANDARD_API(snapshot_function) argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); } - if (zstr(cmd) || argc < 1 || zstr(argv[0])) { + if (zstr(cmd) || argc < 2 || zstr(argv[0])) { stream->write_function(stream, "-USAGE: %s\n", SNAP_API_SYNTAX); goto done; } else { @@ -270,9 +272,9 @@ SWITCH_STANDARD_API(snapshot_function) if (!strcasecmp(argv[1], "snap")) { status = do_snap(lsession); } else if (!strcasecmp(argv[1], "start")) { - char *sec = argv[1]; - char *fl = argv[2]; - const char *base = argv[3]; + char *sec = argv[2]; + char *fl = argv[3]; + const char *base = argv[4]; int seconds = 5; switch_media_bug_flag_t flags = SMBF_READ_STREAM | SMBF_WRITE_STREAM | SMBF_READ_PING; @@ -325,10 +327,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_snapshot_load) /* connect my internal structure to the blank pointer passed to me */ *module_interface = switch_loadable_module_create_module_interface(pool, modname); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Hello World!\n"); - SWITCH_ADD_API(api_interface, "uuid_snapshot", "Snapshot API", snapshot_function, SNAP_API_SYNTAX); SWITCH_ADD_APP(app_interface, "snapshot", "", "", snapshot_app_function, SNAP_SYNTAX, SAF_SUPPORT_NOMEDIA); + switch_console_set_complete("add uuid_snapshot ::console::list_uuid"); /* indicate that the module should continue to be loaded */ return SWITCH_STATUS_SUCCESS; commit f6eab64c5c8eb76484f0502eb99c4dbefbbda7ef Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Dec 27 17:20:33 2010 -0600 add uuid_buglist to fetch the current media-bugs attached to a given session uuid diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 840a06c..bcd3c0a 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -246,6 +246,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_close(_Inout_ switch_media */ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove_all(_In_ switch_core_session_t *session); +SWITCH_DECLARE(switch_status_t) switch_core_media_bug_enumerate(switch_core_session_t *session, switch_stream_handle_t *stream); + /*! \brief Read a frame from the bug \param bug the bug to read from diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 2deb437..1c2e3eb 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -2488,6 +2488,48 @@ SWITCH_STANDARD_API(uuid_display_function) return SWITCH_STATUS_SUCCESS; } +#define BUGLIST_SYNTAX "<uuid>" +SWITCH_STANDARD_API(uuid_buglist_function) +{ + char *mydata = NULL, *argv[2] = { 0 }; + int argc = 0; + + switch_status_t status = SWITCH_STATUS_FALSE; + + if (zstr(cmd)) { + goto error; + } + + mydata = strdup(cmd); + switch_assert(mydata); + + argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + + if (argc < 1) { + goto error; + } + if (argv[0]) { + switch_core_session_t *lsession = NULL; + + if ((lsession = switch_core_session_locate(argv[0]))) { + status = switch_core_media_bug_enumerate(lsession, stream); + switch_core_session_rwunlock(lsession); + } + goto ok; + } else { + goto error; + } + + error: + stream->write_function(stream, "-USAGE: %s\n", BUGLIST_SYNTAX); + switch_safe_free(mydata); + return SWITCH_STATUS_SUCCESS; + ok: + switch_safe_free(mydata); + + return SWITCH_STATUS_SUCCESS; +} + #define SIMPLIFY_SYNTAX "<uuid>" SWITCH_STANDARD_API(uuid_simplify_function) { @@ -2541,7 +2583,6 @@ SWITCH_STANDARD_API(uuid_simplify_function) return SWITCH_STATUS_SUCCESS; } - #define JITTERBUFFER_SYNTAX "<uuid> [0|<min_msec>[:<max_msec>]]" SWITCH_STANDARD_API(uuid_jitterbuffer_function) { @@ -4797,6 +4838,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) SWITCH_ADD_API(commands_api_interface, "uuid_break", "Break", break_function, BREAK_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_bridge", "uuid_bridge", uuid_bridge_function, ""); SWITCH_ADD_API(commands_api_interface, "uuid_broadcast", "broadcast", uuid_broadcast_function, BROADCAST_SYNTAX); + SWITCH_ADD_API(commands_api_interface, "uuid_buglist", "List media bugs on a session", uuid_buglist_function, BUGLIST_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_chat", "Send a chat message", uuid_chat, UUID_CHAT_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_debug_audio", "debug audio", uuid_debug_audio_function, DEBUG_AUDIO_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_deflect", "Send a deflect", uuid_deflect, UUID_DEFLECT_SYNTAX); @@ -4911,6 +4953,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) switch_console_set_complete("add uuid_break ::console::list_uuid both"); switch_console_set_complete("add uuid_bridge ::console::list_uuid ::console::list_uuid"); switch_console_set_complete("add uuid_broadcast ::console::list_uuid"); + switch_console_set_complete("add uuid_buglist ::console::list_uuid"); switch_console_set_complete("add uuid_chat ::console::list_uuid"); switch_console_set_complete("add uuid_debug_audio ::console::list_uuid"); switch_console_set_complete("add uuid_deflect ::console::list_uuid"); @@ -4939,7 +4982,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) switch_console_set_complete("add uuid_phone_event ::console::list_uuid talk"); switch_console_set_complete("add uuid_phone_event ::console::list_uuid hold"); switch_console_set_complete("add uuid_preprocess ::console::list_uuid"); - switch_console_set_complete("add uuid_record ::console::list_uuid"); + switch_console_set_complete("add uuid_record ::console::list_uuid ::[start:stop"); switch_console_set_complete("add uuid_recv_dtmf ::console::list_uuid"); switch_console_set_complete("add uuid_send_dtmf ::console::list_uuid"); switch_console_set_complete("add uuid_session_heartbeat ::console::list_uuid"); diff --git a/src/switch_core_media_bug.c b/src/switch_core_media_bug.c index 7170969..21db3a9 100644 --- a/src/switch_core_media_bug.c +++ b/src/switch_core_media_bug.c @@ -392,6 +392,32 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_flush_all(switch_core_sess return SWITCH_STATUS_FALSE; } +SWITCH_DECLARE(switch_status_t) switch_core_media_bug_enumerate(switch_core_session_t *session, switch_stream_handle_t *stream) +{ + switch_media_bug_t *bp; + + stream->write_function(stream, "<media-bugs>\n"); + + if (session->bugs) { + switch_thread_rwlock_wrlock(session->bug_rwlock); + for (bp = session->bugs; bp; bp = bp->next) { + int thread_locked = (bp->thread_id && bp->thread_id == switch_thread_self()); + stream->write_function(stream, + " <media-bug>\n" + " <function>%s</function>\n" + " <target>%s</target>\n" + " <thread-locked>%d</thread-locked>\n" + " </media-bug>\n", + bp->function, bp->target, thread_locked); + + } + switch_thread_rwlock_unlock(session->bug_rwlock); + } + + stream->write_function(stream, "</media-bugs>\n"); + + return SWITCH_STATUS_SUCCESS; +} SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove_all(switch_core_session_t *session) { commit 27f5340d6ddda512f7d5d12b088f177e6aa38d28 Author: Brian West <brian@freeswitch.org> Date: Mon Dec 27 15:34:26 2010 -0600 swigall diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index bf32881..502ac01 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -21525,6 +21525,8 @@ public enum switch_channel_flag_t { CF_RECOVERED, CF_JITTERBUFFER, CF_DIALPLAN, + CF_BLOCK_BROADCAST_UNTIL_MEDIA, + CF_CNG_PLC, CF_FLAG_MAX } diff --git a/src/mod/languages/mod_perl/mod_perl_wrap.cpp b/src/mod/languages/mod_perl/mod_perl_wrap.cpp index 2efbdf1..370c88b 100644 --- a/src/mod/languages/mod_perl/mod_perl_wrap.cpp +++ b/src/mod/languages/mod_perl/mod_perl_wrap.cpp @@ -9732,17 +9732,17 @@ XS(SWIG_init) { SWIG_TypeClientData(SWIGTYPE_p_IVRMenu, (void*) "freeswitch::IVRMenu"); SWIG_TypeClientData(SWIGTYPE_p_API, (void*) "freeswitch::API"); SWIG_TypeClientData(SWIGTYPE_p_input_callback_state, (void*) "freeswitch::input_callback_state_t"); - /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_HUP", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_HUP))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; - /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_FREE", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_FREE))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; - /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_RDLOCK", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_RDLOCK))); SvREADONLY_on(sv); commit 903b2901dbd09e9ebbc6dffced4faa8cda166a11 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Dec 27 15:35:10 2010 -0600 try to adjust the timer to be ok with the horrible 10000 microsecond kernel resolution on amazon ec3 but that doesn't mean it's not horribly wrong to run the kernel that slow diff --git a/src/switch_time.c b/src/switch_time.c index 8465e5d..ad721be 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -213,9 +213,13 @@ SWITCH_DECLARE(void) switch_time_calibrate_clock(void) } if (res > 1500) { + STEP_MS = res / 1000; + STEP_MIC = res; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Timer resolution of %ld microseconds detected!\n" - "Do you have your kernel timer frequency set to lower than 1,000Hz? You may experience audio problems.\n", ts.tv_nsec / 1000); + "Do you have your kernel timer frequency set to lower than 1,000Hz? " + "You may experience audio problems. Step MS %d\n", ts.tv_nsec / 1000, STEP_MS); do_sleep(5000000); switch_time_set_cond_yield(SWITCH_TRUE); return; commit 5eb951aa302676d2bebd74f630fece440db3b32f Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Dec 27 14:55:55 2010 -0600 fix partial match counting as exact match in dmachine diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index afd0fdb..0459f2b 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -303,8 +303,6 @@ static dm_match_t switch_ivr_dmachine_check_match(switch_ivr_dmachine_t *dmachin if (is_timeout) { if (both_bp) { r_bp = exact_bp ? exact_bp : both_bp; - } else if (partial_bp) { - r_bp = partial_bp; } } commit 430dfdacabcb07feb4f4c1aa6ad5a57e97a3e250 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Dec 27 09:27:21 2010 -0600 revert change based on reports of bad audio diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 2370e70..fef64d5 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -2500,10 +2500,8 @@ static void conference_loop_output(conference_member_t *member) use_buffer = NULL; mux_used = (uint32_t) switch_buffer_inuse(member->mux_buffer); - if (mux_used < bytes * 2) { - use_timer = 1; - } - + use_timer = 1; + if (mux_used) { if (mux_used < bytes) { if (++low_count >= 5) { commit 7f81c3cc3c44ecba08bf58d219740190de3f55e9 Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Mon Dec 27 07:49:24 2010 -0600 skypopen: OSS driver, added some code from /dev/zero to read(), and performances are better diff --git a/src/mod/endpoints/mod_skypopen/oss/main.c b/src/mod/endpoints/mod_skypopen/oss/main.c index a96e38d..10a210a 100644 --- a/src/mod/endpoints/mod_skypopen/oss/main.c +++ b/src/mod/endpoints/mod_skypopen/oss/main.c @@ -249,6 +249,7 @@ static ssize_t skypopen_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos) { DEFINE_WAIT(wait); + size_t written; struct skypopen_dev *dev = filp->private_data; if(unload) @@ -273,8 +274,31 @@ static ssize_t skypopen_read(struct file *filp, char __user *buf, size_t count, prepare_to_wait(&dev->inq, &wait, TASK_INTERRUPTIBLE); schedule(); finish_wait(&dev->inq, &wait); - return count; + if (!count) + return 0; + + if (!access_ok(VERIFY_WRITE, buf, count)) + return -EFAULT; + + written = 0; + while (count) { + unsigned long unwritten; + size_t chunk = count; + + if (chunk > PAGE_SIZE) + chunk = PAGE_SIZE; /* Just for latency reasons */ + unwritten = __clear_user(buf, chunk); + written += chunk - unwritten; + if (unwritten) + break; + if (signal_pending(current)) + return written ? written : -ERESTARTSYS; + buf += chunk; + count -= chunk; + cond_resched(); + } + return written ? written : -EFAULT; } static ssize_t skypopen_write(struct file *filp, const char __user *buf, size_t count, commit 4e95227f39b3af92e03eab1e7808eb2d031dbdff Author: Jeff Lenk <jeff@jefflenk.com> Date: Sun Dec 26 09:09:14 2010 -0600 windows build fix for last commit diff --git a/libs/win32/libg722_1/libg722_1.vcproj b/libs/win32/libg722_1/libg722_1.vcproj index e3101a2..a7a9530 100644 --- a/libs/win32/libg722_1/libg722_1.vcproj +++ b/libs/win32/libg722_1/libg722_1.vcproj @@ -342,6 +342,10 @@ RelativePath="..\..\libg722_1\src\tables.c" > </File> + <File + RelativePath="..\..\libg722_1\src\utilities.c" + > + </File> </Filter> <Filter Name="Header Files" @@ -388,6 +392,10 @@ RelativePath="..\..\libg722_1\src\tables.h" > </File> + <File + RelativePath="..\..\libg722_1\src\utilities.h" + > + </File> </Filter> <Filter Name="Resource Files" diff --git a/libs/win32/libg722_1/libg722_1.vcxproj b/libs/win32/libg722_1/libg722_1.vcxproj index 5dd165a..5ec3101 100644 --- a/libs/win32/libg722_1/libg722_1.vcxproj +++ b/libs/win32/libg722_1/libg722_1.vcxproj @@ -131,6 +131,7 @@ <ClCompile Include="..\..\libg722_1\src\huff_tab.c" /> <ClCompile Include="..\..\libg722_1\src\sam2coef.c" /> <ClCompile Include="..\..\libg722_1\src\tables.c" /> + <ClCompile Include="..\..\libg722_1\src\utilities.c" /> </ItemGroup> <ItemGroup> <ClInclude Include="..\..\libg722_1\src\basop32.h" /> @@ -143,6 +144,7 @@ <ClInclude Include="..\..\libg722_1\src\huff_tab.h" /> <ClInclude Include="..\..\libg722_1\src\sam2coef.h" /> <ClInclude Include="..\..\libg722_1\src\tables.h" /> + <ClInclude Include="..\..\libg722_1\src\utilities.h" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/libs/win32/libg722_1/libg722_1.vcxproj.filters b/libs/win32/libg722_1/libg722_1.vcxproj.filters index 855a60f..d54ad6e 100644 --- a/libs/win32/libg722_1/libg722_1.vcxproj.filters +++ b/libs/win32/libg722_1/libg722_1.vcxproj.filters @@ -60,6 +60,9 @@ <ClCompile Include="..\..\libg722_1\src\tables.c"> <Filter>Source Files</Filter> </ClCompile> + <ClCompile Include="..\..\libg722_1\src\utilities.c"> + <Filter>Source Files</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="..\..\libg722_1\src\basop32.h"> @@ -92,5 +95,8 @@ <ClInclude Include="..\..\libg722_1\src\tables.h"> <Filter>Header Files</Filter> </ClInclude> + <ClInclude Include="..\..\libg722_1\src\utilities.h"> + <Filter>Header Files</Filter> + </ClInclude> </ItemGroup> </Project> \ No newline at end of file commit 93630948e4efac18ad3f065365831a3cdb7407bd Author: Steve Underwood <steveu@coppice.org> Date: Sun Dec 26 13:41:06 2010 +0800 Missed a file in the previous update diff --git a/libs/libg722_1/g722_1.pc.in b/libs/libg722_1/g722_1.pc.in new file mode 100644 index 0000000..0fc01fb --- /dev/null +++ b/libs/libg722_1/g722_1.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: spandsp +Description: A library for the ITU G.722.1 and G.722.1C audio codecs. +Requires: +Version: @VERSION@ +Libs: -L${libdir} -lg722_1 -lm +Cflags: -I${includedir} commit 5d5485708d614c16740b48919f85dafc014cd14f Author: Steve Underwood <steveu@coppice.org> Date: Sun Dec 26 13:25:03 2010 +0800 A bunch of tweaks to the G.722.1 codec diff --git a/libs/libg722_1/Makefile.am b/libs/libg722_1/Makefile.am index f815fb8..9d88533 100644 --- a/libs/libg722_1/Makefile.am +++ b/libs/libg722_1/Makefile.am @@ -15,8 +15,6 @@ ## 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., 675 Mass Ave, Cambridge, MA 02139, USA. -## -## $Id: Makefile.am,v 1.6 2008/09/30 14:06:39 steveu Exp $ AM_CFLAGS = $(COMP_VENDOR_CFLAGS) AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) @@ -26,6 +24,7 @@ noinst_SCRIPTS = g722_1.spec MAINTAINERCLEANFILES = Makefile.in EXTRA_DIST = autogen.sh \ + g722_1.pc \ g722_1.spec \ unpack_g722_1_data.sh \ wrapper.xsl \ @@ -50,6 +49,9 @@ SUBDIRS = src $(MAYBE_DOC) $(MAYBE_TESTS) DIST_SUBDIRS = src doc tests test-data +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = g722_1.pc + faq: faq.xml cd faq ; xsltproc ../wrapper.xsl ../faq.xml diff --git a/libs/libg722_1/autogen.sh b/libs/libg722_1/autogen.sh index 96422db..98fb7e4 100755 --- a/libs/libg722_1/autogen.sh +++ b/libs/libg722_1/autogen.sh @@ -16,11 +16,6 @@ # 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., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# $Id: autogen.sh,v 1.1.1.1 2008/09/20 09:47:17 steveu Exp $ -# - -UNAME=`uname` if [ "x$UNAME" = "xFreeBSD" ]; then echo "" diff --git a/libs/libg722_1/configure.ac b/libs/libg722_1/configure.ac index 64e276b..62095ce 100644 --- a/libs/libg722_1/configure.ac +++ b/libs/libg722_1/configure.ac @@ -15,17 +15,11 @@ # 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., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# $Id: configure.ac,v 1.9 2008/10/09 14:17:12 steveu Exp $ # @start 1 AC_INIT -CFLAGS="$CFLAGS $CONFIGURE_CFLAGS" -CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS" -LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS" - m4_include(config/ax_compiler_vendor.m4) m4_include(config/ax_check_real_file.m4) m4_include(config/ax_fixed_point_machine.m4) @@ -111,6 +105,22 @@ else CXXFLAGS=${CXXFLAGS-"-g -O2"} fi +AC_DEFUN([REMOVE_FROM_VAR],[ + new_val="" + removed=0 + for i in $$1; do + if test "x$i" != "x$2"; then + new_val="$new_val $i" + else + removed=1 + fi + done + if test $removed = "1"; then + echo " removed \"$2\" from $1" + $1=$new_val + fi +]) + AC_C_CONST AC_C_INLINE AC_C_VOLATILE @@ -190,7 +200,7 @@ AC_CHECK_HEADERS([audiofile.h]) AC_LANG([C]) -if test "${build}" = "${host}" +if test "${build}" == "${host}" then case "${host}" in x86_64-*) @@ -270,6 +280,7 @@ sun) COMP_VENDOR_CFLAGS="-native -fast $COMP_VENDOR_CFLAGS" fi COMP_VENDOR_LDFLAGS= + REMOVE_FROM_VAR(CFLAGS, -Xc) ;; *) COMP_VENDOR_CFLAGS="-std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes" @@ -293,20 +304,14 @@ AM_CONDITIONAL([COND_SSE5], [test "$enable_sse5" = yes]) if test "$enable_fixed_point" = "yes" ; then AC_DEFINE([G722_1_USE_FIXED_POINT], [1], [Enable fixed point processing, where possible, instead of floating point]) G722_1_USE_FIXED_POINT="#define G722_1_USE_FIXED_POINT 1" - fixed = "yes" G722_1_VECTORS_FOR_TESTS="fixed" else AX_FIXED_POINT_MACHINE([$host], - [ - AC_DEFINE([G722_1_USE_FIXED_POINT], [1], [Enable fixed point processing, where possible, instead of floating point]) - G722_1_USE_FIXED_POINT="#define G722_1_USE_FIXED_POINT 1" - fixed = "yes" - ], + [AC_DEFINE([G722_1_USE_FIXED_POINT], [1], [Enable fixed point processing, where possible, instead of floating point]) + G722_1_USE_FIXED_POINT="#define G722_1_USE_FIXED_POINT 1"], [G722_1_USE_FIXED_POINT="#undef G722_1_USE_FIXED_POINT"]) G722_1_VECTORS_FOR_TESTS="floating" fi -AM_CONDITIONAL([COND_FIXED], [test "$fixed" = "yes"]) - AX_MISALIGNED_ACCESS_FAILS([$host], [AC_DEFINE([G722_1_MISALIGNED_ACCESS_FAILS], [1], [Do not expect a misaligned memory access to work correctly]) G722_1_MISALIGNED_ACCESS_FAILS="#define G722_1_MISALIGNED_ACCESS_FAILS 1"], @@ -363,6 +368,7 @@ AC_CONFIG_FILES([Makefile src/Makefile src/g722_1.h tests/Makefile + g722_1.pc g722_1.spec]) AC_CONFIG_FILES([tests/regression_tests.sh], [chmod +x tests/regression_tests.sh]) diff --git a/libs/libg722_1/doc/Makefile.am b/libs/libg722_1/doc/Makefile.am index 4e58bbd..a56809d 100644 --- a/libs/libg722_1/doc/Makefile.am +++ b/libs/libg722_1/doc/Makefile.am @@ -15,8 +15,6 @@ ## 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., 675 Mass Ave, Cambridge, MA 02139, USA. -## -## $Id: Makefile.am,v 1.1.1.1 2008/09/20 09:47:17 steveu Exp $ MAINTAINERCLEANFILES = Makefile.in diff --git a/libs/libg722_1/g722_1.spec.in b/libs/libg722_1/g722_1.spec.in index db1d06a..0c2b26d 100644 --- a/libs/libg722_1/g722_1.spec.in +++ b/libs/libg722_1/g722_1.spec.in @@ -47,14 +47,13 @@ rm -rf %{buildroot} %{_libdir}/libg722_1.so.* -%{_datadir}/libg722_1 - %files devel %defattr(-,root,root,-) %doc doc/api %{_includedir}/g722_1.h %{_includedir}/g722_1 %{_libdir}/libg722_1.so +%{_libdir}/pkgconfig/g722_1.pc %post -p /sbin/ldconfig diff --git a/libs/libg722_1/src/Makefile.am b/libs/libg722_1/src/Makefile.am index 1943658..8600e92 100644 --- a/libs/libg722_1/src/Makefile.am +++ b/libs/libg722_1/src/Makefile.am @@ -15,18 +15,19 @@ ## 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., 675 Mass Ave, Cambridge, MA 02139, USA. -## -## $Id: Makefile.am,v 1.10 2008/10/16 15:46:12 steveu Exp $ AM_CFLAGS = $(COMP_VENDOR_CFLAGS) AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) MAINTAINERCLEANFILES = Makefile.in -EXTRA_DIST = g722_1/version.h.in \ +EXTRA_DIST = make_tables.c \ + g722_1/version.h.in \ libg722_1.dsp \ - libg722_1.sln \ - libg722_1.vcproj \ + libg722_1.2005.sln \ + libg722_1.2008.sln \ + libg722_1.2005.vcproj \ + libg722_1.2008.vcproj \ msvc/gettimeofday.c \ msvc/inttypes.h \ msvc/tgmath.h \ @@ -36,13 +37,16 @@ EXTRA_DIST = g722_1/version.h.in \ msvc/msvcproj.head \ msvc/msvcproj.foot \ msvc/vc8proj.head \ - msvc/vc8proj.foot + msvc/vc8proj.foot \ + msvc/vc9proj.head \ + msvc/vc9proj.foot INCLUDES = -I$(top_builddir) lib_LTLIBRARIES = libg722_1.la -libg722_1_la_SOURCES = bitstream.c \ +libg722_1_la_SOURCES = basop32.c \ + bitstream.c \ coef2sam.c \ common.c \ commonf.c \ @@ -55,11 +59,9 @@ libg722_1_la_SOURCES = bitstream.c \ encoderf.c \ huff_tab.c \ sam2coef.c \ - tables.c + tables.c \ + utilities.c -if COND_FIXED -libg722_1_la_SOURCES += basop32.c -endif libg722_1_la_LDFLAGS = -version-info @G722_1_LT_CURRENT@:@G722_1_LT_REVISION@:@G722_1_LT_AGE@ $(COMP_VENDOR_LDFLAGS) nobase_include_HEADERS = g722_1/g722_1.h \ @@ -76,10 +78,10 @@ noinst_HEADERS = basop32.h \ defs.h \ huff_tab.h \ sam2coef.h \ - tables.h + tables.h \ + utilities.h -noinst_PROGRAMS = make_dct4_tables \ - make_tables +noinst_PROGRAMS = make_dct4_tables dct4.$(OBJEXT): dct4.h @@ -88,6 +90,9 @@ dct4.lo: dct4.h dct4.h: make_dct4_tables$(EXEEXT) ./make_dct4_tables$(EXEEXT) >dct4.h +make_dct4_tables$(EXEEXT): $(top_srcdir)/src/make_dct4_tables.c + $(CC_FOR_BUILD) -o make_dct4_tables$(EXEEXT) $(top_srcdir)/src/make_dct4_tables.c -DHAVE_CONFIG_H -I$(top_builddir)/src -lm + #coef2sam.h: make_tables$(EXEEXT) # ./make_tables$(EXEEXT) coef2sam >coef2samx.h @@ -95,13 +100,15 @@ dct4.h: make_dct4_tables$(EXEEXT) # ./make_tables$(EXEEXT) sam2coef >sam2coefx.h DSP = libg722_1.dsp -VCPROJ = libg722_1.vcproj +VCPROJ8 = libg722_1.2005.vcproj +VCPROJ9 = libg722_1.2008.vcproj WIN32SOURCES = $(libg722_1_la_SOURCES) msvc/gettimeofday.c WIN32HEADERS = $(nobase_include_HEADERS) g722_1.h DSPOUT = | awk '{printf("%s\r\n", $$0)}' >> $(DSP) -VCPROJOUT = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ) +VCPROJOUT8 = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ8) +VCPROJOUT9 = | awk '{printf("%s\r\n", $$0)}' >> $(VCPROJ9) $(DSP): msvc/msvcproj.head msvc/msvcproj.foot Makefile.am echo "creating $(DSP)" @@ -124,26 +131,38 @@ $(DSP): msvc/msvcproj.head msvc/msvcproj.foot Makefile.am echo "# End Group" $(DSPOUT); \ cat $(srcdir)/msvc/msvcproj.foot $(DSPOUT) ) -$(VCPROJ): msvc/vc8proj.head msvc/vc8proj.foot Makefile.am - echo "creating $(VCPROJ)" - @(cp $(srcdir)/msvc/vc8proj.head $(VCPROJ); \ +$(VCPROJ8): msvc/vc8proj.head msvc/vc8proj.foot Makefile.am + echo "creating $(VCPROJ8)" + @(cp $(srcdir)/msvc/vc8proj.head $(VCPROJ8); \ for file in $(WIN32SOURCES); do \ - echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT); \ + myfile=`echo $$file | sed -e 's|/|\\\\|g'`; \ + echo "<File RelativePath=\""$$myfile"\"></File>" $(VCPROJOUT8); \ done; \ - echo "</Filter><Filter Name=\"Header Files\">" $(VCPROJOUT); \ + echo "</Filter><Filter Name=\"Header Files\">" $(VCPROJOUT8); \ for file in $(WIN32HEADERS); do \ - echo "<File RelativePath=\""$$file"\"></File>" $(VCPROJOUT); \ + myfile=`echo $$file | sed -e 's|/|\\\\|g'`; \ + echo "<File RelativePath=\""$$myfile"\"></File>" $(VCPROJOUT8); \ done; \ - cat $(srcdir)/msvc/vc8proj.foot $(VCPROJOUT) ) + cat $(srcdir)/msvc/vc8proj.foot $(VCPROJOUT8) ) -g722_1/version.h: - NOWDATE=`date --utc +"%Y%m%d"` ; \ - NOWTIME=`date --utc +"%H%M%S"` ; \ - sed 's/$$G722_1_RELEASE_DATE/'$$NOWDATE'/;s/$$G722_1_RELEASE_TIME/'$$NOWTIME'/' \ - <g722_1/version.h.in >g722_1/version.h +$(VCPROJ9): msvc/vc9proj.head msvc/vc9proj.foot Makefile.am + echo "creating $(VCPROJ9)" + @(cp $(srcdir)/msvc/vc9proj.head $(VCPROJ9); \ + for file in $(WIN32SOURCES); do \ + myfile=`echo $$file | sed -e 's|/|\\\\|g'`; \ + echo "<File RelativePath=\""$$myfile"\"></File>" $(VCPROJOUT9); \ + done; \ + echo "</Filter><Filter Name=\"Header Files\">" $(VCPROJOUT9); \ + for file in $(WIN32HEADERS); do \ + myfile=`echo $$file | sed -e 's|/|\\\\|g'`; \ + echo "<File RelativePath=\""$$myfile"\"></File>" $(VCPROJOUT9); \ + done; \ + cat $(srcdir)/msvc/vc9proj.foot $(VCPROJOUT9) ) + +dist-hook: g722_1/version.h -dist-hook: +g722_1/version.h: NOWDATE=`date --utc +"%Y%m%d"` ; \ NOWTIME=`date --utc +"%H%M%S"` ; \ sed 's/$$G722_1_RELEASE_DATE/'$$NOWDATE'/;s/$$G722_1_RELEASE_TIME/'$$NOWTIME'/' \ - <g722_1/version.h.in >g722_1/version.h + <$(srcdir)/g722_1/version.h.in >$@ diff --git a/libs/libg722_1/src/basop32.c b/libs/libg722_1/src/basop32.c index 54220f4..210e129 100644 --- a/libs/libg722_1/src/basop32.c +++ b/libs/libg722_1/src/basop32.c @@ -9,8 +9,6 @@ * 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. - * - * $Id: basop32.c,v 1.5 2008/09/22 13:08:31 steveu Exp $ */ /*! \file */ diff --git a/libs/libg722_1/src/basop32.h b/libs/libg722_1/src/basop32.h index abc105f..36dae35 100644 --- a/libs/libg722_1/src/basop32.h +++ b/libs/libg722_1/src/basop32.h @@ -6,14 +6,12 @@ * Adapted by Steve Underwood <steveu@coppice.org> from the reference * code supplied with ITU G.722.1, which is: * - * © 2004 Polycom, Inc. + * (C) 2004 Polycom, Inc. * All rights reserved. * * 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. - * - * $Id: basop32.h,v 1.3 2008/09/22 13:08:31 steveu Exp $ */ #if !defined(BASOP32_H_DEFINED) @@ -104,14 +102,14 @@ static __inline__ int32_t L_mac(int32_t L_var3, int16_t var1, int16_t var2) } /*- End of function --------------------------------------------------------*/ -int16_t shl(int16_t var1, int16_t var2); /* Short shift left, 1 */ -int16_t shr(int16_t var1, int16_t var2); /* Short shift right, 1 */ -int32_t L_sub(int32_t L_var1, int32_t L_var2); /* Long sub, 2 */ -int32_t L_shl(int32_t L_var1, int16_t var2); /* Long shift left, 2 */ -int32_t L_shr(int32_t L_var1, int16_t var2); /* Long shift right, 2*/ -int16_t norm_s(int16_t var1); /* Short norm, 15 */ -int16_t div_s(int16_t var1, int16_t var2); /* Short division, 18 */ -int16_t norm_l(int32_t L_var1); /* Long norm, 30 */ +int16_t shl(int16_t var1, int16_t var2); /* Short shift left, 1 */ +int16_t shr(int16_t var1, int16_t var2); /* Short shift right, 1 */ +int32_t L_sub(int32_t L_var1, int32_t L_var2); /* Long sub, 2 */ +int32_t L_shl(int32_t L_var1, int16_t var2); /* Long shift left, 2 */ +int32_t L_shr(int32_t L_var1, int16_t var2); /* Long shift right, 2 */ +int16_t norm_s(int16_t var1); /* Short norm, 15 */ +int16_t div_s(int16_t var1, int16_t var2); /* Short division, 18 */ +int16_t norm_l(int32_t L_var1); /* Long norm, 30 */ #endif diff --git a/libs/libg722_1/src/bitstream.c b/libs/libg722_1/src/bitstream.c index ddaabd0..016ab8e 100644 --- a/libs/libg722_1/src/bitstream.c +++ b/libs/libg722_1/src/bitstream.c @@ -8,8 +8,6 @@ * 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. - * - * $Id: bitstream.c,v 1.2 2008/10/17 13:18:21 steveu Exp $ */ /*! \file */ diff --git a/libs/libg722_1/src/bitstream.h b/libs/libg722_1/src/bitstream.h index 20e3865..f2cc4b8 100644 --- a/libs/libg722_1/src/bitstream.h +++ b/libs/libg722_1/src/bitstream.h @@ -8,8 +8,6 @@ * 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. - * - * $Id: bitstream.h,v 1.2 2008/10/17 13:18:21 steveu Exp $ */ /*! \file */ diff --git a/libs/libg722_1/src/coef2sam.c b/libs/libg722_1/src/coef2sam.c index 38d4943..19f5a21 100644 --- a/libs/libg722_1/src/coef2sam.c +++ b/libs/libg722_1/src/coef2sam.c @@ -6,14 +6,12 @@ * Adapted by Steve Underwood <steveu@coppice.org> from the reference * code supplied with ITU G.722.1, which is: * - * © 2004 Polycom, Inc. + * (C) 2004 Polycom, Inc. * All rights reserved. * * 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. - * - * $Id: coef2sam.c,v 1.10 2008/10/02 11:43:54 steveu Exp $ */ /*! \file */ @@ -29,18 +27,16 @@ #include "defs.h" #include "coef2sam.h" +#include "utilities.h" -/************************************************************************************* - - Purpose: Convert Reversed MLT (Modulated Lapped Transform) Coefficients to Samples +/* Convert Reversed MLT (Modulated Lapped Transform) Coefficients to Samples - The "Reversed MLT" is an overlapped block transform which uses even symmetry - on the left, odd symmetry on the right and a Type IV DCT as the block transform. - It is thus similar to a MLT which uses odd symmetry on the left, even symmetry - on the right and a Type IV DST as the block transform. In fact, it is equivalent - to reversing the order of the samples, performing an MLT and then negating all - the even-numbered coefficients. -***************************************************************************/ + The "Reversed MLT" is an overlapped block transform which uses even symmetry + on the left, odd symmetry on the right and a Type IV DCT as the block transform. + It is thus similar to a MLT which uses odd symmetry on the left, even symmetry + on the right and a Type IV DST as the block transform. In fact, it is equivalent + to reversing the order of the samples, performing an MLT and then negating all + the even-numbered coefficients. */ #if defined(G722_1_USE_FIXED_POINT) void rmlt_coefs_to_samples(int16_t coefs[], @@ -73,29 +69,23 @@ void rmlt_coefs_to_samples(int16_t coefs[], new_samples[i] = shl(new_samples[i], mag_shift); } - if (dct_length == DCT_LENGTH) - win = rmlt_to_samples_window; - else - win = max_rmlt_to_samples_window; + win = (dct_length == DCT_LENGTH) ? rmlt_to_samples_window : max_rmlt_to_samples_window; last = half_dct_length - 1; for (i = 0; i < half_dct_length; i++) { /* Get the first half of the windowed samples */ - sum = 0L; - sum = L_mac(sum, win[i], new_samples[last - i]); + sum = L_mult(win[i], new_samples[last - i]); sum = L_mac(sum, win[dct_length - i - 1], old_samples[i]); out_samples[i] = xround(L_shl(sum, 2)); /* Get the second half of the windowed samples */ - sum = 0L; - sum = L_mac(sum, win[half_dct_length + i], new_samples[i]); + sum = L_mult(win[half_dct_length + i], new_samples[i]); sum = L_mac(sum, negate(win[last - i]), old_samples[last - i]); out_samples[half_dct_length + i] = xround(L_shl(sum, 2)); } /* Save the second half of the new samples for next time, when they will be the old samples. */ - for (i = 0; i < half_dct_length; i++) - old_samples[i] = new_samples[half_dct_length + i]; + vec_copyi16(old_samples, &new_samples[half_dct_length], half_dct_length); } /*- End of function --------------------------------------------------------*/ #else @@ -116,10 +106,7 @@ void rmlt_coefs_to_samples(float coefs[], /* Perform a Type IV (inverse) DCT on the coefficients */ dct_type_iv(coefs, new_samples, dct_length); - if (dct_length == DCT_LENGTH) - win = rmlt_to_samples_window; - else - win = max_rmlt_to_samples_window; + win = (dct_length == DCT_LENGTH) ? rmlt_to_samples_window : max_rmlt_to_samples_window; last = half_dct_length - 1; for (i = 0; i < half_dct_length; i++) { @@ -135,8 +122,7 @@ void rmlt_coefs_to_samples(float coefs[], /* Save the second half of the new samples for next time, when they will be the old samples. */ - for (i = 0; i < half_dct_length; i++) - old_samples[i] = new_samples[half_dct_length + i]; + vec_copyf(old_samples, &new_samples[half_dct_length], half_dct_length); } /*- End of function --------------------------------------------------------*/ #endif diff --git a/libs/libg722_1/src/coef2sam.h b/libs/libg722_1/src/coef2sam.h index 731d28d..2159076 100644 --- a/libs/libg722_1/src/coef2sam.h +++ b/libs/libg722_1/src/coef2sam.h @@ -6,14 +6,12 @@ * Adapted by Steve Underwood <steveu@coppice.org> from the reference * code supplied with ITU G.722.1, which is: * - * © 2004 Polycom, Inc. + * (C) 2004 Polycom, Inc. * All rights reserved. * * 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. - * - * $Id: coef2sam.h,v 1.2 2008/10/02 11:43:54 steveu Exp $ */ #if defined(G722_1_USE_FIXED_POINT) diff --git a/libs/libg722_1/src/common.c b/libs/libg722_1/src/common.c index 46f6595..b763a84 100644 --- a/libs/libg722_1/src/common.c +++ b/libs/libg722_1/src/common.c @@ -6,14 +6,12 @@ * Adapted by Steve Underwood <steveu@coppice.org> from the reference * code supplied with ITU G.722.1, which is: * - * © 2004 Polycom, Inc. + * (C) 2004 Polycom, Inc. * All rights reserved. * * 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. - * - * $Id: common.c,v 1.6 2008/09/30 14:06:39 steveu Exp $ */ /*! \file */ @@ -38,41 +36,7 @@ static void compute_raw_pow_categories(int16_t *power_categories, int16_t number_of_regions, int16_t offset); -/**************************************************************************************** - Function: categorize - - Syntax: void categorize(int16_t number_of_available_bits, - int16_t number_of_regions, - int16_t num_categorization_control_possibilities, - int16_t rms_index, - int16_t power_categories, - int16_t category_balances) - - inputs: number_of_regions - num_categorization_control_possibilities - number_of_available_bits - rms_index[MAX_NUMBER_OF_REGIONS] - - outputs: power_categories[MAX_NUMBER_OF_REGIONS] - category_balances[MAX_NUM_CATEGORIZATION_CONTROL_POSSIBILITIES-1] - - Description: Computes a series of categorizations - - WMOPS: 7kHz | 24kbit | 32kbit - -------|--------------|---------------- - AVG | 0.14 | 0.14 - -------|--------------|---------------- - MAX | 0.15 | 0.15 - -------|--------------|---------------- - - 14kHz | 24kbit | 32kbit | 48kbit - -------|--------------|----------------|---------------- - AVG | 0.42 | 0.45 | 0.48 - -------|--------------|----------------|---------------- - MAX | 0.47 | 0.52 | 0.52 - -------|--------------|----------------|---------------- - -****************************************************************************************/ +/* Compute a series of categorizations */ void categorize(int16_t number_of_available_bits, int16_t number_of_regions, int16_t num_categorization_control_possibilities, @@ -88,10 +52,7 @@ void categorize(int16_t number_of_available_bits, /* At higher bit rates, there is an increase for most categories in average bit consumption per region. We compensate for this by pretending we have fewer available bits. */ - if (number_of_regions == NUMBER_OF_REGIONS) - frame_size = DCT_LENGTH; - else - frame_size = MAX_DCT_LENGTH; + frame_size = (number_of_regions == NUMBER_OF_REGIONS) ? DCT_LENGTH : MAX_DCT_LENGTH; temp = sub(number_of_available_bits, frame_size); if (temp > 0) @@ -114,45 +75,7 @@ void categorize(int16_t number_of_available_bits, } /*- End of function --------------------------------------------------------*/ -/*************************************************************************** - Function: comp_powercat_and_catbalance - - Syntax: void comp_powercat_and_catbalance(int16_t *power_categories, - int16_t *category_balances, - int16_t *rms_index, - int16_t number_of_available_bits, - int16_t number_of_regions, - int16_t num_categorization_control_possibilities, - int16_t offset) - - - inputs: *rms_index - number_of_available_bits - number_of_regions - num_categorization_control_possibilities - offset - - outputs: *power_categories - *category_balances - - - Description: Computes the power_categories and the category balances - - WMOPS: 7kHz | 24kbit | 32kbit - -------|--------------|---------------- - AVG | 0.10 | 0.10 - -------|--------------|---------------- - MAX | 0.11 | 0.11 - -------|--------------|---------------- - - 14kHz | 24kbit | 32kbit | 48kbit - -------|--------------|----------------|---------------- - AVG | 0.32 | 0.35 | 0.38 - -------|--------------|----------------|---------------- - MAX | 0.38 | 0.42 | 0.43 - -------|--------------|----------------|---------------- - -***************************************************************************/ +/* Compute the power_categories and the category balances */ void comp_powercat_and_catbalance(int16_t *power_categories, int16_t *category_balances, int16_t *rms_index, @@ -161,7 +84,6 @@ void comp_powercat_and_catbalance(int16_t *power_categories, int16_t num_categorization_control_possibilities, int16_t offset) { - int16_t expected_number_of_code_bits; int16_t region; int16_t max_region; @@ -190,7 +112,6 @@ void comp_powercat_and_catbalance(int16_t *power_categories, for (region = 0; region < number_of_regions; region++) expected_number_of_code_bits = add(expected_number_of_code_bits, expected_bits_table[power_categories[region]]); - for (region = 0; region < number_of_regions; region++) { max_rate_categories[region] = power_categories[region]; @@ -277,42 +198,16 @@ void comp_powercat_and_catbalance(int16_t *power_categories, } /*- End of function --------------------------------------------------------*/ -/*************************************************************************** - Function: calc_offset - - Syntax: offset=calc_offset(int16_t *rms_index,int16_t number_of_regions,int16_t available_bits) - - input: int16_t *rms_index - int16_t number_of_regions - int16_t available_bits - - output: int16_t offset - - Description: Calculates the the category offset. This is the shift required - To get the most out of the number of available bits. A binary - type search is used to find the offset. - - WMOPS: 7kHz | 24kbit | 32kbit - -------|--------------|---------------- - AVG | 0.04 | 0.04 - -------|--------------|---------------- - MAX | 0.04 | 0.04 - -------|--------------|---------------- - - 14kHz | 24kbit | 32kbit | 48kbit - -------|--------------|----------------|---------------- - AVG | 0.08 | 0.08 | 0.08 - -------|--------------|----------------|---------------- - MAX | 0.09 | 0.09 | 0.09 - -------|--------------|----------------|---------------- - -***************************************************************************/ -int16_t calc_offset(int16_t *rms_index,int16_t number_of_regions,int16_t available_bits) +/* Calculate the the category offset. This is the shift required + To get the most out of the number of available bits. A binary + type search is used to find the offset. */ +int16_t calc_offset(int16_t *rms_index, int16_t number_of_regions, int16_t available_bits) { int16_t answer; int16_t delta; int16_t test_offset; - int16_t region,j; + int16_t region; + int16_t j; int16_t power_cats[MAX_NUMBER_OF_REGIONS]; int16_t bits; int16_t offset; @@ -360,40 +255,9 @@ int16_t calc_offset(int16_t *rms_index,int16_t number_of_regions,int16_t availab } /*- End of function --------------------------------------------------------*/ -/*************************************************************************** - Function: compute_raw_pow_categories - - Syntax: void compute_raw_pow_categories(int16_t *power_categories, - int16_t *rms_index, - int16_t number_of_regions, - int16_t offset) - inputs: *rms_index - number_of_regions - offset - - outputs: *power_categories - - - - Description: This function computes the power categories given the offset - This is kind of redundant since they were already computed - in calc_offset to determine the offset. - - WMOPS: | 24kbit | 32kbit - -------|--------------|---------------- - AVG | 0.01 | 0.01 - -------|--------------|---------------- - MAX | 0.01 | 0.01 - -------|--------------|---------------- - - 14kHz | 24kbit | 32kbit | 48kbit - -------|--------------|----------------|---------------- - AVG | 0.01 | 0.01 | 0.01 - -------|--------------|----------------|---------------- - MAX | 0.01 | 0.01 | 0.01 - -------|--------------|----------------|---------------- - -***************************************************************************/ +/* Compute the power categories given the offset + This is kind of redundant since they were already computed + in calc_offset to determine the offset. */ static void compute_raw_pow_categories(int16_t *power_categories, int16_t *rms_index, int16_t number_of_regions, int16_t offset) { int16_t region; diff --git a/libs/libg722_1/src/commonf.c b/libs/libg722_1/src/commonf.c index dd2050a..d86d1cf 100644 --- a/libs/libg722_1/src/commonf.c +++ b/libs/libg722_1/src/commonf.c @@ -6,14 +6,12 @@ * Adapted by Steve Underwood <steveu@coppice.org> from the reference * code supplied with ITU G.722.1, which is: * - * © 2004 Polycom, Inc. + * (C) 2004 Polycom, Inc. * All rights reserved. * * 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. - * - * $Id: commonf.c,v 1.11 2008/09/30 14:06:39 steveu Exp $ */ /*! \file */ @@ -34,9 +32,7 @@ #if !defined(G722_1_USE_FIXED_POINT) -/**************************************************************************************** - Description: Computes a series of categorizations -****************************************************************************************/ +/* Compute a series of categorizations */ void categorize(int number_of_regions, int number_of_available_bits, int rms_index[MAX_NUMBER_OF_REGIONS], diff --git a/libs/libg722_1/src/dct4.c b/libs/libg722_1/src/dct4.c index cb3a7fd..9f0a61d 100644 --- a/libs/libg722_1/src/dct4.c +++ b/libs/libg722_1/src/dct4.c @@ -6,14 +6,12 @@ * Adapted by Steve Underwood <steveu@coppice.org> from the reference * code supplied with ITU G.722.1, which is: * - * © 2004 Polycom, Inc. + * (C)2004 Polycom, Inc. * All rights reserved. * * 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. - * - * $Id: dct4.c,v 1.8 2008/09/29 16:09:26 steveu Exp $ */ #if defined(HAVE_CONFIG_H) @@ -29,6 +27,7 @@ #include "g722_1/g722_1.h" #include "defs.h" +#include "utilities.h" #if !defined(G722_1_USE_FIXED_POINT) @@ -52,9 +51,7 @@ static const cos_msin_t *cos_msin_table[] = cos_msin_640 }; -/********************************************************************************* - Description: Discrete Cosine Transform, Type IV -*********************************************************************************/ +/* Discrete Cosine Transform, Type IV */ void dct_type_iv(float input[], float output[], int dct_length) { float buffer_a[MAX_DCT_LENGTH]; @@ -64,22 +61,20 @@ void dct_type_iv(float input[], float output[], int dct_length) float *in_ptr_low; float *in_ptr_high; float *next_in_base; - float *out_ptr_low; - float *out_ptr_high; + float *out_ptr; float *next_out_base; float *out_buffer; float *in_buffer; float *buffer_swap; float *fptr0; - const float *fptr2; - const float *core_a; float in_val_low; float in_val_high; float cos_even; float cos_odd; float msin_even; float msin_odd; - float sum; + const float *fptr2; + const float *core_a; const cos_msin_t **table_ptr_ptr; const cos_msin_t *cos_msin_ptr; int set_span; @@ -120,29 +115,24 @@ void dct_type_iv(float input[], float output[], int dct_length) for (sets_left = set_count; sets_left > 0; sets_left--) { /* Set up output pointers for the current set */ - out_ptr_low = next_out_base; + out_ptr = next_out_base; next_out_base += set_span; - out_ptr_high = next_out_base; /* Loop over all the butterflies in the current set */ - do + for (i = 0; i < (set_span >> 1); i++) { in_val_low = *in_ptr++; in_val_high = *in_ptr++; - *out_ptr_low++ = in_val_low + in_val_high; - *--out_ptr_high = in_val_low - in_val_high; + out_ptr[i] = in_val_low + in_val_high; + out_ptr[set_span - 1 - i] = in_val_low - in_val_high; } - while (out_ptr_low < out_ptr_high); } /* Decide which buffers to use as input and output next time. Except for the first time (when the input buffer is the subroutine input) we just alternate the local buffers. */ in_buffer = out_buffer; - if (out_buffer == buffer_a) - out_buffer = buffer_b; - else - out_buffer = buffer_a; + out_buffer = (out_buffer == buffer_a) ? buffer_b : buffer_a; } /* Do dct_size/10 ten-point transforms */ @@ -153,11 +143,8 @@ void dct_type_iv(float input[], float output[], int dct_length) fptr2 = core_a; for (k = 0; k < CORE_SIZE; k++) { - sum = 0; - for (i = 0; i < CORE_SIZE; i++) - sum += fptr0[i]*fptr2[i]; + buffer_swap[k] = vec_dot_prodf(fptr0, fptr2, CORE_SIZE); fptr2 += CORE_SIZE; - buffer_swap[k] = sum; } fptr0 += CORE_SIZE; buffer_swap += CORE_SIZE; @@ -172,14 +159,10 @@ void dct_type_iv(float input[], float output[], int dct_length) { /* Initialization for the loop over sets at the current size */ set_span = dct_length >> set_count_log; - set_count = 1 << set_count_log; next_in_base = in_buffer; - if (set_count_log == 0) - next_out_base = output; - else - next_out_base = out_buffer; - ++table_ptr_ptr; + next_out_base = (set_count_log == 0) ? output : out_buffer; + table_ptr_ptr++; /* Loop over all the sets of this size */ for (sets_left = set_count; sets_left > 0; sets_left--) @@ -187,26 +170,23 @@ void dct_type_iv(float input[], float output[], int dct_length) /* Set up the pointers for the current set */ in_ptr_low = next_in_base; in_ptr_high = in_ptr_low + (set_span >> 1); - next_in_base += set_span; - out_ptr_low = next_out_base; - next_out_base += set_span; - out_ptr_high = next_out_base; + out_ptr = next_out_base; cos_msin_ptr = *table_ptr_ptr; /* Loop over all the butterfly pairs in the current set */ - do + for (i = 0; i < (set_span >> 1); i += 2) { - cos_even = (*cos_msin_ptr).cosine; - msin_even = (*cos_msin_ptr++).minus_sine; - *out_ptr_low++ = cos_even * *in_ptr_low - msin_even * *in_ptr_high; - *--out_ptr_high = msin_even * *in_ptr_low++ + cos_even * *in_ptr_high++; - - cos_odd = (*cos_msin_ptr).cosine; - msin_odd = (*cos_msin_ptr++).minus_sine; - *out_ptr_low++ = cos_odd * *in_ptr_low + msin_odd * *in_ptr_high; - *--out_ptr_high = msin_odd * *in_ptr_low++ - cos_odd * *in_ptr_high++; + cos_even = cos_msin_ptr[i].cosine; + msin_even = cos_msin_ptr[i].minus_sine; + cos_odd = cos_msin_ptr[i + 1].cosine; + msin_odd = cos_msin_ptr[i + 1].minus_sine; + out_ptr[i] = cos_even*in_ptr_low[i] - msin_even*in_ptr_high[i]; + out_ptr[set_span - 1 - i] = msin_even*in_ptr_low[i] + cos_even*in_ptr_high[i]; + out_ptr[i + 1] = cos_odd*in_ptr_low[i + 1] + msin_odd*in_ptr_high[i + 1]; + out_ptr[set_span - 2 - i] = msin_odd*in_ptr_low[i + 1] - cos_odd*in_ptr_high[i + 1]; } - while (out_ptr_low < out_ptr_high); + next_in_base += set_span; + next_out_base += set_span; } /* Swap input and output buffers for next time */ diff --git a/libs/libg722_1/src/dct4_a.c b/libs/libg722_1/src/dct4_a.c index 0f9c90e..d4ed150 100644 --- a/libs/libg722_1/src/dct4_a.c +++ b/libs/libg722_1/src/dct4_a.c @@ -6,29 +6,23 @@ * Adapted by Steve Underwood <steveu@coppice.org> from the reference * code supplied with ITU G.722.1, which is: * - * © 2004 Polycom, Inc. + * (C) 2004 Polycom, Inc. * All rights reserved. * * 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. - * - * $Id: dct4_a.c,v 1.8 2008/09/30 14:06:39 steveu Exp $ */ -/********************************************************************************* -* Filename: dct_type_iv_a.c -* -* Purpose: Discrete Cosine Transform, Type IV used for MLT -* -* The basis functions are -* -* cos(PI*(t+0.5)*(k+0.5)/block_length) -* -* for time t and basis function number k. Due to the symmetry of the expression -* in t and k, it is clear that the forward and inverse transforms are the same. -* -*********************************************************************************/ +/* Discrete Cosine Transform, Type IV used for MLT + + The basis functions are + + cos(PI*(t+0.5)*(k+0.5)/block_length) + + for time t and basis function number k. Due to the symmetry of the + expression in t and k, it is clear that the forward and inverse transforms + are the same. */ /*! \file */ @@ -47,51 +41,31 @@ #include "dct4_a.h" -/********************************************************************************* - Function: dct_type_iv_a - - Syntax: void dct_type_iv_a (input, output, dct_length) - int16_t input[], output[], dct_length; - - Description: Discrete Cosine Transform, Type IV used for MLT -*********************************************************************************/ - +/* Discrete Cosine Transform, Type IV used for MLT */ void dct_type_iv_a(int16_t input[], int16_t output[], int dct_length) { int16_t buffer_a[MAX_DCT_LENGTH]; int16_t buffer_b[MAX_DCT_LENGTH]; int16_t buffer_c[MAX_DCT_LENGTH]; int16_t *in_ptr; - int16_t *in_ptr_low; - int16_t *in_ptr_high; - int16_t *next_in_base; - int16_t *out_ptr_low; - int16_t *out_ptr_high; - int16_t *next_out_base; - int16_t *out_buffer; + int16_t *out_ptr; int16_t *in_buffer; + int16_t *out_buffer; int16_t *buffer_swap; int16_t in_val_low; int16_t in_val_high; - int16_t out_val_low; - int16_t out_val_high; int16_t in_low_even; int16_t in_low_odd; int16_t in_high_even; int16_t in_high_odd; - int16_t out_low_even; - int16_t out_low_odd; - int16_t out_high_even; - int16_t out_high_odd; int16_t *pair_ptr; int16_t cos_even; int16_t cos_odd; int16_t msin_even; int16_t msin_odd; - int16_t neg_cos_odd; - int16_t neg_msin_even; int32_t sum; int16_t set_span; + int16_t half_span; int16_t set_count; int16_t set_count_log; int16_t pairs_left; @@ -99,15 +73,15 @@ void dct_type_iv_a(int16_t input[], int16_t output[], int dct_length) int16_t i; int16_t k; int16_t index; - const cos_msin_t **table_ptr_ptr; - const cos_msin_t *cos_msin_ptr; int16_t temp; int32_t acca; int16_t dct_length_log; + const cos_msin_t **table_ptr_ptr; + const cos_msin_t *cos_msin_ptr; - /* Do the sum/difference butterflies, the first part of */ - /* converting one N-point transform into N/2 two-point */ - /* transforms, where N = 1 << DCT_LENGTH_LOG. = 64/128 */ + /* Do the sum/difference butterflies, the first part of + converting one N-point transform into N/2 two-point + transforms, where N = 1 << DCT_LENGTH_LOG. = 64/128 */ if (dct_length == DCT_LENGTH) { dct_length_log = DCT_LENGTH_LOG; @@ -123,62 +97,45 @@ void dct_type_iv_a(int16_t input[], int16_t output[], int dct_length) index = 0L; in_buffer = input; out_buffer = buffer_a; - temp = sub(dct_length_log, 2); + temp = dct_length_log - 2; for (set_count_log = 0; set_count_log <= temp; set_count_log++) { - /* Initialization for the loop over sets at the current size */ - /* set_span = 1 << (DCT_LENGTH_LOG - set_count_log); */ - set_span = shr(dct_length, set_count_log); - - set_count = shl(1, set_count_log); + /* Loop over all the sets at the current size */ + set_span = dct_length >> set_count_log; + set_count = 1 << set_count_log; + half_span = set_span >> 1; in_ptr = in_buffer; - next_out_base = out_buffer; + out_ptr = out_buffer; - /* Loop over all the sets of this size */ for (sets_left = set_count; sets_left > 0; sets_left--) { - /* Set up output pointers for the current set */ - out_ptr_low = next_out_base; - next_out_base = next_out_base + set_span; - out_ptr_high = next_out_base; - /* Loop over all the butterflies in the current set */ - do + for (i = 0; i < half_span; i++) { - in_val_low = *in_ptr++; - in_val_high = *in_ptr++; - acca = L_add(in_val_low, in_val_high); - acca = L_shr(acca, 1); - out_val_low = (int16_t) acca; + in_val_low = *in_ptr++; + in_val_high = *in_ptr++; - acca = L_sub(in_val_low, in_val_high); - acca = L_shr(acca, 1); - out_val_high = (int16_t) acca; + acca = L_add(in_val_low, in_val_high); + out_ptr[i] = (int16_t) L_shr(acca, 1); - *out_ptr_low++ = out_val_low; - *--out_ptr_high = out_val_high; + acca = L_sub(in_val_low, in_val_high); + out_ptr[set_span - 1 - i] = (int16_t) L_shr(acca, 1); } - while (out_ptr_low < out_ptr_high); + out_ptr += set_span; } - /* Decide which buffers to use as input and output next time. */ - /* Except for the first time (when the input buffer is the */ - /* subroutine input) we just alternate the local buffers. */ + /* Decide which buffers to use as input and output next time. + Except for the first time (when the input buffer is the + subroutine input) we just alternate the local buffers. */ in_buffer = out_buffer; - if (out_buffer == buffer_a) - out_buffer = buffer_b; - else - out_buffer = buffer_a; + out_buffer = (out_buffer == buffer_a) ? buffer_b : buffer_a; index = add(index, 1); } - /* Do N/2 two-point transforms, */ - /* where N = 1 << DCT_LENGTH_LOG */ + /* Do N/2 two-point transforms, where N = 1 << DCT_LENGTH_LOG */ pair_ptr = in_buffer; buffer_swap = buffer_c; - temp = sub(dct_length_log, 1); - temp = shl(1, temp); - + temp = 1 << (dct_length_log - 1); for (pairs_left = temp; pairs_left > 0; pairs_left--) { for (k = 0; k < CORE_SIZE; k++) @@ -188,7 +145,6 @@ void dct_type_iv_a(int16_t input[], int16_t output[], int dct_length) sum = L_mac(sum, pair_ptr[i], dct_core_a[i][k]); buffer_swap[k] = xround(sum); } - /* Address arithmetic */ pair_ptr += CORE_SIZE; buffer_swap += CORE_SIZE; } @@ -202,77 +158,53 @@ void dct_type_iv_a(int16_t input[], int16_t output[], int dct_length) temp = sub(dct_length_log, 2); for (set_count_log = temp; set_count_log >= 0; set_count_log--) { - /* Initialization for the loop over sets at the current size */ - /* set_span = 1 << (DCT_LENGTH_LOG - set_count_log); */ - set_span = shr(dct_length, set_count_log); - set_count = shl(1, set_count_log); - next_in_base = in_buffer; - next_out_base = (set_count_log == 0) ? output : out_buffer; + /* Loop over all the sets at the current size */ + set_span = dct_length >> set_count_log; + set_count = 1 << set_count_log; + half_span = set_span >> 1; + in_ptr = in_buffer; + out_ptr = (set_count_log == 0) ? output : out_buffer; + cos_msin_ptr = *table_ptr_ptr++; - /* Loop over all the sets of this size */ for (sets_left = set_count; sets_left > 0; sets_left--) { - /* Set up the pointers for the current set */ - in_ptr_low = next_in_base; - temp = shr(set_span, 1); - - /* Address arithmetic */ - in_ptr_high = in_ptr_low + temp; - next_in_base += set_span; - out_ptr_low = next_out_base; - next_out_base += set_span; - out_ptr_high = next_out_base; - cos_msin_ptr = *table_ptr_ptr; - /* Loop over all the butterfly pairs in the current set */ - do + for (i = 0; i < half_span; i += 2) { - /* Address arithmetic */ - in_low_even = *in_ptr_low++; - in_low_odd = *in_ptr_low++; - in_high_even = *in_ptr_high++; - in_high_odd = *in_ptr_high++; - cos_even = cos_msin_ptr[0].cosine; - msin_even = cos_msin_ptr[0].minus_sine; - cos_odd = cos_msin_ptr[1].cosine; - msin_odd = cos_msin_ptr[1].minus_sine; - cos_msin_ptr += 2; + in_low_even = in_ptr[i]; + in_low_odd = in_ptr[i + 1]; + in_high_even = in_ptr[half_span + i]; + in_high_odd = in_ptr[half_span + i + 1]; - sum = 0L; - sum = L_mac(sum, cos_even, in_low_even); - neg_msin_even = negate(msin_even); - sum = L_mac(sum, neg_msin_even, in_high_even); - out_low_even = xround(sum); + cos_even = cos_msin_ptr[i].cosine; + msin_even = cos_msin_ptr[i].minus_sine; + cos_odd = cos_msin_ptr[i + 1].cosine; + msin_odd = cos_msin_ptr[i + 1].minus_sine; - sum = 0L; - sum = L_mac(sum, msin_even,in_low_even); + sum = L_mult(cos_even, in_low_even); + sum = L_mac(sum, -msin_even, in_high_even); + out_ptr[i] = xround(sum); + + sum = L_mult(msin_even,in_low_even); sum = L_mac(sum, cos_even, in_high_even); - out_high_even = xround(sum); + out_ptr[set_span - 1 - i] = xround(sum); - sum = 0L; - sum = L_mac(sum, cos_odd, in_low_odd); + sum = L_mult(cos_odd, in_low_odd); sum = L_mac(sum, msin_odd, in_high_odd); - out_low_odd = xround(sum); - - sum = 0L; - sum = L_mac(sum, msin_odd, in_low_odd); - neg_cos_odd = negate(cos_odd); - sum = L_mac(sum, neg_cos_odd, in_high_odd); - out_high_odd = xround(sum); + out_ptr[i + 1] = xround(sum); - *out_ptr_low++ = out_low_even; - *--out_ptr_high = out_high_even; - *out_ptr_low++ = out_low_odd; - *--out_ptr_high = out_high_odd; + sum = L_mult(msin_odd, in_low_odd); + sum = L_mac(sum, -cos_odd, in_high_odd); + out_ptr[set_span - 2 - i] = xround(sum); } - while (out_ptr_low < out_ptr_high); + in_ptr += set_span; + out_ptr += set_span; } /* Swap input and output buffers for next time */ buffer_swap = in_buffer; in_buffer = out_buffer; out_buffer = buffer_swap; - table_ptr_ptr++; } } /*- End of function --------------------------------------------------------*/ diff --git a/libs/libg722_1/src/dct4_a.h b/libs/libg722_1/src/dct4_a.h index bcc63bf..4d4b95c 100644 --- a/libs/libg722_1/src/dct4_a.h +++ b/libs/libg722_1/src/dct4_a.h @@ -6,14 +6,12 @@ * Adapted by Steve Underwood <steveu@coppice.org> from the reference * code supplied with ITU G.722.1, which is: * - * © 2004 Polycom, Inc. + * (C) 2004 Polycom, Inc. * All rights reserved. * * 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. - * - * $Id: dct4_a.h,v 1.4 2008/09/25 15:56:31 steveu Exp $ */ typedef struct diff --git a/libs/libg722_1/src/dct4_s.c b/libs/libg722_1/src/dct4_s.c index 71151b3..c195693 100644 --- a/libs/libg722_1/src/dct4_s.c +++ b/libs/libg722_1/src/dct4_s.c @@ -6,29 +6,23 @@ * Adapted by Steve Underwood <steveu@coppice.org> from the reference * code supplied with ITU G.722.1, which is: * - * © 2004 Polycom, Inc. + * (C) 2004 Polycom, Inc. * All rights reserved. * * 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. - * - * $Id: dct4_s.c,v 1.8 2008/09/30 14:06:39 steveu Exp $ */ -/******************************************************************************** -* Filename: dct_type_iv_s.c -* -* Purpose: Discrete Cosine Transform, Type IV used for inverse MLT -* -* The basis functions are -* -* cos(PI*(t+0.5)*(k+0.5)/block_length) -* -* for time t and basis function number k. Due to the symmetry of the expression -* in t and k, it is clear that the forward and inverse transforms are the same. -* -*********************************************************************************/ +/* Discrete Cosine Transform, Type IV used for inverse MLT + + The basis functions are + + cos(PI*(t+0.5)*(k+0.5)/block_length) + + for time t and basis function number k. Due to the symmetry of the + expression in t and k, it is clear that the forward and inverse transforms + are the same. */ /*! \file */ @@ -45,67 +39,51 @@ #if defined(G722_1_USE_FIXED_POINT) #include "dct4_s.h" +#include "utilities.h" -/******************************************************************************** - Function: dct_type_iv_s - - Syntax: void dct_type_iv_s (int16_t *input,int16_t *output,int16_t dct_length) - - - Description: Discrete Cosine Transform, Type IV used for inverse MLT -********************************************************************************/ +/* Discrete Cosine Transform, Type IV used for inverse MLT */ void dct_type_iv_s(int16_t input[], int16_t output[], int dct_length) { int16_t buffer_a[MAX_DCT_LENGTH]; int16_t buffer_b[MAX_DCT_LENGTH]; int16_t buffer_c[MAX_DCT_LENGTH]; int16_t *in_ptr; - int16_t *in_ptr_low; - int16_t *in_ptr_high; - int16_t *next_in_base; - int16_t *out_ptr_low; - int16_t *out_ptr_high; - int16_t *next_out_base; - int16_t *out_buffer; + int16_t *out_ptr; int16_t *in_buffer; + int16_t *out_buffer; int16_t *buffer_swap; int16_t in_val_low; int16_t in_val_high; - int16_t out_val_low; - int16_t out_val_high; int16_t in_low_even; int16_t in_low_odd; int16_t in_high_even; int16_t in_high_odd; - int16_t out_low_even; - int16_t out_low_odd; - int16_t out_high_even; - int16_t out_high_odd; int16_t *pair_ptr; int16_t cos_even; int16_t cos_odd; int16_t msin_even; int16_t msin_odd; int16_t set_span; + int16_t half_span; int16_t set_count; int16_t set_count_log; int16_t pairs_left; int16_t sets_left; int16_t i; + int16_t j; int16_t k; int16_t index; int16_t dummy; + int16_t dct_length_log; int32_t sum; + int32_t acca; const cos_msin_t **table_ptr_ptr; const cos_msin_t *cos_msin_ptr; - int32_t acca; - int16_t temp; - int16_t dct_length_log; const int16_t *dither_ptr; - /* Do the sum/difference butterflies, the first part of */ - /* converting one N-point transform into 32 - 10 point transforms */ - /* transforms, where N = 1 << DCT_LENGTH_LOG. */ + /* Do the sum/difference butterflies, the first part of + converting one N-point transform into 32 - 10 point transforms + transforms, where N = 1 << DCT_LENGTH_LOG. */ if (dct_length == DCT_LENGTH) { dct_length_log = DCT_LENGTH_LOG; @@ -122,92 +100,61 @@ void dct_type_iv_s(int16_t input[], int16_t output[], int dct_length) index = 0; i = 0; + j = 0; for (set_count_log = 0; set_count_log <= dct_length_log - 2; set_count_log++) { - /* Initialization for the loop over sets at the current size */ - /* set_span = 1 << (DCT_LENGTH_LOG - set_count_log); */ - set_span = shr(dct_length, set_count_log); - - set_count = shl(1, set_count_log); + /* Loop over all the sets at the current size */ + set_span = dct_length >> set_count_log; + set_count = 1 << set_count_log; + half_span = set_span >> 1; in_ptr = in_buffer; - next_out_base = out_buffer; + out_ptr = out_buffer; - /* Loop over all the sets of this size */ - temp = sub(index, 1); - if (temp < 0) + if (index < 1) { for (sets_left = set_count; sets_left > 0; sets_left--) { - /* Set up output pointers for the current set */ - /* pointer arithmetic */ - out_ptr_low = next_out_base; - next_out_base += set_span; - out_ptr_high = next_out_base; - /* Loop over all the butterflies in the current set */ - do + for (i = 0; i < half_span; i++) { in_val_low = *in_ptr++; in_val_high = *in_ptr++; - /* BEST METHOD OF GETTING RID OF BIAS, BUT COMPUTATIONALLY UNPLEASANT */ - /* ALTERNATIVE METHOD, SMEARS BIAS OVER THE ENTIRE FRAME, COMPUTATIONALLY SIMPLEST. */ - /* IF THIS WORKS, IT'S PREFERABLE */ - - dummy = add(in_val_low, dither_ptr[i++]); + dummy = add(in_val_low, dither_ptr[j++]); acca = L_add(dummy, in_val_high); - out_val_low = (int16_t) L_shr(acca, 1); - - dummy = add(in_val_low, dither_ptr[i++]); - acca = L_add(dummy, -in_val_high); - out_val_high = (int16_t) L_shr(acca, 1); - - *out_ptr_low++ = out_val_low; - *--out_ptr_high = out_val_high; + out_ptr[i] = (int16_t) L_shr(acca, 1); - /* this involves comparison of pointers */ - /* pointer arithmetic */ + dummy = add(in_val_low, dither_ptr[j++]); + acca = L_sub(dummy, in_val_high); + out_ptr[set_span - 1 - i] = (int16_t) L_shr(acca, 1); } - while (out_ptr_low < out_ptr_high); + out_ptr += set_span; } } else { for (sets_left = set_count; sets_left > 0; sets_left--) { - /* Set up output pointers for the current set */ - out_ptr_low = next_out_base; - next_out_base += set_span; - out_ptr_high = next_out_base; - /* Loop over all the butterflies in the current set */ - do + for (i = 0; i < half_span; i++) { in_val_low = *in_ptr++; in_val_high = *in_ptr++; - out_val_low = add(in_val_low, in_val_high); - out_val_high = add(in_val_low, negate(in_val_high)); - - *out_ptr_low++ = out_val_low; - *--out_ptr_high = out_val_high; + out_ptr[i] = add(in_val_low, in_val_high); + out_ptr[set_span - 1 - i] = sub(in_val_low, in_val_high); } - while (out_ptr_low < out_ptr_high); + out_ptr += set_span; } } - /* Decide which buffers to use as input and output next time. */ - /* Except for the first time (when the input buffer is the */ - /* subroutine input) we just alternate the local buffers. */ + /* Decide which buffers to use as input and output next time. + Except for the first time (when the input buffer is the + subroutine input) we just alternate the local buffers. */ in_buffer = out_buffer; - - if (out_buffer == buffer_a) - out_buffer = buffer_b; - else - out_buffer = buffer_a; - - index = add(index, 1); + out_buffer = (out_buffer == buffer_a) ? buffer_b : buffer_a; + index++; } /* Do 32 - 10 point transforms */ @@ -228,8 +175,7 @@ void dct_type_iv_s(int16_t input[], int16_t output[], int dct_length) buffer_swap += CORE_SIZE; } - for (i = 0; i < dct_length; i++) - in_buffer[i] = buffer_c[i]; + vec_copyi16(in_buffer, buffer_c, dct_length); table_ptr_ptr = s_cos_msin_table; @@ -238,90 +184,61 @@ void dct_type_iv_s(int16_t input[], int16_t output[], int dct_length) for (set_count_log = dct_length_log - 2; set_count_log >= 0; set_count_log--) { /* Initialization for the loop over sets at the current size */ - /* set_span = 1 << (DCT_LENGTH_LOG - set_count_log); */ - set_span = shr(dct_length, set_count_log); - - set_count = shl(1, set_count_log); - next_in_base = in_buffer; - if (set_count_log == 0) - next_out_base = output; - else - next_out_base = out_buffer; + set_span = dct_length >> set_count_log; + set_count = 1 << set_count_log; + half_span = set_span >> 1; + in_ptr = in_buffer; + out_ptr = (set_count_log == 0) ? output : out_buffer; + cos_msin_ptr = *table_ptr_ptr++; /* Loop over all the sets of this size */ for (sets_left = set_count; sets_left > 0; sets_left--) { - /* Set up the pointers for the current set */ - in_ptr_low = next_in_base; - temp = shr(set_span, 1); - in_ptr_high = in_ptr_low + temp; - next_in_base += set_span; - out_ptr_low = next_out_base; - next_out_base += set_span; - out_ptr_high = next_out_base; - cos_msin_ptr = *table_ptr_ptr; - /* Loop over all the butterfly pairs in the current set */ - do + for (i = 0; i < half_span; i += 2) { - in_low_even = *in_ptr_low++; - in_low_odd = *in_ptr_low++; - in_high_even = *in_ptr_high++; - in_high_odd = *in_ptr_high++; - cos_even = cos_msin_ptr[0].cosine; - msin_even = cos_msin_ptr[0].minus_sine; - cos_odd = cos_msin_ptr[1].cosine; - msin_odd = cos_msin_ptr[1].minus_sine; - cos_msin_ptr += 2; - - sum = 0L; - sum = L_mac(sum, cos_even, in_low_even); - sum = L_mac(sum, negate(msin_even), in_high_even); - out_low_even = xround(L_shl(sum, 1)); - - sum = 0L; - sum = L_mac(sum, msin_even, in_low_even); + in_low_even = in_ptr[i]; + in_low_odd = in_ptr[i + 1]; + in_high_even = in_ptr[half_span + i]; + in_high_odd = in_ptr[half_span + i + 1]; + + cos_even = cos_msin_ptr[i].cosine; + msin_even = cos_msin_ptr[i].minus_sine; + cos_odd = cos_msin_ptr[i + 1].cosine; + msin_odd = cos_msin_ptr[i + 1].minus_sine; + + sum = L_mult(cos_even, in_low_even); + sum = L_mac(sum, -msin_even, in_high_even); + out_ptr[i] = xround(L_shl(sum, 1)); + + sum = L_mult(msin_even, in_low_even); sum = L_mac(sum, cos_even, in_high_even); - out_high_even = xround(L_shl(sum, 1)); + out_ptr[set_span - 1 - i] = xround(L_shl(sum, 1)); - sum = 0L; - sum = L_mac(sum, cos_odd, in_low_odd); + sum = L_mult(cos_odd, in_low_odd); sum = L_mac(sum, msin_odd, in_high_odd); - out_low_odd = xround(L_shl(sum, 1)); + out_ptr[i + 1] = xround(L_shl(sum, 1)); - sum = 0L; - sum = L_mac(sum, msin_odd, in_low_odd); - sum = L_mac(sum, negate(cos_odd), in_high_odd); - out_high_odd = xround(L_shl(sum, 1)); - - *out_ptr_low++ = out_low_even; - *--out_ptr_high = out_high_even; - *out_ptr_low++ = out_low_odd; - *--out_ptr_high = out_high_odd; + sum = L_mult(msin_odd, in_low_odd); + sum = L_mac(sum, -cos_odd, in_high_odd); + out_ptr[set_span - 2 - i] = xround(L_shl(sum, 1)); } - while (out_ptr_low < out_ptr_high); + in_ptr += set_span; + out_ptr += set_span; } /* Swap input and output buffers for next time */ buffer_swap = in_buffer; in_buffer = out_buffer; out_buffer = buffer_swap; - - index = add(index, 1); - table_ptr_ptr++; + index++; } - /* ADD IN BIAS FOR OUTPUT */ + /* Add in bias for output */ if (dct_length == DCT_LENGTH) { - for (i = 0; i < 320; i++) + for (i = 0; i < DCT_LENGTH; i++) { sum = L_add(output[i], syn_bias_7khz[i]); - acca = L_sub(sum, 32767); - if (acca > 0) - sum = 32767L; - acca = L_add(sum, 32768L); - if (acca < 0) - sum = -32768L; - output[i] = (int16_t) sum; + output[i] = saturate(sum); } } } diff --git a/libs/libg722_1/src/dct4_s.h b/libs/libg722_1/src/dct4_s.h index 68040d0..533be1c 100644 --- a/libs/libg722_1/src/dct4_s.h +++ b/libs/libg722_1/src/dct4_s.h @@ -6,14 +6,12 @@ * Adapted by Steve Underwood <steveu@coppice.org> from the reference * code supplied with ITU G.722.1, which is: * - * © 2004 Polycom, Inc. + * (C) 2004 Polycom, Inc. * All rights reserved. * * 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. - * - * $Id: dct4_s.h,v 1.4 2008/09/25 15:56:31 steveu Exp $ */ typedef struct @@ -196,11 +194,9 @@ static const int16_t max_dither[MAX_DCT_LENGTH] = for (index = 0;index < length;index++) { angle = scale * ((double)index + 0.5); - table[index].cosine = (short) (FTOI((18427)* cos(angle))); - table[index].minus_sine = (short) (FTOI((18427)*(-sin(angle)))); + table[index].cosine = (int16_t) (FTOI((18427)* cos(angle))); + table[index].minus_sine = (int16_t) (FTOI((18427)*(-sin(angle)))); } - - ********************************************************************************/ static const cos_msin_t s_cos_msin_2[DCT_LENGTH_DIV_32] = diff --git a/libs/libg722_1/src/decoder.c b/libs/libg722_1/src/decoder.c index 80fcab4..f1db32f 100644 --- a/libs/libg722_1/src/decoder.c +++ b/libs/libg722_1/src/decoder.c @@ -6,14 +6,12 @@ * Adapted by Steve Underwood <steveu@coppice.org> from the reference * code supplied with ITU G.722.1, which is: * - * © 2004 Polycom, Inc. + * (C)2004 Polycom, Inc. * All rights reserved. * * 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. - * - * $Id: decoder.c,v 1.21 2008/11/21 15:30:22 steveu Exp $ */ /*! \file */ @@ -94,9 +92,7 @@ static void decoder(g722_1_decode_state_t *s, int16_t old_decoder_mlt_coefs[], int frame_error_flag); -/*************************************************************************** - Description: Decodes the out_words into mlt coefs using G.722.1 Annex C -***************************************************************************/ +/* Decodes the out_words into MLT coefs using G.722.1 Annex C */ void decoder(g722_1_decode_state_t *s, int16_t number_of_regions, int16_t decoder_mlt_coefs[], @@ -109,11 +105,11 @@ void decoder(g722_1_decode_state_t *s, int16_t absolute_region_power_index[MAX_NUMBER_OF_REGIONS]; int16_t decoder_power_categories[MAX_NUMBER_OF_REGIONS]; int16_t decoder_category_balances[MAX_NUM_CATEGORIZATION_CONTROL_POSSIBILITIES - 1]; - uint16_t categorization_control; int16_t num_categorization_control_bits; int16_t num_categorization_control_possibilities; int16_t number_of_coefs; int16_t number_of_valid_coefs; + uint16_t categorization_control; number_of_valid_coefs = number_of_regions*REGION_SIZE; @@ -184,9 +180,7 @@ void decoder(g722_1_decode_state_t *s, } /*- End of function --------------------------------------------------------*/ -/*************************************************************************** - Description: Recover differential_region_power_index from code bits -***************************************************************************/ +/* Recover differential_region_power_index from code bits */ static void decode_envelope(g722_1_decode_state_t *s, int16_t number_of_regions, int16_t *decoder_region_standard_deviation, @@ -262,7 +256,7 @@ static void decode_envelope(g722_1_decode_state_t *s, while ((i >= 0) && ((temp1 >= 0) || (temp2 > 0))) { i = sub(i, 1); - temp = shr(temp, 1); + temp >>= 1; max_index = sub(max_index, 2); temp1 = sub(temp, 8); temp2 = sub(max_index, 28); @@ -365,12 +359,12 @@ static void decode_vector_quantized_mlt_indices(g722_1_decode_state_t *s, if (g722_1_bitstream_get(&s->bitstream, &(s->code_ptr), 1) == 0) { temp = shl(index, 1); - index = (int16_t) *(decoder_table_ptr + temp); + index = decoder_table_ptr[temp]; } else { temp = shl(index, 1); - index = (int16_t) *(decoder_table_ptr + temp + 1); + index = decoder_table_ptr[temp + 1]; } s->number_of_bits_left--; } @@ -406,7 +400,7 @@ static void decode_vector_quantized_mlt_indices(g722_1_decode_state_t *s, { if ((signs_index & bit) == 0) decoder_mlt_value = negate(decoder_mlt_value); - bit = shr(bit, 1); + bit >>= 1; } *decoder_mlt_ptr++ = decoder_mlt_value; } @@ -440,7 +434,7 @@ static void decode_vector_quantized_mlt_indices(g722_1_decode_state_t *s, if (*decoder_mlt_ptr == 0) { *decoder_mlt_ptr = ((random_word & 1) == 0) ? noifillneg : noifillpos; - random_word = shr(random_word, 1); + random_word >>= 1; } /* pointer arithmetic */ decoder_mlt_ptr++; @@ -451,7 +445,7 @@ static void decode_vector_quantized_mlt_indices(g722_1_decode_state_t *s, if (*decoder_mlt_ptr == 0) { *decoder_mlt_ptr = ((random_word & 1) == 0) ? noifillneg : noifillpos; - random_word = shr(random_word,1); + random_word >>= 1; } /* pointer arithmetic */ decoder_mlt_ptr++; diff --git a/libs/libg722_1/src/decoderf.c b/libs/libg722_1/src/decoderf.c index 761a0cf..e0e8e61 100644 --- a/libs/libg722_1/src/decoderf.c +++ b/libs/libg722_1/src/decoderf.c @@ -6,14 +6,12 @@ * Adapted by Steve Underwood <steveu@coppice.org> from the reference * code supplied with ITU G.722.1, which is: * - * © 2004 Polycom, Inc. + * (C) 2004 Polycom, Inc. * All rights reserved. * * 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. - * - * $Id: decoderf.c,v 1.22 2008/11/21 15:30:22 steveu Exp $ */ /*! \file */ @@ -33,6 +31,7 @@ #include "huff_tab.h" #include "tables.h" #include "bitstream.h" +#include "utilities.h" #if !defined(G722_1_USE_FIXED_POINT) @@ -84,12 +83,12 @@ static void decoder(g722_1_decode_state_t *s, int absolute_region_power_index[MAX_NUMBER_OF_REGIONS]; int decoder_power_categories[MAX_NUMBER_OF_REGIONS]; int decoder_category_balances[MAX_NUM_CATEGORIZATION_CONTROL_POSSIBILITIES - 1]; - int rate_control; int num_categorization_control_bits; int num_categorization_control_possibilities; int number_of_coefs; int number_of_valid_coefs; int rmlt_scale_factor; + int rate_control; number_of_valid_coefs = s->number_of_regions*REGION_SIZE; @@ -451,7 +450,7 @@ static void decode_vector_quantized_mlt_indices(g722_1_decode_state_t *s, if (category == NUM_CATEGORIES - 1) { - noifillpos = standard_deviation*0.70711f; + noifillpos = standard_deviation*0.70711; noifillneg = -noifillpos; /* This assumes region_size = 20 */ @@ -555,27 +554,21 @@ static void error_handling(int number_of_coefs, float *decoder_mlt_coefs, float *old_decoder_mlt_coefs) { - int i; - /* If both the current and previous frames are errored, set the mlt coefficients to 0. If only the current frame is errored, repeat the previous frame's MLT coefficients. */ if (*frame_error_flag) { - for (i = 0; i < number_of_valid_coefs; i++) - decoder_mlt_coefs[i] = old_decoder_mlt_coefs[i]; - for (i = 0; i < number_of_valid_coefs; i++) - old_decoder_mlt_coefs[i] = 0.0f; + vec_copyf(decoder_mlt_coefs, old_decoder_mlt_coefs, number_of_valid_coefs); + vec_zerof(old_decoder_mlt_coefs, number_of_valid_coefs); } else { /* Store in case the next frame has errors. */ - for (i = 0; i < number_of_valid_coefs; i++) - old_decoder_mlt_coefs[i] = decoder_mlt_coefs[i]; + vec_copyf(old_decoder_mlt_coefs, decoder_mlt_coefs, number_of_valid_coefs); } /* Zero out the upper 1/8 of the spectrum. */ - for (i = number_of_valid_coefs; i < number_of_coefs; i++) - decoder_mlt_coefs[i] = 0.0f; + vec_zerof(&decoder_mlt_coefs[number_of_valid_coefs], number_of_coefs - number_of_valid_coefs); } /*- End of function --------------------------------------------------------*/ diff --git a/libs/libg722_1/src/defs.h b/libs/libg722_1/src/defs.h index 7a565d0..9c2c83d 100644 --- a/libs/libg722_1/src/defs.h +++ b/libs/libg722_1/src/defs.h @@ -6,14 +6,12 @@ * Adapted by Steve Underwood <steveu@coppice.org> from the reference * code supplied with ITU G.722.1, which is: * - * © 2004 Polycom, Inc. + * (C) 2004 Polycom, Inc. * All rights reserved. * * 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. - * - * $Id: defs.h,v 1.16 2008/10/01 15:31:10 steveu Exp $ */ #define MAX(a,b) (a > b ? a : b) diff --git a/libs/libg722_1/src/encoder.c b/libs/libg722_1/src/encoder.c index fef4b44..054d6b3 100644 --- a/libs/libg722_1/src/encoder.c +++ b/libs/libg722_1/src/encoder.c @@ -6,14 +6,12 @@ * Adapted by Steve Underwood <steveu@coppice.org> from the reference * code supplied with ITU G.722.1, which is: * - * © 2004 Polycom, Inc. + * (C) 2004 Polycom, Inc. * All rights reserved. * * 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. - * - * $Id: encoder.c,v 1.26 2008/11/21 15:30:22 steveu Exp $ */ /*! \file */ @@ -32,6 +30,7 @@ #include "huff_tab.h" #include "tables.h" #include "bitstream.h" +#include "utilities.h" #if defined(G722_1_USE_FIXED_POINT) @@ -99,9 +98,8 @@ static void bits_to_words(g722_1_encode_state_t *s, drp_num_bits[number_of_regions] = num_categorization_control_bits; drp_code_bits[number_of_regions] = categorization_control; - bit_count = 0; /* These code bits are right justified. */ - for (region = 0; region <= number_of_regions; region++) + for (bit_count = 0, region = 0; region <= number_of_regions; region++) { g722_1_bitstream_put(&s->bitstream, &out_code, drp_code_bits[region], drp_num_bits[region]); bit_count += drp_num_bits[region]; @@ -247,14 +245,11 @@ void adjust_abs_region_power_index(int16_t *absolute_region_power_index, for (region = 0; region < number_of_regions; region++) { - n = sub(absolute_region_power_index[region], 39); - n = shr(n, 1); + n = sub(absolute_region_power_index[region], 39) >> 1; if (n > 0) { temp = (int16_t) L_mult0(region, REGION_SIZE); - raw_mlt_ptr = &mlt_coefs[temp]; - for (i = 0; i < REGION_SIZE; i++) { acca = L_shl(*raw_mlt_ptr, 16); @@ -264,8 +259,7 @@ void adjust_abs_region_power_index(int16_t *absolute_region_power_index, *raw_mlt_ptr++ = (int16_t) acca; } - temp = sub(absolute_region_power_index[region], shl(n, 1)); - absolute_region_power_index[region] = temp; + absolute_region_power_index[region] = sub(absolute_region_power_index[region], shl(n, 1)); } } } @@ -281,7 +275,6 @@ static int16_t compute_region_powers(int16_t *mlt_coefs, { int16_t *input_ptr; int32_t long_accumulator; - int16_t itemp1; int16_t power_shift; int16_t region; int16_t j; @@ -295,12 +288,8 @@ static int16_t compute_region_powers(int16_t *mlt_coefs, input_ptr = mlt_coefs; for (region = 0; region < number_of_regions; region++) { - long_accumulator = 0; - for (j = 0; j < REGION_SIZE; j++) - { - itemp1 = *input_ptr++; - long_accumulator = L_mac0(long_accumulator, itemp1, itemp1); - } + long_accumulator = vec_dot_prodi16(input_ptr, input_ptr, REGION_SIZE); + input_ptr += REGION_SIZE; power_shift = 0; acca = long_accumulator & 0x7FFF0000L; @@ -348,7 +337,7 @@ static int16_t compute_region_powers(int16_t *mlt_coefs, } /* The MLT is currently scaled too low by the factor - ENCODER_SCALE_FACTOR(=18318)/32768 * (1./sqrt(160). + ENCODER_SCALE_FACTOR(=18318)/32768 * (1.0/sqrt(160). This is the ninth power of 1 over the square root of 2. So later we will add ESF_ADJUSTMENT_TO_RMS_INDEX (now 9) to drp_code_bits[0]. */ @@ -520,7 +509,8 @@ static int16_t vector_huffman(int16_t category, int16_t num_vecs; int16_t kmax; int16_t kmax_plus_one; - int16_t index,signs_index; + int16_t index; + int16_t signs_index; const int16_t *bitcount_table_ptr; const uint16_t *code_table_ptr; int32_t code_bits; diff --git a/libs/libg722_1/src/encoderf.c b/libs/libg722_1/src/encoderf.c index 36a5206..2589886 100644 --- a/libs/libg722_1/src/encoderf.c +++ b/libs/libg722_1/src/encoderf.c @@ -6,14 +6,12 @@ * Adapted by Steve Underwood <steveu@coppice.org> from the reference * code supplied with ITU G.722.1, which is: * - * © 2004 Polycom, Inc. + * (C) 2004 Polycom, Inc. * All rights reserved. * * 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. - * - * $Id: encoderf.c,v 1.22 2008/11/21 15:30:22 steveu Exp $ */ /*! \file */ @@ -33,6 +31,7 @@ #include "huff_tab.h" #include "tables.h" #include "bitstream.h" +#include "utilities.h" #if !defined(G722_1_USE_FIXED_POINT) @@ -218,7 +217,6 @@ static int compute_region_powers(int number_of_regions, float *input_ptr; int iterations; float ftemp0; - float ftemp1; int index; int index_min; int index_max; @@ -230,13 +228,9 @@ static int compute_region_powers(int number_of_regions, input_ptr = mlt_coefs; for (region = 0; region < number_of_regions; region++) { - ftemp0 = 0.0f; - for (j = 0; j < REGION_SIZE; j++) - { - ftemp1 = *input_ptr++; - ftemp0 += ftemp1*ftemp1; - } + ftemp0 = vec_dot_prodf(input_ptr, input_ptr, REGION_SIZE); ftemp0 *= REGION_SIZE_INVERSE; + input_ptr += REGION_SIZE; index_min = 0; index_max = REGION_POWER_TABLE_SIZE; @@ -260,7 +254,7 @@ static int compute_region_powers(int number_of_regions, } /* The MLT is currently scaled too low by the factor - ENCODER_SCALE_FACTOR(=18318)/32768 * (1./sqrt(160). + ENCODER_SCALE_FACTOR(=18318)/32768 * (1.0/sqrt(160). This is the ninth power of 1 over the square root of 2. So later we will add ESF_ADJUSTMENT_TO_RMS_INDEX (now 9) to drp_code_bits[0]. */ @@ -448,7 +442,7 @@ static int vector_huffman(int category, number_of_non_zero = 0; for (j = 0; j < vec_dim; j++) { - k = (int) (fabs(*raw_mlt_ptr) * inv_of_step_size_times_std_dev + dead_zone[category]); + k = (int) (fabs(*raw_mlt_ptr)*inv_of_step_size_times_std_dev + dead_zone[category]); if (k != 0) { number_of_non_zero++; @@ -458,12 +452,12 @@ static int vector_huffman(int category, if (k > kmax) k = kmax; } - index = index*(kmax_plus_one) + k; + index = index*kmax_plus_one + k; raw_mlt_ptr++; } - code_bits = *(code_table_ptr + index); - number_of_code_bits = *(bitcount_table_ptr + index) + number_of_non_zero; + code_bits = code_table_ptr[index]; + number_of_code_bits = bitcount_table_ptr[index] + number_of_non_zero; number_of_region_bits += number_of_code_bits; code_bits = (code_bits << number_of_non_zero) + signs_index; diff --git a/libs/libg722_1/src/g722_1.h.in b/libs/libg722_1/src/g722_1.h.in index e4a1e41..86c0921 100644 --- a/libs/libg722_1/src/g722_1.h.in +++ b/libs/libg722_1/src/g722_1.h.in @@ -7,8 +7,6 @@ * 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. - * - * $Id: g722_1.h.in,v 1.1.1.1 2008/09/20 09:47:17 steveu Exp $ */ /*! \file */ diff --git a/libs/libg722_1/src/g722_1/g722_1.h b/libs/libg722_1/src/g722_1/g722_1.h index 3408abb..6f2a497 100644 --- a/libs/libg722_1/src/g722_1/g722_1.h +++ b/libs/libg722_1/src/g722_1/g722_1.h @@ -6,14 +6,12 @@ * Adapted by Steve Underwood <steveu@coppice.org> from the reference * code supplied with ITU G.722.1, which is: * - * © 2004 Polycom, Inc. + * (C) 2004 Polycom, Inc. * All rights reserved. * * 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. - * - * $Id: g722_1.h,v 1.14 2008/10/17 13:18:21 steveu Exp $ */ #if !defined(_G722_1_G722_1_H_) diff --git a/libs/libg722_1/src/g722_1/version.h.in b/libs/libg722_1/src/g722_1/version.h.in index f9c66d0..e825425 100644 --- a/libs/libg722_1/src/g722_1/version.h.in +++ b/libs/libg722_1/src/g722_1/version.h.in @@ -9,8 +9,6 @@ * 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. - * - * $Id: version.h.in,v 1.2 2008/09/20 16:52:51 steveu Exp $ */ #if !defined(_G722_1_VERSION_H_) diff --git a/libs/libg722_1/src/huff_tab.c b/libs/libg722_1/src/huff_tab.c index 07f5085..3583ba3 100644 --- a/libs/libg722_1/src/huff_tab.c +++ b/libs/libg722_1/src/huff_tab.c @@ -6,14 +6,12 @@ * Adapted by Steve Underwood <steveu@coppice.org> from the reference * code supplied with ITU G.722.1, which is: * - * © 2004 Polycom, Inc. + * (C) 2004 Polycom, Inc. * All rights reserved. * * 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. - * - * $Id: huff_tab.c,v 1.7 2008/09/30 14:06:40 steveu Exp $ */ /*! \file */ diff --git a/libs/libg722_1/src/huff_tab.h b/libs/libg722_1/src/huff_tab.h index a58b843..3d58962 100644 --- a/libs/libg722_1/src/huff_tab.h +++ b/libs/libg722_1/src/huff_tab.h @@ -6,14 +6,12 @@ * Adapted by Steve Underwood <steveu@coppice.org> from the reference * code supplied with ITU G.722.1, which is: * - * © 2004 Polycom, Inc. + * (C) 2004 Polycom, Inc. * All rights reserved. * * 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. - * - * $Id: huff_tab.h,v 1.4 2008/09/30 14:06:40 steveu Exp $ */ #define REGION_POWER_STEPSIZE_DB 3.010299957 diff --git a/libs/libg722_1/src/make_dct4_tables.c b/libs/libg722_1/src/make_dct4_tables.c index 015daf3..ffb4a94 100644 --- a/libs/libg722_1/src/make_dct4_tables.c +++ b/libs/libg722_1/src/make_dct4_tables.c @@ -6,14 +6,12 @@ * Adapted by Steve Underwood <steveu@coppice.org> from the reference * code supplied with ITU G.722.1, which is: * - * © 2004 Polycom, Inc. + * (C) 2004 Polycom, Inc. * All rights reserved. * * 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. - * - * $Id: make_dct4_tables.c,v 1.2 2008/10/02 11:43:54 steveu Exp $ */ /*! \file */ @@ -29,7 +27,11 @@ #include "g722_1/g722_1.h" +#if defined(PI) +#undef PI +#endif #define PI 3.141592653589793238462 + #include "defs.h" static void set_up_one_table(int length) @@ -99,6 +101,7 @@ int main(int argc, char *argv[]) for (i = 0; i <= length_log; i++) set_up_one_table(dct_size << i); + return 0; } /*- End of function --------------------------------------------------------*/ /*- End of file ------------------------------------------------------------*/ diff --git a/libs/libg722_1/src/make_tables.c b/libs/libg722_1/src/make_tables.c index d234d8a..aa6d5cb 100644 --- a/libs/libg722_1/src/make_tables.c +++ b/libs/libg722_1/src/make_tables.c @@ -6,14 +6,12 @@ * Adapted by Steve Underwood <steveu@coppice.org> from the reference * code supplied with ITU G.722.1, which is: * - * © 2004 Polycom, Inc. + * (C) 2004 Polycom, Inc. * All rights reserved. * * 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. - * - * $Id: make_tables.c,v 1.5 2008/11/21 15:30:22 steveu Exp $ */ /*! \file */ @@ -37,6 +35,7 @@ #undef PI #endif #define PI 3.141592653589793238462 + /* These may have been defined in the main header for the codec, so we clear out any pre-existing definitions here. */ #if defined(ENCODER_SCALE_FACTOR) @@ -124,7 +123,7 @@ static void generate_sam2coef_tables(void) for (i = 0; i < DCT_LENGTH; i++) { angle = (PI/2.0)*((double) i + 0.5)/(double) DCT_LENGTH; - printf(" %.15e,\n", sin(angle)); + printf(" %.15ef,\n", sin(angle)); } printf("};\n\n"); @@ -132,7 +131,7 @@ static void generate_sam2coef_tables(void) for (i = 0; i < MAX_DCT_LENGTH; i++) { angle = (PI/2.0)*((double) i + 0.5)/(double) MAX_DCT_LENGTH; - printf(" %.15le,\n", sin(angle)); + printf(" %.15ef,\n", sin(angle)); } printf("};\n\n"); @@ -180,7 +179,7 @@ static void generate_coef2sam_tables(void) for (i = 0; i < DCT_LENGTH; i++) { angle = (PI/2.0)*((double) i + 0.5)/(double) DCT_LENGTH; - printf(" %.15e,\n", sin(angle)); + printf(" %.15ef,\n", sin(angle)); } printf("};\n\n"); @@ -188,7 +187,7 @@ static void generate_coef2sam_tables(void) for (i = 0; i < MAX_DCT_LENGTH; i++) { angle = (PI/2.0)*((double) i + 0.5)/(double) MAX_DCT_LENGTH; - printf(" %.15e,\n", sin(angle)); + printf(" %.15ef,\n", sin(angle)); } printf("};\n\n"); @@ -218,7 +217,7 @@ int main(int argc, char *argv[]) for (i = 0; i < REGION_POWER_TABLE_SIZE; i++) { value = pow(10.0, 0.10*REGION_POWER_STEPSIZE_DB*(i - REGION_POWER_TABLE_NUM_NEGATIVES)); - printf(" %.15e,\n", sqrt(value)); + printf(" %.15ef,\n", sqrt(value)); } printf("};\n\n"); @@ -226,7 +225,7 @@ int main(int argc, char *argv[]) for (i = 0; i < REGION_POWER_TABLE_SIZE; i++) { value = pow(10.0, 0.10*REGION_POWER_STEPSIZE_DB*(i - REGION_POWER_TABLE_NUM_NEGATIVES)); - printf(" %.15e,\n", 1.0/sqrt(value)); + printf(" %.15ef,\n", 1.0/sqrt(value)); } printf("};\n\n"); @@ -259,14 +258,14 @@ int main(int argc, char *argv[]) printf("const float step_size[NUM_CATEGORIES] =\n{\n"); for (i = 0; i < NUM_CATEGORIES; i++) { - printf(" %.15e,\n", step_size[i]); + printf(" %.15ef,\n", step_size[i]); } printf("};\n\n"); printf("const float step_size_inverse_table[NUM_CATEGORIES] =\n{\n"); for (i = 0; i < NUM_CATEGORIES; i++) { - printf(" %.15e,\n", 1.0/step_size[i]); + printf(" %.15ef,\n", 1.0/step_size[i]); } printf("};\n\n"); @@ -275,7 +274,7 @@ int main(int argc, char *argv[]) for (i = 0; i < REGION_POWER_TABLE_SIZE; i++) { value = pow(10.0, 0.10*REGION_POWER_STEPSIZE_DB*(i - REGION_POWER_TABLE_NUM_NEGATIVES)); - printf(" %.15e,\n", value); + printf(" %.15ef,\n", value); } printf("};\n\n"); @@ -283,9 +282,10 @@ int main(int argc, char *argv[]) for (i = 0; i < REGION_POWER_TABLE_SIZE - 1; i++) { value = (float) pow(10.0, 0.10*REGION_POWER_STEPSIZE_DB*(0.5 + (i - REGION_POWER_TABLE_NUM_NEGATIVES))); - printf(" %.15e,\n", value); + printf(" %.15ef,\n", value); } printf("};\n\n"); + return 0; } /*- End of function --------------------------------------------------------*/ /*- End of file ------------------------------------------------------------*/ diff --git a/libs/libg722_1/src/sam2coef.c b/libs/libg722_1/src/sam2coef.c index 50f61d2..604c287 100644 --- a/libs/libg722_1/src/sam2coef.c +++ b/libs/libg722_1/src/sam2coef.c @@ -6,14 +6,12 @@ * Adapted by Steve Underwood <steveu@coppice.org> from the reference * code supplied with ITU G.722.1, which is: * - * © 2004 Polycom, Inc. + * (C) 2004 Polycom, Inc. * All rights reserved. * * 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. - * - * $Id: sam2coef.c,v 1.12 2008/10/02 11:43:54 steveu Exp $ */ /*! \file */ @@ -29,17 +27,16 @@ #include "defs.h" #include "sam2coef.h" +#include "utilities.h" -/************************************************************************************ - Purpose: Convert Samples to Reversed MLT (Modulated Lapped Transform) Coefficients +/* Convert Samples to Reversed MLT (Modulated Lapped Transform) Coefficients - The "Reversed MLT" is an overlapped block transform which uses even symmetry - on the left, odd symmetry on the right and a Type IV DCT as the block transform. - It is thus similar to a MLT which uses odd symmetry on the left, even symmetry - on the right and a Type IV DST as the block transform. In fact, it is equivalent - to reversing the order of the samples, performing an MLT and then negating all - the even-numbered coefficients. -***************************************************************************/ + The "Reversed MLT" is an overlapped block transform which uses even symmetry + on the left, odd symmetry on the right and a Type IV DCT as the block transform. + It is thus similar to a MLT which uses odd symmetry on the left, even symmetry + on the right and a Type IV DST as the block transform. In fact, it is equivalent + to reversing the order of the samples, performing an MLT and then negating all + the even-numbered coefficients. */ #if defined(G722_1_USE_FIXED_POINT) int16_t samples_to_rmlt_coefs(const int16_t new_samples[], @@ -62,34 +59,26 @@ int16_t samples_to_rmlt_coefs(const int16_t new_samples[], half_dct_length = dct_length >> 1; - if (dct_length == DCT_LENGTH) - win = samples_to_rmlt_window; - else - win = max_samples_to_rmlt_window; + win = (dct_length == DCT_LENGTH) ? samples_to_rmlt_window : max_samples_to_rmlt_window; /* Get the first half of the windowed samples */ last = half_dct_length - 1; for (i = 0; i < half_dct_length; i++) { - acca = 0L; - acca = L_mac(acca, win[last - i], old_samples[last - i]); + acca = L_mult(win[last - i], old_samples[last - i]); acca = L_mac(acca, win[half_dct_length + i], old_samples[half_dct_length + i]); - temp = xround(acca); - windowed_data[i] = temp; + windowed_data[i] = xround(acca); } /* Get the second half of the windowed samples */ last = dct_length - 1; for (i = 0; i < half_dct_length; i++) { - acca = 0L; - acca = L_mac(acca, win[last - i], new_samples[i]); + acca = L_mult(win[last - i], new_samples[i]); acca = L_mac(acca, negate(win[i]), new_samples[last - i]); - temp = xround(acca); - windowed_data[half_dct_length + i] = temp; + windowed_data[half_dct_length + i] = xround(acca); } /* Save the new samples for next time, when they will be the old samples. */ - for (i = 0; i < dct_length; i++) - old_samples[i] = new_samples[i]; + vec_copyi16(old_samples, new_samples, dct_length); /* Calculate how many bits to shift up the input to the DCT. */ temp1 = 0; @@ -156,10 +145,7 @@ void samples_to_rmlt_coefs(const float new_samples[], half_dct_length = dct_length >> 1; - if (dct_length == DCT_LENGTH) - win = samples_to_rmlt_window; - else - win = max_samples_to_rmlt_window; + win = (dct_length == DCT_LENGTH) ? samples_to_rmlt_window : max_samples_to_rmlt_window; /* Get the first half of the windowed samples. */ last = half_dct_length - 1; for (i = 0; i < half_dct_length; i++) @@ -177,8 +163,7 @@ void samples_to_rmlt_coefs(const float new_samples[], windowed_data[half_dct_length + i] = sum; } /* Save the new samples for next time, when they will be the old samples. */ - for (i = 0; i < dct_length; i++) - old_samples[i] = new_samples[i]; + vec_copyf(old_samples, new_samples, dct_length); /* Perform a Type IV DCT on the windowed data to get the coefficients. */ dct_type_iv(windowed_data, coefs, dct_length); diff --git a/libs/libg722_1/src/sam2coef.h b/libs/libg722_1/src/sam2coef.h index 26f3cba..1df19bb 100644 --- a/libs/libg722_1/src/sam2coef.h +++ b/libs/libg722_1/src/sam2coef.h @@ -6,14 +6,12 @@ * Adapted by Steve Underwood <steveu@coppice.org> from the reference * code supplied with ITU G.722.1, which is: * - * © 2004 Polycom, Inc. + * (C) 2004 Polycom, Inc. * All rights reserved. * * 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. - * - * $Id: sam2coef.h,v 1.2 2008/10/02 11:43:54 steveu Exp $ */ #if defined(G722_1_USE_FIXED_POINT) diff --git a/libs/libg722_1/src/tables.c b/libs/libg722_1/src/tables.c index 62a0e8d..a0eed80 100644 --- a/libs/libg722_1/src/tables.c +++ b/libs/libg722_1/src/tables.c @@ -6,14 +6,12 @@ * Adapted by Steve Underwood <steveu@coppice.org> from the reference * code supplied with ITU G.722.1, which is: * - * © 2004 Polycom, Inc. + * (C) 2004 Polycom, Inc. * All rights reserved. * * 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. - * - * $Id: tables.c,v 1.11 2008/09/30 14:06:40 steveu Exp $ */ /*! \file */ @@ -65,70 +63,70 @@ const int16_t int_region_standard_deviation_table[REGION_POWER_TABLE_SIZE] = #else const float region_standard_deviation_table[REGION_POWER_TABLE_SIZE] = { - 2.441406247570224e-04f, - 3.452669826719395e-04f, - 4.882812495545411e-04f, - 6.905339654011486e-04f, - 9.765624991900746e-04f, - 1.381067930916839e-03f, - 1.953124998542134e-03f, - 2.762135862062757e-03f, - 3.906249997408239e-03f, - 5.524271724583683e-03f, - 7.812499995464418e-03f, - 1.104854345008369e-02f, - 1.562499999222472e-02f, - 2.209708690200003e-02f, - 3.124999998704119e-02f, - 4.419417380766535e-02f, - 6.249999997926591e-02f, - 8.838834762266132e-02f, - 1.249999999688989e-01f, - 1.767766952599839e-01f, - 2.499999999585318e-01f, - 3.535533905492901e-01f, - 4.999999999585318e-01f, - 7.071067811572251e-01f, - 1.000000000000000e+00f, - 1.414213562431740e+00f, - 2.000000000165873e+00f, - 2.828427125098059e+00f, - 4.000000000663491e+00f, - 5.656854250665278e+00f, - 8.000000001990472e+00f, - 1.131370850226887e+01f, - 1.600000000530792e+01f, - 2.262741700641438e+01f, - 3.200000001326981e+01f, - 4.525483401658204e+01f, - 6.400000003184756e+01f, - 9.050966804067060e+01f, - 1.280000000743110e+02f, - 1.810193360963542e+02f, - 2.560000001698536e+02f, - 3.620386722227349e+02f, - 5.120000003821707e+02f, - 7.240773445055215e+02f, - 1.024000000849268e+03f, - 1.448154689131149e+03f, - 2.048000001868390e+03f, - 2.896309378502505e+03f, - 4.096000004076487e+03f, - 5.792618757485434e+03f, - 8.192000008832390e+03f, - 1.158523751593169e+04f, - 1.638400001902361e+04f, - 2.317047503378509e+04f, - 3.276800004076484e+04f, - 4.634095007141347e+04f, - 6.553600008696507e+04f, - 9.268190015051374e+04f, - 1.310720001848009e+05f, - 1.853638003164007e+05f, - 2.621440003913428e+05f, - 3.707276006635486e+05f, - 5.242880008261676e+05f, - 7.414552013885899e+05f + 2.441406247570224e-04, + 3.452669826719395e-04, + 4.882812495545411e-04, + 6.905339654011486e-04, + 9.765624991900746e-04, + 1.381067930916839e-03, + 1.953124998542134e-03, + 2.762135862062757e-03, + 3.906249997408239e-03, + 5.524271724583683e-03, + 7.812499995464418e-03, + 1.104854345008369e-02, + 1.562499999222472e-02, + 2.209708690200003e-02, + 3.124999998704119e-02, + 4.419417380766535e-02, + 6.249999997926591e-02, + 8.838834762266132e-02, + 1.249999999688989e-01, + 1.767766952599839e-01, + 2.499999999585318e-01, + 3.535533905492901e-01, + 4.999999999585318e-01, + 7.071067811572251e-01, + 1.000000000000000e+00, + 1.414213562431740e+00, + 2.000000000165873e+00, + 2.828427125098059e+00, + 4.000000000663491e+00, + 5.656854250665278e+00, + 8.000000001990472e+00, + 1.131370850226887e+01, + 1.600000000530792e+01, + 2.262741700641438e+01, + 3.200000001326981e+01, + 4.525483401658204e+01, + 6.400000003184756e+01, + 9.050966804067060e+01, + 1.280000000743110e+02, + 1.810193360963542e+02, + 2.560000001698536e+02, + 3.620386722227349e+02, + 5.120000003821707e+02, + 7.240773445055215e+02, + 1.024000000849268e+03, + 1.448154689131149e+03, + 2.048000001868390e+03, + 2.896309378502505e+03, + 4.096000004076487e+03, + 5.792618757485434e+03, + 8.192000008832390e+03, + 1.158523751593169e+04, + 1.638400001902361e+04, + 2.317047503378509e+04, + 3.276800004076484e+04, + 4.634095007141347e+04, + 6.553600008696507e+04, + 9.268190015051374e+04, + 1.310720001848009e+05, + 1.853638003164007e+05, + 2.621440003913428e+05, + 3.707276006635486e+05, + 5.242880008261676e+05, + 7.414552013885899e+05 }; #endif @@ -146,70 +144,70 @@ const int16_t standard_deviation_inverse_table[REGION_POWER_TABLE_SIZE] = #else const float standard_deviation_inverse_table[REGION_POWER_TABLE_SIZE] = { - 4.096000004076488e+03f, - 2.896309378502504e+03f, - 2.048000001868390e+03f, - 1.448154689131149e+03f, - 1.024000000849268e+03f, - 7.240773445055215e+02f, - 5.120000003821708e+02f, - 3.620386722227349e+02f, - 2.560000001698537e+02f, - 1.810193360963542e+02f, - 1.280000000743110e+02f, - 9.050966804067060e+01f, - 6.400000003184756e+01f, - 4.525483401658203e+01f, - 3.200000001326982e+01f, - 2.262741700641438e+01f, - 1.600000000530793e+01f, - 1.131370850226887e+01f, - 8.000000001990474e+00f, - 5.656854250665277e+00f, - 4.000000000663491e+00f, - 2.828427125098059e+00f, - 2.000000000165873e+00f, - 1.414213562431740e+00f, - 1.000000000000000e+00f, - 7.071067811572251e-01f, - 4.999999999585318e-01f, - 3.535533905492901e-01f, - 2.499999999585318e-01f, - 1.767766952599838e-01f, - 1.249999999688989e-01f, - 8.838834762266132e-02f, - 6.249999997926592e-02f, - 4.419417380766535e-02f, - 3.124999998704120e-02f, - 2.209708690200002e-02f, - 1.562499999222472e-02f, - 1.104854345008369e-02f, - 7.812499995464418e-03f, - 5.524271724583683e-03f, - 3.906249997408239e-03f, - 2.762135862062757e-03f, - 1.953124998542134e-03f, - 1.381067930916839e-03f, - 9.765624991900747e-04f, - 6.905339654011486e-04f, - 4.882812495545411e-04f, - 3.452669826719394e-04f, - 2.441406247570224e-04f, - 1.726334913216520e-04f, - 1.220703123683871e-04f, - 8.631674565366727e-05f, - 6.103515617913153e-05f, - 4.315837282325419e-05f, - 3.051757808703478e-05f, - 2.157918640983742e-05f, - 1.525878904225187e-05f, - 1.078959320402385e-05f, - 7.629394520493171e-06f, - 5.394796601564505e-06f, - 3.814697259930213e-06f, - 2.697398300558537e-06f, - 1.907348629806920e-06f, - 1.348699150167414e-06f + 4.096000004076488e+03, + 2.896309378502504e+03, + 2.048000001868390e+03, + 1.448154689131149e+03, + 1.024000000849268e+03, + 7.240773445055215e+02, + 5.120000003821708e+02, + 3.620386722227349e+02, + 2.560000001698537e+02, + 1.810193360963542e+02, + 1.280000000743110e+02, + 9.050966804067060e+01, + 6.400000003184756e+01, + 4.525483401658203e+01, + 3.200000001326982e+01, + 2.262741700641438e+01, + 1.600000000530793e+01, + 1.131370850226887e+01, + 8.000000001990474e+00, + 5.656854250665277e+00, + 4.000000000663491e+00, + 2.828427125098059e+00, + 2.000000000165873e+00, + 1.414213562431740e+00, + 1.000000000000000e+00, + 7.071067811572251e-01, + 4.999999999585318e-01, + 3.535533905492901e-01, + 2.499999999585318e-01, + 1.767766952599838e-01, + 1.249999999688989e-01, + 8.838834762266132e-02, + 6.249999997926592e-02, + 4.419417380766535e-02, + 3.124999998704120e-02, + 2.209708690200002e-02, + 1.562499999222472e-02, + 1.104854345008369e-02, + 7.812499995464418e-03, + 5.524271724583683e-03, + 3.906249997408239e-03, + 2.762135862062757e-03, + 1.953124998542134e-03, + 1.381067930916839e-03, + 9.765624991900747e-04, + 6.905339654011486e-04, + 4.882812495545411e-04, + 3.452669826719394e-04, + 2.441406247570224e-04, + 1.726334913216520e-04, + 1.220703123683871e-04, + 8.631674565366727e-05, + 6.103515617913153e-05, + 4.315837282325419e-05, + 3.051757808703478e-05, + 2.157918640983742e-05, + 1.525878904225187e-05, + 1.078959320402385e-05, + 7.629394520493171e-06, + 5.394796601564505e-06, + 3.814697259930213e-06, + 2.697398300558537e-06, + 1.907348629806920e-06, + 1.348699150167414e-06 }; #endif @@ -241,14 +239,14 @@ const float step_size[NUM_CATEGORIES] = const float step_size_inverse_table[NUM_CATEGORIES] = { - 2.82805443e+00f, - 2.00000000e+00f, - 1.41422713e+00f, - 1.00000000e+00f, - 7.07113564e-01f, - 5.00000000e-01f, - 3.53556782e-01f, - 3.53556782e-01f + 2.82805443e+00, + 2.00000000e+00, + 1.41422713e+00, + 1.00000000e+00, + 7.07113564e-01, + 5.00000000e-01, + 3.53556782e-01, + 3.53556782e-01 }; #endif @@ -279,137 +277,137 @@ const float dead_zone[NUM_CATEGORIES] = #if !defined(G722_1_USE_FIXED_POINT) const float region_power_table[REGION_POWER_TABLE_SIZE] = { - 5.96046448e-08f, - 1.19209290e-07f, - 2.38418579e-07f, - 4.76837158e-07f, - 9.53674316e-07f, - 1.90734863e-06f, - 3.81469727e-06f, - 7.62939453e-06f, - 1.52587891e-05f, - 3.05175781e-05f, - 6.10351562e-05f, - 1.22070312e-04f, - 2.44140625e-04f, - 4.88281250e-04f, - 9.76562500e-04f, - 1.95312500e-03f, - 3.90625000e-03f, - 7.81250000e-03f, - 1.56250000e-02f, - 3.12500000e-02f, - 6.25000000e-02f, - 1.25000000e-01f, - 2.50000000e-01f, - 5.00000000e-01f, - 1.00000000e+00f, - 2.00000000e+00f, - 4.00000000e+00f, - 8.00000000e+00f, - 1.60000000e+01f, - 3.20000000e+01f, - 6.40000000e+01f, - 1.28000000e+02f, - 2.56000000e+02f, - 5.12000000e+02f, - 1.02400000e+03f, - 2.04800000e+03f, - 4.09600000e+03f, - 8.19200000e+03f, - 1.63840000e+04f, - 3.27680000e+04f, - 6.55360000e+04f, - 1.31072000e+05f, - 2.62144000e+05f, - 5.24288000e+05f, - 1.04857600e+06f, - 2.09715200e+06f, - 4.19430400e+06f, - 8.38860800e+06f, - 1.67772160e+07f, - 3.35544320e+07f, - 6.71088640e+07f, - 1.34217728e+08f, - 2.68435456e+08f, - 5.36870912e+08f, - 1.07374182e+09f, - 2.14748365e+09f, - 4.29496730e+09f, - 8.58993459e+09f, - 1.71798692e+10f, - 3.43597384e+10f, - 6.87194767e+10f, - 1.37438953e+11f, - 2.74877907e+11f, - 5.49755814e+11f + 5.96046448e-08, + 1.19209290e-07, + 2.38418579e-07, + 4.76837158e-07, + 9.53674316e-07, + 1.90734863e-06, + 3.81469727e-06, + 7.62939453e-06, + 1.52587891e-05, + 3.05175781e-05, + 6.10351562e-05, + 1.22070312e-04, + 2.44140625e-04, + 4.88281250e-04, + 9.76562500e-04, + 1.95312500e-03, + 3.90625000e-03, + 7.81250000e-03, + 1.56250000e-02, + 3.12500000e-02, + 6.25000000e-02, + 1.25000000e-01, + 2.50000000e-01, + 5.00000000e-01, + 1.00000000e+00, + 2.00000000e+00, + 4.00000000e+00, + 8.00000000e+00, + 1.60000000e+01, + 3.20000000e+01, + 6.40000000e+01, + 1.28000000e+02, + 2.56000000e+02, + 5.12000000e+02, + 1.02400000e+03, + 2.04800000e+03, + 4.09600000e+03, + 8.19200000e+03, + 1.63840000e+04, + 3.27680000e+04, + 6.55360000e+04, + 1.31072000e+05, + 2.62144000e+05, + 5.24288000e+05, + 1.04857600e+06, + 2.09715200e+06, + 4.19430400e+06, + 8.38860800e+06, + 1.67772160e+07, + 3.35544320e+07, + 6.71088640e+07, + 1.34217728e+08, + 2.68435456e+08, + 5.36870912e+08, + 1.07374182e+09, + 2.14748365e+09, + 4.29496730e+09, + 8.58993459e+09, + 1.71798692e+10, + 3.43597384e+10, + 6.87194767e+10, + 1.37438953e+11, + 2.74877907e+11, + 5.49755814e+11 }; const float region_power_table_boundary[REGION_POWER_TABLE_SIZE - 1] = { - 8.42936956e-08f, - 1.68587391e-07f, - 3.37174782e-07f, - 6.74349565e-07f, - 1.34869913e-06f, - 2.69739826e-06f, - 5.39479652e-06f, - 1.07895930e-05f, - 2.15791861e-05f, - 4.31583721e-05f, - 8.63167443e-05f, - 1.72633489e-04f, - 3.45266977e-04f, - 6.90533954e-04f, - 1.38106791e-03f, - 2.76213582e-03f, - 5.52427163e-03f, - 1.10485433e-02f, - 2.20970865e-02f, - 4.41941731e-02f, - 8.83883461e-02f, - 1.76776692e-01f, - 3.53553385e-01f, - 7.07106769e-01f, - 1.41421354e+00f, - 2.82842708e+00f, - 5.65685415e+00f, - 1.13137083e+01f, - 2.26274166e+01f, - 4.52548332e+01f, - 9.05096664e+01f, - 1.81019333e+02f, - 3.62038666e+02f, - 7.24077332e+02f, - 1.44815466e+03f, - 2.89630933e+03f, - 5.79261865e+03f, - 1.15852373e+04f, - 2.31704746e+04f, - 4.63409492e+04f, - 9.26818984e+04f, - 1.85363797e+05f, - 3.70727594e+05f, - 7.41455188e+05f, - 1.48291038e+06f, - 2.96582075e+06f, - 5.93164150e+06f, - 1.18632830e+07f, - 2.37265660e+07f, - 4.74531320e+07f, - 9.49062640e+07f, - 1.89812528e+08f, - 3.79625056e+08f, - 7.59250112e+08f, - 1.51850022e+09f, - 3.03700045e+09f, - 6.07400090e+09f, - 1.21480018e+10f, - 2.42960036e+10f, - 4.85920072e+10f, - 9.71840143e+10f, - 1.94368029e+11f, - 3.88736057e+11f + 8.42936956e-08, + 1.68587391e-07, + 3.37174782e-07, + 6.74349565e-07, + 1.34869913e-06, + 2.69739826e-06, + 5.39479652e-06, + 1.07895930e-05, + 2.15791861e-05, + 4.31583721e-05, + 8.63167443e-05, + 1.72633489e-04, + 3.45266977e-04, + 6.90533954e-04, + 1.38106791e-03, + 2.76213582e-03, + 5.52427163e-03, + 1.10485433e-02, + 2.20970865e-02, + 4.41941731e-02, + 8.83883461e-02, + 1.76776692e-01, + 3.53553385e-01, + 7.07106769e-01, + 1.41421354e+00, + 2.82842708e+00, + 5.65685415e+00, + 1.13137083e+01, + 2.26274166e+01, + 4.52548332e+01, + 9.05096664e+01, + 1.81019333e+02, + 3.62038666e+02, + 7.24077332e+02, + 1.44815466e+03, + 2.89630933e+03, + 5.79261865e+03, + 1.15852373e+04, + 2.31704746e+04, + 4.63409492e+04, + 9.26818984e+04, + 1.85363797e+05, + 3.70727594e+05, + 7.41455188e+05, + 1.48291038e+06, + 2.96582075e+06, + 5.93164150e+06, + 1.18632830e+07, + 2.37265660e+07, + 4.74531320e+07, + 9.49062640e+07, + 1.89812528e+08, + 3.79625056e+08, + 7.59250112e+08, + 1.51850022e+09, + 3.03700045e+09, + 6.07400090e+09, + 1.21480018e+10, + 2.42960036e+10, + 4.85920072e+10, + 9.71840143e+10, + 1.94368029e+11, + 3.88736057e+11 }; #endif diff --git a/libs/libg722_1/src/tables.h b/libs/libg722_1/src/tables.h index bf0aacb..9b39979 100644 --- a/libs/libg722_1/src/tables.h +++ b/libs/libg722_1/src/tables.h @@ -6,14 +6,12 @@ * Adapted by Steve Underwood <steveu@coppice.org> from the reference * code supplied with ITU G.722.1, which is: * - * © 2004 Polycom, Inc. + * (C) 2004 Polycom, Inc. * All rights reserved. * * 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. - * - * $Id: tables.h,v 1.7 2008/09/26 17:37:31 steveu Exp $ */ #define REGION_POWER_TABLE_SIZE 64 diff --git a/libs/libg722_1/src/utilities.c b/libs/libg722_1/src/utilities.c new file mode 100644 index 0000000..71cac6c --- /dev/null +++ b/libs/libg722_1/src/utilities.c @@ -0,0 +1,467 @@ +/* + * g722_1 - a library for the G.722.1 and Annex C codecs + * + * utilities.c + * + * Copyright (C) 2006 Steve Underwood + * + * 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. + */ + +#if defined(HAVE_CONFIG_H) +#include <config.h> +#endif + +#include <inttypes.h> + +#if defined(G722_1_USE_MMX) +#include <mmintrin.h> +#endif +#if defined(G722_1_USE_SSE) +#include <xmmintrin.h> +#endif +#if defined(G722_1_USE_SSE2) +#include <emmintrin.h> +#endif +#if defined(G722_1_USE_SSE3) +#include <pmmintrin.h> +#include <tmmintrin.h> +#endif +#if defined(G722_1_USE_SSE4_1) +#include <smmintrin.h> +#endif +#if defined(G722_1_USE_SSE4_2) +#include <nmmintrin.h> +#endif +#if defined(G722_1_USE_SSE4A) +#include <ammintrin.h> +#endif +#if defined(G722_1_USE_SSE5) +#include <bmmintrin.h> +#endif + +#include "utilities.h" + +#if defined(G722_1_USE_FIXED_POINT) +void vec_copyi16(int16_t z[], const int16_t x[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i]; +} +/*- End of function --------------------------------------------------------*/ + +int32_t vec_dot_prodi16(const int16_t x[], const int16_t y[], int n) +{ + int32_t z; + +#if defined(__GNUC__) && defined(G722_1_USE_MMX) +#if defined(__x86_64__) + __asm__ __volatile__( + " emms;\n" + " pxor %%mm0,%%mm0;\n" + " leal -32(%%rsi,%%eax,2),%%edx;\n" /* edx = top - 32 */ + + " cmpl %%rdx,%%rsi;\n" + " ja 1f;\n" + + /* Work in blocks of 16 int16_t's until we are near the end */ + " .p2align 2;\n" + "2:\n" + " movq (%%rdi),%%mm1;\n" + " movq (%%rsi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + " movq 8(%%rdi),%%mm1;\n" + " movq 8(%%rsi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + " movq 16(%%rdi),%%mm1;\n" + " movq 16(%%rsi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + " movq 24(%%rdi),%%mm1;\n" + " movq 24(%%rsi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + + " addl $32,%%rsi;\n" + " addl $32,%%rdi;\n" + " cmpl %%rdx,%%rsi;\n" + " jbe 2b;\n" + + " .p2align 2;\n" + "1:\n" + " addl $24,%%rdx;\n" /* Now edx = top - 8 */ + " cmpl %%rdx,%%rsi;\n" + " ja 3f;\n" + + /* Work in blocks of 4 int16_t's until we are near the end */ + " .p2align 2;\n" + "4:\n" + " movq (%%rdi),%%mm1;\n" + " movq (%%rsi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + + " addl $8,%%rsi;\n" + " addl $8,%%rdi;\n" + " cmpl %%rdx,%%rsi;" + " jbe 4b;\n" + + " .p2align 2;\n" + "3:\n" + " addl $4,%%rdx;\n" /* Now edx = top - 4 */ + " cmpl %%rdx,%%rsi;\n" + " ja 5f;\n" + + /* Work in a block of 2 int16_t's */ + " movd (%%rdi),%%mm1;\n" + " movd (%%rsi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + + " addl $4,%%rsi;\n" + " addl $4,%%rdi;\n" + + " .p2align 2;\n" + "5:\n" + " addl $2,%%rdx;\n" /* Now edx = top - 2 */ + " cmpl %%rdx,%%rsi;\n" + " ja 6f;\n" + + /* Deal with the very last int16_t, when n is odd */ + " movswl (%%rdi),%%eax;\n" + " andl $65535,%%eax;\n" + " movd %%eax,%%mm1;\n" + " movswl (%%rsi),%%eax;\n" + " andl $65535,%%eax;\n" + " movd %%eax,%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + + " .p2align 2;\n" + "6:\n" + /* Merge the pieces of the answer */ + " movq %%mm0,%%mm1;\n" + " punpckhdq %%mm0,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + /* Et voila, eax has the final result */ + " movd %%mm0,%%eax;\n" + + " emms;\n" + : "=a" (z) + : "S" (x), "D" (y), "a" (n) + : "cc" + ); +#else + __asm__ __volatile__( + " emms;\n" + " pxor %%mm0,%%mm0;\n" + " leal -32(%%esi,%%eax,2),%%edx;\n" /* edx = top - 32 */ + + " cmpl %%edx,%%esi;\n" + " ja 1f;\n" + + /* Work in blocks of 16 int16_t's until we are near the end */ + " .p2align 2;\n" + "2:\n" + " movq (%%edi),%%mm1;\n" + " movq (%%esi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + " movq 8(%%edi),%%mm1;\n" + " movq 8(%%esi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + " movq 16(%%edi),%%mm1;\n" + " movq 16(%%esi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + " movq 24(%%edi),%%mm1;\n" + " movq 24(%%esi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + + " addl $32,%%esi;\n" + " addl $32,%%edi;\n" + " cmpl %%edx,%%esi;\n" + " jbe 2b;\n" + + " .p2align 2;\n" + "1:\n" + " addl $24,%%edx;\n" /* Now edx = top - 8 */ + " cmpl %%edx,%%esi;\n" + " ja 3f;\n" + + /* Work in blocks of 4 int16_t's until we are near the end */ + " .p2align 2;\n" + "4:\n" + " movq (%%edi),%%mm1;\n" + " movq (%%esi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + + " addl $8,%%esi;\n" + " addl $8,%%edi;\n" + " cmpl %%edx,%%esi;" + " jbe 4b;\n" + + " .p2align 2;\n" + "3:\n" + " addl $4,%%edx;\n" /* Now edx = top - 4 */ + " cmpl %%edx,%%esi;\n" + " ja 5f;\n" + + /* Work in a block of 2 int16_t's */ + " movd (%%edi),%%mm1;\n" + " movd (%%esi),%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + + " addl $4,%%esi;\n" + " addl $4,%%edi;\n" + + " .p2align 2;\n" + "5:\n" + " addl $2,%%edx;\n" /* Now edx = top - 2 */ + " cmpl %%edx,%%esi;\n" + " ja 6f;\n" + + /* Deal with the very last int16_t, when n is odd */ + " movswl (%%edi),%%eax;\n" + " andl $65535,%%eax;\n" + " movd %%eax,%%mm1;\n" + " movswl (%%esi),%%eax;\n" + " andl $65535,%%eax;\n" + " movd %%eax,%%mm2;\n" + " pmaddwd %%mm2,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + + " .p2align 2;\n" + "6:\n" + /* Merge the pieces of the answer */ + " movq %%mm0,%%mm1;\n" + " punpckhdq %%mm0,%%mm1;\n" + " paddd %%mm1,%%mm0;\n" + /* Et voila, eax has the final result */ + " movd %%mm0,%%eax;\n" + + " emms;\n" + : "=a" (z) + : "S" (x), "D" (y), "a" (n) + : "cc" + ); +#endif +#else + int i; + + z = 0; + for (i = 0; i < n; i++) + z += (int32_t) x[i]*(int32_t) y[i]; +#endif + return z; +} +/*- End of function --------------------------------------------------------*/ +#else +#if defined(__GNUC__) && defined(G722_1_USE_SSE2) +void vec_copyf(float z[], const float x[], int n) +{ + int i; + __m128 n1; + + if ((i = n & ~3)) + { + for (i -= 4; i >= 0; i -= 4) + { + n1 = _mm_loadu_ps(x + i); + _mm_storeu_ps(z + i, n1); + } + } + /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */ + switch (n & 3) + { + case 3: + z[n - 3] = x[n - 3]; + case 2: + z[n - 2] = x[n - 2]; + case 1: + z[n - 1] = x[n - 1]; + } +} +#else +void vec_copyf(float z[], const float x[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i]; +} +#endif +/*- End of function --------------------------------------------------------*/ + +#if defined(__GNUC__) && defined(G722_1_USE_SSE2) +void vec_zerof(float z[], int n) +{ + int i; + __m128 n1; + + if ((i = n & ~3)) + { + n1 = _mm_setzero_ps(); + for (i -= 4; i >= 0; i -= 4) + _mm_storeu_ps(z + i, n1); + } + /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */ + switch (n & 3) + { + case 3: + z[n - 3] = 0; + case 2: + z[n - 2] = 0; + case 1: + z[n - 1] = 0; + } +} +#else +void vec_zerof(float z[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = 0.0f; +} +#endif +/*- End of function --------------------------------------------------------*/ + +void vec_subf(float z[], const float x[], const float y[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i] - y[i]; +} +/*- End of function --------------------------------------------------------*/ + +#if defined(__GNUC__) && defined(G722_1_USE_SSE2) +void vec_mulf(float z[], const float x[], const float y[], int n) +{ + int i; + __m128 n1; + __m128 n2; + __m128 n3; + + if ((i = n & ~3)) + { + for (i -= 4; i >= 0; i -= 4) + { + n1 = _mm_loadu_ps(x + i); + n2 = _mm_loadu_ps(y + i); + n3 = _mm_mul_ps(n1, n2); + _mm_storeu_ps(z + i, n3); + } + } + /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */ + switch (n & 3) + { + case 3: + z[n - 3] = x[n - 3]*y[n - 3]; + case 2: + z[n - 2] = x[n - 2]*y[n - 2]; + case 1: + z[n - 1] = x[n - 1]*y[n - 1]; + } +} +#else +void vec_mulf(float z[], const float x[], const float y[], int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i]*y[i]; +} +#endif +/*- End of function --------------------------------------------------------*/ + +#if defined(__GNUC__) && defined(G722_1_USE_SSE2) +float vec_dot_prodf(const float x[], const float y[], int n) +{ + int i; + float z; + __m128 n1; + __m128 n2; + __m128 n3; + __m128 n4; + + z = 0.0f; + if ((i = n & ~3)) + { + n4 = _mm_setzero_ps(); //sets sum to zero + for (i -= 4; i >= 0; i -= 4) + { + n1 = _mm_loadu_ps(x + i); + n2 = _mm_loadu_ps(y + i); + n3 = _mm_mul_ps(n1, n2); + n4 = _mm_add_ps(n4, n3); + } + n4 = _mm_add_ps(_mm_movehl_ps(n4, n4), n4); + n4 = _mm_add_ss(_mm_shuffle_ps(n4, n4, 1), n4); + _mm_store_ss(&z, n4); + } + /* Now deal with the last 1 to 3 elements, which don't fill an SSE2 register */ + switch (n & 3) + { + case 3: + z += x[n - 3]*y[n - 3]; + case 2: + z += x[n - 2]*y[n - 2]; + case 1: + z += x[n - 1]*y[n - 1]; + } + return z; +} +#else +float vec_dot_prodf(const float x[], const float y[], int n) +{ + int i; + float z; + + z = 0.0f; + for (i = 0; i < n; i++) + z += x[i]*y[i]; + return z; +} +/*- End of function --------------------------------------------------------*/ +#endif + +void vec_scalar_mulf(float z[], const float x[], float y, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i]*y; +} +/*- End of function --------------------------------------------------------*/ + +void vec_scaled_addf(float z[], const float x[], float x_scale, const float y[], float y_scale, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i]*x_scale + y[i]*y_scale; +} +/*- End of function --------------------------------------------------------*/ + +void vec_scaled_subf(float z[], const float x[], float x_scale, const float y[], float y_scale, int n) +{ + int i; + + for (i = 0; i < n; i++) + z[i] = x[i]*x_scale - y[i]*y_scale; +} +/*- End of function --------------------------------------------------------*/ +#endif +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/libg722_1/src/utilities.h b/libs/libg722_1/src/utilities.h new file mode 100644 index 0000000..9d17103 --- /dev/null +++ b/libs/libg722_1/src/utilities.h @@ -0,0 +1,32 @@ +/* + * g722_1 - a library for the G.722.1 and Annex C codecs + * + * utilities.h + * + * Copyright (C) 2006 Steve Underwood + * + * 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. + */ + +#if !defined(__UTILITIES_H__) +#define __UTILITIES_H__ + +/* Prototypes for some general purpose signal and vector functions */ +#if defined(G722_1_USE_FIXED_POINT) +void vec_copyi16(int16_t z[], const int16_t x[], int n); +int32_t vec_dot_prodi16(const int16_t x[], const int16_t y[], int n); +#else +void vec_copyf(float z[], const float x[], int n); +void vec_zerof(float z[], int n); +void vec_subf(float z[], const float x[], const float y[], int n); +void vec_scalar_mulf(float z[], const float x[], float y, int n); +void vec_mulf(float z[], const float x[], const float y[], int n); +float vec_dot_prodf(const float x[], const float y[], int n); +void vec_scaled_addf(float z[], const float x[], float x_scale, const float y[], float y_scale, int n); +void vec_scaled_subf(float z[], const float x[], float x_scale, const float y[], float y_scale, int n); +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/libg722_1/test-data/Makefile.am b/libs/libg722_1/test-data/Makefile.am index 83ddb94..0b27a68 100644 --- a/libs/libg722_1/test-data/Makefile.am +++ b/libs/libg722_1/test-data/Makefile.am @@ -15,8 +15,6 @@ ## 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., 675 Mass Ave, Cambridge, MA 02139, USA. -## -## $Id: Makefile.am,v 1.2 2008/09/20 16:31:19 steveu Exp $ SUBDIRS = itu local diff --git a/libs/libg722_1/test-data/itu/Makefile.am b/libs/libg722_1/test-data/itu/Makefile.am index ae99015..df51ad0 100644 --- a/libs/libg722_1/test-data/itu/Makefile.am +++ b/libs/libg722_1/test-data/itu/Makefile.am @@ -15,8 +15,6 @@ ## 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., 675 Mass Ave, Cambridge, MA 02139, USA. -## -## $Id: Makefile.am,v 1.3 2008/09/23 16:03:04 steveu Exp $ SUBDIRS = diff --git a/libs/libg722_1/test-data/local/Makefile.am b/libs/libg722_1/test-data/local/Makefile.am index a7aca42..142fb4c 100644 --- a/libs/libg722_1/test-data/local/Makefile.am +++ b/libs/libg722_1/test-data/local/Makefile.am @@ -15,8 +15,6 @@ ## 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., 675 Mass Ave, Cambridge, MA 02139, USA. -## -## $Id: Makefile.am,v 1.3 2008/09/24 16:12:52 steveu Exp $ SUBDIRS = diff --git a/libs/libg722_1/tests/Makefile.am b/libs/libg722_1/tests/Makefile.am index afad2f6..aec0cec 100644 --- a/libs/libg722_1/tests/Makefile.am +++ b/libs/libg722_1/tests/Makefile.am @@ -15,8 +15,6 @@ ## 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., 675 Mass Ave, Cambridge, MA 02139, USA. -## -## $Id: Makefile.am,v 1.4 2008/10/19 04:05:02 steveu Exp $ AM_CFLAGS = $(COMP_VENDOR_CFLAGS) AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS) @@ -33,8 +31,8 @@ LIBDIR = -L$(top_builddir)/src noinst_PROGRAMS = g722_1_tests -noinst_HEADERS = itu_bit_stream.c \ +noinst_HEADERS = g192_bit_stream.h \ timing.h -g722_1_tests_SOURCES = g722_1_tests.c itu_bit_stream.c +g722_1_tests_SOURCES = g722_1_tests.c g192_bit_stream.c g722_1_tests_LDADD = $(LIBDIR) -lg722_1 diff --git a/libs/libg722_1/tests/g192_bit_stream.c b/libs/libg722_1/tests/g192_bit_stream.c new file mode 100644 index 0000000..36a853c --- /dev/null +++ b/libs/libg722_1/tests/g192_bit_stream.c @@ -0,0 +1,177 @@ +/* + * broadvoice - a library for the BroadVoice 16 and 32 codecs + * + * g192_bit_stream.c + * + * Copyright 2008-2009 Steve Underwood <steveu@coppice.org> + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*! \file */ + +#if defined(HAVE_CONFIG_H) +#include "config.h" +#endif + +#include <inttypes.h> +#include <stdio.h> +#include <string.h> +#include <audiofile.h> + +#include "g192_bit_stream.h" + +#if !defined(FALSE) +#define FALSE 0 +#endif +#if !defined(TRUE) +#define TRUE (!FALSE) +#endif + +enum +{ + G192_FRAME_ERASURE = 0x6B20, + G192_FRAME_SYNC_1 = 0x6B21, + G192_FRAME_SYNC_2 = 0x6B22, + G192_FRAME_SYNC_3 = 0x6B23, + G192_FRAME_SYNC_4 = 0x6B24, + G192_FRAME_SYNC_5 = 0x6B25, + G192_FRAME_SYNC_6 = 0x6B26, + G192_FRAME_SYNC_7 = 0x6B27, + G192_FRAME_SYNC_8 = 0x6B28, + G192_FRAME_SYNC_9 = 0x6B29, + G192_FRAME_SYNC_10 = 0x6B2A, + G192_FRAME_SYNC_11 = 0x6B2B, + G192_FRAME_SYNC_12 = 0x6B2C, + G192_FRAME_SYNC_13 = 0x6B2D, + G192_FRAME_SYNC_14 = 0x6B2E, + G192_FRAME_SYNC_15 = 0x6B2F, + G192_HARD_ZERO = 0x7F, + G192_INDETERMINATE = 0x00, + G192_HARD_ONE = 0x81 +}; + +int itu_codec_bitstream_write(const uint8_t out_data[], + int number_of_bits, + int mode, + FILE *fp_bitstream) +{ + int i; + int j; + int bit_count; + int number_of_bytes; + uint8_t packed_word; + int16_t out_array[2 + number_of_bits + 7]; + + number_of_bytes = (number_of_bits + 7)/8; + if (mode == ITU_CODEC_BITSTREAM_PACKED) + { + return fwrite(out_data, 1, number_of_bytes, fp_bitstream); + } + j = 0; + out_array[j++] = G192_FRAME_SYNC_1; + out_array[j++] = number_of_bits; + for (i = 0; i < number_of_bytes; i++) + { + packed_word = out_data[i]; + for (bit_count = 7; bit_count >= 0; bit_count--) + out_array[j++] = ((packed_word >> bit_count) & 1) ? G192_HARD_ONE : G192_HARD_ZERO; + } + + return fwrite(out_array, sizeof(int16_t), number_of_bits + 2, fp_bitstream); +} +/*- End of function --------------------------------------------------------*/ + +int itu_codec_bitstream_read(uint8_t in_data[], + int16_t *erasure, + int number_of_bits, + int mode, + FILE *fp_bitstream) +{ + int i; + int j; + int bit_pos; + int nsamp; + int limit; + int rem; + int len; + int erased_frame; + int16_t packed_word; + int16_t bit; + int16_t in_array[2 + number_of_bits]; + + *erasure = FALSE; + if (mode == ITU_CODEC_BITSTREAM_PACKED) + { + nsamp = fread(in_data, 1, number_of_bits/8, fp_bitstream); + if (nsamp <= 0) + return -1; + return nsamp*8; + } + + nsamp = fread(in_array, sizeof(int16_t), 2, fp_bitstream); + if (nsamp < 2) + return -1; + if (in_array[0] < G192_FRAME_ERASURE || in_array[0] > G192_FRAME_SYNC_15) + { + *erasure = TRUE; + return 0; + } + erased_frame = (in_array[0] == G192_FRAME_ERASURE); + len = in_array[1]; + if (len > number_of_bits) + { + *erasure = TRUE; + return 0; + } + nsamp = fread(in_array, sizeof(int16_t), len, fp_bitstream); + if (nsamp != len) + { + *erasure = TRUE; + return nsamp; + } + + limit = (nsamp + 7)/8; + for (i = 0, j = 0; i < limit; i++) + { + packed_word = 0; + rem = (i == (limit - 1)) ? (limit*8 - nsamp) : 0; + for (bit_pos = 7; bit_pos >= rem; bit_pos--) + { + bit = in_array[j++]; + if (bit >= 0x0001 && bit <= G192_HARD_ZERO) + { + /* Its a zero */ + } + else if (bit >= G192_HARD_ONE && bit <= 0x00FF) + { + /* Its a one */ + packed_word |= (1 << bit_pos); + } + else + { + /* Bad bit */ + *erasure = 1; + } + } + in_data[i] = packed_word; + } + if (erased_frame) + *erasure = TRUE; + return nsamp; +} +/*- End of function --------------------------------------------------------*/ +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/libg722_1/tests/g192_bit_stream.h b/libs/libg722_1/tests/g192_bit_stream.h new file mode 100644 index 0000000..1948aa2 --- /dev/null +++ b/libs/libg722_1/tests/g192_bit_stream.h @@ -0,0 +1,75 @@ +/* + * broadvoice - a library for the BroadVoice 16 and 32 codecs + * + * g192_bit_stream.h + * + * Copyright 2008-2009 Steve Underwood <steveu@coppice.org> + * + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2.1, + * as published by the Free Software Foundation. + * + * 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*! \file */ + +#if !defined(_G192_BIT_STREAM_H_) +#define _G192_BIT_STREAM_H_ + +/*! \page g192_bit_stream_page ITU G.192 codec bit stream handling +\section g192_bit_stream_page_sec_1 What does it do? + +\section g192_bit_stream_page_sec_2 How does it work? +*/ + +enum +{ + ITU_CODEC_BITSTREAM_PACKED = 0, + ITU_CODEC_BITSTREAM_G192 = 1 +}; + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/*! \brief Write a frame of data to an output file. + \param out_data The buffer for the data to be written. + \param number_of_bits The number of bits to be written. + \param mode 0 = continuous, 1 = ITU G.192 codec bitstream format. + \param fp_bitstream The file context to be written to. + \return The number of words written. */ +int itu_codec_bitstream_write(const uint8_t out_data[], + int number_of_bits, + int mode, + FILE *fp_bitstream); + +/*! \brief Read a frame of data from an input file. + \param in_data The buffer for the data to be read. + \param p_erasure Set to TRUE if there is a frame erasure, else set to FALSE. + \param number_of_bits The number of bits to be read. + \param mode 0 = continuous, 1 = ITU G.192 codec bitstream format. + \param fp_bitstream The file context to be read from. + \return The number of words read. */ +int itu_codec_bitstream_read(uint8_t in_data[], + int16_t *p_erasure, + int number_of_bits, + int mode, + FILE *fp_bitstream); + +#if defined(__cplusplus) +} +#endif + +#endif +/*- End of file ------------------------------------------------------------*/ diff --git a/libs/libg722_1/tests/g722_1_tests.c b/libs/libg722_1/tests/g722_1_tests.c index 9f0b951..7cc6bef 100644 --- a/libs/libg722_1/tests/g722_1_tests.c +++ b/libs/libg722_1/tests/g722_1_tests.c @@ -6,14 +6,12 @@ * Adapted by Steve Underwood <steveu@coppice.org> from the reference * code supplied with ITU G.722.1, which is: * - * © 2004 Polycom, Inc. + * (C) 2004 Polycom, Inc. * All rights reserved. * * 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. - * - * $Id: g722_1_tests.c,v 1.14 2008/11/21 15:30:22 steveu Exp $ */ /*! \file */ @@ -36,7 +34,7 @@ #include <g722_1.h> #include "timing.h" -#include "itu_bit_stream.h" +#include "g192_bit_stream.h" typedef struct { @@ -227,7 +225,7 @@ static void parse_command_line(char *argv[], coder_control_t *control) } else if (strcasecmp(*argv, "i") == 0) { - control->encoded_format = ITU_CODEC_BITSTREAM_ITU; + control->encoded_format = ITU_CODEC_BITSTREAM_G192; printf("Encoding format = ITU-format bitstream\n"); } else diff --git a/libs/libg722_1/tests/itu_bit_stream.c b/libs/libg722_1/tests/itu_bit_stream.c deleted file mode 100644 index d07ef37..0000000 --- a/libs/libg722_1/tests/itu_bit_stream.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * g722_1 - a library for the G.722.1 and Annex C codecs - * - * itu_bit_stream.c - * - * Adapted by Steve Underwood <steveu@coppice.org> from the reference - * code supplied with ITU G.722.1, which is: - * - * © 2004 Polycom, Inc. - * All rights reserved. - * - * 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. - * - * $Id: itu_bit_stream.c,v 1.6 2008/11/21 15:30:22 steveu Exp $ - */ - -/*! \file */ - -#if defined(HAVE_CONFIG_H) -#include "config.h" -#endif - -#include <inttypes.h> -#include <stdio.h> -#include <string.h> -#include <audiofile.h> - -#include "itu_bit_stream.h" - -static const int16_t frame_start = 0x6B21; -static const int16_t erased_frame_start = 0x6B20; -static const int16_t one = 0x0081; -static const int16_t zero = 0x007F; - -void itu_codec_bitstream_write(const uint8_t out_data[], - int number_of_bits, - int mode, - FILE *fp_bitstream) -{ - int i; - int j; - int bit_count; - int number_of_bytes; - uint8_t packed_word; - int16_t out_array[2 + number_of_bits + 7]; - - number_of_bytes = (number_of_bits + 7)/8; - if (mode == ITU_CODEC_BITSTREAM_PACKED) - { - fwrite(out_data, 1, number_of_bytes, fp_bitstream); - return; - } - j = 0; - out_array[j++] = frame_start; - out_array[j++] = number_of_bits; - for (i = 0; i < number_of_bytes; i++) - { - packed_word = out_data[i]; - for (bit_count = 7; bit_count >= 0; bit_count--) - out_array[j++] = ((packed_word >> bit_count) & 1) ? one : zero; - } - - fwrite(out_array, sizeof(int16_t), number_of_bits + 2, fp_bitstream); -} -/*- End of function --------------------------------------------------------*/ - -int itu_codec_bitstream_read(uint8_t in_data[], - int16_t *p_frame_error_flag, - int number_of_bits, - int mode, - FILE *fp_bitstream) -{ - int i; - int j; - int bit_count; - int nsamp; - int len; - int erased_frame; - int16_t packed_word; - int16_t bit; - int16_t in_array[2 + number_of_bits]; - - if (mode == ITU_CODEC_BITSTREAM_PACKED) - return fread(in_data, 1, number_of_bits/8, fp_bitstream)*8; - - nsamp = fread(in_array, sizeof(int16_t), 2, fp_bitstream); - if (nsamp < 2) - return -1; - if (in_array[0] != frame_start && in_array[0] != erased_frame_start) - { - *p_frame_error_flag = 1; - return 0; - } - erased_frame = (in_array[0] == erased_frame_start); - len = in_array[1]; - if (len > number_of_bits) - { - *p_frame_error_flag = 1; - return 0; - } - nsamp = fread(in_array, sizeof(int16_t), len, fp_bitstream); - if (nsamp != len) - { - *p_frame_error_flag = 1; - return nsamp; - } - *p_frame_error_flag = 0; - - for (i = 0, j = 0; i < nsamp/8; i++) - { - packed_word = 0; - bit_count = 7; - while (bit_count >= 0) - { - bit = in_array[j++]; - if (bit == zero) - bit = 0; - else if (bit == one) - bit = 1; - else - { - /* Bad bit */ - bit = 1; - *p_frame_error_flag = 1; - /* printf("read_ITU_format: bit not zero or one: %4x\n", bit); */ - } - packed_word = (packed_word << 1) | bit; - bit_count--; - } - in_data[i] = packed_word; - } - if (erased_frame) - *p_frame_error_flag = 1; - return nsamp; -} -/*- End of function --------------------------------------------------------*/ -/*- End of file ------------------------------------------------------------*/ diff --git a/libs/libg722_1/tests/regression_tests.sh.in b/libs/libg722_1/tests/regression_tests.sh.in index 6b52213..4be36b2 100644 --- a/libs/libg722_1/tests/regression_tests.sh.in +++ b/libs/libg722_1/tests/regression_tests.sh.in @@ -16,9 +16,6 @@ # 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., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# $Id: regression_tests.sh.in,v 1.4 2008/11/21 15:30:22 steveu Exp $ -# STDOUT_DEST=xyzzy STDERR_DEST=xyzzy2 @@ -33,7 +30,7 @@ diff $TMP_FILE ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_enc_out_32000.itu RETVAL=$? if [ $RETVAL != 0 ] then - echo g722_1_tests E failed! + echo g722_1_tests encode failed! exit $RETVAL fi ./g722_1_tests E I 24000 16000 ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_enc_in.pcm $TMP_FILE @@ -41,17 +38,17 @@ diff $TMP_FILE ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_enc_out_24000.itu RETVAL=$? if [ $RETVAL != 0 ] then - echo g722_1_tests E failed! + echo g722_1_tests encode failed! exit $RETVAL fi -echo g722_1_tests E completed OK +echo g722_1_tests encode completed OK ./g722_1_tests D I 24000 16000 ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_enc_out_24000.itu $TMP_FILE diff $TMP_FILE ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_dec_out_24000.pcm RETVAL=$? if [ $RETVAL != 0 ] then - echo g722_1_tests D failed! + echo g722_1_tests decode failed! exit $RETVAL fi ./g722_1_tests D I 32000 16000 ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_enc_out_32000.itu $TMP_FILE @@ -59,7 +56,7 @@ diff $TMP_FILE ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_dec_out_32000.pcm RETVAL=$? if [ $RETVAL != 0 ] then - echo g722_1_tests D failed! + echo g722_1_tests decode failed! exit $RETVAL fi @@ -68,7 +65,7 @@ diff $TMP_FILE ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_dec_out_24000_fe.pcm RETVAL=$? if [ $RETVAL != 0 ] then - echo g722_1_tests D failed! + echo g722_1_tests decode failed! exit $RETVAL fi ./g722_1_tests D I 32000 16000 ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_dec_in_32000_fe.itu $TMP_FILE @@ -76,28 +73,28 @@ diff $TMP_FILE ../test-data/itu/g722_1/$VECTOR_CLASS/g722_1_dec_out_32000_fe.pcm RETVAL=$? if [ $RETVAL != 0 ] then - echo g722_1_tests D failed! + echo g722_1_tests decode failed! exit $RETVAL fi -echo g722_1_tests D completed OK +echo g722_1_tests decode completed OK ./g722_1_tests E I 32000 16000 ../test-data/local/short_wb_voice.wav $TMP_FILE RETVAL=$? if [ $RETVAL != 0 ] then - echo g722_1_tests E failed! + echo g722_1_tests encode failed! exit $RETVAL fi -echo g722_1_tests E completed OK +echo g722_1_tests encode completed OK ./g722_1_tests D I 32000 16000 $TMP_FILE test.au RETVAL=$? if [ $RETVAL != 0 ] then - echo g722_1_tests D failed! + echo g722_1_tests decode failed! exit $RETVAL fi -echo g722_1_tests D completed OK +echo g722_1_tests decode completed OK echo echo All regression tests successfully completed diff --git a/libs/libg722_1/tests/timing.h b/libs/libg722_1/tests/timing.h index 3fb1b3c..f95f3b8 100644 --- a/libs/libg722_1/tests/timing.h +++ b/libs/libg722_1/tests/timing.h @@ -1,5 +1,5 @@ /* - * SpanDSP - a series of DSP components for telephony + * g722_1 - a library for the G.722.1 and Annex C codecs * * timing.h - Provide access to the Pentium/Athlon TSC timer register * @@ -21,8 +21,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: timing.h,v 1.1 2008/10/17 15:17:39 steveu Exp $ */ #if !defined(_TIMING_H_) diff --git a/libs/libg722_1/unpack_g722_1_data.sh b/libs/libg722_1/unpack_g722_1_data.sh index 75741e0..f8b85f4 100755 --- a/libs/libg722_1/unpack_g722_1_data.sh +++ b/libs/libg722_1/unpack_g722_1_data.sh @@ -16,9 +16,6 @@ # You should have received a copy of the GNU Lesser General Public # License along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# -# $Id: unpack_g722_1_data.sh,v 1.2 2008/09/26 12:09:29 steveu Exp $ -# ITUDATA="../../../T-REC-G.722.1-200505-I!!SOFT-ZST-E.zip" commit d24af1e1c2c49bd8486ec8b29a12a6e11565feaa Author: Travis Cross <tc@traviscross.com> Date: Sat Dec 25 15:02:35 2010 +0000 close font tags in email templates diff --git a/conf/notify-voicemail.tpl b/conf/notify-voicemail.tpl index 5defd74..365faa2 100644 --- a/conf/notify-voicemail.tpl +++ b/conf/notify-voicemail.tpl @@ -37,6 +37,7 @@ Content-Transfer-Encoding: 7bit Created: ${voicemail_time}<br> Duration: ${voicemail_message_len}<br> Account: ${voicemail_account}@${voicemail_domain}<br> +</font> </body> </html> diff --git a/conf/voicemail.tpl b/conf/voicemail.tpl index a98f9d7..2774b78 100644 --- a/conf/voicemail.tpl +++ b/conf/voicemail.tpl @@ -37,6 +37,7 @@ Content-Transfer-Encoding: 7bit Created: ${voicemail_time}<br> Duration: ${voicemail_message_len}<br> Account: ${voicemail_account}@${voicemail_domain}<br> +</font> </body> </html> commit 4268bf84b06a66c98803e4998116390ea5d24da7 Author: Moises Silva <moy@sangoma.com> Date: Fri Dec 24 15:58:04 2010 -0500 freetdm: more core state refactoring, still untested diff --git a/libs/freetdm/Makefile.am b/libs/freetdm/Makefile.am index 5e804b7..2ab5c29 100644 --- a/libs/freetdm/Makefile.am +++ b/libs/freetdm/Makefile.am @@ -73,6 +73,7 @@ libfreetdm_la_SOURCES = \ $(SRC)/hashtable.c \ $(SRC)/hashtable_itr.c \ $(SRC)/ftdm_io.c \ + $(SRC)/ftdm_state.c \ $(SRC)/ftdm_queue.c \ $(SRC)/ftdm_sched.c \ $(SRC)/ftdm_call_utils.c \ diff --git a/libs/freetdm/src/ftdm_state.c b/libs/freetdm/src/ftdm_state.c new file mode 100644 index 0000000..2b54475 --- /dev/null +++ b/libs/freetdm/src/ftdm_state.c @@ -0,0 +1,458 @@ +/* + * Copyright (c) 2010, Sangoma Technologies + * Moises Silva <moy@sangoma.com> + * 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 original author; nor the names of any 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 OWNER + * 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 "private/ftdm_core.h" + +FTDM_ENUM_NAMES(CHANNEL_STATE_NAMES, CHANNEL_STATE_STRINGS) +FTDM_STR2ENUM(ftdm_str2ftdm_channel_state, ftdm_channel_state2str, ftdm_channel_state_t, CHANNEL_STATE_NAMES, FTDM_CHANNEL_STATE_INVALID) + +/* This function is only needed for boost and we should get rid of it at the next refactoring */ +FT_DECLARE(ftdm_status_t) ftdm_channel_init(ftdm_channel_t *fchan) +{ + ftdm_channel_lock(fchan); + + if (fchan->init_state != FTDM_CHANNEL_STATE_DOWN) { + ftdm_channel_set_state(__FILE__, __FUNCTION__, __LINE__, fchan, fchan->init_state, 1); + fchan->init_state = FTDM_CHANNEL_STATE_DOWN; + } + + ftdm_channel_unlock(fchan); + return FTDM_SUCCESS; +} + +FT_DECLARE(ftdm_status_t) _ftdm_channel_complete_state(const char *file, const char *func, int line, ftdm_channel_t *fchan) +{ + uint8_t hindex = 0; + ftdm_channel_state_t state = fchan->state; + + if (fchan->state_status == FTDM_STATE_STATUS_COMPLETED) { + return FTDM_SUCCESS; + } + + if (state == FTDM_CHANNEL_STATE_PROGRESS) { + ftdm_set_flag(fchan, FTDM_CHANNEL_PROGRESS); + } else if (state == FTDM_CHANNEL_STATE_UP) { + ftdm_set_flag(fchan, FTDM_CHANNEL_PROGRESS); + ftdm_set_flag(fchan, FTDM_CHANNEL_MEDIA); + ftdm_set_flag(fchan, FTDM_CHANNEL_ANSWERED); + } else if (state == FTDM_CHANNEL_STATE_PROGRESS_MEDIA) { + ftdm_set_flag(fchan, FTDM_CHANNEL_PROGRESS); + ftdm_set_flag(fchan, FTDM_CHANNEL_MEDIA); + } + + /* if there is a pending ack for an indication */ + if (ftdm_test_flag(fchan, FTDM_CHANNEL_IND_ACK_PENDING)) { + ftdm_ack_indication(fchan, fchan->indication, FTDM_SUCCESS); + ftdm_clear_flag(fchan, FTDM_CHANNEL_IND_ACK_PENDING); + } + + ftdm_log_chan_ex(fchan, file, func, line, FTDM_LOG_LEVEL_DEBUG, "Completed state change from %s to %s\n", ftdm_channel_state2str(fchan->state), ftdm_channel_state2str(state)); + hindex = (fchan->hindex == 0) ? (ftdm_array_len(fchan->history) - 1) : (hindex - 1); + + ftdm_assert(!fchan->history[hindex].end_time, "End time should be zero!\n"); + + fchan->history[hindex].end_time = ftdm_current_time_in_ms(); + + /* FIXME: broadcast condition to wake up anyone waiting on state completion if the channel + * is blocking (FTDM_CHANNEL_NONBLOCK is not set) */ + + return FTDM_SUCCESS; +} + +FT_DECLARE(ftdm_status_t) _ftdm_set_state(const char *file, const char *func, int line, + ftdm_channel_t *fchan, ftdm_channel_state_t state) +{ + if (fchan->state_status == FTDM_STATE_STATUS_NEW) { + /* the current state is new, setting a new state from a signaling module + when the current state is new is equivalent to implicitly acknowledging + the current state */ + _ftdm_channel_complete_state(file, func, line, fchan); + } + return ftdm_channel_set_state(file, func, line, fchan, state, 0); +} + +static int ftdm_parse_state_map(ftdm_channel_t *ftdmchan, ftdm_channel_state_t state, ftdm_state_map_t *state_map) +{ + int x = 0, ok = 0; + ftdm_state_direction_t direction = ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) ? ZSD_OUTBOUND : ZSD_INBOUND; + + for(x = 0; x < FTDM_MAP_NODE_SIZE; x++) { + int i = 0, proceed = 0; + if (!state_map->nodes[x].type) { + break; + } + + if (state_map->nodes[x].direction != direction) { + continue; + } + + if (state_map->nodes[x].check_states[0] == FTDM_ANY_STATE) { + proceed = 1; + } else { + for(i = 0; i < FTDM_MAP_MAX; i++) { + if (state_map->nodes[x].check_states[i] == ftdmchan->state) { + proceed = 1; + break; + } + } + } + + if (!proceed) { + continue; + } + + for(i = 0; i < FTDM_MAP_MAX; i++) { + ok = (state_map->nodes[x].type == ZSM_ACCEPTABLE); + if (state_map->nodes[x].states[i] == FTDM_END) { + break; + } + if (state_map->nodes[x].states[i] == state) { + ok = !ok; + goto end; + } + } + } + end: + + return ok; +} + +/* this function MUST be called with the channel lock held. If waitrq == 1, the channel will be unlocked/locked (never call it with waitrq == 1 with an lock recursivity > 1) */ +#define DEFAULT_WAIT_TIME 1000 +FT_DECLARE(ftdm_status_t) ftdm_channel_set_state(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_channel_state_t state, int waitrq) +{ + int ok = 1; + int waitms = DEFAULT_WAIT_TIME; + + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_READY)) { + ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_ERROR, "Ignored state change request from %s to %s, the channel is not ready\n", + ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state)); + return FTDM_FAIL; + } + + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { + ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_ERROR, "Ignored state change request from %s to %s, the previous state change has not been processed yet\n", + ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state)); + return FTDM_FAIL; + } + + if (ftdmchan->state == state) { + ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_WARNING, "Why bother changing state from %s to %s\n", ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state)); + return FTDM_FAIL; + } + + if (ftdmchan->span->state_map) { + ok = ftdm_parse_state_map(ftdmchan, state, ftdmchan->span->state_map); + goto end; + } + + /* basic core state validation (by-passed if the signaling module provides a state_map) */ + switch(ftdmchan->state) { + case FTDM_CHANNEL_STATE_HANGUP: + case FTDM_CHANNEL_STATE_TERMINATING: + { + ok = 0; + switch(state) { + case FTDM_CHANNEL_STATE_DOWN: + case FTDM_CHANNEL_STATE_BUSY: + case FTDM_CHANNEL_STATE_RESTART: + ok = 1; + break; + default: + break; + } + } + break; + case FTDM_CHANNEL_STATE_UP: + { + ok = 1; + switch(state) { + case FTDM_CHANNEL_STATE_PROGRESS: + case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: + case FTDM_CHANNEL_STATE_RING: + ok = 0; + break; + default: + break; + } + } + break; + case FTDM_CHANNEL_STATE_DOWN: + { + ok = 0; + + switch(state) { + case FTDM_CHANNEL_STATE_DIALTONE: + case FTDM_CHANNEL_STATE_COLLECT: + case FTDM_CHANNEL_STATE_DIALING: + case FTDM_CHANNEL_STATE_RING: + case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: + case FTDM_CHANNEL_STATE_PROGRESS: + case FTDM_CHANNEL_STATE_IDLE: + case FTDM_CHANNEL_STATE_GET_CALLERID: + case FTDM_CHANNEL_STATE_GENRING: + ok = 1; + break; + default: + break; + } + } + break; + case FTDM_CHANNEL_STATE_BUSY: + { + switch(state) { + case FTDM_CHANNEL_STATE_UP: + ok = 0; + break; + default: + break; + } + } + break; + case FTDM_CHANNEL_STATE_RING: + { + switch(state) { + case FTDM_CHANNEL_STATE_UP: + ok = 1; + break; + default: + break; + } + } + break; + default: + break; + } + +end: + + if (ok) { + ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_DEBUG, "Changed state from %s to %s\n", ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state)); + ftdmchan->last_state = ftdmchan->state; + ftdmchan->state = state; + ftdmchan->state_status = FTDM_STATE_STATUS_NEW; + ftdmchan->history[ftdmchan->hindex].file = file; + ftdmchan->history[ftdmchan->hindex].func = func; + ftdmchan->history[ftdmchan->hindex].line = line; + ftdmchan->history[ftdmchan->hindex].state = ftdmchan->state; + ftdmchan->history[ftdmchan->hindex].last_state = ftdmchan->last_state; + ftdmchan->history[ftdmchan->hindex].time = ftdm_current_time_in_ms(); + ftdmchan->history[ftdmchan->hindex].end_time = 0; + ftdmchan->hindex++; + if (ftdmchan->hindex == ftdm_array_len(ftdmchan->history)) { + ftdmchan->hindex = 0; + } + ftdm_set_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE); + + ftdm_mutex_lock(ftdmchan->span->mutex); + ftdm_set_flag(ftdmchan->span, FTDM_SPAN_STATE_CHANGE); + if (ftdmchan->span->pendingchans) { + ftdm_queue_enqueue(ftdmchan->span->pendingchans, ftdmchan); + } + ftdm_mutex_unlock(ftdmchan->span->mutex); + } else { + ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_WARNING, "VETO state change from %s to %s\n", ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state)); + goto done; + } + + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_NONBLOCK)) { + /* the channel should not block waiting for state processing */ + goto done; + } + + /* there is an inherent race here between set and check of the change flag but we do not care because + * the flag should never last raised for more than a few ms for any state change */ + while (waitrq && waitms > 0) { + /* give a chance to the signaling stack to process it */ + ftdm_mutex_unlock(ftdmchan->mutex); + + ftdm_sleep(10); + waitms -= 10; + + ftdm_mutex_lock(ftdmchan->mutex); + + /* if the flag is no longer set, the state change was processed (or is being processed) */ + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { + break; + } + + /* if the state is no longer what we set, the state change was + * obviously processed (and the current state change flag is for other state change) */ + if (ftdmchan->state != state) { + break; + } + } + + if (waitms <= 0) { + ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_WARNING, "state change from %s to %s was most likely not processed after aprox %dms\n", + ftdm_channel_state2str(ftdmchan->last_state), ftdm_channel_state2str(state), DEFAULT_WAIT_TIME); + ok = 0; + } +done: + return ok ? FTDM_SUCCESS : FTDM_FAIL; +} + +FT_DECLARE(int) ftdm_channel_get_state(const ftdm_channel_t *ftdmchan) +{ + int state; + ftdm_channel_lock(ftdmchan); + state = ftdmchan->state; + ftdm_channel_unlock(ftdmchan); + return state; +} + +FT_DECLARE(const char *) ftdm_channel_get_state_str(const ftdm_channel_t *ftdmchan) +{ + const char *state; + ftdm_channel_lock(ftdmchan); + state = ftdm_channel_state2str(ftdmchan->state); + ftdm_channel_unlock(ftdmchan); + return state; +} + +FT_DECLARE(int) ftdm_channel_get_last_state(const ftdm_channel_t *ftdmchan) +{ + int last_state; + ftdm_channel_lock(ftdmchan); + last_state = ftdmchan->last_state; + ftdm_channel_unlock(ftdmchan); + return last_state; +} + +FT_DECLARE(const char *) ftdm_channel_get_last_state_str(const ftdm_channel_t *ftdmchan) +{ + const char *state; + ftdm_channel_lock(ftdmchan); + state = ftdm_channel_state2str(ftdmchan->last_state); + ftdm_channel_unlock(ftdmchan); + return state; +} + +static void write_history_entry(const ftdm_channel_t *fchan, ftdm_stream_handle_t *stream, int i, ftdm_time_t *prevtime) +{ + char func[255]; + char line[255]; + char states[255]; + const char *filename = NULL; + snprintf(states, sizeof(states), "%-5.15s => %-5.15s", ftdm_channel_state2str(fchan->history[i].last_state), ftdm_channel_state2str(fchan->history[i].state)); + snprintf(func, sizeof(func), "[%s]", fchan->history[i].func); + filename = strrchr(fchan->history[i].file, *FTDM_PATH_SEPARATOR); + if (!filename) { + filename = fchan->history[i].file; + } else { + filename++; + } + if (!(*prevtime)) { + *prevtime = fchan->history[i].time; + } + snprintf(line, sizeof(func), "[%s:%d]", filename, fchan->history[i].line); + stream->write_function(stream, "%-30.30s %-30.30s %-30.30s %lums\n", states, func, line, (fchan->history[i].time - *prevtime)); + *prevtime = fchan->history[i].time; +} + +FT_DECLARE(char *) ftdm_channel_get_history_str(const ftdm_channel_t *fchan) +{ + uint8_t i = 0; + ftdm_time_t currtime = 0; + ftdm_time_t prevtime = 0; + + ftdm_stream_handle_t stream = { 0 }; + FTDM_STANDARD_STREAM(stream); + if (!fchan->history[0].file) { + stream.write_function(&stream, "-- No state history --\n"); + return stream.data; + } + + stream.write_function(&stream, "%-30.30s %-30.30s %-30.30s %s", + "-- States --", "-- Function --", "-- Location --", "-- Time Offset --\n"); + + for (i = fchan->hindex; i < ftdm_array_len(fchan->history); i++) { + if (!fchan->history[i].file) { + break; + } + write_history_entry(fchan, &stream, i, &prevtime); + } + + for (i = 0; i < fchan->hindex; i++) { + write_history_entry(fchan, &stream, i, &prevtime); + } + + currtime = ftdm_current_time_in_ms(); + + stream.write_function(&stream, "\nTime since last state change: %lums\n", (currtime - prevtime)); + + return stream.data; +} + +FT_DECLARE(ftdm_status_t) ftdm_channel_advance_states(ftdm_channel_t *fchan, ftdm_channel_state_processor_t state_processor) +{ + ftdm_channel_state_t state; + + ftdm_channel_lock(fchan); + while (fchan->state_status == FTDM_STATE_STATUS_NEW) { + state = fchan->state; + state_processor(fchan); + if (state == fchan->state) { + /* if the state did not change, the state status must go to PROCESSED + * otherwise we don't touch it since is a new state and the old state was + * already completed implicitly by the state_processor() function via some internal + * call to ftdm_set_state() */ + fchan->state_status = FTDM_STATE_STATUS_PROCESSED; + } + } + ftdm_channel_unlock(fchan); + return FTDM_SUCCESS; +} + +FT_DECLARE(int) ftdm_check_state_all(ftdm_span_t *span, ftdm_channel_state_t state) +{ + uint32_t j; + for(j = 1; j <= span->chan_count; j++) { + if (span->channels[j]->state != state || ftdm_test_flag(span->channels[j], FTDM_CHANNEL_STATE_CHANGE)) { + return 0; + } + } + return 1; +} + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4: + */ diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 68c9fdc..30fe6ca 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -440,6 +440,7 @@ typedef struct { * This is used during incoming calls when you want to request the signaling stack * to notify about indications occurring locally. See ftdm_channel_call_indicate for more info */ typedef enum { + FTDM_CHANNEL_INDICATE_NONE, FTDM_CHANNEL_INDICATE_RINGING, FTDM_CHANNEL_INDICATE_PROCEED, FTDM_CHANNEL_INDICATE_PROGRESS, @@ -449,7 +450,7 @@ typedef enum { FTDM_CHANNEL_INDICATE_ANSWER, FTDM_CHANNEL_INDICATE_INVALID, } ftdm_channel_indication_t; -#define INDICATION_STRINGS "RINGING", "PROCEED", "PROGRESS", "PROGRESS_MEDIA", "BUSY", "ANSWER", "INVALID" +#define INDICATION_STRINGS "NONE", "RINGING", "PROCEED", "PROGRESS", "PROGRESS_MEDIA", "BUSY", "ANSWER", "INVALID" /*! \brief Move from string to ftdm_channel_indication_t and viceversa */ FTDM_STR2ENUM_P(ftdm_str2channel_indication, ftdm_channel_indication2str, ftdm_channel_indication_t) diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index dd70dd1..8f97456 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -192,17 +192,6 @@ extern "C" { #define ftdm_clear_sflag_locked(obj, flag) assert(obj->mutex != NULL); ftdm_mutex_lock(obj->mutex); (obj)->sflags &= ~(flag); ftdm_mutex_unlock(obj->mutex); -#define ftdm_set_state(obj, s) ftdm_channel_set_state(__FILE__, __FUNCTION__, __LINE__, obj, s, 0); \ - -#define ftdm_set_state_locked(obj, s) \ - do { \ - ftdm_channel_lock(obj); \ - ftdm_channel_set_state(__FILE__, __FUNCTION__, __LINE__, obj, s, 0); \ - ftdm_channel_unlock(obj); \ - } while(0); - -#define ftdm_set_state_r(obj, s, r) r = ftdm_channel_set_state(__FILE__, __FUNCTION__, __LINE__, obj, s, 0); - #ifdef _MSC_VER /* The while(0) below throws a conditional expression is constant warning */ #pragma warning(disable:4127) @@ -363,15 +352,6 @@ typedef struct { ftdm_mutex_t *mutex; } ftdm_dtmf_debug_t; -typedef struct { - const char *file; - const char *func; - int line; - ftdm_channel_state_t state; - ftdm_channel_state_t last_state; - ftdm_time_t time; -} ftdm_channel_history_entry_t; - typedef enum { FTDM_IOSTATS_ERROR_CRC = (1 << 0), FTDM_IOSTATS_ERROR_FRAME = (1 << 1), @@ -424,9 +404,11 @@ struct ftdm_channel { uint32_t native_interval; uint32_t packet_len; ftdm_channel_state_t state; + ftdm_state_status_t state_status; ftdm_channel_state_t last_state; ftdm_channel_state_t init_state; - ftdm_channel_history_entry_t history[10]; + ftdm_channel_indication_t indication; + ftdm_state_history_entry_t history[10]; uint8_t hindex; ftdm_mutex_t *mutex; teletone_dtmf_detect_state_t dtmf_detect; @@ -572,9 +554,6 @@ FT_DECLARE(ftdm_status_t) ftdm_fsk_data_add_checksum(ftdm_fsk_data_state_t *stat FT_DECLARE(ftdm_status_t) ftdm_fsk_data_add_sdmf(ftdm_fsk_data_state_t *state, const char *date, char *number); FT_DECLARE(ftdm_status_t) ftdm_channel_send_fsk_data(ftdm_channel_t *ftdmchan, ftdm_fsk_data_state_t *fsk_data, float db_level); -FT_DECLARE(ftdm_status_t) ftdm_channel_set_state(const char *file, const char *func, int line, - ftdm_channel_t *ftdmchan, ftdm_channel_state_t state, int wait); - FT_DECLARE(ftdm_status_t) ftdm_span_load_tones(ftdm_span_t *span, const char *mapname); FT_DECLARE(ftdm_time_t) ftdm_current_time_in_ms(void); @@ -589,8 +568,6 @@ FT_DECLARE(void) print_hex_bytes(uint8_t *data, ftdm_size_t dlen, char *buf, ftd FT_DECLARE_NONSTD(int) ftdm_hash_equalkeys(void *k1, void *k2); FT_DECLARE_NONSTD(uint32_t) ftdm_hash_hashfromstring(void *ky); -FT_DECLARE(ftdm_status_t) ftdm_channel_complete_state(ftdm_channel_t *ftdmchan); - FT_DECLARE(int) ftdm_load_modules(void); FT_DECLARE(ftdm_status_t) ftdm_unload_modules(void); @@ -707,30 +684,6 @@ static __inline__ void ftdm_abort(void) #endif } -static __inline__ void ftdm_set_state_all(ftdm_span_t *span, ftdm_channel_state_t state) -{ - uint32_t j; - ftdm_mutex_lock(span->mutex); - for(j = 1; j <= span->chan_count; j++) { - if (!FTDM_IS_DCHAN(span->channels[j])) { - ftdm_set_state_locked((span->channels[j]), state); - } - } - ftdm_mutex_unlock(span->mutex); -} - -static __inline__ int ftdm_check_state_all(ftdm_span_t *span, ftdm_channel_state_t state) -{ - uint32_t j; - for(j = 1; j <= span->chan_count; j++) { - if (span->channels[j]->state != state || ftdm_test_flag(span->channels[j], FTDM_CHANNEL_STATE_CHANGE)) { - return 0; - } - } - - return 1; -} - static __inline__ int16_t ftdm_saturated_add(int16_t sample1, int16_t sample2) { int addres; diff --git a/libs/freetdm/src/include/private/ftdm_state.h b/libs/freetdm/src/include/private/ftdm_state.h new file mode 100644 index 0000000..79a3df0 --- /dev/null +++ b/libs/freetdm/src/include/private/ftdm_state.h @@ -0,0 +1,218 @@ +/* + * Copyright (c) 2010, Sangoma Technologies + * Moises Silva <moy@sangoma.com> + * 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 original author; nor the names of any 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 OWNER + * 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. + */ + +#ifndef __FTDM_STATE_H__ +#define __FTDM_STATE_H__ + +/*! \file + * \brief State handling definitions + * \note Most, if not all of the state handling functions assume you have a lock acquired. Touching the channel + * state is a sensitive matter that requires checks and careful thought and is typically a process that + * is not encapsulated within a single function, therefore the lock must be explicitly acquired by the + * caller (most of the time, signaling modules), process states, set a new state and process it, and + * finally unlock the channel. See docs/locking.txt fore more info + */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + FTDM_CHANNEL_STATE_DOWN, + FTDM_CHANNEL_STATE_HOLD, + FTDM_CHANNEL_STATE_SUSPENDED, + FTDM_CHANNEL_STATE_DIALTONE, + FTDM_CHANNEL_STATE_COLLECT, + FTDM_CHANNEL_STATE_RING, + FTDM_CHANNEL_STATE_RINGING, + FTDM_CHANNEL_STATE_BUSY, + FTDM_CHANNEL_STATE_ATTN, + FTDM_CHANNEL_STATE_GENRING, + FTDM_CHANNEL_STATE_DIALING, + FTDM_CHANNEL_STATE_GET_CALLERID, + FTDM_CHANNEL_STATE_CALLWAITING, + FTDM_CHANNEL_STATE_RESTART, + FTDM_CHANNEL_STATE_PROCEED, + FTDM_CHANNEL_STATE_PROGRESS, + FTDM_CHANNEL_STATE_PROGRESS_MEDIA, + FTDM_CHANNEL_STATE_UP, + FTDM_CHANNEL_STATE_IDLE, + FTDM_CHANNEL_STATE_TERMINATING, + FTDM_CHANNEL_STATE_CANCEL, + FTDM_CHANNEL_STATE_HANGUP, + FTDM_CHANNEL_STATE_HANGUP_COMPLETE, + FTDM_CHANNEL_STATE_IN_LOOP, + FTDM_CHANNEL_STATE_RESET, + FTDM_CHANNEL_STATE_INVALID +} ftdm_channel_state_t; +#define CHANNEL_STATE_STRINGS "DOWN", "HOLD", "SUSPENDED", "DIALTONE", "COLLECT", \ + "RING", "RINGING", "BUSY", "ATTN", "GENRING", "DIALING", "GET_CALLERID", "CALLWAITING", \ + "RESTART", "PROCEED", "PROGRESS", "PROGRESS_MEDIA", "UP", "IDLE", "TERMINATING", "CANCEL", \ + "HANGUP", "HANGUP_COMPLETE", "IN_LOOP", "RESET", "INVALID" +FTDM_STR2ENUM_P(ftdm_str2ftdm_channel_state, ftdm_channel_state2str, ftdm_channel_state_t) + +typedef struct { + const char *file; + const char *func; + int line; + ftdm_channel_state_t state; + ftdm_channel_state_t last_state; + ftdm_time_t time; + ftdm_time_t end_time; +} ftdm_state_history_entry_t; + +typedef ftdm_status_t (*ftdm_channel_state_processor_t)(ftdm_channel_t *fchan); + +FT_DECLARE(ftdm_status_t) ftdm_channel_advance_states(ftdm_channel_t *fchan, ftdm_channel_state_processor_t processor); +FT_DECLARE(ftdm_status_t) _ftdm_channel_complete_state(const char *file, const char *function, int line, ftdm_channel_t *fchan); +#define ftdm_channel_complete_state(obj) _ftdm_channel_complete_state(__FILE__, __FUNCTION__, __LINE__, obj) +FT_DECLARE(int) ftdm_check_state_all(ftdm_span_t *span, ftdm_channel_state_t state); + +/*! + * \brief Status of the current channel state + * \note A given state goes thru several status (yes, states for the state!) + * The order is always FTDM_STATE_STATUS_NEW -> FTDM_STATE_STATUS_PROCESSED -> FTDM_STATUS_COMPLETED + * However, is possible to go from NEW -> COMPLETED directly when the signaling module explicitly changes + * the state of the channel in the middle of processing the current state by calling the ftdm_set_state() API + * + * FTDM_STATE_STATUS_NEW - + * Someone just set the state of the channel, either the signaling module or the user (implicitly through a call API). + * This is accomplished by calling ftdm_channel_set_state() which changes the 'state' and 'last_state' memebers of + * the ftdm_channel_t structure. + * + * FTDM_STATE_STATUS_PROCESSED - + * The signaling module did something based on the new state. + * + * This is accomplished via ftdm_channel_advance_states() + * + * When ftdm_channel_advance_states(), at the very least, if the channel has its state in FTDM_STATE_STATUS_NEW, it + * will move to FTDM_STATE_STATUS_PROCESSED, depending on what the signaling module does during the processing + * the state may move to FTDM_STATE_STATUS_COMPLETED right after or wait for a signaling specific event to complete it. + * It is also possible that more state transitions occur during the execution of ftdm_channel_advance_states() if one + * state processing/completion leads to another state change, the function will not return until the chain of events + * lead to a state that is not in FTDM_STATE_STATUS_NEW + * + * FTDM_STATE_STATUS_COMPLETED - + * The signaling module completed the processing of the state and there is nothing further to be done for this state. + * + * This is accomplished either explicitly by the signaling module by calling ftdm_channel_complete_state() or by + * the signaling module implicitly by trying to set the state of the channel to a new state via ftdm_set_state() + * + * When working with blocking channels (FTDM_CHANNEL_NONBLOCK flag not set), the user thread is signaled and unblocked + * so it can continue. + * + * When a state moves to this status is also possible for a signal FTDM_SIGEVENT_INDICATION_COMPLETED to be delivered + * by the core if the state change was associated to an indication requested by the user, + */ +typedef enum { + FTDM_STATE_STATUS_NEW, + FTDM_STATE_STATUS_PROCESSED, + FTDM_STATE_STATUS_COMPLETED +} ftdm_state_status_t; + +typedef enum { + ZSM_NONE, + ZSM_UNACCEPTABLE, + ZSM_ACCEPTABLE +} ftdm_state_map_type_t; + +typedef enum { + ZSD_INBOUND, + ZSD_OUTBOUND, +} ftdm_state_direction_t; + +#define FTDM_MAP_NODE_SIZE 512 +#define FTDM_MAP_MAX FTDM_CHANNEL_STATE_INVALID+2 + +struct ftdm_state_map_node { + ftdm_state_direction_t direction; + ftdm_state_map_type_t type; + ftdm_channel_state_t check_states[FTDM_MAP_MAX]; + ftdm_channel_state_t states[FTDM_MAP_MAX]; +}; +typedef struct ftdm_state_map_node ftdm_state_map_node_t; + +struct ftdm_state_map { + ftdm_state_map_node_t nodes[FTDM_MAP_NODE_SIZE]; +}; +typedef struct ftdm_state_map ftdm_state_map_t; + +FT_DECLARE(ftdm_status_t) ftdm_channel_set_state(const char *file, const char *func, int line, + ftdm_channel_t *ftdmchan, ftdm_channel_state_t state, int wait); + +/*!\brief Set the state of a channel immediately and implicitly complete the previous state */ +FT_DECLARE(ftdm_status_t) _ftdm_set_state(const char *file, const char *func, int line, + ftdm_channel_t *fchan, ftdm_channel_state_t state); +#define ftdm_set_state(obj, s) _ftdm_set_state(__FILE__, __FUNCTION__, __LINE__, obj, s); \ + +/*!\brief This macro is deprecated, signaling modules should always lock the channel themselves anyways since they must + * process first the user pending state changes then set a new state before releasing the lock + */ +#define ftdm_set_state_locked(obj, s) \ + do { \ + ftdm_channel_lock(obj); \ + ftdm_channel_set_state(__FILE__, __FUNCTION__, __LINE__, obj, s, 0); \ + ftdm_channel_unlock(obj); \ + } while(0); + +#define ftdm_set_state_r(obj, s, r) r = ftdm_channel_set_state(__FILE__, __FUNCTION__, __LINE__, obj, s, 0); + +#define ftdm_set_state_all(span, state) \ + do { \ + uint32_t _j; \ + ftdm_mutex_lock((span)->mutex); \ + for(_j = 1; _j <= (span)->chan_count; _j++) { \ + if (!FTDM_IS_DCHAN(span->channels[_j])) { \ + ftdm_set_state_locked((span->channels[_j]), state); \ + } \ + } \ + ftdm_mutex_unlock((span)->mutex); \ + } while (0); + +#ifdef __cplusplus +} +#endif + +#endif + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4: + */ diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index d70bc69..c4d48a8 100644 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -204,40 +204,6 @@ typedef enum { FTDM_CHANNEL_FEATURE_IO_STATS = (1<<9), /*!< Channel supports IO statistics (HDLC channels only) */ } ftdm_channel_feature_t; -typedef enum { - FTDM_CHANNEL_STATE_DOWN, - FTDM_CHANNEL_STATE_HOLD, - FTDM_CHANNEL_STATE_SUSPENDED, - FTDM_CHANNEL_STATE_DIALTONE, - FTDM_CHANNEL_STATE_COLLECT, - FTDM_CHANNEL_STATE_RING, - FTDM_CHANNEL_STATE_RINGING, - FTDM_CHANNEL_STATE_BUSY, - FTDM_CHANNEL_STATE_ATTN, - FTDM_CHANNEL_STATE_GENRING, - FTDM_CHANNEL_STATE_DIALING, - FTDM_CHANNEL_STATE_GET_CALLERID, - FTDM_CHANNEL_STATE_CALLWAITING, - FTDM_CHANNEL_STATE_RESTART, - FTDM_CHANNEL_STATE_PROCEED, - FTDM_CHANNEL_STATE_PROGRESS, - FTDM_CHANNEL_STATE_PROGRESS_MEDIA, - FTDM_CHANNEL_STATE_UP, - FTDM_CHANNEL_STATE_IDLE, - FTDM_CHANNEL_STATE_TERMINATING, - FTDM_CHANNEL_STATE_CANCEL, - FTDM_CHANNEL_STATE_HANGUP, - FTDM_CHANNEL_STATE_HANGUP_COMPLETE, - FTDM_CHANNEL_STATE_IN_LOOP, - FTDM_CHANNEL_STATE_RESET, - FTDM_CHANNEL_STATE_INVALID -} ftdm_channel_state_t; -#define CHANNEL_STATE_STRINGS "DOWN", "HOLD", "SUSPENDED", "DIALTONE", "COLLECT", \ - "RING", "RINGING", "BUSY", "ATTN", "GENRING", "DIALING", "GET_CALLERID", "CALLWAITING", \ - "RESTART", "PROCEED", "PROGRESS", "PROGRESS_MEDIA", "UP", "IDLE", "TERMINATING", "CANCEL", \ - "HANGUP", "HANGUP_COMPLETE", "IN_LOOP", "RESET", "INVALID" -FTDM_STR2ENUM_P(ftdm_str2ftdm_channel_state, ftdm_channel_state2str, ftdm_channel_state_t) - /*!< Channel flags. This used to be an enum but we reached the 32bit limit for enums, is safer this way */ #define FTDM_CHANNEL_CONFIGURED (1ULL << 0) #define FTDM_CHANNEL_READY (1ULL << 1) @@ -282,33 +248,10 @@ FTDM_STR2ENUM_P(ftdm_str2ftdm_channel_state, ftdm_channel_state2str, ftdm_channe #define FTDM_CHANNEL_CALL_STARTED (1ULL << 32) /*!< The user wants non-blocking operations in the channel */ #define FTDM_CHANNEL_NONBLOCK (1ULL << 33) +/*!< There is a pending acknowledge for an indication */ +#define FTDM_CHANNEL_IND_ACK_PENDING (1ULL << 34) -typedef enum { - ZSM_NONE, - ZSM_UNACCEPTABLE, - ZSM_ACCEPTABLE -} ftdm_state_map_type_t; - -typedef enum { - ZSD_INBOUND, - ZSD_OUTBOUND, -} ftdm_state_direction_t; - -#define FTDM_MAP_NODE_SIZE 512 -#define FTDM_MAP_MAX FTDM_CHANNEL_STATE_INVALID+2 - -struct ftdm_state_map_node { - ftdm_state_direction_t direction; - ftdm_state_map_type_t type; - ftdm_channel_state_t check_states[FTDM_MAP_MAX]; - ftdm_channel_state_t states[FTDM_MAP_MAX]; -}; -typedef struct ftdm_state_map_node ftdm_state_map_node_t; - -struct ftdm_state_map { - ftdm_state_map_node_t nodes[FTDM_MAP_NODE_SIZE]; -}; -typedef struct ftdm_state_map ftdm_state_map_t; +#include "ftdm_state.h" typedef enum ftdm_channel_hw_link_status { FTDM_HW_LINK_DISCONNECTED = 0, commit 55dbbcf195b9ad150cf0d77c39693fe1e5f1009e Author: Jeff Lenk <jeff@jefflenk.com> Date: Fri Dec 24 09:41:31 2010 -0600 add vs2008 windows lua-esl build files diff --git a/libs/esl/lua/esl_lua.2008.sln b/libs/esl/lua/esl_lua.2008.sln new file mode 100644 index 0000000..cdfbd44 --- /dev/null +++ b/libs/esl/lua/esl_lua.2008.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ESL", "esl_lua.2008.vcproj", "{86B6AB99-A261-455A-9CD6-9142A5A1652E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {86B6AB99-A261-455A-9CD6-9142A5A1652E}.Debug|Win32.ActiveCfg = Debug|Win32 + {86B6AB99-A261-455A-9CD6-9142A5A1652E}.Debug|Win32.Build.0 = Debug|Win32 + {86B6AB99-A261-455A-9CD6-9142A5A1652E}.Debug|x64.ActiveCfg = Debug|x64 + {86B6AB99-A261-455A-9CD6-9142A5A1652E}.Debug|x64.Build.0 = Debug|x64 + {86B6AB99-A261-455A-9CD6-9142A5A1652E}.Release|Win32.ActiveCfg = Release|Win32 + {86B6AB99-A261-455A-9CD6-9142A5A1652E}.Release|Win32.Build.0 = Release|Win32 + {86B6AB99-A261-455A-9CD6-9142A5A1652E}.Release|x64.ActiveCfg = Release|x64 + {86B6AB99-A261-455A-9CD6-9142A5A1652E}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/libs/esl/lua/esl_lua.2008.vcproj b/libs/esl/lua/esl_lua.2008.vcproj new file mode 100644 index 0000000..38111c8 --- /dev/null +++ b/libs/esl/lua/esl_lua.2008.vcproj @@ -0,0 +1,351 @@ +<?xml version="1.0" encoding="UTF-8"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="ESL" + ProjectGUID="{86B6AB99-A261-455A-9CD6-9142A5A1652E}" + RootNamespace="esl_lua.2008" + Keyword="Win32Proj" + TargetFrameworkVersion="0" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="Debug" + IntermediateDirectory="Debug" + ConfigurationType="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\src\mod\languages\mod_lua\lua\";"$(ProjectDir)..\src\include"" + PreprocessorDefinitions="ESL_DECLARE_STATIC;WIN32" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="esl.lib lua5.1.lib ws2_32.lib" + LinkIncremental="2" + AdditionalLibraryDirectories=""$(ProjectDir)..\..\..\$(ConfigurationName)";"$(ProjectDir)..\..\..\src\mod\languages\mod_lua\lua\$(ConfigurationName)"" + GenerateDebugInformation="true" + SubSystem="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="Release" + IntermediateDirectory="Release" + ConfigurationType="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\src\mod\languages\mod_lua\lua\";"$(ProjectDir)..\src\include"" + PreprocessorDefinitions="ESL_DECLARE_STATIC;WIN32" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="esl.lib lua5.1.lib ws2_32.lib" + LinkIncremental="2" + AdditionalLibraryDirectories=""$(ProjectDir)..\..\..\$(ConfigurationName)";"$(ProjectDir)..\..\..\src\mod\languages\mod_lua\lua\$(ConfigurationName)"" + GenerateDebugInformation="true" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\src\mod\languages\mod_lua\lua\";"$(ProjectDir)..\src\include"" + PreprocessorDefinitions="ESL_DECLARE_STATIC;WIN32" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="esl.lib lua5.1.lib ws2_32.lib" + LinkIncremental="2" + AdditionalLibraryDirectories=""$(ProjectDir)..\..\..\$(PlatformName)\$(ConfigurationName)";"$(ProjectDir)..\..\..\src\mod\languages\mod_lua\lua\$(PlatformName)\$(ConfigurationName)"" + GenerateDebugInformation="true" + SubSystem="2" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories=""$(ProjectDir)..\..\..\src\mod\languages\mod_lua\lua\";"$(ProjectDir)..\src\include"" + PreprocessorDefinitions="ESL_DECLARE_STATIC;WIN32" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="esl.lib lua5.1.lib ws2_32.lib" + LinkIncremental="2" + AdditionalLibraryDirectories=""$(ProjectDir)..\..\..\$(PlatformName)\$(ConfigurationName)";"$(ProjectDir)..\..\..\src\mod\languages\mod_lua\lua\$(PlatformName)\$(ConfigurationName)"" + GenerateDebugInformation="true" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath="..\src\esl_oop.cpp" + > + </File> + <File + RelativePath=".\esl_wrap.cpp" + > + </File> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> commit 82297de7532cbc6043d77f541772f942cde2039f Author: Moises Silva <moy@sangoma.com> Date: Thu Dec 23 19:50:13 2010 -0500 freetdm: state refactoring in progress *shrug* diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 89e9321..161ccdc 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -268,9 +268,6 @@ FTDM_STR2ENUM(ftdm_str2ftdm_analog_start_type, ftdm_analog_start_type2str, ftdm_ FTDM_ENUM_NAMES(SIGNAL_NAMES, SIGNAL_STRINGS) FTDM_STR2ENUM(ftdm_str2ftdm_signal_event, ftdm_signal_event2str, ftdm_signal_event_t, SIGNAL_NAMES, FTDM_SIGEVENT_INVALID) -FTDM_ENUM_NAMES(CHANNEL_STATE_NAMES, CHANNEL_STATE_STRINGS) -FTDM_STR2ENUM(ftdm_str2ftdm_channel_state, ftdm_channel_state2str, ftdm_channel_state_t, CHANNEL_STATE_NAMES, FTDM_CHANNEL_STATE_INVALID) - FTDM_ENUM_NAMES(MDMF_TYPE_NAMES, MDMF_STRINGS) FTDM_STR2ENUM(ftdm_str2ftdm_mdmf_type, ftdm_mdmf_type2str, ftdm_mdmf_type_t, MDMF_TYPE_NAMES, MDMF_INVALID) @@ -1352,243 +1349,6 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_add_token(ftdm_channel_t *ftdmchan, char } -FT_DECLARE(ftdm_status_t) ftdm_channel_complete_state(ftdm_channel_t *ftdmchan) -{ - ftdm_channel_state_t state = ftdmchan->state; - - if (state == FTDM_CHANNEL_STATE_PROGRESS) { - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_PROGRESS); - } else if (state == FTDM_CHANNEL_STATE_UP) { - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_PROGRESS); - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_MEDIA); - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_ANSWERED); - } else if (state == FTDM_CHANNEL_STATE_PROGRESS_MEDIA) { - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_PROGRESS); - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_MEDIA); - } - - return FTDM_SUCCESS; -} - -static int ftdm_parse_state_map(ftdm_channel_t *ftdmchan, ftdm_channel_state_t state, ftdm_state_map_t *state_map) -{ - int x = 0, ok = 0; - ftdm_state_direction_t direction = ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) ? ZSD_OUTBOUND : ZSD_INBOUND; - - for(x = 0; x < FTDM_MAP_NODE_SIZE; x++) { - int i = 0, proceed = 0; - if (!state_map->nodes[x].type) { - break; - } - - if (state_map->nodes[x].direction != direction) { - continue; - } - - if (state_map->nodes[x].check_states[0] == FTDM_ANY_STATE) { - proceed = 1; - } else { - for(i = 0; i < FTDM_MAP_MAX; i++) { - if (state_map->nodes[x].check_states[i] == ftdmchan->state) { - proceed = 1; - break; - } - } - } - - if (!proceed) { - continue; - } - - for(i = 0; i < FTDM_MAP_MAX; i++) { - ok = (state_map->nodes[x].type == ZSM_ACCEPTABLE); - if (state_map->nodes[x].states[i] == FTDM_END) { - break; - } - if (state_map->nodes[x].states[i] == state) { - ok = !ok; - goto end; - } - } - } - end: - - return ok; -} - -/* this function MUST be called with the channel lock held. If waitrq == 1, the channel will be unlocked/locked (never call it with waitrq == 1 with an lock recursivity > 1) */ -#define DEFAULT_WAIT_TIME 1000 -FT_DECLARE(ftdm_status_t) ftdm_channel_set_state(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_channel_state_t state, int waitrq) -{ - int ok = 1; - int waitms = DEFAULT_WAIT_TIME; - - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_READY)) { - ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_ERROR, "Ignored state change request from %s to %s, the channel is not ready\n", - ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state)); - return FTDM_FAIL; - } - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { - ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_ERROR, "Ignored state change request from %s to %s, the previous state change has not been processed yet\n", - ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state)); - return FTDM_FAIL; - } - - if (ftdmchan->state == state) { - ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_WARNING, "Why bother changing state from %s to %s\n", ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state)); - return FTDM_FAIL; - } - - if (ftdmchan->span->state_map) { - ok = ftdm_parse_state_map(ftdmchan, state, ftdmchan->span->state_map); - goto end; - } - - /* basic core state validation (by-passed if the signaling module provides a state_map) */ - switch(ftdmchan->state) { - case FTDM_CHANNEL_STATE_HANGUP: - case FTDM_CHANNEL_STATE_TERMINATING: - { - ok = 0; - switch(state) { - case FTDM_CHANNEL_STATE_DOWN: - case FTDM_CHANNEL_STATE_BUSY: - case FTDM_CHANNEL_STATE_RESTART: - ok = 1; - break; - default: - break; - } - } - break; - case FTDM_CHANNEL_STATE_UP: - { - ok = 1; - switch(state) { - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - case FTDM_CHANNEL_STATE_RING: - ok = 0; - break; - default: - break; - } - } - break; - case FTDM_CHANNEL_STATE_DOWN: - { - ok = 0; - - switch(state) { - case FTDM_CHANNEL_STATE_DIALTONE: - case FTDM_CHANNEL_STATE_COLLECT: - case FTDM_CHANNEL_STATE_DIALING: - case FTDM_CHANNEL_STATE_RING: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_IDLE: - case FTDM_CHANNEL_STATE_GET_CALLERID: - case FTDM_CHANNEL_STATE_GENRING: - ok = 1; - break; - default: - break; - } - } - break; - case FTDM_CHANNEL_STATE_BUSY: - { - switch(state) { - case FTDM_CHANNEL_STATE_UP: - ok = 0; - break; - default: - break; - } - } - break; - case FTDM_CHANNEL_STATE_RING: - { - switch(state) { - case FTDM_CHANNEL_STATE_UP: - ok = 1; - break; - default: - break; - } - } - break; - default: - break; - } - -end: - - if (ok) { - ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_DEBUG, "Changed state from %s to %s\n", ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state)); - ftdmchan->last_state = ftdmchan->state; - ftdmchan->state = state; - ftdmchan->history[ftdmchan->hindex].file = file; - ftdmchan->history[ftdmchan->hindex].func = func; - ftdmchan->history[ftdmchan->hindex].line = line; - ftdmchan->history[ftdmchan->hindex].state = ftdmchan->state; - ftdmchan->history[ftdmchan->hindex].last_state = ftdmchan->last_state; - ftdmchan->history[ftdmchan->hindex].time = ftdm_current_time_in_ms(); - ftdmchan->hindex++; - if (ftdmchan->hindex == ftdm_array_len(ftdmchan->history)) { - ftdmchan->hindex = 0; - } - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE); - - ftdm_mutex_lock(ftdmchan->span->mutex); - ftdm_set_flag(ftdmchan->span, FTDM_SPAN_STATE_CHANGE); - if (ftdmchan->span->pendingchans) { - ftdm_queue_enqueue(ftdmchan->span->pendingchans, ftdmchan); - } - ftdm_mutex_unlock(ftdmchan->span->mutex); - } else { - ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_WARNING, "VETO state change from %s to %s\n", ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state)); - goto done; - } - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_NONBLOCK)) { - /* the channel should not block waiting for state processing */ - goto done; - } - - /* there is an inherent race here between set and check of the change flag but we do not care because - * the flag should never last raised for more than a few ms for any state change */ - while (waitrq && waitms > 0) { - /* give a chance to the signaling stack to process it */ - ftdm_mutex_unlock(ftdmchan->mutex); - - ftdm_sleep(10); - waitms -= 10; - - ftdm_mutex_lock(ftdmchan->mutex); - - /* if the flag is no longer set, the state change was processed (or is being processed) */ - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { - break; - } - - /* if the state is no longer what we set, the state change was - * obviously processed (and the current state change flag is for other state change) */ - if (ftdmchan->state != state) { - break; - } - } - - if (waitms <= 0) { - ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_WARNING, "state change from %s to %s was most likely not processed after aprox %dms\n", - ftdm_channel_state2str(ftdmchan->last_state), ftdm_channel_state2str(state), DEFAULT_WAIT_TIME); - ok = 0; - } -done: - return ok ? FTDM_SUCCESS : FTDM_FAIL; -} - FT_DECLARE(uint32_t) ftdm_group_get_id(const ftdm_group_t *group) { return group->group_id; @@ -1948,17 +1708,6 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_span(uint32_t span_id, ftdm_direc return status; } - -FT_DECLARE(ftdm_status_t) ftdm_channel_init(ftdm_channel_t *ftdmchan) -{ - if (ftdmchan->init_state != FTDM_CHANNEL_STATE_DOWN) { - ftdm_set_state(ftdmchan, ftdmchan->init_state); - ftdmchan->init_state = FTDM_CHANNEL_STATE_DOWN; - } - - return FTDM_SUCCESS; -} - FT_DECLARE(ftdm_status_t) ftdm_channel_open_chan(ftdm_channel_t *ftdmchan) { ftdm_status_t status = FTDM_FAIL; @@ -2415,42 +2164,6 @@ FT_DECLARE(ftdm_caller_data_t *) ftdm_channel_get_caller_data(ftdm_channel_t *ft return &ftdmchan->caller_data; } -FT_DECLARE(int) ftdm_channel_get_state(const ftdm_channel_t *ftdmchan) -{ - int state; - ftdm_channel_lock(ftdmchan); - state = ftdmchan->state; - ftdm_channel_unlock(ftdmchan); - return state; -} - -FT_DECLARE(const char *) ftdm_channel_get_state_str(const ftdm_channel_t *ftdmchan) -{ - const char *state; - ftdm_channel_lock(ftdmchan); - state = ftdm_channel_state2str(ftdmchan->state); - ftdm_channel_unlock(ftdmchan); - return state; -} - -FT_DECLARE(int) ftdm_channel_get_last_state(const ftdm_channel_t *ftdmchan) -{ - int last_state; - ftdm_channel_lock(ftdmchan); - last_state = ftdmchan->last_state; - ftdm_channel_unlock(ftdmchan); - return last_state; -} - -FT_DECLARE(const char *) ftdm_channel_get_last_state_str(const ftdm_channel_t *ftdmchan) -{ - const char *state; - ftdm_channel_lock(ftdmchan); - state = ftdm_channel_state2str(ftdmchan->last_state); - ftdm_channel_unlock(ftdmchan); - return state; -} - FT_DECLARE(ftdm_channel_t *) ftdm_span_get_channel(const ftdm_span_t *span, uint32_t chanid) { ftdm_channel_t *chan; @@ -6184,63 +5897,6 @@ FT_DECLARE(char *) ftdm_strndup(const char *str, ftdm_size_t inlen) return new; } - -static void write_history_entry(const ftdm_channel_t *fchan, ftdm_stream_handle_t *stream, int i, ftdm_time_t *prevtime) -{ - char func[255]; - char line[255]; - char states[255]; - const char *filename = NULL; - snprintf(states, sizeof(states), "%-5.15s => %-5.15s", ftdm_channel_state2str(fchan->history[i].last_state), ftdm_channel_state2str(fchan->history[i].state)); - snprintf(func, sizeof(func), "[%s]", fchan->history[i].func); - filename = strrchr(fchan->history[i].file, *FTDM_PATH_SEPARATOR); - if (!filename) { - filename = fchan->history[i].file; - } else { - filename++; - } - if (!(*prevtime)) { - *prevtime = fchan->history[i].time; - } - snprintf(line, sizeof(func), "[%s:%d]", filename, fchan->history[i].line); - stream->write_function(stream, "%-30.30s %-30.30s %-30.30s %lums\n", states, func, line, (fchan->history[i].time - *prevtime)); - *prevtime = fchan->history[i].time; -} - -FT_DECLARE(char *) ftdm_channel_get_history_str(const ftdm_channel_t *fchan) -{ - uint8_t i = 0; - ftdm_time_t currtime = 0; - ftdm_time_t prevtime = 0; - - ftdm_stream_handle_t stream = { 0 }; - FTDM_STANDARD_STREAM(stream); - if (!fchan->history[0].file) { - stream.write_function(&stream, "-- No state history --\n"); - return stream.data; - } - - stream.write_function(&stream, "%-30.30s %-30.30s %-30.30s %s", - "-- States --", "-- Function --", "-- Location --", "-- Time Offset --\n"); - - for (i = fchan->hindex; i < ftdm_array_len(fchan->history); i++) { - if (!fchan->history[i].file) { - break; - } - write_history_entry(fchan, &stream, i, &prevtime); - } - - for (i = 0; i < fchan->hindex; i++) { - write_history_entry(fchan, &stream, i, &prevtime); - } - - currtime = ftdm_current_time_in_ms(); - - stream.write_function(&stream, "\nTime since last state change: %lums\n", (currtime - prevtime)); - - return stream.data; -} - static ftdm_status_t ftdm_call_set_call_id(ftdm_channel_t *fchan, ftdm_caller_data_t *caller_data) { uint32_t current_call_id; commit 836604cfd3bc5c0990961a14a22c31baeef0c9fe Merge: fa5ec0e da5b382 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Dec 23 21:23:01 2010 -0200 Merge branch 'master' into arnaldo.r2_reset_channel commit da5b3822a4decadd818b1b493b78635eef4067a4 Merge: 656ecc1 c06a835 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Dec 23 21:14:35 2010 -0200 Merge branch 'arnaldo.span_event_refactor' Conflicts: libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c commit c06a835822049c32a043d2824fe0c8cd05ed7524 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Dec 23 21:10:56 2010 -0200 freetdm: fixed log message diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index b04cf4f..340dd4e 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -1142,7 +1142,7 @@ FT_DECLARE(ftdm_status_t) ftdm_span_next_event(ftdm_span_t *span, ftdm_event_t * status = ftdm_event_handle_oob(*event); if (status != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "failed to send SIGEVENT signal to user\n"); + ftdm_log(FTDM_LOG_ERROR, "failed to handle event %d\n", **event); } return status; } @@ -1168,7 +1168,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_read_event(ftdm_channel_t *ftdmchan, ftdm status = ftdm_event_handle_oob(*event); if (status != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "failed to send SIGEVENT signal to user\n"); + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "failed to handle event %d\n", **event); } done: commit 08769e97b2344682a6ce856b2a69ea2e1bc34b37 Author: Raymond Chandler <intralanman@freeswitch.org> Date: Thu Dec 23 18:01:21 2010 -0500 couple small usability issues diff --git a/libs/esl/perl/ESL/Dispatch.pm b/libs/esl/perl/ESL/Dispatch.pm index 1d21934..d1712d1 100644 --- a/libs/esl/perl/ESL/Dispatch.pm +++ b/libs/esl/perl/ESL/Dispatch.pm @@ -40,7 +40,8 @@ sub set_callback($;$$) { $self->{_callback}->{$event} = shift; my $subclass = shift; if($subclass) { - $self->{_custom_subclass} = split(/,/, $subclass); + my @subclasses = split(/,/, $subclass); + $self->{_custom_subclass} = \@subclasses; } } @@ -79,7 +80,7 @@ sub run($;) { for(;;) { # Only register for events we have callbacks for. for my $key ( keys %{$self->{_callback}} ) { - if ($key eq "CUSTOM") { + if ($key =~ m/custom/i) { foreach $subclass (@{$self->{_custom_subclass}}) { $self->{_esl}->events("plain", "$key $subclass"); } commit cd28c4fc98d8d59fe5c9537d3a4288d5ec89a8a6 Author: Moises Silva <moy@sangoma.com> Date: Thu Dec 23 17:59:05 2010 -0500 fretdm: remove m3ua unused stuff diff --git a/libs/freetdm/conf/m3ua.conf b/libs/freetdm/conf/m3ua.conf deleted file mode 100644 index e3eeed3..0000000 --- a/libs/freetdm/conf/m3ua.conf +++ /dev/null @@ -1,38 +0,0 @@ -;M3UA SS7 Links Config -; -;ss7box-m3ua_mode => true -;local_sctp_ip => localhost -;local sctp_port => 30000 -;remote_sctp_ip => localhost -;remote_sctp_port => 30001 -;opc => 0-0-0 -;dpc => 0-0-0 - - -; AP Specific Stuff. This will likely move later. - -; CNAM Gateways -cnam1_dpc => 0-0-0 -cnam1_ssn => 253 -cnam2_dpc => 0-0-0 -cnam2_ssn => 253 -cnam3_dpc => 0-0-0 -cnam3_ssn => 253 - -;LNP Gateways -lnp1_dpc => 0-0-0 -lnp1_ssn => 253 -lnp2_dpc => 0-0-0 -lnp2_ssn => 253 -lnp3_dpc => 0-0-0 -lnp3_ssn => 253 - -;LNP Gateways -sms8001_dpc => 0-0-0 -sms8001_ssn => 253 -sms8002_dpc => 0-0-0 -sms8002_ssn => 253 -sms8003_dpc => 0-0-0 -sms8003_ssn => 253 - - diff --git a/libs/freetdm/src/ftdm_m3ua.c b/libs/freetdm/src/ftdm_m3ua.c deleted file mode 100644 index 8d3e002..0000000 --- a/libs/freetdm/src/ftdm_m3ua.c +++ /dev/null @@ -1,692 +0,0 @@ -/* - * ftdm_m3ua.c - * freetdm - * - * Created by Shane Burrell on 4/3/08. - * Copyright 2008 Shane Burrell. All rights reserved. - * - * - * Copyright (c) 2007, Anthony Minessale II, Nenad Corbic * - * - * 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 original author; nor the names of any 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 OWNER - * 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 "freetdm.h" -#include "m3ua_client.h" -#include "ftdm_m3ua.h" - -#define MAX_REQ_ID MAX_PENDING_CALLS -typedef uint16_t m3ua_request_id_t; - -typedef enum { - BST_FREE, - BST_WAITING, - BST_READY, - BST_FAIL -} m3ua_request_status_t; - -typedef struct { - m3ua_request_status_t status; - m3uac_event_t event; - ftdm_span_t *span; - ftdm_channel_t *ftdmchan; -} m3ua_request_t; - - -struct general_config { - uint32_t region; -}; -typedef struct general_config general_config_t; - - -struct m3ua_channel_profile { - char name[80]; - int cust_span; - unsigned char opc[3]; - unsigned char dpc[3]; - int local_ip[4]; - int local_port; - int remote_ip[4]; - int remote_port; - int m3ua_mode; -}; -typedef struct m3ua_channel_profile m3ua_channel_profile_t; - -static struct { - ftdm_hash_t *profile_hash; - general_config_t general_config; -} globals; - -struct m3ua_span_data { - uint32_t boardno; - uint32_t flags; -}; -typedef struct m3ua_span_data m3ua_span_data_t; - -struct m3ua_chan_data { - ftdm_buffer_t *digit_buffer; - ftdm_mutex_t *digit_mutex; - ftdm_size_t dtmf_len; - uint32_t flags; - uint32_t hdlc_bytes; -}; -typedef struct m3ua_chan_data m3ua_chan_data_t; - -static ftdm_mutex_t *request_mutex = NULL; -static ftdm_mutex_t *signal_mutex = NULL; - -static uint8_t req_map[MAX_REQ_ID+1] = { 0 }; - -static void release_request_id(m3ua_request_id_t r) -{ - ftdm_mutex_lock(request_mutex); - req_map[r] = 0; - ftdm_mutex_unlock(request_mutex); -} - -/*static m3ua_request_id_t next_request_id(void) -{ - m3ua_request_id_t r = 0; - int ok = 0; - - while(!ok) { - ftdm_mutex_lock(request_mutex); - for (r = 1; r <= MAX_REQ_ID; r++) { - if (!req_map[r]) { - ok = 1; - req_map[r] = 1; - break; - } - } - ftdm_mutex_unlock(request_mutex); - if (!ok) { - ftdm_sleep(5); - } - } - return r; -} -*/ - -static __inline__ void state_advance(ftdm_channel_t *ftdmchan) -{ - - m3ua_data_t *m3ua_data = ftdmchan->span->signal_data; - m3uac_connection_t *mcon = &m3ua_data->mcon; - ftdm_sigmsg_t sig; - ftdm_status_t status; - - ftdm_log(FTDM_LOG_DEBUG, "%d:%d STATE [%s]\n", ftdmchan->span_id, ftdmchan->chan_id, ftdm_channel_state2str(ftdmchan->state)); - - memset(&sig, 0, sizeof(sig)); - sig.chan_id = ftdmchan->chan_id; - sig.span_id = ftdmchan->span_id; - sig.channel = ftdmchan; - - switch (ftdmchan->state) { - case FTDM_CHANNEL_STATE_DOWN: - { - if (ftdmchan->extra_id) { - release_request_id((m3ua_request_id_t)ftdmchan->extra_id); - ftdmchan->extra_id = 0; - } - ftdm_channel_close(&ftdmchan); - } - break; - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - case FTDM_CHANNEL_STATE_PROGRESS: - { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - sig.event_id = FTDM_SIGEVENT_PROGRESS_MEDIA; - if ((status = m3ua_data->signal_cb(&sig) != FTDM_SUCCESS)) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); - } - } else { - m3uac_exec_command(mcon, - ftdmchan->physical_span_id-1, - ftdmchan->physical_chan_id-1, - 0, - SIGBOOST_EVENT_CALL_START_ACK, - 0); - } - } - break; - case FTDM_CHANNEL_STATE_RING: - { - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - sig.event_id = FTDM_SIGEVENT_START; - if ((status = m3ua_data->signal_cb(&sig) != FTDM_SUCCESS)) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); - } - } - - } - break; - case FTDM_CHANNEL_STATE_RESTART: - { - if (ftdmchan->last_state != FTDM_CHANNEL_STATE_HANGUP && ftdmchan->last_state != FTDM_CHANNEL_STATE_DOWN) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); - } else { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } - } - break; - case FTDM_CHANNEL_STATE_UP: - { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - sig.event_id = FTDM_SIGEVENT_UP; - if ((status = m3ua_data->signal_cb(&sig) != FTDM_SUCCESS)) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); - } - } else { - if (!(ftdm_test_flag(ftdmchan, FTDM_CHANNEL_PROGRESS) || ftdm_test_flag(ftdmchan, FTDM_CHANNEL_MEDIA))) { - m3uac_exec_command(mcon, - ftdmchan->physical_span_id-1, - ftdmchan->physical_chan_id-1, - 0, - SIGBOOST_EVENT_CALL_START_ACK, - 0); - } - - m3uac_exec_command(mcon, - ftdmchan->physical_span_id-1, - ftdmchan->physical_chan_id-1, - 0, - SIGBOOST_EVENT_CALL_ANSWERED, - 0); - } - } - break; - case FTDM_CHANNEL_STATE_DIALING: - { - } - break; - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } - break; - case FTDM_CHANNEL_STATE_HANGUP: - { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_ANSWERED) || ftdm_test_flag(ftdmchan, FTDM_CHANNEL_PROGRESS) || ftdm_test_flag(ftdmchan, FTDM_CHANNEL_MEDIA)) { - m3uac_exec_command(mcon, - ftdmchan->physical_span_id-1, - ftdmchan->physical_chan_id-1, - 0, - SIGBOOST_EVENT_CALL_STOPPED, - ftdmchan->caller_data.hangup_cause); - } else { - m3uac_exec_command(mcon, - ftdmchan->physical_span_id-1, - ftdmchan->physical_chan_id-1, - 0, - SIGBOOST_EVENT_CALL_START_NACK, - ftdmchan->caller_data.hangup_cause); - } - } - break; - case FTDM_CHANNEL_STATE_CANCEL: - { - sig.event_id = FTDM_SIGEVENT_STOP; - status = m3ua_data->signal_cb(&sig); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - m3uac_exec_command(mcon, - ftdmchan->physical_span_id-1, - ftdmchan->physical_chan_id-1, - 0, - SIGBOOST_EVENT_CALL_START_NACK_ACK, - 0); - } - break; - case FTDM_CHANNEL_STATE_TERMINATING: - { - sig.event_id = FTDM_SIGEVENT_STOP; - status = m3ua_data->signal_cb(&sig); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - m3uac_exec_command(mcon, - ftdmchan->physical_span_id-1, - ftdmchan->physical_chan_id-1, - 0, - SIGBOOST_EVENT_CALL_STOPPED_ACK, - 0); - } - break; - default: - break; - } -} - - -static __inline__ void check_state(ftdm_span_t *span) -{ - if (ftdm_test_flag(span, FTDM_SPAN_STATE_CHANGE)) { - uint32_t j; - ftdm_clear_flag_locked(span, FTDM_SPAN_STATE_CHANGE); - for(j = 1; j <= span->chan_count; j++) { - if (ftdm_test_flag((&span->channels[j]), FTDM_CHANNEL_STATE_CHANGE)) { - ftdm_clear_flag_locked((&span->channels[j]), FTDM_CHANNEL_STATE_CHANGE); - state_advance(&span->channels[j]); - ftdm_channel_complete_state(&span->channels[j]); - } - } - } -} - - -static int parse_ss7_event(ftdm_span_t *span, m3uac_connection_t *mcon, m3uac_event_t *event) -{ - ftdm_mutex_lock(signal_mutex); - - if (!ftdm_running()) { - ftdm_log(FTDM_LOG_WARNING, "System is shutting down.\n"); - goto end; - } - - - if (ftdm_test_flag(span, FTDM_SPAN_SUSPENDED) && - event->event_id != SIGBOOST_EVENT_SYSTEM_RESTART_ACK && event->event_id != SIGBOOST_EVENT_HEARTBEAT) { - - ftdm_log(FTDM_LOG_WARNING, - "INVALID EVENT: %s:(%X) [w%dg%d] Rc=%i CSid=%i Seq=%i Cd=[%s] Ci=[%s]\n", - m3uac_event_id_name(event->event_id), - event->event_id, - event->span+1, - event->chan+1, - event->release_cause, - event->call_setup_id, - event->fseqno, - (event->called_number_digits_count ? (char *) event->called_number_digits : "N/A"), - (event->calling_number_digits_count ? (char *) event->calling_number_digits : "N/A") - ); - - goto end; - } - - - ftdm_log(FTDM_LOG_DEBUG, - "RX EVENT: %s:(%X) [w%dg%d] Rc=%i CSid=%i Seq=%i Cd=[%s] Ci=[%s]\n", - m3uac_event_id_name(event->event_id), - event->event_id, - event->span+1, - event->chan+1, - event->release_cause, - event->call_setup_id, - event->fseqno, - (event->called_number_digits_count ? (char *) event->called_number_digits : "N/A"), - (event->calling_number_digits_count ? (char *) event->calling_number_digits : "N/A") - ); - - - - switch(event->event_id) { - - case SIGBOOST_EVENT_CALL_START: - //handle_call_start(span, mcon, event); - break; - case SIGBOOST_EVENT_CALL_STOPPED: - //handle_call_stop(span, mcon, event); - break; - case SIGBOOST_EVENT_CALL_START_ACK: - //handle_call_start_ack(mcon, event); - break; - case SIGBOOST_EVENT_CALL_START_NACK: - //handle_call_start_nack(span, mcon, event); - break; - case SIGBOOST_EVENT_CALL_ANSWERED: - //handle_call_answer(span, mcon, event); - break; - case SIGBOOST_EVENT_HEARTBEAT: - //handle_heartbeat(mcon, event); - break; - case SIGBOOST_EVENT_CALL_STOPPED_ACK: - case SIGBOOST_EVENT_CALL_START_NACK_ACK: - //handle_call_done(span, mcon, event); - break; - case SIGBOOST_EVENT_INSERT_CHECK_LOOP: - //handle_call_loop_start(event); - break; - case SIGBOOST_EVENT_REMOVE_CHECK_LOOP: - //handle_call_stop(event); - break; - case SIGBOOST_EVENT_SYSTEM_RESTART_ACK: - //handle_restart_ack(mcon, span, event); - break; - case SIGBOOST_EVENT_AUTO_CALL_GAP_ABATE: - //handle_gap_abate(event); - break; - default: - ftdm_log(FTDM_LOG_WARNING, "No handler implemented for [%s]\n", m3uac_event_id_name(event->event_id)); - break; - } - - end: - - ftdm_mutex_unlock(signal_mutex); - - return 0; -} - -static FIO_CONFIGURE_FUNCTION(m3ua_configure) -{ - m3ua_channel_profile_t *profile = NULL; - - int ok = 1; - - if (!(profile = (m3ua_channel_profile_t *) hashtable_search(globals.profile_hash, (char *)category))) { - profile = ftdm_malloc(sizeof(*profile)); - memset(profile, 0, sizeof(*profile)); - ftdm_set_string(profile->name, category); - hashtable_insert(globals.profile_hash, (void *)profile->name, profile); - ftdm_log(FTDM_LOG_INFO, "creating profile [%s]\n", category); - } - -// ftdm_set_string(m3ua_data->mcon. cfg.local_ip, local_ip); - if (!strcasecmp(var, "local_sctp_port")) { - profile->local_port = 30000 ; - profile->remote_port = 30000; - profile->cust_span++; - } - ok = 1; - - - if (ok) { - ftdm_log(FTDM_LOG_INFO, "setting param [%s]=[%s] for profile [%s]\n", var, val, category); - } else { - ftdm_log(FTDM_LOG_ERROR, "unknown param [%s]\n", var); - } - - return FTDM_SUCCESS; -} - -static FIO_CONFIGURE_SPAN_FUNCTION(m3ua_configure_span) -{ - - return FTDM_FAIL; -} - -static FIO_OPEN_FUNCTION(m3ua_open) -{ - - return FTDM_FAIL; -} - -static FIO_CLOSE_FUNCTION(m3ua_close) -{ - - return FTDM_FAIL; -} - -/*static FIO_SET_INTERVAL_FUNCTION(m3ua_set_interval) -{ - - return 0; -}*/ - -static FIO_WAIT_FUNCTION(m3ua_wait) -{ - - return FTDM_FAIL; -} - -static FIO_READ_FUNCTION(m3ua_read) -{ - - return FTDM_FAIL; -} - -static FIO_WRITE_FUNCTION(m3ua_write) -{ - - return FTDM_FAIL; -} - -static FIO_COMMAND_FUNCTION(m3ua_command) -{ - return FTDM_FAIL; -} - -static FIO_SPAN_POLL_EVENT_FUNCTION(m3ua_poll_event) -{ - return FTDM_FAIL; -} - -static FIO_SPAN_NEXT_EVENT_FUNCTION(m3ua_next_event) -{ - return FTDM_FAIL; -} - - -static FIO_SPAN_DESTROY_FUNCTION(m3ua_span_destroy) -{ - m3ua_span_data_t *span_data = (m3ua_span_data_t *) span->io_data; - - if (span_data) { - ftdm_safe_free(span_data); - } - - return FTDM_SUCCESS; -} -static FIO_CHANNEL_DESTROY_FUNCTION(m3ua_channel_destroy) -{ - m3ua_chan_data_t *chan_data = (m3ua_chan_data_t *) ftdmchan->io_data; - m3ua_span_data_t *span_data = (m3ua_span_data_t *) ftdmchan->span->io_data; - - if (!chan_data) { - return FTDM_FAIL; - } - - - - - - - ftdm_mutex_destroy(&chan_data->digit_mutex); - ftdm_buffer_destroy(&chan_data->digit_buffer); - - - ftdm_safe_free(chan_data); - - if (span_data) { - ftdm_safe_free(span_data); - } - - - return FTDM_SUCCESS; -} - - - -static FIO_GET_ALARMS_FUNCTION(m3ua_get_alarms) -{ - return FTDM_FAIL; -} - -static ftdm_io_interface_t m3ua_interface; - -ftdm_status_t m3ua_init(ftdm_io_interface_t **zint) -{ - assert(zint != NULL); - memset(&m3ua_interface, 0, sizeof(m3ua_interface)); - - m3ua_interface.name = "m3ua"; - m3ua_interface.configure = m3ua_configure; - m3ua_interface.configure_span = m3ua_configure_span; - m3ua_interface.open = m3ua_open; - m3ua_interface.close = m3ua_close; - m3ua_interface.wait = m3ua_wait; - m3ua_interface.read = m3ua_read; - m3ua_interface.write = m3ua_write; - m3ua_interface.command = m3ua_command; - m3ua_interface.poll_event = m3ua_poll_event; - m3ua_interface.next_event = m3ua_next_event; - m3ua_interface.channel_destroy = m3ua_channel_destroy; - m3ua_interface.span_destroy = m3ua_span_destroy; - m3ua_interface.get_alarms = m3ua_get_alarms; - *zint = &m3ua_interface; - - return FTDM_FAIL; -} - -ftdm_status_t m3ua_destroy(void) -{ - return FTDM_FAIL; -} - - -static void *m3ua_run(ftdm_thread_t *me, void *obj) -{ - ftdm_span_t *span = (ftdm_span_t *) obj; - m3ua_data_t *m3ua_data = span->signal_data; - m3uac_connection_t *mcon, *pcon; - uint32_t ms = 10, too_long = 60000; - - - m3ua_data->pcon = m3ua_data->mcon; - - if (m3uac_connection_open(&m3ua_data->mcon, - m3ua_data->mcon.cfg.local_ip, - m3ua_data->mcon.cfg.local_port, - m3ua_data->mcon.cfg.remote_ip, - m3ua_data->mcon.cfg.remote_port) < 0) { - ftdm_log(FTDM_LOG_DEBUG, "Error: Opening MCON Socket [%d] %s\n", m3ua_data->mcon.socket, strerror(errno)); - goto end; - } - - if (m3uac_connection_open(&m3ua_data->pcon, - m3ua_data->pcon.cfg.local_ip, - ++m3ua_data->pcon.cfg.local_port, - m3ua_data->pcon.cfg.remote_ip, - m3ua_data->pcon.cfg.remote_port) < 0) { - ftdm_log(FTDM_LOG_DEBUG, "Error: Opening PCON Socket [%d] %s\n", m3ua_data->pcon.socket, strerror(errno)); - goto end; - } - - mcon = &m3ua_data->mcon; - pcon = &m3ua_data->pcon; - - top: - - //init_outgoing_array(); - - m3uac_exec_command(mcon, - 0, - 0, - -1, - SIGBOOST_EVENT_SYSTEM_RESTART, - 0); - - while (ftdm_test_flag(m3ua_data, FTDM_M3UA_RUNNING)) { - fd_set rfds, efds; - struct timeval tv = { 0, ms * 1000 }; - int max, activity, i = 0; - m3uac_event_t *event = NULL; - - if (!ftdm_running()) { - m3uac_exec_command(mcon, - 0, - 0, - -1, - SIGBOOST_EVENT_SYSTEM_RESTART, - 0); - break; - } - - FD_ZERO(&rfds); - FD_ZERO(&efds); - FD_SET(mcon->socket, &rfds); - FD_SET(mcon->socket, &efds); - FD_SET(pcon->socket, &rfds); - FD_SET(pcon->socket, &efds); - - max = ((pcon->socket > mcon->socket) ? pcon->socket : mcon->socket) + 1; - - if ((activity = select(max, &rfds, NULL, &efds, &tv)) < 0) { - goto error; - } - - if (activity) { - if (FD_ISSET(pcon->socket, &efds) || FD_ISSET(mcon->socket, &efds)) { - goto error; - } - - if (FD_ISSET(pcon->socket, &rfds)) { - if ((event = m3uac_connection_readp(pcon, i))) { - parse_ss7_event(span, mcon, event); - } else goto top; - } - - if (FD_ISSET(mcon->socket, &rfds)) { - if ((event = m3uac_connection_read(mcon, i))) { - parse_ss7_event(span, mcon, event); - } else goto top; - } - } - - check_state(span); - mcon->hb_elapsed += ms; - - if (mcon->hb_elapsed >= too_long && (mcon->up || !ftdm_test_flag(span, FTDM_SPAN_SUSPENDED))) { - ftdm_set_state_all(span, FTDM_CHANNEL_STATE_RESTART); - ftdm_set_flag_locked(span, FTDM_SPAN_SUSPENDED); - mcon->up = 0; - ftdm_log(FTDM_LOG_CRIT, "Lost Heartbeat!\n"); - } - - } - - goto end; - - error: - ftdm_log(FTDM_LOG_CRIT, "Socket Error!\n"); - - end: - - m3uac_connection_close(&m3ua_data->mcon); - m3uac_connection_close(&m3ua_data->pcon); - - ftdm_clear_flag(m3ua_data, FTDM_M3UA_RUNNING); - - ftdm_log(FTDM_LOG_DEBUG, "M3UA thread ended.\n"); - return NULL; -} -ftdm_status_t m3ua_start(ftdm_span_t *span) -{ - m3ua_data_t *m3ua_data = span->signal_data; - ftdm_set_flag(m3ua_data, FTDM_M3UA_RUNNING); - return ftdm_thread_create_detached(m3ua_run, span); -} - -/* For Emacs: - * Local Variables: - * mode:c - * indent-tabs-mode:t - * tab-width:4 - * c-basic-offset:4 - * End: -*/ diff --git a/libs/freetdm/src/include/private/ftdm_m3ua.h b/libs/freetdm/src/include/private/ftdm_m3ua.h deleted file mode 100644 index 1bf8308..0000000 --- a/libs/freetdm/src/include/private/ftdm_m3ua.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - * ftdm_m3ua.h - * freetdm - * - * Created by Shane Burrell on 4/3/08. - * Copyright 2008 Shane Burrell. All rights reserved. - * - * Copyright (c) 2007, Anthony Minessale II, Nenad Corbic - * - * 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 original author; nor the names of any 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 OWNER - * 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 "m3ua_client.h" -#include "freetdm.h" - -#ifdef __cplusplus -extern "C" { -#endif -enum e_sigboost_event_id_values -{ - SIGBOOST_EVENT_CALL_START = 0x80, /*128*/ - SIGBOOST_EVENT_CALL_START_ACK = 0x81, /*129*/ - SIGBOOST_EVENT_CALL_START_NACK = 0x82, /*130*/ - SIGBOOST_EVENT_CALL_START_NACK_ACK = 0x83, /*131*/ - SIGBOOST_EVENT_CALL_ANSWERED = 0x84, /*132*/ - SIGBOOST_EVENT_CALL_STOPPED = 0x85, /*133*/ - SIGBOOST_EVENT_CALL_STOPPED_ACK = 0x86, /*134*/ - SIGBOOST_EVENT_SYSTEM_RESTART = 0x87, /*135*/ - SIGBOOST_EVENT_SYSTEM_RESTART_ACK = 0x88, /*136*/ - /* Following IDs are ss7boost to sangoma_mgd only. */ - SIGBOOST_EVENT_HEARTBEAT = 0x89, /*137*/ - SIGBOOST_EVENT_INSERT_CHECK_LOOP = 0x8a, /*138*/ - SIGBOOST_EVENT_REMOVE_CHECK_LOOP = 0x8b, /*139*/ - SIGBOOST_EVENT_AUTO_CALL_GAP_ABATE = 0x8c, /*140*/ -}; -enum e_sigboost_release_cause_values -{ - SIGBOOST_RELEASE_CAUSE_UNDEFINED = 0, - SIGBOOST_RELEASE_CAUSE_NORMAL = 16, - SIGBOOST_RELEASE_CAUSE_BUSY = 17, - /* probable elimination */ - //SIGBOOST_RELEASE_CAUSE_BUSY = 0x91, /* 145 */ - //SIGBOOST_RELEASE_CAUSE_CALLED_NOT_EXIST = 0x92, /* 146 */ - //SIGBOOST_RELEASE_CAUSE_CIRCUIT_RESET = 0x93, /* 147 */ - //SIGBOOST_RELEASE_CAUSE_NOANSWER = 0x94, /* 148 */ -}; - -enum e_sigboost_call_setup_ack_nack_cause_values -{ - SIGBOOST_CALL_SETUP_NACK_ALL_CKTS_BUSY = 117, /* unused Q.850 value */ - SIGBOOST_CALL_SETUP_NACK_TEST_CKT_BUSY = 118, /* unused Q.850 value */ - SIGBOOST_CALL_SETUP_NACK_INVALID_NUMBER = 28, - /* probable elimination */ - //SIGBOOST_CALL_SETUP_RESERVED = 0x00, - //SIGBOOST_CALL_SETUP_CIRCUIT_RESET = 0x10, - //SIGBOOST_CALL_SETUP_NACK_CKT_START_TIMEOUT = 0x11, - //SIGBOOST_CALL_SETUP_NACK_AUTO_CALL_GAP = 0x17, -}; -typedef enum { - M3UA_SPAN_SIGNALING_M3UA, - M3UA_SPAN_SIGNALING_SS7BOX, - -} M3UA_TSpanSignaling; -#define M3UA_SPAN_STRINGS "M3UA", "SS7BOX" -FTDM_STR2ENUM_P(m3ua_str2span, m3ua_span2str, M3UA_TSpanSignaling) - - - -typedef enum { - FTDM_M3UA_RUNNING = (1 << 0) -} ftdm_m3uat_flag_t; - -/*typedef struct m3ua_data { - m3uac_connection_t mcon; - m3uac_connection_t pcon; - fio_signal_cb_t signal_cb; - uint32_t flags; -} m3ua_data_t; - -*/ -/*typedef struct mu3a_link { - ss7bc_connection_t mcon; - ss7bc_connection_t pcon; - fio_signal_cb_t signal_cb; - uint32_t flags; -} ftdm_m3ua_data_t; -*/ - -ftdm_status_t m3ua_init(ftdm_io_interface_t **zint); -ftdm_status_t m3ua_destroy(void); -ftdm_status_t m3ua_start(ftdm_span_t *span); - -#ifdef __cplusplus -} -#endif - -/* For Emacs: - * Local Variables: - * mode:c - * indent-tabs-mode:t - * tab-width:4 - * c-basic-offset:4 - * End: - * For VIM: - * vim:set softtabstop=4 shiftwidth=4 tabstop=4: - */ - diff --git a/libs/freetdm/src/m3ua/mstm3ua.c b/libs/freetdm/src/m3ua/mstm3ua.c deleted file mode 100644 index 1d8179c..0000000 --- a/libs/freetdm/src/m3ua/mstm3ua.c +++ /dev/null @@ -1,62 +0,0 @@ -/* WARNING WORK IN PROGRESS - * mstm3ua.c - * mstss7d port - * - * Created by Shane Burrell on 2/2/08. - * Copyright 2008 Shane Burrell. 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 original author; nor the names of any 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 OWNER - * 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 "mstm3ua.h" - - - - - -int build_m3ua_hdr(unsigned char len,unsigned char *bytemsg) - -{ - - *bytemsg++ = M_VERSION_REL1; // 1 Verison - //bytemsg[1] = 0x00; // 2 RESERVED - //bytemsg[2] = M_CLASS_XFER; // 3 Msg Class - //SS7 BOX Kludge - *bytemsg++ = 0x01; // 2 RESERVED - *bytemsg++ = 0x00; // 2 RESERVED - - *bytemsg++ = M_TYPE_DATA ; // 4 Msg Type - - *bytemsg++ = len; // 5 Msg LENGTH 81 32bit field - *bytemsg++ = 0x00; // 6 - *bytemsg++ = 0x00; // 7 - *bytemsg++ = 0x00; // 8 - return(0); - -}; \ No newline at end of file diff --git a/libs/freetdm/src/m3ua/mstm3ua.h b/libs/freetdm/src/m3ua/mstm3ua.h deleted file mode 100644 index 13527da..0000000 --- a/libs/freetdm/src/m3ua/mstm3ua.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * mstm3ua.h - * mstss7d - * - * Created by Shane Burrell on 3/2/08. - * Copyright 2008 Shane Burrell. 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 original author; nor the names of any 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 OWNER - * 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. - */ -typedef unsigned long m3ua_ulong; -typedef unsigned short m3ua_ushort; -typedef unsigned char m3ua_uchar; - -typedef unsigned char u8; -typedef unsigned short u16; /* Note: multi-byte values are little-endian */ -typedef unsigned long u32; - - - - -#define M_TAG_NETWORK_APPEARANCE 1 -#define M_TAG_PROTOCOL_DATA 3 -#define M_TAG_INFO_STRING 4 -#define M_TAG_AFFECTED_DPC 5 -#define M_TAG_ROUTING_CONTEXT 6 -#define M_TAG_DIAGNOSTIC_INFORMATION 7 -#define M_TAG_HEARTBEAT_DATA 8 -#define M_TAG_UNAVAILABILITY_CAUSE 9 -#define M_TAG_REASON 10 -#define M_TAG_TRAFFIC_MODE_TYPE 11 -#define M_TAG_ERROR_CODE 12 -#define M_TAG_STATUS_TYPE 13 -#define M_TAG_CONGESTED_INDICATIONS 14 - -#define M_VERSION_REL1 1 - -#define M_CLASS_MGMT 0x00 -#define M_CLASS_XFER 0x01 -#define M_CLASS_SSNM 0x02 -#define M_CLASS_ASPSM 0x03 -#define M_CLASS_ASPTM 0x04 -#define M_CLASS_RKM 0x09 - -#define M_TYPE_ERR (0|M_CLASS_MGMT - -#define M_TYPE_NTFY (1|M_CLASS_XFER) -#define M_TYPE_DATA (1|M_CLASS_XFER) - -#define M_TYPE_DUNA (1|M_CLASS_SSNM) -#define M_TYPE_DAVA (2|M_CLASS_SSNM) -#define M_TYPE_DUAD (3|M_CLASS_SSNM) -#define M_TYPE_SCON (4|M_CLASS_SSNM) -#define M_TYPE_DUPU (5|M_CLASS_SSNM) - -#define M_TYPE_UP (1|M_CLASS_ASPSM) -#define M_TYPE_DOWN (2|M_CLASS_ASPSM) -#define M_TYPE_BEAT (3|M_CLASS_ASPSM) -#define M_TYPE_UP_ACK (4|M_CLASS_ASPSM) -#define M_TYPE_DOWN_ACK (5|M_CLASS_ASPSM) -#define M_TYPE_BEAT_ACK (6|M_CLASS_ASPSM) - -#define M_TYPE_ACTIVE (1|M_CLASS_ASPTM) -#define M_TYPE_INACTIVE (2|M_CLASS_ASPTM) -#define M_TYPE_ACTIVE_ACK (3|M_CLASS_ASPTM) -#define M_TYPE_INACTIVE_ACK (4|M_CLASS_ASPTM) - -#define M_CLASS_MASK 0xff00 -#define M_TYPE_MASK 0x00ff - diff --git a/libs/freetdm/src/m3ua_client.c b/libs/freetdm/src/m3ua_client.c deleted file mode 100644 index 7608183..0000000 --- a/libs/freetdm/src/m3ua_client.c +++ /dev/null @@ -1,333 +0,0 @@ -/* - * m3ua_client.c - * freetdm - * - * Created by Shane Burrell on 4/3/08. - * Copyright 2008 Shane Burrell. All rights reserved. - * - * - * Copyright (c) 2007, Anthony Minessale II, Nenad Corbic - * 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 original author; nor the names of any 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 OWNER - * 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. - */ - -#if HAVE_NETDB_H -#include <netdb.h> -#endif - -#include "freetdm.h" -#include <m3ua_client.h> - - -#ifndef HAVE_GETHOSTBYNAME_R -extern int gethostbyname_r (const char *__name, - struct hostent *__result_buf, - char *__buf, size_t __buflen, - struct hostent **__result, - int *__h_errnop); -#endif - -struct m3uac_map { - uint32_t event_id; - const char *name; -}; - -static struct m3uac_map m3uac_table[] = { - {M3UA_EVENT_CALL_START, "CALL_START"}, - {M3UA_EVENT_CALL_START_ACK, "CALL_START_ACK"}, - {M3UA_EVENT_CALL_START_NACK, "CALL_START_NACK"}, - {M3UA_EVENT_CALL_START_NACK_ACK, "CALL_START_NACK_ACK"}, - {M3UA_EVENT_CALL_ANSWERED, "CALL_ANSWERED"}, - {M3UA_EVENT_CALL_STOPPED, "CALL_STOPPED"}, - {M3UA_EVENT_CALL_STOPPED_ACK, "CALL_STOPPED_ACK"}, - {M3UA_EVENT_SYSTEM_RESTART, "SYSTEM_RESTART"}, - {M3UA_EVENT_SYSTEM_RESTART_ACK, "SYSTEM_RESTART_ACK"}, - {M3UA_EVENT_HEARTBEAT, "HEARTBEAT"}, - {M3UA_EVENT_INSERT_CHECK_LOOP, "LOOP START"}, - {M3UA_EVENT_REMOVE_CHECK_LOOP, "LOOP STOP"} -}; - - - -static int create_conn_socket(m3uac_connection_t *mcon, char *local_ip, int local_port, char *ip, int port) -{ - int rc; - struct hostent *result, *local_result; - char buf[512], local_buf[512]; - int err = 0; - - memset(&mcon->remote_hp, 0, sizeof(mcon->remote_hp)); - memset(&mcon->local_hp, 0, sizeof(mcon->local_hp)); - mcon->socket = socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP); - - ftdm_log(FTDM_LOG_DEBUG, "Creating L=%s:%d R=%s:%d\n", - local_ip,local_port,ip,port); - - if (mcon->socket >= 0) { - int flag; - - flag = 1; - gethostbyname_r(ip, &mcon->remote_hp, buf, sizeof(buf), &result, &err); - gethostbyname_r(local_ip, &mcon->local_hp, local_buf, sizeof(local_buf), &local_result, &err); - if (result && local_result) { - mcon->remote_addr.sin_family = mcon->remote_hp.h_addrtype; - memcpy((char *) &mcon->remote_addr.sin_addr.s_addr, mcon->remote_hp.h_addr_list[0], mcon->remote_hp.h_length); - mcon->remote_addr.sin_port = htons(port); - - mcon->local_addr.sin_family = mcon->local_hp.h_addrtype; - memcpy((char *) &mcon->local_addr.sin_addr.s_addr, mcon->local_hp.h_addr_list[0], mcon->local_hp.h_length); - mcon->local_addr.sin_port = htons(local_port); - - - setsockopt(mcon->socket, IPPROTO_SCTP, SCTP_NODELAY, (char *)&flag, sizeof(int)); - - rc=listen(mcon->socket,100); - if (rc) { - close(mcon->socket); - mcon->socket = -1; - - } - } - } - - ftdm_mutex_create(&mcon->mutex); - - return mcon->socket; -} - -int m3uac_connection_close(m3uac_connection_t *mcon) -{ - if (mcon->socket > -1) { - close(mcon->socket); - } - - ftdm_mutex_lock(mcon->mutex); - ftdm_mutex_unlock(mcon->mutex); - ftdm_mutex_destroy(&mcon->mutex); - memset(mcon, 0, sizeof(*mcon)); - mcon->socket = -1; - - return 0; -} - -int m3uac_connection_open(m3uac_connection_t *mcon, char *local_ip, int local_port, char *ip, int port) -{ - create_conn_socket(mcon, local_ip, local_port, ip, port); - return mcon->socket; -} - - -int m3uac_exec_command(m3uac_connection_t *mcon, int span, int chan, int id, int cmd, int cause) -{ - m3uac_event_t oevent; - int retry = 5; - - m3uac_event_init(&oevent, cmd, chan, span); - oevent.release_cause = cause; - - if (cmd == SIGBOOST_EVENT_SYSTEM_RESTART) { - mcon->rxseq_reset = 1; - mcon->txseq = 0; - mcon->rxseq = 0; - mcon->txwindow = 0; - } - - if (id >= 0) { - oevent.call_setup_id = id; - } - - while (m3uac_connection_write(mcon, &oevent) <= 0) { - if (--retry <= 0) { - ftdm_log(FTDM_LOG_CRIT, "Failed to tx on M3UA socket: %s\n", strerror(errno)); - return -1; - } else { - ftdm_log(FTDM_LOG_WARNING, "Failed to tx on M3UA socket: %s :retry %i\n", strerror(errno), retry); - ftdm_sleep(1); - } - } - - return 0; -} - - - -m3uac_event_t *m3uac_connection_read(m3uac_connection_t *mcon, int iteration) -{ - unsigned int fromlen = sizeof(struct sockaddr_in); - int bytes = 0; - - bytes = recvfrom(mcon->socket, &mcon->event, sizeof(mcon->event), MSG_DONTWAIT, - (struct sockaddr *) &mcon->local_addr, &fromlen); - - if (bytes == sizeof(mcon->event) || bytes == (sizeof(mcon->event)-sizeof(uint32_t))) { - - if (mcon->rxseq_reset) { - if (mcon->event.event_id == SIGBOOST_EVENT_SYSTEM_RESTART_ACK) { - ftdm_log(FTDM_LOG_DEBUG, "Rx sync ok\n"); - mcon->rxseq = mcon->event.fseqno; - return &mcon->event; - } - errno=EAGAIN; - ftdm_log(FTDM_LOG_DEBUG, "Waiting for rx sync...\n"); - return NULL; - } - - mcon->txwindow = mcon->txseq - mcon->event.bseqno; - mcon->rxseq++; - - if (mcon->rxseq != mcon->event.fseqno) { - ftdm_log(FTDM_LOG_CRIT, "Invalid Sequence Number Expect=%i Rx=%i\n", mcon->rxseq, mcon->event.fseqno); - return NULL; - } - - return &mcon->event; - } else { - if (iteration == 0) { - ftdm_log(FTDM_LOG_CRIT, "Invalid Event length from boost rxlen=%i evsz=%i\n", bytes, sizeof(mcon->event)); - return NULL; - } - } - - return NULL; -} - -m3uac_event_t *m3uac_connection_readp(m3uac_connection_t *mcon, int iteration) -{ - unsigned int fromlen = sizeof(struct sockaddr_in); - int bytes = 0; - - bytes = recvfrom(mcon->socket, &mcon->event, sizeof(mcon->event), MSG_DONTWAIT, (struct sockaddr *) &mcon->local_addr, &fromlen); - - if (bytes == sizeof(mcon->event) || bytes == (sizeof(mcon->event)-sizeof(uint32_t))) { - return &mcon->event; - } else { - if (iteration == 0) { - ftdm_log(FTDM_LOG_CRIT, "Critical Error: PQ Invalid Event lenght from boost rxlen=%i evsz=%i\n", bytes, sizeof(mcon->event)); - return NULL; - } - } - - return NULL; -} - - -int m3uac_connection_write(m3uac_connection_t *mcon, ss7bc_event_t *event) -{ - int err; - - if (!event || mcon->socket < 0 || !mcon->mutex) { - ftdm_log(FTDM_LOG_DEBUG, "Critical Error: No Event Device\n"); - return -EINVAL; - } - - if (event->span > 16 || event->chan > 31) { - ftdm_log(FTDM_LOG_CRIT, "Critical Error: TX Cmd=%s Invalid Span=%i Chan=%i\n", m3uac_event_id_name(event->event_id), event->span,event->chan); - return -1; - } - - gettimeofday(&event->tv,NULL); - - ftdm_mutex_lock(mcon->mutex); - event->fseqno = mcon->txseq++; - event->bseqno = mcon->rxseq; - err = sendto(mcon->socket, event, sizeof(m3uac_event_t), 0, (struct sockaddr *) &mcon->remote_addr, sizeof(mcon->remote_addr)); - ftdm_mutex_unlock(mcon->mutex); - - if (err != sizeof(m3uac_event_t)) { - err = -1; - } - - ftdm_log(FTDM_LOG_DEBUG, "TX EVENT: %s:(%X) [w%dg%d] Rc=%i CSid=%i Seq=%i Cd=[%s] Ci=[%s]\n", - m3uac_event_id_name(event->event_id), - event->event_id, - event->span+1, - event->chan+1, - event->release_cause, - event->call_setup_id, - event->fseqno, - (event->called_number_digits_count ? (char *) event->called_number_digits : "N/A"), - (event->calling_number_digits_count ? (char *) event->calling_number_digits : "N/A") - ); - - return err; -} - -void m3uac_call_init(m3uac_event_t *event, const char *calling, const char *called, int setup_id) -{ - memset(event, 0, sizeof(m3uac_event_t)); - event->event_id = M3UA_EVENT_CALL_START; - - if (calling) { - strncpy((char*)event->calling_number_digits, calling, sizeof(event->calling_number_digits)-1); - event->calling_number_digits_count = strlen(calling); - } - - if (called) { - strncpy((char*)event->called_number_digits, called, sizeof(event->called_number_digits)-1); - event->called_number_digits_count = strlen(called); - } - - event->call_setup_id = setup_id; - -} - -void m3uac_event_init(m3uac_event_t *event, m3uac_event_id_t event_id, int chan, int span) -{ - memset(event, 0, sizeof(ss7bc_event_t)); - event->event_id = event_id; - event->chan = chan; - event->span = span; -} - -const char *m3uac_event_id_name(uint32_t event_id) -{ - unsigned int x; - const char *ret = NULL; - - for (x = 0 ; x < sizeof(m3uac_table)/sizeof(struct m3uac_map); x++) { - if (m3uac_table[x].event_id == event_id) { - ret = m3uac_table[x].name; - break; - } - } - - return ret; -} - -/* For Emacs: - * Local Variables: - * mode:c - * indent-tabs-mode:t - * tab-width:4 - * c-basic-offset:4 - * End: - * For VIM: - * vim:set softtabstop=4 shiftwidth=4 tabstop=4: - */ - - diff --git a/libs/freetdm/src/m3ua_client.h b/libs/freetdm/src/m3ua_client.h deleted file mode 100644 index e451156..0000000 --- a/libs/freetdm/src/m3ua_client.h +++ /dev/null @@ -1,164 +0,0 @@ -/* - * m3ua_client.h - * freetdm - * - * Created by Shane Burrell on 4/3/08. - * Copyright 2008 Shane Burrell. All rights reserved. - * - * Copyright (c) 2007, Anthony Minessale II, Nenad Corbic - * - * 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 original author; nor the names of any 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 OWNER - * 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 <ctype.h> -#include <string.h> -#include <unistd.h> -#include <stdlib.h> -#include <errno.h> -#include <stdarg.h> -#include <stdio.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> - -// Fix this for portability -#include <sctp.h> -//#include <netinet/sctp.h> -#include <arpa/inet.h> -#include <stdarg.h> -#include <netdb.h> -//#include <sigboost.h> -#include <sys/time.h> - -#define MAX_DIALED_DIGITS 31 -#define MAX_CALLING_NAME 31 - -/* Next two defines are used to create the range of values for call_setup_id - * in the t_sigboost structure. - * 0..((CORE_MAX_SPANS * CORE_MAX_CHAN_PER_SPAN) - 1) */ -#define CORE_MAX_SPANS 200 -#define CORE_MAX_CHAN_PER_SPAN 30 -#define MAX_PENDING_CALLS CORE_MAX_SPANS * CORE_MAX_CHAN_PER_SPAN -/* 0..(MAX_PENDING_CALLS-1) is range of call_setup_id below */ -#define SIZE_RDNIS 80 - -//#undef MSGWINDOW -#define MSGWINDOW - - -typedef struct -{ - uint32_t event_id; - uint32_t fseqno; -#ifdef MSGWINDOW - uint32_t bseqno; -#endif - uint16_t call_setup_id; - uint32_t trunk_group; - uint32_t span; - uint32_t chan; - uint8_t called_number_digits_count; - char called_number_digits [MAX_DIALED_DIGITS + 1]; /* it's a null terminated string */ - uint8_t calling_number_digits_count; /* it's an array */ - char calling_number_digits [MAX_DIALED_DIGITS + 1]; /* it's a null terminated string */ - uint8_t release_cause; - struct timeval tv; - /* ref. Q.931 Table 4-11 and Q.951 Section 3 */ - uint8_t calling_number_screening_ind; - uint8_t calling_number_presentation; - char redirection_string [SIZE_RDNIS]; /* it's a null terminated string */ - -} t_m3ua; - -typedef t_m3ua m3uac_event_t; -typedef uint32_t m3uac_event_id_t; - - -typedef struct m3uac_ip_cfg -{ - char local_ip[25]; - int local_port; - char remote_ip[25]; - int remote_port; -}m3uac_ip_cfg_t; - -struct m3uac_connection { - ftdm_socket_t socket; - struct sockaddr_in local_addr; - struct sockaddr_in remote_addr; - m3uac_event_t event; - struct hostent remote_hp; - struct hostent local_hp; - unsigned int flags; - ftdm_mutex_t *mutex; - FILE *log; - unsigned int txseq; - unsigned int rxseq; - unsigned int txwindow; - unsigned int rxseq_reset; - m3uac_ip_cfg_t cfg; - uint32_t hb_elapsed; - int up; -}; - -typedef enum { - MSU_FLAG_EVENT = (1 << 0) -} m3uac_flag_t; - -typedef struct m3uac_connection m3uac_connection_t; - -static inline void sctp_no_nagle(int socket) -{ - //int flag = 1; - //setsockopt(socket, IPPROTO_SCTP, SCTP_NODELAY, (char *) &flag, sizeof(int)); -} - -int m3uac_connection_close(m3uac_connection_t *mcon); -int m3uac_connection_open(m3uac_connection_t *mcon, char *local_ip, int local_port, char *ip, int port); -m3uac_event_t *m3uac_connection_read(m3uac_connection_t *mcon, int iteration); -m3uac_event_t *m3uac_connection_readp(m3uac_connection_t *mcon, int iteration); -int m3uac_connection_write(m3uac_connection_t *mcon, m3uac_event_t *event); -void m3uac_event_init(m3uac_event_t *event, m3uac_event_id_t event_id, int chan, int span); -void m3uac_call_init(m3uac_event_t *event, const char *calling, const char *called, int setup_id); -const char *m3uac_event_id_name(uint32_t event_id); -int m3uac_exec_command(m3uac_connection_t *mcon, int span, int chan, int id, int cmd, int cause); - - - - -/* For Emacs: - * Local Variables: - * mode:c - * indent-tabs-mode:t - * tab-width:4 - * c-basic-offset:4 - * End: - * For VIM: - * vim:set softtabstop=4 shiftwidth=4 tabstop=4: - */ diff --git a/libs/freetdm/src/testm3ua.c b/libs/freetdm/src/testm3ua.c deleted file mode 100644 index 5848470..0000000 --- a/libs/freetdm/src/testm3ua.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * testm3ua.c - * freetdm - * - * Created by Shane Burrell on 4/8/08. - * Copyright 2008 __MyCompanyName__. All rights reserved. - * - */ - -#include "testm3ua.h" -#include "freetdm.h" -#include "ftdm_m3ua.h" - -static FIO_SIGNAL_CB_FUNCTION(on_signal) -{ - return FTDM_FAIL; -} - -int main(int argc, char *argv[]) -{ - ftdm_span_t *span; - //m3ua_data_t *data; - - ftdm_global_set_default_logger(FTDM_LOG_LEVEL_DEBUG); - - if (argc < 5) { - printf("more args needed\n"); - exit(-1); - } - - if (ftdm_global_init() != FTDM_SUCCESS) { - fprintf(stderr, "Error loading FreeTDM\n"); - exit(-1); - } - - printf("FreeTDM loaded\n"); - - if (ftdm_span_find(atoi(argv[1]), &span) != FTDM_SUCCESS) { - fprintf(stderr, "Error finding FreeTDM span\n"); - goto done; - } - - - if (ftdm_m3ua_configure_span(span) == FTDM_SUCCESS) { - //data = span->signal_data; - ftdm_m3ua_start(span); - } else { - fprintf(stderr, "Error starting M3UA\n"); - goto done; - } - - //while(ftdm_test_flag(data, FTDM_M3UA_RUNNING)) { - // ftdm_sleep(1 * 1000); - //} - - done: - - ftdm_global_destroy(); - -} commit 568013bc6085d17a97db07822ff26df40cab3788 Author: Moises Silva <moy@sangoma.com> Date: Thu Dec 23 15:39:20 2010 -0500 freetdm: initial changes to make FreeTDM APIs non-blocking diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 451441e..89e9321 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -304,6 +304,9 @@ FTDM_STR2ENUM(ftdm_str2ftdm_usr_layer1_prot, ftdm_user_layer1_prot2str, ftdm_use FTDM_ENUM_NAMES(CALLING_PARTY_CATEGORY_NAMES, CALLING_PARTY_CATEGORY_STRINGS) FTDM_STR2ENUM(ftdm_str2ftdm_calling_party_category, ftdm_calling_party_category2str, ftdm_calling_party_category_t, CALLING_PARTY_CATEGORY_NAMES, FTDM_CPC_INVALID) +FTDM_ENUM_NAMES(INDICATION_NAMES, INDICATION_STRINGS) +FTDM_STR2ENUM(ftdm_str2channel_indication, ftdm_channel_indication2str, ftdm_channel_indication_t, INDICATION_NAMES, FTDM_CHANNEL_INDICATE_INVALID) + static ftdm_status_t ftdm_group_add_channels(ftdm_span_t* span, int currindex, const char* name); static const char *cut_path(const char *in) @@ -1549,6 +1552,11 @@ end: goto done; } + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_NONBLOCK)) { + /* the channel should not block waiting for state processing */ + goto done; + } + /* there is an inherent race here between set and check of the change flag but we do not care because * the flag should never last raised for more than a few ms for any state change */ while (waitrq && waitms > 0) { @@ -1575,6 +1583,7 @@ end: if (waitms <= 0) { ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_WARNING, "state change from %s to %s was most likely not processed after aprox %dms\n", ftdm_channel_state2str(ftdmchan->last_state), ftdm_channel_state2str(state), DEFAULT_WAIT_TIME); + ok = 0; } done: return ok ? FTDM_SUCCESS : FTDM_FAIL; @@ -2124,6 +2133,27 @@ FT_DECLARE(void) ftdm_span_set_trunk_type(ftdm_span_t *span, ftdm_trunk_type_t t span->trunk_type = type; } +FT_DECLARE(ftdm_status_t) ftdm_span_set_blocking_mode(const ftdm_span_t *span, ftdm_bool_t enabled) +{ + ftdm_channel_t *fchan = NULL; + ftdm_iterator_t *citer = NULL; + ftdm_iterator_t *curr = NULL; + + citer = ftdm_span_get_chan_iterator(span, NULL); + if (!citer) { + return FTDM_ENOMEM; + } + for (curr = citer ; curr; curr = ftdm_iterator_next(curr)) { + fchan = ftdm_iterator_current(curr); + if (enabled) { + ftdm_clear_flag_locked(fchan, FTDM_CHANNEL_NONBLOCK); + } else { + ftdm_set_flag_locked(fchan, FTDM_CHANNEL_NONBLOCK); + } + } + return FTDM_SUCCESS; +} + FT_DECLARE(ftdm_trunk_type_t) ftdm_span_get_trunk_type(const ftdm_span_t *span) { return span->trunk_type; @@ -2210,19 +2240,37 @@ FT_DECLARE(ftdm_bool_t) ftdm_channel_call_check_done(const ftdm_channel_t *ftdmc FT_DECLARE(ftdm_status_t) _ftdm_channel_call_hold(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan) { + ftdm_status_t status; ftdm_channel_lock(ftdmchan); + ftdm_set_flag(ftdmchan, FTDM_CHANNEL_HOLD); - ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_DIALTONE, 0); + status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_DIALTONE, 0); ftdm_channel_unlock(ftdmchan); - return FTDM_SUCCESS; + + return status; } FT_DECLARE(ftdm_status_t) _ftdm_channel_call_unhold(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan) { + ftdm_status_t status; + ftdm_channel_lock(ftdmchan); - ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_UP, 0); + + status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_UP, 0); + ftdm_channel_unlock(ftdmchan); - return FTDM_SUCCESS; + + return status; +} + +FT_DECLARE(void) ftdm_ack_indication(const ftdm_channel_t *fchan, ftdm_channel_indication_t indication, ftdm_status_t status) +{ + ftdm_sigmsg_t msg; + memset(&msg, 0, sizeof(msg)); + msg.event_id = FTDM_SIGEVENT_INDICATION_COMPLETED; + msg.ev_data.indication_completed.indication = indication; + msg.ev_data.indication_completed.status = status; + ftdm_span_send_signal(fchan->span, &msg); } FT_DECLARE(ftdm_status_t) _ftdm_channel_call_answer(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan) @@ -2233,46 +2281,61 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_answer(const char *file, const char if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call is already TERMINATING\n"); + status = FTDM_ECANCELED; + ftdm_ack_indication(ftdmchan, FTDM_CHANNEL_INDICATE_ANSWER, status); goto done; } - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_ANSWERED); - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_PROGRESS); - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_MEDIA); - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + status = FTDM_EINVAL; + ftdm_ack_indication(ftdmchan, FTDM_CHANNEL_INDICATE_ANSWER, status); goto done; } if (!ftdm_test_flag(ftdmchan->span, FTDM_SPAN_USE_SKIP_STATES)) { /* We will fail RFC's if we not skip states, but some modules apart from ftmod_sangoma_isdn * expect the call to always to go PROGRESS and PROGRESS MEDIA state before going to UP, so - * use FTDM_SPAN_USE_SKIP_STATESfor now while we update the sig modules */ + * use FTDM_SPAN_USE_SKIP_STATES for now while we update the sig modules */ if (ftdmchan->state < FTDM_CHANNEL_STATE_PROGRESS) { - ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS, 1); + status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS, 1); + if (status != FTDM_SUCCESS) { + ftdm_ack_indication(ftdmchan, FTDM_CHANNEL_INDICATE_ANSWER, status); + goto done; + } } /* set state unlocks the channel so we need to re-confirm that the channel hasn't gone to hell */ if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call has moved to TERMINATING while we're moving to PROGRESS\n"); + status = FTDM_ECANCELED; + ftdm_ack_indication(ftdmchan, FTDM_CHANNEL_INDICATE_ANSWER, status); goto done; } if (ftdmchan->state < FTDM_CHANNEL_STATE_PROGRESS_MEDIA) { - ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, 1); + status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, 1); + if (status != FTDM_SUCCESS) { + ftdm_ack_indication(ftdmchan, FTDM_CHANNEL_INDICATE_ANSWER, status); + goto done; + } } /* set state unlocks the channel so we need to re-confirm that the channel hasn't gone to hell */ if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call has moved to TERMINATING while we're moving to UP\n"); + status = FTDM_ECANCELED; + ftdm_ack_indication(ftdmchan, FTDM_CHANNEL_INDICATE_ANSWER, status); goto done; } } - ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_UP, 1); -done: + status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_UP, 1); + if (status != FTDM_SUCCESS) { + ftdm_ack_indication(ftdmchan, FTDM_CHANNEL_INDICATE_ANSWER, status); + } +done: ftdm_channel_unlock(ftdmchan); return status; } @@ -2280,6 +2343,8 @@ done: /* lock must be acquired by the caller! */ static ftdm_status_t call_hangup(ftdm_channel_t *chan, const char *file, const char *func, int line) { + ftdm_status_t status = FTDM_SUCCESS; + ftdm_set_flag(chan, FTDM_CHANNEL_USER_HANGUP); ftdm_set_echocancel_call_end(chan); @@ -2292,7 +2357,7 @@ static ftdm_status_t call_hangup(ftdm_channel_t *chan, const char *file, const c if (chan->hangup_timer) { ftdm_sched_cancel_timer(globals.timingsched, chan->hangup_timer); } - ftdm_channel_set_state(file, func, line, chan, FTDM_CHANNEL_STATE_HANGUP, 1); + status = ftdm_channel_set_state(file, func, line, chan, FTDM_CHANNEL_STATE_HANGUP, 1); } else { /* the signaling stack did not touch the state, * core is responsible from clearing flags and stuff, however, because ftmod_analog @@ -2305,28 +2370,34 @@ static ftdm_status_t call_hangup(ftdm_channel_t *chan, const char *file, const c ftdm_channel_close(&chan); } } - return FTDM_SUCCESS; + return status; } FT_DECLARE(ftdm_status_t) _ftdm_channel_call_hangup_with_cause(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_call_cause_t cause) { + ftdm_status_t status = FTDM_SUCCESS; ftdm_channel_lock(ftdmchan); ftdmchan->caller_data.hangup_cause = cause; - call_hangup(ftdmchan, file, func, line); + status = call_hangup(ftdmchan, file, func, line); ftdm_channel_unlock(ftdmchan); - return FTDM_SUCCESS; + return status; } FT_DECLARE(ftdm_status_t) _ftdm_channel_call_hangup(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan) { + ftdm_status_t status = FTDM_SUCCESS; + ftdm_channel_lock(ftdmchan); + ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_CLEARING; - call_hangup(ftdmchan, file, func, line); + + status = call_hangup(ftdmchan, file, func, line); + ftdm_channel_unlock(ftdmchan); - return FTDM_SUCCESS; + return status; } FT_DECLARE(const char *) ftdm_channel_get_last_error(const ftdm_channel_t *ftdmchan) @@ -2411,13 +2482,31 @@ FT_DECLARE(uint32_t) ftdm_channel_get_ph_span_id(const ftdm_channel_t *ftdmchan) return id; } +/* + * Every user requested indication *MUST* be acknowledged with the proper status (ftdm_status_t) + * If the indication fails before we notify the signaling stack, we *MUST* acknowledge ourselves, + * but if we already notified the signaling stack about the indication, the signaling stack is + * responsible for the acknowledge. + * */ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_indicate(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_channel_indication_t indication) { ftdm_status_t status = FTDM_SUCCESS; + ftdm_channel_lock(ftdmchan); + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Cannot indicate %s in outgoing channel in state %s\n", + ftdm_channel_indication2str(indication), ftdm_channel_state2str(ftdmchan->state)); + status = FTDM_EINVAL; + ftdm_ack_indication(ftdmchan, indication, status); + goto done; + } + if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call has moved to TERMINATING while we're moving to PROGRESS\n"); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Ignoring indication %s because the call is in %s state\n", + ftdm_channel_indication2str(indication), ftdm_channel_state2str(ftdmchan->state)); + status = FTDM_ECANCELED; + ftdm_ack_indication(ftdmchan, indication, status); goto done; } @@ -2425,55 +2514,71 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_indicate(const char *file, const ch /* FIXME: ring and busy cannot be used with all signaling stacks * (particularly isdn stacks I think, we should emulate or just move to hangup with busy cause) */ case FTDM_CHANNEL_INDICATE_RINGING: - ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_RINGING, 1); + status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_RINGING, 1); + if (status != FTDM_SUCCESS) { + ftdm_ack_indication(ftdmchan, indication, status); + } break; case FTDM_CHANNEL_INDICATE_BUSY: - ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_BUSY, 1); + status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_BUSY, 1); + if (status != FTDM_SUCCESS) { + ftdm_ack_indication(ftdmchan, indication, status); + } break; case FTDM_CHANNEL_INDICATE_PROCEED: - if (ftdm_test_flag(ftdmchan->span, FTDM_SPAN_USE_PROCEED_STATE)) { - if (ftdmchan->state == FTDM_CHANNEL_STATE_RING) { - ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROCEED, 1); - } + if (!ftdm_test_flag(ftdmchan->span, FTDM_SPAN_USE_PROCEED_STATE)) { + ftdm_ack_indication(ftdmchan, indication, status); + goto done; + } + status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROCEED, 1); + if (status != FTDM_SUCCESS) { + ftdm_ack_indication(ftdmchan, indication, status); } break; case FTDM_CHANNEL_INDICATE_PROGRESS: - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_PROGRESS); - } else { - ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS, 1); + status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS, 1); + if (status != FTDM_SUCCESS) { + ftdm_ack_indication(ftdmchan, indication, status); } break; case FTDM_CHANNEL_INDICATE_PROGRESS_MEDIA: - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_PROGRESS); - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_MEDIA); - } else { - if (!ftdm_test_flag(ftdmchan->span, FTDM_SPAN_USE_SKIP_STATES)) { - if (ftdmchan->state < FTDM_CHANNEL_STATE_PROGRESS) { - ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS, 1); - } - - /* set state unlocks the channel so we need to re-confirm that the channel hasn't gone to hell */ - if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call has moved to TERMINATING while we're moving to PROGRESS\n"); + if (!ftdm_test_flag(ftdmchan->span, FTDM_SPAN_USE_SKIP_STATES)) { + if (ftdmchan->state < FTDM_CHANNEL_STATE_PROGRESS) { + status = ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS, 1); + if (status != FTDM_SUCCESS) { + ftdm_ack_indication(ftdmchan, indication, status); goto done; } } - ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, 1); + /* set state unlocks the channel so we need to re-confirm that the channel hasn't gone to hell */ + if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call has moved to TERMINATING while we're moving to PROGRESS\n"); + status = FTDM_ECANCELED; + ftdm_ack_indication(ftdmchan, indication, status); + goto done; + } } + ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, 1); + if (status != FTDM_SUCCESS) { + ftdm_ack_indication(ftdmchan, indication, status); + } + break; + case FTDM_CHANNEL_INDICATE_ANSWER: + /* _ftdm_channel_call_indicate takes care of the indication ack */ + status = _ftdm_channel_call_answer(file, func, line, ftdmchan); break; default: ftdm_log(file, func, line, FTDM_LOG_LEVEL_WARNING, "Do not know how to indicate %d\n", indication); status = FTDM_FAIL; + ftdm_ack_indication(ftdmchan, indication, status); break; } done: ftdm_channel_unlock(ftdmchan); - return FTDM_SUCCESS; + return status; } FT_DECLARE(ftdm_status_t) _ftdm_channel_call_send_msg(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_sigmsg_t *sigmsg) diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 097ffca..3809b22 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -1595,6 +1595,9 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) /* use signals queue */ ftdm_set_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE); + /* we can skip states (going straight from RING to UP) */ + ftdm_set_flag(span, FTDM_SPAN_USE_SKIP_STATES); + /* setup the scheduler */ snprintf(schedname, sizeof(schedname), "ftmod_r2_%s", span->name); ftdm_assert(ftdm_sched_create(&r2data->sched, schedname) == FTDM_SUCCESS, "Failed to create schedule!\n"); diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index d27353d..68c9fdc 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -349,11 +349,13 @@ typedef enum { FTDM_SIGEVENT_FACILITY, /*!< In call facility event */ FTDM_SIGEVENT_TRACE, /*!<Interpreted trace event */ FTDM_SIGEVENT_TRACE_RAW, /*!<Raw trace event */ + FTDM_SIGEVENT_INDICATION_COMPLETED, /*!< Last requested indication was completed */ FTDM_SIGEVENT_INVALID, /*!<Invalid */ } ftdm_signal_event_t; #define SIGNAL_STRINGS "START", "STOP", "RELEASED", "UP", "FLASH", "PROCEED", "RINGING", "PROGRESS", \ "PROGRESS_MEDIA", "ALARM_TRAP", "ALARM_CLEAR", \ - "COLLECTED_DIGIT", "ADD_CALL", "RESTART", "SIGSTATUS_CHANGED", "COLLISION", "FACILITY", "TRACE", "TRACE_RAW", "INVALID" + "COLLECTED_DIGIT", "ADD_CALL", "RESTART", "SIGSTATUS_CHANGED", "COLLISION", "FACILITY", \ + "TRACE", "TRACE_RAW", "INDICATION_COMPLETED", "INVALID" /*! \brief Move from string to ftdm_signal_event_t and viceversa */ FTDM_STR2ENUM_P(ftdm_str2ftdm_signal_event, ftdm_signal_event2str, ftdm_signal_event_t) @@ -434,6 +436,31 @@ typedef struct { char digits[FTDM_DIGITS_LIMIT]; } ftdm_event_collected_t; +/*! \brief FreeTDM supported indications. + * This is used during incoming calls when you want to request the signaling stack + * to notify about indications occurring locally. See ftdm_channel_call_indicate for more info */ +typedef enum { + FTDM_CHANNEL_INDICATE_RINGING, + FTDM_CHANNEL_INDICATE_PROCEED, + FTDM_CHANNEL_INDICATE_PROGRESS, + FTDM_CHANNEL_INDICATE_PROGRESS_MEDIA, + FTDM_CHANNEL_INDICATE_BUSY, + /* Using this indication is equivalent to call ftdm_channel_call_answer API */ + FTDM_CHANNEL_INDICATE_ANSWER, + FTDM_CHANNEL_INDICATE_INVALID, +} ftdm_channel_indication_t; +#define INDICATION_STRINGS "RINGING", "PROCEED", "PROGRESS", "PROGRESS_MEDIA", "BUSY", "ANSWER", "INVALID" + +/*! \brief Move from string to ftdm_channel_indication_t and viceversa */ +FTDM_STR2ENUM_P(ftdm_str2channel_indication, ftdm_channel_indication2str, ftdm_channel_indication_t) + +typedef struct { + /* The indication that was completed */ + ftdm_channel_indication_t indication; + /* Completion status of the indication */ + ftdm_status_t status; +} ftdm_event_indication_completed_t; + /*! \brief Generic signaling message */ struct ftdm_sigmsg { ftdm_signal_event_t event_id; /*!< The type of message */ @@ -444,7 +471,8 @@ struct ftdm_sigmsg { union { ftdm_event_sigstatus_t sigstatus; /*!< valid if event_id is FTDM_SIGEVENT_SIGSTATUS_CHANGED */ ftdm_event_trace_t logevent; /*!< valid if event_id is FTDM_SIGEVENT_TRACE or FTDM_SIGEVENT_TRACE_RAW */ - ftdm_event_collected_t collected; /*!< valif if event_id is FTDM_SIGEVENT_COLLECTED_DIGIT */ + ftdm_event_collected_t collected; /*!< valid if event_id is FTDM_SIGEVENT_COLLECTED_DIGIT */ + ftdm_event_indication_completed_t indication_completed; /*!< valid if the event_id is FTDM_SIGEVENT_INDICATION_COMPLETED */ } ev_data; struct { uint8_t autofree; /*!< Whether the freetdm core will free it after message delivery */ @@ -708,17 +736,6 @@ typedef enum { FTDM_CODEC_NONE = (1 << 30) } ftdm_codec_t; -/*! \brief FreeTDM supported indications. - * This is used during incoming calls when you want to request the signaling stack - * to notify about indications occurring locally */ -typedef enum { - FTDM_CHANNEL_INDICATE_RINGING, - FTDM_CHANNEL_INDICATE_PROCEED, - FTDM_CHANNEL_INDICATE_PROGRESS, - FTDM_CHANNEL_INDICATE_PROGRESS_MEDIA, - FTDM_CHANNEL_INDICATE_BUSY, -} ftdm_channel_indication_t; - /*! \brief FreeTDM supported hardware alarms. */ typedef enum { FTDM_ALARM_NONE = 0, @@ -741,7 +758,12 @@ FT_DECLARE(ftdm_status_t) ftdm_global_set_queue_handler(ftdm_queue_handler_t *ha */ FT_DECLARE(int) ftdm_channel_get_availability(ftdm_channel_t *ftdmchan); -/*! \brief Answer call */ +/*! \brief Answer call. This can also be accomplished by ftdm_channel_call_indicate with FTDM_CHANNEL_INDICATE_ANSWER, in both + * cases you will get a FTDM_SIGEVENT_INDICATION_COMPLETED when the indication is sent (or an error occurs) + * \note Although this API will result in FTDM_SIGEVENT_INDICATION_COMPLETED event being delivered, + * there is no guarantee of whether the event will arrive after or before your execution thread returns + * from ftdm_channel_call_answer + */ #define ftdm_channel_call_answer(ftdmchan) _ftdm_channel_call_answer(__FILE__, __FUNCTION__, __LINE__, (ftdmchan)) /*! \brief Answer call recording the source code point where the it was called (see ftdm_channel_call_answer for an easy to use macro) */ @@ -753,7 +775,13 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_answer(const char *file, const char /*! \brief Place an outgoing call recording the source code point where it was called (see ftdm_channel_call_place for an easy to use macro) */ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_place(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan); -/*! \brief Indicate a new condition in an incoming call */ +/*! \brief Indicate a new condition in an incoming call + * \note Every indication request will result in FTDM_SIGEVENT_INDICATION_COMPLETED event being delivered with + * the proper status that will inform you if the request was successful or not. + * Be aware there is no guarantee of whether the event will arrive after or before your execution thread returns + * from ftdm_channel_call_indicate. This means you could get FTDM_SIGEVENT_INDICATION_COMPLETED even before + * your execution thread returns from the ftdm_channel_call_indicate() API + */ #define ftdm_channel_call_indicate(ftdmchan, indication) _ftdm_channel_call_indicate(__FILE__, __FUNCTION__, __LINE__, (ftdmchan), (indication)) /*! \brief Indicate a new condition in an incoming call recording the source code point where it was called (see ftdm_channel_call_indicate for an easy to use macro) */ @@ -1494,9 +1522,14 @@ FT_DECLARE(const char *) ftdm_channel_get_last_state_str(const ftdm_channel_t *c */ FT_DECLARE(char *) ftdm_channel_get_history_str(const ftdm_channel_t *channel); -/*! \brief Initialize channel state for an outgoing call */ +/*! \brief Initialize channel state for an outgoing call + * \note This API will eventually be deprecated, is only needed if you use boost signaling + */ FT_DECLARE(ftdm_status_t) ftdm_channel_init(ftdm_channel_t *ftdmchan); +/*! \brief Enable/disable blocking mode in the channels for this span */ +FT_DECLARE(ftdm_status_t) ftdm_span_set_blocking_mode(const ftdm_span_t *span, ftdm_bool_t enabled); + /*! \brief Initialize the library */ FT_DECLARE(ftdm_status_t) ftdm_global_init(void); diff --git a/libs/freetdm/src/include/ftdm_declare.h b/libs/freetdm/src/include/ftdm_declare.h index bfec448..2e41281 100644 --- a/libs/freetdm/src/include/ftdm_declare.h +++ b/libs/freetdm/src/include/ftdm_declare.h @@ -183,7 +183,15 @@ typedef enum { FTDM_TIMEOUT, /*!< Operation timed out (ie: polling on a device)*/ FTDM_NOTIMPL, /*!< Operation not implemented */ FTDM_BREAK, /*!< Request the caller to perform a break (context-dependant, ie: stop getting DNIS/ANI) */ - FTDM_EINVAL /*!< Invalid argument */ + + /*!< Any new return codes should try to mimc unix style error codes, no need to reinvent */ + /* Remapping some of the codes that were before */ + FTDM_ENOMEM = FTDM_MEMERR, /*!< Memory error */ + FTDM_ETIMEDOUT = FTDM_TIMEOUT, /*!< Operation timedout */ + FTDM_ENOSYS = FTDM_NOTIMPL, /*!< The function is not implemented */ + + FTDM_EINVAL, /*!< Invalid argument */ + FTDM_ECANCELED, /*!< Operation cancelled */ } ftdm_status_t; /*! \brief FreeTDM bool type. */ diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index 650fce2..dd70dd1 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -606,6 +606,7 @@ FT_DECLARE(int) ftdm_vasprintf(char **ret, const char *fmt, va_list ap); FT_DECLARE(ftdm_status_t) ftdm_span_close_all(void); FT_DECLARE(ftdm_status_t) ftdm_channel_open_chan(ftdm_channel_t *ftdmchan); +FT_DECLARE(void) ftdm_ack_indication(const ftdm_channel_t *ftdmchan, ftdm_channel_indication_t indication, ftdm_status_t status); /*! * \brief Retrieves an event from the span diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index 5b9d05e..d70bc69 100644 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -260,9 +260,16 @@ FTDM_STR2ENUM_P(ftdm_str2ftdm_channel_state, ftdm_channel_state2str, ftdm_channe #define FTDM_CHANNEL_OUTBOUND (1ULL << 18) #define FTDM_CHANNEL_SUSPENDED (1ULL << 19) #define FTDM_CHANNEL_3WAY (1ULL << 20) + +/* this 3 flags are really nonsense used by boost module only, as soon + * as we deprecate/delete boost module we can get rid of them + * ================== + * */ #define FTDM_CHANNEL_PROGRESS (1ULL << 21) #define FTDM_CHANNEL_MEDIA (1ULL << 22) #define FTDM_CHANNEL_ANSWERED (1ULL << 23) +/* ================== */ + #define FTDM_CHANNEL_MUTE (1ULL << 24) #define FTDM_CHANNEL_USE_RX_GAIN (1ULL << 25) #define FTDM_CHANNEL_USE_TX_GAIN (1ULL << 26) @@ -273,6 +280,8 @@ FTDM_STR2ENUM_P(ftdm_str2ftdm_channel_state, ftdm_channel_state2str, ftdm_channe #define FTDM_CHANNEL_TX_DISABLED (1ULL << 31) /*!< The user knows about a call in this channel */ #define FTDM_CHANNEL_CALL_STARTED (1ULL << 32) +/*!< The user wants non-blocking operations in the channel */ +#define FTDM_CHANNEL_NONBLOCK (1ULL << 33) typedef enum { ZSM_NONE, commit fa5ec0e553cdf8d41018e1a14a62613134624678 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Dec 23 18:15:37 2010 -0200 freetdm: core - changed behavior of ftdm_channel_close(). instead of returning if the channel isn't opened, not it prints a warning and proceeds to close it. ftmod_r2 - added handler for FTDM_CHANNEL_STATE_RESET state diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 451441e..9ec92e9 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2726,14 +2726,13 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_close(ftdm_channel_t **ftdmchan) if (ftdm_test_flag(check, FTDM_CHANNEL_CONFIGURED)) { ftdm_mutex_lock(check->mutex); - if (ftdm_test_flag(check, FTDM_CHANNEL_OPEN)) { - status = check->fio->close(check); - if (status == FTDM_SUCCESS) { - ftdm_channel_done(check); - *ftdmchan = NULL; - } - } else { - ftdm_log_chan_msg(check, FTDM_LOG_WARNING, "Called ftdm_channel_close but never ftdm_channel_open??\n"); + if (!ftdm_test_flag(check, FTDM_CHANNEL_OPEN)) { + ftdm_log_chan_msg(check, FTDM_LOG_WARNING, "Channel not opened, proceeding anyway\n"); + } + status = check->fio->close(check); + if (status == FTDM_SUCCESS) { + ftdm_channel_done(check); + *ftdmchan = NULL; } check->ring_count = 0; ftdm_mutex_unlock(check->mutex); diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 097ffca..8792b51 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -1237,6 +1237,18 @@ static ftdm_state_map_t r2_state_map = { { ZSD_INBOUND, ZSM_UNACCEPTABLE, + {FTDM_ANY_STATE, FTDM_END}, + {FTDM_CHANNEL_STATE_RESET, FTDM_END} + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_RESET, FTDM_END}, + {FTDM_CHANNEL_STATE_DOWN, FTDM_END} + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_DOWN, FTDM_END}, {FTDM_CHANNEL_STATE_COLLECT, FTDM_END} }, @@ -1288,6 +1300,20 @@ static ftdm_state_map_t r2_state_map = { { ZSD_OUTBOUND, ZSM_UNACCEPTABLE, + {FTDM_ANY_STATE, FTDM_END}, + {FTDM_CHANNEL_STATE_RESET, FTDM_END} + }, + + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_RESET, FTDM_END}, + {FTDM_CHANNEL_STATE_DOWN, FTDM_END} + }, + + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_DOWN, FTDM_END}, {FTDM_CHANNEL_STATE_DIALING, FTDM_END} }, @@ -1774,7 +1800,9 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) /* finished call for good */ case FTDM_CHANNEL_STATE_DOWN: { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "R2 Call is down\n"); + if (ftdmchan->last_state != FTDM_CHANNEL_STATE_RESET) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "R2 Call is down\n"); + } ret = 1; } break; @@ -1786,6 +1814,15 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) } break; + /* put the r2 channel back to IDLE, close ftdmchan and set it's state as DOWN */ + case FTDM_CHANNEL_STATE_RESET: + { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "RESET indicated, putting the R2 channel back to IDLE\n"); + openr2_chan_set_idle(r2chan); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + } + break; + default: { ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Unhandled channel state change: %s\n", ftdm_channel_state2str(ftdmchan->state)); commit 75198fe4cb130f3d6d0d43f50882188879a59f6f Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Dec 23 13:18:41 2010 -0600 audio adjustments diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index fa1f12c..2370e70 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -408,7 +408,7 @@ static switch_status_t conference_local_play_file(conference_obj_t *conference, static switch_status_t conference_member_play_file(conference_member_t *member, char *file, uint32_t leadin); static switch_status_t conference_member_say(conference_member_t *member, char *text, uint32_t leadin); static uint32_t conference_member_stop_file(conference_member_t *member, file_stop_t stop); -static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_memory_pool_t *pool); +static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_core_session_t *session, switch_memory_pool_t *pool); static switch_status_t chat_send(const char *proto, const char *from, const char *to, const char *subject, const char *body, const char *type, const char *hint); @@ -2499,6 +2499,10 @@ static void conference_loop_output(conference_member_t *member) use_buffer = NULL; mux_used = (uint32_t) switch_buffer_inuse(member->mux_buffer); + + if (mux_used < bytes * 2) { + use_timer = 1; + } if (mux_used) { if (mux_used < bytes) { @@ -2512,10 +2516,7 @@ static void conference_loop_output(conference_member_t *member) } } - - use_timer = 1; - - if (mux_used) { + if (mux_used >= bytes) { /* Flush the output buffer and write all the data (presumably muxed) back to the channel */ switch_mutex_lock(member->audio_out_mutex); write_frame.data = data; @@ -2523,7 +2524,7 @@ static void conference_loop_output(conference_member_t *member) low_count = 0; if ((write_frame.datalen = (uint32_t) switch_buffer_read(use_buffer, write_frame.data, bytes))) { if (write_frame.datalen) { - write_frame.samples = write_frame.datalen / 2; + write_frame.samples = write_frame.datalen / 2; if( !switch_test_flag(member, MFLAG_CAN_HEAR)) { memset(write_frame.data, 255, write_frame.datalen); @@ -4347,7 +4348,7 @@ static switch_status_t conf_api_sub_transfer(conference_obj_t *conference, switc } /* Create the conference object. */ - new_conference = conference_new(conf_name, xml_cfg, pool); + new_conference = conference_new(conf_name, xml_cfg, member->session, pool); /* Release the config registry handle */ if (cxml) { @@ -5472,7 +5473,7 @@ SWITCH_STANDARD_APP(conference_function) } /* Create the conference object. */ - conference = conference_new(conf_name, xml_cfg, NULL); + conference = conference_new(conf_name, xml_cfg, session, NULL); if (!conference) { goto done; @@ -5517,7 +5518,7 @@ SWITCH_STANDARD_APP(conference_function) const char *max_members_str; /* couldn't find the conference, create one */ - conference = conference_new(conf_name, xml_cfg, NULL); + conference = conference_new(conf_name, xml_cfg, session, NULL); if (!conference) { goto done; @@ -5942,7 +5943,7 @@ static conference_obj_t *conference_find(char *name) } /* create a new conferene with a specific profile */ -static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_memory_pool_t *pool) +static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_core_session_t *session, switch_memory_pool_t *pool) { conference_obj_t *conference; switch_xml_t xml_kvp; @@ -5985,13 +5986,48 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m char *verbose_events = NULL; char *auto_record = NULL; char *terminate_on_silence = NULL; - + switch_codec_implementation_t read_impl = { 0 }; + switch_channel_t *channel = NULL; + const char *force_rate = NULL, *force_interval = NULL; + uint32_t force_rate_i = 0, force_interval_i = 0; + /* Validate the conference name */ if (zstr(name)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Record! no name.\n"); return NULL; } + if (session) { + uint32_t tmp; + + switch_core_session_get_read_impl(session, &read_impl); + channel = switch_core_session_get_channel(session); + + if ((force_rate = switch_channel_get_variable(channel, "conference_force_rate"))) { + if (!strcasecmp(force_rate, "auto")) { + force_rate_i = read_impl.actual_samples_per_second; + } else { + tmp = atoi(force_rate); + + if (tmp == 8000 || tmp == 12000 || tmp == 16000 || tmp == 24000 || tmp == 32000 || tmp == 48000) { + force_rate_i = rate = tmp; + } + } + } + + if ((force_interval = switch_channel_get_variable(channel, "conference_force_interval"))) { + if (!strcasecmp(force_interval, "auto")) { + force_interval_i = read_impl.microseconds_per_packet / 1000; + } else { + tmp = atoi(force_interval); + + if (SWITCH_ACCEPTABLE_INTERVAL(tmp)) { + force_interval_i = interval = tmp; + } + } + } + } + switch_mutex_lock(globals.hash_mutex); /* parse the profile tree for param values */ @@ -6012,20 +6048,33 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m var = buf; } - if (!strcasecmp(var, "rate") && !zstr(val)) { + if (!force_rate_i && !strcasecmp(var, "rate") && !zstr(val)) { uint32_t tmp = atoi(val); - if (tmp == 8000 || tmp == 12000 || tmp == 16000 || tmp == 24000 || tmp == 32000 || tmp == 48000) { - rate = tmp; + if (session && tmp == 0) { + if (!strcasecmp(val, "auto")) { + rate = read_impl.actual_samples_per_second; + } + } else { + if (tmp == 8000 || tmp == 12000 || tmp == 16000 || tmp == 24000 || tmp == 32000 || tmp == 48000) { + rate = tmp; + } } } else if (!strcasecmp(var, "domain") && !zstr(val)) { domain = val; - } else if (!strcasecmp(var, "interval") && !zstr(val)) { + } else if (!force_interval_i && !strcasecmp(var, "interval") && !zstr(val)) { uint32_t tmp = atoi(val); - if (SWITCH_ACCEPTABLE_INTERVAL(tmp)) { - interval = tmp; + + if (session && tmp == 0) { + if (!strcasecmp(val, "auto")) { + interval = read_impl.microseconds_per_packet / 1000; + } } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, - "Interval must be multipe of 10 and less than %d, Using default of 20\n", SWITCH_MAX_INTERVAL); + if (SWITCH_ACCEPTABLE_INTERVAL(tmp)) { + interval = tmp; + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, + "Interval must be multipe of 10 and less than %d, Using default of 20\n", SWITCH_MAX_INTERVAL); + } } } else if (!strcasecmp(var, "timer-name") && !zstr(val)) { timer_name = val; @@ -6296,6 +6345,7 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m } else { conference->domain = "cluecon.com"; } + conference->rate = rate; conference->interval = interval; diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 60c0bae..5c4aa30 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -2172,8 +2172,9 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t *bytes = sizeof(rtp_msg_t); status = switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock_input, 0, (void *) &rtp_session->recv_msg, bytes); ts = ntohl(rtp_session->recv_msg.header.ts); - - if (ts && !rtp_session->jb && ts <= rtp_session->last_cng_ts) { + + if (*bytes && (!rtp_session->recv_te || rtp_session->recv_msg.header.pt != rtp_session->recv_te) && + ts && !rtp_session->jb && ts == rtp_session->last_cng_ts) { /* we already sent this frame..... */ *bytes = 0; return SWITCH_STATUS_SUCCESS; @@ -2929,8 +2930,13 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ if (do_cng) { uint8_t *data = (uint8_t *) rtp_session->recv_msg.body; - rtp_session->last_cng_ts = rtp_session->last_read_ts + rtp_session->samples_per_interval; - + + if (rtp_session->last_cng_ts == rtp_session->last_read_ts + rtp_session->samples_per_interval) { + rtp_session->last_cng_ts = 0; + } else { + rtp_session->last_cng_ts = rtp_session->last_read_ts + rtp_session->samples_per_interval; + } + memset(data, 0, 2); data[0] = 65; rtp_session->recv_msg.header.pt = (uint32_t) rtp_session->cng_pt ? rtp_session->cng_pt : SWITCH_RTP_CNG_PAYLOAD; commit 656ecc1bc06ec99182a6b7dfb516c8ff14c3b84e Author: Moises Silva <moy@sangoma.com> Date: Thu Dec 23 14:11:09 2010 -0500 freetdm: fix ftmod_zt warning diff --git a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c index 482988d..fe0ed7c 100644 --- a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c +++ b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c @@ -1000,7 +1000,7 @@ FIO_SPAN_POLL_EVENT_FUNCTION(zt_poll_event) */ FIO_CHANNEL_NEXT_EVENT_FUNCTION(zt_channel_next_event) { - uint32_t i, event_id = FTDM_OOB_INVALID; + ftdm_oob_event_t event_id = FTDM_OOB_INVALID; zt_event_t zt_event_id = 0; ftdm_span_t *span = ftdmchan->span; @@ -1079,7 +1079,7 @@ FIO_CHANNEL_NEXT_EVENT_FUNCTION(zt_channel_next_event) break; default: { - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Unhandled event %d for %d:%d\n", zt_event_id, span->span_id, i); + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Unhandled event %d\n", zt_event_id); event_id = FTDM_OOB_INVALID; } break; commit d8c7913b98c9309e5a12eeac52620696d8bf231c Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Dec 23 16:10:53 2010 -0200 freetdm: ftmod_zt - locking the channel on zt_channel_next_event() diff --git a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c index 3fe40dc..5b507bd 100644 --- a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c +++ b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c @@ -1096,6 +1096,7 @@ FIO_CHANNEL_NEXT_EVENT_FUNCTION(zt_channel_next_event) return FTDM_FAIL; } + /* the core already locked the channel for us, so it's safe to call zt_channel_process_event() here */ if ((zt_channel_process_event(ftdmchan, &event_id, zt_event_id)) != FTDM_SUCCESS) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to process event from channel\n"); return FTDM_FAIL; @@ -1130,10 +1131,13 @@ FIO_SPAN_NEXT_EVENT_FUNCTION(zt_next_event) return FTDM_FAIL; } + ftdm_channel_lock(fchan); if ((zt_channel_process_event(fchan, &event_id, zt_event_id)) != FTDM_SUCCESS) { ftdm_log_chan_msg(fchan, FTDM_LOG_ERROR, "Failed to process event from channel\n"); + ftdm_channel_unlock(fchan); return FTDM_FAIL; } + ftdm_channel_unlock(fchan); fchan->last_event_time = 0; span->event_header.e_type = FTDM_EVENT_OOB; commit a797a93feb8cc0f746f0dba404b9c9bc2dbb8f62 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Dec 23 16:05:48 2010 -0200 freetdm: ftmod_zt - refactored zt_channel_next_event(), zt_next_event() and created zt_channel_process_event() diff --git a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c index 482988d..3fe40dc 100644 --- a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c +++ b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c @@ -993,27 +993,14 @@ FIO_SPAN_POLL_EVENT_FUNCTION(zt_poll_event) } /** - * \brief Retrieves an event from a ftdm channel - * \param ftdmchan Channel to retrieve event from - * \param event FreeTDM event to return - * \return Success or failure + * \brief Process an event from a ftdmchan and set the proper OOB event_id. The channel must be locked. + * \param fchan Channel to retrieve event from + * \param event_id Pointer to OOB event id + * \param zt_event_id Zaptel event id + * \return FTDM_SUCCESS or FTDM_FAIL */ -FIO_CHANNEL_NEXT_EVENT_FUNCTION(zt_channel_next_event) +static __inline__ ftdm_status_t zt_channel_process_event(ftdm_channel_t *fchan, ftdm_oob_event_t *event_id, zt_event_t zt_event_id) { - uint32_t i, event_id = FTDM_OOB_INVALID; - zt_event_t zt_event_id = 0; - ftdm_span_t *span = ftdmchan->span; - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_EVENT)) { - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_EVENT); - } - - if (ioctl(ftdmchan->sockfd, codes.GETEVENT, &zt_event_id) == -1) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed retrieving event from channel: %s\n", - strerror(errno)); - return FTDM_FAIL; - } - switch(zt_event_id) { case ZT_EVENT_RINGEROFF: { @@ -1027,63 +1014,92 @@ FIO_CHANNEL_NEXT_EVENT_FUNCTION(zt_channel_next_event) break; case ZT_EVENT_RINGBEGIN: { - event_id = FTDM_OOB_RING_START; + *event_id = FTDM_OOB_RING_START; } break; case ZT_EVENT_ONHOOK: { - event_id = FTDM_OOB_ONHOOK; + *event_id = FTDM_OOB_ONHOOK; } break; case ZT_EVENT_WINKFLASH: { - if (ftdmchan->state == FTDM_CHANNEL_STATE_DOWN || ftdmchan->state == FTDM_CHANNEL_STATE_DIALING) { - event_id = FTDM_OOB_WINK; + if (fchan->state == FTDM_CHANNEL_STATE_DOWN || fchan->state == FTDM_CHANNEL_STATE_DIALING) { + *event_id = FTDM_OOB_WINK; } else { - event_id = FTDM_OOB_FLASH; + *event_id = FTDM_OOB_FLASH; } } break; case ZT_EVENT_RINGOFFHOOK: { - if (ftdmchan->type == FTDM_CHAN_TYPE_FXS || (ftdmchan->type == FTDM_CHAN_TYPE_EM && ftdmchan->state != FTDM_CHANNEL_STATE_UP)) { - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK); - event_id = FTDM_OOB_OFFHOOK; - } else if (ftdmchan->type == FTDM_CHAN_TYPE_FXO) { - event_id = FTDM_OOB_RING_START; + if (fchan->type == FTDM_CHAN_TYPE_FXS || (fchan->type == FTDM_CHAN_TYPE_EM && fchan->state != FTDM_CHANNEL_STATE_UP)) { + ftdm_set_flag_locked(fchan, FTDM_CHANNEL_OFFHOOK); + *event_id = FTDM_OOB_OFFHOOK; + } else if (fchan->type == FTDM_CHAN_TYPE_FXO) { + *event_id = FTDM_OOB_RING_START; } else { - event_id = FTDM_OOB_NOOP; + *event_id = FTDM_OOB_NOOP; } } break; case ZT_EVENT_ALARM: { - event_id = FTDM_OOB_ALARM_TRAP; + *event_id = FTDM_OOB_ALARM_TRAP; } break; case ZT_EVENT_NOALARM: { - event_id = FTDM_OOB_ALARM_CLEAR; + *event_id = FTDM_OOB_ALARM_CLEAR; } break; case ZT_EVENT_BITSCHANGED: { - event_id = FTDM_OOB_CAS_BITS_CHANGE; + *event_id = FTDM_OOB_CAS_BITS_CHANGE; int bits = 0; - int err = ioctl(ftdmchan->sockfd, codes.GETRXBITS, &bits); + int err = ioctl(fchan->sockfd, codes.GETRXBITS, &bits); if (err) { return FTDM_FAIL; } - ftdmchan->rx_cas_bits = bits; + fchan->rx_cas_bits = bits; } break; default: { - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Unhandled event %d for %d:%d\n", zt_event_id, span->span_id, i); - event_id = FTDM_OOB_INVALID; + ftdm_log_chan(fchan, FTDM_LOG_WARNING, "Unhandled event %d\n", zt_event_id); + *event_id = FTDM_OOB_INVALID; } break; } + return FTDM_SUCCESS; +} + +/** + * \brief Retrieves an event from a ftdm channel + * \param ftdmchan Channel to retrieve event from + * \param event FreeTDM event to return + * \return Success or failure + */ +FIO_CHANNEL_NEXT_EVENT_FUNCTION(zt_channel_next_event) +{ + uint32_t event_id = FTDM_OOB_INVALID; + zt_event_t zt_event_id = 0; + ftdm_span_t *span = ftdmchan->span; + + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_EVENT)) { + ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_EVENT); + } + + if (ioctl(ftdmchan->sockfd, codes.GETEVENT, &zt_event_id) == -1) { + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed retrieving event from channel: %s\n", + strerror(errno)); + return FTDM_FAIL; + } + + if ((zt_channel_process_event(ftdmchan, &event_id, zt_event_id)) != FTDM_SUCCESS) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to process event from channel\n"); + return FTDM_FAIL; + } ftdmchan->last_event_time = 0; span->event_header.e_type = FTDM_EVENT_OOB; @@ -1105,91 +1121,26 @@ FIO_SPAN_NEXT_EVENT_FUNCTION(zt_next_event) zt_event_t zt_event_id = 0; for(i = 1; i <= span->chan_count; i++) { - if (ftdm_test_flag(span->channels[i], FTDM_CHANNEL_EVENT)) { - ftdm_clear_flag(span->channels[i], FTDM_CHANNEL_EVENT); - if (ioctl(span->channels[i]->sockfd, codes.GETEVENT, &zt_event_id) == -1) { - snprintf(span->last_error, sizeof(span->last_error), "%s", strerror(errno)); - return FTDM_FAIL; - } - - switch(zt_event_id) { - case ZT_EVENT_RINGEROFF: - { - return FTDM_FAIL; - } - break; - case ZT_EVENT_RINGERON: - { - return FTDM_FAIL; - } - break; - case ZT_EVENT_RINGBEGIN: - { - event_id = FTDM_OOB_RING_START; - } - break; - case ZT_EVENT_ONHOOK: - { - event_id = FTDM_OOB_ONHOOK; - } - break; - case ZT_EVENT_WINKFLASH: - { - if (span->channels[i]->state == FTDM_CHANNEL_STATE_DOWN || span->channels[i]->state == FTDM_CHANNEL_STATE_DIALING) { - event_id = FTDM_OOB_WINK; - } else { - event_id = FTDM_OOB_FLASH; - } - } - break; - case ZT_EVENT_RINGOFFHOOK: - { - if (span->channels[i]->type == FTDM_CHAN_TYPE_FXS || (span->channels[i]->type == FTDM_CHAN_TYPE_EM && span->channels[i]->state != FTDM_CHANNEL_STATE_UP)) { - ftdm_set_flag_locked(span->channels[i], FTDM_CHANNEL_OFFHOOK); - event_id = FTDM_OOB_OFFHOOK; - } else if (span->channels[i]->type == FTDM_CHAN_TYPE_FXO) { - event_id = FTDM_OOB_RING_START; - } else { - event_id = FTDM_OOB_NOOP; - } - } - break; - case ZT_EVENT_ALARM: - { - event_id = FTDM_OOB_ALARM_TRAP; - } - break; - case ZT_EVENT_NOALARM: - { - event_id = FTDM_OOB_ALARM_CLEAR; - } - break; - case ZT_EVENT_BITSCHANGED: - { - event_id = FTDM_OOB_CAS_BITS_CHANGE; - int bits = 0; - int err = ioctl(span->channels[i]->sockfd, codes.GETRXBITS, &bits); - if (err) { - return FTDM_FAIL; - } - span->channels[i]->rx_cas_bits = bits; - } - break; - default: - { - ftdm_log(FTDM_LOG_WARNING, "Unhandled event %d for %d:%d\n", zt_event_id, span->span_id, i); - event_id = FTDM_OOB_INVALID; - } - break; - } + ftdm_channel_t *fchan = span->channels[i]; + if (ftdm_test_flag(fchan, FTDM_CHANNEL_EVENT)) { + ftdm_clear_flag(fchan, FTDM_CHANNEL_EVENT); + } + if (ioctl(fchan->sockfd, codes.GETEVENT, &zt_event_id) == -1) { + snprintf(span->last_error, sizeof(span->last_error), "%s", strerror(errno)); + return FTDM_FAIL; + } - span->channels[i]->last_event_time = 0; - span->event_header.e_type = FTDM_EVENT_OOB; - span->event_header.enum_id = event_id; - span->event_header.channel = span->channels[i]; - *event = &span->event_header; - return FTDM_SUCCESS; + if ((zt_channel_process_event(fchan, &event_id, zt_event_id)) != FTDM_SUCCESS) { + ftdm_log_chan_msg(fchan, FTDM_LOG_ERROR, "Failed to process event from channel\n"); + return FTDM_FAIL; } + + fchan->last_event_time = 0; + span->event_header.e_type = FTDM_EVENT_OOB; + span->event_header.enum_id = event_id; + span->event_header.channel = fchan; + *event = &span->event_header; + return FTDM_SUCCESS; } return FTDM_FAIL; commit 4098b4e289115440a7baa1bdd889d27bece2caf7 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Dec 23 16:04:25 2010 -0200 freetdm: ftmod_wanpipe - fix log msg diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index 7801bd6..2a203fa 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -1386,7 +1386,7 @@ FIO_CHANNEL_NEXT_EVENT_FUNCTION(wanpipe_channel_next_event) ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "read wanpipe event %d\n", tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_type); if ((wanpipe_channel_process_event(ftdmchan, &event_id, &tdm_api)) != FTDM_SUCCESS) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to process events from channel\n"); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to process event from channel\n"); return FTDM_FAIL; } commit 9be9d799f388a8b146f65fb272f5fe3d58993a1c Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Dec 23 12:41:12 2010 -0500 Fix for always returning FTDM_FAIL when sending FACILITY msg diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 11dee98..8d619f8 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -893,6 +893,7 @@ static FIO_CHANNEL_SEND_MSG_FUNCTION(ftdm_sangoma_isdn_send_msg) switch (sigmsg->event_id) { case FTDM_SIGEVENT_FACILITY: sngisdn_snd_fac_req(ftdmchan); + status = FTDM_SUCCESS; break; default: ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Unsupported signalling msg requested\n"); commit 40aa182e3083f6d418da46ec2ae3e6853f5c9c14 Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Dec 23 11:29:55 2010 -0500 Removed check for spInstId when sending Facility msg to allow transmission of FACILITY msg without receiving PROCEED msg from remote side diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index bb04f88..f3ec8b1 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -261,7 +261,7 @@ void sngisdn_snd_fac_req(ftdm_channel_t *ftdmchan) sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { + if (!sngisdn_info->suInstId) { ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending FACILITY, but no call data, ignoring (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); return; } commit 03f5d55fc95d9c3ea2516e8d7a852d1a73cc0eac Author: Georgiewskiy Yuriy <bottleman@icf.org.ru> Date: Thu Dec 23 17:10:59 2010 +0300 change terminal type diff --git a/src/mod/endpoints/mod_h323/mod_h323.cpp b/src/mod/endpoints/mod_h323/mod_h323.cpp index 3d79917..a31f9a8 100644 --- a/src/mod/endpoints/mod_h323/mod_h323.cpp +++ b/src/mod/endpoints/mod_h323/mod_h323.cpp @@ -589,7 +589,7 @@ FSH323EndPoint::FSH323EndPoint() ,m_fax_old_asn(false) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323EndPoint::FSH323EndPoint [%p]\n",this); - terminalType = e_GatewayOnly; + terminalType = e_GatewayAndMC; } FSH323EndPoint::~FSH323EndPoint() commit 34a0ca50960a152c3ca9cee5099f6aa9109f7735 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Dec 22 20:38:57 2010 -0600 drop rtp frame that was already replaced with a cng frame diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 76af5a4..830ea40 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1097,6 +1097,7 @@ typedef enum { CF_JITTERBUFFER, CF_DIALPLAN, CF_BLOCK_BROADCAST_UNTIL_MEDIA, + CF_CNG_PLC, /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ CF_FLAG_MAX } switch_channel_flag_t; diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index e508486..d5d0cb7 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -3112,6 +3112,11 @@ SWITCH_STANDARD_APP(verbose_events_function) switch_channel_set_flag(switch_core_session_get_channel(session), CF_VERBOSE_EVENTS); } +SWITCH_STANDARD_APP(cng_plc_function) +{ + switch_channel_set_flag(switch_core_session_get_channel(session), CF_CNG_PLC); +} + SWITCH_STANDARD_APP(early_hangup_function) { switch_channel_set_flag(switch_core_session_get_channel(session), CF_EARLY_HANGUP); @@ -3497,6 +3502,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) "<ip> <acl | cidr> [<hangup_cause>]", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC); SWITCH_ADD_APP(app_interface, "verbose_events", "Make ALL Events verbose.", "Make ALL Events verbose.", verbose_events_function, "", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC); + SWITCH_ADD_APP(app_interface, "cng_plc", "Do PLC on CNG frames", "", cng_plc_function, "", + SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC); SWITCH_ADD_APP(app_interface, "early_hangup", "Enable early hangup", "", early_hangup_function, "", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC); SWITCH_ADD_APP(app_interface, "sleep", "Pause a channel", SLEEP_LONG_DESC, sleep_function, "<pausemilliseconds>", SAF_SUPPORT_NOMEDIA); SWITCH_ADD_APP(app_interface, "delay_echo", "echo audio at a specified delay", "Delay n ms", delay_function, "<delay ms>", SAF_NONE); diff --git a/src/switch_core_io.c b/src/switch_core_io.c index c3113e9..49956b3 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -341,7 +341,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi } if (status == SWITCH_STATUS_SUCCESS) { - if (switch_channel_test_flag(session->channel, CF_JITTERBUFFER) && !session->plc) { + if ((switch_channel_test_flag(session->channel, CF_JITTERBUFFER) || switch_channel_test_flag(session->channel, CF_CNG_PLC)) + && !session->plc) { session->plc = plc_init(NULL); } diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 1600e28..60c0bae 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -175,6 +175,7 @@ struct switch_rtp { uint32_t ts; uint32_t last_write_ts; uint32_t last_read_ts; + uint32_t last_cng_ts; uint32_t last_write_samplecount; uint32_t next_write_samplecount; switch_time_t last_write_timestamp; @@ -2164,11 +2165,19 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t { switch_status_t status = SWITCH_STATUS_FALSE; stfu_frame_t *jb_frame; + uint32_t ts; switch_assert(bytes); *bytes = sizeof(rtp_msg_t); status = switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock_input, 0, (void *) &rtp_session->recv_msg, bytes); + ts = ntohl(rtp_session->recv_msg.header.ts); + + if (ts && !rtp_session->jb && ts <= rtp_session->last_cng_ts) { + /* we already sent this frame..... */ + *bytes = 0; + return SWITCH_STATUS_SUCCESS; + } if (*bytes) { rtp_session->stats.inbound.raw_bytes += *bytes; @@ -2192,7 +2201,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t } - rtp_session->last_read_ts = ntohl(rtp_session->recv_msg.header.ts); + rtp_session->last_read_ts = ts; if (rtp_session->jb && rtp_session->recv_msg.header.version == 2 && *bytes) { if (rtp_session->recv_msg.header.m && rtp_session->recv_msg.header.pt != rtp_session->recv_te && @@ -2920,7 +2929,8 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ if (do_cng) { uint8_t *data = (uint8_t *) rtp_session->recv_msg.body; - + rtp_session->last_cng_ts = rtp_session->last_read_ts + rtp_session->samples_per_interval; + memset(data, 0, 2); data[0] = 65; rtp_session->recv_msg.header.pt = (uint32_t) rtp_session->cng_pt ? rtp_session->cng_pt : SWITCH_RTP_CNG_PAYLOAD; commit 751e0291ee9bb99119fec0c1cb5814919ec5d8f7 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Dec 22 19:10:30 2010 -0600 prevent race on execute_on_answer called from the B-leg of a call diff --git a/src/include/switch_types.h b/src/include/switch_types.h index e04f437..76af5a4 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1096,6 +1096,7 @@ typedef enum { CF_RECOVERED, CF_JITTERBUFFER, CF_DIALPLAN, + CF_BLOCK_BROADCAST_UNTIL_MEDIA, /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ CF_FLAG_MAX } switch_channel_flag_t; diff --git a/src/switch_core_session.c b/src/switch_core_session.c index c276617..252b5e2 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -1841,6 +1841,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application_async(sw switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "execute-app-arg", arg); } + if (!switch_channel_test_flag(session->channel, CF_PROXY_MODE)) { + switch_channel_set_flag(session->channel, CF_BLOCK_BROADCAST_UNTIL_MEDIA); + } + switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "event-lock", "true"); switch_core_session_queue_private_event(session, &execute_event, SWITCH_FALSE); @@ -1891,9 +1895,19 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application_get_flag switch_goto_status(SWITCH_STATUS_FALSE, done); } } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, - "Cannot execute app '%s' media required on an outbound channel that does not have media established\n", app); - switch_goto_status(SWITCH_STATUS_FALSE, done); + uint32_t ready = 0, sanity = 2000; + + do { + sanity--; + ready = switch_channel_media_ready(session->channel); + switch_cond_next(); + } while(!ready && sanity); + + if (!ready) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, + "Cannot execute app '%s' media required on an outbound channel that does not have media established\n", app); + switch_goto_status(SWITCH_STATUS_FALSE, done); + } } } diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 68d5a55..82c6ff4 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -698,12 +698,23 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_all_messages(switch_core_sessio SWITCH_DECLARE(switch_status_t) switch_ivr_parse_all_events(switch_core_session_t *session) { int x = 0; - + switch_channel_t *channel; switch_ivr_parse_all_messages(session); - while (switch_ivr_parse_next_event(session) == SWITCH_STATUS_SUCCESS) + channel = switch_core_session_get_channel(session); + + if (!switch_channel_test_flag(channel, CF_PROXY_MODE) && switch_channel_test_flag(channel, CF_BLOCK_BROADCAST_UNTIL_MEDIA)) { + if (switch_channel_media_ready(channel)) { + switch_channel_clear_flag(channel, CF_BLOCK_BROADCAST_UNTIL_MEDIA); + } else { + return SWITCH_STATUS_SUCCESS; + } + } + + while (switch_ivr_parse_next_event(session) == SWITCH_STATUS_SUCCESS) { x++; + } if (x) { switch_ivr_sleep(session, 0, SWITCH_TRUE, NULL); commit 7e880ee33e35986a7435d9e1bfc6e2558b2a9e56 Author: Michal Bielicki <michal.bielicki@seventhsignal.de> Date: Wed Dec 22 22:24:26 2010 +0000 cleanup to debian sound file generation and packaging diff --git a/debian/changelog b/debian/changelog index 8065d93..158984b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +freeswitch (1.0.head~git.master.20101222.1-1) unstable; urgency=low + + * cleaning work + + -- Michal Bielicki <michal.bielicki@seventhsignal.de> Wed, 22 Dec 2010 22:48:02 +0200 + freeswitch (1.0.head~git.master.20101015.1-1) unstable; urgency=low * reintroduced mod_flite diff --git a/debian/sounds/freeswitch-sounds-en-us-callie/debian/changelog b/debian/sounds/freeswitch-sounds-en-us-callie/debian/changelog index 9ca1d1a..9bb038a 100644 --- a/debian/sounds/freeswitch-sounds-en-us-callie/debian/changelog +++ b/debian/sounds/freeswitch-sounds-en-us-callie/debian/changelog @@ -1,11 +1,17 @@ -freeswitch-sounds-en-us-callie (1.0.head-git.master,20101014.1-1) unstable; urgency=low +freeswitch-sounds-en-us-callie (1.0.14~git.master.20101222.1-1) unstable; urgency=low - * Change upstream package version numbering scheme for unreleased versions: - new format is major.minor.micro~git.branch.date.commits-1 + * Bumped up to 1.0.14 version + * Clean ups + + -- Michal Bielicki <michal.bielicki@seventhsignal.de> Wed, 22 Dec 2010 22:55:02 +0200 + +freeswitch-sounds-en-us-callie (1.0.head~git.master.20101014.1-1) unstable; urgency=low + + * Change upstream package version numbering scheme for unreleased versions: new format is major.minor.micro~git.branch.date.commits-1 * Change source format to 3.0 (quilt). * Upgrade debhelper compatibility to version 7. - -- Michal Bielicki <michal.bielicki@seventhsignal.de> Fr, 14 Oct 2010 05:05:02 +0200 + -- Michal Bielicki <michal.bielicki@seventhsignal.de> Fri, 14 Oct 2010 05:05:02 +0200 freeswitch-sounds-en-us-callie (1.0.12-0ubuntu1) jaunty; urgency=low diff --git a/debian/sounds/freeswitch-sounds-en-us-callie/debian/files b/debian/sounds/freeswitch-sounds-en-us-callie/debian/files deleted file mode 100644 index 3da0b65..0000000 --- a/debian/sounds/freeswitch-sounds-en-us-callie/debian/files +++ /dev/null @@ -1,6 +0,0 @@ -freeswitch-sounds-en-us-callie-8000_1.0.12-0ubuntu1_all.deb net extra -freeswitch-sounds-en-us-callie-16000_1.0.12-0ubuntu1_all.deb net extra -freeswitch-sounds-en-us-callie-32000_1.0.12-0ubuntu1_all.deb net extra -freeswitch-sounds-en-us-callie-48000_1.0.12-0ubuntu1_all.deb net extra -freeswitch-sounds-en-us-callie_1.0.12-0ubuntu1_all.deb net extra -freeswitch-sounds-en-us-callie-omega_1.0.12-0ubuntu1_all.deb net extra diff --git a/debian/sounds/freeswitch-sounds-en-us-callie/debian/rules b/debian/sounds/freeswitch-sounds-en-us-callie/debian/rules old mode 100644 new mode 100755 diff --git a/debian/sounds/freeswitch-sounds-music/debian/changelog b/debian/sounds/freeswitch-sounds-music/debian/changelog index 2d639c0..c5c52da 100644 --- a/debian/sounds/freeswitch-sounds-music/debian/changelog +++ b/debian/sounds/freeswitch-sounds-music/debian/changelog @@ -1,3 +1,9 @@ +freeswitch-sounds-music (1.0.8~git.master.20101222.1-1) unstable; urgency=low + + * Clean ups + + -- Michal Bielicki <michal.bielicki@seventhsignal.de> Wed, 22 Dec 2010 22:55:02 +0200 + freeswitch-sounds-music (1.0.head-git.master,20101014.1-1) unstable; urgency=low * Change upstream package version numbering scheme for unreleased versions: @@ -5,7 +11,7 @@ freeswitch-sounds-music (1.0.head-git.master,20101014.1-1) unstable; urgency=low * Change source format to 3.0 (quilt). * Upgrade debhelper compatibility to version 7. - -- Michal Bielicki <michal.bielicki@seventhsignal.de> Fr, 14 Oct 2010 05:05:02 +0200 + -- Michal Bielicki <michal.bielicki@seventhsignal.de> Fri, 14 Oct 2010 05:05:02 +0200 freeswitch-sounds-music (1.0.8-0ubuntu3) jaunty; urgency=low diff --git a/debian/sounds/freeswitch-sounds-music/debian/files b/debian/sounds/freeswitch-sounds-music/debian/files deleted file mode 100644 index 9251f8d..0000000 --- a/debian/sounds/freeswitch-sounds-music/debian/files +++ /dev/null @@ -1,6 +0,0 @@ -freeswitch-sounds-music-8000_1.0.8-0ubuntu3_all.deb net extra -freeswitch-sounds-music-16000_1.0.8-0ubuntu3_all.deb net extra -freeswitch-sounds-music-32000_1.0.8-0ubuntu3_all.deb net extra -freeswitch-sounds-music-48000_1.0.8-0ubuntu3_all.deb net extra -freeswitch-sounds-music_1.0.8-0ubuntu3_all.deb net extra -freeswitch-sounds-music-omega_1.0.8-0ubuntu3_all.deb net extra diff --git a/debian/sounds/freeswitch-sounds-music/debian/rules b/debian/sounds/freeswitch-sounds-music/debian/rules old mode 100644 new mode 100755 diff --git a/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/changelog b/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/changelog index 38cc529..44eb4c7 100644 --- a/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/changelog +++ b/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/changelog @@ -1,3 +1,9 @@ +freeswitch-sounds-ru-ru-elena (1.0.8~git.master.20101222.1-1) unstable; urgency=low + + * Clean ups + + -- Michal Bielicki <michal.bielicki@seventhsignal.de> Wed, 22 Dec 2010 22:55:02 +0200 + freeswitch-sounds-ru-ru-elena (1.0.head-git.master,20101014.1-1) unstable; urgency=low * Change upstream package version numbering scheme for unreleased versions: diff --git a/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/files b/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/files deleted file mode 100644 index f4b6f0c..0000000 --- a/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/files +++ /dev/null @@ -1,6 +0,0 @@ -freeswitch-sounds-ru-ru-elena-8000_1.0.12-0ubuntu3_all.deb net extra -freeswitch-sounds-ru-ru-elena-16000_1.0.12-0ubuntu3_all.deb net extra -freeswitch-sounds-ru-ru-elena-32000_1.0.12-0ubuntu3_all.deb net extra -freeswitch-sounds-ru-ru-elena-48000_1.0.12-0ubuntu3_all.deb net extra -freeswitch-sounds-ru-ru-elena_1.0.12-0ubuntu3_all.deb net extra -freeswitch-sounds-ru-ru-elena-omega_1.0.12-0ubuntu3_all.deb net extra diff --git a/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/rules b/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/rules old mode 100644 new mode 100755 diff --git a/debian/sounds/getsounds.sh b/debian/sounds/getsounds.sh index bf59a02..b75a86f 100755 --- a/debian/sounds/getsounds.sh +++ b/debian/sounds/getsounds.sh @@ -1,5 +1,5 @@ #!/bin/bash -sounds_en_us_callie="freeswitch-sounds-en-us-callie-48000-1.0.12.tar.gz" +sounds_en_us_callie="freeswitch-sounds-en-us-callie-48000-1.0.14.tar.gz" sounds_music="freeswitch-sounds-music-48000-1.0.8.tar.gz" sounds_ru_RU_elena="freeswitch-sounds-ru-RU-elena-48000-1.0.12.tar.gz" @@ -27,4 +27,4 @@ if [ ! -f $sounds_ru_RU_elena ] wget http://files.freeswitch.org/$sounds_ru_RU_elena fi tar zxvf $sounds_ru_RU_elena -cd .. \ No newline at end of file +cd .. commit ad1d1d2bab2716b9f7f4b7de2922dc2fb242780c Author: Jeff Lenk <jeff@jefflenk.com> Date: Wed Dec 22 16:13:18 2010 -0600 vs2008 express fix build diff --git a/Freeswitch.2008.express.sln b/Freeswitch.2008.express.sln index ad3cafe..d9cb441 100644 --- a/Freeswitch.2008.express.sln +++ b/Freeswitch.2008.express.sln @@ -1642,6 +1642,7 @@ Global {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.All|Win32.Build.0 = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.All|x64.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|Win32.ActiveCfg = Debug|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|Win32.Build.0 = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|x64.ActiveCfg = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|x64.Build.0 = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Release|Win32.ActiveCfg = Release|Win32 @@ -2047,6 +2048,7 @@ Global {B808178B-82F0-4CF4-A2B1-921939FA24D0}.Debug|Win32.Build.0 = Debug|Win32 {B808178B-82F0-4CF4-A2B1-921939FA24D0}.Debug|x64.ActiveCfg = Debug|Win32 {B808178B-82F0-4CF4-A2B1-921939FA24D0}.Release|Win32.ActiveCfg = Release|Win32 + {B808178B-82F0-4CF4-A2B1-921939FA24D0}.Release|Win32.Build.0 = Release|Win32 {B808178B-82F0-4CF4-A2B1-921939FA24D0}.Release|x64.ActiveCfg = Release|Win32 {9778F1C0-09BC-4698-8EBC-BD982247209A}.All|Win32.ActiveCfg = Release|Win32 {9778F1C0-09BC-4698-8EBC-BD982247209A}.All|x64.ActiveCfg = Release|x64 commit 3910889aec891e96179a8f748e594857588fb389 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Wed Dec 22 20:10:41 2010 -0200 freetdm: ftmod_wanpipe - not locking the channel on wanpipe_channel_next_event(), now the core takes care of that diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index caddc33..7801bd6 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -1385,13 +1385,10 @@ FIO_CHANNEL_NEXT_EVENT_FUNCTION(wanpipe_channel_next_event) } ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "read wanpipe event %d\n", tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_type); - ftdm_channel_lock(ftdmchan); if ((wanpipe_channel_process_event(ftdmchan, &event_id, &tdm_api)) != FTDM_SUCCESS) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to process events from channel\n"); - ftdm_channel_unlock(ftdmchan); return FTDM_FAIL; } - ftdm_channel_unlock(ftdmchan); ftdmchan->last_event_time = 0; span->event_header.e_type = FTDM_EVENT_OOB; commit 3e32e6ad7b63a16135bf0b2355608e86a46b9795 Merge: 248fe20 bc0414a Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Wed Dec 22 20:08:05 2010 -0200 Merge branch 'master' into arnaldo.span_event_refactor Conflicts: libs/freetdm/src/ftdm_io.c diff --cc libs/freetdm/src/ftdm_io.c index a8b6049,451441e..b04cf4f --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@@ -1160,13 -1152,36 +1163,16 @@@ FT_DECLARE(ftdm_status_t) ftdm_channel_ status = span->fio->channel_next_event(ftdmchan, event); if (status != FTDM_SUCCESS) { - return status; + goto done; } - /* before returning the event to the user we do some core operations with certain OOB events */ - memset(&sigmsg, 0, sizeof(sigmsg)); - sigmsg.span_id = span->span_id; - sigmsg.chan_id = (*event)->channel->chan_id; - sigmsg.channel = (*event)->channel; - switch ((*event)->enum_id) { - case FTDM_OOB_ALARM_CLEAR: - { - sigmsg.event_id = FTDM_SIGEVENT_ALARM_CLEAR; - ftdm_clear_flag_locked((*event)->channel, FTDM_CHANNEL_IN_ALARM); - ftdm_span_send_signal(span, &sigmsg); - } - break; - case FTDM_OOB_ALARM_TRAP: - { - sigmsg.event_id = FTDM_SIGEVENT_ALARM_TRAP; - ftdm_set_flag_locked((*event)->channel, FTDM_CHANNEL_IN_ALARM); - ftdm_span_send_signal(span, &sigmsg); - } - break; - default: - /* NOOP */ - break; + status = ftdm_event_handle_oob(*event); + if (status != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_ERROR, "failed to send SIGEVENT signal to user\n"); } + + done: + ftdm_channel_unlock(ftdmchan); return status; } commit 5b752c54a7c6c6368c97cf458340c71634c3ab39 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Dec 22 15:53:11 2010 -0600 fix ignore_early_media=ring_ready diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 51032de..26d8374 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -488,7 +488,7 @@ static uint8_t check_channel_status(originate_global_t *oglobals, originate_stat pindex = (uint32_t) i; } else if (!oglobals->sent_ring && oglobals->ignore_early_media == 2 && len == 1 && caller_channel && !oglobals->ignore_ring_ready) { switch_channel_pass_callee_id(originate_status[0].peer_channel, caller_channel); - //switch_channel_ring_ready(caller_channel); + switch_channel_ring_ready(caller_channel); oglobals->sent_ring = 1; } commit bc0414a8b533568bdbc84bdd78d288f056e8b231 Merge: 818887f eaf9a41 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Wed Dec 22 19:30:44 2010 -0200 Merge branch 'master' into arnaldo.zt_chan_next_event commit 818887f9d3d5095f6a5e29c0d72b0bd9385707e4 Merge: a3ea8a8 54359f1 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Wed Dec 22 19:09:53 2010 -0200 Merge branch 'master' into arnaldo.zt_chan_next_event commit 248fe20dcc59a38afea330b39ceb8f4aeb248b94 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Wed Dec 22 19:08:49 2010 -0200 freetdm: ftmod_wanpipe - pass tdm_api as a pointer to wanpipe_channel_process_event() diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index 34369e4..caddc33 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -1241,12 +1241,12 @@ static FIO_GET_ALARMS_FUNCTION(wanpipe_get_alarms) * \param tdm_api Wanpipe tdm struct that contain the event * \return FTDM_SUCCESS or FTDM_FAIL */ -static __inline__ ftdm_status_t wanpipe_channel_process_event(ftdm_channel_t *fchan, ftdm_oob_event_t *event_id, wanpipe_tdm_api_t tdm_api) +static __inline__ ftdm_status_t wanpipe_channel_process_event(ftdm_channel_t *fchan, ftdm_oob_event_t *event_id, wanpipe_tdm_api_t *tdm_api) { - switch(tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_type) { + switch(tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_type) { case WP_API_EVENT_LINK_STATUS: { - switch(tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_link_status) { + switch(tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_link_status) { case WP_TDMAPI_EVENT_LINK_STATUS_CONNECTED: *event_id = FTDM_OOB_ALARM_CLEAR; break; @@ -1260,7 +1260,7 @@ static __inline__ ftdm_status_t wanpipe_channel_process_event(ftdm_channel_t *fc case WP_API_EVENT_RXHOOK: { if (fchan->type == FTDM_CHAN_TYPE_FXS) { - *event_id = tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_hook_state & WP_TDMAPI_EVENT_RXHOOK_OFF ? FTDM_OOB_OFFHOOK : FTDM_OOB_ONHOOK; + *event_id = tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_hook_state & WP_TDMAPI_EVENT_RXHOOK_OFF ? FTDM_OOB_OFFHOOK : FTDM_OOB_ONHOOK; if (*event_id == FTDM_OOB_OFFHOOK) { if (ftdm_test_flag(fchan, FTDM_CHANNEL_FLASH)) { ftdm_clear_flag(fchan, FTDM_CHANNEL_FLASH); @@ -1296,26 +1296,26 @@ static __inline__ ftdm_status_t wanpipe_channel_process_event(ftdm_channel_t *fc break; case WP_API_EVENT_RING_DETECT: { - *event_id = tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_ring_state == WP_TDMAPI_EVENT_RING_PRESENT ? FTDM_OOB_RING_START : FTDM_OOB_RING_STOP; + *event_id = tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_ring_state == WP_TDMAPI_EVENT_RING_PRESENT ? FTDM_OOB_RING_START : FTDM_OOB_RING_STOP; } break; /* disabled this ones when configuring, we don't need them, do we? case WP_API_EVENT_RING_TRIP_DETECT: { - *event_id = tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_ring_state == WP_TDMAPI_EVENT_RING_PRESENT ? FTDM_OOB_ONHOOK : FTDM_OOB_OFFHOOK; + *event_id = tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_ring_state == WP_TDMAPI_EVENT_RING_PRESENT ? FTDM_OOB_ONHOOK : FTDM_OOB_OFFHOOK; } break; */ case WP_API_EVENT_RBS: { *event_id = FTDM_OOB_CAS_BITS_CHANGE; - fchan->rx_cas_bits = wanpipe_swap_bits(tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_rbs_bits); + fchan->rx_cas_bits = wanpipe_swap_bits(tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_rbs_bits); } break; case WP_API_EVENT_DTMF: { - char tmp_dtmf[2] = { tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_dtmf_digit, 0 }; + char tmp_dtmf[2] = { tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_dtmf_digit, 0 }; *event_id = FTDM_OOB_NOOP; if (tmp_dtmf[0] == 'f') { @@ -1323,11 +1323,11 @@ static __inline__ ftdm_status_t wanpipe_channel_process_event(ftdm_channel_t *fc break; } - if (tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_dtmf_type == WAN_EC_TONE_PRESENT) { + if (tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_dtmf_type == WAN_EC_TONE_PRESENT) { ftdm_set_flag(fchan, FTDM_CHANNEL_MUTE); } - if (tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_dtmf_type == WAN_EC_TONE_STOP) { + if (tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_dtmf_type == WAN_EC_TONE_STOP) { ftdm_clear_flag(fchan, FTDM_CHANNEL_MUTE); if (ftdm_test_flag(fchan, FTDM_CHANNEL_INUSE)) { ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Queuing wanpipe DTMF: %c\n", tmp_dtmf[0]); @@ -1338,7 +1338,7 @@ static __inline__ ftdm_status_t wanpipe_channel_process_event(ftdm_channel_t *fc break; case WP_API_EVENT_ALARM: { - ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Got wanpipe alarms %d\n", tdm_api.wp_tdm_cmd.event.wp_api_event_alarm); + ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Got wanpipe alarms %d\n", tdm_api->wp_tdm_cmd.event.wp_api_event_alarm); *event_id = FTDM_OOB_ALARM_TRAP; } break; @@ -1350,7 +1350,7 @@ static __inline__ ftdm_status_t wanpipe_channel_process_event(ftdm_channel_t *fc break; default: { - ftdm_log_chan(fchan, FTDM_LOG_WARNING, "Unhandled wanpipe event %d\n", tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_type); + ftdm_log_chan(fchan, FTDM_LOG_WARNING, "Unhandled wanpipe event %d\n", tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_type); *event_id = FTDM_OOB_INVALID; } break; @@ -1386,7 +1386,7 @@ FIO_CHANNEL_NEXT_EVENT_FUNCTION(wanpipe_channel_next_event) ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "read wanpipe event %d\n", tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_type); ftdm_channel_lock(ftdmchan); - if ((wanpipe_channel_process_event(ftdmchan, &event_id, tdm_api)) != FTDM_SUCCESS) { + if ((wanpipe_channel_process_event(ftdmchan, &event_id, &tdm_api)) != FTDM_SUCCESS) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to process events from channel\n"); ftdm_channel_unlock(ftdmchan); return FTDM_FAIL; @@ -1457,7 +1457,7 @@ FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_span_next_event) ftdm_log_chan(span->channels[i], FTDM_LOG_DEBUG, "read wanpipe event %d\n", tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_type); ftdm_channel_lock(ftdmchan); - if ((wanpipe_channel_process_event(ftdmchan, &event_id, tdm_api)) != FTDM_SUCCESS) { + if ((wanpipe_channel_process_event(ftdmchan, &event_id, &tdm_api)) != FTDM_SUCCESS) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to process events from channel\n"); ftdm_channel_unlock(ftdmchan); return FTDM_FAIL; commit 3a8ce05cc667dce575eec4d4aad8ea36cc62b877 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Wed Dec 22 18:50:19 2010 -0200 freetdm: ftmod_wanpipe - refactored wanpipe_channel_next_event(), wanpipe_span_next_event() and created wanpipe_channel_process_event(), used by both diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index 5e9318f..34369e4 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -1235,41 +1235,23 @@ static FIO_GET_ALARMS_FUNCTION(wanpipe_get_alarms) } /** - * \brief Retrieves an event from a wanpipe channel - * \param channel Channel to retrieve event from - * \param event FreeTDM event to return - * \return Success or failure + * \brief Process an event in a channel and set it's OOB event id. The channel must be locked. + * \param fchan Channel in which event occured + * \param event_id Pointer where we save the OOB event id + * \param tdm_api Wanpipe tdm struct that contain the event + * \return FTDM_SUCCESS or FTDM_FAIL */ -FIO_CHANNEL_NEXT_EVENT_FUNCTION(wanpipe_channel_next_event) +static __inline__ ftdm_status_t wanpipe_channel_process_event(ftdm_channel_t *fchan, ftdm_oob_event_t *event_id, wanpipe_tdm_api_t tdm_api) { - ftdm_status_t status; - ftdm_oob_event_t event_id; - wanpipe_tdm_api_t tdm_api; - ftdm_span_t *span = ftdmchan->span; - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_EVENT)) { - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_EVENT); - } - - memset(&tdm_api, 0, sizeof(tdm_api)); - status = sangoma_tdm_read_event(ftdmchan->sockfd, &tdm_api); - if (status != FTDM_SUCCESS) { - snprintf(span->last_error, sizeof(span->last_error), "%s", strerror(errno)); - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to read event from channel: %s\n", strerror(errno)); - return FTDM_FAIL; - } - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "read wanpipe event %d\n", tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_type); switch(tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_type) { - case WP_API_EVENT_LINK_STATUS: { switch(tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_link_status) { case WP_TDMAPI_EVENT_LINK_STATUS_CONNECTED: - event_id = FTDM_OOB_ALARM_CLEAR; + *event_id = FTDM_OOB_ALARM_CLEAR; break; default: - event_id = FTDM_OOB_ALARM_TRAP; + *event_id = FTDM_OOB_ALARM_TRAP; break; }; } @@ -1277,103 +1259,139 @@ FIO_CHANNEL_NEXT_EVENT_FUNCTION(wanpipe_channel_next_event) case WP_API_EVENT_RXHOOK: { - if (ftdmchan->type == FTDM_CHAN_TYPE_FXS) { - event_id = tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_hook_state & WP_TDMAPI_EVENT_RXHOOK_OFF ? FTDM_OOB_OFFHOOK : FTDM_OOB_ONHOOK; - if (event_id == FTDM_OOB_OFFHOOK) { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_FLASH)) { - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_FLASH); - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_WINK); - event_id = FTDM_OOB_FLASH; + if (fchan->type == FTDM_CHAN_TYPE_FXS) { + *event_id = tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_hook_state & WP_TDMAPI_EVENT_RXHOOK_OFF ? FTDM_OOB_OFFHOOK : FTDM_OOB_ONHOOK; + if (*event_id == FTDM_OOB_OFFHOOK) { + if (ftdm_test_flag(fchan, FTDM_CHANNEL_FLASH)) { + ftdm_clear_flag(fchan, FTDM_CHANNEL_FLASH); + ftdm_clear_flag(fchan, FTDM_CHANNEL_WINK); + *event_id = FTDM_OOB_FLASH; goto event; } else { - ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_WINK); + ftdm_set_flag(fchan, FTDM_CHANNEL_WINK); } } else { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_WINK)) { - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_WINK); - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_FLASH); - event_id = FTDM_OOB_WINK; + if (ftdm_test_flag(fchan, FTDM_CHANNEL_WINK)) { + ftdm_clear_flag(fchan, FTDM_CHANNEL_WINK); + ftdm_clear_flag(fchan, FTDM_CHANNEL_FLASH); + *event_id = FTDM_OOB_WINK; goto event; } else { - ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_FLASH); + ftdm_set_flag(fchan, FTDM_CHANNEL_FLASH); } } break; } else { + ftdm_status_t status; wanpipe_tdm_api_t onhook_tdm_api; memset(&onhook_tdm_api, 0, sizeof(onhook_tdm_api)); - status = sangoma_tdm_txsig_onhook(ftdmchan->sockfd, &onhook_tdm_api); + status = sangoma_tdm_txsig_onhook(fchan->sockfd, &onhook_tdm_api); if (status) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "ONHOOK Failed"); + snprintf(fchan->last_error, sizeof(fchan->last_error), "ONHOOK Failed"); return FTDM_FAIL; } - event_id = onhook_tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_hook_state & WP_TDMAPI_EVENT_RXHOOK_OFF ? FTDM_OOB_ONHOOK : FTDM_OOB_NOOP; + *event_id = onhook_tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_hook_state & WP_TDMAPI_EVENT_RXHOOK_OFF ? FTDM_OOB_ONHOOK : FTDM_OOB_NOOP; } } break; case WP_API_EVENT_RING_DETECT: { - event_id = tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_ring_state == WP_TDMAPI_EVENT_RING_PRESENT ? FTDM_OOB_RING_START : FTDM_OOB_RING_STOP; + *event_id = tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_ring_state == WP_TDMAPI_EVENT_RING_PRESENT ? FTDM_OOB_RING_START : FTDM_OOB_RING_STOP; } break; /* disabled this ones when configuring, we don't need them, do we? case WP_API_EVENT_RING_TRIP_DETECT: { - event_id = tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_ring_state == WP_TDMAPI_EVENT_RING_PRESENT ? FTDM_OOB_ONHOOK : FTDM_OOB_OFFHOOK; + *event_id = tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_ring_state == WP_TDMAPI_EVENT_RING_PRESENT ? FTDM_OOB_ONHOOK : FTDM_OOB_OFFHOOK; } break; */ case WP_API_EVENT_RBS: { - event_id = FTDM_OOB_CAS_BITS_CHANGE; - ftdmchan->rx_cas_bits = wanpipe_swap_bits(tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_rbs_bits); + *event_id = FTDM_OOB_CAS_BITS_CHANGE; + fchan->rx_cas_bits = wanpipe_swap_bits(tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_rbs_bits); } break; case WP_API_EVENT_DTMF: { char tmp_dtmf[2] = { tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_dtmf_digit, 0 }; - event_id = FTDM_OOB_NOOP; + *event_id = FTDM_OOB_NOOP; if (tmp_dtmf[0] == 'f') { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Ignoring wanpipe DTMF: %c, fax tones will be passed through!\n", tmp_dtmf[0]); + ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Ignoring wanpipe DTMF: %c, fax tones will be passed through!\n", tmp_dtmf[0]); break; } if (tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_dtmf_type == WAN_EC_TONE_PRESENT) { - ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_MUTE); + ftdm_set_flag(fchan, FTDM_CHANNEL_MUTE); } if (tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_dtmf_type == WAN_EC_TONE_STOP) { - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_MUTE); - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Queuing wanpipe DTMF: %c\n", tmp_dtmf[0]); - ftdm_channel_queue_dtmf(ftdmchan, tmp_dtmf); + ftdm_clear_flag(fchan, FTDM_CHANNEL_MUTE); + if (ftdm_test_flag(fchan, FTDM_CHANNEL_INUSE)) { + ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Queuing wanpipe DTMF: %c\n", tmp_dtmf[0]); + ftdm_channel_queue_dtmf(fchan, tmp_dtmf); } } } break; case WP_API_EVENT_ALARM: { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Got wanpipe alarms %d\n", tdm_api.wp_tdm_cmd.event.wp_api_event_alarm); - event_id = FTDM_OOB_ALARM_TRAP; + ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "Got wanpipe alarms %d\n", tdm_api.wp_tdm_cmd.event.wp_api_event_alarm); + *event_id = FTDM_OOB_ALARM_TRAP; } break; case WP_API_EVENT_POLARITY_REVERSE: { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Got polarity reverse\n"); - event_id = FTDM_OOB_POLARITY_REVERSE; + ftdm_log_chan_msg(fchan, FTDM_LOG_DEBUG, "Got polarity reverse\n"); + *event_id = FTDM_OOB_POLARITY_REVERSE; } break; default: { - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Unhandled wanpipe event %d\n", tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_type); - event_id = FTDM_OOB_INVALID; + ftdm_log_chan(fchan, FTDM_LOG_WARNING, "Unhandled wanpipe event %d\n", tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_type); + *event_id = FTDM_OOB_INVALID; } break; } - event: + return FTDM_SUCCESS; +} + +/** + * \brief Retrieves an event from a wanpipe channel + * \param channel Channel to retrieve event from + * \param event FreeTDM event to return + * \return Success or failure + */ +FIO_CHANNEL_NEXT_EVENT_FUNCTION(wanpipe_channel_next_event) +{ + ftdm_status_t status; + ftdm_oob_event_t event_id; + wanpipe_tdm_api_t tdm_api; + ftdm_span_t *span = ftdmchan->span; + + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_EVENT)) { + ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_EVENT); + } + + memset(&tdm_api, 0, sizeof(tdm_api)); + status = sangoma_tdm_read_event(ftdmchan->sockfd, &tdm_api); + if (status != FTDM_SUCCESS) { + snprintf(span->last_error, sizeof(span->last_error), "%s", strerror(errno)); + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to read event from channel: %s\n", strerror(errno)); + return FTDM_FAIL; + } + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "read wanpipe event %d\n", tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_type); + ftdm_channel_lock(ftdmchan); + if ((wanpipe_channel_process_event(ftdmchan, &event_id, tdm_api)) != FTDM_SUCCESS) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to process events from channel\n"); + ftdm_channel_unlock(ftdmchan); + return FTDM_FAIL; + } + ftdm_channel_unlock(ftdmchan); ftdmchan->last_event_time = 0; span->event_header.e_type = FTDM_EVENT_OOB; @@ -1436,120 +1454,15 @@ FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_span_next_event) snprintf(span->last_error, sizeof(span->last_error), "%s", strerror(errno)); return FTDM_FAIL; } - ftdm_log_chan(span->channels[i], FTDM_LOG_DEBUG, "read wanpipe event %d\n", tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_type); - switch(tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_type) { - - case WP_API_EVENT_LINK_STATUS: - { - switch(tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_link_status) { - case WP_TDMAPI_EVENT_LINK_STATUS_CONNECTED: - event_id = FTDM_OOB_ALARM_CLEAR; - break; - default: - event_id = FTDM_OOB_ALARM_TRAP; - break; - }; - } - break; - case WP_API_EVENT_RXHOOK: - { - if (span->channels[i]->type == FTDM_CHAN_TYPE_FXS) { - event_id = tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_hook_state & WP_TDMAPI_EVENT_RXHOOK_OFF ? FTDM_OOB_OFFHOOK : FTDM_OOB_ONHOOK; - if (event_id == FTDM_OOB_OFFHOOK) { - if (ftdm_test_flag(span->channels[i], FTDM_CHANNEL_FLASH)) { - ftdm_clear_flag_locked(span->channels[i], FTDM_CHANNEL_FLASH); - ftdm_clear_flag_locked(span->channels[i], FTDM_CHANNEL_WINK); - event_id = FTDM_OOB_FLASH; - goto event; - } else { - ftdm_set_flag_locked(span->channels[i], FTDM_CHANNEL_WINK); - } - } else { - if (ftdm_test_flag(span->channels[i], FTDM_CHANNEL_WINK)) { - ftdm_clear_flag_locked(span->channels[i], FTDM_CHANNEL_WINK); - ftdm_clear_flag_locked(span->channels[i], FTDM_CHANNEL_FLASH); - event_id = FTDM_OOB_WINK; - goto event; - } else { - ftdm_set_flag_locked(span->channels[i], FTDM_CHANNEL_FLASH); - } - } - continue; - } else { - int err; - ftdm_channel_t *ftdmchan = span->channels[i]; - err=sangoma_tdm_txsig_onhook(ftdmchan->sockfd,&tdm_api); - if (err) { - snprintf(span->channels[i]->last_error, sizeof(span->channels[i]->last_error), "ONHOOK Failed"); - return FTDM_FAIL; - } - event_id = tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_hook_state & WP_TDMAPI_EVENT_RXHOOK_OFF ? FTDM_OOB_ONHOOK : FTDM_OOB_NOOP; - } - } - break; - case WP_API_EVENT_RING_DETECT: - { - event_id = tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_ring_state == WP_TDMAPI_EVENT_RING_PRESENT ? FTDM_OOB_RING_START : FTDM_OOB_RING_STOP; - } - break; - /* - disabled this ones when configuring, we don't need them, do we? - case WP_API_EVENT_RING_TRIP_DETECT: - { - event_id = tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_ring_state == WP_TDMAPI_EVENT_RING_PRESENT ? FTDM_OOB_ONHOOK : FTDM_OOB_OFFHOOK; - } - break; - */ - case WP_API_EVENT_RBS: - { - event_id = FTDM_OOB_CAS_BITS_CHANGE; - span->channels[i]->rx_cas_bits = wanpipe_swap_bits(tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_rbs_bits); - } - break; - case WP_API_EVENT_DTMF: - { - char tmp_dtmf[2] = { tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_dtmf_digit, 0 }; - event_id = FTDM_OOB_NOOP; - - if (tmp_dtmf[0] == 'f') { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Ignoring wanpipe DTMF: %c, fax tones will be passed through!\n", tmp_dtmf[0]); - break; - } - - if (tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_dtmf_type == WAN_EC_TONE_PRESENT) { - ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_MUTE); - } - - if (tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_dtmf_type == WAN_EC_TONE_STOP) { - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_MUTE); - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Queuing wanpipe DTMF: %c\n", tmp_dtmf[0]); - ftdm_channel_queue_dtmf(ftdmchan, tmp_dtmf); - } - } - } - break; - case WP_API_EVENT_ALARM: - { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Got wanpipe alarms %d\n", tdm_api.wp_tdm_cmd.event.wp_api_event_alarm); - event_id = FTDM_OOB_ALARM_TRAP; - } - break; - case WP_API_EVENT_POLARITY_REVERSE: - { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Got polarity reverse\n"); - event_id = FTDM_OOB_POLARITY_REVERSE; - } - break; - default: - { - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Unhandled wanpipe event %d\n", tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_type); - event_id = FTDM_OOB_INVALID; - } - break; + ftdm_channel_lock(ftdmchan); + if ((wanpipe_channel_process_event(ftdmchan, &event_id, tdm_api)) != FTDM_SUCCESS) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to process events from channel\n"); + ftdm_channel_unlock(ftdmchan); + return FTDM_FAIL; } + ftdm_channel_unlock(ftdmchan); event: @@ -1561,9 +1474,7 @@ FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_span_next_event) return FTDM_SUCCESS; } } - return FTDM_FAIL; - } /** commit eaf9a41f52c5b88db7004baa03edc13a07fca0a2 Merge: 358a319 4f89b51 Author: Moises Silva <moy@sangoma.com> Date: Wed Dec 22 15:26:31 2010 -0500 Merge branch 'master' of git.sangoma.com:smg_freeswitch commit 358a3192c55816d012a2d727a88924788ea1afb8 Author: Moises Silva <moy@sangoma.com> Date: Wed Dec 22 15:26:10 2010 -0500 freetdm: remove unused core flag macros diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index b90e987..650fce2 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -730,26 +730,6 @@ static __inline__ int ftdm_check_state_all(ftdm_span_t *span, ftdm_channel_state return 1; } -static __inline__ void ftdm_set_flag_all(ftdm_span_t *span, uint32_t flag) -{ - uint32_t j; - ftdm_mutex_lock(span->mutex); - for(j = 1; j <= span->chan_count; j++) { - ftdm_set_flag_locked((span->channels[j]), flag); - } - ftdm_mutex_unlock(span->mutex); -} - -static __inline__ void ftdm_clear_flag_all(ftdm_span_t *span, uint32_t flag) -{ - uint32_t j; - ftdm_mutex_lock(span->mutex); - for(j = 1; j <= span->chan_count; j++) { - ftdm_clear_flag_locked((span->channels[j]), flag); - } - ftdm_mutex_unlock(span->mutex); -} - static __inline__ int16_t ftdm_saturated_add(int16_t sample1, int16_t sample2) { int addres; commit 4f89b514cd5c71e43e44a20a0da7ca58bedff5b1 Merge: 525b097 b61f729 Author: Moises Silva <moy@sangoma.com> Date: Wed Dec 22 15:09:01 2010 -0500 Merge remote branch 'fsorig/master' commit 525b0978caebd16184020edc935a60832095e9e9 Author: Moises Silva <moy@sangoma.com> Date: Wed Dec 22 15:07:32 2010 -0500 freetdm: ftmod_r2 - use openr2 API extension to properly report incoming restricted ANI and restrict ANI on outgoing calls diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index e3ae0cf..097ffca 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -468,9 +468,10 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(r2_outgoing_call) } callstatus = openr2_chan_make_call(R2CALL(ftdmchan)->r2chan, - ftdmchan->caller_data.pres == FTDM_PRES_ALLOWED ? ftdmchan->caller_data.cid_num.digits : NULL, + ftdmchan->caller_data.cid_num.digits, ftdmchan->caller_data.dnis.digits, - category); + category, + ftdmchan->caller_data.pres == FTDM_PRES_ALLOWED ? 0 : 1); if (callstatus) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Failed to make call in R2 channel, openr2_chan_make_call failed\n"); @@ -666,12 +667,14 @@ static void ftdm_r2_on_call_init(openr2_chan_t *r2chan) static void dump_mf(openr2_chan_t *r2chan); /* only called for incoming calls when the ANI, DNIS etc is complete and the user has to decide either to accept or reject the call */ -static void ftdm_r2_on_call_offered(openr2_chan_t *r2chan, const char *ani, const char *dnis, openr2_calling_party_category_t category) +static void ftdm_r2_on_call_offered(openr2_chan_t *r2chan, const char *ani, const char *dnis, + openr2_calling_party_category_t category, int ani_restricted) { ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); ftdm_r2_data_t *r2data = ftdmchan->span->signal_data; - ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Call offered with ANI = %s, DNIS = %s, Category = (%d)\n", ani, dnis, category); + ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Call offered with ANI = %s, DNIS = %s, Category = %d, ANI restricted = %s\n", + ani, dnis, category, ani_restricted ? "Yes" : "No"); /* nothing went wrong during call setup, MF has ended, we can and must disable the MF dump */ if (r2data->mf_dump_size) { @@ -687,6 +690,7 @@ static void ftdm_r2_on_call_offered(openr2_chan_t *r2chan, const char *ani, cons ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); } ftdmchan->caller_data.cpc = ftdm_openr2_cpc_to_r2_ftdm_cpc(category); + ftdmchan->caller_data.pres = ani_restricted ? FTDM_PRES_RESTRICTED : FTDM_PRES_ALLOWED; } /* commit 0ab67997f9a267d53c1a40ccdfc86b8cfbf840a0 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Wed Dec 22 17:35:55 2010 -0200 freetdm: ftmod_r2 - refactored ftdm_span_next_event(), ftdm_channel_read_event() and created ftdm_event_handle_oob(), which handle oob events and notify the user by sending the proper SIGEVENT message diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index b812414..a8b6049 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -1091,54 +1091,65 @@ FT_DECLARE(ftdm_status_t) ftdm_span_poll_event(ftdm_span_t *span, uint32_t ms, s return FTDM_NOTIMPL; } -FT_DECLARE(ftdm_status_t) ftdm_span_next_event(ftdm_span_t *span, ftdm_event_t **event) +/* handle oob events and send the proper SIGEVENT signal to user, when applicable */ +static __inline__ ftdm_status_t ftdm_event_handle_oob(ftdm_event_t *event) { - ftdm_status_t status = FTDM_FAIL; ftdm_sigmsg_t sigmsg; - ftdm_assert_return(span->fio != NULL, FTDM_FAIL, "No I/O module attached to this span!\n"); - - if (!span->fio->next_event) { - ftdm_log(FTDM_LOG_ERROR, "next_event method not implemented in module %s!", span->fio->name); - return FTDM_NOTIMPL; - } - - status = span->fio->next_event(span, event); - if (status != FTDM_SUCCESS) { - return status; - } + ftdm_status_t status = FTDM_SUCCESS; + ftdm_channel_t *fchan = event->channel; + ftdm_span_t *span = fchan->span; - /* before returning the event to the user we do some core operations with certain OOB events */ memset(&sigmsg, 0, sizeof(sigmsg)); sigmsg.span_id = span->span_id; - sigmsg.chan_id = (*event)->channel->chan_id; - sigmsg.channel = (*event)->channel; - switch ((*event)->enum_id) { + sigmsg.chan_id = fchan->chan_id; + sigmsg.channel = fchan; + switch (event->enum_id) { case FTDM_OOB_ALARM_CLEAR: { sigmsg.event_id = FTDM_SIGEVENT_ALARM_CLEAR; - ftdm_clear_flag_locked((*event)->channel, FTDM_CHANNEL_IN_ALARM); - ftdm_span_send_signal(span, &sigmsg); + ftdm_clear_flag_locked(fchan, FTDM_CHANNEL_IN_ALARM); + status = ftdm_span_send_signal(span, &sigmsg); } break; case FTDM_OOB_ALARM_TRAP: { sigmsg.event_id = FTDM_SIGEVENT_ALARM_TRAP; - ftdm_set_flag_locked((*event)->channel, FTDM_CHANNEL_IN_ALARM); - ftdm_span_send_signal(span, &sigmsg); + ftdm_set_flag_locked(fchan, FTDM_CHANNEL_IN_ALARM); + status = ftdm_span_send_signal(span, &sigmsg); } break; default: /* NOOP */ break; } + return status; +} + +FT_DECLARE(ftdm_status_t) ftdm_span_next_event(ftdm_span_t *span, ftdm_event_t **event) +{ + ftdm_status_t status = FTDM_FAIL; + ftdm_assert_return(span->fio != NULL, FTDM_FAIL, "No I/O module attached to this span!\n"); + + if (!span->fio->next_event) { + ftdm_log(FTDM_LOG_ERROR, "next_event method not implemented in module %s!", span->fio->name); + return FTDM_NOTIMPL; + } + status = span->fio->next_event(span, event); + if (status != FTDM_SUCCESS) { + return status; + } + + status = ftdm_event_handle_oob(*event); + if (status != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_ERROR, "failed to send SIGEVENT signal to user\n"); + } return status; } FT_DECLARE(ftdm_status_t) ftdm_channel_read_event(ftdm_channel_t *ftdmchan, ftdm_event_t **event) { ftdm_status_t status = FTDM_FAIL; - ftdm_sigmsg_t sigmsg; ftdm_span_t *span = ftdmchan->span; ftdm_assert_return(span->fio != NULL, FTDM_FAIL, "No I/O module attached to this span!\n"); @@ -1152,31 +1163,10 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_read_event(ftdm_channel_t *ftdmchan, ftdm return status; } - /* before returning the event to the user we do some core operations with certain OOB events */ - memset(&sigmsg, 0, sizeof(sigmsg)); - sigmsg.span_id = span->span_id; - sigmsg.chan_id = (*event)->channel->chan_id; - sigmsg.channel = (*event)->channel; - switch ((*event)->enum_id) { - case FTDM_OOB_ALARM_CLEAR: - { - sigmsg.event_id = FTDM_SIGEVENT_ALARM_CLEAR; - ftdm_clear_flag_locked((*event)->channel, FTDM_CHANNEL_IN_ALARM); - ftdm_span_send_signal(span, &sigmsg); - } - break; - case FTDM_OOB_ALARM_TRAP: - { - sigmsg.event_id = FTDM_SIGEVENT_ALARM_TRAP; - ftdm_set_flag_locked((*event)->channel, FTDM_CHANNEL_IN_ALARM); - ftdm_span_send_signal(span, &sigmsg); - } - break; - default: - /* NOOP */ - break; + status = ftdm_event_handle_oob(*event); + if (status != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_ERROR, "failed to send SIGEVENT signal to user\n"); } - return status; } commit b61f72906882b0f1d1538c1e21502e0fc5581282 Author: Michal Bielicki <michal.bielicki@seventhsignal.de> Date: Wed Dec 22 18:55:18 2010 +0000 added polish ringtone diff --git a/conf/vars.xml b/conf/vars.xml index f17540c..0e8782c 100644 --- a/conf/vars.xml +++ b/conf/vars.xml @@ -206,6 +206,7 @@ <X-PRE-PROCESS cmd="set" data="ru-ring=%(800,3200,425,0)"/> <X-PRE-PROCESS cmd="set" data="de-ring=%(1000,4000,425,0)"/> <X-PRE-PROCESS cmd="set" data="dz-ring=%(1500,3500,425.0,0.0)"/> + <X-PRE-PROCESS cmd="set" data="pl-ring=%(1000,4000,425,0)"/> <X-PRE-PROCESS cmd="set" data="bong-ring=v=-7;%(100,0,941.0,1477.0);v=-7;>=2;+=.1;%(1400,0,350,440)"/> <X-PRE-PROCESS cmd="set" data="sit=%(274,0,913.8);%(274,0,1370.6);%(380,0,1776.7)"/> <!-- commit 90e58696fec3dc29f64eb43aa872a5ae9081e6e3 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Dec 22 12:21:52 2010 -0600 fix dtmf issue with jb on diff --git a/src/switch_rtp.c b/src/switch_rtp.c index aa4ca7a..1600e28 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -174,6 +174,7 @@ struct switch_rtp { void *private_data; uint32_t ts; uint32_t last_write_ts; + uint32_t last_read_ts; uint32_t last_write_samplecount; uint32_t next_write_samplecount; switch_time_t last_write_timestamp; @@ -2183,21 +2184,23 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t rtp_session->stats.inbound.packet_count++; } - if (*bytes != 0 && !rtp_session->jb) { - if ((rtp_session->recv_te && rtp_session->recv_msg.header.pt == rtp_session->recv_te) || - *bytes < rtp_header_len || - switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA) || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_UDPTL)) { - return SWITCH_STATUS_SUCCESS; - } + + if ((rtp_session->recv_te && rtp_session->recv_msg.header.pt == rtp_session->recv_te) || + (*bytes < rtp_header_len && *bytes > 0) || + switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA) || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_UDPTL)) { + return SWITCH_STATUS_SUCCESS; } + + rtp_session->last_read_ts = ntohl(rtp_session->recv_msg.header.ts); + if (rtp_session->jb && rtp_session->recv_msg.header.version == 2 && *bytes) { if (rtp_session->recv_msg.header.m && rtp_session->recv_msg.header.pt != rtp_session->recv_te && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO) && !(rtp_session->rtp_bugs & RTP_BUG_IGNORE_MARK_BIT)) { stfu_n_reset(rtp_session->jb); } - stfu_n_eat(rtp_session->jb, ntohl(rtp_session->recv_msg.header.ts), + stfu_n_eat(rtp_session->jb, rtp_session->last_read_ts, rtp_session->recv_msg.header.pt, rtp_session->recv_msg.body, *bytes - rtp_header_len, rtp_session->timer.samplecount); *bytes = 0; commit a971e7de708d954db27ab8a8dfdcca2fbc7e077f Author: Jeff Lenk <jeff@jefflenk.com> Date: Tue Dec 21 22:20:49 2010 -0600 vs2010 reswig diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx index 1ad1b16..6ffeeed 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx @@ -12406,13 +12406,15 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_number(char * jarg1) { } -SWIGEXPORT char * SWIGSTDCALL CSharp_switch_strip_spaces(char * jarg1) { +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_strip_spaces(char * jarg1, int jarg2) { char * jresult ; char *arg1 = (char *) 0 ; + switch_bool_t arg2 ; char *result = 0 ; arg1 = (char *)jarg1; - result = (char *)switch_strip_spaces((char const *)arg1); + arg2 = (switch_bool_t)jarg2; + result = (char *)switch_strip_spaces(arg1,arg2); jresult = SWIG_csharp_string_callback((const char *)result); return jresult; } @@ -22969,6 +22971,16 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_caller_extension(void * ja } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_sort_cid(void * jarg1, int jarg2) { + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + switch_bool_t arg2 ; + + arg1 = (switch_channel_t *)jarg1; + arg2 = (switch_bool_t)jarg2; + switch_channel_sort_cid(arg1,arg2); +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_get_caller_extension(void * jarg1) { void * jresult ; switch_channel_t *arg1 = (switch_channel_t *) 0 ; @@ -28310,6 +28322,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_activate_jitter_buffer(void * jarg1 } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_debug_jitter_buffer(void * jarg1, char * jarg2) { + int jresult ; + switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_rtp_t *)jarg1; + arg2 = (char *)jarg2; + result = (switch_status_t)switch_rtp_debug_jitter_buffer(arg1,(char const *)arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_deactivate_jitter_buffer(void * jarg1) { int jresult ; switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs index 4b9ce71..d0d09b6 100644 --- a/src/mod/languages/mod_managed/managed/swig.2010.cs +++ b/src/mod/languages/mod_managed/managed/swig.2010.cs @@ -2877,8 +2877,8 @@ public class freeswitch { return ret; } - public static string switch_strip_spaces(string str) { - string ret = freeswitchPINVOKE.switch_strip_spaces(str); + public static string switch_strip_spaces(string str, switch_bool_t dup) { + string ret = freeswitchPINVOKE.switch_strip_spaces(str, (int)dup); return ret; } @@ -3328,6 +3328,10 @@ public class freeswitch { freeswitchPINVOKE.switch_channel_set_caller_extension(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_caller_extension.getCPtr(caller_extension)); } + public static void switch_channel_sort_cid(SWIGTYPE_p_switch_channel channel, switch_bool_t arg1) { + freeswitchPINVOKE.switch_channel_sort_cid(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)arg1); + } + public static switch_caller_extension switch_channel_get_caller_extension(SWIGTYPE_p_switch_channel channel) { IntPtr cPtr = freeswitchPINVOKE.switch_channel_get_caller_extension(SWIGTYPE_p_switch_channel.getCPtr(channel)); switch_caller_extension ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_extension(cPtr, false); @@ -4645,6 +4649,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_rtp_debug_jitter_buffer(SWIGTYPE_p_switch_rtp rtp_session, string name) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_debug_jitter_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), name); + return ret; + } + public static switch_status_t switch_rtp_deactivate_jitter_buffer(SWIGTYPE_p_switch_rtp rtp_session) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_deactivate_jitter_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session)); return ret; @@ -8661,7 +8670,7 @@ class freeswitchPINVOKE { public static extern int switch_is_number(string jarg1); [DllImport("mod_managed", EntryPoint="CSharp_switch_strip_spaces")] - public static extern string switch_strip_spaces(string jarg1); + public static extern string switch_strip_spaces(string jarg1, int jarg2); [DllImport("mod_managed", EntryPoint="CSharp_switch_strip_whitespace")] public static extern string switch_strip_whitespace(string jarg1); @@ -11327,6 +11336,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_caller_extension")] public static extern void switch_channel_set_caller_extension(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_sort_cid")] + public static extern void switch_channel_sort_cid(HandleRef jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_caller_extension")] public static extern IntPtr switch_channel_get_caller_extension(HandleRef jarg1); @@ -12455,6 +12467,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_activate_jitter_buffer")] public static extern int switch_rtp_activate_jitter_buffer(HandleRef jarg1, uint jarg2, uint jarg3, uint jarg4, uint jarg5); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_debug_jitter_buffer")] + public static extern int switch_rtp_debug_jitter_buffer(HandleRef jarg1, string jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_deactivate_jitter_buffer")] public static extern int switch_rtp_deactivate_jitter_buffer(HandleRef jarg1); @@ -21563,6 +21578,7 @@ public enum switch_channel_flag_t { CF_BRIDGE_NOWRITE, CF_RECOVERED, CF_JITTERBUFFER, + CF_DIALPLAN, CF_FLAG_MAX } commit fe005bddd7eaf6bb2f8e3569b5f7563265c00052 Author: Jeff Lenk <jeff@jefflenk.com> Date: Tue Dec 21 22:15:03 2010 -0600 FS-2789 fix secondary issue with min_digits = 0 and terminator key pressed to cancel diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 710c0a7..b983d5e 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -1874,6 +1874,11 @@ SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t status = SWITCH_STATUS_SUCCESS; } + if ((min_digits == 0) && (strlen(digit_buffer) == 0) && switch_channel_get_variable(channel, SWITCH_READ_TERMINATOR_USED_VARIABLE) != 0) + { + return SWITCH_STATUS_SUCCESS; + } + if (!(status == SWITCH_STATUS_TOO_SMALL && strlen(digit_buffer) == 0)) { if (status == SWITCH_STATUS_SUCCESS) { if (!zstr(digit_buffer)) { commit b49c366efb37d9eebd9f597d2bafb27d3709115f Author: Joao Mesquita <jmesquita@freeswitch.org> Date: Tue Dec 21 23:55:26 2010 -0300 Fix some log lines and a flag logic. diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 9c3ba0f..fa1f12c 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -30,6 +30,7 @@ * Chris Danielson <chris at maxpowersoft dot com> * Rupa Schomaker <rupa@rupa.com> * David Weekly <david@weekly.org> + * Joao Mesquita <jmesquita@gmail.com> * * mod_conference.c -- Software Conference Bridge * @@ -689,13 +690,13 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe } if (!switch_channel_test_app_flag_key("conf_silent", channel, CONF_SILENT_REQ) && !zstr(conference->enter_sound)) { - if (!zstr(switch_channel_get_variable(channel, "conference_enter_sound"))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Playing file...%s\n", conference->name); - conference_play_file(conference, (char *)switch_channel_get_variable(channel, "conference_enter_sound"), CONF_DEFAULT_LEADIN, - switch_core_session_get_channel(member->session), switch_test_flag(conference, CFLAG_WAIT_MOD) ? 0 : 1); + const char * enter_sound = switch_channel_get_variable(channel, "conference_enter_sound"); + if (!zstr(enter_sound)) { + conference_play_file(conference, (char *)enter_sound, CONF_DEFAULT_LEADIN, + switch_core_session_get_channel(member->session), !switch_test_flag(conference, CFLAG_WAIT_MOD) ? 0 : 1); } else { conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), - switch_test_flag(conference, CFLAG_WAIT_MOD) ? 0 : 1); + !switch_test_flag(conference, CFLAG_WAIT_MOD) ? 0 : 1); } } } commit 48ed9c2c5d5a5833096ca9f476b40d997dcefd6f Merge: 651acc6 4d7e4f1 Author: Joao Mesquita <jmesquita@freeswitch.org> Date: Tue Dec 21 23:41:42 2010 -0300 Merge branch 'master' of git@git.freeswitch.org:freeswitch commit 651acc62f7ddcab09992ba9f98f66ae8303e7d93 Author: Joao Mesquita <jmesquita@freeswitch.org> Date: Tue Dec 21 23:39:05 2010 -0300 Add a chan var conference_enter_sound to override conference enter-sound param on the profile diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index cf8ae96..9c3ba0f 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -689,8 +689,14 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe } if (!switch_channel_test_app_flag_key("conf_silent", channel, CONF_SILENT_REQ) && !zstr(conference->enter_sound)) { - conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), + if (!zstr(switch_channel_get_variable(channel, "conference_enter_sound"))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Playing file...%s\n", conference->name); + conference_play_file(conference, (char *)switch_channel_get_variable(channel, "conference_enter_sound"), CONF_DEFAULT_LEADIN, + switch_core_session_get_channel(member->session), switch_test_flag(conference, CFLAG_WAIT_MOD) ? 0 : 1); + } else { + conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), switch_test_flag(conference, CFLAG_WAIT_MOD) ? 0 : 1); + } } } commit 4d7e4f1ec20bb0091ac3a978d3927c0191f93ccd Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Dec 21 20:30:19 2010 -0600 change switch_strip_spaces to specify if you want it to dup the string or destroy the current buffer diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index e2a7335..3360f33 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -622,7 +622,7 @@ SWITCH_DECLARE(unsigned int) switch_separate_string(_In_ char *buf, char delim, SWITCH_DECLARE(unsigned int) switch_separate_string_string(char *buf, char *delim, _Post_count_(return) char **array, unsigned int arraylen); SWITCH_DECLARE(switch_bool_t) switch_is_number(const char *str); -SWITCH_DECLARE(char *) switch_strip_spaces(const char *str); +SWITCH_DECLARE(char *) switch_strip_spaces(char *str, switch_bool_t dup); SWITCH_DECLARE(char *) switch_strip_whitespace(const char *str); SWITCH_DECLARE(char *) switch_strip_commas(char *in, char *out, switch_size_t len); SWITCH_DECLARE(char *) switch_strip_nonnumerics(char *in, char *out, switch_size_t len); diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index dba86e3..2deb437 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -1428,8 +1428,8 @@ SWITCH_STANDARD_API(cond_function) int a_is_num, b_is_num; *expr++ = '\0'; b = expr; - s_a = switch_strip_spaces(a); - s_b = switch_strip_spaces(b); + s_a = switch_strip_spaces(a, SWITCH_TRUE); + s_b = switch_strip_spaces(b, SWITCH_TRUE); a_is_num = switch_is_number(s_a); b_is_num = switch_is_number(s_b); diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index 1d3c5d6..2c88f65 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -12726,13 +12726,15 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_number(char * jarg1) { } -SWIGEXPORT char * SWIGSTDCALL CSharp_switch_strip_spaces(char * jarg1) { +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_strip_spaces(char * jarg1, int jarg2) { char * jresult ; char *arg1 = (char *) 0 ; + switch_bool_t arg2 ; char *result = 0 ; arg1 = (char *)jarg1; - result = (char *)switch_strip_spaces((char const *)arg1); + arg2 = (switch_bool_t)jarg2; + result = (char *)switch_strip_spaces(arg1,arg2); jresult = SWIG_csharp_string_callback((const char *)result); return jresult; } @@ -23624,6 +23626,16 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_caller_extension(void * ja } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_sort_cid(void * jarg1, int jarg2) { + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + switch_bool_t arg2 ; + + arg1 = (switch_channel_t *)jarg1; + arg2 = (switch_bool_t)jarg2; + switch_channel_sort_cid(arg1,arg2); +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_get_caller_extension(void * jarg1) { void * jresult ; switch_channel_t *arg1 = (switch_channel_t *) 0 ; @@ -29013,6 +29025,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_activate_jitter_buffer(void * jarg1 } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_debug_jitter_buffer(void * jarg1, char * jarg2) { + int jresult ; + switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_rtp_t *)jarg1; + arg2 = (char *)jarg2; + result = (switch_status_t)switch_rtp_debug_jitter_buffer(arg1,(char const *)arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_deactivate_jitter_buffer(void * jarg1) { int jresult ; switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index 9decf74..bf32881 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -2867,8 +2867,8 @@ public class freeswitch { return ret; } - public static string switch_strip_spaces(string str) { - string ret = freeswitchPINVOKE.switch_strip_spaces(str); + public static string switch_strip_spaces(string str, switch_bool_t dup) { + string ret = freeswitchPINVOKE.switch_strip_spaces(str, (int)dup); return ret; } @@ -3318,6 +3318,10 @@ public class freeswitch { freeswitchPINVOKE.switch_channel_set_caller_extension(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_caller_extension.getCPtr(caller_extension)); } + public static void switch_channel_sort_cid(SWIGTYPE_p_switch_channel channel, switch_bool_t arg1) { + freeswitchPINVOKE.switch_channel_sort_cid(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)arg1); + } + public static switch_caller_extension switch_channel_get_caller_extension(SWIGTYPE_p_switch_channel channel) { IntPtr cPtr = freeswitchPINVOKE.switch_channel_get_caller_extension(SWIGTYPE_p_switch_channel.getCPtr(channel)); switch_caller_extension ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_extension(cPtr, false); @@ -4635,6 +4639,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_rtp_debug_jitter_buffer(SWIGTYPE_p_switch_rtp rtp_session, string name) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_debug_jitter_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), name); + return ret; + } + public static switch_status_t switch_rtp_deactivate_jitter_buffer(SWIGTYPE_p_switch_rtp rtp_session) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_deactivate_jitter_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session)); return ret; @@ -8647,7 +8656,7 @@ class freeswitchPINVOKE { public static extern int switch_is_number(string jarg1); [DllImport("mod_managed", EntryPoint="CSharp_switch_strip_spaces")] - public static extern string switch_strip_spaces(string jarg1); + public static extern string switch_strip_spaces(string jarg1, int jarg2); [DllImport("mod_managed", EntryPoint="CSharp_switch_strip_whitespace")] public static extern string switch_strip_whitespace(string jarg1); @@ -11313,6 +11322,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_caller_extension")] public static extern void switch_channel_set_caller_extension(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_sort_cid")] + public static extern void switch_channel_sort_cid(HandleRef jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_caller_extension")] public static extern IntPtr switch_channel_get_caller_extension(HandleRef jarg1); @@ -12441,6 +12453,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_activate_jitter_buffer")] public static extern int switch_rtp_activate_jitter_buffer(HandleRef jarg1, uint jarg2, uint jarg3, uint jarg4, uint jarg5); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_debug_jitter_buffer")] + public static extern int switch_rtp_debug_jitter_buffer(HandleRef jarg1, string jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_deactivate_jitter_buffer")] public static extern int switch_rtp_deactivate_jitter_buffer(HandleRef jarg1); @@ -21509,6 +21524,7 @@ public enum switch_channel_flag_t { CF_BRIDGE_NOWRITE, CF_RECOVERED, CF_JITTERBUFFER, + CF_DIALPLAN, CF_FLAG_MAX } diff --git a/src/mod/languages/mod_perl/mod_perl_wrap.cpp b/src/mod/languages/mod_perl/mod_perl_wrap.cpp index 370c88b..2efbdf1 100644 --- a/src/mod/languages/mod_perl/mod_perl_wrap.cpp +++ b/src/mod/languages/mod_perl/mod_perl_wrap.cpp @@ -9732,17 +9732,17 @@ XS(SWIG_init) { SWIG_TypeClientData(SWIGTYPE_p_IVRMenu, (void*) "freeswitch::IVRMenu"); SWIG_TypeClientData(SWIGTYPE_p_API, (void*) "freeswitch::API"); SWIG_TypeClientData(SWIGTYPE_p_input_callback_state, (void*) "freeswitch::input_callback_state_t"); - /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_HUP", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_HUP))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; - /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_FREE", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_FREE))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; - /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_RDLOCK", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_RDLOCK))); SvREADONLY_on(sv); diff --git a/src/switch_utils.c b/src/switch_utils.c index 1a29e2b..7331a97 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -831,9 +831,9 @@ SWITCH_DECLARE(char *) switch_strip_whitespace(const char *str) return s; } -SWITCH_DECLARE(char *) switch_strip_spaces(const char *str) +SWITCH_DECLARE(char *) switch_strip_spaces(char *str, switch_bool_t dup) { - const char *sp = str; + char *sp = str; char *p, *s = NULL; if (!sp) @@ -843,7 +843,11 @@ SWITCH_DECLARE(char *) switch_strip_spaces(const char *str) sp++; } - s = strdup(sp); + if (dup) { + s = strdup(sp); + } else { + s = sp; + } if (!s) return NULL; commit 638cbf16ccf1403db0c39104d18fc5d8ea194273 Author: Brian West <brian@freeswitch.org> Date: Tue Dec 21 19:32:54 2010 -0600 Sofia madness to make crap just work diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 945740e..961eaa3 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1065,6 +1065,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand if (exptime && v_event && *v_event) { char *exp_var; char *allow_multireg = NULL; + int force_connectile = 0; allow_multireg = switch_event_get_header(*v_event, "sip-allow-multiple-registrations"); if (allow_multireg && switch_false(allow_multireg)) { @@ -1081,8 +1082,13 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand to_user = force_user; } - if ((v_contact_str = switch_event_get_header(*v_event, "sip-force-contact"))) { - if (!strcasecmp(v_contact_str, "NDLB-connectile-dysfunction-2.0")) { + if (profile->rport_level == 3 && sip->sip_user_agent && + sip->sip_user_agent->g_string && !strncasecmp(sip->sip_user_agent->g_string, "Polycom", 7)) { + force_connectile = 1; + } + + if ((v_contact_str = switch_event_get_header(*v_event, "sip-force-contact")) || force_connectile) { + if ((!strcasecmp(v_contact_str, "NDLB-connectile-dysfunction-2.0")) || force_connectile) { char *path_encoded; size_t path_encoded_len; char my_contact_str[1024]; commit a3ea8a8f201ed18e87d4693bccbf298a1abfbdc4 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Tue Dec 21 22:13:16 2010 -0200 freetdm: ftmod_zt - clear FTDM_CHANNEL_EVENT flag on zt_channel_next_event when set, but retrieve event from channel even when it's not diff --git a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c index 7ce3f71..482988d 100644 --- a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c +++ b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c @@ -1006,92 +1006,91 @@ FIO_CHANNEL_NEXT_EVENT_FUNCTION(zt_channel_next_event) if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_EVENT)) { ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_EVENT); - if (ioctl(ftdmchan->sockfd, codes.GETEVENT, &zt_event_id) == -1) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed retrieving event from channel: %s\n", - strerror(errno)); + } + + if (ioctl(ftdmchan->sockfd, codes.GETEVENT, &zt_event_id) == -1) { + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed retrieving event from channel: %s\n", + strerror(errno)); + return FTDM_FAIL; + } + + switch(zt_event_id) { + case ZT_EVENT_RINGEROFF: + { return FTDM_FAIL; } - - switch(zt_event_id) { - case ZT_EVENT_RINGEROFF: - { - return FTDM_FAIL; - } - break; - case ZT_EVENT_RINGERON: - { - return FTDM_FAIL; + break; + case ZT_EVENT_RINGERON: + { + return FTDM_FAIL; + } + break; + case ZT_EVENT_RINGBEGIN: + { + event_id = FTDM_OOB_RING_START; + } + break; + case ZT_EVENT_ONHOOK: + { + event_id = FTDM_OOB_ONHOOK; + } + break; + case ZT_EVENT_WINKFLASH: + { + if (ftdmchan->state == FTDM_CHANNEL_STATE_DOWN || ftdmchan->state == FTDM_CHANNEL_STATE_DIALING) { + event_id = FTDM_OOB_WINK; + } else { + event_id = FTDM_OOB_FLASH; } - break; - case ZT_EVENT_RINGBEGIN: - { + } + break; + case ZT_EVENT_RINGOFFHOOK: + { + if (ftdmchan->type == FTDM_CHAN_TYPE_FXS || (ftdmchan->type == FTDM_CHAN_TYPE_EM && ftdmchan->state != FTDM_CHANNEL_STATE_UP)) { + ftdm_set_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK); + event_id = FTDM_OOB_OFFHOOK; + } else if (ftdmchan->type == FTDM_CHAN_TYPE_FXO) { event_id = FTDM_OOB_RING_START; + } else { + event_id = FTDM_OOB_NOOP; } - break; - case ZT_EVENT_ONHOOK: - { - event_id = FTDM_OOB_ONHOOK; - } - break; - case ZT_EVENT_WINKFLASH: - { - if (ftdmchan->state == FTDM_CHANNEL_STATE_DOWN || ftdmchan->state == FTDM_CHANNEL_STATE_DIALING) { - event_id = FTDM_OOB_WINK; - } else { - event_id = FTDM_OOB_FLASH; - } - } - break; - case ZT_EVENT_RINGOFFHOOK: - { - if (ftdmchan->type == FTDM_CHAN_TYPE_FXS || (ftdmchan->type == FTDM_CHAN_TYPE_EM && ftdmchan->state != FTDM_CHANNEL_STATE_UP)) { - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK); - event_id = FTDM_OOB_OFFHOOK; - } else if (ftdmchan->type == FTDM_CHAN_TYPE_FXO) { - event_id = FTDM_OOB_RING_START; - } else { - event_id = FTDM_OOB_NOOP; - } - } - break; - case ZT_EVENT_ALARM: - { - event_id = FTDM_OOB_ALARM_TRAP; - } - break; - case ZT_EVENT_NOALARM: - { - event_id = FTDM_OOB_ALARM_CLEAR; - } - break; - case ZT_EVENT_BITSCHANGED: - { - event_id = FTDM_OOB_CAS_BITS_CHANGE; - int bits = 0; - int err = ioctl(ftdmchan->sockfd, codes.GETRXBITS, &bits); - if (err) { - return FTDM_FAIL; - } - ftdmchan->rx_cas_bits = bits; - } - break; - default: - { - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Unhandled event %d for %d:%d\n", zt_event_id, span->span_id, i); - event_id = FTDM_OOB_INVALID; + } + break; + case ZT_EVENT_ALARM: + { + event_id = FTDM_OOB_ALARM_TRAP; + } + break; + case ZT_EVENT_NOALARM: + { + event_id = FTDM_OOB_ALARM_CLEAR; + } + break; + case ZT_EVENT_BITSCHANGED: + { + event_id = FTDM_OOB_CAS_BITS_CHANGE; + int bits = 0; + int err = ioctl(ftdmchan->sockfd, codes.GETRXBITS, &bits); + if (err) { + return FTDM_FAIL; } - break; + ftdmchan->rx_cas_bits = bits; } - - ftdmchan->last_event_time = 0; - span->event_header.e_type = FTDM_EVENT_OOB; - span->event_header.enum_id = event_id; - span->event_header.channel = ftdmchan; - *event = &span->event_header; - return FTDM_SUCCESS; + break; + default: + { + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Unhandled event %d for %d:%d\n", zt_event_id, span->span_id, i); + event_id = FTDM_OOB_INVALID; + } + break; } - return FTDM_FAIL; + ftdmchan->last_event_time = 0; + span->event_header.e_type = FTDM_EVENT_OOB; + span->event_header.enum_id = event_id; + span->event_header.channel = ftdmchan; + *event = &span->event_header; + return FTDM_SUCCESS; } /** commit 54359f1b7846819e1fb12fb580ce8c5ee69d74ba Author: Moises Silva <moy@sangoma.com> Date: Tue Dec 21 19:04:41 2010 -0500 freetdm: fix call id generation diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 955729d..b812414 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -63,7 +63,7 @@ ftdm_time_t time_last_throttle_log = 0; ftdm_time_t time_current_throttle_log = 0; static ftdm_iterator_t *get_iterator(ftdm_iterator_type_t type, ftdm_iterator_t *iter); -static ftdm_status_t ftdm_call_set_call_id(ftdm_caller_data_t *caller_data); +static ftdm_status_t ftdm_call_set_call_id(ftdm_channel_t *fchan, ftdm_caller_data_t *caller_data); static ftdm_status_t ftdm_call_clear_call_id(ftdm_caller_data_t *caller_data); static ftdm_status_t ftdm_channel_clear_vars(ftdm_channel_t *ftdmchan); static ftdm_status_t ftdm_channel_done(ftdm_channel_t *ftdmchan); @@ -2522,7 +2522,7 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_place(const char *file, const char if (status == FTDM_SUCCESS) { ftdm_set_flag(ftdmchan, FTDM_CHANNEL_CALL_STARTED); - ftdm_call_set_call_id(&ftdmchan->caller_data); + ftdm_call_set_call_id(ftdmchan, &ftdmchan->caller_data); ftdm_wait_for_flag_cleared(ftdmchan, FTDM_CHANNEL_STATE_CHANGE, 100); } @@ -2606,10 +2606,11 @@ FT_DECLARE(ftdm_status_t) ftdm_span_get_sig_status(ftdm_span_t *span, ftdm_signa } } +/* this function must be called with the channel lock */ static ftdm_status_t ftdm_channel_done(ftdm_channel_t *ftdmchan) { ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "Null channel can't be done!\n"); - ftdm_mutex_lock(ftdmchan->mutex); + ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_OPEN); ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_DTMF_DETECT); ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_SUPRESS_DTMF); @@ -2694,7 +2695,6 @@ static ftdm_status_t ftdm_channel_done(ftdm_channel_t *ftdmchan) ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_TRANSCODE); } ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "channel done\n"); - ftdm_mutex_unlock(ftdmchan->mutex); return FTDM_SUCCESS; } @@ -4397,6 +4397,16 @@ static void print_channels_by_state(ftdm_stream_handle_t *stream, ftdm_channel_s ftdm_mutex_unlock(globals.mutex); } +static void print_core_usage(ftdm_stream_handle_t *stream) +{ + stream->write_function(stream, + "--------------------------------------------------------------------------------\n" + "ftdm core state [!]<state_name> - List all channels in or not in the given state\n" + "ftdm core flag <flag-int-value> - List all channels with the fiven flag value set\n" + "ftdm core calls - List all known calls to the FreeTDM core\n" + "--------------------------------------------------------------------------------\n"); +} + static char *handle_core_command(const char *cmd) { char *mycmd = NULL; @@ -4407,22 +4417,31 @@ static char *handle_core_command(const char *cmd) char *state = NULL; char *flag = NULL; uint32_t flagval = 0; + uint32_t current_call_id = 0; + ftdm_caller_data_t *calldata = NULL; + ftdm_channel_t *fchan = NULL; ftdm_channel_state_t i = FTDM_CHANNEL_STATE_INVALID; ftdm_stream_handle_t stream = { 0 }; FTDM_STANDARD_STREAM(stream); - if (cmd) { + if (cmd && strlen(cmd)) { mycmd = ftdm_strdup(cmd); argc = ftdm_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); } else { - stream.write_function(&stream, "invalid core command\n"); + print_core_usage(&stream); + goto done; + } + + if (!argc) { + print_core_usage(&stream); goto done; } if (!strcasecmp(argv[0], "state")) { if (argc < 2) { stream.write_function(&stream, "core state command requires an argument\n"); + print_core_usage(&stream); goto done; } state = argv[1]; @@ -4443,7 +4462,8 @@ static char *handle_core_command(const char *cmd) stream.write_function(&stream, "\nTotal channels %s %s: %d\n", not ? "not in state" : "in state", ftdm_channel_state2str(i), count); } else if (!strcasecmp(argv[0], "flag")) { if (argc < 2) { - stream.write_function(&stream, "core state command requires an argument\n"); + stream.write_function(&stream, "core flag command requires an argument\n"); + print_core_usage(&stream); goto done; } flag = argv[1]; @@ -4454,8 +4474,28 @@ static char *handle_core_command(const char *cmd) flagval = atoi(flag); print_channels_by_flag(&stream, flagval, not, &count); stream.write_function(&stream, "\nTotal channels %s %d: %d\n", not ? "without flag" : "with flag", flagval, count); + } else if (!strcasecmp(argv[0], "calls")) { + ftdm_mutex_lock(globals.call_id_mutex); + current_call_id = globals.last_call_id; + for (current_call_id = 0; current_call_id <= MAX_CALLIDS; current_call_id++) { + if (!globals.call_ids[current_call_id]) { + continue; + } + calldata = globals.call_ids[current_call_id]; + fchan = calldata->fchan; + if (fchan) { + stream.write_function(&stream, "Call %d on channel %d:%d\n", current_call_id, + fchan->span_id, fchan->chan_id); + } else { + stream.write_function(&stream, "Call %d without a channel?\n", current_call_id); + } + count++; + } + ftdm_mutex_unlock(globals.call_id_mutex); + stream.write_function(&stream, "\nTotal calls: %d\n", count); } else { stream.write_function(&stream, "invalid core command %s\n", argv[0]); + print_core_usage(&stream); } done: @@ -4475,6 +4515,8 @@ FT_DECLARE(char *) ftdm_api_execute(const char *cmd) if ((p = strchr(dup, ' '))) { *p++ = '\0'; cmd = p; + } else { + cmd = ""; } type = dup; @@ -5447,7 +5489,7 @@ FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t case FTDM_SIGEVENT_START: { ftdm_set_flag(sigmsg->channel, FTDM_CHANNEL_CALL_STARTED); - ftdm_call_set_call_id(&sigmsg->channel->caller_data); + ftdm_call_set_call_id(sigmsg->channel, &sigmsg->channel->caller_data); ftdm_set_echocancel_call_begin(sigmsg->channel); if (sigmsg->channel->dtmfdbg.requested) { ftdm_channel_command(sigmsg->channel, FTDM_COMMAND_ENABLE_DEBUG_DTMF, NULL); @@ -6089,27 +6131,35 @@ FT_DECLARE(char *) ftdm_channel_get_history_str(const ftdm_channel_t *fchan) return stream.data; } -static ftdm_status_t ftdm_call_set_call_id(ftdm_caller_data_t *caller_data) +static ftdm_status_t ftdm_call_set_call_id(ftdm_channel_t *fchan, ftdm_caller_data_t *caller_data) { uint32_t current_call_id; - ftdm_assert_return(!caller_data->call_id, FTDM_FAIL, "Overwriting non-cleared call-id"); + + ftdm_assert_return(!caller_data->call_id, FTDM_FAIL, "Overwriting non-cleared call-id\n"); ftdm_mutex_lock(globals.call_id_mutex); + current_call_id = globals.last_call_id; - do { - if (++current_call_id > MAX_CALLIDS) { + for (current_call_id = globals.last_call_id + 1; + current_call_id != globals.last_call_id; + current_call_id++ ) { + if (current_call_id > MAX_CALLIDS) { current_call_id = 1; } - if (globals.call_ids[current_call_id] != NULL) { - continue; + if (globals.call_ids[current_call_id] == NULL) { + break; } - } while (0); + } + + ftdm_assert_return(globals.call_ids[current_call_id] == NULL, FTDM_FAIL, "We ran out of call ids\n"); globals.last_call_id = current_call_id; caller_data->call_id = current_call_id; globals.call_ids[current_call_id] = caller_data; + caller_data->fchan = fchan; + ftdm_mutex_unlock(globals.call_id_mutex); return FTDM_SUCCESS; } @@ -6126,8 +6176,8 @@ static ftdm_status_t ftdm_call_clear_call_id(ftdm_caller_data_t *caller_data) ftdm_mutex_lock(globals.call_id_mutex); if (globals.call_ids[caller_data->call_id]) { ftdm_log(FTDM_LOG_DEBUG, "Cleared call with id %u\n", caller_data->call_id); - caller_data->call_id = 0; globals.call_ids[caller_data->call_id] = NULL; + caller_data->call_id = 0; } else { ftdm_log(FTDM_LOG_CRIT, "call-id did not exist %u\n", caller_data->call_id); } diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index dfb3f1f..d27353d 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -320,6 +320,7 @@ typedef struct ftdm_caller_data { * that the user can use caller_data.call_id to obtain the call_id. The user * should use the call_id from sigmsg otherwise */ uint32_t call_id; /*!< Unique call ID for this call */ + ftdm_channel_t *fchan; /*!< FreeTDM channel associated (can be NULL) */ } ftdm_caller_data_t; /*! \brief Tone type */ commit a1e425029c3a123d1b77d8e81acea873af81961e Author: Brian West <brian@freeswitch.org> Date: Tue Dec 21 16:59:25 2010 -0600 FS-2944 diff --git a/conf/directory/default/default.xml b/conf/directory/default/default.xml index 5db6011..aa138f1 100644 --- a/conf/directory/default/default.xml +++ b/conf/directory/default/default.xml @@ -1,7 +1,7 @@ <include> <user id="default"> <!--if id is numeric mailbox param is not necessary--> <!-- - ATTENTION PLEASE READ THIS... (I know you won't but you've been warrned) + ATTENTION PLEASE READ THIS... (I know you won't but you've been warned) Let it be known that this user can register without a password but since we do not assign this user a user_context and we don't authenticate this user they will be put in context 'public'. commit e80a40cf6835052ccf9750b6c89cd2fa4b776584 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Dec 21 15:35:30 2010 -0600 rtp adjustments when using jitterbuffer diff --git a/libs/stfu/stfu.c b/libs/stfu/stfu.c index b7df8ea..d2c443a 100644 --- a/libs/stfu/stfu.c +++ b/libs/stfu/stfu.c @@ -100,7 +100,9 @@ struct stfu_instance { uint32_t sync_out; uint32_t sync_in; - + int32_t ts_offset; + int32_t ts_drift; + int32_t ts_diff; int32_t last_ts_diff; int32_t same_ts; @@ -126,6 +128,11 @@ static void default_logger(const char *file, const char *func, int line, int lev stfu_logger_t stfu_log = null_logger; +int32_t stfu_n_get_drift(stfu_instance_t *i) +{ + return i->ts_drift; +} + void stfu_global_set_logger(stfu_logger_t logger) { if (logger) { @@ -376,7 +383,7 @@ static void stfu_n_swap(stfu_instance_t *i) i->out_queue->last_jitter = 0; } -stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void *data, size_t datalen, int last) +stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void *data, size_t datalen, uint32_t timer_ts, int last) { uint32_t index = 0; stfu_frame_t *frame; @@ -402,6 +409,12 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void } } + if (timer_ts && ts && !i->ts_offset) { + i->ts_offset = timer_ts - ts; + } + + i->ts_drift = ts + (i->ts_offset - timer_ts); + if (i->sync_in) { good_ts = 1; i->sync_in = 0; @@ -480,12 +493,12 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void if (stfu_log != null_logger && i->debug) { - stfu_log(STFU_LOG_EMERG, "%s %u i=%u/%u - g:%u/%u c:%u/%u b:%u - %u:%u - %u %d %u %u %d %d\n", i->name, - i->qlen, i->period_packet_in_count, i->period_time, i->consecutive_good_count, - i->decrement_time, i->period_clean_count, i->decrement_time, i->consecutive_bad_count, - ts, ts / i->samples_per_packet, - i->period_missing_count, i->period_need_range_avg, - i->last_wr_ts, ts, i->diff, i->diff_total / least1(i->period_packet_in_count)); + stfu_log(STFU_LOG_EMERG, "I: %s %u i=%u/%u - g:%u/%u c:%u/%u b:%u - %u:%u - %u %d %u %u %d %d %d\n", i->name, + i->qlen, i->period_packet_in_count, i->period_time, i->consecutive_good_count, + i->decrement_time, i->period_clean_count, i->decrement_time, i->consecutive_bad_count, + ts, ts / i->samples_per_packet, + i->period_missing_count, i->period_need_range_avg, + i->last_wr_ts, ts, i->diff, i->diff_total / least1(i->period_packet_in_count), i->ts_drift); } if (last || i->in_queue->array_len == i->in_queue->array_size) { diff --git a/libs/stfu/stfu.h b/libs/stfu/stfu.h index ad769c6..b92bb3f 100644 --- a/libs/stfu/stfu.h +++ b/libs/stfu/stfu.h @@ -181,15 +181,16 @@ void stfu_n_report(stfu_instance_t *i, stfu_report_t *r); void stfu_n_destroy(stfu_instance_t **i); stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_qlen, uint32_t samples_per_packet, uint32_t samples_per_second); stfu_status_t stfu_n_resize(stfu_instance_t *i, uint32_t qlen); -stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void *data, size_t datalen, int last); +stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void *data, size_t datalen, uint32_t timer_ts, int last); stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i); void stfu_n_reset(stfu_instance_t *i); stfu_status_t stfu_n_sync(stfu_instance_t *i, uint32_t packets); void stfu_n_call_me(stfu_instance_t *i, stfu_n_call_me_t callback, void *udata); void stfu_n_debug(stfu_instance_t *i, const char *name); +int32_t stfu_n_get_drift(stfu_instance_t *i); -#define stfu_im_done(i) stfu_n_add_data(i, 0, NULL, 0, 1) -#define stfu_n_eat(i,t,p,d,l) stfu_n_add_data(i, t, p, d, l, 0) +#define stfu_im_done(i) stfu_n_add_data(i, 0, NULL, 0, 0, 1) +#define stfu_n_eat(i,t,p,d,l,tt) stfu_n_add_data(i, t, p, d, l, tt, 0) #ifdef __cplusplus } commit a3b01c195be3c1454c60e634477d8c825c60ac77 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Dec 21 15:35:13 2010 -0600 rtp adjustments when using jitterbuffer diff --git a/src/switch_ivr.c b/src/switch_ivr.c index cd74c33..68d5a55 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -2285,7 +2285,7 @@ SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint3 break; } - stfu_n_eat(jb, ts, read_frame->payload, read_frame->data, read_frame->datalen); + stfu_n_eat(jb, ts, read_frame->payload, read_frame->data, read_frame->datalen, 0); ts += interval; if ((jb_frame = stfu_n_read_a_frame(jb))) { diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 4e667fb..aa4ca7a 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -2135,19 +2135,6 @@ static void do_flush(switch_rtp_t *rtp_session) flushed++; -#ifdef _MSC_VER -#pragma warning(push) /* remove this stuff when "if (0" is removed */ -#pragma warning(disable:4127) -#endif - if (0 && rtp_session->jb) { - stfu_n_eat(rtp_session->jb, ntohl(rtp_session->recv_msg.header.ts), - rtp_session->recv_msg.header.pt, - rtp_session->recv_msg.body, bytes - rtp_header_len); - } -#ifdef _MSC_VER -#pragma warning(pop) -#endif - rtp_session->stats.inbound.raw_bytes += bytes; rtp_session->stats.inbound.flush_packet_count++; rtp_session->stats.inbound.packet_count++; @@ -2196,12 +2183,13 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t rtp_session->stats.inbound.packet_count++; } - if ((rtp_session->recv_te && rtp_session->recv_msg.header.pt == rtp_session->recv_te) || - *bytes < rtp_header_len || - switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA) || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_UDPTL)) { - return SWITCH_STATUS_SUCCESS; + if (*bytes != 0 && !rtp_session->jb) { + if ((rtp_session->recv_te && rtp_session->recv_msg.header.pt == rtp_session->recv_te) || + *bytes < rtp_header_len || + switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA) || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_UDPTL)) { + return SWITCH_STATUS_SUCCESS; + } } - if (rtp_session->jb && rtp_session->recv_msg.header.version == 2 && *bytes) { if (rtp_session->recv_msg.header.m && rtp_session->recv_msg.header.pt != rtp_session->recv_te && @@ -2211,14 +2199,15 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t stfu_n_eat(rtp_session->jb, ntohl(rtp_session->recv_msg.header.ts), rtp_session->recv_msg.header.pt, - rtp_session->recv_msg.body, *bytes - rtp_header_len); + rtp_session->recv_msg.body, *bytes - rtp_header_len, rtp_session->timer.samplecount); *bytes = 0; status = SWITCH_STATUS_FALSE; } - if (rtp_session->jb) { + if (rtp_session->jb && !rtp_session->checked_jb) { if ((jb_frame = stfu_n_read_a_frame(rtp_session->jb))) { memcpy(rtp_session->recv_msg.body, jb_frame->data, jb_frame->dlen); + if (jb_frame->plc) { (*flags) |= SFF_PLC; } else { @@ -2229,6 +2218,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t rtp_session->recv_msg.header.pt = jb_frame->pt; status = SWITCH_STATUS_SUCCESS; } + rtp_session->checked_jb++; } @@ -2385,7 +2375,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ rtp_session->read_pollfd) { if (switch_poll(rtp_session->read_pollfd, 1, &fdr, 0) == SWITCH_STATUS_SUCCESS) { rtp_session->hot_hits += rtp_session->samples_per_interval; - + if (rtp_session->hot_hits >= rtp_session->samples_per_second * 5) { switch_set_flag(rtp_session, SWITCH_RTP_FLAG_FLUSH); hot_socket = 1; @@ -2927,12 +2917,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ if (do_cng) { uint8_t *data = (uint8_t *) rtp_session->recv_msg.body; - int fdr; - - if ((poll_status = switch_poll(rtp_session->read_pollfd, 1, &fdr, 0)) == SWITCH_STATUS_SUCCESS) { - goto recvfrom; - } - + memset(data, 0, 2); data[0] = 65; rtp_session->recv_msg.header.pt = (uint32_t) rtp_session->cng_pt ? rtp_session->cng_pt : SWITCH_RTP_CNG_PAYLOAD; commit 665b12b1f534ab477b173eecfb05904f43e9cea7 Merge: ebb6133 fcd7515 Author: Moises Silva <moy@sangoma.com> Date: Tue Dec 21 15:23:23 2010 -0500 Merge remote branch 'fsorig/master' commit ebb613352939291463cb84ea931e6e260de601da Merge: cdfa8bf f5c36ac Author: Moises Silva <moy@sangoma.com> Date: Tue Dec 21 15:16:09 2010 -0500 Merge branch 'master' of git.sangoma.com:smg_freeswitch commit cdfa8bf7aec16823ec402254a185920e47582f5c Author: Moises Silva <moy@sangoma.com> Date: Tue Dec 21 15:11:22 2010 -0500 freetdm: Added new OOB event FTDM_OOB_POLARITY_REVERSE Added new channel command FTDM_COMMAND_SET_POLARITY ftmod_wanpipe - Added support to enqueue polarity events on FXO lines ftmod_wanpipe - Added support to set polarity on FXS lines ftmod_analog - Added support to answer and hangup FXO lines on polarity reverse ftmod_analog - Added support to reverse polarity in the FXS line on answer and hangup mod_freetdm - Added parameters answer-on-polarity, hangup-on-polarity and polarity-delay to enable those analog features diff --git a/libs/freetdm/conf/freetdm.conf.xml b/libs/freetdm/conf/freetdm.conf.xml index 63a3ea6..43197af 100644 --- a/libs/freetdm/conf/freetdm.conf.xml +++ b/libs/freetdm/conf/freetdm.conf.xml @@ -12,31 +12,81 @@ with the signaling protocols that you can run on top of your I/O interfaces. <settings> <param name="debug" value="0"/> <!--<param name="hold-music" value="$${moh_uri}"/>--> + <!-- Analog global options (they apply to all spans) + Remember you can only choose between either call-swap + or 3-way, not both! + --> <!--<param name="enable-analog-option" value="call-swap"/>--> <!--<param name="enable-analog-option" value="3-way"/>--> </settings> - <!-- Sample analog configuration --> + <!-- Sample analog configuration (The analog_spans tag is for ftmod_analog) --> <analog_spans> <!-- The span name must match the name in your freetdm.conf --> <span name="myAnalog"> <!--<param name="hold-music" value="$${moh_uri}"/>--> - <!--<param name="enable-analog-option" value="call-swap"/>--> - <!--<param name="enable-analog-option" value="3-way"/>--> + <!-- + 3-way allows you to flash your FXS line and dial + another number and put all the parties in a conference + + call-swap allows you to flash your FXS line and swap + between one call and another + + Remember you can only choose between either call-swap + or 3-way, not both! + + <param name="enable-analog-option" value="call-swap"/> + <param name="enable-analog-option" value="3-way"/> + --> + + <!-- Tones are defined in tones.conf + This setting is very important for analog lines to + work properly + --> <param name="tonegroup" value="us"/> + + <!-- How much time to wait for digits (in FXS lines) --> <param name="digit-timeout" value="2000"/> + + <!-- Maximum number of digits to wait for (in FXS lines) --> <param name="max-digits" value="11"/> - <param name="dialplan" value="XML"/> - <param name="context" value="default"/> + + <!-- whether you want to wait for caller id --> <param name="enable-callerid" value="true"/> + + <!-- whether you want to enable callwaiting feature --> + <!--<param name="callwaiting" value="true"/>--> + + <!-- whether you want to answer/hangup on polarity reverse for outgoing calls in FXO devices + and send polarity reverse on answer/hangup for incoming calls in FXS devices --> + <!--<param name="answer-polarity-reverse" value="false"/>--> + <!--<param name="hangup-polarity-reverse" value="false"/>--> + <!-- + Minimum delay (in milliseconds) required between an answer polarity reverse + and hangup polarity reverse in order to assume the second polarity reverse is a real hangup + <param name="polarity-delay" value="600"/> + --> + <!-- regex to stop dialing when it matches --> <!--<param name="dial-regex" value="5555"/>--> + <!-- regex to stop dialing when it does not match --> <!--<param name="fail-dial-regex" value="^5"/>--> + + <!-- FreeSWITCH dialplan type and context to send the calls --> + <param name="dialplan" value="XML"/> + <param name="context" value="default"/> </span> </analog_spans> - <!-- openr2 (MFC-R2 signaling) spans + <!-- + + openr2 (MFC-R2 signaling) spans (ftmod_r2) + + In order to use this type of spans your FreeTDM must have been compiled with ftmod_r2 module. + The module is compiled if the openr2 library is present when running the ./configure script + in the FreeTDM source code + MFC-R2 signaling has lots of variants from country to country and even sometimes minor variants inside the same country. The only mandatory parameters here are: variant, but typically you also want to set max_ani and max_dnis. @@ -46,6 +96,7 @@ with the signaling protocols that you can run on top of your I/O interfaces. best defaults for your country. If you want to contribute your configs for a particular country send them to the e-mail of the primary OpenR2 developer that you can find in the AUTHORS file of the OpenR2 package, they will be added to the samples directory of openr2. + --> <r2_spans> <span name="wp1" cfgprofile="testr2"> diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 7e09985..0709021 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -2717,6 +2717,9 @@ static switch_status_t load_config(void) char *hold_music = NULL; char *fail_dial_regex = NULL; const char *enable_callerid = "true"; + const char *answer_polarity = "false"; + const char *hangup_polarity = "false"; + int polarity_delay = 600; int callwaiting = 1; uint32_t span_id = 0, to = 0, max = 0; @@ -2788,6 +2791,12 @@ static switch_status_t load_config(void) dial_regex = val; } else if (!strcasecmp(var, "enable-callerid")) { enable_callerid = val; + } else if (!strcasecmp(var, "answer-polarity-reverse")) { + answer_polarity = val; + } else if (!strcasecmp(var, "hangup-polarity-reverse")) { + hangup_polarity = val; + } else if (!strcasecmp(var, "polarity-delay")) { + polarity_delay = atoi(val); } else if (!strcasecmp(var, "fail-dial-regex")) { fail_dial_regex = val; } else if (!strcasecmp(var, "hold-music")) { @@ -2848,6 +2857,9 @@ static switch_status_t load_config(void) "max_dialstr", &max, "hotline", hotline ? hotline : "", "enable_callerid", enable_callerid, + "answer_polarity_reverse", answer_polarity, + "hangup_polarity_reverse", hangup_polarity, + "polarity_delay", &polarity_delay, "callwaiting", &callwaiting, FTDM_TAG_END) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_ERROR, "Error configuring FreeTDM analog span %s\n", ftdm_span_get_name(span)); diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index c04dd85..955729d 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -1541,6 +1541,7 @@ end: ftdm_mutex_unlock(ftdmchan->span->mutex); } else { ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_WARNING, "VETO state change from %s to %s\n", ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state)); + goto done; } /* there is an inherent race here between set and check of the change flag but we do not care because @@ -1570,7 +1571,7 @@ end: ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_WARNING, "state change from %s to %s was most likely not processed after aprox %dms\n", ftdm_channel_state2str(ftdmchan->last_state), ftdm_channel_state2str(state), DEFAULT_WAIT_TIME); } - +done: return ok ? FTDM_SUCCESS : FTDM_FAIL; } @@ -2289,8 +2290,15 @@ static ftdm_status_t call_hangup(ftdm_channel_t *chan, const char *file, const c ftdm_channel_set_state(file, func, line, chan, FTDM_CHANNEL_STATE_HANGUP, 1); } else { /* the signaling stack did not touch the state, - * core is responsible from clearing flags and stuff */ - ftdm_channel_close(&chan); + * core is responsible from clearing flags and stuff, however, because ftmod_analog + * is a bitch in a serious need of refactoring, we also check whether the channel is open + * to avoid an spurious warning about the channel not being open. This is because ftmod_analog + * does not follow our convention of sending SIGEVENT_STOP and waiting for the user to move + * to HANGUP (implicitly through ftdm_channel_call_hangup(), as soon as ftmod_analog is fixed + * this check can be removed */ + if (ftdm_test_flag(chan, FTDM_CHANNEL_OPEN)) { + ftdm_channel_close(&chan); + } } return FTDM_SUCCESS; } @@ -3933,7 +3941,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_write(ftdm_channel_t *ftdmchan, void *dat if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "cannot write in channel not open\n"); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "cannot write in channel not open\n"); snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "channel not open"); status = FTDM_FAIL; goto done; diff --git a/libs/freetdm/src/ftmod/ftmod_analog/ftdm_analog.h b/libs/freetdm/src/ftmod/ftmod_analog/ftdm_analog.h index 2c79822..39cbc5f 100644 --- a/libs/freetdm/src/ftmod/ftmod_analog/ftdm_analog.h +++ b/libs/freetdm/src/ftmod/ftmod_analog/ftdm_analog.h @@ -37,7 +37,9 @@ typedef enum { FTDM_ANALOG_RUNNING = (1 << 0), - FTDM_ANALOG_CALLERID = (1 << 1) + FTDM_ANALOG_CALLERID = (1 << 1), + FTDM_ANALOG_ANSWER_POLARITY_REVERSE = (1 << 2), + FTDM_ANALOG_HANGUP_POLARITY_REVERSE = (1 << 3) } ftdm_analog_flag_t; #define FTDM_MAX_HOTLINE_STR 20 @@ -47,11 +49,13 @@ struct ftdm_analog_data { uint32_t flags; uint32_t max_dialstr; uint32_t wait_dialtone_timeout; + uint32_t polarity_delay; uint32_t digit_timeout; char hotline[FTDM_MAX_HOTLINE_STR]; }; - +/* Analog flags to be set in the sflags (signaling flags) channel memeber */ +#define AF_POLARITY_REVERSE (1 << 0) static void *ftdm_analog_run(ftdm_thread_t *me, void *obj); typedef struct ftdm_analog_data ftdm_analog_data_t; diff --git a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c index 0acf70b..981df5d 100644 --- a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c +++ b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c @@ -184,6 +184,7 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_analog_configure_span) uint32_t digit_timeout = 10; uint32_t wait_dialtone_timeout = 30000; uint32_t max_dialstr = MAX_DTMF; + uint32_t polarity_delay = 600; const char *var, *val; int *intval; uint32_t flags = FTDM_ANALOG_CALLERID; @@ -236,6 +237,29 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_analog_configure_span) } else { flags &= ~FTDM_ANALOG_CALLERID; } + } else if (!strcasecmp(var, "answer_polarity_reverse")) { + if (!(val = va_arg(ap, char *))) { + break; + } + if (ftdm_true(val)) { + flags |= FTDM_ANALOG_ANSWER_POLARITY_REVERSE; + } else { + flags &= ~FTDM_ANALOG_ANSWER_POLARITY_REVERSE; + } + } else if (!strcasecmp(var, "hangup_polarity_reverse")) { + if (!(val = va_arg(ap, char *))) { + break; + } + if (ftdm_true(val)) { + flags |= FTDM_ANALOG_HANGUP_POLARITY_REVERSE; + } else { + flags &= ~FTDM_ANALOG_HANGUP_POLARITY_REVERSE; + } + } else if (!strcasecmp(var, "polarity_delay")) { + if (!(intval = va_arg(ap, int *))) { + break; + } + polarity_delay = *intval; } else if (!strcasecmp(var, "callwaiting")) { if (!(intval = va_arg(ap, int *))) { break; @@ -276,6 +300,7 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_analog_configure_span) analog_data->flags = flags; analog_data->digit_timeout = digit_timeout; analog_data->wait_dialtone_timeout = wait_dialtone_timeout; + analog_data->polarity_delay = polarity_delay; analog_data->max_dialstr = max_dialstr; span->signal_cb = sig_cb; strncpy(analog_data->hotline, hotline, sizeof(analog_data->hotline)); @@ -399,6 +424,7 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) ftdm_analog_data_t *analog_data = ftdmchan->span->signal_data; ftdm_channel_t *closed_chan; uint32_t state_counter = 0, elapsed = 0, collecting = 0, interval = 0, last_digit = 0, indicate = 0, dial_timeout = analog_data->wait_dialtone_timeout; + uint32_t answer_on_polarity_counter = 0; ftdm_sigmsg_t sig; ftdm_status_t status; @@ -470,7 +496,12 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) if (ftdmchan->needed_tones[FTDM_TONEMAP_DIAL]) { ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY); } else { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); + /* do not go up if we're waiting for polarity reversal */ + if (ftdm_test_flag(analog_data, FTDM_ANALOG_ANSWER_POLARITY_REVERSE)) { + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); + } else { + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); + } } } } @@ -561,8 +592,30 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) } case FTDM_CHANNEL_STATE_UP: case FTDM_CHANNEL_STATE_RING: + case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: { - ftdm_sleep(interval); + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) && + ftdmchan->state == FTDM_CHANNEL_STATE_PROGRESS_MEDIA && + ftdm_test_sflag(ftdmchan, AF_POLARITY_REVERSE)) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "Answering on polarity reverse\n"); + ftdm_clear_sflag(ftdmchan, AF_POLARITY_REVERSE); + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); + answer_on_polarity_counter = state_counter; + } else if (ftdmchan->state == FTDM_CHANNEL_STATE_UP + && ftdm_test_sflag(ftdmchan, AF_POLARITY_REVERSE)){ + /* if this polarity reverse is close to the answer polarity reverse, ignore it */ + if (answer_on_polarity_counter + && (state_counter - answer_on_polarity_counter) > analog_data->polarity_delay) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "Hanging up on polarity reverse\n"); + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); + } else { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, + "Not hanging up on polarity reverse, too close to Answer reverse\n"); + } + ftdm_clear_sflag(ftdmchan, AF_POLARITY_REVERSE); + } else { + ftdm_sleep(interval); + } continue; } break; @@ -615,6 +668,18 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) sig.event_id = FTDM_SIGEVENT_UP; } + if (ftdmchan->type == FTDM_CHAN_TYPE_FXS && + !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) && + ftdm_test_flag(analog_data, FTDM_ANALOG_ANSWER_POLARITY_REVERSE)) { + ftdm_polarity_t polarity = FTDM_POLARITY_REVERSE; + if (ftdmchan->polarity != FTDM_POLARITY_FORWARD) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Polarity is already reversed on answer??\n"); + } else { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Reversing polarity on answer\n"); + ftdm_channel_command(ftdmchan, FTDM_COMMAND_SET_POLARITY, &polarity); + } + } + ftdm_span_send_signal(ftdmchan->span, &sig); continue; } @@ -639,6 +704,22 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) continue; } break; + + case FTDM_CHANNEL_STATE_HANGUP: + /* this state is only used when the user hangup, if the device hang up (onhook) we currently + * go straight to DOWN. If we ever change this (as other signaling modules do) by using this + * state for both user and device hangup, we should check here for the type of hangup since + * some actions (polarity reverse) do not make sense if the device hung up */ + if (ftdmchan->type == FTDM_CHAN_TYPE_FXS && + ftdmchan->last_state == FTDM_CHANNEL_STATE_UP && + ftdm_test_flag(analog_data, FTDM_ANALOG_HANGUP_POLARITY_REVERSE)) { + ftdm_polarity_t polarity = ftdmchan->polarity == FTDM_POLARITY_REVERSE + ? FTDM_POLARITY_FORWARD : FTDM_POLARITY_REVERSE; + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Reversing polarity on hangup\n"); + ftdm_channel_command(ftdmchan, FTDM_COMMAND_SET_POLARITY, &polarity); + } + break; + case FTDM_CHANNEL_STATE_DOWN: { sig.event_id = FTDM_SIGEVENT_STOP; @@ -847,6 +928,9 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) done: + closed_chan = ftdmchan; + + ftdm_channel_lock(closed_chan); if (ftdmchan->type == FTDM_CHAN_TYPE_FXO && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK)) { ftdm_channel_command(ftdmchan, FTDM_COMMAND_ONHOOK, NULL); @@ -857,7 +941,8 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) } - closed_chan = ftdmchan; + ftdm_clear_sflag(ftdmchan, AF_POLARITY_REVERSE); + ftdm_channel_close(&ftdmchan); ftdm_channel_command(closed_chan, FTDM_COMMAND_SET_NATIVE_CODEC, NULL); @@ -875,8 +960,11 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) } ftdm_log_chan(closed_chan, FTDM_LOG_DEBUG, "ANALOG CHANNEL %d:%d thread ended.\n", closed_chan->span_id, closed_chan->chan_id); + ftdm_clear_flag(closed_chan, FTDM_CHANNEL_INTHREAD); + ftdm_channel_unlock(closed_chan); + return NULL; } @@ -903,6 +991,19 @@ static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *e ftdm_mutex_lock(event->channel->mutex); locked++; + /* MAINTENANCE WARNING: + * 1. Be aware you are working on the locked channel + * 2. We should not be calling ftdm_span_send_signal or ftdm_set_state when there is already a channel thread running + * however, since this is old code I am not changing it now, but new code should adhere to that convention + * otherwise, we have possible races where we compete with the user for state changes, ie, the user requests + * a state change and then we process an event, the state change from the user is pending so our ftdm_set_state + * operation will fail. In cases where we win the race, our state change will be accepted but if a user requests + * a state change before the state change we requested here is processed by the channel thread, we'll end up + * rejecting the user request. + * + * See docs/locking.txt for further information about what guarantees should signaling modules provide when + * locking/unlocking a channel + * */ switch(event->enum_id) { case FTDM_OOB_RING_START: { @@ -940,7 +1041,11 @@ static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *e } ftdm_set_state(event->channel, FTDM_CHANNEL_STATE_DOWN); } - + if (event->channel->type == FTDM_CHAN_TYPE_FXS) { + /* we always return to forward when the device goes onhook */ + ftdm_polarity_t forward_polarity = FTDM_POLARITY_FORWARD; + ftdm_channel_command(event->channel, FTDM_COMMAND_SET_POLARITY, &forward_polarity); + } } break; case FTDM_OOB_FLASH: @@ -1004,6 +1109,35 @@ static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *e ftdm_span_send_signal(span, &sig); } break; + case FTDM_OOB_POLARITY_REVERSE: + { + if (event->channel->type != FTDM_CHAN_TYPE_FXO) { + ftdm_log_chan_msg(event->channel, FTDM_LOG_WARNING, + "Ignoring polarity reversal, this should not happen in non-FXO channels!\n"); + break; + } + if (!ftdm_test_flag(event->channel, FTDM_CHANNEL_INTHREAD) && + ftdm_test_flag(event->channel, FTDM_CHANNEL_OFFHOOK)) { + ftdm_log_chan_msg(event->channel, FTDM_LOG_WARNING, + "Forcing onhook in channel not in thread after polarity reversal\n"); + ftdm_channel_command(event->channel, FTDM_COMMAND_ONHOOK, NULL); + break; + } + if (!ftdm_test_flag(analog_data, FTDM_ANALOG_ANSWER_POLARITY_REVERSE) + && !ftdm_test_flag(analog_data, FTDM_ANALOG_HANGUP_POLARITY_REVERSE)) { + ftdm_log_chan_msg(event->channel, FTDM_LOG_DEBUG, + "Ignoring polarity reversal because this channel is not configured for it\n"); + break; + } + if (event->channel->state == FTDM_CHANNEL_STATE_DOWN) { + ftdm_log_chan_msg(event->channel, FTDM_LOG_DEBUG, + "Ignoring polarity reversal because this channel is down\n"); + break; + } + /* we have a good channel, set the polarity flag and let the channel thread deal with it */ + ftdm_set_sflag(event->channel, AF_POLARITY_REVERSE); + } + break; default: { ftdm_log_chan(event->channel, FTDM_LOG_DEBUG, "Ignoring event [%s] in state [%s]\n", ftdm_oob_event2str(event->enum_id), ftdm_channel_state2str(event->channel->state)); diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index 2db4326..5e9318f 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -784,17 +784,27 @@ static FIO_COMMAND_FUNCTION(wanpipe_command) err = sangoma_set_tx_queue_sz(ftdmchan->sockfd, &tdm_api, queue_size); } break; + case FTDM_COMMAND_SET_POLARITY: + { + ftdm_polarity_t polarity = FTDM_COMMAND_OBJ_INT; + err = sangoma_tdm_set_polarity(ftdmchan->sockfd, &tdm_api, polarity); + if (!err) { + ftdmchan->polarity = polarity; + } + } + break; default: err = FTDM_NOTIMPL; break; }; if (err) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "%s", strerror(errno)); + int myerrno = errno; + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Wanpipe failed to execute command %d: %s\n", command, strerror(myerrno)); + errno = myerrno; return err; } - return FTDM_SUCCESS; } @@ -1237,8 +1247,9 @@ FIO_CHANNEL_NEXT_EVENT_FUNCTION(wanpipe_channel_next_event) wanpipe_tdm_api_t tdm_api; ftdm_span_t *span = ftdmchan->span; - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_EVENT)) + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_EVENT)) { ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_EVENT); + } memset(&tdm_api, 0, sizeof(tdm_api)); status = sangoma_tdm_read_event(ftdmchan->sockfd, &tdm_api); @@ -1251,7 +1262,7 @@ FIO_CHANNEL_NEXT_EVENT_FUNCTION(wanpipe_channel_next_event) ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "read wanpipe event %d\n", tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_type); switch(tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_type) { - case WP_TDMAPI_EVENT_LINK_STATUS: + case WP_API_EVENT_LINK_STATUS: { switch(tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_link_status) { case WP_TDMAPI_EVENT_LINK_STATUS_CONNECTED: @@ -1264,7 +1275,7 @@ FIO_CHANNEL_NEXT_EVENT_FUNCTION(wanpipe_channel_next_event) } break; - case WP_TDMAPI_EVENT_RXHOOK: + case WP_API_EVENT_RXHOOK: { if (ftdmchan->type == FTDM_CHAN_TYPE_FXS) { event_id = tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_hook_state & WP_TDMAPI_EVENT_RXHOOK_OFF ? FTDM_OOB_OFFHOOK : FTDM_OOB_ONHOOK; @@ -1300,26 +1311,26 @@ FIO_CHANNEL_NEXT_EVENT_FUNCTION(wanpipe_channel_next_event) } } break; - case WP_TDMAPI_EVENT_RING_DETECT: + case WP_API_EVENT_RING_DETECT: { event_id = tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_ring_state == WP_TDMAPI_EVENT_RING_PRESENT ? FTDM_OOB_RING_START : FTDM_OOB_RING_STOP; } break; /* disabled this ones when configuring, we don't need them, do we? - case WP_TDMAPI_EVENT_RING_TRIP_DETECT: + case WP_API_EVENT_RING_TRIP_DETECT: { event_id = tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_ring_state == WP_TDMAPI_EVENT_RING_PRESENT ? FTDM_OOB_ONHOOK : FTDM_OOB_OFFHOOK; } break; */ - case WP_TDMAPI_EVENT_RBS: + case WP_API_EVENT_RBS: { event_id = FTDM_OOB_CAS_BITS_CHANGE; ftdmchan->rx_cas_bits = wanpipe_swap_bits(tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_rbs_bits); } break; - case WP_TDMAPI_EVENT_DTMF: + case WP_API_EVENT_DTMF: { char tmp_dtmf[2] = { tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_dtmf_digit, 0 }; event_id = FTDM_OOB_NOOP; @@ -1342,12 +1353,18 @@ FIO_CHANNEL_NEXT_EVENT_FUNCTION(wanpipe_channel_next_event) } } break; - case WP_TDMAPI_EVENT_ALARM: + case WP_API_EVENT_ALARM: { ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Got wanpipe alarms %d\n", tdm_api.wp_tdm_cmd.event.wp_api_event_alarm); event_id = FTDM_OOB_ALARM_TRAP; } break; + case WP_API_EVENT_POLARITY_REVERSE: + { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Got polarity reverse\n"); + event_id = FTDM_OOB_POLARITY_REVERSE; + } + break; default: { ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Unhandled wanpipe event %d\n", tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_type); @@ -1423,7 +1440,7 @@ FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_span_next_event) ftdm_log_chan(span->channels[i], FTDM_LOG_DEBUG, "read wanpipe event %d\n", tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_type); switch(tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_type) { - case WP_TDMAPI_EVENT_LINK_STATUS: + case WP_API_EVENT_LINK_STATUS: { switch(tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_link_status) { case WP_TDMAPI_EVENT_LINK_STATUS_CONNECTED: @@ -1436,7 +1453,7 @@ FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_span_next_event) } break; - case WP_TDMAPI_EVENT_RXHOOK: + case WP_API_EVENT_RXHOOK: { if (span->channels[i]->type == FTDM_CHAN_TYPE_FXS) { event_id = tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_hook_state & WP_TDMAPI_EVENT_RXHOOK_OFF ? FTDM_OOB_OFFHOOK : FTDM_OOB_ONHOOK; @@ -1472,26 +1489,26 @@ FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_span_next_event) } } break; - case WP_TDMAPI_EVENT_RING_DETECT: + case WP_API_EVENT_RING_DETECT: { event_id = tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_ring_state == WP_TDMAPI_EVENT_RING_PRESENT ? FTDM_OOB_RING_START : FTDM_OOB_RING_STOP; } break; /* disabled this ones when configuring, we don't need them, do we? - case WP_TDMAPI_EVENT_RING_TRIP_DETECT: + case WP_API_EVENT_RING_TRIP_DETECT: { event_id = tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_ring_state == WP_TDMAPI_EVENT_RING_PRESENT ? FTDM_OOB_ONHOOK : FTDM_OOB_OFFHOOK; } break; */ - case WP_TDMAPI_EVENT_RBS: + case WP_API_EVENT_RBS: { event_id = FTDM_OOB_CAS_BITS_CHANGE; span->channels[i]->rx_cas_bits = wanpipe_swap_bits(tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_rbs_bits); } break; - case WP_TDMAPI_EVENT_DTMF: + case WP_API_EVENT_DTMF: { char tmp_dtmf[2] = { tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_dtmf_digit, 0 }; event_id = FTDM_OOB_NOOP; @@ -1514,12 +1531,18 @@ FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_span_next_event) } } break; - case WP_TDMAPI_EVENT_ALARM: + case WP_API_EVENT_ALARM: { ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Got wanpipe alarms %d\n", tdm_api.wp_tdm_cmd.event.wp_api_event_alarm); event_id = FTDM_OOB_ALARM_TRAP; } break; + case WP_API_EVENT_POLARITY_REVERSE: + { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Got polarity reverse\n"); + event_id = FTDM_OOB_POLARITY_REVERSE; + } + break; default: { ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Unhandled wanpipe event %d\n", tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_type); diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 79e8733..dfb3f1f 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -557,8 +557,14 @@ typedef enum { FTDM_COMMAND_COUNT, FTDM_COMMAND_SET_RX_QUEUE_SIZE, FTDM_COMMAND_SET_TX_QUEUE_SIZE, + FTDM_COMMAND_SET_POLARITY, } ftdm_command_t; +typedef enum { + FTDM_POLARITY_FORWARD = 0, + FTDM_POLARITY_REVERSE = 1 +} ftdm_polarity_t; + /*! \brief Custom memory handler hooks. Not recommended to use unless you need memory allocation customizations */ typedef void *(*ftdm_malloc_func_t)(void *pool, ftdm_size_t len); typedef void *(*ftdm_calloc_func_t)(void *pool, ftdm_size_t elements, ftdm_size_t len); diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index 606a89f..b90e987 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -143,7 +143,9 @@ extern "C" { \return true value if the object has the flags defined */ #define ftdm_test_flag(obj, flag) ((obj)->flags & flag) +/*!< Physical (IO) module specific flags */ #define ftdm_test_pflag(obj, flag) ((obj)->pflags & flag) +/*!< signaling module specific flags */ #define ftdm_test_sflag(obj, flag) ((obj)->sflags & flag) #define ftdm_set_alarm_flag(obj, flag) (obj)->alarm_flags |= (flag) @@ -456,6 +458,7 @@ struct ftdm_channel { ftdm_fsk_data_state_t fsk; uint8_t fsk_buf[80]; uint32_t ring_count; + ftdm_polarity_t polarity; /* Private I/O data. Do not touch unless you are an I/O module */ void *io_data; /* Private signaling data. Do not touch unless you are a signaling module */ diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index 6c521e3..db15b10 100644 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -123,6 +123,7 @@ typedef enum { FTDM_STR2ENUM_P(ftdm_str2ftdm_analog_start_type, ftdm_analog_start_type2str, ftdm_analog_start_type_t) typedef enum { + FTDM_OOB_NOOP, FTDM_OOB_ONHOOK, FTDM_OOB_OFFHOOK, FTDM_OOB_WINK, @@ -131,11 +132,11 @@ typedef enum { FTDM_OOB_RING_STOP, FTDM_OOB_ALARM_TRAP, FTDM_OOB_ALARM_CLEAR, - FTDM_OOB_NOOP, FTDM_OOB_CAS_BITS_CHANGE, + FTDM_OOB_POLARITY_REVERSE, FTDM_OOB_INVALID } ftdm_oob_event_t; -#define OOB_STRINGS "ONHOOK", "OFFHOOK", "WINK", "FLASH", "RING_START", "RING_STOP", "ALARM_TRAP", "ALARM_CLEAR", "NOOP", "CAS_BITS_CHANGE", "INVALID" +#define OOB_STRINGS "NOOP", "ONHOOK", "OFFHOOK", "WINK", "FLASH", "RING_START", "RING_STOP", "ALARM_TRAP", "ALARM_CLEAR", "CAS_BITS_CHANGE", "POLARITY_REVERSE", "INVALID" FTDM_STR2ENUM_P(ftdm_str2ftdm_oob_event, ftdm_oob_event2str, ftdm_oob_event_t) /*! \brief Event types */ commit fcd7515cb2b0fc641e34ff04dd31baa9d851e9b5 Author: Mathieu Rene <mrene@avgs.ca> Date: Tue Dec 21 14:50:34 2010 -0500 Add dz-ring diff --git a/conf/vars.xml b/conf/vars.xml index 05561d7..f17540c 100644 --- a/conf/vars.xml +++ b/conf/vars.xml @@ -205,6 +205,7 @@ <X-PRE-PROCESS cmd="set" data="rs-ring=%(1000,4000,425.0,0.0)"/> <X-PRE-PROCESS cmd="set" data="ru-ring=%(800,3200,425,0)"/> <X-PRE-PROCESS cmd="set" data="de-ring=%(1000,4000,425,0)"/> + <X-PRE-PROCESS cmd="set" data="dz-ring=%(1500,3500,425.0,0.0)"/> <X-PRE-PROCESS cmd="set" data="bong-ring=v=-7;%(100,0,941.0,1477.0);v=-7;>=2;+=.1;%(1400,0,350,440)"/> <X-PRE-PROCESS cmd="set" data="sit=%(274,0,913.8);%(274,0,1370.6);%(380,0,1776.7)"/> <!-- commit 723a598c24ffd6b70b67e1ee1864a87ba33ed1ce Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Tue Dec 21 16:32:02 2010 -0200 freetdm: core - lock the channel on ftdm_channel_read_event() ftmod_zt - not locking the channel on zt_channel_next_event(), minor changes diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index c04dd85..458025e 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -1142,14 +1142,17 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_read_event(ftdm_channel_t *ftdmchan, ftdm ftdm_span_t *span = ftdmchan->span; ftdm_assert_return(span->fio != NULL, FTDM_FAIL, "No I/O module attached to this span!\n"); + ftdm_channel_lock(ftdmchan); + if (!span->fio->channel_next_event) { ftdm_log(FTDM_LOG_ERROR, "channel_next_event method not implemented in module %s!", span->fio->name); - return FTDM_NOTIMPL; + status = FTDM_NOTIMPL; + goto done; } status = span->fio->channel_next_event(ftdmchan, event); if (status != FTDM_SUCCESS) { - return status; + goto done; } /* before returning the event to the user we do some core operations with certain OOB events */ @@ -1177,6 +1180,8 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_read_event(ftdm_channel_t *ftdmchan, ftdm break; } +done: + ftdm_channel_unlock(ftdmchan); return status; } diff --git a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c index 25f9b29..7ce3f71 100644 --- a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c +++ b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c @@ -1007,7 +1007,8 @@ FIO_CHANNEL_NEXT_EVENT_FUNCTION(zt_channel_next_event) if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_EVENT)) { ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_EVENT); if (ioctl(ftdmchan->sockfd, codes.GETEVENT, &zt_event_id) == -1) { - snprintf(span->last_error, sizeof(span->last_error), "%s", strerror(errno)); + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed retrieving event from channel: %s\n", + strerror(errno)); return FTDM_FAIL; } @@ -1044,7 +1045,7 @@ FIO_CHANNEL_NEXT_EVENT_FUNCTION(zt_channel_next_event) case ZT_EVENT_RINGOFFHOOK: { if (ftdmchan->type == FTDM_CHAN_TYPE_FXS || (ftdmchan->type == FTDM_CHAN_TYPE_EM && ftdmchan->state != FTDM_CHANNEL_STATE_UP)) { - ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_OFFHOOK); + ftdm_set_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK); event_id = FTDM_OOB_OFFHOOK; } else if (ftdmchan->type == FTDM_CHAN_TYPE_FXO) { event_id = FTDM_OOB_RING_START; @@ -1076,7 +1077,7 @@ FIO_CHANNEL_NEXT_EVENT_FUNCTION(zt_channel_next_event) break; default: { - ftdm_log(FTDM_LOG_WARNING, "Unhandled event %d for %d:%d\n", zt_event_id, span->span_id, i); + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Unhandled event %d for %d:%d\n", zt_event_id, span->span_id, i); event_id = FTDM_OOB_INVALID; } break; commit 7732a675988694f3f8c182b2dec51481e1652efd Merge: 36a8442 f5c36ac Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Tue Dec 21 14:16:45 2010 -0200 Merge branch 'master' into arnaldo.zt_chan_next_event commit 94bd1a7f26df0f59652364e33f9e9b46729b036a Author: Michal Bielicki <michal.bielicki@seventhsignal.de> Date: Tue Dec 21 15:52:22 2010 +0000 added german ringtone diff --git a/conf/vars.xml b/conf/vars.xml index fced2ef..05561d7 100644 --- a/conf/vars.xml +++ b/conf/vars.xml @@ -204,6 +204,7 @@ <X-PRE-PROCESS cmd="set" data="fr-ring=%(1500,3500,440.0,0.0)"/> <X-PRE-PROCESS cmd="set" data="rs-ring=%(1000,4000,425.0,0.0)"/> <X-PRE-PROCESS cmd="set" data="ru-ring=%(800,3200,425,0)"/> + <X-PRE-PROCESS cmd="set" data="de-ring=%(1000,4000,425,0)"/> <X-PRE-PROCESS cmd="set" data="bong-ring=v=-7;%(100,0,941.0,1477.0);v=-7;>=2;+=.1;%(1400,0,350,440)"/> <X-PRE-PROCESS cmd="set" data="sit=%(274,0,913.8);%(274,0,1370.6);%(380,0,1776.7)"/> <!-- commit f5c36acfe2437835254210061030f179050f62b2 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Tue Dec 21 13:31:21 2010 -0200 freetdm: mod_freetdm - updated api commands help ftmod_r2 - updated api help and removed references to threads per channel, not used anymore diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 7e09985..66bc532 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -3536,7 +3536,19 @@ void dump_chan_xml(ftdm_span_t *span, uint32_t chan_id, switch_stream_handle_t * switch_channel_cause2str(caller_data->hangup_cause)); } -#define FT_SYNTAX "list || dump <span_id> [<chan_id>] || q931_pcap <span_id> on|off [pcapfilename without suffix] || gains <txgain> <rxgain> <span_id> [<chan_id>] || dtmf on|off <span_id> [<chan_id>]" +#define FT_SYNTAX "USAGE:\n" \ +"--------------------------------------------------------------------------------\n" \ +"ftdm list\n" \ +"ftdm start|stop <span_name|span_id>\n" \ +"ftdm restart <span_id|span_name> <chan_id>\n" \ +"ftdm dump <span_id|span_name> [<chan_id>]\n" \ +"ftdm sigstatus get|set [<span_id|span_name>] [<channel>] [<sigstatus>]\n" \ +"ftdm trace <path> <span_id|span_name> [<chan_id>]\n" \ +"ftdm notrace <span_id|span_name> [<chan_id>]\n" \ +"ftdm q931_pcap <span_id> on|off [pcapfilename without suffix]\n" \ +"ftdm gains <txgain> <rxgain> <span_id> [<chan_id>]\n" \ +"ftdm dtmf on|off <span_id> [<chan_id>]\n" \ +"--------------------------------------------------------------------------------\n" SWITCH_STANDARD_API(ft_function) { char *mycmd = NULL, *argv[10] = { 0 }; diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index d178de5..e3ae0cf 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -50,10 +50,6 @@ #include "freetdm.h" #include "private/ftdm_core.h" -/* debug thread count for r2 legs */ -static ftdm_mutex_t* g_thread_count_mutex; -static int32_t g_thread_count = 0; - typedef int openr2_call_status_t; /* when the user stops a span, we clear FTDM_R2_SPAN_STARTED, so that the signaling thread @@ -2023,6 +2019,14 @@ static void __inline__ unblock_channel(ftdm_channel_t *fchan, ftdm_stream_handle ftdm_mutex_unlock(fchan->mutex); } +#define FT_SYNTAX "USAGE:\n" \ +"--------------------------------------------------------------------------------\n" \ +"ftdm r2 status <span_id|span_name>\n" \ +"ftdm r2 loopstats <span_id|span_name>\n" \ +"ftdm r2 block|unblock <span_id|span_name> [<chan_id>]\n" \ +"ftdm r2 version\n" \ +"ftdm r2 variants\n" \ +"--------------------------------------------------------------------------------\n" static FIO_API_FUNCTION(ftdm_r2_api) { ftdm_span_t *span = NULL; @@ -2206,14 +2210,6 @@ static FIO_API_FUNCTION(ftdm_r2_api) } if (argc == 1) { - if (!strcasecmp(argv[0], "threads")) { - ftdm_mutex_lock(g_thread_count_mutex); - stream->write_function(stream, "%d R2 channel threads up\n", g_thread_count); - ftdm_mutex_unlock(g_thread_count_mutex); - stream->write_function(stream, "+OK.\n"); - goto done; - } - if (!strcasecmp(argv[0], "version")) { stream->write_function(stream, "OpenR2 version: %s, revision: %s\n", openr2_get_version(), openr2_get_revision()); stream->write_function(stream, "+OK.\n"); @@ -2239,7 +2235,7 @@ static FIO_API_FUNCTION(ftdm_r2_api) } } - stream->write_function(stream, "-ERR invalid command.\n"); + stream->write_function(stream, "%s", FT_SYNTAX); done: @@ -2268,7 +2264,6 @@ static FIO_SIG_LOAD_FUNCTION(ftdm_r2_init) if (!g_mod_data_hash) { return FTDM_FAIL; } - ftdm_mutex_create(&g_thread_count_mutex); return FTDM_SUCCESS; } @@ -2288,7 +2283,6 @@ static FIO_SIG_UNLOAD_FUNCTION(ftdm_r2_destroy) } } hashtable_destroy(g_mod_data_hash); - ftdm_mutex_destroy(&g_thread_count_mutex); return FTDM_SUCCESS; } commit e085fea23ec990470dd83d654c6639ed526420c7 Author: Moises Silva <moy@sangoma.com> Date: Tue Dec 21 09:09:10 2010 -0500 freetdm: define _GNU_SOURCE to get gethostbyname_r diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/sangoma_boost_client.c b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/sangoma_boost_client.c index 982dd47..6ddb74d 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/sangoma_boost_client.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/sangoma_boost_client.c @@ -31,6 +31,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#define _GNU_SOURCE + #if HAVE_NETDB_H #include <netdb.h> #endif commit 1d7a1bd1311fe633669c7d48ba65e51ccbff24db Author: Moises Silva <moy@sangoma.com> Date: Tue Dec 21 08:57:11 2010 -0500 freetdm: use ULL for flags diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index 6c521e3..b7c6d4a 100644 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -237,41 +237,41 @@ typedef enum { "HANGUP", "HANGUP_COMPLETE", "IN_LOOP", "RESET", "INVALID" FTDM_STR2ENUM_P(ftdm_str2ftdm_channel_state, ftdm_channel_state2str, ftdm_channel_state_t) -/*!< Channel flags. This used to be an enum but we reached the 32bit limit for enums */ -#define FTDM_CHANNEL_CONFIGURED (1UL << 0) -#define FTDM_CHANNEL_READY (1UL << 1) -#define FTDM_CHANNEL_OPEN (1UL << 2) -#define FTDM_CHANNEL_DTMF_DETECT (1UL << 3) -#define FTDM_CHANNEL_SUPRESS_DTMF (1UL << 4) -#define FTDM_CHANNEL_TRANSCODE (1UL << 5) -#define FTDM_CHANNEL_BUFFER (1UL << 6) -#define FTDM_CHANNEL_EVENT (1UL << 7) -#define FTDM_CHANNEL_INTHREAD (1UL << 8) -#define FTDM_CHANNEL_WINK (1UL << 9) -#define FTDM_CHANNEL_FLASH (1UL << 10) -#define FTDM_CHANNEL_STATE_CHANGE (1UL << 11) -#define FTDM_CHANNEL_HOLD (1UL << 12) -#define FTDM_CHANNEL_INUSE (1UL << 13) -#define FTDM_CHANNEL_OFFHOOK (1UL << 14) -#define FTDM_CHANNEL_RINGING (1UL << 15) -#define FTDM_CHANNEL_PROGRESS_DETECT (1UL << 16) -#define FTDM_CHANNEL_CALLERID_DETECT (1UL << 17) -#define FTDM_CHANNEL_OUTBOUND (1UL << 18) -#define FTDM_CHANNEL_SUSPENDED (1UL << 19) -#define FTDM_CHANNEL_3WAY (1UL << 20) -#define FTDM_CHANNEL_PROGRESS (1UL << 21) -#define FTDM_CHANNEL_MEDIA (1UL << 22) -#define FTDM_CHANNEL_ANSWERED (1UL << 23) -#define FTDM_CHANNEL_MUTE (1UL << 24) -#define FTDM_CHANNEL_USE_RX_GAIN (1UL << 25) -#define FTDM_CHANNEL_USE_TX_GAIN (1UL << 26) -#define FTDM_CHANNEL_IN_ALARM (1UL << 27) -#define FTDM_CHANNEL_SIG_UP (1UL << 28) -#define FTDM_CHANNEL_USER_HANGUP (1UL << 29) -#define FTDM_CHANNEL_RX_DISABLED (1UL << 30) -#define FTDM_CHANNEL_TX_DISABLED (1UL << 31) +/*!< Channel flags. This used to be an enum but we reached the 32bit limit for enums, is safer this way */ +#define FTDM_CHANNEL_CONFIGURED (1ULL << 0) +#define FTDM_CHANNEL_READY (1ULL << 1) +#define FTDM_CHANNEL_OPEN (1ULL << 2) +#define FTDM_CHANNEL_DTMF_DETECT (1ULL << 3) +#define FTDM_CHANNEL_SUPRESS_DTMF (1ULL << 4) +#define FTDM_CHANNEL_TRANSCODE (1ULL << 5) +#define FTDM_CHANNEL_BUFFER (1ULL << 6) +#define FTDM_CHANNEL_EVENT (1ULL << 7) +#define FTDM_CHANNEL_INTHREAD (1ULL << 8) +#define FTDM_CHANNEL_WINK (1ULL << 9) +#define FTDM_CHANNEL_FLASH (1ULL << 10) +#define FTDM_CHANNEL_STATE_CHANGE (1ULL << 11) +#define FTDM_CHANNEL_HOLD (1ULL << 12) +#define FTDM_CHANNEL_INUSE (1ULL << 13) +#define FTDM_CHANNEL_OFFHOOK (1ULL << 14) +#define FTDM_CHANNEL_RINGING (1ULL << 15) +#define FTDM_CHANNEL_PROGRESS_DETECT (1ULL << 16) +#define FTDM_CHANNEL_CALLERID_DETECT (1ULL << 17) +#define FTDM_CHANNEL_OUTBOUND (1ULL << 18) +#define FTDM_CHANNEL_SUSPENDED (1ULL << 19) +#define FTDM_CHANNEL_3WAY (1ULL << 20) +#define FTDM_CHANNEL_PROGRESS (1ULL << 21) +#define FTDM_CHANNEL_MEDIA (1ULL << 22) +#define FTDM_CHANNEL_ANSWERED (1ULL << 23) +#define FTDM_CHANNEL_MUTE (1ULL << 24) +#define FTDM_CHANNEL_USE_RX_GAIN (1ULL << 25) +#define FTDM_CHANNEL_USE_TX_GAIN (1ULL << 26) +#define FTDM_CHANNEL_IN_ALARM (1ULL << 27) +#define FTDM_CHANNEL_SIG_UP (1ULL << 28) +#define FTDM_CHANNEL_USER_HANGUP (1ULL << 29) +#define FTDM_CHANNEL_RX_DISABLED (1ULL << 30) +#define FTDM_CHANNEL_TX_DISABLED (1ULL << 31) /*!< The user knows about a call in this channel */ -#define FTDM_CHANNEL_CALL_STARTED (1UL << 32) +#define FTDM_CHANNEL_CALL_STARTED (1ULL << 32) typedef enum { ZSM_NONE, commit 4f9dd5e164b355d8b116a5f3cb0f0271c3366d10 Author: Andrew Thompson <andrew@hijacked.us> Date: Mon Dec 20 23:57:45 2010 -0500 mod_conference: Add XML output for conference run time, recording status and member mute-detect. Also add events for recording start and stop. This work was funded by Xpander Communications. diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 53ce82b..cf8ae96 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -191,7 +191,8 @@ typedef enum { EFLAG_TRANSFER = (1 << 23), EFLAG_BGDIAL_RESULT = (1 << 24), EFLAG_FLOOR_CHANGE = (1 << 25), - EFLAG_MUTE_DETECT = (1 << 26) + EFLAG_MUTE_DETECT = (1 << 26), + EFLAG_RECORD = (1 << 27) } event_type_t; typedef struct conference_file_node { @@ -270,6 +271,7 @@ typedef struct conference_obj { uint32_t not_talking_buf_len; int comfort_noise_level; int is_recording; + int record_count; int video_running; uint32_t eflags; uint32_t verbose_events; @@ -283,6 +285,7 @@ typedef struct conference_obj { uint32_t avg_score; uint32_t avg_itt; uint32_t avg_tally; + switch_time_t run_time; } conference_obj_t; /* Relationship with another member */ @@ -468,6 +471,7 @@ static switch_status_t conference_add_event_member_data(conference_member_t *mem switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Hear", "%s", switch_test_flag(member, MFLAG_CAN_HEAR) ? "true" : "false" ); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Speak", "%s", switch_test_flag(member, MFLAG_CAN_SPEAK) ? "true" : "false" ); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Talking", "%s", switch_test_flag(member, MFLAG_TALKING) ? "true" : "false" ); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Mute-Detect", "%s", switch_test_flag(member, MFLAG_MUTE_DETECT) ? "true" : "false" ); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-Type", "%s", switch_test_flag(member, MFLAG_MOD) ? "moderator" : "member"); @@ -563,6 +567,7 @@ static switch_status_t conference_record_stop(conference_obj_t *conference, char return count; } + /* Add a custom relationship to a member */ static conference_relationship_t *member_add_relationship(conference_member_t *member, uint32_t id) { @@ -1035,6 +1040,7 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, v switch_mutex_unlock(globals.hash_mutex); conference->is_recording = 0; + conference->record_count = 0; while (globals.running && !switch_test_flag(conference, CFLAG_DESTRUCT)) { switch_size_t file_sample_len = samples; @@ -1099,6 +1105,7 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, v /* Start recording if there's more than one participant. */ if (conference->auto_record && !conference->is_recording && conference->count > 1) { conference->is_recording = 1; + conference->record_count++; imember = conference->members; if (imember) { switch_channel_t *channel = switch_core_session_get_channel(imember->session); @@ -2623,6 +2630,7 @@ static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *th switch_timer_t timer = { 0 }; uint32_t rlen; switch_size_t data_buf_len; + switch_event_t *event; data_buf_len = samples * sizeof(int16_t); @@ -2701,6 +2709,15 @@ static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *th switch_core_file_set_string(&fh, SWITCH_AUDIO_COL_STR_ARTIST, "FreeSWITCH mod_conference Software Conference Module"); + if (test_eflag(conference, EFLAG_RECORD) && + switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) { + conference_add_event_data(conference, event); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "start-recording"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Path", rec->path); + switch_event_fire(&event); + } + + while (switch_test_flag(member, MFLAG_RUNNING) && switch_test_flag(conference, CFLAG_RUNNING) && conference->count) { switch_size_t len = 0; mux_used = (uint32_t) switch_buffer_inuse(member->mux_buffer); @@ -3759,6 +3776,13 @@ static void conference_xlist(conference_obj_t *conference, switch_xml_t x_confer switch_xml_set_attr_d(x_conference, "dynamic", "true"); } + if (conference->record_count > 0) { + switch_xml_set_attr_d(x_conference, "recording", "true"); + } + + switch_snprintf(i, sizeof(i), "%d", switch_epoch_time_now(NULL) - conference->run_time); + switch_xml_set_attr_d(x_conference, "run_time", ival); + if (conference->agc_level) { char tmp[30] = ""; switch_snprintf(tmp, sizeof(tmp), "%d", conference->agc_level); @@ -3825,6 +3849,9 @@ static void conference_xlist(conference_obj_t *conference, switch_xml_t x_confer x_tag = switch_xml_add_child_d(x_flags, "can_speak", count++); switch_xml_set_txt_d(x_tag, switch_test_flag(member, MFLAG_CAN_SPEAK) ? "true" : "false"); + x_tag = switch_xml_add_child_d(x_flags, "mute_detect", count++); + switch_xml_set_txt_d(x_tag, switch_test_flag(member, MFLAG_MUTE_DETECT) ? "true" : "false"); + x_tag = switch_xml_add_child_d(x_flags, "talking", count++); switch_xml_set_txt_d(x_tag, switch_test_flag(member, MFLAG_TALKING) ? "true" : "false"); @@ -4414,6 +4441,7 @@ static switch_status_t conf_api_sub_record(conference_obj_t *conference, switch_ return SWITCH_STATUS_GENERR; stream->write_function(stream, "Record file %s\n", argv[2]); + conference->record_count++; launch_conference_record_thread(conference, argv[2]); return SWITCH_STATUS_SUCCESS; } @@ -4421,6 +4449,7 @@ static switch_status_t conf_api_sub_record(conference_obj_t *conference, switch_ static switch_status_t conf_api_sub_norecord(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv) { int all; + switch_event_t *event; switch_assert(conference != NULL); switch_assert(stream != NULL); @@ -4432,6 +4461,20 @@ static switch_status_t conf_api_sub_norecord(conference_obj_t *conference, switc stream->write_function(stream, "Stop recording file %s\n", argv[2]); if (!conference_record_stop(conference, all ? NULL : argv[2]) && !all) { stream->write_function(stream, "non-existant recording '%s'\n", argv[2]); + } else { + if (all) { + conference->record_count = 0; + } else { + conference->record_count--; + } + if (test_eflag(conference, EFLAG_RECORD) && + switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) { + conference_add_event_data(conference, event); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "stop-recording"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Path", all ? "all" : argv[2]); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Other-Recordings", conference->record_count ? "true" : "false"); + switch_event_fire(&event); + } } return SWITCH_STATUS_SUCCESS; @@ -5138,6 +5181,8 @@ static void clear_eflags(char *events, uint32_t *f) *f &= ~EFLAG_BGDIAL_RESULT; } else if (!strcmp(event, "floor-change")) { *f &= ~EFLAG_FLOOR_CHANGE; + } else if (!strcmp(event, "record")) { + *f &= ~EFLAG_RECORD; } event = next; @@ -6121,6 +6166,7 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m conference->caller_id_name = switch_core_strdup(conference->pool, caller_id_name); conference->caller_id_number = switch_core_strdup(conference->pool, caller_id_number); conference->caller_controls = switch_core_strdup(conference->pool, caller_controls); + conference->run_time = switch_epoch_time_now(NULL); if (!zstr(perpetual_sound)) { commit 1b1dea020675d588053f0051b5236dd60d115b08 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Dec 20 20:19:36 2010 -0600 FS-2879 diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 2f2dcdb..aa5ddb9 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -1052,8 +1052,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_signal_bridge(switch_core_session_t * switch_channel_set_variable(caller_channel, "signal_bridge", "true"); switch_channel_set_variable(peer_channel, "signal_bridge", "true"); - switch_channel_sort_cid(peer_channel, SWITCH_FALSE); - /* fire events that will change the data table from "show channels" */ if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(caller_channel, event); @@ -1119,8 +1117,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses switch_channel_set_flag_recursive(caller_channel, CF_BRIDGE_ORIGINATOR); switch_channel_clear_flag(peer_channel, CF_BRIDGE_ORIGINATOR); - switch_channel_sort_cid(peer_channel, SWITCH_FALSE); - b_leg->session = peer_session; switch_copy_string(b_leg->b_uuid, switch_core_session_get_uuid(session), sizeof(b_leg->b_uuid)); b_leg->stream_id = stream_id; diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 87a47e6..51032de 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -2410,6 +2410,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } } + new_profile->callee_id_name = switch_core_strdup(new_profile->pool, "Outbound Call"); + new_profile->callee_id_number = switch_core_strdup(new_profile->pool, new_profile->destination_number); + originate_status[i].caller_profile = NULL; originate_status[i].peer_channel = NULL; originate_status[i].peer_session = NULL; commit d29d83d74323fda1d8c6c50627dab5504c8441b8 Author: Jeff Lenk <jeff@jefflenk.com> Date: Mon Dec 20 19:23:13 2010 -0600 ESL-53 Noevent/Noevents disparity diff --git a/libs/esl/fs_cli.c b/libs/esl/fs_cli.c index 569e2cd..1e3bf04 100644 --- a/libs/esl/fs_cli.c +++ b/libs/esl/fs_cli.c @@ -656,7 +656,7 @@ static int process_command(esl_handle_t *handle, const char *cmd) "-----------------------------------------------\n" "/help \tHelp\n" "/exit, /quit, /bye, ... \tExit the program.\n" - "/event, /noevent, /nixevent\tEvent commands.\n" + "/event, /noevents, /nixevent\tEvent commands.\n" "/log, /nolog \tLog commands.\n" "/uuid \tFilter logs for a single call uuid\n" "/filter \tFilter commands.\n" @@ -692,7 +692,7 @@ static int process_command(esl_handle_t *handle, const char *cmd) } else if ( !strncasecmp(cmd, "event", 5) || - !strncasecmp(cmd, "noevent", 7) || + !strncasecmp(cmd, "noevents", 8) || !strncasecmp(cmd, "nixevent", 8) || !strncasecmp(cmd, "log", 3) || !strncasecmp(cmd, "nolog", 5) || commit 4f9bbdc41b587dba82a93b7937847a99666e6263 Author: David Yat Sin <dyatsin@sangoma.com> Date: Mon Dec 20 17:19:01 2010 -0500 Fixed for some compile errors diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 67bc6e9..305d23c 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -284,7 +284,9 @@ void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event) case FTDM_CHANNEL_STATE_PROGRESS: case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: case FTDM_CHANNEL_STATE_DIALING: +#ifdef NETBORDER_CALL_REF get_callref(ftdmchan, &cnStEvnt->callRef); +#endif get_prog_ind_ie(ftdmchan, &cnStEvnt->progInd); get_facility_ie(ftdmchan, &cnStEvnt->facilityStr); ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_UP); @@ -357,7 +359,9 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) case MI_CALLPROC: case MI_PROGRESS: case MI_ALERTING: +#ifdef NETBORDER_CALL_REF get_callref(ftdmchan, &cnStEvnt->callRef); +#endif get_prog_ind_ie(ftdmchan, &cnStEvnt->progInd); get_facility_ie(ftdmchan, &cnStEvnt->facilityStr); commit 4551ae51c3dcac7588962221d2dcbabe6792572c Merge: c2d7957 27ea959 Author: David Yat Sin <dyatsin@sangoma.com> Date: Mon Dec 20 17:11:32 2010 -0500 Merge branch 'netborder' of git.sangoma.com:smg_freeswitch into netborder commit c2d7957142fbead7b71f2d183f5de2e6893ab874 Merge: 48a1ae3 4144d51 Author: David Yat Sin <dyatsin@sangoma.com> Date: Mon Dec 20 17:08:15 2010 -0500 Merge branch 'master' into netborder Conflicts: libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c diff --cc libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c index fd9edeb,e7488c7..e63ed16 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c @@@ -120,10 -132,7 +132,7 @@@ void sngisdn_trace_raw_q921(sngisdn_spa sigev.ev_data.trace.dir = dir; sigev.ev_data.trace.type = FTDM_TRACE_TYPE_Q921; - + - /* TODO: Map trace to call ID here */ - sigev.call_id = 0; - raw_data = ftdm_malloc(data_len); ftdm_assert(raw_data, "Failed to malloc"); commit 4144d518c60cd215915d9ab07a49425bbe701286 Author: David Yat Sin <dyatsin@sangoma.com> Date: Mon Dec 20 17:06:36 2010 -0500 Freetdm: Support for mapped raw traces diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 6a440e4..9e54788 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -233,6 +233,7 @@ typedef struct sngisdn_chan_data { uint32_t flags; uint8_t ces; /* used only for BRI, otherwise always 0 */ uint8_t dchan_id; + uint16_t call_ref; /* Q.931 call reference, only valid for ETSI/INSNET/QSIG */ uint32_t suInstId; /* instance ID generated locally */ uint32_t spInstId; /* instance ID generated by stack */ @@ -446,6 +447,9 @@ void sngisdn_rcv_cc_ind(CcMngmt *status); void sngisdn_rcv_sng_log(uint8_t level, char *fmt,...); void sngisdn_rcv_sng_assert(char *message); +#ifdef NETBORDER_CALL_REF +ftdm_status_t get_callref(ftdm_channel_t *ftdmchan, BCCallRef* callRef); +#endif ftdm_status_t get_calling_num(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb); ftdm_status_t get_calling_num2(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb); ftdm_status_t get_called_num(ftdm_channel_t *ftdmchan, CdPtyNmb *cdPtyNmb); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 7e9e360..67bc6e9 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -71,13 +71,12 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) sngisdn_info->glare.suInstId = suInstId; /* Do not generate a suInstId now, we will generate when glared call gets extracted */ sngisdn_info->glare.spInstId = spInstId; sngisdn_info->glare.dChan = dChan; - sngisdn_info->glare.ces = ces; + sngisdn_info->glare.ces = ces; break; } sngisdn_info->suInstId = get_unique_suInstId(suId); sngisdn_info->spInstId = spInstId; - if (conEvnt->cdPtyNmb.eh.pres && signal_data->num_local_numbers) { uint8_t local_number_matched = 0; @@ -125,6 +124,9 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) } /* Fill in call information */ +#ifdef NETBORDER_CALL_REF + get_callref(ftdmchan, &conEvnt->callRef); +#endif get_calling_num(ftdmchan, &conEvnt->cgPtyNmb); get_calling_num2(ftdmchan, &conEvnt->cgPtyNmb2); get_called_num(ftdmchan, &conEvnt->cdPtyNmb); @@ -282,6 +284,7 @@ void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event) case FTDM_CHANNEL_STATE_PROGRESS: case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: case FTDM_CHANNEL_STATE_DIALING: + get_callref(ftdmchan, &cnStEvnt->callRef); get_prog_ind_ie(ftdmchan, &cnStEvnt->progInd); get_facility_ie(ftdmchan, &cnStEvnt->facilityStr); ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_UP); @@ -354,6 +357,7 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) case MI_CALLPROC: case MI_PROGRESS: case MI_ALERTING: + get_callref(ftdmchan, &cnStEvnt->callRef); get_prog_ind_ie(ftdmchan, &cnStEvnt->progInd); get_facility_ie(ftdmchan, &cnStEvnt->facilityStr); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 28768a1..6fd613b 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -161,6 +161,32 @@ ftdm_status_t sngisdn_set_span_avail_rate(ftdm_span_t *span, sngisdn_avail_t ava return FTDM_SUCCESS; } +#ifdef NETBORDER_CALL_REF +ftdm_status_t get_callref(ftdm_channel_t *ftdmchan, BCCallRef* callRef) +{ + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data; + + if (signal_data->raw_trace_q931) { + if (callRef->eh.pres != PRSNT_NODEF || callRef->reference.pres != PRSNT_NODEF) { + /* Netborder only supports BRI, so we only care for BRI for now */ + if (FTDM_SPAN_IS_BRI(ftdmchan->span) && !sngisdn_info->call_ref) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Failed to obtain call reference\n"); + } + return FTDM_FAIL; + } + if (FTDM_SPAN_IS_BRI(ftdmchan->span)) { + sngisdn_info->call_ref = 0x7F & callRef->reference.val; + } else { + sngisdn_info->call_ref = 0x7FFF & callRef->reference.val; + } + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Call reference:%04x\n", sngisdn_info->call_ref); + } + return FTDM_SUCCESS; +} +#endif + ftdm_status_t get_calling_num(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb) { ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c index fd9edeb..e7488c7 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c @@ -38,14 +38,26 @@ #define OCTET(x) (ieData[x-1] & 0xFF) #define MAX_DECODE_STR_LEN 2000 +typedef struct sngisdn_trace_info +{ + uint8_t call_ref_flag; + uint16_t call_ref; + uint8_t msgtype; + uint8_t bchan_no; + ftdm_trace_dir_t dir; +} sngisdn_frame_info_t; + void print_hex_dump(char* str, uint32_t *str_len, uint8_t* data, uint32_t index_start, uint32_t index_end); uint32_t sngisdn_decode_ie(char *str, uint32_t *str_len, uint8_t current_codeset, uint8_t *data, uint16_t index_start); +static ftdm_status_t sngisdn_map_call(sngisdn_span_data_t *signal_data, sngisdn_frame_info_t frame_info, ftdm_channel_t **found); +static ftdm_status_t sngisdn_get_frame_info(uint8_t *data, uint32_t data_len, ftdm_trace_dir_t dir, sngisdn_frame_info_t *frame_info); uint8_t get_bits(uint8_t octet, uint8_t bitLo, uint8_t bitHi); char* get_code_2_str(int code, struct code2str *pCodeTable); void sngisdn_decode_q921(char* str, uint8_t* data, uint32_t data_len); void sngisdn_decode_q931(char* str, uint8_t* data, uint32_t data_len); + char* get_code_2_str(int code, struct code2str *pCodeTable) { struct code2str* pCode2txt; @@ -120,10 +132,7 @@ void sngisdn_trace_raw_q921(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t d sigev.ev_data.trace.dir = dir; sigev.ev_data.trace.type = FTDM_TRACE_TYPE_Q921; - - /* TODO: Map trace to call ID here */ - sigev.call_id = 0; - + raw_data = ftdm_malloc(data_len); ftdm_assert(raw_data, "Failed to malloc"); @@ -218,26 +227,33 @@ void sngisdn_trace_raw_q931(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t d { uint8_t *raw_data; ftdm_sigmsg_t sigev; + ftdm_channel_t *ftdmchan; + sngisdn_frame_info_t frame_info; memset(&sigev, 0, sizeof(sigev)); - sigev.span_id = signal_data->ftdm_span->span_id; - sigev.chan_id = signal_data->dchan->chan_id; - sigev.channel = signal_data->dchan; - sigev.event_id = FTDM_SIGEVENT_TRACE_RAW; - - sigev.ev_data.trace.dir = dir; - sigev.ev_data.trace.type = FTDM_TRACE_TYPE_Q931; - - /* TODO: Map trace to call ID here */ + /* Note: Mapped raw trace assume only exclusive b-channel selection is used. i.e the b-channel selected on outgoing SETUP is always used for the call */ - raw_data = ftdm_malloc(data_len); - ftdm_assert(raw_data, "Failed to malloc"); - - memcpy(raw_data, data, data_len); - sigev.raw_data = raw_data; - sigev.raw_data_len = data_len; - ftdm_span_send_signal(signal_data->ftdm_span, &sigev); + if (sngisdn_get_frame_info(data, data_len, dir, &frame_info) == FTDM_SUCCESS) { + if (sngisdn_map_call(signal_data, frame_info, &ftdmchan) == FTDM_SUCCESS) { + sigev.call_id = ftdmchan->caller_data.call_id; + sigev.span_id = ftdmchan->physical_span_id; + sigev.chan_id = ftdmchan->physical_chan_id; + sigev.channel = ftdmchan; + } + sigev.event_id = FTDM_SIGEVENT_TRACE_RAW; + + sigev.ev_data.trace.dir = dir; + sigev.ev_data.trace.type = FTDM_TRACE_TYPE_Q931; + + raw_data = ftdm_malloc(data_len); + ftdm_assert(raw_data, "Failed to malloc"); + + memcpy(raw_data, data, data_len); + sigev.raw_data = raw_data; + sigev.raw_data_len = data_len; + ftdm_span_send_signal(signal_data->ftdm_span, &sigev); + } } void sngisdn_decode_q931(char* str, uint8_t* data, uint32_t data_len) @@ -253,9 +269,6 @@ void sngisdn_decode_q931(char* str, uint8_t* data, uint32_t data_len) prot_disc = (uint8_t)data[0]; str_len += sprintf(&str[str_len], " Prot Disc:%s (0x%02x)\n", get_code_2_str(prot_disc, dcodQ931ProtDiscTable), prot_disc); - - - /* Decode Call Reference */ lenCallRef = (uint8_t) (data[1] & 0x0F); @@ -747,4 +760,203 @@ void print_hex_dump(char* str, uint32_t *str_len, uint8_t* data, uint32_t index_ return; } +static ftdm_status_t sngisdn_get_frame_info(uint8_t *data, uint32_t data_len, ftdm_trace_dir_t dir, sngisdn_frame_info_t *target) +{ + uint8_t pos = 0; + uint8_t flag; + uint16_t ref = 0; + uint8_t ref_len = 0; + uint8_t bchan_no = 0; + uint8_t msgtype; + + /* First octet is protocol discriminator */ + pos++; + /* Second octet contains length of call reference */ + ref_len = data[pos++] & 0x0F; + + /* third octet is call reference */ + flag = (data[pos] & 0x80) >> 7; + if (ref_len == 2) { + ref = (data[pos++] & 0x7F) << 8; + ref |= (data[pos++] & 0xFF) ; + } else { + ref = (data[pos++] & 0x7F); + } + + /* Next octet is the message type */ + msgtype = data[pos++] & 0x7F; + + /* + ftdm_log(FTDM_LOG_DEBUG, "Raw frame:call_ref:0x%04x flag:%d msgtype:%d\n", ref, flag, msgtype); + */ + if (!ref) { + /* This is not a call specific message (RESTART for example and we do not care about it) */ + return FTDM_FAIL; + } + + /* Look for the b-channel */ + if (msgtype == PROT_Q931_MSGTYPE_SETUP) { + /* Try to find the b-channel no*/ + + for(; pos < data_len; pos++) { + uint8_t ie_id = data[pos]; + uint8_t ie_len = data[pos+1]; + + switch(ie_id) { + case PROT_Q931_IE_SENDING_COMPLETE: + /* Single octet ie's do not have a length */ + ie_len = 0; + break; + case PROT_Q931_IE_CHANNEL_ID: + { + /* Try to obtain the b-channel */ + uint8_t ie_pos = pos+2; + //ifaceIdPresent = get_bits(OCTET(3),7,7); + if (data[ie_pos] & 0x20) { + /* Interface type is Primary Rate */ + ie_pos+=2; + bchan_no = data[ie_pos] & 0x7F; + } else { + /* Interface type is Basic Interface */ + /* Get the channel number from info channel selection */ + bchan_no = data[ie_pos] & 0x03; + } + ftdm_log(FTDM_LOG_DEBUG, "Found b-channel:%d\n", bchan_no); + goto parse_ies_done; + } + break; + default: + pos = pos+ie_len+1; + } + //ftdm_log(FTDM_LOG_DEBUG, "Decoded IE:%s\n", get_code_2_str(ie_id, dcodQ931IEIDTable)); + } + if (!bchan_no) { + char tmp[1000]; + print_hex_dump(tmp, 0, data, 0, data_len); + ftdm_log(FTDM_LOG_WARNING, "Failed to determine b-channel on SETUP message\n%s\n", tmp); + } + } + +parse_ies_done: + + target->call_ref = ref; + target->call_ref_flag = flag; + target->msgtype = msgtype; + target->bchan_no = bchan_no; + target->dir = dir; + + return FTDM_SUCCESS; +} + +static ftdm_status_t sngisdn_map_call(sngisdn_span_data_t *signal_data, sngisdn_frame_info_t frame_info, ftdm_channel_t **found) +{ + ftdm_channel_t *ftdmchan; + sngisdn_chan_data_t *sngisdn_info; + ftdm_iterator_t *chaniter = NULL; + ftdm_iterator_t *curr = NULL; + ftdm_status_t status = FTDM_FAIL; + uint8_t outbound_call = 0; + + if ((!frame_info.call_ref_flag && frame_info.dir == FTDM_TRACE_DIR_OUTGOING) || + (frame_info.call_ref_flag && frame_info.dir == FTDM_TRACE_DIR_INCOMING)) { + + /* If this is an outgoing frame and this frame was sent by the originating side + of the call (frame_info.call_ref_flag == 0), then this is an outbound call */ + outbound_call = 1; + } else { + outbound_call = 0; + } + + switch (frame_info.msgtype) { + case PROT_Q931_MSGTYPE_SETUP: + /* We initiated this outgoing call try to match the call reference with our internal call-id*/ + if (!frame_info.bchan_no) { + /* We were not able to determine the bchannel on this call, so we will not be able to match it anyway */ + status = FTDM_FAIL; + } + + chaniter = ftdm_span_get_chan_iterator(signal_data->ftdm_span, NULL); + for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { + ftdmchan = (ftdm_channel_t*)(ftdm_iterator_current(curr)); + ftdm_channel_lock(ftdmchan); + + if (outbound_call) { + sngisdn_info = (sngisdn_chan_data_t*)ftdmchan->call_data; + if (sngisdn_info && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + if (ftdmchan->caller_data.call_id && ftdmchan->physical_chan_id == frame_info.bchan_no) { + + sngisdn_info->call_ref = frame_info.call_ref; + *found = ftdmchan; + status = FTDM_SUCCESS; + } + } + } else { + if (ftdmchan->physical_chan_id == frame_info.bchan_no) { + *found = ftdmchan; + status = FTDM_SUCCESS; + } + } + ftdm_channel_unlock(ftdmchan); + } + ftdm_iterator_free(chaniter); + break; + case PROT_Q931_MSGTYPE_ALERTING: + case PROT_Q931_MSGTYPE_PROCEEDING: + case PROT_Q931_MSGTYPE_PROGRESS: + case PROT_Q931_MSGTYPE_CONNECT: + case PROT_Q931_MSGTYPE_SETUP_ACK: + case PROT_Q931_MSGTYPE_CONNECT_ACK: + case PROT_Q931_MSGTYPE_USER_INFO: + case PROT_Q931_MSGTYPE_DISCONNECT: + case PROT_Q931_MSGTYPE_RELEASE: + case PROT_Q931_MSGTYPE_RELEASE_ACK: + case PROT_Q931_MSGTYPE_RELEASE_COMPLETE: + case PROT_Q931_MSGTYPE_FACILITY: + case PROT_Q931_MSGTYPE_NOTIFY: + case PROT_Q931_MSGTYPE_STATUS_ENQUIRY: + case PROT_Q931_MSGTYPE_INFORMATION: + case PROT_Q931_MSGTYPE_STATUS: + /* Look for an outbound call on that span and and try to match the call-id */ + chaniter = ftdm_span_get_chan_iterator(signal_data->ftdm_span, NULL); + for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { + ftdmchan = (ftdm_channel_t*)(ftdm_iterator_current(curr)); + ftdm_channel_lock(ftdmchan); + sngisdn_info = (sngisdn_chan_data_t*)ftdmchan->call_data; + if (outbound_call) { + if (sngisdn_info && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + if (sngisdn_info->call_ref == frame_info.call_ref) { + + *found = ftdmchan; + status = FTDM_SUCCESS; + } + } + } else { + if (sngisdn_info && !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + if (sngisdn_info->call_ref && sngisdn_info->call_ref == frame_info.call_ref) { + + *found = ftdmchan; + status = FTDM_SUCCESS; + } + } + } + ftdm_channel_unlock(ftdmchan); + } + ftdm_iterator_free(chaniter); + break; + default: + /* This frame is not call specific, ignore */ + break; + } + if (status == FTDM_SUCCESS) { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Mapped %s with Call Ref:%04x to call-id:%d\n", get_code_2_str(frame_info.msgtype, dcodQ931MsgTypeTable), frame_info.call_ref, (*found)->caller_data.call_id); + } else { + /* We could not map this frame to a call-id */ + ftdm_log(FTDM_LOG_DEBUG, "Failed to map %s with Call Ref:%04x to local call\n", + get_code_2_str(frame_info.msgtype, dcodQ931MsgTypeTable), frame_info.call_ref); + } + + return status; +} + + diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.h index f054de9..db33cf8 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.h @@ -191,37 +191,65 @@ struct code2str dcodQ931CallRefLoTable[] = { {13, "D"}, {14, "E"}, {15, "F"}, - {-1,"?"}, + {-1, "?"}, }; +#define PROT_Q931_MSGTYPE_ALERTING 1 +#define PROT_Q931_MSGTYPE_PROCEEDING 2 +#define PROT_Q931_MSGTYPE_PROGRESS 3 +#define PROT_Q931_MSGTYPE_SETUP 5 +#define PROT_Q931_MSGTYPE_CONNECT 7 +#define PROT_Q931_MSGTYPE_SETUP_ACK 13 +#define PROT_Q931_MSGTYPE_CONNECT_ACK 15 +#define PROT_Q931_MSGTYPE_USER_INFO 32 +#define PROT_Q931_MSGTYPE_SUSPEND_REJ 33 +#define PROT_Q931_MSGTYPE_RESUME_REJ 34 +#define PROT_Q931_MSGTYPE_SUSPEND 37 +#define PROT_Q931_MSGTYPE_RESUME 38 +#define PROT_Q931_MSGTYPE_SUSPEND_ACK 45 +#define PROT_Q931_MSGTYPE_RESUME_ACK 46 +#define PROT_Q931_MSGTYPE_DISCONNECT 69 +#define PROT_Q931_MSGTYPE_RESTART 70 +#define PROT_Q931_MSGTYPE_RELEASE 77 +#define PROT_Q931_MSGTYPE_RELEASE_ACK 78 +#define PROT_Q931_MSGTYPE_RELEASE_COMPLETE 90 +#define PROT_Q931_MSGTYPE_SEGMENT 96 +#define PROT_Q931_MSGTYPE_FACILITY 98 +#define PROT_Q931_MSGTYPE_NOTIFY 110 +#define PROT_Q931_MSGTYPE_STATUS_ENQUIRY 117 +#define PROT_Q931_MSGTYPE_CONGESTION_CNTRL 121 +#define PROT_Q931_MSGTYPE_INFORMATION 123 +#define PROT_Q931_MSGTYPE_STATUS 125 + + struct code2str dcodQ931MsgTypeTable[] = { - {1, "Alerting"}, - {2, "Call Proceeding"}, - {3, "Progress"}, - {5, "Setup"}, - {7, "Connect"}, - {13, "Setup Ack"}, - {15, "Connect Ack"}, - {32, "User Info"}, - {33, "Suspend Rej"}, - {34, "Resume Rej"}, - {37, "Suspend"}, - {38, "Resume"}, - {45, "Suspend Ack"}, - {46, "Resume Ack"}, - {69, "Disconnect"}, - {70, "Restart"}, - {77, "Release"}, - {78, "Release Ack"}, - {90, "Release Compl"}, - {96, "Segment"}, - {98, "Facility"}, - {110, "Notify"}, - {117, "Status Enquiry"}, - {121, "Congest Cntrl"}, - {123, "Information"}, - {125, "Status"}, - {-1, "Unknown"}, + {PROT_Q931_MSGTYPE_ALERTING, "ALERT"}, + {PROT_Q931_MSGTYPE_PROCEEDING, "PROCEED"}, + {PROT_Q931_MSGTYPE_PROGRESS, "PROGRESS"}, + {PROT_Q931_MSGTYPE_SETUP, "SETUP"}, + {PROT_Q931_MSGTYPE_CONNECT, "CONNECT"}, + {PROT_Q931_MSGTYPE_SETUP_ACK, "SETUP ACK"}, + {PROT_Q931_MSGTYPE_CONNECT_ACK, "CONNECT ACK"}, + {PROT_Q931_MSGTYPE_USER_INFO, "USER INFO"}, + {PROT_Q931_MSGTYPE_SUSPEND_REJ, "SUSPEND REJ"}, + {PROT_Q931_MSGTYPE_RESUME_REJ, "RESUME REJ"}, + {PROT_Q931_MSGTYPE_SUSPEND, "SUSPEND"}, + {PROT_Q931_MSGTYPE_RESUME, "RESUME"}, + {PROT_Q931_MSGTYPE_SUSPEND_ACK, "SUSPEND ACK"}, + {PROT_Q931_MSGTYPE_RESUME_ACK, "RESUME ACK"}, + {PROT_Q931_MSGTYPE_DISCONNECT, "DISCONNECT"}, + {PROT_Q931_MSGTYPE_RESTART, "RESTART"}, + {PROT_Q931_MSGTYPE_RELEASE, "RELEASE"}, + {PROT_Q931_MSGTYPE_RELEASE_ACK, "RELEASR ACK"}, + {PROT_Q931_MSGTYPE_RELEASE_COMPLETE, "RELEASE COMPLETE"}, + {PROT_Q931_MSGTYPE_SEGMENT, "SEGMENT"}, + {PROT_Q931_MSGTYPE_FACILITY, "FACILITY"}, + {PROT_Q931_MSGTYPE_NOTIFY, "NOTIFY"}, + {PROT_Q931_MSGTYPE_STATUS_ENQUIRY, "STATUS ENQ"}, + {PROT_Q931_MSGTYPE_CONGESTION_CNTRL, "CONGESTION CTRL"}, + {PROT_Q931_MSGTYPE_INFORMATION, "INFO"}, + {PROT_Q931_MSGTYPE_STATUS, "STATUS"}, + {-1, "UNKNOWN"}, }; struct code2str dcodQ931CauseCodeTable[] = { commit 092d22a2142e00245c93f9a5a6592176c00188a8 Author: Moises Silva <moy@sangoma.com> Date: Mon Dec 20 16:57:01 2010 -0500 freetdm: fix get caller id command diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 131d92e..c04dd85 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2780,7 +2780,8 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "%s", strerror(errno)); GOTO_STATUS(done, FTDM_FAIL); } - ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_CALLERID_DETECT); + ftdm_set_flag(ftdmchan, FTDM_CHANNEL_CALLERID_DETECT); + GOTO_STATUS(done, FTDM_SUCCESS); } } break; @@ -2788,7 +2789,8 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co { if (!ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_CALLERID)) { ftdm_fsk_demod_destroy(&ftdmchan->fsk); - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_CALLERID_DETECT); + ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_CALLERID_DETECT); + GOTO_STATUS(done, FTDM_SUCCESS); } } break; @@ -3051,7 +3053,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co case FTDM_COMMAND_DISABLE_PROGRESS_DETECT: { if (!ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_PROGRESS)) { - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_PROGRESS_DETECT); + ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_PROGRESS_DETECT); ftdm_channel_clear_detected_tones(ftdmchan); ftdm_channel_clear_needed_tones(ftdmchan); GOTO_STATUS(done, FTDM_SUCCESS); @@ -3063,8 +3065,8 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co /* if they don't have thier own, use ours */ if (!ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_DTMF_DETECT)) { teletone_dtmf_detect_init (&ftdmchan->dtmf_detect, ftdmchan->rate); - ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_DTMF_DETECT); - ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_SUPRESS_DTMF); + ftdm_set_flag(ftdmchan, FTDM_CHANNEL_DTMF_DETECT); + ftdm_set_flag(ftdmchan, FTDM_CHANNEL_SUPRESS_DTMF); ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Enabled software DTMF detector\n"); GOTO_STATUS(done, FTDM_SUCCESS); } commit f804c75d99598cfce0d4e09c0fcef40bd8827f9d Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Dec 20 15:43:54 2010 -0600 presence was drafted by satan diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index f0cade3..4b93492 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -55,6 +55,7 @@ static void sync_sla(sofia_profile_t *profile, const char *to_user, const char * struct dialog_helper { char status[512]; char rpid[512]; + char presence_id[1024]; }; struct resub_helper { @@ -479,9 +480,10 @@ static int sofia_presence_dialog_callback(void *pArg, int argc, char **argv, cha { struct dialog_helper *helper = (struct dialog_helper *) pArg; - if (argc == 2) { + if (argc == 3) { switch_set_string(helper->status, argv[0]); switch_set_string(helper->rpid, argv[1]); + switch_set_string(helper->presence_id, argv[2]); } return -1; @@ -638,7 +640,8 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) } if (probe_euser && probe_host && (profile = sofia_glue_find_profile(probe_host))) { - sql = switch_mprintf("select status,rpid from sip_dialogs where ((sip_from_user='%q' and sip_from_host='%q') or presence_id='%q@%q')", + sql = switch_mprintf("select status,rpid,presence_id from sip_dialogs " + "where ((sip_from_user='%q' and sip_from_host='%q') or presence_id='%q@%q')", probe_euser, probe_host, probe_euser, probe_host); sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_dialog_callback, &dh); @@ -656,16 +659,16 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) "sip_dialogs.direction, " "sip_dialogs.sip_to_user, " "sip_dialogs.sip_to_host, " + "sip_presence.status," "sip_presence.rpid," "sip_dialogs.presence_id, " "sip_presence.open_closed," "'%q','%q' " + "from sip_registrations " - "from sip_registrations left join sip_dialogs on " + "left join sip_dialogs on " "sip_dialogs.presence_id = sip_registrations.sip_user || '@' || sip_registrations.sip_host " - - "or (sip_dialogs.sip_from_user = sip_registrations.sip_user " "and sip_dialogs.sip_from_host = sip_registrations.sip_host) " @@ -813,7 +816,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); } - sql = switch_mprintf("select status,rpid from sip_dialogs where ((sip_from_user='%q' and sip_from_host='%q') or presence_id='%q@%q')", + sql = switch_mprintf("select status,rpid,presence_id from sip_dialogs where ((sip_from_user='%q' and sip_from_host='%q') or presence_id='%q@%q')", euser, host, euser, host); sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_dialog_callback, &dh); switch_safe_free(sql); @@ -824,25 +827,19 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) "sip_subscriptions.full_via,sip_subscriptions.expires,sip_subscriptions.user_agent," "sip_subscriptions.accept,sip_subscriptions.profile_name" ",'%q','%q','%q',sip_presence.status,sip_presence.rpid,sip_presence.open_closed,'%q','%q'," - "sip_subscriptions.version, sip_dialogs.presence_id " + "sip_subscriptions.version, '%q' " "from sip_subscriptions " "left join sip_presence on " "(sip_subscriptions.sub_to_user=sip_presence.sip_user and sip_subscriptions.sub_to_host=sip_presence.sip_host and " "sip_subscriptions.profile_name=sip_presence.profile_name) " - "left join sip_dialogs on " - - "sip_dialogs.presence_id = sip_subscriptions.sub_to_user || '@' || sip_subscriptions.sub_to_host or " - - - "(sip_dialogs.sip_from_user = sip_subscriptions.sub_to_user " - "and sip_dialogs.sip_from_host = sip_subscriptions.sub_to_host) " "where sip_subscriptions.expires > -1 and " "(event='%q' or event='%q') and sub_to_user='%q' " "and (sub_to_host='%q' or presence_hosts like '%%%q%%') " - "and (sip_subscriptions.profile_name = '%q' or sip_subscriptions.presence_hosts != sip_subscriptions.sub_to_host)", - switch_str_nil(status), switch_str_nil(rpid), host, - dh.status,dh.rpid, + "and (sip_subscriptions.profile_name = '%q' or sip_subscriptions.presence_hosts != sip_subscriptions.sub_to_host) ", + + switch_str_nil(status), switch_str_nil(rpid), host, + dh.status,dh.rpid,dh.presence_id, event_type, alt_event_type, euser, host, host, profile->name))) { struct presence_helper helper = { 0 }; commit 38968d15fe3250bb86751ebb099fd6844c6346d3 Author: Moises Silva <moy@sangoma.com> Date: Mon Dec 20 16:15:41 2010 -0500 freetdm: fake signaling status notifications in ftmod_analog diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 584ed27..7e09985 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1731,6 +1731,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_fxo_signal) } break; case FTDM_SIGEVENT_RELEASED: { /* twiddle */ } break; + case FTDM_SIGEVENT_SIGSTATUS_CHANGED: { /* twiddle */ } break; default: { diff --git a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c index 5b68098..0acf70b 100644 --- a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c +++ b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c @@ -96,6 +96,10 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(analog_fxs_outgoing_call) static FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(analog_get_channel_sig_status) { + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_IN_ALARM)) { + *status = FTDM_SIG_STATE_DOWN; + return FTDM_SUCCESS; + } *status = FTDM_SIG_STATE_UP; return FTDM_SUCCESS; } @@ -109,7 +113,25 @@ static FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(analog_get_channel_sig_status) static FIO_SPAN_GET_SIG_STATUS_FUNCTION(analog_get_span_sig_status) { - *status = FTDM_SIG_STATE_UP; + ftdm_iterator_t *citer = NULL; + ftdm_iterator_t *chaniter = ftdm_span_get_chan_iterator(span, NULL); + if (!chaniter) { + ftdm_log(FTDM_LOG_CRIT, "Failed to allocate channel iterator for span %s!\n", span->name); + return FTDM_FAIL; + } + /* if ALL channels are in alarm, report DOWN, UP otherwise. */ + *status = FTDM_SIG_STATE_DOWN; + for (citer = chaniter; citer; citer = ftdm_iterator_next(citer)) { + ftdm_channel_t *fchan = ftdm_iterator_current(citer); + ftdm_channel_lock(fchan); + if (!ftdm_test_flag(fchan, FTDM_CHANNEL_IN_ALARM)) { + *status = FTDM_SIG_STATE_UP; + ftdm_channel_unlock(fchan); + break; + } + ftdm_channel_unlock(fchan); + } + ftdm_iterator_free(chaniter); return FTDM_SUCCESS; } @@ -967,6 +989,21 @@ static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *e ftdm_set_state(event->channel, FTDM_CHANNEL_STATE_DOWN); } } + break; + case FTDM_OOB_ALARM_TRAP: + { + sig.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; + sig.ev_data.sigstatus.status = FTDM_SIG_STATE_DOWN; + ftdm_span_send_signal(span, &sig); + } + break; + case FTDM_OOB_ALARM_CLEAR: + { + sig.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; + sig.ev_data.sigstatus.status = FTDM_SIG_STATE_UP; + ftdm_span_send_signal(span, &sig); + } + break; default: { ftdm_log_chan(event->channel, FTDM_LOG_DEBUG, "Ignoring event [%s] in state [%s]\n", ftdm_oob_event2str(event->enum_id), ftdm_channel_state2str(event->channel->state)); commit a78922a21221b1c88ebfe0093c7a55bb4bfd6be7 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Dec 20 15:05:07 2010 -0600 nope diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 0590189..f0cade3 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -840,11 +840,10 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) "where sip_subscriptions.expires > -1 and " "(event='%q' or event='%q') and sub_to_user='%q' " "and (sub_to_host='%q' or presence_hosts like '%%%q%%') " - "and (sip_subscriptions.profile_name = '%q' or sip_subscriptions.presence_hosts != sip_subscriptions.sub_to_host) " - "and (presence_id is null or presence_id = '%q@%q')", + "and (sip_subscriptions.profile_name = '%q' or sip_subscriptions.presence_hosts != sip_subscriptions.sub_to_host)", switch_str_nil(status), switch_str_nil(rpid), host, dh.status,dh.rpid, - event_type, alt_event_type, euser, host, host, profile->name, euser, host))) { + event_type, alt_event_type, euser, host, host, profile->name))) { struct presence_helper helper = { 0 }; commit 82ad5278b3fac8adeebbb32bf155d024d423c43c Author: Jeff Lenk <jeff@jefflenk.com> Date: Mon Dec 20 14:55:18 2010 -0600 tweak vs2010 freetdm wanpipe diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2010.vcxproj b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2010.vcxproj index b165ac8..40d0a73 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2010.vcxproj +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2010.vcxproj @@ -100,7 +100,7 @@ <DebugInformationFormat>EditAndContinue</DebugInformationFormat> </ClCompile> <Link> - <AdditionalDependencies>freetdm.lib;libsangoma.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>libsangoma.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalLibraryDirectories>$(OutDir);C:\Program Files\Sangoma\api\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <GenerateDebugInformation>true</GenerateDebugInformation> <SubSystem>Console</SubSystem> @@ -127,7 +127,7 @@ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> <Link> - <AdditionalDependencies>freetdm.lib;libsangoma.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>libsangoma.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalLibraryDirectories>$(OutDir);C:\Program Files\Sangoma\api\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <GenerateDebugInformation>true</GenerateDebugInformation> <SubSystem>Console</SubSystem> @@ -148,7 +148,7 @@ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> <Link> - <AdditionalDependencies>freetdm.lib;libsangoma.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>libsangoma.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalLibraryDirectories>$(OutDir);C:\Program Files\Sangoma\api\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <GenerateDebugInformation>true</GenerateDebugInformation> <SubSystem>Console</SubSystem> @@ -174,7 +174,7 @@ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> <Link> - <AdditionalDependencies>freetdm.lib;libsangoma.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>libsangoma.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalLibraryDirectories>$(OutDir);C:\Program Files\Sangoma\api\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <GenerateDebugInformation>true</GenerateDebugInformation> <SubSystem>Console</SubSystem> commit cfd6876c2127bd64b7c2ced80407b5b9f962549b Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Dec 20 14:36:03 2010 -0600 more presence and not the kind with bows and ribbons diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index f0cade3..0590189 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -840,10 +840,11 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) "where sip_subscriptions.expires > -1 and " "(event='%q' or event='%q') and sub_to_user='%q' " "and (sub_to_host='%q' or presence_hosts like '%%%q%%') " - "and (sip_subscriptions.profile_name = '%q' or sip_subscriptions.presence_hosts != sip_subscriptions.sub_to_host)", + "and (sip_subscriptions.profile_name = '%q' or sip_subscriptions.presence_hosts != sip_subscriptions.sub_to_host) " + "and (presence_id is null or presence_id = '%q@%q')", switch_str_nil(status), switch_str_nil(rpid), host, dh.status,dh.rpid, - event_type, alt_event_type, euser, host, host, profile->name))) { + event_type, alt_event_type, euser, host, host, profile->name, euser, host))) { struct presence_helper helper = { 0 }; commit b5b2f6134dcc06ba994b1f71d619b8b4a5626b1e Author: Moises Silva <moy@sangoma.com> Date: Mon Dec 20 14:06:54 2010 -0500 freetdm: multiple fixes for the core and analog * Replace ftdm_channel_flag_t with defines. We reached the 32bit limit where does not seem reliable to keep using enum. * Flags member for ftdm_channel_t is now uint64_t * Added FTDM_CHANNEL_CALL_STARTED flag to indicate when the API user knows about a call * Refactored raw_data member for ftdm_sigmsg_t. If raw_data needs to be freed it must be requested explicitly through the autofree member * Added collected member to ftdm_sigmsg_t for FTDM_SIGEVENT_COLLECTED data instead of using raw_data * Created define FTDM_DIGITS_LIMIT for DNIS/ANI digits limit * Fix some stat checks and outdated code in ftmod_analog * Refactored ftdm_channel_get_history_str API to return the time offsets and time since last state change * Do not send FTDM_SIGEVENT_STOP and FTDM_SIGEVENT_RELEASED on calls that were never reported to the user diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 80006f1..584ed27 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1920,7 +1920,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_fxs_signal) case FTDM_SIGEVENT_COLLECTED_DIGIT: { int span_id = ftdm_channel_get_span_id(sigmsg->channel); - char *dtmf = sigmsg->raw_data; + char *dtmf = sigmsg->ev_data.collected.digits; char *regex = SPAN_CONFIG[span_id].dial_regex; char *fail_regex = SPAN_CONFIG[span_id].fail_dial_regex; ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(sigmsg->channel); @@ -2192,7 +2192,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_clear_channel_signal) break; case FTDM_SIGEVENT_SIGSTATUS_CHANGED: { - ftdm_signaling_status_t sigstatus = sigmsg->raw_data ? *((ftdm_signaling_status_t*)(sigmsg->raw_data)) : sigmsg->ev_data.sigstatus.status; + ftdm_signaling_status_t sigstatus = sigmsg->ev_data.sigstatus.status; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%d:%d signalling changed to :%s\n", spanid, chanid, ftdm_signaling_status2str(sigstatus)); } diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 0494ef8..131d92e 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2512,17 +2512,20 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_place(const char *file, const char ftdm_log(FTDM_LOG_ERROR, "outgoing_call method not implemented in this span!\n"); } + if (status == FTDM_SUCCESS) { + ftdm_set_flag(ftdmchan, FTDM_CHANNEL_CALL_STARTED); + ftdm_call_set_call_id(&ftdmchan->caller_data); + ftdm_wait_for_flag_cleared(ftdmchan, FTDM_CHANNEL_STATE_CHANGE, 100); + } + + ftdm_channel_unlock(ftdmchan); + #ifdef __WINDOWS__ UNREFERENCED_PARAMETER(file); UNREFERENCED_PARAMETER(func); UNREFERENCED_PARAMETER(line); #endif - ftdm_wait_for_flag_cleared(ftdmchan, FTDM_CHANNEL_STATE_CHANGE, 100); - - ftdm_call_set_call_id(&ftdmchan->caller_data); - ftdm_channel_unlock(ftdmchan); - return status; } @@ -2633,7 +2636,7 @@ static ftdm_status_t ftdm_channel_done(ftdm_channel_t *ftdmchan) ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_INPUT_DUMP, NULL); ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_OUTPUT_DUMP, NULL); - if (FTDM_IS_VOICE_CHANNEL(ftdmchan)) { + if (FTDM_IS_VOICE_CHANNEL(ftdmchan) && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_CALL_STARTED)) { ftdm_sigmsg_t sigmsg; memset(&sigmsg, 0, sizeof(sigmsg)); sigmsg.span_id = ftdmchan->span_id; @@ -2642,6 +2645,7 @@ static ftdm_status_t ftdm_channel_done(ftdm_channel_t *ftdmchan) sigmsg.event_id = FTDM_SIGEVENT_RELEASED; ftdm_span_send_signal(ftdmchan->span, &sigmsg); ftdm_call_clear_call_id(&ftdmchan->caller_data); + ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_CALL_STARTED); } if (ftdmchan->txdrops || ftdmchan->rxdrops) { @@ -3712,23 +3716,21 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_read(ftdm_channel_t *ftdmchan, void *data } status = ftdm_raw_read(ftdmchan, data, datalen); - if (status != FTDM_SUCCESS) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "raw I/O read filed\n"); + goto done; } - if (status == FTDM_SUCCESS) { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_USE_RX_GAIN) - && (ftdmchan->native_codec == FTDM_CODEC_ALAW || ftdmchan->native_codec == FTDM_CODEC_ULAW)) { - unsigned char *rdata = data; - for (i = 0; i < *datalen; i++) { - rdata[i] = ftdmchan->rxgain_table[rdata[i]]; - } + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_USE_RX_GAIN) + && (ftdmchan->native_codec == FTDM_CODEC_ALAW || ftdmchan->native_codec == FTDM_CODEC_ULAW)) { + unsigned char *rdata = data; + for (i = 0; i < *datalen; i++) { + rdata[i] = ftdmchan->rxgain_table[rdata[i]]; } - handle_dtmf(ftdmchan, *datalen); } + handle_dtmf(ftdmchan, *datalen); - if (status == FTDM_SUCCESS && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_TRANSCODE) && ftdmchan->effective_codec != ftdmchan->native_codec) { + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_TRANSCODE) && ftdmchan->effective_codec != ftdmchan->native_codec) { if (ftdmchan->native_codec == FTDM_CODEC_ULAW && ftdmchan->effective_codec == FTDM_CODEC_SLIN) { codec_func = fio_ulaw2slin; } else if (ftdmchan->native_codec == FTDM_CODEC_ULAW && ftdmchan->effective_codec == FTDM_CODEC_ALAW) { @@ -5333,7 +5335,6 @@ static void ftdm_group_add(ftdm_group_t *group) ftdm_mutex_unlock(globals.group_mutex); } - FT_DECLARE(ftdm_status_t) ftdm_group_create(ftdm_group_t **group, const char *name) { ftdm_group_t *new_group = NULL; @@ -5367,7 +5368,11 @@ static ftdm_status_t ftdm_span_trigger_signal(const ftdm_span_t *span, ftdm_sigm if (sigmsg->channel) { ftdm_call_clear_data(&(sigmsg->channel->caller_data)); } - ftdm_safe_free(sigmsg->raw_data); + if (sigmsg->raw.autofree) { + ftdm_safe_free(sigmsg->raw.data); + sigmsg->raw.data = NULL; + sigmsg->raw.len = 0; + } return status; } @@ -5431,6 +5436,7 @@ FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t case FTDM_SIGEVENT_START: { + ftdm_set_flag(sigmsg->channel, FTDM_CHANNEL_CALL_STARTED); ftdm_call_set_call_id(&sigmsg->channel->caller_data); ftdm_set_echocancel_call_begin(sigmsg->channel); if (sigmsg->channel->dtmfdbg.requested) { @@ -5446,6 +5452,11 @@ FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t break; case FTDM_SIGEVENT_STOP: + if (!ftdm_test_flag(sigmsg->channel, FTDM_CHANNEL_CALL_STARTED)) { + /* this happens for FXS devices which blindly send SIGEVENT_STOP, we should fix it there ... */ + ftdm_log_chan_msg(sigmsg->channel, FTDM_LOG_DEBUG, "Ignoring SIGEVENT_STOP since user never knew about a call in this channel\n"); + goto done; + } if (ftdm_test_flag(sigmsg->channel, FTDM_CHANNEL_USER_HANGUP)) { ftdm_log_chan_msg(sigmsg->channel, FTDM_LOG_DEBUG, "Ignoring SIGEVENT_STOP since user already requested hangup\n"); goto done; @@ -6011,12 +6022,34 @@ FT_DECLARE(char *) ftdm_strndup(const char *str, ftdm_size_t inlen) return new; } -FT_DECLARE(char *) ftdm_channel_get_history_str(const ftdm_channel_t *fchan) + +static void write_history_entry(const ftdm_channel_t *fchan, ftdm_stream_handle_t *stream, int i, ftdm_time_t *prevtime) { char func[255]; char line[255]; char states[255]; + const char *filename = NULL; + snprintf(states, sizeof(states), "%-5.15s => %-5.15s", ftdm_channel_state2str(fchan->history[i].last_state), ftdm_channel_state2str(fchan->history[i].state)); + snprintf(func, sizeof(func), "[%s]", fchan->history[i].func); + filename = strrchr(fchan->history[i].file, *FTDM_PATH_SEPARATOR); + if (!filename) { + filename = fchan->history[i].file; + } else { + filename++; + } + if (!(*prevtime)) { + *prevtime = fchan->history[i].time; + } + snprintf(line, sizeof(func), "[%s:%d]", filename, fchan->history[i].line); + stream->write_function(stream, "%-30.30s %-30.30s %-30.30s %lums\n", states, func, line, (fchan->history[i].time - *prevtime)); + *prevtime = fchan->history[i].time; +} + +FT_DECLARE(char *) ftdm_channel_get_history_str(const ftdm_channel_t *fchan) +{ uint8_t i = 0; + ftdm_time_t currtime = 0; + ftdm_time_t prevtime = 0; ftdm_stream_handle_t stream = { 0 }; FTDM_STANDARD_STREAM(stream); @@ -6025,25 +6058,24 @@ FT_DECLARE(char *) ftdm_channel_get_history_str(const ftdm_channel_t *fchan) return stream.data; } - stream.write_function(&stream, "%-30.30s %-30.30s %s", "-- States --", "-- Function --", "-- Location --\n"); + stream.write_function(&stream, "%-30.30s %-30.30s %-30.30s %s", + "-- States --", "-- Function --", "-- Location --", "-- Time Offset --\n"); for (i = fchan->hindex; i < ftdm_array_len(fchan->history); i++) { if (!fchan->history[i].file) { break; } - snprintf(states, sizeof(states), "%-5.15s => %-5.15s", ftdm_channel_state2str(fchan->history[i].last_state), ftdm_channel_state2str(fchan->history[i].state)); - snprintf(func, sizeof(func), "[%s]", fchan->history[i].func); - snprintf(line, sizeof(func), "[%s:%d]", fchan->history[i].file, fchan->history[i].line); - stream.write_function(&stream, "%-30.30s %-30.30s %s\n", states, func, line); + write_history_entry(fchan, &stream, i, &prevtime); } for (i = 0; i < fchan->hindex; i++) { - snprintf(states, sizeof(states), "%-5.15s => %-5.15s", ftdm_channel_state2str(fchan->history[i].last_state), ftdm_channel_state2str(fchan->history[i].state)); - snprintf(func, sizeof(func), "[%s]", fchan->history[i].func); - snprintf(line, sizeof(func), "[%s:%d]", fchan->history[i].file, fchan->history[i].line); - stream.write_function(&stream, "%-30.30s %-30.30s %s\n", states, func, line); + write_history_entry(fchan, &stream, i, &prevtime); } + currtime = ftdm_current_time_in_ms(); + + stream.write_function(&stream, "\nTime since last state change: %lums\n", (currtime - prevtime)); + return stream.data; } @@ -6074,15 +6106,23 @@ static ftdm_status_t ftdm_call_set_call_id(ftdm_caller_data_t *caller_data) static ftdm_status_t ftdm_call_clear_call_id(ftdm_caller_data_t *caller_data) { - ftdm_assert_return((caller_data->call_id && caller_data->call_id <= MAX_CALLIDS), FTDM_FAIL, "Clearing call with invalid call-id\n"); + if (caller_data->call_id) { + ftdm_assert_return((caller_data->call_id <= MAX_CALLIDS), FTDM_FAIL, "Cannot clear call with invalid call-id\n"); + } else { + /* there might not be a call at all */ + return FTDM_SUCCESS; + } + ftdm_mutex_lock(globals.call_id_mutex); if (globals.call_ids[caller_data->call_id]) { + ftdm_log(FTDM_LOG_DEBUG, "Cleared call with id %u\n", caller_data->call_id); caller_data->call_id = 0; globals.call_ids[caller_data->call_id] = NULL; } else { ftdm_log(FTDM_LOG_CRIT, "call-id did not exist %u\n", caller_data->call_id); } ftdm_mutex_unlock(globals.call_id_mutex); + return FTDM_SUCCESS; } diff --git a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c index f07f48b..5b68098 100644 --- a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c +++ b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c @@ -493,8 +493,10 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) if (ftdmchan->type == FTDM_CHAN_TYPE_FXS && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK) && - (ftdmchan->last_state == FTDM_CHANNEL_STATE_RINGING || ftdmchan->last_state == FTDM_CHANNEL_STATE_DIALTONE - || ftdmchan->last_state == FTDM_CHANNEL_STATE_RING)) { + (ftdmchan->last_state == FTDM_CHANNEL_STATE_RINGING + || ftdmchan->last_state == FTDM_CHANNEL_STATE_DIALTONE + || ftdmchan->last_state == FTDM_CHANNEL_STATE_RING + || ftdmchan->last_state == FTDM_CHANNEL_STATE_UP)) { ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY); } else { ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_CLEARING; @@ -717,7 +719,7 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) dtmf_offset = strlen(dtmf); last_digit = elapsed; sig.event_id = FTDM_SIGEVENT_COLLECTED_DIGIT; - sig.raw_data = dtmf; + ftdm_set_string(sig.ev_data.collected.digits, dtmf); if (ftdm_span_send_signal(ftdmchan->span, &sig) == FTDM_BREAK) { collecting = 0; } @@ -884,14 +886,14 @@ static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *e { if (event->channel->type != FTDM_CHAN_TYPE_FXO) { ftdm_log_chan_msg(event->channel, FTDM_LOG_ERROR, "Cannot get a RING_START event on a non-fxo channel, please check your config.\n"); - ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_DOWN); + ftdm_set_state(event->channel, FTDM_CHANNEL_STATE_DOWN); goto end; } if (!event->channel->ring_count && (event->channel->state == FTDM_CHANNEL_STATE_DOWN && !ftdm_test_flag(event->channel, FTDM_CHANNEL_INTHREAD))) { if (ftdm_test_flag(analog_data, FTDM_ANALOG_CALLERID)) { - ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_GET_CALLERID); + ftdm_set_state(event->channel, FTDM_CHANNEL_STATE_GET_CALLERID); } else { - ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_RING); + ftdm_set_state(event->channel, FTDM_CHANNEL_STATE_RING); } event->channel->ring_count = 1; ftdm_mutex_unlock(event->channel->mutex); @@ -909,7 +911,12 @@ static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *e } if (event->channel->state != FTDM_CHANNEL_STATE_DOWN) { - ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_DOWN); + if (event->channel->state == FTDM_CHANNEL_STATE_HANGUP && + ftdm_test_flag(event->channel, FTDM_CHANNEL_STATE_CHANGE)) { + ftdm_clear_flag(event->channel, FTDM_CHANNEL_STATE_CHANGE); + /* we do not need to process HANGUP since the device also hangup already */ + } + ftdm_set_state(event->channel, FTDM_CHANNEL_STATE_DOWN); } } @@ -917,16 +924,16 @@ static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *e case FTDM_OOB_FLASH: { if (event->channel->state == FTDM_CHANNEL_STATE_CALLWAITING) { - ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_UP); - ftdm_clear_flag_locked(event->channel, FTDM_CHANNEL_STATE_CHANGE); - ftdm_clear_flag_locked(event->channel->span, FTDM_SPAN_STATE_CHANGE); + ftdm_set_state(event->channel, FTDM_CHANNEL_STATE_UP); + ftdm_clear_flag(event->channel, FTDM_CHANNEL_STATE_CHANGE); + ftdm_clear_flag(event->channel->span, FTDM_SPAN_STATE_CHANGE); event->channel->detected_tones[FTDM_TONEMAP_CALLWAITING_ACK] = 0; } ftdm_channel_rotate_tokens(event->channel); if (ftdm_test_flag(event->channel, FTDM_CHANNEL_HOLD) && event->channel->token_count != 1) { - ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_UP); + ftdm_set_state(event->channel, FTDM_CHANNEL_STATE_UP); } else { sig.event_id = FTDM_SIGEVENT_FLASH; ftdm_span_send_signal(span, &sig); @@ -940,12 +947,12 @@ static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *e if (ftdm_test_flag(event->channel, FTDM_CHANNEL_RINGING)) { ftdm_channel_command(event->channel, FTDM_COMMAND_GENERATE_RING_OFF, NULL); } - ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_UP); + ftdm_set_state(event->channel, FTDM_CHANNEL_STATE_UP); } else { if(!analog_data->max_dialstr) { - ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_COLLECT); + ftdm_set_state(event->channel, FTDM_CHANNEL_STATE_COLLECT); } else { - ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_DIALTONE); + ftdm_set_state(event->channel, FTDM_CHANNEL_STATE_DIALTONE); } ftdm_mutex_unlock(event->channel->mutex); locked = 0; @@ -957,7 +964,7 @@ static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *e ftdm_channel_command(event->channel, FTDM_COMMAND_ONHOOK, NULL); } } - ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_DOWN); + ftdm_set_state(event->channel, FTDM_CHANNEL_STATE_DOWN); } } default: diff --git a/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c b/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c index 886c4a8..843ac48 100644 --- a/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c +++ b/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c @@ -467,7 +467,7 @@ static void *ftdm_analog_em_channel_run(ftdm_thread_t *me, void *obj) dtmf_offset = strlen(dtmf); last_digit = elapsed; sig.event_id = FTDM_SIGEVENT_COLLECTED_DIGIT; - sig.raw_data = dtmf; + ftdm_set_string(sig.ev_data.collected.digits, dtmf); if (ftdm_span_send_signal(ftdmchan->span, &sig) == FTDM_BREAK) { collecting = 0; } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c index c03976a..8c421b0 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c @@ -128,8 +128,9 @@ void sngisdn_trace_raw_q921(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t d ftdm_assert(raw_data, "Failed to malloc"); memcpy(raw_data, data, data_len); - sigev.raw_data = raw_data; - sigev.raw_data_len = data_len; + sigev.raw.data = raw_data; + sigev.raw.len = data_len; + sigev.raw.autofree = 1; ftdm_span_send_signal(signal_data->ftdm_span, &sigev); } @@ -235,8 +236,9 @@ void sngisdn_trace_raw_q931(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t d ftdm_assert(raw_data, "Failed to malloc"); memcpy(raw_data, data, data_len); - sigev.raw_data = raw_data; - sigev.raw_data_len = data_len; + sigev.raw.data = raw_data; + sigev.raw.len = data_len; + sigev.raw.autofree = 1; ftdm_span_send_signal(signal_data->ftdm_span, &sigev); } diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index a74fd70..79e8733 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -281,16 +281,18 @@ typedef enum { #define CALLING_PARTY_CATEGORY_STRINGS "unknown", "operator", "ordinary", "priority", "data-call", "test-call", "payphone", "invalid" FTDM_STR2ENUM_P(ftdm_str2ftdm_calling_party_category, ftdm_calling_party_category2str, ftdm_calling_party_category_t) +/*! \brief Digit limit used in DNIS/ANI */ +#define FTDM_DIGITS_LIMIT 25 /*! \brief Number abstraction */ typedef struct { - char digits[25]; + char digits[FTDM_DIGITS_LIMIT]; uint8_t type; uint8_t plan; } ftdm_number_t; typedef void * ftdm_variable_container_t; - + /*! \brief Caller information */ typedef struct ftdm_caller_data { char cid_date[8]; /*!< Caller ID date */ @@ -299,10 +301,10 @@ typedef struct ftdm_caller_data { ftdm_number_t ani; /*!< ANI (Automatic Number Identification) */ ftdm_number_t dnis; /*!< DNIS (Dialed Number Identification Service) */ ftdm_number_t rdnis; /*!< RDNIS (Redirected Dialed Number Identification Service) */ - char aniII[25]; /*! ANI II */ + char aniII[FTDM_DIGITS_LIMIT]; /*! ANI II */ uint8_t screen; /*!< Screening */ uint8_t pres; /*!< Presentation*/ - char collected[25]; /*!< Collected digits so far */ + char collected[FTDM_DIGITS_LIMIT]; /*!< Collected digits so far */ int hangup_cause; /*!< Hangup cause */ char raw_data[1024]; /*!< Protocol specific raw caller data */ uint32_t raw_data_len; /*!< Raw data length */ @@ -426,19 +428,28 @@ typedef struct { uint8_t level; /* 1 for phy layer, 2 for q921/mtp2, 3 for q931/mtp3 */ } ftdm_event_trace_t; +typedef struct { + /* Digits collected */ + char digits[FTDM_DIGITS_LIMIT]; +} ftdm_event_collected_t; + /*! \brief Generic signaling message */ struct ftdm_sigmsg { ftdm_signal_event_t event_id; /*!< The type of message */ ftdm_channel_t *channel; /*!< Related channel */ uint32_t chan_id; /*!< easy access to chan id */ uint32_t span_id; /*!< easy access to span_id */ - void *raw_data; /*!< Message specific data if any */ - uint32_t raw_data_len; /*!< Data len in case is needed */ uint32_t call_id; /*!< unique call id for this call */ union { ftdm_event_sigstatus_t sigstatus; /*!< valid if event_id is FTDM_SIGEVENT_SIGSTATUS_CHANGED */ ftdm_event_trace_t logevent; /*!< valid if event_id is FTDM_SIGEVENT_TRACE or FTDM_SIGEVENT_TRACE_RAW */ + ftdm_event_collected_t collected; /*!< valif if event_id is FTDM_SIGEVENT_COLLECTED_DIGIT */ } ev_data; + struct { + uint8_t autofree; /*!< Whether the freetdm core will free it after message delivery */ + uint32_t len; /*!< Data len */ + void *data; /*!< Signaling module specific data */ + } raw; }; /*! \brief Crash policy diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index e8ee715..606a89f 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -411,7 +411,7 @@ struct ftdm_channel { uint32_t extra_id; ftdm_chan_type_t type; ftdm_socket_t sockfd; - uint32_t flags; + uint64_t flags; uint32_t pflags; uint32_t sflags; ftdm_alarm_flag_t alarm_flags; diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index f03c060..6c521e3 100644 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -237,52 +237,41 @@ typedef enum { "HANGUP", "HANGUP_COMPLETE", "IN_LOOP", "RESET", "INVALID" FTDM_STR2ENUM_P(ftdm_str2ftdm_channel_state, ftdm_channel_state2str, ftdm_channel_state_t) -typedef enum { - FTDM_CHANNEL_CONFIGURED = (1 << 0), - FTDM_CHANNEL_READY = (1 << 1), - FTDM_CHANNEL_OPEN = (1 << 2), - FTDM_CHANNEL_DTMF_DETECT = (1 << 3), - FTDM_CHANNEL_SUPRESS_DTMF = (1 << 4), - FTDM_CHANNEL_TRANSCODE = (1 << 5), - FTDM_CHANNEL_BUFFER = (1 << 6), - FTDM_CHANNEL_EVENT = (1 << 7), - FTDM_CHANNEL_INTHREAD = (1 << 8), - FTDM_CHANNEL_WINK = (1 << 9), - FTDM_CHANNEL_FLASH = (1 << 10), - FTDM_CHANNEL_STATE_CHANGE = (1 << 11), - FTDM_CHANNEL_HOLD = (1 << 12), - FTDM_CHANNEL_INUSE = (1 << 13), - FTDM_CHANNEL_OFFHOOK = (1 << 14), - FTDM_CHANNEL_RINGING = (1 << 15), - FTDM_CHANNEL_PROGRESS_DETECT = (1 << 16), - FTDM_CHANNEL_CALLERID_DETECT = (1 << 17), - FTDM_CHANNEL_OUTBOUND = (1 << 18), - FTDM_CHANNEL_SUSPENDED = (1 << 19), - FTDM_CHANNEL_3WAY = (1 << 20), - FTDM_CHANNEL_PROGRESS = (1 << 21), - FTDM_CHANNEL_MEDIA = (1 << 22), - FTDM_CHANNEL_ANSWERED = (1 << 23), - FTDM_CHANNEL_MUTE = (1 << 24), - FTDM_CHANNEL_USE_RX_GAIN = (1 << 25), - FTDM_CHANNEL_USE_TX_GAIN = (1 << 26), - FTDM_CHANNEL_IN_ALARM = (1 << 27), - FTDM_CHANNEL_SIG_UP = (1 << 28), - FTDM_CHANNEL_USER_HANGUP = (1 << 29), - FTDM_CHANNEL_RX_DISABLED = (1 << 30), - FTDM_CHANNEL_TX_DISABLED = (1 << 31), - /* ok, when we reach 32, we need to move to uint64_t all the flag stuff */ -} ftdm_channel_flag_t; -#if defined(__cplusplus) && defined(WIN32) - // fix C2676 -__inline__ ftdm_channel_flag_t operator|=(ftdm_channel_flag_t a, int32_t b) { - a = (ftdm_channel_flag_t)(a | b); - return a; -} -__inline__ ftdm_channel_flag_t operator&=(ftdm_channel_flag_t a, int32_t b) { - a = (ftdm_channel_flag_t)(a & b); - return a; -} -#endif +/*!< Channel flags. This used to be an enum but we reached the 32bit limit for enums */ +#define FTDM_CHANNEL_CONFIGURED (1UL << 0) +#define FTDM_CHANNEL_READY (1UL << 1) +#define FTDM_CHANNEL_OPEN (1UL << 2) +#define FTDM_CHANNEL_DTMF_DETECT (1UL << 3) +#define FTDM_CHANNEL_SUPRESS_DTMF (1UL << 4) +#define FTDM_CHANNEL_TRANSCODE (1UL << 5) +#define FTDM_CHANNEL_BUFFER (1UL << 6) +#define FTDM_CHANNEL_EVENT (1UL << 7) +#define FTDM_CHANNEL_INTHREAD (1UL << 8) +#define FTDM_CHANNEL_WINK (1UL << 9) +#define FTDM_CHANNEL_FLASH (1UL << 10) +#define FTDM_CHANNEL_STATE_CHANGE (1UL << 11) +#define FTDM_CHANNEL_HOLD (1UL << 12) +#define FTDM_CHANNEL_INUSE (1UL << 13) +#define FTDM_CHANNEL_OFFHOOK (1UL << 14) +#define FTDM_CHANNEL_RINGING (1UL << 15) +#define FTDM_CHANNEL_PROGRESS_DETECT (1UL << 16) +#define FTDM_CHANNEL_CALLERID_DETECT (1UL << 17) +#define FTDM_CHANNEL_OUTBOUND (1UL << 18) +#define FTDM_CHANNEL_SUSPENDED (1UL << 19) +#define FTDM_CHANNEL_3WAY (1UL << 20) +#define FTDM_CHANNEL_PROGRESS (1UL << 21) +#define FTDM_CHANNEL_MEDIA (1UL << 22) +#define FTDM_CHANNEL_ANSWERED (1UL << 23) +#define FTDM_CHANNEL_MUTE (1UL << 24) +#define FTDM_CHANNEL_USE_RX_GAIN (1UL << 25) +#define FTDM_CHANNEL_USE_TX_GAIN (1UL << 26) +#define FTDM_CHANNEL_IN_ALARM (1UL << 27) +#define FTDM_CHANNEL_SIG_UP (1UL << 28) +#define FTDM_CHANNEL_USER_HANGUP (1UL << 29) +#define FTDM_CHANNEL_RX_DISABLED (1UL << 30) +#define FTDM_CHANNEL_TX_DISABLED (1UL << 31) +/*!< The user knows about a call in this channel */ +#define FTDM_CHANNEL_CALL_STARTED (1UL << 32) typedef enum { ZSM_NONE, commit a1a710482b8533d181bbf29eb67d2646036614ee Author: Jeff Lenk <jeff@jefflenk.com> Date: Mon Dec 20 12:15:41 2010 -0600 freetdm windows build tweaks diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.2010.vcxproj b/libs/freetdm/mod_freetdm/mod_freetdm.2010.vcxproj index 9f01a3b..ec69333 100644 --- a/libs/freetdm/mod_freetdm/mod_freetdm.2010.vcxproj +++ b/libs/freetdm/mod_freetdm/mod_freetdm.2010.vcxproj @@ -103,7 +103,7 @@ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> <Link> - <AdditionalDependencies>FreeSwitch.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>FreeSwitchCore.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalLibraryDirectories>../../../$(PlatformName)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <GenerateDebugInformation>true</GenerateDebugInformation> <ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile> @@ -127,7 +127,7 @@ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> <Link> - <AdditionalDependencies>FreeSwitch.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>FreeSwitchCore.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalLibraryDirectories>../../../$(PlatformName)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <GenerateDebugInformation>true</GenerateDebugInformation> <ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile> diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj index e3930d8..2e7fb82 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj @@ -40,11 +40,12 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories=""C:\Program Files\libsng_isdn\include";"C:\Program Files\libsng_isdn\include\sng_isdn";../../include;"C:\Program Files\Sangoma\include"" + AdditionalIncludeDirectories=""C:\Program Files\sangoma\sng_isdn\include";../../include;"C:\Program Files\Sangoma\include"" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;" MinimalRebuild="true" ExceptionHandling="0" BasicRuntimeChecks="3" + RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="false" @@ -63,7 +64,7 @@ Name="VCLinkerTool" AdditionalDependencies="freetdm.lib libsng_isdn.lib" LinkIncremental="2" - AdditionalLibraryDirectories=""$(OutDir)";"C:\Program Files\libsng_isdn\lib";"C:\Program Files\Sangoma\api\lib\x86"" + AdditionalLibraryDirectories=""$(OutDir)";"C:\Program Files\sangoma\sng_isdn\lib";"C:\Program Files\Sangoma\api\lib\x86"" GenerateDebugInformation="true" SubSystem="1" RandomizedBaseAddress="1" @@ -116,10 +117,11 @@ /> <Tool Name="VCCLCompilerTool" + AdditionalIncludeDirectories=""C:\Program Files\sangoma\sng_isdn\include";../../include;"C:\Program Files\Sangoma\include"" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;" MinimalRebuild="true" BasicRuntimeChecks="3" - RuntimeLibrary="3" + RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="false" @@ -136,7 +138,9 @@ /> <Tool Name="VCLinkerTool" + AdditionalDependencies="freetdm.lib libsng_isdn.lib" LinkIncremental="2" + AdditionalLibraryDirectories=""$(OutDir)";"C:\Program Files\sangoma\sng_isdn\lib";"C:\Program Files\Sangoma\api\lib\x86"" GenerateDebugInformation="true" SubSystem="2" OptimizeReferences="2" diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2010.vcxproj b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2010.vcxproj index b0a5178..6339fe9 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2010.vcxproj +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2010.vcxproj @@ -85,7 +85,7 @@ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>C:\Program Files\libsng_isdn\include;C:\Program Files\libsng_isdn\include\sng_isdn;../../include;C:\Program Files\Sangoma\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>C:\Program Files\sangoma\sng_isdn\include;../../include;C:\Program Files\Sangoma\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <ExceptionHandling> @@ -95,10 +95,11 @@ </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> </ClCompile> <Link> <AdditionalDependencies>freetdm.lib;libsng_isdn.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalLibraryDirectories>$(OutDir);C:\Program Files\libsng_isdn\lib;C:\Program Files\Sangoma\api\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <AdditionalLibraryDirectories>$(OutDir);C:\Program Files\sangoma\sng_isdn\lib;C:\Program Files\Sangoma\api\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <GenerateDebugInformation>true</GenerateDebugInformation> <SubSystem>Console</SubSystem> <RandomizedBaseAddress>false</RandomizedBaseAddress> @@ -110,7 +111,7 @@ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <ClCompile> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>C:\Program Files\libsng_isdn\include;C:\Program Files\libsng_isdn\include\sng_isdn;../../include;C:\Program Files\Sangoma\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>C:\Program Files\sangoma\sng_isdn\include;../../include;C:\Program Files\Sangoma\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <ExceptionHandling> </ExceptionHandling> @@ -119,6 +120,7 @@ </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> </ClCompile> <Link> <AdditionalDependencies>freetdm.lib;libsng_isdn.lib;%(AdditionalDependencies)</AdditionalDependencies> @@ -135,11 +137,13 @@ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <PrecompiledHeader> </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <AdditionalIncludeDirectories>C:\Program Files\sangoma\sng_isdn\include;../../include;C:\Program Files\Sangoma\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <Optimization>Disabled</Optimization> </ClCompile> <Link> <GenerateDebugInformation>true</GenerateDebugInformation> @@ -147,23 +151,27 @@ <OptimizeReferences>true</OptimizeReferences> <EnableCOMDATFolding>true</EnableCOMDATFolding> <TargetMachine>MachineX86</TargetMachine> + <AdditionalDependencies>freetdm.lib;libsng_isdn.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>$(OutDir);C:\Program Files\sangoma\sng_isdn\lib;C:\Program Files\Sangoma\api\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> </Link> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ClCompile> <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> - <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <PrecompiledHeader> </PrecompiledHeader> <WarningLevel>Level3</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <AdditionalIncludeDirectories>C:\Program Files\sangoma\sng_isdn\include;../../include;C:\Program Files\Sangoma\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> </ClCompile> <Link> <GenerateDebugInformation>true</GenerateDebugInformation> <SubSystem>Windows</SubSystem> <OptimizeReferences>true</OptimizeReferences> <EnableCOMDATFolding>true</EnableCOMDATFolding> + <AdditionalDependencies>freetdm.lib;libsng_isdn.lib;%(AdditionalDependencies)</AdditionalDependencies> </Link> </ItemDefinitionGroup> <ItemGroup> diff --git a/w32/Library/FreeSwitchCore.2010.vcxproj b/w32/Library/FreeSwitchCore.2010.vcxproj index e218445..c74ad94 100644 --- a/w32/Library/FreeSwitchCore.2010.vcxproj +++ b/w32/Library/FreeSwitchCore.2010.vcxproj @@ -120,8 +120,7 @@ <RandomizedBaseAddress>false</RandomizedBaseAddress> <DataExecutionPrevention> </DataExecutionPrevention> - <ImportLibrary> - </ImportLibrary> + <ImportLibrary>$(OutDir)FreeSwitchCore.lib</ImportLibrary> <TargetMachine>MachineX86</TargetMachine> <ShowProgress> </ShowProgress> commit 34690e47ff48f5c52b13cfb7b2c0226f3c0dc92e Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Dec 20 11:16:14 2010 -0600 FS-2879 diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 9d98969..e9d7cfb 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -1761,27 +1761,28 @@ static void *SWITCH_THREAD_FUNC node_thread_run(switch_thread_t *thread, void *o for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) { switch_hash_this(hi, &var, NULL, &val); if ((node = (fifo_node_t *) val)) { + int x = 0; + switch_event_t *pop; if (node->ready == FIFO_DELAY_DESTROY) { - int doit = 0; - - switch_mutex_lock(node->update_mutex); - doit = node->consumer_count == 0 && node_caller_count(node) == 0; - switch_mutex_unlock(node->update_mutex); - - if (doit) { + if (switch_thread_rwlock_trywrlock(node->rwlock) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "%s removed.\n", node->name); switch_core_hash_delete(globals.fifo_hash, node->name); + + for (x = 0; x < MAX_PRI; x++) { + while (fifo_queue_pop(node->fifo_list[x], &pop, 2) == SWITCH_STATUS_SUCCESS) { + switch_event_destroy(&pop); + } + } node->ready = 0; - switch_mutex_lock(node->mutex); switch_core_hash_destroy(&node->consumer_hash); switch_mutex_unlock(node->mutex); switch_mutex_unlock(node->update_mutex); + switch_thread_rwlock_unlock(node->rwlock); switch_core_destroy_memory_pool(&node->pool); goto restart; } - } @@ -2172,7 +2173,7 @@ SWITCH_STANDARD_APP(fifo_function) char *mydata = NULL, *argv[5] = { 0 }; fifo_node_t *node = NULL, *node_list[MAX_NODES_PER_CONSUMER + 1] = { 0 }; switch_channel_t *channel = switch_core_session_get_channel(session); - int do_wait = 1, node_count = 0, i = 0; + int do_destroy = 0, do_wait = 1, node_count = 0, i = 0; const char *moh = NULL; const char *announce = NULL; switch_event_t *event = NULL; @@ -2247,13 +2248,10 @@ SWITCH_STANDARD_APP(fifo_function) if (!(node = switch_core_hash_find(globals.fifo_hash, nlist[i]))) { node = create_node(nlist[i], importance, globals.sql_mutex); node->ready = 1; - switch_thread_rwlock_rdlock(node->rwlock); } - node_list[node_count++] = node; - } - if (switch_true(switch_channel_get_variable(channel, "fifo_destroy_after_use")) && node->ready == 1) { - node->ready = FIFO_DELAY_DESTROY; + switch_thread_rwlock_rdlock(node->rwlock); + node_list[node_count++] = node; } switch_mutex_unlock(globals.mutex); @@ -3103,9 +3101,21 @@ SWITCH_STANDARD_APP(fifo_function) done: - if (node) { + if (switch_true(switch_channel_get_variable(channel, "fifo_destroy_after_use"))) { + do_destroy = 1; + } + + switch_mutex_lock(globals.mutex); + for (i = 0; i < node_count; i++) { + if (!(node = node_list[i])) { + continue; + } switch_thread_rwlock_unlock(node->rwlock); + if (node->ready == 1 && do_destroy) { + node->ready = FIFO_DELAY_DESTROY; + } } + switch_mutex_unlock(globals.mutex); switch_channel_clear_app_flag_key(FIFO_APP_KEY, channel, FIFO_APP_BRIDGE_TAG); commit 11a7b1f9a0af11620eeda79ad0009df8bc65ee5a Merge: 87818ab f4d52d4 Author: Moises Silva <moy@sangoma.com> Date: Mon Dec 20 10:12:48 2010 -0500 Merge remote branch 'fsorig/master' commit f4d52d4caae78359b59d97bf596a269e47f4def3 Author: Brian West <brian@freeswitch.org> Date: Mon Dec 20 08:43:13 2010 -0600 FS-2943: improve fail2ban logging diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 570e297..945740e 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1139,30 +1139,24 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand } if (auth_res != AUTH_OK && !stale) { - if (sofia_test_pflag(profile, PFLAG_LOG_AUTH_FAIL)) { - if (regtype == REG_REGISTER) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SIP auth %s (REGISTER) on sofia profile '%s' " - "for [%s@%s] from ip %s\n", forbidden ? "failure" : "challenge", profile->name, to_user, to_host, network_ip); - } + if (auth_res == AUTH_FORBIDDEN) { + nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END()); + forbidden = 1; + } else { + nua_respond(nh, SIP_401_UNAUTHORIZED, NUTAG_WITH_THIS(nua), TAG_END()); } if (profile->debug) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send %s for [%s@%s]\n", forbidden ? "forbidden" : "challenge", to_user, to_host); } - if (auth_res == AUTH_FORBIDDEN) { - nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END()); - - /* Log line added to support Fail2Ban */ - if (sofia_test_pflag(profile, PFLAG_LOG_AUTH_FAIL)) { - if (regtype == REG_INVITE) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "SIP auth failure (INVITE) on sofia profile '%s' " - "for [%s@%s] from ip %s\n", profile->name, to_user, to_host, network_ip); - } - } - } else { - nua_respond(nh, SIP_401_UNAUTHORIZED, NUTAG_WITH_THIS(nua), TAG_END()); + /* Log line added to support Fail2Ban */ + if (sofia_test_pflag(profile, PFLAG_LOG_AUTH_FAIL)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "SIP auth %s (%s) on sofia profile '%s' " + "for [%s@%s] from ip %s\n", forbidden ? "failure" : "challenge", + (regtype == REG_INVITE) ? "INVITE" : "REGISTER", profile->name, to_user, to_host, network_ip); } + switch_goto_int(r, 1, end); } } @@ -1193,14 +1187,18 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand realm = from_host; } - if (regtype == REG_REGISTER) { - sofia_reg_auth_challenge(nua, profile, nh, regtype, realm, stale); - if (profile->debug) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Requesting Registration from: [%s@%s]\n", to_user, to_host); - } - } else { - sofia_reg_auth_challenge(nua, profile, nh, regtype, realm, stale); + sofia_reg_auth_challenge(nua, profile, nh, regtype, realm, stale); + + if (profile->debug) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send challenge for [%s@%s]\n", to_user, to_host); } + /* Log line added to support Fail2Ban */ + if (sofia_test_pflag(profile, PFLAG_LOG_AUTH_FAIL)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "SIP auth challenge (%s) on sofia profile '%s' " + "for [%s@%s] from ip %s\n", (regtype == REG_INVITE) ? "INVITE" : "REGISTER", + profile->name, to_user, to_host, network_ip); + } + switch_goto_int(r, 1, end); } reg: commit 9b70d9a7a565b7af2f6ee4511f687316d1ba5a48 Author: Mathieu Parent <math.parent@gmail.com> Date: Sun Dec 19 22:20:09 2010 +0100 Revert perl's Net::Skinny test diff --git a/src/mod/endpoints/mod_skinny/test-skinny.pl b/src/mod/endpoints/mod_skinny/test-skinny.pl index 02cf3cc..a44afa3 100644 --- a/src/mod/endpoints/mod_skinny/test-skinny.pl +++ b/src/mod/endpoints/mod_skinny/test-skinny.pl @@ -34,12 +34,6 @@ if(!$socket) { exit 1; } # ============================================================================= -$socket->send_raw( - XML_ALARM_MESSAGE, - "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\x0a<x-cisco-alarm>\x0a<Alarm Name=\"LastOutOfServiceInformation\">\x0a<ParameterList>\x0a<String name=\"DeviceName\">SEP002699438F62</String>\x0a<String name=\"DeviceIPv4Address\">192.168.3.201/24</String>\x0a<String name=\"IPv4DefaultGateway\">192.168.3.254</String>\x0a<String name=\"DeviceIPv6Address\"></String>\x0a<String name=\"IPv6DefaultGateway\"></String>\x0a<String name=\"ModelNumber\">CP-7961G</String>\x0a<String name=\"NeighborIPv4Address\">192.168.0.253</String>\x0a<String name=\"NeighborIPv6Address\"></String>\x0a<String name=\"NeighborDeviceID\">sw2.wvds.local</String>\x0a<String name=\"NeighborPortID\">3</String>\x0a<Enum name=\"DHCPv4Status\">1</Enum>\x0a<Enum name=\"DHCPv6Status\">0</Enum>\x0a<Enum name=\"TFTPCfgStatus\">0</Enum>\x0a<Enum name=\"DNSStatusUnifiedCM1\">0</Enum>\x0a<Enum name=\"DNSStatusUnifiedCM2\">0</Enum>\x0a<Enum name=\"DNSStatusUnifiedCM3\">0</Enum>\x0a<String name=\"VoiceVLAN\">4095</String>\x0a<String name=\"UnifiedCMIPAddress\"><not open></String>\x0a<String name=\"LocalPort\">-1</String>\x0a<String name=\"TimeStamp\">1289313813826</String>\x0a<Enum name=\"ReasonForOutOfService\"></Enum>\x0a<String name=\"LastProtocolEventSent\">1:Register</String>\x0a<String name=\"LastProtocolEventReceived\">129:RegisterAck</String>\x0a</ParameterList>\x0a</Alarm>\x0a</x-cisco-alarm>\x0a" - ); - $socket->sleep(20); - exit; $socket->send_message( REGISTER_MESSAGE, device_name => $device_name, commit 709c4e5f9729dfad0862fa2daaf2f0687d04a56f Author: Mathieu Parent <math.parent@gmail.com> Date: Sun Dec 19 22:16:09 2010 +0100 Skinny: Event skinny::xml_alarm diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.h b/src/mod/endpoints/mod_skinny/mod_skinny.h index b5cc96b..20d68fa 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.h +++ b/src/mod/endpoints/mod_skinny/mod_skinny.h @@ -42,6 +42,7 @@ #define SKINNY_EVENT_UNREGISTER "skinny::unregister" #define SKINNY_EVENT_EXPIRE "skinny::expire" #define SKINNY_EVENT_ALARM "skinny::alarm" +#define SKINNY_EVENT_XML_ALARM "skinny::xml_alarm" #define SKINNY_EVENT_CALL_STATE "skinny::call_state" #define SKINNY_EVENT_USER_TO_DEVICE "skinny::user_to_device" #define SKINNY_EVENT_DEVICE_TO_USER "skinny::device_to_user" diff --git a/src/mod/endpoints/mod_skinny/skinny_protocol.h b/src/mod/endpoints/mod_skinny/skinny_protocol.h index ee3c33a..20e7d7f 100644 --- a/src/mod/endpoints/mod_skinny/skinny_protocol.h +++ b/src/mod/endpoints/mod_skinny/skinny_protocol.h @@ -627,8 +627,7 @@ union skinny_data { struct extended_data_message extended_data; uint16_t as_uint16; - char as_char; - void *raw; + char as_char[1]; }; /* diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index 9bf9d9f..5874be4 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -1963,6 +1963,26 @@ switch_status_t skinny_handle_extended_data_message(listener_t *listener, skinny return SWITCH_STATUS_SUCCESS; } +switch_status_t skinny_handle_xml_alarm(listener_t *listener, skinny_message_t *request) +{ + switch_event_t *event = NULL; + char *tmp = NULL; + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, + "Received XML alarm.\n"); + /* skinny::xml_alarm event */ + skinny_device_event(listener, &event, SWITCH_EVENT_CUSTOM, SKINNY_EVENT_XML_ALARM); + /* Ensure that the body is null-terminated */ + tmp = malloc(request->length - 4 + 1); + memcpy(tmp, request->data.as_char, request->length - 4); + tmp[request->length - 4] = '\0'; + switch_event_add_body(event, "%s", tmp); + switch_safe_free(tmp); + switch_event_fire(&event); + + return SWITCH_STATUS_SUCCESS; +} + switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *request) { if (listener->profile->debug >= 10 || request->type != KEEP_ALIVE_MESSAGE) { @@ -2032,6 +2052,8 @@ switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *re return skinny_handle_extended_data_message(listener, request); case DEVICE_TO_USER_DATA_RESPONSE_VERSION1_MESSAGE: return skinny_handle_extended_data_message(listener, request); + case XML_ALARM_MESSAGE: + return skinny_handle_xml_alarm(listener, request); default: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unhandled request %s (type=%x,length=%d).\n", skinny_message_type2str(request->type), request->type, request->length); diff --git a/src/mod/endpoints/mod_skinny/test-skinny.pl b/src/mod/endpoints/mod_skinny/test-skinny.pl index a44afa3..02cf3cc 100644 --- a/src/mod/endpoints/mod_skinny/test-skinny.pl +++ b/src/mod/endpoints/mod_skinny/test-skinny.pl @@ -34,6 +34,12 @@ if(!$socket) { exit 1; } # ============================================================================= +$socket->send_raw( + XML_ALARM_MESSAGE, + "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\x0a<x-cisco-alarm>\x0a<Alarm Name=\"LastOutOfServiceInformation\">\x0a<ParameterList>\x0a<String name=\"DeviceName\">SEP002699438F62</String>\x0a<String name=\"DeviceIPv4Address\">192.168.3.201/24</String>\x0a<String name=\"IPv4DefaultGateway\">192.168.3.254</String>\x0a<String name=\"DeviceIPv6Address\"></String>\x0a<String name=\"IPv6DefaultGateway\"></String>\x0a<String name=\"ModelNumber\">CP-7961G</String>\x0a<String name=\"NeighborIPv4Address\">192.168.0.253</String>\x0a<String name=\"NeighborIPv6Address\"></String>\x0a<String name=\"NeighborDeviceID\">sw2.wvds.local</String>\x0a<String name=\"NeighborPortID\">3</String>\x0a<Enum name=\"DHCPv4Status\">1</Enum>\x0a<Enum name=\"DHCPv6Status\">0</Enum>\x0a<Enum name=\"TFTPCfgStatus\">0</Enum>\x0a<Enum name=\"DNSStatusUnifiedCM1\">0</Enum>\x0a<Enum name=\"DNSStatusUnifiedCM2\">0</Enum>\x0a<Enum name=\"DNSStatusUnifiedCM3\">0</Enum>\x0a<String name=\"VoiceVLAN\">4095</String>\x0a<String name=\"UnifiedCMIPAddress\"><not open></String>\x0a<String name=\"LocalPort\">-1</String>\x0a<String name=\"TimeStamp\">1289313813826</String>\x0a<Enum name=\"ReasonForOutOfService\"></Enum>\x0a<String name=\"LastProtocolEventSent\">1:Register</String>\x0a<String name=\"LastProtocolEventReceived\">129:RegisterAck</String>\x0a</ParameterList>\x0a</Alarm>\x0a</x-cisco-alarm>\x0a" + ); + $socket->sleep(20); + exit; $socket->send_message( REGISTER_MESSAGE, device_name => $device_name, commit 1c4c84fc0ffdba48fd42154e7f0e85ddbb1c5ede Author: Mathieu Parent <math.parent@gmail.com> Date: Sun Dec 19 21:38:55 2010 +0100 Perl's Net::Skinny : update to current handle PACKED structs diff --git a/src/mod/endpoints/mod_skinny/Net/Skinny/Protocol.pm b/src/mod/endpoints/mod_skinny/Net/Skinny/Protocol.pm index 90de304..9470888 100644 --- a/src/mod/endpoints/mod_skinny/Net/Skinny/Protocol.pm +++ b/src/mod/endpoints/mod_skinny/Net/Skinny/Protocol.pm @@ -48,7 +48,7 @@ sub _find { my ($name, $value) = ($1,hex($2)); $sub{$name} = sub () { $value }; $const{$name} = $value; - } elsif(/^\s*struct\s+([a-z_]+)\s*\{\s*$/) { + } elsif(/^\s*struct\s+PACKED\s+([a-z_]+)\s*\{\s*$/) { my $struct_name = $1; $struct{$struct_name} = []; while(<$fh>) { commit b84b71defa49a715d04d9776a5f0c7040103d6db Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Sun Dec 19 21:09:50 2010 +0100 FreeTDM: Stop using raw_data for FTDM_SIGEVENT_SIGSTATUS_CHANGED events. The raw_data member is used for passing heap allocated data with an event, (e.g. strings of dtmf data) the memory is freed after the event has been processed. Recent changes in the event structure added a way to pass sig status changes inline, so remove the raw_data usage for FTDM_SIGEVENT_SIGSTATUS_CHANGED events. NOTE: This (finally) fixes a bug in ftmod_libpri that was caused by the event handling changes (stack corruption due to using free() on a variable on the stack, which turned into a NULL ptr deref caused by some compat code in ftdm_io.c:ftdm_span_send_signal(). Compiles and tested on my BRI setup, i did a quick audit of all places that generate FTDM_SIGEVENT_SIGSTATUS_CHANGED events and except for the sangoma_boost module there's nothing else that left using raw_data for this event. Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 7637932..80006f1 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -2086,7 +2086,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_r2_signal) case FTDM_SIGEVENT_SIGSTATUS_CHANGED: { - ftdm_signaling_status_t sigstatus = sigmsg->raw_data ? *((ftdm_signaling_status_t*)(sigmsg->raw_data)) : sigmsg->ev_data.sigstatus.status; + ftdm_signaling_status_t sigstatus = sigmsg->ev_data.sigstatus.status; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%d:%d signalling changed to: %s\n", spanid, chanid, ftdm_signaling_status2str(sigstatus)); } diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 94a01aa..297c08e 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -5403,8 +5403,7 @@ FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t case FTDM_SIGEVENT_SIGSTATUS_CHANGED: { - ftdm_signaling_status_t sigstatus = ftdm_test_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE) ? sigmsg->ev_data.sigstatus.status : *((ftdm_signaling_status_t*)(sigmsg->raw_data)); - if (sigstatus == FTDM_SIG_STATE_UP) { + if (sigmsg->ev_data.sigstatus.status == FTDM_SIG_STATE_UP) { ftdm_set_flag(sigmsg->channel, FTDM_CHANNEL_SIG_UP); } else { ftdm_clear_flag(sigmsg->channel, FTDM_CHANNEL_SIG_UP); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c index f59b3b8..97e242d 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c @@ -2478,7 +2478,7 @@ static BOOST_SIG_STATUS_CB_FUNCTION(ftdm_boost_sig_status_change) sig.span_id = ftdmchan->span_id; sig.channel = ftdmchan; sig.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sig.raw_data = &status; + sig.ev_data.sigstatus.status = status; ftdm_span_send_signal(ftdmchan->span, &sig); return; } commit 299c139c3ec6c9b276cefce4d6f1568d0d7100dc Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Sun Dec 19 13:40:27 2010 -0600 skypopen: refined hrtimers support to OSS audio driver diff --git a/src/mod/endpoints/mod_skypopen/oss/main.c b/src/mod/endpoints/mod_skypopen/oss/main.c index 2abc5b3..a96e38d 100644 --- a/src/mod/endpoints/mod_skypopen/oss/main.c +++ b/src/mod/endpoints/mod_skypopen/oss/main.c @@ -250,6 +250,10 @@ static ssize_t skypopen_read(struct file *filp, char __user *buf, size_t count, { DEFINE_WAIT(wait); struct skypopen_dev *dev = filp->private_data; + + if(unload) + return -1; + #ifdef WANT_HRTIMER #if 1 if(dev->timer_inq_started == 0){ @@ -278,6 +282,10 @@ static ssize_t skypopen_write(struct file *filp, const char __user *buf, size_t { DEFINE_WAIT(wait); struct skypopen_dev *dev = filp->private_data; + + if(unload) + return -1; + #ifdef WANT_HRTIMER #if 1 if(dev->timer_outq_started == 0){ @@ -372,10 +380,14 @@ void skypopen_cleanup_module(void) ret= del_timer( &lptr->device.timer_outq ); printk( "Stopped skypopen OSS driver write timer\n"); #else// WANT_HRTIMER - ret = hrtimer_cancel( &lptr->device.timer_inq ); - printk( "Stopped skypopen OSS driver read HRtimer\n"); - ret = hrtimer_cancel( &lptr->device.timer_outq ); - printk( "Stopped skypopen OSS driver write HRtimer\n"); + if(lptr->device.timer_inq_started){ + ret = hrtimer_cancel( &lptr->device.timer_inq ); + printk( "Stopped skypopen OSS driver read HRtimer\n"); + } + if(lptr->device.timer_outq_started){ + ret = hrtimer_cancel( &lptr->device.timer_outq ); + printk( "Stopped skypopen OSS driver write HRtimer\n"); + } #endif// WANT_HRTIMER list_del(&lptr->list); commit dd4bad220ca1f4ddcacfe69e720e7d32b744b6f9 Author: Moises Silva <moy@sangoma.com> Date: Sun Dec 19 12:55:55 2010 -0500 freetdm: ftmod_libpri - update to use proper structure member for signaling status change notifications diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 8cbc0f4..1d3c76d 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -1397,8 +1397,7 @@ static int on_dchan_up(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ev sig.chan_id = ftdm_channel_get_id(chan); sig.channel = chan; sig.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sig.raw_data = &status; - + sig.ev_data.sigstatus.status = status; ftdm_span_send_signal(span, &sig); } } @@ -1434,7 +1433,7 @@ static int on_dchan_down(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ sig.chan_id = ftdm_channel_get_id(chan); sig.channel = chan; sig.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sig.raw_data = &status; + sig.ev_data.sigstatus.status = status; ftdm_span_send_signal(span, &sig); } diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 69b90f1..a74fd70 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -438,7 +438,7 @@ struct ftdm_sigmsg { union { ftdm_event_sigstatus_t sigstatus; /*!< valid if event_id is FTDM_SIGEVENT_SIGSTATUS_CHANGED */ ftdm_event_trace_t logevent; /*!< valid if event_id is FTDM_SIGEVENT_TRACE or FTDM_SIGEVENT_TRACE_RAW */ - }ev_data; + } ev_data; }; /*! \brief Crash policy commit fcd6c54162a6270554de3b037c03398d7655732c Author: Moises Silva <moy@sangoma.com> Date: Sun Dec 19 00:13:08 2010 -0500 freetdm: fix attempt for OPENZAP-130 diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c b/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c index fbe6ca0..bfb67e4 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c @@ -127,9 +127,8 @@ static int __pri_lpwrap_read(struct pri *pri, void *buf, int buflen) } else { ftdm_log(FTDM_LOG_CRIT, "span %d D-READ TIMEOUT\n", spri->span->span_id); } - - ftdm_clear_flag(spri, LPWRAP_PRI_READY); - return -1; + /* we cannot return -1, libpri seems to expect values >= 0 */ + return 0; } spri->errs = 0; res = (int)len; @@ -156,8 +155,8 @@ static int __pri_lpwrap_write(struct pri *pri, void *buf, int buflen) if (ftdm_channel_write(spri->dchan, buf, buflen, &len) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_CRIT, "span %d D-WRITE FAIL! [%s]\n", spri->span->span_id, spri->dchan->last_error); - ftdm_clear_flag(spri, LPWRAP_PRI_READY); - return -1; + /* we cannot return -1, libpri seems to expect values >= 0 */ + return 0; } #ifdef IODEBUG diff --git a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c index 09208f8..b16ead7 100644 --- a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c +++ b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c @@ -1152,6 +1152,7 @@ static FIO_WRITE_FUNCTION(zt_write) bytes += 2; } +tryagain: w = write(ftdmchan->sockfd, data, bytes); if (w >= 0) { @@ -1159,6 +1160,17 @@ static FIO_WRITE_FUNCTION(zt_write) return FTDM_SUCCESS; } + if (errno == ELAST) { + zt_event_t zt_event_id = 0; + if (ioctl(ftdmchan->sockfd, codes.GETEVENT, &zt_event_id) == -1) { + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed retrieving event after ELAST on write: %s\n", strerror(errno)); + return FTDM_FAIL; + } + /* we should enqueue this event somewhere so it can be retrieved by the user, for now, dropping it to see what it is! */ + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Dropping event %d to be able to write data\n", zt_event_id); + goto tryagain; + } + return FTDM_FAIL; } commit 1f26f2f86ad63865a13df010cc3c62e34a2d6d55 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Dec 17 22:29:33 2010 -0600 presence is a 4-letter word diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 5d666f0..f0cade3 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -818,7 +818,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_dialog_callback, &dh); switch_safe_free(sql); - if ((sql = switch_mprintf("select sip_subscriptions.proto,sip_subscriptions.sip_user,sip_subscriptions.sip_host," + if ((sql = switch_mprintf("select distinct sip_subscriptions.proto,sip_subscriptions.sip_user,sip_subscriptions.sip_host," "sip_subscriptions.sub_to_user,sip_subscriptions.sub_to_host,sip_subscriptions.event," "sip_subscriptions.contact,sip_subscriptions.call_id,sip_subscriptions.full_from," "sip_subscriptions.full_via,sip_subscriptions.expires,sip_subscriptions.user_agent," commit 282b156207ccae94c8d80efec72c106cf7e3b4f2 Author: Jeff Lenk <jeff@jefflenk.com> Date: Fri Dec 17 21:25:45 2010 -0600 windows tweak mod_say_pt add to vs2010 others not for now diff --git a/Freeswitch.2010.sln b/Freeswitch.2010.sln index 1869698..edee701 100644 --- a/Freeswitch.2010.sln +++ b/Freeswitch.2010.sln @@ -707,6 +707,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_distributor", "src\mod\ EndProject Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "Setup", "w32\Setup\Setup.wixproj", "{47213370-B933-487D-9F45-BCA26D7E2B6F}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_say_pt", "src\mod\say\mod_say_pt\mod_say_pt.2010.vcxproj", "{7C22BDFF-CC09-400C-8A09-660733980028}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -3619,6 +3621,23 @@ Global {47213370-B933-487D-9F45-BCA26D7E2B6F}.Release|x64 Setup.Build.0 = Release|x64 {47213370-B933-487D-9F45-BCA26D7E2B6F}.Release|x86 Setup.ActiveCfg = Release|x86 {47213370-B933-487D-9F45-BCA26D7E2B6F}.Release|x86 Setup.Build.0 = Release|x86 + {7C22BDFF-CC09-400C-8A09-660733980028}.All|Win32.ActiveCfg = Release|x64 + {7C22BDFF-CC09-400C-8A09-660733980028}.All|x64.ActiveCfg = Release|x64 + {7C22BDFF-CC09-400C-8A09-660733980028}.All|x64.Build.0 = Release|x64 + {7C22BDFF-CC09-400C-8A09-660733980028}.All|x64 Setup.ActiveCfg = Release|x64 + {7C22BDFF-CC09-400C-8A09-660733980028}.All|x86 Setup.ActiveCfg = Release|x64 + {7C22BDFF-CC09-400C-8A09-660733980028}.Debug|Win32.ActiveCfg = Debug|Win32 + {7C22BDFF-CC09-400C-8A09-660733980028}.Debug|Win32.Build.0 = Debug|Win32 + {7C22BDFF-CC09-400C-8A09-660733980028}.Debug|x64.ActiveCfg = Debug|x64 + {7C22BDFF-CC09-400C-8A09-660733980028}.Debug|x64.Build.0 = Debug|x64 + {7C22BDFF-CC09-400C-8A09-660733980028}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {7C22BDFF-CC09-400C-8A09-660733980028}.Debug|x86 Setup.ActiveCfg = Debug|x64 + {7C22BDFF-CC09-400C-8A09-660733980028}.Release|Win32.ActiveCfg = Release|Win32 + {7C22BDFF-CC09-400C-8A09-660733980028}.Release|Win32.Build.0 = Release|Win32 + {7C22BDFF-CC09-400C-8A09-660733980028}.Release|x64.ActiveCfg = Release|x64 + {7C22BDFF-CC09-400C-8A09-660733980028}.Release|x64.Build.0 = Release|x64 + {7C22BDFF-CC09-400C-8A09-660733980028}.Release|x64 Setup.ActiveCfg = Release|x64 + {7C22BDFF-CC09-400C-8A09-660733980028}.Release|x86 Setup.ActiveCfg = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -3769,6 +3788,7 @@ Global {A4B122CF-5196-476B-8C0E-D8BD59AC3C14} = {6CD61A1D-797C-470A-BE08-8C31B68BB336} {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E} = {6CD61A1D-797C-470A-BE08-8C31B68BB336} {0382E8FD-CFDC-41C0-8B03-792C7C84FC31} = {6CD61A1D-797C-470A-BE08-8C31B68BB336} + {7C22BDFF-CC09-400C-8A09-660733980028} = {6CD61A1D-797C-470A-BE08-8C31B68BB336} {3B08FEFD-4D3D-4C16-BA94-EE83509E32A0} = {57D119DC-484F-420F-B9E9-8589FD9A8DF8} {7BFD517E-7F8F-4A40-A78E-8D3632738227} = {57D119DC-484F-420F-B9E9-8589FD9A8DF8} {6374D55C-FABE-4A02-9CF1-4145308A56C5} = {57D119DC-484F-420F-B9E9-8589FD9A8DF8} diff --git a/src/mod/say/mod_say_pt/mod_say_pt.2008.vcproj b/src/mod/say/mod_say_pt/mod_say_pt.2008.vcproj index bf8c033..ee0fffd 100644 --- a/src/mod/say/mod_say_pt/mod_say_pt.2008.vcproj +++ b/src/mod/say/mod_say_pt/mod_say_pt.2008.vcproj @@ -3,7 +3,7 @@ ProjectType="Visual C++" Version="9.00" Name="mod_say_pt" - ProjectGUID="{FA429E98-8B03-45E6-A096-A4BC5E821DE4}" + ProjectGUID="{7C22BDFF-CC09-400C-8A09-660733980028}" RootNamespace="mod_say_pt" Keyword="Win32Proj" TargetFrameworkVersion="131072" diff --git a/src/mod/say/mod_say_pt/mod_say_pt.2010.vcxproj b/src/mod/say/mod_say_pt/mod_say_pt.2010.vcxproj index 63fba6f..8c94e2c 100644 --- a/src/mod/say/mod_say_pt/mod_say_pt.2010.vcxproj +++ b/src/mod/say/mod_say_pt/mod_say_pt.2010.vcxproj @@ -20,7 +20,7 @@ </ItemGroup> <PropertyGroup Label="Globals"> <ProjectName>mod_say_pt</ProjectName> - <ProjectGuid>{FA429E98-8B03-45E6-A096-A4BC5E821DE4}</ProjectGuid> + <ProjectGuid>{7C22BDFF-CC09-400C-8A09-660733980028}</ProjectGuid> <RootNamespace>mod_say_pt</RootNamespace> <Keyword>Win32Proj</Keyword> </PropertyGroup> diff --git a/src/mod/say/mod_say_pt/mod_say_pt.vcproj b/src/mod/say/mod_say_pt/mod_say_pt.vcproj index fb5d2db..ce2a334 100644 --- a/src/mod/say/mod_say_pt/mod_say_pt.vcproj +++ b/src/mod/say/mod_say_pt/mod_say_pt.vcproj @@ -3,7 +3,7 @@ ProjectType="Visual C++" Version="8.00" Name="mod_say_pt" - ProjectGUID="{FA429E98-8B03-45E6-A096-A4BC5E821DE4}" + ProjectGUID="{7C22BDFF-CC09-400C-8A09-660733980028}" RootNamespace="mod_say_pt" Keyword="Win32Proj" > diff --git a/w32/Setup/Setup.wixproj b/w32/Setup/Setup.wixproj index fa6c832..f97000b 100644 --- a/w32/Setup/Setup.wixproj +++ b/w32/Setup/Setup.wixproj @@ -723,6 +723,15 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> + <ProjectReference Include="..\..\src\mod\say\mod_say_pt\mod_say_pt.2010.vcxproj"> + <Name>mod_say_pt</Name> + <Project>{7c22bdff-cc09-400c-8a09-660733980028}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> <ProjectReference Include="..\..\src\mod\say\mod_say_ru\mod_say_ru.2010.vcxproj"> <Name>mod_say_ru</Name> <Project>{0382e8fd-cfdc-41c0-8b03-792c7c84fc31}</Project> commit 87818abeddf0bf47c32392ce0806965536a0f8dc Merge: 9fd1c71 6fe7627 Author: Moises Silva <moy@sangoma.com> Date: Fri Dec 17 20:31:15 2010 -0500 Merge remote branch 'fsorig/master' commit 6fe762727acf216682470927a84023fbc559f0f7 Merge: 2b0bba8 6066993 Author: Moises Silva <moy@sangoma.com> Date: Fri Dec 17 20:28:32 2010 -0500 Merge branch 'master' of git.freeswitch.org:freeswitch commit 2b0bba8e94fd352904e5bc46c802488aa1d538ce Author: Moises Silva <moy@sangoma.com> Date: Fri Dec 17 20:27:37 2010 -0500 freetdm: add __USE_BSD to ftdm_os, needed by unistd.h for usleep() and string.h to define strcasecmp() add -Werror even when the compiler is unknown. This is just a work-around to gcc not being detected as GNU by our current standalone build (not bootstrapped through FreeSWITCH) diff --git a/libs/freetdm/Makefile.am b/libs/freetdm/Makefile.am index af26f7f..5e804b7 100644 --- a/libs/freetdm/Makefile.am +++ b/libs/freetdm/Makefile.am @@ -49,6 +49,7 @@ if HAVE_SNG_ISDN INCS += -I/usr/include/sng_isdn endif +# we needed to separate CFLAGS in FTDM_COMPAT_CFLAGS and FTDM_CFLAGS due to -c99 which causes problems with wanpipe headers FTDM_COMPAT_CFLAGS = $(INCS) -DFTDM_CONFIG_DIR=\"@confdir@\" -DFTDM_MOD_DIR=\"$(moddir)\" @COMP_VENDOR_COMPAT_CFLAGS@ @DEFS@ FTDM_CFLAGS = $(INCS) -DFTDM_CONFIG_DIR=\"@confdir@\" -DFTDM_MOD_DIR=\"$(moddir)\" @COMP_VENDOR_CFLAGS@ @DEFS@ COMPILE = $(CC) $(FTDM_CFLAGS) @@ -183,8 +184,8 @@ ftmod_analog_em_la_LIBADD = libfreetdm.la if HAVE_LIBSANGOMA mod_LTLIBRARIES += ftmod_wanpipe.la ftmod_wanpipe_la_SOURCES = $(SRC)/ftmod/ftmod_wanpipe/ftmod_wanpipe.c -#some structures within Wanpipe drivers are not c99 compatible, so we need to compile ftmod_wanpipe -#without c99 flags +# some structures within Wanpipe drivers are not c99 compatible, so we need to compile ftmod_wanpipe +# without c99 flags, use FTDM_COMPAT_CFLAGS instead ftmod_wanpipe_la_CFLAGS = $(AM_CFLAGS) $(FTDM_COMPAT_CFLAGS) -D__LINUX__ -I/usr/include/wanpipe ftmod_wanpipe_la_LDFLAGS = -shared -module -avoid-version -lsangoma ftmod_wanpipe_la_LIBADD = libfreetdm.la diff --git a/libs/freetdm/configure.ac b/libs/freetdm/configure.ac index 592dfd8..e26f10b 100644 --- a/libs/freetdm/configure.ac +++ b/libs/freetdm/configure.ac @@ -82,7 +82,7 @@ sun) fi ;; *) - COMP_VENDOR_COMPAT_CFLAGS="-Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes" + COMP_VENDOR_COMPAT_CFLAGS="-Wall -Werror -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes" COMP_VENDOR_CFLAGS="-std=c99 $COMP_VENDOR_COMPAT_CFLAGS" ;; esac diff --git a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c index f401964..09208f8 100644 --- a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c +++ b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c @@ -31,7 +31,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include "private/ftdm_core.h" #include "ftmod_zt.h" diff --git a/libs/freetdm/src/include/ftdm_os.h b/libs/freetdm/src/include/ftdm_os.h index 5026bb7..f3ebee9 100644 --- a/libs/freetdm/src/include/ftdm_os.h +++ b/libs/freetdm/src/include/ftdm_os.h @@ -39,9 +39,12 @@ extern "C" { #endif +#if defined(__linux__) && !defined(__USE_BSD) +#define __USE_BSD +#endif + #include "ftdm_declare.h" #include "ftdm_threadmutex.h" - #include <string.h> #ifndef __WINDOWS__ diff --git a/libs/freetdm/src/testsangomaboost.c b/libs/freetdm/src/testsangomaboost.c index b254a08..b007fc1 100644 --- a/libs/freetdm/src/testsangomaboost.c +++ b/libs/freetdm/src/testsangomaboost.c @@ -48,12 +48,7 @@ #include <stdlib.h> #include <string.h> #include <errno.h> -#if defined(__linux__) && !defined(__USE_BSD) -#define __USE_BSD -#endif -#ifndef WIN32 -#include <unistd.h> -#endif + #include "freetdm.h" commit 6066993d21568fa60b5319943f58931767513d99 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Sat Dec 18 02:24:28 2010 +0100 ftmod_libpri: remove ftdm_channel_done(), only use ftdm_channel_close(). Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 68f0e9e..8cbc0f4 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -515,23 +515,17 @@ static __inline__ void state_advance(ftdm_channel_t *chan) switch (ftdm_channel_get_state(chan)) { case FTDM_CHANNEL_STATE_DOWN: { + ftdm_channel_t *chtmp = chan; chan->call_data = NULL; - ftdm_channel_done(chan); - /* - * Close channel completely, BRI PTMP will thank us - */ - if (ftdm_test_flag(chan, FTDM_CHANNEL_OPEN)) { - ftdm_channel_t *chtmp = chan; - if (ftdm_channel_close(&chtmp) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_WARNING, "-- Failed to close channel %d:%d\n", - ftdm_channel_get_span_id(chan), - ftdm_channel_get_id(chan)); - } else { - ftdm_log(FTDM_LOG_DEBUG, "-- Closed channel %d:%d\n", - ftdm_channel_get_span_id(chan), - ftdm_channel_get_id(chan)); - } + if (ftdm_channel_close(&chtmp) != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_WARNING, "-- Failed to close channel %d:%d\n", + ftdm_channel_get_span_id(chan), + ftdm_channel_get_id(chan)); + } else { + ftdm_log(FTDM_LOG_DEBUG, "-- Closed channel %d:%d\n", + ftdm_channel_get_span_id(chan), + ftdm_channel_get_id(chan)); } } break; commit aa69927b8fec99064da113bd6181dd38e82e0d46 Author: Moises Silva <moy@sangoma.com> Date: Fri Dec 17 20:04:30 2010 -0500 freetdm: OPENZAP-124 - Add round robin hunting direction (Patched by Ric) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 0615b38..7637932 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1136,6 +1136,10 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi direction = FTDM_BOTTOM_UP; } else if (*argv[1] == 'a') { direction = FTDM_TOP_DOWN; + } else if (*argv[1] == 'r') { + direction = FTDM_RR_DOWN; + } else if (*argv[1] == 'R') { + direction = FTDM_RR_UP; } else { chan_id = atoi(argv[1]); } diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 36b7632..94a01aa 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -1706,6 +1706,21 @@ static ftdm_status_t __inline__ get_best_rated(ftdm_channel_t **fchan, ftdm_chan return FTDM_SUCCESS; } +static uint32_t __inline__ rr_next(uint32_t last, uint32_t min, uint32_t max, ftdm_direction_t direction) +{ + uint32_t next = min; + + ftdm_log(FTDM_LOG_DEBUG, "last = %d, min = %d, max = %d\n", last, min, max); + + if (direction == FTDM_RR_DOWN) { + next = (last >= max) ? min : ++last; + } else { + next = (last <= min) ? max : --last; + } + return next; +} + + FT_DECLARE(int) ftdm_channel_get_availability(ftdm_channel_t *ftdmchan) { int availability = -1; @@ -1748,6 +1763,8 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_group(uint32_t group_id, ftdm_dir if (direction == FTDM_TOP_DOWN) { i = 0; + } else if (direction == FTDM_RR_DOWN || direction == FTDM_RR_UP) { + i = rr_next(group->last_used_index, 0, group->chan_count - 1, direction); } else { i = group->chan_count-1; } @@ -1762,16 +1779,24 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_group(uint32_t group_id, ftdm_dir if (request_voice_channel(check, ftdmchan, caller_data, direction)) { status = FTDM_SUCCESS; + if (direction == FTDM_RR_UP || direction == FTDM_RR_DOWN) { + group->last_used_index = i; + } break; } calculate_best_rate(check, &best_rated, &best_rate); if (direction == FTDM_TOP_DOWN) { - if (i >= group->chan_count) { + if (i >= (group->chan_count - 1)) { break; } i++; + } else if (direction == FTDM_RR_DOWN || direction == FTDM_RR_UP) { + if (check == best_rated) { + group->last_used_index = i; + } + i = rr_next(i, 0, group->chan_count - 1, direction); } else { if (i == 0) { break; @@ -1850,6 +1875,8 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_span(uint32_t span_id, ftdm_direc if (direction == FTDM_TOP_DOWN) { i = 1; + } else if (direction == FTDM_RR_DOWN || direction == FTDM_RR_UP) { + i = rr_next(span->last_used_index, 1, span->chan_count, direction); } else { i = span->chan_count; } @@ -1860,6 +1887,10 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_span(uint32_t span_id, ftdm_direc if (i > span->chan_count) { break; } + } else if (direction == FTDM_RR_DOWN || direction == FTDM_RR_UP) { + if (i == span->last_used_index) { + break; + } } else { if (i == 0) { break; @@ -1873,6 +1904,9 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_span(uint32_t span_id, ftdm_direc if (request_voice_channel(check, ftdmchan, caller_data, direction)) { status = FTDM_SUCCESS; + if (direction == FTDM_RR_UP || direction == FTDM_RR_DOWN) { + span->last_used_index = i; + } break; } @@ -1880,6 +1914,11 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_span(uint32_t span_id, ftdm_direc if (direction == FTDM_TOP_DOWN) { i++; + } else if (direction == FTDM_RR_DOWN || direction == FTDM_RR_UP) { + if (check == best_rated) { + span->last_used_index = i; + } + i = rr_next(i, 1, span->chan_count, direction); } else { i--; } diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index dce130f..69b90f1 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -144,7 +144,9 @@ typedef enum { /*! \brief Hunting direction (when hunting for free channels) */ typedef enum { FTDM_TOP_DOWN, - FTDM_BOTTOM_UP + FTDM_BOTTOM_UP, + FTDM_RR_DOWN, + FTDM_RR_UP, } ftdm_direction_t; /*! \brief I/O channel type */ diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index 9222da3..e8ee715 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -493,6 +493,7 @@ struct ftdm_span { ftdm_trunk_type_t trunk_type; ftdm_analog_start_type_t start_type; ftdm_signal_type_t signal_type; + uint32_t last_used_index; /* Private signaling data. Do not touch unless you are a signaling module */ void *signal_data; fio_signal_cb_t signal_cb; commit a1a50c87ece4c26a389a8a879a04d4616a2c9e0f Author: Moises Silva <moy@sangoma.com> Date: Fri Dec 17 19:33:43 2010 -0500 freetdm: OPENZAP-123 - Restrict ANI presentation in ftmod_r2 (Patched by ric) diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index efd58b0..9a5a2b1 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -33,6 +33,7 @@ * Contributors: * * Arnaldo Pereira <arnaldo@sangoma.com> + * Ricardo Barroetaveña <rbarroetavena@anura.com.ar> * */ @@ -471,7 +472,7 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(r2_outgoing_call) } callstatus = openr2_chan_make_call(R2CALL(ftdmchan)->r2chan, - ftdmchan->caller_data.cid_num.digits, + ftdmchan->caller_data.pres == FTDM_PRES_ALLOWED ? ftdmchan->caller_data.cid_num.digits : NULL, ftdmchan->caller_data.dnis.digits, category); commit 57e1c4a8e89fb3abdac3ce523b384a79f91275a2 Merge: d349290 a5fa887 Author: Moises Silva <moy@sangoma.com> Date: Fri Dec 17 19:29:42 2010 -0500 Merge branch 'master' of git.freeswitch.org:freeswitch commit d349290f7b3f61e87bf47a683bffe9b056bd89f4 Author: Moises Silva <moy@sangoma.com> Date: Fri Dec 17 19:26:43 2010 -0500 freetdm: fix OPENZAP-125 (Add basic calling party category support into ftmod_r2) (Patched by ric) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index c459a57..0615b38 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1278,6 +1278,10 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi caller_data.dnis.type = outbound_profile->destination_number_ton; } + if ((var = channel_get_variable(session, var_event, "freetdm_calling_party_category"))) { + ftdm_set_calling_party_category(var, (uint8_t *)&caller_data.cpc); + } + if ((var = channel_get_variable(session, var_event, "freetdm_custom_call_data"))) { ftdm_set_string(caller_data.raw_data, var); caller_data.raw_data_len = (uint32_t)strlen(var); diff --git a/libs/freetdm/src/ftdm_call_utils.c b/libs/freetdm/src/ftdm_call_utils.c index 69f2fb4..2b72f05 100644 --- a/libs/freetdm/src/ftdm_call_utils.c +++ b/libs/freetdm/src/ftdm_call_utils.c @@ -30,6 +30,12 @@ * 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. + * + * Contributors: + * + * Moises Silva <moy@sangoma.com> + * Ricardo Barroetaveña <rbarroetavena@anura.com.ar> + * */ #include "private/ftdm_core.h" @@ -144,3 +150,20 @@ FT_DECLARE(ftdm_status_t) ftdm_is_number(const char *number) return FTDM_SUCCESS; } + +FT_DECLARE(ftdm_status_t) ftdm_set_calling_party_category(const char *string, uint8_t *target) +{ + uint8_t val; + ftdm_status_t status = FTDM_SUCCESS; + + val = ftdm_str2ftdm_calling_party_category(string); + if (val == FTDM_CPC_INVALID) { + ftdm_log(FTDM_LOG_WARNING, "Invalid category string (%s)\n", string); + val = FTDM_CPC_ORDINARY; + status = FTDM_FAIL; + } + + *target = val; + return status; +} + diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 1750d6d..36b7632 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -301,6 +301,9 @@ FTDM_STR2ENUM(ftdm_str2ftdm_bearer_cap, ftdm_bearer_cap2str, ftdm_bearer_cap_t, FTDM_ENUM_NAMES(USER_LAYER1_PROT_NAMES, USER_LAYER1_PROT_STRINGS) FTDM_STR2ENUM(ftdm_str2ftdm_usr_layer1_prot, ftdm_user_layer1_prot2str, ftdm_user_layer1_prot_t, USER_LAYER1_PROT_NAMES, FTDM_USER_LAYER1_PROT_INVALID) +FTDM_ENUM_NAMES(CALLING_PARTY_CATEGORY_NAMES, CALLING_PARTY_CATEGORY_STRINGS) +FTDM_STR2ENUM(ftdm_str2ftdm_calling_party_category, ftdm_calling_party_category2str, ftdm_calling_party_category_t, CALLING_PARTY_CATEGORY_NAMES, FTDM_CPC_INVALID) + static ftdm_status_t ftdm_group_add_channels(ftdm_span_t* span, int currindex, const char* name); static const char *cut_path(const char *in) diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 14eca42..efd58b0 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -380,11 +380,72 @@ static void ft_r2_answer_call(ftdm_channel_t *ftdmchan) R2CALL(ftdmchan)->answer_pending = 0; } +static __inline__ ftdm_calling_party_category_t ftdm_openr2_cpc_to_r2_ftdm_cpc(openr2_calling_party_category_t cpc) +{ + switch (cpc) { + case OR2_CALLING_PARTY_CATEGORY_UNKNOWN: + return FTDM_CPC_UNKNOWN; + + case OR2_CALLING_PARTY_CATEGORY_NATIONAL_SUBSCRIBER: + return FTDM_CPC_ORDINARY; + + case OR2_CALLING_PARTY_CATEGORY_NATIONAL_PRIORITY_SUBSCRIBER: + return FTDM_CPC_PRIORITY; + + case OR2_CALLING_PARTY_CATEGORY_INTERNATIONAL_SUBSCRIBER: + return FTDM_CPC_UNKNOWN; + + case OR2_CALLING_PARTY_CATEGORY_INTERNATIONAL_PRIORITY_SUBSCRIBER: + return FTDM_CPC_UNKNOWN; + + case OR2_CALLING_PARTY_CATEGORY_TEST_EQUIPMENT: + return FTDM_CPC_TEST; + + case OR2_CALLING_PARTY_CATEGORY_PAY_PHONE: + return FTDM_CPC_PAYPHONE; + + case OR2_CALLING_PARTY_CATEGORY_COLLECT_CALL: + return FTDM_CPC_OPERATOR; + } + return FTDM_CPC_INVALID; +} + +static __inline openr2_calling_party_category_t ftdm_r2_ftdm_cpc_to_openr2_cpc(ftdm_calling_party_category_t cpc) +{ + switch (cpc) { + case FTDM_CPC_UNKNOWN: + return OR2_CALLING_PARTY_CATEGORY_UNKNOWN; + + case FTDM_CPC_OPERATOR: + return OR2_CALLING_PARTY_CATEGORY_COLLECT_CALL; + + case FTDM_CPC_ORDINARY: + return OR2_CALLING_PARTY_CATEGORY_NATIONAL_SUBSCRIBER; + + case FTDM_CPC_PRIORITY: + return OR2_CALLING_PARTY_CATEGORY_NATIONAL_PRIORITY_SUBSCRIBER; + + case FTDM_CPC_DATA: + return OR2_CALLING_PARTY_CATEGORY_UNKNOWN; + + case FTDM_CPC_TEST: + return OR2_CALLING_PARTY_CATEGORY_TEST_EQUIPMENT; + + case FTDM_CPC_PAYPHONE: + return OR2_CALLING_PARTY_CATEGORY_PAY_PHONE; + + case FTDM_CPC_INVALID: + return OR2_CALLING_PARTY_CATEGORY_UNKNOWN; + } + return OR2_CALLING_PARTY_CATEGORY_UNKNOWN; +} + /* this function must be called with the chan mutex held! */ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(r2_outgoing_call) { openr2_call_status_t callstatus; ftdm_r2_data_t *r2data; + openr2_calling_party_category_t category = OR2_CALLING_PARTY_CATEGORY_NATIONAL_SUBSCRIBER; r2data = ftdmchan->span->signal_data; @@ -397,6 +458,12 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(r2_outgoing_call) ft_r2_clean_call(ftdmchan->call_data); + if (ftdmchan->caller_data.cpc == FTDM_CPC_INVALID || ftdmchan->caller_data.cpc == FTDM_CPC_UNKNOWN) { + category = r2data->category; + } else { + category = ftdm_r2_ftdm_cpc_to_openr2_cpc(ftdmchan->caller_data.cpc); + } + /* start io dump */ if (r2data->mf_dump_size) { ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_INPUT_DUMP, &r2data->mf_dump_size); @@ -406,7 +473,7 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(r2_outgoing_call) callstatus = openr2_chan_make_call(R2CALL(ftdmchan)->r2chan, ftdmchan->caller_data.cid_num.digits, ftdmchan->caller_data.dnis.digits, - r2data->category); + category); if (callstatus) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Failed to make call in R2 channel, openr2_chan_make_call failed\n"); @@ -615,6 +682,7 @@ static void ftdm_r2_on_call_offered(openr2_chan_t *r2chan, const char *ani, cons } else { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); } + ftdmchan->caller_data.cpc = ftdm_openr2_cpc_to_r2_ftdm_cpc(category); } /* diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 56a9dc0..dce130f 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -265,6 +265,21 @@ typedef enum { #define USER_LAYER1_PROT_STRINGS "V.110", "u-law", "a-law", "Invalid" FTDM_STR2ENUM_P(ftdm_str2ftdm_usr_layer1_prot, ftdm_user_layer1_prot2str, ftdm_user_layer1_prot_t) +/*! Calling Party Category */ +typedef enum { + FTDM_CPC_UNKNOWN, + FTDM_CPC_OPERATOR, + FTDM_CPC_ORDINARY, + FTDM_CPC_PRIORITY, + FTDM_CPC_DATA, + FTDM_CPC_TEST, + FTDM_CPC_PAYPHONE, + FTDM_CPC_INVALID +} ftdm_calling_party_category_t; +#define CALLING_PARTY_CATEGORY_STRINGS "unknown", "operator", "ordinary", "priority", "data-call", "test-call", "payphone", "invalid" +FTDM_STR2ENUM_P(ftdm_str2ftdm_calling_party_category, ftdm_calling_party_category2str, ftdm_calling_party_category_t) + + /*! \brief Number abstraction */ typedef struct { char digits[25]; @@ -294,7 +309,8 @@ typedef struct ftdm_caller_data { ftdm_bearer_cap_t bearer_capability; /* user information layer 1 protocol */ ftdm_user_layer1_prot_t bearer_layer1; - ftdm_variable_container_t variables; /*!<variables attached to this call */ + ftdm_calling_party_category_t cpc; /*!< Calling party category */ + ftdm_variable_container_t variables; /*!< Variables attached to this call */ /* We need call_id inside caller_data for the user to be able to retrieve * the call_id when ftdm_channel_call_place is called. This is the only time * that the user can use caller_data.call_id to obtain the call_id. The user diff --git a/libs/freetdm/src/include/ftdm_call_utils.h b/libs/freetdm/src/include/ftdm_call_utils.h index 835a5c6..2418273 100644 --- a/libs/freetdm/src/include/ftdm_call_utils.h +++ b/libs/freetdm/src/include/ftdm_call_utils.h @@ -30,6 +30,12 @@ * 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. + * + * Contributors: + * + * Moises Silva <moy@sangoma.com> + * Ricardo Barroetaveña <rbarroetavena@anura.com.ar> + * */ #ifndef __FTDM_CALL_UTILS_H__ @@ -114,5 +120,16 @@ FT_DECLARE(ftdm_status_t) ftdm_set_presentation_ind(const char *string, uint8_t */ FT_DECLARE(ftdm_status_t) ftdm_is_number(const char *number); +/*! + * \brief Set the Calling Party Category from an enum + * + * \param cpc_string string value + * \param target the target to set value to + * + * \retval FTDM_SUCCESS success + * \retval FTDM_FAIL failure + */ +FT_DECLARE(ftdm_status_t) ftdm_set_calling_party_category(const char *string, uint8_t *target); + #endif /* __FTDM_CALL_UTILS_H__ */ commit a5fa887259d895c83361a26ab072251f61afb6f7 Merge: 7c74af6 f7f7b80 Author: cypromis <michal.bielicki@seventhsignal.de> Date: Sat Dec 18 01:16:58 2010 +0100 Merge remote branch 'origin/master' commit f7f7b8096366fd892c5858358e8c1654326cb3c4 Merge: c81a944 668763f Author: Michael S Collins <msc@freeswitch.org> Date: Fri Dec 17 16:17:16 2010 -0800 Merge branch 'master' of git://git.freeswitch.org/freeswitch commit c81a94485765bd1a5a437c2d1e0d318733677786 Author: Michael S Collins <msc@freeswitch.org> Date: Fri Dec 17 16:16:39 2010 -0800 lang: Update langs - Add pt_PT, update es to have es_ES and es_MX, update mod_say_es and add mod_say_pt (FS-2937) diff --git a/build/modules.conf.in b/build/modules.conf.in index 13e6556..bd5d49a 100644 --- a/build/modules.conf.in +++ b/build/modules.conf.in @@ -100,6 +100,7 @@ say/mod_say_en #say/mod_say_fr #say/mod_say_it #say/mod_say_nl +#say/mod_say_pt say/mod_say_ru #say/mod_say_zh #say/mod_say_hu diff --git a/docs/phrase/phrase_es_ES.xml b/docs/phrase/phrase_es_ES.xml new file mode 100644 index 0000000..ad99c1b --- /dev/null +++ b/docs/phrase/phrase_es_ES.xml @@ -0,0 +1,994 @@ +<language> + <es_ES> + <ascii> + <prompt phrase="Espacio" filename="32.wav"/> + <prompt phrase="Almohadilla" filename="35.wav"/> + <prompt phrase="Asterisco" filename="42.wav"/> + <prompt phrase="Punto" filename="46.wav"/> + <prompt phrase="A" filename="97.wav"/> + <prompt phrase="B" filename="98.wav"/> + <prompt phrase="C" filename="99.wav"/> + <prompt phrase="D" filename="100.wav"/> + <prompt phrase="E" filename="101.wav"/> + <prompt phrase="F" filename="102.wav"/> + <prompt phrase="G" filename="103.wav"/> + <prompt phrase="H" filename="104.wav"/> + <prompt phrase="I" filename="105.wav"/> + <prompt phrase="J" filename="106.wav"/> + <prompt phrase="K" filename="107.wav"/> + <prompt phrase="L" filename="108.wav"/> + <prompt phrase="M" filename="109.wav"/> + <prompt phrase="N" filename="110.wav"/> + <prompt phrase="Ã" filename="Ã.wav"/> + <prompt phrase="O" filename="111.wav"/> + <prompt phrase="P" filename="112.wav"/> + <prompt phrase="Q" filename="113.wav"/> + <prompt phrase="R" filename="114.wav"/> + <prompt phrase="S" filename="115.wav"/> + <prompt phrase="T" filename="116.wav"/> + <prompt phrase="U" filename="117.wav"/> + <prompt phrase="V" filename="118.wav"/> + <prompt phrase="W" filename="119.wav"/> + <prompt phrase="X" filename="120.wav"/> + <prompt phrase="Y" filename="121.wav"/> + <prompt phrase="Z" filename="122.wav"/> + </ascii> + <phonetic-ascii> + <prompt phrase="Espacio" filename="32.wav"/> + <prompt phrase="Punto" filename="46.wav"/> + <prompt phrase="Alpha" filename="97.wav"/> + <prompt phrase="Bravo" filename="98.wav"/> + <prompt phrase="Charlie" filename="99.wav"/> + <prompt phrase="Delta" filename="100.wav"/> + <prompt phrase="Echo" filename="101.wav"/> + <prompt phrase="Foxtrot" filename="102.wav"/> + <prompt phrase="Golf" filename="103.wav"/> + <prompt phrase="Hotel" filename="104.wav"/> + <prompt phrase="India" filename="105.wav"/> + <prompt phrase="Juliet" filename="106.wav"/> + <prompt phrase="Kilo" filename="107.wav"/> + <prompt phrase="Lima" filename="108.wav"/> + <prompt phrase="Mike" filename="109.wav"/> + <prompt phrase="November" filename="110.wav"/> + <prompt phrase="Oscar" filename="111.wav"/> + <prompt phrase="Papa" filename="112.wav"/> + <prompt phrase="Quebec" filename="113.wav"/> + <prompt phrase="Romeo" filename="114.wav"/> + <prompt phrase="Sierra" filename="115.wav"/> + <prompt phrase="Tango" filename="116.wav"/> + <prompt phrase="Unifor" filename="117.wav"/> + <prompt phrase="Victor" filename="118.wav"/> + <prompt phrase="Whiskey" filename="119.wav"/> + <prompt phrase="Xray" filename="120.wav"/> + <prompt phrase="Yankee" filename="121.wav"/> + <prompt phrase="Zulu" filename="122.wav"/> + </phonetic-ascii> + <digits> + <prompt phrase="Cero" filename="0.wav"/> + <prompt phrase="Uno" filename="1.wav"/> + <prompt phrase="Dos" filename="2.wav"/> + <prompt phrase="Tres" filename="3.wav"/> + <prompt phrase="Cuatro" filename="4.wav"/> + <prompt phrase="Cinco" filename="5.wav"/> + <prompt phrase="Seis" filename="6.wav"/> + <prompt phrase="Siete" filename="7.wav"/> + <prompt phrase="Ocho" filename="8.wav"/> + <prompt phrase="Nueve" filename="9.wav"/> + <prompt phrase="Diez" filename="10.wav"/> + <prompt phrase="Once" filename="11.wav"/> + <prompt phrase="Doce" filename="12.wav"/> + <prompt phrase="Trece" filename="13.wav"/> + <prompt phrase="Catorce" filename="14.wav"/> + <prompt phrase="Quince" filename="15.wav"/> + <prompt phrase="Dieciséis" filename="16.wav"/> + <prompt phrase="Diecisiete" filename="17.wav"/> + <prompt phrase="Dieciocho" filename="18.wav"/> + <prompt phrase="Diecinueve" filename="19.wav"/> + <prompt phrase="Veinte" filename="20.wav"/> + <prompt phrase="Veinti" filename="veinti.wav"/> + <prompt phrase="Treinta" filename="30.wav"/> + <prompt phrase="Cuarenta" filename="40.wav"/> + <prompt phrase="Cincuenta" filename="50.wav"/> + <prompt phrase="Sesenta" filename="60.wav"/> + <prompt phrase="Setenta" filename="70.wav"/> + <prompt phrase="Ochenta" filename="80.wav"/> + <prompt phrase="Noventa" filename="90.wav"/> + <prompt phrase="Cien" filename="100.wav"/> + <prompt phrase="Quinientos" filename="500.wav"/> + <prompt phrase="Setecientos" filename="700.wav"/> + <prompt phrase="Novecientos" filename="900.wav"/> + <prompt phrase="Punto" filename="dot.wav"/> + <prompt phrase="Primero" filename="h-1.wav"/> + <prompt phrase="Segundo" filename="h-2.wav"/> + <prompt phrase="Tercero" filename="h-3.wav"/> + <prompt phrase="Cuarto" filename="h-4.wav"/> + <prompt phrase="Quinto" filename="h-5.wav"/> + <prompt phrase="Sexto" filename="h-6.wav"/> + <prompt phrase="Séptimo" filename="h-7.wav"/> + <prompt phrase="Octavo" filename="h-8.wav"/> + <prompt phrase="Noveno" filename="h-9.wav"/> + <prompt phrase="Décimo" filename="h-10.wav"/> + <prompt phrase="Undécimo" filename="h-11.wav"/> + <prompt phrase="Duodécimo" filename="h-12.wav"/> + <prompt phrase="Decimotercero" filename="h-13.wav"/> + <prompt phrase="Decimocuarto" filename="h-14.wav"/> + <prompt phrase="Decimoquinto" filename="h-15.wav"/> + <prompt phrase="Decimosexto" filename="h-16.wav"/> + <prompt phrase="Decimoséptimo" filename="h-17.wav"/> + <prompt phrase="Decimoctavo" filename="h-18.wav"/> + <prompt phrase="Decimonoveno" filename="h-19.wav"/> + <prompt phrase="Vigésimo" filename="h-20.wav"/> + <prompt phrase="Trigésimo" filename="h-30.wav"/> + <prompt phrase="Un" filename="un.wav"/> + <prompt phrase="Ciento" filename="hundred.wav"/> + <prompt phrase="Cientos" filename="hundreds.wav"/> + <prompt phrase="Mil" filename="thousand.wav"/> + <prompt phrase="Millón" filename="million.wav"/> + <prompt phrase="Millones" filename="millions.wav"/> + <prompt phrase="PerÃodo" filename="period.wav"/> + <prompt phrase="Punto" filename="point.wav"/> + <prompt phrase="Almohadilla" filename="pound.wav"/> + <prompt phrase="Asterisco" filename="star.wav"/> + </digits> + <currency> + <prompt phrase="Y" filename="and.wav"/> + <prompt phrase="Céntimo" filename="cent.wav"/> + <prompt phrase="Central" filename="central.wav"/> + <prompt phrase="Céntimos por minuto" filename="cents-per-minute.wav"/> + <prompt phrase="Céntimos" filename="cents.wav"/> + <prompt phrase="Dólar" filename="dollar.wav"/> + <prompt phrase="Dólares" filename="dollars.wav"/> + <prompt phrase="Menos" filename="minus.wav"/> + <prompt phrase="Negativo" filename="negative.wav"/> + </currency> + <time> + <prompt phrase="A.M." filename="a-m.wav"/> + <prompt phrase="A la..." filename="at.wav"/> + <prompt phrase="A las..." filename="ats.wav"/> + <prompt phrase="Domingo" filename="day-0.wav"/> + <prompt phrase="Lunes" filename="day-1.wav"/> + <prompt phrase="Martes" filename="day-2.wav"/> + <prompt phrase="Miércoles" filename="day-3.wav"/> + <prompt phrase="Jueves" filename="day-4.wav"/> + <prompt phrase="Viernes" filename="day-5.wav"/> + <prompt phrase="Sábado" filename="day-6.wav"/> + <prompt phrase="Hora" filename="hour.wav"/> + <prompt phrase="Horas" filename="hours.wav"/> + <prompt phrase="Minuto" filename="minute.wav"/> + <prompt phrase="Minutos" filename="minutes.wav"/> + <prompt phrase="Enero" filename="mon-0.wav"/> + <prompt phrase="Febrero" filename="mon-1.wav"/> + <prompt phrase="Marzo" filename="mon-2.wav"/> + <prompt phrase="Abril" filename="mon-3.wav"/> + <prompt phrase="Mayo" filename="mon-4.wav"/> + <prompt phrase="Junio" filename="mon-5.wav"/> + <prompt phrase="Julio" filename="mon-6.wav"/> + <prompt phrase="Agosto" filename="mon-7.wav"/> + <prompt phrase="Septiembre" filename="mon-8.wav"/> + <prompt phrase="Octubre" filename="mon-9.wav"/> + <prompt phrase="Noviembre" filename="mon-10.wav"/> + <prompt phrase="Diciembre" filename="mon-11.wav"/> + <prompt phrase="En punto" filename="oclock.wav"/> + <prompt phrase="P.M." filename="p-m.wav"/> + <prompt phrase="Segundo" filename="second.wav"/> + <prompt phrase="Segundos" filename="seconds.wav"/> + <prompt phrase="Hoy" filename="today.wav"/> + <prompt phrase="Mañana" filename="tomorrow.wav"/> + <prompt phrase="Ayer" filename="yesterday.wav"/> + </time> + <voicemail> + <prompt phrase="La persona en la extensión..." filename="vm-person.wav"/> + <prompt phrase="Marcado urgente." filename="vm-marked-urgent.wav"/> + <prompt phrase="Enviado por correo electrónico." filename="vm-emailed.wav"/> + <prompt phrase="Usted tiene..." filename="vm-you_have.wav"/> + <prompt phrase="Por favor introduzca su número de usuario, seguido por..." filename="vm-enter_id.wav"/> + <prompt phrase="Por favor introduzca su contraseña, seguido por..." filename="vm-enter_pass.wav"/> + <prompt phrase="Inicio de sesión incorrecto." filename="vm-fail_auth.wav"/> + <prompt phrase="Bienvenido a su buzón de voz." filename="vm-hello.wav"/> + <prompt phrase="Adiós" filename="vm-goodbye.wav"/> + <prompt phrase="Por favor grabe su nombre después de la señal, pulse cualquier tecla o deje de hablar para poner fin a la grabación." filename="vm-record_name1.wav"/> + <prompt phrase="Elija un saludo entre 1 y 9." filename="vm-choose_greeting_choose.wav"/> + <prompt phrase="Valor inválido." filename="vm-choose_greeting_fail.wav"/> + <prompt phrase="Demasiados intentos fallidos." filename="vm-abort.wav"/> + <prompt phrase="Para cambiar su contraseña..." filename="vm-change_password.wav"/> + <prompt phrase="Grabe su saludo después de la señal, pulse cualquier tecla o deje de hablar para poner fin a la grabación." filename="vm-record_greeting.wav"/> + <prompt phrase="Grabe su mensaje después de la señal, pulse cualquier tecla o deje de hablar para poner fin a la grabación." filename="vm-record_message.wav"/> + <prompt phrase="...no está disponible." filename="vm-play_greeting.wav"/> + <prompt phrase="Urgente nuevo." filename="vm-urgent-new.wav"/> + <prompt phrase="Nuevo" filename="vm-new.wav"/> + <prompt phrase="Urgente guardado" filename="vm-urgent-saved.wav"/> + <prompt phrase="Guardado" filename="vm-saved.wav"/> + <prompt phrase="Mensaje" filename="vm-message.wav"/> + <prompt phrase="Mensajes" filename="vm-messages.wav"/> + <prompt phrase="Pulse" filename="vm-press.wav"/> + <prompt phrase="Para escuchar mensajes nuevos..." filename="vm-listen_new.wav"/> + <prompt phrase="Para escuchar mensajes guardados..." filename="vm-listen_saved.wav"/> + <prompt phrase="Para opciones avanzadas..." filename="vm-advanced.wav"/> + <prompt phrase="Para salir..." filename="vm-to_exit.wav"/> + <prompt phrase="Para grabar un saludo..." filename="vm-record_greeting.wav"/> + <prompt phrase="Para elegir un saludo..." filename="vm-choose_greeting.wav"/> + <prompt phrase="Para grabar su nombre..." filename="vm-record_name2.wav"/> + <prompt phrase="Para el menú principal..." filename="vm-main_menu.wav"/> + <prompt phrase="Para escuchar la grabación..." filename="vm-listen_to_recording.wav"/> + <prompt phrase="Para guardar la grabación..." filename="vm-save_recording.wav"/> + <prompt phrase="Para regrabar..." filename="vm-rerecord.wav"/> + <prompt phrase="Para marcar este mensaje como urgente..." filename="vm-mark-urgent.wav"/> + <prompt phrase="Para continuar..." filename="vm-continue.wav"/> + <prompt phrase="Para escuchar la grabación de nuevo..." filename="vm-listen_to_recording_again.wav"/> + <prompt phrase="Para eliminar la grabación..." filename="vm-delete_recording.wav"/> + <prompt phrase="Para enviar la grabación a su correo electrónico..." filename="vm-forward_to_email.wav"/> + <prompt phrase="Saludo" filename="vm-greeting.wav"/> + <prompt phrase="Seleccionado" filename="vm-selected.wav"/> + <prompt phrase="...no está disponible." filename="vm-not_available.wav"/> + <prompt phrase="Mensaje número..." filename="vm-message_number.wav"/> + <prompt phrase="Eliminado" filename="vm-deleted.wav"/> + <prompt phrase="Su grabación es demasiado corta, por favor intente de nuevo." filename="vm-too-small.wav"/> + <prompt phrase="...en la bandeja de entrada." filename="vm-in_folder.wav"/> + <prompt phrase="Para devolver la llamada..." filename="vm-return_call.wav"/> + <prompt phrase="Urgente" filename="vm-urgent.wav"/> + <prompt phrase="Este buzón está lleno. Por favor intente llamar mas tarde." filename="vm-mailbox_full.wav"/> + <prompt phrase="Bienvenido a su nuevo buzón de voz. Para escuchar el tutorial y configurar su buzón, pulse 1. Para saltarlo pulse 2." filename="vm-tutorial_yes_no.wav"/> + <prompt phrase="Necesito grabar su nombre y apellido. Esta grabación se usará entre otros en el servicio de directorio." filename="vm-tutorial_record_name.wav"/> + <prompt phrase="Su número de identificación personal o PIN sirve para impedir a terceros el acceso a sus mensajes. Desea cambiar su PIN ahora?" filename="vm-tutorial_change_pin.wav"/> + </voicemail> + <directory> + <prompt phrase="Por favor introduzca las primeras letras del nombre buscado." filename="dir-enter_person.wav"/> + <prompt phrase="...apellido..." filename="dir-last_name.wav"/> + <prompt phrase="Para buscar por..." filename="dir-to_search_by.wav"/> + <prompt phrase="...nombre..." filename="dir-first_name.wav"/> + <prompt phrase="No hay resultados que coincidan con su busqueda." filename="dir-no_matching_results.wav"/> + <prompt phrase="...resultados coinciden con su busqueda." filename="dir-result_match.wav"/> + <prompt phrase="Su busqueda genera demasiados resultados." filename="dir-too_many_result.wav"/> + <prompt phrase="No hay más resultados." filename="dir-no_more_results.wav"/> + <prompt phrase="Resultado número..." filename="dir-result_number.wav"/> + <prompt phrase="...en la extensión..." filename="dir-at_extension.wav"/> + <prompt phrase="Para seleccionar este resultado..." filename="dir-to_select_entry.wav"/> + <prompt phrase="Para el resultado siguiente..." filename="dir-for_next.wav"/> + <prompt phrase="Para el resultado previo..." filename="dir-for_prev.wav"/> + <prompt phrase="Para empezar una nueva busqueda..." filename="dir-start_new_search.wav"/> + <prompt phrase="Necesita especificar un mÃnimo de..." filename="dir-specify_mininum.wav"/> + <prompt phrase="...letras del nombre buscado." filename="dir-letters_of_person_name.wav"/> + <prompt phrase="Por favor intente de nuevo." filename="dir-please_try_again.wav"/> + <prompt phrase="Pulse..." filename="dir-press.wav" info="we can copy vm/vm-press.wav"/> + </directory> + <conference> + <prompt phrase="NULL" filename="conf-ack.wav" type="tone"/> + <prompt phrase="NULL" filename="conf-nack.wav" type="tone"/> + <prompt phrase="Su voz ha sido silenciada." filename="conf-muted.wav"/> + <prompt phrase="Su voz ha sido habilitada." filename="conf-unmuted.wav"/> + <prompt phrase="En este momento usted es la única persona en la conferencia." filename="conf-alone.wav"/> + <prompt phrase="NULL" filename="conf-perpetual.wav" type="music"/> + <prompt phrase="NULL" filename="conf-enter.wav" type="tone"/> + <prompt phrase="NULL" filename="conf-exit.wav" type="tone"/> + <prompt phrase="Usted ha sido expulsado de la conferencia." filename="conf-kicked.wav"/> + <prompt phrase="Esta conferencia está bloqueada." filename="conf-locked.wav"/> + <prompt phrase="La conferencia está ahora bloqueada." filename="conf-is-locked.wav"/> + <prompt phrase="La conferencia está ahora desbloqueada." filename="conf-is-unlocked.wav"/> + <prompt phrase="Por favor ingrese el PIN de la conferencia." filename="conf-pin.wav"/> + <prompt phrase="PIN inválido, intente de nuevo." filename="conf-bad-pin.wav"/> + <prompt phrase="Hasta luego." filename="conf-goodbye.wav"/> + <prompt phrase="Bienvenido a la conferencia." filename="conf-welcome.wav"/> + </conference> + <ivr> + <prompt phrase="Número de cuenta" filename="ivr-account_number.wav"/> + <prompt phrase="Conectar con el llamante" filename="ivr-connect_to_caller.wav"/> + <prompt phrase="Si conoce la extensión de su destino, por favor marquela ahora." filename="ivr-enter_ext_pound.wav"/> + <prompt phrase="Por favor ingrese un número de extensión seguido por la tecla almohadilla." filename="ivr-enter_ext.wav"/> + <prompt phrase="Para esta persona..." filename="ivr-for_this_person.wav"/> + <prompt phrase="Por favor espere mientras se conecta su llamada." filename="ivr-hold_connect_call.wav"/> + <prompt phrase="Lo siento..." filename="ivr-im_sorry.wav"/> + <prompt phrase="Por favor..." filename="ivr-please.wav"/> + <prompt phrase="Por favor devuelva nuestra llamada al..." filename="ivr-please_return_our_call_at.wav"/> + <prompt phrase="Acerca del número de referencia..." filename="ivr-regarding_reference_number.wav"/> + <prompt phrase="Este es un ejemplo de un submenú." filename="ivr-sample_submenu.wav"/> + <prompt phrase="Por favor diga su nombre después del tono." filename="ivr-say_name.wav"/> + <prompt phrase="Enviar a este llamante al buzón de voz." filename="ivr-send_to_voicemail.wav"/> + <prompt phrase="Para hablar con un representante del servicio de atención al cliente..." filename="ivr-speak_to_a_customer_service_representative.wav"/> + <prompt phrase="Tomar un mensaje" filename="ivr-take_a_message.wav"/> + <prompt phrase="Gracias" filename="ivr-thank_you.wav"/> + <prompt phrase="Esa fue una entrada inválida." filename="ivr-that_was_an_invalid_entry.wav"/> + <prompt phrase="Esta es una llamada de..." filename="ivr-this_is_a_call_from.wav"/> + <prompt phrase="Este menú de voz le permitirá probar algunas de las funciones..." filename="ivr-this_ivr_will_let_you_test_features.wav"/> + <prompt phrase="Para llamar a la conferencia de FreeSWITCH..." filename="ivr-to_call_the_freeswitch_conference.wav"/> + <prompt phrase="Para hacer una prueba de eco de FreeSWITCH..." filename="ivr-to_do_a_freeswitch_echo_test.wav"/> + <prompt phrase="Para hacer una prueba de eco de FWD..." filename="ivr-to_do_a_fwd_echo_test.wav"/> + <prompt phrase="Para escuchar un ejemplo de un submenú..." filename="ivr-to_hear_sample_submenu.wav"/> + <prompt phrase="Para escuchar simios gritando..." filename="ivr-to_hear_screaming_monkeys.wav"/> + <prompt phrase="Para escuchar música de llamada en espera..." filename="ivr-to_listen_to_moh.wav"/> + <prompt phrase="Para repetir estas opciones..." filename="ivr-to_repeat_these_options.wav"/> + <prompt phrase="Para volver al menú anterior..." filename="ivr-to_return_to_previous_menu.wav"/> + <prompt phrase="Para hablar con una operadora..." filename="ivr-to_speak_with_an_operator.wav"/> + <prompt phrase="Bienvenido a FreeSWITCH, el futuro de la telefonÃa." filename="ivr-welcome_to_freeswitch.wav"/> + <prompt phrase="Usted puede colgar en cualquier momento para salir." filename="ivr-you_may_exit_by_hanging_up.wav"/> + <prompt phrase="O" filename="ivr-or.wav"/> + <prompt phrase="No" filename="ivr-not.wav"/> + <prompt phrase="Llamar" filename="ivr-call.wav"/> + <prompt phrase="Usted puede..." filename="ivr-you_may.wav"/> + <prompt phrase="Hola" filename="ivr-hello.wav"/> + <prompt phrase="Usando el teclado de su teléfono..." filename="ivr-use_telephone_keypad.wav"/> + <prompt phrase="Por favor deletree el nombre de la persona con la cual está intentando contactar." filename="ivr-spell_name.wav"/> + <prompt phrase="Primero el apellido" filename="ivr-last_name_first.wav"/> + <prompt phrase="Primero el nombre" filename="ivr-first_name_first.wav"/> + <prompt phrase="Pulse 1 para Q ó Z." filename="ivr-press_one_q_or_z.wav"/> + <prompt phrase="Ventas" filename="ivr-sales.wav"/> + <prompt phrase="Servicio de atención al cliente" filename="ivr-customer_service.wav"/> + <prompt phrase="Soporte técnico" filename="ivr-technical_support.wav"/> + <prompt phrase="Operador" filename="ivr-operator.wav"/> + <prompt phrase="Usted marcó una extensión inválida." filename="ivr-you_have_dialed_an_invalid_extension.wav"/> + <prompt phrase="Por favor introduzca su número de extensión, seguido de la tecla almohadilla." filename="ivr-please_enter_extension_followed_by_pound.wav"/> + <prompt phrase="Por favor introduzca su contraseña, seguido de la tecla almohadilla." filename="ivr-please_enter_pin_followed_by_pound.wav"/> + <prompt phrase="Su contraseña o extensión es inválida." filename="ivr-pin_or_extension_is-invalid.wav"/> + <prompt phrase="Usted esta a punto de asociar este teléfono a su cuenta..." filename="ivr-you_are_about_to_provision_this_phone.wav"/> + <prompt phrase="Por favor vuelva a introducir su contraseña para confirmar." filename="ivr-please_reenter_your_pin.wav"/> + <prompt phrase="Para registrarse en ClueCon, por favor pulse..." filename="ivr-register_for_cluecon.wav"/> + <prompt phrase="Para conectarse..." filename="ivr-to_log_in.wav"/> + <prompt phrase="Para desconectarse..." filename="ivr-to_log_out.wav"/> + <prompt phrase="Usted está ahora conectado." filename="ivr-you_are_now_logged_in.wav"/> + <prompt phrase="Usted está ahora desconectado." filename="ivr-you_are_now_logged_out.wav"/> + <prompt phrase="Por favor intente de nuevo." filename="ivr-please_try_again.wav"/> + <prompt phrase="Usted está a punto de asociar este teléfono a su cuenta de forma permanente." filename="ivr-provision_phone_permanently_to_extension.wav"/> + <prompt phrase="Por favor introduzca su número de extensión con la cual desea asociar su teléfono, seguido de la tecla almohadilla." filename="ivr-extension_to_provision_this_phone.wav"/> + <prompt phrase="Gracias, este teléfono va a reiniciarse ahora." filename="ivr-this_phone_will_now_reboot.wav"/> + <prompt phrase="Gracias, su grabación ha sido guardada." filename="ivr-recording_saved.wav"/> + <prompt phrase="Pulse 1 para guardar su grabación. Pulse 2 para escuchar su grabación. Pulse 3 para volver a grabar." filename="ivr-save_review_record.wav"/> + <prompt phrase="En este momento, el sistema no puede guardar su fichero de audio. Por favor intente de nuevo." filename="ivr-unable_save.wav"/> + <prompt phrase="Usted está en la posición..." filename="ivr-you_are_number.wav"/> + <prompt phrase="...en la cola de espera." filename="ivr-in_line.wav"/> + <prompt phrase="Gracias por permanecer en espera." filename="ivr-thank_you_for_holding.wav"/> + <prompt phrase="El tiempo estimado de espera es..." filename="ivr-estimated_hold_time.wav"/> + <prompt phrase="Más de..." filename="ivr-more_than.wav"/> + <prompt phrase="Menos de..." filename="ivr-less_than.wav"/> + <prompt phrase="Empieze a grabar." filename="ivr-begin_recording.wav "/> + <prompt phrase="El desvÃo de llamada ha sido desactivado." filename="ivr-call_forwarding_has_been_cancelled.wav"/> + <prompt phrase="El desvÃo de llamada ha sido activado." filename="ivr-call_forwarding_has_been_set.wav"/> + <prompt phrase="Por favor introduzca el número de teléfono." filename="ivr-please_enter_the_phone_number.wav"/> + <prompt phrase="Por favor diga su nombre, y la razón de la llamada." filename="ivr-please_state_your_name_and_reason_for_calling.wav"/> + <prompt phrase="Para aceptar, pulse 1. Para rechazar, pulse 2. Para enviar al buzón de voz, pulse 3." filename="ivr-accept_reject_voicemail.wav"/> + <prompt phrase="Llamada entrante." filename="ivr-incoming_call.wav"/> + <prompt phrase="Gracias por llamar." filename="ivr-thank_you_for_calling.wav"/> + <prompt phrase="Por favor mentengase a la espera. Su llamada será atendida en un momento." filename="ivr-stay_on_line_call_answered_momentarily.wav"/> + <prompt phrase="Su llamada está siendo procesada." filename="ivr-call_being_transferred.wav"/> + <prompt phrase="Por favor disfrute de la música mientras su llamada está siendo procesada..." filename="ivr-enjoy_music_while_transfer.wav"/> + <prompt phrase="Usted tiene una llamada de..." filename="ivr-call_from.wav"/> + <prompt phrase="Este menú no tiene entradas. Por favor contacte con el administrador." filename="ivr-no_menu_items.wav"/> + <prompt phrase="Para el servicio de directorio, pulse..." filename="ivr-for_directory_press.wav"/> + <prompt phrase="Usando las teclas de su teléfono..." filename="ivr-using_telephone_keypad.wav"/> + <prompt phrase="Introduzca las primeras letras del apellido de la persona." filename="ivr-enter_letters_last_name.wav"/> + <prompt phrase="Introduzca las primeras letras del nombre de la persona." filename="ivr-enter_letters_first_name.wav"/> + <prompt phrase="Introduzca las primeras letras del nombre o apellido de la persona." filename="ivr-enter_letters_first_or_last_name.wav"/> + <prompt phrase="Si es correcto, pulse..." filename="ivr-if_correct_press.wav"/> + <prompt phrase="Sino, pulse..." filename="ivr-if_not_press.wav"/> + <prompt phrase="Cuando termine, pulse la tecla almohadilla." filename="ivr-finished_pound_hash_key.wav"/> + <prompt phrase="La función de No Molestar ha sido activada." filename="ivr-dnd_activated.wav"/> + <prompt phrase="La función de No Molestar ha sido desactivada." filename="ivr-dnd_cancelled.wav"/> + <prompt phrase="Pulse cualquier otro dÃgito..." filename="ivr-any_other_digit.wav"/> + <prompt phrase="Pulse uno si su respuesta es sÃ. Pulse dos si su respuesta es no." filename="ivr-one_yes_two_no.wav"/> + <prompt phrase="Por favor introduzca el número de la cola, seguido de la tecla almohadilla." filename="ivr-enter_queue_number.wav"/> + <prompt phrase="Por favor introduzca el..." filename="ivr-please_enter_the.wav"/> + <prompt phrase="Número." filename="ivr-number.wav"/> + <prompt phrase="...seguido de la tecla almohadilla." filename="ivr-followed_by_pound.wav"/> + <prompt phrase="El balance de la cuenta es..." filename="ivr-account_balance_is.wav"/> + <prompt phrase="Gracias por llamar. Si conoce la extensión de su destino, por favor marquela ahora. Para acceder al directorio, pulse..." filename="ivr-generic_greeting.wav"/> + <prompt phrase="...fichero..." filename="ivr-file.wav"/> + <prompt phrase="...ficheros..." filename="ivr-files-.wav"/> + <prompt phrase="Para una llamada de despertador..." filename="ivr-for_a_wakeup_call.wav"/> + <prompt phrase="Este es el servicio de despertador." filename="ivr-this_is_your_wakeup_call.wav"/> + <prompt phrase="Para solicitar una llamada de despertador..." filename="ivr-request_wakeup_call.wav"/> + <prompt phrase="Para confirmar la llamada de despertador..." filename="ivr-confirm_wakeup_call.wav"/> + <prompt phrase="Para anular la llamada de despertador..." filename="ivr-cancel_wakeup_call.wav"/> + <prompt phrase="Usted ha solicitado una llamada de despertador para..." filename="ivr-requested_wakeup_call_for.wav"/> + <prompt phrase="Usted no ha solicitado llamadas de despertador." filename="ivr-not_requested_wakeup_call.wav"/> + <prompt phrase="Su llamada de despertador ha sido anulada." filename="ivr-wakeup_call_cancelled.wav"/> + <prompt phrase="Para una llamada diaria de despertador..." filename="ivr-for_daily_wakeup_call.wav"/> + <prompt phrase="Llamada diaria de despertador..." filename="ivr-daily_wakeup_call.wav"/> + <prompt phrase="Para llamadas diarias de despertador..." filename="ivr-for_daily_wakeup_calls.wav"/> + <prompt phrase="Para una llamada de despertador única..." filename="ivr-for_one_time_wakeup_call.wav"/> + <prompt phrase="Llamada de despertador única..." filename="ivr-one_time_wakeup_call.wav"/> + <prompt phrase="...llamada de despertador..." filename="ivr-wakeup_call.wav"/> + <prompt phrase="¡Vamos despierta cielo!" filename="ivr-wakey_wakey_sunshine.wav"/> + <prompt phrase="Bienvenido." filename="ivr-welcome.wav"/> + <prompt phrase="Bienvenido a..." filename="ivr-welcome_to.wav"/> + <prompt phrase="Buenos dÃas." filename="ivr-good_morning.wav"/> + <prompt phrase="Buenas tardes." filename="ivr-good_afternoon.wav"/> + <prompt phrase="Buenas noches." filename="ivr-good_evening.wav"/> + <prompt phrase="Gracias." filename="ivr-Thank_you.wav"/> + <prompt phrase="Para..." filename="ivr-for.wav"/> + <prompt phrase="El tiempo de espera esta siendo anormalmente elevado." filename="ivr-longer_than_usual_hold_times.wav"/> + <prompt phrase="Usted es el..." filename="ivr-you_are_the.wav"/> + <prompt phrase="Un momento por favor." filename="ivr-one_moment_please.wav"/> + <prompt phrase="Su llamada será atendida según el orden de entrada." filename="ivr-call_answered_order_received.wav"/> + <prompt phrase="Por favor introduzca el número de conferencia, seguido de la tecla almohadilla." filename="conf-enter_conf_number.wav"/> + <prompt phrase="Introduzca el PIN de la conferencia, seguido de la tecla almohadilla." filename="conf-enter_conf_pin.wav"/> + <prompt phrase="...se incorporó a la conferencia." filename="conf-has_joined.wav"/> + <prompt phrase="...ha abandonado la conferencia." filename="conf-has_left.wav"/> + <prompt phrase="Usted entró..." filename="ivr-you_entered.wav"/> + <prompt phrase="Número de extensión..." filename="ivr-extension_number.wav"/> + <prompt phrase="Por favor mantengase a la espera mientras contactamos con su destino." filename="ivr-please_hold_while_party_contacted.wav"/> + <prompt phrase="Por favor disfrute de la música mientras le conectamos con su destino." filename="ivr-please_enjoy_music_while_party_reached.wav"/> + <prompt phrase="Gracias por llamar. Si conoce la extensión de su destino, por favor marquela ahora, o marque nueve para el servicio de directorio." filename="ivr-generic_greeting.wav"/> + <prompt phrase="Si es correcto, pulse 1. Sino, pulse 2." filename="ivr-if_correct_one_if_not_two.wav"/> + <prompt phrase="Para repetir esta información..." filename="ivr-repeat_this_information.wav"/> + <prompt phrase="No no no!" filename="ivr-no_no_no.wav"/> + <prompt phrase="Era su intención pulsar esta tecla?" filename="ivr-did_you_mean_to_press_key.wav"/> + <prompt phrase="Pensaba Usted DE VERDAD pulsar esta tecla?" filename="ivr-seriously_mean_to_press_key.wav"/> + <prompt phrase="Oh DA IGUAL." filename="ivr-oh_whatever.wav"/> + <prompt phrase="Se acabó! Un error más y le colgaré a la cara." filename="ivr-one_more_mistake.wav"/> + <prompt phrase="Felicitaciones. Ha pulsado estrella. Esto no significa que ES una estrella. Tan solo significa que puede pulsar teclas y probablemente tiene dedos." filename="ivr-congratulations_you_pressed_star.wav"/> + <prompt phrase="Todos nuestros ingenieros están ocupados en demostrar lo impresionante que es el CudaTel." filename="ivr-engineers_busy_assisting_other_sales.wav"/> + <prompt phrase="La persona con la que intenta hablar no está disponible y no tiene buzón de voz." filename="vm-not_available_no_voicemail.wav"/> + <prompt phrase="Este mensaje se auto-destruira en 5, 4, 3, 2, 1..." filename="ivr-message_self_destruct.wav"/> + <prompt phrase="Su llamada ya está silenciada." filename="conf-you_are_already_muted.wav"/> + <prompt phrase="Su llamada ha sido silenciada en ambos sentidos." filename="conf-you_are_now_bidirectionally_muted.wav"/> + <prompt phrase="Todas sus llamadas nos pertenecen." filename="ivr-all_your_call_are_belong_to_us.wav"/> + <prompt phrase="Me encanta como está pulsando estas teclas!" filename="ivr-love_those_touch_tones.wav"/> + <prompt phrase="No, no tenemos bananas." filename="ivr-yes_we_have_no_bananas.wav"/> + <prompt phrase="Está haciendo el ridÃculo!" filename="ivr-dude_you_suck.wav"/> + <prompt phrase="Su llamada es muy importante para nosotros, pero su bienestar mental no lo es, asà que estamos felices mantenerle a la espera, torturándole indefinidamente con nuestra pésima música en espera." filename="ivr-on_hold_indefinitely.wav"/> + <prompt phrase="...ha abandonado el edificio." filename="ivr-has_left_the_building.wav"/> + <prompt phrase="Este teléfono no está asignado y no puede ser usado para realizar llamadas externas." filename="ivr-phone_is_unassigned.wav"/> + <prompt phrase="Este teléfono no está configurado correctamente." filename="ivr-phone_not_configured.wav"/> + <prompt phrase="Felicitaciones! Este teléfono está configurado correctamente y puede ahora ser asociado a un usuario." filename="ivr-phone_is_configured_properly.wav"/> + <prompt phrase="Por favor contacte con el administrador del sistema para obtener asistencia." filename="ivr-contact_system_administrator.wav"/> + <prompt phrase="Barracuda Networks" filename="ivr-barracuda_networks.wav"/> + <prompt phrase="CudaTel Communication Server" filename="ivr-cudatel_communication_server.wav"/> + <prompt phrase="Por favor introduzca las primeras letras del nombre o apellido de la persona." filename="dir-enter_person_first_or_last.wav"/> + <prompt phrase="No hay llamadas en espera en esta cola." filename="ivr-no_calls_waiting_in_queue.wav"/> + <prompt phrase="Brian West" filename="misc-Brian_West.wav"/> + <prompt phrase="Anthony Minessale" filename="misc-Anthony_Minessale.wav"/> + <prompt phrase="Michael Jerris" filename="misc-Michael_Jerris.wav"/> + <prompt phrase="Raymond Chandler" filename="misc-Raymond_Chandler.wav"/> + <prompt phrase="Michael Collins" filename="misc-Michael_Collins.wav"/> + <prompt phrase="Mark Mann" filename="misc-Mark_Mann.wav"/> + <prompt phrase="William King" filename="misc-William_King.wav"/> + <prompt phrase="Rudy Fleminger" filename="misc-Rudy_Fleminger.wav"/> + <prompt phrase="Andrew Thompson" filename="misc-Andrew_Thompson.wav"/> + <prompt phrase="Graham Saathoff" filename="misc-Graham_Saathoff.wav"/> + <prompt phrase="Nicholaus Belluni" filename="misc-Nicholaus_Belluni.wav"/> + <prompt phrase="Sean Heiney" filename="misc-Sean_Heiney.wav"/> + </ivr> + <misc> + <prompt phrase="Esta llamada está ahora protegida." filename="call_secured.wav"/> + <prompt phrase="...seguido de la tecla almohadilla." filename="followed.wav"/> + <prompt phrase="Si usted es esta persona..." filename="if_you_are_this_person.wav"/> + <prompt phrase="Si usted desea..." filename="if_you_would_like_to.wav"/> + <prompt phrase="Por favor, introduzca el número de referencia." filename="provide_reference_number.wav"/> + <prompt phrase="Por favor, marque la extensión a la cual desea transferir." filename="transfer1.wav"/> + <prompt phrase="Transferir" filename="transfer2.wav"/> + <prompt phrase="Estamos tratando de contactar..." filename="we_are_trying_to_reach.wav"/> + <prompt phrase="Ha ocurrido un error, por favor contacte con el administrador." filename="error.wav"/> + <prompt phrase="Su llamada será terminada en..." filename="misc-your_call_will_be_terminated_in.wav"/> + <prompt phrase="Su llamada ha sido terminada." filename="misc-your_call_has_been_terminated.wav"/> + </misc> + <zrtp> + <!-- base256 prompts for SAS --> + <prompt phrase="Algol" filename="Algol.wav"/> + <prompt phrase="Apollo" filename="Apollo.wav"/> + <prompt phrase="Athens" filename="Athens.wav"/> + <prompt phrase="Atlantic" filename="Atlantic.wav"/> + <prompt phrase="Aztec" filename="Aztec.wav"/> + <prompt phrase="Babylon" filename="Babylon.wav"/> + <prompt phrase="Belfast" filename="Belfast.wav"/> + <prompt phrase="Bradbury" filename="Bradbury.wav"/> + <prompt phrase="Brazilian" filename="Brazilian.wav"/> + <prompt phrase="Burbank" filename="Burbank.wav"/> + <prompt phrase="Burlington" filename="Burlington.wav"/> + <prompt phrase="Camelot" filename="Camelot.wav"/> + <prompt phrase="Capricorn" filename="Capricorn.wav"/> + <prompt phrase="Cherokee" filename="Cherokee.wav"/> + <prompt phrase="Chicago" filename="Chicago.wav"/> + <prompt phrase="Christmas" filename="Christmas.wav"/> + <prompt phrase="Dakota" filename="Dakota.wav"/> + <prompt phrase="December" filename="December.wav"/> + <prompt phrase="Dupont" filename="Dupont.wav"/> + <prompt phrase="Eskimo" filename="Eskimo.wav"/> + <prompt phrase="Galveston" filename="Galveston.wav"/> + <prompt phrase="Geiger" filename="Geiger.wav"/> + <prompt phrase="Hamilton" filename="Hamilton.wav"/> + <prompt phrase="Istanbul" filename="Istanbul.wav"/> + <prompt phrase="Jamaica" filename="Jamaica.wav"/> + <prompt phrase="Jupiter" filename="Jupiter.wav"/> + <prompt phrase="Medusa" filename="Medusa.wav"/> + <prompt phrase="Mohawk" filename="Mohawk.wav"/> + <prompt phrase="Montana" filename="Montana.wav"/> + <prompt phrase="Neptune" filename="Neptune.wav"/> + <prompt phrase="Norwegian" filename="Norwegian.wav"/> + <prompt phrase="Oakland" filename="Oakland.wav"/> + <prompt phrase="October" filename="October.wav"/> + <prompt phrase="Ohio" filename="Ohio.wav"/> + <prompt phrase="Orlando" filename="Orlando.wav"/> + <prompt phrase="Pacific" filename="Pacific.wav"/> + <prompt phrase="Pandora" filename="Pandora.wav"/> + <prompt phrase="Pegasus" filename="Pegasus.wav"/> + <prompt phrase="Pluto" filename="Pluto.wav"/> + <prompt phrase="Saturday" filename="Saturday.wav"/> + <prompt phrase="Scotland" filename="Scotland.wav"/> + <prompt phrase="Trojan" filename="Trojan.wav"/> + <prompt phrase="Virginia" filename="Virginia.wav"/> + <prompt phrase="Vulcan" filename="Vulcan.wav"/> + <prompt phrase="Waterloo" filename="Waterloo.wav"/> + <prompt phrase="Wichita" filename="Wichita.wav"/> + <prompt phrase="Wilmington" filename="Wilmington.wav"/> + <prompt phrase="Wyoming" filename="Wyoming.wav"/> + <prompt phrase="Yucatan" filename="Yucatan.wav"/> + <prompt phrase="Zulu" filename="Zulu.wav"/> + <prompt phrase="aardvark" filename="aardvark.wav"/> + <prompt phrase="absurd" filename="absurd.wav"/> + <prompt phrase="accrue" filename="accrue.wav"/> + <prompt phrase="acme" filename="acme.wav"/> + <prompt phrase="adrift" filename="adrift.wav"/> + <prompt phrase="adroitness" filename="adroitness.wav"/> + <prompt phrase="adult" filename="adult.wav"/> + <prompt phrase="adviser" filename="adviser.wav"/> + <prompt phrase="afflict" filename="afflict.wav"/> + <prompt phrase="aftermath" filename="aftermath.wav"/> + <prompt phrase="aggregate" filename="aggregate.wav"/> + <prompt phrase="ahead" filename="ahead.wav"/> + <prompt phrase="aimless" filename="aimless.wav"/> + <prompt phrase="alkali" filename="alkali.wav"/> + <prompt phrase="allow" filename="allow.wav"/> + <prompt phrase="almighty" filename="almighty.wav"/> + <prompt phrase="alone" filename="alone.wav"/> + <prompt phrase="ammo" filename="ammo.wav"/> + <prompt phrase="amulet" filename="amulet.wav"/> + <prompt phrase="amusement" filename="amusement.wav"/> + <prompt phrase="ancient" filename="ancient.wav"/> + <prompt phrase="antenna" filename="antenna.wav"/> + <prompt phrase="apple" filename="apple.wav"/> + <prompt phrase="applicant" filename="applicant.wav"/> + <prompt phrase="armistice" filename="armistice.wav"/> + <prompt phrase="article" filename="article.wav"/> + <prompt phrase="artist" filename="artist.wav"/> + <prompt phrase="assume" filename="assume.wav"/> + <prompt phrase="asteroid" filename="asteroid.wav"/> + <prompt phrase="atlas" filename="atlas.wav"/> + <prompt phrase="atmosphere" filename="atmosphere.wav"/> + <prompt phrase="autopsy" filename="autopsy.wav"/> + <prompt phrase="baboon" filename="baboon.wav"/> + <prompt phrase="backfield" filename="backfield.wav"/> + <prompt phrase="backward" filename="backward.wav"/> + <prompt phrase="backwater" filename="backwater.wav"/> + <prompt phrase="banjo" filename="banjo.wav"/> + <prompt phrase="barbecue" filename="barbecue.wav"/> + <prompt phrase="beaming" filename="beaming.wav"/> + <prompt phrase="bedlamp" filename="bedlamp.wav"/> + <prompt phrase="beehive" filename="beehive.wav"/> + <prompt phrase="beeswax" filename="beeswax.wav"/> + <prompt phrase="befriend" filename="befriend.wav"/> + <prompt phrase="belowground" filename="belowground.wav"/> + <prompt phrase="berserk" filename="berserk.wav"/> + <prompt phrase="bifocals" filename="bifocals.wav"/> + <prompt phrase="billiard" filename="billiard.wav"/> + <prompt phrase="bison" filename="bison.wav"/> + <prompt phrase="blackjack" filename="blackjack.wav"/> + <prompt phrase="blockade" filename="blockade.wav"/> + <prompt phrase="blowtorch" filename="blowtorch.wav"/> + <prompt phrase="bluebird" filename="bluebird.wav"/> + <prompt phrase="bodyguard" filename="bodyguard.wav"/> + <prompt phrase="bombast" filename="bombast.wav"/> + <prompt phrase="bookseller" filename="bookseller.wav"/> + <prompt phrase="bookshelf" filename="bookshelf.wav"/> + <prompt phrase="borderline" filename="borderline.wav"/> + <prompt phrase="bottomless" filename="bottomless.wav"/> + <prompt phrase="brackish" filename="brackish.wav"/> + <prompt phrase="bravado" filename="bravado.wav"/> + <prompt phrase="breadline" filename="breadline.wav"/> + <prompt phrase="breakaway" filename="breakaway.wav"/> + <prompt phrase="breakup" filename="breakup.wav"/> + <prompt phrase="brickyard" filename="brickyard.wav"/> + <prompt phrase="briefcase" filename="briefcase.wav"/> + <prompt phrase="businessman" filename="businessman.wav"/> + <prompt phrase="butterfat" filename="butterfat.wav"/> + <prompt phrase="button" filename="button.wav"/> + <prompt phrase="buzzard" filename="buzzard.wav"/> + <prompt phrase="candidate" filename="candidate.wav"/> + <prompt phrase="cannonball" filename="cannonball.wav"/> + <prompt phrase="caravan" filename="caravan.wav"/> + <prompt phrase="caretaker" filename="caretaker.wav"/> + <prompt phrase="celebrate" filename="celebrate.wav"/> + <prompt phrase="cellulose" filename="cellulose.wav"/> + <prompt phrase="cement" filename="cement.wav"/> + <prompt phrase="certify" filename="certify.wav"/> + <prompt phrase="chairlift" filename="chairlift.wav"/> + <prompt phrase="chambermaid" filename="chambermaid.wav"/> + <prompt phrase="chatter" filename="chatter.wav"/> + <prompt phrase="checkup" filename="checkup.wav"/> + <prompt phrase="chisel" filename="chisel.wav"/> + <prompt phrase="choking" filename="choking.wav"/> + <prompt phrase="chopper" filename="chopper.wav"/> + <prompt phrase="clamshell" filename="clamshell.wav"/> + <prompt phrase="classic" filename="classic.wav"/> + <prompt phrase="classroom" filename="classroom.wav"/> + <prompt phrase="cleanup" filename="cleanup.wav"/> + <prompt phrase="clergyman" filename="clergyman.wav"/> + <prompt phrase="clockwork" filename="clockwork.wav"/> + <prompt phrase="cobra" filename="cobra.wav"/> + <prompt phrase="coherence" filename="coherence.wav"/> + <prompt phrase="combustion" filename="combustion.wav"/> + <prompt phrase="commando" filename="commando.wav"/> + <prompt phrase="commence" filename="commence.wav"/> + <prompt phrase="company" filename="company.wav"/> + <prompt phrase="component" filename="component.wav"/> + <prompt phrase="concert" filename="concert.wav"/> + <prompt phrase="concurrent" filename="concurrent.wav"/> + <prompt phrase="confidence" filename="confidence.wav"/> + <prompt phrase="conformist" filename="conformist.wav"/> + <prompt phrase="congregate" filename="congregate.wav"/> + <prompt phrase="consensus" filename="consensus.wav"/> + <prompt phrase="consulting" filename="consulting.wav"/> + <prompt phrase="corporate" filename="corporate.wav"/> + <prompt phrase="corrosion" filename="corrosion.wav"/> + <prompt phrase="councilman" filename="councilman.wav"/> + <prompt phrase="cowbell" filename="cowbell.wav"/> + <prompt phrase="crackdown" filename="crackdown.wav"/> + <prompt phrase="cranky" filename="cranky.wav"/> + <prompt phrase="crossover" filename="crossover.wav"/> + <prompt phrase="crowfoot" filename="crowfoot.wav"/> + <prompt phrase="crucial" filename="crucial.wav"/> + <prompt phrase="crucifix" filename="crucifix.wav"/> + <prompt phrase="crumpled" filename="crumpled.wav"/> + <prompt phrase="crusade" filename="crusade.wav"/> + <prompt phrase="cubic" filename="cubic.wav"/> + <prompt phrase="cumbersome" filename="cumbersome.wav"/> + <prompt phrase="customer" filename="customer.wav"/> + <prompt phrase="dashboard" filename="dashboard.wav"/> + <prompt phrase="deadbolt" filename="deadbolt.wav"/> + <prompt phrase="decadence" filename="decadence.wav"/> + <prompt phrase="decimal" filename="decimal.wav"/> + <prompt phrase="deckhand" filename="deckhand.wav"/> + <prompt phrase="designing" filename="designing.wav"/> + <prompt phrase="detector" filename="detector.wav"/> + <prompt phrase="detergent" filename="detergent.wav"/> + <prompt phrase="determine" filename="determine.wav"/> + <prompt phrase="dictator" filename="dictator.wav"/> + <prompt phrase="dinosaur" filename="dinosaur.wav"/> + <prompt phrase="direction" filename="direction.wav"/> + <prompt phrase="disable" filename="disable.wav"/> + <prompt phrase="disbelief" filename="disbelief.wav"/> + <prompt phrase="disruptive" filename="disruptive.wav"/> + <prompt phrase="distortion" filename="distortion.wav"/> + <prompt phrase="document" filename="document.wav"/> + <prompt phrase="dogsled" filename="dogsled.wav"/> + <prompt phrase="dragnet" filename="dragnet.wav"/> + <prompt phrase="drainage" filename="drainage.wav"/> + <prompt phrase="dreadful" filename="dreadful.wav"/> + <prompt phrase="drifter" filename="drifter.wav"/> + <prompt phrase="dropper" filename="dropper.wav"/> + <prompt phrase="drumbeat" filename="drumbeat.wav"/> + <prompt phrase="drunken" filename="drunken.wav"/> + <prompt phrase="dwelling" filename="dwelling.wav"/> + <prompt phrase="eating" filename="eating.wav"/> + <prompt phrase="edict" filename="edict.wav"/> + <prompt phrase="egghead" filename="egghead.wav"/> + <prompt phrase="eightball" filename="eightball.wav"/> + <prompt phrase="embezzle" filename="embezzle.wav"/> + <prompt phrase="enchanting" filename="enchanting.wav"/> + <prompt phrase="endorse" filename="endorse.wav"/> + <prompt phrase="endow" filename="endow.wav"/> + <prompt phrase="enlist" filename="enlist.wav"/> + <prompt phrase="enrollment" filename="enrollment.wav"/> + <prompt phrase="enterprise" filename="enterprise.wav"/> + <prompt phrase="equation" filename="equation.wav"/> + <prompt phrase="equipment" filename="equipment.wav"/> + <prompt phrase="erase" filename="erase.wav"/> + <prompt phrase="escapade" filename="escapade.wav"/> + <prompt phrase="escape" filename="escape.wav"/> + <prompt phrase="everyday" filename="everyday.wav"/> + <prompt phrase="examine" filename="examine.wav"/> + <prompt phrase="exceed" filename="exceed.wav"/> + <prompt phrase="existence" filename="existence.wav"/> + <prompt phrase="exodus" filename="exodus.wav"/> + <prompt phrase="eyeglass" filename="eyeglass.wav"/> + <prompt phrase="eyetooth" filename="eyetooth.wav"/> + <prompt phrase="facial" filename="facial.wav"/> + <prompt phrase="fallout" filename="fallout.wav"/> + <prompt phrase="fascinate" filename="fascinate.wav"/> + <prompt phrase="filament" filename="filament.wav"/> + <prompt phrase="finicky" filename="finicky.wav"/> + <prompt phrase="flagpole" filename="flagpole.wav"/> + <prompt phrase="flatfoot" filename="flatfoot.wav"/> + <prompt phrase="flytrap" filename="flytrap.wav"/> + <prompt phrase="forever" filename="forever.wav"/> + <prompt phrase="fortitude" filename="fortitude.wav"/> + <prompt phrase="fracture" filename="fracture.wav"/> + <prompt phrase="framework" filename="framework.wav"/> + <prompt phrase="freedom" filename="freedom.wav"/> + <prompt phrase="frequency" filename="frequency.wav"/> + <prompt phrase="frighten" filename="frighten.wav"/> + <prompt phrase="gadgetry" filename="gadgetry.wav"/> + <prompt phrase="gazelle" filename="gazelle.wav"/> + <prompt phrase="getaway" filename="getaway.wav"/> + <prompt phrase="glitter" filename="glitter.wav"/> + <prompt phrase="glossary" filename="glossary.wav"/> + <prompt phrase="glucose" filename="glucose.wav"/> + <prompt phrase="goggles" filename="goggles.wav"/> + <prompt phrase="goldfish" filename="goldfish.wav"/> + <prompt phrase="gossamer" filename="gossamer.wav"/> + <prompt phrase="graduate" filename="graduate.wav"/> + <prompt phrase="gravity" filename="gravity.wav"/> + <prompt phrase="gremlin" filename="gremlin.wav"/> + <prompt phrase="guidance" filename="guidance.wav"/> + <prompt phrase="guitarist" filename="guitarist.wav"/> + <prompt phrase="hamburger" filename="hamburger.wav"/> + <prompt phrase="hamlet" filename="hamlet.wav"/> + <prompt phrase="handiwork" filename="handiwork.wav"/> + <prompt phrase="hazardous" filename="hazardous.wav"/> + <prompt phrase="headwaters" filename="headwaters.wav"/> + <prompt phrase="hemisphere" filename="hemisphere.wav"/> + <prompt phrase="hesitate" filename="hesitate.wav"/> + <prompt phrase="hideaway" filename="hideaway.wav"/> + <prompt phrase="highchair" filename="highchair.wav"/> + <prompt phrase="hockey" filename="hockey.wav"/> + <prompt phrase="holiness" filename="holiness.wav"/> + <prompt phrase="hurricane" filename="hurricane.wav"/> + <prompt phrase="hydraulic" filename="hydraulic.wav"/> + <prompt phrase="impartial" filename="impartial.wav"/> + <prompt phrase="impetus" filename="impetus.wav"/> + <prompt phrase="inception" filename="inception.wav"/> + <prompt phrase="indigo" filename="indigo.wav"/> + <prompt phrase="indoors" filename="indoors.wav"/> + <prompt phrase="indulge" filename="indulge.wav"/> + <prompt phrase="inertia" filename="inertia.wav"/> + <prompt phrase="infancy" filename="infancy.wav"/> + <prompt phrase="inferno" filename="inferno.wav"/> + <prompt phrase="informant" filename="informant.wav"/> + <prompt phrase="insincere" filename="insincere.wav"/> + <prompt phrase="insurgent" filename="insurgent.wav"/> + <prompt phrase="integrate" filename="integrate.wav"/> + <prompt phrase="intention" filename="intention.wav"/> + <prompt phrase="inventive" filename="inventive.wav"/> + <prompt phrase="inverse" filename="inverse.wav"/> + <prompt phrase="involve" filename="involve.wav"/> + <prompt phrase="island" filename="island.wav"/> + <prompt phrase="jawbone" filename="jawbone.wav"/> + <prompt phrase="keyboard" filename="keyboard.wav"/> + <prompt phrase="kickoff" filename="kickoff.wav"/> + <prompt phrase="kiwi" filename="kiwi.wav"/> + <prompt phrase="klaxon" filename="klaxon.wav"/> + <prompt phrase="leprosy" filename="leprosy.wav"/> + <prompt phrase="letterhead" filename="letterhead.wav"/> + <prompt phrase="liberty" filename="liberty.wav"/> + <prompt phrase="locale" filename="locale.wav"/> + <prompt phrase="lockup" filename="lockup.wav"/> + <prompt phrase="maritime" filename="maritime.wav"/> + <prompt phrase="matchmaker" filename="matchmaker.wav"/> + <prompt phrase="maverick" filename="maverick.wav"/> + <prompt phrase="megaton" filename="megaton.wav"/> + <prompt phrase="merit" filename="merit.wav"/> + <prompt phrase="microscope" filename="microscope.wav"/> + <prompt phrase="microwave" filename="microwave.wav"/> + <prompt phrase="midsummer" filename="midsummer.wav"/> + <prompt phrase="millionaire" filename="millionaire.wav"/> + <prompt phrase="minnow" filename="minnow.wav"/> + <prompt phrase="miracle" filename="miracle.wav"/> + <prompt phrase="miser" filename="miser.wav"/> + <prompt phrase="misnomer" filename="misnomer.wav"/> + <prompt phrase="molasses" filename="molasses.wav"/> + <prompt phrase="molecule" filename="molecule.wav"/> + <prompt phrase="monument" filename="monument.wav"/> + <prompt phrase="mosquito" filename="mosquito.wav"/> + <prompt phrase="mural" filename="mural.wav"/> + <prompt phrase="music" filename="music.wav"/> + <prompt phrase="narrative" filename="narrative.wav"/> + <prompt phrase="nebula" filename="nebula.wav"/> + <prompt phrase="necklace" filename="necklace.wav"/> + <prompt phrase="newborn" filename="newborn.wav"/> + <prompt phrase="newsletter" filename="newsletter.wav"/> + <prompt phrase="nightbird" filename="nightbird.wav"/> + <prompt phrase="obtuse" filename="obtuse.wav"/> + <prompt phrase="offload" filename="offload.wav"/> + <prompt phrase="onlooker" filename="onlooker.wav"/> + <prompt phrase="optic" filename="optic.wav"/> + <prompt phrase="opulent" filename="opulent.wav"/> + <prompt phrase="orca" filename="orca.wav"/> + <prompt phrase="outfielder" filename="outfielder.wav"/> + <prompt phrase="pandemic" filename="pandemic.wav"/> + <prompt phrase="paperweight" filename="paperweight.wav"/> + <prompt phrase="paragon" filename="paragon.wav"/> + <prompt phrase="paragraph" filename="paragraph.wav"/> + <prompt phrase="paramount" filename="paramount.wav"/> + <prompt phrase="passenger" filename="passenger.wav"/> + <prompt phrase="payday" filename="payday.wav"/> + <prompt phrase="peachy" filename="peachy.wav"/> + <prompt phrase="pedigree" filename="pedigree.wav"/> + <prompt phrase="penetrate" filename="penetrate.wav"/> + <prompt phrase="perceptive" filename="perceptive.wav"/> + <prompt phrase="performance" filename="performance.wav"/> + <prompt phrase="pharmacy" filename="pharmacy.wav"/> + <prompt phrase="pheasant" filename="pheasant.wav"/> + <prompt phrase="phonetic" filename="phonetic.wav"/> + <prompt phrase="photograph" filename="photograph.wav"/> + <prompt phrase="physique" filename="physique.wav"/> + <prompt phrase="pioneer" filename="pioneer.wav"/> + <prompt phrase="playhouse" filename="playhouse.wav"/> + <prompt phrase="pocketful" filename="pocketful.wav"/> + <prompt phrase="politeness" filename="politeness.wav"/> + <prompt phrase="positive" filename="positive.wav"/> + <prompt phrase="potato" filename="potato.wav"/> + <prompt phrase="preclude" filename="preclude.wav"/> + <prompt phrase="prefer" filename="prefer.wav"/> + <prompt phrase="preshrunk" filename="preshrunk.wav"/> + <prompt phrase="printer" filename="printer.wav"/> + <prompt phrase="processor" filename="processor.wav"/> + <prompt phrase="provincial" filename="provincial.wav"/> + <prompt phrase="prowler" filename="prowler.wav"/> + <prompt phrase="proximate" filename="proximate.wav"/> + <prompt phrase="puberty" filename="puberty.wav"/> + <prompt phrase="publisher" filename="publisher.wav"/> + <prompt phrase="pupil" filename="pupil.wav"/> + <prompt phrase="puppy" filename="puppy.wav"/> + <prompt phrase="pyramid" filename="pyramid.wav"/> + <prompt phrase="python" filename="python.wav"/> + <prompt phrase="quadrant" filename="quadrant.wav"/> + <prompt phrase="quantity" filename="quantity.wav"/> + <prompt phrase="quiver" filename="quiver.wav"/> + <prompt phrase="quota" filename="quota.wav"/> + <prompt phrase="racketeer" filename="racketeer.wav"/> + <prompt phrase="ragtime" filename="ragtime.wav"/> + <prompt phrase="ratchet" filename="ratchet.wav"/> + <prompt phrase="rebellion" filename="rebellion.wav"/> + <prompt phrase="rebirth" filename="rebirth.wav"/> + <prompt phrase="recipe" filename="recipe.wav"/> + <prompt phrase="recover" filename="recover.wav"/> + <prompt phrase="reform" filename="reform.wav"/> + <prompt phrase="regain" filename="regain.wav"/> + <prompt phrase="reindeer" filename="reindeer.wav"/> + <prompt phrase="rematch" filename="rematch.wav"/> + <prompt phrase="repay" filename="repay.wav"/> + <prompt phrase="repellent" filename="repellent.wav"/> + <prompt phrase="replica" filename="replica.wav"/> + <prompt phrase="reproduce" filename="reproduce.wav"/> + <prompt phrase="resistor" filename="resistor.wav"/> + <prompt phrase="responsive" filename="responsive.wav"/> + <prompt phrase="retouch" filename="retouch.wav"/> + <prompt phrase="retraction" filename="retraction.wav"/> + <prompt phrase="retrieval" filename="retrieval.wav"/> + <prompt phrase="retrospect" filename="retrospect.wav"/> + <prompt phrase="revenge" filename="revenge.wav"/> + <prompt phrase="revenue" filename="revenue.wav"/> + <prompt phrase="revival" filename="revival.wav"/> + <prompt phrase="revolver" filename="revolver.wav"/> + <prompt phrase="reward" filename="reward.wav"/> + <prompt phrase="rhythm" filename="rhythm.wav"/> + <prompt phrase="ribcage" filename="ribcage.wav"/> + <prompt phrase="ringbolt" filename="ringbolt.wav"/> + <prompt phrase="robust" filename="robust.wav"/> + <prompt phrase="rocker" filename="rocker.wav"/> + <prompt phrase="ruffled" filename="ruffled.wav"/> + <prompt phrase="sailboat" filename="sailboat.wav"/> + <prompt phrase="sandalwood" filename="sandalwood.wav"/> + <prompt phrase="sardonic" filename="sardonic.wav"/> + <prompt phrase="savagery" filename="savagery.wav"/> + <prompt phrase="sawdust" filename="sawdust.wav"/> + <prompt phrase="scallion" filename="scallion.wav"/> + <prompt phrase="scavenger" filename="scavenger.wav"/> + <prompt phrase="scenic" filename="scenic.wav"/> + <prompt phrase="scorecard" filename="scorecard.wav"/> + <prompt phrase="seabird" filename="seabird.wav"/> + <prompt phrase="select" filename="select.wav"/> + <prompt phrase="sensation" filename="sensation.wav"/> + <prompt phrase="sentence" filename="sentence.wav"/> + <prompt phrase="shadow" filename="shadow.wav"/> + <prompt phrase="shamrock" filename="shamrock.wav"/> + <prompt phrase="showgirl" filename="showgirl.wav"/> + <prompt phrase="skullcap" filename="skullcap.wav"/> + <prompt phrase="skydive" filename="skydive.wav"/> + <prompt phrase="slingshot" filename="slingshot.wav"/> + <prompt phrase="slowdown" filename="slowdown.wav"/> + <prompt phrase="snapline" filename="snapline.wav"/> + <prompt phrase="snapshot" filename="snapshot.wav"/> + <prompt phrase="snowcap" filename="snowcap.wav"/> + <prompt phrase="snowslide" filename="snowslide.wav"/> + <prompt phrase="sociable" filename="sociable.wav"/> + <prompt phrase="solo" filename="solo.wav"/> + <prompt phrase="southward" filename="southward.wav"/> + <prompt phrase="souvenir" filename="souvenir.wav"/> + <prompt phrase="soybean" filename="soybean.wav"/> + <prompt phrase="spaniel" filename="spaniel.wav"/> + <prompt phrase="spearhead" filename="spearhead.wav"/> + <prompt phrase="specialist" filename="specialist.wav"/> + <prompt phrase="speculate" filename="speculate.wav"/> + <prompt phrase="spellbind" filename="spellbind.wav"/> + <prompt phrase="spheroid" filename="spheroid.wav"/> + <prompt phrase="spigot" filename="spigot.wav"/> + <prompt phrase="spindle" filename="spindle.wav"/> + <prompt phrase="spyglass" filename="spyglass.wav"/> + <prompt phrase="stagehand" filename="stagehand.wav"/> + <prompt phrase="stagnate" filename="stagnate.wav"/> + <prompt phrase="stairway" filename="stairway.wav"/> + <prompt phrase="standard" filename="standard.wav"/> + <prompt phrase="stapler" filename="stapler.wav"/> + <prompt phrase="steamship" filename="steamship.wav"/> + <prompt phrase="sterling" filename="sterling.wav"/> + <prompt phrase="stethoscope" filename="stethoscope.wav"/> + <prompt phrase="stockman" filename="stockman.wav"/> + <prompt phrase="stopwatch" filename="stopwatch.wav"/> + <prompt phrase="stormy" filename="stormy.wav"/> + <prompt phrase="stupendous" filename="stupendous.wav"/> + <prompt phrase="sugar" filename="sugar.wav"/> + <prompt phrase="supportive" filename="supportive.wav"/> + <prompt phrase="surmount" filename="surmount.wav"/> + <prompt phrase="surrender" filename="surrender.wav"/> + <prompt phrase="suspense" filename="suspense.wav"/> + <prompt phrase="suspicious" filename="suspicious.wav"/> + <prompt phrase="sweatband" filename="sweatband.wav"/> + <prompt phrase="swelter" filename="swelter.wav"/> + <prompt phrase="sympathy" filename="sympathy.wav"/> + <prompt phrase="tactics" filename="tactics.wav"/> + <prompt phrase="talon" filename="talon.wav"/> + <prompt phrase="tambourine" filename="tambourine.wav"/> + <prompt phrase="tapeworm" filename="tapeworm.wav"/> + <prompt phrase="telephone" filename="telephone.wav"/> + <prompt phrase="tempest" filename="tempest.wav"/> + <prompt phrase="therapist" filename="therapist.wav"/> + <prompt phrase="tiger" filename="tiger.wav"/> + <prompt phrase="tissue" filename="tissue.wav"/> + <prompt phrase="tobacco" filename="tobacco.wav"/> + <prompt phrase="tolerance" filename="tolerance.wav"/> + <prompt phrase="tomorrow" filename="tomorrow.wav"/> + <prompt phrase="tonic" filename="tonic.wav"/> + <prompt phrase="topmost" filename="topmost.wav"/> + <prompt phrase="torpedo" filename="torpedo.wav"/> + <prompt phrase="tracker" filename="tracker.wav"/> + <prompt phrase="tradition" filename="tradition.wav"/> + <prompt phrase="transit" filename="transit.wav"/> + <prompt phrase="trauma" filename="trauma.wav"/> + <prompt phrase="travesty" filename="travesty.wav"/> + <prompt phrase="treadmill" filename="treadmill.wav"/> + <prompt phrase="trombonist" filename="trombonist.wav"/> + <prompt phrase="trouble" filename="trouble.wav"/> + <prompt phrase="truncated" filename="truncated.wav"/> + <prompt phrase="tumor" filename="tumor.wav"/> + <prompt phrase="tunnel" filename="tunnel.wav"/> + <prompt phrase="tycoon" filename="tycoon.wav"/> + <prompt phrase="typewriter" filename="typewriter.wav"/> + <prompt phrase="ultimate" filename="ultimate.wav"/> + <prompt phrase="uncut" filename="uncut.wav"/> + <prompt phrase="undaunted" filename="undaunted.wav"/> + <prompt phrase="underfoot" filename="underfoot.wav"/> + <prompt phrase="unearth" filename="unearth.wav"/> + <prompt phrase="unicorn" filename="unicorn.wav"/> + <prompt phrase="unify" filename="unify.wav"/> + <prompt phrase="universe" filename="universe.wav"/> + <prompt phrase="unravel" filename="unravel.wav"/> + <prompt phrase="unwind" filename="unwind.wav"/> + <prompt phrase="upcoming" filename="upcoming.wav"/> + <prompt phrase="uproot" filename="uproot.wav"/> + <prompt phrase="upset" filename="upset.wav"/> + <prompt phrase="upshot" filename="upshot.wav"/> + <prompt phrase="vacancy" filename="vacancy.wav"/> + <prompt phrase="vagabond" filename="vagabond.wav"/> + <prompt phrase="vapor" filename="vapor.wav"/> + <prompt phrase="vertigo" filename="vertigo.wav"/> + <prompt phrase="village" filename="village.wav"/> + <prompt phrase="virus" filename="virus.wav"/> + <prompt phrase="visitor" filename="visitor.wav"/> + <prompt phrase="vocalist" filename="vocalist.wav"/> + <prompt phrase="voyager" filename="voyager.wav"/> + <prompt phrase="waffle" filename="waffle.wav"/> + <prompt phrase="wallet" filename="wallet.wav"/> + <prompt phrase="warranty" filename="warranty.wav"/> + <prompt phrase="watchword" filename="watchword.wav"/> + <prompt phrase="wayside" filename="wayside.wav"/> + <prompt phrase="whimsical" filename="whimsical.wav"/> + <prompt phrase="willow" filename="willow.wav"/> + <prompt phrase="woodlark" filename="woodlark.wav"/> + <prompt phrase="yesteryear" filename="yesteryear.wav"/> + <!-- Event prompts --> + <prompt phrase="Bienvenidos al servicio de inscripción ZRTP." filename="zrtp-enroll_welcome.wav"/> + <prompt phrase="Usted debe verificar la cadena de carácteres con su destino. Si no coincide, indica la presencia de una escucha telefónica." filename="zrtp-check_sas.wav"/> + <prompt phrase="Solo teléfonos autenticados pueden confiar en llamadas securizadas con ZRTP. Su teléfono no está autenticado con este sistema, por lo que esta llamada no estará securizada." filename="zrtp-enroll_not_sip_registered.wav"/> + <prompt phrase="Su teléfono indica que confia en este sistema para realizar llamadas seguras con ZRTP, no necesita hacer nada más." filename="zrtp-enroll_already_enrolled.wav"/> + <prompt phrase="Solo teléfonos soportando el protócolo ZRTP pueden usar esta extensión. Su teléfono no tiene ZRTP habilitado, por lo que esta llamada no estará securizada." filename="zrtp-enroll_notzrtp.wav"/> + <prompt phrase="Este sistema esta configurado para manejar llamadas cifradas con ZRTP. Decida si permite al sistema tener la posibilidad de interceptar o monitorizar su llamada. Puede colgar una vez confirmado." filename="zrtp-enroll_confirmed.wav"/> + <prompt phrase="Compara verbalmente este código de autenticación con su destino." filename="zrtp-is_secure.wav"/> + <prompt phrase="El código de autenticación no está verificado." filename="zrtp-is_unverified.wav"/> + <prompt phrase="El código de autenticación está verificado." filename="zrtp-is_verified.wav"/> + <prompt phrase="Gracias por llamar. Adiós." filename="zrtp-thankyou_goodbye.wav"/> + <prompt phrase="Algún error ha ocurrido." filename="zrtp-somethings_wrong.wav"/> + <prompt phrase="Error." filename="zrtp-status_error.wav"/> + <prompt phrase="Esta llamada no está protegida." filename="zrtp-status_notsecure.wav"/> + <prompt phrase="Esta llamada está protegida." filename="zrtp-status_secure.wav"/> + <prompt phrase="Securizando su llamada." filename="zrtp-status_securing.wav"/> + </zrtp> + </es_ES> +<language> diff --git a/docs/phrase/phrase_es_MX.xml b/docs/phrase/phrase_es_MX.xml new file mode 100644 index 0000000..527f8c3 --- /dev/null +++ b/docs/phrase/phrase_es_MX.xml @@ -0,0 +1,993 @@ +<language> + <es_MX> + <ascii> + <prompt phrase="Espacio" filename="32.wav"/> + <prompt phrase="Signo de número" filename="35.wav"/> + <prompt phrase="Asterisco" filename="42.wav"/> + <prompt phrase="Punto" filename="46.wav"/> + <prompt phrase="A" filename="97.wav"/> + <prompt phrase="B" filename="98.wav"/> + <prompt phrase="C" filename="99.wav"/> + <prompt phrase="D" filename="100.wav"/> + <prompt phrase="E" filename="101.wav"/> + <prompt phrase="F" filename="102.wav"/> + <prompt phrase="G" filename="103.wav"/> + <prompt phrase="H" filename="104.wav"/> + <prompt phrase="I" filename="105.wav"/> + <prompt phrase="J" filename="106.wav"/> + <prompt phrase="K" filename="107.wav"/> + <prompt phrase="L" filename="108.wav"/> + <prompt phrase="M" filename="109.wav"/> + <prompt phrase="N" filename="110.wav"/> + <prompt phrase="Ã" filename="Ã.wav"/> + <prompt phrase="O" filename="111.wav"/> + <prompt phrase="P" filename="112.wav"/> + <prompt phrase="Q" filename="113.wav"/> + <prompt phrase="R" filename="114.wav"/> + <prompt phrase="S" filename="115.wav"/> + <prompt phrase="T" filename="116.wav"/> + <prompt phrase="U" filename="117.wav"/> + <prompt phrase="V" filename="118.wav"/> + <prompt phrase="W" filename="119.wav"/> + <prompt phrase="X" filename="120.wav"/> + <prompt phrase="Y" filename="121.wav"/> + <prompt phrase="Z" filename="122.wav"/> + </ascii> + <phonetic-ascii> + <prompt phrase="Espacio" filename="32.wav"/> + <prompt phrase="Punto" filename="46.wav"/> + <prompt phrase="Alpha" filename="97.wav"/> + <prompt phrase="Bravo" filename="98.wav"/> + <prompt phrase="Charlie" filename="99.wav"/> + <prompt phrase="Delta" filename="100.wav"/> + <prompt phrase="Echo" filename="101.wav"/> + <prompt phrase="Foxtrot" filename="102.wav"/> + <prompt phrase="Golf" filename="103.wav"/> + <prompt phrase="Hotel" filename="104.wav"/> + <prompt phrase="India" filename="105.wav"/> + <prompt phrase="Juliet" filename="106.wav"/> + <prompt phrase="Kilo" filename="107.wav"/> + <prompt phrase="Lima" filename="108.wav"/> + <prompt phrase="Mike" filename="109.wav"/> + <prompt phrase="November" filename="110.wav"/> + <prompt phrase="Oscar" filename="111.wav"/> + <prompt phrase="Papa" filename="112.wav"/> + <prompt phrase="Quebec" filename="113.wav"/> + <prompt phrase="Romeo" filename="114.wav"/> + <prompt phrase="Sierra" filename="115.wav"/> + <prompt phrase="Tango" filename="116.wav"/> + <prompt phrase="Unifor" filename="117.wav"/> + <prompt phrase="Victor" filename="118.wav"/> + <prompt phrase="Whiskey" filename="119.wav"/> + <prompt phrase="Xray" filename="120.wav"/> + <prompt phrase="Yankee" filename="121.wav"/> + <prompt phrase="Zulu" filename="122.wav"/> + </phonetic-ascii> + <digits> + <prompt phrase="Cero" filename="0.wav"/> + <prompt phrase="Uno" filename="1.wav"/> + <prompt phrase="Dos" filename="2.wav"/> + <prompt phrase="Tres" filename="3.wav"/> + <prompt phrase="Cuatro" filename="4.wav"/> + <prompt phrase="Cinco" filename="5.wav"/> + <prompt phrase="Seis" filename="6.wav"/> + <prompt phrase="Siete" filename="7.wav"/> + <prompt phrase="Ocho" filename="8.wav"/> + <prompt phrase="Nueve" filename="9.wav"/> + <prompt phrase="Diez" filename="10.wav"/> + <prompt phrase="Once" filename="11.wav"/> + <prompt phrase="Doce" filename="12.wav"/> + <prompt phrase="Trece" filename="13.wav"/> + <prompt phrase="Catorce" filename="14.wav"/> + <prompt phrase="Quince" filename="15.wav"/> + <prompt phrase="Dieciséis" filename="16.wav"/> + <prompt phrase="Diecisiete" filename="17.wav"/> + <prompt phrase="Dieciocho" filename="18.wav"/> + <prompt phrase="Diecinueve" filename="19.wav"/> + <prompt phrase="Veinte" filename="20.wav"/> + <prompt phrase="Veinti" filename="veinti.wav"/> + <prompt phrase="Treinta" filename="30.wav"/> + <prompt phrase="Cuarenta" filename="40.wav"/> + <prompt phrase="Cincuenta" filename="50.wav"/> + <prompt phrase="Sesenta" filename="60.wav"/> + <prompt phrase="Setenta" filename="70.wav"/> + <prompt phrase="Ochenta" filename="80.wav"/> + <prompt phrase="Noventa" filename="90.wav"/> + <prompt phrase="Cien" filename="100.wav"/> + <prompt phrase="Quinientos" filename="500.wav"/> + <prompt phrase="Setecientos" filename="700.wav"/> + <prompt phrase="Novecientos" filename="900.wav"/> + <prompt phrase="Punto" filename="dot.wav"/> + <prompt phrase="Primero" filename="h-1.wav"/> + <prompt phrase="Segundo" filename="h-2.wav"/> + <prompt phrase="Tercero" filename="h-3.wav"/> + <prompt phrase="Cuarto" filename="h-4.wav"/> + <prompt phrase="Quinto" filename="h-5.wav"/> + <prompt phrase="Sexto" filename="h-6.wav"/> + <prompt phrase="Séptimo" filename="h-7.wav"/> + <prompt phrase="Octavo" filename="h-8.wav"/> + <prompt phrase="Noveno" filename="h-9.wav"/> + <prompt phrase="Décimo" filename="h-10.wav"/> + <prompt phrase="Undécimo" filename="h-11.wav"/> + <prompt phrase="Duodécimo" filename="h-12.wav"/> + <prompt phrase="Decimotercero" filename="h-13.wav"/> + <prompt phrase="Decimocuarto" filename="h-14.wav"/> + <prompt phrase="Decimoquinto" filename="h-15.wav"/> + <prompt phrase="Decimosexto" filename="h-16.wav"/> + <prompt phrase="Decimoséptimo" filename="h-17.wav"/> + <prompt phrase="Decimoctavo" filename="h-18.wav"/> + <prompt phrase="Decimonoveno" filename="h-19.wav"/> + <prompt phrase="Vigésimo" filename="h-20.wav"/> + <prompt phrase="Trigésimo" filename="h-30.wav"/> + <prompt phrase="Un" filename="un.wav"/> + <prompt phrase="Ciento" filename="hundred.wav"/> + <prompt phrase="Cientos" filename="hundreds.wav"/> + <prompt phrase="Mil" filename="thousand.wav"/> + <prompt phrase="Millón" filename="million.wav"/> + <prompt phrase="Millones" filename="millions.wav"/> + <prompt phrase="PerÃodo" filename="period.wav"/> + <prompt phrase="Punto" filename="point.wav"/> + <prompt phrase="Signo de número" filename="pound.wav"/> + <prompt phrase="Asterisco" filename="star.wav"/> + </digits> + <currency> + <prompt phrase="Y" filename="and.wav"/> + <prompt phrase="Centavo" filename="cent.wav"/> + <prompt phrase="Central" filename="central.wav"/> + <prompt phrase="Centavos por minuto" filename="cents-per-minute.wav"/> + <prompt phrase="Centavos" filename="cents.wav"/> + <prompt phrase="Dólar" filename="dollar.wav"/> + <prompt phrase="Dólares" filename="dollars.wav"/> + <prompt phrase="Menos" filename="minus.wav"/> + <prompt phrase="Negativo" filename="negative.wav"/> + </currency> + <time> + <prompt phrase="A.M." filename="a-m.wav"/> + <prompt phrase="A" filename="at.wav"/> + <prompt phrase="Domingo" filename="day-0.wav"/> + <prompt phrase="Lunes" filename="day-1.wav"/> + <prompt phrase="Martes" filename="day-2.wav"/> + <prompt phrase="Miércoles" filename="day-3.wav"/> + <prompt phrase="Jueves" filename="day-4.wav"/> + <prompt phrase="Viernes" filename="day-5.wav"/> + <prompt phrase="Sábado" filename="day-6.wav"/> + <prompt phrase="Hora" filename="hour.wav"/> + <prompt phrase="Horas" filename="hours.wav"/> + <prompt phrase="Minuto" filename="minute.wav"/> + <prompt phrase="Minutos" filename="minutes.wav"/> + <prompt phrase="Enero" filename="mon-0.wav"/> + <prompt phrase="Febrero" filename="mon-1.wav"/> + <prompt phrase="Marzo" filename="mon-2.wav"/> + <prompt phrase="Abril" filename="mon-3.wav"/> + <prompt phrase="Mayo" filename="mon-4.wav"/> + <prompt phrase="Junio" filename="mon-5.wav"/> + <prompt phrase="Julio" filename="mon-6.wav"/> + <prompt phrase="Agosto" filename="mon-7.wav"/> + <prompt phrase="Septiembre" filename="mon-8.wav"/> + <prompt phrase="Octubre" filename="mon-9.wav"/> + <prompt phrase="Noviembre" filename="mon-10.wav"/> + <prompt phrase="Diciembre" filename="mon-11.wav"/> + <prompt phrase="En punto" filename="oclock.wav"/> + <prompt phrase="P.M." filename="p-m.wav"/> + <prompt phrase="Segundo" filename="second.wav"/> + <prompt phrase="Segundos" filename="seconds.wav"/> + <prompt phrase="Hoy" filename="today.wav"/> + <prompt phrase="Mañana" filename="tomorrow.wav"/> + <prompt phrase="Ayer" filename="yesterday.wav"/> + </time> + <voicemail> + <prompt phrase="La persona en la extensión..." filename="vm-person.wav"/> + <prompt phrase="Marcado urgente." filename="vm-marked-urgent.wav"/> + <prompt phrase="Mandado por correo electrónico." filename="vm-emailed.wav"/> + <prompt phrase="Usted tiene..." filename="vm-you_have.wav"/> + <prompt phrase="Por favor ingrese su número de usuario, seguido por..." filename="vm-enter_id.wav"/> + <prompt phrase="Por favor ingrese su contraseña, seguido por..." filename="vm-enter_pass.wav"/> + <prompt phrase="Inicio de sesión incorrectos." filename="vm-fail_auth.wav"/> + <prompt phrase="Bienvenido a su buzon de voz." filename="vm-hello.wav"/> + <prompt phrase="Adiós." filename="vm-goodbye.wav"/> + <prompt phrase="Después del tono, por favor anote su nombre, pulse cualquier tecla o deje de hablar para poner fin a la grabación." filename="vm-record_name1.wav"/> + <prompt phrase="Elija un saludo entre 1 y 9." filename="vm-choose_greeting_choose.wav"/> + <prompt phrase="Valor inválido." filename="vm-choose_greeting_fail.wav"/> + <prompt phrase="Demasiados intentos fallidos." filename="vm-abort.wav"/> + <prompt phrase="Para cambiar su clave." filename="vm-change_password.wav"/> + <prompt phrase="Grabe su saludo después del tono, pulse cualquier tecla o deje de hablar para poner fin a la grabación" filename="vm-record_greeting.wav"/> + <prompt phrase="Grabe su mensaje después del tono, pulse cualquier tecla o deje de hablar para poner fin a la grabación" filename="vm-record_message.wav"/> + <prompt phrase="...no está disponible." filename="vm-play_greeting.wav"/> + <prompt phrase="Urgente nuevo" filename="vm-urgent-new.wav"/> + <prompt phrase="Nuevo" filename="vm-new.wav"/> + <prompt phrase="Urgente guardado" filename="vm-urgent-saved.wav"/> + <prompt phrase="Guardado" filename="vm-saved.wav"/> + <prompt phrase="Mensaje" filename="vm-message.wav"/> + <prompt phrase="Mensajes" filename="vm-messages.wav"/> + <prompt phrase="Presione" filename="vm-press.wav"/> + <prompt phrase="Para escuchar mensajes nuevos..." filename="vm-listen_new.wav"/> + <prompt phrase="Para escuchar mensajes guardados..." filename="vm-listen_saved.wav"/> + <prompt phrase="Para opciones avanzadas..." filename="vm-advanced.wav"/> + <prompt phrase="Para salir..." filename="vm-to_exit.wav"/> + <prompt phrase="Para guardar un saludo..." filename="vm-record_greeting.wav"/> + <prompt phrase="Para elegir un saludo..." filename="vm-choose_greeting.wav"/> + <prompt phrase="Para grabar su nombre..." filename="vm-record_name2.wav"/> + <prompt phrase="Para el menú principal..." filename="vm-main_menu.wav"/> + <prompt phrase="Para escuchar la grabación..." filename="vm-listen_to_recording.wav"/> + <prompt phrase="Para guardar la grabación..." filename="vm-save_recording.wav"/> + <prompt phrase="Para regrabar..." filename="vm-rerecord.wav"/> + <prompt phrase="Para marcar este mensaje como urgente..." filename="vm-mark-urgent.wav"/> + <prompt phrase="Para continuar..." filename="vm-continue.wav"/> + <prompt phrase="Para escuchar la grabación de nuevo..." filename="vm-listen_to_recording_again.wav"/> + <prompt phrase="Para eliminar la grabación..." filename="vm-delete_recording.wav"/> + <prompt phrase="Para enviar la grabación a su e-mail..." filename="vm-forward_to_email.wav"/> + <prompt phrase="Saludo" filename="vm-greeting.wav"/> + <prompt phrase="Seleccionado" filename="vm-selected.wav"/> + <prompt phrase="...no está disponible." filename="vm-not_available.wav"/> + <prompt phrase="Mensaje número..." filename="vm-message_number.wav"/> + <prompt phrase="Eliminado" filename="vm-deleted.wav"/> + <prompt phrase="Su grabación es demasiado corta, por favor intente de nuevo." filename="vm-too-small.wav"/> + <prompt phrase="...en la bandeja de entrada." filename="vm-in_folder.wav"/> + <prompt phrase="Para devolver la llamada..." filename="vm-return_call.wav"/> + <prompt phrase="Urgente" filename="vm-urgent.wav"/> + <prompt phrase="Este buzón está lleno. Por favor intente llamar mas tarde." filename="vm-mailbox_full.wav"/> + <prompt phrase="Bienvenido a su nuevo buzón de voz. Para escuchar el tutorial y configurar su buzón, pulse 1. Para saltarlo pulse 2." filename="vm-tutorial_yes_no.wav"/> + <prompt phrase="Necesito grabar su nombre y apellido. Esta grabación se usará entre otros en el servicio de directorio." filename="vm-tutorial_record_name.wav"/> + <prompt phrase="Su número de identificación personal o PIN sirve para impedir a terceros el acceso a sus mensajes. Desea cambiar su PIN ahora?" filename="vm-tutorial_change_pin.wav"/> + </voicemail> + <directory> + <prompt phrase="Por favor introduzca las primeras letras del nombre buscado." filename="dir-enter_person.wav"/> + <prompt phrase="...apellido..." filename="dir-last_name.wav"/> + <prompt phrase="Para buscar por..." filename="dir-to_search_by.wav"/> + <prompt phrase="...nombre..." filename="dir-first_name.wav"/> + <prompt phrase="No hay resultados que coincidan con su busqueda." filename="dir-no_matching_results.wav"/> + <prompt phrase="...resultados coinciden con su busqueda." filename="dir-result_match.wav"/> + <prompt phrase="Su busqueda genera demasiados resultados." filename="dir-too_many_result.wav"/> + <prompt phrase="No hay más resultados." filename="dir-no_more_results.wav"/> + <prompt phrase="Resultado número..." filename="dir-result_number.wav"/> + <prompt phrase="...en la extensión..." filename="dir-at_extension.wav"/> + <prompt phrase="Para seleccionar este resultado..." filename="dir-to_select_entry.wav"/> + <prompt phrase="Para el resultado siguiente..." filename="dir-for_next.wav"/> + <prompt phrase="Para el resultado previo..." filename="dir-for_prev.wav"/> + <prompt phrase="Para empezar una nueva busqueda..." filename="dir-start_new_search.wav"/> + <prompt phrase="Necesita especificar un mÃnimo de..." filename="dir-specify_mininum.wav"/> + <prompt phrase="...letras del nombre buscado." filename="dir-letters_of_person_name.wav"/> + <prompt phrase="Por favor intentelo de nuevo." filename="dir-please_try_again.wav"/> + <prompt phrase="Pulse..." filename="dir-press.wav" info="we can copy vm/vm-press.wav"/> + </directory> + <conference> + <prompt phrase="NULL" filename="conf-ack.wav" type="tone"/> + <prompt phrase="NULL" filename="conf-nack.wav" type="tone"/> + <prompt phrase="Usted ahora está silenciado." filename="conf-muted.wav"/> + <prompt phrase="Usted ya no está silenciado." filename="conf-unmuted.wav"/> + <prompt phrase="En este momento usted es la única persona en la conferencia." filename="conf-alone.wav"/> + <prompt phrase="NULL" filename="conf-perpetual.wav" type="music"/> + <prompt phrase="NULL" filename="conf-enter.wav" type="tone"/> + <prompt phrase="NULL" filename="conf-exit.wav" type="tone"/> + <prompt phrase="Usted ha sido expulsado de la conferencia." filename="conf-kicked.wav"/> + <prompt phrase="Esta conferencia está bloqueada." filename="conf-locked.wav"/> + <prompt phrase="La conferencia está ahora bloqueada." filename="conf-is-locked.wav"/> + <prompt phrase="La conferencia está ahora desbloqueada." filename="conf-is-unlocked.wav"/> + <prompt phrase="Por favor ingrese el PIN de la conferencia." filename="conf-pin.wav"/> + <prompt phrase="PIN inválido, intente de nuevo." filename="conf-bad-pin.wav"/> + <prompt phrase="Hasta luego." filename="conf-goodbye.wav"/> + <prompt phrase="Bienvenido a la conferencia." filename="conf-welcome.wav"/> + </conference> + <ivr> + <prompt phrase="Número de cuenta" filename="ivr-account_number.wav"/> + <prompt phrase="Conectar con quien llama" filename="ivr-connect_to_caller.wav"/> + <prompt phrase="Si conoce la extensión, por favor ingrésela ahora" filename="ivr-enter_ext_pound.wav"/> + <prompt phrase="por favor ingrese el número de una extensión seguido del signo de número" filename="ivr-enter_ext.wav"/> + <prompt phrase="Para esta persona..." filename="ivr-for_this_person.wav"/> + <prompt phrase="Por favor espere mientras conecto su llamada." filename="ivr-hold_connect_call.wav"/> + <prompt phrase="Lo siento..." filename="ivr-im_sorry.wav"/> + <prompt phrase="Por favor..." filename="ivr-please.wav"/> + <prompt phrase="Por favor devuelva nuestra llamada al..." filename="ivr-please_return_our_call_at.wav"/> + <prompt phrase="Acerca del número de referencia" filename="ivr-regarding_reference_number.wav"/> + <prompt phrase="Este es un ejemplo de un submenú de audio respuesta..." filename="ivr-sample_submenu.wav"/> + <prompt phrase="Por favor diga su nombre después del tono." filename="ivr-say_name.wav"/> + <prompt phrase="Enviar a esta persona que llama al buzón de voz." filename="ivr-send_to_voicemail.wav"/> + <prompt phrase="Para hablar con un representante de servicio al cliente..." filename="ivr-speak_to_a_customer_service_representative.wav"/> + <prompt phrase="Tomar un mensaje" filename="ivr-take_a_message.wav"/> + <prompt phrase="Gracias" filename="ivr-thank_you.wav"/> + <prompt phrase="Esa fue una entrada inválida." filename="ivr-that_was_an_invalid_entry.wav"/> + <prompt phrase="Esta es una llamada de..." filename="ivr-this_is_a_call_from.wav"/> + <prompt phrase="Este menú de audiorrespuesta le permitirá probar algunas de las caracterÃsticas..." filename="ivr-this_ivr_will_let_you_test_features.wav"/> + <prompt phrase="Para llamar a la conferencia de FreeSWITCH..." filename="ivr-to_call_the_freeswitch_conference.wav"/> + <prompt phrase="Para hacer una prueba de eco de FreeSWITCH..." filename="ivr-to_do_a_freeswitch_echo_test.wav"/> + <prompt phrase="Para hacer una prueba de eco de FWD..." filename="ivr-to_do_a_fwd_echo_test.wav"/> + <prompt phrase="Para escuchar un ejemplo de un submenú de audio respuesta..." filename="ivr-to_hear_sample_submenu.wav"/> + <prompt phrase="Para escuchar simios gritando..." filename="ivr-to_hear_screaming_monkeys.wav"/> + <prompt phrase="Para escuchar música de llamada en espera..." filename="ivr-to_listen_to_moh.wav"/> + <prompt phrase="Para repetir estas opciones..." filename="ivr-to_repeat_these_options.wav"/> + <prompt phrase="Para regresar al menú anterior..." filename="ivr-to_return_to_previous_menu.wav"/> + <prompt phrase="Para hablar con un operador..." filename="ivr-to_speak_with_an_operator.wav"/> + <prompt phrase="Bienvenido a FreeSWITCH, el futuro de la telefonÃa." filename="ivr-welcome_to_freeswitch.wav"/> + <prompt phrase="Usted puede colgar en cualquier momento para salir." filename="ivr-you_may_exit_by_hanging_up.wav"/> + <prompt phrase="O" filename="ivr-or.wav"/> + <prompt phrase="No" filename="ivr-not.wav"/> + <prompt phrase="Llamar" filename="ivr-call.wav"/> + <prompt phrase="Usted puede..." filename="ivr-you_may.wav"/> + <prompt phrase="Hola" filename="ivr-hello.wav"/> + <prompt phrase="Usando el teclado de su teléfono..." filename="ivr-use_telephone_keypad.wav"/> + <prompt phrase="por favor deletree el nombre de la persona a la cual está intentando contactar." filename="ivr-spell_name.wav"/> + <prompt phrase="Primero el apellido" filename="ivr-last_name_first.wav"/> + <prompt phrase="Primero el nombre" filename="ivr-first_name_first.wav"/> + <prompt phrase="Presione 1 para Q ó Z." filename="ivr-press_one_q_or_z.wav"/> + <prompt phrase="Ventas" filename="ivr-sales.wav"/> + <prompt phrase="Servicio al cliente" filename="ivr-customer_service.wav"/> + <prompt phrase="Soporte técnico" filename="ivr-technical_support.wav"/> + <prompt phrase="Operador" filename="ivr-operator.wav"/> + <prompt phrase="Usted marcó una extensión inválida." filename="ivr-you_have_dialed_an_invalid_extension.wav"/> + <prompt phrase="Por favor introduzca su número de extensión, seguido de la tecla almohadilla." filename="ivr-please_enter_extension_followed_by_pound.wav"/> + <prompt phrase="Por favor introduzca su contraseña, seguido de la tecla almohadilla." filename="ivr-please_enter_pin_followed_by_pound.wav"/> + <prompt phrase="Su contraseña o extensión es inválida." filename="ivr-pin_or_extension_is-invalid.wav"/> + <prompt phrase="Usted esta a punto de asociar este teléfono a su cuenta..." filename="ivr-you_are_about_to_provision_this_phone.wav"/> + <prompt phrase="Por favor vuelva a introducir su contraseña para confirmar." filename="ivr-please_reenter_your_pin.wav"/> + <prompt phrase="Para registrarse en ClueCon, por favor pulse..." filename="ivr-register_for_cluecon.wav"/> + <prompt phrase="Para conectarse..." filename="ivr-to_log_in.wav"/> + <prompt phrase="Para desconectarse..." filename="ivr-to_log_out.wav"/> + <prompt phrase="Usted está ahora conectado." filename="ivr-you_are_now_logged_in.wav"/> + <prompt phrase="Usted está ahora desconectado." filename="ivr-you_are_now_logged_out.wav"/> + <prompt phrase="Por favor intentelo de nuevo." filename="ivr-please_try_again.wav"/> + <prompt phrase="Usted está a punto de asociar este teléfono a su cuenta de forma permanente." filename="ivr-provision_phone_permanently_to_extension.wav"/> + <prompt phrase="Por favor introduzca su número de extensión con la cual desea asociar su teléfono, seguido de la tecla almohadilla." filename="ivr-extension_to_provision_this_phone.wav"/> + <prompt phrase="Gracias, este teléfono va a reiniciarse ahora." filename="ivr-this_phone_will_now_reboot.wav"/> + <prompt phrase="Gracias, su grabación ha sido guardada." filename="ivr-recording_saved.wav"/> + <prompt phrase="Pulse 1 para guardar su grabación. Pulse 2 para escuchar su grabación. Pulse 3 para volver a grabar." filename="ivr-save_review_record.wav"/> + <prompt phrase="En este momento, el sistema no puede guardar su fichero de audio. Por favor intentelo de nuevo." filename="ivr-unable_save.wav"/> + <prompt phrase="Usted está en la posición..." filename="ivr-you_are_number.wav"/> + <prompt phrase="...en la cola de espera." filename="ivr-in_line.wav"/> + <prompt phrase="Gracias por permanecer en espera." filename="ivr-thank_you_for_holding.wav"/> + <prompt phrase="El tiempo estimado de espera es..." filename="ivr-estimated_hold_time.wav"/> + <prompt phrase="Más de..." filename="ivr-more_than.wav"/> + <prompt phrase="Menos de..." filename="ivr-less_than.wav"/> + <prompt phrase="Empieze a grabar." filename="ivr-begin_recording.wav "/> + <prompt phrase="El desvÃo de llamada ha sido desactivado." filename="ivr-call_forwarding_has_been_cancelled.wav"/> + <prompt phrase="El desvÃo de llamada ha sido activado." filename="ivr-call_forwarding_has_been_set.wav"/> + <prompt phrase="Por favor introduzca el número de teléfono." filename="ivr-please_enter_the_phone_number.wav"/> + <prompt phrase="Por favor diga su nombre, y la razón de la llamada." filename="ivr-please_state_your_name_and_reason_for_calling.wav"/> + <prompt phrase="Para aceptar, pulse 1. Para rechazar, pulse 2. Para mandar a buzón de voz, pulse 3." filename="ivr-accept_reject_voicemail.wav"/> + <prompt phrase="Llamada entrante." filename="ivr-incoming_call.wav"/> + <prompt phrase="Gracias por llamar." filename="ivr-thank_you_for_calling.wav"/> + <prompt phrase="Por favor mentengase a la espera. Su llamada será atendida en un momento." filename="ivr-stay_on_line_call_answered_momentarily.wav"/> + <prompt phrase="Su llamada está siendo procesada." filename="ivr-call_being_transferred.wav"/> + <prompt phrase="Por favor disfrute de la música mientras su llamada está siendo procesada..." filename="ivr-enjoy_music_while_transfer.wav"/> + <prompt phrase="Usted tiene una llamada de..." filename="ivr-call_from.wav"/> + <prompt phrase="Este menú no tiene entradas. Por favor contacte con el administrador." filename="ivr-no_menu_items.wav"/> + <prompt phrase="Para el servicio de directorio, pulse..." filename="ivr-for_directory_press.wav"/> + <prompt phrase="Usando las teclas de su teléfono..." filename="ivr-using_telephone_keypad.wav"/> + <prompt phrase="Introduzca las primeras letras del apellido de la persona." filename="ivr-enter_letters_last_name.wav"/> + <prompt phrase="Introduzca las primeras letras del nombre de la persona." filename="ivr-enter_letters_first_name.wav"/> + <prompt phrase="Introduzca las primeras letras del nombre o apellido de la persona." filename="ivr-enter_letters_first_or_last_name.wav"/> + <prompt phrase="Si es correcto, pulse..." filename="ivr-if_correct_press.wav"/> + <prompt phrase="Sino, pulse..." filename="ivr-if_not_press.wav"/> + <prompt phrase="Cuando termine, pulse la tecla almohadilla." filename="ivr-finished_pound_hash_key.wav"/> + <prompt phrase="La función de No Molestar ha sido activada." filename="ivr-dnd_activated.wav"/> + <prompt phrase="La función de No Molestar ha sido desactivada." filename="ivr-dnd_cancelled.wav"/> + <prompt phrase="Pulse cualquier otro dÃgito..." filename="ivr-any_other_digit.wav"/> + <prompt phrase="Pulse uno si su respuesta es sÃ. Pulse dos si su respuesta es no." filename="ivr-one_yes_two_no.wav"/> + <prompt phrase="Por favor introduzca el número de la cola, seguido de la tecla almohadilla." filename="ivr-enter_queue_number.wav"/> + <prompt phrase="Por favor introduzca el..." filename="ivr-please_enter_the.wav"/> + <prompt phrase="Número." filename="ivr-number.wav"/> + <prompt phrase="...seguido de la tecla almohadilla." filename="ivr-followed_by_pound.wav"/> + <prompt phrase="El balance de la cuenta es..." filename="ivr-account_balance_is.wav"/> + <prompt phrase="Gracias por llamar. Si conoce la extensión de su destino, por favor marquela ahora. Para acceder al directorio, pulse..." filename="ivr-generic_greeting.wav"/> + <prompt phrase="...fichero..." filename="ivr-file.wav"/> + <prompt phrase="...ficheros..." filename="ivr-files-.wav"/> + <prompt phrase="Para una llamada de despertador..." filename="ivr-for_a_wakeup_call.wav"/> + <prompt phrase="Este es el servicio de despertador." filename="ivr-this_is_your_wakeup_call.wav"/> + <prompt phrase="Para solicitar una llamada de despertador..." filename="ivr-request_wakeup_call.wav"/> + <prompt phrase="Para confirmar la llamada de despertador..." filename="ivr-confirm_wakeup_call.wav"/> + <prompt phrase="Para anular la llamada de despertador..." filename="ivr-cancel_wakeup_call.wav"/> + <prompt phrase="Usted ha solicitado una llamada de despertador para..." filename="ivr-requested_wakeup_call_for.wav"/> + <prompt phrase="Usted no ha solicitado llamadas de despertador." filename="ivr-not_requested_wakeup_call.wav"/> + <prompt phrase="Su llamada de despertador ha sido anulada." filename="ivr-wakeup_call_cancelled.wav"/> + <prompt phrase="Para una llamada diaria de despertador..." filename="ivr-for_daily_wakeup_call.wav"/> + <prompt phrase="Llamada diaria de despertador..." filename="ivr-daily_wakeup_call.wav"/> + <prompt phrase="Para llamadas diarias de despertador..." filename="ivr-for_daily_wakeup_calls.wav"/> + <prompt phrase="Para una llamada de despertador única..." filename="ivr-for_one_time_wakeup_call.wav"/> + <prompt phrase="Llamada de despertador única..." filename="ivr-one_time_wakeup_call.wav"/> + <prompt phrase="...llamada de despertador..." filename="ivr-wakeup_call.wav"/> + <prompt phrase="¡Vamos despierta cielo!" filename="ivr-wakey_wakey_sunshine.wav"/> + <prompt phrase="Bienvenido." filename="ivr-welcome.wav"/> + <prompt phrase="Bienvenido a..." filename="ivr-welcome_to.wav"/> + <prompt phrase="Buenos dÃas." filename="ivr-good_morning.wav"/> + <prompt phrase="Buenas tardes." filename="ivr-good_afternoon.wav"/> + <prompt phrase="Buenas noches." filename="ivr-good_evening.wav"/> + <prompt phrase="Gracias." filename="ivr-Thank_you.wav"/> + <prompt phrase="Para..." filename="ivr-for.wav"/> + <prompt phrase="El tiempo de espera esta siendo anormalmente elevado." filename="ivr-longer_than_usual_hold_times.wav"/> + <prompt phrase="Usted es el..." filename="ivr-you_are_the.wav"/> + <prompt phrase="Un momento por favor." filename="ivr-one_moment_please.wav"/> + <prompt phrase="Su llamada será atendida según el orden de entrada." filename="ivr-call_answered_order_received.wav"/> + <prompt phrase="Por favor introduzca el número de conferencia, seguido de la tecla almohadilla." filename="conf-enter_conf_number.wav"/> + <prompt phrase="Introduzca el PIN de la conferencia, seguido de la tecla almohadilla." filename="conf-enter_conf_pin.wav"/> + <prompt phrase="...se incorporó a la conferencia." filename="conf-has_joined.wav"/> + <prompt phrase="...ha abandonado la conferencia." filename="conf-has_left.wav"/> + <prompt phrase="Usted entró..." filename="ivr-you_entered.wav"/> + <prompt phrase="Número de extensión..." filename="ivr-extension_number.wav"/> + <prompt phrase="Por favor mantengase a la espera mientras contactamos con su destino." filename="ivr-please_hold_while_party_contacted.wav"/> + <prompt phrase="Por favor disfrute de la música mientras le conectamos con su destino." filename="ivr-please_enjoy_music_while_party_reached.wav"/> + <prompt phrase="Gracias por llamar. Si conoce la extensión de su destino, por favor marquela ahora, o marque nueve para el servicio de directorio." filename="ivr-generic_greeting.wav"/> + <prompt phrase="Si es correcto, pulse 1. Sino, pulse 2." filename="ivr-if_correct_one_if_not_two.wav"/> + <prompt phrase="Para repetir esta información..." filename="ivr-repeat_this_information.wav"/> + <prompt phrase="No no no!" filename="ivr-no_no_no.wav"/> + <prompt phrase="Era su intención pulsar esta tecla?" filename="ivr-did_you_mean_to_press_key.wav"/> + <prompt phrase="Pensaba Usted DE VERDAD pulsar esta tecla?" filename="ivr-seriously_mean_to_press_key.wav"/> + <prompt phrase="Oh DA IGUAL." filename="ivr-oh_whatever.wav"/> + <prompt phrase="No más! Un error más y le colgaré a la cara." filename="ivr-one_more_mistake.wav"/> + <prompt phrase="Felicitaciones. Ha pulsado estrella. Esto no significa que ES una estrella. Tan solo significa que puede pulsar teclas y probablemente tiene dedos." filename="ivr-congratulations_you_pressed_star.wav"/> + <prompt phrase="Todos nuestros ingenieros están ocupados en demostrar lo impresionante que es el CudaTel." filename="ivr-engineers_busy_assisting_other_sales.wav"/> + <prompt phrase="La persona con la que intenta hablar no está disponible y no tiene buzón de voz." filename="vm-not_available_no_voicemail.wav"/> + <prompt phrase="Este mensaje se auto-destruira en 5, 4, 3, 2, 1..." filename="ivr-message_self_destruct.wav"/> + <prompt phrase="Su llamada ya está silenciada." filename="conf-you_are_already_muted.wav"/> + <prompt phrase="Su llamada ha sido silenciada en ambos sentidos." filename="conf-you_are_now_bidirectionally_muted.wav"/> + <prompt phrase="Todas sus llamadas nos pertenecen." filename="ivr-all_your_call_are_belong_to_us.wav"/> + <prompt phrase="Me encanta como está pulsando estas teclas!" filename="ivr-love_those_touch_tones.wav"/> + <prompt phrase="No, no tenemos bananas." filename="ivr-yes_we_have_no_bananas.wav"/> + <prompt phrase="Hombre, estas siendo ridÃculo!" filename="ivr-dude_you_suck.wav"/> + <prompt phrase="Su llamada es muy importante para nosotros, pero su bienestar mental no lo es, asi que estamos felices mantenerle a la espera, torturandole indefinidamente con nuestra péssima música en espera." filename="ivr-on_hold_indefinitely.wav"/> + <prompt phrase="...ha dejado el edificio." filename="ivr-has_left_the_building.wav"/> + <prompt phrase="Este teléfono no está asignado y no puede ser usado para realizar llamadas externas." filename="ivr-phone_is_unassigned.wav"/> + <prompt phrase="Este teléfono no está configurado correctamente." filename="ivr-phone_not_configured.wav"/> + <prompt phrase="Felicitaciones! Este teléfono está configurado correctamente y puede ahora ser asociado a un usuario." filename="ivr-phone_is_configured_properly.wav"/> + <prompt phrase="Por favor contacte con el administrador del sistema para obtener asistencia." filename="ivr-contact_system_administrator.wav"/> + <prompt phrase="Barracuda Networks" filename="ivr-barracuda_networks.wav"/> + <prompt phrase="CudaTel Communication Server" filename="ivr-cudatel_communication_server.wav"/> + <prompt phrase="Por favor introduzca las primeras letras del nombre o apellido de la persona." filename="dir-enter_person_first_or_last.wav"/> + <prompt phrase="No hay llamadas en espera en esta cola." filename="ivr-no_calls_waiting_in_queue.wav"/> + <prompt phrase="Brian West" filename="misc-Brian_West.wav"/> + <prompt phrase="Anthony Minessale" filename="misc-Anthony_Minessale.wav"/> + <prompt phrase="Michael Jerris" filename="misc-Michael_Jerris.wav"/> + <prompt phrase="Raymond Chandler" filename="misc-Raymond_Chandler.wav"/> + <prompt phrase="Michael Collins" filename="misc-Michael_Collins.wav"/> + <prompt phrase="Mark Mann" filename="misc-Mark_Mann.wav"/> + <prompt phrase="William King" filename="misc-William_King.wav"/> + <prompt phrase="Rudy Fleminger" filename="misc-Rudy_Fleminger.wav"/> + <prompt phrase="Andrew Thompson" filename="misc-Andrew_Thompson.wav"/> + <prompt phrase="Graham Saathoff" filename="misc-Graham_Saathoff.wav"/> + <prompt phrase="Nicholaus Belluni" filename="misc-Nicholaus_Belluni.wav"/> + <prompt phrase="Sean Heiney" filename="misc-Sean_Heiney.wav"/> + </ivr> + <misc> + <prompt phrase="Esta llamada ha sido asegurada." filename="call_secured.wav"/> + <prompt phrase="...seguido del signo de número." filename="followed.wav"/> + <prompt phrase="Si usted es esta persona..." filename="if_you_are_this_person.wav"/> + <prompt phrase="Si usted desea..." filename="if_you_would_like_to.wav"/> + <prompt phrase="Diga el número de referencia..." filename="provide_reference_number.wav"/> + <prompt phrase="Por favor pulse la extensión a la cual desea transferir." filename="transfer1.wav"/> + <prompt phrase="Transferir" filename="transfer2.wav"/> + <prompt phrase="Estamos tratando de contactar..." filename="we_are_trying_to_reach.wav"/> + <prompt phrase="Un error ha ocurrido, por favor contacte al administrador." filename="error.wav"/> + <prompt phrase="Su llamada será terminada en..." filename="misc-your_call_will_be_terminated_in.wav"/> + <prompt phrase="Su llamada ha sido terminada." filename="misc-your_call_has_been_terminated.wav"/> + </misc> + <zrtp> + <!-- base256 prompts for SAS --> + <prompt phrase="Algol" filename="Algol.wav"/> + <prompt phrase="Apollo" filename="Apollo.wav"/> + <prompt phrase="Athens" filename="Athens.wav"/> + <prompt phrase="Atlantic" filename="Atlantic.wav"/> + <prompt phrase="Aztec" filename="Aztec.wav"/> + <prompt phrase="Babylon" filename="Babylon.wav"/> + <prompt phrase="Belfast" filename="Belfast.wav"/> + <prompt phrase="Bradbury" filename="Bradbury.wav"/> + <prompt phrase="Brazilian" filename="Brazilian.wav"/> + <prompt phrase="Burbank" filename="Burbank.wav"/> + <prompt phrase="Burlington" filename="Burlington.wav"/> + <prompt phrase="Camelot" filename="Camelot.wav"/> + <prompt phrase="Capricorn" filename="Capricorn.wav"/> + <prompt phrase="Cherokee" filename="Cherokee.wav"/> + <prompt phrase="Chicago" filename="Chicago.wav"/> + <prompt phrase="Christmas" filename="Christmas.wav"/> + <prompt phrase="Dakota" filename="Dakota.wav"/> + <prompt phrase="December" filename="December.wav"/> + <prompt phrase="Dupont" filename="Dupont.wav"/> + <prompt phrase="Eskimo" filename="Eskimo.wav"/> + <prompt phrase="Galveston" filename="Galveston.wav"/> + <prompt phrase="Geiger" filename="Geiger.wav"/> + <prompt phrase="Hamilton" filename="Hamilton.wav"/> + <prompt phrase="Istanbul" filename="Istanbul.wav"/> + <prompt phrase="Jamaica" filename="Jamaica.wav"/> + <prompt phrase="Jupiter" filename="Jupiter.wav"/> + <prompt phrase="Medusa" filename="Medusa.wav"/> + <prompt phrase="Mohawk" filename="Mohawk.wav"/> + <prompt phrase="Montana" filename="Montana.wav"/> + <prompt phrase="Neptune" filename="Neptune.wav"/> + <prompt phrase="Norwegian" filename="Norwegian.wav"/> + <prompt phrase="Oakland" filename="Oakland.wav"/> + <prompt phrase="October" filename="October.wav"/> + <prompt phrase="Ohio" filename="Ohio.wav"/> + <prompt phrase="Orlando" filename="Orlando.wav"/> + <prompt phrase="Pacific" filename="Pacific.wav"/> + <prompt phrase="Pandora" filename="Pandora.wav"/> + <prompt phrase="Pegasus" filename="Pegasus.wav"/> + <prompt phrase="Pluto" filename="Pluto.wav"/> + <prompt phrase="Saturday" filename="Saturday.wav"/> + <prompt phrase="Scotland" filename="Scotland.wav"/> + <prompt phrase="Trojan" filename="Trojan.wav"/> + <prompt phrase="Virginia" filename="Virginia.wav"/> + <prompt phrase="Vulcan" filename="Vulcan.wav"/> + <prompt phrase="Waterloo" filename="Waterloo.wav"/> + <prompt phrase="Wichita" filename="Wichita.wav"/> + <prompt phrase="Wilmington" filename="Wilmington.wav"/> + <prompt phrase="Wyoming" filename="Wyoming.wav"/> + <prompt phrase="Yucatan" filename="Yucatan.wav"/> + <prompt phrase="Zulu" filename="Zulu.wav"/> + <prompt phrase="aardvark" filename="aardvark.wav"/> + <prompt phrase="absurd" filename="absurd.wav"/> + <prompt phrase="accrue" filename="accrue.wav"/> + <prompt phrase="acme" filename="acme.wav"/> + <prompt phrase="adrift" filename="adrift.wav"/> + <prompt phrase="adroitness" filename="adroitness.wav"/> + <prompt phrase="adult" filename="adult.wav"/> + <prompt phrase="adviser" filename="adviser.wav"/> + <prompt phrase="afflict" filename="afflict.wav"/> + <prompt phrase="aftermath" filename="aftermath.wav"/> + <prompt phrase="aggregate" filename="aggregate.wav"/> + <prompt phrase="ahead" filename="ahead.wav"/> + <prompt phrase="aimless" filename="aimless.wav"/> + <prompt phrase="alkali" filename="alkali.wav"/> + <prompt phrase="allow" filename="allow.wav"/> + <prompt phrase="almighty" filename="almighty.wav"/> + <prompt phrase="alone" filename="alone.wav"/> + <prompt phrase="ammo" filename="ammo.wav"/> + <prompt phrase="amulet" filename="amulet.wav"/> + <prompt phrase="amusement" filename="amusement.wav"/> + <prompt phrase="ancient" filename="ancient.wav"/> + <prompt phrase="antenna" filename="antenna.wav"/> + <prompt phrase="apple" filename="apple.wav"/> + <prompt phrase="applicant" filename="applicant.wav"/> + <prompt phrase="armistice" filename="armistice.wav"/> + <prompt phrase="article" filename="article.wav"/> + <prompt phrase="artist" filename="artist.wav"/> + <prompt phrase="assume" filename="assume.wav"/> + <prompt phrase="asteroid" filename="asteroid.wav"/> + <prompt phrase="atlas" filename="atlas.wav"/> + <prompt phrase="atmosphere" filename="atmosphere.wav"/> + <prompt phrase="autopsy" filename="autopsy.wav"/> + <prompt phrase="baboon" filename="baboon.wav"/> + <prompt phrase="backfield" filename="backfield.wav"/> + <prompt phrase="backward" filename="backward.wav"/> + <prompt phrase="backwater" filename="backwater.wav"/> + <prompt phrase="banjo" filename="banjo.wav"/> + <prompt phrase="barbecue" filename="barbecue.wav"/> + <prompt phrase="beaming" filename="beaming.wav"/> + <prompt phrase="bedlamp" filename="bedlamp.wav"/> + <prompt phrase="beehive" filename="beehive.wav"/> + <prompt phrase="beeswax" filename="beeswax.wav"/> + <prompt phrase="befriend" filename="befriend.wav"/> + <prompt phrase="belowground" filename="belowground.wav"/> + <prompt phrase="berserk" filename="berserk.wav"/> + <prompt phrase="bifocals" filename="bifocals.wav"/> + <prompt phrase="billiard" filename="billiard.wav"/> + <prompt phrase="bison" filename="bison.wav"/> + <prompt phrase="blackjack" filename="blackjack.wav"/> + <prompt phrase="blockade" filename="blockade.wav"/> + <prompt phrase="blowtorch" filename="blowtorch.wav"/> + <prompt phrase="bluebird" filename="bluebird.wav"/> + <prompt phrase="bodyguard" filename="bodyguard.wav"/> + <prompt phrase="bombast" filename="bombast.wav"/> + <prompt phrase="bookseller" filename="bookseller.wav"/> + <prompt phrase="bookshelf" filename="bookshelf.wav"/> + <prompt phrase="borderline" filename="borderline.wav"/> + <prompt phrase="bottomless" filename="bottomless.wav"/> + <prompt phrase="brackish" filename="brackish.wav"/> + <prompt phrase="bravado" filename="bravado.wav"/> + <prompt phrase="breadline" filename="breadline.wav"/> + <prompt phrase="breakaway" filename="breakaway.wav"/> + <prompt phrase="breakup" filename="breakup.wav"/> + <prompt phrase="brickyard" filename="brickyard.wav"/> + <prompt phrase="briefcase" filename="briefcase.wav"/> + <prompt phrase="businessman" filename="businessman.wav"/> + <prompt phrase="butterfat" filename="butterfat.wav"/> + <prompt phrase="button" filename="button.wav"/> + <prompt phrase="buzzard" filename="buzzard.wav"/> + <prompt phrase="candidate" filename="candidate.wav"/> + <prompt phrase="cannonball" filename="cannonball.wav"/> + <prompt phrase="caravan" filename="caravan.wav"/> + <prompt phrase="caretaker" filename="caretaker.wav"/> + <prompt phrase="celebrate" filename="celebrate.wav"/> + <prompt phrase="cellulose" filename="cellulose.wav"/> + <prompt phrase="cement" filename="cement.wav"/> + <prompt phrase="certify" filename="certify.wav"/> + <prompt phrase="chairlift" filename="chairlift.wav"/> + <prompt phrase="chambermaid" filename="chambermaid.wav"/> + <prompt phrase="chatter" filename="chatter.wav"/> + <prompt phrase="checkup" filename="checkup.wav"/> + <prompt phrase="chisel" filename="chisel.wav"/> + <prompt phrase="choking" filename="choking.wav"/> + <prompt phrase="chopper" filename="chopper.wav"/> + <prompt phrase="clamshell" filename="clamshell.wav"/> + <prompt phrase="classic" filename="classic.wav"/> + <prompt phrase="classroom" filename="classroom.wav"/> + <prompt phrase="cleanup" filename="cleanup.wav"/> + <prompt phrase="clergyman" filename="clergyman.wav"/> + <prompt phrase="clockwork" filename="clockwork.wav"/> + <prompt phrase="cobra" filename="cobra.wav"/> + <prompt phrase="coherence" filename="coherence.wav"/> + <prompt phrase="combustion" filename="combustion.wav"/> + <prompt phrase="commando" filename="commando.wav"/> + <prompt phrase="commence" filename="commence.wav"/> + <prompt phrase="company" filename="company.wav"/> + <prompt phrase="component" filename="component.wav"/> + <prompt phrase="concert" filename="concert.wav"/> + <prompt phrase="concurrent" filename="concurrent.wav"/> + <prompt phrase="confidence" filename="confidence.wav"/> + <prompt phrase="conformist" filename="conformist.wav"/> + <prompt phrase="congregate" filename="congregate.wav"/> + <prompt phrase="consensus" filename="consensus.wav"/> + <prompt phrase="consulting" filename="consulting.wav"/> + <prompt phrase="corporate" filename="corporate.wav"/> + <prompt phrase="corrosion" filename="corrosion.wav"/> + <prompt phrase="councilman" filename="councilman.wav"/> + <prompt phrase="cowbell" filename="cowbell.wav"/> + <prompt phrase="crackdown" filename="crackdown.wav"/> + <prompt phrase="cranky" filename="cranky.wav"/> + <prompt phrase="crossover" filename="crossover.wav"/> + <prompt phrase="crowfoot" filename="crowfoot.wav"/> + <prompt phrase="crucial" filename="crucial.wav"/> + <prompt phrase="crucifix" filename="crucifix.wav"/> + <prompt phrase="crumpled" filename="crumpled.wav"/> + <prompt phrase="crusade" filename="crusade.wav"/> + <prompt phrase="cubic" filename="cubic.wav"/> + <prompt phrase="cumbersome" filename="cumbersome.wav"/> + <prompt phrase="customer" filename="customer.wav"/> + <prompt phrase="dashboard" filename="dashboard.wav"/> + <prompt phrase="deadbolt" filename="deadbolt.wav"/> + <prompt phrase="decadence" filename="decadence.wav"/> + <prompt phrase="decimal" filename="decimal.wav"/> + <prompt phrase="deckhand" filename="deckhand.wav"/> + <prompt phrase="designing" filename="designing.wav"/> + <prompt phrase="detector" filename="detector.wav"/> + <prompt phrase="detergent" filename="detergent.wav"/> + <prompt phrase="determine" filename="determine.wav"/> + <prompt phrase="dictator" filename="dictator.wav"/> + <prompt phrase="dinosaur" filename="dinosaur.wav"/> + <prompt phrase="direction" filename="direction.wav"/> + <prompt phrase="disable" filename="disable.wav"/> + <prompt phrase="disbelief" filename="disbelief.wav"/> + <prompt phrase="disruptive" filename="disruptive.wav"/> + <prompt phrase="distortion" filename="distortion.wav"/> + <prompt phrase="document" filename="document.wav"/> + <prompt phrase="dogsled" filename="dogsled.wav"/> + <prompt phrase="dragnet" filename="dragnet.wav"/> + <prompt phrase="drainage" filename="drainage.wav"/> + <prompt phrase="dreadful" filename="dreadful.wav"/> + <prompt phrase="drifter" filename="drifter.wav"/> + <prompt phrase="dropper" filename="dropper.wav"/> + <prompt phrase="drumbeat" filename="drumbeat.wav"/> + <prompt phrase="drunken" filename="drunken.wav"/> + <prompt phrase="dwelling" filename="dwelling.wav"/> + <prompt phrase="eating" filename="eating.wav"/> + <prompt phrase="edict" filename="edict.wav"/> + <prompt phrase="egghead" filename="egghead.wav"/> + <prompt phrase="eightball" filename="eightball.wav"/> + <prompt phrase="embezzle" filename="embezzle.wav"/> + <prompt phrase="enchanting" filename="enchanting.wav"/> + <prompt phrase="endorse" filename="endorse.wav"/> + <prompt phrase="endow" filename="endow.wav"/> + <prompt phrase="enlist" filename="enlist.wav"/> + <prompt phrase="enrollment" filename="enrollment.wav"/> + <prompt phrase="enterprise" filename="enterprise.wav"/> + <prompt phrase="equation" filename="equation.wav"/> + <prompt phrase="equipment" filename="equipment.wav"/> + <prompt phrase="erase" filename="erase.wav"/> + <prompt phrase="escapade" filename="escapade.wav"/> + <prompt phrase="escape" filename="escape.wav"/> + <prompt phrase="everyday" filename="everyday.wav"/> + <prompt phrase="examine" filename="examine.wav"/> + <prompt phrase="exceed" filename="exceed.wav"/> + <prompt phrase="existence" filename="existence.wav"/> + <prompt phrase="exodus" filename="exodus.wav"/> + <prompt phrase="eyeglass" filename="eyeglass.wav"/> + <prompt phrase="eyetooth" filename="eyetooth.wav"/> + <prompt phrase="facial" filename="facial.wav"/> + <prompt phrase="fallout" filename="fallout.wav"/> + <prompt phrase="fascinate" filename="fascinate.wav"/> + <prompt phrase="filament" filename="filament.wav"/> + <prompt phrase="finicky" filename="finicky.wav"/> + <prompt phrase="flagpole" filename="flagpole.wav"/> + <prompt phrase="flatfoot" filename="flatfoot.wav"/> + <prompt phrase="flytrap" filename="flytrap.wav"/> + <prompt phrase="forever" filename="forever.wav"/> + <prompt phrase="fortitude" filename="fortitude.wav"/> + <prompt phrase="fracture" filename="fracture.wav"/> + <prompt phrase="framework" filename="framework.wav"/> + <prompt phrase="freedom" filename="freedom.wav"/> + <prompt phrase="frequency" filename="frequency.wav"/> + <prompt phrase="frighten" filename="frighten.wav"/> + <prompt phrase="gadgetry" filename="gadgetry.wav"/> + <prompt phrase="gazelle" filename="gazelle.wav"/> + <prompt phrase="getaway" filename="getaway.wav"/> + <prompt phrase="glitter" filename="glitter.wav"/> + <prompt phrase="glossary" filename="glossary.wav"/> + <prompt phrase="glucose" filename="glucose.wav"/> + <prompt phrase="goggles" filename="goggles.wav"/> + <prompt phrase="goldfish" filename="goldfish.wav"/> + <prompt phrase="gossamer" filename="gossamer.wav"/> + <prompt phrase="graduate" filename="graduate.wav"/> + <prompt phrase="gravity" filename="gravity.wav"/> + <prompt phrase="gremlin" filename="gremlin.wav"/> + <prompt phrase="guidance" filename="guidance.wav"/> + <prompt phrase="guitarist" filename="guitarist.wav"/> + <prompt phrase="hamburger" filename="hamburger.wav"/> + <prompt phrase="hamlet" filename="hamlet.wav"/> + <prompt phrase="handiwork" filename="handiwork.wav"/> + <prompt phrase="hazardous" filename="hazardous.wav"/> + <prompt phrase="headwaters" filename="headwaters.wav"/> + <prompt phrase="hemisphere" filename="hemisphere.wav"/> + <prompt phrase="hesitate" filename="hesitate.wav"/> + <prompt phrase="hideaway" filename="hideaway.wav"/> + <prompt phrase="highchair" filename="highchair.wav"/> + <prompt phrase="hockey" filename="hockey.wav"/> + <prompt phrase="holiness" filename="holiness.wav"/> + <prompt phrase="hurricane" filename="hurricane.wav"/> + <prompt phrase="hydraulic" filename="hydraulic.wav"/> + <prompt phrase="impartial" filename="impartial.wav"/> + <prompt phrase="impetus" filename="impetus.wav"/> + <prompt phrase="inception" filename="inception.wav"/> + <prompt phrase="indigo" filename="indigo.wav"/> + <prompt phrase="indoors" filename="indoors.wav"/> + <prompt phrase="indulge" filename="indulge.wav"/> + <prompt phrase="inertia" filename="inertia.wav"/> + <prompt phrase="infancy" filename="infancy.wav"/> + <prompt phrase="inferno" filename="inferno.wav"/> + <prompt phrase="informant" filename="informant.wav"/> + <prompt phrase="insincere" filename="insincere.wav"/> + <prompt phrase="insurgent" filename="insurgent.wav"/> + <prompt phrase="integrate" filename="integrate.wav"/> + <prompt phrase="intention" filename="intention.wav"/> + <prompt phrase="inventive" filename="inventive.wav"/> + <prompt phrase="inverse" filename="inverse.wav"/> + <prompt phrase="involve" filename="involve.wav"/> + <prompt phrase="island" filename="island.wav"/> + <prompt phrase="jawbone" filename="jawbone.wav"/> + <prompt phrase="keyboard" filename="keyboard.wav"/> + <prompt phrase="kickoff" filename="kickoff.wav"/> + <prompt phrase="kiwi" filename="kiwi.wav"/> + <prompt phrase="klaxon" filename="klaxon.wav"/> + <prompt phrase="leprosy" filename="leprosy.wav"/> + <prompt phrase="letterhead" filename="letterhead.wav"/> + <prompt phrase="liberty" filename="liberty.wav"/> + <prompt phrase="locale" filename="locale.wav"/> + <prompt phrase="lockup" filename="lockup.wav"/> + <prompt phrase="maritime" filename="maritime.wav"/> + <prompt phrase="matchmaker" filename="matchmaker.wav"/> + <prompt phrase="maverick" filename="maverick.wav"/> + <prompt phrase="megaton" filename="megaton.wav"/> + <prompt phrase="merit" filename="merit.wav"/> + <prompt phrase="microscope" filename="microscope.wav"/> + <prompt phrase="microwave" filename="microwave.wav"/> + <prompt phrase="midsummer" filename="midsummer.wav"/> + <prompt phrase="millionaire" filename="millionaire.wav"/> + <prompt phrase="minnow" filename="minnow.wav"/> + <prompt phrase="miracle" filename="miracle.wav"/> + <prompt phrase="miser" filename="miser.wav"/> + <prompt phrase="misnomer" filename="misnomer.wav"/> + <prompt phrase="molasses" filename="molasses.wav"/> + <prompt phrase="molecule" filename="molecule.wav"/> + <prompt phrase="monument" filename="monument.wav"/> + <prompt phrase="mosquito" filename="mosquito.wav"/> + <prompt phrase="mural" filename="mural.wav"/> + <prompt phrase="music" filename="music.wav"/> + <prompt phrase="narrative" filename="narrative.wav"/> + <prompt phrase="nebula" filename="nebula.wav"/> + <prompt phrase="necklace" filename="necklace.wav"/> + <prompt phrase="newborn" filename="newborn.wav"/> + <prompt phrase="newsletter" filename="newsletter.wav"/> + <prompt phrase="nightbird" filename="nightbird.wav"/> + <prompt phrase="obtuse" filename="obtuse.wav"/> + <prompt phrase="offload" filename="offload.wav"/> + <prompt phrase="onlooker" filename="onlooker.wav"/> + <prompt phrase="optic" filename="optic.wav"/> + <prompt phrase="opulent" filename="opulent.wav"/> + <prompt phrase="orca" filename="orca.wav"/> + <prompt phrase="outfielder" filename="outfielder.wav"/> + <prompt phrase="pandemic" filename="pandemic.wav"/> + <prompt phrase="paperweight" filename="paperweight.wav"/> + <prompt phrase="paragon" filename="paragon.wav"/> + <prompt phrase="paragraph" filename="paragraph.wav"/> + <prompt phrase="paramount" filename="paramount.wav"/> + <prompt phrase="passenger" filename="passenger.wav"/> + <prompt phrase="payday" filename="payday.wav"/> + <prompt phrase="peachy" filename="peachy.wav"/> + <prompt phrase="pedigree" filename="pedigree.wav"/> + <prompt phrase="penetrate" filename="penetrate.wav"/> + <prompt phrase="perceptive" filename="perceptive.wav"/> + <prompt phrase="performance" filename="performance.wav"/> + <prompt phrase="pharmacy" filename="pharmacy.wav"/> + <prompt phrase="pheasant" filename="pheasant.wav"/> + <prompt phrase="phonetic" filename="phonetic.wav"/> + <prompt phrase="photograph" filename="photograph.wav"/> + <prompt phrase="physique" filename="physique.wav"/> + <prompt phrase="pioneer" filename="pioneer.wav"/> + <prompt phrase="playhouse" filename="playhouse.wav"/> + <prompt phrase="pocketful" filename="pocketful.wav"/> + <prompt phrase="politeness" filename="politeness.wav"/> + <prompt phrase="positive" filename="positive.wav"/> + <prompt phrase="potato" filename="potato.wav"/> + <prompt phrase="preclude" filename="preclude.wav"/> + <prompt phrase="prefer" filename="prefer.wav"/> + <prompt phrase="preshrunk" filename="preshrunk.wav"/> + <prompt phrase="printer" filename="printer.wav"/> + <prompt phrase="processor" filename="processor.wav"/> + <prompt phrase="provincial" filename="provincial.wav"/> + <prompt phrase="prowler" filename="prowler.wav"/> + <prompt phrase="proximate" filename="proximate.wav"/> + <prompt phrase="puberty" filename="puberty.wav"/> + <prompt phrase="publisher" filename="publisher.wav"/> + <prompt phrase="pupil" filename="pupil.wav"/> + <prompt phrase="puppy" filename="puppy.wav"/> + <prompt phrase="pyramid" filename="pyramid.wav"/> + <prompt phrase="python" filename="python.wav"/> + <prompt phrase="quadrant" filename="quadrant.wav"/> + <prompt phrase="quantity" filename="quantity.wav"/> + <prompt phrase="quiver" filename="quiver.wav"/> + <prompt phrase="quota" filename="quota.wav"/> + <prompt phrase="racketeer" filename="racketeer.wav"/> + <prompt phrase="ragtime" filename="ragtime.wav"/> + <prompt phrase="ratchet" filename="ratchet.wav"/> + <prompt phrase="rebellion" filename="rebellion.wav"/> + <prompt phrase="rebirth" filename="rebirth.wav"/> + <prompt phrase="recipe" filename="recipe.wav"/> + <prompt phrase="recover" filename="recover.wav"/> + <prompt phrase="reform" filename="reform.wav"/> + <prompt phrase="regain" filename="regain.wav"/> + <prompt phrase="reindeer" filename="reindeer.wav"/> + <prompt phrase="rematch" filename="rematch.wav"/> + <prompt phrase="repay" filename="repay.wav"/> + <prompt phrase="repellent" filename="repellent.wav"/> + <prompt phrase="replica" filename="replica.wav"/> + <prompt phrase="reproduce" filename="reproduce.wav"/> + <prompt phrase="resistor" filename="resistor.wav"/> + <prompt phrase="responsive" filename="responsive.wav"/> + <prompt phrase="retouch" filename="retouch.wav"/> + <prompt phrase="retraction" filename="retraction.wav"/> + <prompt phrase="retrieval" filename="retrieval.wav"/> + <prompt phrase="retrospect" filename="retrospect.wav"/> + <prompt phrase="revenge" filename="revenge.wav"/> + <prompt phrase="revenue" filename="revenue.wav"/> + <prompt phrase="revival" filename="revival.wav"/> + <prompt phrase="revolver" filename="revolver.wav"/> + <prompt phrase="reward" filename="reward.wav"/> + <prompt phrase="rhythm" filename="rhythm.wav"/> + <prompt phrase="ribcage" filename="ribcage.wav"/> + <prompt phrase="ringbolt" filename="ringbolt.wav"/> + <prompt phrase="robust" filename="robust.wav"/> + <prompt phrase="rocker" filename="rocker.wav"/> + <prompt phrase="ruffled" filename="ruffled.wav"/> + <prompt phrase="sailboat" filename="sailboat.wav"/> + <prompt phrase="sandalwood" filename="sandalwood.wav"/> + <prompt phrase="sardonic" filename="sardonic.wav"/> + <prompt phrase="savagery" filename="savagery.wav"/> + <prompt phrase="sawdust" filename="sawdust.wav"/> + <prompt phrase="scallion" filename="scallion.wav"/> + <prompt phrase="scavenger" filename="scavenger.wav"/> + <prompt phrase="scenic" filename="scenic.wav"/> + <prompt phrase="scorecard" filename="scorecard.wav"/> + <prompt phrase="seabird" filename="seabird.wav"/> + <prompt phrase="select" filename="select.wav"/> + <prompt phrase="sensation" filename="sensation.wav"/> + <prompt phrase="sentence" filename="sentence.wav"/> + <prompt phrase="shadow" filename="shadow.wav"/> + <prompt phrase="shamrock" filename="shamrock.wav"/> + <prompt phrase="showgirl" filename="showgirl.wav"/> + <prompt phrase="skullcap" filename="skullcap.wav"/> + <prompt phrase="skydive" filename="skydive.wav"/> + <prompt phrase="slingshot" filename="slingshot.wav"/> + <prompt phrase="slowdown" filename="slowdown.wav"/> + <prompt phrase="snapline" filename="snapline.wav"/> + <prompt phrase="snapshot" filename="snapshot.wav"/> + <prompt phrase="snowcap" filename="snowcap.wav"/> + <prompt phrase="snowslide" filename="snowslide.wav"/> + <prompt phrase="sociable" filename="sociable.wav"/> + <prompt phrase="solo" filename="solo.wav"/> + <prompt phrase="southward" filename="southward.wav"/> + <prompt phrase="souvenir" filename="souvenir.wav"/> + <prompt phrase="soybean" filename="soybean.wav"/> + <prompt phrase="spaniel" filename="spaniel.wav"/> + <prompt phrase="spearhead" filename="spearhead.wav"/> + <prompt phrase="specialist" filename="specialist.wav"/> + <prompt phrase="speculate" filename="speculate.wav"/> + <prompt phrase="spellbind" filename="spellbind.wav"/> + <prompt phrase="spheroid" filename="spheroid.wav"/> + <prompt phrase="spigot" filename="spigot.wav"/> + <prompt phrase="spindle" filename="spindle.wav"/> + <prompt phrase="spyglass" filename="spyglass.wav"/> + <prompt phrase="stagehand" filename="stagehand.wav"/> + <prompt phrase="stagnate" filename="stagnate.wav"/> + <prompt phrase="stairway" filename="stairway.wav"/> + <prompt phrase="standard" filename="standard.wav"/> + <prompt phrase="stapler" filename="stapler.wav"/> + <prompt phrase="steamship" filename="steamship.wav"/> + <prompt phrase="sterling" filename="sterling.wav"/> + <prompt phrase="stethoscope" filename="stethoscope.wav"/> + <prompt phrase="stockman" filename="stockman.wav"/> + <prompt phrase="stopwatch" filename="stopwatch.wav"/> + <prompt phrase="stormy" filename="stormy.wav"/> + <prompt phrase="stupendous" filename="stupendous.wav"/> + <prompt phrase="sugar" filename="sugar.wav"/> + <prompt phrase="supportive" filename="supportive.wav"/> + <prompt phrase="surmount" filename="surmount.wav"/> + <prompt phrase="surrender" filename="surrender.wav"/> + <prompt phrase="suspense" filename="suspense.wav"/> + <prompt phrase="suspicious" filename="suspicious.wav"/> + <prompt phrase="sweatband" filename="sweatband.wav"/> + <prompt phrase="swelter" filename="swelter.wav"/> + <prompt phrase="sympathy" filename="sympathy.wav"/> + <prompt phrase="tactics" filename="tactics.wav"/> + <prompt phrase="talon" filename="talon.wav"/> + <prompt phrase="tambourine" filename="tambourine.wav"/> + <prompt phrase="tapeworm" filename="tapeworm.wav"/> + <prompt phrase="telephone" filename="telephone.wav"/> + <prompt phrase="tempest" filename="tempest.wav"/> + <prompt phrase="therapist" filename="therapist.wav"/> + <prompt phrase="tiger" filename="tiger.wav"/> + <prompt phrase="tissue" filename="tissue.wav"/> + <prompt phrase="tobacco" filename="tobacco.wav"/> + <prompt phrase="tolerance" filename="tolerance.wav"/> + <prompt phrase="tomorrow" filename="tomorrow.wav"/> + <prompt phrase="tonic" filename="tonic.wav"/> + <prompt phrase="topmost" filename="topmost.wav"/> + <prompt phrase="torpedo" filename="torpedo.wav"/> + <prompt phrase="tracker" filename="tracker.wav"/> + <prompt phrase="tradition" filename="tradition.wav"/> + <prompt phrase="transit" filename="transit.wav"/> + <prompt phrase="trauma" filename="trauma.wav"/> + <prompt phrase="travesty" filename="travesty.wav"/> + <prompt phrase="treadmill" filename="treadmill.wav"/> + <prompt phrase="trombonist" filename="trombonist.wav"/> + <prompt phrase="trouble" filename="trouble.wav"/> + <prompt phrase="truncated" filename="truncated.wav"/> + <prompt phrase="tumor" filename="tumor.wav"/> + <prompt phrase="tunnel" filename="tunnel.wav"/> + <prompt phrase="tycoon" filename="tycoon.wav"/> + <prompt phrase="typewriter" filename="typewriter.wav"/> + <prompt phrase="ultimate" filename="ultimate.wav"/> + <prompt phrase="uncut" filename="uncut.wav"/> + <prompt phrase="undaunted" filename="undaunted.wav"/> + <prompt phrase="underfoot" filename="underfoot.wav"/> + <prompt phrase="unearth" filename="unearth.wav"/> + <prompt phrase="unicorn" filename="unicorn.wav"/> + <prompt phrase="unify" filename="unify.wav"/> + <prompt phrase="universe" filename="universe.wav"/> + <prompt phrase="unravel" filename="unravel.wav"/> + <prompt phrase="unwind" filename="unwind.wav"/> + <prompt phrase="upcoming" filename="upcoming.wav"/> + <prompt phrase="uproot" filename="uproot.wav"/> + <prompt phrase="upset" filename="upset.wav"/> + <prompt phrase="upshot" filename="upshot.wav"/> + <prompt phrase="vacancy" filename="vacancy.wav"/> + <prompt phrase="vagabond" filename="vagabond.wav"/> + <prompt phrase="vapor" filename="vapor.wav"/> + <prompt phrase="vertigo" filename="vertigo.wav"/> + <prompt phrase="village" filename="village.wav"/> + <prompt phrase="virus" filename="virus.wav"/> + <prompt phrase="visitor" filename="visitor.wav"/> + <prompt phrase="vocalist" filename="vocalist.wav"/> + <prompt phrase="voyager" filename="voyager.wav"/> + <prompt phrase="waffle" filename="waffle.wav"/> + <prompt phrase="wallet" filename="wallet.wav"/> + <prompt phrase="warranty" filename="warranty.wav"/> + <prompt phrase="watchword" filename="watchword.wav"/> + <prompt phrase="wayside" filename="wayside.wav"/> + <prompt phrase="whimsical" filename="whimsical.wav"/> + <prompt phrase="willow" filename="willow.wav"/> + <prompt phrase="woodlark" filename="woodlark.wav"/> + <prompt phrase="yesteryear" filename="yesteryear.wav"/> + <!-- Event prompts --> + <prompt phrase="Bienvenidos al servicio de inscripción ZRTP." filename="zrtp-enroll_welcome.wav"/> + <prompt phrase="Usted debe verificar la cadena de carácteres con su destino. Si no coincide, indica la presencia de una escucha telefónica." filename="zrtp-check_sas.wav"/> + <prompt phrase="Solo teléfonos autenticados pueden confiar en llamadas seguras con ZRTP. Su teléfono no está autenticado con este sistema, su llamada no estará securizada." filename="zrtp-enroll_not_sip_registered.wav"/> + <prompt phrase="Su teléfono indica que confia en este sistema para realizar llamadas seguras con ZRTP, no necesita hacer nada más." filename="zrtp-enroll_already_enrolled.wav"/> + <prompt phrase="Solo teléfonos soportando el protócolo ZRTP pueden usar esta extensión. Su teléfono no tiene ZRTP habilitado, y está llamada no será securizada." filename="zrtp-enroll_notzrtp.wav"/> + <prompt phrase="Este sistema esta configurado para manejar llamadas cifradas con ZRTP. Decida si permite al sistema tener la posibilidad de interceptar o monitorizar su llamada. Puede colgar una vez confirmado." filename="zrtp-enroll_confirmed.wav"/> + <prompt phrase="Compara verbalmente este código de autenticación con su destino." filename="zrtp-is_secure.wav"/> + <prompt phrase="El código de autenticación no está verificado." filename="zrtp-is_unverified.wav"/> + <prompt phrase="El código de autenticación está verificado." filename="zrtp-is_verified.wav"/> + <prompt phrase="Gracias por llamar. Adiós." filename="zrtp-thankyou_goodbye.wav"/> + <prompt phrase="Algún error ha ocurrido." filename="zrtp-somethings_wrong.wav"/> + <prompt phrase="Error." filename="zrtp-status_error.wav"/> + <prompt phrase="Esta llamada no está protegida." filename="zrtp-status_notsecure.wav"/> + <prompt phrase="Esta llamada está protegida." filename="zrtp-status_secure.wav"/> + <prompt phrase="Securizando su llamada." filename="zrtp-status_securing.wav"/> + </zrtp> + </es_MX> +</language> diff --git a/docs/phrase/phrase_pt_BR.xml b/docs/phrase/phrase_pt_BR.xml new file mode 100644 index 0000000..9cc400c --- /dev/null +++ b/docs/phrase/phrase_pt_BR.xml @@ -0,0 +1,987 @@ +<language> + <pt_BR> + <ascii> + <prompt phrase="Espaço" filename="32.wav"/> + <prompt phrase="Sustenido" filename="35.wav"/> + <prompt phrase="Asterisco" filename="42.wav"/> + <prompt phrase="Ponto" filename="46.wav"/> + <prompt phrase="A" filename="97.wav"/> + <prompt phrase="B" filename="98.wav"/> + <prompt phrase="C" filename="99.wav"/> + <prompt phrase="D" filename="100.wav"/> + <prompt phrase="E" filename="101.wav"/> + <prompt phrase="F" filename="102.wav"/> + <prompt phrase="G" filename="103.wav"/> + <prompt phrase="H" filename="104.wav"/> + <prompt phrase="I" filename="105.wav"/> + <prompt phrase="J" filename="106.wav"/> + <prompt phrase="K" filename="107.wav"/> + <prompt phrase="L" filename="108.wav"/> + <prompt phrase="M" filename="109.wav"/> + <prompt phrase="N" filename="110.wav"/> + <prompt phrase="O" filename="111.wav"/> + <prompt phrase="P" filename="112.wav"/> + <prompt phrase="Q" filename="113.wav"/> + <prompt phrase="R" filename="114.wav"/> + <prompt phrase="S" filename="115.wav"/> + <prompt phrase="T" filename="116.wav"/> + <prompt phrase="U" filename="117.wav"/> + <prompt phrase="V" filename="118.wav"/> + <prompt phrase="W" filename="119.wav"/> + <prompt phrase="X" filename="120.wav"/> + <prompt phrase="Y" filename="121.wav"/> + <prompt phrase="Z" filename="122.wav"/> + </ascii> + <phonetic-ascii> + <prompt phrase="Espaço" filename="32.wav"/> + <prompt phrase="Ponto" filename="46.wav"/> + <prompt phrase="Alpha" filename="97.wav"/> + <prompt phrase="Bravo" filename="98.wav"/> + <prompt phrase="Charlie" filename="99.wav"/> + <prompt phrase="Delta" filename="100.wav"/> + <prompt phrase="Echo" filename="101.wav"/> + <prompt phrase="Foxtrot" filename="102.wav"/> + <prompt phrase="Golf" filename="103.wav"/> + <prompt phrase="Hotel" filename="104.wav"/> + <prompt phrase="India" filename="105.wav"/> + <prompt phrase="Juliet" filename="106.wav"/> + <prompt phrase="Kilo" filename="107.wav"/> + <prompt phrase="Lima" filename="108.wav"/> + <prompt phrase="Mike" filename="109.wav"/> + <prompt phrase="November" filename="110.wav"/> + <prompt phrase="Oscar" filename="111.wav"/> + <prompt phrase="Papa" filename="112.wav"/> + <prompt phrase="Quebec" filename="113.wav"/> + <prompt phrase="Romeo" filename="114.wav"/> + <prompt phrase="Sierra" filename="115.wav"/> + <prompt phrase="Tango" filename="116.wav"/> + <prompt phrase="Unifor" filename="117.wav"/> + <prompt phrase="Victor" filename="118.wav"/> + <prompt phrase="Whiskey" filename="119.wav"/> + <prompt phrase="Xray" filename="120.wav"/> + <prompt phrase="Yankee" filename="121.wav"/> + <prompt phrase="Zulu" filename="122.wav"/> + </phonetic-ascii> + <digits> + <prompt phrase="Zero" filename="0.wav"/> + <prompt phrase="Um" filename="1.wav"/> + <prompt phrase="Dois" filename="2.wav"/> + <prompt phrase="Três" filename="3.wav"/> + <prompt phrase="Quatro" filename="4.wav"/> + <prompt phrase="Cinco" filename="5.wav"/> + <prompt phrase="Seis" filename="6.wav"/> + <prompt phrase="Sete" filename="7.wav"/> + <prompt phrase="Oito" filename="8.wav"/> + <prompt phrase="Nove" filename="9.wav"/> + <prompt phrase="Dez" filename="10.wav"/> + <prompt phrase="Onze" filename="11.wav"/> + <prompt phrase="Doze" filename="12.wav"/> + <prompt phrase="Treze" filename="13.wav"/> + <prompt phrase="Catorze" filename="14.wav"/> + <prompt phrase="Quinze" filename="15.wav"/> + <prompt phrase="Dezesseis" filename="16.wav"/> + <prompt phrase="Dezessete" filename="17.wav"/> + <prompt phrase="Dezoito" filename="18.wav"/> + <prompt phrase="Dezenove" filename="19.wav"/> + <prompt phrase="Vinte" filename="20.wav"/> + <prompt phrase="Trinta" filename="30.wav"/> + <prompt phrase="Quarenta" filename="40.wav"/> + <prompt phrase="Cinquenta" filename="50.wav"/> + <prompt phrase="Sessenta" filename="60.wav"/> + <prompt phrase="Setenta" filename="70.wav"/> + <prompt phrase="Oitenta" filename="80.wav"/> + <prompt phrase="Noventa" filename="90.wav"/> + <prompt phrase="Cem" filename="100.wav"/> + <prompt phrase="Duzentos" filename="200.wav"/> + <prompt phrase="Trezentos" filename="300.wav"/> + <prompt phrase="Quinhentos" filename="500.wav"/> + <prompt phrase="Ponto" filename="dot.wav"/> + <prompt phrase="Primeiro" filename="h-1.wav"/> + <prompt phrase="Segundo" filename="h-2.wav"/> + <prompt phrase="Terceiro" filename="h-3.wav"/> + <prompt phrase="Quarto" filename="h-4.wav"/> + <prompt phrase="Quinto" filename="h-5.wav"/> + <prompt phrase="Sexto" filename="h-6.wav"/> + <prompt phrase="Sétimo" filename="h-7.wav"/> + <prompt phrase="Oitavo" filename="h-8.wav"/> + <prompt phrase="Nono" filename="h-9.wav"/> + <prompt phrase="Décimo" filename="h-10.wav"/> + <prompt phrase="Vigésimo" filename="h-20.wav"/> + <prompt phrase="Trigésimo" filename="h-30.wav"/> + <prompt phrase="Quadragésimo" filename="h-40.wav"/> + <prompt phrase="Quinquagésimo" filename="h-50.wav"/> + <prompt phrase="Sexagésimo" filename="h-60.wav"/> + <prompt phrase="Septuagésimo" filename="h-70.wav"/> + <prompt phrase="Octogésimo" filename="h-80.wav"/> + <prompt phrase="Nonagésimo" filename="h-90.wav"/> + <prompt phrase="Cento" filename="hundred.wav"/> + <prompt phrase="Centos" filename="hundreds.wav"/> + <prompt phrase="Mil" filename="thousand.wav"/> + <prompt phrase="Milhão" filename="million.wav"/> + <prompt phrase="Milhões" filename="millions.wav"/> + <prompt phrase="Período" filename="period.wav"/> + <prompt phrase="Ponto" filename="point.wav"/> + <prompt phrase="Sustenido" filename="pound.wav"/> + <prompt phrase="Asterisco" filename="star.wav"/> + </digits> + <currency> + <prompt phrase="E" filename="and.wav"/> + <prompt phrase="Centavo" filename="cent.wav"/> + <prompt phrase="Central" filename="central.wav"/> + <prompt phrase="Centavos por minuto" filename="cents-per-minute.wav"/> + <prompt phrase="Centavos" filename="cents.wav"/> + <prompt phrase="Dólar" filename="dollar.wav"/> + <prompt phrase="Dólares" filename="dollars.wav"/> + <prompt phrase="Menos" filename="minus.wav"/> + <prompt phrase="Negativo" filename="negative.wav"/> + </currency> + <time> + <prompt phrase="A.M." filename="a-m.wav"/> + <prompt phrase="a" filename="at.wav"/> + <prompt phrase="às" filename="ats.wav"/> + <prompt phrase="Domingo" filename="day-0.wav"/> + <prompt phrase="Segunda-feira" filename="day-1.wav"/> + <prompt phrase="Terça-feira" filename="day-2.wav"/> + <prompt phrase="Quarta-feira" filename="day-3.wav"/> + <prompt phrase="Quinta-feira" filename="day-4.wav"/> + <prompt phrase="Sexta-feira" filename="day-5.wav"/> + <prompt phrase="Sábado" filename="day-6.wav"/> + <prompt phrase="Hora" filename="hour.wav"/> + <prompt phrase="Horas" filename="hours.wav"/> + <prompt phrase="Minuto" filename="minute.wav"/> + <prompt phrase="Minutos" filename="minutes.wav"/> + <prompt phrase="Janeiro" filename="mon-0.wav"/> + <prompt phrase="Fevereiro" filename="mon-1.wav"/> + <prompt phrase="Março" filename="mon-2.wav"/> + <prompt phrase="Abril" filename="mon-3.wav"/> + <prompt phrase="Maio" filename="mon-4.wav"/> + <prompt phrase="Junho" filename="mon-5.wav"/> + <prompt phrase="Julho" filename="mon-6.wav"/> + <prompt phrase="Agosto" filename="mon-7.wav"/> + <prompt phrase="Setembro" filename="mon-8.wav"/> + <prompt phrase="Outubro" filename="mon-9.wav"/> + <prompt phrase="Novembro" filename="mon-10.wav"/> + <prompt phrase="Dezembro" filename="mon-11.wav"/> + <prompt phrase="Em ponto" filename="oclock.wav"/> + <prompt phrase="P.M." filename="p-m.wav"/> + <prompt phrase="Segundo" filename="second.wav"/> + <prompt phrase="Segundos" filename="seconds.wav"/> + <prompt phrase="Hoje" filename="today.wav"/> + <prompt phrase="Amanhã" filename="tomorrow.wav"/> + <prompt phrase="Ontem" filename="yesterday.wav"/> + </time> + <voicemail> + <prompt phrase="A pessoa na extensão..." filename="vm-person.wav"/> + <prompt phrase="marcada como urgente" filename="vm-marked-urgent.wav"/> + <prompt phrase="email enviado" filename="vm-emailed.wav"/> + <prompt phrase="Você tem..." filename="vm-you_have.wav"/> + <prompt phrase="Por favor digite o seu número de usuario, e depois..." filename="vm-enter_id.wav"/> + <prompt phrase="Por favor digite a sua contrasenha, e depois..." filename="vm-enter_pass.wav"/> + <prompt phrase="Inicio incorreto da sessao." filename="vm-fail_auth.wav"/> + <prompt phrase="Bem-vindo ao seu correio de voz." filename="vm-hello.wav"/> + <prompt phrase="Até logo." filename="vm-goodbye.wav"/> + <prompt phrase="Grave a sua mensagem depois de ouvir o sinal, diga o seu nome e pressione qualquer tecla ou pare de falar para finalizar a gravação." filename="vm-record_name1.wav"/> + <prompt phrase="Escolha uma saudaçao entre as opções 1 e 9" filename="vm-choose_greeting_choose.wav"/> + <prompt phrase="Número invalido." filename="vm-choose_greeting_fail.wav"/> + <prompt phrase="Muitas tentativas fracassadas." filename="vm-abort.wav"/> + <prompt phrase="Para mudar a sua senha..." filename="vm-change_password.wav"/> + <prompt phrase="Apos o sinal grave a sua saudação, digite qualquer tecla ou deixe de falar para finalizar a gravação." filename="vm-record_greeting.wav"/> + <prompt phrase="Apos o sinal grave a sua mensagem, digite qualquer tecla ou deixe de falar para finalizar a gravação." filename="vm-record_message.wav"/> + <prompt phrase="Não está disponível." filename="vm-play_greeting.wav"/> + <prompt phrase="nova e urgente" filename="vm-urgent-new.wav"/> + <prompt phrase="nova" filename="vm-new.wav"/> + <prompt phrase="guardada e urgente" filename="vm-urgent-saved.wav"/> + <prompt phrase="guardada" filename="vm-saved.wav"/> + <prompt phrase="mensagem" filename="vm-message.wav"/> + <prompt phrase="mensagens" filename="vm-messages.wav"/> + <prompt phrase="marque" filename="vm-press.wav"/> + <prompt phrase="Para ouvir as mensagens novas..." filename="vm-listen_new.wav"/> + <prompt phrase="Para ouvir as mensagens armazenadas..." filename="vm-listen_saved.wav"/> + <prompt phrase="Para opções avançadas..." filename="vm-advanced.wav"/> + <prompt phrase="Para sair..." filename="vm-to_exit.wav"/> + <prompt phrase="Para gravar a sua saudação..." filename="vm-record_greeting.wav"/> + <prompt phrase="Para escolher a sua saudação..." filename="vm-choose_greeting.wav"/> + <prompt phrase="Para gravar o seu nome..." filename="vm-record_name2.wav"/> + <prompt phrase="Para o menu principal..." filename="vm-main_menu.wav"/> + <prompt phrase="Para ouvir a gravaçao..." filename="vm-listen_to_recording.wav"/> + <prompt phrase="Para guardar a gravaçao..." filename="vm-save_recording.wav"/> + <prompt phrase="Para gravar novamente..." filename="vm-rerecord.wav"/> + <prompt phrase="Para marcar esta mensagem como urgente..." filename="vm-mark_urgent.wav"/> + <prompt phrase="Para continuar..." filename="vm-continue.wav"/> + <prompt phrase="Para ouvir a gravação novamente..." filename="vm-listen_to_recording_again.wav"/> + <prompt phrase="Para borrar a gravação..." filename="vm-delete_recording.wav"/> + <prompt phrase="Para enviar a gravação para o seu email..." filename="vm-forward_to_email.wav"/> + <prompt phrase="saudação" filename="vm-greeting.wav"/> + <prompt phrase="selecionada" filename="vm-selected.wav"/> + <prompt phrase="Não está disponível." filename="vm-not_available.wav"/> + <prompt phrase="Mensagem número..." filename="vm-message_number.wav"/> + <prompt phrase="apagada" filename="vm-deleted.wav"/> + <prompt phrase="A sua gravação é muito curta, por favor tente novamente." filename="vm-too-small.wav"/> + <prompt phrase="na caixa de mensagens" filename="vm-in_folder.wav"/> + <prompt phrase="Para devolver a ligação agora..." filename="vm-return_call.wav"/> + <prompt phrase="urgente" filename="vm-urgent.wav"/> + <prompt phrase="Esta caixa de mensagens está lotada, por favor tente mais tarde." filename="vm-mailbox_full.wav"/> + <prompt phrase="Bem-vindo a sua caixa de mensagens. Para escutar o menu e configurar a sua caixa de mensagens, digite um. Para não considera-lo, digite dois." filename="vm-tutorial_yes_no.wav"/> + <prompt phrase="Você precisa gravar o seu nome e sobrenome. Esta gravação é usada entre outras, no serviço de diretório." filename="vm-tutorial_record_name.wav"/> + <prompt phrase="O número de identificação pessoal ou PIN serve para impedir o acesso de terceiros as suas mensagens. Você deseja mudar o seu PIN agora?" filename="vm-tutorial_change_pin.wav"/> + </voicemail> + <directory> + <prompt phrase="Por favor marque as primeiras letras do nome da pessoa." filename="dir-enter-person.wav"/> + <prompt phrase="...último nome..." filename="dir-last_name.wav"/> + <prompt phrase="Para procurar por..." filename="dir-to_search_by.wav"/> + <prompt phrase="...primeiro nome..." filename="dir-first_name.wav"/> + <prompt phrase="Não foram encontradas as respostas, tente novamente." filename="dir-no_match_entry.wav"/> + <prompt phrase="...respostas encontradas para a sua pergunta." filename="dir-result_match.wav"/> + <prompt phrase="A sua pergunta devolveu muitas respostas, por favor tente novamente." filename="dir-to_many_result.wav"/> + <prompt phrase="Não há mais opções." filename="dir-no_more_results.wav"/> + <prompt phrase="Opção número..." filename="dir-result_number.wav"/> + <prompt phrase="...no ramal..." filename="dir-at_extension.wav"/> + <prompt phrase="Para escolher essa opção..." filename="dir-to_select_entry.wav"/> + <prompt phrase="Para a opção seguinte..." filename="dir-for_next.wav"/> + <prompt phrase="Para a opção anterior..." filename="dir-for_prev.wav"/> + <prompt phrase="Para uma nova busca..." filename="dir-start_new_search.wav"/> + <prompt phrase="Você precisa dizer um mínimo de..." filename="dir-specify_mininum_first.wav"/> + <prompt phrase="...letras do nome da pessoa, tente novamente." filename="dir-letters_of_person_name.wav"/> + <prompt phrase="marque" filename="dir-press.wav"/> + </directory> + <conference> + <prompt phrase="NULL" filename="conf-ack.wav" type="tone"/> + <prompt phrase="NULL" filename="conf-nack.wav" type="tone"/> + <prompt phrase="Você agora está mudo." filename="conf-muted.wav"/> + <prompt phrase="Você não está mais mudo." filename="conf-unmuted.wav"/> + <prompt phrase="Neste momento você é a única pessoa na conferência." filename="conf-alone.wav"/> + <prompt phrase="NULL" filename="conf-perpetual.wav" type="music"/> + <prompt phrase="NULL" filename="conf-enter.wav" type="tone"/> + <prompt phrase="NULL" filename="conf-exit.wav" type="tone"/> + <prompt phrase="Você foi retirado da conferência." filename="conf-kicked.wav"/> + <prompt phrase="Esta confêrencia está bloqueada." filename="conf-locked.wav"/> + <prompt phrase="A conferência está bloqueada." filename="conf-is-locked.wav"/> + <prompt phrase="A conferência está liberada." filename="conf-is-unlocked.wav"/> + <prompt phrase="Por favor insira o PIN da conferência." filename="conf-pin.wav"/> + <prompt phrase="Este PIN não e válido, tente novamente." filename="conf-bad-pin.wav"/> + <prompt phrase="Até logo." filename="conf-goodbye.wav"/> + <prompt phrase="Bem-vindo a conferência." filename="conf-welcome.wav"/> + </conference> + <ivr> + <prompt phrase="Número da conta" filename="ivr-account_number.wav"/> + <prompt phrase="Contatar com a pessoa que telefona" filename="ivr-connect_to_caller.wav"/> + <prompt phrase="Se conhece o ramal da pessoa com quem deseja falar, por favor digite agora." filename="ivr-enter_ext_pound.wav"/> + <prompt phrase="Por favor digite o ramal e a continuação a tecla sustenido." filename="ivr-enter_ext.wav"/> + <prompt phrase="Para a pessoa..." filename="ivr-for_this_person.wav"/> + <prompt phrase="Por favor aguarde enquanto realizamos a sua chamada." filename="ivr-hold_connect_call.wav"/> + <prompt phrase="Desculpe" filename="ivr-im_sorry.wav"/> + <prompt phrase="Por favor" filename="ivr-please.wav"/> + <prompt phrase="Por favor devolva a nossa ligação à..." filename="ivr-please_return_our_call_at.wav"/> + <prompt phrase="De acordo com o número de referência." filename="ivr-regarding_reference_number.wav"/> + <prompt phrase="Este é um exemplo de um submenu IVR..." filename="ivr-sample_submenu.wav"/> + <prompt phrase="Por favor diga o seu nome depois do sinal." filename="ivr-say_name.wav"/> + <prompt phrase="Enviar esta ligação para a caixa de mensagens de voz." filename="ivr-send_to_voicemail.wav"/> + <prompt phrase="Para falar com o responsavel do atençao a clientes..." filename="ivr-speak_to_a_customer_service_representative.wav"/> + <prompt phrase="Deixe uma mensagem" filename="ivr-take_a_message.wav"/> + <prompt phrase="Obrigado" filename="ivr-thank_you.wav"/> + <prompt phrase="Essa opção nao é valida." filename="ivr-that_was_an_invalid_entry.wav"/> + <prompt phrase="Esta é uma ligação de..." filename="ivr-this_is_a_call_from.wav"/> + <prompt phrase="Este IVR lher permite testar algumas das opções..." filename="ivr-this_ivr_will_let_you_test_features.wav"/> + <prompt phrase="Para ligar à conferencia FreeSWITCH..." filename="ivr-to_call_the_freeswitch_conference.wav"/> + <prompt phrase="Para realizar um teste FreeSWITCH eco..." filename="ivr-to_do_a_freeswitch_echo_test.wav"/> + <prompt phrase="Para realizar um teste FWD eco..." filename="ivr-to_do_a_fwd_echo_test.wav"/> + <prompt phrase="Para ouvir o exemplo de um submenu IVR..." filename="ivr-to_hear_sample_submenu.wav"/> + <prompt phrase="Para ouvir gritos de macacos..." filename="ivr-to_hear_screaming_monkeys.wav"/> + <prompt phrase="Para ouvir música de espera..." filename="ivr-to_listen_to_moh.wav"/> + <prompt phrase="Para ouvir novamente estas opções..." filename="ivr-to_repeat_these_options.wav"/> + <prompt phrase="Para voltar ao menu anterior..." filename="ivr-to_return_to_previous_menu.wav"/> + <prompt phrase="Para falar com um atendente..." filename="ivr-to_speak_with_an_operator.wav"/> + <prompt phrase="Bem-vindo a FreeSWITCH, o futuro da telefonia." filename="ivr-welcome_to_freeswitch.wav"/> + <prompt phrase="Você pode sair a qualquer momento, simplesmente terminando a ligação." filename="ivr-you_may_exit_by_hanging_up.wav"/> + <prompt phrase="ou" filename="ivr-or.wav"/> + <prompt phrase="não" filename="ivr-not.wav"/> + <prompt phrase="ligação" filename="ivr-call.wav"/> + <prompt phrase="Você pode" filename="ivr-you_may.wav"/> + <prompt phrase="Oi?" filename="ivr-hello.wav"/> + <prompt phrase="Usando as teclas do seu telefone..." filename="ivr-use_telephone_keypad.wav"/> + <prompt phrase="Por favor soletre o nome da pessoa que você deseja contatar." filename="ivr-spell_name.wav"/> + <prompt phrase="Sobrenome primeiro" filename="ivr-last_name_first.wav"/> + <prompt phrase="Primeiro nome primeiro" filename="ivr-first_name_first.wav"/> + <prompt phrase="Marque 1 para Q ou Z." filename="ivr-press_one_q_or_z.wav"/> + <prompt phrase="Vendas" filename="ivr-sales.wav"/> + <prompt phrase="Atenção a clientes" filename="ivr-customer_service.wav"/> + <prompt phrase="Suporte tecnico" filename="ivr-technical_support.wav"/> + <prompt phrase="Atendente" filename="ivr-operator.wav"/> + <prompt phrase="Você teclou um ramal inválido." filename="ivr-you_have_dialed_an_invalid_extension.wav"/> + <prompt phrase="Por favor digite o seu ramal, depois a tecla sustenido." filename="ivr-please_enter_extension_followed_by_pound.wav"/> + <prompt phrase="Por favor digite o seu número PIN, depois a tecla sustenido." filename="ivr-please_enter_pin_followed_by_pound.wav"/> + <prompt phrase="O seu número PIN ou ramal não é válido." filename="ivr-pin_or_extension_is-invalid.wav"/> + <prompt phrase="Você está a ponto de associar este telefone à sua conta..." filename="ivr-you_are_about_to_provision_this_phone.wav"/> + <prompt phrase="Por favor digite novamente o seu número PIN para confirmar." filename="ivr-please_reenter_your_pin.wav"/> + <prompt phrase="Para registar em ClueCon, por favor digite..." filename="ivr-register_for_cluecon.wav"/> + <prompt phrase="Para contatar..." filename="ivr-to_log_in.wav"/> + <prompt phrase="Para desligar..." filename="ivr-to_log_out.wav"/> + <prompt phrase="Você agora está conetado." filename="ivr-you_are_now_logged_in.wav"/> + <prompt phrase="Você agora está desconetado." filename="ivr-you_are_now_logged_out.wav"/> + <prompt phrase="Por favor tente novamente." filename="ivr-please_try_again.wav"/> + <prompt phrase="Você está a ponto de associar permanentemente este telefone ao seu ramal." filename="ivr-provision_phone_permanently_to_extension.wav"/> + <prompt phrase="Por favor digite o numero do ramal que você pretende associar a este telefone, logo digite sustenido." filename="ivr-extension_to_provision_this_phone.wav"/> + <prompt phrase="Obrigado, este telefone vai ser reiniciado." filename="ivr-this_phone_will_now_reboot.wav"/> + <prompt phrase="Obrigado. A sua gravação foi guardada." filename="ivr-recording_saved.wav"/> + <prompt phrase="Digite 1 para guardar a sua gravação. Digite 2 para ouvir á sua gravação. Digite 3 para gravar novamente." filename="ivr-save_review_record.wav"/> + <prompt phrase="Neste momento o sistema é incapaz de guardar a sua gravação. Por favor tente novamente mais tarde." filename="ivr-unable_save.wav"/> + <prompt phrase="Você é o número" filename="ivr-you_are_number.wav"/> + <prompt phrase="...em linha" filename="ivr-in_line.wav"/> + <prompt phrase="Obrigado por esperar." filename="ivr-thank_you_for_holding.wav"/> + <prompt phrase="O seu tempo estimado de espera é..." filename="ivr-estimated_hold_time.wav"/> + <prompt phrase="Mais de..." filename="ivr-more_than.wav"/> + <prompt phrase="Menos de..." filename="ivr-less_than.wav"/> + <prompt phrase="Iniciar a gravação." filename="ivr-begin_recording.wav "/> + <prompt phrase="O encaminhamento da ligação foi cancelada." filename="ivr-call_forwarding_has_been_cancelled.wav"/> + <prompt phrase="O encaminhamento da ligação foi ativada." filename="ivr-call_forwarding_has_been_set.wav"/> + <prompt phrase="Por favor, introduza o número de telefone." filename="ivr-please_enter_the_phone_number.wav"/> + <prompt phrase="Por favor, diga o seu nome e o motivo da sua ligação." filename="ivr-please_state_your_name_and_reason_for_calling.wav"/> + <prompt phrase="Para aceitar, digite 1. Para rejeitar, digite 2. Para enviar para o correio de voz, digite 3." filename="ivr-accept_reject_voicemail.wav"/> + <prompt phrase="Entrada da ligação." filename="ivr-incoming_call.wav"/> + <prompt phrase="Obrigado pela sua ligação." filename="ivr-thank_you_for_calling.wav"/> + <prompt phrase="Por favor permaneça em linha. A sua ligação será atendida brevemente." filename="ivr-stay_on_line_call_answered_momentarily.wav"/> + <prompt phrase="A sua ligação está sendo transferida." filename="ivr-call_being_transferred.wav"/> + <prompt phrase="Por favor, desfrute da música enquanto a sua ligação é transferida." filename="ivr-enjoy_music_while_transfer.wav"/> + <prompt phrase="Você tem uma ligação de..." filename="ivr-call_from.wav"/> + <prompt phrase="Este menú não tem opções. Por favor entre em contato com o administrador." filename="ivr-no_menu_items.wav"/> + <prompt phrase="Para diretório, digite..." filename="ivr-for_directory_press.wav"/> + <prompt phrase="Usando o teclado do seu telefone..." filename="ivr-using_telephone_keypad.wav"/> + <prompt phrase="Introduza as primeiras letras do último nome da pessoa." filename="ivr-enter_letters_last_name.wav"/> + <prompt phrase="Introduza as primeiras letras do primeiro nome da pessoa." filename="ivr-enter_letters_first_name.wav"/> + <prompt phrase="Introduza as primeiras letras do primeiro ou último nome da pessoa." filename="ivr-enter_letters_first_or_last_name.wav"/> + <prompt phrase="Se isso é correcto, digite..." filename="ivr-if_correct_press.wav"/> + <prompt phrase="Se não, digite..." filename="ivr-if_not_press.wav"/> + <prompt phrase="Quando terminar, digite sustenido." filename="ivr-finished_pound_hash_key.wav"/> + <prompt phrase="O modo Não Incomodar agora está ativado." filename="ivr-dnd_activated.wav"/> + <prompt phrase="O modo Não Incomodar foi desativado." filename="ivr-dnd_cancelled.wav"/> + <prompt phrase="Marque qualquer outro dígito..." filename="ivr-any_other_digit.wav"/> + <prompt phrase="Digite um para sim. Digite dois para não." filename="ivr-one_yes_two_no.wav"/> + <prompt phrase="Por favor digite o número da fila, e logo a tecla sustenido." filename="ivr-enter_queue_number.wav"/> + <prompt phrase="Por favor digite o..." filename="ivr-please_enter_the.wav"/> + <prompt phrase="Número." filename="ivr-number.wav"/> + <prompt phrase="...e depois sustenido." filename="ivr-followed_by_pound.wav"/> + <prompt phrase="O saldo da conta é..." filename="ivr-account_balance_is.wav"/> + <prompt phrase="Obrigado por telefonar. Se conhece a ramal do destinatário, por favor digite-o agora. Para ir para o diretório, digite..." filename="ivr-generic_greeting.wav"/> + <prompt phrase="...ficheiro..." filename="ivr-file.wav"/> + <prompt phrase="...ficheiros..." filename="ivr-files-.wav"/> + <prompt phrase="Para uma ligação de despertar..." filename="ivr-for_a_wakeup_call.wav"/> + <prompt phrase="Esta é a sua ligação de despertar." filename="ivr-this_is_your_wakeup_call.wav"/> + <prompt phrase="Para solicitar uma ligação de despertar..." filename="ivr-request_wakeup_call.wav"/> + <prompt phrase="Para confirmar uma ligação de despertar..." filename="ivr-confirm_wakeup_call.wav"/> + <prompt phrase="Para cancelar uma ligação de despertar..." filename="ivr-cancel_wakeup_call.wav"/> + <prompt phrase="Você solicitou uma ligação de despertar..." filename="ivr-requested_wakeup_call_for.wav"/> + <prompt phrase="Você não solicitou uma ligação de despertar." filename="ivr-not_requested_wakeup_call.wav"/> + <prompt phrase="A sua ligação de despertar foi cancelada." filename="ivr-wakeup_call_cancelled.wav"/> + <prompt phrase="Para uma ligação de despertar por dia..." filename="ivr-for_daily_wakeup_call.wav"/> + <prompt phrase="ligação de despertar diária..." filename="ivr-daily_wakeup_call.wav"/> + <prompt phrase="Para ligações de despertar diárias..." filename="ivr-for_daily_wakeup_calls.wav"/> + <prompt phrase="Para apenas uma ligação de despertar..." filename="ivr-for_one_time_wakeup_call.wav"/> + <prompt phrase="Apenas uma ligação de despertar..." filename="ivr-one_time_wakeup_call.wav"/> + <prompt phrase="...ligação de despertar..." filename="ivr-wakeup_call.wav"/> + <prompt phrase="Acorda! Acorda raio de sol!!" filename="ivr-wakey_wakey_sunshine.wav"/> + <prompt phrase="Bem-vindo." filename="ivr-welcome.wav"/> + <prompt phrase="Bem-vindo a..." filename="ivr-welcome_to.wav"/> + <prompt phrase="Bom dia." filename="ivr-good_morning.wav"/> + <prompt phrase="Boa tarde." filename="ivr-good_afternoon.wav"/> + <prompt phrase="Boa noite." filename="ivr-good_evening.wav"/> + <prompt phrase="Obrigado." filename="ivr-Thank_you.wav"/> + <prompt phrase="Para..." filename="ivr-for.wav"/> + <prompt phrase="Estamos a observar tempos de espera superiores ao normal." filename="ivr-longer_than_usual_hold_times.wav"/> + <prompt phrase="Você é o..." filename="ivr-you_are_the.wav"/> + <prompt phrase="Um momento por favor." filename="ivr-one_moment_please.wav"/> + <prompt phrase="A sua ligação será atendida pela ordem que foi recebida." filename="ivr-call_answered_order_received.wav"/> + <prompt phrase="Por favor digite o número da conferência, seguido de sustenido." filename="conf-enter_conf_number.wav"/> + <prompt phrase="Introduza o número PIN da conferência, seguido de sustenido." filename="conf-enter_conf_pin.wav"/> + <prompt phrase="...entrou na conferência." filename="conf-has_joined.wav"/> + <prompt phrase="...abandonou a conferência." filename="conf-has_left.wav"/> + <prompt phrase="Você entrou..." filename="ivr-you_entered.wav"/> + <prompt phrase="Número do ramal..." filename="ivr-extension_number.wav"/> + <prompt phrase="Por favor aguarde enquanto contatamos com o destinatário." filename="ivr-please_hold_while_party_contacted.wav"/> + <prompt phrase="Por favor desfrute da música enquanto contatamos com o destinatário." filename="ivr-please_enjoy_music_while_party_reached.wav"/> + <prompt phrase="Obrigado por telefonar. Se conhece a ramal do destinatário, digite-o agora, ou digite nove para ir para o diretório." filename="ivr-generic_greeting.wav"/> + <prompt phrase="Se isto é correcto, digite 1. Se não é correcto, digite 2." filename="ivr-if_correct_one_if_not_two.wav"/> + <prompt phrase="Para ouvir novamente esta informação.." filename="ivr-repeat_this_information.wav"/> + <prompt phrase="Não não não!" filename="ivr-no_no_no.wav"/> + <prompt phrase="Você pretendia marcar esta tecla?" filename="ivr-did_you_mean_to_press_key.wav"/> + <prompt phrase="É sério? Pretendia MESMO marcar esta tecla?" filename="ivr-seriously_mean_to_press_key.wav"/> + <prompt phrase="Oh, tanto faz." filename="ivr-oh_whatever.wav"/> + <prompt phrase="Já chega! Um erro mais e corto a ligação." filename="ivr-one_more_mistake.wav"/> + <prompt phrase="Felicidades, você pressionou estrela. Isto não significa que você é uma estrela. Apenas significa que pode pressionar teclas e que provavelmente tens dedos." filename="ivr-congratulations_you_pressed_star.wav"/> + <prompt phrase="Todos os nossos engenheiros estão ocupados demonstrando como é impressionante CudaTel." filename="ivr-engineers_busy_assisting_other_sales.wav"/> + <prompt phrase="O destino que deseja contatar não está disponível e não tem correio de voz." filename="vm-not_available_no_voicemail.wav"/> + <prompt phrase="Esta mensagem vai se auto-destruir em 5, 4, 3, 2, 1..." filename="ivr-message_self_destruct.wav"/> + <prompt phrase="Você já está em silêncio." filename="conf-you_are_already_muted.wav"/> + <prompt phrase="Você está agora em silêncio em ambos sentidos." filename="conf-you_are_now_bidirectionally_muted.wav"/> + <prompt phrase="Todas as suas ligações nos pertence." filename="ivr-all_your_call_are_belong_to_us.wav"/> + <prompt phrase="Adoro a forma como você pressiona as teclas!" filename="ivr-love_those_touch_tones.wav"/> + <prompt phrase="Sim, nós não temos bananas." filename="ivr-yes_we_have_no_bananas.wav"/> + <prompt phrase="Homem, você está sendo ridículo!" filename="ivr-dude_you_suck.wav"/> + <prompt phrase="A sua ligação é muito importante para nós, mas a sua saúde mental não, por isso estamos felizes em fazê-lo esperar, torturando-o com a irritante música de espera." filename="ivr-on_hold_indefinitely.wav"/> + <prompt phrase="...deixou o edifício." filename="ivr-has_left_the_building.wav"/> + <prompt phrase="Este telefone não está associado e não pode realizar ligações externas." filename="ivr-phone_is_unassigned.wav"/> + <prompt phrase="Este telefone não está configurado corretamente." filename="ivr-phone_not_configured.wav"/> + <prompt phrase="Parabéns! Este telefone está configurado corretamente e agora pode ser associado a um utilizador." filename="ivr-phone_is_configured_properly.wav"/> + <prompt phrase="Por favor contate o administrador do sistema para assistência." filename="ivr-contact_system_administrator.wav"/> + <prompt phrase="Barracuda Networks" filename="ivr-barracuda_networks.wav"/> + <prompt phrase="CudaTel Communication Server" filename="ivr-cudatel_communication_server.wav"/> + <prompt phrase="Por favor, introduza as primeiras letras do primeiro ou último nome da pessoa" filename="dir-enter_person_first_or_last.wav"/> + <prompt phrase="Não há mais ligações em espera nesta fila." filename="ivr-no_calls_waiting_in_queue.wav"/> + <prompt phrase="Brian West" filename="misc-Brian_West.wav"/> + <prompt phrase="Anthony Minessale" filename="misc-Anthony_Minessale.wav"/> + <prompt phrase="Michael Jerris" filename="misc-Michael_Jerris.wav"/> + <prompt phrase="Raymond Chandler" filename="misc-Raymond_Chandler.wav"/> + <prompt phrase="Michael Collins" filename="misc-Michael_Collins.wav"/> + <prompt phrase="Mark Mann" filename="misc-Mark_Mann.wav"/> + <prompt phrase="William King" filename="misc-William_King.wav"/> + <prompt phrase="Rudy Fleminger" filename="misc-Rudy_Fleminger.wav"/> + <prompt phrase="Andrew Thompson" filename="misc-Andrew_Thompson.wav"/> + <prompt phrase="Graham Saathoff" filename="misc-Graham_Saathoff.wav"/> + <prompt phrase="Nicholaus Belluni" filename="misc-Nicholaus_Belluni.wav"/> + <prompt phrase="Sean Heiney" filename="misc-Sean_Heiney.wav"/> + </ivr> + <misc> + <prompt phrase="Foi ativada a segurança para esta ligação." filename="call_secured.wav"/> + <prompt phrase="...depois a tecla sustenido." filename="followed.wav"/> + <prompt phrase="Se você é esta pessoa..." filename="if_you_are_this_person.wav"/> + <prompt phrase="Se você deseja..." filename="if_you_would_like_to.wav"/> + <prompt phrase="Indique o número de referência" filename="provide_reference_number.wav"/> + <prompt phrase="Por favor, digite o ramal que deseja transferir." filename="transfer1.wav"/> + <prompt phrase="Transferir" filename="transfer2.wav"/> + <prompt phrase="Estamos tentando contatar..." filename="we_are_trying_to_reach.wav"/> + <prompt phrase="Houve uma falha, por favor entre em contato com o administrador." filename="error.wav"/> + <prompt phrase="A sua ligação vai terminar em..." filename="misc-your_call_will_be_terminated_in.wav"/> + <prompt phrase="A sua ligação foi finalizada." filename="misc-your_call_has_been_terminated.wav"/> + </misc> + <zrtp> + <!-- base256 prompts for SAS --> + <prompt phrase="Algol" filename="Algol.wav"/> + <prompt phrase="Apollo" filename="Apollo.wav"/> + <prompt phrase="Athens" filename="Athens.wav"/> + <prompt phrase="Atlantic" filename="Atlantic.wav"/> + <prompt phrase="Aztec" filename="Aztec.wav"/> + <prompt phrase="Babylon" filename="Babylon.wav"/> + <prompt phrase="Belfast" filename="Belfast.wav"/> + <prompt phrase="Bradbury" filename="Bradbury.wav"/> + <prompt phrase="Brazilian" filename="Brazilian.wav"/> + <prompt phrase="Burbank" filename="Burbank.wav"/> + <prompt phrase="Burlington" filename="Burlington.wav"/> + <prompt phrase="Camelot" filename="Camelot.wav"/> + <prompt phrase="Capricorn" filename="Capricorn.wav"/> + <prompt phrase="Cherokee" filename="Cherokee.wav"/> + <prompt phrase="Chicago" filename="Chicago.wav"/> + <prompt phrase="Christmas" filename="Christmas.wav"/> + <prompt phrase="Dakota" filename="Dakota.wav"/> + <prompt phrase="December" filename="December.wav"/> + <prompt phrase="Dupont" filename="Dupont.wav"/> + <prompt phrase="Eskimo" filename="Eskimo.wav"/> + <prompt phrase="Galveston" filename="Galveston.wav"/> + <prompt phrase="Geiger" filename="Geiger.wav"/> + <prompt phrase="Hamilton" filename="Hamilton.wav"/> + <prompt phrase="Istanbul" filename="Istanbul.wav"/> + <prompt phrase="Jamaica" filename="Jamaica.wav"/> + <prompt phrase="Jupiter" filename="Jupiter.wav"/> + <prompt phrase="Medusa" filename="Medusa.wav"/> + <prompt phrase="Mohawk" filename="Mohawk.wav"/> + <prompt phrase="Montana" filename="Montana.wav"/> + <prompt phrase="Neptune" filename="Neptune.wav"/> + <prompt phrase="Norwegian" filename="Norwegian.wav"/> + <prompt phrase="Oakland" filename="Oakland.wav"/> + <prompt phrase="October" filename="October.wav"/> + <prompt phrase="Ohio" filename="Ohio.wav"/> + <prompt phrase="Orlando" filename="Orlando.wav"/> + <prompt phrase="Pacific" filename="Pacific.wav"/> + <prompt phrase="Pandora" filename="Pandora.wav"/> + <prompt phrase="Pegasus" filename="Pegasus.wav"/> + <prompt phrase="Pluto" filename="Pluto.wav"/> + <prompt phrase="Saturday" filename="Saturday.wav"/> + <prompt phrase="Scotland" filename="Scotland.wav"/> + <prompt phrase="Trojan" filename="Trojan.wav"/> + <prompt phrase="Virginia" filename="Virginia.wav"/> + <prompt phrase="Vulcan" filename="Vulcan.wav"/> + <prompt phrase="Waterloo" filename="Waterloo.wav"/> + <prompt phrase="Wichita" filename="Wichita.wav"/> + <prompt phrase="Wilmington" filename="Wilmington.wav"/> + <prompt phrase="Wyoming" filename="Wyoming.wav"/> + <prompt phrase="Yucatan" filename="Yucatan.wav"/> + <prompt phrase="Zulu" filename="Zulu.wav"/> + <prompt phrase="aardvark" filename="aardvark.wav"/> + <prompt phrase="absurd" filename="absurd.wav"/> + <prompt phrase="accrue" filename="accrue.wav"/> + <prompt phrase="acme" filename="acme.wav"/> + <prompt phrase="adrift" filename="adrift.wav"/> + <prompt phrase="adroitness" filename="adroitness.wav"/> + <prompt phrase="adult" filename="adult.wav"/> + <prompt phrase="adviser" filename="adviser.wav"/> + <prompt phrase="afflict" filename="afflict.wav"/> + <prompt phrase="aftermath" filename="aftermath.wav"/> + <prompt phrase="aggregate" filename="aggregate.wav"/> + <prompt phrase="ahead" filename="ahead.wav"/> + <prompt phrase="aimless" filename="aimless.wav"/> + <prompt phrase="alkali" filename="alkali.wav"/> + <prompt phrase="allow" filename="allow.wav"/> + <prompt phrase="almighty" filename="almighty.wav"/> + <prompt phrase="alone" filename="alone.wav"/> + <prompt phrase="ammo" filename="ammo.wav"/> + <prompt phrase="amulet" filename="amulet.wav"/> + <prompt phrase="amusement" filename="amusement.wav"/> + <prompt phrase="ancient" filename="ancient.wav"/> + <prompt phrase="antenna" filename="antenna.wav"/> + <prompt phrase="apple" filename="apple.wav"/> + <prompt phrase="applicant" filename="applicant.wav"/> + <prompt phrase="armistice" filename="armistice.wav"/> + <prompt phrase="article" filename="article.wav"/> + <prompt phrase="artist" filename="artist.wav"/> + <prompt phrase="assume" filename="assume.wav"/> + <prompt phrase="asteroid" filename="asteroid.wav"/> + <prompt phrase="atlas" filename="atlas.wav"/> + <prompt phrase="atmosphere" filename="atmosphere.wav"/> + <prompt phrase="autopsy" filename="autopsy.wav"/> + <prompt phrase="baboon" filename="baboon.wav"/> + <prompt phrase="backfield" filename="backfield.wav"/> + <prompt phrase="backward" filename="backward.wav"/> + <prompt phrase="backwater" filename="backwater.wav"/> + <prompt phrase="banjo" filename="banjo.wav"/> + <prompt phrase="barbecue" filename="barbecue.wav"/> + <prompt phrase="beaming" filename="beaming.wav"/> + <prompt phrase="bedlamp" filename="bedlamp.wav"/> + <prompt phrase="beehive" filename="beehive.wav"/> + <prompt phrase="beeswax" filename="beeswax.wav"/> + <prompt phrase="befriend" filename="befriend.wav"/> + <prompt phrase="belowground" filename="belowground.wav"/> + <prompt phrase="berserk" filename="berserk.wav"/> + <prompt phrase="bifocals" filename="bifocals.wav"/> + <prompt phrase="billiard" filename="billiard.wav"/> + <prompt phrase="bison" filename="bison.wav"/> + <prompt phrase="blackjack" filename="blackjack.wav"/> + <prompt phrase="blockade" filename="blockade.wav"/> + <prompt phrase="blowtorch" filename="blowtorch.wav"/> + <prompt phrase="bluebird" filename="bluebird.wav"/> + <prompt phrase="bodyguard" filename="bodyguard.wav"/> + <prompt phrase="bombast" filename="bombast.wav"/> + <prompt phrase="bookseller" filename="bookseller.wav"/> + <prompt phrase="bookshelf" filename="bookshelf.wav"/> + <prompt phrase="borderline" filename="borderline.wav"/> + <prompt phrase="bottomless" filename="bottomless.wav"/> + <prompt phrase="brackish" filename="brackish.wav"/> + <prompt phrase="bravado" filename="bravado.wav"/> + <prompt phrase="breadline" filename="breadline.wav"/> + <prompt phrase="breakaway" filename="breakaway.wav"/> + <prompt phrase="breakup" filename="breakup.wav"/> + <prompt phrase="brickyard" filename="brickyard.wav"/> + <prompt phrase="briefcase" filename="briefcase.wav"/> + <prompt phrase="businessman" filename="businessman.wav"/> + <prompt phrase="butterfat" filename="butterfat.wav"/> + <prompt phrase="button" filename="button.wav"/> + <prompt phrase="buzzard" filename="buzzard.wav"/> + <prompt phrase="candidate" filename="candidate.wav"/> + <prompt phrase="cannonball" filename="cannonball.wav"/> + <prompt phrase="caravan" filename="caravan.wav"/> + <prompt phrase="caretaker" filename="caretaker.wav"/> + <prompt phrase="celebrate" filename="celebrate.wav"/> + <prompt phrase="cellulose" filename="cellulose.wav"/> + <prompt phrase="cement" filename="cement.wav"/> + <prompt phrase="certify" filename="certify.wav"/> + <prompt phrase="chairlift" filename="chairlift.wav"/> + <prompt phrase="chambermaid" filename="chambermaid.wav"/> + <prompt phrase="chatter" filename="chatter.wav"/> + <prompt phrase="checkup" filename="checkup.wav"/> + <prompt phrase="chisel" filename="chisel.wav"/> + <prompt phrase="choking" filename="choking.wav"/> + <prompt phrase="chopper" filename="chopper.wav"/> + <prompt phrase="clamshell" filename="clamshell.wav"/> + <prompt phrase="classic" filename="classic.wav"/> + <prompt phrase="classroom" filename="classroom.wav"/> + <prompt phrase="cleanup" filename="cleanup.wav"/> + <prompt phrase="clergyman" filename="clergyman.wav"/> + <prompt phrase="clockwork" filename="clockwork.wav"/> + <prompt phrase="cobra" filename="cobra.wav"/> + <prompt phrase="coherence" filename="coherence.wav"/> + <prompt phrase="combustion" filename="combustion.wav"/> + <prompt phrase="commando" filename="commando.wav"/> + <prompt phrase="commence" filename="commence.wav"/> + <prompt phrase="company" filename="company.wav"/> + <prompt phrase="component" filename="component.wav"/> + <prompt phrase="concert" filename="concert.wav"/> + <prompt phrase="concurrent" filename="concurrent.wav"/> + <prompt phrase="confidence" filename="confidence.wav"/> + <prompt phrase="conformist" filename="conformist.wav"/> + <prompt phrase="congregate" filename="congregate.wav"/> + <prompt phrase="consensus" filename="consensus.wav"/> + <prompt phrase="consulting" filename="consulting.wav"/> + <prompt phrase="corporate" filename="corporate.wav"/> + <prompt phrase="corrosion" filename="corrosion.wav"/> + <prompt phrase="councilman" filename="councilman.wav"/> + <prompt phrase="cowbell" filename="cowbell.wav"/> + <prompt phrase="crackdown" filename="crackdown.wav"/> + <prompt phrase="cranky" filename="cranky.wav"/> + <prompt phrase="crossover" filename="crossover.wav"/> + <prompt phrase="crowfoot" filename="crowfoot.wav"/> + <prompt phrase="crucial" filename="crucial.wav"/> + <prompt phrase="crucifix" filename="crucifix.wav"/> + <prompt phrase="crumpled" filename="crumpled.wav"/> + <prompt phrase="crusade" filename="crusade.wav"/> + <prompt phrase="cubic" filename="cubic.wav"/> + <prompt phrase="cumbersome" filename="cumbersome.wav"/> + <prompt phrase="customer" filename="customer.wav"/> + <prompt phrase="dashboard" filename="dashboard.wav"/> + <prompt phrase="deadbolt" filename="deadbolt.wav"/> + <prompt phrase="decadence" filename="decadence.wav"/> + <prompt phrase="decimal" filename="decimal.wav"/> + <prompt phrase="deckhand" filename="deckhand.wav"/> + <prompt phrase="designing" filename="designing.wav"/> + <prompt phrase="detector" filename="detector.wav"/> + <prompt phrase="detergent" filename="detergent.wav"/> + <prompt phrase="determine" filename="determine.wav"/> + <prompt phrase="dictator" filename="dictator.wav"/> + <prompt phrase="dinosaur" filename="dinosaur.wav"/> + <prompt phrase="direction" filename="direction.wav"/> + <prompt phrase="disable" filename="disable.wav"/> + <prompt phrase="disbelief" filename="disbelief.wav"/> + <prompt phrase="disruptive" filename="disruptive.wav"/> + <prompt phrase="distortion" filename="distortion.wav"/> + <prompt phrase="document" filename="document.wav"/> + <prompt phrase="dogsled" filename="dogsled.wav"/> + <prompt phrase="dragnet" filename="dragnet.wav"/> + <prompt phrase="drainage" filename="drainage.wav"/> + <prompt phrase="dreadful" filename="dreadful.wav"/> + <prompt phrase="drifter" filename="drifter.wav"/> + <prompt phrase="dropper" filename="dropper.wav"/> + <prompt phrase="drumbeat" filename="drumbeat.wav"/> + <prompt phrase="drunken" filename="drunken.wav"/> + <prompt phrase="dwelling" filename="dwelling.wav"/> + <prompt phrase="eating" filename="eating.wav"/> + <prompt phrase="edict" filename="edict.wav"/> + <prompt phrase="egghead" filename="egghead.wav"/> + <prompt phrase="eightball" filename="eightball.wav"/> + <prompt phrase="embezzle" filename="embezzle.wav"/> + <prompt phrase="enchanting" filename="enchanting.wav"/> + <prompt phrase="endorse" filename="endorse.wav"/> + <prompt phrase="endow" filename="endow.wav"/> + <prompt phrase="enlist" filename="enlist.wav"/> + <prompt phrase="enrollment" filename="enrollment.wav"/> + <prompt phrase="enterprise" filename="enterprise.wav"/> + <prompt phrase="equation" filename="equation.wav"/> + <prompt phrase="equipment" filename="equipment.wav"/> + <prompt phrase="erase" filename="erase.wav"/> + <prompt phrase="escapade" filename="escapade.wav"/> + <prompt phrase="escape" filename="escape.wav"/> + <prompt phrase="everyday" filename="everyday.wav"/> + <prompt phrase="examine" filename="examine.wav"/> + <prompt phrase="exceed" filename="exceed.wav"/> + <prompt phrase="existence" filename="existence.wav"/> + <prompt phrase="exodus" filename="exodus.wav"/> + <prompt phrase="eyeglass" filename="eyeglass.wav"/> + <prompt phrase="eyetooth" filename="eyetooth.wav"/> + <prompt phrase="facial" filename="facial.wav"/> + <prompt phrase="fallout" filename="fallout.wav"/> + <prompt phrase="fascinate" filename="fascinate.wav"/> + <prompt phrase="filament" filename="filament.wav"/> + <prompt phrase="finicky" filename="finicky.wav"/> + <prompt phrase="flagpole" filename="flagpole.wav"/> + <prompt phrase="flatfoot" filename="flatfoot.wav"/> + <prompt phrase="flytrap" filename="flytrap.wav"/> + <prompt phrase="forever" filename="forever.wav"/> + <prompt phrase="fortitude" filename="fortitude.wav"/> + <prompt phrase="fracture" filename="fracture.wav"/> + <prompt phrase="framework" filename="framework.wav"/> + <prompt phrase="freedom" filename="freedom.wav"/> + <prompt phrase="frequency" filename="frequency.wav"/> + <prompt phrase="frighten" filename="frighten.wav"/> + <prompt phrase="gadgetry" filename="gadgetry.wav"/> + <prompt phrase="gazelle" filename="gazelle.wav"/> + <prompt phrase="getaway" filename="getaway.wav"/> + <prompt phrase="glitter" filename="glitter.wav"/> + <prompt phrase="glossary" filename="glossary.wav"/> + <prompt phrase="glucose" filename="glucose.wav"/> + <prompt phrase="goggles" filename="goggles.wav"/> + <prompt phrase="goldfish" filename="goldfish.wav"/> + <prompt phrase="gossamer" filename="gossamer.wav"/> + <prompt phrase="graduate" filename="graduate.wav"/> + <prompt phrase="gravity" filename="gravity.wav"/> + <prompt phrase="gremlin" filename="gremlin.wav"/> + <prompt phrase="guidance" filename="guidance.wav"/> + <prompt phrase="guitarist" filename="guitarist.wav"/> + <prompt phrase="hamburger" filename="hamburger.wav"/> + <prompt phrase="hamlet" filename="hamlet.wav"/> + <prompt phrase="handiwork" filename="handiwork.wav"/> + <prompt phrase="hazardous" filename="hazardous.wav"/> + <prompt phrase="headwaters" filename="headwaters.wav"/> + <prompt phrase="hemisphere" filename="hemisphere.wav"/> + <prompt phrase="hesitate" filename="hesitate.wav"/> + <prompt phrase="hideaway" filename="hideaway.wav"/> + <prompt phrase="highchair" filename="highchair.wav"/> + <prompt phrase="hockey" filename="hockey.wav"/> + <prompt phrase="holiness" filename="holiness.wav"/> + <prompt phrase="hurricane" filename="hurricane.wav"/> + <prompt phrase="hydraulic" filename="hydraulic.wav"/> + <prompt phrase="impartial" filename="impartial.wav"/> + <prompt phrase="impetus" filename="impetus.wav"/> + <prompt phrase="inception" filename="inception.wav"/> + <prompt phrase="indigo" filename="indigo.wav"/> + <prompt phrase="indoors" filename="indoors.wav"/> + <prompt phrase="indulge" filename="indulge.wav"/> + <prompt phrase="inertia" filename="inertia.wav"/> + <prompt phrase="infancy" filename="infancy.wav"/> + <prompt phrase="inferno" filename="inferno.wav"/> + <prompt phrase="informant" filename="informant.wav"/> + <prompt phrase="insincere" filename="insincere.wav"/> + <prompt phrase="insurgent" filename="insurgent.wav"/> + <prompt phrase="integrate" filename="integrate.wav"/> + <prompt phrase="intention" filename="intention.wav"/> + <prompt phrase="inventive" filename="inventive.wav"/> + <prompt phrase="inverse" filename="inverse.wav"/> + <prompt phrase="involve" filename="involve.wav"/> + <prompt phrase="island" filename="island.wav"/> + <prompt phrase="jawbone" filename="jawbone.wav"/> + <prompt phrase="keyboard" filename="keyboard.wav"/> + <prompt phrase="kickoff" filename="kickoff.wav"/> + <prompt phrase="kiwi" filename="kiwi.wav"/> + <prompt phrase="klaxon" filename="klaxon.wav"/> + <prompt phrase="leprosy" filename="leprosy.wav"/> + <prompt phrase="letterhead" filename="letterhead.wav"/> + <prompt phrase="liberty" filename="liberty.wav"/> + <prompt phrase="locale" filename="locale.wav"/> + <prompt phrase="lockup" filename="lockup.wav"/> + <prompt phrase="maritime" filename="maritime.wav"/> + <prompt phrase="matchmaker" filename="matchmaker.wav"/> + <prompt phrase="maverick" filename="maverick.wav"/> + <prompt phrase="megaton" filename="megaton.wav"/> + <prompt phrase="merit" filename="merit.wav"/> + <prompt phrase="microscope" filename="microscope.wav"/> + <prompt phrase="microwave" filename="microwave.wav"/> + <prompt phrase="midsummer" filename="midsummer.wav"/> + <prompt phrase="millionaire" filename="millionaire.wav"/> + <prompt phrase="minnow" filename="minnow.wav"/> + <prompt phrase="miracle" filename="miracle.wav"/> + <prompt phrase="miser" filename="miser.wav"/> + <prompt phrase="misnomer" filename="misnomer.wav"/> + <prompt phrase="molasses" filename="molasses.wav"/> + <prompt phrase="molecule" filename="molecule.wav"/> + <prompt phrase="monument" filename="monument.wav"/> + <prompt phrase="mosquito" filename="mosquito.wav"/> + <prompt phrase="mural" filename="mural.wav"/> + <prompt phrase="music" filename="music.wav"/> + <prompt phrase="narrative" filename="narrative.wav"/> + <prompt phrase="nebula" filename="nebula.wav"/> + <prompt phrase="necklace" filename="necklace.wav"/> + <prompt phrase="newborn" filename="newborn.wav"/> + <prompt phrase="newsletter" filename="newsletter.wav"/> + <prompt phrase="nightbird" filename="nightbird.wav"/> + <prompt phrase="obtuse" filename="obtuse.wav"/> + <prompt phrase="offload" filename="offload.wav"/> + <prompt phrase="onlooker" filename="onlooker.wav"/> + <prompt phrase="optic" filename="optic.wav"/> + <prompt phrase="opulent" filename="opulent.wav"/> + <prompt phrase="orca" filename="orca.wav"/> + <prompt phrase="outfielder" filename="outfielder.wav"/> + <prompt phrase="pandemic" filename="pandemic.wav"/> + <prompt phrase="paperweight" filename="paperweight.wav"/> + <prompt phrase="paragon" filename="paragon.wav"/> + <prompt phrase="paragraph" filename="paragraph.wav"/> + <prompt phrase="paramount" filename="paramount.wav"/> + <prompt phrase="passenger" filename="passenger.wav"/> + <prompt phrase="payday" filename="payday.wav"/> + <prompt phrase="peachy" filename="peachy.wav"/> + <prompt phrase="pedigree" filename="pedigree.wav"/> + <prompt phrase="penetrate" filename="penetrate.wav"/> + <prompt phrase="perceptive" filename="perceptive.wav"/> + <prompt phrase="performance" filename="performance.wav"/> + <prompt phrase="pharmacy" filename="pharmacy.wav"/> + <prompt phrase="pheasant" filename="pheasant.wav"/> + <prompt phrase="phonetic" filename="phonetic.wav"/> + <prompt phrase="photograph" filename="photograph.wav"/> + <prompt phrase="physique" filename="physique.wav"/> + <prompt phrase="pioneer" filename="pioneer.wav"/> + <prompt phrase="playhouse" filename="playhouse.wav"/> + <prompt phrase="pocketful" filename="pocketful.wav"/> + <prompt phrase="politeness" filename="politeness.wav"/> + <prompt phrase="positive" filename="positive.wav"/> + <prompt phrase="potato" filename="potato.wav"/> + <prompt phrase="preclude" filename="preclude.wav"/> + <prompt phrase="prefer" filename="prefer.wav"/> + <prompt phrase="preshrunk" filename="preshrunk.wav"/> + <prompt phrase="printer" filename="printer.wav"/> + <prompt phrase="processor" filename="processor.wav"/> + <prompt phrase="provincial" filename="provincial.wav"/> + <prompt phrase="prowler" filename="prowler.wav"/> + <prompt phrase="proximate" filename="proximate.wav"/> + <prompt phrase="puberty" filename="puberty.wav"/> + <prompt phrase="publisher" filename="publisher.wav"/> + <prompt phrase="pupil" filename="pupil.wav"/> + <prompt phrase="puppy" filename="puppy.wav"/> + <prompt phrase="pyramid" filename="pyramid.wav"/> + <prompt phrase="python" filename="python.wav"/> + <prompt phrase="quadrant" filename="quadrant.wav"/> + <prompt phrase="quantity" filename="quantity.wav"/> + <prompt phrase="quiver" filename="quiver.wav"/> + <prompt phrase="quota" filename="quota.wav"/> + <prompt phrase="racketeer" filename="racketeer.wav"/> + <prompt phrase="ragtime" filename="ragtime.wav"/> + <prompt phrase="ratchet" filename="ratchet.wav"/> + <prompt phrase="rebellion" filename="rebellion.wav"/> + <prompt phrase="rebirth" filename="rebirth.wav"/> + <prompt phrase="recipe" filename="recipe.wav"/> + <prompt phrase="recover" filename="recover.wav"/> + <prompt phrase="reform" filename="reform.wav"/> + <prompt phrase="regain" filename="regain.wav"/> + <prompt phrase="reindeer" filename="reindeer.wav"/> + <prompt phrase="rematch" filename="rematch.wav"/> + <prompt phrase="repay" filename="repay.wav"/> + <prompt phrase="repellent" filename="repellent.wav"/> + <prompt phrase="replica" filename="replica.wav"/> + <prompt phrase="reproduce" filename="reproduce.wav"/> + <prompt phrase="resistor" filename="resistor.wav"/> + <prompt phrase="responsive" filename="responsive.wav"/> + <prompt phrase="retouch" filename="retouch.wav"/> + <prompt phrase="retraction" filename="retraction.wav"/> + <prompt phrase="retrieval" filename="retrieval.wav"/> + <prompt phrase="retrospect" filename="retrospect.wav"/> + <prompt phrase="revenge" filename="revenge.wav"/> + <prompt phrase="revenue" filename="revenue.wav"/> + <prompt phrase="revival" filename="revival.wav"/> + <prompt phrase="revolver" filename="revolver.wav"/> + <prompt phrase="reward" filename="reward.wav"/> + <prompt phrase="rhythm" filename="rhythm.wav"/> + <prompt phrase="ribcage" filename="ribcage.wav"/> + <prompt phrase="ringbolt" filename="ringbolt.wav"/> + <prompt phrase="robust" filename="robust.wav"/> + <prompt phrase="rocker" filename="rocker.wav"/> + <prompt phrase="ruffled" filename="ruffled.wav"/> + <prompt phrase="sailboat" filename="sailboat.wav"/> + <prompt phrase="sandalwood" filename="sandalwood.wav"/> + <prompt phrase="sardonic" filename="sardonic.wav"/> + <prompt phrase="savagery" filename="savagery.wav"/> + <prompt phrase="sawdust" filename="sawdust.wav"/> + <prompt phrase="scallion" filename="scallion.wav"/> + <prompt phrase="scavenger" filename="scavenger.wav"/> + <prompt phrase="scenic" filename="scenic.wav"/> + <prompt phrase="scorecard" filename="scorecard.wav"/> + <prompt phrase="seabird" filename="seabird.wav"/> + <prompt phrase="select" filename="select.wav"/> + <prompt phrase="sensation" filename="sensation.wav"/> + <prompt phrase="sentence" filename="sentence.wav"/> + <prompt phrase="shadow" filename="shadow.wav"/> + <prompt phrase="shamrock" filename="shamrock.wav"/> + <prompt phrase="showgirl" filename="showgirl.wav"/> + <prompt phrase="skullcap" filename="skullcap.wav"/> + <prompt phrase="skydive" filename="skydive.wav"/> + <prompt phrase="slingshot" filename="slingshot.wav"/> + <prompt phrase="slowdown" filename="slowdown.wav"/> + <prompt phrase="snapline" filename="snapline.wav"/> + <prompt phrase="snapshot" filename="snapshot.wav"/> + <prompt phrase="snowcap" filename="snowcap.wav"/> + <prompt phrase="snowslide" filename="snowslide.wav"/> + <prompt phrase="sociable" filename="sociable.wav"/> + <prompt phrase="solo" filename="solo.wav"/> + <prompt phrase="southward" filename="southward.wav"/> + <prompt phrase="souvenir" filename="souvenir.wav"/> + <prompt phrase="soybean" filename="soybean.wav"/> + <prompt phrase="spaniel" filename="spaniel.wav"/> + <prompt phrase="spearhead" filename="spearhead.wav"/> + <prompt phrase="specialist" filename="specialist.wav"/> + <prompt phrase="speculate" filename="speculate.wav"/> + <prompt phrase="spellbind" filename="spellbind.wav"/> + <prompt phrase="spheroid" filename="spheroid.wav"/> + <prompt phrase="spigot" filename="spigot.wav"/> + <prompt phrase="spindle" filename="spindle.wav"/> + <prompt phrase="spyglass" filename="spyglass.wav"/> + <prompt phrase="stagehand" filename="stagehand.wav"/> + <prompt phrase="stagnate" filename="stagnate.wav"/> + <prompt phrase="stairway" filename="stairway.wav"/> + <prompt phrase="standard" filename="standard.wav"/> + <prompt phrase="stapler" filename="stapler.wav"/> + <prompt phrase="steamship" filename="steamship.wav"/> + <prompt phrase="sterling" filename="sterling.wav"/> + <prompt phrase="stethoscope" filename="stethoscope.wav"/> + <prompt phrase="stockman" filename="stockman.wav"/> + <prompt phrase="stopwatch" filename="stopwatch.wav"/> + <prompt phrase="stormy" filename="stormy.wav"/> + <prompt phrase="stupendous" filename="stupendous.wav"/> + <prompt phrase="sugar" filename="sugar.wav"/> + <prompt phrase="supportive" filename="supportive.wav"/> + <prompt phrase="surmount" filename="surmount.wav"/> + <prompt phrase="surrender" filename="surrender.wav"/> + <prompt phrase="suspense" filename="suspense.wav"/> + <prompt phrase="suspicious" filename="suspicious.wav"/> + <prompt phrase="sweatband" filename="sweatband.wav"/> + <prompt phrase="swelter" filename="swelter.wav"/> + <prompt phrase="sympathy" filename="sympathy.wav"/> + <prompt phrase="tactics" filename="tactics.wav"/> + <prompt phrase="talon" filename="talon.wav"/> + <prompt phrase="tambourine" filename="tambourine.wav"/> + <prompt phrase="tapeworm" filename="tapeworm.wav"/> + <prompt phrase="telephone" filename="telephone.wav"/> + <prompt phrase="tempest" filename="tempest.wav"/> + <prompt phrase="therapist" filename="therapist.wav"/> + <prompt phrase="tiger" filename="tiger.wav"/> + <prompt phrase="tissue" filename="tissue.wav"/> + <prompt phrase="tobacco" filename="tobacco.wav"/> + <prompt phrase="tolerance" filename="tolerance.wav"/> + <prompt phrase="tomorrow" filename="tomorrow.wav"/> + <prompt phrase="tonic" filename="tonic.wav"/> + <prompt phrase="topmost" filename="topmost.wav"/> + <prompt phrase="torpedo" filename="torpedo.wav"/> + <prompt phrase="tracker" filename="tracker.wav"/> + <prompt phrase="tradition" filename="tradition.wav"/> + <prompt phrase="transit" filename="transit.wav"/> + <prompt phrase="trauma" filename="trauma.wav"/> + <prompt phrase="travesty" filename="travesty.wav"/> + <prompt phrase="treadmill" filename="treadmill.wav"/> + <prompt phrase="trombonist" filename="trombonist.wav"/> + <prompt phrase="trouble" filename="trouble.wav"/> + <prompt phrase="truncated" filename="truncated.wav"/> + <prompt phrase="tumor" filename="tumor.wav"/> + <prompt phrase="tunnel" filename="tunnel.wav"/> + <prompt phrase="tycoon" filename="tycoon.wav"/> + <prompt phrase="typewriter" filename="typewriter.wav"/> + <prompt phrase="ultimate" filename="ultimate.wav"/> + <prompt phrase="uncut" filename="uncut.wav"/> + <prompt phrase="undaunted" filename="undaunted.wav"/> + <prompt phrase="underfoot" filename="underfoot.wav"/> + <prompt phrase="unearth" filename="unearth.wav"/> + <prompt phrase="unicorn" filename="unicorn.wav"/> + <prompt phrase="unify" filename="unify.wav"/> + <prompt phrase="universe" filename="universe.wav"/> + <prompt phrase="unravel" filename="unravel.wav"/> + <prompt phrase="unwind" filename="unwind.wav"/> + <prompt phrase="upcoming" filename="upcoming.wav"/> + <prompt phrase="uproot" filename="uproot.wav"/> + <prompt phrase="upset" filename="upset.wav"/> + <prompt phrase="upshot" filename="upshot.wav"/> + <prompt phrase="vacancy" filename="vacancy.wav"/> + <prompt phrase="vagabond" filename="vagabond.wav"/> + <prompt phrase="vapor" filename="vapor.wav"/> + <prompt phrase="vertigo" filename="vertigo.wav"/> + <prompt phrase="village" filename="village.wav"/> + <prompt phrase="virus" filename="virus.wav"/> + <prompt phrase="visitor" filename="visitor.wav"/> + <prompt phrase="vocalist" filename="vocalist.wav"/> + <prompt phrase="voyager" filename="voyager.wav"/> + <prompt phrase="waffle" filename="waffle.wav"/> + <prompt phrase="wallet" filename="wallet.wav"/> + <prompt phrase="warranty" filename="warranty.wav"/> + <prompt phrase="watchword" filename="watchword.wav"/> + <prompt phrase="wayside" filename="wayside.wav"/> + <prompt phrase="whimsical" filename="whimsical.wav"/> + <prompt phrase="willow" filename="willow.wav"/> + <prompt phrase="woodlark" filename="woodlark.wav"/> + <prompt phrase="yesteryear" filename="yesteryear.wav"/> + <!-- Event prompts --> + <prompt phrase="Bem-vindo ao agente de registro de segurança ZRTP." filename="zrtp-enroll_welcome.wav"/> + <prompt phrase="Você deve verificar a autentificação com o seu destinatário. Se não coincidir, isso indica presença de um dispositivo de escuta telefonica." filename="zrtp-check_sas.wav"/> + <prompt phrase="Somente aqueles telefones que estem autentificados podem ser configurados de maneira segura neste sistema para retransmitir as ligações em ZRTP. O seu telefone nao esta autentificado com este sistema, esta ligação não sera realizada." filename="zrtp-enroll_not_sip_registered.wav"/> + <prompt phrase="O seu telefone indica que é seguro este sistema para realizar ligações seguras em ZRTP, você não precisa fazer nada mais." filename="zrtp-enroll_already_enrolled.wav"/> + <prompt phrase="Somente os telefones equipados com protocolo ZRTP podem usar este ramal.O seu telefone não esta configurado para ZRTP, esta ligação não sera completada." filename="zrtp-enroll_notzrtp.wav"/> + <prompt phrase="Este sistema está configurado para realizar ligações telefonicas encriptadas em ZRTP. Você deve decidir se permitira que este sistema possa interceptar e monitorizar as suas ligações telefonicas seguras. Pode finalizar a ligação depois disso." filename="zrtp-enroll_confirmed.wav"/> + <prompt phrase="Compare verbalmente este código de autentificação com o seu destinatário." filename="zrtp-is_secure.wav"/> + <prompt phrase="O código de autentificação não foi verificado." filename="zrtp-is_unverified.wav"/> + <prompt phrase="O código de autentificação foi verificado." filename="zrtp-is_verified.wav"/> + <prompt phrase="Obrigado pela sua ligação. Até logo." filename="zrtp-thankyou_goodbye.wav"/> + <prompt phrase="Algo falha." filename="zrtp-somethings_wrong.wav"/> + <prompt phrase="Erro." filename="zrtp-status_error.wav"/> + <prompt phrase="A ligação não e segura." filename="zrtp-status_notsecure.wav"/> + <prompt phrase="A ligação e segura." filename="zrtp-status_secure.wav"/> + <prompt phrase="Securizando a ligação." filename="zrtp-status_securing.wav"/> + </zrtp> + </pt_BR> +</language> diff --git a/docs/phrase/phrase_pt_PT.xml b/docs/phrase/phrase_pt_PT.xml new file mode 100644 index 0000000..a0e59de --- /dev/null +++ b/docs/phrase/phrase_pt_PT.xml @@ -0,0 +1,987 @@ +<language> + <pt_PT> + <ascii> + <prompt phrase="Espaço" filename="32.wav"/> + <prompt phrase="Cardinal" filename="35.wav"/> + <prompt phrase="Asterisco" filename="42.wav"/> + <prompt phrase="Ponto" filename="46.wav"/> + <prompt phrase="A" filename="97.wav"/> + <prompt phrase="B" filename="98.wav"/> + <prompt phrase="C" filename="99.wav"/> + <prompt phrase="D" filename="100.wav"/> + <prompt phrase="E" filename="101.wav"/> + <prompt phrase="F" filename="102.wav"/> + <prompt phrase="G" filename="103.wav"/> + <prompt phrase="H" filename="104.wav"/> + <prompt phrase="I" filename="105.wav"/> + <prompt phrase="J" filename="106.wav"/> + <prompt phrase="K" filename="107.wav"/> + <prompt phrase="L" filename="108.wav"/> + <prompt phrase="M" filename="109.wav"/> + <prompt phrase="N" filename="110.wav"/> + <prompt phrase="O" filename="111.wav"/> + <prompt phrase="P" filename="112.wav"/> + <prompt phrase="Q" filename="113.wav"/> + <prompt phrase="R" filename="114.wav"/> + <prompt phrase="S" filename="115.wav"/> + <prompt phrase="T" filename="116.wav"/> + <prompt phrase="U" filename="117.wav"/> + <prompt phrase="V" filename="118.wav"/> + <prompt phrase="W" filename="119.wav"/> + <prompt phrase="X" filename="120.wav"/> + <prompt phrase="Y" filename="121.wav"/> + <prompt phrase="Z" filename="122.wav"/> + </ascii> + <phonetic-ascii> + <prompt phrase="Espaço" filename="32.wav"/> + <prompt phrase="Ponto" filename="46.wav"/> + <prompt phrase="Alpha" filename="97.wav"/> + <prompt phrase="Bravo" filename="98.wav"/> + <prompt phrase="Charlie" filename="99.wav"/> + <prompt phrase="Delta" filename="100.wav"/> + <prompt phrase="Echo" filename="101.wav"/> + <prompt phrase="Foxtrot" filename="102.wav"/> + <prompt phrase="Golf" filename="103.wav"/> + <prompt phrase="Hotel" filename="104.wav"/> + <prompt phrase="India" filename="105.wav"/> + <prompt phrase="Juliet" filename="106.wav"/> + <prompt phrase="Kilo" filename="107.wav"/> + <prompt phrase="Lima" filename="108.wav"/> + <prompt phrase="Mike" filename="109.wav"/> + <prompt phrase="November" filename="110.wav"/> + <prompt phrase="Oscar" filename="111.wav"/> + <prompt phrase="Papa" filename="112.wav"/> + <prompt phrase="Quebec" filename="113.wav"/> + <prompt phrase="Romeo" filename="114.wav"/> + <prompt phrase="Sierra" filename="115.wav"/> + <prompt phrase="Tango" filename="116.wav"/> + <prompt phrase="Unifor" filename="117.wav"/> + <prompt phrase="Victor" filename="118.wav"/> + <prompt phrase="Whiskey" filename="119.wav"/> + <prompt phrase="Xray" filename="120.wav"/> + <prompt phrase="Yankee" filename="121.wav"/> + <prompt phrase="Zulu" filename="122.wav"/> + </phonetic-ascii> + <digits> + <prompt phrase="Zero" filename="0.wav"/> + <prompt phrase="Um" filename="1.wav"/> + <prompt phrase="Dois" filename="2.wav"/> + <prompt phrase="Três" filename="3.wav"/> + <prompt phrase="Quatro" filename="4.wav"/> + <prompt phrase="Cinco" filename="5.wav"/> + <prompt phrase="Seis" filename="6.wav"/> + <prompt phrase="Sete" filename="7.wav"/> + <prompt phrase="Oito" filename="8.wav"/> + <prompt phrase="Nove" filename="9.wav"/> + <prompt phrase="Dez" filename="10.wav"/> + <prompt phrase="Onze" filename="11.wav"/> + <prompt phrase="Doze" filename="12.wav"/> + <prompt phrase="Treze" filename="13.wav"/> + <prompt phrase="Catorze" filename="14.wav"/> + <prompt phrase="Quinze" filename="15.wav"/> + <prompt phrase="Dezasseis" filename="16.wav"/> + <prompt phrase="Dezassete" filename="17.wav"/> + <prompt phrase="Dezoito" filename="18.wav"/> + <prompt phrase="Dezanove" filename="19.wav"/> + <prompt phrase="Vinte" filename="20.wav"/> + <prompt phrase="Trinta" filename="30.wav"/> + <prompt phrase="Quarenta" filename="40.wav"/> + <prompt phrase="Cinquenta" filename="50.wav"/> + <prompt phrase="Sessenta" filename="60.wav"/> + <prompt phrase="Setenta" filename="70.wav"/> + <prompt phrase="Oitenta" filename="80.wav"/> + <prompt phrase="Noventa" filename="90.wav"/> + <prompt phrase="Cem" filename="100.wav"/> + <prompt phrase="Duzentos" filename="200.wav"/> + <prompt phrase="Trezentos" filename="300.wav"/> + <prompt phrase="Quinhentos" filename="500.wav"/> + <prompt phrase="Ponto" filename="dot.wav"/> + <prompt phrase="Primeiro" filename="h-1.wav"/> + <prompt phrase="Segundo" filename="h-2.wav"/> + <prompt phrase="Terceiro" filename="h-3.wav"/> + <prompt phrase="Quarto" filename="h-4.wav"/> + <prompt phrase="Quinto" filename="h-5.wav"/> + <prompt phrase="Sexto" filename="h-6.wav"/> + <prompt phrase="Sétimo" filename="h-7.wav"/> + <prompt phrase="Oitavo" filename="h-8.wav"/> + <prompt phrase="Nono" filename="h-9.wav"/> + <prompt phrase="Décimo" filename="h-10.wav"/> + <prompt phrase="Vigésimo" filename="h-20.wav"/> + <prompt phrase="Trigésimo" filename="h-30.wav"/> + <prompt phrase="Quadragésimo" filename="h-40.wav"/> + <prompt phrase="Quinquagésimo" filename="h-50.wav"/> + <prompt phrase="Sexagésimo" filename="h-60.wav"/> + <prompt phrase="Septuagésimo" filename="h-70.wav"/> + <prompt phrase="Octogésimo" filename="h-80.wav"/> + <prompt phrase="Nonagésimo" filename="h-90.wav"/> + <prompt phrase="Cento" filename="hundred.wav"/> + <prompt phrase="Centos" filename="hundreds.wav"/> + <prompt phrase="Mil" filename="thousand.wav"/> + <prompt phrase="Milhão" filename="million.wav"/> + <prompt phrase="Milhões" filename="millions.wav"/> + <prompt phrase="PerÃodo" filename="period.wav"/> + <prompt phrase="Ponto" filename="point.wav"/> + <prompt phrase="Cardinal" filename="pound.wav"/> + <prompt phrase="Asterisco" filename="star.wav"/> + </digits> + <currency> + <prompt phrase="E" filename="and.wav"/> + <prompt phrase="Cêntimo" filename="cent.wav"/> + <prompt phrase="Central" filename="central.wav"/> + <prompt phrase="Cêntimos por minuto" filename="cents-per-minute.wav"/> + <prompt phrase="Cêntimos" filename="cents.wav"/> + <prompt phrase="Dólar" filename="dollar.wav"/> + <prompt phrase="Dólares" filename="dollars.wav"/> + <prompt phrase="Menos" filename="minus.wav"/> + <prompt phrase="Negativo" filename="negative.wav"/> + </currency> + <time> + <prompt phrase="A.M." filename="a-m.wav"/> + <prompt phrase="a" filename="at.wav"/> + <prompt phrase="à s" filename="ats.wav"/> + <prompt phrase="Domingo" filename="day-0.wav"/> + <prompt phrase="Segunda-feira" filename="day-1.wav"/> + <prompt phrase="Terça-feira" filename="day-2.wav"/> + <prompt phrase="Quarta-feira" filename="day-3.wav"/> + <prompt phrase="Quinta-feira" filename="day-4.wav"/> + <prompt phrase="Sexta-feira" filename="day-5.wav"/> + <prompt phrase="Sábado" filename="day-6.wav"/> + <prompt phrase="Hora" filename="hour.wav"/> + <prompt phrase="Horas" filename="hours.wav"/> + <prompt phrase="Minuto" filename="minute.wav"/> + <prompt phrase="Minutos" filename="minutes.wav"/> + <prompt phrase="Janeiro" filename="mon-0.wav"/> + <prompt phrase="Fevereiro" filename="mon-1.wav"/> + <prompt phrase="Março" filename="mon-2.wav"/> + <prompt phrase="Abril" filename="mon-3.wav"/> + <prompt phrase="Maio" filename="mon-4.wav"/> + <prompt phrase="Junho" filename="mon-5.wav"/> + <prompt phrase="Julho" filename="mon-6.wav"/> + <prompt phrase="Agosto" filename="mon-7.wav"/> + <prompt phrase="Setembro" filename="mon-8.wav"/> + <prompt phrase="Outubro" filename="mon-9.wav"/> + <prompt phrase="Novembro" filename="mon-10.wav"/> + <prompt phrase="Dezembro" filename="mon-11.wav"/> + <prompt phrase="Em ponto" filename="oclock.wav"/> + <prompt phrase="P.M." filename="p-m.wav"/> + <prompt phrase="Segundo" filename="second.wav"/> + <prompt phrase="Segundos" filename="seconds.wav"/> + <prompt phrase="Hoje" filename="today.wav"/> + <prompt phrase="Amanhã" filename="tomorrow.wav"/> + <prompt phrase="Ontem" filename="yesterday.wav"/> + </time> + <voicemail> + <prompt phrase="A pessoa na extensão..." filename="vm-person.wav"/> + <prompt phrase="marcada como urgente" filename="vm-marked-urgent.wav"/> + <prompt phrase="email enviado" filename="vm-emailed.wav"/> + <prompt phrase="Você tem..." filename="vm-you_have.wav"/> + <prompt phrase="Por favor introduza o seu número de utilizador, seguido de..." filename="vm-enter_id.wav"/> + <prompt phrase="Por favor introduza a sua palavra passe, seguida de..." filename="vm-enter_pass.wav"/> + <prompt phrase="Falha na autenticação." filename="vm-fail_auth.wav"/> + <prompt phrase="Bem-vindo ao seu correio de voz." filename="vm-hello.wav"/> + <prompt phrase="Até breve." filename="vm-goodbye.wav"/> + <prompt phrase="Após o sinal por favor diga o seu nome, pressione qualquer tecla ou deixe de falar para parar a gravação." filename="vm-record_name1.wav"/> + <prompt phrase="Seleccione uma saudação entre 1 e 9" filename="vm-choose_greeting_choose.wav"/> + <prompt phrase="Valor inválido." filename="vm-choose_greeting_fail.wav"/> + <prompt phrase="Demasiadas tentativas falhadas." filename="vm-abort.wav"/> + <prompt phrase="Para alterar a sua palavra passe..." filename="vm-change_password.wav"/> + <prompt phrase="após o sinal grave a sua saudação, pressione qualquer tecla ou deixe de falar para parar a gravação." filename="vm-record_greeting.wav"/> + <prompt phrase="após o sinal grave a sua mensagem, pressione qualquer tecla ou deixe de falar para parar a gravação." filename="vm-record_message.wav"/> + <prompt phrase="Não está disponÃvel." filename="vm-play_greeting.wav"/> + <prompt phrase="nova e urgente" filename="vm-urgent-new.wav"/> + <prompt phrase="nova" filename="vm-new.wav"/> + <prompt phrase="guardada e urgente" filename="vm-urgent-saved.wav"/> + <prompt phrase="guardada" filename="vm-saved.wav"/> + <prompt phrase="mensagem" filename="vm-message.wav"/> + <prompt phrase="mensagens" filename="vm-messages.wav"/> + <prompt phrase="marque" filename="vm-press.wav"/> + <prompt phrase="Para ouvir as mensagens novas..." filename="vm-listen_new.wav"/> + <prompt phrase="Para ouvir as mensagens guardadas..." filename="vm-listen_saved.wav"/> + <prompt phrase="Para opções avançadas..." filename="vm-advanced.wav"/> + <prompt phrase="Para sair..." filename="vm-to_exit.wav"/> + <prompt phrase="Para gravar a sua saudação..." filename="vm-record_greeting.wav"/> + <prompt phrase="Para escolher a sua saudação..." filename="vm-choose_greeting.wav"/> + <prompt phrase="Para gravar o seu nome..." filename="vm-record_name2.wav"/> + <prompt phrase="Para o menu principal..." filename="vm-main_menu.wav"/> + <prompt phrase="Para ouvir a gravação..." filename="vm-listen_to_recording.wav"/> + <prompt phrase="Para guardar a gravação..." filename="vm-save_recording.wav"/> + <prompt phrase="Para gravar novamente..." filename="vm-rerecord.wav"/> + <prompt phrase="Para marcar esta mensagem como urgente..." filename="vm-mark_urgent.wav"/> + <prompt phrase="Para continuar..." filename="vm-continue.wav"/> + <prompt phrase="Para ouvir a gravação novamente..." filename="vm-listen_to_recording_again.wav"/> + <prompt phrase="Para apagar a gravação..." filename="vm-delete_recording.wav"/> + <prompt phrase="Para encaminhar a gravação para o seu email..." filename="vm-forward_to_email.wav"/> + <prompt phrase="saudação" filename="vm-greeting.wav"/> + <prompt phrase="seleccionada" filename="vm-selected.wav"/> + <prompt phrase="Não está disponÃvel." filename="vm-not_available.wav"/> + <prompt phrase="Mensagem número..." filename="vm-message_number.wav"/> + <prompt phrase="apagada" filename="vm-deleted.wav"/> + <prompt phrase="O tamanho da sua gravação é menor que o mÃnimo aceite, por favor tente novamente." filename="vm-too-small.wav"/> + <prompt phrase="na caixa de entrada" filename="vm-in_folder.wav"/> + <prompt phrase="Para devolver a chamada agora..." filename="vm-return_call.wav"/> + <prompt phrase="urgente" filename="vm-urgent.wav"/> + <prompt phrase="Esta caixa de correio está cheia, por favor tente mais tarde." filename="vm-mailbox_full.wav"/> + <prompt phrase="Bem-Vindo ao seu voicemail. Para ouvir o tutorial e configurar o seu voicemail, pressione um. Para saltar-lo pressione dois." filename="vm-tutorial_yes_no.wav"/> + <prompt phrase="Necessita gravar o seu nome e sobrenome. Esta gravação é usada entre outros, no serviço de directório." filename="vm-tutorial_record_name.wav"/> + <prompt phrase="O número de identificação pessoal ou PIN serve para impedir o acesso de terceiros à s suas mensagens. Deseja alterar o seu PIN agora?" filename="vm-tutorial_change_pin.wav"/> + </voicemail> + <directory> + <prompt phrase="Por favor introduza as primeiras letras do nome da pessoa." filename="dir-enter-person.wav"/> + <prompt phrase="...último nome..." filename="dir-last_name.wav"/> + <prompt phrase="Para pesquisar por..." filename="dir-to_search_by.wav"/> + <prompt phrase="...primeiro nome..." filename="dir-first_name.wav"/> + <prompt phrase="Não foram encontrados resultados, tente novamente." filename="dir-no_match_entry.wav"/> + <prompt phrase="...resultados encontrados para a sua pesquisa." filename="dir-result_match.wav"/> + <prompt phrase="A sua pesquisa devolveu demasiados resultados, por favor tente novamente." filename="dir-too_many_result.wav"/> + <prompt phrase="Não há mais resultados." filename="dir-no_more_results.wav"/> + <prompt phrase="Resultado número" filename="dir-result_number.wav"/> + <prompt phrase="...na extensão..." filename="dir-at_extension.wav"/> + <prompt phrase="Para seleccionar este resultado..." filename="dir-to_select_entry.wav"/> + <prompt phrase="Para o resultado seguinte..." filename="dir-for_next.wav"/> + <prompt phrase="Para o resultado anterior..." filename="dir-for_prev.wav"/> + <prompt phrase="Para iniciar uma nova pesquisa..." filename="dir-start_new_search.wav"/> + <prompt phrase="Você necessita de especificar um mÃnimo de..." filename="dir-specify_mininum_first.wav"/> + <prompt phrase="...letras do nome da pessoa, tente novamente." filename="dir-letters_of_person_name.wav"/> + <prompt phrase="marque" filename="dir-press.wav"/> + </directory> + <conference> + <prompt phrase="NULL" filename="conf-ack.wav" type="tone"/> + <prompt phrase="NULL" filename="conf-nack.wav" type="tone"/> + <prompt phrase="Você agora está em silêncio." filename="conf-muted.wav"/> + <prompt phrase="Você já não está em silêncio." filename="conf-unmuted.wav"/> + <prompt phrase="Neste momento você é a única pessoa na conferência." filename="conf-alone.wav"/> + <prompt phrase="NULL" filename="conf-perpetual.wav" type="music"/> + <prompt phrase="NULL" filename="conf-enter.wav" type="tone"/> + <prompt phrase="NULL" filename="conf-exit.wav" type="tone"/> + <prompt phrase="Você foi excluÃdo desta conferência." filename="conf-kicked.wav"/> + <prompt phrase="Esta conferência está bloqueada." filename="conf-locked.wav"/> + <prompt phrase="A conferência está agora bloqueada." filename="conf-is-locked.wav"/> + <prompt phrase="A conferência está agora desbloqueada." filename="conf-is-unlocked.wav"/> + <prompt phrase="Por favor introduza o PIN da conferência." filename="conf-pin.wav"/> + <prompt phrase="PIN inválido, tente novamente." filename="conf-bad-pin.wav"/> + <prompt phrase="Até breve." filename="conf-goodbye.wav"/> + <prompt phrase="Bem-vindo à conferência." filename="conf-welcome.wav"/> + </conference> + <ivr> + <prompt phrase="Número da conta" filename="ivr-account_number.wav"/> + <prompt phrase="Estabelecer contacto com a pessoa que telefona" filename="ivr-connect_to_caller.wav"/> + <prompt phrase="Se conhece a extensão do destinatário, por favor marque-a agora." filename="ivr-enter_ext_pound.wav"/> + <prompt phrase="Por favor introduza uma extensão seguida de cardinal." filename="ivr-enter_ext.wav"/> + <prompt phrase="Para esta pessoa..." filename="ivr-for_this_person.wav"/> + <prompt phrase="Por favor aguarde enquanto a sua chamada é estabelecida." filename="ivr-hold_connect_call.wav"/> + <prompt phrase="Desculpe" filename="ivr-im_sorry.wav"/> + <prompt phrase="Por favor" filename="ivr-please.wav"/> + <prompt phrase="Por favor devolva a nossa chamada à s..." filename="ivr-please_return_our_call_at.wav"/> + <prompt phrase="De acordo com o número de referência" filename="ivr-regarding_reference_number.wav"/> + <prompt phrase="Este é um exemplo de um submenu IVR..." filename="ivr-sample_submenu.wav"/> + <prompt phrase="Por favor diga o seu nome depois do sinal." filename="ivr-say_name.wav"/> + <prompt phrase="Enviar esta chamada para o correio de voz." filename="ivr-send_to_voicemail.wav"/> + <prompt phrase="Para falar com um responsável do apoio a clientes..." filename="ivr-speak_to_a_customer_service_representative.wav"/> + <prompt phrase="Deixe uma mensagem" filename="ivr-take_a_message.wav"/> + <prompt phrase="Obrigado" filename="ivr-thank_you.wav"/> + <prompt phrase="Essa era uma entrada inválida." filename="ivr-that_was_an_invalid_entry.wav"/> + <prompt phrase="Esta é uma chamada de..." filename="ivr-this_is_a_call_from.wav"/> + <prompt phrase="Este IVR permite-lhe testar algumas das funções..." filename="ivr-this_ivr_will_let_you_test_features.wav"/> + <prompt phrase="Para ligar à conferência FreeSWITCH..." filename="ivr-to_call_the_freeswitch_conference.wav"/> + <prompt phrase="Para realizar um teste FreeSWITCH eco..." filename="ivr-to_do_a_freeswitch_echo_test.wav"/> + <prompt phrase="Para realizar um teste FWD eco..." filename="ivr-to_do_a_fwd_echo_test.wav"/> + <prompt phrase="Para ouvir o exemplo de um submenu IVR..." filename="ivr-to_hear_sample_submenu.wav"/> + <prompt phrase="Para ouvir gritaria de macacos..." filename="ivr-to_hear_screaming_monkeys.wav"/> + <prompt phrase="Para ouvir música em espera..." filename="ivr-to_listen_to_moh.wav"/> + <prompt phrase="Para ouvir novamente estas opções..." filename="ivr-to_repeat_these_options.wav"/> + <prompt phrase="Para voltar ao menu anterior..." filename="ivr-to_return_to_previous_menu.wav"/> + <prompt phrase="Para falar com um operador..." filename="ivr-to_speak_with_an_operator.wav"/> + <prompt phrase="Bem-vindo a FreeSWITCH, o futuro da telefonia." filename="ivr-welcome_to_freeswitch.wav"/> + <prompt phrase="Você pode sair a qualquer altura, simplesmente terminando a chamada." filename="ivr-you_may_exit_by_hanging_up.wav"/> + <prompt phrase="ou" filename ="ivr-or.wav"/> + <prompt phrase="não" filename ="ivr-not.wav"/> + <prompt phrase="chamada" filename ="ivr-call.wav"/> + <prompt phrase="Você pode" filename ="ivr-you_may.wav"/> + <prompt phrase="Olá" filename="ivr-hello.wav"/> + <prompt phrase="Usando as teclas do seu telefone..." filename="ivr-use_telephone_keypad.wav"/> + <prompt phrase="Por favor soletre o nome da pessoa que você pretente contactar." filename="ivr-spell_name.wav"/> + <prompt phrase="Ãltimo nome primeiro" filename="ivr-last_name_first.wav"/> + <prompt phrase="Primeiro nome primeiro" filename="ivr-first_name_first.wav"/> + <prompt phrase="Marque 1 para Q ou Z." filename="ivr-press_one_q_or_z.wav"/> + <prompt phrase="Vendas" filename="ivr-sales.wav"/> + <prompt phrase="Apoio a clientes" filename="ivr-customer_service.wav"/> + <prompt phrase="Suporte técnico" filename="ivr-technical_support.wav"/> + <prompt phrase="Operador" filename="ivr-operator.wav"/> + <prompt phrase="Você marcou uma extensão inválida." filename="ivr-you_have_dialed_an_invalid_extension.wav"/> + <prompt phrase="Por favor marque a sua extensão, seguida de cardinal." filename="ivr-please_enter_extension_followed_by_pound.wav"/> + <prompt phrase="Por favor marque o seu número PIN, seguido de cardinal." filename="ivr-please_enter_pin_followed_by_pound.wav"/> + <prompt phrase="O seu número PIN ou extensão é inválido." filename="ivr-pin_or_extension_is-invalid.wav"/> + <prompt phrase="Você está a ponto de associar este telefone à sua conta..." filename="ivr-you_are_about_to_provision_this_phone.wav"/> + <prompt phrase="Por favor marque novamente o seu número PIN para confirmar." filename="ivr-please_reenter_your_pin.wav"/> + <prompt phrase="Para registar em ClueCon, por favor marque..." filename="ivr-register_for_cluecon.wav"/> + <prompt phrase="Para conectar..." filename="ivr-to_log_in.wav"/> + <prompt phrase="Para desconectar..." filename="ivr-to_log_out.wav"/> + <prompt phrase="Você está agora conectado." filename="ivr-you_are_now_logged_in.wav"/> + <prompt phrase="Você está agora desconectado." filename="ivr-you_are_now_logged_out.wav"/> + <prompt phrase="Por favor tente novamente." filename="ivr-please_try_again.wav"/> + <prompt phrase="Você está a ponto de associar permanentemente este telefone à sua extensão." filename="ivr-provision_phone_permanently_to_extension.wav"/> + <prompt phrase="Por favor marque o número da extensão à qual pretende associar este telefone, seguido de cardinal." filename="ivr-extension_to_provision_this_phone.wav"/> + <prompt phrase="Obrigado, este telefone irá agora ser reiniciado." filename="ivr-this_phone_will_now_reboot.wav"/> + <prompt phrase="Obrigado. A sua gravação foi guardada." filename="ivr-recording_saved.wav"/> + <prompt phrase="Marque 1 para guardar a sua gravação. Marque 2 para ouvir a sua gravação. Marque 3 para gravar novamente." filename="ivr-save_review_record.wav"/> + <prompt phrase="Neste momento o sistema é incapaz de guardar o seu ficheiro de som. Por favor tente novamente mais tarde." filename="ivr-unable_save.wav"/> + <prompt phrase="Você é o número" filename="ivr-you_are_number.wav"/> + <prompt phrase="...em linha" filename="ivr-in_line.wav"/> + <prompt phrase="Obrigado por aguardar." filename="ivr-thank_you_for_holding.wav"/> + <prompt phrase="O seu tempo estimado de espera é..." filename="ivr-estimated_hold_time.wav"/> + <prompt phrase="Mais de..." filename="ivr-more_than.wav"/> + <prompt phrase="Menos de..." filename="ivr-less_than.wav"/> + <prompt phrase="Iniciar gravação." filename="ivr-begin_recording.wav "/> + <prompt phrase="O encaminhamento da chamada foi cancelado." filename="ivr-call_forwarding_has_been_cancelled.wav"/> + <prompt phrase="O encaminhamento da chamada foi activado." filename="ivr-call_forwarding_has_been_set.wav"/> + <prompt phrase="Por favor, introduza o número de telefone." filename="ivr-please_enter_the_phone_number.wav"/> + <prompt phrase="Por favor, deixe o seu nome e o motivo da sua chamada." filename="ivr-please_state_your_name_and_reason_for_calling.wav"/> + <prompt phrase="Para aceitar, marque 1. Para rejeitar, marque 2. Para enviar para o correio de voz, marque 3." filename="ivr-accept_reject_voicemail.wav"/> + <prompt phrase="Entrada de chamada." filename="ivr-incoming_call.wav"/> + <prompt phrase="Obrigado pela sua chamada." filename="ivr-thank_you_for_calling.wav"/> + <prompt phrase="Por favor permaneça em linha. A sua chamada será atendida brevemente." filename="ivr-stay_on_line_call_answered_momentarily.wav"/> + <prompt phrase="A sua chamada está a ser transferida." filename="ivr-call_being_transferred.wav"/> + <prompt phrase="Por favor, desfrute da música enquanto a sua chamada é transferida." filename="ivr-enjoy_music_while_transfer.wav"/> + <prompt phrase="Você tem uma chamada de..." filename="ivr-call_from.wav"/> + <prompt phrase="Este menú não tem opções. Por favor entre em contacto com o administrador." filename="ivr-no_menu_items.wav"/> + <prompt phrase="Para directório, marque..." filename="ivr-for_directory_press.wav"/> + <prompt phrase="Usando o teclado do seu telefone..." filename="ivr-using_telephone_keypad.wav"/> + <prompt phrase="Introduza as primeiras letras do último nome da pessoa." filename="ivr-enter_letters_last_name.wav"/> + <prompt phrase="Introduza as primeiras letras do primeiro nome da pessoa." filename="ivr-enter_letters_first_name.wav"/> + <prompt phrase="Introduza as primeiras letras do primeiro ou último nome da pessoa." filename="ivr-enter_letters_first_or_last_name.wav"/> + <prompt phrase="Se isto é correcto, marque..." filename="ivr-if_correct_press.wav"/> + <prompt phrase="Se não, marque..." filename="ivr-if_not_press.wav"/> + <prompt phrase="Quando terminar, marque cardinal." filename="ivr-finished_pound_hash_key.wav"/> + <prompt phrase="O modo Não Incomodar está agora activado." filename="ivr-dnd_activated.wav"/> + <prompt phrase="O modo Não Incomodar foi desactivado." filename="ivr-dnd_cancelled.wav"/> + <prompt phrase="Marque qualquer outro dÃgito..." filename="ivr-any_other_digit.wav"/> + <prompt phrase="Marque um para sim. Marque dois para não." filename="ivr-one_yes_two_no.wav"/> + <prompt phrase="Por favor marque o número da fila, seguido de cardinal." filename="ivr-enter_queue_number.wav"/> + <prompt phrase="Por favor marque o..." filename="ivr-please_enter_the.wav"/> + <prompt phrase="Número." filename="ivr-number.wav"/> + <prompt phrase="...seguido de cardinal." filename="ivr-followed_by_pound.wav"/> + <prompt phrase="O saldo da conta é..." filename="ivr-account_balance_is.wav"/> + <prompt phrase="Obrigado por telefonar. Se conhece a extensão do destinatário, por favor marque-a agora. Para ir para o directório, marque..." filename="ivr-generic_greeting.wav"/> + <prompt phrase="...ficheiro..." filename="ivr-file.wav"/> + <prompt phrase="...ficheiros..." filename="ivr-files-.wav"/> + <prompt phrase="Para uma chamada de despertar..." filename="ivr-for_a_wakeup_call.wav"/> + <prompt phrase="Esta é a sua chamada de despertar." filename="ivr-this_is_your_wakeup_call.wav"/> + <prompt phrase="Para solicitar uma chamada de despertar..." filename="ivr-request_wakeup_call.wav"/> + <prompt phrase="Para confirmar uma chamada de despertar..." filename="ivr-confirm_wakeup_call.wav"/> + <prompt phrase="Para cancelar uma chamada de despertar..." filename="ivr-cancel_wakeup_call.wav"/> + <prompt phrase="Você solicitou uma chamada de despertar..." filename="ivr-requested_wakeup_call_for.wav"/> + <prompt phrase="Você não solicitou uma chamada de despertar." filename="ivr-not_requested_wakeup_call.wav"/> + <prompt phrase="A sua chamada de despertar foi cancelada." filename="ivr-wakeup_call_cancelled.wav"/> + <prompt phrase="Para uma chamada de despertar por dia..." filename="ivr-for_daily_wakeup_call.wav"/> + <prompt phrase="Chamada de despertar diária..." filename="ivr-daily_wakeup_call.wav"/> + <prompt phrase="Para chamadas de despertar diárias..." filename="ivr-for_daily_wakeup_calls.wav"/> + <prompt phrase="Para apenas uma chamada de despertar..." filename="ivr-for_one_time_wakeup_call.wav"/> + <prompt phrase="Apenas uma chamada de despertar..." filename="ivr-one_time_wakeup_call.wav"/> + <prompt phrase="...chamada de despertar..." filename="ivr-wakeup_call.wav"/> + <prompt phrase="Acorda! Acorda raio de sol!!" filename="ivr-wakey_wakey_sunshine.wav"/> + <prompt phrase="Bem-vindo." filename="ivr-welcome.wav"/> + <prompt phrase="Bem-vindo a..." filename="ivr-welcome_to.wav"/> + <prompt phrase="Bom dia." filename="ivr-good_morning.wav"/> + <prompt phrase="Boa tarde." filename="ivr-good_afternoon.wav"/> + <prompt phrase="Boa noite." filename="ivr-good_evening.wav"/> + <prompt phrase="Obrigado." filename="ivr-Thank_you.wav"/> + <prompt phrase="Para..." filename="ivr-for.wav"/> + <prompt phrase="Estamos a observar tempos de espera superiores ao normal." filename="ivr-longer_than_usual_hold_times.wav"/> + <prompt phrase="Você é o..." filename="ivr-you_are_the.wav"/> + <prompt phrase="Um momento por favor." filename="ivr-one_moment_please.wav"/> + <prompt phrase="A sua chamada será atendida pela ordem que foi recebida." filename="ivr-call_answered_order_received.wav"/> + <prompt phrase="Por favor marque o número da conferência, seguido de cardinal" filename="conf-enter_conf_number.wav"/> + <prompt phrase="Introduza o número PIN da conferência, seguido de cardinal." filename="conf-enter_conf_pin.wav"/> + <prompt phrase="...entrou na conferência." filename="conf-has_joined.wav"/> + <prompt phrase="...abandonou a conferência." filename="conf-has_left.wav"/> + <prompt phrase="Você entrou..." filename="ivr-you_entered.wav"/> + <prompt phrase="Número da extensão..." filename="ivr-extension_number.wav"/> + <prompt phrase="Por favor aguarde enquanto contactamos com o destinatário." filename="ivr-please_hold_while_party_contacted.wav"/> + <prompt phrase="Por favor desfrute da música enquanto contactamos com o destinatário." filename="ivr-please_enjoy_music_while_party_reached.wav"/> + <prompt phrase="Obrigado por telefonar. Se conhece a extensão do destinatário, marque-a agora, ou marque nove para ir para o directório." filename="ivr-generic_greeting.wav"/> + <prompt phrase="Se isto é correcto, marque 1. Se não é correcto, marque 2." filename="ivr-if_correct_one_if_not_two.wav"/> + <prompt phrase="Para ouvir novamente esta informação.." filename="ivr-repeat_this_information.wav"/> + <prompt phrase="Não não não!" filename="ivr-no_no_no.wav"/> + <prompt phrase="Você pretendia marcar esta tecla?" filename="ivr-did_you_mean_to_press_key.wav"/> + <prompt phrase="A sério? Pretendia MESMO marcar esta tecla?" filename="ivr-seriously_mean_to_press_key.wav"/> + <prompt phrase="Oh, tanto faz." filename="ivr-oh_whatever.wav"/> + <prompt phrase="Já chega! Um erro mais e desligo a chamada." filename="ivr-one_more_mistake.wav"/> + <prompt phrase="Felicidades, você pressionou estrela. Isto não significa que você é uma estrela. Apenas significa que pode pressionar teclas e que provavelmente tem dedos." filename="ivr-congratulations_you_pressed_star.wav"/> + <prompt phrase="Todos os nossos engenheiros estão ocupados demonstrando como é impressionante CudaTel." filename="ivr-engineers_busy_assisting_other_sales.wav"/> + <prompt phrase="O destino que deseja contactar não está disponÃvel e não tem correio de voz." filename="vm-not_available_no_voicemail.wav"/> + <prompt phrase="Esta mensagem vai autodestruir-se em 5, 4, 3, 2, 1..." filename="ivr-message_self_destruct.wav"/> + <prompt phrase="Você já está em silêncio." filename="conf-you_are_already_muted.wav"/> + <prompt phrase="Você está agora em silêncio em ambos sentidos." filename="conf-you_are_now_bidirectionally_muted.wav"/> + <prompt phrase="Todas as suas chamadas pertencem-nos." filename="ivr-all_your_call_are_belong_to_us.wav"/> + <prompt phrase="Adoro a forma como você pressiona as teclas!" filename="ivr-love_those_touch_tones.wav"/> + <prompt phrase="Sim, nós não temos bananas." filename="ivr-yes_we_have_no_bananas.wav"/> + <prompt phrase="Homem, você está a ser ridÃculo!" filename="ivr-dude_you_suck.wav"/> + <prompt phrase="A sua chamada é muito importante para nós, mas a sua saúde mental não, então estamos felizes por mantê-lo em espera, torturando-o com a irritante música em espera." filename="ivr-on_hold_indefinitely.wav"/> + <prompt phrase="...deixou o edifÃcio." filename="ivr-has_left_the_building.wav"/> + <prompt phrase="Este telefone não está associado e não pode realizar chamadas externas." filename="ivr-phone_is_unassigned.wav"/> + <prompt phrase="Este telefone não está configurado correctamente." filename="ivr-phone_not_configured.wav"/> + <prompt phrase="Parabéns! Este telefone está configurado correctamente e pode agora ser associado a um utilizador." filename="ivr-phone_is_configured_properly.wav"/> + <prompt phrase="Por favor contacte o administrador do sistema para assistência." filename="ivr-contact_system_administrator.wav"/> + <prompt phrase="Barracuda Networks" filename="ivr-barracuda_networks.wav"/> + <prompt phrase="CudaTel Communication Server" filename="ivr-cudatel_communication_server.wav"/> + <prompt phrase="Por favor, introduza as primeiras letras do primeiro ou último nome da pessoa" filename="dir-enter_person_first_or_last.wav"/> + <prompt phrase="Não há mais chamadas á espera nesta fila." filename="ivr-no_calls_waiting_in_queue.wav"/> + <prompt phrase="Brian West" filename="misc-Brian_West.wav"/> + <prompt phrase="Anthony Minessale" filename="misc-Anthony_Minessale.wav"/> + <prompt phrase="Michael Jerris" filename="misc-Michael_Jerris.wav"/> + <prompt phrase="Raymond Chandler" filename="misc-Raymond_Chandler.wav"/> + <prompt phrase="Michael Collins" filename="misc-Michael_Collins.wav"/> + <prompt phrase="Mark Mann" filename="misc-Mark_Mann.wav"/> + <prompt phrase="William King" filename="misc-William_King.wav"/> + <prompt phrase="Rudy Fleminger" filename="misc-Rudy_Fleminger.wav"/> + <prompt phrase="Andrew Thompson" filename="misc-Andrew_Thompson.wav"/> + <prompt phrase="Graham Saathoff" filename="misc-Graham_Saathoff.wav"/> + <prompt phrase="Nicholaus Belluni" filename="misc-Nicholaus_Belluni.wav"/> + <prompt phrase="Sean Heiney" filename="misc-Sean_Heiney.wav"/> + </ivr> + <misc> + <prompt phrase="Foi activada a segurança para esta chamada." filename="call_secured.wav"/> + <prompt phrase="...seguido de cardinal." filename="followed.wav"/> + <prompt phrase="Se você é esta pessoa..." filename="if_you_are_this_person.wav"/> + <prompt phrase="Se você deseja..." filename="if_you_would_like_to.wav"/> + <prompt phrase="Forneça o número de referência" filename="provide_reference_number.wav"/> + <prompt phrase="Por favor, introduza a extensão para a qual pretende transferir." filename="transfer1.wav"/> + <prompt phrase="Transferir" filename="transfer2.wav"/> + <prompt phrase="Estamos a tentar contactar..." filename="we_are_trying_to_reach.wav"/> + <prompt phrase="Ocorreu um erro, por favor entre em contacto com o administrador." filename="error.wav"/> + <prompt phrase="A sua chamada irá terminar em..." filename="misc-your_call_will_be_terminated_in.wav"/> + <prompt phrase="A sua chamada foi concluÃda." filename="misc-your_call_has_been_terminated.wav"/> + </misc> + <zrtp> + <!-- base256 prompts for SAS --> + <prompt phrase="Algol" filename="Algol.wav"/> + <prompt phrase="Apollo" filename="Apollo.wav"/> + <prompt phrase="Athens" filename="Athens.wav"/> + <prompt phrase="Atlantic" filename="Atlantic.wav"/> + <prompt phrase="Aztec" filename="Aztec.wav"/> + <prompt phrase="Babylon" filename="Babylon.wav"/> + <prompt phrase="Belfast" filename="Belfast.wav"/> + <prompt phrase="Bradbury" filename="Bradbury.wav"/> + <prompt phrase="Brazilian" filename="Brazilian.wav"/> + <prompt phrase="Burbank" filename="Burbank.wav"/> + <prompt phrase="Burlington" filename="Burlington.wav"/> + <prompt phrase="Camelot" filename="Camelot.wav"/> + <prompt phrase="Capricorn" filename="Capricorn.wav"/> + <prompt phrase="Cherokee" filename="Cherokee.wav"/> + <prompt phrase="Chicago" filename="Chicago.wav"/> + <prompt phrase="Christmas" filename="Christmas.wav"/> + <prompt phrase="Dakota" filename="Dakota.wav"/> + <prompt phrase="December" filename="December.wav"/> + <prompt phrase="Dupont" filename="Dupont.wav"/> + <prompt phrase="Eskimo" filename="Eskimo.wav"/> + <prompt phrase="Galveston" filename="Galveston.wav"/> + <prompt phrase="Geiger" filename="Geiger.wav"/> + <prompt phrase="Hamilton" filename="Hamilton.wav"/> + <prompt phrase="Istanbul" filename="Istanbul.wav"/> + <prompt phrase="Jamaica" filename="Jamaica.wav"/> + <prompt phrase="Jupiter" filename="Jupiter.wav"/> + <prompt phrase="Medusa" filename="Medusa.wav"/> + <prompt phrase="Mohawk" filename="Mohawk.wav"/> + <prompt phrase="Montana" filename="Montana.wav"/> + <prompt phrase="Neptune" filename="Neptune.wav"/> + <prompt phrase="Norwegian" filename="Norwegian.wav"/> + <prompt phrase="Oakland" filename="Oakland.wav"/> + <prompt phrase="October" filename="October.wav"/> + <prompt phrase="Ohio" filename="Ohio.wav"/> + <prompt phrase="Orlando" filename="Orlando.wav"/> + <prompt phrase="Pacific" filename="Pacific.wav"/> + <prompt phrase="Pandora" filename="Pandora.wav"/> + <prompt phrase="Pegasus" filename="Pegasus.wav"/> + <prompt phrase="Pluto" filename="Pluto.wav"/> + <prompt phrase="Saturday" filename="Saturday.wav"/> + <prompt phrase="Scotland" filename="Scotland.wav"/> + <prompt phrase="Trojan" filename="Trojan.wav"/> + <prompt phrase="Virginia" filename="Virginia.wav"/> + <prompt phrase="Vulcan" filename="Vulcan.wav"/> + <prompt phrase="Waterloo" filename="Waterloo.wav"/> + <prompt phrase="Wichita" filename="Wichita.wav"/> + <prompt phrase="Wilmington" filename="Wilmington.wav"/> + <prompt phrase="Wyoming" filename="Wyoming.wav"/> + <prompt phrase="Yucatan" filename="Yucatan.wav"/> + <prompt phrase="Zulu" filename="Zulu.wav"/> + <prompt phrase="aardvark" filename="aardvark.wav"/> + <prompt phrase="absurd" filename="absurd.wav"/> + <prompt phrase="accrue" filename="accrue.wav"/> + <prompt phrase="acme" filename="acme.wav"/> + <prompt phrase="adrift" filename="adrift.wav"/> + <prompt phrase="adroitness" filename="adroitness.wav"/> + <prompt phrase="adult" filename="adult.wav"/> + <prompt phrase="adviser" filename="adviser.wav"/> + <prompt phrase="afflict" filename="afflict.wav"/> + <prompt phrase="aftermath" filename="aftermath.wav"/> + <prompt phrase="aggregate" filename="aggregate.wav"/> + <prompt phrase="ahead" filename="ahead.wav"/> + <prompt phrase="aimless" filename="aimless.wav"/> + <prompt phrase="alkali" filename="alkali.wav"/> + <prompt phrase="allow" filename="allow.wav"/> + <prompt phrase="almighty" filename="almighty.wav"/> + <prompt phrase="alone" filename="alone.wav"/> + <prompt phrase="ammo" filename="ammo.wav"/> + <prompt phrase="amulet" filename="amulet.wav"/> + <prompt phrase="amusement" filename="amusement.wav"/> + <prompt phrase="ancient" filename="ancient.wav"/> + <prompt phrase="antenna" filename="antenna.wav"/> + <prompt phrase="apple" filename="apple.wav"/> + <prompt phrase="applicant" filename="applicant.wav"/> + <prompt phrase="armistice" filename="armistice.wav"/> + <prompt phrase="article" filename="article.wav"/> + <prompt phrase="artist" filename="artist.wav"/> + <prompt phrase="assume" filename="assume.wav"/> + <prompt phrase="asteroid" filename="asteroid.wav"/> + <prompt phrase="atlas" filename="atlas.wav"/> + <prompt phrase="atmosphere" filename="atmosphere.wav"/> + <prompt phrase="autopsy" filename="autopsy.wav"/> + <prompt phrase="baboon" filename="baboon.wav"/> + <prompt phrase="backfield" filename="backfield.wav"/> + <prompt phrase="backward" filename="backward.wav"/> + <prompt phrase="backwater" filename="backwater.wav"/> + <prompt phrase="banjo" filename="banjo.wav"/> + <prompt phrase="barbecue" filename="barbecue.wav"/> + <prompt phrase="beaming" filename="beaming.wav"/> + <prompt phrase="bedlamp" filename="bedlamp.wav"/> + <prompt phrase="beehive" filename="beehive.wav"/> + <prompt phrase="beeswax" filename="beeswax.wav"/> + <prompt phrase="befriend" filename="befriend.wav"/> + <prompt phrase="belowground" filename="belowground.wav"/> + <prompt phrase="berserk" filename="berserk.wav"/> + <prompt phrase="bifocals" filename="bifocals.wav"/> + <prompt phrase="billiard" filename="billiard.wav"/> + <prompt phrase="bison" filename="bison.wav"/> + <prompt phrase="blackjack" filename="blackjack.wav"/> + <prompt phrase="blockade" filename="blockade.wav"/> + <prompt phrase="blowtorch" filename="blowtorch.wav"/> + <prompt phrase="bluebird" filename="bluebird.wav"/> + <prompt phrase="bodyguard" filename="bodyguard.wav"/> + <prompt phrase="bombast" filename="bombast.wav"/> + <prompt phrase="bookseller" filename="bookseller.wav"/> + <prompt phrase="bookshelf" filename="bookshelf.wav"/> + <prompt phrase="borderline" filename="borderline.wav"/> + <prompt phrase="bottomless" filename="bottomless.wav"/> + <prompt phrase="brackish" filename="brackish.wav"/> + <prompt phrase="bravado" filename="bravado.wav"/> + <prompt phrase="breadline" filename="breadline.wav"/> + <prompt phrase="breakaway" filename="breakaway.wav"/> + <prompt phrase="breakup" filename="breakup.wav"/> + <prompt phrase="brickyard" filename="brickyard.wav"/> + <prompt phrase="briefcase" filename="briefcase.wav"/> + <prompt phrase="businessman" filename="businessman.wav"/> + <prompt phrase="butterfat" filename="butterfat.wav"/> + <prompt phrase="button" filename="button.wav"/> + <prompt phrase="buzzard" filename="buzzard.wav"/> + <prompt phrase="candidate" filename="candidate.wav"/> + <prompt phrase="cannonball" filename="cannonball.wav"/> + <prompt phrase="caravan" filename="caravan.wav"/> + <prompt phrase="caretaker" filename="caretaker.wav"/> + <prompt phrase="celebrate" filename="celebrate.wav"/> + <prompt phrase="cellulose" filename="cellulose.wav"/> + <prompt phrase="cement" filename="cement.wav"/> + <prompt phrase="certify" filename="certify.wav"/> + <prompt phrase="chairlift" filename="chairlift.wav"/> + <prompt phrase="chambermaid" filename="chambermaid.wav"/> + <prompt phrase="chatter" filename="chatter.wav"/> + <prompt phrase="checkup" filename="checkup.wav"/> + <prompt phrase="chisel" filename="chisel.wav"/> + <prompt phrase="choking" filename="choking.wav"/> + <prompt phrase="chopper" filename="chopper.wav"/> + <prompt phrase="clamshell" filename="clamshell.wav"/> + <prompt phrase="classic" filename="classic.wav"/> + <prompt phrase="classroom" filename="classroom.wav"/> + <prompt phrase="cleanup" filename="cleanup.wav"/> + <prompt phrase="clergyman" filename="clergyman.wav"/> + <prompt phrase="clockwork" filename="clockwork.wav"/> + <prompt phrase="cobra" filename="cobra.wav"/> + <prompt phrase="coherence" filename="coherence.wav"/> + <prompt phrase="combustion" filename="combustion.wav"/> + <prompt phrase="commando" filename="commando.wav"/> + <prompt phrase="commence" filename="commence.wav"/> + <prompt phrase="company" filename="company.wav"/> + <prompt phrase="component" filename="component.wav"/> + <prompt phrase="concert" filename="concert.wav"/> + <prompt phrase="concurrent" filename="concurrent.wav"/> + <prompt phrase="confidence" filename="confidence.wav"/> + <prompt phrase="conformist" filename="conformist.wav"/> + <prompt phrase="congregate" filename="congregate.wav"/> + <prompt phrase="consensus" filename="consensus.wav"/> + <prompt phrase="consulting" filename="consulting.wav"/> + <prompt phrase="corporate" filename="corporate.wav"/> + <prompt phrase="corrosion" filename="corrosion.wav"/> + <prompt phrase="councilman" filename="councilman.wav"/> + <prompt phrase="cowbell" filename="cowbell.wav"/> + <prompt phrase="crackdown" filename="crackdown.wav"/> + <prompt phrase="cranky" filename="cranky.wav"/> + <prompt phrase="crossover" filename="crossover.wav"/> + <prompt phrase="crowfoot" filename="crowfoot.wav"/> + <prompt phrase="crucial" filename="crucial.wav"/> + <prompt phrase="crucifix" filename="crucifix.wav"/> + <prompt phrase="crumpled" filename="crumpled.wav"/> + <prompt phrase="crusade" filename="crusade.wav"/> + <prompt phrase="cubic" filename="cubic.wav"/> + <prompt phrase="cumbersome" filename="cumbersome.wav"/> + <prompt phrase="customer" filename="customer.wav"/> + <prompt phrase="dashboard" filename="dashboard.wav"/> + <prompt phrase="deadbolt" filename="deadbolt.wav"/> + <prompt phrase="decadence" filename="decadence.wav"/> + <prompt phrase="decimal" filename="decimal.wav"/> + <prompt phrase="deckhand" filename="deckhand.wav"/> + <prompt phrase="designing" filename="designing.wav"/> + <prompt phrase="detector" filename="detector.wav"/> + <prompt phrase="detergent" filename="detergent.wav"/> + <prompt phrase="determine" filename="determine.wav"/> + <prompt phrase="dictator" filename="dictator.wav"/> + <prompt phrase="dinosaur" filename="dinosaur.wav"/> + <prompt phrase="direction" filename="direction.wav"/> + <prompt phrase="disable" filename="disable.wav"/> + <prompt phrase="disbelief" filename="disbelief.wav"/> + <prompt phrase="disruptive" filename="disruptive.wav"/> + <prompt phrase="distortion" filename="distortion.wav"/> + <prompt phrase="document" filename="document.wav"/> + <prompt phrase="dogsled" filename="dogsled.wav"/> + <prompt phrase="dragnet" filename="dragnet.wav"/> + <prompt phrase="drainage" filename="drainage.wav"/> + <prompt phrase="dreadful" filename="dreadful.wav"/> + <prompt phrase="drifter" filename="drifter.wav"/> + <prompt phrase="dropper" filename="dropper.wav"/> + <prompt phrase="drumbeat" filename="drumbeat.wav"/> + <prompt phrase="drunken" filename="drunken.wav"/> + <prompt phrase="dwelling" filename="dwelling.wav"/> + <prompt phrase="eating" filename="eating.wav"/> + <prompt phrase="edict" filename="edict.wav"/> + <prompt phrase="egghead" filename="egghead.wav"/> + <prompt phrase="eightball" filename="eightball.wav"/> + <prompt phrase="embezzle" filename="embezzle.wav"/> + <prompt phrase="enchanting" filename="enchanting.wav"/> + <prompt phrase="endorse" filename="endorse.wav"/> + <prompt phrase="endow" filename="endow.wav"/> + <prompt phrase="enlist" filename="enlist.wav"/> + <prompt phrase="enrollment" filename="enrollment.wav"/> + <prompt phrase="enterprise" filename="enterprise.wav"/> + <prompt phrase="equation" filename="equation.wav"/> + <prompt phrase="equipment" filename="equipment.wav"/> + <prompt phrase="erase" filename="erase.wav"/> + <prompt phrase="escapade" filename="escapade.wav"/> + <prompt phrase="escape" filename="escape.wav"/> + <prompt phrase="everyday" filename="everyday.wav"/> + <prompt phrase="examine" filename="examine.wav"/> + <prompt phrase="exceed" filename="exceed.wav"/> + <prompt phrase="existence" filename="existence.wav"/> + <prompt phrase="exodus" filename="exodus.wav"/> + <prompt phrase="eyeglass" filename="eyeglass.wav"/> + <prompt phrase="eyetooth" filename="eyetooth.wav"/> + <prompt phrase="facial" filename="facial.wav"/> + <prompt phrase="fallout" filename="fallout.wav"/> + <prompt phrase="fascinate" filename="fascinate.wav"/> + <prompt phrase="filament" filename="filament.wav"/> + <prompt phrase="finicky" filename="finicky.wav"/> + <prompt phrase="flagpole" filename="flagpole.wav"/> + <prompt phrase="flatfoot" filename="flatfoot.wav"/> + <prompt phrase="flytrap" filename="flytrap.wav"/> + <prompt phrase="forever" filename="forever.wav"/> + <prompt phrase="fortitude" filename="fortitude.wav"/> + <prompt phrase="fracture" filename="fracture.wav"/> + <prompt phrase="framework" filename="framework.wav"/> + <prompt phrase="freedom" filename="freedom.wav"/> + <prompt phrase="frequency" filename="frequency.wav"/> + <prompt phrase="frighten" filename="frighten.wav"/> + <prompt phrase="gadgetry" filename="gadgetry.wav"/> + <prompt phrase="gazelle" filename="gazelle.wav"/> + <prompt phrase="getaway" filename="getaway.wav"/> + <prompt phrase="glitter" filename="glitter.wav"/> + <prompt phrase="glossary" filename="glossary.wav"/> + <prompt phrase="glucose" filename="glucose.wav"/> + <prompt phrase="goggles" filename="goggles.wav"/> + <prompt phrase="goldfish" filename="goldfish.wav"/> + <prompt phrase="gossamer" filename="gossamer.wav"/> + <prompt phrase="graduate" filename="graduate.wav"/> + <prompt phrase="gravity" filename="gravity.wav"/> + <prompt phrase="gremlin" filename="gremlin.wav"/> + <prompt phrase="guidance" filename="guidance.wav"/> + <prompt phrase="guitarist" filename="guitarist.wav"/> + <prompt phrase="hamburger" filename="hamburger.wav"/> + <prompt phrase="hamlet" filename="hamlet.wav"/> + <prompt phrase="handiwork" filename="handiwork.wav"/> + <prompt phrase="hazardous" filename="hazardous.wav"/> + <prompt phrase="headwaters" filename="headwaters.wav"/> + <prompt phrase="hemisphere" filename="hemisphere.wav"/> + <prompt phrase="hesitate" filename="hesitate.wav"/> + <prompt phrase="hideaway" filename="hideaway.wav"/> + <prompt phrase="highchair" filename="highchair.wav"/> + <prompt phrase="hockey" filename="hockey.wav"/> + <prompt phrase="holiness" filename="holiness.wav"/> + <prompt phrase="hurricane" filename="hurricane.wav"/> + <prompt phrase="hydraulic" filename="hydraulic.wav"/> + <prompt phrase="impartial" filename="impartial.wav"/> + <prompt phrase="impetus" filename="impetus.wav"/> + <prompt phrase="inception" filename="inception.wav"/> + <prompt phrase="indigo" filename="indigo.wav"/> + <prompt phrase="indoors" filename="indoors.wav"/> + <prompt phrase="indulge" filename="indulge.wav"/> + <prompt phrase="inertia" filename="inertia.wav"/> + <prompt phrase="infancy" filename="infancy.wav"/> + <prompt phrase="inferno" filename="inferno.wav"/> + <prompt phrase="informant" filename="informant.wav"/> + <prompt phrase="insincere" filename="insincere.wav"/> + <prompt phrase="insurgent" filename="insurgent.wav"/> + <prompt phrase="integrate" filename="integrate.wav"/> + <prompt phrase="intention" filename="intention.wav"/> + <prompt phrase="inventive" filename="inventive.wav"/> + <prompt phrase="inverse" filename="inverse.wav"/> + <prompt phrase="involve" filename="involve.wav"/> + <prompt phrase="island" filename="island.wav"/> + <prompt phrase="jawbone" filename="jawbone.wav"/> + <prompt phrase="keyboard" filename="keyboard.wav"/> + <prompt phrase="kickoff" filename="kickoff.wav"/> + <prompt phrase="kiwi" filename="kiwi.wav"/> + <prompt phrase="klaxon" filename="klaxon.wav"/> + <prompt phrase="leprosy" filename="leprosy.wav"/> + <prompt phrase="letterhead" filename="letterhead.wav"/> + <prompt phrase="liberty" filename="liberty.wav"/> + <prompt phrase="locale" filename="locale.wav"/> + <prompt phrase="lockup" filename="lockup.wav"/> + <prompt phrase="maritime" filename="maritime.wav"/> + <prompt phrase="matchmaker" filename="matchmaker.wav"/> + <prompt phrase="maverick" filename="maverick.wav"/> + <prompt phrase="megaton" filename="megaton.wav"/> + <prompt phrase="merit" filename="merit.wav"/> + <prompt phrase="microscope" filename="microscope.wav"/> + <prompt phrase="microwave" filename="microwave.wav"/> + <prompt phrase="midsummer" filename="midsummer.wav"/> + <prompt phrase="millionaire" filename="millionaire.wav"/> + <prompt phrase="minnow" filename="minnow.wav"/> + <prompt phrase="miracle" filename="miracle.wav"/> + <prompt phrase="miser" filename="miser.wav"/> + <prompt phrase="misnomer" filename="misnomer.wav"/> + <prompt phrase="molasses" filename="molasses.wav"/> + <prompt phrase="molecule" filename="molecule.wav"/> + <prompt phrase="monument" filename="monument.wav"/> + <prompt phrase="mosquito" filename="mosquito.wav"/> + <prompt phrase="mural" filename="mural.wav"/> + <prompt phrase="music" filename="music.wav"/> + <prompt phrase="narrative" filename="narrative.wav"/> + <prompt phrase="nebula" filename="nebula.wav"/> + <prompt phrase="necklace" filename="necklace.wav"/> + <prompt phrase="newborn" filename="newborn.wav"/> + <prompt phrase="newsletter" filename="newsletter.wav"/> + <prompt phrase="nightbird" filename="nightbird.wav"/> + <prompt phrase="obtuse" filename="obtuse.wav"/> + <prompt phrase="offload" filename="offload.wav"/> + <prompt phrase="onlooker" filename="onlooker.wav"/> + <prompt phrase="optic" filename="optic.wav"/> + <prompt phrase="opulent" filename="opulent.wav"/> + <prompt phrase="orca" filename="orca.wav"/> + <prompt phrase="outfielder" filename="outfielder.wav"/> + <prompt phrase="pandemic" filename="pandemic.wav"/> + <prompt phrase="paperweight" filename="paperweight.wav"/> + <prompt phrase="paragon" filename="paragon.wav"/> + <prompt phrase="paragraph" filename="paragraph.wav"/> + <prompt phrase="paramount" filename="paramount.wav"/> + <prompt phrase="passenger" filename="passenger.wav"/> + <prompt phrase="payday" filename="payday.wav"/> + <prompt phrase="peachy" filename="peachy.wav"/> + <prompt phrase="pedigree" filename="pedigree.wav"/> + <prompt phrase="penetrate" filename="penetrate.wav"/> + <prompt phrase="perceptive" filename="perceptive.wav"/> + <prompt phrase="performance" filename="performance.wav"/> + <prompt phrase="pharmacy" filename="pharmacy.wav"/> + <prompt phrase="pheasant" filename="pheasant.wav"/> + <prompt phrase="phonetic" filename="phonetic.wav"/> + <prompt phrase="photograph" filename="photograph.wav"/> + <prompt phrase="physique" filename="physique.wav"/> + <prompt phrase="pioneer" filename="pioneer.wav"/> + <prompt phrase="playhouse" filename="playhouse.wav"/> + <prompt phrase="pocketful" filename="pocketful.wav"/> + <prompt phrase="politeness" filename="politeness.wav"/> + <prompt phrase="positive" filename="positive.wav"/> + <prompt phrase="potato" filename="potato.wav"/> + <prompt phrase="preclude" filename="preclude.wav"/> + <prompt phrase="prefer" filename="prefer.wav"/> + <prompt phrase="preshrunk" filename="preshrunk.wav"/> + <prompt phrase="printer" filename="printer.wav"/> + <prompt phrase="processor" filename="processor.wav"/> + <prompt phrase="provincial" filename="provincial.wav"/> + <prompt phrase="prowler" filename="prowler.wav"/> + <prompt phrase="proximate" filename="proximate.wav"/> + <prompt phrase="puberty" filename="puberty.wav"/> + <prompt phrase="publisher" filename="publisher.wav"/> + <prompt phrase="pupil" filename="pupil.wav"/> + <prompt phrase="puppy" filename="puppy.wav"/> + <prompt phrase="pyramid" filename="pyramid.wav"/> + <prompt phrase="python" filename="python.wav"/> + <prompt phrase="quadrant" filename="quadrant.wav"/> + <prompt phrase="quantity" filename="quantity.wav"/> + <prompt phrase="quiver" filename="quiver.wav"/> + <prompt phrase="quota" filename="quota.wav"/> + <prompt phrase="racketeer" filename="racketeer.wav"/> + <prompt phrase="ragtime" filename="ragtime.wav"/> + <prompt phrase="ratchet" filename="ratchet.wav"/> + <prompt phrase="rebellion" filename="rebellion.wav"/> + <prompt phrase="rebirth" filename="rebirth.wav"/> + <prompt phrase="recipe" filename="recipe.wav"/> + <prompt phrase="recover" filename="recover.wav"/> + <prompt phrase="reform" filename="reform.wav"/> + <prompt phrase="regain" filename="regain.wav"/> + <prompt phrase="reindeer" filename="reindeer.wav"/> + <prompt phrase="rematch" filename="rematch.wav"/> + <prompt phrase="repay" filename="repay.wav"/> + <prompt phrase="repellent" filename="repellent.wav"/> + <prompt phrase="replica" filename="replica.wav"/> + <prompt phrase="reproduce" filename="reproduce.wav"/> + <prompt phrase="resistor" filename="resistor.wav"/> + <prompt phrase="responsive" filename="responsive.wav"/> + <prompt phrase="retouch" filename="retouch.wav"/> + <prompt phrase="retraction" filename="retraction.wav"/> + <prompt phrase="retrieval" filename="retrieval.wav"/> + <prompt phrase="retrospect" filename="retrospect.wav"/> + <prompt phrase="revenge" filename="revenge.wav"/> + <prompt phrase="revenue" filename="revenue.wav"/> + <prompt phrase="revival" filename="revival.wav"/> + <prompt phrase="revolver" filename="revolver.wav"/> + <prompt phrase="reward" filename="reward.wav"/> + <prompt phrase="rhythm" filename="rhythm.wav"/> + <prompt phrase="ribcage" filename="ribcage.wav"/> + <prompt phrase="ringbolt" filename="ringbolt.wav"/> + <prompt phrase="robust" filename="robust.wav"/> + <prompt phrase="rocker" filename="rocker.wav"/> + <prompt phrase="ruffled" filename="ruffled.wav"/> + <prompt phrase="sailboat" filename="sailboat.wav"/> + <prompt phrase="sandalwood" filename="sandalwood.wav"/> + <prompt phrase="sardonic" filename="sardonic.wav"/> + <prompt phrase="savagery" filename="savagery.wav"/> + <prompt phrase="sawdust" filename="sawdust.wav"/> + <prompt phrase="scallion" filename="scallion.wav"/> + <prompt phrase="scavenger" filename="scavenger.wav"/> + <prompt phrase="scenic" filename="scenic.wav"/> + <prompt phrase="scorecard" filename="scorecard.wav"/> + <prompt phrase="seabird" filename="seabird.wav"/> + <prompt phrase="select" filename="select.wav"/> + <prompt phrase="sensation" filename="sensation.wav"/> + <prompt phrase="sentence" filename="sentence.wav"/> + <prompt phrase="shadow" filename="shadow.wav"/> + <prompt phrase="shamrock" filename="shamrock.wav"/> + <prompt phrase="showgirl" filename="showgirl.wav"/> + <prompt phrase="skullcap" filename="skullcap.wav"/> + <prompt phrase="skydive" filename="skydive.wav"/> + <prompt phrase="slingshot" filename="slingshot.wav"/> + <prompt phrase="slowdown" filename="slowdown.wav"/> + <prompt phrase="snapline" filename="snapline.wav"/> + <prompt phrase="snapshot" filename="snapshot.wav"/> + <prompt phrase="snowcap" filename="snowcap.wav"/> + <prompt phrase="snowslide" filename="snowslide.wav"/> + <prompt phrase="sociable" filename="sociable.wav"/> + <prompt phrase="solo" filename="solo.wav"/> + <prompt phrase="southward" filename="southward.wav"/> + <prompt phrase="souvenir" filename="souvenir.wav"/> + <prompt phrase="soybean" filename="soybean.wav"/> + <prompt phrase="spaniel" filename="spaniel.wav"/> + <prompt phrase="spearhead" filename="spearhead.wav"/> + <prompt phrase="specialist" filename="specialist.wav"/> + <prompt phrase="speculate" filename="speculate.wav"/> + <prompt phrase="spellbind" filename="spellbind.wav"/> + <prompt phrase="spheroid" filename="spheroid.wav"/> + <prompt phrase="spigot" filename="spigot.wav"/> + <prompt phrase="spindle" filename="spindle.wav"/> + <prompt phrase="spyglass" filename="spyglass.wav"/> + <prompt phrase="stagehand" filename="stagehand.wav"/> + <prompt phrase="stagnate" filename="stagnate.wav"/> + <prompt phrase="stairway" filename="stairway.wav"/> + <prompt phrase="standard" filename="standard.wav"/> + <prompt phrase="stapler" filename="stapler.wav"/> + <prompt phrase="steamship" filename="steamship.wav"/> + <prompt phrase="sterling" filename="sterling.wav"/> + <prompt phrase="stethoscope" filename="stethoscope.wav"/> + <prompt phrase="stockman" filename="stockman.wav"/> + <prompt phrase="stopwatch" filename="stopwatch.wav"/> + <prompt phrase="stormy" filename="stormy.wav"/> + <prompt phrase="stupendous" filename="stupendous.wav"/> + <prompt phrase="sugar" filename="sugar.wav"/> + <prompt phrase="supportive" filename="supportive.wav"/> + <prompt phrase="surmount" filename="surmount.wav"/> + <prompt phrase="surrender" filename="surrender.wav"/> + <prompt phrase="suspense" filename="suspense.wav"/> + <prompt phrase="suspicious" filename="suspicious.wav"/> + <prompt phrase="sweatband" filename="sweatband.wav"/> + <prompt phrase="swelter" filename="swelter.wav"/> + <prompt phrase="sympathy" filename="sympathy.wav"/> + <prompt phrase="tactics" filename="tactics.wav"/> + <prompt phrase="talon" filename="talon.wav"/> + <prompt phrase="tambourine" filename="tambourine.wav"/> + <prompt phrase="tapeworm" filename="tapeworm.wav"/> + <prompt phrase="telephone" filename="telephone.wav"/> + <prompt phrase="tempest" filename="tempest.wav"/> + <prompt phrase="therapist" filename="therapist.wav"/> + <prompt phrase="tiger" filename="tiger.wav"/> + <prompt phrase="tissue" filename="tissue.wav"/> + <prompt phrase="tobacco" filename="tobacco.wav"/> + <prompt phrase="tolerance" filename="tolerance.wav"/> + <prompt phrase="tomorrow" filename="tomorrow.wav"/> + <prompt phrase="tonic" filename="tonic.wav"/> + <prompt phrase="topmost" filename="topmost.wav"/> + <prompt phrase="torpedo" filename="torpedo.wav"/> + <prompt phrase="tracker" filename="tracker.wav"/> + <prompt phrase="tradition" filename="tradition.wav"/> + <prompt phrase="transit" filename="transit.wav"/> + <prompt phrase="trauma" filename="trauma.wav"/> + <prompt phrase="travesty" filename="travesty.wav"/> + <prompt phrase="treadmill" filename="treadmill.wav"/> + <prompt phrase="trombonist" filename="trombonist.wav"/> + <prompt phrase="trouble" filename="trouble.wav"/> + <prompt phrase="truncated" filename="truncated.wav"/> + <prompt phrase="tumor" filename="tumor.wav"/> + <prompt phrase="tunnel" filename="tunnel.wav"/> + <prompt phrase="tycoon" filename="tycoon.wav"/> + <prompt phrase="typewriter" filename="typewriter.wav"/> + <prompt phrase="ultimate" filename="ultimate.wav"/> + <prompt phrase="uncut" filename="uncut.wav"/> + <prompt phrase="undaunted" filename="undaunted.wav"/> + <prompt phrase="underfoot" filename="underfoot.wav"/> + <prompt phrase="unearth" filename="unearth.wav"/> + <prompt phrase="unicorn" filename="unicorn.wav"/> + <prompt phrase="unify" filename="unify.wav"/> + <prompt phrase="universe" filename="universe.wav"/> + <prompt phrase="unravel" filename="unravel.wav"/> + <prompt phrase="unwind" filename="unwind.wav"/> + <prompt phrase="upcoming" filename="upcoming.wav"/> + <prompt phrase="uproot" filename="uproot.wav"/> + <prompt phrase="upset" filename="upset.wav"/> + <prompt phrase="upshot" filename="upshot.wav"/> + <prompt phrase="vacancy" filename="vacancy.wav"/> + <prompt phrase="vagabond" filename="vagabond.wav"/> + <prompt phrase="vapor" filename="vapor.wav"/> + <prompt phrase="vertigo" filename="vertigo.wav"/> + <prompt phrase="village" filename="village.wav"/> + <prompt phrase="virus" filename="virus.wav"/> + <prompt phrase="visitor" filename="visitor.wav"/> + <prompt phrase="vocalist" filename="vocalist.wav"/> + <prompt phrase="voyager" filename="voyager.wav"/> + <prompt phrase="waffle" filename="waffle.wav"/> + <prompt phrase="wallet" filename="wallet.wav"/> + <prompt phrase="warranty" filename="warranty.wav"/> + <prompt phrase="watchword" filename="watchword.wav"/> + <prompt phrase="wayside" filename="wayside.wav"/> + <prompt phrase="whimsical" filename="whimsical.wav"/> + <prompt phrase="willow" filename="willow.wav"/> + <prompt phrase="woodlark" filename="woodlark.wav"/> + <prompt phrase="yesteryear" filename="yesteryear.wav"/> + <!-- Event prompts --> + <prompt phrase="Bem-vindo ao agente de registo ZRTP." filename="zrtp-enroll_welcome.wav"/> + <prompt phrase="Deve verificar a chave de autenticação com destinatário. Se não for igual, indica a presença de uma escuta." filename="zrtp-check_sas.wav"/> + <prompt phrase="Apenas telefones que estão autenticados podem ser configurados para usarem este sistema de retransmissão ZRTP para chamadas com modo de segurança activo. Se o seu telefone não está autenticado com o sistema, esta chamada não terá qualquer efeito." filename="zrtp-enroll_not_sip_registered.wav"/> + <prompt phrase="O seu telefone indica que já confia neste sistema de retransmissão ZRTP para chamadas com o modo de segurança activo, portanto você já não precisa de fazer mais nada." filename="zrtp-enroll_already_enrolled.wav"/> + <prompt phrase="Apenas telefones equipados com o protocolo ZRTP podem usar esta extensão. O seu telefone não suporta ZRTP, portanto esta chamada não terá qualquer efeito." filename="zrtp-enroll_notzrtp.wav"/> + <prompt phrase="Este sistema está preparado para suportar chamadas encriptadas ZRTP. Você deve determinar se deseja permitir que o sistema possa interceptar ou gravar as suas chamadas telefónicas com o modo de segurança activado. Você pode desligar após confirmar este comportamento." filename="zrtp-enroll_confirmed.wav"/> + <prompt phrase="Comparando verbalmente o código desta autenticação com o destinatário." filename="zrtp-is_secure.wav"/> + <prompt phrase="O código de autenticação não foi verificado." filename="zrtp-is_unverified.wav"/> + <prompt phrase="O código de autenticação foi verificado." filename="zrtp-is_verified.wav"/> + <prompt phrase="Obrigado por telefonar. Até breve." filename="zrtp-thankyou_goodbye.wav"/> + <prompt phrase="Algo está errado" filename="zrtp-somethings_wrong.wav"/> + <prompt phrase="Erro." filename="zrtp-status_error.wav"/> + <prompt phrase="O modo de segurança não está activo na chamada." filename="zrtp-status_notsecure.wav"/> + <prompt phrase="O modo de segurança está activo na chamada." filename="zrtp-status_secure.wav"/> + <prompt phrase="Activando o modo de segurança na chamada." filename="zrtp-status_securing.wav"/> + </zrtp> + </pt_PT> +</language> diff --git a/src/mod/say/mod_say_es/mod_say_es.c b/src/mod/say/mod_say_es/mod_say_es.c index cf4d2f9..ff0ee94 100644 --- a/src/mod/say/mod_say_es/mod_say_es.c +++ b/src/mod/say/mod_say_es/mod_say_es.c @@ -39,8 +39,9 @@ * * Anthony Minessale II <anthm@freeswitch.org> * Michael B. Murdock <mike@mmurdock.org> + * François Delawarde <fdelawarde@wirelessmundi.com> * - * mod_say_es.c -- Say for English + * mod_say_es.c -- Say for Spanish * */ @@ -102,7 +103,7 @@ static switch_status_t play_group(switch_say_method_t method, int a, int b, int break; default: say_file("digits/%d.wav", a); - say_file("digits/hundred.wav"); + say_file("digits/hundreds.wav"); break; } } @@ -175,7 +176,12 @@ static switch_status_t es_say_general_count(switch_core_session_t *session, char switch (say_args->method) { case SSM_COUNTED: case SSM_PRONOUNCED: - if ((status = play_group(SSM_PRONOUNCED, places[8], places[7], places[6], "digits/million.wav", session, args)) != SWITCH_STATUS_SUCCESS) { + /* specific case, one million => un millón */ + if (!places[8] && !places[7] && (places[6] == 1)) { + say_file("digits/un.wav"); + say_file("digits/million.wav"); + } + else if ((status = play_group(SSM_PRONOUNCED, places[8], places[7], places[6], "digits/millions.wav", session, args)) != SWITCH_STATUS_SUCCESS) { return status; } if ((status = play_group(SSM_PRONOUNCED, places[5], places[4], places[3], "digits/thousand.wav", session, args)) != SWITCH_STATUS_SUCCESS) { diff --git a/src/mod/say/mod_say_pt/Makefile b/src/mod/say/mod_say_pt/Makefile new file mode 100644 index 0000000..2c35e6e --- /dev/null +++ b/src/mod/say/mod_say_pt/Makefile @@ -0,0 +1,2 @@ +BASE=../../../.. +include $(BASE)/build/modmake.rules diff --git a/src/mod/say/mod_say_pt/mod_say_pt.2008.vcproj b/src/mod/say/mod_say_pt/mod_say_pt.2008.vcproj new file mode 100644 index 0000000..bf8c033 --- /dev/null +++ b/src/mod/say/mod_say_pt/mod_say_pt.2008.vcproj @@ -0,0 +1,283 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="mod_say_pt" + ProjectGUID="{FA429E98-8B03-45E6-A096-A4BC5E821DE4}" + RootNamespace="mod_say_pt" + Keyword="Win32Proj" + TargetFrameworkVersion="131072" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + ConfigurationType="2" + InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + RandomizedBaseAddress="1" + DataExecutionPrevention="0" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + ConfigurationType="2" + InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll" + RandomizedBaseAddress="1" + DataExecutionPrevention="0" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + ConfigurationType="2" + InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + RandomizedBaseAddress="1" + DataExecutionPrevention="0" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + ConfigurationType="2" + InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll" + RandomizedBaseAddress="1" + DataExecutionPrevention="0" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath=".\mod_say_pt.c" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/src/mod/say/mod_say_pt/mod_say_pt.2010.vcxproj b/src/mod/say/mod_say_pt/mod_say_pt.2010.vcxproj new file mode 100644 index 0000000..63fba6f --- /dev/null +++ b/src/mod/say/mod_say_pt/mod_say_pt.2010.vcxproj @@ -0,0 +1,131 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>mod_say_pt</ProjectName> + <ProjectGuid>{FA429E98-8B03-45E6-A096-A4BC5E821DE4}</ProjectGuid> + <RootNamespace>mod_say_pt</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\..\w32\module_release.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\..\w32\module_debug.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\..\w32\module_release.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\..\w32\module_debug.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + </ClCompile> + <Link> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + </ClCompile> + <Link> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + </ClCompile> + <Link> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + </ClCompile> + <Link> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="mod_say_pt.c" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\..\w32\Library\FreeSwitchCore.2010.vcxproj"> + <Project>{202d7a4e-760d-4d0e-afa1-d7459ced30ff}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> diff --git a/src/mod/say/mod_say_es/mod_say_es.c b/src/mod/say/mod_say_pt/mod_say_pt.c similarity index 68% copy from src/mod/say/mod_say_es/mod_say_es.c copy to src/mod/say/mod_say_pt/mod_say_pt.c index cf4d2f9..747a0c8 100644 --- a/src/mod/say/mod_say_es/mod_say_es.c +++ b/src/mod/say/mod_say_pt/mod_say_pt.c @@ -1,475 +1,548 @@ -/* - * Copyright (c) 2007, Anthony Minessale II - * 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 original author; nor the names of any 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 OWNER - * 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. - * - * The Initial Developer of the Original Code is - * Anthony Minessale II <anthm@freeswitch.org> - * Portions created by the Initial Developer are Copyright (C) - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Anthony Minessale II <anthm@freeswitch.org> - * Michael B. Murdock <mike@mmurdock.org> - * - * mod_say_es.c -- Say for English - * - */ - -#include <switch.h> -#include <math.h> -#include <ctype.h> - -SWITCH_MODULE_LOAD_FUNCTION(mod_say_es_load); -SWITCH_MODULE_DEFINITION(mod_say_es, mod_say_es_load, NULL, NULL); - -#define say_num(num, meth) { \ - char tmp[80]; \ - switch_status_t tstatus; \ - switch_say_method_t smeth = say_args->method; \ - switch_say_type_t stype = say_args->type; \ - say_args->type = SST_ITEMS; say_args->method = meth; \ - switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \ - if ((tstatus = \ - es_say_general_count(session, tmp, say_args, args)) \ - != SWITCH_STATUS_SUCCESS) { \ - return tstatus; \ - } \ - say_args->method = smeth; say_args->type = stype; \ - } \ - - -#define say_file(...) { \ - char tmp[80]; \ - switch_status_t tstatus; \ - switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__); \ - if ((tstatus = \ - switch_ivr_play_file(session, NULL, tmp, args)) \ - != SWITCH_STATUS_SUCCESS){ \ - return tstatus; \ - } \ - if (!switch_channel_ready(switch_core_session_get_channel(session))) { \ - return SWITCH_STATUS_FALSE; \ - }} \ - -static switch_status_t play_group(switch_say_method_t method, int a, int b, int c, char *what, switch_core_session_t *session, switch_input_args_t *args) -{ - if (a) { - switch (a) { - case 1: - if (b || c) { - say_file("digits/hundred.wav"); - } else { - say_file("digits/100.wav"); - } - break; - case 5: - say_file("digits/500.wav"); - break; - case 7: - say_file("digits/700.wav"); - break; - case 9: - say_file("digits/900.wav"); - break; - default: - say_file("digits/%d.wav", a); - say_file("digits/hundred.wav"); - break; - } - } - - if (b) { - if (b > 1) { - switch (b) { - case 2: - if (method != SSM_COUNTED) { - if (c) { - say_file("digits/veinti.wav"); - } else { - say_file("digits/20.wav"); - } - break; - } - - default: - if ((b < 4) && (method == SSM_COUNTED)) { - say_file("digits/h-%d0.wav", b); - } else { - say_file("digits/%d0.wav", b); - if (c) { - say_file("currency/and.wav"); - } - } - break; - } - } else { - say_file("digits/%d%d.wav", b, c); - c = 0; - } - } - if (c) { - if (method == SSM_COUNTED) { - say_file("digits/h-%d.wav", c); - } else { - say_file("digits/%d.wav", c); - } - } - if (what && (a || b || c)) { - say_file(what); - } - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t es_say_general_count(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) -{ - int in; - int x = 0; - int places[9] = { 0 }; - char sbuf[13] = ""; - switch_status_t status; - - if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); - return SWITCH_STATUS_GENERR; - } - - in = atoi(tosay); - - if (in != 0) { - for (x = 8; x >= 0; x--) { - int num = (int) pow(10, x); - if ((places[(uint32_t) x] = in / num)) { - in -= places[(uint32_t) x] * num; - } - } - - switch (say_args->method) { - case SSM_COUNTED: - case SSM_PRONOUNCED: - if ((status = play_group(SSM_PRONOUNCED, places[8], places[7], places[6], "digits/million.wav", session, args)) != SWITCH_STATUS_SUCCESS) { - return status; - } - if ((status = play_group(SSM_PRONOUNCED, places[5], places[4], places[3], "digits/thousand.wav", session, args)) != SWITCH_STATUS_SUCCESS) { - return status; - } - if ((status = play_group(say_args->method, places[2], places[1], places[0], NULL, session, args)) != SWITCH_STATUS_SUCCESS) { - return status; - } - break; - case SSM_ITERATED: - { - char *p; - for (p = tosay; p && *p; p++) { - say_file("digits/%c.wav", *p); - } - } - break; - default: - break; - } - } else { - say_file("digits/0.wav"); - } - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t es_say_time(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) -{ - int32_t t; - switch_time_t target = 0; - switch_time_exp_t tm; - uint8_t say_date = 0, say_time = 0; - - if (say_args->type == SST_TIME_MEASUREMENT) { - int64_t hours = 0; - int64_t minutes = 0; - int64_t seconds = 0; - int64_t r = 0; - - if (strchr(tosay, ':')) { - char *tme = switch_core_session_strdup(session, tosay); - char *p; - - if ((p = strrchr(tme, ':'))) { - *p++ = '\0'; - seconds = atoi(p); - if ((p = strchr(tme, ':'))) { - *p++ = '\0'; - minutes = atoi(p); - if (tme) { - hours = atoi(tme); - } - } else { - minutes = atoi(tme); - } - } - } else { - if ((seconds = atoi(tosay)) <= 0) { - seconds = (int64_t) switch_epoch_time_now(NULL); - } - - if (seconds >= 60) { - minutes = seconds / 60; - r = seconds % 60; - seconds = r; - } - - if (minutes >= 60) { - hours = minutes / 60; - r = minutes % 60; - minutes = r; - } - } - - if (hours) { - say_num(hours, SSM_PRONOUNCED); - if (hours == 1) { - say_file("time/hour.wav"); - } else { - say_file("time/hours.wav"); - } - } else { - say_file("digits/0.wav"); - say_file("time/hours.wav"); - } - - if (minutes) { - say_num(minutes, SSM_PRONOUNCED); - if (minutes == 1) { - say_file("time/minute.wav"); - } else { - say_file("time/minutes.wav"); - } - } else { - say_file("digits/0.wav"); - say_file("time/minutes.wav"); - } - - if (seconds) { - say_num(seconds, SSM_PRONOUNCED); - if (seconds == 1) { - say_file("time/second.wav"); - } else { - say_file("time/seconds.wav"); - } - } else { - say_file("digits/0.wav"); - say_file("time/seconds.wav"); - } - - return SWITCH_STATUS_SUCCESS; - } - - if ((t = atoi(tosay)) > 0) { - target = switch_time_make(t, 0); - } else { - target = switch_micro_time_now(); - } - switch_time_exp_lt(&tm, target); - - switch (say_args->type) { - case SST_CURRENT_DATE_TIME: - say_date = say_time = 1; - break; - case SST_CURRENT_DATE: - say_date = 1; - break; - case SST_CURRENT_TIME: - say_time = 1; - break; - default: - break; - } - - if (say_date) { - say_file("time/day-%d.wav", tm.tm_wday); - say_file("time/mon-%d.wav", tm.tm_mon); - say_num(tm.tm_mday, SSM_PRONOUNCED); - say_num(tm.tm_year + 1900, SSM_PRONOUNCED); - } - - if (say_time) { - int32_t hour = tm.tm_hour, pm = 0; - - if (hour > 12) { - hour -= 12; - pm = 1; - } else if (hour == 12) { - pm = 1; - } else if (hour == 0) { - hour = 12; - pm = 0; - } - - say_num(hour, SSM_PRONOUNCED); - - if (tm.tm_min > 9) { - say_file("currency/and.wav"); - say_num(tm.tm_min, SSM_PRONOUNCED); - } else if (tm.tm_min) { - say_file("currency/and.wav"); - say_num(tm.tm_min, SSM_PRONOUNCED); - } else { - say_file("time/oclock.wav"); - } - - say_file("time/%s.wav", pm ? "p-m" : "a-m"); - } - - return SWITCH_STATUS_SUCCESS; -} - - -static switch_status_t es_say_money(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) -{ - char sbuf[16] = ""; /* enough for 999,999,999,999.99 (w/o the commas or leading $) */ - char *dollars = NULL; - char *cents = NULL; - - if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); - return SWITCH_STATUS_GENERR; - } - - dollars = sbuf; - - if ((cents = strchr(sbuf, '.'))) { - *cents++ = '\0'; - if (strlen(cents) > 2) { - cents[2] = '\0'; - } - } - - /* If positive sign - skip over" */ - if (sbuf[0] == '+') { - dollars++; - } - - /* If negative say "negative" */ - if (sbuf[0] == '-') { - say_file("currency/negative.wav"); - dollars++; - } - - /* Say dollar amount */ - es_say_general_count(session, dollars, say_args, args); - if (atoi(dollars) == 1) { - say_file("currency/dollar.wav"); - } else { - say_file("currency/dollars.wav"); - } - - /* Say "and" */ - say_file("currency/and.wav"); - - /* Say cents */ - if (cents) { - es_say_general_count(session, cents, say_args, args); - if (atoi(cents) == 1) { - say_file("currency/cent.wav"); - } else { - say_file("currency/cents.wav"); - } - } else { - say_file("digits/0.wav"); - say_file("currency/cents.wav"); - } - - return SWITCH_STATUS_SUCCESS; -} - - - -static switch_status_t es_say(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) -{ - - switch_say_callback_t say_cb = NULL; - - switch (say_args->type) { - case SST_NUMBER: - case SST_ITEMS: - case SST_PERSONS: - case SST_MESSAGES: - say_cb = es_say_general_count; - break; - case SST_TIME_MEASUREMENT: - case SST_CURRENT_DATE: - case SST_CURRENT_TIME: - case SST_CURRENT_DATE_TIME: - say_cb = es_say_time; - break; - case SST_IP_ADDRESS: - return switch_ivr_say_ip(session, tosay, es_say_general_count, say_args, args); - break; - case SST_NAME_SPELLED: - case SST_NAME_PHONETIC: - return switch_ivr_say_spell(session, tosay, say_args, args); - break; - case SST_CURRENCY: - say_cb = es_say_money; - break; - default: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", say_args->type); - break; - } - - if (say_cb) { - return say_cb(session, tosay, say_args, args); - } - - return SWITCH_STATUS_FALSE; -} - -SWITCH_MODULE_LOAD_FUNCTION(mod_say_es_load) -{ - switch_say_interface_t *say_interface; - /* connect my internal structure to the blank pointer passed to me */ - *module_interface = switch_loadable_module_create_module_interface(pool, modname); - say_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_SAY_INTERFACE); - say_interface->interface_name = "es"; - say_interface->say_function = es_say; - - /* indicate that the module should continue to be loaded */ - return SWITCH_STATUS_SUCCESS; -} - -/* For Emacs: - * Local Variables: - * mode:c - * indent-tabs-mode:t - * tab-width:4 - * c-basic-offset:4 - * End: - * For VIM: - * vim:set softtabstop=4 shiftwidth=4 tabstop=4: +/* + * Copyright (c) 2007, Anthony Minessale II + * 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 original author; nor the names of any 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 OWNER + * 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. + * + * The Initial Developer of the Original Code is + * Anthony Minessale II <anthm@freeswitch.org> + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Anthony Minessale II <anthm@freeswitch.org> + * Michael B. Murdock <mike@mmurdock.org> + * António Silva <asilva@wirelessmundi.com> + * + * mod_say_pt.c -- Say for Portuguese + * + */ + +#include <switch.h> +#include <math.h> +#include <ctype.h> + +SWITCH_MODULE_LOAD_FUNCTION(mod_say_pt_load); +SWITCH_MODULE_DEFINITION(mod_say_pt, mod_say_pt_load, NULL, NULL); + +#define say_num(num, meth) { \ + char tmp[80]; \ + switch_status_t tstatus; \ + switch_say_method_t smeth = say_args->method; \ + switch_say_type_t stype = say_args->type; \ + say_args->type = SST_ITEMS; say_args->method = meth; \ + switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \ + if ((tstatus = \ + pt_say_general_count(session, tmp, say_args, args)) \ + != SWITCH_STATUS_SUCCESS) { \ + return tstatus; \ + } \ + say_args->method = smeth; say_args->type = stype; \ + } \ + + +#define say_file(...) { \ + char tmp[80]; \ + switch_status_t tstatus; \ + switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__); \ + if ((tstatus = \ + switch_ivr_play_file(session, NULL, tmp, args)) \ + != SWITCH_STATUS_SUCCESS){ \ + return tstatus; \ + } \ + if (!switch_channel_ready(switch_core_session_get_channel(session))) { \ + return SWITCH_STATUS_FALSE; \ + }} \ + + +static switch_status_t play_group(switch_say_method_t method, int a, int b, int c, char *what, switch_core_session_t *session, switch_input_args_t *args) +{ + + /*a => 1xx-9xx*/ + if (a) { + switch (a) { + case 1: + if (b || c) { + say_file("digits/hundred.wav"); + } else { + say_file("digits/100.wav"); + } + break; + case 2: + say_file("digits/200.wav"); + break; + case 3: + say_file("digits/300.wav"); + break; + case 5: + say_file("digits/500.wav"); + break; + default: + say_file("digits/%d.wav", a); + say_file("digits/hundreds.wav"); + break; + } + if (b || c) { + say_file("currency/and.wav"); + } + } + /* b => 1x - 9x */ + if (b) { + if (b > 1) { + if (method == SSM_COUNTED) { + say_file("digits/h-%d0.wav", b); + } else { + say_file("digits/%d0.wav", b); + if (c > 0) { + say_file("currency/and.wav"); + } + } + } else { + say_file("digits/%d%d.wav", b, c); + c = 0; + } + } + /* c => 0 - 9*/ + if (c) { + if (method == SSM_COUNTED) { + say_file("digits/h-%d.wav", c); + } else { + say_file("digits/%d.wav", c); + } + } + + if (what && (a || b || c)) { + say_file(what); + } + + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t pt_say_general_count(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +{ + int in; + int x = 0; + int places[9] = { 0 }; + char sbuf[128] = ""; + switch_status_t status; + + if (say_args->method == SSM_ITERATED) { + if ((tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)))) { + char *p; + for (p = tosay; p && *p; p++) { + say_file("digits/%c.wav", *p); + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); + return SWITCH_STATUS_GENERR; + } + return SWITCH_STATUS_SUCCESS; + } + + if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); + return SWITCH_STATUS_GENERR; + } + + in = atoi(tosay); + + if (in != 0) { + for (x = 8; x >= 0; x--) { + int num = (int) pow(10, x); + if ((places[(uint32_t) x] = in / num)) { + in -= places[(uint32_t) x] * num; + } + } + + switch (say_args->method) { + case SSM_COUNTED: + case SSM_PRONOUNCED: + /* specific case, one million => um milhão */ + if (!places[8] && !places[7] && (places[6] == 1)) { + say_file("digits/1.wav"); + say_file("digits/million.wav"); + } else if ((status = play_group(SSM_PRONOUNCED, places[8], places[7], places[6], "digits/millions.wav", session, args)) != SWITCH_STATUS_SUCCESS) { + return status; + } + if ((status = play_group(SSM_PRONOUNCED, places[5], places[4], places[3], "digits/thousand.wav", session, args)) != SWITCH_STATUS_SUCCESS) { + return status; + } + if ((status = play_group(say_args->method, places[2], places[1], places[0], NULL, session, args)) != SWITCH_STATUS_SUCCESS) { + return status; + } + break; + default: + break; + } + } else { + say_file("digits/0.wav"); + } + + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t pt_say_time(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +{ + int32_t t; + switch_time_t target = 0, target_now = 0; + switch_time_exp_t tm, tm_now; + uint8_t say_date = 0, say_time = 0, say_year = 0, say_month = 0, say_dow = 0, say_day = 0, say_yesterday = 0, say_today = 0; + switch_channel_t *channel = switch_core_session_get_channel(session); + const char *tz = switch_channel_get_variable(channel, "timezone"); + + if (say_args->type == SST_TIME_MEASUREMENT) { + int64_t hours = 0; + int64_t minutes = 0; + int64_t seconds = 0; + int64_t r = 0; + + if (strchr(tosay, ':')) { + char *tme = switch_core_session_strdup(session, tosay); + char *p; + + if ((p = strrchr(tme, ':'))) { + *p++ = '\0'; + seconds = atoi(p); + if ((p = strchr(tme, ':'))) { + *p++ = '\0'; + minutes = atoi(p); + if (tme) { + hours = atoi(tme); + } + } else { + minutes = atoi(tme); + } + } + } else { + if ((seconds = atol(tosay)) <= 0) { + seconds = (int64_t) switch_epoch_time_now(NULL); + } + + if (seconds >= 60) { + minutes = seconds / 60; + r = seconds % 60; + seconds = r; + } + + if (minutes >= 60) { + hours = minutes / 60; + r = minutes % 60; + minutes = r; + } + } + + if (hours) { + say_num(hours, SSM_PRONOUNCED); + if (hours == 1) { + say_file("time/hour.wav"); + } else { + say_file("time/hours.wav"); + } + } else { + say_file("digits/0.wav"); + say_file("time/hours.wav"); + } + + if (minutes) { + say_num(minutes, SSM_PRONOUNCED); + if (minutes == 1) { + say_file("time/minute.wav"); + } else { + say_file("time/minutes.wav"); + } + } else { + say_file("digits/0.wav"); + say_file("time/minutes.wav"); + } + + if (seconds) { + say_num(seconds, SSM_PRONOUNCED); + if (seconds == 1) { + say_file("time/second.wav"); + } else { + say_file("time/seconds.wav"); + } + } else { + say_file("digits/0.wav"); + say_file("time/seconds.wav"); + } + + return SWITCH_STATUS_SUCCESS; + } + + if ((t = atol(tosay)) > 0) { + target = switch_time_make(t, 0); + target_now = switch_micro_time_now(); + } else { + target = switch_micro_time_now(); + target_now = switch_micro_time_now(); + } + + if (tz) { + int check = atoi(tz); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Timezone is [%s]\n", tz); + if (check) { + switch_time_exp_tz(&tm, target, check); + switch_time_exp_tz(&tm_now, target_now, check); + } else { + switch_time_exp_tz_name(tz, &tm, target); + switch_time_exp_tz_name(tz, &tm_now, target_now); + } + } else { + switch_time_exp_lt(&tm, target); + switch_time_exp_lt(&tm_now, target_now); + } + + switch (say_args->type) { + case SST_CURRENT_DATE_TIME: + say_date = say_time = 1; + break; + case SST_CURRENT_DATE: + say_date = 1; + break; + case SST_CURRENT_TIME: + say_time = 1; + break; + case SST_SHORT_DATE_TIME: + say_time = 1; + if (tm.tm_year != tm_now.tm_year) { + say_date = 1; + break; + } + if (tm.tm_yday == tm_now.tm_yday) { + say_today = 1; + break; + } + if (tm.tm_yday == tm_now.tm_yday - 1) { + say_yesterday = 1; + break; + } + if (tm.tm_yday >= tm_now.tm_yday - 5) { + say_dow = 1; + break; + } + if (tm.tm_mon != tm_now.tm_mon) { + say_month = say_day = say_dow = 1; + break; + } + + say_month = say_day = say_dow = 1; + + break; + default: + break; + } + + if (say_today) { + say_file("time/today.wav"); + } + if (say_yesterday) { + say_file("time/yesterday.wav"); + } + if (say_dow) { + say_file("time/day-%d.wav", tm.tm_wday); + } + + if (say_date) { + say_year = say_month = say_day = say_dow = 1; + say_today = say_yesterday = 0; + } + + if (say_month) { + say_file("time/mon-%d.wav", tm.tm_mon); + } + if (say_day) { + say_num(tm.tm_mday, SSM_COUNTED); + } + if (say_year) { + say_num(tm.tm_year + 1900, SSM_PRONOUNCED); + } + + if (say_time) { + int32_t hour = tm.tm_hour, pm = 0; + + if (say_date || say_today || say_yesterday || say_dow) { + if (hour == 1) { + say_file("time/at.wav"); + } else { + say_file("time/ats.wav"); + } + } + + if (hour > 12) { + hour -= 12; + pm = 1; + } else if (hour == 12) { + pm = 1; + } else if (hour == 0) { + hour = 12; + pm = 0; + } + + say_num(hour, SSM_PRONOUNCED); + + if (tm.tm_min) { + say_file("currency/and.wav"); + say_num(tm.tm_min, SSM_PRONOUNCED); + } else { + say_file("time/oclock.wav"); + } + + say_file("time/%s.wav", pm ? "p-m" : "a-m"); + } + + return SWITCH_STATUS_SUCCESS; +} + + +static switch_status_t pt_say_money(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +{ + char sbuf[16] = ""; /* enough for 999,999,999,999.99 (w/o the commas or leading $) */ + char *dollars = NULL; + char *cents = NULL; + + if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); + return SWITCH_STATUS_GENERR; + } + + dollars = sbuf; + + if ((cents = strchr(sbuf, '.'))) { + *cents++ = '\0'; + if (strlen(cents) > 2) { + cents[2] = '\0'; + } + } + + /* If positive sign - skip over" */ + if (sbuf[0] == '+') { + dollars++; + } + + /* If negative say "negative" */ + if (sbuf[0] == '-') { + say_file("currency/negative.wav"); + dollars++; + } + + /* Say dollar amount */ + pt_say_general_count(session, dollars, say_args, args); + if (atoi(dollars) == 1) { + say_file("currency/dollar.wav"); + } else { + say_file("currency/dollars.wav"); + } + + /* Say "and" */ + say_file("currency/and.wav"); + + /* Say cents */ + if (cents) { + pt_say_general_count(session, cents, say_args, args); + if (atoi(cents) == 1) { + say_file("currency/cent.wav"); + } else { + say_file("currency/cents.wav"); + } + } else { + say_file("digits/0.wav"); + say_file("currency/cents.wav"); + } + + return SWITCH_STATUS_SUCCESS; +} + + + +static switch_status_t pt_say(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +{ + + switch_say_callback_t say_cb = NULL; + + switch (say_args->type) { + case SST_NUMBER: + case SST_ITEMS: + case SST_PERSONS: + case SST_MESSAGES: + say_cb = pt_say_general_count; + break; + case SST_TIME_MEASUREMENT: + case SST_CURRENT_DATE: + case SST_CURRENT_TIME: + case SST_CURRENT_DATE_TIME: + case SST_SHORT_DATE_TIME: + say_cb = pt_say_time; + break; + case SST_IP_ADDRESS: + return switch_ivr_say_ip(session, tosay, pt_say_general_count, say_args, args); + break; + case SST_NAME_SPELLED: + case SST_NAME_PHONETIC: + return switch_ivr_say_spell(session, tosay, say_args, args); + break; + case SST_CURRENCY: + say_cb = pt_say_money; + break; + default: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", say_args->type); + break; + } + + if (say_cb) { + return say_cb(session, tosay, say_args, args); + } + + return SWITCH_STATUS_FALSE; +} + +SWITCH_MODULE_LOAD_FUNCTION(mod_say_pt_load) +{ + switch_say_interface_t *say_interface; + /* connect my internal structure to the blank pointer passed to me */ + *module_interface = switch_loadable_module_create_module_interface(pool, modname); + say_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_SAY_INTERFACE); + say_interface->interface_name = "pt"; + say_interface->say_function = pt_say; + + /* indicate that the module should continue to be loaded */ + return SWITCH_STATUS_SUCCESS; +} + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4: */ diff --git a/src/mod/say/mod_say_pt/mod_say_pt.vcproj b/src/mod/say/mod_say_pt/mod_say_pt.vcproj new file mode 100644 index 0000000..fb5d2db --- /dev/null +++ b/src/mod/say/mod_say_pt/mod_say_pt.vcproj @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="mod_say_pt" + ProjectGUID="{FA429E98-8B03-45E6-A096-A4BC5E821DE4}" + RootNamespace="mod_say_pt" + Keyword="Win32Proj" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + ConfigurationType="2" + InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops" + CharacterSet="2" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0" + /> + </Configuration> + <Configuration + Name="Release|Win32" + ConfigurationType="2" + InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops" + CharacterSet="2" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="0" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath=".\mod_say_pt.c" + > + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> commit 7c74af682e1c5b063aee1f1451692c2713742157 Merge: 2343708 668763f Author: cypromis <michal.bielicki@seventhsignal.de> Date: Sat Dec 18 01:16:03 2010 +0100 Merge remote branch 'origin/master' commit 2343708a9c13f942d0db94281a953215297d5b39 Author: cypromis <michal.bielicki@seventhsignal.de> Date: Sat Dec 18 01:15:55 2010 +0100 Sun Studio does not like __FUNCTION__ and -mt makes better multithreaded code diff --git a/configure.in b/configure.in index de72612..b1ab0f1 100644 --- a/configure.in +++ b/configure.in @@ -205,10 +205,14 @@ if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then APR_ADDTO(SWITCH_AM_CFLAGS, -DPIC) APR_ADDTO(SWITCH_AM_CFLAGS, -erroff=E_END_OF_LOOP_CODE_NOT_REACHED) APR_ADDTO(SWITCH_AM_CFLAGS, -errtags=yes) + APR_ADDTO(SWITCH_AM_CFLAGS, -D__FUNCTION__=__func__ ) + APR_ADDTO(SWITCH_AM_CFLAGS, -mt) APR_ADDTO(SWITCH_AM_CXXFLAGS, -errtags=yes) APR_ADDTO(SWITCH_AM_CXXFLAGS, -KPIC) APR_ADDTO(SWITCH_AM_CXXFLAGS, -DPIC) APR_ADDTO(SWITCH_AM_CXXFLAGS, "-features=extensions") + APR_ADDTO(SWITCH_AM_CXXFLAGS, -D__FUNCTION__=__func__) + APR_ADDTO(SWITCH_AM_CXXFLAGS, -mt) APR_ADDTO(SWITCH_AM_LDFLAGS, -R${prefix}/lib) if test "${enable_64}" = "yes"; then commit 668763f4907b1b6115827160037b867800224df6 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Dec 17 17:27:23 2010 -0600 prevent race on codec change mid-call diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 07e125a..8aa37b9 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1084,7 +1084,7 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f tech_pvt->last_ts = 0; /* inform them of the codec they are actually sending */ - +#if 0 if (++tech_pvt->codec_reinvites > 2) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Ok, some devices *cough* X-lite *cough*\n" @@ -1093,7 +1093,10 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f } else { sofia_glue_do_invite(session); } +#endif + *frame = &silence_frame; + return SWITCH_STATUS_SUCCESS; } } diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 0f52bbc..029f60a 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -2669,7 +2669,8 @@ switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force) tech_pvt->rm_encoding, tech_pvt->codec_ms, tech_pvt->rm_rate); - + + switch_yield(tech_pvt->read_impl.microseconds_per_packet); switch_core_session_lock_codec_write(tech_pvt->session); switch_core_session_lock_codec_read(tech_pvt->session); resetting = 1; commit ab0a2bfa034aa535de9dae1cf7cbf03224ad2bf3 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Dec 17 17:08:24 2010 -0600 prune diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index f275363..9d98969 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -291,6 +291,7 @@ static switch_status_t fifo_queue_popfly(fifo_queue_t *queue, const char *uuid) struct fifo_node { char *name; switch_mutex_t *mutex; + switch_mutex_t *update_mutex; fifo_queue_t *fifo_list[MAX_PRI]; switch_hash_t *consumer_hash; int outbound_priority; @@ -801,6 +802,7 @@ static fifo_node_t *create_node(const char *name, uint32_t importance, switch_mu switch_core_hash_init(&node->consumer_hash, node->pool); switch_thread_rwlock_create(&node->rwlock, node->pool); switch_mutex_init(&node->mutex, SWITCH_MUTEX_NESTED, node->pool); + switch_mutex_init(&node->update_mutex, SWITCH_MUTEX_NESTED, node->pool); cbt.buf = outbound_count; cbt.len = sizeof(outbound_count); sql = switch_mprintf("select count(*) from fifo_outbound where fifo_name = '%q'", name); @@ -1193,10 +1195,10 @@ static void *SWITCH_THREAD_FUNC ringall_thread_run(switch_thread_t *thread, void if (node) { - switch_thread_rwlock_wrlock(node->rwlock); + switch_mutex_lock(node->update_mutex); node->busy = 0; node->ring_consumer_count = 1; - switch_thread_rwlock_unlock(node->rwlock); + switch_mutex_unlock(node->update_mutex); } else { goto end; } @@ -1437,10 +1439,10 @@ static void *SWITCH_THREAD_FUNC ringall_thread_run(switch_thread_t *thread, void cbh->ready = 1; if (node) { - switch_thread_rwlock_wrlock(node->rwlock); + switch_mutex_lock(node->update_mutex); node->ring_consumer_count = 0; node->busy = 0; - switch_thread_rwlock_unlock(node->rwlock); + switch_mutex_unlock(node->update_mutex); } @@ -1501,10 +1503,10 @@ static void *SWITCH_THREAD_FUNC o_thread_run(switch_thread_t *thread, void *obj) switch_mutex_unlock(globals.mutex); if (node) { - switch_thread_rwlock_wrlock(node->rwlock); + switch_mutex_lock(node->update_mutex); node->ring_consumer_count++; node->busy = 0; - switch_thread_rwlock_unlock(node->rwlock); + switch_mutex_unlock(node->update_mutex); } switch_event_create(&ovars, SWITCH_EVENT_REQUEST_PARAMS); @@ -1601,12 +1603,12 @@ static void *SWITCH_THREAD_FUNC o_thread_run(switch_thread_t *thread, void *obj) switch_event_destroy(&ovars); if (node) { - switch_thread_rwlock_wrlock(node->rwlock); + switch_mutex_lock(node->update_mutex); if (node->ring_consumer_count-- < 0) { node->ring_consumer_count = 0; } node->busy = 0; - switch_thread_rwlock_unlock(node->rwlock); + switch_mutex_unlock(node->update_mutex); } switch_core_destroy_memory_pool(&h->pool); @@ -1754,9 +1756,35 @@ static void *SWITCH_THREAD_FUNC node_thread_run(switch_thread_t *thread, void *o if (globals.debug) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Trying priority: %d\n", cur_priority); + restart: + for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) { switch_hash_this(hi, &var, NULL, &val); if ((node = (fifo_node_t *) val)) { + + if (node->ready == FIFO_DELAY_DESTROY) { + int doit = 0; + + switch_mutex_lock(node->update_mutex); + doit = node->consumer_count == 0 && node_caller_count(node) == 0; + switch_mutex_unlock(node->update_mutex); + + if (doit) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "%s removed.\n", node->name); + switch_core_hash_delete(globals.fifo_hash, node->name); + + node->ready = 0; + switch_mutex_lock(node->mutex); + switch_core_hash_destroy(&node->consumer_hash); + switch_mutex_unlock(node->mutex); + switch_mutex_unlock(node->update_mutex); + switch_core_destroy_memory_pool(&node->pool); + goto restart; + } + + } + + if (node->outbound_priority == 0) node->outbound_priority = 5; if (node->has_outbound && node->ready && !node->busy && node->outbound_priority == cur_priority) { ppl_waiting = node_caller_count(node); @@ -2219,6 +2247,7 @@ SWITCH_STANDARD_APP(fifo_function) if (!(node = switch_core_hash_find(globals.fifo_hash, nlist[i]))) { node = create_node(nlist[i], importance, globals.sql_mutex); node->ready = 1; + switch_thread_rwlock_rdlock(node->rwlock); } node_list[node_count++] = node; } @@ -2306,7 +2335,7 @@ SWITCH_STANDARD_APP(fifo_function) switch_channel_answer(channel); - switch_thread_rwlock_wrlock(node->rwlock); + switch_mutex_lock(node->update_mutex); if ((pri = switch_channel_get_variable(channel, "fifo_priority"))) { p = atoi(pri); @@ -2344,7 +2373,7 @@ SWITCH_STANDARD_APP(fifo_function) switch_channel_set_variable(channel, "fifo_priority", tmp); } - switch_thread_rwlock_unlock(node->rwlock); + switch_mutex_unlock(node->update_mutex); ts = switch_micro_time_now(); switch_time_exp_lt(&tm, ts); @@ -2450,9 +2479,9 @@ SWITCH_STANDARD_APP(fifo_function) } switch_mutex_lock(globals.mutex); - switch_thread_rwlock_wrlock(node->rwlock); + switch_mutex_lock(node->update_mutex); node_remove_uuid(node, uuid); - switch_thread_rwlock_unlock(node->rwlock); + switch_mutex_unlock(node->update_mutex); send_presence(node); check_cancel(node); switch_mutex_unlock(globals.mutex); @@ -2682,9 +2711,9 @@ SWITCH_STANDARD_APP(fifo_function) } if (pop && !node_caller_count(node)) { - switch_thread_rwlock_wrlock(node->rwlock); + switch_mutex_lock(node->update_mutex); node->start_waiting = 0; - switch_thread_rwlock_unlock(node->rwlock); + switch_mutex_unlock(node->update_mutex); } } @@ -3074,29 +3103,9 @@ SWITCH_STANDARD_APP(fifo_function) done: - switch_mutex_lock(globals.mutex); - if (node && node->ready == FIFO_DELAY_DESTROY) { - int doit = 0; - - switch_thread_rwlock_wrlock(node->rwlock); - doit = node->consumer_count == 0 && node_caller_count(node) == 0; + if (node) { switch_thread_rwlock_unlock(node->rwlock); - - if (doit) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "%s removed.\n", node->name); - switch_core_hash_delete(globals.fifo_hash, node->name); - - node->ready = 0; - switch_mutex_lock(node->mutex); - switch_core_hash_destroy(&node->consumer_hash); - switch_mutex_unlock(node->mutex); - switch_thread_rwlock_unlock(node->rwlock); - switch_core_destroy_memory_pool(&node->pool); - } - } - switch_mutex_unlock(globals.mutex); - switch_channel_clear_app_flag_key(FIFO_APP_KEY, channel, FIFO_APP_BRIDGE_TAG); @@ -3707,9 +3716,9 @@ SWITCH_STANDARD_API(fifo_api_function) switch_hash_this(hi, &var, NULL, &val); node = (fifo_node_t *) val; len = node_caller_count(node); - switch_thread_rwlock_wrlock(node->rwlock); + switch_mutex_lock(node->update_mutex); stream->write_function(stream, "%s:%d:%d:%d\n", (char *) var, node->consumer_count, node_caller_count(node), len); - switch_thread_rwlock_unlock(node->rwlock); + switch_mutex_unlock(node->update_mutex); x++; } @@ -3718,9 +3727,9 @@ SWITCH_STANDARD_API(fifo_api_function) } } else if ((node = switch_core_hash_find(globals.fifo_hash, argv[1]))) { len = node_caller_count(node); - switch_thread_rwlock_wrlock(node->rwlock); + switch_mutex_lock(node->update_mutex); stream->write_function(stream, "%s:%d:%d:%d\n", argv[1], node->consumer_count, node_caller_count(node), len); - switch_thread_rwlock_unlock(node->rwlock); + switch_mutex_unlock(node->update_mutex); } else { stream->write_function(stream, "none\n"); } @@ -3730,9 +3739,9 @@ SWITCH_STANDARD_API(fifo_api_function) switch_hash_this(hi, &var, NULL, &val); node = (fifo_node_t *) val; len = node_caller_count(node); - switch_thread_rwlock_wrlock(node->rwlock); + switch_mutex_lock(node->update_mutex); stream->write_function(stream, "%s:%d\n", (char *) var, node->has_outbound); - switch_thread_rwlock_unlock(node->rwlock); + switch_mutex_unlock(node->update_mutex); x++; } @@ -3741,9 +3750,9 @@ SWITCH_STANDARD_API(fifo_api_function) } } else if ((node = switch_core_hash_find(globals.fifo_hash, argv[1]))) { len = node_caller_count(node); - switch_thread_rwlock_wrlock(node->rwlock); + switch_mutex_lock(node->update_mutex); stream->write_function(stream, "%s:%d\n", argv[1], node->has_outbound); - switch_thread_rwlock_unlock(node->rwlock); + switch_mutex_unlock(node->update_mutex); } else { stream->write_function(stream, "none\n"); } @@ -4116,7 +4125,7 @@ static switch_status_t load_config(int reload, int del_all) node->ready = FIFO_DELAY_DESTROY; } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "%s removed.\n", node->name); - switch_thread_rwlock_wrlock(node->rwlock); + switch_mutex_lock(node->update_mutex); for (x = 0; x < MAX_PRI; x++) { while (fifo_queue_pop(node->fifo_list[x], &pop, 2) == SWITCH_STATUS_SUCCESS) { switch_event_destroy(&pop); @@ -4125,7 +4134,7 @@ static switch_status_t load_config(int reload, int del_all) switch_core_hash_delete(globals.fifo_hash, node->name); switch_core_hash_destroy(&node->consumer_hash); - switch_thread_rwlock_unlock(node->rwlock); + switch_mutex_unlock(node->update_mutex); switch_core_destroy_memory_pool(&node->pool); goto top; } @@ -4401,7 +4410,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_fifo_shutdown) switch_hash_this(hi, NULL, NULL, &val); node = (fifo_node_t *) val; - switch_thread_rwlock_wrlock(node->rwlock); + switch_mutex_lock(node->update_mutex); switch_mutex_lock(node->mutex); for (x = 0; x < MAX_PRI; x++) { while (fifo_queue_pop(node->fifo_list[x], &pop, 2) == SWITCH_STATUS_SUCCESS) { @@ -4411,7 +4420,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_fifo_shutdown) switch_mutex_unlock(node->mutex); switch_core_hash_delete(globals.fifo_hash, node->name); switch_core_hash_destroy(&node->consumer_hash); - switch_thread_rwlock_unlock(node->rwlock); + switch_mutex_unlock(node->update_mutex); switch_core_destroy_memory_pool(&node->pool); } commit 257c7edaf7d7e6151d11e5ef924d87a77f2c369b Author: Michael S Collins <msc@freeswitch.org> Date: Fri Dec 17 14:54:51 2010 -0800 Update phrase_en.xml for version 1.0.14 of the sounds package diff --git a/docs/phrase/phrase_en.xml b/docs/phrase/phrase_en.xml index a028a2a..41bc69c 100644 --- a/docs/phrase/phrase_en.xml +++ b/docs/phrase/phrase_en.xml @@ -221,6 +221,7 @@ <prompt phrase="Welcome to your new voicemail. To listen to a tutorial and setup your voice mail box, press 1. To skip, press 2." filename="vm-tutorial_yes_no.wav"/> <prompt phrase="I need to record your first and last name. This recording is used throughout the system, including in the company directory." filename="vm-tutorial_record_name.wav"/> <prompt phrase="Your personal identification number, or 'pin', is used to prevent others from accessing your voicemail messages. Would you like to change it now?" filename="vm-tutorial_change_pin.wav"/> + <prompt phrase="The person you are trying to reach is not available and does not have voicemail." filename="vm-not_available_no_voicemail.wav"/> </voicemail> <directory> <prompt phrase="Please enter the first few letters of the persons" filename="dir-enter_person.wav"/> @@ -241,6 +242,8 @@ <prompt phrase="...letters of the person's name." filename="dir-letters_of_person_name.wav"/> <prompt phrase="Please try again." filename="dir-please_try_again.wav"/> <prompt phrase="press" filename="dir-press.wav" info="we can copy vm/vm-press.wav"/> + <prompt phrase="For the next entry..." filename="dir-for_next.wav" note="re-recorded because original was wrong"/> + <prompt phrase="Please enter the first few letters of the person's first or last name" filename="dir-enter_person_first_or_last.wav"/> </directory> <conference> <prompt phrase="NULL" filename="conf-ack.wav" type="tone"/> @@ -259,6 +262,12 @@ <prompt phrase="Invalid pin number, try again." filename="conf-bad-pin.wav"/> <prompt phrase="goodbye" filename="conf-goodbye.wav"/> <prompt phrase="Welcome to the conference." filename="conf-welcome.wav"/> + <prompt phrase="Please enter the conference number, followed by the pound key" filename="conf-enter_conf_number.wav"/> + <prompt phrase="Enter the conference PIN number, followed by the pound key." filename="conf-enter_conf_pin.wav"/> + <prompt phrase="...has entered the conference." filename="conf-has_joined.wav"/> + <prompt phrase="...has left the conference." filename="conf-has_left.wav"/> + <prompt phrase="You are already muted." filename="conf-you_are_already_muted.wav"/> + <prompt phrase="You are now bi-directionally muted." filename="conf-you_are_now_bidirectionally_muted.wav"/> </conference> <ivr> <prompt phrase="Account number" filename="ivr-account_number.wav"/> @@ -362,8 +371,6 @@ <prompt phrase="Thank you for calling. If you know your party's extension, please enter it now. For a directory, press..." filename="ivr-generic_greeting.wav"/> <prompt phrase="...file..." filename="ivr-file.wav"/> <prompt phrase="...files..." filename="ivr-files-.wav"/> - - <!-- The following phrases still need to be recorded --> <prompt phrase="For a wakeup call..." filename="ivr-for_a_wakeup_call.wav"/> <prompt phrase="This is your wakeup call." filename="ivr-this_is_your_wakeup_call.wav"/> <prompt phrase="To request a wakeup call..." filename="ivr-request_wakeup_call.wav"/> @@ -390,15 +397,10 @@ <prompt phrase="You are the..." filename="ivr-you_are_the.wav"/> <prompt phrase="One moment please." filename="ivr-one_moment_please.wav"/> <prompt phrase="Your call will be answered in the order it was received." filename="ivr-call_answered_order_received.wav"/> - <prompt phrase="Please enter the conference number, followed by the pound key" filename="conf-enter_conf_number.wav"/> - <prompt phrase="Enter the conference PIN number, followed by the pound key." filename="conf-enter_conf_pin.wav"/> - <prompt phrase="...has entered the conference." filename="conf-has_joined.wav"/> - <prompt phrase="...has left the conference." filename="conf-has_left.wav"/> <prompt phrase="You entered..." filename="ivr-you_entered.wav"/> <prompt phrase="Extension number..." filename="ivr-extension_number.wav"/> <prompt phrase="Please hold while your party is being contacted." filename="ivr-please_hold_while_party_contacted.wav"/> <prompt phrase="Please enjoy the music while your party is being reached." filename="ivr-please_enjoy_music_while_party_reached.wav"/> - <prompt phrase="For the next entry..." filename="dir-for_next.wav" note="re-record because original is wrong"/> <prompt phrase="Thank you for calling. If you know your party's extension, please enter it now, or dial nine for a directory." filename="ivr-generic_greeting.wav"/> <prompt phrase="If this is correct, press 1. If not, press 2." filename="ivr-if_correct_one_if_not_two.wav"/> <prompt phrase="To repeat this information..." filename="ivr-repeat_this_information.wav"/> @@ -409,10 +411,7 @@ <prompt phrase="That's it! One more mistake and I WILL hang up on your ass." filename="ivr-one_more_mistake.wav"/> <prompt phrase="Congratulations, you pressed star. This does not mean you ARE a star. It simply means that you can press buttons and probably have fingers." filename="ivr-congratulations_you_pressed_star.wav"/> <prompt phrase="All of our engineers are busy assisting other sales guys with demonstrating how cool the CudaTel is." filename="ivr-engineers_busy_assisting_other_sales.wav"/> - <prompt phrase="The person you are trying to reach is not available and does not have voicemail." filename="vm-not_available_no_voicemail.wav"/> <prompt phrase="This message will self-destruct in 5, 4, 3, 2, 1..." filename="ivr-message_self_destruct.wav"/> - <prompt phrase="You are already muted." filename="conf-you_are_already_muted.wav"/> - <prompt phrase="You are now bi-directionally muted." filename="conf-you_are_now_bidirectionally_muted.wav"/> <prompt phrase="All your call are belong to us." filename="ivr-all_your_call_are_belong_to_us.wav"/> <prompt phrase="I just love the way you press those touch tones!" filename="ivr-love_those_touch_tones.wav"/> <prompt phrase="Yes, we have no bananas." filename="ivr-yes_we_have_no_bananas.wav"/> @@ -425,20 +424,10 @@ <prompt phrase="Please contact the system administrator for assistance." filename="ivr-contact_system_administrator.wav"/> <prompt phrase="Barracuda Networks" filename="ivr-barracuda_networks.wav"/> <prompt phrase="CudaTel Communication Server" filename="ivr-cudatel_communication_server.wav"/> - <prompt phrase="Please enter the first few letters of the person's first or last name" filename="dir-enter_person_first_or_last.wav"/> <prompt phrase="There are no calls waiting in this queue." filename="ivr-no_calls_waiting_in_queue.wav"/> - <prompt phrase="Brian West" filename="misc-Brian_West.wav"/> - <prompt phrase="Anthony Minessale" filename="misc-Anthony_Minessale.wav"/> - <prompt phrase="Michael Jerris" filename="misc-Michael_Jerris.wav"/> - <prompt phrase="Raymond Chandler" filename="misc-Raymond_Chandler.wav"/> - <prompt phrase="Michael Collins" filename="misc-Michael_Collins.wav"/> - <prompt phrase="Mark Mann" filename="misc-Mark_Mann.wav"/> - <prompt phrase="William King" filename="misc-William_King.wav"/> - <prompt phrase="Rudy Fleminger" filename="misc-Rudy_Fleminger.wav"/> - <prompt phrase="Andrew Thompson" filename="misc-Andrew_Thompson.wav"/> - <prompt phrase="Graham Saathoff" filename="misc-Graham_Saathoff.wav"/> - <prompt phrase="Nicholaus Belluni" filename="misc-Nicholaus_Belluni.wav"/> - <prompt phrase="Sean Heiney" filename="misc-Sean_Heiney.wav"/> + + <!-- The following phrases still need to be recorded --> + <prompt phrase="You are caller number one. Of course, *every* caller is number one in our book so you may be waiting a while." filename="ivr-youre_number_one.wav"/> </ivr> <misc> <prompt phrase="This call has been secured" filename="call_secured.wav"/> commit 6e2f07f1e63a3bba9721ccaebf2a4d03e02edc9b Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Dec 17 16:19:56 2010 -0600 hide debug line diff --git a/libs/stfu/stfu.c b/libs/stfu/stfu.c index 2ffb86f..b7df8ea 100644 --- a/libs/stfu/stfu.c +++ b/libs/stfu/stfu.c @@ -413,7 +413,9 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void if (i->last_wr_ts) { if ((ts <= i->last_wr_ts && (i->last_wr_ts != UINT_MAX || ts == i->last_wr_ts))) { - stfu_log(STFU_LOG_EMERG, "%s TOO LATE !!! %u \n\n\n", i->name, ts); + if (stfu_log != null_logger && i->debug) { + stfu_log(STFU_LOG_EMERG, "%s TOO LATE !!! %u \n\n\n", i->name, ts); + } if (i->in_queue->array_len < i->in_queue->array_size) { i->in_queue->array_len++; } commit 9fd1c71b4bcd2f9bc0038fa576dc89688ecba9f3 Merge: 764b990 6b52208 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Fri Dec 17 20:18:11 2010 -0200 Merge branch 'arnaldo.sigstatus' commit ee562c82e1e3e321c2ece3b5970114a31b693f33 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Dec 17 16:06:11 2010 -0600 FS-2879 diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 3943ac6..f275363 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -3075,16 +3075,24 @@ SWITCH_STANDARD_APP(fifo_function) done: switch_mutex_lock(globals.mutex); - if (node && node->ready == FIFO_DELAY_DESTROY && node->consumer_count == 0 && node_caller_count(node) == 0) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "%s removed.\n", node->name); - switch_core_hash_delete(globals.fifo_hash, node->name); + if (node && node->ready == FIFO_DELAY_DESTROY) { + int doit = 0; + switch_thread_rwlock_wrlock(node->rwlock); - node->ready = 0; - switch_mutex_lock(node->mutex); - switch_core_hash_destroy(&node->consumer_hash); - switch_mutex_unlock(node->mutex); + doit = node->consumer_count == 0 && node_caller_count(node) == 0; switch_thread_rwlock_unlock(node->rwlock); - switch_core_destroy_memory_pool(&node->pool); + + if (doit) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "%s removed.\n", node->name); + switch_core_hash_delete(globals.fifo_hash, node->name); + + node->ready = 0; + switch_mutex_lock(node->mutex); + switch_core_hash_destroy(&node->consumer_hash); + switch_mutex_unlock(node->mutex); + switch_thread_rwlock_unlock(node->rwlock); + switch_core_destroy_memory_pool(&node->pool); + } } switch_mutex_unlock(globals.mutex); commit 1e0df408cfb343599e30df7ed41137431cdf4a51 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Dec 17 15:28:19 2010 -0600 oops diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 884e5bf..07e125a 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -4065,8 +4065,6 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session switch_channel_set_variable(nchannel, "sip_invite_params", "intercom=true"); } - DUMP_EVENT(var_event); - if (((hval = switch_event_get_header(var_event, "effective_callee_id_name")) || (hval = switch_event_get_header(var_event, "sip_callee_id_name"))) && !zstr(hval)) { caller_profile->callee_id_name = switch_core_strdup(caller_profile->pool, hval); commit 8f452bc5199c6964518f9b505fa904493b3814e9 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Dec 17 14:35:53 2010 -0600 cid logic changes for calle[re] diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index d6bce5e..e726554 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -312,6 +312,8 @@ SWITCH_DECLARE(switch_status_t) switch_channel_caller_extension_masquerade(switc */ SWITCH_DECLARE(void) switch_channel_set_caller_extension(switch_channel_t *channel, switch_caller_extension_t *caller_extension); +SWITCH_DECLARE(void) switch_channel_sort_cid(switch_channel_t *channel, switch_bool_t in); + /*! \brief Retrieve caller extension from a given channel \param channel channel to retrieve extension from diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 07e125a..884e5bf 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -4065,6 +4065,8 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session switch_channel_set_variable(nchannel, "sip_invite_params", "intercom=true"); } + DUMP_EVENT(var_event); + if (((hval = switch_event_get_header(var_event, "effective_callee_id_name")) || (hval = switch_event_get_header(var_event, "sip_callee_id_name"))) && !zstr(hval)) { caller_profile->callee_id_name = switch_core_strdup(caller_profile->pool, hval); diff --git a/src/switch_channel.c b/src/switch_channel.c index ef21e8c..aa7f669 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2382,12 +2382,48 @@ SWITCH_DECLARE(switch_status_t) switch_channel_caller_extension_masquerade(switc return status; } +SWITCH_DECLARE(void) switch_channel_sort_cid(switch_channel_t *channel, switch_bool_t in) +{ + + if (in) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND && !switch_channel_test_flag(channel, CF_DIALPLAN)) { + switch_channel_set_flag(channel, CF_DIALPLAN); + + switch_mutex_lock(channel->profile_mutex); + if (channel->caller_profile->callee_id_name) { + switch_channel_set_variable(channel, "pre_transfer_caller_id_name", channel->caller_profile->caller_id_name); + channel->caller_profile->caller_id_name = switch_core_strdup(channel->caller_profile->pool, channel->caller_profile->callee_id_name); + } + channel->caller_profile->callee_id_name = SWITCH_BLANK_STRING; + + if (channel->caller_profile->callee_id_number) { + switch_channel_set_variable(channel, "pre_transfer_caller_id_number", channel->caller_profile->caller_id_number); + channel->caller_profile->caller_id_number = switch_core_strdup(channel->caller_profile->pool, channel->caller_profile->callee_id_number); + } + channel->caller_profile->callee_id_number = SWITCH_BLANK_STRING; + switch_mutex_unlock(channel->profile_mutex); + } + + return; + } + + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND && switch_channel_test_flag(channel, CF_DIALPLAN)) { + switch_channel_clear_flag(channel, CF_DIALPLAN); + switch_mutex_lock(channel->profile_mutex); + channel->caller_profile->callee_id_name = SWITCH_BLANK_STRING; + channel->caller_profile->callee_id_number = SWITCH_BLANK_STRING; + switch_mutex_unlock(channel->profile_mutex); + } + +} + + SWITCH_DECLARE(void) switch_channel_set_caller_extension(switch_channel_t *channel, switch_caller_extension_t *caller_extension) { switch_assert(channel != NULL); - switch_channel_set_flag(channel, CF_DIALPLAN); - + switch_channel_sort_cid(channel, SWITCH_TRUE); + switch_mutex_lock(channel->profile_mutex); caller_extension->next = channel->caller_profile->caller_extension; channel->caller_profile->caller_extension = caller_extension; diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 494871e..cd74c33 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -1544,21 +1544,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_ new_profile->destination_number = switch_core_strdup(new_profile->pool, extension); new_profile->rdnis = switch_core_strdup(new_profile->pool, profile->destination_number); - if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { - if (profile->callee_id_name) { - switch_channel_set_variable(channel, "pre_transfer_caller_id_name", new_profile->caller_id_name); - new_profile->caller_id_name = switch_core_strdup(new_profile->pool, profile->callee_id_name); - profile->callee_id_name = SWITCH_BLANK_STRING; - } - - if (profile->callee_id_number) { - switch_channel_set_variable(channel, "pre_transfer_caller_id_number", new_profile->caller_id_number); - new_profile->caller_id_number = switch_core_strdup(new_profile->pool, profile->callee_id_number); - profile->callee_id_number = SWITCH_BLANK_STRING; - } - } - - switch_channel_set_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE, NULL); /* If HANGUP_AFTER_BRIDGE is set to 'true', SWITCH_SIGNAL_BRIDGE_VARIABLE diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index aa5ddb9..2f2dcdb 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -1052,6 +1052,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_signal_bridge(switch_core_session_t * switch_channel_set_variable(caller_channel, "signal_bridge", "true"); switch_channel_set_variable(peer_channel, "signal_bridge", "true"); + switch_channel_sort_cid(peer_channel, SWITCH_FALSE); + /* fire events that will change the data table from "show channels" */ if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(caller_channel, event); @@ -1117,6 +1119,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses switch_channel_set_flag_recursive(caller_channel, CF_BRIDGE_ORIGINATOR); switch_channel_clear_flag(peer_channel, CF_BRIDGE_ORIGINATOR); + switch_channel_sort_cid(peer_channel, SWITCH_FALSE); + b_leg->session = peer_session; switch_copy_string(b_leg->b_uuid, switch_core_session_get_uuid(session), sizeof(b_leg->b_uuid)); b_leg->stream_id = stream_id; diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index b6ae346..87a47e6 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -2383,24 +2383,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess new_profile->chan_name = SWITCH_BLANK_STRING; new_profile->destination_number = switch_core_strdup(new_profile->pool, chan_data); - if (switch_channel_direction(caller_channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { - const char *callee_id_name = new_profile->callee_id_name; - const char *callee_id_number = new_profile->callee_id_number; - - if (zstr(callee_id_number)) { - callee_id_number = caller_caller_profile->destination_number; - } - - if (zstr(callee_id_name)) { - callee_id_name = callee_id_number; - } - - new_profile->caller_id_name = callee_id_name; - new_profile->caller_id_number = callee_id_number; - new_profile->callee_id_name = SWITCH_BLANK_STRING; - new_profile->callee_id_number = SWITCH_BLANK_STRING; - } - if (cid_name_override) { new_profile->caller_id_name = switch_core_strdup(new_profile->pool, cid_name_override); } commit 6b522089574944f85c94825f3b0bbc3ebfe8a715 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Fri Dec 17 18:28:57 2010 -0200 freetdm: core - moved validation of sigstatus from implementation to core, on sigstatus getters/setters core - locking the channel on ftdm_channel_get_sig_status() and ftdm_channel_set_sig_status(), but not on ftdm_span_get_sig_status() nor ftdm_span_set_sig_status() ftmod_r2 - locking channels on ftdm_r2_get_span_sig_status() and ftdm_r2_set_span_sig_status() diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 1750d6d..7fb5afd 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2488,9 +2488,18 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_set_sig_status(ftdm_channel_t *ftdmchan, { ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "Null channel\n"); ftdm_assert_return(ftdmchan->span != NULL, FTDM_FAIL, "Null span\n"); - + + if (sigstatus == FTDM_SIG_STATE_DOWN) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "The user is not allowed to set the signaling status to DOWN, valid states are UP or SUSPENDED\n"); + return FTDM_FAIL; + } + if (ftdmchan->span->set_channel_sig_status) { - return ftdmchan->span->set_channel_sig_status(ftdmchan, sigstatus); + ftdm_status_t res; + ftdm_channel_lock(ftdmchan); + res = ftdmchan->span->set_channel_sig_status(ftdmchan, sigstatus); + ftdm_channel_unlock(ftdmchan); + return res; } else { ftdm_log(FTDM_LOG_ERROR, "set_channel_sig_status method not implemented!\n"); return FTDM_FAIL; @@ -2504,7 +2513,11 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_get_sig_status(ftdm_channel_t *ftdmchan, ftdm_assert_return(sigstatus != NULL, FTDM_FAIL, "Null sig status parameter\n"); if (ftdmchan->span->get_channel_sig_status) { - return ftdmchan->span->get_channel_sig_status(ftdmchan, sigstatus); + ftdm_status_t res; + ftdm_channel_lock(ftdmchan); + res = ftdmchan->span->get_channel_sig_status(ftdmchan, sigstatus); + ftdm_channel_unlock(ftdmchan); + return res; } else { /* don't log error here, it can be called just to test if its supported */ return FTDM_NOTIMPL; @@ -2515,6 +2528,11 @@ FT_DECLARE(ftdm_status_t) ftdm_span_set_sig_status(ftdm_span_t *span, ftdm_signa { ftdm_assert_return(span != NULL, FTDM_FAIL, "Null span\n"); + if (sigstatus == FTDM_SIG_STATE_DOWN) { + ftdm_log(FTDM_LOG_WARNING, "The user is not allowed to set the signaling status to DOWN, valid states are UP or SUSPENDED\n"); + return FTDM_FAIL; + } + if (span->set_span_sig_status) { return span->set_span_sig_status(span, sigstatus); } else { diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 5377250..ccf7fdf 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -486,9 +486,6 @@ static FIO_CHANNEL_SET_SIG_STATUS_FUNCTION(ftdm_r2_set_channel_sig_status) ftdm_r2_set_chan_sig_status(ftdmchan, status); } break; - case FTDM_SIG_STATE_DOWN: - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "The user is not allowed to set signaling status to DOWN\n"); - return FTDM_FAIL; default: ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Cannot set signaling status to unknown value '%d'\n", status); return FTDM_FAIL; @@ -508,10 +505,13 @@ static FIO_SPAN_GET_SIG_STATUS_FUNCTION(ftdm_r2_get_span_sig_status) *status = FTDM_SIG_STATE_SUSPENDED; for (citer = chaniter; citer; citer = ftdm_iterator_next(citer)) { ftdm_channel_t *fchan = ftdm_iterator_current(citer); + ftdm_channel_lock(fchan); if (ftdm_test_flag(fchan, FTDM_CHANNEL_SIG_UP)) { *status = FTDM_SIG_STATE_UP; + ftdm_channel_unlock(fchan); break; } + ftdm_channel_unlock(fchan); } ftdm_iterator_free(chaniter); return FTDM_SUCCESS; @@ -522,11 +522,6 @@ static FIO_SPAN_SET_SIG_STATUS_FUNCTION(ftdm_r2_set_span_sig_status) ftdm_iterator_t *chaniter = NULL; ftdm_iterator_t *citer = NULL; - if (status == FTDM_SIG_STATE_DOWN) { - ftdm_log(FTDM_LOG_WARNING, "The user is not allowed to set the span signaling status to DOWN\n"); - return FTDM_FAIL; - } - chaniter = ftdm_span_get_chan_iterator(span, NULL); if (!chaniter) { ftdm_log(FTDM_LOG_CRIT, "Failed to allocate channel iterator for span %s!\n", span->name); @@ -537,9 +532,11 @@ static FIO_SPAN_SET_SIG_STATUS_FUNCTION(ftdm_r2_set_span_sig_status) ftdm_channel_t *fchan = ftdm_iterator_current(citer); /* we set channel's state through ftdm_r2_set_channel_sig_status(), since it already takes * care of notifying the user when appropriate */ + ftdm_channel_lock(fchan); if ((ftdm_r2_set_channel_sig_status(fchan, status)) != FTDM_SUCCESS) { ftdm_log_chan(fchan, FTDM_LOG_ERROR, "Failed to set signaling status to %s\n", ftdm_signaling_status2str(status)); } + ftdm_channel_unlock(fchan); } ftdm_iterator_free(chaniter); return FTDM_SUCCESS; commit bad1eb118358e0b814cde075388c4e342992e4bf Author: Michael S Collins <msc@freeswitch.org> Date: Fri Dec 17 12:19:14 2010 -0800 Update ChangeLog through Dec 16, 2010 diff --git a/docs/ChangeLog b/docs/ChangeLog index 96066b6..0ca48c0 100644 --- a/docs/ChangeLog +++ b/docs/ChangeLog @@ -20,6 +20,7 @@ freeswitch (1.0.7) build: Remove mod_spidermonkey from windows 2008 x64 builds - does not work (r:280e894d) build: fix warnings on windows x64 builds src and mods projects - only libsofia included on the libs side (r:45ecbc2f) build: Patch debian init.d script to set ulimit values (r:0eb33e57/FS-2844) + build: add plc to core (r:b7c80a84) codec2: working prototype, still for testing only (r:04ca0751) config: move limit.conf to db.conf config: Update VM phrase macros to voice option then action on main, config menus @@ -33,6 +34,7 @@ freeswitch (1.0.7) config: Fix phrase files, still missing a sound file (r:6741f350/FS-2742) config: Disallow global-intercept and group-intercept can intercept an outbound call in default dialplan (r:890871ba/FS-2777) config: fix single domain assumption in default config to be more portable *cough* bkw *cough* (r:f987903e) + config: Bump Doxygen.conf version to 1.0.6... belatedly (r:cfeae1ba) core: Add RTCP support (FSRTP-14) core: handle some errors on missing db handle conditions core: add ... and shutdown as a fail-safe when no modules are loaded @@ -145,6 +147,15 @@ freeswitch (1.0.7) core: Application intercept causes FS to stop processing calls (r:12fc65f7/FS-2872) core: fix edge cases for endless loop in sql thread (r:5d7c09ed) core: prevent race while changing codecs mid call (r:7aa72b67) + core: Fix crash in ODBC when SQL Server kills TCP connection (r:5aba96e3/FS-2910) + core: Fix fallback to CORE_DB when MSSQL fails init (r:3406d05b) + core: add new function to init an empty switch_sockaddr_t to avoid an unnecessary dns lookup on 0.0.0.0 (r:009c41d4) + core: fix endless RTP loop in Windows (r:cb2d0736/FS-2924) + core: play_and_get_digits should actually timeout, not last forever... (r:28cab5ed/FS-2923) + core: Fix crash w/o core dump (r:00046ee0/FS-2933) + core: normalize tests for outbound channels to use switch_channel_direction instead of testing for CF_OUTBOUND (r:93cc3dc5) + core: add CF_DIALPLAN (r:3ff07445) + core: tweak on calle[re] id (r:9db4a826) lang: Improve French phrase files (FSCONFIG-23) libapr: Fix issue where after a bridge with a member, uuid of Agent is set to single quote character ' (r:3fee704d/FS-2738) libdingaling: fix race on shutdown causing crash (FSMOD-47) @@ -163,6 +174,8 @@ freeswitch (1.0.7) libesl: fix leak-on-error in esl_connect_timeout() (r:4263d60e) libesl: Call close on connection handle if the connection fails (r:413dcc4c/ESL-50) libesl: allow fs_cli -x to have args up to 1024 chars (was 256) (r:7039ba47) + libesl: Make last_event pointer last longer (r:a15f51d5/ESL-37) + libesl: use a packet buffer for ESL (r:2081bf97) libfreetdm: implemented freetdm config nodes and ss7 initial configuration libfreetdm: fix codec for CAS signaling (r:b76e7f18) libfreetdm: freetdm: ss7- added support for incoming group blocks, started adding support for ansi (r:c219a73c) @@ -220,6 +233,8 @@ freeswitch (1.0.7) mod_commands: add escaping empty strings to sql_escape (r:7bd0a5a6/FS-2833) mod_commands: add uuid_fileman <uuid> <cmd>:<val> <-- same vals as the callbacks in js and lua to control the currently playing file of a channel from the cli or ESL (for the people who were ignoring me on the conference call so I decided to implement it instead of try to explain it ) (r:c4369fc8) mod_commands: FS-2210 Add support for auto completion for uuid_simplify (r:72bcc01b/FS-2210) + mod_commands: allow epoch in strftime_tz (r:bbf1cd1f) + mod_commands: Dramatic jitterbuffer changes (r:d5470961) mod_conference: Fix reporting of volume up/down (MODAPP-419) mod_conference: add last talking time per member to conference xml list mod_conference: add terminate-on-silence conference param @@ -229,6 +244,7 @@ freeswitch (1.0.7) mod_conference: Fix floor change events not always firing (r:8f1767d3/MODAPP-424) mod_conference: refactor conference to use switch_ivr_dmachine for the digit parsing controls are now bound to each member separately based on conference_controls channel var, then the caller-controls param in the profile or a default to "default" (r:ac19f73c) mod_conference: Fix crash on dtmf action (r:4d5389bd/FS-2781) + mod_conference: revert to the last transfered conference on recover (r:d11c83b1) mod_curl: use method=post when post requested (r:c6a4ddd0/FSMOD-69) mod_db: fix stack corruption (MODAPP-407) mod_dialplan_xml: Add in the INFO log the caller id number when processing a request (Currenly only show the caller name) (r:e1df5e13) @@ -500,6 +516,11 @@ freeswitch (1.0.7) mod_sofia: Fix wrong IP in VIA and contact HEADER for MESSAGE method while fs run in private network (r:59ea4a1b/FS-2886) mod_sofia: SIP-header History-Info might exist multiple times, but only last header is exposed as a channel variable (r:8cf15012/FS-2881) mod_sofia: Add support to reboot Yealink phone remotely (r:fdc31908/FS-2897) + mod_sofia: Add reuse-connections sofia profile param to allow users to turn off TPTAG_REUSE, thus not re-using TCP connections (r:98ed05cc) + mod_sofia: Make sofia recover also work on custom uuid (r:3a645dee/FS-2913) + mod_sofia: remove check for va_list completely in sofia since i don't even think it happens ever (r:dfecc914) + mod_sofia: have mod_sofia always elect to be the session refresher so we know it will work, also make the session-expires set to 0 imply 100% disabled session timers (r:321013ef) + mod_sofia: Do not set nat mode when the device's network_ip is within the acl also so if your FS is behind nat and your phone is too then it will still make the right decisions (r:6c6eab8c) mod_spandsp: initial checkin of mod_fax/mod_voipcodecs merge into mod_spandsp (r:fa9a59a8) mod_spandsp: rework of new mod_spandsp to have functions broken up into different c files (r:65400642) mod_spandsp: improve duplicate digit detection and add 'min_dup_digit_spacing_ms' channel variable for use with the dtmf detector (r:eab4f246/FSMOD-45) @@ -515,6 +536,7 @@ freeswitch (1.0.7) mod_spidermonkey: fix seg in js hangup (r:7d554c11) mod_spidermonkey: Fix mod_spidermonkey build on FreeBSD, (Undefined symbol PR_LocalTimeParameters). (r:3edb8419) mod_spy: add support for loopback endpoint (MODAPP-416) + mod_spy: fix crash when session can't be located (r:c4154633/FS-2929) mod_tts_commandline: fix core dump, temp file problem. flush can be called several times (FSMOD-35) mod_unimrcp: fix fortify findings for mod_unimrcp (r:336f0b4e/FSMOD-67) mod_valet_parking: add event data to valet parking hold event commit 764b990849af53e9122bb513ce775df4c270eb14 Merge: 11642cc c2262ab Author: Moises Silva <moy@sangoma.com> Date: Fri Dec 17 13:03:15 2010 -0500 Merge remote branch 'fsorig/master' commit 27ea959b4b3418cea08594ff2e31e9ae6ad10e09 Author: Moises Silva <moy@sangoma.com> Date: Fri Dec 17 12:57:12 2010 -0500 freetdm: add __USE_BSD to ftdm_os, needed by unistd.h for usleep() and string.h to define strcasecmp() add -Werror even when the compiler is unknown. This is just a work-around to gcc not being detected ad GNU by our current standalone build (not bootstrapped through FreeSWITCH) diff --git a/libs/freetdm/Makefile.am b/libs/freetdm/Makefile.am index af26f7f..5e804b7 100644 --- a/libs/freetdm/Makefile.am +++ b/libs/freetdm/Makefile.am @@ -49,6 +49,7 @@ if HAVE_SNG_ISDN INCS += -I/usr/include/sng_isdn endif +# we needed to separate CFLAGS in FTDM_COMPAT_CFLAGS and FTDM_CFLAGS due to -c99 which causes problems with wanpipe headers FTDM_COMPAT_CFLAGS = $(INCS) -DFTDM_CONFIG_DIR=\"@confdir@\" -DFTDM_MOD_DIR=\"$(moddir)\" @COMP_VENDOR_COMPAT_CFLAGS@ @DEFS@ FTDM_CFLAGS = $(INCS) -DFTDM_CONFIG_DIR=\"@confdir@\" -DFTDM_MOD_DIR=\"$(moddir)\" @COMP_VENDOR_CFLAGS@ @DEFS@ COMPILE = $(CC) $(FTDM_CFLAGS) @@ -183,8 +184,8 @@ ftmod_analog_em_la_LIBADD = libfreetdm.la if HAVE_LIBSANGOMA mod_LTLIBRARIES += ftmod_wanpipe.la ftmod_wanpipe_la_SOURCES = $(SRC)/ftmod/ftmod_wanpipe/ftmod_wanpipe.c -#some structures within Wanpipe drivers are not c99 compatible, so we need to compile ftmod_wanpipe -#without c99 flags +# some structures within Wanpipe drivers are not c99 compatible, so we need to compile ftmod_wanpipe +# without c99 flags, use FTDM_COMPAT_CFLAGS instead ftmod_wanpipe_la_CFLAGS = $(AM_CFLAGS) $(FTDM_COMPAT_CFLAGS) -D__LINUX__ -I/usr/include/wanpipe ftmod_wanpipe_la_LDFLAGS = -shared -module -avoid-version -lsangoma ftmod_wanpipe_la_LIBADD = libfreetdm.la diff --git a/libs/freetdm/configure.ac b/libs/freetdm/configure.ac index 592dfd8..e26f10b 100644 --- a/libs/freetdm/configure.ac +++ b/libs/freetdm/configure.ac @@ -82,7 +82,7 @@ sun) fi ;; *) - COMP_VENDOR_COMPAT_CFLAGS="-Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes" + COMP_VENDOR_COMPAT_CFLAGS="-Wall -Werror -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes" COMP_VENDOR_CFLAGS="-std=c99 $COMP_VENDOR_COMPAT_CFLAGS" ;; esac diff --git a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c index 7320934..211bf71 100644 --- a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c +++ b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c @@ -31,7 +31,6 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include "private/ftdm_core.h" #include "ftmod_zt.h" diff --git a/libs/freetdm/src/include/ftdm_os.h b/libs/freetdm/src/include/ftdm_os.h index 5026bb7..f3ebee9 100644 --- a/libs/freetdm/src/include/ftdm_os.h +++ b/libs/freetdm/src/include/ftdm_os.h @@ -39,9 +39,12 @@ extern "C" { #endif +#if defined(__linux__) && !defined(__USE_BSD) +#define __USE_BSD +#endif + #include "ftdm_declare.h" #include "ftdm_threadmutex.h" - #include <string.h> #ifndef __WINDOWS__ diff --git a/libs/freetdm/src/testsangomaboost.c b/libs/freetdm/src/testsangomaboost.c index 529dbbe..b007fc1 100644 --- a/libs/freetdm/src/testsangomaboost.c +++ b/libs/freetdm/src/testsangomaboost.c @@ -49,12 +49,6 @@ #include <string.h> #include <errno.h> -#if defined(__linux__) && !defined(__USE_BSD) -#define __USE_BSD -#endif -#ifndef WIN32 -#include <unistd.h> -#endif #include "freetdm.h" commit d3a24be0baa8a98eabacef7b0ee7b3d088ada316 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Fri Dec 17 15:50:11 2010 -0200 freetdm: ftmod_r2 - updated ftdm_r2_set_channel_sig_status() to notify the user of signaling changes just when specified on docs/sigstatus.txt. also updated ftdm_r2_set_span_sig_status(), so that it uses the former to set channels status, instead of doing it directly. diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 14eca42..5377250 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -456,19 +456,43 @@ static FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(ftdm_r2_get_channel_sig_status) static FIO_CHANNEL_SET_SIG_STATUS_FUNCTION(ftdm_r2_set_channel_sig_status) { openr2_chan_t *r2chan = R2CALL(ftdmchan)->r2chan; + openr2_cas_signal_t rxcas, txcas; + + /* get the current rx and tx cas bits */ + openr2_chan_get_cas(r2chan, &rxcas, &txcas); + + /* if we're already in the state the user asks us to be, we have nothing to do */ + if (status == FTDM_SIG_STATE_SUSPENDED && txcas == OR2_CAS_BLOCK) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Channel signaling status already in BLOCK state\n"); + return FTDM_SUCCESS; + } + if (status == FTDM_SIG_STATE_UP && txcas == OR2_CAS_IDLE) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Channel signaling status already in IDLE state\n"); + return FTDM_SUCCESS; + } + + /* set the signaling as requested and send SIGEVENT_SIGSTATUS_CHANGED, if applicable. + * see docs/sigstatus.txt for details */ switch(status) { - case FTDM_SIG_STATE_DOWN: case FTDM_SIG_STATE_SUSPENDED: openr2_chan_set_blocked(r2chan); + if (rxcas == OR2_CAS_IDLE) { + ftdm_r2_set_chan_sig_status(ftdmchan, status); + } break; case FTDM_SIG_STATE_UP: openr2_chan_set_idle(r2chan); + if (rxcas == OR2_CAS_IDLE) { + ftdm_r2_set_chan_sig_status(ftdmchan, status); + } break; + case FTDM_SIG_STATE_DOWN: + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "The user is not allowed to set signaling status to DOWN\n"); + return FTDM_FAIL; default: ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Cannot set signaling status to unknown value '%d'\n", status); return FTDM_FAIL; } - ftdm_r2_set_chan_sig_status(ftdmchan, status); return FTDM_SUCCESS; } @@ -497,20 +521,10 @@ static FIO_SPAN_SET_SIG_STATUS_FUNCTION(ftdm_r2_set_span_sig_status) { ftdm_iterator_t *chaniter = NULL; ftdm_iterator_t *citer = NULL; - uint32_t span_opr = -1; - /* we either set the channels to BLOCK or IDLE */ - switch(status) { - case FTDM_SIG_STATE_DOWN: - case FTDM_SIG_STATE_SUSPENDED: - span_opr = 0; - break; - case FTDM_SIG_STATE_UP: - span_opr = 1; - break; - default: - ftdm_log(FTDM_LOG_WARNING, "Cannot set signaling status to unknown value '%d'\n", status); - return FTDM_FAIL; + if (status == FTDM_SIG_STATE_DOWN) { + ftdm_log(FTDM_LOG_WARNING, "The user is not allowed to set the span signaling status to DOWN\n"); + return FTDM_FAIL; } chaniter = ftdm_span_get_chan_iterator(span, NULL); @@ -521,15 +535,11 @@ static FIO_SPAN_SET_SIG_STATUS_FUNCTION(ftdm_r2_set_span_sig_status) /* iterate over all channels, setting them to the requested state */ for (citer = chaniter; citer; citer = ftdm_iterator_next(citer)) { ftdm_channel_t *fchan = ftdm_iterator_current(citer); - openr2_chan_t *r2chan = R2CALL(fchan)->r2chan; - if (span_opr == 0) { - openr2_chan_set_blocked(r2chan); - ftdm_log_chan_msg(fchan, FTDM_LOG_NOTICE, "Channel blocked\n"); - } else { - openr2_chan_set_idle(r2chan); - ftdm_log_chan_msg(fchan, FTDM_LOG_NOTICE, "Channel idle\n"); + /* we set channel's state through ftdm_r2_set_channel_sig_status(), since it already takes + * care of notifying the user when appropriate */ + if ((ftdm_r2_set_channel_sig_status(fchan, status)) != FTDM_SUCCESS) { + ftdm_log_chan(fchan, FTDM_LOG_ERROR, "Failed to set signaling status to %s\n", ftdm_signaling_status2str(status)); } - ftdm_r2_set_chan_sig_status(fchan, status); } ftdm_iterator_free(chaniter); return FTDM_SUCCESS; commit c2262aba2be55a9df2a14be5560ac0227516cd49 Author: Moises Silva <moy@sangoma.com> Date: Fri Dec 17 09:52:26 2010 -0500 freetdm: Fix for OPENZAP-128 ioctl interface in FreeBSD expects unsigned long diff --git a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c index 7320934..f401964 100644 --- a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c +++ b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c @@ -53,42 +53,48 @@ static struct { float txgain; } zt_globals; +#if defined(__FreeBSD__) +typedef unsigned long ioctlcmd; +#else +typedef int ioctlcmd; +#endif + /** * \brief General IOCTL codes */ struct ioctl_codes { - int GET_BLOCKSIZE; - int SET_BLOCKSIZE; - int FLUSH; - int SYNC; - int GET_PARAMS; - int SET_PARAMS; - int HOOK; - int GETEVENT; - int IOMUX; - int SPANSTAT; - int MAINT; - int GETCONF; - int SETCONF; - int CONFLINK; - int CONFDIAG; - int GETGAINS; - int SETGAINS; - int SPANCONFIG; - int CHANCONFIG; - int SET_BUFINFO; - int GET_BUFINFO; - int AUDIOMODE; - int ECHOCANCEL; - int HDLCRAWMODE; - int HDLCFCSMODE; - int SPECIFY; - int SETLAW; - int SETLINEAR; - int GETCONFMUTE; - int ECHOTRAIN; - int SETTXBITS; - int GETRXBITS; + ioctlcmd GET_BLOCKSIZE; + ioctlcmd SET_BLOCKSIZE; + ioctlcmd FLUSH; + ioctlcmd SYNC; + ioctlcmd GET_PARAMS; + ioctlcmd SET_PARAMS; + ioctlcmd HOOK; + ioctlcmd GETEVENT; + ioctlcmd IOMUX; + ioctlcmd SPANSTAT; + ioctlcmd MAINT; + ioctlcmd GETCONF; + ioctlcmd SETCONF; + ioctlcmd CONFLINK; + ioctlcmd CONFDIAG; + ioctlcmd GETGAINS; + ioctlcmd SETGAINS; + ioctlcmd SPANCONFIG; + ioctlcmd CHANCONFIG; + ioctlcmd SET_BUFINFO; + ioctlcmd GET_BUFINFO; + ioctlcmd AUDIOMODE; + ioctlcmd ECHOCANCEL; + ioctlcmd HDLCRAWMODE; + ioctlcmd HDLCFCSMODE; + ioctlcmd SPECIFY; + ioctlcmd SETLAW; + ioctlcmd SETLINEAR; + ioctlcmd GETCONFMUTE; + ioctlcmd ECHOTRAIN; + ioctlcmd SETTXBITS; + ioctlcmd GETRXBITS; }; /** commit 917879fe65e0c7e438ea352bb6b87725edbd75d5 Merge: 6e24e8e ae7279f Author: Moises Silva <moy@sangoma.com> Date: Fri Dec 17 09:45:48 2010 -0500 Merge branch 'master' of git.freeswitch.org:freeswitch commit ae7279f1741234e4c3209c7eec9e743791df1087 Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Fri Dec 17 08:44:20 2010 -0600 skypopen: added hrtimers support to OSS audio driver diff --git a/src/mod/endpoints/mod_skypopen/oss/main.c b/src/mod/endpoints/mod_skypopen/oss/main.c index 4fd959f..2abc5b3 100644 --- a/src/mod/endpoints/mod_skypopen/oss/main.c +++ b/src/mod/endpoints/mod_skypopen/oss/main.c @@ -60,15 +60,18 @@ MODULE_LICENSE("Dual BSD/GPL"); static struct skypopen_dev *skypopen_devices; /* allocated in skypopen_init_module */ -#define GIOVA_BLK 1920 -#define GIOVA_SLEEP 20 +static int unload = 0; +#ifdef CENTOS +#define HRTIMER_MODE_REL HRTIMER_REL +#endif// CENTOS +#ifndef WANT_HRTIMER void my_timer_callback_inq( unsigned long data ) { struct skypopen_dev *dev = (void *)data; wake_up_interruptible(&dev->inq); - mod_timer( &dev->timer_inq, jiffies + msecs_to_jiffies(GIOVA_SLEEP) ); + mod_timer( &dev->timer_inq, jiffies + msecs_to_jiffies(SKYPOPEN_SLEEP) ); } @@ -77,8 +80,66 @@ void my_timer_callback_outq( unsigned long data ) struct skypopen_dev *dev = (void *)data; wake_up_interruptible(&dev->outq); - mod_timer( &dev->timer_outq, jiffies + msecs_to_jiffies(GIOVA_SLEEP) ); + mod_timer( &dev->timer_outq, jiffies + msecs_to_jiffies(SKYPOPEN_SLEEP) ); } +#else// WANT_HRTIMER + +#ifndef CENTOS +static enum hrtimer_restart my_hrtimer_callback_inq( struct hrtimer *timer_inq ) +{ + struct skypopen_dev *dev = container_of(timer_inq, struct skypopen_dev, timer_inq); + ktime_t now; + + if(unload) + return HRTIMER_NORESTART; + + now = ktime_get(); + hrtimer_forward(&dev->timer_inq, now, ktime_set(0, SKYPOPEN_SLEEP * 1000000)); + wake_up_interruptible(&dev->inq); + + return HRTIMER_RESTART; +} +static enum hrtimer_restart my_hrtimer_callback_outq( struct hrtimer *timer_outq ) +{ + struct skypopen_dev *dev = container_of(timer_outq, struct skypopen_dev, timer_outq); + ktime_t now; + + if(unload) + return HRTIMER_NORESTART; + + now = ktime_get(); + hrtimer_forward(&dev->timer_outq, now, ktime_set(0, SKYPOPEN_SLEEP * 1000000)); + wake_up_interruptible(&dev->outq); + + return HRTIMER_RESTART; +} +#else// CENTOS +static int my_hrtimer_callback_inq( struct hrtimer *timer_inq ) +{ + struct skypopen_dev *dev = container_of(timer_inq, struct skypopen_dev, timer_inq); + + if(unload) + return HRTIMER_NORESTART; + + hrtimer_forward(&dev->timer_inq, timer_inq->expires, ktime_set(0, SKYPOPEN_SLEEP * 1000000)); + wake_up_interruptible(&dev->inq); + + return HRTIMER_RESTART; +} +static int my_hrtimer_callback_outq( struct hrtimer *timer_outq ) +{ + struct skypopen_dev *dev = container_of(timer_outq, struct skypopen_dev, timer_outq); + + if(unload) + return HRTIMER_NORESTART; + + hrtimer_forward(&dev->timer_outq, timer_outq->expires, ktime_set(0, SKYPOPEN_SLEEP * 1000000)); + wake_up_interruptible(&dev->outq); + + return HRTIMER_RESTART; +} +#endif// CENTOS +#endif// WANT_HRTIMER /* The clone-specific data structure includes a key field */ @@ -97,6 +158,12 @@ static spinlock_t skypopen_c_lock = SPIN_LOCK_UNLOCKED; static struct skypopen_dev *skypopen_c_lookfor_device(dev_t key) { struct skypopen_listitem *lptr; +#ifdef WANT_HRTIMER +#if 0 + ktime_t ktime_inq; + ktime_t ktime_outq; +#endif //0 +#endif// WANT_HRTIMER list_for_each_entry(lptr, &skypopen_c_list, list) { if (lptr->key == key) @@ -112,14 +179,29 @@ static struct skypopen_dev *skypopen_c_lookfor_device(dev_t key) memset(lptr, 0, sizeof(struct skypopen_listitem)); lptr->key = key; - init_waitqueue_head(&lptr->device.inq); - init_waitqueue_head(&lptr->device.outq); - setup_timer( &lptr->device.timer_inq, my_timer_callback_inq, (long int)lptr ); - setup_timer( &lptr->device.timer_outq, my_timer_callback_outq, (long int)lptr ); - printk( "Starting skypopen OSS driver read timer (%dms) skype client:(%d)\n", GIOVA_SLEEP, current->tgid ); - mod_timer( &lptr->device.timer_inq, jiffies + msecs_to_jiffies(GIOVA_SLEEP) ); - printk( "Starting skypopen OSS driver write timer (%dms) skype client:(%d)\n", GIOVA_SLEEP, current->tgid ); - mod_timer( &lptr->device.timer_outq, jiffies + msecs_to_jiffies(GIOVA_SLEEP) ); + init_waitqueue_head(&lptr->device.inq); + init_waitqueue_head(&lptr->device.outq); +#ifndef WANT_HRTIMER + setup_timer( &lptr->device.timer_inq, my_timer_callback_inq, (long int)lptr ); + setup_timer( &lptr->device.timer_outq, my_timer_callback_outq, (long int)lptr ); + printk( "Starting skypopen OSS driver read timer (%dms) skype client:(%d)\n", SKYPOPEN_SLEEP, current->tgid ); + mod_timer( &lptr->device.timer_inq, jiffies + msecs_to_jiffies(SKYPOPEN_SLEEP) ); + printk( "Starting skypopen OSS driver write timer (%dms) skype client:(%d)\n", SKYPOPEN_SLEEP, current->tgid ); + mod_timer( &lptr->device.timer_outq, jiffies + msecs_to_jiffies(SKYPOPEN_SLEEP) ); +#else// WANT_HRTIMER +#if 0 + ktime_inq = ktime_set( 0, SKYPOPEN_SLEEP * 1000000); + hrtimer_init( &lptr->device.timer_inq, CLOCK_MONOTONIC, HRTIMER_MODE_REL ); + lptr->device.timer_inq.function = &my_hrtimer_callback_inq; + hrtimer_start( &lptr->device.timer_inq, ktime_inq, HRTIMER_MODE_REL ); + + ktime_outq = ktime_set( 0, SKYPOPEN_SLEEP * 1000000); + hrtimer_init( &lptr->device.timer_outq, CLOCK_MONOTONIC, HRTIMER_MODE_REL ); + lptr->device.timer_outq.function = &my_hrtimer_callback_outq; + hrtimer_start( &lptr->device.timer_outq, ktime_outq, HRTIMER_MODE_REL ); +#endif + +#endif// WANT_HRTIMER /* place it in the list */ list_add(&lptr->list, &skypopen_c_list); @@ -135,7 +217,7 @@ static int skypopen_c_open(struct inode *inode, struct file *filp) struct skypopen_dev *dev; dev_t key; - key = current->pid; + key = current->tgid; /* look for a skypopenc device in the list */ spin_lock(&skypopen_c_lock); @@ -163,12 +245,27 @@ static int skypopen_c_release(struct inode *inode, struct file *filp) /*************************************************************/ -ssize_t skypopen_read(struct file *filp, char __user *buf, size_t count, +static ssize_t skypopen_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos) { - struct skypopen_dev *dev = filp->private_data; DEFINE_WAIT(wait); + struct skypopen_dev *dev = filp->private_data; +#ifdef WANT_HRTIMER +#if 1 + if(dev->timer_inq_started == 0){ + ktime_t ktime_inq; + + ktime_inq = ktime_set( 0, SKYPOPEN_SLEEP * 1000000); + hrtimer_init( &dev->timer_inq, CLOCK_MONOTONIC, HRTIMER_MODE_REL ); + dev->timer_inq.function = &my_hrtimer_callback_inq; + hrtimer_start( &dev->timer_inq, ktime_inq, HRTIMER_MODE_REL ); + dev->timer_inq_started = 1; + } +#endif +#endif// WANT_HRTIMER + + //printk("READ\n"); prepare_to_wait(&dev->inq, &wait, TASK_INTERRUPTIBLE); schedule(); finish_wait(&dev->inq, &wait); @@ -176,12 +273,27 @@ ssize_t skypopen_read(struct file *filp, char __user *buf, size_t count, } -ssize_t skypopen_write(struct file *filp, const char __user *buf, size_t count, +static ssize_t skypopen_write(struct file *filp, const char __user *buf, size_t count, loff_t *f_pos) { - struct skypopen_dev *dev = filp->private_data; DEFINE_WAIT(wait); + struct skypopen_dev *dev = filp->private_data; +#ifdef WANT_HRTIMER +#if 1 + if(dev->timer_outq_started == 0){ + ktime_t ktime_outq; + + ktime_outq = ktime_set( 0, SKYPOPEN_SLEEP * 1000000); + hrtimer_init( &dev->timer_outq, CLOCK_MONOTONIC, HRTIMER_MODE_REL ); + dev->timer_outq.function = &my_hrtimer_callback_outq; + hrtimer_start( &dev->timer_outq, ktime_outq, HRTIMER_MODE_REL ); + dev->timer_outq_started = 1; + } +#endif +#endif// WANT_HRTIMER + + //printk("WRITE\n"); prepare_to_wait(&dev->outq, &wait, TASK_INTERRUPTIBLE); schedule(); finish_wait(&dev->outq, &wait); @@ -192,7 +304,7 @@ ssize_t skypopen_write(struct file *filp, const char __user *buf, size_t count, * The ioctl() implementation */ -int skypopen_ioctl(struct inode *inode, struct file *filp, +static int skypopen_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { void __user *argp = (void __user *)arg; @@ -202,7 +314,7 @@ int skypopen_ioctl(struct inode *inode, struct file *filp, case OSS_GETVERSION: return put_user(SOUND_VERSION, p); case SNDCTL_DSP_GETBLKSIZE: - return put_user(GIOVA_BLK, p); + return put_user(SKYPOPEN_BLK, p); case SNDCTL_DSP_GETFMTS: return put_user(28731, p); @@ -239,6 +351,11 @@ void skypopen_cleanup_module(void) struct skypopen_listitem *lptr, *next; dev_t devno = MKDEV(skypopen_major, skypopen_minor); + + unload = 1; + + msleep(100); + /* Get rid of our char dev entries */ if (skypopen_devices) { for (i = 0; i < skypopen_nr_devs; i++) { @@ -247,13 +364,20 @@ void skypopen_cleanup_module(void) kfree(skypopen_devices); } - /* And all the cloned devices */ list_for_each_entry_safe(lptr, next, &skypopen_c_list, list) { +#ifndef WANT_HRTIMER ret= del_timer( &lptr->device.timer_inq ); - //printk( "Stopped skypopen OSS driver read timer (%dms) skype client:(%d)\n", GIOVA_SLEEP, current->tgid ); + printk( "Stopped skypopen OSS driver read timer\n"); ret= del_timer( &lptr->device.timer_outq ); - //printk( "Stopped skypopen OSS driver write timer (%dms) skype client:(%d)\n", GIOVA_SLEEP, current->tgid ); + printk( "Stopped skypopen OSS driver write timer\n"); +#else// WANT_HRTIMER + ret = hrtimer_cancel( &lptr->device.timer_inq ); + printk( "Stopped skypopen OSS driver read HRtimer\n"); + ret = hrtimer_cancel( &lptr->device.timer_outq ); + printk( "Stopped skypopen OSS driver write HRtimer\n"); + +#endif// WANT_HRTIMER list_del(&lptr->list); kfree(lptr); } diff --git a/src/mod/endpoints/mod_skypopen/oss/skypopen.h b/src/mod/endpoints/mod_skypopen/oss/skypopen.h index 5469048..2324e44 100644 --- a/src/mod/endpoints/mod_skypopen/oss/skypopen.h +++ b/src/mod/endpoints/mod_skypopen/oss/skypopen.h @@ -20,6 +20,11 @@ #include <linux/ioctl.h> /* needed for the _IOW etc stuff used later */ +#define SKYPOPEN_BLK 960 +#define SKYPOPEN_SLEEP 10 + +#define CENTOS + #ifndef SKYPOPEN_MAJOR #define SKYPOPEN_MAJOR 14 /* dynamic major by default */ #endif @@ -28,12 +33,18 @@ #define SKYPOPEN_NR_DEVS 1 /* skypopen0 through skypopen3 */ #endif +#define WANT_HRTIMER struct skypopen_dev { struct cdev cdev; /* Char device structure */ wait_queue_head_t inq; /* read and write queues */ wait_queue_head_t outq; /* read and write queues */ +#ifndef WANT_HRTIMER struct timer_list timer_inq; struct timer_list timer_outq; +#else// WANT_HRTIMER + struct hrtimer timer_inq; + struct hrtimer timer_outq; +#endif// WANT_HRTIMER int timer_inq_started; int timer_outq_started; }; @@ -50,11 +61,11 @@ extern int skypopen_nr_devs; * Prototypes for shared functions */ -ssize_t skypopen_read(struct file *filp, char __user *buf, size_t count, - loff_t *f_pos); -ssize_t skypopen_write(struct file *filp, const char __user *buf, size_t count, - loff_t *f_pos); -int skypopen_ioctl(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); +//ssize_t skypopen_read(struct file *filp, char __user *buf, size_t count, + //loff_t *f_pos); +//ssize_t skypopen_write(struct file *filp, const char __user *buf, size_t count, + //loff_t *f_pos); +//int skypopen_ioctl(struct inode *inode, struct file *filp, + //unsigned int cmd, unsigned long arg); #endif /* _SKYPOPEN_H_ */ commit 0f91359f3aec468fe5f3673c1048e8dc22556b9f Merge: 6014178 11642cc Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Dec 16 21:33:22 2010 -0200 Merge branch 'master' into netborder commit 11642cce3cc7222514f32397549354bb9e217688 Merge: 0f937ca a134136 Author: Moises Silva <moy@sangoma.com> Date: Thu Dec 16 18:30:25 2010 -0500 Merge branch 'master' of git.sangoma.com:smg_freeswitch commit 0f937ca13415ee60fb636cdbb6e6e5121d4fcb63 Author: Moises Silva <moy@sangoma.com> Date: Thu Dec 16 18:29:45 2010 -0500 freetdm: Add documentation on sig status diff --git a/libs/freetdm/docs/sigstatus.txt b/libs/freetdm/docs/sigstatus.txt new file mode 100644 index 0000000..10561bf --- /dev/null +++ b/libs/freetdm/docs/sigstatus.txt @@ -0,0 +1,59 @@ +FreeTDM can both notify and set signaling status changes in the different protocols thru a unified interface. More +specific details on the C data types and function prototypes are found in freetdm.h + +The API provides the following functions and data types to do it: + +The signaling status in any channel/span is represented thru ftdm_signaling_status_t + + /* The signaling link is down (no d-chans up in the span/group, MFC-R2 bit pattern unidentified) */ + FTDM_SIG_STATE_DOWN, + /* The signaling link is suspended (MFC-R2 bit pattern blocked, PRI maintenance, ss7 blocked?) */ + FTDM_SIG_STATE_SUSPENDED, + /* The signaling link is ready and calls can be placed (ie: d-chan up, MFC-R2 both rx and tx in IDLE) */ + FTDM_SIG_STATE_UP, + /* Invalid status */ + FTDM_SIG_STATE_INVALID + +Changes in the signaling status are notified to the user using the standard callback notification function provided +during configuration using the sigevent type FTDM_SIGEVENT_SIGSTATUS_CHANGED which is sent when the line status changes. + +On startup the signalling status default is FTDM_SIG_STATE_DOWN, and no notification is provided until the state change, +so applications must assume the status is down unless told otherwise. + +When ftdm_span_start is called, the signaling stack takes care of attempting to bring the status to UP +but it will ultimately depend on the other side too. + +== Setting the signaling status == + +Users can set the signaling status on a given channel/span thru FreeTDM the following API functions: + +ftdm_channel_set_sig_status +ftdm_span_set_sig_status + +If the user calls ftdm_channel_set_sig_status(chan, FTDM_SIG_STATE_SUSPENDED), the signaling stack will try to set +the status of the line to the one requested, if successful, it will result in a SIGEVENT_SIGSTATUS_CHANGED notification +being sent with status FTDM_SIG_STATE_SUSPENDED. + +** MFC-R2 Signaling Notes ** +For MFC-R2, calling ftdm_span_start() results in setting the tx CAS bits to IDLE. However, if the rx bits are in BLOCKED state +the signaling status will be reported as SUSPENDED. + +If the user calls ftdm_channel_set_sig_status(chan, SUSPENDED), the tx CAS bits will be set to BLOCKED and, if, the current rx bits +are IDLE then a SIGEVENT_SIGSTATUS_CHANGED with state SUSPENDED will be sent. If the rx bits are already in blocked then no further +SIGEVENT_SIGSTATUS_CHANGED notification is needed (because it was already sent when the rx bits were initially detected as BLOCKED). + +If the user calls ftdm_channel_set_sig_status(chan, UP), the tx CAS bits will be set to IDLE and, if, the current rx bits +are IDLE, then SIGEVENT_SIGSTATUS_CHANGED with state UP will be sent. If the rx bits are BLOCKED, then no notification is +sent at all until the rx bits change. + +Bottom line is, for MFC-R2, SIGEVENT_SIGSTATUS_CHANGED UP is only sent to the user when both the rx and tx bits are in IDLE, and +SIGEVENT_SIGSTATUS_CHANGED SUSPENDED is only sent to the user when any of the rx or tx bits are in BLOCKED. + +== Getting the signaling status == +Users can get the signaling status on a given channel/span thru FreeTDM the following API functions: + +ftdm_channel_get_sig_status +ftdm_span_get_sig_status + +The line status returned should be the same as the last time a SIGEVENT_SIGSTATUS_CHANGED was reported. + diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 41bf819..56a9dc0 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -367,6 +367,7 @@ typedef struct ftdm_channel_config { /*! \brief Signaling status on a given span or specific channel on protocols that support it + \note see docs/sigstatus.txt for more extensive documentation on signaling status */ typedef enum { /* The signaling link is down (no d-chans up in the span/group, MFC-R2 bit pattern unidentified) */ commit 9db4a8265c8e43d36a3333f96e4cc13a8fc1c37c Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Dec 16 16:03:05 2010 -0600 tweak on calle[re] id diff --git a/src/switch_channel.c b/src/switch_channel.c index b0ee9f5..ef21e8c 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2386,6 +2386,8 @@ SWITCH_DECLARE(void) switch_channel_set_caller_extension(switch_channel_t *chann { switch_assert(channel != NULL); + switch_channel_set_flag(channel, CF_DIALPLAN); + switch_mutex_lock(channel->profile_mutex); caller_extension->next = channel->caller_profile->caller_extension; channel->caller_profile->caller_extension = caller_extension; diff --git a/src/switch_core_state_machine.c b/src/switch_core_state_machine.c index 59cc17d..ccd6dac 100644 --- a/src/switch_core_state_machine.c +++ b/src/switch_core_state_machine.c @@ -123,9 +123,7 @@ static void switch_core_standard_on_routing(switch_core_session_t *session) } } - if (count) { - switch_channel_set_flag(session->channel, CF_DIALPLAN); - } else { + if (!count) { if (switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { if (switch_channel_test_flag(session->channel, CF_ANSWERED)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, commit 6e24e8e67b345878553531205fbf0a2225f32349 Merge: 7b1de56 a134136 Author: Moises Silva <moy@sangoma.com> Date: Thu Dec 16 16:50:19 2010 -0500 Merge remote branch 'smgfs/master' commit a134136ee715f6b392ec8bf3c5b3e31af7953c18 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Dec 16 19:44:32 2010 -0200 freetdm: ftmod_r2 - notify the core when we change the signaling status of a channel or span through the api diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 9f35971..14eca42 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -468,6 +468,7 @@ static FIO_CHANNEL_SET_SIG_STATUS_FUNCTION(ftdm_r2_set_channel_sig_status) ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Cannot set signaling status to unknown value '%d'\n", status); return FTDM_FAIL; } + ftdm_r2_set_chan_sig_status(ftdmchan, status); return FTDM_SUCCESS; } @@ -528,6 +529,7 @@ static FIO_SPAN_SET_SIG_STATUS_FUNCTION(ftdm_r2_set_span_sig_status) openr2_chan_set_idle(r2chan); ftdm_log_chan_msg(fchan, FTDM_LOG_NOTICE, "Channel idle\n"); } + ftdm_r2_set_chan_sig_status(fchan, status); } ftdm_iterator_free(chaniter); return FTDM_SUCCESS; commit 6014178b5b751c0d35a18f293fe1dec37fcf000d Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Dec 16 16:32:04 2010 -0500 Removed unwanted lines in previous commit diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 8755d73..1fdb867 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -5117,9 +5117,16 @@ FT_DECLARE(ftdm_status_t) ftdm_configure_span_signaling(ftdm_span_t *span, const FT_DECLARE(ftdm_status_t) ftdm_span_start(ftdm_span_t *span) { if (span->start) { + /* check the alarms again before starting the signaling module + this works-around some I/O modules (netborder I/O module) that cannot + check the alarm status before during configuration because the spans are + not really started yet at the I/O level */ + if (ftdm_set_channels_alarms(span, 0) != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_ERROR, "%d: Failed to set channel alarms\n", span->span_id); + return FTDM_FAIL; + } return span->start(span); } - return FTDM_FAIL; } commit d6ec16804a62e15aad034d6c6e226748ca522817 Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Dec 16 15:57:46 2010 -0500 freetdm: added trace type to raw traces diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 1750d6d..8755d73 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -281,7 +281,10 @@ FTDM_ENUM_NAMES(SIGNALING_STATUS_NAMES, SIGSTATUS_STRINGS) FTDM_STR2ENUM(ftdm_str2ftdm_signaling_status, ftdm_signaling_status2str, ftdm_signaling_status_t, SIGNALING_STATUS_NAMES, FTDM_SIG_STATE_INVALID) FTDM_ENUM_NAMES(TRACE_DIR_NAMES, TRACE_DIR_STRINGS) -FTDM_STR2ENUM(ftdm_str2ftdm_trace_dir, ftdm_trace_dir2str, ftdm_trace_dir_t, TRACE_DIR_NAMES, FTDM_TRACE_INVALID) +FTDM_STR2ENUM(ftdm_str2ftdm_trace_dir, ftdm_trace_dir2str, ftdm_trace_dir_t, TRACE_DIR_NAMES, FTDM_TRACE_DIR_INVALID) + +FTDM_ENUM_NAMES(TRACE_TYPE_NAMES, TRACE_TYPE_STRINGS) +FTDM_STR2ENUM(ftdm_str2ftdm_trace_type, ftdm_trace_type2str, ftdm_trace_type_t, TRACE_TYPE_NAMES, FTDM_TRACE_TYPE_INVALID) FTDM_ENUM_NAMES(TON_NAMES, TON_STRINGS) FTDM_STR2ENUM(ftdm_str2ftdm_ton, ftdm_ton2str, ftdm_ton_t, TON_NAMES, FTDM_TON_INVALID) @@ -2475,12 +2478,9 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_place(const char *file, const char UNREFERENCED_PARAMETER(func); UNREFERENCED_PARAMETER(line); #endif - - ftdm_wait_for_flag_cleared(ftdmchan, FTDM_CHANNEL_STATE_CHANGE, 100); - ftdm_call_set_call_id(&ftdmchan->caller_data); + ftdm_wait_for_flag_cleared(ftdmchan, FTDM_CHANNEL_STATE_CHANGE, 100); ftdm_channel_unlock(ftdmchan); - return status; } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c index 3afdaa5..a90968f 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c @@ -790,9 +790,9 @@ void sngisdn_rcv_q931_trace(InMngmt *trc, Buffer *mBuf) mlen = ((SsMsgInfo*)(mBuf->b_rptr))->len; if (trc->t.trc.evnt == TL3PKTTX) { - dir = FTDM_TRACE_OUTGOING; + dir = FTDM_TRACE_DIR_OUTGOING; } else { - dir = FTDM_TRACE_INCOMING; + dir = FTDM_TRACE_DIR_INCOMING; } if (mlen) { @@ -837,9 +837,9 @@ void sngisdn_rcv_q921_trace(BdMngmt *trc, Buffer *mBuf) } if (trc->t.trc.evnt == TL2FRMTX) { - dir = FTDM_TRACE_OUTGOING; + dir = FTDM_TRACE_DIR_OUTGOING; } else { - dir = FTDM_TRACE_INCOMING; + dir = FTDM_TRACE_DIR_INCOMING; } ftdm_assert(mBuf != NULLP, "Received a Q921 trace with no buffer"); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c index c03976a..fd9edeb 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c @@ -118,8 +118,8 @@ void sngisdn_trace_raw_q921(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t d sigev.channel = signal_data->dchan; sigev.event_id = FTDM_SIGEVENT_TRACE_RAW; - sigev.ev_data.logevent.dir = dir; - sigev.ev_data.logevent.level = 2; + sigev.ev_data.trace.dir = dir; + sigev.ev_data.trace.type = FTDM_TRACE_TYPE_Q921; /* TODO: Map trace to call ID here */ sigev.call_id = 0; @@ -226,8 +226,8 @@ void sngisdn_trace_raw_q931(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t d sigev.channel = signal_data->dchan; sigev.event_id = FTDM_SIGEVENT_TRACE_RAW; - sigev.ev_data.logevent.dir = dir; - sigev.ev_data.logevent.level = 3; + sigev.ev_data.trace.dir = dir; + sigev.ev_data.trace.type = FTDM_TRACE_TYPE_Q931; /* TODO: Map trace to call ID here */ diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 41bf819..b75df1e 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -390,21 +390,31 @@ typedef struct { typedef enum { /* This is an received frame */ - FTDM_TRACE_INCOMING, + FTDM_TRACE_DIR_INCOMING, /* This is a transmitted frame */ - FTDM_TRACE_OUTGOING, + FTDM_TRACE_DIR_OUTGOING, /* Invalid */ - FTDM_TRACE_INVALID, + FTDM_TRACE_DIR_INVALID, } ftdm_trace_dir_t; #define TRACE_DIR_STRINGS "INCOMING", "OUTGOING", "INVALID" /*! \brief Move string to ftdm_trace_dir_t and viceversa */ FTDM_STR2ENUM_P(ftdm_str2ftdm_trace_dir, ftdm_trace_dir2str, ftdm_trace_dir_t) +typedef enum { + FTDM_TRACE_TYPE_Q931, + FTDM_TRACE_TYPE_Q921, + FTDM_TRACE_TYPE_INVALID, +} ftdm_trace_type_t; +#define TRACE_TYPE_STRINGS "Q931", "Q921", "INVALID" + +/*! \brief Move string to ftdm_trace_type_t and viceversa */ +FTDM_STR2ENUM_P(ftdm_str2ftdm_trace_type, ftdm_trace_type2str, ftdm_trace_type_t) + typedef struct { /* Direction - incoming or outgoing */ ftdm_trace_dir_t dir; - uint8_t level; /* 1 for phy layer, 2 for q921/mtp2, 3 for q931/mtp3 */ + ftdm_trace_type_t type; } ftdm_event_trace_t; /*! \brief Generic signaling message */ @@ -418,7 +428,7 @@ struct ftdm_sigmsg { uint32_t call_id; /*!< unique call id for this call */ union { ftdm_event_sigstatus_t sigstatus; /*!< valid if event_id is FTDM_SIGEVENT_SIGSTATUS_CHANGED */ - ftdm_event_trace_t logevent; /*!< valid if event_id is FTDM_SIGEVENT_TRACE or FTDM_SIGEVENT_TRACE_RAW */ + ftdm_event_trace_t trace; /*!< valid if event_id is FTDM_SIGEVENT_TRACE or FTDM_SIGEVENT_TRACE_RAW */ }ev_data; }; commit 48a1ae3896561a0f57b0f362266b44526930b5f1 Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Dec 16 15:57:46 2010 -0500 freetdm: added trace type to raw traces diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 3bcad31..8755d73 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -281,7 +281,10 @@ FTDM_ENUM_NAMES(SIGNALING_STATUS_NAMES, SIGSTATUS_STRINGS) FTDM_STR2ENUM(ftdm_str2ftdm_signaling_status, ftdm_signaling_status2str, ftdm_signaling_status_t, SIGNALING_STATUS_NAMES, FTDM_SIG_STATE_INVALID) FTDM_ENUM_NAMES(TRACE_DIR_NAMES, TRACE_DIR_STRINGS) -FTDM_STR2ENUM(ftdm_str2ftdm_trace_dir, ftdm_trace_dir2str, ftdm_trace_dir_t, TRACE_DIR_NAMES, FTDM_TRACE_INVALID) +FTDM_STR2ENUM(ftdm_str2ftdm_trace_dir, ftdm_trace_dir2str, ftdm_trace_dir_t, TRACE_DIR_NAMES, FTDM_TRACE_DIR_INVALID) + +FTDM_ENUM_NAMES(TRACE_TYPE_NAMES, TRACE_TYPE_STRINGS) +FTDM_STR2ENUM(ftdm_str2ftdm_trace_type, ftdm_trace_type2str, ftdm_trace_type_t, TRACE_TYPE_NAMES, FTDM_TRACE_TYPE_INVALID) FTDM_ENUM_NAMES(TON_NAMES, TON_STRINGS) FTDM_STR2ENUM(ftdm_str2ftdm_ton, ftdm_ton2str, ftdm_ton_t, TON_NAMES, FTDM_TON_INVALID) @@ -2475,12 +2478,9 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_place(const char *file, const char UNREFERENCED_PARAMETER(func); UNREFERENCED_PARAMETER(line); #endif - - ftdm_wait_for_flag_cleared(ftdmchan, FTDM_CHANNEL_STATE_CHANGE, 100); - ftdm_call_set_call_id(&ftdmchan->caller_data); + ftdm_wait_for_flag_cleared(ftdmchan, FTDM_CHANNEL_STATE_CHANGE, 100); ftdm_channel_unlock(ftdmchan); - return status; } @@ -5117,14 +5117,6 @@ FT_DECLARE(ftdm_status_t) ftdm_configure_span_signaling(ftdm_span_t *span, const FT_DECLARE(ftdm_status_t) ftdm_span_start(ftdm_span_t *span) { if (span->start) { - /* check the alarms again before starting the signaling module - this works-around some I/O modules (netborder I/O module) that cannot - check the alarm status before during configuration because the spans are - not really started yet at the I/O level */ - if (ftdm_set_channels_alarms(span, 0) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "%d: Failed to set channel alarms\n", span->span_id); - return FTDM_FAIL; - } return span->start(span); } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c index 3afdaa5..a90968f 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c @@ -790,9 +790,9 @@ void sngisdn_rcv_q931_trace(InMngmt *trc, Buffer *mBuf) mlen = ((SsMsgInfo*)(mBuf->b_rptr))->len; if (trc->t.trc.evnt == TL3PKTTX) { - dir = FTDM_TRACE_OUTGOING; + dir = FTDM_TRACE_DIR_OUTGOING; } else { - dir = FTDM_TRACE_INCOMING; + dir = FTDM_TRACE_DIR_INCOMING; } if (mlen) { @@ -837,9 +837,9 @@ void sngisdn_rcv_q921_trace(BdMngmt *trc, Buffer *mBuf) } if (trc->t.trc.evnt == TL2FRMTX) { - dir = FTDM_TRACE_OUTGOING; + dir = FTDM_TRACE_DIR_OUTGOING; } else { - dir = FTDM_TRACE_INCOMING; + dir = FTDM_TRACE_DIR_INCOMING; } ftdm_assert(mBuf != NULLP, "Received a Q921 trace with no buffer"); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c index c03976a..fd9edeb 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c @@ -118,8 +118,8 @@ void sngisdn_trace_raw_q921(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t d sigev.channel = signal_data->dchan; sigev.event_id = FTDM_SIGEVENT_TRACE_RAW; - sigev.ev_data.logevent.dir = dir; - sigev.ev_data.logevent.level = 2; + sigev.ev_data.trace.dir = dir; + sigev.ev_data.trace.type = FTDM_TRACE_TYPE_Q921; /* TODO: Map trace to call ID here */ sigev.call_id = 0; @@ -226,8 +226,8 @@ void sngisdn_trace_raw_q931(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t d sigev.channel = signal_data->dchan; sigev.event_id = FTDM_SIGEVENT_TRACE_RAW; - sigev.ev_data.logevent.dir = dir; - sigev.ev_data.logevent.level = 3; + sigev.ev_data.trace.dir = dir; + sigev.ev_data.trace.type = FTDM_TRACE_TYPE_Q931; /* TODO: Map trace to call ID here */ diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 41bf819..b75df1e 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -390,21 +390,31 @@ typedef struct { typedef enum { /* This is an received frame */ - FTDM_TRACE_INCOMING, + FTDM_TRACE_DIR_INCOMING, /* This is a transmitted frame */ - FTDM_TRACE_OUTGOING, + FTDM_TRACE_DIR_OUTGOING, /* Invalid */ - FTDM_TRACE_INVALID, + FTDM_TRACE_DIR_INVALID, } ftdm_trace_dir_t; #define TRACE_DIR_STRINGS "INCOMING", "OUTGOING", "INVALID" /*! \brief Move string to ftdm_trace_dir_t and viceversa */ FTDM_STR2ENUM_P(ftdm_str2ftdm_trace_dir, ftdm_trace_dir2str, ftdm_trace_dir_t) +typedef enum { + FTDM_TRACE_TYPE_Q931, + FTDM_TRACE_TYPE_Q921, + FTDM_TRACE_TYPE_INVALID, +} ftdm_trace_type_t; +#define TRACE_TYPE_STRINGS "Q931", "Q921", "INVALID" + +/*! \brief Move string to ftdm_trace_type_t and viceversa */ +FTDM_STR2ENUM_P(ftdm_str2ftdm_trace_type, ftdm_trace_type2str, ftdm_trace_type_t) + typedef struct { /* Direction - incoming or outgoing */ ftdm_trace_dir_t dir; - uint8_t level; /* 1 for phy layer, 2 for q921/mtp2, 3 for q931/mtp3 */ + ftdm_trace_type_t type; } ftdm_event_trace_t; /*! \brief Generic signaling message */ @@ -418,7 +428,7 @@ struct ftdm_sigmsg { uint32_t call_id; /*!< unique call id for this call */ union { ftdm_event_sigstatus_t sigstatus; /*!< valid if event_id is FTDM_SIGEVENT_SIGSTATUS_CHANGED */ - ftdm_event_trace_t logevent; /*!< valid if event_id is FTDM_SIGEVENT_TRACE or FTDM_SIGEVENT_TRACE_RAW */ + ftdm_event_trace_t trace; /*!< valid if event_id is FTDM_SIGEVENT_TRACE or FTDM_SIGEVENT_TRACE_RAW */ }ev_data; }; commit 43dd86fb96f8a20b405df6f6fda932ad6cc2e017 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Dec 16 18:47:40 2010 -0200 freetdm: ftmod_r2 - small code clean diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 952b94b..9f35971 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -473,20 +473,16 @@ static FIO_CHANNEL_SET_SIG_STATUS_FUNCTION(ftdm_r2_set_channel_sig_status) static FIO_SPAN_GET_SIG_STATUS_FUNCTION(ftdm_r2_get_span_sig_status) { - ftdm_iterator_t *chaniter = NULL; ftdm_iterator_t *citer = NULL; - uint32_t i; - - chaniter = ftdm_span_get_chan_iterator(span, NULL); + ftdm_iterator_t *chaniter = ftdm_span_get_chan_iterator(span, NULL); if (!chaniter) { ftdm_log(FTDM_LOG_CRIT, "Failed to allocate channel iterator for span %s!\n", span->name); return FTDM_FAIL; } /* if ALL channels are non-idle, report SUSPENDED. UP otherwise. */ *status = FTDM_SIG_STATE_SUSPENDED; - for (i = 1, citer = chaniter; citer; citer = ftdm_iterator_next(citer), i++) { + for (citer = chaniter; citer; citer = ftdm_iterator_next(citer)) { ftdm_channel_t *fchan = ftdm_iterator_current(citer); - if (ftdm_test_flag(fchan, FTDM_CHANNEL_SIG_UP)) { *status = FTDM_SIG_STATE_UP; break; @@ -501,7 +497,6 @@ static FIO_SPAN_SET_SIG_STATUS_FUNCTION(ftdm_r2_set_span_sig_status) ftdm_iterator_t *chaniter = NULL; ftdm_iterator_t *citer = NULL; uint32_t span_opr = -1; - uint32_t i; /* we either set the channels to BLOCK or IDLE */ switch(status) { @@ -523,7 +518,7 @@ static FIO_SPAN_SET_SIG_STATUS_FUNCTION(ftdm_r2_set_span_sig_status) return FTDM_FAIL; } /* iterate over all channels, setting them to the requested state */ - for (i = 1, citer = chaniter; citer; citer = ftdm_iterator_next(citer), i++) { + for (citer = chaniter; citer; citer = ftdm_iterator_next(citer)) { ftdm_channel_t *fchan = ftdm_iterator_current(citer); openr2_chan_t *r2chan = R2CALL(fchan)->r2chan; if (span_opr == 0) { commit 7b1de56baa504c97cd42790fa3defc9f2182f9c1 Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Dec 16 14:24:54 2010 -0600 vs2010 fix build diff --git a/libs/esl/src/esl.c b/libs/esl/src/esl.c index 3397dbf..f5bab62 100644 --- a/libs/esl/src/esl.c +++ b/libs/esl/src/esl.c @@ -947,9 +947,9 @@ ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, int check_q, esl_ while(!revent && handle->connected) { - esl_size_t len; + esl_size_t len1; - if ((len = esl_buffer_read_packet(handle->packet_buf, handle->socket_buf, sizeof(handle->socket_buf)))) { + if ((len1 = esl_buffer_read_packet(handle->packet_buf, handle->socket_buf, sizeof(handle->socket_buf)))) { char *data = (char *) handle->socket_buf; char *p, *e; commit 6b66a0516bcc4d7bd9461366ea7bf958b4ef9aeb Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Dec 16 18:19:50 2010 -0200 freetdm: ftmod_r2 - fixed infinite loop on span stop diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index d1b24da..952b94b 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -55,10 +55,13 @@ static int32_t g_thread_count = 0; typedef int openr2_call_status_t; -/* when the users kills a span we clear this flag to kill the signaling thread */ +/* when the user stops a span, we clear FTDM_R2_SPAN_STARTED, so that the signaling thread + * knows it must stop, and we wait for FTDM_R2_RUNNING to be clear, which tells us the + * signaling thread is done. */ /* FIXME: what about the calls that are already up-and-running? */ typedef enum { FTDM_R2_RUNNING = (1 << 0), + FTDM_R2_SPAN_STARTED = (1 << 1), } ftdm_r2_flag_t; /* private call information stored in ftdmchan->call_data void* ptr, @@ -424,13 +427,14 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(r2_outgoing_call) static ftdm_status_t ftdm_r2_start(ftdm_span_t *span) { ftdm_r2_data_t *r2_data = span->signal_data; - ftdm_set_flag(r2_data, FTDM_R2_RUNNING); + ftdm_set_flag(r2_data, FTDM_R2_SPAN_STARTED); return ftdm_thread_create_detached(ftdm_r2_run, span); } static ftdm_status_t ftdm_r2_stop(ftdm_span_t *span) { ftdm_r2_data_t *r2_data = span->signal_data; + ftdm_clear_flag(r2_data, FTDM_R2_SPAN_STARTED); while (ftdm_test_flag(r2_data, FTDM_R2_RUNNING)) { ftdm_log(FTDM_LOG_DEBUG, "Waiting for R2 span %s\n", span->name); ftdm_sleep(100); @@ -1759,6 +1763,9 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) uint32_t txqueue_size = 4; short *poll_events = ftdm_malloc(sizeof(short) * span->chan_count); + /* as long as this thread is running, this flag is set */ + ftdm_set_flag(r2data, FTDM_R2_RUNNING); + #ifdef __linux__ r2data->monitor_thread_id = syscall(SYS_gettid); #endif @@ -1781,7 +1788,7 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) memset(&start, 0, sizeof(start)); memset(&end, 0, sizeof(end)); - while (ftdm_running() && ftdm_test_flag(r2data, FTDM_R2_RUNNING)) { + while (ftdm_running() && ftdm_test_flag(r2data, FTDM_R2_SPAN_STARTED)) { res = gettimeofday(&end, NULL); if (res) { ftdm_log(FTDM_LOG_CRIT, "Failure gettimeofday [%s]\n", strerror(errno)); commit dcce6bb510ccc2096350abba07ff9f9efb8e6b9f Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Dec 16 13:52:46 2010 -0600 vs2010 fix build diff --git a/libs/esl/src/esl_buffer.c b/libs/esl/src/esl_buffer.c index 51fbfb2..8032169 100644 --- a/libs/esl/src/esl_buffer.c +++ b/libs/esl/src/esl_buffer.c @@ -277,7 +277,7 @@ ESL_DECLARE(esl_size_t) esl_buffer_write(esl_buffer_t *buffer, const void *data, if (freespace < datalen) { esl_size_t new_size, new_block_size; - void *data; + void *data1; new_size = buffer->datalen + datalen; new_block_size = buffer->datalen + buffer->blocksize; @@ -286,11 +286,11 @@ ESL_DECLARE(esl_size_t) esl_buffer_write(esl_buffer_t *buffer, const void *data, new_size = new_block_size; } buffer->head = buffer->data; - data = realloc(buffer->data, new_size); - if (!data) { + data1 = realloc(buffer->data, new_size); + if (!data1) { return 0; } - buffer->data = data; + buffer->data = data1; buffer->head = buffer->data; buffer->datalen = new_size; } commit 37753892f1033f90bae6cbbfcedcd88d660fee9f Merge: a082c9e ccbc2ed Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Dec 16 17:01:37 2010 -0200 Merge branch 'master' of git@git.sangoma.com:smg_freeswitch commit a082c9e913bb3d777d29e4692a8a6e8afcd552e2 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Dec 16 17:01:06 2010 -0200 freetdm: ftmod_r2 - implemented ftdm_r2_get_span_sig_status() and ftdm_r2_set_span_sig_status() mod_freetdm - created sigstatus api command diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 38197bb..daddc9a 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -3542,7 +3542,83 @@ SWITCH_STANDARD_API(ft_function) goto end; } - if (!strcasecmp(argv[0], "dump")) { + if (!strcasecmp(argv[0], "sigstatus")) { + ftdm_span_t *span = NULL; + ftdm_signaling_status_t sigstatus; + + if (argc < 3) { + stream->write_function(stream, "-ERR Usage: ftdm sigstatus get|set [<span_id>] [<channel>] [<sigstatus>]\n"); + goto end; + } + if (!strcasecmp(argv[1], "get") && argc < 3) { + stream->write_function(stream, "-ERR sigstatus get usage: get <span_id>\n"); + goto end; + } + if (!strcasecmp(argv[1], "set") && argc != 5) { + stream->write_function(stream, "-ERR sigstatus set usage: set <span_id> <channel>|all <sigstatus>\n"); + goto end; + } + + ftdm_span_find_by_name(argv[2], &span); + if (!span) { + stream->write_function(stream, "-ERR invalid span\n"); + goto end; + } + + if (!strcasecmp(argv[1], "get")) { + if (argc == 4) { + uint32_t chan_id = atol(argv[3]); + ftdm_channel_t *fchan = ftdm_span_get_channel(span, chan_id); + if (!fchan) { + stream->write_function(stream, "-ERR failed to get channel id '%d'\n", chan_id); + goto end; + } + + if ((FTDM_SUCCESS == ftdm_channel_get_sig_status(fchan, &sigstatus))) { + stream->write_function(stream, "channel %d signaling status: %s\n", chan_id, ftdm_signaling_status2str(sigstatus)); + } else { + stream->write_function(stream, "-ERR failed to get channel sigstatus\n"); + } + goto end; + } else { + if ((FTDM_SUCCESS == ftdm_span_get_sig_status(span, &sigstatus))) { + stream->write_function(stream, "signaling_status: %s\n", ftdm_signaling_status2str(sigstatus)); + } else { + stream->write_function(stream, "-ERR failed to read span status: %s\n", ftdm_span_get_last_error(span)); + } + } + goto end; + } + if (!strcasecmp(argv[1], "set")) { + sigstatus = ftdm_str2ftdm_signaling_status(argv[4]); + + if (!strcasecmp(argv[3], "all")) { + if ((FTDM_SUCCESS == ftdm_span_set_sig_status(span, sigstatus))) { + stream->write_function(stream, "Signaling status of all channels from span %s set to %s\n", + ftdm_span_get_name(span), ftdm_signaling_status2str(sigstatus)); + } else { + stream->write_function(stream, "-ERR failed to set span sigstatus to '%s'\n", ftdm_signaling_status2str(sigstatus)); + } + goto end; + } else { + uint32_t chan_id = atol(argv[3]); + ftdm_channel_t *fchan = ftdm_span_get_channel(span, chan_id); + if (!fchan) { + stream->write_function(stream, "-ERR failed to get channel id '%d'\n", chan_id); + goto end; + } + + if ((FTDM_SUCCESS == ftdm_channel_set_sig_status(fchan, sigstatus))) { + stream->write_function(stream, "Signaling status of channel %d set to %s\n", chan_id, + ftdm_signaling_status2str(sigstatus)); + } else { + stream->write_function(stream, "-ERR failed to set span sigstatus to '%s'\n", ftdm_signaling_status2str(sigstatus)); + } + goto end; + } + } + + } else if (!strcasecmp(argv[0], "dump")) { if (argc < 2) { stream->write_function(stream, "-ERR Usage: ftdm dump <span_id> [<chan_id>]\n"); goto end; diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index ef9201b..b4e9e13 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -461,12 +461,79 @@ static FIO_CHANNEL_SET_SIG_STATUS_FUNCTION(ftdm_r2_set_channel_sig_status) openr2_chan_set_idle(r2chan); break; default: - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Cannot set signaling status to unknown value '%s'\n", status); + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Cannot set signaling status to unknown value '%d'\n", status); return FTDM_FAIL; } return FTDM_SUCCESS; } +static FIO_SPAN_GET_SIG_STATUS_FUNCTION(ftdm_r2_get_span_sig_status) +{ + ftdm_iterator_t *chaniter = NULL; + ftdm_iterator_t *citer = NULL; + uint32_t i; + + chaniter = ftdm_span_get_chan_iterator(span, NULL); + if (!chaniter) { + ftdm_log(FTDM_LOG_CRIT, "Failed to allocate channel iterator for span %s!\n", span->name); + return FTDM_FAIL; + } + /* if ALL channels are non-idle, report SUSPENDED. UP otherwise. */ + *status = FTDM_SIG_STATE_SUSPENDED; + for (i = 1, citer = chaniter; citer; citer = ftdm_iterator_next(citer), i++) { + ftdm_channel_t *fchan = ftdm_iterator_current(citer); + + if (ftdm_test_flag(fchan, FTDM_CHANNEL_SIG_UP)) { + *status = FTDM_SIG_STATE_UP; + break; + } + } + ftdm_iterator_free(chaniter); + return FTDM_SUCCESS; +} + +static FIO_SPAN_SET_SIG_STATUS_FUNCTION(ftdm_r2_set_span_sig_status) +{ + ftdm_iterator_t *chaniter = NULL; + ftdm_iterator_t *citer = NULL; + uint32_t span_opr = -1; + uint32_t i; + + /* we either set the channels to BLOCK or IDLE */ + switch(status) { + case FTDM_SIG_STATE_DOWN: + case FTDM_SIG_STATE_SUSPENDED: + span_opr = 0; + break; + case FTDM_SIG_STATE_UP: + span_opr = 1; + break; + default: + ftdm_log(FTDM_LOG_WARNING, "Cannot set signaling status to unknown value '%d'\n", status); + return FTDM_FAIL; + } + + chaniter = ftdm_span_get_chan_iterator(span, NULL); + if (!chaniter) { + ftdm_log(FTDM_LOG_CRIT, "Failed to allocate channel iterator for span %s!\n", span->name); + return FTDM_FAIL; + } + /* iterate over all channels, setting them to the requested state */ + for (i = 1, citer = chaniter; citer; citer = ftdm_iterator_next(citer), i++) { + ftdm_channel_t *fchan = ftdm_iterator_current(citer); + openr2_chan_t *r2chan = R2CALL(fchan)->r2chan; + if (span_opr == 0) { + openr2_chan_set_blocked(r2chan); + ftdm_log_chan_msg(fchan, FTDM_LOG_NOTICE, "Channel blocked\n"); + } else { + openr2_chan_set_idle(r2chan); + ftdm_log_chan_msg(fchan, FTDM_LOG_NOTICE, "Channel idle\n"); + } + } + ftdm_iterator_free(chaniter); + return FTDM_SUCCESS; +} + /* always called from the monitor thread */ static void ftdm_r2_on_call_init(openr2_chan_t *r2chan) { @@ -1441,6 +1508,8 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) span->signal_type = FTDM_SIGTYPE_R2; span->signal_data = r2data; span->outgoing_call = r2_outgoing_call; + span->get_span_sig_status = ftdm_r2_get_span_sig_status; + span->set_span_sig_status = ftdm_r2_set_span_sig_status; span->get_channel_sig_status = ftdm_r2_get_channel_sig_status; span->set_channel_sig_status = ftdm_r2_set_channel_sig_status; commit dfdf4e1e23e527e82c6bd1c44870fbe59d1db312 Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Dec 16 12:27:55 2010 -0600 windows fix for last esl commit diff --git a/libs/esl/src/esl.2008.vcproj b/libs/esl/src/esl.2008.vcproj index 101348d..89daa17 100644 --- a/libs/esl/src/esl.2008.vcproj +++ b/libs/esl/src/esl.2008.vcproj @@ -291,6 +291,10 @@ > </File> <File + RelativePath=".\esl_buffer.c" + > + </File> + <File RelativePath=".\esl_config.c" > </File> @@ -317,6 +321,10 @@ > </File> <File + RelativePath=".\include\esl_buffer.h" + > + </File> + <File RelativePath=".\include\esl_config.h" > </File> diff --git a/libs/esl/src/esl.2010.vcxproj b/libs/esl/src/esl.2010.vcxproj index b215fe4..fd5e3a8 100644 --- a/libs/esl/src/esl.2010.vcxproj +++ b/libs/esl/src/esl.2010.vcxproj @@ -128,6 +128,7 @@ <ClCompile Include="esl_event.c" /> <ClCompile Include="esl_json.c" /> <ClCompile Include="esl_threadmutex.c" /> + <ClCompile Include="esl_buffer.c" /> </ItemGroup> <ItemGroup> <ClInclude Include="include\esl.h" /> @@ -135,6 +136,7 @@ <ClInclude Include="include\esl_event.h" /> <ClInclude Include="include\esl_json.h" /> <ClInclude Include="include\esl_threadmutex.h" /> + <ClInclude Include="include\esl_buffer.h" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> commit 871c871b80d314b08bdf82e40e5ea04193c0f5a6 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Dec 16 12:17:02 2010 -0600 wrong week to quit sniffing glue diff --git a/libs/esl/testclient.c b/libs/esl/testclient.c index a031836..9fa271f 100644 --- a/libs/esl/testclient.c +++ b/libs/esl/testclient.c @@ -6,47 +6,6 @@ int main(void) { esl_handle_t handle = {{0}}; - esl_buffer_t *buffer; - char doh[65536]; - - esl_buffer_create(&buffer, 32 * 1024, 32 * 1024, 0); - - snprintf(doh, sizeof(doh), "TEST 1 FOO BAR 1234\n"); - esl_buffer_write(buffer, doh, strlen(doh)); - esl_buffer_write(buffer, doh, strlen(doh)); - esl_buffer_write(buffer, doh, strlen(doh)); - snprintf(doh, sizeof(doh), "TEST 1 END\n\n"); - esl_buffer_write(buffer, doh, strlen(doh)); - - - - snprintf(doh, sizeof(doh), "TEST 2 BAR FOO 4321\n"); - esl_buffer_write(buffer, doh, strlen(doh)); - esl_buffer_write(buffer, doh, strlen(doh)); - esl_buffer_write(buffer, doh, strlen(doh)); - snprintf(doh, sizeof(doh), "TEST 2 END\n\n"); - esl_buffer_write(buffer, doh, strlen(doh)); - - snprintf(doh, sizeof(doh), "TEST 2 BAR FOO 4321\n"); - esl_buffer_write(buffer, doh, strlen(doh)); - esl_buffer_write(buffer, doh, strlen(doh)); - esl_buffer_write(buffer, doh, strlen(doh)); - snprintf(doh, sizeof(doh), "TEST 2 END\n\n"); - esl_buffer_write(buffer, doh, strlen(doh)); - - printf("COUNT %ld\n", esl_buffer_packet_count(buffer)); - - memset(doh, 0, sizeof(doh)); - esl_buffer_read_packet(buffer, doh, sizeof(doh)); - printf("TEST: [%s]\n", doh); - - memset(doh, 0, sizeof(doh)); - - - esl_buffer_read_packet(buffer, doh, sizeof(doh)); - printf("TEST2: [%s]\n", doh); - - return 0; esl_connect(&handle, "localhost", 8021, NULL, "ClueCon"); commit 526436fd1f8c15b5a8bb82557245d56a5587c536 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Dec 16 11:58:18 2010 -0600 doh diff --git a/libs/esl/src/esl_buffer.c b/libs/esl/src/esl_buffer.c new file mode 100644 index 0000000..51fbfb2 --- /dev/null +++ b/libs/esl/src/esl_buffer.c @@ -0,0 +1,354 @@ +/* + * Copyright (c) 2010, Anthony Minessale II + * 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 original author; nor the names of any 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 OWNER + * 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 "esl_buffer.h" + +static unsigned buffer_id = 0; + +struct esl_buffer { + unsigned char *data; + unsigned char *head; + esl_size_t used; + esl_size_t actually_used; + esl_size_t datalen; + esl_size_t max_len; + esl_size_t blocksize; + unsigned id; + int loops; +}; + + +ESL_DECLARE(esl_status_t) esl_buffer_create(esl_buffer_t **buffer, esl_size_t blocksize, esl_size_t start_len, esl_size_t max_len) +{ + esl_buffer_t *new_buffer; + + new_buffer = malloc(sizeof(*new_buffer)); + if (new_buffer) { + memset(new_buffer, 0, sizeof(*new_buffer)); + + if (start_len) { + new_buffer->data = malloc(start_len); + if (!new_buffer->data) { + free(new_buffer); + return ESL_FAIL; + } + memset(new_buffer->data, 0, start_len); + } + + new_buffer->max_len = max_len; + new_buffer->datalen = start_len; + new_buffer->id = buffer_id++; + new_buffer->blocksize = blocksize; + new_buffer->head = new_buffer->data; + + *buffer = new_buffer; + return ESL_SUCCESS; + } + + return ESL_FAIL; +} + +ESL_DECLARE(esl_size_t) esl_buffer_len(esl_buffer_t *buffer) +{ + + assert(buffer != NULL); + + return buffer->datalen; + +} + + +ESL_DECLARE(esl_size_t) esl_buffer_freespace(esl_buffer_t *buffer) +{ + assert(buffer != NULL); + + + if (buffer->max_len) { + return (esl_size_t) (buffer->max_len - buffer->used); + } + return 1000000; + +} + +ESL_DECLARE(esl_size_t) esl_buffer_inuse(esl_buffer_t *buffer) +{ + assert(buffer != NULL); + + return buffer->used; +} + +ESL_DECLARE(esl_size_t) esl_buffer_seek(esl_buffer_t *buffer, esl_size_t datalen) +{ + esl_size_t reading = 0; + + assert(buffer != NULL); + + if (buffer->used < 1) { + buffer->used = 0; + return 0; + } else if (buffer->used >= datalen) { + reading = datalen; + } else { + reading = buffer->used; + } + + buffer->used = buffer->actually_used - reading; + buffer->head = buffer->data + reading; + + return reading; +} + +ESL_DECLARE(esl_size_t) esl_buffer_toss(esl_buffer_t *buffer, esl_size_t datalen) +{ + esl_size_t reading = 0; + + assert(buffer != NULL); + + if (buffer->used < 1) { + buffer->used = 0; + return 0; + } else if (buffer->used >= datalen) { + reading = datalen; + } else { + reading = buffer->used; + } + + buffer->used -= reading; + buffer->head += reading; + + return buffer->used; +} + +ESL_DECLARE(void) esl_buffer_set_loops(esl_buffer_t *buffer, int loops) +{ + buffer->loops = loops; +} + +ESL_DECLARE(esl_size_t) esl_buffer_read_loop(esl_buffer_t *buffer, void *data, esl_size_t datalen) +{ + esl_size_t len; + if ((len = esl_buffer_read(buffer, data, datalen)) < datalen) { + if (buffer->loops == 0) { + return len; + } + buffer->head = buffer->data; + buffer->used = buffer->actually_used; + len = esl_buffer_read(buffer, (char*)data + len, datalen - len); + buffer->loops--; + } + return len; +} + +ESL_DECLARE(esl_size_t) esl_buffer_read(esl_buffer_t *buffer, void *data, esl_size_t datalen) +{ + esl_size_t reading = 0; + + assert(buffer != NULL); + assert(data != NULL); + + + if (buffer->used < 1) { + buffer->used = 0; + return 0; + } else if (buffer->used >= datalen) { + reading = datalen; + } else { + reading = buffer->used; + } + + memcpy(data, buffer->head, reading); + buffer->used -= reading; + buffer->head += reading; + + /* if (buffer->id == 4) printf("%u o %d = %d\n", buffer->id, (unsigned)reading, (unsigned)buffer->used); */ + return reading; +} + + +ESL_DECLARE(esl_size_t) esl_buffer_packet_count(esl_buffer_t *buffer) +{ + char *pe, *p, *e, *head = (char *) buffer->head; + esl_size_t x = 0; + + assert(buffer != NULL); + + e = (head + buffer->used); + + for (p = head; p && *p && p < e; p++) { + if (*p == '\n') { + pe = p+1; + if (*pe == '\r') pe++; + if (pe <= e && *pe == '\n') { + p = pe++; + x++; + } + } + } + + return x; +} + +ESL_DECLARE(esl_size_t) esl_buffer_read_packet(esl_buffer_t *buffer, void *data, esl_size_t maxlen) +{ + char *pe, *p, *e, *head = (char *) buffer->head; + esl_size_t datalen = 0; + + assert(buffer != NULL); + assert(data != NULL); + + e = (head + buffer->used); + + for (p = head; p && *p && p < e; p++) { + if (*p == '\n') { + pe = p+1; + if (*pe == '\r') pe++; + if (pe <= e && *pe == '\n') { + pe++; + datalen = pe - head; + if (datalen > maxlen) { + datalen = maxlen; + } + break; + } + } + } + + return esl_buffer_read(buffer, data, datalen); +} + +ESL_DECLARE(esl_size_t) esl_buffer_write(esl_buffer_t *buffer, const void *data, esl_size_t datalen) +{ + esl_size_t freespace, actual_freespace; + + assert(buffer != NULL); + assert(data != NULL); + assert(buffer->data != NULL); + + if (!datalen) { + return buffer->used; + } + + actual_freespace = buffer->datalen - buffer->actually_used; + if (actual_freespace < datalen && (!buffer->max_len || (buffer->used + datalen <= buffer->max_len))) { + memmove(buffer->data, buffer->head, buffer->used); + buffer->head = buffer->data; + buffer->actually_used = buffer->used; + } + + freespace = buffer->datalen - buffer->used; + + /* + if (buffer->data != buffer->head) { + memmove(buffer->data, buffer->head, buffer->used); + buffer->head = buffer->data; + } + */ + + if (freespace < datalen) { + esl_size_t new_size, new_block_size; + void *data; + + new_size = buffer->datalen + datalen; + new_block_size = buffer->datalen + buffer->blocksize; + + if (new_block_size > new_size) { + new_size = new_block_size; + } + buffer->head = buffer->data; + data = realloc(buffer->data, new_size); + if (!data) { + return 0; + } + buffer->data = data; + buffer->head = buffer->data; + buffer->datalen = new_size; + } + + + freespace = buffer->datalen - buffer->used; + + if (freespace < datalen) { + return 0; + } else { + memcpy(buffer->head + buffer->used, data, datalen); + buffer->used += datalen; + buffer->actually_used += datalen; + } + /* if (buffer->id == 4) printf("%u i %d = %d\n", buffer->id, (unsigned)datalen, (unsigned)buffer->used); */ + + return buffer->used; +} + +ESL_DECLARE(void) esl_buffer_zero(esl_buffer_t *buffer) +{ + assert(buffer != NULL); + assert(buffer->data != NULL); + + buffer->used = 0; + buffer->actually_used = 0; + buffer->head = buffer->data; +} + +ESL_DECLARE(esl_size_t) esl_buffer_zwrite(esl_buffer_t *buffer, const void *data, esl_size_t datalen) +{ + esl_size_t w; + + if (!(w = esl_buffer_write(buffer, data, datalen))) { + esl_buffer_zero(buffer); + return esl_buffer_write(buffer, data, datalen); + } + + return w; +} + +ESL_DECLARE(void) esl_buffer_destroy(esl_buffer_t **buffer) +{ + if (*buffer) { + free((*buffer)->data); + free(*buffer); + } + + *buffer = NULL; +} + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4: + */ diff --git a/libs/esl/src/include/esl_buffer.h b/libs/esl/src/include/esl_buffer.h new file mode 100644 index 0000000..c7901e4 --- /dev/null +++ b/libs/esl/src/include/esl_buffer.h @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2010, Anthony Minessale II + * 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 original author; nor the names of any 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 OWNER + * 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 "esl.h" +#ifndef ESL_BUFFER_H +#define ESL_BUFFER_H +/** + * @defgroup esl_buffer Buffer Routines + * @ingroup buffer + * The purpose of this module is to make a plain buffering interface that can be used for read/write buffers + * throughout the application. + * @{ + */ +struct esl_buffer; +typedef struct esl_buffer esl_buffer_t; + +/*! \brief Allocate a new dynamic esl_buffer + * \param buffer returned pointer to the new buffer + * \param blocksize length to realloc by as data is added + * \param start_len ammount of memory to reserve initially + * \param max_len length the buffer is allowed to grow to + * \return status + */ +ESL_DECLARE(esl_status_t) esl_buffer_create(esl_buffer_t **buffer, esl_size_t blocksize, esl_size_t start_len, esl_size_t max_len); + +/*! \brief Get the length of a esl_buffer_t + * \param buffer any buffer of type esl_buffer_t + * \return int size of the buffer. + */ +ESL_DECLARE(esl_size_t) esl_buffer_len(esl_buffer_t *buffer); + +/*! \brief Get the freespace of a esl_buffer_t + * \param buffer any buffer of type esl_buffer_t + * \return int freespace in the buffer. + */ +ESL_DECLARE(esl_size_t) esl_buffer_freespace(esl_buffer_t *buffer); + +/*! \brief Get the in use amount of a esl_buffer_t + * \param buffer any buffer of type esl_buffer_t + * \return int ammount of buffer curently in use + */ +ESL_DECLARE(esl_size_t) esl_buffer_inuse(esl_buffer_t *buffer); + +/*! \brief Read data from a esl_buffer_t up to the ammount of datalen if it is available. Remove read data from buffer. + * \param buffer any buffer of type esl_buffer_t + * \param data pointer to the read data to be returned + * \param datalen amount of data to be returned + * \return int ammount of data actually read + */ +ESL_DECLARE(esl_size_t) esl_buffer_read(esl_buffer_t *buffer, void *data, esl_size_t datalen); + +ESL_DECLARE(esl_size_t) esl_buffer_read_packet(esl_buffer_t *buffer, void *data, esl_size_t maxlen); +ESL_DECLARE(esl_size_t) esl_buffer_packet_count(esl_buffer_t *buffer); + +/*! \brief Read data endlessly from a esl_buffer_t + * \param buffer any buffer of type esl_buffer_t + * \param data pointer to the read data to be returned + * \param datalen amount of data to be returned + * \return int ammount of data actually read + * \note Once you have read all the data from the buffer it will loop around. + */ +ESL_DECLARE(esl_size_t) esl_buffer_read_loop(esl_buffer_t *buffer, void *data, esl_size_t datalen); + +/*! \brief Assign a number of loops to read + * \param buffer any buffer of type esl_buffer_t + * \param loops the number of loops (-1 for infinite) + */ +ESL_DECLARE(void) esl_buffer_set_loops(esl_buffer_t *buffer, int32_t loops); + +/*! \brief Write data into a esl_buffer_t up to the length of datalen + * \param buffer any buffer of type esl_buffer_t + * \param data pointer to the data to be written + * \param datalen amount of data to be written + * \return int amount of buffer used after the write, or 0 if no space available + */ +ESL_DECLARE(esl_size_t) esl_buffer_write(esl_buffer_t *buffer, const void *data, esl_size_t datalen); + +/*! \brief Remove data from the buffer + * \param buffer any buffer of type esl_buffer_t + * \param datalen amount of data to be removed + * \return int size of buffer, or 0 if unable to toss that much data + */ +ESL_DECLARE(esl_size_t) esl_buffer_toss(esl_buffer_t *buffer, esl_size_t datalen); + +/*! \brief Remove all data from the buffer + * \param buffer any buffer of type esl_buffer_t + */ +ESL_DECLARE(void) esl_buffer_zero(esl_buffer_t *buffer); + +/*! \brief Destroy the buffer + * \param buffer buffer to destroy + * \note only neccessary on dynamic buffers (noop on pooled ones) + */ +ESL_DECLARE(void) esl_buffer_destroy(esl_buffer_t **buffer); + +/*! \brief Seek to offset from the beginning of the buffer + * \param buffer buffer to seek + * \param datalen offset in bytes + * \return new position + */ +ESL_DECLARE(esl_size_t) esl_buffer_seek(esl_buffer_t *buffer, esl_size_t datalen); + +/** @} */ + +ESL_DECLARE(esl_size_t) esl_buffer_zwrite(esl_buffer_t *buffer, const void *data, esl_size_t datalen); + +#endif +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4: + */ commit 2800ea199d6c233fe0aeee91de3be33dfee19607 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Dec 16 11:34:02 2010 -0600 tune event socket params a bit diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index ee7cfc9..596a953 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -31,8 +31,8 @@ */ #include <switch.h> #define CMD_BUFLEN 1024 * 1000 -#define MAX_QUEUE_LEN 5000 -#define MAX_MISSED 200 +#define MAX_QUEUE_LEN 25000 +#define MAX_MISSED 2000 SWITCH_MODULE_LOAD_FUNCTION(mod_event_socket_load); SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_event_socket_shutdown); SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_socket_runtime); @@ -170,7 +170,7 @@ static switch_status_t socket_logger(const switch_log_node_t *node, switch_log_l if (switch_test_flag(l, LFLAG_LOG) && l->level >= node->level) { switch_log_node_t *dnode = switch_log_node_dup(node); - if (switch_queue_trypush(l->log_queue, dnode) == SWITCH_STATUS_SUCCESS) { + if (switch_queue_push(l->log_queue, dnode) == SWITCH_STATUS_SUCCESS) { if (l->lost_logs) { int ll = l->lost_logs; switch_event_t *event; @@ -366,7 +366,7 @@ static void event_handler(switch_event_t *event) if (send) { if (switch_event_dup(&clone, event) == SWITCH_STATUS_SUCCESS) { - if (switch_queue_trypush(l->event_queue, clone) == SWITCH_STATUS_SUCCESS) { + if (switch_queue_push(l->event_queue, clone) == SWITCH_STATUS_SUCCESS) { if (l->lost_events) { int le = l->lost_events; l->lost_events = 0; @@ -1233,7 +1233,7 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event, if (switch_channel_get_state(chan) < CS_HANGUP && switch_channel_test_flag(chan, CF_DIVERT_EVENTS)) { switch_event_t *e = NULL; while (switch_core_session_dequeue_event(listener->session, &e, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) { - if (switch_queue_trypush(listener->event_queue, e) != SWITCH_STATUS_SUCCESS) { + if (switch_queue_push(listener->event_queue, e) != SWITCH_STATUS_SUCCESS) { switch_core_session_queue_event(listener->session, &e); break; } diff --git a/src/switch_event.c b/src/switch_event.c index f782c15..dce42f8 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -339,7 +339,7 @@ static void *SWITCH_THREAD_FUNC switch_event_thread(switch_thread_t *thread, voi launch_dispatch_threads(SOFT_MAX_DISPATCH + 1, DISPATCH_QUEUE_LEN, RUNTIME_POOL); switch_mutex_unlock(EVENT_QUEUE_MUTEX); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Out of threads!\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Out of event dispatch threads! Slowing things down.\n"); switch_yield(1000000); } } commit 2081bf97b9836f5299c22edbb1ead077842ea2bc Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Dec 16 11:33:38 2010 -0600 use a packet buffer for ESL diff --git a/Makefile.am b/Makefile.am index da89572..df1ee2e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -276,7 +276,8 @@ bin_PROGRAMS = freeswitch fs_cli fs_ivrd tone2wav fs_encode ## ## fs_cli () ## -fs_cli_SOURCES = libs/esl/src/esl.c libs/esl/src/esl_config.c libs/esl/src/esl_event.c libs/esl/src/esl_threadmutex.c libs/esl/fs_cli.c libs/esl/src/esl_json.c +fs_cli_SOURCES = libs/esl/src/esl.c libs/esl/src/esl_config.c libs/esl/src/esl_event.c \ + libs/esl/src/esl_threadmutex.c libs/esl/fs_cli.c libs/esl/src/esl_json.c libs/esl/src/esl_buffer.c fs_cli_CFLAGS = $(AM_CFLAGS) -I$(switch_srcdir)/libs/esl/src/include fs_cli_LDFLAGS = $(AM_LDFLAGS) -lpthread $(ESL_LDFLAGS) -lm @@ -304,7 +305,8 @@ tone2wav_LDADD = libfreeswitch.la ## ## fs_ivrd () ## -fs_ivrd_SOURCES = libs/esl/src/esl.c libs/esl/src/esl_config.c libs/esl/src/esl_event.c libs/esl/src/esl_threadmutex.c libs/esl/ivrd.c libs/esl/src/esl_json.c +fs_ivrd_SOURCES = libs/esl/src/esl.c libs/esl/src/esl_config.c libs/esl/src/esl_event.c \ + libs/esl/src/esl_threadmutex.c libs/esl/ivrd.c libs/esl/src/esl_json.c libs/esl/src/esl_buffer.c fs_ivrd_CFLAGS = $(AM_CFLAGS) -I$(switch_srcdir)/libs/esl/src/include fs_ivrd_LDFLAGS = $(AM_LDFLAGS) -lpthread $(ESL_LDFLAGS) -lm diff --git a/libs/esl/Makefile b/libs/esl/Makefile index a180406..ab50bac 100644 --- a/libs/esl/Makefile +++ b/libs/esl/Makefile @@ -9,9 +9,9 @@ CXXFLAGS=$(BASE_FLAGS) -Wall -Werror -Wno-unused-variable MYLIB=libesl.a LIBS=-lncurses -lpthread -lesl -lm LDFLAGS=-L. -OBJS=src/esl.o src/esl_event.o src/esl_threadmutex.o src/esl_config.o src/esl_json.o -SRC=src/esl.c src/esl_json.c src/esl_event.c src/esl_threadmutex.c src/esl_config.c src/esl_oop.cpp src/esl_json.c -HEADERS=src/include/esl_config.h src/include/esl_event.h src/include/esl.h src/include/esl_threadmutex.h src/include/esl_oop.h src/include/esl_json.h +OBJS=src/esl.o src/esl_event.o src/esl_threadmutex.o src/esl_config.o src/esl_json.o src/esl_buffer.o +SRC=src/esl.c src/esl_json.c src/esl_event.c src/esl_threadmutex.c src/esl_config.c src/esl_oop.cpp src/esl_json.c src/esl_buffer.c +HEADERS=src/include/esl_config.h src/include/esl_event.h src/include/esl.h src/include/esl_threadmutex.h src/include/esl_oop.h src/include/esl_json.h src/include/esl_buffer.h SOLINK=-shared -Xlinker -x # comment the next line to disable c++ (no swig mods for you then) OBJS += src/esl_oop.o diff --git a/libs/esl/src/esl.c b/libs/esl/src/esl.c index ce582d3..3397dbf 100644 --- a/libs/esl/src/esl.c +++ b/libs/esl/src/esl.c @@ -428,6 +428,10 @@ ESL_DECLARE(esl_status_t) esl_attach_handle(esl_handle_t *handle, esl_socket_t s esl_mutex_create(&handle->mutex); } + if (!handle->packet_buf) { + esl_buffer_create(&handle->packet_buf, BUF_CHUNK, BUF_START, 0); + } + handle->connected = 1; esl_send_recv(handle, "connect\n\n"); @@ -632,6 +636,10 @@ ESL_DECLARE(esl_status_t) esl_connect_timeout(esl_handle_t *handle, const char * if (!handle->mutex) { esl_mutex_create(&handle->mutex); } + + if (!handle->packet_buf) { + esl_buffer_create(&handle->packet_buf, BUF_CHUNK, BUF_START, 0); + } handle->sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); @@ -805,6 +813,11 @@ ESL_DECLARE(esl_status_t) esl_disconnect(esl_handle_t *handle) esl_mutex_destroy(&mutex); } + if (handle->packet_buf) { + esl_buffer_destroy(&handle->packet_buf); + } + + return status; } @@ -825,7 +838,7 @@ ESL_DECLARE(esl_status_t) esl_recv_event_timed(esl_handle_t *handle, uint32_t ms if (check_q) { esl_mutex_lock(handle->mutex); - if (handle->race_event) { + if (handle->race_event || esl_buffer_packet_count(handle->packet_buf)) { esl_mutex_unlock(handle->mutex); return esl_recv_event(handle, check_q, save_event); } @@ -894,12 +907,15 @@ ESL_DECLARE(esl_status_t) esl_recv_event_timed(esl_handle_t *handle, uint32_t ms } +static esl_ssize_t handle_recv(esl_handle_t *handle, void *data, esl_size_t datalen) +{ + return recv(handle->sock, data, datalen, 0); +} ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, int check_q, esl_event_t **save_event) { char *c; esl_ssize_t rrval; - int crc = 0; esl_event_t *revent = NULL; char *beg; char *hname, *hval; @@ -907,7 +923,6 @@ ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, int check_q, esl_ char *cl; esl_ssize_t len; int zc = 0; - int bread = 0; if (!handle || !handle->connected || handle->sock == ESL_SOCK_INVALID) { return ESL_FAIL; @@ -916,9 +931,7 @@ ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, int check_q, esl_ esl_mutex_lock(handle->mutex); if (!handle->connected || handle->sock == ESL_SOCK_INVALID) { - handle->connected = 0; - esl_mutex_unlock(handle->mutex); - return ESL_FAIL; + goto fail; } esl_event_safe_destroy(&handle->last_event); @@ -932,76 +945,62 @@ ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, int check_q, esl_ goto parse_event; } - memset(handle->header_buf, 0, sizeof(handle->header_buf)); - - c = handle->header_buf; - beg = c; + + while(!revent && handle->connected) { + esl_size_t len; + + if ((len = esl_buffer_read_packet(handle->packet_buf, handle->socket_buf, sizeof(handle->socket_buf)))) { + char *data = (char *) handle->socket_buf; + char *p, *e; + + esl_event_create(&revent, ESL_EVENT_CLONE); + revent->event_id = ESL_EVENT_SOCKET_DATA; + esl_event_add_header_string(revent, ESL_STACK_BOTTOM, "Event-Name", "SOCKET_DATA"); + + hname = p = data; + while(p) { + hname = p; + p = NULL; + + if ((hval = strchr(hname, ':'))) { + *hval++ = '\0'; + while(*hval == ' ' || *hval == '\t') hval++; + + if ((e = strchr(hval, '\n'))) { + *e++ = '\0'; + while(*e == '\n' || *e == '\r') e++; + + if (hname && hval) { + esl_url_decode(hval); + esl_log(ESL_LOG_DEBUG, "RECV HEADER [%s] = [%s]\n", hname, hval); + esl_event_add_header_string(revent, ESL_STACK_BOTTOM, hname, hval); + } + + p = e; + } + } + } - while(handle->connected) { - if (bread + 2 >= sizeof(handle->header_buf)) { - esl_log(ESL_LOG_CRIT, "OUT OF BUFFER SPACE!\n"); - handle->connected = 0; - esl_mutex_unlock(handle->mutex); - return ESL_DISCONNECTED; + break; } - rrval = recv(handle->sock, c, 1, 0); + rrval = handle_recv(handle, handle->socket_buf, sizeof(handle->socket_buf)); + if (rrval == 0) { if (++zc >= 100) { - handle->connected = 0; - esl_mutex_unlock(handle->mutex); - return ESL_DISCONNECTED; + goto fail; } + continue; } else if (rrval < 0) { strerror_r(handle->errnum, handle->err, sizeof(handle->err)); goto fail; - } else { - zc = 0; - - if (*c == '\n') { - - *(c+1) = '\0'; - - if (++crc == 2) { - break; - } - - if (!revent) { - esl_event_create(&revent, ESL_EVENT_CLONE); - revent->event_id = ESL_EVENT_SOCKET_DATA; - esl_event_add_header_string(revent, ESL_STACK_BOTTOM, "Event-Name", "SOCKET_DATA"); - - } - - hname = beg; - hval = col = NULL; - - if (hname && (col = strchr(hname, ':'))) { - hval = col + 1; - *col = '\0'; - while(*hval == ' ') hval++; - } - - *c = '\0'; - - if (hname && hval) { - esl_url_decode(hval); - esl_log(ESL_LOG_DEBUG, "RECV HEADER [%s] = [%s]\n", hname, hval); - esl_event_add_header_string(revent, ESL_STACK_BOTTOM, hname, hval); - } + } - c = beg; - bread = 0; - continue; - - } else { - crc = 0; - } + zc = 0; - c++; - } + esl_buffer_write(handle->packet_buf, handle->socket_buf, rrval); } - + if (!revent) { goto fail; } @@ -1016,12 +1015,28 @@ ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, int check_q, esl_ *(body + len) = '\0'; do { - esl_ssize_t r; - if ((r = recv(handle->sock, body + sofar, len - sofar, 0)) < 0) { - strerror_r(handle->errnum, handle->err, sizeof(handle->err)); - goto fail; + esl_ssize_t r,s = esl_buffer_inuse(handle->packet_buf); + + if (s >= len) { + sofar = esl_buffer_read(handle->packet_buf, body, len); + } else { + r = handle_recv(handle, handle->socket_buf, sizeof(handle->socket_buf)); + + if (r < 0) { + strerror_r(handle->errnum, handle->err, sizeof(handle->err)); + goto fail; + } else if (r == 0) { + if (++zc >= 100) { + goto fail; + } + continue; + } + + zc = 0; + + esl_buffer_write(handle->packet_buf, handle->socket_buf, r); } - sofar += r; + } while (sofar < len); revent->body = body; @@ -1123,6 +1138,8 @@ ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, int check_q, esl_ fail: + esl_mutex_unlock(handle->mutex); + handle->connected = 0; return ESL_FAIL; diff --git a/libs/esl/src/include/esl.h b/libs/esl/src/include/esl.h index 9f28c3d..99ab53a 100644 --- a/libs/esl/src/include/esl.h +++ b/libs/esl/src/include/esl.h @@ -251,6 +251,7 @@ typedef int esl_filehandle_t; #include "esl_json.h" typedef int16_t esl_port_t; +typedef size_t esl_size_t; typedef enum { ESL_SUCCESS, @@ -259,7 +260,11 @@ typedef enum { ESL_DISCONNECTED } esl_status_t; +#define BUF_CHUNK 65536 * 50 +#define BUF_START 65536 * 100 + #include <esl_threadmutex.h> +#include <esl_buffer.h> /*! \brief A handle that will hold the socket information and different events received. */ @@ -273,7 +278,8 @@ typedef struct { /*! The error number reported by the OS */ int errnum; /*! The inner contents received by the socket. Used only internally. */ - char header_buf[4196]; + esl_buffer_t *packet_buf; + char socket_buf[65536]; /*! Last command reply */ char last_reply[1024]; /*! Las command reply when called with esl_send_recv */ diff --git a/libs/esl/testclient.c b/libs/esl/testclient.c index 9fa271f..a031836 100644 --- a/libs/esl/testclient.c +++ b/libs/esl/testclient.c @@ -6,6 +6,47 @@ int main(void) { esl_handle_t handle = {{0}}; + esl_buffer_t *buffer; + char doh[65536]; + + esl_buffer_create(&buffer, 32 * 1024, 32 * 1024, 0); + + snprintf(doh, sizeof(doh), "TEST 1 FOO BAR 1234\n"); + esl_buffer_write(buffer, doh, strlen(doh)); + esl_buffer_write(buffer, doh, strlen(doh)); + esl_buffer_write(buffer, doh, strlen(doh)); + snprintf(doh, sizeof(doh), "TEST 1 END\n\n"); + esl_buffer_write(buffer, doh, strlen(doh)); + + + + snprintf(doh, sizeof(doh), "TEST 2 BAR FOO 4321\n"); + esl_buffer_write(buffer, doh, strlen(doh)); + esl_buffer_write(buffer, doh, strlen(doh)); + esl_buffer_write(buffer, doh, strlen(doh)); + snprintf(doh, sizeof(doh), "TEST 2 END\n\n"); + esl_buffer_write(buffer, doh, strlen(doh)); + + snprintf(doh, sizeof(doh), "TEST 2 BAR FOO 4321\n"); + esl_buffer_write(buffer, doh, strlen(doh)); + esl_buffer_write(buffer, doh, strlen(doh)); + esl_buffer_write(buffer, doh, strlen(doh)); + snprintf(doh, sizeof(doh), "TEST 2 END\n\n"); + esl_buffer_write(buffer, doh, strlen(doh)); + + printf("COUNT %ld\n", esl_buffer_packet_count(buffer)); + + memset(doh, 0, sizeof(doh)); + esl_buffer_read_packet(buffer, doh, sizeof(doh)); + printf("TEST: [%s]\n", doh); + + memset(doh, 0, sizeof(doh)); + + + esl_buffer_read_packet(buffer, doh, sizeof(doh)); + printf("TEST2: [%s]\n", doh); + + return 0; esl_connect(&handle, "localhost", 8021, NULL, "ClueCon"); commit c44b7a74651d2b7ae896a9180ce1f84433c540ed Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Dec 16 10:10:15 2010 -0600 fix formatting in debug mode diff --git a/libs/stfu/stfu.c b/libs/stfu/stfu.c index 4965b12..2ffb86f 100644 --- a/libs/stfu/stfu.c +++ b/libs/stfu/stfu.c @@ -664,20 +664,21 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i) } if (stfu_log != null_logger && i->debug) { + stfu_log(STFU_LOG_EMERG, "%s ", i->name); for(y = 0; y < i->out_queue->array_size; y++) { - if ((y % 5) == 0) stfu_log(STFU_LOG_EMERG, "\n%s", i->name); + if ((y % 5) == 0) stfu_log(STFU_LOG_EMERG, "\n%s ", i->name); frame = &i->out_queue->array[y]; stfu_log(STFU_LOG_EMERG, "%u:%u\t", frame->ts, frame->ts / i->samples_per_packet); } - stfu_log(STFU_LOG_EMERG, "%s\n", i->name); + stfu_log(STFU_LOG_EMERG, "\n%s ", i->name); for(y = 0; y < i->in_queue->array_size; y++) { - if ((y % 5) == 0) stfu_log(STFU_LOG_EMERG, "\n%s", i->name); + if ((y % 5) == 0) stfu_log(STFU_LOG_EMERG, "\n%s ", i->name); frame = &i->in_queue->array[y]; stfu_log(STFU_LOG_EMERG, "%u:%u\t", frame->ts, frame->ts / i->samples_per_packet); } - stfu_log(STFU_LOG_EMERG, "%s\n\n\n", i->name); + stfu_log(STFU_LOG_EMERG, "\n%s\n\n\n", i->name); } commit 3ff07445d4846f5b6c7b5338b396e60d330074fd Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Dec 16 09:45:43 2010 -0600 add CF_DIALPLAN diff --git a/src/include/switch_types.h b/src/include/switch_types.h index d020775..e04f437 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1095,6 +1095,7 @@ typedef enum { CF_BRIDGE_NOWRITE, CF_RECOVERED, CF_JITTERBUFFER, + CF_DIALPLAN, /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ CF_FLAG_MAX } switch_channel_flag_t; diff --git a/src/switch_core_state_machine.c b/src/switch_core_state_machine.c index ccd6dac..59cc17d 100644 --- a/src/switch_core_state_machine.c +++ b/src/switch_core_state_machine.c @@ -123,7 +123,9 @@ static void switch_core_standard_on_routing(switch_core_session_t *session) } } - if (!count) { + if (count) { + switch_channel_set_flag(session->channel, CF_DIALPLAN); + } else { if (switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { if (switch_channel_test_flag(session->channel, CF_ANSWERED)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index ceab8b1..aa5ddb9 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -100,7 +100,7 @@ static void send_display(switch_core_session_t *session, switch_core_session_t * caller_channel = switch_core_session_get_channel(session); caller_profile = switch_channel_get_caller_profile(caller_channel); - if (switch_channel_direction(caller_channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { + if (switch_channel_direction(caller_channel) == SWITCH_CALL_DIRECTION_OUTBOUND && !switch_channel_test_flag(caller_channel, CF_DIALPLAN)) { name = caller_profile->callee_id_name; number = caller_profile->callee_id_number; commit 43393f26d102ef63b24e776d33f53b5f44b84d3c Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Dec 15 20:59:33 2010 -0600 normalize tests for outbound channels to use switch_channel_direction instead of testing for CF_OUTBOUND diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 38197bb..e0961e3 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -802,7 +802,7 @@ static switch_status_t channel_receive_message_cas(switch_core_session_t *sessio phy_id = ftdm_channel_get_ph_id(tech_pvt->ftdmchan); ftdm_log(FTDM_LOG_DEBUG, "Got Freeswitch message in R2 channel %d [%d]\n", phy_id, msg->message_id); - if (switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { return SWITCH_STATUS_SUCCESS; } @@ -849,7 +849,7 @@ static switch_status_t channel_receive_message_b(switch_core_session_t *session, return SWITCH_STATUS_SUCCESS; } - if (switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { return SWITCH_STATUS_SUCCESS; } @@ -892,7 +892,7 @@ static switch_status_t channel_receive_message_fxo(switch_core_session_t *sessio return SWITCH_STATUS_FALSE; } - if (switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { return SWITCH_STATUS_SUCCESS; } @@ -924,7 +924,7 @@ static switch_status_t channel_receive_message_fxs(switch_core_session_t *sessio return SWITCH_STATUS_FALSE; } - if (switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { return SWITCH_STATUS_SUCCESS; } @@ -981,7 +981,7 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s switch (msg->message_id) { case SWITCH_MESSAGE_INDICATE_PROGRESS: case SWITCH_MESSAGE_INDICATE_ANSWER: - if (!switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) { if ((var = switch_channel_get_variable(channel, "freetdm_pre_buffer_size"))) { int tmp = atoi(var); if (tmp > -1) { @@ -1363,7 +1363,6 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi tech_pvt->caller_profile = caller_profile; - switch_channel_set_flag(channel, CF_OUTBOUND); switch_channel_set_state(channel, CS_INIT); if (ftdm_channel_add_token(ftdmchan, switch_core_session_get_uuid(*new_session), ftdm_channel_get_token_count(ftdmchan)) != FTDM_SUCCESS) { switch_core_session_destroy(new_session); @@ -1811,7 +1810,9 @@ static FIO_SIGNAL_CB_FUNCTION(on_fxs_signal) switch_clear_flag_locked(tech_pvt, TFLAG_HOLD); } - if (channel_a && channel_b && !switch_channel_test_flag(channel_a, CF_OUTBOUND) && !switch_channel_test_flag(channel_b, CF_OUTBOUND)) { + if (channel_a && channel_b && switch_channel_direction(channel_a) == SWITCH_CALL_DIRECTION_INBOUND && + switch_channel_direction(channel_b) == SWITCH_CALL_DIRECTION_INBOUND) { + cause = SWITCH_CAUSE_ATTENDED_TRANSFER; if (br_a_uuid && br_b_uuid) { switch_ivr_uuid_bridge(br_a_uuid, br_b_uuid); diff --git a/libs/openzap/mod_openzap/mod_openzap.c b/libs/openzap/mod_openzap/mod_openzap.c index 8425372..6a75dc8 100644 --- a/libs/openzap/mod_openzap/mod_openzap.c +++ b/libs/openzap/mod_openzap/mod_openzap.c @@ -821,7 +821,7 @@ static switch_status_t channel_receive_message_cas(switch_core_session_t *sessio switch (msg->message_id) { case SWITCH_MESSAGE_INDICATE_RINGING: { - if (switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { zap_set_flag_locked(tech_pvt->zchan, ZAP_CHANNEL_PROGRESS); } else { zap_set_state_locked_wait(tech_pvt->zchan, ZAP_CHANNEL_STATE_PROGRESS); @@ -830,7 +830,7 @@ static switch_status_t channel_receive_message_cas(switch_core_session_t *sessio break; case SWITCH_MESSAGE_INDICATE_PROGRESS: { - if (switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { zap_set_flag_locked(tech_pvt->zchan, ZAP_CHANNEL_PROGRESS); zap_set_flag_locked(tech_pvt->zchan, ZAP_CHANNEL_MEDIA); } else { @@ -841,7 +841,7 @@ static switch_status_t channel_receive_message_cas(switch_core_session_t *sessio break; case SWITCH_MESSAGE_INDICATE_ANSWER: { - if (switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { zap_set_flag_locked(tech_pvt->zchan, ZAP_CHANNEL_ANSWERED); } else { /* lets make the ozmod_r2 module life easier by moving thru each @@ -888,7 +888,7 @@ static switch_status_t channel_receive_message_b(switch_core_session_t *session, switch (msg->message_id) { case SWITCH_MESSAGE_INDICATE_RINGING: { - if (switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { zap_set_flag(tech_pvt->zchan, ZAP_CHANNEL_PROGRESS); } else { zap_set_state_wait(tech_pvt->zchan, ZAP_CHANNEL_STATE_PROGRESS); @@ -897,7 +897,7 @@ static switch_status_t channel_receive_message_b(switch_core_session_t *session, break; case SWITCH_MESSAGE_INDICATE_PROGRESS: { - if (switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { zap_set_flag(tech_pvt->zchan, ZAP_CHANNEL_PROGRESS); zap_set_flag(tech_pvt->zchan, ZAP_CHANNEL_MEDIA); } else { @@ -914,7 +914,7 @@ static switch_status_t channel_receive_message_b(switch_core_session_t *session, break; case SWITCH_MESSAGE_INDICATE_ANSWER: { - if (switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { zap_set_flag(tech_pvt->zchan, ZAP_CHANNEL_ANSWERED); } else { /* Don't skip messages in the ISDN call setup @@ -957,7 +957,7 @@ static switch_status_t channel_receive_message_fxo(switch_core_session_t *sessio switch (msg->message_id) { case SWITCH_MESSAGE_INDICATE_PROGRESS: case SWITCH_MESSAGE_INDICATE_ANSWER: - if (switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { zap_set_flag_locked(tech_pvt->zchan, ZAP_CHANNEL_ANSWERED); zap_set_flag_locked(tech_pvt->zchan, ZAP_CHANNEL_PROGRESS); zap_set_flag_locked(tech_pvt->zchan, ZAP_CHANNEL_MEDIA); @@ -991,7 +991,7 @@ static switch_status_t channel_receive_message_fxs(switch_core_session_t *sessio switch (msg->message_id) { case SWITCH_MESSAGE_INDICATE_PROGRESS: case SWITCH_MESSAGE_INDICATE_ANSWER: - if (!switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) { zap_set_flag_locked(tech_pvt->zchan, ZAP_CHANNEL_ANSWERED); zap_set_flag_locked(tech_pvt->zchan, ZAP_CHANNEL_PROGRESS); zap_set_flag_locked(tech_pvt->zchan, ZAP_CHANNEL_MEDIA); @@ -1000,7 +1000,7 @@ static switch_status_t channel_receive_message_fxs(switch_core_session_t *sessio } break; case SWITCH_MESSAGE_INDICATE_RINGING: - if (!switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) { if (!switch_channel_test_flag(channel, CF_ANSWERED) && !switch_channel_test_flag(channel, CF_EARLY_MEDIA) && @@ -1052,7 +1052,7 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s switch (msg->message_id) { case SWITCH_MESSAGE_INDICATE_PROGRESS: case SWITCH_MESSAGE_INDICATE_ANSWER: - if (!switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) { if ((var = switch_channel_get_variable(channel, "openzap_pre_buffer_size"))) { int tmp = atoi(var); if (tmp > -1) { @@ -1327,7 +1327,6 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi tech_pvt->caller_profile = caller_profile; - switch_channel_set_flag(channel, CF_OUTBOUND); switch_channel_set_state(channel, CS_INIT); if (zap_channel_add_token(zchan, switch_core_session_get_uuid(*new_session), zchan->token_count) != ZAP_SUCCESS) { switch_core_session_destroy(new_session); @@ -1678,7 +1677,9 @@ static ZIO_SIGNAL_CB_FUNCTION(on_fxs_signal) switch_clear_flag_locked(tech_pvt, TFLAG_HOLD); } - if (channel_a && channel_b && !switch_channel_test_flag(channel_a, CF_OUTBOUND) && !switch_channel_test_flag(channel_b, CF_OUTBOUND)) { + if (channel_a && channel_b && switch_channel_direction(channel_a) == SWITCH_CALL_DIRECTION_INBOUND && + switch_channel_direction(channel_b) == SWITCH_CALL_DIRECTION_INBOUND) { + cause = SWITCH_CAUSE_ATTENDED_TRANSFER; if (br_a_uuid && br_b_uuid) { switch_ivr_uuid_bridge(br_a_uuid, br_b_uuid); commit 93cc3dc556939a99288b50d8324d0299d0c61b86 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Dec 15 20:59:23 2010 -0600 normalize tests for outbound channels to use switch_channel_direction instead of testing for CF_OUTBOUND diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 9b170a3..53ce82b 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -2456,7 +2456,7 @@ static void conference_loop_output(conference_member_t *member) switch_event_destroy(&event); } - if (switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { /* test to see if outbound channel has answered */ if (switch_channel_test_flag(channel, CF_ANSWERED) && !switch_test_flag(member->conference, CFLAG_ANSWERED)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_DEBUG, @@ -2599,7 +2599,7 @@ static void conference_loop_output(conference_member_t *member) switch_channel_cause2str(switch_channel_get_cause(channel))); /* if it's an outbound channel, store the release cause in the conference struct, we might need it */ - if (switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { member->conference->bridge_hangup_cause = switch_channel_get_cause(channel); } @@ -5446,7 +5446,7 @@ SWITCH_STANDARD_APP(conference_function) launch_conference_thread(conference); } else { - int enforce_security = !switch_channel_test_flag(channel, CF_OUTBOUND); + int enforce_security = switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND; const char *pvar = switch_channel_get_variable(channel, "conference_enforce_security"); if (pvar) { @@ -5655,7 +5655,7 @@ SWITCH_STANDARD_APP(conference_function) } else { /* if we're not using "bridge:" set the conference answered flag */ /* and this isn't an outbound channel, answer the call */ - if (!switch_channel_test_flag(channel, CF_OUTBOUND)) + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) switch_set_flag(conference, CFLAG_ANSWERED); } diff --git a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp index 7e20b7c..13e4335 100644 --- a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp +++ b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp @@ -1324,7 +1324,6 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi caller_profile = tech_pvt->caller_profile; caller_profile->destination_number = rdest; - switch_channel_set_flag(channel, CF_OUTBOUND); switch_set_flag(tech_pvt, TFLAG_OUTBOUND); switch_channel_set_state(channel, CS_INIT); gsmopen_call(tech_pvt, rdest, 30); diff --git a/src/mod/endpoints/mod_h323/mod_h323.cpp b/src/mod/endpoints/mod_h323/mod_h323.cpp index 74fb6ae..3d79917 100644 --- a/src/mod/endpoints/mod_h323/mod_h323.cpp +++ b/src/mod/endpoints/mod_h323/mod_h323.cpp @@ -725,7 +725,6 @@ FSH323Connection::FSH323Connection(FSH323EndPoint& endpoint, H323Transport* tran name += outbound_profile->destination_number; switch_channel_set_name(m_fsChannel, name); - switch_channel_set_flag(m_fsChannel, CF_OUTBOUND); switch_channel_set_state(m_fsChannel, CS_INIT); } @@ -1508,7 +1507,7 @@ switch_status_t FSH323Connection::receive_message(switch_core_session_message_t break; } case SWITCH_MESSAGE_INDICATE_ANSWER: { - if (switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { return SWITCH_STATUS_FALSE; } AnsweringCall(H323Connection::AnswerCallNow); diff --git a/src/mod/endpoints/mod_khomp/src/khomp_pvt.cpp b/src/mod/endpoints/mod_khomp/src/khomp_pvt.cpp index 3abbe3e..1b126eb 100644 --- a/src/mod/endpoints/mod_khomp/src/khomp_pvt.cpp +++ b/src/mod/endpoints/mod_khomp/src/khomp_pvt.cpp @@ -868,7 +868,6 @@ switch_status_t Board::KhompPvt::justStart(switch_caller_profile_t *profile) _caller_profile = switch_caller_profile_clone(_session, profile); switch_channel_set_caller_profile(channel, _caller_profile); - switch_channel_set_flag(channel, CF_OUTBOUND); switch_channel_set_state(channel, CS_INIT); } else diff --git a/src/mod/endpoints/mod_opal/mod_opal.cpp b/src/mod/endpoints/mod_opal/mod_opal.cpp index 8935bbb..0760588 100644 --- a/src/mod/endpoints/mod_opal/mod_opal.cpp +++ b/src/mod/endpoints/mod_opal/mod_opal.cpp @@ -580,7 +580,6 @@ FSConnection::FSConnection(OpalCall & call, FSEndPoint & endpoint, void* userDat name += outbound_profile->destination_number; switch_channel_set_name(m_fsChannel, name); - switch_channel_set_flag(m_fsChannel, CF_OUTBOUND); switch_channel_set_state(m_fsChannel, CS_INIT); } } @@ -966,7 +965,7 @@ switch_status_t FSConnection::receive_message(switch_core_session_message_t *msg It would only happen if someone called switch_channel_answer() instead of switch_channel_mark_answered() on an outbound call. it should not do anything if someone does it by accident somewhere hense this in both cases: - if (switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { return SWITCH_STATUS_FALSE; } @@ -1025,7 +1024,7 @@ switch_status_t FSConnection::receive_message(switch_core_session_message_t *msg { int fixed = 0; - if (switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { return SWITCH_STATUS_FALSE; } diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index 2df8937..5320ca5 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -1080,8 +1080,6 @@ switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, swi switch_channel_set_caller_profile(nchannel, caller_profile); tech_pvt->caller_profile = caller_profile; - switch_channel_set_flag(nchannel, CF_OUTBOUND); - if ((sql = switch_mprintf( "INSERT INTO skinny_active_lines " "(device_name, device_instance, line_instance, channel_uuid, call_id, call_state) " diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index c03e3ce..9bf9d9f 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -343,7 +343,7 @@ switch_status_t skinny_session_send_call_info(switch_core_session_t *session, li zstr((called_party_number = switch_channel_get_variable(channel, "destination_number")))) { called_party_number = "0000000000"; } - if (switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { call_type = SKINNY_INBOUND_CALL; } else { call_type = SKINNY_OUTBOUND_CALL; @@ -1674,7 +1674,7 @@ switch_status_t skinny_handle_open_receive_channel_ack_message(listener_t *liste ); switch_set_flag_locked(tech_pvt, TFLAG_IO); - if (switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { switch_channel_mark_answered(channel); } if (switch_channel_test_flag(channel, CF_HOLD)) { diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index 65c1b12..56188a4 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -1364,7 +1364,6 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi caller_profile = tech_pvt->caller_profile; caller_profile->destination_number = rdest; - switch_channel_set_flag(channel, CF_OUTBOUND); switch_mutex_lock(tech_pvt->flag_mutex); switch_set_flag(tech_pvt, TFLAG_OUTBOUND); switch_mutex_unlock(tech_pvt->flag_mutex); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 4a3c7c0..07e125a 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -508,7 +508,7 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session) TAG_IF(!zstr(bye_headers), SIPTAG_HEADER_STR(bye_headers)), TAG_END()); } } else { - if (switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Sending CANCEL to %s\n", switch_channel_get_name(channel)); if (!tech_pvt->got_bye) { switch_channel_set_variable(channel, "sip_hangup_disposition", "send_cancel"); @@ -573,7 +573,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session) char *sticky = NULL; const char *call_info = switch_channel_get_variable(channel, "presence_call_info_full"); - if (sofia_test_flag(tech_pvt, TFLAG_ANS) || switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (sofia_test_flag(tech_pvt, TFLAG_ANS) || switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { return SWITCH_STATUS_SUCCESS; } @@ -653,7 +653,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session) switch_channel_clear_flag(channel, CF_PROXY_MODE); } - if (!switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND)) { + if (switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_INBOUND) { const char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE); tech_pvt->num_codecs = 0; sofia_glue_tech_prepare_codecs(tech_pvt); @@ -1683,7 +1683,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi sofia_glue_tech_set_local_sdp(tech_pvt, NULL, SWITCH_FALSE); if (!(switch_channel_test_flag(channel, CF_ANSWERED) || switch_channel_test_flag(channel, CF_EARLY_MEDIA))) { - if (!switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND)) { + if (switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_INBOUND) { const char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE); tech_pvt->num_codecs = 0; @@ -2198,7 +2198,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi } else { if (sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) || !tech_pvt->iananame) { sofia_clear_flag_locked(tech_pvt, TFLAG_LATE_NEGOTIATION); - if (!switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND)) { + if (switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_INBOUND) { const char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE); tech_pvt->num_codecs = 0; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 7e4e34f..94eab68 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -357,7 +357,7 @@ void sofia_handle_sip_i_notify(switch_core_session_t *session, int status, goto error; } - if (!switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) { switch_channel_answer(channel); switch_channel_set_variable(channel, "auto_answer_destination", switch_channel_get_variable(channel, "destination_number")); switch_ivr_session_transfer(session, "auto_answer", NULL, NULL); @@ -4114,7 +4114,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status } - if (channel && sip && (status == 300 || status == 301 || status == 302 || status == 305) && switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (channel && sip && (status == 300 || status == 301 || status == 302 || status == 305) && switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { sip_contact_t *p_contact = sip->sip_contact; int i = 0; char var_name[80]; @@ -4645,7 +4645,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, status = 183; } - if (channel && (status == 180 || status == 183) && switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (channel && (status == 180 || status == 183) && switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { const char *val; if ((val = switch_channel_get_variable(channel, "sip_auto_answer")) && switch_true(val)) { nua_notify(nh, NUTAG_NEWSUB(1), NUTAG_SUBSTATE(nua_substate_active), SIPTAG_EVENT_STR("talk"), TAG_END()); @@ -4692,7 +4692,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, if (r_sdp) { if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) { - if (switch_channel_test_flag(channel, CF_PROXY_MEDIA) && !switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND)) { + if (switch_channel_test_flag(channel, CF_PROXY_MEDIA) && switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_INBOUND) { switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "PROXY MEDIA"); } sofia_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA); @@ -4715,7 +4715,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, } goto done; } else { - if (sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) && !switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND)) { + if (sofia_test_flag(tech_pvt, TFLAG_LATE_NEGOTIATION) && switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_INBOUND) { switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "DELAYED NEGOTIATION"); } else { if (sofia_glue_tech_media(tech_pvt, (char *) r_sdp) != SWITCH_STATUS_SUCCESS) { @@ -4910,7 +4910,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, sofia_glue_tech_set_local_sdp(tech_pvt, NULL, SWITCH_FALSE); if (!switch_channel_media_ready(channel)) { - if (!switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND)) { + if (switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_INBOUND) { //const char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE); tech_pvt->num_codecs = 0; diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 803059a..0f52bbc 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -4687,8 +4687,8 @@ void sofia_glue_pass_sdp(private_object_t *tech_pvt, char *sdp) switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, sdp); if (!sofia_test_flag(tech_pvt, TFLAG_CHANGE_MEDIA) && !sofia_test_flag(tech_pvt, TFLAG_RECOVERING) && - (switch_channel_test_flag(other_channel, CF_OUTBOUND) && - switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND) && switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE))) { + (switch_channel_direction(other_channel) == SWITCH_CALL_DIRECTION_OUTBOUND && + switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_OUTBOUND && switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE))) { switch_ivr_nomedia(val, SMF_FORCE); sofia_set_flag_locked(tech_pvt, TFLAG_CHANGE_MEDIA); } diff --git a/src/switch_channel.c b/src/switch_channel.c index a9c87c5..b0ee9f5 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2622,7 +2622,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_pre_answer(switch_channel return SWITCH_STATUS_SUCCESS; } - if (!switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) { msg.message_id = SWITCH_MESSAGE_INDICATE_PROGRESS; msg.from = channel->name; status = switch_core_session_perform_receive_message(channel->session, &msg, file, func, line); @@ -2657,7 +2657,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_ring_ready_value(switch_c return SWITCH_STATUS_SUCCESS; } - if (!switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) { msg.message_id = SWITCH_MESSAGE_INDICATE_RINGING; msg.from = channel->name; msg.numeric_arg = rv; @@ -2800,7 +2800,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_answer(switch_channel_t * switch_assert(channel != NULL); - if (switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { return SWITCH_STATUS_SUCCESS; } diff --git a/src/switch_core_state_machine.c b/src/switch_core_state_machine.c index c77f3f1..ccd6dac 100644 --- a/src/switch_core_state_machine.c +++ b/src/switch_core_state_machine.c @@ -124,7 +124,7 @@ static void switch_core_standard_on_routing(switch_core_session_t *session) } if (!count) { - if (switch_channel_test_flag(session->channel, CF_OUTBOUND)) { + if (switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { if (switch_channel_test_flag(session->channel, CF_ANSWERED)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "No Dialplan on answered channel, changing state to HANGUP\n"); diff --git a/src/switch_cpp.cpp b/src/switch_cpp.cpp index 40462db..1ba850d 100644 --- a/src/switch_cpp.cpp +++ b/src/switch_cpp.cpp @@ -1206,7 +1206,7 @@ SWITCH_DECLARE(void) bridge(CoreSession &session_a, CoreSession &session_b) if (switch_channel_ready(channel_a) && switch_channel_ready(channel_b)) { session_a.begin_allow_threads(); - if (!switch_channel_test_flag(channel_a, CF_OUTBOUND) && !switch_channel_media_ready(channel_a)) { + if (switch_channel_direction(channel_a) == SWITCH_CALL_DIRECTION_INBOUND && !switch_channel_media_ready(channel_a)) { switch_channel_pre_answer(channel_a); } diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 5cd4d4d..494871e 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -140,7 +140,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session, const char *var; /* - if (!switch_channel_test_flag(channel, CF_OUTBOUND) && !switch_channel_test_flag(channel, CF_PROXY_MODE) && + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND && !switch_channel_test_flag(channel, CF_PROXY_MODE) && !switch_channel_media_ready(channel) && !switch_channel_test_flag(channel, CF_SERVICE)) { if ((status = switch_channel_pre_answer(channel)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot establish media.\n"); diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index afd33f1..ceab8b1 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -435,8 +435,8 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) switch_channel_t *un = ans_a ? chan_b : chan_a; switch_channel_t *a = un == chan_b ? chan_a : chan_b; - if (!switch_channel_test_flag(un, CF_OUTBOUND)) { - if (switch_channel_test_flag(a, CF_OUTBOUND) || (un == chan_a && !originator)) { + if (switch_channel_direction(un) == SWITCH_CALL_DIRECTION_INBOUND) { + if (switch_channel_direction(a) == SWITCH_CALL_DIRECTION_OUTBOUND || (un == chan_a && !originator)) { switch_channel_pass_callee_id(a, un); } commit 00046ee0f232cdd4dd9b98c376ad849cbbb90147 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Dec 15 20:01:34 2010 -0600 FS-2933 diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index e615347..b6ae346 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -1751,6 +1751,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess early_state_t early_state = { 0 }; int read_packet = 0; int check_reject = 1; + switch_codec_implementation_t read_impl = { 0 }; if (strstr(bridgeto, SWITCH_ENT_ORIGINATE_DELIM)) { return switch_ivr_enterprise_originate(session, bleg, cause, bridgeto, timelimit_sec, table, cid_name_override, cid_num_override, @@ -1777,6 +1778,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess switch_channel_set_flag(caller_channel, CF_ORIGINATOR); oglobals.session = session; + switch_core_session_get_read_impl(session, &read_impl); if ((to_var = switch_channel_get_variable(caller_channel, SWITCH_CALL_TIMEOUT_VARIABLE))) { timelimit_sec = atoi(to_var); @@ -3066,7 +3068,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess if ((ringback.fh || silence || ringback.audio_buffer || oglobals.bridge_early_media > -1) && write_frame.codec && write_frame.datalen) { if (silence) { - write_frame.datalen = write_frame.codec->implementation->decoded_bytes_per_packet; + write_frame.datalen = read_impl.decoded_bytes_per_packet; switch_generate_sln_silence((int16_t *) write_frame.data, write_frame.datalen / 2, silence); } commit 47c9773048f134eff7517ed73295deb34c671aeb Merge: 8bb15b2 ccbc2ed Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Dec 15 16:47:37 2010 -0500 Merge branch 'master' into netborder Conflicts: libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c commit ccbc2ed93c10ab5f791b2ae15cf68435bc1bb7fc Merge: c602e04 53346e4 Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Dec 15 16:45:15 2010 -0500 Merge branch 'davidy.mapped_raw_traces' commit c602e04ff6c96450bda06718505989931d128d9b Merge: 72f9989 0235f0b Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Dec 15 16:43:33 2010 -0500 Merge branch 'davidy.channel_restart' commit 53346e494876aaa5af9b9adf39e7f510cac938ad Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Dec 15 16:42:47 2010 -0500 Freetdm: exposed channel availability rate to user diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 3fa763f..1750d6d 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -1702,6 +1702,18 @@ static ftdm_status_t __inline__ get_best_rated(ftdm_channel_t **fchan, ftdm_chan return FTDM_SUCCESS; } + +FT_DECLARE(int) ftdm_channel_get_availability(ftdm_channel_t *ftdmchan) +{ + int availability = -1; + ftdm_channel_lock(ftdmchan); + if (ftdm_test_flag(ftdmchan->span, FTDM_SPAN_USE_AV_RATE)) { + availability = ftdmchan->availability_rate; + } + ftdm_channel_unlock(ftdmchan); + return availability; +} + FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_group(uint32_t group_id, ftdm_direction_t direction, ftdm_caller_data_t *caller_data, ftdm_channel_t **ftdmchan) { ftdm_status_t status = FTDM_FAIL; diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 18da29f..41bf819 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -696,6 +696,14 @@ typedef enum { /*! \brief Override the default queue handler */ FT_DECLARE(ftdm_status_t) ftdm_global_set_queue_handler(ftdm_queue_handler_t *handler); +/*! \brief Return the availability rate for a channel + * \param ftdmchan Channel to get the availability from + * + * \retval > 0 if availability is supported + * \retval -1 if availability is not supported + */ +FT_DECLARE(int) ftdm_channel_get_availability(ftdm_channel_t *ftdmchan); + /*! \brief Answer call */ #define ftdm_channel_call_answer(ftdmchan) _ftdm_channel_call_answer(__FILE__, __FUNCTION__, __LINE__, (ftdmchan)) commit a24b9c9f68709dcf7cdf226aa75eecdaaaad7b5c Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Dec 15 16:29:44 2010 -0500 freetdm: Support for RAW traces diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index d8f98f1..6f6025a 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -2077,7 +2077,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_r2_signal) case FTDM_SIGEVENT_SIGSTATUS_CHANGED: { - ftdm_signaling_status_t sigstatus = sigmsg->raw_data ? *((ftdm_signaling_status_t*)(sigmsg->raw_data)) : sigmsg->sigstatus; + ftdm_signaling_status_t sigstatus = sigmsg->raw_data ? *((ftdm_signaling_status_t*)(sigmsg->raw_data)) : sigmsg->ev_data.sigstatus.status; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%d:%d signalling changed to: %s\n", spanid, chanid, ftdm_signaling_status2str(sigstatus)); } @@ -2183,7 +2183,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_clear_channel_signal) break; case FTDM_SIGEVENT_SIGSTATUS_CHANGED: { - ftdm_signaling_status_t sigstatus = sigmsg->raw_data ? *((ftdm_signaling_status_t*)(sigmsg->raw_data)) : sigmsg->sigstatus; + ftdm_signaling_status_t sigstatus = sigmsg->raw_data ? *((ftdm_signaling_status_t*)(sigmsg->raw_data)) : sigmsg->ev_data.sigstatus.status; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%d:%d signalling changed to :%s\n", spanid, chanid, ftdm_signaling_status2str(sigstatus)); } commit dd345b913bcec51f247da22bba045a227e7db320 Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Dec 15 16:29:03 2010 -0500 freetdm: Support for RAW traces diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 6166c55..3fa763f 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -280,6 +280,9 @@ FTDM_STR2ENUM(ftdm_str2ftdm_chan_type, ftdm_chan_type2str, ftdm_chan_type_t, CHA FTDM_ENUM_NAMES(SIGNALING_STATUS_NAMES, SIGSTATUS_STRINGS) FTDM_STR2ENUM(ftdm_str2ftdm_signaling_status, ftdm_signaling_status2str, ftdm_signaling_status_t, SIGNALING_STATUS_NAMES, FTDM_SIG_STATE_INVALID) +FTDM_ENUM_NAMES(TRACE_DIR_NAMES, TRACE_DIR_STRINGS) +FTDM_STR2ENUM(ftdm_str2ftdm_trace_dir, ftdm_trace_dir2str, ftdm_trace_dir_t, TRACE_DIR_NAMES, FTDM_TRACE_INVALID) + FTDM_ENUM_NAMES(TON_NAMES, TON_STRINGS) FTDM_STR2ENUM(ftdm_str2ftdm_ton, ftdm_ton2str, ftdm_ton_t, TON_NAMES, FTDM_TON_INVALID) @@ -5292,6 +5295,7 @@ static ftdm_status_t ftdm_span_trigger_signal(const ftdm_span_t *span, ftdm_sigm if (sigmsg->channel) { ftdm_call_clear_data(&(sigmsg->channel->caller_data)); } + ftdm_safe_free(sigmsg->raw_data); return status; } @@ -5299,8 +5303,6 @@ static ftdm_status_t ftdm_span_queue_signal(const ftdm_span_t *span, ftdm_sigmsg { ftdm_sigmsg_t *new_sigmsg = NULL; - ftdm_assert_return((sigmsg->raw_data == NULL), FTDM_FAIL, "No raw data should be used with asynchronous notification\n"); - new_sigmsg = ftdm_calloc(1, sizeof(*sigmsg)); if (!new_sigmsg) { return FTDM_FAIL; @@ -5347,7 +5349,7 @@ FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t case FTDM_SIGEVENT_SIGSTATUS_CHANGED: { - ftdm_signaling_status_t sigstatus = ftdm_test_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE) ? sigmsg->sigstatus : *((ftdm_signaling_status_t*)(sigmsg->raw_data)); + ftdm_signaling_status_t sigstatus = ftdm_test_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE) ? sigmsg->ev_data.sigstatus.status : *((ftdm_signaling_status_t*)(sigmsg->raw_data)); if (sigstatus == FTDM_SIG_STATE_UP) { ftdm_set_flag(sigmsg->channel, FTDM_CHANNEL_SIG_UP); } else { diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 1549833..8c2fd51 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -255,7 +255,7 @@ static void ftdm_r2_set_chan_sig_status(ftdm_channel_t *ftdmchan, ftdm_signaling sig.span_id = ftdmchan->span_id; sig.channel = ftdmchan; sig.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sig.sigstatus = status; + sig.ev_data.sigstatus.status = status; if (ftdm_span_send_signal(ftdmchan->span, &sig) != FTDM_SUCCESS) { ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to change channel status to %s\n", ftdm_signaling_status2str(status)); } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 48ddddc..bb29b4f 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -976,7 +976,8 @@ static FIO_SPAN_SET_SIG_STATUS_FUNCTION(ftdm_sangoma_isdn_set_span_sig_status) } static ftdm_status_t ftdm_sangoma_isdn_start(ftdm_span_t *span) -{ +{ + sngisdn_span_data_t *signal_data = span->signal_data; ftdm_log(FTDM_LOG_INFO,"Starting span %s:%u.\n",span->name,span->span_id); if (sngisdn_stack_start(span) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_CRIT, "Failed to start span %s\n", span->name); @@ -986,6 +987,14 @@ static ftdm_status_t ftdm_sangoma_isdn_start(ftdm_span_t *span) ftdm_clear_flag(span, FTDM_SPAN_STOP_THREAD); ftdm_clear_flag(span, FTDM_SPAN_IN_THREAD); + if (signal_data->raw_trace_q921 == SNGISDN_OPT_TRUE) { + sngisdn_activate_trace(span, SNGISDN_TRACE_Q921); + } + + if (signal_data->raw_trace_q931 == SNGISDN_OPT_TRUE) { + sngisdn_activate_trace(span, SNGISDN_TRACE_Q931); + } + /*start the span monitor thread*/ if (ftdm_thread_create_detached(ftdm_sangoma_isdn_run, span) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_CRIT,"Failed to start Sangoma ISDN Span Monitor Thread!\n"); @@ -1210,6 +1219,7 @@ static FIO_API_FUNCTION(ftdm_sangoma_isdn_api) stream->write_function(stream, "-ERR failed to find span by name %s\n", argv[2]); goto done; } + if (!strcasecmp(trace_opt, "q921")) { sngisdn_activate_trace(span, SNGISDN_TRACE_Q921); } else if (!strcasecmp(trace_opt, "q931")) { @@ -1218,7 +1228,7 @@ static FIO_API_FUNCTION(ftdm_sangoma_isdn_api) sngisdn_activate_trace(span, SNGISDN_TRACE_DISABLE); } else { stream->write_function(stream, "-ERR invalid trace option <q921|q931> <span name>\n"); - } + } } if (!strcasecmp(argv[0], "l1_stats")) { ftdm_span_t *span; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 0c6c1c6..6a440e4 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -261,6 +261,8 @@ typedef struct sngisdn_span_data { int8_t facility_timeout; uint8_t num_local_numbers; uint8_t ignore_cause_value; + uint8_t raw_trace_q931; + uint8_t raw_trace_q921; uint8_t timer_t3; uint8_t restart_opt; char* local_numbers[SNGISDN_NUM_LOCAL_NUMBERS]; @@ -427,8 +429,11 @@ void sngisdn_process_rst_ind (sngisdn_event_data_t *sngisdn_event); void sngisdn_rcv_phy_ind(SuId suId, Reason reason); void sngisdn_rcv_q921_ind(BdMngmt *status); -void sngisdn_trace_q921(char* str, uint8_t* data, uint32_t data_len); -void sngisdn_trace_q931(char* str, uint8_t* data, uint32_t data_len); +void sngisdn_trace_interpreted_q921(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t dir, uint8_t *data, uint32_t data_len); +void sngisdn_trace_interpreted_q931(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t dir, uint8_t *data, uint32_t data_len); +void sngisdn_trace_raw_q921(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t dir, uint8_t *data, uint32_t data_len); +void sngisdn_trace_raw_q931(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t dir, uint8_t *data, uint32_t data_len); + void get_memory_info(void); ftdm_status_t sng_isdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t trace_opt); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c index cce10cc..c979000 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c @@ -296,6 +296,10 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ parse_yesno(var, val, &signal_data->facility_ie_decode); } else if (!strcasecmp(var, "ignore-cause-value")) { parse_yesno(var, val, &signal_data->ignore_cause_value); + } else if (!strcasecmp(var, "q931-raw-trace")) { + parse_yesno(var, val, &signal_data->raw_trace_q931); + } else if (!strcasecmp(var, "q921-raw-trace")) { + parse_yesno(var, val, &signal_data->raw_trace_q921); } else { ftdm_log(FTDM_LOG_WARNING, "Ignoring unknown parameter %s\n", ftdm_parameters[paramindex].var); } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cntrl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cntrl.c index 5060cb6..668b630 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cntrl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cntrl.c @@ -47,7 +47,7 @@ void sngisdn_set_chan_sig_status(ftdm_channel_t *ftdmchan, ftdm_signaling_status sig.span_id = ftdmchan->span_id; sig.channel = ftdmchan; sig.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sig.sigstatus = status; + sig.ev_data.sigstatus.status = status; ftdm_span_send_signal(ftdmchan->span, &sig); return; } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c index 4b04fb0..3afdaa5 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c @@ -34,9 +34,6 @@ #include "ftmod_sangoma_isdn.h" -#define MAX_DECODE_STR_LEN 2000 - - void sngisdn_rcv_con_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, ConEvnt *conEvnt, int16_t dChan, uint8_t ces) { uint8_t bchan_no = 0; @@ -777,9 +774,6 @@ void sngisdn_rcv_cc_ind(CcMngmt *status) return; } -#define Q931_TRC_EVENT(event) (event == TL3PKTTX)?"TX": \ - (event == TL3PKTRX)?"RX":"UNKNOWN" - void sngisdn_rcv_q931_trace(InMngmt *trc, Buffer *mBuf) { MsgLen mlen; @@ -788,13 +782,20 @@ void sngisdn_rcv_q931_trace(InMngmt *trc, Buffer *mBuf) Buffer *tmp; Data *cptr; uint8_t data; + ftdm_trace_dir_t dir; uint8_t tdata[1000]; - char *data_str = ftdm_calloc(1,MAX_DECODE_STR_LEN); /* TODO Find a proper size */ - + sngisdn_span_data_t *signal_data = g_sngisdn_data.spans[trc->t.trc.suId]; + ftdm_assert(mBuf != NULLP, "Received a Q931 trace with no buffer"); mlen = ((SsMsgInfo*)(mBuf->b_rptr))->len; - - if (mlen != 0) { + + if (trc->t.trc.evnt == TL3PKTTX) { + dir = FTDM_TRACE_OUTGOING; + } else { + dir = FTDM_TRACE_INCOMING; + } + + if (mlen) { tmp = mBuf->b_cont; cptr = tmp->b_rptr; data = *cptr++; @@ -809,41 +810,40 @@ void sngisdn_rcv_q931_trace(InMngmt *trc, Buffer *mBuf) } data = *cptr++; } - - sngisdn_trace_q931(data_str, tdata, mlen); - ftdm_log(FTDM_LOG_INFO, "[SNGISDN Q931] s%d FRAME %s:%s\n", trc->t.trc.suId, Q931_TRC_EVENT(trc->t.trc.evnt), data_str); + if (signal_data->raw_trace_q931 == SNGISDN_OPT_TRUE) { + sngisdn_trace_raw_q931(signal_data, dir, tdata, mlen); + } else { + sngisdn_trace_interpreted_q931(signal_data, dir, tdata, mlen); + } } - - ftdm_safe_free(data_str); - /* We do not need to free mBuf in this case because stack does it */ - /* SPutMsg(mBuf); */ return; } -#define Q921_TRC_EVENT(event) (event == TL2FRMRX)?"RX": \ - (event == TL2FRMTX)?"TX": \ - (event == TL2TMR)?"TMR EXPIRED":"UNKNOWN" - void sngisdn_rcv_q921_trace(BdMngmt *trc, Buffer *mBuf) { MsgLen mlen; + Buffer *tmp; MsgLen i; int16_t j; - Buffer *tmp; Data *cptr; uint8_t data; - uint8_t tdata[16]; - char *data_str = ftdm_calloc(1,200); /* TODO Find a proper size */ - + ftdm_trace_dir_t dir; + uint8_t tdata[1000]; + sngisdn_span_data_t *signal_data = g_sngisdn_data.spans[trc->t.trc.lnkNmb]; if (trc->t.trc.evnt == TL2TMR) { - goto end_of_trace; + return; } + if (trc->t.trc.evnt == TL2FRMTX) { + dir = FTDM_TRACE_OUTGOING; + } else { + dir = FTDM_TRACE_INCOMING; + } + ftdm_assert(mBuf != NULLP, "Received a Q921 trace with no buffer"); mlen = ((SsMsgInfo*)(mBuf->b_rptr))->len; - if (mlen != 0) { tmp = mBuf->b_cont; cptr = tmp->b_rptr; @@ -865,12 +865,12 @@ void sngisdn_rcv_q921_trace(BdMngmt *trc, Buffer *mBuf) } } - sngisdn_trace_q921(data_str, tdata, mlen); - ftdm_log(FTDM_LOG_INFO, "[SNGISDN Q921] s%d FRAME %s:%s\n", trc->t.trc.lnkNmb, Q921_TRC_EVENT(trc->t.trc.evnt), data_str); + if (signal_data->raw_trace_q921 == SNGISDN_OPT_TRUE) { + sngisdn_trace_raw_q921(signal_data, dir, tdata, mlen); + } else { + sngisdn_trace_interpreted_q921(signal_data, dir, tdata, mlen); + } } -end_of_trace: - ftdm_safe_free(data_str); - SPutMsg(mBuf); return; } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c index e516716..c03976a 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c @@ -36,14 +36,15 @@ #include "ftmod_sangoma_isdn_trace.h" #define OCTET(x) (ieData[x-1] & 0xFF) +#define MAX_DECODE_STR_LEN 2000 void print_hex_dump(char* str, uint32_t *str_len, uint8_t* data, uint32_t index_start, uint32_t index_end); -void sngisdn_trace_q921(char* str, uint8_t* data, uint32_t data_len); -void sngisdn_trace_q931(char* str, uint8_t* data, uint32_t data_len); uint32_t sngisdn_decode_ie(char *str, uint32_t *str_len, uint8_t current_codeset, uint8_t *data, uint16_t index_start); uint8_t get_bits(uint8_t octet, uint8_t bitLo, uint8_t bitHi); char* get_code_2_str(int code, struct code2str *pCodeTable); +void sngisdn_decode_q921(char* str, uint8_t* data, uint32_t data_len); +void sngisdn_decode_q931(char* str, uint8_t* data, uint32_t data_len); char* get_code_2_str(int code, struct code2str *pCodeTable) { @@ -97,7 +98,42 @@ uint8_t get_bits(uint8_t octet, uint8_t bitLo, uint8_t bitHi) return 0; } -void sngisdn_trace_q921(char* str, uint8_t* data, uint32_t data_len) +void sngisdn_trace_interpreted_q921(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t dir, uint8_t *data, uint32_t data_len) +{ + char *data_str = ftdm_calloc(1,200); /* TODO Find a proper size */ + sngisdn_decode_q921(data_str, data, data_len); + ftdm_log(FTDM_LOG_INFO, "[SNGISDN Q921] s%d FRAME %s:%s\n", signal_data->ftdm_span->name, ftdm_trace_dir2str(dir), data_str); + ftdm_safe_free(data_str); +} + +void sngisdn_trace_raw_q921(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t dir, uint8_t *data, uint32_t data_len) +{ + uint8_t *raw_data; + ftdm_sigmsg_t sigev; + + memset(&sigev, 0, sizeof(sigev)); + + sigev.span_id = signal_data->ftdm_span->span_id; + sigev.chan_id = signal_data->dchan->chan_id; + sigev.channel = signal_data->dchan; + sigev.event_id = FTDM_SIGEVENT_TRACE_RAW; + + sigev.ev_data.logevent.dir = dir; + sigev.ev_data.logevent.level = 2; + + /* TODO: Map trace to call ID here */ + sigev.call_id = 0; + + raw_data = ftdm_malloc(data_len); + ftdm_assert(raw_data, "Failed to malloc"); + + memcpy(raw_data, data, data_len); + sigev.raw_data = raw_data; + sigev.raw_data_len = data_len; + ftdm_span_send_signal(signal_data->ftdm_span, &sigev); +} + +void sngisdn_decode_q921(char* str, uint8_t* data, uint32_t data_len) { int str_len; uint32_t i; @@ -169,7 +205,42 @@ void sngisdn_trace_q921(char* str, uint8_t* data, uint32_t data_len) return; } -void sngisdn_trace_q931(char* str, uint8_t* data, uint32_t data_len) + +void sngisdn_trace_interpreted_q931(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t dir, uint8_t *data, uint32_t data_len) +{ + char *data_str = ftdm_calloc(1,MAX_DECODE_STR_LEN); /* TODO Find a proper size */ + sngisdn_decode_q931(data_str, data, data_len); + ftdm_log(FTDM_LOG_INFO, "[SNGISDN Q931] %s FRAME %s:%s\n", signal_data->ftdm_span->name, ftdm_trace_dir2str(dir), data_str); + ftdm_safe_free(data_str); +} + +void sngisdn_trace_raw_q931(sngisdn_span_data_t *signal_data, ftdm_trace_dir_t dir, uint8_t *data, uint32_t data_len) +{ + uint8_t *raw_data; + ftdm_sigmsg_t sigev; + + memset(&sigev, 0, sizeof(sigev)); + + sigev.span_id = signal_data->ftdm_span->span_id; + sigev.chan_id = signal_data->dchan->chan_id; + sigev.channel = signal_data->dchan; + sigev.event_id = FTDM_SIGEVENT_TRACE_RAW; + + sigev.ev_data.logevent.dir = dir; + sigev.ev_data.logevent.level = 3; + + /* TODO: Map trace to call ID here */ + + raw_data = ftdm_malloc(data_len); + ftdm_assert(raw_data, "Failed to malloc"); + + memcpy(raw_data, data, data_len); + sigev.raw_data = raw_data; + sigev.raw_data_len = data_len; + ftdm_span_send_signal(signal_data->ftdm_span, &sigev); +} + +void sngisdn_decode_q931(char* str, uint8_t* data, uint32_t data_len) { uint32_t str_len; uint8_t prot_disc, callRefFlag; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c index 34cca80..dc2d24f 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c @@ -1589,7 +1589,7 @@ static ftdm_status_t handle_tx_cgb(ftdm_stream_handle_t *stream, int span, int c sigev.span_id = ftdmchan->span_id; sigev.channel = ftdmchan; sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.sigstatus = FTDM_SIG_STATE_DOWN; + sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_DOWN; ftdm_span_send_signal(ftdmchan->span, &sigev); /* if this is the first channel in the range */ @@ -1689,7 +1689,7 @@ static ftdm_status_t handle_tx_cgu(ftdm_stream_handle_t *stream, int span, int c sigev.span_id = ftdmchan->span_id; sigev.channel = ftdmchan; sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.sigstatus = FTDM_SIG_STATE_UP; + sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_UP; ftdm_span_send_signal(ftdmchan->span, &sigev); /* if this is the first channel in the range */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index 7517ee4..dcfb7f7 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -2004,7 +2004,7 @@ ftdm_status_t handle_cgb_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ /* bring the sig status down */ sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.sigstatus = FTDM_SIG_STATE_DOWN; + sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_DOWN; ftdm_span_send_signal(ftdmchan->span, &sigev); /* unlock the channel again before we exit */ @@ -2135,7 +2135,7 @@ ftdm_status_t handle_cgu_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ /* bring the sig status down */ sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.sigstatus = FTDM_SIG_STATE_UP; + sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_UP; ftdm_span_send_signal(ftdmchan->span, &sigev); /* unlock the channel again before we exit */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index 5c171a9..05a325b 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -841,7 +841,7 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) SS7_DEBUG_CHAN(ftdmchan,"All reset flags cleared %s\n", ""); /* all flags are down so we can bring up the sig status */ sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.sigstatus = FTDM_SIG_STATE_UP; + sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_UP; ftdm_span_send_signal (ftdmchan->span, &sigev); } /* if (!ftdm_test_flag (ftdmchan, FTDM_CHANNEL_SIG_UP)) */ } /* if !blocked */ @@ -949,7 +949,7 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /* if the sig_status is up...bring it down */ if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_SIG_UP)) { sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.sigstatus = FTDM_SIG_STATE_DOWN; + sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_DOWN; ftdm_span_send_signal (ftdmchan->span, &sigev); } @@ -1033,7 +1033,7 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /* bring the sig status back up */ sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.sigstatus = FTDM_SIG_STATE_UP; + sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_UP; ftdm_span_send_signal(ftdmchan->span, &sigev); } @@ -1046,7 +1046,7 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /* bring the sig status down */ sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.sigstatus = FTDM_SIG_STATE_DOWN; + sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_DOWN; ftdm_span_send_signal(ftdmchan->span, &sigev); /* go back to the last state */ @@ -1058,7 +1058,7 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /* bring the sig status down */ sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.sigstatus = FTDM_SIG_STATE_DOWN; + sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_DOWN; ftdm_span_send_signal(ftdmchan->span, &sigev); /* send a BLA */ @@ -1076,7 +1076,7 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /* bring the sig status up */ sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.sigstatus = FTDM_SIG_STATE_UP; + sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_UP; ftdm_span_send_signal(ftdmchan->span, &sigev); /* send a uba */ @@ -1092,7 +1092,7 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /* bring the sig status down */ sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.sigstatus = FTDM_SIG_STATE_DOWN; + sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_DOWN; ftdm_span_send_signal(ftdmchan->span, &sigev); /* send a blo */ @@ -1110,7 +1110,7 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /* bring the sig status up */ sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.sigstatus = FTDM_SIG_STATE_UP; + sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_UP; ftdm_span_send_signal(ftdmchan->span, &sigev); /* send a ubl */ @@ -1149,7 +1149,7 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /* bring the channel signaling status to down */ sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.sigstatus = FTDM_SIG_STATE_DOWN; + sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_DOWN; ftdm_span_send_signal (ftdmchan->span, &sigev); /* remove any reset flags */ diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index f8f69ab..18da29f 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -325,12 +325,14 @@ typedef enum { FTDM_SIGEVENT_RESTART, /*!< Restart has been requested. Typically you hangup your call resources here */ FTDM_SIGEVENT_SIGSTATUS_CHANGED, /*!< Signaling protocol status changed (ie: D-chan up), see new status in raw_data ftdm_sigmsg_t member */ FTDM_SIGEVENT_COLLISION, /*!< Outgoing call was dropped because an incoming call arrived at the same time */ - FTDM_SIGEVENT_FACILITY, /* !< In call facility event */ - FTDM_SIGEVENT_INVALID + FTDM_SIGEVENT_FACILITY, /*!< In call facility event */ + FTDM_SIGEVENT_TRACE, /*!<Interpreted trace event */ + FTDM_SIGEVENT_TRACE_RAW, /*!<Raw trace event */ + FTDM_SIGEVENT_INVALID, /*!<Invalid */ } ftdm_signal_event_t; #define SIGNAL_STRINGS "START", "STOP", "RELEASED", "UP", "FLASH", "PROCEED", "RINGING", "PROGRESS", \ "PROGRESS_MEDIA", "ALARM_TRAP", "ALARM_CLEAR", \ - "COLLECTED_DIGIT", "ADD_CALL", "RESTART", "SIGSTATUS_CHANGED", "COLLISION", "MSG", "INVALID" + "COLLECTED_DIGIT", "ADD_CALL", "RESTART", "SIGSTATUS_CHANGED", "COLLISION", "FACILITY", "TRACE", "TRACE_RAW", "INVALID" /*! \brief Move from string to ftdm_signal_event_t and viceversa */ FTDM_STR2ENUM_P(ftdm_str2ftdm_signal_event, ftdm_signal_event2str, ftdm_signal_event_t) @@ -381,16 +383,43 @@ typedef enum { /*! \brief Move from string to ftdm_signaling_status_t and viceversa */ FTDM_STR2ENUM_P(ftdm_str2ftdm_signaling_status, ftdm_signaling_status2str, ftdm_signaling_status_t) + +typedef struct { + ftdm_signaling_status_t status; +} ftdm_event_sigstatus_t; + +typedef enum { + /* This is an received frame */ + FTDM_TRACE_INCOMING, + /* This is a transmitted frame */ + FTDM_TRACE_OUTGOING, + /* Invalid */ + FTDM_TRACE_INVALID, +} ftdm_trace_dir_t; +#define TRACE_DIR_STRINGS "INCOMING", "OUTGOING", "INVALID" + +/*! \brief Move string to ftdm_trace_dir_t and viceversa */ +FTDM_STR2ENUM_P(ftdm_str2ftdm_trace_dir, ftdm_trace_dir2str, ftdm_trace_dir_t) + +typedef struct { + /* Direction - incoming or outgoing */ + ftdm_trace_dir_t dir; + uint8_t level; /* 1 for phy layer, 2 for q921/mtp2, 3 for q931/mtp3 */ +} ftdm_event_trace_t; + /*! \brief Generic signaling message */ struct ftdm_sigmsg { ftdm_signal_event_t event_id; /*!< The type of message */ ftdm_channel_t *channel; /*!< Related channel */ uint32_t chan_id; /*!< easy access to chan id */ uint32_t span_id; /*!< easy access to span_id */ - ftdm_signaling_status_t sigstatus; /*!< Signaling status (valid if event_id is FTDM_SIGEVENT_SIGSTATUS_CHANGED) */ void *raw_data; /*!< Message specific data if any */ uint32_t raw_data_len; /*!< Data len in case is needed */ uint32_t call_id; /*!< unique call id for this call */ + union { + ftdm_event_sigstatus_t sigstatus; /*!< valid if event_id is FTDM_SIGEVENT_SIGSTATUS_CHANGED */ + ftdm_event_trace_t logevent; /*!< valid if event_id is FTDM_SIGEVENT_TRACE or FTDM_SIGEVENT_TRACE_RAW */ + }ev_data; }; /*! \brief Crash policy commit 72f99898d2dc3dc3bdd7365d1c113462d4d139cb Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Wed Dec 15 18:48:49 2010 -0200 freetdm: ftmod_r2 - updated warning message diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 6e78810..ef9201b 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -461,7 +461,7 @@ static FIO_CHANNEL_SET_SIG_STATUS_FUNCTION(ftdm_r2_set_channel_sig_status) openr2_chan_set_idle(r2chan); break; default: - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Ignoring unknown sigstatus: %d\n", status); + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Cannot set signaling status to unknown value '%s'\n", status); return FTDM_FAIL; } return FTDM_SUCCESS; commit bb8d901c4f437c57b1c349575d5d93eea4fb4203 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Wed Dec 15 18:32:35 2010 -0200 freetdm: ftmod_wanpipe - replaced some POLL macros by SANG_WAIT_OBJ_* diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index 627ef7b..2db4326 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -1053,20 +1053,20 @@ FIO_SPAN_POLL_EVENT_FUNCTION(wanpipe_poll_event) ftdm_channel_t *ftdmchan = span->channels[i]; uint32_t chan_events = 0; - /* if the user specify which events to poll the channel for, we translate them from ftdm_wait_flag_t - * to events that either sangoma_waitfor_many() or poll() understands. if not, we poll for POLLPRI */ + /* translate events from ftdm to libsnagoma. if the user don't specify which events to poll the + * channel for, we just use SANG_WAIT_OBJ_HAS_EVENTS */ if (poll_events) { if (poll_events[j] & FTDM_READ) { - chan_events = POLLIN; + chan_events = SANG_WAIT_OBJ_HAS_INPUT; } if (poll_events[j] & FTDM_WRITE) { - chan_events |= POLLOUT; + chan_events |= SANG_WAIT_OBJ_HAS_OUTPUT; } if (poll_events[j] & FTDM_EVENTS) { - chan_events |= POLLPRI; + chan_events |= SANG_WAIT_OBJ_HAS_EVENTS; } } else { - chan_events = POLLPRI; + chan_events = SANG_WAIT_OBJ_HAS_EVENTS; } #ifdef LIBSANGOMA_VERSION commit 715d250e171a94736b19019ac742f739899ad997 Author: Mathieu Parent <math.parent@gmail.com> Date: Wed Dec 15 21:29:52 2010 +0100 Skinny: handle new XMLAlarmMessage This add support for new SCCP Firmware 9.1 (part of FS-2912) diff --git a/src/mod/endpoints/mod_skinny/skinny_protocol.h b/src/mod/endpoints/mod_skinny/skinny_protocol.h index 4d0b792..ee3c33a 100644 --- a/src/mod/endpoints/mod_skinny/skinny_protocol.h +++ b/src/mod/endpoints/mod_skinny/skinny_protocol.h @@ -547,6 +547,9 @@ struct PACKED service_url_stat_res_message { #define USER_TO_DEVICE_DATA_VERSION1_MESSAGE 0x013F /* See struct PACKED extended_data_message */ +/* XMLAlarmMessage */ +#define XML_ALARM_MESSAGE 0x015A + /*****************************************************************************/ /* SKINNY MESSAGE */ /*****************************************************************************/ diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index cfafea6..c03e3ce 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -1970,7 +1970,7 @@ switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *re "Received %s (type=%x,length=%d) from %s:%d.\n", skinny_message_type2str(request->type), request->type, request->length, listener->device_name, listener->device_instance); } - if(zstr(listener->device_name) && request->type != REGISTER_MESSAGE && request->type != ALARM_MESSAGE) { + if(zstr(listener->device_name) && request->type != REGISTER_MESSAGE && request->type != ALARM_MESSAGE && request->type != XML_ALARM_MESSAGE) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Device should send a register message first.\n"); return SWITCH_STATUS_FALSE; diff --git a/src/mod/endpoints/mod_skinny/skinny_tables.c b/src/mod/endpoints/mod_skinny/skinny_tables.c index 0a27ad7..053b350 100644 --- a/src/mod/endpoints/mod_skinny/skinny_tables.c +++ b/src/mod/endpoints/mod_skinny/skinny_tables.c @@ -99,6 +99,7 @@ struct skinny_table SKINNY_MESSAGE_TYPES[] = { {"DisplayPriNotifyMessage", DISPLAY_PRI_NOTIFY_MESSAGE}, {"ServiceUrlStatMessage", SERVICE_URL_STAT_RES_MESSAGE}, {"UserToDeviceDataVersion1Message", USER_TO_DEVICE_DATA_VERSION1_MESSAGE}, + {"XMLAlarmMessage", XML_ALARM_MESSAGE}, {NULL, 0} }; SKINNY_DECLARE_ID2STR(skinny_message_type2str, SKINNY_MESSAGE_TYPES, "UnknownMessage") diff --git a/src/mod/endpoints/mod_skinny/skinny_tables.h b/src/mod/endpoints/mod_skinny/skinny_tables.h index 14962b8..c119e1f 100644 --- a/src/mod/endpoints/mod_skinny/skinny_tables.h +++ b/src/mod/endpoints/mod_skinny/skinny_tables.h @@ -87,7 +87,7 @@ uint32_t func(const char *str)\ } -extern struct skinny_table SKINNY_MESSAGE_TYPES[65]; +extern struct skinny_table SKINNY_MESSAGE_TYPES[66]; const char *skinny_message_type2str(uint32_t id); uint32_t skinny_str2message_type(const char *str); #define SKINNY_PUSH_MESSAGE_TYPES SKINNY_DECLARE_PUSH_MATCH(SKINNY_MESSAGE_TYPES) commit 20ba5da47991e2b00854ffb66985ce9388d412b2 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Wed Dec 15 18:08:55 2010 -0200 freetdm: ftmod_r2 - implemented set_channel_sig_status() diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 10e0c4a..6e78810 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -449,6 +449,24 @@ static FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(ftdm_r2_get_channel_sig_status) return FTDM_SUCCESS; } +static FIO_CHANNEL_SET_SIG_STATUS_FUNCTION(ftdm_r2_set_channel_sig_status) +{ + openr2_chan_t *r2chan = R2CALL(ftdmchan)->r2chan; + switch(status) { + case FTDM_SIG_STATE_DOWN: + case FTDM_SIG_STATE_SUSPENDED: + openr2_chan_set_blocked(r2chan); + break; + case FTDM_SIG_STATE_UP: + openr2_chan_set_idle(r2chan); + break; + default: + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Ignoring unknown sigstatus: %d\n", status); + return FTDM_FAIL; + } + return FTDM_SUCCESS; +} + /* always called from the monitor thread */ static void ftdm_r2_on_call_init(openr2_chan_t *r2chan) { @@ -1419,13 +1437,12 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) span->sig_read = NULL; span->sig_write = NULL; - /* let the core set the states, we just read them */ - span->get_channel_sig_status = ftdm_r2_get_channel_sig_status; - span->signal_cb = sig_cb; span->signal_type = FTDM_SIGTYPE_R2; span->signal_data = r2data; span->outgoing_call = r2_outgoing_call; + span->get_channel_sig_status = ftdm_r2_get_channel_sig_status; + span->set_channel_sig_status = ftdm_r2_set_channel_sig_status; span->state_map = &r2_state_map; commit dcdbeff9d80202ef8ab0c9a3aff73a09f407b53d Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Wed Dec 15 17:43:40 2010 -0200 freetdm: ftmod_wanpipe - now receiving ftdm macros for channel polling, instead of using POLLPRI, etc., directly ftmod_r2 - also using ftdm macros for polling diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 1549833..10e0c4a 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -1720,7 +1720,7 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) /* deliver the actual channel events to the user now without any channel locking */ ftdm_span_trigger_signals(span); -#ifndef WIN32 + /* figure out what event to poll each channel for. POLLPRI when the channel is down, * POLLPRI|POLLIN|POLLOUT otherwise */ memset(poll_events, 0, sizeof(short)*span->chan_count); @@ -1732,16 +1732,12 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) for (i = 0; citer; citer = ftdm_iterator_next(citer), i++) { ftdmchan = ftdm_iterator_current(citer); r2chan = R2CALL(ftdmchan)->r2chan; - poll_events[i] = POLLPRI; + poll_events[i] = FTDM_EVENTS; if (openr2_chan_get_read_enabled(r2chan)) { - poll_events[i] |= POLLIN; + poll_events[i] |= FTDM_READ; } } - status = ftdm_span_poll_event(span, waitms, poll_events); -#else - status = ftdm_span_poll_event(span, waitms, NULL); -#endif /* run any span timers */ ftdm_sched_run(r2data->sched); diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index e1b6658..627ef7b 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -1051,16 +1051,34 @@ FIO_SPAN_POLL_EVENT_FUNCTION(wanpipe_poll_event) for(i = 1; i <= span->chan_count; i++) { ftdm_channel_t *ftdmchan = span->channels[i]; + uint32_t chan_events = 0; + + /* if the user specify which events to poll the channel for, we translate them from ftdm_wait_flag_t + * to events that either sangoma_waitfor_many() or poll() understands. if not, we poll for POLLPRI */ + if (poll_events) { + if (poll_events[j] & FTDM_READ) { + chan_events = POLLIN; + } + if (poll_events[j] & FTDM_WRITE) { + chan_events |= POLLOUT; + } + if (poll_events[j] & FTDM_EVENTS) { + chan_events |= POLLPRI; + } + } else { + chan_events = POLLPRI; + } + #ifdef LIBSANGOMA_VERSION if (!ftdmchan->io_data) { continue; /* should never happen but happens when shutting down */ } pfds[j] = ftdmchan->io_data; - inflags[j] = poll_events ? poll_events[j] : POLLPRI; + inflags[j] = chan_events; #else memset(&pfds[j], 0, sizeof(pfds[j])); pfds[j].fd = span->channels[i]->sockfd; - pfds[j].events = poll_events ? poll_events[j] : POLLPRI; + pfds[j].events = chan_events; #endif /* The driver probably should be able to do this wink/flash/ringing by itself this is sort of a hack to make it work! */ commit a95af703237509fa55c07df6e381dd6b19550665 Author: Mathieu Parent <math.parent@gmail.com> Date: Wed Dec 15 19:43:13 2010 +0100 Skinny: set max message size to 2048 for now (part of FS-2912) diff --git a/src/mod/endpoints/mod_skinny/skinny_protocol.h b/src/mod/endpoints/mod_skinny/skinny_protocol.h index d85a190..4d0b792 100644 --- a/src/mod/endpoints/mod_skinny/skinny_protocol.h +++ b/src/mod/endpoints/mod_skinny/skinny_protocol.h @@ -552,7 +552,7 @@ struct PACKED service_url_stat_res_message { /*****************************************************************************/ #define SKINNY_MESSAGE_FIELD_SIZE 4 /* 4-bytes field */ #define SKINNY_MESSAGE_HEADERSIZE 12 /* three 4-bytes fields */ -#define SKINNY_MESSAGE_MAXSIZE 1000 +#define SKINNY_MESSAGE_MAXSIZE 2048 union skinny_data { /* no data for KEEP_ALIVE_MESSAGE */ commit 0235f0ba0ef9822d9e289f17360ebdf8b7980824 Merge: ea2b477 3085523 Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Dec 15 12:58:38 2010 -0500 Merge branch 'master' into davidy.channel_restart commit ea2b4774441a594e71ad921fe4721318fa200159 Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Dec 15 12:56:49 2010 -0500 Freetdm:fix for ftdm_channel_close not always passed double-pointer diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 4bd0fdd..eaf057e 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2430,14 +2430,9 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_send_msg(const char *file, const ch FT_DECLARE(ftdm_status_t) _ftdm_channel_reset(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan) { ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "null channel"); -#ifdef __WINDOWS__ - UNREFERENCED_PARAMETER(file); - UNREFERENCED_PARAMETER(func); - UNREFERENCED_PARAMETER(line); -#endif ftdm_channel_lock(ftdmchan); - ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_RESET, 0); + ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_RESET, 1); ftdm_channel_unlock(ftdmchan); return FTDM_SUCCESS; } @@ -2578,8 +2573,7 @@ static ftdm_status_t ftdm_channel_done(ftdm_channel_t *ftdmchan) ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "channel dropped data: txdrops = %d, rxdrops = %d\n", ftdmchan->txdrops, ftdmchan->rxdrops); } - - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "channel done\n"); + memset(&ftdmchan->caller_data, 0, sizeof(ftdmchan->caller_data)); ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_HOLD); @@ -2612,6 +2606,7 @@ static ftdm_status_t ftdm_channel_done(ftdm_channel_t *ftdmchan) ftdmchan->packet_len = ftdmchan->native_interval * (ftdmchan->effective_codec == FTDM_CODEC_SLIN ? 16 : 8); ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_TRANSCODE); } + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "channel done\n"); ftdm_mutex_unlock(ftdmchan->mutex); return FTDM_SUCCESS; } @@ -2642,7 +2637,6 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_close(ftdm_channel_t **ftdmchan) if (ftdm_test_flag(check, FTDM_CHANNEL_OPEN)) { status = check->fio->close(check); if (status == FTDM_SUCCESS) { - ftdm_clear_flag(check, FTDM_CHANNEL_INUSE); ftdm_channel_done(check); *ftdmchan = NULL; } diff --git a/libs/freetdm/src/ftdm_m3ua.c b/libs/freetdm/src/ftdm_m3ua.c index 5a468d1..8d3e002 100644 --- a/libs/freetdm/src/ftdm_m3ua.c +++ b/libs/freetdm/src/ftdm_m3ua.c @@ -156,7 +156,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) release_request_id((m3ua_request_id_t)ftdmchan->extra_id); ftdmchan->extra_id = 0; } - ftdm_channel_close(ftdmchan); + ftdm_channel_close(&ftdmchan); } break; case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c index c6a0e5f..5b4ce71 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@ -1325,7 +1325,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) } Q931ReleaseCRV(&isdn_data->q931, gen->CRV); } - ftdm_channel_close(ftdmchan); + ftdm_channel_close(&ftdmchan); } break; case FTDM_CHANNEL_STATE_PROGRESS: diff --git a/libs/freetdm/src/ftmod/ftmod_pritap/ftmod_pritap.c b/libs/freetdm/src/ftmod/ftmod_pritap/ftmod_pritap.c index b3b4f2a..27fbe21 100644 --- a/libs/freetdm/src/ftmod/ftmod_pritap/ftmod_pritap.c +++ b/libs/freetdm/src/ftmod/ftmod_pritap/ftmod_pritap.c @@ -280,12 +280,12 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) switch (ftdmchan->state) { case FTDM_CHANNEL_STATE_DOWN: - { - ftdm_channel_close(ftdmchan); + { ftdmchan->call_data = NULL; + ftdm_channel_close(&ftdmchan); - ftdm_channel_close(peerchan); peerchan->call_data = NULL; + ftdm_channel_close(&peerchan); } break; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c index a196725..f59b3b8 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c @@ -839,7 +839,7 @@ static void handle_call_released(ftdm_span_t *span, sangomabc_connection_t *mcon if ((ftdmchan = find_ftdmchan(span, event, 1))) { ftdm_log(FTDM_LOG_DEBUG, "Releasing completely chan s%dc%d\n", BOOST_EVENT_SPAN(mcon->sigmod, event), BOOST_EVENT_CHAN(mcon->sigmod, event)); - ftdm_channel_close(ftdmchan); + ftdm_channel_close(&ftdmchan); } else { ftdm_log(FTDM_LOG_CRIT, "Odd, We could not find chan: s%dc%d to release the call completely!!\n", BOOST_EVENT_SPAN(mcon->sigmod, event), BOOST_EVENT_CHAN(mcon->sigmod, event)); @@ -1105,8 +1105,9 @@ static void handle_call_loop_start(ftdm_span_t *span, sangomabc_connection_t *mc ftdm_set_state_r(ftdmchan, FTDM_CHANNEL_STATE_IN_LOOP, res); if (res != FTDM_SUCCESS) { + ftdm_channel_t *toclose = ftdmchan; ftdm_log(FTDM_LOG_CRIT, "yay, could not set the state of the channel to IN_LOOP, loop will fail\n"); - ftdm_channel_close(ftdmchan); + ftdm_channel_close(&toclose); return; } ftdm_log(FTDM_LOG_DEBUG, "%d:%d starting loop\n", ftdmchan->span_id, ftdmchan->chan_id); @@ -1430,7 +1431,8 @@ static __inline__ ftdm_status_t state_advance(ftdm_channel_t *ftdmchan) ftdm_log(FTDM_LOG_DEBUG, "Waiting for call release confirmation before declaring chan %d:%d as available \n", ftdmchan->span_id, ftdmchan->chan_id); } else { - ftdm_channel_close(ftdmchan); + ftdm_channel_t *toclose = ftdmchan; + ftdm_channel_close(&toclose); } } break; commit 8e62bfcb95fb3f0eb68214c8cb2586a3cfe8de8e Author: Jeff Lenk <jeff@jefflenk.com> Date: Wed Dec 15 11:50:41 2010 -0600 vs2008 express fix build dependency diff --git a/Freeswitch.2008.express.sln b/Freeswitch.2008.express.sln index 672406b..ad3cafe 100644 --- a/Freeswitch.2008.express.sln +++ b/Freeswitch.2008.express.sln @@ -1,6 +1,6 @@  Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 +# Visual C++ Express 2008 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeSwitchConsole", "w32\Console\FreeSwitchConsole.2008.vcproj", "{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}" ProjectSection(ProjectDependencies) = postProject {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} @@ -11,6 +11,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeSwitchCoreLib", "w32\Li ProjectSection(ProjectDependencies) = postProject {8D04B550-D240-4A44-8A18-35DA3F7038D9} = {8D04B550-D240-4A44-8A18-35DA3F7038D9} {89385C74-5860-4174-9CAF-A39E7C48909C} = {89385C74-5860-4174-9CAF-A39E7C48909C} + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} {03207781-0D1C-4DB3-A71D-45C608F28DBD} = {03207781-0D1C-4DB3-A71D-45C608F28DBD} {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} commit 102640ad7be96a2f23194cefbb1ca824416576dd Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Dec 15 11:45:50 2010 -0500 freetdm: support for SIGEVENT_RING diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 26b8463..d8f98f1 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -2167,6 +2167,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_clear_channel_signal) } break; case FTDM_SIGEVENT_PROGRESS: + case FTDM_SIGEVENT_RINGING: { if ((session = ftdm_channel_get_session(sigmsg->channel, 0))) { channel = switch_core_session_get_channel(session); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index f8867d5..48ddddc 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -215,7 +215,7 @@ ftdm_state_map_t sangoma_isdn_state_map = { ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_DIALING, FTDM_END}, {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, - FTDM_CHANNEL_STATE_PROCEED, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, + FTDM_CHANNEL_STATE_PROCEED, FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_DOWN, FTDM_END} }, { @@ -223,8 +223,8 @@ ftdm_state_map_t sangoma_isdn_state_map = { ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_PROCEED, FTDM_END}, {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, - FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_END}, - }, + FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_END}, + }, { ZSD_OUTBOUND, ZSM_UNACCEPTABLE, @@ -234,6 +234,12 @@ ftdm_state_map_t sangoma_isdn_state_map = { { ZSD_OUTBOUND, ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_RINGING, FTDM_END}, + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_END}, + }, + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_END}, {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_UP, FTDM_END}, }, @@ -692,8 +698,17 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) break; case FTDM_CHANNEL_STATE_RINGING: { - ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_NETE_ISDN}; - sngisdn_snd_alert(ftdmchan, prog_ind); + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + /* OUTBOUND...so we were told by the line of this so notify the user */ + sigev.event_id = FTDM_SIGEVENT_RINGING; + ftdm_span_send_signal(ftdmchan->span, &sigev); + if (sngisdn_test_flag(sngisdn_info, FLAG_MEDIA_READY)) { + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); + } + } else { + ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_NETE_ISDN}; + sngisdn_snd_alert(ftdmchan, prog_ind); + } } break; case FTDM_CHANNEL_STATE_PROGRESS: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 4662d4e..0c6c1c6 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -101,9 +101,11 @@ typedef enum { FLAG_GLARE = (1 << 6), FLAG_DELAYED_REL = (1 << 7), FLAG_SENT_PROCEED = (1 << 8), - FLAG_SEND_DISC = (1 << 9), + FLAG_SEND_DISC = (1 << 9), /* Used for BRI only, flag is set after we request line CONNECTED */ - FLAG_ACTIVATING = (1 << 10), + FLAG_ACTIVATING = (1 << 10), + /* Used when we receive an ALERT msg + inband tones ready */ + FLAG_MEDIA_READY = (1 << 11), } sngisdn_flag_t; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index bdd3717..7e9e360 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -278,6 +278,7 @@ void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event) if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { switch(ftdmchan->state) { case FTDM_CHANNEL_STATE_PROCEED: + case FTDM_CHANNEL_STATE_RINGING: case FTDM_CHANNEL_STATE_PROGRESS: case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: case FTDM_CHANNEL_STATE_DIALING: @@ -364,21 +365,38 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); goto sngisdn_process_cnst_ind_end; } - + switch(ftdmchan->state) { case FTDM_CHANNEL_STATE_DIALING: case FTDM_CHANNEL_STATE_PROCEED: - if (cnStEvnt->progInd.eh.pres && cnStEvnt->progInd.progDesc.val == IN_PD_IBAVAIL) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); - } else if (evntType == MI_CALLPROC) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROCEED); - } else { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); - } - break; case FTDM_CHANNEL_STATE_PROGRESS: + case FTDM_CHANNEL_STATE_RINGING: if (cnStEvnt->progInd.eh.pres && cnStEvnt->progInd.progDesc.val == IN_PD_IBAVAIL) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); + sngisdn_set_flag(sngisdn_info, FLAG_MEDIA_READY); + } + switch (evntType) { + case MI_CALLPROC: + if (ftdmchan->state == FTDM_CHANNEL_STATE_DIALING) { + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROCEED); + } + break; + case MI_ALERTING: + if (ftdmchan->state == FTDM_CHANNEL_STATE_PROCEED) { + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RINGING); + } + break; + case MI_PROGRESS: + if (sngisdn_test_flag(sngisdn_info, FLAG_MEDIA_READY)) { + + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); + } else if (ftdmchan->state != FTDM_CHANNEL_STATE_PROGRESS) { + + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); + } + break; + default: + /* We should never reach this section !*/ + ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle this event %d\n", evntType); } break; case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index a3cddad..f8f69ab 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -314,7 +314,8 @@ typedef enum { FTDM_SIGEVENT_RELEASED, /*!< Channel is completely released and available */ FTDM_SIGEVENT_UP, /*!< Outgoing call has been answered */ FTDM_SIGEVENT_FLASH, /*!< Flash event (typically on-hook/off-hook for analog devices) */ - FTDM_SIGEVENT_PROCEED, /*!< Outgoing call got a response */ + FTDM_SIGEVENT_PROCEED, /*!< Outgoing call got a response */ + FTDM_SIGEVENT_RINGING, /*!< Remote side is in ringing state */ FTDM_SIGEVENT_PROGRESS, /*!< Outgoing call is making progress */ FTDM_SIGEVENT_PROGRESS_MEDIA, /*!< Outgoing call is making progress and there is media available */ FTDM_SIGEVENT_ALARM_TRAP, /*!< Hardware alarm ON */ @@ -327,7 +328,7 @@ typedef enum { FTDM_SIGEVENT_FACILITY, /* !< In call facility event */ FTDM_SIGEVENT_INVALID } ftdm_signal_event_t; -#define SIGNAL_STRINGS "START", "STOP", "RELEASED", "UP", "FLASH", "PROCEED", "PROGRESS", \ +#define SIGNAL_STRINGS "START", "STOP", "RELEASED", "UP", "FLASH", "PROCEED", "RINGING", "PROGRESS", \ "PROGRESS_MEDIA", "ALARM_TRAP", "ALARM_CLEAR", \ "COLLECTED_DIGIT", "ADD_CALL", "RESTART", "SIGSTATUS_CHANGED", "COLLISION", "MSG", "INVALID" commit 416f6388c3756b92b99bd36ab12de957cf55409b Author: Jeff Lenk <jeff@jefflenk.com> Date: Wed Dec 15 10:37:57 2010 -0600 windows build fixes for last commit diff --git a/libs/stfu/stfu.c b/libs/stfu/stfu.c index 72459ca..4965b12 100644 --- a/libs/stfu/stfu.c +++ b/libs/stfu/stfu.c @@ -40,6 +40,8 @@ #ifdef _MSC_VER /* warning C4706: assignment within conditional expression*/ #pragma warning(disable: 4706) +/* warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. See online help for details. */ +#pragma warning(disable:4996) #endif #define least1(_z) (_z ? _z : 1) @@ -641,7 +643,7 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i) if (!found && i->samples_per_packet) { - int y; + uint32_t y; stfu_frame_t *frame = NULL; int32_t delay = i->last_rd_ts - i->cur_ts; diff --git a/libs/stfu/stfu.h b/libs/stfu/stfu.h index f65511b..ad769c6 100644 --- a/libs/stfu/stfu.h +++ b/libs/stfu/stfu.h @@ -136,7 +136,7 @@ typedef void (*stfu_logger_t)(const char *file, const char *func, int line, int int stfu_vasprintf(char **ret, const char *fmt, va_list ap); -STFU_DECLARE_DATA extern stfu_logger_t stfu_log; +extern stfu_logger_t stfu_log; /*! Sets the logger for libstfu. Default is the null_logger */ void stfu_global_set_logger(stfu_logger_t logger); diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 08a22cc..4e667fb 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -2135,11 +2135,18 @@ static void do_flush(switch_rtp_t *rtp_session) flushed++; +#ifdef _MSC_VER +#pragma warning(push) /* remove this stuff when "if (0" is removed */ +#pragma warning(disable:4127) +#endif if (0 && rtp_session->jb) { stfu_n_eat(rtp_session->jb, ntohl(rtp_session->recv_msg.header.ts), rtp_session->recv_msg.header.pt, rtp_session->recv_msg.body, bytes - rtp_header_len); } +#ifdef _MSC_VER +#pragma warning(pop) +#endif rtp_session->stats.inbound.raw_bytes += bytes; rtp_session->stats.inbound.flush_packet_count++; commit 2c8d5d8ec9833f02f6a7b58079dbeb71da0e2456 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Dec 15 10:22:45 2010 -0600 use our version for better compat diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 306e58a..08a22cc 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1659,7 +1659,7 @@ static void jb_logger(const char *file, const char *func, int line, int level, c va_list ap; va_start(ap, fmt); - ret = stfu_vasprintf(&data, fmt, ap); + ret = switch_vasprintf(&data, fmt, ap); if (ret != -1) { switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_CONSOLE, "%s", data); free(data); commit 8bb15b270c635a75f2bed3d007454171e7dbc73b Merge: 6d21b59 3085523 Author: Moises Silva <moy@sangoma.com> Date: Wed Dec 15 11:20:29 2010 -0500 Merge branch 'master' into netborder commit 5fd5ee0d4889440f443446994dc74be157f78653 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Dec 15 09:39:42 2010 -0600 doh diff --git a/libs/stfu/stfu.c b/libs/stfu/stfu.c index 547c337..72459ca 100644 --- a/libs/stfu/stfu.c +++ b/libs/stfu/stfu.c @@ -33,11 +33,19 @@ # define UINT_MAX 4294967295U #endif +#ifndef UINT16_MAX +# define UINT16_MAX 65535 +#endif + #ifdef _MSC_VER /* warning C4706: assignment within conditional expression*/ #pragma warning(disable: 4706) #endif +#define least1(_z) (_z ? _z : 1) + +static int stfu_log_level = 7; + struct stfu_queue { struct stfu_frame *array; struct stfu_frame int_frame; @@ -53,13 +61,13 @@ typedef struct stfu_queue stfu_queue_t; struct stfu_instance { struct stfu_queue a_queue; struct stfu_queue b_queue; + struct stfu_queue c_queue; struct stfu_queue *in_queue; struct stfu_queue *out_queue; + struct stfu_queue *old_queue; struct stfu_frame *last_frame; uint32_t cur_ts; - uint32_t cur_seq; uint32_t last_wr_ts; - uint32_t last_wr_seq; uint32_t last_rd_ts; uint32_t samples_per_packet; uint32_t samples_per_second; @@ -76,6 +84,7 @@ struct stfu_instance { uint32_t period_packet_in_count; uint32_t period_packet_out_count; uint32_t period_missing_count; + uint32_t period_need_range; uint32_t period_need_range_avg; uint32_t period_clean_count; @@ -86,25 +95,55 @@ struct stfu_instance { uint32_t session_packet_in_count; uint32_t session_packet_out_count; - uint32_t sync; + uint32_t sync_out; + uint32_t sync_in; int32_t ts_diff; int32_t last_ts_diff; int32_t same_ts; - uint32_t last_seq; - uint32_t period_time; uint32_t decrement_time; uint32_t plc_len; + uint32_t plc_pt; + uint32_t diff; + uint32_t diff_total; + uint8_t ready; + uint8_t debug; + char *name; stfu_n_call_me_t callback; void *udata; }; static void stfu_n_reset_counters(stfu_instance_t *i); +static void null_logger(const char *file, const char *func, int line, int level, const char *fmt, ...); +static void default_logger(const char *file, const char *func, int line, int level, const char *fmt, ...); + +stfu_logger_t stfu_log = null_logger; + +void stfu_global_set_logger(stfu_logger_t logger) +{ + if (logger) { + stfu_log = logger; + } else { + stfu_log = null_logger; + } +} + +void stfu_global_set_default_logger(int level) +{ + if (level < 0 || level > 7) { + level = 7; + } + + stfu_log = default_logger; + stfu_log_level = level; +} + + static stfu_status_t stfu_n_resize_aqueue(stfu_queue_t *queue, uint32_t qlen) { @@ -151,12 +190,27 @@ void stfu_n_destroy(stfu_instance_t **i) if (i && *i) { ii = *i; *i = NULL; + if (ii->name) free(ii->name); free(ii->a_queue.array); free(ii->b_queue.array); + free(ii->c_queue.array); free(ii); } } +void stfu_n_debug(stfu_instance_t *i, const char *name) +{ + if (i->name) free(i->name); + + if (name) { + i->name = strdup(name); + i->debug = 1; + } else { + i->name = strdup("none"); + i->debug = 0; + } +} + void stfu_n_report(stfu_instance_t *i, stfu_report_t *r) { assert(i); @@ -172,7 +226,6 @@ stfu_status_t stfu_n_resize(stfu_instance_t *i, uint32_t qlen) stfu_status_t s; if (i->qlen == i->max_qlen) { - printf("FUCKER1\n"); return STFU_IT_FAILED; } @@ -180,13 +233,14 @@ stfu_status_t stfu_n_resize(stfu_instance_t *i, uint32_t qlen) if (i->qlen < i->max_qlen) { qlen = i->max_qlen; } else { - printf("FUCKER2\n"); return STFU_IT_FAILED; } } if ((s = stfu_n_resize_aqueue(&i->a_queue, qlen)) == STFU_IT_WORKED) { s = stfu_n_resize_aqueue(&i->b_queue, qlen); + s = stfu_n_resize_aqueue(&i->c_queue, qlen); + i->qlen = qlen; i->max_plc = 5; i->last_frame = NULL; @@ -205,11 +259,6 @@ stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_qlen, uint32_t samples_ } memset(i, 0, sizeof(*i)); - -#ifdef DB_JB - printf("INIT %u %u\n", qlen, max_qlen); -#endif - i->qlen = qlen; i->max_qlen = max_qlen; i->orig_qlen = qlen; @@ -217,8 +266,12 @@ stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_qlen, uint32_t samples_ stfu_n_init_aqueue(&i->a_queue, qlen); stfu_n_init_aqueue(&i->b_queue, qlen); + stfu_n_init_aqueue(&i->c_queue, qlen); + i->in_queue = &i->a_queue; i->out_queue = &i->b_queue; + i->old_queue = &i->c_queue; + i->name = strdup("none"); i->max_plc = i->qlen / 2; @@ -232,9 +285,9 @@ stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_qlen, uint32_t samples_ static void stfu_n_reset_counters(stfu_instance_t *i) { -#ifdef DB_JB - printf("COUNTER RESET........\n"); -#endif + if (stfu_log != null_logger && i->debug) { + stfu_log(STFU_LOG_EMERG, "%s COUNTER RESET........\n", i->name); + } if (i->callback) { i->callback(i, i->udata); @@ -248,36 +301,44 @@ static void stfu_n_reset_counters(stfu_instance_t *i) i->period_packet_in_count = 0; i->period_packet_out_count = 0; i->period_missing_count = 0; + i->period_need_range = 0; i->period_need_range_avg = 0; + + i->diff = 0; + i->diff_total = 0; + } void stfu_n_reset(stfu_instance_t *i) { -#ifdef DB_JB - printf("RESET\n"); -#endif + if (stfu_log != null_logger && i->debug) { + stfu_log(STFU_LOG_EMERG, "%s RESET\n", i->name); + } + + i->ready = 0; i->in_queue = &i->a_queue; i->out_queue = &i->b_queue; + i->old_queue = &i->c_queue; + i->in_queue->array_len = 0; i->out_queue->array_len = 0; i->out_queue->wr_len = 0; i->last_frame = NULL; - i->in_queue->last_jitter = 0; i->out_queue->last_jitter = 0; - stfu_n_reset_counters(i); - - i->last_seq = 0; + stfu_n_reset_counters(i); + stfu_n_sync(i, 1); + i->cur_ts = 0; - i->cur_seq = 0; i->last_wr_ts = 0; - i->last_wr_seq = 0; i->last_rd_ts = 0; i->miss_count = 0; i->packet_count = 0; + + } stfu_status_t stfu_n_sync(stfu_instance_t *i, uint32_t packets) @@ -286,20 +347,39 @@ stfu_status_t stfu_n_sync(stfu_instance_t *i, uint32_t packets) if (packets > i->qlen) { stfu_n_reset(i); } else { - i->sync = packets; + i->sync_out = packets; + i->sync_in = packets; } return STFU_IT_WORKED; } -stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t seq, uint32_t pt, void *data, size_t datalen, int last) +static void stfu_n_swap(stfu_instance_t *i) +{ + stfu_queue_t *last_in = i->in_queue, *last_out = i->out_queue, *last_old = i->old_queue; + + i->ready = 1; + + i->in_queue = last_out; + i->out_queue = last_old; + i->old_queue = last_in; + + i->in_queue->array_len = 0; + i->out_queue->wr_len = 0; + i->last_frame = NULL; + i->miss_count = 0; + i->in_queue->last_index = 0; + i->out_queue->last_index = 0; + i->out_queue->last_jitter = 0; +} + +stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void *data, size_t datalen, int last) { uint32_t index = 0; stfu_frame_t *frame; size_t cplen = 0; - int good_seq = 0, good_ts = 0; - uint32_t min_seq = UINT_MAX, min_ts = UINT_MAX, min_index = 0; + int good_ts = 0; if (!i->samples_per_packet && ts && i->last_rd_ts) { i->ts_diff = ts - i->last_rd_ts; @@ -320,16 +400,27 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t seq, uin } } - if ((seq && seq == i->last_seq + 1) || (i->last_seq > 65500 && seq == 0)) { - good_seq = 1; - } - - if ((ts && ts == i->last_rd_ts + i->samples_per_packet) || (i->last_rd_ts > 4294900000 && ts < 5000)) { + if (i->sync_in) { good_ts = 1; - } + i->sync_in = 0; + } else { + if ((ts && ts == i->last_rd_ts + i->samples_per_packet) || (i->last_rd_ts > 4294900000 && ts < 5000)) { + good_ts = 1; + } - if (good_seq || good_ts) { + if (i->last_wr_ts) { + if ((ts <= i->last_wr_ts && (i->last_wr_ts != UINT_MAX || ts == i->last_wr_ts))) { + stfu_log(STFU_LOG_EMERG, "%s TOO LATE !!! %u \n\n\n", i->name, ts); + if (i->in_queue->array_len < i->in_queue->array_size) { + i->in_queue->array_len++; + } + return STFU_ITS_TOO_LATE; + } + } + } + + if (good_ts) { i->period_clean_count++; i->session_clean_count++; } @@ -337,12 +428,12 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t seq, uin i->period_packet_in_count++; i->session_packet_in_count++; - i->period_need_range_avg = i->period_need_range / (i->period_missing_count || 1); + i->period_need_range_avg = i->period_need_range / least1(i->period_missing_count); if (i->period_missing_count > i->qlen * 2) { -#ifdef DB_JB - printf("resize %u %u\n", i->qlen, i->qlen + 1); -#endif + if (stfu_log != null_logger && i->debug) { + stfu_log(STFU_LOG_EMERG, "%s resize %u %u\n", i->name, i->qlen, i->qlen + 1); + } stfu_n_resize(i, i->qlen + 1); stfu_n_reset_counters(i); } else { @@ -353,7 +444,24 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t seq, uin } } + + i->diff = 0; + + if (i->last_wr_ts) { + if (ts < 1000 && i->last_wr_ts > (UINT_MAX - 1000)) { + i->diff = abs(((UINT_MAX - i->last_wr_ts) + ts) / i->samples_per_packet); + } else if (ts) { + i->diff = abs(i->last_wr_ts - ts) / i->samples_per_packet; + } + } + + i->diff_total += i->diff; + if ((i->period_packet_in_count > i->period_time)) { + uint32_t avg; + + avg = i->diff_total / least1(i->period_packet_in_count); + i->period_packet_in_count = 0; if (i->period_missing_count == 0 && i->qlen > i->orig_qlen) { @@ -364,68 +472,38 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t seq, uin stfu_n_reset_counters(i); } -#ifdef DB_JB - printf("%u i=%u/%u - g:%u/%u c:%u/%u b:%u - %u/%u - %u %d\n", - i->qlen, i->period_packet_in_count, i->period_time, i->consecutive_good_count, - i->decrement_time, i->period_clean_count, i->decrement_time, i->consecutive_bad_count, - seq, ts, - i->period_missing_count, i->period_need_range_avg); -#endif + + + if (stfu_log != null_logger && i->debug) { + stfu_log(STFU_LOG_EMERG, "%s %u i=%u/%u - g:%u/%u c:%u/%u b:%u - %u:%u - %u %d %u %u %d %d\n", i->name, + i->qlen, i->period_packet_in_count, i->period_time, i->consecutive_good_count, + i->decrement_time, i->period_clean_count, i->decrement_time, i->consecutive_bad_count, + ts, ts / i->samples_per_packet, + i->period_missing_count, i->period_need_range_avg, + i->last_wr_ts, ts, i->diff, i->diff_total / least1(i->period_packet_in_count)); + } if (last || i->in_queue->array_len == i->in_queue->array_size) { - stfu_queue_t *other_queue; - - other_queue = i->in_queue; - i->in_queue = i->out_queue; - i->out_queue = other_queue; - - i->in_queue->array_len = 0; - i->out_queue->wr_len = 0; - i->last_frame = NULL; - i->miss_count = 0; - i->in_queue->last_index = 0; - i->out_queue->last_index = 0; - i->out_queue->last_jitter = 0; + stfu_n_swap(i); } if (last) { return STFU_IM_DONE; } - for(index = 0; index < i->in_queue->array_size; index++) { - - if (i->in_queue->array[index].was_read) { - min_index = index; - break; - } - - if (i->in_queue->array[index].seq < min_seq) { - min_seq = i->in_queue->array[index].seq; - min_index = index; - } - - if (i->in_queue->array[index].ts < min_ts) { - min_ts = i->in_queue->array[index].ts; - min_index = index; - } - } - - index = min_index; - - if (i->in_queue->array_len < i->in_queue->array_size) { - i->in_queue->array_len++; - } - + index = i->in_queue->array_len++; assert(index < i->in_queue->array_size); - frame = &i->in_queue->array[index]; + if (i->in_queue->array_len == i->in_queue->array_size) { + stfu_n_swap(i); + } + if ((cplen = datalen) > sizeof(frame->data)) { cplen = sizeof(frame->data); } - i->last_seq = seq; i->last_rd_ts = ts; i->packet_count++; @@ -433,61 +511,57 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t seq, uin frame->pt = pt; frame->ts = ts; - frame->seq = seq; frame->dlen = cplen; frame->was_read = 0; return STFU_IT_WORKED; } -static int stfu_n_find_any_frame(stfu_instance_t *in, stfu_frame_t **r_frame) +static int stfu_n_find_any_frame(stfu_instance_t *in, stfu_queue_t *queue, stfu_frame_t **r_frame) { uint32_t i = 0; stfu_frame_t *frame = NULL; - stfu_queue_t *queue; assert(r_frame); *r_frame = NULL; - for (queue = in->out_queue ; queue && queue != in->in_queue ; queue = in->in_queue) { - - for(i = 0; i < queue->real_array_size; i++) { - frame = &queue->array[i]; - if (!frame->was_read) { - *r_frame = frame; - queue->last_index = i; - frame->was_read = 1; - in->period_packet_out_count++; - in->session_packet_out_count++; - return 1; - } + for(i = 0; i < queue->real_array_size; i++) { + frame = &queue->array[i]; + if (!frame->was_read) { + *r_frame = frame; + queue->last_index = i; + frame->was_read = 1; + in->period_packet_out_count++; + in->session_packet_out_count++; + return 1; } - } return 0; } -static int stfu_n_find_frame(stfu_instance_t *in, stfu_queue_t *queue, uint32_t ts, uint32_t seq, stfu_frame_t **r_frame) +static int stfu_n_find_frame(stfu_instance_t *in, stfu_queue_t *queue, uint32_t ts, stfu_frame_t **r_frame) { uint32_t i = 0; stfu_frame_t *frame = NULL; - assert(r_frame); - - *r_frame = NULL; + if (r_frame) { + *r_frame = NULL; + } - for(i = 0; i < queue->real_array_size; i++) { + for(i = 0; i < queue->array_size; i++) { frame = &queue->array[i]; - if (((seq || in->last_seq) && frame->seq == seq) || frame->ts == ts) { - *r_frame = frame; - queue->last_index = i; - frame->was_read = 1; - in->period_packet_out_count++; - in->session_packet_out_count++; + if (frame->ts == ts) { + if (r_frame) { + *r_frame = frame; + queue->last_index = i; + frame->was_read = 1; + in->period_packet_out_count++; + in->session_packet_out_count++; + } return 1; } } @@ -500,48 +574,76 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i) stfu_frame_t *rframe = NULL; int found = 0; - if (!i->samples_per_packet || !i->out_queue->array_len) { - //|| ((i->out_queue->wr_len == i->out_queue->array_len) || !i->out_queue->array_len)) { - return NULL; - } + if (!i->samples_per_packet) { + return NULL; + } + + if (!i->ready) { + if (stfu_log != null_logger && i->debug) { + stfu_log(STFU_LOG_EMERG, "%s XXXSKIP\n", i->name); + } + return NULL; + } + - if (i->cur_ts == 0) { - i->cur_ts = i->out_queue->array[0].ts; + if (i->cur_ts == 0 && i->last_wr_ts < 1000) { + uint32_t x = 0; + for (x = 0; x < i->out_queue->array_len; x++) { + if (!i->out_queue->array[x].was_read) { + i->cur_ts = i->out_queue->array[x].ts; + break; + } + if (i->cur_ts == 0) { + if (stfu_log != null_logger && i->debug) { + stfu_log(STFU_LOG_EMERG, "%s XXXPUNT\n", i->name); + return NULL; + } + } + } } else { - i->cur_ts += i->samples_per_packet; + i->cur_ts = i->cur_ts + i->samples_per_packet; } - if (i->cur_seq == 0) { - i->cur_seq = i->out_queue->array[0].seq; + found = stfu_n_find_frame(i, i->out_queue, i->cur_ts, &rframe); + + if (found) { + if (i->out_queue->array_len) { + i->out_queue->array_len--; + } } else { - i->cur_seq++; - /* if we bother using this for anything that doesn't have 16 bit seq, we'll make this a param */ - if (i->cur_seq == 65535) { - i->cur_seq = 0; + found = stfu_n_find_frame(i, i->in_queue, i->cur_ts, &rframe); + + if (!found) { + found = stfu_n_find_frame(i, i->old_queue, i->cur_ts, &rframe); } } - if (!(found = stfu_n_find_frame(i, i->out_queue, i->cur_ts, i->cur_seq, &rframe))) { - found = stfu_n_find_frame(i, i->in_queue, i->cur_ts, i->cur_seq, &rframe); + if (i->sync_out) { + if (!found) { + if ((found = stfu_n_find_any_frame(i, i->out_queue, &rframe))) { + i->cur_ts = rframe->ts; + } + + if (stfu_log != null_logger && i->debug) { + stfu_log(STFU_LOG_EMERG, "%s SYNC %u %u:%u\n", i->name, i->sync_out, i->cur_ts, i->cur_ts / i->samples_per_packet); + } + + } + i->sync_out = 0; } - if (!found && i->sync) { -#ifdef DB_JB - printf("SYNC %u\n", i->sync); -#endif - if ((found = stfu_n_find_any_frame(i, &rframe))) { - i->cur_seq = rframe->seq; - i->cur_ts = rframe->ts; + if (!i->cur_ts) { + if (stfu_log != null_logger && i->debug) { + stfu_log(STFU_LOG_EMERG, "%s NO TS\n", i->name); } - i->sync = 0; + return NULL; } if (!found && i->samples_per_packet) { -#ifdef DB_JB int y; stfu_frame_t *frame = NULL; -#endif + int32_t delay = i->last_rd_ts - i->cur_ts; uint32_t need = abs(i->last_rd_ts - i->cur_ts) / i->samples_per_packet; @@ -550,30 +652,32 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i) i->session_missing_count++; i->period_need_range += need; -#ifdef DB_JB - printf("MISSING %u %u %u %u %d %u %d\n", i->cur_seq, i->cur_ts, i->packet_count, i->last_rd_ts, delay, i->qlen, need); -#endif + if (stfu_log != null_logger && i->debug) { + stfu_log(STFU_LOG_EMERG, "%s MISSING %u:%u %u %u %d %u %d\n", i->name, + i->cur_ts, i->cur_ts / i->samples_per_packet, i->packet_count, i->last_rd_ts, delay, i->qlen, need); + } if (i->packet_count > i->orig_qlen * 100 && delay > 0 && need > i->qlen && need < (i->qlen + 5)) { i->packet_count = 0; } -#ifdef DB_JB - for(y = 0; y < i->out_queue->array_size; y++) { - if ((y % 5) == 0) printf("\n"); - frame = &i->out_queue->array[y]; - printf("%u:%u\t", frame->seq, frame->ts); - } - printf("\n\n"); + if (stfu_log != null_logger && i->debug) { + for(y = 0; y < i->out_queue->array_size; y++) { + if ((y % 5) == 0) stfu_log(STFU_LOG_EMERG, "\n%s", i->name); + frame = &i->out_queue->array[y]; + stfu_log(STFU_LOG_EMERG, "%u:%u\t", frame->ts, frame->ts / i->samples_per_packet); + } + stfu_log(STFU_LOG_EMERG, "%s\n", i->name); + + for(y = 0; y < i->in_queue->array_size; y++) { + if ((y % 5) == 0) stfu_log(STFU_LOG_EMERG, "\n%s", i->name); + frame = &i->in_queue->array[y]; + stfu_log(STFU_LOG_EMERG, "%u:%u\t", frame->ts, frame->ts / i->samples_per_packet); + } + stfu_log(STFU_LOG_EMERG, "%s\n\n\n", i->name); - for(y = 0; y < i->in_queue->array_size; y++) { - if ((y % 5) == 0) printf("\n"); - frame = &i->in_queue->array[y]; - printf("%u:%u\t", frame->seq, frame->ts); } - printf("\n\n"); -#endif if (delay < 0) { stfu_n_reset(i); @@ -581,14 +685,11 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i) } } -#ifdef DB_JB - if (found) { - printf("O: %u:%u %u %d\n", rframe->seq, rframe->ts, rframe->plc, rframe->seq - i->last_seq); - } else { - printf("DATA: %u %u %d %s %d\n", i->packet_count, i->consecutive_good_count, i->out_queue->last_jitter, found ? "found" : "not found", i->qlen); + if (stfu_log != null_logger && i->debug) { + if (found) { + stfu_log(STFU_LOG_EMERG, "%s O: %u:%u %u\n", i->name, rframe->ts, rframe->ts / i->samples_per_packet, rframe->plc); + } } -#endif - if (found) { i->consecutive_good_count++; @@ -602,36 +703,28 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i) if (found) { i->last_frame = rframe; - i->out_queue->wr_len++; - i->last_wr_ts = rframe->ts; - i->last_wr_seq = rframe->seq; - i->miss_count = 0; + i->out_queue->wr_len++; + i->last_wr_ts = rframe->ts; + + i->miss_count = 0; if (rframe->dlen) { i->plc_len = rframe->dlen; } + + i->plc_pt = rframe->pt; + } else { i->last_wr_ts = i->cur_ts; - i->last_wr_seq = i->cur_seq; rframe = &i->out_queue->int_frame; rframe->dlen = i->plc_len; - -#if 0 - if (i->last_frame) { - /* poor man's plc.. Copy the last frame, but we flag it so you can use a better one if you wish */ - if (i->miss_count) { - memset(rframe->data, 255, rframe->dlen); - } else { - memcpy(rframe->data, i->last_frame->data, rframe->dlen); - } - } -#endif + rframe->pt = i->plc_pt; rframe->ts = i->cur_ts; - i->miss_count++; - -#ifdef DB_JB - printf("PLC %d %d %ld %u %u\n", i->miss_count, rframe->plc, rframe->dlen, rframe->seq, rframe->ts); -#endif + + if (stfu_log != null_logger && i->debug) { + stfu_log(STFU_LOG_EMERG, "%s PLC %d %d %ld %u:%u\n", i->name, + i->miss_count, rframe->plc, rframe->dlen, rframe->ts, rframe->ts / i->samples_per_packet); + } if (i->miss_count > i->max_plc) { stfu_n_reset(i); @@ -639,9 +732,138 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i) } } - return rframe; + return rframe; } +#ifdef WIN32 +#ifndef vsnprintf +#define vsnprintf _vsnprintf +#endif +#endif + + +int vasprintf(char **ret, const char *format, va_list ap); + +int stfu_vasprintf(char **ret, const char *fmt, va_list ap) +{ +#if !defined(WIN32) && !defined(__sun) + return vasprintf(ret, fmt, ap); +#else + char *buf; + int len; + size_t buflen; + va_list ap2; + char *tmp = NULL; + +#ifdef _MSC_VER +#if _MSC_VER >= 1500 + /* hack for incorrect assumption in msvc header files for code analysis */ + __analysis_assume(tmp); +#endif + ap2 = ap; +#else + va_copy(ap2, ap); +#endif + + len = vsnprintf(tmp, 0, fmt, ap2); + + if (len > 0 && (buf = malloc((buflen = (size_t) (len + 1)))) != NULL) { + len = vsnprintf(buf, buflen, fmt, ap); + *ret = buf; + } else { + *ret = NULL; + len = -1; + } + + va_end(ap2); + return len; +#endif +} + + + + +int stfu_snprintf(char *buffer, size_t count, const char *fmt, ...) +{ + va_list ap; + int ret; + + va_start(ap, fmt); + ret = vsnprintf(buffer, count-1, fmt, ap); + if (ret < 0) + buffer[count-1] = '\0'; + va_end(ap); + return ret; +} + +static void null_logger(const char *file, const char *func, int line, int level, const char *fmt, ...) +{ + if (file && func && line && level && fmt) { + return; + } + return; +} + + + +static const char *LEVEL_NAMES[] = { + "EMERG", + "ALERT", + "CRIT", + "ERROR", + "WARNING", + "NOTICE", + "INFO", + "DEBUG", + NULL +}; + +static const char *cut_path(const char *in) +{ + const char *p, *ret = in; + char delims[] = "/\\"; + char *i; + + for (i = delims; *i; i++) { + p = in; + while ((p = strchr(p, *i)) != 0) { + ret = ++p; + } + } + return ret; +} + + +static void default_logger(const char *file, const char *func, int line, int level, const char *fmt, ...) +{ + const char *fp; + char *data; + va_list ap; + int ret; + + if (level < 0 || level > 7) { + level = 7; + } + if (level > stfu_log_level) { + return; + } + + fp = cut_path(file); + + va_start(ap, fmt); + + ret = stfu_vasprintf(&data, fmt, ap); + + if (ret != -1) { + fprintf(stderr, "[%s] %s:%d %s() %s", LEVEL_NAMES[level], file, line, func, data); + free(data); + } + + va_end(ap); + +} + + /* For Emacs: * Local Variables: * mode:c diff --git a/libs/stfu/stfu.h b/libs/stfu/stfu.h index d2760b2..f65511b 100644 --- a/libs/stfu/stfu.h +++ b/libs/stfu/stfu.h @@ -38,6 +38,8 @@ extern "C" { #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <stdarg.h> + #ifdef _MSC_VER #ifndef uint32_t @@ -62,6 +64,85 @@ typedef unsigned long in_addr_t; #endif #include <assert.h> + + +#ifdef WIN32 +#include <winsock2.h> +#include <windows.h> +typedef SOCKET stfu_socket_t; +typedef unsigned __int64 uint64_t; +typedef unsigned __int32 uint32_t; +typedef unsigned __int16 uint16_t; +typedef unsigned __int8 uint8_t; +typedef __int64 int64_t; +typedef __int32 int32_t; +typedef __int16 int16_t; +typedef __int8 int8_t; +typedef intptr_t stfu_ssize_t; +typedef int stfu_filehandle_t; +#define STFU_SOCK_INVALID INVALID_SOCKET +#define strerror_r(num, buf, size) strerror_s(buf, size, num) +#if defined(STFU_DECLARE_STATIC) +#define STFU_DECLARE(type) type __stdcall +#define STFU_DECLARE_NONSTD(type) type __cdecl +#define STFU_DECLARE_DATA +#elif defined(STFU_EXPORTS) +#define STFU_DECLARE(type) __declspec(dllexport) type __stdcall +#define STFU_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl +#define STFU_DECLARE_DATA __declspec(dllexport) +#else +#define STFU_DECLARE(type) __declspec(dllimport) type __stdcall +#define STFU_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl +#define STFU_DECLARE_DATA __declspec(dllimport) +#endif +#else +#define STFU_DECLARE(type) type +#define STFU_DECLARE_NONSTD(type) type +#define STFU_DECLARE_DATA +#include <stdint.h> +#include <sys/types.h> +#include <sys/ioctl.h> +#include <stdarg.h> +#include <sys/socket.h> +#include <netinet/in.h> +#include <netdb.h> +#define STFU_SOCK_INVALID -1 +typedef int stfu_socket_t; +typedef ssize_t stfu_ssize_t; +typedef int stfu_filehandle_t; +#endif + + +#define STFU_PRE __FILE__, __FUNCTION__, __LINE__ +#define STFU_LOG_LEVEL_DEBUG 7 +#define STFU_LOG_LEVEL_INFO 6 +#define STFU_LOG_LEVEL_NOTICE 5 +#define STFU_LOG_LEVEL_WARNING 4 +#define STFU_LOG_LEVEL_ERROR 3 +#define STFU_LOG_LEVEL_CRIT 2 +#define STFU_LOG_LEVEL_ALERT 1 +#define STFU_LOG_LEVEL_EMERG 0 + +#define STFU_LOG_DEBUG STFU_PRE, STFU_LOG_LEVEL_DEBUG +#define STFU_LOG_INFO STFU_PRE, STFU_LOG_LEVEL_INFO +#define STFU_LOG_NOTICE STFU_PRE, STFU_LOG_LEVEL_NOTICE +#define STFU_LOG_WARNING STFU_PRE, STFU_LOG_LEVEL_WARNING +#define STFU_LOG_ERROR STFU_PRE, STFU_LOG_LEVEL_ERROR +#define STFU_LOG_CRIT STFU_PRE, STFU_LOG_LEVEL_CRIT +#define STFU_LOG_ALERT STFU_PRE, STFU_LOG_LEVEL_ALERT +#define STFU_LOG_EMERG STFU_PRE, STFU_LOG_LEVEL_EMERG +typedef void (*stfu_logger_t)(const char *file, const char *func, int line, int level, const char *fmt, ...); + + +int stfu_vasprintf(char **ret, const char *fmt, va_list ap); + +STFU_DECLARE_DATA extern stfu_logger_t stfu_log; + +/*! Sets the logger for libstfu. Default is the null_logger */ +void stfu_global_set_logger(stfu_logger_t logger); +/*! Sets the default log level for libstfu */ +void stfu_global_set_default_logger(int level); + #define STFU_DATALEN 16384 #define STFU_QLEN 300 #define STFU_MAX_TRACK 256 @@ -69,13 +150,13 @@ typedef unsigned long in_addr_t; typedef enum { STFU_IT_FAILED, STFU_IT_WORKED, - STFU_IM_DONE + STFU_IM_DONE, + STFU_ITS_TOO_LATE } stfu_status_t; struct stfu_frame { uint32_t ts; uint32_t pt; - uint32_t seq; uint8_t data[STFU_DATALEN]; size_t dlen; uint8_t was_read; @@ -100,14 +181,15 @@ void stfu_n_report(stfu_instance_t *i, stfu_report_t *r); void stfu_n_destroy(stfu_instance_t **i); stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_qlen, uint32_t samples_per_packet, uint32_t samples_per_second); stfu_status_t stfu_n_resize(stfu_instance_t *i, uint32_t qlen); -stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t seq, uint32_t pt, void *data, size_t datalen, int last); +stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void *data, size_t datalen, int last); stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i); void stfu_n_reset(stfu_instance_t *i); stfu_status_t stfu_n_sync(stfu_instance_t *i, uint32_t packets); void stfu_n_call_me(stfu_instance_t *i, stfu_n_call_me_t callback, void *udata); +void stfu_n_debug(stfu_instance_t *i, const char *name); #define stfu_im_done(i) stfu_n_add_data(i, 0, NULL, 0, 1) -#define stfu_n_eat(i,t,s,p,d,l) stfu_n_add_data(i, t, s, p, d, l, 0) +#define stfu_n_eat(i,t,p,d,l) stfu_n_add_data(i, t, p, d, l, 0) #ifdef __cplusplus } commit 3085523f568cad7c9cc720d1899783fd33128bb9 Author: Moises Silva <moy@sangoma.com> Date: Wed Dec 15 09:56:27 2010 -0500 freetdm: define special size formatting that actually works on Linux and Windows diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 2fa7953..fca3adc 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2801,10 +2801,10 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co GOTO_STATUS(done, FTDM_FAIL); } if (start_chan_io_dump(ftdmchan, &ftdmchan->rxdump, size) != FTDM_SUCCESS) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to enable input dump of size %zd\n", size); + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to enable input dump of size %"FTDM_SIZE_FMT"\n", size); GOTO_STATUS(done, FTDM_FAIL); } - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Enabled input dump with size %zd\n", size); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Enabled input dump with size %"FTDM_SIZE_FMT"\n", size); GOTO_STATUS(done, FTDM_SUCCESS); } break; @@ -2816,7 +2816,8 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No need to disable input dump\n"); GOTO_STATUS(done, FTDM_SUCCESS); } - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Disabled input dump of size %zd\n", ftdmchan->rxdump.size); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Disabled input dump of size %"FTDM_SIZE_FMT"\n", + ftdmchan->rxdump.size); stop_chan_io_dump(&ftdmchan->rxdump); GOTO_STATUS(done, FTDM_SUCCESS); } @@ -2834,7 +2835,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to enable output dump of size %d\n", size); GOTO_STATUS(done, FTDM_FAIL); } - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Enabled output dump with size %zd\n", size); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Enabled output dump with size %"FTDM_SIZE_FMT"\n", size); GOTO_STATUS(done, FTDM_SUCCESS); } break; @@ -2846,7 +2847,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No need to disable output dump\n"); GOTO_STATUS(done, FTDM_SUCCESS); } - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Disabled output dump of size %zd\n", ftdmchan->rxdump.size); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Disabled output dump of size %"FTDM_SIZE_FMT"\n", ftdmchan->rxdump.size); stop_chan_io_dump(&ftdmchan->txdump); GOTO_STATUS(done, FTDM_SUCCESS); } @@ -2879,7 +2880,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co GOTO_STATUS(done, FTDM_FAIL); } dump_chan_io_to_file(ftdmchan, &ftdmchan->txdump, obj); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Dumped input of size %zd to file %p\n", ftdmchan->txdump.size, obj); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Dumped input of size %"FTDM_SIZE_FMT" to file %p\n", ftdmchan->txdump.size, obj); GOTO_STATUS(done, FTDM_SUCCESS); } break; @@ -3448,7 +3449,7 @@ static FIO_WRITE_FUNCTION(ftdm_raw_write) } if (ftdmchan->fds[FTDM_WRITE_TRACE_INDEX] > -1) { if ((write(ftdmchan->fds[FTDM_WRITE_TRACE_INDEX], data, dlen)) != dlen) { - ftdm_log(FTDM_LOG_WARNING, "Raw output trace failed to write all of the %zd bytes\n", dlen); + ftdm_log(FTDM_LOG_WARNING, "Raw output trace failed to write all of the %"FTDM_SIZE_FMT" bytes\n", dlen); } } write_chan_io_dump(&ftdmchan->txdump, data, dlen); @@ -3461,7 +3462,7 @@ static FIO_READ_FUNCTION(ftdm_raw_read) if (status == FTDM_SUCCESS && ftdmchan->fds[FTDM_READ_TRACE_INDEX] > -1) { ftdm_size_t dlen = *datalen; if ((ftdm_size_t)write(ftdmchan->fds[FTDM_READ_TRACE_INDEX], data, (int)dlen) != dlen) { - ftdm_log(FTDM_LOG_WARNING, "Raw input trace failed to write all of the %zd bytes\n", dlen); + ftdm_log(FTDM_LOG_WARNING, "Raw input trace failed to write all of the %"FTDM_SIZE_FMT" bytes\n", dlen); } } @@ -4702,7 +4703,7 @@ static ftdm_status_t load_config(void) len = strlen(val); if (len >= FTDM_MAX_NAME_STR_SZ) { len = FTDM_MAX_NAME_STR_SZ - 1; - ftdm_log(FTDM_LOG_WARNING, "Truncating group name %s to %zd length\n", val, len); + ftdm_log(FTDM_LOG_WARNING, "Truncating group name %s to %"FTDM_SIZE_FMT" length\n", val, len); } memcpy(chan_config.group_name, val, len); chan_config.group_name[len] = '\0'; diff --git a/libs/freetdm/src/include/ftdm_declare.h b/libs/freetdm/src/include/ftdm_declare.h index 5c57e01..bfec448 100644 --- a/libs/freetdm/src/include/ftdm_declare.h +++ b/libs/freetdm/src/include/ftdm_declare.h @@ -159,6 +159,7 @@ typedef __int32 int32_t; typedef __int16 int16_t; typedef __int8 int8_t; #define FTDM_O_BINARY O_BINARY +#define FTDM_SIZE_FMT "Id" #if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 #else @@ -166,6 +167,7 @@ typedef __int8 int8_t; #endif /* _MSC_VER */ #else /* __WINDOWS__ */ #define FTDM_O_BINARY 0 +#define FTDM_SIZE_FMT "zd" #define FTDM_INVALID_SOCKET -1 typedef int ftdm_socket_t; #include <stdio.h> commit c4154633cca4b5b9764e192770d08c04f71a6970 Author: Mathieu Rene <mrene@avgs.ca> Date: Wed Dec 15 09:43:36 2010 -0500 FS-2929 diff --git a/src/mod/applications/mod_spy/mod_spy.c b/src/mod/applications/mod_spy/mod_spy.c index 5093ad8..cb8981d 100644 --- a/src/mod/applications/mod_spy/mod_spy.c +++ b/src/mod/applications/mod_spy/mod_spy.c @@ -131,7 +131,6 @@ SWITCH_STANDARD_API(dump_hash) static switch_status_t process_event(switch_event_t *event) { switch_core_session_t *session = NULL; - switch_channel_t *channel; char *username[3] = { 0 }; char *domain[3] = { 0 }; char key[512]; @@ -172,18 +171,19 @@ static switch_status_t process_event(switch_event_t *event) return SWITCH_STATUS_FALSE; } - session = switch_core_session_locate(uuid); - channel = switch_core_session_get_channel(session); + if ((session = switch_core_session_locate(uuid))) { + switch_channel_t *channel = switch_core_session_get_channel(session); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "UserSpy retrieved uuid %s for key %s, activating eavesdrop \n", uuid, key); - my_uuid = switch_event_get_header(event, "Unique-ID"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "UserSpy retrieved uuid %s for key %s, activating eavesdrop \n", uuid, key); + my_uuid = switch_event_get_header(event, "Unique-ID"); - switch_channel_set_variable(channel, "spy_uuid", my_uuid); + switch_channel_set_variable(channel, "spy_uuid", my_uuid); - switch_channel_set_state(channel, CS_EXCHANGE_MEDIA); - switch_channel_set_flag(channel, CF_BREAK); + switch_channel_set_state(channel, CS_EXCHANGE_MEDIA); + switch_channel_set_flag(channel, CF_BREAK); - switch_core_session_rwunlock(session); + switch_core_session_rwunlock(session); + } return SWITCH_STATUS_SUCCESS; } commit e9958c5b0c37b44ff4dd644245412a526ba6118f Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Dec 14 23:46:26 2010 -0600 more jb work, add debug command and logging (sorry jlenk if this breaks win32) diff --git a/src/include/switch_rtp.h b/src/include/switch_rtp.h index e3e9f66..c48a40e 100644 --- a/src/include/switch_rtp.h +++ b/src/include/switch_rtp.h @@ -234,6 +234,8 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t * uint32_t max_queue_frames, uint32_t samples_per_packet, uint32_t samples_per_second); +SWITCH_DECLARE(switch_status_t) switch_rtp_debug_jitter_buffer(switch_rtp_t *rtp_session, const char *name); + SWITCH_DECLARE(switch_status_t) switch_rtp_deactivate_jitter_buffer(switch_rtp_t *rtp_session); /*! diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index d4f8b1b..4a3c7c0 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1339,6 +1339,17 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi if (msg->string_arg) { char *p; + const char *s; + + if (!strncasecmp(msg->string_arg, "debug:", 6)) { + s = msg->string_arg + 6; + if (s && !strcmp(s, "off")) { + s = NULL; + } + switch_rtp_debug_jitter_buffer(tech_pvt->rtp_session, s); + goto end; + } + if ((len = atoi(msg->string_arg))) { qlen = len / (tech_pvt->read_impl.microseconds_per_packet / 1000); diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 6e2aeaf..5cd4d4d 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -2300,7 +2300,7 @@ SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint3 break; } - stfu_n_eat(jb, ts, 0, read_frame->payload, read_frame->data, read_frame->datalen); + stfu_n_eat(jb, ts, read_frame->payload, read_frame->data, read_frame->datalen); ts += interval; if ((jb_frame = stfu_n_read_a_frame(jb))) { diff --git a/src/switch_rtp.c b/src/switch_rtp.c index b4f60fc..306e58a 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -229,7 +229,7 @@ struct switch_rtp { uint32_t sync_packets; int rtcp_interval; switch_bool_t rtcp_fresh_frame; - + uint8_t checked_jb; #ifdef ENABLE_ZRTP zrtp_session_t *zrtp_session; zrtp_profile_t *zrtp_profile; @@ -1652,6 +1652,32 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_deactivate_jitter_buffer(switch_rtp_t return SWITCH_STATUS_SUCCESS; } +static void jb_logger(const char *file, const char *func, int line, int level, const char *fmt, ...) +{ + int ret; + char *data; + va_list ap; + + va_start(ap, fmt); + ret = stfu_vasprintf(&data, fmt, ap); + if (ret != -1) { + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_CONSOLE, "%s", data); + free(data); + } + + //switch_log_printf(SWITCH_CHANNEL_ID_LOG_CLEAN, file, func, line, NULL, level, fmt, ap); + va_end(ap); +} + +SWITCH_DECLARE(switch_status_t) switch_rtp_debug_jitter_buffer(switch_rtp_t *rtp_session, const char *name) +{ + + stfu_n_debug(rtp_session->jb, name); + stfu_global_set_logger(jb_logger); + + return SWITCH_STATUS_SUCCESS; +} + SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t *rtp_session, uint32_t queue_frames, uint32_t max_queue_frames, @@ -1674,6 +1700,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t * if (rtp_session->jb) { switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session"); stfu_n_call_me(rtp_session->jb, jb_callback, session); + return SWITCH_STATUS_SUCCESS; } @@ -2108,9 +2135,8 @@ static void do_flush(switch_rtp_t *rtp_session) flushed++; - if (rtp_session->jb) { + if (0 && rtp_session->jb) { stfu_n_eat(rtp_session->jb, ntohl(rtp_session->recv_msg.header.ts), - ntohs((uint16_t) rtp_session->recv_msg.header.seq), rtp_session->recv_msg.header.pt, rtp_session->recv_msg.body, bytes - rtp_header_len); } @@ -2177,7 +2203,6 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t } stfu_n_eat(rtp_session->jb, ntohl(rtp_session->recv_msg.header.ts), - ntohs((uint16_t) rtp_session->recv_msg.header.seq), rtp_session->recv_msg.header.pt, rtp_session->recv_msg.body, *bytes - rtp_header_len); *bytes = 0; @@ -2195,9 +2220,9 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t *bytes = jb_frame->dlen + rtp_header_len; rtp_session->recv_msg.header.ts = htonl(jb_frame->ts); rtp_session->recv_msg.header.pt = jb_frame->pt; - rtp_session->recv_msg.header.seq = htons((uint16_t)jb_frame->seq); status = SWITCH_STATUS_SUCCESS; } + rtp_session->checked_jb++; } return status; @@ -2342,6 +2367,8 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ READ_INC(rtp_session); + rtp_session->checked_jb = 0; + while (switch_rtp_ready(rtp_session)) { int do_cng = 0; bytes = 0; @@ -2894,7 +2921,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ if (do_cng) { uint8_t *data = (uint8_t *) rtp_session->recv_msg.body; int fdr; - + if ((poll_status = switch_poll(rtp_session->read_pollfd, 1, &fdr, 0)) == SWITCH_STATUS_SUCCESS) { goto recvfrom; } commit 2324c299177be42375610c4928a3b77e60a8bf10 Author: Brian West <brian@freeswitch.org> Date: Tue Dec 14 22:29:25 2010 -0600 round two better code thanks mikej diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index f2a555e..7e4e34f 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -6255,7 +6255,8 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ if (!is_nat && profile->nat_acl_count) { uint32_t x = 0; - int ok = 1; + int contact_private_ip = 1; + int network_private_ip = 0; char *last_acl = NULL; const char *contact_host = NULL; @@ -6264,35 +6265,37 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ } if (!zstr(contact_host)) { - for (x = 0; x < profile->nat_acl_count; x++) { - last_acl = profile->nat_acl[x]; - if (!(ok = switch_check_network_list_ip(contact_host, last_acl))) { - /* NAT mode double check logic and examples. + /* NAT mode double check logic and examples. - Example 1: the contact_host is 192.168.1.100 and the network_ip is also 192.168.1.100 the end point - is most likely behind nat with us so we need to veto that decision to turn on nat processing. + Example 1: the contact_host is 192.168.1.100 and the network_ip is also 192.168.1.100 the end point + is most likely behind nat with us so we need to veto that decision to turn on nat processing. - Example 2: the contact_host is 192.168.1.100 and the network_ip is 192.0.2.100 which is a public internet ip - the remote endpoint is likely behind a remote nat traversing the public internet. + Example 2: the contact_host is 192.168.1.100 and the network_ip is 192.0.2.100 which is a public internet ip + the remote endpoint is likely behind a remote nat traversing the public internet. - This secondary check is here to double check the conclusion of nat settigs to ensure we don't set net - in cases where we don't really need to be doing this. + This secondary check is here to double check the conclusion of nat settigs to ensure we don't set net + in cases where we don't really need to be doing this. - Why would you want to do this? Well if your FreeSWITCH is behind nat and you want to talk to endpoints behind - remote NAT over the public internet in addition to endpoints behind nat with you. This simplifies that process. - - */ - if ((ok = switch_check_network_list_ip(network_ip, last_acl))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Endpoint is already inside nat with us.\n"); - ok = 0; - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Decision stands they are behind nat.\n"); - } + Why would you want to do this? Well if your FreeSWITCH is behind nat and you want to talk to endpoints behind + remote NAT over the public internet in addition to endpoints behind nat with you. This simplifies that process. + + */ + + for (x = 0; x < profile->nat_acl_count; x++) { + last_acl = profile->nat_acl[x]; + if ((contact_private_ip = switch_check_network_list_ip(contact_host, last_acl))) { break; } } + if (contact_private_ip) { + for (x = 0; x < profile->nat_acl_count; x++) { + if ((network_private_ip = switch_check_network_list_ip(network_ip, profile->nat_acl[x]))) { + break; + } + } + } - if (ok) { + if (contact_private_ip && !network_private_ip) { is_nat = last_acl; } } commit eafd7e5e15b2a5b6b28d75e107a1490e60e64563 Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Tue Dec 14 16:55:31 2010 -0600 skypopen: tweaking the OSS audio driver diff --git a/src/mod/endpoints/mod_skypopen/oss/Makefile b/src/mod/endpoints/mod_skypopen/oss/Makefile index 465db53..8df20f6 100644 --- a/src/mod/endpoints/mod_skypopen/oss/Makefile +++ b/src/mod/endpoints/mod_skypopen/oss/Makefile @@ -4,7 +4,7 @@ # Add your debugging flag (or not) to CFLAGS ifeq ($(DEBUG),y) - DEBFLAGS = -O -g -DSCULL_DEBUG # "-O" is needed to expand inlines + DEBFLAGS = -O -g -DSKYPOPEN_DEBUG # "-O" is needed to expand inlines else DEBFLAGS = -O2 -Wall endif @@ -15,9 +15,9 @@ EXTRA_CFLAGS += -I$(LDDINC) ifneq ($(KERNELRELEASE),) # call from kernel build system -scull-objs := main.o +skypopen-objs := main.o -obj-m := scull.o +obj-m := skypopen.o else diff --git a/src/mod/endpoints/mod_skypopen/oss/main.c b/src/mod/endpoints/mod_skypopen/oss/main.c index 8da9c54..4fd959f 100644 --- a/src/mod/endpoints/mod_skypopen/oss/main.c +++ b/src/mod/endpoints/mod_skypopen/oss/main.c @@ -1,5 +1,5 @@ /* - * main.c -- the bare scull char module + * main.c -- the bare skypopen char module * * Copyright (C) 2010 Giovanni Maruzzelli * Copyright (C) 2001 Alessandro Rubini and Jonathan Corbet @@ -41,33 +41,32 @@ #include <linux/hrtimer.h> #include <linux/ktime.h> -#include "scull.h" /* local definitions */ +#include "skypopen.h" /* local definitions */ /* * Our parameters which can be set at load time. */ -int scull_major = SCULL_MAJOR; -int scull_minor = 3; -int scull_nr_devs = SCULL_NR_DEVS; /* number of bare scull devices */ +int skypopen_major = SKYPOPEN_MAJOR; +int skypopen_minor = 3; +int skypopen_nr_devs = SKYPOPEN_NR_DEVS; /* number of bare skypopen devices */ -module_param(scull_major, int, S_IRUGO); -module_param(scull_minor, int, S_IRUGO); -module_param(scull_nr_devs, int, S_IRUGO); +module_param(skypopen_major, int, S_IRUGO); +module_param(skypopen_minor, int, S_IRUGO); +module_param(skypopen_nr_devs, int, S_IRUGO); -MODULE_AUTHOR("Original: Alessandro Rubini, Jonathan Corbet. Heavy modified by: Giovanni Maruzzelli"); +MODULE_AUTHOR("Original: Alessandro Rubini, Jonathan Corbet. Modified by: Giovanni Maruzzelli for FreeSWITCH skypopen"); MODULE_LICENSE("Dual BSD/GPL"); -static struct scull_dev *scull_devices; /* allocated in scull_init_module */ +static struct skypopen_dev *skypopen_devices; /* allocated in skypopen_init_module */ #define GIOVA_BLK 1920 #define GIOVA_SLEEP 20 void my_timer_callback_inq( unsigned long data ) { - struct scull_dev *dev = (void *)data; + struct skypopen_dev *dev = (void *)data; - //dev->readable=1; wake_up_interruptible(&dev->inq); mod_timer( &dev->timer_inq, jiffies + msecs_to_jiffies(GIOVA_SLEEP) ); @@ -75,83 +74,83 @@ void my_timer_callback_inq( unsigned long data ) void my_timer_callback_outq( unsigned long data ) { - struct scull_dev *dev = (void *)data; + struct skypopen_dev *dev = (void *)data; - //dev->writable=1; wake_up_interruptible(&dev->outq); mod_timer( &dev->timer_outq, jiffies + msecs_to_jiffies(GIOVA_SLEEP) ); } /* The clone-specific data structure includes a key field */ -struct scull_listitem { - struct scull_dev device; +struct skypopen_listitem { + struct skypopen_dev device; dev_t key; struct list_head list; }; /* The list of devices, and a lock to protect it */ -static LIST_HEAD(scull_c_list); -static spinlock_t scull_c_lock = SPIN_LOCK_UNLOCKED; +static LIST_HEAD(skypopen_c_list); +static spinlock_t skypopen_c_lock = SPIN_LOCK_UNLOCKED; /* Look for a device or create one if missing */ -static struct scull_dev *scull_c_lookfor_device(dev_t key) +static struct skypopen_dev *skypopen_c_lookfor_device(dev_t key) { - struct scull_listitem *lptr; + struct skypopen_listitem *lptr; - list_for_each_entry(lptr, &scull_c_list, list) { + list_for_each_entry(lptr, &skypopen_c_list, list) { if (lptr->key == key) return &(lptr->device); } /* not found */ - lptr = kmalloc(sizeof(struct scull_listitem), GFP_KERNEL); + lptr = kmalloc(sizeof(struct skypopen_listitem), GFP_KERNEL); if (!lptr) return NULL; /* initialize the device */ - memset(lptr, 0, sizeof(struct scull_listitem)); + memset(lptr, 0, sizeof(struct skypopen_listitem)); lptr->key = key; - init_waitqueue_head(&lptr->device.inq); - init_waitqueue_head(&lptr->device.outq); - printk(" Timer installing\n"); - setup_timer( &lptr->device.timer_inq, my_timer_callback_inq, (long int)lptr ); - setup_timer( &lptr->device.timer_outq, my_timer_callback_outq, (long int)lptr ); - printk( "Starting timer to fire in %dms (%ld)\n", GIOVA_SLEEP, jiffies ); - mod_timer( &lptr->device.timer_inq, jiffies + msecs_to_jiffies(GIOVA_SLEEP) ); - mod_timer( &lptr->device.timer_outq, jiffies + msecs_to_jiffies(GIOVA_SLEEP) ); + init_waitqueue_head(&lptr->device.inq); + init_waitqueue_head(&lptr->device.outq); + setup_timer( &lptr->device.timer_inq, my_timer_callback_inq, (long int)lptr ); + setup_timer( &lptr->device.timer_outq, my_timer_callback_outq, (long int)lptr ); + printk( "Starting skypopen OSS driver read timer (%dms) skype client:(%d)\n", GIOVA_SLEEP, current->tgid ); + mod_timer( &lptr->device.timer_inq, jiffies + msecs_to_jiffies(GIOVA_SLEEP) ); + printk( "Starting skypopen OSS driver write timer (%dms) skype client:(%d)\n", GIOVA_SLEEP, current->tgid ); + mod_timer( &lptr->device.timer_outq, jiffies + msecs_to_jiffies(GIOVA_SLEEP) ); + /* place it in the list */ - list_add(&lptr->list, &scull_c_list); + list_add(&lptr->list, &skypopen_c_list); return &(lptr->device); } -static int scull_c_open(struct inode *inode, struct file *filp) + +/* + * Open and close + */ +static int skypopen_c_open(struct inode *inode, struct file *filp) { - struct scull_dev *dev; + struct skypopen_dev *dev; dev_t key; - if (!current->pid) { - printk("Process \"%s\" has no pid\n", current->comm); - return -EINVAL; - } key = current->pid; - /* look for a scullc device in the list */ - spin_lock(&scull_c_lock); - dev = scull_c_lookfor_device(key); - spin_unlock(&scull_c_lock); + /* look for a skypopenc device in the list */ + spin_lock(&skypopen_c_lock); + dev = skypopen_c_lookfor_device(key); + spin_unlock(&skypopen_c_lock); if (!dev) return -ENOMEM; - /* then, everything else is copied from the bare scull device */ + /* then, everything else is copied from the bare skypopen device */ filp->private_data = dev; return 0; /* success */ } -static int scull_c_release(struct inode *inode, struct file *filp) +static int skypopen_c_release(struct inode *inode, struct file *filp) { /* * Nothing to do, because the device is persistent. @@ -163,39 +162,29 @@ static int scull_c_release(struct inode *inode, struct file *filp) /*************************************************************/ -/* - * Open and close - */ -ssize_t scull_read(struct file *filp, char __user *buf, size_t count, +ssize_t skypopen_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos) { - struct scull_dev *dev = filp->private_data; - + struct skypopen_dev *dev = filp->private_data; DEFINE_WAIT(wait); + prepare_to_wait(&dev->inq, &wait, TASK_INTERRUPTIBLE); schedule(); finish_wait(&dev->inq, &wait); - //memset(buf, 255, count); - - //wait_event_interruptible(dev->inq, dev->readable); - //dev->readable=0; return count; } -ssize_t scull_write(struct file *filp, const char __user *buf, size_t count, +ssize_t skypopen_write(struct file *filp, const char __user *buf, size_t count, loff_t *f_pos) { - struct scull_dev *dev = filp->private_data; + struct skypopen_dev *dev = filp->private_data; DEFINE_WAIT(wait); + prepare_to_wait(&dev->outq, &wait, TASK_INTERRUPTIBLE); schedule(); finish_wait(&dev->outq, &wait); - - //wait_event_interruptible(dev->outq, dev->writable); - //dev->writable=0; - return count; } @@ -203,7 +192,7 @@ ssize_t scull_write(struct file *filp, const char __user *buf, size_t count, * The ioctl() implementation */ -int scull_ioctl(struct inode *inode, struct file *filp, +int skypopen_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { void __user *argp = (void __user *)arg; @@ -223,14 +212,14 @@ int scull_ioctl(struct inode *inode, struct file *filp, } -struct file_operations scull_fops = { +struct file_operations skypopen_fops = { .owner = THIS_MODULE, .llseek = no_llseek, - .read = scull_read, - .write = scull_write, - .ioctl = scull_ioctl, - .open = scull_c_open, - .release = scull_c_release, + .read = skypopen_read, + .write = skypopen_write, + .ioctl = skypopen_ioctl, + .open = skypopen_c_open, + .release = skypopen_c_release, }; /* @@ -243,34 +232,34 @@ struct file_operations scull_fops = { * have not been initialized */ -void scull_cleanup_module(void) +void skypopen_cleanup_module(void) { int i; int ret; - struct scull_listitem *lptr, *next; - dev_t devno = MKDEV(scull_major, scull_minor); + struct skypopen_listitem *lptr, *next; + dev_t devno = MKDEV(skypopen_major, skypopen_minor); /* Get rid of our char dev entries */ - if (scull_devices) { - for (i = 0; i < scull_nr_devs; i++) { - cdev_del(&scull_devices[i].cdev); + if (skypopen_devices) { + for (i = 0; i < skypopen_nr_devs; i++) { + cdev_del(&skypopen_devices[i].cdev); } - kfree(scull_devices); + kfree(skypopen_devices); } /* And all the cloned devices */ - list_for_each_entry_safe(lptr, next, &scull_c_list, list) { + list_for_each_entry_safe(lptr, next, &skypopen_c_list, list) { ret= del_timer( &lptr->device.timer_inq ); - if (ret) printk("The inq timer was still in use...\n"); + //printk( "Stopped skypopen OSS driver read timer (%dms) skype client:(%d)\n", GIOVA_SLEEP, current->tgid ); ret= del_timer( &lptr->device.timer_outq ); - if (ret) printk("The outq timer was still in use...\n"); + //printk( "Stopped skypopen OSS driver write timer (%dms) skype client:(%d)\n", GIOVA_SLEEP, current->tgid ); list_del(&lptr->list); kfree(lptr); } - printk("Timer uninstalling\n"); /* cleanup_module is never called if registering failed */ - unregister_chrdev_region(devno, scull_nr_devs); + unregister_chrdev_region(devno, skypopen_nr_devs); + printk("skypopen OSS driver unloaded\n"); } @@ -278,40 +267,41 @@ void scull_cleanup_module(void) /* * Set up the char_dev structure for this device. */ -static void scull_setup_cdev(struct scull_dev *dev, int index) +static void skypopen_setup_cdev(struct skypopen_dev *dev, int index) { - int err, devno = MKDEV(scull_major, scull_minor + index); + int err, devno = MKDEV(skypopen_major, skypopen_minor + index); - cdev_init(&dev->cdev, &scull_fops); + cdev_init(&dev->cdev, &skypopen_fops); dev->cdev.owner = THIS_MODULE; - dev->cdev.ops = &scull_fops; + dev->cdev.ops = &skypopen_fops; err = cdev_add (&dev->cdev, devno, 1); /* Fail gracefully if need be */ if (err) - printk(KERN_NOTICE "Error %d adding scull%d", err, index); + printk(KERN_NOTICE "Error %d adding skypopen%d", err, index); } -int scull_init_module(void) +int skypopen_init_module(void) { int result, i; dev_t dev = 0; + printk("skypopen OSS driver loading (www.freeswitch.org)\n"); /* * Get a range of minor numbers to work with, asking for a dynamic * major unless directed otherwise at load time. */ - if (scull_major) { - dev = MKDEV(scull_major, scull_minor); - result = register_chrdev_region(dev, scull_nr_devs, "dsp"); + if (skypopen_major) { + dev = MKDEV(skypopen_major, skypopen_minor); + result = register_chrdev_region(dev, skypopen_nr_devs, "dsp"); } else { - result = alloc_chrdev_region(&dev, scull_minor, scull_nr_devs, + result = alloc_chrdev_region(&dev, skypopen_minor, skypopen_nr_devs, "dsp"); - scull_major = MAJOR(dev); + skypopen_major = MAJOR(dev); } if (result < 0) { - printk(KERN_WARNING "scull: can't get major %d\n", scull_major); + printk(KERN_WARNING "skypopen OSS driver: can't get major %d\n", skypopen_major); return result; } @@ -319,26 +309,26 @@ int scull_init_module(void) * allocate the devices -- we can't have them static, as the number * can be specified at load time */ - scull_devices = kmalloc(scull_nr_devs * sizeof(struct scull_dev), GFP_KERNEL); - if (!scull_devices) { + skypopen_devices = kmalloc(skypopen_nr_devs * sizeof(struct skypopen_dev), GFP_KERNEL); + if (!skypopen_devices) { result = -ENOMEM; goto fail; /* Make this more graceful */ } - memset(scull_devices, 0, scull_nr_devs * sizeof(struct scull_dev)); + memset(skypopen_devices, 0, skypopen_nr_devs * sizeof(struct skypopen_dev)); /* Initialize each device. */ - for (i = 0; i < scull_nr_devs; i++) { - scull_setup_cdev(&scull_devices[i], i); + for (i = 0; i < skypopen_nr_devs; i++) { + skypopen_setup_cdev(&skypopen_devices[i], i); } /* At this point call the init function for any friend device */ - dev = MKDEV(scull_major, scull_minor + scull_nr_devs); + dev = MKDEV(skypopen_major, skypopen_minor + skypopen_nr_devs); return 0; /* succeed */ fail: - scull_cleanup_module(); + skypopen_cleanup_module(); return result; } -module_init(scull_init_module); -module_exit(scull_cleanup_module); +module_init(skypopen_init_module); +module_exit(skypopen_cleanup_module); diff --git a/src/mod/endpoints/mod_skypopen/oss/scull.h b/src/mod/endpoints/mod_skypopen/oss/skypopen.h similarity index 55% rename from src/mod/endpoints/mod_skypopen/oss/scull.h rename to src/mod/endpoints/mod_skypopen/oss/skypopen.h index 565b8b3..5469048 100644 --- a/src/mod/endpoints/mod_skypopen/oss/scull.h +++ b/src/mod/endpoints/mod_skypopen/oss/skypopen.h @@ -1,5 +1,5 @@ /* - * scull.h -- definitions for the char module + * skypopen.h -- definitions for the char module * * Copyright (C) 2001 Alessandro Rubini and Jonathan Corbet * Copyright (C) 2001 O'Reilly & Associates @@ -12,55 +12,49 @@ * by O'Reilly & Associates. No warranty is attached; * we cannot take responsibility for errors or fitness for use. * - * $Id: scull.h,v 1.15 2004/11/04 17:51:18 rubini Exp $ + * $Id: skypopen.h,v 1.15 2004/11/04 17:51:18 rubini Exp $ */ -#ifndef _SCULL_H_ -#define _SCULL_H_ +#ifndef _SKYPOPEN_H_ +#define _SKYPOPEN_H_ #include <linux/ioctl.h> /* needed for the _IOW etc stuff used later */ -#ifndef SCULL_MAJOR -#define SCULL_MAJOR 14 /* dynamic major by default */ +#ifndef SKYPOPEN_MAJOR +#define SKYPOPEN_MAJOR 14 /* dynamic major by default */ #endif -#ifndef SCULL_NR_DEVS -#define SCULL_NR_DEVS 1 /* scull0 through scull3 */ +#ifndef SKYPOPEN_NR_DEVS +#define SKYPOPEN_NR_DEVS 1 /* skypopen0 through skypopen3 */ #endif -struct scull_dev { +struct skypopen_dev { struct cdev cdev; /* Char device structure */ wait_queue_head_t inq; /* read and write queues */ wait_queue_head_t outq; /* read and write queues */ struct timer_list timer_inq; struct timer_list timer_outq; - int readable; - int writable; - //unsigned long read_howmany; - //unsigned long write_howmany; - //unsigned long read_sleeped_acc; - //unsigned long write_sleeped_acc; - //double read_delay; /* how much delay last time */ - //double write_delay; /* how much delay last time */ + int timer_inq_started; + int timer_outq_started; }; /* * The different configurable parameters */ -extern int scull_major; /* main.c */ -extern int scull_nr_devs; +extern int skypopen_major; /* main.c */ +extern int skypopen_nr_devs; /* * Prototypes for shared functions */ -ssize_t scull_read(struct file *filp, char __user *buf, size_t count, +ssize_t skypopen_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos); -ssize_t scull_write(struct file *filp, const char __user *buf, size_t count, +ssize_t skypopen_write(struct file *filp, const char __user *buf, size_t count, loff_t *f_pos); -int scull_ioctl(struct inode *inode, struct file *filp, +int skypopen_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -#endif /* _SCULL_H_ */ +#endif /* _SKYPOPEN_H_ */ commit f93897390bfc89ca54c35b6df0924c59e5d8aeca Merge: 1c01144 e5855be Author: Moises Silva <moy@sangoma.com> Date: Tue Dec 14 17:02:33 2010 -0500 Merge branch 'master' of git.sangoma.com:smg_freeswitch commit 1c01144c207d7462e93a6955a5cf129373e84df3 Author: Moises Silva <moy@sangoma.com> Date: Tue Dec 14 16:55:40 2010 -0500 freetdm: open all media dumps as binary. Fixes Windows corrupted cores. diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index e13d019..2fa7953 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2715,7 +2715,8 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co close(ftdmchan->fds[FTDM_READ_TRACE_INDEX]); ftdmchan->fds[FTDM_READ_TRACE_INDEX] = -1; } - if ((ftdmchan->fds[FTDM_READ_TRACE_INDEX] = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) { + if ((ftdmchan->fds[FTDM_READ_TRACE_INDEX] = open(path, O_WRONLY | O_CREAT | O_TRUNC + | FTDM_O_BINARY, S_IRUSR | S_IWUSR)) > -1) { ftdm_log(FTDM_LOG_DEBUG, "Tracing channel %u:%u input to [%s]\n", ftdmchan->span_id, ftdmchan->chan_id, path); GOTO_STATUS(done, FTDM_SUCCESS); } @@ -2731,7 +2732,8 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co close(ftdmchan->fds[FTDM_WRITE_TRACE_INDEX]); ftdmchan->fds[FTDM_WRITE_TRACE_INDEX] = -1; } - if ((ftdmchan->fds[FTDM_WRITE_TRACE_INDEX] = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) { + if ((ftdmchan->fds[FTDM_WRITE_TRACE_INDEX] = open(path, O_WRONLY | O_CREAT | O_TRUNC + | FTDM_O_BINARY, S_IRUSR | S_IWUSR)) > -1) { ftdm_log(FTDM_LOG_DEBUG, "Tracing channel %u:%u output to [%s]\n", ftdmchan->span_id, ftdmchan->chan_id, path); GOTO_STATUS(done, FTDM_SUCCESS); } @@ -3376,7 +3378,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_queue_dtmf(ftdm_channel_t *ftdmchan, cons ftdmchan->span_id, ftdmchan->chan_id, currtime.tm_year-100, currtime.tm_mon+1, currtime.tm_mday, currtime.tm_hour, currtime.tm_min, currtime.tm_sec, ftdmchan->native_codec == FTDM_CODEC_ULAW ? "ulaw" : ftdmchan->native_codec == FTDM_CODEC_ALAW ? "alaw" : "sln"); - ftdmchan->dtmfdbg.file = fopen(dfile, "w"); + ftdmchan->dtmfdbg.file = fopen(dfile, "wb"); if (!ftdmchan->dtmfdbg.file) { ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "failed to open debug dtmf file %s\n", dfile); } else { diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 6bec6b0..1549833 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -568,14 +568,14 @@ static void dump_mf(openr2_chan_t *r2chan) ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Dumping IO output in prefix %s\n", logname); snprintf(dfile, sizeof(dfile), logname ? "%s.s%dc%d.input.alaw" : "%s/s%dc%d.input.alaw", logname ? logname : r2data->logdir, ftdmchan->span_id, ftdmchan->chan_id); - f = fopen(dfile, "w"); + f = fopen(dfile, "wb"); ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Dumping IO input in file %s\n", dfile); ftdm_channel_command(ftdmchan, FTDM_COMMAND_DUMP_INPUT, f); fclose(f); snprintf(dfile, sizeof(dfile), logname ? "%s.s%dc%d.output.alaw" : "%s/s%dc%d.output.alaw", logname ? logname : r2data->logdir, ftdmchan->span_id, ftdmchan->chan_id); - f = fopen(dfile, "w"); + f = fopen(dfile, "wb"); ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Dumping IO output in file %s\n", dfile); ftdm_channel_command(ftdmchan, FTDM_COMMAND_DUMP_OUTPUT, f); fclose(f); diff --git a/libs/freetdm/src/include/ftdm_declare.h b/libs/freetdm/src/include/ftdm_declare.h index 4aba703..5c57e01 100644 --- a/libs/freetdm/src/include/ftdm_declare.h +++ b/libs/freetdm/src/include/ftdm_declare.h @@ -158,12 +158,14 @@ typedef __int64 int64_t; typedef __int32 int32_t; typedef __int16 int16_t; typedef __int8 int8_t; +#define FTDM_O_BINARY O_BINARY #if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 #else #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL #endif /* _MSC_VER */ #else /* __WINDOWS__ */ +#define FTDM_O_BINARY 0 #define FTDM_INVALID_SOCKET -1 typedef int ftdm_socket_t; #include <stdio.h> commit c6417fa2b389364f83e6bad6fdd4ff9f059b589e Author: Moises Silva <moy@sangoma.com> Date: Tue Dec 14 16:50:10 2010 -0500 freetdm: ftmod_r2 - disable MF dump for forward calls on call accepted diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 9206493..6bec6b0 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -585,6 +585,8 @@ static void dump_mf(openr2_chan_t *r2chan) static void ftdm_r2_on_call_accepted(openr2_chan_t *r2chan, openr2_call_mode_t mode) { ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); + ftdm_r2_data_t *r2data = ftdmchan->span->signal_data; + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "Call accepted\n"); clear_accept_pending(ftdmchan); @@ -607,6 +609,11 @@ static void ftdm_r2_on_call_accepted(openr2_chan_t *r2chan, openr2_call_mode_t m return; } } else { + /* nothing went wrong during call setup, MF has ended, we can and must disable the MF dump */ + if (r2data->mf_dump_size) { + ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_INPUT_DUMP, NULL); + ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_OUTPUT_DUMP, NULL); + } ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); } } commit e5855be613158491cc3b29778c76bc4ff021a3d0 Merge: a2faee2 1d668e2 Author: Moises Silva <moy@sangoma.com> Date: Tue Dec 14 16:24:05 2010 -0500 Merge remote branch 'fsorig/master' commit 56515c3a643eda32d8d527a215d4934e521e5e07 Author: David Yat Sin <dyatsin@sangoma.com> Date: Tue Dec 14 16:04:25 2010 -0500 Minor change to allow skip states diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index deeb578..4bd0fdd 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2379,14 +2379,16 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_indicate(const char *file, const ch ftdm_set_flag(ftdmchan, FTDM_CHANNEL_PROGRESS); ftdm_set_flag(ftdmchan, FTDM_CHANNEL_MEDIA); } else { - if (ftdmchan->state < FTDM_CHANNEL_STATE_PROGRESS) { - ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS, 1); - } + if (!ftdm_test_flag(ftdmchan->span, FTDM_SPAN_USE_SKIP_STATES)) { + if (ftdmchan->state < FTDM_CHANNEL_STATE_PROGRESS) { + ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS, 1); + } - /* set state unlocks the channel so we need to re-confirm that the channel hasn't gone to hell */ - if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call has moved to TERMINATING while we're moving to PROGRESS\n"); - goto done; + /* set state unlocks the channel so we need to re-confirm that the channel hasn't gone to hell */ + if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call has moved to TERMINATING while we're moving to PROGRESS\n"); + goto done; + } } ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, 1); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 49e16ea..f8867d5 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -704,12 +704,9 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) sigev.event_id = FTDM_SIGEVENT_PROGRESS; ftdm_span_send_signal(ftdmchan->span, &sigev); } else { - /* If we already sent a PROCEED before, do not send a PROGRESS as there is nothing to indicate to the remote switch */ - if (ftdmchan->last_state != FTDM_CHANNEL_STATE_PROCEED) { - /* Send a progress message, indicating: Call is not end-to-end ISDN, further call progress may be available */ - ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_NETE_ISDN}; - sngisdn_snd_progress(ftdmchan, prog_ind); - } + /* Send a progress message, indicating: Call is not end-to-end ISDN, further call progress may be available */ + ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_NETE_ISDN}; + sngisdn_snd_progress(ftdmchan, prog_ind); } } break; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 0032270..bdd3717 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -493,6 +493,9 @@ void sngisdn_process_disc_ind (sngisdn_event_data_t *sngisdn_event) /* This is a race condition. We just sent a DISCONNECT, on this channel */ /* Do nothing */ break; + case FTDM_CHANNEL_STATE_RESET: + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Processing SETUP but channel in RESET state, ignoring\n"); + break; default: ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Received DISCONNECT in an invalid state (%s)\n", ftdm_channel_state2str(ftdmchan->state)); @@ -598,7 +601,7 @@ void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event) } break; case FTDM_CHANNEL_STATE_RESET: - /* User initiated reset, so they do not know about this call */ + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Processing SETUP but channel in RESET state, ignoring\n"); break; default: ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Received RELEASE in an invalid state (%s)\n", @@ -1103,7 +1106,7 @@ void sngisdn_process_rst_cfm (sngisdn_event_data_t *sngisdn_event) } if (!rstEvnt->rstInd.eh.pres || !rstEvnt->rstInd.rstClass.pres) { - ftdm_log(FTDM_LOG_CRIT, "Receved RESTART, but Restart Indicator IE not present\n"); + ftdm_log(FTDM_LOG_DEBUG, "Receved RESTART, but Restart Indicator IE not present\n"); return; } commit 1d668e25ab8bfbf92bdaebf11a2b756f22895b33 Author: Brian West <brian@freeswitch.org> Date: Tue Dec 14 12:43:51 2010 -0600 hrm diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index d429f59..f2a555e 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -6267,7 +6267,21 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ for (x = 0; x < profile->nat_acl_count; x++) { last_acl = profile->nat_acl[x]; if (!(ok = switch_check_network_list_ip(contact_host, last_acl))) { - /* override the decision to say this is nat because the network_ip is within the acl too */ + /* NAT mode double check logic and examples. + + Example 1: the contact_host is 192.168.1.100 and the network_ip is also 192.168.1.100 the end point + is most likely behind nat with us so we need to veto that decision to turn on nat processing. + + Example 2: the contact_host is 192.168.1.100 and the network_ip is 192.0.2.100 which is a public internet ip + the remote endpoint is likely behind a remote nat traversing the public internet. + + This secondary check is here to double check the conclusion of nat settigs to ensure we don't set net + in cases where we don't really need to be doing this. + + Why would you want to do this? Well if your FreeSWITCH is behind nat and you want to talk to endpoints behind + remote NAT over the public internet in addition to endpoints behind nat with you. This simplifies that process. + + */ if ((ok = switch_check_network_list_ip(network_ip, last_acl))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Endpoint is already inside nat with us.\n"); ok = 0; commit 6c6eab8c13d2d7dddcd078a25f8d64bf94cfa910 Author: Brian West <brian@freeswitch.org> Date: Tue Dec 14 12:00:29 2010 -0600 Do not set nat mode when the device's network_ip is within the acl also so if your FS is behind nat and your phone is too then it will still make the right decisions diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 591cd7f..d429f59 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -6267,6 +6267,13 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ for (x = 0; x < profile->nat_acl_count; x++) { last_acl = profile->nat_acl[x]; if (!(ok = switch_check_network_list_ip(contact_host, last_acl))) { + /* override the decision to say this is nat because the network_ip is within the acl too */ + if ((ok = switch_check_network_list_ip(network_ip, last_acl))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Endpoint is already inside nat with us.\n"); + ok = 0; + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Decision stands they are behind nat.\n"); + } break; } } commit 905fdcc2488dfa0b8cc8bb4d2f0f199704a943b8 Author: David Yat Sin <dyatsin@sangoma.com> Date: Tue Dec 14 11:23:47 2010 -0500 freetdm: Support for channel restarts diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 38197bb..26b8463 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -3922,6 +3922,28 @@ SWITCH_STANDARD_API(ft_function) } } stream->write_function(stream, "+OK gains set to Rx %f and Tx %f\n", rxgain, txgain); + } else if (!strcasecmp(argv[0], "restart")) { + uint32_t chan_id = 0; + ftdm_channel_t *chan; + ftdm_span_t *span = NULL; + if (argc < 3) { + stream->write_function(stream, "-ERR Usage: ftdm restart <span_id> <chan_id>\n"); + goto end; + } + ftdm_span_find_by_name(argv[1], &span); + if (!span) { + stream->write_function(stream, "-ERR invalid span\n"); + goto end; + } + + chan_id = atoi(argv[2]); + chan = ftdm_span_get_channel(span, chan_id); + if (!chan) { + stream->write_function(stream, "-ERR Could not find chan\n"); + goto end; + } + stream->write_function(stream, "Resetting channel %s:%s\n", argv[2], argv[3]); + ftdm_channel_reset(chan); } else { char *rply = ftdm_api_execute(cmd); diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index e13d019..deeb578 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -65,6 +65,8 @@ ftdm_time_t time_current_throttle_log = 0; static ftdm_iterator_t *get_iterator(ftdm_iterator_type_t type, ftdm_iterator_t *iter); static ftdm_status_t ftdm_call_set_call_id(ftdm_caller_data_t *caller_data); static ftdm_status_t ftdm_call_clear_call_id(ftdm_caller_data_t *caller_data); +static ftdm_status_t ftdm_channel_clear_vars(ftdm_channel_t *ftdmchan); +static ftdm_status_t ftdm_channel_done(ftdm_channel_t *ftdmchan); static int time_is_init = 0; @@ -1874,45 +1876,6 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_span(uint32_t span_id, ftdm_direc return status; } -static ftdm_status_t ftdm_channel_reset(ftdm_channel_t *ftdmchan) -{ - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_OPEN); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_DTMF_DETECT); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_SUPRESS_DTMF); - ftdm_channel_done(ftdmchan); - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_HOLD); - - memset(ftdmchan->tokens, 0, sizeof(ftdmchan->tokens)); - ftdmchan->token_count = 0; - - ftdm_channel_flush_dtmf(ftdmchan); - - if (ftdmchan->gen_dtmf_buffer) { - ftdm_buffer_zero(ftdmchan->gen_dtmf_buffer); - } - - if (ftdmchan->digit_buffer) { - ftdm_buffer_zero(ftdmchan->digit_buffer); - } - - if (!ftdmchan->dtmf_on) { - ftdmchan->dtmf_on = FTDM_DEFAULT_DTMF_ON; - } - - if (!ftdmchan->dtmf_off) { - ftdmchan->dtmf_off = FTDM_DEFAULT_DTMF_OFF; - } - - memset(ftdmchan->dtmf_hangup_buf, '\0', ftdmchan->span->dtmf_hangup_len); - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_TRANSCODE)) { - ftdmchan->effective_codec = ftdmchan->native_codec; - ftdmchan->packet_len = ftdmchan->native_interval * (ftdmchan->effective_codec == FTDM_CODEC_SLIN ? 16 : 8); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_TRANSCODE); - } - - return FTDM_SUCCESS; -} FT_DECLARE(ftdm_status_t) ftdm_channel_init(ftdm_channel_t *ftdmchan) { @@ -2462,6 +2425,21 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_send_msg(const char *file, const ch return status; } +FT_DECLARE(ftdm_status_t) _ftdm_channel_reset(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan) +{ + ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "null channel"); +#ifdef __WINDOWS__ + UNREFERENCED_PARAMETER(file); + UNREFERENCED_PARAMETER(func); + UNREFERENCED_PARAMETER(line); +#endif + + ftdm_channel_lock(ftdmchan); + ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_RESET, 0); + ftdm_channel_unlock(ftdmchan); + return FTDM_SUCCESS; +} + FT_DECLARE(ftdm_status_t) _ftdm_channel_call_place(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan) { ftdm_status_t status = FTDM_FAIL; @@ -2545,12 +2523,13 @@ FT_DECLARE(ftdm_status_t) ftdm_span_get_sig_status(ftdm_span_t *span, ftdm_signa } } -static ftdm_status_t ftdm_channel_clear_vars(ftdm_channel_t *ftdmchan); -FT_DECLARE(ftdm_status_t) ftdm_channel_done(ftdm_channel_t *ftdmchan) +static ftdm_status_t ftdm_channel_done(ftdm_channel_t *ftdmchan) { ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "Null channel can't be done!\n"); - ftdm_mutex_lock(ftdmchan->mutex); + ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_OPEN); + ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_DTMF_DETECT); + ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_SUPRESS_DTMF); ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_INUSE); ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND); ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_WINK); @@ -2591,17 +2570,47 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_done(ftdm_channel_t *ftdmchan) sigmsg.event_id = FTDM_SIGEVENT_RELEASED; ftdm_span_send_signal(ftdmchan->span, &sigmsg); ftdm_call_clear_call_id(&ftdmchan->caller_data); - } + } if (ftdmchan->txdrops || ftdmchan->rxdrops) { - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "channel dropped data: txdrops = %d, rxdrops = %d\n", + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "channel dropped data: txdrops = %d, rxdrops = %d\n", ftdmchan->txdrops, ftdmchan->rxdrops); } ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "channel done\n"); memset(&ftdmchan->caller_data, 0, sizeof(ftdmchan->caller_data)); - ftdm_mutex_unlock(ftdmchan->mutex); + ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_HOLD); + + memset(ftdmchan->tokens, 0, sizeof(ftdmchan->tokens)); + ftdmchan->token_count = 0; + + ftdm_channel_flush_dtmf(ftdmchan); + + if (ftdmchan->gen_dtmf_buffer) { + ftdm_buffer_zero(ftdmchan->gen_dtmf_buffer); + } + + if (ftdmchan->digit_buffer) { + ftdm_buffer_zero(ftdmchan->digit_buffer); + } + + if (!ftdmchan->dtmf_on) { + ftdmchan->dtmf_on = FTDM_DEFAULT_DTMF_ON; + } + + if (!ftdmchan->dtmf_off) { + ftdmchan->dtmf_off = FTDM_DEFAULT_DTMF_OFF; + } + + memset(ftdmchan->dtmf_hangup_buf, '\0', ftdmchan->span->dtmf_hangup_len); + + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_TRANSCODE)) { + ftdmchan->effective_codec = ftdmchan->native_codec; + ftdmchan->packet_len = ftdmchan->native_interval * (ftdmchan->effective_codec == FTDM_CODEC_SLIN ? 16 : 8); + ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_TRANSCODE); + } + ftdm_mutex_unlock(ftdmchan->mutex); return FTDM_SUCCESS; } @@ -2632,7 +2641,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_close(ftdm_channel_t **ftdmchan) status = check->fio->close(check); if (status == FTDM_SUCCESS) { ftdm_clear_flag(check, FTDM_CHANNEL_INUSE); - ftdm_channel_reset(check); + ftdm_channel_done(check); *ftdmchan = NULL; } } else { diff --git a/libs/freetdm/src/ftdm_m3ua.c b/libs/freetdm/src/ftdm_m3ua.c index 1a6fe36..5a468d1 100644 --- a/libs/freetdm/src/ftdm_m3ua.c +++ b/libs/freetdm/src/ftdm_m3ua.c @@ -156,7 +156,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) release_request_id((m3ua_request_id_t)ftdmchan->extra_id); ftdmchan->extra_id = 0; } - ftdm_channel_done(ftdmchan); + ftdm_channel_close(ftdmchan); } break; case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c index 6a8a4eb..c6a0e5f 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@ -1325,7 +1325,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) } Q931ReleaseCRV(&isdn_data->q931, gen->CRV); } - ftdm_channel_done(ftdmchan); + ftdm_channel_close(ftdmchan); } break; case FTDM_CHANNEL_STATE_PROGRESS: diff --git a/libs/freetdm/src/ftmod/ftmod_pritap/ftmod_pritap.c b/libs/freetdm/src/ftmod/ftmod_pritap/ftmod_pritap.c index 220a965..b3b4f2a 100644 --- a/libs/freetdm/src/ftmod/ftmod_pritap/ftmod_pritap.c +++ b/libs/freetdm/src/ftmod/ftmod_pritap/ftmod_pritap.c @@ -281,10 +281,10 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) switch (ftdmchan->state) { case FTDM_CHANNEL_STATE_DOWN: { - ftdm_channel_done(ftdmchan); + ftdm_channel_close(ftdmchan); ftdmchan->call_data = NULL; - ftdm_channel_done(peerchan); + ftdm_channel_close(peerchan); peerchan->call_data = NULL; } break; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c index 50a01cc..a196725 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c @@ -839,7 +839,7 @@ static void handle_call_released(ftdm_span_t *span, sangomabc_connection_t *mcon if ((ftdmchan = find_ftdmchan(span, event, 1))) { ftdm_log(FTDM_LOG_DEBUG, "Releasing completely chan s%dc%d\n", BOOST_EVENT_SPAN(mcon->sigmod, event), BOOST_EVENT_CHAN(mcon->sigmod, event)); - ftdm_channel_done(ftdmchan); + ftdm_channel_close(ftdmchan); } else { ftdm_log(FTDM_LOG_CRIT, "Odd, We could not find chan: s%dc%d to release the call completely!!\n", BOOST_EVENT_SPAN(mcon->sigmod, event), BOOST_EVENT_CHAN(mcon->sigmod, event)); @@ -1106,7 +1106,7 @@ static void handle_call_loop_start(ftdm_span_t *span, sangomabc_connection_t *mc ftdm_set_state_r(ftdmchan, FTDM_CHANNEL_STATE_IN_LOOP, res); if (res != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_CRIT, "yay, could not set the state of the channel to IN_LOOP, loop will fail\n"); - ftdm_channel_done(ftdmchan); + ftdm_channel_close(ftdmchan); return; } ftdm_log(FTDM_LOG_DEBUG, "%d:%d starting loop\n", ftdmchan->span_id, ftdmchan->chan_id); @@ -1426,11 +1426,11 @@ static __inline__ ftdm_status_t state_advance(ftdm_channel_t *ftdmchan) ftdmchan->sflags = 0; memset(ftdmchan->call_data, 0, sizeof(sangoma_boost_call_t)); if (sangoma_boost_data->sigmod && call_stopped_ack_sent) { - /* we dont want to call ftdm_channel_done just yet until call released is received */ + /* we dont want to call ftdm_channel_close just yet until call released is received */ ftdm_log(FTDM_LOG_DEBUG, "Waiting for call release confirmation before declaring chan %d:%d as available \n", ftdmchan->span_id, ftdmchan->chan_id); } else { - ftdm_channel_done(ftdmchan); + ftdm_channel_close(ftdmchan); } } break; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index e20d3ae..49e16ea 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -65,7 +65,13 @@ ftdm_state_map_t sangoma_isdn_state_map = { ZSD_INBOUND, ZSM_UNACCEPTABLE, {FTDM_ANY_STATE, FTDM_END}, - {FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_SUSPENDED, FTDM_END} + {FTDM_CHANNEL_STATE_RESET, FTDM_CHANNEL_STATE_RESTART, FTDM_END} + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_RESET, FTDM_END}, + {FTDM_CHANNEL_STATE_DOWN, FTDM_END} }, { ZSD_INBOUND, @@ -170,7 +176,13 @@ ftdm_state_map_t sangoma_isdn_state_map = { ZSD_OUTBOUND, ZSM_UNACCEPTABLE, {FTDM_ANY_STATE, FTDM_END}, - {FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_TERMINATING, FTDM_END} + {FTDM_CHANNEL_STATE_RESET, FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_TERMINATING, FTDM_END} + }, + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_RESET, FTDM_END}, + {FTDM_CHANNEL_STATE_DOWN, FTDM_END} }, { ZSD_OUTBOUND, @@ -780,7 +792,7 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) sngisdn_snd_release(ftdmchan, 0); if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) { - sngisdn_set_avail_rate(ftdmchan->span, SNGISDN_AVAIL_DOWN); + sngisdn_set_span_avail_rate(ftdmchan->span, SNGISDN_AVAIL_DOWN); } } else { sngisdn_snd_disconnect(ftdmchan); @@ -838,6 +850,11 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) /* IMPLEMENT ME */ } break; + case FTDM_CHANNEL_STATE_RESET: + { + sngisdn_snd_restart(ftdmchan); + } + break; default: { ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "unsupported sngisdn_rcvd state %s\n", ftdm_channel_state2str(ftdmchan->state)); @@ -862,10 +879,6 @@ static FIO_CHANNEL_SEND_MSG_FUNCTION(ftdm_sangoma_isdn_send_msg) ftdm_status_t status = FTDM_FAIL; switch (sigmsg->event_id) { - case FTDM_SIGEVENT_RESTART: - /* TODO: Send a channel restart here */ - /* Implement me */ - break; case FTDM_SIGEVENT_FACILITY: sngisdn_snd_fac_req(ftdmchan); break; @@ -1072,7 +1085,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_isdn_span_config) if (span->trunk_type == FTDM_TRUNK_BRI_PTMP || span->trunk_type == FTDM_TRUNK_BRI) { - sngisdn_set_avail_rate(span, SNGISDN_AVAIL_PWR_SAVING); + sngisdn_set_span_avail_rate(span, SNGISDN_AVAIL_PWR_SAVING); } /* Initialize scheduling context */ @@ -1167,6 +1180,7 @@ static FIO_API_FUNCTION(ftdm_sangoma_isdn_api) goto done; } + /* TODO: Move functions to table + function pointers */ if (!strcasecmp(argv[0], "trace")) { char *trace_opt; @@ -1210,7 +1224,7 @@ static FIO_API_FUNCTION(ftdm_sangoma_isdn_api) } sngisdn_print_phy_stats(stream, span); } - + if (!strcasecmp(argv[0], "show_spans")) { ftdm_span_t *span = NULL; if (argc == 2) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index f15eff9..4662d4e 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -352,8 +352,11 @@ void clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info); ftdm_status_t get_ftdmchan_by_suInstId(int16_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data); ftdm_status_t get_ftdmchan_by_spInstId(int16_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data); +ftdm_status_t sngisdn_set_span_avail_rate(ftdm_span_t *span, sngisdn_avail_t avail); +ftdm_status_t sngisdn_set_chan_avail_rate(ftdm_channel_t *chan, sngisdn_avail_t avail); +void sngisdn_set_span_sig_status(ftdm_span_t *ftdmspan, ftdm_signaling_status_t status); +void sngisdn_set_chan_sig_status(ftdm_channel_t *ftdmchan, ftdm_signaling_status_t status); -ftdm_status_t sngisdn_set_avail_rate(ftdm_span_t *span, sngisdn_avail_t avail); ftdm_status_t sngisdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t trace_opt); @@ -374,6 +377,7 @@ void sngisdn_snd_con_complete(ftdm_channel_t *ftdmchan); void sngisdn_snd_fac_req(ftdm_channel_t *ftdmchan); void sngisdn_snd_info_req(ftdm_channel_t *ftdmchan); void sngisdn_snd_status_enq(ftdm_channel_t *ftdmchan); +void sngisdn_snd_restart(ftdm_channel_t *ftdmchan); void sngisdn_snd_data(ftdm_channel_t *dchan, uint8_t *data, ftdm_size_t len); void sngisdn_snd_event(ftdm_channel_t *dchan, ftdm_oob_event_t event); @@ -453,6 +457,9 @@ ftdm_status_t set_redir_num(ftdm_channel_t *ftdmchan, RedirNmb *redirNmb); ftdm_status_t set_calling_name(ftdm_channel_t *ftdmchan, ConEvnt *conEvnt); ftdm_status_t set_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad); ftdm_status_t set_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd, ftdm_sngisdn_progind_t prog_ind); +ftdm_status_t set_bear_cap_ie(ftdm_channel_t *ftdmchan, BearCap *bearCap); +ftdm_status_t set_chan_id_ie(ftdm_channel_t *ftdmchan, ChanId *chanId); +ftdm_status_t set_restart_ind_ie(ftdm_channel_t *ftdmchan, RstInd *rstInd); ftdm_status_t set_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr); ftdm_status_t set_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, uint8_t *data_len); @@ -482,7 +489,6 @@ static __inline__ void sngisdn_set_flag(sngisdn_chan_data_t *sngisdn_info, sngis void handle_sng_log(uint8_t level, char *fmt,...); -void sngisdn_set_span_sig_status(ftdm_span_t *ftdmspan, ftdm_signaling_status_t status); void sngisdn_delayed_setup(void* p_sngisdn_info); void sngisdn_delayed_release(void* p_sngisdn_info); void sngisdn_delayed_connect(void* p_sngisdn_info); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index fb65d20..0032270 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -33,7 +33,8 @@ */ #include "ftmod_sangoma_isdn.h" -ftdm_status_t sngisdn_cause_val_requires_disconnect(ftdm_channel_t *ftdmchan, CauseDgn *causeDgn); +static ftdm_status_t sngisdn_cause_val_requires_disconnect(ftdm_channel_t *ftdmchan, CauseDgn *causeDgn); +static void sngisdn_process_restart_confirm(ftdm_channel_t *ftdmchan); /* Remote side transmit a SETUP */ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) @@ -232,6 +233,9 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); } break; + case FTDM_CHANNEL_STATE_RESET: + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Processing SETUP but channel in RESET state, ignoring\n"); + break; default: ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Processing SETUP in an invalid state (%s)\n", ftdm_channel_state2str(ftdmchan->state)); break; @@ -285,6 +289,9 @@ void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event) case FTDM_CHANNEL_STATE_HANGUP: /* Race condition, we just hung up the call - ignore this message */ break; + case FTDM_CHANNEL_STATE_RESET: + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Processing SETUP but channel in RESET state, ignoring\n"); + break; default: ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Processing CONNECT/CONNECT ACK in an invalid state (%s)\n", ftdm_channel_state2str(ftdmchan->state)); @@ -301,6 +308,9 @@ void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event) case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: /* Race condition, We just hung up an incoming call right after we sent a CONNECT - ignore this message */ break; + case FTDM_CHANNEL_STATE_RESET: + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Processing SETUP but channel in RESET state, ignoring\n"); + break; default: ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Processing CONNECT/CONNECT ACK in an invalid state (%s)\n", ftdm_channel_state2str(ftdmchan->state)); @@ -375,6 +385,9 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) /* We are already in progress media, we can't go to any higher state except up */ /* Do nothing */ break; + case FTDM_CHANNEL_STATE_RESET: + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Processing SETUP but channel in RESET state, ignoring\n"); + break; default: ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Processing ALERT/PROCEED/PROGRESS in an invalid state (%s)\n", ftdm_channel_state2str(ftdmchan->state)); @@ -414,6 +427,9 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) case FTDM_CHANNEL_STATE_UP: ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Receiving more digits %s, but we already proceeded with call\n", cnStEvnt->cdPtyNmb.nmbDigits.val); break; + case FTDM_CHANNEL_STATE_RESET: + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Processing SETUP but channel in RESET state, ignoring\n"); + break; default: ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "\n", suId, suInstId, spInstId); break; @@ -531,7 +547,7 @@ void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event) case FTDM_CHANNEL_STATE_DIALING: /* Remote side rejected our SETUP message on outbound call */ if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) { - sngisdn_set_avail_rate(ftdmchan->span, SNGISDN_AVAIL_DOWN); + sngisdn_set_span_avail_rate(ftdmchan->span, SNGISDN_AVAIL_DOWN); } /* fall-through */ case FTDM_CHANNEL_STATE_PROCEED: @@ -581,6 +597,9 @@ void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event) /* set abort flag so that we do not transmit another release complete on this channel once FS core is done */ } break; + case FTDM_CHANNEL_STATE_RESET: + /* User initiated reset, so they do not know about this call */ + break; default: ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Received RELEASE in an invalid state (%s)\n", ftdm_channel_state2str(ftdmchan->state)); @@ -1050,18 +1069,91 @@ void sngisdn_process_srv_cfm (sngisdn_event_data_t *sngisdn_event) return; } +static void sngisdn_process_restart_confirm(ftdm_channel_t *ftdmchan) +{ + switch (ftdmchan->state) { + case FTDM_CHANNEL_STATE_RESET: + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + break; + case FTDM_CHANNEL_STATE_DOWN: + /* Do nothing */ + break; + default: + ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Received RESTART CFM in an invalid state (%s)\n", + ftdm_channel_state2str(ftdmchan->state)); + } + + return; +} + + void sngisdn_process_rst_cfm (sngisdn_event_data_t *sngisdn_event) { int16_t suId = sngisdn_event->suId; int16_t dChan = sngisdn_event->dChan; uint8_t ces = sngisdn_event->ces; uint8_t evntType = sngisdn_event->evntType; + uint8_t chan_no = 0; + Rst *rstEvnt = &sngisdn_event->event.rstEvnt; + + sngisdn_span_data_t *signal_data = g_sngisdn_data.dchans[dChan].spans[1]; + if (!signal_data) { + ftdm_log(FTDM_LOG_CRIT, "Received RESTART on unconfigured span (suId:%d)\n", suId); + return; + } + + if (!rstEvnt->rstInd.eh.pres || !rstEvnt->rstInd.rstClass.pres) { + ftdm_log(FTDM_LOG_CRIT, "Receved RESTART, but Restart Indicator IE not present\n"); + return; + } + + switch(rstEvnt->rstInd.rstClass.val) { + case IN_CL_INDCHAN: /* Indicated b-channel */ + if (rstEvnt->chanId.eh.pres) { + if (rstEvnt->chanId.intType.val == IN_IT_BASIC) { + if (rstEvnt->chanId.infoChanSel.pres == PRSNT_NODEF) { + chan_no = rstEvnt->chanId.infoChanSel.val; + } + } else if (rstEvnt->chanId.intType.val == IN_IT_OTHER) { + if (rstEvnt->chanId.chanNmbSlotMap.pres == PRSNT_NODEF) { + chan_no = rstEvnt->chanId.chanNmbSlotMap.val[0]; + } + } + } + if (!chan_no) { + ftdm_log(FTDM_LOG_CRIT, "Failed to determine channel from RESTART\n"); + return; + } + break; + case IN_CL_SNGINT: /* Single interface */ + case IN_CL_ALLINT: /* All interfaces */ + /* In case restart class indicates all interfaces, we will duplicate + this event on each span associated to this d-channel in sngisdn_rcv_rst_cfm, + so treat it as a single interface anyway */ + break; + default: + ftdm_log(FTDM_LOG_CRIT, "Invalid restart indicator class:%d\n", rstEvnt->rstInd.rstClass.val); + return; + } - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + if (chan_no) { /* For a single channel */ + if (chan_no > ftdm_span_get_chan_count(signal_data->ftdm_span)) { + ftdm_log(FTDM_LOG_CRIT, "Received RESTART on invalid channel:%d\n", chan_no); + } else { + ftdm_channel_t *ftdmchan = ftdm_span_get_channel(signal_data->ftdm_span, chan_no); + sngisdn_process_restart_confirm(ftdmchan); + } + } else { /* for all channels */ + ftdm_iterator_t *chaniter = NULL; + ftdm_iterator_t *curr = NULL; + + chaniter = ftdm_span_get_chan_iterator(signal_data->ftdm_span, NULL); + for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { + sngisdn_process_restart_confirm((ftdm_channel_t*)ftdm_iterator_current(curr)); + } + ftdm_iterator_free(chaniter); + } - /* Function does not require any info from ssHlEvnt struct for now */ - /*Rst *rstEvnt = &sngisdn_event->event.rstEvnt;*/ - ftdm_log(FTDM_LOG_DEBUG, "Processing RESTART CFM (suId:%u dChan:%d ces:%d type:%d)\n", suId, dChan, ces, evntType); ISDN_FUNC_TRACE_EXIT(__FUNCTION__); return; @@ -1090,7 +1182,7 @@ void sngisdn_process_rst_ind (sngisdn_event_data_t *sngisdn_event) return; } -ftdm_status_t sngisdn_cause_val_requires_disconnect(ftdm_channel_t *ftdmchan, CauseDgn *causeDgn) +static ftdm_status_t sngisdn_cause_val_requires_disconnect(ftdm_channel_t *ftdmchan, CauseDgn *causeDgn) { sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 297c59c..bb04f88 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -51,72 +51,6 @@ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) ftdm_mutex_unlock(g_sngisdn_data.ccs[signal_data->cc_id].mutex); memset(&conEvnt, 0, sizeof(conEvnt)); - - conEvnt.bearCap[0].eh.pres = PRSNT_NODEF; - conEvnt.bearCap[0].infoTranCap.pres = PRSNT_NODEF; - conEvnt.bearCap[0].infoTranCap.val = sngisdn_get_infoTranCap_from_user(ftdmchan->caller_data.bearer_capability); - - conEvnt.bearCap[0].codeStand0.pres = PRSNT_NODEF; - conEvnt.bearCap[0].codeStand0.val = IN_CSTD_CCITT; - conEvnt.bearCap[0].infoTranRate0.pres = PRSNT_NODEF; - conEvnt.bearCap[0].infoTranRate0.val = IN_ITR_64KBIT; - conEvnt.bearCap[0].tranMode.pres = PRSNT_NODEF; - conEvnt.bearCap[0].tranMode.val = IN_TM_CIRCUIT; - - conEvnt.chanId.eh.pres = PRSNT_NODEF; - conEvnt.chanId.prefExc.pres = PRSNT_NODEF; - conEvnt.chanId.prefExc.val = IN_PE_EXCLSVE; - conEvnt.chanId.dChanInd.pres = PRSNT_NODEF; - conEvnt.chanId.dChanInd.val = IN_DSI_NOTDCHAN; - conEvnt.chanId.intIdentPres.pres = PRSNT_NODEF; - conEvnt.chanId.intIdentPres.val = IN_IIP_IMPLICIT; - conEvnt.chanId.intIdent.pres = NOTPRSNT; - - if (ftdmchan->span->trunk_type == FTDM_TRUNK_BRI || - ftdmchan->span->trunk_type == FTDM_TRUNK_BRI_PTMP) { - /* Trillium stack rejests lyr1Ident on BRI, but Netbricks always sends it. - Check with Trillium if this ever causes calls to fail in the field */ - - /* BRI only params */ - conEvnt.chanId.intType.pres = PRSNT_NODEF; - conEvnt.chanId.intType.val = IN_IT_BASIC; - conEvnt.chanId.infoChanSel.pres = PRSNT_NODEF; - conEvnt.chanId.infoChanSel.val = ftdmchan->physical_chan_id; - } else { - /* PRI only params */ - conEvnt.bearCap[0].usrInfoLyr1Prot.pres = PRSNT_NODEF; - conEvnt.bearCap[0].usrInfoLyr1Prot.val = sngisdn_get_usrInfoLyr1Prot_from_user(ftdmchan->caller_data.bearer_layer1); - - if (signal_data->switchtype == SNGISDN_SWITCH_EUROISDN && - conEvnt.bearCap[0].usrInfoLyr1Prot.val == IN_UIL1_G711ULAW) { - - /* We are bridging a call from T1 */ - conEvnt.bearCap[0].usrInfoLyr1Prot.val = IN_UIL1_G711ALAW; - - } else if (conEvnt.bearCap[0].usrInfoLyr1Prot.val == IN_UIL1_G711ALAW) { - - /* We are bridging a call from E1 */ - conEvnt.bearCap[0].usrInfoLyr1Prot.val = IN_UIL1_G711ULAW; - } - - conEvnt.bearCap[0].lyr1Ident.pres = PRSNT_NODEF; - conEvnt.bearCap[0].lyr1Ident.val = IN_L1_IDENT; - - conEvnt.chanId.intType.pres = PRSNT_NODEF; - conEvnt.chanId.intType.val = IN_IT_OTHER; - conEvnt.chanId.infoChanSel.pres = PRSNT_NODEF; - conEvnt.chanId.infoChanSel.val = IN_ICS_B1CHAN; - conEvnt.chanId.chanMapType.pres = PRSNT_NODEF; - conEvnt.chanId.chanMapType.val = IN_CMT_BCHAN; - conEvnt.chanId.nmbMap.pres = PRSNT_NODEF; - conEvnt.chanId.nmbMap.val = IN_NM_CHNNMB; - conEvnt.chanId.codeStand1.pres = PRSNT_NODEF; - conEvnt.chanId.codeStand1.val = IN_CSTD_CCITT; - conEvnt.chanId.chanNmbSlotMap.pres = PRSNT_NODEF; - conEvnt.chanId.chanNmbSlotMap.len = 1; - conEvnt.chanId.chanNmbSlotMap.val[0] = ftdmchan->physical_chan_id; - } - if (signal_data->switchtype == SNGISDN_SWITCH_EUROISDN) { conEvnt.sndCmplt.eh.pres = PRSNT_NODEF; } @@ -126,6 +60,8 @@ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) } ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Outgoing call: Called No:[%s] Calling No:[%s]\n", ftdmchan->caller_data.dnis.digits, ftdmchan->caller_data.cid_num.digits); + set_chan_id_ie(ftdmchan, &conEvnt.chanId); + set_bear_cap_ie(ftdmchan, &conEvnt.bearCap[0]); set_called_num(ftdmchan, &conEvnt.cdPtyNmb); set_calling_num(ftdmchan, &conEvnt.cgPtyNmb); set_calling_num2(ftdmchan, &conEvnt.cgPtyNmb2); @@ -161,38 +97,7 @@ void sngisdn_snd_setup_ack(ftdm_channel_t *ftdmchan) memset(&cnStEvnt, 0, sizeof(cnStEvnt)); - cnStEvnt.chanId.eh.pres = PRSNT_NODEF; - cnStEvnt.chanId.prefExc.pres = PRSNT_NODEF; - cnStEvnt.chanId.prefExc.val = IN_PE_EXCLSVE; - cnStEvnt.chanId.dChanInd.pres = PRSNT_NODEF; - cnStEvnt.chanId.dChanInd.val = IN_DSI_NOTDCHAN; - cnStEvnt.chanId.intIdentPres.pres = PRSNT_NODEF; - cnStEvnt.chanId.intIdentPres.val = IN_IIP_IMPLICIT; - - if (ftdmchan->span->trunk_type == FTDM_TRUNK_BRI || - ftdmchan->span->trunk_type == FTDM_TRUNK_BRI_PTMP) { - - /* BRI only params */ - cnStEvnt.chanId.intType.pres = PRSNT_NODEF; - cnStEvnt.chanId.intType.val = IN_IT_BASIC; - cnStEvnt.chanId.infoChanSel.pres = PRSNT_NODEF; - cnStEvnt.chanId.infoChanSel.val = ftdmchan->physical_chan_id; - } else { - cnStEvnt.chanId.intType.pres = PRSNT_NODEF; - cnStEvnt.chanId.intType.val = IN_IT_OTHER; - cnStEvnt.chanId.infoChanSel.pres = PRSNT_NODEF; - cnStEvnt.chanId.infoChanSel.val = IN_ICS_B1CHAN; - cnStEvnt.chanId.chanMapType.pres = PRSNT_NODEF; - cnStEvnt.chanId.chanMapType.val = IN_CMT_BCHAN; - cnStEvnt.chanId.nmbMap.pres = PRSNT_NODEF; - cnStEvnt.chanId.nmbMap.val = IN_NM_CHNNMB; - cnStEvnt.chanId.codeStand1.pres = PRSNT_NODEF; - cnStEvnt.chanId.codeStand1.val = IN_CSTD_CCITT; - cnStEvnt.chanId.chanNmbSlotMap.pres = PRSNT_NODEF; - cnStEvnt.chanId.chanNmbSlotMap.len = 1; - cnStEvnt.chanId.chanNmbSlotMap.val[0] = ftdmchan->physical_chan_id; - } ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending SETUP ACK (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); @@ -221,38 +126,7 @@ void sngisdn_snd_con_complete(ftdm_channel_t *ftdmchan) memset(&cnStEvnt, 0, sizeof(cnStEvnt)); - cnStEvnt.chanId.eh.pres = PRSNT_NODEF; - cnStEvnt.chanId.prefExc.pres = PRSNT_NODEF; - cnStEvnt.chanId.prefExc.val = IN_PE_EXCLSVE; - cnStEvnt.chanId.dChanInd.pres = PRSNT_NODEF; - cnStEvnt.chanId.dChanInd.val = IN_DSI_NOTDCHAN; - cnStEvnt.chanId.intIdentPres.pres = PRSNT_NODEF; - cnStEvnt.chanId.intIdentPres.val = IN_IIP_IMPLICIT; - - if (ftdmchan->span->trunk_type == FTDM_TRUNK_BRI || - ftdmchan->span->trunk_type == FTDM_TRUNK_BRI_PTMP) { - - /* BRI only params */ - cnStEvnt.chanId.intType.pres = PRSNT_NODEF; - cnStEvnt.chanId.intType.val = IN_IT_BASIC; - cnStEvnt.chanId.infoChanSel.pres = PRSNT_NODEF; - cnStEvnt.chanId.infoChanSel.val = ftdmchan->physical_chan_id; - } else { - cnStEvnt.chanId.intType.pres = PRSNT_NODEF; - cnStEvnt.chanId.intType.val = IN_IT_OTHER; - cnStEvnt.chanId.infoChanSel.pres = PRSNT_NODEF; - cnStEvnt.chanId.infoChanSel.val = IN_ICS_B1CHAN; - cnStEvnt.chanId.chanMapType.pres = PRSNT_NODEF; - cnStEvnt.chanId.chanMapType.val = IN_CMT_BCHAN; - cnStEvnt.chanId.nmbMap.pres = PRSNT_NODEF; - cnStEvnt.chanId.nmbMap.val = IN_NM_CHNNMB; - cnStEvnt.chanId.codeStand1.pres = PRSNT_NODEF; - cnStEvnt.chanId.codeStand1.val = IN_CSTD_CCITT; - cnStEvnt.chanId.chanNmbSlotMap.pres = PRSNT_NODEF; - cnStEvnt.chanId.chanNmbSlotMap.len = 1; - cnStEvnt.chanId.chanNmbSlotMap.val[0] = ftdmchan->physical_chan_id; - } - + set_chan_id_ie(ftdmchan, &cnStEvnt.chanId); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending CONNECT COMPL (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); @@ -277,41 +151,11 @@ void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_i } memset(&cnStEvnt, 0, sizeof(cnStEvnt)); - - cnStEvnt.chanId.eh.pres = PRSNT_NODEF; - cnStEvnt.chanId.prefExc.pres = PRSNT_NODEF; - cnStEvnt.chanId.prefExc.val = IN_PE_EXCLSVE; - cnStEvnt.chanId.dChanInd.pres = PRSNT_NODEF; - cnStEvnt.chanId.dChanInd.val = IN_DSI_NOTDCHAN; - cnStEvnt.chanId.intIdentPres.pres = PRSNT_NODEF; - cnStEvnt.chanId.intIdentPres.val = IN_IIP_IMPLICIT; - - if (ftdmchan->span->trunk_type == FTDM_TRUNK_BRI || - ftdmchan->span->trunk_type == FTDM_TRUNK_BRI_PTMP) { - - /* BRI only params */ - cnStEvnt.chanId.intType.pres = PRSNT_NODEF; - cnStEvnt.chanId.intType.val = IN_IT_BASIC; - cnStEvnt.chanId.infoChanSel.pres = PRSNT_NODEF; - cnStEvnt.chanId.infoChanSel.val = ftdmchan->physical_chan_id; - } else { - cnStEvnt.chanId.intType.pres = PRSNT_NODEF; - cnStEvnt.chanId.intType.val = IN_IT_OTHER; - cnStEvnt.chanId.infoChanSel.pres = PRSNT_NODEF; - cnStEvnt.chanId.infoChanSel.val = IN_ICS_B1CHAN; - cnStEvnt.chanId.chanMapType.pres = PRSNT_NODEF; - cnStEvnt.chanId.chanMapType.val = IN_CMT_BCHAN; - cnStEvnt.chanId.nmbMap.pres = PRSNT_NODEF; - cnStEvnt.chanId.nmbMap.val = IN_NM_CHNNMB; - cnStEvnt.chanId.codeStand1.pres = PRSNT_NODEF; - cnStEvnt.chanId.codeStand1.val = IN_CSTD_CCITT; - cnStEvnt.chanId.chanNmbSlotMap.pres = PRSNT_NODEF; - cnStEvnt.chanId.chanNmbSlotMap.len = 1; - cnStEvnt.chanId.chanNmbSlotMap.val[0] = ftdmchan->physical_chan_id; - } + set_chan_id_ie(ftdmchan, &cnStEvnt.chanId); set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); set_facility_ie(ftdmchan, &cnStEvnt.facilityStr); + ftdm_call_clear_data(&ftdmchan->caller_data); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending PROCEED (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); @@ -397,39 +241,8 @@ void sngisdn_snd_connect(ftdm_channel_t *ftdmchan) } memset(&cnStEvnt, 0, sizeof(cnStEvnt)); - - cnStEvnt.chanId.eh.pres = PRSNT_NODEF; - cnStEvnt.chanId.prefExc.pres = PRSNT_NODEF; - cnStEvnt.chanId.prefExc.val = IN_PE_EXCLSVE; - cnStEvnt.chanId.dChanInd.pres = PRSNT_NODEF; - cnStEvnt.chanId.dChanInd.val = IN_DSI_NOTDCHAN; - cnStEvnt.chanId.intIdentPres.pres = PRSNT_NODEF; - cnStEvnt.chanId.intIdentPres.val = IN_IIP_IMPLICIT; - if (ftdmchan->span->trunk_type == FTDM_TRUNK_BRI || - ftdmchan->span->trunk_type == FTDM_TRUNK_BRI_PTMP) { - - /* BRI only params */ - cnStEvnt.chanId.intType.pres = PRSNT_NODEF; - cnStEvnt.chanId.intType.val = IN_IT_BASIC; - cnStEvnt.chanId.infoChanSel.pres = PRSNT_NODEF; - cnStEvnt.chanId.infoChanSel.val = ftdmchan->physical_chan_id; - } else { - cnStEvnt.chanId.intType.pres = PRSNT_NODEF; - cnStEvnt.chanId.intType.val = IN_IT_OTHER; - cnStEvnt.chanId.infoChanSel.pres = PRSNT_NODEF; - cnStEvnt.chanId.infoChanSel.val = IN_ICS_B1CHAN; - cnStEvnt.chanId.chanMapType.pres = PRSNT_NODEF; - cnStEvnt.chanId.chanMapType.val = IN_CMT_BCHAN; - cnStEvnt.chanId.nmbMap.pres = PRSNT_NODEF; - cnStEvnt.chanId.nmbMap.val = IN_NM_CHNNMB; - cnStEvnt.chanId.codeStand1.pres = PRSNT_NODEF; - cnStEvnt.chanId.codeStand1.val = IN_CSTD_CCITT; - cnStEvnt.chanId.chanNmbSlotMap.pres = PRSNT_NODEF; - cnStEvnt.chanId.chanNmbSlotMap.len = 1; - cnStEvnt.chanId.chanNmbSlotMap.val[0] = ftdmchan->physical_chan_id; - } - + set_chan_id_ie(ftdmchan, &cnStEvnt.chanId); set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); set_facility_ie(ftdmchan, &cnStEvnt.facilityStr); ftdm_call_clear_data(&ftdmchan->caller_data); @@ -563,6 +376,7 @@ void sngisdn_snd_disconnect(ftdm_channel_t *ftdmchan) } return; } + void sngisdn_snd_release(ftdm_channel_t *ftdmchan, uint8_t glare) { RelEvnt relEvnt; @@ -618,6 +432,24 @@ void sngisdn_snd_release(ftdm_channel_t *ftdmchan, uint8_t glare) return; } +void sngisdn_snd_restart(ftdm_channel_t *ftdmchan) +{ + Rst rstEvnt; + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + + memset(&rstEvnt, 0, sizeof(rstEvnt)); + + set_chan_id_ie(ftdmchan, &rstEvnt.chanId); + set_restart_ind_ie(ftdmchan, &rstEvnt.rstInd); + + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending RESTART (suId:%d dchan:%d ces:%d)\n", signal_data->cc_id, signal_data->dchan_id, CES_MNGMNT); + + if (sng_isdn_restart_request(signal_data->cc_id, &rstEvnt, signal_data->dchan_id, CES_MNGMNT, IN_SND_RST)) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused RESTART request\n"); + } + return; +} + /* We received an incoming frame on the d-channel, send data to the stack */ void sngisdn_snd_data(ftdm_channel_t *dchan, uint8_t *data, ftdm_size_t len) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c index af180d1..4b04fb0 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c @@ -630,8 +630,9 @@ void sngisdn_rcv_rst_cfm (int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + ftdm_log(FTDM_LOG_INFO, "Received RESTART CFM (dChan:%d ces:%u type:%u)\n", dChan, ces, evntType); - + /* Enqueue the event to each span within the dChan */ for(i=1; i<=g_sngisdn_data.dchans[dChan].num_spans; i++) { signal_data = g_sngisdn_data.dchans[dChan].spans[i]; @@ -725,14 +726,25 @@ void sngisdn_rcv_q931_ind(InMngmt *status) ftdmspan = signal_data->ftdm_span; if (status->t.usta.alarm.event == LCM_EVENT_UP) { + uint32_t chan_no = status->t.usta.evntParm[2]; ftdm_log(FTDM_LOG_INFO, "[SNGISDN Q931] s%d: %s: %s(%d): %s(%d)\n", status->t.usta.suId, DECODE_LCM_CATEGORY(status->t.usta.alarm.category), DECODE_LCM_EVENT(status->t.usta.alarm.event), status->t.usta.alarm.event, DECODE_LCM_CAUSE(status->t.usta.alarm.cause), status->t.usta.alarm.cause); - - sngisdn_set_span_sig_status(ftdmspan, FTDM_SIG_STATE_UP); - sngisdn_set_avail_rate(ftdmspan, SNGISDN_AVAIL_UP); + + if (chan_no) { + ftdm_channel_t *ftdmchan = ftdm_span_get_channel(ftdmspan, chan_no); + if (ftdmchan) { + sngisdn_set_chan_sig_status(ftdmchan, FTDM_SIG_STATE_UP); + sngisdn_set_chan_avail_rate(ftdmchan, SNGISDN_AVAIL_UP); + } else { + ftdm_log(FTDM_LOG_CRIT, "stack alarm event on invalid channel :%d\n", chan_no); + } + } else { + sngisdn_set_span_sig_status(ftdmspan, FTDM_SIG_STATE_UP); + sngisdn_set_span_avail_rate(ftdmspan, SNGISDN_AVAIL_UP); + } } else { ftdm_log(FTDM_LOG_WARNING, "[SNGISDN Q931] s%d: %s: %s(%d): %s(%d)\n", status->t.usta.suId, @@ -741,7 +753,7 @@ void sngisdn_rcv_q931_ind(InMngmt *status) DECODE_LCM_CAUSE(status->t.usta.alarm.cause), status->t.usta.alarm.cause); sngisdn_set_span_sig_status(ftdmspan, FTDM_SIG_STATE_DOWN); - sngisdn_set_avail_rate(ftdmspan, SNGISDN_AVAIL_PWR_SAVING); + sngisdn_set_span_avail_rate(ftdmspan, SNGISDN_AVAIL_PWR_SAVING); } } break; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 76d11d6..28768a1 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -136,19 +136,25 @@ ftdm_status_t get_ftdmchan_by_spInstId(int16_t cc_id, uint32_t spInstId, sngisdn return FTDM_SUCCESS; } -ftdm_status_t sngisdn_set_avail_rate(ftdm_span_t *span, sngisdn_avail_t avail) +ftdm_status_t sngisdn_set_chan_avail_rate(ftdm_channel_t *chan, sngisdn_avail_t avail) { - if (span->trunk_type == FTDM_TRUNK_BRI || - span->trunk_type == FTDM_TRUNK_BRI_PTMP) { + if (FTDM_SPAN_IS_BRI(chan->span)) { + ftdm_log_chan(chan, FTDM_LOG_DEBUG, "Setting availability rate to:%d\n", avail); + chan->availability_rate = avail; + } + return FTDM_SUCCESS; +} +ftdm_status_t sngisdn_set_span_avail_rate(ftdm_span_t *span, sngisdn_avail_t avail) +{ + if (FTDM_SPAN_IS_BRI(span)) { ftdm_iterator_t *chaniter = NULL; ftdm_iterator_t *curr = NULL; - chaniter = ftdm_span_get_chan_iterator(span, NULL); for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { ftdm_log_chan(((ftdm_channel_t*)ftdm_iterator_current(curr)), FTDM_LOG_DEBUG, "Setting availability rate to:%d\n", avail); - ((ftdm_channel_t*)ftdm_iterator_current(curr))->availability_rate = avail; + sngisdn_set_chan_avail_rate(((ftdm_channel_t*)ftdm_iterator_current(curr)), avail); } ftdm_iterator_free(chaniter); } @@ -676,7 +682,6 @@ ftdm_status_t set_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad) return FTDM_SUCCESS; } - ftdm_status_t set_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr) { ftdm_status_t status; @@ -789,6 +794,93 @@ ftdm_status_t set_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd, ftdm_s return FTDM_SUCCESS; } +ftdm_status_t set_chan_id_ie(ftdm_channel_t *ftdmchan, ChanId *chanId) +{ + if (!ftdmchan) { + return FTDM_SUCCESS; + } + chanId->eh.pres = PRSNT_NODEF; + chanId->prefExc.pres = PRSNT_NODEF; + chanId->prefExc.val = IN_PE_EXCLSVE; + chanId->dChanInd.pres = PRSNT_NODEF; + chanId->dChanInd.val = IN_DSI_NOTDCHAN; + chanId->intIdentPres.pres = PRSNT_NODEF; + chanId->intIdentPres.val = IN_IIP_IMPLICIT; + + if (ftdmchan->span->trunk_type == FTDM_TRUNK_BRI || + ftdmchan->span->trunk_type == FTDM_TRUNK_BRI_PTMP) { + + /* BRI only params */ + chanId->intType.pres = PRSNT_NODEF; + chanId->intType.val = IN_IT_BASIC; + chanId->infoChanSel.pres = PRSNT_NODEF; + chanId->infoChanSel.val = ftdmchan->physical_chan_id; + } else { + chanId->intType.pres = PRSNT_NODEF; + chanId->intType.val = IN_IT_OTHER; + chanId->infoChanSel.pres = PRSNT_NODEF; + chanId->infoChanSel.val = IN_ICS_B1CHAN; + chanId->chanMapType.pres = PRSNT_NODEF; + chanId->chanMapType.val = IN_CMT_BCHAN; + chanId->nmbMap.pres = PRSNT_NODEF; + chanId->nmbMap.val = IN_NM_CHNNMB; + chanId->codeStand1.pres = PRSNT_NODEF; + chanId->codeStand1.val = IN_CSTD_CCITT; + chanId->chanNmbSlotMap.pres = PRSNT_NODEF; + chanId->chanNmbSlotMap.len = 1; + chanId->chanNmbSlotMap.val[0] = ftdmchan->physical_chan_id; + } + return FTDM_SUCCESS; +} + +ftdm_status_t set_bear_cap_ie(ftdm_channel_t *ftdmchan, BearCap *bearCap) +{ + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + + bearCap->eh.pres = PRSNT_NODEF; + bearCap->infoTranCap.pres = PRSNT_NODEF; + bearCap->infoTranCap.val = sngisdn_get_infoTranCap_from_user(ftdmchan->caller_data.bearer_capability); + + bearCap->codeStand0.pres = PRSNT_NODEF; + bearCap->codeStand0.val = IN_CSTD_CCITT; + bearCap->infoTranRate0.pres = PRSNT_NODEF; + bearCap->infoTranRate0.val = IN_ITR_64KBIT; + bearCap->tranMode.pres = PRSNT_NODEF; + bearCap->tranMode.val = IN_TM_CIRCUIT; + + if (!FTDM_SPAN_IS_BRI(ftdmchan->span)) { + /* Trillium stack rejests lyr1Ident on BRI, but Netbricks always sends it. + Check with Trillium if this ever causes calls to fail in the field */ + + /* PRI only params */ + bearCap->usrInfoLyr1Prot.pres = PRSNT_NODEF; + bearCap->usrInfoLyr1Prot.val = sngisdn_get_usrInfoLyr1Prot_from_user(ftdmchan->caller_data.bearer_layer1); + + if (signal_data->switchtype == SNGISDN_SWITCH_EUROISDN && + bearCap->usrInfoLyr1Prot.val == IN_UIL1_G711ULAW) { + + /* We are bridging a call from T1 */ + bearCap->usrInfoLyr1Prot.val = IN_UIL1_G711ALAW; + + } else if (bearCap->usrInfoLyr1Prot.val == IN_UIL1_G711ALAW) { + + /* We are bridging a call from E1 */ + bearCap->usrInfoLyr1Prot.val = IN_UIL1_G711ULAW; + } + + bearCap->lyr1Ident.pres = PRSNT_NODEF; + bearCap->lyr1Ident.val = IN_L1_IDENT; + } + return FTDM_SUCCESS; +} + +ftdm_status_t set_restart_ind_ie(ftdm_channel_t *ftdmchan, RstInd *rstInd) +{ + rstInd->eh.pres = PRSNT_NODEF; + rstInd->rstClass.pres = PRSNT_NODEF; + rstInd->rstClass.val = IN_CL_INDCHAN; + return FTDM_SUCCESS; +} void sngisdn_t3_timeout(void* p_sngisdn_info) { diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index cc32d66..a3cddad 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -702,6 +702,14 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_hangup(const char *file, const char /*! \brief Hangup the call with cause recording the source code point where it was called (see ftdm_channel_call_hangup_with_cause for an easy to use macro) */ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_hangup_with_cause(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_call_cause_t); +/*! \brief Reset the channel */ +#define ftdm_channel_reset(ftdmchan) _ftdm_channel_reset(__FILE__, __FUNCTION__, __LINE__, (ftdmchan)) + +/*! \brief Reset the channel (see _ftdm_channel_reset for an easy to use macro) + * \note if there was a call on this channel, call will be cleared without any notifications to the user + */ +FT_DECLARE(ftdm_status_t) _ftdm_channel_reset(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan); + /*! \brief Put a call on hold (if supported by the signaling stack) */ #define ftdm_channel_call_hold(ftdmchan) _ftdm_channel_call_hold(__FILE__, __FUNCTION__, __LINE__, (ftdmchan)) @@ -741,6 +749,7 @@ FT_DECLARE(ftdm_status_t) ftdm_span_set_sig_status(ftdm_span_t *span, ftdm_signa /*! \brief Get span signaling status (ie: whether protocol layer is up or down) */ FT_DECLARE(ftdm_status_t) ftdm_span_get_sig_status(ftdm_span_t *span, ftdm_signaling_status_t *status); + /*! * \brief Set user private data in the channel * diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index deabafd..9222da3 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -599,7 +599,6 @@ FT_DECLARE(void) ftdm_channel_rotate_tokens(ftdm_channel_t *ftdmchan); FT_DECLARE(int) ftdm_load_module(const char *name); FT_DECLARE(int) ftdm_load_module_assume(const char *name); FT_DECLARE(int) ftdm_vasprintf(char **ret, const char *fmt, va_list ap); -FT_DECLARE(ftdm_status_t) ftdm_channel_done(ftdm_channel_t *ftdmchan); FT_DECLARE(ftdm_status_t) ftdm_span_close_all(void); FT_DECLARE(ftdm_status_t) ftdm_channel_open_chan(ftdm_channel_t *ftdmchan); diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index 313044a..f03c060 100644 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -228,12 +228,13 @@ typedef enum { FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_IN_LOOP, + FTDM_CHANNEL_STATE_RESET, FTDM_CHANNEL_STATE_INVALID } ftdm_channel_state_t; #define CHANNEL_STATE_STRINGS "DOWN", "HOLD", "SUSPENDED", "DIALTONE", "COLLECT", \ "RING", "RINGING", "BUSY", "ATTN", "GENRING", "DIALING", "GET_CALLERID", "CALLWAITING", \ "RESTART", "PROCEED", "PROGRESS", "PROGRESS_MEDIA", "UP", "IDLE", "TERMINATING", "CANCEL", \ - "HANGUP", "HANGUP_COMPLETE", "IN_LOOP", "INVALID" + "HANGUP", "HANGUP_COMPLETE", "IN_LOOP", "RESET", "INVALID" FTDM_STR2ENUM_P(ftdm_str2ftdm_channel_state, ftdm_channel_state2str, ftdm_channel_state_t) typedef enum { commit 36b2346445188c279b8d3da2c139a0ca862f2511 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Dec 14 09:28:57 2010 -0600 add path diff --git a/Makefile.am b/Makefile.am index 72ad3f7..da89572 100644 --- a/Makefile.am +++ b/Makefile.am @@ -102,7 +102,7 @@ CORE_CFLAGS += -I$(switch_srcdir)/libs/pcre CORE_CFLAGS += -I$(switch_srcdir)/libs/speex/include -Ilibs/speex/include CORE_CFLAGS += -I$(switch_srcdir)/libs/srtp/include CORE_CFLAGS += -I$(switch_srcdir)/libs/srtp/crypto/include -Ilibs/srtp/crypto/include -CORE_CFLAGS += -I$(switch_srcdir)/libs/spandsp/src +CORE_CFLAGS += -I$(switch_srcdir)/libs/spandsp/src -I$(switch_srcdir)/libs/tiff-3.8.2/libtiff CORE_LIBS = libs/apr-util/libaprutil-1.la libs/apr/libapr-1.la CORE_LIBS += libs/sqlite/libsqlite3.la libs/pcre/libpcre.la libs/speex/libspeex/libspeexdsp.la commit 739ac99e3b80a15c81def7f65e24b035a96b3602 Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Tue Dec 14 08:38:57 2010 -0600 skypopen: tweaking the OSS audio driver, still gives a load average higher than snd-dummy + snd-pcm-oss on CentOS 5 (but not much more, and lower cpu load), but now is very very good on tickless kernels, eg: Ubuntu 10.04 LTS diff --git a/src/mod/endpoints/mod_skypopen/oss/Makefile b/src/mod/endpoints/mod_skypopen/oss/Makefile index 91cc61b..465db53 100644 --- a/src/mod/endpoints/mod_skypopen/oss/Makefile +++ b/src/mod/endpoints/mod_skypopen/oss/Makefile @@ -1,6 +1,6 @@ # Comment/uncomment the following line to disable/enable debugging #DEBUG = y -LDDINC=/usr/src/linux-headers-2.6.32-26-server/include +#LDDINC=/usr/src/linux-headers-2.6.32-26-server/include # Add your debugging flag (or not) to CFLAGS ifeq ($(DEBUG),y) diff --git a/src/mod/endpoints/mod_skypopen/oss/main.c b/src/mod/endpoints/mod_skypopen/oss/main.c index 925441b..8da9c54 100644 --- a/src/mod/endpoints/mod_skypopen/oss/main.c +++ b/src/mod/endpoints/mod_skypopen/oss/main.c @@ -67,7 +67,7 @@ void my_timer_callback_inq( unsigned long data ) { struct scull_dev *dev = (void *)data; - dev->readable=1; + //dev->readable=1; wake_up_interruptible(&dev->inq); mod_timer( &dev->timer_inq, jiffies + msecs_to_jiffies(GIOVA_SLEEP) ); @@ -77,7 +77,7 @@ void my_timer_callback_outq( unsigned long data ) { struct scull_dev *dev = (void *)data; - dev->writable=1; + //dev->writable=1; wake_up_interruptible(&dev->outq); mod_timer( &dev->timer_outq, jiffies + msecs_to_jiffies(GIOVA_SLEEP) ); } @@ -172,14 +172,14 @@ ssize_t scull_read(struct file *filp, char __user *buf, size_t count, { struct scull_dev *dev = filp->private_data; - //DEFINE_WAIT(wait); - //prepare_to_wait(&dev->inq, &wait, TASK_INTERRUPTIBLE); - //schedule(); - //finish_wait(&dev->inq, &wait); + DEFINE_WAIT(wait); + prepare_to_wait(&dev->inq, &wait, TASK_INTERRUPTIBLE); + schedule(); + finish_wait(&dev->inq, &wait); //memset(buf, 255, count); - wait_event_interruptible(dev->inq, dev->readable); - dev->readable=0; + //wait_event_interruptible(dev->inq, dev->readable); + //dev->readable=0; return count; } @@ -188,13 +188,13 @@ ssize_t scull_write(struct file *filp, const char __user *buf, size_t count, loff_t *f_pos) { struct scull_dev *dev = filp->private_data; - //DEFINE_WAIT(wait); - //prepare_to_wait(&dev->outq, &wait, TASK_INTERRUPTIBLE); - //schedule(); - //finish_wait(&dev->outq, &wait); + DEFINE_WAIT(wait); + prepare_to_wait(&dev->outq, &wait, TASK_INTERRUPTIBLE); + schedule(); + finish_wait(&dev->outq, &wait); - wait_event_interruptible(dev->outq, dev->writable); - dev->writable=0; + //wait_event_interruptible(dev->outq, dev->writable); + //dev->writable=0; return count; commit 7997d24f33eaab50ed1e9068f8326e6e0dd706cf Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Tue Dec 14 06:45:43 2010 -0600 skypopen: tweaking the OSS audio driver diff --git a/src/mod/endpoints/mod_skypopen/oss/main.c b/src/mod/endpoints/mod_skypopen/oss/main.c index c1228d6..925441b 100644 --- a/src/mod/endpoints/mod_skypopen/oss/main.c +++ b/src/mod/endpoints/mod_skypopen/oss/main.c @@ -67,6 +67,7 @@ void my_timer_callback_inq( unsigned long data ) { struct scull_dev *dev = (void *)data; + dev->readable=1; wake_up_interruptible(&dev->inq); mod_timer( &dev->timer_inq, jiffies + msecs_to_jiffies(GIOVA_SLEEP) ); @@ -76,6 +77,7 @@ void my_timer_callback_outq( unsigned long data ) { struct scull_dev *dev = (void *)data; + dev->writable=1; wake_up_interruptible(&dev->outq); mod_timer( &dev->timer_outq, jiffies + msecs_to_jiffies(GIOVA_SLEEP) ); } @@ -130,11 +132,11 @@ static int scull_c_open(struct inode *inode, struct file *filp) struct scull_dev *dev; dev_t key; - if (!current->tgid) { - printk("Process \"%s\" has no tgid\n", current->comm); + if (!current->pid) { + printk("Process \"%s\" has no pid\n", current->comm); return -EINVAL; } - key = current->tgid; + key = current->pid; /* look for a scullc device in the list */ spin_lock(&scull_c_lock); @@ -170,12 +172,14 @@ ssize_t scull_read(struct file *filp, char __user *buf, size_t count, { struct scull_dev *dev = filp->private_data; - DEFINE_WAIT(wait); - prepare_to_wait(&dev->inq, &wait, TASK_INTERRUPTIBLE); - schedule(); - finish_wait(&dev->inq, &wait); + //DEFINE_WAIT(wait); + //prepare_to_wait(&dev->inq, &wait, TASK_INTERRUPTIBLE); + //schedule(); + //finish_wait(&dev->inq, &wait); //memset(buf, 255, count); + wait_event_interruptible(dev->inq, dev->readable); + dev->readable=0; return count; } @@ -184,10 +188,13 @@ ssize_t scull_write(struct file *filp, const char __user *buf, size_t count, loff_t *f_pos) { struct scull_dev *dev = filp->private_data; - DEFINE_WAIT(wait); - prepare_to_wait(&dev->outq, &wait, TASK_INTERRUPTIBLE); - schedule(); - finish_wait(&dev->outq, &wait); + //DEFINE_WAIT(wait); + //prepare_to_wait(&dev->outq, &wait, TASK_INTERRUPTIBLE); + //schedule(); + //finish_wait(&dev->outq, &wait); + + wait_event_interruptible(dev->outq, dev->writable); + dev->writable=0; return count; diff --git a/src/mod/endpoints/mod_skypopen/oss/scull.h b/src/mod/endpoints/mod_skypopen/oss/scull.h index e86281b..565b8b3 100644 --- a/src/mod/endpoints/mod_skypopen/oss/scull.h +++ b/src/mod/endpoints/mod_skypopen/oss/scull.h @@ -34,6 +34,8 @@ struct scull_dev { wait_queue_head_t outq; /* read and write queues */ struct timer_list timer_inq; struct timer_list timer_outq; + int readable; + int writable; //unsigned long read_howmany; //unsigned long write_howmany; //unsigned long read_sleeped_acc; commit 6e310ef8fc0d5b7e00460b7603f6b5854aa61db1 Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Mon Dec 13 07:33:37 2010 -0600 skypopen: slightly improve OSS audio driver diff --git a/src/mod/endpoints/mod_skypopen/oss/main.c b/src/mod/endpoints/mod_skypopen/oss/main.c index 17cc5e3..c1228d6 100644 --- a/src/mod/endpoints/mod_skypopen/oss/main.c +++ b/src/mod/endpoints/mod_skypopen/oss/main.c @@ -61,14 +61,14 @@ MODULE_LICENSE("Dual BSD/GPL"); static struct scull_dev *scull_devices; /* allocated in scull_init_module */ #define GIOVA_BLK 1920 -#define GIOVA_SLEEP 20000 +#define GIOVA_SLEEP 20 void my_timer_callback_inq( unsigned long data ) { struct scull_dev *dev = (void *)data; wake_up_interruptible(&dev->inq); - mod_timer( &dev->timer_inq, jiffies + msecs_to_jiffies(GIOVA_SLEEP/1000) ); + mod_timer( &dev->timer_inq, jiffies + msecs_to_jiffies(GIOVA_SLEEP) ); } @@ -77,7 +77,7 @@ void my_timer_callback_outq( unsigned long data ) struct scull_dev *dev = (void *)data; wake_up_interruptible(&dev->outq); - mod_timer( &dev->timer_outq, jiffies + msecs_to_jiffies(GIOVA_SLEEP/1000) ); + mod_timer( &dev->timer_outq, jiffies + msecs_to_jiffies(GIOVA_SLEEP) ); } /* The clone-specific data structure includes a key field */ @@ -117,9 +117,9 @@ static struct scull_dev *scull_c_lookfor_device(dev_t key) printk(" Timer installing\n"); setup_timer( &lptr->device.timer_inq, my_timer_callback_inq, (long int)lptr ); setup_timer( &lptr->device.timer_outq, my_timer_callback_outq, (long int)lptr ); - printk( "Starting timer to fire in %dms (%ld)\n", GIOVA_SLEEP/1000, jiffies ); - mod_timer( &lptr->device.timer_inq, jiffies + msecs_to_jiffies(GIOVA_SLEEP/1000) ); - mod_timer( &lptr->device.timer_outq, jiffies + msecs_to_jiffies(GIOVA_SLEEP/1000) ); + printk( "Starting timer to fire in %dms (%ld)\n", GIOVA_SLEEP, jiffies ); + mod_timer( &lptr->device.timer_inq, jiffies + msecs_to_jiffies(GIOVA_SLEEP) ); + mod_timer( &lptr->device.timer_outq, jiffies + msecs_to_jiffies(GIOVA_SLEEP) ); /* place it in the list */ list_add(&lptr->list, &scull_c_list); @@ -170,11 +170,11 @@ ssize_t scull_read(struct file *filp, char __user *buf, size_t count, { struct scull_dev *dev = filp->private_data; - DEFINE_WAIT(wait); - prepare_to_wait(&dev->inq, &wait, TASK_INTERRUPTIBLE); - schedule(); - finish_wait(&dev->inq, &wait); - //memset(buf, 255, count); + DEFINE_WAIT(wait); + prepare_to_wait(&dev->inq, &wait, TASK_INTERRUPTIBLE); + schedule(); + finish_wait(&dev->inq, &wait); + //memset(buf, 255, count); return count; @@ -184,10 +184,10 @@ ssize_t scull_write(struct file *filp, const char __user *buf, size_t count, loff_t *f_pos) { struct scull_dev *dev = filp->private_data; - DEFINE_WAIT(wait); - prepare_to_wait(&dev->outq, &wait, TASK_INTERRUPTIBLE); - schedule(); - finish_wait(&dev->outq, &wait); + DEFINE_WAIT(wait); + prepare_to_wait(&dev->outq, &wait, TASK_INTERRUPTIBLE); + schedule(); + finish_wait(&dev->outq, &wait); return count; @@ -252,7 +252,7 @@ void scull_cleanup_module(void) } - /* And all the cloned devices */ + /* And all the cloned devices */ list_for_each_entry_safe(lptr, next, &scull_c_list, list) { ret= del_timer( &lptr->device.timer_inq ); if (ret) printk("The inq timer was still in use...\n"); @@ -261,7 +261,7 @@ void scull_cleanup_module(void) list_del(&lptr->list); kfree(lptr); } - printk("Timer uninstalling\n"); + printk("Timer uninstalling\n"); /* cleanup_module is never called if registering failed */ unregister_chrdev_region(devno, scull_nr_devs); commit 0e83cbe5cae49a326ce687d1079471dd072b915b Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Sun Dec 12 13:39:03 2010 -0600 skypopen: slightly improve OSS audio driver diff --git a/src/mod/endpoints/mod_skypopen/oss/main.c b/src/mod/endpoints/mod_skypopen/oss/main.c index 4d36ac0..17cc5e3 100644 --- a/src/mod/endpoints/mod_skypopen/oss/main.c +++ b/src/mod/endpoints/mod_skypopen/oss/main.c @@ -60,8 +60,8 @@ MODULE_LICENSE("Dual BSD/GPL"); static struct scull_dev *scull_devices; /* allocated in scull_init_module */ -#define GIOVA_BLK 3840 -#define GIOVA_SLEEP 40000 +#define GIOVA_BLK 1920 +#define GIOVA_SLEEP 20000 void my_timer_callback_inq( unsigned long data ) { @@ -130,11 +130,11 @@ static int scull_c_open(struct inode *inode, struct file *filp) struct scull_dev *dev; dev_t key; - if (!current->pid) { - printk("Process \"%s\" has no pid\n", current->comm); + if (!current->tgid) { + printk("Process \"%s\" has no tgid\n", current->comm); return -EINVAL; } - key = current->pid; + key = current->tgid; /* look for a scullc device in the list */ spin_lock(&scull_c_lock); @@ -174,6 +174,8 @@ ssize_t scull_read(struct file *filp, char __user *buf, size_t count, prepare_to_wait(&dev->inq, &wait, TASK_INTERRUPTIBLE); schedule(); finish_wait(&dev->inq, &wait); + //memset(buf, 255, count); + return count; } commit 7e047c3fd12cf3d6a4fae02021ea561512041d8f Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Dec 14 00:15:36 2010 -0600 more ongoing work on jb diff --git a/libs/stfu/stfu.c b/libs/stfu/stfu.c index 1271320..547c337 100644 --- a/libs/stfu/stfu.c +++ b/libs/stfu/stfu.c @@ -28,6 +28,11 @@ #include "stfu.h" //#define DB_JB 1 + +#ifndef UINT_MAX +# define UINT_MAX 4294967295U +#endif + #ifdef _MSC_VER /* warning C4706: assignment within conditional expression*/ #pragma warning(disable: 4706) @@ -123,6 +128,7 @@ static stfu_status_t stfu_n_resize_aqueue(stfu_queue_t *queue, uint32_t qlen) static void stfu_n_init_aqueue(stfu_queue_t *queue, uint32_t qlen) { + queue->array = calloc(qlen, sizeof(struct stfu_frame)); assert(queue->array != NULL); memset(queue->array, 0, sizeof(struct stfu_frame) * qlen); @@ -166,6 +172,7 @@ stfu_status_t stfu_n_resize(stfu_instance_t *i, uint32_t qlen) stfu_status_t s; if (i->qlen == i->max_qlen) { + printf("FUCKER1\n"); return STFU_IT_FAILED; } @@ -173,6 +180,7 @@ stfu_status_t stfu_n_resize(stfu_instance_t *i, uint32_t qlen) if (i->qlen < i->max_qlen) { qlen = i->max_qlen; } else { + printf("FUCKER2\n"); return STFU_IT_FAILED; } } @@ -196,6 +204,12 @@ stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_qlen, uint32_t samples_ return NULL; } memset(i, 0, sizeof(*i)); + + +#ifdef DB_JB + printf("INIT %u %u\n", qlen, max_qlen); +#endif + i->qlen = qlen; i->max_qlen = max_qlen; i->orig_qlen = qlen; @@ -281,10 +295,11 @@ stfu_status_t stfu_n_sync(stfu_instance_t *i, uint32_t packets) stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t seq, uint32_t pt, void *data, size_t datalen, int last) { - uint32_t index; + uint32_t index = 0; stfu_frame_t *frame; size_t cplen = 0; int good_seq = 0, good_ts = 0; + uint32_t min_seq = UINT_MAX, min_ts = UINT_MAX, min_index = 0; if (!i->samples_per_packet && ts && i->last_rd_ts) { i->ts_diff = ts - i->last_rd_ts; @@ -322,21 +337,20 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t seq, uin i->period_packet_in_count++; i->session_packet_in_count++; - if (i->session_packet_in_count == 150) { - return STFU_IT_WORKED; - } - i->period_need_range_avg = i->period_need_range / (i->period_missing_count || 1); - + if (i->period_missing_count > i->qlen * 2) { +#ifdef DB_JB + printf("resize %u %u\n", i->qlen, i->qlen + 1); +#endif stfu_n_resize(i, i->qlen + 1); stfu_n_reset_counters(i); - } - - if (i->qlen > i->orig_qlen && (i->consecutive_good_count > i->decrement_time || i->period_clean_count > i->decrement_time)) { - stfu_n_resize(i, i->qlen - 1); - stfu_n_reset_counters(i); - stfu_n_sync(i, i->qlen); + } else { + if (i->qlen > i->orig_qlen && (i->consecutive_good_count > i->decrement_time || i->period_clean_count > i->decrement_time)) { + stfu_n_resize(i, i->qlen - 1); + stfu_n_reset_counters(i); + stfu_n_sync(i, i->qlen); + } } if ((i->period_packet_in_count > i->period_time)) { @@ -379,13 +393,31 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t seq, uin return STFU_IM_DONE; } - for(index = 0; index < i->out_queue->array_size; index++) { + for(index = 0; index < i->in_queue->array_size; index++) { + if (i->in_queue->array[index].was_read) { + min_index = index; break; } + + if (i->in_queue->array[index].seq < min_seq) { + min_seq = i->in_queue->array[index].seq; + min_index = index; + } + + if (i->in_queue->array[index].ts < min_ts) { + min_ts = i->in_queue->array[index].ts; + min_index = index; + } } - index = i->in_queue->array_len++; + index = min_index; + + if (i->in_queue->array_len < i->in_queue->array_size) { + i->in_queue->array_len++; + } + + assert(index < i->in_queue->array_size); frame = &i->in_queue->array[index]; @@ -468,7 +500,8 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i) stfu_frame_t *rframe = NULL; int found = 0; - if (!i->samples_per_packet || ((i->out_queue->wr_len == i->out_queue->array_len) || !i->out_queue->array_len)) { + if (!i->samples_per_packet || !i->out_queue->array_len) { + //|| ((i->out_queue->wr_len == i->out_queue->array_len) || !i->out_queue->array_len)) { return NULL; } @@ -481,7 +514,11 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i) if (i->cur_seq == 0) { i->cur_seq = i->out_queue->array[0].seq; } else { - i->cur_seq++; + i->cur_seq++; + /* if we bother using this for anything that doesn't have 16 bit seq, we'll make this a param */ + if (i->cur_seq == 65535) { + i->cur_seq = 0; + } } if (!(found = stfu_n_find_frame(i, i->out_queue, i->cur_ts, i->cur_seq, &rframe))) { @@ -496,7 +533,7 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i) i->cur_seq = rframe->seq; i->cur_ts = rframe->ts; } - i->sync--; + i->sync = 0; } @@ -546,7 +583,7 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i) #ifdef DB_JB if (found) { - printf("O: %u:%u %u\n", rframe->seq, rframe->seq, rframe->plc); + printf("O: %u:%u %u %d\n", rframe->seq, rframe->ts, rframe->plc, rframe->seq - i->last_seq); } else { printf("DATA: %u %u %d %s %d\n", i->packet_count, i->consecutive_good_count, i->out_queue->last_jitter, found ? "found" : "not found", i->qlen); } diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 3d56b6d..803059a 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -3153,19 +3153,19 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f if ((val = switch_channel_get_variable(tech_pvt->channel, "jitterbuffer_msec"))) { int len = atoi(val); - int maxlen = 50; + int maxlen = 0; char *p; if ((p = strchr(val, ':'))) { p++; - maxlen = atoi(val); + maxlen = atoi(p); } if (len < 20 || len > 10000) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Invalid Jitterbuffer spec [%d] must be between 20 and 10000\n", len); } else { - int qlen, maxqlen = 0; + int qlen, maxqlen = 50; qlen = len / (tech_pvt->read_impl.microseconds_per_packet / 1000); diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 772c250..b4f60fc 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1667,7 +1667,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t * if (rtp_session->jb) { stfu_n_resize(rtp_session->jb, queue_frames); } else { - rtp_session->jb = stfu_n_init(queue_frames, max_queue_frames || 50, samples_per_packet, samples_per_second); + rtp_session->jb = stfu_n_init(queue_frames, max_queue_frames ? max_queue_frames : 50, samples_per_packet, samples_per_second); } READ_DEC(rtp_session); commit d11c83b16e79f20d00082633d03c68fd0c6c0930 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Dec 13 18:28:43 2010 -0600 revert to the last transfered conference on recover diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 4cbb052..9b170a3 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -4366,6 +4366,8 @@ static switch_status_t conf_api_sub_transfer(conference_obj_t *conference, switc } } + switch_channel_set_variable(channel, "last_transfered_conference", argv[2]); + unlock_member(member); stream->write_function(stream, "OK Member '%d' sent to conference %s.\n", member->id, argv[2]); @@ -5374,6 +5376,14 @@ SWITCH_STANDARD_APP(conference_function) } #endif + if (switch_channel_test_flag(channel, CF_RECOVERED)) { + const char *check = switch_channel_get_variable(channel, "last_transfered_conference"); + + if (!zstr(check)) { + conf_name = (char *) check; + } + } + switch_event_create(¶ms, SWITCH_EVENT_COMMAND); switch_assert(params); switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "conf_name", conf_name); commit 7f8ba794c9d60d560968f8f61680d2fffd6c1b31 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Dec 13 18:17:11 2010 -0600 doh diff --git a/libs/stfu/stfu.c b/libs/stfu/stfu.c index c0d4a96..1271320 100644 --- a/libs/stfu/stfu.c +++ b/libs/stfu/stfu.c @@ -27,7 +27,7 @@ */ #include "stfu.h" -#define DB_JB 1 +//#define DB_JB 1 #ifdef _MSC_VER /* warning C4706: assignment within conditional expression*/ #pragma warning(disable: 4706) commit 0ca7930fa3270bd71e5781539afa7af8b9c975a4 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Dec 13 18:14:39 2010 -0600 small tweak to new plc code diff --git a/src/switch_core_io.c b/src/switch_core_io.c index a2df79d..c3113e9 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -325,13 +325,20 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi switch_thread_rwlock_unlock(session->bug_rwlock); } - status = switch_core_codec_decode(use_codec, - session->read_codec, - read_frame->data, - read_frame->datalen, - session->read_impl.actual_samples_per_second, - session->raw_read_frame.data, &session->raw_read_frame.datalen, &session->raw_read_frame.rate, - &read_frame->flags); + if (switch_test_flag(read_frame, SFF_PLC)) { + session->raw_read_frame.datalen = read_frame->codec->implementation->decoded_bytes_per_packet; + session->raw_read_frame.samples = session->raw_read_frame.datalen / sizeof(int16_t); + memset(session->raw_read_frame.data, 255, session->raw_read_frame.datalen); + status = SWITCH_STATUS_SUCCESS; + } else { + status = switch_core_codec_decode(use_codec, + session->read_codec, + read_frame->data, + read_frame->datalen, + session->read_impl.actual_samples_per_second, + session->raw_read_frame.data, &session->raw_read_frame.datalen, &session->raw_read_frame.rate, + &read_frame->flags); + } if (status == SWITCH_STATUS_SUCCESS) { if (switch_channel_test_flag(session->channel, CF_JITTERBUFFER) && !session->plc) { commit 2e51b571b08d6573936ee787088a72df64d37f65 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Dec 13 18:00:10 2010 -0600 update diff --git a/libs/stfu/stfu.c b/libs/stfu/stfu.c index fce968c..c0d4a96 100644 --- a/libs/stfu/stfu.c +++ b/libs/stfu/stfu.c @@ -27,7 +27,7 @@ */ #include "stfu.h" -//#define DB_JB 1 +#define DB_JB 1 #ifdef _MSC_VER /* warning C4706: assignment within conditional expression*/ #pragma warning(disable: 4706) @@ -305,11 +305,11 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t seq, uin } } - if (seq && seq == i->last_seq + 1) { + if ((seq && seq == i->last_seq + 1) || (i->last_seq > 65500 && seq == 0)) { good_seq = 1; } - if (ts && ts == i->last_rd_ts + i->samples_per_packet) { + if ((ts && ts == i->last_rd_ts + i->samples_per_packet) || (i->last_rd_ts > 4294900000 && ts < 5000)) { good_ts = 1; } @@ -450,7 +450,7 @@ static int stfu_n_find_frame(stfu_instance_t *in, stfu_queue_t *queue, uint32_t for(i = 0; i < queue->real_array_size; i++) { frame = &queue->array[i]; - if ((seq && frame->seq == seq) || frame->ts == ts) { + if (((seq || in->last_seq) && frame->seq == seq) || frame->ts == ts) { *r_frame = frame; queue->last_index = i; frame->was_read = 1; @@ -547,7 +547,6 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i) #ifdef DB_JB if (found) { printf("O: %u:%u %u\n", rframe->seq, rframe->seq, rframe->plc); - assert(found && rframe->seq); } else { printf("DATA: %u %u %d %s %d\n", i->packet_count, i->consecutive_good_count, i->out_queue->last_jitter, found ? "found" : "not found", i->qlen); } @@ -579,6 +578,7 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i) rframe = &i->out_queue->int_frame; rframe->dlen = i->plc_len; +#if 0 if (i->last_frame) { /* poor man's plc.. Copy the last frame, but we flag it so you can use a better one if you wish */ if (i->miss_count) { @@ -587,7 +587,7 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i) memcpy(rframe->data, i->last_frame->data, rframe->dlen); } } - +#endif rframe->ts = i->cur_ts; i->miss_count++; commit 28cab5ed46a140b70d92ea27214f445dfbd26467 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Dec 13 17:59:32 2010 -0600 FS-2923 diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index d8d18f3..710c0a7 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -1761,6 +1761,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_read(switch_core_session_t *session, switch_assert(session); + if (!digit_timeout) { + digit_timeout = timeout; + } + if (max_digits < min_digits) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Max digits %u is less than Min %u, forcing Max to %u\n", max_digits, min_digits, min_digits); commit cfeae1ba99b9c6a545a9c7608eca4b7ba1f22192 Author: Michael S Collins <msc@freeswitch.org> Date: Mon Dec 13 14:57:43 2010 -0800 Bump Doxygen.conf version to 1.0.6... belatedly diff --git a/docs/Doxygen.conf b/docs/Doxygen.conf index ccdb3b8..2c06417 100644 --- a/docs/Doxygen.conf +++ b/docs/Doxygen.conf @@ -31,7 +31,7 @@ PROJECT_NAME = FreeSWITCH # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 1.0.4 +PROJECT_NUMBER = 1.0.6 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. commit a2faee2023041cfc0cf41965b4a2447eb6d2c75a Author: Moises Silva <moy@sangoma.com> Date: Mon Dec 13 16:27:51 2010 -0500 freetdm: ftdm_r2 - fix stats diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 9d94c6d..9206493 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -665,7 +665,7 @@ static void ftdm_r2_on_call_read(openr2_chan_t *r2chan, const unsigned char *buf static void ftdm_r2_on_hardware_alarm(openr2_chan_t *r2chan, int alarm) { ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Alarm notification: %d\n", alarm); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Alarm notification: %d\n", alarm); } static void ftdm_r2_on_os_error(openr2_chan_t *r2chan, int errorcode) @@ -1955,7 +1955,7 @@ static FIO_API_FUNCTION(ftdm_r2_api) "Max DNIS: %d\n" "ANI First: %s\n" "Immediate Accept: %s\n" - "Job Thread: %lu\n" + "Job Thread: %u\n" "Job Max ms: %d\n" "Job Loops: %lu\n", openr2_proto_get_variant_string(r2variant), commit 321013efe74037a098e261bf805a426c27b75dbf Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Dec 13 14:01:53 2010 -0600 have mod_sofia always elect to be the session refresher so we know it will work, also make the session-expires set to 0 imply 100% disabled session timers diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 0e64d54..d4f8b1b 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -723,7 +723,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session) TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)), TAG_IF(cid, SIPTAG_HEADER_STR(cid)), NUTAG_SESSION_TIMER(session_timeout), - TAG_IF(session_timeout, NUTAG_SESSION_REFRESHER(nua_remote_refresher)), + NUTAG_SESSION_REFRESHER(session_timeout ? nua_local_refresher : nua_no_refresher), SIPTAG_CONTACT_STR(tech_pvt->reply_contact), SIPTAG_CALL_INFO_STR(switch_channel_get_variable(tech_pvt->channel, SOFIA_SIP_HEADER_PREFIX "call_info")), SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), @@ -739,7 +739,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session) TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)), TAG_IF(cid, SIPTAG_HEADER_STR(cid)), NUTAG_SESSION_TIMER(session_timeout), - TAG_IF(session_timeout, NUTAG_SESSION_REFRESHER(nua_remote_refresher)), + NUTAG_SESSION_REFRESHER(session_timeout ? nua_local_refresher : nua_no_refresher), SIPTAG_CONTACT_STR(tech_pvt->reply_contact), SIPTAG_CALL_INFO_STR(switch_channel_get_variable(tech_pvt->channel, SOFIA_SIP_HEADER_PREFIX "call_info")), SIPTAG_CONTENT_TYPE_STR("application/sdp"), diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 65aedd3..3d56b6d 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -2342,7 +2342,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) nua_invite(tech_pvt->nh, NUTAG_AUTOANSWER(0), NUTAG_SESSION_TIMER(session_timeout), - TAG_IF(session_timeout, NUTAG_SESSION_REFRESHER(nua_remote_refresher)), + NUTAG_SESSION_REFRESHER(session_timeout ? nua_local_refresher : nua_no_refresher), TAG_IF(sofia_test_flag(tech_pvt, TFLAG_RECOVERED), NUTAG_INVITE_TIMER(UINT_MAX)), TAG_IF(invite_full_from, SIPTAG_FROM_STR(invite_full_from)), TAG_IF(invite_full_to, SIPTAG_TO_STR(invite_full_to)), commit 84c7fa2fbc43fadd37f406dc7cd6f20db1221386 Author: Jeff Lenk <jeff@jefflenk.com> Date: Mon Dec 13 13:42:38 2010 -0600 my bad fix warning diff --git a/src/switch_apr.c b/src/switch_apr.c index 7a6bfc7..c0e51f9 100644 --- a/src/switch_apr.c +++ b/src/switch_apr.c @@ -732,7 +732,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_recv(switch_socket_t *sock, char * SWITCH_DECLARE(switch_status_t) switch_sockaddr_create(switch_sockaddr_t **sa, switch_memory_pool_t *pool) { switch_sockaddr_t *new_sa; - int family = APR_INET; + unsigned short family = APR_INET; new_sa = apr_pcalloc(pool, sizeof(apr_sockaddr_t)); switch_assert(new_sa); commit cb2d073632211b8459ca29aba4785c875bbfc8ec Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Dec 13 11:50:06 2010 -0600 FS-2924 diff --git a/src/switch_apr.c b/src/switch_apr.c index 7c027f8..7a6bfc7 100644 --- a/src/switch_apr.c +++ b/src/switch_apr.c @@ -732,11 +732,21 @@ SWITCH_DECLARE(switch_status_t) switch_socket_recv(switch_socket_t *sock, char * SWITCH_DECLARE(switch_status_t) switch_sockaddr_create(switch_sockaddr_t **sa, switch_memory_pool_t *pool) { switch_sockaddr_t *new_sa; + int family = APR_INET; new_sa = apr_pcalloc(pool, sizeof(apr_sockaddr_t)); switch_assert(new_sa); new_sa->pool = pool; memset(new_sa, 0, sizeof(new_sa)); + + new_sa->family = family; + new_sa->sa.sin.sin_family = family; + + new_sa->salen = sizeof(struct sockaddr_in); + new_sa->addr_str_len = 16; + new_sa->ipaddr_ptr = &(new_sa->sa.sin.sin_addr); + new_sa->ipaddr_len = sizeof(struct in_addr); + *sa = new_sa; return SWITCH_STATUS_SUCCESS; } commit dfecc914876b164ce64c53c4f048aa38ed65d9c5 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Dec 13 11:20:12 2010 -0600 remove check for va_list completely in sofia since i don't event think it happens ever diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index e34d7ae..591cd7f 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1717,16 +1717,9 @@ void launch_sofia_profile_thread(sofia_profile_t *profile) static void logger(void *logarg, char const *fmt, va_list ap) { - /* gcc 4.4 gets mad at us for testing if (ap) so let's try to work around it....*/ - void *ap_ptr = (void *) (intptr_t) ap; - if (!fmt) return; - if (ap_ptr) { - switch_log_vprintf(SWITCH_CHANNEL_LOG_CLEAN, mod_sofia_globals.tracelevel, fmt, ap); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, mod_sofia_globals.tracelevel, "%s", fmt); - } + switch_log_vprintf(SWITCH_CHANNEL_LOG_CLEAN, mod_sofia_globals.tracelevel, fmt, ap); } static su_log_t *sofia_get_logger(const char *name) commit 3a645dee60b50ee188cb3b0a34866c728003059e Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Dec 13 09:36:45 2010 -0600 FS-2913 diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 74f5d3d..65aedd3 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -5060,9 +5060,20 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName const char *port = switch_channel_get_variable(channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE); const char *r_ip = switch_channel_get_variable(channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE); const char *r_port = switch_channel_get_variable(channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE); + const char *use_uuid; sofia_set_flag(tech_pvt, TFLAG_RECOVERING); + if ((use_uuid = switch_channel_get_variable(channel, "origination_uuid"))) { + if (switch_core_session_set_uuid(session, use_uuid) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s set UUID=%s\n", switch_channel_get_name(channel), + use_uuid); + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "%s set UUID=%s FAILED\n", + switch_channel_get_name(channel), use_uuid); + } + } + if (!switch_channel_test_flag(channel, CF_PROXY_MODE) && ip && port) { const char *tmp; tech_pvt->iananame = tech_pvt->rm_encoding = (char *) switch_channel_get_variable(channel, "sip_use_codec_name"); commit 6d21b59fee891e343e963e2dd13018f005bbdffb Merge: a94bbfe ce25c91 Author: David Yat Sin <dyatsin@sangoma.com> Date: Mon Dec 13 12:00:59 2010 -0500 Merge branch 'master' into netborder Conflicts: libs/freetdm/src/testsangomaboost.c commit ce25c9186f38b75bcf9d4967210a8c07020cb0c4 Merge: 19c0026 f87a32c Author: David Yat Sin <dyatsin@sangoma.com> Date: Mon Dec 13 11:51:49 2010 -0500 Merge branch 'davidy.caller_id' commit b2a3bbff9bf470d4376680535150ee8cede158ff Author: Brian West <brian@freeswitch.org> Date: Mon Dec 13 10:30:00 2010 -0600 Fix samples for playback diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 3c8fa5e..d8d18f3 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -1573,10 +1573,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "done playing file\n"); if (read_impl.samples_per_second) { - switch_channel_set_variable_printf(channel, "playback_seconds", "%d", fh->samples_out / read_impl.samples_per_second); - switch_channel_set_variable_printf(channel, "playback_ms", "%d", fh->samples_out / (read_impl.samples_per_second / 1000)); + switch_channel_set_variable_printf(channel, "playback_seconds", "%d", fh->samples_in / read_impl.samples_per_second); + switch_channel_set_variable_printf(channel, "playback_ms", "%d", fh->samples_in / (read_impl.samples_per_second / 1000)); } - switch_channel_set_variable_printf(channel, "playback_samples", "%d", fh->samples_out); + switch_channel_set_variable_printf(channel, "playback_samples", "%d", fh->samples_in); switch_core_session_io_write_lock(session); switch_channel_set_private(channel, "__fh", NULL); commit f87a32c66a059474f160a9055e7d582c424c152b Author: David Yat Sin <dyatsin@sangoma.com> Date: Mon Dec 13 11:29:38 2010 -0500 removed unnecessary initialization diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 78ae3d2..8dd0a2d 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -5478,7 +5478,6 @@ static void ftdm_cpu_monitor_stop(void) FT_DECLARE(ftdm_status_t) ftdm_global_init(void) { - int i; memset(&globals, 0, sizeof(globals)); time_init(); @@ -5504,9 +5503,7 @@ FT_DECLARE(ftdm_status_t) ftdm_global_init(void) ftdm_log(FTDM_LOG_CRIT, "Failed to run master timing schedule context\n"); return FTDM_FAIL; } - for(i=0;i<MAX_CALLIDS;i++) { - globals.call_ids[i] = NULL; - } + globals.running = 1; return FTDM_SUCCESS; } commit 19c0026581f8bffc7fed0b97e31c7067475e7a65 Merge: ff07022 e8792d0 Author: Moises Silva <moy@sangoma.com> Date: Sun Dec 12 19:32:36 2010 -0500 Merge remote branch 'fsorig/master' commit e8792d0ad3742f5babdde4e1ec62cf97cc5deb66 Author: Brian West <brian@freeswitch.org> Date: Sun Dec 12 08:11:11 2010 -0600 swig all diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index a65d82d..1d3c5d6 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -28993,15 +28993,33 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_activate_rtcp(void * jarg1, int jar } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_activate_jitter_buffer(void * jarg1, unsigned long jarg2) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_activate_jitter_buffer(void * jarg1, unsigned long jarg2, unsigned long jarg3, unsigned long jarg4, unsigned long jarg5) { int jresult ; switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; uint32_t arg2 ; + uint32_t arg3 ; + uint32_t arg4 ; + uint32_t arg5 ; switch_status_t result; arg1 = (switch_rtp_t *)jarg1; arg2 = (uint32_t)jarg2; - result = (switch_status_t)switch_rtp_activate_jitter_buffer(arg1,arg2); + arg3 = (uint32_t)jarg3; + arg4 = (uint32_t)jarg4; + arg5 = (uint32_t)jarg5; + result = (switch_status_t)switch_rtp_activate_jitter_buffer(arg1,arg2,arg3,arg4,arg5); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_deactivate_jitter_buffer(void * jarg1) { + int jresult ; + switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; + switch_status_t result; + + arg1 = (switch_rtp_t *)jarg1; + result = (switch_status_t)switch_rtp_deactivate_jitter_buffer(arg1); jresult = result; return jresult; } diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index e024c58..9decf74 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -4630,8 +4630,13 @@ public class freeswitch { return ret; } - public static switch_status_t switch_rtp_activate_jitter_buffer(SWIGTYPE_p_switch_rtp rtp_session, uint queue_frames) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_activate_jitter_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), queue_frames); + public static switch_status_t switch_rtp_activate_jitter_buffer(SWIGTYPE_p_switch_rtp rtp_session, uint queue_frames, uint max_queue_frames, uint samples_per_packet, uint samples_per_second) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_activate_jitter_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), queue_frames, max_queue_frames, samples_per_packet, samples_per_second); + return ret; + } + + public static switch_status_t switch_rtp_deactivate_jitter_buffer(SWIGTYPE_p_switch_rtp rtp_session) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_deactivate_jitter_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session)); return ret; } @@ -12434,7 +12439,10 @@ class freeswitchPINVOKE { public static extern int switch_rtp_activate_rtcp(HandleRef jarg1, int jarg2, ushort jarg3); [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_activate_jitter_buffer")] - public static extern int switch_rtp_activate_jitter_buffer(HandleRef jarg1, uint jarg2); + public static extern int switch_rtp_activate_jitter_buffer(HandleRef jarg1, uint jarg2, uint jarg3, uint jarg4, uint jarg5); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_deactivate_jitter_buffer")] + public static extern int switch_rtp_deactivate_jitter_buffer(HandleRef jarg1); [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_flag")] public static extern void switch_rtp_set_flag(HandleRef jarg1, uint jarg2); @@ -21500,6 +21508,7 @@ public enum switch_channel_flag_t { CF_PASSTHRU_PTIME_MISMATCH, CF_BRIDGE_NOWRITE, CF_RECOVERED, + CF_JITTERBUFFER, CF_FLAG_MAX } @@ -23167,6 +23176,7 @@ public enum switch_core_session_message_types_t { SWITCH_MESSAGE_INDICATE_T38_DESCRIPTION, SWITCH_MESSAGE_INDICATE_UDPTL_MODE, SWITCH_MESSAGE_INDICATE_CLEAR_PROGRESS, + SWITCH_MESSAGE_INDICATE_JITTER_BUFFER, SWITCH_MESSAGE_INVALID } diff --git a/src/mod/languages/mod_perl/mod_perl_wrap.cpp b/src/mod/languages/mod_perl/mod_perl_wrap.cpp index 2efbdf1..370c88b 100644 --- a/src/mod/languages/mod_perl/mod_perl_wrap.cpp +++ b/src/mod/languages/mod_perl/mod_perl_wrap.cpp @@ -9732,17 +9732,17 @@ XS(SWIG_init) { SWIG_TypeClientData(SWIGTYPE_p_IVRMenu, (void*) "freeswitch::IVRMenu"); SWIG_TypeClientData(SWIGTYPE_p_API, (void*) "freeswitch::API"); SWIG_TypeClientData(SWIGTYPE_p_input_callback_state, (void*) "freeswitch::input_callback_state_t"); - /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_HUP", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_HUP))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; - /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_FREE", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_FREE))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; - /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_RDLOCK", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_RDLOCK))); SvREADONLY_on(sv); commit 2f0105d0506a0101f546c8f27c4cb0d1a766ee5d Author: Jeff Lenk <jeff@jefflenk.com> Date: Sat Dec 11 16:53:52 2010 -0600 FS-2921 Fix typo in STFU library diff --git a/libs/stfu/stfu.c b/libs/stfu/stfu.c index 6015207..fce968c 100644 --- a/libs/stfu/stfu.c +++ b/libs/stfu/stfu.c @@ -219,7 +219,7 @@ stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_qlen, uint32_t samples_ static void stfu_n_reset_counters(stfu_instance_t *i) { #ifdef DB_JB - printf("COUNER RESET........\n"); + printf("COUNTER RESET........\n"); #endif if (i->callback) { commit 7b59313902498fa061bbb6b096ddd9fb3094774e Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Sat Dec 11 13:20:35 2010 -0600 skypopen: added a proof of concept standalone OSS audio driver (for Skype-oss clients) diff --git a/src/mod/endpoints/mod_skypopen/oss/scull.init b/src/mod/endpoints/mod_skypopen/oss/scull.init deleted file mode 100644 index e0523ce..0000000 --- a/src/mod/endpoints/mod_skypopen/oss/scull.init +++ /dev/null @@ -1,142 +0,0 @@ -#!/bin/bash -# Sample init script for the a driver module <rubini@linux.it> - -DEVICE="scull" -SECTION="misc" - -# The list of filenames and minor numbers: $PREFIX is prefixed to all names -PREFIX="scull" -FILES=" 0 0 1 1 2 2 3 3 priv 16 - pipe0 32 pipe1 33 pipe2 34 pipe3 35 - single 48 uid 64 wuid 80" - -INSMOD=/sbin/insmod; # use /sbin/modprobe if you prefer - -function device_specific_post_load () { - true; # fill at will -} -function device_specific_pre_unload () { - true; # fill at will -} - -# Everything below this line should work unchanged for any char device. -# Obviously, however, no options on the command line: either in -# /etc/${DEVICE}.conf or /etc/modules.conf (if modprobe is used) - -# Optional configuration file: format is -# owner <ownername> -# group <groupname> -# mode <modename> -# options <insmod options> -CFG=/etc/${DEVICE}.conf - -# kernel version, used to look for modules -KERNEL=`uname -r` - -#FIXME: it looks like there is no misc section. Where should it be? -MODDIR="/lib/modules/${KERNEL}/kernel/drivers/${SECTION}" -if [ ! -d $MODDIR ]; then MODDIR="/lib/modules/${KERNEL}/${SECTION}"; fi - -# Root or die -if [ "$(id -u)" != "0" ] -then - echo "You must be root to load or unload kernel modules" - exit 1 -fi - -# Read configuration file -if [ -r $CFG ]; then - OWNER=`awk "\\$1==\"owner\" {print \\$2}" $CFG` - GROUP=`awk "\\$1==\"group\" {print \\$2}" $CFG` - MODE=`awk "\\$1==\"mode\" {print \\$2}" $CFG` - # The options string may include extra blanks or only blanks - OPTIONS=`sed -n '/^options / s/options //p' $CFG` -fi - - -# Create device files -function create_files () { - cd /dev - local devlist="" - local file - while true; do - if [ $# -lt 2 ]; then break; fi - file="${DEVICE}$1" - mknod $file c $MAJOR $2 - devlist="$devlist $file" - shift 2 - done - if [ -n "$OWNER" ]; then chown $OWNER $devlist; fi - if [ -n "$GROUP" ]; then chgrp $GROUP $devlist; fi - if [ -n "$MODE" ]; then chmod $MODE $devlist; fi -} - -# Remove device files -function remove_files () { - cd /dev - local devlist="" - local file - while true; do - if [ $# -lt 2 ]; then break; fi - file="${DEVICE}$1" - devlist="$devlist $file" - shift 2 - done - rm -f $devlist -} - -# Load and create files -function load_device () { - - if [ -f $MODDIR/$DEVICE.o ]; then - devpath=$MODDIR/$DEVICE.o - else if [ -f ./$DEVICE.o ]; then - devpath=./$DEVICE.o - else - devpath=$DEVICE; # let insmod/modprobe guess - fi; fi - if [ "$devpath" != "$DEVICE" ]; then - echo -n " (loading file $devpath)" - fi - - if $INSMOD $devpath $OPTIONS; then - MAJOR=`awk "\\$2==\"$DEVICE\" {print \\$1}" /proc/devices` - remove_files $FILES - create_files $FILES - device_specific_post_load - else - echo " FAILED!" - fi -} - -# Unload and remove files -function unload_device () { - device_specific_pre_unload - /sbin/rmmod $DEVICE - remove_files $FILES -} - - -case "$1" in - start) - echo -n "Loading $DEVICE" - load_device - echo "." - ;; - stop) - echo -n "Unloading $DEVICE" - unload_device - echo "." - ;; - force-reload|restart) - echo -n "Reloading $DEVICE" - unload_device - load_device - echo "." - ;; - *) - echo "Usage: $0 {start|stop|restart|force-reload}" - exit 1 -esac - -exit 0 commit 577d7b5538f3ce2017092cfec54532a10d3382b9 Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Sat Dec 11 13:19:49 2010 -0600 skypopen: added a proof of concept standalone OSS audio driver (for Skype-oss clients) diff --git a/src/mod/endpoints/mod_skypopen/oss/Makefile b/src/mod/endpoints/mod_skypopen/oss/Makefile new file mode 100644 index 0000000..91cc61b --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/oss/Makefile @@ -0,0 +1,43 @@ +# Comment/uncomment the following line to disable/enable debugging +#DEBUG = y +LDDINC=/usr/src/linux-headers-2.6.32-26-server/include + +# Add your debugging flag (or not) to CFLAGS +ifeq ($(DEBUG),y) + DEBFLAGS = -O -g -DSCULL_DEBUG # "-O" is needed to expand inlines +else + DEBFLAGS = -O2 -Wall +endif + +EXTRA_CFLAGS += $(DEBFLAGS) +EXTRA_CFLAGS += -I$(LDDINC) + +ifneq ($(KERNELRELEASE),) +# call from kernel build system + +scull-objs := main.o + +obj-m := scull.o + +else + +KERNELDIR ?= /lib/modules/$(shell uname -r)/build +PWD := $(shell pwd) + +modules: + $(MAKE) -C $(KERNELDIR) M=$(PWD) LDDINC=$(PWD)/../include modules + +endif + + + +clean: + rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions + +depend .depend dep: + $(CC) $(EXTRA_CFLAGS) -M *.c > .depend + + +ifeq (.depend,$(wildcard .depend)) +include .depend +endif diff --git a/src/mod/endpoints/mod_skypopen/oss/main.c b/src/mod/endpoints/mod_skypopen/oss/main.c new file mode 100644 index 0000000..4d36ac0 --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/oss/main.c @@ -0,0 +1,335 @@ +/* + * main.c -- the bare scull char module + * + * Copyright (C) 2010 Giovanni Maruzzelli + * Copyright (C) 2001 Alessandro Rubini and Jonathan Corbet + * Copyright (C) 2001 O'Reilly & Associates + * + * The source code in this file can be freely used, adapted, + * and redistributed in source or binary form, so long as an + * acknowledgment appears in derived source files. The citation + * should list that the code comes from the book "Linux Device + * Drivers" by Alessandro Rubini and Jonathan Corbet, published + * by O'Reilly & Associates. No warranty is attached; + * we cannot take responsibility for errors or fitness for use. + * + */ + +#include <linux/module.h> +#include <linux/moduleparam.h> +#include <linux/init.h> + +#include <linux/kernel.h> /* printk() */ +#include <linux/slab.h> /* kmalloc() */ +#include <linux/fs.h> /* everything... */ +#include <linux/errno.h> /* error codes */ +#include <linux/types.h> /* size_t */ +#include <linux/proc_fs.h> +#include <linux/fcntl.h> /* O_ACCMODE */ +#include <linux/seq_file.h> +#include <linux/cdev.h> + +#include <asm/system.h> /* cli(), *_flags */ +#include <asm/uaccess.h> /* copy_*_user */ + +#include <linux/soundcard.h> +#include <linux/delay.h> +#include <linux/hrtimer.h> +#include <linux/sched.h> +#include <linux/time.h> +#include <linux/jiffies.h> +#include <linux/hrtimer.h> +#include <linux/ktime.h> + +#include "scull.h" /* local definitions */ + +/* + * Our parameters which can be set at load time. + */ + +int scull_major = SCULL_MAJOR; +int scull_minor = 3; +int scull_nr_devs = SCULL_NR_DEVS; /* number of bare scull devices */ + +module_param(scull_major, int, S_IRUGO); +module_param(scull_minor, int, S_IRUGO); +module_param(scull_nr_devs, int, S_IRUGO); + +MODULE_AUTHOR("Original: Alessandro Rubini, Jonathan Corbet. Heavy modified by: Giovanni Maruzzelli"); +MODULE_LICENSE("Dual BSD/GPL"); + +static struct scull_dev *scull_devices; /* allocated in scull_init_module */ + +#define GIOVA_BLK 3840 +#define GIOVA_SLEEP 40000 + +void my_timer_callback_inq( unsigned long data ) +{ + struct scull_dev *dev = (void *)data; + + wake_up_interruptible(&dev->inq); + mod_timer( &dev->timer_inq, jiffies + msecs_to_jiffies(GIOVA_SLEEP/1000) ); + +} + +void my_timer_callback_outq( unsigned long data ) +{ + struct scull_dev *dev = (void *)data; + + wake_up_interruptible(&dev->outq); + mod_timer( &dev->timer_outq, jiffies + msecs_to_jiffies(GIOVA_SLEEP/1000) ); +} + +/* The clone-specific data structure includes a key field */ + +struct scull_listitem { + struct scull_dev device; + dev_t key; + struct list_head list; + +}; + +/* The list of devices, and a lock to protect it */ +static LIST_HEAD(scull_c_list); +static spinlock_t scull_c_lock = SPIN_LOCK_UNLOCKED; + +/* Look for a device or create one if missing */ +static struct scull_dev *scull_c_lookfor_device(dev_t key) +{ + struct scull_listitem *lptr; + + list_for_each_entry(lptr, &scull_c_list, list) { + if (lptr->key == key) + return &(lptr->device); + } + + /* not found */ + lptr = kmalloc(sizeof(struct scull_listitem), GFP_KERNEL); + if (!lptr) + return NULL; + + /* initialize the device */ + memset(lptr, 0, sizeof(struct scull_listitem)); + lptr->key = key; + + init_waitqueue_head(&lptr->device.inq); + init_waitqueue_head(&lptr->device.outq); + printk(" Timer installing\n"); + setup_timer( &lptr->device.timer_inq, my_timer_callback_inq, (long int)lptr ); + setup_timer( &lptr->device.timer_outq, my_timer_callback_outq, (long int)lptr ); + printk( "Starting timer to fire in %dms (%ld)\n", GIOVA_SLEEP/1000, jiffies ); + mod_timer( &lptr->device.timer_inq, jiffies + msecs_to_jiffies(GIOVA_SLEEP/1000) ); + mod_timer( &lptr->device.timer_outq, jiffies + msecs_to_jiffies(GIOVA_SLEEP/1000) ); + /* place it in the list */ + list_add(&lptr->list, &scull_c_list); + + return &(lptr->device); +} +static int scull_c_open(struct inode *inode, struct file *filp) +{ + struct scull_dev *dev; + dev_t key; + + if (!current->pid) { + printk("Process \"%s\" has no pid\n", current->comm); + return -EINVAL; + } + key = current->pid; + + /* look for a scullc device in the list */ + spin_lock(&scull_c_lock); + dev = scull_c_lookfor_device(key); + spin_unlock(&scull_c_lock); + + if (!dev) + return -ENOMEM; + + /* then, everything else is copied from the bare scull device */ + filp->private_data = dev; + return 0; /* success */ +} + +static int scull_c_release(struct inode *inode, struct file *filp) +{ + /* + * Nothing to do, because the device is persistent. + * A `real' cloned device should be freed on last close + */ + return 0; +} + + + +/*************************************************************/ +/* + * Open and close + */ + +ssize_t scull_read(struct file *filp, char __user *buf, size_t count, + loff_t *f_pos) +{ + struct scull_dev *dev = filp->private_data; + + DEFINE_WAIT(wait); + prepare_to_wait(&dev->inq, &wait, TASK_INTERRUPTIBLE); + schedule(); + finish_wait(&dev->inq, &wait); + return count; + +} + +ssize_t scull_write(struct file *filp, const char __user *buf, size_t count, + loff_t *f_pos) +{ + struct scull_dev *dev = filp->private_data; + DEFINE_WAIT(wait); + prepare_to_wait(&dev->outq, &wait, TASK_INTERRUPTIBLE); + schedule(); + finish_wait(&dev->outq, &wait); + + return count; + +} +/* + * The ioctl() implementation + */ + +int scull_ioctl(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + void __user *argp = (void __user *)arg; + int __user *p = argp; + + switch (cmd) { + case OSS_GETVERSION: + return put_user(SOUND_VERSION, p); + case SNDCTL_DSP_GETBLKSIZE: + return put_user(GIOVA_BLK, p); + case SNDCTL_DSP_GETFMTS: + return put_user(28731, p); + + default: + return 0; + } + +} + +struct file_operations scull_fops = { + .owner = THIS_MODULE, + .llseek = no_llseek, + .read = scull_read, + .write = scull_write, + .ioctl = scull_ioctl, + .open = scull_c_open, + .release = scull_c_release, +}; + +/* + * Finally, the module stuff + */ + +/* + * The cleanup function is used to handle initialization failures as well. + * Thefore, it must be careful to work correctly even if some of the items + * have not been initialized + */ + +void scull_cleanup_module(void) +{ + int i; + int ret; + struct scull_listitem *lptr, *next; + dev_t devno = MKDEV(scull_major, scull_minor); + + /* Get rid of our char dev entries */ + if (scull_devices) { + for (i = 0; i < scull_nr_devs; i++) { + cdev_del(&scull_devices[i].cdev); + } + kfree(scull_devices); + } + + + /* And all the cloned devices */ + list_for_each_entry_safe(lptr, next, &scull_c_list, list) { + ret= del_timer( &lptr->device.timer_inq ); + if (ret) printk("The inq timer was still in use...\n"); + ret= del_timer( &lptr->device.timer_outq ); + if (ret) printk("The outq timer was still in use...\n"); + list_del(&lptr->list); + kfree(lptr); + } + printk("Timer uninstalling\n"); + /* cleanup_module is never called if registering failed */ + unregister_chrdev_region(devno, scull_nr_devs); + +} + + +/* + * Set up the char_dev structure for this device. + */ +static void scull_setup_cdev(struct scull_dev *dev, int index) +{ + int err, devno = MKDEV(scull_major, scull_minor + index); + + cdev_init(&dev->cdev, &scull_fops); + dev->cdev.owner = THIS_MODULE; + dev->cdev.ops = &scull_fops; + err = cdev_add (&dev->cdev, devno, 1); + /* Fail gracefully if need be */ + if (err) + printk(KERN_NOTICE "Error %d adding scull%d", err, index); +} + + + +int scull_init_module(void) +{ + int result, i; + dev_t dev = 0; + + /* + * Get a range of minor numbers to work with, asking for a dynamic + * major unless directed otherwise at load time. + */ + if (scull_major) { + dev = MKDEV(scull_major, scull_minor); + result = register_chrdev_region(dev, scull_nr_devs, "dsp"); + } else { + result = alloc_chrdev_region(&dev, scull_minor, scull_nr_devs, + "dsp"); + scull_major = MAJOR(dev); + } + if (result < 0) { + printk(KERN_WARNING "scull: can't get major %d\n", scull_major); + return result; + } + + /* + * allocate the devices -- we can't have them static, as the number + * can be specified at load time + */ + scull_devices = kmalloc(scull_nr_devs * sizeof(struct scull_dev), GFP_KERNEL); + if (!scull_devices) { + result = -ENOMEM; + goto fail; /* Make this more graceful */ + } + memset(scull_devices, 0, scull_nr_devs * sizeof(struct scull_dev)); + + /* Initialize each device. */ + for (i = 0; i < scull_nr_devs; i++) { + scull_setup_cdev(&scull_devices[i], i); + } + + /* At this point call the init function for any friend device */ + dev = MKDEV(scull_major, scull_minor + scull_nr_devs); + return 0; /* succeed */ + +fail: + scull_cleanup_module(); + return result; +} + +module_init(scull_init_module); +module_exit(scull_cleanup_module); diff --git a/src/mod/endpoints/mod_skypopen/oss/scull.h b/src/mod/endpoints/mod_skypopen/oss/scull.h new file mode 100644 index 0000000..e86281b --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/oss/scull.h @@ -0,0 +1,64 @@ +/* + * scull.h -- definitions for the char module + * + * Copyright (C) 2001 Alessandro Rubini and Jonathan Corbet + * Copyright (C) 2001 O'Reilly & Associates + * + * The source code in this file can be freely used, adapted, + * and redistributed in source or binary form, so long as an + * acknowledgment appears in derived source files. The citation + * should list that the code comes from the book "Linux Device + * Drivers" by Alessandro Rubini and Jonathan Corbet, published + * by O'Reilly & Associates. No warranty is attached; + * we cannot take responsibility for errors or fitness for use. + * + * $Id: scull.h,v 1.15 2004/11/04 17:51:18 rubini Exp $ + */ + +#ifndef _SCULL_H_ +#define _SCULL_H_ + +#include <linux/ioctl.h> /* needed for the _IOW etc stuff used later */ + +#ifndef SCULL_MAJOR +#define SCULL_MAJOR 14 /* dynamic major by default */ +#endif + +#ifndef SCULL_NR_DEVS +#define SCULL_NR_DEVS 1 /* scull0 through scull3 */ +#endif + +struct scull_dev { + struct cdev cdev; /* Char device structure */ + wait_queue_head_t inq; /* read and write queues */ + wait_queue_head_t outq; /* read and write queues */ + struct timer_list timer_inq; + struct timer_list timer_outq; + //unsigned long read_howmany; + //unsigned long write_howmany; + //unsigned long read_sleeped_acc; + //unsigned long write_sleeped_acc; + //double read_delay; /* how much delay last time */ + //double write_delay; /* how much delay last time */ +}; + + +/* + * The different configurable parameters + */ +extern int scull_major; /* main.c */ +extern int scull_nr_devs; + + +/* + * Prototypes for shared functions + */ + +ssize_t scull_read(struct file *filp, char __user *buf, size_t count, + loff_t *f_pos); +ssize_t scull_write(struct file *filp, const char __user *buf, size_t count, + loff_t *f_pos); +int scull_ioctl(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); + +#endif /* _SCULL_H_ */ diff --git a/src/mod/endpoints/mod_skypopen/oss/scull.init b/src/mod/endpoints/mod_skypopen/oss/scull.init new file mode 100644 index 0000000..e0523ce --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/oss/scull.init @@ -0,0 +1,142 @@ +#!/bin/bash +# Sample init script for the a driver module <rubini@linux.it> + +DEVICE="scull" +SECTION="misc" + +# The list of filenames and minor numbers: $PREFIX is prefixed to all names +PREFIX="scull" +FILES=" 0 0 1 1 2 2 3 3 priv 16 + pipe0 32 pipe1 33 pipe2 34 pipe3 35 + single 48 uid 64 wuid 80" + +INSMOD=/sbin/insmod; # use /sbin/modprobe if you prefer + +function device_specific_post_load () { + true; # fill at will +} +function device_specific_pre_unload () { + true; # fill at will +} + +# Everything below this line should work unchanged for any char device. +# Obviously, however, no options on the command line: either in +# /etc/${DEVICE}.conf or /etc/modules.conf (if modprobe is used) + +# Optional configuration file: format is +# owner <ownername> +# group <groupname> +# mode <modename> +# options <insmod options> +CFG=/etc/${DEVICE}.conf + +# kernel version, used to look for modules +KERNEL=`uname -r` + +#FIXME: it looks like there is no misc section. Where should it be? +MODDIR="/lib/modules/${KERNEL}/kernel/drivers/${SECTION}" +if [ ! -d $MODDIR ]; then MODDIR="/lib/modules/${KERNEL}/${SECTION}"; fi + +# Root or die +if [ "$(id -u)" != "0" ] +then + echo "You must be root to load or unload kernel modules" + exit 1 +fi + +# Read configuration file +if [ -r $CFG ]; then + OWNER=`awk "\\$1==\"owner\" {print \\$2}" $CFG` + GROUP=`awk "\\$1==\"group\" {print \\$2}" $CFG` + MODE=`awk "\\$1==\"mode\" {print \\$2}" $CFG` + # The options string may include extra blanks or only blanks + OPTIONS=`sed -n '/^options / s/options //p' $CFG` +fi + + +# Create device files +function create_files () { + cd /dev + local devlist="" + local file + while true; do + if [ $# -lt 2 ]; then break; fi + file="${DEVICE}$1" + mknod $file c $MAJOR $2 + devlist="$devlist $file" + shift 2 + done + if [ -n "$OWNER" ]; then chown $OWNER $devlist; fi + if [ -n "$GROUP" ]; then chgrp $GROUP $devlist; fi + if [ -n "$MODE" ]; then chmod $MODE $devlist; fi +} + +# Remove device files +function remove_files () { + cd /dev + local devlist="" + local file + while true; do + if [ $# -lt 2 ]; then break; fi + file="${DEVICE}$1" + devlist="$devlist $file" + shift 2 + done + rm -f $devlist +} + +# Load and create files +function load_device () { + + if [ -f $MODDIR/$DEVICE.o ]; then + devpath=$MODDIR/$DEVICE.o + else if [ -f ./$DEVICE.o ]; then + devpath=./$DEVICE.o + else + devpath=$DEVICE; # let insmod/modprobe guess + fi; fi + if [ "$devpath" != "$DEVICE" ]; then + echo -n " (loading file $devpath)" + fi + + if $INSMOD $devpath $OPTIONS; then + MAJOR=`awk "\\$2==\"$DEVICE\" {print \\$1}" /proc/devices` + remove_files $FILES + create_files $FILES + device_specific_post_load + else + echo " FAILED!" + fi +} + +# Unload and remove files +function unload_device () { + device_specific_pre_unload + /sbin/rmmod $DEVICE + remove_files $FILES +} + + +case "$1" in + start) + echo -n "Loading $DEVICE" + load_device + echo "." + ;; + stop) + echo -n "Unloading $DEVICE" + unload_device + echo "." + ;; + force-reload|restart) + echo -n "Reloading $DEVICE" + unload_device + load_device + echo "." + ;; + *) + echo "Usage: $0 {start|stop|restart|force-reload}" + exit 1 +esac + +exit 0 commit 009c41d460f1356c67240ff5ead72376f532a709 Author: Anthony Minessale <anthm@freeswitch.org> Date: Sat Dec 11 11:41:19 2010 -0600 add new function to init an empty switch_sockaddr_t to avoid an unnecessary dns lookup on 0.0.0.0 diff --git a/src/include/switch_apr.h b/src/include/switch_apr.h index dc81d1a..d89a13b 100644 --- a/src/include/switch_apr.h +++ b/src/include/switch_apr.h @@ -1110,6 +1110,8 @@ SWITCH_DECLARE(int) switch_sockaddr_equal(const switch_sockaddr_t *sa1, const sw SWITCH_DECLARE(switch_status_t) switch_sockaddr_info_get(switch_sockaddr_t ** sa, const char *hostname, int32_t family, switch_port_t port, int32_t flags, switch_memory_pool_t *pool); +SWITCH_DECLARE(switch_status_t) switch_sockaddr_create(switch_sockaddr_t **sa, switch_memory_pool_t *pool); + /** * Send data over a network. * @param sock The socket to send the data over. diff --git a/src/switch_apr.c b/src/switch_apr.c index dccc37b..7c027f8 100644 --- a/src/switch_apr.c +++ b/src/switch_apr.c @@ -729,6 +729,18 @@ SWITCH_DECLARE(switch_status_t) switch_socket_recv(switch_socket_t *sock, char * return apr_socket_recv(sock, buf, len); } +SWITCH_DECLARE(switch_status_t) switch_sockaddr_create(switch_sockaddr_t **sa, switch_memory_pool_t *pool) +{ + switch_sockaddr_t *new_sa; + + new_sa = apr_pcalloc(pool, sizeof(apr_sockaddr_t)); + switch_assert(new_sa); + new_sa->pool = pool; + memset(new_sa, 0, sizeof(new_sa)); + *sa = new_sa; + return SWITCH_STATUS_SUCCESS; +} + SWITCH_DECLARE(switch_status_t) switch_sockaddr_info_get(switch_sockaddr_t ** sa, const char *hostname, int32_t family, switch_port_t port, int32_t flags, switch_memory_pool_t *pool) { diff --git a/src/switch_rtp.c b/src/switch_rtp.c index aba14b2..772c250 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1367,9 +1367,10 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session switch_rtp_set_flag(rtp_session, flags); /* for from address on recvfrom calls */ - switch_sockaddr_info_get(&rtp_session->from_addr, NULL, SWITCH_UNSPEC, 0, 0, pool); + switch_sockaddr_create(&rtp_session->from_addr, pool); + if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_ENABLE_RTCP)) { - switch_sockaddr_info_get(&rtp_session->rtcp_from_addr, NULL, SWITCH_UNSPEC, 0, 0, pool); + switch_sockaddr_create(&rtp_session->rtcp_from_addr, pool); } rtp_session->seq = (uint16_t) rand(); rtp_session->ssrc = (uint32_t) ((intptr_t) rtp_session + (uint32_t) switch_epoch_time_now(NULL)); commit ee5d1c4dcf134a78756c74e2c3a91172f48bc240 Author: Anthony Minessale <anthm@freeswitch.org> Date: Sat Dec 11 10:41:34 2010 -0600 missed a spot diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 2567d17..c276617 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -1118,6 +1118,11 @@ SWITCH_DECLARE(void) switch_core_session_perform_destroy(switch_core_session_t * } switch_mutex_unlock(runtime.session_hash_mutex); + if ((*session)->plc) { + plc_free((*session)->plc); + (*session)->plc = NULL; + } + if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_DESTROY) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data((*session)->channel, event); switch_event_fire(&event); commit 349e9d5913f953ec6a40b24b9ea4866cfd2eef43 Author: Jeff Lenk <jeff@jefflenk.com> Date: Fri Dec 10 23:07:15 2010 -0600 fix accidental removal diff --git a/libs/freetdm/src/testsangomaboost.c b/libs/freetdm/src/testsangomaboost.c index ed2a7bd..b254a08 100644 --- a/libs/freetdm/src/testsangomaboost.c +++ b/libs/freetdm/src/testsangomaboost.c @@ -53,6 +53,7 @@ #endif #ifndef WIN32 #include <unistd.h> +#endif #include "freetdm.h" commit dc5b964bb12b0a019f3f58fe7cc67ac3976b6d80 Author: Jeff Lenk <jeff@jefflenk.com> Date: Fri Dec 10 21:43:03 2010 -0600 fix build on windows for last commit diff --git a/Freeswitch.2008.sln b/Freeswitch.2008.sln index 01a4cf4..e171ffe 100644 --- a/Freeswitch.2008.sln +++ b/Freeswitch.2008.sln @@ -381,6 +381,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeSwitchCoreLib", "w32\Li ProjectSection(ProjectDependencies) = postProject {8D04B550-D240-4A44-8A18-35DA3F7038D9} = {8D04B550-D240-4A44-8A18-35DA3F7038D9} {89385C74-5860-4174-9CAF-A39E7C48909C} = {89385C74-5860-4174-9CAF-A39E7C48909C} + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} = {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5} {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} {03207781-0D1C-4DB3-A71D-45C608F28DBD} = {03207781-0D1C-4DB3-A71D-45C608F28DBD} {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} diff --git a/libs/stfu/stfu.c b/libs/stfu/stfu.c index 66b165b..6015207 100644 --- a/libs/stfu/stfu.c +++ b/libs/stfu/stfu.c @@ -506,7 +506,7 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i) stfu_frame_t *frame = NULL; #endif int32_t delay = i->last_rd_ts - i->cur_ts; - int32_t need = abs(i->last_rd_ts - i->cur_ts) / i->samples_per_packet; + uint32_t need = abs(i->last_rd_ts - i->cur_ts) / i->samples_per_packet; i->period_missing_count++; diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx index 8033a8f..1ad1b16 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx @@ -28290,15 +28290,33 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_activate_rtcp(void * jarg1, int jar } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_activate_jitter_buffer(void * jarg1, unsigned long jarg2) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_activate_jitter_buffer(void * jarg1, unsigned long jarg2, unsigned long jarg3, unsigned long jarg4, unsigned long jarg5) { int jresult ; switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; uint32_t arg2 ; + uint32_t arg3 ; + uint32_t arg4 ; + uint32_t arg5 ; switch_status_t result; arg1 = (switch_rtp_t *)jarg1; arg2 = (uint32_t)jarg2; - result = (switch_status_t)switch_rtp_activate_jitter_buffer(arg1,arg2); + arg3 = (uint32_t)jarg3; + arg4 = (uint32_t)jarg4; + arg5 = (uint32_t)jarg5; + result = (switch_status_t)switch_rtp_activate_jitter_buffer(arg1,arg2,arg3,arg4,arg5); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_deactivate_jitter_buffer(void * jarg1) { + int jresult ; + switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; + switch_status_t result; + + arg1 = (switch_rtp_t *)jarg1; + result = (switch_status_t)switch_rtp_deactivate_jitter_buffer(arg1); jresult = result; return jresult; } diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs index 4d14f10..4b9ce71 100644 --- a/src/mod/languages/mod_managed/managed/swig.2010.cs +++ b/src/mod/languages/mod_managed/managed/swig.2010.cs @@ -4640,8 +4640,13 @@ public class freeswitch { return ret; } - public static switch_status_t switch_rtp_activate_jitter_buffer(SWIGTYPE_p_switch_rtp rtp_session, uint queue_frames) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_activate_jitter_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), queue_frames); + public static switch_status_t switch_rtp_activate_jitter_buffer(SWIGTYPE_p_switch_rtp rtp_session, uint queue_frames, uint max_queue_frames, uint samples_per_packet, uint samples_per_second) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_activate_jitter_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), queue_frames, max_queue_frames, samples_per_packet, samples_per_second); + return ret; + } + + public static switch_status_t switch_rtp_deactivate_jitter_buffer(SWIGTYPE_p_switch_rtp rtp_session) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_deactivate_jitter_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session)); return ret; } @@ -12448,7 +12453,10 @@ class freeswitchPINVOKE { public static extern int switch_rtp_activate_rtcp(HandleRef jarg1, int jarg2, ushort jarg3); [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_activate_jitter_buffer")] - public static extern int switch_rtp_activate_jitter_buffer(HandleRef jarg1, uint jarg2); + public static extern int switch_rtp_activate_jitter_buffer(HandleRef jarg1, uint jarg2, uint jarg3, uint jarg4, uint jarg5); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_deactivate_jitter_buffer")] + public static extern int switch_rtp_deactivate_jitter_buffer(HandleRef jarg1); [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_flag")] public static extern void switch_rtp_set_flag(HandleRef jarg1, uint jarg2); @@ -21554,6 +21562,7 @@ public enum switch_channel_flag_t { CF_PASSTHRU_PTIME_MISMATCH, CF_BRIDGE_NOWRITE, CF_RECOVERED, + CF_JITTERBUFFER, CF_FLAG_MAX } @@ -23243,6 +23252,7 @@ public enum switch_core_session_message_types_t { SWITCH_MESSAGE_INDICATE_T38_DESCRIPTION, SWITCH_MESSAGE_INDICATE_UDPTL_MODE, SWITCH_MESSAGE_INDICATE_CLEAR_PROGRESS, + SWITCH_MESSAGE_INDICATE_JITTER_BUFFER, SWITCH_MESSAGE_INVALID } diff --git a/w32/Console/FreeSwitchConsole.2008.vcproj b/w32/Console/FreeSwitchConsole.2008.vcproj index 80f062a..7fc1784 100644 --- a/w32/Console/FreeSwitchConsole.2008.vcproj +++ b/w32/Console/FreeSwitchConsole.2008.vcproj @@ -46,7 +46,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories=""$(InputDir)include";"$(InputDir)..\libs\include"" + AdditionalIncludeDirectories=""$(InputDir)include";..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\tiff-3.8.2\libtiff;"$(InputDir)..\libs\include"" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" MinimalRebuild="true" BasicRuntimeChecks="3" @@ -128,7 +128,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories=""$(InputDir)include";"$(InputDir)..\libs\include"" + AdditionalIncludeDirectories=""$(InputDir)include";..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\tiff-3.8.2\libtiff;"$(InputDir)..\libs\include"" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" MinimalRebuild="true" BasicRuntimeChecks="3" @@ -208,7 +208,7 @@ /> <Tool Name="VCCLCompilerTool" - AdditionalIncludeDirectories=""$(InputDir)include";"$(InputDir)..\libs\include"" + AdditionalIncludeDirectories=""$(InputDir)include";..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\tiff-3.8.2\libtiff;"$(InputDir)..\libs\include"" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" RuntimeLibrary="2" UsePrecompiledHeader="0" @@ -288,7 +288,7 @@ /> <Tool Name="VCCLCompilerTool" - AdditionalIncludeDirectories=""$(InputDir)include";"$(InputDir)..\libs\include"" + AdditionalIncludeDirectories=""$(InputDir)include";..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\tiff-3.8.2\libtiff;"$(InputDir)..\libs\include"" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" RuntimeLibrary="2" UsePrecompiledHeader="0" diff --git a/w32/Console/FreeSwitchConsole.2010.vcxproj b/w32/Console/FreeSwitchConsole.2010.vcxproj index 488abc8..b9c47e7 100644 --- a/w32/Console/FreeSwitchConsole.2010.vcxproj +++ b/w32/Console/FreeSwitchConsole.2010.vcxproj @@ -80,7 +80,7 @@ <BuildLog /> <ClCompile> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>%(RootDir)%(Directory)include;%(RootDir)%(Directory)..\libs\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>%(RootDir)%(Directory)include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\tiff-3.8.2\libtiff;%(RootDir)%(Directory)..\libs\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> @@ -109,7 +109,7 @@ </Midl> <ClCompile> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>%(RootDir)%(Directory)include;%(RootDir)%(Directory)..\libs\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>%(RootDir)%(Directory)include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\tiff-3.8.2\libtiff;%(RootDir)%(Directory)..\libs\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> @@ -134,7 +134,7 @@ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <BuildLog /> <ClCompile> - <AdditionalIncludeDirectories>%(RootDir)%(Directory)include;%(RootDir)%(Directory)..\libs\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>%(RootDir)%(Directory)include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\tiff-3.8.2\libtiff;%(RootDir)%(Directory)..\libs\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <PrecompiledHeader> @@ -161,7 +161,7 @@ <TargetEnvironment>X64</TargetEnvironment> </Midl> <ClCompile> - <AdditionalIncludeDirectories>%(RootDir)%(Directory)include;%(RootDir)%(Directory)..\libs\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>%(RootDir)%(Directory)include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\tiff-3.8.2\libtiff;%(RootDir)%(Directory)..\libs\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <PrecompiledHeader> diff --git a/w32/Library/FreeSwitchCore.2008.vcproj b/w32/Library/FreeSwitchCore.2008.vcproj index ca15da8..6ba5b95 100644 --- a/w32/Library/FreeSwitchCore.2008.vcproj +++ b/w32/Library/FreeSwitchCore.2008.vcproj @@ -47,7 +47,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories="..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include" + AdditionalIncludeDirectories="..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\tiff-3.8.2\libtiff;" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;PCRE_STATIC;STATICLIB" MinimalRebuild="true" BasicRuntimeChecks="3" @@ -141,7 +141,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories="..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include" + AdditionalIncludeDirectories="..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\tiff-3.8.2\libtiff;" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;PCRE_STATIC;STATICLIB" MinimalRebuild="true" BasicRuntimeChecks="3" @@ -234,7 +234,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories="..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include" + AdditionalIncludeDirectories="..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\tiff-3.8.2\libtiff;" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;STATICLIB;CRASH_PROT;PCRE_STATIC" RuntimeLibrary="2" UsePrecompiledHeader="2" @@ -324,7 +324,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories="..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include" + AdditionalIncludeDirectories="..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\tiff-3.8.2\libtiff;" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;STATICLIB;CRASH_PROT;PCRE_STATIC" RuntimeLibrary="2" UsePrecompiledHeader="2" diff --git a/w32/Library/FreeSwitchCore.2010.vcxproj b/w32/Library/FreeSwitchCore.2010.vcxproj index 2595793..e218445 100644 --- a/w32/Library/FreeSwitchCore.2010.vcxproj +++ b/w32/Library/FreeSwitchCore.2010.vcxproj @@ -88,7 +88,7 @@ </PreBuildEvent> <ClCompile> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\tiff-3.8.2\libtiff;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;PCRE_STATIC;STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> @@ -147,7 +147,7 @@ if not exist "$(OutDir)htdocs" xcopy "$(SolutionDir)htdocs\*.*" "$(OutDir)htdocs </Midl> <ClCompile> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\tiff-3.8.2\libtiff;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;PCRE_STATIC;STATICLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> @@ -199,7 +199,7 @@ if not exist "$(OutDir)htdocs" xcopy "$(SolutionDir)htdocs\*.*" "$(OutDir)htdocs </PreBuildEvent> <ClCompile> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\tiff-3.8.2\libtiff;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;STATICLIB;CRASH_PROT;PCRE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <PrecompiledHeader>Use</PrecompiledHeader> @@ -248,7 +248,7 @@ if not exist "$(OutDir)htdocs" xcopy "$(SolutionDir)htdocs\*.*" "$(OutDir)htdocs </Midl> <ClCompile> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\..\src\include;..\..\libs\include;..\..\libs\srtp\include;..\..\libs\srtp\crypto\include;..\..\libs\libteletone\src;..\..\libs\win32\sqlite;..\..\libs\pcre;..\..\libs\stfu;..\..\libs\speex\include;..\..\libs\spandsp\src\msvc;..\..\libs\spandsp\src;..\..\libs\tiff-3.8.2\libtiff;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;STATICLIB;CRASH_PROT;PCRE_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <PrecompiledHeader>Use</PrecompiledHeader> @@ -766,6 +766,9 @@ if not exist "$(OutDir)htdocs" xcopy "$(SolutionDir)htdocs\*.*" "$(OutDir)htdocs <Project>{89385c74-5860-4174-9caf-a39e7c48909c}</Project> <ReferenceOutputAssembly>false</ReferenceOutputAssembly> </ProjectReference> + <ProjectReference Include="..\..\libs\spandsp\src\libspandsp.2010.vcxproj"> + <Project>{1cbb0077-18c5-455f-801c-0a0ce7b0bbf5}</Project> + </ProjectReference> <ProjectReference Include="..\..\libs\speex\win32\VS2008\libspeexdsp\libspeexdsp.vcxproj"> <Project>{03207781-0d1c-4db3-a71d-45c608f28dbd}</Project> <ReferenceOutputAssembly>false</ReferenceOutputAssembly> commit 55203ed0d72d28df807ea9f8d326e00cd77f5ee4 Author: David Yat Sin <dyatsin@sangoma.com> Date: Fri Dec 10 19:14:08 2010 -0500 Support for call ID diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index eaa25e3..78ae3d2 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -57,11 +57,14 @@ struct tm *localtime_r(const time_t *clock, struct tm *result); #define SPAN_PENDING_SIGNALS_QUEUE_SIZE 1000 #define FTDM_READ_TRACE_INDEX 0 #define FTDM_WRITE_TRACE_INDEX 1 +#define MAX_CALLIDS 6000 ftdm_time_t time_last_throttle_log = 0; ftdm_time_t time_current_throttle_log = 0; static ftdm_iterator_t *get_iterator(ftdm_iterator_type_t type, ftdm_iterator_t *iter); +static ftdm_status_t ftdm_call_set_call_id(ftdm_caller_data_t *caller_data); +static ftdm_status_t ftdm_call_clear_call_id(ftdm_caller_data_t *caller_data); static int time_is_init = 0; @@ -235,6 +238,10 @@ static struct { ftdm_span_t *spans; ftdm_group_t *groups; cpu_monitor_t cpu_monitor; + + ftdm_caller_data_t *call_ids[MAX_CALLIDS+1]; + ftdm_mutex_t *call_id_mutex; + uint32_t last_call_id; } globals; enum ftdm_enum_cpu_alarm_action_flags @@ -1896,8 +1903,6 @@ static ftdm_status_t ftdm_channel_reset(ftdm_channel_t *ftdmchan) ftdmchan->dtmf_off = FTDM_DEFAULT_DTMF_OFF; } - ftdm_call_clear_vars(&ftdmchan->caller_data); - memset(ftdmchan->dtmf_hangup_buf, '\0', ftdmchan->span->dtmf_hangup_len); if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_TRANSCODE)) { @@ -2483,6 +2488,7 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_place(const char *file, const char ftdm_wait_for_flag_cleared(ftdmchan, FTDM_CHANNEL_STATE_CHANGE, 100); + ftdm_call_set_call_id(&ftdmchan->caller_data); ftdm_channel_unlock(ftdmchan); return status; @@ -2545,9 +2551,6 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_done(ftdm_channel_t *ftdmchan) ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "Null channel can't be done!\n"); ftdm_mutex_lock(ftdmchan->mutex); - - memset(&ftdmchan->caller_data, 0, sizeof(ftdmchan->caller_data)); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_INUSE); ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND); ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_WINK); @@ -2587,7 +2590,8 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_done(ftdm_channel_t *ftdmchan) sigmsg.channel = ftdmchan; sigmsg.event_id = FTDM_SIGEVENT_RELEASED; ftdm_span_send_signal(ftdmchan->span, &sigmsg); - } + ftdm_call_clear_call_id(&ftdmchan->caller_data); + } if (ftdmchan->txdrops || ftdmchan->rxdrops) { ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "channel dropped data: txdrops = %d, rxdrops = %d\n", @@ -2595,8 +2599,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_done(ftdm_channel_t *ftdmchan) } ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "channel done\n"); - - + memset(&ftdmchan->caller_data, 0, sizeof(ftdmchan->caller_data)); ftdm_mutex_unlock(ftdmchan->mutex); return FTDM_SUCCESS; @@ -5328,7 +5331,7 @@ static void execute_safety_hangup(void *data) FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t *sigmsg) { if (sigmsg->channel) { - ftdm_mutex_lock(sigmsg->channel->mutex); + ftdm_mutex_lock(sigmsg->channel->mutex); } /* some core things to do on special events */ @@ -5347,6 +5350,7 @@ FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t case FTDM_SIGEVENT_START: { + ftdm_call_set_call_id(&sigmsg->channel->caller_data); ftdm_set_echocancel_call_begin(sigmsg->channel); if (sigmsg->channel->dtmfdbg.requested) { ftdm_channel_command(sigmsg->channel, FTDM_COMMAND_ENABLE_DEBUG_DTMF, NULL); @@ -5376,7 +5380,10 @@ FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t break; } - + + if (sigmsg->channel) { + sigmsg->call_id = sigmsg->channel->caller_data.call_id; + } /* if the signaling module uses a queue for signaling notifications, then enqueue it */ if (ftdm_test_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE)) { ftdm_span_queue_signal(span, sigmsg); @@ -5471,6 +5478,7 @@ static void ftdm_cpu_monitor_stop(void) FT_DECLARE(ftdm_status_t) ftdm_global_init(void) { + int i; memset(&globals, 0, sizeof(globals)); time_init(); @@ -5485,6 +5493,8 @@ FT_DECLARE(ftdm_status_t) ftdm_global_init(void) ftdm_mutex_create(&globals.mutex); ftdm_mutex_create(&globals.span_mutex); ftdm_mutex_create(&globals.group_mutex); + ftdm_mutex_create(&globals.call_id_mutex); + ftdm_sched_global_init(); if (ftdm_sched_create(&globals.timingsched, "freetdm-master") != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_CRIT, "Failed to create master timing schedule context\n"); @@ -5494,6 +5504,9 @@ FT_DECLARE(ftdm_status_t) ftdm_global_init(void) ftdm_log(FTDM_LOG_CRIT, "Failed to run master timing schedule context\n"); return FTDM_FAIL; } + for(i=0;i<MAX_CALLIDS;i++) { + globals.call_ids[i] = NULL; + } globals.running = 1; return FTDM_SUCCESS; } @@ -5597,6 +5610,7 @@ FT_DECLARE(ftdm_status_t) ftdm_global_destroy(void) ftdm_mutex_destroy(&globals.mutex); ftdm_mutex_destroy(&globals.span_mutex); ftdm_mutex_destroy(&globals.group_mutex); + ftdm_mutex_destroy(&globals.call_id_mutex); memset(&globals, 0, sizeof(globals)); return FTDM_SUCCESS; @@ -5955,6 +5969,47 @@ FT_DECLARE(char *) ftdm_channel_get_history_str(const ftdm_channel_t *fchan) return stream.data; } +static ftdm_status_t ftdm_call_set_call_id(ftdm_caller_data_t *caller_data) +{ + uint32_t current_call_id; + ftdm_assert_return(!caller_data->call_id, FTDM_FAIL, "Overwriting non-cleared call-id"); + + ftdm_mutex_lock(globals.call_id_mutex); + current_call_id = globals.last_call_id; + + do { + if (++current_call_id > MAX_CALLIDS) { + current_call_id = 1; + } + if (globals.call_ids[current_call_id] != NULL) { + continue; + } + } while (0); + + globals.last_call_id = current_call_id; + caller_data->call_id = current_call_id; + + globals.call_ids[current_call_id] = caller_data; + ftdm_mutex_unlock(globals.call_id_mutex); + return FTDM_SUCCESS; +} + +static ftdm_status_t ftdm_call_clear_call_id(ftdm_caller_data_t *caller_data) +{ + ftdm_assert_return((caller_data->call_id && caller_data->call_id <= MAX_CALLIDS), FTDM_FAIL, "Clearing call with invalid call-id\n"); + ftdm_mutex_lock(globals.call_id_mutex); + if (globals.call_ids[caller_data->call_id]) { + caller_data->call_id = 0; + globals.call_ids[caller_data->call_id] = NULL; + } else { + ftdm_log(FTDM_LOG_CRIT, "call-id did not exist %u\n", caller_data->call_id); + } + ftdm_mutex_unlock(globals.call_id_mutex); + return FTDM_SUCCESS; +} + + + /* For Emacs: * Local Variables: diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 4ee6ff5..cc32d66 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -295,6 +295,11 @@ typedef struct ftdm_caller_data { /* user information layer 1 protocol */ ftdm_user_layer1_prot_t bearer_layer1; ftdm_variable_container_t variables; /*!<variables attached to this call */ + /* We need call_id inside caller_data for the user to be able to retrieve + * the call_id when ftdm_channel_call_place is called. This is the only time + * that the user can use caller_data.call_id to obtain the call_id. The user + * should use the call_id from sigmsg otherwise */ + uint32_t call_id; /*!< Unique call ID for this call */ } ftdm_caller_data_t; /*! \brief Tone type */ @@ -381,9 +386,10 @@ struct ftdm_sigmsg { ftdm_channel_t *channel; /*!< Related channel */ uint32_t chan_id; /*!< easy access to chan id */ uint32_t span_id; /*!< easy access to span_id */ - ftdm_signaling_status_t sigstatus; /*!< Signaling status (valid if event_id is FTDM_SIGEVENT_SIGSTATUS_CHANGED) */ + ftdm_signaling_status_t sigstatus; /*!< Signaling status (valid if event_id is FTDM_SIGEVENT_SIGSTATUS_CHANGED) */ void *raw_data; /*!< Message specific data if any */ uint32_t raw_data_len; /*!< Data len in case is needed */ + uint32_t call_id; /*!< unique call id for this call */ }; /*! \brief Crash policy commit 19d1385714600212c47f06e8f4f0c7fa06e18c29 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Dec 10 17:58:24 2010 -0600 temp tiff hack (make spandsp-reconf) diff --git a/libs/spandsp/src/spandsp.h.in b/libs/spandsp/src/spandsp.h.in index 9167c1c..eaed548 100644 --- a/libs/spandsp/src/spandsp.h.in +++ b/libs/spandsp/src/spandsp.h.in @@ -39,8 +39,9 @@ #include <limits.h> #include <time.h> @INSERT_MATH_HEADER@ +#if !defined(SPANDSP_NO_TIFF) #include <tiffio.h> - +#endif #include <spandsp/telephony.h> #include <spandsp/fast_convert.h> #include <spandsp/logging.h> diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index a565299..422d5f2 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -31,6 +31,7 @@ * this file does not exist!!!! * */ +#define SPANDSP_NO_TIFF 1 #include "spandsp.h" #include "switch_profile.h" commit b7c80a8490e00ef1c76dc9eeb8627f92ffb18d48 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Dec 10 17:48:40 2010 -0600 add plc to core diff --git a/Makefile.am b/Makefile.am index e701494..72ad3f7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -102,6 +102,7 @@ CORE_CFLAGS += -I$(switch_srcdir)/libs/pcre CORE_CFLAGS += -I$(switch_srcdir)/libs/speex/include -Ilibs/speex/include CORE_CFLAGS += -I$(switch_srcdir)/libs/srtp/include CORE_CFLAGS += -I$(switch_srcdir)/libs/srtp/crypto/include -Ilibs/srtp/crypto/include +CORE_CFLAGS += -I$(switch_srcdir)/libs/spandsp/src CORE_LIBS = libs/apr-util/libaprutil-1.la libs/apr/libapr-1.la CORE_LIBS += libs/sqlite/libsqlite3.la libs/pcre/libpcre.la libs/speex/libspeex/libspeexdsp.la @@ -249,7 +250,8 @@ libfreeswitch_la_SOURCES = \ libs/miniupnpc/minissdpc.c \ libs/miniupnpc/upnperrors.c \ libs/libnatpmp/natpmp.c \ - libs/libnatpmp/getgateway.c + libs/libnatpmp/getgateway.c\ + libs/spandsp/src/plc.c if ENABLE_CPP libfreeswitch_la_SOURCES += src/switch_cpp.cpp commit c312454f0c3045ac34a1c0eeab0506b2230daafb Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Dec 10 17:48:19 2010 -0600 dramatic jitterbuffer changes diff --git a/libs/stfu/stfu.c b/libs/stfu/stfu.c index 0422cd2..66b165b 100644 --- a/libs/stfu/stfu.c +++ b/libs/stfu/stfu.c @@ -27,6 +27,7 @@ */ #include "stfu.h" +//#define DB_JB 1 #ifdef _MSC_VER /* warning C4706: assignment within conditional expression*/ #pragma warning(disable: 4706) @@ -35,9 +36,12 @@ struct stfu_queue { struct stfu_frame *array; struct stfu_frame int_frame; + uint32_t real_array_size; uint32_t array_size; uint32_t array_len; uint32_t wr_len; + uint32_t last_index; + int32_t last_jitter; }; typedef struct stfu_queue stfu_queue_t; @@ -48,27 +52,72 @@ struct stfu_instance { struct stfu_queue *out_queue; struct stfu_frame *last_frame; uint32_t cur_ts; + uint32_t cur_seq; uint32_t last_wr_ts; + uint32_t last_wr_seq; uint32_t last_rd_ts; - uint32_t interval; + uint32_t samples_per_packet; + uint32_t samples_per_second; uint32_t miss_count; uint32_t max_plc; + uint32_t qlen; + uint32_t max_qlen; + uint32_t orig_qlen; + uint32_t packet_count; + uint32_t consecutive_good_count; + uint32_t consecutive_bad_count; + uint32_t period_good_count; + uint32_t period_bad_count; + uint32_t period_packet_in_count; + uint32_t period_packet_out_count; + uint32_t period_missing_count; + uint32_t period_need_range; + uint32_t period_need_range_avg; + uint32_t period_clean_count; + + uint32_t session_clean_count; + uint32_t session_missing_count; + + uint32_t session_packet_in_count; + uint32_t session_packet_out_count; + + uint32_t sync; + + + int32_t ts_diff; + int32_t last_ts_diff; + int32_t same_ts; + + uint32_t last_seq; + + uint32_t period_time; + uint32_t decrement_time; + + uint32_t plc_len; + + stfu_n_call_me_t callback; + void *udata; }; +static void stfu_n_reset_counters(stfu_instance_t *i); static stfu_status_t stfu_n_resize_aqueue(stfu_queue_t *queue, uint32_t qlen) { unsigned char *m; - if (qlen <= queue->array_size) { - return STFU_IT_FAILED;; + if (qlen <= queue->real_array_size) { + queue->array_size = qlen; + if (queue->array_len > qlen) { + queue->array_len = qlen; + } + } else { + m = realloc(queue->array, qlen * sizeof(struct stfu_frame)); + assert(m); + memset(m + queue->array_size * sizeof(struct stfu_frame), 0, (qlen * sizeof(struct stfu_frame)) - (queue->array_size * sizeof(struct stfu_frame))); + queue->array = (struct stfu_frame *) m; + queue->real_array_size = queue->array_size = qlen; } - m = realloc(queue->array, qlen * sizeof(struct stfu_frame)); - assert(m); - memset(m + queue->array_size, 0, qlen * sizeof(struct stfu_frame) - queue->array_size); - queue->array = (struct stfu_frame *) m; - queue->array_size = qlen; return STFU_IT_WORKED; } @@ -77,8 +126,16 @@ static void stfu_n_init_aqueue(stfu_queue_t *queue, uint32_t qlen) queue->array = calloc(qlen, sizeof(struct stfu_frame)); assert(queue->array != NULL); memset(queue->array, 0, sizeof(struct stfu_frame) * qlen); - queue->array_size = qlen; + queue->real_array_size = queue->array_size = qlen; queue->int_frame.plc = 1; + memset(queue->int_frame.data, 255, sizeof(queue->int_frame.data)); +} + + +void stfu_n_call_me(stfu_instance_t *i, stfu_n_call_me_t callback, void *udata) +{ + i->callback = callback; + i->udata = udata; } void stfu_n_destroy(stfu_instance_t **i) @@ -97,24 +154,40 @@ void stfu_n_destroy(stfu_instance_t **i) void stfu_n_report(stfu_instance_t *i, stfu_report_t *r) { assert(i); - r->in_len = i->in_queue->array_len; - r->in_size = i->in_queue->array_size; - r->out_len = i->out_queue->array_len; - r->out_size = i->out_queue->array_size; + r->qlen = i->qlen; + r->packet_in_count = i->period_packet_in_count; + r->clean_count = i->period_clean_count; + r->consecutive_good_count = i->consecutive_good_count; + r->consecutive_bad_count = i->consecutive_bad_count; } stfu_status_t stfu_n_resize(stfu_instance_t *i, uint32_t qlen) { stfu_status_t s; + if (i->qlen == i->max_qlen) { + return STFU_IT_FAILED; + } + + if (i->max_qlen && qlen > i->max_qlen) { + if (i->qlen < i->max_qlen) { + qlen = i->max_qlen; + } else { + return STFU_IT_FAILED; + } + } + if ((s = stfu_n_resize_aqueue(&i->a_queue, qlen)) == STFU_IT_WORKED) { s = stfu_n_resize_aqueue(&i->b_queue, qlen); + i->qlen = qlen; + i->max_plc = 5; + i->last_frame = NULL; } return s; } -stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_plc) +stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_qlen, uint32_t samples_per_packet, uint32_t samples_per_second) { struct stfu_instance *i; @@ -123,82 +196,172 @@ stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_plc) return NULL; } memset(i, 0, sizeof(*i)); + i->qlen = qlen; + i->max_qlen = max_qlen; + i->orig_qlen = qlen; + i->samples_per_packet = samples_per_packet; + stfu_n_init_aqueue(&i->a_queue, qlen); stfu_n_init_aqueue(&i->b_queue, qlen); i->in_queue = &i->a_queue; i->out_queue = &i->b_queue; + + i->max_plc = i->qlen / 2; - if (max_plc) { - i->max_plc = max_plc; - } else { - i->max_plc = qlen / 2; - } + i->samples_per_second = samples_per_second ? samples_per_second : 8000; + + i->period_time = ((i->samples_per_second * 20) / i->samples_per_packet); + i->decrement_time = ((i->samples_per_second * 15) / i->samples_per_packet); return i; } +static void stfu_n_reset_counters(stfu_instance_t *i) +{ +#ifdef DB_JB + printf("COUNER RESET........\n"); +#endif + + if (i->callback) { + i->callback(i, i->udata); + } + + i->consecutive_good_count = 0; + i->consecutive_bad_count = 0; + i->period_good_count = 0; + i->period_clean_count = 0; + i->period_bad_count = 0; + i->period_packet_in_count = 0; + i->period_packet_out_count = 0; + i->period_missing_count = 0; + i->period_need_range = 0; + i->period_need_range_avg = 0; +} + void stfu_n_reset(stfu_instance_t *i) { +#ifdef DB_JB + printf("RESET\n"); +#endif i->in_queue = &i->a_queue; i->out_queue = &i->b_queue; i->in_queue->array_len = 0; i->out_queue->array_len = 0; i->out_queue->wr_len = 0; i->last_frame = NULL; - i->miss_count = 0; - i->last_wr_ts = 0; - i->miss_count = 0; - i->interval = 0; -} -static int32_t stfu_n_measure_interval(stfu_queue_t *queue) -{ - uint32_t index; - int32_t d, most = 0, last = 0, this, track[STFU_MAX_TRACK] = {0}; - - for(index = 0; index < queue->array_len; index++) { - this = queue->array[index].ts; - if (last) { + i->in_queue->last_jitter = 0; + i->out_queue->last_jitter = 0; - if ((d = this - last) > 0 && d / 10 < STFU_MAX_TRACK) { - track[(d/10)]++; - } - } - - last = this; - } + stfu_n_reset_counters(i); - for(index = 0; index < STFU_MAX_TRACK; index++) { - if (track[index] > track[most]) { - most = index; - } - } + i->last_seq = 0; - return most * 10; + i->cur_ts = 0; + i->cur_seq = 0; + i->last_wr_ts = 0; + i->last_wr_seq = 0; + i->last_rd_ts = 0; + i->miss_count = 0; + i->packet_count = 0; } -static int16_t stfu_n_process(stfu_instance_t *i, stfu_queue_t *queue) +stfu_status_t stfu_n_sync(stfu_instance_t *i, uint32_t packets) { - if (!i->interval && !(i->interval = stfu_n_measure_interval(queue))) { - return -1; - } - return 0; + if (packets > i->qlen) { + stfu_n_reset(i); + } else { + i->sync = packets; + } + + return STFU_IT_WORKED; } -stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void *data, size_t datalen, int last) + +stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t seq, uint32_t pt, void *data, size_t datalen, int last) { uint32_t index; stfu_frame_t *frame; size_t cplen = 0; + int good_seq = 0, good_ts = 0; + + if (!i->samples_per_packet && ts && i->last_rd_ts) { + i->ts_diff = ts - i->last_rd_ts; + + if (i->last_ts_diff == i->ts_diff) { + if (++i->same_ts == 5) { + i->samples_per_packet = i->ts_diff; + } + } else { + i->same_ts = 0; + } + + i->last_ts_diff = i->ts_diff; + + if (!i->samples_per_packet) { + i->last_rd_ts = ts; + return STFU_IT_FAILED; + } + } + + if (seq && seq == i->last_seq + 1) { + good_seq = 1; + } + + if (ts && ts == i->last_rd_ts + i->samples_per_packet) { + good_ts = 1; + } + + + if (good_seq || good_ts) { + i->period_clean_count++; + i->session_clean_count++; + } + + i->period_packet_in_count++; + i->session_packet_in_count++; + + if (i->session_packet_in_count == 150) { + return STFU_IT_WORKED; + } + + i->period_need_range_avg = i->period_need_range / (i->period_missing_count || 1); + + if (i->period_missing_count > i->qlen * 2) { + stfu_n_resize(i, i->qlen + 1); + stfu_n_reset_counters(i); + } + + if (i->qlen > i->orig_qlen && (i->consecutive_good_count > i->decrement_time || i->period_clean_count > i->decrement_time)) { + stfu_n_resize(i, i->qlen - 1); + stfu_n_reset_counters(i); + stfu_n_sync(i, i->qlen); + } + + if ((i->period_packet_in_count > i->period_time)) { + i->period_packet_in_count = 0; + + if (i->period_missing_count == 0 && i->qlen > i->orig_qlen) { + stfu_n_resize(i, i->qlen - 1); + stfu_n_sync(i, i->qlen); + } + + stfu_n_reset_counters(i); + } + +#ifdef DB_JB + printf("%u i=%u/%u - g:%u/%u c:%u/%u b:%u - %u/%u - %u %d\n", + i->qlen, i->period_packet_in_count, i->period_time, i->consecutive_good_count, + i->decrement_time, i->period_clean_count, i->decrement_time, i->consecutive_bad_count, + seq, ts, + i->period_missing_count, i->period_need_range_avg); +#endif + if (last || i->in_queue->array_len == i->in_queue->array_size) { stfu_queue_t *other_queue; - if (i->out_queue->wr_len < i->out_queue->array_len) { - return STFU_IT_FAILED; - } - other_queue = i->in_queue; i->in_queue = i->out_queue; i->out_queue = other_queue; @@ -207,57 +370,92 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void i->out_queue->wr_len = 0; i->last_frame = NULL; i->miss_count = 0; - - if (stfu_n_process(i, i->out_queue) < 0) { - if (i->in_queue->array_len == i->in_queue->array_size && i->out_queue->array_len == i->out_queue->array_size) { - stfu_n_resize(i, i->out_queue->array_size * 2); - } - //return STFU_IT_FAILED; - } - for(index = 0; index < i->out_queue->array_len; index++) { - i->out_queue->array[index].was_read = 0; - } - } + i->in_queue->last_index = 0; + i->out_queue->last_index = 0; + i->out_queue->last_jitter = 0; + } if (last) { return STFU_IM_DONE; } - index = i->in_queue->array_len++; + for(index = 0; index < i->out_queue->array_size; index++) { + if (i->in_queue->array[index].was_read) { + break; + } + } + + index = i->in_queue->array_len++; + frame = &i->in_queue->array[index]; if ((cplen = datalen) > sizeof(frame->data)) { cplen = sizeof(frame->data); } + i->last_seq = seq; i->last_rd_ts = ts; + i->packet_count++; memcpy(frame->data, data, cplen); + frame->pt = pt; frame->ts = ts; + frame->seq = seq; frame->dlen = cplen; frame->was_read = 0; return STFU_IT_WORKED; } -static int stfu_n_find_frame(stfu_queue_t *queue, uint32_t ts, stfu_frame_t **r_frame, uint32_t *index) +static int stfu_n_find_any_frame(stfu_instance_t *in, stfu_frame_t **r_frame) +{ + uint32_t i = 0; + stfu_frame_t *frame = NULL; + stfu_queue_t *queue; + + assert(r_frame); + + *r_frame = NULL; + + for (queue = in->out_queue ; queue && queue != in->in_queue ; queue = in->in_queue) { + + for(i = 0; i < queue->real_array_size; i++) { + frame = &queue->array[i]; + if (!frame->was_read) { + *r_frame = frame; + queue->last_index = i; + frame->was_read = 1; + in->period_packet_out_count++; + in->session_packet_out_count++; + return 1; + } + } + + } + + return 0; +} + + +static int stfu_n_find_frame(stfu_instance_t *in, stfu_queue_t *queue, uint32_t ts, uint32_t seq, stfu_frame_t **r_frame) { uint32_t i = 0; stfu_frame_t *frame = NULL; assert(r_frame); - assert(index); *r_frame = NULL; - for(i = 0; i < queue->array_len; i++) { + for(i = 0; i < queue->real_array_size; i++) { frame = &queue->array[i]; - if (frame->ts == ts) { + if ((seq && frame->seq == seq) || frame->ts == ts) { *r_frame = frame; - *index = i; + queue->last_index = i; frame->was_read = 1; + in->period_packet_out_count++; + in->session_packet_out_count++; return 1; } } @@ -267,40 +465,139 @@ static int stfu_n_find_frame(stfu_queue_t *queue, uint32_t ts, stfu_frame_t **r_ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i) { - uint32_t index; stfu_frame_t *rframe = NULL; - - if (((i->out_queue->wr_len == i->out_queue->array_len) || !i->out_queue->array_len)) { + int found = 0; + + if (!i->samples_per_packet || ((i->out_queue->wr_len == i->out_queue->array_len) || !i->out_queue->array_len)) { return NULL; } if (i->cur_ts == 0) { i->cur_ts = i->out_queue->array[0].ts; } else { - i->cur_ts += i->interval; + i->cur_ts += i->samples_per_packet; } + if (i->cur_seq == 0) { + i->cur_seq = i->out_queue->array[0].seq; + } else { + i->cur_seq++; + } - if (stfu_n_find_frame(i->out_queue, i->cur_ts, &rframe, &index) || stfu_n_find_frame(i->in_queue, i->cur_ts, &rframe, &index)) { + if (!(found = stfu_n_find_frame(i, i->out_queue, i->cur_ts, i->cur_seq, &rframe))) { + found = stfu_n_find_frame(i, i->in_queue, i->cur_ts, i->cur_seq, &rframe); + } + + if (!found && i->sync) { +#ifdef DB_JB + printf("SYNC %u\n", i->sync); +#endif + if ((found = stfu_n_find_any_frame(i, &rframe))) { + i->cur_seq = rframe->seq; + i->cur_ts = rframe->ts; + } + i->sync--; + } + + + if (!found && i->samples_per_packet) { +#ifdef DB_JB + int y; + stfu_frame_t *frame = NULL; +#endif + int32_t delay = i->last_rd_ts - i->cur_ts; + int32_t need = abs(i->last_rd_ts - i->cur_ts) / i->samples_per_packet; + + + i->period_missing_count++; + i->session_missing_count++; + i->period_need_range += need; + +#ifdef DB_JB + printf("MISSING %u %u %u %u %d %u %d\n", i->cur_seq, i->cur_ts, i->packet_count, i->last_rd_ts, delay, i->qlen, need); +#endif + + if (i->packet_count > i->orig_qlen * 100 && delay > 0 && need > i->qlen && need < (i->qlen + 5)) { + i->packet_count = 0; + } + +#ifdef DB_JB + for(y = 0; y < i->out_queue->array_size; y++) { + if ((y % 5) == 0) printf("\n"); + frame = &i->out_queue->array[y]; + printf("%u:%u\t", frame->seq, frame->ts); + } + printf("\n\n"); + + + for(y = 0; y < i->in_queue->array_size; y++) { + if ((y % 5) == 0) printf("\n"); + frame = &i->in_queue->array[y]; + printf("%u:%u\t", frame->seq, frame->ts); + } + printf("\n\n"); +#endif + + if (delay < 0) { + stfu_n_reset(i); + return NULL; + } + } + +#ifdef DB_JB + if (found) { + printf("O: %u:%u %u\n", rframe->seq, rframe->seq, rframe->plc); + assert(found && rframe->seq); + } else { + printf("DATA: %u %u %d %s %d\n", i->packet_count, i->consecutive_good_count, i->out_queue->last_jitter, found ? "found" : "not found", i->qlen); + } +#endif + + + if (found) { + i->consecutive_good_count++; + i->period_good_count++; + i->consecutive_bad_count = 0; + } else { + i->consecutive_bad_count++; + i->period_bad_count++; + i->consecutive_good_count = 0; + } + + if (found) { i->last_frame = rframe; i->out_queue->wr_len++; i->last_wr_ts = rframe->ts; + i->last_wr_seq = rframe->seq; i->miss_count = 0; + if (rframe->dlen) { + i->plc_len = rframe->dlen; + } } else { i->last_wr_ts = i->cur_ts; + i->last_wr_seq = i->cur_seq; rframe = &i->out_queue->int_frame; - - if (i->last_frame && i->last_frame != rframe) { - rframe->dlen = i->last_frame->dlen; + rframe->dlen = i->plc_len; + + if (i->last_frame) { /* poor man's plc.. Copy the last frame, but we flag it so you can use a better one if you wish */ - memcpy(rframe->data, i->last_frame->data, rframe->dlen); + if (i->miss_count) { + memset(rframe->data, 255, rframe->dlen); + } else { + memcpy(rframe->data, i->last_frame->data, rframe->dlen); + } } rframe->ts = i->cur_ts; - if (++i->miss_count > i->max_plc) { - i->out_queue->wr_len = i->out_queue->array_size; - i->cur_ts = 0; + i->miss_count++; + +#ifdef DB_JB + printf("PLC %d %d %ld %u %u\n", i->miss_count, rframe->plc, rframe->dlen, rframe->seq, rframe->ts); +#endif + + if (i->miss_count > i->max_plc) { + stfu_n_reset(i); rframe = NULL; } } diff --git a/libs/stfu/stfu.h b/libs/stfu/stfu.h index 900db6f..d2760b2 100644 --- a/libs/stfu/stfu.h +++ b/libs/stfu/stfu.h @@ -75,6 +75,7 @@ typedef enum { struct stfu_frame { uint32_t ts; uint32_t pt; + uint32_t seq; uint8_t data[STFU_DATALEN]; size_t dlen; uint8_t was_read; @@ -86,24 +87,27 @@ struct stfu_instance; typedef struct stfu_instance stfu_instance_t; typedef struct { - uint32_t in_len; - uint32_t in_size; - uint32_t out_len; - uint32_t out_size; - + uint32_t qlen; + uint32_t packet_in_count; + uint32_t clean_count; + uint32_t consecutive_good_count; + uint32_t consecutive_bad_count; } stfu_report_t; +typedef void (*stfu_n_call_me_t)(stfu_instance_t *i, void *); void stfu_n_report(stfu_instance_t *i, stfu_report_t *r); void stfu_n_destroy(stfu_instance_t **i); -stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_plc); +stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_qlen, uint32_t samples_per_packet, uint32_t samples_per_second); stfu_status_t stfu_n_resize(stfu_instance_t *i, uint32_t qlen); -stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void *data, size_t datalen, int last); +stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t seq, uint32_t pt, void *data, size_t datalen, int last); stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i); void stfu_n_reset(stfu_instance_t *i); +stfu_status_t stfu_n_sync(stfu_instance_t *i, uint32_t packets); +void stfu_n_call_me(stfu_instance_t *i, stfu_n_call_me_t callback, void *udata); #define stfu_im_done(i) stfu_n_add_data(i, 0, NULL, 0, 1) -#define stfu_n_eat(i,t,p,d,l) stfu_n_add_data(i, t, p, d, l, 0) +#define stfu_n_eat(i,t,s,p,d,l) stfu_n_add_data(i, t, s, p, d, l, 0) #ifdef __cplusplus } commit d5470961642db233aba14432a66195b4acef370f Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Dec 10 17:47:24 2010 -0600 dramatic jitterbuffer changes diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index 13410a0..a565299 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -31,7 +31,7 @@ * this file does not exist!!!! * */ - +#include "spandsp.h" #include "switch_profile.h" #ifndef WIN32 @@ -169,6 +169,7 @@ struct switch_core_session { switch_log_level_t loglevel; uint32_t soft_lock; switch_ivr_dmachine_t *dmachine; + plc_state_t *plc; }; struct switch_media_bug { diff --git a/src/include/switch_rtp.h b/src/include/switch_rtp.h index 7269a2b..e3e9f66 100644 --- a/src/include/switch_rtp.h +++ b/src/include/switch_rtp.h @@ -229,7 +229,12 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_rtcp(switch_rtp_t *rtp_sessi \param queue_frames the number of frames to delay \return SWITCH_STATUS_SUCCESS */ -SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t *rtp_session, uint32_t queue_frames); +SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t *rtp_session, + uint32_t queue_frames, + uint32_t max_queue_frames, + uint32_t samples_per_packet, uint32_t samples_per_second); + +SWITCH_DECLARE(switch_status_t) switch_rtp_deactivate_jitter_buffer(switch_rtp_t *rtp_session); /*! \brief Set an RTP Flag diff --git a/src/include/switch_types.h b/src/include/switch_types.h index c016380..d020775 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -790,6 +790,7 @@ typedef enum { SWITCH_MESSAGE_INDICATE_T38_DESCRIPTION, SWITCH_MESSAGE_INDICATE_UDPTL_MODE, SWITCH_MESSAGE_INDICATE_CLEAR_PROGRESS, + SWITCH_MESSAGE_INDICATE_JITTER_BUFFER, SWITCH_MESSAGE_INVALID } switch_core_session_message_types_t; @@ -1093,6 +1094,7 @@ typedef enum { CF_PASSTHRU_PTIME_MISMATCH, CF_BRIDGE_NOWRITE, CF_RECOVERED, + CF_JITTERBUFFER, /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ CF_FLAG_MAX } switch_channel_flag_t; diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 9d6920e..dba86e3 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -2542,6 +2542,60 @@ SWITCH_STANDARD_API(uuid_simplify_function) } +#define JITTERBUFFER_SYNTAX "<uuid> [0|<min_msec>[:<max_msec>]]" +SWITCH_STANDARD_API(uuid_jitterbuffer_function) +{ + char *mydata = NULL, *argv[2] = { 0 }; + int argc = 0; + + switch_status_t status = SWITCH_STATUS_FALSE; + + if (zstr(cmd)) { + goto error; + } + + mydata = strdup(cmd); + switch_assert(mydata); + + argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + + if (argc < 2) { + goto error; + } + if (argv[1]) { + switch_core_session_message_t msg = { 0 }; + switch_core_session_t *lsession = NULL; + + msg.message_id = SWITCH_MESSAGE_INDICATE_JITTER_BUFFER; + msg.string_arg = argv[1]; + msg.from = __FILE__; + + if ((lsession = switch_core_session_locate(argv[0]))) { + status = switch_core_session_receive_message(lsession, &msg); + switch_core_session_rwunlock(lsession); + } + goto ok; + } else { + goto error; + } + + error: + stream->write_function(stream, "-USAGE: %s\n", JITTERBUFFER_SYNTAX); + switch_safe_free(mydata); + return SWITCH_STATUS_SUCCESS; + ok: + switch_safe_free(mydata); + + if (status == SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "+OK Success\n"); + } else { + stream->write_function(stream, "-ERR Operation Failed\n"); + } + + return SWITCH_STATUS_SUCCESS; +} + + #define PHONE_EVENT_SYNTAX "<uuid>" SWITCH_STANDARD_API(uuid_phone_event_function) { @@ -4770,6 +4824,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) SWITCH_ADD_API(commands_api_interface, "uuid_transfer", "Transfer a session", transfer_function, TRANSFER_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_dual_transfer", "Transfer a session and its partner", dual_transfer_function, DUAL_TRANSFER_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_simplify", "Try to cut out of a call path / attended xfer", uuid_simplify_function, SIMPLIFY_SYNTAX); + SWITCH_ADD_API(commands_api_interface, "uuid_jitterbuffer", "Try to cut out of a call path / attended xfer", + uuid_jitterbuffer_function, JITTERBUFFER_SYNTAX); SWITCH_ADD_API(commands_api_interface, "xml_locate", "find some xml", xml_locate_function, "[root | <section> <tag> <tag_attr_name> <tag_attr_val>]"); SWITCH_ADD_API(commands_api_interface, "xml_wrap", "Wrap another api command in xml", xml_wrap_api_function, "<command> <args>"); switch_console_set_complete("add alias add"); @@ -4866,6 +4922,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) switch_console_set_complete("add uuid_flush_dtmf ::console::list_uuid"); switch_console_set_complete("add uuid_getvar ::console::list_uuid"); switch_console_set_complete("add uuid_hold ::console::list_uuid"); + switch_console_set_complete("add uuid_jitterbuffer ::console::list_uuid"); switch_console_set_complete("add uuid_kill ::console::list_uuid"); switch_console_set_complete("add uuid_limit_release ::console::list_uuid"); switch_console_set_complete("add uuid_loglevel ::console::list_uuid console"); diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index eaff5b9..e508486 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -957,6 +957,17 @@ SWITCH_STANDARD_APP(redirect_function) switch_core_session_receive_message(session, &msg); } +SWITCH_STANDARD_APP(jitterbuffer_function) +{ + switch_core_session_message_t msg = { 0 }; + + /* Tell the channel to change the jitter buffer */ + msg.from = __FILE__; + msg.string_arg = data; + msg.message_id = SWITCH_MESSAGE_INDICATE_JITTER_BUFFER; + switch_core_session_receive_message(session, &msg); +} + SWITCH_STANDARD_APP(display_function) { switch_core_session_message_t msg = { 0 }; @@ -1303,13 +1314,22 @@ SWITCH_STANDARD_API(strftime_api_function) char date[80] = ""; switch_time_t thetime; char *p; - if (!zstr(cmd) && (p = strchr(cmd, '|'))) { - thetime = switch_time_make(atoi(cmd), 0); + char *mycmd = NULL; + + if (!zstr(cmd)) { + mycmd = strdup(cmd); + } + + if (!zstr(mycmd) && (p = strchr(cmd, '|'))) { + *p++ = '\0'; + + thetime = switch_time_make(atol(cmd), 0); cmd = p + 1; } else { thetime = switch_micro_time_now(); } switch_time_exp_lt(&tm, thetime); + if (zstr(cmd)) { switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm); } else { @@ -3513,6 +3533,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) SWITCH_ADD_APP(app_interface, "ivr", "Run an ivr menu", "Run an ivr menu.", ivr_application_function, "<menu_name>", SAF_NONE); SWITCH_ADD_APP(app_interface, "redirect", "Send session redirect", "Send a redirect message to a session.", redirect_function, "<redirect_data>", SAF_SUPPORT_NOMEDIA); + SWITCH_ADD_APP(app_interface, "jitterbuffer", "Send session jitterbuffer", "Send a jitterbuffer message to a session.", + jitterbuffer_function, "<jitterbuffer_data>", SAF_SUPPORT_NOMEDIA); SWITCH_ADD_APP(app_interface, "send_display", "Send session a new display", "Send session a new display.", display_function, "<text>", SAF_SUPPORT_NOMEDIA); SWITCH_ADD_APP(app_interface, "respond", "Send session respond", "Send a respond message to a session.", respond_function, "<respond_data>", diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 74c4c08..0e64d54 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -906,7 +906,7 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f tech_pvt->read_frame.flags = SFF_NONE; status = switch_rtp_zerocopy_read_frame(tech_pvt->rtp_session, &tech_pvt->read_frame, flags); - + if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) { if (status == SWITCH_STATUS_TIMEOUT) { @@ -1332,6 +1332,49 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi } } break; + case SWITCH_MESSAGE_INDICATE_JITTER_BUFFER: + { + if (switch_rtp_ready(tech_pvt->rtp_session)) { + int len, maxlen = 0, qlen = 0, maxqlen = 50; + + if (msg->string_arg) { + char *p; + + if ((len = atoi(msg->string_arg))) { + qlen = len / (tech_pvt->read_impl.microseconds_per_packet / 1000); + } + + if (qlen) { + if ((p = strchr(msg->string_arg, ':'))) { + p++; + maxlen = atol(p); + } + } + + + if (maxlen) { + maxqlen = maxlen / (tech_pvt->read_impl.microseconds_per_packet / 1000); + } + } + + if (qlen) { + if (switch_rtp_activate_jitter_buffer(tech_pvt->rtp_session, qlen, maxqlen, + tech_pvt->read_impl.samples_per_packet, + tech_pvt->read_impl.samples_per_second) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), + SWITCH_LOG_DEBUG, "Setting Jitterbuffer to %dms (%d frames) (%d max frames)\n", len, qlen, maxqlen); + switch_channel_set_flag(tech_pvt->channel, CF_JITTERBUFFER); + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), + SWITCH_LOG_WARNING, "Error Setting Jitterbuffer to %dms (%d frames)\n", len, qlen); + } + + } else { + switch_rtp_deactivate_jitter_buffer(tech_pvt->rtp_session); + } + } + } + break; case SWITCH_MESSAGE_INDICATE_DEBUG_AUDIO: { if (switch_rtp_ready(tech_pvt->rtp_session) && !zstr(msg->string_array_arg[0]) && !zstr(msg->string_array_arg[1])) { diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 6416778..74f5d3d 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -3153,18 +3153,37 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f if ((val = switch_channel_get_variable(tech_pvt->channel, "jitterbuffer_msec"))) { int len = atoi(val); + int maxlen = 50; + char *p; - if (len < 100 || len > 1000) { + if ((p = strchr(val, ':'))) { + p++; + maxlen = atoi(val); + } + + if (len < 20 || len > 10000) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, - "Invalid Jitterbuffer spec [%d] must be between 100 and 1000\n", len); + "Invalid Jitterbuffer spec [%d] must be between 20 and 10000\n", len); } else { - int qlen; - + int qlen, maxqlen = 0; + qlen = len / (tech_pvt->read_impl.microseconds_per_packet / 1000); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Setting Jitterbuffer to %dms (%d frames)\n", len, - qlen); - switch_rtp_activate_jitter_buffer(tech_pvt->rtp_session, qlen); + if (maxlen) { + maxqlen = maxlen / (tech_pvt->read_impl.microseconds_per_packet / 1000); + } + + if (switch_rtp_activate_jitter_buffer(tech_pvt->rtp_session, qlen, maxqlen, + tech_pvt->read_impl.samples_per_packet, + tech_pvt->read_impl.samples_per_second) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), + SWITCH_LOG_DEBUG, "Setting Jitterbuffer to %dms (%d frames)\n", len, qlen); + switch_channel_set_flag(tech_pvt->channel, CF_JITTERBUFFER); + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), + SWITCH_LOG_WARNING, "Error Setting Jitterbuffer to %dms (%d frames)\n", len, qlen); + } + } } diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 6f3e65a..a2df79d 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -235,7 +235,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi if (switch_test_flag(*frame, SFF_CNG)) { status = SWITCH_STATUS_SUCCESS; - if (!session->bugs) { + if (!session->bugs && !session->plc) { goto done; } is_cng = 1; @@ -303,7 +303,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi session->raw_read_frame.datalen = session->raw_read_frame.buflen; if (is_cng) { - memset(session->raw_read_frame.data, 255, read_frame->codec->implementation->decoded_bytes_per_packet); + if (session->plc) { + plc_fillin(session->plc, session->raw_read_frame.data, read_frame->codec->implementation->decoded_bytes_per_packet / 2); + is_cng = 0; + flag &= !SFF_CNG; + } else { + memset(session->raw_read_frame.data, 255, read_frame->codec->implementation->decoded_bytes_per_packet); + } session->raw_read_frame.datalen = read_frame->codec->implementation->decoded_bytes_per_packet; session->raw_read_frame.samples = session->raw_read_frame.datalen / sizeof(int16_t); read_frame = &session->raw_read_frame; @@ -326,6 +332,23 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi session->read_impl.actual_samples_per_second, session->raw_read_frame.data, &session->raw_read_frame.datalen, &session->raw_read_frame.rate, &read_frame->flags); + + if (status == SWITCH_STATUS_SUCCESS) { + if (switch_channel_test_flag(session->channel, CF_JITTERBUFFER) && !session->plc) { + session->plc = plc_init(NULL); + } + + if (session->plc) { + if (switch_test_flag(read_frame, SFF_PLC)) { + plc_fillin(session->plc, session->raw_read_frame.data, session->raw_read_frame.datalen / 2); + switch_clear_flag(read_frame, SFF_PLC); + } else { + plc_rx(session->plc, session->raw_read_frame.data, session->raw_read_frame.datalen / 2); + } + } + } + + } if (do_resample && ((status == SWITCH_STATUS_SUCCESS) || is_cng)) { @@ -361,6 +384,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi session->raw_read_frame.seq = read_frame->seq; session->raw_read_frame.m = read_frame->m; session->raw_read_frame.payload = read_frame->payload; + session->raw_read_frame.flags = 0; + if (switch_test_flag(read_frame, SFF_PLC)) { + session->raw_read_frame.flags |= SFF_PLC; + } read_frame = &session->raw_read_frame; break; case SWITCH_STATUS_NOOP: @@ -383,6 +410,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi session->raw_read_frame.seq = read_frame->seq; session->raw_read_frame.m = read_frame->m; session->raw_read_frame.payload = read_frame->payload; + session->raw_read_frame.flags = 0; + if (switch_test_flag(read_frame, SFF_PLC)) { + session->raw_read_frame.flags |= SFF_PLC; + } + read_frame = &session->raw_read_frame; status = SWITCH_STATUS_SUCCESS; break; @@ -462,7 +494,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi read_frame->datalen = session->read_resampler->to_len * 2; read_frame->rate = session->read_resampler->to_rate; switch_mutex_unlock(session->resample_mutex); - } if (read_frame->datalen == session->read_impl.decoded_bytes_per_packet) { @@ -481,7 +512,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi } } - if (perfect || switch_buffer_inuse(session->raw_read_buffer) >= session->read_impl.decoded_bytes_per_packet) { if (perfect) { enc_frame = read_frame; @@ -810,6 +840,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess session->raw_write_frame.ssrc = frame->ssrc; session->raw_write_frame.seq = frame->seq; session->raw_write_frame.payload = frame->payload; + session->raw_write_frame.flags = 0; + if (switch_test_flag(frame, SFF_PLC)) { + session->raw_write_frame.flags |= SFF_PLC; + } + write_frame = &session->raw_write_frame; break; case SWITCH_STATUS_BREAK: diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 46ba4e6..6e2aeaf 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -2290,7 +2290,7 @@ SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint3 qlen = delay_ms / (interval); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Setting delay to %dms (%d frames)\n", delay_ms, qlen); - jb = stfu_n_init(qlen, 0); + jb = stfu_n_init(qlen, qlen, read_impl.samples_per_packet, read_impl.samples_per_second); write_frame.codec = switch_core_session_get_read_codec(session); @@ -2300,7 +2300,7 @@ SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint3 break; } - stfu_n_eat(jb, ts, read_frame->payload, read_frame->data, read_frame->datalen); + stfu_n_eat(jb, ts, 0, read_frame->payload, read_frame->data, read_frame->datalen); ts += interval; if ((jb_frame = stfu_n_read_a_frame(jb))) { diff --git a/src/switch_rtp.c b/src/switch_rtp.c index ee1c4ac..aba14b2 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1618,14 +1618,67 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_stun_ping(switch_rtp_t *rtp_ return SWITCH_STATUS_SUCCESS; } -SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t *rtp_session, uint32_t queue_frames) +static void jb_callback(stfu_instance_t *i, void *udata) { + switch_core_session_t *session = (switch_core_session_t *) udata; + stfu_report_t r = { 0 }; - rtp_session->jb = stfu_n_init(queue_frames, 0); + stfu_n_report(i, &r); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG1, + "%s JB REPORT:\nlen: %u\nin: %u\nclean: %u\ngood: %u\nbad: %u\n", + switch_core_session_get_name(session), + r.qlen, + r.packet_in_count, + r.clean_count, + r.consecutive_good_count, + r.consecutive_bad_count + ); + +} + +SWITCH_DECLARE(switch_status_t) switch_rtp_deactivate_jitter_buffer(switch_rtp_t *rtp_session) +{ + + if (!switch_rtp_ready(rtp_session) || !rtp_session->jb) { + return SWITCH_STATUS_FALSE; + } + + READ_INC(rtp_session); + stfu_n_destroy(&rtp_session->jb); + READ_DEC(rtp_session); + return SWITCH_STATUS_SUCCESS; } +SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t *rtp_session, + uint32_t queue_frames, + uint32_t max_queue_frames, + uint32_t samples_per_packet, + uint32_t samples_per_second) +{ + + if (!switch_rtp_ready(rtp_session)) { + return SWITCH_STATUS_FALSE; + } + + READ_INC(rtp_session); + if (rtp_session->jb) { + stfu_n_resize(rtp_session->jb, queue_frames); + } else { + rtp_session->jb = stfu_n_init(queue_frames, max_queue_frames || 50, samples_per_packet, samples_per_second); + } + READ_DEC(rtp_session); + + if (rtp_session->jb) { + switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session"); + stfu_n_call_me(rtp_session->jb, jb_callback, session); + return SWITCH_STATUS_SUCCESS; + } + + return SWITCH_STATUS_FALSE; +} + SWITCH_DECLARE(switch_status_t) switch_rtp_activate_rtcp(switch_rtp_t *rtp_session, int send_rate, switch_port_t remote_port) { const char *err = NULL; @@ -2016,14 +2069,18 @@ static void do_flush(switch_rtp_t *rtp_session) switch_size_t bytes; switch_status_t status; - if (!switch_rtp_ready(rtp_session) || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA)) { + if (!switch_rtp_ready(rtp_session) || + switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA) || + switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO) + ) { return; } READ_INC(rtp_session); if (switch_rtp_ready(rtp_session)) { - + uint32_t flushed = 0; + if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_DEBUG_RTP_READ)) { switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session"); if (!session) { @@ -2047,6 +2104,16 @@ static void do_flush(switch_rtp_t *rtp_session) bytes = sizeof(rtp_msg_t); status = switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock_input, 0, (void *) &rtp_session->recv_msg, &bytes); if (bytes) { + + flushed++; + + if (rtp_session->jb) { + stfu_n_eat(rtp_session->jb, ntohl(rtp_session->recv_msg.header.ts), + ntohs((uint16_t) rtp_session->recv_msg.header.seq), + rtp_session->recv_msg.header.pt, + rtp_session->recv_msg.body, bytes - rtp_header_len); + } + rtp_session->stats.inbound.raw_bytes += bytes; rtp_session->stats.inbound.flush_packet_count++; rtp_session->stats.inbound.packet_count++; @@ -2056,6 +2123,10 @@ static void do_flush(switch_rtp_t *rtp_session) } } while (bytes > 0); + if (rtp_session->jb && flushed) { + stfu_n_sync(rtp_session->jb, flushed); + } + if (was_blocking && switch_rtp_ready(rtp_session)) { switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_NOBLOCK); switch_socket_opt_set(rtp_session->sock_input, SWITCH_SO_NONBLOCK, FALSE); @@ -2104,7 +2175,9 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t stfu_n_reset(rtp_session->jb); } - stfu_n_eat(rtp_session->jb, ntohl(rtp_session->recv_msg.header.ts), rtp_session->recv_msg.header.pt, + stfu_n_eat(rtp_session->jb, ntohl(rtp_session->recv_msg.header.ts), + ntohs((uint16_t) rtp_session->recv_msg.header.seq), + rtp_session->recv_msg.header.pt, rtp_session->recv_msg.body, *bytes - rtp_header_len); *bytes = 0; status = SWITCH_STATUS_FALSE; @@ -2114,14 +2187,14 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t if ((jb_frame = stfu_n_read_a_frame(rtp_session->jb))) { memcpy(rtp_session->recv_msg.body, jb_frame->data, jb_frame->dlen); if (jb_frame->plc) { - *flags |= SFF_PLC; + (*flags) |= SFF_PLC; } else { rtp_session->stats.inbound.jb_packet_count++; } *bytes = jb_frame->dlen + rtp_header_len; rtp_session->recv_msg.header.ts = htonl(jb_frame->ts); rtp_session->recv_msg.header.pt = jb_frame->pt; - + rtp_session->recv_msg.header.seq = htons((uint16_t)jb_frame->seq); status = SWITCH_STATUS_SUCCESS; } } @@ -2824,7 +2897,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ if ((poll_status = switch_poll(rtp_session->read_pollfd, 1, &fdr, 0)) == SWITCH_STATUS_SUCCESS) { goto recvfrom; } - + memset(data, 0, 2); data[0] = 65; rtp_session->recv_msg.header.pt = (uint32_t) rtp_session->cng_pt ? rtp_session->cng_pt : SWITCH_RTP_CNG_PAYLOAD; @@ -3053,6 +3126,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read_frame(switch_rtp_t *rtp frame->packet = &rtp_session->recv_msg; frame->packetlen = bytes; frame->source = __FILE__; + switch_set_flag(frame, SFF_RAW_RTP); if (frame->payload == rtp_session->recv_te) { switch_set_flag(frame, SFF_RFC2833); commit bbf1cd1f437d4a90b2b8bf7b9017c3786b2777f5 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Dec 9 14:09:38 2010 -0600 allow epoch in strftime_tz diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index eacde59..9d6920e 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -4278,21 +4278,33 @@ SWITCH_STANDARD_API(strftime_tz_api_function) char *format = NULL; const char *tz_name = NULL; char date[80] = ""; + char *mycmd = NULL, *p; + switch_time_t when = 0; - if (!zstr(cmd)) { - format = strchr(cmd, ' '); - tz_name = cmd; - if (format) { + if (cmd) mycmd = strdup(cmd); + + if (!zstr(mycmd)) { + tz_name = mycmd; + + if ((format = strchr(mycmd, ' '))) { *format++ = '\0'; } + + if ((p = strchr(format, '|'))) { + *p++ = '\0'; + when = atol(format); + format = p; + } } - if (switch_strftime_tz(tz_name, format, date, sizeof(date), 0) == SWITCH_STATUS_SUCCESS) { /* The lookup of the zone may fail. */ + if (switch_strftime_tz(tz_name, format, date, sizeof(date), when * 1000000) == SWITCH_STATUS_SUCCESS) { /* The lookup of the zone may fail. */ stream->write_function(stream, "%s", date); } else { stream->write_function(stream, "-ERR Invalid Timezone\n"); } + switch_safe_free(mycmd); + return SWITCH_STATUS_SUCCESS; } @@ -4715,7 +4727,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) SWITCH_ADD_API(commands_api_interface, "show", "Show", show_function, SHOW_SYNTAX); SWITCH_ADD_API(commands_api_interface, "sql_escape", "Escape a string to prevent sql injection", sql_escape, SQL_ESCAPE_SYNTAX); SWITCH_ADD_API(commands_api_interface, "status", "status", status_function, ""); - SWITCH_ADD_API(commands_api_interface, "strftime_tz", "strftime_tz", strftime_tz_api_function, "<Timezone_name> [format string]"); + SWITCH_ADD_API(commands_api_interface, "strftime_tz", "strftime_tz", strftime_tz_api_function, "<Timezone_name> [<epoch>|][format string]"); SWITCH_ADD_API(commands_api_interface, "stun", "stun", stun_function, "<stun_server>[:port]"); SWITCH_ADD_API(commands_api_interface, "system", "Execute a system command", system_function, SYSTEM_SYNTAX); SWITCH_ADD_API(commands_api_interface, "time_test", "time_test", time_test_function, "<mss> [count]"); commit ff07022c264c4414c5a51299b71429f8da2f37fa Merge: 6fdba34 1347983 Author: Konrad Hammel <konrad@sangoma.com> Date: Fri Dec 10 16:55:32 2010 -0500 Merge branch 'master' of git.sangoma.com:smg_freeswitch commit 1347983883fa8bc90400878af68b31f80242363c Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Fri Dec 10 19:31:11 2010 -0200 freetdm: ftmod_r2 - handle FTDM_CHANNEL_STATE_RINGING, just printing a debug message diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 7439ddd..654e68a 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -1605,6 +1605,13 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) } break; + /* INDICATE_RINGING doesn't apply to MFC/R2. maybe we could generate a tone */ + case FTDM_CHANNEL_STATE_RINGING: + { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "RINGING indicated, ignoring it as it doesn't apply to MFC/R2\n"); + } + break; + default: { ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Unhandled channel state change: %s\n", ftdm_channel_state2str(ftdmchan->state)); commit 6fdba3452a737d0385085ad7abe89b299d6f301c Author: Konrad Hammel <konrad@sangoma.com> Date: Wed Dec 8 17:32:52 2010 -0500 freetdm: ss7 - added suport for per isup interface min_digits ss7 - fixed strcpy bugs and compile warnings diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index 304e9d6..5c171a9 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -502,6 +502,8 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /**************************************************************************/ case FTDM_CHANNEL_STATE_COLLECT: /* IAM received but wating on digits */ + isup_intf = &g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId]; + if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); break; @@ -521,8 +523,8 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /*now go to the RING state */ ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_RING); - } else if (i >= g_ftdm_sngss7_data.min_digits) { - SS7_DEBUG_CHAN(ftdmchan, "Received %d digits (min digits = %d)\n", i, g_ftdm_sngss7_data.min_digits); + } else if (i >= isup_intf->min_digits) { + SS7_DEBUG_CHAN(ftdmchan, "Received %d digits (min digits = %d)\n", i, isup_intf->min_digits); /*now go to the RING state */ ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_RING); @@ -532,7 +534,7 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) if (ftdmchan->last_state != FTDM_CHANNEL_STATE_IDLE) { SS7_INFO_CHAN(ftdmchan,"Received %d out of %d so far: %s...starting T35\n", i, - g_ftdm_sngss7_data.min_digits, + isup_intf->min_digits, ftdmchan->caller_data.dnis.digits); /* start ISUP t35 */ @@ -1520,9 +1522,6 @@ static FIO_SIG_LOAD_FUNCTION(ftdm_sangoma_ss7_init) /* initalize the global gen_config flag */ g_ftdm_sngss7_data.gen_config = 0; - /* min. number of digitis to wait for */ - g_ftdm_sngss7_data.min_digits = 7; - /* function trace initizalation */ g_ftdm_sngss7_data.function_trace = 1; g_ftdm_sngss7_data.function_trace_level = 7; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index 378b50e..fe4b6f4 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -50,7 +50,7 @@ /******************************************************************************/ /* DEFINES ********************************************************************/ -#define MAX_NAME_LEN 10 +#define MAX_NAME_LEN 25 #define MAX_PATH 255 #define MAX_CIC_LENGTH 5 @@ -224,6 +224,7 @@ typedef struct sng_isup_intf { uint32_t isap; uint32_t clg_nadi; uint32_t cld_nadi; + uint32_t min_digits; uint16_t t4; uint32_t t10; uint32_t t11; @@ -326,7 +327,6 @@ typedef struct sng_ss7_cfg { typedef struct ftdm_sngss7_data { sng_ss7_cfg_t cfg; int gen_config; - int min_digits; int function_trace; int function_trace_level; int message_trace; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c index 8a24f97..d4fd1ca 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c @@ -142,7 +142,7 @@ int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *spa if (!strcasecmp(var, "ch_map")) { /**********************************************************************/ - strcpy(isupCkt.ch_map, val); + strncpy(isupCkt.ch_map, val, MAX_CIC_MAP_LENGTH-1); SS7_DEBUG("\tFound channel map \"%s\"\n", isupCkt.ch_map); /**********************************************************************/ } else if (!strcasecmp(var, "typeCntrl")) { @@ -393,7 +393,7 @@ static int ftmod_ss7_parse_mtp_linkset(ftdm_conf_node_t *mtp_linkset) for (i = 0; i < num_parms; i++) { /**********************************************************************/ if (!strcasecmp(parm->var, "name")) { - strcpy((char *)mtpLinkSet.name, parm->val); + strncpy((char *)mtpLinkSet.name, parm->val, MAX_NAME_LEN-1); SS7_DEBUG("\tFound an \"mtp_linkset\" named = %s\n", mtpLinkSet.name); /**********************************************************************/ } else if (!strcasecmp(parm->var, "apc")) { @@ -508,7 +508,7 @@ static int ftmod_ss7_parse_mtp_link(ftdm_conf_node_t *mtp_link, sng_mtp_link_t * /* try to match the parameter to what we expect */ /**********************************************************************/ if (!strcasecmp(parm->var, "name")) { - strcpy((char *)mtpLink->name, parm->val); + strncpy((char *)mtpLink->name, parm->val, MAX_NAME_LEN-1); SS7_DEBUG("\tFound an \"mtp_link\" named = %s\n", mtpLink->name); /**********************************************************************/ } else if (!strcasecmp(parm->var, "span")) { @@ -827,7 +827,7 @@ static int ftmod_ss7_parse_mtp_route(ftdm_conf_node_t *mtp_route) /* try to match the parameter to what we expect */ /**********************************************************************/ if (!strcasecmp(parm->var, "name")) { - strcpy((char *)mtpRoute.name, parm->val); + strncpy((char *)mtpRoute.name, parm->val, MAX_NAME_LEN-1); SS7_DEBUG("\tFound an \"mtp_route\" named = %s\n", mtpRoute.name); /**********************************************************************/ } else if (!strcasecmp(parm->var, "dpc")) { @@ -999,7 +999,7 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface) /* try to match the parameter to what we expect */ /**********************************************************************/ if (!strcasecmp(parm->var, "name")) { - strcpy((char *)sng_isup.name, parm->val); + strncpy((char *)sng_isup.name, parm->val, MAX_NAME_LEN-1); SS7_DEBUG("\tFound an \"isup_interface\" named = %s\n", sng_isup.name); /**********************************************************************/ } else if (!strcasecmp(parm->var, "spc")) { @@ -1047,6 +1047,11 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface) SS7_DEBUG("\tFound MTP3 Route = %s\n", parm->val); } /**********************************************************************/ + } else if (!strcasecmp(parm->var, "min_digits")) { + sng_isup.min_digits = atoi(parm->val); + + SS7_DEBUG("\tFound min_digits = %d\n", sng_isup.min_digits); + /**********************************************************************/ } else if (!strcasecmp(parm->var, "ssf")) { if (!strcasecmp(parm->val, "nat")) { sng_isup.ssf = SSF_NAT; @@ -1067,8 +1072,8 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface) /**********************************************************************/ } else if (!strcasecmp(parm->var, "license")) { /**********************************************************************/ - strcpy(g_ftdm_sngss7_data.cfg.license, parm->val); - strcpy(g_ftdm_sngss7_data.cfg.signature, parm->val); + strncpy(g_ftdm_sngss7_data.cfg.license, parm->val, MAX_PATH-1); + strncpy(g_ftdm_sngss7_data.cfg.signature, parm->val, MAX_PATH-1); strcat(g_ftdm_sngss7_data.cfg.signature, ".sig"); SS7_DEBUG("\tFound license file = %s\n", g_ftdm_sngss7_data.cfg.license); SS7_DEBUG("\tFound signature file = %s\n", g_ftdm_sngss7_data.cfg.signature); @@ -1304,6 +1309,13 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface) sng_isup.clg_nadi = 0x03; } + /* check if the user requested min_digits value */ + if (sng_isup.min_digits == 0) { + /* default to 7 */ + sng_isup.min_digits = 7; + } + + /* trickle down the SPC to all sub entities */ linkSetId = g_ftdm_sngss7_data.cfg.mtpRoute[sng_isup.mtpRouteId].linkSetId; @@ -1359,7 +1371,7 @@ static int ftmod_ss7_fill_in_mtpLink(sng_mtp_link_t *mtpLink) } /* fill in the information */ - strcpy((char *)g_ftdm_sngss7_data.cfg.mtpLink[i].name, (char *)mtpLink->name); + strncpy((char *)g_ftdm_sngss7_data.cfg.mtpLink[i].name, (char *)mtpLink->name, MAX_NAME_LEN-1); g_ftdm_sngss7_data.cfg.mtpLink[i].id = mtpLink->id; @@ -1521,7 +1533,7 @@ static int ftmod_ss7_fill_in_mtpLinkSet(sng_link_set_t *mtpLinkSet) { int i = mtpLinkSet->id; - strcpy((char *)g_ftdm_sngss7_data.cfg.mtpLinkSet[i].name, (char *)mtpLinkSet->name); + strncpy((char *)g_ftdm_sngss7_data.cfg.mtpLinkSet[i].name, (char *)mtpLinkSet->name, MAX_NAME_LEN-1); g_ftdm_sngss7_data.cfg.mtpLinkSet[i].id = mtpLinkSet->id; g_ftdm_sngss7_data.cfg.mtpLinkSet[i].apc = mtpLinkSet->apc; @@ -1559,7 +1571,7 @@ static int ftmod_ss7_fill_in_mtp3_route(sng_route_t *mtp3_route) SS7_DEBUG("found existing mtp3_route, id is = %d\n", mtp3_route->id); } - strcpy((char *)g_ftdm_sngss7_data.cfg.mtpRoute[i].name, (char *)mtp3_route->name); + strncpy((char *)g_ftdm_sngss7_data.cfg.mtpRoute[i].name, (char *)mtp3_route->name, MAX_NAME_LEN-1); g_ftdm_sngss7_data.cfg.mtpRoute[i].id = mtp3_route->id; g_ftdm_sngss7_data.cfg.mtpRoute[i].dpc = mtp3_route->dpc; @@ -1693,7 +1705,7 @@ static int ftmod_ss7_fill_in_isup_interface(sng_isup_inf_t *sng_isup) SS7_DEBUG("found existing isup interface, id is = %d\n", sng_isup->id); } - strcpy((char *)g_ftdm_sngss7_data.cfg.isupIntf[i].name, (char *)sng_isup->name); + strncpy((char *)g_ftdm_sngss7_data.cfg.isupIntf[i].name, (char *)sng_isup->name, MAX_NAME_LEN-1); g_ftdm_sngss7_data.cfg.isupIntf[i].id = sng_isup->id; g_ftdm_sngss7_data.cfg.isupIntf[i].mtpRouteId = sng_isup->mtpRouteId; @@ -1705,6 +1717,7 @@ static int ftmod_ss7_fill_in_isup_interface(sng_isup_inf_t *sng_isup) g_ftdm_sngss7_data.cfg.isupIntf[i].isap = sng_isup->isap; g_ftdm_sngss7_data.cfg.isupIntf[i].cld_nadi = sng_isup->cld_nadi; g_ftdm_sngss7_data.cfg.isupIntf[i].clg_nadi = sng_isup->clg_nadi; + g_ftdm_sngss7_data.cfg.isupIntf[i].min_digits = sng_isup->min_digits; g_ftdm_sngss7_data.cfg.isupIntf[i].options = sng_isup->options; if (sng_isup->t4 != 0) { g_ftdm_sngss7_data.cfg.isupIntf[i].t4 = sng_isup->t4; @@ -1976,7 +1989,7 @@ static int ftmod_ss7_fill_in_self_route(int spc, int linkType, int switchType, i return FTDM_FAIL; } - strcpy((char *)g_ftdm_sngss7_data.cfg.mtpRoute[0].name, "self-rt"); + strncpy((char *)g_ftdm_sngss7_data.cfg.mtpRoute[0].name, "self-route", MAX_NAME_LEN-1); g_ftdm_sngss7_data.cfg.mtpRoute[0].id = 0; g_ftdm_sngss7_data.cfg.mtpRoute[0].dpc = spc; @@ -2230,7 +2243,7 @@ static int ftmod_ss7_next_timeslot(char *ch_map, sng_timeslot_t *timeslot) int lower; int upper; char tmp[5]; /*KONRAD FIX ME*/ - char new_ch_map[MAX_CIC_LENGTH]; + char new_ch_map[MAX_CIC_MAP_LENGTH]; memset(&tmp[0], '\0', sizeof(tmp)); memset(&new_ch_map[0], '\0', sizeof(new_ch_map)); @@ -2337,7 +2350,9 @@ static int ftmod_ss7_next_timeslot(char *ch_map, sng_timeslot_t *timeslot) /* the the rest of ch_map to new_ch_map */ strncat(new_ch_map, &ch_map[x], strlen(&ch_map[x])); + /* set the new cic map to ch_map*/ + memset(ch_map, '\0', sizeof(ch_map)); strcpy(ch_map, new_ch_map); } else if (ch_map[x] == ',') { @@ -2345,16 +2360,21 @@ static int ftmod_ss7_next_timeslot(char *ch_map, sng_timeslot_t *timeslot) x++; /* copy the rest of the list to new_ch_map */ + memset(new_ch_map, '\0', sizeof(new_ch_map)); strcpy(new_ch_map, &ch_map[x]); /* copy the new_ch_map over the old one */ + memset(ch_map, '\0', sizeof(ch_map)); strcpy(ch_map, new_ch_map); } else if (ch_map[x] == '\0') { + /* we're at the end of the string...copy the rest of the list to new_ch_map */ + memset(new_ch_map, '\0', sizeof(new_ch_map)); strcpy(new_ch_map, &ch_map[x]); /* set the new cic map to ch_map*/ + memset(ch_map, '\0', sizeof(ch_map)); strcpy(ch_map, new_ch_map); } else { /* nothing to do */ commit 666e9fc2c652ffac2c13a2959ee04f9bd34d5082 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Fri Dec 10 18:48:04 2010 -0200 freetdm: ftmod_r2 - reject collect calls when allow_collect_calls isn't true diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index d1a46d8..7439ddd 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -515,13 +515,20 @@ static void ftdm_r2_on_call_offered(openr2_chan_t *r2chan, const char *ani, cons ftdm_r2_data_t *r2data = ftdmchan->span->signal_data; ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Call offered with ANI = %s, DNIS = %s, Category = (%d)\n", ani, dnis, category); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); /* nothing went wrong during call setup, MF has ended, we can and must disable the MF dump */ if (r2data->mf_dump_size) { ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_INPUT_DUMP, NULL); ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_OUTPUT_DUMP, NULL); } + + /* check if this is a collect call and if we should accept it */ + if (!r2data->allow_collect_calls && category == OR2_CALLING_PARTY_CATEGORY_COLLECT_CALL) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "Rejecting collect call\n"); + openr2_chan_disconnect_call(r2chan, OR2_CAUSE_COLLECT_CALL_REJECTED); + } else { + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); + } } /* commit fb9a1b05accf3fb8a6eb3daa288fa3ffad822dd5 Merge: c5e2fc1 e96d8f1 Author: David Yat Sin <dyatsin@sangoma.com> Date: Fri Dec 10 15:22:14 2010 -0500 Merge branch 'smgfs' diff --cc libs/freetdm/src/testsangomaboost.c index b254a08,01e5a6b..ed2a7bd --- a/libs/freetdm/src/testsangomaboost.c +++ b/libs/freetdm/src/testsangomaboost.c @@@ -51,9 -51,7 +51,8 @@@ #if defined(__linux__) && !defined(__USE_BSD) #define __USE_BSD #endif +#ifndef WIN32 #include <unistd.h> - #endif #include "freetdm.h" commit c5e2fc1571827e7bd861ce69a6878102fe16ef13 Author: Mathieu Rene <mrene@avgs.ca> Date: Fri Dec 10 14:56:29 2010 -0500 fix configure --srcdir for freetdm diff --git a/libs/freetdm/configure.gnu b/libs/freetdm/configure.gnu index 5785ffc..d00cd18 100755 --- a/libs/freetdm/configure.gnu +++ b/libs/freetdm/configure.gnu @@ -1,3 +1,3 @@ #! /bin/sh -./configure "$@" --with-pic - +srcpath=$(dirname $0 2>/dev/null ) || srcpath="." +$srcpath/configure "$@" --with-pic commit 98ed05cc9800c205389b0f286afddea923cab757 Author: Mathieu Rene <mrene@avgs.ca> Date: Fri Dec 10 14:30:47 2010 -0500 Add reuse-connections sofia profile param to allow users to turn off TPTAG_REUSE, thus not re-using TCP connections diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 6970a7a..61d1657 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -225,6 +225,7 @@ typedef enum { PFLAG_DEL_SUBS_ON_REG, PFLAG_IGNORE_183NOSDP, PFLAG_PRESENCE_PROBE_ON_REGISTER, + PFLAG_NO_CONNECTION_REUSE, /* No new flags below this line */ PFLAG_MAX } PFLAGS; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 2e13b54..e34d7ae 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1486,6 +1486,8 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void TAG_IF(profile->timer_t2, NTATAG_SIP_T2(profile->timer_t2)), TAG_IF(profile->timer_t4, NTATAG_SIP_T4(profile->timer_t4)), SIPTAG_ACCEPT_STR("application/sdp, multipart/mixed"), + TAG_IF(sofia_test_pflag(profile, PFLAG_NO_CONNECTION_REUSE), + TPTAG_REUSE(0)), TAG_END()); /* Last tag should always finish the sequence */ if (!profile->nua) { @@ -3673,6 +3675,13 @@ switch_status_t config_sofia(int reload, char *profile_name) } else { profile->timer_t4 = 4000; } + } else if (!strcasecmp(var, "reuse-connections")) { + switch_bool_t value = switch_true(val); + if (!value) { + sofia_set_pflag(profile, PFLAG_NO_CONNECTION_REUSE); + } else { + sofia_clear_pflag(profile, PFLAG_NO_CONNECTION_REUSE); + } } } commit e96d8f163012d52314a966128dc9f63cc2430538 Author: Moises Silva <moy@sangoma.com> Date: Fri Dec 10 13:42:47 2010 -0500 freetdm: fix windows warning in ftmod_r2 diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index e95a74b..d1a46d8 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -900,7 +900,7 @@ static int ftdm_r2_io_write(openr2_chan_t *r2chan, const void *buf, int size) if (FTDM_FAIL == status) { return -1; } - return outsize; + return (int)outsize; } static int ftdm_r2_io_read(openr2_chan_t *r2chan, const void *buf, int size) @@ -911,7 +911,7 @@ static int ftdm_r2_io_read(openr2_chan_t *r2chan, const void *buf, int size) if (FTDM_FAIL == status) { return -1; } - return outsize; + return (int)outsize; } static int ftdm_r2_io_wait(openr2_chan_t *r2chan, int *flags, int block) commit a94bbfe1df3e7498d3246096da510bd8c52d9917 Merge: e9dc863 0b716f2 Author: Moises Silva <moises.silva@gmail.com> Date: Fri Dec 10 08:55:36 2010 -0500 Merge branch 'netborder' of git.sangoma.com:smg_freeswitch into netborder commit e9dc863e21635111f6fdcc8c2d0c4fd6ab2f8e14 Merge: 1a730cb 8c05792 Author: Moises Silva <moises.silva@gmail.com> Date: Fri Dec 10 08:48:43 2010 -0500 Merge branch 'master' into netborder Conflicts: libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c libs/freetdm/src/testsangomaboost.c diff --cc libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 860e17b,76d11d6..06e132f --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@@ -692,7 -692,7 +692,6 @@@ ftdm_status_t set_facility_ie_str(ftdm_ { int len; ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; - - if (caller_data->raw_data_len > 0 && caller_data->raw_data[0] == SNGISDN_Q931_FACILITY_IE_ID) { len = caller_data->raw_data[1]; memcpy(data, &caller_data->raw_data[2], len); diff --cc libs/freetdm/src/testsangomaboost.c index 84ff287,01e5a6b..7174d1e --- a/libs/freetdm/src/testsangomaboost.c +++ b/libs/freetdm/src/testsangomaboost.c @@@ -48,12 -48,10 +48,15 @@@ #include <stdlib.h> #include <string.h> #include <errno.h> - #ifdef __linux__ - #ifndef __USE_BSD ++ + #if defined(__linux__) && !defined(__USE_BSD) #define __USE_BSD #endif ++ ++#ifndef WIN32 #include <unistd.h> +#endif ++ #include "freetdm.h" commit 8c057921f3e5c889cd148e461ffb67932dd78fbb Author: Moises Silva <moises.silva@gmail.com> Date: Fri Dec 10 08:32:36 2010 -0500 ftmod_wanpipe - fix idle frame stats diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index 1c0baa7..e1b6658 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -811,13 +811,14 @@ static void wanpipe_write_stats(ftdm_channel_t *ftdmchan, wp_tdm_api_tx_hdr_t *t ftdm_clear_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_FULL); } - if (ftdmchan->iostats.tx.idle_packets < tx_stats->wp_api_tx_hdr_number_of_frames_in_queue) { - ftdmchan->iostats.tx.idle_packets = tx_stats->wp_api_tx_hdr_tx_idle_packets; + if (ftdmchan->iostats.tx.idle_packets < tx_stats->wp_api_tx_hdr_tx_idle_packets) { /* HDLC channels do not always transmit, so its ok for drivers to fill with idle * also do not report idle warning when we just started transmitting */ if (ftdmchan->iostats.tx.packets && FTDM_IS_VOICE_CHANNEL(ftdmchan)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Tx idle: %d\n", ftdmchan->iostats.tx.idle_packets); + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Tx idle changed from %d to %d\n", + ftdmchan->iostats.tx.idle_packets, tx_stats->wp_api_tx_hdr_tx_idle_packets); } + ftdmchan->iostats.tx.idle_packets = tx_stats->wp_api_tx_hdr_tx_idle_packets; } if (!ftdmchan->iostats.tx.packets) { @@ -941,7 +942,6 @@ static FIO_WRITE_FUNCTION(wanpipe_write) { int bsent = 0; int err = 0; - ftdm_time_t ms = 0; wp_tdm_api_tx_hdr_t hdrframe; /* Do we even need the headerframe here? on windows, we don't even pass it to the driver */ commit ff455e63f2eaf9140894be1b45e1801d402fb0c3 Merge: 002181e 86c484c Author: Moises Silva <moises.silva@gmail.com> Date: Fri Dec 10 06:52:48 2010 -0500 Merge branch 'master' of git.sangoma.com:smg_freeswitch commit 002181e143e5c56c554abeeb37c7611dcdad8536 Author: Moises Silva <moises.silva@gmail.com> Date: Fri Dec 10 06:52:04 2010 -0500 freetdm: fix serious mem leak in R2 module iterator usage diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 37070c4..e95a74b 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -1644,6 +1644,7 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) int index = 0; struct timeval start, end; ftdm_iterator_t *chaniter = NULL; + ftdm_iterator_t *citer = NULL; uint32_t txqueue_size = 4; short *poll_events = ftdm_malloc(sizeof(short) * span->chan_count); @@ -1654,8 +1655,12 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) ftdm_log(FTDM_LOG_DEBUG, "OpenR2 monitor thread %lu started.\n", r2data->monitor_thread_id); r2chan = NULL; chaniter = ftdm_span_get_chan_iterator(span, NULL); - for (i = 1; chaniter; chaniter = ftdm_iterator_next(chaniter), i++) { - ftdmchan = ftdm_iterator_current(chaniter); + if (!chaniter) { + ftdm_log(FTDM_LOG_CRIT, "Failed to allocate channel iterator for span %s!\n", span->name); + goto done; + } + for (i = 1, citer = chaniter; citer; citer = ftdm_iterator_next(citer), i++) { + ftdmchan = ftdm_iterator_current(citer); r2chan = R2CALL(ftdmchan)->r2chan; openr2_chan_set_span_id(r2chan, span->span_id); openr2_chan_set_idle(r2chan); @@ -1694,9 +1699,13 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) /* figure out what event to poll each channel for. POLLPRI when the channel is down, * POLLPRI|POLLIN|POLLOUT otherwise */ memset(poll_events, 0, sizeof(short)*span->chan_count); - chaniter = ftdm_span_get_chan_iterator(span, chaniter); - for (i = 0; chaniter; chaniter = ftdm_iterator_next(chaniter), i++) { - ftdmchan = ftdm_iterator_current(chaniter); + citer = ftdm_span_get_chan_iterator(span, chaniter); + if (!citer) { + ftdm_log(FTDM_LOG_CRIT, "Failed to allocate channel iterator for span %s!\n", span->name); + goto done; + } + for (i = 0; citer; citer = ftdm_iterator_next(citer), i++) { + ftdmchan = ftdm_iterator_current(citer); r2chan = R2CALL(ftdmchan)->r2chan; poll_events[i] = POLLPRI; if (openr2_chan_get_read_enabled(r2chan)) { @@ -1737,9 +1746,9 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) /* this main loop takes care of MF and CAS signaling during call setup and tear down * for every single channel in the span, do not perform blocking operations here! */ - chaniter = ftdm_span_get_chan_iterator(span, chaniter); - for ( ; chaniter; chaniter = ftdm_iterator_next(chaniter)) { - ftdmchan = ftdm_iterator_current(chaniter); + citer = ftdm_span_get_chan_iterator(span, chaniter); + for ( ; citer; citer = ftdm_iterator_next(citer)) { + ftdmchan = ftdm_iterator_current(citer); ftdm_mutex_lock(ftdmchan->mutex); @@ -1766,10 +1775,11 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) ftdm_mutex_unlock(ftdmchan->mutex); } } - - chaniter = ftdm_span_get_chan_iterator(span, chaniter); - for ( ; chaniter; chaniter = ftdm_iterator_next(chaniter)) { - ftdmchan = ftdm_iterator_current(chaniter); + +done: + citer = ftdm_span_get_chan_iterator(span, chaniter); + for ( ; citer; citer = ftdm_iterator_next(citer)) { + ftdmchan = ftdm_iterator_current(citer); r2chan = R2CALL(ftdmchan)->r2chan; openr2_chan_set_blocked(r2chan); } commit 3406d05ba7fafb8e20f69bede72db3564bf8b198 Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Dec 9 23:05:49 2010 -0600 Fix fallback to CORE_DB when MSSQL fails init diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 4364ff2..b561ebe 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -1624,6 +1624,7 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_ runtime.odbc_dsn = NULL; runtime.odbc_user = NULL; runtime.odbc_pass = NULL; + runtime.odbc_dbtype = DBTYPE_DEFAULT; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Falling back to core_db.\n"); goto top; } commit 0b716f21b4caac60d01c58ef5471c97421fc2685 Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Dec 9 18:01:31 2010 -0500 freetdm: added support for skip states, used by sangoma_isdn module diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index a54c515..0ec3b57 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2204,31 +2204,31 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_answer(const char *file, const char goto done; } -#ifndef FREETDM_SKIP_SIG_STATES - /* We will fail RFC's if we not skip states, but some modules apart from ftmod_sangoma_isdn - * expect the call to always to go PROGRESS and PROGRESS MEDIA state before going to UP, so - * remove this only in netborder branch for now while we update the sig modules */ + if (!ftdm_test_flag(ftdmchan->span, FTDM_SPAN_USE_SKIP_STATES)) { + /* We will fail RFC's if we not skip states, but some modules apart from ftmod_sangoma_isdn + * expect the call to always to go PROGRESS and PROGRESS MEDIA state before going to UP, so + * use FTDM_SPAN_USE_SKIP_STATESfor now while we update the sig modules */ - if (ftdmchan->state < FTDM_CHANNEL_STATE_PROGRESS) { - ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS, 1); - } + if (ftdmchan->state < FTDM_CHANNEL_STATE_PROGRESS) { + ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS, 1); + } - /* set state unlocks the channel so we need to re-confirm that the channel hasn't gone to hell */ - if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call has moved to TERMINATING while we're moving to PROGRESS\n"); - goto done; - } + /* set state unlocks the channel so we need to re-confirm that the channel hasn't gone to hell */ + if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call has moved to TERMINATING while we're moving to PROGRESS\n"); + goto done; + } - if (ftdmchan->state < FTDM_CHANNEL_STATE_PROGRESS_MEDIA) { - ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, 1); - } + if (ftdmchan->state < FTDM_CHANNEL_STATE_PROGRESS_MEDIA) { + ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, 1); + } - /* set state unlocks the channel so we need to re-confirm that the channel hasn't gone to hell */ - if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call has moved to TERMINATING while we're moving to UP\n"); - goto done; + /* set state unlocks the channel so we need to re-confirm that the channel hasn't gone to hell */ + if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call has moved to TERMINATING while we're moving to UP\n"); + goto done; + } } -#endif ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_UP, 1); done: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 72f4b28..f7e6597 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -1066,6 +1066,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_isdn_span_config) ftdm_set_flag(span, FTDM_SPAN_USE_CHAN_QUEUE); ftdm_set_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE); ftdm_set_flag(span, FTDM_SPAN_USE_PROCEED_STATE); + ftdm_set_flag(span, FTDM_SPAN_USE_SKIP_STATES); if (span->trunk_type == FTDM_TRUNK_BRI_PTMP || span->trunk_type == FTDM_TRUNK_BRI) { diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index db1428c..40b9015 100644 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -184,6 +184,9 @@ typedef enum { FTDM_SPAN_USE_SIGNALS_QUEUE = (1 << 10), /* If this flag is set, channel will be moved to proceed state when calls goes to routing */ FTDM_SPAN_USE_PROCEED_STATE = (1 << 11), + /* If this flag is set, the signalling module supports jumping directly to state up, without + going through PROGRESS/PROGRESS_MEDIA */ + FTDM_SPAN_USE_SKIP_STATES = (1 << 12), } ftdm_span_flag_t; /*! \brief Channel supported features */ commit 86c484c134ca46edd572c3b46c6480ac9011292b Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Dec 9 18:01:31 2010 -0500 freetdm: added support for skip states, used by sangoma_isdn module diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 605f13c..eaa25e3 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2213,31 +2213,31 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_answer(const char *file, const char goto done; } -#ifndef FREETDM_SKIP_SIG_STATES - /* We will fail RFC's if we not skip states, but some modules apart from ftmod_sangoma_isdn - * expect the call to always to go PROGRESS and PROGRESS MEDIA state before going to UP, so - * remove this only in netborder branch for now while we update the sig modules */ + if (!ftdm_test_flag(ftdmchan->span, FTDM_SPAN_USE_SKIP_STATES)) { + /* We will fail RFC's if we not skip states, but some modules apart from ftmod_sangoma_isdn + * expect the call to always to go PROGRESS and PROGRESS MEDIA state before going to UP, so + * use FTDM_SPAN_USE_SKIP_STATESfor now while we update the sig modules */ - if (ftdmchan->state < FTDM_CHANNEL_STATE_PROGRESS) { - ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS, 1); - } + if (ftdmchan->state < FTDM_CHANNEL_STATE_PROGRESS) { + ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS, 1); + } - /* set state unlocks the channel so we need to re-confirm that the channel hasn't gone to hell */ - if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call has moved to TERMINATING while we're moving to PROGRESS\n"); - goto done; - } + /* set state unlocks the channel so we need to re-confirm that the channel hasn't gone to hell */ + if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call has moved to TERMINATING while we're moving to PROGRESS\n"); + goto done; + } - if (ftdmchan->state < FTDM_CHANNEL_STATE_PROGRESS_MEDIA) { - ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, 1); - } + if (ftdmchan->state < FTDM_CHANNEL_STATE_PROGRESS_MEDIA) { + ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, 1); + } - /* set state unlocks the channel so we need to re-confirm that the channel hasn't gone to hell */ - if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call has moved to TERMINATING while we're moving to UP\n"); - goto done; + /* set state unlocks the channel so we need to re-confirm that the channel hasn't gone to hell */ + if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call has moved to TERMINATING while we're moving to UP\n"); + goto done; + } } -#endif ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_UP, 1); done: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 96f1a2b..e20d3ae 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -1067,6 +1067,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_isdn_span_config) ftdm_set_flag(span, FTDM_SPAN_USE_CHAN_QUEUE); ftdm_set_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE); ftdm_set_flag(span, FTDM_SPAN_USE_PROCEED_STATE); + ftdm_set_flag(span, FTDM_SPAN_USE_SKIP_STATES); if (span->trunk_type == FTDM_TRUNK_BRI_PTMP || span->trunk_type == FTDM_TRUNK_BRI) { diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index df74702..313044a 100644 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -184,6 +184,9 @@ typedef enum { FTDM_SPAN_USE_SIGNALS_QUEUE = (1 << 10), /* If this flag is set, channel will be moved to proceed state when calls goes to routing */ FTDM_SPAN_USE_PROCEED_STATE = (1 << 11), + /* If this flag is set, the signalling module supports jumping directly to state up, without + going through PROGRESS/PROGRESS_MEDIA */ + FTDM_SPAN_USE_SKIP_STATES = (1 << 12), } ftdm_span_flag_t; /*! \brief Channel supported features */ commit fced79a4933560500a5710af3c48019da700948b Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Dec 9 17:13:34 2010 -0500 fix not handling disconnect when in RINGING state diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index cb9f6d3..fb65d20 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -407,6 +407,7 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) } break; case FTDM_CHANNEL_STATE_RING: + case FTDM_CHANNEL_STATE_RINGING: case FTDM_CHANNEL_STATE_PROCEED: case FTDM_CHANNEL_STATE_PROGRESS: case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: @@ -447,6 +448,7 @@ void sngisdn_process_disc_ind (sngisdn_event_data_t *sngisdn_event) ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n"); switch (ftdmchan->state) { case FTDM_CHANNEL_STATE_RING: + case FTDM_CHANNEL_STATE_RINGING: case FTDM_CHANNEL_STATE_DIALING: case FTDM_CHANNEL_STATE_PROCEED: case FTDM_CHANNEL_STATE_PROGRESS: @@ -537,6 +539,7 @@ void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event) case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: case FTDM_CHANNEL_STATE_UP: case FTDM_CHANNEL_STATE_RING: + case FTDM_CHANNEL_STATE_RINGING: /* If we previously had a glare on this channel, this RELEASE could be for the previous call. Confirm whether call_data has not changed while we were waiting for ftdmchan->mutex by comparing suInstId's */ @@ -881,6 +884,7 @@ void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event) break; case FTDM_CHANNEL_STATE_PROCEED: case FTDM_CHANNEL_STATE_PROGRESS: + case FTDM_CHANNEL_STATE_RINGING: case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Remote switch expecting OVERLAP receive, but we are already PROCEEDING\n"); sngisdn_snd_disconnect(ftdmchan); @@ -899,6 +903,7 @@ void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event) switch (ftdmchan->state) { case FTDM_CHANNEL_STATE_PROCEED: case FTDM_CHANNEL_STATE_PROGRESS: + case FTDM_CHANNEL_STATE_RINGING: /* T310 timer has expired */ ftdmchan->caller_data.hangup_cause = staEvnt->causeDgn[0].causeVal.val; ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "T310 Timer expired, hanging up call\n"); @@ -935,6 +940,7 @@ void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event) break; case 9: /* Remote switch is in "Incoming call proceeding" state */ switch (ftdmchan->state) { + case FTDM_CHANNEL_STATE_RINGING: case FTDM_CHANNEL_STATE_PROGRESS: case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: case FTDM_CHANNEL_STATE_GET_CALLERID: commit 1a730cb715af3dd52e93c6680d63d04a0ebfd703 Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Dec 9 17:13:34 2010 -0500 fix not handling disconnect when in RINGING state diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index f0eec06..fb34f8e 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -407,6 +407,7 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) } break; case FTDM_CHANNEL_STATE_RING: + case FTDM_CHANNEL_STATE_RINGING: case FTDM_CHANNEL_STATE_PROCEED: case FTDM_CHANNEL_STATE_PROGRESS: case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: @@ -447,6 +448,7 @@ void sngisdn_process_disc_ind (sngisdn_event_data_t *sngisdn_event) ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n"); switch (ftdmchan->state) { case FTDM_CHANNEL_STATE_RING: + case FTDM_CHANNEL_STATE_RINGING: case FTDM_CHANNEL_STATE_DIALING: case FTDM_CHANNEL_STATE_PROCEED: case FTDM_CHANNEL_STATE_PROGRESS: @@ -537,6 +539,7 @@ void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event) case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: case FTDM_CHANNEL_STATE_UP: case FTDM_CHANNEL_STATE_RING: + case FTDM_CHANNEL_STATE_RINGING: /* If we previously had a glare on this channel, this RELEASE could be for the previous call. Confirm whether call_data has not changed while we were waiting for ftdmchan->mutex by comparing suInstId's */ @@ -881,6 +884,7 @@ void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event) break; case FTDM_CHANNEL_STATE_PROCEED: case FTDM_CHANNEL_STATE_PROGRESS: + case FTDM_CHANNEL_STATE_RINGING: case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Remote switch expecting OVERLAP receive, but we are already PROCEEDING\n"); sngisdn_snd_disconnect(ftdmchan); @@ -899,6 +903,7 @@ void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event) switch (ftdmchan->state) { case FTDM_CHANNEL_STATE_PROCEED: case FTDM_CHANNEL_STATE_PROGRESS: + case FTDM_CHANNEL_STATE_RINGING: /* T310 timer has expired */ ftdmchan->caller_data.hangup_cause = staEvnt->causeDgn[0].causeVal.val; ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "T310 Timer expired, hanging up call\n"); @@ -935,6 +940,7 @@ void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event) break; case 9: /* Remote switch is in "Incoming call proceeding" state */ switch (ftdmchan->state) { + case FTDM_CHANNEL_STATE_RINGING: case FTDM_CHANNEL_STATE_PROGRESS: case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: case FTDM_CHANNEL_STATE_GET_CALLERID: commit 6e24f55859138d092ac38506085676078162d0a3 Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Dec 9 16:09:00 2010 -0500 Minor fixes diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index fc5070c..72f4b28 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -915,7 +915,6 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(ftdm_sangoma_isdn_outgoing_call) ftdm_channel_unlock(ftdmchan); return status; } - static FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(ftdm_sangoma_isdn_get_chan_sig_status) { if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 4357b5c..f0eec06 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -354,17 +354,18 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); goto sngisdn_process_cnst_ind_end; } - + switch(ftdmchan->state) { case FTDM_CHANNEL_STATE_DIALING: case FTDM_CHANNEL_STATE_PROCEED: if (cnStEvnt->progInd.eh.pres && cnStEvnt->progInd.progDesc.val == IN_PD_IBAVAIL) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); - } else if (evntType == MI_CALLPROC) { + } else if (evntType == MI_CALLPROC) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROCEED); } else { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); } + break; case FTDM_CHANNEL_STATE_PROGRESS: if (cnStEvnt->progInd.eh.pres && cnStEvnt->progInd.progDesc.val == IN_PD_IBAVAIL) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); commit c6e7988bf87c910ce19366c40694f1e14fd58cb3 Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Dec 9 14:25:39 2010 -0600 FS-2904 detect_speech documentation incomplete diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 4fd6a67..eaff5b9 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -269,7 +269,7 @@ SWITCH_STANDARD_APP(bind_digit_action_function) } -#define DETECT_SPEECH_SYNTAX "<mod_name> <gram_name> <gram_path> [<addr>] OR grammar <gram_name> [<path>] OR pause OR resume" +#define DETECT_SPEECH_SYNTAX "<mod_name> <gram_name> <gram_path> [<addr>] OR grammar <gram_name> [<path>] OR nogrammar <gram_name> OR pause OR resume OR stop OR param <name> <value>" SWITCH_STANDARD_APP(detect_speech_function) { char *argv[4]; commit 38ca557ad931559b4d58d8fc4de986a4ed1405ad Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Tue Dec 7 20:33:23 2010 -0200 freetdm: ftmod_r2 - fixed complation warnings on windows diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index f0a3df6..a54c515 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -104,7 +104,7 @@ static void write_chan_io_dump(ftdm_io_dump_t *dump, char *dataptr, int dlen) if (dlen > avail) { int diff = dlen - avail; - ftdm_assert(diff < dump->size, "Very small buffer or very big IO chunk!\n"); + ftdm_assert(diff < (int)dump->size, "Very small buffer or very big IO chunk!\n"); /* write only what we can and the rest at the beginning of the buffer */ memcpy(&dump->buffer[windex], dataptr, avail); @@ -118,7 +118,7 @@ static void write_chan_io_dump(ftdm_io_dump_t *dump, char *dataptr, int dlen) windex += dlen; } - if (windex == dump->size) { + if (windex == (int)dump->size) { /*ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "wrapping around dump buffer %p\n", dump);*/ windex = 0; dump->wrapped = 1; @@ -3421,8 +3421,8 @@ static FIO_READ_FUNCTION(ftdm_raw_read) { ftdm_status_t status = ftdmchan->fio->read(ftdmchan, data, datalen); if (status == FTDM_SUCCESS && ftdmchan->fds[FTDM_READ_TRACE_INDEX] > -1) { - int dlen = (int) *datalen; - if (write(ftdmchan->fds[FTDM_READ_TRACE_INDEX], data, dlen) != dlen) { + ftdm_size_t dlen = *datalen; + if ((ftdm_size_t)write(ftdmchan->fds[FTDM_READ_TRACE_INDEX], data, dlen) != dlen) { ftdm_log(FTDM_LOG_WARNING, "Raw input trace failed to write all of the %zd bytes\n", dlen); } } @@ -3432,8 +3432,8 @@ static FIO_READ_FUNCTION(ftdm_raw_read) } if (status == FTDM_SUCCESS) { - int dlen = (int) *datalen; - size_t rc = 0; + ftdm_size_t dlen = *datalen; + ftdm_size_t rc = 0; write_chan_io_dump(&ftdmchan->rxdump, data, dlen); commit 8016813234b471e5636bcff963f5a4ed3391d972 Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Dec 9 14:03:09 2010 -0600 freetdm VS2010 build fix diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.2010.vcxproj b/libs/freetdm/mod_freetdm/mod_freetdm.2010.vcxproj index ec69333..9f01a3b 100644 --- a/libs/freetdm/mod_freetdm/mod_freetdm.2010.vcxproj +++ b/libs/freetdm/mod_freetdm/mod_freetdm.2010.vcxproj @@ -103,7 +103,7 @@ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> <Link> - <AdditionalDependencies>FreeSwitchCore.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>FreeSwitch.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalLibraryDirectories>../../../$(PlatformName)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <GenerateDebugInformation>true</GenerateDebugInformation> <ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile> @@ -127,7 +127,7 @@ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> <Link> - <AdditionalDependencies>FreeSwitchCore.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>FreeSwitch.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalLibraryDirectories>../../../$(PlatformName)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <GenerateDebugInformation>true</GenerateDebugInformation> <ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile> commit 7b371be267ebd4dd3b74b6a1d21304c0ac527731 Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Dec 9 14:08:31 2010 -0500 Fix for compilation issue diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index ca0c4f8..4357b5c 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -325,8 +325,6 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - CnStEvnt *cnStEvnt = &sngisdn_event->event.cnStEvnt; ISDN_FUNC_TRACE_ENTER(__FUNCTION__); commit d3ddd29e8bfc2b36f8c7c2d475c1d4cf630c8388 Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Dec 9 13:47:40 2010 -0500 freetdm: fix compilation diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index e9dcf09..f0a3df6 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -3840,7 +3840,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_write(ftdm_channel_t *ftdmchan, void *dat FT_DECLARE(void) ftdm_call_clear_data(ftdm_caller_data_t *caller_data) { ftdm_call_clear_vars(caller_data); - memset(caller_data.raw_data, 0, sizeof(raw_data)); + memset(&caller_data->raw_data, 0, sizeof(caller_data->raw_data)); caller_data->raw_data_len = 0; return; } commit 502116e4a08d518cc119785e44049aa9e6a8059a Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Dec 9 13:20:05 2010 -0500 freetdm: support for call variables diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index ca16e8b..6c0d8bd 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -429,7 +429,7 @@ static switch_status_t channel_on_routing(switch_core_session_t *session) assert(tech_pvt->ftdmchan != NULL); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL ROUTING\n", switch_channel_get_name(channel)); - + ftdm_channel_call_indicate(tech_pvt->ftdmchan, FTDM_CHANNEL_INDICATE_PROCEED); return SWITCH_STATUS_SUCCESS; } @@ -1329,7 +1329,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi char *v = h->name + FREETDM_VAR_PREFIX_LEN; if (!zstr(v)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding outbound freetdm variable %s=%s to channel %d:%d\n", v, h->value, span_id, chan_id); - ftdm_channel_add_var(ftdmchan, v, h->value); + ftdm_call_add_var(&caller_data, v, h->value); } } } @@ -1528,6 +1528,7 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session switch_channel_set_variable_printf(channel, "freetdm_chan_number", "%d", chanid); switch_channel_set_variable_printf(channel, "freetdm_bearer_capability", "%d", channel_caller_data->bearer_capability); switch_channel_set_variable_printf(channel, "freetdm_bearer_layer1", "%d", channel_caller_data->bearer_layer1); + if (globals.sip_headers) { switch_channel_set_variable(channel, "sip_h_X-FreeTDM-SpanName", ftdm_channel_get_span_name(sigmsg->channel)); switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-SpanNumber", "%d", spanid); @@ -1561,8 +1562,18 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session ftdm_channel_get_current_var(curr, &var_name, &var_value); snprintf(name, sizeof(name), FREETDM_VAR_PREFIX "%s", var_name); switch_channel_set_variable_printf(channel, name, "%s", var_value); + } + + /* Add any call variable to the dial plan */ + iter = ftdm_call_get_var_iterator(channel_caller_data, iter); + for (curr = iter ; curr; curr = ftdm_iterator_next(curr)) { + ftdm_call_get_current_var(curr, &var_name, &var_value); + snprintf(name, sizeof(name), FREETDM_VAR_PREFIX "%s", var_name); + switch_channel_set_variable_printf(channel, name, "%s", var_value); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Call Variable: %s=%s\n", name, var_value); } ftdm_iterator_free(iter); + switch_channel_set_state(channel, CS_INIT); if (switch_core_session_thread_launch(session) != SWITCH_STATUS_SUCCESS) { @@ -1661,11 +1672,11 @@ static FIO_SIGNAL_CB_FUNCTION(on_fxo_signal) ftdm_status_t status; uint32_t spanid; uint32_t chanid; - ftdm_caller_data_t *callerdata; + ftdm_caller_data_t *caller_data; spanid = ftdm_channel_get_span_id(sigmsg->channel); chanid = ftdm_channel_get_id(sigmsg->channel); - callerdata = ftdm_channel_get_caller_data(sigmsg->channel); + caller_data = ftdm_channel_get_caller_data(sigmsg->channel); ftdm_log(FTDM_LOG_DEBUG, "got FXO sig %d:%d [%s]\n", spanid, chanid, ftdm_signal_event2str(sigmsg->event_id)); @@ -1688,7 +1699,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_fxo_signal) switch_set_flag_locked(tech_pvt, TFLAG_DEAD); ftdm_channel_clear_token(sigmsg->channel, 0); channel = switch_core_session_get_channel(session); - switch_channel_hangup(channel, callerdata->hangup_cause); + switch_channel_hangup(channel, caller_data->hangup_cause); ftdm_channel_clear_token(sigmsg->channel, switch_core_session_get_uuid(session)); switch_core_session_rwunlock(session); } @@ -1712,8 +1723,8 @@ static FIO_SIGNAL_CB_FUNCTION(on_fxo_signal) } } break; - case FTDM_SIGEVENT_RELEASED: { /* twiddle */ } break; - + case FTDM_SIGEVENT_RELEASED: { /* twiddle */ } break; + default: { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unhandled msg type %d for channel %d:%d\n", @@ -1767,7 +1778,8 @@ static FIO_SIGNAL_CB_FUNCTION(on_fxs_signal) } } break; - case FTDM_SIGEVENT_RELEASED: { /* twiddle */ } break; + case FTDM_SIGEVENT_RELEASED: { /* twiddle */ } break; + case FTDM_SIGEVENT_STOP: { private_t *tech_pvt = NULL; @@ -1991,8 +2003,8 @@ static FIO_SIGNAL_CB_FUNCTION(on_r2_signal) } break; - case FTDM_SIGEVENT_RELEASED: { /* twiddle */ } break; - + case FTDM_SIGEVENT_RELEASED: { /* twiddle */ } break; + /* on DNIS received from the R2 forward side, return status == FTDM_BREAK to stop requesting DNIS */ case FTDM_SIGEVENT_COLLECTED_DIGIT: { @@ -2095,14 +2107,14 @@ static FIO_SIGNAL_CB_FUNCTION(on_clear_channel_signal) switch(sigmsg->event_id) { case FTDM_SIGEVENT_START: { - ftdm_channel_add_var(sigmsg->channel, "screening_ind", ftdm_screening2str(caller_data->screen)); - ftdm_channel_add_var(sigmsg->channel, "presentation_ind", ftdm_presentation2str(caller_data->pres)); + ftdm_call_add_var(caller_data, "screening_ind", ftdm_screening2str(caller_data->screen)); + ftdm_call_add_var(caller_data, "presentation_ind", ftdm_presentation2str(caller_data->pres)); return ftdm_channel_from_event(sigmsg, &session); } break; - case FTDM_SIGEVENT_RELEASED: { /* twiddle */ } break; - + case FTDM_SIGEVENT_RELEASED: { /* twiddle */ } break; + case FTDM_SIGEVENT_STOP: case FTDM_SIGEVENT_RESTART: { @@ -2167,7 +2179,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_clear_channel_signal) } break; case FTDM_SIGEVENT_PROCEED: - case FTDM_SIGEVENT_MSG: + case FTDM_SIGEVENT_FACILITY: /* FS does not have handlers for these messages, so ignore them for now */ break; default: diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 8411986..e9dcf09 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -61,6 +61,8 @@ struct tm *localtime_r(const time_t *clock, struct tm *result); ftdm_time_t time_last_throttle_log = 0; ftdm_time_t time_current_throttle_log = 0; +static ftdm_iterator_t *get_iterator(ftdm_iterator_type_t type, ftdm_iterator_t *iter); + static int time_is_init = 0; static void time_init(void) @@ -1884,7 +1886,9 @@ static ftdm_status_t ftdm_channel_reset(ftdm_channel_t *ftdmchan) if (!ftdmchan->dtmf_off) { ftdmchan->dtmf_off = FTDM_DEFAULT_DTMF_OFF; } - + + ftdm_call_clear_vars(&ftdmchan->caller_data); + memset(ftdmchan->dtmf_hangup_buf, '\0', ftdmchan->span->dtmf_hangup_len); if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_TRANSCODE)) { @@ -2423,6 +2427,27 @@ done: return FTDM_SUCCESS; } +FT_DECLARE(ftdm_status_t) _ftdm_channel_call_send_msg(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_sigmsg_t *sigmsg) +{ + ftdm_status_t status = FTDM_FAIL; + ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "null channel"); +#ifdef __WINDOWS__ + UNREFERENCED_PARAMETER(file); + UNREFERENCED_PARAMETER(func); + UNREFERENCED_PARAMETER(line); +#endif + + ftdm_channel_lock(ftdmchan); + if (ftdmchan->span->send_msg) { + status = ftdmchan->span->send_msg(ftdmchan, sigmsg); + } else { + status = FTDM_NOTIMPL; + ftdm_log(FTDM_LOG_ERROR, "send_msg method not implemented in this span!\n"); + } + ftdm_channel_unlock(ftdmchan); + return status; +} + FT_DECLARE(ftdm_status_t) _ftdm_channel_call_place(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan) { ftdm_status_t status = FTDM_FAIL; @@ -3812,6 +3837,100 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_write(ftdm_channel_t *ftdmchan, void *dat return status; } +FT_DECLARE(void) ftdm_call_clear_data(ftdm_caller_data_t *caller_data) +{ + ftdm_call_clear_vars(caller_data); + memset(caller_data.raw_data, 0, sizeof(raw_data)); + caller_data->raw_data_len = 0; + return; +} + +FT_DECLARE(ftdm_status_t) ftdm_call_clear_vars(ftdm_caller_data_t *caller_data) +{ + if (caller_data->variables) { + hashtable_destroy(caller_data->variables); + } + caller_data->variables = NULL; + return FTDM_SUCCESS; +} + +FT_DECLARE(ftdm_status_t) ftdm_call_remove_var(ftdm_caller_data_t *caller_data, const char *var_name) +{ + if (caller_data->variables) { + hashtable_remove(caller_data->variables, (void *)var_name); + } + + return FTDM_SUCCESS; +} + + +FT_DECLARE(ftdm_status_t) ftdm_call_add_var(ftdm_caller_data_t *caller_data, const char *var_name, const char *value) +{ + char *t_name = 0, *t_val = 0; + + if (!var_name || !value) { + return FTDM_FAIL; + } + + if (!caller_data->variables) { + /* initialize on first use */ + caller_data->variables = create_hashtable(16, ftdm_hash_hashfromstring, ftdm_hash_equalkeys); + ftdm_assert_return(caller_data->variables, FTDM_FAIL, "Failed to create hash table\n"); + } + + t_name = ftdm_strdup(var_name); + t_val = ftdm_strdup(value); + hashtable_insert(caller_data->variables, t_name, t_val, HASHTABLE_FLAG_FREE_KEY | HASHTABLE_FLAG_FREE_VALUE); + return FTDM_SUCCESS; +} + +FT_DECLARE(const char *) ftdm_call_get_var(ftdm_caller_data_t *caller_data, const char *var_name) +{ + const char *var = NULL; + + if (!caller_data->variables || !var_name) { + return NULL; + } + + var = (const char *)hashtable_search(((struct hashtable*)caller_data->variables), (void *)var_name); + return var; +} + +FT_DECLARE(ftdm_iterator_t *) ftdm_call_get_var_iterator(const ftdm_caller_data_t *caller_data, ftdm_iterator_t *iter) +{ + ftdm_hash_iterator_t *hashiter = NULL; + hashiter = caller_data->variables == NULL ? NULL : hashtable_first(caller_data->variables); + + if (hashiter == NULL) { + return NULL; + } + + if (!(iter = get_iterator(FTDM_ITERATOR_VARS, iter))) { + return NULL; + } + iter->pvt.hashiter = hashiter; + return iter; +} + +FT_DECLARE(ftdm_status_t) ftdm_call_get_current_var(ftdm_iterator_t *iter, const char **var_name, const char **var_val) +{ + const void *key = NULL; + void *val = NULL; + + *var_name = NULL; + *var_val = NULL; + + ftdm_assert_return(iter && (iter->type == FTDM_ITERATOR_VARS) && iter->pvt.hashiter, FTDM_FAIL, "Cannot get variable from invalid iterator!\n"); + + hashtable_this(iter->pvt.hashiter, &key, NULL, &val); + + *var_name = key; + *var_val = val; + + return FTDM_SUCCESS; +} + + static ftdm_status_t ftdm_channel_clear_vars(ftdm_channel_t *ftdmchan) { ftdm_channel_lock(ftdmchan); @@ -3858,6 +3977,7 @@ done: return status; } + FT_DECLARE(const char *) ftdm_channel_get_var(ftdm_channel_t *ftdmchan, const char *var_name) { const char *var = NULL; @@ -5037,7 +5157,11 @@ FT_DECLARE(ftdm_status_t) ftdm_group_create(ftdm_group_t **group, const char *na static ftdm_status_t ftdm_span_trigger_signal(const ftdm_span_t *span, ftdm_sigmsg_t *sigmsg) { - return span->signal_cb(sigmsg); + ftdm_status_t status = span->signal_cb(sigmsg); + if (sigmsg->channel) { + ftdm_call_clear_data(&(sigmsg->channel->caller_data)); + } + return status; } static ftdm_status_t ftdm_span_queue_signal(const ftdm_span_t *span, ftdm_sigmsg_t *sigmsg) @@ -5141,6 +5265,7 @@ FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t } done: + if (sigmsg->channel) { ftdm_mutex_unlock(sigmsg->channel->mutex); } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index e592624..fc5070c 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -626,8 +626,11 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) case FTDM_CHANNEL_STATE_GET_CALLERID: { if (!sngisdn_test_flag(sngisdn_info, FLAG_SENT_PROCEED)) { + /* By default, we do not send a progress indicator in the proceed */ + ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_INVALID}; + sngisdn_set_flag(sngisdn_info, FLAG_SENT_PROCEED); - sngisdn_snd_proceed(ftdmchan); + sngisdn_snd_proceed(ftdmchan, prog_ind); } /* Wait in this state until we get FACILITY msg */ } @@ -666,8 +669,11 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) ftdm_span_send_signal(ftdmchan->span, &sigev); } else { if (!sngisdn_test_flag(sngisdn_info, FLAG_SENT_PROCEED)) { + /* By default, we do not send a progress indicator in the proceed */ + ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_INVALID}; + sngisdn_set_flag(sngisdn_info, FLAG_SENT_PROCEED); - sngisdn_snd_proceed(ftdmchan); + sngisdn_snd_proceed(ftdmchan, prog_ind); } } } @@ -851,6 +857,26 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) return; } +static FIO_CHANNEL_SEND_MSG_FUNCTION(ftdm_sangoma_isdn_send_msg) +{ + ftdm_status_t status = FTDM_FAIL; + + switch (sigmsg->event_id) { + case FTDM_SIGEVENT_RESTART: + /* TODO: Send a channel restart here */ + /* Implement me */ + break; + case FTDM_SIGEVENT_FACILITY: + sngisdn_snd_fac_req(ftdmchan); + break; + default: + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Unsupported signalling msg requested\n"); + status = FTDM_BREAK; + } + ftdm_call_clear_data(&ftdmchan->caller_data); + return status; +} + static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(ftdm_sangoma_isdn_outgoing_call) { sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data; @@ -1030,6 +1056,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_isdn_span_config) span->stop = ftdm_sangoma_isdn_stop; span->signal_type = FTDM_SIGTYPE_ISDN; span->outgoing_call = ftdm_sangoma_isdn_outgoing_call; + span->send_msg = ftdm_sangoma_isdn_send_msg; span->channel_request = NULL; span->signal_cb = sig_cb; span->get_channel_sig_status = ftdm_sangoma_isdn_get_chan_sig_status; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 9172dab..eee363c 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -297,7 +297,7 @@ void stack_pst_init(Pst *pst); /* Outbound Call Control functions */ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan); void sngisdn_snd_setup_ack(ftdm_channel_t *ftdmchan); -void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan); +void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind); void sngisdn_snd_progress(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind); void sngisdn_snd_alert(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind); void sngisdn_snd_connect(ftdm_channel_t *ftdmchan); @@ -370,6 +370,7 @@ void sngisdn_rcv_sng_log(uint8_t level, char *fmt,...); void sngisdn_rcv_sng_assert(char *message); ftdm_status_t get_calling_num(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb); +ftdm_status_t get_calling_num2(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb); ftdm_status_t get_called_num(ftdm_channel_t *ftdmchan, CdPtyNmb *cdPtyNmb); ftdm_status_t get_redir_num(ftdm_channel_t *ftdmchan, RedirNmb *redirNmb); ftdm_status_t get_calling_name_from_display(ftdm_channel_t *ftdmchan, Display *display); @@ -377,16 +378,17 @@ ftdm_status_t get_calling_name_from_usr_usr(ftdm_channel_t *ftdmchan, UsrUsr *us ftdm_status_t get_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad); ftdm_status_t get_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd); ftdm_status_t get_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr); -ftdm_status_t get_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, ftdm_size_t data_len); +ftdm_status_t get_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, uint8_t data_len); ftdm_status_t set_calling_num(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb); +ftdm_status_t set_calling_num2(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb); ftdm_status_t set_called_num(ftdm_channel_t *ftdmchan, CdPtyNmb *cdPtyNmb); ftdm_status_t set_redir_num(ftdm_channel_t *ftdmchan, RedirNmb *redirNmb); ftdm_status_t set_calling_name(ftdm_channel_t *ftdmchan, ConEvnt *conEvnt); ftdm_status_t set_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad); ftdm_status_t set_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd, ftdm_sngisdn_progind_t prog_ind); ftdm_status_t set_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr); -ftdm_status_t set_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, ftdm_size_t *data_len); +ftdm_status_t set_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, uint8_t *data_len); uint8_t sngisdn_get_infoTranCap_from_stack(ftdm_bearer_cap_t bearer_capability); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 8769288..ca0c4f8 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -123,12 +123,9 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) break; } -#if 0 - /* Export ftdmchan variables here if we need to */ - ftdm_channel_add_var(ftdmchan, "isdn_specific_var", "1"); -#endif /* Fill in call information */ get_calling_num(ftdmchan, &conEvnt->cgPtyNmb); + get_calling_num2(ftdmchan, &conEvnt->cgPtyNmb2); get_called_num(ftdmchan, &conEvnt->cdPtyNmb); get_redir_num(ftdmchan, &conEvnt->redirNmb); get_calling_subaddr(ftdmchan, &conEvnt->cgPtySad); @@ -758,14 +755,14 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event) { ftdm_sigmsg_t sigev; if (facEvnt->facElmt.facStr.pres) { - get_facility_ie_str(ftdmchan, &facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len); + get_facility_ie_str(ftdmchan, &facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len-2); } memset(&sigev, 0, sizeof(sigev)); sigev.chan_id = ftdmchan->chan_id; sigev.span_id = ftdmchan->span_id; sigev.channel = ftdmchan; - sigev.event_id = FTDM_SIGEVENT_MSG; + sigev.event_id = FTDM_SIGEVENT_FACILITY; ftdm_span_send_signal(ftdmchan->span, &sigev); } break; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 1a7814a..930b8c7 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -128,6 +128,7 @@ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) set_called_num(ftdmchan, &conEvnt.cdPtyNmb); set_calling_num(ftdmchan, &conEvnt.cgPtyNmb); + set_calling_num2(ftdmchan, &conEvnt.cgPtyNmb2); set_calling_subaddr(ftdmchan, &conEvnt.cgPtySad); set_redir_num(ftdmchan, &conEvnt.redirNmb); set_calling_name(ftdmchan, &conEvnt); @@ -262,10 +263,9 @@ void sngisdn_snd_con_complete(ftdm_channel_t *ftdmchan) } -void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan) +void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind) { CnStEvnt cnStEvnt; - sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; @@ -310,7 +310,9 @@ void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan) cnStEvnt.chanId.chanNmbSlotMap.val[0] = ftdmchan->physical_chan_id; } + set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); set_facility_ie(ftdmchan, &cnStEvnt.facilityStr); + ftdm_call_clear_data(&ftdmchan->caller_data); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending PROCEED (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); @@ -343,6 +345,7 @@ void sngisdn_snd_progress(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ memset(&cnStEvnt, 0, sizeof(cnStEvnt)); set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); set_facility_ie(ftdmchan, &cnStEvnt.facilityStr); + ftdm_call_clear_data(&ftdmchan->caller_data); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending PROGRESS (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); if(sng_isdn_con_status(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId,&cnStEvnt, MI_PROGRESS, signal_data->dchan_id, sngisdn_info->ces)) { @@ -369,6 +372,7 @@ void sngisdn_snd_alert(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); set_facility_ie(ftdmchan, &cnStEvnt.facilityStr); + ftdm_call_clear_data(&ftdmchan->caller_data); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending ALERT (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); @@ -428,6 +432,7 @@ void sngisdn_snd_connect(ftdm_channel_t *ftdmchan) set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); set_facility_ie(ftdmchan, &cnStEvnt.facilityStr); + ftdm_call_clear_data(&ftdmchan->caller_data); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending CONNECT (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); if (sng_isdn_con_response(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &cnStEvnt, signal_data->dchan_id, sngisdn_info->ces)) { @@ -450,10 +455,17 @@ void sngisdn_snd_fac_req(ftdm_channel_t *ftdmchan) memset(&facEvnt, 0, sizeof(facEvnt)); - set_facility_ie_str(ftdmchan, &facEvnt.facElmt.facStr.val[2], (ftdm_size_t*)&facEvnt.facElmt.facStr.len); + if (set_facility_ie_str(ftdmchan, &facEvnt.facElmt.facStr.val[2], (uint8_t*)&facEvnt.facElmt.facStr.len) != FTDM_SUCCESS) { + /* No point in sending a FACILITY message if there is no Facility IE to transmit */ + return; + } + ftdm_call_clear_data(&ftdmchan->caller_data); + facEvnt.facElmt.eh.pres = PRSNT_NODEF; + facEvnt.facElmt.facStr.pres = PRSNT_NODEF; facEvnt.facElmt.facStr.val[0] = 0x1C; - facEvnt.facElmt.facStr.val[1] = facEvnt.facElmt.facStr.len; + facEvnt.facElmt.facStr.val[1] = (uint8_t)facEvnt.facElmt.facStr.len; + facEvnt.facElmt.facStr.len +=2; /* Need to include the size of identifier + len */ ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending FACILITY (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); @@ -481,6 +493,8 @@ void sngisdn_snd_info_req(ftdm_channel_t *ftdmchan) //ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Sending INFO REQ\n"); + ftdm_call_clear_data(&ftdmchan->caller_data); + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending INFO REQ (suId:%d dchan:%d ces:%d)\n", signal_data->cc_id, signal_data->dchan_id, sngisdn_info->ces); if (sng_isdn_con_status(signal_data->cc_id, 0, 0, &cnStEvnt, MI_INFO, signal_data->dchan_id, sngisdn_info->ces)) { @@ -501,6 +515,8 @@ void sngisdn_snd_status_enq(ftdm_channel_t *ftdmchan) memset(&staEvnt, 0, sizeof(StaEvnt)); + ftdm_call_clear_data(&ftdmchan->caller_data); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending Status ENQ on suId:%d suInstId:%u spInstId:%d dchan:%d ces:%d\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); if (sng_isdn_status_request(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &staEvnt, MI_STATENQ)) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused Status ENQ request\n"); @@ -538,6 +554,7 @@ void sngisdn_snd_disconnect(ftdm_channel_t *ftdmchan) discEvnt.causeDgn[0].dgnVal.pres = NOTPRSNT; set_facility_ie(ftdmchan, &discEvnt.facilityStr); + ftdm_call_clear_data(&ftdmchan->caller_data); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending DISCONNECT (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); if (sng_isdn_disc_request(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &discEvnt)) { @@ -584,6 +601,7 @@ void sngisdn_snd_release(ftdm_channel_t *ftdmchan, uint8_t glare) } set_facility_ie(ftdmchan, &relEvnt.facilityStr); + ftdm_call_clear_data(&ftdmchan->caller_data); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending RELEASE/RELEASE COMPLETE (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, suInstId, spInstId); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 37d2938..860e17b 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -185,6 +185,39 @@ ftdm_status_t get_calling_num(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb) return FTDM_SUCCESS; } +ftdm_status_t get_calling_num2(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb) +{ + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; + if (cgPtyNmb->eh.pres != PRSNT_NODEF) { + return FTDM_FAIL; + } + + if (cgPtyNmb->screenInd.pres == PRSNT_NODEF) { + ftdm_call_add_var(caller_data, "isdn.cg_pty2.screen_ind", ftdm_screening2str(cgPtyNmb->screenInd.val)); + } + + if (cgPtyNmb->presInd0.pres == PRSNT_NODEF) { + ftdm_call_add_var(caller_data, "isdn.cg_pty2.presentation_ind", ftdm_presentation2str(cgPtyNmb->presInd0.val)); + } + + if (cgPtyNmb->nmbPlanId.pres == PRSNT_NODEF) { + ftdm_call_add_var(caller_data, "isdn.cg_pty2.npi", ftdm_npi2str(cgPtyNmb->nmbPlanId.val)); + } + + if (cgPtyNmb->typeNmb1.pres == PRSNT_NODEF) { + ftdm_call_add_var(caller_data, "isdn.cg_pty2.ton", ftdm_ton2str(cgPtyNmb->typeNmb1.val)); + } + + if (cgPtyNmb->nmbDigits.pres == PRSNT_NODEF) { + char digits_string [32]; + memcpy(digits_string, (const char*)cgPtyNmb->nmbDigits.val, cgPtyNmb->nmbDigits.len); + digits_string[cgPtyNmb->nmbDigits.len] = '\0'; + ftdm_call_add_var(caller_data, "isdn.cg_pty2.digits", digits_string); + } + memcpy(&caller_data->ani, &caller_data->cid_num, sizeof(caller_data->ani)); + return FTDM_SUCCESS; +} + ftdm_status_t get_called_num(ftdm_channel_t *ftdmchan, CdPtyNmb *cdPtyNmb) { ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; @@ -278,7 +311,7 @@ ftdm_status_t get_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad) memcpy(subaddress, (char*)cgPtySad->sadInfo.val, cgPtySad->sadInfo.len); subaddress[cgPtySad->sadInfo.len] = '\0'; - ftdm_channel_add_var(ftdmchan, "isdn.calling_subaddr", subaddress); + ftdm_call_add_var(&ftdmchan->caller_data, "isdn.calling_subaddr", subaddress); return FTDM_SUCCESS; } @@ -291,17 +324,16 @@ ftdm_status_t get_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr return get_facility_ie_str(ftdmchan, facilityStr->facilityStr.val, facilityStr->facilityStr.len); } -ftdm_status_t get_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, ftdm_size_t data_len) +ftdm_status_t get_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, uint8_t data_len) { ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - if (data_len > sizeof(caller_data->raw_data)-2) { - ftdm_log(FTDM_LOG_CRIT, "Length of Facility IE exceeds maximum length\n"); - return FTDM_FAIL; - } - + /* size of facilityStr->facilityStr.len is a uint8_t so no need to check + for overflow here as facilityStr->facilityStr.len will always be smaller + than sizeof(caller_data->raw_data) */ + memset(caller_data->raw_data, 0, sizeof(caller_data->raw_data)); /* Always include Facility IE identifier + len so this can be used as a sanity check by the user */ caller_data->raw_data[0] = SNGISDN_Q931_FACILITY_IE_ID; @@ -348,7 +380,7 @@ ftdm_status_t get_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd) val = SNGISDN_PROGIND_DESCR_INVALID; break; } - ftdm_channel_add_var(ftdmchan, "isdn.prog_ind.descr", ftdm_sngisdn_progind_descr2str(val)); + ftdm_call_add_var(&ftdmchan->caller_data, "isdn.prog_ind.descr", ftdm_sngisdn_progind_descr2str(val)); } if (progInd->location.pres) { @@ -379,7 +411,7 @@ ftdm_status_t get_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd) val = SNGISDN_PROGIND_LOC_INVALID; break; } - ftdm_channel_add_var(ftdmchan, "isdn.prog_ind.loc", ftdm_sngisdn_progind_loc2str(val)); + ftdm_call_add_var(&ftdmchan->caller_data, "isdn.prog_ind.loc", ftdm_sngisdn_progind_loc2str(val)); } return FTDM_SUCCESS; } @@ -423,6 +455,89 @@ ftdm_status_t set_calling_num(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb) return FTDM_SUCCESS; } +ftdm_status_t set_calling_num2(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb) +{ + const char* string = NULL; + uint8_t len,val; + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; + + string = ftdm_call_get_var(caller_data, "isdn.cg_pty2.digits"); + if ((string == NULL) || !(*string)) { + return FTDM_FAIL; + } + + cgPtyNmb->eh.pres = PRSNT_NODEF; + + len = strlen(string); + cgPtyNmb->nmbDigits.len = len; + + cgPtyNmb->nmbDigits.pres = PRSNT_NODEF; + memcpy(cgPtyNmb->nmbDigits.val, string, len); + + /* Screening Indicator */ + cgPtyNmb->screenInd.pres = PRSNT_NODEF; + + val = FTDM_SCREENING_INVALID; + string = ftdm_call_get_var(caller_data, "isdn.cg_pty2.screening_ind"); + if ((string != NULL) && (*string)) { + val = ftdm_str2ftdm_screening(string); + } + + /* isdn.cg_pty2.screen_ind does not exist or we could not parse its value */ + if (val == FTDM_SCREENING_INVALID) { + /* default to caller data screening ind */ + cgPtyNmb->screenInd.val = caller_data->screen; + } else { + cgPtyNmb->screenInd.val = val; + } + + /* Presentation Indicator */ + cgPtyNmb->presInd0.pres = PRSNT_NODEF; + + val = FTDM_PRES_INVALID; + string = ftdm_call_get_var(caller_data, "isdn.cg_pty2.presentation_ind"); + if ((string != NULL) && (*string)) { + val = ftdm_str2ftdm_presentation(string); + } + + if (val == FTDM_PRES_INVALID) { + cgPtyNmb->presInd0.val = caller_data->pres; + } else { + cgPtyNmb->presInd0.val = val; + } + + /* Numbering Plan Indicator */ + cgPtyNmb->nmbPlanId.pres = PRSNT_NODEF; + + val = FTDM_NPI_INVALID; + string = ftdm_call_get_var(caller_data, "isdn.cg_pty2.npi"); + if ((string != NULL) && (*string)) { + val = ftdm_str2ftdm_npi(string); + } + + if (val == FTDM_NPI_INVALID) { + cgPtyNmb->nmbPlanId.val = caller_data->cid_num.plan; + } else { + cgPtyNmb->nmbPlanId.val = val; + } + + cgPtyNmb->typeNmb1.pres = PRSNT_NODEF; + + /* Type of Number */ + val = FTDM_TON_INVALID; + string = ftdm_call_get_var(caller_data, "isdn.cg_pty2.ton"); + if ((string != NULL) && (*string)) { + val = ftdm_str2ftdm_ton(string); + } + + if (val == FTDM_TON_INVALID) { + cgPtyNmb->typeNmb1.val = caller_data->cid_num.type; + } else { + cgPtyNmb->typeNmb1.val = val; + } + return FTDM_SUCCESS; +} + ftdm_status_t set_called_num(ftdm_channel_t *ftdmchan, CdPtyNmb *cdPtyNmb) { ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; @@ -544,7 +659,7 @@ ftdm_status_t set_calling_name(ftdm_channel_t *ftdmchan, ConEvnt *conEvnt) ftdm_status_t set_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad) { const char* clg_subaddr = NULL; - clg_subaddr = ftdm_channel_get_var(ftdmchan, "isdn.calling_subaddr"); + clg_subaddr = ftdm_call_get_var(&ftdmchan->caller_data, "isdn.calling_subaddr"); if ((clg_subaddr != NULL) && (*clg_subaddr)) { unsigned len = strlen (clg_subaddr); cgPtySad->eh.pres = PRSNT_NODEF; @@ -565,7 +680,7 @@ ftdm_status_t set_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad) ftdm_status_t set_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr) { ftdm_status_t status; - status = set_facility_ie_str(ftdmchan, facilityStr->facilityStr.val, (ftdm_size_t*)&facilityStr->facilityStr.len); + status = set_facility_ie_str(ftdmchan, facilityStr->facilityStr.val, (uint8_t*)&(facilityStr->facilityStr.len)); if (status == FTDM_SUCCESS) { facilityStr->eh.pres = PRSNT_NODEF; facilityStr->facilityStr.pres = PRSNT_NODEF; @@ -573,14 +688,15 @@ ftdm_status_t set_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr return status; } -ftdm_status_t set_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, ftdm_size_t *data_len) +ftdm_status_t set_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, uint8_t *data_len) { + int len; ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; if (caller_data->raw_data_len > 0 && caller_data->raw_data[0] == SNGISDN_Q931_FACILITY_IE_ID) { - - *data_len = caller_data->raw_data[1]; - memcpy(data, &caller_data->raw_data[2], *data_len); + len = caller_data->raw_data[1]; + memcpy(data, &caller_data->raw_data[2], len); + *data_len = len; return FTDM_SUCCESS; } return FTDM_FAIL; @@ -592,7 +708,7 @@ ftdm_status_t set_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd, ftdm_s int descr = prog_ind.descr; int loc = prog_ind.loc; - str = ftdm_channel_get_var(ftdmchan, "isdn.prog_ind.descr"); + str = ftdm_call_get_var(&ftdmchan->caller_data, "isdn.prog_ind.descr"); if (str && *str) { /* User wants to override progress indicator */ descr = ftdm_str2ftdm_sngisdn_progind_descr(str); @@ -603,8 +719,8 @@ ftdm_status_t set_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd, ftdm_s return FTDM_SUCCESS; } - str = ftdm_channel_get_var(ftdmchan, "isdn.prog_ind.loc"); - if (str && *str) { + str = ftdm_call_get_var(&ftdmchan->caller_data, "isdn.prog_ind.loc"); + if (str && *str) { loc = ftdm_str2ftdm_sngisdn_progind_loc(str); } if (loc == SNGISDN_PROGIND_LOC_INVALID) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index 72e4bac..7517ee4 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -211,10 +211,10 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ /* add any special variables for the dialplan */ sprintf(nadi, "%d", siConEvnt->cgPtyNum.natAddrInd.val); - ftdm_channel_add_var(ftdmchan, "ss7_clg_nadi", nadi); + ftdm_call_add_var(&ftdmchan->caller_data, "ss7_clg_nadi", nadi); sprintf(nadi, "%d", siConEvnt->cdPtyNum.natAddrInd.val); - ftdm_channel_add_var(ftdmchan, "ss7_cld_nadi", nadi); + ftdm_call_add_var(&ftdmchan->caller_data, "ss7_cld_nadi", nadi); /* check if a COT test is requested */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index 008265b..ec8d7df 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -187,7 +187,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) copy_cgPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cgPtyNum); /* check if the user would like a custom NADI value for the calling Pty Num */ - clg_nadi = ftdm_channel_get_var(ftdmchan, "ss7_clg_nadi"); + clg_nadi = ftdm_call_get_var(&ftdmchan->caller_data, "ss7_clg_nadi"); if ((clg_nadi != NULL) && (*clg_nadi)) { SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Calling NADI value \"%s\"\n", clg_nadi); iam.cgPtyNum.natAddrInd.val = atoi(clg_nadi); @@ -196,7 +196,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) SS7_DEBUG_CHAN(ftdmchan,"No user supplied NADI value found for CLG, using \"%d\"\n", iam.cgPtyNum.natAddrInd.val); } - cld_nadi = ftdm_channel_get_var(ftdmchan, "ss7_cld_nadi"); + cld_nadi = ftdm_call_get_var(&ftdmchan->caller_data, "ss7_cld_nadi"); if ((cld_nadi != NULL) && (*cld_nadi)) { SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Called NADI value \"%s\"\n", cld_nadi); iam.cdPtyNum.natAddrInd.val = atoi(cld_nadi); @@ -206,7 +206,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) } /* check if the user would like us to send a clg_sub-address */ - clg_subAddr = ftdm_channel_get_var(ftdmchan, "ss7_clg_subaddr"); + clg_subAddr = ftdm_call_get_var(&ftdmchan->caller_data, "ss7_clg_subaddr"); if ((clg_subAddr != NULL) && (*clg_subAddr)) { SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Calling Sub-Address value \"%s\"\n", clg_subAddr); @@ -245,7 +245,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) } /* check if the user would like us to send a cld_sub-address */ - cld_subAddr = ftdm_channel_get_var(ftdmchan, "ss7_cld_subaddr"); + cld_subAddr = ftdm_call_get_var(&ftdmchan->caller_data, "ss7_cld_subaddr"); if ((cld_subAddr != NULL) && (*cld_subAddr)) { SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Called Sub-Address value \"%s\"\n", cld_subAddr); @@ -298,7 +298,8 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) iam.cgPtyNum.natAddrInd.val, ftdmchan->caller_data.dnis.digits, iam.cdPtyNum.natAddrInd.val); - + + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -379,7 +380,7 @@ void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan) ADDRCMPLT); SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx ACM\n", sngss7_info->circuit->cic); - + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -403,7 +404,7 @@ void ft_to_sngss7_anm (ftdm_channel_t * ftdmchan) 5); SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx ANM\n", sngss7_info->circuit->cic); - + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -438,7 +439,7 @@ void ft_to_sngss7_rel (ftdm_channel_t * ftdmchan) SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx REL cause=%d \n", sngss7_info->circuit->cic, ftdmchan->caller_data.hangup_cause ); - + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -461,7 +462,7 @@ void ft_to_sngss7_rlc (ftdm_channel_t * ftdmchan) &rlc); SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx RLC\n", sngss7_info->circuit->cic); - + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -482,7 +483,7 @@ void ft_to_sngss7_rsc (ftdm_channel_t * ftdmchan) NULL); SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx RSC\n", sngss7_info->circuit->cic); - + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -503,7 +504,7 @@ void ft_to_sngss7_rsca (ftdm_channel_t * ftdmchan) NULL); SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx RSC-RLC\n", sngss7_info->circuit->cic); - + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -524,7 +525,7 @@ void ft_to_sngss7_blo (ftdm_channel_t * ftdmchan) NULL); SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx BLO\n", sngss7_info->circuit->cic); - + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -545,7 +546,7 @@ void ft_to_sngss7_bla (ftdm_channel_t * ftdmchan) NULL); SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx BLA\n", sngss7_info->circuit->cic); - + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -567,7 +568,7 @@ ft_to_sngss7_ubl (ftdm_channel_t * ftdmchan) NULL); SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx UBL\n", sngss7_info->circuit->cic); - + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -588,7 +589,7 @@ void ft_to_sngss7_uba (ftdm_channel_t * ftdmchan) NULL); SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx UBA\n", sngss7_info->circuit->cic); - + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -609,7 +610,7 @@ void ft_to_sngss7_lpa (ftdm_channel_t * ftdmchan) NULL); SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx LPA\n", sngss7_info->circuit->cic); - + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -654,6 +655,7 @@ void ft_to_sngss7_gra (ftdm_channel_t * ftdmchan) sngss7_info->circuit->cic, (sngss7_info->circuit->cic + sngss7_span->rx_grs.range)); + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -686,7 +688,8 @@ void ft_to_sngss7_grs (ftdm_channel_t * ftdmchan) sngss7_info->circuit->cic, sngss7_info->circuit->cic, (sngss7_info->circuit->cic + sngss7_span->tx_grs.range)); - + + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -735,7 +738,7 @@ void ft_to_sngss7_cgba(ftdm_channel_t * ftdmchan) /* clean out the saved data */ memset(&sngss7_span->rx_cgb, 0x0, sizeof(sngss7_group_data_t)); - + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -785,6 +788,7 @@ void ft_to_sngss7_cgua(ftdm_channel_t * ftdmchan) /* clean out the saved data */ memset(&sngss7_span->rx_cgu, 0x0, sizeof(sngss7_group_data_t)); + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -835,6 +839,7 @@ void ft_to_sngss7_cgb(ftdm_channel_t * ftdmchan) /* clean out the saved data */ memset(&sngss7_span->tx_cgb, 0x0, sizeof(sngss7_group_data_t)); + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -885,6 +890,7 @@ void ft_to_sngss7_cgu(ftdm_channel_t * ftdmchan) /* clean out the saved data */ memset(&sngss7_span->tx_cgu, 0x0, sizeof(sngss7_group_data_t)); + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 41e7f50..4ee6ff5 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -272,6 +272,8 @@ typedef struct { uint8_t plan; } ftdm_number_t; +typedef void * ftdm_variable_container_t; + /*! \brief Caller information */ typedef struct ftdm_caller_data { char cid_date[8]; /*!< Caller ID date */ @@ -286,12 +288,13 @@ typedef struct ftdm_caller_data { char collected[25]; /*!< Collected digits so far */ int hangup_cause; /*!< Hangup cause */ char raw_data[1024]; /*!< Protocol specific raw caller data */ - uint32_t raw_data_len; /* !< Raw data length */ + uint32_t raw_data_len; /*!< Raw data length */ /* these 2 are undocumented right now, only used by boost: */ /* bearer capability */ ftdm_bearer_cap_t bearer_capability; /* user information layer 1 protocol */ ftdm_user_layer1_prot_t bearer_layer1; + ftdm_variable_container_t variables; /*!<variables attached to this call */ } ftdm_caller_data_t; /*! \brief Tone type */ @@ -316,7 +319,7 @@ typedef enum { FTDM_SIGEVENT_RESTART, /*!< Restart has been requested. Typically you hangup your call resources here */ FTDM_SIGEVENT_SIGSTATUS_CHANGED, /*!< Signaling protocol status changed (ie: D-chan up), see new status in raw_data ftdm_sigmsg_t member */ FTDM_SIGEVENT_COLLISION, /*!< Outgoing call was dropped because an incoming call arrived at the same time */ - FTDM_SIGEVENT_MSG, /*!< We received an in-call msg */ + FTDM_SIGEVENT_FACILITY, /* !< In call facility event */ FTDM_SIGEVENT_INVALID } ftdm_signal_event_t; #define SIGNAL_STRINGS "START", "STOP", "RELEASED", "UP", "FLASH", "PROCEED", "PROGRESS", \ @@ -378,7 +381,7 @@ struct ftdm_sigmsg { ftdm_channel_t *channel; /*!< Related channel */ uint32_t chan_id; /*!< easy access to chan id */ uint32_t span_id; /*!< easy access to span_id */ - ftdm_signaling_status_t sigstatus; /*!< Signaling status (valid if event_id is FTDM_SIGEVENT_SIGSTATUS_CHANGED) */ + ftdm_signaling_status_t sigstatus; /*!< Signaling status (valid if event_id is FTDM_SIGEVENT_SIGSTATUS_CHANGED) */ void *raw_data; /*!< Message specific data if any */ uint32_t raw_data_len; /*!< Data len in case is needed */ }; @@ -507,6 +510,7 @@ struct ftdm_memory_handler { * You don't need these unless your implementing an I/O interface module (most users don't) */ #define FIO_CHANNEL_REQUEST_ARGS (ftdm_span_t *span, uint32_t chan_id, ftdm_direction_t direction, ftdm_caller_data_t *caller_data, ftdm_channel_t **ftdmchan) #define FIO_CHANNEL_OUTGOING_CALL_ARGS (ftdm_channel_t *ftdmchan) +#define FIO_CHANNEL_SEND_MSG_ARGS (ftdm_channel_t *ftdmchan, ftdm_sigmsg_t *sigmsg) #define FIO_CHANNEL_SET_SIG_STATUS_ARGS (ftdm_channel_t *ftdmchan, ftdm_signaling_status_t status) #define FIO_CHANNEL_GET_SIG_STATUS_ARGS (ftdm_channel_t *ftdmchan, ftdm_signaling_status_t *status) #define FIO_SPAN_SET_SIG_STATUS_ARGS (ftdm_span_t *span, ftdm_signaling_status_t status) @@ -539,6 +543,7 @@ struct ftdm_memory_handler { * You don't need these unless your implementing an I/O interface module (most users don't) */ typedef ftdm_status_t (*fio_channel_request_t) FIO_CHANNEL_REQUEST_ARGS ; typedef ftdm_status_t (*fio_channel_outgoing_call_t) FIO_CHANNEL_OUTGOING_CALL_ARGS ; +typedef ftdm_status_t (*fio_channel_send_msg_t) FIO_CHANNEL_SEND_MSG_ARGS; typedef ftdm_status_t (*fio_channel_set_sig_status_t) FIO_CHANNEL_SET_SIG_STATUS_ARGS; typedef ftdm_status_t (*fio_channel_get_sig_status_t) FIO_CHANNEL_GET_SIG_STATUS_ARGS; typedef ftdm_status_t (*fio_span_set_sig_status_t) FIO_SPAN_SET_SIG_STATUS_ARGS; @@ -572,6 +577,7 @@ typedef ftdm_status_t (*fio_api_t) FIO_API_ARGS ; * You don't need these unless your implementing an I/O interface module (most users don't) */ #define FIO_CHANNEL_REQUEST_FUNCTION(name) ftdm_status_t name FIO_CHANNEL_REQUEST_ARGS #define FIO_CHANNEL_OUTGOING_CALL_FUNCTION(name) ftdm_status_t name FIO_CHANNEL_OUTGOING_CALL_ARGS +#define FIO_CHANNEL_SEND_MSG_FUNCTION(name) ftdm_status_t name FIO_CHANNEL_SEND_MSG_ARGS #define FIO_CHANNEL_SET_SIG_STATUS_FUNCTION(name) ftdm_status_t name FIO_CHANNEL_SET_SIG_STATUS_ARGS #define FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(name) ftdm_status_t name FIO_CHANNEL_GET_SIG_STATUS_ARGS #define FIO_SPAN_SET_SIG_STATUS_FUNCTION(name) ftdm_status_t name FIO_SPAN_SET_SIG_STATUS_ARGS @@ -672,6 +678,12 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_place(const char *file, const char /*! \brief Indicate a new condition in an incoming call recording the source code point where it was called (see ftdm_channel_call_indicate for an easy to use macro) */ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_indicate(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_channel_indication_t indication); +/*! \brief Send a message on a call */ +#define ftdm_channel_call_send_msg(ftdmchan, sigmsg) _ftdm_channel_call_send_msg(__FILE__, __FUNCTION__, __LINE__, (ftdmchan), (sigmsg)) + +/*! \brief Send a signal on a call recording the source code point where it was called (see ftdm_channel_call_send_msg for an easy to use macro) */ +FT_DECLARE(ftdm_status_t) _ftdm_channel_call_send_msg(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_sigmsg_t *sigmsg); + /*! \brief Hangup the call without cause */ #define ftdm_channel_call_hangup(ftdmchan) _ftdm_channel_call_hangup(__FILE__, __FUNCTION__, __LINE__, (ftdmchan)) @@ -1128,6 +1140,45 @@ FT_DECLARE(ftdm_iterator_t *) ftdm_iterator_next(ftdm_iterator_t *iter); */ FT_DECLARE(ftdm_status_t) ftdm_iterator_free(ftdm_iterator_t *iter); +/*! \brief Add a custom variable to the call + * \note This variables may be used by signaling modules to override signaling parameters + * \todo Document which signaling variables are available + * */ +FT_DECLARE(ftdm_status_t) ftdm_call_add_var(ftdm_caller_data_t *caller_data, const char *var_name, const char *value); + +/*! \brief Get a custom variable from the call. + * \note The variable pointer returned is only valid during the callback receiving SIGEVENT. */ +FT_DECLARE(const char *) ftdm_call_get_var(ftdm_caller_data_t *caller_data, const char *var_name); + +/*! \brief Get an iterator to iterate over the channel variables + * \param caller_data The signal msg structure containing the variables + * \param iter Optional iterator. You can reuse an old iterator (not previously freed) to avoid the extra allocation of a new iterator. + * \note The iterator pointer returned is only valid while the signal message and it'll be destroyed when the signal message is processed. + * This iterator is completely non-thread safe, if you are adding variables or removing variables while iterating + * results are unpredictable + */ +FT_DECLARE(ftdm_iterator_t *) ftdm_call_get_var_iterator(const ftdm_caller_data_t *caller_data, ftdm_iterator_t *iter); + +/*! \brief Get variable name and value for the current iterator position */ +FT_DECLARE(ftdm_status_t) ftdm_call_get_current_var(ftdm_iterator_t *iter, const char **var_name, const char **var_val); + +/*! \brief Clear all variables attached to the call + * \note Variables are cleared at the end of each call back, so it is not necessary for the user to call this function. + * \todo Document which signaling variables are available + * */ +FT_DECLARE(ftdm_status_t) ftdm_call_clear_vars(ftdm_caller_data_t *caller_data); + +/*! \brief Remove a variable attached to the call + * \note Removes a variable that was attached to the call. + * \todo Document which call variables are available + * */ +FT_DECLARE(ftdm_status_t) ftdm_call_remove_var(ftdm_caller_data_t *caller_data, const char *var_name); + +/*! \brief Clears all the temporary data attached to this call + * \note Clears caller_data->variables and caller_data->raw_data. + * */ +FT_DECLARE(void) ftdm_call_clear_data(ftdm_caller_data_t *caller_data); + /*! \brief Get the span pointer associated to the channel */ FT_DECLARE(ftdm_span_t *) ftdm_channel_get_span(const ftdm_channel_t *ftdmchan); diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index f1058d8..de0056a 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -501,6 +501,7 @@ struct ftdm_span { teletone_multi_tone_t tone_finder[FTDM_TONEMAP_INVALID+1]; ftdm_channel_t *channels[FTDM_MAX_CHANNELS_SPAN+1]; fio_channel_outgoing_call_t outgoing_call; + fio_channel_send_msg_t send_msg; fio_channel_set_sig_status_t set_channel_sig_status; fio_channel_get_sig_status_t get_channel_sig_status; fio_span_set_sig_status_t set_span_sig_status; commit 5ab19aaa23dac4771baadd1f2a2b874c8c630154 Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Dec 9 13:47:40 2010 -0500 freetdm: fix compilation diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 7355c84..605f13c 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -3906,7 +3906,7 @@ done: FT_DECLARE(void) ftdm_call_clear_data(ftdm_caller_data_t *caller_data) { ftdm_call_clear_vars(caller_data); - memset(caller_data.raw_data, 0, sizeof(raw_data)); + memset(&caller_data->raw_data, 0, sizeof(caller_data->raw_data)); caller_data->raw_data_len = 0; return; } commit 3c747978f4b1dc395846e90f613fbf2acb6324db Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Dec 9 13:20:05 2010 -0500 freetdm: support for call variables diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 7ea6bb6..38197bb 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -429,7 +429,7 @@ static switch_status_t channel_on_routing(switch_core_session_t *session) assert(tech_pvt->ftdmchan != NULL); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL ROUTING\n", switch_channel_get_name(channel)); - + ftdm_channel_call_indicate(tech_pvt->ftdmchan, FTDM_CHANNEL_INDICATE_PROCEED); return SWITCH_STATUS_SUCCESS; } @@ -1329,7 +1329,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi char *v = h->name + FREETDM_VAR_PREFIX_LEN; if (!zstr(v)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding outbound freetdm variable %s=%s to channel %d:%d\n", v, h->value, span_id, chan_id); - ftdm_channel_add_var(ftdmchan, v, h->value); + ftdm_call_add_var(&caller_data, v, h->value); } } } @@ -1528,6 +1528,7 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session switch_channel_set_variable_printf(channel, "freetdm_chan_number", "%d", chanid); switch_channel_set_variable_printf(channel, "freetdm_bearer_capability", "%d", channel_caller_data->bearer_capability); switch_channel_set_variable_printf(channel, "freetdm_bearer_layer1", "%d", channel_caller_data->bearer_layer1); + if (globals.sip_headers) { switch_channel_set_variable(channel, "sip_h_X-FreeTDM-SpanName", ftdm_channel_get_span_name(sigmsg->channel)); switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-SpanNumber", "%d", spanid); @@ -1561,8 +1562,18 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session ftdm_channel_get_current_var(curr, &var_name, &var_value); snprintf(name, sizeof(name), FREETDM_VAR_PREFIX "%s", var_name); switch_channel_set_variable_printf(channel, name, "%s", var_value); + } + + /* Add any call variable to the dial plan */ + iter = ftdm_call_get_var_iterator(channel_caller_data, iter); + for (curr = iter ; curr; curr = ftdm_iterator_next(curr)) { + ftdm_call_get_current_var(curr, &var_name, &var_value); + snprintf(name, sizeof(name), FREETDM_VAR_PREFIX "%s", var_name); + switch_channel_set_variable_printf(channel, name, "%s", var_value); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Call Variable: %s=%s\n", name, var_value); } ftdm_iterator_free(iter); + switch_channel_set_state(channel, CS_INIT); if (switch_core_session_thread_launch(session) != SWITCH_STATUS_SUCCESS) { @@ -1661,11 +1672,11 @@ static FIO_SIGNAL_CB_FUNCTION(on_fxo_signal) ftdm_status_t status; uint32_t spanid; uint32_t chanid; - ftdm_caller_data_t *callerdata; + ftdm_caller_data_t *caller_data; spanid = ftdm_channel_get_span_id(sigmsg->channel); chanid = ftdm_channel_get_id(sigmsg->channel); - callerdata = ftdm_channel_get_caller_data(sigmsg->channel); + caller_data = ftdm_channel_get_caller_data(sigmsg->channel); ftdm_log(FTDM_LOG_DEBUG, "got FXO sig %d:%d [%s]\n", spanid, chanid, ftdm_signal_event2str(sigmsg->event_id)); @@ -1688,7 +1699,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_fxo_signal) switch_set_flag_locked(tech_pvt, TFLAG_DEAD); ftdm_channel_clear_token(sigmsg->channel, 0); channel = switch_core_session_get_channel(session); - switch_channel_hangup(channel, callerdata->hangup_cause); + switch_channel_hangup(channel, caller_data->hangup_cause); ftdm_channel_clear_token(sigmsg->channel, switch_core_session_get_uuid(session)); switch_core_session_rwunlock(session); } @@ -1712,8 +1723,8 @@ static FIO_SIGNAL_CB_FUNCTION(on_fxo_signal) } } break; - case FTDM_SIGEVENT_RELEASED: { /* twiddle */ } break; - + case FTDM_SIGEVENT_RELEASED: { /* twiddle */ } break; + default: { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unhandled msg type %d for channel %d:%d\n", @@ -1767,7 +1778,8 @@ static FIO_SIGNAL_CB_FUNCTION(on_fxs_signal) } } break; - case FTDM_SIGEVENT_RELEASED: { /* twiddle */ } break; + case FTDM_SIGEVENT_RELEASED: { /* twiddle */ } break; + case FTDM_SIGEVENT_STOP: { private_t *tech_pvt = NULL; @@ -1991,8 +2003,8 @@ static FIO_SIGNAL_CB_FUNCTION(on_r2_signal) } break; - case FTDM_SIGEVENT_RELEASED: { /* twiddle */ } break; - + case FTDM_SIGEVENT_RELEASED: { /* twiddle */ } break; + /* on DNIS received from the R2 forward side, return status == FTDM_BREAK to stop requesting DNIS */ case FTDM_SIGEVENT_COLLECTED_DIGIT: { @@ -2104,14 +2116,14 @@ static FIO_SIGNAL_CB_FUNCTION(on_clear_channel_signal) switch(sigmsg->event_id) { case FTDM_SIGEVENT_START: { - ftdm_channel_add_var(sigmsg->channel, "screening_ind", ftdm_screening2str(caller_data->screen)); - ftdm_channel_add_var(sigmsg->channel, "presentation_ind", ftdm_presentation2str(caller_data->pres)); + ftdm_call_add_var(caller_data, "screening_ind", ftdm_screening2str(caller_data->screen)); + ftdm_call_add_var(caller_data, "presentation_ind", ftdm_presentation2str(caller_data->pres)); return ftdm_channel_from_event(sigmsg, &session); } break; - case FTDM_SIGEVENT_RELEASED: { /* twiddle */ } break; - + case FTDM_SIGEVENT_RELEASED: { /* twiddle */ } break; + case FTDM_SIGEVENT_STOP: case FTDM_SIGEVENT_RESTART: { @@ -2176,7 +2188,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_clear_channel_signal) } break; case FTDM_SIGEVENT_PROCEED: - case FTDM_SIGEVENT_MSG: + case FTDM_SIGEVENT_FACILITY: /* FS does not have handlers for these messages, so ignore them for now */ break; default: diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index ef29096..7355c84 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -61,6 +61,8 @@ struct tm *localtime_r(const time_t *clock, struct tm *result); ftdm_time_t time_last_throttle_log = 0; ftdm_time_t time_current_throttle_log = 0; +static ftdm_iterator_t *get_iterator(ftdm_iterator_type_t type, ftdm_iterator_t *iter); + static int time_is_init = 0; static void time_init(void) @@ -1893,7 +1895,9 @@ static ftdm_status_t ftdm_channel_reset(ftdm_channel_t *ftdmchan) if (!ftdmchan->dtmf_off) { ftdmchan->dtmf_off = FTDM_DEFAULT_DTMF_OFF; } - + + ftdm_call_clear_vars(&ftdmchan->caller_data); + memset(ftdmchan->dtmf_hangup_buf, '\0', ftdmchan->span->dtmf_hangup_len); if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_TRANSCODE)) { @@ -2432,6 +2436,27 @@ done: return FTDM_SUCCESS; } +FT_DECLARE(ftdm_status_t) _ftdm_channel_call_send_msg(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_sigmsg_t *sigmsg) +{ + ftdm_status_t status = FTDM_FAIL; + ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "null channel"); +#ifdef __WINDOWS__ + UNREFERENCED_PARAMETER(file); + UNREFERENCED_PARAMETER(func); + UNREFERENCED_PARAMETER(line); +#endif + + ftdm_channel_lock(ftdmchan); + if (ftdmchan->span->send_msg) { + status = ftdmchan->span->send_msg(ftdmchan, sigmsg); + } else { + status = FTDM_NOTIMPL; + ftdm_log(FTDM_LOG_ERROR, "send_msg method not implemented in this span!\n"); + } + ftdm_channel_unlock(ftdmchan); + return status; +} + FT_DECLARE(ftdm_status_t) _ftdm_channel_call_place(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan) { ftdm_status_t status = FTDM_FAIL; @@ -3878,6 +3903,100 @@ done: return status; } +FT_DECLARE(void) ftdm_call_clear_data(ftdm_caller_data_t *caller_data) +{ + ftdm_call_clear_vars(caller_data); + memset(caller_data.raw_data, 0, sizeof(raw_data)); + caller_data->raw_data_len = 0; + return; +} + +FT_DECLARE(ftdm_status_t) ftdm_call_clear_vars(ftdm_caller_data_t *caller_data) +{ + if (caller_data->variables) { + hashtable_destroy(caller_data->variables); + } + caller_data->variables = NULL; + return FTDM_SUCCESS; +} + +FT_DECLARE(ftdm_status_t) ftdm_call_remove_var(ftdm_caller_data_t *caller_data, const char *var_name) +{ + if (caller_data->variables) { + hashtable_remove(caller_data->variables, (void *)var_name); + } + + return FTDM_SUCCESS; +} + + +FT_DECLARE(ftdm_status_t) ftdm_call_add_var(ftdm_caller_data_t *caller_data, const char *var_name, const char *value) +{ + char *t_name = 0, *t_val = 0; + + if (!var_name || !value) { + return FTDM_FAIL; + } + + if (!caller_data->variables) { + /* initialize on first use */ + caller_data->variables = create_hashtable(16, ftdm_hash_hashfromstring, ftdm_hash_equalkeys); + ftdm_assert_return(caller_data->variables, FTDM_FAIL, "Failed to create hash table\n"); + } + + t_name = ftdm_strdup(var_name); + t_val = ftdm_strdup(value); + hashtable_insert(caller_data->variables, t_name, t_val, HASHTABLE_FLAG_FREE_KEY | HASHTABLE_FLAG_FREE_VALUE); + return FTDM_SUCCESS; +} + +FT_DECLARE(const char *) ftdm_call_get_var(ftdm_caller_data_t *caller_data, const char *var_name) +{ + const char *var = NULL; + + if (!caller_data->variables || !var_name) { + return NULL; + } + + var = (const char *)hashtable_search(((struct hashtable*)caller_data->variables), (void *)var_name); + return var; +} + +FT_DECLARE(ftdm_iterator_t *) ftdm_call_get_var_iterator(const ftdm_caller_data_t *caller_data, ftdm_iterator_t *iter) +{ + ftdm_hash_iterator_t *hashiter = NULL; + hashiter = caller_data->variables == NULL ? NULL : hashtable_first(caller_data->variables); + + if (hashiter == NULL) { + return NULL; + } + + if (!(iter = get_iterator(FTDM_ITERATOR_VARS, iter))) { + return NULL; + } + iter->pvt.hashiter = hashiter; + return iter; +} + +FT_DECLARE(ftdm_status_t) ftdm_call_get_current_var(ftdm_iterator_t *iter, const char **var_name, const char **var_val) +{ + const void *key = NULL; + void *val = NULL; + + *var_name = NULL; + *var_val = NULL; + + ftdm_assert_return(iter && (iter->type == FTDM_ITERATOR_VARS) && iter->pvt.hashiter, FTDM_FAIL, "Cannot get variable from invalid iterator!\n"); + + hashtable_this(iter->pvt.hashiter, &key, NULL, &val); + + *var_name = key; + *var_val = val; + + return FTDM_SUCCESS; +} + + static ftdm_status_t ftdm_channel_clear_vars(ftdm_channel_t *ftdmchan) { ftdm_channel_lock(ftdmchan); @@ -3924,6 +4043,7 @@ done: return status; } + FT_DECLARE(const char *) ftdm_channel_get_var(ftdm_channel_t *ftdmchan, const char *var_name) { const char *var = NULL; @@ -5157,7 +5277,11 @@ FT_DECLARE(ftdm_status_t) ftdm_group_create(ftdm_group_t **group, const char *na static ftdm_status_t ftdm_span_trigger_signal(const ftdm_span_t *span, ftdm_sigmsg_t *sigmsg) { - return span->signal_cb(sigmsg); + ftdm_status_t status = span->signal_cb(sigmsg); + if (sigmsg->channel) { + ftdm_call_clear_data(&(sigmsg->channel->caller_data)); + } + return status; } static ftdm_status_t ftdm_span_queue_signal(const ftdm_span_t *span, ftdm_sigmsg_t *sigmsg) @@ -5261,6 +5385,7 @@ FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t } done: + if (sigmsg->channel) { ftdm_mutex_unlock(sigmsg->channel->mutex); } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 03b5a5f..96f1a2b 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -626,8 +626,11 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) case FTDM_CHANNEL_STATE_GET_CALLERID: { if (!sngisdn_test_flag(sngisdn_info, FLAG_SENT_PROCEED)) { + /* By default, we do not send a progress indicator in the proceed */ + ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_INVALID}; + sngisdn_set_flag(sngisdn_info, FLAG_SENT_PROCEED); - sngisdn_snd_proceed(ftdmchan); + sngisdn_snd_proceed(ftdmchan, prog_ind); } /* Wait in this state until we get FACILITY msg */ } @@ -666,8 +669,11 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) ftdm_span_send_signal(ftdmchan->span, &sigev); } else { if (!sngisdn_test_flag(sngisdn_info, FLAG_SENT_PROCEED)) { + /* By default, we do not send a progress indicator in the proceed */ + ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_INVALID}; + sngisdn_set_flag(sngisdn_info, FLAG_SENT_PROCEED); - sngisdn_snd_proceed(ftdmchan); + sngisdn_snd_proceed(ftdmchan, prog_ind); } } } @@ -851,6 +857,26 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) return; } +static FIO_CHANNEL_SEND_MSG_FUNCTION(ftdm_sangoma_isdn_send_msg) +{ + ftdm_status_t status = FTDM_FAIL; + + switch (sigmsg->event_id) { + case FTDM_SIGEVENT_RESTART: + /* TODO: Send a channel restart here */ + /* Implement me */ + break; + case FTDM_SIGEVENT_FACILITY: + sngisdn_snd_fac_req(ftdmchan); + break; + default: + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Unsupported signalling msg requested\n"); + status = FTDM_BREAK; + } + ftdm_call_clear_data(&ftdmchan->caller_data); + return status; +} + static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(ftdm_sangoma_isdn_outgoing_call) { sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data; @@ -1030,6 +1056,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_isdn_span_config) span->stop = ftdm_sangoma_isdn_stop; span->signal_type = FTDM_SIGTYPE_ISDN; span->outgoing_call = ftdm_sangoma_isdn_outgoing_call; + span->send_msg = ftdm_sangoma_isdn_send_msg; span->channel_request = NULL; span->signal_cb = sig_cb; span->get_channel_sig_status = ftdm_sangoma_isdn_get_chan_sig_status; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index b9ab339..f15eff9 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -363,7 +363,7 @@ void stack_pst_init(Pst *pst); /* Outbound Call Control functions */ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan); void sngisdn_snd_setup_ack(ftdm_channel_t *ftdmchan); -void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan); +void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind); void sngisdn_snd_progress(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind); void sngisdn_snd_alert(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind); void sngisdn_snd_connect(ftdm_channel_t *ftdmchan); @@ -436,6 +436,7 @@ void sngisdn_rcv_sng_log(uint8_t level, char *fmt,...); void sngisdn_rcv_sng_assert(char *message); ftdm_status_t get_calling_num(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb); +ftdm_status_t get_calling_num2(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb); ftdm_status_t get_called_num(ftdm_channel_t *ftdmchan, CdPtyNmb *cdPtyNmb); ftdm_status_t get_redir_num(ftdm_channel_t *ftdmchan, RedirNmb *redirNmb); ftdm_status_t get_calling_name_from_display(ftdm_channel_t *ftdmchan, Display *display); @@ -443,16 +444,17 @@ ftdm_status_t get_calling_name_from_usr_usr(ftdm_channel_t *ftdmchan, UsrUsr *us ftdm_status_t get_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad); ftdm_status_t get_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd); ftdm_status_t get_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr); -ftdm_status_t get_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, ftdm_size_t data_len); +ftdm_status_t get_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, uint8_t data_len); ftdm_status_t set_calling_num(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb); +ftdm_status_t set_calling_num2(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb); ftdm_status_t set_called_num(ftdm_channel_t *ftdmchan, CdPtyNmb *cdPtyNmb); ftdm_status_t set_redir_num(ftdm_channel_t *ftdmchan, RedirNmb *redirNmb); ftdm_status_t set_calling_name(ftdm_channel_t *ftdmchan, ConEvnt *conEvnt); ftdm_status_t set_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad); ftdm_status_t set_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd, ftdm_sngisdn_progind_t prog_ind); ftdm_status_t set_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr); -ftdm_status_t set_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, ftdm_size_t *data_len); +ftdm_status_t set_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, uint8_t *data_len); uint8_t sngisdn_get_infoTranCap_from_stack(ftdm_bearer_cap_t bearer_capability); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 086354a..cb9f6d3 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -123,12 +123,9 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) break; } -#if 0 - /* Export ftdmchan variables here if we need to */ - ftdm_channel_add_var(ftdmchan, "isdn_specific_var", "1"); -#endif /* Fill in call information */ get_calling_num(ftdmchan, &conEvnt->cgPtyNmb); + get_calling_num2(ftdmchan, &conEvnt->cgPtyNmb2); get_called_num(ftdmchan, &conEvnt->cdPtyNmb); get_redir_num(ftdmchan, &conEvnt->redirNmb); get_calling_subaddr(ftdmchan, &conEvnt->cgPtySad); @@ -757,14 +754,14 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event) { ftdm_sigmsg_t sigev; if (facEvnt->facElmt.facStr.pres) { - get_facility_ie_str(ftdmchan, &facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len); + get_facility_ie_str(ftdmchan, &facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len-2); } memset(&sigev, 0, sizeof(sigev)); sigev.chan_id = ftdmchan->chan_id; sigev.span_id = ftdmchan->span_id; sigev.channel = ftdmchan; - sigev.event_id = FTDM_SIGEVENT_MSG; + sigev.event_id = FTDM_SIGEVENT_FACILITY; ftdm_span_send_signal(ftdmchan->span, &sigev); } break; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 38bbdb6..297c59c 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -128,6 +128,7 @@ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) set_called_num(ftdmchan, &conEvnt.cdPtyNmb); set_calling_num(ftdmchan, &conEvnt.cgPtyNmb); + set_calling_num2(ftdmchan, &conEvnt.cgPtyNmb2); set_calling_subaddr(ftdmchan, &conEvnt.cgPtySad); set_redir_num(ftdmchan, &conEvnt.redirNmb); set_calling_name(ftdmchan, &conEvnt); @@ -262,10 +263,9 @@ void sngisdn_snd_con_complete(ftdm_channel_t *ftdmchan) } -void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan) +void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind) { CnStEvnt cnStEvnt; - sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; @@ -310,7 +310,9 @@ void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan) cnStEvnt.chanId.chanNmbSlotMap.val[0] = ftdmchan->physical_chan_id; } + set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); set_facility_ie(ftdmchan, &cnStEvnt.facilityStr); + ftdm_call_clear_data(&ftdmchan->caller_data); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending PROCEED (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); @@ -343,6 +345,7 @@ void sngisdn_snd_progress(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ memset(&cnStEvnt, 0, sizeof(cnStEvnt)); set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); set_facility_ie(ftdmchan, &cnStEvnt.facilityStr); + ftdm_call_clear_data(&ftdmchan->caller_data); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending PROGRESS (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); if(sng_isdn_con_status(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId,&cnStEvnt, MI_PROGRESS, signal_data->dchan_id, sngisdn_info->ces)) { @@ -369,6 +372,7 @@ void sngisdn_snd_alert(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); set_facility_ie(ftdmchan, &cnStEvnt.facilityStr); + ftdm_call_clear_data(&ftdmchan->caller_data); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending ALERT (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); @@ -428,6 +432,7 @@ void sngisdn_snd_connect(ftdm_channel_t *ftdmchan) set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); set_facility_ie(ftdmchan, &cnStEvnt.facilityStr); + ftdm_call_clear_data(&ftdmchan->caller_data); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending CONNECT (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); if (sng_isdn_con_response(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &cnStEvnt, signal_data->dchan_id, sngisdn_info->ces)) { @@ -450,10 +455,17 @@ void sngisdn_snd_fac_req(ftdm_channel_t *ftdmchan) memset(&facEvnt, 0, sizeof(facEvnt)); - set_facility_ie_str(ftdmchan, &facEvnt.facElmt.facStr.val[2], (ftdm_size_t*)&facEvnt.facElmt.facStr.len); + if (set_facility_ie_str(ftdmchan, &facEvnt.facElmt.facStr.val[2], (uint8_t*)&facEvnt.facElmt.facStr.len) != FTDM_SUCCESS) { + /* No point in sending a FACILITY message if there is no Facility IE to transmit */ + return; + } + ftdm_call_clear_data(&ftdmchan->caller_data); + facEvnt.facElmt.eh.pres = PRSNT_NODEF; + facEvnt.facElmt.facStr.pres = PRSNT_NODEF; facEvnt.facElmt.facStr.val[0] = 0x1C; - facEvnt.facElmt.facStr.val[1] = facEvnt.facElmt.facStr.len; + facEvnt.facElmt.facStr.val[1] = (uint8_t)facEvnt.facElmt.facStr.len; + facEvnt.facElmt.facStr.len +=2; /* Need to include the size of identifier + len */ ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending FACILITY (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); @@ -481,6 +493,8 @@ void sngisdn_snd_info_req(ftdm_channel_t *ftdmchan) //ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Sending INFO REQ\n"); + ftdm_call_clear_data(&ftdmchan->caller_data); + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending INFO REQ (suId:%d dchan:%d ces:%d)\n", signal_data->cc_id, signal_data->dchan_id, sngisdn_info->ces); if (sng_isdn_con_status(signal_data->cc_id, 0, 0, &cnStEvnt, MI_INFO, signal_data->dchan_id, sngisdn_info->ces)) { @@ -501,6 +515,8 @@ void sngisdn_snd_status_enq(ftdm_channel_t *ftdmchan) memset(&staEvnt, 0, sizeof(StaEvnt)); + ftdm_call_clear_data(&ftdmchan->caller_data); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending Status ENQ on suId:%d suInstId:%u spInstId:%d dchan:%d ces:%d\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); if (sng_isdn_status_request(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &staEvnt, MI_STATENQ)) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused Status ENQ request\n"); @@ -539,6 +555,7 @@ void sngisdn_snd_disconnect(ftdm_channel_t *ftdmchan) discEvnt.causeDgn[0].dgnVal.pres = NOTPRSNT; set_facility_ie(ftdmchan, &discEvnt.facilityStr); + ftdm_call_clear_data(&ftdmchan->caller_data); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending DISCONNECT (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); if (sng_isdn_disc_request(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &discEvnt)) { @@ -585,6 +602,7 @@ void sngisdn_snd_release(ftdm_channel_t *ftdmchan, uint8_t glare) } set_facility_ie(ftdmchan, &relEvnt.facilityStr); + ftdm_call_clear_data(&ftdmchan->caller_data); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending RELEASE/RELEASE COMPLETE (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, suInstId, spInstId); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index fae25c9..76d11d6 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -185,6 +185,39 @@ ftdm_status_t get_calling_num(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb) return FTDM_SUCCESS; } +ftdm_status_t get_calling_num2(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb) +{ + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; + if (cgPtyNmb->eh.pres != PRSNT_NODEF) { + return FTDM_FAIL; + } + + if (cgPtyNmb->screenInd.pres == PRSNT_NODEF) { + ftdm_call_add_var(caller_data, "isdn.cg_pty2.screen_ind", ftdm_screening2str(cgPtyNmb->screenInd.val)); + } + + if (cgPtyNmb->presInd0.pres == PRSNT_NODEF) { + ftdm_call_add_var(caller_data, "isdn.cg_pty2.presentation_ind", ftdm_presentation2str(cgPtyNmb->presInd0.val)); + } + + if (cgPtyNmb->nmbPlanId.pres == PRSNT_NODEF) { + ftdm_call_add_var(caller_data, "isdn.cg_pty2.npi", ftdm_npi2str(cgPtyNmb->nmbPlanId.val)); + } + + if (cgPtyNmb->typeNmb1.pres == PRSNT_NODEF) { + ftdm_call_add_var(caller_data, "isdn.cg_pty2.ton", ftdm_ton2str(cgPtyNmb->typeNmb1.val)); + } + + if (cgPtyNmb->nmbDigits.pres == PRSNT_NODEF) { + char digits_string [32]; + memcpy(digits_string, (const char*)cgPtyNmb->nmbDigits.val, cgPtyNmb->nmbDigits.len); + digits_string[cgPtyNmb->nmbDigits.len] = '\0'; + ftdm_call_add_var(caller_data, "isdn.cg_pty2.digits", digits_string); + } + memcpy(&caller_data->ani, &caller_data->cid_num, sizeof(caller_data->ani)); + return FTDM_SUCCESS; +} + ftdm_status_t get_called_num(ftdm_channel_t *ftdmchan, CdPtyNmb *cdPtyNmb) { ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; @@ -278,7 +311,7 @@ ftdm_status_t get_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad) memcpy(subaddress, (char*)cgPtySad->sadInfo.val, cgPtySad->sadInfo.len); subaddress[cgPtySad->sadInfo.len] = '\0'; - ftdm_channel_add_var(ftdmchan, "isdn.calling_subaddr", subaddress); + ftdm_call_add_var(&ftdmchan->caller_data, "isdn.calling_subaddr", subaddress); return FTDM_SUCCESS; } @@ -291,17 +324,16 @@ ftdm_status_t get_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr return get_facility_ie_str(ftdmchan, facilityStr->facilityStr.val, facilityStr->facilityStr.len); } -ftdm_status_t get_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, ftdm_size_t data_len) +ftdm_status_t get_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, uint8_t data_len) { ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - if (data_len > sizeof(caller_data->raw_data)-2) { - ftdm_log(FTDM_LOG_CRIT, "Length of Facility IE exceeds maximum length\n"); - return FTDM_FAIL; - } - + /* size of facilityStr->facilityStr.len is a uint8_t so no need to check + for overflow here as facilityStr->facilityStr.len will always be smaller + than sizeof(caller_data->raw_data) */ + memset(caller_data->raw_data, 0, sizeof(caller_data->raw_data)); /* Always include Facility IE identifier + len so this can be used as a sanity check by the user */ caller_data->raw_data[0] = SNGISDN_Q931_FACILITY_IE_ID; @@ -348,7 +380,7 @@ ftdm_status_t get_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd) val = SNGISDN_PROGIND_DESCR_INVALID; break; } - ftdm_channel_add_var(ftdmchan, "isdn.prog_ind.descr", ftdm_sngisdn_progind_descr2str(val)); + ftdm_call_add_var(&ftdmchan->caller_data, "isdn.prog_ind.descr", ftdm_sngisdn_progind_descr2str(val)); } if (progInd->location.pres) { @@ -379,7 +411,7 @@ ftdm_status_t get_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd) val = SNGISDN_PROGIND_LOC_INVALID; break; } - ftdm_channel_add_var(ftdmchan, "isdn.prog_ind.loc", ftdm_sngisdn_progind_loc2str(val)); + ftdm_call_add_var(&ftdmchan->caller_data, "isdn.prog_ind.loc", ftdm_sngisdn_progind_loc2str(val)); } return FTDM_SUCCESS; } @@ -423,6 +455,89 @@ ftdm_status_t set_calling_num(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb) return FTDM_SUCCESS; } +ftdm_status_t set_calling_num2(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb) +{ + const char* string = NULL; + uint8_t len,val; + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; + + string = ftdm_call_get_var(caller_data, "isdn.cg_pty2.digits"); + if ((string == NULL) || !(*string)) { + return FTDM_FAIL; + } + + cgPtyNmb->eh.pres = PRSNT_NODEF; + + len = strlen(string); + cgPtyNmb->nmbDigits.len = len; + + cgPtyNmb->nmbDigits.pres = PRSNT_NODEF; + memcpy(cgPtyNmb->nmbDigits.val, string, len); + + /* Screening Indicator */ + cgPtyNmb->screenInd.pres = PRSNT_NODEF; + + val = FTDM_SCREENING_INVALID; + string = ftdm_call_get_var(caller_data, "isdn.cg_pty2.screening_ind"); + if ((string != NULL) && (*string)) { + val = ftdm_str2ftdm_screening(string); + } + + /* isdn.cg_pty2.screen_ind does not exist or we could not parse its value */ + if (val == FTDM_SCREENING_INVALID) { + /* default to caller data screening ind */ + cgPtyNmb->screenInd.val = caller_data->screen; + } else { + cgPtyNmb->screenInd.val = val; + } + + /* Presentation Indicator */ + cgPtyNmb->presInd0.pres = PRSNT_NODEF; + + val = FTDM_PRES_INVALID; + string = ftdm_call_get_var(caller_data, "isdn.cg_pty2.presentation_ind"); + if ((string != NULL) && (*string)) { + val = ftdm_str2ftdm_presentation(string); + } + + if (val == FTDM_PRES_INVALID) { + cgPtyNmb->presInd0.val = caller_data->pres; + } else { + cgPtyNmb->presInd0.val = val; + } + + /* Numbering Plan Indicator */ + cgPtyNmb->nmbPlanId.pres = PRSNT_NODEF; + + val = FTDM_NPI_INVALID; + string = ftdm_call_get_var(caller_data, "isdn.cg_pty2.npi"); + if ((string != NULL) && (*string)) { + val = ftdm_str2ftdm_npi(string); + } + + if (val == FTDM_NPI_INVALID) { + cgPtyNmb->nmbPlanId.val = caller_data->cid_num.plan; + } else { + cgPtyNmb->nmbPlanId.val = val; + } + + cgPtyNmb->typeNmb1.pres = PRSNT_NODEF; + + /* Type of Number */ + val = FTDM_TON_INVALID; + string = ftdm_call_get_var(caller_data, "isdn.cg_pty2.ton"); + if ((string != NULL) && (*string)) { + val = ftdm_str2ftdm_ton(string); + } + + if (val == FTDM_TON_INVALID) { + cgPtyNmb->typeNmb1.val = caller_data->cid_num.type; + } else { + cgPtyNmb->typeNmb1.val = val; + } + return FTDM_SUCCESS; +} + ftdm_status_t set_called_num(ftdm_channel_t *ftdmchan, CdPtyNmb *cdPtyNmb) { ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; @@ -544,7 +659,7 @@ ftdm_status_t set_calling_name(ftdm_channel_t *ftdmchan, ConEvnt *conEvnt) ftdm_status_t set_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad) { const char* clg_subaddr = NULL; - clg_subaddr = ftdm_channel_get_var(ftdmchan, "isdn.calling_subaddr"); + clg_subaddr = ftdm_call_get_var(&ftdmchan->caller_data, "isdn.calling_subaddr"); if ((clg_subaddr != NULL) && (*clg_subaddr)) { unsigned len = strlen (clg_subaddr); cgPtySad->eh.pres = PRSNT_NODEF; @@ -565,7 +680,7 @@ ftdm_status_t set_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad) ftdm_status_t set_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr) { ftdm_status_t status; - status = set_facility_ie_str(ftdmchan, facilityStr->facilityStr.val, (ftdm_size_t*)&facilityStr->facilityStr.len); + status = set_facility_ie_str(ftdmchan, facilityStr->facilityStr.val, (uint8_t*)&(facilityStr->facilityStr.len)); if (status == FTDM_SUCCESS) { facilityStr->eh.pres = PRSNT_NODEF; facilityStr->facilityStr.pres = PRSNT_NODEF; @@ -573,13 +688,15 @@ ftdm_status_t set_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr return status; } -ftdm_status_t set_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, ftdm_size_t *data_len) +ftdm_status_t set_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, uint8_t *data_len) { + int len; ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; if (caller_data->raw_data_len > 0 && caller_data->raw_data[0] == SNGISDN_Q931_FACILITY_IE_ID) { - *data_len = caller_data->raw_data[1]; - memcpy(data, &caller_data->raw_data[2], *data_len); + len = caller_data->raw_data[1]; + memcpy(data, &caller_data->raw_data[2], len); + *data_len = len; return FTDM_SUCCESS; } return FTDM_FAIL; @@ -591,7 +708,7 @@ ftdm_status_t set_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd, ftdm_s int descr = prog_ind.descr; int loc = prog_ind.loc; - str = ftdm_channel_get_var(ftdmchan, "isdn.prog_ind.descr"); + str = ftdm_call_get_var(&ftdmchan->caller_data, "isdn.prog_ind.descr"); if (str && *str) { /* User wants to override progress indicator */ descr = ftdm_str2ftdm_sngisdn_progind_descr(str); @@ -602,8 +719,8 @@ ftdm_status_t set_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd, ftdm_s return FTDM_SUCCESS; } - str = ftdm_channel_get_var(ftdmchan, "isdn.prog_ind.loc"); - if (str && *str) { + str = ftdm_call_get_var(&ftdmchan->caller_data, "isdn.prog_ind.loc"); + if (str && *str) { loc = ftdm_str2ftdm_sngisdn_progind_loc(str); } if (loc == SNGISDN_PROGIND_LOC_INVALID) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index 72e4bac..7517ee4 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -211,10 +211,10 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ /* add any special variables for the dialplan */ sprintf(nadi, "%d", siConEvnt->cgPtyNum.natAddrInd.val); - ftdm_channel_add_var(ftdmchan, "ss7_clg_nadi", nadi); + ftdm_call_add_var(&ftdmchan->caller_data, "ss7_clg_nadi", nadi); sprintf(nadi, "%d", siConEvnt->cdPtyNum.natAddrInd.val); - ftdm_channel_add_var(ftdmchan, "ss7_cld_nadi", nadi); + ftdm_call_add_var(&ftdmchan->caller_data, "ss7_cld_nadi", nadi); /* check if a COT test is requested */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index 008265b..ec8d7df 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -187,7 +187,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) copy_cgPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cgPtyNum); /* check if the user would like a custom NADI value for the calling Pty Num */ - clg_nadi = ftdm_channel_get_var(ftdmchan, "ss7_clg_nadi"); + clg_nadi = ftdm_call_get_var(&ftdmchan->caller_data, "ss7_clg_nadi"); if ((clg_nadi != NULL) && (*clg_nadi)) { SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Calling NADI value \"%s\"\n", clg_nadi); iam.cgPtyNum.natAddrInd.val = atoi(clg_nadi); @@ -196,7 +196,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) SS7_DEBUG_CHAN(ftdmchan,"No user supplied NADI value found for CLG, using \"%d\"\n", iam.cgPtyNum.natAddrInd.val); } - cld_nadi = ftdm_channel_get_var(ftdmchan, "ss7_cld_nadi"); + cld_nadi = ftdm_call_get_var(&ftdmchan->caller_data, "ss7_cld_nadi"); if ((cld_nadi != NULL) && (*cld_nadi)) { SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Called NADI value \"%s\"\n", cld_nadi); iam.cdPtyNum.natAddrInd.val = atoi(cld_nadi); @@ -206,7 +206,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) } /* check if the user would like us to send a clg_sub-address */ - clg_subAddr = ftdm_channel_get_var(ftdmchan, "ss7_clg_subaddr"); + clg_subAddr = ftdm_call_get_var(&ftdmchan->caller_data, "ss7_clg_subaddr"); if ((clg_subAddr != NULL) && (*clg_subAddr)) { SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Calling Sub-Address value \"%s\"\n", clg_subAddr); @@ -245,7 +245,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) } /* check if the user would like us to send a cld_sub-address */ - cld_subAddr = ftdm_channel_get_var(ftdmchan, "ss7_cld_subaddr"); + cld_subAddr = ftdm_call_get_var(&ftdmchan->caller_data, "ss7_cld_subaddr"); if ((cld_subAddr != NULL) && (*cld_subAddr)) { SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Called Sub-Address value \"%s\"\n", cld_subAddr); @@ -298,7 +298,8 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) iam.cgPtyNum.natAddrInd.val, ftdmchan->caller_data.dnis.digits, iam.cdPtyNum.natAddrInd.val); - + + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -379,7 +380,7 @@ void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan) ADDRCMPLT); SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx ACM\n", sngss7_info->circuit->cic); - + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -403,7 +404,7 @@ void ft_to_sngss7_anm (ftdm_channel_t * ftdmchan) 5); SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx ANM\n", sngss7_info->circuit->cic); - + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -438,7 +439,7 @@ void ft_to_sngss7_rel (ftdm_channel_t * ftdmchan) SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx REL cause=%d \n", sngss7_info->circuit->cic, ftdmchan->caller_data.hangup_cause ); - + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -461,7 +462,7 @@ void ft_to_sngss7_rlc (ftdm_channel_t * ftdmchan) &rlc); SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx RLC\n", sngss7_info->circuit->cic); - + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -482,7 +483,7 @@ void ft_to_sngss7_rsc (ftdm_channel_t * ftdmchan) NULL); SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx RSC\n", sngss7_info->circuit->cic); - + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -503,7 +504,7 @@ void ft_to_sngss7_rsca (ftdm_channel_t * ftdmchan) NULL); SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx RSC-RLC\n", sngss7_info->circuit->cic); - + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -524,7 +525,7 @@ void ft_to_sngss7_blo (ftdm_channel_t * ftdmchan) NULL); SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx BLO\n", sngss7_info->circuit->cic); - + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -545,7 +546,7 @@ void ft_to_sngss7_bla (ftdm_channel_t * ftdmchan) NULL); SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx BLA\n", sngss7_info->circuit->cic); - + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -567,7 +568,7 @@ ft_to_sngss7_ubl (ftdm_channel_t * ftdmchan) NULL); SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx UBL\n", sngss7_info->circuit->cic); - + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -588,7 +589,7 @@ void ft_to_sngss7_uba (ftdm_channel_t * ftdmchan) NULL); SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx UBA\n", sngss7_info->circuit->cic); - + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -609,7 +610,7 @@ void ft_to_sngss7_lpa (ftdm_channel_t * ftdmchan) NULL); SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx LPA\n", sngss7_info->circuit->cic); - + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -654,6 +655,7 @@ void ft_to_sngss7_gra (ftdm_channel_t * ftdmchan) sngss7_info->circuit->cic, (sngss7_info->circuit->cic + sngss7_span->rx_grs.range)); + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -686,7 +688,8 @@ void ft_to_sngss7_grs (ftdm_channel_t * ftdmchan) sngss7_info->circuit->cic, sngss7_info->circuit->cic, (sngss7_info->circuit->cic + sngss7_span->tx_grs.range)); - + + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -735,7 +738,7 @@ void ft_to_sngss7_cgba(ftdm_channel_t * ftdmchan) /* clean out the saved data */ memset(&sngss7_span->rx_cgb, 0x0, sizeof(sngss7_group_data_t)); - + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -785,6 +788,7 @@ void ft_to_sngss7_cgua(ftdm_channel_t * ftdmchan) /* clean out the saved data */ memset(&sngss7_span->rx_cgu, 0x0, sizeof(sngss7_group_data_t)); + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -835,6 +839,7 @@ void ft_to_sngss7_cgb(ftdm_channel_t * ftdmchan) /* clean out the saved data */ memset(&sngss7_span->tx_cgb, 0x0, sizeof(sngss7_group_data_t)); + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } @@ -885,6 +890,7 @@ void ft_to_sngss7_cgu(ftdm_channel_t * ftdmchan) /* clean out the saved data */ memset(&sngss7_span->tx_cgu, 0x0, sizeof(sngss7_group_data_t)); + ftdm_call_clear_vars(&ftdmchan->caller_data); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 41e7f50..4ee6ff5 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -272,6 +272,8 @@ typedef struct { uint8_t plan; } ftdm_number_t; +typedef void * ftdm_variable_container_t; + /*! \brief Caller information */ typedef struct ftdm_caller_data { char cid_date[8]; /*!< Caller ID date */ @@ -286,12 +288,13 @@ typedef struct ftdm_caller_data { char collected[25]; /*!< Collected digits so far */ int hangup_cause; /*!< Hangup cause */ char raw_data[1024]; /*!< Protocol specific raw caller data */ - uint32_t raw_data_len; /* !< Raw data length */ + uint32_t raw_data_len; /*!< Raw data length */ /* these 2 are undocumented right now, only used by boost: */ /* bearer capability */ ftdm_bearer_cap_t bearer_capability; /* user information layer 1 protocol */ ftdm_user_layer1_prot_t bearer_layer1; + ftdm_variable_container_t variables; /*!<variables attached to this call */ } ftdm_caller_data_t; /*! \brief Tone type */ @@ -316,7 +319,7 @@ typedef enum { FTDM_SIGEVENT_RESTART, /*!< Restart has been requested. Typically you hangup your call resources here */ FTDM_SIGEVENT_SIGSTATUS_CHANGED, /*!< Signaling protocol status changed (ie: D-chan up), see new status in raw_data ftdm_sigmsg_t member */ FTDM_SIGEVENT_COLLISION, /*!< Outgoing call was dropped because an incoming call arrived at the same time */ - FTDM_SIGEVENT_MSG, /*!< We received an in-call msg */ + FTDM_SIGEVENT_FACILITY, /* !< In call facility event */ FTDM_SIGEVENT_INVALID } ftdm_signal_event_t; #define SIGNAL_STRINGS "START", "STOP", "RELEASED", "UP", "FLASH", "PROCEED", "PROGRESS", \ @@ -378,7 +381,7 @@ struct ftdm_sigmsg { ftdm_channel_t *channel; /*!< Related channel */ uint32_t chan_id; /*!< easy access to chan id */ uint32_t span_id; /*!< easy access to span_id */ - ftdm_signaling_status_t sigstatus; /*!< Signaling status (valid if event_id is FTDM_SIGEVENT_SIGSTATUS_CHANGED) */ + ftdm_signaling_status_t sigstatus; /*!< Signaling status (valid if event_id is FTDM_SIGEVENT_SIGSTATUS_CHANGED) */ void *raw_data; /*!< Message specific data if any */ uint32_t raw_data_len; /*!< Data len in case is needed */ }; @@ -507,6 +510,7 @@ struct ftdm_memory_handler { * You don't need these unless your implementing an I/O interface module (most users don't) */ #define FIO_CHANNEL_REQUEST_ARGS (ftdm_span_t *span, uint32_t chan_id, ftdm_direction_t direction, ftdm_caller_data_t *caller_data, ftdm_channel_t **ftdmchan) #define FIO_CHANNEL_OUTGOING_CALL_ARGS (ftdm_channel_t *ftdmchan) +#define FIO_CHANNEL_SEND_MSG_ARGS (ftdm_channel_t *ftdmchan, ftdm_sigmsg_t *sigmsg) #define FIO_CHANNEL_SET_SIG_STATUS_ARGS (ftdm_channel_t *ftdmchan, ftdm_signaling_status_t status) #define FIO_CHANNEL_GET_SIG_STATUS_ARGS (ftdm_channel_t *ftdmchan, ftdm_signaling_status_t *status) #define FIO_SPAN_SET_SIG_STATUS_ARGS (ftdm_span_t *span, ftdm_signaling_status_t status) @@ -539,6 +543,7 @@ struct ftdm_memory_handler { * You don't need these unless your implementing an I/O interface module (most users don't) */ typedef ftdm_status_t (*fio_channel_request_t) FIO_CHANNEL_REQUEST_ARGS ; typedef ftdm_status_t (*fio_channel_outgoing_call_t) FIO_CHANNEL_OUTGOING_CALL_ARGS ; +typedef ftdm_status_t (*fio_channel_send_msg_t) FIO_CHANNEL_SEND_MSG_ARGS; typedef ftdm_status_t (*fio_channel_set_sig_status_t) FIO_CHANNEL_SET_SIG_STATUS_ARGS; typedef ftdm_status_t (*fio_channel_get_sig_status_t) FIO_CHANNEL_GET_SIG_STATUS_ARGS; typedef ftdm_status_t (*fio_span_set_sig_status_t) FIO_SPAN_SET_SIG_STATUS_ARGS; @@ -572,6 +577,7 @@ typedef ftdm_status_t (*fio_api_t) FIO_API_ARGS ; * You don't need these unless your implementing an I/O interface module (most users don't) */ #define FIO_CHANNEL_REQUEST_FUNCTION(name) ftdm_status_t name FIO_CHANNEL_REQUEST_ARGS #define FIO_CHANNEL_OUTGOING_CALL_FUNCTION(name) ftdm_status_t name FIO_CHANNEL_OUTGOING_CALL_ARGS +#define FIO_CHANNEL_SEND_MSG_FUNCTION(name) ftdm_status_t name FIO_CHANNEL_SEND_MSG_ARGS #define FIO_CHANNEL_SET_SIG_STATUS_FUNCTION(name) ftdm_status_t name FIO_CHANNEL_SET_SIG_STATUS_ARGS #define FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(name) ftdm_status_t name FIO_CHANNEL_GET_SIG_STATUS_ARGS #define FIO_SPAN_SET_SIG_STATUS_FUNCTION(name) ftdm_status_t name FIO_SPAN_SET_SIG_STATUS_ARGS @@ -672,6 +678,12 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_place(const char *file, const char /*! \brief Indicate a new condition in an incoming call recording the source code point where it was called (see ftdm_channel_call_indicate for an easy to use macro) */ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_indicate(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_channel_indication_t indication); +/*! \brief Send a message on a call */ +#define ftdm_channel_call_send_msg(ftdmchan, sigmsg) _ftdm_channel_call_send_msg(__FILE__, __FUNCTION__, __LINE__, (ftdmchan), (sigmsg)) + +/*! \brief Send a signal on a call recording the source code point where it was called (see ftdm_channel_call_send_msg for an easy to use macro) */ +FT_DECLARE(ftdm_status_t) _ftdm_channel_call_send_msg(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan, ftdm_sigmsg_t *sigmsg); + /*! \brief Hangup the call without cause */ #define ftdm_channel_call_hangup(ftdmchan) _ftdm_channel_call_hangup(__FILE__, __FUNCTION__, __LINE__, (ftdmchan)) @@ -1128,6 +1140,45 @@ FT_DECLARE(ftdm_iterator_t *) ftdm_iterator_next(ftdm_iterator_t *iter); */ FT_DECLARE(ftdm_status_t) ftdm_iterator_free(ftdm_iterator_t *iter); +/*! \brief Add a custom variable to the call + * \note This variables may be used by signaling modules to override signaling parameters + * \todo Document which signaling variables are available + * */ +FT_DECLARE(ftdm_status_t) ftdm_call_add_var(ftdm_caller_data_t *caller_data, const char *var_name, const char *value); + +/*! \brief Get a custom variable from the call. + * \note The variable pointer returned is only valid during the callback receiving SIGEVENT. */ +FT_DECLARE(const char *) ftdm_call_get_var(ftdm_caller_data_t *caller_data, const char *var_name); + +/*! \brief Get an iterator to iterate over the channel variables + * \param caller_data The signal msg structure containing the variables + * \param iter Optional iterator. You can reuse an old iterator (not previously freed) to avoid the extra allocation of a new iterator. + * \note The iterator pointer returned is only valid while the signal message and it'll be destroyed when the signal message is processed. + * This iterator is completely non-thread safe, if you are adding variables or removing variables while iterating + * results are unpredictable + */ +FT_DECLARE(ftdm_iterator_t *) ftdm_call_get_var_iterator(const ftdm_caller_data_t *caller_data, ftdm_iterator_t *iter); + +/*! \brief Get variable name and value for the current iterator position */ +FT_DECLARE(ftdm_status_t) ftdm_call_get_current_var(ftdm_iterator_t *iter, const char **var_name, const char **var_val); + +/*! \brief Clear all variables attached to the call + * \note Variables are cleared at the end of each call back, so it is not necessary for the user to call this function. + * \todo Document which signaling variables are available + * */ +FT_DECLARE(ftdm_status_t) ftdm_call_clear_vars(ftdm_caller_data_t *caller_data); + +/*! \brief Remove a variable attached to the call + * \note Removes a variable that was attached to the call. + * \todo Document which call variables are available + * */ +FT_DECLARE(ftdm_status_t) ftdm_call_remove_var(ftdm_caller_data_t *caller_data, const char *var_name); + +/*! \brief Clears all the temporary data attached to this call + * \note Clears caller_data->variables and caller_data->raw_data. + * */ +FT_DECLARE(void) ftdm_call_clear_data(ftdm_caller_data_t *caller_data); + /*! \brief Get the span pointer associated to the channel */ FT_DECLARE(ftdm_span_t *) ftdm_channel_get_span(const ftdm_channel_t *ftdmchan); diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index a1e1c02..deabafd 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -503,6 +503,7 @@ struct ftdm_span { teletone_multi_tone_t tone_finder[FTDM_TONEMAP_INVALID+1]; ftdm_channel_t *channels[FTDM_MAX_CHANNELS_SPAN+1]; fio_channel_outgoing_call_t outgoing_call; + fio_channel_send_msg_t send_msg; fio_channel_set_sig_status_t set_channel_sig_status; fio_channel_get_sig_status_t get_channel_sig_status; fio_span_set_sig_status_t set_span_sig_status; commit cfd4d52dd07085c2dab6e89f4c7be9a7b4f4287d Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Dec 9 12:01:24 2010 -0600 fix memory alloc issue diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 143666c..5d666f0 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -90,6 +90,7 @@ switch_status_t sofia_presence_chat_send(const char *proto, const char *from, co char *user_via = NULL; char *contact_str = NULL; char *dup_dest = NULL; + char *remote_host = NULL; if (!to) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing To: header.\n"); @@ -185,11 +186,9 @@ switch_status_t sofia_presence_chat_send(const char *proto, const char *from, co /* sofia_glue is running sofia_overcome_sip_uri_weakness we do not, not sure if it matters */ - remote_ip = malloc(sizeof(80)); dup_dest = strdup(dst->contact); if (switch_stristr("fs_path", dst->contact)) { - char *remote_host = NULL; const char *s; if ((s = switch_stristr("fs_path=", dst->contact))) { @@ -202,7 +201,6 @@ switch_status_t sofia_presence_chat_send(const char *proto, const char *from, co if (!zstr(remote_host)) { switch_split_user_domain(remote_host, NULL, &remote_ip); } - switch_safe_free(remote_host); } if (zstr(remote_ip)) { @@ -236,7 +234,7 @@ switch_status_t sofia_presence_chat_send(const char *proto, const char *from, co } switch_safe_free(dup_dest); - free(remote_ip); + switch_safe_free(remote_host); status = SWITCH_STATUS_SUCCESS; commit a15f51d5772c47fe3a3e49542d227dad5e7e9944 Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Dec 9 09:22:17 2010 -0600 ESL-37 [patch] Make last_event pointer last longer diff --git a/libs/esl/src/esl.c b/libs/esl/src/esl.c index 4a02a8f..ce582d3 100644 --- a/libs/esl/src/esl.c +++ b/libs/esl/src/esl.c @@ -1177,7 +1177,6 @@ ESL_DECLARE(esl_status_t) esl_send_recv_timed(esl_handle_t *handle, const char * return ESL_FAIL; } - esl_event_safe_destroy(&handle->last_event); esl_event_safe_destroy(&handle->last_sr_event); *handle->last_sr_reply = '\0'; commit e680c821297c26530b118ab4ef77f030b1f6e365 Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Dec 9 08:59:06 2010 -0600 Freetdm windows fixes diff --git a/libs/freetdm/freetdm.2010.sln b/libs/freetdm/freetdm.2010.sln index f4bd907..44431d6 100644 --- a/libs/freetdm/freetdm.2010.sln +++ b/libs/freetdm/freetdm.2010.sln @@ -119,10 +119,8 @@ Global {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|x64.ActiveCfg = Release|x64 {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|x64.Build.0 = Release|x64 {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Debug|Win32.ActiveCfg = Debug|Win32 - {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Debug|Win32.Build.0 = Debug|Win32 {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Debug|x64.ActiveCfg = Debug|x64 {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|Win32.ActiveCfg = Release|Win32 - {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|Win32.Build.0 = Release|Win32 {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|x64.ActiveCfg = Release|x64 {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Debug|Win32.ActiveCfg = Debug|Win32 {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Debug|x64.ActiveCfg = Debug|x64 diff --git a/libs/freetdm/src/testsangomaboost.c b/libs/freetdm/src/testsangomaboost.c index 01e5a6b..b254a08 100644 --- a/libs/freetdm/src/testsangomaboost.c +++ b/libs/freetdm/src/testsangomaboost.c @@ -51,7 +51,9 @@ #if defined(__linux__) && !defined(__USE_BSD) #define __USE_BSD #endif +#ifndef WIN32 #include <unistd.h> +#endif #include "freetdm.h" commit 36a84423e7c788a73348420ebcd9dcee95d34fd3 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Dec 9 12:52:32 2010 -0200 freetdm: ftmod_zt - fixed typo on documentation diff --git a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c index 9a6597c..e1d6640 100644 --- a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c +++ b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c @@ -983,7 +983,7 @@ FIO_SPAN_POLL_EVENT_FUNCTION(zt_poll_event) } /** - * \brief Retrieves an event from a ftdmtel span + * \brief Retrieves an event from a ftdm channel * \param ftdmchan Channel to retrieve event from * \param event FreeTDM event to return * \return Success or failure commit fa05585f1a55255ec937ed2cb3eb52743613b972 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Dec 9 12:48:33 2010 -0200 freetdm: ftmod_zt - created zt_channel_next_event() to poll for events on a single channel diff --git a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c index 9247edc..9a6597c 100644 --- a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c +++ b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c @@ -177,6 +177,7 @@ static ftdm_socket_t CONTROL_FD = ZT_INVALID_SOCKET; FIO_SPAN_NEXT_EVENT_FUNCTION(zt_next_event); FIO_SPAN_POLL_EVENT_FUNCTION(zt_poll_event); +FIO_CHANNEL_NEXT_EVENT_FUNCTION(zt_channel_next_event); /** * \brief Initialises codec, and rx/tx gains @@ -983,6 +984,107 @@ FIO_SPAN_POLL_EVENT_FUNCTION(zt_poll_event) /** * \brief Retrieves an event from a ftdmtel span + * \param ftdmchan Channel to retrieve event from + * \param event FreeTDM event to return + * \return Success or failure + */ +FIO_CHANNEL_NEXT_EVENT_FUNCTION(zt_channel_next_event) +{ + uint32_t i, event_id = FTDM_OOB_INVALID; + zt_event_t zt_event_id = 0; + ftdm_span_t *span = ftdmchan->span; + + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_EVENT)) { + ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_EVENT); + if (ioctl(ftdmchan->sockfd, codes.GETEVENT, &zt_event_id) == -1) { + snprintf(span->last_error, sizeof(span->last_error), "%s", strerror(errno)); + return FTDM_FAIL; + } + + switch(zt_event_id) { + case ZT_EVENT_RINGEROFF: + { + return FTDM_FAIL; + } + break; + case ZT_EVENT_RINGERON: + { + return FTDM_FAIL; + } + break; + case ZT_EVENT_RINGBEGIN: + { + event_id = FTDM_OOB_RING_START; + } + break; + case ZT_EVENT_ONHOOK: + { + event_id = FTDM_OOB_ONHOOK; + } + break; + case ZT_EVENT_WINKFLASH: + { + if (ftdmchan->state == FTDM_CHANNEL_STATE_DOWN || ftdmchan->state == FTDM_CHANNEL_STATE_DIALING) { + event_id = FTDM_OOB_WINK; + } else { + event_id = FTDM_OOB_FLASH; + } + } + break; + case ZT_EVENT_RINGOFFHOOK: + { + if (ftdmchan->type == FTDM_CHAN_TYPE_FXS || (ftdmchan->type == FTDM_CHAN_TYPE_EM && ftdmchan->state != FTDM_CHANNEL_STATE_UP)) { + ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_OFFHOOK); + event_id = FTDM_OOB_OFFHOOK; + } else if (ftdmchan->type == FTDM_CHAN_TYPE_FXO) { + event_id = FTDM_OOB_RING_START; + } else { + event_id = FTDM_OOB_NOOP; + } + } + break; + case ZT_EVENT_ALARM: + { + event_id = FTDM_OOB_ALARM_TRAP; + } + break; + case ZT_EVENT_NOALARM: + { + event_id = FTDM_OOB_ALARM_CLEAR; + } + break; + case ZT_EVENT_BITSCHANGED: + { + event_id = FTDM_OOB_CAS_BITS_CHANGE; + int bits = 0; + int err = ioctl(ftdmchan->sockfd, codes.GETRXBITS, &bits); + if (err) { + return FTDM_FAIL; + } + ftdmchan->rx_cas_bits = bits; + } + break; + default: + { + ftdm_log(FTDM_LOG_WARNING, "Unhandled event %d for %d:%d\n", zt_event_id, span->span_id, i); + event_id = FTDM_OOB_INVALID; + } + break; + } + + ftdmchan->last_event_time = 0; + span->event_header.e_type = FTDM_EVENT_OOB; + span->event_header.enum_id = event_id; + span->event_header.channel = ftdmchan; + *event = &span->event_header; + return FTDM_SUCCESS; + } + + return FTDM_FAIL; +} + +/** + * \brief Retrieves an event from a ftdmtel span * \param span Span to retrieve event from * \param event FreeTDM event to return * \return Success or failure commit 87bb33ae3a79c7c6abb61d3e7b74c84b3562f30e Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Dec 9 08:44:55 2010 -0600 windows fix x64 build warnings freetdm diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 249d858..46ae77f 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -3415,7 +3415,7 @@ static FIO_READ_FUNCTION(ftdm_raw_read) ftdm_status_t status = ftdmchan->fio->read(ftdmchan, data, datalen); if (status == FTDM_SUCCESS && ftdmchan->fds[FTDM_READ_TRACE_INDEX] > -1) { ftdm_size_t dlen = *datalen; - if ((ftdm_size_t)write(ftdmchan->fds[FTDM_READ_TRACE_INDEX], data, dlen) != dlen) { + if ((ftdm_size_t)write(ftdmchan->fds[FTDM_READ_TRACE_INDEX], data, (int)dlen) != dlen) { ftdm_log(FTDM_LOG_WARNING, "Raw input trace failed to write all of the %zd bytes\n", dlen); } } @@ -3428,7 +3428,7 @@ static FIO_READ_FUNCTION(ftdm_raw_read) ftdm_size_t dlen = *datalen; ftdm_size_t rc = 0; - write_chan_io_dump(&ftdmchan->rxdump, data, dlen); + write_chan_io_dump(&ftdmchan->rxdump, data, (int)dlen); /* if dtmf debug is enabled and initialized, write there too */ if (ftdmchan->dtmfdbg.file) { commit 499eafb2e02f7d5359dc7d09aa635c7f4dbd3c69 Author: Moises Silva <moy@sangoma.com> Date: Thu Dec 9 07:19:31 2010 -0500 freetdm: check for dump enabled before writing to file diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 249d858..ef29096 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -128,8 +128,15 @@ static void write_chan_io_dump(ftdm_io_dump_t *dump, char *dataptr, int dlen) static void dump_chan_io_to_file(ftdm_channel_t *fchan, ftdm_io_dump_t *dump, FILE *file) { /* write the saved audio buffer */ - size_t rc = 0; - size_t towrite = dump->size - dump->windex; + ftdm_size_t rc = 0; + ftdm_size_t towrite = 0; + + if (!dump->buffer) { + return; + } + + towrite = dump->size - dump->windex; + if (dump->wrapped) { rc = fwrite(&dump->buffer[dump->windex], 1, towrite, file); if (rc != towrite) { @@ -2821,6 +2828,10 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co if (!obj) { GOTO_STATUS(done, FTDM_FAIL); } + if (!ftdmchan->rxdump.buffer) { + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Not dumped input to file %p, input dump is not enabled\n", obj); + GOTO_STATUS(done, FTDM_FAIL); + } dump_chan_io_to_file(ftdmchan, &ftdmchan->rxdump, obj); ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Dumped input of size %d to file %p\n", ftdmchan->rxdump.size, obj); GOTO_STATUS(done, FTDM_SUCCESS); @@ -2833,6 +2844,10 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co if (!obj) { GOTO_STATUS(done, FTDM_FAIL); } + if (!ftdmchan->txdump.buffer) { + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Not dumped output to file %p, output dump is not enabled\n", obj); + GOTO_STATUS(done, FTDM_FAIL); + } dump_chan_io_to_file(ftdmchan, &ftdmchan->txdump, obj); ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Dumped input of size %zd to file %p\n", ftdmchan->txdump.size, obj); GOTO_STATUS(done, FTDM_SUCCESS); diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index ab85d2b..37070c4 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -29,6 +29,11 @@ * 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. + * + * Contributors: + * + * Arnaldo Pereira <arnaldo@sangoma.com> + * */ #ifdef __linux__ commit 515e0ad175bbf5ec847669b3bd50fd46c9bdeea8 Author: Moises Silva <moy@sangoma.com> Date: Wed Dec 8 23:04:29 2010 -0500 freetdm: fix testsangomaboost diff --git a/libs/freetdm/src/testsangomaboost.c b/libs/freetdm/src/testsangomaboost.c index e9042ee..01e5a6b 100644 --- a/libs/freetdm/src/testsangomaboost.c +++ b/libs/freetdm/src/testsangomaboost.c @@ -52,7 +52,6 @@ #define __USE_BSD #endif #include <unistd.h> -#endif #include "freetdm.h" commit b02682bdbee84142708b4a8b97ca67ad4131ac9e Author: Moises Silva <moy@sangoma.com> Date: Wed Dec 8 22:55:43 2010 -0500 freetdm: ftdm_r2 - process only OOB events diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index ab85d2b..cfb57b2 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -988,6 +988,10 @@ static int ftdm_r2_io_get_oob_event(openr2_chan_t *r2chan, openr2_oob_event_t *e return -1; } + if (fevent->e_type != FTDM_EVENT_OOB) { + return 0; + } + switch (fevent->enum_id) { case FTDM_OOB_CAS_BITS_CHANGE: { diff --git a/libs/freetdm/src/testsangomaboost.c b/libs/freetdm/src/testsangomaboost.c index e9042ee..01e5a6b 100644 --- a/libs/freetdm/src/testsangomaboost.c +++ b/libs/freetdm/src/testsangomaboost.c @@ -52,7 +52,6 @@ #define __USE_BSD #endif #include <unistd.h> -#endif #include "freetdm.h" commit 1ee94f343a5ae31e1d484ed51fc5b6dbc5f1e941 Merge: 648a124 5aba96e Author: Moises Silva <moy@sangoma.com> Date: Wed Dec 8 22:41:51 2010 -0500 Merge remote branch 'fsorig/master' Conflicts: libs/freetdm/src/testsangomaboost.c diff --cc libs/freetdm/src/testsangomaboost.c index 84ff287,61b7c47..e9042ee --- a/libs/freetdm/src/testsangomaboost.c +++ b/libs/freetdm/src/testsangomaboost.c @@@ -48,10 -48,8 +48,9 @@@ #include <stdlib.h> #include <string.h> #include <errno.h> - #ifdef __linux__ - #ifndef __USE_BSD + #if defined(__linux__) && !defined(__USE_BSD) #define __USE_BSD +#endif #include <unistd.h> #endif #include "freetdm.h" commit 5aba96e382793c2c4440a658f7c1797b6c8c2809 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Dec 8 20:38:16 2010 -0600 FS-2910 diff --git a/src/switch_odbc.c b/src/switch_odbc.c index a1c476e..5a88ba7 100644 --- a/src/switch_odbc.c +++ b/src/switch_odbc.c @@ -160,11 +160,6 @@ static int db_is_up(switch_odbc_handle_t *handle) strcpy((char *) sql, "select 1"); } - if (stmt) { - SQLFreeHandle(SQL_HANDLE_STMT, stmt); - stmt = NULL; - } - if (SQLAllocHandle(SQL_HANDLE_STMT, handle->con, &stmt) != SQL_SUCCESS) { code = __LINE__; goto error; @@ -229,6 +224,11 @@ static int db_is_up(switch_odbc_handle_t *handle) goto done; } + if (stmt) { + SQLFreeHandle(SQL_HANDLE_STMT, stmt); + stmt = NULL; + } + switch_safe_free(err_str); switch_yield(1000000); goto top; commit 14113f23b187bd1d25122544033b52c94d0ad905 Author: Michael S Collins <msc@freeswitch.org> Date: Wed Dec 8 13:33:34 2010 -0800 Update ChangeLog through Dec 7 diff --git a/docs/ChangeLog b/docs/ChangeLog index 6037c14..96066b6 100644 --- a/docs/ChangeLog +++ b/docs/ChangeLog @@ -32,6 +32,7 @@ freeswitch (1.0.7) config: default example to resolve some issues with SCA in cases where host and ip are mixed causing the phone to be confused. (r:0279261b) config: Fix phrase files, still missing a sound file (r:6741f350/FS-2742) config: Disallow global-intercept and group-intercept can intercept an outbound call in default dialplan (r:890871ba/FS-2777) + config: fix single domain assumption in default config to be more portable *cough* bkw *cough* (r:f987903e) core: Add RTCP support (FSRTP-14) core: handle some errors on missing db handle conditions core: add ... and shutdown as a fail-safe when no modules are loaded @@ -134,6 +135,16 @@ freeswitch (1.0.7) core: Better handling of progress and answering to prevent sip profile from locking up at higher volumes (r:04e57577/FS-2801) core: ACL for IPv6 address and swigall to boot (r:db91f0e8/FS-2842) core: add intercept_unanswered_only var akin to intercept_unbridged_only (r:68f18efe) + core: switch_odbc_handle_exec_string duplication SQLExecute (r:8b0e7d24/FS-2880) + core: Fix timeout while bridge is waiting for CF_BRIDGED flag (r:2572621b/FS-2368) + core: don't parse events for b legs from a leg thread in case they are using a monolothic python script as a group_confirm exec over socket to send it messages while the call is ringing (r:ed5266d3) + core: add new function to check when messages need parsing to improve performance on parsing messages during originate (r:8b0421ff) + core: run execute_on_answer on_media _on_ring apps async (r:ef4a4ed0) + core: add switch_ivr_insert_file to insert one file into another at an arbitrary sample point (r:82394b37) + core: Slow reload cause calls to hang (r:1ba98b02/FS-2852) + core: Application intercept causes FS to stop processing calls (r:12fc65f7/FS-2872) + core: fix edge cases for endless loop in sql thread (r:5d7c09ed) + core: prevent race while changing codecs mid call (r:7aa72b67) lang: Improve French phrase files (FSCONFIG-23) libapr: Fix issue where after a bridge with a member, uuid of Agent is set to single quote character ' (r:3fee704d/FS-2738) libdingaling: fix race on shutdown causing crash (FSMOD-47) @@ -151,6 +162,7 @@ freeswitch (1.0.7) libesl: Fix SEGV when using serialize function without any arguments (r:910729b5/ESL-44) libesl: fix leak-on-error in esl_connect_timeout() (r:4263d60e) libesl: Call close on connection handle if the connection fails (r:413dcc4c/ESL-50) + libesl: allow fs_cli -x to have args up to 1024 chars (was 256) (r:7039ba47) libfreetdm: implemented freetdm config nodes and ss7 initial configuration libfreetdm: fix codec for CAS signaling (r:b76e7f18) libfreetdm: freetdm: ss7- added support for incoming group blocks, started adding support for ansi (r:c219a73c) @@ -189,7 +201,8 @@ freeswitch (1.0.7) mod_callcenter: Fix invalid update of agent field (r:426a448f/FS-2738) mod_callcenter: Allow to get queue info via api (r:70d592ae) mod_callcenter: Fix bad return type so it compile on archlinux, thx bougyman (r:3a475986) - mod_callcenter: Make callcenter_config agent get return the value of the item requested. Also added queue param max-wait-time-with-no-agent-time-reached: If the max-wai-time-with-no-agent is already reached for the queue, then new caller can wait for x ammount of second before it kicked out of the queue rather than get rejected automaticly. (r:81a03869) + mod_callcenter: Make callcenter_config agent get return the value of the item requested. Also added queue param max-wait-time-with-no-agent-time-reached: If the max-wai-time-with-no-agent is already reached for the queue, then new caller can wait for x amount of second before it kicked out of the queue rather than get rejected automatically. (r:81a03869) + mod_callcenter: Add new event socket agent-offering. Plus some documentation and better handling of bad agent type -- FS-2869 (r:80174cf3/FS-2869) mod_cidlookup: null xml is bad (r:095815f8) mod_cid_lookup: honor skipcitystate when using whitepages (r:a66654de/FSMOD-53) mod_commands: make break uuid_break and add cascade flag @@ -205,6 +218,8 @@ freeswitch (1.0.7) mod_commands: ***BEHAVIOUR CHANGE*** reloadacl, load <module>, reload <module> will now explicitly call reloadxml (r:42c9df72) mod_commands: add nat_map usage (r:7577b8aa) mod_commands: add escaping empty strings to sql_escape (r:7bd0a5a6/FS-2833) + mod_commands: add uuid_fileman <uuid> <cmd>:<val> <-- same vals as the callbacks in js and lua to control the currently playing file of a channel from the cli or ESL (for the people who were ignoring me on the conference call so I decided to implement it instead of try to explain it ) (r:c4369fc8) + mod_commands: FS-2210 Add support for auto completion for uuid_simplify (r:72bcc01b/FS-2210) mod_conference: Fix reporting of volume up/down (MODAPP-419) mod_conference: add last talking time per member to conference xml list mod_conference: add terminate-on-silence conference param @@ -221,6 +236,8 @@ freeswitch (1.0.7) mod_dingaling: make dingaling work with google voice inbound too (r:4ee68141) mod_dingaling: Fix crash when testing the new gv-dingaling with around 24 concurrent calls (r:73e1ec5e/FSCORE-667) mod_dingaling: Fix NULL pointer (r:e3eff816/FS-1103) + mod_dingaling: fix leak in chat_send (r:eb109a85) + mod_dingaling: use the login as message source when not in component mode. (chat_send) (r:58c28aab) mod_directory: Add variable directory_search_order to allow to search by first name by default is set to "first_name" (r:163ca31f) mod_distributor: Add mod_distributor to VS2010 - not built by default (r:bac79ba1) mod_dptools: add eavesdrop_enable_dtmf chan var (r:596c0012) @@ -279,8 +296,10 @@ freeswitch (1.0.7) mod_freetdm: lock the channel when placing call (r:705dd237) mod_freetdm: created cmake files for freetdm (r:fc55997b) mod_freetdm: ss7 - added support to control mtp2, mtp3, and isup timers via freetdm.conf.xml (r:4455d581) + mod_freetdm: made ftmod_r2 use FTDM_SPAN_USE_SIGNALS_QUEUE and properly send FTDM_SIGEVENT_SIGSTATUS_CHANGED (r:af5f0a4a) mod_gsmopen: copy from branch mod_gsmopen: fix FS-2793, compilation stops (r:355c0dbb/FS-2793) + mod_gsmopen: retry serial initialization if failed, zeroing audio buffers, slower retry on soundcard busy (EAGAIN) (r:c7aefe93) mod_hash: free all hashtables on shutdown (r:e76d7d92) mod_hash: remove unneeded initializer (r:10d468a6) mod_hash: begin working on remote support (r:c5ad49da) @@ -324,6 +343,7 @@ freeswitch (1.0.7) mod_lua: Added SAF_ROUTING_EXEC flag to lua app, so it can be run inline (r:7d5ca1c0) mod_managed: Added wrapper for switch_event_bind for .net (r:a5f07a80/MODLANG-165) mod_managed: add additional support (r:5be58aac) + mod_managed: add mono 2.8 patch file see FS-2774 (r:6a948bd9/FS-2774) mod_mp4v: MP4V-ES passthru for washibechi on IRC mod_mp4: New module. Supports playback of MP4 files. Depends on libmp4v2 <http://code.google.com/p/mp4v2/> (originally compiled against v1.6.1) mod_nibblebill: free allocated mem at shutdown; free properly if using custom_sql @@ -472,6 +492,14 @@ freeswitch (1.0.7) mod_sofia: fix missing name and potential segfault in gateway status (r:40ac860a) mod_sofia: Add missing RTP info for early SDP in bypass media (r:10119e9e/FS-2824) mod_sofia: add manual_rtp_bugs to profile and chan var and 3 new RTP bugs SEND_LINEAR_TIMESTAMPS|START_SEQ_AT_ZERO|NEVER_SEND_MARKER (r:b278dd23) + mod_sofia: apparently some sip device vendors did not read the RFC (who knew?) adding verbose_sdp=true var to add needless a= lines for standard iana codecs that explicitly do not require them (r:6c4f49a8) + mod_sofia: Fix registering a gateway, sofia always places a Via header with ext-sip-ip, even if this gateway is local (r:cf398e1a/FS-535) + mod_sofia: add presence-probe-on-register sofia param to send a probe on register instead of presence to deal with some broken phones and add some general improvements to allow multi homed presence (r:14394994) + mod_sofia: Fix issue when fs_path is used so we pick the correct media IP in our outbound invite this was soemthing that wouldn't work correctly over ATT on the iphone. (r:a669f76f) + mod_sofia: Default T38 Options (r:92f43440/FS-2892) + mod_sofia: Fix wrong IP in VIA and contact HEADER for MESSAGE method while fs run in private network (r:59ea4a1b/FS-2886) + mod_sofia: SIP-header History-Info might exist multiple times, but only last header is exposed as a channel variable (r:8cf15012/FS-2881) + mod_sofia: Add support to reboot Yealink phone remotely (r:fdc31908/FS-2897) mod_spandsp: initial checkin of mod_fax/mod_voipcodecs merge into mod_spandsp (r:fa9a59a8) mod_spandsp: rework of new mod_spandsp to have functions broken up into different c files (r:65400642) mod_spandsp: improve duplicate digit detection and add 'min_dup_digit_spacing_ms' channel variable for use with the dtmf detector (r:eab4f246/FSMOD-45) @@ -508,6 +536,8 @@ freeswitch (1.0.7) mod_xml_cdr: fix minor memory leaks and config bug (r:19253d83/MODEVENT-62) mod_xml_rpc: Fix crash if unauthorized XML RPC is attempted (r:9835395c/FS-184) scripts: added honeypot.pl and blacklist.pl which add extra SIP security options (r:b6a81ba7) + scripts: do simple verification to make sure we are getting IP addresses from VoIP abuse blacklist (r:b0049160) + scripts: add_user - cmd line utility that lets admin create new users very easily. (r:ec8f2c2b) sofia-sip: fix null derefernce segfault in soa (r:f356c5e6) sofia-sip: extend timeout for session expires on short timeouts to be 90% of timeout instead of 1/3 to handle devices that do not refresh in time such as polycom (r:a7f48928/SFSIP-212) tools: Add fs_encode tool (r:89b17601) commit 648a124c3f777bd79635ddf8e1d57b6c4c741cfc Author: Moises Silva <moises.silva@gmail.com> Date: Wed Dec 8 15:12:10 2010 -0500 freetdm: improve core flag command diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 758681f..249d858 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -4073,7 +4073,7 @@ static struct { ftdm_io_interface_t *pika_interface; } interfaces; -static void print_channels_by_flag(ftdm_stream_handle_t *stream, uint32_t flag, int not, int *count) +static void print_channels_by_flag(ftdm_stream_handle_t *stream, int32_t flagval, int not, int *count) { ftdm_hash_iterator_t *i = NULL; ftdm_span_t *span; @@ -4082,6 +4082,7 @@ static void print_channels_by_flag(ftdm_stream_handle_t *stream, uint32_t flag, ftdm_iterator_t *curr = NULL; const void *key = NULL; void *val = NULL; + uint32_t flag = (1 << flagval); *count = 0; @@ -4103,13 +4104,13 @@ static void print_channels_by_flag(ftdm_stream_handle_t *stream, uint32_t flag, stream->write_function(stream, "[s%dc%d][%d:%d] has not flag %d\n", fchan->span_id, fchan->chan_id, fchan->physical_span_id, fchan->physical_chan_id, - flag); + flagval); (*count)++; } else if (!not && ftdm_test_flag(fchan, flag)) { stream->write_function(stream, "[s%dc%d][%d:%d] has flag %d\n", fchan->span_id, fchan->chan_id, fchan->physical_span_id, fchan->physical_chan_id, - flag); + flagval); (*count)++; } } @@ -4219,7 +4220,7 @@ static char *handle_core_command(const char *cmd) } flagval = atoi(flag); print_channels_by_flag(&stream, flagval, not, &count); - stream.write_function(&stream, "\nTotal channels %s %s: %d\n", not ? "without flag" : "with flag", flagval, count); + stream.write_function(&stream, "\nTotal channels %s %d: %d\n", not ? "without flag" : "with flag", flagval, count); } else { stream.write_function(&stream, "invalid core command %s\n", argv[0]); } commit 997151838426d4f2de8c6f81a836fd0323cad17d Author: Jeff Lenk <jeff@jefflenk.com> Date: Wed Dec 8 13:59:56 2010 -0600 VS2010 add missing files freetdm diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.2010.vcxproj b/libs/freetdm/mod_freetdm/mod_freetdm.2010.vcxproj new file mode 100644 index 0000000..ec69333 --- /dev/null +++ b/libs/freetdm/mod_freetdm/mod_freetdm.2010.vcxproj @@ -0,0 +1,217 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>mod_freetdm</ProjectName> + <ProjectGuid>{FE3540C5-3303-46E0-A69E-D92F775687F1}</ProjectGuid> + <RootNamespace>mod_freetdm</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(PlatformName)\$(Configuration)\mod\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(PlatformName)\$(Configuration)\mod\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\mod\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(PlatformName)\$(Configuration)\mod\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../../src/include;../src/include;../src/isdn/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalDependencies>FreeSwitchCore.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>../../../$(PlatformName)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile> + <SubSystem>Windows</SubSystem> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <ImportLibrary>$(OutDir)mod_freetdm.lib</ImportLibrary> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <AdditionalIncludeDirectories>../../../src/include;../src/include;../src/isdn/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalDependencies>FreeSwitchCore.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>../../../$(PlatformName)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <ImportLibrary>$(OutDir)mod_freetdm.lib</ImportLibrary> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../../src/include;../src/include;../src/isdn/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalDependencies>FreeSwitchCore.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>../../../$(PlatformName)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile> + <SubSystem>Windows</SubSystem> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <ImportLibrary>$(OutDir)mod_freetdm.lib</ImportLibrary> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <AdditionalIncludeDirectories>../../../src/include;../src/include;../src/isdn/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalDependencies>FreeSwitchCore.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>../../../$(PlatformName)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <ImportLibrary>$(OutDir)mod_freetdm.lib</ImportLibrary> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="mod_freetdm.c" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\msvc\freetdm.2010.vcxproj"> + <Project>{93b8812c-3ec4-4f78-8970-ffbfc99e167d}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.2010.vcxproj.filters b/libs/freetdm/mod_freetdm/mod_freetdm.2010.vcxproj.filters new file mode 100644 index 0000000..92ac5ea --- /dev/null +++ b/libs/freetdm/mod_freetdm/mod_freetdm.2010.vcxproj.filters @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="mod_freetdm.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file commit 18299684bf953f6cc635938a2084bb333ab275ac Author: Moises Silva <moises.silva@gmail.com> Date: Wed Dec 8 14:50:40 2010 -0500 freetdm: added core command to print channels by flag diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 6616487..758681f 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -4073,6 +4073,52 @@ static struct { ftdm_io_interface_t *pika_interface; } interfaces; +static void print_channels_by_flag(ftdm_stream_handle_t *stream, uint32_t flag, int not, int *count) +{ + ftdm_hash_iterator_t *i = NULL; + ftdm_span_t *span; + ftdm_channel_t *fchan = NULL; + ftdm_iterator_t *citer = NULL; + ftdm_iterator_t *curr = NULL; + const void *key = NULL; + void *val = NULL; + + *count = 0; + + ftdm_mutex_lock(globals.mutex); + + for (i = hashtable_first(globals.span_hash); i; i = hashtable_next(i)) { + hashtable_this(i, &key, NULL, &val); + if (!key || !val) { + break; + } + span = val; + citer = ftdm_span_get_chan_iterator(span, NULL); + if (!citer) { + continue; + } + for (curr = citer ; curr; curr = ftdm_iterator_next(curr)) { + fchan = ftdm_iterator_current(curr); + if (not && !ftdm_test_flag(fchan, flag)) { + stream->write_function(stream, "[s%dc%d][%d:%d] has not flag %d\n", + fchan->span_id, fchan->chan_id, + fchan->physical_span_id, fchan->physical_chan_id, + flag); + (*count)++; + } else if (!not && ftdm_test_flag(fchan, flag)) { + stream->write_function(stream, "[s%dc%d][%d:%d] has flag %d\n", + fchan->span_id, fchan->chan_id, + fchan->physical_span_id, fchan->physical_chan_id, + flag); + (*count)++; + } + } + ftdm_iterator_free(citer); + } + + ftdm_mutex_unlock(globals.mutex); +} + static void print_channels_by_state(ftdm_stream_handle_t *stream, ftdm_channel_state_t state, int not, int *count) { ftdm_hash_iterator_t *i = NULL; @@ -4125,6 +4171,8 @@ static char *handle_core_command(const char *cmd) int not = 0; char *argv[10] = { 0 }; char *state = NULL; + char *flag = NULL; + uint32_t flagval = 0; ftdm_channel_state_t i = FTDM_CHANNEL_STATE_INVALID; ftdm_stream_handle_t stream = { 0 }; @@ -4159,6 +4207,19 @@ static char *handle_core_command(const char *cmd) } print_channels_by_state(&stream, i, not, &count); stream.write_function(&stream, "\nTotal channels %s %s: %d\n", not ? "not in state" : "in state", ftdm_channel_state2str(i), count); + } else if (!strcasecmp(argv[0], "flag")) { + if (argc < 2) { + stream.write_function(&stream, "core state command requires an argument\n"); + goto done; + } + flag = argv[1]; + if (argv[1][0] == '!') { + not = 1; + flag++; + } + flagval = atoi(flag); + print_channels_by_flag(&stream, flagval, not, &count); + stream.write_function(&stream, "\nTotal channels %s %s: %d\n", not ? "without flag" : "with flag", flagval, count); } else { stream.write_function(&stream, "invalid core command %s\n", argv[0]); } diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index 9c6260c..df74702 100644 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -266,6 +266,7 @@ typedef enum { FTDM_CHANNEL_USER_HANGUP = (1 << 29), FTDM_CHANNEL_RX_DISABLED = (1 << 30), FTDM_CHANNEL_TX_DISABLED = (1 << 31), + /* ok, when we reach 32, we need to move to uint64_t all the flag stuff */ } ftdm_channel_flag_t; #if defined(__cplusplus) && defined(WIN32) // fix C2676 commit 315441d219fa3accb4ad159e3e33226523b59cdd Author: Moises Silva <moises.silva@gmail.com> Date: Wed Dec 8 14:30:47 2010 -0500 freetdm: ftmod_r2 - handle race on protocol error diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index cdd734b..6616487 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -133,14 +133,16 @@ static void dump_chan_io_to_file(ftdm_channel_t *fchan, ftdm_io_dump_t *dump, FI if (dump->wrapped) { rc = fwrite(&dump->buffer[dump->windex], 1, towrite, file); if (rc != towrite) { - ftdm_log_chan(fchan, FTDM_LOG_ERROR, "only wrote %d out of %d bytes in DTMF debug buffer\n", rc, towrite); + ftdm_log_chan(fchan, FTDM_LOG_ERROR, "only wrote %d out of %d bytes in io dump buffer\n", + rc, towrite, strerror(errno)); } } if (dump->windex) { towrite = dump->windex; rc = fwrite(&dump->buffer[0], 1, towrite, file); if (rc != towrite) { - ftdm_log_chan(fchan, FTDM_LOG_ERROR, "only wrote %d out of %d bytes in DTMF debug buffer\n", rc, towrite); + ftdm_log_chan(fchan, FTDM_LOG_ERROR, "only wrote %d out of %d bytes in io dump buffer: %s\n", + rc, towrite, strerror(errno)); } } dump->windex = 0; diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 81f1754..ab85d2b 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -73,6 +73,7 @@ typedef struct ftdm_r2_call_t { ftdm_size_t ani_index; char logname[255]; char name[10]; + ftdm_timer_id_t protocol_error_recovery_timer; } ftdm_r2_call_t; /* this is just used as place holder in the stack when configuring the span to avoid using bunch of locals */ @@ -334,7 +335,7 @@ static openr2_call_disconnect_cause_t ftdm_r2_ftdm_cause_to_openr2_cause(ftdm_ch static void ft_r2_clean_call(ftdm_r2_call_t *call) { openr2_chan_t *r2chan = call->r2chan; - + /* Do not memset call structure, that clears values we do not want to clear, * like the log name set in on_call_log_created() */ call->r2chan = r2chan; @@ -347,6 +348,7 @@ static void ft_r2_clean_call(ftdm_r2_call_t *call) call->dnis_index = 0; call->ani_index = 0; call->name[0] = 0; + call->protocol_error_recovery_timer = 0; } static void ft_r2_accept_call(ftdm_channel_t *ftdmchan) @@ -451,6 +453,18 @@ static void ftdm_r2_on_call_init(openr2_chan_t *r2chan) ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "Received request to start call\n"); + if (ftdmchan->state == FTDM_CHANNEL_STATE_HANGUP) { + r2call = R2CALL(ftdmchan); + if (r2call->protocol_error) { + /* we had a protocol error and we were giving some recovery time, cancel the recovery timer now + * that is obvious that the other side recovered */ + ftdm_sched_cancel_timer(r2data->sched, r2call->protocol_error_recovery_timer); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Cancelled protocol error recovery timer\n"); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + ftdm_r2_state_advance_all(ftdmchan); + } + } + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)) { ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Cannot start call when channel is in use (state = %s)\n", ftdm_channel_state2str(ftdmchan->state)); return; @@ -658,6 +672,7 @@ static void ftdm_r2_recover_from_protocol_error(void *data) goto done; } ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + ftdm_r2_state_advance_all(ftdmchan); done: ftdm_channel_unlock(ftdmchan); } @@ -960,36 +975,37 @@ static int ftdm_r2_io_setup(openr2_chan_t *r2chan) static int ftdm_r2_io_get_oob_event(openr2_chan_t *r2chan, openr2_oob_event_t *event) { - ftdm_status_t status; - ftdm_event_t *fevent = NULL; - ftdm_channel_t *ftdmchan = openr2_chan_get_fd(r2chan); + ftdm_status_t status; + ftdm_event_t *fevent = NULL; + ftdm_channel_t *ftdmchan = openr2_chan_get_fd(r2chan); - *event = OR2_OOB_EVENT_NONE; - status = ftdm_channel_read_event(ftdmchan, &fevent); - if (status != FTDM_SUCCESS) { + *event = OR2_OOB_EVENT_NONE; + + status = ftdm_channel_read_event(ftdmchan, &fevent); + + if (status != FTDM_SUCCESS) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "failed to retrieve freetdm event!\n"); - return -1; - } - if (fevent->e_type != FTDM_EVENT_OOB) - return 0; + return -1; + } + switch (fevent->enum_id) { - case FTDM_OOB_CAS_BITS_CHANGE: - { - *event = OR2_OOB_EVENT_CAS_CHANGE; - } - break; - case FTDM_OOB_ALARM_TRAP: - { - *event = OR2_OOB_EVENT_ALARM_ON; - } - break; - case FTDM_OOB_ALARM_CLEAR: - { - *event = OR2_OOB_EVENT_ALARM_OFF; - } - break; + case FTDM_OOB_CAS_BITS_CHANGE: + { + *event = OR2_OOB_EVENT_CAS_CHANGE; + } + break; + case FTDM_OOB_ALARM_TRAP: + { + *event = OR2_OOB_EVENT_ALARM_ON; + } + break; + case FTDM_OOB_ALARM_CLEAR: + { + *event = OR2_OOB_EVENT_ALARM_OFF; + } + break; } - return 0; + return 0; } static openr2_io_interface_t ftdm_r2_io_iface = { @@ -1419,7 +1435,8 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) { ftdm_sigmsg_t sigev; int ret; - openr2_chan_t *r2chan = R2CALL(ftdmchan)->r2chan; + ftdm_r2_call_t *r2call = R2CALL(ftdmchan); + openr2_chan_t *r2chan = r2call->r2chan; ftdm_r2_data_t *r2data = ftdmchan->span->signal_data; memset(&sigev, 0, sizeof(sigev)); @@ -1435,10 +1452,10 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) * to complete (the processing is media-bound) * */ if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE) - && (R2CALL(ftdmchan)->chanstate != ftdmchan->state)) { + && (r2call->chanstate != ftdmchan->state)) { ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Executing state handler for %s\n", ftdm_channel_state2str(ftdmchan->state)); - R2CALL(ftdmchan)->chanstate = ftdmchan->state; + r2call->chanstate = ftdmchan->state; if (IS_ACCEPTING_PENDING(ftdmchan)) { /* @@ -1487,13 +1504,8 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) /* notify the user about the new call */ sigev.event_id = FTDM_SIGEVENT_START; - if (ftdm_span_send_signal(ftdmchan->span, &sigev) != FTDM_SUCCESS) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "Failed to handle call offered\n"); - openr2_chan_disconnect_call(r2chan, OR2_CAUSE_OUT_OF_ORDER); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); - break; - } - R2CALL(ftdmchan)->ftdm_call_started = 1; + ftdm_span_send_signal(ftdmchan->span, &sigev); + r2call->ftdm_call_started = 1; break; @@ -1502,7 +1514,7 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: { if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - if (!R2CALL(ftdmchan)->accepted) { + if (!r2call->accepted) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Accepting call\n"); ft_r2_accept_call(ftdmchan); } @@ -1522,11 +1534,11 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Call was answered\n"); if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - if (!R2CALL(ftdmchan)->accepted) { + if (!r2call->accepted) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Call has not been accepted, need to accept first\n"); // the answering will be done in the on_call_accepted handler ft_r2_accept_call(ftdmchan); - R2CALL(ftdmchan)->answer_pending = 1; + r2call->answer_pending = 1; } else { ft_r2_answer_call(ftdmchan); } @@ -1541,19 +1553,19 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) /* just got hangup */ case FTDM_CHANNEL_STATE_HANGUP: { - if (!R2CALL(ftdmchan)->disconnect_rcvd) { + if (!r2call->disconnect_rcvd) { openr2_call_disconnect_cause_t disconnect_cause = ftdm_r2_ftdm_cause_to_openr2_cause(ftdmchan); ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Clearing call, cause = %s\n", openr2_proto_get_disconnect_string(disconnect_cause)); /* this will disconnect the call, but need to wait for the call end before moving to DOWN */ openr2_chan_disconnect_call(r2chan, disconnect_cause); - } else if (!R2CALL(ftdmchan)->protocol_error) { + } else if (!r2call->protocol_error) { /* just ack the hangup, on_call_end will be called by openr2 right after */ openr2_chan_disconnect_call(r2chan, OR2_CAUSE_NORMAL_CLEARING); } else { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Clearing call due to protocol error\n"); /* do not set to down yet, give some time for recovery */ ftdm_sched_timer(r2data->sched, "protocolerr_recover", 100, - ftdm_r2_recover_from_protocol_error, r2chan, NULL); + ftdm_r2_recover_from_protocol_error, r2chan, &r2call->protocol_error_recovery_timer); } } break; @@ -1561,7 +1573,7 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) case FTDM_CHANNEL_STATE_TERMINATING: { /* if the call has not been started yet we must go to HANGUP right here */ - if (!R2CALL(ftdmchan)->ftdm_call_started) { + if (!r2call->ftdm_call_started) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); } else { openr2_call_disconnect_cause_t disconnect_cause = ftdm_r2_ftdm_cause_to_openr2_cause(ftdmchan); @@ -1573,19 +1585,10 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) } break; - /* just got hangup from the freetdm side due to abnormal failure */ - case FTDM_CHANNEL_STATE_CANCEL: - { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Unable to receive call\n"); - openr2_chan_disconnect_call(r2chan, OR2_CAUSE_OUT_OF_ORDER); - } - break; - /* finished call for good */ case FTDM_CHANNEL_STATE_DOWN: { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "R2 Call is down\n"); - openr2_chan_disable_read(r2chan); ret = 1; } break; commit fc2f2790c0acc23d98e05fa8237052789990a72e Merge: e6250bc bc44d99 Author: Moises Silva <moy@sangoma.com> Date: Wed Dec 8 13:16:17 2010 -0500 Merge branch 'master' of git.sangoma.com:smg_freeswitch commit bc44d99a45d816ed2787bd1b1dc7a586ddb1e5b7 Merge: 68cad2a de23c6d Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Wed Dec 8 19:25:55 2010 -0200 Merge branch 'master' of git@git.sangoma.com:smg_freeswitch commit 68cad2aa950472b209350febcf76c0d4f9c5ee99 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Wed Dec 8 19:25:44 2010 -0200 freetdm: ftmod_r2 - use freetdm logical channel id to set r2chan's id diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 2a95b01..cfe3ae6 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -1328,7 +1328,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) } for (i = 1; (i <= span->chan_count) && (i <= FTDM_MAX_CHANNELS_SPAN); i++) { - r2chan = openr2_chan_new_from_fd(r2data->r2context, span->channels[i], span->channels[i]->physical_chan_id); + r2chan = openr2_chan_new_from_fd(r2data->r2context, span->channels[i], span->channels[i]->chan_id); if (!r2chan) { snprintf(span->last_error, sizeof(span->last_error), "Cannot create all openr2 channels for span."); goto fail; commit e6250bcb9493aae8a3e8afdf1502c8417b110072 Author: Moises Silva <moy@sangoma.com> Date: Wed Dec 8 13:15:26 2010 -0500 freetdm: ftmod_r2 - Add protocol error recovery timer diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index fa0479d..166a914 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -138,6 +138,8 @@ typedef struct ftdm_r2_data_s { uint32_t monitor_thread_id; /* Logging directory */ char logdir[512]; + /* scheduling context */ + ftdm_sched_t *sched; } ftdm_r2_data_t; /* one element per span will be stored in g_mod_data_hash global var to keep track of them @@ -145,6 +147,7 @@ typedef struct ftdm_r2_data_s { typedef struct ftdm_r2_span_pvt_s { openr2_context_t *r2context; /* r2 context allocated for this span */ ftdm_hash_t *r2calls; /* hash table of allocated call data per channel for this span */ + ftdm_sched_t *sched; /* schedule for the span */ } ftdm_r2_span_pvt_t; /* span monitor thread */ @@ -312,6 +315,7 @@ static openr2_call_disconnect_cause_t ftdm_r2_ftdm_cause_to_openr2_cause(ftdm_ch case FTDM_CAUSE_NETWORK_OUT_OF_ORDER: case FTDM_CAUSE_SERVICE_UNAVAILABLE: + case FTDM_CAUSE_PROTOCOL_ERROR: return OR2_CAUSE_OUT_OF_ORDER; case FTDM_CAUSE_NO_ANSWER: @@ -644,6 +648,20 @@ static void ftdm_r2_on_os_error(openr2_chan_t *r2chan, int errorcode) ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "OS error: %s\n", strerror(errorcode)); } +static void ftdm_r2_recover_from_protocol_error(void *data) +{ + openr2_chan_t *r2chan = data; + ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); + ftdm_channel_lock(ftdmchan); + if (ftdmchan->state != FTDM_CHANNEL_STATE_HANGUP) { + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Recovering from protocol error but state is %s!\n", ftdm_channel_state2str(ftdmchan->state)); + goto done; + } + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); +done: + ftdm_channel_unlock(ftdmchan); +} + static void ftdm_r2_on_protocol_error(openr2_chan_t *r2chan, openr2_protocol_error_t reason) { ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); @@ -1115,6 +1133,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) unsigned int i = 0; int conf_failure = 0; int intval = 0; + char schedname[255]; const char *var = NULL, *val = NULL; const char *log_level = "notice,warning,error"; /* default loglevel, if none is read from conf */ ftdm_r2_data_t *r2data = NULL; @@ -1374,6 +1393,11 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) /* use signals queue */ ftdm_set_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE); + /* setup the scheduler */ + snprintf(schedname, sizeof(schedname), "ftmod_r2_%s", span->name); + ftdm_assert(ftdm_sched_create(&r2data->sched, schedname) == FTDM_SUCCESS, "Failed to create schedule!\n"); + spanpvt->sched = r2data->sched; + return FTDM_SUCCESS; fail: @@ -1396,6 +1420,7 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) ftdm_sigmsg_t sigev; int ret; openr2_chan_t *r2chan = R2CALL(ftdmchan)->r2chan; + ftdm_r2_data_t *r2data = ftdmchan->span->signal_data; memset(&sigev, 0, sizeof(sigev)); sigev.chan_id = ftdmchan->chan_id; @@ -1526,7 +1551,9 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) openr2_chan_disconnect_call(r2chan, OR2_CAUSE_NORMAL_CLEARING); } else { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Clearing call due to protocol error\n"); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + /* do not set to down yet, give some time for recovery */ + ftdm_sched_timer(r2data->sched, "protocolerr_recover", 100, + ftdm_r2_recover_from_protocol_error, r2chan, NULL); } } break; @@ -1650,6 +1677,11 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) r2data->total_loops++; } + /* run any span timers */ + ftdm_sched_run(r2data->sched); + + /* deliver the actual channel events to the user now without any channel locking */ + ftdm_span_trigger_signals(span); #ifndef WIN32 /* figure out what event to poll each channel for. POLLPRI when the channel is down, * POLLPRI|POLLIN|POLLOUT otherwise */ @@ -1669,6 +1701,9 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) status = ftdm_span_poll_event(span, waitms, NULL); #endif + /* run any span timers */ + ftdm_sched_run(r2data->sched); + res = gettimeofday(&start, NULL); if (res) { ftdm_log(FTDM_LOG_CRIT, "Failure gettimeofday [%s]\n", strerror(errno)); @@ -1722,8 +1757,6 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) ftdm_mutex_unlock(ftdmchan->mutex); } - /* deliver the actual events to the user now without any channel locking */ - ftdm_span_trigger_signals(span); } chaniter = ftdm_span_get_chan_iterator(span, chaniter); @@ -2046,6 +2079,7 @@ static FIO_SIG_UNLOAD_FUNCTION(ftdm_r2_destroy) spanpvt = val; openr2_context_delete(spanpvt->r2context); hashtable_destroy(spanpvt->r2calls); + ftdm_sched_destroy(&spanpvt->sched); } } hashtable_destroy(g_mod_data_hash); commit 972500fcc93f816e0a70fa7b64da6636607167e4 Author: Michael Jerris <mike@jerris.com> Date: Wed Dec 8 12:36:26 2010 -0500 return failure from make if build failed diff --git a/Makefile.am b/Makefile.am index aeb31ec..e701494 100644 --- a/Makefile.am +++ b/Makefile.am @@ -90,6 +90,8 @@ $(RECURSIVE_TARGETS): fi; \ if test -z "$$fail" ; then \ cd $(top_builddir)/build && $(MAKE) $(AM_MAKEFLAGS) $$target || exit 1; \ + else \ + exit 1; \ fi ; CORE_CFLAGS = `$(switch_builddir)/libs/apr/apr-1-config --cflags --cppflags --includes` commit de23c6d375cef19961bcc82b9c3f79d32a95190f Author: Moises Silva <moy@sangoma.com> Date: Wed Dec 8 12:01:13 2010 -0500 freetdm: ftmod_r2 - Remove buggy collision check diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 0286018..fa0479d 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -399,12 +399,6 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(r2_outgoing_call) return FTDM_FAIL; } - if (ftdmchan->state != FTDM_CHANNEL_STATE_DIALING) { - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Collision after call attempt, try another channel, new state = %s\n", - ftdm_channel_state2str(ftdmchan->state)); - return FTDM_BREAK; - } - R2CALL(ftdmchan)->ftdm_call_started = 1; R2CALL(ftdmchan)->chanstate = FTDM_CHANNEL_STATE_DOWN; ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DIALING); commit d6583acd3bd4992798092b32cd07679b3d6f18bf Author: Moises Silva <moy@sangoma.com> Date: Wed Dec 8 11:57:24 2010 -0500 freetdm: mod_freetdm - fix progress media state for R2 signaling ftmod_r2 - Do not set the state to DIALING unless openr2_chan_make_call succeeds diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index ca16e8b..7ea6bb6 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -2033,7 +2033,6 @@ static FIO_SIGNAL_CB_FUNCTION(on_r2_signal) break; case FTDM_SIGEVENT_PROGRESS: - case FTDM_SIGEVENT_PROGRESS_MEDIA: { if ((session = ftdm_channel_get_session(sigmsg->channel, 0))) { channel = switch_core_session_get_channel(session); @@ -2043,6 +2042,16 @@ static FIO_SIGNAL_CB_FUNCTION(on_r2_signal) } break; + case FTDM_SIGEVENT_PROGRESS_MEDIA: + { + if ((session = ftdm_channel_get_session(sigmsg->channel, 0))) { + channel = switch_core_session_get_channel(session); + switch_channel_mark_pre_answered(channel); + switch_core_session_rwunlock(session); + } + } + break; + case FTDM_SIGEVENT_UP: { if ((session = ftdm_channel_get_session(sigmsg->channel, 0))) { diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 2a95b01..0286018 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -382,9 +382,6 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(r2_outgoing_call) } ft_r2_clean_call(ftdmchan->call_data); - R2CALL(ftdmchan)->ftdm_call_started = 1; - R2CALL(ftdmchan)->chanstate = FTDM_CHANNEL_STATE_DOWN; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DIALING); /* start io dump */ if (r2data->mf_dump_size) { @@ -395,7 +392,7 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(r2_outgoing_call) callstatus = openr2_chan_make_call(R2CALL(ftdmchan)->r2chan, ftdmchan->caller_data.cid_num.digits, ftdmchan->caller_data.dnis.digits, - OR2_CALLING_PARTY_CATEGORY_NATIONAL_SUBSCRIBER); + r2data->category); if (callstatus) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Failed to make call in R2 channel, openr2_chan_make_call failed\n"); @@ -408,6 +405,10 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(r2_outgoing_call) return FTDM_BREAK; } + R2CALL(ftdmchan)->ftdm_call_started = 1; + R2CALL(ftdmchan)->chanstate = FTDM_CHANNEL_STATE_DOWN; + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DIALING); + ftdm_channel_set_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS); ftdm_channel_command(ftdmchan, FTDM_COMMAND_FLUSH_TX_BUFFERS, NULL); ftdm_channel_command(ftdmchan, FTDM_COMMAND_FLUSH_RX_BUFFERS, NULL); @@ -1354,6 +1355,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) hashtable_insert(spanpvt->r2calls, (void *)r2call->name, r2call, HASHTABLE_FLAG_FREE_VALUE); } r2data->mf_dump_size = r2conf.mf_dump_size; + r2data->category = r2conf.category; r2data->flags = 0; spanpvt->r2context = r2data->r2context; commit 15d18e7a15a80b6aa6f60ccc8c9fd49bf38659d0 Author: Moises Silva <moises.silva@gmail.com> Date: Wed Dec 8 10:45:45 2010 -0500 freetdm: ftmod_r2 - Fixed input size for tx and rx dumping ftmod_r2 - Set tx queue to 4 only ftmod_wanpipe - Fixed stats warnings diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 3206ee4..cdd734b 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -163,9 +163,7 @@ static ftdm_status_t start_chan_io_dump(ftdm_channel_t *chan, ftdm_io_dump_t *du return FTDM_FAIL; } memset(dump, 0, sizeof(*dump)); - /* on 64bits, we get a weird number if we don't cast to uint here - * which is what size_t will be anyway */ - dump->buffer = ftdm_malloc((uint32_t)size); + dump->buffer = ftdm_malloc(size); if (!dump->buffer) { return FTDM_FAIL; } @@ -350,7 +348,7 @@ static __inline__ void *ftdm_std_malloc(void *pool, ftdm_size_t size) { void *ptr = malloc(size); pool = NULL; /* fix warning */ - ftdm_assert_return(ptr != NULL, NULL, "Out of memory"); + ftdm_assert_return(ptr != NULL, NULL, "Out of memory\n"); return ptr; } @@ -358,7 +356,7 @@ static __inline__ void *ftdm_std_calloc(void *pool, ftdm_size_t elements, ftdm_s { void *ptr = calloc(elements, size); pool = NULL; - ftdm_assert_return(ptr != NULL, NULL, "Out of memory"); + ftdm_assert_return(ptr != NULL, NULL, "Out of memory\n"); return ptr; } @@ -366,7 +364,7 @@ static __inline__ void *ftdm_std_realloc(void *pool, void *buff, ftdm_size_t siz { buff = realloc(buff, size); pool = NULL; - ftdm_assert_return(buff != NULL, NULL, "Out of memory"); + ftdm_assert_return(buff != NULL, NULL, "Out of memory\n"); return buff; } @@ -2764,7 +2762,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co GOTO_STATUS(done, FTDM_FAIL); } if (start_chan_io_dump(ftdmchan, &ftdmchan->rxdump, size) != FTDM_SUCCESS) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to enable input dump\n"); + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to enable input dump of size %zd\n", size); GOTO_STATUS(done, FTDM_FAIL); } ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Enabled input dump with size %zd\n", size); @@ -2794,7 +2792,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co GOTO_STATUS(done, FTDM_FAIL); } if (start_chan_io_dump(ftdmchan, &ftdmchan->txdump, size) != FTDM_SUCCESS) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to enable output dump\n"); + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to enable output dump of size %d\n", size); GOTO_STATUS(done, FTDM_FAIL); } ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Enabled output dump with size %zd\n", size); @@ -3847,7 +3845,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_write(ftdm_channel_t *ftdmchan, void *dat } if (ftdmchan->span->sig_write) { - status = ftdmchan->span->sig_write(ftdmchan, data, datalen); + status = ftdmchan->span->sig_write(ftdmchan, data, *datalen); if (status == FTDM_BREAK) { /* signaling module decided to drop user frame */ status = FTDM_SUCCESS; diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 21f7a12..2a95b01 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -91,7 +91,7 @@ typedef struct ft_r2_conf_s { int32_t max_dnis; int32_t mfback_timeout; int32_t metering_pulse_timeout; - int32_t mf_dump_size; + ftdm_size_t mf_dump_size; /* booleans */ int immediate_accept; @@ -121,7 +121,7 @@ typedef struct ftdm_r2_data_s { /* whether accept the call when offered, or wait until the user decides to accept */ int accept_on_offer:1; /* Size of multi-frequency (or any media) dumps used during protocol errors */ - int32_t mf_dump_size; + ftdm_size_t mf_dump_size; /* max time spent in ms doing real work in a single loop */ int32_t jobmax; /* Total number of loops performed so far */ @@ -473,7 +473,6 @@ static void ftdm_r2_on_call_init(openr2_chan_t *r2chan) memset(ftdmchan->caller_data.dnis.digits, 0, sizeof(ftdmchan->caller_data.collected)); memset(ftdmchan->caller_data.ani.digits, 0, sizeof(ftdmchan->caller_data.collected)); - /* clean the call data structure but keep the R2 processing flag on! */ ft_r2_clean_call(ftdmchan->call_data); r2call = R2CALL(ftdmchan); @@ -1120,6 +1119,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) { unsigned int i = 0; int conf_failure = 0; + int intval = 0; const char *var = NULL, *val = NULL; const char *log_level = "notice,warning,error"; /* default loglevel, if none is read from conf */ ftdm_r2_data_t *r2data = NULL; @@ -1226,11 +1226,12 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) r2conf.advanced_protocol_file = (char *)val; ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with advanced protocol file %s\n", span->name, val); } else if (!strcasecmp(var, "mf_dump_size")) { - r2conf.mf_dump_size = atoi(val); - if (r2conf.mf_dump_size < 0) { + intval = atoi(val); + if (intval < 0) { r2conf.mf_dump_size = FTDM_IO_DUMP_DEFAULT_BUFF_SIZE; ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with default mf_dump_size = %d bytes\n", span->name, r2conf.mf_dump_size); } else { + r2conf.mf_dump_size = intval; ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with mf_dump_size = %d bytes\n", span->name, r2conf.mf_dump_size); } } else if (!strcasecmp(var, "allow_collect_calls")) { @@ -1612,6 +1613,7 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) int index = 0; struct timeval start, end; ftdm_iterator_t *chaniter = NULL; + uint32_t txqueue_size = 4; short *poll_events = ftdm_malloc(sizeof(short) * span->chan_count); #ifdef __linux__ @@ -1620,18 +1622,23 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) ftdm_log(FTDM_LOG_DEBUG, "OpenR2 monitor thread %lu started.\n", r2data->monitor_thread_id); r2chan = NULL; - for (i = 1; i <= span->chan_count; i++) { - r2chan = R2CALL(span->channels[i])->r2chan; + chaniter = ftdm_span_get_chan_iterator(span, NULL); + for (i = 1; chaniter; chaniter = ftdm_iterator_next(chaniter), i++) { + ftdmchan = ftdm_iterator_current(chaniter); + r2chan = R2CALL(ftdmchan)->r2chan; openr2_chan_set_span_id(r2chan, span->span_id); openr2_chan_set_idle(r2chan); openr2_chan_process_cas_signaling(r2chan); + ftdm_channel_command(ftdmchan, FTDM_COMMAND_SET_TX_QUEUE_SIZE, &txqueue_size); } memset(&start, 0, sizeof(start)); memset(&end, 0, sizeof(end)); - chaniter = ftdm_span_get_chan_iterator(span, NULL); while (ftdm_running() && ftdm_test_flag(r2data, FTDM_R2_RUNNING)) { res = gettimeofday(&end, NULL); + if (res) { + ftdm_log(FTDM_LOG_CRIT, "Failure gettimeofday [%s]\n", strerror(errno)); + } if (start.tv_sec) { ms = ((end.tv_sec - start.tv_sec) * 1000) + ((( 1000000 + end.tv_usec - start.tv_usec) / 1000) - 1000); diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index 0bafa40..1c0baa7 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -760,8 +760,8 @@ static FIO_COMMAND_FUNCTION(wanpipe_command) { err = sangoma_flush_rx_bufs(ftdmchan->sockfd, &tdm_api); } - case FTDM_COMMAND_FLUSH_TX_BUFFERS: break; + case FTDM_COMMAND_FLUSH_TX_BUFFERS: { err = sangoma_flush_tx_bufs(ftdmchan->sockfd, &tdm_api); } @@ -806,20 +806,17 @@ static void wanpipe_write_stats(ftdm_channel_t *ftdmchan, wp_tdm_api_tx_hdr_t *t /* we don't test for 80% full in tx since is typically full for voice channels, should we test tx 80% full for D-channels? */ if (ftdmchan->iostats.tx.queue_len >= ftdmchan->iostats.tx.queue_size) { - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Tx Queue Full (%d/%d)\n", - ftdmchan->iostats.tx.queue_len, ftdmchan->iostats.tx.queue_size); ftdm_set_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_FULL); } else if (ftdm_test_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_FULL)){ - ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Tx Queue no longer full (%d/%d)\n", - ftdmchan->iostats.tx.queue_len, ftdmchan->iostats.tx.queue_size); ftdm_clear_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_FULL); } if (ftdmchan->iostats.tx.idle_packets < tx_stats->wp_api_tx_hdr_number_of_frames_in_queue) { ftdmchan->iostats.tx.idle_packets = tx_stats->wp_api_tx_hdr_tx_idle_packets; - /* HDLC channels do not always transmit, so its ok for drivers to fill with idle */ - if (FTDM_IS_VOICE_CHANNEL(ftdmchan)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Tx idle: %d\n", ftdmchan->iostats.tx.idle_packets); + /* HDLC channels do not always transmit, so its ok for drivers to fill with idle + * also do not report idle warning when we just started transmitting */ + if (ftdmchan->iostats.tx.packets && FTDM_IS_VOICE_CHANNEL(ftdmchan)) { + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Tx idle: %d\n", ftdmchan->iostats.tx.idle_packets); } } @@ -942,7 +939,9 @@ static FIO_READ_FUNCTION(wanpipe_read) */ static FIO_WRITE_FUNCTION(wanpipe_write) { - int bsent; + int bsent = 0; + int err = 0; + ftdm_time_t ms = 0; wp_tdm_api_tx_hdr_t hdrframe; /* Do we even need the headerframe here? on windows, we don't even pass it to the driver */ @@ -950,6 +949,17 @@ static FIO_WRITE_FUNCTION(wanpipe_write) if (*datalen == 0) { return FTDM_SUCCESS; } + + if (ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS) && !ftdmchan->iostats.tx.packets) { + wanpipe_tdm_api_t tdm_api; + memset(&tdm_api, 0, sizeof(tdm_api)); + /* if this is the first write ever, flush the tx first to have clean stats */ + err = sangoma_flush_tx_bufs(ftdmchan->sockfd, &tdm_api); + if (err) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Failed to flush on first write\n"); + } + } + bsent = sangoma_writemsg_tdm(ftdmchan->sockfd, &hdrframe, (int)sizeof(hdrframe), data, (unsigned short)(*datalen),0); /* should we be checking if bsent == *datalen here? */ commit 71a902d258cbea2302faf75b3bfa058567c49200 Author: Moises Silva <moises.silva@gmail.com> Date: Wed Dec 8 09:09:14 2010 -0500 freetdm: Added core rx and tx drops Added sig_write callback ftmod_r2 - Added IO stats flag during call setup - Disable user read and writes during call setup diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index b7f8d7e..3206ee4 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2254,7 +2254,7 @@ static ftdm_status_t call_hangup(ftdm_channel_t *chan, const char *file, const c } else { /* the signaling stack did not touch the state, * core is responsible from clearing flags and stuff */ - ftdm_channel_done(chan); + ftdm_channel_close(&chan); } return FTDM_SUCCESS; } @@ -2557,8 +2557,14 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_done(ftdm_channel_t *ftdmchan) ftdm_span_send_signal(ftdmchan->span, &sigmsg); } + if (ftdmchan->txdrops || ftdmchan->rxdrops) { + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "channel dropped data: txdrops = %d, rxdrops = %d\n", + ftdmchan->txdrops, ftdmchan->rxdrops); + } + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "channel done\n"); + ftdm_mutex_unlock(ftdmchan->mutex); return FTDM_SUCCESS; @@ -3385,6 +3391,16 @@ skipdebug: static FIO_WRITE_FUNCTION(ftdm_raw_write) { int dlen = (int) *datalen; + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_TX_DISABLED)) { + ftdmchan->txdrops++; + if (ftdmchan->txdrops <= 10) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "cannot write in channel with tx disabled\n"); + } + if (ftdmchan->txdrops == 10) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Too many tx drops, not printing anymore\n"); + } + return FTDM_FAIL; + } if (ftdmchan->fds[FTDM_WRITE_TRACE_INDEX] > -1) { if ((write(ftdmchan->fds[FTDM_WRITE_TRACE_INDEX], data, dlen)) != dlen) { ftdm_log(FTDM_LOG_WARNING, "Raw output trace failed to write all of the %zd bytes\n", dlen); @@ -3557,6 +3573,18 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_read(ftdm_channel_t *ftdmchan, void *data goto done; } + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_RX_DISABLED)) { + ftdmchan->rxdrops++; + if (ftdmchan->rxdrops <= 10) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "cannot read from channel with rx disabled\n"); + } + if (ftdmchan->rxdrops == 10) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "too many rx drops, not logging anymore\n"); + } + status = FTDM_FAIL; + goto done; + } + status = ftdm_raw_read(ftdmchan, data, datalen); if (status != FTDM_SUCCESS) { @@ -3756,7 +3784,7 @@ done: FT_DECLARE(ftdm_status_t) ftdm_channel_write(ftdm_channel_t *ftdmchan, void *data, ftdm_size_t datasize, ftdm_size_t *datalen) { - ftdm_status_t status = FTDM_FAIL; + ftdm_status_t status = FTDM_SUCCESS; fio_codec_t codec_func = NULL; ftdm_size_t max = datasize; unsigned int i = 0; @@ -3764,22 +3792,28 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_write(ftdm_channel_t *ftdmchan, void *dat ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "null channel on write!\n"); ftdm_assert_return(ftdmchan->fio != NULL, FTDM_FAIL, "null I/O on write!\n"); + ftdm_channel_lock(ftdmchan); + if (!ftdmchan->buffer_delay && ((ftdmchan->dtmf_buffer && ftdm_buffer_inuse(ftdmchan->dtmf_buffer)) || (ftdmchan->fsk_buffer && ftdm_buffer_inuse(ftdmchan->fsk_buffer)))) { /* read size writing DTMF ATM */ - return FTDM_SUCCESS; + goto done; } if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "cannot write in channel not open\n"); snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "channel not open"); - return FTDM_FAIL; + status = FTDM_FAIL; + goto done; } if (!ftdmchan->fio->write) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "write method not implemented\n"); snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "method not implemented"); - return FTDM_FAIL; + status = FTDM_FAIL; + goto done; } if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_TRANSCODE) && ftdmchan->effective_codec != ftdmchan->native_codec) { @@ -3796,10 +3830,13 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_write(ftdm_channel_t *ftdmchan, void *dat if (codec_func) { status = codec_func(data, max, datalen); } else { + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Do not know how to handle transcoding from %d to %d\n", + ftdmchan->effective_codec, ftdmchan->native_codec); snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "codec error!"); status = FTDM_FAIL; + goto done; } - } + } if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_USE_TX_GAIN) && (ftdmchan->native_codec == FTDM_CODEC_ALAW || ftdmchan->native_codec == FTDM_CODEC_ULAW)) { @@ -3809,8 +3846,20 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_write(ftdm_channel_t *ftdmchan, void *dat } } + if (ftdmchan->span->sig_write) { + status = ftdmchan->span->sig_write(ftdmchan, data, datalen); + if (status == FTDM_BREAK) { + /* signaling module decided to drop user frame */ + status = FTDM_SUCCESS; + goto done; + } + } + status = ftdm_raw_write(ftdmchan, data, datalen); +done: + ftdm_channel_unlock(ftdmchan); + return status; } diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 30221e1..21f7a12 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -73,7 +73,6 @@ typedef struct ftdm_r2_call_t { ftdm_size_t ani_index; char logname[255]; char name[10]; - unsigned long txdrops; } ftdm_r2_call_t; /* this is just used as place holder in the stack when configuring the span to avoid using bunch of locals */ @@ -129,6 +128,12 @@ typedef struct ftdm_r2_data_s { uint64_t total_loops; /* number of loops per 10ms increment from 0-9ms, 10-19ms .. 100ms and above */ uint64_t loops[11]; + /* Total number of sleeps performed so far */ + uint64_t total_sleeps; + /* number of sleeps per 10ms increment from 0-9ms, 10-19ms .. 100ms and above */ + uint64_t sleeps[11]; + /* max time spent in ms sleeping in a single loop */ + int32_t sleepmax; /* LWP */ uint32_t monitor_thread_id; /* Logging directory */ @@ -338,7 +343,6 @@ static void ft_r2_clean_call(ftdm_r2_call_t *call) call->dnis_index = 0; call->ani_index = 0; call->name[0] = 0; - call->txdrops = 0; } static void ft_r2_accept_call(ftdm_channel_t *ftdmchan) @@ -404,6 +408,10 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(r2_outgoing_call) return FTDM_BREAK; } + ftdm_channel_set_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS); + ftdm_channel_command(ftdmchan, FTDM_COMMAND_FLUSH_TX_BUFFERS, NULL); + ftdm_channel_command(ftdmchan, FTDM_COMMAND_FLUSH_RX_BUFFERS, NULL); + return FTDM_SUCCESS; } @@ -477,6 +485,9 @@ static void ftdm_r2_on_call_init(openr2_chan_t *r2chan) R2CALL(ftdmchan)->chanstate = FTDM_CHANNEL_STATE_DOWN; ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); + ftdm_channel_set_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS); + ftdm_channel_command(ftdmchan, FTDM_COMMAND_FLUSH_TX_BUFFERS, NULL); + ftdm_channel_command(ftdmchan, FTDM_COMMAND_FLUSH_RX_BUFFERS, NULL); } static void dump_mf(openr2_chan_t *r2chan); @@ -556,6 +567,11 @@ static void ftdm_r2_on_call_accepted(openr2_chan_t *r2chan, openr2_call_mode_t m /* at this point the MF signaling has ended and there is no point on keep reading */ openr2_chan_disable_read(r2chan); + + /* at this point we are no longer responsible for reading and writing, + * we are not interested in the stats anymore */ + ftdm_channel_clear_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS); + R2CALL(ftdmchan)->accepted = 1; @@ -1335,7 +1351,6 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) /* value and key are the same so just free one of them */ snprintf(r2call->name, sizeof(r2call->name), "chancall%d", i); hashtable_insert(spanpvt->r2calls, (void *)r2call->name, r2call, HASHTABLE_FLAG_FREE_VALUE); - } r2data->mf_dump_size = r2conf.mf_dump_size; r2data->flags = 0; @@ -1347,6 +1362,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) span->start = ftdm_r2_start; span->stop = ftdm_r2_stop; span->sig_read = NULL; + span->sig_write = NULL; /* let the core set the states, we just read them */ span->get_channel_sig_status = ftdm_r2_get_channel_sig_status; @@ -1544,10 +1560,7 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) /* finished call for good */ case FTDM_CHANNEL_STATE_DOWN: { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Call is down\n"); - if (R2CALL(ftdmchan)->txdrops) { - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "dropped %d tx packets\n", R2CALL(ftdmchan)->txdrops); - } + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "R2 Call is down\n"); openr2_chan_disable_read(r2chan); ret = 1; } @@ -1587,8 +1600,9 @@ static void ftdm_r2_state_advance_all(ftdm_channel_t *ftdmchan) static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) { - openr2_chan_t *r2chan; + openr2_chan_t *r2chan = NULL; ftdm_channel_t *ftdmchan = NULL; + ftdm_r2_call_t *call = NULL; ftdm_status_t status; ftdm_span_t *span = (ftdm_span_t *) obj; ftdm_r2_data_t *r2data = span->signal_data; @@ -1662,6 +1676,19 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) continue; } + ms = ((start.tv_sec - end.tv_sec) * 1000) + + ((( 1000000 + start.tv_usec - end.tv_usec) / 1000) - 1000); + if (ms < 0) { + ms = 0; + } + if (ms > r2data->sleepmax) { + r2data->sleepmax = ms; + } + index = (ms / 15); + index = (index > 10) ? 10 : index; + r2data->sleeps[index]++; + r2data->total_sleeps++; + /* this main loop takes care of MF and CAS signaling during call setup and tear down * for every single channel in the span, do not perform blocking operations here! */ chaniter = ftdm_span_get_chan_iterator(span, chaniter); @@ -1670,13 +1697,26 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) ftdm_mutex_lock(ftdmchan->mutex); + call = R2CALL(ftdmchan); + + /* This let knows the core and io signaling hooks know that + * read/writes come from us and should be allowed */ + ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_RX_DISABLED); + ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_TX_DISABLED); + ftdm_r2_state_advance_all(ftdmchan); - r2chan = R2CALL(ftdmchan)->r2chan; + r2chan = call->r2chan; openr2_chan_process_signaling(r2chan); ftdm_r2_state_advance_all(ftdmchan); + if (!call->accepted) { + /* if the call is not accepted we do not want users reading */ + ftdm_set_flag(ftdmchan, FTDM_CHANNEL_RX_DISABLED); + ftdm_set_flag(ftdmchan, FTDM_CHANNEL_TX_DISABLED); + } + ftdm_mutex_unlock(ftdmchan->mutex); } /* deliver the actual events to the user now without any channel locking */ @@ -1886,6 +1926,8 @@ static FIO_API_FUNCTION(ftdm_r2_api) stream->write_function(stream, "-ERR invalid span. No R2 signal data in span.\n"); goto done; } + stream->write_function(stream, "-- Working --\n"); + stream->write_function(stream, "Total loops: %llu\n", r2data->total_loops); range = 0; for (i = 0; i < ftdm_array_len(r2data->loops); i++) { pct = 100*(float)r2data->loops[i]/r2data->total_loops; @@ -1897,6 +1939,21 @@ static FIO_API_FUNCTION(ftdm_r2_api) range += 10; } stream->write_function(stream, "\n"); + + stream->write_function(stream, "-- Sleeping --\n"); + stream->write_function(stream, "Total sleeps: %llu\n", r2data->total_sleeps); + range = 0; + for (i = 0; i < ftdm_array_len(r2data->sleeps); i++) { + pct = 100*(float)r2data->sleeps[i]/r2data->total_sleeps; + if ((i + 1) == ftdm_array_len(r2data->sleeps)) { + stream->write_function(stream, ">= %dms: %llu - %.03lf%%\n", range, r2data->sleeps[i], pct); + } else { + stream->write_function(stream, "%d-%dms: %llu - %.03lf%%\n", range, range + 14, r2data->sleeps[i], pct); + } + range += 15; + } + stream->write_function(stream, "\n"); + stream->write_function(stream, "+OK.\n"); goto done; } else { diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index f1058d8..a1e1c02 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -477,6 +477,8 @@ struct ftdm_channel { ftdm_dtmf_debug_t dtmfdbg; ftdm_io_dump_t rxdump; ftdm_io_dump_t txdump; + int32_t txdrops; + int32_t rxdrops; }; struct ftdm_span { @@ -509,6 +511,7 @@ struct ftdm_span { ftdm_span_start_t start; ftdm_span_stop_t stop; ftdm_channel_sig_read_t sig_read; + ftdm_channel_sig_write_t sig_write; /* Private I/O data per span. Do not touch unless you are an I/O module */ void *io_data; char *type; diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index db1428c..9c6260c 100644 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -264,6 +264,8 @@ typedef enum { FTDM_CHANNEL_IN_ALARM = (1 << 27), FTDM_CHANNEL_SIG_UP = (1 << 28), FTDM_CHANNEL_USER_HANGUP = (1 << 29), + FTDM_CHANNEL_RX_DISABLED = (1 << 30), + FTDM_CHANNEL_TX_DISABLED = (1 << 31), } ftdm_channel_flag_t; #if defined(__cplusplus) && defined(WIN32) // fix C2676 @@ -380,6 +382,7 @@ typedef struct ftdm_fsk_modulator ftdm_fsk_modulator_t; typedef ftdm_status_t (*ftdm_span_start_t)(ftdm_span_t *span); typedef ftdm_status_t (*ftdm_span_stop_t)(ftdm_span_t *span); typedef ftdm_status_t (*ftdm_channel_sig_read_t)(ftdm_channel_t *ftdmchan, void *data, ftdm_size_t size); +typedef ftdm_status_t (*ftdm_channel_sig_write_t)(ftdm_channel_t *ftdmchan, void *data, ftdm_size_t size); typedef enum { FTDM_ITERATOR_VARS = 1, commit 32e28540db33d19109d32247d2395bb749cacf1b Author: Moises Silva <moises.silva@gmail.com> Date: Wed Dec 8 06:22:46 2010 -0500 freetdm: ftmod_wanpipe - implement tx and rx flush command diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index c8b8868..0bafa40 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -756,6 +756,16 @@ static FIO_COMMAND_FUNCTION(wanpipe_command) err = sangoma_flush_bufs(ftdmchan->sockfd, &tdm_api); } break; + case FTDM_COMMAND_FLUSH_RX_BUFFERS: + { + err = sangoma_flush_rx_bufs(ftdmchan->sockfd, &tdm_api); + } + case FTDM_COMMAND_FLUSH_TX_BUFFERS: + break; + { + err = sangoma_flush_tx_bufs(ftdmchan->sockfd, &tdm_api); + } + break; case FTDM_COMMAND_FLUSH_IOSTATS: { err = sangoma_flush_stats(ftdmchan->sockfd, &tdm_api); @@ -775,12 +785,13 @@ static FIO_COMMAND_FUNCTION(wanpipe_command) } break; default: + err = FTDM_NOTIMPL; break; }; if (err) { snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "%s", strerror(errno)); - return FTDM_FAIL; + return err; } commit 72bcc01b1d975c6d2667cd4762addcff50f1b140 Author: Jeff Lenk <jeff@jefflenk.com> Date: Tue Dec 7 22:32:38 2010 -0600 FS-2210 Add support for auto completion for uuid_simplify diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index c7edfd5..eacde59 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -2491,24 +2491,47 @@ SWITCH_STANDARD_API(uuid_display_function) #define SIMPLIFY_SYNTAX "<uuid>" SWITCH_STANDARD_API(uuid_simplify_function) { + char *mydata = NULL, *argv[2] = { 0 }; + int argc = 0; + switch_status_t status = SWITCH_STATUS_FALSE; if (zstr(cmd)) { - stream->write_function(stream, "-USAGE: %s\n", SIMPLIFY_SYNTAX); - } else { + goto error; + } + + mydata = strdup(cmd); + switch_assert(mydata); + + argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + + if (argc < 1) { + goto error; + } + if (argv[0]) { switch_core_session_message_t msg = { 0 }; switch_core_session_t *lsession = NULL; msg.message_id = SWITCH_MESSAGE_INDICATE_SIMPLIFY; - msg.string_arg = cmd; + msg.string_arg = argv[0]; msg.from = __FILE__; - if ((lsession = switch_core_session_locate(cmd))) { + if ((lsession = switch_core_session_locate(argv[0]))) { status = switch_core_session_receive_message(lsession, &msg); switch_core_session_rwunlock(lsession); } + goto ok; + } else { + goto error; } + error: + stream->write_function(stream, "-USAGE: %s\n", SIMPLIFY_SYNTAX); + switch_safe_free(mydata); + return SWITCH_STATUS_SUCCESS; + ok: + switch_safe_free(mydata); + if (status == SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "+OK Success\n"); } else { @@ -4853,6 +4876,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) switch_console_set_complete("add uuid_session_heartbeat ::console::list_uuid"); switch_console_set_complete("add uuid_setvar_multi ::console::list_uuid"); switch_console_set_complete("add uuid_setvar ::console::list_uuid"); + switch_console_set_complete("add uuid_simplify ::console::list_uuid"); switch_console_set_complete("add uuid_transfer ::console::list_uuid"); switch_console_set_complete("add uuid_dual_transfer ::console::list_uuid"); switch_console_set_complete("add version"); commit 37cdd5b93466811988b6a413165d579a9fa548f0 Author: Moises Silva <moy@sangoma.com> Date: Tue Dec 7 18:31:32 2010 -0500 freetdm: more analog changes to attempt to make the state transitions more similar to other signaling modules diff --git a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c index 95002e3..f07f48b 100644 --- a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c +++ b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c @@ -491,9 +491,10 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) ftdm_channel_command(ftdmchan, FTDM_COMMAND_GENERATE_RING_OFF, NULL); } - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK) && + if (ftdmchan->type == FTDM_CHAN_TYPE_FXS && + ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK) && (ftdmchan->last_state == FTDM_CHANNEL_STATE_RINGING || ftdmchan->last_state == FTDM_CHANNEL_STATE_DIALTONE - || ftdmchan->last_state >= FTDM_CHANNEL_STATE_RING)) { + || ftdmchan->last_state == FTDM_CHANNEL_STATE_RING)) { ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY); } else { ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_CLEARING; diff --git a/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c b/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c index 199bba4..886c4a8 100644 --- a/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c +++ b/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c @@ -329,8 +329,8 @@ static void *ftdm_analog_em_channel_run(ftdm_thread_t *me, void *obj) { if (state_counter > 500) { if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK) && - (ftdmchan->last_state == FTDM_CHANNEL_STATE_RING || ftdmchan->last_state == FTDM_CHANNEL_STATE_DIALTONE - || ftdmchan->last_state >= FTDM_CHANNEL_STATE_IDLE)) { + (ftdmchan->last_state == FTDM_CHANNEL_STATE_RINGING || ftdmchan->last_state == FTDM_CHANNEL_STATE_DIALTONE + || ftdmchan->last_state == FTDM_CHANNEL_STATE_RING)) { ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY); } else { ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_CLEARING; @@ -340,7 +340,7 @@ static void *ftdm_analog_em_channel_run(ftdm_thread_t *me, void *obj) } break; case FTDM_CHANNEL_STATE_UP: - case FTDM_CHANNEL_STATE_IDLE: + case FTDM_CHANNEL_STATE_RING: { ftdm_sleep(interval); continue; @@ -386,7 +386,7 @@ static void *ftdm_analog_em_channel_run(ftdm_thread_t *me, void *obj) ftdm_channel_use(ftdmchan); } break; - case FTDM_CHANNEL_STATE_IDLE: + case FTDM_CHANNEL_STATE_RING: { ftdm_channel_use(ftdmchan); @@ -421,7 +421,7 @@ static void *ftdm_analog_em_channel_run(ftdm_thread_t *me, void *obj) ftdm_channel_command(ftdmchan, FTDM_COMMAND_WINK, NULL); } break; - case FTDM_CHANNEL_STATE_RING: + case FTDM_CHANNEL_STATE_RINGING: { ftdm_buffer_zero(dt_buffer); teletone_run(&ts, ftdmchan->span->tone_map[FTDM_TONEMAP_RING]); @@ -477,7 +477,7 @@ static void *ftdm_analog_em_channel_run(ftdm_thread_t *me, void *obj) if (last_digit && (!collecting || ((elapsed - last_digit > analog_data->digit_timeout) || strlen(dtmf) > analog_data->max_dialstr))) { ftdm_log(FTDM_LOG_DEBUG, "Number obtained [%s]\n", dtmf); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE); + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RING); last_digit = 0; collecting = 0; } commit d25cb0282b1d6db944cd27eb7e87de484eab8225 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Tue Dec 7 20:33:23 2010 -0200 freetdm: ftmod_r2 - fixed complation warnings on windows diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 13c0652..b7f8d7e 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -102,7 +102,7 @@ static void write_chan_io_dump(ftdm_io_dump_t *dump, char *dataptr, int dlen) if (dlen > avail) { int diff = dlen - avail; - ftdm_assert(diff < dump->size, "Very small buffer or very big IO chunk!\n"); + ftdm_assert(diff < (int)dump->size, "Very small buffer or very big IO chunk!\n"); /* write only what we can and the rest at the beginning of the buffer */ memcpy(&dump->buffer[windex], dataptr, avail); @@ -116,7 +116,7 @@ static void write_chan_io_dump(ftdm_io_dump_t *dump, char *dataptr, int dlen) windex += dlen; } - if (windex == dump->size) { + if (windex == (int)dump->size) { /*ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "wrapping around dump buffer %p\n", dump);*/ windex = 0; dump->wrapped = 1; @@ -3398,8 +3398,8 @@ static FIO_READ_FUNCTION(ftdm_raw_read) { ftdm_status_t status = ftdmchan->fio->read(ftdmchan, data, datalen); if (status == FTDM_SUCCESS && ftdmchan->fds[FTDM_READ_TRACE_INDEX] > -1) { - int dlen = (int) *datalen; - if (write(ftdmchan->fds[FTDM_READ_TRACE_INDEX], data, dlen) != dlen) { + ftdm_size_t dlen = *datalen; + if ((ftdm_size_t)write(ftdmchan->fds[FTDM_READ_TRACE_INDEX], data, dlen) != dlen) { ftdm_log(FTDM_LOG_WARNING, "Raw input trace failed to write all of the %zd bytes\n", dlen); } } @@ -3409,8 +3409,8 @@ static FIO_READ_FUNCTION(ftdm_raw_read) } if (status == FTDM_SUCCESS) { - int dlen = (int) *datalen; - size_t rc = 0; + ftdm_size_t dlen = *datalen; + ftdm_size_t rc = 0; write_chan_io_dump(&ftdmchan->rxdump, data, dlen); commit 10885336264f64ad8b737b313aeb70089cd6e57b Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Tue Dec 7 18:14:03 2010 -0200 freetdm: removed dump_mf() debug call from ftmod_r2 and added a comment to ftdm_io diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index cde3c24..13c0652 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -163,6 +163,8 @@ static ftdm_status_t start_chan_io_dump(ftdm_channel_t *chan, ftdm_io_dump_t *du return FTDM_FAIL; } memset(dump, 0, sizeof(*dump)); + /* on 64bits, we get a weird number if we don't cast to uint here + * which is what size_t will be anyway */ dump->buffer = ftdm_malloc((uint32_t)size); if (!dump->buffer) { return FTDM_FAIL; diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 2048d27..30221e1 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -489,8 +489,6 @@ static void ftdm_r2_on_call_offered(openr2_chan_t *r2chan, const char *ani, cons ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Call offered with ANI = %s, DNIS = %s, Category = (%d)\n", ani, dnis, category); ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); - dump_mf(r2chan); - /* nothing went wrong during call setup, MF has ended, we can and must disable the MF dump */ if (r2data->mf_dump_size) { ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_INPUT_DUMP, NULL); commit 60cb91b042cf62186a9f967ab668dfc6c919f6ae Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Tue Dec 7 20:06:48 2010 +0100 freetdm: ftmod_libpri + ftmod_zt: some DAHDI drivers return an error of ELAST (500) on read()/write() to indicate there are events pending. Fixup zt_read() to handle this case correctly and rework ftmod_libpri's read wrapper function to not fail when the read function returns zero bytes. NOTE: zt_write() has not been changed (some better way to handle these events is needed then) This should fix these log messages: [WARNING] ftdm_io.c:3561 [s1c16][1:16] raw I/O read filed [CRIT] lpwrap_pri.c:125 span 1 D-READ FAIL! [] [CRIT] lpwrap_pri.c:157 span 1 D-WRITE FAIL! [] [ERR] ftmod_libpri.c:131 Short write: -1/6 (Unknown error 500) Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c b/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c index de4fa2b..fbe6ca0 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c @@ -134,17 +134,18 @@ static int __pri_lpwrap_read(struct pri *pri, void *buf, int buflen) spri->errs = 0; res = (int)len; - memset(&((unsigned char*)buf)[res], 0, 2); - res += 2; - + if (res > 0) { + memset(&((unsigned char*)buf)[res], 0, 2); + res += 2; #ifdef IODEBUG - { - char bb[2048] = { 0 }; + { + char bb[2048] = { 0 }; - print_hex_bytes(buf, res - 2, bb, sizeof(bb)); - ftdm_log(FTDM_LOG_DEBUG, "READ %d\n", res - 2); - } + print_hex_bytes(buf, res - 2, bb, sizeof(bb)); + ftdm_log(FTDM_LOG_DEBUG, "READ %d\n", res - 2); + } #endif + } return res; } diff --git a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c index 9247edc..7320934 100644 --- a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c +++ b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c @@ -35,6 +35,11 @@ #include "private/ftdm_core.h" #include "ftmod_zt.h" +/* used by dahdi to indicate there is no data available, but events to read */ +#ifndef ELAST +#define ELAST 500 +#endif + /** * \brief Zaptel globals */ @@ -1081,7 +1086,6 @@ FIO_SPAN_NEXT_EVENT_FUNCTION(zt_next_event) } return FTDM_FAIL; - } /** @@ -1100,12 +1104,19 @@ static FIO_READ_FUNCTION(zt_read) if ((r = read(ftdmchan->sockfd, data, *datalen)) > 0) { break; } - ftdm_sleep(10); - if (r == 0) { - errs--; + else if (r == 0) { + ftdm_sleep(10); + if (errs) errs--; } - } + else { + if (errno == EAGAIN || errno == EINTR) + continue; + if (errno == ELAST) + break; + ftdm_log(FTDM_LOG_ERROR, "read failed: %s\n", strerror(errno)); + } + } if (r > 0) { *datalen = r; if (ftdmchan->type == FTDM_CHAN_TYPE_DQ921) { @@ -1113,7 +1124,9 @@ static FIO_READ_FUNCTION(zt_read) } return FTDM_SUCCESS; } - + else if (errno == ELAST) { + return FTDM_SUCCESS; + } return r == 0 ? FTDM_TIMEOUT : FTDM_FAIL; } commit 6a36b8f33faa20d4c4b1aa516feb0c6bf30be429 Author: Moises Silva <moy@sangoma.com> Date: Tue Dec 7 09:59:56 2010 -0500 freetdm: isdn stack and testsangomaboost warning fix diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 16b22a5..086354a 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -328,8 +328,6 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - CnStEvnt *cnStEvnt = &sngisdn_event->event.cnStEvnt; ISDN_FUNC_TRACE_ENTER(__FUNCTION__); diff --git a/libs/freetdm/src/testsangomaboost.c b/libs/freetdm/src/testsangomaboost.c index 85b5332..61b7c47 100644 --- a/libs/freetdm/src/testsangomaboost.c +++ b/libs/freetdm/src/testsangomaboost.c @@ -48,7 +48,7 @@ #include <stdlib.h> #include <string.h> #include <errno.h> -#ifdef __linux__ +#if defined(__linux__) && !defined(__USE_BSD) #define __USE_BSD #include <unistd.h> #endif commit 179fa43c9ea1f7d03a17a6cf1c56fb8c0e4c387e Merge: 673fcb6 a40f926 Author: Moises Silva <moy@sangoma.com> Date: Tue Dec 7 09:45:26 2010 -0500 Merge branch 'master' of git.sangoma.com:smg_freeswitch commit a40f92674f8fc7c07d531c5d6d11688c4b2aec05 Author: David Yat Sin <dyatsin@sangoma.com> Date: Tue Dec 7 11:42:36 2010 -0500 Fix for compile error diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 16b22a5..086354a 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -328,8 +328,6 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - CnStEvnt *cnStEvnt = &sngisdn_event->event.cnStEvnt; ISDN_FUNC_TRACE_ENTER(__FUNCTION__); commit 96e4a6b7d658c76592a97ae2ee755ba9025c0e5e Merge: b4cb165 5d288a9 Author: David Yat Sin <dyatsin@sangoma.com> Date: Tue Dec 7 11:34:43 2010 -0500 Merge branch 'master' of git.sangoma.com:smg_freeswitch commit b4cb165115eec01a83cd2ce9c00cb1b8cefd5e20 Author: David Yat Sin <dyatsin@sangoma.com> Date: Tue Dec 7 11:33:51 2010 -0500 freetdm:Changes to transmit facilityStr in PROGRESS and ALERT messages diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 08b14a0..752ac40 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -341,6 +341,7 @@ void sngisdn_snd_progress(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ memset(&cnStEvnt, 0, sizeof(cnStEvnt)); set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); + set_facility_ie(ftdmchan, &cnStEvnt.facilityStr); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending PROGRESS (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); if(sng_isdn_con_status(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId,&cnStEvnt, MI_PROGRESS, signal_data->dchan_id, sngisdn_info->ces)) { @@ -366,6 +367,7 @@ void sngisdn_snd_alert(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind memset(&cnStEvnt, 0, sizeof(cnStEvnt)); set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); + set_facility_ie(ftdmchan, &cnStEvnt.facilityStr); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending ALERT (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); @@ -424,6 +426,7 @@ void sngisdn_snd_connect(ftdm_channel_t *ftdmchan) } set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); + set_facility_ie(ftdmchan, &cnStEvnt.facilityStr); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending CONNECT (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); if (sng_isdn_con_response(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &cnStEvnt, signal_data->dchan_id, sngisdn_info->ces)) { @@ -522,7 +525,8 @@ void sngisdn_snd_disconnect(ftdm_channel_t *ftdmchan) memset(&discEvnt, 0, sizeof(discEvnt)); - /* Fill discEvnt here */ + /* Fill discEvnt here */ + /* TODO move this to set_cause_ie function */ discEvnt.causeDgn[0].eh.pres = PRSNT_NODEF; discEvnt.causeDgn[0].location.pres = PRSNT_NODEF; discEvnt.causeDgn[0].location.val = IN_LOC_PRIVNETLU; @@ -559,7 +563,7 @@ void sngisdn_snd_release(ftdm_channel_t *ftdmchan, uint8_t glare) memset(&relEvnt, 0, sizeof(relEvnt)); - /* Fill discEvnt here */ + /* Fill relEvnt here */ relEvnt.causeDgn[0].eh.pres = PRSNT_NODEF; relEvnt.causeDgn[0].location.pres = PRSNT_NODEF; relEvnt.causeDgn[0].location.val = IN_LOC_PRIVNETLU; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 42bcd1e..565781a 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -560,9 +560,8 @@ ftdm_status_t set_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr ftdm_status_t set_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, ftdm_size_t *data_len) { ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; - - if (caller_data->raw_data_len > 0 && caller_data->raw_data[0] == SNGISDN_Q931_FACILITY_IE_ID) { + if (caller_data->raw_data_len > 0 && caller_data->raw_data[0] == SNGISDN_Q931_FACILITY_IE_ID) { *data_len = caller_data->raw_data[1]; memcpy(data, &caller_data->raw_data[2], *data_len); return FTDM_SUCCESS; commit 5d288a9a4f3feee2eb2bcb536a6a131309d2c71d Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Tue Dec 7 14:18:38 2010 -0200 freetdm: fix testsangomaboost compilation diff --git a/libs/freetdm/src/testsangomaboost.c b/libs/freetdm/src/testsangomaboost.c index 85b5332..84ff287 100644 --- a/libs/freetdm/src/testsangomaboost.c +++ b/libs/freetdm/src/testsangomaboost.c @@ -49,7 +49,9 @@ #include <string.h> #include <errno.h> #ifdef __linux__ +#ifndef __USE_BSD #define __USE_BSD +#endif #include <unistd.h> #endif #include "freetdm.h" commit ceaa7b1c33beb255b371f5c942c6467ed74caedb Merge: d4f5120 5522982 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Tue Dec 7 14:04:27 2010 -0200 Merge branch 'master' of git.sangoma.com:smg_freeswitch commit d4f512083f14b0ff7058df292a16424be758d3ac Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Tue Dec 7 13:58:44 2010 -0200 freetdm: ftmod_r2 - added cast to properly malloc io dump buffer on win64 diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 3b46394..3e4cce6 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -163,7 +163,7 @@ static ftdm_status_t start_chan_io_dump(ftdm_channel_t *chan, ftdm_io_dump_t *du return FTDM_FAIL; } memset(dump, 0, sizeof(*dump)); - dump->buffer = ftdm_malloc(size); + dump->buffer = ftdm_malloc((uint32_t)size); if (!dump->buffer) { return FTDM_FAIL; } @@ -2814,7 +2814,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co GOTO_STATUS(done, FTDM_FAIL); } dump_chan_io_to_file(ftdmchan, &ftdmchan->rxdump, obj); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Dumped input of size %zd to file %p\n", ftdmchan->rxdump.size, obj); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Dumped input of size %d to file %p\n", ftdmchan->rxdump.size, obj); GOTO_STATUS(done, FTDM_SUCCESS); } break; commit 673fcb6572401d909a44f0a0d4bda9ee819a9027 Author: Moises Silva <moy@sangoma.com> Date: Tue Dec 7 09:44:38 2010 -0500 freetdm: ftmod_r2 - set MF dumps for outgoing calls too diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 0348c8b..2048d27 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -56,7 +56,10 @@ typedef enum { FTDM_R2_RUNNING = (1 << 0), } ftdm_r2_flag_t; -/* private call information stored in ftdmchan->call_data void* ptr */ +/* private call information stored in ftdmchan->call_data void* ptr, + * remember that each time you add a new member to this structure + * most likely you want to clear it in ft_r2_clean_call function + * */ #define R2CALL(ftdmchan) ((ftdm_r2_call_t*)((ftdmchan)->call_data)) typedef struct ftdm_r2_call_t { openr2_chan_t *r2chan; @@ -322,8 +325,20 @@ static openr2_call_disconnect_cause_t ftdm_r2_ftdm_cause_to_openr2_cause(ftdm_ch static void ft_r2_clean_call(ftdm_r2_call_t *call) { openr2_chan_t *r2chan = call->r2chan; - memset(call, 0, sizeof(*call)); + + /* Do not memset call structure, that clears values we do not want to clear, + * like the log name set in on_call_log_created() */ call->r2chan = r2chan; + call->accepted = 0; + call->answer_pending = 0; + call->disconnect_rcvd = 0; + call->ftdm_call_started = 0; + call->protocol_error = 0; + call->chanstate = FTDM_CHANNEL_STATE_DOWN; + call->dnis_index = 0; + call->ani_index = 0; + call->name[0] = 0; + call->txdrops = 0; } static void ft_r2_accept_call(ftdm_channel_t *ftdmchan) @@ -367,6 +382,12 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(r2_outgoing_call) R2CALL(ftdmchan)->chanstate = FTDM_CHANNEL_STATE_DOWN; ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DIALING); + /* start io dump */ + if (r2data->mf_dump_size) { + ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_INPUT_DUMP, &r2data->mf_dump_size); + ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_OUTPUT_DUMP, &r2data->mf_dump_size); + } + callstatus = openr2_chan_make_call(R2CALL(ftdmchan)->r2chan, ftdmchan->caller_data.cid_num.digits, ftdmchan->caller_data.dnis.digits, @@ -382,6 +403,7 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(r2_outgoing_call) ftdm_channel_state2str(ftdmchan->state)); return FTDM_BREAK; } + return FTDM_SUCCESS; } @@ -414,7 +436,7 @@ static FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(ftdm_r2_get_channel_sig_status) } /* always called from the monitor thread */ -static void ftdm_r2_on_call_init(openr2_chan_t *r2chan, const char *logname) +static void ftdm_r2_on_call_init(openr2_chan_t *r2chan) { ftdm_r2_call_t *r2call; ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); @@ -447,8 +469,6 @@ static void ftdm_r2_on_call_init(openr2_chan_t *r2chan, const char *logname) ft_r2_clean_call(ftdmchan->call_data); r2call = R2CALL(ftdmchan); - snprintf(r2call->logname, sizeof(r2call->logname), "%s", logname); - /* start io dump */ if (r2data->mf_dump_size) { ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_INPUT_DUMP, &r2data->mf_dump_size); @@ -459,6 +479,7 @@ static void ftdm_r2_on_call_init(openr2_chan_t *r2chan, const char *logname) ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); } +static void dump_mf(openr2_chan_t *r2chan); /* only called for incoming calls when the ANI, DNIS etc is complete and the user has to decide either to accept or reject the call */ static void ftdm_r2_on_call_offered(openr2_chan_t *r2chan, const char *ani, const char *dnis, openr2_calling_party_category_t category) { @@ -468,6 +489,8 @@ static void ftdm_r2_on_call_offered(openr2_chan_t *r2chan, const char *ani, cons ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Call offered with ANI = %s, DNIS = %s, Category = (%d)\n", ani, dnis, category); ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); + dump_mf(r2chan); + /* nothing went wrong during call setup, MF has ended, we can and must disable the MF dump */ if (r2data->mf_dump_size) { ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_INPUT_DUMP, NULL); @@ -759,6 +782,16 @@ static void ftdm_r2_on_ani_digit_received(openr2_chan_t *r2chan, char digit) R2CALL(ftdmchan)->ani_index = collected_len; } +static void ftdm_r2_on_billing_pulse(openr2_chan_t *r2chan) {} + +static void ftdm_r2_on_call_log_created(openr2_chan_t *r2chan, const char *logname) +{ + ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); + ftdm_r2_call_t *r2call = R2CALL(ftdmchan); + /* this is used when dumping I/O for debugging */ + snprintf(r2call->logname, sizeof(r2call->logname), "%s", logname); +} + static openr2_event_interface_t ftdm_r2_event_iface = { /* .on_call_init */ ftdm_r2_on_call_init, /* .on_call_offered */ ftdm_r2_on_call_offered, @@ -779,7 +812,8 @@ static openr2_event_interface_t ftdm_r2_event_iface = { /* .on_ani_digit_received */ ftdm_r2_on_ani_digit_received, /* so far we do nothing with billing pulses */ - /* .on_billing_pulse_received */ NULL, + /* .on_billing_pulse_received */ ftdm_r2_on_billing_pulse, + /* .on_call_log_created */ ftdm_r2_on_call_log_created, }; static int ftdm_r2_io_set_cas(openr2_chan_t *r2chan, int cas) commit 9350fb96265961fd87c1bcecdb4e0123cf77234f Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Tue Dec 7 00:19:49 2010 -0600 skypopen: added a second timer on read from Skype client (timer_read_srv), so not to depend anymore from select on that socket diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index 1263e5f..65c1b12 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -526,6 +526,10 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session) switch_core_timer_destroy(&tech_pvt->timer_read); } + if (tech_pvt->timer_read_srv.timer_interface && tech_pvt->timer_read_srv.timer_interface->timer_next) { + switch_core_timer_destroy(&tech_pvt->timer_read_srv); + } + if (tech_pvt->timer_write.timer_interface && tech_pvt->timer_write.timer_interface->timer_next) { switch_core_timer_destroy(&tech_pvt->timer_write); } @@ -1121,6 +1125,9 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next) { switch_core_timer_sync(&tech_pvt->timer_read); } + if (tech_pvt->timer_read_srv.timer_interface && tech_pvt->timer_read_srv.timer_interface->timer_next) { + switch_core_timer_sync(&tech_pvt->timer_read_srv); + } switch_mutex_unlock(tech_pvt->mutex_audio_srv); } @@ -1146,6 +1153,9 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next) { switch_core_timer_sync(&tech_pvt->timer_read); } + if (tech_pvt->timer_read_srv.timer_interface && tech_pvt->timer_read_srv.timer_interface->timer_next) { + switch_core_timer_sync(&tech_pvt->timer_read_srv); + } switch_mutex_unlock(tech_pvt->mutex_audio_srv); } @@ -1168,6 +1178,9 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next) { switch_core_timer_sync(&tech_pvt->timer_read); } + if (tech_pvt->timer_read_srv.timer_interface && tech_pvt->timer_read_srv.timer_interface->timer_next) { + switch_core_timer_sync(&tech_pvt->timer_read_srv); + } switch_mutex_unlock(tech_pvt->mutex_audio_srv); } @@ -2168,6 +2181,13 @@ int start_audio_threads(private_t *tech_pvt) switch_core_timer_sync(&tech_pvt->timer_read); + if (switch_core_timer_init(&tech_pvt->timer_read_srv, "soft", MS_SKYPOPEN, SAMPLES_PER_FRAME, skypopen_module_pool) != SWITCH_STATUS_SUCCESS) { + ERRORA("setup timer failed\n", SKYPOPEN_P_LOG); + return SWITCH_STATUS_FALSE; + } + + switch_core_timer_sync(&tech_pvt->timer_read_srv); + if (switch_core_timer_init(&tech_pvt->timer_write, "soft", MS_SKYPOPEN, SAMPLES_PER_FRAME, skypopen_module_pool) != SWITCH_STATUS_SUCCESS) { ERRORA("setup timer failed\n", SKYPOPEN_P_LOG); return SWITCH_STATUS_FALSE; diff --git a/src/mod/endpoints/mod_skypopen/skypopen.h b/src/mod/endpoints/mod_skypopen/skypopen.h index 4ff2b01..2f1c8e4 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen.h +++ b/src/mod/endpoints/mod_skypopen/skypopen.h @@ -76,8 +76,8 @@ #define SAMPLERATE_SKYPOPEN 16000 #define MS_SKYPOPEN 20 -#define SAMPLES_PER_FRAME SAMPLERATE_SKYPOPEN/(1000/MS_SKYPOPEN) -#define BYTES_PER_FRAME SAMPLES_PER_FRAME * sizeof(short) +#define SAMPLES_PER_FRAME (SAMPLERATE_SKYPOPEN/(1000/MS_SKYPOPEN)) +#define BYTES_PER_FRAME (SAMPLES_PER_FRAME * sizeof(short)) #ifdef SKYPOPEN_C_VER #ifdef MODSKYPOPEN_C_VER @@ -341,6 +341,7 @@ struct private_object { chat_t chats[MAX_CHATS]; uint32_t report_incoming_chatmessages; switch_timer_t timer_read; + switch_timer_t timer_read_srv; switch_timer_t timer_write; int begin_to_write; int begin_to_read; diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index ef06bfa..391a23c 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -547,6 +547,9 @@ int skypopen_signaling_read(private_t *tech_pvt) if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next) { switch_core_timer_sync(&tech_pvt->timer_read); } + if (tech_pvt->timer_read_srv.timer_interface && tech_pvt->timer_read_srv.timer_interface->timer_next) { + switch_core_timer_sync(&tech_pvt->timer_read_srv); + } switch_mutex_unlock(tech_pvt->mutex_audio_srv); } @@ -878,7 +881,7 @@ void *skypopen_do_tcp_srv_thread_func(void *obj) || tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD || tech_pvt->skype_callflow == SKYPOPEN_STATE_UP)) { unsigned int fdselect; - int rt; + int rt=1; fd_set fs; struct timeval to; int nospace; @@ -891,7 +894,10 @@ void *skypopen_do_tcp_srv_thread_func(void *obj) to.tv_usec = MS_SKYPOPEN * 1000 * 3; to.tv_sec = 0; - rt = select(fdselect + 1, &fs, NULL, NULL, &to); + if (tech_pvt->timer_read_srv.timer_interface && tech_pvt->timer_read_srv.timer_interface->timer_next) { + switch_core_timer_next(&tech_pvt->timer_read_srv); + } + //rt = select(fdselect + 1, &fs, NULL, NULL, &to); if (rt > 0) { if (tech_pvt->skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) { commit 34e44f92a193291a4a7303cd6f3e0b96e79ab080 Author: Moises Silva <moy@sangoma.com> Date: Mon Dec 6 23:24:39 2010 -0500 freetdm: OPENZAP-121 - ftmod_sangoma_ss7 compile error diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c index 4a9c863..8a24f97 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c @@ -1976,7 +1976,7 @@ static int ftmod_ss7_fill_in_self_route(int spc, int linkType, int switchType, i return FTDM_FAIL; } - strcpy((char *)g_ftdm_sngss7_data.cfg.mtpRoute[0].name, "self-route"); + strcpy((char *)g_ftdm_sngss7_data.cfg.mtpRoute[0].name, "self-rt"); g_ftdm_sngss7_data.cfg.mtpRoute[0].id = 0; g_ftdm_sngss7_data.cfg.mtpRoute[0].dpc = spc; commit b49072aed6847fcb74a157657f2773c5d29a6e94 Merge: f41ff72 5522982 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Mon Dec 6 23:20:56 2010 -0200 Merge branch 'master' into netborder commit 55229829360ba09ac30b45d2c1c364440dc0be8c Merge: 22df181 8f2ee97 Author: Moises Silva <moy@sangoma.com> Date: Mon Dec 6 15:10:53 2010 -0500 Merge remote branch 'fsorig/master' diff --cc libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index b9b4eee,ab29b3e..16b22a5 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@@ -348,35 -352,16 +349,17 @@@ void sngisdn_process_cnst_ind (sngisdn_ case MI_PROGRESS: case MI_ALERTING: get_prog_ind_ie(ftdmchan, &cnStEvnt->progInd); + get_facility_ie(ftdmchan, &cnStEvnt->facilityStr); - if (signal_data->ignore_cause_value != SNGISDN_OPT_TRUE && - cnStEvnt->causeDgn[0].eh.pres && cnStEvnt->causeDgn[0].causeVal.pres) { - - switch(cnStEvnt->causeDgn[0].causeVal.val) { - case 17: /* User Busy */ - case 18: /* No User responding */ - case 19: /* User alerting, no answer */ - case 21: /* Call rejected, the called party does not with to accept this call */ - case 27: /* Destination out of order */ - case 31: /* Normal, unspecified */ - case 34: /* Circuit/Channel congestion */ - case 41: /* Temporary failure */ - case 42: /* Switching equipment is experiencing a period of high traffic */ - case 47: /* Resource unavailable */ - case 58: /* Bearer Capability not available */ - case 63: /* Service or option not available */ - case 65: /* Bearer Cap not implemented, not supported */ - case 79: /* Service or option not implemented, unspecified */ - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Cause requires disconnect (cause:%d)\n", cnStEvnt->causeDgn[0].causeVal.val); - ftdmchan->caller_data.hangup_cause = cnStEvnt->causeDgn[0].causeVal.val; + if (sngisdn_cause_val_requires_disconnect(ftdmchan, &cnStEvnt->causeDgn[0]) == FTDM_SUCCESS) { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Cause requires disconnect (cause:%d)\n", cnStEvnt->causeDgn[0].causeVal.val); + ftdmchan->caller_data.hangup_cause = cnStEvnt->causeDgn[0].causeVal.val; - sngisdn_set_flag(sngisdn_info, FLAG_SEND_DISC); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - goto sngisdn_process_cnst_ind_end; - } + sngisdn_set_flag(sngisdn_info, FLAG_SEND_DISC); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + goto sngisdn_process_cnst_ind_end; } - + switch(ftdmchan->state) { case FTDM_CHANNEL_STATE_DIALING: case FTDM_CHANNEL_STATE_PROCEED: commit 22df1818c4b15fc50a6a3050bc5123423fcf0fd3 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Mon Dec 6 17:37:03 2010 -0200 freetdm: ftmod_r2 - small code cleanup diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index a6bf917..0348c8b 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -1576,14 +1576,9 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) r2chan = NULL; for (i = 1; i <= span->chan_count; i++) { r2chan = R2CALL(span->channels[i])->r2chan; + openr2_chan_set_span_id(r2chan, span->span_id); openr2_chan_set_idle(r2chan); openr2_chan_process_cas_signaling(r2chan); - - /* set r2chan span id */ - openr2_chan_set_span_id(r2chan, span->span_id); - - ftdmchan = openr2_chan_get_client_data(r2chan); - //ftdm_channel_set_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS); } memset(&start, 0, sizeof(start)); commit de758ca22ae3fac9de2fb915fac5ddff00c86c19 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Mon Dec 6 17:35:08 2010 -0200 freetdm: ftmod_r2 - updated code to match openr2 change, now setting span_id per channel diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 78435a7..a6bf917 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -1263,7 +1263,6 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) openr2_context_set_metering_pulse_timeout(r2data->r2context, r2conf.metering_pulse_timeout); openr2_context_set_double_answer(r2data->r2context, r2conf.double_answer); openr2_context_set_immediate_accept(r2data->r2context, r2conf.immediate_accept); - openr2_context_set_span_id(r2data->r2context, span->span_id); ftdm_log(FTDM_LOG_DEBUG, "Setting span %s logdir to %s\n", span->name, r2conf.logdir); openr2_context_set_log_directory(r2data->r2context, r2conf.logdir); @@ -1580,6 +1579,9 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) openr2_chan_set_idle(r2chan); openr2_chan_process_cas_signaling(r2chan); + /* set r2chan span id */ + openr2_chan_set_span_id(r2chan, span->span_id); + ftdmchan = openr2_chan_get_client_data(r2chan); //ftdm_channel_set_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS); } commit 430556697e38ac616ca14fd73fe7bd08e2eeea93 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Mon Dec 6 17:11:56 2010 -0200 freetdm: fixed compilation on windows diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 1f91463..3b46394 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -48,6 +48,10 @@ #endif #include "ftdm_cpu_monitor.h" +#ifndef localtime_r +struct tm *localtime_r(const time_t *clock, struct tm *result); +#endif + #define FORCE_HANGUP_TIMER 3000 #define SPAN_PENDING_CHANS_QUEUE_SIZE 1000 #define SPAN_PENDING_SIGNALS_QUEUE_SIZE 1000 @@ -86,10 +90,10 @@ FT_DECLARE(ftdm_time_t) ftdm_current_time_in_ms(void) #endif } -static void write_chan_io_dump(ftdm_channel_t *fchan, ftdm_io_dump_t *dump, char *dataptr, int dlen) +static void write_chan_io_dump(ftdm_io_dump_t *dump, char *dataptr, int dlen) { int windex = dump->windex; - int avail = dump->size - windex; + int avail = (int)dump->size - windex; if (!dump->buffer) { return; @@ -124,8 +128,8 @@ static void write_chan_io_dump(ftdm_channel_t *fchan, ftdm_io_dump_t *dump, char static void dump_chan_io_to_file(ftdm_channel_t *fchan, ftdm_io_dump_t *dump, FILE *file) { /* write the saved audio buffer */ - int rc = 0; - int towrite = dump->size - dump->windex; + size_t rc = 0; + size_t towrite = dump->size - dump->windex; if (dump->wrapped) { rc = fwrite(&dump->buffer[dump->windex], 1, towrite, file); if (rc != towrite) { @@ -2740,7 +2744,6 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co GOTO_STATUS(done, FTDM_FAIL); } GOTO_STATUS(done, FTDM_SUCCESS); - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Disabled DTMF debugging\n"); } break; @@ -3310,7 +3313,13 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_queue_dtmf(ftdm_channel_t *ftdmchan, cons char dfile[512]; currsec = time(NULL); + +#ifdef WIN32 + _tzset(); + _localtime64_s(&currtime, &currsec); +#else localtime_r(&currsec, &currtime); +#endif snprintf(dfile, sizeof(dfile), "dtmf-s%dc%d-20%d-%d-%d-%d:%d:%d.%s", ftdmchan->span_id, ftdmchan->chan_id, @@ -3379,7 +3388,7 @@ static FIO_WRITE_FUNCTION(ftdm_raw_write) ftdm_log(FTDM_LOG_WARNING, "Raw output trace failed to write all of the %zd bytes\n", dlen); } } - write_chan_io_dump(ftdmchan, &ftdmchan->txdump, data, dlen); + write_chan_io_dump(&ftdmchan->txdump, data, dlen); return ftdmchan->fio->write(ftdmchan, data, datalen); } @@ -3399,9 +3408,9 @@ static FIO_READ_FUNCTION(ftdm_raw_read) if (status == FTDM_SUCCESS) { int dlen = (int) *datalen; - int rc = 0; + size_t rc = 0; - write_chan_io_dump(ftdmchan, &ftdmchan->rxdump, data, dlen); + write_chan_io_dump(&ftdmchan->rxdump, data, dlen); /* if dtmf debug is enabled and initialized, write there too */ if (ftdmchan->dtmfdbg.file) { commit 004cc9d7aa52ee541514490c66c5e517830be8b9 Merge: e85ef4c e37ce44 Author: Moises Silva <moy@sangoma.com> Date: Mon Dec 6 07:34:25 2010 -0500 Merge branch 'moy.iodump' diff --cc libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 4e903ee,e7e4ad6..78435a7 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@@ -1210,12 -1263,11 +1263,12 @@@ static FIO_CONFIGURE_SPAN_SIGNALING_FUN openr2_context_set_metering_pulse_timeout(r2data->r2context, r2conf.metering_pulse_timeout); openr2_context_set_double_answer(r2data->r2context, r2conf.double_answer); openr2_context_set_immediate_accept(r2data->r2context, r2conf.immediate_accept); + openr2_context_set_span_id(r2data->r2context, span->span_id); - if (r2conf.logdir && r2conf.logdir[0]) { - ftdm_log(FTDM_LOG_DEBUG, "Setting openr2 for span %s logdir to %s\n", span->name, r2conf.logdir); - openr2_context_set_log_directory(r2data->r2context, r2conf.logdir); - } + ftdm_log(FTDM_LOG_DEBUG, "Setting span %s logdir to %s\n", span->name, r2conf.logdir); + openr2_context_set_log_directory(r2data->r2context, r2conf.logdir); + snprintf(r2data->logdir, sizeof(r2data->logdir), "%s", r2conf.logdir); + if (r2conf.advanced_protocol_file) { openr2_context_configure_from_advanced_file(r2data->r2context, r2conf.advanced_protocol_file); } commit e37ce444dddf2764d40c22a35983edb7c55ce94f Author: Moises Silva <moy@sangoma.com> Date: Mon Dec 6 07:30:37 2010 -0500 freetdm: fix ftmod_r2 debug message diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index b503919..e7e4ad6 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -1181,7 +1181,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) r2conf.mf_dump_size = atoi(val); if (r2conf.mf_dump_size < 0) { r2conf.mf_dump_size = FTDM_IO_DUMP_DEFAULT_BUFF_SIZE; - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with default mf_dumps = %d bytes\n", span->name, r2conf.mf_dump_size); + ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with default mf_dump_size = %d bytes\n", span->name, r2conf.mf_dump_size); } else { ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with mf_dump_size = %d bytes\n", span->name, r2conf.mf_dump_size); } commit c05cae9f0a005a5bf43bbfe131ac5d82338935ee Author: Moises Silva <moy@sangoma.com> Date: Mon Dec 6 07:26:04 2010 -0500 freetdm: use ftdm_status_t as return code for io dump and debug dtmf functions diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index b70eea7..1f91463 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -152,19 +152,19 @@ static void stop_chan_io_dump(ftdm_io_dump_t *dump) memset(dump, 0, sizeof(dump)); } -static int start_chan_io_dump(ftdm_channel_t *chan, ftdm_io_dump_t *dump, ftdm_size_t size) +static ftdm_status_t start_chan_io_dump(ftdm_channel_t *chan, ftdm_io_dump_t *dump, ftdm_size_t size) { if (dump->buffer) { ftdm_log_chan_msg(chan, FTDM_LOG_ERROR, "IO dump is already started\n"); - return -1; + return FTDM_FAIL; } memset(dump, 0, sizeof(*dump)); dump->buffer = ftdm_malloc(size); if (!dump->buffer) { - return -1; + return FTDM_FAIL; } dump->size = size; - return 0; + return FTDM_SUCCESS; } @@ -177,21 +177,21 @@ static void close_dtmf_debug_file(ftdm_channel_t *ftdmchan) } } -static int disable_dtmf_debug(ftdm_channel_t *ftdmchan) +static ftdm_status_t disable_dtmf_debug(ftdm_channel_t *ftdmchan) { if (!ftdmchan->dtmfdbg.enabled) { - return 0; + return FTDM_SUCCESS; } if (!ftdmchan->rxdump.buffer) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "DTMF debug enabled but no rx dump?\n"); - return -1; + return FTDM_FAIL; } close_dtmf_debug_file(ftdmchan); stop_chan_io_dump(&ftdmchan->rxdump); ftdmchan->dtmfdbg.enabled = 0; - return 0; + return FTDM_SUCCESS; } typedef struct { @@ -2718,8 +2718,9 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Cannot debug DTMF if Rx dumping is already enabled\n"); GOTO_STATUS(done, FTDM_FAIL); } - if (start_chan_io_dump(ftdmchan, &ftdmchan->rxdump, FTDM_IO_DUMP_DEFAULT_BUFF_SIZE)) { + if (start_chan_io_dump(ftdmchan, &ftdmchan->rxdump, FTDM_IO_DUMP_DEFAULT_BUFF_SIZE) != FTDM_SUCCESS) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to enable rx dump for DTMF debugging\n"); + GOTO_STATUS(done, FTDM_FAIL); } ftdmchan->dtmfdbg.enabled = 1; ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Enabled DTMF debugging\n"); @@ -2734,7 +2735,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "DTMF debug is already disabled\n"); GOTO_STATUS(done, FTDM_SUCCESS); } - if (disable_dtmf_debug(ftdmchan)) { + if (disable_dtmf_debug(ftdmchan) != FTDM_SUCCESS) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to disable DTMF debug\n"); GOTO_STATUS(done, FTDM_FAIL); } @@ -2751,7 +2752,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Input dump is already enabled\n"); GOTO_STATUS(done, FTDM_FAIL); } - if (start_chan_io_dump(ftdmchan, &ftdmchan->rxdump, size)) { + if (start_chan_io_dump(ftdmchan, &ftdmchan->rxdump, size) != FTDM_SUCCESS) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to enable input dump\n"); GOTO_STATUS(done, FTDM_FAIL); } @@ -2781,7 +2782,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Output dump is already enabled\n"); GOTO_STATUS(done, FTDM_FAIL); } - if (start_chan_io_dump(ftdmchan, &ftdmchan->txdump, size)) { + if (start_chan_io_dump(ftdmchan, &ftdmchan->txdump, size) != FTDM_SUCCESS) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to enable output dump\n"); GOTO_STATUS(done, FTDM_FAIL); } commit 3284c76150b383ba9b690c8519b75e6a5719cbfd Author: Moises Silva <moy@sangoma.com> Date: Mon Dec 6 07:22:16 2010 -0500 freetdm: remove DEBUG_DTMF macros from build diff --git a/libs/freetdm/Makefile.am b/libs/freetdm/Makefile.am index bc92e1d..af26f7f 100644 --- a/libs/freetdm/Makefile.am +++ b/libs/freetdm/Makefile.am @@ -55,10 +55,6 @@ COMPILE = $(CC) $(FTDM_CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(COMPILE) LINK = $(LIBTOOL) --mode=link --tag=CC $(CC) $(FTDM_CFLAGS) $(LDFLAGS) -o $@ -if WANT_DEBUGDTMF -FTDM_CFLAGS += -DFTDM_DEBUG_DTMF -endif - # # GNU pkgconfig file diff --git a/libs/freetdm/configure.ac b/libs/freetdm/configure.ac index 6b9287d..592dfd8 100644 --- a/libs/freetdm/configure.ac +++ b/libs/freetdm/configure.ac @@ -167,17 +167,6 @@ AC_ARG_WITH([pritap], HAVE_PRITAP="${enable_pritap}" AM_CONDITIONAL([HAVE_PRITAP],[test "${enable_pritap}" = "yes"]) -# debug dtmf? -AC_ARG_WITH([debugdtmf], - [AS_HELP_STRING([--with-debugdtmf], [Debug DTMF])], - [case "${withval}" in - no) enable_debugdtmf="no" ;; - *) enable_debugdtmf="yes" ;; - esac], - [enable_debugdtmf="no"] -) -AM_CONDITIONAL([WANT_DEBUGDTMF], [test "${enable_debugdtmf}" = "yes"]) - ## # OpenR2 stack # commit 8f2ee97ed1d19b3985742a53e232ce5184458f61 Author: Jeff Lenk <jeff@jefflenk.com> Date: Sun Dec 5 17:19:28 2010 -0600 VS2010 Setup - try another way diff --git a/Freeswitch.2010.sln b/Freeswitch.2010.sln index 4f48314..1869698 100644 --- a/Freeswitch.2010.sln +++ b/Freeswitch.2010.sln @@ -964,9 +964,7 @@ Global {692F6330-4D87-4C82-81DF-40DB5892636E}.Release|Win32.ActiveCfg = Release|Win32 {692F6330-4D87-4C82-81DF-40DB5892636E}.Release|x64.ActiveCfg = Release|x64 {692F6330-4D87-4C82-81DF-40DB5892636E}.Release|x64 Setup.ActiveCfg = Release|x64 - {692F6330-4D87-4C82-81DF-40DB5892636E}.Release|x64 Setup.Build.0 = Release|x64 {692F6330-4D87-4C82-81DF-40DB5892636E}.Release|x86 Setup.ActiveCfg = Release|Win32 - {692F6330-4D87-4C82-81DF-40DB5892636E}.Release|x86 Setup.Build.0 = Release|Win32 {D3EC0AFF-76FC-4210-A825-9A17410660A3}.All|Win32.ActiveCfg = Release|x64 {D3EC0AFF-76FC-4210-A825-9A17410660A3}.All|x64.ActiveCfg = Release|x64 {D3EC0AFF-76FC-4210-A825-9A17410660A3}.All|x64.Build.0 = Release|x64 commit e85ef4cebb9528cfad4cc31ea16743c6c293755f Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Sun Dec 5 19:31:20 2010 -0200 freetdm: ftmod_r2 - now setting span id on openr2 through openr2_context_set_span_id() diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 5a36f05..4e903ee 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -1210,6 +1210,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) openr2_context_set_metering_pulse_timeout(r2data->r2context, r2conf.metering_pulse_timeout); openr2_context_set_double_answer(r2data->r2context, r2conf.double_answer); openr2_context_set_immediate_accept(r2data->r2context, r2conf.immediate_accept); + openr2_context_set_span_id(r2data->r2context, span->span_id); if (r2conf.logdir && r2conf.logdir[0]) { ftdm_log(FTDM_LOG_DEBUG, "Setting openr2 for span %s logdir to %s\n", span->name, r2conf.logdir); commit 7aa72b67df8beec7996e3f7532a234cb61e6e26b Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Dec 3 20:22:02 2010 -0600 prevent race while changing codecs mid call diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 451d788..6416778 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -2673,6 +2673,7 @@ switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force) switch_core_session_lock_codec_write(tech_pvt->session); switch_core_session_lock_codec_read(tech_pvt->session); resetting = 1; + switch_yield(tech_pvt->read_impl.microseconds_per_packet); switch_core_codec_destroy(&tech_pvt->read_codec); switch_core_codec_destroy(&tech_pvt->write_codec); } else { diff --git a/src/switch_core_io.c b/src/switch_core_io.c index cd25622..6f3e65a 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -110,6 +110,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi switch_assert(session != NULL); + + if (switch_mutex_trylock(session->codec_read_mutex) == SWITCH_STATUS_SUCCESS) { + switch_mutex_unlock(session->codec_read_mutex); + } else { + switch_cond_next(); + *frame = &runtime.dummy_cng_frame; + return SWITCH_STATUS_SUCCESS; + } + if (!(session->read_codec && session->read_codec->implementation && switch_core_codec_ready(session->read_codec))) { if (switch_channel_test_flag(session->channel, CF_PROXY_MODE) || switch_channel_get_state(session->channel) == CS_HIBERNATE) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "%s reading on a session with no media!\n", @@ -641,11 +650,18 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess return SWITCH_STATUS_FALSE; } + if (switch_mutex_trylock(session->codec_write_mutex) == SWITCH_STATUS_SUCCESS) { + switch_mutex_unlock(session->codec_write_mutex); + } else { + return SWITCH_STATUS_SUCCESS; + } + if (switch_test_flag(frame, SFF_CNG)) { if (switch_channel_test_flag(session->channel, CF_ACCEPT_CNG)) { pass_cng = 1; + } else { + return SWITCH_STATUS_SUCCESS; } - return SWITCH_STATUS_SUCCESS; } if (!(session->write_codec && switch_core_codec_ready(session->write_codec)) && !pass_cng) { commit 3501087b4d314d7f194f3e705fde989d502a229b Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Dec 3 18:34:07 2010 -0600 add-on to earlier change to this file diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index fe12047..4364ff2 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -915,9 +915,9 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, char *tmp, *sqlbuf = (char *) malloc(sql_len); char *sql = NULL, *save_sql = NULL; switch_size_t newlen; - int lc = 0; + int lc = 0, wrote = 0, do_sleep = 1; uint32_t sanity = 120; - + switch_assert(sqlbuf); while (!sql_manager.event_db) { @@ -978,6 +978,7 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, #endif save_sql = sql; sql = NULL; + lc = 0; goto skip; } } @@ -993,10 +994,12 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, } } - skip: - lc = switch_queue_size(sql_manager.sql_queue[0]) + switch_queue_size(sql_manager.sql_queue[1]); + + skip: + wrote = 0; + if (trans && iterations && (iterations > target || !lc)) { #ifdef DEBUG_SQL switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, @@ -1013,14 +1016,25 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, len = 0; *sqlbuf = '\0'; lc = 0; - switch_yield(400000); + if (do_sleep) { + switch_yield(200000); + } + wrote = 1; } - lc = sql ? 1 : 0 + switch_queue_size(sql_manager.sql_queue[0]) + switch_queue_size(sql_manager.sql_queue[1]); + lc = switch_queue_size(sql_manager.sql_queue[0]) + switch_queue_size(sql_manager.sql_queue[1]); if (!lc) { switch_thread_cond_wait(sql_manager.cond, sql_manager.cond_mutex); + } else if (wrote) { + if (lc > 2000) { + do_sleep = 0; + } else { + do_sleep = 1; + } } + + } switch_mutex_unlock(sql_manager.cond_mutex); commit fdc31908faf217d2e3bd011ef84aaba2bbbe0680 Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Fri Dec 3 18:58:39 2010 -0500 mod_sofia: Add support to reboot Yealink phone remotely - FS-2897 diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index e93bdaa..570e297 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -511,7 +511,7 @@ void sofia_reg_send_reboot(sofia_profile_t *profile, const char *user, const cha const char *contenttype = "application/simple-message-summary"; const char *body = ""; - if (switch_stristr("snom", user_agent)) { + if (switch_stristr("snom", user_agent) || switch_stristr("yealink", user_agent)) { event = "check-sync;reboot=true"; } else if (switch_stristr("linksys", user_agent)) { event = "reboot_now"; commit 6e05e90caf09721a55deccff5f80ae8ad5a78a11 Author: Moises Silva <moy@sangoma.com> Date: Fri Dec 3 17:54:24 2010 -0500 freetdm: reduce log severity diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 52555f1..b70eea7 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -3321,7 +3321,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_queue_dtmf(ftdm_channel_t *ftdmchan, cons } else { ftdmchan->dtmfdbg.closetimeout = DTMF_DEBUG_TIMEOUT; ftdm_channel_command(ftdmchan, FTDM_COMMAND_DUMP_INPUT, ftdmchan->dtmfdbg.file); - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Dumped initial DTMF output to %s\n", dfile); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Dumped initial DTMF output to %s\n", dfile); } } else { ftdmchan->dtmfdbg.closetimeout = DTMF_DEBUG_TIMEOUT; commit 50f2686fa1532158cb12d8b8f60dc04060f7ac53 Author: Moises Silva <moy@sangoma.com> Date: Fri Dec 3 17:52:10 2010 -0500 freetdm: Add FTDM_COMMANDs to debug DTMF diff --git a/libs/freetdm/conf/freetdm.conf b/libs/freetdm/conf/freetdm.conf index a657320..2f9643d 100644 --- a/libs/freetdm/conf/freetdm.conf +++ b/libs/freetdm/conf/freetdm.conf @@ -59,3 +59,15 @@ trunk_type => E1 cas-channel => 1-15:1101 cas-channel => 17-31:1101 +; generic channel parameters +; this parameters are accepted by any type of span/channel +; remember that for generic channel parameters only channels +; below the parameter within the span will be affected + +; Channel audio gain +; rxgain => 0.0 +; txgain => 0.0 + +; Whether to perform media dumps for DTMF debugging +; debugdtmf => yes + diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 13a1654..ca16e8b 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1417,6 +1417,24 @@ fail: } +static void ftdm_enable_channel_dtmf(ftdm_channel_t *fchan, switch_channel_t *channel) +{ + if (channel) { + const char *var; + if ((var = switch_channel_get_variable(channel, "freetdm_disable_dtmf"))) { + if (switch_true(var)) { + ftdm_channel_command(fchan, FTDM_COMMAND_DISABLE_DTMF_DETECT, NULL); + ftdm_log(FTDM_LOG_INFO, "DTMF detection disabled in channel %d:%d\n", ftdm_channel_get_span_id(fchan), ftdm_channel_get_id(fchan)); + return; + } + } + /* the variable is not present or has a negative value then proceed to enable DTMF ... */ + } + if (ftdm_channel_command(fchan, FTDM_COMMAND_ENABLE_DTMF_DETECT, NULL) != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_ERROR, "Failed to enable DTMF detection in channel %d:%d\n", ftdm_channel_get_span_id(fchan), ftdm_channel_get_id(fchan)); + } +} + ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session_t **sp) { switch_core_session_t *session = NULL; @@ -1440,6 +1458,9 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session return FTDM_FAIL; } + /* I guess we always want DTMF detection */ + ftdm_enable_channel_dtmf(sigmsg->channel, NULL); + switch_core_session_add_stream(session, NULL); tech_pvt = (private_t *) switch_core_session_alloc(session, sizeof(private_t)); @@ -1633,24 +1654,6 @@ static FIO_SIGNAL_CB_FUNCTION(on_common_signal) return FTDM_BREAK; } -static void ftdm_enable_channel_dtmf(ftdm_channel_t *fchan, switch_channel_t *channel) -{ - if (channel) { - const char *var; - if ((var = switch_channel_get_variable(channel, "freetdm_disable_dtmf"))) { - if (switch_true(var)) { - ftdm_channel_command(fchan, FTDM_COMMAND_DISABLE_DTMF_DETECT, NULL); - ftdm_log(FTDM_LOG_INFO, "DTMF detection disabled in channel %d:%d\n", ftdm_channel_get_span_id(fchan), ftdm_channel_get_id(fchan)); - return; - } - } - /* the variable is not present or has a negative value then proceed to enable DTMF ... */ - } - if (ftdm_channel_command(fchan, FTDM_COMMAND_ENABLE_DTMF_DETECT, NULL) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Failed to enable DTMF detection in channel %d:%d\n", ftdm_channel_get_span_id(fchan), ftdm_channel_get_id(fchan)); - } -} - static FIO_SIGNAL_CB_FUNCTION(on_fxo_signal) { switch_core_session_t *session = NULL; @@ -2059,6 +2062,8 @@ static FIO_SIGNAL_CB_FUNCTION(on_r2_signal) } break; + case FTDM_SIGEVENT_PROCEED:{} break; + default: { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unhandled event %d from R2 for channel %d:%d\n", @@ -2092,8 +2097,6 @@ static FIO_SIGNAL_CB_FUNCTION(on_clear_channel_signal) { ftdm_channel_add_var(sigmsg->channel, "screening_ind", ftdm_screening2str(caller_data->screen)); ftdm_channel_add_var(sigmsg->channel, "presentation_ind", ftdm_presentation2str(caller_data->pres)); - - ftdm_enable_channel_dtmf(sigmsg->channel, NULL); return ftdm_channel_from_event(sigmsg, &session); } break; diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index d2ad249..52555f1 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2537,9 +2537,9 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_done(ftdm_channel_t *ftdmchan) ftdmchan->init_state = FTDM_CHANNEL_STATE_DOWN; ftdmchan->state = FTDM_CHANNEL_STATE_DOWN; + ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_DEBUG_DTMF, NULL); ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_INPUT_DUMP, NULL); ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_OUTPUT_DUMP, NULL); - ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_DEBUG_DTMF, NULL); if (FTDM_IS_VOICE_CHANNEL(ftdmchan)) { ftdm_sigmsg_t sigmsg; @@ -2722,6 +2722,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to enable rx dump for DTMF debugging\n"); } ftdmchan->dtmfdbg.enabled = 1; + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Enabled DTMF debugging\n"); GOTO_STATUS(done, FTDM_SUCCESS); } break; @@ -2738,6 +2739,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co GOTO_STATUS(done, FTDM_FAIL); } GOTO_STATUS(done, FTDM_SUCCESS); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Disabled DTMF debugging\n"); } break; @@ -3295,7 +3297,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_queue_dtmf(ftdm_channel_t *ftdmchan, cons ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "No channel\n"); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Queuing DTMF %s\n", dtmf); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Queuing DTMF %s (debug = %d)\n", dtmf, ftdmchan->dtmfdbg.enabled); if (!ftdmchan->dtmfdbg.enabled) { goto skipdebug; @@ -3319,6 +3321,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_queue_dtmf(ftdm_channel_t *ftdmchan, cons } else { ftdmchan->dtmfdbg.closetimeout = DTMF_DEBUG_TIMEOUT; ftdm_channel_command(ftdmchan, FTDM_COMMAND_DUMP_INPUT, ftdmchan->dtmfdbg.file); + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Dumped initial DTMF output to %s\n", dfile); } } else { ftdmchan->dtmfdbg.closetimeout = DTMF_DEBUG_TIMEOUT; @@ -4206,6 +4209,7 @@ static ftdm_status_t ftdm_set_channels_alarms(ftdm_span_t *span, int currindex) FT_DECLARE(ftdm_status_t) ftdm_configure_span_channels(ftdm_span_t *span, const char* str, ftdm_channel_config_t *chan_config, unsigned *configured) { int currindex; + unsigned chan_index = 0; ftdm_assert_return(span != NULL, FTDM_EINVAL, "span is null\n"); ftdm_assert_return(chan_config != NULL, FTDM_EINVAL, "config is null\n"); @@ -4239,6 +4243,14 @@ FT_DECLARE(ftdm_status_t) ftdm_configure_span_channels(ftdm_span_t *span, const return FTDM_FAIL; } + if (chan_config->debugdtmf) { + for (chan_index = currindex+1; chan_index <= span->chan_count; chan_index++) { + if (!FTDM_IS_VOICE_CHANNEL(span->channels[chan_index])) { + continue; + } + span->channels[chan_index]->dtmfdbg.requested = 1; + } + } return FTDM_SUCCESS; } @@ -4257,7 +4269,7 @@ static ftdm_status_t load_config(void) ftdm_channel_config_t chan_config; memset(&chan_config, 0, sizeof(chan_config)); - sprintf(chan_config.group_name,"default"); + sprintf(chan_config.group_name, "__default"); if (!ftdm_config_open_file(&cfg, cfg_name)) { return FTDM_FAIL; @@ -4294,6 +4306,9 @@ static ftdm_status_t load_config(void) if (ftdm_span_create(type, name, &span) == FTDM_SUCCESS) { ftdm_log(FTDM_LOG_DEBUG, "created span %d (%s) of type %s\n", span->span_id, span->name, type); d = 0; + /* it is confusing that parameters from one span affect others, so let's clear them */ + memset(&chan_config, 0, sizeof(chan_config)); + sprintf(chan_config.group_name, "__default"); } else { ftdm_log(FTDM_LOG_CRIT, "failure creating span of type %s\n", type); span = NULL; @@ -4417,6 +4432,9 @@ static ftdm_status_t load_config(void) if (sscanf(val, "%f", &(chan_config.rxgain)) != 1) { ftdm_log(FTDM_LOG_ERROR, "invalid rxgain: '%s'\n", val); } + } else if (!strcasecmp(var, "debugdtmf")) { + chan_config.debugdtmf = ftdm_true(val); + ftdm_log(FTDM_LOG_DEBUG, "Setting debugdtmf to '%s'\n", chan_config.debugdtmf ? "yes" : "no"); } else if (!strcasecmp(var, "group")) { len = strlen(val); if (len >= FTDM_MAX_NAME_STR_SZ) { @@ -5068,6 +5086,9 @@ FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t case FTDM_SIGEVENT_START: { ftdm_set_echocancel_call_begin(sigmsg->channel); + if (sigmsg->channel->dtmfdbg.requested) { + ftdm_channel_command(sigmsg->channel, FTDM_COMMAND_ENABLE_DEBUG_DTMF, NULL); + } /* when cleaning up the public API I added this because mod_freetdm.c on_fxs_signal was * doing it during SIGEVENT_START, but now that flags are private they can't, wonder if diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 9ece036..b503919 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -448,7 +448,6 @@ static void ftdm_r2_on_call_init(openr2_chan_t *r2chan, const char *logname) r2call = R2CALL(ftdmchan); snprintf(r2call->logname, sizeof(r2call->logname), "%s", logname); - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Set logname for call to %s\n", r2call->logname); /* start io dump */ if (r2data->mf_dump_size) { @@ -464,9 +463,16 @@ static void ftdm_r2_on_call_init(openr2_chan_t *r2chan, const char *logname) static void ftdm_r2_on_call_offered(openr2_chan_t *r2chan, const char *ani, const char *dnis, openr2_calling_party_category_t category) { ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); + ftdm_r2_data_t *r2data = ftdmchan->span->signal_data; ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Call offered with ANI = %s, DNIS = %s, Category = (%d)\n", ani, dnis, category); ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); + + /* nothing went wrong during call setup, MF has ended, we can and must disable the MF dump */ + if (r2data->mf_dump_size) { + ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_INPUT_DUMP, NULL); + ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_OUTPUT_DUMP, NULL); + } } /* diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 76db25c..41e7f50 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -351,6 +351,7 @@ typedef struct ftdm_channel_config { ftdm_chan_type_t type; float rxgain; float txgain; + uint8_t debugdtmf; } ftdm_channel_config_t; /*! diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index 04458ad..f1058d8 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -355,6 +355,7 @@ typedef struct { #define DTMF_DEBUG_TIMEOUT 250 typedef struct { uint8_t enabled; + uint8_t requested; FILE *file; int32_t closetimeout; ftdm_mutex_t *mutex; commit 8b80661e405441761cf1525ed95d03069a2e03df Merge: 9cf15ac b156f4d Author: Moises Silva <moy@sangoma.com> Date: Fri Dec 3 16:51:11 2010 -0500 Merge branch 'moy.iodump' of git.sangoma.com:smg_freeswitch into moy.iodump commit 9cf15ac04b6f47ced2e6be14690301f73bbb76e8 Author: Moises Silva <moy@sangoma.com> Date: Fri Dec 3 16:50:03 2010 -0500 freetdm: add MF dumping support to ftmod_r2 improve sample configuration documentation for MFC-R2 diff --git a/libs/freetdm/conf/freetdm.conf b/libs/freetdm/conf/freetdm.conf index bbaf1e3..a657320 100644 --- a/libs/freetdm/conf/freetdm.conf +++ b/libs/freetdm/conf/freetdm.conf @@ -45,3 +45,17 @@ fxs-channel => 1 number => 2 fxo-channel => 3 +; MFC-R2 typical span configuration + +; MFC-R2 with wanpipe (Sangoma) +[span wanpipe myWanpipeSpan] +trunk_type => E1 +cas-channel => 1-15:1101 +cas-channel => 17-31:1101 + +; MFC-R2 with Zaptel/DAHDI +[span zt myWanpipeSpan] +trunk_type => E1 +cas-channel => 1-15:1101 +cas-channel => 17-31:1101 + diff --git a/libs/freetdm/conf/freetdm.conf.xml b/libs/freetdm/conf/freetdm.conf.xml index 986074d..63a3ea6 100644 --- a/libs/freetdm/conf/freetdm.conf.xml +++ b/libs/freetdm/conf/freetdm.conf.xml @@ -1,52 +1,220 @@ <!-- Please refer to http://wiki.freeswitch.org/wiki/FreeTDM for further documentation --> +<!-- +This is a sample FreeSWITCH XML configuration for FreeTDM +Remember you still need to configure freetdm.conf (no XML extension) in $prefix/conf/ +directory of FreeSWITCH. The freetdm.conf (no XML extension) is a simple text file +definining the I/O interfaces (Sangoma, DAHDI etc). This file (freetdm.conf.xml) deals +with the signaling protocols that you can run on top of your I/O interfaces. +--> <configuration name="freetdm.conf" description="FreeTDM Configuration"> - <settings> - <param name="debug" value="0"/> - <!--<param name="hold-music" value="$${moh_uri}"/>--> - <!--<param name="enable-analog-option" value="call-swap"/>--> - <!--<param name="enable-analog-option" value="3-way"/>--> - </settings> - - <!-- use the <pri_spans> tag for native ISDN support (most likely broken at this point, check sangoma_pri_spans or libpri_spans for alternatives) --> - <pri_spans> - <span name="PRI_1"> - <!-- Log Levels: none, alert, crit, err, warning, notice, info, debug --> - <param name="q921loglevel" value="alert"/> - <param name="q931loglevel" value="alert"/> - <param name="mode" value="user"/> - <param name="dialect" value="5ess"/> - <param name="dialplan" value="XML"/> - <param name="context" value="default"/> - </span> - <span name="PRI_2"> - <param name="q921loglevel" value="alert"/> - <param name="q931loglevel" value="alert"/> - <param name="mode" value="user"/> - <param name="dialect" value="5ess"/> - <param name="dialplan" value="XML"/> - <param name="context" value="default"/> - </span> - </pri_spans> - - - <!-- Analog spans go here --> - <analog_spans> - <span name="myAnalog"> - <!--<param name="hold-music" value="$${moh_uri}"/>--> - <!--<param name="enable-analog-option" value="call-swap"/>--> - <!--<param name="enable-analog-option" value="3-way"/>--> - <param name="tonegroup" value="us"/> - <param name="digit-timeout" value="2000"/> - <param name="max-digits" value="11"/> - <param name="dialplan" value="XML"/> - <param name="context" value="default"/> - <param name="enable-callerid" value="true"/> - <!-- regex to stop dialing when it matches --> - <!--<param name="dial-regex" value="5555"/>--> - <!-- regex to stop dialing when it does not match --> - <!--<param name="fail-dial-regex" value="^5"/>--> - </span> - </analog_spans> + + <settings> + <param name="debug" value="0"/> + <!--<param name="hold-music" value="$${moh_uri}"/>--> + <!--<param name="enable-analog-option" value="call-swap"/>--> + <!--<param name="enable-analog-option" value="3-way"/>--> + </settings> + <!-- Sample analog configuration --> + <analog_spans> + <!-- The span name must match the name in your freetdm.conf --> + <span name="myAnalog"> + <!--<param name="hold-music" value="$${moh_uri}"/>--> + <!--<param name="enable-analog-option" value="call-swap"/>--> + <!--<param name="enable-analog-option" value="3-way"/>--> + <param name="tonegroup" value="us"/> + <param name="digit-timeout" value="2000"/> + <param name="max-digits" value="11"/> + <param name="dialplan" value="XML"/> + <param name="context" value="default"/> + <param name="enable-callerid" value="true"/> + <!-- regex to stop dialing when it matches --> + <!--<param name="dial-regex" value="5555"/>--> + <!-- regex to stop dialing when it does not match --> + <!--<param name="fail-dial-regex" value="^5"/>--> + </span> + </analog_spans> + + <!-- openr2 (MFC-R2 signaling) spans + MFC-R2 signaling has lots of variants from country to country and even sometimes + minor variants inside the same country. The only mandatory parameters here are: + variant, but typically you also want to set max_ani and max_dnis. + IT IS RECOMMENDED that you leave the default values (leaving them commented) for the + other parameters unless you have problems or you have been instructed to change some + parameter. OpenR2 library uses the 'variant' parameter to try to determine the + best defaults for your country. If you want to contribute your configs for a particular + country send them to the e-mail of the primary OpenR2 developer that you can find in the + AUTHORS file of the OpenR2 package, they will be added to the samples directory of openr2. + --> + <r2_spans> + <span name="wp1" cfgprofile="testr2"> + + <!-- + MFC/R2 variant. This depends on the OpenR2 supported variants + A list of values can be found by executing the openr2 command r2test -l + some valid values are: + mx (Mexico) + ar (Argentina) + br (Brazil) + ph (Philippines) + itu (per ITU spec) + --> + <param name="variant" value="mx"/> + + <!-- switch parameters (required), where to send calls to --> + <param name="dialplan" value="XML"/> + <param name="context" value="default"/> + + <!-- + Max amount of ANI (caller id digits) to ask for + <param name="max_ani" value="4"/> + --> + <!-- + Max amount of DNIS to ask for + <param name="max_dnis" value="4"/> + --> + + <!-- Do not set parameters below this line unless you desire to tweak it because is not working --> + + <!-- + Whether or not to get the ANI before getting DNIS (only affects incoming calls) + Some telcos require ANI first some others do not care, if default go wrong on + incoming calls, change this value + <param name="get_ani_first" value="yes"/> + --> + + <!-- + Caller Category to send. Accepted values: + - national_subscriber + - national_priority_subscriber + - international_subscriber + - international_priority_subscriber + - collect_call + Usually national_subscriber (the default) works just fine + <param name="category" value="national_subscriber"/> + --> + + <!-- + Brazil uses a special calling party category for collect calls (llamadas por cobrar) + instead of using the operator (as in Mexico). The R2 spec in Brazil says a special GB tone + should be used to reject collect calls. If you want to ALLOW collect calls specify 'yes', + if you want to BLOCK collect calls then say 'no'. Default is to block collect calls. + (see also 'double_answer') + <param name="allow_collect_calls" value="yes"/> + --> + + <!-- + This feature is related but independent of allow_collect_calls + Some PBX's require a double-answer process to block collect calls, if + you ever have problems blocking collect calls using Group B signals (allow_collect_calls=no) + then you may want to try with double_answer=yes, this will cause that every answer signal + is changed to perform 'answer -> clear back -> answer' (sort of a flash) + (see also 'allow_collect_calls') + <param name="double_answer" value="yes"/> + --> + + <!-- + This feature allows to skip the use of Group B/II signals and go directly + to the accepted state for incoming calls + <param name="immediate_accept" value="yes"/> + --> + + <!-- + Skip request of calling party category and ANI + <param name="skip_category" value="yes"/> + --> + + <!-- + Brazil use a special signal to force the release of the line (hangup) from the + backward perspective. When forced_release=no, the normal clear back signal + will be sent on hangup, which is OK for all mfcr2 variants I know of, except for + Brazilian variant, where the central will leave the line up for several seconds (30, 60) + which sometimes is not what people really want. When forced_release=yes, a different + signal will be sent to hangup the call indicating that the line should be released immediately + <param name="forced_release" value="yes"/> + --> + + <!-- + Whether or not report to the other end 'accept call with charge' + This setting has no effect with most telecos, usually is safe + leave the default (yes), but once in a while when interconnecting with + old PBXs this may be useful. + Concretely this affects the Group B signal used to accept calls + <param name="charge_calls" value="yes"/> + --> + + <!-- + MFC/R2 value in milliseconds for the MF timeout. Any negative value + means 'default', smaller values than 500ms are not recommended + and can cause malfunctioning. If you experience protocol error + due to MF timeout try incrementing this value in 500ms steps + <param name="mfback_timeout" value="1500"/> + --> + + <!-- + MFC/R2 value in milliseconds for the metering pulse timeout. + Metering pulses are sent by some telcos for some R2 variants + during a call presumably for billing purposes to indicate costs, + however this pulses use the same signal that is used to indicate + call hangup, therefore a timeout is sometimes required to distinguish + between a *real* hangup and a billing pulse that should not + last more than 500ms, If you experience call drops after some + minutes of being stablished try setting a value of some ms here, + values greater than 500ms are not recommended. + BE AWARE that choosing the proper protocol variant parameter + implicitly sets a good recommended value for this timer, use this + parameter only when you *really* want to override the default, otherwise + just comment out this value. + <param name="metering_pulse_timeout" value="1000"/> + --> + + <!-- + WARNING: advanced users only! I really mean it + this parameter is commented by default because + YOU DON'T NEED IT UNLESS YOU REALLY GROK MFC/R2 + READ COMMENTS on doc/r2proto.conf in openr2 package + for more info + <param name="advanced_protocol_file" value="/usr/local/freeswitch/conf/r2proto.conf"/> + --> + + <!-- USE THIS FOR DEBUGGING MFC-R2 PROTOCOL --> + <!-- + Where to dump advanced call file protocol logs + <param name="logdir" value="$${base_dir}/log/mfcr2"/> + --> + + <!-- + MFC/R2 valid logging values are: all,error,warning,debug,notice,cas,mf,nothing + error,warning,debug and notice are self-descriptive + 'cas' is for logging ABCD CAS tx and rx + 'mf' is for logging of the Multi Frequency tones + You can mix up values, like: loglevel=error,debug,mf to log just error, debug and + multi frequency messages + 'all' is a special value to log all the activity + 'nothing' is a clean-up value, in case you want to not log any activity for + a channel or group of channels + BE AWARE that the level of output logged will ALSO depend on + the value you have in FreeSWITCH logging configurations, if you disable output FreeSWITCH + then it does not matter if you specify 'all' here, nothing will be logged + so FreeSWITCH has the last word on what is going to be logged + <param name="logging" value="debug,notice,warning,error,mf,cas"/> + --> + + <!-- + whether or not to drop protocol call files into 'logdir' + <param name="call_files" value="yes"/> + --> + + <!-- + Use only for very technical debugging + This is the size (if 0, dumps are disabled) of MF dump files. MF dump files + are audio files that are dumped when a protocol error occurs. + The files are dumped in whatever you set in the logdir parameter. + Value -1 uses a default recommended size (which stores 5 seconds of audio) + <param name="mf_dump_size" value="-1"/> + --> + </span> + </r2_spans> </configuration> + diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index c43d694..d2ad249 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -91,6 +91,10 @@ static void write_chan_io_dump(ftdm_channel_t *fchan, ftdm_io_dump_t *dump, char int windex = dump->windex; int avail = dump->size - windex; + if (!dump->buffer) { + return; + } + if (dlen > avail) { int diff = dlen - avail; @@ -101,7 +105,7 @@ static void write_chan_io_dump(ftdm_channel_t *fchan, ftdm_io_dump_t *dump, char memcpy(&dump->buffer[0], &dataptr[avail], diff); windex = diff; - ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "wrapping around dump buffer %p up to index %d\n\n", dump, windex); + /*ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "wrapping around dump buffer %p up to index %d\n\n", dump, windex);*/ dump->wrapped = 1; } else { memcpy(&dump->buffer[windex], dataptr, dlen); @@ -109,7 +113,7 @@ static void write_chan_io_dump(ftdm_channel_t *fchan, ftdm_io_dump_t *dump, char } if (windex == dump->size) { - ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "wrapping around dump buffer %p\n", dump); + /*ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "wrapping around dump buffer %p\n", dump);*/ windex = 0; dump->wrapped = 1; } @@ -2525,7 +2529,6 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_done(ftdm_channel_t *ftdmchan) ftdm_buffer_destroy(&ftdmchan->pre_buffer); ftdmchan->pre_buffer_size = 0; ftdm_mutex_unlock(ftdmchan->pre_buffer_mutex); - disable_dtmf_debug(ftdmchan); ftdm_channel_clear_vars(ftdmchan); if (ftdmchan->hangup_timer) { ftdm_sched_cancel_timer(globals.timingsched, ftdmchan->hangup_timer); @@ -2534,8 +2537,9 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_done(ftdm_channel_t *ftdmchan) ftdmchan->init_state = FTDM_CHANNEL_STATE_DOWN; ftdmchan->state = FTDM_CHANNEL_STATE_DOWN; - stop_chan_io_dump(&ftdmchan->txdump); - stop_chan_io_dump(&ftdmchan->rxdump); + ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_INPUT_DUMP, NULL); + ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_OUTPUT_DUMP, NULL); + ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_DEBUG_DTMF, NULL); if (FTDM_IS_VOICE_CHANNEL(ftdmchan)) { ftdm_sigmsg_t sigmsg; @@ -2741,6 +2745,10 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co case FTDM_COMMAND_ENABLE_INPUT_DUMP: { ftdm_size_t size = obj ? FTDM_COMMAND_OBJ_SIZE : FTDM_IO_DUMP_DEFAULT_BUFF_SIZE; + if (ftdmchan->rxdump.buffer) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Input dump is already enabled\n"); + GOTO_STATUS(done, FTDM_FAIL); + } if (start_chan_io_dump(ftdmchan, &ftdmchan->rxdump, size)) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to enable input dump\n"); GOTO_STATUS(done, FTDM_FAIL); @@ -2753,6 +2761,10 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co /*!< Stop dumping all input to a circular buffer. */ case FTDM_COMMAND_DISABLE_INPUT_DUMP: { + if (!ftdmchan->rxdump.buffer) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No need to disable input dump\n"); + GOTO_STATUS(done, FTDM_SUCCESS); + } ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Disabled input dump of size %zd\n", ftdmchan->rxdump.size); stop_chan_io_dump(&ftdmchan->rxdump); GOTO_STATUS(done, FTDM_SUCCESS); @@ -2763,6 +2775,10 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co case FTDM_COMMAND_ENABLE_OUTPUT_DUMP: { ftdm_size_t size = obj ? FTDM_COMMAND_OBJ_SIZE : FTDM_IO_DUMP_DEFAULT_BUFF_SIZE; + if (ftdmchan->txdump.buffer) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Output dump is already enabled\n"); + GOTO_STATUS(done, FTDM_FAIL); + } if (start_chan_io_dump(ftdmchan, &ftdmchan->txdump, size)) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to enable output dump\n"); GOTO_STATUS(done, FTDM_FAIL); @@ -2775,6 +2791,10 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co /*!< Stop dumping all output to a circular buffer. */ case FTDM_COMMAND_DISABLE_OUTPUT_DUMP: { + if (!ftdmchan->txdump.buffer) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No need to disable output dump\n"); + GOTO_STATUS(done, FTDM_SUCCESS); + } ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Disabled output dump of size %zd\n", ftdmchan->rxdump.size); stop_chan_io_dump(&ftdmchan->txdump); GOTO_STATUS(done, FTDM_SUCCESS); @@ -3349,12 +3369,13 @@ skipdebug: static FIO_WRITE_FUNCTION(ftdm_raw_write) { + int dlen = (int) *datalen; if (ftdmchan->fds[FTDM_WRITE_TRACE_INDEX] > -1) { - int dlen = (int) *datalen; if ((write(ftdmchan->fds[FTDM_WRITE_TRACE_INDEX], data, dlen)) != dlen) { ftdm_log(FTDM_LOG_WARNING, "Raw output trace failed to write all of the %zd bytes\n", dlen); } } + write_chan_io_dump(ftdmchan, &ftdmchan->txdump, data, dlen); return ftdmchan->fio->write(ftdmchan, data, datalen); } diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 5a36f05..9ece036 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -68,6 +68,7 @@ typedef struct ftdm_r2_call_t { ftdm_channel_state_t chanstate; ftdm_size_t dnis_index; ftdm_size_t ani_index; + char logname[255]; char name[10]; unsigned long txdrops; } ftdm_r2_call_t; @@ -88,13 +89,13 @@ typedef struct ft_r2_conf_s { int32_t max_dnis; int32_t mfback_timeout; int32_t metering_pulse_timeout; + int32_t mf_dump_size; /* booleans */ int immediate_accept; int skip_category; int get_ani_first; int call_files; - int mf_files; int double_answer; int charge_calls; int forced_release; @@ -117,6 +118,8 @@ typedef struct ftdm_r2_data_s { int forced_release:1; /* whether accept the call when offered, or wait until the user decides to accept */ int accept_on_offer:1; + /* Size of multi-frequency (or any media) dumps used during protocol errors */ + int32_t mf_dump_size; /* max time spent in ms doing real work in a single loop */ int32_t jobmax; /* Total number of loops performed so far */ @@ -125,6 +128,8 @@ typedef struct ftdm_r2_data_s { uint64_t loops[11]; /* LWP */ uint32_t monitor_thread_id; + /* Logging directory */ + char logdir[512]; } ftdm_r2_data_t; /* one element per span will be stored in g_mod_data_hash global var to keep track of them @@ -409,10 +414,11 @@ static FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(ftdm_r2_get_channel_sig_status) } /* always called from the monitor thread */ -static void ftdm_r2_on_call_init(openr2_chan_t *r2chan) +static void ftdm_r2_on_call_init(openr2_chan_t *r2chan, const char *logname) { ftdm_r2_call_t *r2call; ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); + ftdm_r2_data_t *r2data = ftdmchan->span->signal_data; ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "Received request to start call\n"); @@ -441,12 +447,16 @@ static void ftdm_r2_on_call_init(openr2_chan_t *r2chan) ft_r2_clean_call(ftdmchan->call_data); r2call = R2CALL(ftdmchan); - if (ftdmchan->state == FTDM_CHANNEL_STATE_DOWN) { - R2CALL(ftdmchan)->chanstate = FTDM_CHANNEL_STATE_DOWN; - } else { - R2CALL(ftdmchan)->chanstate = FTDM_CHANNEL_STATE_DIALING; + snprintf(r2call->logname, sizeof(r2call->logname), "%s", logname); + ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Set logname for call to %s\n", r2call->logname); + + /* start io dump */ + if (r2data->mf_dump_size) { + ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_INPUT_DUMP, &r2data->mf_dump_size); + ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_OUTPUT_DUMP, &r2data->mf_dump_size); } + R2CALL(ftdmchan)->chanstate = FTDM_CHANNEL_STATE_DOWN; ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); } @@ -484,6 +494,32 @@ static void clear_accept_pending(ftdm_channel_t *fchan) } } +static void dump_mf(openr2_chan_t *r2chan) +{ + char dfile[512]; + FILE *f = NULL; + ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); + ftdm_r2_data_t *r2data = ftdmchan->span->signal_data; + if (r2data->mf_dump_size) { + char *logname = R2CALL(ftdmchan)->logname; + + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Dumping IO output in prefix %s\n", logname); + snprintf(dfile, sizeof(dfile), logname ? "%s.s%dc%d.input.alaw" : "%s/s%dc%d.input.alaw", + logname ? logname : r2data->logdir, ftdmchan->span_id, ftdmchan->chan_id); + f = fopen(dfile, "w"); + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Dumping IO input in file %s\n", dfile); + ftdm_channel_command(ftdmchan, FTDM_COMMAND_DUMP_INPUT, f); + fclose(f); + + snprintf(dfile, sizeof(dfile), logname ? "%s.s%dc%d.output.alaw" : "%s/s%dc%d.output.alaw", + logname ? logname : r2data->logdir, ftdmchan->span_id, ftdmchan->chan_id); + f = fopen(dfile, "w"); + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Dumping IO output in file %s\n", dfile); + ftdm_channel_command(ftdmchan, FTDM_COMMAND_DUMP_OUTPUT, f); + fclose(f); + } +} + static void ftdm_r2_on_call_accepted(openr2_chan_t *r2chan, openr2_call_mode_t mode) { ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); @@ -493,6 +529,7 @@ static void ftdm_r2_on_call_accepted(openr2_chan_t *r2chan, openr2_call_mode_t m /* at this point the MF signaling has ended and there is no point on keep reading */ openr2_chan_disable_read(r2chan); + R2CALL(ftdmchan)->accepted = 1; if (OR2_DIR_BACKWARD == openr2_chan_get_direction(r2chan)) { @@ -579,7 +616,7 @@ static void ftdm_r2_on_protocol_error(openr2_chan_t *r2chan, openr2_protocol_err return; } - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Protocol error\n"); + dump_mf(r2chan); clear_accept_pending(ftdmchan); @@ -1042,24 +1079,28 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) /* .variant */ OR2_VAR_ITU, /* .category */ OR2_CALLING_PARTY_CATEGORY_NATIONAL_SUBSCRIBER, /* .loglevel */ OR2_LOG_ERROR | OR2_LOG_WARNING, - /* .logdir */ (char *)"/usr/local/freeswitch/log/", /* FIXME: get PREFIX variable */ +#ifdef WIN32 + /* .logdir */ (char *)"c:\\", +#else + /* .logdir */ (char *)"/tmp", +#endif /* .advanced_protocol_file */ NULL, /* .max_ani */ 10, /* .max_dnis */ 4, /* .mfback_timeout */ -1, /* .metering_pulse_timeout */ -1, + /* .mf_dump_size */ 0, /* .immediate_accept */ -1, /* .skip_category */ -1, /* .get_ani_first */ -1, /* .call_files */ 0, - /* .mf_files */ 0, /* .double_answer */ -1, /* .charge_calls */ -1, /* .forced_release */ -1, /* .allow_collect_calls */ -1 }; - assert(sig_cb != NULL); + ftdm_assert_return(sig_cb != NULL, FTDM_FAIL, "No signaling cb provided\n"); if (span->signal_type) { snprintf(span->last_error, sizeof(span->last_error), "Span is already configured for signalling."); @@ -1119,6 +1160,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) continue; } log_level = val; + ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with loglevel %s\n", span->name, val); } else if (!strcasecmp(var, "advanced_protocol_file")) { if (!val) { break; @@ -1128,46 +1170,51 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) continue; } r2conf.advanced_protocol_file = (char *)val; - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with advanced protocol file %s\n", span->span_id, val); + ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with advanced protocol file %s\n", span->name, val); + } else if (!strcasecmp(var, "mf_dump_size")) { + r2conf.mf_dump_size = atoi(val); + if (r2conf.mf_dump_size < 0) { + r2conf.mf_dump_size = FTDM_IO_DUMP_DEFAULT_BUFF_SIZE; + ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with default mf_dumps = %d bytes\n", span->name, r2conf.mf_dump_size); + } else { + ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with mf_dump_size = %d bytes\n", span->name, r2conf.mf_dump_size); + } } else if (!strcasecmp(var, "allow_collect_calls")) { r2conf.allow_collect_calls = ftdm_true(val); - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with allow collect calls max ani = %d\n", span->span_id, r2conf.allow_collect_calls); + ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with allow collect calls max ani = %d\n", span->name, r2conf.allow_collect_calls); } else if (!strcasecmp(var, "double_answer")) { r2conf.double_answer = ftdm_true(val); - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with double answer = %d\n", span->span_id, r2conf.double_answer); + ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with double answer = %d\n", span->name, r2conf.double_answer); } else if (!strcasecmp(var, "immediate_accept")) { r2conf.immediate_accept = ftdm_true(val); - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with immediate accept = %d\n", span->span_id, r2conf.immediate_accept); + ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with immediate accept = %d\n", span->name, r2conf.immediate_accept); } else if (!strcasecmp(var, "skip_category")) { r2conf.skip_category = ftdm_true(val); - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with skip category = %d\n", span->span_id, r2conf.skip_category); + ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with skip category = %d\n", span->name, r2conf.skip_category); } else if (!strcasecmp(var, "forced_release")) { r2conf.forced_release = ftdm_true(val); - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with forced release = %d\n", span->span_id, r2conf.forced_release); + ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with forced release = %d\n", span->name, r2conf.forced_release); } else if (!strcasecmp(var, "charge_calls")) { r2conf.charge_calls = ftdm_true(val); - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with charge calls = %d\n", span->span_id, r2conf.charge_calls); + ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with charge calls = %d\n", span->name, r2conf.charge_calls); } else if (!strcasecmp(var, "get_ani_first")) { r2conf.get_ani_first = ftdm_true(val); - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with get ani first = %d\n", span->span_id, r2conf.get_ani_first); + ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with get ani first = %d\n", span->name, r2conf.get_ani_first); } else if (!strcasecmp(var, "call_files")) { r2conf.call_files = ftdm_true(val); - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with call files = %d\n", span->span_id, r2conf.call_files); - } else if (!strcasecmp(var, "mf_files")) { - r2conf.mf_files = ftdm_true(val); - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with mf files = %d\n", span->span_id, r2conf.mf_files); + ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with call files = %d\n", span->name, r2conf.call_files); } else if (!strcasecmp(var, "mfback_timeout")) { r2conf.mfback_timeout = atoi(val); - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with MF backward timeout = %dms\n", span->span_id, r2conf.mfback_timeout); + ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with MF backward timeout = %dms\n", span->name, r2conf.mfback_timeout); } else if (!strcasecmp(var, "metering_pulse_timeout")) { r2conf.metering_pulse_timeout = atoi(val); - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with metering pulse timeout = %dms\n", span->span_id, r2conf.metering_pulse_timeout); + ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with metering pulse timeout = %dms\n", span->name, r2conf.metering_pulse_timeout); } else if (!strcasecmp(var, "max_ani")) { r2conf.max_ani = atoi(val); - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with max ani = %d\n", span->span_id, r2conf.max_ani); + ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with max ani = %d\n", span->name, r2conf.max_ani); } else if (!strcasecmp(var, "max_dnis")) { r2conf.max_dnis = atoi(val); - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with max dnis = %d\n", span->span_id, r2conf.max_dnis); + ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %s with max dnis = %d\n", span->name, r2conf.max_dnis); } else { snprintf(span->last_error, sizeof(span->last_error), "Unknown R2 parameter [%s]", var); return FTDM_FAIL; @@ -1211,10 +1258,10 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) openr2_context_set_double_answer(r2data->r2context, r2conf.double_answer); openr2_context_set_immediate_accept(r2data->r2context, r2conf.immediate_accept); - if (r2conf.logdir && r2conf.logdir[0]) { - ftdm_log(FTDM_LOG_DEBUG, "Setting openr2 for span %s logdir to %s\n", span->name, r2conf.logdir); - openr2_context_set_log_directory(r2data->r2context, r2conf.logdir); - } + ftdm_log(FTDM_LOG_DEBUG, "Setting span %s logdir to %s\n", span->name, r2conf.logdir); + openr2_context_set_log_directory(r2data->r2context, r2conf.logdir); + snprintf(r2data->logdir, sizeof(r2data->logdir), "%s", r2conf.logdir); + if (r2conf.advanced_protocol_file) { openr2_context_configure_from_advanced_file(r2data->r2context, r2conf.advanced_protocol_file); } @@ -1252,6 +1299,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) hashtable_insert(spanpvt->r2calls, (void *)r2call->name, r2call, HASHTABLE_FLAG_FREE_VALUE); } + r2data->mf_dump_size = r2conf.mf_dump_size; r2data->flags = 0; spanpvt->r2context = r2data->r2context; commit f41ff727909317e2e3d4c11c5bccd8129d455ab6 Author: David Yat Sin <dyatsin@sangoma.com> Date: Fri Dec 3 14:42:37 2010 -0500 Fixed compilation issues diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index b80d5b5..9172dab 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -65,33 +65,6 @@ /* TODO: rename all *_cc_* to *_an_* */ -#define SNGISDN_ENUM_NAMES(_NAME, _STRINGS) static const char * _NAME [] = { _STRINGS , NULL }; -#define SNGISDN_STR2ENUM_P(_FUNC1, _FUNC2, _TYPE) _TYPE _FUNC1 (const char *name); const char * _FUNC2 (_TYPE type); -#define SNGISDN_STR2ENUM(_FUNC1, _FUNC2, _TYPE, _STRINGS, _MAX) \ - _TYPE _FUNC1 (const char *name) \ -{ \ - int i; \ - _TYPE t = _MAX ; \ - \ - for (i = 0; i < _MAX ; i++) { \ - if (!strcasecmp(name, _STRINGS[i])) { \ - t = (_TYPE) i; \ - break; \ -} \ -} \ - \ - return t; \ -} \ - const char * _FUNC2 (_TYPE type) \ -{ \ - if (type > _MAX) { \ - type = _MAX; \ -} \ - return _STRINGS[(int)type]; \ -} \ - - - typedef enum { FLAG_RESET_RX = (1 << 0), FLAG_RESET_TX = (1 << 1), @@ -164,46 +137,6 @@ typedef enum { SNGISDN_EVENT_RST_IND, } ftdm_sngisdn_event_id_t; -typedef enum { - /* Call is not end-to-end ISDN */ - SNGISDN_PROGIND_DESCR_NETE_ISDN, - /* Destination address is non-ISDN */ - SNGISDN_PROGIND_DESCR_DEST_NISDN, - /* Origination address is non-ISDN */ - SNGISDN_PROGIND_DESCR_ORIG_NISDN, - /* Call has returned to the ISDN */ - SNGISDN_PROGIND_DESCR_RET_ISDN, - /* Interworking as occured and has resulted in a telecommunication service change */ - SNGISDN_PROGIND_DESCR_SERV_CHANGE, - /* In-band information or an appropriate pattern is now available */ - SNGISDN_PROGIND_DESCR_IB_AVAIL, - /* Invalid */ - SNGISDN_PROGIND_DESCR_INVALID, -} ftdm_sngisdn_progind_descr_t; -#define SNGISDN_PROGIND_DESCR_STRINGS "not-end-to-end-isdn", "destination-is-non-isdn", "origination-is-non-isdn", "call-returned-to-isdn", "service-change", "inband-info-available", "invalid" -SNGISDN_STR2ENUM_P(ftdm_str2ftdm_sngisdn_progind_descr, ftdm_sngisdn_progind_descr2str, ftdm_sngisdn_progind_descr_t); - -typedef enum { - /* User */ - SNGISDN_PROGIND_LOC_USER, - /* Private network serving the local user */ - SNGISDN_PROGIND_LOC_PRIV_NET_LOCAL_USR, - /* Public network serving the local user */ - SNGISDN_PROGIND_LOC_PUB_NET_LOCAL_USR, - /* Transit network */ - SNGISDN_PROGIND_LOC_TRANSIT_NET, - /* Public network serving remote user */ - SNGISDN_PROGIND_LOC_PUB_NET_REMOTE_USR, - /* Private network serving remote user */ - SNGISDN_PROGIND_LOC_PRIV_NET_REMOTE_USR, - /* Network beyond the interworking point */ - SNGISDN_PROGIND_LOC_NET_BEYOND_INTRW, - /* Invalid */ - SNGISDN_PROGIND_LOC_INVALID, -} ftdm_sngisdn_progind_loc_t; -#define SNGISDN_PROGIND_LOC_STRINGS "user", "private-net-local-user", "public-net-local-user", "transit-network", "public-net-remote-user", "private-net-remote-user", "beyond-interworking", "invalid" -SNGISDN_STR2ENUM_P(ftdm_str2ftdm_sngisdn_progind_loc, ftdm_sngisdn_progind_loc2str, ftdm_sngisdn_progind_loc_t); - typedef struct ftdm_sngisdn_prog_ind { ftdm_sngisdn_progind_loc_t loc; /* location */ ftdm_sngisdn_progind_descr_t descr; /* description */ diff --git a/libs/freetdm/src/testsangomaboost.c b/libs/freetdm/src/testsangomaboost.c index 85b5332..84ff287 100644 --- a/libs/freetdm/src/testsangomaboost.c +++ b/libs/freetdm/src/testsangomaboost.c @@ -49,7 +49,9 @@ #include <string.h> #include <errno.h> #ifdef __linux__ +#ifndef __USE_BSD #define __USE_BSD +#endif #include <unistd.h> #endif #include "freetdm.h" commit a9af077eb5e9ff40dec23b9046829332dc73dbde Author: David Yat Sin <dyatsin@sangoma.com> Date: Fri Dec 3 14:22:01 2010 -0500 freetdm: ISDN - Added support to push raw facility IE from CONNECT messages diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index a7c111e..0e68e2a 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -131,11 +131,13 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) get_called_num(ftdmchan, &conEvnt->cdPtyNmb); get_redir_num(ftdmchan, &conEvnt->redirNmb); get_calling_subaddr(ftdmchan, &conEvnt->cgPtySad); + get_prog_ind_ie(ftdmchan, &conEvnt->progInd); + get_facility_ie(ftdmchan, &conEvnt->facilityStr); if (get_calling_name_from_display(ftdmchan, &conEvnt->display) != FTDM_SUCCESS) { get_calling_name_from_usr_usr(ftdmchan, &conEvnt->usrUsr); } - get_prog_ind_ie(ftdmchan, &conEvnt->progInd); + ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Incoming call: Called No:[%s] Calling No:[%s]\n", ftdmchan->caller_data.dnis.digits, ftdmchan->caller_data.cid_num.digits); @@ -151,40 +153,34 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) } } - if (conEvnt->facilityStr.eh.pres) { - if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - get_facility_ie(ftdmchan, &conEvnt->facilityStr); - } else if (signal_data->facility == SNGISDN_OPT_TRUE) { - if (signal_data->switchtype == SNGISDN_SWITCH_NI2) { - /* Verify whether the Caller Name will come in a subsequent FACILITY message */ - uint16_t ret_val; - char retrieved_str[255]; - - ret_val = sng_isdn_retrieve_facility_caller_name(conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len, retrieved_str); - /* - return values for "sng_isdn_retrieve_facility_information_following": - If there will be no information following, or fails to decode IE, returns -1 - If there will be no information following, but current FACILITY IE contains a caller name, returns 0 - If there will be information following, returns 1 - */ - - if (ret_val == 1) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Expecting Caller name in FACILITY\n"); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_GET_CALLERID); - /* Launch timer in case we never get a FACILITY msg */ - if (signal_data->facility_timeout) { - ftdm_sched_timer(signal_data->sched, "facility_timeout", signal_data->facility_timeout, - sngisdn_facility_timeout, (void*) sngisdn_info, &sngisdn_info->timers[SNGISDN_TIMER_FACILITY]); - } - break; - } else if (ret_val == 0) { - strcpy(ftdmchan->caller_data.cid_name, retrieved_str); - } - break; + /* this should be in get_facility_ie function, fix this later */ + if (signal_data->facility == SNGISDN_OPT_TRUE && conEvnt->facilityStr.eh.pres) { + /* Verify whether the Caller Name will come in a subsequent FACILITY message */ + uint16_t ret_val; + char retrieved_str[255]; + + ret_val = sng_isdn_retrieve_facility_caller_name(conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len, retrieved_str); + /* + return values for "sng_isdn_retrieve_facility_information_following": + If there will be no information following, or fails to decode IE, returns -1 + If there will be no information following, but current FACILITY IE contains a caller name, returns 0 + If there will be information following, returns 1 + */ + + if (ret_val == 1) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Expecting Caller name in FACILITY\n"); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_GET_CALLERID); + /* Launch timer in case we never get a FACILITY msg */ + if (signal_data->facility_timeout) { + ftdm_sched_timer(signal_data->sched, "facility_timeout", signal_data->facility_timeout, + sngisdn_facility_timeout, (void*) sngisdn_info, &sngisdn_info->timers[SNGISDN_TIMER_FACILITY]); } + break; + } else if (ret_val == 0) { + strcpy(ftdmchan->caller_data.cid_name, retrieved_str); } } - + if (signal_data->overlap_dial == SNGISDN_OPT_TRUE && !conEvnt->sndCmplt.eh.pres) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); } else { @@ -284,6 +280,7 @@ void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event) case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: case FTDM_CHANNEL_STATE_DIALING: get_prog_ind_ie(ftdmchan, &cnStEvnt->progInd); + get_facility_ie(ftdmchan, &cnStEvnt->facilityStr); ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_UP); break; case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: @@ -351,6 +348,7 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) case MI_PROGRESS: case MI_ALERTING: get_prog_ind_ie(ftdmchan, &cnStEvnt->progInd); + get_facility_ie(ftdmchan, &cnStEvnt->facilityStr); if (signal_data->ignore_cause_value != SNGISDN_OPT_TRUE && cnStEvnt->causeDgn[0].eh.pres && cnStEvnt->causeDgn[0].causeVal.pres) { @@ -460,7 +458,6 @@ void sngisdn_process_disc_ind (sngisdn_event_data_t *sngisdn_event) uint32_t spInstId = sngisdn_event->spInstId; sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; DiscEvnt *discEvnt = &sngisdn_event->event.discEvnt; @@ -475,14 +472,9 @@ void sngisdn_process_disc_ind (sngisdn_event_data_t *sngisdn_event) case FTDM_CHANNEL_STATE_PROCEED: case FTDM_CHANNEL_STATE_PROGRESS: case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - case FTDM_CHANNEL_STATE_UP: - if (discEvnt->facilityStr.eh.pres) { - if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - get_facility_ie(ftdmchan, &discEvnt->facilityStr); - } else { - /* Call libsng_isdn facility decode function and copy variables here */ - } - } + case FTDM_CHANNEL_STATE_UP: + get_facility_ie(ftdmchan, &discEvnt->facilityStr); + if (discEvnt->causeDgn[0].eh.pres && discEvnt->causeDgn[0].causeVal.pres) { ftdmchan->caller_data.hangup_cause = discEvnt->causeDgn[0].causeVal.val; } else { @@ -526,7 +518,6 @@ void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event) uint32_t spInstId = sngisdn_event->spInstId; sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; RelEvnt *relEvnt = &sngisdn_event->event.relEvnt; @@ -573,13 +564,7 @@ void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event) if (((sngisdn_chan_data_t*)ftdmchan->call_data)->suInstId == suInstId || ((sngisdn_chan_data_t*)ftdmchan->call_data)->spInstId == spInstId) { - if (relEvnt->facilityStr.eh.pres) { - if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - get_facility_ie(ftdmchan, &relEvnt->facilityStr); - } else { - /* Call libsng_isdn facility decode function and copy variables here */ - } - } + get_facility_ie(ftdmchan, &relEvnt->facilityStr); if (relEvnt->causeDgn[0].eh.pres && relEvnt->causeDgn[0].causeVal.pres) { ftdmchan->caller_data.hangup_cause = relEvnt->causeDgn[0].causeVal.val; @@ -790,11 +775,7 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event) { ftdm_sigmsg_t sigev; if (facEvnt->facElmt.facStr.pres) { - if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - get_facility_ie_str(ftdmchan, &facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len); - } else { - /* Call libsng_isdn facility decode function and copy variables here */ - } + get_facility_ie_str(ftdmchan, &facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len); } memset(&sigev, 0, sizeof(sigev)); sigev.chan_id = ftdmchan->chan_id; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 08b14a0..1a7814a 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -310,6 +310,7 @@ void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan) cnStEvnt.chanId.chanNmbSlotMap.val[0] = ftdmchan->physical_chan_id; } + set_facility_ie(ftdmchan, &cnStEvnt.facilityStr); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending PROCEED (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); @@ -341,6 +342,7 @@ void sngisdn_snd_progress(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ memset(&cnStEvnt, 0, sizeof(cnStEvnt)); set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); + set_facility_ie(ftdmchan, &cnStEvnt.facilityStr); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending PROGRESS (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); if(sng_isdn_con_status(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId,&cnStEvnt, MI_PROGRESS, signal_data->dchan_id, sngisdn_info->ces)) { @@ -366,6 +368,7 @@ void sngisdn_snd_alert(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind memset(&cnStEvnt, 0, sizeof(cnStEvnt)); set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); + set_facility_ie(ftdmchan, &cnStEvnt.facilityStr); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending ALERT (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); @@ -424,6 +427,7 @@ void sngisdn_snd_connect(ftdm_channel_t *ftdmchan) } set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); + set_facility_ie(ftdmchan, &cnStEvnt.facilityStr); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending CONNECT (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); if (sng_isdn_con_response(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &cnStEvnt, signal_data->dchan_id, sngisdn_info->ces)) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 42bcd1e..6fd99ad 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -283,7 +283,7 @@ ftdm_status_t get_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad) } ftdm_status_t get_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr) -{ +{ if (!facilityStr->eh.pres) { return FTDM_FAIL; } @@ -294,18 +294,25 @@ ftdm_status_t get_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr ftdm_status_t get_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, ftdm_size_t data_len) { ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; - if (data_len > sizeof(caller_data->raw_data)-2) { - ftdm_log(FTDM_LOG_CRIT, "Length of Facility IE exceeds maximum length\n"); - return FTDM_FAIL; - } + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + + if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { + if (data_len > sizeof(caller_data->raw_data)-2) { + ftdm_log(FTDM_LOG_CRIT, "Length of Facility IE exceeds maximum length\n"); + return FTDM_FAIL; + } - memset(caller_data->raw_data, 0, sizeof(caller_data->raw_data)); - /* Always include Facility IE identifier + len so this can be used as a sanity check by the user */ - caller_data->raw_data[0] = SNGISDN_Q931_FACILITY_IE_ID; - caller_data->raw_data[1] = data_len; + memset(caller_data->raw_data, 0, sizeof(caller_data->raw_data)); + /* Always include Facility IE identifier + len so this can be used as a sanity check by the user */ + caller_data->raw_data[0] = SNGISDN_Q931_FACILITY_IE_ID; + caller_data->raw_data[1] = data_len; - memcpy(&caller_data->raw_data[2], data, data_len); - caller_data->raw_data_len = data_len+2; + memcpy(&caller_data->raw_data[2], data, data_len); + caller_data->raw_data_len = data_len+2; + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Raw Facility IE copied available\n"); + } else { + /* Call libsng_isdn to process facility IE's here */ + } return FTDM_SUCCESS; } diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index 72a5728..c8b8868 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -945,7 +945,10 @@ static FIO_WRITE_FUNCTION(wanpipe_write) if (bsent > 0) { *datalen = bsent; if (ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS)) { - wanpipe_write_stats(ftdmchan, &hdrframe); + /* BRI cards do not support TX queues for now */ + if(!FTDM_SPAN_IS_BRI(ftdmchan->span)) { + wanpipe_write_stats(ftdmchan, &hdrframe); + } } return FTDM_SUCCESS; } commit 8d57adfc61a6a03594893441e5f2e3854331565b Merge: 74f34db e505884 Author: David Yat Sin <dyatsin@sangoma.com> Date: Fri Dec 3 14:30:36 2010 -0500 Merge branch 'master' of git.sangoma.com:smg_freeswitch commit 74f34db2d5f1ea67cf9b6159190ab86b4c6a2e30 Author: David Yat Sin <dyatsin@sangoma.com> Date: Fri Dec 3 14:22:01 2010 -0500 freetdm: ISDN - Added support to push raw facility IE from CONNECT messages diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index d557ca3..b9b4eee 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -131,11 +131,13 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) get_called_num(ftdmchan, &conEvnt->cdPtyNmb); get_redir_num(ftdmchan, &conEvnt->redirNmb); get_calling_subaddr(ftdmchan, &conEvnt->cgPtySad); + get_prog_ind_ie(ftdmchan, &conEvnt->progInd); + get_facility_ie(ftdmchan, &conEvnt->facilityStr); if (get_calling_name_from_display(ftdmchan, &conEvnt->display) != FTDM_SUCCESS) { get_calling_name_from_usr_usr(ftdmchan, &conEvnt->usrUsr); } - get_prog_ind_ie(ftdmchan, &conEvnt->progInd); + ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Incoming call: Called No:[%s] Calling No:[%s]\n", ftdmchan->caller_data.dnis.digits, ftdmchan->caller_data.cid_num.digits); @@ -151,40 +153,34 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) } } - if (conEvnt->facilityStr.eh.pres) { - if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - get_facility_ie(ftdmchan, &conEvnt->facilityStr); - } else if (signal_data->facility == SNGISDN_OPT_TRUE) { - if (signal_data->switchtype == SNGISDN_SWITCH_NI2) { - /* Verify whether the Caller Name will come in a subsequent FACILITY message */ - uint16_t ret_val; - char retrieved_str[255]; - - ret_val = sng_isdn_retrieve_facility_caller_name(conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len, retrieved_str); - /* - return values for "sng_isdn_retrieve_facility_information_following": - If there will be no information following, or fails to decode IE, returns -1 - If there will be no information following, but current FACILITY IE contains a caller name, returns 0 - If there will be information following, returns 1 - */ - - if (ret_val == 1) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Expecting Caller name in FACILITY\n"); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_GET_CALLERID); - /* Launch timer in case we never get a FACILITY msg */ - if (signal_data->facility_timeout) { - ftdm_sched_timer(signal_data->sched, "facility_timeout", signal_data->facility_timeout, - sngisdn_facility_timeout, (void*) sngisdn_info, &sngisdn_info->timers[SNGISDN_TIMER_FACILITY]); - } - break; - } else if (ret_val == 0) { - strcpy(ftdmchan->caller_data.cid_name, retrieved_str); - } - break; + /* this should be in get_facility_ie function, fix this later */ + if (signal_data->facility == SNGISDN_OPT_TRUE && conEvnt->facilityStr.eh.pres) { + /* Verify whether the Caller Name will come in a subsequent FACILITY message */ + uint16_t ret_val; + char retrieved_str[255]; + + ret_val = sng_isdn_retrieve_facility_caller_name(conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len, retrieved_str); + /* + return values for "sng_isdn_retrieve_facility_information_following": + If there will be no information following, or fails to decode IE, returns -1 + If there will be no information following, but current FACILITY IE contains a caller name, returns 0 + If there will be information following, returns 1 + */ + + if (ret_val == 1) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Expecting Caller name in FACILITY\n"); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_GET_CALLERID); + /* Launch timer in case we never get a FACILITY msg */ + if (signal_data->facility_timeout) { + ftdm_sched_timer(signal_data->sched, "facility_timeout", signal_data->facility_timeout, + sngisdn_facility_timeout, (void*) sngisdn_info, &sngisdn_info->timers[SNGISDN_TIMER_FACILITY]); } + break; + } else if (ret_val == 0) { + strcpy(ftdmchan->caller_data.cid_name, retrieved_str); } } - + if (signal_data->overlap_dial == SNGISDN_OPT_TRUE && !conEvnt->sndCmplt.eh.pres) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); } else { @@ -284,6 +280,7 @@ void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event) case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: case FTDM_CHANNEL_STATE_DIALING: get_prog_ind_ie(ftdmchan, &cnStEvnt->progInd); + get_facility_ie(ftdmchan, &cnStEvnt->facilityStr); ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_UP); break; case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: @@ -351,6 +348,7 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) case MI_PROGRESS: case MI_ALERTING: get_prog_ind_ie(ftdmchan, &cnStEvnt->progInd); + get_facility_ie(ftdmchan, &cnStEvnt->facilityStr); if (signal_data->ignore_cause_value != SNGISDN_OPT_TRUE && cnStEvnt->causeDgn[0].eh.pres && cnStEvnt->causeDgn[0].causeVal.pres) { @@ -461,7 +459,6 @@ void sngisdn_process_disc_ind (sngisdn_event_data_t *sngisdn_event) uint32_t spInstId = sngisdn_event->spInstId; sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; DiscEvnt *discEvnt = &sngisdn_event->event.discEvnt; @@ -476,14 +473,9 @@ void sngisdn_process_disc_ind (sngisdn_event_data_t *sngisdn_event) case FTDM_CHANNEL_STATE_PROCEED: case FTDM_CHANNEL_STATE_PROGRESS: case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - case FTDM_CHANNEL_STATE_UP: - if (discEvnt->facilityStr.eh.pres) { - if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - get_facility_ie(ftdmchan, &discEvnt->facilityStr); - } else { - /* Call libsng_isdn facility decode function and copy variables here */ - } - } + case FTDM_CHANNEL_STATE_UP: + get_facility_ie(ftdmchan, &discEvnt->facilityStr); + if (discEvnt->causeDgn[0].eh.pres && discEvnt->causeDgn[0].causeVal.pres) { ftdmchan->caller_data.hangup_cause = discEvnt->causeDgn[0].causeVal.val; } else { @@ -527,7 +519,6 @@ void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event) uint32_t spInstId = sngisdn_event->spInstId; sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; RelEvnt *relEvnt = &sngisdn_event->event.relEvnt; @@ -574,13 +565,7 @@ void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event) if (((sngisdn_chan_data_t*)ftdmchan->call_data)->suInstId == suInstId || ((sngisdn_chan_data_t*)ftdmchan->call_data)->spInstId == spInstId) { - if (relEvnt->facilityStr.eh.pres) { - if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - get_facility_ie(ftdmchan, &relEvnt->facilityStr); - } else { - /* Call libsng_isdn facility decode function and copy variables here */ - } - } + get_facility_ie(ftdmchan, &relEvnt->facilityStr); if (relEvnt->causeDgn[0].eh.pres && relEvnt->causeDgn[0].causeVal.pres) { ftdmchan->caller_data.hangup_cause = relEvnt->causeDgn[0].causeVal.val; @@ -791,11 +776,7 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event) { ftdm_sigmsg_t sigev; if (facEvnt->facElmt.facStr.pres) { - if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - get_facility_ie_str(ftdmchan, &facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len); - } else { - /* Call libsng_isdn facility decode function and copy variables here */ - } + get_facility_ie_str(ftdmchan, &facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len); } memset(&sigev, 0, sizeof(sigev)); sigev.chan_id = ftdmchan->chan_id; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 08b14a0..1a7814a 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -310,6 +310,7 @@ void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan) cnStEvnt.chanId.chanNmbSlotMap.val[0] = ftdmchan->physical_chan_id; } + set_facility_ie(ftdmchan, &cnStEvnt.facilityStr); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending PROCEED (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); @@ -341,6 +342,7 @@ void sngisdn_snd_progress(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ memset(&cnStEvnt, 0, sizeof(cnStEvnt)); set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); + set_facility_ie(ftdmchan, &cnStEvnt.facilityStr); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending PROGRESS (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); if(sng_isdn_con_status(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId,&cnStEvnt, MI_PROGRESS, signal_data->dchan_id, sngisdn_info->ces)) { @@ -366,6 +368,7 @@ void sngisdn_snd_alert(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind memset(&cnStEvnt, 0, sizeof(cnStEvnt)); set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); + set_facility_ie(ftdmchan, &cnStEvnt.facilityStr); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending ALERT (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); @@ -424,6 +427,7 @@ void sngisdn_snd_connect(ftdm_channel_t *ftdmchan) } set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); + set_facility_ie(ftdmchan, &cnStEvnt.facilityStr); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending CONNECT (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); if (sng_isdn_con_response(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &cnStEvnt, signal_data->dchan_id, sngisdn_info->ces)) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 42bcd1e..6fd99ad 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -283,7 +283,7 @@ ftdm_status_t get_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad) } ftdm_status_t get_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr) -{ +{ if (!facilityStr->eh.pres) { return FTDM_FAIL; } @@ -294,18 +294,25 @@ ftdm_status_t get_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr ftdm_status_t get_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, ftdm_size_t data_len) { ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; - if (data_len > sizeof(caller_data->raw_data)-2) { - ftdm_log(FTDM_LOG_CRIT, "Length of Facility IE exceeds maximum length\n"); - return FTDM_FAIL; - } + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + + if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { + if (data_len > sizeof(caller_data->raw_data)-2) { + ftdm_log(FTDM_LOG_CRIT, "Length of Facility IE exceeds maximum length\n"); + return FTDM_FAIL; + } - memset(caller_data->raw_data, 0, sizeof(caller_data->raw_data)); - /* Always include Facility IE identifier + len so this can be used as a sanity check by the user */ - caller_data->raw_data[0] = SNGISDN_Q931_FACILITY_IE_ID; - caller_data->raw_data[1] = data_len; + memset(caller_data->raw_data, 0, sizeof(caller_data->raw_data)); + /* Always include Facility IE identifier + len so this can be used as a sanity check by the user */ + caller_data->raw_data[0] = SNGISDN_Q931_FACILITY_IE_ID; + caller_data->raw_data[1] = data_len; - memcpy(&caller_data->raw_data[2], data, data_len); - caller_data->raw_data_len = data_len+2; + memcpy(&caller_data->raw_data[2], data, data_len); + caller_data->raw_data_len = data_len+2; + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Raw Facility IE copied available\n"); + } else { + /* Call libsng_isdn to process facility IE's here */ + } return FTDM_SUCCESS; } diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index 72a5728..c8b8868 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -945,7 +945,10 @@ static FIO_WRITE_FUNCTION(wanpipe_write) if (bsent > 0) { *datalen = bsent; if (ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS)) { - wanpipe_write_stats(ftdmchan, &hdrframe); + /* BRI cards do not support TX queues for now */ + if(!FTDM_SPAN_IS_BRI(ftdmchan->span)) { + wanpipe_write_stats(ftdmchan, &hdrframe); + } } return FTDM_SUCCESS; } commit b156f4d03f6d3a65a59fe7d6f0217fca2c8fdf60 Author: Moises Silva <moises.silva@gmail.com> Date: Fri Dec 3 14:13:43 2010 -0500 freetdm: do not write to io dump if is not enabled diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index c43d694..495be78 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -91,6 +91,10 @@ static void write_chan_io_dump(ftdm_channel_t *fchan, ftdm_io_dump_t *dump, char int windex = dump->windex; int avail = dump->size - windex; + if (!dump->buffer) { + return; + } + if (dlen > avail) { int diff = dlen - avail; commit 5d7c09ed779cb5ee6c97ba75652d25e28f878fc3 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Dec 3 12:38:49 2010 -0600 fix edge caes for endless loop in sql thread diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 89249e6..fe12047 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -913,7 +913,7 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, uint32_t target = 20000; switch_size_t len = 0, sql_len = runtime.sql_buffer_len; char *tmp, *sqlbuf = (char *) malloc(sql_len); - char *sql = NULL; + char *sql = NULL, *save_sql = NULL; switch_size_t newlen; int lc = 0; uint32_t sanity = 120; @@ -938,11 +938,16 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, switch_mutex_lock(sql_manager.cond_mutex); while (sql_manager.thread_running == 1) { - if (sql || switch_queue_trypop(sql_manager.sql_queue[0], &pop) == SWITCH_STATUS_SUCCESS || + if (save_sql || switch_queue_trypop(sql_manager.sql_queue[0], &pop) == SWITCH_STATUS_SUCCESS || switch_queue_trypop(sql_manager.sql_queue[1], &pop) == SWITCH_STATUS_SUCCESS) { - if (!sql) sql = (char *) pop; - + if (save_sql) { + sql = save_sql; + save_sql = NULL; + } else if ((sql = (char *) pop)) { + pop = NULL; + } + if (sql) { newlen = strlen(sql) + 2; @@ -971,6 +976,8 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SAVE %d %d\n", switch_queue_size(sql_manager.sql_queue[0]), switch_queue_size(sql_manager.sql_queue[1])); #endif + save_sql = sql; + sql = NULL; goto skip; } } @@ -988,7 +995,7 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, skip: - lc = sql ? 1 : 0 + switch_queue_size(sql_manager.sql_queue[0]) + switch_queue_size(sql_manager.sql_queue[1]); + lc = switch_queue_size(sql_manager.sql_queue[0]) + switch_queue_size(sql_manager.sql_queue[1]); if (trans && iterations && (iterations > target || !lc)) { #ifdef DEBUG_SQL commit 1e3a86310f2382664061d9e3b3540f20d93c2599 Merge: 1c636e8 8d57adf Author: Moises Silva <moy@sangoma.com> Date: Fri Dec 3 13:01:26 2010 -0500 Merge branch 'master' into moy.iodump commit 1c636e800389c65b119e40193ac85354ac88194e Merge: 8dd33bc d6d6a9e Author: Moises Silva <moy@sangoma.com> Date: Fri Dec 3 12:59:48 2010 -0500 Merge branch 'master' into moy.iodump commit a024f006de31afcf1b09845597d300f6cf4248ec Author: Georgiewskiy Yuriy <bottleman@icf.org.ru> Date: Fri Dec 3 19:33:29 2010 +0300 Adds an extra switch_rtp_destroy or switch_rtp_release_port when a session ends - to make sure the port is returned to FS. diff --git a/src/mod/endpoints/mod_h323/changes.txt b/src/mod/endpoints/mod_h323/changes.txt index c01542e..4f75aef 100644 --- a/src/mod/endpoints/mod_h323/changes.txt +++ b/src/mod/endpoints/mod_h323/changes.txt @@ -1,3 +1,5 @@ +Adds an extra switch_rtp_destroy or switch_rtp_release_port when a session ends + - to make sure the port is returned to FS. thx to Peter Olsson. fix issues with Progress message type if pre_answer enabled fix crashes on FSH323Connection calls in on_hangup routine in different threads. move PTrace level set to FSH323EndPoint::Initialise diff --git a/src/mod/endpoints/mod_h323/mod_h323.cpp b/src/mod/endpoints/mod_h323/mod_h323.cpp index 6365f9c..74fb6ae 100644 --- a/src/mod/endpoints/mod_h323/mod_h323.cpp +++ b/src/mod/endpoints/mod_h323/mod_h323.cpp @@ -343,7 +343,7 @@ PString GetH245CodecName(const H323Capability* cap) } FSProcess::FSProcess() - : PLibraryProcess("Test", "mod_h323", 1, 0, AlphaCode, 1) + : PLibraryProcess("FreeSWITCH", "mod_h323", 1, 0, AlphaCode, 1) , m_h323endpoint(NULL){ } @@ -742,6 +742,14 @@ FSH323Connection::~FSH323Connection() switch_core_session_unlock_codec_write(m_fsSession); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->switch_core_session_unlock_codec_write [%p]\n",m_fsSession); } + + if (tech_pvt->rtp_session) { + switch_rtp_destroy(&tech_pvt->rtp_session); + tech_pvt->rtp_session = NULL; + } else if (m_RTPlocalPort) { + switch_rtp_release_port((const char *)m_RTPlocalIP.AsString(), m_RTPlocalPort); + } + tech_pvt->me = NULL; // switch_mutex_unlock(tech_pvt->h323_mutex); // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->h323_mutex_unlock\n"); commit c75e5150d11728372b4bbe335109aa0183ba7bf6 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Fri Dec 3 13:59:42 2010 -0200 freetdm: ftmod_r2 - implemented ftdm_r2_get_channel_sig_status() diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 5160005..e9bc24e 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -397,6 +397,17 @@ static ftdm_status_t ftdm_r2_stop(ftdm_span_t *span) return FTDM_SUCCESS; } +static FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(ftdm_r2_get_channel_sig_status) +{ + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) { + *status = FTDM_SIG_STATE_UP; + } else { + *status = FTDM_SIG_STATE_DOWN; + } + + return FTDM_SUCCESS; +} + /* always called from the monitor thread */ static void ftdm_r2_on_call_init(openr2_chan_t *r2chan) { @@ -1250,6 +1261,9 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) span->stop = ftdm_r2_stop; span->sig_read = NULL; + /* let the core set the states, we just read them */ + span->get_channel_sig_status = ftdm_r2_get_channel_sig_status; + span->signal_cb = sig_cb; span->signal_type = FTDM_SIGTYPE_R2; span->signal_data = r2data; commit e505884e6cc007a1b962e2711fb9c961d064cf0c Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Fri Dec 3 13:59:42 2010 -0200 freetdm: ftmod_r2 - implemented ftdm_r2_get_channel_sig_status() diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 58ff332..5a36f05 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -397,6 +397,17 @@ static ftdm_status_t ftdm_r2_stop(ftdm_span_t *span) return FTDM_SUCCESS; } +static FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(ftdm_r2_get_channel_sig_status) +{ + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) { + *status = FTDM_SIG_STATE_UP; + } else { + *status = FTDM_SIG_STATE_DOWN; + } + + return FTDM_SUCCESS; +} + /* always called from the monitor thread */ static void ftdm_r2_on_call_init(openr2_chan_t *r2chan) { @@ -1251,6 +1262,9 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) span->stop = ftdm_r2_stop; span->sig_read = NULL; + /* let the core set the states, we just read them */ + span->get_channel_sig_status = ftdm_r2_get_channel_sig_status; + span->signal_cb = sig_cb; span->signal_type = FTDM_SIGTYPE_R2; span->signal_data = r2data; commit 230cef0fd1e1d81948faa57623c9ca0bd04b7a17 Merge: de66ad2 6faa4c9 Author: Georgiewskiy Yuriy <bottleman@icf.org.ru> Date: Fri Dec 3 18:55:58 2010 +0300 Merge branch 'master' of ssh://git.freeswitch.org/freeswitch commit f5a9adae92e3ccf32c2a02dc32a182184c4b05d1 Merge: e1efaca cf7d91a Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Fri Dec 3 12:40:14 2010 -0200 Merge branch 'master' into netborder Conflicts: libs/freetdm/src/ftdm_io.c libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h libs/freetdm/src/include/freetdm.h commit d6d6a9ed9e0db9a067e061fa73eada17b53cc760 Author: Moises Silva <moises.silva@gmail.com> Date: Fri Dec 3 06:29:11 2010 -0500 freetdm: ftmod_r2 - do not act upon protocol error in DOWN state diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 5160005..58ff332 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -565,6 +565,7 @@ static void ftdm_r2_on_protocol_error(openr2_chan_t *r2chan, openr2_protocol_err if (ftdmchan->state == FTDM_CHANNEL_STATE_DOWN) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Got protocol error when we're already down!\n"); + return; } ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Protocol error\n"); commit dae177ec30bd62a59f3bff8423963ccb3160073d Author: Moises Silva <moy@sangoma.com> Date: Fri Dec 3 06:13:11 2010 -0500 freetdm: Add configuration profiles support for openr2 diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 6a23a44..13a1654 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -3234,8 +3234,8 @@ static switch_status_t load_config(void) if ((spans = switch_xml_child(cfg, "r2_spans"))) { for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) { - char *id = (char *) switch_xml_attr(myspan, "id"); char *name = (char *) switch_xml_attr(myspan, "name"); + char *configname = (char *) switch_xml_attr(myspan, "cfgprofile"); ftdm_status_t zstatus = FTDM_FAIL; /* common non r2 stuff */ @@ -3249,7 +3249,20 @@ static switch_status_t load_config(void) ftdm_conf_parameter_t spanparameters[30]; unsigned paramindex = 0; + if (!name) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "'name' attribute required for R2 spans!\n"); + continue; + } + memset(spanparameters, 0, sizeof(spanparameters)); + + if (configname) { + paramindex = add_profile_parameters(cfg, configname, spanparameters, ftdm_array_len(spanparameters)); + if (paramindex) { + ftdm_log(FTDM_LOG_DEBUG, "Added %d parameters from profile %s for span %d\n", paramindex, configname, span_id); + } + } + for (param = switch_xml_child(myspan, "param"); param; param = param->next) { char *var = (char *) switch_xml_attr_soft(param, "name"); char *val = (char *) switch_xml_attr_soft(param, "value"); @@ -3270,36 +3283,16 @@ static switch_status_t load_config(void) } } - if (!id && !name) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "either 'id' or 'name' required params are missing\n"); - continue; - } - - if (name) { - zstatus = ftdm_span_find_by_name(name, &span); - } else { - if (switch_is_number(id)) { - span_id = atoi(id); - zstatus = ftdm_span_find(span_id, &span); - } - - if (zstatus != FTDM_SUCCESS) { - zstatus = ftdm_span_find_by_name(id, &span); - } - } - + zstatus = ftdm_span_find_by_name(name, &span); if (zstatus != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error finding FreeTDM span id:%s name:%s\n", switch_str_nil(id), switch_str_nil(name)); + ftdm_log(FTDM_LOG_ERROR, "Error finding FreeTDM R2 Span '%s'\n", name); continue; } - - if (!span_id) { - span_id = ftdm_span_get_id(span); - } + span_id = ftdm_span_get_id(span); if (ftdm_configure_span_signaling(span, "r2", on_r2_signal, spanparameters) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error configuring R2 FreeTDM span %d, error: %s\n", - span_id, ftdm_span_get_last_error(span)); + ftdm_log(FTDM_LOG_ERROR, "Error configuring FreeTDM R2 span %s, error: %s\n", + name, ftdm_span_get_last_error(span)); continue; } @@ -3314,10 +3307,10 @@ static switch_status_t load_config(void) SPAN_CONFIG[span_id].span = span; switch_copy_string(SPAN_CONFIG[span_id].context, context, sizeof(SPAN_CONFIG[span_id].context)); switch_copy_string(SPAN_CONFIG[span_id].dialplan, dialplan, sizeof(SPAN_CONFIG[span_id].dialplan)); - switch_copy_string(SPAN_CONFIG[span_id].type, "r2", sizeof(SPAN_CONFIG[span_id].type)); + switch_copy_string(SPAN_CONFIG[span_id].type, "R2", sizeof(SPAN_CONFIG[span_id].type)); if (ftdm_span_start(span) == FTDM_FAIL) { - ftdm_log(FTDM_LOG_ERROR, "Error starting R2 FreeTDM span %d, error: %s\n", span_id, ftdm_span_get_last_error(span)); + ftdm_log(FTDM_LOG_ERROR, "Error starting FreeTDM R2 span %s, error: %s\n", name, ftdm_span_get_last_error(span)); continue; } } commit 8dd33bc8ccd25a227285627101f28305510086c0 Author: Moises Silva <moy@sangoma.com> Date: Thu Dec 2 18:35:48 2010 -0500 freetdm: add channel commands to record and dump media diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 3dd1aa9..92302c5 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -86,6 +86,110 @@ FT_DECLARE(ftdm_time_t) ftdm_current_time_in_ms(void) #endif } +static void write_chan_io_dump(ftdm_channel_t *fchan, ftdm_io_dump_t *dump, char *dataptr, int dlen) +{ + int windex = dump->windex; + int avail = dump->size - windex; + + if (dlen > avail) { + int diff = dlen - avail; + + ftdm_assert(diff < dump->size, "Very small buffer or very big IO chunk!\n"); + + /* write only what we can and the rest at the beginning of the buffer */ + memcpy(&dump->buffer[windex], dataptr, avail); + memcpy(&dump->buffer[0], &dataptr[avail], diff); + windex = diff; + + ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "wrapping around dump buffer %p up to index %d\n\n", dump, windex); + dump->wrapped = 1; + } else { + memcpy(&dump->buffer[windex], dataptr, dlen); + windex += dlen; + } + + if (windex == dump->size) { + ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "wrapping around dump buffer %p\n", dump); + windex = 0; + dump->wrapped = 1; + } + + dump->windex = windex; +} + +static void dump_chan_io_to_file(ftdm_channel_t *fchan, ftdm_io_dump_t *dump, FILE *file) +{ + /* write the saved audio buffer */ + int rc = 0; + int towrite = dump->size - dump->windex; + if (dump->wrapped) { + rc = fwrite(&dump->buffer[dump->windex], 1, towrite, file); + if (rc != towrite) { + ftdm_log_chan(fchan, FTDM_LOG_ERROR, "only wrote %d out of %d bytes in DTMF debug buffer\n", rc, towrite); + } + } + if (dump->windex) { + towrite = dump->windex; + rc = fwrite(&dump->buffer[0], 1, towrite, file); + if (rc != towrite) { + ftdm_log_chan(fchan, FTDM_LOG_ERROR, "only wrote %d out of %d bytes in DTMF debug buffer\n", rc, towrite); + } + } + dump->windex = 0; + dump->wrapped = 0; +} + +static void stop_chan_io_dump(ftdm_io_dump_t *dump) +{ + if (!dump->buffer) { + return; + } + ftdm_safe_free(dump->buffer); + memset(dump, 0, sizeof(dump)); +} + +static int start_chan_io_dump(ftdm_channel_t *chan, ftdm_io_dump_t *dump, ftdm_size_t size) +{ + if (dump->buffer) { + ftdm_log_chan_msg(chan, FTDM_LOG_ERROR, "IO dump is already started\n"); + return -1; + } + memset(dump, 0, sizeof(*dump)); + dump->buffer = ftdm_malloc(size); + if (!dump->buffer) { + return -1; + } + dump->size = size; + return 0; +} + + +static void close_dtmf_debug_file(ftdm_channel_t *ftdmchan) +{ + if (ftdmchan->dtmfdbg.file) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "closing debug dtmf file\n"); + fclose(ftdmchan->dtmfdbg.file); + ftdmchan->dtmfdbg.file = NULL; + } +} + +static int disable_dtmf_debug(ftdm_channel_t *ftdmchan) +{ + if (!ftdmchan->dtmfdbg.enabled) { + return 0; + } + + if (!ftdmchan->rxdump.buffer) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "DTMF debug enabled but no rx dump?\n"); + return -1; + } + + close_dtmf_debug_file(ftdmchan); + stop_chan_io_dump(&ftdmchan->rxdump); + ftdmchan->dtmfdbg.enabled = 0; + return 0; +} + typedef struct { uint8_t enabled; uint8_t running; @@ -448,10 +552,6 @@ static ftdm_status_t ftdm_channel_destroy(ftdm_channel_t *ftdmchan) ftdm_sleep(500); } -#ifdef FTDM_DEBUG_DTMF - ftdm_mutex_destroy(&ftdmchan->dtmfdbg.mutex); -#endif - ftdm_mutex_lock(ftdmchan->pre_buffer_mutex); ftdm_buffer_destroy(&ftdmchan->pre_buffer); ftdm_mutex_unlock(ftdmchan->pre_buffer_mutex); @@ -870,9 +970,6 @@ FT_DECLARE(ftdm_status_t) ftdm_span_add_channel(ftdm_span_t *span, ftdm_socket_t ftdm_mutex_create(&new_chan->mutex); ftdm_mutex_create(&new_chan->pre_buffer_mutex); -#ifdef FTDM_DEBUG_DTMF - ftdm_mutex_create(&new_chan->dtmfdbg.mutex); -#endif ftdm_buffer_create(&new_chan->digit_buffer, 128, 128, 0); ftdm_buffer_create(&new_chan->gen_dtmf_buffer, 128, 128, 0); @@ -2355,23 +2452,6 @@ FT_DECLARE(ftdm_status_t) ftdm_span_get_sig_status(ftdm_span_t *span, ftdm_signa } } -#ifdef FTDM_DEBUG_DTMF -static void close_dtmf_debug(ftdm_channel_t *ftdmchan) -{ - ftdm_mutex_lock(ftdmchan->dtmfdbg.mutex); - - if (ftdmchan->dtmfdbg.file) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "closing debug dtmf file\n"); - fclose(ftdmchan->dtmfdbg.file); - ftdmchan->dtmfdbg.file = NULL; - } - ftdmchan->dtmfdbg.windex = 0; - ftdmchan->dtmfdbg.wrapped = 0; - - ftdm_mutex_unlock(ftdmchan->dtmfdbg.mutex); -} -#endif - static ftdm_status_t ftdm_channel_clear_vars(ftdm_channel_t *ftdmchan); FT_DECLARE(ftdm_status_t) ftdm_channel_done(ftdm_channel_t *ftdmchan) { @@ -2400,9 +2480,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_done(ftdm_channel_t *ftdmchan) ftdm_buffer_destroy(&ftdmchan->pre_buffer); ftdmchan->pre_buffer_size = 0; ftdm_mutex_unlock(ftdmchan->pre_buffer_mutex); -#ifdef FTDM_DEBUG_DTMF - close_dtmf_debug(ftdmchan); -#endif + disable_dtmf_debug(ftdmchan); ftdm_channel_clear_vars(ftdmchan); if (ftdmchan->hangup_timer) { ftdm_sched_cancel_timer(globals.timingsched, ftdmchan->hangup_timer); @@ -2411,7 +2489,8 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_done(ftdm_channel_t *ftdmchan) ftdmchan->init_state = FTDM_CHANNEL_STATE_DOWN; ftdmchan->state = FTDM_CHANNEL_STATE_DOWN; - ftdm_log(FTDM_LOG_DEBUG, "channel done %u:%u\n", ftdmchan->span_id, ftdmchan->chan_id); + stop_chan_io_dump(&ftdmchan->txdump); + stop_chan_io_dump(&ftdmchan->rxdump); if (FTDM_IS_VOICE_CHANNEL(ftdmchan)) { ftdm_sigmsg_t sigmsg; @@ -2423,6 +2502,8 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_done(ftdm_channel_t *ftdmchan) ftdm_span_send_signal(ftdmchan->span, &sigmsg); } + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "channel done\n"); + ftdm_mutex_unlock(ftdmchan->mutex); return FTDM_SUCCESS; @@ -2431,7 +2512,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_done(ftdm_channel_t *ftdmchan) FT_DECLARE(ftdm_status_t) ftdm_channel_use(ftdm_channel_t *ftdmchan) { - assert(ftdmchan != NULL); + ftdm_assert(ftdmchan != NULL, "Null channel\n"); ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_INUSE); @@ -2505,8 +2586,8 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co { ftdm_status_t status = FTDM_FAIL; - assert(ftdmchan != NULL); - assert(ftdmchan->fio != NULL); + ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "No channel\n"); + ftdm_assert_return(ftdmchan->fio != NULL, FTDM_FAIL, "No IO attached to channel\n"); ftdm_mutex_lock(ftdmchan->mutex); @@ -2533,7 +2614,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co break; case FTDM_COMMAND_TRACE_INPUT: { - char *path = (char *) obj; + char *path = FTDM_COMMAND_OBJ_CHAR_P; if (ftdmchan->fds[FTDM_READ_TRACE_INDEX] > 0) { close(ftdmchan->fds[FTDM_READ_TRACE_INDEX]); ftdmchan->fds[FTDM_READ_TRACE_INDEX] = -1; @@ -2576,6 +2657,109 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_command(ftdm_channel_t *ftdmchan, ftdm_co GOTO_STATUS(done, FTDM_SUCCESS); } break; + + /*!< Enable DTMF debugging */ + case FTDM_COMMAND_ENABLE_DEBUG_DTMF: + { + if (ftdmchan->dtmfdbg.enabled) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Cannot enable debug DTMF again\n"); + GOTO_STATUS(done, FTDM_FAIL); + } + if (ftdmchan->rxdump.buffer) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Cannot debug DTMF if Rx dumping is already enabled\n"); + GOTO_STATUS(done, FTDM_FAIL); + } + if (start_chan_io_dump(ftdmchan, &ftdmchan->rxdump, FTDM_IO_DUMP_DEFAULT_BUFF_SIZE)) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to enable rx dump for DTMF debugging\n"); + } + ftdmchan->dtmfdbg.enabled = 1; + GOTO_STATUS(done, FTDM_SUCCESS); + } + break; + + /*!< Disable DTMF debugging (if not disabled explicitly, it is disabled automatically when calls hangup) */ + case FTDM_COMMAND_DISABLE_DEBUG_DTMF: + { + if (!ftdmchan->dtmfdbg.enabled) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "DTMF debug is already disabled\n"); + GOTO_STATUS(done, FTDM_SUCCESS); + } + if (disable_dtmf_debug(ftdmchan)) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to disable DTMF debug\n"); + GOTO_STATUS(done, FTDM_FAIL); + } + GOTO_STATUS(done, FTDM_SUCCESS); + } + break; + + /*!< Start dumping all input to a circular buffer. The size of the circular buffer can be specified, default used otherwise */ + case FTDM_COMMAND_ENABLE_INPUT_DUMP: + { + ftdm_size_t size = obj ? FTDM_COMMAND_OBJ_SIZE : FTDM_IO_DUMP_DEFAULT_BUFF_SIZE; + if (start_chan_io_dump(ftdmchan, &ftdmchan->rxdump, size)) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to enable input dump\n"); + GOTO_STATUS(done, FTDM_FAIL); + } + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Enabled input dump with size %zd\n", size); + GOTO_STATUS(done, FTDM_SUCCESS); + } + break; + + /*!< Stop dumping all input to a circular buffer. */ + case FTDM_COMMAND_DISABLE_INPUT_DUMP: + { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Disabled input dump of size %zd\n", ftdmchan->rxdump.size); + stop_chan_io_dump(&ftdmchan->rxdump); + GOTO_STATUS(done, FTDM_SUCCESS); + } + break; + + /*!< Start dumping all output to a circular buffer. The size of the circular buffer can be specified, default used otherwise */ + case FTDM_COMMAND_ENABLE_OUTPUT_DUMP: + { + ftdm_size_t size = obj ? FTDM_COMMAND_OBJ_SIZE : FTDM_IO_DUMP_DEFAULT_BUFF_SIZE; + if (start_chan_io_dump(ftdmchan, &ftdmchan->txdump, size)) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failed to enable output dump\n"); + GOTO_STATUS(done, FTDM_FAIL); + } + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Enabled output dump with size %zd\n", size); + GOTO_STATUS(done, FTDM_SUCCESS); + } + break; + + /*!< Stop dumping all output to a circular buffer. */ + case FTDM_COMMAND_DISABLE_OUTPUT_DUMP: + { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Disabled output dump of size %zd\n", ftdmchan->rxdump.size); + stop_chan_io_dump(&ftdmchan->txdump); + GOTO_STATUS(done, FTDM_SUCCESS); + } + break; + + /*!< Dump the current input circular buffer to the specified FILE* structure */ + case FTDM_COMMAND_DUMP_INPUT: + { + if (!obj) { + GOTO_STATUS(done, FTDM_FAIL); + } + dump_chan_io_to_file(ftdmchan, &ftdmchan->rxdump, obj); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Dumped input of size %zd to file %p\n", ftdmchan->rxdump.size, obj); + GOTO_STATUS(done, FTDM_SUCCESS); + } + break; + + /*!< Dump the current output circular buffer to the specified FILE* structure */ + case FTDM_COMMAND_DUMP_OUTPUT: + { + if (!obj) { + GOTO_STATUS(done, FTDM_FAIL); + } + dump_chan_io_to_file(ftdmchan, &ftdmchan->txdump, obj); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Dumped input of size %zd to file %p\n", ftdmchan->txdump.size, obj); + GOTO_STATUS(done, FTDM_SUCCESS); + } + break; + case FTDM_COMMAND_SET_INTERVAL: { if (!ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_INTERVAL)) { @@ -3044,12 +3228,14 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_queue_dtmf(ftdm_channel_t *ftdmchan, cons ftdm_size_t wr = 0; const char *p; - assert(ftdmchan != NULL); + ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "No channel\n"); ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Queuing DTMF %s\n", dtmf); -#ifdef FTDM_DEBUG_DTMF - ftdm_mutex_lock(ftdmchan->dtmfdbg.mutex); + if (!ftdmchan->dtmfdbg.enabled) { + goto skipdebug; + } + if (!ftdmchan->dtmfdbg.file) { struct tm currtime; time_t currsec; @@ -3062,37 +3248,18 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_queue_dtmf(ftdm_channel_t *ftdmchan, cons ftdmchan->span_id, ftdmchan->chan_id, currtime.tm_year-100, currtime.tm_mon+1, currtime.tm_mday, currtime.tm_hour, currtime.tm_min, currtime.tm_sec, ftdmchan->native_codec == FTDM_CODEC_ULAW ? "ulaw" : ftdmchan->native_codec == FTDM_CODEC_ALAW ? "alaw" : "sln"); - ftdmchan->dtmfdbg.file = fopen(dfile, "w"); + ftdmchan->dtmfdbg.file = fopen(dfile, "w"); if (!ftdmchan->dtmfdbg.file) { ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "failed to open debug dtmf file %s\n", dfile); } else { - /* write the saved audio buffer */ - int rc = 0; - int towrite = sizeof(ftdmchan->dtmfdbg.buffer) - ftdmchan->dtmfdbg.windex; - - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "created debug DTMF file %s\n", dfile); ftdmchan->dtmfdbg.closetimeout = DTMF_DEBUG_TIMEOUT; - if (ftdmchan->dtmfdbg.wrapped) { - rc = fwrite(&ftdmchan->dtmfdbg.buffer[ftdmchan->dtmfdbg.windex], 1, towrite, ftdmchan->dtmfdbg.file); - if (rc != towrite) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "only wrote %d out of %d bytes in DTMF debug buffer\n", rc, towrite); - } - } - if (ftdmchan->dtmfdbg.windex) { - towrite = ftdmchan->dtmfdbg.windex; - rc = fwrite(&ftdmchan->dtmfdbg.buffer[0], 1, towrite, ftdmchan->dtmfdbg.file); - if (rc != towrite) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "only wrote %d out of %d bytes in DTMF debug buffer\n", rc, towrite); - } - } - ftdmchan->dtmfdbg.windex = 0; - ftdmchan->dtmfdbg.wrapped = 0; + ftdm_channel_command(ftdmchan, FTDM_COMMAND_DUMP_INPUT, ftdmchan->dtmfdbg.file); } } else { - ftdmchan->dtmfdbg.closetimeout = DTMF_DEBUG_TIMEOUT; + ftdmchan->dtmfdbg.closetimeout = DTMF_DEBUG_TIMEOUT; } - ftdm_mutex_unlock(ftdmchan->dtmfdbg.mutex); -#endif + +skipdebug: if (ftdmchan->pre_buffer) { ftdm_buffer_zero(ftdmchan->pre_buffer); @@ -3146,7 +3313,6 @@ static FIO_WRITE_FUNCTION(ftdm_raw_write) return ftdmchan->fio->write(ftdmchan, data, datalen); } - static FIO_READ_FUNCTION(ftdm_raw_read) { ftdm_status_t status = ftdmchan->fio->read(ftdmchan, data, datalen); @@ -3161,48 +3327,24 @@ static FIO_READ_FUNCTION(ftdm_raw_read) ftdmchan->span->sig_read(ftdmchan, data, *datalen); } -#ifdef FTDM_DEBUG_DTMF if (status == FTDM_SUCCESS) { int dlen = (int) *datalen; int rc = 0; - ftdm_mutex_lock(ftdmchan->dtmfdbg.mutex); - if (!ftdmchan->dtmfdbg.file) { - /* no file yet, write to our circular buffer */ - int windex = ftdmchan->dtmfdbg.windex; - int avail = sizeof(ftdmchan->dtmfdbg.buffer) - windex; - char *dataptr = data; - - if (dlen > avail) { - int diff = dlen - avail; - /* write only what we can and the rest at the beginning of the buffer */ - memcpy(&ftdmchan->dtmfdbg.buffer[windex], dataptr, avail); - memcpy(&ftdmchan->dtmfdbg.buffer[0], &dataptr[avail], diff); - windex = diff; - /*ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "wrapping around dtmf read buffer up to index %d\n\n", windex);*/ - ftdmchan->dtmfdbg.wrapped = 1; - } else { - memcpy(&ftdmchan->dtmfdbg.buffer[windex], dataptr, dlen); - windex += dlen; - } - if (windex == sizeof(ftdmchan->dtmfdbg.buffer)) { - /*ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "wrapping around dtmf read buffer\n");*/ - windex = 0; - ftdmchan->dtmfdbg.wrapped = 1; - } - ftdmchan->dtmfdbg.windex = windex; - } else { + + write_chan_io_dump(ftdmchan, &ftdmchan->rxdump, data, dlen); + + /* if dtmf debug is enabled and initialized, write there too */ + if (ftdmchan->dtmfdbg.file) { rc = fwrite(data, 1, dlen, ftdmchan->dtmfdbg.file); if (rc != dlen) { ftdm_log(FTDM_LOG_WARNING, "DTMF debugger wrote only %d out of %d bytes: %s\n", rc, datalen, strerror(errno)); } ftdmchan->dtmfdbg.closetimeout--; if (!ftdmchan->dtmfdbg.closetimeout) { - close_dtmf_debug(ftdmchan); + close_dtmf_debug_file(ftdmchan); } } - ftdm_mutex_unlock(ftdmchan->dtmfdbg.mutex); } -#endif return status; } diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 45254e8..1adbaa8 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -431,9 +431,38 @@ typedef enum { FTDM_COMMAND_WINK, FTDM_COMMAND_ENABLE_PROGRESS_DETECT, FTDM_COMMAND_DISABLE_PROGRESS_DETECT, + + /*!< Start tracing input and output from channel to the given file */ FTDM_COMMAND_TRACE_INPUT, FTDM_COMMAND_TRACE_OUTPUT, + + /*!< Stop both Input and Output trace, closing the files */ FTDM_COMMAND_TRACE_END_ALL, + + /*!< Enable DTMF debugging */ + FTDM_COMMAND_ENABLE_DEBUG_DTMF, + + /*!< Disable DTMF debugging (if not disabled explicitly, it is disabled automatically when calls hangup) */ + FTDM_COMMAND_DISABLE_DEBUG_DTMF, + + /*!< Start dumping all input to a circular buffer. The size of the circular buffer can be specified, default used otherwise */ + FTDM_COMMAND_ENABLE_INPUT_DUMP, + + /*!< Stop dumping all input to a circular buffer. */ + FTDM_COMMAND_DISABLE_INPUT_DUMP, + + /*!< Start dumping all output to a circular buffer. The size of the circular buffer can be specified, default used otherwise */ + FTDM_COMMAND_ENABLE_OUTPUT_DUMP, + + /*!< Stop dumping all output to a circular buffer. */ + FTDM_COMMAND_DISABLE_OUTPUT_DUMP, + + /*!< Dump the current input circular buffer to the specified FILE* structure */ + FTDM_COMMAND_DUMP_INPUT, + + /*!< Dump the current output circular buffer to the specified FILE* structure */ + FTDM_COMMAND_DUMP_OUTPUT, + FTDM_COMMAND_ENABLE_CALLERID_DETECT, FTDM_COMMAND_DISABLE_CALLERID_DETECT, FTDM_COMMAND_ENABLE_ECHOCANCEL, diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index 7683ec7..04458ad 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -342,21 +342,23 @@ typedef enum { FTDM_TYPE_CHANNEL } ftdm_data_type_t; -#ifdef FTDM_DEBUG_DTMF -/* number of bytes for the circular buffer (5 seconds worth of audio) */ -#define DTMF_DEBUG_SIZE 8 * 5000 -/* number of 20ms cycles before timeout and close the debug dtmf file (5 seconds) */ -#define DTMF_DEBUG_TIMEOUT 250 +/* number of bytes for the IO dump circular buffer (5 seconds worth of audio by default) */ +#define FTDM_IO_DUMP_DEFAULT_BUFF_SIZE 8 * 5000 typedef struct { - FILE *file; - char buffer[DTMF_DEBUG_SIZE]; + char *buffer; + ftdm_size_t size; int windex; int wrapped; - int closetimeout; +} ftdm_io_dump_t; + +/* number of interval cycles before timeout and close the debug dtmf file (5 seconds if interval is 20) */ +#define DTMF_DEBUG_TIMEOUT 250 +typedef struct { + uint8_t enabled; + FILE *file; + int32_t closetimeout; ftdm_mutex_t *mutex; } ftdm_dtmf_debug_t; -#endif - typedef struct { const char *file; @@ -471,9 +473,9 @@ struct ftdm_channel { void *user_private; ftdm_timer_id_t hangup_timer; ftdm_channel_iostats_t iostats; -#ifdef FTDM_DEBUG_DTMF ftdm_dtmf_debug_t dtmfdbg; -#endif + ftdm_io_dump_t rxdump; + ftdm_io_dump_t txdump; }; struct ftdm_span { diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index f265cb1..db1428c 100644 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -58,6 +58,7 @@ typedef int ftdm_filehandle_t; extern "C" { #endif +#define FTDM_COMMAND_OBJ_SIZE *((ftdm_size_t *)obj) #define FTDM_COMMAND_OBJ_INT *((int *)obj) #define FTDM_COMMAND_OBJ_CHAR_P (char *)obj #define FTDM_COMMAND_OBJ_FLOAT *(float *)obj commit 6faa4c91c32028476f5df9af271fd4c7447f2f64 Author: Brian West <brian@freeswitch.org> Date: Thu Dec 2 17:11:04 2010 -0600 using the wrong api to remove media bug from crienzo on IRC, thanks. diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c index 0059241..f576b7d 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c @@ -495,7 +495,7 @@ switch_status_t callprogress_detector_stop(switch_core_session_t *session) switch_channel_t *channel = switch_core_session_get_channel(session); switch_media_bug_t *bug = switch_channel_get_private(channel, TONE_PRIVATE); if (bug) { - switch_core_media_bug_close(&bug); + switch_core_media_bug_remove(session, &bug); switch_channel_set_private(channel, TONE_PRIVATE, NULL); } return SWITCH_STATUS_SUCCESS; commit 8cf1501203de1481089d3576333fe10278da23fe Author: Brian West <brian@freeswitch.org> Date: Thu Dec 2 16:55:02 2010 -0600 FS-2881: SIP-header History-Info might exist multiple times, but only last header is exposed as a channel variable diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index e20d868..2e13b54 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -7001,6 +7001,8 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ if (tech_pvt->caller_profile) { + int first_history_info = 1; + if (rpid) { if (rpid->rpid_privacy) { if (!strcasecmp(rpid->rpid_privacy, "yes")) { @@ -7045,7 +7047,25 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ } } } else if (!strncasecmp(un->un_name, "History-Info", 12)) { - switch_channel_set_variable(channel, "sip_history_info", un->un_value); + if (first_history_info) { + /* If the header exists first time, make sure to remove old info and re-set the variable */ + switch_channel_set_variable(channel, "sip_history_info", un->un_value); + first_history_info = 0; + } else { + /* Append the History-Info into one long string */ + const char *history_var = switch_channel_get_variable(channel, "sip_history_info"); + if (!zstr(history_var)) { + char *tmp_str; + if ((tmp_str = switch_mprintf("%s, %s", history_var, un->un_value))) { + switch_channel_set_variable(channel, "sip_history_info", tmp_str); + free(tmp_str); + } else { + switch_channel_set_variable(channel, "sip_history_info", un->un_value); + } + } else { + switch_channel_set_variable(channel, "sip_history_info", un->un_value); + } + } } else if (!strcasecmp(un->un_name, "X-FS-Support")) { tech_pvt->x_freeswitch_support_remote = switch_core_session_strdup(session, un->un_value); } else if (!strncasecmp(un->un_name, "X-", 2) || !strncasecmp(un->un_name, "P-", 2)) { commit cf7d91a769c06accad064a1b41a98a28d4b138b9 Merge: 71e8ed8 7dbb483 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Dec 2 20:53:18 2010 -0200 Merge branch 'arnaldo.ftdm_channel_read_event' commit 59ea4a1b9cf788f20166708ea02c33568acf93bd Author: Brian West <brian@freeswitch.org> Date: Thu Dec 2 16:52:23 2010 -0600 FS-2886: wrong IP in VIA and contact HEADER for MESSAGE method while fs run in private network diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 5c2517d..143666c 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -86,6 +86,10 @@ switch_status_t sofia_presence_chat_send(const char *proto, const char *from, co char *to_uri = NULL; switch_console_callback_match_t *list = NULL; switch_console_callback_match_node_t *m; + char *remote_ip = NULL; + char *user_via = NULL; + char *contact_str = NULL; + char *dup_dest = NULL; if (!to) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing To: header.\n"); @@ -181,12 +185,80 @@ switch_status_t sofia_presence_chat_send(const char *proto, const char *from, co /* sofia_glue is running sofia_overcome_sip_uri_weakness we do not, not sure if it matters */ + remote_ip = malloc(sizeof(80)); + dup_dest = strdup(dst->contact); + + if (switch_stristr("fs_path", dst->contact)) { + char *remote_host = NULL; + const char *s; + + if ((s = switch_stristr("fs_path=", dst->contact))) { + s += 8; + } + if (s) { + remote_host = strdup(s); + switch_url_decode(remote_host); + } + if (!zstr(remote_host)) { + switch_split_user_domain(remote_host, NULL, &remote_ip); + } + switch_safe_free(remote_host); + } + + if (zstr(remote_ip)) { + switch_split_user_domain(dup_dest, NULL, &remote_ip); + } + + if (!zstr(remote_ip) && sofia_glue_check_nat(profile, remote_ip)) { + char *ptr = NULL; + const char *transport_str = NULL; + if ((ptr = sofia_glue_find_parameter(dst->contact, "transport="))) { + sofia_transport_t transport = sofia_glue_str2transport(ptr); + transport_str = sofia_glue_transport2str(transport); + switch (transport) { + case SOFIA_TRANSPORT_TCP: + contact_str = profile->tcp_public_contact; + break; + case SOFIA_TRANSPORT_TCP_TLS: + contact_str = profile->tls_public_contact; + break; + default: + contact_str = profile->public_url; + break; + } + user_via = sofia_glue_create_external_via(NULL, profile, transport); + } else { + user_via = sofia_glue_create_external_via(NULL, profile, SOFIA_TRANSPORT_UDP); + contact_str = profile->public_url; + } + } else { + contact_str = profile->url; + } + + switch_safe_free(dup_dest); + free(remote_ip); + status = SWITCH_STATUS_SUCCESS; + /* if this cries, add contact here too, change the 1 to 0 and omit the safe_free */ - msg_nh = nua_handle(profile->nua, NULL, TAG_IF(dst->route_uri, NUTAG_PROXY(dst->route_uri)), TAG_IF(dst->route, SIPTAG_ROUTE_STR(dst->route)), - SIPTAG_FROM_STR(from), TAG_IF(contact, NUTAG_URL(contact)), SIPTAG_TO_STR(dst->to), SIPTAG_CONTACT_STR(profile->url), TAG_END()); + + msg_nh = nua_handle(profile->nua, NULL, + TAG_IF(dst->route_uri, NUTAG_PROXY(dst->route_uri)), + TAG_IF(dst->route, SIPTAG_ROUTE_STR(dst->route)), + SIPTAG_FROM_STR(from), + TAG_IF(contact, NUTAG_URL(contact)), + SIPTAG_TO_STR(dst->to), + SIPTAG_CONTACT_STR(contact_str), + TAG_END()); + nua_handle_bind(msg_nh, &mod_sofia_globals.destroy_private); - nua_message(msg_nh, SIPTAG_CONTENT_TYPE_STR(ct), SIPTAG_PAYLOAD_STR(body), TAG_END()); + + nua_message(msg_nh, + TAG_IF(user_via, SIPTAG_VIA_STR(user_via)), + SIPTAG_CONTENT_TYPE_STR(ct), + SIPTAG_PAYLOAD_STR(body), + TAG_END()); + sofia_glue_free_destination(dst); } @@ -197,6 +269,7 @@ switch_status_t sofia_presence_chat_send(const char *proto, const char *from, co switch_safe_free(contact); switch_safe_free(ffrom); switch_safe_free(dup); + if (profile) { switch_thread_rwlock_unlock(profile->rwlock); } commit 7dbb4834e4654b7a0574b3da6337c4216edab9ea Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Dec 2 20:21:22 2010 -0200 freetdm: ftmod_wanpipe - fixed param documentation for wanpipe_channel_next_event() diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 5ae14ab..57c590f 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -915,7 +915,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_remove_from_group(ftdm_group_t* group, ft * from a different thread or even the same. It is recommended to * handle events from the same span in a single thread. * - * \param span The channel to retrieve the event from + * \param ftdmchan The channel to retrieve the event from * \param event Pointer to store the pointer to the event * * \retval FTDM_SUCCESS success (at least one event available) commit e0048ed24e7eee9cbfd07b7a9afc1d97941cd270 Author: Moises Silva <moy@sangoma.com> Date: Thu Dec 2 16:43:27 2010 -0500 freetdm: OPENZAP-120 - Allow FXO to bridge calls without digits diff --git a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c index 99d2566..95002e3 100644 --- a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c +++ b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c @@ -341,8 +341,8 @@ static void send_caller_id(ftdm_channel_t *ftdmchan) static void analog_dial(ftdm_channel_t *ftdmchan, uint32_t *state_counter, uint32_t *dial_timeout) { if (ftdm_strlen_zero(ftdmchan->caller_data.dnis.digits)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "No Digits to send!\n"); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No digits to send, moving to UP!\n"); + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); } else { if (ftdm_channel_command(ftdmchan, FTDM_COMMAND_SEND_DTMF, ftdmchan->caller_data.dnis.digits) != FTDM_SUCCESS) { ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Send Digits Failed [%s]\n", ftdmchan->last_error); commit eab0318b7aae921520b974d2aa44081866fc04b6 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Dec 2 19:11:35 2010 -0200 freetdm: ftmod_r2 - disabled IO stats on all channels diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index c503ba2..5160005 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -1511,7 +1511,7 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) openr2_chan_process_cas_signaling(r2chan); ftdmchan = openr2_chan_get_client_data(r2chan); - ftdm_channel_set_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS); + //ftdm_channel_set_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS); } memset(&start, 0, sizeof(start)); commit a440210f44d2785ca795bae069e3fe1809738170 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Dec 2 19:10:34 2010 -0200 freetdm: ftmod_r2 - added state map diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 485b2fa..c503ba2 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -513,8 +513,6 @@ static void ftdm_r2_on_call_disconnect(openr2_chan_t *r2chan, openr2_call_discon ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "Call disconnected\n"); - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Got openr2 disconnection, clearing call\n"); - clear_accept_pending(ftdmchan); R2CALL(ftdmchan)->disconnect_rcvd = 1; @@ -918,6 +916,103 @@ static openr2_log_level_t ftdm_r2_loglevel_from_string(const char *level) return newlevel; } +static ftdm_state_map_t r2_state_map = { + { + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_DOWN, FTDM_END}, + {FTDM_CHANNEL_STATE_COLLECT, FTDM_END} + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_COLLECT, FTDM_END}, + {FTDM_CHANNEL_STATE_RING, FTDM_CHANNEL_STATE_TERMINATING, FTDM_END} + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_RING, FTDM_END}, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_END} + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_END}, + {FTDM_CHANNEL_STATE_DOWN, FTDM_END}, + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_END}, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_END}, + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_PROGRESS, FTDM_END}, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_END}, + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_END}, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_UP, FTDM_END}, + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_UP, FTDM_END}, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_END}, + }, + + /* Outbound states */ + + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_DOWN, FTDM_END}, + {FTDM_CHANNEL_STATE_DIALING, FTDM_END} + }, + + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_DIALING, FTDM_END}, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_END} + }, + + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_END}, + {FTDM_CHANNEL_STATE_DOWN, FTDM_END} + }, + + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_END}, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_END} + }, + + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_END}, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_UP, FTDM_END} + }, + + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_UP, FTDM_END}, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_END} + }, + } +}; + static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) { unsigned int i = 0; @@ -1160,6 +1255,8 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) span->signal_data = r2data; span->outgoing_call = r2_outgoing_call; + span->state_map = &r2_state_map; + /* use signals queue */ ftdm_set_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE); commit 2673bb77a0f4e4c2336e038a41f622a7af0f0bd8 Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Dec 2 14:26:11 2010 -0500 freetdm: ISDN - Cause value only evaluated on switchtype=5ESS diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index d557ca3..ab29b3e 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -33,6 +33,7 @@ */ #include "ftmod_sangoma_isdn.h" +ftdm_status_t sngisdn_cause_val_requires_disconnect(ftdm_channel_t *ftdmchan, CauseDgn *causeDgn); /* Remote side transmit a SETUP */ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) @@ -352,33 +353,15 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) case MI_ALERTING: get_prog_ind_ie(ftdmchan, &cnStEvnt->progInd); - if (signal_data->ignore_cause_value != SNGISDN_OPT_TRUE && - cnStEvnt->causeDgn[0].eh.pres && cnStEvnt->causeDgn[0].causeVal.pres) { - - switch(cnStEvnt->causeDgn[0].causeVal.val) { - case 17: /* User Busy */ - case 18: /* No User responding */ - case 19: /* User alerting, no answer */ - case 21: /* Call rejected, the called party does not with to accept this call */ - case 27: /* Destination out of order */ - case 31: /* Normal, unspecified */ - case 34: /* Circuit/Channel congestion */ - case 41: /* Temporary failure */ - case 42: /* Switching equipment is experiencing a period of high traffic */ - case 47: /* Resource unavailable */ - case 58: /* Bearer Capability not available */ - case 63: /* Service or option not available */ - case 65: /* Bearer Cap not implemented, not supported */ - case 79: /* Service or option not implemented, unspecified */ - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Cause requires disconnect (cause:%d)\n", cnStEvnt->causeDgn[0].causeVal.val); - ftdmchan->caller_data.hangup_cause = cnStEvnt->causeDgn[0].causeVal.val; + if (sngisdn_cause_val_requires_disconnect(ftdmchan, &cnStEvnt->causeDgn[0]) == FTDM_SUCCESS) { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Cause requires disconnect (cause:%d)\n", cnStEvnt->causeDgn[0].causeVal.val); + ftdmchan->caller_data.hangup_cause = cnStEvnt->causeDgn[0].causeVal.val; - sngisdn_set_flag(sngisdn_info, FLAG_SEND_DISC); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - goto sngisdn_process_cnst_ind_end; - } + sngisdn_set_flag(sngisdn_info, FLAG_SEND_DISC); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + goto sngisdn_process_cnst_ind_end; } - + switch(ftdmchan->state) { case FTDM_CHANNEL_STATE_DIALING: case FTDM_CHANNEL_STATE_PROCEED: @@ -1119,8 +1102,44 @@ void sngisdn_process_rst_ind (sngisdn_event_data_t *sngisdn_event) (evntType == IN_LNK_DWN)?"LNK_DOWN": (evntType == IN_LNK_UP)?"LNK_UP": (evntType == IN_INDCHAN)?"b-channel": - (evntType == IN_LNK_DWN_DM_RLS)?"Nfas service procedures": + (evntType == IN_LNK_DWN_DM_RLS)?"NFAS service procedures": (evntType == IN_SWCHD_BU_DCHAN)?"NFAS switchover to backup":"Unknown"); ISDN_FUNC_TRACE_EXIT(__FUNCTION__); return; } + +ftdm_status_t sngisdn_cause_val_requires_disconnect(ftdm_channel_t *ftdmchan, CauseDgn *causeDgn) +{ + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + + if (signal_data->ignore_cause_value == SNGISDN_OPT_TRUE) { + return FTDM_FAIL; + } + + /* By default, we only evaluate cause value on 5ESS switches */ + if (signal_data->ignore_cause_value == SNGISDN_OPT_DEFAULT && + signal_data->switchtype != SNGISDN_SWITCH_5ESS) { + + return FTDM_FAIL; + } + + /* ignore_cause_value = SNGISDN_OPT_FALSE or switchtype == 5ESS */ + switch(causeDgn->causeVal.val) { + case 17: /* User Busy */ + case 18: /* No User responding */ + case 19: /* User alerting, no answer */ + case 21: /* Call rejected, the called party does not with to accept this call */ + case 27: /* Destination out of order */ + case 31: /* Normal, unspecified */ + case 34: /* Circuit/Channel congestion */ + case 41: /* Temporary failure */ + case 42: /* Switching equipment is experiencing a period of high traffic */ + case 47: /* Resource unavailable */ + case 58: /* Bearer Capability not available */ + case 63: /* Service or option not available */ + case 65: /* Bearer Cap not implemented, not supported */ + case 79: /* Service or option not implemented, unspecified */ + return FTDM_SUCCESS; + } + return FTDM_FAIL; +} commit 60ab93e36c95d28530434810962ef8b102c8691c Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Dec 2 14:25:23 2010 -0500 freetdm: Fix for TON/NPI from default_caller_data ignored diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 3dd1aa9..c0e4585 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -314,43 +314,43 @@ static ftdm_status_t ftdm_set_caller_data(ftdm_span_t *span, ftdm_caller_data_t return FTDM_FAIL; } - if (caller_data->dnis.plan == FTDM_NPI_INVALID) { + if (caller_data->dnis.plan >= FTDM_NPI_INVALID) { caller_data->dnis.plan = span->default_caller_data.dnis.plan; } - if (caller_data->dnis.type == FTDM_TON_INVALID) { + if (caller_data->dnis.type >= FTDM_TON_INVALID) { caller_data->dnis.type = span->default_caller_data.dnis.type; } - if (caller_data->cid_num.plan == FTDM_NPI_INVALID) { + if (caller_data->cid_num.plan >= FTDM_NPI_INVALID) { caller_data->cid_num.plan = span->default_caller_data.cid_num.plan; } - if (caller_data->cid_num.type == FTDM_TON_INVALID) { + if (caller_data->cid_num.type >= FTDM_TON_INVALID) { caller_data->cid_num.type = span->default_caller_data.cid_num.type; } - if (caller_data->ani.plan == FTDM_NPI_INVALID) { + if (caller_data->ani.plan >= FTDM_NPI_INVALID) { caller_data->ani.plan = span->default_caller_data.ani.plan; } - if (caller_data->ani.type == FTDM_TON_INVALID) { + if (caller_data->ani.type >= FTDM_TON_INVALID) { caller_data->ani.type = span->default_caller_data.ani.type; } - if (caller_data->rdnis.plan == FTDM_NPI_INVALID) { + if (caller_data->rdnis.plan >= FTDM_NPI_INVALID) { caller_data->rdnis.plan = span->default_caller_data.rdnis.plan; } - if (caller_data->rdnis.type == FTDM_NPI_INVALID) { + if (caller_data->rdnis.type >= FTDM_NPI_INVALID) { caller_data->rdnis.type = span->default_caller_data.rdnis.type; } - if (caller_data->bearer_capability == FTDM_INVALID_INT_PARM) { + if (caller_data->bearer_capability >= FTDM_INVALID_INT_PARM) { caller_data->bearer_capability = span->default_caller_data.bearer_capability; } - if (caller_data->bearer_layer1 == FTDM_INVALID_INT_PARM) { + if (caller_data->bearer_layer1 >= FTDM_INVALID_INT_PARM) { caller_data->bearer_layer1 = span->default_caller_data.bearer_layer1; } commit d0f403b114d2d446cc7def0ed5acccd9b4b5280a Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Dec 2 16:38:29 2010 -0200 freetdm: ftmod_r2 - Use FTDM_CHANNEL_STATE_TERMINATING state properly as well-behaved modules should diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 9cc96a0..485b2fa 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -445,7 +445,7 @@ static void ftdm_r2_on_call_offered(openr2_chan_t *r2chan, const char *ani, cons ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Call offered with ANI = %s, DNIS = %s, Category = (%d)\n", ani, dnis, category); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RING); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); } /* @@ -492,7 +492,7 @@ static void ftdm_r2_on_call_accepted(openr2_chan_t *r2chan, openr2_call_mode_t m return; } } else { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); } } @@ -502,15 +502,13 @@ static void ftdm_r2_on_call_answered(openr2_chan_t *r2chan) ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "Call answered\n"); /* notify the upper layer of progress in the outbound call */ if (OR2_DIR_FORWARD == openr2_chan_get_direction(r2chan)) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_UP); } } /* may be called in the signaling or media thread depending on whether the hangup is product of MF or CAS signaling */ static void ftdm_r2_on_call_disconnect(openr2_chan_t *r2chan, openr2_call_disconnect_cause_t cause) { - ftdm_sigmsg_t sigev; - ftdm_r2_data_t *r2data; ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "Call disconnected\n"); @@ -523,28 +521,13 @@ static void ftdm_r2_on_call_disconnect(openr2_chan_t *r2chan, openr2_call_discon if (ftdmchan->state == FTDM_CHANNEL_STATE_HANGUP) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Call had been disconnected already by the user\n"); - /* just ack the hangup to go down */ + /* just ack the hangup to trigger the on_call_end callback and go down */ openr2_chan_disconnect_call(r2chan, OR2_CAUSE_NORMAL_CLEARING); return; } - /* if the call has not been started yet we must go to HANGUP right here */ - if (!R2CALL(ftdmchan)->ftdm_call_started) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); - return; - } - ftdmchan->caller_data.hangup_cause = ftdm_r2_cause_to_ftdm_cause(ftdmchan, cause); - - /* notify the user of the call terminating */ - memset(&sigev, 0, sizeof(sigev)); - sigev.chan_id = ftdmchan->chan_id; - sigev.span_id = ftdmchan->span_id; - sigev.channel = ftdmchan; - sigev.event_id = FTDM_SIGEVENT_STOP; - r2data = ftdmchan->span->signal_data; - - ftdm_span_send_signal(ftdmchan->span, &sigev); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); } static void ftdm_r2_on_call_end(openr2_chan_t *r2chan) @@ -580,8 +563,6 @@ static void ftdm_r2_on_os_error(openr2_chan_t *r2chan, int errorcode) static void ftdm_r2_on_protocol_error(openr2_chan_t *r2chan, openr2_protocol_error_t reason) { - ftdm_sigmsg_t sigev; - ftdm_r2_data_t *r2data; ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); if (ftdmchan->state == FTDM_CHANNEL_STATE_DOWN) { @@ -595,22 +576,14 @@ static void ftdm_r2_on_protocol_error(openr2_chan_t *r2chan, openr2_protocol_err R2CALL(ftdmchan)->disconnect_rcvd = 1; R2CALL(ftdmchan)->protocol_error = 1; - if (!R2CALL(ftdmchan)->ftdm_call_started) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); + if (ftdmchan->state == FTDM_CHANNEL_STATE_HANGUP) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "The user already hung up, finishing call in protocol error\n"); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); return; } ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_PROTOCOL_ERROR; - - /* FIXME: go to terminating and notify the user from the terminating handler instead of notifying here */ - memset(&sigev, 0, sizeof(sigev)); - sigev.chan_id = ftdmchan->chan_id; - sigev.span_id = ftdmchan->span_id; - sigev.channel = ftdmchan; - sigev.event_id = FTDM_SIGEVENT_STOP; - r2data = ftdmchan->span->signal_data; - - ftdm_span_send_signal(ftdmchan->span, &sigev); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); } static void ftdm_r2_on_line_blocked(openr2_chan_t *r2chan) @@ -669,14 +642,13 @@ static void ftdm_r2_on_chan_log(openr2_chan_t *r2chan, const char *file, const c openr2_log_level_t level, const char *fmt, va_list ap) { ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); -#define CHAN_TAG "Chan " - char logmsg[512]; - char completemsg[sizeof(logmsg) + sizeof(CHAN_TAG) - 1]; + char logmsg[1024]; + char completemsg[sizeof(logmsg)]; vsnprintf(logmsg, sizeof(logmsg), fmt, ap); - snprintf(completemsg, sizeof(completemsg), CHAN_TAG "%d:%d [%s] %s", - ftdmchan->span_id, ftdmchan->chan_id, ftdm_channel_state2str(ftdmchan->state), logmsg); + snprintf(completemsg, sizeof(completemsg), "[s%dc%d] [%d:%d] [%s] %s", + ftdmchan->span_id, ftdmchan->chan_id, ftdmchan->physical_span_id, ftdmchan->physical_chan_id, + ftdm_channel_state2str(ftdmchan->state), logmsg); ftdm_r2_write_log(level, file, function, line, completemsg); -#undef CHAN_TAG } static int ftdm_r2_on_dnis_digit_received(openr2_chan_t *r2chan, char digit) @@ -1301,13 +1273,10 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) } else { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Notifying progress\n"); sigev.event_id = FTDM_SIGEVENT_PROCEED; - if (ftdm_span_send_signal(ftdmchan->span, &sigev) != FTDM_SUCCESS) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); - } + ftdm_span_send_signal(ftdmchan->span, &sigev); + sigev.event_id = FTDM_SIGEVENT_PROGRESS_MEDIA; - if (ftdm_span_send_signal(ftdmchan->span, &sigev) != FTDM_SUCCESS) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); - } + ftdm_span_send_signal(ftdmchan->span, &sigev); } } break; @@ -1328,31 +1297,44 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) } else { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Notifying of call answered\n"); sigev.event_id = FTDM_SIGEVENT_UP; - if (ftdm_span_send_signal(ftdmchan->span, &sigev) != FTDM_SUCCESS) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); - } + ftdm_span_send_signal(ftdmchan->span, &sigev); } } break; /* just got hangup */ - case FTDM_CHANNEL_STATE_HANGUP: + case FTDM_CHANNEL_STATE_HANGUP: { - openr2_call_disconnect_cause_t disconnect_cause = ftdm_r2_ftdm_cause_to_openr2_cause(ftdmchan); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Clearing call, cause = %s\n", openr2_proto_get_disconnect_string(disconnect_cause)); if (!R2CALL(ftdmchan)->disconnect_rcvd) { + openr2_call_disconnect_cause_t disconnect_cause = ftdm_r2_ftdm_cause_to_openr2_cause(ftdmchan); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Clearing call, cause = %s\n", openr2_proto_get_disconnect_string(disconnect_cause)); /* this will disconnect the call, but need to wait for the call end before moving to DOWN */ openr2_chan_disconnect_call(r2chan, disconnect_cause); } else if (!R2CALL(ftdmchan)->protocol_error) { /* just ack the hangup, on_call_end will be called by openr2 right after */ - openr2_chan_disconnect_call(r2chan, disconnect_cause); + openr2_chan_disconnect_call(r2chan, OR2_CAUSE_NORMAL_CLEARING); } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Clearing call due to protocol error\n"); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Clearing call due to protocol error\n"); ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); } } break; + case FTDM_CHANNEL_STATE_TERMINATING: + { + /* if the call has not been started yet we must go to HANGUP right here */ + if (!R2CALL(ftdmchan)->ftdm_call_started) { + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); + } else { + openr2_call_disconnect_cause_t disconnect_cause = ftdm_r2_ftdm_cause_to_openr2_cause(ftdmchan); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Clearing call, cause = %s\n", openr2_proto_get_disconnect_string(disconnect_cause)); + /* notify the user of the call terminating and we wait for the user to move us to hangup */ + sigev.event_id = FTDM_SIGEVENT_STOP; + ftdm_span_send_signal(ftdmchan->span, &sigev); + } + } + break; + /* just got hangup from the freetdm side due to abnormal failure */ case FTDM_CHANNEL_STATE_CANCEL: { @@ -1408,7 +1390,6 @@ static void ftdm_r2_state_advance_all(ftdm_channel_t *ftdmchan) static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) { openr2_chan_t *r2chan; - ftdm_r2_call_t *r2call = NULL; ftdm_channel_t *ftdmchan = NULL; ftdm_status_t status; ftdm_span_t *span = (ftdm_span_t *) obj; commit 90b0718d5e3248413ac2a74b8bc7d81b3e925dfe Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Dec 2 12:21:38 2010 -0500 freetdm: fix for TON/NPI not set to default if not available from core diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 42bcd1e..636e788 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -394,10 +394,19 @@ ftdm_status_t set_calling_num(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb) cgPtyNmb->presInd0.val = caller_data->pres; cgPtyNmb->nmbPlanId.pres = PRSNT_NODEF; - cgPtyNmb->nmbPlanId.val = caller_data->cid_num.plan; + if (caller_data->cid_num.plan >= FTDM_NPI_INVALID) { + cgPtyNmb->nmbPlanId.val = FTDM_NPI_UNKNOWN; + } else { + cgPtyNmb->nmbPlanId.val = caller_data->cid_num.plan; + } cgPtyNmb->typeNmb1.pres = PRSNT_NODEF; - cgPtyNmb->typeNmb1.val = caller_data->cid_num.type; + + if (caller_data->cid_num.type >= FTDM_TON_INVALID) { + cgPtyNmb->typeNmb1.val = FTDM_TON_UNKNOWN; + } else { + cgPtyNmb->typeNmb1.val = caller_data->cid_num.type; + } cgPtyNmb->nmbDigits.pres = PRSNT_NODEF; cgPtyNmb->nmbDigits.len = len; @@ -418,14 +427,14 @@ ftdm_status_t set_called_num(ftdm_channel_t *ftdmchan, CdPtyNmb *cdPtyNmb) cdPtyNmb->eh.pres = PRSNT_NODEF; cdPtyNmb->nmbPlanId.pres = PRSNT_NODEF; - if (caller_data->dnis.plan == FTDM_NPI_INVALID) { + if (caller_data->dnis.plan >= FTDM_NPI_INVALID) { cdPtyNmb->nmbPlanId.val = FTDM_NPI_UNKNOWN; } else { cdPtyNmb->nmbPlanId.val = caller_data->dnis.plan; } cdPtyNmb->typeNmb0.pres = PRSNT_NODEF; - if (caller_data->dnis.type == FTDM_TON_INVALID) { + if (caller_data->dnis.type >= FTDM_TON_INVALID) { cdPtyNmb->typeNmb0.val = FTDM_TON_UNKNOWN; } else { cdPtyNmb->typeNmb0.val = caller_data->dnis.type; @@ -450,14 +459,14 @@ ftdm_status_t set_redir_num(ftdm_channel_t *ftdmchan, RedirNmb *redirNmb) redirNmb->eh.pres = PRSNT_NODEF; redirNmb->nmbPlanId.pres = PRSNT_NODEF; - if (caller_data->rdnis.plan == FTDM_NPI_INVALID) { + if (caller_data->rdnis.plan >= FTDM_NPI_INVALID) { redirNmb->nmbPlanId.val = FTDM_NPI_UNKNOWN; } else { redirNmb->nmbPlanId.val = caller_data->rdnis.plan; } redirNmb->typeNmb.pres = PRSNT_NODEF; - if (caller_data->rdnis.type == FTDM_TON_INVALID) { + if (caller_data->rdnis.type >= FTDM_TON_INVALID) { redirNmb->typeNmb.val = FTDM_TON_UNKNOWN; } else { redirNmb->typeNmb.val = caller_data->rdnis.type; commit 980692ba9496fc2329389d85c4347cbfae6a35bf Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Dec 2 13:38:28 2010 -0200 freetdm: ftmod_r2 - fixed 'Tx Queue Full' print, it was printing rx's queue length instead of tx diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index 0fd2cd6..72a5728 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -796,7 +796,7 @@ static void wanpipe_write_stats(ftdm_channel_t *ftdmchan, wp_tdm_api_tx_hdr_t *t /* we don't test for 80% full in tx since is typically full for voice channels, should we test tx 80% full for D-channels? */ if (ftdmchan->iostats.tx.queue_len >= ftdmchan->iostats.tx.queue_size) { ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Tx Queue Full (%d/%d)\n", - ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.tx.queue_size); + ftdmchan->iostats.tx.queue_len, ftdmchan->iostats.tx.queue_size); ftdm_set_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_FULL); } else if (ftdm_test_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_FULL)){ ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Tx Queue no longer full (%d/%d)\n", commit 3dca1cb33209a00fb41dec062f79dee7ffac9b12 Merge: 1e2ce09 383395d Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Dec 2 13:11:25 2010 -0200 Merge branch 'arnaldo.ftdm_channel_read_event' of git@git.sangoma.com:smg_freeswitch into arnaldo.ftdm_channel_read_event commit 1e2ce092b30f9c8abeda9237e2c63c16dd08f577 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Dec 2 13:10:57 2010 -0200 freetdm: ftmod_r2 - fixed segfault diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 6440c79..8222fa4 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -1496,10 +1496,9 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) ftdm_mutex_lock(ftdmchan->mutex); - r2chan = R2CALL(span->channels[i])->r2chan; - ftdm_r2_state_advance_all(ftdmchan); + r2chan = R2CALL(ftdmchan)->r2chan; openr2_chan_process_signaling(r2chan); ftdm_r2_state_advance_all(ftdmchan); commit de66ad246f076e85ccbab4f1df0fbb23a9c86957 Merge: 006b316 12fc65f Author: Georgiewskiy Yuriy <bottleman@icf.org.ru> Date: Thu Dec 2 17:30:27 2010 +0300 Merge branch 'master' of ssh://git.freeswitch.org/freeswitch commit 12fc65f7a38d47c2ca2df24b5f0993ad40a3d4d9 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Dec 1 21:20:59 2010 -0600 FS-2872 diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 1f9f7ac..afd33f1 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -435,8 +435,11 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) switch_channel_t *un = ans_a ? chan_b : chan_a; switch_channel_t *a = un == chan_b ? chan_a : chan_b; - if ((!switch_channel_test_flag(un, CF_OUTBOUND) && switch_channel_test_flag(a, CF_OUTBOUND)) || (un == chan_a && !originator)) { - switch_channel_pass_callee_id(a, un); + if (!switch_channel_test_flag(un, CF_OUTBOUND)) { + if (switch_channel_test_flag(a, CF_OUTBOUND) || (un == chan_a && !originator)) { + switch_channel_pass_callee_id(a, un); + } + if (switch_channel_answer(un) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Media Establishment Failed.\n", switch_channel_get_name(un)); goto end_of_bridge_loop; @@ -1553,7 +1556,7 @@ SWITCH_DECLARE(void) switch_ivr_intercept_session(switch_core_session_t *session } } - switch_channel_pre_answer(channel); + switch_channel_answer(channel); if (!zstr(buuid)) { if ((bsession = switch_core_session_locate(buuid))) { commit 7039ba47a19c02907ce8b180739676eb7c5f42f7 Author: Michael S Collins <msc@freeswitch.org> Date: Wed Dec 1 17:39:17 2010 -0800 libesl: allow fs_cli -x to have args up to 1024 chars (was 256) diff --git a/libs/esl/fs_cli.c b/libs/esl/fs_cli.c index 91836b7..569e2cd 100644 --- a/libs/esl/fs_cli.c +++ b/libs/esl/fs_cli.c @@ -1005,7 +1005,7 @@ int main(int argc, char *argv[]) int temp_log = -1; int argv_error = 0; int argv_exec = 0; - char argv_command[256] = ""; + char argv_command[1024] = ""; char argv_loglevel[128] = ""; int argv_quiet = 0; int loops = 2, reconnect = 0; commit 540d486fd05778575acda7cd743ad28a8e25b895 Author: Jeff Lenk <jeff@jefflenk.com> Date: Wed Dec 1 18:42:28 2010 -0600 VS2010 Freetdm fix misc build settings diff --git a/libs/freetdm/freetdm.2010.sln b/libs/freetdm/freetdm.2010.sln index 1806e9e..f4bd907 100644 --- a/libs/freetdm/freetdm.2010.sln +++ b/libs/freetdm/freetdm.2010.sln @@ -120,16 +120,14 @@ Global {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|x64.Build.0 = Release|x64 {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Debug|Win32.ActiveCfg = Debug|Win32 {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Debug|Win32.Build.0 = Debug|Win32 - {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Debug|x64.ActiveCfg = Debug|Win32 + {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Debug|x64.ActiveCfg = Debug|x64 {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|Win32.ActiveCfg = Release|Win32 {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|Win32.Build.0 = Release|Win32 - {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|x64.ActiveCfg = Release|Win32 + {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|x64.ActiveCfg = Release|x64 {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Debug|Win32.ActiveCfg = Debug|Win32 - {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Debug|Win32.Build.0 = Debug|Win32 - {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Debug|x64.ActiveCfg = Debug|Win32 + {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Debug|x64.ActiveCfg = Debug|x64 {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Release|Win32.ActiveCfg = Release|Win32 - {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Release|Win32.Build.0 = Release|Win32 - {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Release|x64.ActiveCfg = Release|Win32 + {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Release|x64.ActiveCfg = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/libs/freetdm/msvc/testboost/testsangomaboost.2010.vcxproj b/libs/freetdm/msvc/testboost/testsangomaboost.2010.vcxproj index b6c0518..5994da6 100644 --- a/libs/freetdm/msvc/testboost/testsangomaboost.2010.vcxproj +++ b/libs/freetdm/msvc/testboost/testsangomaboost.2010.vcxproj @@ -186,7 +186,7 @@ <PrecompiledHeader> </PrecompiledHeader> <WarningLevel>Level4</WarningLevel> - <TreatWarningAsError>true</TreatWarningAsError> + <TreatWarningAsError>false</TreatWarningAsError> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> </ClCompile> diff --git a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.2010.vcxproj b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.2010.vcxproj index 81cb93f..301d821 100644 --- a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.2010.vcxproj +++ b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.2010.vcxproj @@ -168,7 +168,7 @@ <PrecompiledHeader> </PrecompiledHeader> <WarningLevel>Level4</WarningLevel> - <TreatWarningAsError>true</TreatWarningAsError> + <TreatWarningAsError>false</TreatWarningAsError> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> </ClCompile> diff --git a/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.2010.vcxproj b/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.2010.vcxproj index 44792df..3643e27 100644 --- a/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.2010.vcxproj +++ b/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.2010.vcxproj @@ -168,7 +168,7 @@ <PrecompiledHeader> </PrecompiledHeader> <WarningLevel>Level4</WarningLevel> - <TreatWarningAsError>true</TreatWarningAsError> + <TreatWarningAsError>false</TreatWarningAsError> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> </ClCompile> diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2010.vcxproj b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2010.vcxproj index f66f5af..9b893b3 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2010.vcxproj +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2010.vcxproj @@ -5,10 +5,18 @@ <Configuration>Debug</Configuration> <Platform>Win32</Platform> </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> <ProjectConfiguration Include="Release|Win32"> <Configuration>Release</Configuration> <Platform>Win32</Platform> </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> </ItemGroup> <PropertyGroup Label="Globals"> <ProjectName>ftmod_r2</ProjectName> @@ -19,33 +27,53 @@ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> </ImportGroup> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup> <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</LinkIncremental> <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> @@ -68,6 +96,25 @@ <TargetMachine>MachineX86</TargetMachine> </Link> </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>..\..\include;c:\Program Files\openr2\include\openr2;C:\Program Files\openr2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_R2_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalDependencies>freetdm.lib;openr2.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>C:\Program Files\openr2\lib;$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + </Link> + </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ClCompile> <AdditionalIncludeDirectories>..\..\include;C:\Program Files\openr2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> @@ -86,6 +133,23 @@ <TargetMachine>MachineX86</TargetMachine> </Link> </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <AdditionalIncludeDirectories>..\..\include;C:\Program Files\openr2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_R2_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + </Link> + </ItemDefinitionGroup> <ItemGroup> <ClCompile Include="ftmod_r2.c" /> </ItemGroup> diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.2010.vcxproj b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.2010.vcxproj index 1dd0921..78689c3 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.2010.vcxproj +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.2010.vcxproj @@ -172,7 +172,7 @@ <PrecompiledHeader> </PrecompiledHeader> <WarningLevel>Level4</WarningLevel> - <TreatWarningAsError>true</TreatWarningAsError> + <TreatWarningAsError>false</TreatWarningAsError> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> </ClCompile> diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2010.vcxproj b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2010.vcxproj index b4d234c..b0a5178 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2010.vcxproj +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2010.vcxproj @@ -5,10 +5,18 @@ <Configuration>Debug</Configuration> <Platform>Win32</Platform> </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> <ProjectConfiguration Include="Release|Win32"> <Configuration>Release</Configuration> <Platform>Win32</Platform> </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> </ItemGroup> <PropertyGroup Label="Globals"> <ProjectName>ftmod_sangoma_isdn</ProjectName> @@ -21,33 +29,58 @@ <ConfigurationType>DynamicLibrary</ConfigurationType> <WholeProgramOptimization>true</WholeProgramOptimization> </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> </ImportGroup> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup> <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Configuration)\</IntDir> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</LinkIncremental> <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> @@ -74,6 +107,29 @@ <TargetMachine>MachineX86</TargetMachine> </Link> </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>C:\Program Files\libsng_isdn\include;C:\Program Files\libsng_isdn\include\sng_isdn;../../include;C:\Program Files\Sangoma\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <ExceptionHandling> + </ExceptionHandling> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalDependencies>freetdm.lib;libsng_isdn.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>$(OutDir);C:\Program Files\libsng_isdn\lib;C:\Program Files\Sangoma\api\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + </Link> + </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ClCompile> <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> @@ -93,6 +149,23 @@ <TargetMachine>MachineX86</TargetMachine> </Link> </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + </Link> + </ItemDefinitionGroup> <ItemGroup> <ClInclude Include="ftmod_sangoma_isdn.h" /> <ClInclude Include="ftmod_sangoma_isdn_trace.h" /> commit 04a092fab5232ab0ae0b3f7b2f2e913851a27fab Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Wed Dec 1 17:10:14 2010 -0600 skypopen: a little bit of constant cleaning, and screening of A-D dtmfs (not accepted bu Skype client) - fix for FS-2891 diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index 83c409c..1263e5f 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -261,7 +261,7 @@ switch_status_t skypopen_tech_init(private_t *tech_pvt, switch_core_session_t *s ERRORA("skypopen_tech_init: no tech_pvt->session_uuid_str\n", SKYPOPEN_P_LOG); return SWITCH_STATUS_FALSE; } - if (skypopen_codec(tech_pvt, SAMPLERATE_SKYPOPEN, 20) != SWITCH_STATUS_SUCCESS) { + if (skypopen_codec(tech_pvt, SAMPLERATE_SKYPOPEN, MS_SKYPOPEN) != SWITCH_STATUS_SUCCESS) { ERRORA("skypopen_tech_init: skypopen_codec FAILED\n", SKYPOPEN_P_LOG); return SWITCH_STATUS_FALSE; } @@ -822,23 +822,23 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch tech_pvt->read_frame.flags = SFF_NONE; if (!switch_test_flag(tech_pvt, TFLAG_IO)) { - switch_sleep(20000); + switch_sleep(MS_SKYPOPEN * 1000); return SWITCH_STATUS_FALSE; } if (!switch_channel_ready(channel)) { ERRORA("channel not ready \n", SKYPOPEN_P_LOG); - switch_sleep(20000); + switch_sleep(MS_SKYPOPEN * 1000); return SWITCH_STATUS_FALSE; } if (switch_test_flag(tech_pvt, TFLAG_PROGRESS)) { //DEBUGA_SKYPE("CHANNEL READ FRAME in TFLAG_PROGRESS goto CNG\n", SKYPOPEN_P_LOG); - switch_sleep(20000); + switch_sleep(MS_SKYPOPEN * 1000); goto cng; } if (!tech_pvt->read_buffer) { - int32_t max_len = 640 * 10; + int32_t max_len = BYTES_PER_FRAME * 10; switch_buffer_create(skypopen_module_pool, &tech_pvt->read_buffer, max_len); switch_assert(tech_pvt->read_buffer); @@ -861,7 +861,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch || tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD || tech_pvt->skype_callflow == SKYPOPEN_STATE_UP)) { switch_mutex_lock(tech_pvt->mutex_audio_srv); if (tech_pvt->read_buffer && switch_buffer_inuse(tech_pvt->read_buffer)) { - bytes_read = switch_buffer_read(tech_pvt->read_buffer, tech_pvt->read_frame.data, 640); + bytes_read = switch_buffer_read(tech_pvt->read_buffer, tech_pvt->read_frame.data, BYTES_PER_FRAME); tech_pvt->read_frame.datalen = bytes_read; } switch_mutex_unlock(tech_pvt->mutex_audio_srv); @@ -873,13 +873,13 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch if (try < 5) goto read; DEBUGA_SKYPE("skypopen_audio_read Silence\n", SKYPOPEN_P_LOG); - memset(tech_pvt->read_frame.data, 255, SAMPLES_PER_FRAME * sizeof(short)); - tech_pvt->read_frame.datalen = 640; + memset(tech_pvt->read_frame.data, 255, BYTES_PER_FRAME); + tech_pvt->read_frame.datalen = BYTES_PER_FRAME; } } else { - memset(tech_pvt->read_frame.data, 255, SAMPLES_PER_FRAME * sizeof(short)); - tech_pvt->read_frame.datalen = 640; + memset(tech_pvt->read_frame.data, 255, BYTES_PER_FRAME); + tech_pvt->read_frame.datalen = BYTES_PER_FRAME; } switch_mutex_lock(tech_pvt->flag_mutex); @@ -1002,7 +1002,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc } #endif if (!tech_pvt->write_buffer) { - int32_t max_len = 640 * 3; + int32_t max_len = BYTES_PER_FRAME * 3; switch_buffer_create(skypopen_module_pool, &tech_pvt->write_buffer, max_len); switch_assert(tech_pvt->write_buffer); @@ -1017,7 +1017,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc switch_buffer_write(tech_pvt->write_buffer, frame->data, frame->datalen); switch_mutex_unlock(tech_pvt->mutex_audio_cli); if (no_space) { - switch_sleep(20000); + switch_sleep(MS_SKYPOPEN * 1000); } else { tech_pvt->begin_to_write = 1; } @@ -2161,14 +2161,14 @@ int start_audio_threads(private_t *tech_pvt) tech_pvt->begin_to_write = 0; tech_pvt->begin_to_read = 0; - if (switch_core_timer_init(&tech_pvt->timer_read, "soft", 20, 320, skypopen_module_pool) != SWITCH_STATUS_SUCCESS) { + if (switch_core_timer_init(&tech_pvt->timer_read, "soft", MS_SKYPOPEN, SAMPLES_PER_FRAME, skypopen_module_pool) != SWITCH_STATUS_SUCCESS) { ERRORA("setup timer failed\n", SKYPOPEN_P_LOG); return SWITCH_STATUS_FALSE; } switch_core_timer_sync(&tech_pvt->timer_read); - if (switch_core_timer_init(&tech_pvt->timer_write, "soft", 20, 320, skypopen_module_pool) != SWITCH_STATUS_SUCCESS) { + if (switch_core_timer_init(&tech_pvt->timer_write, "soft", MS_SKYPOPEN, SAMPLES_PER_FRAME, skypopen_module_pool) != SWITCH_STATUS_SUCCESS) { ERRORA("setup timer failed\n", SKYPOPEN_P_LOG); return SWITCH_STATUS_FALSE; } diff --git a/src/mod/endpoints/mod_skypopen/skypopen.h b/src/mod/endpoints/mod_skypopen/skypopen.h index f24eacb..4ff2b01 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen.h +++ b/src/mod/endpoints/mod_skypopen/skypopen.h @@ -75,7 +75,9 @@ #define MY_EVENT_INCOMING_RAW "skypopen::incoming_raw" #define SAMPLERATE_SKYPOPEN 16000 -#define SAMPLES_PER_FRAME SAMPLERATE_SKYPOPEN/50 +#define MS_SKYPOPEN 20 +#define SAMPLES_PER_FRAME SAMPLERATE_SKYPOPEN/(1000/MS_SKYPOPEN) +#define BYTES_PER_FRAME SAMPLES_PER_FRAME * sizeof(short) #ifdef SKYPOPEN_C_VER #ifdef MODSKYPOPEN_C_VER diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index 5c61ee6..ef06bfa 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -846,7 +846,7 @@ void *skypopen_do_tcp_srv_thread_func(void *obj) if (!(running && tech_pvt->running)) break; FD_ZERO(&fsgio); - togio.tv_usec = 20000; //20msec + togio.tv_usec = MS_SKYPOPEN * 1000; togio.tv_sec = 0; fdselectgio = s; FD_SET(fdselectgio, &fsgio); @@ -888,14 +888,14 @@ void *skypopen_do_tcp_srv_thread_func(void *obj) fdselect = fd; FD_ZERO(&fs); FD_SET(fdselect, &fs); - to.tv_usec = 60000; //60 msec + to.tv_usec = MS_SKYPOPEN * 1000 * 3; to.tv_sec = 0; rt = select(fdselect + 1, &fs, NULL, NULL, &to); if (rt > 0) { if (tech_pvt->skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) { - len = recv(fd, (char *) srv_in, 640, 0); + len = recv(fd, (char *) srv_in, BYTES_PER_FRAME, 0); } else { skypopen_sleep(10000); continue; @@ -916,13 +916,15 @@ void *skypopen_do_tcp_srv_thread_func(void *obj) if (tech_pvt->read_buffer) { if (switch_buffer_freespace(tech_pvt->read_buffer) < len) { switch_buffer_zero(tech_pvt->read_buffer); + switch_buffer_write(tech_pvt->read_buffer, srv_in, len); nospace = 1; + } else { + switch_buffer_write(tech_pvt->read_buffer, srv_in, len); } - switch_buffer_write(tech_pvt->read_buffer, srv_in, len); } switch_mutex_unlock(tech_pvt->mutex_audio_srv); if (nospace) { - DEBUGA_SKYPE("NO SPACE READ: there was no space for: %d\n", SKYPOPEN_P_LOG, len); + WARNINGA("NO SPACE READ: there was no space for: %d\n", SKYPOPEN_P_LOG, len); } } else if (len == 0) { DEBUGA_SKYPE("CLOSED\n", SKYPOPEN_P_LOG); @@ -1005,7 +1007,7 @@ void *skypopen_do_tcp_cli_thread_func(void *obj) if (!(running && tech_pvt->running)) break; FD_ZERO(&fsgio); - togio.tv_usec = 60000; //60msec + togio.tv_usec = MS_SKYPOPEN * 1000 * 3; togio.tv_sec = 0; fdselectgio = s; FD_SET(fdselectgio, &fsgio); @@ -1048,7 +1050,7 @@ void *skypopen_do_tcp_cli_thread_func(void *obj) if (tech_pvt->begin_to_write == 0) { memset(cli_out, 255, sizeof(cli_out)); - bytes_to_write = 640; + bytes_to_write = BYTES_PER_FRAME; len = send(fd, (char *) cli_out, bytes_to_write, 0); if (len == -1) { DEBUGA_SKYPE("len=%d, error: %s\n", SKYPOPEN_P_LOG, len, strerror(errno)); @@ -1065,14 +1067,14 @@ void *skypopen_do_tcp_cli_thread_func(void *obj) } switch_mutex_lock(tech_pvt->mutex_audio_cli); if (tech_pvt->write_buffer && switch_buffer_inuse(tech_pvt->write_buffer)) { - bytes_to_write = switch_buffer_read(tech_pvt->write_buffer, cli_out, 640); + bytes_to_write = switch_buffer_read(tech_pvt->write_buffer, cli_out, BYTES_PER_FRAME); } switch_mutex_unlock(tech_pvt->mutex_audio_cli); if (!bytes_to_write) { if (tech_pvt->write_silence_when_idle) { memset(cli_out, 255, sizeof(cli_out)); - bytes_to_write = 640; + bytes_to_write = BYTES_PER_FRAME; //DEBUGA_SKYPE("WRITE Silence!\n", SKYPOPEN_P_LOG); } else { continue; @@ -1118,8 +1120,12 @@ int skypopen_senddigit(private_t *tech_pvt, char digit) char msg_to_skype[1024]; DEBUGA_SKYPE("DIGIT received: %c\n", SKYPOPEN_P_LOG, digit); - sprintf(msg_to_skype, "SET CALL %s DTMF %c", tech_pvt->skype_call_id, digit); - skypopen_signaling_write(tech_pvt, msg_to_skype); + if(digit != 'a' && digit != 'A' && digit != 'b' && digit != 'B' && digit != 'c' && digit != 'C' && digit != 'd' && digit != 'D'){ + sprintf(msg_to_skype, "SET CALL %s DTMF %c", tech_pvt->skype_call_id, digit); + skypopen_signaling_write(tech_pvt, msg_to_skype); + } else { + WARNINGA("Received DTMF DIGIT \"%c\", but not relayed to Skype client because Skype client accepts only 0-9*#\n", SKYPOPEN_P_LOG, digit); + } return 0; } commit 383395d12509d35b85dcd8383e53370247596544 Author: Moises Silva <moy@sangoma.com> Date: Wed Dec 1 17:44:05 2010 -0500 freetdm: ftmod_r2 - tabs and logging fixes diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 6440c79..bdfcda7 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -316,9 +316,9 @@ static openr2_call_disconnect_cause_t ftdm_r2_ftdm_cause_to_openr2_cause(ftdm_ch static void ft_r2_clean_call(ftdm_r2_call_t *call) { - openr2_chan_t *r2chan = call->r2chan; - memset(call, 0, sizeof(*call)); - call->r2chan = r2chan; + openr2_chan_t *r2chan = call->r2chan; + memset(call, 0, sizeof(*call)); + call->r2chan = r2chan; } static void ft_r2_accept_call(ftdm_channel_t *ftdmchan) @@ -360,27 +360,24 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(r2_outgoing_call) ft_r2_clean_call(ftdmchan->call_data); R2CALL(ftdmchan)->ftdm_call_started = 1; R2CALL(ftdmchan)->chanstate = FTDM_CHANNEL_STATE_DOWN; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DIALING); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DIALING); callstatus = openr2_chan_make_call(R2CALL(ftdmchan)->r2chan, ftdmchan->caller_data.cid_num.digits, ftdmchan->caller_data.dnis.digits, OR2_CALLING_PARTY_CATEGORY_NATIONAL_SUBSCRIBER); - if (callstatus) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Failed to make call in R2 channel, openr2_chan_make_call failed\n"); - return FTDM_FAIL; - } + if (callstatus) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Failed to make call in R2 channel, openr2_chan_make_call failed\n"); + return FTDM_FAIL; + } if (ftdmchan->state != FTDM_CHANNEL_STATE_DIALING) { ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Collision after call attempt, try another channel, new state = %s\n", ftdm_channel_state2str(ftdmchan->state)); return FTDM_BREAK; } - - /* non-threaded implementation, we're done here */ - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "R2 call placed in non-threaded mode\n"); - return FTDM_SUCCESS; + return FTDM_SUCCESS; } static ftdm_status_t ftdm_r2_start(ftdm_span_t *span) @@ -447,7 +444,7 @@ static void ftdm_r2_on_call_offered(openr2_chan_t *r2chan, const char *ani, cons { ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Call offered with ANI = %s, DNIS = %s, Priority = (%d)\n", ani, dnis, category); + ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Call offered with ANI = %s, DNIS = %s, Category = (%d)\n", ani, dnis, category); ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RING); } commit 3dc8d5b09a8aefd19951f54ddbad153b3fb27877 Merge: 87d5826 35ba58e Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Wed Dec 1 20:34:02 2010 -0200 Merge branch 'master' into arnaldo.ftdm_channel_read_event Conflicts: libs/freetdm/src/ftdm_io.c libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c diff --cc libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index 17f0219,0ac628a..0fd2cd6 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@@ -850,6 -856,17 +858,16 @@@ static void wanpipe_read_stats(ftdm_cha ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_FRAME); } + if (ftdmchan->iostats.rx.queue_len >= (0.8 * ftdmchan->iostats.rx.queue_size)) { + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Rx Queue length exceeded 80% threshold (%d/%d)\n", + ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); + ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES); + } else if (ftdm_test_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES)){ - /* any reason we have wanpipe_tdm_api_iface.h in ftmod_wanpipe/ dir? */ + ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Rx Queue length reduced 80% threshold (%d/%d)\n", + ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); + ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES); + } + if (ftdmchan->iostats.rx.queue_len >= ftdmchan->iostats.rx.queue_size) { ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Rx Queue Full (%d/%d)\n", ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); commit 87d582614250e45c7a6834ffbf58911a34d0b674 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Wed Dec 1 20:18:35 2010 -0200 freetdm: Fix segfault due to race condition in ftmod_r2 processing loop Added SIGEVENT_PROCEED for ftmod_r2 Cleaned up code in main loop to use channel iterators diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 73856f0..6440c79 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -1303,6 +1303,10 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) } } else { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Notifying progress\n"); + sigev.event_id = FTDM_SIGEVENT_PROCEED; + if (ftdm_span_send_signal(ftdmchan->span, &sigev) != FTDM_SUCCESS) { + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); + } sigev.event_id = FTDM_SIGEVENT_PROGRESS_MEDIA; if (ftdm_span_send_signal(ftdmchan->span, &sigev) != FTDM_SUCCESS) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); @@ -1417,6 +1421,7 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) int res, ms; int index = 0; struct timeval start, end; + ftdm_iterator_t *chaniter = NULL; short *poll_events = ftdm_malloc(sizeof(short) * span->chan_count); #ifdef __linux__ @@ -1436,6 +1441,7 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) memset(&start, 0, sizeof(start)); memset(&end, 0, sizeof(end)); + chaniter = ftdm_span_get_chan_iterator(span, NULL); while (ftdm_running() && ftdm_test_flag(r2data, FTDM_R2_RUNNING)) { res = gettimeofday(&end, NULL); if (start.tv_sec) { @@ -1457,9 +1463,10 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) /* figure out what event to poll each channel for. POLLPRI when the channel is down, * POLLPRI|POLLIN|POLLOUT otherwise */ memset(poll_events, 0, sizeof(short)*span->chan_count); - for (i = 0; i < span->chan_count; i++) { - r2chan = R2CALL(span->channels[(i+1)])->r2chan; - ftdmchan = openr2_chan_get_client_data(r2chan); + chaniter = ftdm_span_get_chan_iterator(span, chaniter); + for (i = 0; chaniter; chaniter = ftdm_iterator_next(chaniter), i++) { + ftdmchan = ftdm_iterator_current(chaniter); + r2chan = R2CALL(ftdmchan)->r2chan; poll_events[i] = POLLPRI; if (openr2_chan_get_read_enabled(r2chan)) { poll_events[i] |= POLLIN; @@ -1481,29 +1488,36 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) continue; } - /* XXX - * when ftdm_span_poll_event() returns FTDM_SUCCESS, means there are events pending on the span. - * is it possible to know on which channels those events are pending, without traversing the span? - * XXX */ - for (i = 1; i <= span->chan_count; i++) { - r2chan = R2CALL(span->channels[i])->r2chan; - ftdmchan = openr2_chan_get_client_data(r2chan); - r2call = R2CALL(ftdmchan); + /* this main loop takes care of MF and CAS signaling during call setup and tear down + * for every single channel in the span, do not perform blocking operations here! */ + chaniter = ftdm_span_get_chan_iterator(span, chaniter); + for ( ; chaniter; chaniter = ftdm_iterator_next(chaniter)) { + ftdmchan = ftdm_iterator_current(chaniter); ftdm_mutex_lock(ftdmchan->mutex); + + r2chan = R2CALL(span->channels[i])->r2chan; + ftdm_r2_state_advance_all(ftdmchan); + openr2_chan_process_signaling(r2chan); + ftdm_r2_state_advance_all(ftdmchan); + ftdm_mutex_unlock(ftdmchan->mutex); } + /* deliver the actual events to the user now without any channel locking */ ftdm_span_trigger_signals(span); } - - for (i = 1; i <= span->chan_count; i++) { - r2chan = R2CALL(span->channels[i])->r2chan; + + chaniter = ftdm_span_get_chan_iterator(span, chaniter); + for ( ; chaniter; chaniter = ftdm_iterator_next(chaniter)) { + ftdmchan = ftdm_iterator_current(chaniter); + r2chan = R2CALL(ftdmchan)->r2chan; openr2_chan_set_blocked(r2chan); } + ftdm_iterator_free(chaniter); ftdm_safe_free(poll_events); ftdm_clear_flag(r2data, FTDM_R2_RUNNING); commit 7dcddfa8817545833b39a53486e9fdc4e510e8b7 Merge: 13e8de4 71e8ed8 Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Dec 1 17:13:38 2010 -0500 Merge branch 'smgfs' commit 71e8ed8180d50227cf324c218cd13039c51a51dd Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Dec 1 17:02:58 2010 -0500 freetdm: ISDN - Fix for not being able to open d-channel when span is in alarm diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 5ba7e38..3dd1aa9 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -1764,16 +1764,26 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_chan(ftdm_channel_t *ftdmchan) ftdm_mutex_lock(ftdmchan->mutex); - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SUSPENDED)) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "%s", "Channel is suspended\n"); - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Cannot open channel when is suspended\n"); - goto done; - } - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_IN_ALARM) && !ftdm_test_flag(ftdmchan->span, FTDM_SPAN_PWR_SAVING)) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "%s", "Channel is alarmed\n"); - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Cannot open channel when is alarmed\n"); - goto done; + if (FTDM_IS_VOICE_CHANNEL(ftdmchan)) { + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SUSPENDED)) { + snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "%s", "Channel is suspended\n"); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Cannot open channel when is suspended\n"); + goto done; + } + + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_IN_ALARM) && !ftdm_test_flag(ftdmchan->span, FTDM_SPAN_PWR_SAVING)) { + snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "%s", "Channel is alarmed\n"); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Cannot open channel when is alarmed\n"); + goto done; + } + + if (globals.cpu_monitor.alarm && + globals.cpu_monitor.alarm_action_flags & FTDM_CPU_ALARM_ACTION_REJECT) { + snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "%s", "CPU usage alarm is on - refusing to open channel\n"); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "CPU usage alarm is on - refusing to open channel\n"); + ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_SWITCH_CONGESTION; + goto done; + } } if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_READY)) { @@ -1782,15 +1792,6 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_chan(ftdm_channel_t *ftdmchan) goto done; } - if (globals.cpu_monitor.alarm && - globals.cpu_monitor.alarm_action_flags & FTDM_CPU_ALARM_ACTION_REJECT) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "%s", "CPU usage alarm is on - refusing to open channel\n"); - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "CPU usage alarm is on - refusing to open channel\n"); - ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_SWITCH_CONGESTION; - goto done; - } - - status = ftdmchan->fio->open(ftdmchan); if (status == FTDM_SUCCESS) { ftdm_set_flag(ftdmchan, FTDM_CHANNEL_OPEN | FTDM_CHANNEL_INUSE); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c index 6afab42..cce10cc 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c @@ -280,7 +280,7 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ } else if (!strcasecmp(var, "outbound-bearer_cap")) { ftdm_set_bearer_capability(val, (uint8_t*)&span->default_caller_data.bearer_capability); } else if (!strcasecmp(var, "outbound-bearer_layer1")) { - ftdm_set_bearer_layer1(val, &span->default_caller_data.bearer_layer1); + ftdm_set_bearer_layer1(val, (uint8_t*)&span->default_caller_data.bearer_layer1); } else if (!strcasecmp(var, "channel-restart-on-link-up")) { parse_yesno(var, val, &signal_data->restart_opt); } else if (!strcasecmp(var, "local-number")) { commit e1efaca21f344459a84ba5e0140b0f58df068b8e Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Dec 1 15:15:37 2010 -0500 Added restart_opt diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 6cdbde7..8027dd3 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -198,6 +198,7 @@ typedef struct sngisdn_span_data { uint8_t num_local_numbers; uint8_t ignore_cause_value; uint8_t timer_t3; + uint8_t restart_opt; char* local_numbers[SNGISDN_NUM_LOCAL_NUMBERS]; ftdm_sched_t *sched; ftdm_queue_t *event_queue; commit a5a4a7337ae256b9e7751fa1380e6991c0f1affc Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Dec 1 15:11:51 2010 -0500 Allowed state change from PROGRESS to UP diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 03b5a5f..e592624 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -134,7 +134,7 @@ ftdm_state_map_t sangoma_isdn_state_map = { ZSD_INBOUND, ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_PROGRESS, FTDM_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_END}, + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_END}, }, { ZSD_INBOUND, commit 13e8de4abaf594e90d795480f4d22fc5e61f7ed7 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Dec 1 13:07:37 2010 -0600 FS-2872 diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 4d320d0..1f9f7ac 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -433,19 +433,21 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) if (ans_a != ans_b) { switch_channel_t *un = ans_a ? chan_b : chan_a; + switch_channel_t *a = un == chan_b ? chan_a : chan_b; - if (!switch_channel_test_flag(un, CF_OUTBOUND)) { - switch_channel_pass_callee_id(un == chan_b ? chan_a : chan_b, un); + if ((!switch_channel_test_flag(un, CF_OUTBOUND) && switch_channel_test_flag(a, CF_OUTBOUND)) || (un == chan_a && !originator)) { + switch_channel_pass_callee_id(a, un); if (switch_channel_answer(un) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Media Establishment Failed.\n", switch_channel_get_name(un)); goto end_of_bridge_loop; } - } - if (ans_a) - ans_b = 1; - else - ans_a = 1; + if (ans_a) { + ans_b = 1; + } else { + ans_a = 1; + } + } } if (originator && !sent_update && ans_a && ans_b && switch_channel_media_ack(chan_a) && switch_channel_media_ack(chan_b)) { commit 5df1683c38851b71ac0f74fbf058e32437140c55 Author: Geovani Ricardo Wiedenhoft <grw@geovani.(none)> Date: Wed Dec 1 16:40:35 2010 -0200 - Notifies the pre_answer - Dialplan examples - New version of commons - Priority of contexts - New K3L install script - getk3l.sh - CLI return in XML - More options in GET and SET commands - Events (ESL) to send/receive SMS. - fax-adjustment-timeout implemented - accountcode and language - Owner destroy - Destroy wait for resources release - static const expression - Hangup cause diff --git a/build/modules.conf.in b/build/modules.conf.in index 37244a1..13e6556 100644 --- a/build/modules.conf.in +++ b/build/modules.conf.in @@ -62,6 +62,7 @@ endpoints/mod_loopback #endpoints/mod_skinny #endpoints/mod_skypopen #endpoints/mod_h323 +#endpoints/mod_khomp #../../libs/openzap/mod_openzap #../../libs/freetdm/mod_freetdm #asr_tts/mod_unimrcp @@ -105,5 +106,4 @@ say/mod_say_ru #say/mod_say_th ## Experimental Modules (don't cry if they're broken) -#endpoints/mod_khomp #../../contrib/mod/xml_int/mod_xml_odbc diff --git a/conf/autoload_configs/modules.conf.xml b/conf/autoload_configs/modules.conf.xml index f5627fe..118d7c4 100644 --- a/conf/autoload_configs/modules.conf.xml +++ b/conf/autoload_configs/modules.conf.xml @@ -38,6 +38,7 @@ <!-- <load module="mod_openzap"/> --> <!-- <load module="mod_unicall"/> --> <!-- <load module="mod_skinny"/> --> + <!-- <load module="mod_khomp"/> --> <!-- Applications --> <load module="mod_commands"/> diff --git a/src/mod/endpoints/mod_khomp/Install/files/khomp.conf.xml b/src/mod/endpoints/mod_khomp/Install/files/khomp.conf.xml index 45268f3..79c0051 100644 --- a/src/mod/endpoints/mod_khomp/Install/files/khomp.conf.xml +++ b/src/mod/endpoints/mod_khomp/Install/files/khomp.conf.xml @@ -96,16 +96,6 @@ should be opened for the channel. Limited to 25ms min, 500ms max. --> <!-- -Enable/disable native bridge mode (known in pt_BR as "trombone") for calls -in the Khomp channel, passing the audio inside the board when both channels -(incoming and outgoing) are of type Khomp. This reduces the echo and the -audio delay, and frees the host from most audio processing. -(default = yes) - -<param name="native-bridge" value="yes"/> ---> - -<!-- Defines the incoming context for calls on E1 channels. Some wildcards are accepted, and described in the bottom of this file. (default = khomp-DD-LL) @@ -240,47 +230,29 @@ is enabled on the board configuration. Possible values: --> <!-- -Sets the default AMA flags, affecting the categorization of entries in -the call detail records. -(default = default) - -<param name="amaflags" value="default"/> ---> - -<!-- Sets the account code for calls placed on the channel. The account code may be any alphanumeric string -(default = KhompBoard) +default = <empty>) -<param name="accountcode" value="KhompBoard"/> +<param name="accountcode" value=""/> --> <!-- Set the language of the channel (useful for selecting audio messages of a specific language on answer). + (default = <empty>) <param name="language" value="pt_BR"/> --> <!-- -Set the music on hold class of the channel (useful for selecting a group of -songs to play on hold). -(default = default) - -<param name="mohclass" value="default"/> ---> - -<!-- Sets the global orig (CALLERID) base for FXS boards. This number is added to a sequencial number, which is incremented for each FXS board and FXS channel in the system. - -For more example of how to use this option, see channel README file, -section 'Opcoes do application Bridge', item '<action application="bridge" data="Khomp/r304" />'. (default = 0) -<param name="fxs-global-orig" value="0200"/> +<param name="fxs-global-orig" value="0"/> --> <!-- @@ -301,14 +273,6 @@ a FXS branch. --> <!-- -Enable/disable using CTbus for Khomp CTI boards in native bridge. -(WARNING: just used for internal testings!) -(default = no) - -<param name="has-ctbus" value="no"/> ---> - -<!-- This is the delay time to really disconnect a channel after the disconnect event arrive. If a connect event comes up in this interval, then the disconnection is ignored and the call keeps going on. Values in ms. @@ -338,18 +302,6 @@ not have any tone. Values are in milliseconds. --> <!-- -Defines if the channel should optimize audio delay by droping longstanding -packets from audio buffer. This guarantees the minimal audio delay for the -user, and avoid delays associated with miscoded SIP clients. However, -depending on the system's scheduling policy (some 2.6 kernel releases), -this may result on excessive drop of packets, and audible audio skipping. -This should not be changed naively. -(default = no) - -<param name="optimize-audio-path" value="no"/> ---> - -<!-- Defines if the channel should ignore some uncommon DTMF digits detected by the board (A, B, C and D). This reduces the number of false positives which may happen sometimes, without affecting correctness on traditional @@ -526,9 +478,8 @@ In the example above, the branch numbered 804 will have specific configuration for default output volume set to +2. Possible values to options is: -context, input-volume, output-volume language, -mohclass, amaflags, accountcode, calleridnum, -calleridname, mailbox, flash-to-digits. +context, input-volume, output-volume, language, +accountcode, calleridnum, calleridname, flash-to-digits. --> </fxs-options> diff --git a/src/mod/endpoints/mod_khomp/Makefile b/src/mod/endpoints/mod_khomp/Makefile index 94923c7..db1a6fe 100644 --- a/src/mod/endpoints/mod_khomp/Makefile +++ b/src/mod/endpoints/mod_khomp/Makefile @@ -1,6 +1,9 @@ MODNAME := mod_khomp VERBOSE := 1 +#FreeSWITCH source PATH is needed: +# Set FREESWITCH_PATH + ifeq ($(strip $(FREESWITCH_PATH)),) BASE := ../../../../ else @@ -11,12 +14,12 @@ curr_dir := $(shell pwd) versions := -DFS_VERSION_MAJOR=$(shell bash $(curr_dir)/tools/getversion.sh "SWITCH_VERSION_MAJOR" $(BASE)) -DFS_VERSION_MINOR=$(shell bash $(curr_dir)/tools/getversion.sh "SWITCH_VERSION_MINOR" $(BASE)) -DFS_VERSION_MICRO=$(shell bash $(curr_dir)/tools/getversion.sh "SWITCH_VERSION_MICRO" $(BASE)) -LOCAL_CFLAGS = -I./ -I./include -I./commons -I./support -D_REENTRANT -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DK3L_HOSTSYSTEM -DCOMMONS_LIBRARY_USING_FREESWITCH -g -ggdb #-DDEBUG_FLAGS +LOCAL_CFLAGS = -I./ -I./include -I./commons -I./commons/base -I./support -D_REENTRANT -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DK3L_HOSTSYSTEM -DCOMMONS_LIBRARY_USING_FREESWITCH -g -ggdb #-DDEBUG_FLAGS LOCAL_CFLAGS += $(versions) LOCAL_LDFLAGS = -lk3l -LOCAL_OBJS = ./commons/k3lapi.o ./commons/k3lutil.o ./commons/config_options.o ./commons/format.o ./commons/strings.o ./commons/ringbuffer.o ./commons/verbose.o ./commons/saved_condition.o ./commons/regex.o ./commons/timer.o ./commons/configurator/configfile.o ./commons/configurator/option.o ./commons/configurator/section.o ./commons/configurator/restriction.o +LOCAL_OBJS = ./commons/base/k3lapi.o ./commons/base/k3lutil.o ./commons/base/config_options.o ./commons/base/format.o ./commons/base/strings.o ./commons/base/ringbuffer.o ./commons/base/verbose.o ./commons/base/saved_condition.o ./commons/base/regex.o ./commons/base/timer.o ./commons/base/configurator/configfile.o ./commons/base/configurator/option.o ./commons/base/configurator/section.o ./commons/base/configurator/restriction.o ./commons/base/verbose_traits.o LOCAL_OBJS += ./support/klog-config.o ./support/klog-options.o ./support/config_defaults.o LOCAL_OBJS += ./src/globals.o ./src/opt.o ./src/frame.o ./src/utils.o ./src/lock.o ./src/spec.o ./src/applications.o ./src/khomp_pvt_fxo.o ./src/khomp_pvt_gsm.o ./src/khomp_pvt_kxe1.o ./src/khomp_pvt_passive.o ./src/khomp_pvt.o ./src/logger.o ./src/cli.o @@ -27,7 +30,20 @@ conf_file_install = $(sysconfdir)/autoload_configs include $(BASE)/build/modmake.rules +local_depend: + @if test ! -f $(curr_dir)/commons/base/verbose_traits.hpp || test ! -f $(curr_dir)/commons/base/verbose_traits.cpp ; then \ + echo "Generating verbose_traits" ;\ + bash $(curr_dir)/commons/tools/generate-verbose-headers.sh commons/base/ include/k3l.h ;\ + fi; + depend_install: + @if test "w`kserver --version 2>/dev/null | grep 2.1`" == "w" ; then \ + echo "###############################################################################" ;\ + echo "Install k3l from KHOMP." ;\ + echo "Run: $(curr_dir)/tools/getk3l.sh" ;\ + echo "###############################################################################" ;\ + exit 1;\ + fi; @echo "Copy $(conf_file_name)" @if test -d $(conf_file_install) ; then \ if test -f $(conf_file_dir)/$(conf_file_name) ; then \ diff --git a/src/mod/endpoints/mod_khomp/commons/atomic.hpp b/src/mod/endpoints/mod_khomp/commons/base/atomic.hpp similarity index 90% rename from src/mod/endpoints/mod_khomp/commons/atomic.hpp rename to src/mod/endpoints/mod_khomp/commons/base/atomic.hpp index daa598c..02278b3 100644 --- a/src/mod/endpoints/mod_khomp/commons/atomic.hpp +++ b/src/mod/endpoints/mod_khomp/commons/base/atomic.hpp @@ -64,17 +64,31 @@ namespace Atomic PunnedType pval; pval.valtype = VAL; \ unsigned long long vexp = *(pexp.podtype); \ unsigned long long vval = *(pval.podtype); \ - unsigned long long res = (unsigned long long)exp; \ + unsigned long vval32 = (unsigned long)vval; \ unsigned char chg = 0; \ - asm volatile("lock; cmpxchg8b %2; sete %1;" \ + asm volatile( \ + "xchgl %%ebx, %4;" \ + "lock; cmpxchg8b %2; sete %1;" \ + "movl %4, %%ebx; " \ : "+A" (vexp), /* 0 (result) */ \ - "=q" (chg) /* 1 */ \ + "=c" (chg) /* 1 */ \ : "m" (*(unsigned char**)(PTR)), /* 2 */ \ - "b" ((unsigned long)(vval)), \ - "c" ((unsigned long)(vval >> 32))); \ + "c" ((unsigned long)(vval >> 32)), \ + "m" (vval32)); \ *(pexp.podtype) = vexp; \ return (chg != 0 ? true : false); +// "movl %%ecx, %4;" +// +// "m" (*((unsigned long*)(*(pval.podtype)))), +// "m" ((unsigned long)(vval >> 32)) +// +// "m" (*((unsigned long*)(&vval))), +// "m" ((unsigned long)(vval >> 32)) +// +// unsigned long long vval = *(pval.podtype); +// unsigned long long res = (unsigned long long)exp; +// // Types used for making CMPXCHG instructions independent from base type. template < typename ValType, typename PodType > diff --git a/src/mod/endpoints/mod_khomp/commons/config_commons.hpp b/src/mod/endpoints/mod_khomp/commons/base/config_commons.hpp similarity index 92% rename from src/mod/endpoints/mod_khomp/commons/config_commons.hpp rename to src/mod/endpoints/mod_khomp/commons/base/config_commons.hpp index de8f327..dad16f4 100644 --- a/src/mod/endpoints/mod_khomp/commons/config_commons.hpp +++ b/src/mod/endpoints/mod_khomp/commons/base/config_commons.hpp @@ -63,7 +63,12 @@ #error Unknown implementation selected. Please define COMMONS_LIBRARY_USING_* correctly. #endif -#define COMMONS_INCLUDE(file) <COMMONS_IMPLEMENTATION/file> +#define COMMONS_INCLUDE(file) <system/COMMONS_IMPLEMENTATION/file> -#endif /* _CONFIG_COMMONS_HPP_ */ +#define COMMONS_VERSION_MAJOR 1 +#define COMMONS_VERSION_MINOR 1 + +#define COMMONS_AT_LEAST(x,y) \ + (COMMONS_VERSION_MAJOR > x || (COMMONS_VERSION_MAJOR == x && COMMONS_VERSION_MINOR >= y)) +#endif /* _CONFIG_COMMONS_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/base/config_options.cpp b/src/mod/endpoints/mod_khomp/commons/base/config_options.cpp new file mode 100644 index 0000000..7412b4b --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/base/config_options.cpp @@ -0,0 +1,302 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <config_options.hpp> + +void Config::Restriction::checkRange(const std::string & name, const SIntType value, const Range < SIntType > & range) +{ + if (value < range.minimum) + throw Failure(STG(FMT("value '%d' out-of-range for option '%s' (too low)") % value % name)); + + if (value > range.maximum) + throw Failure(STG(FMT("value '%d' out-of-range for option '%s' (too high)") % value % name)); + + if (((value - range.minimum) % range.step) != 0) + throw Failure(STG(FMT("value '%d' out-of-range for option '%s' (outside allowed step)") % value % name)); +} + +void Config::Restriction::checkRange(const std::string & name, const UIntType value, const Range < UIntType > & range) +{ + if (value < range.minimum) + throw Failure(STG(FMT("value '%d' out-of-range for option '%s' (too low)") % value % name)); + + if (value > range.maximum) + throw Failure(STG(FMT("value '%d' out-of-range for option '%s' (too high)") % value % name)); + + if (((value - range.minimum) % range.step) != 0) + throw Failure(STG(FMT("value '%d' out-of-range for option '%s' (outside allowed step)") % value % name)); +} + +void Config::Restriction::checkStringSet(const std::string & name, const StringType & value, const StringSet & allowed) +{ + if (allowed.empty()) + return; + + if (allowed.find(value) != allowed.end()) + return; + + std::string strlist; + + for (StringSet::const_iterator i = allowed.begin(); i != allowed.end(); i++) + { + strlist += " '"; + strlist += (*i); + strlist += "'"; + } + + throw Failure(STG(FMT("value '%s' not allowed for option '%s' (allowed values:%s)") + % value % name % strlist)); +} + +Config::Option::Option(std::string name, Config::Option::StringMemberType value, const StringType defvalue, StringSet & allowed, bool listme) +: _myname(name), _option(InnerStringType(name, value, defvalue, allowed)), _listme(listme), _values(NULL) +{}; + +Config::Option::Option(std::string name, Config::Option::StringMemberType value, const StringType defvalue, bool listme) +: _myname(name), _option(InnerStringType(name, value, defvalue)), _listme(listme), _values(NULL) +{}; + +Config::Option::Option(std::string name, Config::Option::BooleanMemberType value, const BooleanType defvalue, bool listme) +: _myname(name), _option(InnerBooleanType(name, value, defvalue)), _listme(listme), _values(NULL) +{}; + +Config::Option::Option(std::string name, Config::Option::SIntMemberType value, const SIntType defvalue, + SIntType min, SIntType max, SIntType step, bool listme) +: _myname(name), _option(InnerSIntType(name, value, defvalue, min, max, step)), _listme(listme), _values(NULL) +{}; + +Config::Option::Option(std::string name, Config::Option::UIntMemberType value, const UIntType defvalue, + UIntType min, UIntType max, UIntType step, bool listme) +: _myname(name), _option(InnerUIntType(name, value, defvalue, min, max, step)), _listme(listme), _values(NULL) +{}; + +Config::Option::Option(const Config::Option & o) +: _myname(o._myname), _option(o._option), _listme(o._listme), _values(o._values) +{}; + +Config::Option::Option(std::string name, Config::Option::FunctionMemberType value, const StringType defvalue, StringSet & allowed, bool listme) +: _myname(name), _option(InnerFunctionType(name, value, defvalue, allowed)), _listme(listme), _values(NULL) +{}; + +Config::Option::Option(std::string name, Config::Option::FunctionMemberType value, const StringType defvalue, bool listme) +: _myname(name), _option(InnerFunctionType(name, value, defvalue)), _listme(listme), _values(NULL) +{}; + +Config::Option::~Option(void) +{ + if (_values) + { + for (unsigned int i = 0; _values[i] != NULL; i++) + delete _values[i]; + + delete[] _values; + _values = NULL; + } +}; + +const char ** Config::Option::values(void) +{ + if (_values != NULL) + return _values; + + /**/ if (_option.check<InnerBooleanType>()) + { + _values = new const char*[3]; + + _values[0] = strdup("yes"); + _values[1] = strdup("no"); + _values[2] = NULL; + + } + else if (_option.check<InnerSIntType>()) + { + const InnerSIntType & tmp = _option.get<InnerSIntType>(); + + unsigned int count = ((tmp._range.maximum - tmp._range.minimum) / tmp._range.step) + 1; + unsigned int index = 0; + + _values = new const char*[count + 1]; + + for (SIntType i = tmp._range.minimum; i <= tmp._range.maximum; i += tmp._range.step, ++index) + _values[index] = strdup(STG(FMT("%d") % i).c_str()); + + _values[index] = NULL; + } + else if (_option.check<InnerUIntType>()) + { + const InnerUIntType & tmp = _option.get<InnerUIntType>(); + + unsigned int count = ((tmp._range.maximum - tmp._range.minimum) / tmp._range.step) + 1; + unsigned int index = 0; + + _values = new const char*[count + 1]; + + for (UIntType i = tmp._range.minimum; i <= tmp._range.maximum; i += tmp._range.step, ++index) + _values[index] = strdup(STG(FMT("%d") % i).c_str()); + + _values[index] = NULL; + } + else if (_option.check<InnerStringType>()) + { + const InnerStringType & tmp = _option.get<InnerStringType>(); + + _values = new const char*[ tmp._allowed.size() + 1 ]; + + unsigned int index = 0; + + for (StringSet::iterator i = tmp._allowed.begin(); i != tmp._allowed.end(); ++i, ++index) + _values[index] = strdup((*i).c_str()); + + _values[index] = NULL; + } + else if (_option.check<InnerFunctionType>()) + { + const InnerFunctionType & tmp = _option.get<InnerFunctionType>(); + + _values = new const char*[ tmp._allowed.size() + 1 ]; + + unsigned int index = 0; + + for (StringSet::iterator i = tmp._allowed.begin(); i != tmp._allowed.end(); ++i, ++index) + _values[index] = strdup((*i).c_str()); + + _values[index] = NULL; + } + else + { + throw Failure(STG(FMT("values() not implemented for type used in option '%s'") % _myname)); + } + + return _values; +}; + +/*********************************/ + +Config::Options::Options(void) +: _values(NULL) +{}; + +Config::Options::~Options() +{ + if (_values) + { + for (unsigned int i = 0; _values[i] != NULL; i++) + free((void*)(_values[i])); + + delete[] _values; + _values = NULL; + } +}; + +bool Config::Options::add(Config::Option option) +{ + std::pair<OptionMap::iterator, bool> ret = _map.insert(OptionPair(option.name(), option)); + + return ret.second; +} + +bool Config::Options::synonym(std::string equiv_opt, std::string main_opt) +{ + std::pair<SynOptionMap::iterator, bool> ret = _syn_map.insert(SynOptionPair(equiv_opt, main_opt)); + + return ret.second; +} + +Config::StringSet Config::Options::options(void) +{ + StringSet res; + + for (OptionMap::iterator i = _map.begin(); i != _map.end(); i++) + res.insert(i->first); + + return res; +} + +const char ** Config::Options::values(const char * name) +{ + OptionMap::iterator iter = find_option(name); + + if (iter == _map.end()) + throw Failure(STG(FMT("unknown option '%s'") % name)); + + return iter->second.values(); +} + +const char ** Config::Options::values(void) +{ + if (_values != NULL) + return _values; + + unsigned int count = 0; + + for (OptionMap::iterator i = _map.begin(); i != _map.end(); ++i) + if (i->second.listme()) + ++count; + + _values = new const char*[ count + 1 ]; + + unsigned int index = 0; + + for (OptionMap::iterator i = _map.begin(); i != _map.end(); ++i) + { + if (i->second.listme()) + { + _values[index] = strdup(i->first.c_str()); + ++index; + } + } + + _values[index] = NULL; + + return _values; +} + +Config::Options::OptionMap::iterator Config::Options::find_option(std::string name) +{ + SynOptionMap::iterator syn_iter = _syn_map.find(name); + + if (syn_iter != _syn_map.end()) + name = syn_iter->second; + + OptionMap::iterator iter = _map.find(name); + + return iter; +} diff --git a/src/mod/endpoints/mod_khomp/commons/base/config_options.hpp b/src/mod/endpoints/mod_khomp/commons/base/config_options.hpp new file mode 100644 index 0000000..59e381f --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/base/config_options.hpp @@ -0,0 +1,772 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#ifndef _CONFIG_OPTIONS_HPP_ +#define _CONFIG_OPTIONS_HPP_ + +#include <set> +#include <map> +#include <vector> +#include <stdexcept> + +#include <strings.hpp> +#include <format.hpp> +#include <tagged_union.hpp> +#include <function.hpp> +#include <variable.hpp> + +namespace Config +{ + /* exceptions */ + + struct Failure: public std::runtime_error + { + Failure(const std::string & msg) : std::runtime_error(msg) {}; + }; + + struct EmptyValue: public std::runtime_error + { + EmptyValue(): std::runtime_error("accessed option still not loaded from configuration") {}; + }; + + /* types */ + + typedef int SIntType; + typedef unsigned int UIntType; + typedef bool BooleanType; + typedef std::string StringType; + + template < typename Type > + struct Value; + + template < typename Type > + struct InnerOptionBase; + + template < typename Type > + struct InnerOption; + + struct Option; + + /* here we go! */ + + template < typename Type > + struct Range + { + Range(const Type _minimum, const Type _maximum, const Type _step) + : minimum(_minimum), maximum(_maximum), step(_step) {}; + + const Type minimum, maximum, step; + }; + + typedef std::set < std::string > StringSet; + + template < typename Type > + struct Value: COUNTER_SUPER(Value < Type >) + { + friend class COUNTER_CLASS(Value < Type >); + friend class InnerOptionBase< Type >; + friend class InnerOption < Type >; + friend class Option; + + Value() + : _tmpval(0), _stored(0), _loaded(false), _inited(false) + {}; + + Value(const Value & o) + : COUNTER_REFER(o, Value < Type >), + _tmpval(o._tmpval), _stored(o._stored), + _loaded(o._loaded), _inited(o._inited) + {}; + + const Type & operator()(void) const + { + if (!_inited) + throw EmptyValue(); + + if (!_stored) + return *_tmpval; + + return *_stored; + }; + + const Type & get(void) const { return operator()(); }; + bool loaded(void) const { return _loaded; }; + + void store(const Type val) + { + if (_tmpval) + { + delete _tmpval; + _tmpval = 0; + } + + _tmpval = new Type(val); + + _loaded = true; + _inited = true; + } + + protected: + void unreference(void) + { + _inited = false; + _loaded = false; + + if (_tmpval) + { + delete _tmpval; + _tmpval = 0; + } + + if (_stored) + { + delete _stored; + _stored = 0; + } + }; + + protected: + void commit(Type def) + { + if (_tmpval) + { + { + delete _stored; + _stored = 0; + } + + _stored = _tmpval; + _tmpval = 0; + } + else + { + if (!_stored) + _stored = new Type(def); + } + + _loaded = true; + _inited = true; + }; + + void reset(void) + { + _loaded = false; + } + + protected: + const Type * _tmpval; + const Type * _stored; + bool _loaded; + bool _inited; + }; + + struct FunctionValue + { + friend class InnerFunctionType; + friend class Option; + + FunctionValue() + : _loaded(false), _inited(false) {}; + + virtual ~FunctionValue() {}; + + public: + virtual void operator()(const StringType & val) + { + throw Failure("undefined operator() for value"); + } + + const StringType & get(void) const + { + if (!_inited) + throw EmptyValue(); + + return _stored; + }; + + bool loaded(void) const { return _loaded; }; + + protected: + void commit(const StringType def) + { + if (_tmpval.empty()) + { + _stored = def; + } + else + { + _stored = _tmpval; + _tmpval.clear(); + } + + operator()(_stored); + + _loaded = true; + _inited = true; + }; + + void store(const StringType val) + { + _tmpval = val; + _loaded = true; + _inited = true; + } + + void reset(void) + { + _loaded = false; + } + + private: + StringType _tmpval; + StringType _stored; + bool _loaded; + bool _inited; + }; + + /* NOTE: we use a non-templated classe to place this functions inside the .cpp */ + struct Restriction + { + static void checkRange(const std::string & name, const SIntType value, const Range < SIntType > & range); + static void checkRange(const std::string & name, const UIntType value, const Range < UIntType > & range); + static void checkStringSet(const std::string & name, const StringType & value, const StringSet & allowed); + }; + + template < typename Type > + struct InnerOptionBase + { + typedef Variable < Value < Type > > MemberValue; + + InnerOptionBase(const std::string name, MemberValue option, const Type defvalue) + : _name(name), _option(option), _default(defvalue) {}; + + template < typename Object > + void reset(Object * const obj) const + { + _option(obj).reset(); + } + + template < typename Object > + const Type & get(const Object * const obj) const + { + return _option(obj).get(); + } + + template < typename Object > + bool loaded(const Object * const obj) const + { + return _option(obj).loaded(); + } + + protected: + const std::string _name; + MemberValue _option; + const Type _default; + }; + + template < > + struct InnerOption < SIntType >: public InnerOptionBase < SIntType > + { + typedef InnerOptionBase < SIntType > Super; + typedef Super::MemberValue MemberValue; + + InnerOption(const std::string name, MemberValue option, const SIntType defval, + const SIntType min, const SIntType max, const SIntType step) + : Super(name, option, defval), _range(min, max, step) {}; + + template < typename Object > + void commit(Object * const obj) const + { + Restriction::checkRange(_name, _default, _range); + _option(obj).commit(_default); + }; + + template < typename Object > + void store(Object * const obj, const SIntType stored) const + { + Restriction::checkRange(_name, _default, _range); + _option(obj).store(stored); + } + + using Super::reset; + using Super::get; + + const Range< SIntType > _range; + }; + + template < > + struct InnerOption < UIntType >: public InnerOptionBase < UIntType > + { + typedef InnerOptionBase < UIntType > Super; + typedef Super::MemberValue MemberValue; + + InnerOption(const std::string name, MemberValue option, const UIntType defval, + const UIntType min, const UIntType max, const UIntType step) + : Super(name, option, defval), _range(min, max, step) {}; + + template < typename Object > + void commit(Object * const obj) const + { + Restriction::checkRange(_name, _default, _range); + _option(obj).commit(_default); + }; + + template < typename Object > + void store(Object * const obj, const UIntType stored) const + { + Restriction::checkRange(_name, _default, _range); + _option(obj).store(stored); + } + + using Super::reset; + using Super::get; + + const Range< UIntType > _range; + }; + + template < > + struct InnerOption < BooleanType >: public InnerOptionBase < BooleanType > + { + typedef InnerOptionBase < BooleanType > Super; + typedef Super::MemberValue MemberValue; + + InnerOption(std::string name, MemberValue option, BooleanType defval) + : Super(name, option, defval) {}; + + template < typename Object > + void commit(Object * obj) const + { + _option(obj).commit(_default); + }; + + template < typename Object > + void store(Object * obj, BooleanType stored) const + { + _option(obj).store(stored); + } + + using Super::reset; + using Super::get; + }; + + template < > + struct InnerOption < StringType >: public InnerOptionBase < StringType > + { + typedef InnerOptionBase < StringType > Super; + typedef Super::MemberValue MemberValue; + + InnerOption(const std::string name, MemberValue option, const StringType defval, const StringSet & allowed) + : Super(name, option, defval), _allowed(allowed) {}; + + InnerOption(const std::string name, MemberValue option, const StringType defval) + : Super(name, option, defval) {}; + + template < typename Object > + void commit(Object * const obj) const + { + Restriction::checkStringSet(_name, _default, _allowed); + _option(obj).commit(_default); + }; + + template < typename Object > + void store(Object * const obj, const StringType stored) const + { + Restriction::checkStringSet(_name, _default, _allowed); + _option(obj).store(stored); + } + + using Super::reset; + using Super::get; + + const StringSet _allowed; + }; + + struct InnerFunctionType + { + typedef Variable < FunctionValue > MemberValue; + + InnerFunctionType(const std::string name, MemberValue option, const StringType defval, const StringSet & allowed) + : _name(name), _option(option), _default(defval), _allowed(allowed) {}; + + InnerFunctionType(const std::string name, MemberValue option, const StringType defval) + : _name(name), _option(option), _default(defval) {}; + + template < typename Object > + const StringType & get(const Object * const obj) const + { + return _option(obj).get(); + } + + template < typename Object > + bool loaded(const Object * const obj) const + { + return _option(obj).loaded(); + } + + template < typename Object > + void reset(Object * const obj) const + { + _option(obj).reset(); + } + + template < typename Object > + void commit(Object * const obj) const + { + Restriction::checkStringSet(_name, _default, _allowed); + _option(obj).commit(_default); + }; + + template < typename Object > + void store(Object * const obj, const StringType stored) const + { + Restriction::checkStringSet(_name, _default, _allowed); + _option(obj).store(stored); + } + + protected: + const std::string _name; + MemberValue _option; + const StringType _default; + + public: + const StringSet _allowed; + }; + + struct Option + { + typedef InnerOption < SIntType > InnerSIntType; + typedef InnerOption < UIntType > InnerUIntType; + typedef InnerOption < BooleanType > InnerBooleanType; + typedef InnerOption < StringType > InnerStringType; + + typedef Variable < Value < SIntType > > SIntMemberType; + typedef Variable < Value < UIntType > > UIntMemberType; + typedef Variable < Value < BooleanType > > BooleanMemberType; + typedef Variable < Value < StringType > > StringMemberType; + + typedef Variable < FunctionValue > FunctionMemberType; + + typedef Tagged::Union < InnerStringType, + Tagged::Union < InnerBooleanType, + Tagged::Union < InnerSIntType , + Tagged::Union < InnerUIntType, + Tagged::Union < InnerFunctionType > > > > > + InnerType; + + explicit Option(std::string, StringMemberType, const StringType, StringSet & allowed, bool listme = true); + explicit Option(std::string, StringMemberType, const StringType = "", bool listme = true); + explicit Option(std::string, SIntMemberType, const SIntType = 0, SIntType min = INT_MIN, SIntType max = INT_MAX, SIntType step = 1, bool listme = true); + explicit Option(std::string, UIntMemberType, const UIntType = 0, UIntType min = 0, UIntType max = UINT_MAX, UIntType step = 1, bool listme = true); + explicit Option(std::string, BooleanMemberType, const BooleanType = false, bool listme = true); + + explicit Option(std::string, FunctionMemberType, const StringType, StringSet & allowed, bool listme = true); + explicit Option(std::string, FunctionMemberType, const StringType = "", bool listme = true); + + Option(const Option & o); + + ~Option(void); + + template < typename Object > + void set(Object * object, std::string value) + { + try + { + /**/ if (_option.check<InnerFunctionType>()) _option.get<InnerFunctionType>().store(object, value); + else if (_option.check<InnerStringType>()) _option.get<InnerStringType>().store(object, value); + else if (_option.check<InnerBooleanType>()) _option.get<InnerBooleanType>().store(object, Strings::toboolean(value)); + else if (_option.check<InnerSIntType>()) _option.get<InnerSIntType>().store(object, Strings::tolong(value)); + else if (_option.check<InnerUIntType>()) _option.get<InnerUIntType>().store(object, Strings::toulong(value)); + else + { + throw Failure(STG(FMT("set() not implemented for type used in option '%s'") % _myname)); + } + } + catch (Strings::invalid_value & e) + { + throw Failure(STG(FMT("got invalid value '%s' for option '%s'") % value % _myname)); + } + catch (EmptyVariable & e) + { + throw Failure(STG(FMT("uninitialized variable while setting value '%s' for option '%s'") % value % _myname)); + } + } + + template < typename Object > + std::string get(const Object * const object) const + { + try + { + /**/ if (_option.check<InnerFunctionType>()) return _option.get<InnerFunctionType>().get(object); + else if (_option.check<InnerStringType>()) return _option.get<InnerStringType>().get(object); + else if (_option.check<InnerBooleanType>()) return (_option.get<InnerBooleanType>().get(object) ? "yes" : "no"); + else if (_option.check<InnerSIntType>()) return STG(FMT("%d") % _option.get<InnerSIntType>().get(object)); + else if (_option.check<InnerUIntType>()) return STG(FMT("%u") % _option.get<InnerUIntType>().get(object)); + else + { + throw Failure(STG(FMT("get() not implemented for type used in option '%s'") % _myname)); + } + } + catch (EmptyVariable & e) + { + throw Failure(STG(FMT("uninitialized variable while getting value for option '%s'") % _myname)); + } + } + + template < typename Object > + bool loaded(const Object * const object) const + { + try + { + /**/ if (_option.check<InnerFunctionType>()) return _option.get<InnerFunctionType>().loaded(object); + else if (_option.check<InnerBooleanType>()) return _option.get<InnerBooleanType>().loaded(object); + else if (_option.check<InnerStringType>()) return _option.get<InnerStringType>().loaded(object); + else if (_option.check<InnerSIntType>()) return _option.get<InnerSIntType>().loaded(object); + else if (_option.check<InnerUIntType>()) return _option.get<InnerUIntType>().loaded(object); + else + { + throw Failure(STG(FMT("loaded() not implemented for type used in option '%s'") % _myname)); + } + } + catch (EmptyVariable & e) + { + throw Failure(STG(FMT("uninitialized variable while checking load status for option '%s'") % _myname)); + } + } + + template < typename Object > + void reset(Object * const object) + { + try + { + /**/ if (_option.check<InnerFunctionType>()) _option.get<InnerFunctionType>().reset(object); + else if (_option.check<InnerBooleanType>()) _option.get<InnerBooleanType>().reset(object); + else if (_option.check<InnerStringType>()) _option.get<InnerStringType>().reset(object); + else if (_option.check<InnerSIntType>()) _option.get<InnerSIntType>().reset(object); + else if (_option.check<InnerUIntType>()) _option.get<InnerUIntType>().reset(object); + else + { + throw Failure(STG(FMT("reset() not implemented for type used in option '%s'") % _myname)); + } + } + catch (EmptyVariable & e) + { + throw Failure(STG(FMT("uninitialized variable while reseting status for option '%s'") % _myname)); + } + } + + template < typename Object > + void commit(Object * const object) + { + try + { + /**/ if (_option.check<InnerFunctionType>()) _option.get<InnerFunctionType>().commit(object); + else if (_option.check<InnerBooleanType>()) _option.get<InnerBooleanType>().commit(object); + else if (_option.check<InnerStringType>()) _option.get<InnerStringType>().commit(object); + else if (_option.check<InnerSIntType>()) _option.get<InnerSIntType>().commit(object); + else if (_option.check<InnerUIntType>()) _option.get<InnerUIntType>().commit(object); + else + { + throw Failure(STG(FMT("commit() not implemented for type used in option '%s'") % _myname)); + } + } + catch (EmptyVariable & e) + { + throw Failure(STG(FMT("uninitialized variable while commiting option '%s'") % _myname)); + } + } + + const std::string & name(void) const { return _myname; } + bool listme(void) const { return _listme; }; + + const char ** values(void); + + template < typename Object > + void copyFrom(const Object * const srcobj, Object * const dstobj, bool force = false) + { + if (loaded(dstobj) && !force) + return; + + if (loaded(srcobj)) + set(dstobj, get(srcobj)); + else + reset(dstobj); + } + + protected: + const std::string _myname; + InnerType _option; + const bool _listme; + const char ** _values; + }; + + struct Options + { + typedef std::vector < std::string > Messages; + + Options(); + ~Options(); + + typedef std::set < std::string > StringSet; + + typedef std::map < std::string, Option > OptionMap; + typedef std::pair < std::string, Option > OptionPair; + + typedef std::map < std::string, std::string > SynOptionMap; + typedef std::pair < std::string, std::string > SynOptionPair; + + bool add(Option option); + + /* only valid in "process" (for backwards compatibility config files) */ + bool synonym(std::string, std::string); + + template < typename Type > + void set(const std::string & name, Type value) + { + OptionMap::iterator iter = find_option(name); + + if (iter == _map.end()) + throw Failure(STG(FMT("unknown option: %s") % name)); + + iter->second.set(value); + } + + template < typename Object > + std::string get(const Object * const object, const std::string & name) + { + OptionMap::iterator iter = find_option(name); + + if (iter == _map.end()) + throw Failure(STG(FMT("unknown option: %s") % name)); + + return iter->second.get(object); + } + + template < typename Object > + void process(Object * const object, const char * name, const char * value) + { + OptionMap::iterator iter = find_option(name); + + if (iter == _map.end()) + throw Failure(STG(FMT("unknown option '%s'") % name)); + + iter->second.set(object, value); + } + + template < typename Object > + Messages commit(Object * const object) + { + Messages msgs; + + for (OptionMap::iterator i = _map.begin(); i != _map.end(); ++i) + { + try + { + i->second.commit(object); + } + catch (Failure & e) + { + msgs.push_back(e.what()); + } + } + + return msgs; + } + + template < typename Object > + void reset(Object * object) + { + for (OptionMap::iterator i = _map.begin(); i != _map.end(); ++i) + i->second.reset(object); + } + + template < typename Object > + bool loaded(Object * object, std::string name) + { + OptionMap::iterator iter = find_option(name); + + if (iter == _map.end()) + return false; + + return iter->second.loaded(object); + } + + bool exists(const std::string & name) + { + OptionMap::iterator iter = find_option(name); + + return (iter != _map.end()); + } + + StringSet options(void); + + const char ** values(const char *); /* option value */ + const char ** values(void); /* values from options */ + + template < typename Object > + void copyFrom(const std::string & name, const Object * const src_obj, Object * const dst_obj, bool force = false) + { + OptionMap::iterator iter = find_option(name); + + if (iter == _map.end()) + throw Failure(STG(FMT("unknown option '%s'") % name)); + + iter->second.copyFrom(src_obj, dst_obj, force); + } + + template < typename Object > + void copyFrom(Object * src_obj, Object * dst_obj, bool force = false) + { + for (OptionMap::iterator iter = _map.begin(); iter != _map.end(); ++iter) + iter->second.copyFrom(src_obj, dst_obj, force); + } + + protected: + OptionMap::iterator find_option(std::string); + + protected: + OptionMap _map; + SynOptionMap _syn_map; + + const char ** _values; + }; +}; + +#endif /* _CONFIG_OPTIONS_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/base/configurator/configfile.cpp b/src/mod/endpoints/mod_khomp/commons/base/configurator/configfile.cpp new file mode 100644 index 0000000..8a46587 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/base/configurator/configfile.cpp @@ -0,0 +1,241 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ +#include <errno.h> + +#include <configurator/configfile.hpp> + +#if _MSC_VER >= 1400 +#undef close +#endif + +void Configfile::ignore(const std::string & str) +{ + _ignores.insert(str); +}; + +bool Configfile::select(Section **ptr, const std::string & str) +{ + /* default section == this! */ + *ptr = this; + + /* always success by default */ + return true; +}; + +bool Configfile::adjust(Section * section, const std::string & opt, const std::string & val) +{ + return section->load(opt, val); +}; + +bool Configfile::deserialize(std::ifstream & fd) +{ + Section * section = NULL; + + /* default selection! */ + if (!select(§ion)) + { + _errors.push_back("default selection has failed!"); + return false; + } + + size_t count = 0; + + while (fd.good()) + { + std::string str; + + /* read one line! */ + std::getline(fd, str); + + size_t lst = str.size() - 1; + + if (str.size() >= 1 && str[lst] == '\r') //cuida das quebras de linha do tipo \r\n + { + str.erase(lst,1); + --lst; + } + + /* empty line! */ + if (str.size() == 0) + continue; + + /* comment! */ + if (str[0] == '#') + continue; + + ++count; + + if (str[0] == '[' && str[lst] == ']') + { + str.erase(0,1); --lst; + str.erase(lst,1); --lst; + + if (!select(§ion, str)) + { + _errors.push_back(STG(FMT("erroneous section '%s'") % str)); + + /* ignore this section */ + section = NULL; + continue; + } + } + else + { + std::string::size_type pos = str.find('='); + + if (pos == std::string::npos) + { + _errors.push_back(STG(FMT("erroneous separator '%s'") % str)); + continue; + }; + + if (section == NULL) + { + _errors.push_back(STG(FMT("no section for option '%s'") % str)); + continue; + } + + std::string opt(str.substr(0,pos)); + std::string val(str.substr(pos+1)); + + if (_ignores.find(opt) != _ignores.end()) + continue; + + if (val == "@") val = ""; + + if (adjust(section, opt, val)) + continue; + + _errors.push_back(STG(FMT("option '%s' does " + "not exist or '%s' is not a valid value (at section '%s')") + % opt % val % section->name())); + } + } + + // retorna 'true' se arquivo tinha alguma coisa valida. + return (count != 0); +} + +bool Configfile::obtain() +{ + std::ifstream fd(_filename.c_str()); + + if (!fd.is_open()) + { + _errors.push_back(STG(FMT("unable to open file '%s': %s") + % _filename % strerror(errno))); + return false; + }; + + if (!deserialize(fd)) + { + fd.close(); + return false; + } + + fd.close(); + return true; +}; + +void Configfile::recurse(std::ofstream & fd, Section * section) +{ + typedef Section::SectionMap::const_iterator SectionIter; + typedef Section::OptionMap::const_iterator OptionIter; + + for (OptionIter i = section->option_begin(); i != section->option_end(); i++) + { + std::string res; + + if ((*i).second.store(res)) + { + if (res == "") res = "@"; + fd << (*i).first << "=" << res << std::endl; + } + } + + if (!section->recursive()) + return; + + for (SectionIter j = section->section_begin(); j != section->section_end(); j++) + recurse(fd, (*j).second); +} + +bool Configfile::serialize(std::ofstream & fd) +{ + recurse(fd, this); + return true; +} + +bool Configfile::provide() +{ + std::string tmp(_filename); + tmp += ".new"; + + std::ofstream fd(tmp.c_str()); + + if (!fd.good()) + { + _errors.push_back(STG(FMT("unable to open file '%s': %s") + % tmp % strerror(errno))); + return false; + } + + if (!serialize(fd)) + { + fd.close(); + return false; + } + + fd.close(); + + if (rename(tmp.c_str(), _filename.c_str()) != 0) + { + _errors.push_back(STG(FMT("unable to replace config file '%s': %s") + % _filename % strerror(errno))); + return false; + } + + return true; +} + +#if _MSC_VER >= 1400 +#define close _close +#endif diff --git a/src/mod/endpoints/mod_khomp/commons/configurator/configfile.hpp b/src/mod/endpoints/mod_khomp/commons/base/configurator/configfile.hpp similarity index 65% rename from src/mod/endpoints/mod_khomp/commons/configurator/configfile.hpp rename to src/mod/endpoints/mod_khomp/commons/base/configurator/configfile.hpp index 61f4246..e725c09 100644 --- a/src/mod/endpoints/mod_khomp/commons/configurator/configfile.hpp +++ b/src/mod/endpoints/mod_khomp/commons/base/configurator/configfile.hpp @@ -1,7 +1,7 @@ -/* +/* KHOMP generic endpoint/channel library. - Copyright (C) 2007-2009 Khomp Ind. & Com. - + Copyright (C) 2007-2009 Khomp Ind. & Com. + The contents of this file are subject to the Mozilla Public License Version 1.1 (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.mozilla.org/MPL/ @@ -23,20 +23,20 @@ The LGPL header follows below: - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ #include <vector> @@ -53,38 +53,38 @@ struct Configfile: public Section { - typedef std::list < std::string > ErrorVector; - typedef std::set < std::string > NameSet; + typedef std::list < std::string > ErrorVector; + typedef std::set < std::string > NameSet; - Configfile(std::string name, std::string desc) - : Section(name, desc), _good(false) {}; + Configfile(const std::string & name, const std::string & desc) + : Section(name, desc), _good(false) {}; - virtual ~Configfile() {}; + virtual ~Configfile() {}; - bool good() { return _good; }; - std::string & filename() { return _filename; }; + bool good() const { return _good; }; + const std::string & filename() const { return _filename; }; - ErrorVector & errors() { return _errors; }; + const ErrorVector & errors() const { return _errors; }; - void ignore(std::string); + void ignore(const std::string &); - virtual bool obtain(); - virtual bool provide(); + virtual bool obtain(); + virtual bool provide(); protected: - virtual bool select(Section **, std::string str = ""); - virtual bool adjust(Section *, std::string & opt, std::string & val); + virtual bool select(Section **, const std::string & str = ""); + virtual bool adjust(Section *, const std::string & opt, const std::string & val); - virtual bool deserialize(std::ifstream &); - virtual bool serialize(std::ofstream &); + virtual bool deserialize(std::ifstream &); + virtual bool serialize(std::ofstream &); - void recurse(std::ofstream &, Section *); + void recurse(std::ofstream &, Section *); protected: - bool _good; - ErrorVector _errors; - NameSet _ignores; - std::string _filename; + bool _good; + ErrorVector _errors; + NameSet _ignores; + std::string _filename; }; #endif /* _CONFIG_CONFIGFILE_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/base/configurator/option.cpp b/src/mod/endpoints/mod_khomp/commons/base/configurator/option.cpp new file mode 100644 index 0000000..6de9212 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/base/configurator/option.cpp @@ -0,0 +1,186 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <configurator/option.hpp> + +bool Option::equals(const std::string & value) const +{ + switch (_restriction.numeral()) + { + case Restriction::N_UNIQUE: + { + Restriction::Value my_value; + + if (!_restriction.get(Restriction::F_USER, my_value)) + return false; + + return (my_value == value); + } + case Restriction::N_MULTIPLE: + { + Restriction::Vector my_values; + + if (!_restriction.get(Restriction::F_USER, my_values)) + return false; + + for (Restriction::Vector::iterator i = my_values.begin(); i != my_values.end(); i++) + { + if ((*i) == value) + return true; + } + + return false; + } + } + + return false; +} + +bool Option::load(const std::string & value) +{ + bool ret = _restriction.set( (const Restriction::Format)Restriction::F_FILE, value); + + if (ret) _modified = false; + + return ret; +} + +bool Option::change(const std::string & value) +{ + bool ret = _restriction.set(Restriction::F_FILE, value); + + if (ret) _modified = true; + + return ret; +} + +bool Option::store(std::string & value) const +{ + switch (_restriction.numeral()) + { + case Restriction::N_UNIQUE: + return _restriction.get(Restriction::F_FILE, value); + + case Restriction::N_MULTIPLE: + { + Restriction::Vector values; + + if (!_restriction.get(Restriction::F_FILE, values)) + return false; + + Strings::Merger strs; + + for (Restriction::Vector::iterator i = values.begin(); i != values.end(); i++) + strs.add(*i); + + value = strs.merge(","); + + return true; + } + + default: + return false; + } +} + +/* +Option::Flags Option::set(const char * value) +{ + std::string str_value(value); + return set(str_value); +} +*/ + +Option::Flags Option::set(const Restriction::Value & value) +{ + Restriction::Value last_value, curr_value; + Flags flags; + + bool ret1 = _restriction.get(Restriction::F_USER, last_value); + + if (!_restriction.set(Restriction::F_USER, value)) + return flags; + + flags[F_ADJUSTED] = true; + + bool ret2 = _restriction.get(Restriction::F_USER, curr_value); + + if (!ret1 || (ret2 && (last_value != curr_value))) + { + flags[F_MODIFIED] = true; + _modified = true; + } + + return flags; +} + +Option::Flags Option::set(const Restriction::Vector & values) +{ + Restriction::Vector last_values, curr_values; + Flags flags; + + bool ret1 = _restriction.get(Restriction::F_USER, last_values); + + if (!_restriction.set(Restriction::F_USER, values)) + return flags; + + flags[F_ADJUSTED] = true; + + bool ret2 = _restriction.get(Restriction::F_USER, curr_values); + + if (!ret1 || (ret2 && (last_values != curr_values))) + { + flags[F_MODIFIED] = true; + _modified = true; + } + + return flags; +} + +bool Option::get(Restriction::Value & value) const +{ + return _restriction.get(Restriction::F_USER, value); +} + +bool Option::get(Restriction::Vector & values) const +{ + return _restriction.get(Restriction::F_USER, values); +} diff --git a/src/mod/endpoints/mod_khomp/commons/configurator/option.hpp b/src/mod/endpoints/mod_khomp/commons/base/configurator/option.hpp similarity index 52% rename from src/mod/endpoints/mod_khomp/commons/configurator/option.hpp rename to src/mod/endpoints/mod_khomp/commons/base/configurator/option.hpp index 8aa103a..e46ab75 100644 --- a/src/mod/endpoints/mod_khomp/commons/configurator/option.hpp +++ b/src/mod/endpoints/mod_khomp/commons/base/configurator/option.hpp @@ -1,7 +1,7 @@ -/* +/* KHOMP generic endpoint/channel library. - Copyright (C) 2007-2009 Khomp Ind. & Com. - + Copyright (C) 2007-2009 Khomp Ind. & Com. + The contents of this file are subject to the Mozilla Public License Version 1.1 (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.mozilla.org/MPL/ @@ -23,20 +23,20 @@ The LGPL header follows below: - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ #include <iostream> @@ -45,6 +45,7 @@ #include <list> #include <vector> +#include <format.hpp> #include <strings.hpp> #include <configurator/restriction.hpp> @@ -56,67 +57,72 @@ struct Option { enum FlagTypes { - F_MODIFIED = 0x0, /* if option was modified */ - F_ADJUSTED = 0x1, /* if option was correctly formated */ + F_MODIFIED = 0x0, /* if option was modified */ + F_ADJUSTED = 0x1, /* if option was correctly formated */ }; - struct Flags: public std::vector<bool> - { - Flags(): std::vector<bool>(2) {}; - }; + struct Flags: public std::vector<bool> + { + Flags(): std::vector<bool>(2) {}; + }; - typedef Restriction::Value Value; - typedef Restriction::Vector Vector; + typedef Restriction::Value Value; + typedef Restriction::Vector Vector; /* exception */ - struct InvalidDefaultValue + struct InvalidDefaultValue: public std::runtime_error { - InvalidDefaultValue(std::string name, std::string value) - : _name(name), _value(value) {}; + InvalidDefaultValue(const std::string & name, const std::string & value) + : std::runtime_error(STG(FMT("invalid default value '%s' for option '%s'") % value % name)), + _name(name), _value(value) + {}; - std::string & name() { return _name; }; - std::string & value() { return _value; }; + ~InvalidDefaultValue() throw () + {}; + + const std::string & name() const { return _name; }; + const std::string & value() const { return _value; }; protected: - std::string _name; - std::string _value; + const std::string _name; + const std::string _value; }; - Option(std::string name, std::string desc, std::string defvalue, Restriction restriction) - : _name(name), _desc(desc), _restriction(restriction), _modified(true) - { - std::string value(defvalue); + Option(const std::string & name, const std::string & desc, const std::string & defvalue, const Restriction & restriction) + : _name(name), _description(desc), _restriction(restriction), _modified(true) + { +// std::string value(defvalue); - if (!(set(value)[F_ADJUSTED])) + if (!(set(defvalue)[F_ADJUSTED])) throw InvalidDefaultValue(name, defvalue); - } + } - const std::string & name() { return _name; }; - const std::string & description() { return _desc; }; + const std::string & name() const { return _name; }; + const std::string & description() const { return _description; }; - Restriction & restriction() { return _restriction; }; - bool modified() { return _modified; }; + const Restriction & restriction() const { return _restriction; }; + bool modified() const { return _modified; }; public: - bool load(std::string &); - bool change(std::string &); - bool store(std::string &); + bool load(const std::string &); + bool change(const std::string &); + bool store(std::string &) const; - Flags set(const char *); - Flags set(Value &); - Flags set(Vector &); +// Flags set(const char *); + Flags set(const Value &); + Flags set(const Vector &); - bool get(Value &); - bool get(Vector &); + bool get(Value &) const; + bool get(Vector &) const; - bool equals(std::string &); + bool equals(const std::string &) const; protected: - std::string _name; - std::string _desc; + const std::string _name; + const std::string _description; - Restriction _restriction; - bool _modified; + Restriction _restriction; + bool _modified; }; #endif /* _CONFIG_OPTION_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/base/configurator/restriction.cpp b/src/mod/endpoints/mod_khomp/commons/base/configurator/restriction.cpp new file mode 100644 index 0000000..52be1ea --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/base/configurator/restriction.cpp @@ -0,0 +1,358 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <math.h> +#include <string.h> + +#include <iostream> +#include <strings.hpp> + +#include <configurator/restriction.hpp> + +/* internal helper! */ +bool Restriction::equalNumber(const double a, const double b) +{ + char tmp1[64]; + char tmp2[64]; + + snprintf(tmp1, sizeof(tmp1), "%.3f", a); + snprintf(tmp2, sizeof(tmp2), "%.3f", b); + + if (strncmp(tmp1, tmp2, sizeof(tmp1))) + return false; + + return true; +} + +/* process value to our internal representation */ + +bool Restriction::process(Restriction::Format fmt, + const Restriction::Value & value, Restriction::Value & final) const +{ + switch (_bounds) + { + case B_RANGE: + { + if (_kind != K_NUMBER) + return false; + + std::string tmpvalue; + + Restriction::Value::const_iterator itr = value.begin(); + Restriction::Value::const_iterator end = value.end(); + + tmpvalue.reserve(value.size()); + + // f*cking dot/comma notation! + for (; itr != end; ++itr) + tmpvalue += ((*itr) != ',' ? (*itr) : '.'); + + try + { + double newvalue = Strings::todouble(tmpvalue); + + if (newvalue < _init && newvalue > _fini) + return false; + + double res = (newvalue - _init) / _step; + + if (!Restriction::equalNumber(res, rint(res))) + return false; + + final = value; + return true; + } + catch (...) + { + return false; + } + } + + case B_LIST: + for (List::const_iterator i = _list.begin(); i != _list.end(); i++) + { + const Value & tmp = (*i); + + if (tmp == value) + { + final = value; + return true; + } + } + return false; + + case B_MAPS: + switch (fmt) + { + case F_USER: + { + Map::const_iterator i = _map_from_usr.find(value); + + if (i == _map_from_usr.end()) + return false; + + const Value & tmp = (*i).second; + + final = tmp; + return true; + } + + case F_FILE: + { + Map::const_iterator i = _map_from_cfg.find(value); + + if (i == _map_from_cfg.end()) + return false; + + final = value; + return true; + } + + default: + break; + } + return false; + + case B_FREE: + final = value; + return true; + + default: + break; + } + + return false; +} + +/* unprocess the value (outputs the external representation) */ + +bool Restriction::unprocess(Restriction::Format fmt, + const Restriction::Value & value, Restriction::Value & final) const +{ + switch (_bounds) + { + case B_MAPS: + + switch (fmt) + { + case F_USER: + { + Map::const_iterator i = _map_from_cfg.find(value); + + if (i == _map_from_cfg.end()) + return false; + + final = (*i).second; + return true; + } + default: + break; + } + + default: + final = value; + return true; + } +} + +/***************************** *****************************/ + +bool Restriction::get(Restriction::Format fmt, Restriction::Value & value) const +{ + if (_numeral != N_UNIQUE) + return false; + + if (!unprocess(fmt, _value._unique, value)) + return false; + + return true; +} + +bool Restriction::get(Restriction::Format fmt, Restriction::Vector & values) const +{ + if (_numeral != N_MULTIPLE) + return false; + + const List & my_values = _value._multiple; + + for (List::const_iterator i = my_values.begin(); i != my_values.end(); i++) + { + const Value & value = (*i); + + Value final; + + if (!unprocess(fmt, value, final)) + return false; + + values.push_back(final); + }; + + return true; +} + +/***************************** *****************************/ + +bool Restriction::set(Restriction::Format fmt, const Restriction::Value & value) +{ + switch (_numeral) + { + case N_UNIQUE: + { + Value final; + + if (!constThis().process(fmt, value, final)) + return false; + + _value._unique = final; + return true; + } + + case N_MULTIPLE: + { + if (value == "@" || value == "#" || value == "") + { + _value._multiple.clear(); + return true; + } + + Strings::vector_type values; + Strings::tokenize(value, values, ","); + + return set(fmt, values); + } + + default: + return false; + } +} + +bool Restriction::set(Restriction::Format fmt, const Restriction::Vector & values) +{ + if (_numeral != N_MULTIPLE) + return false; + + if (values.empty()) + { + _value._multiple.clear(); + } + else + { + /* list needed to store temporary values */ + List finals; + + for (Vector::const_iterator i = values.begin(); i != values.end(); i++) + { + const Value & value = (*i); + + Value final; + + if (!constThis().process(fmt, value, final)) + return false; + + finals.push_back(final); + } + + List & lst = _value._multiple; + + /* need to clear values set before */ + lst.clear(); + + for (List::iterator i = finals.begin(); i != finals.end(); i++) + { + Value value = (*i); + lst.push_back(value); + } + }; + + return true; +} + +/***************************** *****************************/ + +void Restriction::allowed(Restriction::Vector & vals) const +{ + switch (_bounds) + { + case B_FREE: + return; + + case B_LIST: + for (List::const_iterator i = _list.begin(); i != _list.end(); i++) + vals.push_back(*i); + break; + + case B_MAPS: + for (Map::const_iterator i = _map_from_usr.begin(); i != _map_from_usr.end(); i++) + vals.push_back(i->first); + break; + + case B_RANGE: + { + if (_kind != K_NUMBER) + return; + + // is there any fraction? + bool has_fraction = + (!Restriction::equalNumber(_init, rint(_init))) || + (!Restriction::equalNumber(_fini, rint(_fini))) || + (!Restriction::equalNumber(_step, rint(_step))); + + const char * format = (has_fraction ? "%.2f" : "%02.0f"); + + for (double i = _init; i <= _fini; i += _step) + { + char tmp[32]; + snprintf(tmp, sizeof(tmp), format, i); + vals.push_back(std::string(tmp)); + } + break; + } + + default: + break; + } +} + +void Restriction::init_class() +{ + _value._unique.clear(); + _value._multiple.clear(); +} diff --git a/src/mod/endpoints/mod_khomp/commons/base/configurator/restriction.hpp b/src/mod/endpoints/mod_khomp/commons/base/configurator/restriction.hpp new file mode 100644 index 0000000..576560d --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/base/configurator/restriction.hpp @@ -0,0 +1,269 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <stdarg.h> + +#include <string> +#include <list> +#include <vector> +#include <map> + +#include <const_this.hpp> + +#ifndef _CONFIG_RESTRICTION_HPP_ +#define _CONFIG_RESTRICTION_HPP_ + +struct Restriction: public ConstThis < Restriction > +{ + /* generic types */ + + // TODO: change this type name for something different + // to avoid conflicting with "format.hpp". + enum Format + { + F_USER, + F_FILE + }; + + enum Kind + { + K_STRING, + K_NUMBER // = K_INTEGER // compatibility + }; + + enum Bounds + { + B_FREE, + B_RANGE, + B_LIST, + B_MAPS + }; + + enum Numeral + { + N_UNIQUE, + N_MULTIPLE + }; + + typedef std::string Value; + + /* types used for data input */ + struct Pair + { + const char *pretty; + const char *value; + }; + + typedef std::pair < Value, Value > PairMap; + typedef std::list < PairMap > ListMap; + + /* types used internally */ + typedef std::map < Value, Value > Map; + typedef std::vector < Value > Vector; + + typedef std::list < Value > List; + typedef std::pair < Value, Value > MapPair; + + struct Generic + { + Value _unique; + List _multiple; + }; + + Restriction(Kind kind, Numeral num) + : _kind(kind), _bounds(B_FREE), _numeral(num), _unit(""), + _init(-1), _fini(-1), _step(-1) + { + init_class(); + } + + Restriction(Kind kind, Numeral num, + double init, double fini, double step = 1) + : _kind(kind), _bounds(B_RANGE), _numeral(num), _unit(""), + _init(init), _fini(fini), _step(step) + { + init_class(); + } + + Restriction(Kind kind, Numeral num, + const char *unit, double init, double fini, double step = 1.0) + : _kind(kind), _bounds(B_RANGE), _numeral(num), _unit(unit), + _init(init), _fini(fini), _step(step) + { + init_class(); + } + + Restriction(Kind kind, Numeral num, + std::string unit, double init, double fini, double step = 1.0) + : _kind(kind), _bounds(B_RANGE), _numeral(num), _unit(unit), + _init(init), _fini(fini), _step(step) + { + init_class(); + } + + Restriction(Kind kind, Numeral num, + const char *first, ...) + : _kind(kind), _bounds(B_LIST), _numeral(num), _unit(""), + _init(-1), _fini(-1), _step(-1) + { + _list.push_back(std::string(first)); + + va_list ap; + va_start(ap, first); + + while (true) + { + const char *arg = va_arg(ap, const char *); + + if (arg == NULL) break; + + _list.push_back(std::string(arg)); + } + + init_class(); + } + + Restriction(Kind kind, const char *unit, Numeral num, + const char *first, ...) + : _kind(kind), _bounds(B_LIST), _numeral(num), _unit(unit), + _init(-1), _fini(-1), _step(-1) + { + _list.push_back(std::string(first)); + + va_list ap; + va_start(ap, first); + + while (true) + { + const char *arg = va_arg(ap, const char *); + + if (arg == NULL) break; + + _list.push_back(std::string(arg)); + } + + init_class(); + } + + Restriction(Kind kind, Numeral num, + const struct Pair first, ...) + : _kind(kind), _bounds(B_MAPS), _numeral(num), _unit(""), + _init(-1), _fini(-1), _step(-1) + { + _map_from_usr.insert(MapPair(Value(first.pretty), Value(first.value))); + _map_from_cfg.insert(MapPair(Value(first.value), Value(first.pretty))); + + va_list ap; + va_start(ap, first); + + while (true) + { + Pair arg = va_arg(ap, Pair); + + if (arg.pretty == NULL) break; + + _map_from_usr.insert(MapPair(Value(arg.pretty), Value(arg.value))); + _map_from_cfg.insert(MapPair(Value(arg.value), Value(arg.pretty))); + } + + init_class(); + } + + Restriction(Kind kind, Numeral num, List list) + : _kind(kind), _bounds(B_LIST), _numeral(num), _unit(""), + _init(-1), _fini(-1), _step(-1), _list(list) + { + init_class(); + } + + Restriction(Kind kind, Numeral num, ListMap map) + : _kind(kind), _bounds(B_MAPS), _numeral(num), _unit(""), + _init(-1), _fini(-1), _step(-1) + { + for (ListMap::iterator i = map.begin(); i != map.end(); i++) + { + _map_from_usr.insert(MapPair(Value((*i).first), Value((*i).second))); + _map_from_cfg.insert(MapPair(Value((*i).second), Value((*i).first))); + } + + init_class(); + } + + const Kind kind() const { return _kind; }; + const Bounds bounds() const { return _bounds; }; + const Numeral numeral() const { return _numeral; }; + + const std::string & unit() const { return _unit; }; + + bool set(Format, const Vector &); + bool set(Format, const Value &); + + bool get(Format, Vector &) const; + bool get(Format, Value &) const; + + void allowed(Vector &) const; + + private: + bool process(const Format, const Value &, Value &) const; + bool unprocess(const Format, const Value &, Value &) const; + + void init_class(); + + static bool equalNumber(const double, const double); + + protected: + const Kind _kind; + const Bounds _bounds; + const Numeral _numeral; + + Value _unit; + + const double _init, _fini, _step; + + Map _map_from_usr, + _map_from_cfg; + + List _list; + + Generic _value; +}; + +#endif /* _CONFIG_RESTRICTION_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/configurator/section.cpp b/src/mod/endpoints/mod_khomp/commons/base/configurator/section.cpp similarity index 59% rename from src/mod/endpoints/mod_khomp/commons/configurator/section.cpp rename to src/mod/endpoints/mod_khomp/commons/base/configurator/section.cpp index 5d26858..9ed775b 100644 --- a/src/mod/endpoints/mod_khomp/commons/configurator/section.cpp +++ b/src/mod/endpoints/mod_khomp/commons/base/configurator/section.cpp @@ -1,7 +1,7 @@ -/* +/* KHOMP generic endpoint/channel library. - Copyright (C) 2007-2009 Khomp Ind. & Com. - + Copyright (C) 2007-2009 Khomp Ind. & Com. + The contents of this file are subject to the Mozilla Public License Version 1.1 (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.mozilla.org/MPL/ @@ -23,108 +23,114 @@ The LGPL header follows below: - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ #include <configurator/section.hpp> -void Section::options(Section::OptionVector & vec) +void Section::options(Section::OptionVector & vec) const { - for (OptionMap::iterator it = _options.begin(); it != _options.end();) - { - vec.push_back(&((*it).second)); - ++it; - } + for (OptionMap::const_iterator it = _options.begin(); it != _options.end();) + { + vec.push_back(const_cast< Option * >(&(it->second))); + ++it; + } } -void Section::sections(Section::SectionVector & vec) +void Section::sections(Section::SectionVector & vec) const { - for (SectionMap::iterator it = _sections.begin(); it != _sections.end();) - { - vec.push_back((*it).second); - ++it; - } + for (SectionMap::const_iterator it = _sections.begin(); it != _sections.end();) + { + vec.push_back(const_cast< Section * >(it->second)); + ++it; + } } /*********/ -Option * Section::option_find(std::string & str, bool recurse) +Option * Section::option_find(const std::string & str, bool recurse) const { - OptionMap::iterator i = _options.find(str); + OptionMap::const_iterator i = _options.find(str); - if (i == _options.end()) + if (i == _options.end()) { if (!recurse) - throw not_found(); + throw OptionNotFound(str, _name); +// throw not_found(); - for (SectionMap::iterator i = _sections.begin(); i != _sections.end(); i++) + for (SectionMap::const_iterator i = _sections.begin(); i != _sections.end(); i++) { try { return i->second->option_find(str, recurse); } - catch (not_found & e) + catch (NotFound & e) { /* keep looping! */ }; } - throw not_found(); +// throw not_found(); + throw OptionNotFound(str, _name); } - return &((*i).second); + return const_cast< Option * >(&(i->second)); } +/* Option * Section::option_find(const char * str, bool recurse) { - std::string sstr(str); - return option_find(sstr, recurse); + std::string sstr(str); + return option_find(sstr, recurse); } +*/ /*********/ -Section * Section::section_find(std::string & str, bool recurse) +Section * Section::section_find(const std::string & str, bool recurse) const { - SectionMap::iterator i = _sections.find(str); + SectionMap::const_iterator i = _sections.find(str); - if (i == _sections.end()) + if (i == _sections.end()) { if (!recurse) - throw not_found(); + throw SectionNotFound(str, _name); - for (SectionMap::iterator i = _sections.begin(); i != _sections.end(); i++) + for (SectionMap::const_iterator i = _sections.begin(); i != _sections.end(); i++) { try { return i->second->section_find(str, recurse); } - catch (not_found & e) + catch (NotFound & e) { /* keep looping! */ }; } - throw not_found(); + throw SectionNotFound(str, _name); } - return ((*i).second); + return const_cast< Section * >(i->second); } +/* Section * Section::section_find(const char * str, bool recurse) { - std::string sstr(str); - return section_find(sstr, recurse); + std::string sstr(str); + return section_find(sstr, recurse); } +*/ diff --git a/src/mod/endpoints/mod_khomp/commons/base/configurator/section.hpp b/src/mod/endpoints/mod_khomp/commons/base/configurator/section.hpp new file mode 100644 index 0000000..d5a8c95 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/base/configurator/section.hpp @@ -0,0 +1,260 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#ifndef _CONFIG_SECTION_HPP_ +#define _CONFIG_SECTION_HPP_ + +#include <string> +#include <vector> +#include <map> +#include <algorithm> +#include <iostream> + +#include <format.hpp> + +#include <configurator/option.hpp> + +struct Section +{ + typedef std::map < std::string, Option > OptionMap; + typedef std::vector< Option * > OptionVector; + + typedef std::map < std::string, Section * > SectionMap; + typedef std::vector < Section * > SectionVector; + + struct NotFound: public std::runtime_error + { + NotFound(const std::string & type, const std::string & name, const std::string & me) + : std::runtime_error(STG(FMT("%s '%s' not found on section '%s'") % type % name % me)) {}; + }; + + struct OptionNotFound: public NotFound + { + OptionNotFound(const std::string & name, const std::string & me) + : NotFound("option", name, me) {}; + }; + + struct SectionNotFound: public NotFound + { + SectionNotFound(const std::string & name, const std::string & me) + : NotFound("section", name, me) {}; + }; + + typedef NotFound not_found; /* backward compatibility */ + +// protected: + Section(const std::string & name, const std::string & desc, bool recursive = true) + : _name(name), _description(desc), _recursive(recursive) {}; + + void add(const Option & o) + { + _options.insert(std::pair<std::string,Option>(o.name(), o)); + }; + + void del(const std::string & name) + { + _options.erase(name); + }; + + void add(Section * s) + { + _sections.insert(std::pair< std::string, Section * >(s->name(), s)); + }; + + public: + const std::string & name() const { return _name; }; + const std::string & description() const { return _description; }; + + const bool recursive() const { return _recursive; }; + + OptionMap::const_iterator option_begin() const { return _options.begin(); }; + OptionMap::const_iterator option_end() const { return _options.end(); }; + + SectionMap::const_iterator section_begin() const { return _sections.begin(); }; + SectionMap::const_iterator section_end() const { return _sections.end(); }; + + /**/ + +// Option * option_find(const char *, bool recurse = false) const; +// Section * section_find(const char *, bool recurse = false) const; + + Option * option_find(const std::string &, bool recurse = false) const; + Section * section_find(const std::string &, bool recurse = false) const; + + /**/ + + void options(OptionVector &) const; + void sections(SectionVector &) const; + + /**/ + + template < typename T, typename F > + bool search_and_apply(const std::string & key, T & value, F f) + { + OptionMap::iterator i = _options.find(key); + + if (i != _options.end()) + return f(i->second); + + if (!_recursive) + return false; + + return (find_if(_sections.begin(), _sections.end(), f) != _sections.end()); + } + + private: + struct ConstKeyValue + { + ConstKeyValue(const std::string & k, const std::string &v) + : _k(k), _v(v) {}; + + const std::string & _k; + const std::string & _v; + }; + + struct KeyValue + { + KeyValue(const std::string & k, std::string &v) + : _k(k), _v(v) {}; + + const std::string & _k; + std::string & _v; + }; + + struct load_section: protected ConstKeyValue + { + load_section(const std::string & k, const std::string & v): ConstKeyValue(k,v) {}; + + bool operator()(Option & o) { return o.load(_v); }; + bool operator()(SectionMap::value_type & v) { return v.second->load(_k,_v); }; + }; + + struct change_section: protected ConstKeyValue + { + change_section(const std::string & k, const std::string & v): ConstKeyValue(k,v) {}; + + bool operator()(Option & o) { return o.change(_v); }; + bool operator()(SectionMap::value_type & v) { return v.second->change(_k,_v); }; + }; + + struct store_section: protected KeyValue + { + store_section(const std::string & k, std::string & v): KeyValue(k,v) {}; + + bool operator()(Option & o) { return o.store(_v); }; + bool operator()(SectionMap::value_type & v) { return v.second->store(_k,_v); }; + }; + + struct set_section: protected ConstKeyValue + { + set_section(const std::string & k, const std::string & v): ConstKeyValue(k,v) {}; + + bool operator()(Option & o) { return (o.set(_v))[Option::F_ADJUSTED]; }; + bool operator()(SectionMap::value_type & v) { return v.second->set(_k,_v); }; + }; + + struct get_section: protected KeyValue + { + get_section(const std::string & k, std::string & v): KeyValue(k,v) {}; + + bool operator()(Option & o) { return o.get(_v); }; + bool operator()(SectionMap::value_type & v) { return v.second->get(_k,_v); }; + }; + + struct modified_section + { + bool operator()(const OptionMap::value_type & v) { return v.second.modified(); }; + bool operator()(const SectionMap::value_type & v) { return v.second->modified(); }; + }; + + public: +/* + bool load(const char * key, const std::string value) + { + std::string skey(key); + return search_and_apply(skey, value, load_section(skey, value)); + } +*/ + bool load(const std::string & key, const std::string & value) + { + return search_and_apply(key, value, load_section(key, value)); + } + + bool change(const std::string & key, const std::string & value) + { + return search_and_apply(key, value, change_section(key, value)); + } + + bool store(const std::string & key, std::string & value) + { + return search_and_apply(key, value, store_section(key, value)); + } + + bool set(const std::string & key, const std::string & value) + { + return search_and_apply(key, value, set_section(key, value)); + } + + bool get(const std::string & key, std::string & value) + { + return search_and_apply(key, value, get_section(key, value)); + } + + bool modified() const + { + return ((find_if(_options.begin(), _options.end(), modified_section()) != _options.end()) || + (find_if(_sections.begin(), _sections.end(), modified_section()) != _sections.end())); + } + + private: + Section(): _name(""), _description(""), _recursive(false) {}; + + protected: + const std::string _name; + const std::string _description; + + OptionMap _options; + SectionMap _sections; + + const bool _recursive; +}; + +#endif /* _CONFIG_SECTION_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/base/const_this.hpp b/src/mod/endpoints/mod_khomp/commons/base/const_this.hpp new file mode 100644 index 0000000..48e3c1e --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/base/const_this.hpp @@ -0,0 +1,15 @@ + +#ifndef _CONST_THIS_H_ +#define _CONST_THIS_H_ + +template < typename T > +struct ConstThis +{ + T const & constThis() const + { + // TODO: will this return the right reference? + return static_cast<const T&>(*this); + } +}; + +#endif /* _CONST_THIS_H_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/flagger.hpp b/src/mod/endpoints/mod_khomp/commons/base/flagger.hpp similarity index 100% rename from src/mod/endpoints/mod_khomp/commons/flagger.hpp rename to src/mod/endpoints/mod_khomp/commons/base/flagger.hpp diff --git a/src/mod/endpoints/mod_khomp/commons/format.cpp b/src/mod/endpoints/mod_khomp/commons/base/format.cpp similarity index 89% rename from src/mod/endpoints/mod_khomp/commons/format.cpp rename to src/mod/endpoints/mod_khomp/commons/base/format.cpp index 20f7920..74223cc 100644 --- a/src/mod/endpoints/mod_khomp/commons/format.cpp +++ b/src/mod/endpoints/mod_khomp/commons/base/format.cpp @@ -42,27 +42,7 @@ #include "format.hpp" //#include <iostream> -Format::Format(const char * format_string, bool raise_exception) -: _format(format_string), _valid(true), _raise(raise_exception) -{ - initialize(format_string); -} - -/* -Format::Format(std::string & format_string, bool raise_exception) -: _format(NULL), _valid(true), _raise(raise_exception) -{ - initialize(format_string.c_str()); -} -*/ - -Format::Format(std::string format_string, bool raise_exception) -: _format(format_string), _valid(true), _raise(raise_exception) -{ - initialize(format_string.c_str()); -} - -void Format::initialize(const char * format_string) +void FormatTraits::initialize(const char * format_string) { std::string txt; @@ -82,7 +62,6 @@ void Format::initialize(const char * format_string) if (*ptr2 == '%') { txt += *ptr; - ptr += 2; continue; } @@ -238,36 +217,20 @@ void Format::initialize(const char * format_string) push_argument(txt, T_LITERAL); } -void Format::mark_invalid(std::string & msg) +void FormatTraits::push_argument(std::string & data, FormatTraits::Type type) { - if (_valid) - { - _valid = false; - - std::string finalmsg; - - finalmsg += "** INVALID FORMAT: "; - finalmsg += msg; - finalmsg += " **"; - - _result = finalmsg; - } -} +// std::cerr << "pushing type (" << type << ") with format (" << data << ")" << std::endl; -void Format::raise_check(void) -{ - if (!_valid && _raise) - throw InvalidFormat(_result); + _args.push(Argument(data, type)); + data.clear(); } -bool Format::validity_check(void) +void FormatTraits::pop_argument(void) { - raise_check(); - - return _valid; + _args.pop(); } -const Format::Argument * Format::next_argument(void) +const FormatTraits::Argument * FormatTraits::next_argument(void) { // std::cerr << "size: " << _args.size() << std::endl; @@ -294,38 +257,81 @@ const Format::Argument * Format::next_argument(void) } } -void Format::pop_argument(void) +/******************************************************************/ + +#if 0 +Format::Format(const char * format_string, bool raise_exception) +: _format(format_string), _valid(true), _raise(raise_exception) +{ + FormatTraits::initialize(format_string); +} + +Format::Format(std::string format_string, bool raise_exception) +: _format(format_string), _valid(true), _raise(raise_exception) { - _args.pop(); + FormatTraits::initialize(format_string.c_str()); } -void Format::push_argument(std::string & data, Format::Type type) +/* +Format::Format(std::string & format_string, bool raise_exception) +: _format(NULL), _valid(true), _raise(raise_exception) { -// std::cerr << "pushing type (" << type << ") with format (" << data << ")" << std::endl; + initialize(format_string.c_str()); +} +*/ - _args.push(Argument(data, type)); - data.clear(); +void Format::mark_invalid(std::string & msg) +{ + if (_valid) + { + _valid = false; + + _result = "** INVALID FORMAT: "; + _result += msg; + _result += " **"; + } } -std::string Format::str() +void Format::raise(void) const { - if (!validity_check()) - return _result; + if (!_valid) + { + // call specialized class + FormatException::raise(_result); + } +} - if (next_argument() == NULL) +bool Format::valid(void) const +{ +// raise(); + return _valid; +} + +std::string Format::str() +{ + if (!valid()) return _result; - std::string msg; +// try +// { + if (next_argument() != NULL) + { + std::string msg; - msg += "too few arguments passed for format '"; - msg += _format; - msg += "' ("; - msg += _format; - msg += ")"; + msg += "too few arguments passed for format '"; + msg += _format; + msg += "' ("; + msg += _format; + msg += ")"; - mark_invalid(msg); + mark_invalid(msg); - return _result; + return _result; + } +// catch (NoArgumentLeft e) +// { +// return _result; +// } } - +#endif diff --git a/src/mod/endpoints/mod_khomp/commons/format.hpp b/src/mod/endpoints/mod_khomp/commons/base/format.hpp similarity index 81% rename from src/mod/endpoints/mod_khomp/commons/format.hpp rename to src/mod/endpoints/mod_khomp/commons/base/format.hpp index b1ebe74..0469e4f 100644 --- a/src/mod/endpoints/mod_khomp/commons/format.hpp +++ b/src/mod/endpoints/mod_khomp/commons/base/format.hpp @@ -52,37 +52,35 @@ #include <stdio.h> #ifdef WIN32 // WINDOWS -#include <KHostSystem.h> +# include <KHostSystem.h> #endif - -/* macros used for shortening lines and making the code clearer */ -#define STG(x) (x).str() -#define FMT(x) Format(x) - -struct Format +struct InvalidFormat { - static const unsigned int strings_base_length = 64; - static const unsigned int generic_base_length = 64; + InvalidFormat(std::string _msg) : msg(_msg) {} + const std::string msg; +}; - struct InvalidFormat +template < bool E > +struct FormatException +{ + void raise(const std::string & msg) const { - InvalidFormat(std::string msg) : _msg(msg) {} - - std::string _msg; + /* DO NOTHING */ }; +}; - explicit Format(const char * format_string, bool raise_exception = false); - explicit Format(std::string format_string, bool raise_exception = false); - - void initialize(const char *); - - std::string str(void); - - //////////////////////////////////////////////////////////// - - protected: +template < > +struct FormatException < true > +{ + void raise(const std::string & msg) const + { + throw InvalidFormat(msg); + }; +}; +struct FormatTraits +{ enum Type { T_ANYTHING = 1, @@ -113,24 +111,240 @@ struct Format Argument(std::string fmts, Type type) : _fmts(fmts), _type(type) {}; - Type type(void) const { return _type; } + const Type type(void) const { return _type; } const std::string & fmts(void) const { return _fmts; } protected: - std::string _fmts; - Type _type; + const std::string _fmts; + const Type _type; }; typedef std::queue < Argument > ArgumentQueue; - //////////////////////////////////////////////////////////// + ////////////////////////////////// + + template < typename V > + bool number_verify_signed_short( V value ) const + { + return + ((typeid(V) == typeid(short int) || + typeid(V) == typeid(short) || + typeid(V) == typeid(const short int) || + typeid(V) == typeid(const short) || + typeid(V) == typeid(volatile short int) || + typeid(V) == typeid(volatile short)) && + sizeof(V) == sizeof(short)); + } + + template < typename V > + bool number_verify_unsigned_short( V value ) const + { + return + ((typeid(V) == typeid(unsigned short int) || + typeid(V) == typeid(unsigned short) || + typeid(V) == typeid(const unsigned short int) || + typeid(V) == typeid(const unsigned short) || + typeid(V) == typeid(volatile unsigned short int) || + typeid(V) == typeid(volatile unsigned short)) && + sizeof(V) == sizeof(unsigned short)); + } + + template < typename V > + bool number_verify_signed_long( V value ) const + { + return + ((typeid(V) == typeid(long int) || + typeid(V) == typeid(long) || + typeid(V) == typeid(const long int) || + typeid(V) == typeid(const long) || + typeid(V) == typeid(volatile long int) || + typeid(V) == typeid(volatile long)) && + sizeof(V) == sizeof(long)); + } + + template < typename V > + bool number_verify_unsigned_long( V value ) const + { + return + ((typeid(V) == typeid(unsigned long int) || + typeid(V) == typeid(unsigned long) || + typeid(V) == typeid(const unsigned long int) || + typeid(V) == typeid(const unsigned long) || + typeid(V) == typeid(volatile unsigned long int) || + typeid(V) == typeid(volatile unsigned long)) && + sizeof(V) == sizeof(long long)); + } + + template < typename V > + bool number_verify_signed_long_long( V value ) const + { + return + ((typeid(V) == typeid(long long int) || + typeid(V) == typeid(long long) || + typeid(V) == typeid(const long long int) || + typeid(V) == typeid(const long long) || + typeid(V) == typeid(volatile long long) || + typeid(V) == typeid(volatile long long int)) && + sizeof(V) == sizeof(long long)); + } + + template < typename V > + bool number_verify_unsigned_long_long( V value ) const + { + return + ((typeid(V) == typeid(unsigned long long int) || + typeid(V) == typeid(unsigned long long) || + typeid(V) == typeid(const unsigned long long int) || + typeid(V) == typeid(const unsigned long long) || + typeid(V) == typeid(volatile unsigned long long) || + typeid(V) == typeid(volatile unsigned long long int)) && + sizeof(V) == sizeof(unsigned long long)); + } + + template < typename V > + bool number_verify_signed_int( V value ) const + { + return + (sizeof(V) <= sizeof(int) || + typeid(V) == typeid(int) || + typeid(V) == typeid(const int) || + typeid(V) == typeid(volatile int)); + } - public: + template < typename V > + bool number_verify_unsigned_int( V value ) const + { + return + (sizeof(V) <= sizeof(unsigned int) || + typeid(V) == typeid(unsigned int) || + typeid(V) == typeid(const unsigned int) || + typeid(V) == typeid(volatile unsigned int)); + } template < typename V > - Format & operator%( V value ) + bool generic_verify( V value, const Type type ) const + { + switch (type) + { + /* EXCEPTION: consider any number an valid input. */ + case T_SIGNED_INT: + case T_UNSIGNED_INT: + return + (number_verify_signed_int(value) || + number_verify_unsigned_int(value) || + number_verify_signed_long(value) || + number_verify_unsigned_long(value) || + number_verify_signed_short(value) || + number_verify_unsigned_short(value)); + + case T_SIGNED_SHORT_SHORT: + return (typeid(V) == typeid(char) || typeid(V) == typeid(const char)); + + case T_SIGNED_SHORT: + return number_verify_signed_short(value); + + case T_SIGNED_LONG: + return number_verify_signed_long(value); + + case T_SIGNED_LONG_LONG: + return number_verify_signed_long_long(value); + + case T_UNSIGNED_SHORT_SHORT: + return (typeid(V) == typeid(unsigned char) || typeid(V) == typeid(unsigned char)); + + case T_UNSIGNED_SHORT: + return number_verify_unsigned_short(value); + + case T_UNSIGNED_LONG: + return number_verify_unsigned_long(value); + + case T_UNSIGNED_LONG_LONG: + return number_verify_unsigned_long_long(value); + + case T_FLOAT: + return (typeid(V) == typeid(float)) || (typeid(V) == typeid(double) || + typeid(V) == typeid(const float)) || (typeid(V) == typeid(const double)); + + case T_CHAR: + return (typeid(V) == typeid(char)) || (typeid(V) == typeid(unsigned char) || + typeid(V) == typeid(const char)) || (typeid(V) == typeid(const unsigned char)); + + case T_POINTER: + case T_STRING: + return false; + + case T_ANYTHING: + return true; + + case T_LITERAL: + return false; + } + + return false; + }; + + const Argument * next_argument(void); + + void push_argument(std::string & data, const Type type); + void pop_argument(void); + + void initialize(const char *); + + protected: + ArgumentQueue _args; + std::string _result; + +}; + +template < bool E = false > +struct FormatBase: protected FormatTraits, protected FormatException < E > +{ + static const unsigned int strings_base_length = 64; + static const unsigned int generic_base_length = 64; + + explicit FormatBase(const char * format_string) + : _format(format_string), _valid(true) + { + FormatTraits::initialize(format_string); + }; + + explicit FormatBase(std::string format_string) + : _format(format_string), _valid(true) { - if (!validity_check()) + FormatTraits::initialize(format_string.c_str()); + }; + + bool valid(void) const + { + return _valid; + } + + const std::string str() + { + if (valid() && (next_argument() != NULL)) + { + std::string msg; + + // TODO: why format appears two times? + msg += "too few arguments passed for format '"; + msg += _format; + msg += "' ("; + msg += _format; + msg += ")"; + + mark_invalid(msg); + } + + raise(); + return _result; + }; + + //////////////////////////////////////////////////////////// + + template < typename V > + FormatBase & operator%( V value ) + { + if (!valid()) return *this; const Argument * top = next_argument(); @@ -149,7 +363,7 @@ struct Format { char temp[generic_base_length]; - if (!generic_verify(value, top->type())) + if (!FormatTraits::generic_verify(value, top->type())) { std::string msg; @@ -171,14 +385,14 @@ struct Format pop_argument(); } - raise_check(); + raise(); return *this; } template < typename V > - Format & operator%( V * value ) + FormatBase & operator%( V * value ) { - if (!validity_check()) + if (!valid()) return *this; const Argument * top = next_argument(); @@ -256,20 +470,13 @@ struct Format pop_argument(); } - raise_check(); + raise(); return *this; } -/* - Format & operator%( std::string value ) - { - return operator%(value); - } -*/ - - Format & operator%( const std::string value ) + FormatBase & operator%( const std::string value ) { - if (!validity_check()) + if (!valid()) return *this; const Argument * top = next_argument(); @@ -313,200 +520,42 @@ struct Format pop_argument(); } - raise_check(); + raise(); return *this; } - protected: - - template < typename V > - bool number_verify_signed_short( V value ) - { - return - ((typeid(V) == typeid(short int) || - typeid(V) == typeid(short) || - typeid(V) == typeid(const short int) || - typeid(V) == typeid(const short) || - typeid(V) == typeid(volatile short int) || - typeid(V) == typeid(volatile short)) && - sizeof(V) == sizeof(short)); - } - - template < typename V > - bool number_verify_unsigned_short( V value ) - { - return - ((typeid(V) == typeid(unsigned short int) || - typeid(V) == typeid(unsigned short) || - typeid(V) == typeid(const unsigned short int) || - typeid(V) == typeid(const unsigned short) || - typeid(V) == typeid(volatile unsigned short int) || - typeid(V) == typeid(volatile unsigned short)) && - sizeof(V) == sizeof(unsigned short)); - } - - template < typename V > - bool number_verify_signed_long( V value ) - { - return - ((typeid(V) == typeid(long int) || - typeid(V) == typeid(long) || - typeid(V) == typeid(const long int) || - typeid(V) == typeid(const long) || - typeid(V) == typeid(volatile long int) || - typeid(V) == typeid(volatile long)) && - sizeof(V) == sizeof(long)); - } - - template < typename V > - bool number_verify_unsigned_long( V value ) - { - return - ((typeid(V) == typeid(unsigned long int) || - typeid(V) == typeid(unsigned long) || - typeid(V) == typeid(const unsigned long int) || - typeid(V) == typeid(const unsigned long) || - typeid(V) == typeid(volatile unsigned long int) || - typeid(V) == typeid(volatile unsigned long)) && - sizeof(V) == sizeof(long long)); - } - - template < typename V > - bool number_verify_signed_long_long( V value ) - { - return - ((typeid(V) == typeid(long long int) || - typeid(V) == typeid(long long) || - typeid(V) == typeid(const long long int) || - typeid(V) == typeid(const long long) || - typeid(V) == typeid(volatile long long) || - typeid(V) == typeid(volatile long long int)) && - sizeof(V) == sizeof(long long)); - } - - template < typename V > - bool number_verify_unsigned_long_long( V value ) + protected: + void mark_invalid(std::string & msg) { - return - ((typeid(V) == typeid(unsigned long long int) || - typeid(V) == typeid(unsigned long long) || - typeid(V) == typeid(const unsigned long long int) || - typeid(V) == typeid(const unsigned long long) || - typeid(V) == typeid(volatile unsigned long long) || - typeid(V) == typeid(volatile unsigned long long int)) && - sizeof(V) == sizeof(unsigned long long)); - } - - template < typename V > - bool number_verify_signed_int( V value ) - { - return - (sizeof(V) <= sizeof(int) || - typeid(V) == typeid(int) || - typeid(V) == typeid(const int) || - typeid(V) == typeid(volatile int)); - } + if (_valid) + { + _valid = false; - template < typename V > - bool number_verify_unsigned_int( V value ) - { - return - (sizeof(V) <= sizeof(unsigned int) || - typeid(V) == typeid(unsigned int) || - typeid(V) == typeid(const unsigned int) || - typeid(V) == typeid(volatile unsigned int)); + _result = "** INVALID FORMAT: "; + _result += msg; + _result += " **"; + } } - template < typename V > - bool generic_verify( V value, Type type ) + void raise(void) const { - switch (type) + if (!_valid) { - /* EXCEPTION: consider any number an valid input. */ - case T_SIGNED_INT: - case T_UNSIGNED_INT: - return - (number_verify_signed_int(value) || - number_verify_unsigned_int(value) || - number_verify_signed_long(value) || - number_verify_unsigned_long(value) || - number_verify_signed_short(value) || - number_verify_unsigned_short(value)); - - case T_SIGNED_SHORT_SHORT: - return (typeid(V) == typeid(char) || typeid(V) == typeid(const char)); - - case T_SIGNED_SHORT: - return number_verify_signed_short(value); - - case T_SIGNED_LONG: - return number_verify_signed_long(value); - - case T_SIGNED_LONG_LONG: - return number_verify_signed_long_long(value); - - case T_UNSIGNED_SHORT_SHORT: - return (typeid(V) == typeid(unsigned char) || typeid(V) == typeid(unsigned char)); - - case T_UNSIGNED_SHORT: - return number_verify_unsigned_short(value); - - case T_UNSIGNED_LONG: - return number_verify_unsigned_long(value); - - case T_UNSIGNED_LONG_LONG: - return number_verify_unsigned_long_long(value); - - case T_FLOAT: - return (typeid(V) == typeid(float)) || (typeid(V) == typeid(double) || - typeid(V) == typeid(const float)) || (typeid(V) == typeid(const double)); - - case T_CHAR: - return (typeid(V) == typeid(char)) || (typeid(V) == typeid(unsigned char) || - typeid(V) == typeid(const char)) || (typeid(V) == typeid(const unsigned char)); - - case T_POINTER: - case T_STRING: - return false; - - case T_ANYTHING: - return true; - - case T_LITERAL: - return false; + // call specialized class + FormatException< E >::raise(_result); } - - return false; - }; - - void mark_invalid(std::string &); - - bool validity_check(void); - void raise_check(void); - -/* - struct NoArgumentLeft - { - NoArgumentLeft(): empty(0) {}; - - unsigned int empty; - }; -*/ - - const Argument * next_argument(void); - - void pop_argument(void); - void push_argument(std::string & data, Type type); + } private: - std::string _format; + const std::string _format; + bool _valid; +}; - bool _valid; - bool _raise; +/* useful typedef for general usage (not generating exceptions) */ +typedef FormatBase<> Format; - std::string _result; - ArgumentQueue _args; -}; +/* macros used for shortening lines and making the code clearer */ +#define STG(x) (x).str() +#define FMT(x) Format(x) #endif /* _FORMAT_H_ */ - diff --git a/src/mod/endpoints/mod_khomp/commons/function.hpp b/src/mod/endpoints/mod_khomp/commons/base/function.hpp similarity index 65% rename from src/mod/endpoints/mod_khomp/commons/function.hpp rename to src/mod/endpoints/mod_khomp/commons/base/function.hpp index c448299..7470bf2 100644 --- a/src/mod/endpoints/mod_khomp/commons/function.hpp +++ b/src/mod/endpoints/mod_khomp/commons/base/function.hpp @@ -46,12 +46,13 @@ namespace Function { - struct EmptyFunction {}; + struct EmptyFunction {}; + struct NonMemberFunction {}; /**/ template < typename FunctionTraits > - struct StorageBase: NEW_REFCOUNTER(StorageBase < FunctionTraits >) + struct StorageBase: COUNTER_SUPER(StorageBase < FunctionTraits >) { typedef typename FunctionTraits::BaseType BaseType; @@ -59,27 +60,33 @@ namespace Function typedef typename FunctionTraits::ObjType ObjType; template < typename Functor > - StorageBase(Functor f) - : _object(reinterpret_cast<ObjType>(new Functor(f))), - _function(reinterpret_cast<FunType>(&(Functor::operator()))), + StorageBase(const Functor f) + : _object(reinterpret_cast< ObjType >(new Functor(f))), + _function(reinterpret_cast< FunType >(&Functor::operator())), _malloced(true) {}; template < typename Functor > StorageBase(Functor & f, bool malloced) - : _object(reinterpret_cast<ObjType>((malloced ? new Functor(f) : &f))), - _function(reinterpret_cast<FunType>(&(Functor::operator()))), + : _object(reinterpret_cast< ObjType >((malloced ? new Functor(f) : &f))), + _function(reinterpret_cast< FunType >(&Functor::operator())), _malloced(malloced) {}; + StorageBase(FunType const * member) + : _object(reinterpret_cast< ObjType >(0)), + _function(reinterpret_cast< FunType >(member)), + _malloced(false) + {}; + StorageBase() - : _object(reinterpret_cast<ObjType>(0)), - _function(reinterpret_cast<FunType>(0)), + : _object(reinterpret_cast< ObjType >(0)), + _function(reinterpret_cast< FunType >(0)), _malloced(false) {}; StorageBase(const StorageBase & o) - : INC_REFCOUNTER(o, StorageBase < FunctionTraits >), + : COUNTER_REFER(o, StorageBase < FunctionTraits >), _object(o._object), _function(o._function), _malloced(o._malloced) {}; @@ -95,9 +102,9 @@ namespace Function template < typename Functor > void operator=(Functor f) { - _object = reinterpret_cast<ObjType>(new Functor(f)), - _function = reinterpret_cast<FunType>(&(Functor::operator())); - _malloced = false; + _object = reinterpret_cast< ObjType >(new Functor(f)), + _function = reinterpret_cast< FunType >(&Functor::operator()); + _malloced = true; } protected: @@ -229,10 +236,15 @@ namespace Function typedef StorageBase < Function0Traits < R > > Storage; template < typename Functor > - Function0(Functor f): Storage(f) {}; + Function0(const Functor f) + : Storage(f) {}; template < typename Functor > - Function0(Functor & f, bool m): Storage(f, m) {}; + Function0(Functor & f, bool m) + : Storage(f, m) {}; + + Function0(const typename Function0Traits < R >::FunType * m) + : Storage(m) {}; Function0() {}; @@ -243,6 +255,18 @@ namespace Function return ((Storage::_object)->*(Storage::_function))(); } + + template < typename Object > + R operator()(Object * object) + { + if (reinterpret_cast<void *>(Storage::_function) == 0) + throw EmptyFunction(); + + if (reinterpret_cast<void *>(Storage::_object) != 0) + throw NonMemberFunction(); + + return (reinterpret_cast< typename Function0Traits < R >::ObjType *>(object)->*(Storage::_function))(); + } }; template < typename R, typename A0 > @@ -251,10 +275,15 @@ namespace Function typedef StorageBase < Function1Traits < R, A0 > > Storage; template < typename Functor > - Function1(Functor f): Storage(f) {}; + Function1(const Functor f) + : Storage(f) {}; template < typename Functor > - Function1(Functor & f, bool m): Storage(f, m) {}; + Function1(Functor & f, bool m) + : Storage(f, m) {}; + + Function1(const typename Function1Traits < R, A0 >::FunType * m) + : Storage(m) {}; Function1() {}; @@ -265,6 +294,18 @@ namespace Function return ((Storage::_object)->*(Storage::_function))(a0); } + + template < typename Object > + R operator()(Object * object, A0 a0) + { + if (reinterpret_cast<void *>(Storage::_function) == 0) + throw EmptyFunction(); + + if (reinterpret_cast<void *>(Storage::_object) != 0) + throw NonMemberFunction(); + + return (reinterpret_cast< typename Function1Traits < R, A0 >::ObjType *>(object)->*(Storage::_function))(a0); + } }; template < typename R, typename A0, typename A1 > @@ -273,10 +314,15 @@ namespace Function typedef StorageBase < Function2Traits < R, A0, A1 > > Storage; template < typename Functor > - Function2(Functor f): Storage(f) {}; + Function2(const Functor f) + : Storage(f) {}; template < typename Functor > - Function2(Functor & f, bool m): Storage(f, m) {}; + Function2(Functor & f, bool m) + : Storage(f, m) {}; + + Function2(const typename Function2Traits < R, A0, A1 >::FunType * m) + : Storage(m) {}; Function2() {}; @@ -287,6 +333,18 @@ namespace Function return ((Storage::_object)->*(Storage::_function))(a0, a1); } + + template < typename Object > + R operator()(Object * object, A0 a0, A1 a1) + { + if (reinterpret_cast<void *>(Storage::_function) == 0) + throw EmptyFunction(); + + if (reinterpret_cast<void *>(Storage::_object) != 0) + throw NonMemberFunction(); + + return (reinterpret_cast< typename Function2Traits < R, A0, A1 >::ObjType *>(object)->*(Storage::_function))(a0, a1); + } }; template < typename R, typename A0, typename A1, typename A2 > @@ -295,20 +353,37 @@ namespace Function typedef StorageBase < Function3Traits < R, A0, A1, A2 > > Storage; template < typename Functor > - Function3(Functor f): Storage(f) {}; + Function3(const Functor f) + : Storage(f) {}; template < typename Functor > - Function3(Functor & f, bool m): Storage(f, m) {}; + Function3(Functor & f, bool m) + : Storage(f, m) {}; + + Function3(const typename Function3Traits < R, A0, A1, A2 >::FunType * m) + : Storage(m) {}; Function3() {}; R operator()(A0 a0, A1 a1, A2 a2) { - if (reinterpret_cast<void *>(Storage::_object) == 0) + if (reinterpret_cast<const void *>(Storage::_object) == 0) throw EmptyFunction(); return ((Storage::_object)->*(Storage::_function))(a0, a1, a2); } + + template < typename Object > + R operator()(Object * object, A0 a0, A1 a1, A2 a2) + { + if (reinterpret_cast<void *>(Storage::_function) == 0) + throw EmptyFunction(); + + if (reinterpret_cast<void *>(Storage::_object) != 0) + throw NonMemberFunction(); + + return (reinterpret_cast< typename Function3Traits < R, A0, A1, A2 >::ObjType *>(object)->*(Storage::_function))(a0, a1, a2); + } }; template < typename R, typename A0, typename A1, typename A2, typename A3 > @@ -317,10 +392,15 @@ namespace Function typedef StorageBase < Function4Traits < R, A0, A1, A2, A3 > > Storage; template < typename Functor > - Function4(Functor f): Storage(f) {}; + Function4(const Functor f) + : Storage(f) {}; template < typename Functor > - Function4(Functor & f, bool m): Storage(f, m) {}; + Function4(Functor & f, bool m) + : Storage(f, m) {}; + + Function4(const typename Function4Traits < R, A0, A1, A2, A3 >::FunType * m) + : Storage(m) {}; Function4() {}; @@ -331,6 +411,18 @@ namespace Function return ((Storage::_object)->*(Storage::_function))(a0, a1, a2, a3); } + + template < typename Object > + R operator()(Object * object, A0 a0, A1 a1, A2 a2, A3 a3) + { + if (reinterpret_cast<void *>(Storage::_function) == 0) + throw EmptyFunction(); + + if (reinterpret_cast<void *>(Storage::_object) != 0) + throw NonMemberFunction(); + + return (reinterpret_cast< typename Function4Traits < R, A0, A1, A2, A3 >::ObjType *>(object)->*(Storage::_function))(a0, a1, a2, a3); + } }; }; diff --git a/src/mod/endpoints/mod_khomp/commons/initializer.hpp b/src/mod/endpoints/mod_khomp/commons/base/initializer.hpp similarity index 86% rename from src/mod/endpoints/mod_khomp/commons/initializer.hpp rename to src/mod/endpoints/mod_khomp/commons/base/initializer.hpp index e0e110d..16359e8 100644 --- a/src/mod/endpoints/mod_khomp/commons/initializer.hpp +++ b/src/mod/endpoints/mod_khomp/commons/base/initializer.hpp @@ -47,32 +47,32 @@ template < typename Type > struct Initializer: public std::vector< Type > { - typedef std::vector< Type > super; + typedef std::vector< Type > Super; - Initializer(Type e) { push_back(e); }; - Initializer(Type & e) { push_back(e); }; + Initializer(Type e) { Super::push_back(e); }; + Initializer(Type & e) { Super::push_back(e); }; - Initializer & operator&(Initializer v) + Initializer & operator&(const Initializer v) { - insert(super::end(), v.begin(), v.end()); + Super::insert(Super::end(), v.begin(), v.end()); return *this; }; Initializer & operator&(Initializer & v) { - insert(super::end(), v.begin(), v.end()); + Super::insert(Super::end(), v.begin(), v.end()); return *this; }; Initializer & operator&(Type v) { - insert(super::end(), v); + Super::insert(Super::end(), v); return *this; }; Initializer & operator&(Type & v) { - insert(super::end(), v); + Super::insert(Super::end(), v); return *this; }; }; diff --git a/src/mod/endpoints/mod_khomp/commons/k3lapi.cpp b/src/mod/endpoints/mod_khomp/commons/base/k3lapi.cpp similarity index 77% rename from src/mod/endpoints/mod_khomp/commons/k3lapi.cpp rename to src/mod/endpoints/mod_khomp/commons/base/k3lapi.cpp index f5afa13..09f5c81 100644 --- a/src/mod/endpoints/mod_khomp/commons/k3lapi.cpp +++ b/src/mod/endpoints/mod_khomp/commons/base/k3lapi.cpp @@ -41,18 +41,16 @@ #include <k3lapi.hpp> -#include <format.hpp> -#include <verbose.hpp> +#include <string.h> -K3LAPI::K3LAPI(bool has_exceptions) -: _has_exceptions(has_exceptions), - _device_count(0), _channel_count(0), _link_count(0), +K3LAPIBase::K3LAPIBase() +: _device_count(0), _channel_count(0), _link_count(0), _device_config(0), _channel_config(0), _link_config(0) {}; /* initialize the whole thing! */ -void K3LAPI::start(void) +void K3LAPIBase::start(void) { /* tie the used k3l to the compiled k3l version */ char *ret = k3lStart(k3lApiMajorVersion, k3lApiMinorVersion, 0); //k3lApiBuildVersion); @@ -64,7 +62,7 @@ void K3LAPI::start(void) init(); } -void K3LAPI::stop(void) +void K3LAPIBase::stop(void) { k3lStop(); fini(); @@ -72,7 +70,7 @@ void K3LAPI::stop(void) /* envio de comandos para placa */ -void K3LAPI::mixer(int32 dev, int32 obj, byte track, KMixerSource src, int32 index) +void K3LAPIBase::mixer(int32 dev, int32 obj, byte track, KMixerSource src, int32 index) const { KMixerCommand mix; @@ -83,7 +81,7 @@ void K3LAPI::mixer(int32 dev, int32 obj, byte track, KMixerSource src, int32 ind command(dev, obj, CM_MIXER, (const char *) &mix); } -void K3LAPI::mixerRecord(int32 dev, int32 obj, byte track, KMixerSource src, int32 index) +void K3LAPIBase::mixerRecord(int32 dev, KDeviceType type, int32 obj, byte track, KMixerSource src, int32 index) const { /* estes buffers *NAO PODEM SER ESTATICOS*! */ char cmd[] = { 0x3f, 0x03, (char)obj, (char)track, 0xff, 0xff }; @@ -131,12 +129,12 @@ void K3LAPI::mixerRecord(int32 dev, int32 obj, byte track, KMixerSource src, int break; } - int32 dsp = get_dsp(dev, DSP_AUDIO); + int32 dsp = get_dsp(type, DSP_AUDIO); raw_command(dev, dsp, cmd, sizeof(cmd)); } -void K3LAPI::mixerCTbus(int32 dev, int32 obj, byte track, KMixerSource src, int32 index) +void K3LAPIBase::mixerCTbus(int32 dev, int32 obj, byte track, KMixerSource src, int32 index) const { KMixerCommand mix; @@ -147,12 +145,12 @@ void K3LAPI::mixerCTbus(int32 dev, int32 obj, byte track, KMixerSource src, int3 command(dev, obj, CM_MIXER_CTBUS, (const char *) &mix); } -void K3LAPI::command(int32 dev, int32 obj, int32 code, std::string & str) +void K3LAPIBase::command(int32 dev, int32 obj, int32 code, std::string & str) const { command(dev, obj, code, str.c_str()); } -void K3LAPI::command (int32 dev, int32 obj, int32 code, const char * parms) +void K3LAPIBase::command (int32 dev, int32 obj, int32 code, const char * parms) const { K3L_COMMAND cmd; @@ -166,12 +164,12 @@ void K3LAPI::command (int32 dev, int32 obj, int32 code, const char * parms) throw failed_command(code, dev, obj, rc); } -void K3LAPI::raw_command(int32 dev, int32 dsp, std::string & str) +void K3LAPIBase::raw_command(int32 dev, int32 dsp, std::string & str) const { raw_command(dev, dsp, str.data(), str.size()); } -void K3LAPI::raw_command(int32 dev, int32 dsp, const char * cmds, int32 size) +void K3LAPIBase::raw_command(int32 dev, int32 dsp, const char * cmds, int32 size) const { std::string str(cmds, size); @@ -181,7 +179,7 @@ void K3LAPI::raw_command(int32 dev, int32 dsp, const char * cmds, int32 size) throw failed_raw_command(dev, dsp, rc); } -KLibraryStatus K3LAPI::get_param(K3L_EVENT *ev, const char *name, std::string &res) +KLibraryStatus K3LAPIBase::get_param(K3L_EVENT *ev, const char *name, std::string &res) const { char tmp_param[256]; memset((void*)tmp_param, 0, sizeof(tmp_param)); @@ -195,7 +193,7 @@ KLibraryStatus K3LAPI::get_param(K3L_EVENT *ev, const char *name, std::string &r return ksSuccess; } -std::string K3LAPI::get_param(K3L_EVENT *ev, const char *name) +std::string K3LAPIBase::get_param(K3L_EVENT *ev, const char *name) const { std::string res; @@ -207,7 +205,7 @@ std::string K3LAPI::get_param(K3L_EVENT *ev, const char *name) return res; } -void K3LAPI::init(void) +void K3LAPIBase::init(void) { if (_device_count != 0) return; @@ -217,20 +215,16 @@ void K3LAPI::init(void) _device_config = new device_conf_type[_device_count]; _channel_config = new channel_ptr_conf_type[_device_count]; _link_config = new link_ptr_conf_type[_device_count]; - _channel_count = new unsigned int[_device_count]; - _link_count = new unsigned int[_device_count]; + _channel_count = new unsigned int[_device_count]; + _link_count = new unsigned int[_device_count]; for (unsigned int dev = 0; dev < _device_count; dev++) { - KLibraryStatus ret = ksSuccess; - _device_type[dev] = (KDeviceType) k3lGetDeviceType(dev); /* caches each device config */ - ret = (KLibraryStatus)k3lGetDeviceConfig(dev, ksoDevice + dev, &(_device_config[dev]), sizeof(_device_config[dev])); - - if (ret != ksSuccess) - throw start_failed(STG(FMT("k3lGetDeviceConfig(dev=%d): %s") % dev % Verbose::status(ret))); + if (k3lGetDeviceConfig(dev, ksoDevice + dev, &(_device_config[dev]), sizeof(_device_config[dev])) != ksSuccess) + throw start_failed("k3lGetDeviceConfig(device)"); /* adjust channel/link count for device */ _channel_count[dev] = _device_config[dev].ChannelCount; @@ -241,10 +235,9 @@ void K3LAPI::init(void) for (unsigned int obj = 0; obj < _channel_count[dev]; obj++) { - ret = (KLibraryStatus)k3lGetDeviceConfig(dev, ksoChannel + obj, &(_channel_config[dev][obj]), sizeof(_channel_config[dev][obj])); - - if (ret != ksSuccess) - throw start_failed(STG(FMT("k3lGetDeviceConfig(dev=%d,chan=%d): %s") % dev % obj % Verbose::status(ret))); + if (k3lGetDeviceConfig(dev, ksoChannel + obj, &(_channel_config[dev][obj]), + sizeof(_channel_config[dev][obj])) != ksSuccess) + throw start_failed("k3lGetDeviceConfig(channel)"); } /* adjust link count for device */ @@ -255,15 +248,14 @@ void K3LAPI::init(void) for (unsigned int obj = 0; obj < _link_count[dev]; obj++) { - ret = (KLibraryStatus)k3lGetDeviceConfig(dev, ksoLink + obj, &(_link_config[dev][obj]), sizeof(_link_config[dev][obj])); - - if (ret != ksSuccess) - throw start_failed(STG(FMT("k3lGetDeviceConfig(dev=%d,link=%d): %s") % dev % obj % Verbose::status(ret))); + if (k3lGetDeviceConfig(dev, ksoLink + obj, &(_link_config[dev][obj]), + sizeof(_link_config[dev][obj])) != ksSuccess) + throw start_failed("k3lGetDeviceConfig(link)"); } } } -void K3LAPI::fini(void) +void K3LAPIBase::fini(void) { for (unsigned int dev = 0; dev < _device_count; dev++) { @@ -290,9 +282,9 @@ void K3LAPI::fini(void) if (_link_count) { delete[] _link_count; _link_count = NULL; } } -int32 K3LAPI::get_dsp(int32 dev, K3LAPI::DspType type) +int32 K3LAPIBase::get_dsp(KDeviceType devtype, K3LAPI::DspType type) const { - switch (device_type(dev)) + switch (devtype) { case kdtFXO: case kdtFXOVoIP: @@ -311,3 +303,7 @@ int32 K3LAPI::get_dsp(int32 dev, K3LAPI::DspType type) } } +int32 K3LAPIBase::get_dsp(const K3LAPIBase::GenericTarget & tgt, K3LAPI::DspType type) const +{ + return get_dsp(_device_type[tgt.device], type); +} diff --git a/src/mod/endpoints/mod_khomp/commons/k3lapi.hpp b/src/mod/endpoints/mod_khomp/commons/base/k3lapi.hpp similarity index 50% rename from src/mod/endpoints/mod_khomp/commons/k3lapi.hpp rename to src/mod/endpoints/mod_khomp/commons/base/k3lapi.hpp index 5965484..ef12a3f 100644 --- a/src/mod/endpoints/mod_khomp/commons/k3lapi.hpp +++ b/src/mod/endpoints/mod_khomp/commons/base/k3lapi.hpp @@ -40,6 +40,9 @@ */ #include <string> +#include <stdexcept> + +#include <format.hpp> #include <k3l.h> @@ -59,15 +62,110 @@ #ifndef _K3LAPI_HPP_ #define _K3LAPI_HPP_ -struct K3LAPI +struct K3LAPITraits +{ + struct invalid_device; + struct invalid_channel; + struct invalid_link; + + struct invalid_target: public std::runtime_error + { + friend class invalid_device; + friend class invalid_channel; + friend class invalid_link; + + const int32 device, object; + + protected: + invalid_target(int32 _device, int32 _object, const std::string & msg) + : std::runtime_error(msg), device(_device), object(_object) {}; + }; + + struct invalid_device: public invalid_target + { + invalid_device(int32 _device) + : invalid_target(_device, -1, STG(FMT("invalid device number '%d'") % _device)) {}; + }; + + struct invalid_channel: public invalid_target + { + invalid_channel(int32 _device, int32 _channel) + : invalid_target(_device, _channel, STG(FMT("invalid channel number '%d' on device '%d'") % _channel % _device)) {}; + }; + + struct invalid_link: public invalid_target + { + invalid_link(int32 _device, int32 _link) + : invalid_target(_device, _link, STG(FMT("invalid link number '%d' on device '%d'") % _link % _device)) {}; + }; +}; + +struct K3LAPIBase { + /* High level checked object identifier. */ + + struct GenericTarget + { + typedef enum { DEVICE, CHANNEL, MIXER, LINK } Type; + + GenericTarget(const K3LAPIBase & k3lapi, Type _type, int32 _device, int32 _object) + : type(_type), device((unsigned int)_device), object((unsigned int)_object) + { + switch (_type) + { + case DEVICE: + if (!k3lapi.valid_device(_device)) + throw K3LAPITraits::invalid_device(_device); + break; + + case CHANNEL: + case MIXER: + if (!k3lapi.valid_channel(_device, _object)) + throw K3LAPITraits::invalid_channel(_device, _object); + break; + + case LINK: + if (!k3lapi.valid_link(_device, _object)) + throw K3LAPITraits::invalid_link(_device, _object); + break; + } + }; + + const Type type; + + const unsigned int device; + const unsigned int object; + }; + +/* + struct LinkTarget : public GenericTarget + { + LinkTarget(const K3LAPIBase & k3lapi, int32 _device, int32 _object) + : GenericTarget(k3lapi, GenericTarget::LINK, _device, _object) {}; + }; + + struct ChannelTarget : public GenericTarget + { + ChannelTarget(const K3LAPIBase & k3lapi, int32 _device, int32 _object) + : GenericTarget(k3lapi, GenericTarget::CHANNEL, _device, _object) {}; + }; + +*/ + template < GenericTarget::Type T > + struct Target: public GenericTarget + { + Target(const K3LAPIBase & k3lapi, int32 _device, int32 _object) + : GenericTarget(k3lapi, T, _device, _object) {}; + +// operator const GenericTarget&() const { return static_cast<const GenericTarget &>(*this); }; + }; + /* exceptions */ - struct start_failed + struct start_failed: public std::runtime_error { - start_failed(const char * _msg) : msg(_msg) {}; - start_failed(std::string _msg) : msg(_msg) {}; - std::string msg; + start_failed(const char * msg) + : std::runtime_error(msg) {}; }; struct failed_command @@ -91,30 +189,6 @@ struct K3LAPI int32 rc; }; - struct invalid_device - { - invalid_device(int32 _device) - : device(_device) {}; - - int32 device; - }; - - struct invalid_channel - { - invalid_channel(int32 _device, int32 _channel) - : device(_device), channel(_channel) {}; - - int32 device, channel; - }; - - struct invalid_link - { - invalid_link(unsigned int _device, unsigned int _link) - : device(_device), link(_link) {}; - - int32 device, link; - }; - struct get_param_failed { get_param_failed(std::string _name, int32 _rc) @@ -124,6 +198,8 @@ struct K3LAPI KLibraryStatus rc; }; + /* typedefs essenciais */ + typedef K3L_DEVICE_CONFIG device_conf_type; typedef K3L_CHANNEL_CONFIG channel_conf_type; typedef K3L_CHANNEL_CONFIG * channel_ptr_conf_type; @@ -132,8 +208,8 @@ struct K3LAPI /* constructors/destructors */ - K3LAPI(bool has_exceptions = false); - virtual ~K3LAPI() {}; + K3LAPIBase(); + virtual ~K3LAPIBase() {}; /* (init|final)ialize the whole thing! */ @@ -142,239 +218,106 @@ struct K3LAPI /* verificacao de intervalos */ - inline bool valid_device(int32 dev) + inline bool valid_device(int32 dev) const { return (dev >= 0 && dev < ((int32)_device_count)); } - inline bool valid_channel(int32 dev, int32 obj) + inline bool valid_channel(int32 dev, int32 obj) const { return (valid_device(dev) && obj >= 0 && obj < ((int32)_channel_count[dev])); } - inline bool valid_link(int32 dev, int32 obj) + inline bool valid_link(int32 dev, int32 obj) const { return (valid_device(dev) && obj >= 0 && obj < ((int32)_link_count[dev])); } - /*! - \brief High level object identifier - Since Khomp works with an object concept, this is used to map the - object id with its proper type. - */ - struct target - { - /*! The types a target can have */ - typedef enum { DEVICE, CHANNEL, MIXER, LINK } target_type; - - target(K3LAPI & k3lapi, target_type type_init, int32 device_value, int32 object_value) - : type(type_init), - device((unsigned short)device_value), - object((unsigned short)object_value) - { - switch (type_init) - { - case DEVICE: - if (!k3lapi.valid_device(device_value)) - throw invalid_device(device_value); - break; - - case CHANNEL: - case MIXER: - if (!k3lapi.valid_channel(device_value, object_value)) - throw invalid_channel(device_value, object_value); - break; - - case LINK: - if (!k3lapi.valid_link(device_value, object_value)) - throw invalid_link(device_value, object_value); - break; - } - - }; - - const target_type type; - - const unsigned short device; - const unsigned short object; - }; - /* envio de comandos para placa (geral) */ - void raw_command(int32 dev, int32 dsp, std::string & str); - void raw_command(int32 dev, int32 dsp, const char * cmds, int32 size); + void raw_command(int32 dev, int32 dsp, std::string & str) const; + void raw_command(int32 dev, int32 dsp, const char * cmds, int32 size) const; /* obter dados 'cacheados' (geral) */ - inline unsigned int device_count(void) + inline unsigned int device_count(void) const { return _device_count; } /* envio de comandos para placa (sem identificadores) */ - void mixer(int32 dev, int32 obj, byte track, KMixerSource src, int32 index); - void mixerRecord(int32 dev, int32 obj, byte track, KMixerSource src, int32 index); - void mixerCTbus(int32 dev, int32 obj, byte track, KMixerSource src, int32 index); - - void command (int32 dev, int32 obj, int32 code, std::string & str); - void command (int32 dev, int32 obj, int32 code, const char * parms = NULL); - - /* obter dados 'cacheados' (sem identificadores) */ - - inline unsigned int channel_count(int32 dev) - { - if (!valid_device(dev)) - { - if (_has_exceptions) - throw invalid_device(dev); - else - return 0; - } - - return _channel_count[dev]; - } - - inline unsigned int link_count(int32 dev) - { - if (!valid_device(dev)) - { - if (_has_exceptions) - throw invalid_device(dev); - else - return 0; - } - - return _link_count[dev]; - } - - inline uint32 channel_stats(int32 dev, int32 obj, uint32 index) - { - if (!valid_channel(dev, obj)) - { - if (_has_exceptions) - throw invalid_channel(dev, obj); - else - return 0; - } - - uint32 res_value = (uint32)-1; - stt_code stt_res = ksFail; - -#if K3L_AT_LEAST(2,1,0) - stt_res = k3lGetChannelStats(dev, obj, index, &res_value); -#endif - - if(stt_res != ksSuccess) - { - return (uint32)-1; - } - - return res_value; - } - - KDeviceType device_type(int32 dev) - { - if (!valid_device(dev)) - { - if (_has_exceptions) - throw invalid_device(dev); - else - return kdtDevTypeCount; - } - - return _device_type[dev]; - } - - - K3L_DEVICE_CONFIG & device_config(int32 dev) - { - if (!valid_device(dev)) - throw invalid_device(dev); - - return _device_config[dev]; - } + void mixer(int32 dev, int32 obj, byte track, KMixerSource src, int32 index) const; + void mixerRecord(int32 dev, KDeviceType type, int32 obj, byte track, KMixerSource src, int32 index) const; + void mixerCTbus(int32 dev, int32 obj, byte track, KMixerSource src, int32 index) const; - K3L_CHANNEL_CONFIG & channel_config(int32 dev, int32 obj) - { - if (!valid_channel(dev, obj)) - throw invalid_channel(dev, obj); + void command (int32 dev, int32 obj, int32 code, std::string & str) const; + void command (int32 dev, int32 obj, int32 code, const char * parms = NULL) const; - return _channel_config[dev][obj]; - } - - K3L_LINK_CONFIG & link_config(int32 dev, int32 obj) - { - if (!valid_link(dev, obj)) - throw invalid_channel(dev, obj); - - return _link_config[dev][obj]; - } /* envio de comandos para placa (com identificadores) */ - void mixer(target & tgt, byte track, KMixerSource src, int32 index) + void mixer(const GenericTarget & tgt, byte track, KMixerSource src, int32 index) const { - mixer((int32)tgt.device, (int32)tgt.object, track, src, index); + mixer(tgt.device, tgt.object, track, src, index); } - void mixerRecord(target & tgt, byte track, KMixerSource src, int32 index) + void mixerRecord(const GenericTarget & tgt, byte track, KMixerSource src, int32 index) const { - mixerRecord((int32)tgt.device, (int32)tgt.object, track, src, index); + mixerRecord((int32)tgt.device, _device_type[tgt.device], (int32)tgt.object, track, src, index); } - void mixerCTbus(target & tgt, byte track, KMixerSource src, int32 index) + void mixerCTbus(const GenericTarget & tgt, byte track, KMixerSource src, int32 index) const { mixerCTbus((int32)tgt.device, (int32)tgt.object, track, src, index); } - void command (target & tgt, int32 code, std::string & str) + void command(const GenericTarget & tgt, int32 code, std::string & str) const { command((int32)tgt.device, (int32)tgt.object, code, str); }; - void command (target & tgt, int32 code, const char * parms = NULL) + void command(const GenericTarget & tgt, int32 code, const char * parms = NULL) const { command((int32)tgt.device, (int32)tgt.object, code, parms); }; /* obter dados 'cacheados' (com indentificadores) */ - inline unsigned int channel_count(target & tgt) + inline unsigned int channel_count(const GenericTarget & tgt) const { return _channel_count[tgt.device]; } - inline unsigned int link_count(target & tgt) + inline unsigned int link_count(const GenericTarget & tgt) const { return _link_count[tgt.device]; } - KDeviceType device_type(target & tgt) + KDeviceType device_type(const GenericTarget & tgt) const { return _device_type[tgt.device]; } - - K3L_DEVICE_CONFIG & device_config(target & tgt) + const K3L_DEVICE_CONFIG & device_config(const GenericTarget & tgt) const { return _device_config[tgt.device]; } - K3L_CHANNEL_CONFIG & channel_config(target & tgt) + const K3L_CHANNEL_CONFIG & channel_config(const Target<GenericTarget::CHANNEL> & tgt) const { return _channel_config[tgt.device][tgt.object]; } - K3L_LINK_CONFIG & link_config(target & tgt) + const K3L_LINK_CONFIG & link_config(const Target<GenericTarget::LINK> & tgt) const { return _link_config[tgt.device][tgt.object]; } /* pega valores em strings de eventos */ - KLibraryStatus get_param(K3L_EVENT *ev, const char *name, std::string &res); - std::string get_param(K3L_EVENT *ev, const char *name); + KLibraryStatus get_param(K3L_EVENT *ev, const char *name, std::string &res) const; + std::string get_param(K3L_EVENT *ev, const char *name) const; /* inicializa valores em cache */ @@ -389,11 +332,11 @@ struct K3LAPI DSP_SIGNALING, }; - int32 get_dsp(int32, DspType); + int32 get_dsp(KDeviceType, DspType) const; - protected: + int32 get_dsp(const GenericTarget &, DspType) const; - const bool _has_exceptions; + protected: unsigned int _device_count; unsigned int * _channel_count; @@ -405,4 +348,145 @@ struct K3LAPI KDeviceType * _device_type; }; +/* exceptions */ +template < bool E = false > +struct K3LAPIException +{ + void invalid_device(const int32 device) const + { + /* NOTHING */ + } + + void invalid_channel(const int32 device, const int32 channel) const + { + /* NOTHING */ + } + + void invalid_link(const int32 device, const int32 link) const + { + /* NOTHING */ + } +}; + +template < > +struct K3LAPIException < true > +{ + void invalid_device(const int32 device) const + { + throw K3LAPITraits::invalid_device(device); + } + + void invalid_channel(const int32 device, const int32 channel) const + { + throw K3LAPITraits::invalid_channel(device, channel); + } + + void invalid_link(const int32 device, const int32 link) const + { + throw K3LAPITraits::invalid_link(device, link); + } +}; + +template < bool E = false > +struct K3LAPITemplate: public K3LAPIBase, protected K3LAPIException < E > +{ + using K3LAPIBase::device_config; + using K3LAPIBase::channel_config; + using K3LAPIBase::link_config; + + using K3LAPIBase::device_type; + using K3LAPIBase::get_dsp; + + using K3LAPIBase::mixerRecord; + + /* obter dados 'cacheados' (sem identificadores) */ + + inline unsigned int channel_count(int32 dev) const + { + if (!valid_device(dev)) + { + K3LAPIException< E >::invalid_device(dev); + return 0; + } + + return _channel_count[dev]; + } + + inline unsigned int link_count(int32 dev) const + { + if (!valid_device(dev)) + { + K3LAPIException< E >::invalid_device(dev); + return 0; + } + + return _link_count[dev]; + } + + inline uint32 channel_stats(int32 dev, int32 obj, uint32 index) const + { + if (!valid_channel(dev, obj)) + { + K3LAPIException< E >::invalid_channel(dev, obj); + return 0u; + } + + uint32 res_value = 0u; + +#if K3L_AT_LEAST(2,1,0) + if (k3lGetChannelStats(dev, obj, index, &res_value) != ksSuccess) + return 0u; + + return res_value; +#endif + } + + KDeviceType device_type(int32 dev) const + { + if (!valid_device(dev)) + { + K3LAPIException< E >::invalid_device(dev); + return kdtDevTypeCount; + } + + return _device_type[dev]; + } + + const K3L_DEVICE_CONFIG & device_config(int32 dev) const + { + if (!valid_device(dev)) + throw K3LAPITraits::invalid_device(dev); + + return _device_config[dev]; + } + + const K3L_CHANNEL_CONFIG & channel_config(int32 dev, int32 obj) const + { + if (!valid_channel(dev, obj)) + throw K3LAPITraits::invalid_channel(dev, obj); + + return _channel_config[dev][obj]; + } + + const K3L_LINK_CONFIG & link_config(int32 dev, int32 obj) const + { + if (!valid_link(dev, obj)) + throw K3LAPITraits::invalid_link(dev, obj); + + return _link_config[dev][obj]; + } + + int32 get_dsp(int32 dev, DspType type) const + { + return get_dsp(device_type(dev), type); + } + + void mixerRecord(int32 dev, int32 obj, byte track, KMixerSource src, int32 index) const + { + mixerRecord(dev, device_type(dev), obj, track, src, index); + } +}; + +typedef K3LAPITemplate<> K3LAPI; + #endif /* _K3LAPI_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/k3lutil.cpp b/src/mod/endpoints/mod_khomp/commons/base/k3lutil.cpp similarity index 83% rename from src/mod/endpoints/mod_khomp/commons/k3lutil.cpp rename to src/mod/endpoints/mod_khomp/commons/base/k3lutil.cpp index 83ac82e..3fda813 100644 --- a/src/mod/endpoints/mod_khomp/commons/k3lutil.cpp +++ b/src/mod/endpoints/mod_khomp/commons/base/k3lutil.cpp @@ -46,7 +46,8 @@ std::string K3LUtil::channelStatus(int32 dev, int32 channel, { try { - K3L_CHANNEL_CONFIG & config = _k3lapi.channel_config(dev, channel); + const K3L_CHANNEL_CONFIG & config = _k3lapi.channel_config(dev, channel); + K3L_CHANNEL_STATUS status; KLibraryStatus ret = (KLibraryStatus) k3lGetDeviceStatus (dev, @@ -60,7 +61,7 @@ std::string K3LUtil::channelStatus(int32 dev, int32 channel, : "Unknown (fail)"); } } - catch(K3LAPI::invalid_channel & e) + catch(K3LAPITraits::invalid_channel & e) { return (fmt == Verbose::EXACT ? "<unknown[fail]>" : "Unknown (fail)"); } @@ -83,64 +84,35 @@ std::string K3LUtil::callStatus(int32 dev, int32 channel, } std::string K3LUtil::linkStatus(int32 dev, int32 link, - Verbose::Presentation fmt, KSignaling sig) + Verbose::Presentation fmt, KSignaling signaling, bool simpleStatus) { try { - if (sig == ksigInactive) + if (signaling == ksigInactive) { - K3L_LINK_CONFIG & config = _k3lapi.link_config(dev, link); - sig = config.Signaling; + const K3L_LINK_CONFIG & config = _k3lapi.link_config(dev, link); + signaling = config.Signaling; } - K3L_LINK_STATUS status; + K3L_LINK_STATUS status; KLibraryStatus ret = (KLibraryStatus) k3lGetDeviceStatus (dev, link + ksoLink, &status, sizeof(status)); switch (ret) { - case ksSuccess: return Verbose::linkStatus(sig, status.E1, fmt); + case ksSuccess: return Verbose::linkStatus(signaling, status.E1, fmt, simpleStatus); default: return (fmt == Verbose::EXACT ? "<unknown[failure]>" : "Unknown (failure)"); } } - catch(K3LAPI::invalid_channel & e) + catch(K3LAPITraits::invalid_channel & e) { return (fmt == Verbose::EXACT ? "<unknown[failure]>" : "Unknown (failure)"); } } -std::string K3LUtil::getLinkStatus(int32 dev, int32 link, - Verbose::Presentation fmt) -{ - switch (_k3lapi.device_type(dev)) - { -#if K3L_AT_LEAST(1,6,0) - case kdtFXS: - case kdtFXSSpx: - return linkStatus(dev, link, fmt, ksigAnalogTerminal); - -#if K3L_AT_LEAST(2,1,0) - case kdtE1FXSSpx: - if (link == 1) - return linkStatus(dev, link, fmt, ksigAnalogTerminal); -#endif -#endif - default: - break; - } - - K3L_LINK_CONFIG & conf = _k3lapi.link_config(dev, link); - - std::string res = linkStatus(dev, link, fmt); - - if (conf.ReceivingClock & 0x01) - res += (fmt == Verbose::EXACT ? ",sync" : " (sync)"); - - return res; -} unsigned int K3LUtil::physicalLinkCount(int32 dev, bool count_virtual) { @@ -199,7 +171,7 @@ unsigned int K3LUtil::physicalLinkCount(int32 dev, bool count_virtual) break; } } - catch(K3LAPI::invalid_device & e) + catch(K3LAPITraits::invalid_device & e) { return 0; } diff --git a/src/mod/endpoints/mod_khomp/commons/k3lutil.hpp b/src/mod/endpoints/mod_khomp/commons/base/k3lutil.hpp similarity index 95% rename from src/mod/endpoints/mod_khomp/commons/k3lutil.hpp rename to src/mod/endpoints/mod_khomp/commons/base/k3lutil.hpp index e547f3d..9d87d8b 100644 --- a/src/mod/endpoints/mod_khomp/commons/k3lutil.hpp +++ b/src/mod/endpoints/mod_khomp/commons/base/k3lutil.hpp @@ -64,10 +64,8 @@ struct K3LUtil std::string linkStatus(int32, int32, Verbose::Presentation fmt = Verbose::HUMAN, - KSignaling sig = ksigInactive); - - std::string getLinkStatus(int32, int32, - Verbose::Presentation fmt = Verbose::HUMAN); + KSignaling sig = ksigInactive, + bool simpleStatus = false); unsigned int physicalLinkCount(int32 dev, bool count_virtual = false); diff --git a/src/mod/endpoints/mod_khomp/commons/logger.hpp b/src/mod/endpoints/mod_khomp/commons/base/logger.hpp similarity index 89% rename from src/mod/endpoints/mod_khomp/commons/logger.hpp rename to src/mod/endpoints/mod_khomp/commons/base/logger.hpp index 6fcf7bf..6c333e7 100644 --- a/src/mod/endpoints/mod_khomp/commons/logger.hpp +++ b/src/mod/endpoints/mod_khomp/commons/base/logger.hpp @@ -55,6 +55,7 @@ #if defined(COMMONS_LIBRARY_USING_ASTERISK) extern "C" { + #include <asterisk.h> #include <asterisk/localtime.h> } #elif defined(COMMONS_LIBRARY_USING_CALLWEAVER) @@ -443,35 +444,17 @@ struct Logger localtime_r (&tv, <); #endif - out_msg += STG(FMT("[%04d-%02d-%02d %02d:%02d:%02d] ") - % (lt.tm_year + 1900) % (lt.tm_mon + 1) % lt.tm_mday % lt.tm_hour - % lt.tm_min % lt.tm_sec); - -#elif defined(COMMONS_LIBRARY_USING_CALLWEAVER) +#elif defined(COMMONS_LIBRARY_USING_CALLWEAVER) || defined(COMMONS_LIBRARY_USING_FREESWITCH) time_t tv; struct tm lt; time (&tv); localtime_r (&tv, <); - - out_msg += STG(FMT("[%04d-%02d-%02d %02d:%02d:%02d] ") - % (lt.tm_year + 1900) % (lt.tm_mon + 1) % lt.tm_mday % lt.tm_hour - % lt.tm_min % lt.tm_sec); - -#elif defined(COMMONS_LIBRARY_USING_FREESWITCH) - time_t tv; - struct tm lt; - - time (&tv); - - localtime_r (&tv, <); - - out_msg += STG(FMT("[%04d-%02d-%02d %02d:%02d:%02d] ") - % (lt.tm_year + 1900) % (lt.tm_mon + 1) % lt.tm_mday % lt.tm_hour - % lt.tm_min % lt.tm_sec); - #endif + out_msg += STG(FMT("[%02d-%02d-%02d %02d:%02d:%02d] ") + % (lt.tm_year % 100) % (lt.tm_mon + 1) % lt.tm_mday % lt.tm_hour + % lt.tm_min % lt.tm_sec); } if (opt._flags[Option::DATETIMEMS]) @@ -497,28 +480,16 @@ struct Logger #endif #if ASTERISK_AT_LEAST(1,6,0) - out_msg += STG(FMT("[%04d-%02d-%02d %02d:%02d:%02d:%04d] ") - % (lt.tm_year + 1900) % (lt.tm_mon + 1) % lt.tm_mday % lt.tm_hour % lt.tm_min + out_msg += STG(FMT("[%02d-%02d-%02d %02d:%02d:%02d:%04d] ") + % (lt.tm_year % 100) % (lt.tm_mon + 1) % lt.tm_mday % lt.tm_hour % lt.tm_min % lt.tm_sec % (tv.tv_usec / 1000)); #else - out_msg += STG(FMT("[%04d-%02d-%02d %02d:%02d:%02d:%04d] ") - % (lt.tm_year + 1900) % (lt.tm_mon + 1) % lt.tm_mday % lt.tm_hour % lt.tm_min + out_msg += STG(FMT("[%02d-%02d-%02d %02d:%02d:%02d:%04d] ") + % (lt.tm_year % 100) % (lt.tm_mon + 1) % lt.tm_mday % lt.tm_hour % lt.tm_min % lt.tm_sec % (tv * 1000)); #endif -#elif defined(COMMONS_LIBRARY_USING_CALLWEAVER) - time_t tv; - struct tm lt; - - time (&tv); - - localtime_r (&tv, <); - - out_msg += STG(FMT("[%04d-%02d-%02d %02d:%02d:%02d:%04d] ") - % (lt.tm_year + 1900) % (lt.tm_mon + 1) % lt.tm_mday % lt.tm_hour % lt.tm_min - % lt.tm_sec % (tv * 1000)); - -#elif defined(COMMONS_LIBRARY_USING_FREESWITCH) +#elif defined(COMMONS_LIBRARY_USING_CALLWEAVER) || defined(COMMONS_LIBRARY_USING_FREESWITCH) time_t tv; struct tm lt; @@ -526,10 +497,9 @@ struct Logger localtime_r (&tv, <); - out_msg += STG(FMT("[%04d-%02d-%02d %02d:%02d:%02d:%04d] ") - % (lt.tm_year + 1900) % (lt.tm_mon + 1) % lt.tm_mday % lt.tm_hour % lt.tm_min + out_msg += STG(FMT("[%02d-%02d-%02d %02d:%02d:%02d:%04d] ") + % (lt.tm_year % 100) % (lt.tm_mon + 1) % lt.tm_mday % lt.tm_hour % lt.tm_min % lt.tm_sec % (tv * 1000)); - #endif } @@ -538,7 +508,7 @@ struct Logger if (opt._flags[Option::THREADID]) { #if defined (COMMONS_LIBRARY_USING_ASTERISK) || defined(COMMONS_LIBRARY_USING_CALLWEAVER) || defined(COMMONS_LIBRARY_USING_FREESWITCH) - out_msg += STG(FMT("t=%08p ") % ((void*)pthread_self())); + out_msg += STG(FMT("%08x ") % ((unsigned long)pthread_self())); #endif } diff --git a/src/mod/endpoints/mod_khomp/commons/noncopyable.hpp b/src/mod/endpoints/mod_khomp/commons/base/noncopyable.hpp similarity index 100% rename from src/mod/endpoints/mod_khomp/commons/noncopyable.hpp rename to src/mod/endpoints/mod_khomp/commons/base/noncopyable.hpp diff --git a/src/mod/endpoints/mod_khomp/commons/refcounter.hpp b/src/mod/endpoints/mod_khomp/commons/base/refcounter.hpp similarity index 94% rename from src/mod/endpoints/mod_khomp/commons/refcounter.hpp rename to src/mod/endpoints/mod_khomp/commons/base/refcounter.hpp index 6ba8ae8..d173818 100644 --- a/src/mod/endpoints/mod_khomp/commons/refcounter.hpp +++ b/src/mod/endpoints/mod_khomp/commons/base/refcounter.hpp @@ -45,6 +45,11 @@ #ifndef _REFCOUNTER_HPP_ #define _REFCOUNTER_HPP_ +#define COUNTER_CLASS(...) ReferenceCounter< __VA_ARGS__ > +#define COUNTER_SUPER(...) public COUNTER_CLASS( __VA_ARGS__ ) +#define COUNTER_REFER(o, ...) COUNTER_CLASS( __VA_ARGS__ )(static_cast< const COUNTER_CLASS( __VA_ARGS__ ) & >(o)) + +// DEPRECATED DECLARATIONS /// #define NEW_REFCOUNTER(...) public ReferenceCounter< __VA_ARGS__ > #define INC_REFCOUNTER(o, ...) ReferenceCounter< __VA_ARGS__ >(static_cast< const ReferenceCounter < __VA_ARGS__ > & >(o)) @@ -179,13 +184,13 @@ struct ReferenceCounter }; template < typename T > -struct ReferenceContainer: NEW_REFCOUNTER(ReferenceContainer< T >) +struct ReferenceContainer: COUNTER_SUPER(ReferenceContainer< T >) { /* type */ typedef T Type; /* shorthand */ - typedef ReferenceCounter < ReferenceContainer< Type > > Counter; + typedef COUNTER_CLASS(ReferenceContainer< Type >) Counter; // TODO: make this a generic exception someday struct NotFound {}; @@ -249,7 +254,7 @@ struct ReferenceContainer: NEW_REFCOUNTER(ReferenceContainer< T >) }; // return value (pointer)! - Type * operator()(void) + Type * operator()(void) const { return _reference_value; }; diff --git a/src/mod/endpoints/mod_khomp/commons/regex.cpp b/src/mod/endpoints/mod_khomp/commons/base/regex.cpp similarity index 94% rename from src/mod/endpoints/mod_khomp/commons/regex.cpp rename to src/mod/endpoints/mod_khomp/commons/base/regex.cpp index 61f941c..d2b8cd0 100644 --- a/src/mod/endpoints/mod_khomp/commons/regex.cpp +++ b/src/mod/endpoints/mod_khomp/commons/base/regex.cpp @@ -74,7 +74,7 @@ void Regex::Expression::initialize(void) _errorstate = regcomp(&_comp_regex, _expression, _flags); } -std::string Regex::Expression::regerror_as_string(void) +std::string Regex::Expression::regerror_as_string(void) const { unsigned int count = regerror(_errorstate, &_comp_regex, 0, 0) + 1; @@ -95,6 +95,7 @@ void Regex::Match::initialize(void) { _subcounter = (_expression.subcount() + 2); // 0 + N.. + invalid _submatches = new regmatch_t[_subcounter]; + _subcaching = new std::string[_subcounter]; _have_match = (regexec(_expression.repr(), _basestring.c_str(), _subcounter, _submatches, _flags) == 0); } @@ -117,7 +118,7 @@ std::string Regex::Match::replace(Regex::ReplaceMap & map) try { if (_submatches[0].rm_so != 0 && (map.find(0) != map.end())) - return _basestring.replace(_submatches[0].rm_so, _submatches[0].rm_eo - _submatches[0].rm_so, map.find(0)->second); + return buffer.replace(_submatches[0].rm_so, _submatches[0].rm_eo - _submatches[0].rm_so, map.find(0)->second); for (unsigned int n = 1; (_submatches[n].rm_so != -1) && (n < _subcounter); n++) { diff --git a/src/mod/endpoints/mod_khomp/commons/regex.hpp b/src/mod/endpoints/mod_khomp/commons/base/regex.hpp similarity index 78% rename from src/mod/endpoints/mod_khomp/commons/regex.hpp rename to src/mod/endpoints/mod_khomp/commons/base/regex.hpp index daf2014..6132523 100644 --- a/src/mod/endpoints/mod_khomp/commons/regex.hpp +++ b/src/mod/endpoints/mod_khomp/commons/base/regex.hpp @@ -111,12 +111,12 @@ struct Regex } } - bool valid(void) { return (_errorstate == 0); } + bool valid(void) const { return (_errorstate == 0); } - unsigned int subcount(void) { return _subcounter; } - const regex_t * repr(void) { return &_comp_regex; } + unsigned int subcount(void) const { return _subcounter; } + const regex_t * repr(void) const { return &_comp_regex; } - std::string error(void) + std::string error(void) const { switch (_errorstate) { @@ -127,31 +127,33 @@ struct Regex } private: - void initialize(void); - std::string regerror_as_string(void); + std::string regerror_as_string(void) const; + + private: + void initialize(void); protected: const char * _expression; - bool _alloced; + const bool _alloced; unsigned int _subcounter; int _errorstate; regex_t _comp_regex; - unsigned int _flags; + const unsigned int _flags; }; - struct Match: NEW_REFCOUNTER(Match) + struct Match: COUNTER_SUPER(Match) { - Match(const char * basestring, Expression & expression, unsigned int flags = 0) + Match(const char * basestring, const Expression & expression, unsigned int flags = 0) : _basestring(basestring), _expression(expression), _subcounter(0), _submatches(0), _have_match(false), _flags(flags) { initialize(); } - Match(std::string & basestring, Expression & expression, unsigned int flags = 0) + Match(const std::string & basestring, const Expression & expression, unsigned int flags = 0) : _basestring(basestring), _expression(expression), _subcounter(0), _submatches(0), _have_match(false), _flags(flags) { @@ -159,7 +161,7 @@ struct Regex } Match(const Match & o) - : INC_REFCOUNTER(o, Match), + : COUNTER_REFER(o, Match), _basestring(o._basestring), _expression(o._expression), _subcounter(o._subcounter), _submatches(o._submatches), _have_match(o._have_match), _flags(o._flags) @@ -169,6 +171,10 @@ struct Regex void unreference() { delete[] _submatches; + delete[] _subcaching; + + _submatches = 0; + _subcaching = 0; } bool matched(void) @@ -184,34 +190,23 @@ struct Regex return false; } - std::string submatch(int number) + const std::string & submatch(int number) { if (!matched(number)) - return ""; - - return _basestring.substr(_submatches[number].rm_so, - _submatches[number].rm_eo - _submatches[number].rm_so); - } + return _subcaching[_subcounter - 1 /* invalid, always empty! */ ]; - /** - * \brief gets a map with all matches - * \return std::map<int,std::string> with all matches - * \note index 0 in map, is the complete string - * \author Eduardo Nunes Pereira - * - * If fails the empty map is returned - */ - std::map<int, std::string> obtain_match_map() - { - int match_counter = 0; - std::map<int,std::string> tmp_map; - while(matched(match_counter)) + if (_subcaching[number].empty()) { - tmp_map.insert(std::make_pair(match_counter,submatch(match_counter))); - match_counter++; + _subcaching[number].assign(_basestring, _submatches[number].rm_so, + _submatches[number].rm_eo - _submatches[number].rm_so); } - return tmp_map; + return _subcaching[number]; + } + + const std::string & operator[](int number) + { + return submatch(number); } /** @@ -226,25 +221,21 @@ struct Regex std::string replace(ReplaceMap &); std::string replace(std::string, unsigned int index = REP_BASE); - std::string operator[](int number) - { - return submatch(number); - } - // NOTE: there is already a way to get subcount defined on EXPRESSION class! private: void initialize(void); protected: - std::string _basestring; - Expression & _expression; + const std::string _basestring; + const Expression & _expression; unsigned int _subcounter; regmatch_t * _submatches; - + std::string * _subcaching; bool _have_match; - unsigned int _flags; + + const unsigned int _flags; }; }; diff --git a/src/mod/endpoints/mod_khomp/commons/base/ringbuffer.cpp b/src/mod/endpoints/mod_khomp/commons/base/ringbuffer.cpp new file mode 100644 index 0000000..4205630 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/base/ringbuffer.cpp @@ -0,0 +1,485 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <ringbuffer.hpp> + +// #include <stdio.h> + + + /* Documentation of the formula used in the buffer arithmetic. + * + * [0|1|2|3|4|5|6|7] => size=8 + * | | + * reader | + * writer + * + * => writer has places [5,6,7,0,1] to write (5 places). + * + * => 8 - (4-2+1) = 8 - (2+1) = 8 - 3 = 5 + * + * > writer goes 1 up, amount goes 1 down. + * > reader goes 1 up, amount goes 1 up. + * > size goes 1 down, amount goes 1 down. + * + */ + +/********** BUFFER FUNCTIONS **********/ + +/* writes everything or nothing */ +bool Ringbuffer_traits::traits_provide(char * buffer, const char * value, unsigned int amount, bool do_not_overwrite) +{ + /* avoid using different values */ + Buffer_table cache = _pointers; + + bool need_overwrite = false; + + if (amount > free_blocks(cache)) + { + if (do_not_overwrite) + return false; + + /* if we are allowed to overwrite, just the buffer size matters for us */ + if (amount >= _size) + return false; + + /* we need to change reader pointer below... */ + need_overwrite = true; + } + + const unsigned int wr = cache.writer.complete; + const unsigned int wp = cache.writer.complete - 1; + + /* should we go around the buffer for writing? */ + if ((wr + amount) > _size) + { +// fprintf(stderr, "%p> first if matched\n", this); + + if (need_overwrite) + { + do + { + Buffer_pointer extra(cache.reader); + extra.complete = ((wr + amount) % _size); // (extra.complete + amount) % _size; +// extra.complete = (extra.complete + amount) % _size; + + if (update(cache.reader, extra)) + break; + } + while (true); + } + + unsigned int wr1 = _size - wr + 1; /* writer is already 1 position after */ + unsigned int wr2 = amount - wr1; + +// fprintf(stderr, "%p> partial write: (%d/%d) %d/%d [%d/%d]\n", this, wr1, wr2, amount, _size, reader, writer); + + /* two partial writes (one at the end, another at the beginning) */ + memcpy((void *) &(buffer[wp]), (const void *) (value), _block * wr1); + memcpy((void *) (buffer), (const void *) &(value[wr1]), _block * wr2); + } + else + { +// fprintf(stderr, "%p> second if matched\n", this); + + if (need_overwrite) + { + do + { + Buffer_pointer extra(cache.reader); + extra.complete = ((wr + amount) % _size); // (extra.complete + amount) % _size; + + if (update(cache.reader, extra)) + break; + } + while (true); + } + +// fprintf(stderr, "%p> full write: a=%d/s=%d [r=%d/w=%d]\n", this, amount, _size, reader, writer); + + /* we are talking about buffers here, man! */ + memcpy((void *) &(buffer[wp]), (const void *) value, _block * amount); + } + + _pointers.writer.complete = ((wp + amount) % _size) + 1; + _pointers.writer.partial = 1; + +// if (need_overwrite) +// fprintf(stdout, "%p> write end: w=%d/r=%d\n", this, _pointers.writer.complete, _pointers.reader.complete); + + return true; +} + +/* returns the number of itens that have been read */ +unsigned int Ringbuffer_traits::traits_consume(const char * buffer, char * value, unsigned int amount, bool atomic_mode) +{ + /* avoid using different values */ + Buffer_table cache = _pointers; + + const unsigned int available = used_blocks(cache); + + if (atomic_mode && amount > available) + return false; + + const unsigned int rd = _pointers.reader.complete; + + unsigned int total = std::min(amount, available); + + /* should we go around the buffer for reading? */ + if ((rd + total) >= _size) + { + unsigned int rd1 = _size - rd; + unsigned int rd2 = total - rd1; + +// fprintf(stderr, "%p> partial read: (%d/%d) %d/%d [%d/%d]\n", this, rd1, rd2, total, _size, reader, writer); + + /* two partial consumes (one at the end, another at the beginning) */ + memcpy((void *) (value), (const void *) &(buffer[rd]), _block * rd1); + memcpy((void *) &(value[rd1]), (const void *) (buffer), _block * rd2); + } + else + { +// fprintf(stderr, "%p> full read: %d/%d [%d/%d]\n", this, total, _size, reader, writer); + + /* we are talking about buffers here, man! */ + memcpy((void *) value, (const void *) &(buffer[rd]), _block * total); + } + + do + { + /* jump the reader forward */ + Buffer_pointer index((cache.reader.complete + total) % _size, 0); + + if (update(cache.reader, index)) + break; + } + while (true); + +// fprintf(stderr, "%p> read end: %d [block=%d]\n", this, reader, _block); + + return total; +} + +/********** TWO-PHASE BUFFER FUNCTIONS ***********/ + +/* returns the number of itens that have been read */ +unsigned int Ringbuffer_traits::traits_consume_begins(const char * buffer, char * value, unsigned int amount, bool atomic_mode) +{ + /* avoid using different values */ + Buffer_table cache = _pointers; + + const unsigned int available = used_blocks(cache); + + if (amount > available) + { + if (atomic_mode) + return false; + } + + const unsigned int rd = _pointers.reader.complete; + + unsigned int total = std::min(amount, available); + + /* should we go around the buffer for reading? */ + if ((rd + total) >= _size) + { + unsigned int rd1 = _size - rd; + unsigned int rd2 = total - rd1; + +// fprintf(stderr, "%p> partial read: (%d/%d) %d/%d [%d/%d]\n", this, rd1, rd2, total, _size, reader, writer); + + /* two partial consumes (one at the end, another at the beginning) */ + memcpy((void *) (value), (const void *) &(buffer[rd]), _block * rd1); + memcpy((void *) &(value[rd1]), (const void *) (buffer), _block * rd2); + } + else + { +// fprintf(stderr, "%p> full read: %d/%d [%d/%d]\n", this, total, _size, reader, writer); + + /* we are talking about buffers here, man! */ + memcpy((void *) value, (const void *) &(buffer[rd]), _block * total); + } + + return total; +} + +bool Ringbuffer_traits::traits_consume_commit(unsigned int amount) +{ + if (amount == 0) + return true; + + /* avoid using different values */ + Buffer_table cache = _pointers; + + const unsigned int available = used_blocks(cache); + + /* cannot commit more than available! */ + if (amount > available) + return false; + + unsigned int total = std::min(amount, available); + + do + { + /* jump the reader forward */ + Buffer_pointer index((cache.reader.complete + total) % _size, 0); + + if (update(cache.reader, index)) + break; + } + while (true); + +// fprintf(stderr, "%p> read end: %d [block=%d]\n", this, reader, _block); + + return true; +} + +/********** PARTIAL BUFFER FUNCTIONS (bytes) ***********/ + +/* writes everything or nothing */ +bool Ringbuffer_traits::traits_provide_partial(char * buffer, const char * value, unsigned int amount) +{ + /* avoid using different values */ + Buffer_table cache = _pointers; + + const unsigned int memsize = (_size * _block); + + if (amount > (free_blocks(cache) * _block)) + return false; + + const unsigned int wr = ((cache.writer.complete - 1) * _block) + cache.writer.partial; + const unsigned int wp = wr - 1; + + /* should we go around the buffer for writing? */ + if ((wr + amount) > memsize) + { +// fprintf(stderr, "%p> first if matched\n", this); + + unsigned int wr1 = memsize - wr + 1; /* writer is already 1 position after */ + unsigned int wr2 = amount - wr1; + +// fprintf(stderr, "%p> partial write: (%d/%d) %d/%d [%d/%d]\n", this, wr1, wr2, amount, _size, reader, writer); + + /* two partial writes (one at the end, another at the beginning) */ + memcpy((void *) &(buffer[wp]), (const void *) (value), wr1); + memcpy((void *) (buffer), (const void *) &(value[wr1]), wr2); + } + else + { +// fprintf(stderr, "%p> second if matched\n", this); + +// fprintf(stderr, "%p> full write: a=%d/s=%d [r=%d/w=%d]\n", this, amount, _size, reader, writer); + + /* we are talking about buffers here, man! */ + memcpy((void *) &(buffer[wp]), (const void *) value, amount); + } + + const unsigned int new_wp = (wp + amount) % memsize; + + _pointers.writer.complete = (unsigned int)(floor((double)new_wp / (double)_block) + 1); + _pointers.writer.partial = (new_wp % _block) + 1; + +// if (need_overwrite) +// fprintf(stdout, "%p> write end: w=%d/r=%d\n", this, _pointers.writer.complete, _pointers.reader.complete); + + return true; +} + +/* returns the number of bytes that have been read */ +unsigned int Ringbuffer_traits::traits_consume_partial(const char * buffer, char * value, unsigned int amount) +{ + /* avoid using different values */ + Buffer_table cache = _pointers; + + const unsigned int available = used_blocks(cache) * _block; + + const unsigned int rd = (_pointers.reader.complete * _block) + _pointers.reader.partial; + + const unsigned int memsize = _size * _block; + + unsigned int total = std::min(amount, available); + + /* should we go around the buffer for reading? */ + if ((rd + total) >= _size) + { + unsigned int rd1 = memsize - rd; + unsigned int rd2 = total - rd1; + +// fprintf(stderr, "%p> partial read: (%d/%d) %d/%d [%d/%d]\n", this, rd1, rd2, total, _size, reader, writer); + + /* two partial consumes (one at the end, another at the beginning) */ + memcpy((void *) (value), (const void *) &(buffer[rd]), rd1); + memcpy((void *) &(value[rd1]), (const void *) (buffer), rd2); + } + else + { +// fprintf(stderr, "%p> full read: %d/%d [%d/%d]\n", this, total, _size, reader, writer); + + /* we are talking about buffers here, man! */ + memcpy((void *) value, (const void *) &(buffer[rd]), total); + } + + do + { + const unsigned int new_rd = (((cache.reader.complete * _block) + cache.reader.partial) + total) % memsize; + + /* jump the reader forward */ + Buffer_pointer index((unsigned int)floor((double)new_rd / (double)_block), (unsigned short)(new_rd % _block)); + + if (update(cache.reader, index)) + break; + } + while (true); + +// fprintf(stderr, "%p> read end: %d [block=%d]\n", this, reader, _block); + + return total; +} + +/********** IO FUNCTIONS **********/ + +/* returns the number of items written to from buffer to stream */ +unsigned int Ringbuffer_traits::traits_put(const char * buffer, std::ostream &fd, unsigned int amount) +{ + /* avoid using different values */ + Buffer_table cache = _pointers; + + const unsigned int available = used_blocks(cache); + + if (amount > available) + return false; + + const unsigned int wr = _pointers.writer.complete; + const unsigned int rd = _pointers.reader.complete; + + unsigned int total = std::min(amount, available); + + /* should we go around the buffer for reading? */ + if ((rd + total) >= _size) + { + unsigned int rd1 = _size - rd; + unsigned int rd2 = total - rd1; + +// fprintf(stderr, "%p> partial read: (%d/%d) %d/%d [%d/%d]\n", this, rd1, rd2, total, _size, reader, writer); + + /* two partial consumes (one at the end, another at the beginning) */ + fd.write((const char *) &(buffer[rd]), _block * rd1); + fd.write((const char *) (buffer), _block * rd2); + } + else + { +// fprintf(stderr, "%p> full read: %d/%d [%d/%d]\n", this, total, _size, reader, writer); + fd.write((const char *) &(buffer[rd]), _block * total); + } + + do + { + /* jump the reader forward */ + Buffer_pointer index((cache.reader.complete + total) % _size, 0); + + if (update(cache.reader, index)) + break; + } + while (true); + +// fprintf(stderr, "%p> read end: %d [block=%d]\n", this, reader, _block); + + return total; +} + +/* returns number of items read from stream to buffer */ +unsigned int Ringbuffer_traits::traits_get(char * buffer, std::istream &fd, unsigned int amount) +{ + /* avoid using different values */ + Buffer_table cache = _pointers; + + if (amount > free_blocks(cache)) + return false; + + const unsigned int wr = cache.writer.complete; + const unsigned int wp = cache.writer.complete - 1; + + unsigned int real_amount = 0; + + /* should we go around the buffer for writing? */ + if ((wr + amount) > _size) + { +// fprintf(stderr, "%p> first if matched\n", this); + + unsigned int wr1 = _size - wr + 1; /* writer is already 1 position after */ + unsigned int wr2 = amount - wr1; + +// fprintf(stderr, "%p> partial write: (%d/%d) %d/%d [%d/%d]\n", this, wr1, wr2, amount, _size, reader, writer); + + /* two partial writes (one at the end, another at the beginning) */ + unsigned int char_amount = 0; + + /* one partial write on the buffer (at the end) */ + fd.read((char *) &(buffer[wp]), _block * wr1); + char_amount += fd.gcount(); + + if (fd.gcount() == (int)(_block * wr1)) + { + /* another partial write on the buffer (at the beginning) */ + fd.read((char *) (buffer), _block * wr2); + char_amount += fd.gcount(); + } + + real_amount = char_amount / _block; + } + else + { +// fprintf(stderr, "%p> second if matched\n", this); + +// fprintf(stderr, "%p> full write: a=%d/s=%d [r=%d/w=%d]\n", this, amount, _size, reader, writer); + + /* we are talking about buffers here, man! */ + fd.read((char *) &(buffer[wp]), _block * amount); + + real_amount = fd.gcount() / _block; + } + + _pointers.writer.complete = ((wp + amount) % _size) + 1; + _pointers.writer.partial = 1; + +// fprintf(stdout, "%p> write end: %d\n", this, _pointers.writer.complete); + + return real_amount; +} diff --git a/src/mod/endpoints/mod_khomp/commons/ringbuffer.hpp b/src/mod/endpoints/mod_khomp/commons/base/ringbuffer.hpp similarity index 88% rename from src/mod/endpoints/mod_khomp/commons/ringbuffer.hpp rename to src/mod/endpoints/mod_khomp/commons/base/ringbuffer.hpp index 39f8ffe..b9ecd7e 100644 --- a/src/mod/endpoints/mod_khomp/commons/ringbuffer.hpp +++ b/src/mod/endpoints/mod_khomp/commons/base/ringbuffer.hpp @@ -46,6 +46,12 @@ Also, it works only for single-reader + single-writer, since it does not depends on external mutex functions. + + NOTE: for single element provide/consume, this abstraction has standard C++ semantics. + + for multiple and partial element provide/consume, memcpy is used - thus complex C++ + objects which need correct copy constructor semantics should not copied this way. + */ #include <string.h> @@ -61,7 +67,7 @@ struct Buffer_pointer { - Buffer_pointer(unsigned int _complete = 0u, unsigned short _partial = 0u) + Buffer_pointer(unsigned int _complete, unsigned short _partial) : complete(_complete), partial(_partial) {}; @@ -134,6 +140,10 @@ __attribute__((packed)); struct Ringbuffer_traits { + struct BufferFull {}; + struct BufferEmpty {}; + + protected: Ringbuffer_traits(unsigned int block, unsigned int size) : _block(block), _size(size) {}; @@ -155,6 +165,28 @@ struct Ringbuffer_traits return Atomic::doCAS(&(_pointers.reader), &cache, update); } + inline unsigned int free_blocks(const Buffer_table & cache) const + { + const unsigned int r = cache.reader.complete; + const unsigned int w = cache.writer.complete; + + if (r >= w) + return (r - w); + + return _size - (w - r); + } + + inline unsigned int used_blocks(const Buffer_table & cache) const + { + const unsigned int r = cache.reader.complete; + const unsigned int w = cache.writer.complete; + + if (r >= w) + return (_size - (r - w)) - 1; + + return (w - r) - 1; + } + protected: const unsigned int _block; const unsigned int _size; @@ -163,11 +195,8 @@ struct Ringbuffer_traits }; template <typename T> -struct Ringbuffer: protected Ringbuffer_traits, public NonCopyable +struct Ringbuffer: public Ringbuffer_traits, public NonCopyable { - struct BufferFull {}; - struct BufferEmpty {}; - Ringbuffer(unsigned int size) : Ringbuffer_traits(sizeof(T), size) { @@ -189,15 +218,17 @@ struct Ringbuffer: protected Ringbuffer_traits, public NonCopyable } /***** GENERIC RANGE/INDEX CALCULATION FUNCTIONS *****/ - bool may_write(Buffer_table & cache) + + protected: + inline bool may_write(const Buffer_table & cache) const { const unsigned int r = cache.reader.complete; const unsigned int w = cache.writer.complete; - return (((r - w) != 1) && (!(r == 0 && w == _size))); + return (((r - w) != 0) && (!(r == 0 && w == _size))); } - bool may_read(Buffer_table & cache) + inline bool may_read(const Buffer_table & cache) const { if ((cache.writer.complete - cache.reader.complete) == 1) return false; @@ -205,7 +236,7 @@ struct Ringbuffer: protected Ringbuffer_traits, public NonCopyable return true; } - unsigned int writer_next(Buffer_pointer & cache, Buffer_pointer & index) + inline unsigned int writer_next(const Buffer_pointer & cache, Buffer_pointer & index) const { unsigned int dest = cache.complete - 1, temp = cache.complete + 1; @@ -218,7 +249,7 @@ struct Ringbuffer: protected Ringbuffer_traits, public NonCopyable return dest; }; - void reader_next(Buffer_pointer & cache, Buffer_pointer & index) + inline void reader_next(const Buffer_pointer & cache, Buffer_pointer & index) const { unsigned int temp = cache.complete + 1; @@ -230,6 +261,7 @@ struct Ringbuffer: protected Ringbuffer_traits, public NonCopyable /***** BUFFER FUNCTIONS *****/ + public: bool provide(const T & value) { Buffer_table cache = _pointers; @@ -280,9 +312,9 @@ struct Ringbuffer: protected Ringbuffer_traits, public NonCopyable } /* writes everything or nothing */ - inline bool provide(const T * value, unsigned int amount, bool skip_overwrite = true) + inline bool provide(const T * value, unsigned int amount, bool do_not_overwrite = true) { - return traits_provide((char *)_buffer, (const char *) value, amount, skip_overwrite); + return traits_provide((char *)_buffer, (const char *) value, amount, do_not_overwrite); } /* returns the number of items that have been read (atomic_mode == true means 'all or nothing') */ @@ -337,7 +369,7 @@ struct Ringbuffer: protected Ringbuffer_traits, public NonCopyable // fprintf(stderr, "%p> write: %d/%d [%d/%d]\n", this, _pointers.reader, _pointers.writer, _pointers.reader_partial, _pointers.writer_partial); } - T & consumer_start(void) + const T & consumer_start(void) { Buffer_table cache = _pointers; @@ -391,13 +423,13 @@ struct Ringbuffer: protected Ringbuffer_traits, public NonCopyable /* returns the number of items written to from buffer to stream */ inline unsigned int put(std::ostream &fd, unsigned int amount) { - return traits_put((char *)_buffer, fd, amount); + return traits_put((const char *)_buffer, fd, amount); } /* returns number of items read from stream to buffer */ inline unsigned int get(std::istream &fd, unsigned int amount) { - return traits_get((const char *)_buffer, fd, amount); + return traits_get((char *)_buffer, fd, amount); } void clear() diff --git a/src/mod/endpoints/mod_khomp/commons/saved_condition.cpp b/src/mod/endpoints/mod_khomp/commons/base/saved_condition.cpp similarity index 100% rename from src/mod/endpoints/mod_khomp/commons/saved_condition.cpp rename to src/mod/endpoints/mod_khomp/commons/base/saved_condition.cpp diff --git a/src/mod/endpoints/mod_khomp/commons/saved_condition.hpp b/src/mod/endpoints/mod_khomp/commons/base/saved_condition.hpp similarity index 100% rename from src/mod/endpoints/mod_khomp/commons/saved_condition.hpp rename to src/mod/endpoints/mod_khomp/commons/base/saved_condition.hpp diff --git a/src/mod/endpoints/mod_khomp/commons/scoped_lock.hpp b/src/mod/endpoints/mod_khomp/commons/base/scoped_lock.hpp similarity index 100% rename from src/mod/endpoints/mod_khomp/commons/scoped_lock.hpp rename to src/mod/endpoints/mod_khomp/commons/base/scoped_lock.hpp diff --git a/src/mod/endpoints/mod_khomp/commons/simple_lock.hpp b/src/mod/endpoints/mod_khomp/commons/base/simple_lock.hpp similarity index 96% copy from src/mod/endpoints/mod_khomp/commons/simple_lock.hpp copy to src/mod/endpoints/mod_khomp/commons/base/simple_lock.hpp index 4f6619f..8f22fe6 100644 --- a/src/mod/endpoints/mod_khomp/commons/simple_lock.hpp +++ b/src/mod/endpoints/mod_khomp/commons/base/simple_lock.hpp @@ -55,7 +55,7 @@ * implement the "unreference()" method for releasing resources. */ template < typename Implementor > -struct SimpleLockCommon: NEW_REFCOUNTER( SimpleLockCommon < Implementor > ) +struct SimpleLockCommon: COUNTER_SUPER( SimpleLockCommon < Implementor > ) { friend class ReferenceCounter < SimpleLockCommon < Implementor > >; @@ -71,7 +71,7 @@ struct SimpleLockCommon: NEW_REFCOUNTER( SimpleLockCommon < Implementor > ) {}; SimpleLockCommon(const SimpleLockCommon & o) - : INC_REFCOUNTER(o, SimpleLockCommon) + : COUNTER_REFER(o, SimpleLockCommon) {}; virtual ~SimpleLockCommon() diff --git a/src/mod/endpoints/mod_khomp/commons/strings.cpp b/src/mod/endpoints/mod_khomp/commons/base/strings.cpp similarity index 87% rename from src/mod/endpoints/mod_khomp/commons/strings.cpp rename to src/mod/endpoints/mod_khomp/commons/base/strings.cpp index 5e1cbc7..b7b8402 100644 --- a/src/mod/endpoints/mod_khomp/commons/strings.cpp +++ b/src/mod/endpoints/mod_khomp/commons/base/strings.cpp @@ -141,23 +141,31 @@ unsigned int Strings::tokenize(const std::string & str, Strings::vector_type & t return (cur_token - 1); } -bool Strings::toboolean(std::string str) +long Strings::tolong(const std::string & str, int base) { - std::string tmp(str); + return tolong(str.c_str(), base); +} - Strings::lower(tmp); +unsigned long Strings::toulong(const std::string & str, int base) +{ + return toulong(str.c_str(), base); +} - if ((tmp == "true") || (tmp == "yes")) return true; - if ((tmp == "false") || (tmp == "no")) return false; +unsigned long long Strings::toulonglong(const std::string & str, int base) +{ + return toulonglong(str.c_str(), base); +} - throw invalid_value(str); +double Strings::todouble(const std::string & str) +{ + return todouble(str.c_str()); } -long Strings::tolong(std::string str, int base) +long Strings::tolong(const char * str, int base) { char *str_end = 0; - unsigned long value = strtol(str.c_str(), &str_end, base); + unsigned long value = strtol(str, &str_end, base); if (str_end && *str_end == 0) return value; @@ -165,11 +173,23 @@ long Strings::tolong(std::string str, int base) throw invalid_value(str); } -unsigned long Strings::toulong(std::string str, int base) +bool Strings::toboolean(std::string str) +{ + std::string tmp(str); + + Strings::lower(tmp); + + if ((tmp == "true") || (tmp == "yes")) return true; + if ((tmp == "false") || (tmp == "no")) return false; + + throw invalid_value(str); +} + +unsigned long Strings::toulong(const char * str, int base) { char *str_end = 0; - unsigned long value = strtoul(str.c_str(), &str_end, base); + unsigned long value = strtoul(str, &str_end, base); if (str_end && *str_end == 0) return value; @@ -177,14 +197,14 @@ unsigned long Strings::toulong(std::string str, int base) throw invalid_value(str); } -unsigned long long Strings::toulonglong(std::string str, int base) +unsigned long long Strings::toulonglong(const char * str, int base) { #if defined(_WINDOWS) || defined(_Windows) || defined(_WIN32) || defined(WIN32) throw not_implemented(); #else char *str_end = 0; - unsigned long long value = strtoull(str.c_str(), &str_end, base); + unsigned long long value = strtoull(str, &str_end, base); if (str_end && *str_end == 0) return value; @@ -193,11 +213,11 @@ unsigned long long Strings::toulonglong(std::string str, int base) #endif } -double Strings::todouble(std::string str) +double Strings::todouble(const char * str) { char *str_end = 0; - double value = strtod(str.c_str(), &str_end); + double value = strtod(str, &str_end); if (str_end && *str_end == 0) return value; diff --git a/src/mod/endpoints/mod_khomp/commons/strings.hpp b/src/mod/endpoints/mod_khomp/commons/base/strings.hpp similarity index 81% rename from src/mod/endpoints/mod_khomp/commons/strings.hpp rename to src/mod/endpoints/mod_khomp/commons/base/strings.hpp index 056b933..947da38 100644 --- a/src/mod/endpoints/mod_khomp/commons/strings.hpp +++ b/src/mod/endpoints/mod_khomp/commons/base/strings.hpp @@ -68,6 +68,8 @@ struct Strings bool empty() { return _list.empty(); }; + const list_type & list() { return _list; }; + protected: list_type _list; }; @@ -75,8 +77,8 @@ struct Strings public: struct invalid_value { - invalid_value(const char * value): _value(value) {}; - invalid_value(std::string value): _value(value) {}; + invalid_value(const char * value): _value(value) {}; + invalid_value(const std::string & value): _value(value) {}; std::string & value() { return _value; } @@ -92,10 +94,15 @@ struct Strings static bool toboolean(std::string); static std::string fromboolean(bool); - static long tolong(std::string, int base = 10); - static unsigned long toulong(std::string, int base = 10); - static unsigned long long toulonglong(std::string, int base = 10); - static double todouble(std::string); + static long tolong(const std::string &, int base = 10); + static unsigned long toulong(const std::string &, int base = 10); + static unsigned long long toulonglong(const std::string &, int base = 10); + static double todouble(const std::string &); + + static long tolong(const char *, int base = 10); + static unsigned long toulong(const char *, int base = 10); + static unsigned long long toulonglong(const char *, int base = 10); + static double todouble(const char *); static std::string lower(std::string); static std::string hexadecimal(std::string); diff --git a/src/mod/endpoints/mod_khomp/commons/freeswitch/saved_condition.cpp b/src/mod/endpoints/mod_khomp/commons/base/system/freeswitch/saved_condition.cpp similarity index 83% rename from src/mod/endpoints/mod_khomp/commons/freeswitch/saved_condition.cpp rename to src/mod/endpoints/mod_khomp/commons/base/system/freeswitch/saved_condition.cpp index 29169f3..d4d9861 100644 --- a/src/mod/endpoints/mod_khomp/commons/freeswitch/saved_condition.cpp +++ b/src/mod/endpoints/mod_khomp/commons/base/system/freeswitch/saved_condition.cpp @@ -1,7 +1,7 @@ -/* +/* KHOMP generic endpoint/channel library. - Copyright (C) 2007-2009 Khomp Ind. & Com. - + Copyright (C) 2007-2009 Khomp Ind. & Com. + The contents of this file are subject to the Mozilla Public License Version 1.1 (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.mozilla.org/MPL/ @@ -23,40 +23,40 @@ The LGPL header follows below: - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ #include "saved_condition.hpp" bool SavedCondition::wait(unsigned int msec) { - bool ret = true; + bool ret = true; switch_mutex_lock(_mutex); if (!_signaled) - { + { /* msec * 1000 = The amount of time in microseconds to wait. */ - if (switch_thread_cond_timedwait(_condition, _mutex, (switch_interval_time_t)msec * 1000) != 0) - ret = false; - } - + if (switch_thread_cond_timedwait(_condition, _mutex, (switch_interval_time_t)msec * 1000) != 0) + ret = false; + } + _signaled = false; - switch_mutex_unlock(_mutex); + switch_mutex_unlock(_mutex); - return ret; + return ret; } diff --git a/src/mod/endpoints/mod_khomp/commons/freeswitch/saved_condition.hpp b/src/mod/endpoints/mod_khomp/commons/base/system/freeswitch/saved_condition.hpp similarity index 94% rename from src/mod/endpoints/mod_khomp/commons/freeswitch/saved_condition.hpp rename to src/mod/endpoints/mod_khomp/commons/base/system/freeswitch/saved_condition.hpp index 8acf0f3..b34e40b 100644 --- a/src/mod/endpoints/mod_khomp/commons/freeswitch/saved_condition.hpp +++ b/src/mod/endpoints/mod_khomp/commons/base/system/freeswitch/saved_condition.hpp @@ -1,7 +1,7 @@ -/* +/* KHOMP generic endpoint/channel library. - Copyright (C) 2007-2009 Khomp Ind. & Com. - + Copyright (C) 2007-2009 Khomp Ind. & Com. + The contents of this file are subject to the Mozilla Public License Version 1.1 (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.mozilla.org/MPL/ @@ -23,20 +23,20 @@ The LGPL header follows below: - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ #ifndef _SAVED_CONDITION_ @@ -104,7 +104,7 @@ struct SavedCondition : public SavedConditionCommon// : public RefCounter < Save if (!_signaled) switch_thread_cond_wait(_condition, _mutex); - + _signaled = false; switch_mutex_unlock(_mutex); diff --git a/src/mod/endpoints/mod_khomp/commons/freeswitch/simple_lock.hpp b/src/mod/endpoints/mod_khomp/commons/base/system/freeswitch/simple_lock.hpp similarity index 96% rename from src/mod/endpoints/mod_khomp/commons/freeswitch/simple_lock.hpp rename to src/mod/endpoints/mod_khomp/commons/base/system/freeswitch/simple_lock.hpp index 530d912..acae576 100644 --- a/src/mod/endpoints/mod_khomp/commons/freeswitch/simple_lock.hpp +++ b/src/mod/endpoints/mod_khomp/commons/base/system/freeswitch/simple_lock.hpp @@ -1,7 +1,7 @@ -/* +/* KHOMP generic endpoint/channel library. - Copyright (C) 2007-2009 Khomp Ind. & Com. - + Copyright (C) 2007-2009 Khomp Ind. & Com. + The contents of this file are subject to the Mozilla Public License Version 1.1 (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.mozilla.org/MPL/ @@ -23,20 +23,20 @@ The LGPL header follows below: - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ #ifndef _SIMPLE_LOCK_HPP_ @@ -72,7 +72,7 @@ struct SimpleLockBasic: public SimpleLockCommon < Implementor > { /* do nothing */ }; - + void unreference() { switch_mutex_destroy(_mutex); diff --git a/src/mod/endpoints/mod_khomp/commons/freeswitch/thread.hpp b/src/mod/endpoints/mod_khomp/commons/base/system/freeswitch/thread.hpp similarity index 94% rename from src/mod/endpoints/mod_khomp/commons/freeswitch/thread.hpp rename to src/mod/endpoints/mod_khomp/commons/base/system/freeswitch/thread.hpp index af50240..9e5abc4 100644 --- a/src/mod/endpoints/mod_khomp/commons/freeswitch/thread.hpp +++ b/src/mod/endpoints/mod_khomp/commons/base/system/freeswitch/thread.hpp @@ -1,7 +1,7 @@ -/* +/* KHOMP generic endpoint/channel library. - Copyright (C) 2007-2009 Khomp Ind. & Com. - + Copyright (C) 2007-2009 Khomp Ind. & Com. + The contents of this file are subject to the Mozilla Public License Version 1.1 (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.mozilla.org/MPL/ @@ -23,20 +23,20 @@ The LGPL header follows below: - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ #ifndef _THREAD_HPP_ @@ -66,7 +66,7 @@ struct Thread : ThreadCommon T _data; A _arg; }; - + template<typename T, typename R> struct ThreadData < T, R, void > : ThreadDataCommon { @@ -79,7 +79,7 @@ struct Thread : ThreadCommon T _data; }; - + template<typename T, typename A> struct ThreadData < T, void, A > : ThreadDataCommon { @@ -111,7 +111,7 @@ struct Thread : ThreadCommon }; template<typename T> - Thread(T obj, switch_memory_pool_t *pool=NULL) : + Thread(T obj, switch_memory_pool_t *pool=NULL) : _thread_info(new ThreadData<T, typename DecomposeFunction<T>::Return, void>(obj)), _pool(pool), _can_delete_pool(false) @@ -134,7 +134,7 @@ struct Thread : ThreadCommon } switch_threadattr_stacksize_set( - (switch_threadattr_t *)_thread_info->_attribute, + (switch_threadattr_t *)_thread_info->_attribute, SWITCH_THREAD_STACKSIZE); if(!priority()) @@ -143,9 +143,9 @@ struct Thread : ThreadCommon } } - + template<typename T, typename A> - Thread(T obj, A arg, switch_memory_pool_t *pool=NULL) : + Thread(T obj, A arg, switch_memory_pool_t *pool=NULL) : _thread_info(new ThreadData<T, typename DecomposeFunction<T>::Return, A>(obj, arg)), _pool(pool), _can_delete_pool(false) @@ -168,7 +168,7 @@ struct Thread : ThreadCommon } switch_threadattr_stacksize_set( - (switch_threadattr_t *)_thread_info->_attribute, + (switch_threadattr_t *)_thread_info->_attribute, SWITCH_THREAD_STACKSIZE); if(!priority()) @@ -178,11 +178,11 @@ struct Thread : ThreadCommon } - ~Thread() + ~Thread() { if(_thread_info) delete _thread_info; - + if (_can_delete_pool) switch_core_destroy_memory_pool(&_pool); } @@ -202,10 +202,10 @@ struct Thread : ThreadCommon if(!_pool || !_thread_info->_attribute) return false; - switch_thread_create((switch_thread_t**)&_thread_info->_self, - (switch_threadattr_t *)_thread_info->_attribute, - run, - _thread_info, + switch_thread_create((switch_thread_t**)&_thread_info->_self, + (switch_threadattr_t *)_thread_info->_attribute, + run, + _thread_info, _pool); if(!_thread_info->_self) @@ -223,13 +223,13 @@ struct Thread : ThreadCommon * * SWITCH_DECLARE(switch_status_t) switch_thread_join(switch_status_t *retval, switch_thread_t *thd); */ - + if(!_thread_info->_self) return -2; int retval = 0; - if(switch_thread_join((switch_status_t*)&retval, + if(switch_thread_join((switch_status_t*)&retval, (switch_thread_t *)_thread_info->_self) != 0) return -1; @@ -267,7 +267,7 @@ private: { #ifndef WIN32 struct sched_param param; - + struct apr_threadattr_t *myattr = (struct apr_threadattr_t *)_thread_info->_attribute; if (pthread_attr_setschedpolicy( @@ -307,13 +307,13 @@ protected: static void *SWITCH_THREAD_FUNC run(BaseThreadType *thread, void * obj) { - //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, // "Starting new Thread\n"); ThreadDataCommon * data = (ThreadDataCommon *)obj; int retval = data->run(); - //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, // "Stopping new Thread = %d\n", retval); ((Thread *)(data->_thread))->exit(retval); diff --git a/src/mod/endpoints/mod_khomp/commons/tagged_union.hpp b/src/mod/endpoints/mod_khomp/commons/base/tagged_union.hpp similarity index 84% rename from src/mod/endpoints/mod_khomp/commons/tagged_union.hpp rename to src/mod/endpoints/mod_khomp/commons/base/tagged_union.hpp index 1616268..f46aab0 100644 --- a/src/mod/endpoints/mod_khomp/commons/tagged_union.hpp +++ b/src/mod/endpoints/mod_khomp/commons/base/tagged_union.hpp @@ -42,10 +42,13 @@ #ifndef _TAGGED_UNION_HPP_ #define _TAGGED_UNION_HPP_ -#include <stdexcept> +#include <unistd.h> +#include <typeinfo> +#include <stdexcept> #include <iostream> -#include <unistd.h> + +#include <format.hpp> namespace Tagged { @@ -69,7 +72,7 @@ namespace Tagged ~EmptyUnion() { _adjusted = false; }; - bool operator==(const EmptyUnion & o) + bool operator==(const EmptyUnion & o) const { return true; }; @@ -80,24 +83,24 @@ namespace Tagged void setup(void) { _adjusted = true; }; protected: - bool value_set(void) { return false; }; - bool value_get(void) { return false; }; + bool value_set(void) const { return false; }; + bool value_get(void) const { return false; }; - bool value_check(void) { return false; }; + bool value_check(void) const { return false; }; template < typename S > - bool value_visit(S & visitor, typename S::ReturnType & ret) + bool value_visit(S & visitor, typename S::ReturnType & ret) const { return false; }; template < typename S > - bool value_visit_void(S & visitor) + bool value_visit_void(S & visitor) const { return false; }; - bool adjusted() { return _adjusted; }; + bool adjusted() const { return _adjusted; }; private: bool _adjusted; @@ -114,7 +117,7 @@ namespace Tagged // constructor with initializer template < typename U > - Union( U value ) + Union(U value) : _value(0) { set(value); @@ -123,7 +126,7 @@ namespace Tagged // copy constructor Union(const Union & o) : E(static_cast<const E&>(o)), - _value( (o._value ? new const V(*(o._value)) : 0) ) + _value( (o._value ? new V(*(o._value)) : 0) ) {}; // copy assignment operator @@ -137,7 +140,7 @@ namespace Tagged if (o._value) { - _value = new const V(*(o._value)); + _value = new V(*(o._value)); } E::operator=(static_cast<const E&>(o)); @@ -163,18 +166,21 @@ namespace Tagged } template < typename U > - bool check(void) + bool check(void) const { - return value_check(static_cast<const U * const>(0)); + return value_check(static_cast< const U * const>(0)); }; template < typename U > - const U & get(void) + U & get(void) const { - const U * res = 0; + U * res = 0; + + if (!E::adjusted()) + throw std::runtime_error("tagged union empty!"); if (!value_get(&res) || !res) - throw std::runtime_error("type mismatch"); + throw std::runtime_error(STG(FMT("type mismatch when asked for '%s'") % typeid(U).name())); return *res; }; @@ -190,7 +196,7 @@ namespace Tagged }; template < typename S > - typename S::ReturnType visit(S visitor) + typename S::ReturnType visit(S visitor) const { typename S::ReturnType ret; @@ -201,7 +207,7 @@ namespace Tagged }; template < typename S > - void visit_void(S visitor) + void visit_void(S visitor) const { if (!value_visit_void(visitor)) throw std::runtime_error("unable to visit empty value"); @@ -219,7 +225,7 @@ namespace Tagged }; // compare (equal) operator - bool operator==(const Union & o) + bool operator==(const Union & o) const { bool are_equal = false; @@ -236,7 +242,7 @@ namespace Tagged }; // compare types - bool sameType(const Union & o) + bool sameType(const Union & o) const { if ((!(_value) && !(o._value)) || (_value && o._value)) return E::operator==(static_cast<const E&>(o)); @@ -254,13 +260,13 @@ namespace Tagged bool value_set(V val) { - _value = new const V(val); + _value = new V(val); E::setup(); return true; }; - bool value_get(const V ** val) + bool value_get(V ** val) const { if (!_value) return false; @@ -269,14 +275,14 @@ namespace Tagged return true; } - bool value_check(const V * const junk) + bool value_check(const V * const junk) const { (void)junk; return (_value != 0); }; template < typename S > - bool value_visit(S & visitor, typename S::ReturnType & ret) + bool value_visit(S & visitor, typename S::ReturnType & ret) const { if (_value) { @@ -288,7 +294,7 @@ namespace Tagged }; template < typename S > - bool value_visit_void(S & visitor) + bool value_visit_void(S & visitor) const { if (_value) { @@ -300,7 +306,7 @@ namespace Tagged }; private: - const V * _value; + V * _value; }; }; diff --git a/src/mod/endpoints/mod_khomp/commons/thread.hpp b/src/mod/endpoints/mod_khomp/commons/base/thread.hpp similarity index 100% rename from src/mod/endpoints/mod_khomp/commons/thread.hpp rename to src/mod/endpoints/mod_khomp/commons/base/thread.hpp diff --git a/src/mod/endpoints/mod_khomp/commons/timer.cpp b/src/mod/endpoints/mod_khomp/commons/base/timer.cpp similarity index 96% rename from src/mod/endpoints/mod_khomp/commons/timer.cpp rename to src/mod/endpoints/mod_khomp/commons/base/timer.cpp index 36e32f5..0cb0ac4 100644 --- a/src/mod/endpoints/mod_khomp/commons/timer.cpp +++ b/src/mod/endpoints/mod_khomp/commons/base/timer.cpp @@ -276,6 +276,20 @@ bool TimerTraits::traits_restart (TimerTraits::Index & idx, bool force) return ret; } +void TimerTraits::traits_setup(TimerTraits::Index * idx, unsigned int msecs, const void * func, void * data, unsigned int value) +{ + _mutex.lock(); + + if (idx->valid) + { + (void)traits_del_unlocked(*idx); + } + + *idx = traits_add_unlocked(msecs, func, data, value); + + _mutex.unlock(); +} + bool TimerTraits::traits_del_unlocked (TimerTraits::Index & idx) { bool ret = false; diff --git a/src/mod/endpoints/mod_khomp/commons/timer.hpp b/src/mod/endpoints/mod_khomp/commons/base/timer.hpp similarity index 93% rename from src/mod/endpoints/mod_khomp/commons/timer.hpp rename to src/mod/endpoints/mod_khomp/commons/base/timer.hpp index 382efa1..24d115d 100644 --- a/src/mod/endpoints/mod_khomp/commons/timer.hpp +++ b/src/mod/endpoints/mod_khomp/commons/base/timer.hpp @@ -125,6 +125,8 @@ struct TimerTraits bool traits_del (Index & idx); bool traits_del (const void * func, const void * data = 0, unsigned int value = 0); + void traits_setup(Index * idx, unsigned int msecs, const void * func, void * data = 0, unsigned int value = 0); + /* timer start/stop functions */ bool start(void); bool stop(void); @@ -169,7 +171,7 @@ struct TimerTraits }; template < typename F, typename D > -struct TimerTemplate: NEW_REFCOUNTER(TimerTemplate< F, D >) +struct TimerTemplate: COUNTER_SUPER(TimerTemplate< F, D >) { typedef TimerTraits::Index Index; typedef TimerTraits::Control Control; @@ -179,7 +181,7 @@ struct TimerTemplate: NEW_REFCOUNTER(TimerTemplate< F, D >) {}; TimerTemplate(const TimerTemplate< F, D > & o) - : INC_REFCOUNTER(o, TimerTemplate< F, D >), + : COUNTER_REFER(o, TimerTemplate< F, D >), _timer(o._timer) {}; @@ -192,6 +194,11 @@ struct TimerTemplate: NEW_REFCOUNTER(TimerTemplate< F, D >) bool start() { return _timer->start(); } bool stop() { return _timer->stop(); } + inline void setup(Index * idx, unsigned int msecs, F * func, D data = 0, unsigned int value = 0) + { + _timer->traits_setup(idx, msecs, (const void *)func, (void *)(data), value); + } + inline Index add(unsigned int msecs, F * func, D data = 0, unsigned int value = 0) { return _timer->traits_add(msecs, (const void *)func, (void *)(data), value); diff --git a/src/mod/endpoints/mod_khomp/commons/types.hpp b/src/mod/endpoints/mod_khomp/commons/base/types.hpp similarity index 88% rename from src/mod/endpoints/mod_khomp/commons/types.hpp rename to src/mod/endpoints/mod_khomp/commons/base/types.hpp index adbd8ab..5ab6d29 100644 --- a/src/mod/endpoints/mod_khomp/commons/types.hpp +++ b/src/mod/endpoints/mod_khomp/commons/base/types.hpp @@ -55,15 +55,33 @@ /*** Used for checking information on classes and stuff.. ***/ template< typename T > -class IsClass +struct IsClass { protected: - template< typename X > static char ( &A( void(X::*)() ) )[1]; - template< typename X > static char ( &A( X ) )[2]; + template < typename X > static char ( &A( void(X::*)() ) )[1]; + template < typename X > static char ( &A( X ) )[2]; public: static bool const Result = sizeof( A< T >(0) ) == 1; }; +template < typename T > +struct IsConst +{ + static bool const Result = false; +}; + +template < typename T > +struct IsConst< const T > +{ + static bool const Result = true; +}; + +template < typename T > +struct IsConst< T const * > +{ + static bool const Result = true; +}; + /*** Used for template metaprogramming ***/ template < bool Value, typename Then, typename Else > diff --git a/src/mod/endpoints/mod_khomp/commons/simple_lock.hpp b/src/mod/endpoints/mod_khomp/commons/base/variable.hpp similarity index 55% rename from src/mod/endpoints/mod_khomp/commons/simple_lock.hpp rename to src/mod/endpoints/mod_khomp/commons/base/variable.hpp index 4f6619f..efeb0f5 100644 --- a/src/mod/endpoints/mod_khomp/commons/simple_lock.hpp +++ b/src/mod/endpoints/mod_khomp/commons/base/variable.hpp @@ -11,7 +11,7 @@ the specific language governing rights and limitations under the License. Alternatively, the contents of this file may be used under the terms of the - "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + "GNU Lesser General Public License 2.1" license (the "LGPL" License), in which case the provisions of "LGPL License" are applicable instead of those above. If you wish to allow use of your version of this file only under the terms of @@ -39,66 +39,86 @@ */ -#ifndef _SIMPLE_LOCK_COMMON_HPP_ -#define _SIMPLE_LOCK_COMMON_HPP_ - -#include <config_commons.hpp> +#include <refcounter.hpp> -#include <unistd.h> -#include <noncopyable.hpp> +#ifndef _VARIABLE_HPP_ +#define _VARIABLE_HPP_ -#include <refcounter.hpp> +template < typename R > +struct VariableBaseTable +{ + R value; +}; -/* This struct uses static polymorphism, and derived classes should implement * - * the "lock/trylock/unlock()" methods for correct code compilation. * - * The base class also features reference counting, so derived classes should * - * implement the "unreference()" method for releasing resources. */ +struct EmptyVariable {}; -template < typename Implementor > -struct SimpleLockCommon: NEW_REFCOUNTER( SimpleLockCommon < Implementor > ) +template < typename R > +struct Variable { - friend class ReferenceCounter < SimpleLockCommon < Implementor > >; + protected: + typedef VariableBaseTable< R > BaseType; - typedef enum - { - ISINUSE = 0, // operation not succeded (no error) - SUCCESS = 1, // operation succeded (no error) - FAILURE = 2, // mutex or state is somehow invalid (error! run for your life!) - } - Result; + typedef const BaseType * ConstObjType; + typedef BaseType * ObjType; + typedef R BaseType::* VarType; - SimpleLockCommon() + public: + template < typename ConstructorObjType > + Variable(R ConstructorObjType::* v) + : _adjusted(true), + _variable(reinterpret_cast<const VarType>(v)) {}; - SimpleLockCommon(const SimpleLockCommon & o) - : INC_REFCOUNTER(o, SimpleLockCommon) + Variable() + : _adjusted(false) {}; - virtual ~SimpleLockCommon() - {}; + template < typename MemberType > + void operator=(const MemberType v) + { + _adjusted = true; + _variable = reinterpret_cast<const VarType>(v); + } - inline Result lock() + template < typename Type > + R & operator()(Type * obj) const { - return static_cast<Implementor*>(this)->lock(); + if (!_adjusted) + throw EmptyVariable(); + + return (reinterpret_cast< ObjType >(obj))->*(_variable); } - inline Result trylock() + template < typename Type > + R & operator()(Type & obj) const { - return static_cast<Implementor*>(this)->trylock(); + if (!_adjusted) + throw EmptyVariable(); + + return (reinterpret_cast< ObjType >(&obj))->*(_variable); } - inline void unlock() + template < typename Type > + const R & operator()(const Type * obj) const { - static_cast<Implementor*>(this)->unlock(); + if (!_adjusted) + throw EmptyVariable(); + + return (reinterpret_cast< ConstObjType >(obj))->*(_variable); } - protected: - void unreference(void) + template < typename Type > + const R & operator()(const Type & obj) const { - static_cast<Implementor*>(this)->unreference(); + if (!_adjusted) + throw EmptyVariable(); + + return (reinterpret_cast< ConstObjType >(&obj))->*(_variable); } -}; -#include COMMONS_INCLUDE(simple_lock.hpp) + protected: + bool _adjusted; + VarType _variable; +}; -#endif /* _SIMPLE_LOCK_COMMON_HPP_ */ +#endif /* _VARIABLE_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/verbose.cpp b/src/mod/endpoints/mod_khomp/commons/base/verbose.cpp similarity index 82% rename from src/mod/endpoints/mod_khomp/commons/verbose.cpp rename to src/mod/endpoints/mod_khomp/commons/base/verbose.cpp index 182d159..bdc412e 100644 --- a/src/mod/endpoints/mod_khomp/commons/verbose.cpp +++ b/src/mod/endpoints/mod_khomp/commons/base/verbose.cpp @@ -54,11 +54,11 @@ /********************************************/ -std::string Verbose::channelStatus(int32 dev, int32 obj, int32 cs, Verbose::Presentation fmt) +std::string Verbose::channelStatus(const int32 dev, const int32 obj, const int32 cs, const Verbose::Presentation fmt) const { try { - K3L_CHANNEL_CONFIG & config = _api.channel_config(dev, obj); + const K3L_CHANNEL_CONFIG & config = _api.channel_config(dev, obj); return Verbose::channelStatus(config.Signaling, cs, fmt); } catch (...) @@ -68,14 +68,14 @@ std::string Verbose::channelStatus(int32 dev, int32 obj, int32 cs, Verbose::Pres } #if K3L_AT_LEAST(2,0,0) -std::string Verbose::event(int32 obj, K3L_EVENT *ev, R2CountryType r2_country, Verbose::Presentation fmt) +std::string Verbose::event(const int32 obj, const K3L_EVENT * const ev, const R2CountryType r2_country, const Verbose::Presentation fmt) const #else -std::string Verbose::event(int32 obj, K3L_EVENT *ev, Verbose::Presentation fmt) +std::string Verbose::event(const int32 obj, const K3L_EVENT * const ev, const Verbose::Presentation fmt) const #endif { try { - K3L_CHANNEL_CONFIG & config = _api.channel_config(ev->DeviceId, obj); + const K3L_CHANNEL_CONFIG & config = _api.channel_config(ev->DeviceId, obj); #if K3L_AT_LEAST(2,0,0) return Verbose::event(config.Signaling, obj, ev, r2_country, fmt); #else @@ -94,7 +94,7 @@ std::string Verbose::event(int32 obj, K3L_EVENT *ev, Verbose::Presentation fmt) /********************************************/ -std::string Verbose::echoLocation(KEchoLocation ec, Verbose::Presentation fmt) +std::string Verbose::echoLocation(const KEchoLocation ec, const Verbose::Presentation fmt) { switch (ec) { @@ -109,7 +109,7 @@ std::string Verbose::echoLocation(KEchoLocation ec, Verbose::Presentation fmt) return presentation(fmt, "<unknown>", "Unknown"); }; -std::string Verbose::echoCancellerConfig(KEchoCancellerConfig ec, Verbose::Presentation fmt) +std::string Verbose::echoCancellerConfig(KEchoCancellerConfig ec, const Verbose::Presentation fmt) { switch (ec) { @@ -124,21 +124,24 @@ std::string Verbose::echoCancellerConfig(KEchoCancellerConfig ec, Verbose::Prese return presentation(fmt, "<unknown>", "Unknown"); }; -// TODO: internal_deviceType / internal_deviceModel +std::string Verbose::deviceName(const KDeviceType dt, const int32 model, const Verbose::Presentation fmt) +{ + return deviceName(dt, model, 0, fmt); +} -std::string Verbose::deviceName(KDeviceType dt, int32 model, Verbose::Presentation fmt) +std::string Verbose::deviceName(const KDeviceType dt, const int32 model, const int32 count, const Verbose::Presentation fmt) { try { std::string value; - value += internal_deviceType(dt); + value += internal_deviceType(dt, count); value += "-"; - value += internal_deviceModel(dt, model); + value += internal_deviceModel(dt, model, count); return value; } - catch (internal_not_found & e) + catch (internal_not_found e) { PRESENTATION_CHECK_RETURN(fmt, STG(FMT("[type/model='%d/%d']") % (int)dt % (int)model), @@ -146,13 +149,18 @@ std::string Verbose::deviceName(KDeviceType dt, int32 model, Verbose::Presentati } } -std::string Verbose::deviceType(KDeviceType dt, Verbose::Presentation fmt) +std::string Verbose::deviceType(const KDeviceType dt, const Verbose::Presentation fmt) +{ + return deviceType(dt, 0, fmt); +} + +std::string Verbose::deviceType(const KDeviceType dt, const int32 count, const Verbose::Presentation fmt) { try { - return internal_deviceType(dt); + return internal_deviceType(dt, count); } - catch (internal_not_found & e) + catch (internal_not_found e) { PRESENTATION_CHECK_RETURN(fmt, STG(FMT("[type='%d']") % (int)dt), @@ -160,11 +168,11 @@ std::string Verbose::deviceType(KDeviceType dt, Verbose::Presentation fmt) } } -std::string Verbose::internal_deviceType(KDeviceType dt) +std::string Verbose::internal_deviceType(const KDeviceType dt, const int32 count) { switch (dt) { - case kdtE1: return "K2E1"; + case kdtE1: return (count > 34 || count == 0 ? "K2E1" : "K1E1"); #if K3L_AT_LEAST(1,6,0) case kdtFXO: return "KFXO"; @@ -183,10 +191,10 @@ std::string Verbose::internal_deviceType(KDeviceType dt) #endif #if K3L_AT_LEAST(1,5,0) - case kdtE1IP: return "K2E1"; + case kdtE1IP: return (count > 90 || count == 0 ? "K2E1" : "K1E1"); #endif #if K3L_AT_LEAST(1,5,1) - case kdtE1Spx: return "K2E1"; + case kdtE1Spx: return (count > 30 || count == 0 ? "K2E1" : "K1E1"); case kdtGWIP: return "KGWIP"; #endif @@ -202,7 +210,6 @@ std::string Verbose::internal_deviceType(KDeviceType dt) case kdtGSMUSBSpx: return "KGSMUSB"; case kdtE1FXSSpx: return "KE1FXS"; - case kdtDevTypeCount: return "DevTypeCount"; #endif #if K3L_EXACT(2,1,0) @@ -212,18 +219,24 @@ std::string Verbose::internal_deviceType(KDeviceType dt) #if K3L_AT_LEAST(2,2,0) case kdtE1AdHoc: return "KE1AdHoc"; #endif + case kdtDevTypeCount: break; } throw internal_not_found(); } -std::string Verbose::deviceModel(KDeviceType dt, int32 model, Verbose::Presentation fmt) +std::string Verbose::deviceModel(const KDeviceType dt, const int32 model, const Verbose::Presentation fmt) +{ + return deviceModel(dt, model, 0, fmt); +}; + +std::string Verbose::deviceModel(const KDeviceType dt, const int32 model, const int32 count, const Verbose::Presentation fmt) { try { - return internal_deviceModel(dt, model); + return internal_deviceModel(dt, model, count); } - catch (internal_not_found & e) + catch (internal_not_found e) { PRESENTATION_CHECK_RETURN(fmt, STG(FMT("[model='%d']") % (int)model), @@ -231,17 +244,17 @@ std::string Verbose::deviceModel(KDeviceType dt, int32 model, Verbose::Presentat } } -std::string Verbose::internal_deviceModel(KDeviceType dt, int32 model) +std::string Verbose::internal_deviceModel(const KDeviceType dt, const int32 model, const int32 count) { switch (dt) { case kdtE1: switch ((KE1DeviceModel)model) { - case kdmE1600: return "600"; - case kdmE1600E: return "600E"; + case kdmE1600: return (count > 34 || count == 0 ? "600" : "300"); + case kdmE1600E: return (count > 34 || count == 0 ? "600" : "300"); #if K3L_AT_LEAST(2,0,0) - case kdmE1600EX: return "600EX"; + case kdmE1600EX: return (count > 34 || count == 0 ? "600" : "300"); #endif } throw internal_not_found(); @@ -255,14 +268,38 @@ std::string Verbose::internal_deviceModel(KDeviceType dt, int32 model) #endif { #if K3L_AT_LEAST(1,6,0) - case kdmFXO80: return "80"; - case kdmFXOHI: return "HI"; + case kdmFXO80: + switch (count) + { + case 0: /* default */ + case 8: return "80"; + case 4: return "40"; + } + break; + + case kdmFXOHI: + switch (count) + { + case 0: /* default */ + case 8: return "80-HI"; + case 4: return "40-HI"; + } + break; + case kdmFXO160HI: return "160HI"; #if K3L_AT_LEAST(2,1,0) - case kdmFXO240HI: return "240HI"; + case kdmFXO240HI: return "240HI"; #endif #else - case kdmFXO80: return "80"; + case kdmFXO80: + switch (count) + { + case 0: /* default */ + case 8: return "80"; + case 4: return "40"; + } + break; + #endif } @@ -300,13 +337,13 @@ std::string Verbose::internal_deviceModel(KDeviceType dt, int32 model) switch ((KE1GWDeviceModel)model) { #if K3L_AT_LEAST(1,6,0) - case kdmE1GW640: return "640"; + case kdmE1GW640: return "640"; #if K3L_AT_LEAST(2,0,0) case kdmE1GW640EX: return "640EX"; #endif #else - case kdmE1600V: return "600V"; - case kdmE1600EV: return "600EV"; + case kdmE1600V: return (count > 34 || count == 0 ? "600V" : "300V" ); + case kdmE1600EV: return (count > 34 || count == 0 ? "600EV" : "600EV"); #endif } @@ -337,12 +374,12 @@ std::string Verbose::internal_deviceModel(KDeviceType dt, int32 model) switch ((KE1IPDeviceModel)model) { #if K3L_AT_LEAST(1,6,0) - case kdmE1IP: return "E1IP"; + case kdmE1IP: return "E1IP"; #if K3L_AT_LEAST(2,0,0) case kdmE1IPEX: return "E1IPEX"; #endif #else - case kdmE1600EG: return "600EG"; + case kdmE1600EG: return (count > 90 || count == 0 ? "600EG" : "300EG"); #endif } @@ -353,8 +390,8 @@ std::string Verbose::internal_deviceModel(KDeviceType dt, int32 model) case kdtE1Spx: switch ((KE1SpxDeviceModel)model) { - case kdmE1Spx: return "SPX"; - case kdm2E1Based: return "SPX-2E1"; + case kdmE1Spx: return "SPX"; + case kdm2E1Based: return "SPX-2E1"; #if K3L_AT_LEAST(2,0,0) case kdmE1SpxEX: return "SPXEX"; #endif @@ -367,7 +404,7 @@ std::string Verbose::internal_deviceModel(KDeviceType dt, int32 model) #if K3L_AT_LEAST(1,6,0) case kdmGWIP: return "GWIP"; #if K3L_AT_LEAST(2,0,0) - case kdmGWIPEX: return "GWIPEX"; + case kdmGWIPEX: return "GWIPEX"; #endif #else case kdmGW600G: return "600G"; @@ -382,9 +419,9 @@ std::string Verbose::internal_deviceModel(KDeviceType dt, int32 model) case kdtFXS: switch ((KFXSDeviceModel)model) { - case kdmFXS300: return "300"; + case kdmFXS300: return (count > 30 || count == 0 ? "300" : "150"); #if K3L_AT_LEAST(2,0,0) - case kdmFXS300EX: return "300EX"; + case kdmFXS300EX: return (count > 30 || count == 0 ? "300EX" : "150EX"); #endif } @@ -393,10 +430,10 @@ std::string Verbose::internal_deviceModel(KDeviceType dt, int32 model) case kdtFXSSpx: switch ((KFXSSpxDeviceModel)model) { - case kdmFXSSpx300: return "SPX"; - case kdmFXSSpx2E1Based: return "SPX-2E1"; + case kdmFXSSpx300: return (count > 30 || count == 0 ? "300-SPX" : "150-SPX"); + case kdmFXSSpx2E1Based: return "SPX-2E1"; #if K3L_AT_LEAST(2,0,0) - case kdmFXSSpx300EX: return "SPXEX"; + case kdmFXSSpx300EX: return (count > 30 || count == 0 ? "300-SPXEX" : "150-SPXEX"); #endif } @@ -405,9 +442,27 @@ std::string Verbose::internal_deviceModel(KDeviceType dt, int32 model) case kdtGSM: switch ((KGSMDeviceModel)model) { - case kdmGSM: return "40"; + case kdmGSM: + switch (count) + { + case 0: /* default */ + case 4: return "40"; + case 3: return "30"; + case 2: return "20"; + case 1: return "10"; + } + break; #if K3L_AT_LEAST(2,0,0) - case kdmGSMEX: return "40EX"; + case kdmGSMEX: + switch (count) + { + case 0: /* default */ + case 4: return "40EX"; + case 3: return "80EX"; + case 2: return "20EX"; + case 1: return "10EX"; + } + break; #endif } @@ -416,9 +471,27 @@ std::string Verbose::internal_deviceModel(KDeviceType dt, int32 model) case kdtGSMSpx: switch ((KGSMSpxDeviceModel)model) { - case kdmGSMSpx: return "SPX"; + case kdmGSMSpx: + switch (count) + { + case 0: /* default */ + case 4: return "40"; + case 3: return "30"; + case 2: return "20"; + case 1: return "10"; + } + break; #if K3L_AT_LEAST(2,0,0) - case kdmGSMSpxEX: return "SPXEX"; + case kdmGSMSpxEX: + switch (count) + { + case 0: /* default */ + case 4: return "40-SPXEX"; + case 3: return "80-SPXEX"; + case 2: return "20-SPXEX"; + case 1: return "10-SPXEX"; + } + break; #endif } @@ -444,8 +517,8 @@ std::string Verbose::internal_deviceModel(KDeviceType dt, int32 model) case kdtE1FXSSpx: switch ((KGSMSpxDeviceModel)model) { - case kdmE1FXSSpx: return "SPX"; - case kdmE1FXSSpxEX: return "SPXEX"; + case kdmE1FXSSpx: return "450-SPX"; + case kdmE1FXSSpxEX: return "450-SPXEX"; } throw internal_not_found(); @@ -476,7 +549,7 @@ std::string Verbose::internal_deviceModel(KDeviceType dt, int32 model) throw internal_not_found(); } -std::string Verbose::signaling(KSignaling sig, Verbose::Presentation fmt) +std::string Verbose::signaling(const KSignaling sig, const Verbose::Presentation fmt) { switch (sig) { @@ -523,7 +596,7 @@ std::string Verbose::signaling(KSignaling sig, Verbose::Presentation fmt) STG(FMT("Unknown signaling (%d)") % (int)sig)); } -std::string Verbose::systemObject(KSystemObject so, Verbose::Presentation fmt) +std::string Verbose::systemObject(const KSystemObject so, const Verbose::Presentation fmt) { switch (so) { @@ -544,7 +617,7 @@ std::string Verbose::systemObject(KSystemObject so, Verbose::Presentation fmt) STG(FMT("Unknown object (%d)") % (int)so)); } -std::string Verbose::mixerTone(KMixerTone mt, Verbose::Presentation fmt) +std::string Verbose::mixerTone(const KMixerTone mt, const Verbose::Presentation fmt) { switch (mt) { @@ -567,7 +640,7 @@ std::string Verbose::mixerTone(KMixerTone mt, Verbose::Presentation fmt) STG(FMT("Unknonwn tone (%d)") % (int)mt)); } -std::string Verbose::mixerSource(KMixerSource ms, Verbose::Presentation fmt) +std::string Verbose::mixerSource(const KMixerSource ms, const Verbose::Presentation fmt) { switch (ms) { @@ -588,7 +661,7 @@ std::string Verbose::mixerSource(KMixerSource ms, Verbose::Presentation fmt) STG(FMT("Unknonwn source (%d)") % (int)ms)); } -std::string Verbose::channelFeatures(int32 flags, Verbose::Presentation fmt) +std::string Verbose::channelFeatures(const int32 flags, const Verbose::Presentation fmt) { if (0x00 != flags) { @@ -603,9 +676,7 @@ std::string Verbose::channelFeatures(int32 flags, Verbose::Presentation fmt) if (kcfHighImpEvents & flags) strs.add(presentation(fmt, "HighImpEvents", "High Impedance Events")); #if K3L_AT_LEAST(1,6,0) if (kcfCallAnswerInfo & flags) strs.add(presentation(fmt, "CallAnswerInfo", "Call Answer Info")); -#if !K3L_AT_LEAST(2,2,0) if (kcfOutputVolume & flags) strs.add(presentation(fmt, "OutputVolume", "Output Volume")); -#endif if (kcfPlayerAGC & flags) strs.add(presentation(fmt, "PlayerAGC", "Player AGC")); #endif @@ -617,7 +688,7 @@ std::string Verbose::channelFeatures(int32 flags, Verbose::Presentation fmt) PRESENTATION_CHECK_RETURN(fmt, "", "No features"); } -std::string Verbose::seizeFail(KSeizeFail sf, Verbose::Presentation fmt) +std::string Verbose::seizeFail(const KSeizeFail sf, const Verbose::Presentation fmt) { switch (sf) { @@ -635,7 +706,7 @@ std::string Verbose::seizeFail(KSeizeFail sf, Verbose::Presentation fmt) } #if K3L_AT_LEAST(1,5,0) -std::string Verbose::internal_sipFailures(KSIP_Failures code, Verbose::Presentation fmt) +std::string Verbose::internal_sipFailures(const KSIP_Failures code, const Verbose::Presentation fmt) { switch (code) { @@ -691,13 +762,13 @@ std::string Verbose::internal_sipFailures(KSIP_Failures code, Verbose::Presentat throw internal_not_found(); } -std::string Verbose::sipFailures(KSIP_Failures code, Verbose::Presentation fmt) +std::string Verbose::sipFailures(const KSIP_Failures code, const Verbose::Presentation fmt) { try { return internal_sipFailures(code, fmt); } - catch (internal_not_found & e) + catch (internal_not_found e) { PRESENTATION_CHECK_RETURN(fmt, STG(FMT("[KSIP_Failures='%d']") % (int)code), @@ -708,7 +779,7 @@ std::string Verbose::sipFailures(KSIP_Failures code, Verbose::Presentation fmt) #endif #if K3L_AT_LEAST(1,5,1) -std::string Verbose::internal_isdnCause(KQ931Cause code, Verbose::Presentation fmt) +std::string Verbose::internal_isdnCause(const KQ931Cause code, const Verbose::Presentation fmt) { switch (code) { @@ -810,13 +881,13 @@ std::string Verbose::internal_isdnCause(KQ931Cause code, Verbose::Presentation f throw internal_not_found(); } -std::string Verbose::isdnCause(KQ931Cause code, Verbose::Presentation fmt) +std::string Verbose::isdnCause(const KQ931Cause code, const Verbose::Presentation fmt) { try { return internal_isdnCause(code); } - catch (internal_not_found & e) + catch (internal_not_found e) { return STG(FMT("[KQ931Cause='%d']") % (int)code); } @@ -824,7 +895,7 @@ std::string Verbose::isdnCause(KQ931Cause code, Verbose::Presentation fmt) #endif #if K3L_AT_LEAST(1,5,2) -std::string Verbose::isdnDebug(int32 flags, Verbose::Presentation fmt) +std::string Verbose::isdnDebug(const int32 flags, const Verbose::Presentation fmt) { if (0x00 != flags) { @@ -844,9 +915,9 @@ std::string Verbose::isdnDebug(int32 flags, Verbose::Presentation fmt) #endif #if K3L_AT_LEAST(2,0,0) -std::string Verbose::internal_signGroupB(KSignGroupB group, R2CountryType country, Verbose::Presentation fmt) +std::string Verbose::internal_signGroupB(const KSignGroupB group, const R2CountryType country, const Verbose::Presentation fmt) #else -std::string Verbose::internal_signGroupB(KSignGroupB group, Verbose::Presentation fmt) +std::string Verbose::internal_signGroupB(const KSignGroupB group, const Verbose::Presentation fmt) #endif { #if K3L_AT_LEAST(2,0,0) @@ -955,9 +1026,9 @@ std::string Verbose::internal_signGroupB(KSignGroupB group, Verbose::Presentatio } #if K3L_AT_LEAST(2,0,0) -std::string Verbose::signGroupB(KSignGroupB group, R2CountryType r2_country, Verbose::Presentation fmt) +std::string Verbose::signGroupB(const KSignGroupB group, const R2CountryType r2_country, const Verbose::Presentation fmt) #else -std::string Verbose::signGroupB(KSignGroupB group, Verbose::Presentation fmt) +std::string Verbose::signGroupB(const KSignGroupB group, const Verbose::Presentation fmt) #endif { try @@ -968,7 +1039,7 @@ std::string Verbose::signGroupB(KSignGroupB group, Verbose::Presentation fmt) return internal_signGroupB(group, fmt); #endif } - catch (internal_not_found & e) + catch (internal_not_found e) { PRESENTATION_CHECK_RETURN(fmt, STG(FMT("[KSignGroupB='%d']") % (int)group), @@ -977,9 +1048,9 @@ std::string Verbose::signGroupB(KSignGroupB group, Verbose::Presentation fmt) } #if K3L_AT_LEAST(2,0,0) -std::string Verbose::internal_signGroupII(KSignGroupII group, R2CountryType country, Verbose::Presentation fmt) +std::string Verbose::internal_signGroupII(const KSignGroupII group, const R2CountryType country, const Verbose::Presentation fmt) #else -std::string Verbose::internal_signGroupII(KSignGroupII group, Verbose::Presentation fmt) +std::string Verbose::internal_signGroupII(const KSignGroupII group, const Verbose::Presentation fmt) #endif { #if K3L_AT_LEAST(2,0,0) @@ -1085,9 +1156,9 @@ std::string Verbose::internal_signGroupII(KSignGroupII group, Verbose::Presentat } #if K3L_AT_LEAST(2,0,0) -std::string Verbose::signGroupII(KSignGroupII group, R2CountryType r2_country, Verbose::Presentation fmt) +std::string Verbose::signGroupII(const KSignGroupII group, const R2CountryType r2_country, const Verbose::Presentation fmt) #else -std::string Verbose::signGroupII(KSignGroupII group, Verbose::Presentation fmt) +std::string Verbose::signGroupII(const KSignGroupII group, const Verbose::Presentation fmt) #endif { try @@ -1098,7 +1169,7 @@ std::string Verbose::signGroupII(KSignGroupII group, Verbose::Presentation fmt) return internal_signGroupII(group); #endif } - catch (internal_not_found & e) + catch (internal_not_found e) { PRESENTATION_CHECK_RETURN(fmt, STG(FMT("[KSignGroupII='%d']") % (int)group), @@ -1107,9 +1178,9 @@ std::string Verbose::signGroupII(KSignGroupII group, Verbose::Presentation fmt) } #if K3L_AT_LEAST(2,0,0) -std::string Verbose::callFail(KSignaling sig, R2CountryType country, int32 info, Verbose::Presentation fmt) +std::string Verbose::callFail(const KSignaling sig, const R2CountryType country, const int32 info, const Verbose::Presentation fmt) #else -std::string Verbose::callFail(KSignaling sig, int32 info, Verbose::Presentation fmt) +std::string Verbose::callFail(const KSignaling sig, const int32 info, const Verbose::Presentation fmt) #endif { try @@ -1130,8 +1201,10 @@ std::string Verbose::callFail(KSignaling sig, int32 info, Verbose::Presentation #endif #if K3L_EXACT(2,1,0) case ksigISUP: +#if !K3L_AT_LEAST(2,2,0) case ksigFax: #endif +#endif #if K3L_AT_LEAST(1,6,0) case ksigCAS_EL7: case ksigE1LC: @@ -1181,7 +1254,7 @@ std::string Verbose::callFail(KSignaling sig, int32 info, Verbose::Presentation #endif } } - catch (internal_not_found & e) + catch (internal_not_found e) { /* this exception is used for breaking the control flow */ } @@ -1191,7 +1264,7 @@ std::string Verbose::callFail(KSignaling sig, int32 info, Verbose::Presentation STG(FMT("Unknown call fail code for '%s' (%d)") % signaling(sig, fmt) % (int)info)); } -std::string Verbose::channelFail(KSignaling sig, int32 code, Verbose::Presentation fmt) +std::string Verbose::channelFail(const KSignaling sig, const int32 code, const Verbose::Presentation fmt) { try { @@ -1202,8 +1275,10 @@ std::string Verbose::channelFail(KSignaling sig, int32 code, Verbose::Presentati case ksigSIP: #if K3L_EXACT(2,1,0) case ksigISUP: +#if !K3L_AT_LEAST(2,2,0) case ksigFax: #endif +#endif throw internal_not_found(); #if K3L_AT_LEAST(1,6,0) @@ -1248,7 +1323,7 @@ std::string Verbose::channelFail(KSignaling sig, int32 code, Verbose::Presentati #endif } } - catch (internal_not_found & e) + catch (internal_not_found e) { /* this exception is used for breaking the control flow */ } @@ -1258,7 +1333,7 @@ std::string Verbose::channelFail(KSignaling sig, int32 code, Verbose::Presentati STG(FMT("Unknown channel fail code for '%s' (%d)") % signaling(sig, fmt) % (int)code)); } -std::string Verbose::internalFail(KInternalFail inf, Verbose::Presentation fmt) +std::string Verbose::internalFail(const KInternalFail inf, const Verbose::Presentation fmt) { switch (inf) { @@ -1277,7 +1352,7 @@ std::string Verbose::internalFail(KInternalFail inf, Verbose::Presentation fmt) STG(FMT("Unknown internal failure (%d)") % (int)inf)); } -std::string Verbose::linkErrorCounter(KLinkErrorCounter ec, Verbose::Presentation fmt) +std::string Verbose::linkErrorCounter(const KLinkErrorCounter ec, const Verbose::Presentation fmt) { switch (ec) { @@ -1304,7 +1379,7 @@ std::string Verbose::linkErrorCounter(KLinkErrorCounter ec, Verbose::Presentatio STG(FMT("Unknown link error counter (%d)") % (int)ec)); } -std::string Verbose::callStatus(KCallStatus code, Verbose::Presentation fmt) +std::string Verbose::callStatus(const KCallStatus code, const Verbose::Presentation fmt) { switch (code) { @@ -1319,7 +1394,7 @@ std::string Verbose::callStatus(KCallStatus code, Verbose::Presentation fmt) STG(FMT("Unknown call status (%d)") % (int)code)); } -std::string Verbose::linkStatus(KSignaling sig, int32 code, Verbose::Presentation fmt) +std::string Verbose::linkStatus(const KSignaling sig, const int32 code, const Verbose::Presentation fmt, const bool simpleStatus) { switch (sig) { @@ -1340,7 +1415,9 @@ std::string Verbose::linkStatus(KSignaling sig, int32 code, Verbose::Presentatio #endif #if K3L_EXACT(2,1,0) - case ksigFax: +#if !K3L_AT_LEAST(2,2,0) + case ksigFax: +#endif return presentation(fmt, "[ksigFax]", "FAX"); #endif case ksigContinuousEM: @@ -1386,9 +1463,18 @@ std::string Verbose::linkStatus(KSignaling sig, int32 code, Verbose::Presentatio if (kesUnknownAlarm & code) strs.add(presentation(fmt, "UnknownAlarm", "Slip alarm")); if (kesE1Error & code) strs.add(presentation(fmt, "E1Error", "E1 error")); - PRESENTATION_CHECK_RETURN(fmt, - STG(FMT("kes{%s}") % strs.merge(",")), - strs.merge(", ")); + if (simpleStatus) + { + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("kes{%s}") % *(strs.list().begin())), + *(strs.list().begin())); + } + else + { + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("kes{%s}") % strs.merge(",")), + strs.merge(", ")); + } } } @@ -1397,7 +1483,7 @@ std::string Verbose::linkStatus(KSignaling sig, int32 code, Verbose::Presentatio STG(FMT("Unknown link status for '%s' (%d)") % signaling(sig) % (int)code)); } -std::string Verbose::channelStatus(KSignaling sig, int32 flags, Verbose::Presentation fmt) +std::string Verbose::channelStatus(const KSignaling sig, const int32 flags, const Verbose::Presentation fmt) { try { @@ -1413,9 +1499,11 @@ std::string Verbose::channelStatus(KSignaling sig, int32 flags, Verbose::Present #if K3L_EXACT(2,1,0) case ksigISUP: return presentation(fmt, "[ksigISUP]", "ISUP trunk"); +#if !K3L_AT_LEAST(2,2,0) case ksigFax: return presentation(fmt, "[ksigFax]", "FAX"); #endif +#endif case ksigAnalog: #if K3L_AT_LEAST(1,6,0) @@ -1532,7 +1620,7 @@ std::string Verbose::channelStatus(KSignaling sig, int32 flags, Verbose::Present } } } - catch (internal_not_found & e) + catch (internal_not_found e) { /* we use this exception to break the control flow */ } @@ -1542,7 +1630,7 @@ std::string Verbose::channelStatus(KSignaling sig, int32 flags, Verbose::Present STG(FMT("Unknown channel status for '%s' (%d)") % signaling(sig) % flags)); } -std::string Verbose::status(KLibraryStatus code, Verbose::Presentation fmt) +std::string Verbose::status(const KLibraryStatus code, const Verbose::Presentation fmt) { switch (code) { @@ -1569,7 +1657,7 @@ std::string Verbose::status(KLibraryStatus code, Verbose::Presentation fmt) STG(FMT("Unknown library status (%d)") % (int)code)); } -std::string Verbose::h100configIndex(KH100ConfigIndex code, Verbose::Presentation fmt) +std::string Verbose::h100configIndex(const KH100ConfigIndex code, const Verbose::Presentation fmt) { switch (code) { @@ -1584,7 +1672,7 @@ std::string Verbose::h100configIndex(KH100ConfigIndex code, Verbose::Presentatio case khciCTbusFreq07_04: return presentation(fmt, "khciCTbusFreq07_04", "CTBus Frequency 07 04"); // TODO: find better name case khciCTbusFreq11_08: return presentation(fmt, "khciCTbusFreq11_08", "CTBus Frequency 11 08"); // TODO: find better name case khciCTbusFreq15_12: return presentation(fmt, "khciCTbusFreq15_12", "CTBus Frequency 15 12"); // TODO: find better name - case khciMax: return presentation(fmt, "khciMax", "Max"); // TODO: find better name + case khciMax: return presentation(fmt, "khciMax", "Max"); // TODO: find better name case khciMasterDevId: return presentation(fmt, "khciMasterDevId", "Master Device Number"); case khciSecMasterDevId: return presentation(fmt, "khciSecMasterDevId", "Secondary Master Device Number"); case khciCtNetrefDevId: return presentation(fmt, "khciCtNetrefDevId", "CTBus Network Reference Device Number"); @@ -1599,7 +1687,7 @@ std::string Verbose::h100configIndex(KH100ConfigIndex code, Verbose::Presentatio } #if K3L_AT_LEAST(1,6,0) -std::string Verbose::callStartInfo(KCallStartInfo code, Verbose::Presentation fmt) +std::string Verbose::callStartInfo(const KCallStartInfo code, const Verbose::Presentation fmt) { switch (code) { @@ -1615,13 +1703,13 @@ std::string Verbose::callStartInfo(KCallStartInfo code, Verbose::Presentation fm STG(FMT("Unknown call answer info (%d)") % (int)code)); } -std::string Verbose::gsmCallCause(KGsmCallCause code, Verbose::Presentation fmt) +std::string Verbose::gsmCallCause(const KGsmCallCause code, const Verbose::Presentation fmt) { try { return internal_gsmCallCause(code, fmt); } - catch (internal_not_found & e) + catch (internal_not_found e) { PRESENTATION_CHECK_RETURN(fmt, STG(FMT("[KGsmCallCause='%d']") % (int)code), @@ -1629,7 +1717,7 @@ std::string Verbose::gsmCallCause(KGsmCallCause code, Verbose::Presentation fmt) } } -std::string Verbose::internal_gsmCallCause(KGsmCallCause code, Verbose::Presentation fmt) +std::string Verbose::internal_gsmCallCause(const KGsmCallCause code, const Verbose::Presentation fmt) { switch (code) { @@ -1686,13 +1774,13 @@ std::string Verbose::internal_gsmCallCause(KGsmCallCause code, Verbose::Presenta throw internal_not_found(); } -std::string Verbose::gsmMobileCause(KGsmMobileCause code, Verbose::Presentation fmt) +std::string Verbose::gsmMobileCause(const KGsmMobileCause code, const Verbose::Presentation fmt) { try { return internal_gsmMobileCause(code, fmt); } - catch (internal_not_found & e) + catch (internal_not_found e) { PRESENTATION_CHECK_RETURN(fmt, STG(FMT("[KGsmMobileCause='%d']") % (int)code), @@ -1700,7 +1788,7 @@ std::string Verbose::gsmMobileCause(KGsmMobileCause code, Verbose::Presentation } } -std::string Verbose::internal_gsmMobileCause(KGsmMobileCause code, Verbose::Presentation fmt) +std::string Verbose::internal_gsmMobileCause(const KGsmMobileCause code, const Verbose::Presentation fmt) { switch (code) { @@ -1792,13 +1880,13 @@ std::string Verbose::internal_gsmMobileCause(KGsmMobileCause code, Verbose::Pres throw internal_not_found(); } -std::string Verbose::gsmSmsCause(KGsmSmsCause code, Verbose::Presentation fmt) +std::string Verbose::gsmSmsCause(const KGsmSmsCause code, const Verbose::Presentation fmt) { try { return internal_gsmSmsCause(code, fmt); } - catch (internal_not_found & e) + catch (internal_not_found e) { PRESENTATION_CHECK_RETURN(fmt, STG(FMT("[KGsmSmsCause='%d']") % (int)code), @@ -1806,7 +1894,7 @@ std::string Verbose::gsmSmsCause(KGsmSmsCause code, Verbose::Presentation fmt) } } -std::string Verbose::internal_gsmSmsCause(KGsmSmsCause code, Verbose::Presentation fmt) +std::string Verbose::internal_gsmSmsCause(const KGsmSmsCause code, const Verbose::Presentation fmt) { switch (code) { @@ -1890,13 +1978,13 @@ std::string Verbose::internal_gsmSmsCause(KGsmSmsCause code, Verbose::Presentati throw internal_not_found(); } -std::string Verbose::q931ProgressIndication(KQ931ProgressIndication code, Verbose::Presentation fmt) +std::string Verbose::q931ProgressIndication(const KQ931ProgressIndication code, const Verbose::Presentation fmt) { try { return internal_q931ProgressIndication(code); } - catch (internal_not_found & e) + catch (internal_not_found e) { PRESENTATION_CHECK_RETURN(fmt, STG(FMT("[KQ931ProgressIndication='%d']") % (int)code), @@ -1904,7 +1992,7 @@ std::string Verbose::q931ProgressIndication(KQ931ProgressIndication code, Verbos } } -std::string Verbose::internal_q931ProgressIndication(KQ931ProgressIndication code, Verbose::Presentation fmt) +std::string Verbose::internal_q931ProgressIndication(const KQ931ProgressIndication code, const Verbose::Presentation fmt) { switch (code) { @@ -1924,7 +2012,7 @@ std::string Verbose::internal_q931ProgressIndication(KQ931ProgressIndication cod #if K3L_AT_LEAST(2,1,0) -std::string Verbose::faxResult(KFaxResult code, Verbose::Presentation fmt) +std::string Verbose::faxResult(const KFaxResult code, const Verbose::Presentation fmt) { switch (code) { @@ -1945,7 +2033,7 @@ std::string Verbose::faxResult(KFaxResult code, Verbose::Presentation fmt) STG(FMT("Unknown fax result (%d)") % (int)code)); } -std::string Verbose::faxFileErrorCause(KFaxFileErrorCause code, Verbose::Presentation fmt) +std::string Verbose::faxFileErrorCause(const KFaxFileErrorCause code, const Verbose::Presentation fmt) { switch (code) { @@ -1969,307 +2057,12 @@ std::string Verbose::faxFileErrorCause(KFaxFileErrorCause code, Verbose::Present #endif - /********/ -std::string Verbose::commandName(int32 code) -{ - switch ((kcommand)code) - { - case K_CM_SEIZE: return "CM_SEIZE"; - case K_CM_SYNC_SEIZE: return "CM_SYNC_SEIZE"; - case K_CM_DIAL_DTMF: return "CM_DIAL_DTMF"; -#if K3L_AT_LEAST(1,6,0) - case K_CM_SIP_REGISTER: return "CM_SIP_REGISTER"; -#endif - case K_CM_DISCONNECT: return "CM_DISCONNECT"; - case K_CM_CONNECT: return "CM_CONNECT"; - case K_CM_PRE_CONNECT: return "CM_PRE_CONNECT"; - case K_CM_CAS_CHANGE_LINE_STT: return "CM_CAS_CHANGE_LINE_STT"; - case K_CM_CAS_SEND_MFC: return "CM_CAS_SEND_MFC"; - case K_CM_SET_FORWARD_CHANNEL: return "CM_SET_FORWARD_CHANNEL"; - case K_CM_CAS_SET_MFC_DETECT_MODE: return "CM_CAS_SET_MFC_DETECT_MODE"; - case K_CM_DROP_COLLECT_CALL: return "CM_DROP_COLLECT_CALL"; - -#if K3L_AT_LEAST(1,5,0) - case K_CM_MAKE_CALL: return "CM_MAKE_CALL"; -#endif - -#if K3L_AT_LEAST(1,4,0) - case K_CM_RINGBACK: return "CM_RINGBACK"; -#endif - -#if K3L_AT_LEAST(1,5,1) - case K_CM_USER_INFORMATION: return "CM_USER_INFORMATION"; -#endif - -#if K3L_AT_LEAST(1,4,0) && !K3L_AT_LEAST(2,2,0) - case K_CM_VOIP_SEIZE: return "CM_VOIP_SEIZE"; - -#if !K3L_AT_LEAST(2,0,0) - /* internal commands */ - case K_CM_VOIP_START_DEBUG: return "CM_VOIP_START_DEBUG"; - case K_CM_VOIP_STOP_DEBUG: return "CM_VOIP_STOP_DEBUG"; - case K_CM_VOIP_DUMP_STAT: return "CM_VOIP_DUMP_STAT"; -#endif -#endif - -#if K3L_AT_LEAST(1,5,2) && !K3L_AT_LEAST(2,0,0) - /* internal command */ - case K_CM_ISDN_DEBUG: return "CM_ISDN_DEBUG"; -#endif - - case K_CM_LOCK_INCOMING: return "CM_LOCK_INCOMING"; - case K_CM_UNLOCK_INCOMING: return "CM_UNLOCK_INCOMING"; - case K_CM_LOCK_OUTGOING: return "CM_LOCK_OUTGOING"; - case K_CM_UNLOCK_OUTGOING: return "CM_UNLOCK_OUTGOING"; - - case K_CM_START_SEND_FAIL: return "CM_START_SEND_FAIL"; - case K_CM_STOP_SEND_FAIL: return "CM_STOP_SEND_FAIL"; - -#if K3L_AT_LEAST(1,5,3) - case K_CM_END_OF_NUMBER: return "CM_END_OF_NUMBER"; -#endif - -#if K3L_AT_LEAST(1,6,0) - case K_CM_SS_TRANSFER: return "CM_SS_TRANSFER"; - case K_CM_GET_SMS: return "CM_GET_SMS"; - case K_CM_PREPARE_SMS: return "CM_PREPARE_SMS"; - case K_CM_SEND_SMS: return "CM_SEND_SMS"; -#endif -#if K3L_HAS_MPTY_SUPPORT - case K_CM_HOLD_SWITCH: return "CM_HOLD_SWITCH"; - case K_CM_MPTY_CONF: return "CM_MPTY_CONF"; - case K_CM_MPTY_SPLIT: return "CM_MPTY_SPLIT"; -#endif - - case K_CM_ENABLE_DTMF_SUPPRESSION: return "CM_ENABLE_DTMF_SUPPRESSION"; - case K_CM_DISABLE_DTMF_SUPPRESSION: return "CM_DISABLE_DTMF_SUPPRESSION"; - case K_CM_ENABLE_AUDIO_EVENTS: return "CM_ENABLE_AUDIO_EVENTS"; - case K_CM_DISABLE_AUDIO_EVENTS: return "CM_DISABLE_AUDIO_EVENTS"; - case K_CM_ENABLE_CALL_PROGRESS: return "CM_ENABLE_CALL_PROGRESS"; - case K_CM_DISABLE_CALL_PROGRESS: return "CM_DISABLE_CALL_PROGRESS"; - case K_CM_FLASH: return "CM_FLASH"; - case K_CM_ENABLE_PULSE_DETECTION: return "CM_ENABLE_PULSE_DETECTION"; - case K_CM_DISABLE_PULSE_DETECTION: return "CM_DISABLE_PULSE_DETECTION"; - case K_CM_ENABLE_ECHO_CANCELLER: return "CM_ENABLE_ECHO_CANCELLER"; - case K_CM_DISABLE_ECHO_CANCELLER: return "CM_DISABLE_ECHO_CANCELLER"; - case K_CM_ENABLE_AGC: return "CM_ENABLE_AGC"; - case K_CM_DISABLE_AGC: return "CM_DISABLE_AGC"; - case K_CM_ENABLE_HIGH_IMP_EVENTS: return "CM_ENABLE_HIGH_IMP_EVENTS"; - case K_CM_DISABLE_HIGH_IMP_EVENTS: return "CM_DISABLE_HIGH_IMP_EVENTS"; - -#if K3L_AT_LEAST(1,6,0) - case K_CM_ENABLE_CALL_ANSWER_INFO: return "CM_ENABLE_CALL_ANSWER_INFO"; - case K_CM_DISABLE_CALL_ANSWER_INFO: return "CM_DISABLE_CALL_ANSWER_INFO"; -#endif - - case K_CM_RESET_LINK: return "CM_RESET_LINK"; - -#if K3L_AT_LEAST(1,6,0) - case K_CM_CLEAR_LINK_ERROR_COUNTER: return "CM_CLEAR_LINK_ERROR_COUNTER"; -#endif - - case K_CM_SEND_DTMF: return "CM_SEND_DTMF"; - case K_CM_STOP_AUDIO: return "CM_STOP_AUDIO"; - case K_CM_HARD_RESET: return "CM_HARD_RESET"; - - case K_CM_SEND_TO_CTBUS: return "CM_SEND_TO_CTBUS"; - case K_CM_RECV_FROM_CTBUS: return "CM_RECV_FROM_CTBUS"; - case K_CM_SETUP_H100: return "CM_SETUP_H100"; - - case K_CM_MIXER: return "CM_MIXER"; - case K_CM_CLEAR_MIXER: return "CM_CLEAR_MIXER"; - case K_CM_PLAY_FROM_FILE: return "CM_PLAY_FROM_FILE"; - case K_CM_RECORD_TO_FILE: return "CM_RECORD_TO_FILE"; - case K_CM_PLAY_FROM_STREAM: return "CM_PLAY_FROM_STREAM"; - case K_CM_STOP_PLAY: return "CM_STOP_PLAY"; - case K_CM_STOP_RECORD: return "CM_STOP_RECORD"; - case K_CM_PAUSE_PLAY: return "CM_PAUSE_PLAY"; - case K_CM_PAUSE_RECORD: return "CM_PAUSE_RECORD"; - case K_CM_INCREASE_VOLUME: return "CM_INCREASE_VOLUME"; - case K_CM_DECREASE_VOLUME: return "CM_DECREASE_VOLUME"; - case K_CM_LISTEN: return "CM_LISTEN"; - case K_CM_STOP_LISTEN: return "CM_STOP_LISTEN"; - case K_CM_PREPARE_FOR_LISTEN: return "CM_PREPARE_FOR_LISTEN"; - - case K_CM_PLAY_SOUND_CARD: return "CM_PLAY_SOUND_CARD"; - case K_CM_STOP_SOUND_CARD: return "CM_STOP_SOUND_CARD"; - - case K_CM_MIXER_CTBUS: return "CM_MIXER_CTBUS"; - case K_CM_PLAY_FROM_STREAM_EX: return "CM_PLAY_FROM_STREAM_EX"; - case K_CM_ENABLE_PLAYER_AGC: return "CM_ENABLE_PLAYER_AGC"; - case K_CM_DISABLE_PLAYER_AGC: return "CM_DISABLE_PLAYER_AGC"; - case K_CM_START_STREAM_BUFFER: return "CM_START_STREAM_BUFFER"; - case K_CM_ADD_STREAM_BUFFER: return "CM_ADD_STREAM_BUFFER"; - case K_CM_STOP_STREAM_BUFFER: return "CM_STOP_STREAM_BUFFER"; - case K_CM_SEND_BEEP: return "CM_SEND_BEEP"; - case K_CM_SEND_BEEP_CONF: return "CM_SEND_BEEP_CONF"; - case K_CM_ADD_TO_CONF: return "CM_ADD_TO_CONF"; - case K_CM_REMOVE_FROM_CONF: return "CM_REMOVE_FROM_CONF"; - case K_CM_RECORD_TO_FILE_EX: return "CM_RECORD_TO_FILE_EX"; - -#if K3L_AT_LEAST(1,5,4) - case K_CM_SET_VOLUME: return "CM_SET_VOLUME"; -#endif - case K_CM_SET_LINE_CONDITION: return "CM_SET_LINE_CONDITION"; - case K_CM_SEND_LINE_CONDITION: return "CM_SEND_LINE_CONDITION"; - case K_CM_SET_CALLER_CATEGORY: return "CM_SET_CALLER_CATEGORY"; - case K_CM_DIAL_MFC: return "CM_DIAL_MFC"; - - case K_CM_INTERNAL_PLAY: return "CM_INTERNAL_PLAY"; - case K_CM_RESUME_PLAY: return "CM_RESUME_PLAY"; - case K_CM_RESUME_RECORD: return "CM_RESUME_RECORD"; - case K_CM_INTERNAL_PLAY_EX: return "CM_INTERNAL_PLAY_EX"; -#if !K3L_AT_LEAST(2,0,0) - case K_CM_PING: return "CM_PING"; -#if K3L_AT_LEAST(1,6,0) - case K_CM_LOG_REQUEST: return "CM_LOG_REQUEST"; - case K_CM_LOG_CREATE_DISPATCHER: return "CM_LOG_CREATE_DISPATCHER"; - case K_CM_LOG_DESTROY_DISPATCHER: return "CM_LOG_DESTROY_DISPATCHER"; -#endif -#endif - -#if K3L_AT_LEAST(1,6,0) - case K_CM_START_CADENCE: return "CM_START_CADENCE"; - case K_CM_STOP_CADENCE: return "CM_STOP_CADENCE"; - case K_CM_CHECK_NEW_SMS: return "CM_CHECK_NEW_SMS"; - case K_CM_SEND_TO_MODEM: return "CM_SEND_TO_MODEM"; -#endif -#if K3L_AT_LEAST(2,1,0) - case K_CM_START_FAX_TX: return "CM_START_FAX_TX"; - case K_CM_STOP_FAX_TX: return "CM_STOP_FAX_TX"; - case K_CM_ADD_FAX_FILE: return "CM_ADD_FAX_FILE"; - case K_CM_ADD_FAX_PAGE_BREAK: return "CM_ADD_FAX_PAGE_BREAK"; - case K_CM_START_FAX_RX: return "CM_START_FAX_RX"; - case K_CM_STOP_FAX_RX: return "CM_STOP_FAX_RX"; - case K_CM_SIM_CARD_SELECT: return "CM_SIM_CARD_SELECT"; -#endif - -#if K3L_AT_LEAST(2,1,0) - case K_CM_NOTIFY_WATCHDOG: return "CM_NOTIFY_WATCHDOG"; - case K_CM_STOP_WATCHDOG: return "CM_STOP_WATCHDOG"; - case K_CM_WATCHDOG_COUNT: return "CM_WATCHDOG_COUNT"; - case K_CM_START_WATCHDOG: return "CM_START_WATCHDOG"; -#endif - - } - - return STG(FMT("[command='%d']") % code); -} - -std::string Verbose::eventName(int32 code) -{ - switch ((kevent)code) - { - case K_EV_CHANNEL_FREE: return "EV_CHANNEL_FREE"; - case K_EV_CONNECT: return "EV_CONNECT"; - case K_EV_DISCONNECT: return "EV_DISCONNECT"; - case K_EV_CALL_SUCCESS: return "EV_CALL_SUCCESS"; - case K_EV_CALL_FAIL: return "EV_CALL_FAIL"; - case K_EV_NO_ANSWER: return "EV_NO_ANSWER"; - case K_EV_BILLING_PULSE: return "EV_BILLING_PULSE"; - case K_EV_SEIZE_SUCCESS: return "EV_SEIZE_SUCCESS"; - case K_EV_SEIZE_FAIL: return "EV_SEIZE_FAIL"; - case K_EV_SEIZURE_START: return "EV_SEIZURE_START"; - case K_EV_CAS_LINE_STT_CHANGED: return "EV_CAS_LINE_STT_CHANGED"; - case K_EV_CAS_MFC_RECV: return "EV_CAS_MFC_RECV"; - -#if K3L_AT_LEAST(1,5,0) - case K_EV_NEW_CALL: return "EV_NEW_CALL"; -#endif - -#if K3L_AT_LEAST(1,5,1) - case K_EV_USER_INFORMATION: return "EV_USER_INFORMATION"; -#endif - -#if K3L_AT_LEAST(1,5,3) - case K_EV_DIALED_DIGIT: return "EV_DIALED_DIGIT"; -#endif - -#if K3L_AT_LEAST(1,6,0) - case K_EV_SIP_REGISTER_INFO: return "EV_SIP_REGISTER_INFO"; -#endif - -#if K3L_AT_LEAST(1,4,0) - case K_EV_CALL_HOLD_START: return "EV_CALL_HOLD_START"; - case K_EV_CALL_HOLD_STOP: return "EV_CALL_HOLD_STOP"; -#endif - -#if K3L_AT_LEAST(1,6,0) - case K_EV_SS_TRANSFER_FAIL: return "EV_SS_TRANSFER_FAIL"; - case K_EV_FLASH: return "EV_FLASH"; -#endif - - case K_EV_DTMF_DETECTED: return "EV_DTMF_DETECTED"; - case K_EV_DTMF_SEND_FINISH: return "EV_DTMF_SEND_FINISH"; - case K_EV_AUDIO_STATUS: return "EV_AUDIO_STATUS"; - case K_EV_CADENCE_RECOGNIZED: return "EV_CADENCE_RECOGNIZED"; - - case K_EV_END_OF_STREAM: return "EV_END_OF_STREAM"; - case K_EV_PULSE_DETECTED: return "EV_PULSE_DETECTED"; - -#if K3L_AT_LEAST(1,5,1) - case K_EV_POLARITY_REVERSAL: return "EV_POLARITY_REVERSAL"; -#endif - -#if K3L_AT_LEAST(1,6,0) - case K_EV_ISDN_PROGRESS_INDICATOR: return "EV_ISDN_PROGRESS_INDICATOR"; - case K_EV_CALL_ANSWER_INFO: return "EV_CALL_ANSWER_INFO"; - case K_EV_COLLECT_CALL: return "EV_COLLECT_CALL"; - case K_EV_SIP_DTMF_DETECTED: return "EV_SIP_DTMF_DETECTED"; - - case K_EV_RECV_FROM_MODEM: return "EV_RECV_FROM_MODEM"; - case K_EV_NEW_SMS: return "EV_NEW_SMS"; - case K_EV_SMS_INFO: return "EV_SMS_INFO"; - case K_EV_SMS_DATA: return "EV_SMS_DATA"; - case K_EV_SMS_SEND_RESULT: return "EV_SMS_SEND_RESULT"; - case K_EV_RING_DETECTED: return "EV_RING_DETECTED"; - case K_EV_PHYSICAL_LINK_DOWN: return "EV_PHYSICAL_LINK_DOWN"; - case K_EV_PHYSICAL_LINK_UP: return "EV_PHYSICAL_LINK_UP"; -#endif -#if K3L_HAS_MPTY_SUPPORT - case K_EV_CALL_MPTY_START: return "EV_CALL_MPTY_START"; - case K_EV_CALL_MPTY_STOP: return "EV_CALL_MPTY_STOP"; - case K_EV_GSM_COMMAND_STATUS: return "EV_GSM_COMMAND_STATUS"; -#endif -#if !K3L_AT_LEAST(2,0,0) - case K_EV_PONG: return "EV_PONG"; -#endif - case K_EV_CHANNEL_FAIL: return "EV_CHANNEL_FAIL"; - case K_EV_REFERENCE_FAIL: return "EV_REFERENCE_FAIL"; - case K_EV_INTERNAL_FAIL: return "EV_INTERNAL_FAIL"; - case K_EV_HARDWARE_FAIL: return "EV_HARDWARE_FAIL"; - case K_EV_LINK_STATUS: return "EV_LINK_STATUS"; - -#if K3L_AT_LEAST(1,4,0) - case K_EV_CLIENT_RECONNECT: return "EV_CLIENT_RECONNECT"; - case K_EV_VOIP_SEIZURE: return "EV_VOIP_SEIZURE"; -#endif - case K_EV_SEIZURE: return "EV_SEIZURE"; -#if K3L_AT_LEAST(2,1,0) - case K_EV_FAX_CHANNEL_FREE: return "EV_FAX_CHANNEL_FREE"; - case K_EV_FAX_FILE_SENT: return "EV_FAX_FILE_SENT"; - case K_EV_FAX_FILE_FAIL: return "EV_FAX_FILE_FAIL"; - /*case K_EV_FAX_MESSAGE_CONFIRMATION:return "EV_FAX_MESSAGE_CONFIRMATION";*/ - case K_EV_FAX_TX_TIMEOUT: return "EV_FAX_TX_TIMEOUT"; - case K_EV_FAX_PAGE_CONFIRMATION:return "EV_FAX_PAGE_CONFIRMATION"; - case K_EV_FAX_REMOTE_INFO: return "EV_FAX_REMOTE_INFO"; -#endif - -#if K3L_AT_LEAST(2,1,0) - case K_EV_WATCHDOG_COUNT: return "EV_WATCHDOG_COUNT"; -#endif - } - - return STG(FMT("[event='%d']") % code); -} - - #if K3L_AT_LEAST(2,0,0) -std::string Verbose::command(int32 dev, K3L_COMMAND *k3lcmd, R2CountryType r2_country, Verbose::Presentation fmt) +std::string Verbose::command(const int32 dev, const K3L_COMMAND * const k3lcmd, const R2CountryType r2_country, const Verbose::Presentation fmt) #else -std::string Verbose::command(int32 dev, K3L_COMMAND *k3lcmd, Verbose::Presentation fmt) +std::string Verbose::command(const int32 dev, const K3L_COMMAND * const k3lcmd, const Verbose::Presentation fmt) #endif { #if K3L_AT_LEAST(2,0,0) @@ -2280,106 +2073,107 @@ std::string Verbose::command(int32 dev, K3L_COMMAND *k3lcmd, Verbose::Presentati } #if K3L_AT_LEAST(2,0,0) -std::string Verbose::command(int32 cmd_code, int32 dev_idx, int32 obj_idx, const char * params, R2CountryType r2_country, Verbose::Presentation fmt) +std::string Verbose::command(const int32 cmd_code, const int32 dev_idx, const int32 obj_idx, const char * const params, const R2CountryType r2_country, const Verbose::Presentation fmt) #else -std::string Verbose::command(int32 cmd_code, int32 dev_idx, int32 obj_idx, const char * params, Verbose::Presentation fmt) +std::string Verbose::command(const int32 cmd_code, const int32 dev_idx, const int32 obj_idx, const char * const params, const Verbose::Presentation fmt) #endif { unsigned short int dev = (unsigned short int) dev_idx; unsigned short int obj = (unsigned short int) obj_idx; - kcommand code = (kcommand) cmd_code; + VerboseTraits::Command code = (VerboseTraits::Command) cmd_code; std::string buf, extra; switch (code) { - case K_CM_SEIZE: - case K_CM_SYNC_SEIZE: - //case K_CM_VOIP_SEIZE://deprecated - case K_CM_DIAL_MFC: - case K_CM_DIAL_DTMF: - - case K_CM_CONNECT: - case K_CM_PRE_CONNECT: - case K_CM_DISCONNECT: - case K_CM_DROP_COLLECT_CALL: - - case K_CM_START_SEND_FAIL: - case K_CM_STOP_SEND_FAIL: - - case K_CM_ENABLE_DTMF_SUPPRESSION: - case K_CM_DISABLE_DTMF_SUPPRESSION: - case K_CM_ENABLE_AUDIO_EVENTS: - case K_CM_DISABLE_AUDIO_EVENTS: - case K_CM_ENABLE_CALL_PROGRESS: - case K_CM_DISABLE_CALL_PROGRESS: - case K_CM_ENABLE_PULSE_DETECTION: - case K_CM_DISABLE_PULSE_DETECTION: - case K_CM_ENABLE_ECHO_CANCELLER: - case K_CM_DISABLE_ECHO_CANCELLER: - case K_CM_ENABLE_AGC: - case K_CM_DISABLE_AGC: - case K_CM_ENABLE_HIGH_IMP_EVENTS: - case K_CM_DISABLE_HIGH_IMP_EVENTS: - - case K_CM_FLASH: - case K_CM_RESET_LINK: - case K_CM_CLEAR_MIXER: - - case K_CM_LOCK_INCOMING: - case K_CM_UNLOCK_INCOMING: - case K_CM_LOCK_OUTGOING: - case K_CM_UNLOCK_OUTGOING: - - case K_CM_INCREASE_VOLUME: - case K_CM_DECREASE_VOLUME: - - case K_CM_STOP_RECORD: - case K_CM_PAUSE_RECORD: - case K_CM_RESUME_RECORD: - - case K_CM_STOP_LISTEN: - - case K_CM_PLAY_SOUND_CARD: - case K_CM_STOP_SOUND_CARD: - case K_CM_RINGBACK: + case VerboseTraits::K_CM_SEIZE: + case VerboseTraits::K_CM_SYNC_SEIZE: + case VerboseTraits::K_CM_VOIP_SEIZE: + case VerboseTraits::K_CM_DIAL_MFC: + case VerboseTraits::K_CM_DIAL_DTMF: + + case VerboseTraits::K_CM_CONNECT: + case VerboseTraits::K_CM_PRE_CONNECT: + case VerboseTraits::K_CM_DISCONNECT: + case VerboseTraits::K_CM_DROP_COLLECT_CALL: + + case VerboseTraits::K_CM_START_SEND_FAIL: + case VerboseTraits::K_CM_STOP_SEND_FAIL: + + case VerboseTraits::K_CM_ENABLE_DTMF_SUPPRESSION: + case VerboseTraits::K_CM_DISABLE_DTMF_SUPPRESSION: + case VerboseTraits::K_CM_ENABLE_AUDIO_EVENTS: + case VerboseTraits::K_CM_DISABLE_AUDIO_EVENTS: + case VerboseTraits::K_CM_ENABLE_CALL_PROGRESS: + case VerboseTraits::K_CM_DISABLE_CALL_PROGRESS: + case VerboseTraits::K_CM_ENABLE_PULSE_DETECTION: + case VerboseTraits::K_CM_DISABLE_PULSE_DETECTION: + case VerboseTraits::K_CM_ENABLE_ECHO_CANCELLER: + case VerboseTraits::K_CM_DISABLE_ECHO_CANCELLER: + case VerboseTraits::K_CM_ENABLE_AGC: + case VerboseTraits::K_CM_DISABLE_AGC: + case VerboseTraits::K_CM_ENABLE_HIGH_IMP_EVENTS: + case VerboseTraits::K_CM_DISABLE_HIGH_IMP_EVENTS: + + case VerboseTraits::K_CM_FLASH: + case VerboseTraits::K_CM_RESET_LINK: + case VerboseTraits::K_CM_CLEAR_MIXER: + + case VerboseTraits::K_CM_LOCK_INCOMING: + case VerboseTraits::K_CM_UNLOCK_INCOMING: + case VerboseTraits::K_CM_LOCK_OUTGOING: + case VerboseTraits::K_CM_UNLOCK_OUTGOING: + + case VerboseTraits::K_CM_INCREASE_VOLUME: + case VerboseTraits::K_CM_DECREASE_VOLUME: + + case VerboseTraits::K_CM_STOP_RECORD: + case VerboseTraits::K_CM_PAUSE_RECORD: + case VerboseTraits::K_CM_RESUME_RECORD: + + case VerboseTraits::K_CM_STOP_LISTEN: + + case VerboseTraits::K_CM_PLAY_SOUND_CARD: + case VerboseTraits::K_CM_STOP_SOUND_CARD: + case VerboseTraits::K_CM_RINGBACK: #if K3L_AT_LEAST(1,4,0) && !K3L_AT_LEAST(2,0,0) - case K_CM_VOIP_START_DEBUG: - case K_CM_VOIP_STOP_DEBUG: - case K_CM_VOIP_DUMP_STAT: + case VerboseTraits::K_CM_VOIP_START_DEBUG: + case VerboseTraits::K_CM_VOIP_STOP_DEBUG: + case VerboseTraits::K_CM_VOIP_DUMP_STAT: #endif #if K3L_AT_LEAST(1,5,3) - case K_CM_END_OF_NUMBER: + case VerboseTraits::K_CM_END_OF_NUMBER: #endif #if K3L_AT_LEAST(1,5,4) - case K_CM_SET_VOLUME: + case VerboseTraits::K_CM_SET_VOLUME: #endif #if K3L_AT_LEAST(1,6,0) - case K_CM_ENABLE_CALL_ANSWER_INFO: - case K_CM_DISABLE_CALL_ANSWER_INFO: + case VerboseTraits::K_CM_ENABLE_CALL_ANSWER_INFO: + case VerboseTraits::K_CM_DISABLE_CALL_ANSWER_INFO: - case K_CM_SS_TRANSFER: + case VerboseTraits::K_CM_SS_TRANSFER: - case K_CM_CHECK_NEW_SMS: - case K_CM_GET_SMS: - case K_CM_PREPARE_SMS: - case K_CM_SEND_SMS: + case VerboseTraits::K_CM_CHECK_NEW_SMS: + case VerboseTraits::K_CM_GET_SMS: + case VerboseTraits::K_CM_PREPARE_SMS: + case VerboseTraits::K_CM_SEND_SMS: - case K_CM_START_CADENCE: - case K_CM_STOP_CADENCE: - case K_CM_SEND_TO_MODEM: + case VerboseTraits::K_CM_START_CADENCE: + case VerboseTraits::K_CM_STOP_CADENCE: + case VerboseTraits::K_CM_SEND_TO_MODEM: #endif #if K3L_HAS_MPTY_SUPPORT - case K_CM_HOLD_SWITCH: - case K_CM_MPTY_CONF: - case K_CM_MPTY_SPLIT: + case VerboseTraits::K_CM_HOLD_SWITCH: + case VerboseTraits::K_CM_MPTY_CONF: + case VerboseTraits::K_CM_MPTY_SPLIT: #endif #if K3L_AT_LEAST(2,1,0) - case K_CM_SIM_CARD_SELECT: + case VerboseTraits::K_CM_SIM_CARD_SELECT: + case VerboseTraits::K_CM_CT_TRANSFER: #endif if (params != NULL) { @@ -2394,12 +2188,12 @@ std::string Verbose::command(int32 cmd_code, int32 dev_idx, int32 obj_idx, const return show(buf, commandName(code), Target(CHANNEL, dev, obj)); } - case K_CM_SEND_DTMF: /* ?? */ + case VerboseTraits::K_CM_SEND_DTMF: /* ?? */ return show(buf, commandName(code), Target(CHANNEL, dev, obj)); /****/ - case K_CM_STOP_AUDIO: + case VerboseTraits::K_CM_STOP_AUDIO: extra = "stop='"; switch ((params ? (int)(*params) : -1)) { @@ -2415,7 +2209,7 @@ std::string Verbose::command(int32 cmd_code, int32 dev_idx, int32 obj_idx, const /****/ #if K3L_AT_LEAST(1,5,2) && !K3L_AT_LEAST(2,0,0) - case K_CM_ISDN_DEBUG: + case VerboseTraits::K_CM_ISDN_DEBUG: extra = "flags='"; extra += isdnDebug((unsigned long)params); extra += "'"; @@ -2426,7 +2220,7 @@ std::string Verbose::command(int32 cmd_code, int32 dev_idx, int32 obj_idx, const /****/ #if K3L_AT_LEAST(1,5,1) - case K_CM_USER_INFORMATION: + case VerboseTraits::K_CM_USER_INFORMATION: #endif if (params != NULL) { @@ -2448,7 +2242,7 @@ std::string Verbose::command(int32 cmd_code, int32 dev_idx, int32 obj_idx, const - case K_CM_CAS_CHANGE_LINE_STT: + case VerboseTraits::K_CM_CAS_CHANGE_LINE_STT: { const char status = (params ? *params : 0x00); @@ -2462,7 +2256,7 @@ std::string Verbose::command(int32 cmd_code, int32 dev_idx, int32 obj_idx, const return show(buf, commandName(code), Target(CHANNEL, dev, obj), extra); } - case K_CM_CAS_SEND_MFC: + case VerboseTraits::K_CM_CAS_SEND_MFC: { char mfc = (params ? *params : 0xff); @@ -2471,7 +2265,7 @@ std::string Verbose::command(int32 cmd_code, int32 dev_idx, int32 obj_idx, const return show(buf, commandName(code), Target(CHANNEL, dev, obj), extra); } - case K_CM_CAS_SET_MFC_DETECT_MODE: + case VerboseTraits::K_CM_CAS_SET_MFC_DETECT_MODE: { int mode = (params ? *((int *)params) : -1); @@ -2480,7 +2274,7 @@ std::string Verbose::command(int32 cmd_code, int32 dev_idx, int32 obj_idx, const return show(buf, commandName(code), Target(CHANNEL, dev, obj), extra); } - case K_CM_SET_FORWARD_CHANNEL: + case VerboseTraits::K_CM_SET_FORWARD_CHANNEL: { int channel = (params ? *((int*) params) : -1); @@ -2490,7 +2284,7 @@ std::string Verbose::command(int32 cmd_code, int32 dev_idx, int32 obj_idx, const } #if K3L_AT_LEAST(1,5,0) - case K_CM_MAKE_CALL: + case VerboseTraits::K_CM_MAKE_CALL: extra = "options='"; extra += (params ? params : "<empty>"); extra += "'"; @@ -2498,8 +2292,8 @@ std::string Verbose::command(int32 cmd_code, int32 dev_idx, int32 obj_idx, const return show(buf, commandName(code), Target(CHANNEL, dev, obj), extra); #endif - case K_CM_MIXER: - case K_CM_MIXER_CTBUS: + case VerboseTraits::K_CM_MIXER: + case VerboseTraits::K_CM_MIXER_CTBUS: { if (params) { @@ -2537,29 +2331,29 @@ std::string Verbose::command(int32 cmd_code, int32 dev_idx, int32 obj_idx, const return show(buf, commandName(code), Target(MIXER, dev, obj), extra); }; - case K_CM_PLAY_FROM_FILE: + case VerboseTraits::K_CM_PLAY_FROM_FILE: extra = "file='"; extra += (params ? params : "<empty>"); extra += "'"; return show(buf, commandName(code), Target(PLAYER, dev, obj), extra); - case K_CM_RECORD_TO_FILE: + case VerboseTraits::K_CM_RECORD_TO_FILE: extra = "file='"; extra += (params ? params : "<empty>"); extra += "'"; return show(buf, commandName(code), Target(PLAYER, dev, obj), extra); - case K_CM_RECORD_TO_FILE_EX: + case VerboseTraits::K_CM_RECORD_TO_FILE_EX: extra = "params='"; extra += (params ? params : "<empty>"); extra += "'"; return show(buf, commandName(code), Target(PLAYER, dev, obj), extra); - case K_CM_PLAY_FROM_STREAM: - case K_CM_ADD_STREAM_BUFFER: + case VerboseTraits::K_CM_PLAY_FROM_STREAM: + case VerboseTraits::K_CM_ADD_STREAM_BUFFER: { struct buffer_param { @@ -2576,7 +2370,7 @@ std::string Verbose::command(int32 cmd_code, int32 dev_idx, int32 obj_idx, const return show(buf, commandName(code), Target(PLAYER, dev, obj), extra); } - case K_CM_PLAY_FROM_STREAM_EX: + case VerboseTraits::K_CM_PLAY_FROM_STREAM_EX: { struct buffer_param { @@ -2604,24 +2398,24 @@ std::string Verbose::command(int32 cmd_code, int32 dev_idx, int32 obj_idx, const return show(buf, commandName(code), Target(PLAYER, dev, obj), extra); } - case K_CM_STOP_PLAY: - case K_CM_PAUSE_PLAY: - case K_CM_RESUME_PLAY: + case VerboseTraits::K_CM_STOP_PLAY: + case VerboseTraits::K_CM_PAUSE_PLAY: + case VerboseTraits::K_CM_RESUME_PLAY: - case K_CM_START_STREAM_BUFFER: - case K_CM_STOP_STREAM_BUFFER: + case VerboseTraits::K_CM_START_STREAM_BUFFER: + case VerboseTraits::K_CM_STOP_STREAM_BUFFER: - case K_CM_ENABLE_PLAYER_AGC: - case K_CM_DISABLE_PLAYER_AGC: + case VerboseTraits::K_CM_ENABLE_PLAYER_AGC: + case VerboseTraits::K_CM_DISABLE_PLAYER_AGC: - case K_CM_SEND_BEEP: - case K_CM_SEND_BEEP_CONF: + case VerboseTraits::K_CM_SEND_BEEP: + case VerboseTraits::K_CM_SEND_BEEP_CONF: - case K_CM_INTERNAL_PLAY: - case K_CM_INTERNAL_PLAY_EX: + case VerboseTraits::K_CM_INTERNAL_PLAY: + case VerboseTraits::K_CM_INTERNAL_PLAY_EX: return show(buf, commandName(code), Target(PLAYER, dev, obj)); - case K_CM_ADD_TO_CONF: + case VerboseTraits::K_CM_ADD_TO_CONF: extra += "conference='"; extra += (params ? (int) (*params) : -1); extra += "'"; @@ -2631,8 +2425,8 @@ std::string Verbose::command(int32 cmd_code, int32 dev_idx, int32 obj_idx, const case CM_REMOVE_FROM_CONF: return show(buf, commandName(code), Target(MIXER, dev, obj)); - case K_CM_LISTEN: - case K_CM_PREPARE_FOR_LISTEN: + case VerboseTraits::K_CM_LISTEN: + case VerboseTraits::K_CM_PREPARE_FOR_LISTEN: { int msecs = (params ? *((int*)params) : -1); @@ -2641,8 +2435,8 @@ std::string Verbose::command(int32 cmd_code, int32 dev_idx, int32 obj_idx, const return show(buf, commandName(code), Target(PLAYER, dev, obj), extra); } - case K_CM_SEND_TO_CTBUS: - case K_CM_RECV_FROM_CTBUS: + case VerboseTraits::K_CM_SEND_TO_CTBUS: + case VerboseTraits::K_CM_RECV_FROM_CTBUS: { KCtbusCommand *p = (KCtbusCommand*)(params); @@ -2652,8 +2446,8 @@ std::string Verbose::command(int32 cmd_code, int32 dev_idx, int32 obj_idx, const return show(buf, commandName(code), Target(CHANNEL, dev, obj), extra); } - case K_CM_SET_LINE_CONDITION: - case K_CM_SEND_LINE_CONDITION: + case VerboseTraits::K_CM_SET_LINE_CONDITION: + case VerboseTraits::K_CM_SEND_LINE_CONDITION: extra = "condition='"; #if K3L_AT_LEAST(2,0,0) extra += signGroupB((KSignGroupB) *((int *) params), r2_country); @@ -2664,7 +2458,7 @@ std::string Verbose::command(int32 cmd_code, int32 dev_idx, int32 obj_idx, const return show(buf, commandName(code), Target(CHANNEL, dev, obj), extra); - case K_CM_SET_CALLER_CATEGORY: + case VerboseTraits::K_CM_SET_CALLER_CATEGORY: extra = "category='"; #if K3L_AT_LEAST(2,0,0) extra += signGroupII((KSignGroupII) *((int *) params), r2_country); @@ -2676,10 +2470,10 @@ std::string Verbose::command(int32 cmd_code, int32 dev_idx, int32 obj_idx, const return show(buf, commandName(code), Target(CHANNEL, dev, obj), extra); #if K3L_AT_LEAST(1,6,0) - case K_CM_CLEAR_LINK_ERROR_COUNTER: + case VerboseTraits::K_CM_CLEAR_LINK_ERROR_COUNTER: return show(buf, commandName(code), Target(LINK, dev, obj)); - case K_CM_SIP_REGISTER: + case VerboseTraits::K_CM_SIP_REGISTER: if (params != NULL) { extra += "param='"; @@ -2694,7 +2488,7 @@ std::string Verbose::command(int32 cmd_code, int32 dev_idx, int32 obj_idx, const } #endif - case K_CM_SETUP_H100: + case VerboseTraits::K_CM_SETUP_H100: extra += "option='"; extra += h100configIndex((KH100ConfigIndex)obj_idx); extra += "'value='"; @@ -2703,38 +2497,38 @@ std::string Verbose::command(int32 cmd_code, int32 dev_idx, int32 obj_idx, const return show(buf, commandName(code), Target(DEVICE, dev), extra); - case K_CM_HARD_RESET: + case VerboseTraits::K_CM_HARD_RESET: return show(buf, commandName(code), Target(LINK, dev, obj)); #if !K3L_AT_LEAST(2,0,0) /* como funciona? */ - case K_CM_LOG_REQUEST: - case K_CM_LOG_CREATE_DISPATCHER: - case K_CM_LOG_DESTROY_DISPATCHER: + case VerboseTraits::K_CM_LOG_REQUEST: + case VerboseTraits::K_CM_LOG_CREATE_DISPATCHER: + case VerboseTraits::K_CM_LOG_DESTROY_DISPATCHER: - case K_CM_PING: + case VerboseTraits::K_CM_PING: #endif return show(buf, commandName(code), Target(NONE)); #if K3L_AT_LEAST(2,1,0) - case K_CM_START_FAX_TX: - case K_CM_START_FAX_RX: - case K_CM_ADD_FAX_FILE: + case VerboseTraits::K_CM_START_FAX_TX: + case VerboseTraits::K_CM_START_FAX_RX: + case VerboseTraits::K_CM_ADD_FAX_FILE: extra = "params='"; extra += (params ? params : "<empty>"); extra += "'"; return show(buf, commandName(code), Target(CHANNEL, dev, obj), extra); - case K_CM_STOP_FAX_TX: - case K_CM_STOP_FAX_RX: - case K_CM_ADD_FAX_PAGE_BREAK: + case VerboseTraits::K_CM_STOP_FAX_TX: + case VerboseTraits::K_CM_STOP_FAX_RX: + case VerboseTraits::K_CM_ADD_FAX_PAGE_BREAK: return show(buf, commandName(code), Target(CHANNEL, dev, obj)); #endif #if K3L_AT_LEAST(2,1,0) - case K_CM_NOTIFY_WATCHDOG: - case K_CM_STOP_WATCHDOG: - case K_CM_START_WATCHDOG: + case VerboseTraits::K_CM_NOTIFY_WATCHDOG: + case VerboseTraits::K_CM_STOP_WATCHDOG: + case VerboseTraits::K_CM_START_WATCHDOG: return show(buf, commandName(code) , Target(DEVICE, obj)); - case K_CM_WATCHDOG_COUNT: + case VerboseTraits::K_CM_WATCHDOG_COUNT: return show(buf, commandName(code) , Target(NONE)); #endif @@ -2745,65 +2539,66 @@ std::string Verbose::command(int32 cmd_code, int32 dev_idx, int32 obj_idx, const } #if K3L_AT_LEAST(2,0,0) -std::string Verbose::event(KSignaling sig, int32 obj_idx, K3L_EVENT *ev, R2CountryType r2_country, Verbose::Presentation fmt) +std::string Verbose::event(const KSignaling sig, const int32 obj_idx, const K3L_EVENT * const ev, const R2CountryType r2_country, const Verbose::Presentation fmt) #else -std::string Verbose::event(KSignaling sig, int32 obj_idx, K3L_EVENT *ev, Verbose::Presentation fmt) +std::string Verbose::event(const KSignaling sig, const int32 obj_idx, const K3L_EVENT * const ev, const Verbose::Presentation fmt) #endif { unsigned short int dev = (unsigned short int) ev->DeviceId; unsigned short int obj = (unsigned short int) obj_idx; - kevent code = (kevent) ev->Code; + VerboseTraits::Event code = (VerboseTraits::Event) ev->Code; - std::string buf, extra; + std::string buf; + std::string extra; switch (code) { - case K_EV_CHANNEL_FREE: - case K_EV_SEIZE_SUCCESS: - case K_EV_CALL_SUCCESS: - case K_EV_NO_ANSWER: - case K_EV_CONNECT: - case K_EV_DTMF_SEND_FINISH: - case K_EV_SEIZURE_START: - case K_EV_BILLING_PULSE: - case K_EV_REFERENCE_FAIL: + case VerboseTraits::VerboseTraits::K_EV_CHANNEL_FREE: + case VerboseTraits::VerboseTraits::K_EV_SEIZE_SUCCESS: + case VerboseTraits::VerboseTraits::K_EV_CALL_SUCCESS: + case VerboseTraits::VerboseTraits::K_EV_NO_ANSWER: + case VerboseTraits::VerboseTraits::K_EV_CONNECT: + case VerboseTraits::VerboseTraits::K_EV_DTMF_SEND_FINISH: + case VerboseTraits::VerboseTraits::K_EV_SEIZURE_START: + case VerboseTraits::VerboseTraits::K_EV_BILLING_PULSE: + case VerboseTraits::VerboseTraits::K_EV_REFERENCE_FAIL: #if K3L_AT_LEAST(1,4,0) - case K_EV_CALL_HOLD_START: - case K_EV_CALL_HOLD_STOP: + case VerboseTraits::VerboseTraits::K_EV_CALL_HOLD_START: + case VerboseTraits::VerboseTraits::K_EV_CALL_HOLD_STOP: #endif #if K3L_AT_LEAST(1,5,0) - case K_EV_NEW_CALL: + case VerboseTraits::VerboseTraits::K_EV_NEW_CALL: #endif #if K3L_AT_LEAST(1,6,0) - case K_EV_FLASH: - case K_EV_POLARITY_REVERSAL: - case K_EV_COLLECT_CALL: - case K_EV_SS_TRANSFER_FAIL: - case K_EV_RING_DETECTED: + case VerboseTraits::VerboseTraits::K_EV_FLASH: + case VerboseTraits::VerboseTraits::K_EV_POLARITY_REVERSAL: + case VerboseTraits::VerboseTraits::K_EV_COLLECT_CALL: + case VerboseTraits::VerboseTraits::K_EV_RING_DETECTED: + case VerboseTraits::VerboseTraits::K_EV_SS_TRANSFER_FAIL: #endif #if K3L_HAS_MPTY_SUPPORT - case K_EV_CALL_MPTY_START: - case K_EV_CALL_MPTY_STOP: + case VerboseTraits::VerboseTraits::K_EV_CALL_MPTY_START: + case VerboseTraits::VerboseTraits::K_EV_CALL_MPTY_STOP: #endif break; #if K3L_AT_LEAST(1,6,0) - case K_EV_RECV_FROM_MODEM: - case K_EV_SMS_INFO: - case K_EV_SMS_DATA: + case VerboseTraits::VerboseTraits::K_EV_RECV_FROM_MODEM: + case VerboseTraits::VerboseTraits::K_EV_SMS_INFO: + case VerboseTraits::VerboseTraits::K_EV_SMS_DATA: +#endif extra = "data='"; extra += (ev->Params ? (const char *)(ev->Params) : "<empty>"); extra += "'"; return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); -#endif #if K3L_AT_LEAST(1,6,0) - case K_EV_SMS_SEND_RESULT: + case VerboseTraits::VerboseTraits::K_EV_SMS_SEND_RESULT: extra = "result='"; #if K3L_AT_LEAST(2,0,0) extra += gsmSmsCause((KGsmSmsCause)ev->AddInfo); @@ -2814,20 +2609,20 @@ std::string Verbose::event(KSignaling sig, int32 obj_idx, K3L_EVENT *ev, Verbose return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); #if K3L_HAS_MPTY_SUPPORT - case K_EV_GSM_COMMAND_STATUS: + case VerboseTraits::VerboseTraits::K_EV_GSM_COMMAND_STATUS: extra = "result='"; extra += gsmMobileCause((KGsmMobileCause)ev->AddInfo); extra += "'"; return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); #endif - case K_EV_CALL_ANSWER_INFO: + case VerboseTraits::VerboseTraits::K_EV_CALL_ANSWER_INFO: extra = "info='"; extra += callStartInfo((KCallStartInfo)ev->AddInfo); extra += "'"; return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); - case K_EV_NEW_SMS: + case VerboseTraits::VerboseTraits::K_EV_NEW_SMS: if (ev->AddInfo != 0) { extra = "messages='"; @@ -2840,7 +2635,7 @@ std::string Verbose::event(KSignaling sig, int32 obj_idx, K3L_EVENT *ev, Verbose return show(buf, eventName(code), Target(CHANNEL, dev, obj)); } - case K_EV_ISDN_PROGRESS_INDICATOR: + case VerboseTraits::VerboseTraits::K_EV_ISDN_PROGRESS_INDICATOR: if (ev->AddInfo != 0) { extra = "indication='"; @@ -2854,19 +2649,19 @@ std::string Verbose::event(KSignaling sig, int32 obj_idx, K3L_EVENT *ev, Verbose } #endif - case K_EV_CAS_LINE_STT_CHANGED: + case VerboseTraits::VerboseTraits::K_EV_CAS_LINE_STT_CHANGED: extra = STG(FMT("[a=%d,b=%d,c=%d,d=%d]") % ((ev->AddInfo & 0x8) >> 3) % ((ev->AddInfo & 0x4) >> 2) % ((ev->AddInfo & 0x2) >> 1) % (ev->AddInfo & 0x1)); return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); - case K_EV_CAS_MFC_RECV: + case VerboseTraits::VerboseTraits::K_EV_CAS_MFC_RECV: extra = STG(FMT("digit='%d'") % ev->AddInfo); return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); - case K_EV_CALL_FAIL: + case VerboseTraits::VerboseTraits::K_EV_CALL_FAIL: extra = "cause='"; #if K3L_AT_LEAST(2,0,0) extra += callFail(sig, r2_country, ev->AddInfo); @@ -2887,7 +2682,7 @@ std::string Verbose::event(KSignaling sig, int32 obj_idx, K3L_EVENT *ev, Verbose return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); - case K_EV_DISCONNECT: + case VerboseTraits::VerboseTraits::K_EV_DISCONNECT: switch (sig) { #if K3L_AT_LEAST(1,5,1) @@ -2921,16 +2716,16 @@ std::string Verbose::event(KSignaling sig, int32 obj_idx, K3L_EVENT *ev, Verbose break; #if K3L_AT_LEAST(1,6,0) - case K_EV_SIP_DTMF_DETECTED: + case VerboseTraits::VerboseTraits::K_EV_SIP_DTMF_DETECTED: #endif - case K_EV_DTMF_DETECTED: - case K_EV_PULSE_DETECTED: - case K_EV_DIALED_DIGIT: + case VerboseTraits::VerboseTraits::K_EV_DTMF_DETECTED: + case VerboseTraits::VerboseTraits::K_EV_PULSE_DETECTED: + case VerboseTraits::VerboseTraits::K_EV_DIALED_DIGIT: extra = STG(FMT("digit='%c'") % (char)ev->AddInfo); return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); - case K_EV_SEIZURE: + case VerboseTraits::VerboseTraits::K_EV_SEIZURE: { KIncomingSeizeParams *n = (KIncomingSeizeParams *) ( ((char*)ev) + sizeof(K3L_EVENT) ); @@ -2945,7 +2740,7 @@ std::string Verbose::event(KSignaling sig, int32 obj_idx, K3L_EVENT *ev, Verbose } #if K3L_AT_LEAST(1,4,0) - case K_EV_VOIP_SEIZURE: + case VerboseTraits::VerboseTraits::K_EV_VOIP_SEIZURE: { char *numB = ((char*)ev) + sizeof(K3L_EVENT); char *numA = numB + 61; @@ -2961,43 +2756,43 @@ std::string Verbose::event(KSignaling sig, int32 obj_idx, K3L_EVENT *ev, Verbose #endif - case K_EV_END_OF_STREAM: + case VerboseTraits::VerboseTraits::K_EV_END_OF_STREAM: return show(buf, eventName(code), Target(PLAYER, dev, obj)); - case K_EV_AUDIO_STATUS: + case VerboseTraits::VerboseTraits::K_EV_AUDIO_STATUS: extra = "tone='"; extra += mixerTone((KMixerTone)ev->AddInfo); extra += "'"; return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); - case K_EV_CADENCE_RECOGNIZED: + case VerboseTraits::VerboseTraits::K_EV_CADENCE_RECOGNIZED: extra = STG(FMT("cadence='%c'") % (char)(ev->AddInfo)); return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); - case K_EV_CHANNEL_FAIL: + case VerboseTraits::VerboseTraits::K_EV_CHANNEL_FAIL: extra = "reason='"; extra += channelFail(sig, ev->AddInfo); extra += "'"; return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); - case K_EV_SEIZE_FAIL: + case VerboseTraits::VerboseTraits::K_EV_SEIZE_FAIL: extra = "reason='"; extra += seizeFail((KSeizeFail) ev->AddInfo); extra += "'"; return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); - case K_EV_INTERNAL_FAIL: + case VerboseTraits::VerboseTraits::K_EV_INTERNAL_FAIL: extra = "reason='"; extra += internalFail((KInternalFail) ev->AddInfo); extra += "'"; return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); - case K_EV_HARDWARE_FAIL: + case VerboseTraits::VerboseTraits::K_EV_HARDWARE_FAIL: extra = "component='"; extra += systemObject((KSystemObject) ev->AddInfo); extra += "'"; @@ -3018,18 +2813,18 @@ std::string Verbose::event(KSignaling sig, int32 obj_idx, K3L_EVENT *ev, Verbose } - case K_EV_LINK_STATUS: + case VerboseTraits::VerboseTraits::K_EV_LINK_STATUS: // EV_LINK_STATUS has always zero in ObjectInfo (and AddInfo!) /* fall throught... */ #if K3L_AT_LEAST(1,6,0) - case K_EV_PHYSICAL_LINK_UP: - case K_EV_PHYSICAL_LINK_DOWN: + case VerboseTraits::VerboseTraits::K_EV_PHYSICAL_LINK_UP: + case VerboseTraits::VerboseTraits::K_EV_PHYSICAL_LINK_DOWN: return show(buf, eventName(code), Target(LINK, dev, obj)); #endif #if K3L_AT_LEAST(1,5,1) - case K_EV_USER_INFORMATION: + case VerboseTraits::VerboseTraits::K_EV_USER_INFORMATION: { KUserInformation *info = (KUserInformation *)(ev->Params); @@ -3044,7 +2839,7 @@ std::string Verbose::event(KSignaling sig, int32 obj_idx, K3L_EVENT *ev, Verbose #endif #if K3L_AT_LEAST(1,6,0) - case K_EV_SIP_REGISTER_INFO: + case VerboseTraits::VerboseTraits::K_EV_SIP_REGISTER_INFO: extra = "params='"; extra += (ev->Params ? (const char *) (ev->Params) : "<unknown>"); extra += "',status='"; @@ -3055,28 +2850,28 @@ std::string Verbose::event(KSignaling sig, int32 obj_idx, K3L_EVENT *ev, Verbose #endif #if !K3L_AT_LEAST(2,0,0) - case K_EV_PONG: + case VerboseTraits::VerboseTraits::K_EV_PONG: #endif #if K3L_AT_LEAST(1,4,0) - case K_EV_CLIENT_RECONNECT: + case VerboseTraits::VerboseTraits::K_EV_CLIENT_RECONNECT: #endif return show(buf, eventName(code), Target(NONE)); #if K3L_AT_LEAST(2,1,0) - case K_EV_FAX_CHANNEL_FREE: + case VerboseTraits::VerboseTraits::K_EV_FAX_CHANNEL_FREE: extra = "status='"; extra += faxResult((KFaxResult)ev->AddInfo); extra += "'"; return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); - case K_EV_FAX_FILE_SENT: + case VerboseTraits::VerboseTraits::K_EV_FAX_FILE_SENT: extra = "filename='"; extra += (ev->Params ? (const char *) (ev->Params) : "<unknown>"); extra += "'"; return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); - case K_EV_FAX_FILE_FAIL: + case VerboseTraits::VerboseTraits::K_EV_FAX_FILE_FAIL: extra = "cause='"; extra += faxFileErrorCause((KFaxFileErrorCause)ev->AddInfo); extra += "',filename='"; @@ -3084,22 +2879,29 @@ std::string Verbose::event(KSignaling sig, int32 obj_idx, K3L_EVENT *ev, Verbose extra += "'"; return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); - case K_EV_FAX_REMOTE_INFO: + case VerboseTraits::VerboseTraits::K_EV_FAX_REMOTE_INFO: extra = ((ev->Params && ev->ParamSize != 0) ? (const char *) ev->Params : ""); return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); - /*case K_EV_FAX_MESSAGE_CONFIRMATION:*/ - case K_EV_FAX_PAGE_CONFIRMATION: - case K_EV_FAX_TX_TIMEOUT: + case VerboseTraits::VerboseTraits::K_EV_FAX_PAGE_CONFIRMATION: + case VerboseTraits::VerboseTraits::K_EV_FAX_TX_TIMEOUT: return show(buf, eventName(code), Target(CHANNEL, dev, obj)); #endif #if K3L_AT_LEAST(2,1,0) - case K_EV_WATCHDOG_COUNT: + case VerboseTraits::VerboseTraits::K_EV_WATCHDOG_COUNT: extra = STG(FMT("count='%d'") % (char)ev->AddInfo); return show(buf , eventName(code), Target(NONE), extra); #endif +#if K3L_AT_LEAST(2,1,0) + case VerboseTraits::VerboseTraits::K_EV_CT_TRANSFER_FAIL: + extra = "cause='"; + extra += isdnCause((KQ931Cause)ev->AddInfo); + extra += "'"; + + return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); +#endif } // default handler... @@ -3117,7 +2919,7 @@ std::string Verbose::event(KSignaling sig, int32 obj_idx, K3L_EVENT *ev, Verbose /********************************************/ -std::string Verbose::show(std::string & buf, std::string name, Target tgt, std::string & extra) +std::string Verbose::show(std::string & buf, const std::string & name, const Target tgt, const std::string & extra) { if (tgt.type == NONE) { @@ -3134,7 +2936,7 @@ std::string Verbose::show(std::string & buf, std::string name, Target tgt, std:: return buf; } -std::string Verbose::show(std::string & buf, std::string name, Target tgt) +std::string Verbose::show(std::string & buf, const std::string & name, const Target tgt) { std::string tmp(""); @@ -3142,7 +2944,7 @@ std::string Verbose::show(std::string & buf, std::string name, Target tgt) return buf; } -void Verbose::generate(std::string &buf, std::string &name, Target tgt, std::string &extra) +void Verbose::generate(std::string & buf, const std::string & name, const Target tgt, const std::string & extra) { switch (tgt.type) { diff --git a/src/mod/endpoints/mod_khomp/commons/base/verbose.hpp b/src/mod/endpoints/mod_khomp/commons/base/verbose.hpp new file mode 100644 index 0000000..a0ea290 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/base/verbose.hpp @@ -0,0 +1,303 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#ifndef _VERBOSE_HPP_ +#define _VERBOSE_HPP_ + +#include <string> +#include <sstream> +#include <map> + +#include <k3l.h> + +// k3lApiMajorVersion +#ifndef CM_PING +# include <k3lVersion.h> +# include <KTools.h> +#endif + +#include <types.hpp> +#include <k3lapi.hpp> +#include <format.hpp> + +#include <verbose_traits.hpp> + +struct Verbose +{ + typedef enum + { + R2_COUNTRY_BRA = 1, + R2_COUNTRY_ARG = 2, + R2_COUNTRY_CHI = 3, + R2_COUNTRY_MEX = 4, + R2_COUNTRY_URY = 5, + R2_COUNTRY_VEN = 6 + } + R2CountryType; + + typedef enum + { + HUMAN, + EXACT + } + Presentation; + + /* dynamic (object) stuff */ + + Verbose(const K3LAPI & api) + : _api(api) {}; + +#if K3L_AT_LEAST(2,0,0) + std::string event(const int32, const K3L_EVENT * const, + const R2CountryType r2_country = R2_COUNTRY_BRA, + const Presentation fmt = HUMAN) const; +#else + std::string event(const int32, const K3L_EVENT * const, + const Presentation fmt = HUMAN) const; +#endif + + std::string channelStatus(const int32, const int32, const int32, + const Presentation fmt = HUMAN) const; + + /* end of dynamic (object) stuff */ + + protected: + const K3LAPI & _api; + + /* used internally */ + struct internal_not_found {}; + + public: + + /* static (class) stuff */ + + static std::string echoLocation(const KEchoLocation, const Presentation fmt = HUMAN); + static std::string echoCancellerConfig(const KEchoCancellerConfig, const Presentation fmt = HUMAN); + +#if K3L_AT_LEAST(2,0,0) + static std::string event(const KSignaling, const int32, const K3L_EVENT * const, + const R2CountryType = R2_COUNTRY_BRA, Presentation fmt = HUMAN); +#else + static std::string event(const KSignaling, const int32, const K3L_EVENT * const, + const Presentation fmt = HUMAN); +#endif + +#if K3L_AT_LEAST(2,0,0) + static std::string command(const int32, const K3L_COMMAND * const, + const R2CountryType = R2_COUNTRY_BRA, + const Presentation fmt = HUMAN); + + static std::string command(const int32, const int32, const int32, const char * const, + const R2CountryType = R2_COUNTRY_BRA, + const Presentation fmt = HUMAN); +#else + static std::string command(const int32, const K3L_COMMAND * const, + const Presentation fmt = HUMAN); + + static std::string command(const int32, const int32, const int32, const char * const, + const Presentation fmt = HUMAN); +#endif + + static std::string deviceName(const KDeviceType, const int32, const int32 count = 0, const Presentation fmt = HUMAN); + static std::string deviceName(const KDeviceType, const int32, const Presentation fmt); + + static std::string deviceType(const KDeviceType, const int32 count = 0, const Presentation fmt = HUMAN); + static std::string deviceType(const KDeviceType, const Presentation fmt); + + static std::string deviceModel(const KDeviceType, const int32, const int32 count = 0, const Presentation fmt = HUMAN); + static std::string deviceModel(const KDeviceType, const int32, const Presentation fmt); + + static std::string channelFeatures(const int32, const Presentation fmt = HUMAN); + static std::string signaling(const KSignaling, const Presentation fmt = HUMAN); + static std::string systemObject(const KSystemObject, const Presentation fmt = HUMAN); + static std::string mixerTone(const KMixerTone, const Presentation fmt = HUMAN); + static std::string mixerSource(const KMixerSource, const Presentation fmt = HUMAN); + + static std::string seizeFail(const KSeizeFail, const Presentation fmt = HUMAN); + +#if K3L_AT_LEAST(2,0,0) + static std::string callFail(const KSignaling, const R2CountryType, const int32, const Presentation fmt = HUMAN); +#else + static std::string callFail(const KSignaling, const int32, const Presentation fmt = HUMAN); +#endif + + static std::string channelFail(const KSignaling, const int32, const Presentation fmt = HUMAN); + static std::string internalFail(const KInternalFail, const Presentation fmt = HUMAN); + + static std::string linkErrorCounter(const KLinkErrorCounter, const Presentation fmt = HUMAN); + + static std::string linkStatus(const KSignaling, const int32, const Presentation fmt = HUMAN, const bool simpleStatus = false); + static std::string channelStatus(const KSignaling, const int32, const Presentation fmt = HUMAN); + static std::string callStatus(const KCallStatus, const Presentation fmt = HUMAN); + static std::string status(const KLibraryStatus, const Presentation fmt = HUMAN); + +#if K3L_AT_LEAST(2,0,0) + static std::string signGroupB(const KSignGroupB, const R2CountryType contry = R2_COUNTRY_BRA, + Presentation fmt = HUMAN); +#else + static std::string signGroupB(const KSignGroupB, const Presentation fmt = HUMAN); +#endif + +#if K3L_AT_LEAST(2,0,0) + static std::string signGroupII(const KSignGroupII, const R2CountryType contry = R2_COUNTRY_BRA, + Presentation fmt = HUMAN); +#else + static std::string signGroupII(const KSignGroupII, const Presentation fmt = HUMAN); +#endif + + static std::string h100configIndex(const KH100ConfigIndex, const Presentation fmt = HUMAN); + + static std::string eventName(const int32 value) + { + return VerboseTraits::eventName((VerboseTraits::Event)value); + }; + + static std::string commandName(const int32 value) + { + return VerboseTraits::commandName((VerboseTraits::Command)value); + }; + +#if K3L_AT_LEAST(1,5,0) + static std::string sipFailures(const KSIP_Failures, const Presentation fmt = HUMAN); +#endif + +#if K3L_AT_LEAST(1,5,1) + static std::string isdnCause(const KQ931Cause, const Presentation fmt = HUMAN); +#endif + +#if K3L_AT_LEAST(1,5,2) + static std::string isdnDebug(const int32, const Presentation fmt = HUMAN); +#endif + +#if K3L_AT_LEAST(1,6,0) + static std::string callStartInfo(const KCallStartInfo, const Presentation fmt = HUMAN); + + static std::string gsmCallCause(const KGsmCallCause, const Presentation fmt = HUMAN); + static std::string gsmMobileCause(const KGsmMobileCause, const Presentation fmt = HUMAN); + static std::string gsmSmsCause(const KGsmSmsCause, const Presentation fmt = HUMAN); + + static std::string q931ProgressIndication(const KQ931ProgressIndication, + Presentation fmt = HUMAN); +#endif + +#if K3L_AT_LEAST(2,1,0) + static std::string faxResult(const KFaxResult code, const Presentation fmt = HUMAN); + static std::string faxFileErrorCause(const KFaxFileErrorCause code, const Presentation fmt = HUMAN); +#endif + + /* end of static (class) stuff */ + + private: + static std::string internal_deviceType(const KDeviceType, const int32); + static std::string internal_deviceModel(const KDeviceType, const int32, const int32); + +#if K3L_AT_LEAST(1,5,0) + static std::string internal_sipFailures(const KSIP_Failures, const Presentation fmt = HUMAN); +#endif +#if K3L_AT_LEAST(1,5,1) + static std::string internal_isdnCause(const KQ931Cause, const Presentation fmt = HUMAN); +#endif + +#if K3L_AT_LEAST(2,0,0) + static std::string internal_signGroupB(const KSignGroupB, const R2CountryType contry, const Presentation fmt = HUMAN); + static std::string internal_signGroupII(const KSignGroupII, const R2CountryType contry, const Presentation fmt = HUMAN); +#else + static std::string internal_signGroupB(const KSignGroupB, const Presentation fmt = HUMAN); + static std::string internal_signGroupII(const KSignGroupII, const Presentation fmt = HUMAN); +#endif + +#if K3L_AT_LEAST(1,6,0) + static std::string internal_gsmCallCause(const KGsmCallCause, const Presentation fmt = HUMAN); + static std::string internal_gsmMobileCause(const KGsmMobileCause, const Presentation fmt = HUMAN); + static std::string internal_gsmSmsCause(const KGsmSmsCause, const Presentation fmt = HUMAN); + + static std::string internal_q931ProgressIndication(const KQ931ProgressIndication, const Presentation fmt = HUMAN); +#endif + + private: + enum Type + { + DEVICE, + CHANNEL, + PLAYER, + MIXER, + LINK, + NONE + }; + + struct Target + { + Target(Type _type) + : type(_type), device(-1), object(-1) + {}; + + Target(Type _type, int32 _device) + : type(_type), device(_device), object(-1) + {}; + + Target(Type _type, int32 _device, int32 _object) + : type(_type), device(_device), object(_object) + {}; + + const Type type; + const int32 device; + const int32 object; + }; + + static void generate(std::string &, const std::string &, const Target, const std::string &); + + static std::string show(std::string &, const std::string &, const Target, const std::string &); + static std::string show(std::string &, const std::string &, const Target); + + template < typename ReturnType > + static ReturnType presentation(const Presentation fmt, ReturnType str_exact, ReturnType str_human) + { + switch (fmt) + { + case HUMAN: return str_human; + case EXACT: return str_exact; + }; + + return str_exact; + } +}; + +#endif /* _VERBOSE_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/config_options.cpp b/src/mod/endpoints/mod_khomp/commons/config_options.cpp deleted file mode 100644 index 5383855..0000000 --- a/src/mod/endpoints/mod_khomp/commons/config_options.cpp +++ /dev/null @@ -1,710 +0,0 @@ -/* - KHOMP generic endpoint/channel library. - Copyright (C) 2007-2009 Khomp Ind. & Com. - - The contents of this file are subject to the Mozilla Public License Version 1.1 - (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.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" basis, - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - the specific language governing rights and limitations under the License. - - Alternatively, the contents of this file may be used under the terms of the - "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which - case the provisions of "LGPL License" are applicable instead of those above. - - If you wish to allow use of your version of this file only under the terms of - the LGPL License and not to allow others to use your version of this file under - the MPL, indicate your decision by deleting the provisions above and replace them - with the notice and other provisions required by the LGPL License. If you do not - delete the provisions above, a recipient may use your version of this file under - either the MPL or the LGPL License. - - The LGPL header follows below: - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this library; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -*/ - -#include <config_options.hpp> - -ConfigOption::ConfigOption(std::string name, const ConfigOption::StringType & value, const ConfigOption::StringType defvalue, string_allowed_type allowed, bool list_me) -: _my_name(name), _value_data(new StringData(const_cast<StringType &>(value), defvalue, allowed), true), - _list_me(list_me), _values(NULL), _loaded(false) -{}; - -ConfigOption::ConfigOption(std::string name, const ConfigOption::StringType & value, const ConfigOption::StringType defvalue, bool list_me) -: _my_name(name), _value_data(new StringData(const_cast<StringType &>(value), defvalue, string_allowed_type()), true), - _list_me(list_me), _values(NULL), _loaded(false) -{}; - -ConfigOption::ConfigOption(std::string name, const ConfigOption::SignedIntType & value, const ConfigOption::SignedIntType defvalue, - ConfigOption::SignedIntType min, ConfigOption::SignedIntType max, ConfigOption::SignedIntType step, bool list_me) -: _my_name(name), _value_data(new SignedIntData(const_cast<SignedIntType &>(value), defvalue, Range<SignedIntType>(min, max, step)), true), - _list_me(list_me), _values(NULL), _loaded(false) -{}; - -ConfigOption::ConfigOption(std::string name, const ConfigOption::UnsignedIntType & value, const ConfigOption::UnsignedIntType defvalue, - ConfigOption::UnsignedIntType min, ConfigOption::UnsignedIntType max, ConfigOption::UnsignedIntType step, bool list_me) -: _my_name(name), _value_data(new UnsignedIntData(const_cast<UnsignedIntType &>(value), defvalue, Range<UnsignedIntType>(min, max, step)), true), - _list_me(list_me), _values(NULL), _loaded(false) -{}; - -ConfigOption::ConfigOption(std::string name, const ConfigOption::BooleanType & value, const ConfigOption::BooleanType defvalue, bool list_me) -: _my_name(name), _value_data(new BooleanData(const_cast<BooleanType &>(value), defvalue), true), - _list_me(list_me), _values(NULL), _loaded(false) -{}; - -ConfigOption::ConfigOption(std::string name, ConfigOption::FunctionType fun, std::string defvalue, string_allowed_type allowed, bool list_me) -: _my_name(name), _value_data(new FunctionData(fun, defvalue, allowed), true), - _list_me(list_me), _values(NULL), _loaded(false) -{}; - -ConfigOption::ConfigOption(std::string name, ConfigOption::FunctionType fun, std::string defvalue, bool list_me) -: _my_name(name), _value_data(new FunctionData(fun, defvalue, string_allowed_type()), true), - _list_me(list_me), _values(NULL), _loaded(false) -{}; - -ConfigOption::ConfigOption(const ConfigOption & o) -: _my_name(o._my_name), _value_data(o._value_data), - _list_me(o._list_me), _values(o._values), _loaded(o._loaded) -{}; - -ConfigOption::~ConfigOption(void) -{ - if (_values) - { - for (unsigned int i = 0; _values[i] != NULL; i++) - delete _values[i]; - - delete[] _values; - _values = NULL; - } -}; - -void ConfigOption::set(ConfigOption::StringType value) -{ - switch (_value_data.which()) - { - case ID_STRING: - { - try - { - StringData & tmp = _value_data.get<StringData>(); - - if (tmp.string_allowed.empty()) - { - tmp.string_val = value; - _loaded = true; - } - else - { - if (tmp.string_allowed.find(value) != tmp.string_allowed.end()) - { - tmp.string_val = value; - _loaded = true; - return; - } - - std::string allowed_string; - - for (string_allowed_type::iterator i = tmp.string_allowed.begin(); i != tmp.string_allowed.end(); i++) - { - allowed_string += " '"; - allowed_string += (*i); - allowed_string += "'"; - } - - throw ConfigProcessFailure(STG(FMT("value '%s' not allowed for option '%s' (allowed values:%s)") - % value % _my_name % allowed_string)); - } - break; - } - catch(ValueType::InvalidType & e) - { - throw; - } - } - - case ID_FUN: - { - try - { - FunctionData & tmp = _value_data.get<FunctionData>(); - tmp.fun_val(value); - _loaded = true; - break; - } - catch(ValueType::InvalidType & e) - { - throw; - } - - } - - default: - { - throw ConfigProcessFailure(STG(FMT("option '%s' is not of type string, nor function defined") % _my_name)); - } - } -} - -void ConfigOption::set(ConfigOption::SignedIntType value) -{ - try - { - SignedIntData & tmp = _value_data.get<SignedIntData>(); - - if (value < tmp.sint_Range.minimum) - throw ConfigProcessFailure(STG(FMT("value '%d' out-of-Range for option '%s' (too low)") % value % _my_name)); - - if (value > tmp.sint_Range.maximum) - throw ConfigProcessFailure(STG(FMT("value '%d' out-of-Range for option '%s' (too high)") % value % _my_name)); - - if (((value - tmp.sint_Range.minimum) % tmp.sint_Range.step) != 0) - throw ConfigProcessFailure(STG(FMT("value '%d' out-of-Range for option '%s' (outside allowed step)") % value % _my_name)); - - tmp.sint_val = value; - _loaded = true; - } - catch(ValueType::InvalidType & e) - { - throw; - } -} - -void ConfigOption::set(ConfigOption::UnsignedIntType value) -{ - try - { - UnsignedIntData & tmp = _value_data.get<UnsignedIntData>(); - - if (value < tmp.uint_Range.minimum) - throw ConfigProcessFailure(STG(FMT("value '%d' out-of-Range for option '%s' (too low)") % value % _my_name)); - - if (value > tmp.uint_Range.maximum) - throw ConfigProcessFailure(STG(FMT("value '%d' out-of-Range for option '%s' (too high)") % value % _my_name)); - - if (((value - tmp.uint_Range.minimum) % tmp.uint_Range.step) != 0) - throw ConfigProcessFailure(STG(FMT("value '%d' out-of-Range for option '%s' (outside allowed step)") % value % _my_name)); - - tmp.uint_val = value; - _loaded = true; - } - catch(ValueType::InvalidType & e) - { - throw; - } -} - -void ConfigOption::set(ConfigOption::BooleanType value) -{ - try - { - BooleanData & tmp = _value_data.get<BooleanData>(); - tmp.bool_val = value; - _loaded = true; - } - catch(ValueType::InvalidType & e) - { - throw; - } -} - -std::string & ConfigOption::name(void) { return _my_name; }; - -ConfigOption::value_id_type ConfigOption::type(void) -{ - return (value_id_type) _value_data.which(); -}; - -const char ** ConfigOption::values(void) -{ - if (_values != NULL) - return _values; - - switch ((value_id_type) _value_data.which()) - { - case ConfigOption::ID_BOOL: - { - _values = new const char*[3]; - - _values[0] = strdup("yes"); - _values[1] = strdup("no"); - _values[2] = NULL; - - return _values; - } - - case ConfigOption::ID_SINT: - { - try - { - SignedIntData & tmp = _value_data.get<SignedIntData>(); - - - unsigned int count = ((tmp.sint_Range.maximum - tmp.sint_Range.minimum) / tmp.sint_Range.step) + 1; - unsigned int index = 0; - - _values = new const char*[count + 1]; - - for (SignedIntType i = tmp.sint_Range.minimum; i <= tmp.sint_Range.maximum; i += tmp.sint_Range.step, index++) - _values[index] = strdup(STG(FMT("%d") % i).c_str()); - - _values[index] = NULL; - - return _values; - } - catch(ValueType::InvalidType & e) - { - throw; - } - } - - case ConfigOption::ID_UINT: - { - try - { - UnsignedIntData & tmp = _value_data.get<UnsignedIntData>(); - - unsigned int count = ((tmp.uint_Range.maximum - tmp.uint_Range.minimum) / tmp.uint_Range.step) + 1; - unsigned int index = 0; - - _values = new const char*[count + 1]; - - for (UnsignedIntType i = tmp.uint_Range.minimum; i <= tmp.uint_Range.maximum; i += tmp.uint_Range.step, index++) - _values[index] = strdup(STG(FMT("%d") % i).c_str()); - - _values[index] = NULL; - - return _values; - } - catch(ValueType::InvalidType & e) - { - throw; - } - } - - case ConfigOption::ID_STRING: - { - try - { - StringData & tmp = _value_data.get<StringData>(); - - _values = new const char*[ tmp.string_allowed.size() + 1 ]; - - unsigned int index = 0; - - for (string_allowed_type::iterator i = tmp.string_allowed.begin(); i != tmp.string_allowed.end(); i++, index++) - _values[index] = strdup((*i).c_str()); - - _values[index] = NULL; - - return _values; - } - catch(ValueType::InvalidType & e) - { - throw; - } - } - - case ConfigOption::ID_FUN: - { - try - { - FunctionData & tmp = _value_data.get<FunctionData>(); - - _values = new const char*[ tmp.fun_allowed.size() + 1 ]; - - unsigned int index = 0; - - for (string_allowed_type::iterator i = tmp.fun_allowed.begin(); i != tmp.fun_allowed.end(); i++, index++) - _values[index] = strdup((*i).c_str()); - - _values[index] = NULL; - return _values; - } - catch(ValueType::InvalidType & e) - { - throw; - } - - } - - default: - throw ConfigProcessFailure(STG(FMT("unknown type identifier '%d'") % _value_data.which())); - } -}; - -void ConfigOption::reset(void) -{ - _loaded = false; -}; - -void ConfigOption::commit(void) -{ - if (_loaded) - return; - - switch ((value_id_type) _value_data.which()) - { - case ConfigOption::ID_BOOL: - { - try - { - BooleanData & tmp = _value_data.get<BooleanData>(); - tmp.bool_val = tmp.bool_default; - } - catch(ValueType::InvalidType & e) - { - throw; - } - - break; - } - - case ConfigOption::ID_SINT: - { - try - { - SignedIntData & tmp = _value_data.get<SignedIntData>(); - tmp.sint_val = tmp.sint_default; - } - catch(ValueType::InvalidType & e) - { - throw; - } - break; - } - - case ConfigOption::ID_UINT: - { - try - { - UnsignedIntData & tmp = _value_data.get<UnsignedIntData>(); - tmp.uint_val = tmp.uint_default; - } - catch(ValueType::InvalidType & e) - { - throw; - } - break; - } - - case ConfigOption::ID_STRING: - { - try - { - StringData & tmp = _value_data.get<StringData>(); - tmp.string_val = tmp.string_default; - } - catch(ValueType::InvalidType & e) - { - throw; - } - break; - } - - case ConfigOption::ID_FUN: - { - try - { - FunctionData & tmp = _value_data.get<FunctionData>(); - tmp.fun_val(tmp.fun_default); - } - catch(ValueType::InvalidType & e) - { - throw; - } - break; - } - - default: - throw ConfigProcessFailure(STG(FMT("unknown type identifier '%d'") % _value_data.which())); - } - - _loaded = true; -}; - -void ConfigOption::copy_from(ConfigOption & src) -{ - if (src._value_data.which() != _value_data.which()) - throw ConfigProcessFailure(STG(FMT("unable to copy options, source type differs from destination."))); - - if (!src._loaded) - return; - - switch ((value_id_type) _value_data.which()) - { - case ConfigOption::ID_BOOL: - { - try - { - BooleanData & stmp = src._value_data.get<BooleanData>(); - BooleanData & dtmp = _value_data.get<BooleanData>(); - /* do not copy references, but values.. */ - bool tmpval = stmp.bool_val; - dtmp.bool_val = tmpval; - } - catch(ValueType::InvalidType & e) - { - throw; - } - - break; - } - - case ConfigOption::ID_SINT: - { - try - { - SignedIntData & stmp = src._value_data.get<SignedIntData>(); - SignedIntData & dtmp = _value_data.get<SignedIntData>(); - /* do not copy references, but values.. */ - int tmpval = stmp.sint_val; - dtmp.sint_val = tmpval; - } - catch(ValueType::InvalidType & e) - { - throw; - } - - break; - } - - case ConfigOption::ID_UINT: - { - try - { - UnsignedIntData & stmp = src._value_data.get<UnsignedIntData>(); - UnsignedIntData & dtmp = _value_data.get<UnsignedIntData>(); - /* do not copy references, but values.. */ - unsigned int tmpval = stmp.uint_val; - dtmp.uint_val = tmpval; - } - catch(ValueType::InvalidType & e) - { - throw; - } - - - break; - } - - case ConfigOption::ID_STRING: - { - try - { - StringData & stmp = src._value_data.get<StringData>(); - StringData & dtmp = _value_data.get<StringData>(); - /* do not copy references, but values.. */ - std::string tmpval = stmp.string_val; - dtmp.string_val = tmpval; - } - catch(ValueType::InvalidType & e) - { - throw; - } - - break; - } - - case ConfigOption::ID_FUN: - { - /* TO IMPLEMENT (NEEDS ANOTHER METHOD ON FUNCTION FOR GETTING VALUE) */ - -// FunctionData & tmp = boost::get<FunctionData>(_value_data); -// -// if (!tmp.loaded) -// { -// tmp.fun_val(tmp.fun_default); -// tmp.loaded = true; -// } - break; - } - - default: - throw ConfigProcessFailure(STG(FMT("unknown type identifier '%d'") % _value_data.which())); - } - - _loaded = true; -}; - -/*********************************/ - -bool ConfigOptions::add(ConfigOption option) -{ - //option_map_type::iterator iter2 = _map.begin(); - - //boost::tie(iter2, ok2) - std::pair<option_map_type::iterator, bool> ret = _map.insert(option_pair_type(option.name(), option)); - - return ret.second; -} - -bool ConfigOptions::synonym(std::string equiv_opt, std::string main_opt) -{ - //syn_option_map_type::iterator iter = _syn_map.begin(); - - //boost::tie(iter, ok) - std::pair<syn_option_map_type::iterator, bool> ret = _syn_map.insert(syn_option_pair_type(equiv_opt, main_opt)); - - return ret.second; -} - -ConfigOptions::string_set ConfigOptions::options(void) -{ - string_set res; - - for (option_map_type::iterator i = _map.begin(); i != _map.end(); i++) - res.insert((*i).first); - - return res; -} - -void ConfigOptions::process(const char * name, const char * value) -{ - option_map_type::iterator iter = find_option(name); - - if (iter == _map.end()) - throw ConfigProcessFailure(STG(FMT("unknown option '%s'") % name)); - - try - { - switch ((*iter).second.type()) - { - case ConfigOption::ID_SINT: - set<ConfigOption::SignedIntType>((*iter).first, Strings::toulong(value)); - return; - case ConfigOption::ID_UINT: - set<ConfigOption::UnsignedIntType>((*iter).first, Strings::tolong(value)); - return; - case ConfigOption::ID_BOOL: - set<ConfigOption::BooleanType>((*iter).first, Strings::toboolean(value)); - return; - case ConfigOption::ID_STRING: - case ConfigOption::ID_FUN: - set<ConfigOption::StringType>((*iter).first, std::string(value)); - return; - default: - throw ConfigProcessFailure(STG(FMT("unknown type identifier '%d'") % (*iter).second.type())); - } - } - catch (Strings::invalid_value & e) - { - throw ConfigProcessFailure(STG(FMT("invalid value '%s' for option '%s'") % value % name)); - } -} - -const char ** ConfigOptions::values(const char * name) -{ - option_map_type::iterator iter = find_option(name); - - if (iter == _map.end()) - throw ConfigProcessFailure(STG(FMT("unknown option '%s'") % name)); - - return (*iter).second.values(); -} - -const char ** ConfigOptions::values(void) -{ - if (_values != NULL) - return _values; - - unsigned int count = 0; - - for (option_map_type::iterator i = _map.begin(); i != _map.end(); i++) - if ((*i).second.list_me()) - ++count; - - _values = new const char*[ count + 1 ]; - - unsigned int index = 0; - - for (option_map_type::iterator i = _map.begin(); i != _map.end(); i++) - { - if ((*i).second.list_me()) - { - _values[index] = strdup((*i).first.c_str()); - ++index; - } - } - - _values[index] = NULL; - - return _values; -} - -void ConfigOptions::reset(void) -{ - for (option_map_type::iterator i = _map.begin(); i != _map.end(); i++) - (*i).second.reset(); -} - -ConfigOptions::messages_type ConfigOptions::commit(void) -{ - messages_type msgs; - - for (option_map_type::iterator i = _map.begin(); i != _map.end(); i++) - { - try - { - (*i).second.commit(); - } - catch (ConfigProcessFailure & e) - { - msgs.push_back(e.msg); - } - } - - return msgs; -} - -bool ConfigOptions::loaded(std::string name) -{ - option_map_type::iterator iter = find_option(name); - - if (iter == _map.end()) - return false; - - return iter->second.loaded(); -} - -void ConfigOptions::copy_from(ConfigOptions & source, std::string name) -{ - option_map_type::iterator iter_src = source.find_option(name); - option_map_type::iterator iter_dst = find_option(name); - - if (iter_src == source._map.end()) - throw ConfigProcessFailure(STG(FMT("unknown option '%s' on source") % name)); - - if (iter_dst == _map.end()) - throw ConfigProcessFailure(STG(FMT("unknown option '%s' on destination") % name)); - - iter_dst->second.copy_from(iter_src->second); -} - -ConfigOptions::option_map_type::iterator ConfigOptions::find_option(std::string name) -{ - syn_option_map_type::iterator syn_iter = _syn_map.find(name); - - if (syn_iter != _syn_map.end()) - name = syn_iter->second; - - option_map_type::iterator iter = _map.find(name); - - return iter; -} diff --git a/src/mod/endpoints/mod_khomp/commons/config_options.hpp b/src/mod/endpoints/mod_khomp/commons/config_options.hpp deleted file mode 100644 index 3cfe2e1..0000000 --- a/src/mod/endpoints/mod_khomp/commons/config_options.hpp +++ /dev/null @@ -1,286 +0,0 @@ -/* - KHOMP generic endpoint/channel library. - Copyright (C) 2007-2009 Khomp Ind. & Com. - - The contents of this file are subject to the Mozilla Public License Version 1.1 - (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.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" basis, - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - the specific language governing rights and limitations under the License. - - Alternatively, the contents of this file may be used under the terms of the - "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which - case the provisions of "LGPL License" are applicable instead of those above. - - If you wish to allow use of your version of this file only under the terms of - the LGPL License and not to allow others to use your version of this file under - the MPL, indicate your decision by deleting the provisions above and replace them - with the notice and other provisions required by the LGPL License. If you do not - delete the provisions above, a recipient may use your version of this file under - either the MPL or the LGPL License. - - The LGPL header follows below: - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this library; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -*/ - -#include <set> -#include <map> -#include <vector> - -#include <strings.hpp> - -#include <function.hpp> -#include <variant.hpp> -#include <format.hpp> - -#ifndef _CONFIG_OPTIONS_HPP_ -#define _CONFIG_OPTIONS_HPP_ - -struct ConfigProcessFailure -{ - ConfigProcessFailure(std::string _msg): msg(_msg) {}; - std::string msg; -}; - -struct ConfigOption -{ - typedef int SignedIntType; - typedef unsigned int UnsignedIntType; - typedef bool BooleanType; - typedef std::string StringType; - - typedef Function::Function1 < void, std::string > FunctionType; - - typedef std::set < StringType > string_allowed_type; - - /* this should reflect 'variant.which()'! */ - typedef enum - { - ID_SINT = 0, - ID_UINT = 1, - ID_BOOL = 2, - ID_STRING = 3, - ID_FUN = 4, - } - value_id_type; - - template < typename number_type > - struct Range - { - Range(number_type _minimum, number_type _maximum, number_type _step) - : minimum(_minimum), maximum(_maximum), step(_step) {}; - - number_type minimum, maximum, step; - }; - - struct SignedIntData : public VariantBaseType < void > - { - SignedIntData(SignedIntType & _sint_val, SignedIntType _sint_default, Range< SignedIntType > _sint_Range) - : sint_val(_sint_val), sint_default(_sint_default), sint_Range(_sint_Range) {}; - - int which() - { - return ID_SINT; - } - - SignedIntType & sint_val; - SignedIntType sint_default; - Range<SignedIntType> sint_Range; - }; - - struct UnsignedIntData : public VariantBaseType < void > - { - UnsignedIntData(UnsignedIntType & _uint_val, UnsignedIntType _uint_default, Range< UnsignedIntType > _uint_Range) - : uint_val(_uint_val), uint_default(_uint_default), uint_Range(_uint_Range) {}; - - int which() - { - return ID_UINT; - } - - UnsignedIntType & uint_val; - UnsignedIntType uint_default; - Range<UnsignedIntType> uint_Range; - }; - - struct BooleanData : public VariantBaseType < void > - { - BooleanData(BooleanType & _bool_val, BooleanType _bool_default) - : bool_val(_bool_val), bool_default(_bool_default) {}; - - int which() - { - return ID_BOOL; - } - - BooleanType & bool_val; - BooleanType bool_default; - }; - - struct StringData : public VariantBaseType < void > - { - StringData(std::string & _string_val, std::string _string_default, string_allowed_type _string_allowed) - : string_val(_string_val), string_default(_string_default), string_allowed(_string_allowed) {}; - - int which() - { - return ID_STRING; - } - - std::string & string_val; - std::string string_default; - string_allowed_type string_allowed; - }; - - struct FunctionData : public VariantBaseType < void > - { - FunctionData(FunctionType _fun_val, std::string _fun_default, string_allowed_type _fun_allowed) - : fun_val(_fun_val), fun_default(_fun_default), fun_allowed(_fun_allowed) {}; - - int which() - { - return ID_FUN; - } - - FunctionType fun_val; - std::string fun_default; - string_allowed_type fun_allowed; - }; - - - typedef Variant < VariantBaseType < void > > ValueType; - - ConfigOption(std::string, const StringType &, const StringType, string_allowed_type allowed, bool list_me = true); - ConfigOption(std::string, const StringType &, const StringType = "", bool list_me = true); - ConfigOption(std::string, const SignedIntType &, const SignedIntType = 0, SignedIntType min = -INT_MAX, SignedIntType max = INT_MAX, SignedIntType step = 1, bool list_me = true); - ConfigOption(std::string, const UnsignedIntType &, const UnsignedIntType = 0, UnsignedIntType min = 0, UnsignedIntType max = UINT_MAX, UnsignedIntType step = 1, bool list_me = true); - ConfigOption(std::string, const BooleanType &, const BooleanType = false, bool list_me = true); - ConfigOption(std::string, FunctionType, std::string defvalue, string_allowed_type allowed, bool list_me = true); - ConfigOption(std::string, FunctionType, std::string defvalue = "", bool list_me = true); - - ConfigOption(const ConfigOption & o); - - ~ConfigOption(void); - - void set(StringType value); - - void set(SignedIntType value); - void set(UnsignedIntType value); - void set(BooleanType value); - - BooleanType get_bool(){ return _value_data.get<BooleanData>().bool_val; } - std::string get_str(){ return _value_data.get<StringData>().string_val; } - SignedIntType get_sint(){ return _value_data.get<SignedIntData>().sint_val; } - UnsignedIntType get_uint(){ return _value_data.get<UnsignedIntData>().uint_val; } - - std::string & name(void); - value_id_type type(void); - - const char ** values(void); - - void reset(void); - void commit(void); - - bool list_me(void) { return _list_me; }; - bool loaded(void) { return _loaded; }; - - void copy_from(ConfigOption &); - - protected: - std::string _my_name; - ValueType _value_data; - - bool _list_me; - const char ** _values; - bool _loaded; -}; - -struct ConfigOptions -{ - typedef std::vector < std::string > messages_type; - - ConfigOptions(void): _values(NULL) {}; - - typedef std::set < std::string > string_set; - - typedef std::map < std::string, ConfigOption > option_map_type; - typedef std::pair < std::string, ConfigOption > option_pair_type; - - typedef std::map < std::string, std::string > syn_option_map_type; - typedef std::pair < std::string, std::string > syn_option_pair_type; - - bool add(ConfigOption option); - - /* only valid in "process" (for backwards compatibility config files) */ - bool synonym(std::string, std::string); - - template <typename ValueType> - void set(std::string name, ValueType value) - { - option_map_type::iterator iter = _map.find(name); - - if (iter == _map.end()) - throw ConfigProcessFailure(STG(FMT("unknown option: %s") % name)); - - (*iter).second.set(value); - } - - std::string get(std::string name) - { - option_map_type::iterator iter = _map.find(name); - - if (iter == _map.end()) - throw ConfigProcessFailure(STG(FMT("unknown option: %s") % name)); - - switch((*iter).second.type()) - { - case ConfigOption::ID_BOOL: return (*iter).second.get_bool() ? "yes" : "no"; - case ConfigOption::ID_STRING: return (*iter).second.get_str(); - case ConfigOption::ID_UINT: return STG(FMT("%d") % (*iter).second.get_uint()); - case ConfigOption::ID_SINT: return STG(FMT("%d") % (*iter).second.get_sint()); - case ConfigOption::ID_FUN: return ""; - } - } - - string_set options(void); - - void process(const char *, const char *); /* process option from file */ - - void reset(void); /* reset loaded opts */ - messages_type commit(void); /* set defaults */ - - const char ** values(const char *); /* option value */ - const char ** values(void); /* values from options */ - - bool loaded(std::string); /* return if config was loaded */ - - void copy_from(ConfigOptions &, std::string); - - protected: - option_map_type::iterator find_option(std::string); - - protected: - option_map_type _map; - syn_option_map_type _syn_map; - - const char ** _values; -}; - -#endif /* _CONFIG_OPTIONS_HPP_ */ - diff --git a/src/mod/endpoints/mod_khomp/commons/configurator/configfile.cpp b/src/mod/endpoints/mod_khomp/commons/configurator/configfile.cpp deleted file mode 100644 index 6aa2e59..0000000 --- a/src/mod/endpoints/mod_khomp/commons/configurator/configfile.cpp +++ /dev/null @@ -1,241 +0,0 @@ -/* - KHOMP generic endpoint/channel library. - Copyright (C) 2007-2009 Khomp Ind. & Com. - - The contents of this file are subject to the Mozilla Public License Version 1.1 - (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.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" basis, - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - the specific language governing rights and limitations under the License. - - Alternatively, the contents of this file may be used under the terms of the - "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which - case the provisions of "LGPL License" are applicable instead of those above. - - If you wish to allow use of your version of this file only under the terms of - the LGPL License and not to allow others to use your version of this file under - the MPL, indicate your decision by deleting the provisions above and replace them - with the notice and other provisions required by the LGPL License. If you do not - delete the provisions above, a recipient may use your version of this file under - either the MPL or the LGPL License. - - The LGPL header follows below: - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this library; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -*/ -#include <errno.h> - -#include <configurator/configfile.hpp> - -#if _MSC_VER >= 1400 -#undef close -#endif - -void Configfile::ignore(std::string str) -{ - _ignores.insert(str); -}; - -bool Configfile::select(Section **ptr, std::string str) -{ - /* default section == this! */ - *ptr = this; - - /* always success by default */ - return true; -}; - -bool Configfile::adjust(Section * section, std::string & opt, std::string & val) -{ - return section->load(opt, val); -}; - -bool Configfile::deserialize(std::ifstream& fd) -{ - Section * section = NULL; - - /* default selection! */ - if (!select(§ion)) - { - _errors.push_back("default selection has failed!"); - return false; - } - - size_t count = 0; - - while (fd.good()) - { - std::string str; - - /* read one line! */ - std::getline(fd, str); - - size_t lst = str.size() - 1; - - if (str.size() >= 1 && str[lst] == '\r') //cuida das quebras de linha do tipo \r\n - { - str.erase(lst,1); - --lst; - } - - /* empty line! */ - if (str.size() == 0) - continue; - - /* comment! */ - if (str[0] == '#') - continue; - - ++count; - - if (str[0] == '[' && str[lst] == ']') - { - str.erase(0,1); --lst; - str.erase(lst,1); --lst; - - if (!select(§ion, str)) - { - _errors.push_back(STG(FMT("erroneous section '%s'") % str)); - - /* ignore this section */ - section = NULL; - continue; - } - } - else - { - std::string::size_type pos = str.find('='); - - if (pos == std::string::npos) - { - _errors.push_back(STG(FMT("erroneous separator '%s'") % str)); - continue; - }; - - if (section == NULL) - { - _errors.push_back(STG(FMT("no section for option '%s'") % str)); - continue; - } - - std::string opt(str.substr(0,pos)); - std::string val(str.substr(pos+1)); - - if (_ignores.find(opt) != _ignores.end()) - continue; - - if (val == "@") val = ""; - - if (adjust(section, opt, val)) - continue; - - _errors.push_back(STG(FMT("option '%s' does " - "not exist or '%s' is not a valid value (at section '%s')") - % opt % val % section->name())); - } - } - - // retorna 'true' se arquivo tinha alguma coisa valida. - return (count != 0); -} - -bool Configfile::obtain() -{ - std::ifstream fd(_filename.c_str()); - - if (!fd.is_open()) - { - _errors.push_back(STG(FMT("unable to open file '%s': %s") - % _filename % strerror(errno))); - return false; - }; - - if (!deserialize(fd)) - { - fd.close(); - return false; - } - - fd.close(); - return true; -}; - -void Configfile::recurse(std::ofstream& fd, Section * section) -{ - typedef Section::SectionMap::iterator section_iter; - typedef Section::OptionMap::iterator option_iter; - - for (option_iter i = section->option_begin(); i != section->option_end(); i++) - { - std::string res; - - if ((*i).second.store(res)) - { - if (res == "") res = "@"; - fd << (*i).first << "=" << res << std::endl; - } - } - - if (!section->recursive()) - return; - - for (section_iter j = section->section_begin(); j != section->section_end(); j++) - recurse(fd, (*j).second); -} - -bool Configfile::serialize(std::ofstream& fd) -{ - recurse(fd, this); - return true; -} - -bool Configfile::provide() -{ - std::string tmp(_filename); - tmp += ".new"; - - std::ofstream fd(tmp.c_str()); - - if (!fd.good()) - { - _errors.push_back(STG(FMT("unable to open file '%s': %s") - % tmp % strerror(errno))); - return false; - } - - if (!serialize(fd)) - { - fd.close(); - return false; - } - - fd.close(); - - if (rename(tmp.c_str(), _filename.c_str()) != 0) - { - _errors.push_back(STG(FMT("unable to replace config file '%s': %s") - % _filename % strerror(errno))); - return false; - } - - return true; -} - -#if _MSC_VER >= 1400 -#define close _close -#endif \ No newline at end of file diff --git a/src/mod/endpoints/mod_khomp/commons/configurator/option.cpp b/src/mod/endpoints/mod_khomp/commons/configurator/option.cpp deleted file mode 100644 index 083883e..0000000 --- a/src/mod/endpoints/mod_khomp/commons/configurator/option.cpp +++ /dev/null @@ -1,185 +0,0 @@ -/* - KHOMP generic endpoint/channel library. - Copyright (C) 2007-2009 Khomp Ind. & Com. - - The contents of this file are subject to the Mozilla Public License Version 1.1 - (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.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" basis, - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - the specific language governing rights and limitations under the License. - - Alternatively, the contents of this file may be used under the terms of the - "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which - case the provisions of "LGPL License" are applicable instead of those above. - - If you wish to allow use of your version of this file only under the terms of - the LGPL License and not to allow others to use your version of this file under - the MPL, indicate your decision by deleting the provisions above and replace them - with the notice and other provisions required by the LGPL License. If you do not - delete the provisions above, a recipient may use your version of this file under - either the MPL or the LGPL License. - - The LGPL header follows below: - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this library; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -*/ - -#include <configurator/option.hpp> - -bool Option::equals(std::string & value) -{ - switch (_restriction.numeral()) - { - case Restriction::N_UNIQUE: - { - Restriction::Value my_value; - - if (!_restriction.get(Restriction::F_USER, my_value)) - return false; - - return (my_value == value); - } - case Restriction::N_MULTIPLE: - { - Restriction::Vector my_values; - - if (!_restriction.get(Restriction::F_USER, my_values)) - return false; - - for (Restriction::Vector::iterator i = my_values.begin(); i != my_values.end(); i++) - { - if ((*i) == value) - return true; - } - - return false; - } - } - - return false; -} - -bool Option::load(std::string & value) -{ - bool ret = _restriction.set(Restriction::F_FILE, value); - - if (ret) _modified = false; - - return ret; -} - -bool Option::change(std::string & value) -{ - bool ret = _restriction.set(Restriction::F_FILE, value); - - if (ret) _modified = true; - - return ret; -} - -bool Option::store(std::string & value) -{ - switch (_restriction.numeral()) - { - case Restriction::N_UNIQUE: - return _restriction.get(Restriction::F_FILE, value); - - case Restriction::N_MULTIPLE: - { - Restriction::Vector values; - - if (!_restriction.get(Restriction::F_FILE, values)) - return false; - - Strings::Merger strs; - - for (Restriction::Vector::iterator i = values.begin(); i != values.end(); i++) - strs.add(*i); - - value = strs.merge(","); - - return true; - } - - default: - return false; - } -} - -Option::Flags Option::set(const char * value) -{ - std::string str_value(value); - return set(str_value); -} - - -Option::Flags Option::set(Restriction::Value & value) -{ - Restriction::Value last_value, curr_value; - Flags flags; - - bool ret1 = _restriction.get(Restriction::F_USER, last_value); - - if (!_restriction.set(Restriction::F_USER, value)) - return flags; - - flags[F_ADJUSTED] = true; - - bool ret2 = _restriction.get(Restriction::F_USER, curr_value); - - if (!ret1 || (ret2 && (last_value != curr_value))) - { - flags[F_MODIFIED] = true; - _modified = true; - } - - return flags; -} - -Option::Flags Option::set(Restriction::Vector & values) -{ - Restriction::Vector last_values, curr_values; - Flags flags; - - bool ret1 = _restriction.get(Restriction::F_USER, last_values); - - if (!_restriction.set(Restriction::F_USER, values)) - return flags; - - flags[F_ADJUSTED] = true; - - bool ret2 = _restriction.get(Restriction::F_USER, curr_values); - - if (!ret1 || (ret2 && (last_values != curr_values))) - { - flags[F_MODIFIED] = true; - _modified = true; - } - - return flags; -} - -bool Option::get(Restriction::Value & value) -{ - return _restriction.get(Restriction::F_USER, value); -} - -bool Option::get(Restriction::Vector & values) -{ - return _restriction.get(Restriction::F_USER, values); -} diff --git a/src/mod/endpoints/mod_khomp/commons/configurator/restriction.cpp b/src/mod/endpoints/mod_khomp/commons/configurator/restriction.cpp deleted file mode 100644 index 9653a7c..0000000 --- a/src/mod/endpoints/mod_khomp/commons/configurator/restriction.cpp +++ /dev/null @@ -1,353 +0,0 @@ -/* - KHOMP generic endpoint/channel library. - Copyright (C) 2007-2009 Khomp Ind. & Com. - - The contents of this file are subject to the Mozilla Public License Version 1.1 - (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.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" basis, - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - the specific language governing rights and limitations under the License. - - Alternatively, the contents of this file may be used under the terms of the - "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which - case the provisions of "LGPL License" are applicable instead of those above. - - If you wish to allow use of your version of this file only under the terms of - the LGPL License and not to allow others to use your version of this file under - the MPL, indicate your decision by deleting the provisions above and replace them - with the notice and other provisions required by the LGPL License. If you do not - delete the provisions above, a recipient may use your version of this file under - either the MPL or the LGPL License. - - The LGPL header follows below: - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this library; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -*/ - -#include <math.h> -#include <string.h> - -#include <iostream> -#include <strings.hpp> - -#include <configurator/restriction.hpp> - -/* internal helper! */ -bool Restriction::equalNumber(const double a, const double b) -{ - char tmp1[64]; - char tmp2[64]; - - snprintf(tmp1, sizeof(tmp1), "%.3f", a); - snprintf(tmp2, sizeof(tmp2), "%.3f", b); - - if (strncmp(tmp1, tmp2, sizeof(tmp1))) - return false; - - return true; -} - -/* process value to our internal representation */ - -bool Restriction::process(Restriction::Format fmt, - const Restriction::Value & value, Restriction::Value & final) -{ - switch (_bounds) - { - case B_RANGE: - { - if (_kind != K_NUMBER) - return false; - - std::string tmpvalue; - - Restriction::Value::const_iterator itr = value.begin(); - Restriction::Value::const_iterator end = value.end(); - - tmpvalue.reserve(value.size()); - - // f*cking dot/comma notation! - for (; itr != end; ++itr) - tmpvalue += ((*itr) != ',' ? (*itr) : '.'); - - try - { - double newvalue = Strings::todouble(tmpvalue); - - if (newvalue < _init && newvalue > _fini) - return false; - - double res = (newvalue - _init) / _step; - - if (!equalNumber(res, rint(res))) - return false; - - final = value; - return true; - } - catch (...) - { - return false; - } - } - - case B_LIST: - for (List::iterator i = _list.begin(); i != _list.end(); i++) - { - Value & tmp = (*i); - - if (tmp == value) - { - final = value; - return true; - } - } - return false; - - case B_MAPS: - switch (fmt) - { - case F_USER: - { - Map::iterator i = _map_from_usr.find(std::string(value)); - - if (i == _map_from_usr.end()) - return false; - - Value & tmp = (*i).second; - - final = tmp; - return true; - } - - case F_FILE: - { - Map::iterator i = _map_from_cfg.find(std::string(value)); - - if (i == _map_from_cfg.end()) - return false; - - final = value; - return true; - } - - default: - break; - } - return false; - - case B_FREE: - final = value; - return true; - - default: - break; - } - - return false; -} - -/* unprocess the value (outputs the external representation) */ - -bool Restriction::unprocess(Restriction::Format fmt, - const Restriction::Value & value, Restriction::Value & final) -{ - switch (_bounds) - { - case B_MAPS: - - switch (fmt) - { - case F_USER: - { - Map::iterator i = _map_from_cfg.find(std::string(value)); - - if (i == _map_from_cfg.end()) - return false; - - final = (*i).second; - return true; - } - default: - break; - } - - default: - final = value; - return true; - } -} - -/***************************** *****************************/ - -bool Restriction::get(Restriction::Format fmt, Restriction::Value & value) -{ - if (_numeral != N_UNIQUE) - return false; - - if (!unprocess(fmt, _value._unique, value)) - return false; - - return true; -} - -bool Restriction::get(Restriction::Format fmt, Restriction::Vector & values) -{ - if (_numeral != N_MULTIPLE) - return false; - - List & my_values = _value._multiple; - - for (List::iterator i = my_values.begin(); i != my_values.end(); i++) - { - Value & value = (*i); - Value final; - - if (!unprocess(fmt, value, final)) - return false; - - values.push_back(final); - }; - - return true; -} - -/***************************** *****************************/ - -bool Restriction::set(Restriction::Format fmt, Restriction::Value &value) -{ - switch (_numeral) - { - case N_UNIQUE: - { - Value final; - - if (!process(fmt, value, final)) - return false; - - _value._unique = final; - return true; - } - - case N_MULTIPLE: - { - if (value == "@" || value == "#" || value == "") - { - _value._multiple.clear(); - return true; - } - - Strings::vector_type values; - Strings::tokenize(value, values, ","); - - return set(fmt, values); - } - - default: - return false; - } -} - -bool Restriction::set(Restriction::Format fmt, Restriction::Vector & values) -{ - if (_numeral != N_MULTIPLE) - return false; - - if (values.empty()) - { - _value._multiple.clear(); - } - else - { - /* list needed to store temporary values */ - List finals; - - for (Vector::iterator i = values.begin(); i != values.end(); i++) - { - Value & value = (*i); - Value final; - - if (!process(fmt, value, final)) - return false; - - finals.push_back(final); - } - - List & lst = _value._multiple; - - /* need to clear values set before */ - lst.clear(); - - for (List::iterator i = finals.begin(); i != finals.end(); i++) - { - Value value = (*i); - lst.push_back(value); - } - }; - - return true; -} - -/***************************** *****************************/ - -void Restriction::allowed(Restriction::Vector &vals) -{ - switch (_bounds) - { - case B_FREE: - return; - - case B_LIST: - for (List::iterator i = _list.begin(); i != _list.end(); i++) - vals.push_back((*i)); - break; - - case B_MAPS: - for (Map::iterator i = _map_from_usr.begin(); i != _map_from_usr.end(); i++) - vals.push_back((*i).first); - break; - - case B_RANGE: - { - if (_kind != K_NUMBER) - return; - - // is there any fraction? - bool has_fraction = (!equalNumber(_init, rint(_init))) || (!equalNumber(_fini, rint(_fini))) || (!equalNumber(_step, rint(_step))); - - const char * format = (has_fraction ? "%.2f" : "%02.0f"); - - for (double i = _init; i <= _fini; i += _step) - { - char tmp[32]; - snprintf(tmp, sizeof(tmp), format, i); - vals.push_back(std::string(tmp)); - } - break; - } - - default: - break; - } -} - -void Restriction::init_class() -{ - _value._unique.clear(); - _value._multiple.clear(); -} diff --git a/src/mod/endpoints/mod_khomp/commons/configurator/restriction.hpp b/src/mod/endpoints/mod_khomp/commons/configurator/restriction.hpp deleted file mode 100644 index 0815ede..0000000 --- a/src/mod/endpoints/mod_khomp/commons/configurator/restriction.hpp +++ /dev/null @@ -1,321 +0,0 @@ -/* - KHOMP generic endpoint/channel library. - Copyright (C) 2007-2009 Khomp Ind. & Com. - - The contents of this file are subject to the Mozilla Public License Version 1.1 - (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.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" basis, - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - the specific language governing rights and limitations under the License. - - Alternatively, the contents of this file may be used under the terms of the - "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which - case the provisions of "LGPL License" are applicable instead of those above. - - If you wish to allow use of your version of this file only under the terms of - the LGPL License and not to allow others to use your version of this file under - the MPL, indicate your decision by deleting the provisions above and replace them - with the notice and other provisions required by the LGPL License. If you do not - delete the provisions above, a recipient may use your version of this file under - either the MPL or the LGPL License. - - The LGPL header follows below: - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this library; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -*/ - -#include <stdarg.h> - -#include <string> -#include <list> -#include <vector> -#include <map> - -#ifndef _CONFIG_RESTRICTION_HPP_ -#define _CONFIG_RESTRICTION_HPP_ - -struct Restriction -{ - /* generic types */ - enum Format - { - F_USER, - F_FILE - }; - - enum Kind - { -// K_INTEGER, -// K_FLOAT, - K_STRING, - K_NUMBER // = K_INTEGER // compatibility - }; - - enum Bounds - { - B_FREE, - B_RANGE, - B_LIST, - B_MAPS - }; - - enum Numeral - { - N_UNIQUE, - N_MULTIPLE - }; - - typedef std::string Value; - - /* types used for data input */ - struct Pair - { - const char *pretty; - const char *value; - }; - - typedef std::pair < Value, Value > PairMap; - typedef std::list < PairMap > ListMap; - - /* types used internally */ - typedef std::map < Value, Value > Map; - typedef std::vector < Value > Vector; - - typedef std::list < Value > List; - typedef std::pair < Value, Value > MapPair; - - struct Generic - { - Value _unique; - List _multiple; - }; - - Restriction(Kind kind, Numeral num) - : _kind(kind), _bounds(B_FREE), _numeral(num), _unit(""), - _init(-1), _fini(-1), _step(-1) - { - init_class(); - } - -/* - Restriction(Kind kind, Numeral num, - int init, int fini, int step = 1) - : _kind(kind), _bounds(B_RANGE), _numeral(num), _unit(unit), - _iinit(init), _ifini(fini), _istep(step), - _finit(-1), _ffini(-1), _fstep(-1) - { - init_class(); - } - - Restriction(Kind kind, Numeral num, - const char *unit, int init, int fini, int step = 1) - : _kind(kind), _bounds(B_RANGE), _numeral(num), _unit(unit), - _iinit(init), _ifini(fini), _istep(step), - _finit(-1), _ffini(-1), _fstep(-1) - { - init_class(); - } - - Restriction(Kind kind, Numeral num, - std::string unit, int init, int fini, int step = 1) - : _kind(kind), _bounds(B_RANGE), _numeral(num), _unit(unit), - _iinit(init), _ifini(fini), _istep(step), - _finit(-1), _ffini(-1), _fstep(-1) - { - init_class(); - } - - Restriction(Kind kind, Numeral num, - float init, float fini, float step = 1) - : _kind(kind), _bounds(B_RANGE), _numeral(num), _unit(unit), - _iinit(-1), _ifini(-1), _istep(-1) - _finit(init), _ffini(fini), _fstep(step), - { - init_class(); - } - - Restriction(Kind kind, Numeral num, - const char *unit, float init, float fini, float step = 1.0) - : _kind(kind), _bounds(B_RANGE), _numeral(num), _unit(unit), - _iinit(-1), _ifini(-1), _istep(-1) - _finit(init), _ffini(fini), _fstep(step), - { - init_class(); - } - - Restriction(Kind kind, Numeral num, - std::string unit, float init, float fini, float step = 1.0) - : _kind(kind), _bounds(B_RANGE), _numeral(num), _unit(unit), - _iinit(-1), _ifini(-1), _istep(-1) - _finit(init), _ffini(fini), _fstep(step), - { - init_class(); - } -*/ - - Restriction(Kind kind, Numeral num, - double init, double fini, double step = 1) - : _kind(kind), _bounds(B_RANGE), _numeral(num), _unit(""), - _init(init), _fini(fini), _step(step) - { - init_class(); - } - - Restriction(Kind kind, Numeral num, - const char *unit, double init, double fini, double step = 1.0) - : _kind(kind), _bounds(B_RANGE), _numeral(num), _unit(unit), - _init(init), _fini(fini), _step(step) - { - init_class(); - } - - Restriction(Kind kind, Numeral num, - std::string unit, double init, double fini, double step = 1.0) - : _kind(kind), _bounds(B_RANGE), _numeral(num), _unit(unit), - _init(init), _fini(fini), _step(step) - { - init_class(); - } - - Restriction(Kind kind, Numeral num, - const char *first, ...) - : _kind(kind), _bounds(B_LIST), _numeral(num), _unit(""), - _init(-1), _fini(-1), _step(-1) - { - _list.push_back(std::string(first)); - - va_list ap; - va_start(ap, first); - - while (true) - { - const char *arg = va_arg(ap, const char *); - - if (arg == NULL) break; - - _list.push_back(std::string(arg)); - } - - init_class(); - } - - Restriction(Kind kind, const char *unit, Numeral num, - const char *first, ...) - : _kind(kind), _bounds(B_LIST), _numeral(num), _unit(unit), - _init(-1), _fini(-1), _step(-1) - { - _list.push_back(std::string(first)); - - va_list ap; - va_start(ap, first); - - while (true) - { - const char *arg = va_arg(ap, const char *); - - if (arg == NULL) break; - - _list.push_back(std::string(arg)); - } - - init_class(); - } - - Restriction(Kind kind, Numeral num, - const struct Pair first, ...) - : _kind(kind), _bounds(B_MAPS), _numeral(num), _unit(""), - _init(-1), _fini(-1), _step(-1) - { - _map_from_usr.insert(MapPair(Value(first.pretty), Value(first.value))); - _map_from_cfg.insert(MapPair(Value(first.value), Value(first.pretty))); - - va_list ap; - va_start(ap, first); - - while (true) - { - Pair arg = va_arg(ap, Pair); - - if (arg.pretty == NULL) break; - - _map_from_usr.insert(MapPair(Value(arg.pretty), Value(arg.value))); - _map_from_cfg.insert(MapPair(Value(arg.value), Value(arg.pretty))); - } - - init_class(); - } - - Restriction(Kind kind, Numeral num, List list) - : _kind(kind), _bounds(B_LIST), _numeral(num), _unit(""), - _init(-1), _fini(-1), _step(-1), _list(list) - { - init_class(); - } - - Restriction(Kind kind, Numeral num, ListMap map) - : _kind(kind), _bounds(B_MAPS), _numeral(num), _unit(""), - _init(-1), _fini(-1), _step(-1) - { - for (ListMap::iterator i = map.begin(); i != map.end(); i++) - { - _map_from_usr.insert(MapPair(Value((*i).first), Value((*i).second))); - _map_from_cfg.insert(MapPair(Value((*i).second), Value((*i).first))); - } - - init_class(); - } - - Kind kind() { return _kind; }; - Bounds bounds() { return _bounds; }; - Numeral numeral() { return _numeral; }; - - Value unit() { return _unit; }; - - bool set(Format, Vector &); - bool set(Format, Value &); - - bool get(Format, Vector &); - bool get(Format, Value &); - - void allowed(Vector &); - - private: - bool process(Format, const Value &, Value &); - bool unprocess(Format, const Value &, Value &); - void init_class(); - - bool equalNumber(const double, const double); - - protected: - Kind _kind; - Bounds _bounds; - Numeral _numeral; - - Value _unit; - - double _init, _fini, _step; - - Map _map_from_usr, - _map_from_cfg; - - List _list; - - Generic _value; -}; - -#endif /* _CONFIG_RESTRICTION_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/configurator/section.hpp b/src/mod/endpoints/mod_khomp/commons/configurator/section.hpp deleted file mode 100644 index fdb7823..0000000 --- a/src/mod/endpoints/mod_khomp/commons/configurator/section.hpp +++ /dev/null @@ -1,226 +0,0 @@ -/* - KHOMP generic endpoint/channel library. - Copyright (C) 2007-2009 Khomp Ind. & Com. - - The contents of this file are subject to the Mozilla Public License Version 1.1 - (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.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" basis, - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - the specific language governing rights and limitations under the License. - - Alternatively, the contents of this file may be used under the terms of the - "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which - case the provisions of "LGPL License" are applicable instead of those above. - - If you wish to allow use of your version of this file only under the terms of - the LGPL License and not to allow others to use your version of this file under - the MPL, indicate your decision by deleting the provisions above and replace them - with the notice and other provisions required by the LGPL License. If you do not - delete the provisions above, a recipient may use your version of this file under - either the MPL or the LGPL License. - - The LGPL header follows below: - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this library; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -*/ - -#include <string> -#include <vector> -#include <map> -#include <algorithm> -#include <iostream> - -#include <configurator/option.hpp> - -#ifndef _CONFIG_SECTION_HPP_ -#define _CONFIG_SECTION_HPP_ - -struct Section -{ - typedef std::map < std::string, Option > OptionMap; - typedef std::vector< Option * > OptionVector; - - typedef std::map < std::string, Section * > SectionMap; - typedef std::vector < Section * > SectionVector; - - struct not_found {}; /* exception */ - -// protected: - Section(std::string name, std::string desc, bool recursive = true) - : _name(name), _description(desc), _recursive(recursive) {}; - - void add(Option o) - { - _options.insert(std::pair<std::string,Option>(o.name(), o)); - }; - - void del(std::string name) - { - _options.erase(name); - }; - - void add(Section *s) - { - _sections.insert(std::pair<std::string,Section*>(s->name(), s)); - }; - - public: - const std::string & name() { return _name; }; - const std::string & description() { return _description; }; - const bool & recursive() { return _recursive; }; - - OptionMap::iterator option_begin() { return _options.begin(); }; - OptionMap::iterator option_end() { return _options.end(); }; - - SectionMap::iterator section_begin() { return _sections.begin(); }; - SectionMap::iterator section_end() { return _sections.end(); }; - - /**/ - - Option * option_find(const char *, bool recurse = false); - Section * section_find(const char *, bool recurse = false); - - Option * option_find(std::string &, bool recurse = false); - Section * section_find(std::string &, bool recurse = false); - - /**/ - - void options(OptionVector &); - void sections(SectionVector &); - - /**/ - - template <typename F> - bool search_and_apply(std::string &key, std::string &value, F f) - { - OptionMap::iterator i = _options.find(key); - - if (i != _options.end()) - return f((*i).second); - - if (!_recursive) - return false; - - return (find_if(_sections.begin(), _sections.end(), f) != _sections.end()); - } - - private: - struct key_value - { - key_value(std::string &k, std::string &v): _k(k), _v(v) {}; - std::string & _k, & _v; - }; - - struct load_section: protected key_value - { - load_section(std::string &k, std::string &v): key_value(k,v) {}; - - bool operator()(Option &o) { return o.load(_v); }; - bool operator()(SectionMap::value_type &v) { return v.second->load(_k,_v); }; - }; - - struct change_section: protected key_value - { - change_section(std::string &k, std::string &v): key_value(k,v) {}; - - bool operator()(Option &o) { return o.change(_v); }; - bool operator()(SectionMap::value_type &v) { return v.second->change(_k,_v); }; - }; - - struct store_section: protected key_value - { - store_section(std::string &k, std::string &v): key_value(k,v) {}; - - bool operator()(Option &o) { return o.store(_v); }; - bool operator()(SectionMap::value_type &v) { return v.second->store(_k,_v); }; - }; - - struct set_section: protected key_value - { - set_section(std::string &k, std::string &v): key_value(k,v) {}; - - bool operator()(Option &o) { return (o.set(_v))[Option::F_ADJUSTED]; }; - bool operator()(SectionMap::value_type &v) { return v.second->set(_k,_v); }; - }; - - struct get_section: protected key_value - { - get_section(std::string &k, std::string &v): key_value(k,v) {}; - - bool operator()(Option &o) { return o.get(_v); }; - bool operator()(SectionMap::value_type &v) { return v.second->get(_k,_v); }; - }; - - struct modified_section - { - bool operator()(OptionMap::value_type &v) { return v.second.modified(); }; - bool operator()(SectionMap::value_type &v) { return v.second->modified(); }; - }; - - public: - bool load(const char * key, std::string value) - { - std::string skey(key); - return search_and_apply(skey, value, load_section(skey, value)); - } - - bool load(std::string &key, std::string &value) - { - return search_and_apply(key, value, load_section(key, value)); - } - - bool change(std::string &key, std::string &value) - { - return search_and_apply(key, value, change_section(key, value)); - } - - bool store(std::string &key, std::string &value) - { - return search_and_apply(key, value, store_section(key, value)); - } - - bool set(std::string &key, std::string &value) - { - return search_and_apply(key, value, set_section(key, value)); - } - - bool get(std::string &key, std::string &value) - { - return search_and_apply(key, value, get_section(key, value)); - } - - bool modified() - { - return ((find_if(_options.begin(), _options.end(), modified_section()) != _options.end()) || - (find_if(_sections.begin(), _sections.end(), modified_section()) != _sections.end())); - } - - private: - Section() {}; - - protected: - std::string _name; - std::string _description; - - OptionMap _options; - SectionMap _sections; - - bool _recursive; -}; - -#endif /* _CONFIG_SECTION_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/ringbuffer.cpp b/src/mod/endpoints/mod_khomp/commons/ringbuffer.cpp deleted file mode 100644 index 428bd29..0000000 --- a/src/mod/endpoints/mod_khomp/commons/ringbuffer.cpp +++ /dev/null @@ -1,575 +0,0 @@ -/* - KHOMP generic endpoint/channel library. - Copyright (C) 2007-2009 Khomp Ind. & Com. - - The contents of this file are subject to the Mozilla Public License Version 1.1 - (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.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" basis, - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - the specific language governing rights and limitations under the License. - - Alternatively, the contents of this file may be used under the terms of the - "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which - case the provisions of "LGPL License" are applicable instead of those above. - - If you wish to allow use of your version of this file only under the terms of - the LGPL License and not to allow others to use your version of this file under - the MPL, indicate your decision by deleting the provisions above and replace them - with the notice and other provisions required by the LGPL License. If you do not - delete the provisions above, a recipient may use your version of this file under - either the MPL or the LGPL License. - - The LGPL header follows below: - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this library; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -*/ - -#include <ringbuffer.hpp> - -/********** BUFFER FUNCTIONS **********/ - -/* writes everything or nothing */ -bool Ringbuffer_traits::traits_provide(char * buffer, const char * value, unsigned int amount, bool skip_overwrite) -{ - /* avoid using different values */ - Buffer_table cache = _pointers; - - const unsigned int reader = cache.reader.complete; - const unsigned int writer = cache.writer.complete; - - const unsigned int dest = cache.writer.complete - 1; - - const bool reader_less = cache.reader.complete < cache.writer.complete; - - if (amount >= _size) - return false; - - bool ret = true; - - /* should we go around the buffer for writing? */ - if (((writer + amount) > _size) && (reader_less || !skip_overwrite)) - { - /* Documentation of the formula used in the 'if' below. - * - * [0|1|2|3|4|5|6|7] => size=8 - * | | - * reader | - * writer - * - * => writer has places [5,6,7,0,1] to write (5 places). - * - * => 8 - (4-2+1) = 8 - (2+1) = 8 - 3 = 5 - * - * > writer goes 1 up, amount goes 1 down. - * > reader goes 1 up, amount goes 1 up. - * > size goes 1 down, amount goes 1 down. - * - */ - - if ((_size - (writer - reader + 1)) <= amount) - { - if (skip_overwrite) - return false; - - do - { - Buffer_pointer extra(cache.reader); - extra.complete = (extra.complete + amount) % _size; - - if (update(cache.reader, extra)) - break; - } - while (true); - - ret = false; - } - - unsigned int wr1 = _size - writer + 1; /* writer is already 1 position after */ - unsigned int wr2 = amount - wr1; - -// fprintf(stderr, "%p> partial write: (%d/%d) %d/%d [%d/%d]\n", this, wr1, wr2, amount, _size, reader, writer); - - /* two partial writes (one at the end, another at the beginning) */ - memcpy((void *) &(buffer[dest]), (const void *) (value), _block * wr1); - memcpy((void *) (buffer), (const void *) &(value[wr1]), _block * wr2); - } - else - { - if (!reader_less && ((reader - writer) <= amount)) - { - if (skip_overwrite) - return false; - - do - { - Buffer_pointer extra(cache.reader); - extra.complete = (extra.complete + amount) % _size; - - if (update(cache.reader, extra)) - break; - } - while (true); - - ret = false; - } - -// fprintf(stderr, "%p> full write: a=%d/s=%d [r=%d/w=%d]\n", this, amount, _size, reader, writer); - - /* we are talking about buffers here, man! */ - memcpy((void *) &(buffer[dest]), (const void *) value, _block * amount); - } - - _pointers.writer.complete = ((dest + amount) % _size) + 1; - _pointers.writer.partial = 1; - -// fprintf(stderr, "%p> write end: %d [block=%d]\n", this, writer, _block); - - return ret; -} - -/* returns the number of itens that have been read */ -unsigned int Ringbuffer_traits::traits_consume(const char * buffer, char * value, unsigned int amount, bool atomic_mode) -{ - /* avoid using different values */ - Buffer_table cache = _pointers; - - const unsigned int writer = _pointers.writer.complete; - const unsigned int reader = _pointers.reader.complete; - - const bool writer_less = writer < reader; - - unsigned int total = 0; - - /* should we go around the buffer for reading? */ - if (writer_less && (reader + amount >= _size)) - { - total = std::min(_size - (reader - writer + 1), amount); - - if ((total == 0) || (atomic_mode && (total < amount))) - return 0; - - unsigned int rd1 = _size - reader; - unsigned int rd2 = total - rd1; - -// fprintf(stderr, "%p> partial read: (%d/%d) %d/%d [%d/%d]\n", this, rd1, rd2, total, _size, reader, writer); - - /* two partial consumes (one at the end, another at the beginning) */ - memcpy((void *) (value), (const void *) &(buffer[reader]), _block * rd1); - memcpy((void *) &(value[rd1]), (const void *) (buffer), _block * rd2); - } - else - { - total = std::min((!writer_less ? writer - (reader + 1) : amount), amount); - - if ((total == 0) || (atomic_mode && (total < amount))) - return 0; - -// fprintf(stderr, "%p> full read: %d/%d [%d/%d]\n", this, total, _size, reader, writer); - - /* we are talking about buffers here, man! */ - memcpy((void *) value, (const void *) &(buffer[reader]), _block * total); - } - - do - { - /* jump the reader forward */ - Buffer_pointer index((cache.reader.complete + total) % _size); - - if (update(cache.reader, index)) - break; - } - while (true); - -// fprintf(stderr, "%p> read end: %d [block=%d]\n", this, reader, _block); - - return total; -} - -/********** TWO-PHASE BUFFER FUNCTIONS ***********/ - -/* returns the number of itens that have been read */ -unsigned int Ringbuffer_traits::traits_consume_begins(const char * buffer, char * value, unsigned int amount, bool atomic_mode) -{ - Buffer_table cache = _pointers; - - /* avoid using different values */ - const unsigned int reader = cache.reader.complete; - const unsigned int writer = cache.writer.complete; - - const bool writer_less = writer < reader; - - unsigned int total = 0; - - /* should we go around the buffer for reading? */ - if (writer_less && (reader + amount >= _size)) - { - total = std::min(_size - (reader - writer + 1), amount); - - if ((total == 0) || (atomic_mode && (total < amount))) - return 0; - - unsigned int rd1 = _size - reader; - unsigned int rd2 = total - rd1; - -// fprintf(stderr, "%p> partial read: (%d/%d) %d/%d [%d/%d]\n", this, rd1, rd2, total, _size, reader, writer); - - /* two partial consumes (one at the end, another at the beginning) */ - memcpy((void *) (value), (const void *) &(buffer[reader]), _block * rd1); - memcpy((void *) &(value[rd1]), (const void *) (buffer), _block * rd2); - } - else - { - total = std::min((!writer_less ? writer - (reader + 1) : amount), amount); - - if ((total == 0) || (atomic_mode && (total < amount))) - return 0; - -// fprintf(stderr, "%p> full read: %d/%d [%d/%d]\n", this, total, _size, reader, writer); - - /* we are talking about buffers here, man! */ - memcpy((void *) value, (const void *) &(buffer[reader]), _block * total); - } - -// fprintf(stderr, "%p> read end: %d [%d]\n", this, _reader, _reader_partial); - - return total; -} - -bool Ringbuffer_traits::traits_consume_commit(unsigned int amount) -{ - /* avoid using different values */ - Buffer_table cache = _pointers; - - const unsigned int writer = cache.writer.complete; - const unsigned int reader = cache.reader.complete; - - const bool writer_less = writer < reader; - - unsigned int total = 0; - - /* should we go around the buffer for reading? */ - if (writer_less && (reader + amount >= _size)) - { - total = std::min(_size - (reader - writer + 1), amount); - - if (total < amount) - return false; - -// fprintf(stderr, "%p> partial read: (%d/%d) %d/%d [%d/%d]\n", this, rd1, rd2, total, _size, reader, writer); - } - else - { - total = std::min((!writer_less ? writer - (reader + 1) : amount), amount); - - if (total < amount) - return false; - -// fprintf(stderr, "%p> full read: %d/%d [%d/%d]\n", this, total, _size, reader, writer); - } - - do - { - /* jump the reader forward */ - Buffer_pointer index(cache.reader); - index.complete = (index.complete + total) % _size; - - if (update(cache.reader, index)) - break; - } - while (true); - -// fprintf(stderr, "%p> read end: %d [%d]\n", this, _reader, _reader_partial); - - return true; -} - -/********** PARTIAL BUFFER FUNCTIONS (bytes) ***********/ - -/* writes everything or nothing */ -bool Ringbuffer_traits::traits_provide_partial(char * buffer, const char * value, unsigned int amount) -{ - /* avoid using different values */ - Buffer_table cache = _pointers; - - const unsigned int reader = (cache.reader.complete * _block) + cache.reader.partial; - const unsigned int writer = ((cache.writer.complete - 1) * _block) + cache.writer.partial; - - const unsigned int size = _size * _block; - const unsigned int dest = writer - 1; - -// fprintf(stderr, "%p> provide partial: %d/%d [%d/%d]\n", this, reader, writer, amount, size); - - const bool reader_less = reader < writer; - - /* should we go around the buffer for writing? */ - if (reader_less && ((writer + amount) > size)) - { - /* Documentation of the formula used in the 'if' below. - * - * [0|1|2|3|4|5|6|7] => size=8 - * | | - * reader | - * writer - * - * => writer has places [5,6,7,0,1] to write (5 places). - * - * => 8 - (4-2+1) = 8 - (2+1) = 8 - 3 = 5 - * - * > writer goes 1 up, amount goes 1 down. - * > reader goes 1 up, amount goes 1 up. - * > size goes 1 down, amount goes 1 down. - * - */ - - if ((size - (writer - reader + 1)) <= amount) - return false; - - unsigned int wr1 = size - writer + 1; /* writer is already 1 position after */ - unsigned int wr2 = amount - wr1; - -// fprintf(stderr, "%p> p partial write: (%d/%d) %d/%d [%d/%d]\n", this, wr1, wr2, amount, size, reader, writer); - - /* two partial writes (one at the end, another at the beginning) */ - memcpy((void *) &(buffer[dest]), (const void *) (value), wr1); - memcpy((void *) (buffer), (const void *) &(value[wr1]), wr2); - } - else - { - if (!reader_less && ((reader - writer) <= amount)) - return false; - -// fprintf(stderr, "%p> p full write: %d/%d [r=%d/w=%d]\n", this, amount, size, reader, writer); - - /* we are talking about buffers here, man! */ - memcpy((void *) &(buffer[dest]), (const void *) value, amount); - } - - unsigned int new_writer = ((dest + amount) % size) + 1; - - /* update "full length position" */ - _pointers.writer.complete = (unsigned int)floor((double) new_writer / (double)_block)+1; - _pointers.writer.partial = (unsigned short)(new_writer % _block); - -// fprintf(stderr, "%p> p write end: %d [block=%d]\n", this, new_writer, _block); - - return true; -} - -/* returns the number of bytes that have been read */ -unsigned int Ringbuffer_traits::traits_consume_partial(const char * buffer, char * value, unsigned int amount) -{ - /* avoid using different values */ - Buffer_table cache = _pointers; - - const unsigned int writer = ((cache.writer.complete - 1) * _block) + cache.writer.partial; - const unsigned int reader = (cache.reader.complete * _block) + cache.reader.partial; - - const unsigned int size = _size * _block; - -// fprintf(stderr, "%p> consume partial: %d/%d [%d/%d]\n", this, reader, writer, amount, size); - - const bool writer_less = writer < reader; - - unsigned int total = 0; - - /* should we go around the buffer for reading? */ - if (writer_less && (reader + amount >= size)) - { - total = std::min(size - (reader - writer + 1), amount); - - if (total == 0) - return 0; - - unsigned int rd1 = size - reader; - unsigned int rd2 = total - rd1; - -// fprintf(stderr, "%p> p partial read: (%d/%d) %d/%d [%d/%d]\n", this, rd1, rd2, total, size, reader, writer); - - /* two partial consumes (one at the end, another at the beginning) */ - memcpy((void *) (value), (const void *) &(buffer[reader]), rd1); - memcpy((void *) &(value[rd1]), (const void *) (buffer), rd2); - } - else - { - total = std::min((writer_less ? amount : writer - (reader + 1)), amount); - - if (total == 0) - return 0; - -// fprintf(stderr, "%p> p full read: %d/%d [r=%d/w=%d]\n", this, total, size, reader, writer); - - /* we are talking about buffers here, man! */ - memcpy((void *) value, (const void *) &(buffer[reader]), total); - } - - do - { - unsigned int new_reader = (((cache.reader.complete * _block) + cache.reader.partial) + total) % size; - - /* jump the reader forward */ - Buffer_pointer index((unsigned int)floor((double)new_reader / (double)_block), - (unsigned short)(new_reader % _block)); - - if (update(cache.reader, index)) - { -// fprintf(stderr, "%p> p read end: %d [block=%d]\n", this, new_reader, _block); - break; - } - } - while (true); - - return total; -} - - - -/********** IO FUNCTIONS **********/ - -/* returns the number of items written to from buffer to stream */ -unsigned int Ringbuffer_traits::traits_put(const char * buffer, std::ostream &fd, unsigned int amount) -{ - /* avoid using different values */ - Buffer_table cache = _pointers; - - const unsigned int reader = cache.reader.complete; - const unsigned int writer = cache.writer.complete; - - const bool writer_less = writer < reader; - - unsigned int total = 0; - - /* should we go around the buffer for reading? */ - if (writer_less && (reader + amount >= _size)) - { - total = std::min(_size - (reader - writer + 1), amount); - - if (total == 0) - return 0; - - unsigned int rd1 = _size - reader; - unsigned int rd2 = total - rd1; - -// fprintf(stderr, "%p> partial read: (%d/%d) %d/%d [%d/%d]\n", this, rd1, rd2, total, _size, reader, writer); - - /* two partial consumes (one at the end, another at the beginning) */ - fd.write((const char *) &(buffer[reader]), _block * rd1); - fd.write((const char *) (buffer), _block * rd2); - } - else - { - total = std::min((!writer_less ? writer - (reader + 1) : amount), amount); - - if (total == 0) - return 0; - -// fprintf(stderr, "%p> full read: %d/%d [%d/%d]\n", this, total, _size, reader, writer); - - /* we are talking about buffers here, man! */ - fd.write((const char *) &(buffer[reader]), _block * total); - } - - do - { - /* jump the reader forward */ - Buffer_pointer index(cache.reader); - index.complete = (index.complete + total) % _size; - - if (update(cache.reader, index)) - break; - } - while (true); - - return total; -} - -/* returns number of items read from stream to buffer */ -unsigned int Ringbuffer_traits::traits_get(char * buffer, std::istream &fd, unsigned int amount) -{ - /* avoid using different values */ - Buffer_table cache = _pointers; - - const unsigned int reader = cache.reader.complete; - const unsigned int writer = cache.writer.complete; - - const unsigned int dest = writer - 1; - - const bool reader_less = reader < writer; - - unsigned int real_amount = 0; - - /* should we go around the buffer for writing? */ - if (reader_less && ((writer + amount) > _size)) - { - /* Documentation of the formula used in the 'if' below. - * - * [0|1|2|3|4|5|6|7] => size=8 - * | | - * reader | - * writer - * - * => writer has places [5,6,7,0,1] to write (5 places). - * - * => 8 - (4-2+1) = 8 - (2+1) = 8 - 3 = 5 - * - * > writer goes 1 up, amount goes 1 down. - * > reader goes 1 up, amount goes 1 up. - * > size goes 1 down, amount goes 1 down. - * - */ - - if ((_size - (writer - reader + 1)) <= amount) - return false; - - unsigned int wr1 = _size - writer + 1; /* writer is already 1 position after */ - unsigned int wr2 = amount - wr1; - -// fprintf(stderr, "%p> partial write: (%d/%d) %d/%d [%d/%d]\n", this, wr1, wr2, amount, _size, reader, writer); - - unsigned int char_amount = 0; - - /* one partial write on the buffer (at the end) */ - fd.read((char *) &(buffer[dest]), _block * wr1); - char_amount += fd.gcount(); - - if (fd.gcount() == (int)(_block * wr1)) - { - /* another partial write on the buffer (at the beginning) */ - fd.read((char *) (buffer), _block * wr2); - char_amount += fd.gcount(); - } - - real_amount = char_amount / _block; - } - else - { - if (!reader_less && ((reader - writer) <= amount)) - return false; - -// fprintf(stderr, "%p> full write: %d/%d [%d/%d]\n", this, amount, _size, reader, writer); - - /* we are talking about buffers here, man! */ - fd.read((char *) &(buffer[dest]), _block * amount); - - real_amount = fd.gcount() / _block; - } - - _pointers.writer.complete = ((dest + real_amount) % _size) + 1; - _pointers.writer.partial = 1; - - return real_amount; -} diff --git a/src/mod/endpoints/mod_khomp/commons/tools/generate-verbose-headers.sh b/src/mod/endpoints/mod_khomp/commons/tools/generate-verbose-headers.sh new file mode 100755 index 0000000..7b9012b --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/tools/generate-verbose-headers.sh @@ -0,0 +1,183 @@ +#!/bin/sh + +cut_defines () +{ + cut -b9- | cut -f1 | cut -d' ' -f1 +} + +list_commands () +{ + egrep -h 'define.+CM_' "$@" | cut_defines +} + +list_events () +{ + # list and remove deprecations + egrep -h 'define.+EV_' "$@" | cut_defines | \ + grep -v 'EV_CALL_PROGRESS\|EV_FAX_MESSAGE_CONFIRMATION' +} + +make_enumeration_one_by_one () +{ + while read line + do + local size=$[50 - $(expr length "${line}")] + + echo -n " K_${line}" + + for ((i=0;i<size;i++)) + do + echo -n " " + done + + echo "= ${line}," + done +} + +make_enumeration () +{ + local name="$1"; shift + local func="$1"; shift + + echo " typedef enum" + echo " {" + "${func}" "$@" | make_enumeration_one_by_one + echo " }" + echo " ${name};" +} + +make_switch_case_one_by_one () +{ + while read line + do + local size=$[50 - $(expr length "${line}")] + + echo -n " case K_${line}:" + + for ((i=0;i<size;i++)) + do + echo -n " " + done + + echo "return \"${line}\";" + done +} + +make_switch_case () +{ + local type="$1"; shift + local name="$1"; shift + local func="$1"; shift + + echo "std::string VerboseTraits::${name}Name(const ${type} value)" + echo "{" + echo " switch(value)" + echo " {" + "${func}" "$@" | make_switch_case_one_by_one + echo " }" + echo " return STG(FMT(\"${name}=%d\") % ((int)value));" + echo "}" +} + +make_license () +{ + echo '/*' + echo ' KHOMP generic endpoint/channel library.' + echo ' Copyright (C) 2007-2010 Khomp Ind. & Com.' + echo '' + echo ' The contents of this file are subject to the Mozilla Public License Version 1.1' + echo ' (the "License"); you may not use this file except in compliance with the' + echo ' License. You may obtain a copy of the License at http://www.mozilla.org/MPL/' + echo '' + echo ' Software distributed under the License is distributed on an "AS IS" basis,' + echo ' WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for' + echo ' the specific language governing rights and limitations under the License.' + echo '' + echo ' Alternatively, the contents of this file may be used under the terms of the' + echo ' "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which' + echo ' case the provisions of "LGPL License" are applicable instead of those above.' + echo '' + echo ' If you wish to allow use of your version of this file only under the terms of' + echo ' the LGPL License and not to allow others to use your version of this file under' + echo ' the MPL, indicate your decision by deleting the provisions above and replace them' + echo ' with the notice and other provisions required by the LGPL License. If you do not' + echo ' delete the provisions above, a recipient may use your version of this file under' + echo ' either the MPL or the LGPL License.' + echo '' + echo ' The LGPL header follows below:' + echo '' + echo ' This library is free software; you can redistribute it and/or' + echo ' modify it under the terms of the GNU Lesser General Public' + echo ' License as published by the Free Software Foundation; either' + echo ' version 2.1 of the License, or (at your option) any later version.' + echo '' + echo ' This library is distributed in the hope that it will be useful,' + echo ' but WITHOUT ANY WARRANTY; without even the implied warranty of' + echo ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU' + echo ' Lesser General Public License for more details.' + echo '' + echo ' You should have received a copy of the GNU Lesser General Public License' + echo ' along with this library; if not, write to the Free Software Foundation, Inc.,' + echo ' 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA' + echo '' + echo '*/' + + echo "/* ****************************************************************************** */" + echo "/* ******************* AUTO GENERATED FILE - DO NOT EDIT! *********************** */" + echo "/* ****************************************************************************** */" + echo +} + +make_header () +{ + make_license + + echo "#ifndef _VERBOSE_TRAITS_H_" + echo "#define _VERBOSE_TRAITS_H_" + echo + echo "#include <string>" + echo + echo "#include <format.hpp>" + echo + echo "#include <k3l.h>" + echo + echo "struct VerboseTraits" + echo "{" + make_enumeration "Command" list_commands "$@" || return 1 + echo + make_enumeration "Event" list_events "$@" || return 1 + echo + echo " static std::string eventName(const Event);" + echo " static std::string commandName(const Command);" + echo "};" + echo + echo "#endif /* _VERBOSE_TRAITS_H_ */" +} + +make_source () +{ + make_license + + echo "#include <verbose_traits.hpp>" + echo + + make_switch_case "Event" "event" list_events "$@" || return 1 + echo + make_switch_case "Command" "command" list_commands "$@" || return 1 +} + +make_run () +{ + local destdir="$1"; shift + + if [ ! -d "${destdir}" ] + then + echo "ERROR: First argument is not a directory!" + return 1 + fi + + make_header "$@" > "${destdir}/verbose_traits.hpp" + make_source "$@" > "${destdir}/verbose_traits.cpp" +} + +make_run "$@" diff --git a/src/mod/endpoints/mod_khomp/commons/variant.hpp b/src/mod/endpoints/mod_khomp/commons/variant.hpp deleted file mode 100644 index 410a770..0000000 --- a/src/mod/endpoints/mod_khomp/commons/variant.hpp +++ /dev/null @@ -1,127 +0,0 @@ -/* - KHOMP generic endpoint/channel library. - Copyright (C) 2007-2009 Khomp Ind. & Com. - - The contents of this file are subject to the Mozilla Public License Version 1.1 - (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.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" basis, - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - the specific language governing rights and limitations under the License. - - Alternatively, the contents of this file may be used under the terms of the - "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which - case the provisions of "LGPL License" are applicable instead of those above. - - If you wish to allow use of your version of this file only under the terms of - the LGPL License and not to allow others to use your version of this file under - the MPL, indicate your decision by deleting the provisions above and replace them - with the notice and other provisions required by the LGPL License. If you do not - delete the provisions above, a recipient may use your version of this file under - either the MPL or the LGPL License. - - The LGPL header follows below: - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this library; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -*/ - -#include <refcounter.hpp> - -#include <typeinfo> - -#ifndef _VARIANT_H_ -#define _VARIANT_H_ - -/* this is internal, should not be used by the user */ -struct NoArgumentDefined {}; - -template < typename UserReturnType, typename UserArgumentType = NoArgumentDefined > -struct VariantBaseType -{ - typedef UserReturnType ReturnType; - typedef UserArgumentType ArgumentType; - - virtual ~VariantBaseType() {}; - - virtual int which() = 0; - - virtual ReturnType visit(void) { return ReturnType(); }; - virtual ReturnType visit(ArgumentType) { return ReturnType(); }; -}; - -template < typename BaseType = VariantBaseType < void > > -struct Variant: NEW_REFCOUNTER(Variant < BaseType >) -{ - typedef typename BaseType::ReturnType ReturnType; - typedef typename BaseType::ArgumentType ArgumentType; - - struct InvalidType {}; - - Variant(BaseType * value, bool is_owner = false) - : _value(value), _is_owner(is_owner) {}; - - Variant(const Variant & v) - : INC_REFCOUNTER(v, Variant < BaseType >), - _value(v._value), _is_owner(v._is_owner) {}; - - virtual ~Variant() {}; - - void unreference() - { - if (_is_owner && _value) - { - delete _value; - _value = 0; - } - }; - - template < typename ValueType > - ValueType & get(void) - { - try - { - ValueType & ret = dynamic_cast < ValueType & > (*_value); - return ret; - } - catch (std::bad_cast & e) - { - throw InvalidType(); - } - }; - - int which() - { - return _value->which(); - } - - ReturnType visit(void) - { - return _value->visit(); - } - - ReturnType visit(ArgumentType arg) - { - return _value->visit(arg); - } - - protected: - BaseType * _value; - bool _is_owner; -}; - -#endif /* _VARIANT_H_ */ - diff --git a/src/mod/endpoints/mod_khomp/commons/verbose.hpp b/src/mod/endpoints/mod_khomp/commons/verbose.hpp deleted file mode 100644 index 4668ea6..0000000 --- a/src/mod/endpoints/mod_khomp/commons/verbose.hpp +++ /dev/null @@ -1,505 +0,0 @@ -/* - KHOMP generic endpoint/channel library. - Copyright (C) 2007-2009 Khomp Ind. & Com. - - The contents of this file are subject to the Mozilla Public License Version 1.1 - (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.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" basis, - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for - the specific language governing rights and limitations under the License. - - Alternatively, the contents of this file may be used under the terms of the - "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which - case the provisions of "LGPL License" are applicable instead of those above. - - If you wish to allow use of your version of this file only under the terms of - the LGPL License and not to allow others to use your version of this file under - the MPL, indicate your decision by deleting the provisions above and replace them - with the notice and other provisions required by the LGPL License. If you do not - delete the provisions above, a recipient may use your version of this file under - either the MPL or the LGPL License. - - The LGPL header follows below: - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this library; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -*/ - -#include <string> -#include <sstream> -#include <map> - -#include <k3l.h> - -// k3lApiMajorVersion -#ifndef CM_PING -# include <k3lVersion.h> -# include <KTools.h> -#endif - -#include <types.hpp> -#include <k3lapi.hpp> -#include <format.hpp> - -#ifndef _VERBOSE_HPP_ -#define _VERBOSE_HPP_ - -struct Verbose -{ - typedef enum - { - K_CM_SEIZE = CM_SEIZE, - K_CM_SYNC_SEIZE = CM_SYNC_SEIZE, -#if K3L_AT_LEAST(1,6,0) - K_CM_SIP_REGISTER = CM_SIP_REGISTER, -#endif - K_CM_DIAL_DTMF = CM_DIAL_DTMF, - K_CM_DISCONNECT = CM_DISCONNECT, - K_CM_CONNECT = CM_CONNECT, - K_CM_PRE_CONNECT = CM_PRE_CONNECT, - K_CM_CAS_CHANGE_LINE_STT = CM_CAS_CHANGE_LINE_STT, - K_CM_CAS_SEND_MFC = CM_CAS_SEND_MFC, - K_CM_SET_FORWARD_CHANNEL = CM_SET_FORWARD_CHANNEL, - K_CM_CAS_SET_MFC_DETECT_MODE = CM_CAS_SET_MFC_DETECT_MODE, - K_CM_DROP_COLLECT_CALL = CM_DROP_COLLECT_CALL, - K_CM_MAKE_CALL = CM_MAKE_CALL, - K_CM_RINGBACK = CM_RINGBACK, - K_CM_USER_INFORMATION = CM_USER_INFORMATION, -#if !K3L_AT_LEAST(2,2,0) - K_CM_VOIP_SEIZE = CM_VOIP_SEIZE, //deprecated -#endif - K_CM_LOCK_INCOMING = CM_LOCK_INCOMING, - K_CM_UNLOCK_INCOMING = CM_UNLOCK_INCOMING, - K_CM_LOCK_OUTGOING = CM_LOCK_OUTGOING, - K_CM_UNLOCK_OUTGOING = CM_UNLOCK_OUTGOING, - K_CM_START_SEND_FAIL = CM_START_SEND_FAIL, - K_CM_STOP_SEND_FAIL = CM_STOP_SEND_FAIL, - K_CM_END_OF_NUMBER = CM_END_OF_NUMBER, -#if K3L_AT_LEAST(1,6,0) - K_CM_SS_TRANSFER = CM_SS_TRANSFER, - K_CM_GET_SMS = CM_GET_SMS, - K_CM_PREPARE_SMS = CM_PREPARE_SMS, - K_CM_SEND_SMS = CM_SEND_SMS, -#endif -#if K3L_HAS_MPTY_SUPPORT - K_CM_HOLD_SWITCH = CM_HOLD_SWITCH, - K_CM_MPTY_CONF = CM_MPTY_CONF, - K_CM_MPTY_SPLIT = CM_MPTY_SPLIT, -#endif - K_CM_ENABLE_DTMF_SUPPRESSION = CM_ENABLE_DTMF_SUPPRESSION, - K_CM_DISABLE_DTMF_SUPPRESSION = CM_DISABLE_DTMF_SUPPRESSION, - K_CM_ENABLE_AUDIO_EVENTS = CM_ENABLE_AUDIO_EVENTS, - K_CM_DISABLE_AUDIO_EVENTS = CM_DISABLE_AUDIO_EVENTS, - K_CM_ENABLE_CALL_PROGRESS = CM_ENABLE_CALL_PROGRESS, - K_CM_DISABLE_CALL_PROGRESS = CM_DISABLE_CALL_PROGRESS, - K_CM_FLASH = CM_FLASH, - K_CM_ENABLE_PULSE_DETECTION = CM_ENABLE_PULSE_DETECTION, - K_CM_DISABLE_PULSE_DETECTION = CM_DISABLE_PULSE_DETECTION, - K_CM_ENABLE_ECHO_CANCELLER = CM_ENABLE_ECHO_CANCELLER, - K_CM_DISABLE_ECHO_CANCELLER = CM_DISABLE_ECHO_CANCELLER, - K_CM_ENABLE_AGC = CM_ENABLE_AGC, - K_CM_DISABLE_AGC = CM_DISABLE_AGC, - K_CM_ENABLE_HIGH_IMP_EVENTS = CM_ENABLE_HIGH_IMP_EVENTS, - K_CM_DISABLE_HIGH_IMP_EVENTS = CM_DISABLE_HIGH_IMP_EVENTS, -#if K3L_AT_LEAST(1,6,0) - K_CM_ENABLE_CALL_ANSWER_INFO = CM_ENABLE_CALL_ANSWER_INFO, - K_CM_DISABLE_CALL_ANSWER_INFO = CM_DISABLE_CALL_ANSWER_INFO, -#endif - K_CM_RESET_LINK = CM_RESET_LINK, -#if K3L_AT_LEAST(1,6,0) - K_CM_CLEAR_LINK_ERROR_COUNTER = CM_CLEAR_LINK_ERROR_COUNTER, -#endif - K_CM_SEND_DTMF = CM_SEND_DTMF, - K_CM_STOP_AUDIO = CM_STOP_AUDIO, - K_CM_HARD_RESET = CM_HARD_RESET, - K_CM_SEND_TO_CTBUS = CM_SEND_TO_CTBUS, - K_CM_RECV_FROM_CTBUS = CM_RECV_FROM_CTBUS, - K_CM_SETUP_H100 = CM_SETUP_H100, - K_CM_MIXER = CM_MIXER, - K_CM_CLEAR_MIXER = CM_CLEAR_MIXER, - K_CM_PLAY_FROM_FILE = CM_PLAY_FROM_FILE, - K_CM_RECORD_TO_FILE = CM_RECORD_TO_FILE, - K_CM_PLAY_FROM_STREAM = CM_PLAY_FROM_STREAM, - K_CM_INTERNAL_PLAY = CM_INTERNAL_PLAY, - K_CM_STOP_PLAY = CM_STOP_PLAY, - K_CM_STOP_RECORD = CM_STOP_RECORD, - K_CM_PAUSE_PLAY = CM_PAUSE_PLAY, - K_CM_PAUSE_RECORD = CM_PAUSE_RECORD, - K_CM_RESUME_PLAY = CM_RESUME_PLAY, - K_CM_RESUME_RECORD = CM_RESUME_RECORD, - K_CM_INCREASE_VOLUME = CM_INCREASE_VOLUME, - K_CM_DECREASE_VOLUME = CM_DECREASE_VOLUME, - K_CM_LISTEN = CM_LISTEN, - K_CM_STOP_LISTEN = CM_STOP_LISTEN, - K_CM_PREPARE_FOR_LISTEN = CM_PREPARE_FOR_LISTEN, - K_CM_PLAY_SOUND_CARD = CM_PLAY_SOUND_CARD, - K_CM_STOP_SOUND_CARD = CM_STOP_SOUND_CARD, - K_CM_MIXER_CTBUS = CM_MIXER_CTBUS, - K_CM_PLAY_FROM_STREAM_EX = CM_PLAY_FROM_STREAM_EX, - K_CM_INTERNAL_PLAY_EX = CM_INTERNAL_PLAY_EX, - K_CM_ENABLE_PLAYER_AGC = CM_ENABLE_PLAYER_AGC, - K_CM_DISABLE_PLAYER_AGC = CM_DISABLE_PLAYER_AGC, - K_CM_START_STREAM_BUFFER = CM_START_STREAM_BUFFER, - K_CM_ADD_STREAM_BUFFER = CM_ADD_STREAM_BUFFER, - K_CM_STOP_STREAM_BUFFER = CM_STOP_STREAM_BUFFER, - K_CM_SEND_BEEP = CM_SEND_BEEP, - K_CM_SEND_BEEP_CONF = CM_SEND_BEEP_CONF, - K_CM_ADD_TO_CONF = CM_ADD_TO_CONF, - K_CM_REMOVE_FROM_CONF = CM_REMOVE_FROM_CONF, - K_CM_RECORD_TO_FILE_EX = CM_RECORD_TO_FILE_EX, - K_CM_SET_VOLUME = CM_SET_VOLUME, - K_CM_SET_LINE_CONDITION = CM_SET_LINE_CONDITION, - K_CM_SEND_LINE_CONDITION = CM_SEND_LINE_CONDITION, - K_CM_SET_CALLER_CATEGORY = CM_SET_CALLER_CATEGORY, - K_CM_DIAL_MFC = CM_DIAL_MFC, -#if !K3L_AT_LEAST(2,0,0) - K_CM_VOIP_START_DEBUG = CM_VOIP_START_DEBUG, - K_CM_VOIP_STOP_DEBUG = CM_VOIP_STOP_DEBUG, - K_CM_VOIP_DUMP_STAT = CM_VOIP_DUMP_STAT, - K_CM_ISDN_DEBUG = CM_ISDN_DEBUG, - K_CM_PING = CM_PING, - K_CM_LOG_REQUEST = CM_LOG_REQUEST, - K_CM_LOG_CREATE_DISPATCHER = CM_LOG_CREATE_DISPATCHER, - K_CM_LOG_DESTROY_DISPATCHER = CM_LOG_DESTROY_DISPATCHER, -#endif -#if K3L_AT_LEAST(1,6,0) - K_CM_START_CADENCE = CM_START_CADENCE, - K_CM_STOP_CADENCE = CM_STOP_CADENCE, - K_CM_CHECK_NEW_SMS = CM_CHECK_NEW_SMS, - K_CM_SEND_TO_MODEM = CM_SEND_TO_MODEM, -#endif -#if K3L_AT_LEAST(2,1,0) - K_CM_START_FAX_TX = CM_START_FAX_TX, - K_CM_STOP_FAX_TX = CM_STOP_FAX_TX, - K_CM_ADD_FAX_FILE = CM_ADD_FAX_FILE, - K_CM_ADD_FAX_PAGE_BREAK = CM_ADD_FAX_PAGE_BREAK, - K_CM_START_FAX_RX = CM_START_FAX_RX, - K_CM_STOP_FAX_RX = CM_STOP_FAX_RX, - K_CM_SIM_CARD_SELECT = CM_SIM_CARD_SELECT, -#endif - -#if K3L_AT_LEAST(2,1,0) - K_CM_NOTIFY_WATCHDOG = CM_NOTIFY_WATCHDOG, - K_CM_STOP_WATCHDOG = CM_STOP_WATCHDOG, - K_CM_WATCHDOG_COUNT = CM_WATCHDOG_COUNT, - K_CM_START_WATCHDOG = CM_START_WATCHDOG, -#endif - - } - kcommand; - - typedef enum - { - K_EV_CHANNEL_FREE = EV_CHANNEL_FREE, - K_EV_CONNECT = EV_CONNECT, - K_EV_DISCONNECT = EV_DISCONNECT, - K_EV_CALL_SUCCESS = EV_CALL_SUCCESS, - K_EV_CALL_FAIL = EV_CALL_FAIL, - K_EV_NO_ANSWER = EV_NO_ANSWER, - K_EV_BILLING_PULSE = EV_BILLING_PULSE, - K_EV_SEIZE_SUCCESS = EV_SEIZE_SUCCESS, - K_EV_SEIZE_FAIL = EV_SEIZE_FAIL, - K_EV_SEIZURE_START = EV_SEIZURE_START, - K_EV_CAS_LINE_STT_CHANGED = EV_CAS_LINE_STT_CHANGED, - K_EV_CAS_MFC_RECV = EV_CAS_MFC_RECV, - K_EV_NEW_CALL = EV_NEW_CALL, - K_EV_USER_INFORMATION = EV_USER_INFORMATION, - K_EV_DIALED_DIGIT = EV_DIALED_DIGIT, -#if K3L_AT_LEAST(1,6,0) - K_EV_SIP_REGISTER_INFO = EV_SIP_REGISTER_INFO, - K_EV_RING_DETECTED = EV_RING_DETECTED, -#endif - K_EV_CALL_HOLD_START = EV_CALL_HOLD_START, - K_EV_CALL_HOLD_STOP = EV_CALL_HOLD_STOP, -#if K3L_AT_LEAST(1,6,0) - K_EV_SS_TRANSFER_FAIL = EV_SS_TRANSFER_FAIL, - K_EV_FLASH = EV_FLASH, -#endif - K_EV_DTMF_DETECTED = EV_DTMF_DETECTED, - K_EV_DTMF_SEND_FINISH = EV_DTMF_SEND_FINISH, - K_EV_AUDIO_STATUS = EV_AUDIO_STATUS, - K_EV_CADENCE_RECOGNIZED = EV_CADENCE_RECOGNIZED, - K_EV_END_OF_STREAM = EV_END_OF_STREAM, - K_EV_PULSE_DETECTED = EV_PULSE_DETECTED, - K_EV_POLARITY_REVERSAL = EV_POLARITY_REVERSAL, -#if K3L_AT_LEAST(1,6,0) - K_EV_ISDN_PROGRESS_INDICATOR = EV_ISDN_PROGRESS_INDICATOR, - K_EV_CALL_ANSWER_INFO = EV_CALL_ANSWER_INFO, - K_EV_COLLECT_CALL = EV_COLLECT_CALL, - K_EV_SIP_DTMF_DETECTED = EV_SIP_DTMF_DETECTED, - K_EV_RECV_FROM_MODEM = EV_RECV_FROM_MODEM, - K_EV_NEW_SMS = EV_NEW_SMS, - K_EV_SMS_INFO = EV_SMS_INFO, - K_EV_SMS_DATA = EV_SMS_DATA, - K_EV_SMS_SEND_RESULT = EV_SMS_SEND_RESULT, -#endif -#if K3L_HAS_MPTY_SUPPORT - K_EV_CALL_MPTY_START = EV_CALL_MPTY_START, - K_EV_CALL_MPTY_STOP = EV_CALL_MPTY_STOP, - K_EV_GSM_COMMAND_STATUS = EV_GSM_COMMAND_STATUS, -#endif - K_EV_CHANNEL_FAIL = EV_CHANNEL_FAIL, - K_EV_REFERENCE_FAIL = EV_REFERENCE_FAIL, - K_EV_INTERNAL_FAIL = EV_INTERNAL_FAIL, - K_EV_HARDWARE_FAIL = EV_HARDWARE_FAIL, - K_EV_LINK_STATUS = EV_LINK_STATUS, -#if K3L_AT_LEAST(1,6,0) - K_EV_PHYSICAL_LINK_UP = EV_PHYSICAL_LINK_UP, - K_EV_PHYSICAL_LINK_DOWN = EV_PHYSICAL_LINK_DOWN, -#endif - K_EV_CLIENT_RECONNECT = EV_CLIENT_RECONNECT, - K_EV_VOIP_SEIZURE = EV_VOIP_SEIZURE, - K_EV_SEIZURE = EV_SEIZURE, - -#if K3L_AT_LEAST(2,1,0) - K_EV_FAX_CHANNEL_FREE = EV_FAX_CHANNEL_FREE, - K_EV_FAX_FILE_SENT = EV_FAX_FILE_SENT, - K_EV_FAX_FILE_FAIL = EV_FAX_FILE_FAIL, - K_EV_FAX_MESSAGE_CONFIRMATION = EV_FAX_MESSAGE_CONFIRMATION, - K_EV_FAX_TX_TIMEOUT = EV_FAX_TX_TIMEOUT, - K_EV_FAX_PAGE_CONFIRMATION = EV_FAX_PAGE_CONFIRMATION, - K_EV_FAX_REMOTE_INFO = EV_FAX_REMOTE_INFO, -#endif - -#if K3L_AT_LEAST(2,1,0) - K_EV_WATCHDOG_COUNT = EV_WATCHDOG_COUNT, -#endif - -#if !K3L_AT_LEAST(2,0,0) - K_EV_PONG = EV_PONG, -#endif - } - kevent; - - typedef enum - { - R2_COUNTRY_ARG = 1, - R2_COUNTRY_BRA = 2, - R2_COUNTRY_CHI = 3, - R2_COUNTRY_MEX = 4, - R2_COUNTRY_URY = 5, - R2_COUNTRY_VEN = 6 - } - R2CountryType; - - typedef enum - { - HUMAN, - EXACT - } - Presentation; - - /* dynamic (object) stuff */ - - Verbose(K3LAPI & api): _api(api) {}; - -#if K3L_AT_LEAST(2,0,0) - std::string event(int32, K3L_EVENT*, R2CountryType r2_country = R2_COUNTRY_BRA, - Presentation fmt = HUMAN); -#else - std::string event(int32, K3L_EVENT*, Presentation fmt = HUMAN); -#endif - - std::string channelStatus(int32, int32, int32, Presentation fmt = HUMAN); - - /* end of dynamic (object) stuff */ - - protected: - K3LAPI & _api; - - /* used internally */ - struct internal_not_found {}; - - public: - - /* static (class) stuff */ - - static std::string echoLocation(KEchoLocation, Presentation fmt = HUMAN); - static std::string echoCancellerConfig(KEchoCancellerConfig, Presentation fmt = HUMAN); - -#if K3L_AT_LEAST(2,0,0) - static std::string event(KSignaling, int32, K3L_EVENT*, R2CountryType = R2_COUNTRY_BRA, - Presentation fmt = HUMAN); -#else - static std::string event(KSignaling, int32, K3L_EVENT*, Presentation fmt = HUMAN); -#endif - -#if K3L_AT_LEAST(2,0,0) - static std::string command(int32, K3L_COMMAND*, R2CountryType = R2_COUNTRY_BRA, - Presentation fmt = HUMAN); - static std::string command(int32, int32, int32, const char *, R2CountryType = R2_COUNTRY_BRA, - Presentation fmt = HUMAN); -#else - static std::string command(int32, K3L_COMMAND*, Presentation fmt = HUMAN); - static std::string command(int32, int32, int32, const char *, Presentation fmt = HUMAN); -#endif - - - static std::string deviceName(KDeviceType, int32, Presentation fmt = HUMAN); - - static std::string deviceType(KDeviceType, Presentation fmt = HUMAN); - static std::string deviceModel(KDeviceType, int32, Presentation fmt = HUMAN); - - static std::string channelFeatures(int32, Presentation fmt = HUMAN); - static std::string signaling(KSignaling, Presentation fmt = HUMAN); - static std::string systemObject(KSystemObject, Presentation fmt = HUMAN); - static std::string mixerTone(KMixerTone, Presentation fmt = HUMAN); - static std::string mixerSource(KMixerSource, Presentation fmt = HUMAN); - - static std::string seizeFail(KSeizeFail, Presentation fmt = HUMAN); - -#if K3L_AT_LEAST(2,0,0) - static std::string callFail(KSignaling, R2CountryType, int32, Presentation fmt = HUMAN); -#else - static std::string callFail(KSignaling, int32, Presentation fmt = HUMAN); -#endif - - static std::string channelFail(KSignaling, int32, Presentation fmt = HUMAN); - static std::string internalFail(KInternalFail, Presentation fmt = HUMAN); - - static std::string linkErrorCounter(KLinkErrorCounter, Presentation fmt = HUMAN); - - static std::string linkStatus(KSignaling, int32, Presentation fmt = HUMAN); - static std::string channelStatus(KSignaling, int32, Presentation fmt = HUMAN); - static std::string callStatus(KCallStatus, Presentation fmt = HUMAN); - static std::string status(KLibraryStatus, Presentation fmt = HUMAN); - -#if K3L_AT_LEAST(2,0,0) - static std::string signGroupB(KSignGroupB, R2CountryType contry = R2_COUNTRY_BRA, - Presentation fmt = HUMAN); -#else - static std::string signGroupB(KSignGroupB, Presentation fmt = HUMAN); -#endif - -#if K3L_AT_LEAST(2,0,0) - static std::string signGroupII(KSignGroupII, R2CountryType contry = R2_COUNTRY_BRA, - Presentation fmt = HUMAN); -#else - static std::string signGroupII(KSignGroupII, Presentation fmt = HUMAN); -#endif - - static std::string h100configIndex(KH100ConfigIndex, Presentation fmt = HUMAN); - - static std::string eventName(int32); - static std::string commandName(int32); - -#if K3L_AT_LEAST(1,5,0) - static std::string sipFailures(KSIP_Failures, Presentation fmt = HUMAN); -#endif - -#if K3L_AT_LEAST(1,5,1) - static std::string isdnCause(KQ931Cause, Presentation fmt = HUMAN); -#endif - -#if K3L_AT_LEAST(1,5,2) - static std::string isdnDebug(int32, Presentation fmt = HUMAN); -#endif - -#if K3L_AT_LEAST(1,6,0) - static std::string callStartInfo(KCallStartInfo, Presentation fmt = HUMAN); - - static std::string gsmCallCause(KGsmCallCause, Presentation fmt = HUMAN); - static std::string gsmMobileCause(KGsmMobileCause, Presentation fmt = HUMAN); - static std::string gsmSmsCause(KGsmSmsCause, Presentation fmt = HUMAN); - - static std::string q931ProgressIndication(KQ931ProgressIndication, - Presentation fmt = HUMAN); -#endif - -#if K3L_AT_LEAST(2,1,0) - static std::string faxResult(KFaxResult code, Presentation fmt = HUMAN); - static std::string faxFileErrorCause(KFaxFileErrorCause code, Presentation fmt = HUMAN); -#endif - - /* end of static (class) stuff */ - - private: - static std::string internal_deviceType(KDeviceType); - static std::string internal_deviceModel(KDeviceType, int32); - -#if K3L_AT_LEAST(1,5,0) - static std::string internal_sipFailures(KSIP_Failures, Presentation fmt = HUMAN); -#endif -#if K3L_AT_LEAST(1,5,1) - static std::string internal_isdnCause(KQ931Cause, Presentation fmt = HUMAN); -#endif - -#if K3L_AT_LEAST(2,0,0) - static std::string internal_signGroupB(KSignGroupB, R2CountryType contry, Presentation fmt = HUMAN); - static std::string internal_signGroupII(KSignGroupII, R2CountryType contry, Presentation fmt = HUMAN); -#else - static std::string internal_signGroupB(KSignGroupB, Presentation fmt = HUMAN); - static std::string internal_signGroupII(KSignGroupII, Presentation fmt = HUMAN); -#endif - -#if K3L_AT_LEAST(1,6,0) - static std::string internal_gsmCallCause(KGsmCallCause, Presentation fmt = HUMAN); - static std::string internal_gsmMobileCause(KGsmMobileCause, Presentation fmt = HUMAN); - static std::string internal_gsmSmsCause(KGsmSmsCause, Presentation fmt = HUMAN); - - static std::string internal_q931ProgressIndication(KQ931ProgressIndication, Presentation fmt = HUMAN); -#endif - - private: - enum Type - { - DEVICE, - CHANNEL, - PLAYER, - MIXER, - LINK, - NONE - }; - - struct Target - { - Target(Type _type) - : type(_type), device(-1), object(-1) - {}; - - Target(Type _type, int32 _device) - : type(_type), device(_device), object(-1) - {}; - - Target(Type _type, int32 _device, int32 _object) - : type(_type), device(_device), object(_object) - {}; - - Type type; - int32 device; - int32 object; - }; - - static void generate(std::string &, std::string &, Target, std::string &); - - static std::string show(std::string &, std::string, Target, std::string &); - static std::string show(std::string &, std::string, Target); - - template < typename ReturnType > - static ReturnType presentation(Presentation fmt, ReturnType str_exact, ReturnType str_human) - { - switch (fmt) - { - case HUMAN: return str_human; - case EXACT: return str_exact; - }; - - return str_exact; - } -}; - -#endif /* _VERBOSE_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/docs/Manual.html b/src/mod/endpoints/mod_khomp/docs/Manual.html index 863ef76..c474570 100644 --- a/src/mod/endpoints/mod_khomp/docs/Manual.html +++ b/src/mod/endpoints/mod_khomp/docs/Manual.html @@ -37,17 +37,22 @@ </li><li><b>context-fxs</b>: Contexto de entrada para placas FXS (o padrão é "khomp-DD-CC", onde "DD" será substituído, no momento da ligação, pelo número do dispositivo, "CC" pelo número do canal, e "SSSS" pelo número serial do dispositivo); </li><li><b>context-gsm-call</b> (ou "context-gsm"): Contexto de entrada para ligações GSM (o padrão é "khomp-DD-CC", onde "DD" será substituído no momento da ligação pelo número do dispositivo, "CC" pelo número do canal, e "SSSS" pelo número serial do dispositivo); </li><li><b>context-gsm-sms</b>: Contexto de entrada para SMSs (o padrão é "khomp-sms-DD-CC", onde "DD" será substituído pelo número de dispositivo, "CC" pelo número do canal, e "SSSS" pelo número serial do dispositivo); -</li><li><b>context-pr</b>: Contexto de entrada para ligações em placas KPR (o padrão é "khomp-DD-CC", onde "DD" será substituído, no momento da ligação, pelo número do dispositivo, "CC" pelo número do canal); +</li><li><b>context-pr</b>: Contexto de entrada para ligações em placas KPR (o padrão é "khomp-DD-CC", onde "DD" será substituído, no momento da ligação, pelo número do dispositivo, "CC" pelo número do canal); +</li><li><b>delay-ringback-co</b>: Define o tempo de <i>delay</i> para ativar a geração de tom de controle de chamada (<i>ringback</i>) pelo Endpoint da Khomp quando há uma indicação de <i>ringback</i>, e não há áudio sendo enviado por quem indicou a situação de controle da chamada; +</li><li><b>delay-ringback-pbx</b>: Define o tempo de <i>delay</i> para ativar a geração de controle de chamada (<i>ringback</i>) pelo Endpoint da Khomp quando há uma indicação de <i>ringback</i>, e o áudio de controle enviado não possui nenhum tom (ou seja, está em silêncio); </li><li><b>disconnect-delay</b>: Define o tempo em milissegundos para realizar o processamento de um evento de desconexão, para ignorar situações onde outros equipamentos realizam o duplo atendimento para derrubar chamadas a cobrar; +</li><li><b>drop-collect-call</b>: Ativa ("yes") ou desativa ("no") o derrubamento de chamadas à cobrar. Caso ativo, todas as chamadas à cobrar serão derrubadas não importando o que foi ajustado na variável KDropCollectCall (o valor padrão é "no"); </li><li><b>echo-canceller</b>: Ativa ("yes") ou desativa ("no") o cancelamento de eco automático pelo Endpoint; +</li><li><b>flash-to-digits</b>: Define os dígitos para serem enviados quando o FLASH é detectado na FXS; </li><li><b>fxo-send-pre-audio</b>: Quando ativada ("yes") libera canal de áudio sainte antes da conexão da chamada em placas KFXO (o valor padrão é "yes"); +</li><li><b>fxs-digit-timeout</b>: Define o <i>timeout</i>, em segundos, entre dígitos na FXS; </li><li><b>fxs-global-orig</b>: Número inicial para numeração seqüencial de ramais das placas <b>KFXS</b> que não estiverem listadas na seção <b><fxs-branches></b> (a numeração segue ordem crescente por número da placa e número do canal físico) (o padrão é "0"); </li><li><b>fxs-co-dialtone</b>: Seqüências de números, separados por vírgula, que disparam um tom contínuo (de central pública) em ramais FXS (ex: "0,99" faz com que, ao discar "0" ou "99", o usuário receba o tom de linha contínuo) (o padrão é vazio); </li><li><b>fxs-bina</b>: Quando ativada ("yes"), ligações para ramais FXS enviarão os dígitos correspondentes ao telefone de origem em sinalização BINA DTMF (o valor padrão é "no"); +</li><li><b>ignore-letter-dtmfs</b>: Define se o canal deve ignorar DTMFs incomuns detectados pela placa (A, B, C e D). Entretanto, se você necessita passar esses dígitos pela placa, você deve ajustar esta opção para "no" (o valor padrão é "yes"); </li><li><b>input-volume</b>: Define o volume de entrada das ligações, varia de -10 a +10 ; </li><li><b>kommuter-activation</b>: Define se a ativação de dispositivos kommuter encontrados no sistema será feita de forma automática ("auto"), ou de forma manual ("manual") pelo usuário, através do comando "khomp kommuter on/off"; </li><li><b>kommuter-timeout</b>: Define o <i>timeout</i> (em segundos) com que os kommuters serão inicializados. Se chegarem a este <i>timeout</i> sem receberem notificação do channel, os dispositivos irão comutar para o estado "desligado". O valor mínimo é "0" , onde os links permanecerão sempre comutados no estado "ligado", e o valor máximo é "255"; -</li><li><b>language</b>: Define idioma para ligações nas placas Khomp; </li><li><b>log-to-console</b>: Define mensagens de log que devem ser impressas na console; </li><li><b>log-to-disk</b>: Define mensagens de log que devem ser salvar em disco; </li><li><b>out-of-band-dtmfs</b>: Ativa ("yes") ou desativa ("no") a supressão DTMF e o envio destes out-of-band; @@ -55,12 +60,9 @@ </li><li><b>pulse-forwarding</b>: Ativa ("yes") ou desativa ("no") a detecção de pulsos e a conversão dos mesmos em DTMFs; </li><li><b>r2-preconnect-wait</b>: Define o tempo de espera do envio da sinalização de ringback, no protocolo R2/MFC, para iniciar o envio de áudio de silêncio. Apenas utilizado quando "r2-strict-behaviour" estiver ajustado para "no"; </li><li><b>r2-strict-behaviour</b>: Ativa ("yes") ou desativa ("no") o comportamento da sinalização R2/MFC conforme a norma define. O padrão é "no", e pode ser alterado para "yes" caso seja necessário receber/enviar dados precisos da sinalização do protocolo (condição de B, por exemplo); -</li><li><b>ringback-delay-co</b>: Define o tempo de <i>delay</i> para ativar a geração de tom de controle de chamada (<i>ringback</i>) pelo Endpoint da Khomp quando há uma indicação de <i>ringback</i>, e não há áudio sendo enviado por quem indicou a situação de controle da chamada; -</li><li><b>ringback-delay-pbx</b>: Define o tempo de <i>delay</i> para ativar a geração de controle de chamada (<i>ringback</i>) pelo Endpoint da Khomp quando há uma indicação de <i>ringback</i>, e o áudio de controle enviado não possui nenhum tom (ou seja, está em silêncio); </li><li><b>suppression-delay</b>: Ativa ("yes") ou desativa ("no") o delay necessário para supressão DTMF. Se desativado ("no"), também desativa supressão de DTMFs; </li><li><b>trace</b>: Define opções de depuração. Não deve ser utilizado em produção a não ser que estritamente necessário; </li><li><b>user-transfer-digits</b>: Define uma seqüência de dígitos DTMF para iniciar a transferencia entre o FreeSWITCH® e um outro PABX (utilizando sinalização de usuário, como QSig ou FXO FLASH); -</li><li><b>flash-to-digits</b>: Define os dígitos para serem enviados quando o FLASH é detectado na FXS; </li></ul> <p><br /> </p> @@ -117,15 +119,13 @@ <ul><li>context; </li><li>input-volume; </li><li>output-volume; -</li><li>accountcode; </li><li>calleridnum; </li><li>calleridname; -</li><li>mailbox; </li><li>flash-to-digits. </li></ul> <p>Cada opção é separada uma da outra por um pipe "|" ou uma barra "/" e definidas após dois pontos ":", exemplo: </p> -<pre> <param name="200" value="language:en|context:master-branch" /> +<pre> <param name="200" value="input-volume:1|context:master-branch" /> </pre> <p>Para maiores informações sobre a sintaxe e exemplos, favor consultar o arquivo de configuração. </p><p><br /> diff --git a/src/mod/endpoints/mod_khomp/docs/Manual.pdf b/src/mod/endpoints/mod_khomp/docs/Manual.pdf index 935b299..260ba54 100644 Binary files a/src/mod/endpoints/mod_khomp/docs/Manual.pdf and b/src/mod/endpoints/mod_khomp/docs/Manual.pdf differ diff --git a/src/mod/endpoints/mod_khomp/docs/README.pdf b/src/mod/endpoints/mod_khomp/docs/README.pdf index 2b95cfa..13a5f54 100644 Binary files a/src/mod/endpoints/mod_khomp/docs/README.pdf and b/src/mod/endpoints/mod_khomp/docs/README.pdf differ diff --git a/src/mod/endpoints/mod_khomp/docs/README_en.pdf b/src/mod/endpoints/mod_khomp/docs/README_en.pdf index 25be8ab..a88e940 100644 Binary files a/src/mod/endpoints/mod_khomp/docs/README_en.pdf and b/src/mod/endpoints/mod_khomp/docs/README_en.pdf differ diff --git a/src/mod/endpoints/mod_khomp/docs/User_Guide.html b/src/mod/endpoints/mod_khomp/docs/User_Guide.html index eb5cfc6..5d0753a 100644 --- a/src/mod/endpoints/mod_khomp/docs/User_Guide.html +++ b/src/mod/endpoints/mod_khomp/docs/User_Guide.html @@ -18,7 +18,7 @@ <p>This step is carried out in a semi-automated way using the <b>khompwizard</b> program, a wizard that configures the basic parameters of the system boards. This wizard initializes the configuration files using information from the user when they are needed, initializing the standard settings to default values. </p><p>Typically, this program runs automatically after installation of the system. However, you may need to run it manually if an update is being performed, or if new cards were added to the system after installing new drivers. </p><p><br /> -If you need to set advanced parameters of the board and/or signaling, the program <b>k3lconfig</b> allows you to access all the available settings for each installed card. For more information about this program, check the <b><a href="http://169.254.1.3/kdevwiki/wikidocs/index.php?title=K3lconfig_-_User%27s_Guide&action=edit&redlink=1" class="new" title="K3lconfig - User's Guide (página não existe)">k3lconfig User's Guide</a></b>. For solving synchronization issues, check the <a href="#_Troubleshooting" title="">Troubleshooting</a> section for manual configuration of the boards. +If you need to set advanced parameters of the board and/or signaling, the program <b>k3lconfig</b> allows you to access all the available settings for each installed card. For more information about this program, check the <b><a href="http://169.254.1.3/kdevwiki/wikidocs/index.php?title=K3lconfig_-_User%27s_Guide&action=edit&redlink=1" class="new" title="K3lconfig - User's Guide (página não existe)">k3lconfig User's Guide</a></b>. For solving synchronization issues, check the <a href="#Troubleshooting" title="">Troubleshooting</a> section for manual configuration of the boards. <br /> </p> <a name="Endpoint_Configuration" id="Endpoint_Configuration"></a><h2> <span class="mw-headline"> Endpoint Configuration </span></h2> @@ -39,16 +39,21 @@ If you need to set advanced parameters of the board and/or signaling, the progra </li><li><b>context-gsm-call</b> (or <b>context-gsm</b>): Context of entry for GSM boards (the default is "khomp-CC-DD", where "DD" will be replaced at the time of connection by the device number, "CC" by channel number, and "SSSS" by the device serial number); </li><li><b>context-gsm-sms</b>: Context for incoming SMSs (the default is "khomp-sms-CC-DD", where "DD" will be replaced by the number of device, "CC" by channel number and "SSSS" by the device's serial number); </li><li><b>context-pr</b>: Context for incoming connections on boards KPR (default is "khomp-CC-DD", where "DD" will be replaced at the time of connection by the device number, "CC "by channel number); +</li><li><b>delay-ringback-co</b>: Sets the delay to enable the generation of call control tone (ringback) by the Endpoint Khomp when there is an ringback indication from signaling and there is no audio being sent by the channel which indicated the situation (local option); +</li><li><b>delay-ringback-pbx</b>: Sets the delay to enable the generation of call control tone (ringback) by the Endpoint Khomp when there is an ringback indication, and the audio has no tone (silence) (local option); </li><li><b>disconnect-delay</b>: Sets the time in milliseconds to perform processing a disconnect event, to ignore situations where other equipment performing the double service to overthrow collect calls (local option); +</li><li><b>drop-collect-call</b>: Enables/Disables the action of dropping collect calls. If enabled, all collect calls will be dropped no matter what KDropCollectCall is set to (the default value is "no"); </li><li><b>echo-canceller</b> (former 'echocanceller): Active ("yes") or disables ("no") echo cancellation automatic Endpoint (local option); +</li><li><b>flash-to-digits</b>: Defines the digits to be sent when the FLASH is detected on FXS channels; </li><li><b>fxo-send-pre-audio</b>: When enabled ("yes") releases audio channel before the outgoing call connection boards KFXO (the default value is "yes"); +</li><li><b>fxs-digit-timeout</b>: Defines the timeout, in seconds, between digits of a FXS board's extension; </li><li><b>fxs-global-orig</b>: Start number for sequencial branch numbering in FXS cards that are not listed in the <b>[fxs-branches]</b> section (the numbering follows ascending order from board number and physical channel number) (default is "0"); </li><li><b>fxs-co-dialtone</b>: Sequences of numbers, separated by commas, which fires a continuous tone (of central office) in FXS branches (eg: "0,99" means that, when you dial "0" or "99", the user will hear a continuous dial tone) (default is empty); </li><li><b>fxs-bina</b>: When enabled ("yes"), calls to FXS lines will send digits corresponding to the source phone identification using BINA DTMF signaling (the default value is "no") (local option); +</li><li><b>ignore-letter-dtmfs</b>: Defines if the channel should ignore some uncommon DTMF digits detected by the board (A, B, C and D). However, if you need to pass those digits througth the board, you may need to set this option to 'no' (the default value is "yes"); </li><li><b>input-volume</b>: Sets the volume gain for incoming audio (entering the board), from -10 to +10 (local option); </li><li><b>kommuter-activation</b>: Sets whether to activate devices kommuter found in the system will be done automatically ("auto") by the channel, or manually ("manual") by the user through the command "khomp kommuter on/off" </li><li><b>kommuter-timeout</b>: Sets the timeout (in seconds) for initializing the kommuter devices. If this timeout is reached without receiving notification of the channel, the devices will switch back to "off" condition. The minimum value is "0", where the links will always remain switched "on", and the maximum is "255"; -</li><li><b>language</b>: Set language to Khomp channel calls (local option); </li><li><b>log-to-console</b>: Set log messages to be printed on the console; </li><li><b>log-to-disk</b> (old "log"): Set log messages to be saved to disk; </li><li><b>out-of-band-DTMF</b> (former <b>dtmfsuppression</b>): Activate ("yes") or disables ("no") the removal and DTMF sending these out-of-band (local option); @@ -56,12 +61,9 @@ If you need to set advanced parameters of the board and/or signaling, the progra </li><li><b>pulse-forwarding</b> (former 'pulsedetection): Active ("yes") or disables ("no") for the detection of pulses and converting them into DTMF (local option); </li><li><b>r2-preconnect-wait</b> (former 'r2preconnectwait): Sets the timeout sending the ringback signaling, protocol R2/MFC to start sending audio silence. Only used when "r2-strict-Behavior" is set to "no" (local option); </li><li><b>r2-strict-Behaviour</b>: Enable ("yes") or disables ("no") the behavior of signaling R2/MFC as the standard sets. The default is "no", and can be changed to "yes" if needed to receive / send data precise signaling protocol (condition B, for example) (local option); -</li><li><b>ringback-delay-co</b>: Sets the delay to enable the generation of call control tone (ringback) by the Endpoint Khomp when there is an ringback indication from signaling and there is no audio being sent by the channel which indicated the situation (local option); -</li><li><b>ringback-delay-pbx</b>: Sets the delay to enable the generation of call control tone (ringback) by the Endpoint Khomp when there is an ringback indication, and the audio has no tone (silence) (local option); </li><li><b>suppression-delay</b> (former <b>suppressiondelay</b>): Activate ("yes") or disables ("no") the delay necessary to suppress DTMF. If disabled ("no"), also disables suppression of DTMF (local option); </li><li><b>trace</b>: Set debugging options. Should not be used in production unless absolutely necessary; -</li><li><b>user-transfer-digits</b>: Defines a sequence of DTMF digits to initiate the transfer between FreeSWITCH® and another PBX (using user signaling, like QSig or FXO FLASH). -</li><li><b>flash-to-digits</b>: Defines the digits to be sent when the FLASH is detected on FXS channels.. +</li><li><b>user-transfer-digits</b>: Defines a sequence of DTMF digits to initiate the transfer between FreeSWITCH® and another PBX (using user signaling, like QSig or FXO FLASH); </li></ul> <p><br /> </p> @@ -121,15 +123,13 @@ For details, please refer to the configuration file for examples. <ul><li>context; </li><li>input-volume; </li><li>output-volume; -</li><li>accountcode; </li><li>calleridnum; </li><li>calleridname; -</li><li>mailbox; </li><li>flash-to-digits. </li></ul> <p>Each option is separated from each other by a pipe "|" or a slash "/" and defined after the colon ":". Example: </p> -<pre><param name="200" value="language:en|context:master-branch" /> +<pre><param name="200" value="input-volume:1|context:master-branch" /> </pre> <p>For more information on the syntax and examples, please refer to the configuration file. </p><p>For more information visit the configuration file '<b>khomp.conf.xml'</b>. diff --git a/src/mod/endpoints/mod_khomp/docs/User_Guide.pdf b/src/mod/endpoints/mod_khomp/docs/User_Guide.pdf index 832596b..e0c33e1 100644 Binary files a/src/mod/endpoints/mod_khomp/docs/User_Guide.pdf and b/src/mod/endpoints/mod_khomp/docs/User_Guide.pdf differ diff --git a/src/mod/endpoints/mod_khomp/examples/intercept.xml b/src/mod/endpoints/mod_khomp/examples/intercept.xml new file mode 100644 index 0000000..5c91d7c --- /dev/null +++ b/src/mod/endpoints/mod_khomp/examples/intercept.xml @@ -0,0 +1,26 @@ +<include> + +<!-- ########################### FXS Context ############################### --> +<context name="khomp-fxs-00"> + + <extension name="main"> + <condition field="destination_number" expression="^(\d{4})$"> + <action application="set" data="called_party_callgroup=1"/> + <action application="db" data="insert/last_dial/${called_party_callgroup}/${uuid}"/> + <action application="bridge" data="khomp/r$1"/> + </condition> + </extension> + + <extension name="intercept"> + <condition field="destination_number" expression="^55$"> + <action application="answer"/> + <action application="set" data="intercept_unbridged_only=true"/> + <action application="intercept" data="${db(select/last_dial/1)}"/> + </condition> + </extension> + +</context> +<!-- ####################################################################### --> + +</include> + diff --git a/src/mod/endpoints/mod_khomp/examples/transfer.xml b/src/mod/endpoints/mod_khomp/examples/transfer.xml new file mode 100644 index 0000000..5c66633 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/examples/transfer.xml @@ -0,0 +1,43 @@ +<include> + +<!-- ########################### FXS Context ############################### --> +<context name="khomp-fxs-00"> + + <extension name="main"> + <condition field="destination_number" expression="^(\d{4})$"> + <action application="set" data="continue_on_fail=true"/> + <action application="set" data="dialed_extension=$1"/> + <action application="export" data="dialed_extension=$1"/> + <action application="bind_meta_app" data="1 b s execute_extension::attented_xfer XML khomp-features"/> + <action application="set" data="transfer_ringback=$${hold_music}"/> + <action application="set" data="call_timeout=10"/> + <action application="set" data="hangup_after_bridge=true"/> + <action application="bridge" data="khomp/r$1"/> + <action application="bridge" data="sofia/external/$1@169.1.1.1"/> + <action application="hangup"/> + </condition> + </extension> + +</context> +<!-- ####################################################################### --> +<!-- ########################## Features ################################### --> +<context name="khomp-features"> + + <extension name="attented_xfer"> + <condition field="destination_number" expression="^attented_xfer$"> + <action application="set" data="continue_on_fail=true"/> + <action application="set" data="ringback=${us-ring}"/> + + <action application="read" data="3 4 misc/8000/transfer1.wav attxfer_callthis 30000 #"/> + <action application="set" data="origination_cancel_key=#" /> + + <action application="att_xfer" data="khomp/r${attxfer_callthis}"/> + <action application="att_xfer" data="sofia/external/${attxfer_callthis}@169.1.1.1" /> + </condition> + </extension> + +</context> +<!-- ####################################################################### --> + +</include> + diff --git a/src/mod/endpoints/mod_khomp/include/applications.h b/src/mod/endpoints/mod_khomp/include/applications.h index 75f55ec..21b66b2 100644 --- a/src/mod/endpoints/mod_khomp/include/applications.h +++ b/src/mod/endpoints/mod_khomp/include/applications.h @@ -268,7 +268,7 @@ struct Transfer if (!(_call->_flags.check(Kflags::XFER_DIALING))) { _call->_flags.set(Kflags::XFER_DIALING); - _idx_xfer_dial = Board::board(_pvt->target().device)->_timers.add(Opt::_transferdigittimeout, &userXferTimer, _pvt, TM_VAL_CALL); + _idx_xfer_dial = Board::board(_pvt->target().device)->_timers.add(Opt::_options._transferdigittimeout(), &userXferTimer, _pvt, TM_VAL_CALL); } else { @@ -280,7 +280,7 @@ struct Transfer } } - catch (K3LAPI::invalid_device & err) + catch (K3LAPITraits::invalid_device & err) { LOG(ERROR, PVT_FMT(_pvt->target(), "Unable to get device: %d!") % err.device); } @@ -506,7 +506,7 @@ struct Transfer<T, false> if (!(_call->_flags.check(Kflags::XFER_DIALING) || _call->_flags.check(Kflags::XFER_QSIG_DIALING))) { _call->_flags.set(Kflags::XFER_DIALING); - _idx_xfer_dial = Board::board(_pvt->target().device)->_timers.add(Opt::_transferdigittimeout, &userXferTimer, _pvt, TM_VAL_CALL); + _idx_xfer_dial = Board::board(_pvt->target().device)->_timers.add(Opt::_options._transferdigittimeout(), &userXferTimer, _pvt, TM_VAL_CALL); } else { @@ -530,7 +530,7 @@ struct Transfer<T, false> } } - catch (K3LAPI::invalid_device & err) + catch (K3LAPITraits::invalid_device & err) { LOG(ERROR, PVT_FMT(_pvt->target(), "Unable to get device: %d!") % err.device); } @@ -735,6 +735,9 @@ struct Transfer<T, false> }; /*************************** SMS **********************************************/ +#define ESL_SMS_RECEIVED "khomp::sms_received" +#define ESL_SMS_SENT "khomp::sms_sent" + struct SMS : public Application { typedef std::list< switch_core_session_t *> OwnersList; @@ -889,6 +892,78 @@ struct SMS : public Application bool _conf; }; + static struct _SMSEvent : public ESL + { + + _SMSEvent() : ESL("khomp::sms") + { + if(_events) + { + _events->push_back(ESL_SMS_RECEIVED); + _events->push_back(ESL_SMS_SENT); + } + } + + ~_SMSEvent() + { + if(_events) + { + //Remove two from vector + _events->pop_back(); + _events->pop_back(); + } + } + + bool operator()(Board::KhompPvt * pvt, ReceiveData & data) + { + switch_event_t *event = create(ESL_SMS_RECEIVED); + + if(!event) + { + LOG(ERROR, "Cannot create SMS ESL"); + return false; + } + + add(event, pvt->target()); + add(event, "Type", data._type); + add(event, "From", data._from); + add(event, "Date", data._date); + add(event, "Size", data._size); + add(event, "Coding", data._coding); + add(event, "Serial", data._serial); + add(event, "Id", data._id); + add(event, "Page", data._page); + add(event, "Pages", data._pages); + add(event, "Sc_date", data._sc_date); + add(event, "Status", data._status); + add(event, "Body", data._body); + + return fire(&event); + } + + bool operator()(Board::KhompPvt * pvt, SendData & data) + { + switch_event_t *event = create(ESL_SMS_SENT); + + if(!event) + { + LOG(ERROR, "Cannot create SMS ESL"); + return false; + } + + add(event, pvt->target()); + add(event, "Dest", data._dest); + add(event, "Body", data._body); + add(event, "Confirmation?", (data._conf ? "Yes" : "No")); + + + return fire(&event); + } + + + + } SMSEvent; + struct Request { /* "empty" constructor */ diff --git a/src/mod/endpoints/mod_khomp/include/cli.h b/src/mod/endpoints/mod_khomp/include/cli.h index 214e2aa..bb251bb 100644 --- a/src/mod/endpoints/mod_khomp/include/cli.h +++ b/src/mod/endpoints/mod_khomp/include/cli.h @@ -99,12 +99,52 @@ struct Command std::string usage; /* usage of the command, a help */ }; +struct CommandXMLOutput : public Command +{ + void createRoot(const char *name) + { + root = switch_xml_new(name); + } + + void insertXML(switch_xml_t xml) + { + switch_xml_insert(xml,root,0); + } + + void clearRoot() + { + if(root) + { + switch_xml_free(root); + root = NULL; + } + } + + void printXMLOutput(switch_stream_handle_t *stream) + { + K::Logger::Logg2(C_CLI,stream,switch_xml_toxml(root,SWITCH_FALSE)); + } + + CommandXMLOutput() : root(NULL) {}; + + switch_xml_t root; /* for commands that ouput as xml */ +}; + struct Cli { /* Useful definitions --------------------------------------------------- */ typedef switch_status_t (APIFunc)(const char*, switch_core_session_t*, switch_stream_handle_t*); typedef std::vector<Command*> Commands; + /* Define the output types form commands */ + typedef enum + { + VERBOSE = 1, + CONCISE, + DETAILED, + XML + } OutputType; + /* register our commands, but you must create the command function */ static void registerCommands(APIFunc func,switch_loadable_module_interface_t **mod_int); @@ -145,27 +185,31 @@ struct Cli /* The Commands --------------------------------------------------------- */ /* khomp summary */ - static struct _KhompSummary : public Command + static struct _KhompSummary : public CommandXMLOutput { _KhompSummary(bool on_cli_term = true): - _on_cli_term(on_cli_term) + CommandXMLOutput(), + _on_cli_term(on_cli_term), + xdevs(NULL) { complete_name = "summary"; options.push_back("verbose"); options.push_back("concise"); + options.push_back("xml"); brief = "Print system info."; usage = \ "Prints detailed info about the system like API version and \n" \ "boards characteristics like DSPs version.\n\n" \ -"Usage: khomp summary [concise]"; +"Usage: khomp summary [concise|verbose|xml]"; _commands.push_back(this); }; bool execute(int argc, char *argv[]); - bool _on_cli_term; /* indicates if message is sent to fs_cli */ + bool _on_cli_term; /* indicates if message is sent to fs_cli */ + switch_xml_t xdevs; /* support xml needed to help the interation */ } KhompSummary; /* khomp show calls */ @@ -239,21 +283,22 @@ struct Cli } KhompChannelsUnblock; /* khomp show statistics */ - static struct _KhompShowStatistics : public Command + static struct _KhompShowStatistics : public CommandXMLOutput { - _KhompShowStatistics() + _KhompShowStatistics() : CommandXMLOutput(), xdevs(NULL) { complete_name = "show statistics"; options.push_back("verbose"); options.push_back("detailed"); + options.push_back("xml"); brief = "Shows statistics of the channels."; usage = \ "Shows statistics of the channels, like number of calls incoming \n" \ "and outgoing, status, status time.\n\n" \ -"Usage: khomp show statistics [{verbose [<board> [<channel>]]} | \n" \ +"Usage: khomp show statistics [{{verbose|xml} [<board> [<channel>]]} | \n" \ " {detailed <board> <channel>}]\n" \ "\tboard -- Number of the board (start from 0).\n" \ "\tchannel -- Number of the channel (start from 0).\n" \ @@ -274,20 +319,22 @@ struct Cli bool execute(int argc, char *argv[]); /* support functions */ - void cliStatistics(unsigned int device); - void cliDetailedStatistics(unsigned int device, unsigned int channel); + void cliStatistics(unsigned int device, OutputType output_type); + void cliDetailedStatistics(unsigned int device, unsigned int channel, OutputType output_type); + switch_xml_t xdevs; /* support xml needed to help the interation */ } KhompShowStatistics; /* khomp show channels */ - static struct _KhompShowChannels: public Command + static struct _KhompShowChannels: public CommandXMLOutput { - _KhompShowChannels() + _KhompShowChannels() : CommandXMLOutput(), xdev(NULL) { complete_name = "show channels"; options.push_back("verbose"); options.push_back("concise"); + options.push_back("xml"); brief = "Show all channels status."; usage = \ @@ -295,34 +342,40 @@ struct Cli "khomp API point of view.\n\n" \ "Usage: \n" \ "khomp show channels [{<board> [<channel>]} | \n" \ - "{{concise|verbose} [<board> [<channel>]]}]\n" \ + "{{concise|verbose|xml} [<board> [<channel>]]}]\n" \ "\tboard -- Number of the board (start from 0).\n" \ "e.g. khomp show channels - List status of all channels of all boards.\n" \ "e.g. khomp show channels concise 0 - List status of all channels of \n" \ -" board 0 in a concise way."; +" board 0 in a concise way.\n" \ +"e.g. khomp show channels xml 0 - List status of all channels of \n" \ +" board 0 in a xml structure."; _commands.push_back(this); }; /* support function for _KhompShowChannels */ - void showChannel(unsigned int device, bool concise, unsigned int channel); - void showChannels(unsigned int device, bool concise); + void showChannel(unsigned int device, unsigned int channel, OutputType output_type = Cli::VERBOSE); + void showChannels(unsigned int device, OutputType output_type = Cli::VERBOSE); bool execute(int argc, char *argv[]); + switch_xml_t xdev; /* support xml needed to help the interation */ + } KhompShowChannels; /* khomp show links */ - static struct _KhompShowLinks: public Command + static struct _KhompShowLinks: public CommandXMLOutput { - _KhompShowLinks() + _KhompShowLinks() : CommandXMLOutput(), xdev(NULL) { complete_name = "show links"; options.push_back("verbose"); options.push_back("concise"); + options.push_back("xml"); options.push_back("errors"); options.push_back("errors verbose"); options.push_back("errors concise"); + options.push_back("errors xml"); brief = "Show E1 link(s) status/errors counters in a concise \n" \ "way or not."; @@ -332,8 +385,9 @@ struct Cli "status/the error counters of each link on the board. It prints in \n" \ "a concise way for parsing facilities.\n\n" \ "Usage: \n" \ -"khomp show links [[errors] [{<board>} | {{concise|verbose} [<board>]}]]\n" \ +"khomp show links [[errors] [{<board>} | {{concise|verbose|xml} [<board>]}]]\n"\ "e.g. khomp show links - Show all links of all boards.\n" \ +"e.g. khomp show links xml - Show all links of all boards in xml.\n" \ "e.g. khomp show links errors - Show error counters of all links of \n" \ " all boards.\n" \ "e.g. khomp show links errors 0 - Show error counters of all links of \n" \ @@ -343,10 +397,12 @@ struct Cli }; /* support function for _KhompShowLinks */ - void showLinks(unsigned int device, bool concise); - void showErrors(unsigned int device, bool concise); + void showLinks(unsigned int device, OutputType output_type = Cli::VERBOSE); + void showErrors(unsigned int device, OutputType output_type = Cli::VERBOSE); + std::string getLinkStatus(int dev, int obj, Verbose::Presentation fmt); bool execute(int argc, char *argv[]); + switch_xml_t xdev; /* support xml needed to help the interation */ } KhompShowLinks; /* khomp clear links */ @@ -653,24 +709,41 @@ struct Cli { complete_name = "get"; + options.push_back("dialplan"); options.push_back("echo-canceller"); + options.push_back("auto-gain-control"); options.push_back("out-of-band-dtmfs"); + options.push_back("suppression-delay"); options.push_back("auto-fax-adjustment"); + options.push_back("fax-adjustment-timeout"); options.push_back("pulse-forwarding"); options.push_back("r2-strict-behaviour"); options.push_back("r2-preconnect-wait"); - options.push_back("native-bridge"); - options.push_back("suppression-delay"); - options.push_back("context-fxo"); - options.push_back("context-fxo-alt"); + options.push_back("context-digital"); options.push_back("context-fxs"); - options.push_back("context-fxs-alt"); + options.push_back("context-fxo"); options.push_back("context-gsm-call"); - options.push_back("context-gsm-call-alt"); options.push_back("context-gsm-sms"); - options.push_back("context-digital"); + options.push_back("context-pr"); + options.push_back("log-to-console"); + options.push_back("log-to-disk"); + options.push_back("trace"); options.push_back("output-volume"); options.push_back("input-volume"); + options.push_back("fxs-global-orig"); + options.push_back("fxs-co-dialtone"); + options.push_back("fxs-bina"); + options.push_back("disconnect-delay"); + options.push_back("delay-ringback-co"); + options.push_back("delay-ringback-pbx"); + options.push_back("ignore-letter-dtmfs"); + options.push_back("fxo-send-pre-audio"); + options.push_back("fxs-digit-timeout"); + options.push_back("drop-collect-call"); + options.push_back("kommuter-activation"); + options.push_back("kommuter-timeout"); + options.push_back("user-transfer-digits"); + options.push_back("flash-to-digits"); brief = "Get configuration options in the Khomp channel."; @@ -678,36 +751,37 @@ struct Cli "Usage: khomp get <option>\n" \ "<option> -- Shown below, with a short description each.\n\n" \ "Option Description\n" \ +"dialplan Gets the Name of the dialplan module in use.\n" \ "echo-canceller Gets the echo cancellation procedures if they are \n" \ -" avaliable.\n" \ +" avaliable.\n" \ +"auto-gain-control Gets the AGC procedures if they are avaliable.\n" \ "out-of-band-dtmfs Gets DTMFs to be sent out-of-band (using ast_frames) \n" \ -" instead of in-band (audio).\n" \ +" instead of in-band (audio).\n" \ +"suppression-delay Enable/disable the internal buffer for DTMF \n" \ +" suppression.\n" \ "auto-fax-adjustment Gets the automatic adjustment for FAX (mainly, \n" \ -" disables the echo canceller).\n" \ +" disables the echo canceller).\n" \ +//"fax-adjustment-timeout" "pulse-forwarding Gets the forwarding of detected pulses as DTMF tones.\n" \ "r2-strict-behaviour Gets the R2 protocol behavior while answering lines.\n" \ -"r2-preconnect-wait Sets the R2 protocol delay to pre-connect after \n" \ -" sending ringback signal.\n" \ -"native-bridge Enable/disable the native bridge mode for the channel.\n"\ -"suppression-delay Enable/disable the internal buffer for DTMF \n" \ -" suppression.\n" \ -"context-fxo Context (may be a template) for receiving FXO calls.\n" \ -"context-fxo-alt Alternative context (may be a template) for \n" \ -" receiving FXO calls.\n" \ +"r2-preconnect-wait Gets the R2 protocol delay to pre-connect after \n" \ +" sending ringback signal.\n" \ +"context-digital Context (may be a template) for receiving digital \n" \ +" (E1) calls.\n" \ "context-fxs Context (may be a template) for receiving FXS calls.\n" \ -"context-fxs-alt Alternative context (may be a template) for \n" \ -" receiving FXS calls.\n" \ +"context-fxo Context (may be a template) for receiving FXO calls.\n" \ "context-gsm-call Context (may be a template) for receiving GSM calls.\n" \ -"context-gsm-call-alt Alternative context (may be a template) for \n" \ -" receiving GSM calls.\n" \ "context-gsm-sms Context (may be a template) for receiving GSM \n" \ -" messages.\n" \ -"context-digital Context (may be a template) for receiving digital \n" \ -" (E1) calls.\n" \ +" messages.\n" \ +"context-pr Context (may be a template) for receiving calls on \n" \ +" Passive Record boards.\n" \ +"log-to-console Gets the logging of messages to console.\n" \ +"log-to-disk Gets the logging of messages to disk.\n" \ +"trace Gets the low level tracing.\n" \ "output-volume Gets the volume multiplier to be applied by the \n" \ -" board over the output audio.\n" \ +" board over the output audio.\n" \ "input-volume Gets the volume multiplier to be applied by the \n" \ -" board over the input audio.\n\n" \ +" board over the input audio.\n\n" \ "FOR ALL COMMANDS, CHECK THE DOCUMENTATION."; _commands.push_back(this); @@ -723,24 +797,42 @@ struct Cli { complete_name = "set"; + options.push_back("dialplan"); options.push_back("echo-canceller"); + options.push_back("auto-gain-control"); options.push_back("out-of-band-dtmfs"); + options.push_back("suppression-delay"); options.push_back("auto-fax-adjustment"); + options.push_back("fax-adjustment-timeout"); options.push_back("pulse-forwarding"); options.push_back("r2-strict-behaviour"); options.push_back("r2-preconnect-wait"); - options.push_back("native-bridge"); - options.push_back("suppression-delay"); - options.push_back("context-fxo"); - options.push_back("context-fxo-alt"); + options.push_back("context-digital"); options.push_back("context-fxs"); - options.push_back("context-fxs-alt"); + options.push_back("context-fxo"); options.push_back("context-gsm-call"); - options.push_back("context-gsm-call-alt"); options.push_back("context-gsm-sms"); - options.push_back("context-digital"); + options.push_back("context-pr"); + options.push_back("log-to-console"); + options.push_back("log-to-disk"); + options.push_back("trace"); options.push_back("output-volume"); options.push_back("input-volume"); + options.push_back("fxs-global-orig"); + options.push_back("fxs-co-dialtone"); + options.push_back("fxs-bina"); + options.push_back("disconnect-delay"); + options.push_back("delay-ringback-co"); + options.push_back("delay-ringback-pbx"); + options.push_back("ignore-letter-dtmfs"); + options.push_back("fxo-send-pre-audio"); + options.push_back("fxs-digit-timeout"); + options.push_back("drop-collect-call"); + options.push_back("kommuter-activation"); + options.push_back("kommuter-timeout"); + options.push_back("user-transfer-digits"); + options.push_back("flash-to-digits"); + brief = "Ajust configuration options in the Khomp channel."; usage = \ @@ -749,36 +841,36 @@ struct Cli "\t<value> -- Depends on the option. Check the documentation for \n" \ "\t more info.\n\n" \ "Option Description\n" \ +"dialplan Sets the Name of the dialplan module in use.\n" \ "echo-canceller Sets the echo cancellation procedures if they are \n" \ -" avaliable.\n" \ +" avaliable.\n" \ +"auto-gain-control Sets the AGC procedures if they are avaliable.\n" \ "out-of-band-dtmfs Sets DTMFs to be sent out-of-band (using ast_frames) \n" \ -" instead of in-band (audio).\n" \ +" instead of in-band (audio).\n" \ +"suppression-delay Enable/disable the internal buffer for DTMF \n" \ +" suppression.\n" \ "auto-fax-adjustment Sets the automatic adjustment for FAX (mainly, \n" \ -" disables the echo canceller).\n" \ +" disables the echo canceller).\n" \ "pulse-forwarding Sets the forwarding of detected pulses as DTMF tones.\n" \ "r2-strict-behaviour Sets the R2 protocol behavior while answering lines.\n" \ "r2-preconnect-wait Sets the R2 protocol delay to pre-connect after \n" \ -" sending ringback signal.\n" \ -"native-bridge Enable/disable the native bridge mode for the channel.\n"\ -"suppression-delay Enable/disable the internal buffer for DTMF \n" \ -" suppression.\n" \ -"context-fxo Context (may be a template) for receiving FXO calls.\n" \ -"context-fxo-alt Alternative context (may be a template) for \n" \ -" receiving FXO calls.\n" \ +" sending ringback signal.\n" \ +"context-digital Context (may be a template) for receiving digital \n" \ +" (E1) calls.\n" \ "context-fxs Context (may be a template) for receiving FXS calls.\n" \ -"context-fxs-alt Alternative context (may be a template) for \n" \ -" receiving FXS calls.\n" \ +"context-fxo Context (may be a template) for receiving FXO calls.\n" \ "context-gsm-call Context (may be a template) for receiving GSM calls.\n" \ -"context-gsm-call-alt Alternative context (may be a template) for \n" \ -" receiving GSM calls.\n" \ "context-gsm-sms Context (may be a template) for receiving GSM \n" \ -" messages.\n" \ -"context-digital Context (may be a template) for receiving digital \n" \ -" (E1) calls.\n" \ +" messages.\n" \ +"context-pr Context (may be a template) for receiving calls on \n" \ +" Passive Record boards.\n" \ +"log-to-console Sets the logging of messages to console.\n" \ +"log-to-disk Sets the logging of messages to disk.\n" \ +"trace Sets the low level tracing.\n" \ "output-volume Sets the volume multiplier to be applied by the \n" \ -" board over the output audio.\n" \ +" board over the output audio.\n" \ "input-volume Sets the volume multiplier to be applied by the \n" \ -" board over the input audio.\n\n" \ +" board over the input audio.\n\n" \ "FOR ALL COMMANDS, CHECK THE DOCUMENTATION."; _commands.push_back(this); diff --git a/src/mod/endpoints/mod_khomp/include/defs.h b/src/mod/endpoints/mod_khomp/include/defs.h index f296882..bcd5c3c 100644 --- a/src/mod/endpoints/mod_khomp/include/defs.h +++ b/src/mod/endpoints/mod_khomp/include/defs.h @@ -58,10 +58,10 @@ "%s (d=%02d,c=%03d) " msg, __SWITCH_FUNC__, dev, obj #define PVT_FMT(tgt,msg) \ - FMT("%s (d=%02hu,c=%03hu) " msg) % __SWITCH_FUNC__ % tgt.device % tgt.object + FMT("%s (d=%02d,c=%03d) " msg) % __SWITCH_FUNC__ % tgt.device % tgt.object #define PVT_MSG(tgt,msg) \ - "%s (d=%02hu,c=%03hu) " msg, __SWITCH_FUNC__, tgt.device, tgt.object + "%s (d=%02d,c=%03d) " msg, __SWITCH_FUNC__, tgt.device, tgt.object #define D(x) ( FMT( "%s: " x ) % __func__ ) diff --git a/src/mod/endpoints/mod_khomp/include/frame.h b/src/mod/endpoints/mod_khomp/include/frame.h index 87b968b..8337f37 100644 --- a/src/mod/endpoints/mod_khomp/include/frame.h +++ b/src/mod/endpoints/mod_khomp/include/frame.h @@ -97,7 +97,7 @@ struct FrameStorage template < int S > struct FrameManager: protected FrameStorage { - typedef char Packet[ S ]; + typedef const char Packet[ S ]; typedef Ringbuffer < Packet > AudioBuffer; diff --git a/src/mod/endpoints/mod_khomp/include/globals.h b/src/mod/endpoints/mod_khomp/include/globals.h index f212d63..a807273 100644 --- a/src/mod/endpoints/mod_khomp/include/globals.h +++ b/src/mod/endpoints/mod_khomp/include/globals.h @@ -98,7 +98,9 @@ struct Globals static Mutex khomp_alloc_mutex; /* Config options class */ - static ConfigOptions options; + static Config::Options options; + + static const Regex::Expression regex_allocation; /* FreeSWITCH Articular Ligaments */ static switch_endpoint_interface_t * khomp_endpoint_interface; diff --git a/src/mod/endpoints/mod_khomp/include/khomp_pvt.h b/src/mod/endpoints/mod_khomp/include/khomp_pvt.h index bed6e1e..d09be88 100644 --- a/src/mod/endpoints/mod_khomp/include/khomp_pvt.h +++ b/src/mod/endpoints/mod_khomp/include/khomp_pvt.h @@ -221,6 +221,37 @@ struct KhompPvt return strBuffer; } + switch_xml_t getDetailedXML() + { + /* very very important yet! */ + idle(); + + std::string str_incoming_time = timeToString(_total_time_incoming); + std::string str_outgoing_time = timeToString(_total_time_outgoing); + std::string str_idle_time = timeToString(_total_idle_time); + + /* total */ + switch_xml_t xtotal = switch_xml_new("total"); + + /* total/incoming_time */ + switch_xml_t xin_time = switch_xml_add_child_d(xtotal,"incoming_time",0); + switch_xml_set_txt_d(xin_time, str_incoming_time.c_str()); + + /* total/outgoing_time */ + switch_xml_t xout_time = switch_xml_add_child_d(xtotal,"outgoing_time",0); + switch_xml_set_txt_d(xout_time, str_outgoing_time.c_str()); + + /* total/idle_time */ + switch_xml_t xidle_time = switch_xml_add_child_d(xtotal,"idle_time",0); + switch_xml_set_txt_d(xidle_time, str_idle_time.c_str()); + + /* total/channel_fails */ + switch_xml_t xchannel_fails = switch_xml_add_child_d(xtotal,"channel_fails",0); + switch_xml_set_txt_d(xchannel_fails, STR(FMT("%d") % _channel_fails)); + + return xtotal; + } + void clear() { time(&_base_time); @@ -373,7 +404,7 @@ struct KhompPvt public: /* KhompPvt constructor */ - KhompPvt(K3LAPI::target & target); + KhompPvt(K3LAPIBase::GenericTarget & target); /* KhompPvt destructor */ virtual ~KhompPvt() @@ -388,8 +419,14 @@ public: _pvt(pvt) {} std::string getDetailedRates(); + switch_xml_t getDetailedRatesXML(); + std::string getDetailed(); + switch_xml_t getDetailedXML(); + std::string getRow(); + switch_xml_t getNode(); + void clear() { @@ -569,6 +606,7 @@ public: /* statistics functions */ virtual std::string getStatistics(Statistics::Type type); + virtual switch_xml_t getStatisticsXML(Statistics::Type type); virtual void clearStatistics() { _pvt_statistics->clear(); @@ -649,7 +687,7 @@ public: return pvt_locked; } - K3LAPI::target & target() + K3LAPIBase::GenericTarget & target() { return _target; } @@ -996,18 +1034,20 @@ public: { DBG(FUNC,PVT_FMT(_target,"c")); + /* if(!_group_context.empty()) { contexts.insert(contexts.begin(), _group_context); //contexts.push_back(_group_context); } + */ for (MatchExtension::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) replaceTemplate((*i), "DD", _target.device); BEGIN_CONTEXT { - K3L_DEVICE_CONFIG & dev_cfg = Globals::k3lapi.device_config(_target.device); + const K3L_DEVICE_CONFIG & dev_cfg = Globals::k3lapi.device_config(_target); for (MatchExtension::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) replaceTemplate((*i), "SSSS", atoi(dev_cfg.SerialNumber)); @@ -1048,7 +1088,7 @@ public: Call * call() { return _call; } - K3LAPI::target _target; /*!< The device/channel pair to bind this pvt to */ + K3LAPIBase::GenericTarget _target; /*!< The device/channel pair to bind this pvt to */ ChanLockType _mutex; /*!< Used for *our* internal locking */ Call *_call; switch_core_session_t *_session; /*!< The session to which this pvt is associated with */ @@ -1066,6 +1106,10 @@ public: std::string _group_context; PvtStatistics *_pvt_statistics; + + std::string _mohclass; + std::string _language; + std::string _accountcode; }; /******************************************************************************/ @@ -1115,7 +1159,7 @@ public: } catch (...) { - throw K3LAPI::invalid_channel(_device_id, obj); + throw K3LAPITraits::invalid_channel(_device_id, obj); } } @@ -1141,7 +1185,7 @@ public: { ret = channel(obj)->eventHandler(e); } - catch (K3LAPI::invalid_channel & invalid) + catch (K3LAPITraits::invalid_channel & invalid) { LOG(ERROR, OBJ_FMT(_device_id,obj,"(Generic Board) r (invalid channel on event '%s')") % Verbose::eventName(e->Code).c_str()); @@ -1191,7 +1235,7 @@ public: \return KhompPvt to be used on the call. */ static KhompPvt * find_channel(char* allocation_string, switch_core_session_t * new_session, switch_call_cause_t * cause); - static void khomp_add_event_board_data(const K3LAPI::target target, switch_event_t *event); + static void khomp_add_event_board_data(const K3LAPIBase::GenericTarget target, switch_event_t *event); static Board * board(int dev) { @@ -1208,7 +1252,7 @@ public: } catch(...) { - throw K3LAPI::invalid_device(dev); + throw K3LAPITraits::invalid_device(dev); } } @@ -1223,11 +1267,11 @@ public: } catch(...) { - throw K3LAPI::invalid_channel(device, object); + throw K3LAPITraits::invalid_channel(device, object); } } - static KhompPvt * get(K3LAPI::target & target) + static KhompPvt * get(K3LAPIBase::GenericTarget & target) { //if (!Globals::k3lapi.valid_channel(target.device, target.object)) // throw K3LAPI::invalid_channel(target.device, target.object); @@ -1252,7 +1296,7 @@ public: { stats = Globals::k3lapi.channel_stats(device, object, index); } - catch(K3LAPI::invalid_channel & err) + catch(K3LAPITraits::invalid_channel & err) { //K::logger::logg(C_WARNING, B(dev,channel, "Command get_stats has failed with error '%s'.") % // Verbose::status((KLibraryStatus) stt_res)); diff --git a/src/mod/endpoints/mod_khomp/include/khomp_pvt_fxo.h b/src/mod/endpoints/mod_khomp/include/khomp_pvt_fxo.h index 130c3b3..d91705b 100644 --- a/src/mod/endpoints/mod_khomp/include/khomp_pvt_fxo.h +++ b/src/mod/endpoints/mod_khomp/include/khomp_pvt_fxo.h @@ -114,7 +114,7 @@ struct KhompPvtFXO: public KhompPvt _call_info_report = false; _call_info_drop = 0; - _user_xfer_digits = Opt::_user_xfer; + _user_xfer_digits = Opt::_options._user_xfer_digits(); _user_xfer_buffer.clear(); _digits_buffer.clear(); @@ -141,7 +141,7 @@ struct KhompPvtFXO: public KhompPvt //ChanTimer::Index _idx_disconnect; }; /******************************************************************************/ - KhompPvtFXO(K3LAPI::target & target) : KhompPvt(target) + KhompPvtFXO(K3LAPIBase::GenericTarget & target) : KhompPvt(target) { _fax = new Fax(this); _transfer = new Transfer<CallFXO>(this); @@ -323,7 +323,7 @@ struct KhompPvtFXO: public KhompPvt for (unsigned obj = 0; obj < Globals::k3lapi.channel_count(_device_id); obj++) { - K3LAPI::target tgt(Globals::k3lapi, K3LAPI::target::CHANNEL, _device_id, obj); + K3LAPIBase::GenericTarget tgt(Globals::k3lapi, K3LAPIBase::GenericTarget::CHANNEL, _device_id, obj); KhompPvt * pvt; switch(Globals::k3lapi.channel_config(_device_id, obj).Signaling) diff --git a/src/mod/endpoints/mod_khomp/include/khomp_pvt_gsm.h b/src/mod/endpoints/mod_khomp/include/khomp_pvt_gsm.h index d31dba5..7467a5e 100644 --- a/src/mod/endpoints/mod_khomp/include/khomp_pvt_gsm.h +++ b/src/mod/endpoints/mod_khomp/include/khomp_pvt_gsm.h @@ -115,7 +115,7 @@ struct KhompPvtGSM: public KhompPvt }; /******************************************************************************/ - KhompPvtGSM(K3LAPI::target & target) : KhompPvt(target) + KhompPvtGSM(K3LAPIBase::GenericTarget & target) : KhompPvt(target) { _sms = new SMS(this); command(KHOMP_LOG, CM_ENABLE_CALL_ANSWER_INFO); @@ -278,7 +278,7 @@ struct KhompPvtGSM: public KhompPvt for (unsigned obj = 0; obj < Globals::k3lapi.channel_count(_device_id); obj++) { - K3LAPI::target tgt(Globals::k3lapi, K3LAPI::target::CHANNEL, _device_id, obj); + K3LAPIBase::GenericTarget tgt(Globals::k3lapi, K3LAPIBase::GenericTarget::CHANNEL, _device_id, obj); KhompPvt * pvt; switch(Globals::k3lapi.channel_config(_device_id, obj).Signaling) diff --git a/src/mod/endpoints/mod_khomp/include/khomp_pvt_kxe1.h b/src/mod/endpoints/mod_khomp/include/khomp_pvt_kxe1.h index 722bd80..0267f33 100644 --- a/src/mod/endpoints/mod_khomp/include/khomp_pvt_kxe1.h +++ b/src/mod/endpoints/mod_khomp/include/khomp_pvt_kxe1.h @@ -122,7 +122,7 @@ struct KhompPvtE1: public KhompPvt }; /******************************************************************************/ - KhompPvtE1(K3LAPI::target & target) : KhompPvt(target) + KhompPvtE1(K3LAPIBase::GenericTarget & target) : KhompPvt(target) { _fax = new Fax(this); command(KHOMP_LOG,CM_ENABLE_CALL_ANSWER_INFO); @@ -219,7 +219,7 @@ struct KhompPvtE1: public KhompPvt { Board::board(_target.device)->_timers.del(callE1()->_idx_disconnect); } - catch (K3LAPI::invalid_device & err) + catch (K3LAPITraits::invalid_device & err) { LOG(ERROR, PVT_FMT(target(), "Unable to get device: %d!") % err.device); } @@ -310,7 +310,7 @@ struct KhompPvtISDN: public KhompPvtE1 _uui_information.clear(); _isdn_cause = -1; - _user_xfer_digits = Opt::_user_xfer; + _user_xfer_digits = Opt::_options._user_xfer_digits(); _user_xfer_buffer.clear(); _digits_buffer.clear(); _qsig_number.clear(); @@ -332,7 +332,7 @@ struct KhompPvtISDN: public KhompPvtE1 }; /******************************************************************************/ - KhompPvtISDN(K3LAPI::target & target) : KhompPvtE1(target) + KhompPvtISDN(K3LAPIBase::GenericTarget & target) : KhompPvtE1(target) { _transfer = new Transfer<CallISDN, false>(this); } @@ -496,7 +496,7 @@ struct KhompPvtR2: public KhompPvtE1 std::string _incoming_exten; }; /******************************************************************************/ - KhompPvtR2(K3LAPI::target & target) : KhompPvtE1(target) + KhompPvtR2(K3LAPIBase::GenericTarget & target) : KhompPvtE1(target) { K3L_E1600A_FW_CONFIG dspAcfg; @@ -672,7 +672,7 @@ struct KhompPvtFlash: public KhompPvtR2 bool clear() { - _user_xfer_digits = Opt::_user_xfer; + _user_xfer_digits = Opt::_options._user_xfer_digits(); _user_xfer_buffer.clear(); _digits_buffer.clear(); @@ -686,7 +686,7 @@ struct KhompPvtFlash: public KhompPvtR2 }; /******************************************************************************/ - KhompPvtFlash(K3LAPI::target & target) : KhompPvtR2(target) + KhompPvtFlash(K3LAPIBase::GenericTarget & target) : KhompPvtR2(target) { _transfer = new Transfer<CallFlash>(this); } @@ -796,7 +796,7 @@ struct KhompPvtFXS: public KhompPvt } else if (name == "ring_cadence") { - Opt::CadencesMapType::iterator i = Opt::_cadences.find(value); + CadencesMapType::iterator i = Opt::_cadences.find(value); if (i != Opt::_cadences.end()) { @@ -858,11 +858,11 @@ struct KhompPvtFXS: public KhompPvt }; /******************************************************************************/ - KhompPvtFXS(K3LAPI::target & target) : KhompPvt(target) + KhompPvtFXS(K3LAPIBase::GenericTarget & target) : KhompPvt(target) { //command(KHOMP_LOG,CM_ENABLE_CALL_ANSWER_INFO); /* sequence numbers on FXS */ - static Opt::OrigToNseqMapType fxs_nseq = generateNseqMap(); + static OrigToNseqMapType fxs_nseq = generateNseqMap(); load(fxs_nseq); } @@ -926,7 +926,7 @@ struct KhompPvtFXS: public KhompPvt } bool setupConnection(); - void load(Opt::OrigToNseqMapType & fxs_nseq); + void load(OrigToNseqMapType & fxs_nseq); void loadOptions(); bool parseBranchOptions(std::string options_str); bool alloc(); @@ -991,13 +991,10 @@ struct KhompPvtFXS: public KhompPvt std::string _context; int _input_volume; int _output_volume; - std::string _mohclass; - std::string _language; - std::string _accountcode; std::string _mailbox; std::string _flash; - static Opt::OrigToNseqMapType generateNseqMap(); + static OrigToNseqMapType generateNseqMap(); static void dialTimer(KhompPvt * pvt); static void transferTimer(KhompPvt * pvt); @@ -1044,7 +1041,7 @@ struct KhompPvtFXS: public KhompPvt for (unsigned obj = 0; obj < Globals::k3lapi.channel_count(_device_id); obj++) { - K3LAPI::target tgt(Globals::k3lapi, K3LAPI::target::CHANNEL, _device_id, obj); + K3LAPIBase::GenericTarget tgt(Globals::k3lapi, K3LAPIBase::GenericTarget::CHANNEL, _device_id, obj); KhompPvt * pvt; switch(Globals::k3lapi.channel_config(_device_id, obj).Signaling) diff --git a/src/mod/endpoints/mod_khomp/include/khomp_pvt_passive.h b/src/mod/endpoints/mod_khomp/include/khomp_pvt_passive.h index a0a6df0..1fa23cd 100644 --- a/src/mod/endpoints/mod_khomp/include/khomp_pvt_passive.h +++ b/src/mod/endpoints/mod_khomp/include/khomp_pvt_passive.h @@ -81,7 +81,7 @@ struct KhompPvtPassive: public KhompPvt }; */ /******************************************************************************/ - KhompPvtPassive(K3LAPI::target & target) : KhompPvt(target) + KhompPvtPassive(K3LAPIBase::GenericTarget & target) : KhompPvt(target) { } @@ -150,7 +150,7 @@ struct KhompPvtPassive: public KhompPvt /********************************** HI Channel ********************************/ struct KhompPvtHI: public KhompPvtPassive { - KhompPvtHI(K3LAPI::target & target) : KhompPvtPassive(target) + KhompPvtHI(K3LAPIBase::GenericTarget & target) : KhompPvtPassive(target) { } @@ -189,7 +189,7 @@ struct KhompPvtHI: public KhompPvtPassive /********************************* KPR Channel ********************************/ struct KhompPvtKPR: public KhompPvtPassive { - KhompPvtKPR(K3LAPI::target & target) : KhompPvtPassive(target) + KhompPvtKPR(K3LAPIBase::GenericTarget & target) : KhompPvtPassive(target) { } @@ -243,7 +243,7 @@ struct KhompPvtKPR: public KhompPvtPassive for (unsigned obj = 0; obj < Globals::k3lapi.channel_count(_device_id); obj++) { - K3LAPI::target tgt(Globals::k3lapi, K3LAPI::target::CHANNEL, _device_id, obj); + K3LAPIBase::GenericTarget tgt(Globals::k3lapi, K3LAPIBase::GenericTarget::CHANNEL, _device_id, obj); KhompPvt * pvt; switch(Globals::k3lapi.channel_config(_device_id, obj).Signaling) diff --git a/src/mod/endpoints/mod_khomp/include/opt.h b/src/mod/endpoints/mod_khomp/include/opt.h index 3458f9e..270adc7 100644 --- a/src/mod/endpoints/mod_khomp/include/opt.h +++ b/src/mod/endpoints/mod_khomp/include/opt.h @@ -47,9 +47,32 @@ #include <string> #include <map> #include <vector> + +#include <config_options.hpp> + #include "switch.h" #include "utils.h" +typedef std::map < std::string, std::string > OrigToDestMapType; +typedef std::pair < std::string, std::string > OrigToDestPairType; +typedef std::vector < std::string > DestVectorType; + +typedef std::map < unsigned int, std::string > BoardToOrigMapType; +typedef std::pair < unsigned int, std::string > BoardToOrigPairType; + +typedef std::map < std::string, unsigned int > OrigToNseqMapType; +typedef std::pair < std::string, unsigned int > OrigToNseqPairType; + +typedef std::pair < unsigned int,unsigned int > ObjectIdType; +typedef std::pair < std::string, ObjectIdType > BranchToObjectPairType; +typedef std::map < std::string, ObjectIdType > BranchToObjectMapType; + +typedef std::map < std::string, std::string > BranchToOptMapType; +typedef std::pair < std::string, std::string > BranchToOptPairType; + +typedef std::map < std::string, std::string > GroupToDestMapType; +typedef std::pair < std::string, std::string > GroupToDestPairType; + struct CadenceType { CadenceType(void) @@ -67,182 +90,171 @@ struct CadenceType unsigned int ring_ext_s; }; -struct CSpan { - std::string _dialplan; - std::string _context; - std::string _dialstring; +typedef std::pair < std::string, CadenceType > CadencesPairType; +typedef std::map < std::string, CadenceType > CadencesMapType; + +struct Options +{ + Config::Value< bool > _debug; + Config::Value< std::string > _dialplan; + Config::Value< std::string > _context; + + Config::Value< bool > _echo_canceller; + Config::Value< bool > _auto_gain_control; + Config::Value< bool > _out_of_band_dtmfs; + Config::Value< bool > _suppression_delay; + Config::Value< bool > _pulse_forwarding; + Config::Value< bool > _native_bridge; + Config::Value< bool > _recording; + Config::Value< bool > _has_ctbus; + Config::Value< bool > _fxs_bina; + Config::Value< bool > _fxo_send_pre_audio; + Config::Value< bool > _drop_collect_call; + Config::Value< bool > _ignore_letter_dtmfs; + Config::Value< bool > _optimize_audio_path; + + Config::Value< bool > _auto_fax_adjustment; + Config::Value< unsigned int > _fax_adjustment_timeout; + + Config::Value< bool > _r2_strict_behaviour; + Config::Value< unsigned int > _r2_preconnect_wait; + + Config::Value< unsigned int > _fxs_digit_timeout; + Config::Value< unsigned int > _transferdigittimeout; + + Config::Value< std::string > _flash; + Config::Value< std::string > _blindxfer; + Config::Value< std::string > _atxfer; + + Config::Value< unsigned int > _ringback_co_delay; + Config::Value< unsigned int > _ringback_pbx_delay; + + Config::Value< unsigned int > _disconnect_delay; + + Config::Value< int > _input_volume; + Config::Value< int > _output_volume; + + struct CentralOfficeDialtone : public Config::FunctionValue + { + void operator ()(const Config::StringType &); + const DestVectorType & operator()(void) const { return _value; }; + void clear(void) + { + _value.clear(); + } + + protected: + DestVectorType _value; + } _fxs_co_dialtone; + + struct LogDiskOption : public Config::FunctionValue + { + void operator ()(const Config::StringType &); + } _log_disk_option; + + /* + struct CallGroupOption: public Config::FunctionValue + { + void operator ()(const Config::StringType &); + const std::string operator()(void) const { return _groups; }; + protected: + std::string _groups; + } _callgroup; + + struct PickupGroupOption: public Config::FunctionValue + { + void operator ()(const Config::StringType &); + const std::string operator()(void) const { return _groups; }; + protected: + std::string _groups; + } _pickupgroup; // or intercept + */ + + struct LogConsoleOption : public Config::FunctionValue + { + void operator ()(const Config::StringType &); + } _log_console_option; + + struct LogTraceOption : public Config::FunctionValue + { + void operator ()(const Config::StringType &); + } _log_trace_option; + + struct RecordPrefixOption: public Config::FunctionValue + { + void operator ()(const Config::StringType &); + const std::string & operator()(void) const { return _value; }; + + protected: + std::string _value; + } _record_prefix; + + Config::Value< std::string > _user_xfer_digits; + Config::Value< std::string > _fxs_global_orig_base; + + Config::Value< std::string > _global_mohclass; + Config::Value< std::string > _global_language; + + Config::Value< std::string > _context_gsm_call; + Config::Value< std::string > _context2_gsm_call; + Config::Value< std::string > _context_gsm_sms; + Config::Value< std::string > _context_fxo; + Config::Value< std::string > _context2_fxo; + Config::Value< std::string > _context_fxs; + Config::Value< std::string > _context2_fxs; + Config::Value< std::string > _context_digital; + Config::Value< std::string > _context_pr; + + Config::Value< std::string > _callgroup; + Config::Value< std::string > _pickupgroup; /* or intercept */ + Config::Value< std::string > _accountcode; + + Config::Value< unsigned int > _kommuter_timeout; + Config::Value< std::string > _kommuter_activation; + + Config::Value< unsigned int > _audio_packet_size; }; struct Opt { - typedef std::pair < std::string, CadenceType > CadencesPairType; - typedef std::map < std::string, CadenceType > CadencesMapType; + /* here we load [cadences] */ + static CadencesMapType _cadences; - typedef std::map < std::string, std::string > OrigToDestMapType; - typedef std::pair < std::string, std::string > OrigToDestPairType; - typedef std::vector < std::string > DestVectorType; + /* here we load [groups] */ + static GroupToDestMapType _groups; - typedef std::map < unsigned int, std::string > BoardToOrigMapType; - typedef std::pair < unsigned int, std::string > BoardToOrigPairType; + /* here we load [fxs-hotlines] */ + static OrigToDestMapType _fxs_hotline; - typedef std::map < std::string, unsigned int > OrigToNseqMapType; - typedef std::pair < std::string, unsigned int > OrigToNseqPairType; + /* here we load [fxs-branches] */ + static BoardToOrigMapType _fxs_orig_base; - typedef std::pair < unsigned int,unsigned int > ObjectIdType; - typedef std::pair < std::string, ObjectIdType > BranchToObjectPairType; - typedef std::map < std::string, ObjectIdType > BranchToObjectMapType; + /* here we load [fxs-options] */ + static BranchToOptMapType _branch_options; - typedef std::map < std::string, std::string > BranchToOptMapType; - typedef std::pair < std::string, std::string > BranchToOptPairType; - - typedef std::map < std::string, std::string > GroupToDestMapType; - typedef std::pair < std::string, std::string > GroupToDestPairType; - - typedef std::pair < std::string, CSpan > SpanPairType; + /* here we load ... hannnn */ + static BranchToObjectMapType _fxs_branch_map; - typedef enum - { - GFLAG_MY_CODEC_PREFS = (1 << 0) - } - GFLAGS; + static Options _options; + /* Member functions */ static void initialize(void); static void obtain(void); static void commit(void); - static void printConfiguration(switch_stream_handle_t*); -protected: + //TODO: reload options at reloadxml ? + static void reload(void); + protected: static void loadConfiguration(const char *, const char **, bool show_errors = true); static void cleanConfiguration(void); - + static switch_xml_t processSimpleXML(switch_xml_t &xml, const std::string& child_name); static void processGroupXML(switch_xml_t &xml); static void processCadenceXML(switch_xml_t &xml); static void processFXSBranchesXML(switch_xml_t &xml); static void processFXSHotlines(switch_xml_t &xml); static void processFXSOptions(switch_xml_t &xml); - -public: - static bool _debug; - static std::string _dialplan; - static std::string _context; - static std::map < std::string, CSpan > _spans; - static GroupToDestMapType _groups; - static CadencesMapType _cadences; - - static bool _echo_canceller; - static bool _auto_gain_control; - static bool _out_of_band_dtmfs; - static bool _suppression_delay; - static bool _pulse_forwarding; - static bool _native_bridge; - static bool _recording; - static bool _has_ctbus; - static bool _fxs_bina; - static bool _fxo_send_pre_audio; - static bool _drop_collect_call; - static bool _ignore_letter_dtmfs; - static bool _optimize_audio_path; - - static bool _auto_fax_adjustment; - static unsigned int _fax_adjustment_timeout; - - static bool _r2_strict_behaviour; - static unsigned int _r2_preconnect_wait; - - static unsigned int _fxs_digit_timeout; - - static unsigned int _transferdigittimeout; - - static std::string _flash; - static std::string _blindxfer; - static std::string _atxfer; - - static unsigned int _ringback_co_delay; - static unsigned int _ringback_pbx_delay; - - static unsigned int _disconnect_delay; - - static int _input_volume; - static int _output_volume; - - static DestVectorType _fxs_co_dialtone; - static OrigToDestMapType _fxs_hotline; - static std::string _fxs_global_orig_base; - - static BoardToOrigMapType _fxs_orig_base; - static BranchToObjectMapType _fxs_branch_map; - static BranchToOptMapType _branch_options; - - static std::string _global_mohclass; - static std::string _global_language; - - static std::string _record_prefix; - - static std::string _context_gsm_call; - static std::string _context2_gsm_call; - static std::string _context_gsm_sms; - static std::string _context_fxo; - static std::string _context2_fxo; - static std::string _context_fxs; - static std::string _context2_fxs; - static std::string _context_digital; - static std::string _context_pr; - static std::string _user_xfer; - - static int _amaflags; - static std::string _callgroup; - static std::string _pickupgroup; /* or intercept */ - - static std::string _accountcode; - - static unsigned int _kommuter_timeout; - static std::string _kommuter_activation; - - static unsigned int _audio_packet_size; - -protected: - - struct ProcessFXSCODialtone - { - void operator()(std::string options); - }; - - struct ProcessRecordPrefix - { - void operator()(std::string path); - }; - - struct ProcessAMAFlags - { - void operator()(std::string options); - }; - - struct ProcessCallGroup - { - void operator()(std::string options); - }; - - struct ProcessPickupGroup - { - void operator()(std::string options); - }; - - struct ProcessLogOptions - { - ProcessLogOptions(output_type output): _output(output) {}; - - void operator()(std::string options); - - protected: - output_type _output; - }; - - struct ProcessTraceOptions - { - void operator()(std::string options); - }; }; diff --git a/src/mod/endpoints/mod_khomp/include/revision.h b/src/mod/endpoints/mod_khomp/include/revision.h index fe9ef9e..b0ace1a 100644 --- a/src/mod/endpoints/mod_khomp/include/revision.h +++ b/src/mod/endpoints/mod_khomp/include/revision.h @@ -1 +1 @@ -#define MOD_KHOMP_VERSION "1.0 - (rev: 5841)" +#define MOD_KHOMP_VERSION "1.0 - (rev: 5891)" diff --git a/src/mod/endpoints/mod_khomp/include/spec.h b/src/mod/endpoints/mod_khomp/include/spec.h index 119607b..cf788f6 100644 --- a/src/mod/endpoints/mod_khomp/include/spec.h +++ b/src/mod/endpoints/mod_khomp/include/spec.h @@ -63,15 +63,8 @@ typedef enum SpecFlagType; typedef unsigned int SpecFlagsType; - - typedef Function::Function3 < bool, unsigned int, unsigned int, SpecFlagsType & > SpecFunType; - -//SpecRetType processSpecAtom(std::string &, SpecFlagsType &, SpecFunType &); -//SpecRetType processSpecAtoms(std::string &, SpecFlagsType &, SpecFunType &); -//bool processCallChannelString(std::string &, Board::KhompPvt *&, int *, bool need_free = true); - /* Request a Board::KhompPvt based on dialplan string. -- Format of dialplan string. -- diff --git a/src/mod/endpoints/mod_khomp/include/utils.h b/src/mod/endpoints/mod_khomp/include/utils.h index 0c71a74..0c59241 100644 --- a/src/mod/endpoints/mod_khomp/include/utils.h +++ b/src/mod/endpoints/mod_khomp/include/utils.h @@ -687,7 +687,97 @@ struct Statistics virtual std::string getDetailed() { return ""; } virtual void clear() {} }; +/******************************************************************************/ +/****************************** ESL - Events **********************************/ + +struct ESL +{ + + typedef std::vector <std::string> VectorEvents; + + ESL(std::string type); + + ~ESL(); + + switch_event_t * create(const std::string type) + { + switch_event_t *event; + + if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, type.c_str()) != SWITCH_STATUS_SUCCESS) + { + return NULL; + } + + return event; + } + + switch_event_t * create() + { + return create(_type); + } + + bool add(switch_event_t *event, const std::string key, + const std::string value) const + { + if(!event) return false; + + switch_status_t res = switch_event_add_header_string(event, + SWITCH_STACK_BOTTOM, + key.c_str(), + value.c_str()); + + return (res == SWITCH_STATUS_SUCCESS ? true : false); + } + + bool add(switch_event_t *event, K3LAPIBase::GenericTarget & target) + { + bool ok = add(event, "Device", STR(FMT("%d") % target.device)); + + if(!ok) + return ok; + + std::string type; + + switch(target.type) + { + case K3LAPIBase::GenericTarget::CHANNEL: + type = "Channel"; + break; + case K3LAPIBase::GenericTarget::MIXER: + type = "Mixer"; + break; + case K3LAPIBase::GenericTarget::LINK: + type = "Link"; + break; + default: + type = "Other"; + break; + } + + return add(event, type, STR(FMT("%d") % target.object)); + } + + bool fire(switch_event_t **event) const + { + if(!event || !*event) return false; + + switch_status_t res = switch_event_fire(event); + + *event = NULL; + + return (res == SWITCH_STATUS_SUCCESS ? true : false); + } + + static bool registerEvents(); + + static bool unregisterEvents(); + +protected: + const std::string _type; + static VectorEvents * _events; +}; /******************************************************************************/ /******************************************************************************/ + #endif /* _UTILS_H_ */ diff --git a/src/mod/endpoints/mod_khomp/mod_khomp.cpp b/src/mod/endpoints/mod_khomp/mod_khomp.cpp index d09a8a3..5e7375b 100644 --- a/src/mod/endpoints/mod_khomp/mod_khomp.cpp +++ b/src/mod/endpoints/mod_khomp/mod_khomp.cpp @@ -269,22 +269,22 @@ switch_status_t khompExecute(switch_core_session_t *session) switch_status_t khompHangup(switch_core_session_t *session) { - DBG(FUNC, D("c")); - Board::KhompPvt *tech_pvt = NULL; if(!session) { - LOG(ERROR, D("r (Session is NULL)")); - return SWITCH_STATUS_SUCCESS; + LOG(ERROR, D("cr (Session is NULL)")); + return SWITCH_STATUS_FALSE; } tech_pvt = static_cast<Board::KhompPvt*>(switch_core_session_get_private(session)); if(!tech_pvt) { - DBG(FUNC, D("r (pvt is NULL)")); + LOG(ERROR, D("cr (pvt is NULL)")); return SWITCH_STATUS_FALSE; } + + DBG(FUNC, PVT_FMT(tech_pvt->target(), "c")); try { @@ -312,13 +312,13 @@ switch_status_t khompHangup(switch_core_session_t *session) LOG(ERROR, PVT_FMT(tech_pvt->target(), "r (unable to lock: %s!)") % err._msg.c_str()); return SWITCH_STATUS_FALSE; } - catch (K3LAPI::invalid_device & err) + catch (K3LAPITraits::invalid_device & err) { LOG(ERROR, PVT_FMT(tech_pvt->target(), "r (unable to get device: %d!)") % err.device); return SWITCH_STATUS_FALSE; } - DBG(FUNC, D("r")) + DBG(FUNC, PVT_FMT(tech_pvt->target(), "r")) return SWITCH_STATUS_SUCCESS; } @@ -331,12 +331,10 @@ switch_status_t khompPRHangup(switch_core_session_t *session) switch_status_t khompDestroy(switch_core_session_t *session) { - DBG(FUNC, D("c")) - if(!session) { - DBG(FUNC, D("r (session is null)")) - return SWITCH_STATUS_SUCCESS; + LOG(ERROR, D("cr (session is null)")) + return SWITCH_STATUS_FALSE; } Board::KhompPvt *tech_pvt = NULL; @@ -345,24 +343,36 @@ switch_status_t khompDestroy(switch_core_session_t *session) if(!tech_pvt) { - DBG(FUNC, D("r (pvt is null)")) + LOG(ERROR, D("cr (pvt is null)")) return SWITCH_STATUS_FALSE; } - try - { - ScopedPvtLock lock(tech_pvt); - switch_core_session_set_private(session, NULL); - tech_pvt->destroyAll(); - } - catch (ScopedLockFailed & err) + DBG(FUNC, PVT_FMT(tech_pvt->target(), "c")) + + do { - DBG(FUNC, PVT_FMT(tech_pvt->target(), "r (unable to lock: %s!)") % err._msg.c_str()); - } + try + { + ScopedPvtLock lock(tech_pvt); - DBG(FUNC, D("r")) + switch_core_session_set_private(session, NULL); + tech_pvt->destroyAll(); + + DBG(FUNC, PVT_FMT(tech_pvt->target(), "r")); - return SWITCH_STATUS_SUCCESS; + return SWITCH_STATUS_SUCCESS; + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(tech_pvt->target(), "unable to lock: %s!: try again...") % err._msg.c_str()); + } + + } + while(true); + + DBG(FUNC, PVT_FMT(tech_pvt->target(), "r (unable to lock!)")); + + return SWITCH_STATUS_FALSE; } switch_status_t khompSMSDestroy(switch_core_session_t *session) @@ -372,7 +382,7 @@ switch_status_t khompSMSDestroy(switch_core_session_t *session) if(!session) { DBG(FUNC, D("r (session is null)")) - return SWITCH_STATUS_SUCCESS; + return SWITCH_STATUS_FALSE; } /* Board::KhompPvt *tech_pvt = NULL; @@ -569,7 +579,7 @@ switch_status_t khompWrite(switch_core_session_t *session, switch_frame_t *frame { Board::board(tech_pvt->target().device)->_timers.del(tech_pvt->call()->_idx_co_ring); } - catch (K3LAPI::invalid_device & err) + catch (K3LAPITraits::invalid_device & err) { LOG(ERROR, PVT_FMT(tech_pvt->target(), "Unable to get device: %d!") % err.device); } @@ -666,7 +676,7 @@ switch_status_t khompAnswer(switch_core_session_t *session) } - catch (K3LAPI::invalid_device & err) + catch (K3LAPITraits::invalid_device & err) { LOG(ERROR, D("unable to get device: %d!") % err.device); return SWITCH_STATUS_FALSE; @@ -826,7 +836,7 @@ switch_call_cause_t khompCall } Board::KhompPvt *tech_pvt; - int cause = (int)SWITCH_CAUSE_SUCCESS; + int cause = (int)SWITCH_CAUSE_NONE; try { @@ -882,7 +892,7 @@ switch_call_cause_t khompCall { if(err._fail == ScopedLockFailed::ALLOC_FAILED) { - LOG(ERROR, PVT_FMT(tech_pvt->target(), "unable to global alloc lock")); + LOG(ERROR, D("unable to global alloc lock: %s!") % err._msg.c_str()); } else { @@ -1295,7 +1305,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_khomp_load) } /* apply global volume now */ - if(Opt::_input_volume != 0 || Opt::_output_volume != 0) + if(Opt::_options._input_volume() != 0 || Opt::_options._output_volume() != 0) Board::applyGlobalVolume(); Opt::commit(); @@ -1320,6 +1330,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_khomp_load) /* Register cli commands */ Cli::registerCommands(apiKhomp,module_interface); + + ESL::registerEvents(); /* Add applications */ SWITCH_ADD_APP(Globals::khomp_app_inteface, "KLog", "KLog", "KLog log every string to khomp log system", klogFunction, "<value>", SAF_SUPPORT_NOMEDIA); @@ -1352,6 +1364,9 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_khomp_shutdown) Board::kommuter.stop(); Cli::unregisterCommands(); + + ESL::unregisterEvents(); + /* Finnish him! */ DBG(FUNC, "Unloading mod_khomp...") @@ -1412,7 +1427,7 @@ extern "C" void Kstdcall khompAudioListener (int32 deviceid, int32 objectid, byt try { - //If NULL get throws K3LAPI::invalid_channel exception. + //If NULL get throws K3LAPITraits::invalid_channel exception. Board::KhompPvt * pvt = Board::get(deviceid, objectid); /* add listener audio to the read buffer */ @@ -1485,7 +1500,7 @@ extern "C" void Kstdcall khompAudioListener (int32 deviceid, int32 objectid, byt } } - catch (K3LAPI::invalid_channel & err) + catch (K3LAPITraits::invalid_channel & err) { LOG(ERROR, OBJ_FMT(deviceid, objectid, "Invalid channel...")); return; diff --git a/src/mod/endpoints/mod_khomp/src/applications.cpp b/src/mod/endpoints/mod_khomp/src/applications.cpp index d4a50e0..bd17d36 100644 --- a/src/mod/endpoints/mod_khomp/src/applications.cpp +++ b/src/mod/endpoints/mod_khomp/src/applications.cpp @@ -44,6 +44,7 @@ #include "applications.h" #include "lock.h" + bool Fax::adjustForFax() { /* Don't worry, let the man work */ @@ -379,18 +380,20 @@ bool Fax::addFaxFile(const char * filename, bool last) } /******************************************************************************/ +SMS::_SMSEvent SMS::SMSEvent; + bool SMS::justAlloc(unsigned int count) { /* incoming contexts */ MatchExtension::ContextListType contexts; - contexts.push_back(Opt::_context_gsm_sms); + contexts.push_back(Opt::_options._context_gsm_sms()); /* temporary variables */ std::string context; std::string exten("s"); - K3L_DEVICE_CONFIG & dev_cfg = Globals::k3lapi.device_config(_pvt->_target.device); + const K3L_DEVICE_CONFIG & dev_cfg = Globals::k3lapi.device_config(_pvt->_target); for (MatchExtension::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) { @@ -438,7 +441,7 @@ bool SMS::justAlloc(unsigned int count) switch_caller_profile_t *caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session), "Khomp_SMS", //username - Opt::_dialplan.c_str(), //dialplan + Opt::_options._dialplan().c_str(), //dialplan NULL, //caller_id_name _got_sms._from.c_str(), //caller_id_number NULL, //network_addr @@ -465,7 +468,7 @@ bool SMS::justAlloc(unsigned int count) return false; } - std::string name = STG(FMT("Khomp_SMS/%hu/%hu") + std::string name = STG(FMT("Khomp_SMS/%d/%d") % _pvt->target().device % _pvt->target().object); @@ -744,6 +747,8 @@ bool SMS::onSMSData(K3L_EVENT *e) { _got_sms._body = (const char *)(e->Params ? e->Params : ""); + SMSEvent(_pvt, _got_sms); + if(!justStart()) { if(_got_sms._type != "broadcast") @@ -945,6 +950,8 @@ int SMS::smsThread(void * sms_ptr) if (sms->_result == kgccNone) { + sms->SMSEvent(pvt, sms->_send_sms); + /* stats update if sent! */ sms->statistics<SMSStatistics>()->incrementOutgoing(); } diff --git a/src/mod/endpoints/mod_khomp/src/cli.cpp b/src/mod/endpoints/mod_khomp/src/cli.cpp index 709abb9..621afe6 100644 --- a/src/mod/endpoints/mod_khomp/src/cli.cpp +++ b/src/mod/endpoints/mod_khomp/src/cli.cpp @@ -93,12 +93,12 @@ void Cli::registerCommands(APIFunc func,switch_loadable_module_interface_t **mod " khomp set <option> <value>\n" \ " khomp show calls [<board> [<channel>]]\n" \ " khomp show channels [{<board> [<channel>]} | \n" \ -" {{concise|verbose} [<board> [<channel>]]}]\n" \ -" khomp show links [[errors] [{<board>} | {{concise|verbose} [<board>]}]]\n" \ -" khomp show statistics [{verbose [<board> [<channel>]]} | \n" \ +" {{concise|verbose|xml} [<board> [<channel>]]}]\n" \ +" khomp show links [[errors] [{<board>} | {{concise|verbose|xml}[<board>]}]]\n"\ +" khomp show statistics [{{verbose|xml} [<board> [<channel>]]} | \n" \ " {detailed <board> <channel>}]\n" \ " khomp sms <device> <destination> <message..>\n" \ -" khomp summary [concise]\n" \ +" khomp summary [concise|verbose|xml]\n" \ "---------------------------------------------------------------------------\n\n"; /* we need this module_inteface, is used by SWITCH_ADD_API, there's no escape */ @@ -319,13 +319,18 @@ bool Cli::_KhompSummary::execute(int argc, char *argv[]) return false; } - /* show concise ? */ - bool concise = ARG_CMP(1, "concise") ? true:false; - + Cli::OutputType output_type = Cli::VERBOSE; + if(ARG_CMP(1, "concise")) output_type = Cli::CONCISE; + if(ARG_CMP(1, "xml")) + { + output_type = Cli::XML; + createRoot("summary"); + } + class_type classe = ( !_on_cli_term ? C_MESSAGE : C_CLI ); K3L_API_CONFIG apiCfg; - if (!concise) + if (output_type == Cli::VERBOSE) { K::Logger::Logg2(classe, stream, " ------------------------------------------------------------------"); K::Logger::Logg2(classe, stream, "|---------------------- Khomp System Summary ----------------------|"); @@ -334,17 +339,41 @@ bool Cli::_KhompSummary::execute(int argc, char *argv[]) if (k3lGetDeviceConfig(-1, ksoAPI, &apiCfg, sizeof(apiCfg)) == ksSuccess) { - if (concise) + switch(output_type) { - K::Logger::Logg2(classe, stream, FMT("%d.%d.%d;%d;%s") + case Cli::VERBOSE: + { + K::Logger::Logg2(classe, stream, FMT("| K3L API %d.%d.%d [m.VPD %d] - %-38s |") % apiCfg.MajorVersion % apiCfg.MinorVersion % apiCfg.BuildVersion % apiCfg.VpdVersionNeeded % apiCfg.StrVersion); - } - else - { - K::Logger::Logg2(classe, stream, FMT("| K3L API %d.%d.%d [m.VPD %d] - %-38s |") + } break; + + case Cli::CONCISE: + { + K::Logger::Logg2(classe, stream, FMT("%d.%d.%d;%d;%s") % apiCfg.MajorVersion % apiCfg.MinorVersion % apiCfg.BuildVersion % apiCfg.VpdVersionNeeded % apiCfg.StrVersion); + } break; + + case Cli::XML: + { + /* summary/k3lapi */ + switch_xml_t xk3lapi = switch_xml_add_child_d(root, "k3lapi",0); + + /* summary/k3lapi/version */ + switch_xml_t xk3l_version = switch_xml_add_child_d(xk3lapi,"version", 0); + switch_xml_set_attr_d(xk3l_version,"major",STR(FMT("%d") % apiCfg.MajorVersion)); + switch_xml_set_attr_d(xk3l_version,"minor",STR(FMT("%d") % apiCfg.MinorVersion)); + switch_xml_set_attr_d(xk3l_version,"build",STR(FMT("%d") % apiCfg.BuildVersion)); + switch_xml_set_attr_d(xk3l_version,"vpd",STR(FMT("%d") % apiCfg.VpdVersionNeeded)); + + /* summary/k3lapi/version/revision */ + switch_xml_t xk3l_rev = switch_xml_add_child_d(xk3l_version,"revision",0); + switch_xml_set_txt_d(xk3l_rev,STR(FMT("%s") % apiCfg.StrVersion)); + } break; + + default: + break; } } @@ -359,25 +388,54 @@ bool Cli::_KhompSummary::execute(int argc, char *argv[]) std::string khomp_endpoint_rev(MOD_KHOMP_VERSION); std::string freeswitch_rev(SWITCH_VERSION_FULL); - if (concise) + switch(output_type) { - K::Logger::Logg2(classe, stream, FMT("%s") % khomp_endpoint_rev); - K::Logger::Logg2(classe, stream, FMT("%s") % freeswitch_rev); + case Cli::VERBOSE: + { + K::Logger::Logg2(classe, stream, FMT("| Khomp Endpoint - %-47s |") % khomp_endpoint_rev); + K::Logger::Logg2(classe, stream, FMT("| FreeSWITCH - %-51s |") % freeswitch_rev); + } break; + + case Cli::CONCISE: + { + K::Logger::Logg2(classe, stream, FMT("%s") % khomp_endpoint_rev); + K::Logger::Logg2(classe, stream, FMT("%s") % freeswitch_rev); + } break; + + case Cli::XML: + { + /* summary/mod_khomp */ + switch_xml_t xmod_khomp = switch_xml_add_child_d(root,"mod_khomp",0); + + /* summary/mod_khomp/revision */ + switch_xml_t xrevision = switch_xml_add_child_d(xmod_khomp,"revision",0); + switch_xml_set_txt_d(xrevision, khomp_endpoint_rev.c_str()); + + /* summary/freeswitch */ + switch_xml_t xfs = switch_xml_add_child_d(root,"freeswitch",0); + + /* summary/freeswitch/revision */ + switch_xml_t xfs_rev = switch_xml_add_child_d(xfs,"revision",0); + switch_xml_set_txt_d(xfs_rev, freeswitch_rev.c_str()); + } break; + + default: + break; } - else + + if (output_type == Cli::XML) { - K::Logger::Logg2(classe, stream, FMT("| Khomp Endpoint - %-47s |") % khomp_endpoint_rev); - K::Logger::Logg2(classe, stream, FMT("| FreeSWITCH - %-51s |") % freeswitch_rev); + /* summary/board */ + xdevs = switch_xml_add_child_d(root,"devices",0); } - for (unsigned int i = 0; i < Globals::k3lapi.device_count(); i++) { - K3L_DEVICE_CONFIG & devCfg = Globals::k3lapi.device_config(i); + const K3L_DEVICE_CONFIG & devCfg = Globals::k3lapi.device_config(i); std::string tipo = Verbose::deviceName((KDeviceType)Globals::k3lapi.device_type(i), devCfg.DeviceModel); - if (!concise) + if (output_type == Cli::VERBOSE) K::Logger::Logg2(classe, stream, " ------------------------------------------------------------------"); switch (Globals::k3lapi.device_type(i)) @@ -400,29 +458,92 @@ bool Cli::_KhompSummary::execute(int argc, char *argv[]) if ((k3lGetDeviceConfig(i, ksoFirmware + kfiE1600A, &dspAcfg, sizeof(dspAcfg)) == ksSuccess) && (k3lGetDeviceConfig(i, ksoFirmware + kfiE1600B, &dspBcfg, sizeof(dspBcfg)) == ksSuccess)) { - if (concise) - { - K::Logger::Logg2(classe, stream, FMT("%02u;%s;%d;%d;%d;%s;%s;%02d;%02d;%s;%s;%s;%s") - % i % tipo % atoi(devCfg.SerialNumber) % devCfg.ChannelCount % devCfg.LinkCount - % dspAcfg.DspVersion % dspBcfg.DspVersion % devCfg.PciBus % devCfg.PciSlot - % dspAcfg.FwVersion % dspBcfg.FwVersion - % Verbose::echoCancellerConfig(devCfg.EchoConfig) - % Verbose::echoLocation(devCfg.EchoLocation)); - } - else + switch(output_type) { - K::Logger::Logg2(classe, stream, FMT("| [[ %02u ]] %s, serial '%s', %02d channels, %d links.%s|") + case Cli::VERBOSE: + { + K::Logger::Logg2(classe, stream, FMT("| [[ %02u ]] %s, serial '%s', %02d channels, %d links.%s|") % i % tipo % devCfg.SerialNumber % devCfg.ChannelCount % devCfg.LinkCount % std::string(std::max<int>(0, 22 - tipo.size() - strlen(devCfg.SerialNumber)), ' ')); - K::Logger::Logg2(classe, stream, FMT("| * DSP A: %s, DSP B: %s - PCI bus: %02d, PCI slot: %02d %s|") + K::Logger::Logg2(classe, stream, FMT("| * DSP A: %s, DSP B: %s - PCI bus: %02d, PCI slot: %02d %s|") % dspAcfg.DspVersion % dspBcfg.DspVersion % devCfg.PciBus % devCfg.PciSlot % std::string(18 - strlen(dspAcfg.DspVersion) - strlen(dspBcfg.DspVersion), ' ')); - K::Logger::Logg2(classe, stream, FMT("| * %-62s |") % dspAcfg.FwVersion); - K::Logger::Logg2(classe, stream, FMT("| * %-62s |") % dspBcfg.FwVersion); + K::Logger::Logg2(classe, stream, FMT("| * %-62s |") % dspAcfg.FwVersion); + K::Logger::Logg2(classe, stream, FMT("| * %-62s |") % dspBcfg.FwVersion); - K::Logger::Logg2(classe, stream, FMT("| * Echo Canceller: %-20s - Location: %-12s |") + K::Logger::Logg2(classe, stream, FMT("| * Echo Canceller: %-20s - Location: %-12s |") % Verbose::echoCancellerConfig(devCfg.EchoConfig) % Verbose::echoLocation(devCfg.EchoLocation)); + } break; + + case Cli::CONCISE: + { + K::Logger::Logg2(classe, stream, FMT("%02u;%s;%d;%d;%d;%s;%s;%02d;%02d;%s;%s;%s;%s") + % i % tipo % atoi(devCfg.SerialNumber) % devCfg.ChannelCount % devCfg.LinkCount + % dspAcfg.DspVersion % dspBcfg.DspVersion % devCfg.PciBus % devCfg.PciSlot + % dspAcfg.FwVersion % dspBcfg.FwVersion + % Verbose::echoCancellerConfig(devCfg.EchoConfig) + % Verbose::echoLocation(devCfg.EchoLocation)); + } break; + + case Cli::XML: + { + /* boards/board */ + switch_xml_t xdev = switch_xml_add_child_d(xdevs,"device",0); + switch_xml_set_attr_d(xdev,"id",STR(FMT("%02u") % i)); + + /* boards/board/general */ + switch_xml_t xgeneral = switch_xml_add_child_d(xdev,"general",0); + + /* boards/board/general/type */ + switch_xml_t xtype = switch_xml_add_child_d(xgeneral,"type",0); + switch_xml_set_txt_d(xtype,tipo.c_str()); + + /* boards/board/general/serial */ + switch_xml_t xserial = switch_xml_add_child_d(xgeneral,"serial",0); + switch_xml_set_txt_d(xserial, devCfg.SerialNumber); + + /* boards/board/general/channels */ + switch_xml_t xchannels = switch_xml_add_child_d(xgeneral,"channels",0); + switch_xml_set_txt_d(xchannels, STR(FMT("%02d") % devCfg.ChannelCount)); + + /* boards/board/general/links */ + switch_xml_t xlinks = switch_xml_add_child_d(xgeneral,"links",0); + switch_xml_set_txt_d(xlinks, STR(FMT("%d") % devCfg.LinkCount)); + + /* boards/board/hardware */ + switch_xml_t xhardware = switch_xml_add_child_d(xdev,"hardware",0); + + /* boards/board/hardware/dsps */ + switch_xml_t xdsps = switch_xml_add_child_d(xhardware,"dsps",0); + + /* boards/board/hardware/dsps/dsp (0) */ + switch_xml_t xdsp0 = switch_xml_add_child_d(xdsps,"dsp",0); + switch_xml_set_attr_d(xdsp0,"id","0"); + + /* boards/board/hardware/dsps/dsp/version */ + switch_xml_t xversion0 = switch_xml_add_child_d(xdsp0,"version",0); + switch_xml_set_txt_d(xversion0, dspAcfg.DspVersion); + + /* boards/board/hardware/dsps/dsp/firmware */ + switch_xml_t xfirmware0 = switch_xml_add_child_d(xdsp0,"firmware",0); + switch_xml_set_txt_d(xfirmware0,dspAcfg.FwVersion); + + /* boards/board/hardware/dsps/dsp (1) */ + switch_xml_t xdsp1 = switch_xml_add_child_d(xdsps,"dsp",0); + switch_xml_set_attr_d(xdsp1,"id","1"); + + /* boards/board/hardware/dsps/dsp/version */ + switch_xml_t xversion1 = switch_xml_add_child_d(xdsp1,"version",0); + switch_xml_set_txt_d(xversion1, dspBcfg.DspVersion); + + /* boards/board/hardware/dsps/dsp/firmware */ + switch_xml_t xfirmware1 = switch_xml_add_child_d(xdsp1,"firmware",0); + switch_xml_set_txt_d(xfirmware1,dspBcfg.FwVersion); + } break; + + default: + break; } } @@ -442,28 +563,84 @@ bool Cli::_KhompSummary::execute(int argc, char *argv[]) if (k3lGetDeviceConfig(i, ksoFirmware + kfiFXO80, &dspCfg, sizeof(dspCfg)) == ksSuccess) { - if (concise) + switch(output_type) { - K::Logger::Logg2(classe, stream, FMT("%02u;%s;%d;%d;%s;%02d;%02d;%s") - % i % tipo % atoi(devCfg.SerialNumber) % devCfg.ChannelCount - % dspCfg.DspVersion % devCfg.PciBus % devCfg.PciSlot - % dspCfg.FwVersion); - } - else - { - K::Logger::Logg2(classe, stream, FMT("| [[ %02u ]] %s, serial '%s', %02d channels. %s|") - % i % tipo % devCfg.SerialNumber % devCfg.ChannelCount - % std::string(std::max<int>(0, 30 - tipo.size() - strlen(devCfg.SerialNumber)), ' ')); - K::Logger::Logg2(classe, stream, FMT("| * DSP: %s - PCI bus: %02d, PCI slot: %02d%s|") - % dspCfg.DspVersion % devCfg.PciBus % devCfg.PciSlot - % std::string(30 - strlen(dspCfg.DspVersion), ' ')); - K::Logger::Logg2(classe, stream, FMT("| * %-63s|") % dspCfg.FwVersion); + case Cli::VERBOSE: + { + K::Logger::Logg2(classe, stream, FMT("| [[ %02u ]] %s, serial '%s', %02d channels. %s|") + % i % tipo % devCfg.SerialNumber % devCfg.ChannelCount + % std::string(std::max<int>(0, 30 - tipo.size() - strlen(devCfg.SerialNumber)), ' ')); + K::Logger::Logg2(classe, stream, FMT("| * DSP: %s - PCI bus: %02d, PCI slot: %02d%s|") + % dspCfg.DspVersion % devCfg.PciBus % devCfg.PciSlot + % std::string(30 - strlen(dspCfg.DspVersion), ' ')); + K::Logger::Logg2(classe, stream, FMT("| * %-63s|") % dspCfg.FwVersion); + } break; + + case Cli::CONCISE: + { + K::Logger::Logg2(classe, stream, FMT("%02u;%s;%d;%d;%s;%02d;%02d;%s") + % i % tipo % atoi(devCfg.SerialNumber) % devCfg.ChannelCount + % dspCfg.DspVersion % devCfg.PciBus % devCfg.PciSlot + % dspCfg.FwVersion); + } break; + + case Cli::XML: + { + /* boards/board */ + switch_xml_t xdev = switch_xml_add_child_d(xdevs,"device",0); + switch_xml_set_attr_d(xdev,"id",STR(FMT("%02u") % i)); + + /* boards/board/general */ + switch_xml_t xgeneral = switch_xml_add_child_d(xdev,"general",0); + + /* boards/board/general/type */ + switch_xml_t xtype = switch_xml_add_child_d(xgeneral,"type",0); + switch_xml_set_txt_d(xtype,tipo.c_str()); + + /* boards/board/general/serial */ + switch_xml_t xserial = switch_xml_add_child_d(xgeneral,"serial",0); + switch_xml_set_txt_d(xserial, devCfg.SerialNumber); + + /* boards/board/general/channels */ + switch_xml_t xchannels = switch_xml_add_child_d(xgeneral,"channels",0); + switch_xml_set_txt_d(xchannels, STR(FMT("%02d") % devCfg.ChannelCount)); + + /* boards/board/general/links */ + switch_xml_t xlinks = switch_xml_add_child_d(xgeneral,"links",0); + switch_xml_set_txt_d(xlinks, STR(FMT("%d") % devCfg.LinkCount)); + + /* boards/hardware */ + switch_xml_t xhardware = switch_xml_add_child_d(xdev,"hardware",0); + + /* boards/board/hardware/dsps */ + switch_xml_t xdsps = switch_xml_add_child_d(xhardware,"dsps",0); + + /* boards/board/hardware/dsps/dsp */ + switch_xml_t xdsp = switch_xml_add_child_d(xdsps,"dsp",0); + switch_xml_set_attr_d(xdsp,"id","0"); + + /* boards/board/hardware/dsps/dsps/version */ + switch_xml_t xversion_a = switch_xml_add_child_d(xdsp,"version",0); + switch_xml_set_txt_d(xversion_a, dspCfg.DspVersion); + + /* boards/board/hardware/dsps/dsps/firmare */ + switch_xml_t xfirmware = switch_xml_add_child_d(xdsp,"firmware",0); + switch_xml_set_txt_d(xfirmware,dspCfg.FwVersion); + + /* boards/board/hardware/pci */ + switch_xml_t xpci = switch_xml_add_child_d(xhardware,"pci",0); + switch_xml_set_attr_d(xpci,"bus" ,STR(FMT("%02d") % devCfg.PciBus )); + switch_xml_set_attr_d(xpci,"slot",STR(FMT("%02d") % devCfg.PciSlot)); + } break; + + default: + break; } } if (Globals::k3lapi.device_type(i) == kdtFXOVoIP) { - if (!concise) + if (output_type == Cli::VERBOSE) { K::Logger::Logg2(classe, stream, FMT("| * Echo Canceller: %-20s - Location: %-12s |") % Verbose::echoCancellerConfig(devCfg.EchoConfig) @@ -480,24 +657,80 @@ bool Cli::_KhompSummary::execute(int argc, char *argv[]) if (k3lGetDeviceConfig(i, ksoFirmware + kfiGSM40, &dspCfg, sizeof(dspCfg)) == ksSuccess) { - if (concise) + switch(output_type) { - K::Logger::Logg2(classe, stream, FMT("%02d;%s;%d;%d;%s;%02d;%02d;%s") - % i % tipo % atoi(devCfg.SerialNumber) % devCfg.ChannelCount - % dspCfg.DspVersion % devCfg.PciBus % devCfg.PciSlot - % dspCfg.FwVersion); - } - else - { - K::Logger::Logg2(classe, stream, FMT("| [[ %02d ]] %s, serial '%s', %02d channels. %s|") - % i % tipo % devCfg.SerialNumber % devCfg.ChannelCount - % std::string(std::max<int>(0, 30 - tipo.size() - strlen(devCfg.SerialNumber)), ' ')); + case Cli::VERBOSE: + { + K::Logger::Logg2(classe, stream, FMT("| [[ %02d ]] %s, serial '%s', %02d channels. %s|") + % i % tipo % devCfg.SerialNumber % devCfg.ChannelCount + % std::string(std::max<int>(0, 30 - tipo.size() - strlen(devCfg.SerialNumber)), ' ')); + + K::Logger::Logg2(classe, stream, FMT("| * DSP: %s - PCI bus: %02d, PCI slot: %02d%s|") + % dspCfg.DspVersion % devCfg.PciBus % devCfg.PciSlot + % std::string(std::max<int>(30 - strlen(dspCfg.DspVersion), 0), ' ')); + + K::Logger::Logg2(classe, stream, FMT("| * %-62s |") % dspCfg.FwVersion); + } break; + + case Cli::CONCISE: + { + K::Logger::Logg2(classe, stream, FMT("%02d;%s;%d;%d;%s;%02d;%02d;%s") + % i % tipo % atoi(devCfg.SerialNumber) % devCfg.ChannelCount + % dspCfg.DspVersion % devCfg.PciBus % devCfg.PciSlot + % dspCfg.FwVersion); + } break; + + case Cli::XML: + { + /* boards/board */ + switch_xml_t xdev = switch_xml_add_child_d(xdev,"device",0); + switch_xml_set_attr_d(xdev,"id",STR(FMT("%02u") % i)); + + /* boards/board/general */ + switch_xml_t xgeneral = switch_xml_add_child_d(xdev,"general",0); + + /* boards/board/general/type */ + switch_xml_t xtype = switch_xml_add_child_d(xgeneral,"type",0); + switch_xml_set_txt_d(xtype,tipo.c_str()); + + /* boards/board/general/serial */ + switch_xml_t xserial = switch_xml_add_child_d(xgeneral,"serial",0); + switch_xml_set_txt_d(xserial, devCfg.SerialNumber); + + /* boards/board/general/channels */ + switch_xml_t xchannels = switch_xml_add_child_d(xgeneral,"channels",0); + switch_xml_set_txt_d(xchannels, STR(FMT("%02d") % devCfg.ChannelCount)); + + /* boards/board/general/links */ + switch_xml_t xlinks = switch_xml_add_child_d(xgeneral,"links",0); + switch_xml_set_txt_d(xlinks, STR(FMT("%d") % devCfg.LinkCount)); + + /* boards/board/hardware */ + switch_xml_t xhardware = switch_xml_add_child_d(xdev,"hardware",0); + + /* boards/board/hardware/dsps */ + switch_xml_t xdsps = switch_xml_add_child_d(xhardware,"dsps",0); - K::Logger::Logg2(classe, stream, FMT("| * DSP: %s - PCI bus: %02d, PCI slot: %02d%s|") - % dspCfg.DspVersion % devCfg.PciBus % devCfg.PciSlot - % std::string(std::max<int>(30 - strlen(dspCfg.DspVersion), 0), ' ')); + /* boards/board/hardware/dsps/dsp */ + switch_xml_t xdsp = switch_xml_add_child_d(xdsps,"dsp",0); + switch_xml_set_attr_d(xdsp,"id","0"); - K::Logger::Logg2(classe, stream, FMT("| * %-62s |") % dspCfg.FwVersion); + /* boards/board/hardware/dsps/dsp/version */ + switch_xml_t xversion_a = switch_xml_add_child_d(xdsp,"version",0); + switch_xml_set_txt_d(xversion_a, dspCfg.DspVersion); + + /* boards/board/hardware/dsps/dsp/firmware*/ + switch_xml_t xfirmware = switch_xml_add_child_d(xdsp,"firmware",0); + switch_xml_set_txt_d(xfirmware,dspCfg.FwVersion); + + /* boards/board/hardware/dsps/dsp/pci */ + switch_xml_t xpci = switch_xml_add_child_d(xhardware,"pci",0); + switch_xml_set_attr_d(xpci,"bus" ,STR(FMT("%02d") % devCfg.PciBus )); + switch_xml_set_attr_d(xpci,"slot",STR(FMT("%02d") % devCfg.PciSlot)); + } break; + + default: + break; } } @@ -510,24 +743,71 @@ bool Cli::_KhompSummary::execute(int argc, char *argv[]) if (k3lGetDeviceConfig(i, ksoFirmware + kfiGSMUSB, &dspCfg, sizeof(dspCfg)) == ksSuccess) { - if (concise) - { - K::Logger::Logg2(classe, stream, FMT("%02d;%s;%d;%d;%s;%02d;%02d;%s") - % i % tipo % atoi(devCfg.SerialNumber) % devCfg.ChannelCount - % dspCfg.DspVersion % devCfg.PciBus % devCfg.PciSlot - % dspCfg.FwVersion); - } - else + switch(output_type) { - K::Logger::Logg2(classe, stream, FMT("| [[ %02d ]] %s, serial '%s', %02d channels. %s|") - % i % tipo % devCfg.SerialNumber % devCfg.ChannelCount - % std::string(std::max<int>(0, 30 - tipo.size() - strlen(devCfg.SerialNumber)), ' ')); - - int size = strlen(dspCfg.DspVersion) + strlen(dspCfg.FwVersion); - - K::Logger::Logg2(classe, stream, FMT("| * DSP: %s - %s%s|") - % dspCfg.DspVersion % dspCfg.FwVersion - % std::string(std::max<int>(55 - size, 0), ' ')); + case Cli::VERBOSE: + { + K::Logger::Logg2(classe, stream, FMT("| [[ %02d ]] %s, serial '%s', %02d channels. %s|") + % i % tipo % devCfg.SerialNumber % devCfg.ChannelCount + % std::string(std::max<int>(0, 30 - tipo.size() - strlen(devCfg.SerialNumber)), ' ')); + + int size = strlen(dspCfg.DspVersion) + strlen(dspCfg.FwVersion); + + K::Logger::Logg2(classe, stream, FMT("| * DSP: %s - %s%s|") + % dspCfg.DspVersion % dspCfg.FwVersion + % std::string(std::max<int>(55 - size, 0), ' ')); + + } break; + + case Cli::CONCISE: + { + K::Logger::Logg2(classe, stream, FMT("%02d;%s;%d;%d;%s;%s") + % i % tipo % atoi(devCfg.SerialNumber) % devCfg.ChannelCount + % dspCfg.DspVersion % dspCfg.FwVersion); + } break; + + case Cli::XML: + { + /* boards/board */ + switch_xml_t xdev = switch_xml_add_child_d(xdev,"device",0); + switch_xml_set_attr_d(xdev,"id",STR(FMT("%02u") % i)); + + /* boards/board/general */ + switch_xml_t xgeneral = switch_xml_add_child_d(xdev,"general",0); + + /* boards/board/general/type */ + switch_xml_t xtype = switch_xml_add_child_d(xgeneral,"type",0); + switch_xml_set_txt_d(xtype,tipo.c_str()); + + /* boards/board/general/serial */ + switch_xml_t xserial = switch_xml_add_child_d(xgeneral,"serial",0); + switch_xml_set_txt_d(xserial, devCfg.SerialNumber); + + /* boards/board/general/channels */ + switch_xml_t xchannels = switch_xml_add_child_d(xgeneral,"channels",0); + switch_xml_set_txt_d(xchannels, STR(FMT("%02d") % devCfg.ChannelCount)); + + /* boards/board/hardware */ + switch_xml_t xhardware = switch_xml_add_child_d(xdev,"hardware",0); + + /* boards/board/hardware/dsps */ + switch_xml_t xdsps = switch_xml_add_child_d(xhardware,"dsps",0); + + /* boards/board/hardware/dsp */ + switch_xml_t xdsp = switch_xml_add_child_d(xdsps,"dsp",0); + switch_xml_set_attr_d(xdsp,"id","0"); + + /* boards/board/hardware/dsps/dsp/version */ + switch_xml_t xversion_a = switch_xml_add_child_d(xdsp,"version",0); + switch_xml_set_txt_d(xversion_a, dspCfg.DspVersion); + + /* boards/board/hardware/dsps/dsp/firmware */ + switch_xml_t xfirmware = switch_xml_add_child_d(xdsp,"firmware",0); + switch_xml_set_txt_d(xfirmware,dspCfg.FwVersion); + } break; + + default: + break; } } @@ -541,8 +821,14 @@ bool Cli::_KhompSummary::execute(int argc, char *argv[]) } } - if (!concise) + if (output_type == Cli::VERBOSE) K::Logger::Logg2(classe,stream, " ------------------------------------------------------------------"); + + if (output_type == Cli::XML) + { + printXMLOutput(stream); + clearRoot(); + } return true; } @@ -622,7 +908,7 @@ bool Cli::_KhompShowCalls::execute(int argc, char *argv[]) } } } - catch(K3LAPI::invalid_channel & err) + catch(K3LAPITraits::invalid_channel & err) { K::Logger::Logg2(C_CLI, stream, "ERROR: No such chanel"); return false; @@ -653,9 +939,9 @@ bool Cli::_KhompChannelsDisconnect::forceDisconnect(unsigned int device, unsigne ret = pvt->command(KHOMP_LOG,CM_DISCONNECT); DBG(FUNC,PVT_FMT(pvt->target(),"Command CM_DISCONNECT sent!")); } - catch (K3LAPI::invalid_channel & err) + catch (K3LAPITraits::invalid_channel & err) { - K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Unable to find channel %d on device %d!") % err.channel % err.device ); + K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Unable to find channel %d on device %d!") % err.object % err.device ); } catch (ScopedLockFailed & err) { @@ -835,35 +1121,69 @@ bool Cli::_KhompChannelsUnblock::execute(int argc, char *argv[]) return true; } -void Cli::_KhompShowStatistics::cliStatistics(unsigned int device) +void Cli::_KhompShowStatistics::cliStatistics(unsigned int device, OutputType output_type) { + if(output_type == Cli::XML) + { + /* device */ + xdevs = switch_xml_add_child_d(root,"device",0); + switch_xml_set_attr_d(xdevs,"id",STR(FMT("%d") % device)); + } + for (unsigned int channel = 0; channel < Globals::k3lapi.channel_count(device); channel++) { try { Board::KhompPvt *pvt = Board::get(device, channel); - K::Logger::Logg2(C_CLI,stream,pvt->getStatistics(Statistics::ROW).c_str()); + switch(output_type) + { + case Cli::VERBOSE: + K::Logger::Logg2(C_CLI,stream,pvt->getStatistics(Statistics::ROW).c_str()); + break; + case Cli::CONCISE: + /* do we need concise ? */ + break; + case Cli::XML: + switch_xml_insert(pvt->getStatisticsXML(Statistics::ROW),xdevs,0); + break; + } } - catch (K3LAPI::invalid_channel & err) + catch (K3LAPITraits::invalid_channel & err) { - K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Unable to find channel %d on device %d!") % err.channel % err.device ); + K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Unable to find channel %d on device %d!") % err.object % err.device ); } } } -void Cli::_KhompShowStatistics::cliDetailedStatistics(unsigned int device, unsigned int channel) +void Cli::_KhompShowStatistics::cliDetailedStatistics(unsigned int device, unsigned int channel, OutputType output_type) { try { Board::KhompPvt *pvt = Board::get(device, channel); - K::Logger::Logg2(C_CLI,stream,"----------------------------------------------"); - K::Logger::Logg2(C_CLI,stream,FMT("Detailed statistics of: Device %02d - Channel %02d") % pvt->target().device % pvt->target().object); - K::Logger::Logg2(C_CLI,stream,pvt->getStatistics(Statistics::DETAILED).c_str()); - K::Logger::Logg2(C_CLI,stream,"----------------------------------------------"); + switch(output_type) + { + case Cli::DETAILED: + { + K::Logger::Logg2(C_CLI,stream,"----------------------------------------------"); + K::Logger::Logg2(C_CLI,stream,FMT("Detailed statistics of: Device %02d - Channel %02d") % pvt->target().device % pvt->target().object); + K::Logger::Logg2(C_CLI,stream,pvt->getStatistics(Statistics::DETAILED).c_str()); + K::Logger::Logg2(C_CLI,stream,"----------------------------------------------"); + } break; + + case Cli::CONCISE: + { + /* We don't have xml, need concise yet ? */ + } break; + + case Cli::XML: + { + /* We don't have concise, need XML yet ? */ + } break; + } } - catch (K3LAPI::invalid_channel & err) + catch (K3LAPITraits::invalid_channel & err) { - K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Unable to find channel %d on device %d!") % err.channel % err.device ); + K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Unable to find channel %d on device %d!") % err.object % err.device ); } } @@ -874,19 +1194,21 @@ bool Cli::_KhompShowStatistics::execute(int argc, char *argv[]) printUsage(stream); return false; } + unsigned int dev = UINT_MAX; unsigned int obj = UINT_MAX; - int detailed = 0, verbose = 0; + int detailed = 0, verbose = 0, as_xml = 0; + OutputType output_type = Cli::VERBOSE; detailed = ((argc > 2) && (!strcasecmp(argv[2], "detailed")) ? 1 : 0 ); verbose = ((argc > 2) && (!strcasecmp(argv[2], "verbose")) ? 1 : 0 ); + as_xml = ((argc > 2) && (!strcasecmp(argv[2], "xml")) ? 1 : 0 ); try { - - if(argc > (2+detailed+verbose)) + if(argc > (2+detailed+verbose+as_xml)) { - dev = Strings::tolong(argv[2+detailed+verbose]); + dev = Strings::tolong(argv[2+detailed+verbose+as_xml]); if (!Globals::k3lapi.valid_device(dev)) { K::Logger::Logg2(C_CLI, stream, "ERROR: No such device!"); @@ -894,9 +1216,9 @@ bool Cli::_KhompShowStatistics::execute(int argc, char *argv[]) } } - if (argc > (3+detailed+verbose)) + if (argc > (3+detailed+verbose+as_xml)) { - std::string object(argv[3+detailed+verbose]); + std::string object(argv[3+detailed+verbose+as_xml]); obj = Strings::tolong(object); if (!Globals::k3lapi.valid_channel(dev, obj)) @@ -910,7 +1232,14 @@ bool Cli::_KhompShowStatistics::execute(int argc, char *argv[]) { K::Logger::Logg2(C_CLI, stream, "ERROR: Invalid numeric value!"); return false; - } + } + + if(detailed) output_type = Cli::DETAILED; + if(as_xml) + { + createRoot("statistics"); + output_type = Cli::XML; + } std::string header; header.append( " ------------------------------------------------------------------------------------\n"); @@ -926,42 +1255,92 @@ bool Cli::_KhompShowStatistics::execute(int argc, char *argv[]) { if (obj != UINT_MAX) { - if(detailed != 0) + switch(output_type) { - cliDetailedStatistics (dev, obj); - } - else - { - K::Logger::Logg2(C_CLI,stream,header.c_str()); - Board::KhompPvt *pvt = Board::get(dev, obj); - K::Logger::Logg2(C_CLI,stream,pvt->getStatistics(Statistics::ROW).c_str()); - K::Logger::Logg2(C_CLI,stream,footer.c_str()); + case Cli::VERBOSE: + { + K::Logger::Logg2(C_CLI,stream,header.c_str()); + Board::KhompPvt *pvt = Board::get(dev, obj); + K::Logger::Logg2(C_CLI,stream,pvt->getStatistics(Statistics::ROW).c_str()); + K::Logger::Logg2(C_CLI,stream,footer.c_str()); + } break; + + case Cli::DETAILED: + { + cliDetailedStatistics (dev, obj, output_type); + } break; + + case Cli::XML: + { + /* no problem, nothing created */ + switch_xml_t xboard = NULL; + + /* device */ + xdevs = switch_xml_add_child_d(root,"device",0); + switch_xml_set_attr_d(xdevs,"id",STR(FMT("%d") % dev)); + + try + { + Board::KhompPvt *pvt = Board::get(dev, obj); + switch_xml_insert(pvt->getStatisticsXML(Statistics::ROW),xdevs,0); + } + catch (K3LAPITraits::invalid_channel & err) + { + K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Unable to find channel %d on device %d!") % err.object % err.device ); + } + + printXMLOutput(stream); + clearRoot(); + } break; } } else { - if(detailed != 0) + switch(output_type) { - printUsage(stream); - return false; - } + case Cli::VERBOSE: + { + K::Logger::Logg2(C_CLI,stream,header.c_str()); - K::Logger::Logg2(C_CLI,stream,header.c_str()); + if (dev == UINT_MAX) + { + for (dev = 0; dev < Globals::k3lapi.device_count(); dev++) + cliStatistics (dev, output_type); + } + else + { + cliStatistics (dev, output_type); + } - if (dev == UINT_MAX) - { - for (dev = 0; dev < Globals::k3lapi.device_count(); dev++) - cliStatistics (dev); - } - else - { - cliStatistics (dev); + K::Logger::Logg2(C_CLI,stream,footer.c_str()); + } break; + + case Cli::XML: + { + if (dev == UINT_MAX) + { + for (dev = 0; dev < Globals::k3lapi.device_count(); dev++) + cliStatistics (dev, output_type); + } + else + { + cliStatistics (dev, output_type); + } + + printXMLOutput(stream); + clearRoot(); + + } break; + + case Cli::DETAILED: + { + printUsage(stream); + return false; + } break; } - - K::Logger::Logg2(C_CLI,stream,footer.c_str()); } } - catch(K3LAPI::invalid_channel &e) + catch(K3LAPITraits::invalid_channel &e) { K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Unable to find channel %d on device %d!") % obj % dev ); } @@ -969,11 +1348,10 @@ bool Cli::_KhompShowStatistics::execute(int argc, char *argv[]) return true; } -void Cli::_KhompShowChannels::showChannel(unsigned int device, bool concise, unsigned int channel) +void Cli::_KhompShowChannels::showChannel(unsigned int device, unsigned int channel, OutputType output_type) { try { - Board::KhompPvt *pvt = Board::get(device, channel); DBG(FUNC, PVT_FMT(pvt->target(), "found channel..")); @@ -990,78 +1368,129 @@ void Cli::_KhompShowChannels::showChannel(unsigned int device, bool concise, uns std::string tmp_call = Globals::k3lutil.callStatus( pvt->target().device, pvt->target().object, - (concise ? Verbose::EXACT : Verbose::HUMAN)); + (output_type == Cli::CONCISE ? Verbose::EXACT : Verbose::HUMAN)); std::string tmp_chan = Globals::k3lutil.channelStatus( pvt->target().device, pvt->target().object, - (concise ? Verbose::EXACT : Verbose::HUMAN)); + (output_type == Cli::CONCISE ? Verbose::EXACT : Verbose::HUMAN)); - if (concise) - { - std::string state = pvt->getStateString(); - if (pvt->getSignaling() == ksigGSM) - { - K3L_GSM_CHANNEL_STATUS gsmStatus; + switch(output_type) + { + case Cli::VERBOSE: + { + if (pvt->getSignaling() == ksigGSM) + { + K3L_GSM_CHANNEL_STATUS gsmStatus; - if (k3lGetDeviceStatus(device, channel + ksoGsmChannel, &gsmStatus, sizeof(gsmStatus)) != ksSuccess) - return; + if (k3lGetDeviceStatus(device, channel + ksoGsmChannel, &gsmStatus, sizeof(gsmStatus)) != ksSuccess) + return; - const unsigned int sign_numb = (gsmStatus.SignalStrength != 255 ? gsmStatus.SignalStrength : 0); + const unsigned int sign_numb = (gsmStatus.SignalStrength != 255 ? gsmStatus.SignalStrength : 0); - std::string gsm_registry = (strlen(gsmStatus.OperName) != 0 ? gsmStatus.OperName : "<none>"); + const unsigned int full_size = 10; + const unsigned int sign_size = std::min((sign_numb * full_size) / 100, full_size); - K::Logger::Logg2(C_CLI, stream, FMT("B%02dC%02d:%s:%s:%s:%d%%:%s") - % device % channel % state % tmp_call % tmp_chan - % sign_numb % gsm_registry); - } - else - { - K::Logger::Logg2(C_CLI, stream, FMT("B%02dC%02d:%s:%s:%s") - % device % channel % state % tmp_call % tmp_chan); - } - } - else - { - if (pvt->getSignaling() == ksigGSM) - { - K3L_GSM_CHANNEL_STATUS gsmStatus; + std::string tmp_antenna_level; + + for (unsigned int i = 0; i < sign_size; i++) + tmp_antenna_level += '*'; + + for (unsigned int i = sign_size; i < full_size; i++) + tmp_antenna_level += ' '; + + tmp_chan += " ("; + tmp_chan += (strlen(gsmStatus.OperName) != 0 ? gsmStatus.OperName : "..."); + tmp_chan += ")"; + + K::Logger::Logg2(C_CLI, stream, FMT("| %d,%02d | %8s | %8s | %-23s | %02d%% |%s|") + % device % channel % pvt->getStateString() % tmp_call % tmp_chan + % sign_numb % tmp_antenna_level); + } + else + { + K::Logger::Logg2(C_CLI, stream, FMT("| %d,%02d | %8s | %8s | %-40s |") + % device % channel % pvt->getStateString() % tmp_call % tmp_chan); + } - if (k3lGetDeviceStatus(device, channel + ksoGsmChannel, &gsmStatus, sizeof(gsmStatus)) != ksSuccess) - return; + } break; - const unsigned int sign_numb = (gsmStatus.SignalStrength != 255 ? gsmStatus.SignalStrength : 0); + case Cli::CONCISE: + { + std::string state = pvt->getStateString(); - const unsigned int full_size = 10; - const unsigned int sign_size = std::min((sign_numb * full_size) / 100, full_size); + if (pvt->getSignaling() == ksigGSM) + { + K3L_GSM_CHANNEL_STATUS gsmStatus; - std::string tmp_antenna_level; + if (k3lGetDeviceStatus(device, channel + ksoGsmChannel, &gsmStatus, sizeof(gsmStatus)) != ksSuccess) + return; - for (unsigned int i = 0; i < sign_size; i++) - tmp_antenna_level += '*'; + const unsigned int sign_numb = (gsmStatus.SignalStrength != 255 ? gsmStatus.SignalStrength : 0); - for (unsigned int i = sign_size; i < full_size; i++) - tmp_antenna_level += ' '; + std::string gsm_registry = (strlen(gsmStatus.OperName) != 0 ? gsmStatus.OperName : "<none>"); - tmp_chan += " ("; - tmp_chan += (strlen(gsmStatus.OperName) != 0 ? gsmStatus.OperName : "..."); - tmp_chan += ")"; + K::Logger::Logg2(C_CLI, stream, FMT("B%02dC%02d:%s:%s:%s:%d%%:%s") + % device % channel % state % tmp_call % tmp_chan + % sign_numb % gsm_registry); + } + else + { + K::Logger::Logg2(C_CLI, stream, FMT("B%02dC%02d:%s:%s:%s") + % device % channel % state % tmp_call % tmp_chan); + } + + } break; + + case Cli::XML: + { + /* device/channel */ + switch_xml_t xchannel = switch_xml_add_child_d(xdev,"channel",0); + switch_xml_set_attr_d(xchannel,"id",STR(FMT("%d") % channel)); + + /* device/channel/fs_state */ + switch_xml_t xstate = switch_xml_add_child_d(xchannel,"fs_state",0); + switch_xml_set_txt_d(xstate, pvt->getStateString().c_str()); + + /* device/channel/call */ + switch_xml_t xcall = switch_xml_add_child_d(xchannel,"call",0); + switch_xml_set_txt_d(xcall, tmp_call.c_str()); + + /* device/channel/status */ + switch_xml_t xstatus = switch_xml_add_child_d(xchannel,"status",0); + switch_xml_set_txt_d(xstatus, tmp_chan.c_str()); + + if (pvt->getSignaling() == ksigGSM) + { + K3L_GSM_CHANNEL_STATUS gsmStatus; + + if (k3lGetDeviceStatus(device, channel + ksoGsmChannel, &gsmStatus, sizeof(gsmStatus)) != ksSuccess) + return; + + const unsigned int sign_numb = (gsmStatus.SignalStrength != 255 ? gsmStatus.SignalStrength : 0); + std::string gsm_registry = (strlen(gsmStatus.OperName) != 0 ? gsmStatus.OperName : "<none>"); + + /* device/channel/signal */ + switch_xml_t xsign_numb = switch_xml_add_child_d(xchannel, "signal", 0); + switch_xml_set_txt_d(xsign_numb, STR(FMT("%d") % sign_numb)); + + /* device/channel/registry */ + switch_xml_t xgsm_registry = switch_xml_add_child_d(xchannel, "registry", 9); + switch_xml_set_txt_d(xgsm_registry, gsm_registry.c_str()); + } + + } break; + + default: + /* do nothing */ + break; + } - K::Logger::Logg2(C_CLI, stream, FMT("| %d,%02d | %8s | %8s | %-23s | %02d%% |%s|") - % device % channel % pvt->getStateString() % tmp_call % tmp_chan - % sign_numb % tmp_antenna_level); - } - else - { - K::Logger::Logg2(C_CLI, stream, FMT("| %d,%02d | %8s | %8s | %-40s |") - % device % channel % pvt->getStateString() % tmp_call % tmp_chan); - } - } } - catch (K3LAPI::invalid_channel & err) + catch (K3LAPITraits::invalid_channel & err) { - K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Unable to find channel %d on device %d!") % err.channel % err.device ); + K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Unable to find channel %d on device %d!") % err.object % err.device ); } catch (...) { @@ -1069,18 +1498,26 @@ void Cli::_KhompShowChannels::showChannel(unsigned int device, bool concise, uns } } -void Cli::_KhompShowChannels::showChannels(unsigned int device, bool concise) +void Cli::_KhompShowChannels::showChannels(unsigned int device, OutputType output_type) { + if(output_type == Cli::XML) + { + /* channels/device */ + xdev = switch_xml_add_child_d(root,"device",0); + switch_xml_set_attr_d(xdev, "id", STR(FMT("%d") % device)); + } + for (unsigned int channel = 0; channel < Globals::k3lapi.channel_count(device); channel++) { - showChannel(device, concise, channel); + showChannel(device, channel, output_type); } } bool Cli::_KhompShowChannels::execute(int argc, char *argv[]) { unsigned int dev = UINT_MAX; - int concise = 0, verbose = 0; + int concise = 0, verbose = 0, as_xml = 0; + OutputType output_type = Cli::VERBOSE; bool onlyShowOneChannel = false; unsigned int channelToShow = 0; @@ -1093,10 +1530,11 @@ bool Cli::_KhompShowChannels::execute(int argc, char *argv[]) concise = ( ((argc == 3) || (argc == 4) || (argc == 5) ) && (ARG_CMP(2, "concise")) ? 1 : 0 ); verbose = ( ((argc == 3) || (argc == 4) || (argc == 5) ) && (ARG_CMP(2, "verbose")) ? 1 : 0 ); + as_xml = ( ((argc == 3) || (argc == 4) || (argc == 5) ) && (ARG_CMP(2, "xml")) ? 1 : 0 ); - if (argc >= (3 + concise + verbose)) + if (argc >= (3 + concise + verbose + as_xml)) { - dev = atoi (argv[2 + concise + verbose]); + dev = atoi (argv[2 + concise + verbose + as_xml]); if (!Globals::k3lapi.valid_device(dev)) { @@ -1104,14 +1542,14 @@ bool Cli::_KhompShowChannels::execute(int argc, char *argv[]) return false; } - if (argc == ( 4 + concise + verbose )) + if (argc == ( 4 + concise + verbose + as_xml)) { onlyShowOneChannel = true; - channelToShow = atoi (argv[3 + concise + verbose]); + channelToShow = atoi (argv[3 + concise + verbose + as_xml]); } } - if (concise == 0) + if (concise == 0 && as_xml == 0) { K::Logger::Logg2(C_CLI, stream, " -----------------------------------------------------------------------"); K::Logger::Logg2(C_CLI, stream, "|-------------------- Khomp Channels and Connections -------------------|"); @@ -1119,13 +1557,29 @@ bool Cli::_KhompShowChannels::execute(int argc, char *argv[]) K::Logger::Logg2(C_CLI, stream, "| hw |freeSWITCH| call | channel |"); K::Logger::Logg2(C_CLI, stream, "| id | status | status | status |"); K::Logger::Logg2(C_CLI, stream, " -----------------------------------------------------------------------"); - } + } + + if (concise != 0) output_type = Cli::CONCISE; + if (as_xml != 0) + { + output_type = Cli::XML; + + /* channels */ + createRoot("channels"); + } if ( onlyShowOneChannel ) { if ( channelToShow < Globals::k3lapi.channel_count(dev) ) { - showChannel (dev,(concise == 0 ? false : true), channelToShow); + if(output_type == Cli::XML) + { + /* channels/device */ + xdev = switch_xml_add_child_d(root,"device",0); + switch_xml_set_attr_d(xdev, "id", STR(FMT("%d") % dev)); + } + + showChannel (dev, channelToShow, output_type); } else { @@ -1136,74 +1590,173 @@ bool Cli::_KhompShowChannels::execute(int argc, char *argv[]) { for (dev = 0; dev < Globals::k3lapi.device_count(); dev++) { - showChannels(dev, (concise == 0 ? false : true)); + showChannels(dev, output_type); } } else { - showChannels ( dev, (concise == 0 ? false : true)); + showChannels ( dev, output_type); } - if (concise == 0) + if (concise == 0 && as_xml == 0) K::Logger::Logg2(C_CLI, stream, " -----------------------------------------------------------------------"); + if(output_type == Cli::XML) + { + printXMLOutput(stream); + clearRoot(); + } + return true; } -void Cli::_KhompShowLinks::showLinks(unsigned int device, bool concise) +std::string Cli::_KhompShowLinks::getLinkStatus(int dev, int obj, Verbose::Presentation fmt) { - if (!concise) + switch(Globals::k3lapi.device_type(dev)) + { + case kdtE1FXSSpx: + if (obj == 1) + return Globals::k3lutil.linkStatus(dev, obj, fmt, ksigAnalogTerminal, true); + default: + break; + } + + std::string res; + + try + { + const K3L_LINK_CONFIG & conf = Globals::k3lapi.link_config(dev, obj); + + res = Globals::k3lutil.linkStatus(dev, obj, fmt); + + if (conf.ReceivingClock & 0x01) + res += (fmt == Verbose::EXACT ? ",sync" : " (sync)"); + } + catch (K3LAPITraits::invalid_target & e) + { + res = "<error>"; + } + + return res; +} + +void Cli::_KhompShowLinks::showLinks(unsigned int device, OutputType output_type) +{ + if (output_type != Cli::CONCISE && output_type != Cli::XML) K::Logger::Logg2(C_CLI, stream, "|------------------------------------------------------------------------|"); switch (Globals::k3lutil.physicalLinkCount(device, true)) { case 1: { - std::string str_link0 = Globals::k3lutil.getLinkStatus(device, 0, (concise ? Verbose::EXACT : Verbose::HUMAN)); + std::string str_link0 = getLinkStatus(device, 0, (output_type == Cli::CONCISE ? Verbose::EXACT : Verbose::HUMAN)); + + switch(output_type) + { + case Cli::VERBOSE: + { + K::Logger::Logg2(C_CLI, stream, FMT("| Link '0' on board '%d': %-47s |") % device % str_link0); + } break; + + case Cli::CONCISE: + { + K::Logger::Logg2(C_MESSAGE, stream, FMT("B%02dL00:%s") % device % str_link0); + } break; + + case Cli::XML: + { + /* device */ + xdev = switch_xml_add_child_d(root,"device",0); + switch_xml_set_attr_d(xdev,"id",STR(FMT("%d") % device)); + + /* device/links */ + switch_xml_t xlinks = switch_xml_add_child_d(xdev,"links",0); + + /* device/links/link */ + switch_xml_t xlink = switch_xml_add_child_d(xlinks,"link",0); + switch_xml_set_attr_d(xlink, "id", "0"); + switch_xml_set_txt_d(xlink, str_link0.c_str()); + } break; + } - if (concise) - K::Logger::Logg2(C_MESSAGE, stream, FMT("B%02dL00:%s") % device % str_link0); - else - K::Logger::Logg2(C_CLI, stream, FMT("| Link '0' on board '%d': %-47s |") % device % str_link0); break; } case 2: { - std::string str_link0 = Globals::k3lutil.getLinkStatus(device, 0, (concise ? Verbose::EXACT : Verbose::HUMAN)); - std::string str_link1 = Globals::k3lutil.getLinkStatus(device, 1, (concise ? Verbose::EXACT : Verbose::HUMAN)); + std::string str_link0 = getLinkStatus(device, 0, (output_type == Cli::CONCISE ? Verbose::EXACT : Verbose::HUMAN)); + std::string str_link1 = getLinkStatus(device, 1, (output_type == Cli::CONCISE ? Verbose::EXACT : Verbose::HUMAN)); - if (concise) - { - K::Logger::Logg2(C_MESSAGE, stream, FMT("B%02dL00:%s") % device % str_link0); - K::Logger::Logg2(C_MESSAGE, stream, FMT("B%02dL01:%s") % device % str_link1); - } - else + switch(output_type) { - K::Logger::Logg2(C_CLI, stream, FMT("|------ Link '0' on board '%d' ------||------ Link '1' on board '%d' ------|") - % device % device); + case Cli::VERBOSE: + { + K::Logger::Logg2(C_CLI, stream, FMT("|------ Link '0' on board '%d' ------||------ Link '1' on board '%d' ------|") + % device % device); + + K::Logger::Logg2(C_CLI, stream, FMT("| %-33s || %-33s |") % str_link0 % str_link1); + } break; + + case Cli::CONCISE: + { + K::Logger::Logg2(C_MESSAGE, stream, FMT("B%02dL00:%s") % device % str_link0); + K::Logger::Logg2(C_MESSAGE, stream, FMT("B%02dL01:%s") % device % str_link1); + } break; - K::Logger::Logg2(C_CLI, stream, FMT("| %-33s || %-33s |") % str_link0 % str_link1); + case Cli::XML: + { + /* device */ + xdev = switch_xml_add_child_d(root,"device",0); + switch_xml_set_attr_d(xdev,"id",STR(FMT("%d") % device)); + + /* device/links */ + switch_xml_t xlinks = switch_xml_add_child_d(xdev,"links",0); + + /* device/links/link (0) */ + switch_xml_t xlink = switch_xml_add_child_d(xlinks,"link",0); + switch_xml_set_attr_d(xlink, "id", "0"); + switch_xml_set_txt_d(xlink, str_link0.c_str()); + + /* device/links/link (1) */ + switch_xml_t xlink1 = switch_xml_add_child_d(xlinks,"link",0); + switch_xml_set_attr_d(xlink1, "id", "1"); + switch_xml_set_txt_d(xlink1, str_link0.c_str()); + } break; } break; } default: { - if (concise) - K::Logger::Logg2(C_MESSAGE, stream, FMT("B%02dLXX:NoLinksAvailable") % device); - else - K::Logger::Logg2(C_CLI, stream, FMT("| Board '%d': %-59s |") % device % "No links available."); + switch(output_type) + { + case Cli::VERBOSE: + { + K::Logger::Logg2(C_CLI, stream, FMT("| Board '%d': %-59s |") % device % "No links available."); + } break; + + case Cli::CONCISE: + { + K::Logger::Logg2(C_MESSAGE, stream, FMT("B%02dLXX:NoLinksAvailable") % device); + } break; + + case Cli::XML: + { + /* device */ + xdev = switch_xml_add_child_d(root,"device",0); + switch_xml_set_attr_d(xdev,"id",STR(FMT("%d") % device)); + switch_xml_set_txt_d(xdev,"NoLinksAvailable"); + } break; + } + break; } } - } -void Cli::_KhompShowLinks::showErrors(unsigned int device, bool concise) +void Cli::_KhompShowLinks::showErrors(unsigned int device, OutputType output_type) { - - if (!concise) + if (output_type != Cli::CONCISE && output_type != Cli::XML) K::Logger::Logg2(C_CLI, stream, "|-----------------------------------------------------------------------|"); switch (Globals::k3lutil.physicalLinkCount(device, true)) @@ -1211,33 +1764,77 @@ void Cli::_KhompShowLinks::showErrors(unsigned int device, bool concise) case 2: { K3LUtil::ErrorCountType link0 = Globals::k3lutil.linkErrorCount( - device, 0, (concise ? Verbose::EXACT : Verbose::HUMAN)); + device, 0, (output_type == Cli::CONCISE ? Verbose::EXACT : Verbose::HUMAN)); K3LUtil::ErrorCountType link1 = Globals::k3lutil.linkErrorCount( - device, 1, (concise ? Verbose::EXACT : Verbose::HUMAN)); + device, 1, (output_type == Cli::CONCISE ? Verbose::EXACT : Verbose::HUMAN)); - if (concise) + switch(output_type) { - for (K3LUtil::ErrorCountType::iterator i = link0.begin(); i != link0.end(); i++) - K::Logger::Logg2(C_CLI, stream, FMT("%d:0:%s:%d") % device % i->first % i->second); + case Cli::VERBOSE: + { + K::Logger::Logg2(C_CLI, stream, FMT("|----- Link '0' on board '%d' ------| |----- Link '1' on board '%d' ------|") % device % device); + K::Logger::Logg2(C_CLI, stream, "|----------------------------------| |----------------------------------|"); + K::Logger::Logg2(C_CLI, stream, "| Error type | Number | | Error type | Number |"); + K::Logger::Logg2(C_CLI, stream, "|----------------------------------| |----------------------------------|"); - for (K3LUtil::ErrorCountType::iterator i = link1.begin(); i != link1.end(); i++) - K::Logger::Logg2(C_CLI, stream, FMT("%d:1:%s:%d") % device % i->first % i->second); - } - else - { - K::Logger::Logg2(C_CLI, stream, FMT("|----- Link '0' on board '%d' ------| |----- Link '1' on board '%d' ------|") % device % device); - K::Logger::Logg2(C_CLI, stream, "|----------------------------------| |----------------------------------|"); - K::Logger::Logg2(C_CLI, stream, "| Error type | Number | | Error type | Number |"); - K::Logger::Logg2(C_CLI, stream, "|----------------------------------| |----------------------------------|"); + K3LUtil::ErrorCountType::iterator i = link0.begin(); + K3LUtil::ErrorCountType::iterator j = link1.begin(); - K3LUtil::ErrorCountType::iterator i = link0.begin(); - K3LUtil::ErrorCountType::iterator j = link1.begin(); + for (; i != link0.end() && j != link1.end(); i++, j++) + { + K::Logger::Logg2(C_CLI, stream, FMT("| %22s | %-7d | | %22s | %-7d |") + % i->first % i->second % j->first % j->second); + } + } break; - for (; i != link0.end() && j != link1.end(); i++, j++) + case Cli::CONCISE: { - K::Logger::Logg2(C_CLI, stream, FMT("| %22s | %-7d | | %22s | %-7d |") - % i->first % i->second % j->first % j->second); - } + for (K3LUtil::ErrorCountType::iterator i = link0.begin(); i != link0.end(); i++) + K::Logger::Logg2(C_CLI, stream, FMT("%d:0:%s:%d") % device % i->first % i->second); + + for (K3LUtil::ErrorCountType::iterator i = link1.begin(); i != link1.end(); i++) + K::Logger::Logg2(C_CLI, stream, FMT("%d:1:%s:%d") % device % i->first % i->second); + } break; + + case Cli::XML: + { + /* device */ + xdev = switch_xml_add_child_d(root,"device",0); + switch_xml_set_attr_d(xdev,"id",STR(FMT("%d") % device)); + + /* device/errors */ + switch_xml_t xerrors = switch_xml_add_child_d(xdev,"errors",0); + + /* device/errors/link (0) */ + switch_xml_t xlinks0 = switch_xml_add_child_d(xerrors,"link",0); + switch_xml_set_attr_d(xlinks0,"id","0"); + + for (K3LUtil::ErrorCountType::iterator i = link0.begin(); i != link0.end(); i++) + { + /* device/errors/link/type */ + switch_xml_t xtype0 = switch_xml_add_child_d(xlinks0,"type",0); + switch_xml_set_txt_d(xtype0,i->first.c_str()); + + /* device/errors/link/number */ + switch_xml_t xnumber0 = switch_xml_add_child_d(xlinks0,"number",0); + switch_xml_set_txt_d(xnumber0,STR(FMT("%d") % i->second)); + } + + /* device/errors/link (1) */ + switch_xml_t xlinks1 = switch_xml_add_child_d(xerrors,"link",0); + switch_xml_set_attr_d(xlinks1,"id","1"); + + for (K3LUtil::ErrorCountType::iterator i = link1.begin(); i != link1.end(); i++) + { + /* device/errors/link/type */ + switch_xml_t xtype1 = switch_xml_add_child_d(xlinks1,"type",0); + switch_xml_set_txt_d(xtype1,i->first.c_str()); + + /* device/errors/link/number */ + switch_xml_t xnumber1 = switch_xml_add_child_d(xlinks1,"number",0); + switch_xml_set_txt_d(xnumber1,STR(FMT("%d") % i->second)); + } + } break; } break; @@ -1245,22 +1842,51 @@ void Cli::_KhompShowLinks::showErrors(unsigned int device, bool concise) case 1: { - K3LUtil::ErrorCountType link0 = Globals::k3lutil.linkErrorCount(device, 0, (concise ? Verbose::EXACT : Verbose::HUMAN)); + K3LUtil::ErrorCountType link0 = Globals::k3lutil.linkErrorCount(device, 0, (output_type == Cli::CONCISE ? Verbose::EXACT : Verbose::HUMAN)); - if (concise) - { - for (K3LUtil::ErrorCountType::iterator i = link0.begin(); i != link0.end(); i++) - K::Logger::Logg2(C_CLI, stream, FMT("%d:0:%s:%d") % device % i->first % i->second); - } - else + switch(output_type) { - K::Logger::Logg2(C_CLI, stream, FMT("|------------------------ Link '0' on board '%d' ------------------------|") % device); - K::Logger::Logg2(C_CLI, stream, "|-----------------------------------------------------------------------|"); - K::Logger::Logg2(C_CLI, stream, "| Error type | Number |"); - K::Logger::Logg2(C_CLI, stream, "|-----------------------------------------------------------------------|"); + case Cli::VERBOSE: + { + K::Logger::Logg2(C_CLI, stream, FMT("|------------------------ Link '0' on board '%d' ------------------------|") % device); + K::Logger::Logg2(C_CLI, stream, "|-----------------------------------------------------------------------|"); + K::Logger::Logg2(C_CLI, stream, "| Error type | Number |"); + K::Logger::Logg2(C_CLI, stream, "|-----------------------------------------------------------------------|"); + + for (K3LUtil::ErrorCountType::iterator i = link0.begin(); i != link0.end(); i++) + K::Logger::Logg2(C_CLI, stream, FMT("| %52s | %-14d |") % i->first % i->second); + } break; + + case Cli::CONCISE: + { + for (K3LUtil::ErrorCountType::iterator i = link0.begin(); i != link0.end(); i++) + K::Logger::Logg2(C_CLI, stream, FMT("%d:0:%s:%d") % device % i->first % i->second); + } break; - for (K3LUtil::ErrorCountType::iterator i = link0.begin(); i != link0.end(); i++) - K::Logger::Logg2(C_CLI, stream, FMT("| %52s | %-14d |") % i->first % i->second); + case Cli::XML: + { + /* device */ + xdev = switch_xml_add_child_d(root,"device",0); + switch_xml_set_attr_d(xdev,"id",STR(FMT("%d") % device)); + + /* device/errors */ + switch_xml_t xerrors = switch_xml_add_child_d(xdev,"errors",0); + + /* device/errors/link (0) */ + switch_xml_t xlinks0 = switch_xml_add_child_d(xerrors,"link",0); + switch_xml_set_attr_d(xlinks0,"id","0"); + + for (K3LUtil::ErrorCountType::iterator i = link0.begin(); i != link0.end(); i++) + { + /* device/errors/link/type */ + switch_xml_t xtype0 = switch_xml_add_child_d(xlinks0,"type",0); + switch_xml_set_txt_d(xtype0,i->first.c_str()); + + /* device/errors/link/number */ + switch_xml_t xnumber0 = switch_xml_add_child_d(xlinks0,"number",0); + switch_xml_set_txt_d(xnumber0,STR(FMT("%d") % i->second)); + } + } break; } break; @@ -1268,7 +1894,7 @@ void Cli::_KhompShowLinks::showErrors(unsigned int device, bool concise) case 0: { - if (!concise) + if (output_type != Cli::XML && output_type != Cli::CONCISE) K::Logger::Logg2(C_CLI, stream, FMT("| No links detected on board %d! |") % device); break; @@ -1285,16 +1911,18 @@ bool Cli::_KhompShowLinks::execute(int argc, char *argv[]) } unsigned int dev = UINT_MAX; - int concise = 0, verbose = 0, errors = 0; + int concise = 0, verbose = 0, as_xml = 0, errors = 0; + OutputType output_type = Cli::VERBOSE; errors = ( (argc > 2) && (!strcasecmp(argv[2],"errors")) ? 1 : 0 ); concise = ( (argc > (2+errors)) && (!strcasecmp(argv[(2+errors)],"concise")) ? 1 : 0 ); verbose = ( (argc > (2+errors)) && (!strcasecmp(argv[(2+errors)],"verbose")) ? 1 : 0 ); + as_xml = ( (argc > (2+errors)) && (!strcasecmp(argv[(2+errors)],"xml")) ? 1 : 0 ); - if(argc > (2+errors+concise+verbose)) + if(argc > (2+errors+concise+verbose+as_xml)) { - dev = atoi(argv[(2+errors+concise+verbose)]); + dev = atoi(argv[(2+errors+concise+verbose+as_xml)]); if (!Globals::k3lapi.valid_device(dev)) { @@ -1303,7 +1931,8 @@ bool Cli::_KhompShowLinks::execute(int argc, char *argv[]) } } - if (!concise) + + if (!concise && !as_xml) { K::Logger::Logg2(C_CLI, stream, " ------------------------------------------------------------------------"); if(!errors) @@ -1316,17 +1945,24 @@ bool Cli::_KhompShowLinks::execute(int argc, char *argv[]) } } + if(concise) output_type = Cli::CONCISE; + if(as_xml) + { + output_type = Cli::XML; + createRoot("links"); + } + if (dev == UINT_MAX) { for (dev = 0; dev < Globals::k3lapi.device_count(); dev++) { if(!errors) { - showLinks (dev, (concise == 1)); + showLinks (dev, output_type); } else { - showErrors(dev, (concise == 1)); + showErrors(dev, output_type); } } } @@ -1334,19 +1970,25 @@ bool Cli::_KhompShowLinks::execute(int argc, char *argv[]) { if(!errors) { - showLinks (dev, (concise == 1)); + showLinks (dev, output_type); } else { - showErrors(dev, (concise == 1)); + showErrors(dev, output_type); } } - if (!concise) + if (!concise && !as_xml) { K::Logger::Logg2(C_CLI, stream, " ------------------------------------------------------------------------"); } + if (as_xml) + { + printXMLOutput(stream); + clearRoot(); + } + return true; } @@ -1503,9 +2145,9 @@ bool Cli::_KhompClearStatistics::execute(int argc, char *argv[]) } } - catch (K3LAPI::invalid_channel & err) + catch (K3LAPITraits::invalid_channel & err) { - K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Unable to find channel %d on device %d!") % err.channel % err.device ); + K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Unable to find channel %d on device %d!") % err.object % err.device ); return false; } @@ -1636,7 +2278,7 @@ bool Cli::_KhompSMS::execute(int argc, char *argv[]) } std::string complete = begin + devs + "/" + numb + "/" + mesg; - int cause; + int cause = (int)SWITCH_CAUSE_NONE; try { @@ -1922,7 +2564,7 @@ bool Cli::_KhompLogTraceISDN::execute(int argc, char *argv[]) std::string what; - for (unsigned int i = 4; i < (unsigned int)argc; i++) + for (unsigned int i = 3; i < (unsigned int)argc; i++) { what += argv[i]; what += ","; @@ -2045,10 +2687,10 @@ bool Cli::_KhompGet::execute(int argc, char *argv[]) try { - std::string res = Globals::options.get((const char*) argv[1]); + std::string res = Globals::options.get(&Opt::_options, (const char*) argv[1]); K::Logger::Logg2(C_CLI, stream, FMT("Result for command %s is %s.") % std::string(argv[1]) % res); - }catch(ConfigProcessFailure &e){ - K::Logger::Logg2(C_CLI, stream, (char*) e.msg.c_str()); + }catch(Config::Failure &e){ + K::Logger::Logg2(C_CLI, stream, e.what()); } return true; @@ -2075,11 +2717,11 @@ bool Cli::_KhompSet::execute(int argc, char *argv[]) try { - Globals::options.process((const char *) argv[1], (const char *) args.c_str()); + Globals::options.process(&Opt::_options, (const char *) argv[1], (const char *) args.c_str()); } - catch (ConfigProcessFailure &e) + catch (Config::Failure &e) { - K::Logger::Logg2(C_CLI,stream, FMT("config processing error: %s.") % e.msg.c_str()); + K::Logger::Logg2(C_CLI,stream, FMT("config processing error: %s.") % e.what()); } return true; @@ -2256,9 +2898,9 @@ bool Cli::_KhompSelectSim::execute(int argc, char *argv[]) K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Invalid number '%s'!") % e.value()); return false; } - catch (K3LAPI::invalid_channel & err) + catch (K3LAPITraits::invalid_channel & err) { - K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Unable to find channel %d on device %d!") % err.channel % err.device ); + K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Unable to find channel %d on device %d!") % err.object % err.device ); return false; } catch(...) @@ -2284,7 +2926,7 @@ bool Cli::_KhompKommuterOnOff::execute(int argc, char *argv[]) case 0: K::Logger::Logg2(C_CLI, stream, "ERROR: none Kommuter was found on the system." ); return false; } - if (Opt::_kommuter_activation == "auto") + if (Opt::_options._kommuter_activation() == "auto") { K::Logger::Logg2(C_CLI, stream, "ERROR: Kommuter is set to be started automatically by kommuter-activation configuration."); return false; @@ -2295,7 +2937,7 @@ bool Cli::_KhompKommuterOnOff::execute(int argc, char *argv[]) int ret = 0; if (on_off) { - int timeout = Opt::_kommuter_timeout; + int timeout = Opt::_options._kommuter_timeout(); K::Logger::Logg2(C_CLI, stream, FMT("NOTICE: Activating Kommuters with timeout of %d seconds .") % timeout); bool start_timer = false; diff --git a/src/mod/endpoints/mod_khomp/src/globals.cpp b/src/mod/endpoints/mod_khomp/src/globals.cpp index cdc20ef..d43ff53 100644 --- a/src/mod/endpoints/mod_khomp/src/globals.cpp +++ b/src/mod/endpoints/mod_khomp/src/globals.cpp @@ -52,7 +52,9 @@ Globals::GlobalTimer * Globals::global_timer = NULL; Globals::Mutex Globals::khomp_alloc_mutex; -ConfigOptions Globals::options; +Config::Options Globals::options; + +const Regex::Expression Globals::regex_allocation("(((([bB])[ ]*([0-9]+))|(([sS])[ ]*([0-9]+)))[ ]*(([cClL])[ ]*([0-9]+)[ ]*([-][ ]*([0-9]+))?)?)|(([rR])[ ]*([0-9]+)[ ]*([-][ ]*([0-9]+))?)", Regex::E_EXTENDED); switch_endpoint_interface_t * Globals::khomp_endpoint_interface = NULL; switch_endpoint_interface_t * Globals::khomp_sms_endpoint_interface = NULL; diff --git a/src/mod/endpoints/mod_khomp/src/khomp_pvt.cpp b/src/mod/endpoints/mod_khomp/src/khomp_pvt.cpp index 225312b..3abbe3e 100644 --- a/src/mod/endpoints/mod_khomp/src/khomp_pvt.cpp +++ b/src/mod/endpoints/mod_khomp/src/khomp_pvt.cpp @@ -54,7 +54,7 @@ char Board::_cng_buffer[Globals::cng_buffer_size]; Kommuter Board::kommuter; -Board::KhompPvt::KhompPvt(K3LAPI::target & target) : +Board::KhompPvt::KhompPvt(K3LAPIBase::GenericTarget & target) : _target(target), _mutex(Globals::module_pool), _session(NULL), @@ -66,6 +66,10 @@ Board::KhompPvt::KhompPvt(K3LAPI::target & target) : _write_codec.implementation = NULL; _pvt_statistics = new PvtStatistics(this); + + _mohclass = Opt::_options._global_mohclass(); + _language = Opt::_options._global_language(); + _accountcode = Opt::_options._accountcode(); } bool Board::initializeK3L(void) @@ -82,7 +86,7 @@ bool Board::initializeK3L(void) } catch (K3LAPI::start_failed & e) { - LOG(ERROR,FMT("loading K3L API failed: %s") % e.msg); + LOG(ERROR,FMT("loading K3L API failed: %s") % e.what()); return false; } @@ -236,7 +240,7 @@ void Board::initializeChannels(void) for (unsigned obj = 0; obj < Globals::k3lapi.channel_count(_device_id); obj++) { - K3LAPI::target tgt(Globals::k3lapi, K3LAPI::target::CHANNEL, _device_id, obj); + K3LAPIBase::GenericTarget tgt(Globals::k3lapi, K3LAPIBase::GenericTarget::CHANNEL, _device_id, obj); KhompPvt * pvt; @@ -328,7 +332,25 @@ bool Board::initialize(void) { initializeCngBuffer(); - initializeBoards(); + try + { + initializeBoards(); + } + catch(K3LAPITraits::invalid_device & err) + { + LOG(ERROR, FMT("Invalid device at initialize boards: %s") % err.what()); + return false; + } + catch(K3LAPITraits::invalid_channel & err) + { + LOG(ERROR, FMT("Invalid channel at initialize boards: %s") % err.what()); + return false; + } + catch(K3LAPITraits::invalid_link & err) + { + LOG(ERROR, FMT("Invalid link at initialize boards: %s") % err.what()); + return false; + } return true; } @@ -340,7 +362,7 @@ bool Board::finalize(void) return finalizeK3L(); } -void Board::khomp_add_event_board_data(const K3LAPI::target target, switch_event_t *event) +void Board::khomp_add_event_board_data(const K3LAPIBase::GenericTarget target, switch_event_t *event) { //if (!event) { @@ -349,7 +371,7 @@ void Board::khomp_add_event_board_data(const K3LAPI::target target, switch_event try { - if (target.type == K3LAPI::target::CHANNEL) + if (target.type == K3LAPIBase::GenericTarget::CHANNEL) { switch_core_session_t * s = get(target.device, target.object)->session(); switch_channel_event_set_data(Board::KhompPvt::getFSChannel(s), event); @@ -358,7 +380,7 @@ void Board::khomp_add_event_board_data(const K3LAPI::target target, switch_event switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Khomp-DeviceId", "%u", target.device); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Khomp-Object", "%u", target.object); } - catch(K3LAPI::invalid_channel & err) + catch(K3LAPITraits::invalid_channel & err) { LOG(ERROR, PVT_FMT(target, "Invalid channel")); } @@ -385,6 +407,23 @@ std::string Board::KhompPvt::getStatistics(Statistics::Type type) } } +switch_xml_t Board::KhompPvt::getStatisticsXML(Statistics::Type type) +{ + switch(type) + { + case Statistics::DETAILED: + { + return _pvt_statistics->getDetailedXML(); + } + case Statistics::ROW: + { + return _pvt_statistics->getNode(); + } + default: + return NULL; + } +} + std::string Board::KhompPvt::PvtStatistics::getDetailedRates() { /* skip inactive channels */ @@ -429,6 +468,49 @@ std::string Board::KhompPvt::PvtStatistics::getDetailedRates() return strBuffer; } +switch_xml_t Board::KhompPvt::PvtStatistics::getDetailedRatesXML() +{ + switch_xml_t xrates = switch_xml_new("rates"); + + /* this values come from kserver */ + unsigned int call_incoming = Globals::k3lapi.channel_stats( + _pvt->target().device, _pvt->target().object, kcsiInbound); + unsigned int call_outgoing = Globals::k3lapi.channel_stats( + _pvt->target().device, _pvt->target().object, kcsiOutbound); + + float occupation_rate = 100.0; + + if (_pvt->call()->statistics()->_total_idle_time > 0) + { + occupation_rate = 100 * ( + _pvt->call()->statistics()->_total_time_incoming + + _pvt->call()->statistics()->_total_time_outgoing + ) / ( + _pvt->call()->statistics()->_total_idle_time + + _pvt->call()->statistics()->_total_time_incoming + + _pvt->call()->statistics()->_total_time_outgoing); + } + + switch_xml_t xoccupation = switch_xml_add_child_d(xrates,"oucpation",0); + switch_xml_set_txt_d(xoccupation,STR(FMT("%d") % occupation_rate)); + + if (call_incoming > 0) + { + std::string str_calls_incoming_mean = timeToString ( (time_t) (_pvt->call()->statistics()->_total_time_incoming / call_incoming) ); + switch_xml_t xmean_in = switch_xml_add_child_d(xrates,"incoming",0); + switch_xml_set_txt_d(xmean_in,str_calls_incoming_mean.c_str()); + } + + if (call_outgoing > 0) + { + std::string str_calls_outgoing_mean = timeToString ( (time_t) (_pvt->call()->statistics()->_total_time_outgoing / call_outgoing) ); + switch_xml_t xmean_out = switch_xml_add_child_d(xrates,"outgoing",0); + switch_xml_set_txt_d(xmean_out,str_calls_outgoing_mean.c_str()); + } + + return xrates; +} + std::string Board::KhompPvt::PvtStatistics::getDetailed() { /* skip inactive channels */ @@ -456,6 +538,34 @@ std::string Board::KhompPvt::PvtStatistics::getDetailed() return strBuffer; } + +switch_xml_t Board::KhompPvt::PvtStatistics::getDetailedXML() +{ + switch_xml_t xch = _pvt->call()->statistics()->getDetailedXML(); + + /* this values come from kserver */ + unsigned int call_incoming = Globals::k3lapi.channel_stats( + _pvt->target().device, _pvt->target().object, kcsiInbound); + unsigned int call_outgoing = Globals::k3lapi.channel_stats( + _pvt->target().device, _pvt->target().object, kcsiOutbound); + unsigned int call_fails = Globals::k3lapi.channel_stats( + _pvt->target().device, _pvt->target().object, kcsiOutFailed); + + /* total/call_incoming */ + switch_xml_t xin_calls = switch_xml_add_child_d(xch,"calls_incoming",0); + switch_xml_set_txt_d(xin_calls,STR(FMT("%d") % call_incoming)); + + /* total/call_outgoing */ + switch_xml_t xout_calls = switch_xml_add_child_d(xch,"calls_outgoing",0); + switch_xml_set_txt_d(xout_calls,STR(FMT("%d") % call_outgoing)); + + /* total/calls_failed */ + switch_xml_t xfailed_calls = switch_xml_add_child_d(xch,"calls_failed",0); + switch_xml_set_txt_d(xfailed_calls,STR(FMT("%d") % call_fails)); + + return xch; +} + std::string Board::KhompPvt::PvtStatistics::getRow() { /* skip inactive channels */ @@ -498,6 +608,71 @@ std::string Board::KhompPvt::PvtStatistics::getRow() % string_time); } +switch_xml_t Board::KhompPvt::PvtStatistics::getNode() +{ + time_t action_time; + time (&action_time); + + action_time -= _pvt->call()->statistics()->_base_time; + + uint32 calls_incoming = Globals::k3lapi.channel_stats( + _pvt->target().device, _pvt->target().object, kcsiInbound); + uint32 calls_outgoing = Globals::k3lapi.channel_stats( + _pvt->target().device, _pvt->target().object, kcsiOutbound); + uint32 call_fails = Globals::k3lapi.channel_stats( + _pvt->target().device, _pvt->target().object, kcsiOutFailed); + + std::string string_time = " n/a "; + std::string call_type = " none "; + + if (_pvt->call()->_flags.check(Kflags::IS_INCOMING)) + call_type = "incoming"; + else if (_pvt->call()->_flags.check(Kflags::IS_OUTGOING)) + call_type = "outgoing"; + + if (_pvt->owner()) + { + string_time = timeToString(action_time); + } + + /* device/channel */ + switch_xml_t xchn = switch_xml_new("channel"); + switch_xml_set_attr_d(xchn,"id",STR(FMT("%d") % _pvt->target().object)); + + /* device/channel/details */ + switch_xml_t xdetails = switch_xml_add_child_d(xchn,"details",0); + + /* device/channel/details/calls_incomming */ + switch_xml_t xin_calls = switch_xml_add_child_d(xdetails,"calls_incoming",0); + switch_xml_set_txt_d(xin_calls,STR(FMT("%d") % calls_incoming)); + + /* device/channel/details/calls_outgoing */ + switch_xml_t xout_calls = switch_xml_add_child_d(xdetails,"calls_incoming",0); + switch_xml_set_txt_d(xout_calls,STR(FMT("%d") % calls_outgoing)); + + /* device/channel/details/channel_fails */ + switch_xml_t xchn_fails = switch_xml_add_child_d(xdetails,"channel_fails",0); + switch_xml_set_txt_d(xchn_fails,STR(FMT("%d") % _pvt->call()->statistics()->_channel_fails)); + + /* device/channel/details/calls_fails */ + switch_xml_t xcall_fails = switch_xml_add_child_d(xdetails,"calls_fails",0); + switch_xml_set_txt_d(xcall_fails,STR(FMT("%d") % call_fails)); + + /* device/channel/details/state */ + switch_xml_t xstate = switch_xml_add_child_d(xdetails,"state",0); + switch_xml_set_txt_d(xstate,_pvt->getStateString().c_str()); + + /* device/channel/details/call_type */ + switch_xml_t xcall_type = switch_xml_add_child_d(xdetails,"call_type",0); + switch_xml_set_txt_d(xcall_type,call_type.c_str()); + + /* device/channel/details/time */ + switch_xml_t xtime = switch_xml_add_child_d(xdetails,"time",0); + switch_xml_set_txt_d(xtime,string_time.c_str()); + + return xchn; +} + switch_status_t Board::KhompPvt::justAlloc(bool is_answering, switch_memory_pool_t **pool) { DBG(FUNC, PVT_FMT(target(), "c")); @@ -572,6 +747,20 @@ switch_status_t Board::KhompPvt::justAlloc(bool is_answering, switch_memory_pool return SWITCH_STATUS_FALSE; } + try + { + /* accounttcode for CDR identification */ + setFSChannelVar(getFSChannel(),"accountcode",_accountcode.c_str()); + + /* language for IVR machine */ + setFSChannelVar(getFSChannel(),"language",_language.c_str()); + } + catch (Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR, PVT_FMT(target(), "(%s)") % err._msg.c_str() ); + return SWITCH_STATUS_FALSE; + } + DBG(FUNC, PVT_FMT(target(), "r")); return SWITCH_STATUS_SUCCESS; } @@ -612,7 +801,7 @@ switch_status_t Board::KhompPvt::justStart(switch_caller_profile_t *profile) % _call->_dest_addr % (contexts.size() >= 1 ? contexts[0] : "default")); return SWITCH_STATUS_FALSE; default: - DBG(FUNC, PVT_FMT(_target, "our: dialplan '%s', context '%s', exten '%s'") % Opt::_dialplan % context % exten); + DBG(FUNC, PVT_FMT(_target, "our: dialplan '%s', context '%s', exten '%s'") % Opt::_options._dialplan() % context % exten); break; } @@ -621,12 +810,12 @@ switch_status_t Board::KhompPvt::justStart(switch_caller_profile_t *profile) else { exten = call()->_dest_addr; - DBG(FUNC, PVT_FMT(target(), "already found our: dialplan '%s', context '%s', exten '%s'") % Opt::_dialplan % call()->_incoming_context % exten); + DBG(FUNC, PVT_FMT(target(), "already found our: dialplan '%s', context '%s', exten '%s'") % Opt::_options._dialplan() % call()->_incoming_context % exten); } _caller_profile = switch_caller_profile_new(switch_core_session_get_pool(_session), "Khomp", //username - Opt::_dialplan.c_str(), //dialplan + Opt::_options._dialplan().c_str(), //dialplan NULL, //caller_id_name _call->_orig_addr.c_str(), //caller_id_number NULL, //network_addr @@ -645,7 +834,7 @@ switch_status_t Board::KhompPvt::justStart(switch_caller_profile_t *profile) return SWITCH_STATUS_FALSE; } - std::string name = STG(FMT("Khomp/%hu/%hu/%s") + std::string name = STG(FMT("Khomp/%d/%d/%s") % target().device % target().object % _call->_dest_addr); @@ -672,7 +861,7 @@ switch_status_t Board::KhompPvt::justStart(switch_caller_profile_t *profile) if(_call->_orig_addr.empty()) _call->_orig_addr = profile->caller_id_number; - switch_channel_set_name(channel, STG(FMT("Khomp/%hu/%hu/%s") + switch_channel_set_name(channel, STG(FMT("Khomp/%d/%d/%s") % target().device % target().object % (!_call->_dest_addr.empty() ? _call->_dest_addr.c_str() : "")).c_str()); @@ -772,7 +961,7 @@ bool Board::KhompPvt::indicateBusyUnlocked(int cause, bool sent_signaling) Board::board(_target.device)->_timers.del(call()->_idx_pbx_ring); Board::board(_target.device)->_timers.del(call()->_idx_co_ring); } - catch (K3LAPI::invalid_device & err) + catch (K3LAPITraits::invalid_device & err) { LOG(ERROR, PVT_FMT(_target, "Unable to get device: %d!") % err.device); } @@ -824,6 +1013,8 @@ void Board::KhompPvt::destroyAll() switch_core_session_set_private(_session, NULL); _session = NULL; } + + owner(NULL); if(_caller_profile) { @@ -854,8 +1045,6 @@ void Board::KhompPvt::destroyAll() void Board::KhompPvt::doHangup() { - owner(NULL); - try { switch_channel_t *channel = getFSChannel(); @@ -903,7 +1092,7 @@ bool Board::KhompPvt::cleanup(CleanupType type) Board::board(_target.device)->_timers.del(call()->_idx_pbx_ring); Board::board(_target.device)->_timers.del(call()->_idx_co_ring); } - catch (K3LAPI::invalid_device & err) + catch (K3LAPITraits::invalid_device & err) { LOG(ERROR, PVT_FMT(_target, "Unable to get device: %d!") % err.device); } @@ -939,10 +1128,10 @@ bool Board::KhompPvt::cleanup(CleanupType type) } if(call()->_input_volume >= -10 && call()->_input_volume <= 10) - setVolume("input" , Opt::_input_volume); + setVolume("input" , Opt::_options._input_volume()); if(call()->_output_volume >= -10 && call()->_output_volume <= 10) - setVolume("output", Opt::_output_volume); + setVolume("output", Opt::_options._output_volume()); return _call->clear(); case CLN_SOFT: @@ -1037,7 +1226,7 @@ void Board::queueAddChannel(PriorityCallQueue &pqueue, unsigned int board, unsig KhompPvt * pvt = get(board, object); pqueue.insert(pvt); } - catch(K3LAPI::invalid_channel & err) + catch(K3LAPITraits::invalid_channel & err) { //... } @@ -1050,7 +1239,7 @@ Board::KhompPvt * Board::findFree(unsigned int board, unsigned int object, bool KhompPvt * pvt = get(board, object); return ((fully_available ? pvt->isFree() : pvt->isOK()) ? pvt : NULL); } - catch(K3LAPI::invalid_channel & err) + catch(K3LAPITraits::invalid_channel & err) { } return NULL; @@ -1066,10 +1255,10 @@ void Board::applyGlobalVolume(void) { try { - Board::get(dev,obj)->setVolume("input", Opt::_input_volume); - Board::get(dev,obj)->setVolume("output",Opt::_output_volume); + Board::get(dev,obj)->setVolume("input", Opt::_options._input_volume()); + Board::get(dev,obj)->setVolume("output",Opt::_options._output_volume()); } - catch(K3LAPI::invalid_channel & err) + catch(K3LAPITraits::invalid_channel & err) { DBG(FUNC, OBJ_FMT(dev, obj, "Channel not found")); } @@ -1096,7 +1285,7 @@ bool Board::KhompPvt::startCadence(CadencesType type) { call()->_cadence = type; - Opt::CadencesMapType::iterator i = Opt::_cadences.find(tone); + CadencesMapType::iterator i = Opt::_cadences.find(tone); std::string cmd_params; if (i != Opt::_cadences.end()) @@ -1220,9 +1409,10 @@ bool Board::KhompPvt::obtainRX(bool with_delay) } catch(K3LAPI::failed_raw_command & e) { - LOG(ERROR, PVT_FMT(target(), "ERROR sending mixer record command!")); + LOG(ERROR, PVT_FMT(target(), "ERROR sending mixer command!")); return false; } + return true; } @@ -1236,7 +1426,7 @@ bool Board::KhompPvt::obtainTX() try { - int dsp = Globals::k3lapi.get_dsp(_target.device, K3LAPI::DSP_AUDIO); + int dsp = Globals::k3lapi.get_dsp(_target, K3LAPI::DSP_AUDIO); Globals::k3lapi.raw_command(_target.device, dsp, cmd1, sizeof(cmd1)); @@ -1347,7 +1537,7 @@ bool Board::KhompPvt::dtmfSuppression(bool enable) bool Board::KhompPvt::echoCancellation(bool enable) { - K3L_DEVICE_CONFIG & devCfg = Globals::k3lapi.device_config(_target.device); + const K3L_DEVICE_CONFIG & devCfg = Globals::k3lapi.device_config(_target); /* echo canceller should not be used for non-echo cancellable channels */ switch (devCfg.EchoConfig) @@ -1432,8 +1622,8 @@ bool Board::KhompPvt::setCollectCall() const char * tmp_var = NULL; // get option configuration value - confvalues.push_back(Opt::_drop_collect_call ? T_TRUE : T_FALSE); - DBG(FUNC, PVT_FMT(_target, "option drop collect call is '%s'") % (Opt::_drop_collect_call ? "yes" : "no")); + confvalues.push_back(Opt::_options._drop_collect_call() ? T_TRUE : T_FALSE); + DBG(FUNC, PVT_FMT(_target, "option drop collect call is '%s'") % (Opt::_options._drop_collect_call() ? "yes" : "no")); // get global filter configuration value tmp_var = switch_core_get_variable("KDropCollectCall"); @@ -1622,7 +1812,7 @@ bool Board::KhompPvt::onAudioStatus(K3L_EVENT *e) if (!call()->_flags.check(Kflags::CONNECTED)) { - obtainRX(Opt::_suppression_delay); + obtainRX(Opt::_options._suppression_delay()); //Marcar para o Freeswitch que jah tem audio passando if (call()->_flags.check(Kflags::IS_OUTGOING)) @@ -1660,7 +1850,7 @@ bool Board::KhompPvt::onAudioStatus(K3L_EVENT *e) LOG(ERROR, PVT_FMT(target(), "r (%s)") % err._msg.c_str() ); return false; } - catch (K3LAPI::invalid_device & err) + catch (K3LAPITraits::invalid_device & err) { LOG(ERROR, PVT_FMT(_target, "r (unable to get device: %d!)") % err.device); return false; @@ -1679,7 +1869,7 @@ bool Board::KhompPvt::onCollectCall(K3L_EVENT *e) //K::internal::ami_event(pvt, EVENT_FLAG_CALL, "CollectCall", // STG(FMT("Channel: Khomp/B%dC%d\r\n") % pvt->boardid % pvt->objectid)); - if (Opt::_drop_collect_call || _call->_flags.check(Kflags::DROP_COLLECT)) + if (Opt::_options._drop_collect_call() || _call->_flags.check(Kflags::DROP_COLLECT)) { /* disconnect! */ //TODO: SCE_HIDE !? @@ -1790,7 +1980,7 @@ bool Board::KhompPvt::onConnect(K3L_EVENT *e) LOG(ERROR, PVT_FMT(target(), "r (%s)") % err._msg.c_str() ); return false; } - catch (K3LAPI::invalid_device & err) + catch (K3LAPITraits::invalid_device & err) { LOG(ERROR, PVT_FMT(_target, "r (unable to get device: %d!)") % err.device); return false; @@ -1896,7 +2086,7 @@ bool Board::KhompPvt::onDtmfDetected(K3L_EVENT *e) return true; } - if (Opt::_ignore_letter_dtmfs) + if (Opt::_options._ignore_letter_dtmfs()) { switch (e->AddInfo) { @@ -2105,7 +2295,7 @@ bool Board::KhompPvt::indicateRinging() { int ringback_value = RingbackDefs::RB_SEND_DEFAULT; - bool do_drop_call = Opt::_drop_collect_call + bool do_drop_call = Opt::_options._drop_collect_call() || call()->_flags.check(Kflags::DROP_COLLECT); if (do_drop_call && call()->_collect_call) @@ -2128,7 +2318,7 @@ bool Board::KhompPvt::indicateRinging() if (send_ringback) { call()->_flags.set(Kflags::GEN_CO_RING); - call()->_idx_co_ring = Board::board(_target.device)->_timers.add(Opt::_ringback_co_delay, &Board::KhompPvt::coRingGen,this); + call()->_idx_co_ring = Board::board(_target.device)->_timers.add(Opt::_options._ringback_co_delay(), &Board::KhompPvt::coRingGen,this); /* start grabbing audio */ startListen(); @@ -2145,7 +2335,7 @@ bool Board::KhompPvt::indicateRinging() LOG(ERROR, PVT_FMT(_target, "r (unable to lock %s!)") % err._msg.c_str() ); return false; } - catch (K3LAPI::invalid_device & err) + catch (K3LAPITraits::invalid_device & err) { LOG(ERROR, PVT_FMT(_target, "r (unable to get device: %d!)") % err.device); return false; @@ -2333,7 +2523,7 @@ int Board::eventThread(void *void_evt) % Globals::verbose.event(evt.obj(), evt.event())); } } - catch (K3LAPI::invalid_device & invalid) + catch (K3LAPITraits::invalid_device & invalid) { LOG(ERROR, D("invalid device on event '%s'") % Verbose::eventName(evt.event()->Code).c_str()); @@ -2378,7 +2568,7 @@ int Board::commandThread(void *void_evt) LOG(ERROR, D("(d=%d) Error on command(%d)") % devid % cmd.code()); } } - catch (K3LAPI::invalid_channel & invalid) + catch (K3LAPITraits::invalid_channel & invalid) { LOG(ERROR, OBJ_FMT(devid,cmd.obj(), "invalid device on command '%d'") % cmd.code()); } @@ -2418,7 +2608,7 @@ extern "C" int32 Kstdcall khompEventCallback(int32 obj, K3L_EVENT * e) EventRequest e_req(obj, e); Board::board(e->DeviceId)->chanEventHandler()->write(e_req); } - catch (K3LAPI::invalid_device & err) + catch (K3LAPITraits::invalid_device & err) { LOG(ERROR, D("Unable to get device: %d!") % err.device); return ksFail; diff --git a/src/mod/endpoints/mod_khomp/src/khomp_pvt_fxo.cpp b/src/mod/endpoints/mod_khomp/src/khomp_pvt_fxo.cpp index f45638b..0f7862d 100644 --- a/src/mod/endpoints/mod_khomp/src/khomp_pvt_fxo.cpp +++ b/src/mod/endpoints/mod_khomp/src/khomp_pvt_fxo.cpp @@ -305,10 +305,11 @@ bool BoardFXO::KhompPvtFXO::onCallSuccess(K3L_EVENT *e) if (call()->_pre_answer) { - dtmfSuppression(Opt::_out_of_band_dtmfs && !call()->_flags.check(Kflags::FAX_DETECTED)); + dtmfSuppression(Opt::_options._out_of_band_dtmfs() && !call()->_flags.check(Kflags::FAX_DETECTED)); startListen(); startStream(); + switch_channel_mark_pre_answered(getFSChannel()); } } catch (ScopedLockFailed & err) @@ -316,6 +317,11 @@ bool BoardFXO::KhompPvtFXO::onCallSuccess(K3L_EVENT *e) LOG(ERROR, PVT_FMT(_target, "(FXO) r (unable to lock %s!)") % err._msg.c_str() ); return false; } + catch (Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR, PVT_FMT(target(), "(FXO) r (%s)") % err._msg.c_str() ); + return false; + } DBG(FUNC, PVT_FMT(_target, "(FXO) r")); @@ -355,16 +361,24 @@ bool BoardFXO::KhompPvtFXO::onAudioStatus(K3L_EVENT *e) if(e->AddInfo == kmtFax) { - DBG(FUNC, PVT_FMT(_target, "Fax detected")); + DBG(STRM, PVT_FMT(_target, "Fax detected")); - bool already_detected = call()->_flags.check(Kflags::FAX_DETECTED); + /* hadn't we did this already? */ + bool already_detected = call()->_flags.check(Kflags::FAX_DETECTED); + + time_t time_was = call()->_call_statistics->_base_time; + time_t time_now = time(NULL); + + bool detection_timeout = (time_now > (time_was + (time_t) (Opt::_options._fax_adjustment_timeout()))); + BEGIN_CONTEXT { - if(already_detected) - break; - ScopedPvtLock lock(this); + /* already adjusted? do not adjust again. */ + if (already_detected || detection_timeout) + break; + if (callFXO()->_call_info_drop != 0 || callFXO()->_call_info_report) { /* we did not detected fax yet, send answer info! */ @@ -377,7 +391,7 @@ bool BoardFXO::KhompPvtFXO::onAudioStatus(K3L_EVENT *e) } } - if (Opt::_auto_fax_adjustment) + if (Opt::_options._auto_fax_adjustment()) { DBG(FUNC, PVT_FMT(_target, "communication will be adjusted for fax!")); _fax->adjustForFax(); @@ -483,9 +497,9 @@ bool BoardFXO::KhompPvtFXO::onDtmfSendFinish(K3L_EVENT *e) /* activate resources early... */ bool fax_detected = callFXO()->_flags.check(Kflags::FAX_DETECTED); - bool res_out_of_band_dtmf = Opt::_suppression_delay && Opt::_out_of_band_dtmfs && !fax_detected; - bool res_echo_cancellator = Opt::_echo_canceller && !fax_detected; - bool res_auto_gain_cntrol = Opt::_auto_gain_control && !fax_detected; + bool res_out_of_band_dtmf = Opt::_options._suppression_delay() && Opt::_options._out_of_band_dtmfs() && !fax_detected; + bool res_echo_cancellator = Opt::_options._echo_canceller() && !fax_detected; + bool res_auto_gain_cntrol = Opt::_options._auto_gain_control() && !fax_detected; if (!call()->_flags.check(Kflags::KEEP_DTMF_SUPPRESSION)) dtmfSuppression(res_out_of_band_dtmf); @@ -497,7 +511,7 @@ bool BoardFXO::KhompPvtFXO::onDtmfSendFinish(K3L_EVENT *e) autoGainControl(res_auto_gain_cntrol); /* start sending audio if wanted so */ - if (Opt::_fxo_send_pre_audio) + if (Opt::_options._fxo_send_pre_audio()) startStream(); //TODO: Verificar isso aqui @@ -624,13 +638,13 @@ bool BoardFXO::KhompPvtFXO::setupConnection() bool fax_detected = callFXO()->_flags.check(Kflags::FAX_DETECTED) || (callFXO()->_var_fax_adjust == T_TRUE); bool res_out_of_band_dtmf = (call()->_var_dtmf_state == T_UNKNOWN || fax_detected ? - Opt::_suppression_delay && Opt::_out_of_band_dtmfs && !fax_detected : (call()->_var_dtmf_state == T_TRUE)); + Opt::_options._suppression_delay() && Opt::_options._out_of_band_dtmfs() && !fax_detected : (call()->_var_dtmf_state == T_TRUE)); bool res_echo_cancellator = (call()->_var_echo_state == T_UNKNOWN || fax_detected ? - Opt::_echo_canceller && !fax_detected : (call()->_var_echo_state == T_TRUE)); + Opt::_options._echo_canceller() && !fax_detected : (call()->_var_echo_state == T_TRUE)); bool res_auto_gain_cntrol = (call()->_var_gain_state == T_UNKNOWN || fax_detected ? - Opt::_auto_gain_control && !fax_detected : (call()->_var_gain_state == T_TRUE)); + Opt::_options._auto_gain_control() && !fax_detected : (call()->_var_gain_state == T_TRUE)); if (!call()->_flags.check(Kflags::REALLY_CONNECTED)) { @@ -739,8 +753,13 @@ bool BoardFXO::KhompPvtFXO::validContexts( { DBG(FUNC,PVT_FMT(_target,"(FXO) c")); - contexts.push_back(Opt::_context_fxo); - contexts.push_back(Opt::_context2_fxo); + if(!_group_context.empty()) + { + contexts.push_back(_group_context); + } + + contexts.push_back(Opt::_options._context_fxo()); + contexts.push_back(Opt::_options._context2_fxo()); for (MatchExtension::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) { diff --git a/src/mod/endpoints/mod_khomp/src/khomp_pvt_gsm.cpp b/src/mod/endpoints/mod_khomp/src/khomp_pvt_gsm.cpp index 1095c5a..05020a0 100644 --- a/src/mod/endpoints/mod_khomp/src/khomp_pvt_gsm.cpp +++ b/src/mod/endpoints/mod_khomp/src/khomp_pvt_gsm.cpp @@ -115,10 +115,11 @@ bool BoardGSM::KhompPvtGSM::onCallSuccess(K3L_EVENT *e) if (call()->_pre_answer) { - dtmfSuppression(Opt::_out_of_band_dtmfs); + dtmfSuppression(Opt::_options._out_of_band_dtmfs()); startListen(); startStream(); + switch_channel_mark_pre_answered(getFSChannel()); } } catch (ScopedLockFailed & err) @@ -126,6 +127,11 @@ bool BoardGSM::KhompPvtGSM::onCallSuccess(K3L_EVENT *e) LOG(ERROR, PVT_FMT(_target, "(GSM) r (unable to lock %s!)") % err._msg.c_str() ); return false; } + catch (Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR, PVT_FMT(target(), "(GSM) r (%s)") % err._msg.c_str() ); + return false; + } DBG(FUNC, PVT_FMT(_target, "(GSM) r")); @@ -401,14 +407,14 @@ bool BoardGSM::KhompPvtGSM::setupConnection() } bool res_out_of_band_dtmf = (call()->_var_dtmf_state == T_UNKNOWN ? - Opt::_suppression_delay && Opt::_out_of_band_dtmfs : (call()->_var_dtmf_state == T_TRUE)); + Opt::_options._suppression_delay() && Opt::_options._out_of_band_dtmfs() : (call()->_var_dtmf_state == T_TRUE)); bool res_echo_cancellator = (call()->_var_echo_state == T_UNKNOWN ? - Opt::_echo_canceller : (call()->_var_echo_state == T_TRUE)); + Opt::_options._echo_canceller() : (call()->_var_echo_state == T_TRUE)); bool res_auto_gain_cntrol = (call()->_var_gain_state == T_UNKNOWN ? - Opt::_auto_gain_control : (call()->_var_gain_state == T_TRUE)); + Opt::_options._auto_gain_control() : (call()->_var_gain_state == T_TRUE)); if (!call()->_flags.check(Kflags::REALLY_CONNECTED)) @@ -516,6 +522,11 @@ bool BoardGSM::KhompPvtGSM::validContexts( { DBG(FUNC,PVT_FMT(_target,"(GSM) c")); + if(!_group_context.empty()) + { + contexts.push_back(_group_context); + } + if (!extra_context.empty()) { if (!_group_context.empty()) @@ -526,25 +537,25 @@ bool BoardGSM::KhompPvtGSM::validContexts( contexts.push_back(pvt_context); } - if (!Opt::_context_gsm_call.empty()) + if (!Opt::_options._context_gsm_call().empty()) { - std::string context(Opt::_context_gsm_call); + std::string context(Opt::_options._context_gsm_call()); context += "-"; context += extra_context; contexts.push_back(_group_context); } - if (!Opt::_context2_gsm_call.empty()) + if (!Opt::_options._context2_gsm_call().empty()) { - std::string context(Opt::_context2_gsm_call); + std::string context(Opt::_options._context2_gsm_call()); context += "-"; context += extra_context; contexts.push_back(_group_context); } } - contexts.push_back(Opt::_context_gsm_call); - contexts.push_back(Opt::_context2_gsm_call); + contexts.push_back(Opt::_options._context_gsm_call()); + contexts.push_back(Opt::_options._context2_gsm_call()); for (MatchExtension::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) replaceTemplate((*i), "CC", _target.object); diff --git a/src/mod/endpoints/mod_khomp/src/khomp_pvt_kxe1.cpp b/src/mod/endpoints/mod_khomp/src/khomp_pvt_kxe1.cpp index c0eb1a3..0d3c3b3 100644 --- a/src/mod/endpoints/mod_khomp/src/khomp_pvt_kxe1.cpp +++ b/src/mod/endpoints/mod_khomp/src/khomp_pvt_kxe1.cpp @@ -121,15 +121,16 @@ bool BoardE1::KhompPvtE1::onCallSuccess(K3L_EVENT *e) if (call()->_pre_answer) { - dtmfSuppression(Opt::_out_of_band_dtmfs && !call()->_flags.check(Kflags::FAX_DETECTED)); + dtmfSuppression(Opt::_options._out_of_band_dtmfs()&& !call()->_flags.check(Kflags::FAX_DETECTED)); startListen(); startStream(); + switch_channel_mark_pre_answered(getFSChannel()); } else { call()->_flags.set(Kflags::GEN_PBX_RING); - call()->_idx_pbx_ring = Board::board(_target.device)->_timers.add(Opt::_ringback_pbx_delay, + call()->_idx_pbx_ring = Board::board(_target.device)->_timers.add(Opt::_options._ringback_pbx_delay(), &Board::KhompPvt::pbxRingGen,this, TM_VAL_CALL); } @@ -139,7 +140,7 @@ bool BoardE1::KhompPvtE1::onCallSuccess(K3L_EVENT *e) LOG(ERROR, PVT_FMT(_target, "(E1) r (unable to lock %s!)") % err._msg.c_str() ); return false; } - catch (K3LAPI::invalid_device & err) + catch (K3LAPITraits::invalid_device & err) { LOG(ERROR, PVT_FMT(_target, "(E1) r (unable to get device: %d!)") % err.device); return false; @@ -152,7 +153,7 @@ bool BoardE1::KhompPvtE1::onCallSuccess(K3L_EVENT *e) bool BoardE1::KhompPvtE1::onAudioStatus(K3L_EVENT *e) { - //DBG(FUNC, PVT_FMT(_target, "(E1) c")); + DBG(STRM, PVT_FMT(_target, "(E1) c")); try { @@ -160,16 +161,27 @@ bool BoardE1::KhompPvtE1::onAudioStatus(K3L_EVENT *e) if(e->AddInfo == kmtFax) { - DBG(FUNC, PVT_FMT(_target, "Fax detected")); + DBG(STRM, PVT_FMT(_target, "Fax detected")); + /* hadn't we did this already? */ bool already_detected = call()->_flags.check(Kflags::FAX_DETECTED); + + time_t time_was = call()->_call_statistics->_base_time; + time_t time_now = time(NULL); + + bool detection_timeout = (time_now > (time_was + (time_t) (Opt::_options._fax_adjustment_timeout()))); + + DBG(STRM, PVT_FMT(_target, "is set? (%s) timeout? (%s)") + % (already_detected ? "true" : "false") % (detection_timeout ? "true" : "false")); + BEGIN_CONTEXT { - if(already_detected) - break; - ScopedPvtLock lock(this); + /* already adjusted? do not adjust again. */ + if (already_detected || detection_timeout) + break; + if (callE1()->_call_info_drop != 0 || callE1()->_call_info_report) { /* we did not detected fax yet, send answer info! */ @@ -182,7 +194,7 @@ bool BoardE1::KhompPvtE1::onAudioStatus(K3L_EVENT *e) } } - if (Opt::_auto_fax_adjustment) + if (Opt::_options._auto_fax_adjustment()) { DBG(FUNC, PVT_FMT(_target, "communication will be adjusted for fax!")); _fax->adjustForFax(); @@ -207,7 +219,7 @@ bool BoardE1::KhompPvtE1::onAudioStatus(K3L_EVENT *e) bool ret = KhompPvt::onAudioStatus(e); - //DBG(FUNC, PVT_FMT(_target, "(E1) r")); + DBG(STRM, PVT_FMT(_target, "(E1) r")); return ret; } @@ -283,7 +295,7 @@ bool BoardE1::KhompPvtE1::onDisconnect(K3L_EVENT *e) if (call()->_flags.check(Kflags::IS_OUTGOING) || call()->_flags.check(Kflags::IS_INCOMING)) { - if(Opt::_disconnect_delay == 0) + if(Opt::_options._disconnect_delay()== 0) { DBG(FUNC, PVT_FMT(_target, "queueing disconnecting outgoing channel!")); command(KHOMP_LOG, CM_DISCONNECT); @@ -291,7 +303,7 @@ bool BoardE1::KhompPvtE1::onDisconnect(K3L_EVENT *e) else { callE1()->_idx_disconnect = Board::board(_target.device)->_timers.add( - 1000 * Opt::_disconnect_delay,&BoardE1::KhompPvtE1::delayedDisconnect,this); + 1000 * Opt::_options._disconnect_delay(),&BoardE1::KhompPvtE1::delayedDisconnect,this); } } else @@ -309,7 +321,7 @@ bool BoardE1::KhompPvtE1::onDisconnect(K3L_EVENT *e) LOG(ERROR, PVT_FMT(_target, "(E1) r (unable to lock %s!)") % err._msg.c_str() ); return false; } - catch (K3LAPI::invalid_device & err) + catch (K3LAPITraits::invalid_device & err) { LOG(ERROR, PVT_FMT(_target, "(E1) r (unable to get device: %d!)") % err.device); return false; @@ -767,13 +779,13 @@ bool BoardE1::KhompPvtE1::setupConnection() bool fax_detected = callE1()->_flags.check(Kflags::FAX_DETECTED) || (callE1()->_var_fax_adjust == T_TRUE); bool res_out_of_band_dtmf = (call()->_var_dtmf_state == T_UNKNOWN || fax_detected ? - Opt::_suppression_delay && Opt::_out_of_band_dtmfs && !fax_detected : (call()->_var_dtmf_state == T_TRUE)); + Opt::_options._suppression_delay()&& Opt::_options._out_of_band_dtmfs()&& !fax_detected : (call()->_var_dtmf_state == T_TRUE)); bool res_echo_cancellator = (call()->_var_echo_state == T_UNKNOWN || fax_detected ? - Opt::_echo_canceller && !fax_detected : (call()->_var_echo_state == T_TRUE)); + Opt::_options._echo_canceller()&& !fax_detected : (call()->_var_echo_state == T_TRUE)); bool res_auto_gain_cntrol = (call()->_var_gain_state == T_UNKNOWN || fax_detected ? - Opt::_auto_gain_control && !fax_detected : (call()->_var_gain_state == T_TRUE)); + Opt::_options._auto_gain_control()&& !fax_detected : (call()->_var_gain_state == T_TRUE)); if (!call()->_flags.check(Kflags::REALLY_CONNECTED)) { @@ -823,7 +835,12 @@ bool BoardE1::KhompPvtE1::validContexts( { DBG(FUNC,PVT_FMT(_target, "(E1) c")); - contexts.push_back(Opt::_context_digital); + if(!_group_context.empty()) + { + contexts.push_back(_group_context); + } + + contexts.push_back(Opt::_options._context_digital()); for (MatchExtension::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) { @@ -1122,7 +1139,7 @@ void BoardE1::KhompPvtR2::reportFailToReceive(int fail_code) { KhompPvt::reportFailToReceive(fail_code); - if (Opt::_r2_strict_behaviour && fail_code != -1) + if (Opt::_options._r2_strict_behaviour()&& fail_code != -1) { DBG(FUNC,PVT_FMT(_target, "sending a 'unknown number' message/audio")); @@ -1586,7 +1603,7 @@ bool BoardE1::KhompPvtR2::sendPreAudio(int rb_value) DBG(FUNC,PVT_FMT(_target, "doing the R2 pre_connect wait...")); /* wait some ms, just to be sure the command has been sent. */ - usleep(Opt::_r2_preconnect_wait * 1000); + usleep(Opt::_options._r2_preconnect_wait()* 1000); if (call()->_flags.check(Kflags::HAS_PRE_AUDIO)) { @@ -1654,7 +1671,7 @@ bool BoardE1::KhompPvtR2::indicateRinging() { int ringback_value = RingbackDefs::RB_SEND_DEFAULT; - bool do_drop_call = Opt::_drop_collect_call + bool do_drop_call = Opt::_options._drop_collect_call() || call()->_flags.check(Kflags::DROP_COLLECT); if (do_drop_call && call()->_collect_call) @@ -1679,7 +1696,7 @@ bool BoardE1::KhompPvtR2::indicateRinging() % condition_string); } - if (Opt::_r2_strict_behaviour) + if (Opt::_options._r2_strict_behaviour()) { /* send ringback too? */ send_ringback = sendPreAudio(ringback_value); @@ -1700,7 +1717,7 @@ bool BoardE1::KhompPvtR2::indicateRinging() DBG(FUNC, PVT_FMT(_target, "Send ringback!")); call()->_flags.set(Kflags::GEN_CO_RING); - call()->_idx_co_ring = Board::board(_target.device)->_timers.add(Opt::_ringback_co_delay, &Board::KhompPvt::coRingGen,this); + call()->_idx_co_ring = Board::board(_target.device)->_timers.add(Opt::_options._ringback_co_delay(), &Board::KhompPvt::coRingGen,this); /* start grabbing audio */ startListen(); @@ -1722,7 +1739,7 @@ bool BoardE1::KhompPvtR2::indicateRinging() LOG(ERROR,PVT_FMT(_target, "(R2) r (%s)") % err._msg.c_str()); return false; } - catch (K3LAPI::invalid_device & err) + catch (K3LAPITraits::invalid_device & err) { LOG(ERROR, PVT_FMT(_target, "(R2) r (unable to get device: %d!)") % err.device); return false; @@ -1768,9 +1785,9 @@ bool BoardE1::KhompPvtR2::onNewCall(K3L_EVENT *e) if(!ret) return false; - if (!Opt::_r2_strict_behaviour) + if (!Opt::_options._r2_strict_behaviour()) { - bool do_drop_collect = Opt::_drop_collect_call; + bool do_drop_collect = Opt::_options._drop_collect_call(); const char* drop_str = getFSGlobalVar("KDropCollectCall"); if(checkTrueString(drop_str)) @@ -1936,7 +1953,7 @@ bool BoardE1::KhompPvtR2::onNumberDetected(K3L_EVENT *e) LOG(ERROR, PVT_FMT(target(), "unable to lock %s!") % err._msg.c_str() ); return false; } - catch (K3LAPI::invalid_device & err) + catch (K3LAPITraits::invalid_device & err) { LOG(ERROR, PVT_FMT(_target, "unable to get device: %d!") % err.device); return false; @@ -1973,32 +1990,32 @@ bool BoardE1::KhompPvtFlash::sendDtmf(std::string digit) return ret; } -Opt::OrigToNseqMapType BoardE1::KhompPvtFXS::generateNseqMap() +OrigToNseqMapType BoardE1::KhompPvtFXS::generateNseqMap() { - Opt::OrigToNseqMapType fxs_nseq; /* sequence numbers on FXS */ + OrigToNseqMapType fxs_nseq; /* sequence numbers on FXS */ - fxs_nseq.insert(Opt::OrigToNseqPairType("", 0)); /* global sequence */ + fxs_nseq.insert(OrigToNseqPairType("", 0)); /* global sequence */ - for (Opt::BoardToOrigMapType::iterator i = Opt::_fxs_orig_base.begin(); i != Opt::_fxs_orig_base.end(); i++) + for (BoardToOrigMapType::iterator i = Opt::_fxs_orig_base.begin(); i != Opt::_fxs_orig_base.end(); i++) { - fxs_nseq.insert(Opt::OrigToNseqPairType((*i).second, 0)); + fxs_nseq.insert(OrigToNseqPairType((*i).second, 0)); } return fxs_nseq; } -void BoardE1::KhompPvtFXS::load(Opt::OrigToNseqMapType & fxs_nseq) +void BoardE1::KhompPvtFXS::load(OrigToNseqMapType & fxs_nseq) { - Opt::BoardToOrigMapType::iterator it1 = Opt::_fxs_orig_base.find(_target.device); - Opt::OrigToNseqMapType::iterator it2; + BoardToOrigMapType::iterator it1 = Opt::_fxs_orig_base.find(_target.device); + OrigToNseqMapType::iterator it2; std::string orig_base("invalid"); /* will have orig base */ if (it1 == Opt::_fxs_orig_base.end()) { it2 = fxs_nseq.find(""); - orig_base = Opt::_fxs_global_orig_base; + orig_base = Opt::_options._fxs_global_orig_base(); } else { @@ -2024,8 +2041,8 @@ void BoardE1::KhompPvtFXS::load(Opt::OrigToNseqMapType & fxs_nseq) loadOptions(); /* makes a "reverse mapping" for Dial using 'r' identifiers */ - Opt::_fxs_branch_map.insert(Opt::BranchToObjectPairType(_fxs_orig_addr, - Opt::ObjectIdType(_target.device, _target.object))); + Opt::_fxs_branch_map.insert(BranchToObjectPairType(_fxs_orig_addr, + ObjectIdType(_target.device, _target.object))); /* increment sequence number */ ++((*it2).second); @@ -2045,19 +2062,16 @@ void BoardE1::KhompPvtFXS::loadOptions() /* Initialize fxs default options */ _calleridname.clear(); - _amaflags = Opt::_amaflags; - _callgroup = Opt::_callgroup; - _pickupgroup = Opt::_pickupgroup; + //_amaflags = Opt::_amaflags; + _callgroup = Opt::_options._callgroup(); + _pickupgroup = Opt::_options._pickupgroup(); _context.clear(); - _input_volume = Opt::_input_volume; - _output_volume = Opt::_output_volume; - _mohclass = Opt::_global_mohclass; - _language = Opt::_global_language; - _accountcode = Opt::_accountcode; + _input_volume = Opt::_options._input_volume(); + _output_volume = Opt::_options._output_volume(); _mailbox.clear(); - _flash = Opt::_flash; + _flash = Opt::_options._flash(); - Opt::BranchToOptMapType::iterator it3 = Opt::_branch_options.find(_fxs_orig_addr); + BranchToOptMapType::iterator it3 = Opt::_branch_options.find(_fxs_orig_addr); if (it3 != Opt::_branch_options.end()) { @@ -2066,9 +2080,9 @@ void BoardE1::KhompPvtFXS::loadOptions() //TODO: Implementar o setVolume para levar em consideracao que o // padrao pode ser o da FXS - if (_input_volume != Opt::_input_volume) + if (_input_volume != Opt::_options._input_volume()) setVolume("input", _input_volume); - if (_output_volume != Opt::_output_volume) + if (_output_volume != Opt::_options._output_volume()) setVolume("output", _output_volume); } @@ -2163,11 +2177,11 @@ bool BoardE1::KhompPvtFXS::parseBranchOptions(std::string options_str) } else if (opt_name == "calleridnum") // conscious ultra chuncho! { - Opt::BranchToOptMapType::iterator it3 = Opt::_branch_options.find(_fxs_orig_addr); + BranchToOptMapType::iterator it3 = Opt::_branch_options.find(_fxs_orig_addr); if (it3 != Opt::_branch_options.end()) { - Opt::_branch_options.insert(Opt::BranchToOptPairType(opt_value, it3->second)); + Opt::_branch_options.insert(BranchToOptPairType(opt_value, it3->second)); Opt::_branch_options.erase(it3); } @@ -2221,10 +2235,11 @@ bool BoardE1::KhompPvtFXS::alloc() startStream(); /* do this procedures early (as audio is already being heard) */ - dtmfSuppression(Opt::_out_of_band_dtmfs && !callFXS()->_flags.check(Kflags::FAX_DETECTED)); - echoCancellation(Opt::_echo_canceller && !callFXS()->_flags.check(Kflags::FAX_DETECTED)); - autoGainControl(Opt::_auto_gain_control && !callFXS()->_flags.check(Kflags::FAX_DETECTED)); + dtmfSuppression(Opt::_options._out_of_band_dtmfs() && !callFXS()->_flags.check(Kflags::FAX_DETECTED)); + echoCancellation(Opt::_options._echo_canceller() && !callFXS()->_flags.check(Kflags::FAX_DETECTED)); + autoGainControl(Opt::_options._auto_gain_control() && !callFXS()->_flags.check(Kflags::FAX_DETECTED)); + //TODO: NEED RECORD HERE !? /* if it does not need context, probably it's a pickupcall and will not pass throw setup_connection, so we start recording here*/ //if (!need_context && K::opt::recording && !pvt->is_recording) @@ -2234,7 +2249,6 @@ bool BoardE1::KhompPvtFXS::alloc() return true; } - bool BoardE1::KhompPvtFXS::onSeizureStart(K3L_EVENT *e) { DBG(FUNC, PVT_FMT(_target, "(FXS) c")); @@ -2260,13 +2274,13 @@ bool BoardE1::KhompPvtFXS::onSeizureStart(K3L_EVENT *e) return false; } - /* desabilita para evitar problemas de detecção de DTMF */ + /* disable to avoid problems with DTMF detection */ echoCancellation(false); autoGainControl(false); call()->_orig_addr = _fxs_orig_addr; - Opt::OrigToDestMapType::iterator i = Opt::_fxs_hotline.find(_fxs_orig_addr); + OrigToDestMapType::iterator i = Opt::_fxs_hotline.find(_fxs_orig_addr); if (i != Opt::_fxs_hotline.end()) { @@ -2285,7 +2299,6 @@ bool BoardE1::KhompPvtFXS::onSeizureStart(K3L_EVENT *e) call()->_flags.clear(Kflags::FXS_DIAL_ONGOING); call()->_flags.set(Kflags::FXS_OFFHOOK); } - } catch (ScopedLockFailed & err) { @@ -2312,16 +2325,17 @@ bool BoardE1::KhompPvtFXS::onCallSuccess(K3L_EVENT *e) if (call()->_pre_answer) { - dtmfSuppression(Opt::_out_of_band_dtmfs); + dtmfSuppression(Opt::_options._out_of_band_dtmfs()); startListen(); startStream(); + switch_channel_mark_pre_answered(getFSChannel()); } else { call()->_flags.set(Kflags::GEN_PBX_RING); call()->_idx_pbx_ring = Board::board(_target.device)->_timers.add( - Opt::_ringback_pbx_delay, + Opt::_options._ringback_pbx_delay(), &Board::KhompPvt::pbxRingGen, this, TM_VAL_CALL); @@ -2333,11 +2347,16 @@ bool BoardE1::KhompPvtFXS::onCallSuccess(K3L_EVENT *e) LOG(ERROR, PVT_FMT(_target, "(FXS) r (unable to lock %s!)") % err._msg.c_str() ); return false; } - catch (K3LAPI::invalid_device & err) + catch (K3LAPITraits::invalid_device & err) { LOG(ERROR, PVT_FMT(_target, "(FXS) r (unable to get device: %d!)") % err.device); return false; } + catch (Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR, PVT_FMT(target(), "(FXS) r (%s)") % err._msg.c_str() ); + return false; + } DBG(FUNC, PVT_FMT(_target, "(FXS) r")); @@ -2536,7 +2555,7 @@ bool BoardE1::KhompPvtFXS::startTransfer() startCadence(PLAY_PBX_TONE); - callFXS()->_idx_transfer = Board::board(_target.device)->_timers.add(Opt::_fxs_digit_timeout * 1000, &BoardE1::KhompPvtFXS::transferTimer, this, TM_VAL_CALL); + callFXS()->_idx_transfer = Board::board(_target.device)->_timers.add(Opt::_options._fxs_digit_timeout()* 1000, &BoardE1::KhompPvtFXS::transferTimer, this, TM_VAL_CALL); } catch(Board::KhompPvt::InvalidSwitchChannel & err) @@ -2545,7 +2564,7 @@ bool BoardE1::KhompPvtFXS::startTransfer() LOG(ERROR, PVT_FMT(target(), "r (no valid partner %s!)") % err._msg.c_str()); return false; } - catch (K3LAPI::invalid_device & err) + catch (K3LAPITraits::invalid_device & err) { LOG(ERROR, PVT_FMT(_target, "unable to get device: %d!") % err.device); } @@ -2570,7 +2589,7 @@ bool BoardE1::KhompPvtFXS::stopTransfer() { Board::board(_target.device)->_timers.del(callFXS()->_idx_transfer); } - catch (K3LAPI::invalid_device & err) + catch (K3LAPITraits::invalid_device & err) { LOG(ERROR, PVT_FMT(_target, "unable to get device: %d!") % err.device); } @@ -2690,7 +2709,7 @@ bool BoardE1::KhompPvtFXS::transfer(std::string & context, bool blind) { Board::board(_target.device)->_timers.del(callFXS()->_idx_transfer); } - catch (K3LAPI::invalid_device & err) + catch (K3LAPITraits::invalid_device & err) { LOG(ERROR, PVT_FMT(_target, "unable to get device: %d!") % err.device); } @@ -2709,7 +2728,7 @@ bool BoardE1::KhompPvtFXS::transfer(std::string & context, bool blind) if(blind) { DBG(FUNC, PVT_FMT(_target, "Blind Transfer")); - switch_ivr_session_transfer(peer_session, number.c_str(), Opt::_dialplan.c_str(), context.c_str()); + switch_ivr_session_transfer(peer_session, number.c_str(), Opt::_options._dialplan().c_str(), context.c_str()); } else { @@ -2748,7 +2767,7 @@ bool BoardE1::KhompPvtFXS::transfer(std::string & context, bool blind) switch_channel_set_variable(channel, SWITCH_PARK_AFTER_BRIDGE_VARIABLE, "true"); switch_core_event_hook_add_state_change(session(), xferHook); - switch_ivr_session_transfer(session(), number.c_str(), Opt::_dialplan.c_str(), context.c_str()); + switch_ivr_session_transfer(session(), number.c_str(), Opt::_options._dialplan().c_str(), context.c_str()); DBG(FUNC, PVT_FMT(target(), "Generating ring")); call()->_indication = INDICA_RING; @@ -2758,9 +2777,9 @@ bool BoardE1::KhompPvtFXS::transfer(std::string & context, bool blind) /* try { - call()->_idx_co_ring = Board::board(_target.device)->_timers.add(Opt::_ringback_co_delay, &Board::KhompPvt::coRingGen,this); + call()->_idx_co_ring = Board::board(_target.device)->_timers.add(Opt::_options._ringback_co_delay(), &Board::KhompPvt::coRingGen,this); } - catch (K3LAPI::invalid_device & err) + catch (K3LAPITraits::invalid_device & err) { LOG(ERROR, PVT_FMT(_target, "unable to get device: %d!") % err.device); } @@ -2816,7 +2835,7 @@ bool BoardE1::KhompPvtFXS::onDtmfDetected(K3L_EVENT *e) mixer(KHOMP_LOG, 1, kmsGenerator, kmtSilence); - callFXS()->_idx_dial = Board::board(_target.device)->_timers.add(Opt::_fxs_digit_timeout * 1000, &BoardE1::KhompPvtFXS::dialTimer, this, TM_VAL_CALL); + callFXS()->_idx_dial = Board::board(_target.device)->_timers.add(Opt::_options._fxs_digit_timeout()* 1000, &BoardE1::KhompPvtFXS::dialTimer, this, TM_VAL_CALL); } else { @@ -2849,7 +2868,7 @@ bool BoardE1::KhompPvtFXS::onDtmfDetected(K3L_EVENT *e) DBG(FUNC, PVT_FMT(target(), "match more...")); /* can match, will match more, and it's an external call? */ - for (Opt::DestVectorType::iterator i = Opt::_fxs_co_dialtone.begin(); i != Opt::_fxs_co_dialtone.end(); i++) + for (DestVectorType::const_iterator i = Opt::_options._fxs_co_dialtone().begin(); i != Opt::_options._fxs_co_dialtone().end(); i++) { if (callFXS()->_incoming_exten == (*i)) { @@ -2931,7 +2950,7 @@ bool BoardE1::KhompPvtFXS::onDtmfDetected(K3L_EVENT *e) DBG(FUNC, PVT_FMT(target(), "match more...")); /* can match, will match more, and it's an external call? */ - for (Opt::DestVectorType::iterator i = Opt::_fxs_co_dialtone.begin(); i != Opt::_fxs_co_dialtone.end(); i++) + for (DestVectorType::const_iterator i = Opt::_options._fxs_co_dialtone().begin(); i != Opt::_options._fxs_co_dialtone().end(); i++) { if (callFXS()->_flash_transfer == (*i)) { @@ -2967,7 +2986,7 @@ bool BoardE1::KhompPvtFXS::onDtmfDetected(K3L_EVENT *e) LOG(ERROR, PVT_FMT(_target, "(FXS) r (unable to lock %s!)") % err._msg.c_str() ); return false; } - catch (K3LAPI::invalid_device & err) + catch (K3LAPITraits::invalid_device & err) { LOG(ERROR, PVT_FMT(_target, "(FXS) r (unable to get device: %d!)") % err.device); return false; @@ -3080,7 +3099,7 @@ int BoardE1::KhompPvtFXS::makeCall(std::string params) /* we always have audio */ call()->_flags.set(Kflags::HAS_PRE_AUDIO); - if (Opt::_fxs_bina && !call()->_orig_addr.empty()) + if (Opt::_options._fxs_bina()&& !call()->_orig_addr.empty()) { /* Sending Bina DTMF*/ callFXS()->_flags.set(Kflags::WAIT_SEND_DTMF); @@ -3165,6 +3184,11 @@ bool BoardE1::KhompPvtFXS::doChannelAnswer(CommandRequest &cmd) LOG(ERROR,PVT_FMT(_target, "(FXS) r (unable to lock %s!)") % err._msg.c_str() ); return false; } + catch (Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR, PVT_FMT(target(), "r (%s)") % err._msg.c_str() ); + return false; + } DBG(FUNC, PVT_FMT(_target, "(FXS) r")); @@ -3276,14 +3300,14 @@ bool BoardE1::KhompPvtFXS::setupConnection() } bool res_out_of_band_dtmf = (call()->_var_dtmf_state == T_UNKNOWN ? - Opt::_suppression_delay && Opt::_out_of_band_dtmfs : (call()->_var_dtmf_state == T_TRUE)); + Opt::_options._suppression_delay() && Opt::_options._out_of_band_dtmfs(): (call()->_var_dtmf_state == T_TRUE)); bool res_echo_cancellator = (call()->_var_echo_state == T_UNKNOWN ? - Opt::_echo_canceller : (call()->_var_echo_state == T_TRUE)); + Opt::_options._echo_canceller() : (call()->_var_echo_state == T_TRUE)); bool res_auto_gain_cntrol = (call()->_var_gain_state == T_UNKNOWN ? - Opt::_auto_gain_control : (call()->_var_gain_state == T_TRUE)); + Opt::_options._auto_gain_control() : (call()->_var_gain_state == T_TRUE)); if (!call()->_flags.check(Kflags::REALLY_CONNECTED)) @@ -3408,8 +3432,13 @@ bool BoardE1::KhompPvtFXS::validContexts( if(!_context.empty()) contexts.push_back(_context); - contexts.push_back(Opt::_context_fxs); - contexts.push_back(Opt::_context2_fxs); + if(!_group_context.empty()) + { + contexts.push_back(_group_context); + } + + contexts.push_back(Opt::_options._context_fxs()); + contexts.push_back(Opt::_options._context2_fxs()); for (MatchExtension::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) { diff --git a/src/mod/endpoints/mod_khomp/src/khomp_pvt_passive.cpp b/src/mod/endpoints/mod_khomp/src/khomp_pvt_passive.cpp index 28ccb99..48e0010 100644 --- a/src/mod/endpoints/mod_khomp/src/khomp_pvt_passive.cpp +++ b/src/mod/endpoints/mod_khomp/src/khomp_pvt_passive.cpp @@ -50,7 +50,12 @@ bool BoardPassive::KhompPvtPassive::validContexts( { DBG(FUNC,PVT_FMT(_target,"(Passive) c")); - contexts.push_back(Opt::_context_pr); + if(!_group_context.empty()) + { + contexts.push_back(_group_context); + } + + contexts.push_back(Opt::_options._context_pr()); for (MatchExtension::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) { diff --git a/src/mod/endpoints/mod_khomp/src/opt.cpp b/src/mod/endpoints/mod_khomp/src/opt.cpp index 8a08023..8001bab 100644 --- a/src/mod/endpoints/mod_khomp/src/opt.cpp +++ b/src/mod/endpoints/mod_khomp/src/opt.cpp @@ -47,170 +47,109 @@ #include "logger.h" #include "spec.h" -bool Opt::_debug; -std::string Opt::_dialplan; -std::string Opt::_context; -std::string Opt::_user_xfer; -std::map < std::string, CSpan > Opt::_spans; -Opt::GroupToDestMapType Opt::_groups; -Opt::CadencesMapType Opt::_cadences; +#include <function.hpp> -bool Opt::_echo_canceller; -bool Opt::_auto_gain_control; -bool Opt::_out_of_band_dtmfs; -bool Opt::_suppression_delay; -bool Opt::_pulse_forwarding; -bool Opt::_native_bridge; -bool Opt::_recording; -bool Opt::_has_ctbus; -bool Opt::_fxs_bina; -bool Opt::_fxo_send_pre_audio; -bool Opt::_drop_collect_call; -bool Opt::_ignore_letter_dtmfs; -bool Opt::_optimize_audio_path; +Options Opt::_options; +CadencesMapType Opt::_cadences; +GroupToDestMapType Opt::_groups; +OrigToDestMapType Opt::_fxs_hotline; +BoardToOrigMapType Opt::_fxs_orig_base; +BranchToOptMapType Opt::_branch_options; +BranchToObjectMapType Opt::_fxs_branch_map; -bool Opt::_auto_fax_adjustment; -unsigned int Opt::_fax_adjustment_timeout; - -bool Opt::_r2_strict_behaviour; -unsigned int Opt::_r2_preconnect_wait; - -unsigned int Opt::_fxs_digit_timeout; - -unsigned int Opt::_transferdigittimeout; - -std::string Opt::_flash; -std::string Opt::_atxfer; -std::string Opt::_blindxfer; - -unsigned int Opt::_ringback_co_delay; -unsigned int Opt::_ringback_pbx_delay; - -unsigned int Opt::_disconnect_delay; - -int Opt::_input_volume; -int Opt::_output_volume; - -Opt::DestVectorType Opt::_fxs_co_dialtone; -Opt::OrigToDestMapType Opt::_fxs_hotline; -std::string Opt::_fxs_global_orig_base; - -Opt::BoardToOrigMapType Opt::_fxs_orig_base; -Opt::BranchToObjectMapType Opt::_fxs_branch_map; -Opt::BranchToOptMapType Opt::_branch_options; - -std::string Opt::_global_mohclass; -std::string Opt::_global_language; - -std::string Opt::_record_prefix; - -std::string Opt::_context_gsm_call; -std::string Opt::_context2_gsm_call; -std::string Opt::_context_gsm_sms; -std::string Opt::_context_fxo; -std::string Opt::_context2_fxo; -std::string Opt::_context_fxs; -std::string Opt::_context2_fxs; -std::string Opt::_context_digital; -std::string Opt::_context_pr; - -int Opt::_amaflags; -std::string Opt::_callgroup; -std::string Opt::_pickupgroup; - -std::string Opt::_accountcode; - -unsigned int Opt::_kommuter_timeout; -std::string Opt::_kommuter_activation; - -unsigned int Opt::_audio_packet_size; +/* not beautiful, should think of something! */ +#define FUNCTION_VALUE(x) reinterpret_cast< Config::FunctionValue Options::* >( x ) void Opt::initialize(void) { - Globals::options.add(ConfigOption("debug", _debug, false)); - Globals::options.add(ConfigOption("dialplan", _dialplan, "XML")); - Globals::options.add(ConfigOption("context", _context, "default")); - - Globals::options.add(ConfigOption("echo-canceller", _echo_canceller, true)); - Globals::options.add(ConfigOption("auto-gain-control", _auto_gain_control, true)); - Globals::options.add(ConfigOption("out-of-band-dtmfs", _out_of_band_dtmfs, true)); - Globals::options.add(ConfigOption("suppression-delay", _suppression_delay, true)); - Globals::options.add(ConfigOption("pulse-forwarding", _pulse_forwarding, false)); - Globals::options.add(ConfigOption("native-bridge", _native_bridge, true)); - Globals::options.add(ConfigOption("recording", _recording, true)); - Globals::options.add(ConfigOption("has-ctbus", _has_ctbus, false)); - Globals::options.add(ConfigOption("fxs-bina", _fxs_bina, true)); - Globals::options.add(ConfigOption("fxo-send-pre-audio", _fxo_send_pre_audio, true)); - Globals::options.add(ConfigOption("drop-collect-call", _drop_collect_call, false)); - Globals::options.add(ConfigOption("ignore-letter-dtmfs", _ignore_letter_dtmfs, false)); - Globals::options.add(ConfigOption("optimize-audio-path", _optimize_audio_path, false)); - - Globals::options.add(ConfigOption("auto-fax-adjustment", _auto_fax_adjustment, true)); - Globals::options.add(ConfigOption("fax-adjustment-timeout", _fax_adjustment_timeout, 30u, 3u, 9999u)); - - Globals::options.add(ConfigOption("r2-strict-behaviour", _r2_strict_behaviour, false)); - Globals::options.add(ConfigOption("r2-preconnect-wait", _r2_preconnect_wait, 250u, 25u, 500u)); + Globals::options.add(Config::Option("debug", &Options::_debug, false)); + Globals::options.add(Config::Option("dialplan", &Options::_dialplan, "XML")); + Globals::options.add(Config::Option("context", &Options::_context, "default")); + + Globals::options.add(Config::Option("echo-canceller", &Options::_echo_canceller, true)); + Globals::options.add(Config::Option("auto-gain-control", &Options::_auto_gain_control, true)); + Globals::options.add(Config::Option("out-of-band-dtmfs", &Options::_out_of_band_dtmfs, true)); + Globals::options.add(Config::Option("suppression-delay", &Options::_suppression_delay, true)); + Globals::options.add(Config::Option("pulse-forwarding", &Options::_pulse_forwarding, false)); + Globals::options.add(Config::Option("native-bridge", &Options::_native_bridge, true)); + Globals::options.add(Config::Option("recording", &Options::_recording, true)); + Globals::options.add(Config::Option("has-ctbus", &Options::_has_ctbus, false)); + Globals::options.add(Config::Option("fxs-bina", &Options::_fxs_bina, true)); + Globals::options.add(Config::Option("fxo-send-pre-audio", &Options::_fxo_send_pre_audio, true)); + Globals::options.add(Config::Option("drop-collect-call", &Options::_drop_collect_call, false)); + Globals::options.add(Config::Option("ignore-letter-dtmfs", &Options::_ignore_letter_dtmfs, true)); + Globals::options.add(Config::Option("optimize-audio-path", &Options::_optimize_audio_path, false)); + + Globals::options.add(Config::Option("auto-fax-adjustment", &Options::_auto_fax_adjustment, true)); + Globals::options.add(Config::Option("fax-adjustment-timeout", &Options::_fax_adjustment_timeout, 30u, 3u, 9999u)); + + Globals::options.add(Config::Option("r2-strict-behaviour", &Options::_r2_strict_behaviour, false)); + Globals::options.add(Config::Option("r2-preconnect-wait", &Options::_r2_preconnect_wait, 250u, 25u, 500u)); + + Globals::options.add(Config::Option("fxs-digit-timeout", &Options::_fxs_digit_timeout, 7u, 1u, 30u)); + Globals::options.add(Config::Option("transferdigittimeout", &Options::_transferdigittimeout, 3000u, 0u, 90000u)); + + Globals::options.add(Config::Option("atxfer", &Options::_atxfer, "")); + Globals::options.add(Config::Option("blindxfer", &Options::_blindxfer, "")); + + Globals::options.add(Config::Option("flash-to-digits", &Options::_flash, "*1")); + + Globals::options.add(Config::Option("delay-ringback-co", &Options::_ringback_co_delay, 1500u, 0u, 999000u)); + Globals::options.add(Config::Option("delay-ringback-pbx", &Options::_ringback_pbx_delay, 2500u, 0u, 999000u)); + + Globals::options.add(Config::Option("disconnect-delay", &Options::_disconnect_delay, 0u, 0u, 100000u)); - Globals::options.add(ConfigOption("fxs-digit-timeout", _fxs_digit_timeout, 7u, 1u, 30u)); + Globals::options.add(Config::Option("input-volume", &Options::_input_volume, 0, -10, 10)); + Globals::options.add(Config::Option("output-volume", &Options::_output_volume, 0, -10, 10)); - Globals::options.add(ConfigOption("transferdigittimeout", _transferdigittimeout, 3000u, 0u, 90000u)); + Globals::options.add(Config::Option("fxs-co-dialtone", + FUNCTION_VALUE(&Options::_fxs_co_dialtone), "")); - Globals::options.add(ConfigOption("flash-to-digits", _flash, "*1")); + Globals::options.add(Config::Option("log-to-disk", + FUNCTION_VALUE(&Options::_log_disk_option), "standard", false)); - Globals::options.add(ConfigOption("atxfer", _atxfer, "")); - Globals::options.add(ConfigOption("blindxfer", _blindxfer, "")); + Globals::options.add(Config::Option("callgroup", &Options::_callgroup, "0")); - Globals::options.add(ConfigOption("delay-ringback-co", _ringback_co_delay, 1500u, 0u, 999000u)); - Globals::options.add(ConfigOption("delay-ringback-pbx", _ringback_pbx_delay, 2500u, 0u, 999000u)); + Globals::options.add(Config::Option("pickupgroup", &Options::_pickupgroup, "0")); - Globals::options.add(ConfigOption("disconnect-delay", _disconnect_delay, 0u, 0u, 100000u)); + Globals::options.add(Config::Option("log-to-console", + FUNCTION_VALUE(&Options::_log_console_option), "standard", false)); - Globals::options.add(ConfigOption("input-volume", _input_volume, 0, -10, 10)); - Globals::options.add(ConfigOption("output-volume", _output_volume, 0, -10, 10)); + Globals::options.add(Config::Option("trace", + FUNCTION_VALUE(&Options::_log_trace_option), "", false)); + Globals::options.add(Config::Option("record-prefix", + FUNCTION_VALUE(&Options::_record_prefix), "/var/spool/freeswitch/monitor/")); + + Globals::options.add(Config::Option("fxs-global-orig", &Options::_fxs_global_orig_base, "0")); - Globals::options.add(ConfigOption("fxs-co-dialtone", ProcessFXSCODialtone(), "")); - Globals::options.add(ConfigOption("fxs-global-orig", _fxs_global_orig_base, "0")); - - Globals::options.add(ConfigOption("language", _global_language, "")); - Globals::options.add(ConfigOption("mohclass", _global_mohclass, "")); - - Globals::options.add(ConfigOption("record-prefix", ProcessRecordPrefix(), "/var/spool/freeswitch/monitor/")); - - Globals::options.add(ConfigOption("context-fxo", _context_fxo, "khomp-DD-CC")); - Globals::options.add(ConfigOption("context-fxo-alt", _context2_fxo, "khomp-DD")); - Globals::options.add(ConfigOption("context-fxs", _context_fxs, "khomp-DD-CC")); - Globals::options.add(ConfigOption("context-fxs-alt", _context2_fxs, "khomp-DD")); - Globals::options.add(ConfigOption("context-gsm-call", _context_gsm_call, "khomp-DD-CC")); - Globals::options.add(ConfigOption("context-gsm-call-alt", _context2_gsm_call, "khomp-DD")); - Globals::options.add(ConfigOption("context-gsm-sms", _context_gsm_sms, "khomp-sms-DD-CC")); - Globals::options.add(ConfigOption("context-digital", _context_digital, "khomp-DD-LL")); - Globals::options.add(ConfigOption("context-pr", _context_pr, "khomp-DD-CC")); + Globals::options.add(Config::Option("language", &Options::_global_language, "")); + Globals::options.add(Config::Option("mohclass", &Options::_global_mohclass, "")); - Globals::options.add(ConfigOption("amaflags", ProcessAMAFlags(), "default")); - Globals::options.add(ConfigOption("callgroup", _callgroup, "0")); - Globals::options.add(ConfigOption("pickupgroup", _pickupgroup, "0")); - //Globals::options.add(ConfigOption("callgroup", ProcessCallGroup(), "0")); - //Globals::options.add(ConfigOption("pickupgroup", ProcessPickupGroup(), "0")); + Globals::options.add(Config::Option("context-fxo", &Options::_context_fxo, "khomp-DD-CC")); + Globals::options.add(Config::Option("context-fxo-alt", &Options::_context2_fxo, "khomp-DD")); + Globals::options.add(Config::Option("context-fxs", &Options::_context_fxs, "khomp-DD-CC")); + Globals::options.add(Config::Option("context-fxs-alt", &Options::_context2_fxs, "khomp-DD")); + Globals::options.add(Config::Option("context-gsm-call", &Options::_context_gsm_call, "khomp-DD-CC")); + Globals::options.add(Config::Option("context-gsm-call-alt", &Options::_context2_gsm_call, "khomp-DD")); + Globals::options.add(Config::Option("context-gsm-sms", &Options::_context_gsm_sms, "khomp-sms-DD-CC")); + Globals::options.add(Config::Option("context-digital", &Options::_context_digital, "khomp-DD-LL")); + Globals::options.add(Config::Option("context-pr", &Options::_context_pr, "khomp-DD-CC")); - Globals::options.add(ConfigOption("accountcode", _accountcode, "")); + Globals::options.add(Config::Option("accountcode", &Options::_accountcode, "")); - ConfigOption::string_allowed_type kommuter_allowed; - kommuter_allowed.insert("auto"); - kommuter_allowed.insert("manual"); + Config::StringSet activation_strings; + activation_strings.insert("auto"); + activation_strings.insert("manual"); - Globals::options.add(ConfigOption("kommuter-activation", _kommuter_activation , "auto", kommuter_allowed)); - Globals::options.add(ConfigOption("kommuter-timeout", _kommuter_timeout ,(unsigned int) 10 , (unsigned int) 0 , (unsigned int) 255)); + Globals::options.add(Config::Option("kommuter-activation", &Options::_kommuter_activation , "auto", activation_strings)); + Globals::options.add(Config::Option("kommuter-timeout", &Options::_kommuter_timeout ,(unsigned int) 10 , (unsigned int) 0 , (unsigned int) 255)); - Globals::options.add(ConfigOption("audio-packet-length", _audio_packet_size, + Globals::options.add(Config::Option("audio-packet-length", &Options::_audio_packet_size, (unsigned int)KHOMP_READ_PACKET_SIZE, (unsigned int)KHOMP_MIN_READ_PACKET_SIZE, (unsigned int)KHOMP_MAX_READ_PACKET_SIZE, 8u)); - Globals::options.add(ConfigOption("log-to-disk", ProcessLogOptions(O_GENERIC), "standard", false)); - Globals::options.add(ConfigOption("log-to-console", ProcessLogOptions(O_CONSOLE), "standard", false)); - - Globals::options.add(ConfigOption("trace", ProcessTraceOptions(), "", false)); - Globals::options.add(ConfigOption("user-transfer-digits", _user_xfer, "")); - + Globals::options.add(Config::Option("user-transfer-digits", &Options::_user_xfer_digits, "")); + /* aliases */ Globals::options.synonym("context-gsm", "context-gsm-call"); Globals::options.synonym("context-gsm-alt", "context-gsm-call-alt"); @@ -224,27 +163,34 @@ void Opt::initialize(void) Globals::options.synonym("log", "log-to-disk"); Globals::options.synonym("volume", "output-volume"); Globals::options.synonym("disconnectdelay", "disconnect-delay"); - } void Opt::obtain(void) { - /* everything should start clean! */ - cleanConfiguration(); + try + { + /* everything should start clean! */ + cleanConfiguration(); - /* reset loaded options */ - Globals::options.reset(); + /* reset loaded options */ + Globals::options.reset(&Opt::_options); - loadConfiguration("khomp.conf", NULL); + /* should be loaded *BEFORE* start_k3l */ + loadConfiguration("khomp.conf", NULL); - /* commit, loading defaults where needed */ - ConfigOptions::messages_type msgs = Globals::options.commit(); + /* commit, loading defaults where needed */ + Config::Options::Messages msgs = Globals::options.commit(&Opt::_options); - /* config already full loaded at this point, so we can use our own log system... */ - for (ConfigOptions::messages_type::iterator i = msgs.begin(); i != msgs.end(); i++) - { - DBG(FUNC,FMT("%s") % (*i).c_str()); + /* config already full loaded at this point, so we can use our own log system... */ + for (Config::Options::Messages::iterator i = msgs.begin(); i != msgs.end(); i++) + { + DBG(FUNC,FMT("%s") % (*i).c_str()); + } } + catch (std::runtime_error & e) + { + LOG(ERROR, FMT("unable to obtain general options: %s: procedure aborted!") % e.what()); + } } void Opt::commit(void) @@ -283,8 +229,13 @@ void Opt::loadConfiguration(const char *file_name, const char **section, bool sh { switch_xml_t cfg, xml, settings; - if (!(xml = switch_xml_open_cfg(file_name, &cfg, NULL))) { - LOG(ERROR,FMT("Open of %s failed") % file_name); + if (!(xml = switch_xml_open_cfg(file_name, &cfg, NULL))) + { + if (show_errors) + { + LOG(ERROR,FMT("Open of %s failed") % file_name); + } + return; } @@ -312,24 +263,10 @@ void Opt::loadConfiguration(const char *file_name, const char **section, bool sh switch_xml_free(xml); } -void Opt::printConfiguration(switch_stream_handle_t* stream) -{ - for( std::map<std::string, CSpan>::iterator ii=_spans.begin(); ii!=_spans.end(); ++ii ) - { - stream->write_function(stream, - "Span: %s.\nDialplan: %s.\nContext: %s.\nDialstring: %s.\n\n", - (*ii).first.c_str(), - (*ii).second._dialplan.c_str(), - (*ii).second._context.c_str(), - (*ii).second._dialstring.c_str()); - } -} - void Opt::cleanConfiguration(void) { _fxs_orig_base.clear(); _fxs_hotline.clear(); - _fxs_co_dialtone.clear(); _fxs_branch_map.clear(); _branch_options.clear(); @@ -343,72 +280,56 @@ void Opt::cleanConfiguration(void) _cadences.insert(CadencesPairType("vm-dialtone", CadenceType(1000,100,100,100))); } -void Opt::ProcessFXSCODialtone::operator()(std::string options) // const +/* +void Options::AmaflagOption::operator()(const Config::StringType & str) { - Strings::vector_type tokens; - Strings::tokenize(options, tokens, ","); + //_value = Strings::tolong(str); + //if(_value < 0) + // throw Config::Failure(STG(FMT("invalid AMA flags: %s") % str)); +} - for (Strings::vector_type::iterator i = tokens.begin(); i != tokens.end(); i++) - _fxs_co_dialtone.push_back(*i); +void Options::CallGroupOption::operator()(const Config::StringType & str) +{ + _groups = str; } -void Opt::ProcessRecordPrefix::operator()(std::string path) // const +void Options::PickupGroupOption::operator()(const Config::StringType & str) { - if (mkdir(path.c_str(), 493 /* 0755 */) < 0 && errno != EEXIST) - { - throw ConfigProcessFailure("the default recording directory could not be created."); - } - else - { - _record_prefix = path; - } + _groups = str; } +*/ -void Opt::ProcessAMAFlags::operator()(std::string options) +void Options::RecordPrefixOption::operator()(const Config::StringType & str) { -/* - //TODO: Do we need this ? - amaflags = ast_cdr_amaflags2int(options.c_str()); + if (mkdir(str.c_str(), 493 /* 0755 */) < 0 && errno != EEXIST) + throw Config::Failure("the default recording directory could not be created."); - if (amaflags < 0) - throw ConfigProcessFailure(STG(FMT("invalid AMA flags: %s") % options)); -*/ + _value = str; } -//TODO: Check this -void Opt::ProcessCallGroup::operator()(std::string options) +void Options::CentralOfficeDialtone::operator()(const Config::StringType & str) { -// _callgroup = options.c_str(); + Strings::vector_type tokens; + Strings::tokenize(str, tokens, ","); + + for (Strings::vector_type::iterator i = tokens.begin(); i != tokens.end(); i++) + _value.push_back(*i); } -//TODO: Check this -void Opt::ProcessPickupGroup::operator()(std::string options) +void Options::LogDiskOption::operator()(const Config::StringType & str) { -// _pickupgroup = options.c_str(); + K::Logger::processLogDisk(NULL, str, false, true); } -void Opt::ProcessLogOptions::operator()(std::string options) +void Options::LogConsoleOption::operator()(const Config::StringType & str) { - switch (_output) - { - case O_GENERIC: - K::Logger::processLogDisk(NULL, options, false, true); - break; - - case O_CONSOLE: - K::Logger::processLogConsole(NULL, options, false, true); - break; - - default: - throw ConfigProcessFailure("attempt to process unknown log file configuration"); - break; - } + K::Logger::processLogConsole(NULL, str, false, true); } -void Opt::ProcessTraceOptions::operator()(std::string options) +void Options::LogTraceOption::operator()(const Config::StringType & str) { Strings::vector_type tokens; - Strings::tokenize(options, tokens, ","); + Strings::tokenize(str, tokens, ","); bool enable_k3l_tracing = false; bool enable_r2_tracing = false; @@ -418,17 +339,12 @@ void Opt::ProcessTraceOptions::operator()(std::string options) { std::string tok = Strings::trim(*i); - if (tok == "k3l") - { - enable_k3l_tracing = true; - } - else if (tok == "r2") - { - enable_r2_tracing = true; - } - else if (tok == "rdsi") + /**/ if (tok == "k3l") enable_k3l_tracing = true; + else if (tok == "r2") enable_r2_tracing = true; + else if (tok == "rdsi") enable_rdsi_tracing = true; + else { - enable_rdsi_tracing = true; + LOG(ERROR, FMT("invalid string '%s' for option 'trace', ignoring...") % tok) } } @@ -485,12 +401,12 @@ switch_xml_t Opt::processSimpleXML(switch_xml_t &xml, const std::string& child_n % var % val); - Globals::options.process(var, val); + Globals::options.process(&Opt::_options, var, val); } - catch (ConfigProcessFailure e) + catch (Config::Failure e) { LOG(ERROR,FMT("config processing error: %s. [%s=%s]") - % e.msg.c_str() + % e.what() % var % val); @@ -521,10 +437,10 @@ void Opt::processGroupXML(switch_xml_t &xml) _groups.insert(GroupToDestPairType(var,val)); } - catch (ConfigProcessFailure e) + catch (Config::Failure e) { LOG(ERROR,FMT("config processing error: %s. [%s=%s]") - % e.msg.c_str() + % e.what() % var % val); } @@ -575,10 +491,10 @@ void Opt::processCadenceXML(switch_xml_t &xml) _cadences.insert(CadencesPairType(var, cadence)); } } - catch (ConfigProcessFailure e) + catch (Config::Failure e) { LOG(ERROR,FMT("config processing error: %s. [%s=%s]") - % e.msg.c_str() + % e.what() % var % val); @@ -637,7 +553,7 @@ void Opt::processFXSBranchesXML(switch_xml_t &xml) for (unsigned int device = 0; device < Globals::k3lapi.device_count(); device++) { - K3L_DEVICE_CONFIG & conf = Globals::k3lapi.device_config(device); + const K3L_DEVICE_CONFIG & conf = Globals::k3lapi.device_config(device); std::string str_serial(conf.SerialNumber); @@ -659,10 +575,10 @@ void Opt::processFXSBranchesXML(switch_xml_t &xml) } } } - catch (ConfigProcessFailure e) + catch (Config::Failure e) { LOG(ERROR,FMT("config processing error: %s. [%s=%s]") - % e.msg.c_str() + % e.what() % var % val); } @@ -702,10 +618,10 @@ void Opt::processFXSHotlines(switch_xml_t &xml) _fxs_hotline.insert(OrigToDestPairType(var, val)); } - catch (ConfigProcessFailure e) + catch (Config::Failure e) { LOG(ERROR,FMT("config processing error: %s. [%s=%s]") - % e.msg.c_str() + % e.what() % var % val); } @@ -758,10 +674,10 @@ void Opt::processFXSOptions(switch_xml_t &xml) } } } - catch (ConfigProcessFailure e) + catch (Config::Failure e) { LOG(ERROR,FMT("config processing error: %s. [%s=%s]") - % e.msg.c_str() + % e.what() % var % val); } diff --git a/src/mod/endpoints/mod_khomp/src/spec.cpp b/src/mod/endpoints/mod_khomp/src/spec.cpp index 5af0263..85e4699 100644 --- a/src/mod/endpoints/mod_khomp/src/spec.cpp +++ b/src/mod/endpoints/mod_khomp/src/spec.cpp @@ -66,7 +66,7 @@ static SpecRetType processSpecAtom(std::string & atom, SpecFlagsType & flags, Sp { std::string group_name = allocstr.substr(1); - Opt::GroupToDestMapType::iterator it = Opt::_groups.find(group_name); + GroupToDestMapType::iterator it = Opt::_groups.find(group_name); if (it == Opt::_groups.end()) { @@ -78,9 +78,9 @@ static SpecRetType processSpecAtom(std::string & atom, SpecFlagsType & flags, Sp return processSpecAtoms(allocstr, flags, fun); } - Regex::Expression e("(((([bB])[ ]*([0-9]+))|(([sS])[ ]*([0-9]+)))[ ]*(([cClL])[ ]*([0-9]+)[ ]*([-][ ]*([0-9]+))?)?)|(([rR])[ ]*([0-9]+)[ ]*([-][ ]*([0-9]+))?)", Regex::E_EXTENDED); + //Regex::Expression e("(((([bB])[ ]*([0-9]+))|(([sS])[ ]*([0-9]+)))[ ]*(([cClL])[ ]*([0-9]+)[ ]*([-][ ]*([0-9]+))?)?)|(([rR])[ ]*([0-9]+)[ ]*([-][ ]*([0-9]+))?)", Regex::E_EXTENDED); - Regex::Match what(allocstr, e); + Regex::Match what(allocstr, Globals::regex_allocation); if (!what.matched()) { @@ -170,7 +170,7 @@ static SpecRetType processSpecAtom(std::string & atom, SpecFlagsType & flags, Sp for (unsigned int i = branch_id; i <= branch2_id; i++) { std::string call_addr = BoardE1::KhompPvtFXS::padOrig(base_addr, i - branch_id); - Opt::BranchToObjectMapType::iterator i = Opt::_fxs_branch_map.find(call_addr); + BranchToObjectMapType::iterator i = Opt::_fxs_branch_map.find(call_addr); if (i == Opt::_fxs_branch_map.end()) { @@ -188,7 +188,7 @@ static SpecRetType processSpecAtom(std::string & atom, SpecFlagsType & flags, Sp { std::string call_addr = BoardE1::KhompPvtFXS::padOrig(base_addr, i - branch_id); - Opt::BranchToObjectMapType::iterator i = Opt::_fxs_branch_map.find(call_addr); + BranchToObjectMapType::iterator i = Opt::_fxs_branch_map.find(call_addr); if (i == Opt::_fxs_branch_map.end()) { @@ -205,7 +205,7 @@ static SpecRetType processSpecAtom(std::string & atom, SpecFlagsType & flags, Sp { DBG(FUNC, D("branch matched: %s") % base_addr); - Opt::BranchToObjectMapType::iterator i = Opt::_fxs_branch_map.find(base_addr); + BranchToObjectMapType::iterator i = Opt::_fxs_branch_map.find(base_addr); if (i == Opt::_fxs_branch_map.end()) { @@ -440,7 +440,7 @@ struct funProcessCallChannelString if (_all_fail) _all_fail = (tmp ? !tmp->isOK() : true); } - catch (K3LAPI::invalid_channel & err) + catch (K3LAPITraits::invalid_channel & err) { _all_fail = true; } @@ -599,7 +599,7 @@ struct FunProcessGroupString if (pvt) pvt->_group_context = _ctx; } - catch (K3LAPI::invalid_channel & err) + catch (K3LAPITraits::invalid_channel & err) { } @@ -634,8 +634,13 @@ static bool processCallChannelString(std::string & str, Board::KhompPvt *& pvt, pvt = proc.pvt(flags); DBG(FUNC, D("pvt = %p") % pvt); - if (!pvt && cause && !(*cause)) - *cause = SWITCH_CAUSE_INTERWORKING; + if (cause && !(*cause)) + { + if (!pvt) + *cause = SWITCH_CAUSE_INTERWORKING; + else + *cause = SWITCH_CAUSE_SUCCESS; + } ret = true; break; @@ -663,9 +668,14 @@ bool processSMSChannelString(std::string & str, Board::KhompPvt *& pvt, int *cau case SPR_CONTINUE: pvt = proc.pvt(flags); DBG(FUNC, FMT("pvt = %p") % pvt); - - if (!pvt && cause && !(*cause)) - *cause = SWITCH_CAUSE_INTERWORKING; + + if (cause && !(*cause)) + { + if (!pvt) + *cause = SWITCH_CAUSE_INTERWORKING; + else + *cause = SWITCH_CAUSE_SUCCESS; + } return true; } @@ -685,7 +695,7 @@ Board::KhompPvt * processDialString (const char *dial_charv, int *cause) DBG(FUNC, FMT("processing dial string [%d] : '%s'") % dial_args.size() % dial_string); - if ((dial_args.size() < 1 && dial_args.size() > 3)) + if ((dial_args.size() < 1 || dial_args.size() > 3)) { LOG(ERROR, FMT("invalid dial string '%s': wrong number of separators ('/').") % dial_string); return NULL; @@ -837,7 +847,7 @@ Board::KhompPvt * processSMSString (const char *sms_charv, int *cause) void processGroupString() { - for (Opt::GroupToDestMapType::iterator i = Opt::_groups.begin(); i != Opt::_groups.end(); i++) + for (GroupToDestMapType::iterator i = Opt::_groups.begin(); i != Opt::_groups.end(); i++) { const std::string & name = (*i).first; std::string & opts = (*i).second; diff --git a/src/mod/endpoints/mod_khomp/src/utils.cpp b/src/mod/endpoints/mod_khomp/src/utils.cpp index cc6eaef..178ec0b 100644 --- a/src/mod/endpoints/mod_khomp/src/utils.cpp +++ b/src/mod/endpoints/mod_khomp/src/utils.cpp @@ -44,7 +44,6 @@ #include <utils.h> #include "khomp_pvt.h" - void Kflags::init() { _flags[CONNECTED]._name = "CONNECTED"; @@ -461,7 +460,7 @@ bool Kommuter::stop() } /* stop all watches */ - if (Opt::_kommuter_activation == "auto") + if (Opt::_options._kommuter_activation() == "auto") { for (int kommuter = 0 ; kommuter < _kommuter_count ; kommuter++) { @@ -486,7 +485,7 @@ bool Kommuter::initialize(K3L_EVENT *e) /* get total of kommuter devices */ _kommuter_count = e->AddInfo; - if(Opt::_kommuter_activation == "manual") + if(Opt::_options._kommuter_activation() == "manual") { if (_kommuter_count > 0) { @@ -499,7 +498,7 @@ bool Kommuter::initialize(K3L_EVENT *e) if (_kommuter_count > 0) { bool start_timer = false; - int timeout = Opt::_kommuter_timeout; + int timeout = Opt::_options._kommuter_timeout(); std::string param = STG(FMT("timeout=%d") % timeout); @@ -605,3 +604,74 @@ void Kommuter::wtdKickTimer(void *) } } +/************************************ ESLs **********************************/ +ESL::VectorEvents * ESL::_events = NULL; + +ESL::ESL(std::string type) : _type(type) +{ + if(!_events) + _events = new VectorEvents(); + +// _events->push_back(_type); +} + +ESL::~ESL() +{ + if(!_events) + return; + + //Remove one from vector + //_events->pop_back(); + + if(_events->size() == 0) + { + delete _events; + _events = NULL; + } +} + +bool ESL::registerEvents() +{ + bool ok = true; + + DBG(FUNC, "Register ESLs"); + + if(!_events) + return true; + + for(VectorEvents::const_iterator event = _events->begin(); event != _events->end(); event++) + { + if (switch_event_reserve_subclass((*(event)).c_str()) != SWITCH_STATUS_SUCCESS) + { + LOG(ERROR, FMT("Couldn't register subclass=\"%s\"") % *(event)); + ok = false; + } + else + { + DBG(FUNC, FMT("Register subclass=\"%s\"") % *(event)); + } + } + + return ok; +} + +bool ESL::unregisterEvents() +{ + DBG(FUNC, "Unregister ESLs"); + + if(!_events) + return true; + + for(VectorEvents::const_iterator event = _events->begin(); event != _events->end(); event++) + { + DBG(FUNC, FMT("Unregister subclass=\"%s\"") % *(event)); + switch_event_free_subclass((*(event)).c_str()); + } + + return true; +} + + + +/******************************************************************************/ + diff --git a/src/mod/endpoints/mod_khomp/support/klog-config.cpp b/src/mod/endpoints/mod_khomp/support/klog-config.cpp index d2d743a..112b616 100644 --- a/src/mod/endpoints/mod_khomp/support/klog-config.cpp +++ b/src/mod/endpoints/mod_khomp/support/klog-config.cpp @@ -60,7 +60,11 @@ Logfile::~Logfile() /* nothing for now */ }; +#if COMMONS_AT_LEAST(1,1) +bool Logfile::select(Section ** ptr, const std::string & str) +#else bool Logfile::select(Section ** ptr, std::string str) +#endif { // default section, needed for API compliance. if (str == "") diff --git a/src/mod/endpoints/mod_khomp/support/klog-config.hpp b/src/mod/endpoints/mod_khomp/support/klog-config.hpp index 6e3e75a..fbab705 100644 --- a/src/mod/endpoints/mod_khomp/support/klog-config.hpp +++ b/src/mod/endpoints/mod_khomp/support/klog-config.hpp @@ -43,6 +43,7 @@ #include <stdexcept> #pragma GCC visibility pop +#include <config_commons.hpp> #include <format.hpp> #include <configurator/configfile.hpp> @@ -57,7 +58,12 @@ struct Logfile: public Configfile Logfile(); ~Logfile(); +#if COMMONS_AT_LEAST(1,1) + bool select(Section **, const std::string & str = ""); +#else bool select(Section **, std::string str = ""); +#endif + bool serialize(std::ofstream &); Section & root() { return _logoptions; }; diff --git a/src/mod/endpoints/mod_khomp/install.sh b/src/mod/endpoints/mod_khomp/tools/getk3l.sh similarity index 93% rename from src/mod/endpoints/mod_khomp/install.sh rename to src/mod/endpoints/mod_khomp/tools/getk3l.sh index 8cc60f2..57364cd 100755 --- a/src/mod/endpoints/mod_khomp/install.sh +++ b/src/mod/endpoints/mod_khomp/tools/getk3l.sh @@ -53,10 +53,10 @@ then clean "Need to be root\n" fi -if [ "w$FREESWITCH_PATH" == "w" ] -then - clean "FreeSWITCH source PATH is needed: \n\tSet \"FREESWITCH_PATH=\"\n" -fi +#if [ "w$FREESWITCH_PATH" == "w" ] +#then +# clean "FreeSWITCH source PATH is needed: \n\tSet \"FREESWITCH_PATH=\"\n" +#fi if ! which 'kserver' &> /dev/null then @@ -85,9 +85,9 @@ then clean "k3l version 2.1 must be installed: \n\tUninstall the old version of k3l and try again\n" fi -make || clean "Error on compilation\n" +#make || clean "Error on compilation\n" -make install || clean "Error on installation\n" +#make install || clean "Error on installation\n" echo "Successfully installed!" commit 1b7e4a0df9b886c42ca517c7577c88a763b8a075 Merge: 85d2395 1cad9ed Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Wed Dec 1 16:24:03 2010 -0200 Merge branch 'arnaldo.ftdm_channel_read_event' of git@git.sangoma.com:smg_freeswitch into arnaldo.ftdm_channel_read_event commit 85d2395d26135a862b3bed07b316c0ebbf14b725 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Wed Dec 1 16:23:21 2010 -0200 freetdm: ftmod_r2 - now clearing FTDM_CHANNEL_STATE_CHANGE flag when needed diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index b98f7db..73856f0 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -56,15 +56,10 @@ typedef enum { FTDM_R2_RUNNING = (1 << 0), } ftdm_r2_flag_t; -typedef enum { - FTDM_R2_WAITING_ACK = (1 << 0), -} ftdm_r2_call_flag_t; - /* private call information stored in ftdmchan->call_data void* ptr */ #define R2CALL(ftdmchan) ((ftdm_r2_call_t*)((ftdmchan)->call_data)) typedef struct ftdm_r2_call_t { openr2_chan_t *r2chan; - ftdm_r2_call_flag_t flags; int accepted:1; int answer_pending:1; int disconnect_rcvd:1; @@ -154,6 +149,12 @@ static ftdm_io_interface_t g_ftdm_r2_interface; static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan); static void ftdm_r2_state_advance_all(ftdm_channel_t *ftdmchan); +/* whether R2 call accept process is pending */ +#define IS_ACCEPTING_PENDING(ftdmchan) \ + ( (!ftdm_test_flag((ftdmchan), FTDM_CHANNEL_OUTBOUND)) && !R2CALL((ftdmchan))->accepted && \ + ((ftdmchan)->state == FTDM_CHANNEL_STATE_PROGRESS || \ + (ftdmchan)->state == FTDM_CHANNEL_STATE_PROGRESS_MEDIA || \ + (ftdmchan)->state == FTDM_CHANNEL_STATE_UP) ) /* functions not available on windows */ #ifdef WIN32 @@ -374,7 +375,6 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(r2_outgoing_call) if (ftdmchan->state != FTDM_CHANNEL_STATE_DIALING) { ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Collision after call attempt, try another channel, new state = %s\n", ftdm_channel_state2str(ftdmchan->state)); - ftdm_clear_flag(R2CALL(ftdmchan), FTDM_R2_WAITING_ACK); return FTDM_BREAK; } @@ -451,16 +451,43 @@ static void ftdm_r2_on_call_offered(openr2_chan_t *r2chan, const char *ani, cons ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RING); } +/* + * Accepting a call in R2 is a lengthy process due to MF tones, + * when the user sends PROGRESS indication (implicitly moving the + * ftdm channel to PROGRESS state) the R2 processing loop + * does not clear FTDM_CHANNEL_STATE_CHANGE immediately as it does + * for all the other states, instead has to wait for on_call_accepted + * callback from openr2, which means the MF has ended and the progress + * indication is done, in order to clear the flag. However, if + * a protocol error or call disconnection (which is indicated using CAS bits) + * occurrs while accepting, we must clear the pending flag, this function + * takes care of that + * */ +static void clear_accept_pending(ftdm_channel_t *fchan) +{ + if (IS_ACCEPTING_PENDING(fchan)) { + ftdm_clear_flag(fchan, FTDM_CHANNEL_STATE_CHANGE); + ftdm_channel_complete_state(fchan); + } else if (ftdm_test_flag(fchan, FTDM_CHANNEL_STATE_CHANGE)) { + ftdm_log_chan(fchan, FTDM_LOG_CRIT, "State change flag set in state %s, last state = %s\n", + ftdm_channel_state2str(fchan->state), ftdm_channel_state2str(fchan->last_state)); + ftdm_clear_flag(fchan, FTDM_CHANNEL_STATE_CHANGE); + ftdm_channel_complete_state(fchan); + } +} + static void ftdm_r2_on_call_accepted(openr2_chan_t *r2chan, openr2_call_mode_t mode) { ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "Call accepted\n"); + + clear_accept_pending(ftdmchan); + /* at this point the MF signaling has ended and there is no point on keep reading */ openr2_chan_disable_read(r2chan); R2CALL(ftdmchan)->accepted = 1; + if (OR2_DIR_BACKWARD == openr2_chan_get_direction(r2chan)) { - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE); - ftdm_channel_complete_state(ftdmchan); if (R2CALL(ftdmchan)->answer_pending) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Answer was pending, answering now.\n"); ft_r2_answer_call(ftdmchan); @@ -493,6 +520,8 @@ static void ftdm_r2_on_call_disconnect(openr2_chan_t *r2chan, openr2_call_discon ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Got openr2 disconnection, clearing call\n"); + clear_accept_pending(ftdmchan); + R2CALL(ftdmchan)->disconnect_rcvd = 1; if (ftdmchan->state == FTDM_CHANNEL_STATE_HANGUP) { @@ -564,6 +593,8 @@ static void ftdm_r2_on_protocol_error(openr2_chan_t *r2chan, openr2_protocol_err ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Protocol error\n"); + clear_accept_pending(ftdmchan); + R2CALL(ftdmchan)->disconnect_rcvd = 1; R2CALL(ftdmchan)->protocol_error = 1; @@ -1204,12 +1235,9 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Executing state handler for %s\n", ftdm_channel_state2str(ftdmchan->state)); R2CALL(ftdmchan)->chanstate = ftdmchan->state; - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) && !R2CALL(ftdmchan)->accepted && - (ftdmchan->state == FTDM_CHANNEL_STATE_PROGRESS || - ftdmchan->state == FTDM_CHANNEL_STATE_PROGRESS_MEDIA || - ftdmchan->state == FTDM_CHANNEL_STATE_UP) ) { + if (IS_ACCEPTING_PENDING(ftdmchan)) { /* - Moving to PROGRESS, PROGRESS_MEDIA or UP means that we must accept the call, and accepting + Moving to PROGRESS, PROGRESS_MEDIA or UP means that we must accept the call first, and accepting the call in R2 means sending a tone, then waiting for the acknowledge from the other end, since all of that requires sending and detecting tones, it takes a few milliseconds (I'd say around 100) which means during that time the user should not try to perform any operations like answer, hangup or anything commit 6b52a43314824943a3ef19b86bd577d5729416eb Author: Jeff Lenk <jeff@jefflenk.com> Date: Wed Dec 1 11:55:05 2010 -0600 fix build warnings diff --git a/libs/freetdm/src/ftdm_call_utils.c b/libs/freetdm/src/ftdm_call_utils.c index 52d2557..69f2fb4 100644 --- a/libs/freetdm/src/ftdm_call_utils.c +++ b/libs/freetdm/src/ftdm_call_utils.c @@ -38,7 +38,7 @@ FT_DECLARE(ftdm_status_t) ftdm_set_npi(const char *string, uint8_t *target) { - int val; + uint8_t val; ftdm_status_t status = FTDM_SUCCESS; val = ftdm_str2ftdm_npi(string); @@ -53,7 +53,7 @@ FT_DECLARE(ftdm_status_t) ftdm_set_npi(const char *string, uint8_t *target) FT_DECLARE(ftdm_status_t) ftdm_set_ton(const char *string, uint8_t *target) { - int val; + uint8_t val; ftdm_status_t status = FTDM_SUCCESS; val = ftdm_str2ftdm_ton(string); @@ -68,7 +68,7 @@ FT_DECLARE(ftdm_status_t) ftdm_set_ton(const char *string, uint8_t *target) FT_DECLARE(ftdm_status_t) ftdm_set_bearer_capability(const char *string, uint8_t *target) { - int val; + uint8_t val; ftdm_status_t status = FTDM_SUCCESS; val = ftdm_str2ftdm_bearer_cap(string); @@ -84,7 +84,7 @@ FT_DECLARE(ftdm_status_t) ftdm_set_bearer_capability(const char *string, uint8_t FT_DECLARE(ftdm_status_t) ftdm_set_bearer_layer1(const char *string, uint8_t *target) { - int val; + uint8_t val; ftdm_status_t status = FTDM_SUCCESS; val = ftdm_str2ftdm_usr_layer1_prot(string); @@ -100,7 +100,7 @@ FT_DECLARE(ftdm_status_t) ftdm_set_bearer_layer1(const char *string, uint8_t *ta FT_DECLARE(ftdm_status_t) ftdm_set_screening_ind(const char *string, uint8_t *target) { - int val; + uint8_t val; ftdm_status_t status = FTDM_SUCCESS; val = ftdm_str2ftdm_screening(string); @@ -116,7 +116,7 @@ FT_DECLARE(ftdm_status_t) ftdm_set_screening_ind(const char *string, uint8_t *ta FT_DECLARE(ftdm_status_t) ftdm_set_presentation_ind(const char *string, uint8_t *target) { - int val; + uint8_t val; ftdm_status_t status = FTDM_SUCCESS; val = ftdm_str2ftdm_presentation(string); commit 9d021b8dc4340e4f99f94984c8c7717d513d2e9c Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Dec 1 12:28:38 2010 -0500 Freetdm: moved some defines from ftmod_sangoma_isdn.h to ftmod_sangoma_isdn_user.h diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index eb00b1f..6cdbde7 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -47,11 +47,12 @@ #include <ctype.h> #include "private/ftdm_core.h" +#include "ftmod_sangoma_isdn_user.h" #include <sng_isdn.h> /* Theoretical limit for MAX_SPANS_PER_NFAS_LINK is 31, - but set to 8 for now to save some memor */ + but set to 8 for now to save some memory */ #define MAX_SPANS_PER_NFAS_LINK 8 #define NUM_E1_CHANNELS_PER_SPAN 32 @@ -64,31 +65,6 @@ /* TODO: rename all *_cc_* to *_an_* */ -#define SNGISDN_ENUM_NAMES(_NAME, _STRINGS) static const char * _NAME [] = { _STRINGS , NULL }; -#define SNGISDN_STR2ENUM_P(_FUNC1, _FUNC2, _TYPE) _TYPE _FUNC1 (const char *name); const char * _FUNC2 (_TYPE type); -#define SNGISDN_STR2ENUM(_FUNC1, _FUNC2, _TYPE, _STRINGS, _MAX) \ - _TYPE _FUNC1 (const char *name) \ -{ \ - int i; \ - _TYPE t = _MAX ; \ - \ - for (i = 0; i < _MAX ; i++) { \ - if (!strcasecmp(name, _STRINGS[i])) { \ - t = (_TYPE) i; \ - break; \ -} \ -} \ - \ - return t; \ -} \ - const char * _FUNC2 (_TYPE type) \ -{ \ - if (type > _MAX) { \ - type = _MAX; \ -} \ - return _STRINGS[(int)type]; \ -} \ - typedef enum { @@ -163,45 +139,7 @@ typedef enum { SNGISDN_EVENT_RST_IND, } ftdm_sngisdn_event_id_t; -typedef enum { - /* Call is not end-to-end ISDN */ - SNGISDN_PROGIND_DESCR_NETE_ISDN, - /* Destination address is non-ISDN */ - SNGISDN_PROGIND_DESCR_DEST_NISDN, - /* Origination address is non-ISDN */ - SNGISDN_PROGIND_DESCR_ORIG_NISDN, - /* Call has returned to the ISDN */ - SNGISDN_PROGIND_DESCR_RET_ISDN, - /* Interworking as occured and has resulted in a telecommunication service change */ - SNGISDN_PROGIND_DESCR_SERV_CHANGE, - /* In-band information or an appropriate pattern is now available */ - SNGISDN_PROGIND_DESCR_IB_AVAIL, - /* Invalid */ - SNGISDN_PROGIND_DESCR_INVALID, -} ftdm_sngisdn_progind_descr_t; -#define SNGISDN_PROGIND_DESCR_STRINGS "not-end-to-end-isdn", "destination-is-non-isdn", "origination-is-non-isdn", "call-returned-to-isdn", "service-change", "inband-info-available", "invalid" -SNGISDN_STR2ENUM_P(ftdm_str2ftdm_sngisdn_progind_descr, ftdm_sngisdn_progind_descr2str, ftdm_sngisdn_progind_descr_t); -typedef enum { - /* User */ - SNGISDN_PROGIND_LOC_USER, - /* Private network serving the local user */ - SNGISDN_PROGIND_LOC_PRIV_NET_LOCAL_USR, - /* Public network serving the local user */ - SNGISDN_PROGIND_LOC_PUB_NET_LOCAL_USR, - /* Transit network */ - SNGISDN_PROGIND_LOC_TRANSIT_NET, - /* Public network serving remote user */ - SNGISDN_PROGIND_LOC_PUB_NET_REMOTE_USR, - /* Private network serving remote user */ - SNGISDN_PROGIND_LOC_PRIV_NET_REMOTE_USR, - /* Network beyond the interworking point */ - SNGISDN_PROGIND_LOC_NET_BEYOND_INTRW, - /* Invalid */ - SNGISDN_PROGIND_LOC_INVALID, -} ftdm_sngisdn_progind_loc_t; -#define SNGISDN_PROGIND_LOC_STRINGS "user", "private-net-local-user", "public-net-local-user", "transit-network", "public-net-remote-user", "private-net-remote-user", "beyond-interworking", "invalid" -SNGISDN_STR2ENUM_P(ftdm_str2ftdm_sngisdn_progind_loc, ftdm_sngisdn_progind_loc2str, ftdm_sngisdn_progind_loc_t); typedef struct ftdm_sngisdn_prog_ind { ftdm_sngisdn_progind_loc_t loc; /* location */ @@ -499,3 +437,15 @@ void sngisdn_print_span(ftdm_stream_handle_t *stream, ftdm_span_t *span); #endif /* __FTMOD_SNG_ISDN_H__ */ +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4: + */ + +/******************************************************************************/ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c index 6b4e73a..b7e6e26 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c @@ -280,7 +280,9 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ ftdm_set_bearer_capability(val, (uint8_t*)&span->default_caller_data.bearer_capability); } else if (!strcasecmp(var, "outbound-bearer_layer1")) { ftdm_set_bearer_layer1(val, (uint8_t*)&span->default_caller_data.bearer_layer1); - } else if (!strcasecmp(var, "local-number")) { + } else if (!strcasecmp(var, "channel-restart-on-link-up")) { + parse_yesno(var, val, &signal_data->restart_opt); + } else if (!strcasecmp(var, "local-number")) { if (add_local_number(val, span) != FTDM_SUCCESS) { return FTDM_FAIL; } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_user.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_user.h new file mode 100644 index 0000000..5d94e6c --- /dev/null +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_user.h @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2010, Sangoma Technologies + * David Yat Sin <davidy@sangoma.com> + * 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 original author; nor the names of any 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 OWNER + * 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. + */ +#ifndef __FTMOD_SANGOMA_ISDN_USER_H__ +#define __FTMOD_SANGOMA_ISDN_USER_H__ + + +#define SNGISDN_ENUM_NAMES(_NAME, _STRINGS) static const char * _NAME [] = { _STRINGS , NULL }; +#define SNGISDN_STR2ENUM_P(_FUNC1, _FUNC2, _TYPE) _TYPE _FUNC1 (const char *name); const char * _FUNC2 (_TYPE type); +#define SNGISDN_STR2ENUM(_FUNC1, _FUNC2, _TYPE, _STRINGS, _MAX) \ + _TYPE _FUNC1 (const char *name) \ + { \ + int i; \ + _TYPE t = _MAX ; \ + \ + for (i = 0; i < _MAX ; i++) { \ + if (!strcasecmp(name, _STRINGS[i])) { \ + t = (_TYPE) i; \ + break; \ + } \ + } \ + return t; \ + } \ + const char * _FUNC2 (_TYPE type) \ + { \ + if (type > _MAX) { \ + type = _MAX; \ + } \ + return _STRINGS[(int)type]; \ + } \ + + +typedef enum { + /* Call is not end-to-end ISDN */ + SNGISDN_PROGIND_DESCR_NETE_ISDN, + /* Destination address is non-ISDN */ + SNGISDN_PROGIND_DESCR_DEST_NISDN, + /* Origination address is non-ISDN */ + SNGISDN_PROGIND_DESCR_ORIG_NISDN, + /* Call has returned to the ISDN */ + SNGISDN_PROGIND_DESCR_RET_ISDN, + /* Interworking as occured and has resulted in a telecommunication service change */ + SNGISDN_PROGIND_DESCR_SERV_CHANGE, + /* In-band information or an appropriate pattern is now available */ + SNGISDN_PROGIND_DESCR_IB_AVAIL, + /* Invalid */ + SNGISDN_PROGIND_DESCR_INVALID, +} ftdm_sngisdn_progind_descr_t; +#define SNGISDN_PROGIND_DESCR_STRINGS "not-end-to-end-isdn", "destination-is-non-isdn", "origination-is-non-isdn", "call-returned-to-isdn", "service-change", "inband-info-available", "invalid" +SNGISDN_STR2ENUM_P(ftdm_str2ftdm_sngisdn_progind_descr, ftdm_sngisdn_progind_descr2str, ftdm_sngisdn_progind_descr_t); + + +typedef enum { + /* User */ + SNGISDN_PROGIND_LOC_USER, + /* Private network serving the local user */ + SNGISDN_PROGIND_LOC_PRIV_NET_LOCAL_USR, + /* Public network serving the local user */ + SNGISDN_PROGIND_LOC_PUB_NET_LOCAL_USR, + /* Transit network */ + SNGISDN_PROGIND_LOC_TRANSIT_NET, + /* Public network serving remote user */ + SNGISDN_PROGIND_LOC_PUB_NET_REMOTE_USR, + /* Private network serving remote user */ + SNGISDN_PROGIND_LOC_PRIV_NET_REMOTE_USR, + /* Network beyond the interworking point */ + SNGISDN_PROGIND_LOC_NET_BEYOND_INTRW, + /* Invalid */ + SNGISDN_PROGIND_LOC_INVALID, +} ftdm_sngisdn_progind_loc_t; +#define SNGISDN_PROGIND_LOC_STRINGS "user", "private-net-local-user", "public-net-local-user", "transit-network", "public-net-remote-user", "private-net-remote-user", "beyond-interworking", "invalid" +SNGISDN_STR2ENUM_P(ftdm_str2ftdm_sngisdn_progind_loc, ftdm_sngisdn_progind_loc2str, ftdm_sngisdn_progind_loc_t); + + +#endif /* __FTMOD_SANGOMA_ISDN_USER_H__*/ + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4: + */ + +/******************************************************************************/ commit ca28a80658d50a9fab14f3022c40536b385b6b9b Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Dec 1 10:31:28 2010 -0600 update caller_profile to have correct uuid when using custom uuid from originate string diff --git a/src/switch_core_session.c b/src/switch_core_session.c index fc76481..2567d17 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -1327,6 +1327,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_uuid(switch_core_session { switch_event_t *event; switch_core_session_message_t msg = { 0 }; + switch_caller_profile_t *profile; switch_assert(use_uuid); @@ -1343,6 +1344,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_uuid(switch_core_session msg.string_array_arg[1] = use_uuid; switch_core_session_receive_message(session, &msg); + if ((profile = switch_channel_get_caller_profile(session->channel))) { + profile->uuid = switch_core_strdup(profile->pool, use_uuid); + } + switch_event_create(&event, SWITCH_EVENT_CHANNEL_UUID); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Old-Unique-ID", session->uuid_str); switch_core_hash_delete(session_manager.session_table, session->uuid_str); commit 43c91d5fce868bc7a6b9055494cd3e0d46ade964 Author: Jeff Lenk <jeff@jefflenk.com> Date: Wed Dec 1 10:25:02 2010 -0600 misc windows x64 fixes diff --git a/libs/freetdm/freetdm.2008.sln b/libs/freetdm/freetdm.2008.sln index f059d94..2e8c7c4 100644 --- a/libs/freetdm/freetdm.2008.sln +++ b/libs/freetdm/freetdm.2008.sln @@ -161,10 +161,8 @@ Global {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|Win32.Build.0 = Release|Win32 {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|x64.ActiveCfg = Release|Win32 {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Debug|Win32.ActiveCfg = Debug|Win32 - {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Debug|Win32.Build.0 = Debug|Win32 {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Debug|x64.ActiveCfg = Debug|Win32 {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Release|Win32.ActiveCfg = Release|Win32 - {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Release|Win32.Build.0 = Release|Win32 {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Release|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution diff --git a/libs/freetdm/msvc/testboost/testboost.2008.vcproj b/libs/freetdm/msvc/testboost/testboost.2008.vcproj index afb44b6..5707033 100644 --- a/libs/freetdm/msvc/testboost/testboost.2008.vcproj +++ b/libs/freetdm/msvc/testboost/testboost.2008.vcproj @@ -22,7 +22,7 @@ <Configuration Name="Debug|Win32" OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" + IntermediateDirectory="testboost\$(ConfigurationName)" ConfigurationType="1" CharacterSet="1" BuildLogFile="$(IntDir)\BuildLog-testboost.htm" @@ -98,12 +98,11 @@ /> </Configuration> <Configuration - Name="Release|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" + Name="Debug|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\testboost\$(ConfigurationName)" ConfigurationType="1" CharacterSet="1" - WholeProgramOptimization="1" BuildLogFile="$(IntDir)\BuildLog-testboost.htm" > <Tool @@ -120,12 +119,16 @@ /> <Tool Name="VCMIDLTool" + TargetEnvironment="3" /> <Tool Name="VCCLCompilerTool" + Optimization="0" AdditionalIncludeDirectories="../../src/include" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" - RuntimeLibrary="2" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="4" WarnAsError="true" @@ -143,14 +146,13 @@ /> <Tool Name="VCLinkerTool" - LinkIncremental="1" + AdditionalDependencies="..\..\debug\freetdm.lib" + LinkIncremental="2" GenerateDebugInformation="true" SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" RandomizedBaseAddress="1" DataExecutionPrevention="0" - TargetMachine="1" + TargetMachine="17" /> <Tool Name="VCALinkTool" @@ -175,11 +177,12 @@ /> </Configuration> <Configuration - Name="Debug|x64" - OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="testboost\$(ConfigurationName)" ConfigurationType="1" CharacterSet="1" + WholeProgramOptimization="1" BuildLogFile="$(IntDir)\BuildLog-testboost.htm" > <Tool @@ -196,16 +199,12 @@ /> <Tool Name="VCMIDLTool" - TargetEnvironment="3" /> <Tool Name="VCCLCompilerTool" - Optimization="0" AdditionalIncludeDirectories="../../src/include" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="3" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="4" WarnAsError="true" @@ -223,13 +222,14 @@ /> <Tool Name="VCLinkerTool" - AdditionalDependencies="..\..\debug\freetdm.lib" - LinkIncremental="2" + LinkIncremental="1" GenerateDebugInformation="true" SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" RandomizedBaseAddress="1" DataExecutionPrevention="0" - TargetMachine="17" + TargetMachine="1" /> <Tool Name="VCALinkTool" @@ -256,7 +256,7 @@ <Configuration Name="Release|x64" OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\testboost\$(ConfigurationName)" ConfigurationType="1" CharacterSet="1" WholeProgramOptimization="1" diff --git a/libs/freetdm/msvc/testboost/testsangomaboost.2008.vcproj b/libs/freetdm/msvc/testboost/testsangomaboost.2008.vcproj index 834b298..29c4a27 100644 --- a/libs/freetdm/msvc/testboost/testsangomaboost.2008.vcproj +++ b/libs/freetdm/msvc/testboost/testsangomaboost.2008.vcproj @@ -98,12 +98,11 @@ /> </Configuration> <Configuration - Name="Release|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" + Name="Debug|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" ConfigurationType="1" CharacterSet="1" - WholeProgramOptimization="1" BuildLogFile="$(IntDir)\BuildLog-testsangomaboost.htm" > <Tool @@ -120,12 +119,16 @@ /> <Tool Name="VCMIDLTool" + TargetEnvironment="3" /> <Tool Name="VCCLCompilerTool" + Optimization="0" AdditionalIncludeDirectories="../../src/include" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" - RuntimeLibrary="2" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="4" WarnAsError="true" @@ -143,14 +146,13 @@ /> <Tool Name="VCLinkerTool" - LinkIncremental="1" + AdditionalDependencies="..\..\debug\freetdm.lib" + LinkIncremental="2" GenerateDebugInformation="true" SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" RandomizedBaseAddress="1" DataExecutionPrevention="0" - TargetMachine="1" + TargetMachine="17" /> <Tool Name="VCALinkTool" @@ -175,11 +177,12 @@ /> </Configuration> <Configuration - Name="Debug|x64" - OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" ConfigurationType="1" CharacterSet="1" + WholeProgramOptimization="1" BuildLogFile="$(IntDir)\BuildLog-testsangomaboost.htm" > <Tool @@ -196,16 +199,12 @@ /> <Tool Name="VCMIDLTool" - TargetEnvironment="3" /> <Tool Name="VCCLCompilerTool" - Optimization="0" AdditionalIncludeDirectories="../../src/include" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="3" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" + RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="4" WarnAsError="true" @@ -223,13 +222,14 @@ /> <Tool Name="VCLinkerTool" - AdditionalDependencies="..\..\debug\freetdm.lib" - LinkIncremental="2" + LinkIncremental="1" GenerateDebugInformation="true" SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" RandomizedBaseAddress="1" DataExecutionPrevention="0" - TargetMachine="17" + TargetMachine="1" /> <Tool Name="VCALinkTool" @@ -285,7 +285,7 @@ RuntimeLibrary="2" UsePrecompiledHeader="0" WarningLevel="4" - WarnAsError="true" + WarnAsError="false" DebugInformationFormat="3" DisableSpecificWarnings="4100" /> diff --git a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.2008.vcproj b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.2008.vcproj index 448f03a..09349fc 100644 --- a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.2008.vcproj +++ b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.2008.vcproj @@ -1,353 +1,353 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="9.00" - Name="ftmod_analog" - ProjectGUID="{37C94798-6E33-4B4F-8EE0-C72A7DC91157}" - RootNamespace="ftmod_analog" - Keyword="Win32Proj" - TargetFrameworkVersion="196613" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="2" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="..\..\include;..\..\isdn\include" - PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EXPORTS" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="0" - WarningLevel="4" - WarnAsError="true" - DebugInformationFormat="4" - DisableSpecificWarnings="4100" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="2" - GenerateDebugInformation="true" - SubSystem="2" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="2" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="2" - EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories="..\..\include;..\..\isdn\include" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EXPORTS" - RuntimeLibrary="2" - EnableFunctionLevelLinking="true" - UsePrecompiledHeader="0" - WarningLevel="4" - WarnAsError="true" - DebugInformationFormat="3" - DisableSpecificWarnings="4100" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="1" - GenerateDebugInformation="true" - SubSystem="2" - OptimizeReferences="2" - EnableCOMDATFolding="2" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="2" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="..\..\include;..\..\isdn\include" - PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EXPORTS" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="0" - WarningLevel="4" - WarnAsError="false" - DebugInformationFormat="3" - DisableSpecificWarnings="4100" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="2" - GenerateDebugInformation="true" - SubSystem="2" - TargetMachine="17" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="2" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="2" - EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories="..\..\include;..\..\isdn\include" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EXPORTS" - RuntimeLibrary="2" - EnableFunctionLevelLinking="true" - UsePrecompiledHeader="0" - WarningLevel="4" - WarnAsError="true" - DebugInformationFormat="3" - DisableSpecificWarnings="4100" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="1" - GenerateDebugInformation="true" - SubSystem="2" - OptimizeReferences="2" - EnableCOMDATFolding="2" - TargetMachine="17" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath="ftmod_analog.c" - > - </File> - </Filter> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath="ftdm_analog.h" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="ftmod_analog" + ProjectGUID="{37C94798-6E33-4B4F-8EE0-C72A7DC91157}" + RootNamespace="ftmod_analog" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="2" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="..\..\include;..\..\isdn\include" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EXPORTS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="4" + WarnAsError="true" + DebugInformationFormat="4" + DisableSpecificWarnings="4100" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="2" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="..\..\include;..\..\isdn\include" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EXPORTS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="4" + WarnAsError="false" + DebugInformationFormat="3" + DisableSpecificWarnings="4100" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="2" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="2" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + AdditionalIncludeDirectories="..\..\include;..\..\isdn\include" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EXPORTS" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="4" + WarnAsError="true" + DebugInformationFormat="3" + DisableSpecificWarnings="4100" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="2" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + AdditionalIncludeDirectories="..\..\include;..\..\isdn\include" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EXPORTS" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="4" + WarnAsError="false" + DebugInformationFormat="3" + DisableSpecificWarnings="4100" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath="ftmod_analog.c" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <File + RelativePath="ftdm_analog.h" + > + </File> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.2008.vcproj b/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.2008.vcproj index 8ad1837..837ba7d 100644 --- a/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.2008.vcproj +++ b/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.2008.vcproj @@ -1,353 +1,353 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="9.00" - Name="ftmod_analog_em" - ProjectGUID="{B3F49375-2834-4937-9D8C-4AC2EC911010}" - RootNamespace="ftmod_analog_em" - Keyword="Win32Proj" - TargetFrameworkVersion="196613" - > - <Platforms> - <Platform - Name="Win32" - /> - <Platform - Name="x64" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="2" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="..\..\include;..\..\isdn\include" - PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EM_EXPORTS" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="0" - WarningLevel="4" - WarnAsError="true" - DebugInformationFormat="4" - DisableSpecificWarnings="4100" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="2" - GenerateDebugInformation="true" - SubSystem="2" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="2" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="2" - EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories="..\..\include;..\..\isdn\include" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EM_EXPORTS" - RuntimeLibrary="2" - EnableFunctionLevelLinking="true" - UsePrecompiledHeader="0" - WarningLevel="4" - WarnAsError="true" - DebugInformationFormat="3" - DisableSpecificWarnings="4100" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="1" - GenerateDebugInformation="true" - SubSystem="2" - OptimizeReferences="2" - EnableCOMDATFolding="2" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Debug|x64" - OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="2" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="..\..\include;..\..\isdn\include" - PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EM_EXPORTS" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="0" - WarningLevel="4" - WarnAsError="false" - DebugInformationFormat="3" - DisableSpecificWarnings="4100" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="2" - GenerateDebugInformation="true" - SubSystem="2" - TargetMachine="17" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|x64" - OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="2" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - TargetEnvironment="3" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="2" - EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories="..\..\include;..\..\isdn\include" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EM_EXPORTS" - RuntimeLibrary="2" - EnableFunctionLevelLinking="true" - UsePrecompiledHeader="0" - WarningLevel="4" - WarnAsError="true" - DebugInformationFormat="3" - DisableSpecificWarnings="4100" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="1" - GenerateDebugInformation="true" - SubSystem="2" - OptimizeReferences="2" - EnableCOMDATFolding="2" - TargetMachine="17" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath="ftmod_analog_em.c" - > - </File> - </Filter> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath="ftdm_analog_em.h" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="ftmod_analog_em" + ProjectGUID="{B3F49375-2834-4937-9D8C-4AC2EC911010}" + RootNamespace="ftmod_analog_em" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="2" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="..\..\include;..\..\isdn\include" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EM_EXPORTS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="4" + WarnAsError="true" + DebugInformationFormat="4" + DisableSpecificWarnings="4100" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="2" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="..\..\include;..\..\isdn\include" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EM_EXPORTS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="4" + WarnAsError="false" + DebugInformationFormat="3" + DisableSpecificWarnings="4100" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="2" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="2" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + AdditionalIncludeDirectories="..\..\include;..\..\isdn\include" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EM_EXPORTS" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="4" + WarnAsError="true" + DebugInformationFormat="3" + DisableSpecificWarnings="4100" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="2" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="2" + EnableIntrinsicFunctions="true" + AdditionalIncludeDirectories="..\..\include;..\..\isdn\include" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EM_EXPORTS" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="4" + WarnAsError="false" + DebugInformationFormat="3" + DisableSpecificWarnings="4100" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="1" + GenerateDebugInformation="true" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath="ftmod_analog_em.c" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <File + RelativePath="ftdm_analog_em.h" + > + </File> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.2008.vcproj b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.2008.vcproj index e7fc1d6..73e4218 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.2008.vcproj +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.2008.vcproj @@ -96,12 +96,11 @@ /> </Configuration> <Configuration - Name="Release|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" + Name="Debug|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" ConfigurationType="2" CharacterSet="1" - WholeProgramOptimization="1" > <Tool Name="VCPreBuildEventTool" @@ -117,15 +116,16 @@ /> <Tool Name="VCMIDLTool" + TargetEnvironment="3" /> <Tool Name="VCCLCompilerTool" - Optimization="2" - EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories="..\..\include" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_SANGOMA_BOOST_EXPORTS" - RuntimeLibrary="2" - EnableFunctionLevelLinking="true" + Optimization="0" + AdditionalIncludeDirectories="..\..\include;..\..\isdn\include" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_SANGOMA_BOOST_EXPORTS" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="4" WarnAsError="true" @@ -143,12 +143,12 @@ /> <Tool Name="VCLinkerTool" - LinkIncremental="1" + AdditionalDependencies="freetdm.lib" + LinkIncremental="2" + AdditionalLibraryDirectories=""$(OutDir)"" GenerateDebugInformation="true" SubSystem="2" - OptimizeReferences="2" - EnableCOMDATFolding="2" - TargetMachine="1" + TargetMachine="17" /> <Tool Name="VCALinkTool" @@ -173,11 +173,12 @@ /> </Configuration> <Configuration - Name="Debug|x64" - OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" ConfigurationType="2" CharacterSet="1" + WholeProgramOptimization="1" > <Tool Name="VCPreBuildEventTool" @@ -193,16 +194,15 @@ /> <Tool Name="VCMIDLTool" - TargetEnvironment="3" /> <Tool Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="..\..\include;..\..\isdn\include" - PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_SANGOMA_BOOST_EXPORTS" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="3" + Optimization="2" + EnableIntrinsicFunctions="true" + AdditionalIncludeDirectories="..\..\include" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_SANGOMA_BOOST_EXPORTS" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" UsePrecompiledHeader="0" WarningLevel="4" WarnAsError="true" @@ -220,12 +220,12 @@ /> <Tool Name="VCLinkerTool" - AdditionalDependencies="freetdm.lib" - LinkIncremental="2" - AdditionalLibraryDirectories=""$(OutDir)"" + LinkIncremental="1" GenerateDebugInformation="true" SubSystem="2" - TargetMachine="17" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" /> <Tool Name="VCALinkTool" @@ -283,7 +283,7 @@ EnableFunctionLevelLinking="true" UsePrecompiledHeader="0" WarningLevel="4" - WarnAsError="true" + WarnAsError="false" DebugInformationFormat="3" DisableSpecificWarnings="4100" /> commit 1cad9ed8a9a958080afaf7dd692520c4112d48ee Merge: 6b61166 3934682 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Wed Dec 1 13:55:34 2010 -0200 Merge branch 'arnaldo.ftdm_channel_read_event' of git.sangoma.com:smg_freeswitch into arnaldo.ftdm_channel_read_event commit 1ba98b02b9b2a44d1504f5c4546a7088907ed4eb Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Dec 1 09:54:28 2010 -0600 FS-2852 diff --git a/src/switch_xml.c b/src/switch_xml.c index a7bfe41..05cfe9f 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -1980,19 +1980,16 @@ static char not_so_threadsafe_error_buffer[256] = ""; SWITCH_DECLARE(switch_xml_t) switch_xml_open_root(uint8_t reload, const char **err) { char path_buf[1024]; - uint8_t hasmain = 0, errcnt = 0; + uint8_t errcnt = 0; switch_xml_t new_main, r = NULL; switch_mutex_lock(XML_LOCK); if (MAIN_XML_ROOT) { - hasmain++; - if (!reload) { r = switch_xml_root(); goto done; } - switch_thread_rwlock_wrlock(RWLOCK); } switch_snprintf(path_buf, sizeof(path_buf), "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "freeswitch.xml"); @@ -2007,9 +2004,15 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_open_root(uint8_t reload, const char **e } else { switch_xml_t old_root; *err = "Success"; + + switch_thread_rwlock_wrlock(RWLOCK); + old_root = MAIN_XML_ROOT; MAIN_XML_ROOT = new_main; switch_set_flag(MAIN_XML_ROOT, SWITCH_XML_ROOT); + + switch_thread_rwlock_unlock(RWLOCK); + switch_xml_free(old_root); /* switch_xml_free_in_thread(old_root); */ } @@ -2018,10 +2021,6 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_open_root(uint8_t reload, const char **e errcnt++; } - if (hasmain) { - switch_thread_rwlock_unlock(RWLOCK); - } - if (errcnt == 0) { switch_event_t *event; if (switch_event_create(&event, SWITCH_EVENT_RELOADXML) == SWITCH_STATUS_SUCCESS) { commit 6b611662c26fbdd1ae96d71dadd243c48b725ab6 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Wed Dec 1 13:47:17 2010 -0200 freetdm: removed ftmod_sangoma_boost, testboost, testsangomaboost, ftmod_sangoma_isdn and ftmod_r2 from default msvc 2008 build diff --git a/libs/freetdm/freetdm.2008.sln b/libs/freetdm/freetdm.2008.sln index f059d94..c7207a6 100644 --- a/libs/freetdm/freetdm.2008.sln +++ b/libs/freetdm/freetdm.2008.sln @@ -64,6 +64,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_sangoma_isdn", "src\f EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_r2", "src\ftmod\ftmod_r2\ftmod_r2.2008.vcproj", "{08C3EA27-A51D-47F8-B47D-B189C649CF30}" + ProjectSection(ProjectDependencies) = postProject + {93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D} + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -131,7 +134,6 @@ Global {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Release|Win32.ActiveCfg = Release|Win32 {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Release|x64.ActiveCfg = Release|x64 {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Debug|Win32.ActiveCfg = Debug|Win32 - {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Debug|Win32.Build.0 = Debug|Win32 {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Debug|x64.ActiveCfg = Debug|x64 {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Debug|x64.Build.0 = Debug|x64 {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Release|Win32.ActiveCfg = Release|Win32 @@ -139,7 +141,6 @@ Global {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Release|x64.ActiveCfg = Release|x64 {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Release|x64.Build.0 = Release|x64 {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Debug|Win32.ActiveCfg = Debug|Win32 - {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Debug|Win32.Build.0 = Debug|Win32 {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Debug|x64.ActiveCfg = Debug|x64 {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Debug|x64.Build.0 = Debug|x64 {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Release|Win32.ActiveCfg = Release|Win32 @@ -147,7 +148,6 @@ Global {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Release|x64.ActiveCfg = Release|x64 {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Release|x64.Build.0 = Release|x64 {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Debug|Win32.ActiveCfg = Debug|Win32 - {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Debug|Win32.Build.0 = Debug|Win32 {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Debug|x64.ActiveCfg = Debug|x64 {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Debug|x64.Build.0 = Debug|x64 {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|Win32.ActiveCfg = Release|Win32 @@ -155,13 +155,11 @@ Global {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|x64.ActiveCfg = Release|x64 {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|x64.Build.0 = Release|x64 {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Debug|Win32.ActiveCfg = Debug|Win32 - {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Debug|Win32.Build.0 = Debug|Win32 {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Debug|x64.ActiveCfg = Debug|Win32 {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|Win32.ActiveCfg = Release|Win32 {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|Win32.Build.0 = Release|Win32 {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|x64.ActiveCfg = Release|Win32 {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Debug|Win32.ActiveCfg = Debug|Win32 - {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Debug|Win32.Build.0 = Debug|Win32 {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Debug|x64.ActiveCfg = Debug|Win32 {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Release|Win32.ActiveCfg = Release|Win32 {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Release|Win32.Build.0 = Release|Win32 commit 92f43440729f16831fa9a3e840843486a942906e Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Dec 1 09:46:06 2010 -0600 FS-2892 diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 57a2bfa..451d788 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -3732,6 +3732,14 @@ static switch_t38_options_t *tech_process_udptl(private_object_t *tech_pvt, sdp_ if (!t38_options) { t38_options = switch_core_session_alloc(tech_pvt->session, sizeof(switch_t38_options_t)); + + // set some default value + t38_options->T38FaxVersion = 0; + t38_options->T38MaxBitRate = 9600; + t38_options->T38FaxRateManagement = switch_core_session_strdup(tech_pvt->session, "transferredTCF"); + t38_options->T38FaxUdpEC = switch_core_session_strdup(tech_pvt->session, "t38UDPRedundancy"); + t38_options->T38FaxMaxBuffer = 500; + t38_options->T38FaxMaxDatagram = 500; } t38_options->remote_port = (switch_port_t)m->m_port; commit 2343f68597f7f5d2986aeef1f85f579add45b0c4 Author: Jeff Lenk <jeff@jefflenk.com> Date: Tue Nov 30 21:43:28 2010 -0600 VS2010 reswig diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx index 4a0b52e..8033a8f 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx @@ -6454,6 +6454,42 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_destroy() { } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_io_read_lock(void * jarg1) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + result = (switch_status_t)switch_core_session_io_read_lock(arg1); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_io_write_lock(void * jarg1) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + result = (switch_status_t)switch_core_session_io_write_lock(arg1); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_io_rwunlock(void * jarg1) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + result = (switch_status_t)switch_core_session_io_rwunlock(arg1); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_read_lock(void * jarg1) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; @@ -7336,6 +7372,22 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_execute_application_get_fl } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_execute_application_async(void * jarg1, char * jarg2, char * jarg3) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (char *)jarg3; + result = (switch_status_t)switch_core_session_execute_application_async(arg1,(char const *)arg2,(char const *)arg3); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_get_app_flags(char * jarg1, void * jarg2) { int jresult ; char *arg1 = (char *) 0 ; @@ -7566,6 +7618,18 @@ SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_session_event_count(void } +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_session_messages_waiting(void * jarg1) { + unsigned long jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + uint32_t result; + + arg1 = (switch_core_session_t *)jarg1; + result = (uint32_t)switch_core_session_messages_waiting(arg1); + jresult = (unsigned long)result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_dequeue_event(void * jarg1, void * jarg2, int jarg3) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; @@ -27597,6 +27661,74 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_set_realm(void * jarg1, ch } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_get_file_handle(void * jarg1, void * jarg2) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_file_handle_t **arg2 = (switch_file_handle_t **) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (switch_file_handle_t **)jarg2; + result = (switch_status_t)switch_ivr_get_file_handle(arg1,arg2); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_release_file_handle(void * jarg1, void * jarg2) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_file_handle_t **arg2 = (switch_file_handle_t **) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (switch_file_handle_t **)jarg2; + result = (switch_status_t)switch_ivr_release_file_handle(arg1,arg2); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_process_fh(void * jarg1, char * jarg2, void * jarg3) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_file_handle_t *arg3 = (switch_file_handle_t *) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (switch_file_handle_t *)jarg3; + result = (switch_status_t)switch_ivr_process_fh(arg1,(char const *)arg2,arg3); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_insert_file(void * jarg1, char * jarg2, char * jarg3, void * jarg4) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + switch_size_t arg4 ; + switch_size_t *argp4 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (char *)jarg3; + argp4 = (switch_size_t *)jarg4; + if (!argp4) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0); + return 0; + } + arg4 = *argp4; + result = (switch_status_t)switch_ivr_insert_file(arg1,(char const *)arg2,(char const *)arg3,arg4); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RTP_MAX_BUF_LEN_get() { int jresult ; int result; diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs index 2897fef..4d14f10 100644 --- a/src/mod/languages/mod_managed/managed/swig.2010.cs +++ b/src/mod/languages/mod_managed/managed/swig.2010.cs @@ -1113,6 +1113,21 @@ public class freeswitch { return ret; } + public static switch_status_t switch_core_session_io_read_lock(SWIGTYPE_p_switch_core_session session) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_io_read_lock(SWIGTYPE_p_switch_core_session.getCPtr(session)); + return ret; + } + + public static switch_status_t switch_core_session_io_write_lock(SWIGTYPE_p_switch_core_session session) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_io_write_lock(SWIGTYPE_p_switch_core_session.getCPtr(session)); + return ret; + } + + public static switch_status_t switch_core_session_io_rwunlock(SWIGTYPE_p_switch_core_session session) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_io_rwunlock(SWIGTYPE_p_switch_core_session.getCPtr(session)); + return ret; + } + public static switch_status_t switch_core_session_read_lock(SWIGTYPE_p_switch_core_session session) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_read_lock(SWIGTYPE_p_switch_core_session.getCPtr(session)); return ret; @@ -1449,6 +1464,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_core_session_execute_application_async(SWIGTYPE_p_switch_core_session session, string app, string arg) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_execute_application_async(SWIGTYPE_p_switch_core_session.getCPtr(session), app, arg); + return ret; + } + public static switch_status_t switch_core_session_get_app_flags(string app, SWIGTYPE_p_int flags) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_get_app_flags(app, SWIGTYPE_p_int.getCPtr(flags)); return ret; @@ -1528,6 +1548,11 @@ public class freeswitch { return ret; } + public static uint switch_core_session_messages_waiting(SWIGTYPE_p_switch_core_session session) { + uint ret = freeswitchPINVOKE.switch_core_session_messages_waiting(SWIGTYPE_p_switch_core_session.getCPtr(session)); + return ret; + } + public static switch_status_t switch_core_session_dequeue_event(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_event arg1, switch_bool_t force) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_dequeue_event(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_event.getCPtr(arg1), (int)force); return ret; @@ -4471,6 +4496,27 @@ public class freeswitch { return ret; } + public static switch_status_t switch_ivr_get_file_handle(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_file_handle fh) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_get_file_handle(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_file_handle.getCPtr(fh)); + return ret; + } + + public static switch_status_t switch_ivr_release_file_handle(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_file_handle fh) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_release_file_handle(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_file_handle.getCPtr(fh)); + return ret; + } + + public static switch_status_t switch_ivr_process_fh(SWIGTYPE_p_switch_core_session session, string cmd, switch_file_handle fhp) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_process_fh(SWIGTYPE_p_switch_core_session.getCPtr(session), cmd, switch_file_handle.getCPtr(fhp)); + return ret; + } + + public static switch_status_t switch_ivr_insert_file(SWIGTYPE_p_switch_core_session session, string file, string insert_file, SWIGTYPE_p_switch_size_t sample_point) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_insert_file(SWIGTYPE_p_switch_core_session.getCPtr(session), file, insert_file, SWIGTYPE_p_switch_size_t.getCPtr(sample_point)); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + public static switch_status_t switch_rtp_add_crypto_key(SWIGTYPE_p_switch_rtp rtp_session, switch_rtp_crypto_direction_t direction, uint index, switch_rtp_crypto_key_type_t type, SWIGTYPE_p_unsigned_char key, SWIGTYPE_p_switch_size_t keylen) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_add_crypto_key(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), (int)direction, index, (int)type, SWIGTYPE_p_unsigned_char.getCPtr(key), SWIGTYPE_p_switch_size_t.getCPtr(keylen)); if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); @@ -7259,6 +7305,15 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_destroy")] public static extern int switch_core_destroy(); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_io_read_lock")] + public static extern int switch_core_session_io_read_lock(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_io_write_lock")] + public static extern int switch_core_session_io_write_lock(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_io_rwunlock")] + public static extern int switch_core_session_io_rwunlock(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_read_lock")] public static extern int switch_core_session_read_lock(HandleRef jarg1); @@ -7463,6 +7518,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_execute_application_get_flags")] public static extern int switch_core_session_execute_application_get_flags(HandleRef jarg1, string jarg2, string jarg3, HandleRef jarg4); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_execute_application_async")] + public static extern int switch_core_session_execute_application_async(HandleRef jarg1, string jarg2, string jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_app_flags")] public static extern int switch_core_session_get_app_flags(string jarg1, HandleRef jarg2); @@ -7511,6 +7569,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_event_count")] public static extern uint switch_core_session_event_count(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_messages_waiting")] + public static extern uint switch_core_session_messages_waiting(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_dequeue_event")] public static extern int switch_core_session_dequeue_event(HandleRef jarg1, HandleRef jarg2, int jarg3); @@ -12242,6 +12303,18 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_set_realm")] public static extern int switch_ivr_dmachine_set_realm(HandleRef jarg1, string jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_get_file_handle")] + public static extern int switch_ivr_get_file_handle(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_release_file_handle")] + public static extern int switch_ivr_release_file_handle(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_process_fh")] + public static extern int switch_ivr_process_fh(HandleRef jarg1, string jarg2, HandleRef jarg3); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_insert_file")] + public static extern int switch_ivr_insert_file(HandleRef jarg1, string jarg2, string jarg3, HandleRef jarg4); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RTP_MAX_BUF_LEN_get")] public static extern int SWITCH_RTP_MAX_BUF_LEN_get(); @@ -17157,6 +17230,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_p_switch_file_handle { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_file_handle(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_file_handle() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_file_handle obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.1 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_p_switch_frame { private HandleRef swigCPtr; commit bc34a24d4c7a70f5b526252495a19ba5f3d2de86 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Nov 30 18:35:43 2010 -0600 get ready for ClueCon 11 diff --git a/build/Makefile.am b/build/Makefile.am index 4b426ef..1d57dad 100644 --- a/build/Makefile.am +++ b/build/Makefile.am @@ -6,8 +6,13 @@ all: @echo " + Install by running: +" @echo " + +" @echo " + $(MK) install +" + @echo " + +" + @echo " + While you're waiting, register for ClueCon! +" + @echo " + http://www.cluecon.com +" + @echo " + +" @echo " +-----------------------------------------------+" + install: @echo " +---------- FreeSWITCH install Complete ----------+" @echo " + FreeSWITCH has been successfully installed. +" commit 77a7f93d6799ebf7cfb433af7a78b2c7b6ace60d Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Nov 30 18:23:01 2010 -0600 reswig diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index f4bf780..a65d82d 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -28397,6 +28397,30 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_process_fh(void * jarg1, char * jar } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_insert_file(void * jarg1, char * jarg2, char * jarg3, void * jarg4) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + switch_size_t arg4 ; + switch_status_t result; + switch_size_t *argp4 ; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (char *)jarg3; + argp4 = (switch_size_t *)jarg4; + if (!argp4) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0); + return 0; + } + arg4 = *argp4; + result = (switch_status_t)switch_ivr_insert_file(arg1,(char const *)arg2,(char const *)arg3,arg4); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RTP_MAX_BUF_LEN_get() { int jresult ; int result; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index 10fd3c6..e024c58 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -4501,6 +4501,12 @@ public class freeswitch { return ret; } + public static switch_status_t switch_ivr_insert_file(SWIGTYPE_p_switch_core_session session, string file, string insert_file, SWIGTYPE_p_switch_size_t sample_point) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_insert_file(SWIGTYPE_p_switch_core_session.getCPtr(session), file, insert_file, SWIGTYPE_p_switch_size_t.getCPtr(sample_point)); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + public static switch_status_t switch_rtp_add_crypto_key(SWIGTYPE_p_switch_rtp rtp_session, switch_rtp_crypto_direction_t direction, uint index, switch_rtp_crypto_key_type_t type, SWIGTYPE_p_unsigned_char key, SWIGTYPE_p_switch_size_t keylen) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_add_crypto_key(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), (int)direction, index, (int)type, SWIGTYPE_p_unsigned_char.getCPtr(key), SWIGTYPE_p_switch_size_t.getCPtr(keylen)); if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); @@ -12292,6 +12298,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_process_fh")] public static extern int switch_ivr_process_fh(HandleRef jarg1, string jarg2, HandleRef jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_insert_file")] + public static extern int switch_ivr_insert_file(HandleRef jarg1, string jarg2, string jarg3, HandleRef jarg4); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RTP_MAX_BUF_LEN_get")] public static extern int SWITCH_RTP_MAX_BUF_LEN_get(); commit 82394b37687cb43ae3805d14a7ed9ca20da95a63 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Nov 30 18:22:12 2010 -0600 add switch_ivr_insert_file to insert one file into another at an arbitrary sample point diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index d277bd0..da366c5 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -878,6 +878,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_set_realm(switch_ivr_dmachin SWITCH_DECLARE(switch_status_t) switch_ivr_get_file_handle(switch_core_session_t *session, switch_file_handle_t **fh); SWITCH_DECLARE(switch_status_t) switch_ivr_release_file_handle(switch_core_session_t *session, switch_file_handle_t **fh); SWITCH_DECLARE(switch_status_t) switch_ivr_process_fh(switch_core_session_t *session, const char *cmd, switch_file_handle_t *fhp); +SWITCH_DECLARE(switch_status_t) switch_ivr_insert_file(switch_core_session_t *session, const char *file, const char *insert_file, switch_size_t sample_point); /** @} */ diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 00917ad..46ba4e6 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -2681,6 +2681,162 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_process_fh(switch_core_session_t *ses } +#define START_SAMPLES 32768 + +SWITCH_DECLARE(switch_status_t) switch_ivr_insert_file(switch_core_session_t *session, const char *file, const char *insert_file, switch_size_t sample_point) +{ + switch_file_handle_t orig_fh = { 0 }; + switch_file_handle_t new_fh = { 0 }; + switch_codec_implementation_t read_impl = { 0 }; + char *tmp_file; + switch_uuid_t uuid; + char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1]; + int16_t *abuf = NULL; + switch_size_t olen = 0; + int asis = 0; + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_size_t sample_count = 0; + uint32_t pos = 0; + char *ext; + + switch_uuid_get(&uuid); + switch_uuid_format(uuid_str, &uuid); + + if ((ext = strrchr(file, '.'))) { + ext++; + } else { + ext = "wav"; + } + + tmp_file = switch_core_session_sprintf(session, "%s%smsg_%s.%s", + SWITCH_GLOBAL_dirs.temp_dir, SWITCH_PATH_SEPARATOR, uuid_str, ext); + + switch_core_session_get_read_impl(session, &read_impl); + + new_fh.channels = read_impl.number_of_channels; + new_fh.native_rate = read_impl.actual_samples_per_second; + + + if (switch_core_file_open(&new_fh, + tmp_file, + new_fh.channels, + read_impl.actual_samples_per_second, SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to open file %s\n", tmp_file); + goto end; + } + + + if (switch_core_file_open(&orig_fh, + file, + new_fh.channels, + read_impl.actual_samples_per_second, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to open file %s\n", file); + goto end; + } + + + switch_zmalloc(abuf, START_SAMPLES * sizeof(*abuf)); + + if (switch_test_flag((&orig_fh), SWITCH_FILE_NATIVE)) { + asis = 1; + } + + while (switch_channel_ready(channel)) { + olen = START_SAMPLES; + + if (!asis) { + olen /= 2; + } + + if ((sample_count + olen) > sample_point) { + olen = sample_point - sample_count; + } + + if (!olen || switch_core_file_read(&orig_fh, abuf, &olen) != SWITCH_STATUS_SUCCESS || !olen) { + break; + } + + sample_count += olen; + + switch_core_file_write(&new_fh, abuf, &olen); + } + + switch_core_file_close(&orig_fh); + + + if (switch_core_file_open(&orig_fh, + insert_file, + new_fh.channels, + read_impl.actual_samples_per_second, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to open file %s\n", file); + goto end; + } + + + while (switch_channel_ready(channel)) { + olen = START_SAMPLES; + + if (!asis) { + olen /= 2; + } + + if (switch_core_file_read(&orig_fh, abuf, &olen) != SWITCH_STATUS_SUCCESS || !olen) { + break; + } + + sample_count += olen; + + switch_core_file_write(&new_fh, abuf, &olen); + } + + switch_core_file_close(&orig_fh); + + if (switch_core_file_open(&orig_fh, + file, + new_fh.channels, + read_impl.actual_samples_per_second, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to open file %s\n", file); + goto end; + } + + pos = 0; + switch_core_file_seek(&orig_fh, &pos, sample_point, SEEK_SET); + + while (switch_channel_ready(channel)) { + olen = START_SAMPLES; + + if (!asis) { + olen /= 2; + } + + if (switch_core_file_read(&orig_fh, abuf, &olen) != SWITCH_STATUS_SUCCESS || !olen) { + break; + } + + sample_count += olen; + + switch_core_file_write(&new_fh, abuf, &olen); + } + + end: + + if (switch_test_flag((&orig_fh), SWITCH_FILE_OPEN)) { + switch_core_file_close(&orig_fh); + } + + if (switch_test_flag((&new_fh), SWITCH_FILE_OPEN)) { + switch_core_file_close(&new_fh); + } + + switch_file_rename(tmp_file, file, switch_core_session_get_pool(session)); + unlink(tmp_file); + + switch_safe_free(abuf); + + return SWITCH_STATUS_SUCCESS; +} + + /* For Emacs: * Local Variables: commit a669f76f786e2a74d3621cf5d4f9b0ad30d7e89a Author: Brian West <brian@freeswitch.org> Date: Tue Nov 30 17:38:44 2010 -0600 Fix issue when fs_path is used so we pick the correct media IP in our outbound invite this was soemthing that wouldn't work correctly over ATT on the iphone. diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 3bb926a..74c4c08 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3900,7 +3900,26 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session switch_channel_set_variable_printf(nchannel, "sip_local_network_addr", "%s", profile->extsipip ? profile->extsipip : profile->sipip); switch_channel_set_variable(nchannel, "sip_profile_name", profile_name); - switch_split_user_domain(switch_core_session_strdup(nsession, tech_pvt->dest), NULL, &tech_pvt->remote_ip); + if (switch_stristr("fs_path", tech_pvt->dest)) { + char *remote_host = NULL; + const char *s; + + if ((s = switch_stristr("fs_path=", tech_pvt->dest))) { + s += 8; + } + + if (s) { + remote_host = switch_core_session_strdup(nsession, s); + switch_url_decode(remote_host); + } + if (!zstr(remote_host)) { + switch_split_user_domain(remote_host, NULL, &tech_pvt->remote_ip); + } + } + + if (zstr(tech_pvt->remote_ip)) { + switch_split_user_domain(switch_core_session_strdup(nsession, tech_pvt->dest), NULL, &tech_pvt->remote_ip); + } if (dest_to) { if (strchr(dest_to, '@')) { commit 35ba58e64994efa0a2c97a08b5164a5ea9f20679 Author: David Yat Sin <dyatsin@sangoma.com> Date: Tue Nov 30 16:45:05 2010 -0500 freetdm - ISDN:Fix for windows compilation issues diff --git a/libs/freetdm/src/ftdm_call_utils.c b/libs/freetdm/src/ftdm_call_utils.c index 52d2557..69f2fb4 100644 --- a/libs/freetdm/src/ftdm_call_utils.c +++ b/libs/freetdm/src/ftdm_call_utils.c @@ -38,7 +38,7 @@ FT_DECLARE(ftdm_status_t) ftdm_set_npi(const char *string, uint8_t *target) { - int val; + uint8_t val; ftdm_status_t status = FTDM_SUCCESS; val = ftdm_str2ftdm_npi(string); @@ -53,7 +53,7 @@ FT_DECLARE(ftdm_status_t) ftdm_set_npi(const char *string, uint8_t *target) FT_DECLARE(ftdm_status_t) ftdm_set_ton(const char *string, uint8_t *target) { - int val; + uint8_t val; ftdm_status_t status = FTDM_SUCCESS; val = ftdm_str2ftdm_ton(string); @@ -68,7 +68,7 @@ FT_DECLARE(ftdm_status_t) ftdm_set_ton(const char *string, uint8_t *target) FT_DECLARE(ftdm_status_t) ftdm_set_bearer_capability(const char *string, uint8_t *target) { - int val; + uint8_t val; ftdm_status_t status = FTDM_SUCCESS; val = ftdm_str2ftdm_bearer_cap(string); @@ -84,7 +84,7 @@ FT_DECLARE(ftdm_status_t) ftdm_set_bearer_capability(const char *string, uint8_t FT_DECLARE(ftdm_status_t) ftdm_set_bearer_layer1(const char *string, uint8_t *target) { - int val; + uint8_t val; ftdm_status_t status = FTDM_SUCCESS; val = ftdm_str2ftdm_usr_layer1_prot(string); @@ -100,7 +100,7 @@ FT_DECLARE(ftdm_status_t) ftdm_set_bearer_layer1(const char *string, uint8_t *ta FT_DECLARE(ftdm_status_t) ftdm_set_screening_ind(const char *string, uint8_t *target) { - int val; + uint8_t val; ftdm_status_t status = FTDM_SUCCESS; val = ftdm_str2ftdm_screening(string); @@ -116,7 +116,7 @@ FT_DECLARE(ftdm_status_t) ftdm_set_screening_ind(const char *string, uint8_t *ta FT_DECLARE(ftdm_status_t) ftdm_set_presentation_ind(const char *string, uint8_t *target) { - int val; + uint8_t val; ftdm_status_t status = FTDM_SUCCESS; val = ftdm_str2ftdm_presentation(string); diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index bcaa15a..5ba7e38 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -38,8 +38,6 @@ */ #define _GNU_SOURCE -#ifndef WIN32 -#endif #include "private/ftdm_core.h" #include <stdarg.h> #ifdef WIN32 diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 02927d7..03b5a5f 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -799,9 +799,7 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) break; case FTDM_CHANNEL_STATE_DOWN: /* the call is finished and removed */ { - uint8_t glare = 0; - - glare = sngisdn_test_flag(sngisdn_info, FLAG_GLARE); + uint8_t glare = sngisdn_test_flag(sngisdn_info, FLAG_GLARE); /* clear all of the call specific data store in the channel structure */ clear_call_data(sngisdn_info); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 9cddecb..b9ab339 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -64,6 +64,33 @@ /* TODO: rename all *_cc_* to *_an_* */ +#define SNGISDN_ENUM_NAMES(_NAME, _STRINGS) static const char * _NAME [] = { _STRINGS , NULL }; +#define SNGISDN_STR2ENUM_P(_FUNC1, _FUNC2, _TYPE) _TYPE _FUNC1 (const char *name); const char * _FUNC2 (_TYPE type); +#define SNGISDN_STR2ENUM(_FUNC1, _FUNC2, _TYPE, _STRINGS, _MAX) \ + _TYPE _FUNC1 (const char *name) \ +{ \ + int i; \ + _TYPE t = _MAX ; \ + \ + for (i = 0; i < _MAX ; i++) { \ + if (!strcasecmp(name, _STRINGS[i])) { \ + t = (_TYPE) i; \ + break; \ +} \ +} \ + \ + return t; \ +} \ + const char * _FUNC2 (_TYPE type) \ +{ \ + if (type > _MAX) { \ + type = _MAX; \ +} \ + return _STRINGS[(int)type]; \ +} \ + + + typedef enum { FLAG_RESET_RX = (1 << 0), FLAG_RESET_TX = (1 << 1), @@ -153,7 +180,7 @@ typedef enum { SNGISDN_PROGIND_DESCR_INVALID, } ftdm_sngisdn_progind_descr_t; #define SNGISDN_PROGIND_DESCR_STRINGS "not-end-to-end-isdn", "destination-is-non-isdn", "origination-is-non-isdn", "call-returned-to-isdn", "service-change", "inband-info-available", "invalid" -FTDM_STR2ENUM_P(ftdm_str2ftdm_sngisdn_progind_descr, ftdm_sngisdn_progind_descr2str, ftdm_sngisdn_progind_descr_t); +SNGISDN_STR2ENUM_P(ftdm_str2ftdm_sngisdn_progind_descr, ftdm_sngisdn_progind_descr2str, ftdm_sngisdn_progind_descr_t); typedef enum { /* User */ @@ -174,7 +201,7 @@ typedef enum { SNGISDN_PROGIND_LOC_INVALID, } ftdm_sngisdn_progind_loc_t; #define SNGISDN_PROGIND_LOC_STRINGS "user", "private-net-local-user", "public-net-local-user", "transit-network", "public-net-remote-user", "private-net-remote-user", "beyond-interworking", "invalid" -FTDM_STR2ENUM_P(ftdm_str2ftdm_sngisdn_progind_loc, ftdm_sngisdn_progind_loc2str, ftdm_sngisdn_progind_loc_t); +SNGISDN_STR2ENUM_P(ftdm_str2ftdm_sngisdn_progind_loc, ftdm_sngisdn_progind_loc2str, ftdm_sngisdn_progind_loc_t); typedef struct ftdm_sngisdn_prog_ind { ftdm_sngisdn_progind_loc_t loc; /* location */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index c4e9f4a..d557ca3 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -255,10 +255,9 @@ void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event) uint8_t ces = sngisdn_event->ces; sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - CnStEvnt *cnStEvnt = &sngisdn_event->event.cnStEvnt; + + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n"); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 964d06c..42bcd1e 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -37,11 +37,11 @@ /* ftmod_sangoma_isdn specific enum look-up functions */ -FTDM_ENUM_NAMES(SNGISDN_PROGIND_DESCR_NAMES, SNGISDN_PROGIND_DESCR_STRINGS) -FTDM_STR2ENUM(ftdm_str2ftdm_sngisdn_progind_descr, ftdm_sngisdn_progind_descr2str, ftdm_sngisdn_progind_descr_t, SNGISDN_PROGIND_DESCR_NAMES, SNGISDN_PROGIND_DESCR_INVALID) +SNGISDN_ENUM_NAMES(SNGISDN_PROGIND_DESCR_NAMES, SNGISDN_PROGIND_DESCR_STRINGS) +SNGISDN_STR2ENUM(ftdm_str2ftdm_sngisdn_progind_descr, ftdm_sngisdn_progind_descr2str, ftdm_sngisdn_progind_descr_t, SNGISDN_PROGIND_DESCR_NAMES, SNGISDN_PROGIND_DESCR_INVALID) -FTDM_ENUM_NAMES(SNGISDN_PROGIND_LOC_NAMES, SNGISDN_PROGIND_LOC_STRINGS) -FTDM_STR2ENUM(ftdm_str2ftdm_sngisdn_progind_loc, ftdm_sngisdn_progind_loc2str, ftdm_sngisdn_progind_loc_t, SNGISDN_PROGIND_LOC_NAMES, SNGISDN_PROGIND_LOC_INVALID) +SNGISDN_ENUM_NAMES(SNGISDN_PROGIND_LOC_NAMES, SNGISDN_PROGIND_LOC_STRINGS) +SNGISDN_STR2ENUM(ftdm_str2ftdm_sngisdn_progind_loc, ftdm_sngisdn_progind_loc2str, ftdm_sngisdn_progind_loc_t, SNGISDN_PROGIND_LOC_NAMES, SNGISDN_PROGIND_LOC_INVALID) ftdm_status_t sngisdn_check_free_ids(void); commit b6d024eae617ac8fbc6330eda26435e2823f8d34 Merge: 086245a a1d6596 Author: Moises Silva <moy@sangoma.com> Date: Tue Nov 30 17:22:57 2010 -0500 Merge remote branch 'origin/master' commit 086245a70103f87fc16eb294e23738cca95b1817 Author: Moises Silva <moy@sangoma.com> Date: Tue Nov 30 17:21:48 2010 -0500 freetdm: do not skip states if FREETDM_SKIP_SIG_STATES is not defined diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index cffd982..bcaa15a 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2051,10 +2051,10 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_answer(const char *file, const char goto done; } -#if 0 - /* DAVIDY - We will fail RFC's if we do that, but some modules apart from ftmod_sangoma_isdn +#ifndef FREETDM_SKIP_SIG_STATES + /* We will fail RFC's if we not skip states, but some modules apart from ftmod_sangoma_isdn * expect the call to always to go PROGRESS and PROGRESS MEDIA state before going to UP, so - * remove this only in netborder branch for now */ + * remove this only in netborder branch for now while we update the sig modules */ if (ftdmchan->state < FTDM_CHANNEL_STATE_PROGRESS) { ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS, 1); commit a1d6596ea627285828e5425282c60052c4a88b27 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Nov 30 15:50:15 2010 -0600 swigall diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index d2f63b1..f4bf780 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -6744,6 +6744,42 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_destroy() { } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_io_read_lock(void * jarg1) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + result = (switch_status_t)switch_core_session_io_read_lock(arg1); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_io_write_lock(void * jarg1) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + result = (switch_status_t)switch_core_session_io_write_lock(arg1); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_io_rwunlock(void * jarg1) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + result = (switch_status_t)switch_core_session_io_rwunlock(arg1); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_read_lock(void * jarg1) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; @@ -28317,6 +28353,50 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_set_realm(void * jarg1, ch } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_get_file_handle(void * jarg1, void * jarg2) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_file_handle_t **arg2 = (switch_file_handle_t **) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (switch_file_handle_t **)jarg2; + result = (switch_status_t)switch_ivr_get_file_handle(arg1,arg2); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_release_file_handle(void * jarg1, void * jarg2) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_file_handle_t **arg2 = (switch_file_handle_t **) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (switch_file_handle_t **)jarg2; + result = (switch_status_t)switch_ivr_release_file_handle(arg1,arg2); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_process_fh(void * jarg1, char * jarg2, void * jarg3) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_file_handle_t *arg3 = (switch_file_handle_t *) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (switch_file_handle_t *)jarg3; + result = (switch_status_t)switch_ivr_process_fh(arg1,(char const *)arg2,arg3); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RTP_MAX_BUF_LEN_get() { int jresult ; int result; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index fd4915f..10fd3c6 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -1103,6 +1103,21 @@ public class freeswitch { return ret; } + public static switch_status_t switch_core_session_io_read_lock(SWIGTYPE_p_switch_core_session session) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_io_read_lock(SWIGTYPE_p_switch_core_session.getCPtr(session)); + return ret; + } + + public static switch_status_t switch_core_session_io_write_lock(SWIGTYPE_p_switch_core_session session) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_io_write_lock(SWIGTYPE_p_switch_core_session.getCPtr(session)); + return ret; + } + + public static switch_status_t switch_core_session_io_rwunlock(SWIGTYPE_p_switch_core_session session) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_io_rwunlock(SWIGTYPE_p_switch_core_session.getCPtr(session)); + return ret; + } + public static switch_status_t switch_core_session_read_lock(SWIGTYPE_p_switch_core_session session) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_read_lock(SWIGTYPE_p_switch_core_session.getCPtr(session)); return ret; @@ -4471,6 +4486,21 @@ public class freeswitch { return ret; } + public static switch_status_t switch_ivr_get_file_handle(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_file_handle fh) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_get_file_handle(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_file_handle.getCPtr(fh)); + return ret; + } + + public static switch_status_t switch_ivr_release_file_handle(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_file_handle fh) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_release_file_handle(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_file_handle.getCPtr(fh)); + return ret; + } + + public static switch_status_t switch_ivr_process_fh(SWIGTYPE_p_switch_core_session session, string cmd, switch_file_handle fhp) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_process_fh(SWIGTYPE_p_switch_core_session.getCPtr(session), cmd, switch_file_handle.getCPtr(fhp)); + return ret; + } + public static switch_status_t switch_rtp_add_crypto_key(SWIGTYPE_p_switch_rtp rtp_session, switch_rtp_crypto_direction_t direction, uint index, switch_rtp_crypto_key_type_t type, SWIGTYPE_p_unsigned_char key, SWIGTYPE_p_switch_size_t keylen) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_add_crypto_key(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), (int)direction, index, (int)type, SWIGTYPE_p_unsigned_char.getCPtr(key), SWIGTYPE_p_switch_size_t.getCPtr(keylen)); if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); @@ -7255,6 +7285,15 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_destroy")] public static extern int switch_core_destroy(); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_io_read_lock")] + public static extern int switch_core_session_io_read_lock(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_io_write_lock")] + public static extern int switch_core_session_io_write_lock(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_io_rwunlock")] + public static extern int switch_core_session_io_rwunlock(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_read_lock")] public static extern int switch_core_session_read_lock(HandleRef jarg1); @@ -12244,6 +12283,15 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_set_realm")] public static extern int switch_ivr_dmachine_set_realm(HandleRef jarg1, string jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_get_file_handle")] + public static extern int switch_ivr_get_file_handle(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_release_file_handle")] + public static extern int switch_ivr_release_file_handle(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_process_fh")] + public static extern int switch_ivr_process_fh(HandleRef jarg1, string jarg2, HandleRef jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RTP_MAX_BUF_LEN_get")] public static extern int SWITCH_RTP_MAX_BUF_LEN_get(); @@ -17119,6 +17167,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_p_switch_file_handle { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_file_handle(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_file_handle() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_file_handle obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_p_switch_frame { private HandleRef swigCPtr; diff --git a/src/mod/languages/mod_perl/mod_perl_wrap.cpp b/src/mod/languages/mod_perl/mod_perl_wrap.cpp index 370c88b..2efbdf1 100644 --- a/src/mod/languages/mod_perl/mod_perl_wrap.cpp +++ b/src/mod/languages/mod_perl/mod_perl_wrap.cpp @@ -9732,17 +9732,17 @@ XS(SWIG_init) { SWIG_TypeClientData(SWIGTYPE_p_IVRMenu, (void*) "freeswitch::IVRMenu"); SWIG_TypeClientData(SWIGTYPE_p_API, (void*) "freeswitch::API"); SWIG_TypeClientData(SWIGTYPE_p_input_callback_state, (void*) "freeswitch::input_callback_state_t"); - /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_HUP", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_HUP))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; - /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_FREE", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_FREE))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; - /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_RDLOCK", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_RDLOCK))); SvREADONLY_on(sv); commit f0d15785924faa8a3de2fd9c3105a274e73b748b Author: David Yat Sin <dyatsin@sangoma.com> Date: Tue Nov 30 16:45:05 2010 -0500 freetdm - ISDN:Fix for windows compilation issues diff --git a/libs/freetdm/src/ftdm_call_utils.c b/libs/freetdm/src/ftdm_call_utils.c index 52d2557..69f2fb4 100644 --- a/libs/freetdm/src/ftdm_call_utils.c +++ b/libs/freetdm/src/ftdm_call_utils.c @@ -38,7 +38,7 @@ FT_DECLARE(ftdm_status_t) ftdm_set_npi(const char *string, uint8_t *target) { - int val; + uint8_t val; ftdm_status_t status = FTDM_SUCCESS; val = ftdm_str2ftdm_npi(string); @@ -53,7 +53,7 @@ FT_DECLARE(ftdm_status_t) ftdm_set_npi(const char *string, uint8_t *target) FT_DECLARE(ftdm_status_t) ftdm_set_ton(const char *string, uint8_t *target) { - int val; + uint8_t val; ftdm_status_t status = FTDM_SUCCESS; val = ftdm_str2ftdm_ton(string); @@ -68,7 +68,7 @@ FT_DECLARE(ftdm_status_t) ftdm_set_ton(const char *string, uint8_t *target) FT_DECLARE(ftdm_status_t) ftdm_set_bearer_capability(const char *string, uint8_t *target) { - int val; + uint8_t val; ftdm_status_t status = FTDM_SUCCESS; val = ftdm_str2ftdm_bearer_cap(string); @@ -84,7 +84,7 @@ FT_DECLARE(ftdm_status_t) ftdm_set_bearer_capability(const char *string, uint8_t FT_DECLARE(ftdm_status_t) ftdm_set_bearer_layer1(const char *string, uint8_t *target) { - int val; + uint8_t val; ftdm_status_t status = FTDM_SUCCESS; val = ftdm_str2ftdm_usr_layer1_prot(string); @@ -100,7 +100,7 @@ FT_DECLARE(ftdm_status_t) ftdm_set_bearer_layer1(const char *string, uint8_t *ta FT_DECLARE(ftdm_status_t) ftdm_set_screening_ind(const char *string, uint8_t *target) { - int val; + uint8_t val; ftdm_status_t status = FTDM_SUCCESS; val = ftdm_str2ftdm_screening(string); @@ -116,7 +116,7 @@ FT_DECLARE(ftdm_status_t) ftdm_set_screening_ind(const char *string, uint8_t *ta FT_DECLARE(ftdm_status_t) ftdm_set_presentation_ind(const char *string, uint8_t *target) { - int val; + uint8_t val; ftdm_status_t status = FTDM_SUCCESS; val = ftdm_str2ftdm_presentation(string); diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 33f987c..528e983 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -38,8 +38,6 @@ */ #define _GNU_SOURCE -#ifndef WIN32 -#endif #include "private/ftdm_core.h" #include <stdarg.h> #ifdef WIN32 diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 02927d7..03b5a5f 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -799,9 +799,7 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) break; case FTDM_CHANNEL_STATE_DOWN: /* the call is finished and removed */ { - uint8_t glare = 0; - - glare = sngisdn_test_flag(sngisdn_info, FLAG_GLARE); + uint8_t glare = sngisdn_test_flag(sngisdn_info, FLAG_GLARE); /* clear all of the call specific data store in the channel structure */ clear_call_data(sngisdn_info); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 6957f99..eb00b1f 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -64,6 +64,33 @@ /* TODO: rename all *_cc_* to *_an_* */ +#define SNGISDN_ENUM_NAMES(_NAME, _STRINGS) static const char * _NAME [] = { _STRINGS , NULL }; +#define SNGISDN_STR2ENUM_P(_FUNC1, _FUNC2, _TYPE) _TYPE _FUNC1 (const char *name); const char * _FUNC2 (_TYPE type); +#define SNGISDN_STR2ENUM(_FUNC1, _FUNC2, _TYPE, _STRINGS, _MAX) \ + _TYPE _FUNC1 (const char *name) \ +{ \ + int i; \ + _TYPE t = _MAX ; \ + \ + for (i = 0; i < _MAX ; i++) { \ + if (!strcasecmp(name, _STRINGS[i])) { \ + t = (_TYPE) i; \ + break; \ +} \ +} \ + \ + return t; \ +} \ + const char * _FUNC2 (_TYPE type) \ +{ \ + if (type > _MAX) { \ + type = _MAX; \ +} \ + return _STRINGS[(int)type]; \ +} \ + + + typedef enum { FLAG_RESET_RX = (1 << 0), FLAG_RESET_TX = (1 << 1), @@ -153,7 +180,7 @@ typedef enum { SNGISDN_PROGIND_DESCR_INVALID, } ftdm_sngisdn_progind_descr_t; #define SNGISDN_PROGIND_DESCR_STRINGS "not-end-to-end-isdn", "destination-is-non-isdn", "origination-is-non-isdn", "call-returned-to-isdn", "service-change", "inband-info-available", "invalid" -FTDM_STR2ENUM_P(ftdm_str2ftdm_sngisdn_progind_descr, ftdm_sngisdn_progind_descr2str, ftdm_sngisdn_progind_descr_t); +SNGISDN_STR2ENUM_P(ftdm_str2ftdm_sngisdn_progind_descr, ftdm_sngisdn_progind_descr2str, ftdm_sngisdn_progind_descr_t); typedef enum { /* User */ @@ -174,7 +201,7 @@ typedef enum { SNGISDN_PROGIND_LOC_INVALID, } ftdm_sngisdn_progind_loc_t; #define SNGISDN_PROGIND_LOC_STRINGS "user", "private-net-local-user", "public-net-local-user", "transit-network", "public-net-remote-user", "private-net-remote-user", "beyond-interworking", "invalid" -FTDM_STR2ENUM_P(ftdm_str2ftdm_sngisdn_progind_loc, ftdm_sngisdn_progind_loc2str, ftdm_sngisdn_progind_loc_t); +SNGISDN_STR2ENUM_P(ftdm_str2ftdm_sngisdn_progind_loc, ftdm_sngisdn_progind_loc2str, ftdm_sngisdn_progind_loc_t); typedef struct ftdm_sngisdn_prog_ind { ftdm_sngisdn_progind_loc_t loc; /* location */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 865f498..a7c111e 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -255,10 +255,9 @@ void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event) uint8_t ces = sngisdn_event->ces; sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; - - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - CnStEvnt *cnStEvnt = &sngisdn_event->event.cnStEvnt; + + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n"); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 964d06c..42bcd1e 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -37,11 +37,11 @@ /* ftmod_sangoma_isdn specific enum look-up functions */ -FTDM_ENUM_NAMES(SNGISDN_PROGIND_DESCR_NAMES, SNGISDN_PROGIND_DESCR_STRINGS) -FTDM_STR2ENUM(ftdm_str2ftdm_sngisdn_progind_descr, ftdm_sngisdn_progind_descr2str, ftdm_sngisdn_progind_descr_t, SNGISDN_PROGIND_DESCR_NAMES, SNGISDN_PROGIND_DESCR_INVALID) +SNGISDN_ENUM_NAMES(SNGISDN_PROGIND_DESCR_NAMES, SNGISDN_PROGIND_DESCR_STRINGS) +SNGISDN_STR2ENUM(ftdm_str2ftdm_sngisdn_progind_descr, ftdm_sngisdn_progind_descr2str, ftdm_sngisdn_progind_descr_t, SNGISDN_PROGIND_DESCR_NAMES, SNGISDN_PROGIND_DESCR_INVALID) -FTDM_ENUM_NAMES(SNGISDN_PROGIND_LOC_NAMES, SNGISDN_PROGIND_LOC_STRINGS) -FTDM_STR2ENUM(ftdm_str2ftdm_sngisdn_progind_loc, ftdm_sngisdn_progind_loc2str, ftdm_sngisdn_progind_loc_t, SNGISDN_PROGIND_LOC_NAMES, SNGISDN_PROGIND_LOC_INVALID) +SNGISDN_ENUM_NAMES(SNGISDN_PROGIND_LOC_NAMES, SNGISDN_PROGIND_LOC_STRINGS) +SNGISDN_STR2ENUM(ftdm_str2ftdm_sngisdn_progind_loc, ftdm_sngisdn_progind_loc2str, ftdm_sngisdn_progind_loc_t, SNGISDN_PROGIND_LOC_NAMES, SNGISDN_PROGIND_LOC_INVALID) ftdm_status_t sngisdn_check_free_ids(void); commit 15b5170b14396e1e17b6f75a3da01695cb49eff3 Author: Moises Silva <moy@sangoma.com> Date: Tue Nov 30 16:42:58 2010 -0500 freetdm: ftmod_libpri - add support for RINGING state diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 07d4e88..b5c8b84 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -841,9 +841,9 @@ static switch_status_t channel_receive_message_b(switch_core_session_t *session, assert(tech_pvt != NULL); if (switch_test_flag(tech_pvt, TFLAG_DEAD)) { - switch_channel_hangup(channel, SWITCH_CAUSE_LOSE_RACE); - return SWITCH_STATUS_FALSE; - } + switch_channel_hangup(channel, SWITCH_CAUSE_LOSE_RACE); + return SWITCH_STATUS_FALSE; + } if (ftdm_channel_call_check_hangup(tech_pvt->ftdmchan)) { return SWITCH_STATUS_SUCCESS; @@ -888,9 +888,9 @@ static switch_status_t channel_receive_message_fxo(switch_core_session_t *sessio assert(tech_pvt != NULL); if (switch_test_flag(tech_pvt, TFLAG_DEAD)) { - switch_channel_hangup(channel, SWITCH_CAUSE_LOSE_RACE); - return SWITCH_STATUS_FALSE; - } + switch_channel_hangup(channel, SWITCH_CAUSE_LOSE_RACE); + return SWITCH_STATUS_FALSE; + } if (switch_channel_test_flag(channel, CF_OUTBOUND)) { return SWITCH_STATUS_SUCCESS; diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index c8e8652..68f0e9e 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -462,7 +462,7 @@ static ftdm_state_map_t isdn_state_map = { ZSD_INBOUND, ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_RING, FTDM_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_END} + {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_END} }, { ZSD_INBOUND, @@ -479,7 +479,7 @@ static ftdm_state_map_t isdn_state_map = { { ZSD_INBOUND, ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_END}, + {FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_END}, {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_CANCEL, FTDM_CHANNEL_STATE_UP, FTDM_END}, }, @@ -537,6 +537,8 @@ static __inline__ void state_advance(ftdm_channel_t *chan) break; case FTDM_CHANNEL_STATE_PROGRESS: + /* RINGING is an alias for PROGRESS state in inbound calls ATM */ + case FTDM_CHANNEL_STATE_RINGING: { if (ftdm_test_flag(chan, FTDM_CHANNEL_OUTBOUND)) { sig.event_id = FTDM_SIGEVENT_PROGRESS; commit c4369fc84dc00348169f0e7adc9a0169d864ac96 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Nov 30 15:34:22 2010 -0600 add uuid_fileman <uuid> <cmd>:<val> <-- same vals as the callbacks in js and lua to control the currently playing file of a channel from the cli or ESL (for the people who were ignoring me on the conference call so I decided to implement it instead of try to explain it ) diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index 3df9001..13410a0 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -135,6 +135,7 @@ struct switch_core_session { switch_mutex_t *frame_read_mutex; switch_thread_rwlock_t *rwlock; + switch_thread_rwlock_t *io_rwlock; void *streams[SWITCH_MAX_STREAMS]; int stream_count; diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 33df7e3..840a06c 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -354,6 +354,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_destroy(void); ///\ingroup core1 ///\{ + +SWITCH_DECLARE(switch_status_t) switch_core_session_io_read_lock(switch_core_session_t *session); +SWITCH_DECLARE(switch_status_t) switch_core_session_io_write_lock(switch_core_session_t *session); +SWITCH_DECLARE(switch_status_t) switch_core_session_io_rwunlock(switch_core_session_t *session); + #ifdef SWITCH_DEBUG_RWLOCKS SWITCH_DECLARE(switch_status_t) switch_core_session_perform_read_lock(_In_ switch_core_session_t *session, const char *file, const char *func, int line); #endif diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index 249ac63..d277bd0 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -874,6 +874,11 @@ SWITCH_DECLARE(void) switch_ivr_dmachine_set_input_timeout_ms(switch_ivr_dmachin SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_clear_realm(switch_ivr_dmachine_t *dmachine, const char *realm); SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_set_realm(switch_ivr_dmachine_t *dmachine, const char *realm); + +SWITCH_DECLARE(switch_status_t) switch_ivr_get_file_handle(switch_core_session_t *session, switch_file_handle_t **fh); +SWITCH_DECLARE(switch_status_t) switch_ivr_release_file_handle(switch_core_session_t *session, switch_file_handle_t **fh); +SWITCH_DECLARE(switch_status_t) switch_ivr_process_fh(switch_core_session_t *session, const char *cmd, switch_file_handle_t *fhp); + /** @} */ SWITCH_END_EXTERN_C diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index ba4b6d3..c7edfd5 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -3968,6 +3968,47 @@ SWITCH_STANDARD_API(uuid_getvar_function) return SWITCH_STATUS_SUCCESS; } + +#define FILEMAN_SYNTAX "<uuid> <cmd>:<val>" +SWITCH_STANDARD_API(uuid_fileman_function) +{ + switch_core_session_t *psession = NULL; + char *mycmd = NULL, *argv[4] = { 0 }; + int argc = 0; + + if (!zstr(cmd) && (mycmd = strdup(cmd))) { + argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + if (argc >= 2 && !zstr(argv[0])) { + char *uuid = argv[0]; + char *cmd = argv[1]; + + if ((psession = switch_core_session_locate(uuid))) { + switch_channel_t *channel; + switch_file_handle_t *fh = NULL; + + channel = switch_core_session_get_channel(psession); + + if (switch_ivr_get_file_handle(psession, &fh) == SWITCH_STATUS_SUCCESS) { + switch_ivr_process_fh(psession, cmd, fh); + switch_ivr_release_file_handle(psession, &fh); + } + + switch_core_session_rwunlock(psession); + + } else { + stream->write_function(stream, "-ERR No Such Channel!\n"); + } + goto done; + } + } + + stream->write_function(stream, "-USAGE: %s\n", GETVAR_SYNTAX); + + done: + switch_safe_free(mycmd); + return SWITCH_STATUS_SUCCESS; +} + #define UUID_SEND_DTMF_SYNTAX "<uuid> <dtmf_data>" SWITCH_STANDARD_API(uuid_send_dtmf_function) { @@ -4674,6 +4715,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) SWITCH_ADD_API(commands_api_interface, "uuid_display", "change display", uuid_display_function, DISPLAY_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_dump", "uuid_dump", uuid_dump_function, DUMP_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_exists", "see if a uuid exists", uuid_exists_function, EXISTS_SYNTAX); + SWITCH_ADD_API(commands_api_interface, "uuid_fileman", "uuid_fileman", uuid_fileman_function, FILEMAN_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_flush_dtmf", "Flush dtmf on a given uuid", uuid_flush_dtmf_function, "<uuid>"); SWITCH_ADD_API(commands_api_interface, "uuid_getvar", "uuid_getvar", uuid_getvar_function, GETVAR_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_hold", "hold", uuid_hold_function, HOLD_SYNTAX); @@ -4785,6 +4827,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) switch_console_set_complete("add uuid_display ::console::list_uuid"); switch_console_set_complete("add uuid_dump ::console::list_uuid"); switch_console_set_complete("add uuid_exists ::console::list_uuid"); + switch_console_set_complete("add uuid_fileman ::console::list_uuid"); switch_console_set_complete("add uuid_flush_dtmf ::console::list_uuid"); switch_console_set_complete("add uuid_getvar ::console::list_uuid"); switch_console_set_complete("add uuid_hold ::console::list_uuid"); diff --git a/src/switch_core_rwlock.c b/src/switch_core_rwlock.c index 4285491..57168d9 100644 --- a/src/switch_core_rwlock.c +++ b/src/switch_core_rwlock.c @@ -36,6 +36,46 @@ #include "private/switch_core_pvt.h" +SWITCH_DECLARE(switch_status_t) switch_core_session_io_read_lock(switch_core_session_t *session) +{ + switch_status_t status = SWITCH_STATUS_FALSE; + + if (session->io_rwlock) { + if (switch_thread_rwlock_tryrdlock(session->io_rwlock) == SWITCH_STATUS_SUCCESS) { + status = SWITCH_STATUS_SUCCESS; + } + } + + return status; +} + +SWITCH_DECLARE(switch_status_t) switch_core_session_io_write_lock(switch_core_session_t *session) +{ + switch_status_t status = SWITCH_STATUS_FALSE; + + if (session->io_rwlock) { + switch_thread_rwlock_wrlock(session->io_rwlock); + status = SWITCH_STATUS_SUCCESS; + } + + return status; +} + + +SWITCH_DECLARE(switch_status_t) switch_core_session_io_rwunlock(switch_core_session_t *session) +{ + switch_status_t status = SWITCH_STATUS_FALSE; + + if (session->io_rwlock) { + switch_thread_rwlock_unlock(session->io_rwlock); + status = SWITCH_STATUS_SUCCESS; + } + + return status; +} + + + #ifdef SWITCH_DEBUG_RWLOCKS SWITCH_DECLARE(switch_status_t) switch_core_session_perform_read_lock(switch_core_session_t *session, const char *file, const char *func, int line) #else diff --git a/src/switch_core_session.c b/src/switch_core_session.c index a84bfab..fc76481 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -1667,6 +1667,7 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(switch_ switch_thread_rwlock_create(&session->bug_rwlock, session->pool); switch_thread_cond_create(&session->cond, session->pool); switch_thread_rwlock_create(&session->rwlock, session->pool); + switch_thread_rwlock_create(&session->io_rwlock, session->pool); switch_queue_create(&session->message_queue, SWITCH_MESSAGE_QUEUE_LEN, session->pool); switch_queue_create(&session->event_queue, SWITCH_EVENT_QUEUE_LEN, session->pool); switch_queue_create(&session->private_event_queue, SWITCH_EVENT_QUEUE_LEN, session->pool); diff --git a/src/switch_cpp.cpp b/src/switch_cpp.cpp index 469ae18..40462db 100644 --- a/src/switch_cpp.cpp +++ b/src/switch_cpp.cpp @@ -1269,120 +1269,7 @@ SWITCH_DECLARE(switch_status_t) CoreSession::process_callback_result(char *resul this_check(SWITCH_STATUS_FALSE); sanity_check(SWITCH_STATUS_FALSE); - if (zstr(result)) { - return SWITCH_STATUS_SUCCESS; - } - - if (fhp) { - if (!switch_test_flag(fhp, SWITCH_FILE_OPEN)) { - return SWITCH_STATUS_FALSE; - } - - if (!strncasecmp(result, "speed", 5)) { - char *p; - - if ((p = strchr(result, ':'))) { - p++; - if (*p == '+' || *p == '-') { - int step; - if (!(step = atoi(p))) { - step = 1; - } - fhp->speed += step; - } else { - int speed = atoi(p); - fhp->speed = speed; - } - return SWITCH_STATUS_SUCCESS; - } - - return SWITCH_STATUS_FALSE; - - } else if (!strncasecmp(result, "volume", 6)) { - char *p; - - if ((p = strchr(result, ':'))) { - p++; - if (*p == '+' || *p == '-') { - int step; - if (!(step = atoi(p))) { - step = 1; - } - fhp->vol += step; - } else { - int vol = atoi(p); - fhp->vol = vol; - } - return SWITCH_STATUS_SUCCESS; - } - - if (fhp->vol) { - switch_normalize_volume(fhp->vol); - } - - return SWITCH_STATUS_FALSE; - } else if (!strcasecmp(result, "pause")) { - if (switch_test_flag(fhp, SWITCH_FILE_PAUSE)) { - switch_clear_flag(fhp, SWITCH_FILE_PAUSE); - } else { - switch_set_flag(fhp, SWITCH_FILE_PAUSE); - } - return SWITCH_STATUS_SUCCESS; - } else if (!strcasecmp(result, "stop")) { - return SWITCH_STATUS_FALSE; - } else if (!strcasecmp(result, "truncate")) { - switch_core_file_truncate(fhp, 0); - } else if (!strcasecmp(result, "restart")) { - unsigned int pos = 0; - fhp->speed = 0; - switch_core_file_seek(fhp, &pos, 0, SEEK_SET); - return SWITCH_STATUS_SUCCESS; - } else if (!strncasecmp(result, "seek", 4)) { - switch_codec_t *codec; - unsigned int samps = 0; - unsigned int pos = 0; - char *p; - codec = switch_core_session_get_read_codec(session); - - if ((p = strchr(result, ':'))) { - p++; - if (*p == '+' || *p == '-') { - int step; - int32_t target; - if (!(step = atoi(p))) { - step = 1000; - } - - samps = step * (codec->implementation->samples_per_second / 1000); - target = (int32_t)fhp->pos + samps; - - if (target < 0) { - target = 0; - } - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "seek to position %d\n", target); - switch_core_file_seek(fhp, &pos, target, SEEK_SET); - - } else { - samps = atoi(p) * (codec->implementation->samples_per_second / 1000); - if (samps < 0) { - samps = 0; - } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "seek to position %d\n", samps); - switch_core_file_seek(fhp, &pos, samps, SEEK_SET); - } - } - - return SWITCH_STATUS_SUCCESS; - } - } - - if (!strcmp(result, "true") || !strcmp(result, "undefined")) { - return SWITCH_STATUS_SUCCESS; - } - - - return SWITCH_STATUS_FALSE; + return switch_ivr_process_fh(session, result, fhp); } /* For Emacs: diff --git a/src/switch_ivr.c b/src/switch_ivr.c index df88451..00917ad 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -2563,6 +2563,124 @@ SWITCH_DECLARE(switch_bool_t) switch_ivr_uuid_exists(const char *uuid) return exists; } +SWITCH_DECLARE(switch_status_t) switch_ivr_process_fh(switch_core_session_t *session, const char *cmd, switch_file_handle_t *fhp) +{ + if (zstr(cmd)) { + return SWITCH_STATUS_SUCCESS; + } + + if (fhp) { + if (!switch_test_flag(fhp, SWITCH_FILE_OPEN)) { + return SWITCH_STATUS_FALSE; + } + + if (!strncasecmp(cmd, "speed", 5)) { + char *p; + + if ((p = strchr(cmd, ':'))) { + p++; + if (*p == '+' || *p == '-') { + int step; + if (!(step = atoi(p))) { + step = 1; + } + fhp->speed += step; + } else { + int speed = atoi(p); + fhp->speed = speed; + } + return SWITCH_STATUS_SUCCESS; + } + + return SWITCH_STATUS_FALSE; + + } else if (!strncasecmp(cmd, "volume", 6)) { + char *p; + + if ((p = strchr(cmd, ':'))) { + p++; + if (*p == '+' || *p == '-') { + int step; + if (!(step = atoi(p))) { + step = 1; + } + fhp->vol += step; + } else { + int vol = atoi(p); + fhp->vol = vol; + } + return SWITCH_STATUS_SUCCESS; + } + + if (fhp->vol) { + switch_normalize_volume(fhp->vol); + } + + return SWITCH_STATUS_FALSE; + } else if (!strcasecmp(cmd, "pause")) { + if (switch_test_flag(fhp, SWITCH_FILE_PAUSE)) { + switch_clear_flag(fhp, SWITCH_FILE_PAUSE); + } else { + switch_set_flag(fhp, SWITCH_FILE_PAUSE); + } + return SWITCH_STATUS_SUCCESS; + } else if (!strcasecmp(cmd, "stop")) { + return SWITCH_STATUS_FALSE; + } else if (!strcasecmp(cmd, "truncate")) { + switch_core_file_truncate(fhp, 0); + } else if (!strcasecmp(cmd, "restart")) { + unsigned int pos = 0; + fhp->speed = 0; + switch_core_file_seek(fhp, &pos, 0, SEEK_SET); + return SWITCH_STATUS_SUCCESS; + } else if (!strncasecmp(cmd, "seek", 4)) { + switch_codec_t *codec; + unsigned int samps = 0; + unsigned int pos = 0; + char *p; + codec = switch_core_session_get_read_codec(session); + + if ((p = strchr(cmd, ':'))) { + p++; + if (*p == '+' || *p == '-') { + int step; + int32_t target; + if (!(step = atoi(p))) { + step = 1000; + } + + samps = step * (codec->implementation->samples_per_second / 1000); + target = (int32_t)fhp->pos + samps; + + if (target < 0) { + target = 0; + } + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "seek to position %d\n", target); + switch_core_file_seek(fhp, &pos, target, SEEK_SET); + + } else { + samps = atoi(p) * (codec->implementation->samples_per_second / 1000); + if (samps < 0) { + samps = 0; + } + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "seek to position %d\n", samps); + switch_core_file_seek(fhp, &pos, samps, SEEK_SET); + } + } + + return SWITCH_STATUS_SUCCESS; + } + } + + if (!strcmp(cmd, "true") || !strcmp(cmd, "undefined")) { + return SWITCH_STATUS_SUCCESS; + } + + return SWITCH_STATUS_FALSE; + +} + /* For Emacs: * Local Variables: diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 7285b89..3c8fa5e 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -913,6 +913,31 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *sessi return SWITCH_STATUS_SUCCESS; } +SWITCH_DECLARE(switch_status_t) switch_ivr_get_file_handle(switch_core_session_t *session, switch_file_handle_t **fh) +{ + switch_file_handle_t *fhp; + switch_channel_t *channel = switch_core_session_get_channel(session); + + *fh = NULL; + switch_core_session_io_read_lock(session); + + if ((fhp = switch_channel_get_private(channel, "__fh"))) { + *fh = fhp; + return SWITCH_STATUS_SUCCESS; + } + + switch_core_session_io_rwunlock(session); + + return SWITCH_STATUS_FALSE; +} + +SWITCH_DECLARE(switch_status_t) switch_ivr_release_file_handle(switch_core_session_t *session, switch_file_handle_t **fh) +{ + *fh = NULL; + switch_core_session_io_rwunlock(session); + + return SWITCH_STATUS_SUCCESS; +} #define FILE_STARTSAMPLES 1024 * 32 #define FILE_BLOCKSIZE 1024 * 8 @@ -994,6 +1019,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess } + + if (play_delimiter) { file_dup = switch_core_session_strdup(session, file); argc = switch_separate_string(file_dup, play_delimiter, argv, (sizeof(argv) / sizeof(argv[0]))); @@ -1134,6 +1161,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess status = SWITCH_STATUS_NOTFOUND; continue; } + + switch_core_session_io_write_lock(session); + switch_channel_set_private(channel, "__fh", fh); + switch_core_session_io_rwunlock(session); + if (switch_test_flag(fh, SWITCH_FILE_NATIVE)) { asis = 1; } @@ -1208,7 +1240,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Raw Codec Activation Failed %s@%uhz %u channels %dms\n", codec_name, fh->samplerate, fh->channels, interval); + switch_core_session_io_write_lock(session); + switch_channel_set_private(channel, "__fh", NULL); + switch_core_session_io_rwunlock(session); + switch_core_file_close(fh); + switch_core_session_reset(session, SWITCH_TRUE, SWITCH_FALSE); status = SWITCH_STATUS_GENERR; continue; @@ -1228,6 +1265,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess if (switch_core_timer_init(&timer, timer_name, interval, samples, pool) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Setup timer failed!\n"); switch_core_codec_destroy(&codec); + switch_core_session_io_write_lock(session); + switch_channel_set_private(channel, "__fh", NULL); + switch_core_session_io_rwunlock(session); switch_core_file_close(fh); switch_core_session_reset(session, SWITCH_TRUE, SWITCH_FALSE); status = SWITCH_STATUS_GENERR; @@ -1538,6 +1578,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess } switch_channel_set_variable_printf(channel, "playback_samples", "%d", fh->samples_out); + switch_core_session_io_write_lock(session); + switch_channel_set_private(channel, "__fh", NULL); + switch_core_session_io_rwunlock(session); + switch_core_file_close(fh); if (fh->audio_buffer) { commit 3d9ed976cd7fada0b0dc89cc3bff84c7d11a4419 Merge: 4fb2c5c cefedc0 Author: Moises Silva <moy@sangoma.com> Date: Tue Nov 30 13:32:09 2010 -0500 Merge remote branch 'smgfs/master' commit cefedc0da9a8248cbebde655ecc73701d7cfcd1d Author: Moises Silva <moy@sangoma.com> Date: Tue Nov 30 13:30:37 2010 -0500 sync .sln file with mainstream, ppl stop blindly using git commit -a! diff --git a/Freeswitch.2008.sln b/Freeswitch.2008.sln index 4ffd66a..01a4cf4 100644 --- a/Freeswitch.2008.sln +++ b/Freeswitch.2008.sln @@ -36,6 +36,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Default", "Default", "{3B08FEFD-4D3D-4C16-BA94-EE83509E32A0}" ProjectSection(SolutionItems) = preProject conf\freeswitch.xml = conf\freeswitch.xml + conf\vars.xml = conf\vars.xml EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Release", "Release", "{7BFD517E-7F8F-4A40-A78E-8D3632738227}" @@ -56,6 +57,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Build System", "_Build Sys bootstrap.sh = bootstrap.sh build\buildlib.sh = build\buildlib.sh configure.in = configure.in + Makefile.am = Makefile.am build\modmake.rules.in = build\modmake.rules.in build\modules.conf.in = build\modules.conf.in libs\win32\util.vbs = libs\win32\util.vbs @@ -90,12 +92,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "autoload_configs", "autoloa conf\autoload_configs\limit.conf.xml = conf\autoload_configs\limit.conf.xml conf\autoload_configs\local_stream.conf.xml = conf\autoload_configs\local_stream.conf.xml conf\autoload_configs\logfile.conf.xml = conf\autoload_configs\logfile.conf.xml + conf\autoload_configs\modules.conf.xml = conf\autoload_configs\modules.conf.xml conf\autoload_configs\openmrcp.conf.xml = conf\autoload_configs\openmrcp.conf.xml conf\autoload_configs\portaudio.conf.xml = conf\autoload_configs\portaudio.conf.xml conf\autoload_configs\rss.conf.xml = conf\autoload_configs\rss.conf.xml conf\autoload_configs\sofia.conf.xml = conf\autoload_configs\sofia.conf.xml conf\autoload_configs\spidermonkey.conf.xml = conf\autoload_configs\spidermonkey.conf.xml + conf\autoload_configs\switch.conf.xml = conf\autoload_configs\switch.conf.xml conf\autoload_configs\syslog.conf.xml = conf\autoload_configs\syslog.conf.xml + conf\autoload_configs\voicemail.conf.xml = conf\autoload_configs\voicemail.conf.xml conf\autoload_configs\wanpipe.conf.xml = conf\autoload_configs\wanpipe.conf.xml conf\autoload_configs\woomera.conf.xml = conf\autoload_configs\woomera.conf.xml conf\autoload_configs\xml_cdr.conf.xml = conf\autoload_configs\xml_cdr.conf.xml @@ -106,6 +111,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "autoload_configs", "autoloa EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dialplan", "dialplan", "{C7E2382E-2C22-4D18-BF93-80C6A1FFA7AC}" ProjectSection(SolutionItems) = preProject + conf\dialplan\default.xml = conf\dialplan\default.xml conf\dialplan\public.xml = conf\dialplan\public.xml EndProjectSection EndProject @@ -117,6 +123,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sip_profiles", "sip_profiles", "{8E2E8798-8B6F-4A55-8E4F-4E6FDE40ED26}" ProjectSection(SolutionItems) = preProject conf\sip_profiles\external.xml = conf\sip_profiles\external.xml + conf\sip_profiles\internal.xml = conf\sip_profiles\internal.xml conf\sip_profiles\nat.xml = conf\sip_profiles\nat.xml EndProjectSection EndProject @@ -301,6 +308,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "autoload_configs", "autoloa EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dialplan", "dialplan", "{23874F4B-C0AF-4587-9F7E-DB0F06DE8CB4}" + ProjectSection(SolutionItems) = preProject + conf\dialplan\default.xml = conf\dialplan\default.xml + EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "directory", "directory", "{19ED97F6-30D8-4FCE-AE1D-8B7FCB170D40}" ProjectSection(SolutionItems) = preProject @@ -1261,15 +1271,15 @@ Global {89385C74-5860-4174-9CAF-A39E7C48909C}.Release|Win32.Build.0 = Release|Win32 {89385C74-5860-4174-9CAF-A39E7C48909C}.Release|x64.ActiveCfg = Release|x64 {89385C74-5860-4174-9CAF-A39E7C48909C}.Release|x64.Build.0 = Release|x64 - {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|Win32.ActiveCfg = Release|Win32 - {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|Win32.Build.0 = Release|Win32 - {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|x64.ActiveCfg = Release|Win32 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|Win32.ActiveCfg = Release|x64 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|x64.ActiveCfg = Release|x64 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|x64.Build.0 = Release|x64 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|Win32.ActiveCfg = Debug|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|Win32.Build.0 = Debug|Win32 - {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|x64.ActiveCfg = Debug|Win32 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|x64.ActiveCfg = Debug|x64 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|Win32.ActiveCfg = Release|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|Win32.Build.0 = Release|Win32 - {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|x64.ActiveCfg = Release|Win32 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|x64.ActiveCfg = Release|x64 {692F6330-4D87-4C82-81DF-40DB5892636E}.All|Win32.ActiveCfg = Release|x64 {692F6330-4D87-4C82-81DF-40DB5892636E}.All|x64.ActiveCfg = Release|x64 {692F6330-4D87-4C82-81DF-40DB5892636E}.All|x64.Build.0 = Release|x64 commit 4fb2c5ca666692bd25428ba0210562808cc4ab47 Merge: 93ab7fa 1f329ad Author: Moises Silva <moy@sangoma.com> Date: Tue Nov 30 13:29:21 2010 -0500 Merge remote branch 'smgfs/master' commit 1f329ad521926c5af22a710a7e473daec0177f3e Author: Moises Silva <moy@sangoma.com> Date: Tue Nov 30 13:28:14 2010 -0500 set the right configs in sync with mainstream diff --git a/conf/autoload_configs/callcenter.conf.xml b/conf/autoload_configs/callcenter.conf.xml index 9140193..a069413 100644 --- a/conf/autoload_configs/callcenter.conf.xml +++ b/conf/autoload_configs/callcenter.conf.xml @@ -13,6 +13,7 @@ <param name="time-base-score" value="system"/> <param name="max-wait-time" value="0"/> <param name="max-wait-time-with-no-agent" value="0"/> + <param name="max-wait-time-with-no-agent-time-reached" value="5"/> <param name="tier-rules-apply" value="false"/> <param name="tier-rule-wait-second" value="300"/> <param name="tier-rule-wait-multiply-level" value="true"/> diff --git a/conf/autoload_configs/erlang_event.conf.xml b/conf/autoload_configs/erlang_event.conf.xml index ec14e21..62deb84 100644 --- a/conf/autoload_configs/erlang_event.conf.xml +++ b/conf/autoload_configs/erlang_event.conf.xml @@ -2,7 +2,16 @@ <settings> <param name="listen-ip" value="0.0.0.0"/> <param name="listen-port" value="8031"/> + <!-- Specify the first part of the node name + (the host part after the @ will be autodetected) + OR pass a complete nodename to avoid autodetection + eg. freeswitch@example or freeswitch@example.com. + If you pass a complete node name, the 'shortname' parameter has no effect. --> + <param name="nodename" value="freeswitch"/> + <!-- Specify this OR 'cookie-file' or $HOME/.erlang.cookie will be read --> <param name="cookie" value="ClueCon"/> + <!-- Read a cookie from an arbitary erlang cookie file instead --> + <!--<param name="cookie-file" value="/tmp/erlang.cookie"/>--> <param name="shortname" value="true"/> <!-- in additon to cookie, optionally restrict by ACL --> <!--<param name="apply-inbound-acl" value="lan"/>--> diff --git a/conf/autoload_configs/modules.conf.xml b/conf/autoload_configs/modules.conf.xml index 90d66f5..f5627fe 100644 --- a/conf/autoload_configs/modules.conf.xml +++ b/conf/autoload_configs/modules.conf.xml @@ -1,17 +1,113 @@ <configuration name="modules.conf" description="Modules"> <modules> + <!-- Loggers (I'd load these first) --> <load module="mod_console"/> <load module="mod_logfile"/> + <!-- <load module="mod_syslog"/> --> + + <!--<load module="mod_yaml"/>--> + + <!-- Multi-Faceted --> + <!-- mod_enum is a dialplan interface, an application interface and an api command interface --> + <load module="mod_enum"/> + + <!-- XML Interfaces --> + <!-- <load module="mod_xml_rpc"/> --> + <!-- <load module="mod_xml_curl"/> --> + <!-- <load module="mod_xml_cdr"/> --> + + <!-- Event Handlers --> + <load module="mod_cdr_csv"/> + <!-- <load module="mod_event_multicast"/> --> <load module="mod_event_socket"/> + <!-- <load module="mod_zeroconf"/> --> + <!-- <load module="mod_erlang_event"/> --> + + <!-- Directory Interfaces --> + <!-- <load module="mod_ldap"/> --> + + <!-- Endpoints --> + <!-- <load module="mod_dingaling"/> --> + <!-- <load module="mod_portaudio"/> --> + <!-- <load module="mod_alsa"/> --> <load module="mod_sofia"/> + <load module="mod_loopback"/> + <!-- <load module="mod_woomera"/> --> + <!-- <load module="mod_freetdm"/> --> + <!-- <load module="mod_openzap"/> --> + <!-- <load module="mod_unicall"/> --> + <!-- <load module="mod_skinny"/> --> + + <!-- Applications --> <load module="mod_commands"/> + <load module="mod_conference"/> + <load module="mod_db"/> <load module="mod_dptools"/> <load module="mod_expr"/> + <load module="mod_fifo"/> + <load module="mod_hash"/> + <load module="mod_voicemail"/> + <!--<load module="mod_directory"/>--> + <!--<load module="mod_lcr"/>--> + <load module="mod_esf"/> + <load module="mod_fsv"/> + <load module="mod_cluechoo"/> + <load module="mod_valet_parking"/> + <!--<load module="mod_spy"/>--> + + <!-- SNOM Module --> + <!--<load module="mod_snom"/>--> + + <!-- Dialplan Interfaces --> + <!-- <load module="mod_dialplan_directory"/> --> <load module="mod_dialplan_xml"/> + <load module="mod_dialplan_asterisk"/> + + <!-- Codec Interfaces --> + <load module="mod_spandsp"/> + <load module="mod_g723_1"/> + <load module="mod_g729"/> + <load module="mod_amr"/> + <load module="mod_ilbc"/> + <load module="mod_speex"/> + <load module="mod_h26x"/> + <load module="mod_siren"/> + <!--<load module="mod_celt"/>--> + + <!-- File Format Interfaces --> <load module="mod_sndfile"/> <load module="mod_native_file"/> + <!--For icecast/mp3 streams/files--> + <!--<load module="mod_shout"/>--> + <!--For local streams (play all the files in a directory)--> + <load module="mod_local_stream"/> + <load module="mod_tone_stream"/> + <load module="mod_file_string"/> + + <!-- Timers --> + + <!-- Languages --> + <load module="mod_spidermonkey"/> + <!-- <load module="mod_perl"/> --> + <!-- <load module="mod_python"/> --> + <!-- <load module="mod_java"/> --> + <load module="mod_lua"/> + + <!-- ASR /TTS --> + <!-- <load module="mod_flite"/> --> + <!-- <load module="mod_pocketsphinx"/> --> + <!-- <load module="mod_cepstral"/> --> + <!-- <load module="mod_tts_commandline"/> --> + <!-- <load module="mod_rss"/> --> + + <!-- Say --> <load module="mod_say_en"/> + <load module="mod_say_ru"/> + <!-- <load module="mod_say_zh"/> --> + + <!-- Third party modules --> + <!--<load module="mod_nibblebill"/>--> </modules> </configuration> diff --git a/conf/autoload_configs/switch.conf.xml b/conf/autoload_configs/switch.conf.xml index 7a68a7f..896dd0e 100644 --- a/conf/autoload_configs/switch.conf.xml +++ b/conf/autoload_configs/switch.conf.xml @@ -15,6 +15,11 @@ <key name="12" value="version"/> </cli-keybindings> + <default-ptimes> + <!-- set this to overide the 20ms assumption of various codecs in the sdp with no ptime defined --> + <!--<codec name="G729" ptime="40"/>--> + </default-ptimes> + <settings> <!--Colorize the Console --> <param name="colorize-console" value="true"/> @@ -81,6 +86,7 @@ <!-- <param name="core-db-dsn" value="dsn:username:password" /> --> <!-- The system will create all the db schemas automatically, set this to false to avoid this behaviour--> <!--<param name="auto-create-schemas" value="true"/>--> + <!-- <param name="core-dbtype" value="MSSQL"/> --> </settings> </configuration> diff --git a/conf/autoload_configs/voicemail.conf.xml b/conf/autoload_configs/voicemail.conf.xml index 14ad98b..06bd6f6 100644 --- a/conf/autoload_configs/voicemail.conf.xml +++ b/conf/autoload_configs/voicemail.conf.xml @@ -33,9 +33,10 @@ <param name="ff-key" value="6"/> <param name="rew-key" value="4"/> <param name="skip-greet-key" value="#"/> - <!--<param name="previous-message-key" value=""/>--> - <!--<param name="next-message-key" value=""/>--> - <!--<param name="skip-info-key" value=""/>--> + <param name="previous-message-key" value="1"/>--> + <param name="next-message-key" value="3"/> + <param name="skip-info-key" value="*"/> + <param name="repeat-message-key" value="0"/> <param name="record-silence-threshold" value="200"/> <param name="record-silence-hits" value="2"/> <param name="web-template-file" value="web-vm.tpl"/> diff --git a/conf/sip_profiles/internal.xml b/conf/sip_profiles/internal.xml index 69b0d15..3e756a8 100644 --- a/conf/sip_profiles/internal.xml +++ b/conf/sip_profiles/internal.xml @@ -42,6 +42,26 @@ <!-- If you want FreeSWITCH to shutdown if this profile fails to load, uncomment the next line. --> <!-- <param name="shutdown-on-fail" value="true"/> --> <param name="sip-trace" value="no"/> + + <!-- + Sometimes, in extremely rare edge cases, the Sofia SIP stack may stop + responding. These options allow you to enable and control a watchdog + on the Sofia SIP stack so that if it stops responding for the + specified number of milliseconds, it will cause FreeSWITCH to shut + down immediately. This is useful if you run in an HA environment and + need to ensure automated recovery from such a condition. Note that if + your server is idle a lot, the watchdog may fire due to not receiving + any SIP messages. Thus, if you expect your system to be idle, you + should leave the watchdog disabled. It can be toggled on and off + through the FreeSWITCH CLI either on an individual profile basis or + globally for all profiles. So, if you run in an HA environment with a + master and slave, you should use the CLI to make sure the watchdog is + only enabled on the master. + --> + <param name="watchdog-enabled" value="no"/> + <param name="watchdog-step-timeout" value="30000"/> + <param name="watchdog-event-timeout" value="30000"/> + <param name="log-auth-failures" value="true"/> <param name="forward-unsolicited-mwi-notify" value="false"/> diff --git a/conf/skinny_profiles/internal.xml b/conf/skinny_profiles/internal.xml index 5feac1f..52da897 100644 --- a/conf/skinny_profiles/internal.xml +++ b/conf/skinny_profiles/internal.xml @@ -16,7 +16,7 @@ <soft-key-set-sets> <soft-key-set-set name="default"> <soft-key-set name="KeySetOnHook" value="SoftkeyNewcall,SoftkeyRedial"/> - <soft-key-set name="KeySetOffHook" value=",SoftkeyNewcall,SoftkeyEndcall"/> + <soft-key-set name="KeySetOffHook" value=",SoftkeyRedial,SoftkeyEndcall"/> <soft-key-set name="KeySetDigitsAfterDialingFirstDigit" value="SoftkeyBackspace,,SoftkeyEndcall"/> <soft-key-set name="KeySetConnected" value="SoftkeyEndcall,SoftkeyHold,SoftkeyNewcall,SoftkeyTransfer"/> <soft-key-set name="KeySetRingIn" value="SoftkeyAnswer,SoftkeyEndcall,SoftkeyNewcall"/> diff --git a/conf/vars.xml b/conf/vars.xml index c638a80..fced2ef 100644 --- a/conf/vars.xml +++ b/conf/vars.xml @@ -195,7 +195,7 @@ <!-- various debug and defaults --> <X-PRE-PROCESS cmd="set" data="call_debug=false"/> - <X-PRE-PROCESS cmd="set" data="console_loglevel=debug"/> + <X-PRE-PROCESS cmd="set" data="console_loglevel=info"/> <X-PRE-PROCESS cmd="set" data="default_areacode=918"/> <X-PRE-PROCESS cmd="set" data="default_country=US"/> commit 93ab7fa91e652f4b7018f6f82e878864a965622c Merge: 5b15e03 e3b070c Author: Moises Silva <moy@sangoma.com> Date: Tue Nov 30 13:25:01 2010 -0500 Merge remote branch 'smgfs/master' commit e3b070c88fa02406890b35e554f5c0ac1ad6aa36 Author: Moises Silva <moy@sangoma.com> Date: Tue Nov 30 13:21:47 2010 -0500 freetdm: ftmod_wanpipe - do not test 80% tx queue full diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index fbb827e..0ac628a 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -791,16 +791,7 @@ static void wanpipe_write_stats(ftdm_channel_t *ftdmchan, wp_tdm_api_tx_hdr_t *t ftdmchan->iostats.tx.queue_size = tx_stats->wp_api_tx_hdr_max_queue_length; ftdmchan->iostats.tx.queue_len = tx_stats->wp_api_tx_hdr_number_of_frames_in_queue; - if (ftdmchan->iostats.tx.queue_len >= (0.8 * ftdmchan->iostats.tx.queue_size)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Tx Queue length exceeded 80% threshold (%d/%d)\n", - ftdmchan->iostats.tx.queue_len, ftdmchan->iostats.tx.queue_size); - ftdm_set_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_THRES); - } else if (ftdm_test_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_THRES)){ - ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Tx Queue length reduced 80% threshold (%d/%d)\n", - ftdmchan->iostats.tx.queue_len, ftdmchan->iostats.tx.queue_size); - ftdm_clear_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_THRES); - } - + /* we don't test for 80% full in tx since is typically full for voice channels, should we test tx 80% full for D-channels? */ if (ftdmchan->iostats.tx.queue_len >= ftdmchan->iostats.tx.queue_size) { ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Tx Queue Full (%d/%d)\n", ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.tx.queue_size); commit 3caeb58533226ef42283e1709fa2d24295bfa3c9 Author: David Yat Sin <dyatsin@sangoma.com> Date: Tue Nov 30 13:17:48 2010 -0500 Changes to freetdm variables diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 27dc8d8..07d4e88 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -149,6 +149,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id); static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id); static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig); +static const char* channel_get_variable(switch_core_session_t *session, switch_event_t *var_event, const char *variable_name); ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session_t **sp); void dump_chan(ftdm_span_t *span, uint32_t chan_id, switch_stream_handle_t *stream); void dump_chan_xml(ftdm_span_t *span, uint32_t chan_id, switch_stream_handle_t *stream); @@ -1049,6 +1050,27 @@ switch_io_routines_t freetdm_io_routines = { /*.receive_message*/ channel_receive_message }; +static const char* channel_get_variable(switch_core_session_t *session, switch_event_t *var_event, const char *variable_name) +{ + const char *variable = NULL; + + if (var_event) { + if ((variable = switch_event_get_header(var_event, variable_name))) { + return variable; + } + } + if (session) { + switch_channel_t *channel = switch_core_session_get_channel(session); + if ((variable = switch_channel_get_variable(channel, variable_name))) { + return variable; + } + } + if ((variable = switch_core_get_variable(variable_name))) { + return variable; + } + return NULL; +} + /* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines that allocate memory or you will have 1 channel with memory allocated from another channel's pool! */ @@ -1226,20 +1248,6 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi } } - if (session) { - /* take out some other values from the session if they're present */ - switch_channel_t *channel = switch_core_session_get_channel(session); - const char *freetdmvar; - freetdmvar = switch_channel_get_variable(channel, "freetdm_bearer_capability"); - if (freetdmvar) { - caller_data.bearer_capability = (uint8_t)atoi(freetdmvar); - } - freetdmvar = switch_channel_get_variable(channel, "freetdm_bearer_layer1"); - if (freetdmvar) { - caller_data.bearer_layer1 = (uint8_t)atoi(freetdmvar); - } - } - if (switch_test_flag(outbound_profile, SWITCH_CPF_SCREEN)) { caller_data.screen = 1; } @@ -1248,29 +1256,37 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi caller_data.pres = 1; } - if (!zstr(dest)) { - ftdm_set_string(caller_data.dnis.digits, dest); + if ((var = channel_get_variable(session, var_event, "freetdm_bearer_capability"))) { + caller_data.bearer_capability = (uint8_t)atoi(var); } - if ((var = switch_event_get_header(var_event, "freetdm_outbound_ton")) || (var = switch_core_get_variable("freetdm_outbound_ton"))) { - if (!strcasecmp(var, "national")) { - caller_data.dnis.type = FTDM_TON_NATIONAL; - } else if (!strcasecmp(var, "international")) { - caller_data.dnis.type = FTDM_TON_INTERNATIONAL; - } else if (!strcasecmp(var, "local")) { - caller_data.dnis.type = FTDM_TON_SUBSCRIBER_NUMBER; - } else if (!strcasecmp(var, "unknown")) { - caller_data.dnis.type = FTDM_TON_UNKNOWN; - } + if ((var = channel_get_variable(session, var_event, "freetdm_bearer_layer1"))) { + caller_data.bearer_layer1 = (uint8_t)atoi(var); + } + + if ((var = channel_get_variable(session, var_event, "freetdm_screening_ind"))) { + ftdm_set_screening_ind(var, &caller_data.screen); + } + + if ((var = channel_get_variable(session, var_event, "freetdm_presentation_ind"))) { + ftdm_set_presentation_ind(var, &caller_data.pres); + } + + if ((var = channel_get_variable(session, var_event, "freetdm_outbound_ton"))) { + ftdm_set_ton(var, &caller_data.dnis.type); } else { caller_data.dnis.type = outbound_profile->destination_number_ton; } - if ((var = switch_event_get_header(var_event, "freetdm_custom_call_data")) || (var = switch_core_get_variable("freetdm_custom_call_data"))) { + if ((var = channel_get_variable(session, var_event, "freetdm_custom_call_data"))) { ftdm_set_string(caller_data.raw_data, var); caller_data.raw_data_len = (uint32_t)strlen(var); } + if (!zstr(dest)) { + ftdm_set_string(caller_data.dnis.digits, dest); + } + caller_data.dnis.plan = outbound_profile->destination_number_numplan; /* blindly copy data from outbound_profile. They will be overwritten @@ -2074,6 +2090,9 @@ static FIO_SIGNAL_CB_FUNCTION(on_clear_channel_signal) switch(sigmsg->event_id) { case FTDM_SIGEVENT_START: { + ftdm_channel_add_var(sigmsg->channel, "screening_ind", ftdm_screening2str(caller_data->screen)); + ftdm_channel_add_var(sigmsg->channel, "presentation_ind", ftdm_presentation2str(caller_data->pres)); + ftdm_enable_channel_dtmf(sigmsg->channel, NULL); return ftdm_channel_from_event(sigmsg, &session); } diff --git a/libs/freetdm/src/ftdm_call_utils.c b/libs/freetdm/src/ftdm_call_utils.c index d91b3bc..52d2557 100644 --- a/libs/freetdm/src/ftdm_call_utils.c +++ b/libs/freetdm/src/ftdm_call_utils.c @@ -36,80 +36,101 @@ #include <ctype.h> -FT_DECLARE(ftdm_status_t) ftdm_span_set_npi(const char *npi_string, uint8_t *target) +FT_DECLARE(ftdm_status_t) ftdm_set_npi(const char *string, uint8_t *target) { - if (!strcasecmp(npi_string, "isdn") || !strcasecmp(npi_string, "e164")) { - *target = FTDM_NPI_ISDN; - } else if (!strcasecmp(npi_string, "data")) { - *target = FTDM_NPI_DATA; - } else if (!strcasecmp(npi_string, "telex")) { - *target = FTDM_NPI_TELEX; - } else if (!strcasecmp(npi_string, "national")) { - *target = FTDM_NPI_NATIONAL; - } else if (!strcasecmp(npi_string, "private")) { - *target = FTDM_NPI_PRIVATE; - } else if (!strcasecmp(npi_string, "reserved")) { - *target = FTDM_NPI_RESERVED; - } else if (!strcasecmp(npi_string, "unknown")) { - *target = FTDM_NPI_UNKNOWN; - } else { - ftdm_log(FTDM_LOG_WARNING, "Invalid NPI value (%s)\n", npi_string); - *target = FTDM_NPI_UNKNOWN; - return FTDM_FAIL; + int val; + ftdm_status_t status = FTDM_SUCCESS; + + val = ftdm_str2ftdm_npi(string); + if (val == FTDM_NPI_INVALID) { + ftdm_log(FTDM_LOG_WARNING, "Invalid NPI string (%s)\n", string); + status = FTDM_FAIL; + val = FTDM_NPI_UNKNOWN; } - return FTDM_SUCCESS; + *target = val; + return status; } -FT_DECLARE(ftdm_status_t) ftdm_span_set_ton(const char *ton_string, uint8_t *target) +FT_DECLARE(ftdm_status_t) ftdm_set_ton(const char *string, uint8_t *target) { - if (!strcasecmp(ton_string, "national")) { - *target = FTDM_TON_NATIONAL; - } else if (!strcasecmp(ton_string, "international")) { - *target = FTDM_TON_INTERNATIONAL; - } else if (!strcasecmp(ton_string, "local")) { - *target = FTDM_TON_SUBSCRIBER_NUMBER; - } else if (!strcasecmp(ton_string, "unknown")) { - *target = FTDM_TON_UNKNOWN; - } else { - ftdm_log(FTDM_LOG_WARNING, "Invalid TON value (%s)\n", ton_string); - *target = FTDM_TON_UNKNOWN; - return FTDM_FAIL; + int val; + ftdm_status_t status = FTDM_SUCCESS; + + val = ftdm_str2ftdm_ton(string); + if (val == FTDM_TON_INVALID) { + ftdm_log(FTDM_LOG_WARNING, "Invalid TON string (%s)\n", string); + status = FTDM_FAIL; + val = FTDM_TON_UNKNOWN; } - return FTDM_SUCCESS; + *target = val; + return status; } -FT_DECLARE(ftdm_status_t) ftdm_span_set_bearer_capability(const char *bc_string, ftdm_bearer_cap_t *target) +FT_DECLARE(ftdm_status_t) ftdm_set_bearer_capability(const char *string, uint8_t *target) { - if (!strcasecmp(bc_string, "speech")) { - *target = FTDM_BEARER_CAP_SPEECH; - } else if (!strcasecmp(bc_string, "unrestricted-digital")) { - *target = FTDM_BEARER_CAP_64K_UNRESTRICTED; - } else if (!strcasecmp(bc_string, "3.1Khz")) { - *target = FTDM_BEARER_CAP_3_1KHZ_AUDIO; - } else { - ftdm_log(FTDM_LOG_WARNING, "Unsupported Bearer Capability value (%s)\n", bc_string); - return FTDM_FAIL; + int val; + ftdm_status_t status = FTDM_SUCCESS; + + val = ftdm_str2ftdm_bearer_cap(string); + if (val == FTDM_NPI_INVALID) { + ftdm_log(FTDM_LOG_WARNING, "Invalid Bearer-Capability string (%s)\n", string); + status = FTDM_FAIL; + val = FTDM_BEARER_CAP_SPEECH; } - return FTDM_SUCCESS; + + *target = val; + return status; } -FT_DECLARE(ftdm_status_t) ftdm_span_set_bearer_layer1(const char *bc_string, ftdm_user_layer1_prot_t *target) +FT_DECLARE(ftdm_status_t) ftdm_set_bearer_layer1(const char *string, uint8_t *target) { - if (!strcasecmp(bc_string, "v110")) { - *target = FTDM_USER_LAYER1_PROT_V110; - } else if (!strcasecmp(bc_string, "ulaw")) { - *target = FTDM_USER_LAYER1_PROT_ULAW; - } else if (!strcasecmp(bc_string, "alaw")) { - *target =FTDM_USER_LAYER1_PROT_ALAW ; - } else { - ftdm_log(FTDM_LOG_WARNING, "Unsupported Bearer Layer1 Prot value (%s)\n", bc_string); - return FTDM_FAIL; + int val; + ftdm_status_t status = FTDM_SUCCESS; + + val = ftdm_str2ftdm_usr_layer1_prot(string); + if (val == FTDM_USER_LAYER1_PROT_INVALID) { + ftdm_log(FTDM_LOG_WARNING, "Invalid Bearer Layer 1 Protocol string (%s)\n", string); + status = FTDM_FAIL; + val = FTDM_USER_LAYER1_PROT_ULAW; } - return FTDM_SUCCESS; + + *target = val; + return status; +} + +FT_DECLARE(ftdm_status_t) ftdm_set_screening_ind(const char *string, uint8_t *target) +{ + int val; + ftdm_status_t status = FTDM_SUCCESS; + + val = ftdm_str2ftdm_screening(string); + if (val == FTDM_SCREENING_INVALID) { + ftdm_log(FTDM_LOG_WARNING, "Invalid screening indicator string (%s)\n", string); + status = FTDM_FAIL; + val = FTDM_SCREENING_NOT_SCREENED; + } + + *target = val; + return status; } +FT_DECLARE(ftdm_status_t) ftdm_set_presentation_ind(const char *string, uint8_t *target) +{ + int val; + ftdm_status_t status = FTDM_SUCCESS; + + val = ftdm_str2ftdm_presentation(string); + if (val == FTDM_PRES_INVALID) { + ftdm_log(FTDM_LOG_WARNING, "Invalid presentation string (%s)\n", string); + status = FTDM_FAIL; + val = FTDM_PRES_ALLOWED; + } + + *target = val; + return status; +} -FT_DECLARE(ftdm_status_t) ftdm_is_number(char *number) +FT_DECLARE(ftdm_status_t) ftdm_is_number(const char *number) { if (!number) { return FTDM_FAIL; diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index ee3c4e6..33f987c 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -150,6 +150,24 @@ FTDM_STR2ENUM(ftdm_str2ftdm_chan_type, ftdm_chan_type2str, ftdm_chan_type_t, CHA FTDM_ENUM_NAMES(SIGNALING_STATUS_NAMES, SIGSTATUS_STRINGS) FTDM_STR2ENUM(ftdm_str2ftdm_signaling_status, ftdm_signaling_status2str, ftdm_signaling_status_t, SIGNALING_STATUS_NAMES, FTDM_SIG_STATE_INVALID) +FTDM_ENUM_NAMES(TON_NAMES, TON_STRINGS) +FTDM_STR2ENUM(ftdm_str2ftdm_ton, ftdm_ton2str, ftdm_ton_t, TON_NAMES, FTDM_TON_INVALID) + +FTDM_ENUM_NAMES(NPI_NAMES, NPI_STRINGS) +FTDM_STR2ENUM(ftdm_str2ftdm_npi, ftdm_npi2str, ftdm_npi_t, NPI_NAMES, FTDM_NPI_INVALID) + +FTDM_ENUM_NAMES(PRESENTATION_NAMES, PRESENTATION_STRINGS) +FTDM_STR2ENUM(ftdm_str2ftdm_presentation, ftdm_presentation2str, ftdm_presentation_t, PRESENTATION_NAMES, FTDM_PRES_INVALID) + +FTDM_ENUM_NAMES(SCREENING_NAMES, SCREENING_STRINGS) +FTDM_STR2ENUM(ftdm_str2ftdm_screening, ftdm_screening2str, ftdm_screening_t, SCREENING_NAMES, FTDM_SCREENING_INVALID) + +FTDM_ENUM_NAMES(BEARER_CAP_NAMES, BEARER_CAP_STRINGS) +FTDM_STR2ENUM(ftdm_str2ftdm_bearer_cap, ftdm_bearer_cap2str, ftdm_bearer_cap_t, BEARER_CAP_NAMES, FTDM_BEARER_CAP_INVALID) + +FTDM_ENUM_NAMES(USER_LAYER1_PROT_NAMES, USER_LAYER1_PROT_STRINGS) +FTDM_STR2ENUM(ftdm_str2ftdm_usr_layer1_prot, ftdm_user_layer1_prot2str, ftdm_user_layer1_prot_t, USER_LAYER1_PROT_NAMES, FTDM_USER_LAYER1_PROT_INVALID) + static ftdm_status_t ftdm_group_add_channels(ftdm_span_t* span, int currindex, const char* name); static const char *cut_path(const char *in) @@ -4875,7 +4893,7 @@ FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t if (sigmsg->channel) { ftdm_mutex_lock(sigmsg->channel->mutex); } - + /* some core things to do on special events */ switch (sigmsg->event_id) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftdm_sangoma_boost.h b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftdm_sangoma_boost.h index 5a3ca76..6fbf272 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftdm_sangoma_boost.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftdm_sangoma_boost.h @@ -58,7 +58,7 @@ typedef struct ftdm_sangoma_boost_trunkgroup { ftdm_size_t size; /* Number of b-channels in group */ unsigned int last_used_index; /* index of last b-channel used */ ftdm_channel_t* ftdmchans[MAX_CHANS_PER_TRUNKGROUP]; - //DAVIDY need to merge congestion timeouts to this struct + //TODO need to merge congestion timeouts to this struct } ftdm_sangoma_boost_trunkgroup_t; #endif diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c index c9691e2..50a01cc 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c @@ -55,7 +55,7 @@ ftdm_mutex_t *g_boost_modules_mutex = NULL; ftdm_hash_t *g_boost_modules_hash = NULL; #define MAX_TRUNK_GROUPS 64 -//DAVIDY need to merge congestion_timeouts with ftdm_sangoma_boost_trunkgroups +//TODO need to merge congestion_timeouts with ftdm_sangoma_boost_trunkgroups static time_t congestion_timeouts[MAX_TRUNK_GROUPS]; static ftdm_sangoma_boost_trunkgroup_t *g_trunkgroups[MAX_TRUNK_GROUPS]; @@ -2582,17 +2582,17 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_boost_configure_span) } else if (!strcasecmp(var, "remote_port")) { remote_port = atoi(val); } else if (!strcasecmp(var, "outbound-called-ton")) { - ftdm_span_set_ton(val, &span->default_caller_data.dnis.type); + ftdm_set_ton(val, &span->default_caller_data.dnis.type); } else if (!strcasecmp(var, "outbound-called-npi")) { - ftdm_span_set_npi(val, &span->default_caller_data.dnis.plan); + ftdm_set_npi(val, &span->default_caller_data.dnis.plan); } else if (!strcasecmp(var, "outbound-calling-ton")) { - ftdm_span_set_ton(val, &span->default_caller_data.cid_num.type); + ftdm_set_ton(val, &span->default_caller_data.cid_num.type); } else if (!strcasecmp(var, "outbound-calling-npi")) { - ftdm_span_set_npi(val, &span->default_caller_data.cid_num.plan); + ftdm_set_npi(val, &span->default_caller_data.cid_num.plan); } else if (!strcasecmp(var, "outbound-rdnis-ton")) { - ftdm_span_set_ton(val, &span->default_caller_data.rdnis.type); + ftdm_set_ton(val, &span->default_caller_data.rdnis.type); } else if (!strcasecmp(var, "outbound-rdnis-npi")) { - ftdm_span_set_npi(val, &span->default_caller_data.rdnis.plan); + ftdm_set_npi(val, &span->default_caller_data.rdnis.plan); } else if (!sigmod) { snprintf(span->last_error, sizeof(span->last_error), "Unknown parameter [%s]", var); FAIL_CONFIG_RETURN(FTDM_FAIL); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 9aa52f8..02927d7 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -40,8 +40,8 @@ #include <sys/mman.h> #endif -static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj); +static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj); static ftdm_status_t ftdm_sangoma_isdn_stop(ftdm_span_t *span); static ftdm_status_t ftdm_sangoma_isdn_start(ftdm_span_t *span); @@ -674,7 +674,8 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) break; case FTDM_CHANNEL_STATE_RINGING: { - sngisdn_snd_alert(ftdmchan, SNGISDN_PROGIND_NETE_ISDN); + ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_NETE_ISDN}; + sngisdn_snd_alert(ftdmchan, prog_ind); } break; case FTDM_CHANNEL_STATE_PROGRESS: @@ -688,7 +689,8 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) /* If we already sent a PROCEED before, do not send a PROGRESS as there is nothing to indicate to the remote switch */ if (ftdmchan->last_state != FTDM_CHANNEL_STATE_PROCEED) { /* Send a progress message, indicating: Call is not end-to-end ISDN, further call progress may be available */ - sngisdn_snd_progress(ftdmchan, SNGISDN_PROGIND_NETE_ISDN); + ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_NETE_ISDN}; + sngisdn_snd_progress(ftdmchan, prog_ind); } } } @@ -700,7 +702,8 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) ftdm_span_send_signal(ftdmchan->span, &sigev); } else { /* Send a progress message, indicating: In-band information/pattern available */ - sngisdn_snd_progress(ftdmchan, SNGISDN_PROGIND_IB_AVAIL); + ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_IB_AVAIL}; + sngisdn_snd_progress(ftdmchan, prog_ind); } } break; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index a82ed28..6957f99 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -138,17 +138,47 @@ typedef enum { typedef enum { /* Call is not end-to-end ISDN */ - SNGISDN_PROGIND_NETE_ISDN = 1, + SNGISDN_PROGIND_DESCR_NETE_ISDN, /* Destination address is non-ISDN */ - SNGISDN_PROGIND_DEST_NISDN, + SNGISDN_PROGIND_DESCR_DEST_NISDN, /* Origination address is non-ISDN */ - SNGISDN_PROGIND_ORIG_NISDN, + SNGISDN_PROGIND_DESCR_ORIG_NISDN, /* Call has returned to the ISDN */ - SNGISDN_PROGIND_RET_ISDN, + SNGISDN_PROGIND_DESCR_RET_ISDN, /* Interworking as occured and has resulted in a telecommunication service change */ - SNGISDN_PROGIND_SERV_CHANGE, - /* In-band information or an appropriate pattern is now available */ - SNGISDN_PROGIND_IB_AVAIL, + SNGISDN_PROGIND_DESCR_SERV_CHANGE, + /* In-band information or an appropriate pattern is now available */ + SNGISDN_PROGIND_DESCR_IB_AVAIL, + /* Invalid */ + SNGISDN_PROGIND_DESCR_INVALID, +} ftdm_sngisdn_progind_descr_t; +#define SNGISDN_PROGIND_DESCR_STRINGS "not-end-to-end-isdn", "destination-is-non-isdn", "origination-is-non-isdn", "call-returned-to-isdn", "service-change", "inband-info-available", "invalid" +FTDM_STR2ENUM_P(ftdm_str2ftdm_sngisdn_progind_descr, ftdm_sngisdn_progind_descr2str, ftdm_sngisdn_progind_descr_t); + +typedef enum { + /* User */ + SNGISDN_PROGIND_LOC_USER, + /* Private network serving the local user */ + SNGISDN_PROGIND_LOC_PRIV_NET_LOCAL_USR, + /* Public network serving the local user */ + SNGISDN_PROGIND_LOC_PUB_NET_LOCAL_USR, + /* Transit network */ + SNGISDN_PROGIND_LOC_TRANSIT_NET, + /* Public network serving remote user */ + SNGISDN_PROGIND_LOC_PUB_NET_REMOTE_USR, + /* Private network serving remote user */ + SNGISDN_PROGIND_LOC_PRIV_NET_REMOTE_USR, + /* Network beyond the interworking point */ + SNGISDN_PROGIND_LOC_NET_BEYOND_INTRW, + /* Invalid */ + SNGISDN_PROGIND_LOC_INVALID, +} ftdm_sngisdn_progind_loc_t; +#define SNGISDN_PROGIND_LOC_STRINGS "user", "private-net-local-user", "public-net-local-user", "transit-network", "public-net-remote-user", "private-net-remote-user", "beyond-interworking", "invalid" +FTDM_STR2ENUM_P(ftdm_str2ftdm_sngisdn_progind_loc, ftdm_sngisdn_progind_loc2str, ftdm_sngisdn_progind_loc_t); + +typedef struct ftdm_sngisdn_prog_ind { + ftdm_sngisdn_progind_loc_t loc; /* location */ + ftdm_sngisdn_progind_descr_t descr; /* description */ } ftdm_sngisdn_progind_t; /* Only timers that can be cancelled are listed here */ @@ -201,6 +231,7 @@ typedef struct sngisdn_span_data { uint8_t facility; int8_t facility_timeout; uint8_t num_local_numbers; + uint8_t ignore_cause_value; uint8_t timer_t3; char* local_numbers[SNGISDN_NUM_LOCAL_NUMBERS]; ftdm_sched_t *sched; @@ -376,18 +407,25 @@ void sngisdn_rcv_cc_ind(CcMngmt *status); void sngisdn_rcv_sng_log(uint8_t level, char *fmt,...); void sngisdn_rcv_sng_assert(char *message); -ftdm_status_t get_calling_num(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb); -ftdm_status_t get_called_num(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb); -ftdm_status_t get_redir_num(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb); -ftdm_status_t get_calling_name_from_display(ftdm_caller_data_t *ftdm, Display *display); -ftdm_status_t get_calling_name_from_usr_usr(ftdm_caller_data_t *ftdm, UsrUsr *usrUsr); -ftdm_status_t get_facility_ie(ftdm_caller_data_t *ftdm, uint8_t *data, uint32_t data_len); - -ftdm_status_t set_calling_num(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm); -ftdm_status_t set_called_num(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm); -ftdm_status_t set_redir_num(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm); -ftdm_status_t set_calling_name(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan); +ftdm_status_t get_calling_num(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb); +ftdm_status_t get_called_num(ftdm_channel_t *ftdmchan, CdPtyNmb *cdPtyNmb); +ftdm_status_t get_redir_num(ftdm_channel_t *ftdmchan, RedirNmb *redirNmb); +ftdm_status_t get_calling_name_from_display(ftdm_channel_t *ftdmchan, Display *display); +ftdm_status_t get_calling_name_from_usr_usr(ftdm_channel_t *ftdmchan, UsrUsr *usrUsr); +ftdm_status_t get_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad); +ftdm_status_t get_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd); +ftdm_status_t get_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr); +ftdm_status_t get_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, ftdm_size_t data_len); + +ftdm_status_t set_calling_num(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb); +ftdm_status_t set_called_num(ftdm_channel_t *ftdmchan, CdPtyNmb *cdPtyNmb); +ftdm_status_t set_redir_num(ftdm_channel_t *ftdmchan, RedirNmb *redirNmb); +ftdm_status_t set_calling_name(ftdm_channel_t *ftdmchan, ConEvnt *conEvnt); +ftdm_status_t set_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad); +ftdm_status_t set_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd, ftdm_sngisdn_progind_t prog_ind); ftdm_status_t set_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr); +ftdm_status_t set_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, ftdm_size_t *data_len); + uint8_t sngisdn_get_infoTranCap_from_stack(ftdm_bearer_cap_t bearer_capability); uint8_t sngisdn_get_usrInfoLyr1Prot_from_stack(ftdm_user_layer1_prot_t layer1_prot); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c index 657aa5e..6b4e73a 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c @@ -34,13 +34,24 @@ #include "ftmod_sangoma_isdn.h" -ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span); -ftdm_status_t parse_signalling(const char* signalling, ftdm_span_t *span); -ftdm_status_t add_local_number(const char* val, ftdm_span_t *span); +static ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span); +static ftdm_status_t parse_signalling(const char* signalling, ftdm_span_t *span); +static ftdm_status_t add_local_number(const char* val, ftdm_span_t *span); +static ftdm_status_t parse_yesno(const char* var, const char* val, uint8_t *target); extern ftdm_sngisdn_data_t g_sngisdn_data; -ftdm_status_t add_local_number(const char* val, ftdm_span_t *span) +static ftdm_status_t parse_yesno(const char* var, const char* val, uint8_t *target) +{ + if (ftdm_true(val)) { + *target = SNGISDN_OPT_TRUE; + } else { + *target = SNGISDN_OPT_FALSE; + } + return FTDM_SUCCESS; +} + +static ftdm_status_t add_local_number(const char* val, ftdm_span_t *span) { sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data; @@ -53,7 +64,7 @@ ftdm_status_t add_local_number(const char* val, ftdm_span_t *span) return FTDM_SUCCESS; } -ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span) +static ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span) { unsigned i; ftdm_iterator_t *chaniter = NULL; @@ -160,7 +171,7 @@ ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span) return FTDM_SUCCESS; } -ftdm_status_t parse_signalling(const char* signalling, ftdm_span_t *span) +static ftdm_status_t parse_signalling(const char* signalling, ftdm_span_t *span) { sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data; if (!strcasecmp(signalling, "net") || @@ -190,7 +201,8 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ signal_data->min_digits = 8; signal_data->overlap_dial = SNGISDN_OPT_DEFAULT; signal_data->setup_arb = SNGISDN_OPT_DEFAULT; - signal_data->facility_ie_decode = SNGISDN_OPT_TRUE; + signal_data->facility_ie_decode = SNGISDN_OPT_DEFAULT; + signal_data->ignore_cause_value = SNGISDN_OPT_DEFAULT; signal_data->timer_t3 = 8; signal_data->link_id = span->span_id; @@ -202,20 +214,19 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ if (span->trunk_type == FTDM_TRUNK_BRI || span->trunk_type == FTDM_TRUNK_BRI_PTMP) { - - ftdm_span_set_npi("unknown", &span->default_caller_data.dnis.plan); - ftdm_span_set_ton("unknown", &span->default_caller_data.dnis.type); - ftdm_span_set_npi("unknown", &span->default_caller_data.cid_num.plan); - ftdm_span_set_ton("unknown", &span->default_caller_data.cid_num.type); - ftdm_span_set_npi("unknown", &span->default_caller_data.rdnis.plan); - ftdm_span_set_ton("unknown", &span->default_caller_data.rdnis.type); + ftdm_set_npi("unknown", &span->default_caller_data.dnis.plan); + ftdm_set_ton("unknown", &span->default_caller_data.dnis.type); + ftdm_set_npi("unknown", &span->default_caller_data.cid_num.plan); + ftdm_set_ton("unknown", &span->default_caller_data.cid_num.type); + ftdm_set_npi("unknown", &span->default_caller_data.rdnis.plan); + ftdm_set_ton("unknown", &span->default_caller_data.rdnis.type); } else { - ftdm_span_set_npi("e164", &span->default_caller_data.dnis.plan); - ftdm_span_set_ton("national", &span->default_caller_data.dnis.type); - ftdm_span_set_npi("e164", &span->default_caller_data.cid_num.plan); - ftdm_span_set_ton("national", &span->default_caller_data.cid_num.type); - ftdm_span_set_npi("e164", &span->default_caller_data.rdnis.plan); - ftdm_span_set_ton("national", &span->default_caller_data.rdnis.type); + ftdm_set_npi("isdn", &span->default_caller_data.dnis.plan); + ftdm_set_ton("national", &span->default_caller_data.dnis.type); + ftdm_set_npi("isdn", &span->default_caller_data.cid_num.plan); + ftdm_set_ton("national", &span->default_caller_data.cid_num.type); + ftdm_set_npi("isdn", &span->default_caller_data.rdnis.plan); + ftdm_set_ton("national", &span->default_caller_data.rdnis.type); } for (paramindex = 0; ftdm_parameters[paramindex].var; paramindex++) { @@ -247,41 +258,29 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ } else { ftdm_log(FTDM_LOG_ERROR, "Invalid value for parameter:%s:%s\n", var, val); } - } else if (!strcasecmp(var, "setup arbitration")) { - if (!strcasecmp(val, "yes")) { - signal_data->setup_arb = SNGISDN_OPT_TRUE; - } else if (!strcasecmp(val, "no")) { - signal_data->setup_arb = SNGISDN_OPT_FALSE; - } else { - ftdm_log(FTDM_LOG_ERROR, "Invalid value for parameter:%s:%s\n", var, val); - } + } else if (!strcasecmp(var, "setup-arbitration")) { + parse_yesno(var, val, &signal_data->setup_arb); } else if (!strcasecmp(var, "facility")) { - if (!strcasecmp(val, "yes")) { - signal_data->facility = SNGISDN_OPT_TRUE; - } else if (!strcasecmp(val, "no")) { - signal_data->facility = SNGISDN_OPT_FALSE; - } else { - ftdm_log(FTDM_LOG_ERROR, "Invalid value for parameter:%s:%s\n", var, val); - } + parse_yesno(var, val, &signal_data->facility); } else if (!strcasecmp(var, "min_digits")) { signal_data->min_digits = atoi(val); } else if (!strcasecmp(var, "outbound-called-ton")) { - ftdm_span_set_ton(val, &span->default_caller_data.dnis.type); + ftdm_set_ton(val, &span->default_caller_data.dnis.type); } else if (!strcasecmp(var, "outbound-called-npi")) { - ftdm_span_set_npi(val, &span->default_caller_data.dnis.plan); + ftdm_set_npi(val, &span->default_caller_data.dnis.plan); } else if (!strcasecmp(var, "outbound-calling-ton")) { - ftdm_span_set_ton(val, &span->default_caller_data.cid_num.type); + ftdm_set_ton(val, &span->default_caller_data.cid_num.type); } else if (!strcasecmp(var, "outbound-calling-npi")) { - ftdm_span_set_npi(val, &span->default_caller_data.cid_num.plan); + ftdm_set_npi(val, &span->default_caller_data.cid_num.plan); } else if (!strcasecmp(var, "outbound-rdnis-ton")) { - ftdm_span_set_ton(val, &span->default_caller_data.rdnis.type); + ftdm_set_ton(val, &span->default_caller_data.rdnis.type); } else if (!strcasecmp(var, "outbound-rdnis-npi")) { - ftdm_span_set_npi(val, &span->default_caller_data.rdnis.plan); + ftdm_set_npi(val, &span->default_caller_data.rdnis.plan); } else if (!strcasecmp(var, "outbound-bearer_cap")) { - ftdm_span_set_bearer_capability(val, &span->default_caller_data.bearer_capability); + ftdm_set_bearer_capability(val, (uint8_t*)&span->default_caller_data.bearer_capability); } else if (!strcasecmp(var, "outbound-bearer_layer1")) { - ftdm_span_set_bearer_layer1(val, &span->default_caller_data.bearer_layer1); - } else if (!strcasecmp(var, "local-number")) { + ftdm_set_bearer_layer1(val, (uint8_t*)&span->default_caller_data.bearer_layer1); + } else if (!strcasecmp(var, "local-number")) { if (add_local_number(val, span) != FTDM_SUCCESS) { return FTDM_FAIL; } @@ -291,13 +290,9 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ signal_data->facility_timeout = 0; } } else if (!strcasecmp(var, "facility-ie-decode")) { - if (!strcasecmp(val, "yes")) { - signal_data->facility_ie_decode = SNGISDN_OPT_TRUE; - } else if (!strcasecmp(val, "no")) { - signal_data->facility_ie_decode = SNGISDN_OPT_FALSE; - } else { - ftdm_log(FTDM_LOG_ERROR, "Invalid value for parameter:%s:%s\n", var, val); - } + parse_yesno(var, val, &signal_data->facility_ie_decode); + } else if (!strcasecmp(var, "ignore-cause-value")) { + parse_yesno(var, val, &signal_data->ignore_cause_value); } else { ftdm_log(FTDM_LOG_WARNING, "Ignoring unknown parameter %s\n", ftdm_parameters[paramindex].var); } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index f3fc23e..865f498 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -127,13 +127,15 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) ftdm_channel_add_var(ftdmchan, "isdn_specific_var", "1"); #endif /* Fill in call information */ - get_calling_num(&ftdmchan->caller_data, &conEvnt->cgPtyNmb); - get_called_num(&ftdmchan->caller_data, &conEvnt->cdPtyNmb); - get_redir_num(&ftdmchan->caller_data, &conEvnt->redirNmb); + get_calling_num(ftdmchan, &conEvnt->cgPtyNmb); + get_called_num(ftdmchan, &conEvnt->cdPtyNmb); + get_redir_num(ftdmchan, &conEvnt->redirNmb); + get_calling_subaddr(ftdmchan, &conEvnt->cgPtySad); - if (get_calling_name_from_display(&ftdmchan->caller_data, &conEvnt->display) != FTDM_SUCCESS) { - get_calling_name_from_usr_usr(&ftdmchan->caller_data, &conEvnt->usrUsr); + if (get_calling_name_from_display(ftdmchan, &conEvnt->display) != FTDM_SUCCESS) { + get_calling_name_from_usr_usr(ftdmchan, &conEvnt->usrUsr); } + get_prog_ind_ie(ftdmchan, &conEvnt->progInd); ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Incoming call: Called No:[%s] Calling No:[%s]\n", ftdmchan->caller_data.dnis.digits, ftdmchan->caller_data.cid_num.digits); @@ -151,7 +153,7 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) if (conEvnt->facilityStr.eh.pres) { if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - get_facility_ie(&ftdmchan->caller_data, conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len); + get_facility_ie(ftdmchan, &conEvnt->facilityStr); } else if (signal_data->facility == SNGISDN_OPT_TRUE) { if (signal_data->switchtype == SNGISDN_SWITCH_NI2) { /* Verify whether the Caller Name will come in a subsequent FACILITY message */ @@ -178,6 +180,7 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) } else if (ret_val == 0) { strcpy(ftdmchan->caller_data.cid_name, retrieved_str); } + break; } } } @@ -255,8 +258,7 @@ void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event) ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - /* Function does not require any info from conStEvnt struct for now */ - /* CnStEvnt *cnStEvnt = &sngisdn_event->event.cnStEvnt; */ + CnStEvnt *cnStEvnt = &sngisdn_event->event.cnStEvnt; ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n"); @@ -282,6 +284,7 @@ void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event) case FTDM_CHANNEL_STATE_PROGRESS: case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: case FTDM_CHANNEL_STATE_DIALING: + get_prog_ind_ie(ftdmchan, &cnStEvnt->progInd); ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_UP); break; case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: @@ -345,9 +348,13 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) suId, suInstId, spInstId, ces); switch(evntType) { + case MI_CALLPROC: case MI_PROGRESS: - if (signal_data->switchtype == SNGISDN_SWITCH_NI2 && - cnStEvnt->causeDgn[0].eh.pres && cnStEvnt->causeDgn[0].causeVal.pres) { + case MI_ALERTING: + get_prog_ind_ie(ftdmchan, &cnStEvnt->progInd); + + if (signal_data->ignore_cause_value != SNGISDN_OPT_TRUE && + cnStEvnt->causeDgn[0].eh.pres && cnStEvnt->causeDgn[0].causeVal.pres) { switch(cnStEvnt->causeDgn[0].causeVal.val) { case 17: /* User Busy */ @@ -372,12 +379,10 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) goto sngisdn_process_cnst_ind_end; } } - /* fall-through */ - case MI_ALERTING: - case MI_CALLPROC: - + switch(ftdmchan->state) { case FTDM_CHANNEL_STATE_DIALING: + case FTDM_CHANNEL_STATE_PROCEED: if (cnStEvnt->progInd.eh.pres && cnStEvnt->progInd.progDesc.val == IN_PD_IBAVAIL) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); } else if (evntType == MI_CALLPROC) { @@ -385,8 +390,6 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) } else { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); } - break; - case FTDM_CHANNEL_STATE_PROCEED: case FTDM_CHANNEL_STATE_PROGRESS: if (cnStEvnt->progInd.eh.pres && cnStEvnt->progInd.progDesc.val == IN_PD_IBAVAIL) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); @@ -417,7 +420,7 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) ftdm_size_t min_digits = ((sngisdn_span_data_t*)ftdmchan->span->signal_data)->min_digits; ftdm_size_t num_digits; - get_called_num(&ftdmchan->caller_data, &cnStEvnt->cdPtyNmb); + get_called_num(ftdmchan, &cnStEvnt->cdPtyNmb); num_digits = strlen(ftdmchan->caller_data.dnis.digits); if (cnStEvnt->sndCmplt.eh.pres || num_digits >= min_digits) { @@ -476,7 +479,7 @@ void sngisdn_process_disc_ind (sngisdn_event_data_t *sngisdn_event) case FTDM_CHANNEL_STATE_UP: if (discEvnt->facilityStr.eh.pres) { if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - get_facility_ie(&ftdmchan->caller_data, discEvnt->facilityStr.facilityStr.val, discEvnt->facilityStr.facilityStr.len); + get_facility_ie(ftdmchan, &discEvnt->facilityStr); } else { /* Call libsng_isdn facility decode function and copy variables here */ } @@ -573,7 +576,7 @@ void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event) if (relEvnt->facilityStr.eh.pres) { if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - get_facility_ie(&ftdmchan->caller_data, relEvnt->facilityStr.facilityStr.val, relEvnt->facilityStr.facilityStr.len); + get_facility_ie(ftdmchan, &relEvnt->facilityStr); } else { /* Call libsng_isdn facility decode function and copy variables here */ } @@ -789,7 +792,7 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event) ftdm_sigmsg_t sigev; if (facEvnt->facElmt.facStr.pres) { if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - get_facility_ie(&ftdmchan->caller_data, &facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len); + get_facility_ie_str(ftdmchan, &facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len); } else { /* Call libsng_isdn facility decode function and copy variables here */ } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 1b906a2..d1c7063 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -34,13 +34,12 @@ #include "ftmod_sangoma_isdn.h" -static void sngisdn_set_prog_desc(ProgInd *progInd, ftdm_sngisdn_progind_t prod_ind); - void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) { - ConEvnt conEvnt; + ConEvnt conEvnt; sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_NETE_ISDN}; ftdm_assert((!sngisdn_info->suInstId && !sngisdn_info->spInstId), "Trying to call out, but call data was not cleared\n"); @@ -118,14 +117,6 @@ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) conEvnt.chanId.chanNmbSlotMap.val[0] = ftdmchan->physical_chan_id; } - conEvnt.progInd.eh.pres = PRSNT_NODEF; - conEvnt.progInd.location.pres = PRSNT_NODEF; - conEvnt.progInd.location.val = IN_LOC_USER; - conEvnt.progInd.codeStand0.pres = PRSNT_NODEF; - conEvnt.progInd.codeStand0.val = IN_CSTD_CCITT; - conEvnt.progInd.progDesc.pres = PRSNT_NODEF; - conEvnt.progInd.progDesc.val = IN_PD_NOTETEISDN; /* Not end-to-end ISDN */ - if (signal_data->switchtype == SNGISDN_SWITCH_EUROISDN) { conEvnt.sndCmplt.eh.pres = PRSNT_NODEF; } @@ -135,11 +126,13 @@ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) } ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Outgoing call: Called No:[%s] Calling No:[%s]\n", ftdmchan->caller_data.dnis.digits, ftdmchan->caller_data.cid_num.digits); - set_called_num(&conEvnt.cdPtyNmb, &ftdmchan->caller_data); - set_calling_num(&conEvnt.cgPtyNmb, &ftdmchan->caller_data); - set_redir_num(&conEvnt.redirNmb, &ftdmchan->caller_data); - set_calling_name(&conEvnt, ftdmchan); + set_called_num(ftdmchan, &conEvnt.cdPtyNmb); + set_calling_num(ftdmchan, &conEvnt.cgPtyNmb); + set_calling_subaddr(ftdmchan, &conEvnt.cgPtySad); + set_redir_num(ftdmchan, &conEvnt.redirNmb); + set_calling_name(ftdmchan, &conEvnt); set_facility_ie(ftdmchan, &conEvnt.facilityStr); + set_prog_ind_ie(ftdmchan, &conEvnt.progInd, prog_ind); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending SETUP (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); @@ -347,15 +340,7 @@ void sngisdn_snd_progress(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ } memset(&cnStEvnt, 0, sizeof(cnStEvnt)); - - cnStEvnt.progInd.eh.pres = PRSNT_NODEF; - cnStEvnt.progInd.location.pres = PRSNT_NODEF; - cnStEvnt.progInd.location.val = IN_LOC_USER; - cnStEvnt.progInd.codeStand0.pres = PRSNT_NODEF; - cnStEvnt.progInd.codeStand0.val = IN_CSTD_CCITT; - cnStEvnt.progInd.progDesc.pres = PRSNT_NODEF; - - sngisdn_set_prog_desc(&cnStEvnt.progInd, prog_ind); + set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending PROGRESS (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); if(sng_isdn_con_status(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId,&cnStEvnt, MI_PROGRESS, signal_data->dchan_id, sngisdn_info->ces)) { @@ -380,13 +365,7 @@ void sngisdn_snd_alert(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind memset(&cnStEvnt, 0, sizeof(cnStEvnt)); - cnStEvnt.progInd.eh.pres = PRSNT_NODEF; - cnStEvnt.progInd.location.pres = PRSNT_NODEF; - cnStEvnt.progInd.location.val = IN_LOC_USER; - cnStEvnt.progInd.codeStand0.pres = PRSNT_NODEF; - cnStEvnt.progInd.codeStand0.val = IN_CSTD_CCITT; - cnStEvnt.progInd.progDesc.pres = PRSNT_NODEF; - sngisdn_set_prog_desc(&cnStEvnt.progInd, prog_ind); + set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending ALERT (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); @@ -398,10 +377,10 @@ void sngisdn_snd_alert(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind void sngisdn_snd_connect(ftdm_channel_t *ftdmchan) { - CnStEvnt cnStEvnt; - + CnStEvnt cnStEvnt; sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_NETE_ISDN}; if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending CONNECT, but no call data, aborting (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); @@ -443,14 +422,8 @@ void sngisdn_snd_connect(ftdm_channel_t *ftdmchan) cnStEvnt.chanId.chanNmbSlotMap.len = 1; cnStEvnt.chanId.chanNmbSlotMap.val[0] = ftdmchan->physical_chan_id; } - - cnStEvnt.progInd.eh.pres = PRSNT_NODEF; - cnStEvnt.progInd.location.pres = PRSNT_NODEF; - cnStEvnt.progInd.location.val = IN_LOC_USER; - cnStEvnt.progInd.codeStand0.pres = PRSNT_NODEF; - cnStEvnt.progInd.codeStand0.val = IN_CSTD_CCITT; - cnStEvnt.progInd.progDesc.pres = PRSNT_NODEF; - cnStEvnt.progInd.progDesc.val = IN_PD_NOTETEISDN; /* Not end-to-end ISDN */ + + set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending CONNECT (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); if (sng_isdn_con_response(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &cnStEvnt, signal_data->dchan_id, sngisdn_info->ces)) { @@ -472,7 +445,12 @@ void sngisdn_snd_fac_req(ftdm_channel_t *ftdmchan) } memset(&facEvnt, 0, sizeof(facEvnt)); - + + set_facility_ie_str(ftdmchan, &facEvnt.facElmt.facStr.val[2], (ftdm_size_t*)&facEvnt.facElmt.facStr.len); + + facEvnt.facElmt.facStr.val[0] = 0x1C; + facEvnt.facElmt.facStr.val[1] = facEvnt.facElmt.facStr.len; + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending FACILITY (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); if (sng_isdn_facility_request(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &facEvnt, MI_FACIL, signal_data->dchan_id, sngisdn_info->ces)) { @@ -617,32 +595,6 @@ void sngisdn_snd_release(ftdm_channel_t *ftdmchan, uint8_t glare) return; } -static void sngisdn_set_prog_desc(ProgInd *progInd, ftdm_sngisdn_progind_t prog_ind) -{ - switch(prog_ind) { - case SNGISDN_PROGIND_NETE_ISDN: - progInd->progDesc.val = IN_PD_NOTETEISDN; - break; - case SNGISDN_PROGIND_DEST_NISDN: - progInd->progDesc.val = IN_PD_DSTNOTISDN; - break; - case SNGISDN_PROGIND_ORIG_NISDN: - progInd->progDesc.val = IN_PD_ORGNOTISDN; - break; - case SNGISDN_PROGIND_RET_ISDN: - progInd->progDesc.val = IN_PD_CALLRET; - break; - case SNGISDN_PROGIND_SERV_CHANGE: - /* Trillium defines do not match ITU-T Q931 Progress descriptions, - indicate a delayed response for now */ - progInd->progDesc.val = IN_PD_DELRESP; - break; - case SNGISDN_PROGIND_IB_AVAIL: - progInd->progDesc.val = IN_PD_IBAVAIL; - break; - } - return; -} /* We received an incoming frame on the d-channel, send data to the stack */ void sngisdn_snd_data(ftdm_channel_t *dchan, uint8_t *data, ftdm_size_t len) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 241bb43..964d06c 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -33,6 +33,15 @@ */ #include "ftmod_sangoma_isdn.h" +#define SNGISDN_Q931_FACILITY_IE_ID 0x1C + +/* ftmod_sangoma_isdn specific enum look-up functions */ + +FTDM_ENUM_NAMES(SNGISDN_PROGIND_DESCR_NAMES, SNGISDN_PROGIND_DESCR_STRINGS) +FTDM_STR2ENUM(ftdm_str2ftdm_sngisdn_progind_descr, ftdm_sngisdn_progind_descr2str, ftdm_sngisdn_progind_descr_t, SNGISDN_PROGIND_DESCR_NAMES, SNGISDN_PROGIND_DESCR_INVALID) + +FTDM_ENUM_NAMES(SNGISDN_PROGIND_LOC_NAMES, SNGISDN_PROGIND_LOC_STRINGS) +FTDM_STR2ENUM(ftdm_str2ftdm_sngisdn_progind_loc, ftdm_sngisdn_progind_loc2str, ftdm_sngisdn_progind_loc_t, SNGISDN_PROGIND_LOC_NAMES, SNGISDN_PROGIND_LOC_INVALID) ftdm_status_t sngisdn_check_free_ids(void); @@ -129,7 +138,6 @@ ftdm_status_t get_ftdmchan_by_spInstId(int16_t cc_id, uint32_t spInstId, sngisdn ftdm_status_t sngisdn_set_avail_rate(ftdm_span_t *span, sngisdn_avail_t avail) { - if (span->trunk_type == FTDM_TRUNK_BRI || span->trunk_type == FTDM_TRUNK_BRI_PTMP) { @@ -147,8 +155,9 @@ ftdm_status_t sngisdn_set_avail_rate(ftdm_span_t *span, sngisdn_avail_t avail) return FTDM_SUCCESS; } -ftdm_status_t get_calling_num(ftdm_caller_data_t *caller_data, CgPtyNmb *cgPtyNmb) +ftdm_status_t get_calling_num(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb) { + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; if (cgPtyNmb->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; } @@ -176,8 +185,9 @@ ftdm_status_t get_calling_num(ftdm_caller_data_t *caller_data, CgPtyNmb *cgPtyNm return FTDM_SUCCESS; } -ftdm_status_t get_called_num(ftdm_caller_data_t *caller_data, CdPtyNmb *cdPtyNmb) +ftdm_status_t get_called_num(ftdm_channel_t *ftdmchan, CdPtyNmb *cdPtyNmb) { + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; if (cdPtyNmb->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; } @@ -199,8 +209,9 @@ ftdm_status_t get_called_num(ftdm_caller_data_t *caller_data, CdPtyNmb *cdPtyNmb return FTDM_SUCCESS; } -ftdm_status_t get_redir_num(ftdm_caller_data_t *caller_data, RedirNmb *redirNmb) +ftdm_status_t get_redir_num(ftdm_channel_t *ftdmchan, RedirNmb *redirNmb) { + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; if (redirNmb->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; } @@ -219,8 +230,9 @@ ftdm_status_t get_redir_num(ftdm_caller_data_t *caller_data, RedirNmb *redirNmb) return FTDM_SUCCESS; } -ftdm_status_t get_calling_name_from_display(ftdm_caller_data_t *caller_data, Display *display) +ftdm_status_t get_calling_name_from_display(ftdm_channel_t *ftdmchan, Display *display) { + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; if (display->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; } @@ -232,8 +244,9 @@ ftdm_status_t get_calling_name_from_display(ftdm_caller_data_t *caller_data, Dis return FTDM_SUCCESS; } -ftdm_status_t get_calling_name_from_usr_usr(ftdm_caller_data_t *caller_data, UsrUsr *usrUsr) +ftdm_status_t get_calling_name_from_usr_usr(ftdm_channel_t *ftdmchan, UsrUsr *usrUsr) { + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; if (usrUsr->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; } @@ -250,26 +263,124 @@ ftdm_status_t get_calling_name_from_usr_usr(ftdm_caller_data_t *caller_data, Usr return FTDM_SUCCESS; } -ftdm_status_t get_facility_ie(ftdm_caller_data_t *caller_data, uint8_t *data, uint32_t data_len) +ftdm_status_t get_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad) { + char subaddress[100]; + + if (cgPtySad->eh.pres != PRSNT_NODEF) { + return FTDM_FAIL; + } + memset(subaddress, 0, sizeof(subaddress)); + if(cgPtySad->sadInfo.len >= sizeof(subaddress)) { + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Calling Party Subaddress exceeds local size limit (len:%d max:%d)\n", cgPtySad->sadInfo.len, sizeof(subaddress)); + cgPtySad->sadInfo.len = sizeof(subaddress)-1; + } + + memcpy(subaddress, (char*)cgPtySad->sadInfo.val, cgPtySad->sadInfo.len); + subaddress[cgPtySad->sadInfo.len] = '\0'; + ftdm_channel_add_var(ftdmchan, "isdn.calling_subaddr", subaddress); + return FTDM_SUCCESS; +} + +ftdm_status_t get_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr) +{ + if (!facilityStr->eh.pres) { + return FTDM_FAIL; + } + + return get_facility_ie_str(ftdmchan, facilityStr->facilityStr.val, facilityStr->facilityStr.len); +} + +ftdm_status_t get_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, ftdm_size_t data_len) +{ + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; if (data_len > sizeof(caller_data->raw_data)-2) { ftdm_log(FTDM_LOG_CRIT, "Length of Facility IE exceeds maximum length\n"); return FTDM_FAIL; } - + memset(caller_data->raw_data, 0, sizeof(caller_data->raw_data)); /* Always include Facility IE identifier + len so this can be used as a sanity check by the user */ - caller_data->raw_data[0] = 0x1C; + caller_data->raw_data[0] = SNGISDN_Q931_FACILITY_IE_ID; caller_data->raw_data[1] = data_len; memcpy(&caller_data->raw_data[2], data, data_len); caller_data->raw_data_len = data_len+2; + return FTDM_SUCCESS; +} + +ftdm_status_t get_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd) +{ + uint8_t val; + if (!progInd->eh.pres) { + return FTDM_FAIL; + } + + if (progInd->progDesc.pres) { + switch (progInd->progDesc.val) { + case IN_PD_NOTETEISDN: + val = SNGISDN_PROGIND_DESCR_NETE_ISDN; + break; + case IN_PD_DSTNOTISDN: + val = SNGISDN_PROGIND_DESCR_DEST_NISDN; + break; + case IN_PD_ORGNOTISDN: + val = SNGISDN_PROGIND_DESCR_ORIG_NISDN; + break; + case IN_PD_CALLRET: + val = SNGISDN_PROGIND_DESCR_RET_ISDN; + break; + case IN_PD_DELRESP: + val = SNGISDN_PROGIND_DESCR_SERV_CHANGE; + break; + case IN_PD_IBAVAIL: + val = SNGISDN_PROGIND_DESCR_IB_AVAIL; + break; + default: + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Unknown Progress Indicator Description (%d)\n", progInd->progDesc.val); + val = SNGISDN_PROGIND_DESCR_INVALID; + break; + } + ftdm_channel_add_var(ftdmchan, "isdn.prog_ind.descr", ftdm_sngisdn_progind_descr2str(val)); + } + if (progInd->location.pres) { + switch (progInd->location.val) { + case IN_LOC_USER: + val = SNGISDN_PROGIND_LOC_USER; + break; + case IN_LOC_PRIVNETLU: + val = SNGISDN_PROGIND_LOC_PRIV_NET_LOCAL_USR; + break; + case IN_LOC_PUBNETLU: + val = SNGISDN_PROGIND_LOC_PUB_NET_LOCAL_USR; + break; + case IN_LOC_TRANNET: + val = SNGISDN_PROGIND_LOC_TRANSIT_NET; + break; + case IN_LOC_PUBNETRU: + val = SNGISDN_PROGIND_LOC_PUB_NET_REMOTE_USR; + break; + case IN_LOC_PRIVNETRU: + val = SNGISDN_PROGIND_LOC_PRIV_NET_REMOTE_USR; + break; + case IN_LOC_NETINTER: + val = SNGISDN_PROGIND_LOC_NET_BEYOND_INTRW; + break; + default: + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Unknown Progress Indicator Location (%d)", progInd->location.val); + val = SNGISDN_PROGIND_LOC_INVALID; + break; + } + ftdm_channel_add_var(ftdmchan, "isdn.prog_ind.loc", ftdm_sngisdn_progind_loc2str(val)); + } return FTDM_SUCCESS; } -ftdm_status_t set_calling_num(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *caller_data) + +ftdm_status_t set_calling_num(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb) { + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; uint8_t len = strlen(caller_data->cid_num.digits); if (!len) { return FTDM_SUCCESS; @@ -296,9 +407,11 @@ ftdm_status_t set_calling_num(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *caller_dat return FTDM_SUCCESS; } -ftdm_status_t set_called_num(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *caller_data) +ftdm_status_t set_called_num(ftdm_channel_t *ftdmchan, CdPtyNmb *cdPtyNmb) { + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; uint8_t len = strlen(caller_data->dnis.digits); + if (!len) { return FTDM_SUCCESS; } @@ -326,8 +439,9 @@ ftdm_status_t set_called_num(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *caller_data return FTDM_SUCCESS; } -ftdm_status_t set_redir_num(RedirNmb *redirNmb, ftdm_caller_data_t *caller_data) +ftdm_status_t set_redir_num(ftdm_channel_t *ftdmchan, RedirNmb *redirNmb) { + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; uint8_t len = strlen(caller_data->rdnis.digits); if (!len) { return FTDM_SUCCESS; @@ -358,7 +472,7 @@ ftdm_status_t set_redir_num(RedirNmb *redirNmb, ftdm_caller_data_t *caller_data) } -ftdm_status_t set_calling_name(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan) +ftdm_status_t set_calling_name(ftdm_channel_t *ftdmchan, ConEvnt *conEvnt) { uint8_t len; ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; @@ -411,20 +525,139 @@ ftdm_status_t set_calling_name(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan) return FTDM_SUCCESS; } +ftdm_status_t set_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad) +{ + const char* clg_subaddr = NULL; + clg_subaddr = ftdm_channel_get_var(ftdmchan, "isdn.calling_subaddr"); + if ((clg_subaddr != NULL) && (*clg_subaddr)) { + unsigned len = strlen (clg_subaddr); + cgPtySad->eh.pres = PRSNT_NODEF; + cgPtySad->typeSad.pres = 1; + cgPtySad->typeSad.val = 0; /* NSAP */ + cgPtySad->oddEvenInd.pres = 1; + cgPtySad->oddEvenInd.val = 0; + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending Calling Party Subaddress:%s\n", clg_subaddr); + cgPtySad->sadInfo.pres = 1; + cgPtySad->sadInfo.len = len; + memcpy(cgPtySad->sadInfo.val, clg_subaddr, len); + } + return FTDM_SUCCESS; +} + + ftdm_status_t set_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr) { - if (ftdmchan->caller_data.raw_data_len && - ftdmchan->caller_data.raw_data[0] == 0x1C) { + ftdm_status_t status; + status = set_facility_ie_str(ftdmchan, facilityStr->facilityStr.val, (ftdm_size_t*)&facilityStr->facilityStr.len); + if (status == FTDM_SUCCESS) { facilityStr->eh.pres = PRSNT_NODEF; facilityStr->facilityStr.pres = PRSNT_NODEF; - facilityStr->facilityStr.len = ftdmchan->caller_data.raw_data_len-2; - memcpy(facilityStr->facilityStr.val, &ftdmchan->caller_data.raw_data[2], facilityStr->facilityStr.len); - return FTDM_SUCCESS; } + return status; +} + +ftdm_status_t set_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, ftdm_size_t *data_len) +{ + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; + if (caller_data->raw_data_len > 0 && caller_data->raw_data[0] == SNGISDN_Q931_FACILITY_IE_ID) { + + *data_len = caller_data->raw_data[1]; + memcpy(data, &caller_data->raw_data[2], *data_len); + return FTDM_SUCCESS; + } return FTDM_FAIL; } +ftdm_status_t set_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd, ftdm_sngisdn_progind_t prog_ind) +{ + const char *str = NULL; + int descr = prog_ind.descr; + int loc = prog_ind.loc; + + str = ftdm_channel_get_var(ftdmchan, "isdn.prog_ind.descr"); + if (str && *str) { + /* User wants to override progress indicator */ + descr = ftdm_str2ftdm_sngisdn_progind_descr(str); + } + + if (descr == SNGISDN_PROGIND_DESCR_INVALID) { + /* User does not want to send progress indicator */ + return FTDM_SUCCESS; + } + + str = ftdm_channel_get_var(ftdmchan, "isdn.prog_ind.loc"); + if (str && *str) { + loc = ftdm_str2ftdm_sngisdn_progind_loc(str); + } + if (loc == SNGISDN_PROGIND_LOC_INVALID) { + loc = SNGISDN_PROGIND_LOC_USER; + } + + progInd->eh.pres = PRSNT_NODEF; + progInd->codeStand0.pres = PRSNT_NODEF; + progInd->codeStand0.val = IN_CSTD_CCITT; + + progInd->progDesc.pres = PRSNT_NODEF; + switch(descr) { + case SNGISDN_PROGIND_DESCR_NETE_ISDN: + progInd->progDesc.val = IN_PD_NOTETEISDN; + break; + case SNGISDN_PROGIND_DESCR_DEST_NISDN: + progInd->progDesc.val = IN_PD_DSTNOTISDN; + break; + case SNGISDN_PROGIND_DESCR_ORIG_NISDN: + progInd->progDesc.val = IN_PD_ORGNOTISDN; + break; + case SNGISDN_PROGIND_DESCR_RET_ISDN: + progInd->progDesc.val = IN_PD_CALLRET; + break; + case SNGISDN_PROGIND_DESCR_SERV_CHANGE: + /* Trillium defines do not match ITU-T Q931 Progress descriptions, + indicate a delayed response for now */ + progInd->progDesc.val = IN_PD_DELRESP; + break; + case SNGISDN_PROGIND_DESCR_IB_AVAIL: + progInd->progDesc.val = IN_PD_IBAVAIL; + break; + default: + ftdm_log(FTDM_LOG_WARNING, "Invalid prog_ind description:%d\n", descr); + progInd->progDesc.val = IN_PD_NOTETEISDN; + break; + } + + progInd->location.pres = PRSNT_NODEF; + switch (loc) { + case SNGISDN_PROGIND_LOC_USER: + progInd->location.val = IN_LOC_USER; + break; + case SNGISDN_PROGIND_LOC_PRIV_NET_LOCAL_USR: + progInd->location.val = IN_LOC_PRIVNETLU; + break; + case SNGISDN_PROGIND_LOC_PUB_NET_LOCAL_USR: + progInd->location.val = IN_LOC_PUBNETLU; + break; + case SNGISDN_PROGIND_LOC_TRANSIT_NET: + progInd->location.val = IN_LOC_TRANNET; + break; + case SNGISDN_PROGIND_LOC_PUB_NET_REMOTE_USR: + progInd->location.val = IN_LOC_PUBNETRU; + break; + case SNGISDN_PROGIND_LOC_PRIV_NET_REMOTE_USR: + progInd->location.val = IN_LOC_PRIVNETRU; + break; + case SNGISDN_PROGIND_LOC_NET_BEYOND_INTRW: + progInd->location.val = IN_LOC_NETINTER; + break; + default: + ftdm_log(FTDM_LOG_WARNING, "Invalid prog_ind location:%d\n", loc); + progInd->location.val = IN_PD_NOTETEISDN; + } + return FTDM_SUCCESS; +} + + void sngisdn_t3_timeout(void* p_sngisdn_info) { sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*)p_sngisdn_info; @@ -581,13 +814,12 @@ uint8_t sngisdn_get_infoTranCap_from_stack(ftdm_bearer_cap_t bearer_capability) switch(bearer_capability) { case FTDM_BEARER_CAP_SPEECH: return IN_ITC_SPEECH; - case FTDM_BEARER_CAP_64K_UNRESTRICTED: return IN_ITC_UNRDIG; - case FTDM_BEARER_CAP_3_1KHZ_AUDIO: return IN_ITC_A31KHZ; - + case FTDM_BEARER_CAP_INVALID: + return IN_ITC_SPEECH; /* Do not put a default case here, so we can see compile warnings if we have unhandled cases */ } return FTDM_BEARER_CAP_SPEECH; @@ -598,13 +830,12 @@ uint8_t sngisdn_get_usrInfoLyr1Prot_from_stack(ftdm_user_layer1_prot_t layer1_pr switch(layer1_prot) { case FTDM_USER_LAYER1_PROT_V110: return IN_UIL1_CCITTV110; - case FTDM_USER_LAYER1_PROT_ULAW: return IN_UIL1_G711ULAW; - case FTDM_USER_LAYER1_PROT_ALAW: return IN_UIL1_G711ALAW; - + case FTDM_USER_LAYER1_PROT_INVALID: + return IN_UIL1_G711ULAW; /* Do not put a default case here, so we can see compile warnings if we have unhandled cases */ } return IN_UIL1_G711ULAW; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c index 624d35c..e516716 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c @@ -613,6 +613,21 @@ uint32_t sngisdn_decode_ie(char *str, uint32_t *str_len, uint8_t current_codeset return 0; break; case PROT_Q931_IE_CALLED_PARTY_SUBADDRESS: + { + uint8_t type; + uint8_t currentOct, j=0; + char calling_subaddr_string[82]; + memset(calling_subaddr_string, 0, sizeof(calling_subaddr_string)); + type = get_bits(OCTET(3),5,7); + currentOct = 3; + while(currentOct++ <= len+1) { + calling_subaddr_string[j++]=ia5[get_bits(OCTET(currentOct),1,4)][get_bits(OCTET(currentOct),5,8)]; + } + calling_subaddr_string[j++]='\0'; + *str_len += sprintf(&str[*str_len], "%s (l:%d) type:%s(%d) \n", + calling_subaddr_string, (j-1), get_code_2_str(type, dcodQ931TypeOfSubaddressTable), type); + } + break; case PROT_Q931_IE_REDIRECTION_NUMBER: case PROT_Q931_IE_NOTIFICATION_IND: case PROT_Q931_IE_DATE_TIME: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.h index d210c50..f054de9 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.h @@ -544,5 +544,11 @@ struct code2str dcodQ931GenDigitsTypeTable[] = { {-1, "Invalid"}, }; +struct code2str dcodQ931TypeOfSubaddressTable[] = { + { 0x00, "NSAP"}, + { 0x02, "User-specified"}, + { -1, "Invalid"}, +}; + #endif /* __FTMOD_SANGOMA_ISDN_TRACE_H__ */ diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 45fb1e9..5ae14ab 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -41,6 +41,7 @@ #include "ftdm_declare.h" +#include "ftdm_call_utils.h" /*! \brief Max number of channels per physical span */ #define FTDM_MAX_CHANNELS_PHYSICAL_SPAN 32 @@ -62,23 +63,6 @@ #define FTDM_INVALID_INT_PARM 0xFF -/*! \brief FreeTDM APIs possible return codes */ -typedef enum { - FTDM_SUCCESS, /*!< Success */ - FTDM_FAIL, /*!< Failure, generic error return code, use ftdm_channel_get_last_error or ftdm_span_get_last_error for details */ - FTDM_MEMERR, /*!< Memory error, most likely allocation failure */ - FTDM_TIMEOUT, /*!< Operation timed out (ie: polling on a device)*/ - FTDM_NOTIMPL, /*!< Operation not implemented */ - FTDM_BREAK, /*!< Request the caller to perform a break (context-dependant, ie: stop getting DNIS/ANI) */ - FTDM_EINVAL /*!< Invalid argument */ -} ftdm_status_t; - -/*! \brief FreeTDM bool type. */ -typedef enum { - FTDM_FALSE, - FTDM_TRUE -} ftdm_bool_t; - /*! \brief Thread/Mutex OS abstraction API. */ #include "ftdm_os.h" @@ -220,8 +204,10 @@ typedef enum { FTDM_TON_SUBSCRIBER_NUMBER, FTDM_TON_ABBREVIATED_NUMBER, FTDM_TON_RESERVED, - FTDM_TON_INVALID = 255 + FTDM_TON_INVALID } ftdm_ton_t; +#define TON_STRINGS "unknown", "international", "national", "network-specific", "subscriber-number", "abbreviated-number", "reserved", "invalid" +FTDM_STR2ENUM_P(ftdm_str2ftdm_ton, ftdm_ton2str, ftdm_ton_t) /*! Numbering Plan Identification (NPI) */ typedef enum { @@ -232,29 +218,59 @@ typedef enum { FTDM_NPI_NATIONAL = 8, FTDM_NPI_PRIVATE = 9, FTDM_NPI_RESERVED = 10, - FTDM_NPI_INVALID = 255 + FTDM_NPI_INVALID } ftdm_npi_t; +#define NPI_STRINGS "unknown", "ISDN", "data", "telex", "national", "private", "reserved", "invalid" +FTDM_STR2ENUM_P(ftdm_str2ftdm_npi, ftdm_npi2str, ftdm_npi_t) -/*! \brief Number abstraction */ -typedef struct { - char digits[25]; - uint8_t type; - uint8_t plan; -} ftdm_number_t; +/*! Presentation Ind */ +typedef enum { + FTDM_PRES_ALLOWED, + FTDM_PRES_RESTRICTED, + FTDM_PRES_NOT_AVAILABLE, + FTDM_PRES_RESERVED, + FTDM_PRES_INVALID +} ftdm_presentation_t; +#define PRESENTATION_STRINGS "presentation-allowed", "presentation-restricted", "number-not-available", "reserved", "Invalid" +FTDM_STR2ENUM_P(ftdm_str2ftdm_presentation, ftdm_presentation2str, ftdm_presentation_t) + +/*! Screening Ind */ +typedef enum { + FTDM_SCREENING_NOT_SCREENED, + FTDM_SCREENING_VERIFIED_PASSED, + FTDM_SCREENING_VERIFIED_FAILED, + FTDM_SCREENING_NETWORK_PROVIDED, + FTDM_SCREENING_INVALID +} ftdm_screening_t; +#define SCREENING_STRINGS "user-provided-not-screened", "user-provided-verified-and-passed", "user-provided-verified-and-failed", "network-provided", "invalid" +FTDM_STR2ENUM_P(ftdm_str2ftdm_screening, ftdm_screening2str, ftdm_screening_t) /*! \brief bearer capability */ typedef enum { FTDM_BEARER_CAP_SPEECH = 0x00, FTDM_BEARER_CAP_64K_UNRESTRICTED = 0x02, - FTDM_BEARER_CAP_3_1KHZ_AUDIO = 0x03 + FTDM_BEARER_CAP_3_1KHZ_AUDIO = 0x03, + FTDM_BEARER_CAP_INVALID } ftdm_bearer_cap_t; +#define BEARER_CAP_STRINGS "speech", "unrestricted-digital-information", "3.1-Khz-audio", "invalid" +FTDM_STR2ENUM_P(ftdm_str2ftdm_bearer_cap, ftdm_bearer_cap2str, ftdm_bearer_cap_t) /*! \brief user information layer 1 protocol */ typedef enum { FTDM_USER_LAYER1_PROT_V110 = 0x01, FTDM_USER_LAYER1_PROT_ULAW = 0x02, FTDM_USER_LAYER1_PROT_ALAW = 0x03, + FTDM_USER_LAYER1_PROT_INVALID } ftdm_user_layer1_prot_t; +#define USER_LAYER1_PROT_STRINGS "V.110", "u-law", "a-law", "Invalid" +FTDM_STR2ENUM_P(ftdm_str2ftdm_usr_layer1_prot, ftdm_user_layer1_prot2str, ftdm_user_layer1_prot_t) + +/*! \brief Number abstraction */ +typedef struct { + char digits[25]; + uint8_t type; + uint8_t plan; +} ftdm_number_t; /*! \brief Caller information */ typedef struct ftdm_caller_data { diff --git a/libs/freetdm/src/include/ftdm_call_utils.h b/libs/freetdm/src/include/ftdm_call_utils.h new file mode 100644 index 0000000..835a5c6 --- /dev/null +++ b/libs/freetdm/src/include/ftdm_call_utils.h @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2010, Sangoma Technologies + * David Yat Sin <dyatsin@sangoma.com> + * 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 original author; nor the names of any 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 OWNER + * 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. + */ + +#ifndef __FTDM_CALL_UTILS_H__ +#define __FTDM_CALL_UTILS_H__ + +/*! + * \brief Set the Numbering Plan Identification from a string + * + * \param npi_string string value + * \param target the target to set value to + * + * \retval FTDM_SUCCESS success + * \retval FTDM_FAIL failure + */ +FT_DECLARE(ftdm_status_t) ftdm_set_npi(const char *npi_string, uint8_t *target); + + +/*! + * \brief Set the Type of number from a string + * + * \param ton_string string value + * \param target the target to set value to + * + * \retval FTDM_SUCCESS success + * \retval FTDM_FAIL failure + */ +FT_DECLARE(ftdm_status_t) ftdm_set_ton(const char *ton_string, uint8_t *target); + +/*! + * \brief Set the Bearer Capability from a string + * + * \param bc_string string value + * \param target the target to set value to + * + * \retval FTDM_SUCCESS success + * \retval FTDM_FAIL failure + */ +FT_DECLARE(ftdm_status_t) ftdm_set_bearer_capability(const char *bc_string, uint8_t *target); + +/*! + * \brief Set the Bearer Capability - Layer 1 from a string + * + * \param bc_string string value + * \param target the target to set value to + * + * \retval FTDM_SUCCESS success + * \retval FTDM_FAIL failure + */ +FT_DECLARE(ftdm_status_t) ftdm_set_bearer_layer1(const char *bc_string, uint8_t *target); + +/*! + * \brief Set the Screening Ind from a string + * + * \param screen_string string value + * \param target the target to set value to + * + * \retval FTDM_SUCCESS success + * \retval FTDM_FAIL failure + */ +FT_DECLARE(ftdm_status_t) ftdm_set_screening_ind(const char *string, uint8_t *target); + + +/*! + * \brief Set the Presentation Ind from an enum + * + * \param screen_string string value + * \param target the target to set value to + * + * \retval FTDM_SUCCESS success + * \retval FTDM_FAIL failure + */ +FT_DECLARE(ftdm_status_t) ftdm_set_presentation_ind(const char *string, uint8_t *target); + + +/*! + * \brief Checks whether a string contains only numbers + * + * \param number string value + * + * \retval FTDM_SUCCESS success + * \retval FTDM_FAIL failure + */ +FT_DECLARE(ftdm_status_t) ftdm_is_number(const char *number); + +#endif /* __FTDM_CALL_UTILS_H__ */ + diff --git a/libs/freetdm/src/include/ftdm_declare.h b/libs/freetdm/src/include/ftdm_declare.h index ab3b5c8..4aba703 100644 --- a/libs/freetdm/src/include/ftdm_declare.h +++ b/libs/freetdm/src/include/ftdm_declare.h @@ -171,6 +171,23 @@ typedef int ftdm_socket_t; #include <stdarg.h> #endif +/*! \brief FreeTDM APIs possible return codes */ +typedef enum { + FTDM_SUCCESS, /*!< Success */ + FTDM_FAIL, /*!< Failure, generic error return code, use ftdm_channel_get_last_error or ftdm_span_get_last_error for details */ + FTDM_MEMERR, /*!< Memory error, most likely allocation failure */ + FTDM_TIMEOUT, /*!< Operation timed out (ie: polling on a device)*/ + FTDM_NOTIMPL, /*!< Operation not implemented */ + FTDM_BREAK, /*!< Request the caller to perform a break (context-dependant, ie: stop getting DNIS/ANI) */ + FTDM_EINVAL /*!< Invalid argument */ +} ftdm_status_t; + +/*! \brief FreeTDM bool type. */ +typedef enum { + FTDM_FALSE, + FTDM_TRUE +} ftdm_bool_t; + /*! * \brief FreeTDM channel. * This is the basic data structure used to place calls and I/O operations diff --git a/libs/freetdm/src/include/private/ftdm_call_utils.h b/libs/freetdm/src/include/private/ftdm_call_utils.h deleted file mode 100644 index 782abde..0000000 --- a/libs/freetdm/src/include/private/ftdm_call_utils.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2010, Sangoma Technologies - * David Yat Sin <dyatsin@sangoma.com> - * 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 original author; nor the names of any 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 OWNER - * 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. - */ - -#ifndef __FTDM_CALL_UTILS_H__ -#define __FTDM_CALL_UTILS_H__ - -#include "freetdm.h" - -FT_DECLARE(ftdm_status_t) ftdm_span_set_npi(const char *npi_string, uint8_t *target); -FT_DECLARE(ftdm_status_t) ftdm_span_set_ton(const char *ton_string, uint8_t *target); -FT_DECLARE(ftdm_status_t) ftdm_span_set_bearer_capability(const char *bc_string, ftdm_bearer_cap_t *target); -FT_DECLARE(ftdm_status_t) ftdm_span_set_bearer_layer1(const char *bc_string, ftdm_user_layer1_prot_t *target); -FT_DECLARE(ftdm_status_t) ftdm_is_number(char *number); - -#endif /* __FTDM_CALL_UTILS_H__ */ - commit 3934682e9b616f9117d70f05965e8c5f3bbc3269 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Tue Nov 30 16:01:08 2010 -0200 freetdm: ftmod_r2 - rename ftdm_started flag to ftdm_call_started diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index ffc39e8..b98f7db 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -68,7 +68,7 @@ typedef struct ftdm_r2_call_t { int accepted:1; int answer_pending:1; int disconnect_rcvd:1; - int ftdm_started:1; + int ftdm_call_started:1; int protocol_error:1; ftdm_channel_state_t chanstate; ftdm_size_t dnis_index; @@ -357,7 +357,7 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(r2_outgoing_call) } ft_r2_clean_call(ftdmchan->call_data); - R2CALL(ftdmchan)->ftdm_started = 1; + R2CALL(ftdmchan)->ftdm_call_started = 1; R2CALL(ftdmchan)->chanstate = FTDM_CHANNEL_STATE_DOWN; ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DIALING); @@ -503,7 +503,7 @@ static void ftdm_r2_on_call_disconnect(openr2_chan_t *r2chan, openr2_call_discon } /* if the call has not been started yet we must go to HANGUP right here */ - if (!R2CALL(ftdmchan)->ftdm_started) { + if (!R2CALL(ftdmchan)->ftdm_call_started) { ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); return; } @@ -567,7 +567,7 @@ static void ftdm_r2_on_protocol_error(openr2_chan_t *r2chan, openr2_protocol_err R2CALL(ftdmchan)->disconnect_rcvd = 1; R2CALL(ftdmchan)->protocol_error = 1; - if (!R2CALL(ftdmchan)->ftdm_started) { + if (!R2CALL(ftdmchan)->ftdm_call_started) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); return; } @@ -1260,7 +1260,7 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); break; } - R2CALL(ftdmchan)->ftdm_started = 1; + R2CALL(ftdmchan)->ftdm_call_started = 1; break; commit a27bdf3f5b083f65aa1a7dbe66023e930cb59979 Merge: 2a00d3e 302d5bb Author: David Yat Sin <dyatsin@sangoma.com> Date: Tue Nov 30 12:57:43 2010 -0500 freetdm:Changed freetdm variables diff --cc libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index d46f439,6957f99..9cddecb --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@@ -201,8 -231,8 +231,9 @@@ typedef struct sngisdn_span_data uint8_t facility; int8_t facility_timeout; uint8_t num_local_numbers; + uint8_t ignore_cause_value; uint8_t timer_t3; + uint8_t restart_opt; char* local_numbers[SNGISDN_NUM_LOCAL_NUMBERS]; ftdm_sched_t *sched; ftdm_queue_t *event_queue; diff --cc libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c index f6d670c,6b4e73a..6afab42 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c @@@ -190,9 -201,9 +201,10 @@@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm signal_data->min_digits = 8; signal_data->overlap_dial = SNGISDN_OPT_DEFAULT; signal_data->setup_arb = SNGISDN_OPT_DEFAULT; - signal_data->facility_ie_decode = SNGISDN_OPT_TRUE; + signal_data->facility_ie_decode = SNGISDN_OPT_DEFAULT; + signal_data->ignore_cause_value = SNGISDN_OPT_DEFAULT; signal_data->timer_t3 = 8; + signal_data->restart_opt = SNGISDN_OPT_DEFAULT; signal_data->link_id = span->span_id; span->default_caller_data.bearer_capability = IN_ITC_SPEECH; @@@ -267,31 -265,22 +266,24 @@@ } else if (!strcasecmp(var, "min_digits")) { signal_data->min_digits = atoi(val); } else if (!strcasecmp(var, "outbound-called-ton")) { - ftdm_span_set_ton(val, &span->default_caller_data.dnis.type); + ftdm_set_ton(val, &span->default_caller_data.dnis.type); } else if (!strcasecmp(var, "outbound-called-npi")) { - ftdm_span_set_npi(val, &span->default_caller_data.dnis.plan); + ftdm_set_npi(val, &span->default_caller_data.dnis.plan); } else if (!strcasecmp(var, "outbound-calling-ton")) { - ftdm_span_set_ton(val, &span->default_caller_data.cid_num.type); + ftdm_set_ton(val, &span->default_caller_data.cid_num.type); } else if (!strcasecmp(var, "outbound-calling-npi")) { - ftdm_span_set_npi(val, &span->default_caller_data.cid_num.plan); + ftdm_set_npi(val, &span->default_caller_data.cid_num.plan); } else if (!strcasecmp(var, "outbound-rdnis-ton")) { - ftdm_span_set_ton(val, &span->default_caller_data.rdnis.type); + ftdm_set_ton(val, &span->default_caller_data.rdnis.type); } else if (!strcasecmp(var, "outbound-rdnis-npi")) { - ftdm_span_set_npi(val, &span->default_caller_data.rdnis.plan); + ftdm_set_npi(val, &span->default_caller_data.rdnis.plan); } else if (!strcasecmp(var, "outbound-bearer_cap")) { - ftdm_span_set_bearer_capability(val, &span->default_caller_data.bearer_capability); + ftdm_set_bearer_capability(val, (uint8_t*)&span->default_caller_data.bearer_capability); } else if (!strcasecmp(var, "outbound-bearer_layer1")) { - ftdm_span_set_bearer_layer1(val, &span->default_caller_data.bearer_layer1); - ftdm_set_bearer_layer1(val, (uint8_t*)&span->default_caller_data.bearer_layer1); - } else if (!strcasecmp(var, "local-number")) { ++ ftdm_set_bearer_layer1(val, &span->default_caller_data.bearer_layer1); + } else if (!strcasecmp(var, "channel-restart-on-link-up")) { - if (!strcasecmp(val, "yes")) { - signal_data->restart_opt = SNGISDN_OPT_TRUE; - } else if (!strcasecmp(val, "no")) { - signal_data->restart_opt = SNGISDN_OPT_FALSE; - } else { - ftdm_log(FTDM_LOG_ERROR, "Invalid value for parameter:%s:%s\n", var, val); - } - ++ parse_yesno(var, val, &signal_data->restart_opt); + } else if (!strcasecmp(var, "local-number")) { if (add_local_number(val, span) != FTDM_SUCCESS) { return FTDM_FAIL; } diff --cc libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index f3fc23e,6bf0c25..c4e9f4a --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@@ -151,33 -154,31 +153,34 @@@ void sngisdn_process_con_ind (sngisdn_e if (conEvnt->facilityStr.eh.pres) { if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - get_facility_ie(&ftdmchan->caller_data, conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len); + get_facility_ie(ftdmchan, &conEvnt->facilityStr); } else if (signal_data->facility == SNGISDN_OPT_TRUE) { - /* Verify whether the Caller Name will come in a subsequent FACILITY message */ - uint16_t ret_val; - char retrieved_str[255]; - - ret_val = sng_isdn_retrieve_facility_caller_name(conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len, retrieved_str); - /* - return values for "sng_isdn_retrieve_facility_information_following": - If there will be no information following, or fails to decode IE, returns -1 - If there will be no information following, but current FACILITY IE contains a caller name, returns 0 - If there will be information following, returns 1 - */ - - if (ret_val == 1) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Expecting Caller name in FACILITY\n"); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_GET_CALLERID); - /* Launch timer in case we never get a FACILITY msg */ - if (signal_data->facility_timeout) { - ftdm_sched_timer(signal_data->sched, "facility_timeout", signal_data->facility_timeout, - sngisdn_facility_timeout, (void*) sngisdn_info, &sngisdn_info->timers[SNGISDN_TIMER_FACILITY]); + if (signal_data->switchtype == SNGISDN_SWITCH_NI2) { + /* Verify whether the Caller Name will come in a subsequent FACILITY message */ + uint16_t ret_val; + char retrieved_str[255]; + + ret_val = sng_isdn_retrieve_facility_caller_name(conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len, retrieved_str); + /* + return values for "sng_isdn_retrieve_facility_information_following": + If there will be no information following, or fails to decode IE, returns -1 + If there will be no information following, but current FACILITY IE contains a caller name, returns 0 + If there will be information following, returns 1 + */ + + if (ret_val == 1) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Expecting Caller name in FACILITY\n"); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_GET_CALLERID); + /* Launch timer in case we never get a FACILITY msg */ + if (signal_data->facility_timeout) { + ftdm_sched_timer(signal_data->sched, "facility_timeout", signal_data->facility_timeout, + sngisdn_facility_timeout, (void*) sngisdn_info, &sngisdn_info->timers[SNGISDN_TIMER_FACILITY]); + } + break; + } else if (ret_val == 0) { + strcpy(ftdmchan->caller_data.cid_name, retrieved_str); } + break; - } else if (ret_val == 0) { - strcpy(ftdmchan->caller_data.cid_name, retrieved_str); } } } @@@ -372,21 -377,15 +379,18 @@@ void sngisdn_process_cnst_ind (sngisdn_ goto sngisdn_process_cnst_ind_end; } } - /* fall-through */ - case MI_ALERTING: - case MI_CALLPROC: - + switch(ftdmchan->state) { case FTDM_CHANNEL_STATE_DIALING: + case FTDM_CHANNEL_STATE_PROCEED: if (cnStEvnt->progInd.eh.pres && cnStEvnt->progInd.progDesc.val == IN_PD_IBAVAIL) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); + } else if (evntType == MI_CALLPROC) { + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROCEED); } else { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); } + break; - case FTDM_CHANNEL_STATE_PROCEED: case FTDM_CHANNEL_STATE_PROGRESS: if (cnStEvnt->progInd.eh.pres && cnStEvnt->progInd.progDesc.val == IN_PD_IBAVAIL) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); diff --cc libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index 65c587c,c13455d..fbb827e --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@@ -785,110 -777,44 +785,113 @@@ static FIO_COMMAND_FUNCTION(wanpipe_com return FTDM_SUCCESS; } -static void wanpipe_read_stats(ftdm_channel_t *ftdmchan, wp_tdm_api_rx_hdr_t *rx_stats) +static void wanpipe_write_stats(ftdm_channel_t *ftdmchan, wp_tdm_api_tx_hdr_t *tx_stats) { - ftdmchan->iostats.stats.rx.flags = 0; + ftdmchan->iostats.tx.errors = tx_stats->wp_api_tx_hdr_errors; + ftdmchan->iostats.tx.queue_size = tx_stats->wp_api_tx_hdr_max_queue_length; + ftdmchan->iostats.tx.queue_len = tx_stats->wp_api_tx_hdr_number_of_frames_in_queue; + + if (ftdmchan->iostats.tx.queue_len >= (0.8 * ftdmchan->iostats.tx.queue_size)) { + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Tx Queue length exceeded 80% threshold (%d/%d)\n", + ftdmchan->iostats.tx.queue_len, ftdmchan->iostats.tx.queue_size); + ftdm_set_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_THRES); + } else if (ftdm_test_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_THRES)){ + ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Tx Queue length reduced 80% threshold (%d/%d)\n", + ftdmchan->iostats.tx.queue_len, ftdmchan->iostats.tx.queue_size); + ftdm_clear_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_THRES); + } + - if (ftdmchan->iostats.tx.queue_len >= ftdmchan->iostats.rx.queue_size) { ++ if (ftdmchan->iostats.tx.queue_len >= ftdmchan->iostats.tx.queue_size) { + ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Tx Queue Full (%d/%d)\n", - ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); - ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_FULL); ++ ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.tx.queue_size); ++ ftdm_set_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_FULL); + } else if (ftdm_test_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_FULL)){ + ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Tx Queue no longer full (%d/%d)\n", + ftdmchan->iostats.tx.queue_len, ftdmchan->iostats.tx.queue_size); + ftdm_clear_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_FULL); + } - ftdmchan->iostats.stats.rx.errors = rx_stats->wp_api_rx_hdr_errors; - ftdmchan->iostats.stats.rx.rx_queue_size = rx_stats->wp_api_rx_hdr_max_queue_length; - ftdmchan->iostats.stats.rx.rx_queue_len = rx_stats->wp_api_rx_hdr_number_of_frames_in_queue; + if (ftdmchan->iostats.tx.idle_packets < tx_stats->wp_api_tx_hdr_number_of_frames_in_queue) { + ftdmchan->iostats.tx.idle_packets = tx_stats->wp_api_tx_hdr_tx_idle_packets; - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Tx idle: %d\n", ftdmchan->iostats.tx.idle_packets); ++ /* HDLC channels do not always transmit, so its ok for drivers to fill with idle */ ++ if (FTDM_IS_VOICE_CHANNEL(ftdmchan)) { ++ ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Tx idle: %d\n", ftdmchan->iostats.tx.idle_packets); ++ } + } + + if (!ftdmchan->iostats.tx.packets) { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "First packet write stats: Tx queue len: %d, Tx queue size: %d, Tx idle: %d\n", + ftdmchan->iostats.tx.queue_len, + ftdmchan->iostats.tx.queue_size, + ftdmchan->iostats.tx.idle_packets); + } + + ftdmchan->iostats.tx.packets++; +} + +static void wanpipe_read_stats(ftdm_channel_t *ftdmchan, wp_tdm_api_rx_hdr_t *rx_stats) +{ + ftdmchan->iostats.rx.errors = rx_stats->wp_api_rx_hdr_errors; + ftdmchan->iostats.rx.queue_size = rx_stats->wp_api_rx_hdr_max_queue_length; + ftdmchan->iostats.rx.queue_len = rx_stats->wp_api_rx_hdr_number_of_frames_in_queue; - if (rx_stats->wp_api_rx_hdr_error_map & (1<<WP_ABORT_ERROR_BIT)) { - ftdm_set_flag(&(ftdmchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_ABORT); + if ((rx_stats->wp_api_rx_hdr_error_map & (1 << WP_ABORT_ERROR_BIT))) { + ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_ABORT); + } else { + ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_ABORT); } - if (rx_stats->wp_api_rx_hdr_error_map & (1<<WP_DMA_ERROR_BIT)) { - ftdm_set_flag(&(ftdmchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_DMA); + + if ((rx_stats->wp_api_rx_hdr_error_map & (1 << WP_DMA_ERROR_BIT))) { + ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_DMA); + } else { + ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_DMA); } - if (rx_stats->wp_api_rx_hdr_error_map & (1<<WP_FIFO_ERROR_BIT)) { - ftdm_set_flag(&(ftdmchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_FIFO); + + if ((rx_stats->wp_api_rx_hdr_error_map & (1 << WP_FIFO_ERROR_BIT))) { + ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_FIFO); + } else { + ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_FIFO); } - if (rx_stats->wp_api_rx_hdr_error_map & (1<<WP_CRC_ERROR_BIT)) { - ftdm_set_flag(&(ftdmchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_CRC); + + if ((rx_stats->wp_api_rx_hdr_error_map & (1 << WP_CRC_ERROR_BIT))) { + ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_CRC); + } else { + ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_CRC); } - if (rx_stats->wp_api_rx_hdr_error_map & (1<<WP_FRAME_ERROR_BIT)) { - ftdm_set_flag(&(ftdmchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_FRAME); + + if ((rx_stats->wp_api_rx_hdr_error_map & (1 << WP_FRAME_ERROR_BIT))) { + ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_FRAME); + } else { + ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_FRAME); } - if (ftdmchan->iostats.stats.rx.rx_queue_len >= (0.8*ftdmchan->iostats.stats.rx.rx_queue_size)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Rx Queue length exceeded threshold (%d/%d)\n", - ftdmchan->iostats.stats.rx.rx_queue_len, ftdmchan->iostats.stats.rx.rx_queue_size); - - ftdm_set_flag(&(ftdmchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES); + if (ftdmchan->iostats.rx.queue_len >= (0.8 * ftdmchan->iostats.rx.queue_size)) { + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Rx Queue length exceeded 80% threshold (%d/%d)\n", + ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); + ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES); + } else if (ftdm_test_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES)){ + /* any reason we have wanpipe_tdm_api_iface.h in ftmod_wanpipe/ dir? */ + ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Rx Queue length reduced 80% threshold (%d/%d)\n", + ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); + ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES); } - if (ftdmchan->iostats.stats.rx.rx_queue_len >= ftdmchan->iostats.stats.rx.rx_queue_size) { + if (ftdmchan->iostats.rx.queue_len >= ftdmchan->iostats.rx.queue_size) { ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Rx Queue Full (%d/%d)\n", - ftdmchan->iostats.stats.rx.rx_queue_len, ftdmchan->iostats.stats.rx.rx_queue_size); - - ftdm_set_flag(&(ftdmchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_QUEUE_FULL); + ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); + ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_FULL); + } else if (ftdm_test_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_FULL)){ + ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Rx Queue no longer full (%d/%d)\n", + ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); + ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_FULL); } - return; + + if (!ftdmchan->iostats.rx.packets) { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "First packet read stats: Rx queue len: %d, Rx queue size: %d\n", + ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); + } + + ftdmchan->iostats.rx.packets++; } /** commit 302d5bb18f5604c180d1eb3c48b80929e1b306ae Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Nov 25 19:19:32 2010 -0500 Changes for ftdm variables diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 27dc8d8..07d4e88 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -149,6 +149,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id); static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id); static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig); +static const char* channel_get_variable(switch_core_session_t *session, switch_event_t *var_event, const char *variable_name); ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session_t **sp); void dump_chan(ftdm_span_t *span, uint32_t chan_id, switch_stream_handle_t *stream); void dump_chan_xml(ftdm_span_t *span, uint32_t chan_id, switch_stream_handle_t *stream); @@ -1049,6 +1050,27 @@ switch_io_routines_t freetdm_io_routines = { /*.receive_message*/ channel_receive_message }; +static const char* channel_get_variable(switch_core_session_t *session, switch_event_t *var_event, const char *variable_name) +{ + const char *variable = NULL; + + if (var_event) { + if ((variable = switch_event_get_header(var_event, variable_name))) { + return variable; + } + } + if (session) { + switch_channel_t *channel = switch_core_session_get_channel(session); + if ((variable = switch_channel_get_variable(channel, variable_name))) { + return variable; + } + } + if ((variable = switch_core_get_variable(variable_name))) { + return variable; + } + return NULL; +} + /* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines that allocate memory or you will have 1 channel with memory allocated from another channel's pool! */ @@ -1226,20 +1248,6 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi } } - if (session) { - /* take out some other values from the session if they're present */ - switch_channel_t *channel = switch_core_session_get_channel(session); - const char *freetdmvar; - freetdmvar = switch_channel_get_variable(channel, "freetdm_bearer_capability"); - if (freetdmvar) { - caller_data.bearer_capability = (uint8_t)atoi(freetdmvar); - } - freetdmvar = switch_channel_get_variable(channel, "freetdm_bearer_layer1"); - if (freetdmvar) { - caller_data.bearer_layer1 = (uint8_t)atoi(freetdmvar); - } - } - if (switch_test_flag(outbound_profile, SWITCH_CPF_SCREEN)) { caller_data.screen = 1; } @@ -1248,29 +1256,37 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi caller_data.pres = 1; } - if (!zstr(dest)) { - ftdm_set_string(caller_data.dnis.digits, dest); + if ((var = channel_get_variable(session, var_event, "freetdm_bearer_capability"))) { + caller_data.bearer_capability = (uint8_t)atoi(var); } - if ((var = switch_event_get_header(var_event, "freetdm_outbound_ton")) || (var = switch_core_get_variable("freetdm_outbound_ton"))) { - if (!strcasecmp(var, "national")) { - caller_data.dnis.type = FTDM_TON_NATIONAL; - } else if (!strcasecmp(var, "international")) { - caller_data.dnis.type = FTDM_TON_INTERNATIONAL; - } else if (!strcasecmp(var, "local")) { - caller_data.dnis.type = FTDM_TON_SUBSCRIBER_NUMBER; - } else if (!strcasecmp(var, "unknown")) { - caller_data.dnis.type = FTDM_TON_UNKNOWN; - } + if ((var = channel_get_variable(session, var_event, "freetdm_bearer_layer1"))) { + caller_data.bearer_layer1 = (uint8_t)atoi(var); + } + + if ((var = channel_get_variable(session, var_event, "freetdm_screening_ind"))) { + ftdm_set_screening_ind(var, &caller_data.screen); + } + + if ((var = channel_get_variable(session, var_event, "freetdm_presentation_ind"))) { + ftdm_set_presentation_ind(var, &caller_data.pres); + } + + if ((var = channel_get_variable(session, var_event, "freetdm_outbound_ton"))) { + ftdm_set_ton(var, &caller_data.dnis.type); } else { caller_data.dnis.type = outbound_profile->destination_number_ton; } - if ((var = switch_event_get_header(var_event, "freetdm_custom_call_data")) || (var = switch_core_get_variable("freetdm_custom_call_data"))) { + if ((var = channel_get_variable(session, var_event, "freetdm_custom_call_data"))) { ftdm_set_string(caller_data.raw_data, var); caller_data.raw_data_len = (uint32_t)strlen(var); } + if (!zstr(dest)) { + ftdm_set_string(caller_data.dnis.digits, dest); + } + caller_data.dnis.plan = outbound_profile->destination_number_numplan; /* blindly copy data from outbound_profile. They will be overwritten @@ -2074,6 +2090,9 @@ static FIO_SIGNAL_CB_FUNCTION(on_clear_channel_signal) switch(sigmsg->event_id) { case FTDM_SIGEVENT_START: { + ftdm_channel_add_var(sigmsg->channel, "screening_ind", ftdm_screening2str(caller_data->screen)); + ftdm_channel_add_var(sigmsg->channel, "presentation_ind", ftdm_presentation2str(caller_data->pres)); + ftdm_enable_channel_dtmf(sigmsg->channel, NULL); return ftdm_channel_from_event(sigmsg, &session); } diff --git a/libs/freetdm/src/ftdm_call_utils.c b/libs/freetdm/src/ftdm_call_utils.c index d91b3bc..52d2557 100644 --- a/libs/freetdm/src/ftdm_call_utils.c +++ b/libs/freetdm/src/ftdm_call_utils.c @@ -36,80 +36,101 @@ #include <ctype.h> -FT_DECLARE(ftdm_status_t) ftdm_span_set_npi(const char *npi_string, uint8_t *target) +FT_DECLARE(ftdm_status_t) ftdm_set_npi(const char *string, uint8_t *target) { - if (!strcasecmp(npi_string, "isdn") || !strcasecmp(npi_string, "e164")) { - *target = FTDM_NPI_ISDN; - } else if (!strcasecmp(npi_string, "data")) { - *target = FTDM_NPI_DATA; - } else if (!strcasecmp(npi_string, "telex")) { - *target = FTDM_NPI_TELEX; - } else if (!strcasecmp(npi_string, "national")) { - *target = FTDM_NPI_NATIONAL; - } else if (!strcasecmp(npi_string, "private")) { - *target = FTDM_NPI_PRIVATE; - } else if (!strcasecmp(npi_string, "reserved")) { - *target = FTDM_NPI_RESERVED; - } else if (!strcasecmp(npi_string, "unknown")) { - *target = FTDM_NPI_UNKNOWN; - } else { - ftdm_log(FTDM_LOG_WARNING, "Invalid NPI value (%s)\n", npi_string); - *target = FTDM_NPI_UNKNOWN; - return FTDM_FAIL; + int val; + ftdm_status_t status = FTDM_SUCCESS; + + val = ftdm_str2ftdm_npi(string); + if (val == FTDM_NPI_INVALID) { + ftdm_log(FTDM_LOG_WARNING, "Invalid NPI string (%s)\n", string); + status = FTDM_FAIL; + val = FTDM_NPI_UNKNOWN; } - return FTDM_SUCCESS; + *target = val; + return status; } -FT_DECLARE(ftdm_status_t) ftdm_span_set_ton(const char *ton_string, uint8_t *target) +FT_DECLARE(ftdm_status_t) ftdm_set_ton(const char *string, uint8_t *target) { - if (!strcasecmp(ton_string, "national")) { - *target = FTDM_TON_NATIONAL; - } else if (!strcasecmp(ton_string, "international")) { - *target = FTDM_TON_INTERNATIONAL; - } else if (!strcasecmp(ton_string, "local")) { - *target = FTDM_TON_SUBSCRIBER_NUMBER; - } else if (!strcasecmp(ton_string, "unknown")) { - *target = FTDM_TON_UNKNOWN; - } else { - ftdm_log(FTDM_LOG_WARNING, "Invalid TON value (%s)\n", ton_string); - *target = FTDM_TON_UNKNOWN; - return FTDM_FAIL; + int val; + ftdm_status_t status = FTDM_SUCCESS; + + val = ftdm_str2ftdm_ton(string); + if (val == FTDM_TON_INVALID) { + ftdm_log(FTDM_LOG_WARNING, "Invalid TON string (%s)\n", string); + status = FTDM_FAIL; + val = FTDM_TON_UNKNOWN; } - return FTDM_SUCCESS; + *target = val; + return status; } -FT_DECLARE(ftdm_status_t) ftdm_span_set_bearer_capability(const char *bc_string, ftdm_bearer_cap_t *target) +FT_DECLARE(ftdm_status_t) ftdm_set_bearer_capability(const char *string, uint8_t *target) { - if (!strcasecmp(bc_string, "speech")) { - *target = FTDM_BEARER_CAP_SPEECH; - } else if (!strcasecmp(bc_string, "unrestricted-digital")) { - *target = FTDM_BEARER_CAP_64K_UNRESTRICTED; - } else if (!strcasecmp(bc_string, "3.1Khz")) { - *target = FTDM_BEARER_CAP_3_1KHZ_AUDIO; - } else { - ftdm_log(FTDM_LOG_WARNING, "Unsupported Bearer Capability value (%s)\n", bc_string); - return FTDM_FAIL; + int val; + ftdm_status_t status = FTDM_SUCCESS; + + val = ftdm_str2ftdm_bearer_cap(string); + if (val == FTDM_NPI_INVALID) { + ftdm_log(FTDM_LOG_WARNING, "Invalid Bearer-Capability string (%s)\n", string); + status = FTDM_FAIL; + val = FTDM_BEARER_CAP_SPEECH; } - return FTDM_SUCCESS; + + *target = val; + return status; } -FT_DECLARE(ftdm_status_t) ftdm_span_set_bearer_layer1(const char *bc_string, ftdm_user_layer1_prot_t *target) +FT_DECLARE(ftdm_status_t) ftdm_set_bearer_layer1(const char *string, uint8_t *target) { - if (!strcasecmp(bc_string, "v110")) { - *target = FTDM_USER_LAYER1_PROT_V110; - } else if (!strcasecmp(bc_string, "ulaw")) { - *target = FTDM_USER_LAYER1_PROT_ULAW; - } else if (!strcasecmp(bc_string, "alaw")) { - *target =FTDM_USER_LAYER1_PROT_ALAW ; - } else { - ftdm_log(FTDM_LOG_WARNING, "Unsupported Bearer Layer1 Prot value (%s)\n", bc_string); - return FTDM_FAIL; + int val; + ftdm_status_t status = FTDM_SUCCESS; + + val = ftdm_str2ftdm_usr_layer1_prot(string); + if (val == FTDM_USER_LAYER1_PROT_INVALID) { + ftdm_log(FTDM_LOG_WARNING, "Invalid Bearer Layer 1 Protocol string (%s)\n", string); + status = FTDM_FAIL; + val = FTDM_USER_LAYER1_PROT_ULAW; } - return FTDM_SUCCESS; + + *target = val; + return status; +} + +FT_DECLARE(ftdm_status_t) ftdm_set_screening_ind(const char *string, uint8_t *target) +{ + int val; + ftdm_status_t status = FTDM_SUCCESS; + + val = ftdm_str2ftdm_screening(string); + if (val == FTDM_SCREENING_INVALID) { + ftdm_log(FTDM_LOG_WARNING, "Invalid screening indicator string (%s)\n", string); + status = FTDM_FAIL; + val = FTDM_SCREENING_NOT_SCREENED; + } + + *target = val; + return status; } +FT_DECLARE(ftdm_status_t) ftdm_set_presentation_ind(const char *string, uint8_t *target) +{ + int val; + ftdm_status_t status = FTDM_SUCCESS; + + val = ftdm_str2ftdm_presentation(string); + if (val == FTDM_PRES_INVALID) { + ftdm_log(FTDM_LOG_WARNING, "Invalid presentation string (%s)\n", string); + status = FTDM_FAIL; + val = FTDM_PRES_ALLOWED; + } + + *target = val; + return status; +} -FT_DECLARE(ftdm_status_t) ftdm_is_number(char *number) +FT_DECLARE(ftdm_status_t) ftdm_is_number(const char *number) { if (!number) { return FTDM_FAIL; diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index ede3ff8..3e48586 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -150,6 +150,24 @@ FTDM_STR2ENUM(ftdm_str2ftdm_chan_type, ftdm_chan_type2str, ftdm_chan_type_t, CHA FTDM_ENUM_NAMES(SIGNALING_STATUS_NAMES, SIGSTATUS_STRINGS) FTDM_STR2ENUM(ftdm_str2ftdm_signaling_status, ftdm_signaling_status2str, ftdm_signaling_status_t, SIGNALING_STATUS_NAMES, FTDM_SIG_STATE_INVALID) +FTDM_ENUM_NAMES(TON_NAMES, TON_STRINGS) +FTDM_STR2ENUM(ftdm_str2ftdm_ton, ftdm_ton2str, ftdm_ton_t, TON_NAMES, FTDM_TON_INVALID) + +FTDM_ENUM_NAMES(NPI_NAMES, NPI_STRINGS) +FTDM_STR2ENUM(ftdm_str2ftdm_npi, ftdm_npi2str, ftdm_npi_t, NPI_NAMES, FTDM_NPI_INVALID) + +FTDM_ENUM_NAMES(PRESENTATION_NAMES, PRESENTATION_STRINGS) +FTDM_STR2ENUM(ftdm_str2ftdm_presentation, ftdm_presentation2str, ftdm_presentation_t, PRESENTATION_NAMES, FTDM_PRES_INVALID) + +FTDM_ENUM_NAMES(SCREENING_NAMES, SCREENING_STRINGS) +FTDM_STR2ENUM(ftdm_str2ftdm_screening, ftdm_screening2str, ftdm_screening_t, SCREENING_NAMES, FTDM_SCREENING_INVALID) + +FTDM_ENUM_NAMES(BEARER_CAP_NAMES, BEARER_CAP_STRINGS) +FTDM_STR2ENUM(ftdm_str2ftdm_bearer_cap, ftdm_bearer_cap2str, ftdm_bearer_cap_t, BEARER_CAP_NAMES, FTDM_BEARER_CAP_INVALID) + +FTDM_ENUM_NAMES(USER_LAYER1_PROT_NAMES, USER_LAYER1_PROT_STRINGS) +FTDM_STR2ENUM(ftdm_str2ftdm_usr_layer1_prot, ftdm_user_layer1_prot2str, ftdm_user_layer1_prot_t, USER_LAYER1_PROT_NAMES, FTDM_USER_LAYER1_PROT_INVALID) + static ftdm_status_t ftdm_group_add_channels(ftdm_span_t* span, int currindex, const char* name); static const char *cut_path(const char *in) @@ -4822,7 +4840,7 @@ FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t if (sigmsg->channel) { ftdm_mutex_lock(sigmsg->channel->mutex); } - + /* some core things to do on special events */ switch (sigmsg->event_id) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftdm_sangoma_boost.h b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftdm_sangoma_boost.h index 5a3ca76..6fbf272 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftdm_sangoma_boost.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftdm_sangoma_boost.h @@ -58,7 +58,7 @@ typedef struct ftdm_sangoma_boost_trunkgroup { ftdm_size_t size; /* Number of b-channels in group */ unsigned int last_used_index; /* index of last b-channel used */ ftdm_channel_t* ftdmchans[MAX_CHANS_PER_TRUNKGROUP]; - //DAVIDY need to merge congestion timeouts to this struct + //TODO need to merge congestion timeouts to this struct } ftdm_sangoma_boost_trunkgroup_t; #endif diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c index c9691e2..50a01cc 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c @@ -55,7 +55,7 @@ ftdm_mutex_t *g_boost_modules_mutex = NULL; ftdm_hash_t *g_boost_modules_hash = NULL; #define MAX_TRUNK_GROUPS 64 -//DAVIDY need to merge congestion_timeouts with ftdm_sangoma_boost_trunkgroups +//TODO need to merge congestion_timeouts with ftdm_sangoma_boost_trunkgroups static time_t congestion_timeouts[MAX_TRUNK_GROUPS]; static ftdm_sangoma_boost_trunkgroup_t *g_trunkgroups[MAX_TRUNK_GROUPS]; @@ -2582,17 +2582,17 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_boost_configure_span) } else if (!strcasecmp(var, "remote_port")) { remote_port = atoi(val); } else if (!strcasecmp(var, "outbound-called-ton")) { - ftdm_span_set_ton(val, &span->default_caller_data.dnis.type); + ftdm_set_ton(val, &span->default_caller_data.dnis.type); } else if (!strcasecmp(var, "outbound-called-npi")) { - ftdm_span_set_npi(val, &span->default_caller_data.dnis.plan); + ftdm_set_npi(val, &span->default_caller_data.dnis.plan); } else if (!strcasecmp(var, "outbound-calling-ton")) { - ftdm_span_set_ton(val, &span->default_caller_data.cid_num.type); + ftdm_set_ton(val, &span->default_caller_data.cid_num.type); } else if (!strcasecmp(var, "outbound-calling-npi")) { - ftdm_span_set_npi(val, &span->default_caller_data.cid_num.plan); + ftdm_set_npi(val, &span->default_caller_data.cid_num.plan); } else if (!strcasecmp(var, "outbound-rdnis-ton")) { - ftdm_span_set_ton(val, &span->default_caller_data.rdnis.type); + ftdm_set_ton(val, &span->default_caller_data.rdnis.type); } else if (!strcasecmp(var, "outbound-rdnis-npi")) { - ftdm_span_set_npi(val, &span->default_caller_data.rdnis.plan); + ftdm_set_npi(val, &span->default_caller_data.rdnis.plan); } else if (!sigmod) { snprintf(span->last_error, sizeof(span->last_error), "Unknown parameter [%s]", var); FAIL_CONFIG_RETURN(FTDM_FAIL); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 6f5f838..8831ac4 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -40,8 +40,8 @@ #include <sys/mman.h> #endif -static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj); +static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj); static ftdm_status_t ftdm_sangoma_isdn_stop(ftdm_span_t *span); static ftdm_status_t ftdm_sangoma_isdn_start(ftdm_span_t *span); @@ -673,7 +673,8 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) break; case FTDM_CHANNEL_STATE_RINGING: { - sngisdn_snd_alert(ftdmchan, SNGISDN_PROGIND_NETE_ISDN); + ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_NETE_ISDN}; + sngisdn_snd_alert(ftdmchan, prog_ind); } break; case FTDM_CHANNEL_STATE_PROGRESS: @@ -687,7 +688,8 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) /* If we already sent a PROCEED before, do not send a PROGRESS as there is nothing to indicate to the remote switch */ if (ftdmchan->last_state != FTDM_CHANNEL_STATE_PROCEED) { /* Send a progress message, indicating: Call is not end-to-end ISDN, further call progress may be available */ - sngisdn_snd_progress(ftdmchan, SNGISDN_PROGIND_NETE_ISDN); + ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_NETE_ISDN}; + sngisdn_snd_progress(ftdmchan, prog_ind); } } } @@ -699,7 +701,8 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) ftdm_span_send_signal(ftdmchan->span, &sigev); } else { /* Send a progress message, indicating: In-band information/pattern available */ - sngisdn_snd_progress(ftdmchan, SNGISDN_PROGIND_IB_AVAIL); + ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_IB_AVAIL}; + sngisdn_snd_progress(ftdmchan, prog_ind); } } break; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index a82ed28..6957f99 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -138,17 +138,47 @@ typedef enum { typedef enum { /* Call is not end-to-end ISDN */ - SNGISDN_PROGIND_NETE_ISDN = 1, + SNGISDN_PROGIND_DESCR_NETE_ISDN, /* Destination address is non-ISDN */ - SNGISDN_PROGIND_DEST_NISDN, + SNGISDN_PROGIND_DESCR_DEST_NISDN, /* Origination address is non-ISDN */ - SNGISDN_PROGIND_ORIG_NISDN, + SNGISDN_PROGIND_DESCR_ORIG_NISDN, /* Call has returned to the ISDN */ - SNGISDN_PROGIND_RET_ISDN, + SNGISDN_PROGIND_DESCR_RET_ISDN, /* Interworking as occured and has resulted in a telecommunication service change */ - SNGISDN_PROGIND_SERV_CHANGE, - /* In-band information or an appropriate pattern is now available */ - SNGISDN_PROGIND_IB_AVAIL, + SNGISDN_PROGIND_DESCR_SERV_CHANGE, + /* In-band information or an appropriate pattern is now available */ + SNGISDN_PROGIND_DESCR_IB_AVAIL, + /* Invalid */ + SNGISDN_PROGIND_DESCR_INVALID, +} ftdm_sngisdn_progind_descr_t; +#define SNGISDN_PROGIND_DESCR_STRINGS "not-end-to-end-isdn", "destination-is-non-isdn", "origination-is-non-isdn", "call-returned-to-isdn", "service-change", "inband-info-available", "invalid" +FTDM_STR2ENUM_P(ftdm_str2ftdm_sngisdn_progind_descr, ftdm_sngisdn_progind_descr2str, ftdm_sngisdn_progind_descr_t); + +typedef enum { + /* User */ + SNGISDN_PROGIND_LOC_USER, + /* Private network serving the local user */ + SNGISDN_PROGIND_LOC_PRIV_NET_LOCAL_USR, + /* Public network serving the local user */ + SNGISDN_PROGIND_LOC_PUB_NET_LOCAL_USR, + /* Transit network */ + SNGISDN_PROGIND_LOC_TRANSIT_NET, + /* Public network serving remote user */ + SNGISDN_PROGIND_LOC_PUB_NET_REMOTE_USR, + /* Private network serving remote user */ + SNGISDN_PROGIND_LOC_PRIV_NET_REMOTE_USR, + /* Network beyond the interworking point */ + SNGISDN_PROGIND_LOC_NET_BEYOND_INTRW, + /* Invalid */ + SNGISDN_PROGIND_LOC_INVALID, +} ftdm_sngisdn_progind_loc_t; +#define SNGISDN_PROGIND_LOC_STRINGS "user", "private-net-local-user", "public-net-local-user", "transit-network", "public-net-remote-user", "private-net-remote-user", "beyond-interworking", "invalid" +FTDM_STR2ENUM_P(ftdm_str2ftdm_sngisdn_progind_loc, ftdm_sngisdn_progind_loc2str, ftdm_sngisdn_progind_loc_t); + +typedef struct ftdm_sngisdn_prog_ind { + ftdm_sngisdn_progind_loc_t loc; /* location */ + ftdm_sngisdn_progind_descr_t descr; /* description */ } ftdm_sngisdn_progind_t; /* Only timers that can be cancelled are listed here */ @@ -201,6 +231,7 @@ typedef struct sngisdn_span_data { uint8_t facility; int8_t facility_timeout; uint8_t num_local_numbers; + uint8_t ignore_cause_value; uint8_t timer_t3; char* local_numbers[SNGISDN_NUM_LOCAL_NUMBERS]; ftdm_sched_t *sched; @@ -376,18 +407,25 @@ void sngisdn_rcv_cc_ind(CcMngmt *status); void sngisdn_rcv_sng_log(uint8_t level, char *fmt,...); void sngisdn_rcv_sng_assert(char *message); -ftdm_status_t get_calling_num(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb); -ftdm_status_t get_called_num(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb); -ftdm_status_t get_redir_num(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb); -ftdm_status_t get_calling_name_from_display(ftdm_caller_data_t *ftdm, Display *display); -ftdm_status_t get_calling_name_from_usr_usr(ftdm_caller_data_t *ftdm, UsrUsr *usrUsr); -ftdm_status_t get_facility_ie(ftdm_caller_data_t *ftdm, uint8_t *data, uint32_t data_len); - -ftdm_status_t set_calling_num(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm); -ftdm_status_t set_called_num(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm); -ftdm_status_t set_redir_num(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm); -ftdm_status_t set_calling_name(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan); +ftdm_status_t get_calling_num(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb); +ftdm_status_t get_called_num(ftdm_channel_t *ftdmchan, CdPtyNmb *cdPtyNmb); +ftdm_status_t get_redir_num(ftdm_channel_t *ftdmchan, RedirNmb *redirNmb); +ftdm_status_t get_calling_name_from_display(ftdm_channel_t *ftdmchan, Display *display); +ftdm_status_t get_calling_name_from_usr_usr(ftdm_channel_t *ftdmchan, UsrUsr *usrUsr); +ftdm_status_t get_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad); +ftdm_status_t get_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd); +ftdm_status_t get_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr); +ftdm_status_t get_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, ftdm_size_t data_len); + +ftdm_status_t set_calling_num(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb); +ftdm_status_t set_called_num(ftdm_channel_t *ftdmchan, CdPtyNmb *cdPtyNmb); +ftdm_status_t set_redir_num(ftdm_channel_t *ftdmchan, RedirNmb *redirNmb); +ftdm_status_t set_calling_name(ftdm_channel_t *ftdmchan, ConEvnt *conEvnt); +ftdm_status_t set_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad); +ftdm_status_t set_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd, ftdm_sngisdn_progind_t prog_ind); ftdm_status_t set_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr); +ftdm_status_t set_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, ftdm_size_t *data_len); + uint8_t sngisdn_get_infoTranCap_from_stack(ftdm_bearer_cap_t bearer_capability); uint8_t sngisdn_get_usrInfoLyr1Prot_from_stack(ftdm_user_layer1_prot_t layer1_prot); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c index 657aa5e..6b4e73a 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c @@ -34,13 +34,24 @@ #include "ftmod_sangoma_isdn.h" -ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span); -ftdm_status_t parse_signalling(const char* signalling, ftdm_span_t *span); -ftdm_status_t add_local_number(const char* val, ftdm_span_t *span); +static ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span); +static ftdm_status_t parse_signalling(const char* signalling, ftdm_span_t *span); +static ftdm_status_t add_local_number(const char* val, ftdm_span_t *span); +static ftdm_status_t parse_yesno(const char* var, const char* val, uint8_t *target); extern ftdm_sngisdn_data_t g_sngisdn_data; -ftdm_status_t add_local_number(const char* val, ftdm_span_t *span) +static ftdm_status_t parse_yesno(const char* var, const char* val, uint8_t *target) +{ + if (ftdm_true(val)) { + *target = SNGISDN_OPT_TRUE; + } else { + *target = SNGISDN_OPT_FALSE; + } + return FTDM_SUCCESS; +} + +static ftdm_status_t add_local_number(const char* val, ftdm_span_t *span) { sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data; @@ -53,7 +64,7 @@ ftdm_status_t add_local_number(const char* val, ftdm_span_t *span) return FTDM_SUCCESS; } -ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span) +static ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span) { unsigned i; ftdm_iterator_t *chaniter = NULL; @@ -160,7 +171,7 @@ ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span) return FTDM_SUCCESS; } -ftdm_status_t parse_signalling(const char* signalling, ftdm_span_t *span) +static ftdm_status_t parse_signalling(const char* signalling, ftdm_span_t *span) { sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data; if (!strcasecmp(signalling, "net") || @@ -190,7 +201,8 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ signal_data->min_digits = 8; signal_data->overlap_dial = SNGISDN_OPT_DEFAULT; signal_data->setup_arb = SNGISDN_OPT_DEFAULT; - signal_data->facility_ie_decode = SNGISDN_OPT_TRUE; + signal_data->facility_ie_decode = SNGISDN_OPT_DEFAULT; + signal_data->ignore_cause_value = SNGISDN_OPT_DEFAULT; signal_data->timer_t3 = 8; signal_data->link_id = span->span_id; @@ -202,20 +214,19 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ if (span->trunk_type == FTDM_TRUNK_BRI || span->trunk_type == FTDM_TRUNK_BRI_PTMP) { - - ftdm_span_set_npi("unknown", &span->default_caller_data.dnis.plan); - ftdm_span_set_ton("unknown", &span->default_caller_data.dnis.type); - ftdm_span_set_npi("unknown", &span->default_caller_data.cid_num.plan); - ftdm_span_set_ton("unknown", &span->default_caller_data.cid_num.type); - ftdm_span_set_npi("unknown", &span->default_caller_data.rdnis.plan); - ftdm_span_set_ton("unknown", &span->default_caller_data.rdnis.type); + ftdm_set_npi("unknown", &span->default_caller_data.dnis.plan); + ftdm_set_ton("unknown", &span->default_caller_data.dnis.type); + ftdm_set_npi("unknown", &span->default_caller_data.cid_num.plan); + ftdm_set_ton("unknown", &span->default_caller_data.cid_num.type); + ftdm_set_npi("unknown", &span->default_caller_data.rdnis.plan); + ftdm_set_ton("unknown", &span->default_caller_data.rdnis.type); } else { - ftdm_span_set_npi("e164", &span->default_caller_data.dnis.plan); - ftdm_span_set_ton("national", &span->default_caller_data.dnis.type); - ftdm_span_set_npi("e164", &span->default_caller_data.cid_num.plan); - ftdm_span_set_ton("national", &span->default_caller_data.cid_num.type); - ftdm_span_set_npi("e164", &span->default_caller_data.rdnis.plan); - ftdm_span_set_ton("national", &span->default_caller_data.rdnis.type); + ftdm_set_npi("isdn", &span->default_caller_data.dnis.plan); + ftdm_set_ton("national", &span->default_caller_data.dnis.type); + ftdm_set_npi("isdn", &span->default_caller_data.cid_num.plan); + ftdm_set_ton("national", &span->default_caller_data.cid_num.type); + ftdm_set_npi("isdn", &span->default_caller_data.rdnis.plan); + ftdm_set_ton("national", &span->default_caller_data.rdnis.type); } for (paramindex = 0; ftdm_parameters[paramindex].var; paramindex++) { @@ -247,41 +258,29 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ } else { ftdm_log(FTDM_LOG_ERROR, "Invalid value for parameter:%s:%s\n", var, val); } - } else if (!strcasecmp(var, "setup arbitration")) { - if (!strcasecmp(val, "yes")) { - signal_data->setup_arb = SNGISDN_OPT_TRUE; - } else if (!strcasecmp(val, "no")) { - signal_data->setup_arb = SNGISDN_OPT_FALSE; - } else { - ftdm_log(FTDM_LOG_ERROR, "Invalid value for parameter:%s:%s\n", var, val); - } + } else if (!strcasecmp(var, "setup-arbitration")) { + parse_yesno(var, val, &signal_data->setup_arb); } else if (!strcasecmp(var, "facility")) { - if (!strcasecmp(val, "yes")) { - signal_data->facility = SNGISDN_OPT_TRUE; - } else if (!strcasecmp(val, "no")) { - signal_data->facility = SNGISDN_OPT_FALSE; - } else { - ftdm_log(FTDM_LOG_ERROR, "Invalid value for parameter:%s:%s\n", var, val); - } + parse_yesno(var, val, &signal_data->facility); } else if (!strcasecmp(var, "min_digits")) { signal_data->min_digits = atoi(val); } else if (!strcasecmp(var, "outbound-called-ton")) { - ftdm_span_set_ton(val, &span->default_caller_data.dnis.type); + ftdm_set_ton(val, &span->default_caller_data.dnis.type); } else if (!strcasecmp(var, "outbound-called-npi")) { - ftdm_span_set_npi(val, &span->default_caller_data.dnis.plan); + ftdm_set_npi(val, &span->default_caller_data.dnis.plan); } else if (!strcasecmp(var, "outbound-calling-ton")) { - ftdm_span_set_ton(val, &span->default_caller_data.cid_num.type); + ftdm_set_ton(val, &span->default_caller_data.cid_num.type); } else if (!strcasecmp(var, "outbound-calling-npi")) { - ftdm_span_set_npi(val, &span->default_caller_data.cid_num.plan); + ftdm_set_npi(val, &span->default_caller_data.cid_num.plan); } else if (!strcasecmp(var, "outbound-rdnis-ton")) { - ftdm_span_set_ton(val, &span->default_caller_data.rdnis.type); + ftdm_set_ton(val, &span->default_caller_data.rdnis.type); } else if (!strcasecmp(var, "outbound-rdnis-npi")) { - ftdm_span_set_npi(val, &span->default_caller_data.rdnis.plan); + ftdm_set_npi(val, &span->default_caller_data.rdnis.plan); } else if (!strcasecmp(var, "outbound-bearer_cap")) { - ftdm_span_set_bearer_capability(val, &span->default_caller_data.bearer_capability); + ftdm_set_bearer_capability(val, (uint8_t*)&span->default_caller_data.bearer_capability); } else if (!strcasecmp(var, "outbound-bearer_layer1")) { - ftdm_span_set_bearer_layer1(val, &span->default_caller_data.bearer_layer1); - } else if (!strcasecmp(var, "local-number")) { + ftdm_set_bearer_layer1(val, (uint8_t*)&span->default_caller_data.bearer_layer1); + } else if (!strcasecmp(var, "local-number")) { if (add_local_number(val, span) != FTDM_SUCCESS) { return FTDM_FAIL; } @@ -291,13 +290,9 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ signal_data->facility_timeout = 0; } } else if (!strcasecmp(var, "facility-ie-decode")) { - if (!strcasecmp(val, "yes")) { - signal_data->facility_ie_decode = SNGISDN_OPT_TRUE; - } else if (!strcasecmp(val, "no")) { - signal_data->facility_ie_decode = SNGISDN_OPT_FALSE; - } else { - ftdm_log(FTDM_LOG_ERROR, "Invalid value for parameter:%s:%s\n", var, val); - } + parse_yesno(var, val, &signal_data->facility_ie_decode); + } else if (!strcasecmp(var, "ignore-cause-value")) { + parse_yesno(var, val, &signal_data->ignore_cause_value); } else { ftdm_log(FTDM_LOG_WARNING, "Ignoring unknown parameter %s\n", ftdm_parameters[paramindex].var); } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index a541a65..6bf0c25 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -127,13 +127,15 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) ftdm_channel_add_var(ftdmchan, "isdn_specific_var", "1"); #endif /* Fill in call information */ - get_calling_num(&ftdmchan->caller_data, &conEvnt->cgPtyNmb); - get_called_num(&ftdmchan->caller_data, &conEvnt->cdPtyNmb); - get_redir_num(&ftdmchan->caller_data, &conEvnt->redirNmb); + get_calling_num(ftdmchan, &conEvnt->cgPtyNmb); + get_called_num(ftdmchan, &conEvnt->cdPtyNmb); + get_redir_num(ftdmchan, &conEvnt->redirNmb); + get_calling_subaddr(ftdmchan, &conEvnt->cgPtySad); - if (get_calling_name_from_display(&ftdmchan->caller_data, &conEvnt->display) != FTDM_SUCCESS) { - get_calling_name_from_usr_usr(&ftdmchan->caller_data, &conEvnt->usrUsr); + if (get_calling_name_from_display(ftdmchan, &conEvnt->display) != FTDM_SUCCESS) { + get_calling_name_from_usr_usr(ftdmchan, &conEvnt->usrUsr); } + get_prog_ind_ie(ftdmchan, &conEvnt->progInd); ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Incoming call: Called No:[%s] Calling No:[%s]\n", ftdmchan->caller_data.dnis.digits, ftdmchan->caller_data.cid_num.digits); @@ -148,35 +150,35 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) snprintf(ftdmchan->caller_data.aniII, 5, "%.2d", conEvnt->ni2OctStr.str.val[3]); } } + } - if (conEvnt->facilityStr.eh.pres) { - if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - get_facility_ie(&ftdmchan->caller_data, conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len); - } else if (signal_data->facility == SNGISDN_OPT_TRUE) { - /* Verify whether the Caller Name will come in a subsequent FACILITY message */ - uint16_t ret_val; - char retrieved_str[255]; - - ret_val = sng_isdn_retrieve_facility_caller_name(conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len, retrieved_str); - /* - return values for "sng_isdn_retrieve_facility_information_following": - If there will be no information following, or fails to decode IE, returns -1 - If there will be no information following, but current FACILITY IE contains a caller name, returns 0 - If there will be information following, returns 1 - */ - - if (ret_val == 1) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Expecting Caller name in FACILITY\n"); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_GET_CALLERID); - /* Launch timer in case we never get a FACILITY msg */ - if (signal_data->facility_timeout) { - ftdm_sched_timer(signal_data->sched, "facility_timeout", signal_data->facility_timeout, - sngisdn_facility_timeout, (void*) sngisdn_info, &sngisdn_info->timers[SNGISDN_TIMER_FACILITY]); - } - break; - } else if (ret_val == 0) { - strcpy(ftdmchan->caller_data.cid_name, retrieved_str); + if (conEvnt->facilityStr.eh.pres) { + if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { + get_facility_ie(ftdmchan, &conEvnt->facilityStr); + } else if (signal_data->facility == SNGISDN_OPT_TRUE) { + /* Verify whether the Caller Name will come in a subsequent FACILITY message */ + uint16_t ret_val; + char retrieved_str[255]; + + ret_val = sng_isdn_retrieve_facility_caller_name(conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len, retrieved_str); + /* + return values for "sng_isdn_retrieve_facility_information_following": + If there will be no information following, or fails to decode IE, returns -1 + If there will be no information following, but current FACILITY IE contains a caller name, returns 0 + If there will be information following, returns 1 + */ + + if (ret_val == 1) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Expecting Caller name in FACILITY\n"); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_GET_CALLERID); + /* Launch timer in case we never get a FACILITY msg */ + if (signal_data->facility_timeout) { + ftdm_sched_timer(signal_data->sched, "facility_timeout", signal_data->facility_timeout, + sngisdn_facility_timeout, (void*) sngisdn_info, &sngisdn_info->timers[SNGISDN_TIMER_FACILITY]); } + break; + } else if (ret_val == 0) { + strcpy(ftdmchan->caller_data.cid_name, retrieved_str); } } } @@ -254,8 +256,7 @@ void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event) ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - /* Function does not require any info from conStEvnt struct for now */ - /* CnStEvnt *cnStEvnt = &sngisdn_event->event.cnStEvnt; */ + CnStEvnt *cnStEvnt = &sngisdn_event->event.cnStEvnt; ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n"); @@ -281,6 +282,7 @@ void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event) case FTDM_CHANNEL_STATE_PROGRESS: case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: case FTDM_CHANNEL_STATE_DIALING: + get_prog_ind_ie(ftdmchan, &cnStEvnt->progInd); ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_UP); break; case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: @@ -344,9 +346,13 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) suId, suInstId, spInstId, ces); switch(evntType) { + case MI_CALLPROC: case MI_PROGRESS: - if (signal_data->switchtype == SNGISDN_SWITCH_NI2 && - cnStEvnt->causeDgn[0].eh.pres && cnStEvnt->causeDgn[0].causeVal.pres) { + case MI_ALERTING: + get_prog_ind_ie(ftdmchan, &cnStEvnt->progInd); + + if (signal_data->ignore_cause_value != SNGISDN_OPT_TRUE && + cnStEvnt->causeDgn[0].eh.pres && cnStEvnt->causeDgn[0].causeVal.pres) { switch(cnStEvnt->causeDgn[0].causeVal.val) { case 17: /* User Busy */ @@ -371,24 +377,17 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) goto sngisdn_process_cnst_ind_end; } } - /* fall-through */ - case MI_ALERTING: - case MI_CALLPROC: - + switch(ftdmchan->state) { case FTDM_CHANNEL_STATE_DIALING: - if (evntType == MI_CALLPROC) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROCEED); - } else if (evntType == MI_PROGRESS || - (cnStEvnt->progInd.eh.pres && cnStEvnt->progInd.progDesc.val == IN_PD_IBAVAIL)) { + case FTDM_CHANNEL_STATE_PROCEED: + if (cnStEvnt->progInd.eh.pres && cnStEvnt->progInd.progDesc.val == IN_PD_IBAVAIL) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); } else { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); } - break; case FTDM_CHANNEL_STATE_PROGRESS: - if (evntType == MI_PROGRESS || - (cnStEvnt->progInd.eh.pres && cnStEvnt->progInd.progDesc.val == IN_PD_IBAVAIL)) { + if (cnStEvnt->progInd.eh.pres && cnStEvnt->progInd.progDesc.val == IN_PD_IBAVAIL) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); } break; @@ -417,7 +416,7 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) ftdm_size_t min_digits = ((sngisdn_span_data_t*)ftdmchan->span->signal_data)->min_digits; ftdm_size_t num_digits; - get_called_num(&ftdmchan->caller_data, &cnStEvnt->cdPtyNmb); + get_called_num(ftdmchan, &cnStEvnt->cdPtyNmb); num_digits = strlen(ftdmchan->caller_data.dnis.digits); if (cnStEvnt->sndCmplt.eh.pres || num_digits >= min_digits) { @@ -476,7 +475,7 @@ void sngisdn_process_disc_ind (sngisdn_event_data_t *sngisdn_event) case FTDM_CHANNEL_STATE_UP: if (discEvnt->facilityStr.eh.pres) { if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - get_facility_ie(&ftdmchan->caller_data, discEvnt->facilityStr.facilityStr.val, discEvnt->facilityStr.facilityStr.len); + get_facility_ie(ftdmchan, &discEvnt->facilityStr); } else { /* Call libsng_isdn facility decode function and copy variables here */ } @@ -573,7 +572,7 @@ void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event) if (relEvnt->facilityStr.eh.pres) { if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - get_facility_ie(&ftdmchan->caller_data, relEvnt->facilityStr.facilityStr.val, relEvnt->facilityStr.facilityStr.len); + get_facility_ie(ftdmchan, &relEvnt->facilityStr); } else { /* Call libsng_isdn facility decode function and copy variables here */ } @@ -789,7 +788,7 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event) ftdm_sigmsg_t sigev; if (facEvnt->facElmt.facStr.pres) { if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - get_facility_ie(&ftdmchan->caller_data, &facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len); + get_facility_ie_str(ftdmchan, &facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len); } else { /* Call libsng_isdn facility decode function and copy variables here */ } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 36c6782..e91f21f 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -34,13 +34,12 @@ #include "ftmod_sangoma_isdn.h" -static void sngisdn_set_prog_desc(ProgInd *progInd, ftdm_sngisdn_progind_t prod_ind); - void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) { - ConEvnt conEvnt; + ConEvnt conEvnt; sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_NETE_ISDN}; ftdm_assert((!sngisdn_info->suInstId && !sngisdn_info->spInstId), "Trying to call out, but call data was not cleared\n"); @@ -118,14 +117,6 @@ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) conEvnt.chanId.chanNmbSlotMap.val[0] = ftdmchan->physical_chan_id; } - conEvnt.progInd.eh.pres = PRSNT_NODEF; - conEvnt.progInd.location.pres = PRSNT_NODEF; - conEvnt.progInd.location.val = IN_LOC_USER; - conEvnt.progInd.codeStand0.pres = PRSNT_NODEF; - conEvnt.progInd.codeStand0.val = IN_CSTD_CCITT; - conEvnt.progInd.progDesc.pres = PRSNT_NODEF; - conEvnt.progInd.progDesc.val = IN_PD_NOTETEISDN; /* Not end-to-end ISDN */ - if (signal_data->switchtype == SNGISDN_SWITCH_EUROISDN) { conEvnt.sndCmplt.eh.pres = PRSNT_NODEF; } @@ -135,11 +126,13 @@ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) } ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Outgoing call: Called No:[%s] Calling No:[%s]\n", ftdmchan->caller_data.dnis.digits, ftdmchan->caller_data.cid_num.digits); - set_called_num(&conEvnt.cdPtyNmb, &ftdmchan->caller_data); - set_calling_num(&conEvnt.cgPtyNmb, &ftdmchan->caller_data); - set_redir_num(&conEvnt.redirNmb, &ftdmchan->caller_data); - set_calling_name(&conEvnt, ftdmchan); + set_called_num(ftdmchan, &conEvnt.cdPtyNmb); + set_calling_num(ftdmchan, &conEvnt.cgPtyNmb); + set_calling_subaddr(ftdmchan, &conEvnt.cgPtySad); + set_redir_num(ftdmchan, &conEvnt.redirNmb); + set_calling_name(ftdmchan, &conEvnt); set_facility_ie(ftdmchan, &conEvnt.facilityStr); + set_prog_ind_ie(ftdmchan, &conEvnt.progInd, prog_ind); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending SETUP (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); @@ -347,15 +340,7 @@ void sngisdn_snd_progress(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ } memset(&cnStEvnt, 0, sizeof(cnStEvnt)); - - cnStEvnt.progInd.eh.pres = PRSNT_NODEF; - cnStEvnt.progInd.location.pres = PRSNT_NODEF; - cnStEvnt.progInd.location.val = IN_LOC_USER; - cnStEvnt.progInd.codeStand0.pres = PRSNT_NODEF; - cnStEvnt.progInd.codeStand0.val = IN_CSTD_CCITT; - cnStEvnt.progInd.progDesc.pres = PRSNT_NODEF; - - sngisdn_set_prog_desc(&cnStEvnt.progInd, prog_ind); + set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending PROGRESS (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); if(sng_isdn_con_status(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId,&cnStEvnt, MI_PROGRESS, signal_data->dchan_id, sngisdn_info->ces)) { @@ -380,13 +365,7 @@ void sngisdn_snd_alert(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind memset(&cnStEvnt, 0, sizeof(cnStEvnt)); - cnStEvnt.progInd.eh.pres = PRSNT_NODEF; - cnStEvnt.progInd.location.pres = PRSNT_NODEF; - cnStEvnt.progInd.location.val = IN_LOC_USER; - cnStEvnt.progInd.codeStand0.pres = PRSNT_NODEF; - cnStEvnt.progInd.codeStand0.val = IN_CSTD_CCITT; - cnStEvnt.progInd.progDesc.pres = PRSNT_NODEF; - sngisdn_set_prog_desc(&cnStEvnt.progInd, prog_ind); + set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending ALERT (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); @@ -398,10 +377,10 @@ void sngisdn_snd_alert(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind void sngisdn_snd_connect(ftdm_channel_t *ftdmchan) { - CnStEvnt cnStEvnt; - + CnStEvnt cnStEvnt; sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + ftdm_sngisdn_progind_t prog_ind = {SNGISDN_PROGIND_LOC_USER, SNGISDN_PROGIND_DESCR_NETE_ISDN}; if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending CONNECT, but no call data, aborting (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); @@ -444,14 +423,8 @@ void sngisdn_snd_connect(ftdm_channel_t *ftdmchan) cnStEvnt.chanId.chanNmbSlotMap.len = 1; cnStEvnt.chanId.chanNmbSlotMap.val[0] = ftdmchan->physical_chan_id; } - - cnStEvnt.progInd.eh.pres = PRSNT_NODEF; - cnStEvnt.progInd.location.pres = PRSNT_NODEF; - cnStEvnt.progInd.location.val = IN_LOC_USER; - cnStEvnt.progInd.codeStand0.pres = PRSNT_NODEF; - cnStEvnt.progInd.codeStand0.val = IN_CSTD_CCITT; - cnStEvnt.progInd.progDesc.pres = PRSNT_NODEF; - cnStEvnt.progInd.progDesc.val = IN_PD_NOTETEISDN; /* Not end-to-end ISDN */ + + set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending CONNECT (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); if (sng_isdn_con_response(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &cnStEvnt, signal_data->dchan_id, sngisdn_info->ces)) { @@ -473,7 +446,12 @@ void sngisdn_snd_fac_req(ftdm_channel_t *ftdmchan) } memset(&facEvnt, 0, sizeof(facEvnt)); - + + set_facility_ie_str(ftdmchan, &facEvnt.facElmt.facStr.val[2], (ftdm_size_t*)&facEvnt.facElmt.facStr.len); + + facEvnt.facElmt.facStr.val[0] = 0x1C; + facEvnt.facElmt.facStr.val[1] = facEvnt.facElmt.facStr.len; + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending FACILITY (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); if (sng_isdn_facility_request(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &facEvnt, MI_FACIL, signal_data->dchan_id, sngisdn_info->ces)) { @@ -619,32 +597,6 @@ void sngisdn_snd_release(ftdm_channel_t *ftdmchan, uint8_t glare) return; } -static void sngisdn_set_prog_desc(ProgInd *progInd, ftdm_sngisdn_progind_t prog_ind) -{ - switch(prog_ind) { - case SNGISDN_PROGIND_NETE_ISDN: - progInd->progDesc.val = IN_PD_NOTETEISDN; - break; - case SNGISDN_PROGIND_DEST_NISDN: - progInd->progDesc.val = IN_PD_DSTNOTISDN; - break; - case SNGISDN_PROGIND_ORIG_NISDN: - progInd->progDesc.val = IN_PD_ORGNOTISDN; - break; - case SNGISDN_PROGIND_RET_ISDN: - progInd->progDesc.val = IN_PD_CALLRET; - break; - case SNGISDN_PROGIND_SERV_CHANGE: - /* Trillium defines do not match ITU-T Q931 Progress descriptions, - indicate a delayed response for now */ - progInd->progDesc.val = IN_PD_DELRESP; - break; - case SNGISDN_PROGIND_IB_AVAIL: - progInd->progDesc.val = IN_PD_IBAVAIL; - break; - } - return; -} /* We received an incoming frame on the d-channel, send data to the stack */ void sngisdn_snd_data(ftdm_channel_t *dchan, uint8_t *data, ftdm_size_t len) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 4ddb90b..964d06c 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -33,6 +33,15 @@ */ #include "ftmod_sangoma_isdn.h" +#define SNGISDN_Q931_FACILITY_IE_ID 0x1C + +/* ftmod_sangoma_isdn specific enum look-up functions */ + +FTDM_ENUM_NAMES(SNGISDN_PROGIND_DESCR_NAMES, SNGISDN_PROGIND_DESCR_STRINGS) +FTDM_STR2ENUM(ftdm_str2ftdm_sngisdn_progind_descr, ftdm_sngisdn_progind_descr2str, ftdm_sngisdn_progind_descr_t, SNGISDN_PROGIND_DESCR_NAMES, SNGISDN_PROGIND_DESCR_INVALID) + +FTDM_ENUM_NAMES(SNGISDN_PROGIND_LOC_NAMES, SNGISDN_PROGIND_LOC_STRINGS) +FTDM_STR2ENUM(ftdm_str2ftdm_sngisdn_progind_loc, ftdm_sngisdn_progind_loc2str, ftdm_sngisdn_progind_loc_t, SNGISDN_PROGIND_LOC_NAMES, SNGISDN_PROGIND_LOC_INVALID) ftdm_status_t sngisdn_check_free_ids(void); @@ -129,7 +138,6 @@ ftdm_status_t get_ftdmchan_by_spInstId(int16_t cc_id, uint32_t spInstId, sngisdn ftdm_status_t sngisdn_set_avail_rate(ftdm_span_t *span, sngisdn_avail_t avail) { - if (span->trunk_type == FTDM_TRUNK_BRI || span->trunk_type == FTDM_TRUNK_BRI_PTMP) { @@ -147,8 +155,9 @@ ftdm_status_t sngisdn_set_avail_rate(ftdm_span_t *span, sngisdn_avail_t avail) return FTDM_SUCCESS; } -ftdm_status_t get_calling_num(ftdm_caller_data_t *caller_data, CgPtyNmb *cgPtyNmb) +ftdm_status_t get_calling_num(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb) { + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; if (cgPtyNmb->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; } @@ -176,8 +185,9 @@ ftdm_status_t get_calling_num(ftdm_caller_data_t *caller_data, CgPtyNmb *cgPtyNm return FTDM_SUCCESS; } -ftdm_status_t get_called_num(ftdm_caller_data_t *caller_data, CdPtyNmb *cdPtyNmb) +ftdm_status_t get_called_num(ftdm_channel_t *ftdmchan, CdPtyNmb *cdPtyNmb) { + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; if (cdPtyNmb->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; } @@ -199,8 +209,9 @@ ftdm_status_t get_called_num(ftdm_caller_data_t *caller_data, CdPtyNmb *cdPtyNmb return FTDM_SUCCESS; } -ftdm_status_t get_redir_num(ftdm_caller_data_t *caller_data, RedirNmb *redirNmb) +ftdm_status_t get_redir_num(ftdm_channel_t *ftdmchan, RedirNmb *redirNmb) { + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; if (redirNmb->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; } @@ -219,8 +230,9 @@ ftdm_status_t get_redir_num(ftdm_caller_data_t *caller_data, RedirNmb *redirNmb) return FTDM_SUCCESS; } -ftdm_status_t get_calling_name_from_display(ftdm_caller_data_t *caller_data, Display *display) +ftdm_status_t get_calling_name_from_display(ftdm_channel_t *ftdmchan, Display *display) { + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; if (display->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; } @@ -232,8 +244,9 @@ ftdm_status_t get_calling_name_from_display(ftdm_caller_data_t *caller_data, Dis return FTDM_SUCCESS; } -ftdm_status_t get_calling_name_from_usr_usr(ftdm_caller_data_t *caller_data, UsrUsr *usrUsr) +ftdm_status_t get_calling_name_from_usr_usr(ftdm_channel_t *ftdmchan, UsrUsr *usrUsr) { + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; if (usrUsr->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; } @@ -250,26 +263,124 @@ ftdm_status_t get_calling_name_from_usr_usr(ftdm_caller_data_t *caller_data, Usr return FTDM_SUCCESS; } -ftdm_status_t get_facility_ie(ftdm_caller_data_t *caller_data, uint8_t *data, uint32_t data_len) +ftdm_status_t get_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad) { + char subaddress[100]; + + if (cgPtySad->eh.pres != PRSNT_NODEF) { + return FTDM_FAIL; + } + memset(subaddress, 0, sizeof(subaddress)); + if(cgPtySad->sadInfo.len >= sizeof(subaddress)) { + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Calling Party Subaddress exceeds local size limit (len:%d max:%d)\n", cgPtySad->sadInfo.len, sizeof(subaddress)); + cgPtySad->sadInfo.len = sizeof(subaddress)-1; + } + + memcpy(subaddress, (char*)cgPtySad->sadInfo.val, cgPtySad->sadInfo.len); + subaddress[cgPtySad->sadInfo.len] = '\0'; + ftdm_channel_add_var(ftdmchan, "isdn.calling_subaddr", subaddress); + return FTDM_SUCCESS; +} + +ftdm_status_t get_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr) +{ + if (!facilityStr->eh.pres) { + return FTDM_FAIL; + } + + return get_facility_ie_str(ftdmchan, facilityStr->facilityStr.val, facilityStr->facilityStr.len); +} + +ftdm_status_t get_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, ftdm_size_t data_len) +{ + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; if (data_len > sizeof(caller_data->raw_data)-2) { ftdm_log(FTDM_LOG_CRIT, "Length of Facility IE exceeds maximum length\n"); return FTDM_FAIL; } - + memset(caller_data->raw_data, 0, sizeof(caller_data->raw_data)); /* Always include Facility IE identifier + len so this can be used as a sanity check by the user */ - caller_data->raw_data[0] = 0x1C; + caller_data->raw_data[0] = SNGISDN_Q931_FACILITY_IE_ID; caller_data->raw_data[1] = data_len; memcpy(&caller_data->raw_data[2], data, data_len); caller_data->raw_data_len = data_len+2; + return FTDM_SUCCESS; +} + +ftdm_status_t get_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd) +{ + uint8_t val; + if (!progInd->eh.pres) { + return FTDM_FAIL; + } + + if (progInd->progDesc.pres) { + switch (progInd->progDesc.val) { + case IN_PD_NOTETEISDN: + val = SNGISDN_PROGIND_DESCR_NETE_ISDN; + break; + case IN_PD_DSTNOTISDN: + val = SNGISDN_PROGIND_DESCR_DEST_NISDN; + break; + case IN_PD_ORGNOTISDN: + val = SNGISDN_PROGIND_DESCR_ORIG_NISDN; + break; + case IN_PD_CALLRET: + val = SNGISDN_PROGIND_DESCR_RET_ISDN; + break; + case IN_PD_DELRESP: + val = SNGISDN_PROGIND_DESCR_SERV_CHANGE; + break; + case IN_PD_IBAVAIL: + val = SNGISDN_PROGIND_DESCR_IB_AVAIL; + break; + default: + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Unknown Progress Indicator Description (%d)\n", progInd->progDesc.val); + val = SNGISDN_PROGIND_DESCR_INVALID; + break; + } + ftdm_channel_add_var(ftdmchan, "isdn.prog_ind.descr", ftdm_sngisdn_progind_descr2str(val)); + } + if (progInd->location.pres) { + switch (progInd->location.val) { + case IN_LOC_USER: + val = SNGISDN_PROGIND_LOC_USER; + break; + case IN_LOC_PRIVNETLU: + val = SNGISDN_PROGIND_LOC_PRIV_NET_LOCAL_USR; + break; + case IN_LOC_PUBNETLU: + val = SNGISDN_PROGIND_LOC_PUB_NET_LOCAL_USR; + break; + case IN_LOC_TRANNET: + val = SNGISDN_PROGIND_LOC_TRANSIT_NET; + break; + case IN_LOC_PUBNETRU: + val = SNGISDN_PROGIND_LOC_PUB_NET_REMOTE_USR; + break; + case IN_LOC_PRIVNETRU: + val = SNGISDN_PROGIND_LOC_PRIV_NET_REMOTE_USR; + break; + case IN_LOC_NETINTER: + val = SNGISDN_PROGIND_LOC_NET_BEYOND_INTRW; + break; + default: + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Unknown Progress Indicator Location (%d)", progInd->location.val); + val = SNGISDN_PROGIND_LOC_INVALID; + break; + } + ftdm_channel_add_var(ftdmchan, "isdn.prog_ind.loc", ftdm_sngisdn_progind_loc2str(val)); + } return FTDM_SUCCESS; } -ftdm_status_t set_calling_num(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *caller_data) + +ftdm_status_t set_calling_num(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb) { + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; uint8_t len = strlen(caller_data->cid_num.digits); if (!len) { return FTDM_SUCCESS; @@ -296,9 +407,11 @@ ftdm_status_t set_calling_num(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *caller_dat return FTDM_SUCCESS; } -ftdm_status_t set_called_num(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *caller_data) +ftdm_status_t set_called_num(ftdm_channel_t *ftdmchan, CdPtyNmb *cdPtyNmb) { + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; uint8_t len = strlen(caller_data->dnis.digits); + if (!len) { return FTDM_SUCCESS; } @@ -326,8 +439,9 @@ ftdm_status_t set_called_num(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *caller_data return FTDM_SUCCESS; } -ftdm_status_t set_redir_num(RedirNmb *redirNmb, ftdm_caller_data_t *caller_data) +ftdm_status_t set_redir_num(ftdm_channel_t *ftdmchan, RedirNmb *redirNmb) { + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; uint8_t len = strlen(caller_data->rdnis.digits); if (!len) { return FTDM_SUCCESS; @@ -358,7 +472,7 @@ ftdm_status_t set_redir_num(RedirNmb *redirNmb, ftdm_caller_data_t *caller_data) } -ftdm_status_t set_calling_name(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan) +ftdm_status_t set_calling_name(ftdm_channel_t *ftdmchan, ConEvnt *conEvnt) { uint8_t len; ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; @@ -411,20 +525,139 @@ ftdm_status_t set_calling_name(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan) return FTDM_SUCCESS; } +ftdm_status_t set_calling_subaddr(ftdm_channel_t *ftdmchan, CgPtySad *cgPtySad) +{ + const char* clg_subaddr = NULL; + clg_subaddr = ftdm_channel_get_var(ftdmchan, "isdn.calling_subaddr"); + if ((clg_subaddr != NULL) && (*clg_subaddr)) { + unsigned len = strlen (clg_subaddr); + cgPtySad->eh.pres = PRSNT_NODEF; + cgPtySad->typeSad.pres = 1; + cgPtySad->typeSad.val = 0; /* NSAP */ + cgPtySad->oddEvenInd.pres = 1; + cgPtySad->oddEvenInd.val = 0; + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending Calling Party Subaddress:%s\n", clg_subaddr); + cgPtySad->sadInfo.pres = 1; + cgPtySad->sadInfo.len = len; + memcpy(cgPtySad->sadInfo.val, clg_subaddr, len); + } + return FTDM_SUCCESS; +} + + ftdm_status_t set_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr) { - const char *facility_str = NULL; - - facility_str = ftdm_channel_get_var(ftdmchan, "isdn.facility.val"); - if (facility_str) { + ftdm_status_t status; + status = set_facility_ie_str(ftdmchan, facilityStr->facilityStr.val, (ftdm_size_t*)&facilityStr->facilityStr.len); + if (status == FTDM_SUCCESS) { facilityStr->eh.pres = PRSNT_NODEF; - facilityStr->facilityStr.len = strlen(facility_str); - memcpy(facilityStr->facilityStr.val, facility_str, facilityStr->facilityStr.len); - return FTDM_SUCCESS; + facilityStr->facilityStr.pres = PRSNT_NODEF; } + return status; +} + +ftdm_status_t set_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, ftdm_size_t *data_len) +{ + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; + + if (caller_data->raw_data_len > 0 && caller_data->raw_data[0] == SNGISDN_Q931_FACILITY_IE_ID) { + + *data_len = caller_data->raw_data[1]; + memcpy(data, &caller_data->raw_data[2], *data_len); + return FTDM_SUCCESS; + } return FTDM_FAIL; } +ftdm_status_t set_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd, ftdm_sngisdn_progind_t prog_ind) +{ + const char *str = NULL; + int descr = prog_ind.descr; + int loc = prog_ind.loc; + + str = ftdm_channel_get_var(ftdmchan, "isdn.prog_ind.descr"); + if (str && *str) { + /* User wants to override progress indicator */ + descr = ftdm_str2ftdm_sngisdn_progind_descr(str); + } + + if (descr == SNGISDN_PROGIND_DESCR_INVALID) { + /* User does not want to send progress indicator */ + return FTDM_SUCCESS; + } + + str = ftdm_channel_get_var(ftdmchan, "isdn.prog_ind.loc"); + if (str && *str) { + loc = ftdm_str2ftdm_sngisdn_progind_loc(str); + } + if (loc == SNGISDN_PROGIND_LOC_INVALID) { + loc = SNGISDN_PROGIND_LOC_USER; + } + + progInd->eh.pres = PRSNT_NODEF; + progInd->codeStand0.pres = PRSNT_NODEF; + progInd->codeStand0.val = IN_CSTD_CCITT; + + progInd->progDesc.pres = PRSNT_NODEF; + switch(descr) { + case SNGISDN_PROGIND_DESCR_NETE_ISDN: + progInd->progDesc.val = IN_PD_NOTETEISDN; + break; + case SNGISDN_PROGIND_DESCR_DEST_NISDN: + progInd->progDesc.val = IN_PD_DSTNOTISDN; + break; + case SNGISDN_PROGIND_DESCR_ORIG_NISDN: + progInd->progDesc.val = IN_PD_ORGNOTISDN; + break; + case SNGISDN_PROGIND_DESCR_RET_ISDN: + progInd->progDesc.val = IN_PD_CALLRET; + break; + case SNGISDN_PROGIND_DESCR_SERV_CHANGE: + /* Trillium defines do not match ITU-T Q931 Progress descriptions, + indicate a delayed response for now */ + progInd->progDesc.val = IN_PD_DELRESP; + break; + case SNGISDN_PROGIND_DESCR_IB_AVAIL: + progInd->progDesc.val = IN_PD_IBAVAIL; + break; + default: + ftdm_log(FTDM_LOG_WARNING, "Invalid prog_ind description:%d\n", descr); + progInd->progDesc.val = IN_PD_NOTETEISDN; + break; + } + + progInd->location.pres = PRSNT_NODEF; + switch (loc) { + case SNGISDN_PROGIND_LOC_USER: + progInd->location.val = IN_LOC_USER; + break; + case SNGISDN_PROGIND_LOC_PRIV_NET_LOCAL_USR: + progInd->location.val = IN_LOC_PRIVNETLU; + break; + case SNGISDN_PROGIND_LOC_PUB_NET_LOCAL_USR: + progInd->location.val = IN_LOC_PUBNETLU; + break; + case SNGISDN_PROGIND_LOC_TRANSIT_NET: + progInd->location.val = IN_LOC_TRANNET; + break; + case SNGISDN_PROGIND_LOC_PUB_NET_REMOTE_USR: + progInd->location.val = IN_LOC_PUBNETRU; + break; + case SNGISDN_PROGIND_LOC_PRIV_NET_REMOTE_USR: + progInd->location.val = IN_LOC_PRIVNETRU; + break; + case SNGISDN_PROGIND_LOC_NET_BEYOND_INTRW: + progInd->location.val = IN_LOC_NETINTER; + break; + default: + ftdm_log(FTDM_LOG_WARNING, "Invalid prog_ind location:%d\n", loc); + progInd->location.val = IN_PD_NOTETEISDN; + } + return FTDM_SUCCESS; +} + + void sngisdn_t3_timeout(void* p_sngisdn_info) { sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*)p_sngisdn_info; @@ -581,13 +814,12 @@ uint8_t sngisdn_get_infoTranCap_from_stack(ftdm_bearer_cap_t bearer_capability) switch(bearer_capability) { case FTDM_BEARER_CAP_SPEECH: return IN_ITC_SPEECH; - case FTDM_BEARER_CAP_64K_UNRESTRICTED: return IN_ITC_UNRDIG; - case FTDM_BEARER_CAP_3_1KHZ_AUDIO: return IN_ITC_A31KHZ; - + case FTDM_BEARER_CAP_INVALID: + return IN_ITC_SPEECH; /* Do not put a default case here, so we can see compile warnings if we have unhandled cases */ } return FTDM_BEARER_CAP_SPEECH; @@ -598,13 +830,12 @@ uint8_t sngisdn_get_usrInfoLyr1Prot_from_stack(ftdm_user_layer1_prot_t layer1_pr switch(layer1_prot) { case FTDM_USER_LAYER1_PROT_V110: return IN_UIL1_CCITTV110; - case FTDM_USER_LAYER1_PROT_ULAW: return IN_UIL1_G711ULAW; - case FTDM_USER_LAYER1_PROT_ALAW: return IN_UIL1_G711ALAW; - + case FTDM_USER_LAYER1_PROT_INVALID: + return IN_UIL1_G711ULAW; /* Do not put a default case here, so we can see compile warnings if we have unhandled cases */ } return IN_UIL1_G711ULAW; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c index 624d35c..e516716 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c @@ -613,6 +613,21 @@ uint32_t sngisdn_decode_ie(char *str, uint32_t *str_len, uint8_t current_codeset return 0; break; case PROT_Q931_IE_CALLED_PARTY_SUBADDRESS: + { + uint8_t type; + uint8_t currentOct, j=0; + char calling_subaddr_string[82]; + memset(calling_subaddr_string, 0, sizeof(calling_subaddr_string)); + type = get_bits(OCTET(3),5,7); + currentOct = 3; + while(currentOct++ <= len+1) { + calling_subaddr_string[j++]=ia5[get_bits(OCTET(currentOct),1,4)][get_bits(OCTET(currentOct),5,8)]; + } + calling_subaddr_string[j++]='\0'; + *str_len += sprintf(&str[*str_len], "%s (l:%d) type:%s(%d) \n", + calling_subaddr_string, (j-1), get_code_2_str(type, dcodQ931TypeOfSubaddressTable), type); + } + break; case PROT_Q931_IE_REDIRECTION_NUMBER: case PROT_Q931_IE_NOTIFICATION_IND: case PROT_Q931_IE_DATE_TIME: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.h index d210c50..f054de9 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.h @@ -544,5 +544,11 @@ struct code2str dcodQ931GenDigitsTypeTable[] = { {-1, "Invalid"}, }; +struct code2str dcodQ931TypeOfSubaddressTable[] = { + { 0x00, "NSAP"}, + { 0x02, "User-specified"}, + { -1, "Invalid"}, +}; + #endif /* __FTMOD_SANGOMA_ISDN_TRACE_H__ */ diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 014eeef..45254e8 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -41,6 +41,7 @@ #include "ftdm_declare.h" +#include "ftdm_call_utils.h" /*! \brief Max number of channels per physical span */ #define FTDM_MAX_CHANNELS_PHYSICAL_SPAN 32 @@ -62,23 +63,6 @@ #define FTDM_INVALID_INT_PARM 0xFF -/*! \brief FreeTDM APIs possible return codes */ -typedef enum { - FTDM_SUCCESS, /*!< Success */ - FTDM_FAIL, /*!< Failure, generic error return code, use ftdm_channel_get_last_error or ftdm_span_get_last_error for details */ - FTDM_MEMERR, /*!< Memory error, most likely allocation failure */ - FTDM_TIMEOUT, /*!< Operation timed out (ie: polling on a device)*/ - FTDM_NOTIMPL, /*!< Operation not implemented */ - FTDM_BREAK, /*!< Request the caller to perform a break (context-dependant, ie: stop getting DNIS/ANI) */ - FTDM_EINVAL /*!< Invalid argument */ -} ftdm_status_t; - -/*! \brief FreeTDM bool type. */ -typedef enum { - FTDM_FALSE, - FTDM_TRUE -} ftdm_bool_t; - /*! \brief Thread/Mutex OS abstraction API. */ #include "ftdm_os.h" @@ -220,8 +204,10 @@ typedef enum { FTDM_TON_SUBSCRIBER_NUMBER, FTDM_TON_ABBREVIATED_NUMBER, FTDM_TON_RESERVED, - FTDM_TON_INVALID = 255 + FTDM_TON_INVALID } ftdm_ton_t; +#define TON_STRINGS "unknown", "international", "national", "network-specific", "subscriber-number", "abbreviated-number", "reserved", "invalid" +FTDM_STR2ENUM_P(ftdm_str2ftdm_ton, ftdm_ton2str, ftdm_ton_t) /*! Numbering Plan Identification (NPI) */ typedef enum { @@ -232,29 +218,59 @@ typedef enum { FTDM_NPI_NATIONAL = 8, FTDM_NPI_PRIVATE = 9, FTDM_NPI_RESERVED = 10, - FTDM_NPI_INVALID = 255 + FTDM_NPI_INVALID } ftdm_npi_t; +#define NPI_STRINGS "unknown", "ISDN", "data", "telex", "national", "private", "reserved", "invalid" +FTDM_STR2ENUM_P(ftdm_str2ftdm_npi, ftdm_npi2str, ftdm_npi_t) -/*! \brief Number abstraction */ -typedef struct { - char digits[25]; - uint8_t type; - uint8_t plan; -} ftdm_number_t; +/*! Presentation Ind */ +typedef enum { + FTDM_PRES_ALLOWED, + FTDM_PRES_RESTRICTED, + FTDM_PRES_NOT_AVAILABLE, + FTDM_PRES_RESERVED, + FTDM_PRES_INVALID +} ftdm_presentation_t; +#define PRESENTATION_STRINGS "presentation-allowed", "presentation-restricted", "number-not-available", "reserved", "Invalid" +FTDM_STR2ENUM_P(ftdm_str2ftdm_presentation, ftdm_presentation2str, ftdm_presentation_t) + +/*! Screening Ind */ +typedef enum { + FTDM_SCREENING_NOT_SCREENED, + FTDM_SCREENING_VERIFIED_PASSED, + FTDM_SCREENING_VERIFIED_FAILED, + FTDM_SCREENING_NETWORK_PROVIDED, + FTDM_SCREENING_INVALID +} ftdm_screening_t; +#define SCREENING_STRINGS "user-provided-not-screened", "user-provided-verified-and-passed", "user-provided-verified-and-failed", "network-provided", "invalid" +FTDM_STR2ENUM_P(ftdm_str2ftdm_screening, ftdm_screening2str, ftdm_screening_t) /*! \brief bearer capability */ typedef enum { FTDM_BEARER_CAP_SPEECH = 0x00, FTDM_BEARER_CAP_64K_UNRESTRICTED = 0x02, - FTDM_BEARER_CAP_3_1KHZ_AUDIO = 0x03 + FTDM_BEARER_CAP_3_1KHZ_AUDIO = 0x03, + FTDM_BEARER_CAP_INVALID } ftdm_bearer_cap_t; +#define BEARER_CAP_STRINGS "speech", "unrestricted-digital-information", "3.1-Khz-audio", "invalid" +FTDM_STR2ENUM_P(ftdm_str2ftdm_bearer_cap, ftdm_bearer_cap2str, ftdm_bearer_cap_t) /*! \brief user information layer 1 protocol */ typedef enum { FTDM_USER_LAYER1_PROT_V110 = 0x01, FTDM_USER_LAYER1_PROT_ULAW = 0x02, FTDM_USER_LAYER1_PROT_ALAW = 0x03, + FTDM_USER_LAYER1_PROT_INVALID } ftdm_user_layer1_prot_t; +#define USER_LAYER1_PROT_STRINGS "V.110", "u-law", "a-law", "Invalid" +FTDM_STR2ENUM_P(ftdm_str2ftdm_usr_layer1_prot, ftdm_user_layer1_prot2str, ftdm_user_layer1_prot_t) + +/*! \brief Number abstraction */ +typedef struct { + char digits[25]; + uint8_t type; + uint8_t plan; +} ftdm_number_t; /*! \brief Caller information */ typedef struct ftdm_caller_data { diff --git a/libs/freetdm/src/include/ftdm_call_utils.h b/libs/freetdm/src/include/ftdm_call_utils.h new file mode 100644 index 0000000..835a5c6 --- /dev/null +++ b/libs/freetdm/src/include/ftdm_call_utils.h @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2010, Sangoma Technologies + * David Yat Sin <dyatsin@sangoma.com> + * 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 original author; nor the names of any 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 OWNER + * 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. + */ + +#ifndef __FTDM_CALL_UTILS_H__ +#define __FTDM_CALL_UTILS_H__ + +/*! + * \brief Set the Numbering Plan Identification from a string + * + * \param npi_string string value + * \param target the target to set value to + * + * \retval FTDM_SUCCESS success + * \retval FTDM_FAIL failure + */ +FT_DECLARE(ftdm_status_t) ftdm_set_npi(const char *npi_string, uint8_t *target); + + +/*! + * \brief Set the Type of number from a string + * + * \param ton_string string value + * \param target the target to set value to + * + * \retval FTDM_SUCCESS success + * \retval FTDM_FAIL failure + */ +FT_DECLARE(ftdm_status_t) ftdm_set_ton(const char *ton_string, uint8_t *target); + +/*! + * \brief Set the Bearer Capability from a string + * + * \param bc_string string value + * \param target the target to set value to + * + * \retval FTDM_SUCCESS success + * \retval FTDM_FAIL failure + */ +FT_DECLARE(ftdm_status_t) ftdm_set_bearer_capability(const char *bc_string, uint8_t *target); + +/*! + * \brief Set the Bearer Capability - Layer 1 from a string + * + * \param bc_string string value + * \param target the target to set value to + * + * \retval FTDM_SUCCESS success + * \retval FTDM_FAIL failure + */ +FT_DECLARE(ftdm_status_t) ftdm_set_bearer_layer1(const char *bc_string, uint8_t *target); + +/*! + * \brief Set the Screening Ind from a string + * + * \param screen_string string value + * \param target the target to set value to + * + * \retval FTDM_SUCCESS success + * \retval FTDM_FAIL failure + */ +FT_DECLARE(ftdm_status_t) ftdm_set_screening_ind(const char *string, uint8_t *target); + + +/*! + * \brief Set the Presentation Ind from an enum + * + * \param screen_string string value + * \param target the target to set value to + * + * \retval FTDM_SUCCESS success + * \retval FTDM_FAIL failure + */ +FT_DECLARE(ftdm_status_t) ftdm_set_presentation_ind(const char *string, uint8_t *target); + + +/*! + * \brief Checks whether a string contains only numbers + * + * \param number string value + * + * \retval FTDM_SUCCESS success + * \retval FTDM_FAIL failure + */ +FT_DECLARE(ftdm_status_t) ftdm_is_number(const char *number); + +#endif /* __FTDM_CALL_UTILS_H__ */ + diff --git a/libs/freetdm/src/include/ftdm_declare.h b/libs/freetdm/src/include/ftdm_declare.h index ab3b5c8..4aba703 100644 --- a/libs/freetdm/src/include/ftdm_declare.h +++ b/libs/freetdm/src/include/ftdm_declare.h @@ -171,6 +171,23 @@ typedef int ftdm_socket_t; #include <stdarg.h> #endif +/*! \brief FreeTDM APIs possible return codes */ +typedef enum { + FTDM_SUCCESS, /*!< Success */ + FTDM_FAIL, /*!< Failure, generic error return code, use ftdm_channel_get_last_error or ftdm_span_get_last_error for details */ + FTDM_MEMERR, /*!< Memory error, most likely allocation failure */ + FTDM_TIMEOUT, /*!< Operation timed out (ie: polling on a device)*/ + FTDM_NOTIMPL, /*!< Operation not implemented */ + FTDM_BREAK, /*!< Request the caller to perform a break (context-dependant, ie: stop getting DNIS/ANI) */ + FTDM_EINVAL /*!< Invalid argument */ +} ftdm_status_t; + +/*! \brief FreeTDM bool type. */ +typedef enum { + FTDM_FALSE, + FTDM_TRUE +} ftdm_bool_t; + /*! * \brief FreeTDM channel. * This is the basic data structure used to place calls and I/O operations diff --git a/libs/freetdm/src/include/private/ftdm_call_utils.h b/libs/freetdm/src/include/private/ftdm_call_utils.h deleted file mode 100644 index 782abde..0000000 --- a/libs/freetdm/src/include/private/ftdm_call_utils.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2010, Sangoma Technologies - * David Yat Sin <dyatsin@sangoma.com> - * 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 original author; nor the names of any 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 OWNER - * 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. - */ - -#ifndef __FTDM_CALL_UTILS_H__ -#define __FTDM_CALL_UTILS_H__ - -#include "freetdm.h" - -FT_DECLARE(ftdm_status_t) ftdm_span_set_npi(const char *npi_string, uint8_t *target); -FT_DECLARE(ftdm_status_t) ftdm_span_set_ton(const char *ton_string, uint8_t *target); -FT_DECLARE(ftdm_status_t) ftdm_span_set_bearer_capability(const char *bc_string, ftdm_bearer_cap_t *target); -FT_DECLARE(ftdm_status_t) ftdm_span_set_bearer_layer1(const char *bc_string, ftdm_user_layer1_prot_t *target); -FT_DECLARE(ftdm_status_t) ftdm_is_number(char *number); - -#endif /* __FTDM_CALL_UTILS_H__ */ - commit 5b15e03f30eabcba91b0c1bec09a489221bbaaaa Author: Brian West <brian@freeswitch.org> Date: Tue Nov 30 11:24:59 2010 -0600 swigall diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index ca001f6..d2f63b1 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -7626,6 +7626,22 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_execute_application_get_fl } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_execute_application_async(void * jarg1, char * jarg2, char * jarg3) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (char *)jarg3; + result = (switch_status_t)switch_core_session_execute_application_async(arg1,(char const *)arg2,(char const *)arg3); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_get_app_flags(char * jarg1, void * jarg2) { int jresult ; char *arg1 = (char *) 0 ; @@ -7856,6 +7872,18 @@ SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_session_event_count(void } +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_session_messages_waiting(void * jarg1) { + unsigned long jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + uint32_t result; + + arg1 = (switch_core_session_t *)jarg1; + result = (uint32_t)switch_core_session_messages_waiting(arg1); + jresult = (unsigned long)result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_dequeue_event(void * jarg1, void * jarg2, int jarg3) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index bd90191..fd4915f 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -1439,6 +1439,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_core_session_execute_application_async(SWIGTYPE_p_switch_core_session session, string app, string arg) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_execute_application_async(SWIGTYPE_p_switch_core_session.getCPtr(session), app, arg); + return ret; + } + public static switch_status_t switch_core_session_get_app_flags(string app, SWIGTYPE_p_int flags) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_get_app_flags(app, SWIGTYPE_p_int.getCPtr(flags)); return ret; @@ -1518,6 +1523,11 @@ public class freeswitch { return ret; } + public static uint switch_core_session_messages_waiting(SWIGTYPE_p_switch_core_session session) { + uint ret = freeswitchPINVOKE.switch_core_session_messages_waiting(SWIGTYPE_p_switch_core_session.getCPtr(session)); + return ret; + } + public static switch_status_t switch_core_session_dequeue_event(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_event arg1, switch_bool_t force) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_dequeue_event(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_event.getCPtr(arg1), (int)force); return ret; @@ -7449,6 +7459,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_execute_application_get_flags")] public static extern int switch_core_session_execute_application_get_flags(HandleRef jarg1, string jarg2, string jarg3, HandleRef jarg4); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_execute_application_async")] + public static extern int switch_core_session_execute_application_async(HandleRef jarg1, string jarg2, string jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_app_flags")] public static extern int switch_core_session_get_app_flags(string jarg1, HandleRef jarg2); @@ -7497,6 +7510,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_event_count")] public static extern uint switch_core_session_event_count(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_messages_waiting")] + public static extern uint switch_core_session_messages_waiting(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_dequeue_event")] public static extern int switch_core_session_dequeue_event(HandleRef jarg1, HandleRef jarg2, int jarg3); commit 2a00d3ea1300ed918d713840c99b9313981f0799 Merge: 469728a 8b0421f Author: Moises Silva <moy@sangoma.com> Date: Tue Nov 30 12:19:42 2010 -0500 Merge remote branch 'fsorig/master' Conflicts: conf/dialplan/default.xml diff --cc libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c index 657aa5e,a869bda..f6d670c --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c @@@ -190,8 -181,8 +190,9 @@@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm signal_data->min_digits = 8; signal_data->overlap_dial = SNGISDN_OPT_DEFAULT; signal_data->setup_arb = SNGISDN_OPT_DEFAULT; + signal_data->facility_ie_decode = SNGISDN_OPT_TRUE; signal_data->timer_t3 = 8; + signal_data->restart_opt = SNGISDN_OPT_DEFAULT; signal_data->link_id = span->span_id; span->default_caller_data.bearer_capability = IN_ITC_SPEECH; commit ef4a4ed03498769c34bfbb22fce1e100a3e3b5e8 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Nov 30 11:01:54 2010 -0600 run execute_on_answer on_media _on_ring apps async diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 231b26f..33df7e3 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -882,6 +882,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_exec(_In_ switch_core_sessio SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application_get_flags(_In_ switch_core_session_t *session, _In_ const char *app, _In_opt_z_ const char *arg, _Out_opt_ int32_t *flags); +SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application_async(switch_core_session_t *session, const char *app, const char *arg); + SWITCH_DECLARE(switch_status_t) switch_core_session_get_app_flags(const char *app, int32_t *flags); /*! diff --git a/src/switch_channel.c b/src/switch_channel.c index c63a1aa..a9c87c5 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2518,7 +2518,12 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready_value(swi if ((arg = strchr(app, ' '))) { *arg++ = '\0'; } - switch_core_session_execute_application(channel->session, app, arg); + + if (switch_core_session_in_thread(channel->session)) { + switch_core_session_execute_application(channel->session, app, arg); + } else { + switch_core_session_execute_application_async(channel->session, app, arg); + } } return SWITCH_STATUS_SUCCESS; @@ -2571,7 +2576,12 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_ if ((arg = strchr(app, ' '))) { *arg++ = '\0'; } - switch_core_session_execute_application(channel->session, app, arg); + + if (switch_core_session_in_thread(channel->session)) { + switch_core_session_execute_application(channel->session, app, arg); + } else { + switch_core_session_execute_application_async(channel->session, app, arg); + } } if ((var = switch_channel_get_variable(channel, SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE))) { @@ -2750,7 +2760,12 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan } switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "%s execute on answer: %s(%s)\n", channel->name, app, switch_str_nil(arg)); - switch_core_session_execute_application(channel->session, app, arg); + + if (switch_core_session_in_thread(channel->session)) { + switch_core_session_execute_application(channel->session, app, arg); + } else { + switch_core_session_execute_application_async(channel->session, app, arg); + } } } diff --git a/src/switch_core_session.c b/src/switch_core_session.c index aaa47cc..a84bfab 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -855,6 +855,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_queue_event(switch_core_sess if (switch_queue_trypush(session->event_queue, *event) == SWITCH_STATUS_SUCCESS) { *event = NULL; status = SWITCH_STATUS_SUCCESS; + + if (switch_channel_test_flag(session->channel, CF_PROXY_MODE) || switch_channel_test_flag(session->channel, CF_THREAD_SLEEPING)) { + switch_core_session_wake_session_thread(session); + } } } @@ -1814,6 +1818,28 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_app_flags(const char *ap } +SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application_async(switch_core_session_t *session, const char *app, const char *arg) +{ + switch_event_t *execute_event; + + if (switch_event_create(&execute_event, SWITCH_EVENT_COMMAND) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "call-command", "execute"); + switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "execute-app-name", app); + + if (arg) { + switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "execute-app-arg", arg); + } + + switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "event-lock", "true"); + switch_core_session_queue_private_event(session, &execute_event, SWITCH_FALSE); + + return SWITCH_STATUS_SUCCESS; + } + + return SWITCH_STATUS_FALSE; +} + + SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application_get_flags(switch_core_session_t *session, const char *app, const char *arg, int32_t *flags) { diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 4cae1a6..4d320d0 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -348,20 +348,10 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) if (read_frame_count > DEFAULT_LEAD_FRAMES && switch_channel_media_ack(chan_a)) { if (exec_app) { - switch_event_t *execute_event; switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_a), SWITCH_LOG_DEBUG, "%s Bridge execute app %s(%s)\n", switch_channel_get_name(chan_a), exec_app, exec_data); - if (switch_event_create(&execute_event, SWITCH_EVENT_COMMAND) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "call-command", "execute"); - switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "execute-app-name", exec_app); - if (exec_data) { - switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "execute-app-arg", exec_data); - } - //switch_event_add_header(execute_event, SWITCH_STACK_BOTTOM, "lead-frames", "%d", 5); - switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "event-lock", "true"); - switch_core_session_queue_private_event(session_a, &execute_event, SWITCH_FALSE); - } + switch_core_session_execute_application_async(session_a, exec_app, exec_data); exec_app = exec_data = NULL; } commit 469728a8656431e334e77d92d398cca05fa6c4a0 Author: Moises Silva <moy@sangoma.com> Date: Tue Nov 30 11:38:38 2010 -0500 freetdm: clear out wait flags in the core on timeout diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 6f54330..4df4d81 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2828,21 +2828,17 @@ done: FT_DECLARE(ftdm_status_t) ftdm_channel_wait(ftdm_channel_t *ftdmchan, ftdm_wait_flag_t *flags, int32_t to) { - assert(ftdmchan != NULL); - assert(ftdmchan->fio != NULL); - - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "channel not open"); - return FTDM_FAIL; - } + ftdm_status_t status = FTDM_FAIL; + ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "Null channel\n"); + ftdm_assert_return(ftdmchan->fio != NULL, FTDM_FAIL, "Null io interface\n"); + ftdm_assert_return(ftdmchan->fio->wait != NULL, FTDM_NOTIMPL, "wait method not implemented\n"); - if (!ftdmchan->fio->wait) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "method not implemented"); - return FTDM_FAIL; + status = ftdmchan->fio->wait(ftdmchan, flags, to); + if (status == FTDM_TIMEOUT) { + /* make sure the flags are cleared on timeout */ + *flags = 0; } - - return ftdmchan->fio->wait(ftdmchan, flags, to); - + return status; } /*******************************/ commit 006b3165cf7d0e512e4b3d7ed23c92f2bedb1d22 Author: root <root@proxy-2.(none)> Date: Tue Nov 30 19:35:38 2010 +0300 fix issues with Progress message type if pre_answer enabled diff --git a/src/mod/endpoints/mod_h323/changes.txt b/src/mod/endpoints/mod_h323/changes.txt index 19aca46..c01542e 100644 --- a/src/mod/endpoints/mod_h323/changes.txt +++ b/src/mod/endpoints/mod_h323/changes.txt @@ -1,3 +1,4 @@ +fix issues with Progress message type if pre_answer enabled fix crashes on FSH323Connection calls in on_hangup routine in different threads. move PTrace level set to FSH323EndPoint::Initialise partially apply patch from from Peter Olsson, Remove UnLock() when TryLock() failed and DEBUG_RTP_PACKETS directive. diff --git a/src/mod/endpoints/mod_h323/mod_h323.cpp b/src/mod/endpoints/mod_h323/mod_h323.cpp index 142506d..6365f9c 100644 --- a/src/mod/endpoints/mod_h323/mod_h323.cpp +++ b/src/mod/endpoints/mod_h323/mod_h323.cpp @@ -1148,7 +1148,7 @@ void FSH323Connection::AnsweringCall(AnswerCallResponse response) if (!mediaWaitForConnect) { // create a new facility PDU if doing AnswerDeferredWithMedia H323SignalPDU want245PDU; - //H225_Progress_UUIE & prog = want245PDU.BuildProgress(*this); + want245PDU.BuildProgress(*this); PBoolean sendPDU = TRUE; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,"mediaWaitForConnect = FALSE\n"); /* if (SendFastStartAcknowledge(prog.m_fastStart)){ commit a523e7755c111023ec767e298206fd7657693b94 Author: Moises Silva <moy@sangoma.com> Date: Tue Nov 30 11:07:40 2010 -0500 freetdm: get rid of Linux warnings in testsangomaboost.c diff --git a/libs/freetdm/src/testsangomaboost.c b/libs/freetdm/src/testsangomaboost.c index 38eac3c..85b5332 100644 --- a/libs/freetdm/src/testsangomaboost.c +++ b/libs/freetdm/src/testsangomaboost.c @@ -45,10 +45,14 @@ #include <signal.h> -#include "freetdm.h" #include <stdlib.h> #include <string.h> #include <errno.h> +#ifdef __linux__ +#define __USE_BSD +#include <unistd.h> +#endif +#include "freetdm.h" /* arbitrary limit for max calls in this sample program */ @@ -338,9 +342,9 @@ int main(int argc, char *argv[]) exit(-1); } - if (!strcasecmp(argv[2], "cpe")) { + if (!strcmp(argv[2], "cpe")) { sigtype = "pri_cpe"; - } else if (!strcasecmp(argv[2], "net")) { + } else if (!strcmp(argv[2], "net")) { sigtype = "pri_net"; } else { fprintf(stderr, "Valid signaling types are cpe and net only\n"); commit 136fc8aa954cf7154b75a72297e76b94cb92e3c3 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Tue Nov 30 13:56:29 2010 -0200 freetdm: ftmod_wanpipe - removed 80% tx/rx queue warnings diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index 804c6cf..17f0219 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -789,16 +789,6 @@ static void wanpipe_write_stats(ftdm_channel_t *ftdmchan, wp_tdm_api_tx_hdr_t *t ftdmchan->iostats.tx.queue_size = tx_stats->wp_api_tx_hdr_max_queue_length; ftdmchan->iostats.tx.queue_len = tx_stats->wp_api_tx_hdr_number_of_frames_in_queue; - if (ftdmchan->iostats.tx.queue_len >= (0.8 * ftdmchan->iostats.tx.queue_size)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Tx Queue length exceeded 80% threshold (%d/%d)\n", - ftdmchan->iostats.tx.queue_len, ftdmchan->iostats.tx.queue_size); - ftdm_set_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_THRES); - } else if (ftdm_test_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_THRES)){ - ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Tx Queue length reduced 80% threshold (%d/%d)\n", - ftdmchan->iostats.tx.queue_len, ftdmchan->iostats.tx.queue_size); - ftdm_clear_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_THRES); - } - if (ftdmchan->iostats.tx.queue_len >= ftdmchan->iostats.rx.queue_size) { ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Tx Queue Full (%d/%d)\n", ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); @@ -860,17 +850,6 @@ static void wanpipe_read_stats(ftdm_channel_t *ftdmchan, wp_tdm_api_rx_hdr_t *rx ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_FRAME); } - if (ftdmchan->iostats.rx.queue_len >= (0.8 * ftdmchan->iostats.rx.queue_size)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Rx Queue length exceeded 80% threshold (%d/%d)\n", - ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); - ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES); - } else if (ftdm_test_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES)){ - /* any reason we have wanpipe_tdm_api_iface.h in ftmod_wanpipe/ dir? */ - ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Rx Queue length reduced 80% threshold (%d/%d)\n", - ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); - ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES); - } - if (ftdmchan->iostats.rx.queue_len >= ftdmchan->iostats.rx.queue_size) { ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Rx Queue Full (%d/%d)\n", ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); commit bce61e7f926ca424c04340d217ac5ee3246fe454 Author: Moises Silva <moy@sangoma.com> Date: Tue Nov 30 10:49:23 2010 -0500 freetdm: ftmod_wanpipe - use SANGOMA_WAIT_INFINITE instead of -1 diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index c20ad82..65c587c 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -121,6 +121,10 @@ static __inline__ int tdmv_api_wait_socket(ftdm_channel_t *ftdmchan, int timeout uint32_t outflags = 0; sangoma_wait_obj_t *sangoma_wait_obj = ftdmchan->io_data; + if (timeout == -1) { + timeout = SANGOMA_WAIT_INFINITE; + } + err = sangoma_waitfor(sangoma_wait_obj, inflags, &outflags, timeout); *flags = 0; if (err == SANG_STATUS_SUCCESS) { commit 8b0421ff6815457ac9b21223db2bbe338cd782f0 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Nov 30 09:49:12 2010 -0600 add new function to check when messages need parsing to improve performance on parsing messages during originate diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 3f636d0..231b26f 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -1024,6 +1024,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_queue_event(_In_ switch_core */ SWITCH_DECLARE(uint32_t) switch_core_session_event_count(_In_ switch_core_session_t *session); +/* + Number of parsable messages waiting on the session. + */ +SWITCH_DECLARE(uint32_t) switch_core_session_messages_waiting(switch_core_session_t *session); + /*! \brief DE-Queue an event on a given session \param session the session to de-queue the message on diff --git a/src/switch_core_session.c b/src/switch_core_session.c index eca2f8d..aaa47cc 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -861,6 +861,21 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_queue_event(switch_core_sess return status; } +SWITCH_DECLARE(uint32_t) switch_core_session_messages_waiting(switch_core_session_t *session) +{ + int x = 0; + + if (session->private_event_queue) { + x += switch_queue_size(session->private_event_queue); + } + + if (session->message_queue) { + x += switch_queue_size(session->message_queue); + } + + return x; +} + SWITCH_DECLARE(uint32_t) switch_core_session_event_count(switch_core_session_t *session) { if (session->event_queue) { diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index f99ac69..e615347 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -638,10 +638,12 @@ static uint8_t check_channel_status(originate_global_t *oglobals, originate_stat if (!switch_channel_test_flag(originate_status[i].peer_channel, CF_PARK) && !switch_channel_test_flag(originate_status[i].peer_channel, CF_CONSUME_ON_ORIGINATE)) { - if (switch_channel_test_flag(originate_status[i].peer_channel, CF_THREAD_SLEEPING)) { - switch_core_session_wake_session_thread(originate_status[i].peer_session); - } else { - switch_ivr_parse_all_events(originate_status[i].peer_session); + if (switch_core_session_messages_waiting(originate_status[i].peer_session)) { + if (switch_channel_test_flag(originate_status[i].peer_channel, CF_THREAD_SLEEPING)) { + switch_core_session_wake_session_thread(originate_status[i].peer_session); + } else { + switch_ivr_parse_all_events(originate_status[i].peer_session); + } } } commit 7630d47e0e9efb0cea1f2a2ae7f908fee43d80a3 Author: Jeff Lenk <jeff@jefflenk.com> Date: Mon Nov 29 21:55:34 2010 -0600 VS2010 Initial version for freetdm diff --git a/libs/freetdm/freetdm.2010.sln b/libs/freetdm/freetdm.2010.sln new file mode 100644 index 0000000..1806e9e --- /dev/null +++ b/libs/freetdm/freetdm.2010.sln @@ -0,0 +1,137 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "freetdm", "msvc\freetdm.2010.vcxproj", "{93B8812C-3EC4-4F78-8970-FFBFC99E167D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testanalog", "msvc\testanalog\testanalog.2010.vcxproj", "{BB833648-BAFF-4BE2-94DB-F8BB043C588C}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testisdn", "msvc\testisdn\testisdn.2010.vcxproj", "{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_freetdm", "mod_freetdm\mod_freetdm.2010.vcxproj", "{FE3540C5-3303-46E0-A69E-D92F775687F1}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_analog", "src\ftmod\ftmod_analog\ftmod_analog.2010.vcxproj", "{37C94798-6E33-4B4F-8EE0-C72A7DC91157}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_analog_em", "src\ftmod\ftmod_analog_em\ftmod_analog_em.2010.vcxproj", "{B3F49375-2834-4937-9D8C-4AC2EC911010}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_isdn", "src\ftmod\ftmod_isdn\ftmod_isdn.2010.vcxproj", "{729344A5-D5E9-434D-8EE8-AF8C6C795D15}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_pika", "src\ftmod\ftmod_pika\ftmod_pika.2010.vcxproj", "{E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_wanpipe", "src\ftmod\ftmod_wanpipe\ftmod_wanpipe.2010.vcxproj", "{1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_sangoma_boost", "src\ftmod\ftmod_sangoma_boost\ftmod_sangoma_boost.2010.vcxproj", "{D021EF2A-460D-4827-A0F7-41FDECF46F1B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testboost", "msvc\testboost\testboost.2010.vcxproj", "{2B1BAF36-0241-43E7-B865-A8338AD48E2E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testsangomaboost", "msvc\testboost\testsangomaboost.2010.vcxproj", "{0DA69C18-4FA1-4E8C-89CE-12498637C5BE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_sangoma_isdn", "src\ftmod\ftmod_sangoma_isdn\ftmod_sangoma_isdn.2010.vcxproj", "{B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_r2", "src\ftmod\ftmod_r2\ftmod_r2.2010.vcxproj", "{08C3EA27-A51D-47F8-B47D-B189C649CF30}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Debug|Win32.ActiveCfg = Debug|Win32 + {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Debug|Win32.Build.0 = Debug|Win32 + {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Debug|x64.ActiveCfg = Debug|x64 + {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Debug|x64.Build.0 = Debug|x64 + {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|Win32.ActiveCfg = Release|Win32 + {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|Win32.Build.0 = Release|Win32 + {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|x64.ActiveCfg = Release|x64 + {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|x64.Build.0 = Release|x64 + {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|Win32.ActiveCfg = Debug|Win32 + {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|Win32.Build.0 = Debug|Win32 + {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|x64.ActiveCfg = Debug|x64 + {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|x64.Build.0 = Debug|x64 + {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Release|Win32.ActiveCfg = Release|Win32 + {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Release|Win32.Build.0 = Release|Win32 + {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Release|x64.ActiveCfg = Release|x64 + {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Release|x64.Build.0 = Release|x64 + {6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Debug|Win32.ActiveCfg = Debug|Win32 + {6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Debug|x64.ActiveCfg = Debug|x64 + {6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Release|Win32.ActiveCfg = Release|Win32 + {6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Release|x64.ActiveCfg = Release|x64 + {FE3540C5-3303-46E0-A69E-D92F775687F1}.Debug|Win32.ActiveCfg = Debug|Win32 + {FE3540C5-3303-46E0-A69E-D92F775687F1}.Debug|Win32.Build.0 = Debug|Win32 + {FE3540C5-3303-46E0-A69E-D92F775687F1}.Debug|x64.ActiveCfg = Debug|x64 + {FE3540C5-3303-46E0-A69E-D92F775687F1}.Debug|x64.Build.0 = Debug|x64 + {FE3540C5-3303-46E0-A69E-D92F775687F1}.Release|Win32.ActiveCfg = Release|Win32 + {FE3540C5-3303-46E0-A69E-D92F775687F1}.Release|Win32.Build.0 = Release|Win32 + {FE3540C5-3303-46E0-A69E-D92F775687F1}.Release|x64.ActiveCfg = Release|x64 + {FE3540C5-3303-46E0-A69E-D92F775687F1}.Release|x64.Build.0 = Release|x64 + {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Debug|Win32.ActiveCfg = Debug|Win32 + {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Debug|Win32.Build.0 = Debug|Win32 + {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Debug|x64.ActiveCfg = Debug|x64 + {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Debug|x64.Build.0 = Debug|x64 + {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Release|Win32.ActiveCfg = Release|Win32 + {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Release|Win32.Build.0 = Release|Win32 + {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Release|x64.ActiveCfg = Release|x64 + {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Release|x64.Build.0 = Release|x64 + {B3F49375-2834-4937-9D8C-4AC2EC911010}.Debug|Win32.ActiveCfg = Debug|Win32 + {B3F49375-2834-4937-9D8C-4AC2EC911010}.Debug|Win32.Build.0 = Debug|Win32 + {B3F49375-2834-4937-9D8C-4AC2EC911010}.Debug|x64.ActiveCfg = Debug|x64 + {B3F49375-2834-4937-9D8C-4AC2EC911010}.Debug|x64.Build.0 = Debug|x64 + {B3F49375-2834-4937-9D8C-4AC2EC911010}.Release|Win32.ActiveCfg = Release|Win32 + {B3F49375-2834-4937-9D8C-4AC2EC911010}.Release|Win32.Build.0 = Release|Win32 + {B3F49375-2834-4937-9D8C-4AC2EC911010}.Release|x64.ActiveCfg = Release|x64 + {B3F49375-2834-4937-9D8C-4AC2EC911010}.Release|x64.Build.0 = Release|x64 + {729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Debug|Win32.ActiveCfg = Debug|Win32 + {729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Debug|x64.ActiveCfg = Debug|x64 + {729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Release|Win32.ActiveCfg = Release|Win32 + {729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Release|x64.ActiveCfg = Release|x64 + {E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Debug|Win32.ActiveCfg = Debug|Win32 + {E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Debug|x64.ActiveCfg = Debug|x64 + {E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Release|Win32.ActiveCfg = Release|Win32 + {E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Release|x64.ActiveCfg = Release|x64 + {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Debug|Win32.ActiveCfg = Debug|Win32 + {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Debug|Win32.Build.0 = Debug|Win32 + {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Debug|x64.ActiveCfg = Debug|x64 + {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Release|Win32.ActiveCfg = Release|Win32 + {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Release|x64.ActiveCfg = Release|x64 + {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Debug|Win32.ActiveCfg = Debug|Win32 + {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Debug|Win32.Build.0 = Debug|Win32 + {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Debug|x64.ActiveCfg = Debug|x64 + {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Debug|x64.Build.0 = Debug|x64 + {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Release|Win32.ActiveCfg = Release|Win32 + {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Release|Win32.Build.0 = Release|Win32 + {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Release|x64.ActiveCfg = Release|x64 + {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Release|x64.Build.0 = Release|x64 + {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Debug|Win32.ActiveCfg = Debug|Win32 + {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Debug|Win32.Build.0 = Debug|Win32 + {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Debug|x64.ActiveCfg = Debug|x64 + {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Debug|x64.Build.0 = Debug|x64 + {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Release|Win32.ActiveCfg = Release|Win32 + {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Release|Win32.Build.0 = Release|Win32 + {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Release|x64.ActiveCfg = Release|x64 + {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Release|x64.Build.0 = Release|x64 + {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Debug|Win32.ActiveCfg = Debug|Win32 + {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Debug|Win32.Build.0 = Debug|Win32 + {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Debug|x64.ActiveCfg = Debug|x64 + {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Debug|x64.Build.0 = Debug|x64 + {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|Win32.ActiveCfg = Release|Win32 + {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|Win32.Build.0 = Release|Win32 + {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|x64.ActiveCfg = Release|x64 + {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|x64.Build.0 = Release|x64 + {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Debug|Win32.ActiveCfg = Debug|Win32 + {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Debug|Win32.Build.0 = Debug|Win32 + {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Debug|x64.ActiveCfg = Debug|Win32 + {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|Win32.ActiveCfg = Release|Win32 + {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|Win32.Build.0 = Release|Win32 + {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|x64.ActiveCfg = Release|Win32 + {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Debug|Win32.ActiveCfg = Debug|Win32 + {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Debug|Win32.Build.0 = Debug|Win32 + {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Debug|x64.ActiveCfg = Debug|Win32 + {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Release|Win32.ActiveCfg = Release|Win32 + {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Release|Win32.Build.0 = Release|Win32 + {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Release|x64.ActiveCfg = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/libs/freetdm/msvc/freetdm.2010.vcxproj b/libs/freetdm/msvc/freetdm.2010.vcxproj new file mode 100644 index 0000000..71eb6db --- /dev/null +++ b/libs/freetdm/msvc/freetdm.2010.vcxproj @@ -0,0 +1,223 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>freetdm</ProjectName> + <ProjectGuid>{93B8812C-3EC4-4F78-8970-FFBFC99E167D}</ProjectGuid> + <RootNamespace>freetdm</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <BuildLog> + <Path>$(IntDir)BuildLog-freetdm.htm</Path> + </BuildLog> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../src/include;../src/include/private;../src/isdn/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FREETDM_EXPORTS;TELETONE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <DisableLanguageExtensions>false</DisableLanguageExtensions> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <CompileAs>CompileAsC</CompileAs> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <BuildLog> + <Path>$(IntDir)BuildLog-freetdm.htm</Path> + </BuildLog> + <ClCompile> + <AdditionalIncludeDirectories>../src/include;../src/include/private;../src/isdn/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FREETDM_EXPORTS;TELETONE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <DisableLanguageExtensions>false</DisableLanguageExtensions> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <CompileAs>CompileAsC</CompileAs> + </ClCompile> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <BuildLog> + <Path>$(IntDir)BuildLog-freetdm.htm</Path> + </BuildLog> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../src/include;../src/include/private;../src/isdn/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FREETDM_EXPORTS;TELETONE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <DisableLanguageExtensions>false</DisableLanguageExtensions> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <CompileAs>CompileAsC</CompileAs> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <BuildLog> + <Path>$(IntDir)BuildLog-freetdm.htm</Path> + </BuildLog> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <AdditionalIncludeDirectories>../src/include;../src/include/private;../src/isdn/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FREETDM_EXPORTS;TELETONE_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <DisableLanguageExtensions>false</DisableLanguageExtensions> + <RuntimeTypeInfo>false</RuntimeTypeInfo> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <CompileAs>CompileAsC</CompileAs> + </ClCompile> + <Link> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\src\include\freetdm.h" /> + <ClInclude Include="..\src\include\private\fsk.h" /> + <ClInclude Include="..\src\include\private\ftdm_buffer.h" /> + <ClInclude Include="..\src\include\private\ftdm_call_utils.h" /> + <ClInclude Include="..\src\include\private\ftdm_config.h" /> + <ClInclude Include="..\src\include\private\ftdm_core.h" /> + <ClInclude Include="..\src\include\ftdm_declare.h" /> + <ClInclude Include="..\src\include\private\ftdm_dso.h" /> + <ClInclude Include="..\src\include\ftdm_os.h" /> + <ClInclude Include="..\src\include\private\ftdm_sched.h" /> + <ClInclude Include="..\src\include\ftdm_threadmutex.h" /> + <ClInclude Include="..\src\include\private\ftdm_types.h" /> + <ClInclude Include="..\src\include\private\g711.h" /> + <ClInclude Include="..\src\include\private\hashtable.h" /> + <ClInclude Include="..\src\include\private\hashtable_itr.h" /> + <ClInclude Include="..\src\include\private\hashtable_private.h" /> + <ClInclude Include="..\src\include\private\libteletone.h" /> + <ClInclude Include="..\src\include\private\libteletone_detect.h" /> + <ClInclude Include="..\src\include\private\libteletone_generate.h" /> + <ClInclude Include="..\src\include\private\uart.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\src\fsk.c" /> + <ClCompile Include="..\src\ftdm_buffer.c" /> + <ClCompile Include="..\src\ftdm_call_utils.c" /> + <ClCompile Include="..\src\ftdm_callerid.c" /> + <ClCompile Include="..\src\ftdm_config.c" /> + <ClCompile Include="..\src\ftdm_cpu_monitor.c" /> + <ClCompile Include="..\src\ftdm_dso.c" /> + <ClCompile Include="..\src\ftdm_io.c" /> + <ClCompile Include="..\src\ftdm_queue.c" /> + <ClCompile Include="..\src\ftdm_sched.c" /> + <ClCompile Include="..\src\ftdm_threadmutex.c" /> + <ClCompile Include="..\src\g711.c" /> + <ClCompile Include="..\src\hashtable.c" /> + <ClCompile Include="..\src\hashtable_itr.c" /> + <ClCompile Include="..\src\libteletone_detect.c" /> + <ClCompile Include="..\src\libteletone_generate.c" /> + <ClCompile Include="..\src\uart.c" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/libs/freetdm/msvc/freetdm.2010.vcxproj.filters b/libs/freetdm/msvc/freetdm.2010.vcxproj.filters new file mode 100644 index 0000000..ed642ba --- /dev/null +++ b/libs/freetdm/msvc/freetdm.2010.vcxproj.filters @@ -0,0 +1,128 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\src\include\freetdm.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\src\include\private\fsk.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\src\include\private\ftdm_buffer.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\src\include\private\ftdm_call_utils.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\src\include\private\ftdm_config.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\src\include\private\ftdm_core.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\src\include\ftdm_declare.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\src\include\private\ftdm_dso.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\src\include\ftdm_os.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\src\include\private\ftdm_sched.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\src\include\ftdm_threadmutex.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\src\include\private\ftdm_types.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\src\include\private\g711.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\src\include\private\hashtable.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\src\include\private\hashtable_itr.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\src\include\private\hashtable_private.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\src\include\private\libteletone.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\src\include\private\libteletone_detect.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\src\include\private\libteletone_generate.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\src\include\private\uart.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\src\fsk.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\ftdm_buffer.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\ftdm_call_utils.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\ftdm_callerid.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\ftdm_config.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\ftdm_cpu_monitor.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\ftdm_dso.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\ftdm_io.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\ftdm_queue.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\ftdm_sched.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\ftdm_threadmutex.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\g711.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\hashtable.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\hashtable_itr.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\libteletone_detect.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\libteletone_generate.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\uart.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/freetdm/msvc/testanalog/testanalog.2010.vcxproj b/libs/freetdm/msvc/testanalog/testanalog.2010.vcxproj new file mode 100644 index 0000000..719dc61 --- /dev/null +++ b/libs/freetdm/msvc/testanalog/testanalog.2010.vcxproj @@ -0,0 +1,213 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>testanalog</ProjectName> + <ProjectGuid>{BB833648-BAFF-4BE2-94DB-F8BB043C588C}</ProjectGuid> + <RootNamespace>testanalog</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <BuildLog> + <Path>$(IntDir)BuildLog-testanalog.htm</Path> + </BuildLog> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../src/include;../../src/isdn/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <BuildLog> + <Path>$(IntDir)BuildLog-testanalog.htm</Path> + </BuildLog> + <ClCompile> + <AdditionalIncludeDirectories>../../src/include;../../src/isdn/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <BuildLog> + <Path>$(IntDir)BuildLog-testanalog.htm</Path> + </BuildLog> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../src/include;../../src/isdn/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <BuildLog> + <Path>$(IntDir)BuildLog-testanalog.htm</Path> + </BuildLog> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <AdditionalIncludeDirectories>../../src/include;../../src/isdn/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\src\testanalog.c" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\freetdm.2010.vcxproj"> + <Project>{93b8812c-3ec4-4f78-8970-ffbfc99e167d}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/libs/freetdm/msvc/testanalog/testanalog.2010.vcxproj.filters b/libs/freetdm/msvc/testanalog/testanalog.2010.vcxproj.filters new file mode 100644 index 0000000..7ac3635 --- /dev/null +++ b/libs/freetdm/msvc/testanalog/testanalog.2010.vcxproj.filters @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\testanalog.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/freetdm/msvc/testboost/testboost.2010.vcxproj b/libs/freetdm/msvc/testboost/testboost.2010.vcxproj new file mode 100644 index 0000000..6206148 --- /dev/null +++ b/libs/freetdm/msvc/testboost/testboost.2010.vcxproj @@ -0,0 +1,218 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>testboost</ProjectName> + <ProjectGuid>{2B1BAF36-0241-43E7-B865-A8338AD48E2E}</ProjectGuid> + <RootNamespace>testboost</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\testboost\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\testboost\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\testboost\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\testboost\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <BuildLog> + <Path>$(IntDir)BuildLog-testboost.htm</Path> + </BuildLog> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../src/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <AdditionalDependencies>..\..\debug\freetdm.lib;%(AdditionalDependencies)</AdditionalDependencies> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <BuildLog> + <Path>$(IntDir)BuildLog-testboost.htm</Path> + </BuildLog> + <ClCompile> + <AdditionalIncludeDirectories>../../src/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <BuildLog> + <Path>$(IntDir)BuildLog-testboost.htm</Path> + </BuildLog> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../src/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <AdditionalDependencies>freetdm.lib;%(AdditionalDependencies)</AdditionalDependencies> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX64</TargetMachine> + <AdditionalLibraryDirectories>../../$(PlatformName)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <BuildLog> + <Path>$(IntDir)BuildLog-testboost.htm</Path> + </BuildLog> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <AdditionalIncludeDirectories>../../src/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX64</TargetMachine> + <AdditionalDependencies>freetdm.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>../../$(PlatformName)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\src\testboost.c" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\freetdm.2010.vcxproj"> + <Project>{93b8812c-3ec4-4f78-8970-ffbfc99e167d}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/libs/freetdm/msvc/testboost/testboost.2010.vcxproj.filters b/libs/freetdm/msvc/testboost/testboost.2010.vcxproj.filters new file mode 100644 index 0000000..74181d6 --- /dev/null +++ b/libs/freetdm/msvc/testboost/testboost.2010.vcxproj.filters @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\testboost.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/freetdm/msvc/testboost/testsangomaboost.2010.vcxproj b/libs/freetdm/msvc/testboost/testsangomaboost.2010.vcxproj new file mode 100644 index 0000000..b6c0518 --- /dev/null +++ b/libs/freetdm/msvc/testboost/testsangomaboost.2010.vcxproj @@ -0,0 +1,218 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>testsangomaboost</ProjectName> + <ProjectGuid>{0DA69C18-4FA1-4E8C-89CE-12498637C5BE}</ProjectGuid> + <RootNamespace>testsangomaboost</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <BuildLog> + <Path>$(IntDir)BuildLog-testsangomaboost.htm</Path> + </BuildLog> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../src/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <AdditionalDependencies>..\..\debug\freetdm.lib;%(AdditionalDependencies)</AdditionalDependencies> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <BuildLog> + <Path>$(IntDir)BuildLog-testsangomaboost.htm</Path> + </BuildLog> + <ClCompile> + <AdditionalIncludeDirectories>../../src/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <BuildLog> + <Path>$(IntDir)BuildLog-testsangomaboost.htm</Path> + </BuildLog> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../src/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>false</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <AdditionalDependencies>freetdm.lib;%(AdditionalDependencies)</AdditionalDependencies> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX64</TargetMachine> + <AdditionalLibraryDirectories>../../$(PlatformName)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <BuildLog> + <Path>$(IntDir)BuildLog-testsangomaboost.htm</Path> + </BuildLog> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <AdditionalIncludeDirectories>../../src/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX64</TargetMachine> + <AdditionalDependencies>freetdm.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>../../$(PlatformName)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\src\testsangomaboost.c" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\freetdm.2010.vcxproj"> + <Project>{93b8812c-3ec4-4f78-8970-ffbfc99e167d}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/libs/freetdm/msvc/testboost/testsangomaboost.2010.vcxproj.filters b/libs/freetdm/msvc/testboost/testsangomaboost.2010.vcxproj.filters new file mode 100644 index 0000000..e72f14e --- /dev/null +++ b/libs/freetdm/msvc/testboost/testsangomaboost.2010.vcxproj.filters @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\testsangomaboost.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/freetdm/msvc/testisdn/testisdn.2010.vcxproj b/libs/freetdm/msvc/testisdn/testisdn.2010.vcxproj new file mode 100644 index 0000000..2dfdeb0 --- /dev/null +++ b/libs/freetdm/msvc/testisdn/testisdn.2010.vcxproj @@ -0,0 +1,213 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>testisdn</ProjectName> + <ProjectGuid>{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}</ProjectGuid> + <RootNamespace>testisdn</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <BuildLog> + <Path>$(IntDir)BuildLog-testisdn.htm</Path> + </BuildLog> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../src/include;../../src/isdn/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <BuildLog> + <Path>$(IntDir)BuildLog-testisdn.htm</Path> + </BuildLog> + <ClCompile> + <AdditionalIncludeDirectories>../../src/include;../../src/isdn/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <BuildLog> + <Path>$(IntDir)BuildLog-testisdn.htm</Path> + </BuildLog> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../src/include;../../src/isdn/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <BuildLog> + <Path>$(IntDir)BuildLog-testisdn.htm</Path> + </BuildLog> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <AdditionalIncludeDirectories>../../src/include;../../src/isdn/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\src\testisdn.c" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\freetdm.2010.vcxproj"> + <Project>{93b8812c-3ec4-4f78-8970-ffbfc99e167d}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/libs/freetdm/msvc/testisdn/testisdn.2010.vcxproj.filters b/libs/freetdm/msvc/testisdn/testisdn.2010.vcxproj.filters new file mode 100644 index 0000000..9d48828 --- /dev/null +++ b/libs/freetdm/msvc/testisdn/testisdn.2010.vcxproj.filters @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\testisdn.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.2010.vcxproj b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.2010.vcxproj new file mode 100644 index 0000000..81cb93f --- /dev/null +++ b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.2010.vcxproj @@ -0,0 +1,198 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>ftmod_analog</ProjectName> + <ProjectGuid>{37C94798-6E33-4B4F-8EE0-C72A7DC91157}</ProjectGuid> + <RootNamespace>ftmod_analog</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>..\..\include;..\..\isdn\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>..\..\include;..\..\isdn\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>..\..\include;..\..\isdn\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>false</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>..\..\include;..\..\isdn\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="ftmod_analog.c" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="ftdm_analog.h" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\msvc\freetdm.2010.vcxproj"> + <Project>{93b8812c-3ec4-4f78-8970-ffbfc99e167d}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.2010.vcxproj.filters b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.2010.vcxproj.filters new file mode 100644 index 0000000..b6fed59 --- /dev/null +++ b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.2010.vcxproj.filters @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="ftmod_analog.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="ftdm_analog.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.2010.vcxproj b/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.2010.vcxproj new file mode 100644 index 0000000..44792df --- /dev/null +++ b/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.2010.vcxproj @@ -0,0 +1,198 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>ftmod_analog_em</ProjectName> + <ProjectGuid>{B3F49375-2834-4937-9D8C-4AC2EC911010}</ProjectGuid> + <RootNamespace>ftmod_analog_em</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>..\..\include;..\..\isdn\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>..\..\include;..\..\isdn\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>..\..\include;..\..\isdn\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>false</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>..\..\include;..\..\isdn\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EM_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="ftmod_analog_em.c" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="ftdm_analog_em.h" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\msvc\freetdm.2010.vcxproj"> + <Project>{93b8812c-3ec4-4f78-8970-ffbfc99e167d}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.2010.vcxproj.filters b/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.2010.vcxproj.filters new file mode 100644 index 0000000..3326f9f --- /dev/null +++ b/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.2010.vcxproj.filters @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="ftmod_analog_em.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="ftdm_analog_em.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.2010.vcxproj b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.2010.vcxproj new file mode 100644 index 0000000..bd2e2fe --- /dev/null +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.2010.vcxproj @@ -0,0 +1,223 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>ftmod_isdn</ProjectName> + <ProjectGuid>{729344A5-D5E9-434D-8EE8-AF8C6C795D15}</ProjectGuid> + <RootNamespace>ftmod_isdn</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>..\..\isdn\include;..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_ISDN_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>..\..\isdn\include;..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_ISDN_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>..\..\isdn\include;..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_ISDN_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>..\..\isdn\include;..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_ISDN_EXPORTS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\isdn\5ESSmes.c" /> + <ClCompile Include="..\..\isdn\5ESSStateNT.c" /> + <ClCompile Include="..\..\isdn\5ESSStateTE.c" /> + <ClCompile Include="..\..\isdn\DMSmes.c" /> + <ClCompile Include="..\..\isdn\DMSStateNT.c" /> + <ClCompile Include="..\..\isdn\DMSStateTE.c" /> + <ClCompile Include="..\..\isdn\EuroISDNStateNT.c" /> + <ClCompile Include="..\..\isdn\EuroISDNStateTE.c" /> + <ClCompile Include="..\..\isdn\mfifo.c" /> + <ClCompile Include="..\..\isdn\nationalmes.c" /> + <ClCompile Include="..\..\isdn\nationalStateNT.c" /> + <ClCompile Include="..\..\isdn\nationalStateTE.c" /> + <ClCompile Include="ftmod_isdn.c" /> + <ClCompile Include="..\..\isdn\Q921.c" /> + <ClCompile Include="..\..\isdn\Q931.c" /> + <ClCompile Include="..\..\isdn\Q931api.c" /> + <ClCompile Include="..\..\isdn\Q931ie.c" /> + <ClCompile Include="..\..\isdn\Q931mes.c" /> + <ClCompile Include="..\..\isdn\Q931StateNT.c" /> + <ClCompile Include="..\..\isdn\Q931StateTE.c" /> + <ClCompile Include="..\..\isdn\Q932mes.c" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\isdn\include\5ESS.h" /> + <ClInclude Include="..\..\isdn\include\DMS.h" /> + <ClInclude Include="..\..\isdn\include\mfifo.h" /> + <ClInclude Include="..\..\isdn\include\national.h" /> + <ClInclude Include="..\..\isdn\include\Q921.h" /> + <ClInclude Include="..\..\isdn\include\Q921priv.h" /> + <ClInclude Include="..\..\isdn\include\Q931.h" /> + <ClInclude Include="..\..\isdn\include\Q931ie.h" /> + <ClInclude Include="..\..\isdn\include\Q932.h" /> + <ClInclude Include="ftdm_isdn.h" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\msvc\freetdm.2010.vcxproj"> + <Project>{93b8812c-3ec4-4f78-8970-ffbfc99e167d}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.2010.vcxproj.filters b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.2010.vcxproj.filters new file mode 100644 index 0000000..3082488 --- /dev/null +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.2010.vcxproj.filters @@ -0,0 +1,110 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\isdn\5ESSmes.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\isdn\5ESSStateNT.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\isdn\5ESSStateTE.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\isdn\DMSmes.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\isdn\DMSStateNT.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\isdn\DMSStateTE.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\isdn\EuroISDNStateNT.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\isdn\EuroISDNStateTE.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\isdn\mfifo.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\isdn\nationalmes.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\isdn\nationalStateNT.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\isdn\nationalStateTE.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="ftmod_isdn.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\isdn\Q921.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\isdn\Q931.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\isdn\Q931api.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\isdn\Q931ie.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\isdn\Q931mes.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\isdn\Q931StateNT.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\isdn\Q931StateTE.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\isdn\Q932mes.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\isdn\include\5ESS.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\isdn\include\DMS.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\isdn\include\mfifo.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\isdn\include\national.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\isdn\include\Q921.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\isdn\include\Q921priv.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\isdn\include\Q931.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\isdn\include\Q931ie.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\isdn\include\Q932.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="ftdm_isdn.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.2010.vcxproj b/libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.2010.vcxproj new file mode 100644 index 0000000..c4004bd --- /dev/null +++ b/libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.2010.vcxproj @@ -0,0 +1,198 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>ftmod_pika</ProjectName> + <ProjectGuid>{E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}</ProjectGuid> + <RootNamespace>ftmod_pika</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>..\..\isdn\include;..\..\include;..\..\..\pika\aoh\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_PIKA_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalDependencies>pikahmpapi.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>..\..\..\pika\aoh\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>..\..\isdn\include;..\..\include;..\..\..\pika\aoh\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_PIKA_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalDependencies>pikahmpapi.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>..\..\..\pika\aoh\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>..\..\isdn\include;..\..\include;..\..\..\pika\aoh\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_PIKA_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalDependencies>pikahmpapi.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>..\..\..\pika\aoh\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>..\..\isdn\include;..\..\include;..\..\..\pika\aoh\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_PIKA_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalDependencies>pikahmpapi.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>..\..\..\pika\aoh\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="ftmod_pika.c" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="ftdm_pika.h" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\msvc\freetdm.2010.vcxproj"> + <Project>{93b8812c-3ec4-4f78-8970-ffbfc99e167d}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.2010.vcxproj.filters b/libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.2010.vcxproj.filters new file mode 100644 index 0000000..4d4cec4 --- /dev/null +++ b/libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.2010.vcxproj.filters @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="ftmod_pika.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="ftdm_pika.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2010.vcxproj b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2010.vcxproj new file mode 100644 index 0000000..f66f5af --- /dev/null +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2010.vcxproj @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>ftmod_r2</ProjectName> + <ProjectGuid>{08C3EA27-A51D-47F8-B47D-B189C649CF30}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</LinkIncremental> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>..\..\include;c:\Program Files\openr2\include\openr2;C:\Program Files\openr2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_R2_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalDependencies>freetdm.lib;openr2.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>C:\Program Files\openr2\lib;$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <AdditionalIncludeDirectories>..\..\include;C:\Program Files\openr2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_R2_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="ftmod_r2.c" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2010.vcxproj.filters b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2010.vcxproj.filters new file mode 100644 index 0000000..9c91228 --- /dev/null +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2010.vcxproj.filters @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx</Extensions> + </Filter> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="ftmod_r2.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.2010.vcxproj b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.2010.vcxproj new file mode 100644 index 0000000..1dd0921 --- /dev/null +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.2010.vcxproj @@ -0,0 +1,206 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>ftmod_sangoma_boost</ProjectName> + <ProjectGuid>{D021EF2A-460D-4827-A0F7-41FDECF46F1B}</ProjectGuid> + <RootNamespace>ftmod_sangoma_boost</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>..\..\include;..\..\isdn\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_SANGOMA_BOOST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <AdditionalDependencies>freetdm.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_SANGOMA_BOOST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>..\..\include;..\..\isdn\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_SANGOMA_BOOST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <AdditionalDependencies>freetdm.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <Optimization>MaxSpeed</Optimization> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_SANGOMA_BOOST_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level4</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4100;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="ftmod_sangoma_boost.c" /> + <ClCompile Include="sangoma_boost_client.c" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="ftdm_sangoma_boost.h" /> + <ClInclude Include="sangoma_boost_client.h" /> + <ClInclude Include="sangoma_boost_interface.h" /> + <ClInclude Include="sigboost.h" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\msvc\freetdm.2010.vcxproj"> + <Project>{93b8812c-3ec4-4f78-8970-ffbfc99e167d}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.2010.vcxproj.filters b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.2010.vcxproj.filters new file mode 100644 index 0000000..2aeed15 --- /dev/null +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.2010.vcxproj.filters @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="ftmod_sangoma_boost.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="sangoma_boost_client.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="ftdm_sangoma_boost.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="sangoma_boost_client.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="sangoma_boost_interface.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="sigboost.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2010.vcxproj b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2010.vcxproj new file mode 100644 index 0000000..b4d234c --- /dev/null +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2010.vcxproj @@ -0,0 +1,121 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>ftmod_sangoma_isdn</ProjectName> + <ProjectGuid>{B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}</ProjectGuid> + <RootNamespace>ftmod_sangoma_isdn</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</LinkIncremental> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>C:\Program Files\libsng_isdn\include;C:\Program Files\libsng_isdn\include\sng_isdn;../../include;C:\Program Files\Sangoma\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <ExceptionHandling> + </ExceptionHandling> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalDependencies>freetdm.lib;libsng_isdn.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>$(OutDir);C:\Program Files\libsng_isdn\lib;C:\Program Files\Sangoma\api\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="ftmod_sangoma_isdn.h" /> + <ClInclude Include="ftmod_sangoma_isdn_trace.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="ftmod_sangoma_isdn.c" /> + <ClCompile Include="ftmod_sangoma_isdn_cfg.c" /> + <ClCompile Include="ftmod_sangoma_isdn_cntrl.c" /> + <ClCompile Include="ftmod_sangoma_isdn_stack_cfg.c" /> + <ClCompile Include="ftmod_sangoma_isdn_stack_cntrl.c" /> + <ClCompile Include="ftmod_sangoma_isdn_stack_hndl.c" /> + <ClCompile Include="ftmod_sangoma_isdn_stack_out.c" /> + <ClCompile Include="ftmod_sangoma_isdn_stack_rcv.c" /> + <ClCompile Include="ftmod_sangoma_isdn_support.c" /> + <ClCompile Include="ftmod_sangoma_isdn_trace.c" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\msvc\freetdm.2010.vcxproj"> + <Project>{93b8812c-3ec4-4f78-8970-ffbfc99e167d}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2010.vcxproj.filters b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2010.vcxproj.filters new file mode 100644 index 0000000..5f592fa --- /dev/null +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2010.vcxproj.filters @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx</Extensions> + </Filter> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="ftmod_sangoma_isdn.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="ftmod_sangoma_isdn_trace.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="ftmod_sangoma_isdn.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="ftmod_sangoma_isdn_cfg.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="ftmod_sangoma_isdn_cntrl.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="ftmod_sangoma_isdn_stack_cfg.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="ftmod_sangoma_isdn_stack_cntrl.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="ftmod_sangoma_isdn_stack_hndl.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="ftmod_sangoma_isdn_stack_out.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="ftmod_sangoma_isdn_stack_rcv.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="ftmod_sangoma_isdn_support.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="ftmod_sangoma_isdn_trace.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2010.vcxproj b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2010.vcxproj new file mode 100644 index 0000000..b165ac8 --- /dev/null +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2010.vcxproj @@ -0,0 +1,201 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>ftmod_wanpipe</ProjectName> + <ProjectGuid>{1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}</ProjectGuid> + <RootNamespace>ftmod_wanpipe</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> + <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> + <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../include;C:\Program Files\Sangoma\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>EditAndContinue</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalDependencies>freetdm.lib;libsangoma.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>$(OutDir);C:\Program Files\Sangoma\api\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../../include;C:\Program Files\Sangoma\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalDependencies>freetdm.lib;libsangoma.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>$(OutDir);C:\Program Files\Sangoma\api\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <AdditionalIncludeDirectories>../../include;C:\Program Files\Sangoma\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalDependencies>freetdm.lib;libsangoma.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>$(OutDir);C:\Program Files\Sangoma\api\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <AdditionalIncludeDirectories>../../include;C:\Program Files\Sangoma\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalDependencies>freetdm.lib;libsangoma.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>$(OutDir);C:\Program Files\Sangoma\api\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="ftmod_wanpipe.c" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\msvc\freetdm.2010.vcxproj"> + <Project>{93b8812c-3ec4-4f78-8970-ffbfc99e167d}</Project> + <ReferenceOutputAssembly>false</ReferenceOutputAssembly> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2010.vcxproj.filters b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2010.vcxproj.filters new file mode 100644 index 0000000..15a8bc3 --- /dev/null +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2010.vcxproj.filters @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="ftmod_wanpipe.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file commit ed5266d3ca944036165a26d06eac3a3fcd0b88a5 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Nov 29 15:34:27 2010 -0600 don't parse events for b legs from a leg thread in case they are using a monolothic python script as a group_confirm exec over socket to send it messages while the call is ringing diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index da76cf6..f99ac69 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -635,8 +635,15 @@ static uint8_t check_channel_status(originate_global_t *oglobals, originate_stat } } } - - switch_ivr_parse_all_events(originate_status[i].peer_session); + + if (!switch_channel_test_flag(originate_status[i].peer_channel, CF_PARK) && + !switch_channel_test_flag(originate_status[i].peer_channel, CF_CONSUME_ON_ORIGINATE)) { + if (switch_channel_test_flag(originate_status[i].peer_channel, CF_THREAD_SLEEPING)) { + switch_core_session_wake_session_thread(originate_status[i].peer_session); + } else { + switch_ivr_parse_all_events(originate_status[i].peer_session); + } + } state = switch_channel_get_state(originate_status[i].peer_channel); if (state >= CS_HANGUP || state == CS_RESET || switch_channel_test_flag(originate_status[i].peer_channel, CF_TRANSFER) || commit 74f04959b4e27f4af677c960c82637e874920395 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Mon Nov 29 19:27:49 2010 -0200 freetdm: ftmod_r2 - reverted last commit diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index b9e0e13..ffc39e8 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -1403,6 +1403,7 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) openr2_chan_process_cas_signaling(r2chan); ftdmchan = openr2_chan_get_client_data(r2chan); + ftdm_channel_set_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS); } memset(&start, 0, sizeof(start)); @@ -1461,12 +1462,6 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) ftdmchan = openr2_chan_get_client_data(r2chan); r2call = R2CALL(ftdmchan); - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_UP)) { - ftdm_channel_set_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS); - } else { - ftdm_channel_clear_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS); - } - ftdm_mutex_lock(ftdmchan->mutex); ftdm_r2_state_advance_all(ftdmchan); openr2_chan_process_signaling(r2chan); commit 9a25519496cf5299b0d4d59ea1ca9da56b008432 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Nov 29 13:02:48 2010 -0600 FS-2368 forgot one debug line diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 64a5f8d..4cae1a6 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -349,7 +349,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) if (exec_app) { switch_event_t *execute_event; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_a), SWITCH_LOG_CRIT, "%s Bridge execute app %s(%s)\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_a), SWITCH_LOG_DEBUG, "%s Bridge execute app %s(%s)\n", switch_channel_get_name(chan_a), exec_app, exec_data); if (switch_event_create(&execute_event, SWITCH_EVENT_COMMAND) == SWITCH_STATUS_SUCCESS) { @@ -1228,8 +1228,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses switch_channel_set_variable(peer_channel, "bridge_pre_execute_data", data); } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "APP [%s][%s]\n", app, switch_str_nil(data)); - } switch_channel_set_private(peer_channel, "_bridge_", b_leg); commit 2572621bc914e30cc22e79749264d67882d0aaf8 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Nov 29 13:00:19 2010 -0600 FS-2368 diff --git a/src/switch_core_session.c b/src/switch_core_session.c index b3bb638..eca2f8d 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -1831,10 +1831,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application_get_flag switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Application %s Requires media on channel %s!\n", app, switch_channel_get_name(session->channel)); } else if (!switch_test_flag(application_interface, SAF_SUPPORT_NOMEDIA) && !switch_channel_media_ready(session->channel)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Application %s Requires media! pre_answering channel %s\n", - app, switch_channel_get_name(session->channel)); - if (switch_channel_pre_answer(session->channel) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Well, that didn't work very well did it? ...\n"); + if (switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_INBOUND) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Application %s Requires media! pre_answering channel %s\n", + app, switch_channel_get_name(session->channel)); + if (switch_channel_pre_answer(session->channel) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Well, that didn't work very well did it? ...\n"); + switch_goto_status(SWITCH_STATUS_FALSE, done); + } + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, + "Cannot execute app '%s' media required on an outbound channel that does not have media established\n", app); switch_goto_status(SWITCH_STATUS_FALSE, done); } } diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index b6363ff..64a5f8d 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -155,7 +155,6 @@ struct switch_ivr_bridge_data { switch_input_callback_function_t input_callback; void *session_data; int clean_exit; - uint32_t skip_frames; }; typedef struct switch_ivr_bridge_data switch_ivr_bridge_data_t; @@ -169,7 +168,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) switch_channel_t *chan_a, *chan_b; switch_frame_t *read_frame; switch_core_session_t *session_a, *session_b; - uint32_t loop_count = 0; + uint32_t read_frame_count = 0; const char *app_name = NULL, *app_arg = NULL; const char *hook_var = NULL; int inner_bridge = 0; @@ -181,6 +180,8 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) const char *bridge_answer_timeout = NULL; int answer_timeout, sent_update = 0; time_t answer_limit = 0; + const char *exec_app = NULL; + const char *exec_data = NULL; #ifdef SWITCH_VIDEO_IN_THREADS switch_thread_t *vid_thread = NULL; @@ -201,6 +202,10 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) chan_a = switch_core_session_get_channel(session_a); chan_b = switch_core_session_get_channel(session_b); + if ((exec_app = switch_channel_get_variable(chan_a, "bridge_pre_execute_app"))) { + exec_data = switch_channel_get_variable(chan_a, "bridge_pre_execute_data"); + } + bypass_media_after_bridge = switch_channel_test_flag(chan_a, CF_BYPASS_MEDIA_AFTER_BRIDGE); switch_channel_clear_flag(chan_a, CF_BYPASS_MEDIA_AFTER_BRIDGE); @@ -212,7 +217,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) } inner_bridge = switch_channel_test_flag(chan_a, CF_INNER_BRIDGE); - + if (!switch_channel_test_flag(chan_a, CF_ANSWERED) && (bridge_answer_timeout = switch_channel_get_variable(chan_a, "bridge_answer_timeout"))) { if ((answer_timeout = atoi(bridge_answer_timeout)) < 0) { answer_timeout = 0; @@ -285,7 +290,6 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) switch_channel_state_t b_state; switch_status_t status; switch_event_t *event; - loop_count++; if (switch_channel_test_flag(chan_a, CF_TRANSFER)) { data->clean_exit = 1; @@ -309,7 +313,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) goto end_of_bridge_loop; } - if (loop_count > DEFAULT_LEAD_FRAMES && switch_channel_media_ack(chan_a) && switch_core_session_private_event_count(session_a)) { + if (read_frame_count > DEFAULT_LEAD_FRAMES && switch_channel_media_ack(chan_a) && switch_core_session_private_event_count(session_a)) { switch_channel_set_flag(chan_b, CF_SUSPEND); msg.string_arg = data->b_uuid; msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE; @@ -341,13 +345,34 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) } #endif - if (loop_count > DEFAULT_LEAD_FRAMES && switch_channel_media_ack(chan_a) && - (bypass_media_after_bridge || switch_channel_test_flag(chan_a, CF_BYPASS_MEDIA_AFTER_BRIDGE)) && switch_channel_test_flag(chan_a, CF_ANSWERED) - && switch_channel_test_flag(chan_b, CF_ANSWERED)) { - switch_ivr_nomedia(switch_core_session_get_uuid(session_a), SMF_REBRIDGE); - bypass_media_after_bridge = 0; - switch_channel_clear_flag(chan_a, CF_BYPASS_MEDIA_AFTER_BRIDGE); - goto end_of_bridge_loop; + if (read_frame_count > DEFAULT_LEAD_FRAMES && switch_channel_media_ack(chan_a)) { + + if (exec_app) { + switch_event_t *execute_event; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session_a), SWITCH_LOG_CRIT, "%s Bridge execute app %s(%s)\n", + switch_channel_get_name(chan_a), exec_app, exec_data); + + if (switch_event_create(&execute_event, SWITCH_EVENT_COMMAND) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "call-command", "execute"); + switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "execute-app-name", exec_app); + if (exec_data) { + switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "execute-app-arg", exec_data); + } + //switch_event_add_header(execute_event, SWITCH_STACK_BOTTOM, "lead-frames", "%d", 5); + switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "event-lock", "true"); + switch_core_session_queue_private_event(session_a, &execute_event, SWITCH_FALSE); + } + exec_app = exec_data = NULL; + } + + + if ((bypass_media_after_bridge || switch_channel_test_flag(chan_a, CF_BYPASS_MEDIA_AFTER_BRIDGE)) && switch_channel_test_flag(chan_a, CF_ANSWERED) + && switch_channel_test_flag(chan_b, CF_ANSWERED)) { + switch_ivr_nomedia(switch_core_session_get_uuid(session_a), SMF_REBRIDGE); + bypass_media_after_bridge = 0; + switch_channel_clear_flag(chan_a, CF_BYPASS_MEDIA_AFTER_BRIDGE); + goto end_of_bridge_loop; + } } /* if 1 channel has DTMF pass it to the other */ @@ -454,6 +479,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) status = switch_core_session_read_frame(session_a, &read_frame, SWITCH_IO_FLAG_NONE, stream_id); if (SWITCH_READ_ACCEPTABLE(status)) { + read_frame_count++; if (switch_test_flag(read_frame, SFF_CNG)) { if (silence_val) { switch_generate_sln_silence((int16_t *) silence_frame.data, silence_frame.samples, silence_val); @@ -463,11 +489,6 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) } } - if (data->skip_frames) { - data->skip_frames--; - continue; - } - if (switch_channel_test_flag(chan_a, CF_BRIDGE_NOWRITE)) { continue; } @@ -1193,35 +1214,24 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses switch_channel_set_variable(peer_channel, SWITCH_SIGNAL_BOND_VARIABLE, switch_core_session_get_uuid(session)); if ((app = switch_channel_get_variable(caller_channel, "bridge_pre_execute_aleg_app"))) { - switch_event_t *execute_event; - - data = switch_channel_get_variable(caller_channel, "bridge_pre_execute_aleg_data"); - if (switch_event_create(&execute_event, SWITCH_EVENT_COMMAND) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "call-command", "execute"); - switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "execute-app-name", app); - switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "execute-app-arg", data); - switch_event_add_header(execute_event, SWITCH_STACK_BOTTOM, "lead-frames", "%d", 5); - switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "event-lock", "true"); - switch_core_session_queue_private_event(session, &execute_event, SWITCH_FALSE); - a_leg->skip_frames = DEFAULT_LEAD_FRAMES; + switch_channel_set_variable(caller_channel, "bridge_pre_execute_app", app); + + if ((data = switch_channel_get_variable(caller_channel, "bridge_pre_execute_aleg_data"))) { + switch_channel_set_variable(caller_channel, "bridge_pre_execute_data", data); } - } if ((app = switch_channel_get_variable(caller_channel, "bridge_pre_execute_bleg_app"))) { - switch_event_t *execute_event; - data = switch_channel_get_variable(caller_channel, "bridge_pre_execute_bleg_data"); - if (switch_event_create(&execute_event, SWITCH_EVENT_COMMAND) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "call-command", "execute"); - switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "execute-app-name", app); - switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "execute-app-arg", data); - switch_event_add_header(execute_event, SWITCH_STACK_BOTTOM, "lead-frames", "%d", 5); - switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "event-lock", "true"); - switch_core_session_queue_private_event(peer_session, &execute_event, SWITCH_FALSE); - b_leg->skip_frames = DEFAULT_LEAD_FRAMES; + switch_channel_set_variable(peer_channel, "bridge_pre_execute_app", app); + + if ((data = switch_channel_get_variable(caller_channel, "bridge_pre_execute_bleg_data"))) { + switch_channel_set_variable(peer_channel, "bridge_pre_execute_data", data); } + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "APP [%s][%s]\n", app, switch_str_nil(data)); + } - + switch_channel_set_private(peer_channel, "_bridge_", b_leg); switch_channel_set_state(peer_channel, CS_EXCHANGE_MEDIA); audio_bridge_thread(NULL, (void *) a_leg); commit ac2998b61f74e06100ca988eefdb608d312d1098 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Mon Nov 29 16:48:01 2010 -0200 freetdm: ftmod_r2 - set feature FTDM_CHANNEL_FEATURE_IO_STATS just when the channel is in FTDM_CHANNEL_STATE_UP state diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index ffc39e8..b9e0e13 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -1403,7 +1403,6 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) openr2_chan_process_cas_signaling(r2chan); ftdmchan = openr2_chan_get_client_data(r2chan); - ftdm_channel_set_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS); } memset(&start, 0, sizeof(start)); @@ -1462,6 +1461,12 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) ftdmchan = openr2_chan_get_client_data(r2chan); r2call = R2CALL(ftdmchan); + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_UP)) { + ftdm_channel_set_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS); + } else { + ftdm_channel_clear_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS); + } + ftdm_mutex_lock(ftdmchan->mutex); ftdm_r2_state_advance_all(ftdmchan); openr2_chan_process_signaling(r2chan); commit 8825b6eac893b8280e7323133469eb24b79ed8db Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Sun Nov 28 17:15:39 2010 -0500 mod_sofia: Fix in previous commit incompleted, this one should do it (sofia presence related) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 9d0b23a..5c2517d 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1927,7 +1927,7 @@ static void sync_sla(sofia_profile_t *profile, const char *to_user, const char * switch_core_hash_init(&sh->hash, sh->pool); sql = switch_mprintf("select sip_from_user,sip_from_host,call_info,call_info_state,uuid from sip_dialogs " - "where hostname='%q' and ((sip_from_user='%q' and sip_from_host='%q) or presence_id='%q@%q')", + "where hostname='%q' and ((sip_from_user='%q' and sip_from_host='%q') or presence_id='%q@%q')", mod_sofia_globals.hostname, to_user, to_host, to_user, to_host); commit 9a9373c0bb42cf0e57c1b08e661a14b2a7760369 Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Sun Nov 28 17:07:54 2010 -0500 mod_sofia: Fix malformed Presense SQL Query diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 95ea913..9d0b23a 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1927,7 +1927,7 @@ static void sync_sla(sofia_profile_t *profile, const char *to_user, const char * switch_core_hash_init(&sh->hash, sh->pool); sql = switch_mprintf("select sip_from_user,sip_from_host,call_info,call_info_state,uuid from sip_dialogs " - "where hostname='%q' " "and ((sip_from_user='%q' and sip_from_host='%q) or presence_id='%q@%q')' ", + "where hostname='%q' and ((sip_from_user='%q' and sip_from_host='%q) or presence_id='%q@%q')", mod_sofia_globals.hostname, to_user, to_host, to_user, to_host); commit 80174cf39fa6b29c45232b231f7f169224f975a7 Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Fri Nov 26 20:38:46 2010 -0500 mod_callcenter: Add new eventsocket agent-offering. Plus some documentation and better handeling of bad agent type -- FS-2869 diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 1b0ba13..ca92b17 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1346,6 +1346,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_time_t t_agent_called = 0; switch_time_t t_agent_answered = 0; switch_time_t t_member_called = atoi(h->member_joined_epoch); + switch_event_t *event = NULL; switch_mutex_lock(globals.mutex); globals.threads++; @@ -1360,6 +1361,21 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_safe_free(sql); goto done; } + + /* Proceed contact the agent to offer the member */ + if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CALLCENTER_EVENT) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Queue", h->queue_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Action", "agent-offering"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent", h->agent_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-Type", h->agent_type); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-System", h->agent_system); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", h->member_uuid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Name", h->member_caller_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Number", h->member_caller_number); + switch_event_fire(&event); + } + + /* CallBack Mode */ if (!strcasecmp(h->agent_type, CC_AGENT_TYPE_CALLBACK)) { switch_event_create(&ovars, SWITCH_EVENT_REQUEST_PARAMS); switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "cc_queue", "%s", h->queue_name); @@ -1375,6 +1391,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_safe_free(dialstr); switch_event_destroy(&ovars); + /* UUID Standby Mode */ } else if (!strcasecmp(h->agent_type, CC_AGENT_TYPE_UUID_STANDBY)) { agent_session = switch_core_session_locate(h->agent_uuid); if (agent_session) { @@ -1400,14 +1417,17 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa cc_agent_update("status", cc_agent_status2str(CC_AGENT_STATUS_LOGGED_OUT), h->agent_name); cc_agent_update("uuid", "", h->agent_name); } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Invalid agent type '%s' for agent '%s', aborting member offering", h->agent_type, h->agent_name); + status = SWITCH_CAUSE_USER_NOT_REGISTERED; } + /* Originate/Bridge is not finished, processing the return value */ if (status == SWITCH_STATUS_SUCCESS) { /* Agent Answered */ const char *agent_uuid = switch_core_session_get_uuid(agent_session); switch_channel_t *member_channel = switch_core_session_get_channel(member_session); switch_channel_t *agent_channel = switch_core_session_get_channel(agent_session); - switch_event_t *event; switch_channel_set_variable(agent_channel, "cc_member_pre_answer_uuid", NULL); commit f7279386e423d7f525211f9f929242ca1e4baf1b Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Fri Nov 26 22:10:33 2010 -0200 freetdm: ftmod_r2 - replaced deprecated ftdm_r2_configure_span() by ftdm_r2_configure_span_signaling(), all r2 default params now stays on ftmod_r2 diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 8d96112..18c1d4a 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -3212,29 +3212,6 @@ static switch_status_t load_config(void) char *name = (char *) switch_xml_attr(myspan, "name"); ftdm_status_t zstatus = FTDM_FAIL; - /* strings */ - const char *variant = "itu"; - const char *category = "national_subscriber"; - const char *logdir = "/usr/local/freeswitch/log/"; /* FIXME: get PREFIX variable */ - const char *logging = "notice,warning,error"; - const char *advanced_protocol_file = ""; - - /* booleans */ - int call_files = 0; - int get_ani_first = -1; - int immediate_accept = -1; - int double_answer = -1; - int skip_category = -1; - int forced_release = -1; - int charge_calls = -1; - - /* integers */ - int mfback_timeout = -1; - int metering_pulse_timeout = -1; - int allow_collect_calls = -1; - int max_ani = 10; - int max_dnis = 4; - /* common non r2 stuff */ const char *context = "default"; const char *dialplan = "XML"; @@ -3243,53 +3220,16 @@ static switch_status_t load_config(void) uint32_t span_id = 0; ftdm_span_t *span = NULL; + ftdm_conf_parameter_t spanparameters[30]; + unsigned paramindex = 0; + memset(spanparameters, 0, sizeof(spanparameters)); for (param = switch_xml_child(myspan, "param"); param; param = param->next) { char *var = (char *) switch_xml_attr_soft(param, "name"); char *val = (char *) switch_xml_attr_soft(param, "value"); /* string parameters */ - if (!strcasecmp(var, "variant")) { - variant = val; - } else if (!strcasecmp(var, "category")) { - category = val; - } else if (!strcasecmp(var, "logdir")) { - logdir = val; - } else if (!strcasecmp(var, "logging")) { - logging = val; - } else if (!strcasecmp(var, "advanced_protocol_file")) { - advanced_protocol_file = val; - - /* booleans */ - } else if (!strcasecmp(var, "allow_collect_calls")) { - allow_collect_calls = switch_true(val); - } else if (!strcasecmp(var, "immediate_accept")) { - immediate_accept = switch_true(val); - } else if (!strcasecmp(var, "double_answer")) { - double_answer = switch_true(val); - } else if (!strcasecmp(var, "skip_category")) { - skip_category = switch_true(var); - } else if (!strcasecmp(var, "forced_release")) { - forced_release = switch_true(val); - } else if (!strcasecmp(var, "charge_calls")) { - charge_calls = switch_true(val); - } else if (!strcasecmp(var, "get_ani_first")) { - get_ani_first = switch_true(val); - } else if (!strcasecmp(var, "call_files")) { - call_files = switch_true(val); - - /* integers */ - } else if (!strcasecmp(var, "mfback_timeout")) { - mfback_timeout = atoi(val); - } else if (!strcasecmp(var, "metering_pulse_timeout")) { - metering_pulse_timeout = atoi(val); - } else if (!strcasecmp(var, "max_ani")) { - max_ani = atoi(val); - } else if (!strcasecmp(var, "max_dnis")) { - max_dnis = atoi(val); - - /* common non r2 stuff */ - } else if (!strcasecmp(var, "context")) { + if (!strcasecmp(var, "context")) { context = val; } else if (!strcasecmp(var, "dialplan")) { dialplan = val; @@ -3297,11 +3237,15 @@ static switch_status_t load_config(void) dial_regex = val; } else if (!strcasecmp(var, "fail-dial-regex")) { fail_dial_regex = val; + } else { + spanparameters[paramindex].var = var; + spanparameters[paramindex].val = val; + paramindex++; } } if (!id && !name) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "span missing required param 'id'\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "either 'id' or 'name' required params are missing\n"); continue; } @@ -3327,25 +3271,7 @@ static switch_status_t load_config(void) span_id = ftdm_span_get_id(span); } - if (ftdm_configure_span(span, "r2", on_r2_signal, - "variant", variant, - "max_ani", max_ani, - "max_dnis", max_dnis, - "category", category, - "logdir", logdir, - "logging", logging, - "advanced_protocol_file", advanced_protocol_file, - "allow_collect_calls", allow_collect_calls, - "immediate_accept", immediate_accept, - "double_answer", double_answer, - "skip_category", skip_category, - "forced_release", forced_release, - "charge_calls", charge_calls, - "get_ani_first", get_ani_first, - "call_files", call_files, - "mfback_timeout", mfback_timeout, - "metering_pulse_timeout", metering_pulse_timeout, - FTDM_TAG_END) != FTDM_SUCCESS) { + if (ftdm_configure_span_signaling(span, "r2", on_r2_signal, spanparameters) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_ERROR, "Error configuring R2 FreeTDM span %d, error: %s\n", span_id, ftdm_span_get_last_error(span)); continue; diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index c8d669c..ffc39e8 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -892,27 +892,50 @@ static openr2_io_interface_t ftdm_r2_io_iface = { /* .get_oob_event */ ftdm_r2_io_get_oob_event /* never called */ }; -static FIO_SIG_CONFIGURE_FUNCTION(ftdm_r2_configure_span) - //ftdm_status_t (ftdm_span_t *span, fio_signal_cb_t sig_cb, va_list ap) +/* resolve a loglevel string, such as "debug,notice,warning", to an openr2 log level integer */ +static openr2_log_level_t ftdm_r2_loglevel_from_string(const char *level) +{ + openr2_log_level_t tmplevel; + openr2_log_level_t newlevel = 0; + char *clevel = NULL; + char *logval = NULL; + + logval = ftdm_malloc(strlen(level)+1); /* alloca man page scared me, so better to use good ol' malloc */ + if (!logval) { + ftdm_log(FTDM_LOG_WARNING, "Ignoring R2 logging parameter: '%s', failed to alloc memory\n", level); + return newlevel; + } + strcpy(logval, level); + while (logval) { + clevel = strsep(&logval, ","); + if (-1 == (tmplevel = openr2_log_get_level(clevel))) { + ftdm_log(FTDM_LOG_WARNING, "Ignoring invalid R2 logging level: '%s'\n", clevel); + continue; + } + newlevel |= tmplevel; + } + ftdm_safe_free(logval); + return newlevel; +} + +static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) { unsigned int i = 0; int conf_failure = 0; - char *var = NULL; - char *val = NULL; + const char *var = NULL, *val = NULL; + const char *log_level = "notice,warning,error"; /* default loglevel, if none is read from conf */ ftdm_r2_data_t *r2data = NULL; ftdm_r2_span_pvt_t *spanpvt = NULL; ftdm_r2_call_t *r2call = NULL; openr2_chan_t *r2chan = NULL; - openr2_log_level_t tmplevel; - char *clevel = NULL; - char *logval = NULL; + unsigned paramindex = 0; ft_r2_conf_t r2conf = { /* .variant */ OR2_VAR_ITU, /* .category */ OR2_CALLING_PARTY_CATEGORY_NATIONAL_SUBSCRIBER, /* .loglevel */ OR2_LOG_ERROR | OR2_LOG_WARNING, - /* .logdir */ NULL, + /* .logdir */ (char *)"/usr/local/freeswitch/log/", /* FIXME: get PREFIX variable */ /* .advanced_protocol_file */ NULL, /* .max_ani */ 10, /* .max_dnis */ 4, @@ -923,7 +946,7 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_r2_configure_span) /* .get_ani_first */ -1, /* .call_files */ 0, /* .mf_files */ 0, - /* .double_answer */ 0, + /* .double_answer */ -1, /* .charge_calls */ -1, /* .forced_release */ -1, /* .allow_collect_calls */ -1 @@ -936,10 +959,12 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_r2_configure_span) return FTDM_FAIL; } - while ((var = va_arg(ap, char *))) { + for (; ftdm_parameters[paramindex].var; paramindex++) { + var = ftdm_parameters[paramindex].var; + val = ftdm_parameters[paramindex].val; ftdm_log(FTDM_LOG_DEBUG, "Reading R2 parameter %s for span %d\n", var, span->span_id); if (!strcasecmp(var, "variant")) { - if (!(val = va_arg(ap, char *))) { + if (!val) { break; } if (ftdm_strlen_zero_buf(val)) { @@ -954,7 +979,7 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_r2_configure_span) } ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d for variant %s\n", span->span_id, val); } else if (!strcasecmp(var, "category")) { - if (!(val = va_arg(ap, char *))) { + if (!val) { break; } if (ftdm_strlen_zero_buf(val)) { @@ -969,87 +994,72 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_r2_configure_span) } ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with default category %s\n", span->span_id, val); } else if (!strcasecmp(var, "logdir")) { - if (!(val = va_arg(ap, char *))) { + if (!val) { break; } if (ftdm_strlen_zero_buf(val)) { ftdm_log(FTDM_LOG_NOTICE, "Ignoring empty R2 logdir parameter\n"); continue; } - r2conf.logdir = val; + r2conf.logdir = (char *)val; ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with logdir %s\n", span->span_id, val); } else if (!strcasecmp(var, "logging")) { - if (!(val = va_arg(ap, char *))) { + if (!val) { break; } if (ftdm_strlen_zero_buf(val)) { ftdm_log(FTDM_LOG_NOTICE, "Ignoring empty R2 logging parameter\n"); continue; } - logval = ftdm_malloc(strlen(val)+1); /* alloca man page scared me, so better to use good ol' malloc */ - if (!logval) { - ftdm_log(FTDM_LOG_WARNING, "Ignoring R2 logging parameter: '%s', failed to alloc memory\n", val); - continue; - } - strcpy(logval, val); - while (logval) { - clevel = strsep(&logval, ","); - if (-1 == (tmplevel = openr2_log_get_level(clevel))) { - ftdm_log(FTDM_LOG_WARNING, "Ignoring invalid R2 logging level: '%s'\n", clevel); - continue; - } - r2conf.loglevel |= tmplevel; - ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with loglevel %s\n", span->span_id, clevel); - } - ftdm_safe_free(logval); + log_level = val; } else if (!strcasecmp(var, "advanced_protocol_file")) { - if (!(val = va_arg(ap, char *))) { + if (!val) { break; } if (ftdm_strlen_zero_buf(val)) { ftdm_log(FTDM_LOG_NOTICE, "Ignoring empty R2 advanced_protocol_file parameter\n"); continue; } - r2conf.advanced_protocol_file = val; + r2conf.advanced_protocol_file = (char *)val; ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with advanced protocol file %s\n", span->span_id, val); } else if (!strcasecmp(var, "allow_collect_calls")) { - r2conf.allow_collect_calls = va_arg(ap, int); + r2conf.allow_collect_calls = ftdm_true(val); ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with allow collect calls max ani = %d\n", span->span_id, r2conf.allow_collect_calls); } else if (!strcasecmp(var, "double_answer")) { - r2conf.double_answer = va_arg(ap, int); + r2conf.double_answer = ftdm_true(val); ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with double answer = %d\n", span->span_id, r2conf.double_answer); } else if (!strcasecmp(var, "immediate_accept")) { - r2conf.immediate_accept = va_arg(ap, int); + r2conf.immediate_accept = ftdm_true(val); ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with immediate accept = %d\n", span->span_id, r2conf.immediate_accept); } else if (!strcasecmp(var, "skip_category")) { - r2conf.skip_category = va_arg(ap, int); + r2conf.skip_category = ftdm_true(val); ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with skip category = %d\n", span->span_id, r2conf.skip_category); } else if (!strcasecmp(var, "forced_release")) { - r2conf.forced_release = va_arg(ap, int); + r2conf.forced_release = ftdm_true(val); ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with forced release = %d\n", span->span_id, r2conf.forced_release); } else if (!strcasecmp(var, "charge_calls")) { - r2conf.charge_calls = va_arg(ap, int); + r2conf.charge_calls = ftdm_true(val); ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with charge calls = %d\n", span->span_id, r2conf.charge_calls); } else if (!strcasecmp(var, "get_ani_first")) { - r2conf.get_ani_first = va_arg(ap, int); + r2conf.get_ani_first = ftdm_true(val); ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with get ani first = %d\n", span->span_id, r2conf.get_ani_first); } else if (!strcasecmp(var, "call_files")) { - r2conf.call_files = va_arg(ap, int); + r2conf.call_files = ftdm_true(val); ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with call files = %d\n", span->span_id, r2conf.call_files); } else if (!strcasecmp(var, "mf_files")) { - r2conf.mf_files = va_arg(ap, int); + r2conf.mf_files = ftdm_true(val); ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with mf files = %d\n", span->span_id, r2conf.mf_files); } else if (!strcasecmp(var, "mfback_timeout")) { - r2conf.mfback_timeout = va_arg(ap, int); + r2conf.mfback_timeout = atoi(val); ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with MF backward timeout = %dms\n", span->span_id, r2conf.mfback_timeout); } else if (!strcasecmp(var, "metering_pulse_timeout")) { - r2conf.metering_pulse_timeout = va_arg(ap, int); + r2conf.metering_pulse_timeout = atoi(val); ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with metering pulse timeout = %dms\n", span->span_id, r2conf.metering_pulse_timeout); } else if (!strcasecmp(var, "max_ani")) { - r2conf.max_ani = va_arg(ap, int); + r2conf.max_ani = atoi(val); ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with max ani = %d\n", span->span_id, r2conf.max_ani); } else if (!strcasecmp(var, "max_dnis")) { - r2conf.max_dnis = va_arg(ap, int); + r2conf.max_dnis = atoi(val); ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with max dnis = %d\n", span->span_id, r2conf.max_dnis); } else { snprintf(span->last_error, sizeof(span->last_error), "Unknown R2 parameter [%s]", var); @@ -1062,6 +1072,10 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_r2_configure_span) return FTDM_FAIL; } + /* set span log level */ + r2conf.loglevel = ftdm_r2_loglevel_from_string(log_level); + ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with loglevel %s\n", span->span_id, log_level); + r2data = ftdm_malloc(sizeof(*r2data)); if (!r2data) { snprintf(span->last_error, sizeof(span->last_error), "Failed to allocate R2 data."); @@ -1387,6 +1401,9 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) r2chan = R2CALL(span->channels[i])->r2chan; openr2_chan_set_idle(r2chan); openr2_chan_process_cas_signaling(r2chan); + + ftdmchan = openr2_chan_get_client_data(r2chan); + ftdm_channel_set_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS); } memset(&start, 0, sizeof(start)); @@ -1762,12 +1779,13 @@ static FIO_SIG_UNLOAD_FUNCTION(ftdm_r2_destroy) } EX_DECLARE_DATA ftdm_module_t ftdm_module = { - "r2", - ftdm_r2_io_init, - NULL, - ftdm_r2_init, - ftdm_r2_configure_span, - ftdm_r2_destroy + /* .name */ "r2", + /* .io_load */ ftdm_r2_io_init, + /* .io_unload */ NULL, + /* .sig_load */ ftdm_r2_init, + /* .sig_configure */ NULL, + /* .sig_unload */ ftdm_r2_destroy, + /* .configure_span_signaling */ ftdm_r2_configure_span_signaling }; commit 7a7a387f551a8b2a52a64dd3590f73e29ee5112e Author: Moises Silva <moy@sangoma.com> Date: Fri Nov 26 15:49:18 2010 -0500 freetdm: improve IO stats (cherry picked from R2 branch) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 1b906a2..62d6d02 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -655,32 +655,32 @@ void sngisdn_snd_data(ftdm_channel_t *dchan, uint8_t *data, ftdm_size_t len) memcpy(&l1_frame.data, data, len); - if (ftdm_test_flag(&(dchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_CRC)) { + if (ftdm_test_flag(&(dchan->iostats.rx), FTDM_IOSTATS_ERROR_CRC)) { l1_frame.flags |= SNG_L1FRAME_ERROR_CRC; } - if (ftdm_test_flag(&(dchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_FRAME)) { + if (ftdm_test_flag(&(dchan->iostats.rx), FTDM_IOSTATS_ERROR_FRAME)) { l1_frame.flags |= SNG_L1FRAME_ERROR_FRAME; } - if (ftdm_test_flag(&(dchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_ABORT)) { + if (ftdm_test_flag(&(dchan->iostats.rx), FTDM_IOSTATS_ERROR_ABORT)) { l1_frame.flags |= SNG_L1FRAME_ERROR_ABORT; } - if (ftdm_test_flag(&(dchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_FIFO)) { + if (ftdm_test_flag(&(dchan->iostats.rx), FTDM_IOSTATS_ERROR_FIFO)) { l1_frame.flags |= SNG_L1FRAME_ERROR_FIFO; } - if (ftdm_test_flag(&(dchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_DMA)) { + if (ftdm_test_flag(&(dchan->iostats.rx), FTDM_IOSTATS_ERROR_DMA)) { l1_frame.flags |= SNG_L1FRAME_ERROR_DMA; } - if (ftdm_test_flag(&(dchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES)) { + if (ftdm_test_flag(&(dchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES)) { /* Should we trigger congestion here? */ l1_frame.flags |= SNG_L1FRAME_QUEUE_THRES; } - if (ftdm_test_flag(&(dchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_QUEUE_FULL)) { + if (ftdm_test_flag(&(dchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_FULL)) { /* Should we trigger congestion here? */ l1_frame.flags |= SNG_L1FRAME_QUEUE_FULL; } diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index c13455d..c20ad82 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -513,7 +513,10 @@ static FIO_OPEN_FUNCTION(wanpipe_open) wanpipe_tdm_api_t tdm_api; memset(&tdm_api,0,sizeof(tdm_api)); + sangoma_tdm_flush_bufs(ftdmchan->sockfd, &tdm_api); + sangoma_flush_stats(ftdmchan->sockfd, &tdm_api); + memset(&ftdmchan->iostats, 0, sizeof(ftdmchan->iostats)); if (ftdmchan->type == FTDM_CHAN_TYPE_DQ921 || ftdmchan->type == FTDM_CHAN_TYPE_DQ931) { ftdmchan->native_codec = ftdmchan->effective_codec = FTDM_CODEC_NONE; @@ -750,6 +753,7 @@ static FIO_COMMAND_FUNCTION(wanpipe_command) case FTDM_COMMAND_FLUSH_IOSTATS: { err = sangoma_flush_stats(ftdmchan->sockfd, &tdm_api); + memset(&ftdmchan->iostats, 0, sizeof(ftdmchan->iostats)); } break; case FTDM_COMMAND_SET_RX_QUEUE_SIZE: @@ -777,44 +781,110 @@ static FIO_COMMAND_FUNCTION(wanpipe_command) return FTDM_SUCCESS; } -static void wanpipe_read_stats(ftdm_channel_t *ftdmchan, wp_tdm_api_rx_hdr_t *rx_stats) +static void wanpipe_write_stats(ftdm_channel_t *ftdmchan, wp_tdm_api_tx_hdr_t *tx_stats) { - ftdmchan->iostats.stats.rx.flags = 0; + ftdmchan->iostats.tx.errors = tx_stats->wp_api_tx_hdr_errors; + ftdmchan->iostats.tx.queue_size = tx_stats->wp_api_tx_hdr_max_queue_length; + ftdmchan->iostats.tx.queue_len = tx_stats->wp_api_tx_hdr_number_of_frames_in_queue; + + if (ftdmchan->iostats.tx.queue_len >= (0.8 * ftdmchan->iostats.tx.queue_size)) { + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Tx Queue length exceeded 80% threshold (%d/%d)\n", + ftdmchan->iostats.tx.queue_len, ftdmchan->iostats.tx.queue_size); + ftdm_set_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_THRES); + } else if (ftdm_test_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_THRES)){ + ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Tx Queue length reduced 80% threshold (%d/%d)\n", + ftdmchan->iostats.tx.queue_len, ftdmchan->iostats.tx.queue_size); + ftdm_clear_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_THRES); + } + + if (ftdmchan->iostats.tx.queue_len >= ftdmchan->iostats.rx.queue_size) { + ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Tx Queue Full (%d/%d)\n", + ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); + ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_FULL); + } else if (ftdm_test_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_FULL)){ + ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Tx Queue no longer full (%d/%d)\n", + ftdmchan->iostats.tx.queue_len, ftdmchan->iostats.tx.queue_size); + ftdm_clear_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_FULL); + } + + if (ftdmchan->iostats.tx.idle_packets < tx_stats->wp_api_tx_hdr_number_of_frames_in_queue) { + ftdmchan->iostats.tx.idle_packets = tx_stats->wp_api_tx_hdr_tx_idle_packets; + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Tx idle: %d\n", ftdmchan->iostats.tx.idle_packets); + } - ftdmchan->iostats.stats.rx.errors = rx_stats->wp_api_rx_hdr_errors; - ftdmchan->iostats.stats.rx.rx_queue_size = rx_stats->wp_api_rx_hdr_max_queue_length; - ftdmchan->iostats.stats.rx.rx_queue_len = rx_stats->wp_api_rx_hdr_number_of_frames_in_queue; + if (!ftdmchan->iostats.tx.packets) { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "First packet write stats: Tx queue len: %d, Tx queue size: %d, Tx idle: %d\n", + ftdmchan->iostats.tx.queue_len, + ftdmchan->iostats.tx.queue_size, + ftdmchan->iostats.tx.idle_packets); + } + + ftdmchan->iostats.tx.packets++; +} + +static void wanpipe_read_stats(ftdm_channel_t *ftdmchan, wp_tdm_api_rx_hdr_t *rx_stats) +{ + ftdmchan->iostats.rx.errors = rx_stats->wp_api_rx_hdr_errors; + ftdmchan->iostats.rx.queue_size = rx_stats->wp_api_rx_hdr_max_queue_length; + ftdmchan->iostats.rx.queue_len = rx_stats->wp_api_rx_hdr_number_of_frames_in_queue; - if (rx_stats->wp_api_rx_hdr_error_map & (1<<WP_ABORT_ERROR_BIT)) { - ftdm_set_flag(&(ftdmchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_ABORT); + if ((rx_stats->wp_api_rx_hdr_error_map & (1 << WP_ABORT_ERROR_BIT))) { + ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_ABORT); + } else { + ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_ABORT); } - if (rx_stats->wp_api_rx_hdr_error_map & (1<<WP_DMA_ERROR_BIT)) { - ftdm_set_flag(&(ftdmchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_DMA); + + if ((rx_stats->wp_api_rx_hdr_error_map & (1 << WP_DMA_ERROR_BIT))) { + ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_DMA); + } else { + ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_DMA); } - if (rx_stats->wp_api_rx_hdr_error_map & (1<<WP_FIFO_ERROR_BIT)) { - ftdm_set_flag(&(ftdmchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_FIFO); + + if ((rx_stats->wp_api_rx_hdr_error_map & (1 << WP_FIFO_ERROR_BIT))) { + ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_FIFO); + } else { + ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_FIFO); } - if (rx_stats->wp_api_rx_hdr_error_map & (1<<WP_CRC_ERROR_BIT)) { - ftdm_set_flag(&(ftdmchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_CRC); + + if ((rx_stats->wp_api_rx_hdr_error_map & (1 << WP_CRC_ERROR_BIT))) { + ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_CRC); + } else { + ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_CRC); } - if (rx_stats->wp_api_rx_hdr_error_map & (1<<WP_FRAME_ERROR_BIT)) { - ftdm_set_flag(&(ftdmchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_FRAME); + + if ((rx_stats->wp_api_rx_hdr_error_map & (1 << WP_FRAME_ERROR_BIT))) { + ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_FRAME); + } else { + ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_FRAME); } - if (ftdmchan->iostats.stats.rx.rx_queue_len >= (0.8*ftdmchan->iostats.stats.rx.rx_queue_size)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Rx Queue length exceeded threshold (%d/%d)\n", - ftdmchan->iostats.stats.rx.rx_queue_len, ftdmchan->iostats.stats.rx.rx_queue_size); - - ftdm_set_flag(&(ftdmchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES); + if (ftdmchan->iostats.rx.queue_len >= (0.8 * ftdmchan->iostats.rx.queue_size)) { + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Rx Queue length exceeded 80% threshold (%d/%d)\n", + ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); + ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES); + } else if (ftdm_test_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES)){ + /* any reason we have wanpipe_tdm_api_iface.h in ftmod_wanpipe/ dir? */ + ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Rx Queue length reduced 80% threshold (%d/%d)\n", + ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); + ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES); } - if (ftdmchan->iostats.stats.rx.rx_queue_len >= ftdmchan->iostats.stats.rx.rx_queue_size) { + if (ftdmchan->iostats.rx.queue_len >= ftdmchan->iostats.rx.queue_size) { ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Rx Queue Full (%d/%d)\n", - ftdmchan->iostats.stats.rx.rx_queue_len, ftdmchan->iostats.stats.rx.rx_queue_size); - - ftdm_set_flag(&(ftdmchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_QUEUE_FULL); + ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); + ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_FULL); + } else if (ftdm_test_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_FULL)){ + ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Rx Queue no longer full (%d/%d)\n", + ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); + ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_FULL); } - return; + + if (!ftdmchan->iostats.rx.packets) { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "First packet read stats: Rx queue len: %d, Rx queue size: %d\n", + ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); + } + + ftdmchan->iostats.rx.packets++; } /** @@ -875,6 +945,9 @@ static FIO_WRITE_FUNCTION(wanpipe_write) /* should we be checking if bsent == *datalen here? */ if (bsent > 0) { *datalen = bsent; + if (ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS)) { + wanpipe_write_stats(ftdmchan, &hdrframe); + } return FTDM_SUCCESS; } diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index 06f899c..7683ec7 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -368,30 +368,32 @@ typedef struct { } ftdm_channel_history_entry_t; typedef enum { - FTDM_IOSTATS_ERROR_CRC = (1<<0), - FTDM_IOSTATS_ERROR_FRAME = (1<<1), - FTDM_IOSTATS_ERROR_ABORT = (1<<2), - FTDM_IOSTATS_ERROR_FIFO = (1<<3), - FTDM_IOSTATS_ERROR_DMA = (1<<4), - FTDM_IOSTATS_ERROR_QUEUE_THRES = (1<<5), /* Queue reached high threshold */ - FTDM_IOSTATS_ERROR_QUEUE_FULL = (1<<6), /* Queue is full */ + FTDM_IOSTATS_ERROR_CRC = (1 << 0), + FTDM_IOSTATS_ERROR_FRAME = (1 << 1), + FTDM_IOSTATS_ERROR_ABORT = (1 << 2), + FTDM_IOSTATS_ERROR_FIFO = (1 << 3), + FTDM_IOSTATS_ERROR_DMA = (1 << 4), + FTDM_IOSTATS_ERROR_QUEUE_THRES = (1 << 5), /* Queue reached high threshold */ + FTDM_IOSTATS_ERROR_QUEUE_FULL = (1 << 6), /* Queue is full */ } ftdm_iostats_error_type_t; typedef struct { - union { - struct { - uint32_t errors; - uint16_t flags; - uint8_t rx_queue_size; /* max queue size configured */ - uint8_t rx_queue_len; /* Current number of elements in queue */ - } rx; - struct { - uint32_t errors; - uint16_t flags; - uint8_t tx_queue_size; /* max queue size configured */ - uint8_t tx_queue_len; /* Current number of elements in queue */ - } tx; - } stats; + struct { + uint32_t errors; + uint16_t flags; + uint8_t queue_size; /* max queue size configured */ + uint8_t queue_len; /* Current number of elements in queue */ + uint64_t packets; + } rx; + + struct { + uint32_t errors; + uint16_t flags; + uint8_t idle_packets; + uint8_t queue_size; /* max queue size configured */ + uint8_t queue_len; /* Current number of elements in queue */ + uint64_t packets; + } tx; } ftdm_channel_iostats_t; /* 2^8 table size, one for each byte (sample) value */ commit 0b7a2d4c92501980983bd71365f339a674a86a3c Author: Moises Silva <moy@sangoma.com> Date: Fri Nov 26 15:10:18 2010 -0500 freetdm: remove openzap projects diff --git a/libs/freetdm/openzap.2005.sln b/libs/freetdm/openzap.2005.sln deleted file mode 100644 index c9f666b..0000000 --- a/libs/freetdm/openzap.2005.sln +++ /dev/null @@ -1,82 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openzap", "msvc\openzap.2005.vcproj", "{93B8812C-3EC4-4F78-8970-FFBFC99E167D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testanalog", "msvc\testanalog\testanalog.2005.vcproj", "{BB833648-BAFF-4BE2-94DB-F8BB043C588C}" - ProjectSection(ProjectDependencies) = postProject - {93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testisdn", "msvc\testisdn\testisdn.2005.vcproj", "{6DA6FD42-641D-4147-92F5-3BC4AAA6589B}" - ProjectSection(ProjectDependencies) = postProject - {93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_openzap", "mod_openzap\mod_openzap.2005.vcproj", "{FE3540C5-3303-46E0-A69E-D92F775687F1}" - ProjectSection(ProjectDependencies) = postProject - {93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ozmod_analog", "src\ozmod\ozmod_analog\ozmod_analog.2005.vcproj", "{37C94798-6E33-4B4F-8EE0-C72A7DC91157}" - ProjectSection(ProjectDependencies) = postProject - {93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ozmod_analog_em", "src\ozmod\ozmod_analog_em\ozmod_analog_em.2005.vcproj", "{C539D7C8-26A8-4A94-B938-77672165C130}" - ProjectSection(ProjectDependencies) = postProject - {93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ozmod_isdn", "src\ozmod\ozmod_isdn\ozmod_isdn.2005.vcproj", "{729344A5-D5E9-434D-8EE8-AF8C6C795D15}" - ProjectSection(ProjectDependencies) = postProject - {93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ozmod_wanpipe", "src\ozmod\ozmod_wanpipe\ozmod_wanpipe.2005.vcproj", "{1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ozmod_pika", "src\ozmod\ozmod_pika\ozmod_pika.2005.vcproj", "{E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Debug|Win32.ActiveCfg = Debug|Win32 - {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Debug|Win32.Build.0 = Debug|Win32 - {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|Win32.ActiveCfg = Release|Win32 - {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|Win32.Build.0 = Release|Win32 - {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|Win32.ActiveCfg = Debug|Win32 - {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|Win32.Build.0 = Debug|Win32 - {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Release|Win32.ActiveCfg = Release|Win32 - {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Release|Win32.Build.0 = Release|Win32 - {6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Debug|Win32.ActiveCfg = Debug|Win32 - {6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Debug|Win32.Build.0 = Debug|Win32 - {6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Release|Win32.ActiveCfg = Release|Win32 - {6DA6FD42-641D-4147-92F5-3BC4AAA6589B}.Release|Win32.Build.0 = Release|Win32 - {FE3540C5-3303-46E0-A69E-D92F775687F1}.Debug|Win32.ActiveCfg = Debug|Win32 - {FE3540C5-3303-46E0-A69E-D92F775687F1}.Debug|Win32.Build.0 = Debug|Win32 - {FE3540C5-3303-46E0-A69E-D92F775687F1}.Release|Win32.ActiveCfg = Release|Win32 - {FE3540C5-3303-46E0-A69E-D92F775687F1}.Release|Win32.Build.0 = Release|Win32 - {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Debug|Win32.ActiveCfg = Debug|Win32 - {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Debug|Win32.Build.0 = Debug|Win32 - {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Release|Win32.ActiveCfg = Release|Win32 - {37C94798-6E33-4B4F-8EE0-C72A7DC91157}.Release|Win32.Build.0 = Release|Win32 - {C539D7C8-26A8-4A94-B938-77672165C130}.Debug|Win32.ActiveCfg = Debug|Win32 - {C539D7C8-26A8-4A94-B938-77672165C130}.Debug|Win32.Build.0 = Debug|Win32 - {C539D7C8-26A8-4A94-B938-77672165C130}.Release|Win32.ActiveCfg = Release|Win32 - {C539D7C8-26A8-4A94-B938-77672165C130}.Release|Win32.Build.0 = Release|Win32 - {729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Debug|Win32.ActiveCfg = Debug|Win32 - {729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Debug|Win32.Build.0 = Debug|Win32 - {729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Release|Win32.ActiveCfg = Release|Win32 - {729344A5-D5E9-434D-8EE8-AF8C6C795D15}.Release|Win32.Build.0 = Release|Win32 - {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Debug|Win32.ActiveCfg = Debug|Win32 - {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Release|Win32.ActiveCfg = Release|Win32 - {E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Debug|Win32.ActiveCfg = Debug|Win32 - {E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Release|Win32.ActiveCfg = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/libs/freetdm/src/ftmod/ftmod_analog/ozmod_analog.2005.vcproj b/libs/freetdm/src/ftmod/ftmod_analog/ozmod_analog.2005.vcproj deleted file mode 100644 index 7a1cf53..0000000 --- a/libs/freetdm/src/ftmod/ftmod_analog/ozmod_analog.2005.vcproj +++ /dev/null @@ -1,202 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="ftmod_analog" - ProjectGUID="{37C94798-6E33-4B4F-8EE0-C72A7DC91157}" - RootNamespace="ftmod_analog" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="2" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="..\..\include;..\..\isdn\include" - PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EXPORTS" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="0" - WarningLevel="4" - WarnAsError="true" - DebugInformationFormat="4" - DisableSpecificWarnings="4100" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="2" - GenerateDebugInformation="true" - SubSystem="2" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="2" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="2" - EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories="..\..\include;..\..\isdn\include" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EXPORTS" - RuntimeLibrary="2" - EnableFunctionLevelLinking="true" - UsePrecompiledHeader="0" - WarningLevel="4" - WarnAsError="true" - DebugInformationFormat="3" - DisableSpecificWarnings="4100" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="1" - GenerateDebugInformation="true" - SubSystem="2" - OptimizeReferences="2" - EnableCOMDATFolding="2" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath="ftmod_analog.c" - > - </File> - </Filter> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath="ftdm_analog.h" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/libs/freetdm/src/ftmod/ftmod_analog_em/ozmod_analog_em.2005.vcproj b/libs/freetdm/src/ftmod/ftmod_analog_em/ozmod_analog_em.2005.vcproj deleted file mode 100644 index 9ecbadc..0000000 --- a/libs/freetdm/src/ftmod/ftmod_analog_em/ozmod_analog_em.2005.vcproj +++ /dev/null @@ -1,202 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="ftmod_analog_em" - ProjectGUID="{C539D7C8-26A8-4A94-B938-77672165C130}" - RootNamespace="ftmod_analog_em" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="2" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="..\..\include;..\..\isdn\include" - PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EM_EXPORTS" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="0" - WarningLevel="4" - WarnAsError="true" - DebugInformationFormat="4" - DisableSpecificWarnings="4100" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="2" - GenerateDebugInformation="true" - SubSystem="2" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="2" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="2" - EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories="..\..\include;..\..\isdn\include" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_ANALOG_EM_EXPORTS" - RuntimeLibrary="2" - EnableFunctionLevelLinking="true" - UsePrecompiledHeader="0" - WarningLevel="4" - WarnAsError="true" - DebugInformationFormat="3" - DisableSpecificWarnings="4100" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="1" - GenerateDebugInformation="true" - SubSystem="2" - OptimizeReferences="2" - EnableCOMDATFolding="2" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath="ftmod_analog_em.c" - > - </File> - </Filter> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath="ftdm_analog_em.h" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ozmod_wanpipe.2005.vcproj b/libs/freetdm/src/ftmod/ftmod_wanpipe/ozmod_wanpipe.2005.vcproj deleted file mode 100644 index abebf30..0000000 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ozmod_wanpipe.2005.vcproj +++ /dev/null @@ -1,196 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="ftmod_wanpipe" - ProjectGUID="{1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}" - RootNamespace="ftmod_wanpipe" - Keyword="Win32Proj" - TargetFrameworkVersion="131072" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="2" - CharacterSet="2" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="../../../src/include;../../../src/isdn/include;../../../wanpipe/include" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="4" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="freetdm.lib libsangoma.lib" - LinkIncremental="2" - AdditionalLibraryDirectories=""$(OutDir)";../../../wanpipe/api/lib/x86" - GenerateDebugInformation="true" - SubSystem="1" - RandomizedBaseAddress="1" - DataExecutionPrevention="0" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="2" - CharacterSet="2" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - AdditionalIncludeDirectories="../../../src/include;../../../src/isdn/include;../../../wanpipe/include" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" - RuntimeLibrary="2" - UsePrecompiledHeader="0" - WarningLevel="3" - Detect64BitPortabilityProblems="true" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - AdditionalDependencies="freetdm.lib libsangoma.lib" - LinkIncremental="1" - AdditionalLibraryDirectories=""$(OutDir)";../../../wanpipe/api/lib/x86" - GenerateDebugInformation="true" - SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" - RandomizedBaseAddress="1" - DataExecutionPrevention="0" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath=".\ftmod_wanpipe.c" - > - </File> - </Filter> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/wanpipe_tdm_api_iface.h b/libs/freetdm/src/ftmod/ftmod_wanpipe/wanpipe_tdm_api_iface.h deleted file mode 100644 index 3801ff9..0000000 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/wanpipe_tdm_api_iface.h +++ /dev/null @@ -1,351 +0,0 @@ -/***************************************************************************** -* wanpipe_tdm_api_iface.h -* -* WANPIPE(tm) AFT TE1 Hardware Support -* -* Authors: Nenad Corbic <ncorbic@sangoma.com> -* -* Copyright (c) 2007 - 08, Sangoma Technologies -* 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 <organization> 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 <copyright holder> ``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 <copyright holder> 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. - -* ============================================================================ -* Oct 04, 2005 Nenad Corbic Initial version. -* -* Jul 25, 2006 David Rokhvarg <davidr@sangoma.com> Ported to Windows. -*****************************************************************************/ - -#ifndef __WANPIPE_TDM_API_IFACE_H_ -#define __WANPIPE_TDM_API_IFACE_H_ - - -#if defined(__WINDOWS__) -typedef HANDLE sng_fd_t; -#else -typedef int sng_fd_t; -#endif - -/* Indicate to library that new features exist */ -#define WP_TDM_FEATURE_DTMF_EVENTS 1 -#define WP_TDM_FEATURE_FE_ALARM 1 -#define WP_TDM_FEATURE_EVENTS 1 -#define WP_TDM_FEATURE_LINK_STATUS 1 - -enum wanpipe_tdm_api_cmds { - - SIOC_WP_TDM_GET_USR_MTU_MRU, /* 0x00 */ - - SIOC_WP_TDM_SET_USR_PERIOD, /* 0x01 */ - SIOC_WP_TDM_GET_USR_PERIOD, /* 0x02 */ - - SIOC_WP_TDM_SET_HW_MTU_MRU, /* 0x03 */ - SIOC_WP_TDM_GET_HW_MTU_MRU, /* 0x04 */ - - SIOC_WP_TDM_SET_CODEC, /* 0x05 */ - SIOC_WP_TDM_GET_CODEC, /* 0x06 */ - - SIOC_WP_TDM_SET_POWER_LEVEL, /* 0x07 */ - SIOC_WP_TDM_GET_POWER_LEVEL, /* 0x08 */ - - SIOC_WP_TDM_TOGGLE_RX, /* 0x09 */ - SIOC_WP_TDM_TOGGLE_TX, /* 0x0A */ - - SIOC_WP_TDM_GET_HW_CODING, /* 0x0B */ - SIOC_WP_TDM_SET_HW_CODING, /* 0x0C */ - - SIOC_WP_TDM_GET_FULL_CFG, /* 0x0D */ - - SIOC_WP_TDM_SET_EC_TAP, /* 0x0E */ - SIOC_WP_TDM_GET_EC_TAP, /* 0x0F */ - - SIOC_WP_TDM_ENABLE_RBS_EVENTS, /* 0x10 */ - SIOC_WP_TDM_DISABLE_RBS_EVENTS, /* 0x11 */ - SIOC_WP_TDM_WRITE_RBS_BITS, /* 0x12 */ - - SIOC_WP_TDM_GET_STATS, /* 0x13 */ - SIOC_WP_TDM_FLUSH_BUFFERS, /* 0x14 */ - - SIOC_WP_TDM_READ_EVENT, /* 0x15 */ - - SIOC_WP_TDM_SET_EVENT, /* 0x16 */ - - SIOC_WP_TDM_SET_RX_GAINS, /* 0x17 */ - SIOC_WP_TDM_SET_TX_GAINS, /* 0x18 */ - SIOC_WP_TDM_CLEAR_RX_GAINS, /* 0x19 */ - SIOC_WP_TDM_CLEAR_TX_GAINS, /* 0x1A */ - - SIOC_WP_TDM_GET_FE_ALARMS, /* 0x1B */ - - SIOC_WP_TDM_ENABLE_HWEC, /* 0x1C */ - SIOC_WP_TDM_DISABLE_HWEC, /* 0x1D */ - - SIOC_WP_TDM_SET_FE_STATUS, /* 0x1E */ - SIOC_WP_TDM_GET_FE_STATUS, /* 0x1F */ - - SIOC_WP_TDM_GET_HW_DTMF, /* 0x20 */ - - SIOC_WP_TDM_NOTSUPP /* */ - -}; - -#define SIOC_WP_TDM_GET_LINK_STATUS SIOC_WP_TDM_GET_FE_STATUS - -enum wanpipe_tdm_api_events { - WP_TDMAPI_EVENT_NONE, - WP_TDMAPI_EVENT_RBS, - WP_TDMAPI_EVENT_ALARM, - WP_TDMAPI_EVENT_DTMF, - WP_TDMAPI_EVENT_RM_DTMF, - WP_TDMAPI_EVENT_RXHOOK, - WP_TDMAPI_EVENT_RING, - WP_TDMAPI_EVENT_RING_DETECT, - WP_TDMAPI_EVENT_RING_TRIP_DETECT, - WP_TDMAPI_EVENT_TONE, - WP_TDMAPI_EVENT_TXSIG_KEWL, - WP_TDMAPI_EVENT_TXSIG_START, - WP_TDMAPI_EVENT_TXSIG_OFFHOOK, - WP_TDMAPI_EVENT_TXSIG_ONHOOK, - WP_TDMAPI_EVENT_ONHOOKTRANSFER, - WP_TDMAPI_EVENT_SETPOLARITY, - WP_TDMAPI_EVENT_BRI_CHAN_LOOPBACK, - WP_TDMAPI_EVENT_LINK_STATUS -}; - -#define WP_TDMAPI_EVENT_FE_ALARM WP_TDMAPI_EVENT_ALARM - - -#define WP_TDMAPI_EVENT_ENABLE 0x01 -#define WP_TDMAPI_EVENT_DISABLE 0x02 -#define WP_TDMAPI_EVENT_MODE_DECODE(mode) \ - ((mode) == WP_TDMAPI_EVENT_ENABLE) ? "Enable" : \ - ((mode) == WP_TDMAPI_EVENT_DISABLE) ? "Disable" : \ - "(Unknown mode)" - -#define WPTDM_A_BIT WAN_RBS_SIG_A -#define WPTDM_B_BIT WAN_RBS_SIG_B -#define WPTDM_C_BIT WAN_RBS_SIG_C -#define WPTDM_D_BIT WAN_RBS_SIG_D - -#define WP_TDMAPI_EVENT_RXHOOK_OFF 0x01 -#define WP_TDMAPI_EVENT_RXHOOK_ON 0x02 -#define WP_TDMAPI_EVENT_RXHOOK_DECODE(state) \ - ((state) == WP_TDMAPI_EVENT_RXHOOK_OFF) ? "Off-hook" : \ - ((state) == WP_TDMAPI_EVENT_RXHOOK_ON) ? "On-hook" : \ - "(Unknown state)" - -#define WP_TDMAPI_EVENT_RING_PRESENT 0x01 -#define WP_TDMAPI_EVENT_RING_STOP 0x02 -#define WP_TDMAPI_EVENT_RING_DECODE(state) \ - ((state) == WP_TDMAPI_EVENT_RING_PRESENT) ? "Ring Present" : \ - ((state) == WP_TDMAPI_EVENT_RING_STOP) ? "Ring Stop" : \ - "(Unknown state)" - -#define WP_TDMAPI_EVENT_RING_TRIP_PRESENT 0x01 -#define WP_TDMAPI_EVENT_RING_TRIP_STOP 0x02 -#define WP_TDMAPI_EVENT_RING_TRIP_DECODE(state) \ - ((state) == WP_TDMAPI_EVENT_RING_TRIP_PRESENT) ? "Ring Present" : \ - ((state) == WP_TDMAPI_EVENT_RING_TRIP_STOP) ? "Ring Stop" : \ - "(Unknown state)" -/*Link Status */ -#define WP_TDMAPI_EVENT_LINK_STATUS_CONNECTED 0x01 -#define WP_TDMAPI_EVENT_LINK_STATUS_DISCONNECTED 0x02 -#define WP_TDMAPI_EVENT_LINK_STATUS_DECODE(status) \ - ((status) == WP_TDMAPI_EVENT_LINK_STATUS_CONNECTED) ? "Connected" : \ - ((status) == WP_TDMAPI_EVENT_LINK_STATUS_DISCONNECTED) ? "Disconnected" : \ - "Unknown" -#define WP_TDMAPI_EVENT_TONE_DIAL 0x01 -#define WP_TDMAPI_EVENT_TONE_BUSY 0x02 -#define WP_TDMAPI_EVENT_TONE_RING 0x03 -#define WP_TDMAPI_EVENT_TONE_CONGESTION 0x04 - -/* BRI channels list */ -#define WAN_BRI_BCHAN1 0x01 -#define WAN_BRI_BCHAN2 0x02 -#define WAN_BRI_DCHAN 0x03 - - -typedef struct { - - u_int8_t type; - u_int8_t mode; - u_int32_t time_stamp; - u_int8_t channel; - u_int32_t chan_map; - u_int8_t span; - union { - struct { - u_int8_t alarm; - } te1_alarm; - struct { - u_int8_t rbs_bits; - } te1_rbs; - struct { - u_int8_t state; - u_int8_t sig; - } rm_hook; - struct { - u_int8_t state; - } rm_ring; - struct { - u_int8_t type; - } rm_tone; - struct { - u_int8_t digit; /* DTMF: digit */ - u_int8_t port; /* DTMF: SOUT/ROUT */ - u_int8_t type; /* DTMF: PRESET/STOP */ - } dtmf; - struct { - u_int16_t polarity; - u_int16_t ohttimer; - } rm_common; - struct{ - u_int16_t status; - } linkstatus; - } wp_tdm_api_event_u; -#define wp_tdm_api_event_type type -#define wp_tdm_api_event_mode mode -#define wp_tdm_api_event_alarm wp_tdm_api_event_u.te1_alarm.alarm -#define wp_tdm_api_event_alarm wp_tdm_api_event_u.te1_alarm.alarm -#define wp_tdm_api_event_rbs_bits wp_tdm_api_event_u.te1_rbs.rbs_bits -#define wp_tdm_api_event_hook_state wp_tdm_api_event_u.rm_hook.state -#define wp_tdm_api_event_hook_sig wp_tdm_api_event_u.rm_hook.sig -#define wp_tdm_api_event_ring_state wp_tdm_api_event_u.rm_ring.state -#define wp_tdm_api_event_tone_type wp_tdm_api_event_u.rm_tone.type -#define wp_tdm_api_event_dtmf_digit wp_tdm_api_event_u.dtmf.digit -#define wp_tdm_api_event_dtmf_type wp_tdm_api_event_u.dtmf.type -#define wp_tdm_api_event_dtmf_port wp_tdm_api_event_u.dtmf.port -#define wp_tdm_api_event_ohttimer wp_tdm_api_event_u.rm_common.ohttimer -#define wp_tdm_api_event_polarity wp_tdm_api_event_u.rm_common.polarity -#define wp_tdm_api_event_link_status wp_tdm_api_event_u.linkstatus.status -} wp_tdm_api_event_t; - -typedef struct { - union { - unsigned char reserved[16]; - }wp_rx_hdr_u; -} wp_tdm_api_rx_hdr_t; - -typedef struct { - wp_tdm_api_rx_hdr_t hdr; - unsigned char data[1]; -} wp_tdm_api_rx_element_t; - -typedef struct { - union { - struct { - unsigned char _rbs_rx_bits; - unsigned int _time_stamp; - }wp_tx; - unsigned char reserved[16]; - }wp_tx_hdr_u; -#define wp_api_time_stamp wp_tx_hdr_u.wp_tx._time_stamp -} wp_tdm_api_tx_hdr_t; - -typedef struct { - wp_tdm_api_tx_hdr_t hdr; - unsigned char data[1]; -} wp_tdm_api_tx_element_t; - - - -typedef struct wp_tdm_chan_stats -{ - unsigned int rx_packets; /* total packets received */ - unsigned int tx_packets; /* total packets transmitted */ - unsigned int rx_bytes; /* total bytes received */ - unsigned int tx_bytes; /* total bytes transmitted */ - unsigned int rx_errors; /* bad packets received */ - unsigned int tx_errors; /* packet transmit problems */ - unsigned int rx_dropped; /* no space in linux buffers */ - unsigned int tx_dropped; /* no space available in linux */ - unsigned int multicast; /* multicast packets received */ -#if !defined(__WINDOWS__) - unsigned int collisions; -#endif - /* detailed rx_errors: */ - unsigned int rx_length_errors; - unsigned int rx_over_errors; /* receiver ring buff overflow */ - unsigned int rx_crc_errors; /* recved pkt with crc error */ - unsigned int rx_frame_errors; /* recv'd frame alignment error */ -#if !defined(__WINDOWS__) - unsigned int rx_fifo_errors; /* recv'r fifo overrun */ -#endif - unsigned int rx_missed_errors; /* receiver missed packet */ - - /* detailed tx_errors */ -#if !defined(__WINDOWS__) - unsigned int tx_aborted_errors; - unsigned int tx_carrier_errors; -#endif - unsigned int tx_fifo_errors; - unsigned int tx_heartbeat_errors; - unsigned int tx_window_errors; - -}wp_tdm_chan_stats_t; - - - -typedef struct wanpipe_tdm_api_cmd{ - unsigned int cmd; - unsigned int hw_tdm_coding; /* Set/Get HW TDM coding: uLaw muLaw */ - unsigned int hw_mtu_mru; /* Set/Get HW TDM MTU/MRU */ - unsigned int usr_period; /* Set/Get User Period in ms */ - unsigned int tdm_codec; /* Set/Get TDM Codec: SLinear */ - unsigned int power_level; /* Set/Get Power level treshold */ - unsigned int rx_disable; /* Enable/Disable Rx */ - unsigned int tx_disable; /* Enable/Disable Tx */ - unsigned int usr_mtu_mru; /* Set/Get User TDM MTU/MRU */ - unsigned int ec_tap; /* Echo Cancellation Tap */ - unsigned int rbs_poll; /* Enable/Disable RBS Polling */ - unsigned int rbs_rx_bits; /* Rx RBS Bits */ - unsigned int rbs_tx_bits; /* Tx RBS Bits */ - unsigned int hdlc; /* HDLC based device */ - unsigned int idle_flag; /* IDLE flag to Tx */ - unsigned int fe_alarms; /* FE Alarms detected */ - wp_tdm_chan_stats_t stats; /* TDM Statistics */ - /* Do NOT add anything above this! Important for binary backward compatibility. */ - wp_tdm_api_event_t event; /* TDM Event */ - unsigned int data_len; - void *data; - unsigned char fe_status; /* FE status - Connected or Disconnected */ - unsigned int hw_dtmf; /* HW DTMF enabled */ -}wanpipe_tdm_api_cmd_t; - -typedef struct wanpipe_tdm_api_event{ - int (*wp_rbs_event)(sng_fd_t fd, unsigned char rbs_bits); - int (*wp_dtmf_event)(sng_fd_t fd, unsigned char dtmf, unsigned char type, unsigned char port); - int (*wp_rxhook_event)(sng_fd_t fd, unsigned char hook_state); - int (*wp_ring_detect_event)(sng_fd_t fd, unsigned char ring_state); - int (*wp_ring_trip_detect_event)(sng_fd_t fd, unsigned char ring_state); - int (*wp_fe_alarm_event)(sng_fd_t fd, unsigned char fe_alarm_event); - int (*wp_link_status_event)(sng_fd_t fd, unsigned char link_status_event); -}wanpipe_tdm_api_event_t; - -typedef struct wanpipe_tdm_api{ - wanpipe_tdm_api_cmd_t wp_tdm_cmd; - wanpipe_tdm_api_event_t wp_tdm_event; -}wanpipe_tdm_api_t; - - -#endif commit d53db202435868cfac98ed0ce6fe537d84a4947d Author: Moises Silva <moy@sangoma.com> Date: Fri Nov 26 15:06:36 2010 -0500 freetdm: ftmod_wanpipe - add tx stats diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index b97b75c..804c6cf 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -783,6 +783,47 @@ static FIO_COMMAND_FUNCTION(wanpipe_command) return FTDM_SUCCESS; } +static void wanpipe_write_stats(ftdm_channel_t *ftdmchan, wp_tdm_api_tx_hdr_t *tx_stats) +{ + ftdmchan->iostats.tx.errors = tx_stats->wp_api_tx_hdr_errors; + ftdmchan->iostats.tx.queue_size = tx_stats->wp_api_tx_hdr_max_queue_length; + ftdmchan->iostats.tx.queue_len = tx_stats->wp_api_tx_hdr_number_of_frames_in_queue; + + if (ftdmchan->iostats.tx.queue_len >= (0.8 * ftdmchan->iostats.tx.queue_size)) { + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Tx Queue length exceeded 80% threshold (%d/%d)\n", + ftdmchan->iostats.tx.queue_len, ftdmchan->iostats.tx.queue_size); + ftdm_set_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_THRES); + } else if (ftdm_test_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_THRES)){ + ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Tx Queue length reduced 80% threshold (%d/%d)\n", + ftdmchan->iostats.tx.queue_len, ftdmchan->iostats.tx.queue_size); + ftdm_clear_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_THRES); + } + + if (ftdmchan->iostats.tx.queue_len >= ftdmchan->iostats.rx.queue_size) { + ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Tx Queue Full (%d/%d)\n", + ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); + ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_FULL); + } else if (ftdm_test_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_FULL)){ + ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Tx Queue no longer full (%d/%d)\n", + ftdmchan->iostats.tx.queue_len, ftdmchan->iostats.tx.queue_size); + ftdm_clear_flag(&(ftdmchan->iostats.tx), FTDM_IOSTATS_ERROR_QUEUE_FULL); + } + + if (ftdmchan->iostats.tx.idle_packets < tx_stats->wp_api_tx_hdr_number_of_frames_in_queue) { + ftdmchan->iostats.tx.idle_packets = tx_stats->wp_api_tx_hdr_tx_idle_packets; + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Tx idle: %d\n", ftdmchan->iostats.tx.idle_packets); + } + + if (!ftdmchan->iostats.tx.packets) { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "First packet write stats: Tx queue len: %d, Tx queue size: %d, Tx idle: %d\n", + ftdmchan->iostats.tx.queue_len, + ftdmchan->iostats.tx.queue_size, + ftdmchan->iostats.tx.idle_packets); + } + + ftdmchan->iostats.tx.packets++; +} + static void wanpipe_read_stats(ftdm_channel_t *ftdmchan, wp_tdm_api_rx_hdr_t *rx_stats) { ftdmchan->iostats.rx.errors = rx_stats->wp_api_rx_hdr_errors; @@ -906,6 +947,9 @@ static FIO_WRITE_FUNCTION(wanpipe_write) /* should we be checking if bsent == *datalen here? */ if (bsent > 0) { *datalen = bsent; + if (ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS)) { + wanpipe_write_stats(ftdmchan, &hdrframe); + } return FTDM_SUCCESS; } diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index 5c235ad..7683ec7 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -377,17 +377,23 @@ typedef enum { FTDM_IOSTATS_ERROR_QUEUE_FULL = (1 << 6), /* Queue is full */ } ftdm_iostats_error_type_t; -typedef struct iostats_element { - uint32_t errors; - uint16_t flags; - uint8_t queue_size; /* max queue size configured */ - uint8_t queue_len; /* Current number of elements in queue */ - uint64_t packets; -} iostats_element_t; - typedef struct { - iostats_element_t rx; - iostats_element_t tx; + struct { + uint32_t errors; + uint16_t flags; + uint8_t queue_size; /* max queue size configured */ + uint8_t queue_len; /* Current number of elements in queue */ + uint64_t packets; + } rx; + + struct { + uint32_t errors; + uint16_t flags; + uint8_t idle_packets; + uint8_t queue_size; /* max queue size configured */ + uint8_t queue_len; /* Current number of elements in queue */ + uint64_t packets; + } tx; } ftdm_channel_iostats_t; /* 2^8 table size, one for each byte (sample) value */ commit 8fd62850e4ba65a249900c044bdbf057e1117477 Author: Jeff Lenk <jeff@jefflenk.com> Date: Fri Nov 26 13:07:57 2010 -0600 vs2010 add mod_cepstral to setup build diff --git a/Freeswitch.2010.sln b/Freeswitch.2010.sln index 1869698..4f48314 100644 --- a/Freeswitch.2010.sln +++ b/Freeswitch.2010.sln @@ -964,7 +964,9 @@ Global {692F6330-4D87-4C82-81DF-40DB5892636E}.Release|Win32.ActiveCfg = Release|Win32 {692F6330-4D87-4C82-81DF-40DB5892636E}.Release|x64.ActiveCfg = Release|x64 {692F6330-4D87-4C82-81DF-40DB5892636E}.Release|x64 Setup.ActiveCfg = Release|x64 + {692F6330-4D87-4C82-81DF-40DB5892636E}.Release|x64 Setup.Build.0 = Release|x64 {692F6330-4D87-4C82-81DF-40DB5892636E}.Release|x86 Setup.ActiveCfg = Release|Win32 + {692F6330-4D87-4C82-81DF-40DB5892636E}.Release|x86 Setup.Build.0 = Release|Win32 {D3EC0AFF-76FC-4210-A825-9A17410660A3}.All|Win32.ActiveCfg = Release|x64 {D3EC0AFF-76FC-4210-A825-9A17410660A3}.All|x64.ActiveCfg = Release|x64 {D3EC0AFF-76FC-4210-A825-9A17410660A3}.All|x64.Build.0 = Release|x64 commit 17fc3bd62b640196825f3002732affaa9b22da85 Author: Moises Silva <moy@sangoma.com> Date: Fri Nov 26 14:03:16 2010 -0500 freetdm: ftmod_wanpipe, ftmod_sangoma_isdn and and core - Updated stats code diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 2853335..b58bef2 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -600,32 +600,32 @@ void sngisdn_snd_data(ftdm_channel_t *dchan, uint8_t *data, ftdm_size_t len) memcpy(&l1_frame.data, data, len); - if (ftdm_test_flag(&(dchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_CRC)) { + if (ftdm_test_flag(&(dchan->iostats.rx), FTDM_IOSTATS_ERROR_CRC)) { l1_frame.flags |= SNG_L1FRAME_ERROR_CRC; } - if (ftdm_test_flag(&(dchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_FRAME)) { + if (ftdm_test_flag(&(dchan->iostats.rx), FTDM_IOSTATS_ERROR_FRAME)) { l1_frame.flags |= SNG_L1FRAME_ERROR_FRAME; } - if (ftdm_test_flag(&(dchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_ABORT)) { + if (ftdm_test_flag(&(dchan->iostats.rx), FTDM_IOSTATS_ERROR_ABORT)) { l1_frame.flags |= SNG_L1FRAME_ERROR_ABORT; } - if (ftdm_test_flag(&(dchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_FIFO)) { + if (ftdm_test_flag(&(dchan->iostats.rx), FTDM_IOSTATS_ERROR_FIFO)) { l1_frame.flags |= SNG_L1FRAME_ERROR_FIFO; } - if (ftdm_test_flag(&(dchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_DMA)) { + if (ftdm_test_flag(&(dchan->iostats.rx), FTDM_IOSTATS_ERROR_DMA)) { l1_frame.flags |= SNG_L1FRAME_ERROR_DMA; } - if (ftdm_test_flag(&(dchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES)) { + if (ftdm_test_flag(&(dchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES)) { /* Should we trigger congestion here? */ l1_frame.flags |= SNG_L1FRAME_QUEUE_THRES; } - if (ftdm_test_flag(&(dchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_QUEUE_FULL)) { + if (ftdm_test_flag(&(dchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_FULL)) { /* Should we trigger congestion here? */ l1_frame.flags |= SNG_L1FRAME_QUEUE_FULL; } diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index 98da73e..b97b75c 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -515,8 +515,10 @@ static FIO_OPEN_FUNCTION(wanpipe_open) wanpipe_tdm_api_t tdm_api; memset(&tdm_api,0,sizeof(tdm_api)); + sangoma_tdm_flush_bufs(ftdmchan->sockfd, &tdm_api); sangoma_flush_stats(ftdmchan->sockfd, &tdm_api); + memset(&ftdmchan->iostats, 0, sizeof(ftdmchan->iostats)); if (ftdmchan->type == FTDM_CHAN_TYPE_DQ921 || ftdmchan->type == FTDM_CHAN_TYPE_DQ931) { ftdmchan->native_codec = ftdmchan->effective_codec = FTDM_CODEC_NONE; @@ -753,6 +755,7 @@ static FIO_COMMAND_FUNCTION(wanpipe_command) case FTDM_COMMAND_FLUSH_IOSTATS: { err = sangoma_flush_stats(ftdmchan->sockfd, &tdm_api); + memset(&ftdmchan->iostats, 0, sizeof(ftdmchan->iostats)); } break; case FTDM_COMMAND_SET_RX_QUEUE_SIZE: @@ -782,42 +785,67 @@ static FIO_COMMAND_FUNCTION(wanpipe_command) static void wanpipe_read_stats(ftdm_channel_t *ftdmchan, wp_tdm_api_rx_hdr_t *rx_stats) { - ftdmchan->iostats.stats.rx.flags = 0; - - ftdmchan->iostats.stats.rx.errors = rx_stats->wp_api_rx_hdr_errors; - ftdmchan->iostats.stats.rx.rx_queue_size = rx_stats->wp_api_rx_hdr_max_queue_length; - ftdmchan->iostats.stats.rx.rx_queue_len = rx_stats->wp_api_rx_hdr_number_of_frames_in_queue; + ftdmchan->iostats.rx.errors = rx_stats->wp_api_rx_hdr_errors; + ftdmchan->iostats.rx.queue_size = rx_stats->wp_api_rx_hdr_max_queue_length; + ftdmchan->iostats.rx.queue_len = rx_stats->wp_api_rx_hdr_number_of_frames_in_queue; - if (rx_stats->wp_api_rx_hdr_error_map & (1<<WP_ABORT_ERROR_BIT)) { - ftdm_set_flag(&(ftdmchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_ABORT); + if ((rx_stats->wp_api_rx_hdr_error_map & (1 << WP_ABORT_ERROR_BIT))) { + ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_ABORT); + } else { + ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_ABORT); } - if (rx_stats->wp_api_rx_hdr_error_map & (1<<WP_DMA_ERROR_BIT)) { - ftdm_set_flag(&(ftdmchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_DMA); + + if ((rx_stats->wp_api_rx_hdr_error_map & (1 << WP_DMA_ERROR_BIT))) { + ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_DMA); + } else { + ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_DMA); } - if (rx_stats->wp_api_rx_hdr_error_map & (1<<WP_FIFO_ERROR_BIT)) { - ftdm_set_flag(&(ftdmchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_FIFO); + + if ((rx_stats->wp_api_rx_hdr_error_map & (1 << WP_FIFO_ERROR_BIT))) { + ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_FIFO); + } else { + ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_FIFO); } - if (rx_stats->wp_api_rx_hdr_error_map & (1<<WP_CRC_ERROR_BIT)) { - ftdm_set_flag(&(ftdmchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_CRC); + + if ((rx_stats->wp_api_rx_hdr_error_map & (1 << WP_CRC_ERROR_BIT))) { + ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_CRC); + } else { + ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_CRC); } - if (rx_stats->wp_api_rx_hdr_error_map & (1<<WP_FRAME_ERROR_BIT)) { - ftdm_set_flag(&(ftdmchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_FRAME); + + if ((rx_stats->wp_api_rx_hdr_error_map & (1 << WP_FRAME_ERROR_BIT))) { + ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_FRAME); + } else { + ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_FRAME); } - if (ftdmchan->iostats.stats.rx.rx_queue_len >= (0.8*ftdmchan->iostats.stats.rx.rx_queue_size)) { - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Rx Queue length exceeded threshold (%d/%d)\n", - ftdmchan->iostats.stats.rx.rx_queue_len, ftdmchan->iostats.stats.rx.rx_queue_size); - - ftdm_set_flag(&(ftdmchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES); + if (ftdmchan->iostats.rx.queue_len >= (0.8 * ftdmchan->iostats.rx.queue_size)) { + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Rx Queue length exceeded 80% threshold (%d/%d)\n", + ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); + ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES); + } else if (ftdm_test_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES)){ + /* any reason we have wanpipe_tdm_api_iface.h in ftmod_wanpipe/ dir? */ + ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Rx Queue length reduced 80% threshold (%d/%d)\n", + ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); + ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES); } - if (ftdmchan->iostats.stats.rx.rx_queue_len >= ftdmchan->iostats.stats.rx.rx_queue_size) { + if (ftdmchan->iostats.rx.queue_len >= ftdmchan->iostats.rx.queue_size) { ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Rx Queue Full (%d/%d)\n", - ftdmchan->iostats.stats.rx.rx_queue_len, ftdmchan->iostats.stats.rx.rx_queue_size); - - ftdm_set_flag(&(ftdmchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_QUEUE_FULL); + ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); + ftdm_set_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_FULL); + } else if (ftdm_test_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_FULL)){ + ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Rx Queue no longer full (%d/%d)\n", + ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); + ftdm_clear_flag(&(ftdmchan->iostats.rx), FTDM_IOSTATS_ERROR_QUEUE_FULL); + } + + if (!ftdmchan->iostats.rx.packets) { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "First packet read stats: Rx queue len: %d, Rx queue size: %d\n", + ftdmchan->iostats.rx.queue_len, ftdmchan->iostats.rx.queue_size); } - return; + + ftdmchan->iostats.rx.packets++; } /** diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index 06f899c..5c235ad 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -368,30 +368,26 @@ typedef struct { } ftdm_channel_history_entry_t; typedef enum { - FTDM_IOSTATS_ERROR_CRC = (1<<0), - FTDM_IOSTATS_ERROR_FRAME = (1<<1), - FTDM_IOSTATS_ERROR_ABORT = (1<<2), - FTDM_IOSTATS_ERROR_FIFO = (1<<3), - FTDM_IOSTATS_ERROR_DMA = (1<<4), - FTDM_IOSTATS_ERROR_QUEUE_THRES = (1<<5), /* Queue reached high threshold */ - FTDM_IOSTATS_ERROR_QUEUE_FULL = (1<<6), /* Queue is full */ + FTDM_IOSTATS_ERROR_CRC = (1 << 0), + FTDM_IOSTATS_ERROR_FRAME = (1 << 1), + FTDM_IOSTATS_ERROR_ABORT = (1 << 2), + FTDM_IOSTATS_ERROR_FIFO = (1 << 3), + FTDM_IOSTATS_ERROR_DMA = (1 << 4), + FTDM_IOSTATS_ERROR_QUEUE_THRES = (1 << 5), /* Queue reached high threshold */ + FTDM_IOSTATS_ERROR_QUEUE_FULL = (1 << 6), /* Queue is full */ } ftdm_iostats_error_type_t; +typedef struct iostats_element { + uint32_t errors; + uint16_t flags; + uint8_t queue_size; /* max queue size configured */ + uint8_t queue_len; /* Current number of elements in queue */ + uint64_t packets; +} iostats_element_t; + typedef struct { - union { - struct { - uint32_t errors; - uint16_t flags; - uint8_t rx_queue_size; /* max queue size configured */ - uint8_t rx_queue_len; /* Current number of elements in queue */ - } rx; - struct { - uint32_t errors; - uint16_t flags; - uint8_t tx_queue_size; /* max queue size configured */ - uint8_t tx_queue_len; /* Current number of elements in queue */ - } tx; - } stats; + iostats_element_t rx; + iostats_element_t tx; } ftdm_channel_iostats_t; /* 2^8 table size, one for each byte (sample) value */ commit 546a2961cb5fa1cf056b682c1a4553381d9ec75a Author: David Yat Sin <dyatsin@sangoma.com> Date: Fri Nov 26 12:59:36 2010 -0500 Added channel-restart-on-link-up option diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 2a65a82..36b5662 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -183,6 +183,7 @@ typedef struct sngisdn_span_data { int8_t facility_timeout; uint8_t num_local_numbers; uint8_t timer_t3; + uint8_t restart_opt; char* local_numbers[SNGISDN_NUM_LOCAL_NUMBERS]; ftdm_sched_t *sched; ftdm_queue_t *event_queue; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c index 18ca9c3..a869bda 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c @@ -182,6 +182,7 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ signal_data->overlap_dial = SNGISDN_OPT_DEFAULT; signal_data->setup_arb = SNGISDN_OPT_DEFAULT; signal_data->timer_t3 = 8; + signal_data->restart_opt = SNGISDN_OPT_DEFAULT; signal_data->link_id = span->span_id; span->default_caller_data.bearer_capability = IN_ITC_SPEECH; @@ -271,6 +272,15 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ ftdm_span_set_bearer_capability(val, &span->default_caller_data.bearer_capability); } else if (!strcasecmp(var, "outbound-bearer_layer1")) { ftdm_span_set_bearer_layer1(val, &span->default_caller_data.bearer_layer1); + } else if (!strcasecmp(var, "channel-restart-on-link-up")) { + if (!strcasecmp(val, "yes")) { + signal_data->restart_opt = SNGISDN_OPT_TRUE; + } else if (!strcasecmp(val, "no")) { + signal_data->restart_opt = SNGISDN_OPT_FALSE; + } else { + ftdm_log(FTDM_LOG_ERROR, "Invalid value for parameter:%s:%s\n", var, val); + } + } else if (!strcasecmp(var, "local-number")) { if (add_local_number(val, span) != FTDM_SUCCESS) { return FTDM_FAIL; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c index bb46fb7..94683d8 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c @@ -701,7 +701,16 @@ ftdm_status_t sng_isdn_stack_cfg_q931_dlsap(ftdm_span_t *span) cfg.t.cfg.s.inDLSAP.statEnqOpt = FALSE; cfg.t.cfg.s.inDLSAP.rstOpt = FALSE; } - + + /* Override the restart options if user selected that option */ + if (signal_data->restart_opt != SNGISDN_OPT_DEFAULT) { + if (signal_data->restart_opt == SNGISDN_OPT_TRUE) { + cfg.t.cfg.s.inDLSAP.rstOpt = TRUE; + } else { + cfg.t.cfg.s.inDLSAP.rstOpt = FALSE; + } + } + for (i = 0; i < IN_MAXBCHNL; i++) { cfg.t.cfg.s.inDLSAP.bProf[i].profNmb = 0; commit 894dea2803a66ad933899b4377a9154ee3f16394 Author: Moises Silva <moy@sangoma.com> Date: Fri Nov 26 12:39:30 2010 -0500 freetdm: ftmod_wanpipe - flush stats when opening a channel diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index c55d42e..98da73e 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -516,6 +516,7 @@ static FIO_OPEN_FUNCTION(wanpipe_open) memset(&tdm_api,0,sizeof(tdm_api)); sangoma_tdm_flush_bufs(ftdmchan->sockfd, &tdm_api); + sangoma_flush_stats(ftdmchan->sockfd, &tdm_api); if (ftdmchan->type == FTDM_CHAN_TYPE_DQ921 || ftdmchan->type == FTDM_CHAN_TYPE_DQ931) { ftdmchan->native_codec = ftdmchan->effective_codec = FTDM_CODEC_NONE; commit 2b126a1510abae4364341d29d49cb31711f2119b Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Fri Nov 26 15:03:31 2010 -0200 freetdm: ftmod_r2 - cast added diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 513adfd..c8d669c 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -1656,7 +1656,7 @@ static FIO_API_FUNCTION(ftdm_r2_api) } range = 0; for (i = 0; i < ftdm_array_len(r2data->loops); i++) { - pct = 100*r2data->loops[i]/r2data->total_loops; + pct = 100*(float)r2data->loops[i]/r2data->total_loops; if ((i + 1) == ftdm_array_len(r2data->loops)) { stream->write_function(stream, ">= %dms: %llu - %.03lf%%\n", range, r2data->loops[i], pct); } else { commit 80031c3e17d78c50d533644bd4bbbbbc181d6252 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Fri Nov 26 14:51:09 2010 -0200 freetdm: ftmod_r2 - added percentage to loop timing stats diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 8514569..513adfd 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -1642,6 +1642,7 @@ static FIO_API_FUNCTION(ftdm_r2_api) if (!strcasecmp(argv[0], "loopstats")) { int range; + float pct; span_id = atoi(argv[1]); if (ftdm_span_find_by_name(argv[1], &span) == FTDM_SUCCESS || ftdm_span_find(span_id, &span) == FTDM_SUCCESS) { @@ -1655,10 +1656,11 @@ static FIO_API_FUNCTION(ftdm_r2_api) } range = 0; for (i = 0; i < ftdm_array_len(r2data->loops); i++) { + pct = 100*r2data->loops[i]/r2data->total_loops; if ((i + 1) == ftdm_array_len(r2data->loops)) { - stream->write_function(stream, ">= %dms: %llu\n", range, r2data->loops[i]); + stream->write_function(stream, ">= %dms: %llu - %.03lf%%\n", range, r2data->loops[i], pct); } else { - stream->write_function(stream, "%d-%dms: %llu\n", range, range + 9, r2data->loops[i]); + stream->write_function(stream, "%d-%dms: %llu - %.03lf%%\n", range, range + 9, r2data->loops[i], pct); } range += 10; } commit ef8682507650792e6a3c38b9a5612526ab0b1ecb Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Fri Nov 26 13:49:34 2010 -0200 freetdm: ftmod_r2 - fixed ftdm_r2_state_advance_all() definition diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 84ddea5..8514569 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -152,7 +152,7 @@ static ftdm_hash_t *g_mod_data_hash; static ftdm_io_interface_t g_ftdm_r2_interface; static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan); -static int ftdm_r2_state_advance_all(ftdm_channel_t *ftdmchan); +static void ftdm_r2_state_advance_all(ftdm_channel_t *ftdmchan); /* functions not available on windows */ commit 86657a6c0aefb1cb52f47c77aae38415bc584dfe Author: Moises Silva <moy@sangoma.com> Date: Fri Nov 26 10:42:37 2010 -0500 freetdm: ftmod_r2 - process all state changes before moving to openr2 events or going back to sleep diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 06d1abd..84ddea5 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -152,6 +152,7 @@ static ftdm_hash_t *g_mod_data_hash; static ftdm_io_interface_t g_ftdm_r2_interface; static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan); +static int ftdm_r2_state_advance_all(ftdm_channel_t *ftdmchan); /* functions not available on windows */ @@ -529,7 +530,7 @@ static void ftdm_r2_on_call_end(openr2_chan_t *r2chan) ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); /* in some circumstances openr2 can call on_call_init right after this, so let's advance the state right here */ - ftdm_r2_state_advance(ftdmchan); + ftdm_r2_state_advance_all(ftdmchan); } static void ftdm_r2_on_call_read(openr2_chan_t *r2chan, const unsigned char *buf, int buflen) @@ -1347,6 +1348,20 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) return ret; } +/* the channel must be locked when calling this function */ +static void ftdm_r2_state_advance_all(ftdm_channel_t *ftdmchan) +{ + /* because we do not always acknowledge the state change (clearing the FTDM_CHANNEL_STATE_CHANGE flag) due to the accept + * procedure described below, we need the chanstate member to NOT process some states twice, so is valid entering this + * function with the FTDM_CHANNEL_STATE_CHANGE flag set but with a state that was already processed and is just waiting + * to complete (the processing is media-bound) + * */ + while (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE) + && (R2CALL(ftdmchan)->chanstate != ftdmchan->state)) { + ftdm_r2_state_advance(ftdmchan); + } +} + static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) { openr2_chan_t *r2chan; @@ -1431,9 +1446,9 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) r2call = R2CALL(ftdmchan); ftdm_mutex_lock(ftdmchan->mutex); - ftdm_r2_state_advance(ftdmchan); + ftdm_r2_state_advance_all(ftdmchan); openr2_chan_process_signaling(r2chan); - ftdm_r2_state_advance(ftdmchan); + ftdm_r2_state_advance_all(ftdmchan); ftdm_mutex_unlock(ftdmchan->mutex); } ftdm_span_trigger_signals(span); commit 599a200509e4f164aa494e1798f61e8138d5d20a Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Fri Nov 26 07:05:16 2010 -0600 skypopen: adding osscuse directory, lot of news to come in some days ;) diff --git a/src/mod/endpoints/mod_skypopen/osscuse/98-osscuse.rules b/src/mod/endpoints/mod_skypopen/osscuse/98-osscuse.rules new file mode 100644 index 0000000..c1430fd --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/osscuse/98-osscuse.rules @@ -0,0 +1,7 @@ +# Since these devices are not part of 'sound' subsystem the group is forced +# to audio by name +# /dev/cuse can stay mode 0660 root:root since osspd is run as root +# and drops privileges to user level when opened by user +KERNEL=="dsp", GROUP="audio" +KERNEL=="mixer", GROUP="audio" +KERNEL=="adsp", GROUP="audio" diff --git a/src/mod/endpoints/mod_skypopen/osscuse/LICENSE b/src/mod/endpoints/mod_skypopen/osscuse/LICENSE new file mode 100644 index 0000000..d511905 --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/osscuse/LICENSE @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + 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., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/src/mod/endpoints/mod_skypopen/osscuse/Makefile b/src/mod/endpoints/mod_skypopen/osscuse/Makefile new file mode 100644 index 0000000..a42d37a --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/osscuse/Makefile @@ -0,0 +1,69 @@ +# These can be overridden if needed +# DESTDIR is completely respected +CC := gcc +AR := ar +CFLAGS := -Wall $(CFLAGS) +XLDFLAGS := $(LDFLAGS) +LDFLAGS := -L. -lossp $(LDFLAGS) +prefix := /usr/local +DESTDIR := +UDEVDIR := /etc/udev/rules.d + +ifeq "$(origin OSSPD_CFLAGS)" "undefined" +OSSPD_CFLAGS := $(shell pkg-config --cflags fuse) +endif + +ifeq "$(origin OSSPD_LDFLAGS)" "undefined" +OSSPD_LDFLAGS := $(shell pkg-config --libs fuse) +endif + +ifeq "$(origin OSSP_PADSP_CFLAGS)" "undefined" +OSSP_PADSP_CFLAGS := $(shell pkg-config --cflags libpulse) +endif + +ifeq "$(origin OSSP_PADSP_LDFLAGS)" "undefined" +OSSP_PADSP_LDFLAGS := $(shell pkg-config --libs libpulse) +endif + +ifeq "$(origin OSSP_ALSAP_CFLAGS)" "undefined" +OSSP_ALSAP_CFLAGS := $(shell pkg-config --libs alsa) +endif + +ifeq "$(origin OSSP_ALSAP_LDFLAGS)" "undefined" +OSSP_ALSAP_LDFLAGS := $(shell pkg-config --libs alsa) +endif + +headers := ossp.h ossp-util.h ossp-slave.h + +#all: osspd ossp-padsp ossp-alsap +all: osspd ossp-alsap + +install: + mkdir -p $(DESTDIR)$(prefix)/sbin + install -m755 osspd ossp-padsp ossp-alsap $(DESTDIR)$(prefix)/sbin + mkdir -p $(DESTDIR)$(UDEVDIR) + install -m644 98-osscuse.rules $(DESTDIR)$(UDEVDIR) + +libossp.a: ossp.c ossp.h ossp-util.c ossp-util.h ossp-slave.c ossp-slave.h + $(CC) $(CFLAGS) -c -o ossp.o ossp.c + $(CC) $(CFLAGS) -c -o ossp-util.o ossp-util.c + $(CC) $(CFLAGS) -c -o ossp-slave.o ossp-slave.c + $(AR) rc $@ ossp.o ossp-util.o ossp-slave.o + +osspd: osspd.c libossp.a $(headers) + $(CC) $(CFLAGS) $(OSSPD_CFLAGS) -o $@ $< $(OSSPD_LDFLAGS) $(LDFLAGS) + +ossp-padsp: ossp-padsp.c libossp.a $(headers) + $(CC) $(CFLAGS) $(OSSP_PADSP_CFLAGS) -o $@ $< $(OSSP_PADSP_LDFLAGS) $(LDFLAGS) + +ossp-alsap: ossp-alsap.c libossp.a $(headers) + $(CC) $(CFLAGS) $(OSSP_ALSAP_CFLAGS) -o $@ $< $(OSSP_ALSAP_LDFLAGS) $(LDFLAGS) + +osstest: osstest.c + $(CC) $(CFLAGS) -o $@ $< $(XLDFLAGS) + +test: osstest + @./osstest + +clean: + rm -f *.o *.a osspd ossp-padsp ossp-alsap osstest diff --git a/src/mod/endpoints/mod_skypopen/osscuse/README b/src/mod/endpoints/mod_skypopen/osscuse/README new file mode 100644 index 0000000..6b716c7 --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/osscuse/README @@ -0,0 +1,119 @@ + + OSS Proxy - emulate OSS device using CUSE + + Copyright (C) 2008-2009 SUSE Linux Products GmbH + Copyright (C) 2008-2009 Tejun Heo <tj@kernel.org> + +1. What is it? +-------------- + +Well, first, OSS refers to Open Sound System. If it still doesn't +ring a bell, think /dev/dsp, /dev/adsp and /dev/mixer. + +Currently, Linux supports two audio programming interface - ALSA and +OSS. The latter one is deprecated and has been that way for a long +time but there still are applications which still use them including +UML (usermode Linux) host sound support. + +ALSA contains OSS emulation but sadly the emulation is behind +multiplexing layer (which is in userland) which means that if your +sound card doesn't support multiple audio streams, only either one of +ALSA or OSS interface would be usable at any given moment. + +There have been also attempts to emulate OSS in userland using dynamic +library preloading - aoss and more recently padsp. This works for +many applications but it's just not easy to emulate everything using +the technique. Things like polling, signals, forking, privilege +changes make it very difficult to emulate things reliably. + +OSS Proxy uses CUSE (extension of FUSE allowing character devices to +be implemented in userspace) to implement OSS interface - /dev/dsp, +/dev/adsp and /dev/mixer. From the POV of the applications, these +devices are proper character devices and behave exactly the same way +so it can be made quite versatile. + + +2. Hmmm... So, how does the whole thing work? +--------------------------------------------- + +The OSS Proxy daemon - osspd - should be started first. Note that +osspd will fail to start if sound device number regions are already +occupied. You'll need to turn off OSS or its emulation[1]. + +On startup, osspd creates /dev/dsp, /dev/adsp and /dev/mixer using +CUSE. When an application access one of the devices, all IOs are +redirected to osspd via CUSE. Upon receiving a new DSP open request, +osspd creates a slave process which drops the root privilege and +assumes the opening process's credentials. After handshaking, osspd +forwards all relevant IOs to the slave which is responsible for +actually playing the sound. + +Currently there's only one slave implemented - ossp-padsp, which as +the name suggests forwards (again) the sound to pulseaudio. To sum +up, the whole pipe looks like the following. + + App <-> /dev/dsp <-> CUSE <-> osspd <-> ossp-padsp <-> pulseaudio + +Which is a lot of forwarding, but on modern machines, it won't be too +noticeable. + + +3. What works? +-------------- + +Well, MIDI part isn't implemented and I doubt it will be in any near +future but except that everything should work. Playing, recording, +5.1ch, A-V syncing, all should work. If not, it's a bug, so please +report. + +The mixer behaves a bit differently tho. In the original OSS, +/dev/mixer is the hardware mixer, so adjusting volumes there affects +all audio streams. When using ossp, each process group gets its own +mixer and the mixer always contains only two knobs - PCM and IGAIN. +Combined with per-stream volume control of pulseaudio, this scheme +works quite well for applications with embedded volume control +although it makes standalone OSS mixer programs virtually useless[2]. + + +4. How do I use it? +------------------- + +First you need CUSE support in kernel which might land on 2.6.28 with +sufficient luck[3] and then you also need libfuse which supports +CUSE[4]. Once you have both, it should be easy. First build it by +running `make'. You can set OSSPD_CFLAGS, OSSPD_LDFLAGS, +OSSP_PADSP_CFLAGS and OSSP_PADSP_LDFLAGS if you have stuff at +non-default locations. + +After build completes, there will be two executables - `osspd' and +`ossp-padsp'. Just copy them to where other system executables live. +Specific location doesn't matter as long as both files end up in the +same directory. + +Execute `osspd'. It will create the device files and you're all set. +`osspd' uses syslog with LOG_DAEMON facility, so if something doesn't +work take a look at what osspd complains about. + + +[1] As of this writing, turning on any sound support makes the + soundcore module claim OSS device regions. Patch to make it claim + OSS device regions only when OSS support or emulation is enabled + is scheduled for 2.6.28. Even with the patch, soundcore will + claim OSS device regions if OSS support or ALSA OSS emulation is + enabled. Make sure they're turned off. + +[2] If you have a strong reason to use standalone OSS mixer program, + you can play some shell tricks to put it into the same process + group as the target audio application. e.g. To use aumix with + mpg123 - `(mpg123 asdf.mp3 > /dev/null 2>&1 & aumix)', but + seriously, just use PA or ALSA one. + +[3] For the time being, here's the git tree with all the necessary + changes. This tree is base on top of 2.6.27-rc3. + + http://git.kernel.org/?p=linux/kernel/git/tj/misc.git;a=shortlog;h=cuse + git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc.git cuse + +[4] And libfuse with the modifications can be found at... + + http://userweb.kernel.org/~tj/ossp/fuse-cuse.tar.gz diff --git a/src/mod/endpoints/mod_skypopen/osscuse/ossp-alsap.c b/src/mod/endpoints/mod_skypopen/osscuse/ossp-alsap.c new file mode 100644 index 0000000..607e05c --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/osscuse/ossp-alsap.c @@ -0,0 +1,613 @@ +/* + * ossp-alsap - ossp DSP slave which forwards to alsa + * + * Copyright (C) 2009 Maarten Lankhorst <m.b.lankhorst@gmail.com> + * + * This file is released under the GPLv2. + * + * Why an alsa plugin as well? Just to show how much + * the alsa userspace api sucks ;-) + */ + +#include <assert.h> +#include <errno.h> +#include <fcntl.h> +#include <getopt.h> +#include <libgen.h> +#include <limits.h> +#include <poll.h> +#include <pthread.h> +#include <pwd.h> +#include <stdarg.h> +#include <stdio.h> +#include <string.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <unistd.h> + +#include <alsa/asoundlib.h> +#include <sys/soundcard.h> + +#include "ossp-slave.h" + +enum { + AFMT_FLOAT = 0x00004000, + AFMT_S32_LE = 0x00001000, + AFMT_S32_BE = 0x00002000, +}; + +static size_t page_size; + +/* alsa structures */ +static snd_pcm_t *pcm[2]; +static snd_pcm_hw_params_t *hw_params; +static snd_pcm_sw_params_t *sw_params; +static int block; + +static unsigned int byte_counter[2]; +static snd_pcm_uframes_t mmap_pos[2]; +static int stream_corked[2]; +static int stream_notify; + +static struct format { + snd_pcm_format_t format; + snd_pcm_sframes_t rate; + int channels; +} hw_format = { SND_PCM_FORMAT_U8, 8000, 1 }; + +#if 0 +/* future mmap stuff */ +static size_t mmap_raw_size, mmap_size; +static int mmap_fd[2] = { -1, -1 }; +static void *mmap_map[2]; +static uint64_t mmap_idx[2]; /* mmap pointer */ +static uint64_t mmap_last_idx[2]; /* last idx for get_ptr */ +static struct ring_buf mmap_stg[2]; /* staging ring buffer */ +static size_t mmap_lead[2]; /* lead bytes */ +static int mmap_sync[2]; /* sync with backend stream */ +#endif + +static snd_pcm_format_t fmt_oss_to_alsa(int fmt) +{ + switch (fmt) { + case AFMT_U8: return SND_PCM_FORMAT_U8; + case AFMT_A_LAW: return SND_PCM_FORMAT_A_LAW; + case AFMT_MU_LAW: return SND_PCM_FORMAT_MU_LAW; + case AFMT_S16_LE: return SND_PCM_FORMAT_S16_LE; + case AFMT_S16_BE: return SND_PCM_FORMAT_S16_BE; + case AFMT_FLOAT: return SND_PCM_FORMAT_FLOAT; + case AFMT_S32_LE: return SND_PCM_FORMAT_S32_LE; + case AFMT_S32_BE: return SND_PCM_FORMAT_S32_BE; + default: return SND_PCM_FORMAT_U8; + } +} + +static int fmt_alsa_to_oss(snd_pcm_format_t fmt) +{ + switch (fmt) { + case SND_PCM_FORMAT_U8: return AFMT_U8; + case SND_PCM_FORMAT_A_LAW: return AFMT_A_LAW; + case SND_PCM_FORMAT_MU_LAW: return AFMT_MU_LAW; + case SND_PCM_FORMAT_S16_LE: return AFMT_S16_LE; + case SND_PCM_FORMAT_S16_BE: return AFMT_S16_BE; + case SND_PCM_FORMAT_FLOAT: return AFMT_FLOAT; + case SND_PCM_FORMAT_S32_LE: return AFMT_S32_LE; + case SND_PCM_FORMAT_S32_BE: return AFMT_S32_BE; + default: return AFMT_U8; + } +} + +static void flush_streams(int drain) +{ + /* FIXME: snd_pcm_drain appears to be able to deadlock, + * always drop or check state? */ + if (drain) { + if (pcm[PLAY]) + snd_pcm_drain(pcm[PLAY]); + if (pcm[REC]) + snd_pcm_drain(pcm[REC]); + } else { + if (pcm[PLAY]) + snd_pcm_drop(pcm[PLAY]); + if (pcm[REC]) + snd_pcm_drop(pcm[REC]); + } + + /* XXX: Really needed? */ +#if 0 + if (pcm[PLAY]) { + snd_pcm_close(pcm[PLAY]); + snd_pcm_open(&pcm[PLAY], "default", + SND_PCM_STREAM_PLAYBACK, block); + } + if (pcm[REC]) { + snd_pcm_close(pcm[REC]); + snd_pcm_open(&pcm[REC], "default", + SND_PCM_STREAM_CAPTURE, block); + } +#endif +} + +static void kill_streams(void) +{ + flush_streams(0); +} + +static int trigger_streams(int play, int rec) +{ + int ret = 0; + + if (pcm[PLAY] && play >= 0) { + ret = snd_pcm_sw_params_set_start_threshold(pcm[PLAY], sw_params, + play ? 1 : -1); + if (ret >= 0) + snd_pcm_sw_params(pcm[PLAY], sw_params); + } + if (ret >= 0 && pcm[REC] && rec >= 0) { + ret = snd_pcm_sw_params_set_start_threshold(pcm[REC], sw_params, + rec ? 1 : -1); + if (ret >= 0) + snd_pcm_sw_params(pcm[REC], sw_params); + } + + return ret; +} + +static ssize_t alsap_mixer(enum ossp_opcode opcode, + void *carg, void *din, size_t din_sz, + void *rarg, void *dout, size_t *dout_szp, int tfd) +{ +return -EBUSY; +} + +static int set_hw_params(snd_pcm_t *pcm) +{ + int ret; + unsigned rate; + + ret = snd_pcm_hw_params_any(pcm, hw_params); + if (ret >= 0) + ret = snd_pcm_hw_params_set_access(pcm, hw_params, + SND_PCM_ACCESS_RW_INTERLEAVED); + rate = hw_format.rate; + if (ret >= 0) + ret = snd_pcm_hw_params_set_rate_minmax(pcm, hw_params, + &rate, NULL, + &rate, NULL); + if (ret >= 0) + ret = snd_pcm_hw_params_set_format(pcm, hw_params, hw_format.format); + if (ret >= 0) + ret = snd_pcm_hw_params_set_channels(pcm, hw_params, + hw_format.channels); + if (ret >= 0) + ret = snd_pcm_hw_params(pcm, hw_params); + if (ret >= 0) + ret = snd_pcm_sw_params_current(pcm, sw_params); + if (ret >= 0) + ret = snd_pcm_sw_params(pcm, sw_params); + return ret; +} + +static ssize_t alsap_open(enum ossp_opcode opcode, + void *carg, void *din, size_t din_sz, + void *rarg, void *dout, size_t *dout_szp, int tfd) +{ + struct ossp_dsp_open_arg *arg = carg; + int ret; + block = arg->flags & O_NONBLOCK ? SND_PCM_NONBLOCK : 0; + int access; +// block |= SND_PCM_ASYNC; + /* Woop dee dooo.. I love handling things in SIGIO (PAIN!!) + * Probably needed for MMAP + */ + + if (!hw_params) + ret = snd_pcm_hw_params_malloc(&hw_params); + if (ret < 0) + return ret; + + if (!sw_params) + ret = snd_pcm_sw_params_malloc(&sw_params); + if (ret < 0) + return ret; + + if (pcm[PLAY]) + snd_pcm_close(pcm[PLAY]); + if (pcm[REC]) + snd_pcm_close(pcm[REC]); + pcm[REC] = pcm[PLAY] = NULL; + + access = arg->flags & O_ACCMODE; + if (access == O_WRONLY || access == O_RDWR) { + ret = snd_pcm_open(&pcm[PLAY], "default", + SND_PCM_STREAM_PLAYBACK, block); + if (ret >= 0) + ret = set_hw_params(pcm[PLAY]); + } + + if (ret >= 0 && (access == O_RDONLY || access == O_RDWR)) { + ret = snd_pcm_open(&pcm[REC], "default", + SND_PCM_STREAM_CAPTURE, block); + if (ret >= 0) + ret = set_hw_params(pcm[REC]); + } + + if (ret < 0) { + if (pcm[PLAY]) + snd_pcm_close(pcm[PLAY]); + if (pcm[REC]) + snd_pcm_close(pcm[REC]); + pcm[REC] = pcm[PLAY] = NULL; + return ret; + } + return 0; +} + +#define GIOVANNI +#ifdef GIOVANNI + +#define GIOVA_SLEEP 40000 +#define GIOVA_BLK 3840 +static ssize_t alsap_write(enum ossp_opcode opcode, + void *carg, void *din, size_t din_sz, + void *rarg, void *dout, size_t *dout_szp, int tfd) +{ + usleep((GIOVA_SLEEP/GIOVA_BLK)* din_sz); + return din_sz; +} +static ssize_t alsap_read(enum ossp_opcode opcode, + void *carg, void *din, size_t din_sz, + void *rarg, void *dout, size_t *dout_szp, int tfd) +{ + usleep((GIOVA_SLEEP/GIOVA_BLK)* *dout_szp); + return *dout_szp; +} +#else// GIOVANNI +static ssize_t alsap_write(enum ossp_opcode opcode, + void *carg, void *din, size_t din_sz, + void *rarg, void *dout, size_t *dout_szp, int tfd) +{ +// struct ossp_dsp_rw_arg *arg = carg; + int ret, insize; + + insize = snd_pcm_bytes_to_frames(pcm[PLAY], din_sz); + + if (snd_pcm_state(pcm[PLAY]) == SND_PCM_STATE_SETUP) + snd_pcm_prepare(pcm[PLAY]); + +// snd_pcm_start(pcm[PLAY]); + ret = snd_pcm_writei(pcm[PLAY], din, insize); + if (ret < 0) + ret = snd_pcm_recover(pcm[PLAY], ret, 1); + + if (ret >= 0) + return snd_pcm_frames_to_bytes(pcm[PLAY], ret); + else + return ret; +} + +static ssize_t alsap_read(enum ossp_opcode opcode, + void *carg, void *din, size_t din_sz, + void *rarg, void *dout, size_t *dout_szp, int tfd) +{ +// struct ossp_dsp_rw_arg *arg = carg; + int ret, outsize; + + outsize = snd_pcm_bytes_to_frames(pcm[REC], *dout_szp); + + if (snd_pcm_state(pcm[REC]) == SND_PCM_STATE_SETUP) + snd_pcm_prepare(pcm[REC]); + + ret = snd_pcm_readi(pcm[REC], dout, outsize); + if (ret < 0) + ret = snd_pcm_recover(pcm[REC], ret, 1); + if (ret >= 0) + *dout_szp = ret = snd_pcm_frames_to_bytes(pcm[REC], ret); + else + *dout_szp = 0; + + return ret; +} +#endif// GIOVANNI + +static ssize_t alsap_poll(enum ossp_opcode opcode, + void *carg, void *din, size_t din_sz, + void *rarg, void *dout, size_t *dout_szp, int tfd) +{ + unsigned revents = 0; + + stream_notify |= *(int *)carg; + + if (pcm[PLAY]) + revents |= POLLOUT; + if (pcm[REC]) + revents |= POLLIN; + + *(unsigned *)rarg = revents; + return 0; +} + + +static ssize_t alsap_flush(enum ossp_opcode opcode, + void *carg, void *din, size_t din_sz, + void *rarg, void *dout, size_t *dout_szp, int tfd) +{ + flush_streams(opcode == OSSP_DSP_SYNC); + return 0; +} + +static ssize_t alsap_post(enum ossp_opcode opcode, + void *carg, void *din, size_t din_sz, + void *rarg, void *dout, size_t *dout_szp, int tfd) +{ + int ret; + + ret = trigger_streams(1, 1); + if (ret >= 0 && pcm[PLAY]) + ret = snd_pcm_start(pcm[PLAY]); + if (pcm[REC]) + ret = snd_pcm_start(pcm[REC]); + return ret; +} + +static ssize_t alsap_get_param(enum ossp_opcode opcode, + void *carg, void *din, size_t din_sz, + void *rarg, void *dout, size_t *dout_szp, + int tfd) +{ + int v = 0; + + switch (opcode) { + case OSSP_DSP_GET_RATE: + return hw_format.rate; + + case OSSP_DSP_GET_CHANNELS: + return hw_format.channels; + + case OSSP_DSP_GET_FORMAT: { + v = fmt_alsa_to_oss(hw_format.format); + break; + } + + case OSSP_DSP_GET_BLKSIZE: { + snd_pcm_uframes_t psize; + snd_pcm_hw_params_get_period_size(hw_params, &psize, NULL); + v = psize; + break; + } + + case OSSP_DSP_GET_FORMATS: + v = AFMT_U8 | AFMT_A_LAW | AFMT_MU_LAW | AFMT_S16_LE | + AFMT_S16_BE | AFMT_FLOAT | AFMT_S32_LE | AFMT_S32_BE; + break; + + case OSSP_DSP_GET_TRIGGER: + if (!stream_corked[PLAY]) + v |= PCM_ENABLE_OUTPUT; + if (!stream_corked[REC]) + v |= PCM_ENABLE_INPUT; + break; + + default: + assert(0); + } + + *(int *)rarg = v; + + return 0; +} + +static ssize_t alsap_set_param(enum ossp_opcode opcode, + void *carg, void *din, size_t din_sz, + void *rarg, void *dout, size_t *dout_szp, + int tfd) +{ + int v = *(int *)carg; + int ret = 0; + + /* kill the streams before changing parameters */ + kill_streams(); + + switch (opcode) { + case OSSP_DSP_SET_RATE: { + hw_format.rate = v; + break; + } + + case OSSP_DSP_SET_CHANNELS: { + hw_format.channels = v; + break; + } + + case OSSP_DSP_SET_FORMAT: { + snd_pcm_format_t format = fmt_oss_to_alsa(v); + hw_format.format = format; + break; + } + + case OSSP_DSP_SET_SUBDIVISION: + if (!v) + v = 1; +#if 0 + if (!v) { + v = user_subdivision ?: 1; + break; + } + user_frag_size = 0; + user_subdivision = v; + break; + + case OSSP_DSP_SET_FRAGMENT: + user_subdivision = 0; + user_frag_size = 1 << (v & 0xffff); + user_max_frags = (v >> 16) & 0xffff; + if (user_frag_size < 4) + user_frag_size = 4; + if (user_max_frags < 2) + user_max_frags = 2; +#else + case OSSP_DSP_SET_FRAGMENT: +#endif + break; + default: + assert(0); + } + + if (pcm[PLAY]) + ret = set_hw_params(pcm[PLAY]); + if (ret >= 0 && pcm[REC]) + ret = set_hw_params(pcm[REC]); + + if (rarg) + *(int *)rarg = v; + return 0; +} + +static ssize_t alsap_set_trigger(enum ossp_opcode opcode, + void *carg, void *din, size_t din_sz, + void *rarg, void *dout, size_t *dout_szp, + int fd) +{ + int enable = *(int *)carg; + + stream_corked[PLAY] = !!(enable & PCM_ENABLE_OUTPUT); + stream_corked[REC] = !!(enable & PCM_ENABLE_INPUT); + + return trigger_streams(enable & PCM_ENABLE_OUTPUT, + enable & PCM_ENABLE_INPUT); +} + +static ssize_t alsap_get_space(enum ossp_opcode opcode, + void *carg, void *din, size_t din_sz, + void *rarg, void *dout, size_t *dout_szp, int tfd) +{ + int dir = (opcode == OSSP_DSP_GET_OSPACE) ? PLAY : REC; + int underrun = 0; + struct audio_buf_info info = { }; + unsigned long bufsize; + snd_pcm_uframes_t avail, fragsize; + snd_pcm_state_t state; + + if (!pcm[dir]) + return -EINVAL; + + state = snd_pcm_state(pcm[dir]); + if (state == SND_PCM_STATE_XRUN) { + snd_pcm_recover(pcm[dir], -EPIPE, 0); + underrun = 1; + } else if (state == SND_PCM_STATE_SUSPENDED) { + snd_pcm_recover(pcm[dir], -ESTRPIPE, 0); + underrun = 1; + } + + snd_pcm_hw_params_current(pcm[dir], hw_params); + snd_pcm_hw_params_get_period_size(hw_params, &fragsize, NULL); + snd_pcm_hw_params_get_buffer_size(hw_params, &bufsize); + info.fragsize = snd_pcm_frames_to_bytes(pcm[dir], fragsize); + info.fragstotal = bufsize / fragsize; + if (!underrun) { + avail = snd_pcm_avail_update(pcm[dir]); + info.fragments = avail / fragsize; + } else + info.fragments = info.fragstotal; + + info.bytes = info.fragsize * info.fragments; + + *(struct audio_buf_info *)rarg = info; + return 0; +} + +static ssize_t alsap_get_ptr(enum ossp_opcode opcode, + void *carg, void *din, size_t din_sz, + void *rarg, void *dout, size_t *dout_szp, int tfd) +{ + int dir = (opcode == OSSP_DSP_GET_OPTR) ? PLAY : REC; + struct count_info info = { }; + + if (!pcm[dir]) + return -EIO; + + snd_pcm_hw_params_current(pcm[dir], hw_params); + info.bytes = byte_counter[dir]; + snd_pcm_hw_params_get_periods(hw_params, (unsigned int *)&info.blocks, NULL); + info.ptr = mmap_pos[dir]; + + *(struct count_info *)rarg = info; + return 0; +} + +static ssize_t alsap_get_odelay(enum ossp_opcode opcode, + void *carg, void *din, size_t din_sz, + void *rarg, void *dout, size_t *dout_szp, + int fd) +{ + snd_pcm_sframes_t delay; + + if (!pcm[PLAY]) + return -EIO; + + if (snd_pcm_delay(pcm[PLAY], &delay) < 0) + return -EIO; + + *(int *)rarg = snd_pcm_frames_to_bytes(pcm[PLAY], delay); + return 0; +} + +static ossp_action_fn_t action_fn_tbl[OSSP_NR_OPCODES] = { + [OSSP_MIXER] = alsap_mixer, + [OSSP_DSP_OPEN] = alsap_open, + [OSSP_DSP_READ] = alsap_read, + [OSSP_DSP_WRITE] = alsap_write, + [OSSP_DSP_POLL] = alsap_poll, +#if 0 + [OSSP_DSP_MMAP] = alsap_mmap, + [OSSP_DSP_MUNMAP] = alsap_munmap, +#endif + [OSSP_DSP_RESET] = alsap_flush, + [OSSP_DSP_SYNC] = alsap_flush, + [OSSP_DSP_POST] = alsap_post, + [OSSP_DSP_GET_RATE] = alsap_get_param, + [OSSP_DSP_GET_CHANNELS] = alsap_get_param, + [OSSP_DSP_GET_FORMAT] = alsap_get_param, + [OSSP_DSP_GET_BLKSIZE] = alsap_get_param, + [OSSP_DSP_GET_FORMATS] = alsap_get_param, + [OSSP_DSP_SET_RATE] = alsap_set_param, + [OSSP_DSP_SET_CHANNELS] = alsap_set_param, + [OSSP_DSP_SET_FORMAT] = alsap_set_param, + [OSSP_DSP_SET_SUBDIVISION] = alsap_set_param, + [OSSP_DSP_SET_FRAGMENT] = alsap_set_param, + [OSSP_DSP_GET_TRIGGER] = alsap_get_param, + [OSSP_DSP_SET_TRIGGER] = alsap_set_trigger, + [OSSP_DSP_GET_OSPACE] = alsap_get_space, + [OSSP_DSP_GET_ISPACE] = alsap_get_space, + [OSSP_DSP_GET_OPTR] = alsap_get_ptr, + [OSSP_DSP_GET_IPTR] = alsap_get_ptr, + [OSSP_DSP_GET_ODELAY] = alsap_get_odelay, +}; + +static int action_pre(void) +{ + return 0; +} + +static void action_post(void) +{ +} + +int main(int argc, char **argv) +{ + int rc; + + ossp_slave_init(argc, argv); + + page_size = sysconf(_SC_PAGE_SIZE); + + /* Okay, now we're open for business */ + rc = 0; + do { + rc = ossp_slave_process_command(ossp_cmd_fd, action_fn_tbl, + action_pre, action_post); + } while (rc > 0); + + return rc ? 1 : 0; +} diff --git a/src/mod/endpoints/mod_skypopen/osscuse/ossp-slave.c b/src/mod/endpoints/mod_skypopen/osscuse/ossp-slave.c new file mode 100644 index 0000000..4c5cb2d --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/osscuse/ossp-slave.c @@ -0,0 +1,250 @@ +/* + * ossp-slave - OSS Proxy: Common codes for slaves + * + * Copyright (C) 2008-2010 SUSE Linux Products GmbH + * Copyright (C) 2008-2010 Tejun Heo <tj@kernel.org> + * + * This file is released under the GPLv2. + */ + +#define _GNU_SOURCE + +#include <sys/types.h> +#include <sys/mman.h> +#include <sys/socket.h> +#include <sys/uio.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <pwd.h> +#include <signal.h> + +#include "ossp-slave.h" + +static const char *usage = +"usage: ossp-SLAVE [options]\n" +"\n" +"proxies commands from osspd to pulseaudio\n" +"\n" +"options:\n" +" -u UID uid to use\n" +" -g GID gid to use\n" +" -c CMD_FD fd to receive commands from osspd\n" +" -n NOTIFY_FD fd to send async notifications to osspd\n" +" -m MMAP_FD fd to use for mmap\n" +" -o MMAP_OFFSET mmap offset\n" +" -s MMAP_SIZE mmap size\n" +" -l LOG_LEVEL set log level\n" +" -t enable log timestamps\n"; + +char ossp_user_name[OSSP_USER_NAME_LEN]; +int ossp_cmd_fd = -1, ossp_notify_fd = -1; +void *ossp_mmap_addr[2]; + +void ossp_slave_init(int argc, char **argv) +{ + int have_uid = 0, have_gid = 0; + uid_t uid; + gid_t gid; + int mmap_fd = -1; + off_t mmap_off = 0; + size_t mmap_size = 0; + int opt; + struct passwd *pw, pw_buf; + struct sigaction sa; + char pw_sbuf[sysconf(_SC_GETPW_R_SIZE_MAX)]; + + while ((opt = getopt(argc, argv, "u:g:c:n:m:o:s:l:t")) != -1) { + switch (opt) { + case 'u': + have_uid = 1; + uid = strtol(optarg, NULL, 0); + break; + case 'g': + have_gid = 1; + gid = strtol(optarg, NULL, 0); + break; + case 'c': + ossp_cmd_fd = strtol(optarg, NULL, 0); + break; + case 'n': + ossp_notify_fd = strtol(optarg, NULL, 0); + break; + case 'm': + mmap_fd = strtol(optarg, NULL, 0); + break; + case 'o': + mmap_off = strtoull(optarg, NULL, 0); + break; + case 's': + mmap_size = strtoul(optarg, NULL, 0); + break; + case 'l': + ossp_log_level = strtol(optarg, NULL, 0); + break; + case 't': + ossp_log_timestamp = 1; + break; + } + } + + if (!have_uid || !have_gid || ossp_cmd_fd < 0 || ossp_notify_fd < 0) { + fprintf(stderr, usage); + _exit(1); + } + + snprintf(ossp_user_name, sizeof(ossp_user_name), "uid%d", uid); + if (getpwuid_r(uid, &pw_buf, pw_sbuf, sizeof(pw_sbuf), &pw) == 0) + snprintf(ossp_user_name, sizeof(ossp_user_name), "%s", + pw->pw_name); + + snprintf(ossp_log_name, sizeof(ossp_log_name), "ossp-padsp[%s:%d]", + ossp_user_name, getpid()); + + if (mmap_fd >= 0) { + void *p; + + if (!mmap_off || !mmap_size) { + fprintf(stderr, usage); + _exit(1); + } + + p = mmap(NULL, mmap_size, PROT_READ | PROT_WRITE, MAP_SHARED, + mmap_fd, mmap_off); + if (p == MAP_FAILED) + fatal_e(-errno, "mmap failed"); + + ossp_mmap_addr[PLAY] = p; + ossp_mmap_addr[REC] = p + mmap_size / 2; + close(mmap_fd); + } + + /* mmap done, drop privileges */ + if (setresgid(gid, gid, gid) || setresuid(uid, uid, uid)) + fatal_e(-errno, "failed to drop privileges"); + + /* block SIGPIPE */ + memset(&sa, 0, sizeof(sa)); + sa.sa_handler = SIG_IGN; + if (sigaction(SIGPIPE, &sa, NULL)) + fatal_e(-errno, "failed to ignore SIGPIPE"); +} + +int ossp_slave_process_command(int cmd_fd, + ossp_action_fn_t const *action_fn_tbl, + int (*action_pre_fn)(void), + void (*action_post_fn)(void)) +{ + static struct sized_buf carg_sbuf = { }, rarg_sbuf = { }; + static struct sized_buf din_sbuf = { }, dout_sbuf = { }; + struct ossp_cmd cmd; + int fd = -1; + char cmsg_buf[CMSG_SPACE(sizeof(fd))]; + struct iovec iov = { &cmd, sizeof(cmd) }; + struct msghdr msg = { .msg_iov = &iov, .msg_iovlen = 1, + .msg_control = cmsg_buf, + .msg_controllen = sizeof(cmsg_buf) }; + struct cmsghdr *cmsg; + size_t carg_size, din_size, rarg_size, dout_size; + char *carg = NULL, *din = NULL, *rarg = NULL, *dout = NULL; + struct ossp_reply reply = { .magic = OSSP_REPLY_MAGIC }; + ssize_t ret; + + ret = recvmsg(cmd_fd, &msg, 0); + if (ret == 0) + return 0; + if (ret < 0) { + ret = -errno; + err_e(ret, "failed to read command channel"); + return ret; + } + + if (ret != sizeof(cmd)) { + err("command struct size mismatch (%zu, should be %zu)", + ret, sizeof(cmd)); + return -EINVAL; + } + + if (cmd.magic != OSSP_CMD_MAGIC) { + err("illegal command magic 0x%x", cmd.magic); + return -EINVAL; + } + + for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; + cmsg = CMSG_NXTHDR(&msg, cmsg)) { + if (cmsg->cmsg_level == SOL_SOCKET && + cmsg->cmsg_type == SCM_RIGHTS) + fd = *(int *)CMSG_DATA(cmsg); + else { + err("unknown cmsg %d:%d received (opcode %d)", + cmsg->cmsg_level, cmsg->cmsg_type, cmd.opcode); + return -EINVAL; + } + } + + if (cmd.opcode >= OSSP_NR_OPCODES) { + err("unknown opcode %d", cmd.opcode); + return -EINVAL; + } + + carg_size = ossp_arg_sizes[cmd.opcode].carg_size; + din_size = cmd.din_size; + rarg_size = ossp_arg_sizes[cmd.opcode].rarg_size; + dout_size = cmd.dout_size; + + if ((fd >= 0) != ossp_arg_sizes[cmd.opcode].has_fd) { + err("fd=%d unexpected for opcode %d", fd, cmd.opcode); + return -EINVAL; + } + + if (ensure_sbuf_size(&carg_sbuf, carg_size) || + ensure_sbuf_size(&din_sbuf, din_size) || + ensure_sbuf_size(&rarg_sbuf, rarg_size) || + ensure_sbuf_size(&dout_sbuf, dout_size)) { + err("failed to allocate command buffers"); + return -ENOMEM; + } + + if (carg_size) { + carg = carg_sbuf.buf; + ret = read_fill(cmd_fd, carg, carg_size); + if (ret < 0) + return ret; + } + if (din_size) { + din = din_sbuf.buf; + ret = read_fill(cmd_fd, din, din_size); + if (ret < 0) + return ret; + } + if (rarg_size) + rarg = rarg_sbuf.buf; + if (dout_size) + dout = dout_sbuf.buf; + + ret = -EINVAL; + if (action_fn_tbl[cmd.opcode]) { + ret = action_pre_fn(); + if (ret == 0) { + ret = action_fn_tbl[cmd.opcode](cmd.opcode, carg, + din, din_size, rarg, + dout, &dout_size, fd); + action_post_fn(); + } + } + + reply.result = ret; + if (ret >= 0) + reply.dout_size = dout_size; + else { + rarg_size = 0; + dout_size = 0; + } + + if (write_fill(cmd_fd, &reply, sizeof(reply)) < 0 || + write_fill(cmd_fd, rarg, rarg_size) < 0 || + write_fill(cmd_fd, dout, dout_size) < 0) + return -EIO; + + return 1; +} diff --git a/src/mod/endpoints/mod_skypopen/osscuse/ossp-slave.h b/src/mod/endpoints/mod_skypopen/osscuse/ossp-slave.h new file mode 100644 index 0000000..10c22cd --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/osscuse/ossp-slave.h @@ -0,0 +1,28 @@ +/* + * ossp-slave - OSS Proxy: Common codes for slaves + * + * Copyright (C) 2008-2010 SUSE Linux Products GmbH + * Copyright (C) 2008-2010 Tejun Heo <tj@kernel.org> + * + * This file is released under the GPLv2. + */ + +#ifndef _OSSP_SLAVE_H +#define _OSSP_SLAVE_H + +#include "ossp.h" +#include "ossp-util.h" + +#define OSSP_USER_NAME_LEN 128 + +extern char ossp_user_name[OSSP_USER_NAME_LEN]; +extern int ossp_cmd_fd, ossp_notify_fd; +extern void *ossp_mmap_addr[2]; + +void ossp_slave_init(int argc, char **argv); +int ossp_slave_process_command(int cmd_fd, + ossp_action_fn_t const *action_fn_tbl, + int (*action_pre_fn)(void), + void (*action_post_fn)(void)); + +#endif /* _OSSP_SLAVE_H */ diff --git a/src/mod/endpoints/mod_skypopen/osscuse/ossp-util.c b/src/mod/endpoints/mod_skypopen/osscuse/ossp-util.c new file mode 100644 index 0000000..325cefd --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/osscuse/ossp-util.c @@ -0,0 +1,369 @@ +/* + * ossp-util - OSS Proxy: Common utilities + * + * Copyright (C) 2008-2010 SUSE Linux Products GmbH + * Copyright (C) 2008-2010 Tejun Heo <tj@kernel.org> + * + * This file is released under the GPLv2. + */ + +#include <ctype.h> +#include <fcntl.h> +#include <inttypes.h> +#include <limits.h> +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/time.h> +#include <syslog.h> +#include <unistd.h> +#include "ossp-util.h" + +#define BIT(nr) (1UL << (nr)) +#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) +#define BIT_WORD(nr) ((nr) / BITS_PER_LONG) +#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) +#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG) + +char ossp_log_name[OSSP_LOG_NAME_LEN]; +int ossp_log_level = OSSP_LOG_DFL; +int ossp_log_timestamp; + +static const char *severity_strs[] = { + [OSSP_LOG_CRIT] = "CRIT", + [OSSP_LOG_ERR] = " ERR", + [OSSP_LOG_WARN] = "WARN", + [OSSP_LOG_INFO] = NULL, + [OSSP_LOG_DBG0] = "DBG0", + [OSSP_LOG_DBG1] = "DBG1", +}; + +static int severity_map[] = { + [OSSP_LOG_CRIT] = LOG_ERR, + [OSSP_LOG_ERR] = LOG_ERR, + [OSSP_LOG_WARN] = LOG_WARNING, + [OSSP_LOG_INFO] = LOG_INFO, + [OSSP_LOG_DBG0] = LOG_DEBUG, + [OSSP_LOG_DBG1] = LOG_DEBUG, +}; + +void log_msg(int severity, const char *fmt, ...) +{ + static int syslog_opened = 0; + char buf[1024]; + size_t len = sizeof(buf), off = 0; + va_list ap; + + if (severity > abs(ossp_log_level)) + return; + + if (ossp_log_level < 0 && !syslog_opened) + openlog(ossp_log_name, 0, LOG_DAEMON); + + assert(severity >= 0 && severity < ARRAY_SIZE(severity_strs)); + + if (ossp_log_timestamp) { + static uint64_t start; + uint64_t now; + struct timeval tv; + gettimeofday(&tv, NULL); + now = tv.tv_sec * 1000 + tv.tv_usec / 1000; + if (!start) + start = now; + + off += snprintf(buf + off, len - off, "<%08"PRIu64"> ", + now - start); + } + + if (ossp_log_level > 0) { + char sev_buf[16] = ""; + if (severity_strs[severity]) + snprintf(sev_buf, sizeof(sev_buf), " %s", + severity_strs[severity]); + off += snprintf(buf + off, len - off, "%s%s: ", + ossp_log_name, sev_buf); + } else if (severity_strs[severity]) + off += snprintf(buf + off, len - off, "%s ", + severity_strs[severity]); + + va_start(ap, fmt); + off += vsnprintf(buf + off, len - off, fmt, ap); + va_end(ap); + + off += snprintf(buf + off, len - off, "\n"); + + if (ossp_log_level > 0) + fputs(buf, stderr); + else + syslog(severity_map[severity], "%s", buf); +} + +int read_fill(int fd, void *buf, size_t size) +{ + while (size) { + ssize_t ret; + int rc; + + ret = read(fd, buf, size); + if (ret <= 0) { + if (ret == 0) + rc = -EIO; + else + rc = -errno; + err_e(rc, "failed to read_fill %zu bytes from fd %d", + size, fd); + return rc; + } + buf += ret; + size -= ret; + } + return 0; +} + +int write_fill(int fd, const void *buf, size_t size) +{ + while (size) { + ssize_t ret; + int rc; + + ret = write(fd, buf, size); + if (ret <= 0) { + if (ret == 0) + rc = -EIO; + else + rc = -errno; + err_e(rc, "failed to write_fill %zu bytes to fd %d", + size, fd); + return rc; + } + buf += ret; + size -= ret; + } + return 0; +} + +void ring_fill(struct ring_buf *ring, const void *buf, size_t size) +{ + size_t tail; + + assert(ring_space(ring) >= size); + + tail = (ring->head + ring->size - ring->bytes) % ring->size; + + if (ring->head >= tail) { + size_t todo = min(size, ring->size - ring->head); + + memcpy(ring->buf + ring->head, buf, todo); + ring->head = (ring->head + todo) % ring->size; + ring->bytes += todo; + buf += todo; + size -= todo; + } + + assert(ring->size - ring->head >= size); + memcpy(ring->buf + ring->head, buf, size); + ring->head += size; + ring->bytes += size; +} + +void *ring_data(struct ring_buf *ring, size_t *sizep) +{ + size_t tail; + + if (!ring->bytes) + return NULL; + + tail = (ring->head + ring->size - ring->bytes) % ring->size; + + *sizep = min(ring->bytes, ring->size - tail); + return ring->buf + tail; +} + +int ring_resize(struct ring_buf *ring, size_t new_size) +{ + struct ring_buf new_ring = { .size = new_size }; + void *p; + size_t size; + + if (ring_bytes(ring) > new_size) + return -ENOSPC; + + new_ring.buf = calloc(1, new_size); + if (new_size && !new_ring.buf) + return -ENOMEM; + + while ((p = ring_data(ring, &size))) { + ring_fill(&new_ring, p, size); + ring_consume(ring, size); + } + + free(ring->buf); + *ring = new_ring; + return 0; +} + +int ensure_sbuf_size(struct sized_buf *sbuf, size_t size) +{ + char *new_buf; + + if (sbuf->size >= size) + return 0; + + new_buf = realloc(sbuf->buf, size); + if (size && !new_buf) + return -ENOMEM; + + sbuf->buf = new_buf; + sbuf->size = size; + return 0; +} + +static unsigned long __ffs(unsigned long word) +{ + int num = 0; + + if (BITS_PER_LONG == 64) { + if ((word & 0xffffffff) == 0) { + num += 32; + word >>= 32; + } + } + + if ((word & 0xffff) == 0) { + num += 16; + word >>= 16; + } + if ((word & 0xff) == 0) { + num += 8; + word >>= 8; + } + if ((word & 0xf) == 0) { + num += 4; + word >>= 4; + } + if ((word & 0x3) == 0) { + num += 2; + word >>= 2; + } + if ((word & 0x1) == 0) + num += 1; + return num; +} + +#define ffz(x) __ffs(~(x)) + +unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size, + unsigned long offset) +{ + const unsigned long *p = addr + BITOP_WORD(offset); + unsigned long result = offset & ~(BITS_PER_LONG-1); + unsigned long tmp; + + if (offset >= size) + return size; + size -= result; + offset %= BITS_PER_LONG; + if (offset) { + tmp = *(p++); + tmp |= ~0UL >> (BITS_PER_LONG - offset); + if (size < BITS_PER_LONG) + goto found_first; + if (~tmp) + goto found_middle; + size -= BITS_PER_LONG; + result += BITS_PER_LONG; + } + while (size & ~(BITS_PER_LONG-1)) { + if (~(tmp = *(p++))) + goto found_middle; + result += BITS_PER_LONG; + size -= BITS_PER_LONG; + } + if (!size) + return result; + tmp = *p; + +found_first: + tmp |= ~0UL << size; + if (tmp == ~0UL) /* Are any bits zero? */ + return result + size; /* Nope. */ +found_middle: + return result + ffz(tmp); +} + +void __set_bit(int nr, volatile unsigned long *addr) +{ + unsigned long mask = BIT_MASK(nr); + unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr); + + *p |= mask; +} + +void __clear_bit(int nr, volatile unsigned long *addr) +{ + unsigned long mask = BIT_MASK(nr); + unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr); + + *p &= ~mask; +} + +int get_proc_self_info(pid_t pid, pid_t *ppid_r, + char *cmd_buf, size_t cmd_buf_sz) + +{ + char path[64], buf[4096]; + int fd = -1; + char *cmd_start, *cmd_end, *ppid_start, *end; + ssize_t ret; + pid_t ppid; + int i, rc; + + snprintf(path, sizeof(path), "/proc/%ld/stat", (long)pid); + fd = open(path, O_RDONLY); + if (fd < 0) { + rc = -errno; + goto out; + } + + ret = read(fd, buf, sizeof(buf)); + if (ret < 0) + goto out; + if (ret == sizeof(buf)) { + rc = -EOVERFLOW; + goto out; + } + buf[ret] = '\0'; + + rc = -EINVAL; + cmd_start = strchr(buf, '('); + cmd_end = strrchr(buf, ')'); + if (!cmd_start || !cmd_end) + goto out; + cmd_start++; + + ppid_start = cmd_end; + for (i = 0; i < 3; i++) { + ppid_start = strchr(ppid_start, ' '); + if (!ppid_start) + goto out; + ppid_start++; + } + + ppid = strtoul(ppid_start, &end, 10); + if (end == ppid_start || *end != ' ') + goto out; + + if (ppid_r) + *ppid_r = ppid; + if (cmd_buf) { + size_t len = min_t(size_t, cmd_end - cmd_start, cmd_buf_sz - 1); + memcpy(cmd_buf, cmd_start, len); + cmd_buf[len] = '\0'; + } + + rc = 0; + out: + close(fd); + + return rc; +} diff --git a/src/mod/endpoints/mod_skypopen/osscuse/ossp-util.h b/src/mod/endpoints/mod_skypopen/osscuse/ossp-util.h new file mode 100644 index 0000000..f48d022 --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/osscuse/ossp-util.h @@ -0,0 +1,609 @@ +/* + * ossp-util - OSS Proxy: Common utilities + * + * Copyright (C) 2008-2010 SUSE Linux Products GmbH + * Copyright (C) 2008-2010 Tejun Heo <tj@kernel.org> + * + * This file is released under the GPLv2. + */ + +#ifndef _OSSP_UTIL_H +#define _OSSP_UTIL_H + +#include <assert.h> +#include <stddef.h> +#include <string.h> +#include <sys/types.h> +#include <errno.h> +#include <unistd.h> +#include "ossp.h" + +#define OSSP_LOG_NAME_LEN 128 + +enum { + OSSP_LOG_CRIT = 1, + OSSP_LOG_ERR, + OSSP_LOG_WARN, + OSSP_LOG_INFO, + OSSP_LOG_DFL = OSSP_LOG_INFO, /* default log level */ + OSSP_LOG_DBG0, + OSSP_LOG_DBG1, + OSSP_LOG_MAX = OSSP_LOG_DBG1, +}; + +extern char ossp_log_name[OSSP_LOG_NAME_LEN]; +extern int ossp_log_level; +extern int ossp_log_timestamp; + +#define BITS_PER_BYTE 8 +#define BITS_PER_LONG (BITS_PER_BYTE * sizeof(long)) +#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) +#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) + +/* ARRAY_SIZE and min/max macros stolen from linux/kernel.h */ +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) + +#define min(x, y) ({ \ + typeof(x) _min1 = (x); \ + typeof(y) _min2 = (y); \ + (void) (&_min1 == &_min2); \ + _min1 < _min2 ? _min1 : _min2; }) + +#define max(x, y) ({ \ + typeof(x) _max1 = (x); \ + typeof(y) _max2 = (y); \ + (void) (&_max1 == &_max2); \ + _max1 > _max2 ? _max1 : _max2; }) + +#define min_t(type, x, y) ({ \ + type __min1 = (x); \ + type __min2 = (y); \ + __min1 < __min2 ? __min1: __min2; }) + +#define max_t(type, x, y) ({ \ + type __max1 = (x); \ + type __max2 = (y); \ + __max1 > __max2 ? __max1: __max2; }) + +void log_msg(int severity, const char *fmt, ...) + __attribute__ ((format (printf, 2, 3))); + +#define fatal(fmt, args...) do { \ + log_msg(OSSP_LOG_CRIT, fmt , ##args); \ + _exit(1); \ +} while (0) +#define err(fmt, args...) log_msg(OSSP_LOG_ERR, fmt , ##args) +#define warn(fmt, args...) log_msg(OSSP_LOG_WARN, fmt , ##args) +#define info(fmt, args...) log_msg(OSSP_LOG_INFO, fmt , ##args) +#define dbg0(fmt, args...) log_msg(OSSP_LOG_DBG0, fmt , ##args) +#define dbg1(fmt, args...) log_msg(OSSP_LOG_DBG1, fmt , ##args) + +#define fatal_e(e, fmt, args...) \ + fatal(fmt" (%s)" , ##args, strerror(-(e))) +#define err_e(e, fmt, args...) \ + err(fmt" (%s)" , ##args, strerror(-(e))) +#define warn_e(e, fmt, args...) \ + warn(fmt" (%s)" , ##args, strerror(-(e))) +#define info_e(e, fmt, args...) \ + info(fmt" (%s)" , ##args, strerror(-(e))) +#define dbg0_e(e, fmt, args...) \ + dbg0(fmt" (%s)" , ##args, strerror(-(e))) +#define dbg1_e(e, fmt, args...) \ + dbg1(fmt" (%s)" , ##args, strerror(-(e))) + +struct ring_buf { + char *buf; + size_t size; + size_t head; + size_t bytes; +}; + +static inline size_t ring_size(struct ring_buf *ring) +{ + return ring->size; +} + +static inline size_t ring_bytes(struct ring_buf *ring) +{ + return ring->bytes; +} + +static inline size_t ring_space(struct ring_buf *ring) +{ + return ring->size - ring->bytes; +} + +static inline void ring_consume(struct ring_buf *ring, size_t size) +{ + assert(ring->bytes >= size); + ring->bytes -= size; +} + +static inline void ring_manual_init(struct ring_buf *ring, void *buf, + size_t size, size_t head, size_t bytes) +{ + ring->buf = buf; + ring->size = size; + ring->head = head; + ring->bytes = bytes; +} + +void ring_fill(struct ring_buf *ring, const void *buf, size_t size); +void *ring_data(struct ring_buf *ring, size_t *sizep); +int ring_resize(struct ring_buf *ring, size_t new_size); + +struct sized_buf { + char *buf; + size_t size; +}; + +int ensure_sbuf_size(struct sized_buf *sbuf, size_t size); + +int read_fill(int fd, void *buf, size_t size); +int write_fill(int fd, const void *buf, size_t size); + +/* + * Bitops lifted from linux asm-generic implementation. + */ +unsigned long find_next_zero_bit(const unsigned long *addr, unsigned + long size, unsigned long offset); +#define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0) +extern void __set_bit(int nr, volatile unsigned long *addr); +extern void __clear_bit(int nr, volatile unsigned long *addr); + +typedef ssize_t (*ossp_action_fn_t)(enum ossp_opcode opcode, + void *carg, void *din, size_t din_sz, + void *rarg, void *dout, size_t *dout_szp, + int fd); + +int get_proc_self_info(pid_t tid, pid_t *pgrp, + char *cmd_buf, size_t cmd_buf_sz); + +/* + * Doubly linked list handling code shamelessly stolen from the Linux + * kernel 2.6.26 include/linux/list.h. + */ + +/** + * container_of - cast a member of a structure out to the containing structure + * @ptr: the pointer to the member. + * @type: the type of the container struct this is embedded in. + * @member: the name of the member within the struct. + * + */ +#define container_of(ptr, type, member) ({ \ + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (char *)__mptr - offsetof(type,member) );}) + +#define LIST_POISON1 ((void *) 0x00100100) +#define LIST_POISON2 ((void *) 0x00200200) + +/* + * Simple doubly linked list implementation. + * + * Some of the internal functions ("__xxx") are useful when + * manipulating whole lists rather than single entries, as + * sometimes we already know the next/prev entries and we can + * generate better code by using them directly rather than + * using the generic single-entry routines. + */ + +struct list_head { + struct list_head *next, *prev; +}; + +#define LIST_HEAD_INIT(name) { &(name), &(name) } + +#define LIST_HEAD(name) \ + struct list_head name = LIST_HEAD_INIT(name) + +static inline void INIT_LIST_HEAD(struct list_head *list) +{ + list->next = list; + list->prev = list; +} + +/* + * Insert a new entry between two known consecutive entries. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static inline void __list_add(struct list_head *new, + struct list_head *prev, + struct list_head *next) +{ + next->prev = new; + new->next = next; + new->prev = prev; + prev->next = new; +} + +/** + * list_add - add a new entry + * @new: new entry to be added + * @head: list head to add it after + * + * Insert a new entry after the specified head. + * This is good for implementing stacks. + */ +static inline void list_add(struct list_head *new, struct list_head *head) +{ + __list_add(new, head, head->next); +} + +/** + * list_add_tail - add a new entry + * @new: new entry to be added + * @head: list head to add it before + * + * Insert a new entry before the specified head. + * This is useful for implementing queues. + */ +static inline void list_add_tail(struct list_head *new, struct list_head *head) +{ + __list_add(new, head->prev, head); +} + +/* + * Delete a list entry by making the prev/next entries + * point to each other. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static inline void __list_del(struct list_head * prev, struct list_head * next) +{ + next->prev = prev; + prev->next = next; +} + +/** + * list_del - deletes entry from list. + * @entry: the element to delete from the list. + * Note: list_empty() on entry does not return true after this, the entry is + * in an undefined state. + */ +static inline void list_del(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); + entry->next = LIST_POISON1; + entry->prev = LIST_POISON2; +} + +/** + * list_replace - replace old entry by new one + * @old : the element to be replaced + * @new : the new element to insert + * + * If @old was empty, it will be overwritten. + */ +static inline void list_replace(struct list_head *old, + struct list_head *new) +{ + new->next = old->next; + new->next->prev = new; + new->prev = old->prev; + new->prev->next = new; +} + +static inline void list_replace_init(struct list_head *old, + struct list_head *new) +{ + list_replace(old, new); + INIT_LIST_HEAD(old); +} + +/** + * list_del_init - deletes entry from list and reinitialize it. + * @entry: the element to delete from the list. + */ +static inline void list_del_init(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); + INIT_LIST_HEAD(entry); +} + +/** + * list_move - delete from one list and add as another's head + * @list: the entry to move + * @head: the head that will precede our entry + */ +static inline void list_move(struct list_head *list, struct list_head *head) +{ + __list_del(list->prev, list->next); + list_add(list, head); +} + +/** + * list_move_tail - delete from one list and add as another's tail + * @list: the entry to move + * @head: the head that will follow our entry + */ +static inline void list_move_tail(struct list_head *list, + struct list_head *head) +{ + __list_del(list->prev, list->next); + list_add_tail(list, head); +} + +/** + * list_is_last - tests whether @list is the last entry in list @head + * @list: the entry to test + * @head: the head of the list + */ +static inline int list_is_last(const struct list_head *list, + const struct list_head *head) +{ + return list->next == head; +} + +/** + * list_empty - tests whether a list is empty + * @head: the list to test. + */ +static inline int list_empty(const struct list_head *head) +{ + return head->next == head; +} + +/** + * list_empty_careful - tests whether a list is empty and not being modified + * @head: the list to test + * + * Description: + * tests whether a list is empty _and_ checks that no other CPU might be + * in the process of modifying either member (next or prev) + * + * NOTE: using list_empty_careful() without synchronization + * can only be safe if the only activity that can happen + * to the list entry is list_del_init(). Eg. it cannot be used + * if another CPU could re-list_add() it. + */ +static inline int list_empty_careful(const struct list_head *head) +{ + struct list_head *next = head->next; + return (next == head) && (next == head->prev); +} + +/** + * list_is_singular - tests whether a list has just one entry. + * @head: the list to test. + */ +static inline int list_is_singular(const struct list_head *head) +{ + return !list_empty(head) && (head->next == head->prev); +} + +static inline void __list_splice(const struct list_head *list, + struct list_head *head) +{ + struct list_head *first = list->next; + struct list_head *last = list->prev; + struct list_head *at = head->next; + + first->prev = head; + head->next = first; + + last->next = at; + at->prev = last; +} + +/** + * list_splice - join two lists + * @list: the new list to add. + * @head: the place to add it in the first list. + */ +static inline void list_splice(const struct list_head *list, + struct list_head *head) +{ + if (!list_empty(list)) + __list_splice(list, head); +} + +/** + * list_splice_init - join two lists and reinitialise the emptied list. + * @list: the new list to add. + * @head: the place to add it in the first list. + * + * The list at @list is reinitialised + */ +static inline void list_splice_init(struct list_head *list, + struct list_head *head) +{ + if (!list_empty(list)) { + __list_splice(list, head); + INIT_LIST_HEAD(list); + } +} + +/** + * list_entry - get the struct for this entry + * @ptr: the &struct list_head pointer. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_struct within the struct. + */ +#define list_entry(ptr, type, member) \ + container_of(ptr, type, member) + +/** + * list_first_entry - get the first element from a list + * @ptr: the list head to take the element from. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_struct within the struct. + * + * Note, that list is expected to be not empty. + */ +#define list_first_entry(ptr, type, member) \ + list_entry((ptr)->next, type, member) + +/** + * list_for_each - iterate over a list + * @pos: the &struct list_head to use as a loop cursor. + * @head: the head for your list. + */ +#define list_for_each(pos, head) \ + for (pos = (head)->next; pos != (head); pos = pos->next) + +/** + * list_for_each_prev - iterate over a list backwards + * @pos: the &struct list_head to use as a loop cursor. + * @head: the head for your list. + */ +#define list_for_each_prev(pos, head) \ + for (pos = (head)->prev; pos != (head); pos = pos->prev) + +/** + * list_for_each_safe - iterate over a list safe against removal of list entry + * @pos: the &struct list_head to use as a loop cursor. + * @n: another &struct list_head to use as temporary storage + * @head: the head for your list. + */ +#define list_for_each_safe(pos, n, head) \ + for (pos = (head)->next, n = pos->next; pos != (head); \ + pos = n, n = pos->next) + +/** + * list_for_each_prev_safe - iterate over a list backwards safe against removal of list entry + * @pos: the &struct list_head to use as a loop cursor. + * @n: another &struct list_head to use as temporary storage + * @head: the head for your list. + */ +#define list_for_each_prev_safe(pos, n, head) \ + for (pos = (head)->prev, n = pos->prev; \ + pos != (head); pos = n, n = pos->prev) + +/** + * list_for_each_entry - iterate over list of given type + * @pos: the type * to use as a loop cursor. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry(pos, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = list_entry(pos->member.next, typeof(*pos), member)) + +/** + * list_for_each_entry_reverse - iterate backwards over list of given type. + * @pos: the type * to use as a loop cursor. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry_reverse(pos, head, member) \ + for (pos = list_entry((head)->prev, typeof(*pos), member); \ + &pos->member != (head); \ + pos = list_entry(pos->member.prev, typeof(*pos), member)) + +/** + * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue() + * @pos: the type * to use as a start point + * @head: the head of the list + * @member: the name of the list_struct within the struct. + * + * Prepares a pos entry for use as a start point in list_for_each_entry_continue(). + */ +#define list_prepare_entry(pos, head, member) \ + ((pos) ? : list_entry(head, typeof(*pos), member)) + +/** + * list_for_each_entry_continue - continue iteration over list of given type + * @pos: the type * to use as a loop cursor. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + * + * Continue to iterate over list of given type, continuing after + * the current position. + */ +#define list_for_each_entry_continue(pos, head, member) \ + for (pos = list_entry(pos->member.next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = list_entry(pos->member.next, typeof(*pos), member)) + +/** + * list_for_each_entry_continue_reverse - iterate backwards from the given point + * @pos: the type * to use as a loop cursor. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + * + * Start to iterate over list of given type backwards, continuing after + * the current position. + */ +#define list_for_each_entry_continue_reverse(pos, head, member) \ + for (pos = list_entry(pos->member.prev, typeof(*pos), member); \ + &pos->member != (head); \ + pos = list_entry(pos->member.prev, typeof(*pos), member)) + +/** + * list_for_each_entry_from - iterate over list of given type from the current point + * @pos: the type * to use as a loop cursor. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + * + * Iterate over list of given type, continuing from current position. + */ +#define list_for_each_entry_from(pos, head, member) \ + for (; &pos->member != (head); \ + pos = list_entry(pos->member.next, typeof(*pos), member)) + +/** + * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry + * @pos: the type * to use as a loop cursor. + * @n: another type * to use as temporary storage + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry_safe(pos, n, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member), \ + n = list_entry(pos->member.next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = n, n = list_entry(n->member.next, typeof(*n), member)) + +/** + * list_for_each_entry_safe_continue + * @pos: the type * to use as a loop cursor. + * @n: another type * to use as temporary storage + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + * + * Iterate over list of given type, continuing after current point, + * safe against removal of list entry. + */ +#define list_for_each_entry_safe_continue(pos, n, head, member) \ + for (pos = list_entry(pos->member.next, typeof(*pos), member), \ + n = list_entry(pos->member.next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = n, n = list_entry(n->member.next, typeof(*n), member)) + +/** + * list_for_each_entry_safe_from + * @pos: the type * to use as a loop cursor. + * @n: another type * to use as temporary storage + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + * + * Iterate over list of given type from current point, safe against + * removal of list entry. + */ +#define list_for_each_entry_safe_from(pos, n, head, member) \ + for (n = list_entry(pos->member.next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = n, n = list_entry(n->member.next, typeof(*n), member)) + +/** + * list_for_each_entry_safe_reverse + * @pos: the type * to use as a loop cursor. + * @n: another type * to use as temporary storage + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + * + * Iterate backwards over list of given type, safe against removal + * of list entry. + */ +#define list_for_each_entry_safe_reverse(pos, n, head, member) \ + for (pos = list_entry((head)->prev, typeof(*pos), member), \ + n = list_entry(pos->member.prev, typeof(*pos), member); \ + &pos->member != (head); \ + pos = n, n = list_entry(n->member.prev, typeof(*n), member)) + +#endif /*_OSSP_UTIL_H*/ diff --git a/src/mod/endpoints/mod_skypopen/osscuse/ossp.c b/src/mod/endpoints/mod_skypopen/osscuse/ossp.c new file mode 100644 index 0000000..96f98fa --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/osscuse/ossp.c @@ -0,0 +1,83 @@ +/* + * ossp - OSS Proxy: emulate OSS device using CUSE + * + * Copyright (C) 2008-2010 SUSE Linux Products GmbH + * Copyright (C) 2008-2010 Tejun Heo <tj@kernel.org> + * + * This file is released under the GPLv2. + */ + +#include "ossp.h" + +const struct ossp_arg_size ossp_arg_sizes[OSSP_NR_OPCODES] = { + [OSSP_MIXER] = { sizeof(struct ossp_mixer_arg), + sizeof(struct ossp_mixer_arg), 0 }, + + [OSSP_DSP_OPEN] = { sizeof(struct ossp_dsp_open_arg), 0, 0 }, + [OSSP_DSP_READ] = { sizeof(struct ossp_dsp_rw_arg), 0, 0 }, + [OSSP_DSP_WRITE] = { sizeof(struct ossp_dsp_rw_arg), 0, 0 }, + [OSSP_DSP_POLL] = { sizeof(int), sizeof(unsigned), 0 }, + [OSSP_DSP_MMAP] = { sizeof(struct ossp_dsp_mmap_arg), 0, 0 }, + [OSSP_DSP_MUNMAP] = { sizeof(int), 0, 0 }, + + [OSSP_DSP_RESET] = { 0, 0, 0 }, + [OSSP_DSP_SYNC] = { 0, 0, 0 }, + [OSSP_DSP_POST] = { 0, 0, 0 }, + [OSSP_DSP_GET_RATE] = { 0, sizeof(int), 0 }, + [OSSP_DSP_GET_CHANNELS] = { 0, sizeof(int), 0 }, + [OSSP_DSP_GET_FORMAT] = { 0, sizeof(int), 0 }, + [OSSP_DSP_GET_BLKSIZE] = { 0, sizeof(int), 0 }, + [OSSP_DSP_GET_FORMATS] = { 0, sizeof(int), 0 }, + [OSSP_DSP_SET_RATE] = { sizeof(int), sizeof(int), 0 }, + [OSSP_DSP_SET_CHANNELS] = { sizeof(int), sizeof(int), 0 }, + [OSSP_DSP_SET_FORMAT] = { sizeof(int), sizeof(int), 0 }, + [OSSP_DSP_SET_SUBDIVISION] = { sizeof(int), sizeof(int), 0 }, + [OSSP_DSP_SET_FRAGMENT] = { sizeof(int), 0, 0 }, + [OSSP_DSP_GET_TRIGGER] = { 0, sizeof(int), 0 }, + [OSSP_DSP_SET_TRIGGER] = { sizeof(int), 0, 0 }, + [OSSP_DSP_GET_OSPACE] = { 0, sizeof(struct audio_buf_info), 0 }, + [OSSP_DSP_GET_ISPACE] = { 0, sizeof(struct audio_buf_info), 0 }, + [OSSP_DSP_GET_OPTR] = { 0, sizeof(struct count_info), 0 }, + [OSSP_DSP_GET_IPTR] = { 0, sizeof(struct count_info), 0 }, + [OSSP_DSP_GET_ODELAY] = { 0, sizeof(int), 0 }, +}; + +const char *ossp_cmd_str[OSSP_NR_OPCODES] = { + [OSSP_MIXER] = "MIXER", + + [OSSP_DSP_OPEN] = "OPEN", + [OSSP_DSP_READ] = "READ", + [OSSP_DSP_WRITE] = "WRITE", + [OSSP_DSP_POLL] = "POLL", + [OSSP_DSP_MMAP] = "MMAP", + [OSSP_DSP_MUNMAP] = "MUNMAP", + + [OSSP_DSP_RESET] = "RESET", + [OSSP_DSP_SYNC] = "SYNC", + [OSSP_DSP_POST] = "POST", + + [OSSP_DSP_GET_RATE] = "GET_RATE", + [OSSP_DSP_GET_CHANNELS] = "GET_CHANNELS", + [OSSP_DSP_GET_FORMAT] = "GET_FORMAT", + [OSSP_DSP_GET_BLKSIZE] = "GET_BLKSIZE", + [OSSP_DSP_GET_FORMATS] = "GET_FORMATS", + [OSSP_DSP_SET_RATE] = "SET_RATE", + [OSSP_DSP_SET_CHANNELS] = "SET_CHANNELS", + [OSSP_DSP_SET_FORMAT] = "SET_FORMAT", + [OSSP_DSP_SET_SUBDIVISION] = "SET_BUSDIVISION", + + [OSSP_DSP_SET_FRAGMENT] = "SET_FRAGMENT", + [OSSP_DSP_GET_TRIGGER] = "GET_TRIGGER", + [OSSP_DSP_SET_TRIGGER] = "SET_TRIGGER", + [OSSP_DSP_GET_OSPACE] = "GET_OSPACE", + [OSSP_DSP_GET_ISPACE] = "GET_ISPACE", + [OSSP_DSP_GET_OPTR] = "GET_OPTR", + [OSSP_DSP_GET_IPTR] = "GET_IPTR", + [OSSP_DSP_GET_ODELAY] = "GET_ODELAY", +}; + +const char *ossp_notify_str[OSSP_NR_NOTIFY_OPCODES] = { + [OSSP_NOTIFY_POLL] = "POLL", + [OSSP_NOTIFY_OBITUARY] = "OBITUARY", + [OSSP_NOTIFY_VOLCHG] = "VOLCHG", +}; diff --git a/src/mod/endpoints/mod_skypopen/osscuse/ossp.h b/src/mod/endpoints/mod_skypopen/osscuse/ossp.h new file mode 100644 index 0000000..9d03e63 --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/osscuse/ossp.h @@ -0,0 +1,117 @@ +/* + * ossp - OSS Proxy: emulate OSS device using CUSE + * + * Copyright (C) 2008-2010 SUSE Linux Products GmbH + * Copyright (C) 2008-2010 Tejun Heo <tj@kernel.org> + * + * This file is released under the GPLv2. + */ + +#ifndef _OSSP_H +#define _OSSP_H + +#include <sys/types.h> +#include <inttypes.h> +#include <sys/soundcard.h> + +#define OSSP_VERSION "1.3.2" +#define OSSP_CMD_MAGIC 0xdeadbeef +#define OSSP_REPLY_MAGIC 0xbeefdead +#define OSSP_NOTIFY_MAGIC 0xbebebebe + +#define PLAY 0 +#define REC 1 +#define LEFT 0 +#define RIGHT 1 + +enum ossp_opcode { + OSSP_MIXER, + + OSSP_DSP_OPEN, + OSSP_DSP_READ, + OSSP_DSP_WRITE, + OSSP_DSP_POLL, + OSSP_DSP_MMAP, + OSSP_DSP_MUNMAP, + + OSSP_DSP_RESET, + OSSP_DSP_SYNC, + OSSP_DSP_POST, + + OSSP_DSP_GET_RATE, + OSSP_DSP_GET_CHANNELS, + OSSP_DSP_GET_FORMAT, + OSSP_DSP_GET_BLKSIZE, + OSSP_DSP_GET_FORMATS, + OSSP_DSP_SET_RATE, + OSSP_DSP_SET_CHANNELS, + OSSP_DSP_SET_FORMAT, + OSSP_DSP_SET_SUBDIVISION, + + OSSP_DSP_SET_FRAGMENT, + OSSP_DSP_GET_TRIGGER, + OSSP_DSP_SET_TRIGGER, + OSSP_DSP_GET_OSPACE, + OSSP_DSP_GET_ISPACE, + OSSP_DSP_GET_OPTR, + OSSP_DSP_GET_IPTR, + OSSP_DSP_GET_ODELAY, + + OSSP_NR_OPCODES, +}; + +enum ossp_notify_opcode { + OSSP_NOTIFY_POLL, + OSSP_NOTIFY_OBITUARY, + OSSP_NOTIFY_VOLCHG, + + OSSP_NR_NOTIFY_OPCODES, +}; + +struct ossp_mixer_arg { + int vol[2][2]; +}; + +struct ossp_dsp_open_arg { + int flags; + pid_t opener_pid; +}; + +struct ossp_dsp_rw_arg { + unsigned nonblock:1; +}; + +struct ossp_dsp_mmap_arg { + int dir; + size_t size; +}; + +struct ossp_cmd { + unsigned magic; + enum ossp_opcode opcode; + size_t din_size; + size_t dout_size; +}; + +struct ossp_reply { + unsigned magic; + int result; + size_t dout_size; /* <= cmd.data_in_size */ +}; + +struct ossp_notify { + unsigned magic; + enum ossp_notify_opcode opcode; +}; + +struct ossp_arg_size { + ssize_t carg_size; + ssize_t rarg_size; + unsigned has_fd:1; +}; + +extern const struct ossp_arg_size ossp_arg_sizes[OSSP_NR_OPCODES]; +extern const char *ossp_cmd_str[OSSP_NR_OPCODES]; +extern const char *ossp_notify_str[OSSP_NR_NOTIFY_OPCODES]; + +#endif /* _OSSP_H */ diff --git a/src/mod/endpoints/mod_skypopen/osscuse/osspd.c b/src/mod/endpoints/mod_skypopen/osscuse/osspd.c new file mode 100644 index 0000000..dc9f36a --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/osscuse/osspd.c @@ -0,0 +1,2374 @@ +/* + * osspd - OSS Proxy Daemon: emulate OSS device using CUSE + * + * Copyright (C) 2008-2010 SUSE Linux Products GmbH + * Copyright (C) 2008-2010 Tejun Heo <tj@kernel.org> + * + * This file is released under the GPLv2. + */ +#undef GIOVANNI + +#define FUSE_USE_VERSION 28 +#define _GNU_SOURCE + +#include <assert.h> +#include <cuse_lowlevel.h> +#include <fcntl.h> +#include <fuse_opt.h> +#include <libgen.h> +#include <limits.h> +#include <pthread.h> +#include <pwd.h> +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <signal.h> +#include <sys/mman.h> +#include <sys/stat.h> +#include <sys/epoll.h> +#include <sys/socket.h> +#include <sys/soundcard.h> +#include <sys/time.h> +#include <sys/wait.h> +#include <unistd.h> + +#include "ossp.h" +#include "ossp-util.h" + +/* + * MMAP support needs to be updated to the new fuse MMAP API. Disable + * it for the time being. + */ +#warning mmap support disabled for now +/* #define OSSP_MMAP */ + +#define DFL_MIXER_NAME "mixer" +#define DFL_DSP_NAME "dsp" +#define DFL_ADSP_NAME "adsp" +#define STRFMT "S[%u/%d]" +#define STRID(os) os->id, os->pid + +#define dbg1_os(os, fmt, args...) dbg1(STRFMT" "fmt, STRID(os) , ##args) +#define dbg0_os(os, fmt, args...) dbg0(STRFMT" "fmt, STRID(os) , ##args) +#define warn_os(os, fmt, args...) warn(STRFMT" "fmt, STRID(os) , ##args) +#define err_os(os, fmt, args...) err(STRFMT" "fmt, STRID(os) , ##args) +#define warn_ose(os, err, fmt, args...) \ + warn_e(err, STRFMT" "fmt, STRID(os) , ##args) +#define err_ose(os, err, fmt, args...) \ + err_e(err, STRFMT" "fmt, STRID(os) , ##args) + +enum { + SNDRV_OSS_VERSION = ((3<<16)|(8<<8)|(1<<4)|(0)), /* 3.8.1a */ + DFL_MIXER_MAJOR = 14, + DFL_MIXER_MINOR = 0, + DFL_DSP_MAJOR = 14, + DFL_DSP_MINOR = 3, + DFL_ADSP_MAJOR = 14, + DFL_ADSP_MINOR = 12, + DFL_MAX_STREAMS = 128, + MIXER_PUT_DELAY = 600, /* 10 mins */ + /* DSPS_MMAP_SIZE / 2 must be multiple of SHMLBA */ + DSPS_MMAP_SIZE = 2 * (512 << 10), /* 512k for each dir */ +}; + +struct ossp_uid_cnt { + struct list_head link; + uid_t uid; + unsigned nr_os; +}; + +struct ossp_mixer { + pid_t pgrp; + struct list_head link; + struct list_head delayed_put_link; + unsigned refcnt; + /* the following two fields are protected by mixer_mutex */ + int vol[2][2]; + int modify_counter; + time_t put_expires; +}; + +struct ossp_mixer_cmd { + struct ossp_mixer *mixer; + struct ossp_mixer_arg set; + int out_dir; + int rvol; +}; + +#define for_each_vol(i, j) \ + for (i = 0, j = 0; i < 2; j += i << 1, j++, i = j >> 1, j &= 1) + +struct ossp_stream { + unsigned id; /* stream ID */ + struct list_head link; + struct list_head pgrp_link; + struct list_head notify_link; + unsigned refcnt; + pthread_mutex_t cmd_mutex; + pthread_mutex_t mmap_mutex; + struct fuse_pollhandle *ph; + + /* stream owner info */ + pid_t pid; + pid_t pgrp; + uid_t uid; + gid_t gid; + + /* slave info */ + pid_t slave_pid; + int cmd_fd; + int notify_tx; + int notify_rx; + + /* the following dead flag is set asynchronously, keep it separate. */ + int dead; + + /* stream mixer state, protected by mixer_mutex */ + int mixer_pending; + int vol[2][2]; + int vol_set[2][2]; + + off_t mmap_off; + size_t mmap_size; + + struct ossp_uid_cnt *ucnt; + struct fuse_session *se; /* associated fuse session */ + struct ossp_mixer *mixer; +}; + +struct ossp_dsp_stream { + struct ossp_stream os; + unsigned rw; + unsigned mmapped; + int nonblock; +}; + +#define os_to_dsps(_os) container_of(_os, struct ossp_dsp_stream, os) + +static unsigned max_streams; +static unsigned umax_streams; +static unsigned hashtbl_size; +static char dsp_slave_path[PATH_MAX]; + +static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t mixer_mutex = PTHREAD_MUTEX_INITIALIZER; +static unsigned long *os_id_bitmap; +static unsigned nr_mixers; +static struct list_head *mixer_tbl; /* indexed by PGRP */ +static struct list_head *os_tbl; /* indexed by ID */ +static struct list_head *os_pgrp_tbl; /* indexed by PGRP */ +static struct list_head *os_notify_tbl; /* indexed by notify fd */ +static LIST_HEAD(uid_cnt_list); +static int notify_epfd; /* epoll used to monitor notify fds */ +static pthread_t notify_poller_thread; +static pthread_t slave_reaper_thread; +static pthread_t mixer_delayed_put_thread; +static pthread_t cuse_mixer_thread; +static pthread_t cuse_adsp_thread; +static pthread_cond_t notify_poller_kill_wait = PTHREAD_COND_INITIALIZER; +static pthread_cond_t slave_reaper_wait = PTHREAD_COND_INITIALIZER; +static LIST_HEAD(slave_corpse_list); +static LIST_HEAD(mixer_delayed_put_head); /* delayed reference */ +static pthread_cond_t mixer_delayed_put_cond = PTHREAD_COND_INITIALIZER; + +static int init_wait_fd = -1; +static int exit_on_idle; +static struct fuse_session *mixer_se; +static struct fuse_session *dsp_se; +static struct fuse_session *adsp_se; + +static void put_os(struct ossp_stream *os); + + +/*************************************************************************** + * Accessors + */ + +static struct list_head *mixer_tbl_head(pid_t pid) +{ + return &mixer_tbl[pid % hashtbl_size]; +} + +static struct list_head *os_tbl_head(uint64_t id) +{ + return &os_tbl[id % hashtbl_size]; +} + +static struct list_head *os_pgrp_tbl_head(pid_t pgrp) +{ + return &os_pgrp_tbl[pgrp % hashtbl_size]; +} + +static struct list_head *os_notify_tbl_head(int notify_rx) +{ + return &os_notify_tbl[notify_rx % hashtbl_size]; +} + +static struct ossp_mixer *find_mixer_locked(pid_t pgrp) +{ + struct ossp_mixer *mixer; + + list_for_each_entry(mixer, mixer_tbl_head(pgrp), link) + if (mixer->pgrp == pgrp) + return mixer; + return NULL; +} + +static struct ossp_mixer *find_mixer(pid_t pgrp) +{ + struct ossp_mixer *mixer; + + pthread_mutex_lock(&mutex); + mixer = find_mixer_locked(pgrp); + pthread_mutex_unlock(&mutex); + return mixer; +} + +static struct ossp_stream *find_os(unsigned id) +{ + struct ossp_stream *os, *found = NULL; + + pthread_mutex_lock(&mutex); + list_for_each_entry(os, os_tbl_head(id), link) + if (os->id == id) { + found = os; + break; + } + pthread_mutex_unlock(&mutex); + return found; +} + +static struct ossp_stream *find_os_by_notify_rx(int notify_rx) +{ + struct ossp_stream *os, *found = NULL; + + pthread_mutex_lock(&mutex); + list_for_each_entry(os, os_notify_tbl_head(notify_rx), notify_link) + if (os->notify_rx == notify_rx) { + found = os; + break; + } + pthread_mutex_unlock(&mutex); + return found; +} + + +/*************************************************************************** + * Command and ioctl helpers + */ + +static ssize_t exec_cmd_intern(struct ossp_stream *os, enum ossp_opcode opcode, + const void *carg, size_t carg_size, const void *din, size_t din_size, + void *rarg, size_t rarg_size, void *dout, size_t *dout_sizep, int fd) +{ + size_t dout_size = dout_sizep ? *dout_sizep : 0; + struct ossp_cmd cmd = { .magic = OSSP_CMD_MAGIC, .opcode = opcode, + .din_size = din_size, + .dout_size = dout_size }; + struct iovec iov = { &cmd, sizeof(cmd) }; + struct msghdr msg = { .msg_iov = &iov, .msg_iovlen = 1 }; + struct ossp_reply reply = { }; + char cmsg_buf[CMSG_SPACE(sizeof(fd))]; + char reason[512]; + int rc; + + if (os->dead) + return -EIO; + + //dbg1_os(os, "opcode %s=%d carg=%zu din=%zu rarg=%zu dout=%zu", + //ossp_cmd_str[opcode], opcode, carg_size, din_size, rarg_size, + //dout_size); +#ifndef GIOVANNI +memset(dout, 255, dout_size); +memset(din, 255, din_size); + +#define GIOVA_BLK 3840 +#define GIOVA_SLEEP 40000 +switch(opcode){ + + case 1: //OPEN + reply.result = 0; + break; + case 2: //READ + usleep((GIOVA_SLEEP/GIOVA_BLK)* *dout_sizep); + reply.result = *dout_sizep; + break; + case 3: //WRITE + usleep((GIOVA_SLEEP/GIOVA_BLK)* din_size); + reply.result = din_size; + break; + case 9: //POST + reply.result = -32; + break; + case 13: //GET_BLKSIZE + reply.result = 0; + *(int *)rarg = GIOVA_BLK; + break; + case 14: //GET_FORMATS + reply.result = 0; + *(int *)rarg = 28731; + break; + case 15: //SET_RATE + reply.result = 0; + *(int *)rarg = *(int *) carg; + break; + case 16: //SET_CHANNELS + reply.result = 0; + *(int *)rarg = *(int *) carg; + break; + case 17: //SET_FORMAT + reply.result = 0; + *(int *)rarg = *(int *) carg; + break; + case 19: //SET_FRAGMENT + reply.result = 0; + break; + default: + reply.result = 0; + break; +} +#endif // GIOVANNI + +#ifdef GIOVANNI + if (fd >= 0) { + struct cmsghdr *cmsg; + + msg.msg_control = cmsg_buf; + msg.msg_controllen = sizeof(cmsg_buf); + cmsg = CMSG_FIRSTHDR(&msg); + cmsg->cmsg_level = SOL_SOCKET; + cmsg->cmsg_type = SCM_RIGHTS; + cmsg->cmsg_len = CMSG_LEN(sizeof(fd)); + *(int *)CMSG_DATA(cmsg) = fd; + msg.msg_controllen = cmsg->cmsg_len; + } + + if (sendmsg(os->cmd_fd, &msg, 0) <= 0) { + rc = -errno; + snprintf(reason, sizeof(reason), "command sendmsg failed: %s", + strerror(-rc)); + goto fail; + } + + if ((rc = write_fill(os->cmd_fd, carg, carg_size)) < 0 || + (rc = write_fill(os->cmd_fd, din, din_size)) < 0) { + snprintf(reason, sizeof(reason), + "can't tranfer command argument and/or data: %s", + strerror(-rc)); + goto fail; + } + if ((rc = read_fill(os->cmd_fd, &reply, sizeof(reply))) < 0) { + snprintf(reason, sizeof(reason), "can't read reply: %s", + strerror(-rc)); + goto fail; + } + + if (reply.magic != OSSP_REPLY_MAGIC) { + snprintf(reason, sizeof(reason), + "reply magic mismatch %x != %x", + reply.magic, OSSP_REPLY_MAGIC); + rc = -EINVAL; + goto fail; + } + + if (reply.result < 0) + goto out_unlock; + + if (reply.dout_size > dout_size) { + snprintf(reason, sizeof(reason), + "data out size overflow %zu > %zu", + reply.dout_size, dout_size); + rc = -EINVAL; + goto fail; + } + + dout_size = reply.dout_size; + if (dout_sizep) + *dout_sizep = dout_size; + + if ((rc = read_fill(os->cmd_fd, rarg, rarg_size)) < 0 || + (rc = read_fill(os->cmd_fd, dout, dout_size)) < 0) { + snprintf(reason, sizeof(reason), "can't read data out: %s", + strerror(-rc)); + goto fail; + } + +#endif // GIOVANNI + +out_unlock: + //dbg1_os(os, " completed, result=%d dout=%zu", + //reply.result, dout_size); + +//if(rarg) + //dbg1_os(os, " 2 %s=%d completed, result=%d dout=%zu carg=%d rarg=%d", ossp_cmd_str[opcode], opcode, + //reply.result, dout_size, carg ? *(int *) carg : 666, *(int *)rarg); + return reply.result; + +fail: + warn_os(os, "communication with slave failed (%s)", reason); + os->dead = 1; + return rc; +} + +static ssize_t exec_cmd(struct ossp_stream *os, enum ossp_opcode opcode, + const void *carg, size_t carg_size, const void *din, size_t din_size, + void *rarg, size_t rarg_size, void *dout, size_t *dout_sizep, int fd) +{ + int is_mixer; + int i, j; + ssize_t ret, mret; + + /* mixer command is handled exlicitly below */ + is_mixer = opcode == OSSP_MIXER; + if (is_mixer) { + ret = -pthread_mutex_trylock(&os->cmd_mutex); + if (ret) + return ret; + } else { + pthread_mutex_lock(&os->cmd_mutex); + + ret = exec_cmd_intern(os, opcode, carg, carg_size, + din, din_size, rarg, rarg_size, + dout, dout_sizep, fd); + } + + /* lazy mixer handling */ + pthread_mutex_lock(&mixer_mutex); + + if (os->mixer_pending) { + struct ossp_mixer_arg marg; + repeat_mixer: + /* we have mixer command pending */ + memcpy(marg.vol, os->vol_set, sizeof(os->vol_set)); + memset(os->vol_set, -1, sizeof(os->vol_set)); + + pthread_mutex_unlock(&mixer_mutex); + mret = exec_cmd_intern(os, OSSP_MIXER, &marg, sizeof(marg), + NULL, 0, &marg, sizeof(marg), NULL, NULL, + -1); + pthread_mutex_lock(&mixer_mutex); + + /* was there mixer set request while executing mixer command? */ + for_each_vol(i, j) + if (os->vol_set[i][j] >= 0) + goto repeat_mixer; + + /* update internal mixer state */ + if (mret == 0) { + for_each_vol(i, j) { + if (marg.vol[i][j] >= 0) { + if (os->vol[i][j] != marg.vol[i][j]) + os->mixer->modify_counter++; + os->vol[i][j] = marg.vol[i][j]; + } + } + } + os->mixer_pending = 0; + } + + pthread_mutex_unlock(&os->cmd_mutex); + + /* + * mixer mutex must be released after cmd_mutex so that + * exec_mixer_cmd() can guarantee that mixer_pending flags + * will be handled immediately or when the currently + * in-progress command completes. + */ + pthread_mutex_unlock(&mixer_mutex); + + return is_mixer ? mret : ret; +} + +static ssize_t exec_simple_cmd(struct ossp_stream *os, + enum ossp_opcode opcode, void *carg, void *rarg) +{ + return exec_cmd(os, opcode, + carg, ossp_arg_sizes[opcode].carg_size, NULL, 0, + rarg, ossp_arg_sizes[opcode].rarg_size, NULL, NULL, -1); +} + +static int ioctl_prep_uarg(fuse_req_t req, void *in, size_t in_sz, void *out, + size_t out_sz, void *uarg, const void *in_buf, + size_t in_bufsz, size_t out_bufsz) +{ + struct iovec in_iov = { }, out_iov = { }; + int retry = 0; + + if (in) { + if (!in_bufsz) { + in_iov.iov_base = uarg; + in_iov.iov_len = in_sz; + retry = 1; + } else { + assert(in_bufsz == in_sz); + memcpy(in, in_buf, in_sz); + } + } + + if (out) { + if (!out_bufsz) { + out_iov.iov_base = uarg; + out_iov.iov_len = out_sz; + retry = 1; + } else + assert(out_bufsz == out_sz); + } + + if (retry) + fuse_reply_ioctl_retry(req, &in_iov, 1, &out_iov, 1); + + return retry; +} + +#define PREP_UARG(inp, outp) do { \ + if (ioctl_prep_uarg(req, (inp), sizeof(*(inp)), \ + (outp), sizeof(*(outp)), uarg, \ + in_buf, in_bufsz, out_bufsz)) \ + return; \ +} while (0) + +#define IOCTL_RETURN(result, outp) do { \ + if ((outp) != NULL) \ + fuse_reply_ioctl(req, result, (outp), sizeof(*(outp))); \ + else \ + fuse_reply_ioctl(req, result, NULL, 0); \ + return; \ +} while (0) + + +/*************************************************************************** + * Mixer implementation + */ + +static void put_mixer_real(struct ossp_mixer *mixer) +{ + if (!--mixer->refcnt) { + dbg0("DESTROY mixer(%d)", mixer->pgrp); + list_del_init(&mixer->link); + list_del_init(&mixer->delayed_put_link); + free(mixer); + nr_mixers--; + + /* + * If exit_on_idle, mixer for pgrp0 is touched during + * init and each stream has mixer attached. As mixers + * are destroyed after they have been idle for + * MIXER_PUT_DELAY seconds, we can use it for idle + * detection. Note that this might race with + * concurrent open. The race is inherent. + */ + if (exit_on_idle && !nr_mixers) { + info("idle, exiting"); + exit(0); + } + } +} + +static struct ossp_mixer *get_mixer(pid_t pgrp) +{ + struct ossp_mixer *mixer; + + pthread_mutex_lock(&mutex); + + /* is there a matching one? */ + mixer = find_mixer_locked(pgrp); + if (mixer) { + if (list_empty(&mixer->delayed_put_link)) + mixer->refcnt++; + else + list_del_init(&mixer->delayed_put_link); + goto out_unlock; + } + + /* reap delayed put list if there are too many mixers */ + while (nr_mixers > 2 * max_streams && + !list_empty(&mixer_delayed_put_head)) { + struct ossp_mixer *mixer = + list_first_entry(&mixer_delayed_put_head, + struct ossp_mixer, delayed_put_link); + + assert(mixer->refcnt == 1); + put_mixer_real(mixer); + } + + /* create a new one */ + mixer = calloc(1, sizeof(*mixer)); + if (!mixer) { + warn("failed to allocate mixer for %d", pgrp); + mixer = NULL; + goto out_unlock; + } + + mixer->pgrp = pgrp; + INIT_LIST_HEAD(&mixer->link); + INIT_LIST_HEAD(&mixer->delayed_put_link); + mixer->refcnt = 1; + memset(mixer->vol, -1, sizeof(mixer->vol)); + + list_add(&mixer->link, mixer_tbl_head(pgrp)); + nr_mixers++; + dbg0("CREATE mixer(%d)", pgrp); + +out_unlock: + pthread_mutex_unlock(&mutex); + return mixer; +} + +static void put_mixer(struct ossp_mixer *mixer) +{ + pthread_mutex_lock(&mutex); + + if (mixer) { + if (mixer->refcnt == 1) { + struct timespec ts; + + clock_gettime(CLOCK_REALTIME, &ts); + mixer->put_expires = ts.tv_sec + MIXER_PUT_DELAY; + list_add_tail(&mixer->delayed_put_link, + &mixer_delayed_put_head); + pthread_cond_signal(&mixer_delayed_put_cond); + } else + put_mixer_real(mixer); + } + + pthread_mutex_unlock(&mutex); +} + +static void *mixer_delayed_put_worker(void *arg) +{ + struct ossp_mixer *mixer; + struct timespec ts; + time_t now; + + pthread_mutex_lock(&mutex); +again: + clock_gettime(CLOCK_REALTIME, &ts); + now = ts.tv_sec; + + mixer = NULL; + while (!list_empty(&mixer_delayed_put_head)) { + mixer = list_first_entry(&mixer_delayed_put_head, + struct ossp_mixer, delayed_put_link); + + if (now <= mixer->put_expires) + break; + + assert(mixer->refcnt == 1); + put_mixer_real(mixer); + mixer = NULL; + } + + if (mixer) { + ts.tv_sec = mixer->put_expires + 1; + pthread_cond_timedwait(&mixer_delayed_put_cond, &mutex, &ts); + } else + pthread_cond_wait(&mixer_delayed_put_cond, &mutex); + + goto again; +} + +static void init_mixer_cmd(struct ossp_mixer_cmd *mxcmd, + struct ossp_mixer *mixer) +{ + memset(mxcmd, 0, sizeof(*mxcmd)); + memset(&mxcmd->set.vol, -1, sizeof(mxcmd->set.vol)); + mxcmd->mixer = mixer; + mxcmd->out_dir = -1; +} + +static int exec_mixer_cmd(struct ossp_mixer_cmd *mxcmd, struct ossp_stream *os) +{ + int i, j, rc; + + /* + * Set pending flags before trying to execute mixer command. + * Combined with lock release order in exec_cmd(), this + * guarantees that the mixer command will be executed + * immediately or when the current command completes. + */ + pthread_mutex_lock(&mixer_mutex); + os->mixer_pending = 1; + for_each_vol(i, j) + if (mxcmd->set.vol[i][j] >= 0) + os->vol_set[i][j] = mxcmd->set.vol[i][j]; + pthread_mutex_unlock(&mixer_mutex); + + rc = exec_simple_cmd(os, OSSP_MIXER, NULL, NULL); + if (rc >= 0) { + dbg0_os(os, "volume set=%d/%d:%d/%d get=%d/%d:%d/%d", + mxcmd->set.vol[PLAY][LEFT], mxcmd->set.vol[PLAY][RIGHT], + mxcmd->set.vol[REC][LEFT], mxcmd->set.vol[REC][RIGHT], + os->vol[PLAY][LEFT], os->vol[PLAY][RIGHT], + os->vol[REC][LEFT], os->vol[REC][RIGHT]); + } else if (rc != -EBUSY) + warn_ose(os, rc, "mixer command failed"); + + return rc; +} + +static void finish_mixer_cmd(struct ossp_mixer_cmd *mxcmd) +{ + struct ossp_mixer *mixer = mxcmd->mixer; + struct ossp_stream *os; + int dir = mxcmd->out_dir; + int vol[2][2] = { }; + int cnt[2][2] = { }; + int i, j; + + pthread_mutex_lock(&mixer_mutex); + + /* get volume of all streams attached to this mixer */ + pthread_mutex_lock(&mutex); + list_for_each_entry(os, os_pgrp_tbl_head(mixer->pgrp), pgrp_link) { + if (os->pgrp != mixer->pgrp) + continue; + for_each_vol(i, j) { + if (os->vol[i][j] < 0) + continue; + vol[i][j] += os->vol[i][j]; + cnt[i][j]++; + } + } + pthread_mutex_unlock(&mutex); + + /* calculate the summary volume values */ + for_each_vol(i, j) { + if (mxcmd->set.vol[i][j] >= 0) + vol[i][j] = mxcmd->set.vol[i][j]; + else if (cnt[i][j]) + vol[i][j] = vol[i][j] / cnt[i][j]; + else if (mixer->vol[i][j] >= 0) + vol[i][j] = mixer->vol[i][j]; + else + vol[i][j] = 100; + + vol[i][j] = min(max(0, vol[i][j]), 100); + } + + if (dir >= 0) + mxcmd->rvol = vol[dir][LEFT] | (vol[dir][RIGHT] << 8); + + pthread_mutex_unlock(&mixer_mutex); +} + +static void mixer_simple_ioctl(fuse_req_t req, struct ossp_mixer *mixer, + unsigned cmd, void *uarg, const void *in_buf, + size_t in_bufsz, size_t out_bufsz, + int *not_minep) +{ + const char *id = "OSS Proxy", *name = "Mixer"; + int i; + + switch (cmd) { + case SOUND_MIXER_INFO: { + struct mixer_info info = { }; + + PREP_UARG(NULL, &info); + strncpy(info.id, id, sizeof(info.id) - 1); + strncpy(info.name, name, sizeof(info.name) - 1); + info.modify_counter = mixer->modify_counter; + IOCTL_RETURN(0, &info); + } + + case SOUND_OLD_MIXER_INFO: { + struct _old_mixer_info info = { }; + + PREP_UARG(NULL, &info); + strncpy(info.id, id, sizeof(info.id) - 1); + strncpy(info.name, name, sizeof(info.name) - 1); + IOCTL_RETURN(0, &info); + } + + case OSS_GETVERSION: + i = SNDRV_OSS_VERSION; + goto puti; + case SOUND_MIXER_READ_DEVMASK: + case SOUND_MIXER_READ_STEREODEVS: + i = SOUND_MASK_PCM | SOUND_MASK_IGAIN; + goto puti; + case SOUND_MIXER_READ_CAPS: + i = SOUND_CAP_EXCL_INPUT; + goto puti; + case SOUND_MIXER_READ_RECMASK: + case SOUND_MIXER_READ_RECSRC: + i = SOUND_MASK_IGAIN; + goto puti; + puti: + PREP_UARG(NULL, &i); + IOCTL_RETURN(0, &i); + + case SOUND_MIXER_WRITE_RECSRC: + IOCTL_RETURN(0, NULL); + + default: + *not_minep = 1; + return; + } + assert(0); +} + +static void mixer_do_ioctl(fuse_req_t req, struct ossp_mixer *mixer, + unsigned cmd, void *uarg, const void *in_buf, + size_t in_bufsz, size_t out_bufsz) +{ + struct ossp_mixer_cmd mxcmd; + struct ossp_stream *os, **osa; + int not_mine = 0; + int slot = cmd & 0xff, dir; + int nr_os; + int i, rc; + + mixer_simple_ioctl(req, mixer, cmd, uarg, in_buf, in_bufsz, out_bufsz, + ¬_mine); + if (!not_mine) + return; + + rc = -ENXIO; + if (!(cmd & (SIOC_IN | SIOC_OUT))) + goto err; + + /* + * Okay, it's not one of the easy ones. Build mxcmd for + * actual volume control. + */ + if (cmd & SIOC_IN) + PREP_UARG(&i, &i); + else + PREP_UARG(NULL, &i); + + switch (slot) { + case SOUND_MIXER_PCM: + dir = PLAY; + break; + case SOUND_MIXER_IGAIN: + dir = REC; + break; + default: + i = 0; + IOCTL_RETURN(0, &i); + } + + init_mixer_cmd(&mxcmd, mixer); + + if (cmd & SIOC_IN) { + unsigned l, r; + + rc = -EINVAL; + l = i & 0xff; + r = (i >> 8) & 0xff; + if (l > 100 || r > 100) + goto err; + + mixer->vol[dir][LEFT] = mxcmd.set.vol[dir][LEFT] = l; + mixer->vol[dir][RIGHT] = mxcmd.set.vol[dir][RIGHT] = r; + } + mxcmd.out_dir = dir; + + /* + * Apply volume conrol + */ + /* acquire target streams */ + pthread_mutex_lock(&mutex); + osa = calloc(max_streams, sizeof(osa[0])); + if (!osa) { + pthread_mutex_unlock(&mutex); + rc = -ENOMEM; + goto err; + } + + nr_os = 0; + list_for_each_entry(os, os_pgrp_tbl_head(mixer->pgrp), pgrp_link) { + if (os->pgrp == mixer->pgrp) { + osa[nr_os++] = os; + os->refcnt++; + } + } + + pthread_mutex_unlock(&mutex); + + /* execute mxcmd for each stream and put it */ + for (i = 0; i < nr_os; i++) { + exec_mixer_cmd(&mxcmd, osa[i]); + put_os(osa[i]); + } + + finish_mixer_cmd(&mxcmd); + free(osa); + + IOCTL_RETURN(0, out_bufsz ? &mxcmd.rvol : NULL); + +err: + fuse_reply_err(req, -rc); +} + +static void mixer_open(fuse_req_t req, struct fuse_file_info *fi) +{ + pid_t pid = fuse_req_ctx(req)->pid, pgrp; + struct ossp_mixer *mixer; + int rc; + + rc = get_proc_self_info(pid, &pgrp, NULL, 0); + if (rc) { + err_e(rc, "get_proc_self_info(%d) failed", pid); + fuse_reply_err(req, -rc); + return; + } + + mixer = get_mixer(pgrp); + fi->fh = pgrp; + + if (mixer) + fuse_reply_open(req, fi); + else + fuse_reply_err(req, ENOMEM); +} + +static void mixer_ioctl(fuse_req_t req, int signed_cmd, void *uarg, + struct fuse_file_info *fi, unsigned int flags, + const void *in_buf, size_t in_bufsz, size_t out_bufsz) +{ + struct ossp_mixer *mixer; + + mixer = find_mixer(fi->fh); + if (!mixer) { + fuse_reply_err(req, EBADF); + return; + } + + mixer_do_ioctl(req, mixer, signed_cmd, uarg, in_buf, in_bufsz, + out_bufsz); +} + +static void mixer_release(fuse_req_t req, struct fuse_file_info *fi) +{ + struct ossp_mixer *mixer; + + mixer = find_mixer(fi->fh); + if (mixer) { + put_mixer(mixer); + fuse_reply_err(req, 0); + } else + fuse_reply_err(req, EBADF); +} + + +/*************************************************************************** + * Stream implementation + */ + +static int alloc_os(size_t stream_size, size_t mmap_size, pid_t pid, uid_t pgrp, + uid_t uid, gid_t gid, int cmd_sock, + const int *notify, struct fuse_session *se, + struct ossp_stream **osp) +{ + struct ossp_uid_cnt *tmp_ucnt, *ucnt = NULL; + struct ossp_stream *os; + int rc; + + assert(stream_size >= sizeof(struct ossp_stream)); + os = calloc(1, stream_size); + if (!os) + return -ENOMEM; + + INIT_LIST_HEAD(&os->link); + INIT_LIST_HEAD(&os->pgrp_link); + INIT_LIST_HEAD(&os->notify_link); + os->refcnt = 1; + + rc = -pthread_mutex_init(&os->cmd_mutex, NULL); + if (rc) + goto err_free; + + rc = -pthread_mutex_init(&os->mmap_mutex, NULL); + if (rc) + goto err_destroy_cmd_mutex; + + pthread_mutex_lock(&mutex); + + list_for_each_entry(tmp_ucnt, &uid_cnt_list, link) + if (tmp_ucnt->uid == uid) { + ucnt = tmp_ucnt; + break; + } + if (!ucnt) { + rc = -ENOMEM; + ucnt = calloc(1, sizeof(*ucnt)); + if (!ucnt) + goto err_unlock; + ucnt->uid = uid; + list_add(&ucnt->link, &uid_cnt_list); + } + + rc = -EBUSY; + if (ucnt->nr_os + 1 > umax_streams) + goto err_unlock; + + /* everything looks fine, allocate id and init stream */ + rc = -EBUSY; + os->id = find_next_zero_bit(os_id_bitmap, max_streams, 0); + if (os->id >= max_streams) + goto err_unlock; + __set_bit(os->id, os_id_bitmap); + + os->cmd_fd = cmd_sock; + os->notify_tx = notify[1]; + os->notify_rx = notify[0]; + os->pid = pid; + os->pgrp = pgrp; + os->uid = uid; + os->gid = gid; + if (mmap_size) { + os->mmap_off = os->id * mmap_size; + os->mmap_size = mmap_size; + } + os->ucnt = ucnt; + os->se = se; + + memset(os->vol, -1, sizeof(os->vol)); + memset(os->vol_set, -1, sizeof(os->vol)); + + list_add(&os->link, os_tbl_head(os->id)); + list_add(&os->pgrp_link, os_pgrp_tbl_head(os->pgrp)); + + ucnt->nr_os++; + *osp = os; + pthread_mutex_unlock(&mutex); + return 0; + +err_unlock: + pthread_mutex_unlock(&mutex); + pthread_mutex_destroy(&os->mmap_mutex); +err_destroy_cmd_mutex: + pthread_mutex_destroy(&os->cmd_mutex); +err_free: + free(os); + return rc; +} + +static void shutdown_notification(struct ossp_stream *os) +{ + struct ossp_notify obituary = { .magic = OSSP_NOTIFY_MAGIC, + .opcode = OSSP_NOTIFY_OBITUARY }; + ssize_t ret; + + /* + * Shutdown notification for this stream. We politely ask + * notify_poller to shut the receive side down to avoid racing + * with it. + */ + while (os->notify_rx >= 0) { + ret = write(os->notify_tx, &obituary, sizeof(obituary)); + if (ret <= 0) { + if (ret == 0) + warn_os(os, "unexpected EOF on notify_tx"); + else if (errno != EPIPE) + warn_ose(os, -errno, + "unexpected error on notify_tx"); + close(os->notify_rx); + os->notify_rx = -1; + break; + } + + if (ret != sizeof(obituary)) + warn_os(os, "short transfer on notify_tx"); + pthread_cond_wait(¬ify_poller_kill_wait, &mutex); + } +} + +static void put_os(struct ossp_stream *os) +{ + if (!os) + return; + + pthread_mutex_lock(&mutex); + + assert(os->refcnt); + if (--os->refcnt) { + pthread_mutex_unlock(&mutex); + return; + } + + os->dead = 1; + shutdown_notification(os); + + dbg0_os(os, "DESTROY"); + + list_del_init(&os->link); + list_del_init(&os->pgrp_link); + list_del_init(&os->notify_link); + os->ucnt->nr_os--; + + pthread_mutex_unlock(&mutex); + + close(os->cmd_fd); + close(os->notify_tx); + put_mixer(os->mixer); + pthread_mutex_destroy(&os->cmd_mutex); + pthread_mutex_destroy(&os->mmap_mutex); + + pthread_mutex_lock(&mutex); + dbg1_os(os, "stream dead, requesting reaping"); + list_add_tail(&os->link, &slave_corpse_list); + pthread_cond_signal(&slave_reaper_wait); + pthread_mutex_unlock(&mutex); +} + +static void set_extra_env(pid_t pid) +{ + char procenviron[32]; + const int step = 1024; + char *data = malloc(step + 1); + int ofs = 0; + int fd; + int ret; + + if (!data) + return; + + sprintf(procenviron, "/proc/%d/environ", pid); + fd = open(procenviron, O_RDONLY); + if (fd < 0) + return; + + /* + * There should really be a 'read whole file to a newly allocated + * buffer' function. + */ + while ((ret = read(fd, data + ofs, step)) > 0) { + char *newdata; + ofs += ret; + newdata = realloc(data, ofs + step + 1); + if (!newdata) { + ret = -1; + break; + } + data = newdata; + } + if (ret == 0) { + char *ptr = data; + /* Append the extra 0 for end condition */ + data[ofs] = 0; + + while ((ret = strlen(ptr)) > 0) { + /* + * Copy all PULSE variables and DISPLAY so that + * ssh -X remotehost 'mplayer -ao oss' will work + */ + if (!strncmp(ptr, "DISPLAY=", 8) || + !strncmp(ptr, "PULSE_", 6)) + putenv(ptr); + ptr += ret + 1; + } + } + + free(data); + close(fd); +} + +#ifndef GIOVANNI +int contapid = 13000; +#endif// GIOVANNI + +static int create_os(const char *slave_path, + size_t stream_size, size_t mmap_size, + pid_t pid, pid_t pgrp, uid_t uid, gid_t gid, + struct fuse_session *se, struct ossp_stream **osp) +{ + static pthread_mutex_t create_mutex = PTHREAD_MUTEX_INITIALIZER; + int cmd_sock[2] = { -1, -1 }; + int notify_sock[2] = { -1, -1 }; + struct ossp_stream *os = NULL; + struct epoll_event ev = { }; + int i, rc; + + /* + * Only one thread can be creating a stream. This is to avoid + * leaking unwanted fds into slaves. + */ + pthread_mutex_lock(&create_mutex); + + /* prepare communication channels */ + if (socketpair(AF_UNIX, SOCK_STREAM, 0, cmd_sock) || + socketpair(AF_UNIX, SOCK_STREAM, 0, notify_sock)) { + rc = -errno; + warn_e(rc, "failed to create slave command channel"); + goto close_all; + } + + if (fcntl(notify_sock[0], F_SETFL, O_NONBLOCK) < 0) { + rc = -errno; + warn_e(rc, "failed to set NONBLOCK on notify sock"); + goto close_all; + } + + /* + * Alloc stream which will be responsible for all server side + * resources from now on. + */ + rc = alloc_os(stream_size, mmap_size, pid, pgrp, uid, gid, cmd_sock[0], + notify_sock, se, &os); + if (rc) { + warn_e(rc, "failed to allocate stream for %d", pid); + goto close_all; + } + + rc = -ENOMEM; + os->mixer = get_mixer(pgrp); + if (!os->mixer) + goto put_os; + + /* + * Register notification. If successful, notify_poller has + * custody of notify_rx fd. + */ + pthread_mutex_lock(&mutex); + list_add(&os->notify_link, os_notify_tbl_head(os->notify_rx)); + pthread_mutex_unlock(&mutex); + +#ifndef GIOVANNI + os->slave_pid = contapid; + contapid++; + if(contapid > 30000) + contapid=13000; +#endif //GIOVANNI + +//#ifdef GIOVANNI + ev.events = EPOLLIN; + ev.data.fd = notify_sock[0]; + if (epoll_ctl(notify_epfd, EPOLL_CTL_ADD, notify_sock[0], &ev)) { + /* + * Without poller watching this notify sock, poller + * shutdown sequence in shutdown_notification() can't + * be used. Kill notification rx manually. + */ + rc = -errno; + warn_ose(os, rc, "failed to add notify epoll"); + close(os->notify_rx); + os->notify_rx = -1; + goto put_os; + } + + /* start slave */ + os->slave_pid = fork(); + if (os->slave_pid < 0) { + rc = -errno; + warn_ose(os, rc, "failed to fork slave"); + goto put_os; + } + + if (os->slave_pid == 0) { + /* child */ + char id_str[2][16], fd_str[3][16]; + char mmap_off_str[32], mmap_size_str[32]; + char log_str[16], slave_path_copy[PATH_MAX]; + char *argv[] = { slave_path_copy, "-u", id_str[0], + "-g", id_str[1], "-c", fd_str[0], + "-n", fd_str[1], "-m", fd_str[2], + "-o", mmap_off_str, "-s", mmap_size_str, + "-l", log_str, NULL, NULL }; + struct passwd *pwd; + + /* drop stuff we don't need */ + if (close(cmd_sock[0]) || close(notify_sock[0])) + fatal_e(-errno, "failed to close server pipe fds"); + +#ifdef OSSP_MMAP + if (!mmap_size) + close(fuse_mmap_fd(se)); +#endif + + clearenv(); + pwd = getpwuid(os->uid); + if (pwd) { + setenv("LOGNAME", pwd->pw_name, 1); + setenv("USER", pwd->pw_name, 1); + setenv("HOME", pwd->pw_dir, 1); + } + /* Set extra environment variables from the caller */ + set_extra_env(pid); + + /* prep and exec */ + slave_path_copy[sizeof(slave_path_copy) - 1] = '\0'; + strncpy(slave_path_copy, slave_path, sizeof(slave_path_copy) - 1); + if (slave_path_copy[sizeof(slave_path_copy) - 1] != '\0') { + rc = -errno; + err_ose(os, rc, "slave path too long"); + goto child_fail; + } + + snprintf(id_str[0], sizeof(id_str[0]), "%d", os->uid); + snprintf(id_str[1], sizeof(id_str[0]), "%d", os->gid); + snprintf(fd_str[0], sizeof(fd_str[0]), "%d", cmd_sock[1]); + snprintf(fd_str[1], sizeof(fd_str[1]), "%d", notify_sock[1]); + snprintf(fd_str[2], sizeof(fd_str[2]), "%d", +#ifdef OSSP_MMAP + mmap_size ? fuse_mmap_fd(se) : +#endif + -1); + snprintf(mmap_off_str, sizeof(mmap_off_str), "0x%llx", + (unsigned long long)os->mmap_off); + snprintf(mmap_size_str, sizeof(mmap_size_str), "0x%zx", + mmap_size); + snprintf(log_str, sizeof(log_str), "%d", ossp_log_level); + if (ossp_log_timestamp) + argv[ARRAY_SIZE(argv) - 2] = "-t"; + + execv(slave_path, argv); + rc = -errno; + err_ose(os, rc, "execv failed for <%d>", pid); + child_fail: + _exit(1); + } +//#endif //GIOVANNI + + /* turn on CLOEXEC on all server side fds */ + if (fcntl(os->cmd_fd, F_SETFD, FD_CLOEXEC) < 0 || + fcntl(os->notify_tx, F_SETFD, FD_CLOEXEC) < 0 || + fcntl(os->notify_rx, F_SETFD, FD_CLOEXEC) < 0) { + rc = -errno; + err_ose(os, rc, "failed to set CLOEXEC on server side fds"); + goto put_os; + } + + dbg0_os(os, "CREATE slave=%d %s", os->slave_pid, slave_path); + dbg0_os(os, " client=%d cmd=%d:%d notify=%d:%d mmap=%d:0x%llx:%zu", + pid, cmd_sock[0], cmd_sock[1], notify_sock[0], notify_sock[1], +#ifdef OSSP_MMAP + os->mmap_size ? fuse_mmap_fd(se) : +#endif + -1, + (unsigned long long)os->mmap_off, os->mmap_size); + + *osp = os; + rc = 0; + goto close_client_fds; + +put_os: + put_os(os); +close_client_fds: + close(cmd_sock[1]); + pthread_mutex_unlock(&create_mutex); + return rc; + +close_all: + for (i = 0; i < 2; i++) { + close(cmd_sock[i]); + close(notify_sock[i]); + } + pthread_mutex_unlock(&create_mutex); + return rc; +} + +static void dsp_open_common(fuse_req_t req, struct fuse_file_info *fi, + struct fuse_session *se) +{ + const struct fuse_ctx *fuse_ctx = fuse_req_ctx(req); + struct ossp_dsp_open_arg arg = { }; + struct ossp_stream *os = NULL; + struct ossp_mixer *mixer; + struct ossp_dsp_stream *dsps; + struct ossp_mixer_cmd mxcmd; + pid_t pgrp; + ssize_t ret; + + ret = get_proc_self_info(fuse_ctx->pid, &pgrp, NULL, 0); + if (ret) { + err_e(ret, "get_proc_self_info(%d) failed", fuse_ctx->pid); + goto err; + } + + ret = create_os(dsp_slave_path, sizeof(*dsps), DSPS_MMAP_SIZE, + fuse_ctx->pid, pgrp, fuse_ctx->uid, fuse_ctx->gid, + se, &os); + if (ret) + goto err; + dsps = os_to_dsps(os); + mixer = os->mixer; + + switch (fi->flags & O_ACCMODE) { + case O_WRONLY: + dsps->rw |= 1 << PLAY; + break; + case O_RDONLY: + dsps->rw |= 1 << REC; + break; + case O_RDWR: + dsps->rw |= (1 << PLAY) | (1 << REC); + break; + default: + assert(0); + } + + arg.flags = fi->flags; + arg.opener_pid = os->pid; + ret = exec_simple_cmd(&dsps->os, OSSP_DSP_OPEN, &arg, NULL); + if (ret < 0) { + put_os(os); + goto err; + } + + memcpy(os->vol, mixer->vol, sizeof(os->vol)); + if (os->vol[PLAY][0] >= 0 || os->vol[REC][0] >= 0) { + init_mixer_cmd(&mxcmd, mixer); + memcpy(mxcmd.set.vol, os->vol, sizeof(os->vol)); + exec_mixer_cmd(&mxcmd, os); + finish_mixer_cmd(&mxcmd); + } + + fi->direct_io = 1; + fi->nonseekable = 1; + fi->fh = os->id; + + fuse_reply_open(req, fi); + return; + +err: + fuse_reply_err(req, -ret); +} + +static void dsp_open(fuse_req_t req, struct fuse_file_info *fi) +{ + dsp_open_common(req, fi, dsp_se); +} + +static void adsp_open(fuse_req_t req, struct fuse_file_info *fi) +{ + dsp_open_common(req, fi, adsp_se); +} + +static void dsp_release(fuse_req_t req, struct fuse_file_info *fi) +{ + struct ossp_stream *os; + + os = find_os(fi->fh); + if (os) { + put_os(os); + fuse_reply_err(req, 0); + } else + fuse_reply_err(req, EBADF); +} + +static void dsp_read(fuse_req_t req, size_t size, off_t off, + struct fuse_file_info *fi) +{ + struct ossp_dsp_rw_arg arg = { }; + struct ossp_stream *os; + struct ossp_dsp_stream *dsps; + void *buf = NULL; + ssize_t ret; + + ret = -EBADF; + os = find_os(fi->fh); + if (!os) + goto out; + dsps = os_to_dsps(os); + + ret = -EINVAL; + if (!(dsps->rw & (1 << REC))) + goto out; + + ret = -ENXIO; + if (dsps->mmapped) + goto out; + + ret = -ENOMEM; + buf = malloc(size); + if (!buf) + goto out; + + arg.nonblock = (fi->flags & O_NONBLOCK) || dsps->nonblock; + + ret = exec_cmd(os, OSSP_DSP_READ, &arg, sizeof(arg), + NULL, 0, NULL, 0, buf, &size, -1); +out: + if (ret >= 0) + fuse_reply_buf(req, buf, size); + else + fuse_reply_err(req, -ret); + + free(buf); +} + +static void dsp_write(fuse_req_t req, const char *buf, size_t size, off_t off, + struct fuse_file_info *fi) +{ + struct ossp_dsp_rw_arg arg = { }; + struct ossp_stream *os; + struct ossp_dsp_stream *dsps; + ssize_t ret; + + ret = -EBADF; + os = find_os(fi->fh); + if (!os) + goto out; + dsps = os_to_dsps(os); + + ret = -EINVAL; + if (!(dsps->rw & (1 << PLAY))) + goto out; + + ret = -ENXIO; + if (dsps->mmapped) + goto out; + + arg.nonblock = (fi->flags & O_NONBLOCK) || dsps->nonblock; + + ret = exec_cmd(os, OSSP_DSP_WRITE, &arg, sizeof(arg), + buf, size, NULL, 0, NULL, NULL, -1); +out: + if (ret >= 0) + fuse_reply_write(req, ret); + else + fuse_reply_err(req, -ret); +} + +static void dsp_poll(fuse_req_t req, struct fuse_file_info *fi, + struct fuse_pollhandle *ph) +{ + int notify = ph != NULL; + unsigned revents = 0; + struct ossp_stream *os; + ssize_t ret; + + ret = -EBADF; + os = find_os(fi->fh); + if (!os) + goto out; + + if (ph) { + pthread_mutex_lock(&mutex); + if (os->ph) + fuse_pollhandle_destroy(os->ph); + os->ph = ph; + pthread_mutex_unlock(&mutex); + } + + ret = exec_simple_cmd(os, OSSP_DSP_POLL, ¬ify, &revents); +out: + if (ret >= 0) + fuse_reply_poll(req, revents); + else + fuse_reply_err(req, -ret); +} + +static void dsp_ioctl(fuse_req_t req, int signed_cmd, void *uarg, + struct fuse_file_info *fi, unsigned int flags, + const void *in_buf, size_t in_bufsz, size_t out_bufsz) +{ + /* some ioctl constants are long and has the highest bit set */ + unsigned cmd = signed_cmd; + struct ossp_stream *os; + struct ossp_dsp_stream *dsps; + enum ossp_opcode op; + ssize_t ret; + int i; + + ret = -EBADF; + os = find_os(fi->fh); + if (!os) + goto err; + dsps = os_to_dsps(os); + + /* mixer commands are allowed on DSP devices */ + if (((cmd >> 8) & 0xff) == 'M') { + mixer_do_ioctl(req, os->mixer, cmd, uarg, in_buf, in_bufsz, + out_bufsz); + return; + } + + /* and the rest */ + switch (cmd) { + case OSS_GETVERSION: + i = SNDRV_OSS_VERSION; + PREP_UARG(NULL, &i); + IOCTL_RETURN(0, &i); + + case SNDCTL_DSP_GETCAPS: + i = DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | +#ifdef OSSP_MMAP + DSP_CAP_MMAP | +#endif + DSP_CAP_MULTI; + PREP_UARG(NULL, &i); + IOCTL_RETURN(0, &i); + + case SNDCTL_DSP_NONBLOCK: + dsps->nonblock = 1; + ret = 0; + IOCTL_RETURN(0, NULL); + + case SNDCTL_DSP_RESET: op = OSSP_DSP_RESET; goto nd; + case SNDCTL_DSP_SYNC: op = OSSP_DSP_SYNC; goto nd; + case SNDCTL_DSP_POST: op = OSSP_DSP_POST; goto nd; + nd: + ret = exec_simple_cmd(&dsps->os, op, NULL, NULL); + if (ret) + goto err; + IOCTL_RETURN(0, NULL); + + case SOUND_PCM_READ_RATE: op = OSSP_DSP_GET_RATE; goto ri; + case SOUND_PCM_READ_BITS: op = OSSP_DSP_GET_FORMAT; goto ri; + case SOUND_PCM_READ_CHANNELS: op = OSSP_DSP_GET_CHANNELS; goto ri; + case SNDCTL_DSP_GETBLKSIZE: op = OSSP_DSP_GET_BLKSIZE; goto ri; + case SNDCTL_DSP_GETFMTS: op = OSSP_DSP_GET_FORMATS; goto ri; + case SNDCTL_DSP_GETTRIGGER: op = OSSP_DSP_GET_TRIGGER; goto ri; + ri: + PREP_UARG(NULL, &i); + ret = exec_simple_cmd(&dsps->os, op, NULL, &i); + if (ret) + goto err; + IOCTL_RETURN(0, &i); + + case SNDCTL_DSP_SPEED: op = OSSP_DSP_SET_RATE; goto wi; + case SNDCTL_DSP_SETFMT: op = OSSP_DSP_SET_FORMAT; goto wi; + case SNDCTL_DSP_CHANNELS: op = OSSP_DSP_SET_CHANNELS; goto wi; + case SNDCTL_DSP_SUBDIVIDE: op = OSSP_DSP_SET_SUBDIVISION; goto wi; + wi: + PREP_UARG(&i, &i); + ret = exec_simple_cmd(&dsps->os, op, &i, &i); + if (ret) + goto err; + IOCTL_RETURN(0, &i); + + case SNDCTL_DSP_STEREO: + PREP_UARG(NULL, &i); + i = 2; + ret = exec_simple_cmd(&dsps->os, OSSP_DSP_SET_CHANNELS, &i, &i); + i--; + if (ret) + goto err; + IOCTL_RETURN(0, &i); + + case SNDCTL_DSP_SETFRAGMENT: + PREP_UARG(&i, NULL); + ret = exec_simple_cmd(&dsps->os, + OSSP_DSP_SET_FRAGMENT, &i, NULL); + if (ret) + goto err; + IOCTL_RETURN(0, NULL); + + case SNDCTL_DSP_SETTRIGGER: + PREP_UARG(&i, NULL); + ret = exec_simple_cmd(&dsps->os, + OSSP_DSP_SET_TRIGGER, &i, NULL); + if (ret) + goto err; + IOCTL_RETURN(0, NULL); + + case SNDCTL_DSP_GETOSPACE: + case SNDCTL_DSP_GETISPACE: { + struct audio_buf_info info; + + ret = -EINVAL; + if (cmd == SNDCTL_DSP_GETOSPACE) { + if (!(dsps->rw & (1 << PLAY))) + goto err; + op = OSSP_DSP_GET_OSPACE; + } else { + if (!(dsps->rw & (1 << REC))) + goto err; + op = OSSP_DSP_GET_ISPACE; + } + + PREP_UARG(NULL, &info); + ret = exec_simple_cmd(&dsps->os, op, NULL, &info); + if (ret) + goto err; + IOCTL_RETURN(0, &info); + } + + case SNDCTL_DSP_GETOPTR: + case SNDCTL_DSP_GETIPTR: { + struct count_info info; + + op = cmd == SNDCTL_DSP_GETOPTR ? OSSP_DSP_GET_OPTR + : OSSP_DSP_GET_IPTR; + PREP_UARG(NULL, &info); + ret = exec_simple_cmd(&dsps->os, op, NULL, &info); + if (ret) + goto err; + IOCTL_RETURN(0, &info); + } + + case SNDCTL_DSP_GETODELAY: + PREP_UARG(NULL, &i); + i = 0; + ret = exec_simple_cmd(&dsps->os, OSSP_DSP_GET_ODELAY, NULL, &i); + IOCTL_RETURN(ret, &i); /* always copy out result, 0 on err */ + + case SOUND_PCM_WRITE_FILTER: + case SOUND_PCM_READ_FILTER: + ret = -EIO; + goto err; + + case SNDCTL_DSP_MAPINBUF: + case SNDCTL_DSP_MAPOUTBUF: + ret = -EINVAL; + goto err; + + case SNDCTL_DSP_SETSYNCRO: + case SNDCTL_DSP_SETDUPLEX: + case SNDCTL_DSP_PROFILE: + IOCTL_RETURN(0, NULL); + + default: + warn_os(os, "unknown ioctl 0x%x", cmd); + ret = -EINVAL; + goto err; + } + assert(0); /* control shouldn't reach here */ +err: + fuse_reply_err(req, -ret); +} + +#ifdef OSSP_MMAP +static int dsp_mmap_dir(int prot) +{ + if (!(prot & PROT_WRITE)) + return REC; + return PLAY; +} + +static void dsp_mmap(fuse_req_t req, void *addr, size_t len, int prot, + int flags, off_t offset, struct fuse_file_info *fi, + uint64_t mh) +{ + int dir = dsp_mmap_dir(prot); + struct ossp_dsp_mmap_arg arg = { }; + struct ossp_stream *os; + struct ossp_dsp_stream *dsps; + ssize_t ret; + + os = find_os(fi->fh); + if (!os) { + fuse_reply_err(req, EBADF); + return; + } + dsps = os_to_dsps(os); + + if (!os->mmap_off || len > os->mmap_size / 2) { + fuse_reply_err(req, EINVAL); + return; + } + + pthread_mutex_lock(&os->mmap_mutex); + + ret = -EBUSY; + if (dsps->mmapped & (1 << dir)) + goto out_unlock; + + arg.dir = dir; + arg.size = len; + + ret = exec_simple_cmd(os, OSSP_DSP_MMAP, &arg, NULL); + if (ret == 0) + dsps->mmapped |= 1 << dir; + +out_unlock: + pthread_mutex_unlock(&os->mmap_mutex); + + if (ret == 0) + fuse_reply_mmap(req, os->mmap_off + dir * os->mmap_size / 2, 0); + else + fuse_reply_err(req, -ret); +} + +static void dsp_munmap(fuse_req_t req, size_t len, struct fuse_file_info *fi, + off_t offset, uint64_t mh) +{ + struct ossp_stream *os; + struct ossp_dsp_stream *dsps; + int dir, rc; + + os = find_os(fi->fh); + if (!os) + goto out; + dsps = os_to_dsps(os); + + pthread_mutex_lock(&os->mmap_mutex); + + for (dir = 0; dir < 2; dir++) + if (offset == os->mmap_off + dir * os->mmap_size / 2) + break; + if (dir == 2 || len > os->mmap_size / 2) { + warn_os(os, "invalid munmap request " + "offset=%llu len=%zu mmapped=0x%x", + (unsigned long long)offset, len, dsps->mmapped); + goto out_unlock; + } + + rc = exec_simple_cmd(os, OSSP_DSP_MUNMAP, &dir, NULL); + if (rc) + warn_ose(os, rc, "MUNMAP failed for dir=%d", dir); + + dsps->mmapped &= ~(1 << dir); + +out_unlock: + pthread_mutex_unlock(&os->mmap_mutex); +out: + fuse_reply_none(req); +} +#endif + + +/*************************************************************************** + * Notify poller + */ + +static void *notify_poller(void *arg) +{ + struct epoll_event events[1024]; + int i, nfds; + +repeat: + nfds = epoll_wait(notify_epfd, events, ARRAY_SIZE(events), -1); + for (i = 0; i < nfds; i++) { + int do_notify = 0; + struct ossp_stream *os; + struct ossp_notify notify; + ssize_t ret; + + os = find_os_by_notify_rx(events[i].data.fd); + if (!os) { + err("can't find stream for notify_rx fd %d", + events[i].data.fd); + epoll_ctl(notify_epfd, EPOLL_CTL_DEL, events[i].data.fd, + NULL); + /* we don't know what's going on, don't close the fd */ + continue; + } + + while ((ret = read(os->notify_rx, + ¬ify, sizeof(notify))) > 0) { + if (os->dead) + continue; + if (ret != sizeof(notify)) { + warn_os(os, "short read on notify_rx (%zu, " + "expected %zu), killing the stream", + ret, sizeof(notify)); + os->dead = 1; + break; + } + if (notify.magic != OSSP_NOTIFY_MAGIC) { + warn_os(os, "invalid magic on notification, " + "killing the stream"); + os->dead = 1; + break; + } + + if (notify.opcode >= OSSP_NR_NOTIFY_OPCODES) + goto unknown; + + dbg1_os(os, "NOTIFY %s", ossp_notify_str[notify.opcode]); + + switch (notify.opcode) { + case OSSP_NOTIFY_POLL: + do_notify = 1; + break; + case OSSP_NOTIFY_OBITUARY: + os->dead = 1; + break; + case OSSP_NOTIFY_VOLCHG: + pthread_mutex_lock(&mixer_mutex); + os->mixer->modify_counter++; + pthread_mutex_unlock(&mixer_mutex); + break; + default: + unknown: + warn_os(os, "unknown notification %d", + notify.opcode); + } + } + if (ret == 0) + os->dead = 1; + else if (ret < 0 && errno != EAGAIN) { + warn_ose(os, -errno, "read fail on notify fd"); + os->dead = 1; + } + + if (!do_notify && !os->dead) + continue; + + pthread_mutex_lock(&mutex); + + if (os->ph) { + fuse_lowlevel_notify_poll(os->ph); + fuse_pollhandle_destroy(os->ph); + os->ph = NULL; + } + + if (os->dead) { + dbg0_os(os, "removing %d from notify poll list", + os->notify_rx); + epoll_ctl(notify_epfd, EPOLL_CTL_DEL, os->notify_rx, + NULL); + close(os->notify_rx); + os->notify_rx = -1; + pthread_cond_broadcast(¬ify_poller_kill_wait); + } + + pthread_mutex_unlock(&mutex); + } + goto repeat; +} + + +/*************************************************************************** + * Slave corpse reaper + */ + +static void *slave_reaper(void *arg) +{ + struct ossp_stream *os; + int status; + pid_t pid; + + pthread_mutex_lock(&mutex); +repeat: + while (list_empty(&slave_corpse_list)) + pthread_cond_wait(&slave_reaper_wait, &mutex); + + os = list_first_entry(&slave_corpse_list, struct ossp_stream, link); + list_del_init(&os->link); + + pthread_mutex_unlock(&mutex); + + do { + pid = waitpid(os->slave_pid, &status, 0); + } while (pid < 0 && errno == EINTR); + + if (pid < 0) { + if (errno == ECHILD) + warn_ose(os, -errno, "slave %d already gone?", + os->slave_pid); + else + fatal_e(-errno, "waitpid(%d) failed", os->slave_pid); + } + + pthread_mutex_lock(&mutex); + + dbg1_os(os, "slave %d reaped", os->slave_pid); + __clear_bit(os->id, os_id_bitmap); + free(os); + + goto repeat; +} + + +/*************************************************************************** + * Stuff to bind and start everything + */ + +static void ossp_daemonize(void) +{ + int fd, pfd[2]; + pid_t pid; + ssize_t ret; + int err; + + fd = open("/dev/null", O_RDWR); + if (fd >= 0) { + dup2(fd, 0); + dup2(fd, 1); + dup2(fd, 2); + if (fd > 2) + close(fd); + } + + if (pipe(pfd)) + fatal_e(-errno, "failed to create pipe for init wait"); + + if (fcntl(pfd[0], F_SETFD, FD_CLOEXEC) < 0 || + fcntl(pfd[1], F_SETFD, FD_CLOEXEC) < 0) + fatal_e(-errno, "failed to set CLOEXEC on init wait pipe"); + + pid = fork(); + if (pid < 0) + fatal_e(-errno, "failed to fork for daemon"); + + if (pid == 0) { + close(pfd[0]); + init_wait_fd = pfd[1]; + + /* be evil, my child */ + chdir("/"); + setsid(); + return; + } + + /* wait for init completion and pass over success indication */ + close(pfd[1]); + + do { + ret = read(pfd[0], &err, sizeof(err)); + } while (ret < 0 && errno == EINTR); + + if (ret == sizeof(err) && err == 0) + exit(0); + + fatal("daemon init failed ret=%zd err=%d", ret, err); + exit(1); +} + +static void ossp_init_done(void *userdata) +{ + /* init complete, notify parent if it's waiting */ + if (init_wait_fd >= 0) { + ssize_t ret; + int err = 0; + + ret = write(init_wait_fd, &err, sizeof(err)); + if (ret != sizeof(err)) + fatal_e(-errno, "failed to notify init completion, " + "ret=%zd", ret); + close(init_wait_fd); + init_wait_fd = -1; + } +} + +static const struct cuse_lowlevel_ops mixer_ops = { + .open = mixer_open, + .release = mixer_release, + .ioctl = mixer_ioctl, +}; + +static const struct cuse_lowlevel_ops dsp_ops = { + .init_done = ossp_init_done, + .open = dsp_open, + .release = dsp_release, + .read = dsp_read, + .write = dsp_write, + .poll = dsp_poll, + .ioctl = dsp_ioctl, +#ifdef OSSP_MMAP + .mmap = dsp_mmap, + .munmap = dsp_munmap, +#endif +}; + +static const struct cuse_lowlevel_ops adsp_ops = { + .open = adsp_open, + .release = dsp_release, + .read = dsp_read, + .write = dsp_write, + .poll = dsp_poll, + .ioctl = dsp_ioctl, +#ifdef OSSP_MMAP + .mmap = dsp_mmap, + .munmap = dsp_munmap, +#endif +}; + +static const char *usage = +"usage: osspd [options]\n" +"\n" +"options:\n" +" --help print this help message\n" +" --dsp=NAME DSP device name (default dsp)\n" +" --dsp-maj=MAJ DSP device major number (default 14)\n" +" --dsp-min=MIN DSP device minor number (default 3)\n" +" --adsp=NAME Aux DSP device name (default adsp, blank to disable)\n" +" --adsp-maj=MAJ Aux DSP device major number (default 14)\n" +" --adsp-min=MIN Aux DSP device minor number (default 12)\n" +" --mixer=NAME mixer device name (default mixer, blank to disable)\n" +" --mixer-maj=MAJ mixer device major number (default 14)\n" +" --mixer-min=MIN mixer device minor number (default 0)\n" +" --max=MAX maximum number of open streams (default 256)\n" +" --umax=MAX maximum number of open streams per UID (default --max)\n" +" --exit-on-idle exit if idle\n" +" --dsp-slave=PATH DSP slave (default ossp-padsp in the same dir)\n" +" --log=LEVEL log level (0..6)\n" +" --timestamp timestamp log messages\n" +" -v increase verbosity, can be specified multiple times\n" +" -f Run in foreground (don't daemonize)\n" +"\n"; + +struct ossp_param { + char *dsp_name; + unsigned dsp_major; + unsigned dsp_minor; + char *adsp_name; + unsigned adsp_major; + unsigned adsp_minor; + char *mixer_name; + unsigned mixer_major; + unsigned mixer_minor; + unsigned max_streams; + unsigned umax_streams; + char *dsp_slave_path; + unsigned log_level; + int exit_on_idle; + int timestamp; + int fg; + int help; +}; + +#define OSSP_OPT(t, p) { t, offsetof(struct ossp_param, p), 1 } + +static const struct fuse_opt ossp_opts[] = { + OSSP_OPT("--dsp=%s", dsp_name), + OSSP_OPT("--dsp-maj=%u", dsp_major), + OSSP_OPT("--dsp-min=%u", dsp_minor), + OSSP_OPT("--adsp=%s", adsp_name), + OSSP_OPT("--adsp-maj=%u", adsp_major), + OSSP_OPT("--adsp-min=%u", adsp_minor), + OSSP_OPT("--mixer=%s", mixer_name), + OSSP_OPT("--mixer-maj=%u", mixer_major), + OSSP_OPT("--mixer-min=%u", mixer_minor), + OSSP_OPT("--max=%u", max_streams), + OSSP_OPT("--umax=%u", umax_streams), + OSSP_OPT("--exit-on-idle", exit_on_idle), + OSSP_OPT("--dsp-slave=%s", dsp_slave_path), + OSSP_OPT("--timestamp", timestamp), + OSSP_OPT("--log=%u", log_level), + OSSP_OPT("-f", fg), + FUSE_OPT_KEY("-h", 0), + FUSE_OPT_KEY("--help", 0), + FUSE_OPT_KEY("-v", 1), + FUSE_OPT_END +}; + +static struct fuse_session *setup_ossp_cuse(const struct cuse_lowlevel_ops *ops, + const char *name, int major, + int minor, int argc, char **argv) +{ + char name_buf[128]; + const char *bufp = name_buf; + struct cuse_info ci = { .dev_major = major, .dev_minor = minor, + .dev_info_argc = 1, .dev_info_argv = &bufp, + .flags = CUSE_UNRESTRICTED_IOCTL }; + struct fuse_session *se; + int fd; + + snprintf(name_buf, sizeof(name_buf), "DEVNAME=%s", name); + + se = cuse_lowlevel_setup(argc, argv, &ci, ops, NULL, NULL); + if (!se) { + err("failed to setup %s CUSE", name); + return NULL; + } + + fd = fuse_chan_fd(fuse_session_next_chan(se, NULL)); + if ( +#ifdef OSSP_MMAP + fd != fuse_mmap_fd(se) && +#endif + fcntl(fd, F_SETFD, FD_CLOEXEC) < 0) { + err_e(-errno, "failed to set CLOEXEC on %s CUSE fd", name); + cuse_lowlevel_teardown(se); + return NULL; + } + + return se; +} + +static void *cuse_worker(void *arg) +{ + struct fuse_session *se = arg; + int rc; + + rc = fuse_session_loop_mt(se); + cuse_lowlevel_teardown(se); + + return (void *)(unsigned long)rc; +} + +static int process_arg(void *data, const char *arg, int key, + struct fuse_args *outargs) +{ + struct ossp_param *param = data; + + switch (key) { + case 0: + fprintf(stderr, usage); + param->help = 1; + return 0; + case 1: + param->log_level++; + return 0; + } + return 1; +} + +int main(int argc, char **argv) +{ + static struct ossp_param param = { + .dsp_name = DFL_DSP_NAME, + .dsp_major = DFL_DSP_MAJOR, .dsp_minor = DFL_DSP_MINOR, + .adsp_name = DFL_ADSP_NAME, + .adsp_major = DFL_ADSP_MAJOR, .adsp_minor = DFL_ADSP_MINOR, + .mixer_name = DFL_MIXER_NAME, + .mixer_major = DFL_MIXER_MAJOR, .mixer_minor = DFL_MIXER_MINOR, + .max_streams = DFL_MAX_STREAMS, + }; + struct fuse_args args = FUSE_ARGS_INIT(argc, argv); + char path_buf[PATH_MAX], *dir; + char adsp_buf[64] = "", mixer_buf[64] = ""; + struct sigaction sa; + struct stat stat_buf; + ssize_t ret; + unsigned u; + + snprintf(ossp_log_name, sizeof(ossp_log_name), "osspd"); + param.log_level = ossp_log_level; + + if (fuse_opt_parse(&args, ¶m, ossp_opts, process_arg)) + fatal("failed to parse arguments"); + + if (param.help) + return 0; + + max_streams = param.max_streams; + hashtbl_size = max_streams / 2 + 13; + + umax_streams = max_streams; + if (param.umax_streams) + umax_streams = param.umax_streams; + if (param.log_level > OSSP_LOG_MAX) + param.log_level = OSSP_LOG_MAX; + if (!param.fg) + param.log_level = -param.log_level; + ossp_log_level = param.log_level; + ossp_log_timestamp = param.timestamp; + + if (!param.fg) + ossp_daemonize(); + + /* daemonization already handled, prevent forking inside FUSE */ + fuse_opt_add_arg(&args, "-f"); + + info("OSS Proxy v%s (C) 2008-2010 by Tejun Heo <teheo@suse.de>", + OSSP_VERSION); + + /* ignore stupid SIGPIPEs */ + memset(&sa, 0, sizeof(sa)); + sa.sa_handler = SIG_IGN; + if (sigaction(SIGPIPE, &sa, NULL)) + fatal_e(-errno, "failed to ignore SIGPIPE"); + +//#ifdef GIOVANNI + /* determine slave path and check for availability */ + ret = readlink("/proc/self/exe", path_buf, PATH_MAX - 1); + if (ret < 0) + fatal_e(-errno, "failed to determine executable path"); + path_buf[ret] = '\0'; + dir = dirname(path_buf); + + if (param.dsp_slave_path) { + strncpy(dsp_slave_path, param.dsp_slave_path, PATH_MAX - 1); + dsp_slave_path[PATH_MAX - 1] = '\0'; + } else { + ret = snprintf(dsp_slave_path, PATH_MAX, "%s/%s", + dir, "ossp-padsp"); + if (ret >= PATH_MAX) + fatal("dsp slave pathname too long"); + } + + if (stat(dsp_slave_path, &stat_buf)) + fatal_e(-errno, "failed to stat %s", dsp_slave_path); + if (!S_ISREG(stat_buf.st_mode) || !(stat_buf.st_mode & 0444)) + fatal("%s is not executable", dsp_slave_path); + +//#endif// GIOVANNI + /* allocate tables */ + os_id_bitmap = calloc(BITS_TO_LONGS(max_streams), sizeof(long)); + mixer_tbl = calloc(hashtbl_size, sizeof(mixer_tbl[0])); + os_tbl = calloc(hashtbl_size, sizeof(os_tbl[0])); + os_pgrp_tbl = calloc(hashtbl_size, sizeof(os_pgrp_tbl[0])); + os_notify_tbl = calloc(hashtbl_size, sizeof(os_notify_tbl[0])); + if (!os_id_bitmap || !mixer_tbl || !os_tbl || !os_pgrp_tbl || + !os_notify_tbl) + fatal("failed to allocate stream hash tables"); + for (u = 0; u < hashtbl_size; u++) { + INIT_LIST_HEAD(&mixer_tbl[u]); + INIT_LIST_HEAD(&os_tbl[u]); + INIT_LIST_HEAD(&os_pgrp_tbl[u]); + INIT_LIST_HEAD(&os_notify_tbl[u]); + } + __set_bit(0, os_id_bitmap); /* don't use id 0 */ + + /* create mixer delayed reference worker */ + ret = -pthread_create(&mixer_delayed_put_thread, NULL, + mixer_delayed_put_worker, NULL); + if (ret) + fatal_e(ret, "failed to create mixer delayed put worker"); + + /* if exit_on_idle, touch mixer for pgrp0 */ + exit_on_idle = param.exit_on_idle; + if (exit_on_idle) { + struct ossp_mixer *mixer; + + mixer = get_mixer(0); + if (!mixer) + fatal("failed to touch idle mixer"); + put_mixer(mixer); + } + + /* create notify epoll and kick off watcher thread */ + notify_epfd = epoll_create(max_streams); + if (notify_epfd < 0) + fatal_e(-errno, "failed to create notify epoll"); + if (fcntl(notify_epfd, F_SETFD, FD_CLOEXEC) < 0) + fatal_e(-errno, "failed to set CLOEXEC on notify epfd"); + + ret = -pthread_create(¬ify_poller_thread, NULL, notify_poller, NULL); + if (ret) + fatal_e(ret, "failed to create notify poller thread"); + + /* create reaper for slave corpses */ + ret = -pthread_create(&slave_reaper_thread, NULL, slave_reaper, NULL); + if (ret) + fatal_e(ret, "failed to create slave reaper thread"); + +#ifdef GIOVANNI + /* we're set, let's setup fuse structures */ + if (strlen(param.mixer_name)) + mixer_se = setup_ossp_cuse(&mixer_ops, param.mixer_name, + param.mixer_major, param.mixer_minor, + args.argc, args.argv); + if (strlen(param.adsp_name)) + adsp_se = setup_ossp_cuse(&dsp_ops, param.adsp_name, + param.adsp_major, param.adsp_minor, + args.argc, args.argv); + +#endif// GIOVANNI + dsp_se = setup_ossp_cuse(&dsp_ops, param.dsp_name, + param.dsp_major, param.dsp_minor, + args.argc, args.argv); + if (!dsp_se) + fatal("can't create dsp, giving up"); + +#ifdef GIOVANNI + if (mixer_se) + snprintf(mixer_buf, sizeof(mixer_buf), ", %s (%d:%d)", + param.mixer_name, param.mixer_major, param.mixer_minor); + if (adsp_se) + snprintf(adsp_buf, sizeof(adsp_buf), ", %s (%d:%d)", + param.adsp_name, param.adsp_major, param.adsp_minor); + +#endif// GIOVANNI + info("Creating %s (%d:%d)%s%s", param.dsp_name, param.dsp_major, + param.dsp_minor, adsp_buf, mixer_buf); + +#ifdef GIOVANNI + /* start threads for mixer and adsp */ + if (mixer_se) { + ret = -pthread_create(&cuse_mixer_thread, NULL, + cuse_worker, mixer_se); + if (ret) + err_e(ret, "failed to create mixer worker"); + } + if (adsp_se) { + ret = -pthread_create(&cuse_adsp_thread, NULL, + cuse_worker, adsp_se); + if (ret) + err_e(ret, "failed to create adsp worker"); + } +#endif// GIOVANNI + + /* run CUSE for /dev/dsp in the main thread */ + ret = (ssize_t)cuse_worker(dsp_se); + if (ret < 0) + fatal("dsp worker failed"); + return 0; +} commit c7aefe934fc6d603b7756406528f6881af198b0b Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Fri Nov 26 06:44:57 2010 -0600 gsmopen: retry serial initialization if failed, zeroing audio buffers, slower retry on soundcard busy (EAGAIN) diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen.h b/src/mod/endpoints/mod_gsmopen/gsmopen.h index fd94bcc..05ef164 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen.h +++ b/src/mod/endpoints/mod_gsmopen/gsmopen.h @@ -158,7 +158,7 @@ typedef enum { #define WARNINGA(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "rev "GSMOPEN_SVN_VERSION "[%p|%-7lx][WARNINGA %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ ); #define NOTICA(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "rev "GSMOPEN_SVN_VERSION "[%p|%-7lx][NOTICA %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ ); -#define GSMOPEN_P_LOG NULL, (unsigned long)55, __LINE__, tech_pvt ? tech_pvt->name ? tech_pvt->name : "none" : "none", -1, tech_pvt ? tech_pvt->interface_state : -1, tech_pvt ? tech_pvt->phone_callflow : -1 +#define GSMOPEN_P_LOG (void *)NULL, (unsigned long)55, __LINE__, tech_pvt ? tech_pvt->name ? tech_pvt->name : "none" : "none", -1, tech_pvt ? tech_pvt->interface_state : -1, tech_pvt ? tech_pvt->phone_callflow : -1 /*********************************/ #define GSMOPEN_CAUSE_NORMAL 1 diff --git a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp index e4bb6b9..76d32ac 100644 --- a/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp +++ b/src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp @@ -3294,12 +3294,18 @@ int alsa_write(private_t * tech_pvt, short *data, int datalen) time_t now_timestamp; /* size_t frames = 0; */ snd_pcm_state_t state; - snd_pcm_sframes_t delayp1; - snd_pcm_sframes_t delayp2; + snd_pcm_sframes_t delayp1=0; + snd_pcm_sframes_t delayp2=0; if(tech_pvt->no_sound==1){ return res; } + + + memset(sizbuf, 255, sizeof(sizbuf)); + memset(sizbuf2, 255, sizeof(sizbuf)); + memset(silencebuf, 255, sizeof(sizbuf)); + //ERRORA("data=%p, datalen=%d\n", GSMOPEN_P_LOG, (void *)data, datalen); /* We have to digest the frame in 160-byte portions */ if (datalen > sizeof(sizbuf) - sizpos) { @@ -3307,8 +3313,11 @@ int alsa_write(private_t * tech_pvt, short *data, int datalen) res = -1; } else { memcpy(sizbuf + sizpos, data, datalen); + memset(data, 255, datalen); len += datalen; pos = 0; + + #ifdef ALSA_MONITOR alsa_monitor_write(sizbuf, len); #endif @@ -3456,6 +3465,7 @@ int alsa_write(private_t * tech_pvt, short *data, int datalen) if (res == -ESTRPIPE) { ERRORA("You've got some big problems\n", GSMOPEN_P_LOG); } else if (res == -EAGAIN) { + DEBUGA_GSMOPEN("Momentarily busy\n", GSMOPEN_P_LOG); res = 0; } else if (res < 0) { ERRORA("Error %d on audio write: \"%s\"\n", GSMOPEN_P_LOG, res, snd_strerror(res)); @@ -3572,9 +3582,11 @@ int alsa_read(private_t * tech_pvt, short *data, int datalen) return r; } else if (r == -EAGAIN) { - DEBUGA_GSMOPEN("ALSA read -EAGAIN, the soundcard is not ready to be read by gsmopen\n", GSMOPEN_P_LOG); + int count=0; while (r == -EAGAIN) { - gsmopen_sleep(1000); + gsmopen_sleep(10000); + DEBUGA_GSMOPEN("%d ALSA read -EAGAIN, the soundcard is not ready to be read by gsmopen\n", GSMOPEN_P_LOG, count); + count++; if (tech_pvt->alsa_capture_is_mono) { r = snd_pcm_readi(tech_pvt->alsac, buf + readpos, left); diff --git a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp index cb440d3..7e20b7c 100644 --- a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp +++ b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp @@ -1904,14 +1904,25 @@ static switch_status_t load_config(int reload_type) if (globals.GSMOPEN_INTERFACES[interface_id].controldevprotocol != PROTOCOL_NO_SERIAL) { res = gsmopen_serial_config(&globals.GSMOPEN_INTERFACES[interface_id]); if (res) { - ERRORA("gsmopen_serial_config failed\n", GSMOPEN_P_LOG); - ERRORA("STARTING interface_id=%d FAILED\n", GSMOPEN_P_LOG, interface_id); - //return SWITCH_STATUS_FALSE; - globals.GSMOPEN_INTERFACES[interface_id].running=0; - alarm_event(&globals.GSMOPEN_INTERFACES[interface_id], ALARM_FAILED_INTERFACE, "gsmopen_serial_config failed"); - globals.GSMOPEN_INTERFACES[interface_id].active=0; - globals.GSMOPEN_INTERFACES[interface_id].name[0]='\0'; - continue; + int count = 0; + ERRORA("gsmopen_serial_config failed, let's try again\n", GSMOPEN_P_LOG); + while(res && count < 5){ + switch_sleep(100000); //0.1 seconds + res = gsmopen_serial_config(&globals.GSMOPEN_INTERFACES[interface_id]); + count++; + if (res) { + ERRORA("%d: gsmopen_serial_config failed, let's try again\n", GSMOPEN_P_LOG, count); + } + } + if (res) { + ERRORA("STARTING interface_id=%d FAILED\n", GSMOPEN_P_LOG, interface_id); + //return SWITCH_STATUS_FALSE; + globals.GSMOPEN_INTERFACES[interface_id].running=0; + alarm_event(&globals.GSMOPEN_INTERFACES[interface_id], ALARM_FAILED_INTERFACE, "gsmopen_serial_config failed"); + globals.GSMOPEN_INTERFACES[interface_id].active=0; + globals.GSMOPEN_INTERFACES[interface_id].name[0]='\0'; + continue; + } } } commit 54a3c95cb0aeb52ca1b8f6cbb80ca0e5d0afdf39 Author: Moises Silva <moy@sangoma.com> Date: Thu Nov 25 23:42:36 2010 -0500 freetdm: add r2 loop timing statistics diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index f089846..06d1abd 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -123,11 +123,13 @@ typedef struct ftdm_r2_data_s { /* whether accept the call when offered, or wait until the user decides to accept */ int accept_on_offer:1; /* max time spent in ms doing real work in a single loop */ - int jobmax; - /* total working loops */ - unsigned long loops; + int32_t jobmax; + /* Total number of loops performed so far */ + uint64_t total_loops; + /* number of loops per 10ms increment from 0-9ms, 10-19ms .. 100ms and above */ + uint64_t loops[11]; /* LWP */ - unsigned long monitor_thread_id; + uint32_t monitor_thread_id; } ftdm_r2_data_t; /* one element per span will be stored in g_mod_data_hash global var to keep track of them @@ -1356,8 +1358,9 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) int waitms = 20; unsigned int i; int res, ms; + int index = 0; struct timeval start, end; - short *poll_events = ftdm_malloc(sizeof(short)*span->chan_count); + short *poll_events = ftdm_malloc(sizeof(short) * span->chan_count); #ifdef __linux__ r2data->monitor_thread_id = syscall(SYS_gettid); @@ -1374,14 +1377,20 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) memset(&start, 0, sizeof(start)); memset(&end, 0, sizeof(end)); while (ftdm_running() && ftdm_test_flag(r2data, FTDM_R2_RUNNING)) { - r2data->loops++; res = gettimeofday(&end, NULL); if (start.tv_sec) { ms = ((end.tv_sec - start.tv_sec) * 1000) + ((( 1000000 + end.tv_usec - start.tv_usec) / 1000) - 1000); + if (ms < 0) { + ms = 0; + } if (ms > r2data->jobmax) { r2data->jobmax = ms; } + index = (ms / 10); + index = (index > 10) ? 10 : index; + r2data->loops[index]++; + r2data->total_loops++; } #ifndef WIN32 @@ -1576,7 +1585,7 @@ static FIO_API_FUNCTION(ftdm_r2_api) goto done; } if (!(r2data = span->signal_data)) { - stream->write_function(stream, "-ERR invalid span. No R2 singal data in span.\n"); + stream->write_function(stream, "-ERR invalid span. No R2 signal data in span.\n"); goto done; } r2context = r2data->r2context; @@ -1587,19 +1596,17 @@ static FIO_API_FUNCTION(ftdm_r2_api) "Max DNIS: %d\n" "ANI First: %s\n" "Immediate Accept: %s\n" - "Side: %s\n" + "Job Thread: %lu\n" "Job Max ms: %d\n" - "Job Loops: %lu\n" - "Monitor Thread: %lu\n", + "Job Loops: %lu\n", openr2_proto_get_variant_string(r2variant), openr2_context_get_max_ani(r2context), openr2_context_get_max_dnis(r2context), openr2_context_get_ani_first(r2context) ? "Yes" : "No", openr2_context_get_immediate_accept(r2context) ? "Yes" : "No", - "no side", + r2data->monitor_thread_id, r2data->jobmax, - r2data->loops, - r2data->monitor_thread_id); + r2data->total_loops); stream->write_function(stream, "\n"); stream->write_function(stream, "%4s %-12.12s %-12.12s\n", "Channel", "Tx CAS", "Rx CAS"); for (i = 1; i <= span->chan_count; i++) { @@ -1618,6 +1625,37 @@ static FIO_API_FUNCTION(ftdm_r2_api) } } + if (!strcasecmp(argv[0], "loopstats")) { + int range; + span_id = atoi(argv[1]); + + if (ftdm_span_find_by_name(argv[1], &span) == FTDM_SUCCESS || ftdm_span_find(span_id, &span) == FTDM_SUCCESS) { + if (span->start != ftdm_r2_start) { + stream->write_function(stream, "-ERR not an R2 span.\n"); + goto done; + } + if (!(r2data = span->signal_data)) { + stream->write_function(stream, "-ERR invalid span. No R2 signal data in span.\n"); + goto done; + } + range = 0; + for (i = 0; i < ftdm_array_len(r2data->loops); i++) { + if ((i + 1) == ftdm_array_len(r2data->loops)) { + stream->write_function(stream, ">= %dms: %llu\n", range, r2data->loops[i]); + } else { + stream->write_function(stream, "%d-%dms: %llu\n", range, range + 9, r2data->loops[i]); + } + range += 10; + } + stream->write_function(stream, "\n"); + stream->write_function(stream, "+OK.\n"); + goto done; + } else { + stream->write_function(stream, "-ERR invalid span.\n"); + goto done; + } + } + } if (argc == 1) { commit ca2370d0a6bd88a1121f242cf854dbb8c636a734 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Nov 25 22:11:20 2010 -0200 freetdm: when protocol errors occurs on ftmod_r2, the channel state is properly set as down now diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index bfe49fd..f089846 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -67,9 +67,9 @@ typedef struct ftdm_r2_call_t { ftdm_r2_call_flag_t flags; int accepted:1; int answer_pending:1; - int state_ack_pending:1; int disconnect_rcvd:1; int ftdm_started:1; + int protocol_error:1; ftdm_channel_state_t chanstate; ftdm_size_t dnis_index; ftdm_size_t ani_index; @@ -456,10 +456,12 @@ static void ftdm_r2_on_call_accepted(openr2_chan_t *r2chan, openr2_call_mode_t m openr2_chan_disable_read(r2chan); R2CALL(ftdmchan)->accepted = 1; if (OR2_DIR_BACKWARD == openr2_chan_get_direction(r2chan)) { - R2CALL(ftdmchan)->state_ack_pending = 1; + ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE); + ftdm_channel_complete_state(ftdmchan); if (R2CALL(ftdmchan)->answer_pending) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Answer was pending, answering now.\n"); ft_r2_answer_call(ftdmchan); + R2CALL(ftdmchan)->answer_pending = 0; return; } } else { @@ -522,7 +524,7 @@ static void ftdm_r2_on_call_end(openr2_chan_t *r2chan) ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "Call finished\n"); /* the call is done as far as the stack is concerned, lets move to down here */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); /* in some circumstances openr2 can call on_call_init right after this, so let's advance the state right here */ ftdm_r2_state_advance(ftdmchan); @@ -560,6 +562,7 @@ static void ftdm_r2_on_protocol_error(openr2_chan_t *r2chan, openr2_protocol_err ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Protocol error\n"); R2CALL(ftdmchan)->disconnect_rcvd = 1; + R2CALL(ftdmchan)->protocol_error = 1; if (!R2CALL(ftdmchan)->ftdm_started) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); @@ -1173,13 +1176,13 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) ret = 0; - if (R2CALL(ftdmchan)->state_ack_pending) { - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE); - ftdm_channel_complete_state(ftdmchan); - R2CALL(ftdmchan)->state_ack_pending = 0; - } - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE) && (R2CALL(ftdmchan)->chanstate != ftdmchan->state)) { + /* because we do not always acknowledge the state change (clearing the FTDM_CHANNEL_STATE_CHANGE flag) due to the accept + * procedure described below, we need the chanstate member to NOT process some states twice, so is valid entering this + * function with the FTDM_CHANNEL_STATE_CHANGE flag set but with a state that was already processed and is just waiting + * to complete (the processing is media-bound) + * */ + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE) + && (R2CALL(ftdmchan)->chanstate != ftdmchan->state)) { ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Executing state handler for %s\n", ftdm_channel_state2str(ftdmchan->state)); R2CALL(ftdmchan)->chanstate = ftdmchan->state; @@ -1188,10 +1191,15 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) (ftdmchan->state == FTDM_CHANNEL_STATE_PROGRESS || ftdmchan->state == FTDM_CHANNEL_STATE_PROGRESS_MEDIA || ftdmchan->state == FTDM_CHANNEL_STATE_UP) ) { - /* if an accept ack will be required we should not acknowledge the state change just yet, - it will be done below after processing the MF signals, otherwise we have a race condition between freetdm calling - openr2_chan_answer_call and openr2 accepting the call first, if freetdm calls openr2_chan_answer_call before the accept cycle - completes, openr2 will fail to answer the call */ + /* + Moving to PROGRESS, PROGRESS_MEDIA or UP means that we must accept the call, and accepting + the call in R2 means sending a tone, then waiting for the acknowledge from the other end, + since all of that requires sending and detecting tones, it takes a few milliseconds (I'd say around 100) + which means during that time the user should not try to perform any operations like answer, hangup or anything + else, therefore we DO NOT clear the FTDM_CHANNEL_STATE_CHANGE flag here, we rely on ftdm_io.c to block + the user thread until we're done with the accept (see on_call_accepted callback) and then we clear the state change flag, + otherwise we have a race condition between freetdm calling openr2_chan_answer_call and openr2 accepting the call first, + if freetdm calls openr2_chan_answer_call before the accept cycle completes, openr2 will fail to answer the call */ ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "State ack for state %s will have to wait a bit\n", ftdm_channel_state2str(ftdmchan->state)); } else if (ftdmchan->state != FTDM_CHANNEL_STATE_DOWN){ ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE); @@ -1289,9 +1297,12 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) if (!R2CALL(ftdmchan)->disconnect_rcvd) { /* this will disconnect the call, but need to wait for the call end before moving to DOWN */ openr2_chan_disconnect_call(r2chan, disconnect_cause); - } else { + } else if (!R2CALL(ftdmchan)->protocol_error) { /* just ack the hangup, on_call_end will be called by openr2 right after */ openr2_chan_disconnect_call(r2chan, disconnect_cause); + } else { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Clearing call due to protocol error\n"); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); } } break; @@ -1347,7 +1358,6 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) int res, ms; struct timeval start, end; short *poll_events = ftdm_malloc(sizeof(short)*span->chan_count); - ftdm_event_t *event = NULL; #ifdef __linux__ r2data->monitor_thread_id = syscall(SYS_gettid); commit 1bd4de4fd95c4dc33a379f537f93ab36f4134d5f Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Nov 25 22:11:20 2010 -0200 freetdm: when protocol errors occurs on ftmod_r2, the channel state is properly set as down now diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index bfe49fd..f089846 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -67,9 +67,9 @@ typedef struct ftdm_r2_call_t { ftdm_r2_call_flag_t flags; int accepted:1; int answer_pending:1; - int state_ack_pending:1; int disconnect_rcvd:1; int ftdm_started:1; + int protocol_error:1; ftdm_channel_state_t chanstate; ftdm_size_t dnis_index; ftdm_size_t ani_index; @@ -456,10 +456,12 @@ static void ftdm_r2_on_call_accepted(openr2_chan_t *r2chan, openr2_call_mode_t m openr2_chan_disable_read(r2chan); R2CALL(ftdmchan)->accepted = 1; if (OR2_DIR_BACKWARD == openr2_chan_get_direction(r2chan)) { - R2CALL(ftdmchan)->state_ack_pending = 1; + ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE); + ftdm_channel_complete_state(ftdmchan); if (R2CALL(ftdmchan)->answer_pending) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Answer was pending, answering now.\n"); ft_r2_answer_call(ftdmchan); + R2CALL(ftdmchan)->answer_pending = 0; return; } } else { @@ -522,7 +524,7 @@ static void ftdm_r2_on_call_end(openr2_chan_t *r2chan) ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "Call finished\n"); /* the call is done as far as the stack is concerned, lets move to down here */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); /* in some circumstances openr2 can call on_call_init right after this, so let's advance the state right here */ ftdm_r2_state_advance(ftdmchan); @@ -560,6 +562,7 @@ static void ftdm_r2_on_protocol_error(openr2_chan_t *r2chan, openr2_protocol_err ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Protocol error\n"); R2CALL(ftdmchan)->disconnect_rcvd = 1; + R2CALL(ftdmchan)->protocol_error = 1; if (!R2CALL(ftdmchan)->ftdm_started) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); @@ -1173,13 +1176,13 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) ret = 0; - if (R2CALL(ftdmchan)->state_ack_pending) { - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE); - ftdm_channel_complete_state(ftdmchan); - R2CALL(ftdmchan)->state_ack_pending = 0; - } - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE) && (R2CALL(ftdmchan)->chanstate != ftdmchan->state)) { + /* because we do not always acknowledge the state change (clearing the FTDM_CHANNEL_STATE_CHANGE flag) due to the accept + * procedure described below, we need the chanstate member to NOT process some states twice, so is valid entering this + * function with the FTDM_CHANNEL_STATE_CHANGE flag set but with a state that was already processed and is just waiting + * to complete (the processing is media-bound) + * */ + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE) + && (R2CALL(ftdmchan)->chanstate != ftdmchan->state)) { ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Executing state handler for %s\n", ftdm_channel_state2str(ftdmchan->state)); R2CALL(ftdmchan)->chanstate = ftdmchan->state; @@ -1188,10 +1191,15 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) (ftdmchan->state == FTDM_CHANNEL_STATE_PROGRESS || ftdmchan->state == FTDM_CHANNEL_STATE_PROGRESS_MEDIA || ftdmchan->state == FTDM_CHANNEL_STATE_UP) ) { - /* if an accept ack will be required we should not acknowledge the state change just yet, - it will be done below after processing the MF signals, otherwise we have a race condition between freetdm calling - openr2_chan_answer_call and openr2 accepting the call first, if freetdm calls openr2_chan_answer_call before the accept cycle - completes, openr2 will fail to answer the call */ + /* + Moving to PROGRESS, PROGRESS_MEDIA or UP means that we must accept the call, and accepting + the call in R2 means sending a tone, then waiting for the acknowledge from the other end, + since all of that requires sending and detecting tones, it takes a few milliseconds (I'd say around 100) + which means during that time the user should not try to perform any operations like answer, hangup or anything + else, therefore we DO NOT clear the FTDM_CHANNEL_STATE_CHANGE flag here, we rely on ftdm_io.c to block + the user thread until we're done with the accept (see on_call_accepted callback) and then we clear the state change flag, + otherwise we have a race condition between freetdm calling openr2_chan_answer_call and openr2 accepting the call first, + if freetdm calls openr2_chan_answer_call before the accept cycle completes, openr2 will fail to answer the call */ ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "State ack for state %s will have to wait a bit\n", ftdm_channel_state2str(ftdmchan->state)); } else if (ftdmchan->state != FTDM_CHANNEL_STATE_DOWN){ ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE); @@ -1289,9 +1297,12 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) if (!R2CALL(ftdmchan)->disconnect_rcvd) { /* this will disconnect the call, but need to wait for the call end before moving to DOWN */ openr2_chan_disconnect_call(r2chan, disconnect_cause); - } else { + } else if (!R2CALL(ftdmchan)->protocol_error) { /* just ack the hangup, on_call_end will be called by openr2 right after */ openr2_chan_disconnect_call(r2chan, disconnect_cause); + } else { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Clearing call due to protocol error\n"); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); } } break; @@ -1347,7 +1358,6 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) int res, ms; struct timeval start, end; short *poll_events = ftdm_malloc(sizeof(short)*span->chan_count); - ftdm_event_t *event = NULL; #ifdef __linux__ r2data->monitor_thread_id = syscall(SYS_gettid); commit 5c747b699cfe3b2e19a3dc66a815cf7bfc9574a0 Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Nov 25 18:54:15 2010 -0500 Fix for receiving/transmitting facility IE diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index f10fa76..f3fc23e 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -142,21 +142,22 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) ftdmchan->caller_data.bearer_capability = sngisdn_get_infoTranCap_from_stack(conEvnt->bearCap[0].infoTranCap.val); } - if (signal_data->switchtype == SNGISDN_SWITCH_NI2) { - if (conEvnt->shift11.eh.pres && conEvnt->ni2OctStr.eh.pres) { - if (conEvnt->ni2OctStr.str.len == 4 && conEvnt->ni2OctStr.str.val[0] == 0x37) { - snprintf(ftdmchan->caller_data.aniII, 5, "%.2d", conEvnt->ni2OctStr.str.val[3]); - } + + if (conEvnt->shift11.eh.pres && conEvnt->ni2OctStr.eh.pres) { + if (conEvnt->ni2OctStr.str.len == 4 && conEvnt->ni2OctStr.str.val[0] == 0x37) { + snprintf(ftdmchan->caller_data.aniII, 5, "%.2d", conEvnt->ni2OctStr.str.val[3]); } + } - if (conEvnt->facilityStr.eh.pres) { - if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - get_facility_ie(&ftdmchan->caller_data, conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len); - } else if (signal_data->facility == SNGISDN_OPT_TRUE) { + if (conEvnt->facilityStr.eh.pres) { + if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { + get_facility_ie(&ftdmchan->caller_data, conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len); + } else if (signal_data->facility == SNGISDN_OPT_TRUE) { + if (signal_data->switchtype == SNGISDN_SWITCH_NI2) { /* Verify whether the Caller Name will come in a subsequent FACILITY message */ uint16_t ret_val; char retrieved_str[255]; - + ret_val = sng_isdn_retrieve_facility_caller_name(conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len, retrieved_str); /* return values for "sng_isdn_retrieve_facility_information_following": @@ -170,7 +171,7 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_GET_CALLERID); /* Launch timer in case we never get a FACILITY msg */ if (signal_data->facility_timeout) { - ftdm_sched_timer(signal_data->sched, "facility_timeout", signal_data->facility_timeout, + ftdm_sched_timer(signal_data->sched, "facility_timeout", signal_data->facility_timeout, sngisdn_facility_timeout, (void*) sngisdn_info, &sngisdn_info->timers[SNGISDN_TIMER_FACILITY]); } break; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 36c6782..1b906a2 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -412,7 +412,6 @@ void sngisdn_snd_connect(ftdm_channel_t *ftdmchan) memset(&cnStEvnt, 0, sizeof(cnStEvnt)); - cnStEvnt.chanId.eh.pres = PRSNT_NODEF; cnStEvnt.chanId.prefExc.pres = PRSNT_NODEF; cnStEvnt.chanId.prefExc.val = IN_PE_EXCLSVE; @@ -557,7 +556,6 @@ void sngisdn_snd_disconnect(ftdm_channel_t *ftdmchan) discEvnt.causeDgn[0].dgnVal.pres = NOTPRSNT; set_facility_ie(ftdmchan, &discEvnt.facilityStr); - ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending DISCONNECT (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); if (sng_isdn_disc_request(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &discEvnt)) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index c9aa3f0..241bb43 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -412,14 +412,16 @@ ftdm_status_t set_calling_name(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan) } ftdm_status_t set_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr) -{ +{ if (ftdmchan->caller_data.raw_data_len && ftdmchan->caller_data.raw_data[0] == 0x1C) { facilityStr->eh.pres = PRSNT_NODEF; + facilityStr->facilityStr.pres = PRSNT_NODEF; facilityStr->facilityStr.len = ftdmchan->caller_data.raw_data_len-2; memcpy(facilityStr->facilityStr.val, &ftdmchan->caller_data.raw_data[2], facilityStr->facilityStr.len); return FTDM_SUCCESS; } + return FTDM_FAIL; } commit 2973776b6480309a5fe95aa8b2a3ba5151288c6b Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Nov 25 16:36:49 2010 -0500 changed set_facility_ie diff --git a/Freeswitch.2008.sln b/Freeswitch.2008.sln index 01a4cf4..4ffd66a 100644 --- a/Freeswitch.2008.sln +++ b/Freeswitch.2008.sln @@ -36,7 +36,6 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Default", "Default", "{3B08FEFD-4D3D-4C16-BA94-EE83509E32A0}" ProjectSection(SolutionItems) = preProject conf\freeswitch.xml = conf\freeswitch.xml - conf\vars.xml = conf\vars.xml EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Release", "Release", "{7BFD517E-7F8F-4A40-A78E-8D3632738227}" @@ -57,7 +56,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Build System", "_Build Sys bootstrap.sh = bootstrap.sh build\buildlib.sh = build\buildlib.sh configure.in = configure.in - Makefile.am = Makefile.am build\modmake.rules.in = build\modmake.rules.in build\modules.conf.in = build\modules.conf.in libs\win32\util.vbs = libs\win32\util.vbs @@ -92,15 +90,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "autoload_configs", "autoloa conf\autoload_configs\limit.conf.xml = conf\autoload_configs\limit.conf.xml conf\autoload_configs\local_stream.conf.xml = conf\autoload_configs\local_stream.conf.xml conf\autoload_configs\logfile.conf.xml = conf\autoload_configs\logfile.conf.xml - conf\autoload_configs\modules.conf.xml = conf\autoload_configs\modules.conf.xml conf\autoload_configs\openmrcp.conf.xml = conf\autoload_configs\openmrcp.conf.xml conf\autoload_configs\portaudio.conf.xml = conf\autoload_configs\portaudio.conf.xml conf\autoload_configs\rss.conf.xml = conf\autoload_configs\rss.conf.xml conf\autoload_configs\sofia.conf.xml = conf\autoload_configs\sofia.conf.xml conf\autoload_configs\spidermonkey.conf.xml = conf\autoload_configs\spidermonkey.conf.xml - conf\autoload_configs\switch.conf.xml = conf\autoload_configs\switch.conf.xml conf\autoload_configs\syslog.conf.xml = conf\autoload_configs\syslog.conf.xml - conf\autoload_configs\voicemail.conf.xml = conf\autoload_configs\voicemail.conf.xml conf\autoload_configs\wanpipe.conf.xml = conf\autoload_configs\wanpipe.conf.xml conf\autoload_configs\woomera.conf.xml = conf\autoload_configs\woomera.conf.xml conf\autoload_configs\xml_cdr.conf.xml = conf\autoload_configs\xml_cdr.conf.xml @@ -111,7 +106,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "autoload_configs", "autoloa EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dialplan", "dialplan", "{C7E2382E-2C22-4D18-BF93-80C6A1FFA7AC}" ProjectSection(SolutionItems) = preProject - conf\dialplan\default.xml = conf\dialplan\default.xml conf\dialplan\public.xml = conf\dialplan\public.xml EndProjectSection EndProject @@ -123,7 +117,6 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sip_profiles", "sip_profiles", "{8E2E8798-8B6F-4A55-8E4F-4E6FDE40ED26}" ProjectSection(SolutionItems) = preProject conf\sip_profiles\external.xml = conf\sip_profiles\external.xml - conf\sip_profiles\internal.xml = conf\sip_profiles\internal.xml conf\sip_profiles\nat.xml = conf\sip_profiles\nat.xml EndProjectSection EndProject @@ -308,9 +301,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "autoload_configs", "autoloa EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dialplan", "dialplan", "{23874F4B-C0AF-4587-9F7E-DB0F06DE8CB4}" - ProjectSection(SolutionItems) = preProject - conf\dialplan\default.xml = conf\dialplan\default.xml - EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "directory", "directory", "{19ED97F6-30D8-4FCE-AE1D-8B7FCB170D40}" ProjectSection(SolutionItems) = preProject @@ -1271,15 +1261,15 @@ Global {89385C74-5860-4174-9CAF-A39E7C48909C}.Release|Win32.Build.0 = Release|Win32 {89385C74-5860-4174-9CAF-A39E7C48909C}.Release|x64.ActiveCfg = Release|x64 {89385C74-5860-4174-9CAF-A39E7C48909C}.Release|x64.Build.0 = Release|x64 - {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|Win32.ActiveCfg = Release|x64 - {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|x64.ActiveCfg = Release|x64 - {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|x64.Build.0 = Release|x64 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|Win32.ActiveCfg = Release|Win32 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|Win32.Build.0 = Release|Win32 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|x64.ActiveCfg = Release|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|Win32.ActiveCfg = Debug|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|Win32.Build.0 = Debug|Win32 - {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|x64.ActiveCfg = Debug|x64 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|x64.ActiveCfg = Debug|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|Win32.ActiveCfg = Release|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|Win32.Build.0 = Release|Win32 - {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|x64.ActiveCfg = Release|x64 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|x64.ActiveCfg = Release|Win32 {692F6330-4D87-4C82-81DF-40DB5892636E}.All|Win32.ActiveCfg = Release|x64 {692F6330-4D87-4C82-81DF-40DB5892636E}.All|x64.ActiveCfg = Release|x64 {692F6330-4D87-4C82-81DF-40DB5892636E}.All|x64.Build.0 = Release|x64 diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 4ddb90b..c9aa3f0 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -412,14 +412,12 @@ ftdm_status_t set_calling_name(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan) } ftdm_status_t set_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr) -{ - const char *facility_str = NULL; - - facility_str = ftdm_channel_get_var(ftdmchan, "isdn.facility.val"); - if (facility_str) { +{ + if (ftdmchan->caller_data.raw_data_len && + ftdmchan->caller_data.raw_data[0] == 0x1C) { facilityStr->eh.pres = PRSNT_NODEF; - facilityStr->facilityStr.len = strlen(facility_str); - memcpy(facilityStr->facilityStr.val, facility_str, facilityStr->facilityStr.len); + facilityStr->facilityStr.len = ftdmchan->caller_data.raw_data_len-2; + memcpy(facilityStr->facilityStr.val, &ftdmchan->caller_data.raw_data[2], facilityStr->facilityStr.len); return FTDM_SUCCESS; } return FTDM_FAIL; commit b8fb8acca152a5850b4a0fa4c0625f0094909059 Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Nov 25 16:16:36 2010 -0500 freetdm: ISDN allow change state from PROCEED to UP diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index ede3ff8..6f54330 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2033,6 +2033,11 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_answer(const char *file, const char goto done; } +#if 0 + /* DAVIDY - We will fail RFC's if we do that, but some modules apart from ftmod_sangoma_isdn + * expect the call to always to go PROGRESS and PROGRESS MEDIA state before going to UP, so + * remove this only in netborder branch for now */ + if (ftdmchan->state < FTDM_CHANNEL_STATE_PROGRESS) { ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS, 1); } @@ -2052,7 +2057,7 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_answer(const char *file, const char ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call has moved to TERMINATING while we're moving to UP\n"); goto done; } - +#endif ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_UP, 1); done: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 6f5f838..9aa52f8 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -121,7 +121,8 @@ ftdm_state_map_t sangoma_isdn_state_map = { ZSD_INBOUND, ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_PROCEED, FTDM_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA,FTDM_END} + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, + FTDM_CHANNEL_STATE_UP, FTDM_END} }, { ZSD_INBOUND, diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index a541a65..f10fa76 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -377,18 +377,17 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) switch(ftdmchan->state) { case FTDM_CHANNEL_STATE_DIALING: - if (evntType == MI_CALLPROC) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROCEED); - } else if (evntType == MI_PROGRESS || - (cnStEvnt->progInd.eh.pres && cnStEvnt->progInd.progDesc.val == IN_PD_IBAVAIL)) { + if (cnStEvnt->progInd.eh.pres && cnStEvnt->progInd.progDesc.val == IN_PD_IBAVAIL) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); + } else if (evntType == MI_CALLPROC) { + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROCEED); } else { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); } break; + case FTDM_CHANNEL_STATE_PROCEED: case FTDM_CHANNEL_STATE_PROGRESS: - if (evntType == MI_PROGRESS || - (cnStEvnt->progInd.eh.pres && cnStEvnt->progInd.progDesc.val == IN_PD_IBAVAIL)) { + if (cnStEvnt->progInd.eh.pres && cnStEvnt->progInd.progDesc.val == IN_PD_IBAVAIL) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); } break; commit 1b3c306636af7d136514e64c286219d9dfecf95e Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Nov 25 18:54:15 2010 -0500 Fix for receiving/transmitting facility IE diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index f10fa76..f3fc23e 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -142,21 +142,22 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) ftdmchan->caller_data.bearer_capability = sngisdn_get_infoTranCap_from_stack(conEvnt->bearCap[0].infoTranCap.val); } - if (signal_data->switchtype == SNGISDN_SWITCH_NI2) { - if (conEvnt->shift11.eh.pres && conEvnt->ni2OctStr.eh.pres) { - if (conEvnt->ni2OctStr.str.len == 4 && conEvnt->ni2OctStr.str.val[0] == 0x37) { - snprintf(ftdmchan->caller_data.aniII, 5, "%.2d", conEvnt->ni2OctStr.str.val[3]); - } + + if (conEvnt->shift11.eh.pres && conEvnt->ni2OctStr.eh.pres) { + if (conEvnt->ni2OctStr.str.len == 4 && conEvnt->ni2OctStr.str.val[0] == 0x37) { + snprintf(ftdmchan->caller_data.aniII, 5, "%.2d", conEvnt->ni2OctStr.str.val[3]); } + } - if (conEvnt->facilityStr.eh.pres) { - if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - get_facility_ie(&ftdmchan->caller_data, conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len); - } else if (signal_data->facility == SNGISDN_OPT_TRUE) { + if (conEvnt->facilityStr.eh.pres) { + if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { + get_facility_ie(&ftdmchan->caller_data, conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len); + } else if (signal_data->facility == SNGISDN_OPT_TRUE) { + if (signal_data->switchtype == SNGISDN_SWITCH_NI2) { /* Verify whether the Caller Name will come in a subsequent FACILITY message */ uint16_t ret_val; char retrieved_str[255]; - + ret_val = sng_isdn_retrieve_facility_caller_name(conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len, retrieved_str); /* return values for "sng_isdn_retrieve_facility_information_following": @@ -170,7 +171,7 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_GET_CALLERID); /* Launch timer in case we never get a FACILITY msg */ if (signal_data->facility_timeout) { - ftdm_sched_timer(signal_data->sched, "facility_timeout", signal_data->facility_timeout, + ftdm_sched_timer(signal_data->sched, "facility_timeout", signal_data->facility_timeout, sngisdn_facility_timeout, (void*) sngisdn_info, &sngisdn_info->timers[SNGISDN_TIMER_FACILITY]); } break; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 36c6782..1b906a2 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -412,7 +412,6 @@ void sngisdn_snd_connect(ftdm_channel_t *ftdmchan) memset(&cnStEvnt, 0, sizeof(cnStEvnt)); - cnStEvnt.chanId.eh.pres = PRSNT_NODEF; cnStEvnt.chanId.prefExc.pres = PRSNT_NODEF; cnStEvnt.chanId.prefExc.val = IN_PE_EXCLSVE; @@ -557,7 +556,6 @@ void sngisdn_snd_disconnect(ftdm_channel_t *ftdmchan) discEvnt.causeDgn[0].dgnVal.pres = NOTPRSNT; set_facility_ie(ftdmchan, &discEvnt.facilityStr); - ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending DISCONNECT (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); if (sng_isdn_disc_request(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &discEvnt)) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index c9aa3f0..241bb43 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -412,14 +412,16 @@ ftdm_status_t set_calling_name(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan) } ftdm_status_t set_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr) -{ +{ if (ftdmchan->caller_data.raw_data_len && ftdmchan->caller_data.raw_data[0] == 0x1C) { facilityStr->eh.pres = PRSNT_NODEF; + facilityStr->facilityStr.pres = PRSNT_NODEF; facilityStr->facilityStr.len = ftdmchan->caller_data.raw_data_len-2; memcpy(facilityStr->facilityStr.val, &ftdmchan->caller_data.raw_data[2], facilityStr->facilityStr.len); return FTDM_SUCCESS; } + return FTDM_FAIL; } commit 3b0911aaf367fdd459c7ac6490d3328c8e241f09 Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Nov 25 16:36:49 2010 -0500 changed set_facility_ie diff --git a/Freeswitch.2008.sln b/Freeswitch.2008.sln index 01a4cf4..4ffd66a 100644 --- a/Freeswitch.2008.sln +++ b/Freeswitch.2008.sln @@ -36,7 +36,6 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Default", "Default", "{3B08FEFD-4D3D-4C16-BA94-EE83509E32A0}" ProjectSection(SolutionItems) = preProject conf\freeswitch.xml = conf\freeswitch.xml - conf\vars.xml = conf\vars.xml EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Release", "Release", "{7BFD517E-7F8F-4A40-A78E-8D3632738227}" @@ -57,7 +56,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Build System", "_Build Sys bootstrap.sh = bootstrap.sh build\buildlib.sh = build\buildlib.sh configure.in = configure.in - Makefile.am = Makefile.am build\modmake.rules.in = build\modmake.rules.in build\modules.conf.in = build\modules.conf.in libs\win32\util.vbs = libs\win32\util.vbs @@ -92,15 +90,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "autoload_configs", "autoloa conf\autoload_configs\limit.conf.xml = conf\autoload_configs\limit.conf.xml conf\autoload_configs\local_stream.conf.xml = conf\autoload_configs\local_stream.conf.xml conf\autoload_configs\logfile.conf.xml = conf\autoload_configs\logfile.conf.xml - conf\autoload_configs\modules.conf.xml = conf\autoload_configs\modules.conf.xml conf\autoload_configs\openmrcp.conf.xml = conf\autoload_configs\openmrcp.conf.xml conf\autoload_configs\portaudio.conf.xml = conf\autoload_configs\portaudio.conf.xml conf\autoload_configs\rss.conf.xml = conf\autoload_configs\rss.conf.xml conf\autoload_configs\sofia.conf.xml = conf\autoload_configs\sofia.conf.xml conf\autoload_configs\spidermonkey.conf.xml = conf\autoload_configs\spidermonkey.conf.xml - conf\autoload_configs\switch.conf.xml = conf\autoload_configs\switch.conf.xml conf\autoload_configs\syslog.conf.xml = conf\autoload_configs\syslog.conf.xml - conf\autoload_configs\voicemail.conf.xml = conf\autoload_configs\voicemail.conf.xml conf\autoload_configs\wanpipe.conf.xml = conf\autoload_configs\wanpipe.conf.xml conf\autoload_configs\woomera.conf.xml = conf\autoload_configs\woomera.conf.xml conf\autoload_configs\xml_cdr.conf.xml = conf\autoload_configs\xml_cdr.conf.xml @@ -111,7 +106,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "autoload_configs", "autoloa EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dialplan", "dialplan", "{C7E2382E-2C22-4D18-BF93-80C6A1FFA7AC}" ProjectSection(SolutionItems) = preProject - conf\dialplan\default.xml = conf\dialplan\default.xml conf\dialplan\public.xml = conf\dialplan\public.xml EndProjectSection EndProject @@ -123,7 +117,6 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sip_profiles", "sip_profiles", "{8E2E8798-8B6F-4A55-8E4F-4E6FDE40ED26}" ProjectSection(SolutionItems) = preProject conf\sip_profiles\external.xml = conf\sip_profiles\external.xml - conf\sip_profiles\internal.xml = conf\sip_profiles\internal.xml conf\sip_profiles\nat.xml = conf\sip_profiles\nat.xml EndProjectSection EndProject @@ -308,9 +301,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "autoload_configs", "autoloa EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dialplan", "dialplan", "{23874F4B-C0AF-4587-9F7E-DB0F06DE8CB4}" - ProjectSection(SolutionItems) = preProject - conf\dialplan\default.xml = conf\dialplan\default.xml - EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "directory", "directory", "{19ED97F6-30D8-4FCE-AE1D-8B7FCB170D40}" ProjectSection(SolutionItems) = preProject @@ -1271,15 +1261,15 @@ Global {89385C74-5860-4174-9CAF-A39E7C48909C}.Release|Win32.Build.0 = Release|Win32 {89385C74-5860-4174-9CAF-A39E7C48909C}.Release|x64.ActiveCfg = Release|x64 {89385C74-5860-4174-9CAF-A39E7C48909C}.Release|x64.Build.0 = Release|x64 - {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|Win32.ActiveCfg = Release|x64 - {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|x64.ActiveCfg = Release|x64 - {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|x64.Build.0 = Release|x64 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|Win32.ActiveCfg = Release|Win32 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|Win32.Build.0 = Release|Win32 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|x64.ActiveCfg = Release|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|Win32.ActiveCfg = Debug|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|Win32.Build.0 = Debug|Win32 - {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|x64.ActiveCfg = Debug|x64 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|x64.ActiveCfg = Debug|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|Win32.ActiveCfg = Release|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|Win32.Build.0 = Release|Win32 - {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|x64.ActiveCfg = Release|x64 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|x64.ActiveCfg = Release|Win32 {692F6330-4D87-4C82-81DF-40DB5892636E}.All|Win32.ActiveCfg = Release|x64 {692F6330-4D87-4C82-81DF-40DB5892636E}.All|x64.ActiveCfg = Release|x64 {692F6330-4D87-4C82-81DF-40DB5892636E}.All|x64.Build.0 = Release|x64 diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 4ddb90b..c9aa3f0 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -412,14 +412,12 @@ ftdm_status_t set_calling_name(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan) } ftdm_status_t set_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr) -{ - const char *facility_str = NULL; - - facility_str = ftdm_channel_get_var(ftdmchan, "isdn.facility.val"); - if (facility_str) { +{ + if (ftdmchan->caller_data.raw_data_len && + ftdmchan->caller_data.raw_data[0] == 0x1C) { facilityStr->eh.pres = PRSNT_NODEF; - facilityStr->facilityStr.len = strlen(facility_str); - memcpy(facilityStr->facilityStr.val, facility_str, facilityStr->facilityStr.len); + facilityStr->facilityStr.len = ftdmchan->caller_data.raw_data_len-2; + memcpy(facilityStr->facilityStr.val, &ftdmchan->caller_data.raw_data[2], facilityStr->facilityStr.len); return FTDM_SUCCESS; } return FTDM_FAIL; commit 39155c614cc133e363f8fd91ff68c76a67615090 Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Nov 25 16:16:36 2010 -0500 freetdm: ISDN allow change state from PROCEED to UP diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index c36b265..ee3c4e6 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2078,6 +2078,11 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_answer(const char *file, const char goto done; } +#if 0 + /* DAVIDY - We will fail RFC's if we do that, but some modules apart from ftmod_sangoma_isdn + * expect the call to always to go PROGRESS and PROGRESS MEDIA state before going to UP, so + * remove this only in netborder branch for now */ + if (ftdmchan->state < FTDM_CHANNEL_STATE_PROGRESS) { ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS, 1); } @@ -2097,7 +2102,7 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_answer(const char *file, const char ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call has moved to TERMINATING while we're moving to UP\n"); goto done; } - +#endif ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_UP, 1); done: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 6f5f838..9aa52f8 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -121,7 +121,8 @@ ftdm_state_map_t sangoma_isdn_state_map = { ZSD_INBOUND, ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_PROCEED, FTDM_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA,FTDM_END} + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, + FTDM_CHANNEL_STATE_UP, FTDM_END} }, { ZSD_INBOUND, diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index a541a65..f10fa76 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -377,18 +377,17 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) switch(ftdmchan->state) { case FTDM_CHANNEL_STATE_DIALING: - if (evntType == MI_CALLPROC) { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROCEED); - } else if (evntType == MI_PROGRESS || - (cnStEvnt->progInd.eh.pres && cnStEvnt->progInd.progDesc.val == IN_PD_IBAVAIL)) { + if (cnStEvnt->progInd.eh.pres && cnStEvnt->progInd.progDesc.val == IN_PD_IBAVAIL) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); + } else if (evntType == MI_CALLPROC) { + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROCEED); } else { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); } break; + case FTDM_CHANNEL_STATE_PROCEED: case FTDM_CHANNEL_STATE_PROGRESS: - if (evntType == MI_PROGRESS || - (cnStEvnt->progInd.eh.pres && cnStEvnt->progInd.progDesc.val == IN_PD_IBAVAIL)) { + if (cnStEvnt->progInd.eh.pres && cnStEvnt->progInd.progDesc.val == IN_PD_IBAVAIL) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); } break; commit c9fa092a9ef7a48ee702a729da2d8c30f62e7d65 Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Nov 25 13:22:41 2010 -0600 VS2010 add mod_cepstral to Setup diff --git a/w32/Setup/Setup.wixproj b/w32/Setup/Setup.wixproj index 7d11c90..fa6c832 100644 --- a/w32/Setup/Setup.wixproj +++ b/w32/Setup/Setup.wixproj @@ -336,6 +336,15 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> + <ProjectReference Include="..\..\src\mod\asr_tts\mod_cepstral\mod_cepstral.2010.vcxproj"> + <Name>mod_cepstral</Name> + <Project>{692f6330-4d87-4c82-81df-40db5892636e}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> <ProjectReference Include="..\..\src\mod\asr_tts\mod_pocketsphinx\mod_pocketsphinx.2010.vcxproj"> <Name>mod_pocketsphinx</Name> <Project>{2286da73-9fc5-45bc-a508-85994c3317ab}</Project> commit 535a578ef6bcb3e40aa9da3e87dcad59c751a003 Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Nov 25 13:16:44 2010 -0500 Fix for caller ID not received properly on BRI diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 25ffef8..a82ed28 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -376,16 +376,18 @@ void sngisdn_rcv_cc_ind(CcMngmt *status); void sngisdn_rcv_sng_log(uint8_t level, char *fmt,...); void sngisdn_rcv_sng_assert(char *message); -ftdm_status_t cpy_calling_num_from_stack(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb); -ftdm_status_t cpy_called_num_from_stack(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb); -ftdm_status_t cpy_redir_num_from_stack(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb); -ftdm_status_t cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *display); -ftdm_status_t cpy_facility_ie_from_stack(ftdm_caller_data_t *ftdm, uint8_t *data, uint32_t data_len); - -ftdm_status_t cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm); -ftdm_status_t cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm); -ftdm_status_t cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm); -ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan); +ftdm_status_t get_calling_num(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb); +ftdm_status_t get_called_num(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb); +ftdm_status_t get_redir_num(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb); +ftdm_status_t get_calling_name_from_display(ftdm_caller_data_t *ftdm, Display *display); +ftdm_status_t get_calling_name_from_usr_usr(ftdm_caller_data_t *ftdm, UsrUsr *usrUsr); +ftdm_status_t get_facility_ie(ftdm_caller_data_t *ftdm, uint8_t *data, uint32_t data_len); + +ftdm_status_t set_calling_num(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm); +ftdm_status_t set_called_num(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm); +ftdm_status_t set_redir_num(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm); +ftdm_status_t set_calling_name(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan); +ftdm_status_t set_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr); uint8_t sngisdn_get_infoTranCap_from_stack(ftdm_bearer_cap_t bearer_capability); uint8_t sngisdn_get_usrInfoLyr1Prot_from_stack(ftdm_user_layer1_prot_t layer1_prot); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 209284a..a541a65 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -127,10 +127,14 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) ftdm_channel_add_var(ftdmchan, "isdn_specific_var", "1"); #endif /* Fill in call information */ - cpy_calling_num_from_stack(&ftdmchan->caller_data, &conEvnt->cgPtyNmb); - cpy_called_num_from_stack(&ftdmchan->caller_data, &conEvnt->cdPtyNmb); - cpy_calling_name_from_stack(&ftdmchan->caller_data, &conEvnt->display); - cpy_redir_num_from_stack(&ftdmchan->caller_data, &conEvnt->redirNmb); + get_calling_num(&ftdmchan->caller_data, &conEvnt->cgPtyNmb); + get_called_num(&ftdmchan->caller_data, &conEvnt->cdPtyNmb); + get_redir_num(&ftdmchan->caller_data, &conEvnt->redirNmb); + + if (get_calling_name_from_display(&ftdmchan->caller_data, &conEvnt->display) != FTDM_SUCCESS) { + get_calling_name_from_usr_usr(&ftdmchan->caller_data, &conEvnt->usrUsr); + } + ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Incoming call: Called No:[%s] Calling No:[%s]\n", ftdmchan->caller_data.dnis.digits, ftdmchan->caller_data.cid_num.digits); if (conEvnt->bearCap[0].eh.pres) { @@ -147,7 +151,7 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) if (conEvnt->facilityStr.eh.pres) { if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - cpy_facility_ie_from_stack(&ftdmchan->caller_data, conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len); + get_facility_ie(&ftdmchan->caller_data, conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len); } else if (signal_data->facility == SNGISDN_OPT_TRUE) { /* Verify whether the Caller Name will come in a subsequent FACILITY message */ uint16_t ret_val; @@ -413,7 +417,7 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) ftdm_size_t min_digits = ((sngisdn_span_data_t*)ftdmchan->span->signal_data)->min_digits; ftdm_size_t num_digits; - cpy_called_num_from_stack(&ftdmchan->caller_data, &cnStEvnt->cdPtyNmb); + get_called_num(&ftdmchan->caller_data, &cnStEvnt->cdPtyNmb); num_digits = strlen(ftdmchan->caller_data.dnis.digits); if (cnStEvnt->sndCmplt.eh.pres || num_digits >= min_digits) { @@ -472,7 +476,7 @@ void sngisdn_process_disc_ind (sngisdn_event_data_t *sngisdn_event) case FTDM_CHANNEL_STATE_UP: if (discEvnt->facilityStr.eh.pres) { if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - cpy_facility_ie_from_stack(&ftdmchan->caller_data, discEvnt->facilityStr.facilityStr.val, discEvnt->facilityStr.facilityStr.len); + get_facility_ie(&ftdmchan->caller_data, discEvnt->facilityStr.facilityStr.val, discEvnt->facilityStr.facilityStr.len); } else { /* Call libsng_isdn facility decode function and copy variables here */ } @@ -569,7 +573,7 @@ void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event) if (relEvnt->facilityStr.eh.pres) { if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - cpy_facility_ie_from_stack(&ftdmchan->caller_data, relEvnt->facilityStr.facilityStr.val, relEvnt->facilityStr.facilityStr.len); + get_facility_ie(&ftdmchan->caller_data, relEvnt->facilityStr.facilityStr.val, relEvnt->facilityStr.facilityStr.len); } else { /* Call libsng_isdn facility decode function and copy variables here */ } @@ -785,7 +789,7 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event) ftdm_sigmsg_t sigev; if (facEvnt->facElmt.facStr.pres) { if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - cpy_facility_ie_from_stack(&ftdmchan->caller_data, &facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len); + get_facility_ie(&ftdmchan->caller_data, &facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len); } else { /* Call libsng_isdn facility decode function and copy variables here */ } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 385d1eb..36c6782 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -35,7 +35,6 @@ #include "ftmod_sangoma_isdn.h" static void sngisdn_set_prog_desc(ProgInd *progInd, ftdm_sngisdn_progind_t prod_ind); -static void sngisdn_set_facilityStr(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr); void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) { @@ -136,12 +135,11 @@ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) } ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Outgoing call: Called No:[%s] Calling No:[%s]\n", ftdmchan->caller_data.dnis.digits, ftdmchan->caller_data.cid_num.digits); - cpy_called_num_from_user(&conEvnt.cdPtyNmb, &ftdmchan->caller_data); - cpy_calling_num_from_user(&conEvnt.cgPtyNmb, &ftdmchan->caller_data); - cpy_redir_num_from_user(&conEvnt.redirNmb, &ftdmchan->caller_data); - cpy_calling_name_from_user(&conEvnt, ftdmchan); - - sngisdn_set_facilityStr(ftdmchan, &conEvnt.facilityStr); + set_called_num(&conEvnt.cdPtyNmb, &ftdmchan->caller_data); + set_calling_num(&conEvnt.cgPtyNmb, &ftdmchan->caller_data); + set_redir_num(&conEvnt.redirNmb, &ftdmchan->caller_data); + set_calling_name(&conEvnt, ftdmchan); + set_facility_ie(ftdmchan, &conEvnt.facilityStr); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending SETUP (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); @@ -558,7 +556,8 @@ void sngisdn_snd_disconnect(ftdm_channel_t *ftdmchan) discEvnt.causeDgn[0].recommend.pres = NOTPRSNT; discEvnt.causeDgn[0].dgnVal.pres = NOTPRSNT; - sngisdn_set_facilityStr(ftdmchan, &discEvnt.facilityStr); + set_facility_ie(ftdmchan, &discEvnt.facilityStr); + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending DISCONNECT (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); if (sng_isdn_disc_request(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &discEvnt)) { @@ -604,7 +603,7 @@ void sngisdn_snd_release(ftdm_channel_t *ftdmchan, uint8_t glare) spInstId = sngisdn_info->spInstId; } - sngisdn_set_facilityStr(ftdmchan, &relEvnt.facilityStr); + set_facility_ie(ftdmchan, &relEvnt.facilityStr); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending RELEASE/RELEASE COMPLETE (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, suInstId, spInstId); @@ -647,19 +646,6 @@ static void sngisdn_set_prog_desc(ProgInd *progInd, ftdm_sngisdn_progind_t prog_ return; } -static void sngisdn_set_facilityStr(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr) -{ - const char *facility_str = NULL; - - facility_str = ftdm_channel_get_var(ftdmchan, "isdn.facility.val"); - if (facility_str) { - facilityStr->eh.pres = PRSNT_NODEF; - facilityStr->facilityStr.len = strlen(facility_str); - memcpy(facilityStr->facilityStr.val, facility_str, facilityStr->facilityStr.len); - } - return; -} - /* We received an incoming frame on the d-channel, send data to the stack */ void sngisdn_snd_data(ftdm_channel_t *dchan, uint8_t *data, ftdm_size_t len) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 379c481..4ddb90b 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -147,76 +147,79 @@ ftdm_status_t sngisdn_set_avail_rate(ftdm_span_t *span, sngisdn_avail_t avail) return FTDM_SUCCESS; } -ftdm_status_t cpy_calling_num_from_stack(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb) +ftdm_status_t get_calling_num(ftdm_caller_data_t *caller_data, CgPtyNmb *cgPtyNmb) { if (cgPtyNmb->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; } if (cgPtyNmb->screenInd.pres == PRSNT_NODEF) { - ftdm->screen = cgPtyNmb->screenInd.val; + caller_data->screen = cgPtyNmb->screenInd.val; } if (cgPtyNmb->presInd0.pres == PRSNT_NODEF) { - ftdm->pres = cgPtyNmb->presInd0.val; + caller_data->pres = cgPtyNmb->presInd0.val; } if (cgPtyNmb->nmbPlanId.pres == PRSNT_NODEF) { - ftdm->cid_num.plan = cgPtyNmb->nmbPlanId.val; + caller_data->cid_num.plan = cgPtyNmb->nmbPlanId.val; } + if (cgPtyNmb->typeNmb1.pres == PRSNT_NODEF) { - ftdm->cid_num.type = cgPtyNmb->typeNmb1.val; + caller_data->cid_num.type = cgPtyNmb->typeNmb1.val; } if (cgPtyNmb->nmbDigits.pres == PRSNT_NODEF) { - ftdm_copy_string(ftdm->cid_num.digits, (const char*)cgPtyNmb->nmbDigits.val, cgPtyNmb->nmbDigits.len+1); + ftdm_copy_string(caller_data->cid_num.digits, (const char*)cgPtyNmb->nmbDigits.val, cgPtyNmb->nmbDigits.len+1); } + memcpy(&caller_data->ani, &caller_data->cid_num, sizeof(caller_data->ani)); return FTDM_SUCCESS; } -ftdm_status_t cpy_called_num_from_stack(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb) +ftdm_status_t get_called_num(ftdm_caller_data_t *caller_data, CdPtyNmb *cdPtyNmb) { if (cdPtyNmb->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; } if (cdPtyNmb->nmbPlanId.pres == PRSNT_NODEF) { - ftdm->dnis.plan = cdPtyNmb->nmbPlanId.val; + caller_data->dnis.plan = cdPtyNmb->nmbPlanId.val; } if (cdPtyNmb->typeNmb0.pres == PRSNT_NODEF) { - ftdm->dnis.type = cdPtyNmb->typeNmb0.val; + caller_data->dnis.type = cdPtyNmb->typeNmb0.val; } if (cdPtyNmb->nmbDigits.pres == PRSNT_NODEF) { - unsigned i = strlen(ftdm->dnis.digits); + /* In overlap receive mode, append the new digits to the existing dnis */ + unsigned i = strlen(caller_data->dnis.digits); - ftdm_copy_string(&ftdm->dnis.digits[i], (const char*)cdPtyNmb->nmbDigits.val, cdPtyNmb->nmbDigits.len+1); + ftdm_copy_string(&caller_data->dnis.digits[i], (const char*)cdPtyNmb->nmbDigits.val, cdPtyNmb->nmbDigits.len+1); } return FTDM_SUCCESS; } -ftdm_status_t cpy_redir_num_from_stack(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb) +ftdm_status_t get_redir_num(ftdm_caller_data_t *caller_data, RedirNmb *redirNmb) { if (redirNmb->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; } if (redirNmb->nmbPlanId.pres == PRSNT_NODEF) { - ftdm->rdnis.plan = redirNmb->nmbPlanId.val; + caller_data->rdnis.plan = redirNmb->nmbPlanId.val; } if (redirNmb->typeNmb.pres == PRSNT_NODEF) { - ftdm->rdnis.type = redirNmb->typeNmb.val; + caller_data->rdnis.type = redirNmb->typeNmb.val; } if (redirNmb->nmbDigits.pres == PRSNT_NODEF) { - ftdm_copy_string(ftdm->rdnis.digits, (const char*)redirNmb->nmbDigits.val, redirNmb->nmbDigits.len+1); + ftdm_copy_string(caller_data->rdnis.digits, (const char*)redirNmb->nmbDigits.val, redirNmb->nmbDigits.len+1); } return FTDM_SUCCESS; } -ftdm_status_t cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *display) +ftdm_status_t get_calling_name_from_display(ftdm_caller_data_t *caller_data, Display *display) { if (display->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; @@ -225,11 +228,29 @@ ftdm_status_t cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *dis return FTDM_FAIL; } - ftdm_copy_string(ftdm->cid_name, (const char*)display->dispInfo.val, display->dispInfo.len+1); + ftdm_copy_string(caller_data->cid_name, (const char*)display->dispInfo.val, display->dispInfo.len+1); + return FTDM_SUCCESS; +} + +ftdm_status_t get_calling_name_from_usr_usr(ftdm_caller_data_t *caller_data, UsrUsr *usrUsr) +{ + if (usrUsr->eh.pres != PRSNT_NODEF) { + return FTDM_FAIL; + } + + if (usrUsr->protocolDisc.val != PD_IA5) { + return FTDM_FAIL; + } + + if (usrUsr->usrInfo.pres != PRSNT_NODEF) { + return FTDM_FAIL; + } + + ftdm_copy_string(caller_data->cid_name, (const char*)usrUsr->usrInfo.val, usrUsr->usrInfo.len+1); return FTDM_SUCCESS; } -ftdm_status_t cpy_facility_ie_from_stack(ftdm_caller_data_t *caller_data, uint8_t *data, uint32_t data_len) +ftdm_status_t get_facility_ie(ftdm_caller_data_t *caller_data, uint8_t *data, uint32_t data_len) { if (data_len > sizeof(caller_data->raw_data)-2) { ftdm_log(FTDM_LOG_CRIT, "Length of Facility IE exceeds maximum length\n"); @@ -247,67 +268,67 @@ ftdm_status_t cpy_facility_ie_from_stack(ftdm_caller_data_t *caller_data, uint8_ return FTDM_SUCCESS; } -ftdm_status_t cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm) +ftdm_status_t set_calling_num(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *caller_data) { - uint8_t len = strlen(ftdm->cid_num.digits); + uint8_t len = strlen(caller_data->cid_num.digits); if (!len) { return FTDM_SUCCESS; } cgPtyNmb->eh.pres = PRSNT_NODEF; cgPtyNmb->screenInd.pres = PRSNT_NODEF; - cgPtyNmb->screenInd.val = ftdm->screen; + cgPtyNmb->screenInd.val = caller_data->screen; cgPtyNmb->presInd0.pres = PRSNT_NODEF; - cgPtyNmb->presInd0.val = ftdm->pres; - + cgPtyNmb->presInd0.val = caller_data->pres; + cgPtyNmb->nmbPlanId.pres = PRSNT_NODEF; - cgPtyNmb->nmbPlanId.val = ftdm->cid_num.plan; + cgPtyNmb->nmbPlanId.val = caller_data->cid_num.plan; cgPtyNmb->typeNmb1.pres = PRSNT_NODEF; - cgPtyNmb->typeNmb1.val = ftdm->cid_num.type; + cgPtyNmb->typeNmb1.val = caller_data->cid_num.type; cgPtyNmb->nmbDigits.pres = PRSNT_NODEF; cgPtyNmb->nmbDigits.len = len; - memcpy(cgPtyNmb->nmbDigits.val, ftdm->cid_num.digits, len); + memcpy(cgPtyNmb->nmbDigits.val, caller_data->cid_num.digits, len); return FTDM_SUCCESS; } -ftdm_status_t cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm) +ftdm_status_t set_called_num(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *caller_data) { - uint8_t len = strlen(ftdm->dnis.digits); + uint8_t len = strlen(caller_data->dnis.digits); if (!len) { return FTDM_SUCCESS; } cdPtyNmb->eh.pres = PRSNT_NODEF; cdPtyNmb->nmbPlanId.pres = PRSNT_NODEF; - if (ftdm->dnis.plan == FTDM_NPI_INVALID) { + if (caller_data->dnis.plan == FTDM_NPI_INVALID) { cdPtyNmb->nmbPlanId.val = FTDM_NPI_UNKNOWN; } else { - cdPtyNmb->nmbPlanId.val = ftdm->dnis.plan; + cdPtyNmb->nmbPlanId.val = caller_data->dnis.plan; } cdPtyNmb->typeNmb0.pres = PRSNT_NODEF; - if (ftdm->dnis.type == FTDM_TON_INVALID) { + if (caller_data->dnis.type == FTDM_TON_INVALID) { cdPtyNmb->typeNmb0.val = FTDM_TON_UNKNOWN; } else { - cdPtyNmb->typeNmb0.val = ftdm->dnis.type; + cdPtyNmb->typeNmb0.val = caller_data->dnis.type; } cdPtyNmb->nmbDigits.pres = PRSNT_NODEF; cdPtyNmb->nmbDigits.len = len; - memcpy(cdPtyNmb->nmbDigits.val, ftdm->dnis.digits, len); + memcpy(cdPtyNmb->nmbDigits.val, caller_data->dnis.digits, len); return FTDM_SUCCESS; } -ftdm_status_t cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm) +ftdm_status_t set_redir_num(RedirNmb *redirNmb, ftdm_caller_data_t *caller_data) { - uint8_t len = strlen(ftdm->rdnis.digits); + uint8_t len = strlen(caller_data->rdnis.digits); if (!len) { return FTDM_SUCCESS; } @@ -315,36 +336,36 @@ ftdm_status_t cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_caller_data_t *ft redirNmb->eh.pres = PRSNT_NODEF; redirNmb->nmbPlanId.pres = PRSNT_NODEF; - if (ftdm->rdnis.plan == FTDM_NPI_INVALID) { + if (caller_data->rdnis.plan == FTDM_NPI_INVALID) { redirNmb->nmbPlanId.val = FTDM_NPI_UNKNOWN; } else { - redirNmb->nmbPlanId.val = ftdm->rdnis.plan; + redirNmb->nmbPlanId.val = caller_data->rdnis.plan; } redirNmb->typeNmb.pres = PRSNT_NODEF; - if (ftdm->rdnis.type == FTDM_TON_INVALID) { + if (caller_data->rdnis.type == FTDM_TON_INVALID) { redirNmb->typeNmb.val = FTDM_TON_UNKNOWN; } else { - redirNmb->typeNmb.val = ftdm->rdnis.type; + redirNmb->typeNmb.val = caller_data->rdnis.type; } redirNmb->nmbDigits.pres = PRSNT_NODEF; redirNmb->nmbDigits.len = len; - memcpy(redirNmb->nmbDigits.val, ftdm->rdnis.digits, len); + memcpy(redirNmb->nmbDigits.val, caller_data->rdnis.digits, len); return FTDM_SUCCESS; } -ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan) +ftdm_status_t set_calling_name(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan) { uint8_t len; - ftdm_caller_data_t *ftdm = &ftdmchan->caller_data; + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; /* sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data; */ sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - len = strlen(ftdm->cid_name); + len = strlen(caller_data->cid_name); if (!len) { return FTDM_SUCCESS; } @@ -359,7 +380,7 @@ ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmc conEvnt->usrUsr.usrInfo.len = len; /* in sangoma_brid we used to send usr-usr info as <cid_name>!<calling_number>, change to previous style if current one does not work */ - memcpy(conEvnt->usrUsr.usrInfo.val, ftdm->cid_name, len); + memcpy(conEvnt->usrUsr.usrInfo.val, caller_data->cid_name, len); } else { switch (signal_data->switchtype) { case SNGISDN_SWITCH_NI2: @@ -377,7 +398,7 @@ ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmc conEvnt->display.eh.pres = PRSNT_NODEF; conEvnt->display.dispInfo.pres = PRSNT_NODEF; conEvnt->display.dispInfo.len = len; - memcpy(conEvnt->display.dispInfo.val, ftdm->cid_name, len); + memcpy(conEvnt->display.dispInfo.val, caller_data->cid_name, len); break; case SNGISDN_SWITCH_QSIG: /* It seems like QSIG does not support Caller ID Name */ @@ -390,6 +411,20 @@ ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmc return FTDM_SUCCESS; } +ftdm_status_t set_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr) +{ + const char *facility_str = NULL; + + facility_str = ftdm_channel_get_var(ftdmchan, "isdn.facility.val"); + if (facility_str) { + facilityStr->eh.pres = PRSNT_NODEF; + facilityStr->facilityStr.len = strlen(facility_str); + memcpy(facilityStr->facilityStr.val, facility_str, facilityStr->facilityStr.len); + return FTDM_SUCCESS; + } + return FTDM_FAIL; +} + void sngisdn_t3_timeout(void* p_sngisdn_info) { sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*)p_sngisdn_info; diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index e5ffd09..45fb1e9 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -285,7 +285,7 @@ typedef enum { /*! \brief Signaling messages sent by the stacks */ typedef enum { - FTDM_SIGEVENT_START, /*!< Incoming call (ie: incoming SETUP msg or Ring) */ + FTDM_SIGEVENT_START,/*!< Incoming call (ie: incoming SETUP msg or Ring) */ FTDM_SIGEVENT_STOP, /*!< Hangup */ FTDM_SIGEVENT_RELEASED, /*!< Channel is completely released and available */ FTDM_SIGEVENT_UP, /*!< Outgoing call has been answered */ @@ -300,12 +300,12 @@ typedef enum { FTDM_SIGEVENT_RESTART, /*!< Restart has been requested. Typically you hangup your call resources here */ FTDM_SIGEVENT_SIGSTATUS_CHANGED, /*!< Signaling protocol status changed (ie: D-chan up), see new status in raw_data ftdm_sigmsg_t member */ FTDM_SIGEVENT_COLLISION, /*!< Outgoing call was dropped because an incoming call arrived at the same time */ - FTDM_SIGEVENT_MSG, /* !< We received an in-call msg */ + FTDM_SIGEVENT_MSG, /*!< We received an in-call msg */ FTDM_SIGEVENT_INVALID } ftdm_signal_event_t; #define SIGNAL_STRINGS "START", "STOP", "RELEASED", "UP", "FLASH", "PROCEED", "PROGRESS", \ "PROGRESS_MEDIA", "ALARM_TRAP", "ALARM_CLEAR", \ - "COLLECTED_DIGIT", "ADD_CALL", "RESTART", "SIGSTATUS_CHANGED", "COLLISION", "INVALID" + "COLLECTED_DIGIT", "ADD_CALL", "RESTART", "SIGSTATUS_CHANGED", "COLLISION", "MSG", "INVALID" /*! \brief Move from string to ftdm_signal_event_t and viceversa */ FTDM_STR2ENUM_P(ftdm_str2ftdm_signal_event, ftdm_signal_event2str, ftdm_signal_event_t) commit 7433a1e5786f91f07f3b13f392596943062b4a13 Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Nov 25 13:16:44 2010 -0500 Fix for caller ID not received properly on BRI diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 25ffef8..a82ed28 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -376,16 +376,18 @@ void sngisdn_rcv_cc_ind(CcMngmt *status); void sngisdn_rcv_sng_log(uint8_t level, char *fmt,...); void sngisdn_rcv_sng_assert(char *message); -ftdm_status_t cpy_calling_num_from_stack(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb); -ftdm_status_t cpy_called_num_from_stack(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb); -ftdm_status_t cpy_redir_num_from_stack(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb); -ftdm_status_t cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *display); -ftdm_status_t cpy_facility_ie_from_stack(ftdm_caller_data_t *ftdm, uint8_t *data, uint32_t data_len); - -ftdm_status_t cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm); -ftdm_status_t cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm); -ftdm_status_t cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm); -ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan); +ftdm_status_t get_calling_num(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb); +ftdm_status_t get_called_num(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb); +ftdm_status_t get_redir_num(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb); +ftdm_status_t get_calling_name_from_display(ftdm_caller_data_t *ftdm, Display *display); +ftdm_status_t get_calling_name_from_usr_usr(ftdm_caller_data_t *ftdm, UsrUsr *usrUsr); +ftdm_status_t get_facility_ie(ftdm_caller_data_t *ftdm, uint8_t *data, uint32_t data_len); + +ftdm_status_t set_calling_num(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm); +ftdm_status_t set_called_num(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm); +ftdm_status_t set_redir_num(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm); +ftdm_status_t set_calling_name(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan); +ftdm_status_t set_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr); uint8_t sngisdn_get_infoTranCap_from_stack(ftdm_bearer_cap_t bearer_capability); uint8_t sngisdn_get_usrInfoLyr1Prot_from_stack(ftdm_user_layer1_prot_t layer1_prot); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 209284a..a541a65 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -127,10 +127,14 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) ftdm_channel_add_var(ftdmchan, "isdn_specific_var", "1"); #endif /* Fill in call information */ - cpy_calling_num_from_stack(&ftdmchan->caller_data, &conEvnt->cgPtyNmb); - cpy_called_num_from_stack(&ftdmchan->caller_data, &conEvnt->cdPtyNmb); - cpy_calling_name_from_stack(&ftdmchan->caller_data, &conEvnt->display); - cpy_redir_num_from_stack(&ftdmchan->caller_data, &conEvnt->redirNmb); + get_calling_num(&ftdmchan->caller_data, &conEvnt->cgPtyNmb); + get_called_num(&ftdmchan->caller_data, &conEvnt->cdPtyNmb); + get_redir_num(&ftdmchan->caller_data, &conEvnt->redirNmb); + + if (get_calling_name_from_display(&ftdmchan->caller_data, &conEvnt->display) != FTDM_SUCCESS) { + get_calling_name_from_usr_usr(&ftdmchan->caller_data, &conEvnt->usrUsr); + } + ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Incoming call: Called No:[%s] Calling No:[%s]\n", ftdmchan->caller_data.dnis.digits, ftdmchan->caller_data.cid_num.digits); if (conEvnt->bearCap[0].eh.pres) { @@ -147,7 +151,7 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) if (conEvnt->facilityStr.eh.pres) { if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - cpy_facility_ie_from_stack(&ftdmchan->caller_data, conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len); + get_facility_ie(&ftdmchan->caller_data, conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len); } else if (signal_data->facility == SNGISDN_OPT_TRUE) { /* Verify whether the Caller Name will come in a subsequent FACILITY message */ uint16_t ret_val; @@ -413,7 +417,7 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) ftdm_size_t min_digits = ((sngisdn_span_data_t*)ftdmchan->span->signal_data)->min_digits; ftdm_size_t num_digits; - cpy_called_num_from_stack(&ftdmchan->caller_data, &cnStEvnt->cdPtyNmb); + get_called_num(&ftdmchan->caller_data, &cnStEvnt->cdPtyNmb); num_digits = strlen(ftdmchan->caller_data.dnis.digits); if (cnStEvnt->sndCmplt.eh.pres || num_digits >= min_digits) { @@ -472,7 +476,7 @@ void sngisdn_process_disc_ind (sngisdn_event_data_t *sngisdn_event) case FTDM_CHANNEL_STATE_UP: if (discEvnt->facilityStr.eh.pres) { if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - cpy_facility_ie_from_stack(&ftdmchan->caller_data, discEvnt->facilityStr.facilityStr.val, discEvnt->facilityStr.facilityStr.len); + get_facility_ie(&ftdmchan->caller_data, discEvnt->facilityStr.facilityStr.val, discEvnt->facilityStr.facilityStr.len); } else { /* Call libsng_isdn facility decode function and copy variables here */ } @@ -569,7 +573,7 @@ void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event) if (relEvnt->facilityStr.eh.pres) { if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - cpy_facility_ie_from_stack(&ftdmchan->caller_data, relEvnt->facilityStr.facilityStr.val, relEvnt->facilityStr.facilityStr.len); + get_facility_ie(&ftdmchan->caller_data, relEvnt->facilityStr.facilityStr.val, relEvnt->facilityStr.facilityStr.len); } else { /* Call libsng_isdn facility decode function and copy variables here */ } @@ -785,7 +789,7 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event) ftdm_sigmsg_t sigev; if (facEvnt->facElmt.facStr.pres) { if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { - cpy_facility_ie_from_stack(&ftdmchan->caller_data, &facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len); + get_facility_ie(&ftdmchan->caller_data, &facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len); } else { /* Call libsng_isdn facility decode function and copy variables here */ } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 385d1eb..36c6782 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -35,7 +35,6 @@ #include "ftmod_sangoma_isdn.h" static void sngisdn_set_prog_desc(ProgInd *progInd, ftdm_sngisdn_progind_t prod_ind); -static void sngisdn_set_facilityStr(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr); void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) { @@ -136,12 +135,11 @@ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) } ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Outgoing call: Called No:[%s] Calling No:[%s]\n", ftdmchan->caller_data.dnis.digits, ftdmchan->caller_data.cid_num.digits); - cpy_called_num_from_user(&conEvnt.cdPtyNmb, &ftdmchan->caller_data); - cpy_calling_num_from_user(&conEvnt.cgPtyNmb, &ftdmchan->caller_data); - cpy_redir_num_from_user(&conEvnt.redirNmb, &ftdmchan->caller_data); - cpy_calling_name_from_user(&conEvnt, ftdmchan); - - sngisdn_set_facilityStr(ftdmchan, &conEvnt.facilityStr); + set_called_num(&conEvnt.cdPtyNmb, &ftdmchan->caller_data); + set_calling_num(&conEvnt.cgPtyNmb, &ftdmchan->caller_data); + set_redir_num(&conEvnt.redirNmb, &ftdmchan->caller_data); + set_calling_name(&conEvnt, ftdmchan); + set_facility_ie(ftdmchan, &conEvnt.facilityStr); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending SETUP (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); @@ -558,7 +556,8 @@ void sngisdn_snd_disconnect(ftdm_channel_t *ftdmchan) discEvnt.causeDgn[0].recommend.pres = NOTPRSNT; discEvnt.causeDgn[0].dgnVal.pres = NOTPRSNT; - sngisdn_set_facilityStr(ftdmchan, &discEvnt.facilityStr); + set_facility_ie(ftdmchan, &discEvnt.facilityStr); + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending DISCONNECT (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); if (sng_isdn_disc_request(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &discEvnt)) { @@ -604,7 +603,7 @@ void sngisdn_snd_release(ftdm_channel_t *ftdmchan, uint8_t glare) spInstId = sngisdn_info->spInstId; } - sngisdn_set_facilityStr(ftdmchan, &relEvnt.facilityStr); + set_facility_ie(ftdmchan, &relEvnt.facilityStr); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending RELEASE/RELEASE COMPLETE (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, suInstId, spInstId); @@ -647,19 +646,6 @@ static void sngisdn_set_prog_desc(ProgInd *progInd, ftdm_sngisdn_progind_t prog_ return; } -static void sngisdn_set_facilityStr(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr) -{ - const char *facility_str = NULL; - - facility_str = ftdm_channel_get_var(ftdmchan, "isdn.facility.val"); - if (facility_str) { - facilityStr->eh.pres = PRSNT_NODEF; - facilityStr->facilityStr.len = strlen(facility_str); - memcpy(facilityStr->facilityStr.val, facility_str, facilityStr->facilityStr.len); - } - return; -} - /* We received an incoming frame on the d-channel, send data to the stack */ void sngisdn_snd_data(ftdm_channel_t *dchan, uint8_t *data, ftdm_size_t len) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 379c481..4ddb90b 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -147,76 +147,79 @@ ftdm_status_t sngisdn_set_avail_rate(ftdm_span_t *span, sngisdn_avail_t avail) return FTDM_SUCCESS; } -ftdm_status_t cpy_calling_num_from_stack(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb) +ftdm_status_t get_calling_num(ftdm_caller_data_t *caller_data, CgPtyNmb *cgPtyNmb) { if (cgPtyNmb->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; } if (cgPtyNmb->screenInd.pres == PRSNT_NODEF) { - ftdm->screen = cgPtyNmb->screenInd.val; + caller_data->screen = cgPtyNmb->screenInd.val; } if (cgPtyNmb->presInd0.pres == PRSNT_NODEF) { - ftdm->pres = cgPtyNmb->presInd0.val; + caller_data->pres = cgPtyNmb->presInd0.val; } if (cgPtyNmb->nmbPlanId.pres == PRSNT_NODEF) { - ftdm->cid_num.plan = cgPtyNmb->nmbPlanId.val; + caller_data->cid_num.plan = cgPtyNmb->nmbPlanId.val; } + if (cgPtyNmb->typeNmb1.pres == PRSNT_NODEF) { - ftdm->cid_num.type = cgPtyNmb->typeNmb1.val; + caller_data->cid_num.type = cgPtyNmb->typeNmb1.val; } if (cgPtyNmb->nmbDigits.pres == PRSNT_NODEF) { - ftdm_copy_string(ftdm->cid_num.digits, (const char*)cgPtyNmb->nmbDigits.val, cgPtyNmb->nmbDigits.len+1); + ftdm_copy_string(caller_data->cid_num.digits, (const char*)cgPtyNmb->nmbDigits.val, cgPtyNmb->nmbDigits.len+1); } + memcpy(&caller_data->ani, &caller_data->cid_num, sizeof(caller_data->ani)); return FTDM_SUCCESS; } -ftdm_status_t cpy_called_num_from_stack(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb) +ftdm_status_t get_called_num(ftdm_caller_data_t *caller_data, CdPtyNmb *cdPtyNmb) { if (cdPtyNmb->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; } if (cdPtyNmb->nmbPlanId.pres == PRSNT_NODEF) { - ftdm->dnis.plan = cdPtyNmb->nmbPlanId.val; + caller_data->dnis.plan = cdPtyNmb->nmbPlanId.val; } if (cdPtyNmb->typeNmb0.pres == PRSNT_NODEF) { - ftdm->dnis.type = cdPtyNmb->typeNmb0.val; + caller_data->dnis.type = cdPtyNmb->typeNmb0.val; } if (cdPtyNmb->nmbDigits.pres == PRSNT_NODEF) { - unsigned i = strlen(ftdm->dnis.digits); + /* In overlap receive mode, append the new digits to the existing dnis */ + unsigned i = strlen(caller_data->dnis.digits); - ftdm_copy_string(&ftdm->dnis.digits[i], (const char*)cdPtyNmb->nmbDigits.val, cdPtyNmb->nmbDigits.len+1); + ftdm_copy_string(&caller_data->dnis.digits[i], (const char*)cdPtyNmb->nmbDigits.val, cdPtyNmb->nmbDigits.len+1); } return FTDM_SUCCESS; } -ftdm_status_t cpy_redir_num_from_stack(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb) +ftdm_status_t get_redir_num(ftdm_caller_data_t *caller_data, RedirNmb *redirNmb) { if (redirNmb->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; } if (redirNmb->nmbPlanId.pres == PRSNT_NODEF) { - ftdm->rdnis.plan = redirNmb->nmbPlanId.val; + caller_data->rdnis.plan = redirNmb->nmbPlanId.val; } if (redirNmb->typeNmb.pres == PRSNT_NODEF) { - ftdm->rdnis.type = redirNmb->typeNmb.val; + caller_data->rdnis.type = redirNmb->typeNmb.val; } if (redirNmb->nmbDigits.pres == PRSNT_NODEF) { - ftdm_copy_string(ftdm->rdnis.digits, (const char*)redirNmb->nmbDigits.val, redirNmb->nmbDigits.len+1); + ftdm_copy_string(caller_data->rdnis.digits, (const char*)redirNmb->nmbDigits.val, redirNmb->nmbDigits.len+1); } return FTDM_SUCCESS; } -ftdm_status_t cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *display) +ftdm_status_t get_calling_name_from_display(ftdm_caller_data_t *caller_data, Display *display) { if (display->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; @@ -225,11 +228,29 @@ ftdm_status_t cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *dis return FTDM_FAIL; } - ftdm_copy_string(ftdm->cid_name, (const char*)display->dispInfo.val, display->dispInfo.len+1); + ftdm_copy_string(caller_data->cid_name, (const char*)display->dispInfo.val, display->dispInfo.len+1); + return FTDM_SUCCESS; +} + +ftdm_status_t get_calling_name_from_usr_usr(ftdm_caller_data_t *caller_data, UsrUsr *usrUsr) +{ + if (usrUsr->eh.pres != PRSNT_NODEF) { + return FTDM_FAIL; + } + + if (usrUsr->protocolDisc.val != PD_IA5) { + return FTDM_FAIL; + } + + if (usrUsr->usrInfo.pres != PRSNT_NODEF) { + return FTDM_FAIL; + } + + ftdm_copy_string(caller_data->cid_name, (const char*)usrUsr->usrInfo.val, usrUsr->usrInfo.len+1); return FTDM_SUCCESS; } -ftdm_status_t cpy_facility_ie_from_stack(ftdm_caller_data_t *caller_data, uint8_t *data, uint32_t data_len) +ftdm_status_t get_facility_ie(ftdm_caller_data_t *caller_data, uint8_t *data, uint32_t data_len) { if (data_len > sizeof(caller_data->raw_data)-2) { ftdm_log(FTDM_LOG_CRIT, "Length of Facility IE exceeds maximum length\n"); @@ -247,67 +268,67 @@ ftdm_status_t cpy_facility_ie_from_stack(ftdm_caller_data_t *caller_data, uint8_ return FTDM_SUCCESS; } -ftdm_status_t cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm) +ftdm_status_t set_calling_num(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *caller_data) { - uint8_t len = strlen(ftdm->cid_num.digits); + uint8_t len = strlen(caller_data->cid_num.digits); if (!len) { return FTDM_SUCCESS; } cgPtyNmb->eh.pres = PRSNT_NODEF; cgPtyNmb->screenInd.pres = PRSNT_NODEF; - cgPtyNmb->screenInd.val = ftdm->screen; + cgPtyNmb->screenInd.val = caller_data->screen; cgPtyNmb->presInd0.pres = PRSNT_NODEF; - cgPtyNmb->presInd0.val = ftdm->pres; - + cgPtyNmb->presInd0.val = caller_data->pres; + cgPtyNmb->nmbPlanId.pres = PRSNT_NODEF; - cgPtyNmb->nmbPlanId.val = ftdm->cid_num.plan; + cgPtyNmb->nmbPlanId.val = caller_data->cid_num.plan; cgPtyNmb->typeNmb1.pres = PRSNT_NODEF; - cgPtyNmb->typeNmb1.val = ftdm->cid_num.type; + cgPtyNmb->typeNmb1.val = caller_data->cid_num.type; cgPtyNmb->nmbDigits.pres = PRSNT_NODEF; cgPtyNmb->nmbDigits.len = len; - memcpy(cgPtyNmb->nmbDigits.val, ftdm->cid_num.digits, len); + memcpy(cgPtyNmb->nmbDigits.val, caller_data->cid_num.digits, len); return FTDM_SUCCESS; } -ftdm_status_t cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm) +ftdm_status_t set_called_num(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *caller_data) { - uint8_t len = strlen(ftdm->dnis.digits); + uint8_t len = strlen(caller_data->dnis.digits); if (!len) { return FTDM_SUCCESS; } cdPtyNmb->eh.pres = PRSNT_NODEF; cdPtyNmb->nmbPlanId.pres = PRSNT_NODEF; - if (ftdm->dnis.plan == FTDM_NPI_INVALID) { + if (caller_data->dnis.plan == FTDM_NPI_INVALID) { cdPtyNmb->nmbPlanId.val = FTDM_NPI_UNKNOWN; } else { - cdPtyNmb->nmbPlanId.val = ftdm->dnis.plan; + cdPtyNmb->nmbPlanId.val = caller_data->dnis.plan; } cdPtyNmb->typeNmb0.pres = PRSNT_NODEF; - if (ftdm->dnis.type == FTDM_TON_INVALID) { + if (caller_data->dnis.type == FTDM_TON_INVALID) { cdPtyNmb->typeNmb0.val = FTDM_TON_UNKNOWN; } else { - cdPtyNmb->typeNmb0.val = ftdm->dnis.type; + cdPtyNmb->typeNmb0.val = caller_data->dnis.type; } cdPtyNmb->nmbDigits.pres = PRSNT_NODEF; cdPtyNmb->nmbDigits.len = len; - memcpy(cdPtyNmb->nmbDigits.val, ftdm->dnis.digits, len); + memcpy(cdPtyNmb->nmbDigits.val, caller_data->dnis.digits, len); return FTDM_SUCCESS; } -ftdm_status_t cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm) +ftdm_status_t set_redir_num(RedirNmb *redirNmb, ftdm_caller_data_t *caller_data) { - uint8_t len = strlen(ftdm->rdnis.digits); + uint8_t len = strlen(caller_data->rdnis.digits); if (!len) { return FTDM_SUCCESS; } @@ -315,36 +336,36 @@ ftdm_status_t cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_caller_data_t *ft redirNmb->eh.pres = PRSNT_NODEF; redirNmb->nmbPlanId.pres = PRSNT_NODEF; - if (ftdm->rdnis.plan == FTDM_NPI_INVALID) { + if (caller_data->rdnis.plan == FTDM_NPI_INVALID) { redirNmb->nmbPlanId.val = FTDM_NPI_UNKNOWN; } else { - redirNmb->nmbPlanId.val = ftdm->rdnis.plan; + redirNmb->nmbPlanId.val = caller_data->rdnis.plan; } redirNmb->typeNmb.pres = PRSNT_NODEF; - if (ftdm->rdnis.type == FTDM_TON_INVALID) { + if (caller_data->rdnis.type == FTDM_TON_INVALID) { redirNmb->typeNmb.val = FTDM_TON_UNKNOWN; } else { - redirNmb->typeNmb.val = ftdm->rdnis.type; + redirNmb->typeNmb.val = caller_data->rdnis.type; } redirNmb->nmbDigits.pres = PRSNT_NODEF; redirNmb->nmbDigits.len = len; - memcpy(redirNmb->nmbDigits.val, ftdm->rdnis.digits, len); + memcpy(redirNmb->nmbDigits.val, caller_data->rdnis.digits, len); return FTDM_SUCCESS; } -ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan) +ftdm_status_t set_calling_name(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan) { uint8_t len; - ftdm_caller_data_t *ftdm = &ftdmchan->caller_data; + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; /* sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data; */ sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - len = strlen(ftdm->cid_name); + len = strlen(caller_data->cid_name); if (!len) { return FTDM_SUCCESS; } @@ -359,7 +380,7 @@ ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmc conEvnt->usrUsr.usrInfo.len = len; /* in sangoma_brid we used to send usr-usr info as <cid_name>!<calling_number>, change to previous style if current one does not work */ - memcpy(conEvnt->usrUsr.usrInfo.val, ftdm->cid_name, len); + memcpy(conEvnt->usrUsr.usrInfo.val, caller_data->cid_name, len); } else { switch (signal_data->switchtype) { case SNGISDN_SWITCH_NI2: @@ -377,7 +398,7 @@ ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmc conEvnt->display.eh.pres = PRSNT_NODEF; conEvnt->display.dispInfo.pres = PRSNT_NODEF; conEvnt->display.dispInfo.len = len; - memcpy(conEvnt->display.dispInfo.val, ftdm->cid_name, len); + memcpy(conEvnt->display.dispInfo.val, caller_data->cid_name, len); break; case SNGISDN_SWITCH_QSIG: /* It seems like QSIG does not support Caller ID Name */ @@ -390,6 +411,20 @@ ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmc return FTDM_SUCCESS; } +ftdm_status_t set_facility_ie(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr) +{ + const char *facility_str = NULL; + + facility_str = ftdm_channel_get_var(ftdmchan, "isdn.facility.val"); + if (facility_str) { + facilityStr->eh.pres = PRSNT_NODEF; + facilityStr->facilityStr.len = strlen(facility_str); + memcpy(facilityStr->facilityStr.val, facility_str, facilityStr->facilityStr.len); + return FTDM_SUCCESS; + } + return FTDM_FAIL; +} + void sngisdn_t3_timeout(void* p_sngisdn_info) { sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*)p_sngisdn_info; diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 87da5d1..014eeef 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -285,7 +285,7 @@ typedef enum { /*! \brief Signaling messages sent by the stacks */ typedef enum { - FTDM_SIGEVENT_START, /*!< Incoming call (ie: incoming SETUP msg or Ring) */ + FTDM_SIGEVENT_START,/*!< Incoming call (ie: incoming SETUP msg or Ring) */ FTDM_SIGEVENT_STOP, /*!< Hangup */ FTDM_SIGEVENT_RELEASED, /*!< Channel is completely released and available */ FTDM_SIGEVENT_UP, /*!< Outgoing call has been answered */ @@ -300,12 +300,12 @@ typedef enum { FTDM_SIGEVENT_RESTART, /*!< Restart has been requested. Typically you hangup your call resources here */ FTDM_SIGEVENT_SIGSTATUS_CHANGED, /*!< Signaling protocol status changed (ie: D-chan up), see new status in raw_data ftdm_sigmsg_t member */ FTDM_SIGEVENT_COLLISION, /*!< Outgoing call was dropped because an incoming call arrived at the same time */ - FTDM_SIGEVENT_MSG, /* !< We received an in-call msg */ + FTDM_SIGEVENT_MSG, /*!< We received an in-call msg */ FTDM_SIGEVENT_INVALID } ftdm_signal_event_t; #define SIGNAL_STRINGS "START", "STOP", "RELEASED", "UP", "FLASH", "PROCEED", "PROGRESS", \ "PROGRESS_MEDIA", "ALARM_TRAP", "ALARM_CLEAR", \ - "COLLECTED_DIGIT", "ADD_CALL", "RESTART", "SIGSTATUS_CHANGED", "COLLISION", "INVALID" + "COLLECTED_DIGIT", "ADD_CALL", "RESTART", "SIGSTATUS_CHANGED", "COLLISION", "MSG", "INVALID" /*! \brief Move from string to ftdm_signal_event_t and viceversa */ FTDM_STR2ENUM_P(ftdm_str2ftdm_signal_event, ftdm_signal_event2str, ftdm_signal_event_t) commit ffbded67fdd5dc177d950be82951d3fa6208cf24 Author: Moises Silva <moy@sangoma.com> Date: Thu Nov 25 12:33:36 2010 -0500 freetdm: ftmod_libpri - lock the channel in libpri on_ring callback this should fix potential call_data pointer corruption diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index cf84dbe..c8e8652 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -495,6 +495,7 @@ static ftdm_state_map_t isdn_state_map = { /** * \brief Handler for channel state change * \param ftdmchan Channel to handle + * \note This function MUST be called with the channel locked */ static __inline__ void state_advance(ftdm_channel_t *chan) { @@ -989,7 +990,16 @@ static int on_ring(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event if (!chan) { ftdm_log(FTDM_LOG_ERROR, "-- Unable to get channel %d:%d\n", ftdm_span_get_id(span), pevent->ring.channel); - goto done; + return ret; + } + + ftdm_channel_lock(chan); + + if (chan->call_data) { + /* we could drop the incoming call, but most likely the pointer is just a ghost of the past, + * this check is just to detect potentially unreleased pointers */ + ftdm_log_chan(chan, FTDM_LOG_ERROR, "channel already has call %p!\n", chan->call_data); + chan->call_data = NULL; } if (ftdm_channel_get_state(chan) != FTDM_CHANNEL_STATE_DOWN || ftdm_test_flag(chan, FTDM_CHANNEL_INUSE)) { @@ -1049,9 +1059,10 @@ static int on_ring(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event /* hurr, this is valid as along as nobody releases the call */ chan->call_data = pevent->ring.call; - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RING); + ftdm_set_state(chan, FTDM_CHANNEL_STATE_RING); done: + ftdm_channel_unlock(chan); return ret; } commit d32be19c00308d97821ee8e9cdad48a8b7f53228 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Nov 25 15:40:44 2010 -0200 freetdm: moved ftdm_channel_read_event() to freetdm.h diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index f862ae1..e5ffd09 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -890,6 +890,23 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_add_to_group(const char* name, ftdm_chann /*! \brief Remove the channel from a hunt group */ FT_DECLARE(ftdm_status_t) ftdm_channel_remove_from_group(ftdm_group_t* group, ftdm_channel_t* ftdmchan); +/*! + * \brief Retrieves an event from the span + * + * \note + * This function is non-reentrant and not thread-safe. + * The event returned may be modified if the function is called again + * from a different thread or even the same. It is recommended to + * handle events from the same span in a single thread. + * + * \param span The channel to retrieve the event from + * \param event Pointer to store the pointer to the event + * + * \retval FTDM_SUCCESS success (at least one event available) + * \retval FTDM_FAIL failure + */ +FT_DECLARE(ftdm_status_t) ftdm_channel_read_event(ftdm_channel_t *ftdmchan, ftdm_event_t **event); + /*! \brief Find a hunt group by id */ FT_DECLARE(ftdm_status_t) ftdm_group_find(uint32_t id, ftdm_group_t **group); diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index 7d3ee68..06f899c 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -616,23 +616,6 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_chan(ftdm_channel_t *ftdmchan); FT_DECLARE(ftdm_status_t) ftdm_span_next_event(ftdm_span_t *span, ftdm_event_t **event); /*! - * \brief Retrieves an event from the span - * - * \note - * This function is non-reentrant and not thread-safe. - * The event returned may be modified if the function is called again - * from a different thread or even the same. It is recommended to - * handle events from the same span in a single thread. - * - * \param span The channel to retrieve the event from - * \param event Pointer to store the pointer to the event - * - * \retval FTDM_SUCCESS success (at least one event available) - * \retval FTDM_FAIL failure - */ -FT_DECLARE(ftdm_status_t) ftdm_channel_read_event(ftdm_channel_t *ftdmchan, ftdm_event_t **event); - -/*! * \brief Enqueue a DTMF string into the channel * * \param ftdmchan The channel to enqueue the dtmf string to commit 78036cdcecee3c585b54e819e4519b3b51ad8012 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Nov 25 14:31:30 2010 -0200 freetdm: eliminated some warnings from ftmod_r2 windows build diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 52c0f86..bfe49fd 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -889,7 +889,7 @@ static openr2_io_interface_t ftdm_r2_io_iface = { static FIO_SIG_CONFIGURE_FUNCTION(ftdm_r2_configure_span) //ftdm_status_t (ftdm_span_t *span, fio_signal_cb_t sig_cb, va_list ap) { - int i = 0; + unsigned int i = 0; int conf_failure = 0; char *var = NULL; char *val = NULL; @@ -1107,11 +1107,6 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_r2_configure_span) openr2_chan_set_log_level(r2chan, r2conf.loglevel); if (r2conf.call_files) { openr2_chan_enable_call_files(r2chan); -#if 0 - if (r2conf.mf_files) { - openr2_chan_enable_mf_files(r2chan); - } -#endif } r2call = ftdm_malloc(sizeof(*r2call)); @@ -1348,8 +1343,8 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) ftdm_span_t *span = (ftdm_span_t *) obj; ftdm_r2_data_t *r2data = span->signal_data; int waitms = 20; - int i, res; - int ms; + unsigned int i; + int res, ms; struct timeval start, end; short *poll_events = ftdm_malloc(sizeof(short)*span->chan_count); ftdm_event_t *event = NULL; @@ -1413,8 +1408,8 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) * XXX */ for (i = 1; i <= span->chan_count; i++) { r2chan = R2CALL(span->channels[i])->r2chan; - r2call = R2CALL(ftdmchan); ftdmchan = openr2_chan_get_client_data(r2chan); + r2call = R2CALL(ftdmchan); ftdm_mutex_lock(ftdmchan->mutex); ftdm_r2_state_advance(ftdmchan); @@ -1487,8 +1482,8 @@ static FIO_API_FUNCTION(ftdm_r2_api) char *mycmd = NULL, *argv[10] = { 0 }; int argc = 0; int span_id = 0; - int chan_id = 0; - int i = 0; + unsigned int chan_id = 0; + unsigned int i = 0; ftdm_r2_data_t *r2data = NULL; openr2_chan_t *r2chan = NULL; openr2_context_t *r2context = NULL; commit 597aa087db0633cea368360fdb3b552283ea3c7d Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Nov 25 00:36:01 2010 -0200 freetdm: on ftmod_r2, fixed flags for correctly polling the span, now freeing poll_events pointer, enabling/disabling channel reading flag when needed. also removed the test for FTDM_CHANNEL_OPEN flag on ftdm_channel_wait(). diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 246ebc0..c36b265 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2871,11 +2871,6 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_wait(ftdm_channel_t *ftdmchan, ftdm_wait_ assert(ftdmchan != NULL); assert(ftdmchan->fio != NULL); - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "channel not open"); - return FTDM_FAIL; - } - if (!ftdmchan->fio->wait) { snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "method not implemented"); return FTDM_FAIL; diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 8a4a826..52c0f86 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -781,7 +781,7 @@ static int ftdm_r2_io_wait(openr2_chan_t *r2chan, int *flags, int block) int32_t timeout; ftdm_wait_flag_t ftdmflags = 0; - ftdm_channel_t *ftdm_chan = openr2_chan_get_fd(r2chan); + ftdm_channel_t *fchan = openr2_chan_get_fd(r2chan); timeout = block ? -1 : 0; if (*flags & OR2_IO_READ) { @@ -794,9 +794,10 @@ static int ftdm_r2_io_wait(openr2_chan_t *r2chan, int *flags, int block) ftdmflags |= FTDM_EVENTS; } - status = ftdm_channel_wait(ftdm_chan, &ftdmflags, timeout); + status = ftdm_channel_wait(fchan, &ftdmflags, timeout); if (FTDM_SUCCESS != status && FTDM_TIMEOUT != status) { + ftdm_log_chan_msg(fchan, FTDM_LOG_ERROR, "Failed to wait for events on channel\n"); return -1; } @@ -869,7 +870,6 @@ static int ftdm_r2_io_get_oob_event(openr2_chan_t *r2chan, openr2_oob_event_t *e } break; } - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "returning event: %s\n", ftdm_signal_event2str(*event)); return 0; } @@ -1212,6 +1212,7 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_INTERVAL, &interval); ftdm_assert(interval != 0, "Invalid interval!"); ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Starting processing of incoming call with interval %d\n", interval); + openr2_chan_enable_read(r2chan); } break; @@ -1223,6 +1224,7 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) ftdm_assert(interval != 0, "Invalid interval!"); ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Starting processing of outgoing call in channel with interval %d\n", interval); + openr2_chan_enable_read(r2chan); } break; @@ -1289,7 +1291,6 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) { openr2_call_disconnect_cause_t disconnect_cause = ftdm_r2_ftdm_cause_to_openr2_cause(ftdmchan); ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Clearing call, cause = %s\n", openr2_proto_get_disconnect_string(disconnect_cause)); - openr2_chan_enable_read(r2chan); if (!R2CALL(ftdmchan)->disconnect_rcvd) { /* this will disconnect the call, but need to wait for the call end before moving to DOWN */ openr2_chan_disconnect_call(r2chan, disconnect_cause); @@ -1304,7 +1305,6 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) case FTDM_CHANNEL_STATE_CANCEL: { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Unable to receive call\n"); - openr2_chan_enable_read(r2chan); openr2_chan_disconnect_call(r2chan, OR2_CAUSE_OUT_OF_ORDER); } break; @@ -1316,6 +1316,7 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) if (R2CALL(ftdmchan)->txdrops) { ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "dropped %d tx packets\n", R2CALL(ftdmchan)->txdrops); } + openr2_chan_disable_read(r2chan); ret = 1; } break; @@ -1385,7 +1386,10 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) for (i = 0; i < span->chan_count; i++) { r2chan = R2CALL(span->channels[(i+1)])->r2chan; ftdmchan = openr2_chan_get_client_data(r2chan); - poll_events[i] = ftdmchan->state == FTDM_CHANNEL_STATE_DOWN ? POLLPRI : (POLLPRI | POLLIN | POLLOUT); + poll_events[i] = POLLPRI; + if (openr2_chan_get_read_enabled(r2chan)) { + poll_events[i] |= POLLIN; + } } status = ftdm_span_poll_event(span, waitms, poll_events); @@ -1426,6 +1430,8 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) openr2_chan_set_blocked(r2chan); } + ftdm_safe_free(poll_events); + ftdm_clear_flag(r2data, FTDM_R2_RUNNING); ftdm_log(FTDM_LOG_DEBUG, "R2 thread ending.\n"); diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index 1a43c4d..c55d42e 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -1131,10 +1131,8 @@ FIO_CHANNEL_NEXT_EVENT_FUNCTION(wanpipe_channel_next_event) memset(&tdm_api, 0, sizeof(tdm_api)); status = sangoma_tdm_read_event(ftdmchan->sockfd, &tdm_api); if (status != FTDM_SUCCESS) { -#if 0 snprintf(span->last_error, sizeof(span->last_error), "%s", strerror(errno)); ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to read event from channel: %s\n", strerror(errno)); -#endif return FTDM_FAIL; } commit e79488cf49c70b8d4a73b2c68934565d8427a07f Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Wed Nov 24 22:58:05 2010 -0200 freetdm: now wanpipe_channel_next_event() doesn't expect the flag FTDM_CHANNEL_EVENT to be set. If it is, it just clears it. Also removed unused code from wanpipe_channel_next_event() diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index ae46852..1a43c4d 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -1125,45 +1125,16 @@ FIO_CHANNEL_NEXT_EVENT_FUNCTION(wanpipe_channel_next_event) wanpipe_tdm_api_t tdm_api; ftdm_span_t *span = ftdmchan->span; - if (ftdmchan->last_event_time && !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_EVENT)) { - uint32_t diff = (uint32_t)(ftdm_current_time_in_ms() - ftdmchan->last_event_time); - /* XX printf("%u %u %u\n", diff, (unsigned)ftdm_current_time_in_ms(), (unsigned)ftdmchan->last_event_time); */ - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_WINK)) { - if (diff > wp_globals.wink_ms) { - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_WINK); - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_FLASH); - ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_OFFHOOK); - event_id = FTDM_OOB_OFFHOOK; - goto event; - } - } - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_FLASH)) { - if (diff > wp_globals.flash_ms) { - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_FLASH); - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_WINK); - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_OFFHOOK); - event_id = FTDM_OOB_ONHOOK; - - if (ftdmchan->type == FTDM_CHAN_TYPE_FXO) { - wanpipe_tdm_api_t tdm_api; - memset(&tdm_api, 0, sizeof(tdm_api)); - - sangoma_tdm_txsig_onhook(ftdmchan->sockfd,&tdm_api); - } - goto event; - } - } - } - - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_EVENT)) - return FTDM_FAIL; + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_EVENT)) + ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_EVENT); memset(&tdm_api, 0, sizeof(tdm_api)); status = sangoma_tdm_read_event(ftdmchan->sockfd, &tdm_api); if (status != FTDM_SUCCESS) { +#if 0 snprintf(span->last_error, sizeof(span->last_error), "%s", strerror(errno)); ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to read event from channel: %s\n", strerror(errno)); +#endif return FTDM_FAIL; } @@ -1277,8 +1248,6 @@ FIO_CHANNEL_NEXT_EVENT_FUNCTION(wanpipe_channel_next_event) event: - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_EVENT); - ftdmchan->last_event_time = 0; span->event_header.e_type = FTDM_EVENT_OOB; span->event_header.enum_id = event_id; commit c1e79295e4ff1b37147f97f866bc71a43464f443 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Wed Nov 24 22:14:06 2010 -0200 freetdm: removed wrong main loop code diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 7c5f4a4..8a4a826 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -847,7 +847,7 @@ static int ftdm_r2_io_get_oob_event(openr2_chan_t *r2chan, openr2_oob_event_t *e *event = OR2_OOB_EVENT_NONE; status = ftdm_channel_read_event(ftdmchan, &fevent); if (status != FTDM_SUCCESS) { - //ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "failed to retrieve freetdm event!\n"); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "failed to retrieve freetdm event!\n"); return -1; } if (fevent->e_type != FTDM_EVENT_OOB) @@ -1412,33 +1412,11 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) r2call = R2CALL(ftdmchan); ftdmchan = openr2_chan_get_client_data(r2chan); - status = ftdm_channel_read_event(ftdmchan, &event); ftdm_mutex_lock(ftdmchan->mutex); - if (status == FTDM_SUCCESS) { - switch (event->enum_id) { - case FTDM_OOB_CAS_BITS_CHANGE: - { - ftdm_log(FTDM_LOG_DEBUG, "Handling CAS on channel %d.\n", i); - openr2_chan_process_cas_signaling(r2chan); - } - break; - case FTDM_OOB_ALARM_TRAP: - case FTDM_OOB_ALARM_CLEAR: - { - ftdm_log(FTDM_LOG_DEBUG, "OOB EVENT: %s\n", ftdm_signal_event2str(event->enum_id)); - openr2_chan_process_oob_events(r2chan); - } - break; - } - } - - if (!ftdm_r2_state_advance(ftdmchan)) { - ftdm_mutex_unlock(ftdmchan->mutex); - } + ftdm_r2_state_advance(ftdmchan); openr2_chan_process_signaling(r2chan); - if (!ftdm_r2_state_advance(ftdmchan)) { - ftdm_mutex_unlock(ftdmchan->mutex); - } + ftdm_r2_state_advance(ftdmchan); + ftdm_mutex_unlock(ftdmchan->mutex); } ftdm_span_trigger_signals(span); } commit c842466a6845ed3e81b292c67e456c006b72bc89 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Wed Nov 24 21:25:24 2010 -0200 freetdm: ftdm_channel_read_event() to retrieve events from a channel, removed from ftmod_r2: ftdm_r2_sig_read(), FTDM_R2_PROCESSING flag and locks for ftdmchan diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index a600727..246ebc0 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -988,6 +988,51 @@ FT_DECLARE(ftdm_status_t) ftdm_span_next_event(ftdm_span_t *span, ftdm_event_t * return status; } +FT_DECLARE(ftdm_status_t) ftdm_channel_read_event(ftdm_channel_t *ftdmchan, ftdm_event_t **event) +{ + ftdm_status_t status = FTDM_FAIL; + ftdm_sigmsg_t sigmsg; + ftdm_span_t *span = ftdmchan->span; + ftdm_assert_return(span->fio != NULL, FTDM_FAIL, "No I/O module attached to this span!\n"); + + if (!span->fio->channel_next_event) { + ftdm_log(FTDM_LOG_ERROR, "channel_next_event method not implemented in module %s!", span->fio->name); + return FTDM_NOTIMPL; + } + + status = span->fio->channel_next_event(ftdmchan, event); + if (status != FTDM_SUCCESS) { + return status; + } + + /* before returning the event to the user we do some core operations with certain OOB events */ + memset(&sigmsg, 0, sizeof(sigmsg)); + sigmsg.span_id = span->span_id; + sigmsg.chan_id = (*event)->channel->chan_id; + sigmsg.channel = (*event)->channel; + switch ((*event)->enum_id) { + case FTDM_OOB_ALARM_CLEAR: + { + sigmsg.event_id = FTDM_SIGEVENT_ALARM_CLEAR; + ftdm_clear_flag_locked((*event)->channel, FTDM_CHANNEL_IN_ALARM); + ftdm_span_send_signal(span, &sigmsg); + } + break; + case FTDM_OOB_ALARM_TRAP: + { + sigmsg.event_id = FTDM_SIGEVENT_ALARM_TRAP; + ftdm_set_flag_locked((*event)->channel, FTDM_CHANNEL_IN_ALARM); + ftdm_span_send_signal(span, &sigmsg); + } + break; + default: + /* NOOP */ + break; + } + + return status; +} + static ftdm_status_t ftdmchan_fsk_write_sample(int16_t *buf, ftdm_size_t buflen, void *user_data) { ftdm_channel_t *ftdmchan = (ftdm_channel_t *) user_data; diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 30de788..7c5f4a4 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -57,8 +57,7 @@ typedef enum { } ftdm_r2_flag_t; typedef enum { - FTDM_R2_PROCESSING = (1 << 0), - FTDM_R2_WAITING_ACK = (1 << 1), + FTDM_R2_WAITING_ACK = (1 << 0), } ftdm_r2_call_flag_t; /* private call information stored in ftdmchan->call_data void* ptr */ @@ -398,44 +397,26 @@ static ftdm_status_t ftdm_r2_stop(ftdm_span_t *span) return FTDM_SUCCESS; } -static ftdm_status_t ftdm_r2_sig_read(ftdm_channel_t *ftdmchan, void *data, ftdm_size_t size) -{ - openr2_chan_t *r2chan = R2CALL(ftdmchan)->r2chan; - if (!openr2_chan_get_read_enabled(r2chan)) { - ftdm_mutex_lock(ftdmchan->mutex); - //openr2_chan_process_input(r2chan, data, size); - ftdm_mutex_unlock(ftdmchan->mutex); - } - return FTDM_SUCCESS; -} - /* always called from the monitor thread */ static void ftdm_r2_on_call_init(openr2_chan_t *r2chan) { - //ftdm_status_t status; ftdm_r2_call_t *r2call; ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - //ftdm_r2_data_t *r2data = ftdmchan->span->signal_data; ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "Received request to start call\n"); - ftdm_mutex_lock(ftdmchan->mutex); - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)) { ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Cannot start call when channel is in use (state = %s)\n", ftdm_channel_state2str(ftdmchan->state)); - ftdm_mutex_unlock(ftdmchan->mutex); return; } if (ftdmchan->state != FTDM_CHANNEL_STATE_DOWN) { ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Cannot handle request to start call in state %s\n", ftdm_channel_state2str(ftdmchan->state)); - ftdm_mutex_unlock(ftdmchan->mutex); return; } if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to open channel during incoming call! [%s]\n", ftdmchan->last_error); - ftdm_mutex_unlock(ftdmchan->mutex); return; } @@ -448,7 +429,6 @@ static void ftdm_r2_on_call_init(openr2_chan_t *r2chan) /* clean the call data structure but keep the R2 processing flag on! */ ft_r2_clean_call(ftdmchan->call_data); r2call = R2CALL(ftdmchan); - ftdm_set_flag(r2call, FTDM_R2_PROCESSING); if (ftdmchan->state == FTDM_CHANNEL_STATE_DOWN) { R2CALL(ftdmchan)->chanstate = FTDM_CHANNEL_STATE_DOWN; @@ -457,7 +437,6 @@ static void ftdm_r2_on_call_init(openr2_chan_t *r2chan) } ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); - ftdm_mutex_unlock(ftdmchan->mutex); } /* only called for incoming calls when the ANI, DNIS etc is complete and the user has to decide either to accept or reject the call */ @@ -574,11 +553,8 @@ static void ftdm_r2_on_protocol_error(openr2_chan_t *r2chan, openr2_protocol_err ftdm_r2_data_t *r2data; ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - ftdm_mutex_lock(ftdmchan->mutex); - if (ftdmchan->state == FTDM_CHANNEL_STATE_DOWN) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Got protocol error when we're already down!\n"); - ftdm_mutex_unlock(ftdmchan->mutex); } ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Protocol error\n"); @@ -587,7 +563,6 @@ static void ftdm_r2_on_protocol_error(openr2_chan_t *r2chan, openr2_protocol_err if (!R2CALL(ftdmchan)->ftdm_started) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); - ftdm_mutex_unlock(ftdmchan->mutex); return; } @@ -602,8 +577,6 @@ static void ftdm_r2_on_protocol_error(openr2_chan_t *r2chan, openr2_protocol_err r2data = ftdmchan->span->signal_data; ftdm_span_send_signal(ftdmchan->span, &sigev); - - ftdm_mutex_unlock(ftdmchan->mutex); } static void ftdm_r2_on_line_blocked(openr2_chan_t *r2chan) @@ -867,9 +840,37 @@ static int ftdm_r2_io_setup(openr2_chan_t *r2chan) static int ftdm_r2_io_get_oob_event(openr2_chan_t *r2chan, openr2_oob_event_t *event) { - *event = 0; - ftdm_log(FTDM_LOG_ERROR, "I should not be called (I/O get oob event)!!\n"); - return 0; + ftdm_status_t status; + ftdm_event_t *fevent = NULL; + ftdm_channel_t *ftdmchan = openr2_chan_get_fd(r2chan); + + *event = OR2_OOB_EVENT_NONE; + status = ftdm_channel_read_event(ftdmchan, &fevent); + if (status != FTDM_SUCCESS) { + //ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "failed to retrieve freetdm event!\n"); + return -1; + } + if (fevent->e_type != FTDM_EVENT_OOB) + return 0; + switch (fevent->enum_id) { + case FTDM_OOB_CAS_BITS_CHANGE: + { + *event = OR2_OOB_EVENT_CAS_CHANGE; + } + break; + case FTDM_OOB_ALARM_TRAP: + { + *event = OR2_OOB_EVENT_ALARM_ON; + } + break; + case FTDM_OOB_ALARM_CLEAR: + { + *event = OR2_OOB_EVENT_ALARM_OFF; + } + break; + } + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "returning event: %s\n", ftdm_signal_event2str(*event)); + return 0; } static openr2_io_interface_t ftdm_r2_io_iface = { @@ -1137,7 +1138,7 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_r2_configure_span) span->start = ftdm_r2_start; span->stop = ftdm_r2_stop; - span->sig_read = ftdm_r2_sig_read; + span->sig_read = NULL; span->signal_cb = sig_cb; span->signal_type = FTDM_SIGTYPE_R2; @@ -1350,6 +1351,7 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) int ms; struct timeval start, end; short *poll_events = ftdm_malloc(sizeof(short)*span->chan_count); + ftdm_event_t *event = NULL; #ifdef __linux__ r2data->monitor_thread_id = syscall(SYS_gettid); @@ -1401,63 +1403,44 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) continue; } - if (FTDM_SUCCESS == status) { - ftdm_event_t *event; - while (ftdm_span_next_event(span, &event) == FTDM_SUCCESS) { - if (event->enum_id == FTDM_OOB_CAS_BITS_CHANGE) { - r2call = R2CALL(event->channel); - r2chan = r2call->r2chan; - - ftdm_log(FTDM_LOG_DEBUG, "Handling CAS on channel %d.\n", openr2_chan_get_number(r2chan)); - // we only expect CAS and other OOB events on this thread/loop, once a call is started - // the MF events (in-band signaling) are handled in the call thread - openr2_chan_process_cas_signaling(r2chan); - } else { - ftdm_log(FTDM_LOG_DEBUG, "Ignoring event %d on channel %d.\n", event->enum_id, openr2_chan_get_number(r2chan)); - // XXX TODO: handle alarms here XXX - } - } - - /* XXX - * when ftdm_span_poll_event() returns FTDM_SUCCESS, means there are events pending on the span. - * is it possible to know on which channels those events are pending, without traversing the span? - * XXX */ - for (i = 1; i <= span->chan_count; i++) { - r2chan = R2CALL(span->channels[i])->r2chan; - ftdmchan = openr2_chan_get_client_data(r2chan); - r2call = R2CALL(ftdmchan); - - ftdm_mutex_lock(ftdmchan->mutex); - ftdm_set_flag(r2call, FTDM_R2_PROCESSING); - - if (ftdm_r2_state_advance(ftdmchan)) { - ftdm_clear_flag(r2call, FTDM_R2_PROCESSING); - ftdm_mutex_unlock(ftdmchan->mutex); - continue; - } - - /* handle timeout events first if any */ - openr2_chan_run_schedule(r2chan); - - /* process mf tones, if any */ - if (openr2_chan_get_read_enabled(r2chan)) { - openr2_chan_process_mf_signaling(r2chan); - } + /* XXX + * when ftdm_span_poll_event() returns FTDM_SUCCESS, means there are events pending on the span. + * is it possible to know on which channels those events are pending, without traversing the span? + * XXX */ + for (i = 1; i <= span->chan_count; i++) { + r2chan = R2CALL(span->channels[i])->r2chan; + r2call = R2CALL(ftdmchan); + ftdmchan = openr2_chan_get_client_data(r2chan); - if (ftdm_r2_state_advance(ftdmchan)) { - ftdm_clear_flag(r2call, FTDM_R2_PROCESSING); - ftdm_mutex_unlock(ftdmchan->mutex); - continue; + status = ftdm_channel_read_event(ftdmchan, &event); + ftdm_mutex_lock(ftdmchan->mutex); + if (status == FTDM_SUCCESS) { + switch (event->enum_id) { + case FTDM_OOB_CAS_BITS_CHANGE: + { + ftdm_log(FTDM_LOG_DEBUG, "Handling CAS on channel %d.\n", i); + openr2_chan_process_cas_signaling(r2chan); + } + break; + case FTDM_OOB_ALARM_TRAP: + case FTDM_OOB_ALARM_CLEAR: + { + ftdm_log(FTDM_LOG_DEBUG, "OOB EVENT: %s\n", ftdm_signal_event2str(event->enum_id)); + openr2_chan_process_oob_events(r2chan); + } + break; } + } - ftdm_clear_flag(r2call, FTDM_R2_PROCESSING); + if (!ftdm_r2_state_advance(ftdmchan)) { + ftdm_mutex_unlock(ftdmchan->mutex); + } + openr2_chan_process_signaling(r2chan); + if (!ftdm_r2_state_advance(ftdmchan)) { ftdm_mutex_unlock(ftdmchan->mutex); } - } else if (status != FTDM_TIMEOUT) { - ftdm_log(FTDM_LOG_ERROR, "ftdm_span_poll_event returned %d.\n", status); } ftdm_span_trigger_signals(span); - ftdm_sleep(20); } for (i = 1; i <= span->chan_count; i++) { diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index c13455d..ae46852 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -35,6 +35,7 @@ * Moises Silva <moy@sangoma.com> * David Yat Sin <davidy@sangoma.com> * Nenad Corbic <ncorbic@sangoma.com> + * Arnaldo Pereira <arnaldo@sangoma.com> * */ @@ -99,7 +100,8 @@ static struct { /* a bunch of this stuff should go into the wanpipe_tdm_api_iface.h */ FIO_SPAN_POLL_EVENT_FUNCTION(wanpipe_poll_event); -FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_next_event); +FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_span_next_event); +FIO_CHANNEL_NEXT_EVENT_FUNCTION(wanpipe_channel_next_event); /** * \brief Poll for event on a wanpipe socket @@ -1111,12 +1113,187 @@ static FIO_GET_ALARMS_FUNCTION(wanpipe_get_alarms) } /** + * \brief Retrieves an event from a wanpipe channel + * \param channel Channel to retrieve event from + * \param event FreeTDM event to return + * \return Success or failure + */ +FIO_CHANNEL_NEXT_EVENT_FUNCTION(wanpipe_channel_next_event) +{ + ftdm_status_t status; + ftdm_oob_event_t event_id; + wanpipe_tdm_api_t tdm_api; + ftdm_span_t *span = ftdmchan->span; + + if (ftdmchan->last_event_time && !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_EVENT)) { + uint32_t diff = (uint32_t)(ftdm_current_time_in_ms() - ftdmchan->last_event_time); + /* XX printf("%u %u %u\n", diff, (unsigned)ftdm_current_time_in_ms(), (unsigned)ftdmchan->last_event_time); */ + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_WINK)) { + if (diff > wp_globals.wink_ms) { + ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_WINK); + ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_FLASH); + ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_OFFHOOK); + event_id = FTDM_OOB_OFFHOOK; + goto event; + } + } + + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_FLASH)) { + if (diff > wp_globals.flash_ms) { + ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_FLASH); + ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_WINK); + ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_OFFHOOK); + event_id = FTDM_OOB_ONHOOK; + + if (ftdmchan->type == FTDM_CHAN_TYPE_FXO) { + wanpipe_tdm_api_t tdm_api; + memset(&tdm_api, 0, sizeof(tdm_api)); + + sangoma_tdm_txsig_onhook(ftdmchan->sockfd,&tdm_api); + } + goto event; + } + } + } + + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_EVENT)) + return FTDM_FAIL; + + memset(&tdm_api, 0, sizeof(tdm_api)); + status = sangoma_tdm_read_event(ftdmchan->sockfd, &tdm_api); + if (status != FTDM_SUCCESS) { + snprintf(span->last_error, sizeof(span->last_error), "%s", strerror(errno)); + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to read event from channel: %s\n", strerror(errno)); + return FTDM_FAIL; + } + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "read wanpipe event %d\n", tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_type); + switch(tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_type) { + + case WP_TDMAPI_EVENT_LINK_STATUS: + { + switch(tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_link_status) { + case WP_TDMAPI_EVENT_LINK_STATUS_CONNECTED: + event_id = FTDM_OOB_ALARM_CLEAR; + break; + default: + event_id = FTDM_OOB_ALARM_TRAP; + break; + }; + } + break; + + case WP_TDMAPI_EVENT_RXHOOK: + { + if (ftdmchan->type == FTDM_CHAN_TYPE_FXS) { + event_id = tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_hook_state & WP_TDMAPI_EVENT_RXHOOK_OFF ? FTDM_OOB_OFFHOOK : FTDM_OOB_ONHOOK; + if (event_id == FTDM_OOB_OFFHOOK) { + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_FLASH)) { + ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_FLASH); + ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_WINK); + event_id = FTDM_OOB_FLASH; + goto event; + } else { + ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_WINK); + } + } else { + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_WINK)) { + ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_WINK); + ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_FLASH); + event_id = FTDM_OOB_WINK; + goto event; + } else { + ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_FLASH); + } + } + break; + } else { + wanpipe_tdm_api_t onhook_tdm_api; + memset(&onhook_tdm_api, 0, sizeof(onhook_tdm_api)); + status = sangoma_tdm_txsig_onhook(ftdmchan->sockfd, &onhook_tdm_api); + if (status) { + snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "ONHOOK Failed"); + return FTDM_FAIL; + } + event_id = onhook_tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_hook_state & WP_TDMAPI_EVENT_RXHOOK_OFF ? FTDM_OOB_ONHOOK : FTDM_OOB_NOOP; + } + } + break; + case WP_TDMAPI_EVENT_RING_DETECT: + { + event_id = tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_ring_state == WP_TDMAPI_EVENT_RING_PRESENT ? FTDM_OOB_RING_START : FTDM_OOB_RING_STOP; + } + break; + /* + disabled this ones when configuring, we don't need them, do we? + case WP_TDMAPI_EVENT_RING_TRIP_DETECT: + { + event_id = tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_ring_state == WP_TDMAPI_EVENT_RING_PRESENT ? FTDM_OOB_ONHOOK : FTDM_OOB_OFFHOOK; + } + break; + */ + case WP_TDMAPI_EVENT_RBS: + { + event_id = FTDM_OOB_CAS_BITS_CHANGE; + ftdmchan->rx_cas_bits = wanpipe_swap_bits(tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_rbs_bits); + } + break; + case WP_TDMAPI_EVENT_DTMF: + { + char tmp_dtmf[2] = { tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_dtmf_digit, 0 }; + event_id = FTDM_OOB_NOOP; + + if (tmp_dtmf[0] == 'f') { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Ignoring wanpipe DTMF: %c, fax tones will be passed through!\n", tmp_dtmf[0]); + break; + } + + if (tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_dtmf_type == WAN_EC_TONE_PRESENT) { + ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_MUTE); + } + + if (tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_dtmf_type == WAN_EC_TONE_STOP) { + ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_MUTE); + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)) { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Queuing wanpipe DTMF: %c\n", tmp_dtmf[0]); + ftdm_channel_queue_dtmf(ftdmchan, tmp_dtmf); + } + } + } + break; + case WP_TDMAPI_EVENT_ALARM: + { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Got wanpipe alarms %d\n", tdm_api.wp_tdm_cmd.event.wp_api_event_alarm); + event_id = FTDM_OOB_ALARM_TRAP; + } + break; + default: + { + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Unhandled wanpipe event %d\n", tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_type); + event_id = FTDM_OOB_INVALID; + } + break; + } + +event: + + ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_EVENT); + + ftdmchan->last_event_time = 0; + span->event_header.e_type = FTDM_EVENT_OOB; + span->event_header.enum_id = event_id; + span->event_header.channel = ftdmchan; + *event = &span->event_header; + return FTDM_SUCCESS; +} + +/** * \brief Retrieves an event from a wanpipe span * \param span Span to retrieve event from * \param event FreeTDM event to return * \return Success or failure */ -FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_next_event) +FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_span_next_event) { uint32_t i,err; ftdm_oob_event_t event_id; @@ -1348,7 +1525,8 @@ static FIO_IO_LOAD_FUNCTION(wanpipe_init) wanpipe_interface.read = wanpipe_read; wanpipe_interface.write = wanpipe_write; wanpipe_interface.poll_event = wanpipe_poll_event; - wanpipe_interface.next_event = wanpipe_next_event; + wanpipe_interface.next_event = wanpipe_span_next_event; + wanpipe_interface.channel_next_event = wanpipe_channel_next_event; wanpipe_interface.channel_destroy = wanpipe_channel_destroy; wanpipe_interface.get_alarms = wanpipe_get_alarms; *fio = &wanpipe_interface; diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 87da5d1..f862ae1 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -467,6 +467,7 @@ struct ftdm_memory_handler { #define FIO_SPAN_GET_SIG_STATUS_ARGS (ftdm_span_t *span, ftdm_signaling_status_t *status) #define FIO_SPAN_POLL_EVENT_ARGS (ftdm_span_t *span, uint32_t ms, short *poll_events) #define FIO_SPAN_NEXT_EVENT_ARGS (ftdm_span_t *span, ftdm_event_t **event) +#define FIO_CHANNEL_NEXT_EVENT_ARGS (ftdm_channel_t *ftdmchan, ftdm_event_t **event) #define FIO_SIGNAL_CB_ARGS (ftdm_sigmsg_t *sigmsg) #define FIO_EVENT_CB_ARGS (ftdm_channel_t *ftdmchan, ftdm_event_t *event) #define FIO_CONFIGURE_SPAN_ARGS (ftdm_span_t *span, const char *str, ftdm_chan_type_t type, char *name, char *number) @@ -498,6 +499,7 @@ typedef ftdm_status_t (*fio_span_set_sig_status_t) FIO_SPAN_SET_SIG_STATUS_ARGS; typedef ftdm_status_t (*fio_span_get_sig_status_t) FIO_SPAN_GET_SIG_STATUS_ARGS; typedef ftdm_status_t (*fio_span_poll_event_t) FIO_SPAN_POLL_EVENT_ARGS ; typedef ftdm_status_t (*fio_span_next_event_t) FIO_SPAN_NEXT_EVENT_ARGS ; +typedef ftdm_status_t (*fio_channel_next_event_t) FIO_CHANNEL_NEXT_EVENT_ARGS ; typedef ftdm_status_t (*fio_signal_cb_t) FIO_SIGNAL_CB_ARGS ; typedef ftdm_status_t (*fio_event_cb_t) FIO_EVENT_CB_ARGS ; typedef ftdm_status_t (*fio_configure_span_t) FIO_CONFIGURE_SPAN_ARGS ; @@ -530,6 +532,7 @@ typedef ftdm_status_t (*fio_api_t) FIO_API_ARGS ; #define FIO_SPAN_GET_SIG_STATUS_FUNCTION(name) ftdm_status_t name FIO_SPAN_GET_SIG_STATUS_ARGS #define FIO_SPAN_POLL_EVENT_FUNCTION(name) ftdm_status_t name FIO_SPAN_POLL_EVENT_ARGS #define FIO_SPAN_NEXT_EVENT_FUNCTION(name) ftdm_status_t name FIO_SPAN_NEXT_EVENT_ARGS +#define FIO_CHANNEL_NEXT_EVENT_FUNCTION(name) ftdm_status_t name FIO_CHANNEL_NEXT_EVENT_ARGS #define FIO_SIGNAL_CB_FUNCTION(name) ftdm_status_t name FIO_SIGNAL_CB_ARGS #define FIO_EVENT_CB_FUNCTION(name) ftdm_status_t name FIO_EVENT_CB_ARGS #define FIO_CONFIGURE_SPAN_FUNCTION(name) ftdm_status_t name FIO_CONFIGURE_SPAN_ARGS @@ -568,6 +571,7 @@ struct ftdm_io_interface { fio_write_t write; /*!< Write data to the channel */ fio_span_poll_event_t poll_event; /*!< Poll for events on the whole span */ fio_span_next_event_t next_event; /*!< Retrieve an event from the span */ + fio_channel_next_event_t channel_next_event; /*!< Retrieve an event from channel */ fio_api_t api; /*!< Execute a text command */ }; diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index 06f899c..7d3ee68 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -616,6 +616,23 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_chan(ftdm_channel_t *ftdmchan); FT_DECLARE(ftdm_status_t) ftdm_span_next_event(ftdm_span_t *span, ftdm_event_t **event); /*! + * \brief Retrieves an event from the span + * + * \note + * This function is non-reentrant and not thread-safe. + * The event returned may be modified if the function is called again + * from a different thread or even the same. It is recommended to + * handle events from the same span in a single thread. + * + * \param span The channel to retrieve the event from + * \param event Pointer to store the pointer to the event + * + * \retval FTDM_SUCCESS success (at least one event available) + * \retval FTDM_FAIL failure + */ +FT_DECLARE(ftdm_status_t) ftdm_channel_read_event(ftdm_channel_t *ftdmchan, ftdm_event_t **event); + +/*! * \brief Enqueue a DTMF string into the channel * * \param ftdmchan The channel to enqueue the dtmf string to commit b7c82d4c2efa974e8c867826253732139f9fb385 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Nov 25 15:40:44 2010 -0200 freetdm: moved ftdm_channel_read_event() to freetdm.h diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 9ce213c..eff6305 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -888,6 +888,23 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_add_to_group(const char* name, ftdm_chann /*! \brief Remove the channel from a hunt group */ FT_DECLARE(ftdm_status_t) ftdm_channel_remove_from_group(ftdm_group_t* group, ftdm_channel_t* ftdmchan); +/*! + * \brief Retrieves an event from the span + * + * \note + * This function is non-reentrant and not thread-safe. + * The event returned may be modified if the function is called again + * from a different thread or even the same. It is recommended to + * handle events from the same span in a single thread. + * + * \param span The channel to retrieve the event from + * \param event Pointer to store the pointer to the event + * + * \retval FTDM_SUCCESS success (at least one event available) + * \retval FTDM_FAIL failure + */ +FT_DECLARE(ftdm_status_t) ftdm_channel_read_event(ftdm_channel_t *ftdmchan, ftdm_event_t **event); + /*! \brief Find a hunt group by id */ FT_DECLARE(ftdm_status_t) ftdm_group_find(uint32_t id, ftdm_group_t **group); diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index 7d3ee68..06f899c 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -616,23 +616,6 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_chan(ftdm_channel_t *ftdmchan); FT_DECLARE(ftdm_status_t) ftdm_span_next_event(ftdm_span_t *span, ftdm_event_t **event); /*! - * \brief Retrieves an event from the span - * - * \note - * This function is non-reentrant and not thread-safe. - * The event returned may be modified if the function is called again - * from a different thread or even the same. It is recommended to - * handle events from the same span in a single thread. - * - * \param span The channel to retrieve the event from - * \param event Pointer to store the pointer to the event - * - * \retval FTDM_SUCCESS success (at least one event available) - * \retval FTDM_FAIL failure - */ -FT_DECLARE(ftdm_status_t) ftdm_channel_read_event(ftdm_channel_t *ftdmchan, ftdm_event_t **event); - -/*! * \brief Enqueue a DTMF string into the channel * * \param ftdmchan The channel to enqueue the dtmf string to commit c57c17604c175e9c154d2552c608087a4e98807d Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Nov 25 10:40:20 2010 -0600 Update mod_cepstral for windows vs2010 diff --git a/src/mod/asr_tts/mod_cepstral/WinReadme.txt b/src/mod/asr_tts/mod_cepstral/WinReadme.txt new file mode 100644 index 0000000..56b4e79 --- /dev/null +++ b/src/mod/asr_tts/mod_cepstral/WinReadme.txt @@ -0,0 +1,4 @@ +The Cepstral SDK for Windows should be placed in c:\dev\cepstral +ex. C:\dev\cepstral\sdk\include +This SDK can be obtained from http://cepstral.com/ +If you want a prebuilt version you may download one from http://files.freeswitch.org/windows/installer/ \ No newline at end of file diff --git a/src/mod/asr_tts/mod_cepstral/mod_cepstral.2010.vcxproj b/src/mod/asr_tts/mod_cepstral/mod_cepstral.2010.vcxproj index 2bc46ef..b7e42eb 100644 --- a/src/mod/asr_tts/mod_cepstral/mod_cepstral.2010.vcxproj +++ b/src/mod/asr_tts/mod_cepstral/mod_cepstral.2010.vcxproj @@ -66,13 +66,13 @@ </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> - <AdditionalIncludeDirectories>C:\Program Files\Cepstral\sdk\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>C:\dev\cepstral\sdk\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PrecompiledHeader> </PrecompiledHeader> </ClCompile> <Link> <AdditionalDependencies>swift.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalLibraryDirectories>C:\Program Files\Cepstral\sdk\lib\winnt;C:\Program Files\Cepstral\sdk\lib\windows;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <AdditionalLibraryDirectories>C:\dev\cepstral\sdk\lib\lib-windows;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <RandomizedBaseAddress>false</RandomizedBaseAddress> <DataExecutionPrevention> </DataExecutionPrevention> @@ -83,13 +83,13 @@ <TargetEnvironment>X64</TargetEnvironment> </Midl> <ClCompile> - <AdditionalIncludeDirectories>C:\Program Files\Cepstral\sdk\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>C:\dev\cepstral\sdk\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PrecompiledHeader> </PrecompiledHeader> </ClCompile> <Link> <AdditionalDependencies>swift.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalLibraryDirectories>C:\Program Files\Cepstral\sdk\lib\winnt;C:\Program Files\Cepstral\sdk\lib\windows;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <AdditionalLibraryDirectories>C:\dev\cepstral\sdk\lib\lib-windows_x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <RandomizedBaseAddress>false</RandomizedBaseAddress> <DataExecutionPrevention> </DataExecutionPrevention> @@ -98,13 +98,13 @@ </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ClCompile> - <AdditionalIncludeDirectories>C:\Program Files\Cepstral\sdk\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>C:\dev\cepstral\sdk\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PrecompiledHeader> </PrecompiledHeader> </ClCompile> <Link> <AdditionalDependencies>swift.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalLibraryDirectories>C:\Program Files\Cepstral\sdk\lib\winnt;C:\Program Files\Cepstral\sdk\lib\windows;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <AdditionalLibraryDirectories>C:\dev\cepstral\sdk\lib\lib-windows;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <RandomizedBaseAddress>false</RandomizedBaseAddress> <DataExecutionPrevention> </DataExecutionPrevention> @@ -115,13 +115,13 @@ <TargetEnvironment>X64</TargetEnvironment> </Midl> <ClCompile> - <AdditionalIncludeDirectories>C:\Program Files\Cepstral\sdk\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>C:\dev\cepstral\sdk\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PrecompiledHeader> </PrecompiledHeader> </ClCompile> <Link> <AdditionalDependencies>swift.lib;%(AdditionalDependencies)</AdditionalDependencies> - <AdditionalLibraryDirectories>C:\Program Files\Cepstral\sdk\lib\winnt;C:\Program Files\Cepstral\sdk\lib\windows;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <AdditionalLibraryDirectories>C:\dev\cepstral\sdk\lib\lib-windows_x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <RandomizedBaseAddress>false</RandomizedBaseAddress> <DataExecutionPrevention> </DataExecutionPrevention> @@ -132,9 +132,8 @@ <ClCompile Include="mod_cepstral.c" /> </ItemGroup> <ItemGroup> - <ProjectReference Include="..\..\..\..\w32\Library\FreeSwitchCore.2008.vcxproj"> + <ProjectReference Include="..\..\..\..\w32\Library\FreeSwitchCore.2010.vcxproj"> <Project>{202d7a4e-760d-4d0e-afa1-d7459ced30ff}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> </ProjectReference> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> commit 37ce4003e129097e179f213c86e00b3307cc1738 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Nov 25 14:31:30 2010 -0200 freetdm: eliminated some warnings from ftmod_r2 windows build diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 52c0f86..bfe49fd 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -889,7 +889,7 @@ static openr2_io_interface_t ftdm_r2_io_iface = { static FIO_SIG_CONFIGURE_FUNCTION(ftdm_r2_configure_span) //ftdm_status_t (ftdm_span_t *span, fio_signal_cb_t sig_cb, va_list ap) { - int i = 0; + unsigned int i = 0; int conf_failure = 0; char *var = NULL; char *val = NULL; @@ -1107,11 +1107,6 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_r2_configure_span) openr2_chan_set_log_level(r2chan, r2conf.loglevel); if (r2conf.call_files) { openr2_chan_enable_call_files(r2chan); -#if 0 - if (r2conf.mf_files) { - openr2_chan_enable_mf_files(r2chan); - } -#endif } r2call = ftdm_malloc(sizeof(*r2call)); @@ -1348,8 +1343,8 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) ftdm_span_t *span = (ftdm_span_t *) obj; ftdm_r2_data_t *r2data = span->signal_data; int waitms = 20; - int i, res; - int ms; + unsigned int i; + int res, ms; struct timeval start, end; short *poll_events = ftdm_malloc(sizeof(short)*span->chan_count); ftdm_event_t *event = NULL; @@ -1413,8 +1408,8 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) * XXX */ for (i = 1; i <= span->chan_count; i++) { r2chan = R2CALL(span->channels[i])->r2chan; - r2call = R2CALL(ftdmchan); ftdmchan = openr2_chan_get_client_data(r2chan); + r2call = R2CALL(ftdmchan); ftdm_mutex_lock(ftdmchan->mutex); ftdm_r2_state_advance(ftdmchan); @@ -1487,8 +1482,8 @@ static FIO_API_FUNCTION(ftdm_r2_api) char *mycmd = NULL, *argv[10] = { 0 }; int argc = 0; int span_id = 0; - int chan_id = 0; - int i = 0; + unsigned int chan_id = 0; + unsigned int i = 0; ftdm_r2_data_t *r2data = NULL; openr2_chan_t *r2chan = NULL; openr2_context_t *r2context = NULL; commit 75bd5642105532f80101fc84849b96996d710a04 Author: Moises Silva <moy@sangoma.com> Date: Thu Nov 25 09:35:14 2010 -0500 freetdm: wait for state change to be cleared when placing outgoing calls this fixes a race where the call is hangup even before the state DIALING is processed and therefore the HANGUP state change is ignored. diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 0aeaeed..bcceba5 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2270,6 +2270,8 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_place(const char *file, const char UNREFERENCED_PARAMETER(line); #endif + ftdm_wait_for_flag_cleared(ftdmchan, FTDM_CHANNEL_STATE_CHANGE, 100); + ftdm_channel_unlock(ftdmchan); return status; commit 6a9a27b791a231b970b37eadb1ebf927b0c30bea Author: Jeff Lenk <jeff@jefflenk.com> Date: Wed Nov 24 22:13:12 2010 -0600 VS2010 fix output paths diff --git a/src/mod/codecs/mod_celt/mod_celt.vcxproj b/src/mod/codecs/mod_celt/mod_celt.vcxproj index 01c55d4..ee8a70c 100644 --- a/src/mod/codecs/mod_celt/mod_celt.vcxproj +++ b/src/mod/codecs/mod_celt/mod_celt.vcxproj @@ -62,10 +62,6 @@ <PropertyGroup Label="UserMacros" /> <PropertyGroup> <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> commit 143949941c6a1e4ae68c7ebd86957525caf2242a Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Nov 24 21:39:08 2010 -0600 add presence-probe-on-register sofia param to send a probe on register instead of presence to deal with some broken phones and add some general improvements to allow multi homed presence diff --git a/conf/sip_profiles/internal.xml b/conf/sip_profiles/internal.xml index 93558a3..3e756a8 100644 --- a/conf/sip_profiles/internal.xml +++ b/conf/sip_profiles/internal.xml @@ -132,6 +132,8 @@ <param name="record-template" value="${caller_id_number}.${target_domain}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/> <!--enable to use presence --> <param name="manage-presence" value="true"/> + <!-- send a presence probe on each register to query devices to send presence instead of sending presence with less info --> + <!--<param name="presence-probe-on-register" value="true"/>--> <!--<param name="manage-shared-appearance" value="true"/>--> <!-- used to share presence info across sofia profiles --> <!-- Name of the db to use for this profile --> diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 3c8404d..3bb926a 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3936,7 +3936,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session dest_num = p + 5; } } -#endif + if (profile->pres_type) { char *sql; @@ -3957,6 +3957,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session sofia_glue_actually_execute_sql(profile, sql, profile->ireg_mutex); switch_safe_free(sql); } +#endif caller_profile = switch_caller_profile_clone(nsession, outbound_profile); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index c1244c0..6970a7a 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -224,6 +224,7 @@ typedef enum { PFLAG_IN_DIALOG_CHAT, PFLAG_DEL_SUBS_ON_REG, PFLAG_IGNORE_183NOSDP, + PFLAG_PRESENCE_PROBE_ON_REGISTER, /* No new flags below this line */ PFLAG_MAX } PFLAGS; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 4d9bd7f..e20d868 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2405,6 +2405,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) } else { sofia_clear_pflag(profile, PFLAG_IGNORE_183NOSDP); } + } else if (!strcasecmp(var, "presence-probe-on-register")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_PRESENCE_PROBE_ON_REGISTER); + } else { + sofia_clear_pflag(profile, PFLAG_PRESENCE_PROBE_ON_REGISTER); + } } else if (!strcasecmp(var, "cid-in-1xx")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_CID_IN_1XX); @@ -3070,6 +3076,12 @@ switch_status_t config_sofia(int reload, char *profile_name) } else { sofia_clear_pflag(profile, PFLAG_IGNORE_183NOSDP); } + } else if (!strcasecmp(var, "presence-probe-on-register")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_PRESENCE_PROBE_ON_REGISTER); + } else { + sofia_clear_pflag(profile, PFLAG_PRESENCE_PROBE_ON_REGISTER); + } } else if (!strcasecmp(var, "cid-in-1xx")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_CID_IN_1XX); @@ -4420,7 +4432,6 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status contact_host, astate, "outbound", user_agent, profile->name, mod_sofia_globals.hostname, switch_str_nil(full_contact), switch_str_nil(presence_id), switch_str_nil(presence_data), switch_str_nil(p)); - switch_assert(sql); sofia_glue_actually_execute_sql(profile, sql, profile->ireg_mutex); @@ -6872,8 +6883,9 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ sql = switch_mprintf - ("select call_id from sip_dialogs where call_info='%q' and sip_from_user='%q' and sip_from_host='%q' and call_id is not null", - switch_str_nil(p), user, host); + ("select call_id from sip_dialogs where call_info='%q' and ((sip_from_user='%q' and sip_from_host='%q') or presence_id='%q@%q') " + "and call_id is not null", + switch_str_nil(p), user, host, user, host); if ((str = sofia_glue_execute_sql2str(profile, profile->ireg_mutex, sql, cid, sizeof(cid)))) { bnh = nua_handle_by_call_id(nua, str); diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 4b853de..95ea913 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -567,7 +567,8 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) } if (probe_euser && probe_host && (profile = sofia_glue_find_profile(probe_host))) { - sql = switch_mprintf("select status,rpid from sip_dialogs where sip_from_user='%q' and sip_from_host='%q'", probe_euser, probe_host); + sql = switch_mprintf("select status,rpid from sip_dialogs where ((sip_from_user='%q' and sip_from_host='%q') or presence_id='%q@%q')", + probe_euser, probe_host, probe_euser, probe_host); sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_dialog_callback, &dh); h.profile = profile; @@ -591,9 +592,11 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) "'%q','%q' " "from sip_registrations left join sip_dialogs on " - "(sip_dialogs.sip_from_user = sip_registrations.sip_user " - "and (sip_dialogs.sip_from_host = sip_registrations.orig_server_host or " - "sip_dialogs.sip_from_host = sip_registrations.sip_host) ) " + "sip_dialogs.presence_id = sip_registrations.sip_user || '@' || sip_registrations.sip_host " + + + "or (sip_dialogs.sip_from_user = sip_registrations.sip_user " + "and sip_dialogs.sip_from_host = sip_registrations.sip_host) " "left join sip_presence on " "(sip_registrations.sip_user=sip_presence.sip_user and sip_registrations.orig_server_host=sip_presence.sip_host and " @@ -601,7 +604,8 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) "where sip_dialogs.presence_id='%q@%q' or (sip_registrations.sip_user='%q' and " "(sip_registrations.orig_server_host='%q' or sip_registrations.sip_host='%q' " "or sip_registrations.presence_hosts like '%%%q%%'))", - dh.status, dh.rpid, probe_euser, probe_host, probe_euser, probe_host, probe_host, probe_host); + dh.status, dh.rpid, + probe_euser, probe_host, probe_euser, probe_host, probe_host, probe_host); switch_assert(sql); if (mod_sofia_globals.debug_presence > 0) { @@ -711,9 +715,10 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) sql = switch_mprintf("update sip_dialogs set call_info='%q',call_info_state='%q' where hostname='%q' and uuid='%q'", call_info, call_info_state, mod_sofia_globals.hostname, uuid); } else { - sql = switch_mprintf("update sip_dialogs set call_info='%q', call_info_state='%q' where hostname='%q' and sip_dialogs.sip_from_user='%q' " - "and sip_dialogs.sip_from_host='%q' and call_info='%q'", - call_info, call_info_state, mod_sofia_globals.hostname, euser, host, call_info); + sql = switch_mprintf("update sip_dialogs set call_info='%q', call_info_state='%q' where hostname='%q' and " + "((sip_dialogs.sip_from_user='%q' and sip_dialogs.sip_from_host='%q') or presence_id='%q@%q') and call_info='%q'", + + call_info, call_info_state, mod_sofia_globals.hostname, euser, host, euser, host, call_info); } @@ -737,7 +742,8 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); } - sql = switch_mprintf("select status,rpid from sip_dialogs where sip_from_user='%q' and sip_from_host='%q'", euser, host); + sql = switch_mprintf("select status,rpid from sip_dialogs where ((sip_from_user='%q' and sip_from_host='%q') or presence_id='%q@%q')", + euser, host, euser, host); sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_dialog_callback, &dh); switch_safe_free(sql); @@ -753,17 +759,20 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) "(sip_subscriptions.sub_to_user=sip_presence.sip_user and sip_subscriptions.sub_to_host=sip_presence.sip_host and " "sip_subscriptions.profile_name=sip_presence.profile_name) " "left join sip_dialogs on " + + "sip_dialogs.presence_id = sip_subscriptions.sub_to_user || '@' || sip_subscriptions.sub_to_host or " + "(sip_dialogs.sip_from_user = sip_subscriptions.sub_to_user " "and sip_dialogs.sip_from_host = sip_subscriptions.sub_to_host) " "where sip_subscriptions.expires > -1 and " - "(event='%q' or event='%q') and (sub_to_user='%q' or sip_dialogs.presence_id like '%q@%%') " + "(event='%q' or event='%q') and sub_to_user='%q' " "and (sub_to_host='%q' or presence_hosts like '%%%q%%') " "and (sip_subscriptions.profile_name = '%q' or sip_subscriptions.presence_hosts != sip_subscriptions.sub_to_host)", switch_str_nil(status), switch_str_nil(rpid), host, dh.status,dh.rpid, - event_type, alt_event_type, euser, euser, host, host, profile->name))) { + event_type, alt_event_type, euser, host, host, profile->name))) { struct presence_helper helper = { 0 }; @@ -1918,7 +1927,8 @@ static void sync_sla(sofia_profile_t *profile, const char *to_user, const char * switch_core_hash_init(&sh->hash, sh->pool); sql = switch_mprintf("select sip_from_user,sip_from_host,call_info,call_info_state,uuid from sip_dialogs " - "where hostname='%q' " "and sip_from_user='%q' and sip_from_host='%q' ", mod_sofia_globals.hostname, to_user, to_host); + "where hostname='%q' " "and ((sip_from_user='%q' and sip_from_host='%q) or presence_id='%q@%q')' ", + mod_sofia_globals.hostname, to_user, to_host, to_user, to_host); if (mod_sofia_globals.debug_sla > 1) { @@ -1954,7 +1964,8 @@ static void sync_sla(sofia_profile_t *profile, const char *to_user, const char * if (clear) { - sql = switch_mprintf("delete from sip_dialogs where sip_from_user='%q' and sip_from_host='%q' and call_info_state='seized'", to_user, to_host); + sql = switch_mprintf("delete from sip_dialogs where ((sip_from_user='%q' and sip_from_host='%q') or presence_id='%q@%q') " + "and call_info_state='seized'", to_user, to_host, to_user, to_host); if (mod_sofia_globals.debug_sla > 1) { @@ -2326,8 +2337,9 @@ void sofia_presence_handle_sip_i_subscribe(int status, switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "CANCEL LINE SEIZE\n"); } - sql = switch_mprintf("delete from sip_dialogs where sip_from_user='%q' and sip_from_host='%q' and call_info_state='seized'", - to_user, to_host); + sql = switch_mprintf("delete from sip_dialogs where ((sip_from_user='%q' and sip_from_host='%q') or presence_id='%q@%q') " + "and call_info_state='seized'", + to_user, to_host, to_user, to_host); if (mod_sofia_globals.debug_sla > 1) { @@ -2360,8 +2372,9 @@ void sofia_presence_handle_sip_i_subscribe(int status, - sql = switch_mprintf("delete from sip_dialogs where sip_from_user='%q' and sip_from_host='%q' and call_info_state='seized'", - to_user, to_host); + sql = switch_mprintf("delete from sip_dialogs where ((sip_from_user='%q' and sip_from_host='%q') or presence_id='%q@%q') " + "and call_info_state='seized'", + to_user, to_host, to_user, to_host); if (mod_sofia_globals.debug_sla > 1) { diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 216f808..e93bdaa 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1445,27 +1445,27 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand } } - -#if 0 - if (switch_event_create(&s_event, SWITCH_EVENT_PRESENCE_PROBE) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); - switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "login", profile->name); - switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, sub_host); - switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "to", "%s@%s", to_user, sub_host); - switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "event_type", "presence"); - switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog"); - switch_event_fire(&s_event); + if (sofia_test_pflag(profile, PFLAG_PRESENCE_PROBE_ON_REGISTER)) { + if (switch_event_create(&s_event, SWITCH_EVENT_PRESENCE_PROBE) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "login", profile->name); + switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, sub_host); + switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "to", "%s@%s", to_user, sub_host); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "event_type", "presence"); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog"); + switch_event_fire(&s_event); + } + } else { + if (switch_event_create(&s_event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "login", profile->name); + switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, sub_host); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "rpid", "unknown"); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "status", "Registered"); + switch_event_fire(&s_event); + } } -#else - if (switch_event_create(&s_event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); - switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "login", profile->name); - switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, sub_host); - switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "rpid", "unknown"); - switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "status", "Registered"); - switch_event_fire(&s_event); - } -#endif + } else { if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_UNREGISTER) == SWITCH_STATUS_SUCCESS) { switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "profile-name", profile->name); commit f987903e5ee275ff4afd27245f322e4b8d9eb8f3 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Nov 24 21:36:21 2010 -0600 fix single domain assumption in default config to be more portable *cough* bkw *cough* diff --git a/conf/dialplan/default.xml b/conf/dialplan/default.xml index 42a3bcc..a19f683 100644 --- a/conf/dialplan/default.xml +++ b/conf/dialplan/default.xml @@ -265,7 +265,7 @@ <action application="set" data="called_party_callgroup=${user_data(${dialed_extension}@${domain_name} var callgroup)}"/> <!--<action application="export" data="nolocal:sip_secure_media=${user_data(${dialed_extension}@${domain_name} var sip_secure_media)}"/>--> <action application="hash" data="insert/${domain_name}-last_dial/${called_party_callgroup}/${uuid}"/> - <action application="bridge" data="{sip_invite_domain=$${domain}}user/${dialed_extension}@${domain_name}"/> + <action application="bridge" data="user/${dialed_extension}@${domain_name}"/> <action application="answer"/> <action application="sleep" data="1000"/> <action application="bridge" data="loopback/app=voicemail:default ${domain_name} ${dialed_extension}"/> diff --git a/conf/directory/default.xml b/conf/directory/default.xml index 1e58303..8af7aea 100644 --- a/conf/directory/default.xml +++ b/conf/directory/default.xml @@ -21,7 +21,7 @@ <!--the domain or ip (the right hand side of the @ in the addr--> <domain name="$${domain}"> <params> - <param name="dial-string" value="{presence_id=${dialed_user}@${dialed_domain}}${sofia_contact(${dialed_user}@${dialed_domain})}"/> + <param name="dial-string" value="{sip_invite_domain=${dialed_domain},presence_id=${dialed_user}@${dialed_domain}}${sofia_contact(${dialed_user}@${dialed_domain})}"/> </params> <variables> commit 8b0e7d2496e53fd78aae4764c222e2dddfc4bc2a Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Nov 24 21:25:58 2010 -0600 FS-2880 diff --git a/src/switch_odbc.c b/src/switch_odbc.c index 36c3c99..a1c476e 100644 --- a/src/switch_odbc.c +++ b/src/switch_odbc.c @@ -364,7 +364,6 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec_string(switch_odbc_ goto done; } - result = SQLExecute(stmt); result = SQLFetch(stmt); if (result != SQL_SUCCESS && result != SQL_SUCCESS_WITH_INFO && result != SQL_NO_DATA) { commit 9fbecc60bee1601cf7a53775ecaa7e97229cca43 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Nov 25 00:36:01 2010 -0200 freetdm: on ftmod_r2, fixed flags for correctly polling the span, now freeing poll_events pointer, enabling/disabling channel reading flag when needed. also removed the test for FTDM_CHANNEL_OPEN flag on ftdm_channel_wait(). diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 0065d77..23ed68c 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2869,11 +2869,6 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_wait(ftdm_channel_t *ftdmchan, ftdm_wait_ assert(ftdmchan != NULL); assert(ftdmchan->fio != NULL); - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "channel not open"); - return FTDM_FAIL; - } - if (!ftdmchan->fio->wait) { snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "method not implemented"); return FTDM_FAIL; diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 8a4a826..52c0f86 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -781,7 +781,7 @@ static int ftdm_r2_io_wait(openr2_chan_t *r2chan, int *flags, int block) int32_t timeout; ftdm_wait_flag_t ftdmflags = 0; - ftdm_channel_t *ftdm_chan = openr2_chan_get_fd(r2chan); + ftdm_channel_t *fchan = openr2_chan_get_fd(r2chan); timeout = block ? -1 : 0; if (*flags & OR2_IO_READ) { @@ -794,9 +794,10 @@ static int ftdm_r2_io_wait(openr2_chan_t *r2chan, int *flags, int block) ftdmflags |= FTDM_EVENTS; } - status = ftdm_channel_wait(ftdm_chan, &ftdmflags, timeout); + status = ftdm_channel_wait(fchan, &ftdmflags, timeout); if (FTDM_SUCCESS != status && FTDM_TIMEOUT != status) { + ftdm_log_chan_msg(fchan, FTDM_LOG_ERROR, "Failed to wait for events on channel\n"); return -1; } @@ -869,7 +870,6 @@ static int ftdm_r2_io_get_oob_event(openr2_chan_t *r2chan, openr2_oob_event_t *e } break; } - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "returning event: %s\n", ftdm_signal_event2str(*event)); return 0; } @@ -1212,6 +1212,7 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_INTERVAL, &interval); ftdm_assert(interval != 0, "Invalid interval!"); ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Starting processing of incoming call with interval %d\n", interval); + openr2_chan_enable_read(r2chan); } break; @@ -1223,6 +1224,7 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) ftdm_assert(interval != 0, "Invalid interval!"); ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Starting processing of outgoing call in channel with interval %d\n", interval); + openr2_chan_enable_read(r2chan); } break; @@ -1289,7 +1291,6 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) { openr2_call_disconnect_cause_t disconnect_cause = ftdm_r2_ftdm_cause_to_openr2_cause(ftdmchan); ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Clearing call, cause = %s\n", openr2_proto_get_disconnect_string(disconnect_cause)); - openr2_chan_enable_read(r2chan); if (!R2CALL(ftdmchan)->disconnect_rcvd) { /* this will disconnect the call, but need to wait for the call end before moving to DOWN */ openr2_chan_disconnect_call(r2chan, disconnect_cause); @@ -1304,7 +1305,6 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) case FTDM_CHANNEL_STATE_CANCEL: { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Unable to receive call\n"); - openr2_chan_enable_read(r2chan); openr2_chan_disconnect_call(r2chan, OR2_CAUSE_OUT_OF_ORDER); } break; @@ -1316,6 +1316,7 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) if (R2CALL(ftdmchan)->txdrops) { ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "dropped %d tx packets\n", R2CALL(ftdmchan)->txdrops); } + openr2_chan_disable_read(r2chan); ret = 1; } break; @@ -1385,7 +1386,10 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) for (i = 0; i < span->chan_count; i++) { r2chan = R2CALL(span->channels[(i+1)])->r2chan; ftdmchan = openr2_chan_get_client_data(r2chan); - poll_events[i] = ftdmchan->state == FTDM_CHANNEL_STATE_DOWN ? POLLPRI : (POLLPRI | POLLIN | POLLOUT); + poll_events[i] = POLLPRI; + if (openr2_chan_get_read_enabled(r2chan)) { + poll_events[i] |= POLLIN; + } } status = ftdm_span_poll_event(span, waitms, poll_events); @@ -1426,6 +1430,8 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) openr2_chan_set_blocked(r2chan); } + ftdm_safe_free(poll_events); + ftdm_clear_flag(r2data, FTDM_R2_RUNNING); ftdm_log(FTDM_LOG_DEBUG, "R2 thread ending.\n"); diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index 1a43c4d..c55d42e 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -1131,10 +1131,8 @@ FIO_CHANNEL_NEXT_EVENT_FUNCTION(wanpipe_channel_next_event) memset(&tdm_api, 0, sizeof(tdm_api)); status = sangoma_tdm_read_event(ftdmchan->sockfd, &tdm_api); if (status != FTDM_SUCCESS) { -#if 0 snprintf(span->last_error, sizeof(span->last_error), "%s", strerror(errno)); ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to read event from channel: %s\n", strerror(errno)); -#endif return FTDM_FAIL; } commit 5eb172d9f3b3e718ac6e2ac3a61cf2412b82be61 Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Nov 24 20:04:43 2010 -0500 freetdm: ISDN Changes to better match SIP-to-TDM states diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 8d96112..27dc8d8 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -425,8 +425,11 @@ static switch_status_t channel_on_routing(switch_core_session_t *session) tech_pvt = switch_core_session_get_private(session); assert(tech_pvt != NULL); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL ROUTING\n", switch_channel_get_name(channel)); + assert(tech_pvt->ftdmchan != NULL); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL ROUTING\n", switch_channel_get_name(channel)); + + ftdm_channel_call_indicate(tech_pvt->ftdmchan, FTDM_CHANNEL_INDICATE_PROCEED); return SWITCH_STATUS_SUCCESS; } @@ -852,7 +855,7 @@ static switch_status_t channel_receive_message_b(switch_core_session_t *session, switch (msg->message_id) { case SWITCH_MESSAGE_INDICATE_RINGING: { - ftdm_channel_call_indicate(tech_pvt->ftdmchan, FTDM_CHANNEL_INDICATE_PROGRESS); + ftdm_channel_call_indicate(tech_pvt->ftdmchan, FTDM_CHANNEL_INDICATE_RINGING); } break; case SWITCH_MESSAGE_INDICATE_PROGRESS: @@ -935,7 +938,7 @@ static switch_status_t channel_receive_message_fxs(switch_core_session_t *sessio !switch_channel_test_flag(channel, CF_EARLY_MEDIA) && !switch_channel_test_flag(channel, CF_RING_READY) ) { - ftdm_channel_call_indicate(tech_pvt->ftdmchan, FTDM_CHANNEL_INDICATE_RING); + ftdm_channel_call_indicate(tech_pvt->ftdmchan, FTDM_CHANNEL_INDICATE_RINGING); switch_channel_mark_ring_ready(channel); } break; @@ -2133,7 +2136,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_clear_channel_signal) spanid, chanid, (uuid) ? uuid : "N/A"); } } - break; + break; case FTDM_SIGEVENT_SIGSTATUS_CHANGED: { ftdm_signaling_status_t sigstatus = sigmsg->raw_data ? *((ftdm_signaling_status_t*)(sigmsg->raw_data)) : sigmsg->sigstatus; @@ -2141,6 +2144,10 @@ static FIO_SIGNAL_CB_FUNCTION(on_clear_channel_signal) spanid, chanid, ftdm_signaling_status2str(sigstatus)); } break; + case FTDM_SIGEVENT_PROCEED: + case FTDM_SIGEVENT_MSG: + /* FS does not have handlers for these messages, so ignore them for now */ + break; default: { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unhandled msg type %d for channel %d:%d\n", diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 31a585e..a600727 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2033,7 +2033,6 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_answer(const char *file, const char goto done; } - if (ftdmchan->state < FTDM_CHANNEL_STATE_PROGRESS) { ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS, 1); } @@ -2202,14 +2201,19 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_indicate(const char *file, const ch switch (indication) { /* FIXME: ring and busy cannot be used with all signaling stacks * (particularly isdn stacks I think, we should emulate or just move to hangup with busy cause) */ - case FTDM_CHANNEL_INDICATE_RING: - ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_RING, 1); + case FTDM_CHANNEL_INDICATE_RINGING: + ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_RINGING, 1); break; - case FTDM_CHANNEL_INDICATE_BUSY: ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_BUSY, 1); break; - + case FTDM_CHANNEL_INDICATE_PROCEED: + if (ftdm_test_flag(ftdmchan->span, FTDM_SPAN_USE_PROCEED_STATE)) { + if (ftdmchan->state == FTDM_CHANNEL_STATE_RING) { + ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROCEED, 1); + } + } + break; case FTDM_CHANNEL_INDICATE_PROGRESS: if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { ftdm_set_flag(ftdmchan, FTDM_CHANNEL_PROGRESS); @@ -2217,7 +2221,6 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_indicate(const char *file, const ch ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS, 1); } break; - case FTDM_CHANNEL_INDICATE_PROGRESS_MEDIA: if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { ftdm_set_flag(ftdmchan, FTDM_CHANNEL_PROGRESS); @@ -2236,7 +2239,6 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_indicate(const char *file, const ch ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, 1); } break; - default: ftdm_log(file, func, line, FTDM_LOG_LEVEL_WARNING, "Do not know how to indicate %d\n", indication); status = FTDM_FAIL; diff --git a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c index fc9bea6..99d2566 100644 --- a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c +++ b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c @@ -438,7 +438,7 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) { if (state_counter > 5000 || !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_CALLERID_DETECT)) { ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_CALLERID_DETECT, NULL); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE); + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RING); } } break; @@ -492,8 +492,8 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) } if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK) && - (ftdmchan->last_state == FTDM_CHANNEL_STATE_RING || ftdmchan->last_state == FTDM_CHANNEL_STATE_DIALTONE - || ftdmchan->last_state >= FTDM_CHANNEL_STATE_IDLE)) { + (ftdmchan->last_state == FTDM_CHANNEL_STATE_RINGING || ftdmchan->last_state == FTDM_CHANNEL_STATE_DIALTONE + || ftdmchan->last_state >= FTDM_CHANNEL_STATE_RING)) { ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY); } else { ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_CLEARING; @@ -535,7 +535,7 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) } } case FTDM_CHANNEL_STATE_UP: - case FTDM_CHANNEL_STATE_IDLE: + case FTDM_CHANNEL_STATE_RING: { ftdm_sleep(interval); continue; @@ -599,7 +599,7 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) ftdm_channel_use(ftdmchan); } break; - case FTDM_CHANNEL_STATE_IDLE: + case FTDM_CHANNEL_STATE_RING: { ftdm_channel_use(ftdmchan); sig.event_id = FTDM_SIGEVENT_START; @@ -669,7 +669,7 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) continue; } break; - case FTDM_CHANNEL_STATE_RING: + case FTDM_CHANNEL_STATE_RINGING: { ftdm_buffer_zero(dt_buffer); teletone_run(&ts, ftdmchan->span->tone_map[FTDM_TONEMAP_RING]); @@ -732,7 +732,7 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) if (last_digit && (!collecting || ((elapsed - last_digit > analog_data->digit_timeout) || strlen(dtmf) >= analog_data->max_dialstr))) { ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Number obtained [%s]\n", dtmf); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE); + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RING); last_digit = 0; collecting = 0; } @@ -890,7 +890,7 @@ static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *e if (ftdm_test_flag(analog_data, FTDM_ANALOG_CALLERID)) { ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_GET_CALLERID); } else { - ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_IDLE); + ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_RING); } event->channel->ring_count = 1; ftdm_mutex_unlock(event->channel->mutex); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 77ad917..6f5f838 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -115,7 +115,19 @@ ftdm_state_map_t sangoma_isdn_state_map = { ZSD_INBOUND, ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_RING, FTDM_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS, FTDM_END} + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROCEED, FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_PROGRESS, FTDM_END} + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_PROCEED, FTDM_END}, + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA,FTDM_END} + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_RINGING, FTDM_END}, + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_END}, }, { ZSD_INBOUND, @@ -189,12 +201,20 @@ ftdm_state_map_t sangoma_isdn_state_map = { ZSD_OUTBOUND, ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_DIALING, FTDM_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS, - FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_DOWN, FTDM_END} + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, + FTDM_CHANNEL_STATE_PROCEED, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, + FTDM_CHANNEL_STATE_DOWN, FTDM_END} }, { ZSD_OUTBOUND, ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_PROCEED, FTDM_END}, + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, + FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_END}, + }, + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_PROGRESS, FTDM_END}, {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_END}, }, @@ -604,13 +624,15 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) break; case FTDM_CHANNEL_STATE_GET_CALLERID: { - sngisdn_set_flag(sngisdn_info, FLAG_SENT_PROCEED); - sngisdn_snd_proceed(ftdmchan); + if (!sngisdn_test_flag(sngisdn_info, FLAG_SENT_PROCEED)) { + sngisdn_set_flag(sngisdn_info, FLAG_SENT_PROCEED); + sngisdn_snd_proceed(ftdmchan); + } /* Wait in this state until we get FACILITY msg */ } break; case FTDM_CHANNEL_STATE_RING: /* incoming call request */ - { + { ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending incoming call from %s to %s to FTDM core\n", ftdmchan->caller_data.ani.digits, ftdmchan->caller_data.dnis.digits); /* we have enough information to inform FTDM of the call*/ @@ -635,6 +657,25 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) } } break; + case FTDM_CHANNEL_STATE_PROCEED: + { + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + /*OUTBOUND...so we were told by the line of this so noifiy the user*/ + sigev.event_id = FTDM_SIGEVENT_PROCEED; + ftdm_span_send_signal(ftdmchan->span, &sigev); + } else { + if (!sngisdn_test_flag(sngisdn_info, FLAG_SENT_PROCEED)) { + sngisdn_set_flag(sngisdn_info, FLAG_SENT_PROCEED); + sngisdn_snd_proceed(ftdmchan); + } + } + } + break; + case FTDM_CHANNEL_STATE_RINGING: + { + sngisdn_snd_alert(ftdmchan, SNGISDN_PROGIND_NETE_ISDN); + } + break; case FTDM_CHANNEL_STATE_PROGRESS: { /*check if the channel is inbound or outbound*/ @@ -642,9 +683,12 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) /*OUTBOUND...so we were told by the line of this so noifiy the user*/ sigev.event_id = FTDM_SIGEVENT_PROGRESS; ftdm_span_send_signal(ftdmchan->span, &sigev); - } else if (!sngisdn_test_flag(sngisdn_info, FLAG_SENT_PROCEED)) { - sngisdn_set_flag(sngisdn_info, FLAG_SENT_PROCEED); - sngisdn_snd_proceed(ftdmchan); + } else { + /* If we already sent a PROCEED before, do not send a PROGRESS as there is nothing to indicate to the remote switch */ + if (ftdmchan->last_state != FTDM_CHANNEL_STATE_PROCEED) { + /* Send a progress message, indicating: Call is not end-to-end ISDN, further call progress may be available */ + sngisdn_snd_progress(ftdmchan, SNGISDN_PROGIND_NETE_ISDN); + } } } break; @@ -654,7 +698,8 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) sigev.event_id = FTDM_SIGEVENT_PROGRESS_MEDIA; ftdm_span_send_signal(ftdmchan->span, &sigev); } else { - sngisdn_snd_progress(ftdmchan); + /* Send a progress message, indicating: In-band information/pattern available */ + sngisdn_snd_progress(ftdmchan, SNGISDN_PROGIND_IB_AVAIL); } } break; @@ -992,6 +1037,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_isdn_span_config) span->state_map = &sangoma_isdn_state_map; ftdm_set_flag(span, FTDM_SPAN_USE_CHAN_QUEUE); ftdm_set_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE); + ftdm_set_flag(span, FTDM_SPAN_USE_PROCEED_STATE); if (span->trunk_type == FTDM_TRUNK_BRI_PTMP || span->trunk_type == FTDM_TRUNK_BRI) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 81a98cf..25ffef8 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -75,7 +75,8 @@ typedef enum { FLAG_DELAYED_REL = (1 << 7), FLAG_SENT_PROCEED = (1 << 8), FLAG_SEND_DISC = (1 << 9), - FLAG_ACTIVATING = (1 << 10), /* Used for BRI only, flag is set after we request line CONNECTED */ + /* Used for BRI only, flag is set after we request line CONNECTED */ + FLAG_ACTIVATING = (1 << 10), } sngisdn_flag_t; @@ -135,6 +136,21 @@ typedef enum { SNGISDN_EVENT_RST_IND, } ftdm_sngisdn_event_id_t; +typedef enum { + /* Call is not end-to-end ISDN */ + SNGISDN_PROGIND_NETE_ISDN = 1, + /* Destination address is non-ISDN */ + SNGISDN_PROGIND_DEST_NISDN, + /* Origination address is non-ISDN */ + SNGISDN_PROGIND_ORIG_NISDN, + /* Call has returned to the ISDN */ + SNGISDN_PROGIND_RET_ISDN, + /* Interworking as occured and has resulted in a telecommunication service change */ + SNGISDN_PROGIND_SERV_CHANGE, + /* In-band information or an appropriate pattern is now available */ + SNGISDN_PROGIND_IB_AVAIL, +} ftdm_sngisdn_progind_t; + /* Only timers that can be cancelled are listed here */ #define SNGISDN_NUM_TIMERS 1 /* Increase NUM_TIMERS as number of ftdm_sngisdn_timer_t increases */ @@ -181,6 +197,7 @@ typedef struct sngisdn_span_data { uint8_t trace_flags; /* TODO: change to flags, so we can use ftdm_test_flag etc.. */ uint8_t overlap_dial; uint8_t setup_arb; + uint8_t facility_ie_decode; uint8_t facility; int8_t facility_timeout; uint8_t num_local_numbers; @@ -288,13 +305,14 @@ void stack_pst_init(Pst *pst); void sngisdn_snd_setup(ftdm_channel_t *ftdmchan); void sngisdn_snd_setup_ack(ftdm_channel_t *ftdmchan); void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan); -void sngisdn_snd_progress(ftdm_channel_t *ftdmchan); -void sngisdn_snd_alert(ftdm_channel_t *ftdmchan); +void sngisdn_snd_progress(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind); +void sngisdn_snd_alert(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind); void sngisdn_snd_connect(ftdm_channel_t *ftdmchan); void sngisdn_snd_disconnect(ftdm_channel_t *ftdmchan); void sngisdn_snd_release(ftdm_channel_t *ftdmchan, uint8_t glare); void sngisdn_snd_reset(ftdm_channel_t *ftdmchan); void sngisdn_snd_con_complete(ftdm_channel_t *ftdmchan); +void sngisdn_snd_fac_req(ftdm_channel_t *ftdmchan); void sngisdn_snd_info_req(ftdm_channel_t *ftdmchan); void sngisdn_snd_status_enq(ftdm_channel_t *ftdmchan); void sngisdn_snd_data(ftdm_channel_t *dchan, uint8_t *data, ftdm_size_t len); @@ -362,6 +380,8 @@ ftdm_status_t cpy_calling_num_from_stack(ftdm_caller_data_t *ftdm, CgPtyNmb *cgP ftdm_status_t cpy_called_num_from_stack(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb); ftdm_status_t cpy_redir_num_from_stack(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb); ftdm_status_t cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *display); +ftdm_status_t cpy_facility_ie_from_stack(ftdm_caller_data_t *ftdm, uint8_t *data, uint32_t data_len); + ftdm_status_t cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm); ftdm_status_t cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm); ftdm_status_t cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c index 3b264ae..657aa5e 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c @@ -190,6 +190,7 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ signal_data->min_digits = 8; signal_data->overlap_dial = SNGISDN_OPT_DEFAULT; signal_data->setup_arb = SNGISDN_OPT_DEFAULT; + signal_data->facility_ie_decode = SNGISDN_OPT_TRUE; signal_data->timer_t3 = 8; signal_data->link_id = span->span_id; @@ -289,6 +290,14 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ if (signal_data->facility_timeout < 0) { signal_data->facility_timeout = 0; } + } else if (!strcasecmp(var, "facility-ie-decode")) { + if (!strcasecmp(val, "yes")) { + signal_data->facility_ie_decode = SNGISDN_OPT_TRUE; + } else if (!strcasecmp(val, "no")) { + signal_data->facility_ie_decode = SNGISDN_OPT_FALSE; + } else { + ftdm_log(FTDM_LOG_ERROR, "Invalid value for parameter:%s:%s\n", var, val); + } } else { ftdm_log(FTDM_LOG_WARNING, "Ignoring unknown parameter %s\n", ftdm_parameters[paramindex].var); } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 3fe0422..209284a 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -144,31 +144,35 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) snprintf(ftdmchan->caller_data.aniII, 5, "%.2d", conEvnt->ni2OctStr.str.val[3]); } } - - if (signal_data->facility == SNGISDN_OPT_TRUE && conEvnt->facilityStr.eh.pres) { - /* Verify whether the Caller Name will come in a subsequent FACILITY message */ - uint16_t ret_val; - char retrieved_str[255]; - - ret_val = sng_isdn_retrieve_facility_caller_name(conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len, retrieved_str); - /* - return values for "sng_isdn_retrieve_facility_information_following": - If there will be no information following, or fails to decode IE, returns -1 - If there will be no information following, but current FACILITY IE contains a caller name, returns 0 - If there will be information following, returns 1 - */ - - if (ret_val == 1) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Expecting Caller name in FACILITY\n"); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_GET_CALLERID); - /* Launch timer in case we never get a FACILITY msg */ - if (signal_data->facility_timeout) { - ftdm_sched_timer(signal_data->sched, "facility_timeout", signal_data->facility_timeout, - sngisdn_facility_timeout, (void*) sngisdn_info, &sngisdn_info->timers[SNGISDN_TIMER_FACILITY]); + + if (conEvnt->facilityStr.eh.pres) { + if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { + cpy_facility_ie_from_stack(&ftdmchan->caller_data, conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len); + } else if (signal_data->facility == SNGISDN_OPT_TRUE) { + /* Verify whether the Caller Name will come in a subsequent FACILITY message */ + uint16_t ret_val; + char retrieved_str[255]; + + ret_val = sng_isdn_retrieve_facility_caller_name(conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len, retrieved_str); + /* + return values for "sng_isdn_retrieve_facility_information_following": + If there will be no information following, or fails to decode IE, returns -1 + If there will be no information following, but current FACILITY IE contains a caller name, returns 0 + If there will be information following, returns 1 + */ + + if (ret_val == 1) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Expecting Caller name in FACILITY\n"); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_GET_CALLERID); + /* Launch timer in case we never get a FACILITY msg */ + if (signal_data->facility_timeout) { + ftdm_sched_timer(signal_data->sched, "facility_timeout", signal_data->facility_timeout, + sngisdn_facility_timeout, (void*) sngisdn_info, &sngisdn_info->timers[SNGISDN_TIMER_FACILITY]); + } + break; + } else if (ret_val == 0) { + strcpy(ftdmchan->caller_data.cid_name, retrieved_str); } - break; - } else if (ret_val == 0) { - strcpy(ftdmchan->caller_data.cid_name, retrieved_str); } } } @@ -269,6 +273,7 @@ void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event) if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { switch(ftdmchan->state) { + case FTDM_CHANNEL_STATE_PROCEED: case FTDM_CHANNEL_STATE_PROGRESS: case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: case FTDM_CHANNEL_STATE_DIALING: @@ -367,8 +372,10 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) case MI_CALLPROC: switch(ftdmchan->state) { - case FTDM_CHANNEL_STATE_DIALING: - if (evntType == MI_PROGRESS || + case FTDM_CHANNEL_STATE_DIALING: + if (evntType == MI_CALLPROC) { + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROCEED); + } else if (evntType == MI_PROGRESS || (cnStEvnt->progInd.eh.pres && cnStEvnt->progInd.progDesc.val == IN_PD_IBAVAIL)) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); } else { @@ -417,6 +424,7 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) } break; case FTDM_CHANNEL_STATE_RING: + case FTDM_CHANNEL_STATE_PROCEED: case FTDM_CHANNEL_STATE_PROGRESS: case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: case FTDM_CHANNEL_STATE_UP: @@ -446,6 +454,7 @@ void sngisdn_process_disc_ind (sngisdn_event_data_t *sngisdn_event) uint32_t spInstId = sngisdn_event->spInstId; sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; DiscEvnt *discEvnt = &sngisdn_event->event.discEvnt; @@ -454,12 +463,20 @@ void sngisdn_process_disc_ind (sngisdn_event_data_t *sngisdn_event) ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing DISCONNECT (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n"); - switch (ftdmchan->state) { + switch (ftdmchan->state) { case FTDM_CHANNEL_STATE_RING: case FTDM_CHANNEL_STATE_DIALING: + case FTDM_CHANNEL_STATE_PROCEED: case FTDM_CHANNEL_STATE_PROGRESS: case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - case FTDM_CHANNEL_STATE_UP: + case FTDM_CHANNEL_STATE_UP: + if (discEvnt->facilityStr.eh.pres) { + if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { + cpy_facility_ie_from_stack(&ftdmchan->caller_data, discEvnt->facilityStr.facilityStr.val, discEvnt->facilityStr.facilityStr.len); + } else { + /* Call libsng_isdn facility decode function and copy variables here */ + } + } if (discEvnt->causeDgn[0].eh.pres && discEvnt->causeDgn[0].causeVal.pres) { ftdmchan->caller_data.hangup_cause = discEvnt->causeDgn[0].causeVal.val; } else { @@ -503,6 +520,7 @@ void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event) uint32_t spInstId = sngisdn_event->spInstId; sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; RelEvnt *relEvnt = &sngisdn_event->event.relEvnt; @@ -538,6 +556,7 @@ void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event) sngisdn_set_avail_rate(ftdmchan->span, SNGISDN_AVAIL_DOWN); } /* fall-through */ + case FTDM_CHANNEL_STATE_PROCEED: case FTDM_CHANNEL_STATE_PROGRESS: case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: case FTDM_CHANNEL_STATE_UP: @@ -547,6 +566,15 @@ void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event) not changed while we were waiting for ftdmchan->mutex by comparing suInstId's */ if (((sngisdn_chan_data_t*)ftdmchan->call_data)->suInstId == suInstId || ((sngisdn_chan_data_t*)ftdmchan->call_data)->spInstId == spInstId) { + + if (relEvnt->facilityStr.eh.pres) { + if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { + cpy_facility_ie_from_stack(&ftdmchan->caller_data, relEvnt->facilityStr.facilityStr.val, relEvnt->facilityStr.facilityStr.len); + } else { + /* Call libsng_isdn facility decode function and copy variables here */ + } + } + if (relEvnt->causeDgn[0].eh.pres && relEvnt->causeDgn[0].causeVal.pres) { ftdmchan->caller_data.hangup_cause = relEvnt->causeDgn[0].causeVal.val; ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "cause:%d\n", ftdmchan->caller_data.hangup_cause); @@ -725,15 +753,16 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event) switch (ftdmchan->state) { case FTDM_CHANNEL_STATE_GET_CALLERID: /* Update the caller ID Name */ + if (facEvnt->facElmt.facStr.pres) { char retrieved_str[255]; - + /* return values for "sng_isdn_retrieve_facility_information_following": If there will be no information following, or fails to decode IE, returns -1 If there will be no information following, but current FACILITY IE contains a caller name, returns 0 If there will be information following, returns 1 */ - + if (sng_isdn_retrieve_facility_caller_name(&facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len, retrieved_str) == 0) { strcpy(ftdmchan->caller_data.cid_name, retrieved_str); } else { @@ -751,6 +780,25 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event) /* We received the caller ID Name in FACILITY, but its too late, facility-timeout already occurred */ ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "FACILITY received, but we already proceeded with call\n"); break; + case FTDM_CHANNEL_STATE_UP: + { + ftdm_sigmsg_t sigev; + if (facEvnt->facElmt.facStr.pres) { + if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { + cpy_facility_ie_from_stack(&ftdmchan->caller_data, &facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len); + } else { + /* Call libsng_isdn facility decode function and copy variables here */ + } + } + memset(&sigev, 0, sizeof(sigev)); + sigev.chan_id = ftdmchan->chan_id; + sigev.span_id = ftdmchan->span_id; + sigev.channel = ftdmchan; + + sigev.event_id = FTDM_SIGEVENT_MSG; + ftdm_span_send_signal(ftdmchan->span, &sigev); + } + break; default: /* We do not support other FACILITY types for now, so do nothing */ break; @@ -865,6 +913,7 @@ void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event) ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "T302 Timer expired, proceeding with call\n"); ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); break; + case FTDM_CHANNEL_STATE_PROCEED: case FTDM_CHANNEL_STATE_PROGRESS: case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Remote switch expecting OVERLAP receive, but we are already PROCEEDING\n"); @@ -882,6 +931,7 @@ void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event) break; case 3: switch (ftdmchan->state) { + case FTDM_CHANNEL_STATE_PROCEED: case FTDM_CHANNEL_STATE_PROGRESS: /* T310 timer has expired */ ftdmchan->caller_data.hangup_cause = staEvnt->causeDgn[0].causeVal.val; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 2853335..385d1eb 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -34,6 +34,9 @@ #include "ftmod_sangoma_isdn.h" +static void sngisdn_set_prog_desc(ProgInd *progInd, ftdm_sngisdn_progind_t prod_ind); +static void sngisdn_set_facilityStr(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr); + void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) { ConEvnt conEvnt; @@ -138,6 +141,8 @@ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) cpy_redir_num_from_user(&conEvnt.redirNmb, &ftdmchan->caller_data); cpy_calling_name_from_user(&conEvnt, ftdmchan); + sngisdn_set_facilityStr(ftdmchan, &conEvnt.facilityStr); + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending SETUP (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); if (sng_isdn_con_request(signal_data->cc_id, sngisdn_info->suInstId, &conEvnt, signal_data->dchan_id, sngisdn_info->ces)) { @@ -323,14 +328,14 @@ void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan) return; } -void sngisdn_snd_progress(ftdm_channel_t *ftdmchan) +void sngisdn_snd_progress(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind) { CnStEvnt cnStEvnt; sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { + if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending PROGRESS, but no call data, aborting (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); @@ -351,7 +356,8 @@ void sngisdn_snd_progress(ftdm_channel_t *ftdmchan) cnStEvnt.progInd.codeStand0.pres = PRSNT_NODEF; cnStEvnt.progInd.codeStand0.val = IN_CSTD_CCITT; cnStEvnt.progInd.progDesc.pres = PRSNT_NODEF; - cnStEvnt.progInd.progDesc.val = IN_PD_IBAVAIL; + + sngisdn_set_prog_desc(&cnStEvnt.progInd, prog_ind); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending PROGRESS (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); if(sng_isdn_con_status(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId,&cnStEvnt, MI_PROGRESS, signal_data->dchan_id, sngisdn_info->ces)) { @@ -360,14 +366,14 @@ void sngisdn_snd_progress(ftdm_channel_t *ftdmchan) return; } -void sngisdn_snd_alert(ftdm_channel_t *ftdmchan) +void sngisdn_snd_alert(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind) { CnStEvnt cnStEvnt; sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { + if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending ALERT, but no call data, aborting (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); @@ -382,7 +388,7 @@ void sngisdn_snd_alert(ftdm_channel_t *ftdmchan) cnStEvnt.progInd.codeStand0.pres = PRSNT_NODEF; cnStEvnt.progInd.codeStand0.val = IN_CSTD_CCITT; cnStEvnt.progInd.progDesc.pres = PRSNT_NODEF; - cnStEvnt.progInd.progDesc.val = IN_PD_NOTETEISDN; + sngisdn_set_prog_desc(&cnStEvnt.progInd, prog_ind); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending ALERT (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); @@ -456,6 +462,27 @@ void sngisdn_snd_connect(ftdm_channel_t *ftdmchan) return; } +void sngisdn_snd_fac_req(ftdm_channel_t *ftdmchan) +{ + FacEvnt facEvnt; + + sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + + if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending FACILITY, but no call data, ignoring (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); + return; + } + + memset(&facEvnt, 0, sizeof(facEvnt)); + + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending FACILITY (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); + + if (sng_isdn_facility_request(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &facEvnt, MI_FACIL, signal_data->dchan_id, sngisdn_info->ces)) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused FACILITY request\n"); + } + return; +} void sngisdn_snd_info_req(ftdm_channel_t *ftdmchan) { @@ -510,7 +537,7 @@ void sngisdn_snd_disconnect(ftdm_channel_t *ftdmchan) sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { + if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending DISCONNECT, but no call data, aborting (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); @@ -531,6 +558,8 @@ void sngisdn_snd_disconnect(ftdm_channel_t *ftdmchan) discEvnt.causeDgn[0].recommend.pres = NOTPRSNT; discEvnt.causeDgn[0].dgnVal.pres = NOTPRSNT; + sngisdn_set_facilityStr(ftdmchan, &discEvnt.facilityStr); + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending DISCONNECT (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); if (sng_isdn_disc_request(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &discEvnt)) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused DISCONNECT request\n"); @@ -575,6 +604,8 @@ void sngisdn_snd_release(ftdm_channel_t *ftdmchan, uint8_t glare) spInstId = sngisdn_info->spInstId; } + sngisdn_set_facilityStr(ftdmchan, &relEvnt.facilityStr); + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending RELEASE/RELEASE COMPLETE (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, suInstId, spInstId); if (glare) { @@ -589,6 +620,46 @@ void sngisdn_snd_release(ftdm_channel_t *ftdmchan, uint8_t glare) return; } +static void sngisdn_set_prog_desc(ProgInd *progInd, ftdm_sngisdn_progind_t prog_ind) +{ + switch(prog_ind) { + case SNGISDN_PROGIND_NETE_ISDN: + progInd->progDesc.val = IN_PD_NOTETEISDN; + break; + case SNGISDN_PROGIND_DEST_NISDN: + progInd->progDesc.val = IN_PD_DSTNOTISDN; + break; + case SNGISDN_PROGIND_ORIG_NISDN: + progInd->progDesc.val = IN_PD_ORGNOTISDN; + break; + case SNGISDN_PROGIND_RET_ISDN: + progInd->progDesc.val = IN_PD_CALLRET; + break; + case SNGISDN_PROGIND_SERV_CHANGE: + /* Trillium defines do not match ITU-T Q931 Progress descriptions, + indicate a delayed response for now */ + progInd->progDesc.val = IN_PD_DELRESP; + break; + case SNGISDN_PROGIND_IB_AVAIL: + progInd->progDesc.val = IN_PD_IBAVAIL; + break; + } + return; +} + +static void sngisdn_set_facilityStr(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr) +{ + const char *facility_str = NULL; + + facility_str = ftdm_channel_get_var(ftdmchan, "isdn.facility.val"); + if (facility_str) { + facilityStr->eh.pres = PRSNT_NODEF; + facilityStr->facilityStr.len = strlen(facility_str); + memcpy(facilityStr->facilityStr.val, facility_str, facilityStr->facilityStr.len); + } + return; +} + /* We received an incoming frame on the d-channel, send data to the stack */ void sngisdn_snd_data(ftdm_channel_t *dchan, uint8_t *data, ftdm_size_t len) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 056bf66..379c481 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -229,6 +229,24 @@ ftdm_status_t cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *dis return FTDM_SUCCESS; } +ftdm_status_t cpy_facility_ie_from_stack(ftdm_caller_data_t *caller_data, uint8_t *data, uint32_t data_len) +{ + if (data_len > sizeof(caller_data->raw_data)-2) { + ftdm_log(FTDM_LOG_CRIT, "Length of Facility IE exceeds maximum length\n"); + return FTDM_FAIL; + } + + memset(caller_data->raw_data, 0, sizeof(caller_data->raw_data)); + /* Always include Facility IE identifier + len so this can be used as a sanity check by the user */ + caller_data->raw_data[0] = 0x1C; + caller_data->raw_data[1] = data_len; + + memcpy(&caller_data->raw_data[2], data, data_len); + caller_data->raw_data_len = data_len+2; + + return FTDM_SUCCESS; +} + ftdm_status_t cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm) { uint8_t len = strlen(ftdm->cid_num.digits); diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 508c699..87da5d1 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -289,7 +289,8 @@ typedef enum { FTDM_SIGEVENT_STOP, /*!< Hangup */ FTDM_SIGEVENT_RELEASED, /*!< Channel is completely released and available */ FTDM_SIGEVENT_UP, /*!< Outgoing call has been answered */ - FTDM_SIGEVENT_FLASH, /*< Flash event (typically on-hook/off-hook for analog devices) */ + FTDM_SIGEVENT_FLASH, /*!< Flash event (typically on-hook/off-hook for analog devices) */ + FTDM_SIGEVENT_PROCEED, /*!< Outgoing call got a response */ FTDM_SIGEVENT_PROGRESS, /*!< Outgoing call is making progress */ FTDM_SIGEVENT_PROGRESS_MEDIA, /*!< Outgoing call is making progress and there is media available */ FTDM_SIGEVENT_ALARM_TRAP, /*!< Hardware alarm ON */ @@ -299,9 +300,10 @@ typedef enum { FTDM_SIGEVENT_RESTART, /*!< Restart has been requested. Typically you hangup your call resources here */ FTDM_SIGEVENT_SIGSTATUS_CHANGED, /*!< Signaling protocol status changed (ie: D-chan up), see new status in raw_data ftdm_sigmsg_t member */ FTDM_SIGEVENT_COLLISION, /*!< Outgoing call was dropped because an incoming call arrived at the same time */ + FTDM_SIGEVENT_MSG, /* !< We received an in-call msg */ FTDM_SIGEVENT_INVALID } ftdm_signal_event_t; -#define SIGNAL_STRINGS "START", "STOP", "RELEASED", "UP", "FLASH", "PROGRESS", \ +#define SIGNAL_STRINGS "START", "STOP", "RELEASED", "UP", "FLASH", "PROCEED", "PROGRESS", \ "PROGRESS_MEDIA", "ALARM_TRAP", "ALARM_CLEAR", \ "COLLECTED_DIGIT", "ADD_CALL", "RESTART", "SIGSTATUS_CHANGED", "COLLISION", "INVALID" @@ -581,7 +583,7 @@ typedef enum { * This is used during incoming calls when you want to request the signaling stack * to notify about indications occurring locally */ typedef enum { - FTDM_CHANNEL_INDICATE_RING, + FTDM_CHANNEL_INDICATE_RINGING, FTDM_CHANNEL_INDICATE_PROCEED, FTDM_CHANNEL_INDICATE_PROGRESS, FTDM_CHANNEL_INDICATE_PROGRESS_MEDIA, diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index d9cefc3..f265cb1 100644 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -181,6 +181,8 @@ typedef enum { * after having called ftdm_send_span_signal(), which with this flag it will just enqueue the signal * for later delivery */ FTDM_SPAN_USE_SIGNALS_QUEUE = (1 << 10), + /* If this flag is set, channel will be moved to proceed state when calls goes to routing */ + FTDM_SPAN_USE_PROCEED_STATE = (1 << 11), } ftdm_span_flag_t; /*! \brief Channel supported features */ @@ -204,6 +206,7 @@ typedef enum { FTDM_CHANNEL_STATE_DIALTONE, FTDM_CHANNEL_STATE_COLLECT, FTDM_CHANNEL_STATE_RING, + FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_BUSY, FTDM_CHANNEL_STATE_ATTN, FTDM_CHANNEL_STATE_GENRING, @@ -211,6 +214,7 @@ typedef enum { FTDM_CHANNEL_STATE_GET_CALLERID, FTDM_CHANNEL_STATE_CALLWAITING, FTDM_CHANNEL_STATE_RESTART, + FTDM_CHANNEL_STATE_PROCEED, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, @@ -223,8 +227,8 @@ typedef enum { FTDM_CHANNEL_STATE_INVALID } ftdm_channel_state_t; #define CHANNEL_STATE_STRINGS "DOWN", "HOLD", "SUSPENDED", "DIALTONE", "COLLECT", \ - "RING", "BUSY", "ATTN", "GENRING", "DIALING", "GET_CALLERID", "CALLWAITING", \ - "RESTART", "PROGRESS", "PROGRESS_MEDIA", "UP", "IDLE", "TERMINATING", "CANCEL", \ + "RING", "RINGING", "BUSY", "ATTN", "GENRING", "DIALING", "GET_CALLERID", "CALLWAITING", \ + "RESTART", "PROCEED", "PROGRESS", "PROGRESS_MEDIA", "UP", "IDLE", "TERMINATING", "CANCEL", \ "HANGUP", "HANGUP_COMPLETE", "IN_LOOP", "INVALID" FTDM_STR2ENUM_P(ftdm_str2ftdm_channel_state, ftdm_channel_state2str, ftdm_channel_state_t) diff --git a/libs/freetdm/src/testanalog.c b/libs/freetdm/src/testanalog.c index 84d09f7..326bb5a 100644 --- a/libs/freetdm/src/testanalog.c +++ b/libs/freetdm/src/testanalog.c @@ -50,7 +50,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_signal) switch(sigmsg->event_id) { case FTDM_SIGEVENT_START: - ftdm_channel_call_indicate(sigmsg->channel, FTDM_CHANNEL_INDICATE_RING); + ftdm_channel_call_indicate(sigmsg->channel, FTDM_CHANNEL_INDICATE_RINGING); ftdm_log(FTDM_LOG_DEBUG, "launching thread and indicating ring\n"); ftdm_thread_create_detached(test_call, sigmsg->channel); break; commit b814dc17ce5aefded953fc7e30db257088f70475 Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Nov 24 20:04:43 2010 -0500 freetdm: ISDN Changes to better match SIP-to-TDM states diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 8d96112..27dc8d8 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -425,8 +425,11 @@ static switch_status_t channel_on_routing(switch_core_session_t *session) tech_pvt = switch_core_session_get_private(session); assert(tech_pvt != NULL); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL ROUTING\n", switch_channel_get_name(channel)); + assert(tech_pvt->ftdmchan != NULL); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL ROUTING\n", switch_channel_get_name(channel)); + + ftdm_channel_call_indicate(tech_pvt->ftdmchan, FTDM_CHANNEL_INDICATE_PROCEED); return SWITCH_STATUS_SUCCESS; } @@ -852,7 +855,7 @@ static switch_status_t channel_receive_message_b(switch_core_session_t *session, switch (msg->message_id) { case SWITCH_MESSAGE_INDICATE_RINGING: { - ftdm_channel_call_indicate(tech_pvt->ftdmchan, FTDM_CHANNEL_INDICATE_PROGRESS); + ftdm_channel_call_indicate(tech_pvt->ftdmchan, FTDM_CHANNEL_INDICATE_RINGING); } break; case SWITCH_MESSAGE_INDICATE_PROGRESS: @@ -935,7 +938,7 @@ static switch_status_t channel_receive_message_fxs(switch_core_session_t *sessio !switch_channel_test_flag(channel, CF_EARLY_MEDIA) && !switch_channel_test_flag(channel, CF_RING_READY) ) { - ftdm_channel_call_indicate(tech_pvt->ftdmchan, FTDM_CHANNEL_INDICATE_RING); + ftdm_channel_call_indicate(tech_pvt->ftdmchan, FTDM_CHANNEL_INDICATE_RINGING); switch_channel_mark_ring_ready(channel); } break; @@ -2133,7 +2136,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_clear_channel_signal) spanid, chanid, (uuid) ? uuid : "N/A"); } } - break; + break; case FTDM_SIGEVENT_SIGSTATUS_CHANGED: { ftdm_signaling_status_t sigstatus = sigmsg->raw_data ? *((ftdm_signaling_status_t*)(sigmsg->raw_data)) : sigmsg->sigstatus; @@ -2141,6 +2144,10 @@ static FIO_SIGNAL_CB_FUNCTION(on_clear_channel_signal) spanid, chanid, ftdm_signaling_status2str(sigstatus)); } break; + case FTDM_SIGEVENT_PROCEED: + case FTDM_SIGEVENT_MSG: + /* FS does not have handlers for these messages, so ignore them for now */ + break; default: { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unhandled msg type %d for channel %d:%d\n", diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 64233a9..ede3ff8 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2033,7 +2033,6 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_answer(const char *file, const char goto done; } - if (ftdmchan->state < FTDM_CHANNEL_STATE_PROGRESS) { ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS, 1); } @@ -2202,14 +2201,19 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_indicate(const char *file, const ch switch (indication) { /* FIXME: ring and busy cannot be used with all signaling stacks * (particularly isdn stacks I think, we should emulate or just move to hangup with busy cause) */ - case FTDM_CHANNEL_INDICATE_RING: - ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_RING, 1); + case FTDM_CHANNEL_INDICATE_RINGING: + ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_RINGING, 1); break; - case FTDM_CHANNEL_INDICATE_BUSY: ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_BUSY, 1); break; - + case FTDM_CHANNEL_INDICATE_PROCEED: + if (ftdm_test_flag(ftdmchan->span, FTDM_SPAN_USE_PROCEED_STATE)) { + if (ftdmchan->state == FTDM_CHANNEL_STATE_RING) { + ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROCEED, 1); + } + } + break; case FTDM_CHANNEL_INDICATE_PROGRESS: if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { ftdm_set_flag(ftdmchan, FTDM_CHANNEL_PROGRESS); @@ -2217,7 +2221,6 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_indicate(const char *file, const ch ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS, 1); } break; - case FTDM_CHANNEL_INDICATE_PROGRESS_MEDIA: if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { ftdm_set_flag(ftdmchan, FTDM_CHANNEL_PROGRESS); @@ -2236,7 +2239,6 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_indicate(const char *file, const ch ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, 1); } break; - default: ftdm_log(file, func, line, FTDM_LOG_LEVEL_WARNING, "Do not know how to indicate %d\n", indication); status = FTDM_FAIL; diff --git a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c index fc9bea6..99d2566 100644 --- a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c +++ b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c @@ -438,7 +438,7 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) { if (state_counter > 5000 || !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_CALLERID_DETECT)) { ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_CALLERID_DETECT, NULL); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE); + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RING); } } break; @@ -492,8 +492,8 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) } if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK) && - (ftdmchan->last_state == FTDM_CHANNEL_STATE_RING || ftdmchan->last_state == FTDM_CHANNEL_STATE_DIALTONE - || ftdmchan->last_state >= FTDM_CHANNEL_STATE_IDLE)) { + (ftdmchan->last_state == FTDM_CHANNEL_STATE_RINGING || ftdmchan->last_state == FTDM_CHANNEL_STATE_DIALTONE + || ftdmchan->last_state >= FTDM_CHANNEL_STATE_RING)) { ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY); } else { ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_CLEARING; @@ -535,7 +535,7 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) } } case FTDM_CHANNEL_STATE_UP: - case FTDM_CHANNEL_STATE_IDLE: + case FTDM_CHANNEL_STATE_RING: { ftdm_sleep(interval); continue; @@ -599,7 +599,7 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) ftdm_channel_use(ftdmchan); } break; - case FTDM_CHANNEL_STATE_IDLE: + case FTDM_CHANNEL_STATE_RING: { ftdm_channel_use(ftdmchan); sig.event_id = FTDM_SIGEVENT_START; @@ -669,7 +669,7 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) continue; } break; - case FTDM_CHANNEL_STATE_RING: + case FTDM_CHANNEL_STATE_RINGING: { ftdm_buffer_zero(dt_buffer); teletone_run(&ts, ftdmchan->span->tone_map[FTDM_TONEMAP_RING]); @@ -732,7 +732,7 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) if (last_digit && (!collecting || ((elapsed - last_digit > analog_data->digit_timeout) || strlen(dtmf) >= analog_data->max_dialstr))) { ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Number obtained [%s]\n", dtmf); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE); + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RING); last_digit = 0; collecting = 0; } @@ -890,7 +890,7 @@ static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *e if (ftdm_test_flag(analog_data, FTDM_ANALOG_CALLERID)) { ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_GET_CALLERID); } else { - ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_IDLE); + ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_RING); } event->channel->ring_count = 1; ftdm_mutex_unlock(event->channel->mutex); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 77ad917..6f5f838 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -115,7 +115,19 @@ ftdm_state_map_t sangoma_isdn_state_map = { ZSD_INBOUND, ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_RING, FTDM_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS, FTDM_END} + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROCEED, FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_PROGRESS, FTDM_END} + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_PROCEED, FTDM_END}, + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA,FTDM_END} + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_RINGING, FTDM_END}, + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_END}, }, { ZSD_INBOUND, @@ -189,12 +201,20 @@ ftdm_state_map_t sangoma_isdn_state_map = { ZSD_OUTBOUND, ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_DIALING, FTDM_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS, - FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_DOWN, FTDM_END} + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, + FTDM_CHANNEL_STATE_PROCEED, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, + FTDM_CHANNEL_STATE_DOWN, FTDM_END} }, { ZSD_OUTBOUND, ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_PROCEED, FTDM_END}, + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, + FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_END}, + }, + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_PROGRESS, FTDM_END}, {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_END}, }, @@ -604,13 +624,15 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) break; case FTDM_CHANNEL_STATE_GET_CALLERID: { - sngisdn_set_flag(sngisdn_info, FLAG_SENT_PROCEED); - sngisdn_snd_proceed(ftdmchan); + if (!sngisdn_test_flag(sngisdn_info, FLAG_SENT_PROCEED)) { + sngisdn_set_flag(sngisdn_info, FLAG_SENT_PROCEED); + sngisdn_snd_proceed(ftdmchan); + } /* Wait in this state until we get FACILITY msg */ } break; case FTDM_CHANNEL_STATE_RING: /* incoming call request */ - { + { ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending incoming call from %s to %s to FTDM core\n", ftdmchan->caller_data.ani.digits, ftdmchan->caller_data.dnis.digits); /* we have enough information to inform FTDM of the call*/ @@ -635,6 +657,25 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) } } break; + case FTDM_CHANNEL_STATE_PROCEED: + { + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + /*OUTBOUND...so we were told by the line of this so noifiy the user*/ + sigev.event_id = FTDM_SIGEVENT_PROCEED; + ftdm_span_send_signal(ftdmchan->span, &sigev); + } else { + if (!sngisdn_test_flag(sngisdn_info, FLAG_SENT_PROCEED)) { + sngisdn_set_flag(sngisdn_info, FLAG_SENT_PROCEED); + sngisdn_snd_proceed(ftdmchan); + } + } + } + break; + case FTDM_CHANNEL_STATE_RINGING: + { + sngisdn_snd_alert(ftdmchan, SNGISDN_PROGIND_NETE_ISDN); + } + break; case FTDM_CHANNEL_STATE_PROGRESS: { /*check if the channel is inbound or outbound*/ @@ -642,9 +683,12 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) /*OUTBOUND...so we were told by the line of this so noifiy the user*/ sigev.event_id = FTDM_SIGEVENT_PROGRESS; ftdm_span_send_signal(ftdmchan->span, &sigev); - } else if (!sngisdn_test_flag(sngisdn_info, FLAG_SENT_PROCEED)) { - sngisdn_set_flag(sngisdn_info, FLAG_SENT_PROCEED); - sngisdn_snd_proceed(ftdmchan); + } else { + /* If we already sent a PROCEED before, do not send a PROGRESS as there is nothing to indicate to the remote switch */ + if (ftdmchan->last_state != FTDM_CHANNEL_STATE_PROCEED) { + /* Send a progress message, indicating: Call is not end-to-end ISDN, further call progress may be available */ + sngisdn_snd_progress(ftdmchan, SNGISDN_PROGIND_NETE_ISDN); + } } } break; @@ -654,7 +698,8 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) sigev.event_id = FTDM_SIGEVENT_PROGRESS_MEDIA; ftdm_span_send_signal(ftdmchan->span, &sigev); } else { - sngisdn_snd_progress(ftdmchan); + /* Send a progress message, indicating: In-band information/pattern available */ + sngisdn_snd_progress(ftdmchan, SNGISDN_PROGIND_IB_AVAIL); } } break; @@ -992,6 +1037,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_isdn_span_config) span->state_map = &sangoma_isdn_state_map; ftdm_set_flag(span, FTDM_SPAN_USE_CHAN_QUEUE); ftdm_set_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE); + ftdm_set_flag(span, FTDM_SPAN_USE_PROCEED_STATE); if (span->trunk_type == FTDM_TRUNK_BRI_PTMP || span->trunk_type == FTDM_TRUNK_BRI) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 81a98cf..25ffef8 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -75,7 +75,8 @@ typedef enum { FLAG_DELAYED_REL = (1 << 7), FLAG_SENT_PROCEED = (1 << 8), FLAG_SEND_DISC = (1 << 9), - FLAG_ACTIVATING = (1 << 10), /* Used for BRI only, flag is set after we request line CONNECTED */ + /* Used for BRI only, flag is set after we request line CONNECTED */ + FLAG_ACTIVATING = (1 << 10), } sngisdn_flag_t; @@ -135,6 +136,21 @@ typedef enum { SNGISDN_EVENT_RST_IND, } ftdm_sngisdn_event_id_t; +typedef enum { + /* Call is not end-to-end ISDN */ + SNGISDN_PROGIND_NETE_ISDN = 1, + /* Destination address is non-ISDN */ + SNGISDN_PROGIND_DEST_NISDN, + /* Origination address is non-ISDN */ + SNGISDN_PROGIND_ORIG_NISDN, + /* Call has returned to the ISDN */ + SNGISDN_PROGIND_RET_ISDN, + /* Interworking as occured and has resulted in a telecommunication service change */ + SNGISDN_PROGIND_SERV_CHANGE, + /* In-band information or an appropriate pattern is now available */ + SNGISDN_PROGIND_IB_AVAIL, +} ftdm_sngisdn_progind_t; + /* Only timers that can be cancelled are listed here */ #define SNGISDN_NUM_TIMERS 1 /* Increase NUM_TIMERS as number of ftdm_sngisdn_timer_t increases */ @@ -181,6 +197,7 @@ typedef struct sngisdn_span_data { uint8_t trace_flags; /* TODO: change to flags, so we can use ftdm_test_flag etc.. */ uint8_t overlap_dial; uint8_t setup_arb; + uint8_t facility_ie_decode; uint8_t facility; int8_t facility_timeout; uint8_t num_local_numbers; @@ -288,13 +305,14 @@ void stack_pst_init(Pst *pst); void sngisdn_snd_setup(ftdm_channel_t *ftdmchan); void sngisdn_snd_setup_ack(ftdm_channel_t *ftdmchan); void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan); -void sngisdn_snd_progress(ftdm_channel_t *ftdmchan); -void sngisdn_snd_alert(ftdm_channel_t *ftdmchan); +void sngisdn_snd_progress(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind); +void sngisdn_snd_alert(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind); void sngisdn_snd_connect(ftdm_channel_t *ftdmchan); void sngisdn_snd_disconnect(ftdm_channel_t *ftdmchan); void sngisdn_snd_release(ftdm_channel_t *ftdmchan, uint8_t glare); void sngisdn_snd_reset(ftdm_channel_t *ftdmchan); void sngisdn_snd_con_complete(ftdm_channel_t *ftdmchan); +void sngisdn_snd_fac_req(ftdm_channel_t *ftdmchan); void sngisdn_snd_info_req(ftdm_channel_t *ftdmchan); void sngisdn_snd_status_enq(ftdm_channel_t *ftdmchan); void sngisdn_snd_data(ftdm_channel_t *dchan, uint8_t *data, ftdm_size_t len); @@ -362,6 +380,8 @@ ftdm_status_t cpy_calling_num_from_stack(ftdm_caller_data_t *ftdm, CgPtyNmb *cgP ftdm_status_t cpy_called_num_from_stack(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb); ftdm_status_t cpy_redir_num_from_stack(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb); ftdm_status_t cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *display); +ftdm_status_t cpy_facility_ie_from_stack(ftdm_caller_data_t *ftdm, uint8_t *data, uint32_t data_len); + ftdm_status_t cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm); ftdm_status_t cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm); ftdm_status_t cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c index 3b264ae..657aa5e 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c @@ -190,6 +190,7 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ signal_data->min_digits = 8; signal_data->overlap_dial = SNGISDN_OPT_DEFAULT; signal_data->setup_arb = SNGISDN_OPT_DEFAULT; + signal_data->facility_ie_decode = SNGISDN_OPT_TRUE; signal_data->timer_t3 = 8; signal_data->link_id = span->span_id; @@ -289,6 +290,14 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ if (signal_data->facility_timeout < 0) { signal_data->facility_timeout = 0; } + } else if (!strcasecmp(var, "facility-ie-decode")) { + if (!strcasecmp(val, "yes")) { + signal_data->facility_ie_decode = SNGISDN_OPT_TRUE; + } else if (!strcasecmp(val, "no")) { + signal_data->facility_ie_decode = SNGISDN_OPT_FALSE; + } else { + ftdm_log(FTDM_LOG_ERROR, "Invalid value for parameter:%s:%s\n", var, val); + } } else { ftdm_log(FTDM_LOG_WARNING, "Ignoring unknown parameter %s\n", ftdm_parameters[paramindex].var); } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 3fe0422..209284a 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -144,31 +144,35 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) snprintf(ftdmchan->caller_data.aniII, 5, "%.2d", conEvnt->ni2OctStr.str.val[3]); } } - - if (signal_data->facility == SNGISDN_OPT_TRUE && conEvnt->facilityStr.eh.pres) { - /* Verify whether the Caller Name will come in a subsequent FACILITY message */ - uint16_t ret_val; - char retrieved_str[255]; - - ret_val = sng_isdn_retrieve_facility_caller_name(conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len, retrieved_str); - /* - return values for "sng_isdn_retrieve_facility_information_following": - If there will be no information following, or fails to decode IE, returns -1 - If there will be no information following, but current FACILITY IE contains a caller name, returns 0 - If there will be information following, returns 1 - */ - - if (ret_val == 1) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Expecting Caller name in FACILITY\n"); - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_GET_CALLERID); - /* Launch timer in case we never get a FACILITY msg */ - if (signal_data->facility_timeout) { - ftdm_sched_timer(signal_data->sched, "facility_timeout", signal_data->facility_timeout, - sngisdn_facility_timeout, (void*) sngisdn_info, &sngisdn_info->timers[SNGISDN_TIMER_FACILITY]); + + if (conEvnt->facilityStr.eh.pres) { + if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { + cpy_facility_ie_from_stack(&ftdmchan->caller_data, conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len); + } else if (signal_data->facility == SNGISDN_OPT_TRUE) { + /* Verify whether the Caller Name will come in a subsequent FACILITY message */ + uint16_t ret_val; + char retrieved_str[255]; + + ret_val = sng_isdn_retrieve_facility_caller_name(conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len, retrieved_str); + /* + return values for "sng_isdn_retrieve_facility_information_following": + If there will be no information following, or fails to decode IE, returns -1 + If there will be no information following, but current FACILITY IE contains a caller name, returns 0 + If there will be information following, returns 1 + */ + + if (ret_val == 1) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Expecting Caller name in FACILITY\n"); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_GET_CALLERID); + /* Launch timer in case we never get a FACILITY msg */ + if (signal_data->facility_timeout) { + ftdm_sched_timer(signal_data->sched, "facility_timeout", signal_data->facility_timeout, + sngisdn_facility_timeout, (void*) sngisdn_info, &sngisdn_info->timers[SNGISDN_TIMER_FACILITY]); + } + break; + } else if (ret_val == 0) { + strcpy(ftdmchan->caller_data.cid_name, retrieved_str); } - break; - } else if (ret_val == 0) { - strcpy(ftdmchan->caller_data.cid_name, retrieved_str); } } } @@ -269,6 +273,7 @@ void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event) if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { switch(ftdmchan->state) { + case FTDM_CHANNEL_STATE_PROCEED: case FTDM_CHANNEL_STATE_PROGRESS: case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: case FTDM_CHANNEL_STATE_DIALING: @@ -367,8 +372,10 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) case MI_CALLPROC: switch(ftdmchan->state) { - case FTDM_CHANNEL_STATE_DIALING: - if (evntType == MI_PROGRESS || + case FTDM_CHANNEL_STATE_DIALING: + if (evntType == MI_CALLPROC) { + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROCEED); + } else if (evntType == MI_PROGRESS || (cnStEvnt->progInd.eh.pres && cnStEvnt->progInd.progDesc.val == IN_PD_IBAVAIL)) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); } else { @@ -417,6 +424,7 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) } break; case FTDM_CHANNEL_STATE_RING: + case FTDM_CHANNEL_STATE_PROCEED: case FTDM_CHANNEL_STATE_PROGRESS: case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: case FTDM_CHANNEL_STATE_UP: @@ -446,6 +454,7 @@ void sngisdn_process_disc_ind (sngisdn_event_data_t *sngisdn_event) uint32_t spInstId = sngisdn_event->spInstId; sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; DiscEvnt *discEvnt = &sngisdn_event->event.discEvnt; @@ -454,12 +463,20 @@ void sngisdn_process_disc_ind (sngisdn_event_data_t *sngisdn_event) ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing DISCONNECT (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n"); - switch (ftdmchan->state) { + switch (ftdmchan->state) { case FTDM_CHANNEL_STATE_RING: case FTDM_CHANNEL_STATE_DIALING: + case FTDM_CHANNEL_STATE_PROCEED: case FTDM_CHANNEL_STATE_PROGRESS: case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - case FTDM_CHANNEL_STATE_UP: + case FTDM_CHANNEL_STATE_UP: + if (discEvnt->facilityStr.eh.pres) { + if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { + cpy_facility_ie_from_stack(&ftdmchan->caller_data, discEvnt->facilityStr.facilityStr.val, discEvnt->facilityStr.facilityStr.len); + } else { + /* Call libsng_isdn facility decode function and copy variables here */ + } + } if (discEvnt->causeDgn[0].eh.pres && discEvnt->causeDgn[0].causeVal.pres) { ftdmchan->caller_data.hangup_cause = discEvnt->causeDgn[0].causeVal.val; } else { @@ -503,6 +520,7 @@ void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event) uint32_t spInstId = sngisdn_event->spInstId; sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; RelEvnt *relEvnt = &sngisdn_event->event.relEvnt; @@ -538,6 +556,7 @@ void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event) sngisdn_set_avail_rate(ftdmchan->span, SNGISDN_AVAIL_DOWN); } /* fall-through */ + case FTDM_CHANNEL_STATE_PROCEED: case FTDM_CHANNEL_STATE_PROGRESS: case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: case FTDM_CHANNEL_STATE_UP: @@ -547,6 +566,15 @@ void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event) not changed while we were waiting for ftdmchan->mutex by comparing suInstId's */ if (((sngisdn_chan_data_t*)ftdmchan->call_data)->suInstId == suInstId || ((sngisdn_chan_data_t*)ftdmchan->call_data)->spInstId == spInstId) { + + if (relEvnt->facilityStr.eh.pres) { + if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { + cpy_facility_ie_from_stack(&ftdmchan->caller_data, relEvnt->facilityStr.facilityStr.val, relEvnt->facilityStr.facilityStr.len); + } else { + /* Call libsng_isdn facility decode function and copy variables here */ + } + } + if (relEvnt->causeDgn[0].eh.pres && relEvnt->causeDgn[0].causeVal.pres) { ftdmchan->caller_data.hangup_cause = relEvnt->causeDgn[0].causeVal.val; ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "cause:%d\n", ftdmchan->caller_data.hangup_cause); @@ -725,15 +753,16 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event) switch (ftdmchan->state) { case FTDM_CHANNEL_STATE_GET_CALLERID: /* Update the caller ID Name */ + if (facEvnt->facElmt.facStr.pres) { char retrieved_str[255]; - + /* return values for "sng_isdn_retrieve_facility_information_following": If there will be no information following, or fails to decode IE, returns -1 If there will be no information following, but current FACILITY IE contains a caller name, returns 0 If there will be information following, returns 1 */ - + if (sng_isdn_retrieve_facility_caller_name(&facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len, retrieved_str) == 0) { strcpy(ftdmchan->caller_data.cid_name, retrieved_str); } else { @@ -751,6 +780,25 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event) /* We received the caller ID Name in FACILITY, but its too late, facility-timeout already occurred */ ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "FACILITY received, but we already proceeded with call\n"); break; + case FTDM_CHANNEL_STATE_UP: + { + ftdm_sigmsg_t sigev; + if (facEvnt->facElmt.facStr.pres) { + if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { + cpy_facility_ie_from_stack(&ftdmchan->caller_data, &facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len); + } else { + /* Call libsng_isdn facility decode function and copy variables here */ + } + } + memset(&sigev, 0, sizeof(sigev)); + sigev.chan_id = ftdmchan->chan_id; + sigev.span_id = ftdmchan->span_id; + sigev.channel = ftdmchan; + + sigev.event_id = FTDM_SIGEVENT_MSG; + ftdm_span_send_signal(ftdmchan->span, &sigev); + } + break; default: /* We do not support other FACILITY types for now, so do nothing */ break; @@ -865,6 +913,7 @@ void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event) ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "T302 Timer expired, proceeding with call\n"); ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); break; + case FTDM_CHANNEL_STATE_PROCEED: case FTDM_CHANNEL_STATE_PROGRESS: case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Remote switch expecting OVERLAP receive, but we are already PROCEEDING\n"); @@ -882,6 +931,7 @@ void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event) break; case 3: switch (ftdmchan->state) { + case FTDM_CHANNEL_STATE_PROCEED: case FTDM_CHANNEL_STATE_PROGRESS: /* T310 timer has expired */ ftdmchan->caller_data.hangup_cause = staEvnt->causeDgn[0].causeVal.val; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 2853335..385d1eb 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -34,6 +34,9 @@ #include "ftmod_sangoma_isdn.h" +static void sngisdn_set_prog_desc(ProgInd *progInd, ftdm_sngisdn_progind_t prod_ind); +static void sngisdn_set_facilityStr(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr); + void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) { ConEvnt conEvnt; @@ -138,6 +141,8 @@ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) cpy_redir_num_from_user(&conEvnt.redirNmb, &ftdmchan->caller_data); cpy_calling_name_from_user(&conEvnt, ftdmchan); + sngisdn_set_facilityStr(ftdmchan, &conEvnt.facilityStr); + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending SETUP (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); if (sng_isdn_con_request(signal_data->cc_id, sngisdn_info->suInstId, &conEvnt, signal_data->dchan_id, sngisdn_info->ces)) { @@ -323,14 +328,14 @@ void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan) return; } -void sngisdn_snd_progress(ftdm_channel_t *ftdmchan) +void sngisdn_snd_progress(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind) { CnStEvnt cnStEvnt; sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { + if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending PROGRESS, but no call data, aborting (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); @@ -351,7 +356,8 @@ void sngisdn_snd_progress(ftdm_channel_t *ftdmchan) cnStEvnt.progInd.codeStand0.pres = PRSNT_NODEF; cnStEvnt.progInd.codeStand0.val = IN_CSTD_CCITT; cnStEvnt.progInd.progDesc.pres = PRSNT_NODEF; - cnStEvnt.progInd.progDesc.val = IN_PD_IBAVAIL; + + sngisdn_set_prog_desc(&cnStEvnt.progInd, prog_ind); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending PROGRESS (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); if(sng_isdn_con_status(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId,&cnStEvnt, MI_PROGRESS, signal_data->dchan_id, sngisdn_info->ces)) { @@ -360,14 +366,14 @@ void sngisdn_snd_progress(ftdm_channel_t *ftdmchan) return; } -void sngisdn_snd_alert(ftdm_channel_t *ftdmchan) +void sngisdn_snd_alert(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_ind) { CnStEvnt cnStEvnt; sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { + if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending ALERT, but no call data, aborting (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); @@ -382,7 +388,7 @@ void sngisdn_snd_alert(ftdm_channel_t *ftdmchan) cnStEvnt.progInd.codeStand0.pres = PRSNT_NODEF; cnStEvnt.progInd.codeStand0.val = IN_CSTD_CCITT; cnStEvnt.progInd.progDesc.pres = PRSNT_NODEF; - cnStEvnt.progInd.progDesc.val = IN_PD_NOTETEISDN; + sngisdn_set_prog_desc(&cnStEvnt.progInd, prog_ind); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending ALERT (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); @@ -456,6 +462,27 @@ void sngisdn_snd_connect(ftdm_channel_t *ftdmchan) return; } +void sngisdn_snd_fac_req(ftdm_channel_t *ftdmchan) +{ + FacEvnt facEvnt; + + sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + + if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending FACILITY, but no call data, ignoring (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); + return; + } + + memset(&facEvnt, 0, sizeof(facEvnt)); + + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending FACILITY (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); + + if (sng_isdn_facility_request(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &facEvnt, MI_FACIL, signal_data->dchan_id, sngisdn_info->ces)) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused FACILITY request\n"); + } + return; +} void sngisdn_snd_info_req(ftdm_channel_t *ftdmchan) { @@ -510,7 +537,7 @@ void sngisdn_snd_disconnect(ftdm_channel_t *ftdmchan) sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { + if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending DISCONNECT, but no call data, aborting (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); @@ -531,6 +558,8 @@ void sngisdn_snd_disconnect(ftdm_channel_t *ftdmchan) discEvnt.causeDgn[0].recommend.pres = NOTPRSNT; discEvnt.causeDgn[0].dgnVal.pres = NOTPRSNT; + sngisdn_set_facilityStr(ftdmchan, &discEvnt.facilityStr); + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending DISCONNECT (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); if (sng_isdn_disc_request(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &discEvnt)) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused DISCONNECT request\n"); @@ -575,6 +604,8 @@ void sngisdn_snd_release(ftdm_channel_t *ftdmchan, uint8_t glare) spInstId = sngisdn_info->spInstId; } + sngisdn_set_facilityStr(ftdmchan, &relEvnt.facilityStr); + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending RELEASE/RELEASE COMPLETE (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, suInstId, spInstId); if (glare) { @@ -589,6 +620,46 @@ void sngisdn_snd_release(ftdm_channel_t *ftdmchan, uint8_t glare) return; } +static void sngisdn_set_prog_desc(ProgInd *progInd, ftdm_sngisdn_progind_t prog_ind) +{ + switch(prog_ind) { + case SNGISDN_PROGIND_NETE_ISDN: + progInd->progDesc.val = IN_PD_NOTETEISDN; + break; + case SNGISDN_PROGIND_DEST_NISDN: + progInd->progDesc.val = IN_PD_DSTNOTISDN; + break; + case SNGISDN_PROGIND_ORIG_NISDN: + progInd->progDesc.val = IN_PD_ORGNOTISDN; + break; + case SNGISDN_PROGIND_RET_ISDN: + progInd->progDesc.val = IN_PD_CALLRET; + break; + case SNGISDN_PROGIND_SERV_CHANGE: + /* Trillium defines do not match ITU-T Q931 Progress descriptions, + indicate a delayed response for now */ + progInd->progDesc.val = IN_PD_DELRESP; + break; + case SNGISDN_PROGIND_IB_AVAIL: + progInd->progDesc.val = IN_PD_IBAVAIL; + break; + } + return; +} + +static void sngisdn_set_facilityStr(ftdm_channel_t *ftdmchan, FacilityStr *facilityStr) +{ + const char *facility_str = NULL; + + facility_str = ftdm_channel_get_var(ftdmchan, "isdn.facility.val"); + if (facility_str) { + facilityStr->eh.pres = PRSNT_NODEF; + facilityStr->facilityStr.len = strlen(facility_str); + memcpy(facilityStr->facilityStr.val, facility_str, facilityStr->facilityStr.len); + } + return; +} + /* We received an incoming frame on the d-channel, send data to the stack */ void sngisdn_snd_data(ftdm_channel_t *dchan, uint8_t *data, ftdm_size_t len) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 056bf66..379c481 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -229,6 +229,24 @@ ftdm_status_t cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *dis return FTDM_SUCCESS; } +ftdm_status_t cpy_facility_ie_from_stack(ftdm_caller_data_t *caller_data, uint8_t *data, uint32_t data_len) +{ + if (data_len > sizeof(caller_data->raw_data)-2) { + ftdm_log(FTDM_LOG_CRIT, "Length of Facility IE exceeds maximum length\n"); + return FTDM_FAIL; + } + + memset(caller_data->raw_data, 0, sizeof(caller_data->raw_data)); + /* Always include Facility IE identifier + len so this can be used as a sanity check by the user */ + caller_data->raw_data[0] = 0x1C; + caller_data->raw_data[1] = data_len; + + memcpy(&caller_data->raw_data[2], data, data_len); + caller_data->raw_data_len = data_len+2; + + return FTDM_SUCCESS; +} + ftdm_status_t cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm) { uint8_t len = strlen(ftdm->cid_num.digits); diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 508c699..87da5d1 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -289,7 +289,8 @@ typedef enum { FTDM_SIGEVENT_STOP, /*!< Hangup */ FTDM_SIGEVENT_RELEASED, /*!< Channel is completely released and available */ FTDM_SIGEVENT_UP, /*!< Outgoing call has been answered */ - FTDM_SIGEVENT_FLASH, /*< Flash event (typically on-hook/off-hook for analog devices) */ + FTDM_SIGEVENT_FLASH, /*!< Flash event (typically on-hook/off-hook for analog devices) */ + FTDM_SIGEVENT_PROCEED, /*!< Outgoing call got a response */ FTDM_SIGEVENT_PROGRESS, /*!< Outgoing call is making progress */ FTDM_SIGEVENT_PROGRESS_MEDIA, /*!< Outgoing call is making progress and there is media available */ FTDM_SIGEVENT_ALARM_TRAP, /*!< Hardware alarm ON */ @@ -299,9 +300,10 @@ typedef enum { FTDM_SIGEVENT_RESTART, /*!< Restart has been requested. Typically you hangup your call resources here */ FTDM_SIGEVENT_SIGSTATUS_CHANGED, /*!< Signaling protocol status changed (ie: D-chan up), see new status in raw_data ftdm_sigmsg_t member */ FTDM_SIGEVENT_COLLISION, /*!< Outgoing call was dropped because an incoming call arrived at the same time */ + FTDM_SIGEVENT_MSG, /* !< We received an in-call msg */ FTDM_SIGEVENT_INVALID } ftdm_signal_event_t; -#define SIGNAL_STRINGS "START", "STOP", "RELEASED", "UP", "FLASH", "PROGRESS", \ +#define SIGNAL_STRINGS "START", "STOP", "RELEASED", "UP", "FLASH", "PROCEED", "PROGRESS", \ "PROGRESS_MEDIA", "ALARM_TRAP", "ALARM_CLEAR", \ "COLLECTED_DIGIT", "ADD_CALL", "RESTART", "SIGSTATUS_CHANGED", "COLLISION", "INVALID" @@ -581,7 +583,7 @@ typedef enum { * This is used during incoming calls when you want to request the signaling stack * to notify about indications occurring locally */ typedef enum { - FTDM_CHANNEL_INDICATE_RING, + FTDM_CHANNEL_INDICATE_RINGING, FTDM_CHANNEL_INDICATE_PROCEED, FTDM_CHANNEL_INDICATE_PROGRESS, FTDM_CHANNEL_INDICATE_PROGRESS_MEDIA, diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index d9cefc3..f265cb1 100644 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -181,6 +181,8 @@ typedef enum { * after having called ftdm_send_span_signal(), which with this flag it will just enqueue the signal * for later delivery */ FTDM_SPAN_USE_SIGNALS_QUEUE = (1 << 10), + /* If this flag is set, channel will be moved to proceed state when calls goes to routing */ + FTDM_SPAN_USE_PROCEED_STATE = (1 << 11), } ftdm_span_flag_t; /*! \brief Channel supported features */ @@ -204,6 +206,7 @@ typedef enum { FTDM_CHANNEL_STATE_DIALTONE, FTDM_CHANNEL_STATE_COLLECT, FTDM_CHANNEL_STATE_RING, + FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_BUSY, FTDM_CHANNEL_STATE_ATTN, FTDM_CHANNEL_STATE_GENRING, @@ -211,6 +214,7 @@ typedef enum { FTDM_CHANNEL_STATE_GET_CALLERID, FTDM_CHANNEL_STATE_CALLWAITING, FTDM_CHANNEL_STATE_RESTART, + FTDM_CHANNEL_STATE_PROCEED, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, @@ -223,8 +227,8 @@ typedef enum { FTDM_CHANNEL_STATE_INVALID } ftdm_channel_state_t; #define CHANNEL_STATE_STRINGS "DOWN", "HOLD", "SUSPENDED", "DIALTONE", "COLLECT", \ - "RING", "BUSY", "ATTN", "GENRING", "DIALING", "GET_CALLERID", "CALLWAITING", \ - "RESTART", "PROGRESS", "PROGRESS_MEDIA", "UP", "IDLE", "TERMINATING", "CANCEL", \ + "RING", "RINGING", "BUSY", "ATTN", "GENRING", "DIALING", "GET_CALLERID", "CALLWAITING", \ + "RESTART", "PROCEED", "PROGRESS", "PROGRESS_MEDIA", "UP", "IDLE", "TERMINATING", "CANCEL", \ "HANGUP", "HANGUP_COMPLETE", "IN_LOOP", "INVALID" FTDM_STR2ENUM_P(ftdm_str2ftdm_channel_state, ftdm_channel_state2str, ftdm_channel_state_t) diff --git a/libs/freetdm/src/testanalog.c b/libs/freetdm/src/testanalog.c index 84d09f7..326bb5a 100644 --- a/libs/freetdm/src/testanalog.c +++ b/libs/freetdm/src/testanalog.c @@ -50,7 +50,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_signal) switch(sigmsg->event_id) { case FTDM_SIGEVENT_START: - ftdm_channel_call_indicate(sigmsg->channel, FTDM_CHANNEL_INDICATE_RING); + ftdm_channel_call_indicate(sigmsg->channel, FTDM_CHANNEL_INDICATE_RINGING); ftdm_log(FTDM_LOG_DEBUG, "launching thread and indicating ring\n"); ftdm_thread_create_detached(test_call, sigmsg->channel); break; commit 2b0189becad007b0683272a0a3d46a952cc520ed Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Wed Nov 24 22:58:05 2010 -0200 freetdm: now wanpipe_channel_next_event() doesn't expect the flag FTDM_CHANNEL_EVENT to be set. If it is, it just clears it. Also removed unused code from wanpipe_channel_next_event() diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index ae46852..1a43c4d 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -1125,45 +1125,16 @@ FIO_CHANNEL_NEXT_EVENT_FUNCTION(wanpipe_channel_next_event) wanpipe_tdm_api_t tdm_api; ftdm_span_t *span = ftdmchan->span; - if (ftdmchan->last_event_time && !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_EVENT)) { - uint32_t diff = (uint32_t)(ftdm_current_time_in_ms() - ftdmchan->last_event_time); - /* XX printf("%u %u %u\n", diff, (unsigned)ftdm_current_time_in_ms(), (unsigned)ftdmchan->last_event_time); */ - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_WINK)) { - if (diff > wp_globals.wink_ms) { - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_WINK); - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_FLASH); - ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_OFFHOOK); - event_id = FTDM_OOB_OFFHOOK; - goto event; - } - } - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_FLASH)) { - if (diff > wp_globals.flash_ms) { - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_FLASH); - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_WINK); - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_OFFHOOK); - event_id = FTDM_OOB_ONHOOK; - - if (ftdmchan->type == FTDM_CHAN_TYPE_FXO) { - wanpipe_tdm_api_t tdm_api; - memset(&tdm_api, 0, sizeof(tdm_api)); - - sangoma_tdm_txsig_onhook(ftdmchan->sockfd,&tdm_api); - } - goto event; - } - } - } - - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_EVENT)) - return FTDM_FAIL; + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_EVENT)) + ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_EVENT); memset(&tdm_api, 0, sizeof(tdm_api)); status = sangoma_tdm_read_event(ftdmchan->sockfd, &tdm_api); if (status != FTDM_SUCCESS) { +#if 0 snprintf(span->last_error, sizeof(span->last_error), "%s", strerror(errno)); ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to read event from channel: %s\n", strerror(errno)); +#endif return FTDM_FAIL; } @@ -1277,8 +1248,6 @@ FIO_CHANNEL_NEXT_EVENT_FUNCTION(wanpipe_channel_next_event) event: - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_EVENT); - ftdmchan->last_event_time = 0; span->event_header.e_type = FTDM_EVENT_OOB; span->event_header.enum_id = event_id; commit a5d53b8a38b770f702fa55d72e996ed54a32f181 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Wed Nov 24 22:14:06 2010 -0200 freetdm: removed wrong main loop code diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 7c5f4a4..8a4a826 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -847,7 +847,7 @@ static int ftdm_r2_io_get_oob_event(openr2_chan_t *r2chan, openr2_oob_event_t *e *event = OR2_OOB_EVENT_NONE; status = ftdm_channel_read_event(ftdmchan, &fevent); if (status != FTDM_SUCCESS) { - //ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "failed to retrieve freetdm event!\n"); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "failed to retrieve freetdm event!\n"); return -1; } if (fevent->e_type != FTDM_EVENT_OOB) @@ -1412,33 +1412,11 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) r2call = R2CALL(ftdmchan); ftdmchan = openr2_chan_get_client_data(r2chan); - status = ftdm_channel_read_event(ftdmchan, &event); ftdm_mutex_lock(ftdmchan->mutex); - if (status == FTDM_SUCCESS) { - switch (event->enum_id) { - case FTDM_OOB_CAS_BITS_CHANGE: - { - ftdm_log(FTDM_LOG_DEBUG, "Handling CAS on channel %d.\n", i); - openr2_chan_process_cas_signaling(r2chan); - } - break; - case FTDM_OOB_ALARM_TRAP: - case FTDM_OOB_ALARM_CLEAR: - { - ftdm_log(FTDM_LOG_DEBUG, "OOB EVENT: %s\n", ftdm_signal_event2str(event->enum_id)); - openr2_chan_process_oob_events(r2chan); - } - break; - } - } - - if (!ftdm_r2_state_advance(ftdmchan)) { - ftdm_mutex_unlock(ftdmchan->mutex); - } + ftdm_r2_state_advance(ftdmchan); openr2_chan_process_signaling(r2chan); - if (!ftdm_r2_state_advance(ftdmchan)) { - ftdm_mutex_unlock(ftdmchan->mutex); - } + ftdm_r2_state_advance(ftdmchan); + ftdm_mutex_unlock(ftdmchan->mutex); } ftdm_span_trigger_signals(span); } commit 03dc3b7b8d734e5a916c0dd48c408e78e6f66f55 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Wed Nov 24 21:25:24 2010 -0200 freetdm: ftdm_channel_read_event() to retrieve events from a channel, removed from ftmod_r2: ftdm_r2_sig_read(), FTDM_R2_PROCESSING flag and locks for ftdmchan diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 64233a9..0065d77 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -988,6 +988,51 @@ FT_DECLARE(ftdm_status_t) ftdm_span_next_event(ftdm_span_t *span, ftdm_event_t * return status; } +FT_DECLARE(ftdm_status_t) ftdm_channel_read_event(ftdm_channel_t *ftdmchan, ftdm_event_t **event) +{ + ftdm_status_t status = FTDM_FAIL; + ftdm_sigmsg_t sigmsg; + ftdm_span_t *span = ftdmchan->span; + ftdm_assert_return(span->fio != NULL, FTDM_FAIL, "No I/O module attached to this span!\n"); + + if (!span->fio->channel_next_event) { + ftdm_log(FTDM_LOG_ERROR, "channel_next_event method not implemented in module %s!", span->fio->name); + return FTDM_NOTIMPL; + } + + status = span->fio->channel_next_event(ftdmchan, event); + if (status != FTDM_SUCCESS) { + return status; + } + + /* before returning the event to the user we do some core operations with certain OOB events */ + memset(&sigmsg, 0, sizeof(sigmsg)); + sigmsg.span_id = span->span_id; + sigmsg.chan_id = (*event)->channel->chan_id; + sigmsg.channel = (*event)->channel; + switch ((*event)->enum_id) { + case FTDM_OOB_ALARM_CLEAR: + { + sigmsg.event_id = FTDM_SIGEVENT_ALARM_CLEAR; + ftdm_clear_flag_locked((*event)->channel, FTDM_CHANNEL_IN_ALARM); + ftdm_span_send_signal(span, &sigmsg); + } + break; + case FTDM_OOB_ALARM_TRAP: + { + sigmsg.event_id = FTDM_SIGEVENT_ALARM_TRAP; + ftdm_set_flag_locked((*event)->channel, FTDM_CHANNEL_IN_ALARM); + ftdm_span_send_signal(span, &sigmsg); + } + break; + default: + /* NOOP */ + break; + } + + return status; +} + static ftdm_status_t ftdmchan_fsk_write_sample(int16_t *buf, ftdm_size_t buflen, void *user_data) { ftdm_channel_t *ftdmchan = (ftdm_channel_t *) user_data; diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 30de788..7c5f4a4 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -57,8 +57,7 @@ typedef enum { } ftdm_r2_flag_t; typedef enum { - FTDM_R2_PROCESSING = (1 << 0), - FTDM_R2_WAITING_ACK = (1 << 1), + FTDM_R2_WAITING_ACK = (1 << 0), } ftdm_r2_call_flag_t; /* private call information stored in ftdmchan->call_data void* ptr */ @@ -398,44 +397,26 @@ static ftdm_status_t ftdm_r2_stop(ftdm_span_t *span) return FTDM_SUCCESS; } -static ftdm_status_t ftdm_r2_sig_read(ftdm_channel_t *ftdmchan, void *data, ftdm_size_t size) -{ - openr2_chan_t *r2chan = R2CALL(ftdmchan)->r2chan; - if (!openr2_chan_get_read_enabled(r2chan)) { - ftdm_mutex_lock(ftdmchan->mutex); - //openr2_chan_process_input(r2chan, data, size); - ftdm_mutex_unlock(ftdmchan->mutex); - } - return FTDM_SUCCESS; -} - /* always called from the monitor thread */ static void ftdm_r2_on_call_init(openr2_chan_t *r2chan) { - //ftdm_status_t status; ftdm_r2_call_t *r2call; ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - //ftdm_r2_data_t *r2data = ftdmchan->span->signal_data; ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "Received request to start call\n"); - ftdm_mutex_lock(ftdmchan->mutex); - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)) { ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Cannot start call when channel is in use (state = %s)\n", ftdm_channel_state2str(ftdmchan->state)); - ftdm_mutex_unlock(ftdmchan->mutex); return; } if (ftdmchan->state != FTDM_CHANNEL_STATE_DOWN) { ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Cannot handle request to start call in state %s\n", ftdm_channel_state2str(ftdmchan->state)); - ftdm_mutex_unlock(ftdmchan->mutex); return; } if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to open channel during incoming call! [%s]\n", ftdmchan->last_error); - ftdm_mutex_unlock(ftdmchan->mutex); return; } @@ -448,7 +429,6 @@ static void ftdm_r2_on_call_init(openr2_chan_t *r2chan) /* clean the call data structure but keep the R2 processing flag on! */ ft_r2_clean_call(ftdmchan->call_data); r2call = R2CALL(ftdmchan); - ftdm_set_flag(r2call, FTDM_R2_PROCESSING); if (ftdmchan->state == FTDM_CHANNEL_STATE_DOWN) { R2CALL(ftdmchan)->chanstate = FTDM_CHANNEL_STATE_DOWN; @@ -457,7 +437,6 @@ static void ftdm_r2_on_call_init(openr2_chan_t *r2chan) } ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); - ftdm_mutex_unlock(ftdmchan->mutex); } /* only called for incoming calls when the ANI, DNIS etc is complete and the user has to decide either to accept or reject the call */ @@ -574,11 +553,8 @@ static void ftdm_r2_on_protocol_error(openr2_chan_t *r2chan, openr2_protocol_err ftdm_r2_data_t *r2data; ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - ftdm_mutex_lock(ftdmchan->mutex); - if (ftdmchan->state == FTDM_CHANNEL_STATE_DOWN) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Got protocol error when we're already down!\n"); - ftdm_mutex_unlock(ftdmchan->mutex); } ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Protocol error\n"); @@ -587,7 +563,6 @@ static void ftdm_r2_on_protocol_error(openr2_chan_t *r2chan, openr2_protocol_err if (!R2CALL(ftdmchan)->ftdm_started) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); - ftdm_mutex_unlock(ftdmchan->mutex); return; } @@ -602,8 +577,6 @@ static void ftdm_r2_on_protocol_error(openr2_chan_t *r2chan, openr2_protocol_err r2data = ftdmchan->span->signal_data; ftdm_span_send_signal(ftdmchan->span, &sigev); - - ftdm_mutex_unlock(ftdmchan->mutex); } static void ftdm_r2_on_line_blocked(openr2_chan_t *r2chan) @@ -867,9 +840,37 @@ static int ftdm_r2_io_setup(openr2_chan_t *r2chan) static int ftdm_r2_io_get_oob_event(openr2_chan_t *r2chan, openr2_oob_event_t *event) { - *event = 0; - ftdm_log(FTDM_LOG_ERROR, "I should not be called (I/O get oob event)!!\n"); - return 0; + ftdm_status_t status; + ftdm_event_t *fevent = NULL; + ftdm_channel_t *ftdmchan = openr2_chan_get_fd(r2chan); + + *event = OR2_OOB_EVENT_NONE; + status = ftdm_channel_read_event(ftdmchan, &fevent); + if (status != FTDM_SUCCESS) { + //ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "failed to retrieve freetdm event!\n"); + return -1; + } + if (fevent->e_type != FTDM_EVENT_OOB) + return 0; + switch (fevent->enum_id) { + case FTDM_OOB_CAS_BITS_CHANGE: + { + *event = OR2_OOB_EVENT_CAS_CHANGE; + } + break; + case FTDM_OOB_ALARM_TRAP: + { + *event = OR2_OOB_EVENT_ALARM_ON; + } + break; + case FTDM_OOB_ALARM_CLEAR: + { + *event = OR2_OOB_EVENT_ALARM_OFF; + } + break; + } + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "returning event: %s\n", ftdm_signal_event2str(*event)); + return 0; } static openr2_io_interface_t ftdm_r2_io_iface = { @@ -1137,7 +1138,7 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_r2_configure_span) span->start = ftdm_r2_start; span->stop = ftdm_r2_stop; - span->sig_read = ftdm_r2_sig_read; + span->sig_read = NULL; span->signal_cb = sig_cb; span->signal_type = FTDM_SIGTYPE_R2; @@ -1350,6 +1351,7 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) int ms; struct timeval start, end; short *poll_events = ftdm_malloc(sizeof(short)*span->chan_count); + ftdm_event_t *event = NULL; #ifdef __linux__ r2data->monitor_thread_id = syscall(SYS_gettid); @@ -1401,63 +1403,44 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) continue; } - if (FTDM_SUCCESS == status) { - ftdm_event_t *event; - while (ftdm_span_next_event(span, &event) == FTDM_SUCCESS) { - if (event->enum_id == FTDM_OOB_CAS_BITS_CHANGE) { - r2call = R2CALL(event->channel); - r2chan = r2call->r2chan; - - ftdm_log(FTDM_LOG_DEBUG, "Handling CAS on channel %d.\n", openr2_chan_get_number(r2chan)); - // we only expect CAS and other OOB events on this thread/loop, once a call is started - // the MF events (in-band signaling) are handled in the call thread - openr2_chan_process_cas_signaling(r2chan); - } else { - ftdm_log(FTDM_LOG_DEBUG, "Ignoring event %d on channel %d.\n", event->enum_id, openr2_chan_get_number(r2chan)); - // XXX TODO: handle alarms here XXX - } - } - - /* XXX - * when ftdm_span_poll_event() returns FTDM_SUCCESS, means there are events pending on the span. - * is it possible to know on which channels those events are pending, without traversing the span? - * XXX */ - for (i = 1; i <= span->chan_count; i++) { - r2chan = R2CALL(span->channels[i])->r2chan; - ftdmchan = openr2_chan_get_client_data(r2chan); - r2call = R2CALL(ftdmchan); - - ftdm_mutex_lock(ftdmchan->mutex); - ftdm_set_flag(r2call, FTDM_R2_PROCESSING); - - if (ftdm_r2_state_advance(ftdmchan)) { - ftdm_clear_flag(r2call, FTDM_R2_PROCESSING); - ftdm_mutex_unlock(ftdmchan->mutex); - continue; - } - - /* handle timeout events first if any */ - openr2_chan_run_schedule(r2chan); - - /* process mf tones, if any */ - if (openr2_chan_get_read_enabled(r2chan)) { - openr2_chan_process_mf_signaling(r2chan); - } + /* XXX + * when ftdm_span_poll_event() returns FTDM_SUCCESS, means there are events pending on the span. + * is it possible to know on which channels those events are pending, without traversing the span? + * XXX */ + for (i = 1; i <= span->chan_count; i++) { + r2chan = R2CALL(span->channels[i])->r2chan; + r2call = R2CALL(ftdmchan); + ftdmchan = openr2_chan_get_client_data(r2chan); - if (ftdm_r2_state_advance(ftdmchan)) { - ftdm_clear_flag(r2call, FTDM_R2_PROCESSING); - ftdm_mutex_unlock(ftdmchan->mutex); - continue; + status = ftdm_channel_read_event(ftdmchan, &event); + ftdm_mutex_lock(ftdmchan->mutex); + if (status == FTDM_SUCCESS) { + switch (event->enum_id) { + case FTDM_OOB_CAS_BITS_CHANGE: + { + ftdm_log(FTDM_LOG_DEBUG, "Handling CAS on channel %d.\n", i); + openr2_chan_process_cas_signaling(r2chan); + } + break; + case FTDM_OOB_ALARM_TRAP: + case FTDM_OOB_ALARM_CLEAR: + { + ftdm_log(FTDM_LOG_DEBUG, "OOB EVENT: %s\n", ftdm_signal_event2str(event->enum_id)); + openr2_chan_process_oob_events(r2chan); + } + break; } + } - ftdm_clear_flag(r2call, FTDM_R2_PROCESSING); + if (!ftdm_r2_state_advance(ftdmchan)) { + ftdm_mutex_unlock(ftdmchan->mutex); + } + openr2_chan_process_signaling(r2chan); + if (!ftdm_r2_state_advance(ftdmchan)) { ftdm_mutex_unlock(ftdmchan->mutex); } - } else if (status != FTDM_TIMEOUT) { - ftdm_log(FTDM_LOG_ERROR, "ftdm_span_poll_event returned %d.\n", status); } ftdm_span_trigger_signals(span); - ftdm_sleep(20); } for (i = 1; i <= span->chan_count; i++) { diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index c13455d..ae46852 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -35,6 +35,7 @@ * Moises Silva <moy@sangoma.com> * David Yat Sin <davidy@sangoma.com> * Nenad Corbic <ncorbic@sangoma.com> + * Arnaldo Pereira <arnaldo@sangoma.com> * */ @@ -99,7 +100,8 @@ static struct { /* a bunch of this stuff should go into the wanpipe_tdm_api_iface.h */ FIO_SPAN_POLL_EVENT_FUNCTION(wanpipe_poll_event); -FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_next_event); +FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_span_next_event); +FIO_CHANNEL_NEXT_EVENT_FUNCTION(wanpipe_channel_next_event); /** * \brief Poll for event on a wanpipe socket @@ -1111,12 +1113,187 @@ static FIO_GET_ALARMS_FUNCTION(wanpipe_get_alarms) } /** + * \brief Retrieves an event from a wanpipe channel + * \param channel Channel to retrieve event from + * \param event FreeTDM event to return + * \return Success or failure + */ +FIO_CHANNEL_NEXT_EVENT_FUNCTION(wanpipe_channel_next_event) +{ + ftdm_status_t status; + ftdm_oob_event_t event_id; + wanpipe_tdm_api_t tdm_api; + ftdm_span_t *span = ftdmchan->span; + + if (ftdmchan->last_event_time && !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_EVENT)) { + uint32_t diff = (uint32_t)(ftdm_current_time_in_ms() - ftdmchan->last_event_time); + /* XX printf("%u %u %u\n", diff, (unsigned)ftdm_current_time_in_ms(), (unsigned)ftdmchan->last_event_time); */ + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_WINK)) { + if (diff > wp_globals.wink_ms) { + ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_WINK); + ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_FLASH); + ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_OFFHOOK); + event_id = FTDM_OOB_OFFHOOK; + goto event; + } + } + + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_FLASH)) { + if (diff > wp_globals.flash_ms) { + ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_FLASH); + ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_WINK); + ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_OFFHOOK); + event_id = FTDM_OOB_ONHOOK; + + if (ftdmchan->type == FTDM_CHAN_TYPE_FXO) { + wanpipe_tdm_api_t tdm_api; + memset(&tdm_api, 0, sizeof(tdm_api)); + + sangoma_tdm_txsig_onhook(ftdmchan->sockfd,&tdm_api); + } + goto event; + } + } + } + + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_EVENT)) + return FTDM_FAIL; + + memset(&tdm_api, 0, sizeof(tdm_api)); + status = sangoma_tdm_read_event(ftdmchan->sockfd, &tdm_api); + if (status != FTDM_SUCCESS) { + snprintf(span->last_error, sizeof(span->last_error), "%s", strerror(errno)); + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to read event from channel: %s\n", strerror(errno)); + return FTDM_FAIL; + } + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "read wanpipe event %d\n", tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_type); + switch(tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_type) { + + case WP_TDMAPI_EVENT_LINK_STATUS: + { + switch(tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_link_status) { + case WP_TDMAPI_EVENT_LINK_STATUS_CONNECTED: + event_id = FTDM_OOB_ALARM_CLEAR; + break; + default: + event_id = FTDM_OOB_ALARM_TRAP; + break; + }; + } + break; + + case WP_TDMAPI_EVENT_RXHOOK: + { + if (ftdmchan->type == FTDM_CHAN_TYPE_FXS) { + event_id = tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_hook_state & WP_TDMAPI_EVENT_RXHOOK_OFF ? FTDM_OOB_OFFHOOK : FTDM_OOB_ONHOOK; + if (event_id == FTDM_OOB_OFFHOOK) { + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_FLASH)) { + ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_FLASH); + ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_WINK); + event_id = FTDM_OOB_FLASH; + goto event; + } else { + ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_WINK); + } + } else { + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_WINK)) { + ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_WINK); + ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_FLASH); + event_id = FTDM_OOB_WINK; + goto event; + } else { + ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_FLASH); + } + } + break; + } else { + wanpipe_tdm_api_t onhook_tdm_api; + memset(&onhook_tdm_api, 0, sizeof(onhook_tdm_api)); + status = sangoma_tdm_txsig_onhook(ftdmchan->sockfd, &onhook_tdm_api); + if (status) { + snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "ONHOOK Failed"); + return FTDM_FAIL; + } + event_id = onhook_tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_hook_state & WP_TDMAPI_EVENT_RXHOOK_OFF ? FTDM_OOB_ONHOOK : FTDM_OOB_NOOP; + } + } + break; + case WP_TDMAPI_EVENT_RING_DETECT: + { + event_id = tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_ring_state == WP_TDMAPI_EVENT_RING_PRESENT ? FTDM_OOB_RING_START : FTDM_OOB_RING_STOP; + } + break; + /* + disabled this ones when configuring, we don't need them, do we? + case WP_TDMAPI_EVENT_RING_TRIP_DETECT: + { + event_id = tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_ring_state == WP_TDMAPI_EVENT_RING_PRESENT ? FTDM_OOB_ONHOOK : FTDM_OOB_OFFHOOK; + } + break; + */ + case WP_TDMAPI_EVENT_RBS: + { + event_id = FTDM_OOB_CAS_BITS_CHANGE; + ftdmchan->rx_cas_bits = wanpipe_swap_bits(tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_rbs_bits); + } + break; + case WP_TDMAPI_EVENT_DTMF: + { + char tmp_dtmf[2] = { tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_dtmf_digit, 0 }; + event_id = FTDM_OOB_NOOP; + + if (tmp_dtmf[0] == 'f') { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Ignoring wanpipe DTMF: %c, fax tones will be passed through!\n", tmp_dtmf[0]); + break; + } + + if (tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_dtmf_type == WAN_EC_TONE_PRESENT) { + ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_MUTE); + } + + if (tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_dtmf_type == WAN_EC_TONE_STOP) { + ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_MUTE); + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)) { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Queuing wanpipe DTMF: %c\n", tmp_dtmf[0]); + ftdm_channel_queue_dtmf(ftdmchan, tmp_dtmf); + } + } + } + break; + case WP_TDMAPI_EVENT_ALARM: + { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Got wanpipe alarms %d\n", tdm_api.wp_tdm_cmd.event.wp_api_event_alarm); + event_id = FTDM_OOB_ALARM_TRAP; + } + break; + default: + { + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Unhandled wanpipe event %d\n", tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_type); + event_id = FTDM_OOB_INVALID; + } + break; + } + +event: + + ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_EVENT); + + ftdmchan->last_event_time = 0; + span->event_header.e_type = FTDM_EVENT_OOB; + span->event_header.enum_id = event_id; + span->event_header.channel = ftdmchan; + *event = &span->event_header; + return FTDM_SUCCESS; +} + +/** * \brief Retrieves an event from a wanpipe span * \param span Span to retrieve event from * \param event FreeTDM event to return * \return Success or failure */ -FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_next_event) +FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_span_next_event) { uint32_t i,err; ftdm_oob_event_t event_id; @@ -1348,7 +1525,8 @@ static FIO_IO_LOAD_FUNCTION(wanpipe_init) wanpipe_interface.read = wanpipe_read; wanpipe_interface.write = wanpipe_write; wanpipe_interface.poll_event = wanpipe_poll_event; - wanpipe_interface.next_event = wanpipe_next_event; + wanpipe_interface.next_event = wanpipe_span_next_event; + wanpipe_interface.channel_next_event = wanpipe_channel_next_event; wanpipe_interface.channel_destroy = wanpipe_channel_destroy; wanpipe_interface.get_alarms = wanpipe_get_alarms; *fio = &wanpipe_interface; diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 508c699..9ce213c 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -465,6 +465,7 @@ struct ftdm_memory_handler { #define FIO_SPAN_GET_SIG_STATUS_ARGS (ftdm_span_t *span, ftdm_signaling_status_t *status) #define FIO_SPAN_POLL_EVENT_ARGS (ftdm_span_t *span, uint32_t ms, short *poll_events) #define FIO_SPAN_NEXT_EVENT_ARGS (ftdm_span_t *span, ftdm_event_t **event) +#define FIO_CHANNEL_NEXT_EVENT_ARGS (ftdm_channel_t *ftdmchan, ftdm_event_t **event) #define FIO_SIGNAL_CB_ARGS (ftdm_sigmsg_t *sigmsg) #define FIO_EVENT_CB_ARGS (ftdm_channel_t *ftdmchan, ftdm_event_t *event) #define FIO_CONFIGURE_SPAN_ARGS (ftdm_span_t *span, const char *str, ftdm_chan_type_t type, char *name, char *number) @@ -496,6 +497,7 @@ typedef ftdm_status_t (*fio_span_set_sig_status_t) FIO_SPAN_SET_SIG_STATUS_ARGS; typedef ftdm_status_t (*fio_span_get_sig_status_t) FIO_SPAN_GET_SIG_STATUS_ARGS; typedef ftdm_status_t (*fio_span_poll_event_t) FIO_SPAN_POLL_EVENT_ARGS ; typedef ftdm_status_t (*fio_span_next_event_t) FIO_SPAN_NEXT_EVENT_ARGS ; +typedef ftdm_status_t (*fio_channel_next_event_t) FIO_CHANNEL_NEXT_EVENT_ARGS ; typedef ftdm_status_t (*fio_signal_cb_t) FIO_SIGNAL_CB_ARGS ; typedef ftdm_status_t (*fio_event_cb_t) FIO_EVENT_CB_ARGS ; typedef ftdm_status_t (*fio_configure_span_t) FIO_CONFIGURE_SPAN_ARGS ; @@ -528,6 +530,7 @@ typedef ftdm_status_t (*fio_api_t) FIO_API_ARGS ; #define FIO_SPAN_GET_SIG_STATUS_FUNCTION(name) ftdm_status_t name FIO_SPAN_GET_SIG_STATUS_ARGS #define FIO_SPAN_POLL_EVENT_FUNCTION(name) ftdm_status_t name FIO_SPAN_POLL_EVENT_ARGS #define FIO_SPAN_NEXT_EVENT_FUNCTION(name) ftdm_status_t name FIO_SPAN_NEXT_EVENT_ARGS +#define FIO_CHANNEL_NEXT_EVENT_FUNCTION(name) ftdm_status_t name FIO_CHANNEL_NEXT_EVENT_ARGS #define FIO_SIGNAL_CB_FUNCTION(name) ftdm_status_t name FIO_SIGNAL_CB_ARGS #define FIO_EVENT_CB_FUNCTION(name) ftdm_status_t name FIO_EVENT_CB_ARGS #define FIO_CONFIGURE_SPAN_FUNCTION(name) ftdm_status_t name FIO_CONFIGURE_SPAN_ARGS @@ -566,6 +569,7 @@ struct ftdm_io_interface { fio_write_t write; /*!< Write data to the channel */ fio_span_poll_event_t poll_event; /*!< Poll for events on the whole span */ fio_span_next_event_t next_event; /*!< Retrieve an event from the span */ + fio_channel_next_event_t channel_next_event; /*!< Retrieve an event from channel */ fio_api_t api; /*!< Execute a text command */ }; diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index 06f899c..7d3ee68 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -616,6 +616,23 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_chan(ftdm_channel_t *ftdmchan); FT_DECLARE(ftdm_status_t) ftdm_span_next_event(ftdm_span_t *span, ftdm_event_t **event); /*! + * \brief Retrieves an event from the span + * + * \note + * This function is non-reentrant and not thread-safe. + * The event returned may be modified if the function is called again + * from a different thread or even the same. It is recommended to + * handle events from the same span in a single thread. + * + * \param span The channel to retrieve the event from + * \param event Pointer to store the pointer to the event + * + * \retval FTDM_SUCCESS success (at least one event available) + * \retval FTDM_FAIL failure + */ +FT_DECLARE(ftdm_status_t) ftdm_channel_read_event(ftdm_channel_t *ftdmchan, ftdm_event_t **event); + +/*! * \brief Enqueue a DTMF string into the channel * * \param ftdmchan The channel to enqueue the dtmf string to commit b017931c5eb6ea4065060e9b7f22e28274c87c15 Author: Michael Jerris <mike@jerris.com> Date: Wed Nov 24 17:22:16 2010 -0500 add -lresolv when its present so modules don't have to link to it diff --git a/configure.in b/configure.in index de72612..77df2a6 100644 --- a/configure.in +++ b/configure.in @@ -373,6 +373,11 @@ if test "x$have_libz" = "xyes" ; then APR_ADDTO(SWITCH_AM_LDFLAGS, -lz) fi +AC_CHECK_LIB(resolv, res_init, have_libresolv=yes, have_libresolv=no) +if test "x$have_libresolv" = "xyes" ; then +APR_ADDTO(SWITCH_AM_LDFLAGS, -lresolv) +fi + ESL_LDFLAGS= PLATFORM_CORE_DEPLIBS= # tweak platform specific flags commit 8b61fe440031ae1c66729c3d9f611a91511c8c8e Author: Moises Silva <moy@sangoma.com> Date: Wed Nov 24 16:13:52 2010 -0500 mod_sangoma_codec: update sample config diff --git a/conf/autoload_configs/sangoma_codec.conf.xml b/conf/autoload_configs/sangoma_codec.conf.xml index 05d70de..eed9d67 100644 --- a/conf/autoload_configs/sangoma_codec.conf.xml +++ b/conf/autoload_configs/sangoma_codec.conf.xml @@ -4,14 +4,15 @@ <!-- Comma separated list of codecs to register with FreeSWITCH, by default (if this parameter is not set) all available codecs are registered. - Valid codec values are: PCMU,PCMA,L16,G729,G726-32,GSM + Valid codec values are: PCMU,PCMA,G729,G726-32,G722,GSM,G723,AMR,G7221,iLBC + If this parameter is not specified only G729 will be registered <param name="register" value="all"/> --> <!-- List of codecs to not register with FreeSWITCH, by default this is empty, but you may want to not load PCMU and PCMA or may be others to not use your - vocallo resources in codecs that are done well and fast in software. + resources in codecs that are done well and fast in software. <param name="noregister" value="PCMU,PCMA"/> --> commit a697462a589cab5f70e5608e33837bd6e4ada14c Author: Moises Silva <moy@sangoma.com> Date: Wed Nov 24 12:30:58 2010 -0500 freetdm: ftmod_libpri - Do not unlock the channel until all states pending have been cleared. This should fix issues with state transitions being ignored. diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 669e852..cf84dbe 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -727,15 +727,13 @@ static __inline__ void check_state(ftdm_span_t *span) for (j = 1; j <= ftdm_span_get_chan_count(span); j++) { ftdm_channel_t *chan = ftdm_span_get_channel(span, j); - if (ftdm_test_flag(chan, FTDM_CHANNEL_STATE_CHANGE)) { - ftdm_channel_lock(chan); - + ftdm_channel_lock(chan); + while (ftdm_test_flag(chan, FTDM_CHANNEL_STATE_CHANGE)) { ftdm_clear_flag(chan, FTDM_CHANNEL_STATE_CHANGE); state_advance(chan); ftdm_channel_complete_state(chan); - - ftdm_channel_unlock(chan); } + ftdm_channel_unlock(chan); } } } commit 17efb68d1d31deb7cc8d6fcabfc145e4d65da3f1 Author: Brian West <brian@freeswitch.org> Date: Wed Nov 24 10:53:01 2010 -0600 woops don't log reg twice diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 262aff1..216f808 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1140,8 +1140,10 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand if (auth_res != AUTH_OK && !stale) { if (sofia_test_pflag(profile, PFLAG_LOG_AUTH_FAIL)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SIP auth %s (REGISTER) on sofia profile '%s' " - "for [%s@%s] from ip %s\n", forbidden ? "failure" : "challenge", profile->name, to_user, to_host, network_ip); + if (regtype == REG_REGISTER) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SIP auth %s (REGISTER) on sofia profile '%s' " + "for [%s@%s] from ip %s\n", forbidden ? "failure" : "challenge", profile->name, to_user, to_host, network_ip); + } } if (profile->debug) { @@ -1150,13 +1152,10 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand } if (auth_res == AUTH_FORBIDDEN) { nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END()); - + /* Log line added to support Fail2Ban */ if (sofia_test_pflag(profile, PFLAG_LOG_AUTH_FAIL)) { - if (regtype == REG_REGISTER) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "SIP auth failure (REGISTER) on sofia profile '%s' " - "for [%s@%s] from ip %s\n", profile->name, to_user, to_host, network_ip); - } else if (regtype == REG_INVITE) { + if (regtype == REG_INVITE) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "SIP auth failure (INVITE) on sofia profile '%s' " "for [%s@%s] from ip %s\n", profile->name, to_user, to_host, network_ip); } commit d73cd50e99529ad9572b5d2892736db292d8367f Author: Brian West <brian@freeswitch.org> Date: Wed Nov 24 10:34:02 2010 -0600 sofia_reg.c lets make this fail2ban stuff better diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 7390378..262aff1 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1139,9 +1139,14 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand } if (auth_res != AUTH_OK && !stale) { + if (sofia_test_pflag(profile, PFLAG_LOG_AUTH_FAIL)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SIP auth %s (REGISTER) on sofia profile '%s' " + "for [%s@%s] from ip %s\n", forbidden ? "failure" : "challenge", profile->name, to_user, to_host, network_ip); + } + if (profile->debug) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send %s for [%s@%s] from ip '%s'\n", - forbidden ? "forbidden" : "challenge", to_user, to_host, network_ip); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send %s for [%s@%s]\n", + forbidden ? "forbidden" : "challenge", to_user, to_host); } if (auth_res == AUTH_FORBIDDEN) { nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END()); commit 6a948bd98bc29156774d09210fe07548fed3388b Author: Jeff Lenk <jeff@jefflenk.com> Date: Wed Nov 24 09:50:50 2010 -0600 add mono 2.8 patch file see FS-2774 diff --git a/src/mod/languages/mod_managed/mono28.patch b/src/mod/languages/mod_managed/mono28.patch new file mode 100644 index 0000000..7ec60f5 --- /dev/null +++ b/src/mod/languages/mod_managed/mono28.patch @@ -0,0 +1,75 @@ +diff --git a/src/mod/languages/mod_managed/Makefile b/src/mod/languages/mod_managed/Makefile +index 0ac49b4..ec44ff5 100644 +--- a/src/mod/languages/mod_managed/Makefile ++++ b/src/mod/languages/mod_managed/Makefile +@@ -1,6 +1,6 @@ +-LOCAL_INSERT_CFLAGS= /usr/bin/pkg-config mono --cflags +-LOCAL_INSERT_LDFLAGS= /usr/bin/pkg-config mono --libs +-#MOD_CFLAGS=-D_REENTRANT -pthread -I/opt/mono-1.9/lib/pkgconfig/../../include/mono-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -lmono ++LOCAL_INSERT_CFLAGS= /usr/bin/pkg-config mono-2 --cflags ++LOCAL_INSERT_LDFLAGS= /usr/bin/pkg-config mono-2 --libs ++#MOD_CFLAGS=-D_REENTRANT -pthread -I/usr/lib/mono -lmono + BASE=../../../.. + VERBOSE=1 + include $(BASE)/build/modmake.rules +diff --git a/src/mod/languages/mod_managed/freeswitch.i b/src/mod/languages/mod_managed/freeswitch.i +index ffbdf9b..117d58c 100644 +--- a/src/mod/languages/mod_managed/freeswitch.i ++++ b/src/mod/languages/mod_managed/freeswitch.i +@@ -8,7 +8,6 @@ + + /* Callback for returning strings to C# without leaking memory */ + #ifndef _MANAGED +-#include <glib.h> + #include <mono/jit/jit.h> + #include <mono/metadata/environment.h> + #include <mono/metadata/mono-config.h> +diff --git a/src/mod/languages/mod_managed/freeswitch_managed.h b/src/mod/languages/mod_managed/freeswitch_managed.h +index 1d0b6a7..13ffe5d 100644 +--- a/src/mod/languages/mod_managed/freeswitch_managed.h ++++ b/src/mod/languages/mod_managed/freeswitch_managed.h +@@ -40,7 +40,6 @@ typedef void (*hangupFunction) (void); + typedef char *(*inputFunction) (void *, switch_input_type_t); + + #ifndef _MANAGED +-#include <glib.h> + #include <mono/jit/jit.h> + #include <mono/metadata/assembly.h> + #include <mono/metadata/environment.h> +@@ -73,7 +72,7 @@ extern mod_managed_globals globals; + #ifdef WIN32 + #define RESULT_FREE(x) CoTaskMemFree(x) + #else +-#define RESULT_FREE(x) g_free(x) ++#define RESULT_FREE(x) mono_free(x) + #endif + + SWITCH_END_EXTERN_C +diff --git a/src/mod/languages/mod_managed/mod_managed.cpp b/src/mod/languages/mod_managed/mod_managed.cpp +index ec2d866..87e831f 100644 +--- a/src/mod/languages/mod_managed/mod_managed.cpp ++++ b/src/mod/languages/mod_managed/mod_managed.cpp +@@ -208,18 +208,13 @@ switch_status_t loadRuntime() + } + + /* Already loaded? */ +- MonoAssemblyName name; +- name.name = MOD_MANAGED_ASM_NAME; +- name.major = MOD_MANAGED_ASM_V1; +- name.minor = MOD_MANAGED_ASM_V2; +- name.revision = MOD_MANAGED_ASM_V3; +- name.build = MOD_MANAGED_ASM_V4; +- name.culture = ""; +- name.hash_value = ""; +- ++ MonoAssemblyName *name = mono_assembly_name_new (MOD_MANAGED_ASM_NAME); ++ //Note also that it can't be allocated on the stack anymore and you'll need to create and destroy it with the following API: ++ //mono_assembly_name_free (name); ++ + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Calling mono_assembly_loaded.\n"); + +- if (!(globals.mod_mono_asm = mono_assembly_loaded(&name))) { ++ if (!(globals.mod_mono_asm = mono_assembly_loaded(name))) { + /* Open the assembly */ + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Calling mono_domain_assembly_open.\n"); + globals.mod_mono_asm = mono_domain_assembly_open(globals.domain, filename); commit 4bdcebde822e58c9a5a15598619cbdfd87133a18 Merge: ab246b9 473a046 Author: Moises Silva <moy@sangoma.com> Date: Wed Nov 24 09:30:42 2010 -0500 Merge branch 'master' into netborder commit 473a04651c3971883cc413b1ee53f4c1ee3135ce Author: Moises Silva <moy@sangoma.com> Date: Wed Nov 24 09:28:34 2010 -0500 freetdm: add missing string for SIGEVENT_RELEASED diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index dc181e1..508c699 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -301,7 +301,7 @@ typedef enum { FTDM_SIGEVENT_COLLISION, /*!< Outgoing call was dropped because an incoming call arrived at the same time */ FTDM_SIGEVENT_INVALID } ftdm_signal_event_t; -#define SIGNAL_STRINGS "START", "STOP", "UP", "FLASH", "PROGRESS", \ +#define SIGNAL_STRINGS "START", "STOP", "RELEASED", "UP", "FLASH", "PROGRESS", \ "PROGRESS_MEDIA", "ALARM_TRAP", "ALARM_CLEAR", \ "COLLECTED_DIGIT", "ADD_CALL", "RESTART", "SIGSTATUS_CHANGED", "COLLISION", "INVALID" commit e82828231e7634a06d0230df865bbcf5496f57b7 Author: Travis Cross <tc@traviscross.com> Date: Wed Nov 24 06:07:21 2010 +0000 spelling corrections diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index a1f13ed..d6bce5e 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -179,8 +179,8 @@ SWITCH_DECLARE(void) switch_channel_uninit(switch_channel_t *channel); SWITCH_DECLARE(void) switch_channel_set_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile); /*! - \brief Retrive the given channel's caller profile - \param channel channel to retrive the profile from + \brief Retrieve the given channel's caller profile + \param channel channel to retrieve the profile from \return the requested profile */ SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_caller_profile(switch_channel_t *channel); @@ -195,8 +195,8 @@ SWITCH_DECLARE(void) switch_channel_set_originator_caller_profile(switch_channel SWITCH_DECLARE(void) switch_channel_set_hunt_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile); /*! - \brief Retrive the given channel's originator caller profile - \param channel channel to retrive the profile from + \brief Retrieve the given channel's originator caller profile + \param channel channel to retrieve the profile from \return the requested profile */ SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_originator_caller_profile(switch_channel_t *channel); @@ -209,8 +209,8 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_originator_caller_p SWITCH_DECLARE(void) switch_channel_set_originatee_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile); /*! - \brief Retrive the given channel's originatee caller profile - \param channel channel to retrive the profile from + \brief Retrieve the given channel's originatee caller profile + \param channel channel to retrieve the profile from \return the requested profile */ SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_originatee_caller_profile(switch_channel_t *channel); @@ -223,16 +223,16 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_originatee_caller_p SWITCH_DECLARE(void) switch_channel_set_origination_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile); /*! - \brief Retrive the given channel's origination caller profile - \param channel channel to retrive the profile from + \brief Retrieve the given channel's origination caller profile + \param channel channel to retrieve the profile from \return the requested profile */ SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_origination_caller_profile(switch_channel_t *channel); /*! - \brief Retrive the given channel's unique id - \param channel channel to retrive the unique id from + \brief Retrieve the given channel's unique id + \param channel channel to retrieve the unique id from \return the unique id */ SWITCH_DECLARE(char *) switch_channel_get_uuid(switch_channel_t *channel); @@ -241,7 +241,7 @@ SWITCH_DECLARE(char *) switch_channel_get_uuid(switch_channel_t *channel); \brief Set a variable on a given channel \param channel channel to set variable on \param varname the name of the variable - \param value the vaule of the variable + \param value the value of the variable \returns SWITCH_STATUS_SUCCESS if successful */ commit 89245dc5a1f6c4938fff0d760c4660e0bf7974c5 Author: Travis Cross <tc@traviscross.com> Date: Wed Nov 24 03:58:22 2010 +0000 remove ignored file from tree diff --git a/libs/libsndfile/M4/lt~obsolete.m4 b/libs/libsndfile/M4/lt~obsolete.m4 deleted file mode 100644 index c573da9..0000000 --- a/libs/libsndfile/M4/lt~obsolete.m4 +++ /dev/null @@ -1,98 +0,0 @@ -# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- -# -# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. -# Written by Scott James Remnant, 2004. -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 5 lt~obsolete.m4 - -# These exist entirely to fool aclocal when bootstrapping libtool. -# -# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) -# which have later been changed to m4_define as they aren't part of the -# exported API, or moved to Autoconf or Automake where they belong. -# -# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN -# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us -# using a macro with the same name in our local m4/libtool.m4 it'll -# pull the old libtool.m4 in (it doesn't see our shiny new m4_define -# and doesn't know about Autoconf macros at all.) -# -# So we provide this file, which has a silly filename so it's always -# included after everything else. This provides aclocal with the -# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything -# because those macros already exist, or will be overwritten later. -# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. -# -# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. -# Yes, that means every name once taken will need to remain here until -# we give up compatibility with versions before 1.7, at which point -# we need to keep only those names which we still refer to. - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) - -m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) -m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) -m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) -m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) -m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) -m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) -m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) -m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) -m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) -m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) -m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) -m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) -m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) -m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) -m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) -m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) -m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) -m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) -m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) -m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) -m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) -m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) -m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) -m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) -m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) -m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) -m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) -m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) -m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) -m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) -m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) -m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) -m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) -m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) -m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) -m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) -m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) -m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) -m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) -m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) -m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) -m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) -m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) -m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) -m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) -m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) -m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) -m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) -m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) -m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) -m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) -m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) -m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) commit 364c156cdc3f078ba423208bc5c6bf0af85a471c Author: Travis Cross <tc@traviscross.com> Date: Wed Nov 24 03:46:06 2010 +0000 update .gitignore diff --git a/.gitignore b/.gitignore index adcfda3..304b42c 100644 --- a/.gitignore +++ b/.gitignore @@ -70,10 +70,12 @@ config.status configure.lineno /freeswitch /fs_cli +/fs_encode /fs_ivrd /libtool /modules.conf /quiet_libtool +/tone2wav /scripts/fsxs /scripts/gentls_cert /a.out.dSYM diff --git a/src/mod/.gitignore b/src/mod/.gitignore index 47cdbaf..b6e7842 100644 --- a/src/mod/.gitignore +++ b/src/mod/.gitignore @@ -7,6 +7,7 @@ /applications/mod_spandsp/mod_spandsp.log /applications/mod_commands/Makefile /applications/mod_conference/Makefile +/applications/mod_db/Makefile /applications/mod_dptools/Makefile /applications/mod_enum/Makefile /applications/mod_enum/Makefile.in commit 61bc810bf8f252bb33946cb23a8d66a78036569b Author: Michael S Collins <msc@freeswitch.org> Date: Tue Nov 23 17:17:46 2010 -0800 Fix usage formatting in logger.pl diff --git a/libs/esl/perl/logger.pl b/libs/esl/perl/logger.pl index d0dbb17..08213c0 100644 --- a/libs/esl/perl/logger.pl +++ b/libs/esl/perl/logger.pl @@ -17,13 +17,13 @@ my $USAGE = " FreeSWITCH Logger Utility USAGE: --h --helpThis help +-h --help This help -p --port <port> Choose port -P -pass <pass> Choose password -f --file <file> Output file -pb --paste-bin <name> Post to FreeSWITCH Paste Bin -sp --sip-profiles <list> List of SIP profiles to trace --sd --sip-debug <level> Set SIP debug level +-sd --sip-debug <level> Set SIP debug level No arguments given will trace profile 'internal' to STDOUT "; commit dad92067daa6d882a640cccfbf503ec2f800085d Author: Brian West <brian@freeswitch.org> Date: Tue Nov 23 18:35:45 2010 -0600 FS-535: fix issue in is_lan_addr where 172.2 would match 172.250.x.x which is not RFC1918 this also fixes an chicken egg issue diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 4d992b0..4d9bd7f 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2173,7 +2173,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag) register_host = sofia_glue_get_register_host(gateway->register_proxy); - if (register_host && !sofia_glue_check_nat(profile, register_host)) { + if (register_host && switch_is_lan_addr(register_host)) { sipip = profile->sipip; } diff --git a/src/switch_utils.c b/src/switch_utils.c index 75be02a..1a29e2b 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -726,18 +726,31 @@ SWITCH_DECLARE(switch_bool_t) switch_is_lan_addr(const char *ip) if (zstr(ip)) return SWITCH_FALSE; - return (strncmp(ip, "10.", 3) && - strncmp(ip, "192.168.", 8) && - strncmp(ip, "127.", 4) && + return (strncmp(ip, "10.", 3) && /* 10.0.0.0 - 10.255.255.255 (10/8 prefix) */ + strncmp(ip, "192.168.", 8) && /* 192.168.0.0 - 192.168.255.255 (192.168/16 prefix) */ + strncmp(ip, "127.", 4) && /* 127.0.0.0 - 127.255.255.255 (127/8 prefix) */ strncmp(ip, "255.", 4) && - strncmp(ip, "0.", 2) && + strncmp(ip, "0.", 2) && strncmp(ip, "1.", 2) && strncmp(ip, "2.", 2) && - strncmp(ip, "172.16.", 7) && + strncmp(ip, "172.16.", 7) && /* 172.16.0.0 - 172.31.255.255 (172.16/12 prefix) */ strncmp(ip, "172.17.", 7) && strncmp(ip, "172.18.", 7) && strncmp(ip, "172.19.", 7) && - strncmp(ip, "172.2", 5) && strncmp(ip, "172.30.", 7) && strncmp(ip, "172.31.", 7) && strncmp(ip, "192.0.2.", 8) && strncmp(ip, "169.254.", 8) + strncmp(ip, "172.20.", 7) && + strncmp(ip, "172.21.", 7) && + strncmp(ip, "172.22.", 7) && + strncmp(ip, "172.23.", 7) && + strncmp(ip, "172.24.", 7) && + strncmp(ip, "172.25.", 7) && + strncmp(ip, "172.26.", 7) && + strncmp(ip, "172.27.", 7) && + strncmp(ip, "172.28.", 7) && + strncmp(ip, "172.29.", 7) && + strncmp(ip, "172.30.", 7) && + strncmp(ip, "172.31.", 7) && + strncmp(ip, "192.0.2.", 8) && /* 192.0.2.0 - 192.0.2.255 (192.0.2/24 prefix) */ + strncmp(ip, "169.254.", 8) /* 169.254.0.0 - 169.254.255.255 (169.254/16 prefix) */ )? SWITCH_FALSE : SWITCH_TRUE; } commit 0bd8d187e0a58c708667416f63f30e30c344c295 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Nov 23 18:03:56 2010 -0600 clear controlled flag on recovered calls diff --git a/src/switch_ivr.c b/src/switch_ivr.c index f076f6c..df88451 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -763,6 +763,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session, write_frame.samples = write_frame.datalen / sizeof(int16_t); } + if (switch_channel_test_flag(channel, CF_RECOVERED) && switch_channel_test_flag(channel, CF_CONTROLLED)) { + switch_channel_clear_flag(channel, CF_CONTROLLED); + } + if (switch_channel_test_flag(channel, CF_CONTROLLED)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot park channels that are under control already.\n"); return SWITCH_STATUS_FALSE; commit ab246b9b58e1b1f1b511514511ea3ba49c1d94af Author: David Yat Sin <dyatsin@sangoma.com> Date: Tue Nov 23 17:41:40 2010 -0500 freetdm: ISDN - Added pendingsignals to list of interrupts in span poll thread diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index cb96107..77ad917 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -370,7 +370,7 @@ static void *ftdm_sangoma_isdn_dchan_run(ftdm_thread_t *me, void *obj) static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj) { - ftdm_interrupt_t *ftdm_sangoma_isdn_int[2]; + ftdm_interrupt_t *ftdm_sangoma_isdn_int[3]; ftdm_status_t ret_status; ftdm_span_t *span = (ftdm_span_t *) obj; ftdm_channel_t *ftdmchan = NULL; @@ -388,8 +388,13 @@ static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj) ftdm_log(FTDM_LOG_CRIT, "%s:Failed to get a ftdm_interrupt for span = %s!\n", span->name); goto ftdm_sangoma_isdn_run_exit; } + + if (ftdm_queue_get_interrupt(span->pendingsignals, &ftdm_sangoma_isdn_int[1]) != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_CRIT, "%s:Failed to get a signal interrupt for span = %s!\n", span->name); + goto ftdm_sangoma_isdn_run_exit; + } - if (ftdm_queue_get_interrupt(signal_data->event_queue, &ftdm_sangoma_isdn_int[1]) != FTDM_SUCCESS) { + if (ftdm_queue_get_interrupt(signal_data->event_queue, &ftdm_sangoma_isdn_int[2]) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_CRIT, "%s:Failed to get a event interrupt for span = %s!\n", span->name); goto ftdm_sangoma_isdn_run_exit; } @@ -398,8 +403,14 @@ static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj) /* Check if there are any timers to process */ ftdm_sched_run(signal_data->sched); + ftdm_span_trigger_signals(span); - ret_status = ftdm_interrupt_multiple_wait(ftdm_sangoma_isdn_int, 2, sleep); + if (ftdm_sched_get_time_to_next_timer(signal_data->sched, &sleep) == FTDM_SUCCESS) { + if (sleep < 0 || sleep > SNGISDN_EVENT_POLL_RATE) { + sleep = SNGISDN_EVENT_POLL_RATE; + } + } + ret_status = ftdm_interrupt_multiple_wait(ftdm_sangoma_isdn_int, 3, sleep); /* find out why we returned from the interrupt queue */ switch (ret_status) { case FTDM_SUCCESS: /* there was a state change on the span */ @@ -415,7 +426,6 @@ static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj) ftdm_sangoma_isdn_process_stack_event(span, sngisdn_event); ftdm_safe_free(sngisdn_event); } - ftdm_span_trigger_signals(span); break; case FTDM_TIMEOUT: /* twiddle */ @@ -431,13 +441,6 @@ static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj) /* Poll for events, e.g HW DTMF */ ftdm_sangoma_isdn_poll_events(span); - ftdm_span_trigger_signals(span); - - if (ftdm_sched_get_time_to_next_timer(signal_data->sched, &sleep) == FTDM_SUCCESS) { - if (sleep < 0 || sleep > SNGISDN_EVENT_POLL_RATE) { - sleep = SNGISDN_EVENT_POLL_RATE; - } - } } /* clear the IN_THREAD flag so that we know the thread is done */ commit 1526f83c091a549bd758b86b2237500e88db70e5 Merge: 9f183fa c059649 Author: David Yat Sin <dyatsin@sangoma.com> Date: Tue Nov 23 17:48:16 2010 -0500 Merge branch 'master' of git.sangoma.com:smg_freeswitch commit 9f183fa4b15ec9e5d2249f5da63dc2af3a25d9d2 Author: David Yat Sin <dyatsin@sangoma.com> Date: Tue Nov 23 17:41:40 2010 -0500 freetdm: ISDN - Added pendingsignals to list of interrupts in span poll thread diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index cb96107..77ad917 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -370,7 +370,7 @@ static void *ftdm_sangoma_isdn_dchan_run(ftdm_thread_t *me, void *obj) static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj) { - ftdm_interrupt_t *ftdm_sangoma_isdn_int[2]; + ftdm_interrupt_t *ftdm_sangoma_isdn_int[3]; ftdm_status_t ret_status; ftdm_span_t *span = (ftdm_span_t *) obj; ftdm_channel_t *ftdmchan = NULL; @@ -388,8 +388,13 @@ static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj) ftdm_log(FTDM_LOG_CRIT, "%s:Failed to get a ftdm_interrupt for span = %s!\n", span->name); goto ftdm_sangoma_isdn_run_exit; } + + if (ftdm_queue_get_interrupt(span->pendingsignals, &ftdm_sangoma_isdn_int[1]) != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_CRIT, "%s:Failed to get a signal interrupt for span = %s!\n", span->name); + goto ftdm_sangoma_isdn_run_exit; + } - if (ftdm_queue_get_interrupt(signal_data->event_queue, &ftdm_sangoma_isdn_int[1]) != FTDM_SUCCESS) { + if (ftdm_queue_get_interrupt(signal_data->event_queue, &ftdm_sangoma_isdn_int[2]) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_CRIT, "%s:Failed to get a event interrupt for span = %s!\n", span->name); goto ftdm_sangoma_isdn_run_exit; } @@ -398,8 +403,14 @@ static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj) /* Check if there are any timers to process */ ftdm_sched_run(signal_data->sched); + ftdm_span_trigger_signals(span); - ret_status = ftdm_interrupt_multiple_wait(ftdm_sangoma_isdn_int, 2, sleep); + if (ftdm_sched_get_time_to_next_timer(signal_data->sched, &sleep) == FTDM_SUCCESS) { + if (sleep < 0 || sleep > SNGISDN_EVENT_POLL_RATE) { + sleep = SNGISDN_EVENT_POLL_RATE; + } + } + ret_status = ftdm_interrupt_multiple_wait(ftdm_sangoma_isdn_int, 3, sleep); /* find out why we returned from the interrupt queue */ switch (ret_status) { case FTDM_SUCCESS: /* there was a state change on the span */ @@ -415,7 +426,6 @@ static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj) ftdm_sangoma_isdn_process_stack_event(span, sngisdn_event); ftdm_safe_free(sngisdn_event); } - ftdm_span_trigger_signals(span); break; case FTDM_TIMEOUT: /* twiddle */ @@ -431,13 +441,6 @@ static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj) /* Poll for events, e.g HW DTMF */ ftdm_sangoma_isdn_poll_events(span); - ftdm_span_trigger_signals(span); - - if (ftdm_sched_get_time_to_next_timer(signal_data->sched, &sleep) == FTDM_SUCCESS) { - if (sleep < 0 || sleep > SNGISDN_EVENT_POLL_RATE) { - sleep = SNGISDN_EVENT_POLL_RATE; - } - } } /* clear the IN_THREAD flag so that we know the thread is done */ commit 58c28aabc8c0ef3cd00087dbd67640cc85d34a71 Author: Mathieu Rene <mrene@avgs.ca> Date: Tue Nov 23 17:26:32 2010 -0500 mod_dingaling: use the login as message source when not in component mode. (chat_send) diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index 480f2bd..75329a0 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -514,8 +514,13 @@ static switch_status_t chat_send(const char *proto, const char *from, const char from = hint; } else { char *p; - ffrom = switch_mprintf("%s+%s", proto, from); - from = ffrom; + + if (!(profile->user_flags & LDL_FLAG_COMPONENT)) { + from = ffrom = strdup(profile->login); + } else { + from = ffrom = switch_mprintf("%s+%s", proto, from); + } + if ((p = strchr(from, '/'))) { *p = '\0'; } commit 6e07995bee1b75c3d7f9e87baf2bb5377fdfee20 Author: Moises Silva <moy@sangoma.com> Date: Tue Nov 23 17:00:24 2010 -0500 freetdm: check alarm status when starting the span diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 64233a9..31a585e 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -4585,6 +4585,14 @@ FT_DECLARE(ftdm_status_t) ftdm_configure_span_signaling(ftdm_span_t *span, const FT_DECLARE(ftdm_status_t) ftdm_span_start(ftdm_span_t *span) { if (span->start) { + /* check the alarms again before starting the signaling module + this works-around some I/O modules (netborder I/O module) that cannot + check the alarm status before during configuration because the spans are + not really started yet at the I/O level */ + if (ftdm_set_channels_alarms(span, 0) != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_ERROR, "%d: Failed to set channel alarms\n", span->span_id); + return FTDM_FAIL; + } return span->start(span); } commit eb109a85d5b54b47e54567893cd714b857865984 Author: Mathieu Rene <mrene@avgs.ca> Date: Tue Nov 23 17:00:08 2010 -0500 mod_dingaling: fix leak in chat_send diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index f5d515c..480f2bd 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -521,6 +521,7 @@ static switch_status_t chat_send(const char *proto, const char *from, const char } } ldl_handle_send_msg(profile->handle, (char *) from, (char *) to, NULL, switch_str_nil(body)); + switch_safe_free(ffrom); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Profile %s\n", f_host ? f_host : "NULL"); return SWITCH_STATUS_FALSE; commit 72710484b55f3dfe7c759c318dfd131d6c7542e3 Merge: e1e8417 c059649 Author: Moises Silva <moy@sangoma.com> Date: Tue Nov 23 16:52:43 2010 -0500 Merge branch 'master' into netborder commit 10cb487cb02917dfb563872a8146a67af88b20d9 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Nov 23 15:50:17 2010 -0600 FS-2868 diff --git a/src/mod/applications/mod_hash/mod_hash.c b/src/mod/applications/mod_hash/mod_hash.c index 29a0561..2609b6c 100644 --- a/src/mod/applications/mod_hash/mod_hash.c +++ b/src/mod/applications/mod_hash/mod_hash.c @@ -130,7 +130,7 @@ SWITCH_LIMIT_INCR(limit_incr_hash) { switch_channel_t *channel = switch_core_session_get_channel(session); char *hashkey = NULL; - switch_bool_t status = SWITCH_STATUS_SUCCESS; + switch_status_t status = SWITCH_STATUS_SUCCESS; limit_hash_item_t *item = NULL; time_t now = switch_epoch_time_now(NULL); limit_hash_private_t *pvt = NULL; commit c059649f8f9d812ec284150f410c0a6d0c77b2d7 Author: Moises Silva <moy@sangoma.com> Date: Tue Nov 23 16:27:40 2010 -0500 freetdm: only notify of released channels when is a voice channel diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 24e5457..64233a9 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2349,8 +2349,6 @@ static void close_dtmf_debug(ftdm_channel_t *ftdmchan) static ftdm_status_t ftdm_channel_clear_vars(ftdm_channel_t *ftdmchan); FT_DECLARE(ftdm_status_t) ftdm_channel_done(ftdm_channel_t *ftdmchan) { - ftdm_sigmsg_t sigmsg; - ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "Null channel can't be done!\n"); ftdm_mutex_lock(ftdmchan->mutex); @@ -2389,12 +2387,15 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_done(ftdm_channel_t *ftdmchan) ftdm_log(FTDM_LOG_DEBUG, "channel done %u:%u\n", ftdmchan->span_id, ftdmchan->chan_id); - memset(&sigmsg, 0, sizeof(sigmsg)); - sigmsg.span_id = ftdmchan->span_id; - sigmsg.chan_id = ftdmchan->chan_id; - sigmsg.channel = ftdmchan; - sigmsg.event_id = FTDM_SIGEVENT_RELEASED; - ftdm_span_send_signal(ftdmchan->span, &sigmsg); + if (FTDM_IS_VOICE_CHANNEL(ftdmchan)) { + ftdm_sigmsg_t sigmsg; + memset(&sigmsg, 0, sizeof(sigmsg)); + sigmsg.span_id = ftdmchan->span_id; + sigmsg.chan_id = ftdmchan->chan_id; + sigmsg.channel = ftdmchan; + sigmsg.event_id = FTDM_SIGEVENT_RELEASED; + ftdm_span_send_signal(ftdmchan->span, &sigmsg); + } ftdm_mutex_unlock(ftdmchan->mutex); commit e1e8417fde16bef30a79d96ed556d6ce986d17c4 Merge: 05b3b32 2f08cb6 Author: Moises Silva <moy@sangoma.com> Date: Tue Nov 23 15:57:49 2010 -0500 Merge branch 'master' into netborder commit 2f08cb6ad0ea966ac51e62d7f8dae8ef1d5088ed Merge: ce67a4d 4a6be54 Author: Moises Silva <moy@sangoma.com> Date: Tue Nov 23 15:51:05 2010 -0500 Merge branch 'master' of git.sangoma.com:smg_freeswitch commit ce67a4d39b995398cb9899b5b4152560a48b45f8 Author: Moises Silva <moy@sangoma.com> Date: Tue Nov 23 15:49:50 2010 -0500 freetdm: do not flush events queue on channel start diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index eb42207..c13455d 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -333,8 +333,8 @@ static unsigned wp_open_range(ftdm_span_t *span, unsigned spanno, unsigned start ftdm_log(FTDM_LOG_ERROR, "Failed to enable RBS/CAS events in device %d:%d fd:%d\n", chan->span_id, chan->chan_id, sockfd); continue; } - /* probably done by the driver but lets write defensive code this time */ sangoma_flush_bufs(chan->sockfd, &tdm_api); + sangoma_flush_event_bufs(chan->sockfd, &tdm_api); #else /* * With wanpipe 3.4.4.2 I get failure even though the events are enabled, /var/log/messages said: @@ -514,9 +514,6 @@ static FIO_OPEN_FUNCTION(wanpipe_open) memset(&tdm_api,0,sizeof(tdm_api)); sangoma_tdm_flush_bufs(ftdmchan->sockfd, &tdm_api); -#ifdef LIBSANGOMA_VERSION - sangoma_flush_event_bufs(ftdmchan->sockfd, &tdm_api); -#endif if (ftdmchan->type == FTDM_CHAN_TYPE_DQ921 || ftdmchan->type == FTDM_CHAN_TYPE_DQ931) { ftdmchan->native_codec = ftdmchan->effective_codec = FTDM_CODEC_NONE; commit 4a6be5477aaf72d732292b50674ce2d83947e8fd Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Tue Nov 23 17:29:58 2010 -0200 freetdm: updated libopenr2 dll name on ftmod_r2 msvc dependency diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2008.vcproj b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2008.vcproj index 9ea351b..8942a8f 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2008.vcproj +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2008.vcproj @@ -60,9 +60,9 @@ /> <Tool Name="VCLinkerTool" - AdditionalDependencies="freetdm.lib openr2.lib" + AdditionalDependencies="freetdm.lib libopenr2.lib" LinkIncremental="2" - AdditionalLibraryDirectories=""C:\Program Files\openr2\lib";"$(OutDir)"" + AdditionalLibraryDirectories=""$(OutDir)";"C:\Program Files\openr2\lib"" GenerateDebugInformation="true" SubSystem="2" TargetMachine="1" commit 05b3b327a4e89a410ad8e4f50fe8790a2942cbb3 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Tue Nov 23 17:29:58 2010 -0200 freetdm: updated libopenr2 dll name on ftmod_r2 msvc dependency diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2008.vcproj b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2008.vcproj index 9ea351b..8942a8f 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2008.vcproj +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2008.vcproj @@ -60,9 +60,9 @@ /> <Tool Name="VCLinkerTool" - AdditionalDependencies="freetdm.lib openr2.lib" + AdditionalDependencies="freetdm.lib libopenr2.lib" LinkIncremental="2" - AdditionalLibraryDirectories=""C:\Program Files\openr2\lib";"$(OutDir)"" + AdditionalLibraryDirectories=""$(OutDir)";"C:\Program Files\openr2\lib"" GenerateDebugInformation="true" SubSystem="2" TargetMachine="1" commit 21c2a74840ee5413b822b254786310a14f2100f2 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Nov 23 13:18:50 2010 -0600 uncomment diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index dc02ca4..4b853de 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1616,7 +1616,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * } - /* commenting to test + if (helper->event){ const char *uuid = switch_event_get_header_nil(helper->event, "unique-id"); @@ -1625,7 +1625,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE); } } - */ + nua_handle_bind(nh, &mod_sofia_globals.keep_private); commit 8966b4ba6e84f54b8b8262d5cf30a65b686c136e Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Nov 23 10:07:07 2010 -0600 FS-2867 diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index 7558e1b..f5d515c 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -602,7 +602,7 @@ static void ipchanged_event_handler(switch_event_t *event) for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) { switch_hash_this(hi, NULL, NULL, &val); profile = (mdl_profile_t *) val; - if (old_ip4 && !strcmp(profile->extip, old_ip4)) { + if (old_ip4 && profile->extip && !strcmp(profile->extip, old_ip4)) { tmp = profile->extip; profile->extip = strdup(new_ip4); switch_safe_free(tmp); commit 2f2ebb73c94dbe4e79a032f8937781fc30e53de4 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Tue Nov 23 14:55:59 2010 -0200 freetdm: made ftmod_r2 use FTDM_SPAN_USE_SIGNALS_QUEUE and properly send FTDM_SIGEVENT_SIGSTATUS_CHANGED diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index a410e4e..73f5660 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -2028,6 +2028,14 @@ static FIO_SIGNAL_CB_FUNCTION(on_r2_signal) } break; + case FTDM_SIGEVENT_SIGSTATUS_CHANGED: + { + ftdm_signaling_status_t sigstatus = sigmsg->raw_data ? *((ftdm_signaling_status_t*)(sigmsg->raw_data)) : sigmsg->sigstatus; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%d:%d signalling changed to: %s\n", + spanid, chanid, ftdm_signaling_status2str(sigstatus)); + } + break; + default: { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unhandled event %d from R2 for channel %d:%d\n", diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index d534481..30de788 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -220,6 +220,23 @@ static char *strsep(char **stringp, const char *delim) } #endif /* WIN32 */ +static void ftdm_r2_set_chan_sig_status(ftdm_channel_t *ftdmchan, ftdm_signaling_status_t status) +{ + ftdm_sigmsg_t sig; + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Signalling link status changed to %s\n", ftdm_signaling_status2str(status)); + + memset(&sig, 0, sizeof(sig)); + sig.chan_id = ftdmchan->chan_id; + sig.span_id = ftdmchan->span_id; + sig.channel = ftdmchan; + sig.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; + sig.sigstatus = status; + if (ftdm_span_send_signal(ftdmchan->span, &sig) != FTDM_SUCCESS) { + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to change channel status to %s\n", ftdm_signaling_status2str(status)); + } + return; +} + static ftdm_call_cause_t ftdm_r2_cause_to_ftdm_cause(ftdm_channel_t *fchan, openr2_call_disconnect_cause_t cause) { switch (cause) { @@ -593,17 +610,14 @@ static void ftdm_r2_on_line_blocked(openr2_chan_t *r2chan) { ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Far end blocked in state %s\n", ftdm_channel_state2str(ftdmchan->state)); - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_SUSPENDED); + ftdm_r2_set_chan_sig_status(ftdmchan, FTDM_SIG_STATE_SUSPENDED); } static void ftdm_r2_on_line_idle(openr2_chan_t *r2chan) { ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Far end unblocked in state %s\n", ftdm_channel_state2str(ftdmchan->state)); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_SUSPENDED); - - /* XXX when should we set/unset this flag? XXX */ - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_SIG_UP); + ftdm_r2_set_chan_sig_status(ftdmchan, FTDM_SIG_STATE_UP); } static void ftdm_r2_write_log(openr2_log_level_t level, const char *file, const char *function, int line, const char *message) @@ -1130,6 +1144,9 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_r2_configure_span) span->signal_data = r2data; span->outgoing_call = r2_outgoing_call; + /* use signals queue */ + ftdm_set_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE); + return FTDM_SUCCESS; fail: @@ -1439,6 +1456,7 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) } else if (status != FTDM_TIMEOUT) { ftdm_log(FTDM_LOG_ERROR, "ftdm_span_poll_event returned %d.\n", status); } + ftdm_span_trigger_signals(span); ftdm_sleep(20); } commit 8aae09127344f4a518f8b3a30d9ddd6401aa59af Merge: af5f0a4 04e8541 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Tue Nov 23 14:56:50 2010 -0200 Merge branch 'master' of git.sangoma.com:smg_freeswitch commit af5f0a4acd0426d63791d8f1c7a18608de3955ff Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Tue Nov 23 14:55:59 2010 -0200 freetdm: made ftmod_r2 use FTDM_SPAN_USE_SIGNALS_QUEUE and properly send FTDM_SIGEVENT_SIGSTATUS_CHANGED diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index a410e4e..73f5660 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -2028,6 +2028,14 @@ static FIO_SIGNAL_CB_FUNCTION(on_r2_signal) } break; + case FTDM_SIGEVENT_SIGSTATUS_CHANGED: + { + ftdm_signaling_status_t sigstatus = sigmsg->raw_data ? *((ftdm_signaling_status_t*)(sigmsg->raw_data)) : sigmsg->sigstatus; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%d:%d signalling changed to: %s\n", + spanid, chanid, ftdm_signaling_status2str(sigstatus)); + } + break; + default: { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unhandled event %d from R2 for channel %d:%d\n", diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index d534481..30de788 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -220,6 +220,23 @@ static char *strsep(char **stringp, const char *delim) } #endif /* WIN32 */ +static void ftdm_r2_set_chan_sig_status(ftdm_channel_t *ftdmchan, ftdm_signaling_status_t status) +{ + ftdm_sigmsg_t sig; + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Signalling link status changed to %s\n", ftdm_signaling_status2str(status)); + + memset(&sig, 0, sizeof(sig)); + sig.chan_id = ftdmchan->chan_id; + sig.span_id = ftdmchan->span_id; + sig.channel = ftdmchan; + sig.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; + sig.sigstatus = status; + if (ftdm_span_send_signal(ftdmchan->span, &sig) != FTDM_SUCCESS) { + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to change channel status to %s\n", ftdm_signaling_status2str(status)); + } + return; +} + static ftdm_call_cause_t ftdm_r2_cause_to_ftdm_cause(ftdm_channel_t *fchan, openr2_call_disconnect_cause_t cause) { switch (cause) { @@ -593,17 +610,14 @@ static void ftdm_r2_on_line_blocked(openr2_chan_t *r2chan) { ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Far end blocked in state %s\n", ftdm_channel_state2str(ftdmchan->state)); - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_SUSPENDED); + ftdm_r2_set_chan_sig_status(ftdmchan, FTDM_SIG_STATE_SUSPENDED); } static void ftdm_r2_on_line_idle(openr2_chan_t *r2chan) { ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Far end unblocked in state %s\n", ftdm_channel_state2str(ftdmchan->state)); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_SUSPENDED); - - /* XXX when should we set/unset this flag? XXX */ - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_SIG_UP); + ftdm_r2_set_chan_sig_status(ftdmchan, FTDM_SIG_STATE_UP); } static void ftdm_r2_write_log(openr2_log_level_t level, const char *file, const char *function, int line, const char *message) @@ -1130,6 +1144,9 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_r2_configure_span) span->signal_data = r2data; span->outgoing_call = r2_outgoing_call; + /* use signals queue */ + ftdm_set_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE); + return FTDM_SUCCESS; fail: @@ -1439,6 +1456,7 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) } else if (status != FTDM_TIMEOUT) { ftdm_log(FTDM_LOG_ERROR, "ftdm_span_poll_event returned %d.\n", status); } + ftdm_span_trigger_signals(span); ftdm_sleep(20); } commit 04e854136675ba1369a73af712b12971d4ee9c69 Author: Moises Silva <moy@sangoma.com> Date: Tue Nov 23 11:43:52 2010 -0500 freetdm: add release event to ftdm core diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index a410e4e..165fce0 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1690,6 +1690,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_fxo_signal) } } break; + case FTDM_SIGEVENT_RELEASED: { /* twiddle */ } break; default: { @@ -1744,6 +1745,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_fxs_signal) } } break; + case FTDM_SIGEVENT_RELEASED: { /* twiddle */ } break; case FTDM_SIGEVENT_STOP: { private_t *tech_pvt = NULL; @@ -1966,6 +1968,8 @@ static FIO_SIGNAL_CB_FUNCTION(on_r2_signal) status = ftdm_channel_from_event(sigmsg, &session); } break; + + case FTDM_SIGEVENT_RELEASED: { /* twiddle */ } break; /* on DNIS received from the R2 forward side, return status == FTDM_BREAK to stop requesting DNIS */ case FTDM_SIGEVENT_COLLECTED_DIGIT: @@ -2063,6 +2067,9 @@ static FIO_SIGNAL_CB_FUNCTION(on_clear_channel_signal) return ftdm_channel_from_event(sigmsg, &session); } break; + + case FTDM_SIGEVENT_RELEASED: { /* twiddle */ } break; + case FTDM_SIGEVENT_STOP: case FTDM_SIGEVENT_RESTART: { diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 939933a..24e5457 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2349,6 +2349,8 @@ static void close_dtmf_debug(ftdm_channel_t *ftdmchan) static ftdm_status_t ftdm_channel_clear_vars(ftdm_channel_t *ftdmchan); FT_DECLARE(ftdm_status_t) ftdm_channel_done(ftdm_channel_t *ftdmchan) { + ftdm_sigmsg_t sigmsg; + ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "Null channel can't be done!\n"); ftdm_mutex_lock(ftdmchan->mutex); @@ -2387,6 +2389,13 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_done(ftdm_channel_t *ftdmchan) ftdm_log(FTDM_LOG_DEBUG, "channel done %u:%u\n", ftdmchan->span_id, ftdmchan->chan_id); + memset(&sigmsg, 0, sizeof(sigmsg)); + sigmsg.span_id = ftdmchan->span_id; + sigmsg.chan_id = ftdmchan->chan_id; + sigmsg.channel = ftdmchan; + sigmsg.event_id = FTDM_SIGEVENT_RELEASED; + ftdm_span_send_signal(ftdmchan->span, &sigmsg); + ftdm_mutex_unlock(ftdmchan->mutex); return FTDM_SUCCESS; diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 55e433d..dc181e1 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -287,6 +287,7 @@ typedef enum { typedef enum { FTDM_SIGEVENT_START, /*!< Incoming call (ie: incoming SETUP msg or Ring) */ FTDM_SIGEVENT_STOP, /*!< Hangup */ + FTDM_SIGEVENT_RELEASED, /*!< Channel is completely released and available */ FTDM_SIGEVENT_UP, /*!< Outgoing call has been answered */ FTDM_SIGEVENT_FLASH, /*< Flash event (typically on-hook/off-hook for analog devices) */ FTDM_SIGEVENT_PROGRESS, /*!< Outgoing call is making progress */ commit 38f994206f075acf461b399f0e512ec5795b0083 Author: Brian West <brian@freeswitch.org> Date: Tue Nov 23 09:54:50 2010 -0600 FS-535: additional checks and use the right contact for registers inside and outside of nat diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 32d25d0..4d992b0 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2156,6 +2156,30 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag) sipip = profile->sipip; } + gateway->extension = switch_core_strdup(gateway->pool, extension); + + + if (!strncasecmp(proxy, "sip:", 4)) { + gateway->register_proxy = switch_core_strdup(gateway->pool, proxy); + gateway->register_to = switch_core_sprintf(gateway->pool, "sip:%s@%s", username, proxy + 4); + } else { + gateway->register_proxy = switch_core_sprintf(gateway->pool, "sip:%s", proxy); + gateway->register_to = switch_core_sprintf(gateway->pool, "sip:%s@%s", username, proxy); + } + + /* This checks to make sure we provide the right contact on register for targets behind nat with us. */ + if (sofia_test_pflag(profile, PFLAG_AUTO_NAT)) { + char *register_host = NULL; + + register_host = sofia_glue_get_register_host(gateway->register_proxy); + + if (register_host && !sofia_glue_check_nat(profile, register_host)) { + sipip = profile->sipip; + } + + switch_safe_free(register_host); + } + if (extension_in_contact) { format = strchr(sipip, ':') ? "<sip:%s@[%s]:%d%s>" : "<sip:%s@%s:%d%s>"; gateway->register_contact = switch_core_sprintf(gateway->pool, format, extension, @@ -2170,16 +2194,6 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag) profile->tls_sip_port : profile->sip_port, params); } - gateway->extension = switch_core_strdup(gateway->pool, extension); - - if (!strncasecmp(proxy, "sip:", 4)) { - gateway->register_proxy = switch_core_strdup(gateway->pool, proxy); - gateway->register_to = switch_core_sprintf(gateway->pool, "sip:%s@%s", username, proxy + 4); - } else { - gateway->register_proxy = switch_core_sprintf(gateway->pool, "sip:%s", proxy); - gateway->register_to = switch_core_sprintf(gateway->pool, "sip:%s@%s", username, proxy); - } - gateway->expires_str = switch_core_strdup(gateway->pool, expire_seconds); if ((gateway->freq = atoi(gateway->expires_str)) < 5) { diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 14a7bfd..7390378 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -152,7 +152,7 @@ void sofia_sub_check_gateway(sofia_profile_t *profile, time_t now) register_host = sofia_glue_get_register_host(gateway_ptr->register_proxy); /* check for NAT and place a Via header if necessary (hostname or non-local IP) */ - if (sofia_glue_check_nat(gateway_ptr->profile, register_host)) { + if (register_host && sofia_glue_check_nat(gateway_ptr->profile, register_host)) { user_via = sofia_glue_create_external_via(NULL, gateway_ptr->profile, gateway_ptr->register_transport); } @@ -295,7 +295,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now) register_host = sofia_glue_get_register_host(gateway_ptr->register_proxy); /* check for NAT and place a Via header if necessary (hostname or non-local IP) */ - if (sofia_glue_check_nat(gateway_ptr->profile, register_host)) { + if (register_host && sofia_glue_check_nat(gateway_ptr->profile, register_host)) { user_via = sofia_glue_create_external_via(NULL, gateway_ptr->profile, gateway_ptr->register_transport); } @@ -358,7 +358,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now) register_host = sofia_glue_get_register_host(gateway_ptr->register_proxy); /* check for NAT and place a Via header if necessary (hostname or non-local IP) */ - if (sofia_glue_check_nat(gateway_ptr->profile, register_host)) { + if (register_host && sofia_glue_check_nat(gateway_ptr->profile, register_host)) { user_via = sofia_glue_create_external_via(NULL, gateway_ptr->profile, gateway_ptr->register_transport); } commit ec8f2c2bc2b65457ab6c6684769463f54125d62e Author: Michael S Collins <msc@freeswitch.org> Date: Mon Nov 22 22:00:36 2010 -0800 scripts: add_user - cmd line utility that lets admin create new users very easily. diff --git a/scripts/perl/add_user b/scripts/perl/add_user new file mode 100755 index 0000000..d16ebb5 --- /dev/null +++ b/scripts/perl/add_user @@ -0,0 +1,306 @@ +#!/usr/bin/perl +# +# add_user +# +# Add one or more users to the XML directory +# +# + +use strict; +use warnings; +use Getopt::Long; +use Data::Dumper; + +## Useful items +my $path_sep; +my $config_path; +my @dir_elem; +my $user_template = &get_user_template; +my $new_user_count = 0; + +## Command line args +my $users; +my $domain; +my $dirpath; +my $help; + +## Misc items somewhat related to cmd line args +my $start; +my $end; +my $user; + +## Check for Windows vs. *nix +if ( $^O =~ m/^win/i ) { + ## Detected Windows (probably) + $path_sep = "\\"; # single backslash (\) + use File::Spec::Win32; +} else { + $path_sep = '/'; # single slash (/) + use File::Spec; +} + +GetOptions( + 'h' => \$help, + 'help' => \$help, + 'domain=s' => \$domain, + 'users=s' => \$users, + 'confpath=s' => \$config_path, +); + +if ( $help ) { + usage(); + exit(0); +} + +if ( ! $domain ) { + $domain='default'; +} + +## Validate users if specified on command line +if ( $users ) { + ($start,$end) = split /-/,$users; + if ( ! $start && ! $end ) { + die "Please specify both a start and end range, separated by a hyphen:\n add_user --users=xxxx-yyyy\n"; + } + + unless ( $start =~ m/[1-9]\d+/ ) { + die "Start of range '$start' is not numeric or is too short\n"; + } + + unless ( $end =~ m/[1-9]\d+/ ) { + die "End of range '$end' is not numberic or is too short\n"; + } + + if ( $end <= $start ) { + die "End of range needs to be greater than start of range\n"; + } +} else { + ## Look for user id in $ARGV[0] + if ( ! $ARGV[0] ) { + die "You must specify user id as a command line argument to add user, or use the --users option.\n"; + } + unless ( $ARGV[0] =~ m/^[1-9]\d+$/ ) { + die "User id must be numeric, be at least 2 digits long, and cannot begin with the digit zero.\n" + } + $user = $ARGV[0]; +} + +if ( ! $config_path ) { + $config_path = '/usr/local/freeswitch/conf'; +} + +## Check to make sure the directories in question exists +unless ( -d $config_path ) { + die "Configuration path '$config_path' does not exist.\n"; +} + +my $directory_path = $config_path . $path_sep . 'directory'; +unless ( -d $directory_path ) { + die "Directory path '$directory_path' does not exist.\n"; +} + +## Now check domain pathname and test existence +if ( ! $domain ) { + $domain = 'default'; +} + +## Full directory path includes the domain name +my $full_dir_path = $directory_path . $path_sep . $domain; +unless ( -d $full_dir_path ) { + die "Full path to directory and domain '$full_dir_path' does not exist. \n"; +} + +unless ( -w $full_dir_path ) { + die "This user does not have write access to '$full_dir_path'.\n"; +} +print "\n"; + +## Regexp assemble items to show user what a PCRE might look like for his new users +my $ra_present; +my $ra_new; +my $ra_all; +eval { require Regexp::Assemble; }; +if ( ! $@ ) { + ## If Regexp::Assemble is available flag it for later building regexes + $ra_present = 'true'; + $ra_new = Regexp::Assemble->new( # new user regex + reduce => 1, + flags => 0, +); + $ra_all = Regexp::Assemble->new( # all users regex w/ new users thrown in + reduce => 1, + flags => 0, +); +} + +## If we're this far then we can read in the existing users and put them in a hash +## Later we can check hash to avoid adding duplicate users +my %current_users; +my @CURRENT_USER_FILES = glob($full_dir_path . $path_sep . '*.xml'); +foreach ( @CURRENT_USER_FILES ) { + #print "User: $_\n"; + open(FILEIN,'<',$_); + while(<FILEIN>) { + next unless m/user id|number-alias/; + m/user id="(\d+)"/; + my $user_id = $1; + if ( ! $user_id ) { + m/alias="(\d+)"/; + $user_id = $1; + } + + next unless $user_id; + $current_users{$user_id}++; + + if ( $ra_present && $user_id =~ m/^\d+$/ ) { + #print "Adding $user_id to \$re_all...\n"; + $ra_all->add($user_id)->anchor_line_begin->anchor_line_end; + } + last; + } + close(FILEIN); +} + +#print Dumper(%current_users) . "\n"; +if ( $start && $end ) { + ## Add range of users + foreach $user ($start .. $end) { + &add_user($user); + } +} else { + ## Add single user + &add_user($user); +} + +print "\nOperation complete. "; +if ( $new_user_count == 0 ) { + print "No users added.\n"; + exit(0); +} else { + printf "%d user%s added.\n", $new_user_count, $new_user_count==1 ? "" : "s"; + print "Be sure to reloadxml.\n\n"; +} + +if ( $ra_present ) { + print "Regular expression information:\n\n"; + ## Regexp::Assemble adds some stuff we really don't need + ## These lines just make the regexp pattern a bit more readable + my $tmp = $ra_new->as_string; + $tmp =~ s/\?://g; + $tmp =~ s/^\(\?\-xism:\^/^(/; + $tmp =~ s/\$\)$/)\$/; + $tmp =~ s/\\d/[0-9]/g; # [0-9] is sometimes easier to read than \d + print " Sample regex for all new users: " . $tmp . "\n"; + $tmp = $ra_all->as_string; + $tmp =~ s/\?://g; + $tmp =~ s/^\(\?\-xism:\^/^(/; + $tmp =~ s/\$\)$/)\$/; + $tmp =~ s/\\d/[0-9]/g; # [0-9] is sometimes easier to read than \d + print "Sample regex for all new AND current users: " . $tmp . "\n\n"; + print "In the default configuration you can modify the expression in the condition for 'Local_Extension'.\n"; + print "" +} else { + print "If CPAN module Regexp::Assemble were installed this program would be able to suggest a regex for your new users.\n" +} + +exit(0); + +sub add_user { + my $user_id = shift; + if ( exists( $current_users{$user_id} ) ) { + warn "User id $user_id already exists, skipping...\n"; + } else { + my $new_user = $user_template; + $new_user =~ s/__USERID__/$user_id/g; + #print "Adding user id '$user_id' with this XML:\n"; + #print $new_user . "\n"; + + ## Attempt to create the user file + my $user_file_name = $full_dir_path . $path_sep . $user_id . '.xml'; + + ## Does it already exist? + if ( -f $user_file_name ) { + warn "$user_file_name exists, skipping...\n"; + } + my $fh; + open($fh,'>',$user_file_name); + if ( ! $fh ) { + warn "Unable to open '$user_file_name' - $!\n"; + warn "Skipping...\n"; + next; + } + + print $fh $new_user; + close($fh); + print "Added $user_id in file $user_file_name \n"; + $new_user_count++; + if ( $ra_present ) { + $ra_new->add($user_id)->anchor_line_begin->anchor_line_end; + $ra_all->add($user_id)->anchor_line_begin->anchor_line_end; + } + } + +} + +sub get_user_template { + my $templ = <<ENDUSERTEMPLATE; +<include> + <user id="__USERID__"> + <params> + <param name="password" value="\$\${default_password}"/> + <param name="vm-password" value="__USERID__"/> + </params> + <variables> + <variable name="toll_allow" value="domestic,international,local"/> + <variable name="accountcode" value="__USERID__"/> + <variable name="user_context" value="default"/> + <variable name="effective_caller_id_name" value="Extension __USERID__"/> + <variable name="effective_caller_id_number" value="__USERID__"/> + <variable name="outbound_caller_id_name" value="\$\${outbound_caller_name}"/> + <variable name="outbound_caller_id_number" value="\$\${outbound_caller_id}"/> + <variable name="callgroup" value="techsupport"/> + </variables> + </user> +</include> + +ENDUSERTEMPLATE + + return $templ; +} + +sub usage { + print <<ENDUSAGE; + + FreeSWITCH add user utility + +Adds one or more users to the FreeSWITCH directory using XML files. + + + Syntax: + + add_user <user_id> [--domain=<domain_name>] [--confpath=<configuration_path>] + add_user --users=<start_user_id>-<end_user_id> [--domain=<domain_name>] [--confpath=<configuration_path>] + +In its simplest form, add_user will simply add the user_id specified at the command line. +By default, users are added to the "default" domain. Use the --domain option to specify +a different domain for the user(s) that are added. + +To specify a range of user IDs use the --users option. Separate the beginning and +end of the range with a hyphen (-) character. + +By default add_user will look for the XML directory in its default location of +/usr/local/freeswitch/conf/directory. Use the --confpath (configuration path) +option to specify an alternate directory location. + + + NOTES: + +add_user assumes +User IDs must be numeric and cannot begin with zero. +User IDs must be at least two digits long and have no specific length limit. +If a user ID exists it will be skipped. +If a domain specified does not exist no users will be created. + +ENDUSAGE + +} commit c109a89e4e81c57963c3cde28774243fce4203ed Author: Jeff Lenk <jeff@jefflenk.com> Date: Mon Nov 22 21:49:33 2010 -0600 VS2010 fix initial build dependency diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj index c6aaba5..b393149 100644 --- a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj +++ b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj @@ -127,6 +127,11 @@ <ClCompile Include="src\mrcp_sofiasip_client_agent.c" /> <ClCompile Include="src\mrcp_sofiasip_server_agent.c" /> </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\win32\sofia\libsofia_sip_ua_static.2010.vcxproj"> + <Project>{70a49bc2-7500-41d0-b75d-edcc5be987a0}</Project> + </ProjectReference> + </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> commit 89dbe0b0a09fa52f47f24884c969d1ed3ef6b6e8 Author: Brian West <brian@freeswitch.org> Date: Mon Nov 22 17:06:59 2010 -0600 ESL-52 diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index 941db22..ee7cfc9 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -691,7 +691,7 @@ SWITCH_STANDARD_API(event_sink_function) switch_mutex_lock(listener->filter_mutex); if (!listener->filters) { - switch_event_create_plain(&listener->filters, SWITCH_EVENT_CHANNEL_DATA); + switch_event_create_plain(&listener->filters, SWITCH_EVENT_CLONE); } if (!strcasecmp(action, "delete")) { @@ -702,7 +702,7 @@ SWITCH_STANDARD_API(event_sink_function) if (!strcasecmp(header_val, "all")) { switch_event_destroy(&listener->filters); - switch_event_create_plain(&listener->filters, SWITCH_EVENT_CHANNEL_DATA); + switch_event_create_plain(&listener->filters, SWITCH_EVENT_CLONE); } else { switch_event_del_header(listener->filters, header_val); } @@ -1744,7 +1744,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even switch_mutex_lock(listener->filter_mutex); if (!listener->filters) { - switch_event_create_plain(&listener->filters, SWITCH_EVENT_CHANNEL_DATA); + switch_event_create_plain(&listener->filters, SWITCH_EVENT_CLONE); } if (!strcasecmp(header_name, "delete") && header_val) { @@ -1754,7 +1754,7 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even } if (!strcasecmp(header_name, "all")) { switch_event_destroy(&listener->filters); - switch_event_create_plain(&listener->filters, SWITCH_EVENT_CHANNEL_DATA); + switch_event_create_plain(&listener->filters, SWITCH_EVENT_CLONE); } else { switch_event_del_header_val(listener->filters, header_name, header_val); } commit 87edbed6bbcdb351b9502f66e78b01116ae1ab00 Author: Brian West <brian@freeswitch.org> Date: Mon Nov 22 15:32:23 2010 -0600 FS-535: be more careful and catch ipv6 edge case diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 23d3f29..57a2bfa 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -5740,6 +5740,10 @@ char *sofia_glue_get_register_host(const char *uri) const char *s; char *p = NULL; + if (zstr(uri)) { + return NULL; + } + if ((s = switch_stristr("sip:", uri))) { s += 4; } else if ((s = switch_stristr("sips:", uri))) { @@ -5755,9 +5759,12 @@ char *sofia_glue_get_register_host(const char *uri) /* remove port for register_host for testing nat acl take into account ipv6 addresses which are required to have brackets around the addr */ - if ((p = strchr(register_host, ']')) && (*(p + 1) == ':')) { - *(p + 1) = '\0'; - } else { + + if ((p = strchr(register_host, ']'))) { + if (*(p + 1) == ':') { + *(p + 1) = '\0'; + } + } else { if ((p = strrchr(register_host, ':'))) { *p = '\0'; } commit 22047f93377fac0c763934603001085428f74d3e Author: Brian West <brian@freeswitch.org> Date: Mon Nov 22 15:24:22 2010 -0600 FS-2862: fix seg more diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 580334a..32d25d0 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -5959,7 +5959,7 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t /* Barf if we didn't get our private */ assert(switch_core_session_get_private(session)); - if (sip->sip_content_type && + if (sip->sip_content_type && sip->sip_content_type->c_subtype && sip->sip_content_type->c_type && !strncasecmp(sip->sip_content_type->c_type, "message", 7) && !strcasecmp(sip->sip_content_type->c_subtype, "update_display")) { sofia_update_callee_id(session, profile, sip, SWITCH_TRUE); commit cf398e1a442bc54c05d68837fcad6258cecc7dfe Author: Brian West <brian@freeswitch.org> Date: Mon Nov 22 14:59:25 2010 -0600 FS-535: tested but please test MORE. diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 750fb60..c1244c0 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -957,6 +957,7 @@ void sofia_presence_event_thread_start(void); void sofia_reg_expire_call_id(sofia_profile_t *profile, const char *call_id, int reboot); switch_status_t sofia_glue_tech_choose_video_port(private_object_t *tech_pvt, int force); switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int force); +char *sofia_glue_get_register_host(const char *uri); const char *sofia_glue_strip_proto(const char *uri); switch_status_t reconfig_sofia(sofia_profile_t *profile); void sofia_glue_del_gateway(sofia_gateway_t *gp); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index fa82860..23d3f29 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -5734,6 +5734,41 @@ char *sofia_glue_execute_sql2str(sofia_profile_t *profile, switch_mutex_t *mutex return ret; } +char *sofia_glue_get_register_host(const char *uri) +{ + char *register_host = NULL; + const char *s; + char *p = NULL; + + if ((s = switch_stristr("sip:", uri))) { + s += 4; + } else if ((s = switch_stristr("sips:", uri))) { + s += 5; + } + + if (!s) { + return NULL; + } + + register_host = strdup(s); + + /* remove port for register_host for testing nat acl take into account + ipv6 addresses which are required to have brackets around the addr + */ + if ((p = strchr(register_host, ']')) && (*(p + 1) == ':')) { + *(p + 1) = '\0'; + } else { + if ((p = strrchr(register_host, ':'))) { + *p = '\0'; + } + } + + /* register_proxy should always start with "sip:" or "sips:" */ + assert(register_host); + + return register_host; +} + const char *sofia_glue_strip_proto(const char *uri) { char *p; @@ -5983,7 +6018,6 @@ void sofia_glue_tech_simplify(private_object_t *tech_pvt) } } - void sofia_glue_build_vid_refresh_message(switch_core_session_t *session, const char *pl) { switch_core_session_message_t *msg; diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 4bb8796..14a7bfd 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -142,16 +142,22 @@ void sofia_sub_check_gateway(sofia_profile_t *profile, time_t now) int ss_state = nua_callstate_authenticating; sub_state_t ostate = gw_sub_ptr->state; char *user_via = NULL; + char *register_host = NULL; if (!now) { gw_sub_ptr->state = ostate = SUB_STATE_UNSUBED; gw_sub_ptr->expires_str = "0"; } - if (sofia_glue_check_nat(gateway_ptr->profile, gateway_ptr->register_proxy)) { + register_host = sofia_glue_get_register_host(gateway_ptr->register_proxy); + + /* check for NAT and place a Via header if necessary (hostname or non-local IP) */ + if (sofia_glue_check_nat(gateway_ptr->profile, register_host)) { user_via = sofia_glue_create_external_via(NULL, gateway_ptr->profile, gateway_ptr->register_transport); } + switch_safe_free(register_host); + switch (ostate) { case SUB_STATE_NOSUB: break; @@ -189,7 +195,15 @@ void sofia_sub_check_gateway(sofia_profile_t *profile, time_t now) nua_handle_bind(gateway_ptr->nh, gateway_ptr->sofia_private); if (now) { - nua_subscribe(gateway_ptr->sub_nh, NUTAG_URL(gateway_ptr->register_url), TAG_IF(user_via, SIPTAG_VIA_STR(user_via)), SIPTAG_EVENT_STR(gw_sub_ptr->event), SIPTAG_ACCEPT_STR(gw_sub_ptr->content_type), SIPTAG_TO_STR(gateway_ptr->register_from), SIPTAG_FROM_STR(gateway_ptr->register_from), SIPTAG_CONTACT_STR(gateway_ptr->register_contact), SIPTAG_EXPIRES_STR(gw_sub_ptr->expires_str), // sofia stack bases its auto-refresh stuff on this + nua_subscribe(gateway_ptr->sub_nh, + NUTAG_URL(gateway_ptr->register_url), + TAG_IF(user_via, SIPTAG_VIA_STR(user_via)), + SIPTAG_EVENT_STR(gw_sub_ptr->event), + SIPTAG_ACCEPT_STR(gw_sub_ptr->content_type), + SIPTAG_TO_STR(gateway_ptr->register_from), + SIPTAG_FROM_STR(gateway_ptr->register_from), + SIPTAG_CONTACT_STR(gateway_ptr->register_contact), + SIPTAG_EXPIRES_STR(gw_sub_ptr->expires_str), /* sofia stack bases its auto-refresh stuff on this */ TAG_NULL()); gw_sub_ptr->retry = now + gw_sub_ptr->retry_seconds; } else { @@ -266,6 +280,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now) for (gateway_ptr = profile->gateways; gateway_ptr; gateway_ptr = gateway_ptr->next) { reg_state_t ostate = gateway_ptr->state; char *user_via = NULL; + char *register_host = NULL; if (!now) { gateway_ptr->state = ostate = REG_STATE_UNREGED; @@ -277,10 +292,15 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now) nua_handle_t *nh = nua_handle(profile->nua, NULL, NUTAG_URL(gateway_ptr->register_url), TAG_END()); sofia_private_t *pvt; - if (sofia_glue_check_nat(gateway_ptr->profile, gateway_ptr->register_proxy)) { + register_host = sofia_glue_get_register_host(gateway_ptr->register_proxy); + + /* check for NAT and place a Via header if necessary (hostname or non-local IP) */ + if (sofia_glue_check_nat(gateway_ptr->profile, register_host)) { user_via = sofia_glue_create_external_via(NULL, gateway_ptr->profile, gateway_ptr->register_transport); } + switch_safe_free(register_host); + pvt = malloc(sizeof(*pvt)); switch_assert(pvt); memset(pvt, 0, sizeof(*pvt)); @@ -335,10 +355,15 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now) sofia_reg_new_handle(gateway_ptr, now ? 1 : 0); } - if (sofia_glue_check_nat(gateway_ptr->profile, gateway_ptr->register_proxy)) { + register_host = sofia_glue_get_register_host(gateway_ptr->register_proxy); + + /* check for NAT and place a Via header if necessary (hostname or non-local IP) */ + if (sofia_glue_check_nat(gateway_ptr->profile, register_host)) { user_via = sofia_glue_create_external_via(NULL, gateway_ptr->profile, gateway_ptr->register_transport); } + switch_safe_free(register_host); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Registering %s\n", gateway_ptr->name); if (now) { commit 8e142ff22abf13f98eb4355eb98ecc14eb6ce10f Merge: f1789ed 53c41c0 Author: David Yat Sin <dyatsin@sangoma.com> Date: Mon Nov 22 15:16:10 2010 -0500 Merge branch 'netborder' commit 0d87954a46b6fc98ebf29d5cf761a1e011ba48df Merge: 90c1562 f1789ed Author: Moises Silva <moy@sangoma.com> Date: Mon Nov 22 11:36:31 2010 -0500 Merge remote branch 'smgfs/master' commit 90c156243c89f582d242f13f332a6360659812e6 Author: Brian West <brian@freeswitch.org> Date: Mon Nov 22 10:10:26 2010 -0600 FS-2862: fix seg diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index e749abd..580334a 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -5959,7 +5959,9 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t /* Barf if we didn't get our private */ assert(switch_core_session_get_private(session)); - if (!strncasecmp(sip->sip_content_type->c_type, "message", 7) && !strcasecmp(sip->sip_content_type->c_subtype, "update_display")) { + if (sip->sip_content_type && + !strncasecmp(sip->sip_content_type->c_type, "message", 7) && + !strcasecmp(sip->sip_content_type->c_subtype, "update_display")) { sofia_update_callee_id(session, profile, sip, SWITCH_TRUE); goto end; } commit f1789ed5a23a8684a384ec6ce39f003716edfe2d Merge: 5e562ed 6dfd39c Author: Moises Silva <moy@sangoma.com> Date: Mon Nov 22 10:41:16 2010 -0500 Merge remote branch 'fsorig/master' commit 6dfd39c5f3186000b08a1fa500a98a4a04d65724 Author: Brian West <brian@freeswitch.org> Date: Sun Nov 21 12:01:48 2010 -0600 log ip too diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 571c167..4bb8796 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1115,7 +1115,8 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand if (auth_res != AUTH_OK && !stale) { if (profile->debug) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send %s for [%s@%s]\n", forbidden ? "forbidden" : "challenge", to_user, to_host); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send %s for [%s@%s] from ip '%s'\n", + forbidden ? "forbidden" : "challenge", to_user, to_host, network_ip); } if (auth_res == AUTH_FORBIDDEN) { nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END()); commit a9a31041d47b89c7837ea3bca705da91b40f6d48 Author: Moises Silva <moy@sangoma.com> Date: Sat Nov 20 18:18:37 2010 -0500 freetdm: added wait_dialtone_timeout parameter for ftmod_analog if this parameter is set to 0 ftmod_analog will not wait for dial tone before dialing out the requested number. Anything bigger than 0 is the units in milliseconds to wait for dialtone before aborting the call. diff --git a/libs/freetdm/src/ftdm_threadmutex.c b/libs/freetdm/src/ftdm_threadmutex.c index 1271d80..b1884ec 100644 --- a/libs/freetdm/src/ftdm_threadmutex.c +++ b/libs/freetdm/src/ftdm_threadmutex.c @@ -417,7 +417,7 @@ FT_DECLARE(ftdm_status_t) ftdm_interrupt_destroy(ftdm_interrupt_t **ininterrupt) FT_DECLARE(ftdm_status_t) ftdm_interrupt_multiple_wait(ftdm_interrupt_t *interrupts[], ftdm_size_t size, int ms) { int numdevices = 0; - unsigned i; + unsigned i = 0; #if defined(__WINDOWS__) DWORD res = 0; @@ -496,6 +496,8 @@ pollagain: } } #else + /* for MacOS compilation, unused vars */ + numdevices = i; #endif return FTDM_SUCCESS; } diff --git a/libs/freetdm/src/ftmod/ftmod_analog/ftdm_analog.h b/libs/freetdm/src/ftmod/ftmod_analog/ftdm_analog.h index 487829f..2c79822 100644 --- a/libs/freetdm/src/ftmod/ftmod_analog/ftdm_analog.h +++ b/libs/freetdm/src/ftmod/ftmod_analog/ftdm_analog.h @@ -46,6 +46,7 @@ typedef enum { struct ftdm_analog_data { uint32_t flags; uint32_t max_dialstr; + uint32_t wait_dialtone_timeout; uint32_t digit_timeout; char hotline[FTDM_MAX_HOTLINE_STR]; }; diff --git a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c index dacda7e..fc9bea6 100644 --- a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c +++ b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c @@ -49,13 +49,16 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj); */ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(analog_fxo_outgoing_call) { + ftdm_analog_data_t *analog_data = ftdmchan->span->signal_data; if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OFFHOOK) && !ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INTHREAD)) { ftdm_channel_clear_needed_tones(ftdmchan); ftdm_channel_clear_detected_tones(ftdmchan); ftdm_channel_command(ftdmchan, FTDM_COMMAND_OFFHOOK, NULL); ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_PROGRESS_DETECT, NULL); - ftdmchan->needed_tones[FTDM_TONEMAP_DIAL] = 1; + if (analog_data->wait_dialtone_timeout) { + ftdmchan->needed_tones[FTDM_TONEMAP_DIAL] = 1; + } ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DIALING); ftdm_thread_create_detached(ftdm_analog_channel_run, ftdmchan); return FTDM_SUCCESS; @@ -157,6 +160,7 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_analog_configure_span) const char *tonemap = "us"; const char *hotline = ""; uint32_t digit_timeout = 10; + uint32_t wait_dialtone_timeout = 30000; uint32_t max_dialstr = MAX_DTMF; const char *var, *val; int *intval; @@ -191,6 +195,15 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_analog_configure_span) break; } digit_timeout = *intval; + } else if (!strcasecmp(var, "wait_dialtone_timeout")) { + if (!(intval = va_arg(ap, int *))) { + break; + } + wait_dialtone_timeout = *intval; + if (wait_dialtone_timeout < 0) { + wait_dialtone_timeout = 0; + } + ftdm_log_chan(span->channels[i], FTDM_LOG_DEBUG, "Wait dial tone ms = %d\n", wait_dialtone_timeout); } else if (!strcasecmp(var, "enable_callerid")) { if (!(val = va_arg(ap, char *))) { break; @@ -221,7 +234,6 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_analog_configure_span) } } - if (digit_timeout < 2000 || digit_timeout > 10000) { digit_timeout = 2000; } @@ -241,6 +253,7 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_analog_configure_span) span->stop = ftdm_analog_stop; analog_data->flags = flags; analog_data->digit_timeout = digit_timeout; + analog_data->wait_dialtone_timeout = wait_dialtone_timeout; analog_data->max_dialstr = max_dialstr; span->signal_cb = sig_cb; strncpy(analog_data->hotline, hotline, sizeof(analog_data->hotline)); @@ -325,6 +338,27 @@ static void send_caller_id(ftdm_channel_t *ftdmchan) ftdm_channel_send_fsk_data(ftdmchan, &fsk_data, -14); } +static void analog_dial(ftdm_channel_t *ftdmchan, uint32_t *state_counter, uint32_t *dial_timeout) +{ + if (ftdm_strlen_zero(ftdmchan->caller_data.dnis.digits)) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "No Digits to send!\n"); + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY); + } else { + if (ftdm_channel_command(ftdmchan, FTDM_COMMAND_SEND_DTMF, ftdmchan->caller_data.dnis.digits) != FTDM_SUCCESS) { + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Send Digits Failed [%s]\n", ftdmchan->last_error); + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY); + } else { + *state_counter = 0; + ftdmchan->needed_tones[FTDM_TONEMAP_RING] = 1; + ftdmchan->needed_tones[FTDM_TONEMAP_BUSY] = 1; + ftdmchan->needed_tones[FTDM_TONEMAP_FAIL1] = 1; + ftdmchan->needed_tones[FTDM_TONEMAP_FAIL2] = 1; + ftdmchan->needed_tones[FTDM_TONEMAP_FAIL3] = 1; + *dial_timeout = ((ftdmchan->dtmf_on + ftdmchan->dtmf_off) * strlen(ftdmchan->caller_data.dnis.digits)) + 2000; + } + } +} + /** * \brief Main thread function for analog channel (outgoing call) * \param me Current thread @@ -342,7 +376,7 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) ftdm_size_t dtmf_offset = 0; ftdm_analog_data_t *analog_data = ftdmchan->span->signal_data; ftdm_channel_t *closed_chan; - uint32_t state_counter = 0, elapsed = 0, collecting = 0, interval = 0, last_digit = 0, indicate = 0, dial_timeout = 30000; + uint32_t state_counter = 0, elapsed = 0, collecting = 0, interval = 0, last_digit = 0, indicate = 0, dial_timeout = analog_data->wait_dialtone_timeout; ftdm_sigmsg_t sig; ftdm_status_t status; @@ -383,7 +417,11 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) sig.span_id = ftdmchan->span_id; sig.channel = ftdmchan; - assert(interval != 0); + ftdm_assert(interval != 0, NULL); + + if (!dial_timeout) { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Not waiting for dial tone to dial number %s\n", ftdmchan->caller_data.dnis.digits); + } while (ftdm_running() && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INTHREAD)) { ftdm_wait_flag_t flags = FTDM_READ; @@ -412,7 +450,7 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) } else { ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); } - } + } } break; case FTDM_CHANNEL_STATE_GENRING: @@ -730,28 +768,15 @@ static void *ftdm_analog_channel_run(ftdm_thread_t *me, void *obj) ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Failure indication detected!\n"); ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY); } else if (ftdmchan->detected_tones[FTDM_TONEMAP_DIAL]) { - if (ftdm_strlen_zero(ftdmchan->caller_data.dnis.digits)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "No Digits to send!\n"); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY); - } else { - if (ftdm_channel_command(ftdmchan, FTDM_COMMAND_SEND_DTMF, ftdmchan->caller_data.dnis.digits) != FTDM_SUCCESS) { - ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Send Digits Failed [%s]\n", ftdmchan->last_error); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_BUSY); - } else { - state_counter = 0; - ftdmchan->needed_tones[FTDM_TONEMAP_RING] = 1; - ftdmchan->needed_tones[FTDM_TONEMAP_BUSY] = 1; - ftdmchan->needed_tones[FTDM_TONEMAP_FAIL1] = 1; - ftdmchan->needed_tones[FTDM_TONEMAP_FAIL2] = 1; - ftdmchan->needed_tones[FTDM_TONEMAP_FAIL3] = 1; - dial_timeout = ((ftdmchan->dtmf_on + ftdmchan->dtmf_off) * strlen(ftdmchan->caller_data.dnis.digits)) + 2000; - } - } + analog_dial(ftdmchan, &state_counter, &dial_timeout); } else if (ftdmchan->detected_tones[FTDM_TONEMAP_RING]) { ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); } ftdm_channel_clear_detected_tones(ftdmchan); + } else if (!dial_timeout) { + /* we were requested not to wait for dial tone, we can dial immediately */ + analog_dial(ftdmchan, &state_counter, &dial_timeout); } if ((ftdmchan->dtmf_buffer && ftdm_buffer_inuse(ftdmchan->dtmf_buffer)) || (ftdmchan->fsk_buffer && ftdm_buffer_inuse(ftdmchan->fsk_buffer))) { commit 53c41c0463a332447fd5cf1007265dc45446beec Author: David Yat Sin <dyatsin@sangoma.com> Date: Sat Nov 20 10:25:02 2010 -0500 freetdm: ISDN - Fix for main loop going to sleep without processing events from IO module diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 56efcb4..cb96107 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -431,6 +431,7 @@ static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj) /* Poll for events, e.g HW DTMF */ ftdm_sangoma_isdn_poll_events(span); + ftdm_span_trigger_signals(span); if (ftdm_sched_get_time_to_next_timer(signal_data->sched, &sleep) == FTDM_SUCCESS) { if (sleep < 0 || sleep > SNGISDN_EVENT_POLL_RATE) { commit 5973679e3536e50175176b26e29177a409580147 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Nov 19 14:47:45 2010 -0600 fix passing of callee-id diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 9cc515e..e749abd 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -666,21 +666,32 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro } } } - + if (((tmp = switch_channel_get_variable(channel, "effective_callee_id_name")) || - (tmp = switch_channel_get_variable(channel, "sip_callee_id_name")) || - (tmp = switch_channel_get_variable(channel, "callee_id_name"))) && !zstr(tmp)) { + (tmp = switch_channel_get_variable(channel, "sip_callee_id_name"))) && !zstr(tmp)) { name = (char *) tmp; } if (((tmp = switch_channel_get_variable(channel, "effective_callee_id_number")) || - (tmp = switch_channel_get_variable(channel, "sip_callee_id_number")) || - (tmp = switch_channel_get_variable(channel, "callee_id_number"))) && !zstr(tmp)) { + (tmp = switch_channel_get_variable(channel, "sip_callee_id_number"))) && !zstr(tmp)) { number = tmp; } - if (zstr(name)) + if (zstr(number)) { + if ((tmp = switch_channel_get_variable(channel, "callee_id_number")) && !zstr(tmp)) { + number = (char *) tmp; + } + } + + if (zstr(name)) { + if ((tmp = switch_channel_get_variable(channel, "callee_id_name")) && !zstr(tmp)) { + name = (char *) tmp; + } + } + + if (zstr(name)) { name = (char *) number; + } if (zstr(name) && zstr(number)) { goto end; @@ -5947,7 +5958,12 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t /* Barf if we didn't get our private */ assert(switch_core_session_get_private(session)); - + + if (!strncasecmp(sip->sip_content_type->c_type, "message", 7) && !strcasecmp(sip->sip_content_type->c_subtype, "update_display")) { + sofia_update_callee_id(session, profile, sip, SWITCH_TRUE); + goto end; + } + if (sip && sip->sip_content_type && sip->sip_content_type->c_type && sip->sip_content_type->c_subtype && sip->sip_payload && sip->sip_payload->pl_data) { if (!strncasecmp(sip->sip_content_type->c_type, "application", 11) && !strcasecmp(sip->sip_content_type->c_subtype, "media_control+xml")) { @@ -6000,8 +6016,6 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t } else if (!strncasecmp(sip->sip_content_type->c_type, "application", 11) && !strcasecmp(sip->sip_content_type->c_subtype, "dtmf")) { int tmp = atoi(sip->sip_payload->pl_data); dtmf.digit = switch_rfc2833_to_char(tmp); - } else if (!strncasecmp(sip->sip_content_type->c_type, "message", 11) && !strcasecmp(sip->sip_content_type->c_subtype, "update_display")) { - sofia_update_callee_id(session, profile, sip, SWITCH_TRUE); } else { goto end; } commit f61051af9118ffb67679b8f5634b318194cdbd88 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Nov 19 14:15:55 2010 -0600 silly git needs old-school format param to remain back-compat diff --git a/Makefile.am b/Makefile.am index 944511d..aeb31ec 100644 --- a/Makefile.am +++ b/Makefile.am @@ -374,7 +374,7 @@ src/include/switch_version.h: src/include/switch_version.h.in .version $(libfree touch .version ; \ else \ if [ -d .git ] ; then \ - version=`git log --format="%h %ci" -1 HEAD | head -1 | sed -e 's|:|-|g' || echo hacked` ; \ + version=`git log --pretty=format:"%h %ci" -1 HEAD | head -1 | sed -e 's|:|-|g' || echo hacked` ; \ if [ "x$$version" = "xhacked" ] ; then \ version="hacked-`date -u +%Y%m%dT%H%M%SZ`" ; \ else \ commit 6c4f49a888f5953f977816fc9e2a9ce4ec8e1400 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Nov 19 13:46:01 2010 -0600 apparently some sip device vendors did not read the RFC (who knew?) adding verbose_sdp=true var to add needless a= lines for standard iana codecs that explicitly do not require them diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 6e9aacb..fa82860 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -187,7 +187,7 @@ void sofia_glue_set_image_sdp(private_object_t *tech_pvt, switch_t38_options_t * static void generate_m(private_object_t *tech_pvt, char *buf, size_t buflen, switch_port_t port, - int cur_ptime, const char *append_audio, const char *sr, int use_cng, int cng_type, switch_event_t *map) + int cur_ptime, const char *append_audio, const char *sr, int use_cng, int cng_type, switch_event_t *map, int verbose_sdp) { int i = 0; int rate; @@ -298,7 +298,7 @@ static void generate_m(private_object_t *tech_pvt, char *buf, size_t buflen, } } - if (tech_pvt->ianacodes[i] > 95) { + if (tech_pvt->ianacodes[i] > 95 || verbose_sdp) { switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtpmap:%d %s/%d\n", tech_pvt->ianacodes[i], imp->iananame, rate); } @@ -373,6 +373,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32 const char *fmtp_out_var = switch_channel_get_variable(tech_pvt->channel, "sip_force_audio_fmtp"); switch_event_t *map = NULL, *ptmap = NULL; const char *b_sdp = NULL; + int verbose_sdp = 0; sofia_glue_check_dtmf_type(tech_pvt); @@ -396,6 +397,10 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32 fmtp_out = fmtp_out_var; } + if ((val = switch_channel_get_variable(tech_pvt->channel, "verbose_sdp")) && switch_true(val)) { + verbose_sdp = 1; + } + if (sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) || ((val = switch_channel_get_variable(tech_pvt->channel, "supress_cng")) && switch_true(val)) || ((val = switch_channel_get_variable(tech_pvt->channel, "suppress_cng")) && switch_true(val))) { @@ -533,7 +538,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32 } if (!switch_true(switch_channel_get_variable(tech_pvt->channel, "sdp_m_per_ptime"))) { - generate_m(tech_pvt, buf, sizeof(buf), port, 0, append_audio, sr, use_cng, cng_type, map); + generate_m(tech_pvt, buf, sizeof(buf), port, 0, append_audio, sr, use_cng, cng_type, map, verbose_sdp); } else { for (i = 0; i < tech_pvt->num_codecs; i++) { @@ -547,7 +552,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32 if (cur_ptime != this_ptime) { cur_ptime = this_ptime; - generate_m(tech_pvt, buf, sizeof(buf), port, cur_ptime, append_audio, sr, use_cng, cng_type, map); + generate_m(tech_pvt, buf, sizeof(buf), port, cur_ptime, append_audio, sr, use_cng, cng_type, map, verbose_sdp); } } commit 2783face5ffe68b235e3a3be699bcacf1e56280a Merge: c74573c 67fa716 Author: Michael S Collins <msc@freeswitch.org> Date: Fri Nov 19 11:42:29 2010 -0800 Merge branch 'master' of git://git.freeswitch.org/freeswitch commit c74573cb16f8892666f16d36dbdc1fe1c5ef7c46 Author: Michael S Collins <msc@freeswitch.org> Date: Fri Nov 19 11:42:15 2010 -0800 Strip whitespace from IP addresses in blacklist diff --git a/scripts/perl/blacklist.pl b/scripts/perl/blacklist.pl index 92fa55e..a2834b6 100755 --- a/scripts/perl/blacklist.pl +++ b/scripts/perl/blacklist.pl @@ -17,7 +17,8 @@ my @netblocks = split(/\n/, get("http://www.infiltrated.net/voipabuse/netblocks. print "<list name=\"voip-abuse-addresses\" default=\"deny\">\n"; foreach $addr (@addresses) { - next unless $addr =~ m/\d+\.\d+\.\d+\.\d+/; + $addr =~ s/\s//g; # strip whitespace + next unless $addr =~ m/\d+\.\d+\.\d+\.\d+/; # imperfect but useful IP addr check print " <node type=\"allow\" cidr=\"$addr/32\"/>\n"; } print "</list>\n"; @@ -25,7 +26,8 @@ print "</list>\n"; print "<list name=\"voip-abuse-netblocks\" default=\"deny\">\n"; foreach $netb (@netblocks) { - next unless $netb =~ m/\d+\.\d+\.\d+\.\d+/; + $netb =~ s/\s//g; # strip whitespace + next unless $netb =~ m/\d+\.\d+\.\d+\.\d+/; # imperfect but useful IP addr check print " <node type=\"allow\" cidr=\"$netb\"/>\n"; } print "</list>\n"; commit 5c128405b836188ba02f989c0c682fb77c6de2f9 Author: David Yat Sin <dyatsin@sangoma.com> Date: Fri Nov 19 14:41:26 2010 -0500 Fix for windows compile errors introduced during previous merge diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index d8c0e48..81a98cf 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -273,6 +273,10 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ uint32_t get_unique_suInstId(int16_t cc_id); void clear_call_data(sngisdn_chan_data_t *sngisdn_info); void clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info); +ftdm_status_t get_ftdmchan_by_suInstId(int16_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data); +ftdm_status_t get_ftdmchan_by_spInstId(int16_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data); + + ftdm_status_t sngisdn_set_avail_rate(ftdm_span_t *span, sngisdn_avail_t avail); ftdm_status_t sngisdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t trace_opt); @@ -354,6 +358,15 @@ void sngisdn_rcv_cc_ind(CcMngmt *status); void sngisdn_rcv_sng_log(uint8_t level, char *fmt,...); void sngisdn_rcv_sng_assert(char *message); +ftdm_status_t cpy_calling_num_from_stack(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb); +ftdm_status_t cpy_called_num_from_stack(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb); +ftdm_status_t cpy_redir_num_from_stack(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb); +ftdm_status_t cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *display); +ftdm_status_t cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm); +ftdm_status_t cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm); +ftdm_status_t cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm); +ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan); + uint8_t sngisdn_get_infoTranCap_from_stack(ftdm_bearer_cap_t bearer_capability); uint8_t sngisdn_get_usrInfoLyr1Prot_from_stack(ftdm_user_layer1_prot_t layer1_prot); ftdm_bearer_cap_t sngisdn_get_infoTranCap_from_user(uint8_t bearer_capability); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 7871deb..056bf66 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -319,7 +319,7 @@ ftdm_status_t cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_caller_data_t *ft } -ftm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan) +ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan) { uint8_t len; ftdm_caller_data_t *ftdm = &ftdmchan->caller_data; commit 553255c63195ecbc87cdaa72394e425bc6a0f52a Author: David Yat Sin <dyatsin@sangoma.com> Date: Fri Nov 19 14:33:57 2010 -0500 Fixed some windows compile warnings from merge diff --git a/conf/autoload_configs/callcenter.conf.xml b/conf/autoload_configs/callcenter.conf.xml index a069413..9140193 100644 --- a/conf/autoload_configs/callcenter.conf.xml +++ b/conf/autoload_configs/callcenter.conf.xml @@ -13,7 +13,6 @@ <param name="time-base-score" value="system"/> <param name="max-wait-time" value="0"/> <param name="max-wait-time-with-no-agent" value="0"/> - <param name="max-wait-time-with-no-agent-time-reached" value="5"/> <param name="tier-rules-apply" value="false"/> <param name="tier-rule-wait-second" value="300"/> <param name="tier-rule-wait-multiply-level" value="true"/> diff --git a/conf/autoload_configs/erlang_event.conf.xml b/conf/autoload_configs/erlang_event.conf.xml index 62deb84..ec14e21 100644 --- a/conf/autoload_configs/erlang_event.conf.xml +++ b/conf/autoload_configs/erlang_event.conf.xml @@ -2,16 +2,7 @@ <settings> <param name="listen-ip" value="0.0.0.0"/> <param name="listen-port" value="8031"/> - <!-- Specify the first part of the node name - (the host part after the @ will be autodetected) - OR pass a complete nodename to avoid autodetection - eg. freeswitch@example or freeswitch@example.com. - If you pass a complete node name, the 'shortname' parameter has no effect. --> - <param name="nodename" value="freeswitch"/> - <!-- Specify this OR 'cookie-file' or $HOME/.erlang.cookie will be read --> <param name="cookie" value="ClueCon"/> - <!-- Read a cookie from an arbitary erlang cookie file instead --> - <!--<param name="cookie-file" value="/tmp/erlang.cookie"/>--> <param name="shortname" value="true"/> <!-- in additon to cookie, optionally restrict by ACL --> <!--<param name="apply-inbound-acl" value="lan"/>--> diff --git a/conf/autoload_configs/modules.conf.xml b/conf/autoload_configs/modules.conf.xml index f5627fe..90d66f5 100644 --- a/conf/autoload_configs/modules.conf.xml +++ b/conf/autoload_configs/modules.conf.xml @@ -1,113 +1,17 @@ <configuration name="modules.conf" description="Modules"> <modules> - <!-- Loggers (I'd load these first) --> <load module="mod_console"/> <load module="mod_logfile"/> - <!-- <load module="mod_syslog"/> --> - - <!--<load module="mod_yaml"/>--> - - <!-- Multi-Faceted --> - <!-- mod_enum is a dialplan interface, an application interface and an api command interface --> - <load module="mod_enum"/> - - <!-- XML Interfaces --> - <!-- <load module="mod_xml_rpc"/> --> - <!-- <load module="mod_xml_curl"/> --> - <!-- <load module="mod_xml_cdr"/> --> - - <!-- Event Handlers --> - <load module="mod_cdr_csv"/> - <!-- <load module="mod_event_multicast"/> --> <load module="mod_event_socket"/> - <!-- <load module="mod_zeroconf"/> --> - <!-- <load module="mod_erlang_event"/> --> - - <!-- Directory Interfaces --> - <!-- <load module="mod_ldap"/> --> - - <!-- Endpoints --> - <!-- <load module="mod_dingaling"/> --> - <!-- <load module="mod_portaudio"/> --> - <!-- <load module="mod_alsa"/> --> <load module="mod_sofia"/> - <load module="mod_loopback"/> - <!-- <load module="mod_woomera"/> --> - <!-- <load module="mod_freetdm"/> --> - <!-- <load module="mod_openzap"/> --> - <!-- <load module="mod_unicall"/> --> - <!-- <load module="mod_skinny"/> --> - - <!-- Applications --> <load module="mod_commands"/> - <load module="mod_conference"/> - <load module="mod_db"/> <load module="mod_dptools"/> <load module="mod_expr"/> - <load module="mod_fifo"/> - <load module="mod_hash"/> - <load module="mod_voicemail"/> - <!--<load module="mod_directory"/>--> - <!--<load module="mod_lcr"/>--> - <load module="mod_esf"/> - <load module="mod_fsv"/> - <load module="mod_cluechoo"/> - <load module="mod_valet_parking"/> - <!--<load module="mod_spy"/>--> - - <!-- SNOM Module --> - <!--<load module="mod_snom"/>--> - - <!-- Dialplan Interfaces --> - <!-- <load module="mod_dialplan_directory"/> --> <load module="mod_dialplan_xml"/> - <load module="mod_dialplan_asterisk"/> - - <!-- Codec Interfaces --> - <load module="mod_spandsp"/> - <load module="mod_g723_1"/> - <load module="mod_g729"/> - <load module="mod_amr"/> - <load module="mod_ilbc"/> - <load module="mod_speex"/> - <load module="mod_h26x"/> - <load module="mod_siren"/> - <!--<load module="mod_celt"/>--> - - <!-- File Format Interfaces --> <load module="mod_sndfile"/> <load module="mod_native_file"/> - <!--For icecast/mp3 streams/files--> - <!--<load module="mod_shout"/>--> - <!--For local streams (play all the files in a directory)--> - <load module="mod_local_stream"/> - <load module="mod_tone_stream"/> - <load module="mod_file_string"/> - - <!-- Timers --> - - <!-- Languages --> - <load module="mod_spidermonkey"/> - <!-- <load module="mod_perl"/> --> - <!-- <load module="mod_python"/> --> - <!-- <load module="mod_java"/> --> - <load module="mod_lua"/> - - <!-- ASR /TTS --> - <!-- <load module="mod_flite"/> --> - <!-- <load module="mod_pocketsphinx"/> --> - <!-- <load module="mod_cepstral"/> --> - <!-- <load module="mod_tts_commandline"/> --> - <!-- <load module="mod_rss"/> --> - - <!-- Say --> <load module="mod_say_en"/> - <load module="mod_say_ru"/> - <!-- <load module="mod_say_zh"/> --> - - <!-- Third party modules --> - <!--<load module="mod_nibblebill"/>--> </modules> </configuration> diff --git a/conf/autoload_configs/switch.conf.xml b/conf/autoload_configs/switch.conf.xml index 896dd0e..7a68a7f 100644 --- a/conf/autoload_configs/switch.conf.xml +++ b/conf/autoload_configs/switch.conf.xml @@ -15,11 +15,6 @@ <key name="12" value="version"/> </cli-keybindings> - <default-ptimes> - <!-- set this to overide the 20ms assumption of various codecs in the sdp with no ptime defined --> - <!--<codec name="G729" ptime="40"/>--> - </default-ptimes> - <settings> <!--Colorize the Console --> <param name="colorize-console" value="true"/> @@ -86,7 +81,6 @@ <!-- <param name="core-db-dsn" value="dsn:username:password" /> --> <!-- The system will create all the db schemas automatically, set this to false to avoid this behaviour--> <!--<param name="auto-create-schemas" value="true"/>--> - <!-- <param name="core-dbtype" value="MSSQL"/> --> </settings> </configuration> diff --git a/conf/autoload_configs/voicemail.conf.xml b/conf/autoload_configs/voicemail.conf.xml index 06bd6f6..14ad98b 100644 --- a/conf/autoload_configs/voicemail.conf.xml +++ b/conf/autoload_configs/voicemail.conf.xml @@ -33,10 +33,9 @@ <param name="ff-key" value="6"/> <param name="rew-key" value="4"/> <param name="skip-greet-key" value="#"/> - <param name="previous-message-key" value="1"/>--> - <param name="next-message-key" value="3"/> - <param name="skip-info-key" value="*"/> - <param name="repeat-message-key" value="0"/> + <!--<param name="previous-message-key" value=""/>--> + <!--<param name="next-message-key" value=""/>--> + <!--<param name="skip-info-key" value=""/>--> <param name="record-silence-threshold" value="200"/> <param name="record-silence-hits" value="2"/> <param name="web-template-file" value="web-vm.tpl"/> diff --git a/conf/dialplan/default.xml b/conf/dialplan/default.xml index 42a3bcc..9e762b9 100644 --- a/conf/dialplan/default.xml +++ b/conf/dialplan/default.xml @@ -1,763 +1,88 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- - NOTICE: - - This context is usually accessed via authenticated callers on the sip profile on port 5060 - or transfered callers from the public context which arrived via the sip profile on port 5080. - - Authenticated users will use the user_context variable on the user to determine what context - they can access. You can also add a user in the directory with the cidr= attribute acl.conf.xml - will build the domains ACL using this value. ---> -<!-- http://wiki.freeswitch.org/wiki/Dialplan_XML --> -<include> - <context name="default"> - - <extension name="unloop"> - <condition field="${unroll_loops}" expression="^true$"/> - <condition field="${sip_looped_call}" expression="^true$"> - <action application="deflect" data="${destination_number}"/> - </condition> - </extension> - - <!-- Example of doing things based on time of day. - - year = 4 digit year. Example year="2009" - yday = 1-365 - mon = 1-12 - mday = 1-31 - week = 1-52 - mweek= 1-6 - wday = 1-7 - hour = 0-23 - minute = 0-59 - minute-of-day = 1-1440 - - Example: - <condition minute-of-day="540-1080"> (9am to 6pm EVERY day) - do something ... - </condition> - --> - <extension name="tod_example" continue="true"> - <condition wday="2-6" hour="9-18"> - <action application="set" data="open=true"/> - </condition> - </extension> - - <!-- Example of routing based on holidays - - This example covers all US Federal holidays except for inauguration day. - --> - - <extension name="holiday_example" continue="true"> - <condition mday="1" mon="1"> - <!-- new year's day --> - <action application="set" data="open=false"/> - </condition> - <condition wday="2" mweek="3" mon="1"> - <!-- martin luther king day is the 3rd monday in january --> - <action application="set" data="open=false"/> - </condition> - <condition wday="2" mweek="3" mon="2"> - <!-- president's day is the 3rd monday in february --> - <action application="set" data="open=false"/> - </condition> - <condition wday="2" mon="5" mday="25-31"> - <!-- memorial day is the last monday in may (the only monday between the 25th and the 31st) --> - <action application="set" data="open=false"/> - </condition> - <condition mday="4" mon="7"> - <!-- independence day --> - <action application="set" data="open=false"/> - </condition> - <condition wday="2" mweek="1" mon="9"> - <!-- labor day is the 1st monday in september --> - <action application="set" data="open=false"/> - </condition> - <condition wday="2" mweek="2" mon="10"> - <!-- columbus day is the 2nd monday in october --> - <action application="set" data="open=false"/> - </condition> - <condition mday="11" mon="11"> - <!-- veteran's day --> - <action application="set" data="open=false"/> - </condition> - <condition wday="5-6" mweek="4" mon="11"> - <!-- thanksgiving is the 4th thursday in november and usually there's an extension for black friday --> - <action application="set" data="open=false"/> - </condition> - <condition mday="25" mon="12"> - <!-- Christmas --> - <action application="set" data="open=false"/> - </condition> - </extension> - - <extension name="global-intercept"> - <condition field="destination_number" expression="^886$"> - <action application="answer"/> - <action application="intercept" data="${hash(select/${domain_name}-last_dial_ext/global)}"/> - <action application="sleep" data="2000"/> - </condition> - </extension> - - <extension name="group-intercept"> - <condition field="destination_number" expression="^\*8$"> - <action application="answer"/> - <action application="intercept" data="${hash(select/${domain_name}-last_dial_ext/${callgroup})}"/> - <action application="sleep" data="2000"/> - </condition> - </extension> - - <extension name="intercept-ext"> - <condition field="destination_number" expression="^\*\*(\d+)$"> - <action application="answer"/> - <action application="intercept" data="${hash(select/${domain_name}-last_dial_ext/$1)}"/> - <action application="sleep" data="2000"/> - </condition> - </extension> - - <extension name="redial"> - <condition field="destination_number" expression="^(redial|870)$"> - <action application="transfer" data="${hash(select/${domain_name}-last_dial/${caller_id_number})}"/> - </condition> - </extension> - - <extension name="global" continue="true"> - <condition field="${call_debug}" expression="^true$" break="never"> - <action application="info"/> - </condition> - <!-- - This is an example of how to auto detect if telephone-event is missing and activate inband detection - --> - <!-- - <condition field="${switch_r_sdp}" expression="a=rtpmap:(\d+)\stelephone-event/8000" break="never"> - <action application="set" data="rtp_payload_number=$1"/> - <anti-action application="start_dtmf"/> - </condition> - --> - <condition field="${sip_has_crypto}" expression="^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$" break="never"> - <action application="set" data="sip_secure_media=true"/> - <!-- Offer SRTP on outbound legs if we have it on inbound. --> - <!-- <action application="export" data="sip_secure_media=true"/> --> - </condition> - - <condition> - <action application="hash" data="insert/${domain_name}-spymap/${caller_id_number}/${uuid}"/> - <action application="hash" data="insert/${domain_name}-last_dial/${caller_id_number}/${destination_number}"/> - <action application="hash" data="insert/${domain_name}-last_dial/global/${uuid}"/> - <action application="set" data="RFC2822_DATE=${strftime(%a, %d %b %Y %T %z)}"/> - </condition> - </extension> - - <!-- If sip_req_host is not a local domain then this has to be an external sip uri --> - <!-- - <extension name="external_sip_uri" continue="true"> - <condition field="source" expression="mod_sofia"/> - <condition field="${outside_call}" expression="^$"/> - <condition field="${domain_exists(${sip_req_host})}" expression="true"> - <anti-action application="bridge" data="sofia/${use_profile}/${sip_to_uri}"/> - </condition> - </extension> - --> - <!-- - Snom button demo, call 9000 to make button 2 mapped to transfer the current call to a conference - --> - - <extension name="snom-demo-2"> - <condition field="destination_number" expression="^9001$"> - <action application="eval" data="${snom_bind_key(2 off DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message notused)}"/> - <action application="transfer" data="3000"/> - </condition> - </extension> - - <extension name="snom-demo-1"> - <condition field="destination_number" expression="^9000$"> - <!--<key> <light> <label> <user> <host> <profile> <action_name> <action>--> - <action application="eval" data="${snom_bind_key(2 on DND ${sip_from_user} ${sip_from_host} ${sofia_profile_name} message api+uuid_transfer ${uuid} 9001)}"/> - <action application="playback" data="$${hold_music}"/> - </condition> - </extension> - - <extension name="eavesdrop"> - <condition field="destination_number" expression="^88(\d{4})$|^\*0(.*)$"> - <action application="answer"/> - <action application="eavesdrop" data="${hash(select/${domain_name}-spymap/$1)}"/> - </condition> - </extension> - - <extension name="eavesdrop"> - <condition field="destination_number" expression="^779$"> - <action application="answer"/> - <action application="set" data="eavesdrop_indicate_failed=tone_stream://%(500, 0, 320)"/> - <action application="set" data="eavesdrop_indicate_new=tone_stream://%(500, 0, 620)"/> - <action application="set" data="eavesdrop_indicate_idle=tone_stream://%(250, 0, 920)"/> - <action application="eavesdrop" data="all"/> - </condition> - </extension> - - <extension name="call_return"> - <condition field="destination_number" expression="^\*69$|^869$|^lcr$"> - <action application="transfer" data="${hash(select/${domain_name}-call_return/${caller_id_number})}"/> - </condition> - </extension> - - <extension name="del-group"> - <condition field="destination_number" expression="^80(\d{2})$"> - <action application="answer"/> - <action application="group" data="delete:$1@${domain_name}:${sofia_contact(${sip_from_user}@${domain_name})}"/> - <action application="gentones" data="%(1000, 0, 320)"/> - </condition> - </extension> - - <extension name="add-group"> - <condition field="destination_number" expression="^81(\d{2})$"> - <action application="answer"/> - <action application="group" data="insert:$1@${domain_name}:${sofia_contact(${sip_from_user}@${domain_name})}"/> - <action application="gentones" data="%(1000, 0, 640)"/> - </condition> - </extension> - - <extension name="call-group-simo"> - <condition field="destination_number" expression="^82(\d{2})$"> - <action application="bridge" data="{leg_timeout=15,ignore_early_media=true}${group(call:$1@${domain_name})}"/> - </condition> - </extension> - - <extension name="call-group-order"> - <condition field="destination_number" expression="^83(\d{2})$"> - <action application="bridge" data="{leg_timeout=15,ignore_early_media=true}${group(call:$1@${domain_name}:order)}"/> - </condition> - </extension> - - <extension name="extension-intercom"> - <condition field="destination_number" expression="^8(10[01][0-9])$"> - <action application="set" data="dialed_extension=$1"/> - <action application="export" data="sip_auto_answer=true"/> - <action application="bridge" data="user/${dialed_extension}@${domain_name}"/> - </condition> - </extension> - - <!-- - dial the extension (1000-1019) for 30 seconds and go to voicemail if the - call fails (continue_on_fail=true), otherwise hang up after a successful - bridge (hangup_after_bridge=true) - --> - <extension name="Local_Extension"> - <condition field="destination_number" expression="^(10[01][0-9])$"> - <action application="set" data="dialed_extension=$1"/> - <action application="export" data="dialed_extension=$1"/> - <!-- bind_meta_app can have these args <key> [a|b|ab] [a|b|o|s] <app> --> - <action application="bind_meta_app" data="1 b s execute_extension::dx XML features"/> - <action application="bind_meta_app" data="2 b s record_session::$${recordings_dir}/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/> - <action application="bind_meta_app" data="3 b s execute_extension::cf XML features"/> - <action application="bind_meta_app" data="4 b s execute_extension::att_xfer XML features"/> - <action application="set" data="ringback=${us-ring}"/> - <action application="set" data="transfer_ringback=$${hold_music}"/> - <action application="set" data="call_timeout=30"/> - <!-- <action application="set" data="sip_exclude_contact=${network_addr}"/> --> - <action application="set" data="hangup_after_bridge=true"/> - <!--<action application="set" data="continue_on_fail=NORMAL_TEMPORARY_FAILURE,USER_BUSY,NO_ANSWER,TIMEOUT,NO_ROUTE_DESTINATION"/> --> - <action application="set" data="continue_on_fail=true"/> - <action application="hash" data="insert/${domain_name}-call_return/${dialed_extension}/${caller_id_number}"/> - <action application="hash" data="insert/${domain_name}-last_dial_ext/${dialed_extension}/${uuid}"/> - <action application="hash" data="insert/${domain_name}-last_dial_ext/${called_party_callgroup}/${uuid}"/> - <action application="hash" data="insert/${domain_name}-last_dial_ext/global/${uuid}"/> - <action application="set" data="called_party_callgroup=${user_data(${dialed_extension}@${domain_name} var callgroup)}"/> - <!--<action application="export" data="nolocal:sip_secure_media=${user_data(${dialed_extension}@${domain_name} var sip_secure_media)}"/>--> - <action application="hash" data="insert/${domain_name}-last_dial/${called_party_callgroup}/${uuid}"/> - <action application="bridge" data="{sip_invite_domain=$${domain}}user/${dialed_extension}@${domain_name}"/> - <action application="answer"/> - <action application="sleep" data="1000"/> - <action application="bridge" data="loopback/app=voicemail:default ${domain_name} ${dialed_extension}"/> - </condition> - </extension> - - <extension name="Local_Extension_Skinny"> - <condition field="destination_number" expression="^(11[01][0-9])$"> - <action application="bridge" data="skinny/internal/${destination_number}"/> - </condition> - </extension> - - <extension name="group_dial_sales"> - <condition field="destination_number" expression="^2000$"> - <action application="bridge" data="${group_call(sales@${domain_name})}"/> - </condition> - </extension> - - <extension name="group_dial_support"> - <condition field="destination_number" expression="^2001$"> - <action application="bridge" data="group/support@${domain_name}"/> - </condition> - </extension> - - <extension name="group_dial_billing"> - <condition field="destination_number" expression="^2002$"> - <action application="bridge" data="group/billing@${domain_name}"/> - </condition> - </extension> - - <!-- voicemail operator extension --> - <extension name="operator"> - <condition field="destination_number" expression="^(operator|0)$"> - <action application="set" data="transfer_ringback=$${hold_music}"/> - <action application="transfer" data="1000 XML features"/> - </condition> - </extension> - - <!-- voicemail main extension --> - <extension name="vmain"> - <condition field="destination_number" expression="^vmain$|^4000$|^\*98$"> - <action application="answer"/> - <action application="sleep" data="1000"/> - <action application="voicemail" data="check default ${domain_name}"/> - </condition> - </extension> - - <!-- - This extension is used by mod_portaudio so you can pa call sip:someone@example.com - mod_portaudio will pass the entire string to the dialplan for routing. - --> - <extension name="sip_uri"> - <condition field="destination_number" expression="^sip:(.*)$"> - <action application="bridge" data="sofia/${use_profile}/$1"/> - </condition> - </extension> - - <!-- - start a dynamic conference with the settings of the "default" conference profile in conference.conf.xml - --> - <extension name="nb_conferences"> - <condition field="destination_number" expression="^(30\d{2})$"> - <action application="answer"/> - <action application="conference" data="$1-${domain_name}@default"/> - </condition> - </extension> - - <extension name="wb_conferences"> - <condition field="destination_number" expression="^(31\d{2})$"> - <action application="answer"/> - <action application="conference" data="$1-${domain_name}@wideband"/> - </condition> - </extension> - - <extension name="uwb_conferences"> - <condition field="destination_number" expression="^(32\d{2})$"> - <action application="answer"/> - <action application="conference" data="$1-${domain_name}@ultrawideband"/> - </condition> - </extension> - <!-- MONO 48kHz conferences --> - <extension name="cdquality_conferences"> - <condition field="destination_number" expression="^(33\d{2})$"> - <action application="answer"/> - <action application="conference" data="$1-${domain_name}@cdquality"/> - </condition> - </extension> - - <!-- dial the FreeSWITCH conference via SIP--> - <extension name="freeswitch_public_conf_via_sip"> - <condition field="destination_number" expression="^9(888|8888|1616|3232)$"> - <action application="export" data="hold_music=silence"/> - <!-- - This will take the SAS from the b-leg and send it to the display on the a-leg phone. - Known working with Polycom and Snom maybe others. - --> - <!-- - <action application="set" data="exec_after_bridge_app=${sched_api(+4 zrtp expand uuid_display ${uuid} \${uuid_getvar(\${uuid_getvar(${uuid} signal_bond)} zrtp_sas1_string )} \${uuid_getvar(\${uuid_getvar(${uuid} signal_bond)} zrtp_sas2_string )} )}"/> - <action application="export" data="nolocal:zrtp_secure_media=true"/> - --> - <action application="bridge" data="sofia/${use_profile}/$1@conference.freeswitch.org"/> - </condition> - </extension> - - <!-- - This extension will start a conference and invite a group. - At anytime the participant can dial *2 to bridge directly to the boss. - All other callers are then hung up on. - --> - <extension name="mad_boss_intercom"> - <condition field="destination_number" expression="^0911$"> - <action application="set" data="conference_auto_outcall_caller_id_name=Mad Boss1"/> - <action application="set" data="conference_auto_outcall_caller_id_number=0911"/> - <action application="set" data="conference_auto_outcall_timeout=60"/> - <action application="set" data="conference_auto_outcall_flags=mute"/> - <action application="set" data="conference_auto_outcall_prefix={sip_auto_answer=true,execute_on_answer='bind_meta_app 2 a s1 transfer::intercept:${uuid} inline'}"/> - <action application="set" data="sip_exclude_contact=${network_addr}"/> - <action application="conference_set_auto_outcall" data="${group_call(sales)}"/> - <action application="conference" data="madboss_intercom1@default+flags{endconf|deaf}"/> - </condition> - </extension> - - <!-- - This extension will start a conference and invite a few of people. - At anytime the participant can dial *2 to bridge directly to the boss. - All other callers are then hung up on. - --> - <extension name="mad_boss_intercom"> - <condition field="destination_number" expression="^0912$"> - <action application="set" data="conference_auto_outcall_caller_id_name=Mad Boss2"/> - <action application="set" data="conference_auto_outcall_caller_id_number=0912"/> - <action application="set" data="conference_auto_outcall_timeout=60"/> - <action application="set" data="conference_auto_outcall_flags=mute"/> - <action application="set" data="conference_auto_outcall_prefix={sip_auto_answer=true,execute_on_answer='bind_meta_app 2 a s1 transfer::intercept:${uuid} inline'}"/> - <action application="set" data="sip_exclude_contact=${network_addr}"/> - <action application="conference_set_auto_outcall" data="loopback/9664"/> - <action application="conference" data="madboss_intercom2@default+flags{endconf|deaf}"/> - </condition> - </extension> - <!--This extension will start a conference and invite several people upon entering --> - <extension name="mad_boss"> - <condition field="destination_number" expression="^0913$"> - <!--These params effect the outcalls made once you join--> - <action application="set" data="conference_auto_outcall_caller_id_name=Mad Boss"/> - <action application="set" data="conference_auto_outcall_caller_id_number=0911"/> - <action application="set" data="conference_auto_outcall_timeout=60"/> - <action application="set" data="conference_auto_outcall_flags=none"/> - <!--<action application="set" data="conference_auto_outcall_announce=say:You have been called into an emergency conference"/>--> - <!--Add as many of these as you need, These are the people you are going to call--> - <action application="conference_set_auto_outcall" data="loopback/9664"/> - <action application="conference" data="madboss3@default"/> - </condition> - </extension> - - <!-- a sample IVR --> - <extension name="ivr_demo"> - <condition field="destination_number" expression="^5000$"> - <action application="answer"/> - <action application="sleep" data="2000"/> - <action application="ivr" data="demo_ivr"/> - </condition> - </extension> - - <!-- Create a conference on the fly and pull someone in at the same time. --> - <extension name="dynamic_conference"> - <condition field="destination_number" expression="^5001$"> - <action application="conference" data="bridge:mydynaconf:sofia/${use_profile}/1234@conference.freeswitch.org"/> - </condition> - </extension> - - <extension name="rtp_multicast_page"> - <condition field="destination_number" expression="^pagegroup$|^7243$"> - <action application="answer"/> - <action application="esf_page_group"/> - </condition> - </extension> - - <!-- - Parking extensions... transferring calls to 5900 will park them in a queue. - --> - <extension name="park"> - <condition field="destination_number" expression="^5900$"> - <action application="set" data="fifo_music=$${hold_music}"/> - <action application="fifo" data="5900@${domain_name} in"/> - </condition> - </extension> - - <!-- - Parking pickup extension. Calling 5901 will pickup the call. - --> - <extension name="unpark"> - <condition field="destination_number" expression="^5901$"> - <action application="answer"/> - <action application="fifo" data="5900@${domain_name} out nowait"/> - </condition> - </extension> - - <!-- - Valet park retrieval, works with valet_park extension below. - Retrieve a valet parked call by dialing 6000 + park number + # - --> - <extension name="valet_park"> - <condition field="destination_number" expression="^(6000)$"> - <action application="answer"/> - <action application="valet_park" data="valet_parking_lot ask 1 11 10000 ivr/ivr-enter_ext_pound.wav"/> - </condition> - </extension> - - <!-- - Valet park 6001-6099. Blind x-fer to 6001, 6002, etc. to valet park the call. - Dial 6001, 6002, etc. to retrieve a call that is already valet parked. - After call is retrieved, park extension is free for another call. - --> - <extension name="valet_park"> - <condition field="destination_number" expression="^(60\d[1-9])$"> - <action application="answer"/> - <action application="valet_park" data="valet_parking_lot $1"/> - </condition> - </extension> - - - <!-- - This extension is used with Snom phones. - - Set a function key to park+lot (lot being a number or name.) - Set type to Park+Orbit. You can then park and pickup using - the softkey on the phone. Should work with other phones. - --> - <extension name="park"> - <condition field="source" expression="mod_sofia"/> - <condition field="destination_number" expression="park\+(\d+)"> - <action application="fifo" data="$1@${domain_name} in undef $${hold_music}"/> - </condition> - </extension> - <!-- - The extension is parking pickup with a to param of the fifo we are calling - Some phones send things like orbit= and you can extract that info. - --> - <extension name="unpark"> - <condition field="source" expression="mod_sofia"/> - <condition field="destination_number" expression="^parking$"/> - <condition field="${sip_to_params}" expression="fifo\=(\d+)"> - <action application="answer"/> - <action application="fifo" data="$1@${domain_name} out nowait"/> - </condition> - </extension> - - <!-- - This extension is used with Linksys phones. - - Set a Phone tab option Call Park Serv to yes. You can park and - pickup using soft keys "park" and "unpark" found during - active call when moving navigation button. The other option - is to use phone's star codes (defaults to *38 and *39). - --> - <extension name="park"> - <condition field="source" expression="mod_sofia"/> - <condition field="destination_number" expression="callpark"/> - <condition field="${sip_refer_to}"> - <expression><![CDATA[<sip:callpark@${domain_name};orbit=(\d+)>]]></expression> - <action application="fifo" data="$1@${domain_name} in undef $${hold_music}"/> - </condition> - </extension> - - <!-- - This extension is used with Linksys phones. - - The extension is parking pickup with a to param of the fifo - we are calling. Linksys sends orbit=<parkingslotnumber> - and we extract that info. - --> - <extension name="unpark"> - <condition field="source" expression="mod_sofia"/> - <condition field="destination_number" expression="pickup"/> - <condition field="${sip_to_params}" expression="orbit\=(\d+)"> - <action application="answer"/> - <action application="fifo" data="$1@${domain_name} out nowait"/> - </condition> - </extension> - - <!-- - Here are some examples of how to override the ringback heard by the - far end. You have two variables that you can use to override this. - - ringback - used when a call isn't answered. (early media) - transfer_ringback - used when the call is already answered. (post answer) - --> - - <!-- Demonstration of how to override the ringback in various situations --> - <extension name="wait"> - <condition field="destination_number" expression="^wait$"> - <action application="pre_answer"/> - <action application="sleep" data="20000"/> - <action application="answer"/> - <action application="sleep" data="1000"/> - <action application="playback" data="voicemail/vm-goodbye.wav"/> - <action application="hangup"/> - </condition> - </extension> - - <extension name="fax_receive"> - <condition field="destination_number" expression="^9178$"> - <action application="answer" /> - <action application="playback" data="silence_stream://2000"/> - <action application="rxfax" data="/tmp/rxfax.tif"/> - <action application="hangup"/> - </condition> - </extension> - - <extension name="fax_transmit"> - <condition field="destination_number" expression="^9179$"> - <action application="txfax" data="/tmp/txfax.tif"/> - <action application="hangup"/> - </condition> - </extension> - - <!-- Send a 180 and let the far end generate ringback. --> - <extension name="ringback_180"> - <condition field="destination_number" expression="^9180$"> - <action application="ring_ready"/> - <action application="sleep" data="20000"/> - <action application="answer"/> - <action application="sleep" data="1000"/> - <action application="playback" data="voicemail/vm-goodbye.wav"/> - <action application="hangup"/> - </condition> - </extension> - - <!-- Send a 183 and send uk-ring as the ringtone. (early media) --> - <extension name="ringback_183_uk_ring"> - <condition field="destination_number" expression="^9181$"> - <action application="set" data="ringback=$${uk-ring}"/> - <action application="bridge" data="{ignore_early_media=true}loopback/wait"/> - </condition> - </extension> - - <!-- Send a 183 and use music as the ringtone. (early media) --> - <extension name="ringback_183_music_ring"> - <condition field="destination_number" expression="^9182$"> - <action application="set" data="ringback=$${hold_music}"/> - <action application="bridge" data="{ignore_early_media=true}loopback/wait"/> - </condition> - </extension> - - <!-- Answer the call and use music as the ringtone. (post answer) --> - <extension name="ringback_post_answer_uk_ring"> - <condition field="destination_number" expression="^9183$"> - <action application="set" data="transfer_ringback=$${uk-ring}"/> - <action application="answer"/> - <action application="bridge" data="{ignore_early_media=true}loopback/wait"/> - </condition> - </extension> - - <!-- Answer the call and use music as the ringtone. (post answer) --> - <extension name="ringback_post_answer_music"> - <condition field="destination_number" expression="^9184$"> - <action application="set" data="transfer_ringback=$${hold_music}"/> - <action application="answer"/> - <action application="bridge" data="{ignore_early_media=true}loopback/wait"/> - </condition> - </extension> - - <extension name="ClueCon"> - <condition field="destination_number" expression="^9191$"> - <action application="set" data="effective_caller_id_name=ClueCon IVR"/> - <action application="bridge" data="sofia/$${domain}/2000@bkw.org"/> - </condition> - </extension> - - <extension name="show_info"> - <condition field="destination_number" expression="^9192$"> - <action application="answer"/> - <action application="info"/> - <action application="sleep" data="250"/> - <action application="hangup"/> - </condition> - </extension> - - <extension name="video_record"> - <condition field="destination_number" expression="^9193$"> - <action application="answer"/> - <action application="record_fsv" data="/tmp/testrecord.fsv"/> - </condition> - </extension> - - <extension name="video_playback"> - <condition field="destination_number" expression="^9194$"> - <action application="answer"/> - <action application="play_fsv" data="/tmp/testrecord.fsv"/> - </condition> - </extension> - - <extension name="delay_echo"> - <condition field="destination_number" expression="^9195$"> - <action application="answer"/> - <action application="delay_echo" data="5000"/> - </condition> - </extension> - - <extension name="echo"> - <condition field="destination_number" expression="^9196$"> - <action application="answer"/> - <action application="echo"/> - </condition> - </extension> - - <extension name="milliwatt"> - <condition field="destination_number" expression="^9197$"> - <action application="answer"/> - <action application="playback" data="tone_stream://%(251,0,1004);loops=-1"/> - </condition> - </extension> - - <extension name="tone_stream"> - <condition field="destination_number" expression="^9198$"> - <action application="answer"/> - <action application="playback" data="tone_stream://path=${base_dir}/conf/tetris.ttml;loops=10"/> - </condition> - </extension> - - <!-- install zrtp_agent.lua into scripts (ZRTP == 9787) --> - <extension name="zrtp_enrollement"> - <condition field="destination_number" expression="^9787$"> - <action application="lua" data="zrtp_agent.lua"/> - </condition> - </extension> - - <!-- - You will no longer hear the bong tone. The wav file is playing stating the call is secure. - The file will not play unless you have both TLS and SRTP active. - --> - - <extension name="hold_music"> - <condition field="destination_number" expression="^9664$"/> - <condition field="${sip_has_crypto}" expression="^(AES_CM_128_HMAC_SHA1_32|AES_CM_128_HMAC_SHA1_80)$"> - <action application="answer"/> - <action application="execute_extension" data="is_secure XML features"/> - <action application="playback" data="$${hold_music}"/> - <anti-action application="set" data="zrtp_secure_media=true"/> - <anti-action application="answer"/> - <anti-action application="playback" data="silence_stream://2000"/> - <anti-action application="execute_extension" data="is_zrtp_secure XML features"/> - <anti-action application="playback" data="$${hold_music}"/> - </condition> - </extension> - - <!-- - You can place files in the default directory to get included. - --> - <X-PRE-PROCESS cmd="include" data="default/*.xml"/> - - <!-- - <extension name="refer"> - <condition field="${sip_refer_to}"> - <expression><![CDATA[<sip:${destination_number}@${domain_name}>]]></expression> - </condition> - <condition field="${sip_refer_to}"> - <expression><![CDATA[<sip:(.*)@(.*)>]]></expression> - <action application="set" data="refer_user=$1"/> - <action application="set" data="refer_domain=$2"/> - <action application="info"/> - <action application="bridge" data="sofia/${use_profile}/${refer_user}@${refer_domain}"/> - </condition> - </extension> - --> - <!-- - This is an example of how to override the RURI on an outgoing invite to a registered contact. - --> - <!-- - <extension name="ruri"> - <condition field="destination_number" expression="^ruri$"> - <action application="bridge" data="sofia/${ruri_profile}/${ruri_user}${regex(${sofia_contact(${ruri_contact})}|^[^\@]+(.*)|%1)}"/> - </condition> - </extension> - - <extension name="7004"> - <condition field="destination_number" expression="^7004$"> - <action application="set" data="ruri_profile=default"/> - <action application="set" data="ruri_user=2000"/> - <action application="set" data="ruri_contact=1001@${domain_name}"/> - <action application="execute_extension" data="ruri"/> - </condition> - </extension> - --> - - <extension name="enum"> - <condition field="${module_exists(mod_enum)}" expression="true"/> - <condition field="destination_number" expression="^(.*)$"> - <action application="transfer" data="$1 enum"/> - </condition> - </extension> - - </context> +<include> +<context name="public"> + <extension name="outbound-service"> + <condition field="destination_number" expression="^service$"> + </condition> + </extension> + <extension name="outbound132"> + <condition field="destination_number" expression="^132$"> + <action application="set" data="origination_caller_id_name=sipp"/> + <action application="set" data="origination_caller_id_number=987654321"/> + <action application="set" data="call_timeout=80"/> + <action application="bridge" data="freetdm/grp1/a/132"/> + </condition> + </extension> + +service <extension name="outbound"> + <condition field="destination_number" expression="(.*)"> + <action application="set" data="dialed_number=$1"/> + <!-- <action application="answer"/> --> + <action application="set" data="caller_id_name=sipp"/> + <action application="set" data="effective_caller_id_number=987654321"/> + <action application="set_profile_var" data="caller_ton=1"/> + <action application="set_profile_var" data="caller_numplan=0"/> + <action application="set_profile_var" data="destination_number_ton=1"/> + <action application="set_profile_var" data="destination_number_numplan=0"/> + <action application="bridge" data="freetdm/grp1/a/${dialed_number}"/> + </condition> + </extension> + +</context> +<context name="default"> + <extension name="fast-hangup"> + <condition field="destination_number" expression="123"> + <!-- <action application="sleep" data="1000"/> --> + <!-- <action application="answer"/> --> + <action application="answer"/> + <action application="playback" data="/usr/local/freeswitch/sounds/demo-congrats.gsm" /> + <action application="playback" data="/usr/local/freeswitch/sounds/demo-congrats.gsm" /> + <action application="playback" data="/usr/local/freeswitch/sounds/demo-congrats.gsm" /> + <action application="playback" data="/usr/local/freeswitch/sounds/demo-congrats.gsm" /> + <action application="playback" data="/usr/local/freeswitch/sounds/demo-congrats.gsm" /> + <action application="playback" data="/usr/local/freeswitch/sounds/demo-congrats.gsm" /> + <action application="playback" data="/usr/local/freeswitch/sounds/demo-congrats.gsm" /> + <action application="playback" data="/usr/local/freeswitch/sounds/demo-congrats.gsm" /> + <action application="playback" data="/usr/local/freeswitch/sounds/demo-congrats.gsm" /> + <action application="playback" data="/usr/local/freeswitch/sounds/demo-congrats.gsm" /> + <action application="hangup" /> + </condition> + </extension> + <extension name="slow-hangup"> + <condition field="destination_number" expression="124"> + <action application="answer"/> + <action application="playback" data="c:\cygwin\home\davidy\smg_freeswitch.netborder\Debug\sounds\tt-monkeys.gsm" /> + <action application="hangup" /> + </condition> + </extension> + <extension name="answer-then-bridge"> + <condition field="destination_number" expression="125"> + <action application="answer"/> + <action application="bridge" data="sofia/$${domain}/123@192.168.1.144:5062"/> + <action application="hangup" /> + </condition> + </extension> + <extension name="just-bridge"> + <condition field="destination_number" expression="126"> + <!-- <action application="sleep" data="20000" /> --> + <!-- <action application="answer"/> --> + <!-- <action application="info" /> --> + <action application="log" data="DESTINATION_NUMBER [${destination_number}]" /> + <action application="log" data="CALLER_TON [${caller_ton}]" /> + <action application="log" data="CALLER_NPI [${caller_numplan}]" /> + <action application="log" data="DEST_TON [${destination_number_ton}]" /> + <action application="log" data="DEST_NPI [${destination_number_numplan}]" /> + <action application="bridge" data="sofia/$${domain}/123@192.168.1.145:5062"/> + <action application="hangup" /> + </condition> + </extension> + <extension name="other"> + <condition field="destination_number" expression="(.*)"> + <action application="log" data="CID_NAME [${caller_id_name}]" /> + <action application="bridge" data="sofia/$${domain}/123@192.168.1.145:5062"/> + <action application="hangup"/> + </condition> + </extension> +</context> </include> diff --git a/conf/sip_profiles/internal.xml b/conf/sip_profiles/internal.xml index 93558a3..50833bf 100644 --- a/conf/sip_profiles/internal.xml +++ b/conf/sip_profiles/internal.xml @@ -42,26 +42,6 @@ <!-- If you want FreeSWITCH to shutdown if this profile fails to load, uncomment the next line. --> <!-- <param name="shutdown-on-fail" value="true"/> --> <param name="sip-trace" value="no"/> - - <!-- - Sometimes, in extremely rare edge cases, the Sofia SIP stack may stop - responding. These options allow you to enable and control a watchdog - on the Sofia SIP stack so that if it stops responding for the - specified number of milliseconds, it will cause FreeSWITCH to shut - down immediately. This is useful if you run in an HA environment and - need to ensure automated recovery from such a condition. Note that if - your server is idle a lot, the watchdog may fire due to not receiving - any SIP messages. Thus, if you expect your system to be idle, you - should leave the watchdog disabled. It can be toggled on and off - through the FreeSWITCH CLI either on an individual profile basis or - globally for all profiles. So, if you run in an HA environment with a - master and slave, you should use the CLI to make sure the watchdog is - only enabled on the master. - --> - <param name="watchdog-enabled" value="no"/> - <param name="watchdog-step-timeout" value="30000"/> - <param name="watchdog-event-timeout" value="30000"/> - <param name="log-auth-failures" value="true"/> <param name="forward-unsolicited-mwi-notify" value="false"/> diff --git a/conf/skinny_profiles/internal.xml b/conf/skinny_profiles/internal.xml index 52da897..5feac1f 100644 --- a/conf/skinny_profiles/internal.xml +++ b/conf/skinny_profiles/internal.xml @@ -16,7 +16,7 @@ <soft-key-set-sets> <soft-key-set-set name="default"> <soft-key-set name="KeySetOnHook" value="SoftkeyNewcall,SoftkeyRedial"/> - <soft-key-set name="KeySetOffHook" value=",SoftkeyRedial,SoftkeyEndcall"/> + <soft-key-set name="KeySetOffHook" value=",SoftkeyNewcall,SoftkeyEndcall"/> <soft-key-set name="KeySetDigitsAfterDialingFirstDigit" value="SoftkeyBackspace,,SoftkeyEndcall"/> <soft-key-set name="KeySetConnected" value="SoftkeyEndcall,SoftkeyHold,SoftkeyNewcall,SoftkeyTransfer"/> <soft-key-set name="KeySetRingIn" value="SoftkeyAnswer,SoftkeyEndcall,SoftkeyNewcall"/> diff --git a/conf/vars.xml b/conf/vars.xml index fced2ef..c638a80 100644 --- a/conf/vars.xml +++ b/conf/vars.xml @@ -195,7 +195,7 @@ <!-- various debug and defaults --> <X-PRE-PROCESS cmd="set" data="call_debug=false"/> - <X-PRE-PROCESS cmd="set" data="console_loglevel=info"/> + <X-PRE-PROCESS cmd="set" data="console_loglevel=debug"/> <X-PRE-PROCESS cmd="set" data="default_areacode=918"/> <X-PRE-PROCESS cmd="set" data="default_country=US"/> diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 052fbd4..d8c0e48 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -270,9 +270,11 @@ extern ftdm_sngisdn_data_t g_sngisdn_data; ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *span); /* Support functions */ -FT_DECLARE(uint32_t) get_unique_suInstId(int16_t cc_id); -FT_DECLARE(void) clear_call_data(sngisdn_chan_data_t *sngisdn_info); -FT_DECLARE(void) clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info); +uint32_t get_unique_suInstId(int16_t cc_id); +void clear_call_data(sngisdn_chan_data_t *sngisdn_info); +void clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info); +ftdm_status_t sngisdn_set_avail_rate(ftdm_span_t *span, sngisdn_avail_t avail); +ftdm_status_t sngisdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t trace_opt); void stack_hdr_init(Header *hdr); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c index d8e6c8e..225244f 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c @@ -41,7 +41,6 @@ ftdm_status_t sngisdn_activate_phy(ftdm_span_t *span); ftdm_status_t sngisdn_deactivate_phy(ftdm_span_t *span); ftdm_status_t sngisdn_activate_cc(ftdm_span_t *span); -ftdm_status_t sngisdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t trace_opt); ftdm_status_t sngisdn_cntrl_q931(ftdm_span_t *span, uint8_t action, uint8_t subaction); ftdm_status_t sngisdn_cntrl_q921(ftdm_span_t *span, uint8_t action, uint8_t subaction); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 7e08307..7871deb 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -39,7 +39,7 @@ ftdm_status_t sngisdn_check_free_ids(void); extern ftdm_sngisdn_data_t g_sngisdn_data; void get_memory_info(void); -FT_DECLARE(void) clear_call_data(sngisdn_chan_data_t *sngisdn_info) +void clear_call_data(sngisdn_chan_data_t *sngisdn_info) { uint32_t cc_id = ((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->cc_id; @@ -56,7 +56,7 @@ FT_DECLARE(void) clear_call_data(sngisdn_chan_data_t *sngisdn_info) return; } -FT_DECLARE(void) clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info) +void clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info) { ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_DEBUG, "Clearing glare data (suId:%d suInstId:%u spInstId:%u actv-suInstId:%u actv-spInstId:%u)\n", sngisdn_info->glare.suId, @@ -81,7 +81,7 @@ FT_DECLARE(void) clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info) } -FT_DECLARE(uint32_t) get_unique_suInstId(int16_t cc_id) +uint32_t get_unique_suInstId(int16_t cc_id) { uint32_t suInstId; ftdm_assert_return((cc_id > 0 && cc_id <=MAX_VARIANTS), FTDM_FAIL, "Invalid cc_id\n"); @@ -103,7 +103,7 @@ FT_DECLARE(uint32_t) get_unique_suInstId(int16_t cc_id) return 0; } -FT_DECLARE(ftdm_status_t) get_ftdmchan_by_suInstId(int16_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data) +ftdm_status_t get_ftdmchan_by_suInstId(int16_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data) { ftdm_assert_return((cc_id > 0 && cc_id <=MAX_VARIANTS), FTDM_FAIL, "Invalid cc_id\n"); ftdm_assert_return(g_sngisdn_data.ccs[cc_id].activation_done, FTDM_FAIL, "Trying to find call on unconfigured CC\n"); @@ -115,7 +115,7 @@ FT_DECLARE(ftdm_status_t) get_ftdmchan_by_suInstId(int16_t cc_id, uint32_t suIns return FTDM_SUCCESS; } -FT_DECLARE(ftdm_status_t) get_ftdmchan_by_spInstId(int16_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data) +ftdm_status_t get_ftdmchan_by_spInstId(int16_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data) { ftdm_assert_return((cc_id > 0 && cc_id <=MAX_VARIANTS), FTDM_FAIL, "Invalid cc_id\n"); ftdm_assert_return(g_sngisdn_data.ccs[cc_id].activation_done, FTDM_FAIL, "Trying to find call on unconfigured CC\n"); @@ -147,7 +147,7 @@ ftdm_status_t sngisdn_set_avail_rate(ftdm_span_t *span, sngisdn_avail_t avail) return FTDM_SUCCESS; } -FT_DECLARE(ftdm_status_t) cpy_calling_num_from_stack(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb) +ftdm_status_t cpy_calling_num_from_stack(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb) { if (cgPtyNmb->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; @@ -174,7 +174,7 @@ FT_DECLARE(ftdm_status_t) cpy_calling_num_from_stack(ftdm_caller_data_t *ftdm, C return FTDM_SUCCESS; } -FT_DECLARE(ftdm_status_t) cpy_called_num_from_stack(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb) +ftdm_status_t cpy_called_num_from_stack(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb) { if (cdPtyNmb->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; @@ -196,7 +196,7 @@ FT_DECLARE(ftdm_status_t) cpy_called_num_from_stack(ftdm_caller_data_t *ftdm, Cd return FTDM_SUCCESS; } -FT_DECLARE(ftdm_status_t) cpy_redir_num_from_stack(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb) +ftdm_status_t cpy_redir_num_from_stack(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb) { if (redirNmb->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; @@ -216,7 +216,7 @@ FT_DECLARE(ftdm_status_t) cpy_redir_num_from_stack(ftdm_caller_data_t *ftdm, Red return FTDM_SUCCESS; } -FT_DECLARE(ftdm_status_t) cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *display) +ftdm_status_t cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *display) { if (display->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; @@ -229,7 +229,7 @@ FT_DECLARE(ftdm_status_t) cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, return FTDM_SUCCESS; } -FT_DECLARE(ftdm_status_t) cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm) +ftdm_status_t cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm) { uint8_t len = strlen(ftdm->cid_num.digits); if (!len) { @@ -257,7 +257,7 @@ FT_DECLARE(ftdm_status_t) cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_cal return FTDM_SUCCESS; } -FT_DECLARE(ftdm_status_t) cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm) +ftdm_status_t cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm) { uint8_t len = strlen(ftdm->dnis.digits); if (!len) { @@ -287,7 +287,7 @@ FT_DECLARE(ftdm_status_t) cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_call return FTDM_SUCCESS; } -FT_DECLARE(ftdm_status_t) cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm) +ftdm_status_t cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm) { uint8_t len = strlen(ftdm->rdnis.digits); if (!len) { @@ -319,7 +319,7 @@ FT_DECLARE(ftdm_status_t) cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_calle } -FT_DECLARE(ftdm_status_t) cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan) +ftm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan) { uint8_t len; ftdm_caller_data_t *ftdm = &ftdmchan->caller_data; commit 15d02eb930b4b4673767581bb60c3ac115b5ecc8 Merge: c5070aa 995c250 Author: David Yat Sin <dyatsin@sangoma.com> Date: Fri Nov 19 14:18:44 2010 -0500 Merge branch 'netborder' of git.sangoma.com:smg_freeswitch into netborder commit 67fa716bfd78e7a0c78dbe817c8c33ebae4ebd1b Author: Jeff Lenk <jeff@jefflenk.com> Date: Fri Nov 19 13:15:56 2010 -0600 fix critical property for module load diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 7aee9a7..c603e27 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -1293,7 +1293,7 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init(switch_bool_t autolo if (path && zstr(path)) { path = SWITCH_GLOBAL_dirs.mod_dir; } - if (switch_loadable_module_load_module_ex((char *) path, (char *) val, SWITCH_FALSE, global, &err) == SWITCH_STATUS_FALSE) { + if (switch_loadable_module_load_module_ex((char *) path, (char *) val, SWITCH_FALSE, global, &err) == SWITCH_STATUS_GENERR) { if (critical && switch_true(critical)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to load critical module '%s', abort()\n", val); abort(); commit 995c25051829899f64a6cb495b7913f0d78b2183 Merge: 65be57d 5e562ed Author: David Yat Sin <dyatsin@sangoma.com> Date: Fri Nov 19 13:58:08 2010 -0500 Merged from master branch diff --cc libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 674fea2,583d5c1..56efcb4 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@@ -48,20 -48,15 +48,17 @@@ static ftdm_status_t ftdm_sangoma_isdn_ ftdm_channel_t* ftdm_sangoma_isdn_process_event_states(ftdm_span_t *span, sngisdn_event_data_t *sngisdn_event); static void ftdm_sangoma_isdn_advance_chan_states(ftdm_channel_t *ftdmchan); static void ftdm_sangoma_isdn_poll_events(ftdm_span_t *span); - +static void ftdm_sangoma_isdn_process_phy_events(ftdm_span_t *span, ftdm_oob_event_t event); static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan); static void ftdm_sangoma_isdn_process_stack_event (ftdm_span_t *span, sngisdn_event_data_t *sngisdn_event); +static void ftdm_sangoma_isdn_wakeup_phy(ftdm_channel_t *dchan); +static void ftdm_sangoma_isdn_dchan_set_queue_size(ftdm_channel_t *ftdmchan); -static ftdm_io_interface_t g_sngisdn_io_interface; -static sng_isdn_event_interface_t g_sngisdn_event_interface; +static ftdm_io_interface_t g_sngisdn_io_interface; +static sng_isdn_event_interface_t g_sngisdn_event_interface; -ftdm_sngisdn_data_t g_sngisdn_data; +ftdm_sngisdn_data_t g_sngisdn_data; - extern ftdm_status_t sngisdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t trace_opt); - extern ftdm_status_t sngisdn_check_free_ids(void); - ftdm_state_map_t sangoma_isdn_state_map = { { { diff --cc libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 8208aa1,2a65a82..052fbd4 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@@ -277,10 -275,21 +277,7 @@@ FT_DECLARE(void) clear_call_glare_data( void stack_hdr_init(Header *hdr); void stack_pst_init(Pst *pst); - FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_spInstId(int16_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data); - FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_suInstId(int16_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data); - FT_DECLARE_INLINE(ftdm_status_t) sngisdn_set_avail_rate(ftdm_span_t *ftdmspan, sngisdn_avail_t avail); -FT_DECLARE(ftdm_status_t) get_ftdmchan_by_spInstId(int16_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data); -FT_DECLARE(ftdm_status_t) get_ftdmchan_by_suInstId(int16_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data); -FT_DECLARE(ftdm_status_t) sng_isdn_set_avail_rate(ftdm_span_t *ftdmspan, sngisdn_avail_t avail); - -FT_DECLARE(ftdm_status_t) cpy_calling_num_from_stack(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb); -FT_DECLARE(ftdm_status_t) cpy_called_num_from_stack(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb); -FT_DECLARE(ftdm_status_t) cpy_redir_num_from_stack(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb); -FT_DECLARE(ftdm_status_t) cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *display); - -FT_DECLARE(ftdm_status_t) cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm); -FT_DECLARE(ftdm_status_t) cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm); -FT_DECLARE(ftdm_status_t) cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm); -FT_DECLARE(ftdm_status_t) cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan); - /* Outbound Call Control functions */ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan); void sngisdn_snd_setup_ack(ftdm_channel_t *ftdmchan); diff --cc libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index b084837,cb508a5..2853335 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@@ -34,12 -34,13 +34,6 @@@ #include "ftmod_sangoma_isdn.h" - extern ftdm_status_t cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm); - extern ftdm_status_t cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm); - extern ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan); - extern ftdm_status_t cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm); - - -void sngisdn_snd_setup(ftdm_channel_t *ftdmchan); -void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan); -void sngisdn_snd_progress(ftdm_channel_t *ftdmchan); -void sngisdn_snd_connect(ftdm_channel_t *ftdmchan); -void sngisdn_snd_disconnect(ftdm_channel_t *ftdmchan); -void sngisdn_snd_release(ftdm_channel_t *ftdmchan, uint8_t glare); - void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) { ConEvnt conEvnt; diff --cc libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index f9fbb5c,8e8acc2..eb42207 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@@ -115,11 -115,11 +115,11 @@@ FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_ne static __inline__ int tdmv_api_wait_socket(ftdm_channel_t *ftdmchan, int timeout, int *flags) { -#ifdef LIBSANGOMA_VERSION +#ifdef LIBSANGOMA_VERSION int err; - uint32_t inflags = *flags; - uint32_t outflags = 0; - sangoma_wait_obj_t *sangoma_wait_obj = ftdmchan->mod_data; + uint32_t inflags = *flags; + uint32_t outflags = 0; + sangoma_wait_obj_t *sangoma_wait_obj = ftdmchan->io_data; err = sangoma_waitfor(sangoma_wait_obj, inflags, &outflags, timeout); *flags = 0; commit b004916036465d145d0388a1afb24d5471b48f64 Author: Michael S Collins <msc@freeswitch.org> Date: Fri Nov 19 10:54:39 2010 -0800 Do at least *SOME* verification to make sure that we are getting an IP address in the blacklist list diff --git a/scripts/perl/blacklist.pl b/scripts/perl/blacklist.pl index f434669..92fa55e 100755 --- a/scripts/perl/blacklist.pl +++ b/scripts/perl/blacklist.pl @@ -17,13 +17,15 @@ my @netblocks = split(/\n/, get("http://www.infiltrated.net/voipabuse/netblocks. print "<list name=\"voip-abuse-addresses\" default=\"deny\">\n"; foreach $addr (@addresses) { - print " <node type=\"allow\" cidr=\"$addr/32\"/>\n"; + next unless $addr =~ m/\d+\.\d+\.\d+\.\d+/; + print " <node type=\"allow\" cidr=\"$addr/32\"/>\n"; } print "</list>\n"; print "<list name=\"voip-abuse-netblocks\" default=\"deny\">\n"; foreach $netb (@netblocks) { - print " <node type=\"allow\" cidr=\"$netb\"/>\n"; + next unless $netb =~ m/\d+\.\d+\.\d+\.\d+/; + print " <node type=\"allow\" cidr=\"$netb\"/>\n"; } print "</list>\n"; commit 8c9f23ea566ac746eb4ed40cdd7816309dffaa45 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Nov 19 11:16:18 2010 -0600 refactor codec_destroy to prevent race diff --git a/src/switch_core_codec.c b/src/switch_core_codec.c index 9b607ea..d6b6270 100644 --- a/src/switch_core_codec.c +++ b/src/switch_core_codec.c @@ -672,14 +672,19 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_decode(switch_codec_t *codec, SWITCH_DECLARE(switch_status_t) switch_core_codec_destroy(switch_codec_t *codec) { - switch_mutex_t *mutex; - switch_memory_pool_t *pool; + switch_mutex_t *mutex = codec->mutex; + switch_memory_pool_t *pool = codec->memory_pool; int free_pool = 0; switch_assert(codec != NULL); - if (!switch_core_codec_ready(codec)) { + if (mutex) switch_mutex_lock(mutex); + + if (switch_core_codec_ready(codec)) { + switch_clear_flag(codec, SWITCH_CODEC_FLAG_READY); + } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Codec is not initialized!\n"); + if (mutex) switch_mutex_unlock(mutex); return SWITCH_STATUS_NOT_INITALIZED; } @@ -687,23 +692,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_destroy(switch_codec_t *codec) free_pool = 1; } - pool = codec->memory_pool; - mutex = codec->mutex; - - if (mutex) { - switch_mutex_lock(mutex); - switch_clear_flag(codec, SWITCH_CODEC_FLAG_READY); - switch_mutex_unlock(mutex); - switch_mutex_lock(mutex); - } - codec->implementation->destroy(codec); UNPROTECT_INTERFACE(codec->codec_interface); - if (mutex) { - switch_mutex_unlock(mutex); - } + if (mutex) switch_mutex_unlock(mutex); if (free_pool) { switch_core_destroy_memory_pool(&pool); commit d2fd5ba0aa2a968031dc0719576da3f9d63bcf31 Author: Mathieu Rene <mrene@avgs.ca> Date: Fri Nov 19 12:07:07 2010 -0500 fix regression diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 9fadced..9cc515e 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1256,6 +1256,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread if (sofia_test_pflag(profile, PFLAG_SQL_IN_TRANS)) { /* Do we have enough statements or is the timeout expired */ while (sql || (sofia_test_pflag(profile, PFLAG_RUNNING) && mod_sofia_globals.running == 1 && + switch_micro_time_now() - last_check < 1000000 && (statements == 0 || (statements <= 1024 && (switch_micro_time_now() - last_commit)/1000 < profile->trans_timeout)))) { switch_interval_time_t sleepy_time = !statements ? 1000000 : switch_micro_time_now() - last_commit - profile->trans_timeout*1000; commit 3c76811f0c41998069d21955a306baf3944c8ed0 Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Nov 18 21:19:57 2010 -0600 fix unimrcp build after last commit diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_consumer_task.c b/libs/unimrcp/libs/apr-toolkit/src/apt_consumer_task.c index 3b96373..ceb9320 100644 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_consumer_task.c +++ b/libs/unimrcp/libs/apr-toolkit/src/apt_consumer_task.c @@ -14,6 +14,7 @@ * limitations under the License. */ +#include <apr_time.h> #include <apr_queue.h> #include "apt_consumer_task.h" #include "apt_log.h" commit de417e99f0c41421f701f86ee5e4e507868be81f Author: Mathieu Rene <mrene@avgs.ca> Date: Thu Nov 18 21:00:21 2010 -0500 Implement switch_queue_pop_timeout() and refactor sofia_profile_worker_thread_run() to use it so it doesn't wake up too often diff --git a/libs/apr-util/.update b/libs/apr-util/.update index f430e64..a573c80 100644 --- a/libs/apr-util/.update +++ b/libs/apr-util/.update @@ -1 +1 @@ -Mon Dec 28 14:55:57 EST 2009 +Thu 18 Nov 2010 20:56:38 EST diff --git a/libs/apr-util/include/apr_queue.h b/libs/apr-util/include/apr_queue.h index 5a0181b..dcf0c13 100644 --- a/libs/apr-util/include/apr_queue.h +++ b/libs/apr-util/include/apr_queue.h @@ -79,6 +79,22 @@ APU_DECLARE(apr_status_t) apr_queue_push(apr_queue_t *queue, void *data); APU_DECLARE(apr_status_t) apr_queue_pop(apr_queue_t *queue, void **data); /** + * pop/get an object from the queue, blocking if the queue is already empty + * + * @param queue the queue + * @param data the data + * @param timeout The amount of time in microseconds to wait. This is + * a maximum, not a minimum. If the condition is signaled, we + * will wake up before this time, otherwise the error APR_TIMEUP + * is returned. + * @returns APR_TIMEUP the request timed out + * @returns APR_EINTR the blocking was interrupted (try again) + * @returns APR_EOF if the queue has been terminated + * @returns APR_SUCCESS on a successfull pop + */ +APU_DECLARE(apr_status_t) apr_queue_pop_timeout(apr_queue_t *queue, void **data, apr_interval_time_t timeout); + +/** * push/add a object to the queue, returning immediatly if the queue is full * * @param queue the queue diff --git a/libs/apr-util/misc/apr_queue.c b/libs/apr-util/misc/apr_queue.c index 28d79af..e905a53 100644 --- a/libs/apr-util/misc/apr_queue.c +++ b/libs/apr-util/misc/apr_queue.c @@ -315,6 +315,71 @@ APU_DECLARE(apr_status_t) apr_queue_pop(apr_queue_t *queue, void **data) /** * Retrieves the next item from the queue. If there are no + * items available, it will block until one becomes available, or + * until timeout is elapsed. Once retrieved, the item is placed into + * the address specified by'data'. + */ +APU_DECLARE(apr_status_t) apr_queue_pop_timeout(apr_queue_t *queue, void **data, apr_interval_time_t timeout) +{ + apr_status_t rv; + + if (queue->terminated) { + return APR_EOF; /* no more elements ever again */ + } + + rv = apr_thread_mutex_lock(queue->one_big_mutex); + if (rv != APR_SUCCESS) { + return rv; + } + + /* Keep waiting until we wake up and find that the queue is not empty. */ + if (apr_queue_empty(queue)) { + if (!queue->terminated) { + queue->empty_waiters++; + rv = apr_thread_cond_timedwait(queue->not_empty, queue->one_big_mutex, timeout); + queue->empty_waiters--; + /* In the event of a timemout, APR_TIMEUP will be returned */ + if (rv != APR_SUCCESS) { + apr_thread_mutex_unlock(queue->one_big_mutex); + return rv; + } + } + /* If we wake up and it's still empty, then we were interrupted */ + if (apr_queue_empty(queue)) { + Q_DBG("queue empty (intr)", queue); + rv = apr_thread_mutex_unlock(queue->one_big_mutex); + if (rv != APR_SUCCESS) { + return rv; + } + if (queue->terminated) { + return APR_EOF; /* no more elements ever again */ + } + else { + return APR_EINTR; + } + } + } + + *data = queue->data[queue->out]; + queue->nelts--; + + queue->out = (queue->out + 1) % queue->bounds; + if (queue->full_waiters) { + Q_DBG("signal !full", queue); + rv = apr_thread_cond_signal(queue->not_full); + if (rv != APR_SUCCESS) { + apr_thread_mutex_unlock(queue->one_big_mutex); + return rv; + } + } + + rv = apr_thread_mutex_unlock(queue->one_big_mutex); + return rv; +} + + +/** + * Retrieves the next item from the queue. If there are no * items available, return APR_EAGAIN. Once retrieved, * the item is placed into the address specified by 'data'. */ diff --git a/src/include/switch_apr.h b/src/include/switch_apr.h index f82b81a..dc81d1a 100644 --- a/src/include/switch_apr.h +++ b/src/include/switch_apr.h @@ -593,6 +593,22 @@ SWITCH_DECLARE(switch_status_t) switch_queue_create(switch_queue_t ** queue, uns SWITCH_DECLARE(switch_status_t) switch_queue_pop(switch_queue_t *queue, void **data); /** + * pop/get an object from the queue, blocking if the queue is already empty + * + * @param queue the queue + * @param data the data + * @param timeout The amount of time in microseconds to wait. This is + * a maximum, not a minimum. If the condition is signaled, we + * will wake up before this time, otherwise the error APR_TIMEUP + * is returned. + * @returns APR_TIMEUP the request timed out + * @returns APR_EINTR the blocking was interrupted (try again) + * @returns APR_EOF if the queue has been terminated + * @returns APR_SUCCESS on a successfull pop + */ +SWITCH_DECLARE(switch_status_t) switch_queue_pop_timeout(switch_queue_t *queue, void **data, switch_interval_time_t timeout); + +/** * push/add a object to the queue, blocking if the queue is already full * * @param queue the queue diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 5bb2ff0..9fadced 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1230,43 +1230,42 @@ static void sofia_perform_profile_start_failure(sofia_profile_t *profile, char * void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread, void *obj) { sofia_profile_t *profile = (sofia_profile_t *) obj; - uint32_t ireg_loops = 0; - uint32_t gateway_loops = 0; - int loops = 0; - uint32_t qsize; - void *pop = NULL; - int loop_count = 0; - switch_size_t sql_len = 1024 * 32; - char *tmp, *sqlbuf = NULL; - char *sql = NULL; + uint32_t ireg_loops = IREG_SECONDS; /* Number of loop iterations done when we haven't checked for registrations */ + uint32_t gateway_loops = GATEWAY_SECONDS; /* Number of loop iterations done when we haven't checked for gateways */ + void *pop = NULL; /* queue_pop placeholder */ + switch_size_t sql_len = 1024 * 32; /* length of sqlbuf */ + char *tmp, *sqlbuf = NULL; /* Buffer for SQL statements */ + char *sql = NULL; /* Current SQL statement */ + switch_time_t last_commit; /* Last time we committed stuff to the DB */ + switch_time_t last_check; /* Last time we did the second-resolution loop that checks various stuff */ + switch_size_t len = 0; /* Current length of sqlbuf */ + uint32_t statements = 0; /* Number of statements in the current sql buffer */ + + last_commit = last_check = switch_micro_time_now(); if (sofia_test_pflag(profile, PFLAG_SQL_IN_TRANS)) { sqlbuf = (char *) malloc(sql_len); } - ireg_loops = IREG_SECONDS; - gateway_loops = GATEWAY_SECONDS; - sofia_set_pflag_locked(profile, PFLAG_WORKER_RUNNING); switch_queue_create(&profile->sql_queue, SOFIA_QUEUE_SIZE, profile->pool); - qsize = switch_queue_size(profile->sql_queue); - - while ((mod_sofia_globals.running == 1 && sofia_test_pflag(profile, PFLAG_RUNNING)) || qsize) { + /* While we're running, or there is a pending sql statment that we haven't appended to sqlbuf yet, because of a lack of buffer space */ + while ((mod_sofia_globals.running == 1 && sofia_test_pflag(profile, PFLAG_RUNNING)) || sql) { if (sofia_test_pflag(profile, PFLAG_SQL_IN_TRANS)) { - if (qsize > 0 && (qsize >= 1024 || ++loop_count >= (int)profile->trans_timeout)) { - switch_size_t newlen; - uint32_t iterations = 0; - switch_size_t len = 0; - - switch_mutex_lock(profile->ireg_mutex); + /* Do we have enough statements or is the timeout expired */ + while (sql || (sofia_test_pflag(profile, PFLAG_RUNNING) && mod_sofia_globals.running == 1 && + (statements == 0 || (statements <= 1024 && (switch_micro_time_now() - last_commit)/1000 < profile->trans_timeout)))) { + + switch_interval_time_t sleepy_time = !statements ? 1000000 : switch_micro_time_now() - last_commit - profile->trans_timeout*1000; - while (sql || (switch_queue_trypop(profile->sql_queue, &pop) == SWITCH_STATUS_SUCCESS && pop)) { + if (sql || (switch_queue_pop_timeout(profile->sql_queue, &pop, sleepy_time) == SWITCH_STATUS_SUCCESS && pop)) { + switch_size_t newlen; + if (!sql) sql = (char *) pop; - newlen = strlen(sql) + 2; - iterations++; + newlen = strlen(sql) + 2 /* strlen(";\n") */ ; if (len + newlen + 10 > sql_len) { switch_size_t new_mlen = len + newlen + 10 + 10240; @@ -1280,7 +1279,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread } sqlbuf = tmp; } else { - goto skip; + break; } } @@ -1288,31 +1287,32 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread len += newlen; free(sql); sql = NULL; + + statements++; } - - skip: - + } + + /* Execute here */ + last_commit = switch_micro_time_now(); + + if (len) { //printf("TRANS:\n%s\n", sqlbuf); + switch_mutex_lock(profile->ireg_mutex); sofia_glue_actually_execute_sql_trans(profile, sqlbuf, NULL); //sofia_glue_actually_execute_sql(profile, "commit;\n", NULL); switch_mutex_unlock(profile->ireg_mutex); - loop_count = 0; + statements = 0; + len = 0; } + } else { - if (qsize) { - //switch_mutex_lock(profile->ireg_mutex); - while (switch_queue_trypop(profile->sql_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) { - sofia_glue_actually_execute_sql(profile, (char *) pop, profile->ireg_mutex); - free(pop); - } - //switch_mutex_unlock(profile->ireg_mutex); + if (switch_queue_pop_timeout(profile->sql_queue, &pop, 1000000) == SWITCH_STATUS_SUCCESS && pop) { + sofia_glue_actually_execute_sql(profile, (char *) pop, profile->ireg_mutex); + free(pop); } } - if (++loops >= 1000) { - - - + if (switch_micro_time_now() - last_check >= 1000000) { if (profile->watchdog_enabled) { uint32_t event_diff = 0, step_diff = 0, event_fail = 0, step_fail = 0; @@ -1339,7 +1339,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread if (event_fail || step_fail) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Profile %s: SIP STACK FAILURE DETECTED!\n" "GOODBYE CRUEL WORLD, I'M LEAVING YOU TODAY....GOODBYE, GOODBYE, GOOD BYE\n", profile->name); - switch_yield(2000); + switch_yield(2000000); abort(); } } @@ -1354,12 +1354,11 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread sofia_reg_check_gateway(profile, switch_epoch_time_now(NULL)); gateway_loops = 0; } + sofia_sub_check_gateway(profile, time(NULL)); - loops = 0; + + last_check = switch_micro_time_now(); } - - switch_cond_next(); - qsize = switch_queue_size(profile->sql_queue); } switch_mutex_lock(profile->ireg_mutex); diff --git a/src/switch_apr.c b/src/switch_apr.c index bdff179..dccc37b 100644 --- a/src/switch_apr.c +++ b/src/switch_apr.c @@ -986,6 +986,12 @@ SWITCH_DECLARE(switch_status_t) switch_queue_pop(switch_queue_t *queue, void **d return apr_queue_pop(queue, data); } +SWITCH_DECLARE(switch_status_t) switch_queue_pop_timeout(switch_queue_t *queue, void **data, switch_interval_time_t timeout) +{ + return apr_queue_pop_timeout(queue, data, timeout); +} + + SWITCH_DECLARE(switch_status_t) switch_queue_push(switch_queue_t *queue, void *data) { apr_status_t s; commit 42a4a3dedfe762268d935e5fd5e5de6e0f1d024a Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Nov 18 18:24:32 2010 -0600 revert FS-2859 diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 12fac04..c016380 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -471,9 +471,7 @@ typedef enum { SWITCH_VAD_FLAG_TALKING = (1 << 0), SWITCH_VAD_FLAG_EVENTS_TALK = (1 << 1), SWITCH_VAD_FLAG_EVENTS_NOTALK = (1 << 2), - SWITCH_VAD_FLAG_CNG = (1 << 3), -/* added to keep track when last normal packet sent */ - SWITCH_VAD_NPACKET_SENT = (1 << 4) + SWITCH_VAD_FLAG_CNG = (1 << 3) } switch_vad_flag_enum_t; typedef uint32_t switch_vad_flag_t; diff --git a/src/switch_rtp.c b/src/switch_rtp.c index e347212..ee1c4ac 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -240,7 +240,6 @@ struct switch_rtp { switch_time_t send_time; switch_byte_t auto_adj_used; - int last_voicepkt; }; struct switch_rtcp_senderinfo { @@ -1357,7 +1356,6 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session rtp_session->pool = pool; rtp_session->te = 101; rtp_session->recv_te = 101; - rtp_session->last_voicepkt=0; switch_mutex_init(&rtp_session->flag_mutex, SWITCH_MUTEX_NESTED, pool); switch_mutex_init(&rtp_session->read_mutex, SWITCH_MUTEX_NESTED, pool); @@ -3157,12 +3155,9 @@ static int rtp_common_write(switch_rtp_t *rtp_session, { switch_size_t bytes, rtcp_bytes; uint8_t send = 1; - uint8_t CNdata[10] = { 0 }; - uint8_t sendCN = 0; uint32_t this_ts = 0; int ret; switch_time_t now; - CNdata[0] = 65; if (!switch_rtp_ready(rtp_session)) { return SWITCH_STATUS_FALSE; @@ -3244,15 +3239,9 @@ static int rtp_common_write(switch_rtp_t *rtp_session, rtp_session->recv_msg.header.pt = 102; } - if ( !switch_test_flag(rtp_session,SWITCH_RTP_FLAG_VAD ) ) - switch_set_flag( rtp_session,SWITCH_RTP_FLAG_VAD); - - -/* if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VAD) && rtp_session->recv_msg.header.pt == rtp_session->vad_data.read_codec->implementation->ianacode) { -*/ - if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VAD)) { + int16_t decoded[SWITCH_RECOMMENDED_BUFFER_SIZE / sizeof(int16_t)] = { 0 }; uint32_t rate = 0; uint32_t codec_flags = 0; @@ -3301,7 +3290,6 @@ static int rtp_common_write(switch_rtp_t *rtp_session, if (score > rtp_session->vad_data.bg_level && !switch_test_flag(&rtp_session->vad_data, SWITCH_VAD_FLAG_TALKING)) { uint32_t diff = score - rtp_session->vad_data.bg_level; - if (rtp_session->vad_data.hangover_hits) { rtp_session->vad_data.hangover_hits--; } @@ -3354,31 +3342,11 @@ static int rtp_common_write(switch_rtp_t *rtp_session, this_ts = ntohl(send_msg->header.ts); - - /* if previous normal packet is sent but this one is not scheduled to be sent, send a CN packet */ - if ( !rtp_session->last_voicepkt && send==0 ) { - send=1; - sendCN=1; - //switch_set_flag(&rtp_session->vad_data,SWITCH_VAD_NPACKET_SENT ); - rtp_session->last_voicepkt=1; - } - if (!switch_rtp_ready(rtp_session) || rtp_session->sending_dtmf || !this_ts) { send = 0; } - /* we send CN automatically. ignore other attempts */ - if ( send_msg->header.pt == rtp_session->cng_pt ){ - send = 0; - } - - - if (send) { - if ( !sendCN) - rtp_session->last_voicepkt=0; - - send_msg->header.seq = htons(++rtp_session->seq); if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND)) { @@ -3473,18 +3441,6 @@ static int rtp_common_write(switch_rtp_t *rtp_session, } } - if ( sendCN ) { - int CNdatalen = 2; - rtp_session->cn++; - memcpy(send_msg->body, CNdata, CNdatalen); - bytes = CNdatalen + rtp_header_len; - payload = rtp_session->cng_pt; - send_msg->header.pt = rtp_session->cng_pt; - send_msg->header.m = 0; - rtp_session->last_voicepkt=1; - } - - if (switch_socket_sendto(rtp_session->sock_output, rtp_session->remote_addr, 0, (void *) send_msg, &bytes) != SWITCH_STATUS_SUCCESS) { rtp_session->seq--; @@ -3567,9 +3523,6 @@ static int rtp_common_write(switch_rtp_t *rtp_session, } } - - - if (rtp_session->remote_stun_addr) { do_stun_ping(rtp_session); } commit 0a11b9b4333eb960038feca7972470f3770a5cce Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Nov 18 16:23:01 2010 -0600 FS-2859 diff --git a/src/include/switch_types.h b/src/include/switch_types.h index c016380..12fac04 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -471,7 +471,9 @@ typedef enum { SWITCH_VAD_FLAG_TALKING = (1 << 0), SWITCH_VAD_FLAG_EVENTS_TALK = (1 << 1), SWITCH_VAD_FLAG_EVENTS_NOTALK = (1 << 2), - SWITCH_VAD_FLAG_CNG = (1 << 3) + SWITCH_VAD_FLAG_CNG = (1 << 3), +/* added to keep track when last normal packet sent */ + SWITCH_VAD_NPACKET_SENT = (1 << 4) } switch_vad_flag_enum_t; typedef uint32_t switch_vad_flag_t; diff --git a/src/switch_rtp.c b/src/switch_rtp.c index ee1c4ac..e347212 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -240,6 +240,7 @@ struct switch_rtp { switch_time_t send_time; switch_byte_t auto_adj_used; + int last_voicepkt; }; struct switch_rtcp_senderinfo { @@ -1356,6 +1357,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session rtp_session->pool = pool; rtp_session->te = 101; rtp_session->recv_te = 101; + rtp_session->last_voicepkt=0; switch_mutex_init(&rtp_session->flag_mutex, SWITCH_MUTEX_NESTED, pool); switch_mutex_init(&rtp_session->read_mutex, SWITCH_MUTEX_NESTED, pool); @@ -3155,9 +3157,12 @@ static int rtp_common_write(switch_rtp_t *rtp_session, { switch_size_t bytes, rtcp_bytes; uint8_t send = 1; + uint8_t CNdata[10] = { 0 }; + uint8_t sendCN = 0; uint32_t this_ts = 0; int ret; switch_time_t now; + CNdata[0] = 65; if (!switch_rtp_ready(rtp_session)) { return SWITCH_STATUS_FALSE; @@ -3239,9 +3244,15 @@ static int rtp_common_write(switch_rtp_t *rtp_session, rtp_session->recv_msg.header.pt = 102; } + if ( !switch_test_flag(rtp_session,SWITCH_RTP_FLAG_VAD ) ) + switch_set_flag( rtp_session,SWITCH_RTP_FLAG_VAD); + + +/* if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VAD) && rtp_session->recv_msg.header.pt == rtp_session->vad_data.read_codec->implementation->ianacode) { - +*/ + if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VAD)) { int16_t decoded[SWITCH_RECOMMENDED_BUFFER_SIZE / sizeof(int16_t)] = { 0 }; uint32_t rate = 0; uint32_t codec_flags = 0; @@ -3290,6 +3301,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session, if (score > rtp_session->vad_data.bg_level && !switch_test_flag(&rtp_session->vad_data, SWITCH_VAD_FLAG_TALKING)) { uint32_t diff = score - rtp_session->vad_data.bg_level; + if (rtp_session->vad_data.hangover_hits) { rtp_session->vad_data.hangover_hits--; } @@ -3342,11 +3354,31 @@ static int rtp_common_write(switch_rtp_t *rtp_session, this_ts = ntohl(send_msg->header.ts); + + /* if previous normal packet is sent but this one is not scheduled to be sent, send a CN packet */ + if ( !rtp_session->last_voicepkt && send==0 ) { + send=1; + sendCN=1; + //switch_set_flag(&rtp_session->vad_data,SWITCH_VAD_NPACKET_SENT ); + rtp_session->last_voicepkt=1; + } + if (!switch_rtp_ready(rtp_session) || rtp_session->sending_dtmf || !this_ts) { send = 0; } + /* we send CN automatically. ignore other attempts */ + if ( send_msg->header.pt == rtp_session->cng_pt ){ + send = 0; + } + + + if (send) { + if ( !sendCN) + rtp_session->last_voicepkt=0; + + send_msg->header.seq = htons(++rtp_session->seq); if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND)) { @@ -3441,6 +3473,18 @@ static int rtp_common_write(switch_rtp_t *rtp_session, } } + if ( sendCN ) { + int CNdatalen = 2; + rtp_session->cn++; + memcpy(send_msg->body, CNdata, CNdatalen); + bytes = CNdatalen + rtp_header_len; + payload = rtp_session->cng_pt; + send_msg->header.pt = rtp_session->cng_pt; + send_msg->header.m = 0; + rtp_session->last_voicepkt=1; + } + + if (switch_socket_sendto(rtp_session->sock_output, rtp_session->remote_addr, 0, (void *) send_msg, &bytes) != SWITCH_STATUS_SUCCESS) { rtp_session->seq--; @@ -3523,6 +3567,9 @@ static int rtp_common_write(switch_rtp_t *rtp_session, } } + + + if (rtp_session->remote_stun_addr) { do_stun_ping(rtp_session); } commit d96eb988ff7422dc72662b51ce1d0cbb036138e0 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Nov 18 16:14:08 2010 -0600 FS-2857 diff --git a/src/switch_ivr.c b/src/switch_ivr.c index aa3de5f..f076f6c 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -911,7 +911,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session, switch_ivr_parse_all_events(session); - if (args && switch_channel_has_dtmf(channel)) { + if (switch_channel_has_dtmf(channel)) { switch_dtmf_t dtmf = { 0 }; if (args && !args->input_callback && !args->buf && !args->dmachine) { @@ -921,14 +921,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session, switch_channel_dequeue_dtmf(channel, &dtmf); - if (args->dmachine) { - char ds[2] = {dtmf.digit, '\0'}; - if ((status = switch_ivr_dmachine_feed(args->dmachine, ds, NULL)) != SWITCH_STATUS_SUCCESS) { - break; - } - } else if (args->input_callback) { - if ((status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen)) != SWITCH_STATUS_SUCCESS) { - break; + if (args) { + if (args->dmachine) { + char ds[2] = {dtmf.digit, '\0'}; + if ((status = switch_ivr_dmachine_feed(args->dmachine, ds, NULL)) != SWITCH_STATUS_SUCCESS) { + break; + } + } else if (args->input_callback) { + if ((status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen)) != SWITCH_STATUS_SUCCESS) { + break; + } } } } commit d4138959b2eac09313c420e158f2488ece7080d8 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Thu Nov 18 23:14:46 2010 +0100 freetdm: use m4_ifdef() to check for pkg-config macros and print a warning if they are not available ...instead of failing at runtime Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/configure.ac b/libs/freetdm/configure.ac index 8b878ed..6b9287d 100644 --- a/libs/freetdm/configure.ac +++ b/libs/freetdm/configure.ac @@ -24,7 +24,12 @@ AC_PROG_MAKE_SET AM_PROG_CC_C_O AC_PROG_LIBTOOL AC_PROG_INSTALL -PKG_PROG_PKG_CONFIG + +# NOTE: pkg-config is used to detect libisdn +m4_ifdef([PKG_PROG_PKG_CONFIG], + [PKG_PROG_PKG_CONFIG], + [AC_MSG_WARN([pkg-config missing (required for libisdn detection)])] +) AX_COMPILER_VENDOR @@ -305,41 +310,44 @@ AC_ARG_WITH([libisdn], if test "${with_libisdn}" != "no" then AC_MSG_RESULT([${as_nl}<<>> ftmod_isdn (libisdn stack)]) - PKG_CHECK_MODULES([libisdn], - [libisdn >= 0.0.1], - [AC_MSG_CHECKING([libisdn version]) - LIBISDN_VERSION="`${PKG_CONFIG} --modversion libisdn`" - if test -z "${LIBISDN_VERSION}"; then - AC_MSG_ERROR([Failed to retrieve libisdn version]) - fi - AC_MSG_RESULT([${LIBISDN_VERSION}]) - - # check features - AC_MSG_CHECKING([for new experimental API]) - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [#include <libisdn/version.h> - #if !LIBISDN_FEATURE(API2) - #error "libisdn API v2 not available" - #endif - ], - [;] - )], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no])] + m4_ifdef([PKG_CHECK_MODULES], + [PKG_CHECK_MODULES([libisdn], + [libisdn >= 0.0.1], + [AC_MSG_CHECKING([libisdn version]) + LIBISDN_VERSION="`${PKG_CONFIG} --modversion libisdn`" + if test -z "${LIBISDN_VERSION}"; then + AC_MSG_ERROR([Failed to retrieve libisdn version]) + fi + AC_MSG_RESULT([${LIBISDN_VERSION}]) + + # check features + AC_MSG_CHECKING([for new experimental API]) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [#include <libisdn/version.h> + #if !LIBISDN_FEATURE(API2) + #error "libisdn API v2 not available" + #endif + ], + [;] + )], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])] + ) + + HAVE_LIBISDN="yes" + AC_DEFINE([HAVE_LIBISDN], [1], [libisdn support]) + AC_SUBST([LIBISDN_CFLAGS], [${libisdn_CFLAGS}]) + AC_SUBST([LIBISDN_CPPFLAGS],[${libisdn_CPPFLAGS}]) + AC_SUBST([LIBISDN_LDFLAGS], [${libisdn_LDFLAGS}]) + AC_SUBST([LIBISDN_LIBS], [${libisdn_LIBS}]) + AC_SUBST([LIBISDN_VERSION]) + ], + [AC_MSG_ERROR([Need libisdn-0.0.1 or higher])] ) - - HAVE_LIBISDN="yes" - AC_DEFINE([HAVE_LIBISDN], [1], [libisdn support]) - AC_SUBST([LIBISDN_CFLAGS], [${libisdn_CFLAGS}]) - AC_SUBST([LIBISDN_CPPFLAGS],[${libisdn_CPPFLAGS}]) - AC_SUBST([LIBISDN_LDFLAGS], [${libisdn_LDFLAGS}]) - AC_SUBST([LIBISDN_LIBS], [${libisdn_LIBS}]) - AC_SUBST([LIBISDN_VERSION]) - ], - [AC_MSG_ERROR([Need libisdn-0.0.1 or higher])] + AX_LIB_PCAP], + [AC_MSG_WARN([pkg-config missing (required for libisdn detection)])] ) - AX_LIB_PCAP fi AM_CONDITIONAL([HAVE_LIBISDN], [test "${HAVE_LIBISDN}" = "yes"]) commit ad7c7f1323d64c255b88f13610fc9c0341f86dc1 Author: Mathieu Rene <mrene@avgs.ca> Date: Thu Nov 18 11:17:11 2010 -0500 adjust switch_yield times in switch_core_sql_db_thread() and pool_thread() diff --git a/src/switch_core_memory.c b/src/switch_core_memory.c index 39d0403..a63ce0d 100644 --- a/src/switch_core_memory.c +++ b/src/switch_core_memory.c @@ -548,7 +548,7 @@ static void *SWITCH_THREAD_FUNC pool_thread(switch_thread_t *thread, void *obj) goto done; } } else { - switch_yield(100000); + switch_yield(1000000); } } diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 509d989..89249e6 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -898,7 +898,7 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_db_thread(switch_thread_t *threa wake_thread(0); sec = 0; } - switch_yield(1000); + switch_yield(1000000); } commit 86509640e343da132c0a06461c0b9bdde7e6309c Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Nov 18 09:00:24 2010 -0600 FS-2857 diff --git a/src/switch_ivr.c b/src/switch_ivr.c index e599839..aa3de5f 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -911,10 +911,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session, switch_ivr_parse_all_events(session); - if (switch_channel_has_dtmf(channel)) { + if (args && switch_channel_has_dtmf(channel)) { switch_dtmf_t dtmf = { 0 }; - if (!args->input_callback && !args->buf && !args->dmachine) { + if (args && !args->input_callback && !args->buf && !args->dmachine) { status = SWITCH_STATUS_BREAK; break; } @@ -926,7 +926,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session, if ((status = switch_ivr_dmachine_feed(args->dmachine, ds, NULL)) != SWITCH_STATUS_SUCCESS) { break; } - } else if (args && args->input_callback) { + } else if (args->input_callback) { if ((status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen)) != SWITCH_STATUS_SUCCESS) { break; } commit de7a9843996f31e29a08fa93e2bf7b600e76cad0 Author: Jeff Lenk <jeff@jefflenk.com> Date: Wed Nov 17 19:37:40 2010 -0600 correct windows vs2010 mod_valet_parking x64 path issue diff --git a/src/mod/applications/mod_valet_parking/mod_valet_parking.2010.vcxproj b/src/mod/applications/mod_valet_parking/mod_valet_parking.2010.vcxproj index 5e006e1..29c0c4a 100644 --- a/src/mod/applications/mod_valet_parking/mod_valet_parking.2010.vcxproj +++ b/src/mod/applications/mod_valet_parking/mod_valet_parking.2010.vcxproj @@ -63,10 +63,6 @@ <PropertyGroup Label="UserMacros" /> <PropertyGroup> <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> commit 5e562ed55fc48514f0d223b2e2076f84099f7a00 Author: Konrad Hammel <konrad@sangoma.com> Date: Wed Nov 17 16:41:38 2010 -0500 freetdm: ss7 - bug fix for caller-id presentation...line value was not passed through stack properly diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c index 87d80f1..e7378bf 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c @@ -1347,7 +1347,7 @@ int ftmod_ss7_isup_isap_config(int id) cfg.t.cfg.s.siSap.natAddrInd = ADDR_NOTPRSNT; /* SID Nature of Addres Indicator */ cfg.t.cfg.s.siSap.sidNPlan = NP_ISDN; /* SID Numbering Plan */ cfg.t.cfg.s.siSap.sidPresInd = FALSE; /* default presentation indicator */ - cfg.t.cfg.s.siSap.incSidPresRes = TRUE; /* Presentation Restriction of incoming SID */ + cfg.t.cfg.s.siSap.incSidPresRes = FALSE; /* Presentation Restriction of incoming SID */ cfg.t.cfg.s.siSap.sidPresRes = 0; /* Presentation Restriction */ } cfg.t.cfg.s.siSap.reqOpt = FALSE; /* Request option */ commit 4d41a0f3a2ddd74e0a95b31f3766a71f80d1045c Author: Jeff Lenk <jeff@jefflenk.com> Date: Wed Nov 17 15:39:33 2010 -0600 FS-2855 Fix spidermonkey under windows x64 diff --git a/libs/js/src/jstypes.h b/libs/js/src/jstypes.h index 0a76d47..e5d9544 100644 --- a/libs/js/src/jstypes.h +++ b/libs/js/src/jstypes.h @@ -77,35 +77,25 @@ ** ***********************************************************************/ #ifdef WIN32 -/* These also work for __MWERKS__ */ -#define JS_EXTERN_API(__type) extern __declspec(dllexport) __type -#define JS_EXPORT_API(__type) __declspec(dllexport) __type -#define JS_EXTERN_DATA(__type) extern __declspec(dllexport) __type -#define JS_EXPORT_DATA(__type) __declspec(dllexport) __type - -#define JS_DLL_CALLBACK -#define JS_STATIC_DLL_CALLBACK(__x) static __x -#elif defined(WIN16) +/* These also work for __MWERKS__ */ +# define JS_EXTERN_API(__type) extern __declspec(dllexport) __type +# define JS_EXPORT_API(__type) __declspec(dllexport) __type +# define JS_EXTERN_DATA(__type) extern __declspec(dllexport) __type +# define JS_EXPORT_DATA(__type) __declspec(dllexport) __type -#ifdef _WINDLL -#define JS_EXTERN_API(__type) extern __type _cdecl _export _loadds -#define JS_EXPORT_API(__type) __type _cdecl _export _loadds -#define JS_EXTERN_DATA(__type) extern __type _export -#define JS_EXPORT_DATA(__type) __type _export +# define JS_DLL_CALLBACK +# define JS_STATIC_DLL_CALLBACK(__x) static __x -#define JS_DLL_CALLBACK __cdecl __loadds -#define JS_STATIC_DLL_CALLBACK(__x) static __x CALLBACK +#elif defined(XP_OS2) && defined(__declspec) -#else /* this must be .EXE */ -#define JS_EXTERN_API(__type) extern __type _cdecl _export -#define JS_EXPORT_API(__type) __type _cdecl _export -#define JS_EXTERN_DATA(__type) extern __type _export -#define JS_EXPORT_DATA(__type) __type _export +# define JS_EXTERN_API(__type) extern __declspec(dllexport) __type +# define JS_EXPORT_API(__type) __declspec(dllexport) __type +# define JS_EXTERN_DATA(__type) extern __declspec(dllexport) __type +# define JS_EXPORT_DATA(__type) __declspec(dllexport) __type -#define JS_DLL_CALLBACK __cdecl __loadds -#define JS_STATIC_DLL_CALLBACK(__x) __x JS_DLL_CALLBACK -#endif /* _WINDLL */ +# define JS_DLL_CALLBACK +# define JS_STATIC_DLL_CALLBACK(__x) static __x #else /* Unix */ @@ -126,44 +116,57 @@ #endif #ifdef _WIN32 -# if defined(__MWERKS__) || defined(__GNUC__) -# define JS_IMPORT_API(__x) __x -# else -# define JS_IMPORT_API(__x) __declspec(dllimport) __x -# endif +# if defined(__MWERKS__) || defined(__GNUC__) +# define JS_IMPORT_API(__x) __x +# else +# define JS_IMPORT_API(__x) __declspec(dllimport) __x +# endif +#elif defined(XP_OS2) && defined(__declspec) +# define JS_IMPORT_API(__x) __declspec(dllimport) __x #else -# define JS_IMPORT_API(__x) JS_EXPORT_API (__x) +# define JS_IMPORT_API(__x) JS_EXPORT_API (__x) #endif #if defined(_WIN32) && !defined(__MWERKS__) -# define JS_IMPORT_DATA(__x) __declspec(dllimport) __x +# define JS_IMPORT_DATA(__x) __declspec(dllimport) __x +#elif defined(XP_OS2) && defined(__declspec) +# define JS_IMPORT_DATA(__x) __declspec(dllimport) __x #else -# define JS_IMPORT_DATA(__x) JS_EXPORT_DATA (__x) +# define JS_IMPORT_DATA(__x) JS_EXPORT_DATA (__x) #endif /* * The linkage of JS API functions differs depending on whether the file is - * used within the JS library or not. Any source file within the JS + * used within the JS library or not. Any source file within the JS * interpreter should define EXPORT_JS_API whereas any client of the library - * should not. + * should not. STATIC_JS_API is used to build JS as a static library. */ -#ifdef EXPORT_JS_API -#define JS_PUBLIC_API(t) JS_EXPORT_API(t) -#define JS_PUBLIC_DATA(t) JS_EXPORT_DATA(t) +#if defined(STATIC_JS_API) + +# define JS_PUBLIC_API(t) t +# define JS_PUBLIC_DATA(t) t + +#elif defined(EXPORT_JS_API) + +# define JS_PUBLIC_API(t) JS_EXPORT_API(t) +# define JS_PUBLIC_DATA(t) JS_EXPORT_DATA(t) + #else -#define JS_PUBLIC_API(t) JS_IMPORT_API(t) -#define JS_PUBLIC_DATA(t) JS_IMPORT_DATA(t) + +# define JS_PUBLIC_API(t) JS_IMPORT_API(t) +# define JS_PUBLIC_DATA(t) JS_IMPORT_DATA(t) + #endif #define JS_FRIEND_API(t) JS_PUBLIC_API(t) #define JS_FRIEND_DATA(t) JS_PUBLIC_DATA(t) -#ifdef _WIN32 -# define JS_INLINE __inline +#if defined(_MSC_VER) +# define JS_INLINE __forceinline #elif defined(__GNUC__) # define JS_INLINE #else -# define JS_INLINE +# define JS_INLINE #endif /*********************************************************************** @@ -174,7 +177,14 @@ ** behave syntactically more like functions when called. ***********************************************************************/ #define JS_BEGIN_MACRO do { -#define JS_END_MACRO } while (0) + +#if defined(_MSC_VER) && _MSC_VER >= 1400 +# define JS_END_MACRO \ + } __pragma(warning(push)) __pragma(warning(disable:4127)) \ + while (0) __pragma(warning(pop)) +#else +# define JS_END_MACRO } while (0) +#endif /*********************************************************************** ** MACROS: JS_BEGIN_EXTERN_C @@ -183,11 +193,15 @@ ** Macro shorthands for conditional C++ extern block delimiters. ***********************************************************************/ #ifdef __cplusplus -#define JS_BEGIN_EXTERN_C extern "C" { -#define JS_END_EXTERN_C } + +# define JS_BEGIN_EXTERN_C extern "C" { +# define JS_END_EXTERN_C } + #else -#define JS_BEGIN_EXTERN_C -#define JS_END_EXTERN_C + +# define JS_BEGIN_EXTERN_C +# define JS_END_EXTERN_C + #endif /*********************************************************************** @@ -226,12 +240,12 @@ #define JS_MAX(x,y) ((x)>(y)?(x):(y)) #if (defined(XP_WIN) && !defined(CROSS_COMPILE)) || defined (WINCE) -# include "jscpucfg.h" /* Use standard Mac or Windows configuration */ +# include "jscpucfg.h" /* Use standard Mac or Windows configuration */ #elif defined(XP_UNIX) || defined(XP_BEOS) || defined(XP_OS2) || defined(CROSS_COMPILE) -# include "jsautocfg.h" /* Use auto-detected configuration */ +# include "jsautocfg.h" /* Use auto-detected configuration */ # include "jsosdep.h" /* ...and platform-specific flags */ #else -# error "Must define one of XP_BEOS, XP_OS2, XP_WIN or XP_UNIX" +# error "Must define one of XP_BEOS, XP_OS2, XP_WIN or XP_UNIX" #endif JS_BEGIN_EXTERN_C @@ -247,7 +261,7 @@ JS_BEGIN_EXTERN_C typedef unsigned char JSUint8; typedef signed char JSInt8; #else -#error No suitable type for JSInt8/JSUint8 +# error No suitable type for JSInt8/JSUint8 #endif /************************************************************************ @@ -260,7 +274,7 @@ typedef signed char JSInt8; typedef unsigned short JSUint16; typedef short JSInt16; #else -#error No suitable type for JSInt16/JSUint16 +# error No suitable type for JSInt16/JSUint16 #endif /************************************************************************ @@ -272,15 +286,15 @@ typedef short JSInt16; #if JS_BYTES_PER_INT == 4 typedef unsigned int JSUint32; typedef int JSInt32; -#define JS_INT32(x) x -#define JS_UINT32(x) x ## U +# define JS_INT32(x) x +# define JS_UINT32(x) x ## U #elif JS_BYTES_PER_LONG == 4 typedef unsigned long JSUint32; typedef long JSInt32; -#define JS_INT32(x) x ## L -#define JS_UINT32(x) x ## UL +# define JS_INT32(x) x ## L +# define JS_UINT32(x) x ## UL #else -#error No suitable type for JSInt32/JSUint32 +# error No suitable type for JSInt32/JSUint32 #endif /************************************************************************ @@ -294,28 +308,32 @@ typedef long JSInt32; ** the JSLL_ macros (see jslong.h). ************************************************************************/ #ifdef JS_HAVE_LONG_LONG -#if JS_BYTES_PER_LONG == 8 + +# if JS_BYTES_PER_LONG == 8 typedef long JSInt64; typedef unsigned long JSUint64; -#elif defined(WIN16) +# elif defined(WIN16) typedef __int64 JSInt64; typedef unsigned __int64 JSUint64; -#elif defined(WIN32) && !defined(__GNUC__) +# elif defined(WIN32) && !defined(__GNUC__) typedef __int64 JSInt64; typedef unsigned __int64 JSUint64; -#else +# else typedef long long JSInt64; typedef unsigned long long JSUint64; -#endif /* JS_BYTES_PER_LONG == 8 */ +# endif /* JS_BYTES_PER_LONG == 8 */ + #else /* !JS_HAVE_LONG_LONG */ + typedef struct { -#ifdef IS_LITTLE_ENDIAN +# ifdef IS_LITTLE_ENDIAN JSUint32 lo, hi; -#else +# else JSUint32 hi, lo; #endif } JSInt64; typedef JSInt64 JSUint64; + #endif /* !JS_HAVE_LONG_LONG */ /************************************************************************ @@ -331,7 +349,7 @@ typedef JSInt64 JSUint64; typedef int JSIntn; typedef unsigned int JSUintn; #else -#error 'sizeof(int)' not sufficient for platform use +# error 'sizeof(int)' not sufficient for platform use #endif /************************************************************************ @@ -362,7 +380,11 @@ typedef ptrdiff_t JSPtrdiff; ** A type for pointer difference. Variables of this type are suitable ** for storing a pointer or pointer sutraction. ************************************************************************/ +#if JS_BYTES_PER_WORD == 8 && JS_BYTES_PER_LONG != 8 +typedef JSUint64 JSUptrdiff; +#else typedef unsigned long JSUptrdiff; +#endif /************************************************************************ ** TYPES: JSBool @@ -380,15 +402,20 @@ typedef JSIntn JSBool; ** TYPES: JSPackedBool ** DESCRIPTION: ** Use JSPackedBool within structs where bitfields are not desireable -** but minimum and consistant overhead matters. +** but minimum and consistent overhead matters. ************************************************************************/ typedef JSUint8 JSPackedBool; /* ** A JSWord is an integer that is the same size as a void* */ +#if JS_BYTES_PER_WORD == 8 && JS_BYTES_PER_LONG != 8 +typedef JSInt64 JSWord; +typedef JSUint64 JSUword; +#else typedef long JSWord; typedef unsigned long JSUword; +#endif #include "jsotypes.h" @@ -409,13 +436,37 @@ typedef unsigned long JSUword; ** ***********************************************************************/ #if defined(__GNUC__) && (__GNUC__ > 2) -#define JS_LIKELY(x) (__builtin_expect((x), 1)) -#define JS_UNLIKELY(x) (__builtin_expect((x), 0)) + +# define JS_LIKELY(x) (__builtin_expect((x), 1)) +# define JS_UNLIKELY(x) (__builtin_expect((x), 0)) + #else -#define JS_LIKELY(x) (x) -#define JS_UNLIKELY(x) (x) + +# define JS_LIKELY(x) (x) +# define JS_UNLIKELY(x) (x) + #endif +/*********************************************************************** +** MACROS: JS_ARRAY_LENGTH +** JS_ARRAY_END +** DESCRIPTION: +** Macros to get the number of elements and the pointer to one past the +** last element of a C array. Use them like this: +** +** jschar buf[10], *s; +** JSString *str; +** ... +** for (s = buf; s != JS_ARRAY_END(buf); ++s) *s = ...; +** ... +** str = JS_NewStringCopyN(cx, buf, JS_ARRAY_LENGTH(buf)); +** ... +** +***********************************************************************/ + +#define JS_ARRAY_LENGTH(array) (sizeof (array) / sizeof (array)[0]) +#define JS_ARRAY_END(array) ((array) + JS_ARRAY_LENGTH(array)) + JS_END_EXTERN_C #endif /* jstypes_h___ */ diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.2008.vcproj b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.2008.vcproj index d2f7fb3..cf35ce5 100644 --- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.2008.vcproj +++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.2008.vcproj @@ -44,7 +44,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="" - PreprocessorDefinitions="SM_EXPORTS;JS_HAS_FILE_OBJECT=1" + PreprocessorDefinitions="SM_EXPORTS;JS_HAS_FILE_OBJECT=1;XP_WIN" UsePrecompiledHeader="0" /> <Tool @@ -111,7 +111,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="" - PreprocessorDefinitions="SM_EXPORTS;JS_HAS_FILE_OBJECT=1" + PreprocessorDefinitions="SM_EXPORTS;JS_HAS_FILE_OBJECT=1;XP_WIN" UsePrecompiledHeader="0" /> <Tool @@ -178,7 +178,7 @@ <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="" - PreprocessorDefinitions="SM_EXPORTS;JS_HAS_FILE_OBJECT=1" + PreprocessorDefinitions="SM_EXPORTS;JS_HAS_FILE_OBJECT=1;XP_WIN" UsePrecompiledHeader="0" /> <Tool @@ -244,7 +244,7 @@ <Tool Name="VCCLCompilerTool" AdditionalIncludeDirectories="" - PreprocessorDefinitions="SM_EXPORTS;JS_HAS_FILE_OBJECT=1" + PreprocessorDefinitions="SM_EXPORTS;JS_HAS_FILE_OBJECT=1;XP_WIN" UsePrecompiledHeader="0" /> <Tool diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.2010.vcxproj b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.2010.vcxproj index fd7c7c8..330feaa 100644 --- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.2010.vcxproj +++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.2010.vcxproj @@ -72,7 +72,7 @@ <ClCompile> <Optimization>Disabled</Optimization> <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>SM_EXPORTS;JS_HAS_FILE_OBJECT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>SM_EXPORTS;JS_HAS_FILE_OBJECT=1;XP_WIN;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PrecompiledHeader> </PrecompiledHeader> </ClCompile> @@ -91,7 +91,7 @@ <ClCompile> <Optimization>Disabled</Optimization> <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>SM_EXPORTS;JS_HAS_FILE_OBJECT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>SM_EXPORTS;JS_HAS_FILE_OBJECT=1;XP_WIN;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PrecompiledHeader> </PrecompiledHeader> </ClCompile> @@ -107,7 +107,7 @@ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ClCompile> <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>SM_EXPORTS;JS_HAS_FILE_OBJECT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>SM_EXPORTS;JS_HAS_FILE_OBJECT=1;XP_WIN;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PrecompiledHeader> </PrecompiledHeader> </ClCompile> @@ -125,7 +125,7 @@ </Midl> <ClCompile> <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>SM_EXPORTS;JS_HAS_FILE_OBJECT=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>SM_EXPORTS;JS_HAS_FILE_OBJECT=1;XP_WIN;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PrecompiledHeader> </PrecompiledHeader> </ClCompile> commit 180f58a677a2ef49f71cbbe377f9eb177e6574e5 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Nov 17 12:17:27 2010 -0600 FS-2851 diff --git a/src/switch_channel.c b/src/switch_channel.c index 0b1b6e8..c63a1aa 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -1971,7 +1971,7 @@ SWITCH_DECLARE(void) switch_channel_event_set_basic_data(switch_channel_t *chann SWITCH_DECLARE(void) switch_channel_event_set_extended_data(switch_channel_t *channel, switch_event_t *event) { switch_event_header_t *hi; - int x, global_verbose_events = 0; + int global_verbose_events = -1; switch_mutex_lock(channel->profile_mutex); @@ -2004,7 +2004,6 @@ SWITCH_DECLARE(void) switch_channel_event_set_extended_data(switch_channel_t *ch event->event_id == SWITCH_EVENT_MEDIA_BUG_STOP || event->event_id == SWITCH_EVENT_CUSTOM) { - x = 0; /* Index Variables */ if (channel->variables) { for (hi = channel->variables->headers; hi; hi = hi->next) { @@ -2013,8 +2012,7 @@ SWITCH_DECLARE(void) switch_channel_event_set_extended_data(switch_channel_t *ch vvar = (char *) hi->name; vval = (char *) hi->value; - x++; - + switch_assert(vvar && vval); switch_snprintf(buf, sizeof(buf), "variable_%s", vvar); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, buf, vval); commit b32ceb3c228b33d5640cc5253f6e88d7b98baa60 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Nov 17 11:46:20 2010 -0600 part 2 diff --git a/libs/stfu/stfu.c b/libs/stfu/stfu.c index bb10b4a..0422cd2 100644 --- a/libs/stfu/stfu.c +++ b/libs/stfu/stfu.c @@ -269,22 +269,22 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i) { uint32_t index; stfu_frame_t *rframe = NULL; - + if (((i->out_queue->wr_len == i->out_queue->array_len) || !i->out_queue->array_len)) { return NULL; } if (i->cur_ts == 0) { - i->cur_ts = i->out_queue->array[1].ts; + i->cur_ts = i->out_queue->array[0].ts; } else { i->cur_ts += i->interval; } + if (stfu_n_find_frame(i->out_queue, i->cur_ts, &rframe, &index) || stfu_n_find_frame(i->in_queue, i->cur_ts, &rframe, &index)) { i->last_frame = rframe; i->out_queue->wr_len++; i->last_wr_ts = rframe->ts; - rframe->was_read = 1; i->miss_count = 0; } else { i->last_wr_ts = i->cur_ts; commit b517ddd6d3f1090fec83fe91c508b5f8bb19dd2a Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Nov 17 10:51:14 2010 -0600 fix jitterbuffer diff --git a/libs/stfu/stfu.c b/libs/stfu/stfu.c index 7c30ab2..bb10b4a 100644 --- a/libs/stfu/stfu.c +++ b/libs/stfu/stfu.c @@ -47,6 +47,7 @@ struct stfu_instance { struct stfu_queue *in_queue; struct stfu_queue *out_queue; struct stfu_frame *last_frame; + uint32_t cur_ts; uint32_t last_wr_ts; uint32_t last_rd_ts; uint32_t interval; @@ -267,27 +268,26 @@ static int stfu_n_find_frame(stfu_queue_t *queue, uint32_t ts, stfu_frame_t **r_ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i) { uint32_t index; - uint32_t should_have = 0; stfu_frame_t *rframe = NULL; if (((i->out_queue->wr_len == i->out_queue->array_len) || !i->out_queue->array_len)) { return NULL; } - if (i->last_wr_ts) { - should_have = i->last_wr_ts + i->interval; - } else { - should_have = i->out_queue->array[0].ts; - } - - if (stfu_n_find_frame(i->out_queue, should_have, &rframe, &index) || stfu_n_find_frame(i->in_queue, should_have, &rframe, &index)) { + if (i->cur_ts == 0) { + i->cur_ts = i->out_queue->array[1].ts; + } else { + i->cur_ts += i->interval; + } + + if (stfu_n_find_frame(i->out_queue, i->cur_ts, &rframe, &index) || stfu_n_find_frame(i->in_queue, i->cur_ts, &rframe, &index)) { i->last_frame = rframe; i->out_queue->wr_len++; i->last_wr_ts = rframe->ts; rframe->was_read = 1; i->miss_count = 0; } else { - i->last_wr_ts = should_have; + i->last_wr_ts = i->cur_ts; rframe = &i->out_queue->int_frame; if (i->last_frame && i->last_frame != rframe) { @@ -296,12 +296,11 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i) memcpy(rframe->data, i->last_frame->data, rframe->dlen); } - rframe->ts = should_have; + rframe->ts = i->cur_ts; if (++i->miss_count > i->max_plc) { - i->interval = 0; i->out_queue->wr_len = i->out_queue->array_size; - i->last_wr_ts = 0; + i->cur_ts = 0; rframe = NULL; } } commit fee2f1b701c5d454caf2e1ade91f75d7d234087a Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Wed Nov 17 14:36:31 2010 -0200 freetdm: removed empty stats from ftmod_r2 and fixed strsep() definition warning. diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index dd2dc1f..d534481 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -31,11 +31,15 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include <stdio.h> #ifdef __linux__ +#ifndef _BSD_SOURCE +#define _BSD_SOURCE /* for strsep() */ +#endif #include <syscall.h> #include <poll.h> +#include <string.h> #endif +#include <stdio.h> #include <openr2.h> #include "freetdm.h" #include "private/ftdm_core.h" @@ -1607,22 +1611,13 @@ static FIO_API_FUNCTION(ftdm_r2_api) r2data->loops, r2data->monitor_thread_id); stream->write_function(stream, "\n"); - stream->write_function(stream, "%4s %-12.12s %-12.12s %6s %6s %6s %6s\n", "Channel", "Tx CAS", "Rx CAS", - "Rx Avg", "Tx Avg", "Rx", "Tx"); + stream->write_function(stream, "%4s %-12.12s %-12.12s\n", "Channel", "Tx CAS", "Rx CAS"); for (i = 1; i <= span->chan_count; i++) { - char rx_str[25]; - char tx_str[25]; - char rxavg_str[25]; - char txavg_str[25]; r2chan = R2CALL(span->channels[i])->r2chan; - stream->write_function(stream, "%4d %-12.12s %-12.12s %6s %6s %6s %6s\n", + stream->write_function(stream, "%4d %-12.12s %-12.12s\n", span->channels[i]->chan_id, openr2_chan_get_tx_cas_string(r2chan), - openr2_chan_get_rx_cas_string(r2chan), - rxavg_str, - txavg_str, - rx_str, - tx_str); + openr2_chan_get_rx_cas_string(r2chan)); } stream->write_function(stream, "\n"); stream->write_function(stream, "+OK.\n"); commit 5d28a8fa057d948464588226598e94f2c905d20f Author: cypromis <michal.bielicki@seventhsignal.de> Date: Wed Nov 17 17:15:30 2010 +0100 ftmod_zt typo ... diff --git a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c index 06c48da..9247edc 100644 --- a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c +++ b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c @@ -896,7 +896,7 @@ pollagain: result = poll(pfds, 1, to); *flags = 0; - if result < 0 && errno == EINTR) { + if (result < 0 && errno == EINTR) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "DAHDI wait got interrupted, trying again\n"); goto pollagain; } commit 05d1fd2a66e6acb73937a0adae23563f6ee6fae0 Author: cypromis <michal.bielicki@seventhsignal.de> Date: Wed Nov 17 17:01:30 2010 +0100 ftmod_zt rc has changed to result diff --git a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c index b135e61..06c48da 100644 --- a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c +++ b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c @@ -896,7 +896,7 @@ pollagain: result = poll(pfds, 1, to); *flags = 0; - if (rc < 0 && errno == EINTR) { + if result < 0 && errno == EINTR) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "DAHDI wait got interrupted, trying again\n"); goto pollagain; } commit 1c1df1f77239b32701cdcabc9eb63f4974210d53 Author: Rupa Schomaker <rupa@rupa.com> Date: Wed Nov 17 09:34:09 2010 -0600 mod_lcr: FS-2820 - profile support in dialplan module diff --git a/src/mod/applications/mod_lcr/mod_lcr.c b/src/mod/applications/mod_lcr/mod_lcr.c index cc93707..5f70e0a 100644 --- a/src/mod/applications/mod_lcr/mod_lcr.c +++ b/src/mod/applications/mod_lcr/mod_lcr.c @@ -1387,7 +1387,6 @@ SWITCH_STANDARD_DIALPLAN(lcr_dialplan_hunt) switch_channel_t *channel = switch_core_session_get_channel(session); callback_t routes = { 0 }; lcr_route cur_route = { 0 }; - char *lcr_profile = NULL; switch_memory_pool_t *pool = NULL; switch_event_t *event = NULL; const char *intrastate = NULL; @@ -1403,11 +1402,6 @@ SWITCH_STANDARD_DIALPLAN(lcr_dialplan_hunt) } routes.pool = pool; - if (!(routes.profile = locate_profile(lcr_profile))) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Unknown profile: %s\n", lcr_profile); - goto end; - } - intrastate = switch_channel_get_variable(channel, "intrastate"); intralata = switch_channel_get_variable(channel, "intralata"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "intrastate channel var is [%s]\n", intrastate); @@ -1427,7 +1421,12 @@ SWITCH_STANDARD_DIALPLAN(lcr_dialplan_hunt) caller_profile = switch_channel_get_caller_profile(channel); } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "LCR Lookup on %s using profile %s\n", caller_profile->destination_number, lcr_profile); + if (!(routes.profile = locate_profile(caller_profile->context))) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Unknown profile: %s\n", caller_profile->context); + goto end; + } + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "LCR Lookup on %s using profile %s\n", caller_profile->destination_number, caller_profile->context); routes.lookup_number = caller_profile->destination_number; routes.cid = (char *) caller_profile->caller_id_number; if (lcr_do_lookup(&routes) == SWITCH_STATUS_SUCCESS) { @@ -1465,7 +1464,7 @@ SWITCH_STANDARD_DIALPLAN(lcr_dialplan_hunt) switch_caller_extension_add_application(session, extension, app, argc); } } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "LCR lookup failed for %s using profile %s\n", caller_profile->destination_number, lcr_profile); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "LCR lookup failed for %s using profile %s\n", caller_profile->destination_number, caller_profile->context); } end: commit 5486b8c74d9b853cd74229689dc67800cd722c65 Author: Moises Silva <moy@sangoma.com> Date: Tue Nov 16 23:41:11 2010 -0500 freetdm: retry polling in DAHDI devices when fails due to interrupted system call diff --git a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c index ddf7b3f..b135e61 100644 --- a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c +++ b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c @@ -889,13 +889,18 @@ static FIO_WAIT_FUNCTION(zt_wait) inflags |= POLLPRI; } - +pollagain: memset(&pfds[0], 0, sizeof(pfds[0])); pfds[0].fd = ftdmchan->sockfd; pfds[0].events = inflags; result = poll(pfds, 1, to); *flags = 0; + if (rc < 0 && errno == EINTR) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "DAHDI wait got interrupted, trying again\n"); + goto pollagain; + } + if (pfds[0].revents & POLLERR) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "DAHDI device got POLLERR\n"); result = -1; commit 21e1f69b982682c8d135a52193dee3450f9d53a4 Author: Jeff Lenk <jeff@jefflenk.com> Date: Tue Nov 16 20:21:59 2010 -0600 add spidermonkey back to x64 build and setup diff --git a/Freeswitch.2010.sln b/Freeswitch.2010.sln index 5722802..1869698 100644 --- a/Freeswitch.2010.sln +++ b/Freeswitch.2010.sln @@ -942,11 +942,13 @@ Global {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|Win32.ActiveCfg = Debug|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|Win32.Build.0 = Debug|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|x64.ActiveCfg = Debug|x64 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|x64.Build.0 = Debug|x64 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|x64 Setup.ActiveCfg = Debug|x64 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|Win32.ActiveCfg = Release|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|Win32.Build.0 = Release|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|x64.ActiveCfg = Release|x64 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|x64.Build.0 = Release|x64 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|x64 Setup.ActiveCfg = Release|x64 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|x86 Setup.ActiveCfg = Release|Win32 {692F6330-4D87-4C82-81DF-40DB5892636E}.All|Win32.ActiveCfg = Release|x64 @@ -1442,11 +1444,13 @@ Global {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|Win32.ActiveCfg = Debug|Win32 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|Win32.Build.0 = Debug|Win32 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|x64.ActiveCfg = Debug|x64 + {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|x64.Build.0 = Debug|x64 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|x64 Setup.ActiveCfg = Debug|x64 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|Win32.ActiveCfg = Release|Win32 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|Win32.Build.0 = Release|Win32 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|x64.ActiveCfg = Release|x64 + {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|x64.Build.0 = Release|x64 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|x64 Setup.ActiveCfg = Release|x64 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|x86 Setup.ActiveCfg = Release|Win32 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.All|Win32.ActiveCfg = Release|x64 @@ -1458,11 +1462,13 @@ Global {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|Win32.ActiveCfg = Debug|Win32 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|Win32.Build.0 = Debug|Win32 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|x64.ActiveCfg = Debug|x64 + {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|x64.Build.0 = Debug|x64 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|x64 Setup.ActiveCfg = Debug|x64 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|Win32.ActiveCfg = Release|Win32 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|Win32.Build.0 = Release|Win32 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|x64.ActiveCfg = Release|x64 + {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|x64.Build.0 = Release|x64 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|x64 Setup.ActiveCfg = Release|x64 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|x86 Setup.ActiveCfg = Release|Win32 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|Win32.ActiveCfg = Release|x64 @@ -1510,11 +1516,13 @@ Global {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|Win32.ActiveCfg = Debug|Win32 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|Win32.Build.0 = Debug|Win32 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|x64.ActiveCfg = Debug|x64 + {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|x64.Build.0 = Debug|x64 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|x64 Setup.ActiveCfg = Debug|x64 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|Win32.ActiveCfg = Release|Win32 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|Win32.Build.0 = Release|Win32 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|x64.ActiveCfg = Release|x64 + {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|x64.Build.0 = Release|x64 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|x64 Setup.ActiveCfg = Release|x64 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|x86 Setup.ActiveCfg = Release|Win32 {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.All|Win32.ActiveCfg = Release|x64 @@ -1670,11 +1678,13 @@ Global {028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|Win32.ActiveCfg = Debug|Win32 {028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|Win32.Build.0 = Debug|Win32 {028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|x64.ActiveCfg = Debug|x64 + {028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|x64.Build.0 = Debug|x64 {028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|x64 Setup.ActiveCfg = Debug|x64 {028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {028C7278-05D7-4E18-82FE-BE231B844F41}.Release|Win32.ActiveCfg = Release|Win32 {028C7278-05D7-4E18-82FE-BE231B844F41}.Release|Win32.Build.0 = Release|Win32 {028C7278-05D7-4E18-82FE-BE231B844F41}.Release|x64.ActiveCfg = Release|x64 + {028C7278-05D7-4E18-82FE-BE231B844F41}.Release|x64.Build.0 = Release|x64 {028C7278-05D7-4E18-82FE-BE231B844F41}.Release|x64 Setup.ActiveCfg = Release|x64 {028C7278-05D7-4E18-82FE-BE231B844F41}.Release|x86 Setup.ActiveCfg = Release|Win32 {D7F1E3F2-A3F4-474C-8555-15122571AF52}.All|Win32.ActiveCfg = Release|x64 @@ -1938,11 +1948,13 @@ Global {36E854E3-CE12-4348-A125-CCF3F9D74813}.Debug|Win32.ActiveCfg = Debug|Win32 {36E854E3-CE12-4348-A125-CCF3F9D74813}.Debug|Win32.Build.0 = Debug|Win32 {36E854E3-CE12-4348-A125-CCF3F9D74813}.Debug|x64.ActiveCfg = Debug|x64 + {36E854E3-CE12-4348-A125-CCF3F9D74813}.Debug|x64.Build.0 = Debug|x64 {36E854E3-CE12-4348-A125-CCF3F9D74813}.Debug|x64 Setup.ActiveCfg = Debug|x64 {36E854E3-CE12-4348-A125-CCF3F9D74813}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|Win32.ActiveCfg = Release|Win32 {36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|Win32.Build.0 = Release|Win32 {36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|x64.ActiveCfg = Release|x64 + {36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|x64.Build.0 = Release|x64 {36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|x64 Setup.ActiveCfg = Release|x64 {36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|x86 Setup.ActiveCfg = Release|Win32 {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.All|Win32.ActiveCfg = Release|x64 diff --git a/w32/Setup/Setup.wixproj b/w32/Setup/Setup.wixproj index 9aba3a1..7d11c90 100644 --- a/w32/Setup/Setup.wixproj +++ b/w32/Setup/Setup.wixproj @@ -597,6 +597,51 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> + <ProjectReference Include="..\..\src\mod\languages\mod_spidermonkey\mod_spidermonkey.2010.vcxproj"> + <Name>mod_spidermonkey</Name> + <Project>{1ad3f51e-bbb6-4090-ba39-9dfab1ef1f5f}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\..\src\mod\languages\mod_spidermonkey\mod_spidermonkey_core_db.2010.vcxproj"> + <Name>mod_spidermonkey_core_db</Name> + <Project>{acfff684-4d19-4d48-af12-88ea1d778bdf}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\..\src\mod\languages\mod_spidermonkey\mod_spidermonkey_odbc.2010.vcxproj"> + <Name>mod_spidermonkey_odbc</Name> + <Project>{0a6b5ea5-6e9b-4a51-931f-ed25aa87b4df}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\..\src\mod\languages\mod_spidermonkey\mod_spidermonkey_socket.2010.vcxproj"> + <Name>mod_spidermonkey_socket</Name> + <Project>{028c7278-05d7-4e18-82fe-be231b844f41}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\..\src\mod\languages\mod_spidermonkey\mod_spidermonkey_teletone.2010.vcxproj"> + <Name>mod_spidermonkey_teletone</Name> + <Project>{8f992c49-6c51-412f-b2a3-34eab708eb65}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> <ProjectReference Include="..\..\src\mod\loggers\mod_console\mod_console.2010.vcxproj"> <Name>mod_console</Name> <Project>{1c453396-d912-4213-89fd-9b489162b7b5}</Project> commit 8be0cef9079ca3e2935798412739e7b83b1cc42c Author: Michael S Collins <msc@freeswitch.org> Date: Tue Nov 16 18:09:27 2010 -0800 Update ChangeLog through Nov 16 diff --git a/docs/ChangeLog b/docs/ChangeLog index e0f5297..6037c14 100644 --- a/docs/ChangeLog +++ b/docs/ChangeLog @@ -19,6 +19,7 @@ freeswitch (1.0.7) build: add mod_osp Makefile to configure generated Makefiles (r:dc06a039/FS-122) build: Remove mod_spidermonkey from windows 2008 x64 builds - does not work (r:280e894d) build: fix warnings on windows x64 builds src and mods projects - only libsofia included on the libs side (r:45ecbc2f) + build: Patch debian init.d script to set ulimit values (r:0eb33e57/FS-2844) codec2: working prototype, still for testing only (r:04ca0751) config: move limit.conf to db.conf config: Update VM phrase macros to voice option then action on main, config menus @@ -118,6 +119,21 @@ freeswitch (1.0.7) core: "Silent recovery" (r:93c2ed94) core: fix switch_find_local_ip to properly handle force_local_ip_v4 and _v6 (r:f42c9036/FS-2778) core: fix att_xfer/3-way scenario (r:0559cc50) + core: dmachine - timeout instantly when you have exact match and are equal to max digits (r:81a9f8ef) + core: Core ODBC support for transactions with MSSQL (r:d2ca8d40/FS-2050) + core: Show the UUID of the session in the log when sending RFC2833 DTMF packet and when receiving a RTP DTMF (r:9241a35e) + core: add record_post_process_exec_app and record_post_process_exec_api both can have <app|cmd>:<args> (r:07adca56) + core: add -ncwait for Unix based implememtations to make the backgrounder wait to make sure the process starts before detaching (r:23d5fc19) + core: fire DTMF event when converting dtmf to inband with start_dtmf_generate (r:dcdd3811) + core: fail calls with uninitialized frame (r:7dafe4e2) + core: allow switch_process_import to specify a prefix (r:e0c37c1f) + core: add additional info when fail (r:4bbd9a4c/FS-2825) + core: avoid hypothetical problem with flushing queue with delayed events (r:49b6237e) + core: add send_silence_when_idle and dmachine honoring to park loop (r:3be3cd76) + core: ivr_enterprise_originate: Fix export of variable from the originator channel to the called channels (r:025c82e7) + core: Better handling of progress and answering to prevent sip profile from locking up at higher volumes (r:04e57577/FS-2801) + core: ACL for IPv6 address and swigall to boot (r:db91f0e8/FS-2842) + core: add intercept_unanswered_only var akin to intercept_unbridged_only (r:68f18efe) lang: Improve French phrase files (FSCONFIG-23) libapr: Fix issue where after a bridge with a member, uuid of Agent is set to single quote character ' (r:3fee704d/FS-2738) libdingaling: fix race on shutdown causing crash (FSMOD-47) @@ -146,6 +162,7 @@ freeswitch (1.0.7) libsofiasip: Fix random crashes (r:c15ee980/SFSIP-219) libsofiasip: Fix T.38 bug in sofia_glue (r:2843f1ad/MODSOFIA-94) libsofiasip: VS2010 sofia posix problem (r:46dd24c2/SFSIP-220) + libsofiasip: set minimum initital sip t1 timer to 1000ms to work around race condition on retry timer firing before all the things that are supposed to be handled by the timer are set. The base resolution on this timer is 500ms, so doubling up makes sure we always hit the initial retry timer on the next run, where everything should be set. The side effect was, 1/2 the time on a request that did not get immediate response, the timer would be fired and cleared, but the action (sending retry) was never done, and a new timer was not set, causing the request to just sit zombied and never retry. A better solution would be to find and correct the race condition so the timer is never set to early and we never hit this condition. (r:20c2740c) libspandsp: Fixed a typo in spandsp's msvc/inttypes.h Updated sig_tone processing in spandsp to the latest, to allow moy to proceed with his signaling work. libspandsp: removed a saturate16 from spandsp that was causing problems fixed a typo in the MSVC inttypes.h file for spandsp libspandsp: Changes to the signaling tone detector to detect concurrent 2400Hz + 2600Hz tones. This passes voice immunity and other key tests, but it bounces a bit when transitions like 2400 -> 2400+2600 -> 2600 occur. Transitions between tone off and tone on are clean. (r:bc13e944) @@ -154,6 +171,7 @@ freeswitch (1.0.7) libspandsp: spandsp t38 fax receiving error in win XP - regression from f029f7ef (r:761cec8f/FS-2766) mod_avmd: Initial check in - Advanced Voicemail Detect (r:10c6a30a) (by Eric Des Courtis) mod_avmd: Add to windows build (r:df4bd935) + mod_avmd: Fix mem leak (r:cd951384/FS-2839) mod_callcenter: Initial commit of the mod_callcenter application. This module is in it early state of developpement. You can see documentation on the wiki at : <a href="http://wiki.freeswitch.org/wiki/Mod_callcenter">http://wiki.freeswitch.org/wiki/Mod_callcenter</a> For support/comments, please use <a href="http://jira.freeswitch.org/">http://jira.freeswitch.org/</a> and select the MOD CALLCENTER module. (r:ba09b96d) mod_callcenter: Add ability to unload/reload/load a queue setting (You still need to reloadxml before). Note that joining a queue will check for it in the config and load it on the fly... I've used the same system as in mod_voicemail. Not sure if we should allow this, but just comment it out of the config before unload and it wont be available anymore (r:3eafca60) mod_callcenter: Try to fix the ring-all, also add cli auto complete done in previous commit (r:1666783c) @@ -170,6 +188,8 @@ freeswitch (1.0.7) mod_callcenter: Make sure we fail to load if config is not present (r:e1fb79a1) mod_callcenter: Fix invalid update of agent field (r:426a448f/FS-2738) mod_callcenter: Allow to get queue info via api (r:70d592ae) + mod_callcenter: Fix bad return type so it compile on archlinux, thx bougyman (r:3a475986) + mod_callcenter: Make callcenter_config agent get return the value of the item requested. Also added queue param max-wait-time-with-no-agent-time-reached: If the max-wai-time-with-no-agent is already reached for the queue, then new caller can wait for x ammount of second before it kicked out of the queue rather than get rejected automaticly. (r:81a03869) mod_cidlookup: null xml is bad (r:095815f8) mod_cid_lookup: honor skipcitystate when using whitepages (r:a66654de/FSMOD-53) mod_commands: make break uuid_break and add cascade flag @@ -184,6 +204,7 @@ freeswitch (1.0.7) mod_commands: Allow cond API to return empty false value (r:c8a897b9) mod_commands: ***BEHAVIOUR CHANGE*** reloadacl, load <module>, reload <module> will now explicitly call reloadxml (r:42c9df72) mod_commands: add nat_map usage (r:7577b8aa) + mod_commands: add escaping empty strings to sql_escape (r:7bd0a5a6/FS-2833) mod_conference: Fix reporting of volume up/down (MODAPP-419) mod_conference: add last talking time per member to conference xml list mod_conference: add terminate-on-silence conference param @@ -213,14 +234,19 @@ freeswitch (1.0.7) mod_erlang_event: generate long node names the same as erlang does (r:9ad509c2) mod_erlang_event: Improve some logging to include UUIDs (r:c0d51b83) mod_erlang_event: Support for reading erlang cookie from a file (r:094ffe37) + mod_erlang_event: Rewrite XML fetch conditional wait to be more sane (Reported by James Aimonetti) (r:6941c6eb/FS-2775) mod_event_socket: fix up other users of switch_event_xmlize() to use SWITCH_EVENT_NONE (r:d6eb7562) mod_event_socket: Fix small mem leaks (r:e4f90584/MODEVENT-68) + mod_event_socket: Add "-ERR" to api cmd response when failure occurs (r:58759052/FS-2827) mod_fifo: allow multiple dtmf to exit fifo, set fifo_caller_exit_key to specify which (MODAPP-420) mod_fifo: cancel outbound call if customer hangs up (r:cadb4d94) mod_fifo: add taking_calls param to fifo member add and config file (r:821488bf) mod_fifo: add nomedia flag (r:2d30a8c2) mod_fifo: Fix inconsistency between the fifo queue and the channels (num callers in queue can become "-1") (r:07487114/FS-1659) mod_fifo: fix issue leaving stale records in fifo_bridge table (r:b36d015f) + mod_fifo: fix fifo race in use count dec (r:402e383b) + mod_fifo: add outbound_ring_timeout param to mod_fifo (r:3885eea7) + mod_fifo: add default_lag to fifo (r:dd4fb5be) mod_freetdm: Fix for TON and NPI not passed through to channel variables on incoming calls mod_freetdm: add pvt data to freetdm channels fix fxs features (r:9d456900) mod_freetdm: export and import boost custom data (r:edb2d582) @@ -254,6 +280,7 @@ freeswitch (1.0.7) mod_freetdm: created cmake files for freetdm (r:fc55997b) mod_freetdm: ss7 - added support to control mtp2, mtp3, and isup timers via freetdm.conf.xml (r:4455d581) mod_gsmopen: copy from branch + mod_gsmopen: fix FS-2793, compilation stops (r:355c0dbb/FS-2793) mod_hash: free all hashtables on shutdown (r:e76d7d92) mod_hash: remove unneeded initializer (r:10d468a6) mod_hash: begin working on remote support (r:c5ad49da) @@ -277,6 +304,8 @@ freeswitch (1.0.7) mod_java: fix eventConsumer issue and add flush() method (r:7fd3aff6) mod_java: Allow user defined java methods to be called at startup and shutdown of JVM (r:1339e218/MODLANG-117) mod_json_cdr: Fix segfault in mod_json_cdr.c (r:f347698a/MODEVENT-66) + mod_khomp: Added mod_khomp Endpoint. (r:5fea197b) + mod_khomp: Removed alternative contexts / extensions - New struct for matchs - On calls originated from an FXS branch, the Endpoint searches for a valid extension (digits sent) after the DTMF '#' or after the timeout (option fxs-digit-timeout). That search is done in the context defined in section <fxs-options>, or if no context configured, the search is done in context defined in context-fxs. - Added "dialplan" configuration: Name of the dialplan module in use (default XML) - Group context enabled. If set, the search for a valid extension is done only in that context. - Updated documentation (r:1ef3fc9a) mod_lcr: Expand variables (MODAPP-418) mod_lcr: add enable_sip_redir parameter (r:70bf7a0a/MODAPP-427) mod_lcr: don't validate profiles with ${} vars since they are dynamic and we can't guess what the proper value should be (r:af33afaa) @@ -287,12 +316,16 @@ freeswitch (1.0.7) mod_loopback: add loopback_bowout_on_execute var to make 1 legged loopback calls bow out of the picture mod_loopback: only execute app once in app mode (r:64f58f2d) mod_loopback: fix bug in mod_loopback where bowout=false (r:e9ab5368) + mod_loopback: pass indication when in app mode on mod_loopback (r:c423e209) + mod_loopback: fix voicemail failure (r:1a1881e8/FS-2795) + mod_loopback: pass ring_ready like we do with pre_answer (r:9d087d45) mod_lua: Add switch_core_sqldb functionality from inside Lua script (r:26f2e095/FS-1384) mod_lua: Made 2nd arg to freeswitch.Dbh:query (cb func) optional (r:87db11af) mod_lua: Added SAF_ROUTING_EXEC flag to lua app, so it can be run inline (r:7d5ca1c0) mod_managed: Added wrapper for switch_event_bind for .net (r:a5f07a80/MODLANG-165) mod_managed: add additional support (r:5be58aac) mod_mp4v: MP4V-ES passthru for washibechi on IRC + mod_mp4: New module. Supports playback of MP4 files. Depends on libmp4v2 <http://code.google.com/p/mp4v2/> (originally compiled against v1.6.1) mod_nibblebill: free allocated mem at shutdown; free properly if using custom_sql mod_nibblebill: Add SAF_SUPPORT_NOMEDIA to nibblebill mod_nibblebill: fix compile issues in latest HEAD (r:b073e82b/FSMOD-51) @@ -312,7 +345,15 @@ freeswitch (1.0.7) mod_sangoma_codec: silence suppression (r:73d9d56f) mod_sangoma_codec: do not return 0 len frames and return silence instead when there is no transcoding output update stats only when we really receive a frame (r:dc4d19e9) mod_sangoma_codec: flush sockets on first use (r:bbba1148) - mod_say_es: fix grammar when saying dates and time (r:6bed19b2/MODAPP-429) + mod_sangoma_codec: use native L16 for the source codec (r:d2e25519) + mod_sangoma_codec: default to G729 only and remove L16 since it did not make any sense (r:1d5aa062) + mod_sangoma_codec: add iLBC 13.3k and 15.2k (r:68abb39e) + mod_sangoma_codec: add G723.1 (r:3e33540a) + mod_sangoma_codec: register AMR (r:31cc2502) + mod_sangoma_codec: add G722 (r:ca8c2336) + mod_sangoma_codec: add siren7 32kbps (r:fcaf2677) + mod_sangoma_codec: add SIREN7 24kbps (r:3acc5fdb) + mod_say_es: fix grammar when saying dates and time (r:6bed19b2/MODAPP-429) mod_say_ja: initial commit, still needs sound files (r:b2423158/FS-2755) mod_say_ru: Fix saying time with +1 hour of current time (r:68d74c31/MODAPP-444) mod_say_zh: Number reading should now be OK for the whole range of integers for Cantonese and Mandarin @@ -341,6 +382,7 @@ freeswitch (1.0.7) mod_skypopen: now answer a call only when directed to do it (before was trying to answer any incoming call). Lot of changes to a messy part, so maybe some problem will come out... (r:45c6c4d3) mod_skypopen: ignore early media sent by channels to be bridged before our channel is answered (r:ef14b78a) mod_sndfile: Add support for .alaw and .ulaw to mod_sndfile (r:facf09b8/MODFORM-41) + mod_sndfile: return break in mod_sndfile when seek returns failure (r:564dc7e4) mod_sofia: Send SIP MESSAGE to unregistered users by prefixing sip: to user@domain mod_sofia: fix callee being updated with callee information mod_sofia: set appearance-index in update statement for SLA @@ -417,6 +459,19 @@ freeswitch (1.0.7) mod_sofia: Set SDP proper connection type of "c=" field to IP6 or IP4 when IPv6 called IPv4 (r:14361c09/FS-620) mod_sofia: FS wrongly assumes NAT on Cisco 7941G (r:42f534fa/FS-2773) mod_sofia: sofia_reg.c doesn't pass profile name into query, also, typo with all-reg-options-ping (r:6772c795/FS-2787) + mod_sofia: adjust sql stmts in presence to allow even non-registered entities to be tracked (r:4e0399d0) + mod_sofia: dont update display to ring when call is hungup in pidf presence (r:36851a90) + mod_sofia: 1) Add force-publish-expires to set custom presence update expires delta (-1 means endless) 2) Check how many users are registered when receiving a PUBLISH AND Multiple Registrations is enabled: if there is more than just 1 AND you are sending a offline message: skip publishing it to everyone to prevent clients from thinking themselves has gone offline. (r:fd1736b3) + mod_sofia: profile param ignore-183nosdp, chanvar sip_ignore_183nosdp FS-1978 (r:59d3b84d/FS-1978) + mod_sofia: fix race in codec failure condition, then fix bug in sdp parsing (likely a regression from recent codec changes) to never have the problem in the first place so you are double-protected (r:19325c43) + mod_sofia: fix mem leak (r:1970ec1d/FS-2810) + mod_sofia: parse static route in sip uri in notify by event (r:35676e7e) + mod_sofia: add support for NDLB-force-rport=safe param that does force-rport behavior only on endpoints we know are safe to do so on. This is a dirty hack to try to work with certain endpoints behind sonicwall which does not use the same port when it does nat, when the devices do not support rport, while not breaking devices that acutally use different ports that force-rport will break (r:fc4d290c) + mod_sofia: add separate reg timeout from retry sec (r:e5b891ee) + mod_sofia: fix display of timeout (r:2043d5a) + mod_sofia: fix missing name and potential segfault in gateway status (r:40ac860a) + mod_sofia: Add missing RTP info for early SDP in bypass media (r:10119e9e/FS-2824) + mod_sofia: add manual_rtp_bugs to profile and chan var and 3 new RTP bugs SEND_LINEAR_TIMESTAMPS|START_SEQ_AT_ZERO|NEVER_SEND_MARKER (r:b278dd23) mod_spandsp: initial checkin of mod_fax/mod_voipcodecs merge into mod_spandsp (r:fa9a59a8) mod_spandsp: rework of new mod_spandsp to have functions broken up into different c files (r:65400642) mod_spandsp: improve duplicate digit detection and add 'min_dup_digit_spacing_ms' channel variable for use with the dtmf detector (r:eab4f246/FSMOD-45) commit 4f343bf892d75f00d58d3886d07c937888dfe4f5 Author: Jeff Lenk <jeff@jefflenk.com> Date: Tue Nov 16 17:34:50 2010 -0600 fix spidermonkey with x64 windows diff --git a/libs/js/nsprpub/pr/src/io/prmwait.c b/libs/js/nsprpub/pr/src/io/prmwait.c index 1a2e1cd..afdcddf 100644 --- a/libs/js/nsprpub/pr/src/io/prmwait.c +++ b/libs/js/nsprpub/pr/src/io/prmwait.c @@ -235,7 +235,7 @@ void _PR_InitMW(void) * We use NT 4's InterlockedCompareExchange() to operate * on PRMWStatus variables. */ - PR_ASSERT(sizeof(PVOID) == sizeof(PRMWStatus)); + //PR_ASSERT(sizeof(PVOID) == sizeof(PRMWStatus)); TimerInit(); #endif mw_lock = PR_NewLock(); diff --git a/libs/js/src/jscpucfg.h b/libs/js/src/jscpucfg.h index 7b8b2ad..f8b25d1 100644 --- a/libs/js/src/jscpucfg.h +++ b/libs/js/src/jscpucfg.h @@ -44,11 +44,62 @@ #if defined(XP_WIN) || defined(XP_OS2) || defined(WINCE) +#if defined(_WIN64) + +#if defined(_M_X64) || defined(_M_AMD64) || defined(_AMD64_) +#define IS_LITTLE_ENDIAN 1 +#undef IS_BIG_ENDIAN + +#define JS_BYTES_PER_BYTE 1Ll +#define JS_BYTES_PER_SHORT 2L +#define JS_BYTES_PER_INT 4L +#define JS_BYTES_PER_INT64 8L +#define JS_BYTES_PER_LONG 4L +#define JS_BYTES_PER_FLOAT 4L +#define JS_BYTES_PER_DOUBLE 8L +#define JS_BYTES_PER_WORD 8L +#define JS_BYTES_PER_DWORD 8L + +#define JS_BITS_PER_BYTE 8L +#define JS_BITS_PER_SHORT 16L +#define JS_BITS_PER_INT 32L +#define JS_BITS_PER_INT64 64L +#define JS_BITS_PER_LONG 32L +#define JS_BITS_PER_FLOAT 32L +#define JS_BITS_PER_DOUBLE 64L +#define JS_BITS_PER_WORD 64L + +#define JS_BITS_PER_BYTE_LOG2 3L +#define JS_BITS_PER_SHORT_LOG2 4L +#define JS_BITS_PER_INT_LOG2 5L +#define JS_BITS_PER_INT64_LOG2 6L +#define JS_BITS_PER_LONG_LOG2 5L +#define JS_BITS_PER_FLOAT_LOG2 5L +#define JS_BITS_PER_DOUBLE_LOG2 6L +#define JS_BITS_PER_WORD_LOG2 6L + +#define JS_ALIGN_OF_SHORT 2L +#define JS_ALIGN_OF_INT 4L +#define JS_ALIGN_OF_LONG 4L +#define JS_ALIGN_OF_INT64 8L +#define JS_ALIGN_OF_FLOAT 4L +#define JS_ALIGN_OF_DOUBLE 8L +#define JS_ALIGN_OF_POINTER 8L +#define JS_ALIGN_OF_WORD 8L + +#define JS_BYTES_PER_WORD_LOG2 3L +#define JS_BYTES_PER_DWORD_LOG2 3L +#define PR_WORDS_PER_DWORD_LOG2 0L +#else /* !(defined(_M_X64) || defined(_M_AMD64) || defined(_AMD64_)) */ +#error "CPU type is unknown" +#endif /* !(defined(_M_X64) || defined(_M_AMD64) || defined(_AMD64_)) */ + +#elif defined(_WIN32) || defined(XP_OS2) || defined(WINCE) + #ifdef __WATCOMC__ #define HAVE_VA_LIST_AS_ARRAY #endif -#if defined(_WIN32) || defined(XP_OS2) || defined(WINCE) #define IS_LITTLE_ENDIAN 1 #undef IS_BIG_ENDIAN @@ -95,6 +146,7 @@ #endif /* _WIN32 || XP_OS2 || WINCE*/ #if defined(_WINDOWS) && !defined(_WIN32) /* WIN16 */ + #define IS_LITTLE_ENDIAN 1 #undef IS_BIG_ENDIAN @@ -138,6 +190,7 @@ #define JS_BYTES_PER_WORD_LOG2 2L #define JS_BYTES_PER_DWORD_LOG2 3L #define PR_WORDS_PER_DWORD_LOG2 1L + #endif /* defined(_WINDOWS) && !defined(_WIN32) */ #elif defined(XP_UNIX) || defined(XP_BEOS) commit 9257e0f34459f6087d37843defdfadf75c72ac39 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Tue Nov 16 22:58:44 2010 +0100 ftmod_isdn: Port(/Fix) span signal handling, remove some dead/unused pieces and close the D-Channel on shutdown. This fixes a NULL-call segfault in ftdm_span_trigger_signal(). Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c index 491ef88..d54d46a 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@ -595,9 +595,10 @@ static void ftdm_isdn_call_event(struct Q931_Call *call, struct Q931_CallEvent * return; } - if (ftdmchan->state != FTDM_CHANNEL_STATE_DOWN) { + if (ftdm_channel_get_state(ftdmchan) != FTDM_CHANNEL_STATE_DOWN) { ftdm_log(FTDM_LOG_DEBUG, "Channel %d:%d not in DOWN state, cleaning up\n", - ftdmchan->span_id, ftdmchan->chan_id); + ftdm_channel_get_span_id(ftdmchan), + ftdm_channel_get_id(ftdmchan)); /* * Send hangup signal to mod_openzap @@ -607,7 +608,7 @@ static void ftdm_isdn_call_event(struct Q931_Call *call, struct Q931_CallEvent * } sig.event_id = FTDM_SIGEVENT_STOP; - isdn_data->sig_cb(&sig); + ftdm_span_send_signal(ftdm_channel_get_span(ftdmchan), &sig); /* Release zap channel */ ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); @@ -641,7 +642,9 @@ static void ftdm_isdn_call_event(struct Q931_Call *call, struct Q931_CallEvent * return; } - ftdm_log(FTDM_LOG_DEBUG, "Call setup failed on channel %d:%d\n", ftdmchan->span_id, ftdmchan->chan_id); + ftdm_log(FTDM_LOG_DEBUG, "Call setup failed on channel %d:%d\n", + ftdm_channel_get_span_id(ftdmchan), + ftdm_channel_get_id(ftdmchan)); /* * Send signal to mod_openzap @@ -649,7 +652,7 @@ static void ftdm_isdn_call_event(struct Q931_Call *call, struct Q931_CallEvent * sig.channel->caller_data.hangup_cause = FTDM_CAUSE_NETWORK_OUT_OF_ORDER; sig.event_id = FTDM_SIGEVENT_STOP; - isdn_data->sig_cb(&sig); + ftdm_span_send_signal(ftdm_channel_get_span(ftdmchan), &sig); /* Release zap channel */ ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); @@ -909,7 +912,7 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic sig.channel->caller_data.hangup_cause = (cause) ? cause->Value : FTDM_CAUSE_NORMAL_UNSPECIFIED; sig.event_id = FTDM_SIGEVENT_STOP; - status = isdn_data->sig_cb(&sig); + status = ftdm_span_send_signal(span, &sig); ftdm_log(FTDM_LOG_DEBUG, "Received %s in state %s, requested hangup for channel %d:%d\n", what, ftdm_channel_get_state_str(ftdmchan), @@ -1298,6 +1301,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) { Q931mes_Generic *gen = (Q931mes_Generic *) ftdmchan->caller_data.raw_data; ftdm_isdn_data_t *isdn_data = ftdmchan->span->signal_data; + ftdm_span_t *span = ftdm_channel_get_span(ftdmchan); ftdm_sigmsg_t sig; ftdm_status_t status; @@ -1329,7 +1333,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) { if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { sig.event_id = FTDM_SIGEVENT_PROGRESS; - if ((status = isdn_data->sig_cb(&sig) != FTDM_SUCCESS)) { + if ((status = ftdm_span_send_signal(ftdm_channel_get_span(ftdmchan), &sig) != FTDM_SUCCESS)) { ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); } } else { @@ -1377,7 +1381,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) { if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { sig.event_id = FTDM_SIGEVENT_START; - if ((status = isdn_data->sig_cb(&sig) != FTDM_SUCCESS)) { + if ((status = ftdm_span_send_signal(span, &sig) != FTDM_SUCCESS)) { ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); } } @@ -1387,7 +1391,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) { ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_UNSPECIFIED; sig.event_id = FTDM_SIGEVENT_RESTART; - status = isdn_data->sig_cb(&sig); + status = ftdm_span_send_signal(span, &sig); ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); } break; @@ -1395,7 +1399,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) { if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { sig.event_id = FTDM_SIGEVENT_PROGRESS_MEDIA; - if ((status = isdn_data->sig_cb(&sig) != FTDM_SUCCESS)) { + if ((status = ftdm_span_send_signal(span, &sig) != FTDM_SUCCESS)) { ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); } } else { @@ -1415,7 +1419,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) { if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { sig.event_id = FTDM_SIGEVENT_UP; - if ((status = isdn_data->sig_cb(&sig) != FTDM_SUCCESS)) { + if ((status = ftdm_span_send_signal(span, &sig) != FTDM_SUCCESS)) { ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); } } else { @@ -1636,7 +1640,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) ftdm_log(FTDM_LOG_DEBUG, "Terminating: Direction %s\n", ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) ? "Outbound" : "Inbound"); sig.event_id = FTDM_SIGEVENT_STOP; - status = isdn_data->sig_cb(&sig); + status = ftdm_span_send_signal(span, &sig); gen->MesType = Q931mes_RELEASE; gen->CRVFlag = ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) ? 0 : 1; @@ -1673,7 +1677,6 @@ static __inline__ void check_state(ftdm_span_t *span) static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *event) { - ftdm_isdn_data_t *isdn_data = span->signal_data; ftdm_alarm_flag_t alarmbits; ftdm_sigmsg_t sig; @@ -1697,7 +1700,7 @@ static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *e } ftdm_set_flag(event->channel, FTDM_CHANNEL_SUSPENDED); ftdm_channel_get_alarms(event->channel, &alarmbits); - isdn_data->sig_cb(&sig); + ftdm_span_send_signal(span, &sig); ftdm_log(FTDM_LOG_WARNING, "channel %d:%d (%d:%d) has alarms [%s]\n", ftdm_channel_get_span_id(event->channel), @@ -1712,7 +1715,7 @@ static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *e sig.event_id = FTDM_OOB_ALARM_CLEAR; ftdm_clear_flag(event->channel, FTDM_CHANNEL_SUSPENDED); ftdm_channel_get_alarms(event->channel, &alarmbits); - isdn_data->sig_cb(&sig); + ftdm_span_send_signal(span, &sig); } break; #ifdef __BROKEN_BY_FREETDM_CONVERSION__ @@ -2057,8 +2060,7 @@ static void *ftdm_isdn_run(ftdm_thread_t *me, void *obj) } done: -// ftdm_channel_close(&isdn_data->dchans[0]); -// ftdm_channel_close(&isdn_data->dchans[1]); + ftdm_channel_close(&isdn_data->dchan); ftdm_clear_flag(isdn_data, FTDM_ISDN_RUNNING); #ifdef WIN32 @@ -2745,8 +2747,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(isdn_configure_span) } } - isdn_data->sig_cb = sig_cb; - isdn_data->dchan = dchan; + isdn_data->dchan = dchan; isdn_data->digit_timeout = digit_timeout; Q921_InitTrunk(&isdn_data->q921, @@ -2788,6 +2789,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(isdn_configure_span) span->state_map = &isdn_state_map; span->signal_data = isdn_data; span->signal_type = FTDM_SIGTYPE_ISDN; + span->signal_cb = sig_cb; span->start = ftdm_isdn_start; span->stop = ftdm_isdn_stop; span->outgoing_call = isdn_outgoing_call; diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h index 95eee90..6b17f2c 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h @@ -63,9 +63,6 @@ struct ftdm_isdn_data { Q921Data_t q921; Q931_TrunkInfo_t q931; ftdm_channel_t *dchan; - ftdm_channel_t *dchans[2]; - struct ftdm_sigmsg sigmsg; - fio_signal_cb_t sig_cb; uint32_t flags; int32_t mode; int32_t digit_timeout; commit a9b2ced2aaa56311237c8437efde13f3d5342600 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Tue Nov 16 22:50:43 2010 +0100 ftmod_libpri: First part of the BRI PTMP channel handling changes. I really need to dig deeper here, some libpri events never fire for incoming calls and i'll have to find out how mod_freetdm or the FreeSWITCH core change states on the channel... Anyway, incoming and outgoing calls still work for me (BRI PTMP TE), so commit this now and let a wider audience do some more testing. Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> Tested-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 21d6674..669e852 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -503,15 +503,9 @@ static __inline__ void state_advance(ftdm_channel_t *chan) ftdm_status_t status; ftdm_sigmsg_t sig; - ftdm_log(FTDM_LOG_DEBUG, "%d:%d STATE [%s]\n", + ftdm_log(FTDM_LOG_DEBUG, "-- %d:%d STATE [%s]\n", ftdm_channel_get_span_id(chan), ftdm_channel_get_id(chan), ftdm_channel_get_state_str(chan)); -#if 0 - if (!ftdm_test_flag(chan, FTDM_CHANNEL_OUTBOUND) && !call) { - ftdm_log(FTDM_LOG_WARNING, "NO CALL!!!!\n"); - } -#endif - memset(&sig, 0, sizeof(sig)); sig.chan_id = ftdm_channel_get_id(chan); sig.span_id = ftdm_channel_get_span_id(chan); @@ -522,6 +516,22 @@ static __inline__ void state_advance(ftdm_channel_t *chan) { chan->call_data = NULL; ftdm_channel_done(chan); + + /* + * Close channel completely, BRI PTMP will thank us + */ + if (ftdm_test_flag(chan, FTDM_CHANNEL_OPEN)) { + ftdm_channel_t *chtmp = chan; + if (ftdm_channel_close(&chtmp) != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_WARNING, "-- Failed to close channel %d:%d\n", + ftdm_channel_get_span_id(chan), + ftdm_channel_get_id(chan)); + } else { + ftdm_log(FTDM_LOG_DEBUG, "-- Closed channel %d:%d\n", + ftdm_channel_get_span_id(chan), + ftdm_channel_get_id(chan)); + } + } } break; @@ -548,6 +558,10 @@ static __inline__ void state_advance(ftdm_channel_t *chan) ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP); } } else if (call) { + /* make sure channel is open in this state (outbound handled in on_proceeding()) */ + if (!ftdm_test_flag(chan, FTDM_CHANNEL_OPEN)) { + ftdm_channel_open_chan(chan); + } pri_proceeding(isdn_data->spri.pri, call, ftdm_channel_get_id(chan), 1); } else { ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART); @@ -557,6 +571,10 @@ static __inline__ void state_advance(ftdm_channel_t *chan) case FTDM_CHANNEL_STATE_RING: { + /* + * This needs more auditing for BRI PTMP: + * does pri_acknowledge() steal the call from other devices? + */ if (!ftdm_test_flag(chan, FTDM_CHANNEL_OUTBOUND)) { if (call) { pri_acknowledge(isdn_data->spri.pri, call, ftdm_channel_get_id(chan), 0); @@ -588,6 +606,10 @@ static __inline__ void state_advance(ftdm_channel_t *chan) ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP); } } else if (call) { + /* make sure channel is open in this state (outbound handled in on_answer()) */ + if (!ftdm_test_flag(chan, FTDM_CHANNEL_OPEN)) { + ftdm_channel_open_chan(chan); + } pri_answer(isdn_data->spri.pri, call, 0, 1); } else { ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART); @@ -795,34 +817,113 @@ static int on_answer(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_even ftdm_channel_t *chan = ftdm_span_get_channel(span, pevent->answer.channel); if (chan) { + if (!ftdm_test_flag(chan, FTDM_CHANNEL_OPEN)) { + ftdm_log(FTDM_LOG_DEBUG, "-- Call answered, opening B-Channel %d:%d\n", + ftdm_channel_get_span_id(chan), + ftdm_channel_get_id(chan)); + + if (ftdm_channel_open_chan(chan) != FTDM_SUCCESS) { + ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); + + ftdm_log(FTDM_LOG_ERROR, "-- Error opening channel %d:%d\n", + ftdm_channel_get_span_id(chan), + ftdm_channel_get_id(chan)); + + caller_data->hangup_cause = FTDM_CAUSE_DESTINATION_OUT_OF_ORDER; + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_TERMINATING); + goto out; + } + } ftdm_log(FTDM_LOG_DEBUG, "-- Answer on channel %d:%d\n", ftdm_span_get_id(span), pevent->answer.channel); ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_UP); } else { ftdm_log(FTDM_LOG_DEBUG, "-- Answer on channel %d:%d but it's not in the span?\n", ftdm_span_get_id(span), pevent->answer.channel); } +out: return 0; } /** - * \brief Handler for libpri proceed event + * \brief Handler for libpri proceeding event * \param spri Pri wrapper structure (libpri, span, dchan) * \param event_type Event type (unused) * \param pevent Event * \return 0 */ -static int on_proceed(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) +static int on_proceeding(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) { ftdm_span_t *span = spri->span; - ftdm_channel_t *chan = ftdm_span_get_channel(span, pevent->answer.channel); + ftdm_channel_t *chan = ftdm_span_get_channel(span, pevent->proceeding.channel); if (chan) { + /* Open channel if inband information is available */ + if ((pevent->proceeding.progressmask & PRI_PROG_INBAND_AVAILABLE) && !ftdm_test_flag(chan, FTDM_CHANNEL_OPEN)) { + ftdm_log(FTDM_LOG_DEBUG, "-- In-band information available, opening B-Channel %d:%d\n", + ftdm_channel_get_span_id(chan), + ftdm_channel_get_id(chan)); + + if (ftdm_channel_open_chan(chan) != FTDM_SUCCESS) { + ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); + + ftdm_log(FTDM_LOG_ERROR, "-- Error opening channel %d:%d\n", + ftdm_channel_get_span_id(chan), + ftdm_channel_get_id(chan)); + + caller_data->hangup_cause = FTDM_CAUSE_DESTINATION_OUT_OF_ORDER; + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_TERMINATING); + goto out; + } + } ftdm_log(FTDM_LOG_DEBUG, "-- Proceeding on channel %d:%d\n", ftdm_span_get_id(span), pevent->proceeding.channel); ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); } else { ftdm_log(FTDM_LOG_DEBUG, "-- Proceeding on channel %d:%d but it's not in the span?\n", ftdm_span_get_id(span), pevent->proceeding.channel); } +out: + return 0; +} + +/** + * \brief Handler for libpri progress event + * \param spri Pri wrapper structure (libpri, span, dchan) + * \param event_type Event type (unused) + * \param pevent Event + * \return 0 + * \note also uses pri_event->proceeding + */ +static int on_progress(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) +{ + ftdm_span_t *span = spri->span; + ftdm_channel_t *chan = ftdm_span_get_channel(span, pevent->proceeding.channel); + + if (chan) { + /* Open channel if inband information is available */ + if ((pevent->proceeding.progressmask & PRI_PROG_INBAND_AVAILABLE) && !ftdm_test_flag(chan, FTDM_CHANNEL_OPEN)) { + ftdm_log(FTDM_LOG_DEBUG, "-- In-band information available, opening B-Channel %d:%d\n", + ftdm_channel_get_span_id(chan), + ftdm_channel_get_id(chan)); + + if (ftdm_channel_open_chan(chan) != FTDM_SUCCESS) { + ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); + + ftdm_log(FTDM_LOG_ERROR, "-- Error opening channel %d:%d\n", + ftdm_channel_get_span_id(chan), + ftdm_channel_get_id(chan)); + + caller_data->hangup_cause = FTDM_CAUSE_DESTINATION_OUT_OF_ORDER; + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_TERMINATING); + goto out; + } + } + ftdm_log(FTDM_LOG_DEBUG, "-- Progress on channel %d:%d\n", ftdm_span_get_id(span), pevent->proceeding.channel); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); + } else { + ftdm_log(FTDM_LOG_DEBUG, "-- Progress on channel %d:%d but it's not in the span?\n", + ftdm_span_get_id(span), pevent->proceeding.channel); + } +out: return 0; } @@ -840,17 +941,37 @@ static int on_ringing(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_eve if (chan) { ftdm_log(FTDM_LOG_DEBUG, "-- Ringing on channel %d:%d\n", ftdm_span_get_id(span), pevent->ringing.channel); + /* we may get on_ringing even when we're already in FTDM_CHANNEL_STATE_PROGRESS_MEDIA */ if (ftdm_channel_get_state(chan) == FTDM_CHANNEL_STATE_PROGRESS_MEDIA) { /* dont try to move to STATE_PROGRESS to avoid annoying veto warning */ return 0; } + + /* Open channel if inband information is available */ + if ((pevent->ringing.progressmask & PRI_PROG_INBAND_AVAILABLE) && !ftdm_test_flag(chan, FTDM_CHANNEL_OPEN)) { + ftdm_log(FTDM_LOG_DEBUG, "-- In-band information available, opening B-Channel %d:%d\n", + ftdm_channel_get_span_id(chan), + ftdm_channel_get_id(chan)); + + if (ftdm_channel_open_chan(chan) != FTDM_SUCCESS) { + ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); + + ftdm_log(FTDM_LOG_ERROR, "-- Error opening channel %d:%d\n", + ftdm_channel_get_span_id(chan), + ftdm_channel_get_id(chan)); + + caller_data->hangup_cause = FTDM_CAUSE_DESTINATION_OUT_OF_ORDER; + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_TERMINATING); + goto out; + } + } ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_PROGRESS); } else { ftdm_log(FTDM_LOG_DEBUG, "-- Ringing on channel %d:%d but it's not in the span?\n", ftdm_span_get_id(span), pevent->ringing.channel); } - +out: return 0; } @@ -868,16 +989,42 @@ static int on_ring(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event ftdm_caller_data_t *caller_data = NULL; int ret = 0; - if (!chan || ftdm_channel_get_state(chan) != FTDM_CHANNEL_STATE_DOWN || ftdm_test_flag(chan, FTDM_CHANNEL_INUSE)) { - ftdm_log(FTDM_LOG_WARNING, "--Duplicate Ring on channel %d:%d (ignored)\n", ftdm_span_get_id(span), pevent->ring.channel); + if (!chan) { + ftdm_log(FTDM_LOG_ERROR, "-- Unable to get channel %d:%d\n", ftdm_span_get_id(span), pevent->ring.channel); goto done; } - if (ftdm_channel_open_chan(chan) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_WARNING, "--Failure opening channel %d:%d (ignored)\n", ftdm_span_get_id(span), pevent->ring.channel); + if (ftdm_channel_get_state(chan) != FTDM_CHANNEL_STATE_DOWN || ftdm_test_flag(chan, FTDM_CHANNEL_INUSE)) { + ftdm_log(FTDM_LOG_WARNING, "-- Duplicate Ring on channel %d:%d (ignored)\n", ftdm_span_get_id(span), pevent->ring.channel); goto done; } + if ((pevent->ring.progressmask & PRI_PROG_INBAND_AVAILABLE)) { + /* Open channel if inband information is available */ + ftdm_log(FTDM_LOG_DEBUG, "-- In-band information available, opening B-Channel %d:%d\n", + ftdm_channel_get_span_id(chan), + ftdm_channel_get_id(chan)); + + if (!ftdm_test_flag(chan, FTDM_CHANNEL_OPEN) && ftdm_channel_open_chan(chan) != FTDM_SUCCESS) { +// ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); + + ftdm_log(FTDM_LOG_WARNING, "-- Error opening channel %d:%d (ignored)\n", + ftdm_channel_get_span_id(chan), + ftdm_channel_get_id(chan)); + +// caller_data->hangup_cause = FTDM_CAUSE_DESTINATION_OUT_OF_ORDER; +// ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_TERMINATING); +// goto done; + } + } else { + /* Reserve channel, don't open it yet */ + if (ftdm_channel_use(chan) != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_WARNING, "-- Error reserving channel %d:%d (ignored)\n", + ftdm_span_get_id(span), pevent->ring.channel); + goto done; + } + } + ftdm_log(FTDM_LOG_NOTICE, "-- Ring on channel %d:%d (from %s to %s)\n", ftdm_span_get_id(span), pevent->ring.channel, pevent->ring.callingnum, pevent->ring.callednum); @@ -901,7 +1048,7 @@ static int on_ring(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event } // scary to trust this pointer, you'd think they would give you a copy of the call data so you own it...... - /* hurr, this valid as along as nobody releases the call */ + /* hurr, this is valid as along as nobody releases the call */ chan->call_data = pevent->ring.call; ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RING); @@ -1300,7 +1447,7 @@ static int on_dchan_down(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ */ static int on_anything(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) { - ftdm_log(FTDM_LOG_DEBUG, "Caught Event span %d %u (%s)\n", ftdm_span_get_id(spri->span), event_type, lpwrap_pri_event_str(event_type)); + ftdm_log(FTDM_LOG_DEBUG, "-- Caught Event span %d %u (%s)\n", ftdm_span_get_id(spri->span), event_type, lpwrap_pri_event_str(event_type)); return 0; } @@ -1313,7 +1460,7 @@ static int on_anything(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ev */ static int on_io_fail(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) { - ftdm_log(FTDM_LOG_DEBUG, "Caught Event span %d %u (%s)\n", ftdm_span_get_id(spri->span), event_type, lpwrap_pri_event_str(event_type)); + ftdm_log(FTDM_LOG_DEBUG, "-- Caught Event span %d %u (%s)\n", ftdm_span_get_id(spri->span), event_type, lpwrap_pri_event_str(event_type)); return 0; } @@ -1401,8 +1548,8 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_ANY, on_anything); LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_RING, on_ring); LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_RINGING, on_ringing); - //LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_SETUP_ACK, on_proceed); - LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_PROCEEDING, on_proceed); + LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_PROCEEDING, on_proceeding); + LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_PROGRESS, on_progress); LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_ANSWER, on_answer); LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_DCHAN_UP, on_dchan_up); LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_DCHAN_DOWN, on_dchan_down); commit 055c78e61eb4a4de76404d11c221654dda2b301d Author: Michael S Collins <msc@freeswitch.org> Date: Tue Nov 16 12:49:59 2010 -0800 Update ChangeLog through Oct 15 (more to come) diff --git a/docs/ChangeLog b/docs/ChangeLog index d6fddd6..e0f5297 100644 --- a/docs/ChangeLog +++ b/docs/ChangeLog @@ -30,6 +30,7 @@ freeswitch (1.0.7) config: Add att_xfer example to default dialplan (r:20ec962a) config: default example to resolve some issues with SCA in cases where host and ip are mixed causing the phone to be confused. (r:0279261b) config: Fix phrase files, still missing a sound file (r:6741f350/FS-2742) + config: Disallow global-intercept and group-intercept can intercept an outbound call in default dialplan (r:890871ba/FS-2777) core: Add RTCP support (FSRTP-14) core: handle some errors on missing db handle conditions core: add ... and shutdown as a fail-safe when no modules are loaded @@ -110,6 +111,13 @@ freeswitch (1.0.7) core: add bitrate patch from moc with some extra stuff for late neg mode (r:633f193d) core: refactor fmtp parser as a core func (r:56f8c11f) core: add switch_ivr_dmachine async digit parser to core (r:7f3319dc) + core: make parens optional on functions as vars ${foo(bar)} is now the same as ${foo bar} (r:fdba0e07) + core: fix default ptime for iLBC and make new configurable global map in switch.conf.xml (r:e3c427ad) + core: only pause recording media bugs in fifo (r:c1d41dd9) + core: Allow IPv6 in proxy mode (r:4e5911c2/FS-2776) + core: "Silent recovery" (r:93c2ed94) + core: fix switch_find_local_ip to properly handle force_local_ip_v4 and _v6 (r:f42c9036/FS-2778) + core: fix att_xfer/3-way scenario (r:0559cc50) lang: Improve French phrase files (FSCONFIG-23) libapr: Fix issue where after a bridge with a member, uuid of Agent is set to single quote character ' (r:3fee704d/FS-2738) libdingaling: fix race on shutdown causing crash (FSMOD-47) @@ -126,6 +134,7 @@ freeswitch (1.0.7) libesl: use uint32_t instead of long for timeout as in the rest of the lib, 0 means forever. Also added esl_send_recv_timed() (r:49d6c803) libesl: Fix SEGV when using serialize function without any arguments (r:910729b5/ESL-44) libesl: fix leak-on-error in esl_connect_timeout() (r:4263d60e) + libesl: Call close on connection handle if the connection fails (r:413dcc4c/ESL-50) libfreetdm: implemented freetdm config nodes and ss7 initial configuration libfreetdm: fix codec for CAS signaling (r:b76e7f18) libfreetdm: freetdm: ss7- added support for incoming group blocks, started adding support for ansi (r:c219a73c) @@ -142,6 +151,7 @@ freeswitch (1.0.7) libspandsp: Changes to the signaling tone detector to detect concurrent 2400Hz + 2600Hz tones. This passes voice immunity and other key tests, but it bounces a bit when transitions like 2400 -> 2400+2600 -> 2600 occur. Transitions between tone off and tone on are clean. (r:bc13e944) libspandsp: Fix Windows build after libspandsp update (r:d70cc852/FSBUILD-293) libspandsp: Fix for T.30 processing of operator interrupts, to improve compatibility with some machines, which seem to send them when no operator is around. (r:84ee0ae6) + libspandsp: spandsp t38 fax receiving error in win XP - regression from f029f7ef (r:761cec8f/FS-2766) mod_avmd: Initial check in - Advanced Voicemail Detect (r:10c6a30a) (by Eric Des Courtis) mod_avmd: Add to windows build (r:df4bd935) mod_callcenter: Initial commit of the mod_callcenter application. This module is in it early state of developpement. You can see documentation on the wiki at : <a href="http://wiki.freeswitch.org/wiki/Mod_callcenter">http://wiki.freeswitch.org/wiki/Mod_callcenter</a> For support/comments, please use <a href="http://jira.freeswitch.org/">http://jira.freeswitch.org/</a> and select the MOD CALLCENTER module. (r:ba09b96d) @@ -159,6 +169,7 @@ freeswitch (1.0.7) mod_callcenter: Added max-wait-time and max-wait-time-with-no-agent param to a queue. (r:3482f95e) mod_callcenter: Make sure we fail to load if config is not present (r:e1fb79a1) mod_callcenter: Fix invalid update of agent field (r:426a448f/FS-2738) + mod_callcenter: Allow to get queue info via api (r:70d592ae) mod_cidlookup: null xml is bad (r:095815f8) mod_cid_lookup: honor skipcitystate when using whitepages (r:a66654de/FSMOD-53) mod_commands: make break uuid_break and add cascade flag @@ -180,22 +191,28 @@ freeswitch (1.0.7) mod_conference: add conference_member_id variable to all sessions with the member id used by their conference participation (For drk__) (r:49c9bfdb) mod_conference: fix relate nohear (r:f029ce07/MODAPP-428) mod_conference: Fix floor change events not always firing (r:8f1767d3/MODAPP-424) + mod_conference: refactor conference to use switch_ivr_dmachine for the digit parsing controls are now bound to each member separately based on conference_controls channel var, then the caller-controls param in the profile or a default to "default" (r:ac19f73c) + mod_conference: Fix crash on dtmf action (r:4d5389bd/FS-2781) mod_curl: use method=post when post requested (r:c6a4ddd0/FSMOD-69) + mod_db: fix stack corruption (MODAPP-407) mod_dialplan_xml: Add in the INFO log the caller id number when processing a request (Currenly only show the caller name) (r:e1df5e13) mod_dingaling: make mod_dingaling compat with google's new free phonecalls thing (r:ba0a2a32) mod_dingaling: make dingaling work with google voice inbound too (r:4ee68141) mod_dingaling: Fix crash when testing the new gv-dingaling with around 24 concurrent calls (r:73e1ec5e/FSCORE-667) mod_dingaling: Fix NULL pointer (r:e3eff816/FS-1103) mod_directory: Add variable directory_search_order to allow to search by first name by default is set to "first_name" (r:163ca31f) - mod_db: fix stack corruption (MODAPP-407) + mod_distributor: Add mod_distributor to VS2010 - not built by default (r:bac79ba1) mod_dptools: add eavesdrop_enable_dtmf chan var (r:596c0012) mod_dptools: Make park app not send 183 session progress (r:76932995/FSCORE-567) mod_dptools: add block_dtmf and unblock_dtmf apps (r:d9eb0197) mod_dptools: refactor export code and add new bridge_export app which is like export but exports across when one channel bridges another (r:4aa9a838) + mod_dptools: add bind_digit_action application (r:9537197b) + mod_dptools: emit event when user presses DTMFs (r:37298f56) mod_erlang_event: Make XML fetch reply ACKs distinguishable, update freeswitch.erl (r:9d44ed04) mod_erlang_event: Add 3 new commands; session_event, session_noevents, session_nixevent (r:698fa045) mod_erlang_event: generate long node names the same as erlang does (r:9ad509c2) mod_erlang_event: Improve some logging to include UUIDs (r:c0d51b83) + mod_erlang_event: Support for reading erlang cookie from a file (r:094ffe37) mod_event_socket: fix up other users of switch_event_xmlize() to use SWITCH_EVENT_NONE (r:d6eb7562) mod_event_socket: Fix small mem leaks (r:e4f90584/MODEVENT-68) mod_fifo: allow multiple dtmf to exit fifo, set fifo_caller_exit_key to specify which (MODAPP-420) @@ -234,6 +251,8 @@ freeswitch (1.0.7) mod_freetdm: OPENZAP-107 - Patched by Jeff Lenk (r:aa075136/OPENZAP-107) mod_freetdm: allocate channels in their own memory page when debugging (r:fcd8df0a) mod_freetdm: lock the channel when placing call (r:705dd237) + mod_freetdm: created cmake files for freetdm (r:fc55997b) + mod_freetdm: ss7 - added support to control mtp2, mtp3, and isup timers via freetdm.conf.xml (r:4455d581) mod_gsmopen: copy from branch mod_hash: free all hashtables on shutdown (r:e76d7d92) mod_hash: remove unneeded initializer (r:10d468a6) @@ -291,6 +310,8 @@ freeswitch (1.0.7) mod_sangoma_codec: added load/noload options for the supported codecs mod_sangoma_codec: rename load/noload to register/noregister mod_sangoma_codec: silence suppression (r:73d9d56f) + mod_sangoma_codec: do not return 0 len frames and return silence instead when there is no transcoding output update stats only when we really receive a frame (r:dc4d19e9) + mod_sangoma_codec: flush sockets on first use (r:bbba1148) mod_say_es: fix grammar when saying dates and time (r:6bed19b2/MODAPP-429) mod_say_ja: initial commit, still needs sound files (r:b2423158/FS-2755) mod_say_ru: Fix saying time with +1 hour of current time (r:68d74c31/MODAPP-444) @@ -391,6 +412,11 @@ freeswitch (1.0.7) mod_sofia: fix parsing of sofia tracelevel param, moved param from profile params to global_settings as its global, and it only worked on reparse before anyways. Please correct any documentation on this issue on the wiki (r:82c4c4cc/FS-523) mod_sofia: fix nat acl count check to check against the number of nat acls (r:e11550e7/FS-502) mod_sofia: add sofia_glue_find_parameter_value function to get a specific value from a url params string (r:c701d41c) + mod_sofia: Sofia SIP Stack Lockup (r:8f13eb89/FS-2762) + mod_sofia: ix memory leak caused by regression from FS-2747 (r:6c4cb07b/FS-2747) + mod_sofia: Set SDP proper connection type of "c=" field to IP6 or IP4 when IPv6 called IPv4 (r:14361c09/FS-620) + mod_sofia: FS wrongly assumes NAT on Cisco 7941G (r:42f534fa/FS-2773) + mod_sofia: sofia_reg.c doesn't pass profile name into query, also, typo with all-reg-options-ping (r:6772c795/FS-2787) mod_spandsp: initial checkin of mod_fax/mod_voipcodecs merge into mod_spandsp (r:fa9a59a8) mod_spandsp: rework of new mod_spandsp to have functions broken up into different c files (r:65400642) mod_spandsp: improve duplicate digit detection and add 'min_dup_digit_spacing_ms' channel variable for use with the dtmf detector (r:eab4f246/FSMOD-45) @@ -420,6 +446,7 @@ freeswitch (1.0.7) mod_voicemail: fix vm_inject to a group and change syntax for sending to a whole domain to domain= for clarity sake (r:f30a1cc6) mod_voicemail: add quotes to vm_cc command generated internally to escape spaces in the caller id name (r:5f012813) mod_voicemail: Play caller id of callee prior to playing a vmail (r:e7b97907/FS-2719) + mod_voicemail: FS-1776 Add support for per user operator exten override param vm-operator-extension (r:df5b3498/FS-1776) mod_xml_cdr: add force_process_cdr var to process b leg cdr on a case by case basis when b leg cdr is disabled (XML-17) mod_xml_cdr: add leg param to query string (XML-24) mod_xml_cdr: fix locked sessions (XML-26) @@ -428,6 +455,7 @@ freeswitch (1.0.7) scripts: added honeypot.pl and blacklist.pl which add extra SIP security options (r:b6a81ba7) sofia-sip: fix null derefernce segfault in soa (r:f356c5e6) sofia-sip: extend timeout for session expires on short timeouts to be 90% of timeout instead of 1/3 to handle devices that do not refresh in time such as polycom (r:a7f48928/SFSIP-212) + tools: Add fs_encode tool (r:89b17601) freeswitch (1.0.6) commit c5070aaf52bb37ec63731e82be04f8e78057df21 Author: David Yat Sin <dyatsin@sangoma.com> Date: Tue Nov 16 14:56:19 2010 -0500 Fixed cyginstall.sh script diff --git a/libs/freetdm/cyginstall.sh b/libs/freetdm/cyginstall.sh index 311df93..e2d5885 100644 --- a/libs/freetdm/cyginstall.sh +++ b/libs/freetdm/cyginstall.sh @@ -5,7 +5,8 @@ fsdir=../.. set -x cp Debug/mod/*.dll $fsdir/Debug/mod/ cp mod_freetdm/Debug/*.pdb $fsdir/Debug/mod/ -cp Debug/*.dll $fsdir/Debug/mod/ +cp Debug/freetdm.dll $fsdir/Debug/ +cp Debug/ftmod_*.dll $fsdir/Debug/mod/ cp Debug/*.pdb $fsdir/Debug/mod/ #cp Debug/testsangomaboost.exe $fsdir/Debug/ echo "FRIENDLY REMINDER: RECOMPILE ftmod_wanpipe WHENEVER YOU INSTALL NEW DRIVERS" commit 65be57d212e601de396d57821bb499a4d802a1c7 Author: David Yat Sin <dyatsin@sangoma.com> Date: Tue Nov 16 12:41:56 2010 -0500 Fixed for windows compilation issues diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 8842ef5..b084837 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -642,10 +642,11 @@ void sngisdn_snd_data(ftdm_channel_t *dchan, uint8_t *data, ftdm_size_t len) void sngisdn_snd_event(ftdm_channel_t *dchan, ftdm_oob_event_t event) { sng_l1_event_t l1_event; + sngisdn_span_data_t *signal_data = NULL; memset(&l1_event, 0, sizeof(l1_event)); - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) dchan->span->signal_data; + signal_data = (sngisdn_span_data_t*) dchan->span->signal_data; switch(event) { case FTDM_OOB_ALARM_CLEAR: l1_event.type = SNG_L1EVENT_ALARM_OFF; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c index e3898b9..02e0bdf 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c @@ -871,9 +871,10 @@ int16_t sngisdn_rcv_l1_data_req(uint16_t spId, sng_l1_frame_t *l1_frame) { ftdm_status_t status; ftdm_wait_flag_t flags = FTDM_WRITE; - sngisdn_span_data_t *signal_data = g_sngisdn_data.spans[spId]; - ftdm_assert(signal_data, "Received Data request on unconfigured span\n"); + sngisdn_span_data_t *signal_data = g_sngisdn_data.spans[spId]; ftdm_size_t length = l1_frame->len; + + ftdm_assert(signal_data, "Received Data request on unconfigured span\n"); do { flags = FTDM_WRITE; commit 0b377051af622ac8974e990f9244e9f69bee90ce Author: Mathieu Rene <mrene@avgs.ca> Date: Tue Nov 16 10:52:16 2010 -0500 gdbinit: ignore SIGTTIN and SIGPIPE diff --git a/support-d/.gdbinit b/support-d/.gdbinit old mode 100644 new mode 100755 index 942b761..e32687c --- a/support-d/.gdbinit +++ b/support-d/.gdbinit @@ -1,3 +1,6 @@ +handle SIGPIPE pass noprint nostop +handle SIGTTIN pass noprint nostop + # FreeSWITCH Custom GDB commands define list_sessions dont-repeat commit 525f399812e389ec40556f8b4a9d1c9e5fe5d2a8 Author: Konrad Hammel <konrad@sangoma.com> Date: Tue Nov 16 11:07:41 2010 -0500 freetdm: ss7 - updated ftmod_sangoma_ss7 to support changes to FreeTDM api diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c index 38d3723..34cca80 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c @@ -1482,7 +1482,7 @@ static ftdm_status_t handle_tx_grs(ftdm_stream_handle_t *stream, int span, int c sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; ftdmchan = sngss7_info->ftdmchan; - sngss7_span = ftdmchan->span->mod_data; + sngss7_span = ftdmchan->span->signal_data; if ((ftdmchan->physical_span_id == span) && ((ftdmchan->physical_chan_id >= chan) && (ftdmchan->physical_chan_id < (chan+range)))) { @@ -1529,7 +1529,7 @@ static ftdm_status_t handle_tx_grs(ftdm_stream_handle_t *stream, int span, int c sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; ftdmchan = sngss7_info->ftdmchan; - sngss7_span = ftdmchan->span->mod_data; + sngss7_span = ftdmchan->span->signal_data; if ((ftdmchan->physical_span_id == span) && ((ftdmchan->physical_chan_id >= chan) && (ftdmchan->physical_chan_id < (chan+range)))) { @@ -1572,7 +1572,7 @@ static ftdm_status_t handle_tx_cgb(ftdm_stream_handle_t *stream, int span, int c /* extract the channel and span info for this circuit */ sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; ftdmchan = sngss7_info->ftdmchan; - sngss7_span = ftdmchan->span->mod_data; + sngss7_span = ftdmchan->span->signal_data; /* check if this circuit is part of the block */ if ((ftdmchan->physical_span_id == span) && @@ -1628,7 +1628,7 @@ static ftdm_status_t handle_tx_cgb(ftdm_stream_handle_t *stream, int span, int c sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; ftdmchan = sngss7_info->ftdmchan; - sngss7_span = ftdmchan->span->mod_data; + sngss7_span = ftdmchan->span->signal_data; if ((ftdmchan->physical_span_id == span) && ((ftdmchan->physical_chan_id >= chan) && (ftdmchan->physical_chan_id < (chan+range)))) { @@ -1672,7 +1672,7 @@ static ftdm_status_t handle_tx_cgu(ftdm_stream_handle_t *stream, int span, int c /* extract the channel and span info for this circuit */ sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; ftdmchan = sngss7_info->ftdmchan; - sngss7_span = ftdmchan->span->mod_data; + sngss7_span = ftdmchan->span->signal_data; /* check if this circuit is part of the block */ if ((ftdmchan->physical_span_id == span) && @@ -1728,7 +1728,7 @@ static ftdm_status_t handle_tx_cgu(ftdm_stream_handle_t *stream, int span, int c sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; ftdmchan = sngss7_info->ftdmchan; - sngss7_span = ftdmchan->span->mod_data; + sngss7_span = ftdmchan->span->signal_data; if ((ftdmchan->physical_span_id == span) && ((ftdmchan->physical_chan_id >= chan) && (ftdmchan->physical_chan_id < (chan+range)))) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index af3b9ed..72e4bac 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -1722,7 +1722,7 @@ ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ } /* fill in the span structure for this circuit */ - sngss7_span = ftdmchan->span->mod_data; + sngss7_span = ftdmchan->span->signal_data; sngss7_span->rx_grs.circuit = circuit; sngss7_span->rx_grs.range = range; @@ -1758,7 +1758,7 @@ ftdm_status_t handle_grs_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ } /* fill in the span structure for this circuit */ - sngss7_span = ftdmchan->span->mod_data; + sngss7_span = ftdmchan->span->signal_data; sngss7_span->rx_gra.circuit = circuit; sngss7_span->rx_gra.range = range; @@ -1866,7 +1866,7 @@ ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit } /* check if we just sent a GRS request...*/ - sngss7_span = ftdmchan->span->mod_data; + sngss7_span = ftdmchan->span->signal_data; if (sngss7_span->tx_grs.circuit > 0) { /* we need to put all circuits on this UCIC */ sngss7_span->ucic.circuit = sngss7_span->tx_grs.circuit; @@ -1917,7 +1917,7 @@ ftdm_status_t handle_cgb_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ } /* grab the span info */ - sngss7_span = ftdmchan->span->mod_data; + sngss7_span = ftdmchan->span->signal_data; /* figure out what type of block needs to be applied */ if ((siStaEvnt->cgsmti.eh.pres == PRSNT_NODEF) && (siStaEvnt->cgsmti.typeInd.pres == PRSNT_NODEF)) { @@ -2058,7 +2058,7 @@ ftdm_status_t handle_cgu_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ } /* grab the span info */ - sngss7_span = ftdmchan->span->mod_data; + sngss7_span = ftdmchan->span->signal_data; /* figure out what type of block needs to be applied */ if ((siStaEvnt->cgsmti.eh.pres == PRSNT_NODEF) && (siStaEvnt->cgsmti.typeInd.pres == PRSNT_NODEF)) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c index 06fae0c..72bd1c3 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c @@ -90,7 +90,7 @@ void sngss7_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCo memcpy(&sngss7_event->event.siConEvnt, siConEvnt, sizeof(*siConEvnt)); /* enqueue this event */ - ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event); SS7_FUNC_TRACE_EXIT(__FUNCTION__); } @@ -128,7 +128,7 @@ void sngss7_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCo memcpy(&sngss7_event->event.siConEvnt, siConEvnt, sizeof(*siConEvnt)); /* enqueue this event */ - ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event); SS7_FUNC_TRACE_EXIT(__FUNCTION__); } @@ -167,7 +167,7 @@ void sngss7_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCn memcpy(&sngss7_event->event.siCnStEvnt, siCnStEvnt, sizeof(*siCnStEvnt)); /* enqueue this event */ - ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event); SS7_FUNC_TRACE_EXIT(__FUNCTION__); } @@ -205,7 +205,7 @@ void sngss7_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRe memcpy(&sngss7_event->event.siRelEvnt, siRelEvnt, sizeof(*siRelEvnt)); /* enqueue this event */ - ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event); SS7_FUNC_TRACE_EXIT(__FUNCTION__); } @@ -243,7 +243,7 @@ void sngss7_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRe memcpy(&sngss7_event->event.siRelEvnt, siRelEvnt, sizeof(*siRelEvnt)); /* enqueue this event */ - ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event); SS7_FUNC_TRACE_EXIT(__FUNCTION__); } @@ -281,7 +281,7 @@ void sngss7_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiIn memcpy(&sngss7_event->event.siInfoEvnt, siInfoEvnt, sizeof(*siInfoEvnt)); /* enqueue this event */ - ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event); SS7_FUNC_TRACE_EXIT(__FUNCTION__); } @@ -320,7 +320,7 @@ void sngss7_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint memcpy(&sngss7_event->event.siFacEvnt, siFacEvnt, sizeof(*siFacEvnt)); /* enqueue this event */ - ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event); SS7_FUNC_TRACE_EXIT(__FUNCTION__); } @@ -359,7 +359,7 @@ void sngss7_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint memcpy(&sngss7_event->event.siFacEvnt, siFacEvnt, sizeof(*siFacEvnt)); /* enqueue this event */ - ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event); SS7_FUNC_TRACE_EXIT(__FUNCTION__); } @@ -396,7 +396,7 @@ void sngss7_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit) sngss7_event->event_id = SNGSS7_UMSG_IND_EVENT; /* enqueue this event */ - ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event); SS7_FUNC_TRACE_EXIT(__FUNCTION__); @@ -438,7 +438,7 @@ void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint } /* enqueue this event */ - ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event); SS7_FUNC_TRACE_EXIT(__FUNCTION__); } @@ -478,7 +478,7 @@ void sngss7_susp_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiS } /* enqueue this event */ - ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event); SS7_FUNC_TRACE_EXIT(__FUNCTION__); @@ -519,7 +519,7 @@ void sngss7_resm_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiR } /* enqueue this event */ - ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event); SS7_FUNC_TRACE_EXIT(__FUNCTION__); @@ -560,7 +560,7 @@ void sngss7_ssp_sta_cfm(uint32_t infId) } /* enqueue this event */ - ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->signal_data)->event_queue, sngss7_event); #endif SS7_FUNC_TRACE_EXIT(__FUNCTION__); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index 7612f3d..304e9d6 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -275,7 +275,7 @@ static void *ftdm_sangoma_ss7_run(ftdm_thread_t * me, void *obj) ftdm_span_t *ftdmspan = (ftdm_span_t *) obj; ftdm_channel_t *ftdmchan = NULL; sngss7_event_data_t *sngss7_event = NULL; - sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->mod_data; + sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->signal_data; ftdm_log (FTDM_LOG_INFO, "ftmod_sangoma_ss7 monitor thread for span=%u started.\n", ftdmspan->span_id); @@ -788,7 +788,7 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /* check if this is the base circuit and send out the GRA * we insure that this is the last circuit to have the state change queued */ - sngss7_span_data_t *span = ftdmchan->span->mod_data; + sngss7_span_data_t *span = ftdmchan->span->signal_data; if (span->rx_grs.circuit == sngss7_info->circuit->id) { /* send out the GRA */ ft_to_sngss7_gra(ftdmchan); @@ -1350,7 +1350,7 @@ static ftdm_status_t ftdm_sangoma_ss7_start(ftdm_span_t * span) ftdmchan = span->channels[x]; if (ftdmchan->call_data == NULL) continue; sngss7_info = ftdmchan->call_data; - sngss7_span = ftdmchan->span->mod_data; + sngss7_span = ftdmchan->span->signal_data; sngss7_intf = &g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId]; @@ -1474,7 +1474,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_ss7_span_config) span->get_channel_sig_status = ftdm_sangoma_ss7_get_sig_status; span->set_channel_sig_status = ftdm_sangoma_ss7_set_sig_status; span->state_map = &sangoma_ss7_state_map; - span->mod_data = ss7_span_info; + span->signal_data = ss7_span_info; /* set the flag to indicate that this span uses channel state change queues */ ftdm_set_flag (span, FTDM_SPAN_USE_CHAN_QUEUE); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index 970d006..008265b 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -619,7 +619,7 @@ void ft_to_sngss7_gra (ftdm_channel_t * ftdmchan) { SS7_FUNC_TRACE_ENTER (__FUNCTION__); - sngss7_span_data_t *sngss7_span = ftdmchan->span->mod_data; + sngss7_span_data_t *sngss7_span = ftdmchan->span->signal_data; sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; SiStaEvnt gra; @@ -663,7 +663,7 @@ void ft_to_sngss7_grs (ftdm_channel_t * ftdmchan) { SS7_FUNC_TRACE_ENTER (__FUNCTION__); - sngss7_span_data_t *sngss7_span = ftdmchan->span->mod_data; + sngss7_span_data_t *sngss7_span = ftdmchan->span->signal_data; sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; SiStaEvnt grs; @@ -696,7 +696,7 @@ void ft_to_sngss7_cgba(ftdm_channel_t * ftdmchan) { SS7_FUNC_TRACE_ENTER (__FUNCTION__); - sngss7_span_data_t *sngss7_span = ftdmchan->span->mod_data; + sngss7_span_data_t *sngss7_span = ftdmchan->span->signal_data; sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; int x = 0; @@ -745,7 +745,7 @@ void ft_to_sngss7_cgua(ftdm_channel_t * ftdmchan) { SS7_FUNC_TRACE_ENTER (__FUNCTION__); - sngss7_span_data_t *sngss7_span = ftdmchan->span->mod_data; + sngss7_span_data_t *sngss7_span = ftdmchan->span->signal_data; sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; int x = 0; @@ -794,7 +794,7 @@ void ft_to_sngss7_cgb(ftdm_channel_t * ftdmchan) { SS7_FUNC_TRACE_ENTER (__FUNCTION__); - sngss7_span_data_t *sngss7_span = ftdmchan->span->mod_data; + sngss7_span_data_t *sngss7_span = ftdmchan->span->signal_data; sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; SiStaEvnt cgb; int x = 0; @@ -844,7 +844,7 @@ void ft_to_sngss7_cgu(ftdm_channel_t * ftdmchan) { SS7_FUNC_TRACE_ENTER (__FUNCTION__); - sngss7_span_data_t *sngss7_span = ftdmchan->span->mod_data; + sngss7_span_data_t *sngss7_span = ftdmchan->span->signal_data; sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; SiStaEvnt cgu; int x = 0; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 4d497b5..23617c9 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -513,7 +513,7 @@ ftdm_status_t check_if_rx_grs_started(ftdm_span_t *ftdmspan) { ftdm_channel_t *ftdmchan = NULL; sngss7_chan_data_t *sngss7_info = NULL; - sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->mod_data; + sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->signal_data; int i; for ( i = sngss7_span->rx_grs.circuit; i < (sngss7_span->rx_grs.circuit + sngss7_span->rx_grs.range + 1); i++) { @@ -575,7 +575,7 @@ ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan) { ftdm_channel_t *ftdmchan = NULL; sngss7_chan_data_t *sngss7_info = NULL; - sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->mod_data; + sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->signal_data; int i; int byte = 0; int bit = 0; @@ -667,7 +667,7 @@ ftdm_status_t check_if_rx_gra_started(ftdm_span_t *ftdmspan) { ftdm_channel_t *ftdmchan = NULL; sngss7_chan_data_t *sngss7_info = NULL; - sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->mod_data; + sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->signal_data; int i; for (i = sngss7_span->rx_gra.circuit; i < (sngss7_span->rx_gra.circuit + sngss7_span->rx_gra.range + 1); i++) { @@ -817,7 +817,7 @@ ftdm_status_t process_span_ucic(ftdm_span_t *ftdmspan) { ftdm_channel_t *ftdmchan = NULL; sngss7_chan_data_t *sngss7_info = NULL; - sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->mod_data; + sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->signal_data; int i; for (i = sngss7_span->ucic.circuit; i < (sngss7_span->ucic.circuit + sngss7_span->ucic.range + 1); i++) { @@ -869,7 +869,7 @@ ftdm_status_t clear_rx_grs_flags(sngss7_chan_data_t *sngss7_info) ftdm_status_t clear_rx_grs_data(sngss7_chan_data_t *sngss7_info) { ftdm_channel_t *ftdmchan = sngss7_info->ftdmchan; - sngss7_span_data_t *sngss7_span = ftdmchan->span->mod_data; + sngss7_span_data_t *sngss7_span = ftdmchan->span->signal_data; /* clear the rx_grs data fields */ memset(&sngss7_span->rx_grs, 0x0, sizeof(sngss7_group_data_t)); @@ -881,7 +881,7 @@ ftdm_status_t clear_rx_grs_data(sngss7_chan_data_t *sngss7_info) ftdm_status_t clear_rx_gra_data(sngss7_chan_data_t *sngss7_info) { ftdm_channel_t *ftdmchan = sngss7_info->ftdmchan; - sngss7_span_data_t *sngss7_span = ftdmchan->span->mod_data; + sngss7_span_data_t *sngss7_span = ftdmchan->span->signal_data; /* clear the rx_grs data fields */ memset(&sngss7_span->rx_gra, 0x0, sizeof(sngss7_group_data_t)); @@ -904,7 +904,7 @@ ftdm_status_t clear_tx_grs_flags(sngss7_chan_data_t *sngss7_info) ftdm_status_t clear_tx_grs_data(sngss7_chan_data_t *sngss7_info) { ftdm_channel_t *ftdmchan = sngss7_info->ftdmchan; - sngss7_span_data_t *sngss7_span = ftdmchan->span->mod_data; + sngss7_span_data_t *sngss7_span = ftdmchan->span->signal_data; /* clear the rx_grs data fields */ memset(&sngss7_span->tx_grs, 0x0, sizeof(sngss7_group_data_t)); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c index 74d37b5..4a9c863 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c @@ -2121,7 +2121,7 @@ static int ftmod_ss7_fill_in_circuits(sng_isupCkt_t *isupCkt) ftdmchan->call_data = ss7_info; /* prepare the timer structures */ - ss7_info->t35.sched = ((sngss7_span_data_t *)isupCkt->span->mod_data)->sched; + ss7_info->t35.sched = ((sngss7_span_data_t *)isupCkt->span->signal_data)->sched; ss7_info->t35.counter = 1; ss7_info->t35.beat = g_ftdm_sngss7_data.cfg.isupIntf[isupCkt->isupInf].t35*100; /* beat is in ms, t35 is in 100ms */ ss7_info->t35.callback = handle_isup_t35; commit 68f18efe37248bd6797b055b31711ae1c7f2e782 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Nov 15 13:51:27 2010 -0600 add intercept_unanswered_only var akin to intercept_unbridged_only diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 2549554..b6363ff 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -1546,6 +1546,13 @@ SWITCH_DECLARE(void) switch_ivr_intercept_session(switch_core_session_t *session } } + if ((var = switch_channel_get_variable(channel, "intercept_unanswered_only")) && switch_true(var)) { + if ((switch_channel_test_flag(rchannel, CF_ANSWERED))) { + switch_core_session_rwunlock(rsession); + return; + } + } + switch_channel_pre_answer(channel); if (!zstr(buuid)) { commit 3acc5fdb642832bf2b91c06fadcd221660f6e6ae Author: Moises Silva <moy@sangoma.com> Date: Fri Nov 12 12:39:32 2010 -0500 mod_sangoma_codec: add SIREN7 24kbps diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index 9f4c12b..97d9f6d 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -40,7 +40,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load); SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sangoma_codec_shutdown); SWITCH_MODULE_DEFINITION(mod_sangoma_codec, mod_sangoma_codec_load, mod_sangoma_codec_shutdown, NULL); -#define IANA_LINEAR 10 #define SANGOMA_SESS_HASH_KEY_FORMAT "sngtc%lu" /* it seemed we need higher PTIME than the calling parties, so we assume nobody will use higher ptime than 40 */ @@ -83,15 +82,13 @@ typedef struct vocallo_codec_s { int autoinit; /* initialize on start loop or manually */ } vocallo_codec_t; -#define ILBC_133_PAYLOAD 97 -#define ILBC_152_PAYLOAD 98 vocallo_codec_t g_codec_map[] = { /* auto-init codecs */ { SNGTC_CODEC_PCMU, IANA_PCMU_A_8000_1, "PCMU", "Sangoma PCMU", 40, 64000, 10000, 80, 160, 80, 8000, 8000, 1 }, { SNGTC_CODEC_PCMA, IANA_PCMA_A_8000_1, "PCMA", "Sangoma PCMA", 40, 64000, 10000, 80, 160, 80, 8000, 8000, 1 }, - { SNGTC_CODEC_L16_1, IANA_L16_A_44100_1, "L16", "Sangoma L16", 40, 120000, 10000, 80, 160, 160, 8000, 8000, 0 }, - { SNGTC_CODEC_L16_2, IANA_L16_A_44100_1, "L16", "Sangoma L16 2", 40, 320000, 10000, 160, 320, 320, 16000, 16000, 0 }, + { SNGTC_CODEC_L16_1, IANA_L16_A_8000_1, "L16", "Sangoma L16", 40, 120000, 10000, 80, 160, 160, 8000, 8000, 0 }, + { SNGTC_CODEC_L16_2, IANA_L16_A_16000_1, "L16", "Sangoma L16 2", 40, 320000, 10000, 160, 320, 320, 16000, 16000, 0 }, { SNGTC_CODEC_G729AB, IANA_G729_AB_8000_1, "G729", "Sangoma G729", 40, 8000, 10000, 80, 160, 10, 8000, 8000, 1 }, { SNGTC_CODEC_G726_32, IANA_G726_32_8000_1, "G726-32", "Sangoma G.726 32k", 40, 32000, 10000, 80, 160, 40, 8000, 8000, 1 }, { SNGTC_CODEC_G722, IANA_G722_A_8000_1, "G722", "Sangoma G722", 20, 64000, 10000, 80, 160, 80, 8000, 8000, 1 }, @@ -100,9 +97,10 @@ vocallo_codec_t g_codec_map[] = { SNGTC_CODEC_GSM_FR, IANA_GSM_A_8000_1, "GSM", "Sangoma GSM", 20, 13200, 20000, 160, 320, 33, 8000, 8000, 0 }, { SNGTC_CODEC_G723_1_63, IANA_G723_A_8000_1, "G723", "Sangoma G723", 90, 6300, 30000, 240, 480, 24, 8000, 8000, 0 }, { SNGTC_CODEC_AMR_1220, IANA_AMR_WB_16000_1, "AMR", "Sangoma AMR", 20, 12200, 20000, 160, 320, 0, 8000, 8000, 0 }, + { SNGTC_CODEC_SIREN7_24, IANA_SIREN7, "G7221", "Sangoma G722.1", 20, 24000, 20000, 320, 640, 60, 16000, 16000, 0 }, { SNGTC_CODEC_SIREN7_32, IANA_SIREN7, "G7221", "Sangoma G722.1", 20, 32000, 20000, 320, 640, 80, 16000, 16000, 0 }, - { SNGTC_CODEC_ILBC_133, IANA_ILBC_133_8000_1, "iLBC", "Sangoma iLBC", -1, -1, -1, -1, -1, -1, -1, -1, 0 }, - { SNGTC_CODEC_ILBC_152, IANA_ILBC_152_8000_1, "iLBC", "Sangoma iLBC", -1, -1, -1, -1, -1, -1, -1, -1, 0 }, + { SNGTC_CODEC_ILBC_133, IANA_ILBC_133_8000_1, "iLBC", "Sangoma iLBC", 30, 13300, 30000, 240, 480, 50, 8000, 8000, 0 }, + { SNGTC_CODEC_ILBC_152, IANA_ILBC_152_8000_1, "iLBC", "Sangoma iLBC", 20, 15200, 20000, 160, 320, 38, 8000, 8000, 0 }, { -1, -1, NULL, NULL, -1, -1, -1, -1, -1, -1, -1, -1, 0 }, }; @@ -182,11 +180,14 @@ static int codec_id_to_iana(int codec_id) return -1; } -static vocallo_codec_t *get_codec_from_iana(int iana) +static vocallo_codec_t *get_codec_from_iana(int iana, int bitrate) { int i; for (i = 0; g_codec_map[i].codec_id != -1; i++) { - if (iana == g_codec_map[i].iana) { + if (iana == g_codec_map[i].iana && !bitrate) { + return &g_codec_map[i]; + } + if (iana == g_codec_map[i].iana && bitrate == g_codec_map[i].bps) { return &g_codec_map[i]; } } @@ -320,7 +321,7 @@ static switch_status_t switch_sangoma_init(switch_codec_t *codec, switch_codec_f sess->pool = codec->memory_pool; sess->impl = codec->implementation; - vcodec = get_codec_from_iana(codec->implementation->ianacode); + vcodec = get_codec_from_iana(codec->implementation->ianacode, codec->implementation->bits_per_second); switch_mutex_lock(g_sessions_lock); @@ -442,6 +443,7 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec switch_time_t func_start_time = 0, func_end_time = 0; int i = 0; int res = 0; + int linear_payload = codec->implementation->actual_samples_per_second == 8000 ? IANA_L16_A_8000_1 : IANA_L16_A_16000_1; struct sangoma_transcoding_session *sess = codec->private_info; if (sess->encoder.debug_timing) { @@ -480,7 +482,7 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec linear_frame.source = __FUNCTION__; linear_frame.data = decoded_byteswapped_data; linear_frame.datalen = decoded_data_len; - linear_frame.payload = IANA_LINEAR; + linear_frame.payload = linear_payload; /* copy and byte-swap */ for (i = 0; i < decoded_data_len/2; i++) { @@ -538,9 +540,9 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec if (sess->encoder.request.b.codec_id == SNGTC_CODEC_ILBC_152 || sess->encoder.request.b.codec_id == SNGTC_CODEC_ILBC_133) { /* since we moved to SOAP based communications, the mapping between vocallo IANA and our IANA does not work, * some codecs checks cannot be completely done, like iLBC */ - if (encoded_frame.payload != ILBC_152_PAYLOAD && encoded_frame.payload != ILBC_133_PAYLOAD) { + if (encoded_frame.payload != IANA_ILBC_152_8000_1 && encoded_frame.payload != IANA_ILBC_133_8000_1) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read unexpected payload %d in Sangoma encoder RTP session, expecting either %d or %d\n", - encoded_frame.payload, ILBC_152_PAYLOAD, ILBC_133_PAYLOAD); + encoded_frame.payload, IANA_ILBC_152_8000_1, IANA_ILBC_133_8000_1); break; } } else { @@ -640,6 +642,7 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses uint16_t *rtp_data_linear; int res = 0; int i = 0; + int linear_payload = codec->implementation->actual_samples_per_second == 8000 ? IANA_L16_A_8000_1 : IANA_L16_A_16000_1; struct sangoma_transcoding_session *sess = codec->private_info; if (sess->decoder.debug_timing) { @@ -729,9 +732,9 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses continue; } - if (linear_frame.payload != IANA_LINEAR) { + if (linear_frame.payload != linear_payload) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read unexpected payload %d in Sangoma decoder RTP session, expecting %d\n", - linear_frame.payload, IANA_LINEAR); + linear_frame.payload, linear_payload); break; } @@ -1163,7 +1166,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) switch_api_interface_t *api_interface = NULL; int i = 0, c = 0; int ilbc_done = 0; + int siren_done = 0; vocallo_codec_t *ilbc_codec = NULL; + vocallo_codec_t *siren_codec = NULL; int detected = 0, activated = 0; /* make sure we have valid configuration */ @@ -1221,17 +1226,18 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) continue; } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Registering implementations for codec %s\n", g_codec_map[c].iana_name); - - /* let know the library which iana to use */ - sngtc_set_iana_code_based_on_codec_id(g_codec_map[c].codec_id, g_codec_map[c].iana); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Mapped codec %d to IANA %d\n", g_codec_map[c].codec_id, g_codec_map[c].iana); - /* special check for iLBC to add a single codec interface for both ILBC bitrate versions */ if ((g_codec_map[c].codec_id == SNGTC_CODEC_ILBC_152 || g_codec_map[c].codec_id == SNGTC_CODEC_ILBC_133) && ilbc_done) { continue; } + /* special check for siren to add a single codec interface for all siren bitrate versions */ + if ((g_codec_map[c].codec_id == SNGTC_CODEC_SIREN7_24 || g_codec_map[c].codec_id == SNGTC_CODEC_SIREN7_32) && siren_done) { + continue; + } + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Registering implementations for codec %s\n", g_codec_map[c].iana_name); + /* SWITCH_ADD_CODEC allocates a codec interface structure from the pool the core gave us and adds it to the internal interface * list the core keeps, gets a codec id and set the given codec name to it. * At this point there is an empty shell codec interface registered, but not yet implementations */ @@ -1382,25 +1388,49 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) switch_sangoma_destroy); /* deinitalize a codec handle using this implementation */ break; + case SNGTC_CODEC_SIREN7_24: case SNGTC_CODEC_SIREN7_32: + + siren_codec = get_codec_from_id(SNGTC_CODEC_SIREN7_24); switch_core_codec_add_implementation(pool, codec_interface, /* the codec interface we allocated and we want to register with the core */ SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - g_codec_map[c].iana, /* the IANA code number, ie http://www.iana.org/assignments/rtp-parameters */ - g_codec_map[c].iana_name, /* the IANA code name */ + siren_codec->iana, /* the IANA code number, ie http://www.iana.org/assignments/rtp-parameters */ + siren_codec->iana_name, /* the IANA code name */ + "bitrate=24000", /* default fmtp to send (can be overridden by the init function), fmtp is used in SDP for format specific parameters */ + siren_codec->sampling_rate, /* samples transferred per second */ + siren_codec->actual_sampling_rate, /* actual samples transferred per second */ + siren_codec->bps, /* bits transferred per second */ + siren_codec->mpf, /* microseconds per frame */ + siren_codec->spf, /* samples per frame */ + siren_codec->bpfd, /* number of bytes per frame decompressed */ + siren_codec->bpfc, /* number of bytes per frame compressed */ + 1, /* number of channels represented */ + siren_codec->spf, /* number of frames per network packet (I dont think this is used at all) */ + switch_sangoma_init_siren7, /* function to initialize a codec session using this implementation */ + switch_sangoma_encode, /* function to encode slinear data into encoded data */ + switch_sangoma_decode, /* function to decode encoded data into slinear data */ + switch_sangoma_destroy); /* deinitalize a codec handle using this implementation */ + + siren_codec = get_codec_from_id(SNGTC_CODEC_SIREN7_32); + switch_core_codec_add_implementation(pool, codec_interface, /* the codec interface we allocated and we want to register with the core */ + SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ + siren_codec->iana, /* the IANA code number, ie http://www.iana.org/assignments/rtp-parameters */ + siren_codec->iana_name, /* the IANA code name */ "bitrate=32000", /* default fmtp to send (can be overridden by the init function), fmtp is used in SDP for format specific parameters */ - g_codec_map[c].sampling_rate, /* samples transferred per second */ - g_codec_map[c].actual_sampling_rate, /* actual samples transferred per second */ - g_codec_map[c].bps, /* bits transferred per second */ - g_codec_map[c].mpf, /* microseconds per frame */ - g_codec_map[c].spf, /* samples per frame */ - g_codec_map[c].bpfd, /* number of bytes per frame decompressed */ - g_codec_map[c].bpfc, /* number of bytes per frame compressed */ + siren_codec->sampling_rate, /* samples transferred per second */ + siren_codec->actual_sampling_rate, /* actual samples transferred per second */ + siren_codec->bps, /* bits transferred per second */ + siren_codec->mpf, /* microseconds per frame */ + siren_codec->spf, /* samples per frame */ + siren_codec->bpfd, /* number of bytes per frame decompressed */ + siren_codec->bpfc, /* number of bytes per frame compressed */ 1, /* number of channels represented */ - g_codec_map[c].spf, /* number of frames per network packet (I dont think this is used at all) */ + siren_codec->spf, /* number of frames per network packet (I dont think this is used at all) */ switch_sangoma_init_siren7, /* function to initialize a codec session using this implementation */ switch_sangoma_encode, /* function to encode slinear data into encoded data */ switch_sangoma_decode, /* function to decode encoded data into slinear data */ switch_sangoma_destroy); /* deinitalize a codec handle using this implementation */ + siren_done = 1; break; default: commit fcaf2677574df7fde795bb4e11f8d843ab383442 Author: Moises Silva <moy@sangoma.com> Date: Fri Nov 12 09:47:55 2010 -0500 mod_sangoma_codec: add siren7 32kbps diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index dc2fce2..9f4c12b 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -88,21 +88,22 @@ typedef struct vocallo_codec_s { vocallo_codec_t g_codec_map[] = { /* auto-init codecs */ - { SNGTC_CODEC_PCMU, 0, "PCMU", "Sangoma PCMU", 40, 64000, 10000, 80, 160, 80, 8000, 8000, 1 }, - { SNGTC_CODEC_PCMA, 8, "PCMA", "Sangoma PCMA", 40, 64000, 10000, 80, 160, 80, 8000, 8000, 1 }, - { SNGTC_CODEC_L16_1, 10, "L16", "Sangoma L16", 40, 120000, 10000, 80, 160, 160, 8000, 8000, 0 }, - { SNGTC_CODEC_L16_2, 10, "L16", "Sangoma L16 2", 40, 320000, 10000, 160, 320, 320, 16000, 16000, 0 }, - { SNGTC_CODEC_G729AB, 18, "G729", "Sangoma G729", 40, 8000, 10000, 80, 160, 10, 8000, 8000, 1 }, - { SNGTC_CODEC_G726_32, 122, "G726-32", "Sangoma G.726 32k", 40, 32000, 10000, 80, 160, 40, 8000, 8000, 1 }, - { SNGTC_CODEC_G722, 9, "G722", "Sangoma G722", 20, 64000, 10000, 80, 160, 80, 8000, 8000, 1 }, + { SNGTC_CODEC_PCMU, IANA_PCMU_A_8000_1, "PCMU", "Sangoma PCMU", 40, 64000, 10000, 80, 160, 80, 8000, 8000, 1 }, + { SNGTC_CODEC_PCMA, IANA_PCMA_A_8000_1, "PCMA", "Sangoma PCMA", 40, 64000, 10000, 80, 160, 80, 8000, 8000, 1 }, + { SNGTC_CODEC_L16_1, IANA_L16_A_44100_1, "L16", "Sangoma L16", 40, 120000, 10000, 80, 160, 160, 8000, 8000, 0 }, + { SNGTC_CODEC_L16_2, IANA_L16_A_44100_1, "L16", "Sangoma L16 2", 40, 320000, 10000, 160, 320, 320, 16000, 16000, 0 }, + { SNGTC_CODEC_G729AB, IANA_G729_AB_8000_1, "G729", "Sangoma G729", 40, 8000, 10000, 80, 160, 10, 8000, 8000, 1 }, + { SNGTC_CODEC_G726_32, IANA_G726_32_8000_1, "G726-32", "Sangoma G.726 32k", 40, 32000, 10000, 80, 160, 40, 8000, 8000, 1 }, + { SNGTC_CODEC_G722, IANA_G722_A_8000_1, "G722", "Sangoma G722", 20, 64000, 10000, 80, 160, 80, 8000, 8000, 1 }, /* manually initialized */ - { SNGTC_CODEC_GSM_FR, 3, "GSM", "Sangoma GSM", 20, 13200, 20000, 160, 320, 33, 8000, 8000, 0 }, - { SNGTC_CODEC_G723_1_63, 4, "G723", "Sangoma G723", 90, 6300, 30000, 240, 480, 24, 8000, 8000, 0 }, - { SNGTC_CODEC_AMR_1220, 96, "AMR", "Sangoma AMR", 20, 12200, 20000, 160, 320, 0, 8000, 8000, 0 }, - { SNGTC_CODEC_ILBC_133, ILBC_133_PAYLOAD, "iLBC", "Sangoma iLBC", -1, -1, -1, -1, -1, -1, -1, -1, 0 }, - { SNGTC_CODEC_ILBC_152, ILBC_152_PAYLOAD, "iLBC", "Sangoma iLBC", -1, -1, -1, -1, -1, -1, -1, -1, 0 }, - { -1, -1, NULL, NULL, -1, -1, -1, -1, -1, -1, -1, -1, 0 }, + { SNGTC_CODEC_GSM_FR, IANA_GSM_A_8000_1, "GSM", "Sangoma GSM", 20, 13200, 20000, 160, 320, 33, 8000, 8000, 0 }, + { SNGTC_CODEC_G723_1_63, IANA_G723_A_8000_1, "G723", "Sangoma G723", 90, 6300, 30000, 240, 480, 24, 8000, 8000, 0 }, + { SNGTC_CODEC_AMR_1220, IANA_AMR_WB_16000_1, "AMR", "Sangoma AMR", 20, 12200, 20000, 160, 320, 0, 8000, 8000, 0 }, + { SNGTC_CODEC_SIREN7_32, IANA_SIREN7, "G7221", "Sangoma G722.1", 20, 32000, 20000, 320, 640, 80, 16000, 16000, 0 }, + { SNGTC_CODEC_ILBC_133, IANA_ILBC_133_8000_1, "iLBC", "Sangoma iLBC", -1, -1, -1, -1, -1, -1, -1, -1, 0 }, + { SNGTC_CODEC_ILBC_152, IANA_ILBC_152_8000_1, "iLBC", "Sangoma iLBC", -1, -1, -1, -1, -1, -1, -1, -1, 0 }, + { -1, -1, NULL, NULL, -1, -1, -1, -1, -1, -1, -1, -1, 0 }, }; /* RFC3389 RTP Payload for Comfort Noise */ @@ -386,6 +387,12 @@ static switch_status_t switch_sangoma_init_ilbc(switch_codec_t *codec, switch_co return switch_sangoma_init(codec, flags, codec_settings); } +static switch_status_t switch_sangoma_init_siren7(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings) +{ + int bit_rate = codec->implementation->bits_per_second; + codec->fmtp_out = switch_core_sprintf(codec->memory_pool, "bitrate=%d", bit_rate); + return switch_sangoma_init(codec, flags, codec_settings); +} static void flush_rtp(switch_rtp_t *rtp) { @@ -1322,7 +1329,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) 50, /* number of bytes per frame compressed */ 1, /* number of channels represented */ 1, /* number of frames per network packet (I dont think this is used at all) */ - switch_sangoma_init, /* function to initialize a codec session using this implementation */ + switch_sangoma_init_ilbc, /* function to initialize a codec session using this implementation */ switch_sangoma_encode, /* function to encode slinear data into encoded data */ switch_sangoma_decode, /* function to decode encoded data into slinear data */ switch_sangoma_destroy); /* deinitalize a codec handle using this implementation */ @@ -1353,6 +1360,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) } break; + case SNGTC_CODEC_AMR_1220: switch_core_codec_add_implementation(pool, codec_interface, /* the codec interface we allocated and we want to register with the core */ SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ @@ -1374,6 +1382,27 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) switch_sangoma_destroy); /* deinitalize a codec handle using this implementation */ break; + case SNGTC_CODEC_SIREN7_32: + switch_core_codec_add_implementation(pool, codec_interface, /* the codec interface we allocated and we want to register with the core */ + SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ + g_codec_map[c].iana, /* the IANA code number, ie http://www.iana.org/assignments/rtp-parameters */ + g_codec_map[c].iana_name, /* the IANA code name */ + "bitrate=32000", /* default fmtp to send (can be overridden by the init function), fmtp is used in SDP for format specific parameters */ + g_codec_map[c].sampling_rate, /* samples transferred per second */ + g_codec_map[c].actual_sampling_rate, /* actual samples transferred per second */ + g_codec_map[c].bps, /* bits transferred per second */ + g_codec_map[c].mpf, /* microseconds per frame */ + g_codec_map[c].spf, /* samples per frame */ + g_codec_map[c].bpfd, /* number of bytes per frame decompressed */ + g_codec_map[c].bpfc, /* number of bytes per frame compressed */ + 1, /* number of channels represented */ + g_codec_map[c].spf, /* number of frames per network packet (I dont think this is used at all) */ + switch_sangoma_init_siren7, /* function to initialize a codec session using this implementation */ + switch_sangoma_encode, /* function to encode slinear data into encoded data */ + switch_sangoma_decode, /* function to decode encoded data into slinear data */ + switch_sangoma_destroy); /* deinitalize a codec handle using this implementation */ + break; + default: break; } commit 97056b24c0fc975ac7a92d344992e13e6c0d320d Author: Moises Silva <moy@sangoma.com> Date: Thu Nov 11 16:04:56 2010 -0500 mod_sangoma_codec: fix samples per packet diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index 6e6fe58..dc2fce2 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -91,7 +91,7 @@ vocallo_codec_t g_codec_map[] = { SNGTC_CODEC_PCMU, 0, "PCMU", "Sangoma PCMU", 40, 64000, 10000, 80, 160, 80, 8000, 8000, 1 }, { SNGTC_CODEC_PCMA, 8, "PCMA", "Sangoma PCMA", 40, 64000, 10000, 80, 160, 80, 8000, 8000, 1 }, { SNGTC_CODEC_L16_1, 10, "L16", "Sangoma L16", 40, 120000, 10000, 80, 160, 160, 8000, 8000, 0 }, - { SNGTC_CODEC_L16_2, 10, "L16", "Sangoma L16 2", 40, 320000, 10000, 80, 320, 320, 16000, 16000, 0 }, + { SNGTC_CODEC_L16_2, 10, "L16", "Sangoma L16 2", 40, 320000, 10000, 160, 320, 320, 16000, 16000, 0 }, { SNGTC_CODEC_G729AB, 18, "G729", "Sangoma G729", 40, 8000, 10000, 80, 160, 10, 8000, 8000, 1 }, { SNGTC_CODEC_G726_32, 122, "G726-32", "Sangoma G.726 32k", 40, 32000, 10000, 80, 160, 40, 8000, 8000, 1 }, { SNGTC_CODEC_G722, 9, "G722", "Sangoma G722", 20, 64000, 10000, 80, 160, 80, 8000, 8000, 1 }, commit a2add139638907d3c36ee935c2f0b51db7821fd0 Author: David Yat Sin <dyatsin@sangoma.com> Date: Mon Nov 15 19:16:09 2010 -0500 freetdm:Changes for shared IO diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 5142de5..674fea2 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -51,6 +51,8 @@ static void ftdm_sangoma_isdn_poll_events(ftdm_span_t *span); static void ftdm_sangoma_isdn_process_phy_events(ftdm_span_t *span, ftdm_oob_event_t event); static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan); static void ftdm_sangoma_isdn_process_stack_event (ftdm_span_t *span, sngisdn_event_data_t *sngisdn_event); +static void ftdm_sangoma_isdn_wakeup_phy(ftdm_channel_t *dchan); +static void ftdm_sangoma_isdn_dchan_set_queue_size(ftdm_channel_t *ftdmchan); static ftdm_io_interface_t g_sngisdn_io_interface; static sng_isdn_event_interface_t g_sngisdn_event_interface; @@ -241,8 +243,9 @@ static __inline__ void ftdm_sangoma_isdn_advance_chan_states(ftdm_channel_t *ftd static void ftdm_sangoma_isdn_process_phy_events(ftdm_span_t *span, ftdm_oob_event_t event) { - - sngisdn_snd_event(span, event); + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data; + sngisdn_snd_event(signal_data->dchan, event); + switch (event) { /* Check if the span woke up from power-saving mode */ case FTDM_OOB_ALARM_CLEAR: @@ -251,8 +254,7 @@ static void ftdm_sangoma_isdn_process_phy_events(ftdm_span_t *span, ftdm_oob_eve sngisdn_chan_data_t *sngisdn_info; ftdm_iterator_t *chaniter = NULL; ftdm_iterator_t *curr = NULL; - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data; - + chaniter = ftdm_span_get_chan_iterator(span, NULL); for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { ftdmchan = (ftdm_channel_t*)ftdm_iterator_current(curr); @@ -261,7 +263,7 @@ static void ftdm_sangoma_isdn_process_phy_events(ftdm_span_t *span, ftdm_oob_eve if (ftdm_test_flag(sngisdn_info, FLAG_ACTIVATING)) { ftdm_clear_flag(sngisdn_info, FLAG_ACTIVATING); - ftdm_sched_timer(signal_data->sched, "delayed_setup", 1, sngisdn_delayed_setup, (void*) ftdmchan->call_data, NULL); + ftdm_sched_timer(signal_data->sched, "delayed_setup", 1000, sngisdn_delayed_setup, (void*) ftdmchan->call_data, NULL); } } ftdm_iterator_free(chaniter); @@ -276,9 +278,7 @@ static void ftdm_sangoma_isdn_process_phy_events(ftdm_span_t *span, ftdm_oob_eve static void ftdm_sangoma_isdn_poll_events(ftdm_span_t *span) { ftdm_status_t ret_status; - ftdm_iterator_t *chaniter = NULL; - ftdm_iterator_t *curr = NULL; - + ret_status = ftdm_span_poll_event(span, 0, NULL); switch(ret_status) { case FTDM_SUCCESS: @@ -297,6 +297,33 @@ static void ftdm_sangoma_isdn_poll_events(ftdm_span_t *span) } } +static void ftdm_sangoma_isdn_dchan_set_queue_size(ftdm_channel_t *dchan) +{ + ftdm_status_t ret_status; + uint32_t queue_size; + + queue_size = SNGISDN_DCHAN_QUEUE_LEN; + ret_status = ftdm_channel_command(dchan, FTDM_COMMAND_SET_RX_QUEUE_SIZE, &queue_size); + ftdm_assert(ret_status == FTDM_SUCCESS, "Failed to set Rx Queue size"); + + queue_size = SNGISDN_DCHAN_QUEUE_LEN; + ret_status = ftdm_channel_command(dchan, FTDM_COMMAND_SET_TX_QUEUE_SIZE, &queue_size); + ftdm_assert(ret_status == FTDM_SUCCESS, "Failed to set Tx Queue size"); + + RETVOID; +} + +static void ftdm_sangoma_isdn_wakeup_phy(ftdm_channel_t *dchan) +{ + ftdm_status_t ret_status; + ftdm_channel_hw_link_status_t status = FTDM_HW_LINK_CONNECTED; + ret_status = ftdm_channel_command(dchan, FTDM_COMMAND_SET_LINK_STATUS, &status); + if (ret_status != FTDM_SUCCESS) { + ftdm_log_chan_msg(dchan, FTDM_LOG_WARNING, "Failed to wake-up link\n"); + } + return; +} + static void *ftdm_sangoma_isdn_dchan_run(ftdm_thread_t *me, void *obj) { uint8_t data[1000]; @@ -306,7 +333,9 @@ static void *ftdm_sangoma_isdn_dchan_run(ftdm_thread_t *me, void *obj) ftdm_channel_t *dchan = ((sngisdn_span_data_t*)span->signal_data)->dchan; ftdm_size_t len = 0; - + ftdm_channel_set_feature(dchan, FTDM_CHANNEL_FEATURE_IO_STATS); + ftdm_sangoma_isdn_dchan_set_queue_size(dchan); + ftdm_assert(dchan, "Span does not have a dchannel"); ftdm_channel_open_chan(dchan); @@ -597,8 +626,8 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Requesting Line activation\n"); - sngisdn_set_flag(sngisdn_info, FLAG_ACTIVATING); - sngisdn_wake_up_phy(ftdmchan->span); + sngisdn_set_flag(sngisdn_info, FLAG_ACTIVATING); + ftdm_sangoma_isdn_wakeup_phy(ftdmchan); ftdm_sched_timer(signal_data->sched, "timer_t3", signal_data->timer_t3*1000, sngisdn_t3_timeout, (void*) sngisdn_info, NULL); } else { sngisdn_snd_setup(ftdmchan); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 7c66c38..8208aa1 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -60,6 +60,7 @@ #define SNGISDN_EVENT_QUEUE_SIZE 100 #define SNGISDN_EVENT_POLL_RATE 100 #define SNGISDN_NUM_LOCAL_NUMBERS 8 +#define SNGISDN_DCHAN_QUEUE_LEN 200 /* TODO: rename all *_cc_* to *_an_* */ @@ -294,7 +295,7 @@ void sngisdn_snd_con_complete(ftdm_channel_t *ftdmchan); void sngisdn_snd_info_req(ftdm_channel_t *ftdmchan); void sngisdn_snd_status_enq(ftdm_channel_t *ftdmchan); void sngisdn_snd_data(ftdm_channel_t *dchan, uint8_t *data, ftdm_size_t len); -void sngisdn_snd_event(ftdm_channel_t *span, sng_isdn_l1_event_t l1_event); +void sngisdn_snd_event(ftdm_channel_t *dchan, ftdm_oob_event_t event); /* Inbound Call Control functions */ void sngisdn_rcv_con_ind(int16_t suId, uint32_t suInstId, uint32_t spInstId, ConEvnt *conEvnt, int16_t dChan, uint8_t ces); @@ -314,7 +315,7 @@ void sngisdn_rcv_srv_ind(int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces) void sngisdn_rcv_srv_cfm(int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces); void sngisdn_rcv_rst_cfm(int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces, uint8_t evntType); void sngisdn_rcv_rst_ind(int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces, uint8_t evntType); -int16_t sngisdn_rcv_l1_data_req(uint16_t spId, sng_isdn_l1_frame_t *l1_frame); +int16_t sngisdn_rcv_l1_data_req(uint16_t spId, sng_l1_frame_t *l1_frame); int16_t sngisdn_rcv_l1_cmd_req(uint16_t spId, sng_l1_cmd_t *l1_cmd); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 94bd6e2..8842ef5 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -598,7 +598,7 @@ void sngisdn_snd_release(ftdm_channel_t *ftdmchan, uint8_t glare) /* We received an incoming frame on the d-channel, send data to the stack */ void sngisdn_snd_data(ftdm_channel_t *dchan, uint8_t *data, ftdm_size_t len) { - l1_frame_t l1_frame; + sng_l1_frame_t l1_frame; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) dchan->span->signal_data; memset(&l1_frame, 0, sizeof(l1_frame)); @@ -606,32 +606,32 @@ void sngisdn_snd_data(ftdm_channel_t *dchan, uint8_t *data, ftdm_size_t len) memcpy(&l1_frame.data, data, len); - if (ftdm_test_flag(&(dchan->iostats.s.rx), FTDM_IOSTATS_ERROR_CRC)) { + if (ftdm_test_flag(&(dchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_CRC)) { l1_frame.flags |= SNG_L1FRAME_ERROR_CRC; } - if (ftdm_test_flag(&(dchan->iostats.s.rx), FTDM_IOSTATS_ERROR_FRAME)) { + if (ftdm_test_flag(&(dchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_FRAME)) { l1_frame.flags |= SNG_L1FRAME_ERROR_FRAME; } - if (ftdm_test_flag(&(dchan->iostats.s.rx), FTDM_IOSTATS_ERROR_ABORT)) { + if (ftdm_test_flag(&(dchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_ABORT)) { l1_frame.flags |= SNG_L1FRAME_ERROR_ABORT; } - if (ftdm_test_flag(&(dchan->iostats.s.rx), FTDM_IOSTATS_ERROR_FIFO)) { + if (ftdm_test_flag(&(dchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_FIFO)) { l1_frame.flags |= SNG_L1FRAME_ERROR_FIFO; } - if (ftdm_test_flag(&(dchan->iostats.s.rx), FTDM_IOSTATS_ERROR_DMA)) { + if (ftdm_test_flag(&(dchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_DMA)) { l1_frame.flags |= SNG_L1FRAME_ERROR_DMA; } - if (ftdm_test_flag(&(dchan->iostats.s.rx), FTDM_IOSTATS_QUEUE_THRES)) { + if (ftdm_test_flag(&(dchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES)) { /* Should we trigger congestion here? */ l1_frame.flags |= SNG_L1FRAME_QUEUE_THRES; } - if (ftdm_test_flag(&(dchan->iostats.s.rx), FTDM_IOSTATS_QUEUE_FULL)) { + if (ftdm_test_flag(&(dchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_QUEUE_FULL)) { /* Should we trigger congestion here? */ l1_frame.flags |= SNG_L1FRAME_QUEUE_FULL; } @@ -640,14 +640,20 @@ void sngisdn_snd_data(ftdm_channel_t *dchan, uint8_t *data, ftdm_size_t len) } void sngisdn_snd_event(ftdm_channel_t *dchan, ftdm_oob_event_t event) -{ +{ + sng_l1_event_t l1_event; + memset(&l1_event, 0, sizeof(l1_event)); + + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) dchan->span->signal_data; switch(event) { case FTDM_OOB_ALARM_CLEAR: - sng_isdn_event_ind(signal_data->link_id, SNG_L1EVENT_ALARM_OFF); + l1_event.type = SNG_L1EVENT_ALARM_OFF; + sng_isdn_event_ind(signal_data->link_id, &l1_event); break; case FTDM_OOB_ALARM_TRAP: - sng_isdn_event_ind(signal_data->link_id, SNG_L1EVENT_ALARM_ON); + l1_event.type = SNG_L1EVENT_ALARM_ON; + sng_isdn_event_ind(signal_data->link_id, &l1_event); break; default: /* We do not care about the other OOB events for now */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c index 9400064..e3898b9 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c @@ -866,13 +866,15 @@ end_of_trace: return; } -int16_t sngisdn_rcv_data_req(uint16_t spId, uint8_t *buff, uint32_t length) +/* The stacks is wants to transmit a frame */ +int16_t sngisdn_rcv_l1_data_req(uint16_t spId, sng_l1_frame_t *l1_frame) { ftdm_status_t status; ftdm_wait_flag_t flags = FTDM_WRITE; sngisdn_span_data_t *signal_data = g_sngisdn_data.spans[spId]; ftdm_assert(signal_data, "Received Data request on unconfigured span\n"); - + ftdm_size_t length = l1_frame->len; + do { flags = FTDM_WRITE; status = signal_data->dchan->fio->wait(signal_data->dchan, &flags, 1000); @@ -883,7 +885,7 @@ int16_t sngisdn_rcv_data_req(uint16_t spId, uint8_t *buff, uint32_t length) if ((flags & FTDM_WRITE)) { - status = signal_data->dchan->fio->write(signal_data->dchan, buff, (ftdm_size_t*)&length); + status = signal_data->dchan->fio->write(signal_data->dchan, l1_frame->data, (ftdm_size_t*)&length); if (status != FTDM_SUCCESS) { ftdm_log_chan_msg(signal_data->dchan, FTDM_LOG_CRIT, "Failed to transmit frame\n"); return -1; @@ -900,6 +902,45 @@ int16_t sngisdn_rcv_data_req(uint16_t spId, uint8_t *buff, uint32_t length) return 0; } +int16_t sngisdn_rcv_l1_cmd_req(uint16_t spId, sng_l1_cmd_t *l1_cmd) +{ + sngisdn_span_data_t *signal_data = g_sngisdn_data.spans[spId]; + ftdm_assert(signal_data, "Received Data request on unconfigured span\n"); + + switch(l1_cmd->type) { + case SNG_L1CMD_SET_LINK_STATUS: + { + ftdm_channel_hw_link_status_t status = FTDM_HW_LINK_CONNECTED; + ftdm_channel_command(signal_data->dchan, FTDM_COMMAND_SET_LINK_STATUS, &status); + } + break; + case SNG_L1CMD_GET_LINK_STATUS: + { + ftdm_channel_hw_link_status_t status = 0; + ftdm_channel_command(signal_data->dchan, FTDM_COMMAND_GET_LINK_STATUS, &status); + if (status == FTDM_HW_LINK_CONNECTED) { + l1_cmd->cmd.status = 1; + } else if (status == FTDM_HW_LINK_DISCONNECTED) { + l1_cmd->cmd.status = 0; + } else { + ftdm_log_chan(signal_data->dchan, FTDM_LOG_CRIT, "Invalid link status reported %d\n", status); + l1_cmd->cmd.status = 0; + } + } + break; + case SNG_L1CMD_FLUSH_STATS: + ftdm_channel_command(signal_data->dchan, FTDM_COMMAND_FLUSH_IOSTATS, NULL); + break; + case SNG_L1CMD_FLUSH_BUFFERS: + ftdm_channel_command(signal_data->dchan, FTDM_COMMAND_FLUSH_BUFFERS, NULL); + break; + default: + ftdm_log_chan(signal_data->dchan, FTDM_LOG_CRIT, "Unsupported channel command:%d\n", l1_cmd->type); + return -1; + } + return 0; +} + void sngisdn_rcv_sng_assert(char *message) { ftdm_assert(0, message); diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index d6573ac..f9fbb5c 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -746,6 +746,28 @@ static FIO_COMMAND_FUNCTION(wanpipe_command) } } break; + case FTDM_COMMAND_FLUSH_BUFFERS: + { + err = sangoma_flush_bufs(ftdmchan->sockfd, &tdm_api); + } + break; + case FTDM_COMMAND_FLUSH_IOSTATS: + { + err = sangoma_flush_stats(ftdmchan->sockfd, &tdm_api); + } + break; + case FTDM_COMMAND_SET_RX_QUEUE_SIZE: + { + uint32_t queue_size = FTDM_COMMAND_OBJ_INT; + err = sangoma_set_rx_queue_sz(ftdmchan->sockfd, &tdm_api, queue_size); + } + break; + case FTDM_COMMAND_SET_TX_QUEUE_SIZE: + { + uint32_t queue_size = FTDM_COMMAND_OBJ_INT; + err = sangoma_set_tx_queue_sz(ftdmchan->sockfd, &tdm_api, queue_size); + } + break; default: break; }; @@ -759,45 +781,42 @@ static FIO_COMMAND_FUNCTION(wanpipe_command) return FTDM_SUCCESS; } -static void wanpipe_read_stats(ftdmchan, wp_tdm_api_rx_hdr_t *rx_stats) +static void wanpipe_read_stats(ftdm_channel_t *ftdmchan, wp_tdm_api_rx_hdr_t *rx_stats) { - ftdmchan->iostats.s.rx.error_flags = 0; - if (rx_stats->rx_hdr_errors) { - wanpipe_reset_stats(ftdmchan); - ftdm_log_chan_msg_throttle(ftdmchan, "IO errors\n"); - } + ftdmchan->iostats.stats.rx.flags = 0; - ftdmchan->iostats.s.rx_queue_size = rx_stats->rx_h.rx_h.max_rx_queue_length; - ftdmchan->iostats.s.rx_queue_len = rx_stats->rx_h.current_number_of_frames_in_rx_queue; + ftdmchan->iostats.stats.rx.errors = rx_stats->wp_api_rx_hdr_errors; + ftdmchan->iostats.stats.rx.rx_queue_size = rx_stats->wp_api_rx_hdr_max_queue_length; + ftdmchan->iostats.stats.rx.rx_queue_len = rx_stats->wp_api_rx_hdr_number_of_frames_in_queue; - if (rx_stats->rx_h.wp_api_rx_hdr_error_map & (1<<WP_ABORT_ERROR_BIT)) { - ftdm_set_flag(&(ftdmchan->iostats.s.rx), FTDM_IOSTATS_ERROR_ABORT); + if (rx_stats->wp_api_rx_hdr_error_map & (1<<WP_ABORT_ERROR_BIT)) { + ftdm_set_flag(&(ftdmchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_ABORT); } - if (rx_stats->rx_h.wp_api_rx_hdr_error_map & (1<<WP_DMA_ERROR_BIT)) { - ftdm_set_flag(&(ftdmchan->iostats.s.rx), FTDM_IOSTATS_ERROR_DMA); + if (rx_stats->wp_api_rx_hdr_error_map & (1<<WP_DMA_ERROR_BIT)) { + ftdm_set_flag(&(ftdmchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_DMA); } - if (rx_stats->rx_h.wp_api_rx_hdr_error_map & (1<<WP_FIFO_ERROR_BIT)) { - ftdm_set_flag(&(ftdmchan->iostats.s.rx), FTDM_IOSTATS_ERROR_FIFO); + if (rx_stats->wp_api_rx_hdr_error_map & (1<<WP_FIFO_ERROR_BIT)) { + ftdm_set_flag(&(ftdmchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_FIFO); } - if (rx_stats->rx_h.wp_api_rx_hdr_error_map & (1<<WP_CRC_ERROR_BIT)) { - ftdm_set_flag(&(ftdmchan->iostats.s.rx), FTDM_IOSTATS_ERROR_CRC); + if (rx_stats->wp_api_rx_hdr_error_map & (1<<WP_CRC_ERROR_BIT)) { + ftdm_set_flag(&(ftdmchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_CRC); } - if (rx_stats->rx_h.wp_api_rx_hdr_error_map & (1<<WP_FRAME_ERROR_BIT)) { - ftdm_set_flag(&(ftdmchan->iostats.s.rx), FTDM_IOSTATS_ERROR_FRAME); + if (rx_stats->wp_api_rx_hdr_error_map & (1<<WP_FRAME_ERROR_BIT)) { + ftdm_set_flag(&(ftdmchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_FRAME); } - if (ftdmchan->iostats.s.rx_queue_len >= (0.8*ftdmchan->iostats.s.rx_queue_size)) { + if (ftdmchan->iostats.stats.rx.rx_queue_len >= (0.8*ftdmchan->iostats.stats.rx.rx_queue_size)) { ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Rx Queue length exceeded threshold (%d/%d)\n", - ftdmchan->iostats.s.rx_queue_len, ftdmchan->iostats.s.rx_queue_size); + ftdmchan->iostats.stats.rx.rx_queue_len, ftdmchan->iostats.stats.rx.rx_queue_size); - ftdm_set_flag(&(ftdmchan->iostats.s.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES); + ftdm_set_flag(&(ftdmchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES); } - if (ftdmchan->iostats.s.rx_queue_len >= ftdmchan->iostats.s.rx_queue_size) { + if (ftdmchan->iostats.stats.rx.rx_queue_len >= ftdmchan->iostats.stats.rx.rx_queue_size) { ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Rx Queue Full (%d/%d)\n", - ftdmchan->iostats.s.rx_queue_len, ftdmchan->iostats.s.rx_queue_size); + ftdmchan->iostats.stats.rx.rx_queue_len, ftdmchan->iostats.stats.rx.rx_queue_size); - ftdm_set_flag(&(ftdmchan->iostats.s.rx), FTDM_IOSTATS_ERROR_QUEUE_FULL); + ftdm_set_flag(&(ftdmchan->iostats.stats.rx), FTDM_IOSTATS_ERROR_QUEUE_FULL); } return; } diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 64ecc2e..52a5456 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -430,12 +430,15 @@ typedef enum { FTDM_COMMAND_FLUSH_TX_BUFFERS, FTDM_COMMAND_FLUSH_RX_BUFFERS, FTDM_COMMAND_FLUSH_BUFFERS, + FTDM_COMMAND_FLUSH_IOSTATS, FTDM_COMMAND_SET_PRE_BUFFER_SIZE, FTDM_COMMAND_SET_LINK_STATUS, FTDM_COMMAND_GET_LINK_STATUS, FTDM_COMMAND_ENABLE_LOOP, FTDM_COMMAND_DISABLE_LOOP, - FTDM_COMMAND_COUNT + FTDM_COMMAND_COUNT, + FTDM_COMMAND_SET_RX_QUEUE_SIZE, + FTDM_COMMAND_SET_TX_QUEUE_SIZE, } ftdm_command_t; /*! \brief Custom memory handler hooks. Not recommended to use unless you need memory allocation customizations */ diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index 6cbf589..c7a1533 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -391,7 +391,7 @@ typedef struct { uint8_t tx_queue_size; /* max queue size configured */ uint8_t tx_queue_len; /* Current number of elements in queue */ } tx; - } s; + } stats; } ftdm_channel_iostats_t; /* 2^8 table size, one for each byte (sample) value */ diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index 78ac8f6..d9cefc3 100644 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -194,6 +194,7 @@ typedef enum { FTDM_CHANNEL_FEATURE_CALLWAITING = (1 << 6), /*!< Channel will allow call waiting (ie: FXS devices) (read/write) */ FTDM_CHANNEL_FEATURE_HWEC = (1<<7), /*!< Channel has a hardware echo canceller */ FTDM_CHANNEL_FEATURE_HWEC_DISABLED_ON_IDLE = (1<<8), /*!< hardware echo canceller is disabled when there are no calls on this channel */ + FTDM_CHANNEL_FEATURE_IO_STATS = (1<<9), /*!< Channel supports IO statistics (HDLC channels only) */ } ftdm_channel_feature_t; typedef enum { commit b1e773e7873345ce327e9e736b2aec9e6cb69901 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Mon Nov 15 21:10:39 2010 -0200 freetdm: fixed ftmod_r2 r2conf function pointers diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 0866561..dd2dc1f 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -879,7 +879,7 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_r2_configure_span) ftdm_r2_call_t *r2call = NULL; openr2_chan_t *r2chan = NULL; openr2_log_level_t tmplevel; - char *clevel; + char *clevel = NULL; char *logval = NULL; ft_r2_conf_t r2conf = @@ -887,20 +887,21 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_r2_configure_span) /* .variant */ OR2_VAR_ITU, /* .category */ OR2_CALLING_PARTY_CATEGORY_NATIONAL_SUBSCRIBER, /* .loglevel */ OR2_LOG_ERROR | OR2_LOG_WARNING, + /* .logdir */ NULL, + /* .advanced_protocol_file */ NULL, /* .max_ani */ 10, /* .max_dnis */ 4, /* .mfback_timeout */ -1, /* .metering_pulse_timeout */ -1, - /* .allow_collect_calls */ -1, /* .immediate_accept */ -1, /* .skip_category */ -1, - /* .forced_release */ -1, - /* .charge_calls */ -1, /* .get_ani_first */ -1, /* .call_files */ 0, /* .mf_files */ 0, - /* .logdir */ NULL, - /* .advanced_protocol_file */ NULL + /* .double_answer */ 0, + /* .charge_calls */ -1, + /* .forced_release */ -1, + /* .allow_collect_calls */ -1 }; assert(sig_cb != NULL); @@ -982,15 +983,6 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_r2_configure_span) } if (ftdm_strlen_zero_buf(val)) { ftdm_log(FTDM_LOG_NOTICE, "Ignoring empty R2 advanced_protocol_file parameter\n"); - /* - * TODO: investigate this - * - * despite the fact advanced_protocol_file was initialized as NULL, it's now a bad - * pointer - hence, this workaround. - * this seems to happen only on windows. - * - */ - r2conf.advanced_protocol_file = NULL; continue; } r2conf.advanced_protocol_file = val; commit 9fa6fb5e022397c72e0f49511a89119e412b8558 Author: Moises Silva <moy@sangoma.com> Date: Mon Nov 15 15:48:59 2010 -0500 freetdm: remove unused patches directory diff --git a/libs/freetdm/patches/oz.diff b/libs/freetdm/patches/oz.diff deleted file mode 100644 index 2e9c558..0000000 --- a/libs/freetdm/patches/oz.diff +++ /dev/null @@ -1,134 +0,0 @@ -Index: src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c -=================================================================== ---- src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c (revision 745) -+++ src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c (working copy) -@@ -98,19 +98,21 @@ - * so we can have one analong handler thread that will deal with all the idle analog channels for events - * the alternative would be for the driver to provide one socket for all of the oob events for all analog channels - */ --static __inline__ int tdmv_api_wait_socket(sng_fd_t fd, int timeout, int *flags) -+static __inline__ int tdmv_api_wait_socket(zap_channel_t *zchan, int timeout, int *flags) - { - - #ifdef LIBSANGOMA_VERSION - int err; -- sangoma_wait_obj_t sangoma_wait_obj; -+ sangoma_wait_obj_t *sangoma_wait_obj = zchan->mod_data; - -- sangoma_init_wait_obj(&sangoma_wait_obj, fd, 1, 1, *flags, SANGOMA_WAIT_OBJ); -+ sangoma_init_wait_obj(sangoma_wait_obj, zchan->sockfd, 1, 1, 0, SANGOMA_WAIT_OBJ); - -- err=sangoma_socket_waitfor_many(&sangoma_wait_obj,1 , timeout); -+ err = sangoma_socket_waitfor_many(&sangoma_wait_obj, 1, timeout); -+ - if (err > 0) { -- *flags=sangoma_wait_obj.flags_out; -+ *flags = sangoma_wait_obj.flags_out; - } -+ - return err; - - #else -@@ -118,7 +120,7 @@ - int res; - - memset(&pfds[0], 0, sizeof(pfds[0])); -- pfds[0].fd = fd; -+ pfds[0].fd = zchan->sockfd; - pfds[0].events = *flags; - res = poll(pfds, 1, timeout); - *flags = 0; -@@ -200,6 +202,15 @@ - - if (sockfd != WP_INVALID_SOCKET && zap_span_add_channel(span, sockfd, type, &chan) == ZAP_SUCCESS) { - wanpipe_tdm_api_t tdm_api; -+#ifdef LIBSANGOMA_VERSION -+ sangoma_wait_obj_t *sangoma_wait_obj; -+ -+ sangoma_wait_obj = malloc(sizeof(*sangoma_wait_obj)); -+ memset(sangoma_wait_obj, 0, sizeof(*sangoma_wait_obj)); -+ sangoma_init_wait_obj(sangoma_wait_obj, sockfd, 1, 1, 0, SANGOMA_WAIT_OBJ); -+ chan->mod_data = sangoma_wait_obj; -+#endif -+ - memset(&tdm_api,0,sizeof(tdm_api)); - - chan->physical_span_id = spanno; -@@ -211,7 +222,7 @@ - - dtmf = "software"; - -- /* FIXME: Handle Error Conditino Check for return code */ -+ /* FIXME: Handle Error Condition Check for return code */ - err= sangoma_tdm_get_hw_coding(chan->sockfd, &tdm_api); - - if (tdm_api.wp_tdm_cmd.hw_tdm_coding) { -@@ -606,7 +617,7 @@ - inflags |= POLLPRI; - } - -- result = tdmv_api_wait_socket(zchan->sockfd, to, &inflags); -+ result = tdmv_api_wait_socket(zchan, to, &inflags); - - *flags = ZAP_NO_FLAGS; - -@@ -643,26 +654,30 @@ - ZIO_SPAN_POLL_EVENT_FUNCTION(wanpipe_poll_event) - { - #ifdef LIBSANGOMA_VERSION -- sangoma_wait_obj_t pfds[ZAP_MAX_CHANNELS_SPAN]; -+ sangoma_wait_obj_t *pfds[ZAP_MAX_CHANNELS_SPAN] = { 0 }; - #else - struct pollfd pfds[ZAP_MAX_CHANNELS_SPAN]; - #endif - - uint32_t i, j = 0, k = 0, l = 0; -- int objects=0; - int r; - - for(i = 1; i <= span->chan_count; i++) { - zap_channel_t *zchan = span->channels[i]; - -+ - #ifdef LIBSANGOMA_VERSION -- sangoma_init_wait_obj(&pfds[j], zchan->sockfd , 1, 1, POLLPRI, SANGOMA_WAIT_OBJ); -+ if (!zchan->mod_data) { -+ continue; -+ } -+ pfds[j] = zchan->mod_data; -+ - #else - memset(&pfds[j], 0, sizeof(pfds[j])); - pfds[j].fd = span->channels[i]->sockfd; - pfds[j].events = POLLPRI; - #endif -- objects++; -+ - /* The driver probably should be able to do this wink/flash/ringing by itself this is sort of a hack to make it work! */ - - if (zap_test_flag(zchan, ZAP_CHANNEL_WINK) || zap_test_flag(zchan, ZAP_CHANNEL_FLASH)) { -@@ -703,7 +718,7 @@ - ms = l; - } - #ifdef LIBSANGOMA_VERSION -- r = sangoma_socket_waitfor_many(pfds,objects,ms); -+ r = sangoma_socket_waitfor_many(pfds, j, ms); - #else - r = poll(pfds, j, ms); - #endif -@@ -935,6 +950,15 @@ - */ - static ZIO_CHANNEL_DESTROY_FUNCTION(wanpipe_channel_destroy) - { -+ sangoma_wait_obj_t *sangoma_wait_obj; -+ -+ if (zchan->mod_data) { -+ sangoma_wait_obj = zchan->mod_data; -+ zchan->mod_data = NULL; -+ sangoma_release_wait_obj(sangoma_wait_obj); -+ free(sangoma_wait_obj); -+ } -+ - if (zchan->sockfd > -1) { - close(zchan->sockfd); - zchan->sockfd = WP_INVALID_SOCKET; commit 6cfce6f43d48867fcc601eba500253c631df906c Author: Moises Silva <moy@sangoma.com> Date: Mon Nov 15 15:39:44 2010 -0500 freetdm: rename mod_data to io_data since is data meant for I/O modules only fix ftmod_isdn usage of mod_data, it should be call_data pointer diff --git a/libs/freetdm/src/ftdm_m3ua.c b/libs/freetdm/src/ftdm_m3ua.c index 31f4cd5..1a6fe36 100644 --- a/libs/freetdm/src/ftdm_m3ua.c +++ b/libs/freetdm/src/ftdm_m3ua.c @@ -484,7 +484,7 @@ static FIO_SPAN_NEXT_EVENT_FUNCTION(m3ua_next_event) static FIO_SPAN_DESTROY_FUNCTION(m3ua_span_destroy) { - m3ua_span_data_t *span_data = (m3ua_span_data_t *) span->mod_data; + m3ua_span_data_t *span_data = (m3ua_span_data_t *) span->io_data; if (span_data) { ftdm_safe_free(span_data); @@ -494,8 +494,8 @@ static FIO_SPAN_DESTROY_FUNCTION(m3ua_span_destroy) } static FIO_CHANNEL_DESTROY_FUNCTION(m3ua_channel_destroy) { - m3ua_chan_data_t *chan_data = (m3ua_chan_data_t *) ftdmchan->mod_data; - m3ua_span_data_t *span_data = (m3ua_span_data_t *) ftdmchan->span->mod_data; + m3ua_chan_data_t *chan_data = (m3ua_chan_data_t *) ftdmchan->io_data; + m3ua_span_data_t *span_data = (m3ua_span_data_t *) ftdmchan->span->io_data; if (!chan_data) { return FTDM_FAIL; diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c index 3ccad89..1dbd6d3 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@ -1077,8 +1077,8 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic isdn_data->channels_remote_crv[gen->CRV] = ftdmchan; memset(&ftdmchan->caller_data, 0, sizeof(ftdmchan->caller_data)); - if (ftdmchan->mod_data) { - memset(ftdmchan->mod_data, 0, sizeof(ftdm_isdn_bchan_data_t)); + if (ftdmchan->call_data) { + memset(ftdmchan->call_data, 0, sizeof(ftdm_isdn_bchan_data_t)); } /* copy number readd prefix as needed */ @@ -1210,7 +1210,7 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic * overlap dial digit indication */ if (Q931IsIEPresent(gen->CalledNum)) { - ftdm_isdn_bchan_data_t *data = (ftdm_isdn_bchan_data_t *)ftdmchan->mod_data; + ftdm_isdn_bchan_data_t *data = (ftdm_isdn_bchan_data_t *)ftdmchan->call_data; Q931ie_CalledNum *callednum = Q931GetIEPtr(gen->CalledNum, gen->buf); int pos; @@ -1365,7 +1365,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) break; case FTDM_CHANNEL_STATE_DIALTONE: { - ftdm_isdn_bchan_data_t *data = (ftdm_isdn_bchan_data_t *)ftdmchan->mod_data; + ftdm_isdn_bchan_data_t *data = (ftdm_isdn_bchan_data_t *)ftdmchan->call_data; if (data) { data->digit_timeout = ftdm_time_now() + isdn_data->digit_timeout; @@ -1858,7 +1858,7 @@ static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj) switch (ftdm_channel_get_state(chan)) { case FTDM_CHANNEL_STATE_DIALTONE: { - ftdm_isdn_bchan_data_t *data = (ftdm_isdn_bchan_data_t *)chan->mod_data; + ftdm_isdn_bchan_data_t *data = (ftdm_isdn_bchan_data_t *)chan->call_data; ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); /* check overlap dial timeout first before generating tone */ @@ -2738,7 +2738,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(isdn_configure_span) ftdm_channel_t *chan = ftdm_span_get_channel(span, i); if (ftdm_channel_get_type(chan) == FTDM_CHAN_TYPE_B) { - chan->mod_data = data; + chan->call_data = data; memset(data, 0, sizeof(ftdm_isdn_bchan_data_t)); } } diff --git a/libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.c b/libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.c index f20cbc5..aaafdb3 100644 --- a/libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.c +++ b/libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.c @@ -266,7 +266,7 @@ PK_VOID PK_CALLBACK media_out_callback(PKH_TPikaEvent *event) { PK_STATUS pk_status; ftdm_channel_t *ftdmchan = event->userData; - pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->mod_data; + pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->io_data; //PK_CHAR event_text[PKH_EVENT_MAX_NAME_LENGTH]; //PKH_EVENT_GetText(event->id, event_text, sizeof(event_text)); @@ -345,8 +345,8 @@ static unsigned pika_open_range(ftdm_span_t *span, unsigned boardno, unsigned sp } - if (span->mod_data) { - span_data = span->mod_data; + if (span->io_data) { + span_data = span->io_data; } else { span_data = ftdm_malloc(sizeof(*span_data)); assert(span_data != NULL); @@ -364,7 +364,7 @@ static unsigned pika_open_range(ftdm_span_t *span, unsigned boardno, unsigned sp //PKH_QUEUE_Attach(span_data->event_queue, globals.open_boards[boardno], NULL); - span->mod_data = span_data; + span->io_data = span_data; } if (type == FTDM_CHAN_TYPE_FXS || type == FTDM_CHAN_TYPE_FXO) { @@ -380,7 +380,7 @@ static unsigned pika_open_range(ftdm_span_t *span, unsigned boardno, unsigned sp assert(chan_data); memset(chan_data, 0, sizeof(*chan_data)); ftdm_span_add_channel(span, 0, type, &chan); - chan->mod_data = chan_data; + chan->io_data = chan_data; if ((type == FTDM_CHAN_TYPE_B || type == FTDM_CHAN_TYPE_DQ921) && !span_data->handle) { PKH_TBoardConfig boardConfig; @@ -680,7 +680,7 @@ static FIO_CONFIGURE_SPAN_FUNCTION(pika_configure_span) */ static FIO_OPEN_FUNCTION(pika_open) { - pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->mod_data; + pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->io_data; if (!chan_data && !ftdm_test_flag(chan_data, PK_FLAG_READY)) { return FTDM_FAIL; @@ -715,7 +715,7 @@ static FIO_CLOSE_FUNCTION(pika_close) */ static FIO_WAIT_FUNCTION(pika_wait) { - pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->mod_data; + pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->io_data; PK_STATUS status; ftdm_wait_flag_t myflags = *flags; PK_CHAR event_text[PKH_EVENT_MAX_NAME_LENGTH]; @@ -754,7 +754,7 @@ static FIO_WAIT_FUNCTION(pika_wait) */ static FIO_READ_FUNCTION(pika_read) { - pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->mod_data; + pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->io_data; PK_STATUS status; PK_CHAR event_text[PKH_EVENT_MAX_NAME_LENGTH]; uint32_t len; @@ -795,7 +795,7 @@ static FIO_READ_FUNCTION(pika_read) */ static FIO_WRITE_FUNCTION(pika_write) { - pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->mod_data; + pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->io_data; PK_STATUS status; if (ftdmchan->type == FTDM_CHAN_TYPE_DQ921) { @@ -821,8 +821,8 @@ static FIO_WRITE_FUNCTION(pika_write) */ static FIO_COMMAND_FUNCTION(pika_command) { - pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->mod_data; - //pika_span_data_t *span_data = (pika_span_data_t *) ftdmchan->span->mod_data; + pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->io_data; + //pika_span_data_t *span_data = (pika_span_data_t *) ftdmchan->span->io_data; PK_STATUS pk_status; ftdm_status_t status = FTDM_SUCCESS; @@ -956,7 +956,7 @@ static FIO_COMMAND_FUNCTION(pika_command) */ static FIO_SPAN_POLL_EVENT_FUNCTION(pika_poll_event) { - pika_span_data_t *span_data = (pika_span_data_t *) span->mod_data; + pika_span_data_t *span_data = (pika_span_data_t *) span->io_data; PK_STATUS status; PK_CHAR event_text[PKH_EVENT_MAX_NAME_LENGTH]; @@ -1025,7 +1025,7 @@ static FIO_SPAN_POLL_EVENT_FUNCTION(pika_poll_event) for(x = 1; x <= span->chan_count; x++) { ftdmchan = span->channels[x]; assert(ftdmchan != NULL); - chan_data = (pika_chan_data_t *) ftdmchan->mod_data; + chan_data = (pika_chan_data_t *) ftdmchan->io_data; assert(chan_data != NULL); @@ -1042,7 +1042,7 @@ static FIO_SPAN_POLL_EVENT_FUNCTION(pika_poll_event) //ftdm_log(FTDM_LOG_DEBUG, "Event: %s\n", event_text); if (ftdmchan) { - pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->mod_data; + pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->io_data; assert(chan_data != NULL); ftdm_set_flag(ftdmchan, FTDM_CHANNEL_EVENT); @@ -1068,7 +1068,7 @@ static FIO_SPAN_NEXT_EVENT_FUNCTION(pika_next_event) for(i = 1; i <= span->chan_count; i++) { if (ftdm_test_flag(span->channels[i], FTDM_CHANNEL_EVENT)) { - pika_chan_data_t *chan_data = (pika_chan_data_t *) span->channels[i]->mod_data; + pika_chan_data_t *chan_data = (pika_chan_data_t *) span->channels[i]->io_data; PK_CHAR event_text[PKH_EVENT_MAX_NAME_LENGTH]; ftdm_clear_flag(span->channels[i], FTDM_CHANNEL_EVENT); @@ -1207,7 +1207,7 @@ static FIO_SPAN_NEXT_EVENT_FUNCTION(pika_next_event) */ static FIO_SPAN_DESTROY_FUNCTION(pika_span_destroy) { - pika_span_data_t *span_data = (pika_span_data_t *) span->mod_data; + pika_span_data_t *span_data = (pika_span_data_t *) span->io_data; if (span_data) { PKH_QUEUE_Destroy(span_data->event_queue); @@ -1224,8 +1224,8 @@ static FIO_SPAN_DESTROY_FUNCTION(pika_span_destroy) */ static FIO_CHANNEL_DESTROY_FUNCTION(pika_channel_destroy) { - pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->mod_data; - pika_span_data_t *span_data = (pika_span_data_t *) ftdmchan->span->mod_data; + pika_chan_data_t *chan_data = (pika_chan_data_t *) ftdmchan->io_data; + pika_span_data_t *span_data = (pika_span_data_t *) ftdmchan->span->io_data; if (!chan_data) { return FTDM_FAIL; diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index 896b8ee..8e8acc2 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -117,28 +117,28 @@ static __inline__ int tdmv_api_wait_socket(ftdm_channel_t *ftdmchan, int timeout #ifdef LIBSANGOMA_VERSION int err; - uint32_t inflags = *flags; - uint32_t outflags = 0; - sangoma_wait_obj_t *sangoma_wait_obj = ftdmchan->mod_data; + uint32_t inflags = *flags; + uint32_t outflags = 0; + sangoma_wait_obj_t *sangoma_wait_obj = ftdmchan->io_data; err = sangoma_waitfor(sangoma_wait_obj, inflags, &outflags, timeout); *flags = 0; - if (err == SANG_STATUS_SUCCESS) { - *flags = outflags; - err = 1; /* ideally should be the number of file descriptors with something to read */ - } - if (err == SANG_STATUS_APIPOLL_TIMEOUT) { - err = 0; - } - return err; + if (err == SANG_STATUS_SUCCESS) { + *flags = outflags; + err = 1; /* ideally should be the number of file descriptors with something to read */ + } + if (err == SANG_STATUS_APIPOLL_TIMEOUT) { + err = 0; + } + return err; #else struct pollfd pfds[1]; - int res; + int res; - memset(&pfds[0], 0, sizeof(pfds[0])); - pfds[0].fd = ftdmchan->sockfd; - pfds[0].events = *flags; - res = poll(pfds, 1, timeout); + memset(&pfds[0], 0, sizeof(pfds[0])); + pfds[0].fd = ftdmchan->sockfd; + pfds[0].events = *flags; + res = poll(pfds, 1, timeout); *flags = 0; if (pfds[0].revents & POLLERR) { @@ -149,7 +149,7 @@ static __inline__ int tdmv_api_wait_socket(ftdm_channel_t *ftdmchan, int timeout *flags = pfds[0].revents; } - return res; + return res; #endif } @@ -252,7 +252,7 @@ static unsigned wp_open_range(ftdm_span_t *span, unsigned spanno, unsigned start ftdm_log(FTDM_LOG_ERROR, "failure create waitable object for s%dc%d\n", spanno, x); continue; } - chan->mod_data = sangoma_wait_obj; + chan->io_data = sangoma_wait_obj; #endif chan->physical_span_id = spanno; @@ -541,7 +541,7 @@ static FIO_OPEN_FUNCTION(wanpipe_open) static FIO_CLOSE_FUNCTION(wanpipe_close) { #ifdef LIBSANGOMA_VERSION - sangoma_wait_obj_t *waitobj = ftdmchan->mod_data; + sangoma_wait_obj_t *waitobj = ftdmchan->io_data; /* kick any I/O waiters */ sangoma_wait_obj_signal(waitobj); #endif @@ -895,10 +895,10 @@ FIO_SPAN_POLL_EVENT_FUNCTION(wanpipe_poll_event) for(i = 1; i <= span->chan_count; i++) { ftdm_channel_t *ftdmchan = span->channels[i]; #ifdef LIBSANGOMA_VERSION - if (!ftdmchan->mod_data) { + if (!ftdmchan->io_data) { continue; /* should never happen but happens when shutting down */ } - pfds[j] = ftdmchan->mod_data; + pfds[j] = ftdmchan->io_data; inflags[j] = poll_events ? poll_events[j] : POLLPRI; #else memset(&pfds[j], 0, sizeof(pfds[j])); @@ -1234,10 +1234,10 @@ FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_next_event) static FIO_CHANNEL_DESTROY_FUNCTION(wanpipe_channel_destroy) { #ifdef LIBSANGOMA_VERSION - if (ftdmchan->mod_data) { + if (ftdmchan->io_data) { sangoma_wait_obj_t *sangoma_wait_obj; - sangoma_wait_obj = ftdmchan->mod_data; - ftdmchan->mod_data = NULL; + sangoma_wait_obj = ftdmchan->io_data; + ftdmchan->io_data = NULL; sangoma_wait_obj_delete(&sangoma_wait_obj); } #endif diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index dbf1080..ab20ef8 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -424,7 +424,9 @@ struct ftdm_channel { ftdm_fsk_data_state_t fsk; uint8_t fsk_buf[80]; uint32_t ring_count; - void *mod_data; + /* Private I/O data. Do not touch unless you are an I/O module */ + void *io_data; + /* Private signaling data. Do not touch unless you are a signaling module */ void *call_data; struct ftdm_caller_data caller_data; struct ftdm_span *span; @@ -456,6 +458,7 @@ struct ftdm_span { ftdm_trunk_type_t trunk_type; ftdm_analog_start_type_t start_type; ftdm_signal_type_t signal_type; + /* Private signaling data. Do not touch unless you are a signaling module */ void *signal_data; fio_signal_cb_t signal_cb; ftdm_event_t event_header; @@ -473,7 +476,8 @@ struct ftdm_span { ftdm_span_start_t start; ftdm_span_stop_t stop; ftdm_channel_sig_read_t sig_read; - void *mod_data; + /* Private I/O data per span. Do not touch unless you are an I/O module */ + void *io_data; char *type; char *dtmf_hangup; size_t dtmf_hangup_len; commit caacb24500b1294a93cea6fa5345bd9605492c99 Author: David Yat Sin <dyatsin@sangoma.com> Date: Mon Nov 15 14:13:01 2010 -0500 freetdm: Changes for FTDM IO commands diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 1ede703..15e8532 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -56,6 +56,9 @@ #define FTDM_READ_TRACE_INDEX 0 #define FTDM_WRITE_TRACE_INDEX 1 +ftdm_time_t time_last_throttle_log = 0; +ftdm_time_t time_current_throttle_log = 0; + static int time_is_init = 0; static void time_init(void) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 98b09e9..5142de5 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -242,10 +242,10 @@ static __inline__ void ftdm_sangoma_isdn_advance_chan_states(ftdm_channel_t *ftd static void ftdm_sangoma_isdn_process_phy_events(ftdm_span_t *span, ftdm_oob_event_t event) { + sngisdn_snd_event(span, event); switch (event) { /* Check if the span woke up from power-saving mode */ case FTDM_OOB_ALARM_CLEAR: - sngisdn_snd_event(span, SNG_L1EVENT_ALARM_OFF); if (FTDM_SPAN_IS_BRI(span)) { ftdm_channel_t *ftdmchan; sngisdn_chan_data_t *sngisdn_info; @@ -267,9 +267,6 @@ static void ftdm_sangoma_isdn_process_phy_events(ftdm_span_t *span, ftdm_oob_eve ftdm_iterator_free(chaniter); } break; - case FTDM_OOB_ALARM_TRAP: - sngisdn_snd_event(span, SNG_L1EVENT_ALARM_ON); - break; default: /* Ignore other events for now */ break; @@ -327,7 +324,7 @@ static void *ftdm_sangoma_isdn_dchan_run(ftdm_thread_t *me, void *obj) len = 1000; status = ftdm_channel_read(dchan, data, &len); if (status == FTDM_SUCCESS) { - sngisdn_snd_data(span, data, len); + sngisdn_snd_data(dchan, data, len); } else { ftdm_log_chan_msg(dchan, FTDM_LOG_WARNING, "Failed to read from channel \n"); } @@ -1019,7 +1016,8 @@ static FIO_SIG_LOAD_FUNCTION(ftdm_sangoma_isdn_init) g_sngisdn_event_interface.sta.sng_q931_trc_ind = sngisdn_rcv_q931_trace; g_sngisdn_event_interface.sta.sng_cc_sta_ind = sngisdn_rcv_cc_ind; - g_sngisdn_event_interface.io.sng_data_req = sngisdn_rcv_data_req; + g_sngisdn_event_interface.io.sng_l1_data_req = sngisdn_rcv_l1_data_req; + g_sngisdn_event_interface.io.sng_l1_cmd_req = sngisdn_rcv_l1_cmd_req; for(i=1;i<=MAX_VARIANTS;i++) { ftdm_mutex_create(&g_sngisdn_data.ccs[i].mutex); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 75262c9..7c66c38 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -293,8 +293,8 @@ void sngisdn_snd_reset(ftdm_channel_t *ftdmchan); void sngisdn_snd_con_complete(ftdm_channel_t *ftdmchan); void sngisdn_snd_info_req(ftdm_channel_t *ftdmchan); void sngisdn_snd_status_enq(ftdm_channel_t *ftdmchan); -void sngisdn_snd_data(ftdm_span_t *span, uint8_t *data, ftdm_size_t len); -void sngisdn_snd_event(ftdm_span_t *span, sng_isdn_l1_event_t l1_event); +void sngisdn_snd_data(ftdm_channel_t *dchan, uint8_t *data, ftdm_size_t len); +void sngisdn_snd_event(ftdm_channel_t *span, sng_isdn_l1_event_t l1_event); /* Inbound Call Control functions */ void sngisdn_rcv_con_ind(int16_t suId, uint32_t suInstId, uint32_t spInstId, ConEvnt *conEvnt, int16_t dChan, uint8_t ces); @@ -314,7 +314,9 @@ void sngisdn_rcv_srv_ind(int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces) void sngisdn_rcv_srv_cfm(int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces); void sngisdn_rcv_rst_cfm(int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces, uint8_t evntType); void sngisdn_rcv_rst_ind(int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces, uint8_t evntType); -int16_t sngisdn_rcv_data_req(uint16_t spId, uint8_t *buff, uint32_t length); +int16_t sngisdn_rcv_l1_data_req(uint16_t spId, sng_isdn_l1_frame_t *l1_frame); +int16_t sngisdn_rcv_l1_cmd_req(uint16_t spId, sng_l1_cmd_t *l1_cmd); + void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event); void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c index eabaa7a..6c75fb3 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c @@ -156,34 +156,34 @@ ftdm_status_t sngisdn_stack_cfg(ftdm_span_t *span) ftdm_status_t sngisdn_stack_cfg_phy_gen(void) { /*local variables*/ - L1Mngmt cfg; /*configuration structure*/ - Pst pst; /*post structure*/ + L1Mngmt cfg; /*configuration structure*/ + Pst pst; /*post structure*/ - /* initalize the post structure */ - stack_pst_init(&pst); + /* initalize the post structure */ + stack_pst_init(&pst); - /* insert the destination Entity */ - pst.dstEnt = ENTL1; + /* insert the destination Entity */ + pst.dstEnt = ENTL1; - /*clear the configuration structure*/ + /*clear the configuration structure*/ memset(&cfg, 0, sizeof(cfg)); - /*fill in some general sections of the header*/ - stack_hdr_init(&cfg.hdr); + /*fill in some general sections of the header*/ + stack_hdr_init(&cfg.hdr); - /*fill in the specific fields of the header*/ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTL1; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STGEN; + /*fill in the specific fields of the header*/ + cfg.hdr.msgType = TCFG; + cfg.hdr.entId.ent = ENTL1; + cfg.hdr.entId.inst = S_INST; + cfg.hdr.elmId.elmnt = STGEN; - stack_pst_init(&cfg.t.cfg.s.l1Gen.sm ); - cfg.t.cfg.s.l1Gen.sm.srcEnt = ENTL1; - cfg.t.cfg.s.l1Gen.sm.dstEnt = ENTSM; + stack_pst_init(&cfg.t.cfg.s.l1Gen.sm ); + cfg.t.cfg.s.l1Gen.sm.srcEnt = ENTL1; + cfg.t.cfg.s.l1Gen.sm.dstEnt = ENTSM; - cfg.t.cfg.s.l1Gen.nmbLnks = MAX_L1_LINKS+1; - cfg.t.cfg.s.l1Gen.poolTrUpper = POOL_UP_TR; /* upper pool threshold */ - cfg.t.cfg.s.l1Gen.poolTrLower = POOL_LW_TR; /* lower pool threshold */ + cfg.t.cfg.s.l1Gen.nmbLnks = MAX_L1_LINKS; + cfg.t.cfg.s.l1Gen.poolTrUpper = POOL_UP_TR; /* upper pool threshold */ + cfg.t.cfg.s.l1Gen.poolTrLower = POOL_LW_TR; /* lower pool threshold */ if (sng_isdn_phy_config(&pst, &cfg)) { return FTDM_FAIL; @@ -193,38 +193,38 @@ ftdm_status_t sngisdn_stack_cfg_phy_gen(void) ftdm_status_t sngisdn_stack_cfg_phy_psap(ftdm_span_t *span) { - L1Mngmt cfg; - Pst pst; + L1Mngmt cfg; + Pst pst; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; - /* initalize the post structure */ - stack_pst_init(&pst); + /* initalize the post structure */ + stack_pst_init(&pst); - /* insert the destination Entity */ - pst.dstEnt = ENTL1; + /* insert the destination Entity */ + pst.dstEnt = ENTL1; - /*clear the configuration structure*/ + /*clear the configuration structure*/ memset(&cfg, 0, sizeof(cfg)); - /*fill in some general sections of the header*/ - stack_hdr_init(&cfg.hdr); + /*fill in some general sections of the header*/ + stack_hdr_init(&cfg.hdr); - /*fill in the specific fields of the header*/ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTL1; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STPSAP; + /*fill in the specific fields of the header*/ + cfg.hdr.msgType = TCFG; + cfg.hdr.entId.ent = ENTL1; + cfg.hdr.entId.inst = S_INST; + cfg.hdr.elmId.elmnt = STPSAP; cfg.hdr.elmId.elmntInst1 = signal_data->link_id; - + if (!signal_data->dchan) { ftdm_log(FTDM_LOG_ERROR, "%s:No d-channels specified\n", span->name); return FTDM_FAIL; - } + } cfg.t.cfg.s.l1PSAP.sockfd = (int32_t)signal_data->dchan->sockfd; - + switch(span->trunk_type) { case FTDM_TRUNK_E1: cfg.t.cfg.s.l1PSAP.type = SNG_L1_TYPE_PRI; @@ -240,9 +240,9 @@ ftdm_status_t sngisdn_stack_cfg_phy_psap(ftdm_span_t *span) default: ftdm_log(FTDM_LOG_ERROR, "%s:Unsupported trunk type %d\n", span->name, span->trunk_type); return FTDM_FAIL; - } - cfg.t.cfg.s.l1PSAP.spId = signal_data->link_id; - + } + cfg.t.cfg.s.l1PSAP.spId = signal_data->link_id; + if (sng_isdn_phy_config(&pst, &cfg)) { return FTDM_FAIL; } @@ -253,25 +253,25 @@ ftdm_status_t sngisdn_stack_cfg_phy_psap(ftdm_span_t *span) ftdm_status_t sngisdn_stack_cfg_q921_gen(void) { BdMngmt cfg; - Pst pst; + Pst pst; - /* initalize the post structure */ - stack_pst_init(&pst); + /* initalize the post structure */ + stack_pst_init(&pst); /* insert the destination Entity */ - pst.dstEnt = ENTLD; + pst.dstEnt = ENTLD; - /*clear the configuration structure*/ - memset(&cfg, 0, sizeof(cfg)); + /*clear the configuration structure*/ + memset(&cfg, 0, sizeof(cfg)); /*fill in some general sections of the header*/ - stack_hdr_init(&cfg.hdr); - - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTLD; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STGEN; - /* fill in the Gen Conf structures internal pst struct */ + stack_hdr_init(&cfg.hdr); + + cfg.hdr.msgType = TCFG; + cfg.hdr.entId.ent = ENTLD; + cfg.hdr.entId.inst = S_INST; + cfg.hdr.elmId.elmnt = STGEN; + /* fill in the Gen Conf structures internal pst struct */ - stack_pst_init(&cfg.t.cfg.s.bdGen.sm); + stack_pst_init(&cfg.t.cfg.s.bdGen.sm); cfg.t.cfg.s.bdGen.sm.dstEnt = ENTSM; /* entity */ @@ -284,8 +284,8 @@ ftdm_status_t sngisdn_stack_cfg_q921_gen(void) #ifdef LAPD_3_4 cfg.t.cfg.s.bdGen.timeRes = 100; /* timer resolution = 1 sec */ #endif - cfg.t.cfg.s.bdGen.poolTrUpper = 2; /* upper pool threshold */ - cfg.t.cfg.s.bdGen.poolTrLower = 1; /* lower pool threshold */ + cfg.t.cfg.s.bdGen.poolTrUpper = 2; /* upper pool threshold */ + cfg.t.cfg.s.bdGen.poolTrLower = 1; /* lower pool threshold */ if (sng_isdn_q921_config(&pst, &cfg)) { return FTDM_FAIL; @@ -296,27 +296,27 @@ ftdm_status_t sngisdn_stack_cfg_q921_gen(void) ftdm_status_t sngisdn_stack_cfg_q921_msap(ftdm_span_t *span) { BdMngmt cfg; - Pst pst; + Pst pst; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; - /* initalize the post structure */ - stack_pst_init(&pst); + /* initalize the post structure */ + stack_pst_init(&pst); /* insert the destination Entity */ - pst.dstEnt = ENTLD; + pst.dstEnt = ENTLD; - /*clear the configuration structure*/ - memset(&cfg, 0, sizeof(cfg)); + /*clear the configuration structure*/ + memset(&cfg, 0, sizeof(cfg)); /*fill in some general sections of the header*/ - stack_hdr_init(&cfg.hdr); + stack_hdr_init(&cfg.hdr); cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTLD; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STMSAP; + cfg.hdr.entId.ent = ENTLD; + cfg.hdr.entId.inst = S_INST; + cfg.hdr.elmId.elmnt = STMSAP; cfg.t.cfg.s.bdMSAP.lnkNmb = signal_data->link_id; - + cfg.t.cfg.s.bdMSAP.maxOutsFrms = 24; /* MAC window */ cfg.t.cfg.s.bdMSAP.tQUpperTrs = 32; /* Tx Queue Upper Threshold */ cfg.t.cfg.s.bdMSAP.tQLowerTrs = 24; /* Tx Queue Lower Threshold */ @@ -328,7 +328,7 @@ ftdm_status_t sngisdn_stack_cfg_q921_msap(ftdm_span_t *span) cfg.t.cfg.s.bdMSAP.route = RTESPEC; /* Route */ cfg.t.cfg.s.bdMSAP.dstProcId = SFndProcId(); /* destination proc id */ cfg.t.cfg.s.bdMSAP.dstEnt = ENTL1; /* entity */ - cfg.t.cfg.s.bdMSAP.dstInst = S_INST; /* instance */ + cfg.t.cfg.s.bdMSAP.dstInst = S_INST; /* instance */ cfg.t.cfg.s.bdMSAP.t201Tmr = 1; /* T201 - should be equal to t200Tmr */ cfg.t.cfg.s.bdMSAP.t202Tmr = 2; /* T202 */ cfg.t.cfg.s.bdMSAP.bndRetryCnt = 2; /* bind retry counter */ @@ -377,7 +377,7 @@ ftdm_status_t sngisdn_stack_cfg_q921_msap(ftdm_span_t *span) if (signal_data->setup_arb == SNGISDN_OPT_TRUE) { cfg.t.cfg.s.bdMSAP.setUpArb = ACTIVE; } else if (signal_data->setup_arb == SNGISDN_OPT_FALSE) { - cfg.t.cfg.s.bdMSAP.setUpArb = PASSIVE; + cfg.t.cfg.s.bdMSAP.setUpArb = PASSIVE; } if (sng_isdn_q921_config(&pst, &cfg)) { @@ -389,24 +389,24 @@ ftdm_status_t sngisdn_stack_cfg_q921_msap(ftdm_span_t *span) ftdm_status_t sngisdn_stack_cfg_q921_dlsap(ftdm_span_t *span, uint8_t management) { BdMngmt cfg; - Pst pst; + Pst pst; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; - /* initalize the post structure */ - stack_pst_init(&pst); + /* initalize the post structure */ + stack_pst_init(&pst); /* insert the destination Entity */ - pst.dstEnt = ENTLD; + pst.dstEnt = ENTLD; - /*clear the configuration structure*/ - memset(&cfg, 0, sizeof(cfg)); + /*clear the configuration structure*/ + memset(&cfg, 0, sizeof(cfg)); /*fill in some general sections of the header*/ - stack_hdr_init(&cfg.hdr); + stack_hdr_init(&cfg.hdr); /*fill in the specific fields of the header*/ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTLD; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STDLSAP; + cfg.hdr.msgType = TCFG; + cfg.hdr.entId.ent = ENTLD; + cfg.hdr.entId.inst = S_INST; + cfg.hdr.elmId.elmnt = STDLSAP; cfg.t.cfg.s.bdDLSAP.lnkNmb = signal_data->link_id; @@ -418,10 +418,10 @@ ftdm_status_t sngisdn_stack_cfg_q921_dlsap(ftdm_span_t *span, uint8_t management } else { cfg.t.cfg.s.bdDLSAP.k = 7; /* k */ } - + cfg.t.cfg.s.bdDLSAP.n200 = 3; /* n200 */ cfg.t.cfg.s.bdDLSAP.congTmr = 300; /* congestion timer */ - cfg.t.cfg.s.bdDLSAP.t200Tmr = 1; /* t1 changed from 25 */ + cfg.t.cfg.s.bdDLSAP.t200Tmr = 1; /* t1 changed from 25 */ cfg.t.cfg.s.bdDLSAP.t203Tmr = 10; /* t3 changed from 50 */ cfg.t.cfg.s.bdDLSAP.mod = 128; /* modulo */ cfg.t.cfg.s.bdDLSAP.selector = 0; /* Selector 0 */ @@ -471,28 +471,28 @@ ftdm_status_t sngisdn_stack_cfg_q921_dlsap(ftdm_span_t *span, uint8_t management ftdm_status_t sngisdn_stack_cfg_q931_gen(void) { InMngmt cfg; - Pst pst; + Pst pst; - /* initalize the post structure */ - stack_pst_init(&pst); + /* initalize the post structure */ + stack_pst_init(&pst); - /* insert the destination Entity */ - pst.dstEnt = ENTIN; + /* insert the destination Entity */ + pst.dstEnt = ENTIN; - /*clear the configuration structure*/ + /*clear the configuration structure*/ memset(&cfg, 0, sizeof(cfg)); - /*fill in some general sections of the header*/ - stack_hdr_init(&cfg.hdr); + /*fill in some general sections of the header*/ + stack_hdr_init(&cfg.hdr); - /*fill in the specific fields of the header*/ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTIN; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STGEN; + /*fill in the specific fields of the header*/ + cfg.hdr.msgType = TCFG; + cfg.hdr.entId.ent = ENTIN; + cfg.hdr.entId.inst = S_INST; + cfg.hdr.elmId.elmnt = STGEN; - /* fill in the Gen Conf structures internal pst struct */ - stack_pst_init(&cfg.t.cfg.s.inGen.sm); + /* fill in the Gen Conf structures internal pst struct */ + stack_pst_init(&cfg.t.cfg.s.inGen.sm); cfg.t.cfg.s.inGen.nmbSaps = MAX_VARIANTS+1; /* Total number of variants supported */ @@ -526,26 +526,26 @@ ftdm_status_t sngisdn_stack_cfg_q931_gen(void) ftdm_status_t sngisdn_stack_cfg_q931_tsap(ftdm_span_t *span) { InMngmt cfg; - Pst pst; + Pst pst; unsigned i; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; - /* initalize the post structure */ - stack_pst_init(&pst); + /* initalize the post structure */ + stack_pst_init(&pst); - /* insert the destination Entity */ - pst.dstEnt = ENTIN; + /* insert the destination Entity */ + pst.dstEnt = ENTIN; - /*clear the configuration structure*/ + /*clear the configuration structure*/ memset(&cfg, 0, sizeof(cfg)); - /*fill in some general sections of the header*/ - stack_hdr_init(&cfg.hdr); + /*fill in some general sections of the header*/ + stack_hdr_init(&cfg.hdr); - /*fill in the specific fields of the header*/ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTIN; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STTSAP; + /*fill in the specific fields of the header*/ + cfg.hdr.msgType = TCFG; + cfg.hdr.entId.ent = ENTIN; + cfg.hdr.entId.inst = S_INST; + cfg.hdr.elmId.elmnt = STTSAP; cfg.t.cfg.s.inTSAP.sapId = signal_data->cc_id; @@ -589,31 +589,31 @@ ftdm_status_t sngisdn_stack_cfg_q931_tsap(ftdm_span_t *span) ftdm_status_t sngisdn_stack_cfg_q931_dlsap(ftdm_span_t *span) { InMngmt cfg; - Pst pst; + Pst pst; unsigned i; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; - /* initalize the post structure */ - stack_pst_init(&pst); + /* initalize the post structure */ + stack_pst_init(&pst); - /* insert the destination Entity */ - pst.dstEnt = ENTIN; + /* insert the destination Entity */ + pst.dstEnt = ENTIN; - /*clear the configuration structure*/ + /*clear the configuration structure*/ memset(&cfg, 0, sizeof(cfg)); - /*fill in some general sections of the header*/ - stack_hdr_init(&cfg.hdr); + /*fill in some general sections of the header*/ + stack_hdr_init(&cfg.hdr); + + /*fill in the specific fields of the header*/ + cfg.hdr.msgType = TCFG; + cfg.hdr.entId.ent = ENTIN; + cfg.hdr.entId.inst = S_INST; + cfg.hdr.elmId.elmnt = STDLSAP; - /*fill in the specific fields of the header*/ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTIN; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STDLSAP; - cfg.hdr.response.selector=0; - + cfg.t.cfg.s.inDLSAP.sapId = signal_data->link_id; cfg.t.cfg.s.inDLSAP.spId = signal_data->link_id; cfg.t.cfg.s.inDLSAP.swtch = sng_isdn_stack_switchtype(signal_data->switchtype); @@ -659,7 +659,7 @@ ftdm_status_t sngisdn_stack_cfg_q931_dlsap(ftdm_span_t *span) cfg.t.cfg.s.inDLSAP.ctldInt[1] = 1; } - cfg.t.cfg.s.inDLSAP.numRstInd = 255; + cfg.t.cfg.s.inDLSAP.numRstInd = 255; cfg.t.cfg.s.inDLSAP.relOpt = TRUE; #ifdef ISDN_SRV cfg.t.cfg.s.inDLSAP.bcas = FALSE; @@ -839,36 +839,36 @@ ftdm_status_t sngisdn_stack_cfg_q931_dlsap(ftdm_span_t *span) ftdm_status_t sngisdn_stack_cfg_q931_lce(ftdm_span_t *span) { InMngmt cfg; - Pst pst; + Pst pst; uint8_t i; - uint8_t numCes=1; + uint8_t numCes=1; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; if (span->trunk_type == FTDM_TRUNK_BRI_PTMP && signal_data->signalling == SNGISDN_SIGNALING_NET) { numCes = 8; } - /* initalize the post structure */ - stack_pst_init(&pst); + /* initalize the post structure */ + stack_pst_init(&pst); - /* insert the destination Entity */ - pst.dstEnt = ENTIN; + /* insert the destination Entity */ + pst.dstEnt = ENTIN; - /*clear the configuration structure*/ + /*clear the configuration structure*/ memset(&cfg, 0, sizeof(cfg)); - /*fill in some general sections of the header*/ - stack_hdr_init(&cfg.hdr); + /*fill in some general sections of the header*/ + stack_hdr_init(&cfg.hdr); - /*fill in the specific fields of the header*/ - cfg.hdr.msgType = TCFG; - cfg.hdr.entId.ent = ENTIN; - cfg.hdr.entId.inst = S_INST; - cfg.hdr.elmId.elmnt = STDLC; + /*fill in the specific fields of the header*/ + cfg.hdr.msgType = TCFG; + cfg.hdr.entId.ent = ENTIN; + cfg.hdr.entId.inst = S_INST; + cfg.hdr.elmId.elmnt = STDLC; cfg.hdr.response.selector=0; cfg.t.cfg.s.inLCe.sapId = signal_data->link_id; - + cfg.t.cfg.s.inLCe.lnkUpDwnInd = TRUE; cfg.t.cfg.s.inLCe.tCon.enb = TRUE; @@ -877,7 +877,7 @@ ftdm_status_t sngisdn_stack_cfg_q931_lce(ftdm_span_t *span) cfg.t.cfg.s.inLCe.tDisc.val = 35; cfg.t.cfg.s.inLCe.t314.enb = FALSE; /* if segmentation enabled, set to TRUE */ cfg.t.cfg.s.inLCe.t314.val = 35; - + cfg.t.cfg.s.inLCe.t332i.enb = FALSE; /* set to TRUE for NFAS */ #ifdef NFAS @@ -897,7 +897,6 @@ ftdm_status_t sngisdn_stack_cfg_q931_lce(ftdm_span_t *span) cfg.t.cfg.s.inLCe.tRstAck.enb = TRUE; cfg.t.cfg.s.inLCe.tRstAck.val = 10; - cfg.t.cfg.s.inLCe.usid = 0; cfg.t.cfg.s.inLCe.tid = 0; @@ -983,11 +982,11 @@ ftdm_status_t sngisdn_stack_cfg_cc_sap(ftdm_span_t *span) cfg.t.cfg.s.ccISAP.pst.dstInst = S_INST; cfg.t.cfg.s.ccISAP.pst.dstProcId = SFndProcId(); - cfg.t.cfg.s.ccISAP.pst.prior = PRIOR0; - cfg.t.cfg.s.ccISAP.pst.route = RTESPEC; - cfg.t.cfg.s.ccISAP.pst.region = S_REG; - cfg.t.cfg.s.ccISAP.pst.pool = S_POOL; - cfg.t.cfg.s.ccISAP.pst.selector = 0; + cfg.t.cfg.s.ccISAP.pst.prior = PRIOR0; + cfg.t.cfg.s.ccISAP.pst.route = RTESPEC; + cfg.t.cfg.s.ccISAP.pst.region = S_REG; + cfg.t.cfg.s.ccISAP.pst.pool = S_POOL; + cfg.t.cfg.s.ccISAP.pst.selector = 0; cfg.t.cfg.s.ccISAP.suId = signal_data->cc_id; cfg.t.cfg.s.ccISAP.spId = signal_data->cc_id; @@ -1005,19 +1004,19 @@ ftdm_status_t sngisdn_stack_cfg_cc_sap(ftdm_span_t *span) void stack_pst_init(Pst *pst) { memset(pst, 0, sizeof(Pst)); - /*fill in the post structure*/ - pst->dstProcId = SFndProcId(); - pst->dstInst = S_INST; - - pst->srcProcId = SFndProcId(); - pst->srcEnt = ENTSM; - pst->srcInst = S_INST; - - pst->prior = PRIOR0; - pst->route = RTESPEC; - pst->region = S_REG; - pst->pool = S_POOL; - pst->selector = 0; + /*fill in the post structure*/ + pst->dstProcId = SFndProcId(); + pst->dstInst = S_INST; + + pst->srcProcId = SFndProcId(); + pst->srcEnt = ENTSM; + pst->srcInst = S_INST; + + pst->prior = PRIOR0; + pst->route = RTESPEC; + pst->region = S_REG; + pst->pool = S_POOL; + pst->selector = 0; return; } @@ -1026,21 +1025,21 @@ void stack_pst_init(Pst *pst) void stack_hdr_init(Header *hdr) { hdr->msgType = 0; - hdr->msgLen = 0; - hdr->entId.ent = 0; - hdr->entId.inst = 0; - hdr->elmId.elmnt = 0; - hdr->elmId.elmntInst1 = 0; - hdr->elmId.elmntInst2 = 0; - hdr->elmId.elmntInst3 = 0; - hdr->seqNmb = 0; - hdr->version = 0; - hdr->response.prior = PRIOR0; - hdr->response.route = RTESPEC; - hdr->response.mem.region = S_REG; - hdr->response.mem.pool = S_POOL; - hdr->transId = 0; - hdr->response.selector = 0; + hdr->msgLen = 0; + hdr->entId.ent = 0; + hdr->entId.inst = 0; + hdr->elmId.elmnt = 0; + hdr->elmId.elmntInst1 = 0; + hdr->elmId.elmntInst2 = 0; + hdr->elmId.elmntInst3 = 0; + hdr->seqNmb = 0; + hdr->version = 0; + hdr->response.prior = PRIOR0; + hdr->response.route = RTESPEC; + hdr->response.mem.region = S_REG; + hdr->response.mem.pool = S_POOL; + hdr->transId = 0; + hdr->response.selector = 0; return; } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index c0ee11d..94bd6e2 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -595,16 +595,65 @@ void sngisdn_snd_release(ftdm_channel_t *ftdmchan, uint8_t glare) return; } -void sngisdn_snd_data(ftdm_span_t *span, uint8_t *data, ftdm_size_t len) +/* We received an incoming frame on the d-channel, send data to the stack */ +void sngisdn_snd_data(ftdm_channel_t *dchan, uint8_t *data, ftdm_size_t len) { - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data; - sng_isdn_data_ind(signal_data->link_id, data, len); + l1_frame_t l1_frame; + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) dchan->span->signal_data; + + memset(&l1_frame, 0, sizeof(l1_frame)); + l1_frame.len = len; + + memcpy(&l1_frame.data, data, len); + + if (ftdm_test_flag(&(dchan->iostats.s.rx), FTDM_IOSTATS_ERROR_CRC)) { + l1_frame.flags |= SNG_L1FRAME_ERROR_CRC; + } + + if (ftdm_test_flag(&(dchan->iostats.s.rx), FTDM_IOSTATS_ERROR_FRAME)) { + l1_frame.flags |= SNG_L1FRAME_ERROR_FRAME; + } + + if (ftdm_test_flag(&(dchan->iostats.s.rx), FTDM_IOSTATS_ERROR_ABORT)) { + l1_frame.flags |= SNG_L1FRAME_ERROR_ABORT; + } + + if (ftdm_test_flag(&(dchan->iostats.s.rx), FTDM_IOSTATS_ERROR_FIFO)) { + l1_frame.flags |= SNG_L1FRAME_ERROR_FIFO; + } + + if (ftdm_test_flag(&(dchan->iostats.s.rx), FTDM_IOSTATS_ERROR_DMA)) { + l1_frame.flags |= SNG_L1FRAME_ERROR_DMA; + } + + if (ftdm_test_flag(&(dchan->iostats.s.rx), FTDM_IOSTATS_QUEUE_THRES)) { + /* Should we trigger congestion here? */ + l1_frame.flags |= SNG_L1FRAME_QUEUE_THRES; + } + + if (ftdm_test_flag(&(dchan->iostats.s.rx), FTDM_IOSTATS_QUEUE_FULL)) { + /* Should we trigger congestion here? */ + l1_frame.flags |= SNG_L1FRAME_QUEUE_FULL; + } + + sng_isdn_data_ind(signal_data->link_id, &l1_frame); } -void sngisdn_snd_event(ftdm_span_t *span, sng_isdn_l1_event_t l1_event) -{ - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data; - sng_isdn_event_ind(signal_data->link_id, l1_event); +void sngisdn_snd_event(ftdm_channel_t *dchan, ftdm_oob_event_t event) +{ + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) dchan->span->signal_data; + switch(event) { + case FTDM_OOB_ALARM_CLEAR: + sng_isdn_event_ind(signal_data->link_id, SNG_L1EVENT_ALARM_OFF); + break; + case FTDM_OOB_ALARM_TRAP: + sng_isdn_event_ind(signal_data->link_id, SNG_L1EVENT_ALARM_ON); + break; + default: + /* We do not care about the other OOB events for now */ + return; + } + return; } diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index f40f2b2..d6573ac 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -170,7 +170,7 @@ static __inline__ sng_fd_t tdmv_api_open_span_chan(int span, int chan) static __inline__ sng_fd_t __tdmv_api_open_span_chan(int span, int chan) { return __sangoma_open_tdmapi_span_chan(span, chan); -} +} #endif static ftdm_io_interface_t wanpipe_interface; @@ -759,6 +759,49 @@ static FIO_COMMAND_FUNCTION(wanpipe_command) return FTDM_SUCCESS; } +static void wanpipe_read_stats(ftdmchan, wp_tdm_api_rx_hdr_t *rx_stats) +{ + ftdmchan->iostats.s.rx.error_flags = 0; + if (rx_stats->rx_hdr_errors) { + wanpipe_reset_stats(ftdmchan); + ftdm_log_chan_msg_throttle(ftdmchan, "IO errors\n"); + } + + ftdmchan->iostats.s.rx_queue_size = rx_stats->rx_h.rx_h.max_rx_queue_length; + ftdmchan->iostats.s.rx_queue_len = rx_stats->rx_h.current_number_of_frames_in_rx_queue; + + if (rx_stats->rx_h.wp_api_rx_hdr_error_map & (1<<WP_ABORT_ERROR_BIT)) { + ftdm_set_flag(&(ftdmchan->iostats.s.rx), FTDM_IOSTATS_ERROR_ABORT); + } + if (rx_stats->rx_h.wp_api_rx_hdr_error_map & (1<<WP_DMA_ERROR_BIT)) { + ftdm_set_flag(&(ftdmchan->iostats.s.rx), FTDM_IOSTATS_ERROR_DMA); + } + if (rx_stats->rx_h.wp_api_rx_hdr_error_map & (1<<WP_FIFO_ERROR_BIT)) { + ftdm_set_flag(&(ftdmchan->iostats.s.rx), FTDM_IOSTATS_ERROR_FIFO); + } + if (rx_stats->rx_h.wp_api_rx_hdr_error_map & (1<<WP_CRC_ERROR_BIT)) { + ftdm_set_flag(&(ftdmchan->iostats.s.rx), FTDM_IOSTATS_ERROR_CRC); + } + if (rx_stats->rx_h.wp_api_rx_hdr_error_map & (1<<WP_FRAME_ERROR_BIT)) { + ftdm_set_flag(&(ftdmchan->iostats.s.rx), FTDM_IOSTATS_ERROR_FRAME); + } + + if (ftdmchan->iostats.s.rx_queue_len >= (0.8*ftdmchan->iostats.s.rx_queue_size)) { + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Rx Queue length exceeded threshold (%d/%d)\n", + ftdmchan->iostats.s.rx_queue_len, ftdmchan->iostats.s.rx_queue_size); + + ftdm_set_flag(&(ftdmchan->iostats.s.rx), FTDM_IOSTATS_ERROR_QUEUE_THRES); + } + + if (ftdmchan->iostats.s.rx_queue_len >= ftdmchan->iostats.s.rx_queue_size) { + ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Rx Queue Full (%d/%d)\n", + ftdmchan->iostats.s.rx_queue_len, ftdmchan->iostats.s.rx_queue_size); + + ftdm_set_flag(&(ftdmchan->iostats.s.rx), FTDM_IOSTATS_ERROR_QUEUE_FULL); + } + return; +} + /** * \brief Reads data from a Wanpipe channel * \param ftdmchan Channel to read from @@ -787,9 +830,11 @@ static FIO_READ_FUNCTION(wanpipe_read) snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "%s", strerror(errno)); ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Failed to read from sangoma device: %s (%d)\n", strerror(errno), rx_len); return FTDM_FAIL; - } - + } + if (ftdm_channel_test_feature(ftdmchan, FTDM_CHANNEL_FEATURE_IO_STATS)) { + wanpipe_read_stats(ftdmchan, &hdrframe); + } return FTDM_SUCCESS; } diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index c5f3c4b..6cbf589 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -357,6 +357,7 @@ typedef struct { } ftdm_dtmf_debug_t; #endif + typedef struct { const char *file; const char *func; @@ -366,6 +367,33 @@ typedef struct { ftdm_time_t time; } ftdm_channel_history_entry_t; +typedef enum { + FTDM_IOSTATS_ERROR_CRC = (1<<0), + FTDM_IOSTATS_ERROR_FRAME = (1<<1), + FTDM_IOSTATS_ERROR_ABORT = (1<<2), + FTDM_IOSTATS_ERROR_FIFO = (1<<3), + FTDM_IOSTATS_ERROR_DMA = (1<<4), + FTDM_IOSTATS_ERROR_QUEUE_THRES = (1<<5), /* Queue reached high threshold */ + FTDM_IOSTATS_ERROR_QUEUE_FULL = (1<<6), /* Queue is full */ +} ftdm_iostats_error_type_t; + +typedef struct { + union { + struct { + uint32_t errors; + uint16_t flags; + uint8_t rx_queue_size; /* max queue size configured */ + uint8_t rx_queue_len; /* Current number of elements in queue */ + } rx; + struct { + uint32_t errors; + uint16_t flags; + uint8_t tx_queue_size; /* max queue size configured */ + uint8_t tx_queue_len; /* Current number of elements in queue */ + } tx; + } s; +} ftdm_channel_iostats_t; + /* 2^8 table size, one for each byte (sample) value */ #define FTDM_GAINS_TABLE_SIZE 256 struct ftdm_channel { @@ -438,6 +466,7 @@ struct ftdm_channel { int availability_rate; void *user_private; ftdm_timer_id_t hangup_timer; + ftdm_channel_iostats_t iostats; #ifdef FTDM_DEBUG_DTMF ftdm_dtmf_debug_t dtmfdbg; #endif @@ -632,10 +661,21 @@ FT_DECLARE(void) ftdm_channel_clear_detected_tones(ftdm_channel_t *ftdmchan); #define ftdm_channel_lock(chan) ftdm_mutex_lock(chan->mutex) #define ftdm_channel_unlock(chan) ftdm_mutex_unlock(chan->mutex) + +#define ftdm_log_throttle(level, ...) \ + time_current_throttle_log = ftdm_current_time_in_ms(); \ + if (time_current_throttle_log - time_last_throttle_log > FTDM_THROTTLE_LOG_INTERVAL) {\ + ftdm_log(level, __VA_ARGS__); \ + time_last_throttle_log = time_current_throttle_log; \ + } + #define ftdm_log_chan_ex(fchan, file, func, line, level, format, ...) ftdm_log(file, func, line, level, "[s%dc%d][%d:%d] " format, fchan->span_id, fchan->chan_id, fchan->physical_span_id, fchan->physical_chan_id, __VA_ARGS__) #define ftdm_log_chan(fchan, level, format, ...) ftdm_log(level, "[s%dc%d][%d:%d] " format, fchan->span_id, fchan->chan_id, fchan->physical_span_id, fchan->physical_chan_id, __VA_ARGS__) #define ftdm_log_chan_msg(fchan, level, msg) ftdm_log(level, "[s%dc%d][%d:%d] " msg, fchan->span_id, fchan->chan_id, fchan->physical_span_id, fchan->physical_chan_id) +#define ftdm_log_chan_throttle(fchan, level, format, ...) ftdm_log_throttle(level, "[s%dc%d][%d:%d] " format, fchan->span_id, fchan->chan_id, fchan->physical_span_id, fchan->physical_chan_id, __VA_ARGS__) +#define ftdm_log_chan_msg_throttle(fchan, level, format, ...) ftdm_log_throttle(level, "[s%dc%d][%d:%d] " format, fchan->span_id, fchan->chan_id, fchan->physical_span_id, fchan->physical_chan_id, __VA_ARGS__) + #define ftdm_span_lock(span) ftdm_mutex_lock(span->mutex) #define ftdm_span_unlock(span) ftdm_mutex_unlock(span->mutex) commit f3e55a26ef069a6ba5c3574b6c31a00d0299bbec Merge: d7a136c 97c65a0 Author: Moises Silva <moy@sangoma.com> Date: Mon Nov 15 14:00:49 2010 -0500 Merge remote branch 'fsorig/master' Conflicts: libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c diff --cc libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index e269809,124cd96..cb508a5 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@@ -34,11 -34,14 +34,13 @@@ #include "ftmod_sangoma_isdn.h" - extern ftdm_status_t cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm); - extern ftdm_status_t cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm); - extern ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan); - + void sngisdn_snd_setup(ftdm_channel_t *ftdmchan); + void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan); + void sngisdn_snd_progress(ftdm_channel_t *ftdmchan); + void sngisdn_snd_connect(ftdm_channel_t *ftdmchan); + void sngisdn_snd_disconnect(ftdm_channel_t *ftdmchan); + void sngisdn_snd_release(ftdm_channel_t *ftdmchan, uint8_t glare); - void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) { ConEvnt conEvnt; commit 97c65a004ee9e9b88dad7ff4ac1b2ec893b8c5ba Author: Jeff Lenk <jeff@jefflenk.com> Date: Mon Nov 15 12:22:09 2010 -0600 reswig diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx index c55a6d6..4a0b52e 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make @@ -11634,6 +11634,108 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_isxdigit(int jarg1) { } +SWIGEXPORT void SWIGSTDCALL CSharp_ip_t_v4_set(void * jarg1, unsigned long jarg2) { + ip_t *arg1 = (ip_t *) 0 ; + uint32_t arg2 ; + + arg1 = (ip_t *)jarg1; + arg2 = (uint32_t)jarg2; + if (arg1) (arg1)->v4 = arg2; +} + + +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_ip_t_v4_get(void * jarg1) { + unsigned long jresult ; + ip_t *arg1 = (ip_t *) 0 ; + uint32_t result; + + arg1 = (ip_t *)jarg1; + result = (uint32_t) ((arg1)->v4); + jresult = (unsigned long)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_ip_t_v6_set(void * jarg1, void * jarg2) { + ip_t *arg1 = (ip_t *) 0 ; + in6_addr arg2 ; + in6_addr *argp2 ; + + arg1 = (ip_t *)jarg1; + argp2 = (in6_addr *)jarg2; + if (!argp2) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null in6_addr", 0); + return ; + } + arg2 = *argp2; + if (arg1) (arg1)->v6 = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_ip_t_v6_get(void * jarg1) { + void * jresult ; + ip_t *arg1 = (ip_t *) 0 ; + in6_addr result; + + arg1 = (ip_t *)jarg1; + result = ((arg1)->v6); + jresult = new in6_addr((const in6_addr &)result); + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_new_ip_t() { + void * jresult ; + ip_t *result = 0 ; + + result = (ip_t *)new ip_t(); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_delete_ip_t(void * jarg1) { + ip_t *arg1 = (ip_t *) 0 ; + + arg1 = (ip_t *)jarg1; + delete arg1; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_testv6_subnet(void * jarg1, void * jarg2, void * jarg3) { + int jresult ; + ip_t arg1 ; + ip_t arg2 ; + ip_t arg3 ; + ip_t *argp1 ; + ip_t *argp2 ; + ip_t *argp3 ; + switch_bool_t result; + + argp1 = (ip_t *)jarg1; + if (!argp1) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null ip_t", 0); + return 0; + } + arg1 = *argp1; + argp2 = (ip_t *)jarg2; + if (!argp2) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null ip_t", 0); + return 0; + } + arg2 = *argp2; + argp3 = (ip_t *)jarg3; + if (!argp3) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null ip_t", 0); + return 0; + } + arg3 = *argp3; + result = (switch_bool_t)switch_testv6_subnet(arg1,arg2,arg3); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_SMAX_get() { int jresult ; int result; @@ -12589,14 +12691,14 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_file_path(char * jarg1) { SWIGEXPORT int SWIGSTDCALL CSharp_switch_parse_cidr(char * jarg1, void * jarg2, void * jarg3, void * jarg4) { int jresult ; char *arg1 = (char *) 0 ; - uint32_t *arg2 = (uint32_t *) 0 ; - uint32_t *arg3 = (uint32_t *) 0 ; + ip_t *arg2 = (ip_t *) 0 ; + ip_t *arg3 = (ip_t *) 0 ; uint32_t *arg4 = (uint32_t *) 0 ; int result; arg1 = (char *)jarg1; - arg2 = (uint32_t *)jarg2; - arg3 = (uint32_t *)jarg3; + arg2 = (ip_t *)jarg2; + arg3 = (ip_t *)jarg3; arg4 = (uint32_t *)jarg4; result = (int)switch_parse_cidr((char const *)arg1,arg2,arg3,arg4); jresult = result; @@ -12674,6 +12776,28 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_network_list_validate_ip_token(void * j } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_network_list_validate_ip6_token(void * jarg1, void * jarg2, void * jarg3) { + int jresult ; + switch_network_list_t *arg1 = (switch_network_list_t *) 0 ; + ip_t arg2 ; + char **arg3 = (char **) 0 ; + ip_t *argp2 ; + switch_bool_t result; + + arg1 = (switch_network_list_t *)jarg1; + argp2 = (ip_t *)jarg2; + if (!argp2) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null ip_t", 0); + return 0; + } + arg2 = *argp2; + arg3 = (char **)jarg3; + result = (switch_bool_t)switch_network_list_validate_ip6_token(arg1,arg2,(char const **)arg3); + jresult = result; + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_switch_dow_int2str(int jarg1) { char * jresult ; int arg1 ; diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs index 8c307fc..2897fef 100644 --- a/src/mod/languages/mod_managed/managed/swig.2010.cs +++ b/src/mod/languages/mod_managed/managed/swig.2010.cs @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -64,7 +64,7 @@ public class Api : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -80,7 +80,7 @@ public enum cache_db_flag_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -432,7 +432,7 @@ public class CoreSession : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -448,7 +448,7 @@ public enum dm_match_type_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -517,7 +517,7 @@ public class DTMF : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -532,7 +532,7 @@ public enum dtmf_flag_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -660,7 +660,7 @@ public partial class Event : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -792,7 +792,7 @@ public class EventConsumer : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -2653,6 +2653,12 @@ public class freeswitch { return ret; } + public static switch_bool_t switch_testv6_subnet(ip_t _ip, ip_t _net, ip_t _mask) { + switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_testv6_subnet(ip_t.getCPtr(_ip), ip_t.getCPtr(_net), ip_t.getCPtr(_mask)); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + public static int _zstr(string s) { int ret = freeswitchPINVOKE._zstr(s); return ret; @@ -2959,8 +2965,8 @@ public class freeswitch { return ret; } - public static int switch_parse_cidr(string arg0, SWIGTYPE_p_unsigned_long ip, SWIGTYPE_p_unsigned_long mask, SWIGTYPE_p_unsigned_long bitp) { - int ret = freeswitchPINVOKE.switch_parse_cidr(arg0, SWIGTYPE_p_unsigned_long.getCPtr(ip), SWIGTYPE_p_unsigned_long.getCPtr(mask), SWIGTYPE_p_unsigned_long.getCPtr(bitp)); + public static int switch_parse_cidr(string arg0, ip_t ip, ip_t mask, SWIGTYPE_p_unsigned_long bitp) { + int ret = freeswitchPINVOKE.switch_parse_cidr(arg0, ip_t.getCPtr(ip), ip_t.getCPtr(mask), SWIGTYPE_p_unsigned_long.getCPtr(bitp)); return ret; } @@ -2984,6 +2990,12 @@ public class freeswitch { return ret; } + public static switch_bool_t switch_network_list_validate_ip6_token(SWIGTYPE_p_switch_network_list list, ip_t ip, ref string token) { + switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_network_list_validate_ip6_token(SWIGTYPE_p_switch_network_list.getCPtr(list), ip_t.getCPtr(ip), ref token); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + public static string switch_dow_int2str(int val) { string ret = freeswitchPINVOKE.switch_dow_int2str(val); return ret; @@ -5437,7 +5449,7 @@ public class freeswitch { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -8444,6 +8456,27 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_isxdigit")] public static extern int switch_isxdigit(int jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_ip_t_v4_set")] + public static extern void ip_t_v4_set(HandleRef jarg1, uint jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_ip_t_v4_get")] + public static extern uint ip_t_v4_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_ip_t_v6_set")] + public static extern void ip_t_v6_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_ip_t_v6_get")] + public static extern IntPtr ip_t_v6_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_new_ip_t")] + public static extern IntPtr new_ip_t(); + + [DllImport("mod_managed", EntryPoint="CSharp_delete_ip_t")] + public static extern void delete_ip_t(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_testv6_subnet")] + public static extern int switch_testv6_subnet(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SMAX_get")] public static extern int SWITCH_SMAX_get(); @@ -8642,6 +8675,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_network_list_validate_ip_token")] public static extern int switch_network_list_validate_ip_token(HandleRef jarg1, uint jarg2, ref string jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_network_list_validate_ip6_token")] + public static extern int switch_network_list_validate_ip6_token(HandleRef jarg1, HandleRef jarg2, ref string jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_dow_int2str")] public static extern string switch_dow_int2str(int jarg1); @@ -13698,7 +13734,7 @@ class freeswitchPINVOKE { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -13790,7 +13826,78 @@ public class input_callback_state_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + +public class ip_t : IDisposable { + private HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal ip_t(IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new HandleRef(this, cPtr); + } + + internal static HandleRef getCPtr(ip_t obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } + + ~ip_t() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if (swigCPtr.Handle != IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_ip_t(swigCPtr); + } + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + GC.SuppressFinalize(this); + } + } + + public uint v4 { + set { + freeswitchPINVOKE.ip_t_v4_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.ip_t_v4_get(swigCPtr); + return ret; + } + } + + public SWIGTYPE_p_in6_addr v6 { + set { + freeswitchPINVOKE.ip_t_v6_set(swigCPtr, SWIGTYPE_p_in6_addr.getCPtr(value)); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + } + get { + SWIGTYPE_p_in6_addr ret = new SWIGTYPE_p_in6_addr(freeswitchPINVOKE.ip_t_v6_get(swigCPtr), true); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public ip_t() : this(freeswitchPINVOKE.new_ip_t(), true) { + } + +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -13847,7 +13954,7 @@ public class IvrMenu : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -13901,7 +14008,7 @@ public partial class ManagedSession : CoreSession { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -13918,7 +14025,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -13979,7 +14086,7 @@ public partial class Stream : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14009,7 +14116,7 @@ public class SWIGTYPE_p_apr_pool_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14039,7 +14146,7 @@ public class SWIGTYPE_p_FILE { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14069,7 +14176,7 @@ public class SWIGTYPE_p_float { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14099,7 +14206,7 @@ public class SWIGTYPE_p_f_p_char_enum_switch_management_action_t_p_char_switch_s } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14129,7 +14236,7 @@ public class SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_ } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14159,7 +14266,7 @@ public class SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__swi } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14189,7 +14296,7 @@ public class SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_p_switch_console_cal } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14219,7 +14326,7 @@ public class SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_co } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14249,7 +14356,7 @@ public class SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_co } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14279,7 +14386,7 @@ public class SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_unsigned_long__int { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14309,7 +14416,7 @@ public class SWIGTYPE_p_f_p_q_const__char_p_q_const__char__switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14339,7 +14446,7 @@ public class SWIGTYPE_p_f_p_q_const__char_p_switch_codec_fmtp__switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14369,7 +14476,7 @@ public class SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_ } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14399,7 +14506,7 @@ public class SWIGTYPE_p_f_p_q_const__switch_log_node_t_enum_switch_log_level_t__ } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14429,7 +14536,7 @@ public class SWIGTYPE_p_f_p_q_const__void_p_q_const__void_p_void__switch_bool_t } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14459,7 +14566,7 @@ public class SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14489,7 +14596,7 @@ public class SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14519,7 +14626,7 @@ public class SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14549,7 +14656,7 @@ public class SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_s } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14579,7 +14686,7 @@ public class SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__cha } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14609,7 +14716,7 @@ public class SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__s } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14639,7 +14746,7 @@ public class SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14669,7 +14776,7 @@ public class SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14699,7 +14806,7 @@ public class SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_lon } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14729,7 +14836,7 @@ public class SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14759,7 +14866,7 @@ public class SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_uns } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14789,7 +14896,7 @@ public class SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_s } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14819,7 +14926,7 @@ public class SWIGTYPE_p_f_p_switch_codec__switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14849,7 +14956,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14879,7 +14986,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_char_p_switch_say_args_t_p_swi } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14909,7 +15016,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_i } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14939,7 +15046,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_q_const__char_p_q_const__char_ } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14969,7 +15076,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_q_const__char_p_q_const__char_ } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -14999,7 +15106,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_q_const__char_p_q_const__char_ } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15029,7 +15136,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15059,7 +15166,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_sw } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15089,7 +15196,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t__switch } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15119,7 +15226,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__s } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15149,7 +15256,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_p } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15179,7 +15286,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_p } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15209,7 +15316,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15239,7 +15346,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_p_void__switch_st } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15269,7 +15376,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15299,7 +15406,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_ } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15329,7 +15436,7 @@ public class SWIGTYPE_p_f_p_switch_core_session_t_p_void_p_switch_caller_profile } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15359,7 +15466,7 @@ public class SWIGTYPE_p_f_p_switch_core_session__switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15389,7 +15496,7 @@ public class SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char_p_char__switch } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15419,7 +15526,7 @@ public class SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char__switch_status } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15449,7 +15556,7 @@ public class SWIGTYPE_p_f_p_switch_directory_handle_p_p_char_p_p_char__switch_st } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15479,7 +15586,7 @@ public class SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15509,7 +15616,7 @@ public class SWIGTYPE_p_f_p_switch_event__void { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15539,7 +15646,7 @@ public class SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_con } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15569,7 +15676,7 @@ public class SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15599,7 +15706,7 @@ public class SWIGTYPE_p_f_p_switch_file_handle_long_long__switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15629,7 +15736,7 @@ public class SWIGTYPE_p_f_p_switch_file_handle_p_q_const__char__switch_status_t } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15659,7 +15766,7 @@ public class SWIGTYPE_p_f_p_switch_file_handle_p_unsigned_int_long_long_int__swi } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15689,7 +15796,7 @@ public class SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_st } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15719,7 +15826,7 @@ public class SWIGTYPE_p_f_p_switch_file_handle__switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15749,7 +15856,7 @@ public class SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15779,7 +15886,7 @@ public class SWIGTYPE_p_f_p_switch_ivr_menu_p_char_p_char_size_t_p_void__switch_ } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15809,7 +15916,7 @@ public class SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__swit } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15839,7 +15946,7 @@ public class SWIGTYPE_p_f_p_switch_rtp_p_switch_socket_t_p_void_switch_size_t_p_ } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15869,7 +15976,7 @@ public class SWIGTYPE_p_f_p_switch_scheduler_task__void { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15899,7 +16006,7 @@ public class SWIGTYPE_p_f_p_switch_speech_handle_p_char_double__void { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15929,7 +16036,7 @@ public class SWIGTYPE_p_f_p_switch_speech_handle_p_char_int__void { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15959,7 +16066,7 @@ public class SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_q_const__char__void { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -15989,7 +16096,7 @@ public class SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_ } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16019,7 +16126,7 @@ public class SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_unsigned_ } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16049,7 +16156,7 @@ public class SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__switch_status_ } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16079,7 +16186,7 @@ public class SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsign } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16109,7 +16216,7 @@ public class SWIGTYPE_p_f_p_switch_speech_handle__void { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16139,7 +16246,7 @@ public class SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______switch_ } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16169,7 +16276,7 @@ public class SWIGTYPE_p_f_p_switch_stream_handle_p_unsigned_char_switch_size_t__ } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16199,7 +16306,7 @@ public class SWIGTYPE_p_f_p_switch_thread_t_p_void__p_void { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16229,7 +16336,7 @@ public class SWIGTYPE_p_f_p_switch_timer_enum_switch_bool_t__switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16259,7 +16366,7 @@ public class SWIGTYPE_p_f_p_switch_timer__switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16289,7 +16396,7 @@ public class SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16319,7 +16426,7 @@ public class SWIGTYPE_p_f_p_void_p_q_const__char__int { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16349,7 +16456,7 @@ public class SWIGTYPE_p_f_p_void__void { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16379,7 +16486,7 @@ public class SWIGTYPE_p_f_void__p_char { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16409,7 +16516,7 @@ public class SWIGTYPE_p_f_void__switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16439,7 +16546,37 @@ public class SWIGTYPE_p_HashElem { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + +public class SWIGTYPE_p_in6_addr { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_in6_addr(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_in6_addr() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_in6_addr obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16469,7 +16606,7 @@ public class SWIGTYPE_p_int { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16499,7 +16636,7 @@ public class SWIGTYPE_p_p_apr_pool_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16529,7 +16666,7 @@ public class SWIGTYPE_p_p_char { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16559,7 +16696,7 @@ public class SWIGTYPE_p_p_p_char { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16589,7 +16726,7 @@ public class SWIGTYPE_p_p_real_pcre { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16619,7 +16756,7 @@ public class SWIGTYPE_p_p_sqlite3 { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16649,7 +16786,7 @@ public class SWIGTYPE_p_p_sqlite3_stmt { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16679,7 +16816,7 @@ public class SWIGTYPE_p_p_switch_audio_resampler_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16709,7 +16846,7 @@ public class SWIGTYPE_p_p_switch_buffer { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16739,7 +16876,7 @@ public class SWIGTYPE_p_p_switch_cache_db_handle_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16769,7 +16906,7 @@ public class SWIGTYPE_p_p_switch_caller_extension { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16799,7 +16936,7 @@ public class SWIGTYPE_p_p_switch_channel { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16829,7 +16966,7 @@ public class SWIGTYPE_p_p_switch_codec_implementation { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16859,7 +16996,7 @@ public class SWIGTYPE_p_p_switch_console_callback_match { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16889,7 +17026,7 @@ public class SWIGTYPE_p_p_switch_core_port_allocator { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16919,7 +17056,7 @@ public class SWIGTYPE_p_p_switch_core_session { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16949,7 +17086,7 @@ public class SWIGTYPE_p_p_switch_core_session_message { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -16979,7 +17116,7 @@ public class SWIGTYPE_p_p_switch_event { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17009,7 +17146,7 @@ public class SWIGTYPE_p_p_switch_event_node { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17039,7 +17176,7 @@ public class SWIGTYPE_p_p_switch_frame { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17069,7 +17206,7 @@ public class SWIGTYPE_p_p_switch_hash { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17099,7 +17236,7 @@ public class SWIGTYPE_p_p_switch_ivr_digit_stream { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17129,7 +17266,7 @@ public class SWIGTYPE_p_p_switch_ivr_digit_stream_parser { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17159,7 +17296,7 @@ public class SWIGTYPE_p_p_switch_ivr_dmachine { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17189,7 +17326,7 @@ public class SWIGTYPE_p_p_switch_ivr_dmachine_match { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17219,7 +17356,7 @@ public class SWIGTYPE_p_p_switch_ivr_menu { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17249,7 +17386,7 @@ public class SWIGTYPE_p_p_switch_ivr_menu_xml_ctx { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17279,7 +17416,7 @@ public class SWIGTYPE_p_p_switch_log_node_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17309,7 +17446,7 @@ public class SWIGTYPE_p_p_switch_media_bug { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17339,7 +17476,7 @@ public class SWIGTYPE_p_p_switch_network_list { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17369,7 +17506,7 @@ public class SWIGTYPE_p_p_switch_rtp { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17399,7 +17536,7 @@ public class SWIGTYPE_p_p_switch_xml { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17429,7 +17566,7 @@ public class SWIGTYPE_p_p_switch_xml_binding { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17459,7 +17596,7 @@ public class SWIGTYPE_p_p_void { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17489,7 +17626,7 @@ public class SWIGTYPE_p_real_pcre { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17519,7 +17656,7 @@ public class SWIGTYPE_p_short { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17549,7 +17686,7 @@ public class SWIGTYPE_p_sockaddr { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17579,7 +17716,7 @@ public class SWIGTYPE_p_sockaddr_in6 { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17609,7 +17746,7 @@ public class SWIGTYPE_p_socklen_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17639,7 +17776,7 @@ public class SWIGTYPE_p_sqlite3 { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17669,7 +17806,7 @@ public class SWIGTYPE_p_sqlite3_stmt { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17699,7 +17836,7 @@ public class SWIGTYPE_p_switch_buffer { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17729,7 +17866,7 @@ public class SWIGTYPE_p_switch_call_cause_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17759,7 +17896,7 @@ public class SWIGTYPE_p_switch_channel { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17789,7 +17926,7 @@ public class SWIGTYPE_p_switch_core_port_allocator { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17819,7 +17956,7 @@ public class SWIGTYPE_p_switch_core_session { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17849,7 +17986,7 @@ public class SWIGTYPE_p_switch_event_types_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17879,7 +18016,7 @@ public class SWIGTYPE_p_switch_file_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17909,7 +18046,7 @@ public class SWIGTYPE_p_switch_hash { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17939,7 +18076,7 @@ public class SWIGTYPE_p_switch_interval_time_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17969,7 +18106,7 @@ public class SWIGTYPE_p_switch_ivr_action_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -17999,7 +18136,7 @@ public class SWIGTYPE_p_switch_ivr_digit_stream { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18029,7 +18166,7 @@ public class SWIGTYPE_p_switch_ivr_digit_stream_parser { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18059,7 +18196,7 @@ public class SWIGTYPE_p_switch_ivr_dmachine { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18089,7 +18226,7 @@ public class SWIGTYPE_p_switch_ivr_menu { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18119,7 +18256,7 @@ public class SWIGTYPE_p_switch_ivr_menu_xml_ctx { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18149,7 +18286,7 @@ public class SWIGTYPE_p_switch_media_bug { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18179,7 +18316,7 @@ public class SWIGTYPE_p_switch_mutex_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18209,7 +18346,7 @@ public class SWIGTYPE_p_switch_network_list { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18239,7 +18376,7 @@ public class SWIGTYPE_p_switch_odbc_handle { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18269,7 +18406,7 @@ public class SWIGTYPE_p_switch_pollfd_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18299,7 +18436,7 @@ public class SWIGTYPE_p_switch_queue_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18329,7 +18466,7 @@ public class SWIGTYPE_p_switch_rtcp_frame { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18359,7 +18496,7 @@ public class SWIGTYPE_p_switch_rtp { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18389,7 +18526,7 @@ public class SWIGTYPE_p_switch_size_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18419,7 +18556,7 @@ public class SWIGTYPE_p_switch_sockaddr_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18449,7 +18586,7 @@ public class SWIGTYPE_p_switch_socket_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18479,7 +18616,7 @@ public class SWIGTYPE_p_switch_ssize_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18509,7 +18646,7 @@ public class SWIGTYPE_p_switch_thread_rwlock_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18539,7 +18676,7 @@ public class SWIGTYPE_p_switch_time_exp_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18569,7 +18706,7 @@ public class SWIGTYPE_p_switch_time_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18599,7 +18736,7 @@ public class SWIGTYPE_p_switch_xml_binding { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18629,7 +18766,7 @@ public class SWIGTYPE_p_time_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18659,7 +18796,7 @@ public class SWIGTYPE_p_unsigned_char { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18689,7 +18826,7 @@ public class SWIGTYPE_p_unsigned_int { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18719,7 +18856,7 @@ public class SWIGTYPE_p_unsigned_long { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18749,7 +18886,7 @@ public class SWIGTYPE_p_unsigned_short { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18779,7 +18916,7 @@ public class SWIGTYPE_p_void { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18800,7 +18937,7 @@ public enum switch_abc_type_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18944,7 +19081,7 @@ public class switch_api_interface : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -18962,7 +19099,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -19126,7 +19263,7 @@ public class switch_application_interface : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -19206,7 +19343,7 @@ public class switch_app_log : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -19226,7 +19363,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -19368,7 +19505,7 @@ public class switch_asr_handle : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -19624,7 +19761,7 @@ public class switch_asr_interface : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -19644,7 +19781,7 @@ public enum switch_audio_col_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -19775,7 +19912,7 @@ public class switch_audio_resampler_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -19797,7 +19934,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -19813,7 +19950,7 @@ public enum switch_bitpack_mode_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -19994,7 +20131,7 @@ public class switch_bitpack_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -20010,7 +20147,7 @@ public enum switch_bool_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -20081,7 +20218,7 @@ public class switch_cache_db_connection_options_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -20140,7 +20277,7 @@ public class switch_cache_db_core_db_options_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -20305,7 +20442,7 @@ public class switch_cache_db_handle_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -20321,7 +20458,7 @@ public enum switch_cache_db_handle_type_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -20392,7 +20529,7 @@ public class switch_cache_db_native_handle_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -20471,7 +20608,7 @@ public class switch_cache_db_odbc_options_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -20562,7 +20699,7 @@ public class switch_caller_application : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -20686,7 +20823,7 @@ public class switch_caller_extension : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -21083,7 +21220,7 @@ public class switch_caller_profile : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -21101,7 +21238,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -21179,7 +21316,7 @@ public enum switch_call_cause_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -21195,7 +21332,7 @@ public enum switch_call_direction_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -21211,7 +21348,7 @@ public enum switch_channel_app_flag_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -21232,7 +21369,7 @@ public enum switch_channel_callstate_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -21250,7 +21387,7 @@ public enum switch_channel_cap_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -21320,7 +21457,7 @@ public enum switch_channel_flag_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -21348,7 +21485,7 @@ public enum switch_channel_state_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -21504,7 +21641,7 @@ public class switch_channel_timetable : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -21628,7 +21765,7 @@ public class switch_chat_interface : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -21783,7 +21920,7 @@ public class switch_codec : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -21806,7 +21943,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -21896,7 +22033,7 @@ public class switch_codec_fmtp : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -22150,7 +22287,7 @@ public class switch_codec_implementation : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -22295,7 +22432,7 @@ public class switch_codec_interface : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -22354,7 +22491,7 @@ public class switch_codec_settings : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -22372,7 +22509,7 @@ public enum switch_codec_type_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -22512,7 +22649,7 @@ public class switch_config : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -22603,7 +22740,7 @@ public class switch_console_callback_match : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -22673,7 +22810,7 @@ public class switch_console_callback_match_node : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -22703,7 +22840,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -22945,7 +23082,7 @@ public class switch_core_session_message : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -22962,7 +23099,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -23009,7 +23146,7 @@ public enum switch_core_session_message_types_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -23112,7 +23249,7 @@ public class switch_core_thread_session : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -23231,7 +23368,7 @@ public class switch_core_time_duration : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -23355,7 +23492,7 @@ public class switch_dialplan_interface : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -23534,7 +23671,7 @@ public class switch_directories : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -23549,7 +23686,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -23641,7 +23778,7 @@ public class switch_directory_handle : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -23809,7 +23946,7 @@ public class switch_directory_interface : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -23825,7 +23962,7 @@ public enum switch_dtmf_direction_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -23904,7 +24041,7 @@ public class switch_dtmf_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -23922,7 +24059,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -24068,7 +24205,7 @@ public class switch_endpoint_interface : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -24242,7 +24379,7 @@ public class switch_event : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -24257,7 +24394,7 @@ public enum switch_event_flag_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -24347,7 +24484,7 @@ public class switch_event_header : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -24441,7 +24578,7 @@ public enum switch_event_types_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -24472,7 +24609,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -24932,7 +25069,7 @@ public class switch_file_handle : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -25142,7 +25279,7 @@ public class switch_file_interface : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -25357,7 +25494,7 @@ public class switch_frame : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -25381,7 +25518,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -25495,7 +25632,7 @@ public class switch_input_args_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -25511,7 +25648,7 @@ public enum switch_input_type_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -25703,7 +25840,7 @@ public class switch_io_event_hooks : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -25774,7 +25911,7 @@ public class switch_io_event_hook_kill_channel : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -25845,7 +25982,7 @@ public class switch_io_event_hook_outgoing_channel : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -25916,7 +26053,7 @@ public class switch_io_event_hook_read_frame : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -25987,7 +26124,7 @@ public class switch_io_event_hook_receive_event : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -26058,7 +26195,7 @@ public class switch_io_event_hook_receive_message : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -26129,7 +26266,7 @@ public class switch_io_event_hook_recv_dtmf : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -26200,7 +26337,7 @@ public class switch_io_event_hook_resurrect_session : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -26271,7 +26408,7 @@ public class switch_io_event_hook_send_dtmf : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -26342,7 +26479,7 @@ public class switch_io_event_hook_state_change : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -26413,7 +26550,7 @@ public class switch_io_event_hook_state_run : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -26484,7 +26621,7 @@ public class switch_io_event_hook_video_read_frame : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -26555,7 +26692,7 @@ public class switch_io_event_hook_video_write_frame : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -26626,7 +26763,7 @@ public class switch_io_event_hook_write_frame : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -26643,7 +26780,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -26835,7 +26972,7 @@ public class switch_io_routines : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -26860,7 +26997,7 @@ public enum switch_io_routine_name_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -26881,7 +27018,7 @@ public enum switch_ivr_action_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -26982,7 +27119,7 @@ public class switch_ivr_dmachine_match : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -26999,7 +27136,7 @@ public enum switch_ivr_menu_flags { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -27016,7 +27153,7 @@ public enum switch_ivr_option_enum_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -27195,7 +27332,7 @@ public class switch_limit_interface : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -27297,7 +27434,7 @@ public class switch_loadable_module_function_table_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -27542,7 +27679,7 @@ public class switch_loadable_module_interface : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -27575,7 +27712,7 @@ public enum switch_log_level_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -27716,7 +27853,7 @@ public class switch_log_node_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -27733,7 +27870,7 @@ public enum switch_management_action_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -27857,7 +27994,7 @@ public class switch_management_interface : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -27882,7 +28019,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -27906,7 +28043,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -27922,7 +28059,7 @@ public enum switch_module_flag_enum_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -27950,7 +28087,7 @@ public enum switch_module_interface_name_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -27970,7 +28107,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -27987,7 +28124,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -28004,7 +28141,7 @@ public enum switch_priority_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -28021,7 +28158,7 @@ public enum switch_ring_ready_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -28120,7 +28257,7 @@ public class switch_rtcp_hdr_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -28189,7 +28326,7 @@ public class switch_rtcp_numbers_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -28201,13 +28338,16 @@ public enum switch_rtp_bug_flag_t { RTP_BUG_NONE = 0, RTP_BUG_CISCO_SKIP_MARK_BIT_2833 = (1 << 0), RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833 = (1 << 1), - RTP_BUG_IGNORE_MARK_BIT = (1 << 2) + RTP_BUG_IGNORE_MARK_BIT = (1 << 2), + RTP_BUG_SEND_LINEAR_TIMESTAMPS = (1 << 3), + RTP_BUG_START_SEQ_AT_ZERO = (1 << 4), + RTP_BUG_NEVER_SEND_MARKER = (1 << 5) } } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -28224,7 +28364,7 @@ public enum switch_rtp_crypto_direction_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -28327,7 +28467,7 @@ public class switch_rtp_crypto_key : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -28345,7 +28485,7 @@ public enum switch_rtp_crypto_key_type_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -28391,7 +28531,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -28408,7 +28548,7 @@ public enum switch_rtp_flush_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -28547,7 +28687,7 @@ public class switch_rtp_hdr_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -28704,7 +28844,7 @@ public class switch_rtp_numbers_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -28786,7 +28926,7 @@ public class switch_rtp_stats_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -28865,7 +29005,7 @@ public class switch_say_args_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -28882,7 +29022,7 @@ public enum switch_say_gender_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -29006,7 +29146,7 @@ public class switch_say_interface : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -29024,7 +29164,7 @@ public enum switch_say_method_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -29057,7 +29197,7 @@ public enum switch_say_type_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -29075,7 +29215,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -29185,7 +29325,7 @@ public class switch_scheduler_task : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -29225,7 +29365,7 @@ public enum switch_session_ctl_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -29243,7 +29383,7 @@ public enum switch_signal_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -29265,7 +29405,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -29492,7 +29632,7 @@ public class switch_speech_handle : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -29693,7 +29833,7 @@ public class switch_speech_interface : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -29710,7 +29850,7 @@ public enum switch_stack_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -29725,7 +29865,7 @@ public enum switch_state_handler_flag_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -29751,7 +29891,7 @@ public enum switch_state_handler_name_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -29953,7 +30093,7 @@ public class switch_state_handler_table : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -29989,7 +30129,7 @@ public enum switch_status_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -30141,7 +30281,7 @@ public class switch_stream_handle : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -30330,7 +30470,7 @@ public class switch_t38_options_t : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -30348,7 +30488,7 @@ public enum switch_text_channel_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -30494,7 +30634,7 @@ public class switch_timer : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -30509,7 +30649,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -30529,7 +30669,7 @@ public enum switch_timer_func_name_t { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -30708,7 +30848,7 @@ public class switch_timer_interface : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -30925,7 +31065,7 @@ public class switch_unicast_conninfo : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -30943,7 +31083,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -30960,7 +31100,7 @@ public enum switch_uri_flags { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -30978,7 +31118,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -31153,7 +31293,7 @@ public class switch_xml : IDisposable { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. @@ -31171,7 +31311,7 @@ namespace FreeSWITCH.Native { } /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 + * Version 2.0.1 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. commit db91f0e81ff9cd6705f51dd58582d393aeeae267 Author: Brian West <brian@freeswitch.org> Date: Mon Nov 15 11:37:07 2010 -0600 FS-2842: ACL for IPv6 address and swigall to boot diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 3a4f8b2..e2a7335 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -54,6 +54,13 @@ SWITCH_DECLARE(int) switch_isspace(int c); SWITCH_DECLARE(int) switch_isupper(int c); SWITCH_DECLARE(int) switch_isxdigit(int c); +typedef union{ + uint32_t v4; + struct in6_addr v6; +} ip_t; + +SWITCH_DECLARE(switch_bool_t) switch_testv6_subnet(ip_t _ip, ip_t _net, ip_t _mask); + #define switch_goto_status(_status, _label) status = _status; goto _label #define switch_goto_int(_n, _i, _label) _n = _i; goto _label #define switch_samples_per_packet(rate, interval) ((uint32_t)((float)rate / (1000.0f / (float)interval))) @@ -694,7 +701,7 @@ SWITCH_DECLARE(char *) switch_find_end_paren(const char *s, char open, char clos -SWITCH_DECLARE(int) switch_parse_cidr(const char *string, uint32_t *ip, uint32_t *mask, uint32_t *bitp); +SWITCH_DECLARE(int) switch_parse_cidr(const char *string, ip_t *ip, ip_t *mask, uint32_t *bitp); SWITCH_DECLARE(switch_status_t) switch_network_list_create(switch_network_list_t **list, const char *name, switch_bool_t default_type, switch_memory_pool_t *pool); SWITCH_DECLARE(switch_status_t) switch_network_list_add_cidr_token(switch_network_list_t *list, const char *cidr_str, switch_bool_t ok, const char *token); @@ -703,6 +710,7 @@ SWITCH_DECLARE(switch_status_t) switch_network_list_add_cidr_token(switch_networ SWITCH_DECLARE(switch_status_t) switch_network_list_add_host_mask(switch_network_list_t *list, const char *host, const char *mask_str, switch_bool_t ok); SWITCH_DECLARE(switch_bool_t) switch_network_list_validate_ip_token(switch_network_list_t *list, uint32_t ip, const char **token); +SWITCH_DECLARE(switch_bool_t) switch_network_list_validate_ip6_token(switch_network_list_t *list, ip_t ip, const char **token); #define switch_network_list_validate_ip(_list, _ip) switch_network_list_validate_ip_token(_list, _ip, NULL); #define switch_test_subnet(_ip, _net, _mask) (_mask ? ((_net & _mask) == (_ip & _mask)) : _net ? _net == _ip : 1) diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index 13136d9..ca001f6 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -11949,6 +11949,111 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_isxdigit(int jarg1) { } +SWIGEXPORT void SWIGSTDCALL CSharp_ip_t_v4_set(void * jarg1, unsigned long jarg2) { + ip_t *arg1 = (ip_t *) 0 ; + uint32_t arg2 ; + + arg1 = (ip_t *)jarg1; + arg2 = (uint32_t)jarg2; + if (arg1) (arg1)->v4 = arg2; + +} + + +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_ip_t_v4_get(void * jarg1) { + unsigned long jresult ; + ip_t *arg1 = (ip_t *) 0 ; + uint32_t result; + + arg1 = (ip_t *)jarg1; + result = (uint32_t) ((arg1)->v4); + jresult = (unsigned long)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_ip_t_v6_set(void * jarg1, void * jarg2) { + ip_t *arg1 = (ip_t *) 0 ; + in6_addr arg2 ; + in6_addr *argp2 ; + + arg1 = (ip_t *)jarg1; + argp2 = (in6_addr *)jarg2; + if (!argp2) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null in6_addr", 0); + return ; + } + arg2 = *argp2; + if (arg1) (arg1)->v6 = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_ip_t_v6_get(void * jarg1) { + void * jresult ; + ip_t *arg1 = (ip_t *) 0 ; + in6_addr result; + + arg1 = (ip_t *)jarg1; + result = ((arg1)->v6); + jresult = new in6_addr((in6_addr &)result); + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_new_ip_t() { + void * jresult ; + ip_t *result = 0 ; + + result = (ip_t *)new ip_t(); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_delete_ip_t(void * jarg1) { + ip_t *arg1 = (ip_t *) 0 ; + + arg1 = (ip_t *)jarg1; + delete arg1; + +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_testv6_subnet(void * jarg1, void * jarg2, void * jarg3) { + int jresult ; + ip_t arg1 ; + ip_t arg2 ; + ip_t arg3 ; + switch_bool_t result; + ip_t *argp1 ; + ip_t *argp2 ; + ip_t *argp3 ; + + argp1 = (ip_t *)jarg1; + if (!argp1) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null ip_t", 0); + return 0; + } + arg1 = *argp1; + argp2 = (ip_t *)jarg2; + if (!argp2) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null ip_t", 0); + return 0; + } + arg2 = *argp2; + argp3 = (ip_t *)jarg3; + if (!argp3) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null ip_t", 0); + return 0; + } + arg3 = *argp3; + result = (switch_bool_t)switch_testv6_subnet(arg1,arg2,arg3); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_SMAX_get() { int jresult ; int result; @@ -12906,14 +13011,14 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_file_path(char * jarg1) { SWIGEXPORT int SWIGSTDCALL CSharp_switch_parse_cidr(char * jarg1, void * jarg2, void * jarg3, void * jarg4) { int jresult ; char *arg1 = (char *) 0 ; - uint32_t *arg2 = (uint32_t *) 0 ; - uint32_t *arg3 = (uint32_t *) 0 ; + ip_t *arg2 = (ip_t *) 0 ; + ip_t *arg3 = (ip_t *) 0 ; uint32_t *arg4 = (uint32_t *) 0 ; int result; arg1 = (char *)jarg1; - arg2 = (uint32_t *)jarg2; - arg3 = (uint32_t *)jarg3; + arg2 = (ip_t *)jarg2; + arg3 = (ip_t *)jarg3; arg4 = (uint32_t *)jarg4; result = (int)switch_parse_cidr((char const *)arg1,arg2,arg3,arg4); jresult = result; @@ -12991,6 +13096,28 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_network_list_validate_ip_token(void * j } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_network_list_validate_ip6_token(void * jarg1, void * jarg2, void * jarg3) { + int jresult ; + switch_network_list_t *arg1 = (switch_network_list_t *) 0 ; + ip_t arg2 ; + char **arg3 = (char **) 0 ; + switch_bool_t result; + ip_t *argp2 ; + + arg1 = (switch_network_list_t *)jarg1; + argp2 = (ip_t *)jarg2; + if (!argp2) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null ip_t", 0); + return 0; + } + arg2 = *argp2; + arg3 = (char **)jarg3; + result = (switch_bool_t)switch_network_list_validate_ip6_token(arg1,arg2,(char const **)arg3); + jresult = result; + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_switch_dow_int2str(int jarg1) { char * jresult ; int arg1 ; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index e31d444..bd90191 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -2643,6 +2643,12 @@ public class freeswitch { return ret; } + public static switch_bool_t switch_testv6_subnet(ip_t _ip, ip_t _net, ip_t _mask) { + switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_testv6_subnet(ip_t.getCPtr(_ip), ip_t.getCPtr(_net), ip_t.getCPtr(_mask)); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + public static int _zstr(string s) { int ret = freeswitchPINVOKE._zstr(s); return ret; @@ -2949,8 +2955,8 @@ public class freeswitch { return ret; } - public static int switch_parse_cidr(string arg0, SWIGTYPE_p_unsigned_long ip, SWIGTYPE_p_unsigned_long mask, SWIGTYPE_p_unsigned_long bitp) { - int ret = freeswitchPINVOKE.switch_parse_cidr(arg0, SWIGTYPE_p_unsigned_long.getCPtr(ip), SWIGTYPE_p_unsigned_long.getCPtr(mask), SWIGTYPE_p_unsigned_long.getCPtr(bitp)); + public static int switch_parse_cidr(string arg0, ip_t ip, ip_t mask, SWIGTYPE_p_unsigned_long bitp) { + int ret = freeswitchPINVOKE.switch_parse_cidr(arg0, ip_t.getCPtr(ip), ip_t.getCPtr(mask), SWIGTYPE_p_unsigned_long.getCPtr(bitp)); return ret; } @@ -2974,6 +2980,12 @@ public class freeswitch { return ret; } + public static switch_bool_t switch_network_list_validate_ip6_token(SWIGTYPE_p_switch_network_list list, ip_t ip, ref string token) { + switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_network_list_validate_ip6_token(SWIGTYPE_p_switch_network_list.getCPtr(list), ip_t.getCPtr(ip), ref token); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + public static string switch_dow_int2str(int val) { string ret = freeswitchPINVOKE.switch_dow_int2str(val); return ret; @@ -8430,6 +8442,27 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_isxdigit")] public static extern int switch_isxdigit(int jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_ip_t_v4_set")] + public static extern void ip_t_v4_set(HandleRef jarg1, uint jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_ip_t_v4_get")] + public static extern uint ip_t_v4_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_ip_t_v6_set")] + public static extern void ip_t_v6_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_ip_t_v6_get")] + public static extern IntPtr ip_t_v6_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_new_ip_t")] + public static extern IntPtr new_ip_t(); + + [DllImport("mod_managed", EntryPoint="CSharp_delete_ip_t")] + public static extern void delete_ip_t(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_testv6_subnet")] + public static extern int switch_testv6_subnet(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SMAX_get")] public static extern int SWITCH_SMAX_get(); @@ -8628,6 +8661,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_network_list_validate_ip_token")] public static extern int switch_network_list_validate_ip_token(HandleRef jarg1, uint jarg2, ref string jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_network_list_validate_ip6_token")] + public static extern int switch_network_list_validate_ip6_token(HandleRef jarg1, HandleRef jarg2, ref string jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_dow_int2str")] public static extern string switch_dow_int2str(int jarg1); @@ -13785,6 +13821,75 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class ip_t : IDisposable { + private HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal ip_t(IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new HandleRef(this, cPtr); + } + + internal static HandleRef getCPtr(ip_t obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } + + ~ip_t() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_ip_t(swigCPtr); + } + swigCPtr = new HandleRef(null, IntPtr.Zero); + GC.SuppressFinalize(this); + } + } + + public uint v4 { + set { + freeswitchPINVOKE.ip_t_v4_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.ip_t_v4_get(swigCPtr); + return ret; + } + } + + public SWIGTYPE_p_in6_addr v6 { + set { + freeswitchPINVOKE.ip_t_v6_set(swigCPtr, SWIGTYPE_p_in6_addr.getCPtr(value)); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + } + get { + SWIGTYPE_p_in6_addr ret = new SWIGTYPE_p_in6_addr(freeswitchPINVOKE.ip_t_v6_get(swigCPtr), true); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + + public ip_t() : this(freeswitchPINVOKE.new_ip_t(), true) { + } + +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class IvrMenu : IDisposable { private HandleRef swigCPtr; protected bool swigCMemOwn; @@ -16398,6 +16503,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_in6_addr { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_in6_addr(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_in6_addr() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_in6_addr obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_int { private HandleRef swigCPtr; @@ -28053,7 +28188,10 @@ public enum switch_rtp_bug_flag_t { RTP_BUG_NONE = 0, RTP_BUG_CISCO_SKIP_MARK_BIT_2833 = (1 << 0), RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833 = (1 << 1), - RTP_BUG_IGNORE_MARK_BIT = (1 << 2) + RTP_BUG_IGNORE_MARK_BIT = (1 << 2), + RTP_BUG_SEND_LINEAR_TIMESTAMPS = (1 << 3), + RTP_BUG_START_SEQ_AT_ZERO = (1 << 4), + RTP_BUG_NEVER_SEND_MARKER = (1 << 5) } } diff --git a/src/mod/languages/mod_perl/mod_perl_wrap.cpp b/src/mod/languages/mod_perl/mod_perl_wrap.cpp index 2efbdf1..370c88b 100644 --- a/src/mod/languages/mod_perl/mod_perl_wrap.cpp +++ b/src/mod/languages/mod_perl/mod_perl_wrap.cpp @@ -9732,17 +9732,17 @@ XS(SWIG_init) { SWIG_TypeClientData(SWIGTYPE_p_IVRMenu, (void*) "freeswitch::IVRMenu"); SWIG_TypeClientData(SWIGTYPE_p_API, (void*) "freeswitch::API"); SWIG_TypeClientData(SWIGTYPE_p_input_callback_state, (void*) "freeswitch::input_callback_state_t"); - /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_HUP", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_HUP))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; - /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_FREE", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_FREE))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; - /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_RDLOCK", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_RDLOCK))); SvREADONLY_on(sv); diff --git a/src/switch_core.c b/src/switch_core.c index bd4b00d..0c1263a 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -901,16 +901,25 @@ static switch_ip_list_t IP_LIST = { 0 }; SWITCH_DECLARE(switch_bool_t) switch_check_network_list_ip_token(const char *ip_str, const char *list_name, const char **token) { switch_network_list_t *list; - uint32_t ip, net, mask, bits; + ip_t ip, mask, net; + uint32_t bits; + char *ipv6 = strchr(ip_str,':'); switch_bool_t ok = SWITCH_FALSE; switch_mutex_lock(runtime.global_mutex); - switch_inet_pton(AF_INET, ip_str, &ip); - - ip = htonl(ip); + if (ipv6) { + switch_inet_pton(AF_INET6, ip_str, &ip); + } else { + switch_inet_pton(AF_INET, ip_str, &ip); + ip.v4 = htonl(ip.v4); + } if ((list = switch_core_hash_find(IP_LIST.hash, list_name))) { - ok = switch_network_list_validate_ip_token(list, ip, token); + if (ipv6) { + ok = switch_network_list_validate_ip6_token(list, ip, token); + } else { + ok = switch_network_list_validate_ip_token(list, ip.v4, token); + } } else if (strchr(list_name, '/')) { if (strchr(list_name, ',')) { char *list_name_dup = strdup(list_name); @@ -923,15 +932,21 @@ SWITCH_DECLARE(switch_bool_t) switch_check_network_list_ip_token(const char *ip_ int i; for (i = 0; i < argc; i++) { switch_parse_cidr(argv[i], &net, &mask, &bits); - if ((ok = switch_test_subnet(ip, net, mask))) { - break; + if (ipv6) { + if ((ok = switch_testv6_subnet(ip, net, mask))){ + break; + } + } else { + if ((ok = switch_test_subnet(ip.v4, net.v4, mask.v4))) { + break; + } } } } free(list_name_dup); } else { switch_parse_cidr(list_name, &net, &mask, &bits); - ok = switch_test_subnet(ip, net, mask); + ok = switch_test_subnet(ip.v4, net.v4, mask.v4); } } switch_mutex_unlock(runtime.global_mutex); diff --git a/src/switch_utils.c b/src/switch_utils.c index 2872f10..75be02a 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -39,9 +39,10 @@ #define ESCAPE_META '\\' struct switch_network_node { - uint32_t ip; - uint32_t mask; + ip_t ip; + ip_t mask; uint32_t bits; + int family; switch_bool_t ok; char *token; char *str; @@ -140,6 +141,50 @@ SWITCH_DECLARE(switch_status_t) switch_network_list_create(switch_network_list_t return SWITCH_STATUS_SUCCESS; } +#define IN6_AND_MASK(result, ip, mask) \ + ((uint32_t *) (result))[0] =((const uint32_t *) (ip))[0] & ((const uint32_t *)(mask))[0]; \ + ((uint32_t *) (result))[1] =((const uint32_t *) (ip))[1] & ((const uint32_t *)(mask))[1]; \ + ((uint32_t *) (result))[2] =((const uint32_t *) (ip))[2] & ((const uint32_t *)(mask))[2]; \ + ((uint32_t *) (result))[3] =((const uint32_t *) (ip))[3] & ((const uint32_t *)(mask))[3]; +SWITCH_DECLARE(switch_bool_t) switch_testv6_subnet(ip_t _ip, ip_t _net, ip_t _mask) { + if (!IN6_IS_ADDR_UNSPECIFIED(&_mask.v6)) { + struct in6_addr a, b; + IN6_AND_MASK(&a, &_net, &_mask); + IN6_AND_MASK(&b, &_ip, &_mask); + return !memcmp(&a,&b, sizeof(struct in6_addr)); + } else { + if (!IN6_IS_ADDR_UNSPECIFIED(&_net.v6)) { + return !memcmp(&_net,&_ip,sizeof(struct in6_addr)); + } + else return SWITCH_TRUE; + } +} +SWITCH_DECLARE(switch_bool_t) switch_network_list_validate_ip6_token(switch_network_list_t *list, ip_t ip, const char **token) +{ + switch_network_node_t *node; + switch_bool_t ok = list->default_type; + uint32_t bits = 0; + + for (node = list->node_head; node; node = node->next) { + if (node->family == AF_INET) continue; + if (node->bits > bits && switch_testv6_subnet(ip, node->ip, node->mask)) { + if (node->ok) { + ok = SWITCH_TRUE; + } else { + ok = SWITCH_FALSE; + } + + bits = node->bits; + + if (token) { + *token = node->token; + } + } + } + + return ok; +} + SWITCH_DECLARE(switch_bool_t) switch_network_list_validate_ip_token(switch_network_list_t *list, uint32_t ip, const char **token) { switch_network_node_t *node; @@ -147,7 +192,8 @@ SWITCH_DECLARE(switch_bool_t) switch_network_list_validate_ip_token(switch_netwo uint32_t bits = 0; for (node = list->node_head; node; node = node->next) { - if (node->bits > bits && switch_test_subnet(ip, node->ip, node->mask)) { + if (node->family == AF_INET6) continue; /* want AF_INET */ + if (node->bits > bits && switch_test_subnet(ip, node->ip.v4, node->mask.v4)) { if (node->ok) { ok = SWITCH_TRUE; } else { @@ -168,7 +214,8 @@ SWITCH_DECLARE(switch_bool_t) switch_network_list_validate_ip_token(switch_netwo SWITCH_DECLARE(switch_status_t) switch_network_list_perform_add_cidr_token(switch_network_list_t *list, const char *cidr_str, switch_bool_t ok, const char *token) { - uint32_t ip, mask, bits; + ip_t ip, mask; + uint32_t bits; switch_network_node_t *node; if (switch_parse_cidr(cidr_str, &ip, &mask, &bits)) { @@ -185,6 +232,12 @@ SWITCH_DECLARE(switch_status_t) switch_network_list_perform_add_cidr_token(switc node->bits = bits; node->str = switch_core_strdup(list->pool, cidr_str); + if (strchr(cidr_str,':')) { + node->family = AF_INET6; + } else { + node->family = AF_INET; + } + if (!zstr(token)) { node->token = switch_core_strdup(list->pool, token); } @@ -227,7 +280,7 @@ SWITCH_DECLARE(switch_status_t) switch_network_list_add_cidr_token(switch_networ SWITCH_DECLARE(switch_status_t) switch_network_list_add_host_mask(switch_network_list_t *list, const char *host, const char *mask_str, switch_bool_t ok) { - int ip, mask; + ip_t ip, mask; switch_network_node_t *node; switch_inet_pton(AF_INET, host, &ip); @@ -235,14 +288,15 @@ SWITCH_DECLARE(switch_status_t) switch_network_list_add_host_mask(switch_network node = switch_core_alloc(list->pool, sizeof(*node)); - node->ip = ntohl(ip); - node->mask = ntohl(mask); + node->ip.v4 = ntohl(ip.v4); + node->mask.v4 = ntohl(mask.v4); node->ok = ok; /* http://graphics.stanford.edu/~seander/bithacks.html */ - mask = mask - ((mask >> 1) & 0x55555555); - mask = (mask & 0x33333333) + ((mask >> 2) & 0x33333333); - node->bits = (((mask + (mask >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24; + mask.v4 = mask.v4 - ((mask.v4 >> 1) & 0x55555555); + mask.v4 = (mask.v4 & 0x33333333) + ((mask.v4 >> 2) & 0x33333333); + node->bits = (((mask.v4 + (mask.v4 >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24; + node->str = switch_core_sprintf(list->pool, "%s:%s", host, mask_str); node->next = list->node_head; @@ -252,13 +306,16 @@ SWITCH_DECLARE(switch_status_t) switch_network_list_add_host_mask(switch_network } -SWITCH_DECLARE(int) switch_parse_cidr(const char *string, uint32_t *ip, uint32_t *mask, uint32_t *bitp) +SWITCH_DECLARE(int) switch_parse_cidr(const char *string, ip_t *ip, ip_t *mask, uint32_t *bitp) { char host[128]; char *bit_str; int32_t bits; + const char *ipv6; + ip_t *maskv = mask; + ip_t *ipv = ip; - switch_copy_string(host, string, sizeof(host)); + memcpy(host, string, sizeof(host)); bit_str = strchr(host, '/'); if (!bit_str) { @@ -267,17 +324,36 @@ SWITCH_DECLARE(int) switch_parse_cidr(const char *string, uint32_t *ip, uint32_t *bit_str++ = '\0'; bits = atoi(bit_str); + ipv6 = strchr(string, ':'); + if (ipv6) { + int i,n; + if (bits < 0 || bits > 128) { + return -2; + } + bits = atoi(bit_str); + switch_inet_pton(AF_INET6, host, (unsigned char *)ip); + for (n=bits,i=0 ;i < 16; i++){ + if (n >= 8) { + maskv->v6.s6_addr[i] = 0xFF; + n -= 8; + } else if (n < 8) { + maskv->v6.s6_addr[i] = 0xFF & ~(0xFF >> n); + n -= n; + } else if (n == 0) { + maskv->v6.s6_addr[i] = 0x00; + } + } + } else { + if (bits < 0 || bits > 32) { + return -2; + } - if (bits < 0 || bits > 32) { - return -2; - } - - bits = atoi(bit_str); - switch_inet_pton(AF_INET, host, ip); - *ip = htonl(*ip); - - *mask = 0xFFFFFFFF & ~(0xFFFFFFFF >> bits); + bits = atoi(bit_str); + switch_inet_pton(AF_INET, host, (unsigned char *)ip); + ipv->v4 = htonl(ipv->v4); + maskv->v4 = 0xFFFFFFFF & ~(0xFFFFFFFF >> bits); + } *bitp = bits; return 0; @@ -394,7 +470,7 @@ SWITCH_DECLARE(switch_status_t) switch_b64_encode(unsigned char *in, switch_size if (++y != 72) { continue; } - //out[bytes++] = '\n'; + /* out[bytes++] = '\n'; */ y = 0; } } @@ -963,7 +1039,7 @@ static int get_netmask(struct sockaddr_in *me, int *mask) if (ip.s_addr == me->sin_addr.s_addr) { ioctl(sock, SIOCGIFNETMASK, &ifreqs[i]); sin = (struct sockaddr_in *) &ifreqs[i].ifr_addr; - //mask = sin->sin_addr; + /* mask = sin->sin_addr; */ *mask = sin->sin_addr.s_addr; r = 0; break; @@ -1094,7 +1170,7 @@ SWITCH_DECLARE(switch_status_t) switch_find_local_ip(char *buf, int len, int *ma break; case AF_INET6: switch_copy_string(buf, "::1", len); - base = "2001:503:BA3E::2:30"; // DNS Root server A + base = "2001:503:BA3E::2:30"; /* DNS Root server A */ break; default: base = "127.0.0.1"; commit 6941c6eb71cdb38fbcacae03c00a65d0b0c6724f Author: Andrew Thompson <andrew@hijacked.us> Date: Mon Nov 15 12:39:54 2010 -0500 FS-2775 Rewrite XML fetch conditional wait to be more sane (Reported by James Aimonetti) diff --git a/src/mod/event_handlers/mod_erlang_event/handle_msg.c b/src/mod/event_handlers/mod_erlang_event/handle_msg.c index 1a8b64f..bb37cdd 100644 --- a/src/mod/event_handlers/mod_erlang_event/handle_msg.c +++ b/src/mod/event_handlers/mod_erlang_event/handle_msg.c @@ -173,68 +173,74 @@ static switch_status_t handle_msg_fetch_reply(listener_t *listener, ei_x_buff * ei_x_encode_atom(rbuf, "error"); ei_x_encode_atom(rbuf, "badarg"); } else { - ei_x_buff *nbuf = malloc(sizeof(nbuf)); - nbuf->buff = malloc(buf->buffsz); - memcpy(nbuf->buff, buf->buff, buf->buffsz); - nbuf->index = buf->index; - nbuf->buffsz = buf->buffsz; - - switch_mutex_lock(globals.fetch_reply_mutex); - if ((p = switch_core_hash_find(globals.fetch_reply_hash, uuid_str))) { - /* Get the status and release the lock ASAP. */ - enum { is_timeout, is_waiting, is_filled } status; - if (p->state == reply_not_ready) { - switch_thread_cond_wait(p->ready_or_found, globals.fetch_reply_mutex); - } - - if (p->state == reply_waiting) { - /* update the key with a reply */ - status = is_waiting; - p->reply = nbuf; - p->state = reply_found; - strncpy(p->winner, listener->peer_nodename, MAXNODELEN); - switch_thread_cond_broadcast(p->ready_or_found); - } else if (p->state == reply_timeout) { - status = is_timeout; - } else { - status = is_filled; - } - - put_reply_unlock(p, uuid_str); + /* TODO - maybe use a rwlock instead */ + if ((p = switch_core_hash_find_locked(globals.fetch_reply_hash, uuid_str, globals.fetch_reply_mutex))) { + /* try to lock the mutex, so no other responder can */ + if (switch_mutex_trylock(p->mutex) == SWITCH_STATUS_SUCCESS) { + if (p->state == reply_waiting) { + /* alright, we've got the lock and we're the first to reply */ + + /* clone the reply so it doesn't get destroyed on us */ + ei_x_buff *nbuf = malloc(sizeof(nbuf)); + nbuf->buff = malloc(buf->buffsz); + memcpy(nbuf->buff, buf->buff, buf->buffsz); + nbuf->index = buf->index; + nbuf->buffsz = buf->buffsz; + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Got reply for %s\n", uuid_str); + + /* copy info into the reply struct */ + p->state = reply_found; + p->reply = nbuf; + strncpy(p->winner, listener->peer_nodename, MAXNODELEN); + + /* signal waiting thread that its time to wake up */ + switch_thread_cond_signal(p->ready_or_found); + + /* reply OK */ + ei_x_encode_tuple_header(rbuf, 2); + ei_x_encode_atom(rbuf, "ok"); + _ei_x_encode_string(rbuf, uuid_str); - /* Relay the status back to the fetch responder. */ - if (status == is_waiting) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found waiting slot for %s\n", uuid_str); - ei_x_encode_tuple_header(rbuf, 2); - ei_x_encode_atom(rbuf, "ok"); - _ei_x_encode_string(rbuf, uuid_str); - /* Return here to avoid freeing the reply. */ - return SWITCH_STATUS_SUCCESS; - } else if (status == is_timeout) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Handler for %s timed out\n", uuid_str); - ei_x_encode_tuple_header(rbuf, 3); - ei_x_encode_atom(rbuf, "error"); - _ei_x_encode_string(rbuf, uuid_str); - ei_x_encode_atom(rbuf, "timeout"); + /* unlock */ + switch_mutex_unlock(p->mutex); + } else { + if (p->state == reply_found) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Reply for already complete request %s\n", uuid_str); + ei_x_encode_tuple_header(rbuf, 3); + ei_x_encode_atom(rbuf, "error"); + _ei_x_encode_string(rbuf, uuid_str); + ei_x_encode_atom(rbuf, "duplicate_response"); + } else if (p->state == reply_timeout) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Reply for timed out request %s\n", uuid_str); + ei_x_encode_tuple_header(rbuf, 3); + ei_x_encode_atom(rbuf, "error"); + _ei_x_encode_string(rbuf, uuid_str); + ei_x_encode_atom(rbuf, "timeout"); + } else if (p->state == reply_not_ready) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Request %s is not ready?!\n", uuid_str); + ei_x_encode_tuple_header(rbuf, 3); + ei_x_encode_atom(rbuf, "error"); + _ei_x_encode_string(rbuf, uuid_str); + ei_x_encode_atom(rbuf, "not_ready"); + } + switch_mutex_unlock(p->mutex); + } } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found filled slot for %s\n", uuid_str); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Could not lock mutex for reply %s\n", uuid_str); ei_x_encode_tuple_header(rbuf, 3); ei_x_encode_atom(rbuf, "error"); _ei_x_encode_string(rbuf, uuid_str); ei_x_encode_atom(rbuf, "duplicate_response"); } } else { - /* nothing in the hash */ - switch_mutex_unlock(globals.fetch_reply_mutex); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Empty slot for %s\n", uuid_str); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Could not find request for reply %s\n", uuid_str); ei_x_encode_tuple_header(rbuf, 2); ei_x_encode_atom(rbuf, "error"); ei_x_encode_atom(rbuf, "invalid_uuid"); } - - switch_safe_free(nbuf->buff); - switch_safe_free(nbuf); } + return SWITCH_STATUS_SUCCESS; } @@ -1052,7 +1058,7 @@ static switch_status_t handle_ref_tuple(listener_t *listener, erlang_msg * msg, if (se->spawn_reply->state == reply_waiting) { se->spawn_reply->pid = pid; - switch_thread_cond_broadcast(se->spawn_reply->ready_or_found); + switch_thread_cond_signal(se->spawn_reply->ready_or_found); ei_x_encode_atom(rbuf, "ok"); switch_thread_rwlock_unlock(listener->session_rwlock); switch_mutex_unlock(se->spawn_reply->mutex); diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index 8565e1a..e375515 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -366,13 +366,21 @@ static switch_xml_t erlang_fetch(const char *sectionstr, const char *tag_name, c ei_x_buff buf; ei_x_new_with_version(&buf); + switch_uuid_get(&uuid); + switch_uuid_format(uuid_str, &uuid); + + ei_x_encode_tuple_header(&buf, 7); + ei_x_encode_atom(&buf, "fetch"); + ei_x_encode_atom(&buf, sectionstr); + _ei_x_encode_string(&buf, tag_name ? tag_name : "undefined"); + _ei_x_encode_string(&buf, key_name ? key_name : "undefined"); + _ei_x_encode_string(&buf, key_value ? key_value : "undefined"); + _ei_x_encode_string(&buf, uuid_str); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "looking for bindings\n"); section = switch_xml_parse_section_string((char *) sectionstr); - switch_uuid_get(&uuid); - switch_uuid_format(uuid_str, &uuid); - for (ptr = bindings.head; ptr; ptr = ptr->next) { if (ptr->section != section) continue; @@ -384,13 +392,6 @@ static switch_xml_t erlang_fetch(const char *sectionstr, const char *tag_name, c switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "binding for %s in section %s with key %s and value %s requested from node %s\n", tag_name, sectionstr, key_name, key_value, ptr->process.pid.node); - ei_x_encode_tuple_header(&buf, 7); - ei_x_encode_atom(&buf, "fetch"); - ei_x_encode_atom(&buf, sectionstr); - _ei_x_encode_string(&buf, tag_name ? tag_name : "undefined"); - _ei_x_encode_string(&buf, key_name ? key_name : "undefined"); - _ei_x_encode_string(&buf, key_value ? key_value : "undefined"); - _ei_x_encode_string(&buf, uuid_str); if (params) { ei_encode_switch_event_headers(&buf, params); } else { @@ -401,41 +402,42 @@ static switch_xml_t erlang_fetch(const char *sectionstr, const char *tag_name, c /* Create a new fetch object. */ p = malloc(sizeof(*p)); switch_thread_cond_create(&p->ready_or_found, module_pool); - p->usecount = 1; + switch_mutex_init(&p->mutex, SWITCH_MUTEX_UNNESTED, module_pool); p->state = reply_not_ready; p->reply = NULL; switch_core_hash_insert_locked(globals.fetch_reply_hash, uuid_str, p, globals.fetch_reply_mutex); + p->state = reply_waiting; now = switch_micro_time_now(); } /* We don't need to lock here because everybody is waiting on our condition before the action starts. */ - p->usecount ++; switch_mutex_lock(ptr->listener->sock_mutex); ei_sendto(ptr->listener->ec, ptr->listener->sockfd, &ptr->process, &buf); switch_mutex_unlock(ptr->listener->sock_mutex); } + ei_x_free(&buf); + if (!p) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "no binding for %s\n", sectionstr); goto cleanup; } /* Tell the threads to be ready, and wait five seconds for a reply. */ - switch_mutex_lock(globals.fetch_reply_mutex); - p->state = reply_waiting; - switch_thread_cond_broadcast(p->ready_or_found); + switch_mutex_lock(p->mutex); + //p->state = reply_waiting; switch_thread_cond_timedwait(p->ready_or_found, - globals.fetch_reply_mutex, 5000000); + p->mutex, 5000000); if (!p->reply) { p->state = reply_timeout; - switch_mutex_unlock(globals.fetch_reply_mutex); + switch_mutex_unlock(p->mutex); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Timed out after %d milliseconds when waiting for XML fetch response for %s\n", (int) (switch_micro_time_now() - now) / 1000, uuid_str); goto cleanup; } rep = p->reply; - switch_mutex_unlock(globals.fetch_reply_mutex); + switch_mutex_unlock(p->mutex); ei_get_type(rep->buff, &rep->index, &type, &size); @@ -450,7 +452,6 @@ static switch_xml_t erlang_fetch(const char *sectionstr, const char *tag_name, c goto cleanup; } - if (!(xmlstr = malloc(size + 1))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error\n"); goto cleanup; @@ -471,26 +472,17 @@ static switch_xml_t erlang_fetch(const char *sectionstr, const char *tag_name, c /* cleanup */ cleanup: if (p) { - switch_mutex_lock(globals.fetch_reply_mutex); - put_reply_unlock(p, uuid_str); - } - - return xml; -} - - -void put_reply_unlock(fetch_reply_t *p, char *uuid_str) -{ - if (-- p->usecount == 0) { - switch_core_hash_delete(globals.fetch_reply_hash, uuid_str); + /* lock so nothing can have it while we delete it */ + switch_mutex_lock(p->mutex); + switch_core_hash_delete_locked(globals.fetch_reply_hash, uuid_str, globals.fetch_reply_mutex); + switch_mutex_unlock(p->mutex); + switch_mutex_destroy(p->mutex); switch_thread_cond_destroy(p->ready_or_found); - if (p->reply) { - switch_safe_free(p->reply->buff); - switch_safe_free(p->reply); - } + switch_safe_free(p->reply); switch_safe_free(p); } - switch_mutex_unlock(globals.fetch_reply_mutex); + + return xml; } diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h index 248e66b..eb36612 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h @@ -60,7 +60,7 @@ enum reply_state { reply_not_ready, reply_waiting, reply_found, reply_timeout }; struct fetch_reply_struct { switch_thread_cond_t *ready_or_found; - int usecount; + switch_mutex_t *mutex; enum reply_state state; ei_x_buff *reply; char winner[MAXNODELEN + 1]; commit 04e57577b3561e2fa76f86ff4053fad6b0f9c6b7 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Nov 15 11:22:25 2010 -0600 FS-2801 diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index e567206..5bb2ff0 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -4671,9 +4671,8 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, if (!switch_channel_get_variable(other_channel, SWITCH_B_SDP_VARIABLE)) { switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, r_sdp); } - switch_mutex_unlock(tech_pvt->sofia_mutex); - switch_channel_pre_answer(other_channel); - switch_mutex_lock(tech_pvt->sofia_mutex); + //switch_channel_pre_answer(other_channel); + switch_core_session_queue_indication(other_session, SWITCH_MESSAGE_INDICATE_PROGRESS); switch_core_session_rwunlock(other_session); } goto done; @@ -5100,10 +5099,9 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) { if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) { - other_channel = switch_core_session_get_channel(other_session); - switch_mutex_unlock(tech_pvt->sofia_mutex); - switch_channel_answer(other_channel); - switch_mutex_lock(tech_pvt->sofia_mutex); + //other_channel = switch_core_session_get_channel(other_session); + //switch_channel_answer(other_channel); + switch_core_session_queue_indication(other_session, SWITCH_MESSAGE_INDICATE_ANSWER); switch_core_session_rwunlock(other_session); } } @@ -5132,9 +5130,10 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, if (!switch_channel_get_variable(other_channel, SWITCH_B_SDP_VARIABLE)) { switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, r_sdp); } - switch_mutex_unlock(tech_pvt->sofia_mutex); - switch_channel_answer(other_channel); - switch_mutex_lock(tech_pvt->sofia_mutex); + + //switch_channel_answer(other_channel); + switch_core_session_queue_indication(other_session, SWITCH_MESSAGE_INDICATE_ANSWER); + switch_core_session_rwunlock(other_session); } goto done; diff --git a/src/switch_ivr.c b/src/switch_ivr.c index b5c5632..e599839 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -658,12 +658,38 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_next_event(switch_core_session_ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_all_messages(switch_core_session_t *session) { switch_core_session_message_t *message; + switch_channel_t *channel = switch_core_session_get_channel(session); int i = 0; while (switch_core_session_dequeue_message(session, &message) == SWITCH_STATUS_SUCCESS) { i++; - switch_core_session_receive_message(session, message); + + switch(message->message_id) { + case SWITCH_MESSAGE_INDICATE_ANSWER: + if (switch_channel_answer(channel) != SWITCH_STATUS_SUCCESS) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + } + switch_core_session_free_message(&message); + break; + case SWITCH_MESSAGE_INDICATE_PROGRESS: + if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + } + switch_core_session_free_message(&message); + break; + case SWITCH_MESSAGE_INDICATE_RINGING: + if (switch_channel_ring_ready(channel) != SWITCH_STATUS_SUCCESS) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + } + switch_core_session_free_message(&message); + break; + default: + switch_core_session_receive_message(session, message); + break; + } + message = NULL; + } return i ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE; commit 0eb33e57617079f0d3d9a8891f99439d45ffd29a Author: Brian West <brian@freeswitch.org> Date: Mon Nov 15 11:12:50 2010 -0600 FS-2844: Patch debian init.d script to set ulimit values diff --git a/debian/freeswitch.init b/debian/freeswitch.init index 1eb71ac..ddde2f5 100755 --- a/debian/freeswitch.init +++ b/debian/freeswitch.init @@ -49,6 +49,24 @@ fi . /lib/lsb/init-functions # +# Function that sets ulimit values for the daemon +# +do_setlimits() { + ulimit -c unlimited + ulimit -d unlimited + ulimit -f unlimited + ulimit -i unlimited + ulimit -n 999999 + ulimit -q unlimited + ulimit -u unlimited + ulimit -v unlimited + ulimit -x unlimited + ulimit -s 240 + ulimit -l unlimited + return 0 +} + +# # Function that starts the daemon/service # do_start() @@ -59,6 +77,7 @@ do_start() # 2 if daemon could not be started start-stop-daemon -d $WORKDIR -c $USER --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ || return 1 + do_setlimits start-stop-daemon -d $WORKDIR -c $USER --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ $FREESWITCH_PARAMS \ || return 2 commit a09bce346eec10bd282385100dc1ec9733ba3c2e Author: David Yat Sin <dyatsin@sangoma.com> Date: Mon Nov 15 11:46:47 2010 -0500 Fix for compilation errors due to some functions defined as extern diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 22c89cb..a765626 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -56,9 +56,6 @@ static sng_isdn_event_interface_t g_sngisdn_event_interface; ftdm_sngisdn_data_t g_sngisdn_data; -extern ftdm_status_t sng_isdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t trace_opt); -extern ftdm_status_t sngisdn_check_free_ids(void); - ftdm_state_map_t sangoma_isdn_state_map = { { { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 953bfee..336ffe9 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -273,10 +273,21 @@ FT_DECLARE(void) clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info); void stack_hdr_init(Header *hdr); void stack_pst_init(Pst *pst); + FT_DECLARE(ftdm_status_t) get_ftdmchan_by_spInstId(int16_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data); FT_DECLARE(ftdm_status_t) get_ftdmchan_by_suInstId(int16_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data); FT_DECLARE(ftdm_status_t) sng_isdn_set_avail_rate(ftdm_span_t *ftdmspan, sngisdn_avail_t avail); +FT_DECLARE(ftdm_status_t) cpy_calling_num_from_stack(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb); +FT_DECLARE(ftdm_status_t) cpy_called_num_from_stack(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb); +FT_DECLARE(ftdm_status_t) cpy_redir_num_from_stack(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb); +FT_DECLARE(ftdm_status_t) cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *display); + +FT_DECLARE(ftdm_status_t) cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm); +FT_DECLARE(ftdm_status_t) cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm); +FT_DECLARE(ftdm_status_t) cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm); +FT_DECLARE(ftdm_status_t) cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan); + /* Outbound Call Control functions */ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan); void sngisdn_snd_setup_ack(ftdm_channel_t *ftdmchan); @@ -331,6 +342,14 @@ void sngisdn_process_rst_ind (sngisdn_event_data_t *sngisdn_event); void sngisdn_rcv_phy_ind(SuId suId, Reason reason); void sngisdn_rcv_q921_ind(BdMngmt *status); + +void sngisdn_trace_q921(char* str, uint8_t* data, uint32_t data_len); +void sngisdn_trace_q931(char* str, uint8_t* data, uint32_t data_len); +void get_memory_info(void); + +ftdm_status_t sng_isdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t trace_opt); +ftdm_status_t sngisdn_check_free_ids(void); + void sngisdn_rcv_q921_trace(BdMngmt *trc, Buffer *mBuf); void sngisdn_rcv_q931_ind(InMngmt *status); void sngisdn_rcv_q931_trace(InMngmt *trc, Buffer *mBuf); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 83a8faa..8408c67 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -34,11 +34,6 @@ #include "ftmod_sangoma_isdn.h" -extern ftdm_status_t cpy_calling_num_from_stack(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb); -extern ftdm_status_t cpy_called_num_from_stack(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb); -extern ftdm_status_t cpy_redir_num_from_stack(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb); -extern ftdm_status_t cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *display); - /* Remote side transmit a SETUP */ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 8367687..124cd96 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -34,10 +34,6 @@ #include "ftmod_sangoma_isdn.h" -extern ftdm_status_t cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm); -extern ftdm_status_t cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm); -extern ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan); - void sngisdn_snd_setup(ftdm_channel_t *ftdmchan); void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan); void sngisdn_snd_progress(ftdm_channel_t *ftdmchan); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c index 5580f3a..7c375f7 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c @@ -34,10 +34,6 @@ #include "ftmod_sangoma_isdn.h" -extern void sngisdn_trace_q921(char* str, uint8_t* data, uint32_t data_len); -extern void sngisdn_trace_q931(char* str, uint8_t* data, uint32_t data_len); -extern void get_memory_info(void); - #define MAX_DECODE_STR_LEN 2000 diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index aa34279..e8e2768 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -34,16 +34,6 @@ #include "ftmod_sangoma_isdn.h" -ftdm_status_t cpy_calling_num_from_stack(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb); -ftdm_status_t cpy_called_num_from_stack(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb); -ftdm_status_t cpy_redir_num_from_stack(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb); -ftdm_status_t cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *display); - -ftdm_status_t cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm); -ftdm_status_t cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm); -ftdm_status_t cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm); -ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan); - ftdm_status_t sngisdn_check_free_ids(void); extern ftdm_sngisdn_data_t g_sngisdn_data; @@ -157,7 +147,7 @@ ftdm_status_t sng_isdn_set_avail_rate(ftdm_span_t *span, sngisdn_avail_t avail) return FTDM_SUCCESS; } -ftdm_status_t cpy_calling_num_from_stack(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb) +FT_DECLARE(ftdm_status_t) cpy_calling_num_from_stack(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb) { if (cgPtyNmb->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; @@ -184,7 +174,7 @@ ftdm_status_t cpy_calling_num_from_stack(ftdm_caller_data_t *ftdm, CgPtyNmb *cgP return FTDM_SUCCESS; } -ftdm_status_t cpy_called_num_from_stack(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb) +FT_DECLARE(ftdm_status_t) cpy_called_num_from_stack(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb) { if (cdPtyNmb->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; @@ -206,7 +196,7 @@ ftdm_status_t cpy_called_num_from_stack(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPt return FTDM_SUCCESS; } -ftdm_status_t cpy_redir_num_from_stack(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb) +FT_DECLARE(ftdm_status_t) cpy_redir_num_from_stack(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb) { if (redirNmb->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; @@ -226,7 +216,7 @@ ftdm_status_t cpy_redir_num_from_stack(ftdm_caller_data_t *ftdm, RedirNmb *redir return FTDM_SUCCESS; } -ftdm_status_t cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *display) +FT_DECLARE(ftdm_status_t) cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *display) { if (display->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; @@ -239,7 +229,7 @@ ftdm_status_t cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *dis return FTDM_SUCCESS; } -ftdm_status_t cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm) +FT_DECLARE(ftdm_status_t) cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm) { uint8_t len = strlen(ftdm->cid_num.digits); if (!len) { @@ -267,7 +257,7 @@ ftdm_status_t cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t * return FTDM_SUCCESS; } -ftdm_status_t cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm) +FT_DECLARE(ftdm_status_t) cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm) { uint8_t len = strlen(ftdm->dnis.digits); if (!len) { @@ -297,7 +287,7 @@ ftdm_status_t cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *f return FTDM_SUCCESS; } -ftdm_status_t cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm) +FT_DECLARE(ftdm_status_t) cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm) { uint8_t len = strlen(ftdm->rdnis.digits); if (!len) { @@ -329,7 +319,7 @@ ftdm_status_t cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_caller_data_t *ft } -ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan) +FT_DECLARE(ftdm_status_t) cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan) { uint8_t len; ftdm_caller_data_t *ftdm = &ftdmchan->caller_data; commit ced7c9ae43af218f2e02bf44032916498f7b90ab Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Mon Nov 15 12:33:58 2010 +0100 freetdm: Another round of parameter handling fixes (ftmod_{libpri,isdn,pritap}) ftmod_pritap: Abort before overflowing spanparameters array and initialize to all zero ftmod_isdn: Fix overflow check, skip over parameters without name or value, initialize spanparameters array to all zero. ftmod_libpri: Skip over parameters without name or value, initialize spanparameters array to all zero and drop "i < 10" hardcoded check. This should fix: 2010-11-15 09:24:34.609515 [ERR] ftmod_libpri.c:1741 Unknown parameter '', aborting configuration 2010-11-15 09:24:34.609515 [ERR] mod_freetdm.c:3080 Error configuring FreeTDM span BRI_1 Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> Reported-by: Ingmar Schraub <is@eseco.de> diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index aaddbf6..a410e4e 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -2937,15 +2937,22 @@ static switch_status_t load_config(void) continue; } - for (param = switch_xml_child(myspan, "param"); param && paramindex < 10; param = param->next) { + memset(spanparameters, 0, sizeof(spanparameters)); + + for (param = switch_xml_child(myspan, "param"); param; param = param->next) { char *var = (char *) switch_xml_attr_soft(param, "name"); char *val = (char *) switch_xml_attr_soft(param, "value"); - if (ftdm_array_len(spanparameters) == paramindex) { + if (ftdm_array_len(spanparameters) - 1 == paramindex) { ftdm_log(FTDM_LOG_ERROR, "Too many parameters for pri span '%s', ignoring everything after '%s'\n", name, var); break; } + if (ftdm_strlen_zero(var) || ftdm_strlen_zero(val)) { + ftdm_log(FTDM_LOG_WARNING, "Skipping parameter with empty name or value\n"); + continue; + } + if (!strcasecmp(var, "context")) { context = val; } else if (!strcasecmp(var, "dialplan")) { @@ -2995,11 +3002,18 @@ static switch_status_t load_config(void) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "span missing required attribute 'name'\n"); continue; } - + + memset(spanparameters, 0, sizeof(spanparameters)); + for (param = switch_xml_child(myspan, "param"); param; param = param->next) { char *var = (char *) switch_xml_attr_soft(param, "name"); char *val = (char *) switch_xml_attr_soft(param, "value"); + if (ftdm_array_len(spanparameters) - 1 == paramindex) { + ftdm_log(FTDM_LOG_ERROR, "Too many parameters for pritap span '%s', ignoring everything after '%s'\n", name, var); + break; + } + if (!strcasecmp(var, "context")) { context = val; } else if (!strcasecmp(var, "dialplan")) { @@ -3049,7 +3063,9 @@ static switch_status_t load_config(void) continue; } - for (param = switch_xml_child(myspan, "param"); param && paramindex < 10; param = param->next) { + memset(spanparameters, 0, sizeof(spanparameters)); + + for (param = switch_xml_child(myspan, "param"); param; param = param->next) { char *var = (char *) switch_xml_attr_soft(param, "name"); char *val = (char *) switch_xml_attr_soft(param, "value"); @@ -3058,6 +3074,11 @@ static switch_status_t load_config(void) break; } + if (ftdm_strlen_zero(var) || ftdm_strlen_zero(val)) { + ftdm_log(FTDM_LOG_WARNING, "Skipping parameter with empty name or value\n"); + continue; + } + if (!strcasecmp(var, "context")) { context = val; } else if (!strcasecmp(var, "dialplan")) { diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c index 1f90d48..491ef88 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@ -2667,7 +2667,12 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(isdn_configure_span) const char *var = ftdm_parameters[i].var; const char *val = ftdm_parameters[i].val; - if (!val) { + if (ftdm_strlen_zero(var)) { + ftdm_log(FTDM_LOG_WARNING, "Skipping variable with no name\n"); + continue; + } + + if (ftdm_strlen_zero(val)) { ftdm_log(FTDM_LOG_ERROR, "Variable '%s' has no value\n", var); return FTDM_FAIL; } diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 2d66235..21d6674 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -1704,11 +1704,16 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) return FTDM_FAIL; } - for (i = 0; i < 10 && ftdm_parameters[i].var; i++) { + for (i = 0; ftdm_parameters[i].var; i++) { const char *var = ftdm_parameters[i].var; const char *val = ftdm_parameters[i].val; - if (!val) { + if (ftdm_strlen_zero(var)) { + ftdm_log(FTDM_LOG_WARNING, "Skipping parameter with no name\n"); + continue; + } + + if (ftdm_strlen_zero(val)) { ftdm_log(FTDM_LOG_ERROR, "Parameter '%s' has no value\n", var); snprintf(span->last_error, sizeof(span->last_error), "Parameter [%s] has no value", var); return FTDM_FAIL; commit e98b4a6b8dccbd22e2bcccb04ae992633f7fee3c Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Mon Nov 15 11:38:45 2010 +0100 ftmod_libpri: Set RDNIS Signed-off-by: lakshmanan ganapathy <lakindia89@gmail.com> Reviewed-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index b423c51..2d66235 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -888,6 +888,7 @@ static int on_ring(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event ftdm_set_string(caller_data->cid_num.digits, (char *)pevent->ring.callingnum); ftdm_set_string(caller_data->ani.digits, (char *)pevent->ring.callingani); ftdm_set_string(caller_data->dnis.digits, (char *)pevent->ring.callednum); + ftdm_set_string(caller_data->rdnis.digits, (char *)pevent->ring.redirectingnum); if (!ftdm_strlen_zero((char *)pevent->ring.callingname)) { ftdm_set_string(caller_data->cid_name, (char *)pevent->ring.callingname); commit c1517e99d196754bd4089bfc4cdd344c126530e9 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Sun Nov 14 23:38:16 2010 +0100 ftmod_zt: B-Channels need to have audio mode disabled upon closing the channel. Preparation for fixing channel handling for BRI PTMP (Point-To-MultiPoint) setups. Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c index 692b505..ddf7b3f 100644 --- a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c +++ b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c @@ -658,6 +658,14 @@ static FIO_OPEN_FUNCTION(zt_open) */ static FIO_CLOSE_FUNCTION(zt_close) { + if (ftdmchan->type == FTDM_CHAN_TYPE_B) { + int value = 0; /* disable audio mode */ + if (ioctl(ftdmchan->sockfd, codes.AUDIOMODE, &value)) { + snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "%s", strerror(errno)); + ftdm_log(FTDM_LOG_ERROR, "%s\n", ftdmchan->last_error); + return FTDM_FAIL; + } + } return FTDM_SUCCESS; } commit 0286af421bb0ff4f391f56938ebbb25e99e84b46 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Sun Nov 14 18:04:19 2010 +0100 freeswitch: Update .gitignore file (libcodec2, esl binaries, mod_hash + mod_osp autogenerated files) Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/.gitignore b/.gitignore index 824abfc..adcfda3 100644 --- a/.gitignore +++ b/.gitignore @@ -108,5 +108,26 @@ libs/freetdm/testpri libs/freetdm/testr2 libs/freetdm/testsangomaboost libs/freetdm/testtones +libs/esl/fs_cli +libs/esl/ivrd +libs/esl/testserver +libs/esl/testclient +libs/libcodec2/Makefile +libs/libcodec2/Makefile.in +libs/libcodec2/config.guess +libs/libcodec2/config.sub +libs/libcodec2/configure +libs/libcodec2/depcomp +libs/libcodec2/install-sh +libs/libcodec2/libtool +libs/libcodec2/ltmain.sh +libs/libcodec2/missing +libs/libcodec2/src/Makefile +libs/libcodec2/src/Makefile.in +libs/libcodec2/unittest/Makefile +libs/libcodec2/unittest/Makefile.in src/mod/applications/mod_osp/Makefile - +src/mod/applications/mod_osp/Makefile.in +src/mod/applications/mod_hash/Makefile +src/mod/applications/mod_hash/Makefile.in +src/mod/applications/mod_hash/mod_hash.log commit 96b0ef9ce9ac14fadace32dd3a087d37b34c1c05 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Sun Nov 14 17:48:53 2010 +0100 ftmod_libpri: Use ftdm_array_len(), remove custom ARRAY_SIZE macro. Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index fdfdf79..b423c51 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -34,10 +34,6 @@ #include "private/ftdm_core.h" #include "ftmod_libpri.h" -#ifndef ARRAY_SIZE -#define ARRAY_SIZE(x) (sizeof((x)) / sizeof((x)[0])) -#endif - static void _ftdm_channel_set_state_force(ftdm_channel_t *chan, const ftdm_channel_state_t state) { assert(chan); @@ -198,7 +194,7 @@ static int parse_debug(const char *in, uint32_t *flags) return 0; } - for (i = 0; i < ARRAY_SIZE(ftdm_libpri_debug); i++) { + for (i = 0; i < ftdm_array_len(ftdm_libpri_debug); i++) { if (strstr(in, ftdm_libpri_debug[i].name)) { *flags |= ftdm_libpri_debug[i].flags; res = 0; @@ -222,7 +218,7 @@ static int print_debug(uint32_t flags, char *tmp, const int size) return 0; } - for (i = 0; i < ARRAY_SIZE(ftdm_libpri_debug); i++) { + for (i = 0; i < ftdm_array_len(ftdm_libpri_debug); i++) { if ((flags & ftdm_libpri_debug[i].flags) == ftdm_libpri_debug[i].flags) { res = snprintf(&tmp[offset], size - offset, "%s,", ftdm_libpri_debug[i].name); if (res <= 0 || res == (size - offset)) commit e17201bbac873aa79679fd0ca14f1edaa0747eff Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Sun Nov 14 17:43:38 2010 +0100 freetdm: Add ftdm_channel_get_state(), ftdm_channel_get_last_state() and ftdm_span_get_trunk_type_str(). Remove custom versions from ftmod_isdn and ftmod_libpri. Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index f02c9c4..1dada45 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -1915,6 +1915,11 @@ FT_DECLARE(ftdm_trunk_type_t) ftdm_span_get_trunk_type(const ftdm_span_t *span) return span->trunk_type; } +FT_DECLARE(const char *) ftdm_span_get_trunk_type_str(const ftdm_span_t *span) +{ + return ftdm_trunk_type2str(span->trunk_type); +} + FT_DECLARE(uint32_t) ftdm_span_get_id(const ftdm_span_t *span) { return span->span_id; @@ -2114,6 +2119,15 @@ FT_DECLARE(ftdm_caller_data_t *) ftdm_channel_get_caller_data(ftdm_channel_t *ft return &ftdmchan->caller_data; } +FT_DECLARE(int) ftdm_channel_get_state(const ftdm_channel_t *ftdmchan) +{ + int state; + ftdm_channel_lock(ftdmchan); + state = ftdmchan->state; + ftdm_channel_unlock(ftdmchan); + return state; +} + FT_DECLARE(const char *) ftdm_channel_get_state_str(const ftdm_channel_t *ftdmchan) { const char *state; @@ -2123,6 +2137,15 @@ FT_DECLARE(const char *) ftdm_channel_get_state_str(const ftdm_channel_t *ftdmch return state; } +FT_DECLARE(int) ftdm_channel_get_last_state(const ftdm_channel_t *ftdmchan) +{ + int last_state; + ftdm_channel_lock(ftdmchan); + last_state = ftdmchan->last_state; + ftdm_channel_unlock(ftdmchan); + return last_state; +} + FT_DECLARE(const char *) ftdm_channel_get_last_state_str(const ftdm_channel_t *ftdmchan) { const char *state; diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c index 03c027e..1f90d48 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@ -54,24 +54,6 @@ #define DEFAULT_NATIONAL_PREFIX "0" #define DEFAULT_INTERNATIONAL_PREFIX "00" -static const char *ftdm_span_get_trunk_type_str(const ftdm_span_t *span) -{ - assert(span); - return ftdm_trunk_type2str(span->trunk_type); -} - -static int ftdm_channel_get_state(const ftdm_channel_t *chan) -{ - assert(chan); - return chan->state; -} - -static int ftdm_channel_get_last_state(const ftdm_channel_t *chan) -{ - assert(chan); - return chan->last_state; -} - /***************************************************************************************** * PCAP * Based on Helmut Kuper's (<helmut.kuper@ewetel.de>) implementation, diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 1d1685f..fdfdf79 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -34,30 +34,16 @@ #include "private/ftdm_core.h" #include "ftmod_libpri.h" -/*** - * Move to core - ***/ #ifndef ARRAY_SIZE #define ARRAY_SIZE(x) (sizeof((x)) / sizeof((x)[0])) #endif -static ftdm_channel_state_t ftdm_channel_get_state(const ftdm_channel_t *chan) -{ - assert(chan); - return chan->state; -} - static void _ftdm_channel_set_state_force(ftdm_channel_t *chan, const ftdm_channel_state_t state) { assert(chan); chan->state = state; } -static const char *ftdm_span_get_trunk_type_str(const ftdm_span_t *span) -{ - return ftdm_trunk_type2str(span->trunk_type); -} - /** * \brief Unloads libpri IO module * \return Success diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 64ecc2e..31bc88b 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -1240,6 +1240,9 @@ FT_DECLARE(void) ftdm_span_set_trunk_type(ftdm_span_t *span, ftdm_trunk_type_t t */ FT_DECLARE(ftdm_trunk_type_t) ftdm_span_get_trunk_type(const ftdm_span_t *span); +/*! \brief For display debugging purposes you can display this string which describes the trunk type of a span */ +FT_DECLARE(const char *) ftdm_span_get_trunk_type_str(const ftdm_span_t *span); + /*! * \brief Return the channel identified by the provided id * @@ -1259,6 +1262,12 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_set_caller_data(ftdm_channel_t *ftdmchan, /*! \brief Get the caller data for a channel, typically you need this when receiving FTDM_SIGEVENT_START */ FT_DECLARE(ftdm_caller_data_t *) ftdm_channel_get_caller_data(ftdm_channel_t *channel); +/*! \brief Get current state of a channel */ +FT_DECLARE(int) ftdm_channel_get_state(const ftdm_channel_t *ftdmchan); + +/*! \brief Get last state of a channel */ +FT_DECLARE(int) ftdm_channel_get_last_state(const ftdm_channel_t *ftdmchan); + /*! \brief For display debugging purposes you can display this string which describes the current channel internal state */ FT_DECLARE(const char *) ftdm_channel_get_state_str(const ftdm_channel_t *channel); commit 4f4aee4f07e2cd748b5625b92ddded79ad779a18 Merge: c12f81c b0cca15 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Sun Nov 14 16:47:43 2010 +0100 Merge branch 'ftmod_isdn' commit b0cca151e60063868b929b5826533850569d718b Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Sun Nov 14 16:45:35 2010 +0100 ftmod_isdn: Major cleanup: use accessor functions, coding-style, etc. Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c index c5294bf..03c027e 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@ -56,9 +56,22 @@ static const char *ftdm_span_get_trunk_type_str(const ftdm_span_t *span) { + assert(span); return ftdm_trunk_type2str(span->trunk_type); } +static int ftdm_channel_get_state(const ftdm_channel_t *chan) +{ + assert(chan); + return chan->state; +} + +static int ftdm_channel_get_last_state(const ftdm_channel_t *chan) +{ + assert(chan); + return chan->last_state; +} + /***************************************************************************************** * PCAP * Based on Helmut Kuper's (<helmut.kuper@ewetel.de>) implementation, @@ -95,13 +108,8 @@ static ftdm_status_t isdn_pcap_open(struct ftdm_isdn_data *isdn, char *filename) { struct pcap_context *pcap = NULL; - if (!isdn) { - return FTDM_FAIL; - } - - if (ftdm_strlen_zero(filename)) { + if (!isdn || ftdm_strlen_zero(filename)) return FTDM_FAIL; - } pcap = malloc(sizeof(struct pcap_context)); if (!pcap) { @@ -121,23 +129,20 @@ static ftdm_status_t isdn_pcap_open(struct ftdm_isdn_data *isdn, char *filename) pcap->dump = pcap_dump_open(pcap->handle, pcap->filename); if (!pcap->dump) { - ftdm_log(FTDM_LOG_ERROR, "Failed to open capture file: %s\n", pcap_geterr(pcap->handle)); + ftdm_log(FTDM_LOG_ERROR, "Failed to open capture file: '%s'\n", pcap_geterr(pcap->handle)); goto error; } - ftdm_log(FTDM_LOG_INFO, "Capture file \"%s\" opened\n", pcap->filename); + ftdm_log(FTDM_LOG_INFO, "Capture file '%s' opened\n", pcap->filename); isdn->pcap = pcap; return FTDM_SUCCESS; - error: - if (pcap->handle) { + if (pcap->handle) pcap_close(pcap->handle); - } - if (pcap->filename) { + if (pcap->filename) free(pcap->filename); - } free(pcap); @@ -149,9 +154,9 @@ static ftdm_status_t isdn_pcap_close(struct ftdm_isdn_data *isdn) struct pcap_context *pcap = NULL; long size; - if (!isdn || !isdn->pcap) { + if (!isdn || !isdn->pcap) return FTDM_FAIL; - } + pcap = isdn->pcap; isdn->flags &= ~(FTDM_ISDN_CAPTURE | FTDM_ISDN_CAPTURE_L3ONLY); @@ -160,7 +165,7 @@ static ftdm_status_t isdn_pcap_close(struct ftdm_isdn_data *isdn) pcap_dump_flush(pcap->dump); size = pcap_dump_ftell(pcap->dump); - ftdm_log(FTDM_LOG_INFO, "File \"%s\" captured %ld bytes of data\n", pcap->filename, size); + ftdm_log(FTDM_LOG_INFO, "File '%s' captured %ld bytes of data\n", pcap->filename, size); pcap_dump_close(pcap->dump); pcap_close(pcap->handle); @@ -214,9 +219,8 @@ static ftdm_status_t isdn_pcap_write(struct ftdm_isdn_data *isdn, unsigned char int offset = sizeof(struct isdn_sll_hdr); int nbytes; - if (!isdn || !isdn->pcap || !buf || !len) { + if (!isdn || !isdn->pcap || !buf || !len) return FTDM_FAIL; - } pcap = isdn->pcap; @@ -436,7 +440,7 @@ static FIO_CHANNEL_REQUEST_FUNCTION(isdn_channel_request) isdn_data->outbound_crv[gen->CRV] = caller_data; //isdn_data->channels_local_crv[gen->CRV] = ftdmchan; - while(ftdm_running() && caller_data->call_state == FTDM_CALLER_STATE_DIALING) { + while (ftdm_running() && caller_data->call_state == FTDM_CALLER_STATE_DIALING) { ftdm_sleep(1); if (!--sanity) { @@ -451,8 +455,8 @@ static FIO_CHANNEL_REQUEST_FUNCTION(isdn_channel_request) int fail = 1; new_chan = NULL; - if (caller_data->chan_id < FTDM_MAX_CHANNELS_SPAN && caller_data->chan_id <= span->chan_count) { - new_chan = span->channels[caller_data->chan_id]; + if (caller_data->chan_id > 0 && caller_data->chan_id <= ftdm_span_get_chan_count(span)) { + new_chan = ftdm_span_get_channel(span, caller_data->chan_id); } if (new_chan && (status = ftdm_channel_open_chan(new_chan) == FTDM_SUCCESS)) { @@ -570,10 +574,8 @@ static void ftdm_isdn_call_event(struct Q931_Call *call, struct Q931_CallEvent * /* * Global event */ - ftdm_log(FTDM_LOG_DEBUG, "Received global event from Q.931\n"); - } - else { + } else { ftdm_channel_t *ftdmchan = NULL; ftdm_sigmsg_t sig; int call_crv = Q931CallGetCRV(call); @@ -716,9 +718,8 @@ static void __isdn_get_number(const char *digits, const int ton, char *buf, int { int offset = 0; - if (!digits || !buf || size <= 0) { + if (!digits || !buf || size <= 0) return; - } switch (ton) { case Q931_TON_NATIONAL: @@ -747,24 +748,23 @@ static void __isdn_get_number(const char *digits, const int ton, char *buf, int */ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic *msg, int mlen) { + Q931mes_Generic *gen = (Q931mes_Generic *) msg; ftdm_span_t *span = (ftdm_span_t *) pvt; ftdm_isdn_data_t *isdn_data = span->signal_data; - Q931mes_Generic *gen = (Q931mes_Generic *) msg; + ftdm_channel_t *ftdmchan = NULL; int chan_id = 0; int chan_hunt = 0; - ftdm_channel_t *ftdmchan = NULL; -// ftdm_caller_data_t *caller_data = NULL; if (Q931IsIEPresent(gen->ChanID)) { Q931ie_ChanID *chanid = Q931GetIEPtr(gen->ChanID, gen->buf); - if(chanid->IntType) + if (chanid->IntType) chan_id = chanid->ChanSlot; else chan_id = chanid->InfoChanSel; /* "any" channel specified */ - if(chanid->InfoChanSel == 3) { + if (chanid->InfoChanSel == 3) { chan_hunt++; } } else if (FTDM_SPAN_IS_NT(span)) { @@ -810,9 +810,7 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic case Q931mes_ALERTING: case Q931mes_PROGRESS: case Q931mes_CONNECT: - { - caller_data->call_state = FTDM_CALLER_STATE_SUCCESS; - } + caller_data->call_state = FTDM_CALLER_STATE_SUCCESS; break; default: caller_data->call_state = FTDM_CALLER_STATE_FAIL; @@ -829,8 +827,12 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic ftdmchan = isdn_data->channels_remote_crv[gen->CRV]; } - ftdm_log(FTDM_LOG_DEBUG, "ftdmchan %x (%d:%d) source isdn_data->channels_%s_crv[%#hx]\n", ftdmchan, ftdmchan ? ftdmchan->span_id : -1, ftdmchan ? ftdmchan->chan_id : -1, gen->CRVFlag ? "local" : "remote", gen->CRV); - + ftdm_log(FTDM_LOG_DEBUG, "ftdmchan %x (%d:%d) source isdn_data->channels_%s_crv[%#hx]\n", + ftdmchan, + ((ftdmchan) ? ftdm_channel_get_span_id(ftdmchan) : -1), + ((ftdmchan) ? ftdm_channel_get_id(ftdmchan) : -1), + ((gen->CRVFlag) ? "local" : "remote"), + gen->CRV); if (gen->ProtDisc == 3) { switch(gen->MesType) { @@ -842,7 +844,9 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic case 0: /* change status to "in service" */ { ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_SUSPENDED); - ftdm_log(FTDM_LOG_DEBUG, "Channel %d:%d in service\n", ftdmchan->span_id, ftdmchan->chan_id); + ftdm_log(FTDM_LOG_DEBUG, "Channel %d:%d in service\n", + ftdm_channel_get_span_id(ftdmchan), + ftdm_channel_get_id(ftdmchan)); ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); } break; @@ -874,19 +878,20 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic case Q931mes_RESTART: { if (chan_id) { - ftdmchan = span->channels[chan_id]; + ftdmchan = ftdm_span_get_channel(span, chan_id); } if (ftdmchan) { ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); } else { uint32_t i; - for (i = 1; i < span->chan_count; i++) { + for (i = 1; i < ftdm_span_get_chan_count(span); i++) { /* Skip channels that are down and D-Channels (#OpenZAP-39) */ - if (span->channels[i]->state == FTDM_CHANNEL_STATE_DOWN || span->channels[i]->type == FTDM_CHAN_TYPE_DQ921) + if (ftdm_channel_get_state(span->channels[i]) == FTDM_CHANNEL_STATE_DOWN || + ftdm_channel_get_type(span->channels[i]) == FTDM_CHAN_TYPE_DQ921) continue; - ftdm_set_state_locked((span->channels[i]), FTDM_CHANNEL_STATE_RESTART); + ftdm_set_state_locked(span->channels[i], FTDM_CHANNEL_STATE_RESTART); } } } @@ -896,15 +901,17 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic { const char *what = gen->MesType == Q931mes_RELEASE ? "Release" : "Release Complete"; if (ftdmchan) { - if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING || ftdmchan->state == FTDM_CHANNEL_STATE_HANGUP) { + if (ftdm_channel_get_state(ftdmchan) == FTDM_CHANNEL_STATE_TERMINATING || + ftdm_channel_get_state(ftdmchan) == FTDM_CHANNEL_STATE_HANGUP) + { if (gen->MesType == Q931mes_RELEASE) { ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); } else { ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); } } - else if((gen->MesType == Q931mes_RELEASE && ftdmchan->state <= FTDM_CHANNEL_STATE_UP) || - (gen->MesType == Q931mes_RELEASE_COMPLETE && ftdmchan->state == FTDM_CHANNEL_STATE_DIALING)) { + else if ((gen->MesType == Q931mes_RELEASE && ftdm_channel_get_state(ftdmchan) <= FTDM_CHANNEL_STATE_UP) || + (gen->MesType == Q931mes_RELEASE_COMPLETE && ftdm_channel_get_state(ftdmchan) == FTDM_CHANNEL_STATE_DIALING)) { /* * Don't keep inbound channels open if the remote side hangs up before we answered @@ -914,18 +921,20 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic ftdm_status_t status; memset(&sig, 0, sizeof(sig)); - sig.chan_id = ftdmchan->chan_id; - sig.span_id = ftdmchan->span_id; + sig.span_id = ftdm_channel_get_span_id(ftdmchan); + sig.chan_id = ftdm_channel_get_id(ftdmchan); sig.channel = ftdmchan; sig.channel->caller_data.hangup_cause = (cause) ? cause->Value : FTDM_CAUSE_NORMAL_UNSPECIFIED; sig.event_id = FTDM_SIGEVENT_STOP; status = isdn_data->sig_cb(&sig); - ftdm_log(FTDM_LOG_DEBUG, "Received %s in state %s, requested hangup for channel %d:%d\n", what, ftdm_channel_state2str(ftdmchan->state), ftdmchan->span_id, chan_id); - } - else { - ftdm_log(FTDM_LOG_DEBUG, "Ignoring %s on channel %d\n", what, chan_id); + ftdm_log(FTDM_LOG_DEBUG, "Received %s in state %s, requested hangup for channel %d:%d\n", what, + ftdm_channel_get_state_str(ftdmchan), + ftdm_channel_get_span_id(ftdmchan), + ftdm_channel_get_id(ftdmchan)); + } else { + ftdm_log(FTDM_LOG_DEBUG, "Ignoring %s on channel %d\n", what, ftdm_channel_get_id(ftdmchan)); } } else { ftdm_log(FTDM_LOG_CRIT, "Received %s with no matching channel %d\n", what, chan_id); @@ -982,18 +991,18 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic { Q931ie_CallingNum *callingnum = Q931GetIEPtr(gen->CallingNum, gen->buf); Q931ie_CalledNum *callednum = Q931GetIEPtr(gen->CalledNum, gen->buf); - int fail = 1; - int fail_cause = 0; - int overlap_dial = 0; uint32_t cplen = mlen; + int overlap_dial = 0; + int fail_cause = 0; + int fail = 1; - if(ftdmchan && ftdmchan == isdn_data->channels_remote_crv[gen->CRV]) { + if (ftdmchan && ftdmchan == isdn_data->channels_remote_crv[gen->CRV]) { ftdm_log(FTDM_LOG_INFO, "Duplicate SETUP message(?) for Channel %d:%d ~ %d:%d in state %s [ignoring]\n", - ftdmchan->span_id, - ftdmchan->chan_id, - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id, - ftdm_channel_state2str(ftdmchan->state)); + ftdm_channel_get_span_id(ftdmchan), + ftdm_channel_get_id(ftdmchan), + ftdm_channel_get_ph_span_id(ftdmchan), + ftdm_channel_get_ph_id(ftdmchan), + ftdm_channel_get_state_str(ftdmchan)); break; } @@ -1008,10 +1017,10 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic * In NT-mode with channel selection "any", * try to find a free channel */ - for (x = 1; x <= span->chan_count; x++) { - ftdm_channel_t *zc = span->channels[x]; + for (x = 1; x <= ftdm_span_get_chan_count(span); x++) { + ftdm_channel_t *zc = ftdm_span_get_channel(span, x); - if (!ftdm_test_flag(zc, FTDM_CHANNEL_INUSE) && zc->state == FTDM_CHANNEL_STATE_DOWN) { + if (!ftdm_test_flag(zc, FTDM_CHANNEL_INUSE) && ftdm_channel_get_state(zc) == FTDM_CHANNEL_STATE_DOWN) { ftdmchan = zc; break; } @@ -1032,8 +1041,8 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic * TODO: NT mode is abled to select a different channel if the one chosen * by the TE side is already in use */ - if (chan_id > 0 && chan_id < FTDM_MAX_CHANNELS_SPAN && chan_id <= span->chan_count) { - ftdmchan = span->channels[chan_id]; + if (chan_id > 0 && chan_id < FTDM_MAX_CHANNELS_SPAN && chan_id <= ftdm_span_get_chan_count(span)) { + ftdmchan = ftdm_span_get_channel(span, chan_id); } else { /* invalid channel id */ @@ -1047,22 +1056,22 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic if (FTDM_SPAN_IS_NT(span)) { ftdm_log(FTDM_LOG_NOTICE, "No destination number found, assuming overlap dial\n"); overlap_dial++; - } - else { + } else { ftdm_log(FTDM_LOG_ERROR, "No destination number found\n"); ftdmchan = NULL; } } if (ftdmchan) { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE) || ftdmchan->state != FTDM_CHANNEL_STATE_DOWN) { - if (ftdmchan->state == FTDM_CHANNEL_STATE_DOWN || ftdmchan->state >= FTDM_CHANNEL_STATE_TERMINATING) { + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE) || ftdm_channel_get_state(ftdmchan) != FTDM_CHANNEL_STATE_DOWN) { + if (ftdm_channel_get_state(ftdmchan) == FTDM_CHANNEL_STATE_DOWN || ftdm_channel_get_state(ftdmchan) >= FTDM_CHANNEL_STATE_TERMINATING) + { int x = 0; ftdm_log(FTDM_LOG_WARNING, "Channel %d:%d ~ %d:%d is already in use waiting for it to become available.\n", - ftdmchan->span_id, - ftdmchan->chan_id, - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id); + ftdm_channel_get_span_id(ftdmchan), + ftdm_channel_get_id(ftdmchan), + ftdm_channel_get_ph_span_id(ftdmchan), + ftdm_channel_get_ph_id(ftdmchan)); for (x = 0; x < 200; x++) { if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)) { @@ -1073,16 +1082,17 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic } if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)) { ftdm_log(FTDM_LOG_ERROR, "Channel %d:%d ~ %d:%d is already in use.\n", - ftdmchan->span_id, - ftdmchan->chan_id, - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id - ); + ftdm_channel_get_span_id(ftdmchan), + ftdm_channel_get_id(ftdmchan), + ftdm_channel_get_ph_span_id(ftdmchan), + ftdm_channel_get_ph_id(ftdmchan)); ftdmchan = NULL; } } - if (ftdmchan && ftdmchan->state == FTDM_CHANNEL_STATE_DOWN) { + if (ftdmchan && ftdm_channel_get_state(ftdmchan) == FTDM_CHANNEL_STATE_DOWN) { + ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(ftdmchan); + isdn_data->channels_remote_crv[gen->CRV] = ftdmchan; memset(&ftdmchan->caller_data, 0, sizeof(ftdmchan->caller_data)); @@ -1091,34 +1101,32 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic } /* copy number readd prefix as needed */ - isdn_get_number(callingnum, ftdmchan->caller_data.cid_num.digits); - isdn_get_number(callingnum, ftdmchan->caller_data.cid_name); - isdn_get_number(callingnum, ftdmchan->caller_data.ani.digits); + isdn_get_number(callingnum, caller_data->cid_num.digits); + isdn_get_number(callingnum, caller_data->cid_name); + isdn_get_number(callingnum, caller_data->ani.digits); -// ftdm_set_string(ftdmchan->caller_data.cid_num.digits, (char *)callingnum->Digit); -// ftdm_set_string(ftdmchan->caller_data.cid_name, (char *)callingnum->Digit); -// ftdm_set_string(ftdmchan->caller_data.ani.digits, (char *)callingnum->Digit); if (!overlap_dial) { -// ftdm_set_string(ftdmchan->caller_data.dnis.digits, (char *)callednum->Digit); - isdn_get_number(callednum, ftdmchan->caller_data.dnis.digits); + isdn_get_number(callednum, caller_data->dnis.digits); } #ifdef __TODO_OR_REMOVE__ ftdmchan->caller_data.CRV = gen->CRV; #endif - if (cplen > sizeof(ftdmchan->caller_data.raw_data)) { - cplen = sizeof(ftdmchan->caller_data.raw_data); + if (cplen > sizeof(caller_data->raw_data)) { + cplen = sizeof(caller_data->raw_data); } gen->CRVFlag = !(gen->CRVFlag); - memcpy(ftdmchan->caller_data.raw_data, msg, cplen); - ftdmchan->caller_data.raw_data_len = cplen; + memcpy(caller_data->raw_data, msg, cplen); + caller_data->raw_data_len = cplen; fail = 0; } } if (fail) { Q931ie_Cause cause; + gen->MesType = Q931mes_DISCONNECT; gen->CRVFlag = 1; /* inbound call */ + cause.IEId = Q931ie_CAUSE; cause.Size = sizeof(Q931ie_Cause); cause.CodStand = Q931_CODING_ITU; @@ -1149,12 +1157,12 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic Q931InitIEChanID(&ChanID); ChanID.IntType = FTDM_SPAN_IS_BRI(ftdmchan->span) ? 0 : 1; /* PRI = 1, BRI = 0 */ ChanID.PrefExcl = FTDM_SPAN_IS_NT(ftdmchan->span) ? 1 : 0; /* Exclusive in NT-mode = 1, Preferred otherwise = 0 */ - if(ChanID.IntType) { + if (ChanID.IntType) { ChanID.InfoChanSel = 1; /* None = 0, See Slot = 1, Any = 3 */ ChanID.ChanMapType = 3; /* B-Chan */ - ChanID.ChanSlot = (unsigned char)ftdmchan->chan_id; + ChanID.ChanSlot = (unsigned char)ftdm_channel_get_id(ftdmchan); } else { - ChanID.InfoChanSel = (unsigned char)ftdmchan->chan_id & 0x03; /* None = 0, B1 = 1, B2 = 2, Any = 3 */ + ChanID.InfoChanSel = (unsigned char)ftdm_channel_get_id(ftdmchan) & 0x03; /* None = 0, B1 = 1, B2 = 2, Any = 3 */ } gen->ChanID = Q931AppendIE(gen, (L3UCHAR *) &ChanID); @@ -1192,7 +1200,7 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic case Q931mes_CALL_PROCEEDING: { if (ftdmchan) { - ftdm_log(FTDM_LOG_CRIT, "Received CALL PROCEEDING message for channel %d\n", chan_id); + ftdm_log(FTDM_LOG_CRIT, "Received CALL PROCEEDING message for channel %d\n", ftdm_channel_get_id(ftdmchan)); ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); } else { ftdm_log(FTDM_LOG_CRIT, "Received CALL PROCEEDING with no matching channel %d\n", chan_id); @@ -1202,7 +1210,7 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic case Q931mes_CONNECT_ACKNOWLEDGE: { if (ftdmchan) { - ftdm_log(FTDM_LOG_DEBUG, "Received CONNECT_ACK message for channel %d\n", chan_id); + ftdm_log(FTDM_LOG_DEBUG, "Received CONNECT_ACK message for channel %d\n", ftdm_channel_get_id(ftdmchan)); } else { ftdm_log(FTDM_LOG_DEBUG, "Received CONNECT_ACK with no matching channel %d\n", chan_id); } @@ -1212,9 +1220,9 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic case Q931mes_INFORMATION: { if (ftdmchan) { - ftdm_log(FTDM_LOG_CRIT, "Received INFORMATION message for channel %d\n", ftdmchan->chan_id); + ftdm_log(FTDM_LOG_CRIT, "Received INFORMATION message for channel %d\n", ftdm_channel_get_id(ftdmchan)); - if (ftdmchan->state == FTDM_CHANNEL_STATE_DIALTONE) { + if (ftdm_channel_get_state(ftdmchan) == FTDM_CHANNEL_STATE_DIALTONE) { char digit = '\0'; /* @@ -1232,7 +1240,7 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic /* TODO: make this more safe with strncat() */ pos = strlen(ftdmchan->caller_data.dnis.digits); - strcat(&ftdmchan->caller_data.dnis.digits[pos], (char *)callednum->Digit); + strcat(&ftdmchan->caller_data.dnis.digits[pos], (char *)callednum->Digit); /* update timer */ data->digit_timeout = ftdm_time_now() + isdn_data->digit_timeout; @@ -1312,14 +1320,16 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) ftdm_status_t status; ftdm_log(FTDM_LOG_DEBUG, "%d:%d STATE [%s]\n", - ftdmchan->span_id, ftdmchan->chan_id, ftdm_channel_state2str(ftdmchan->state)); + ftdm_channel_get_span_id(ftdmchan), + ftdm_channel_get_id(ftdmchan), + ftdm_channel_get_state_str(ftdmchan)); memset(&sig, 0, sizeof(sig)); - sig.chan_id = ftdmchan->chan_id; - sig.span_id = ftdmchan->span_id; + sig.span_id = ftdm_channel_get_span_id(ftdmchan); + sig.chan_id = ftdm_channel_get_id(ftdmchan); sig.channel = ftdmchan; - switch (ftdmchan->state) { + switch (ftdm_channel_get_state(ftdmchan)) { case FTDM_CHANNEL_STATE_DOWN: { if (gen->CRV) { @@ -1348,22 +1358,22 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) gen->CRV = crv; gen->CRVFlag = 1; /* inbound */ - if (FTDM_SPAN_IS_NT(ftdmchan->span)) { + if (FTDM_SPAN_IS_NT(ftdm_channel_get_span(ftdmchan))) { Q931ie_ChanID ChanID; /* * Set new Channel ID */ Q931InitIEChanID(&ChanID); - ChanID.IntType = FTDM_SPAN_IS_BRI(ftdmchan->span) ? 0 : 1; /* PRI = 1, BRI = 0 */ + ChanID.IntType = FTDM_SPAN_IS_BRI(ftdm_channel_get_span(ftdmchan)) ? 0 : 1; /* PRI = 1, BRI = 0 */ ChanID.PrefExcl = 1; /* always exclusive in NT-mode */ - if(ChanID.IntType) { + if (ChanID.IntType) { ChanID.InfoChanSel = 1; /* None = 0, See Slot = 1, Any = 3 */ ChanID.ChanMapType = 3; /* B-Chan */ - ChanID.ChanSlot = (unsigned char)ftdmchan->chan_id; + ChanID.ChanSlot = (unsigned char)ftdm_channel_get_id(ftdmchan); } else { - ChanID.InfoChanSel = (unsigned char)ftdmchan->chan_id & 0x03; /* None = 0, B1 = 1, B2 = 2, Any = 3 */ + ChanID.InfoChanSel = (unsigned char)ftdm_channel_get_id(ftdmchan) & 0x03; /* None = 0, B1 = 1, B2 = 2, Any = 3 */ } gen->ChanID = Q931AppendIE(gen, (L3UCHAR *) &ChanID); } @@ -1442,6 +1452,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) break; case FTDM_CHANNEL_STATE_DIALING: if (!(isdn_data->opts & FTDM_ISDN_OPT_SUGGEST_CHANNEL)) { + ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(ftdmchan); Q931ie_BearerCap BearerCap; Q931ie_ChanID ChanID; Q931ie_CallingNum CallingNum; @@ -1456,7 +1467,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) /* * get codec type */ - ftdm_channel_command(ftdmchan->span->channels[ftdmchan->chan_id], FTDM_COMMAND_GET_NATIVE_CODEC, &codec); + ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_NATIVE_CODEC, &codec); /* * Q.931 Setup Message @@ -1481,14 +1492,14 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) * ChannelID IE */ Q931InitIEChanID(&ChanID); - ChanID.IntType = FTDM_SPAN_IS_BRI(ftdmchan->span) ? 0 : 1; /* PRI = 1, BRI = 0 */ - ChanID.PrefExcl = FTDM_SPAN_IS_NT(ftdmchan->span) ? 1 : 0; /* Exclusive in NT-mode = 1, Preferred otherwise = 0 */ - if(ChanID.IntType) { + ChanID.IntType = FTDM_SPAN_IS_BRI(ftdm_channel_get_span(ftdmchan)) ? 0 : 1; /* PRI = 1, BRI = 0 */ + ChanID.PrefExcl = FTDM_SPAN_IS_NT(ftdm_channel_get_span(ftdmchan)) ? 1 : 0; /* Exclusive in NT-mode = 1, Preferred otherwise = 0 */ + if (ChanID.IntType) { ChanID.InfoChanSel = 1; /* None = 0, See Slot = 1, Any = 3 */ ChanID.ChanMapType = 3; /* B-Chan */ - ChanID.ChanSlot = (unsigned char)ftdmchan->chan_id; + ChanID.ChanSlot = (unsigned char)ftdm_channel_get_id(ftdmchan); } else { - ChanID.InfoChanSel = (unsigned char)ftdmchan->chan_id & 0x03; /* None = 0, B1 = 1, B2 = 2, Any = 3 */ + ChanID.InfoChanSel = (unsigned char)ftdm_channel_get_id(ftdmchan) & 0x03; /* None = 0, B1 = 1, B2 = 2, Any = 3 */ } gen->ChanID = Q931AppendIE(gen, (L3UCHAR *) &ChanID); @@ -1504,26 +1515,26 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) /* * Display IE */ - if (!(isdn_data->opts & FTDM_ISDN_OPT_OMIT_DISPLAY_IE) && FTDM_SPAN_IS_NT(ftdmchan->span)) { + if (!(isdn_data->opts & FTDM_ISDN_OPT_OMIT_DISPLAY_IE) && FTDM_SPAN_IS_NT(ftdm_channel_get_span(ftdmchan))) { Q931InitIEDisplay(&Display); - Display.Size = Display.Size + (unsigned char)strlen(ftdmchan->caller_data.cid_name); + Display.Size = Display.Size + (unsigned char)strlen(caller_data->cid_name); gen->Display = Q931AppendIE(gen, (L3UCHAR *) &Display); ptrDisplay = Q931GetIEPtr(gen->Display, gen->buf); - ftdm_copy_string((char *)ptrDisplay->Display, ftdmchan->caller_data.cid_name, strlen(ftdmchan->caller_data.cid_name)+1); + ftdm_copy_string((char *)ptrDisplay->Display, caller_data->cid_name, strlen(caller_data->cid_name) + 1); } /* * CallingNum IE */ Q931InitIECallingNum(&CallingNum); - CallingNum.TypNum = ftdmchan->caller_data.ani.type; + CallingNum.TypNum = caller_data->ani.type; CallingNum.NumPlanID = Q931_NUMPLAN_E164; CallingNum.PresInd = Q931_PRES_ALLOWED; CallingNum.ScreenInd = Q931_SCREEN_USER_NOT_SCREENED; - CallingNum.Size = CallingNum.Size + (unsigned char)strlen(ftdmchan->caller_data.cid_num.digits); + CallingNum.Size = CallingNum.Size + (unsigned char)strlen(caller_data->cid_num.digits); gen->CallingNum = Q931AppendIE(gen, (L3UCHAR *) &CallingNum); ptrCallingNum = Q931GetIEPtr(gen->CallingNum, gen->buf); - ftdm_copy_string((char *)ptrCallingNum->Digit, ftdmchan->caller_data.cid_num.digits, strlen(ftdmchan->caller_data.cid_num.digits)+1); + ftdm_copy_string((char *)ptrCallingNum->Digit, caller_data->cid_num.digits, strlen(caller_data->cid_num.digits) + 1); /* * CalledNum IE @@ -1531,10 +1542,10 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) Q931InitIECalledNum(&CalledNum); CalledNum.TypNum = Q931_TON_UNKNOWN; CalledNum.NumPlanID = Q931_NUMPLAN_E164; - CalledNum.Size = CalledNum.Size + (unsigned char)strlen(ftdmchan->caller_data.ani.digits); + CalledNum.Size = CalledNum.Size + (unsigned char)strlen(caller_data->ani.digits); gen->CalledNum = Q931AppendIE(gen, (L3UCHAR *) &CalledNum); ptrCalledNum = Q931GetIEPtr(gen->CalledNum, gen->buf); - ftdm_copy_string((char *)ptrCalledNum->Digit, ftdmchan->caller_data.ani.digits, strlen(ftdmchan->caller_data.ani.digits)+1); + ftdm_copy_string((char *)ptrCalledNum->Digit, caller_data->ani.digits, strlen(caller_data->ani.digits) + 1); /* * High-Layer Compatibility IE (Note: Required for AVM FritzBox) @@ -1559,7 +1570,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) call = Q931GetCallByCRV(&isdn_data->q931, gen->CRV); if (call) { ftdm_log(FTDM_LOG_DEBUG, "Storing reference to current span in call %d [0x%x]\n", gen->CRV, gen->CRV); - Q931CallSetPrivate(call, ftdmchan->span); + Q931CallSetPrivate(call, ftdm_channel_get_span(ftdmchan)); } } } @@ -1567,7 +1578,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: { /* reply RELEASE with RELEASE_COMPLETE message */ - if(ftdmchan->last_state == FTDM_CHANNEL_STATE_HANGUP) { + if (ftdm_channel_get_last_state(ftdmchan) == FTDM_CHANNEL_STATE_HANGUP) { gen->MesType = Q931mes_RELEASE_COMPLETE; Q931Rx43(&isdn_data->q931, gen, gen->Size); @@ -1577,6 +1588,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) break; case FTDM_CHANNEL_STATE_HANGUP: { + ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(ftdmchan); Q931ie_Cause cause; ftdm_log(FTDM_LOG_DEBUG, "Hangup: Direction %s\n", ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) ? "Outbound" : "Inbound"); @@ -1593,7 +1605,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) * BRI PTMP needs special handling here... * TODO: cleanup / refine (see above) */ - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_RING) { + if (ftdm_channel_get_last_state(ftdmchan) == FTDM_CHANNEL_STATE_RING) { /* * inbound call [was: number unknown (= not found in routing state)] * (in Q.931 spec terms: Reject request) @@ -1601,7 +1613,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) gen->MesType = Q931mes_RELEASE_COMPLETE; //cause.Value = (unsigned char) FTDM_CAUSE_UNALLOCATED; - cause.Value = (unsigned char) ftdmchan->caller_data.hangup_cause; + cause.Value = (unsigned char) caller_data->hangup_cause; *cause.Diag = '\0'; gen->Cause = Q931AppendIE(gen, (L3UCHAR *) &cause); Q931Rx43(&isdn_data->q931, gen, gen->Size); @@ -1610,13 +1622,13 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) //ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); } - else if (ftdmchan->last_state <= FTDM_CHANNEL_STATE_PROGRESS) { + else if (ftdm_channel_get_last_state(ftdmchan) <= FTDM_CHANNEL_STATE_PROGRESS) { /* * just release all unanswered calls [was: inbound call, remote side hung up before we answered] */ gen->MesType = Q931mes_RELEASE; - cause.Value = (unsigned char) ftdmchan->caller_data.hangup_cause; + cause.Value = (unsigned char) caller_data->hangup_cause; *cause.Diag = '\0'; gen->Cause = Q931AppendIE(gen, (L3UCHAR *) &cause); Q931Rx43(&isdn_data->q931, gen, gen->Size); @@ -1630,7 +1642,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) */ gen->MesType = Q931mes_DISCONNECT; - cause.Value = (unsigned char) ftdmchan->caller_data.hangup_cause; + cause.Value = (unsigned char) caller_data->hangup_cause; *cause.Diag = '\0'; gen->Cause = Q931AppendIE(gen, (L3UCHAR *) &cause); Q931Rx43(&isdn_data->q931, gen, gen->Size); @@ -1643,6 +1655,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) sig.event_id = FTDM_SIGEVENT_STOP; status = isdn_data->sig_cb(&sig); + gen->MesType = Q931mes_RELEASE; gen->CRVFlag = ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) ? 0 : 1; Q931Rx43(&isdn_data->q931, gen, gen->Size); @@ -1654,19 +1667,25 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) static __inline__ void check_state(ftdm_span_t *span) { - if (ftdm_test_flag(span, FTDM_SPAN_STATE_CHANGE)) { - uint32_t j; - ftdm_clear_flag_locked(span, FTDM_SPAN_STATE_CHANGE); - for(j = 1; j <= span->chan_count; j++) { - if (ftdm_test_flag((span->channels[j]), FTDM_CHANNEL_STATE_CHANGE)) { - ftdm_mutex_lock(span->channels[j]->mutex); - ftdm_clear_flag((span->channels[j]), FTDM_CHANNEL_STATE_CHANGE); - state_advance(span->channels[j]); - ftdm_channel_complete_state(span->channels[j]); - ftdm_mutex_unlock(span->channels[j]->mutex); - } - } - } + if (ftdm_test_flag(span, FTDM_SPAN_STATE_CHANGE)) { + uint32_t j; + + ftdm_clear_flag_locked(span, FTDM_SPAN_STATE_CHANGE); + + for (j = 1; j <= ftdm_span_get_chan_count(span); j++) { + ftdm_channel_t *chan = ftdm_span_get_channel(span, j); + + if (ftdm_test_flag(chan, FTDM_CHANNEL_STATE_CHANGE)) { + ftdm_channel_lock(chan); + + ftdm_clear_flag(chan, FTDM_CHANNEL_STATE_CHANGE); + state_advance(chan); + ftdm_channel_complete_state(chan); + + ftdm_channel_unlock(chan); + } + } + } } @@ -1677,27 +1696,33 @@ static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *e ftdm_sigmsg_t sig; memset(&sig, 0, sizeof(sig)); - sig.chan_id = event->channel->chan_id; - sig.span_id = event->channel->span_id; + sig.span_id = ftdm_channel_get_span_id(event->channel); + sig.chan_id = ftdm_channel_get_id(event->channel); sig.channel = event->channel; ftdm_log(FTDM_LOG_DEBUG, "EVENT [%s][%d:%d] STATE [%s]\n", - ftdm_oob_event2str(event->enum_id), event->channel->span_id, event->channel->chan_id, ftdm_channel_state2str(event->channel->state)); + ftdm_oob_event2str(event->enum_id), + ftdm_channel_get_span_id(event->channel), + ftdm_channel_get_id(event->channel), + ftdm_channel_get_state_str(event->channel)); - switch(event->enum_id) { + switch (event->enum_id) { case FTDM_OOB_ALARM_TRAP: { sig.event_id = FTDM_OOB_ALARM_TRAP; - if (event->channel->state != FTDM_CHANNEL_STATE_DOWN) { + if (ftdm_channel_get_state(event->channel) != FTDM_CHANNEL_STATE_DOWN) { ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_RESTART); } ftdm_set_flag(event->channel, FTDM_CHANNEL_SUSPENDED); ftdm_channel_get_alarms(event->channel, &alarmbits); isdn_data->sig_cb(&sig); + ftdm_log(FTDM_LOG_WARNING, "channel %d:%d (%d:%d) has alarms [%s]\n", - event->channel->span_id, event->channel->chan_id, - event->channel->physical_span_id, event->channel->physical_chan_id, - event->channel->last_error); + ftdm_channel_get_span_id(event->channel), + ftdm_channel_get_id(event->channel), + ftdm_channel_get_ph_span_id(event->channel), + ftdm_channel_get_ph_id(event->channel), + ftdm_channel_get_last_error(event->channel)); } break; case FTDM_OOB_ALARM_CLEAR: @@ -1713,7 +1738,7 @@ static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *e { const char * digit_str = (const char *)event->data; - if(digit_str) { + if (digit_str) { fio_event_cb_t event_callback = NULL; ftdm_channel_queue_dtmf(event->channel, digit_str); @@ -1744,14 +1769,13 @@ static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *e static __inline__ void check_events(ftdm_span_t *span) { - ftdm_status_t status; - - status = ftdm_span_poll_event(span, 5, NULL); + ftdm_status_t status = ftdm_span_poll_event(span, 5, NULL); - switch(status) { + switch (status) { case FTDM_SUCCESS: { ftdm_event_t *event; + while (ftdm_span_next_event(span, &event) == FTDM_SUCCESS) { if (event->enum_id == FTDM_OOB_NOOP) { continue; @@ -1781,6 +1805,7 @@ static int teletone_handler(teletone_generation_session_t *ts, teletone_tone_map if (!dt_buffer) { return -1; } + wrote = teletone_mux_tones(ts, map); ftdm_buffer_write(dt_buffer, ts->buffer, wrote * 2); return 0; @@ -1807,9 +1832,11 @@ static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj) ftdm_buffer_set_loops(dt_buffer, -1); /* get a tone generation friendly interval to avoid distortions */ - for (x = 1; x <= span->chan_count; x++) { - if (span->channels[x]->type != FTDM_CHAN_TYPE_DQ921) { - ftdm_channel_command(span->channels[x], FTDM_COMMAND_GET_INTERVAL, &interval); + for (x = 1; x <= ftdm_span_get_chan_count(span); x++) { + ftdm_channel_t *chan = ftdm_span_get_channel(span, x); + + if (ftdm_channel_get_type(chan) != FTDM_CHAN_TYPE_DQ921) { + ftdm_channel_command(chan, FTDM_COMMAND_GET_INTERVAL, &interval); break; } } @@ -1824,7 +1851,7 @@ static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj) ts.duration = ts.rate; /* main loop */ - while(ftdm_running() && ftdm_test_flag(isdn_data, FTDM_ISDN_RUNNING)) { + while (ftdm_running() && ftdm_test_flag(isdn_data, FTDM_ISDN_RUNNING)) { ftdm_wait_flag_t flags; ftdm_status_t status; int last_chan_state = 0; @@ -1834,11 +1861,11 @@ static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj) /* * check b-channel states and generate & send tones if neccessary */ - for (x = 1; x <= span->chan_count; x++) { - ftdm_channel_t *ftdmchan = span->channels[x]; + for (x = 1; x <= ftdm_span_get_chan_count(span); x++) { + ftdm_channel_t *chan = ftdm_span_get_channel(span, x); ftdm_size_t len = sizeof(frame), rlen; - if (ftdmchan->type == FTDM_CHAN_TYPE_DQ921) { + if (ftdm_channel_get_type(chan) == FTDM_CHAN_TYPE_DQ921) { continue; } @@ -1847,40 +1874,41 @@ static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj) * (Recycle buffer content if succeeding channels share the * same state, this saves some cpu cycles) */ - switch (ftdmchan->state) { + switch (ftdm_channel_get_state(chan)) { case FTDM_CHANNEL_STATE_DIALTONE: { - ftdm_isdn_bchan_data_t *data = (ftdm_isdn_bchan_data_t *)ftdmchan->mod_data; + ftdm_isdn_bchan_data_t *data = (ftdm_isdn_bchan_data_t *)chan->mod_data; + ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); /* check overlap dial timeout first before generating tone */ if (data && data->digit_timeout && data->digit_timeout <= now) { - if (strlen(ftdmchan->caller_data.dnis.digits) > 0) { + if (strlen(caller_data->dnis.digits) > 0) { ftdm_log(FTDM_LOG_DEBUG, "Overlap dial timeout, advancing to RING state\n"); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RING); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RING); } else { /* no digits received, hangup */ ftdm_log(FTDM_LOG_DEBUG, "Overlap dial timeout, no digits received, going to HANGUP state\n"); - ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_RECOVERY_ON_TIMER_EXPIRE; /* TODO: probably wrong cause value */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); + caller_data->hangup_cause = FTDM_CAUSE_RECOVERY_ON_TIMER_EXPIRE; /* TODO: probably wrong cause value */ + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP); } data->digit_timeout = 0; continue; } - if (last_chan_state != ftdmchan->state) { + if (last_chan_state != ftdm_channel_get_state(chan)) { ftdm_buffer_zero(dt_buffer); - teletone_run(&ts, ftdmchan->span->tone_map[FTDM_TONEMAP_DIAL]); - last_chan_state = ftdmchan->state; + teletone_run(&ts, span->tone_map[FTDM_TONEMAP_DIAL]); + last_chan_state = ftdm_channel_get_state(chan); } } break; case FTDM_CHANNEL_STATE_RING: { - if (last_chan_state != ftdmchan->state) { + if (last_chan_state != ftdm_channel_get_state(chan)) { ftdm_buffer_zero(dt_buffer); - teletone_run(&ts, ftdmchan->span->tone_map[FTDM_TONEMAP_RING]); - last_chan_state = ftdmchan->state; + teletone_run(&ts, span->tone_map[FTDM_TONEMAP_RING]); + last_chan_state = ftdm_channel_get_state(chan); } } break; @@ -1889,18 +1917,20 @@ static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj) continue; } - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) { - if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); + if (!ftdm_test_flag(chan, FTDM_CHANNEL_OPEN)) { + if (ftdm_channel_open_chan(chan) != FTDM_SUCCESS) { + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP); continue; } - ftdm_log(FTDM_LOG_NOTICE, "Successfully opened channel %d:%d\n", ftdmchan->span_id, ftdmchan->chan_id); + ftdm_log(FTDM_LOG_NOTICE, "Successfully opened channel %d:%d\n", + ftdm_channel_get_span_id(chan), + ftdm_channel_get_id(chan)); } flags = FTDM_READ; - status = ftdm_channel_wait(ftdmchan, &flags, (gated) ? 0 : interval); - switch(status) { + status = ftdm_channel_wait(chan, &flags, (gated) ? 0 : interval); + switch (status) { case FTDM_FAIL: continue; @@ -1915,12 +1945,12 @@ static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj) } gated = 1; - status = ftdm_channel_read(ftdmchan, frame, &len); + status = ftdm_channel_read(chan, frame, &len); if (status != FTDM_SUCCESS || len <= 0) { continue; } - if (ftdmchan->effective_codec != FTDM_CODEC_SLIN) { + if (chan->effective_codec != FTDM_CODEC_SLIN) { len *= 2; } @@ -1929,23 +1959,23 @@ static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj) rlen = ftdm_buffer_read_loop(dt_buffer, frame, len); - if (ftdmchan->effective_codec != FTDM_CODEC_SLIN) { + if (chan->effective_codec != FTDM_CODEC_SLIN) { fio_codec_t codec_func = NULL; - if (ftdmchan->native_codec == FTDM_CODEC_ULAW) { + if (chan->native_codec == FTDM_CODEC_ULAW) { codec_func = fio_slin2ulaw; - } else if (ftdmchan->native_codec == FTDM_CODEC_ALAW) { + } else if (chan->native_codec == FTDM_CODEC_ALAW) { codec_func = fio_slin2alaw; } if (codec_func) { status = codec_func(frame, sizeof(frame), &rlen); } else { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "codec error!"); + snprintf(chan->last_error, sizeof(chan->last_error), "codec error!"); goto done; } } - ftdm_channel_write(ftdmchan, frame, sizeof(frame), &rlen); + ftdm_channel_write(chan, frame, sizeof(frame), &rlen); } /* @@ -1994,7 +2024,7 @@ static void *ftdm_isdn_run(ftdm_thread_t *me, void *obj) Q921Start(&isdn_data->q921); Q931Start(&isdn_data->q931); - while(ftdm_running() && ftdm_test_flag(isdn_data, FTDM_ISDN_RUNNING)) { + while (ftdm_running() && ftdm_test_flag(isdn_data, FTDM_ISDN_RUNNING)) { ftdm_wait_flag_t flags = FTDM_READ; ftdm_status_t status = ftdm_channel_wait(isdn_data->dchan, &flags, 100); @@ -2006,7 +2036,7 @@ static void *ftdm_isdn_run(ftdm_thread_t *me, void *obj) /* * */ - switch(status) { + switch (status) { case FTDM_FAIL: { ftdm_log(FTDM_LOG_ERROR, "D-Chan Read Error!\n"); @@ -2045,8 +2075,8 @@ static void *ftdm_isdn_run(ftdm_thread_t *me, void *obj) } done: - ftdm_channel_close(&isdn_data->dchans[0]); - ftdm_channel_close(&isdn_data->dchans[1]); +// ftdm_channel_close(&isdn_data->dchans[0]); +// ftdm_channel_close(&isdn_data->dchans[1]); ftdm_clear_flag(isdn_data, FTDM_ISDN_RUNNING); #ifdef WIN32 @@ -2228,11 +2258,11 @@ static ftdm_status_t ftdm_isdn_stop(ftdm_span_t *span) ftdm_set_flag(isdn_data, FTDM_ISDN_STOP); - while(ftdm_test_flag(isdn_data, FTDM_ISDN_RUNNING)) { + while (ftdm_test_flag(isdn_data, FTDM_ISDN_RUNNING)) { ftdm_sleep(100); } - while(ftdm_test_flag(isdn_data, FTDM_ISDN_TONES_RUNNING)) { + while (ftdm_test_flag(isdn_data, FTDM_ISDN_TONES_RUNNING)) { ftdm_sleep(100); } @@ -2244,8 +2274,8 @@ static ftdm_status_t ftdm_isdn_stop(ftdm_span_t *span) */ static ftdm_status_t ftdm_isdn_start(ftdm_span_t *span) { - ftdm_status_t ret; ftdm_isdn_data_t *isdn_data = span->signal_data; + ftdm_status_t ret; if (ftdm_test_flag(isdn_data, FTDM_ISDN_RUNNING)) { return FTDM_FAIL; @@ -2429,7 +2459,7 @@ static FIO_API_FUNCTION(isdn_api) if (!strcasecmp(argv[2], "q921")) { layer = 0x01; - } else if(!strcasecmp(argv[2], "q931")) { + } else if (!strcasecmp(argv[2], "q931")) { layer = 0x02; } else if (!strcasecmp(argv[2], "all")) { layer = 0x03; @@ -2517,7 +2547,7 @@ static FIO_API_FUNCTION(isdn_api) stream->write_function(stream, "+OK capture started.\n"); goto done; } - else if(!strcasecmp(argv[2], "stop")) { + else if (!strcasecmp(argv[2], "stop")) { if (!isdn_pcap_is_open(isdn_data)) { stream->write_function(stream, "-ERR capture is not running.\n"); @@ -2530,7 +2560,7 @@ static FIO_API_FUNCTION(isdn_api) stream->write_function(stream, "+OK capture stopped.\n"); goto done; } - else if(!strcasecmp(argv[2], "suspend")) { + else if (!strcasecmp(argv[2], "suspend")) { if (!isdn_pcap_is_open(isdn_data)) { stream->write_function(stream, "-ERR capture is not running.\n"); @@ -2541,7 +2571,7 @@ static FIO_API_FUNCTION(isdn_api) stream->write_function(stream, "+OK capture suspended.\n"); goto done; } - else if(!strcasecmp(argv[2], "resume")) { + else if (!strcasecmp(argv[2], "resume")) { if (!isdn_pcap_is_open(isdn_data)) { stream->write_function(stream, "-ERR capture is not running.\n"); commit 47af9933c425e2921d4350dfc78206b27ca01be7 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Sun Nov 14 15:44:50 2010 +0100 freetdm: convert ftmod_isdn to use (+ pri_spans) to use ftdm_configure_span_signaling() interface. Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 4fda283..aaddbf6 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -2923,102 +2923,49 @@ static switch_status_t load_config(void) if ((spans = switch_xml_child(cfg, "pri_spans"))) { for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) { - char *id = (char *) switch_xml_attr(myspan, "id"); char *name = (char *) switch_xml_attr(myspan, "name"); + ftdm_conf_parameter_t spanparameters[10]; ftdm_status_t zstatus = FTDM_FAIL; const char *context = "default"; const char *dialplan = "XML"; - //Q921NetUser_t mode = Q931_TE; - //Q931Dialect_t dialect = Q931_Dialect_National; - char *mode = NULL; - char *dialect = NULL; - uint32_t span_id = 0; + unsigned paramindex = 0; ftdm_span_t *span = NULL; - const char *tonegroup = NULL; - char *digit_timeout = NULL; - const char *opts = "none"; - uint32_t to = 0; - int q921loglevel = -1; - int q931loglevel = -1; - - // quick debug - //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ID: '%s', Name:'%s'\n",id,name); + uint32_t span_id = 0; - for (param = switch_xml_child(myspan, "param"); param; param = param->next) { + if (!name) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "span missing required attribute 'name'\n"); + continue; + } + + for (param = switch_xml_child(myspan, "param"); param && paramindex < 10; param = param->next) { char *var = (char *) switch_xml_attr_soft(param, "name"); char *val = (char *) switch_xml_attr_soft(param, "value"); - if (!strcasecmp(var, "tonegroup")) { - tonegroup = val; - } else if (!strcasecmp(var, "mode")) { - mode = val; - } else if (!strcasecmp(var, "dialect")) { - dialect = val; - } else if (!strcasecmp(var, "q921loglevel")) { - if ((q921loglevel = switch_log_str2level(val)) == SWITCH_LOG_INVALID) { - q921loglevel = -1; - } - } else if (!strcasecmp(var, "q931loglevel")) { - if ((q931loglevel = switch_log_str2level(val)) == SWITCH_LOG_INVALID) { - q931loglevel = -1; - } - } else if (!strcasecmp(var, "context")) { + if (ftdm_array_len(spanparameters) == paramindex) { + ftdm_log(FTDM_LOG_ERROR, "Too many parameters for pri span '%s', ignoring everything after '%s'\n", name, var); + break; + } + + if (!strcasecmp(var, "context")) { context = val; - } else if (!strcasecmp(var, "opts")) { - opts = val; } else if (!strcasecmp(var, "dialplan")) { dialplan = val; - } else if (!strcasecmp(var, "digit_timeout") || !strcasecmp(var, "digit-timeout")) { - digit_timeout = val; - } - } - - if (!id && !name) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "span missing required param 'id'\n"); - continue; - } - - if (name) { - zstatus = ftdm_span_find_by_name(name, &span); - } else { - if (switch_is_number(id)) { - span_id = atoi(id); - zstatus = ftdm_span_find(span_id, &span); - } - - if (zstatus != FTDM_SUCCESS) { - zstatus = ftdm_span_find_by_name(id, &span); + } else { + spanparameters[paramindex].var = var; + spanparameters[paramindex].val = val; + paramindex++; } } - if (digit_timeout) { - to = atoi(digit_timeout); - } - + zstatus = ftdm_span_find_by_name(name, &span); if (zstatus != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error finding FreeTDM span id:%s name:%s\n", switch_str_nil(id), switch_str_nil(name)); + ftdm_log(FTDM_LOG_ERROR, "Error finding FreeTDM span %s\n", name); continue; } - if (!span_id) { - span_id = ftdm_span_get_id(span); - } - - if (!tonegroup) { - tonegroup = "us"; - } - - if (ftdm_configure_span(span, "isdn", on_clear_channel_signal, - "mode", mode, - "dialect", dialect, - "digit_timeout", &to, - "opts", opts, - "tonemap", tonegroup, - "q921loglevel", q921loglevel, - "q931loglevel", q931loglevel, - FTDM_TAG_END) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error starting FreeTDM span %d mode: %s dialect: %s error: %s\n", span_id, - mode, dialect, ftdm_span_get_last_error(span)); + span_id = ftdm_span_get_id(span); + if (ftdm_configure_span_signaling(span, "isdn", on_clear_channel_signal, spanparameters) != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_ERROR, "Error configuring FreeTDM span %s\n", name); continue; } diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c index 2b34552..c5294bf 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@ -54,6 +54,11 @@ #define DEFAULT_NATIONAL_PREFIX "0" #define DEFAULT_INTERNATIONAL_PREFIX "00" +static const char *ftdm_span_get_trunk_type_str(const ftdm_span_t *span) +{ + return ftdm_trunk_type2str(span->trunk_type); +} + /***************************************************************************************** * PCAP * Based on Helmut Kuper's (<helmut.kuper@ewetel.de>) implementation, @@ -2266,9 +2271,8 @@ static ftdm_status_t ftdm_isdn_start(ftdm_span_t *span) static int32_t parse_loglevel(const char *level) { - if (!level) { + if (!level) return -1; - } if (!strcasecmp(level, "debug")) { return FTDM_LOG_LEVEL_DEBUG; @@ -2291,53 +2295,53 @@ static int32_t parse_loglevel(const char *level) } } -static uint32_t parse_opts(const char *in) +static int parse_opts(const char *in, uint32_t *flags) { - uint32_t flags = 0; - - if (!in) { - return 0; - } + if (!in || !flags) + return -1; if (strstr(in, "suggest_channel")) { - flags |= FTDM_ISDN_OPT_SUGGEST_CHANNEL; + *flags |= FTDM_ISDN_OPT_SUGGEST_CHANNEL; } - if (strstr(in, "omit_display")) { - flags |= FTDM_ISDN_OPT_OMIT_DISPLAY_IE; + *flags |= FTDM_ISDN_OPT_OMIT_DISPLAY_IE; } - if (strstr(in, "disable_tones")) { - flags |= FTDM_ISDN_OPT_DISABLE_TONES; + *flags |= FTDM_ISDN_OPT_DISABLE_TONES; } - return flags; + return 0; } -static uint32_t parse_dialect(const char *in) +static int parse_dialect(const char *in, uint32_t *dialect) { - if (!in) { - return Q931_Dialect_Count; - } + if (!in || !dialect) + return -1; #if __UNSUPPORTED__ if (!strcasecmp(in, "national")) { - return Q931_Dialect_National; + *dialect = Q931_Dialect_National; + return 0; } if (!strcasecmp(in, "dms")) { - return Q931_Dialect_DMS; + *dialect = Q931_Dialect_DMS; + return 0; } #endif if (!strcasecmp(in, "5ess")) { - return Q931_Dialect_5ESS; + *dialect = Q931_Dialect_5ESS; + return 0; } - if (!strcasecmp(in, "dss1")) { - return Q931_Dialect_DSS1; + if (!strcasecmp(in, "dss1") || !strcasecmp(in, "euroisdn")) { + *dialect = Q931_Dialect_DSS1; + return 0; } if (!strcasecmp(in, "q931")) { - return Q931_Dialect_Q931; + *dialect = Q931_Dialect_Q931; + return 0; } - return Q931_Dialect_Count; + + return -1; } @@ -2563,44 +2567,80 @@ done: return FTDM_SUCCESS; } -static FIO_SIG_CONFIGURE_FUNCTION(isdn_configure_span) +static int parse_mode(const char *mode) +{ + if (!mode) + return -1; + + if (!strcasecmp(mode, "user") || !strcasecmp(mode, "cpe")) { + return Q931_TE; + } + if (!strcasecmp(mode, "net") || !strcasecmp(mode, "network")) { + return Q931_NT; + } + + return -1; +} + +static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(isdn_configure_span) { - uint32_t i, x = 0; - ftdm_channel_t *dchans[2] = { 0 }; - ftdm_isdn_data_t *isdn_data; - const char *tonemap = "us"; - char *var, *val; Q931Dialect_t dialect = Q931_Dialect_National; + ftdm_channel_t *dchan = NULL; + ftdm_isdn_data_t *isdn_data; int32_t digit_timeout = 0; + const char *tonemap = "us"; + int dchan_count = 0, bchan_count = 0; int q921loglevel = -1; int q931loglevel = -1; + uint32_t i; if (span->signal_type) { - snprintf(span->last_error, sizeof(span->last_error), "Span is already configured for signalling [%d].", span->signal_type); + ftdm_log(FTDM_LOG_ERROR, "Span is already configured for signalling [%d]\n", span->signal_type); + snprintf(span->last_error, sizeof(span->last_error), "Span is already configured for signalling [%d]", span->signal_type); return FTDM_FAIL; } - if (span->trunk_type >= FTDM_TRUNK_NONE) { - ftdm_log(FTDM_LOG_WARNING, "Invalid trunk type '%s' defaulting to T1.\n", ftdm_trunk_type2str(span->trunk_type)); + if (ftdm_span_get_trunk_type(span) >= FTDM_TRUNK_NONE) { + ftdm_log(FTDM_LOG_WARNING, "Invalid trunk type '%s' defaulting to T1\n", ftdm_span_get_trunk_type_str(span)); span->trunk_type = FTDM_TRUNK_T1; } - for(i = 1; i <= span->chan_count; i++) { - if (span->channels[i]->type == FTDM_CHAN_TYPE_DQ921) { - if (x > 1) { - snprintf(span->last_error, sizeof(span->last_error), "Span has more than 2 D-Channels!"); + for (i = 1; i <= ftdm_span_get_chan_count(span); i++) { + ftdm_channel_t *chan = ftdm_span_get_channel(span, i); + + switch (ftdm_channel_get_type(chan)) { + case FTDM_CHAN_TYPE_DQ921: + if (dchan_count > 1) { + ftdm_log(FTDM_LOG_ERROR, "Span has more than 1 D-Channel!\n"); + snprintf(span->last_error, sizeof(span->last_error), "Span has more than 1 D-Channel!"); return FTDM_FAIL; } - if (ftdm_channel_open(span->span_id, i, &dchans[x]) == FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_DEBUG, "opening d-channel #%d %d:%d\n", x, dchans[x]->span_id, dchans[x]->chan_id); - dchans[x]->state = FTDM_CHANNEL_STATE_UP; - x++; + if (ftdm_channel_open(ftdm_span_get_id(span), i, &dchan) == FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_DEBUG, "opening d-channel #%d %d:%d\n", dchan_count, + ftdm_channel_get_span_id(dchan), ftdm_channel_get_id(dchan)); + dchan->state = FTDM_CHANNEL_STATE_UP; } + + dchan_count++; + break; + + case FTDM_CHAN_TYPE_B: + bchan_count++; + break; + + default: + break; } } - if (!x) { - snprintf(span->last_error, sizeof(span->last_error), "Span has no D-Channels!"); + if (!dchan_count) { + ftdm_log(FTDM_LOG_ERROR, "Span has no D-Channel!\n"); + snprintf(span->last_error, sizeof(span->last_error), "Span has no D-Channel!"); + return FTDM_FAIL; + } + if (!bchan_count) { + ftdm_log(FTDM_LOG_ERROR, "Span has no B-Channels!\n"); + snprintf(span->last_error, sizeof(span->last_error), "Span has no B-Channels!"); return FTDM_FAIL; } @@ -2611,52 +2651,55 @@ static FIO_SIG_CONFIGURE_FUNCTION(isdn_configure_span) isdn_data->mode = Q931_TE; dialect = Q931_Dialect_Q931; - while((var = va_arg(ap, char *))) { + for (i = 0; ftdm_parameters[i].var; i++) { + const char *var = ftdm_parameters[i].var; + const char *val = ftdm_parameters[i].val; + + if (!val) { + ftdm_log(FTDM_LOG_ERROR, "Variable '%s' has no value\n", var); + return FTDM_FAIL; + } + if (!strcasecmp(var, "mode")) { - if (!(val = va_arg(ap, char *))) { - break; + if ((isdn_data->mode = parse_mode(val)) < 0) { + ftdm_log(FTDM_LOG_ERROR, "Invalid/unknown mode '%s'\n", val); + snprintf(span->last_error, sizeof(span->last_error), "Invalid/unknown mode [%s]!", val); + return FTDM_FAIL; } - isdn_data->mode = strcasecmp(val, "net") ? Q931_TE : Q931_NT; } else if (!strcasecmp(var, "dialect")) { - if (!(val = va_arg(ap, char *))) { - break; - } - dialect = parse_dialect(val); - if (dialect == Q931_Dialect_Count) { + if (parse_dialect(val, &dialect) < 0) { + ftdm_log(FTDM_LOG_ERROR, "Invalid/unknown dialect '%s'\n", val); snprintf(span->last_error, sizeof(span->last_error), "Invalid/unknown dialect [%s]!", val); return FTDM_FAIL; } } else if (!strcasecmp(var, "opts")) { - if (!(val = va_arg(ap, char *))) { - break; + if (parse_opts(val, &isdn_data->opts) < 0) { + ftdm_log(FTDM_LOG_ERROR, "Invalid/unknown options '%s'\n", val); + snprintf(span->last_error, sizeof(span->last_error), "Invalid/unknown options [%s]!", val); + return FTDM_FAIL; } - isdn_data->opts = parse_opts(val); } else if (!strcasecmp(var, "tonemap")) { - if (!(val = va_arg(ap, char *))) { - break; - } tonemap = (const char *)val; } else if (!strcasecmp(var, "digit_timeout")) { - int *optp; - if (!(optp = va_arg(ap, int *))) { - break; + digit_timeout = atoi(val); + if (digit_timeout < 3000 || digit_timeout > 30000) { + ftdm_log(FTDM_LOG_WARNING, "Digit timeout %d ms outside of range (3000 - 30000 ms), using default (10000 ms)\n", digit_timeout); + digit_timeout = DEFAULT_DIGIT_TIMEOUT; } - digit_timeout = *optp; } else if (!strcasecmp(var, "q921loglevel")) { - q921loglevel = va_arg(ap, int); - if (q921loglevel < Q921_LOG_NONE) { - q921loglevel = Q921_LOG_NONE; - } else if (q921loglevel > Q921_LOG_DEBUG) { - q921loglevel = Q921_LOG_DEBUG; + if ((q921loglevel = parse_loglevel(val)) < 0) { + ftdm_log(FTDM_LOG_ERROR, "Invalid/unknown loglevel '%s'\n", val); + snprintf(span->last_error, sizeof(span->last_error), "Invalid/unknown loglevel [%s]!", val); + return FTDM_FAIL; } } else if (!strcasecmp(var, "q931loglevel")) { - q931loglevel = va_arg(ap, int); - if (q931loglevel < Q931_LOG_NONE) { - q931loglevel = Q931_LOG_NONE; - } else if (q931loglevel > Q931_LOG_DEBUG) { - q931loglevel = Q931_LOG_DEBUG; + if ((q931loglevel = parse_loglevel(val)) < 0) { + ftdm_log(FTDM_LOG_ERROR, "Invalid/unknown loglevel '%s'\n", val); + snprintf(span->last_error, sizeof(span->last_error), "Invalid/unknown loglevel [%s]!", val); + return FTDM_FAIL; } } else { + ftdm_log(FTDM_LOG_ERROR, "Unknown parameter '%s'\n", var); snprintf(span->last_error, sizeof(span->last_error), "Unknown parameter [%s]", var); return FTDM_FAIL; } @@ -2665,39 +2708,35 @@ static FIO_SIG_CONFIGURE_FUNCTION(isdn_configure_span) if (!digit_timeout) { digit_timeout = DEFAULT_DIGIT_TIMEOUT; } - else if (digit_timeout < 3000 || digit_timeout > 30000) { - ftdm_log(FTDM_LOG_WARNING, "Digit timeout %d ms outside of range (3000 - 30000 ms), using default (10000 ms)\n", digit_timeout); - digit_timeout = DEFAULT_DIGIT_TIMEOUT; - } /* allocate per b-chan data */ if (isdn_data->mode == Q931_NT) { ftdm_isdn_bchan_data_t *data; - data = malloc(span->chan_count * sizeof(ftdm_isdn_bchan_data_t)); + data = malloc(bchan_count * sizeof(ftdm_isdn_bchan_data_t)); if (!data) { return FTDM_FAIL; } - for (i = 1; i <= span->chan_count; i++, data++) { - if (span->channels[i]->type == FTDM_CHAN_TYPE_B) { - span->channels[i]->mod_data = data; + for (i = 1; i <= ftdm_span_get_chan_count(span); i++, data++) { + ftdm_channel_t *chan = ftdm_span_get_channel(span, i); + + if (ftdm_channel_get_type(chan) == FTDM_CHAN_TYPE_B) { + chan->mod_data = data; memset(data, 0, sizeof(ftdm_isdn_bchan_data_t)); } } } - isdn_data->sig_cb = sig_cb; - isdn_data->dchans[0] = dchans[0]; - isdn_data->dchans[1] = dchans[1]; - isdn_data->dchan = isdn_data->dchans[0]; + isdn_data->sig_cb = sig_cb; + isdn_data->dchan = dchan; isdn_data->digit_timeout = digit_timeout; Q921_InitTrunk(&isdn_data->q921, 0, 0, isdn_data->mode, - span->trunk_type == FTDM_TRUNK_BRI_PTMP ? Q921_PTMP : Q921_PTP, + (ftdm_span_get_trunk_type(span) == FTDM_TRUNK_BRI_PTMP) ? Q921_PTMP : Q921_PTP, 0, ftdm_isdn_921_21, (Q921Tx23CB_t)ftdm_isdn_921_23, @@ -2798,7 +2837,7 @@ ftdm_module_t ftdm_module = { .io_unload = NULL, .sig_load = isdn_load, .sig_unload = isdn_unload, - .sig_configure = isdn_configure_span + .configure_span_signaling = isdn_configure_span }; /* For Emacs: commit c12f81cd0f24a8ea5cf7ce26cf83f88e3ffcd4a4 Author: Brian West <brian@freeswitch.org> Date: Fri Nov 12 13:50:12 2010 -0600 Use the right variable diff --git a/scripts/lua/zrtp_agent.lua b/scripts/lua/zrtp_agent.lua index c657359..2ce8b3e 100644 --- a/scripts/lua/zrtp_agent.lua +++ b/scripts/lua/zrtp_agent.lua @@ -8,7 +8,7 @@ session:sleep(3000); -- Give the agent time to bring up ZRTP. local zrtp_secure_media_confirmed = session:getVariable("zrtp_secure_media_confirmed_audio"); -local zrtp_new_user_enrolled = session:getVariable("zrtp_new_user_enrolled"); +local zrtp_new_user_enrolled = session:getVariable("zrtp_new_user_enrolled_audio"); local zrtp_already_enrolled = session:getVariable("zrtp_already_enrolled_audio"); if zrtp_secure_media_confirmed == "true" then commit b160942bc0e3c9d8c2a7d4f377c2295d3d5ff655 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Nov 12 11:43:18 2010 -0600 test diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 71a827f..dc02ca4 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1259,7 +1259,6 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * char *to = NULL; char *open; char *prpid; - char *sql; time_t exptime = switch_epoch_time_now(NULL) + 3600; int is_dialog = 0; sofia_profile_t *ext_profile = NULL, *profile = helper->profile; @@ -1617,15 +1616,16 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * } + /* commenting to test if (helper->event){ const char *uuid = switch_event_get_header_nil(helper->event, "unique-id"); if (!zstr(uuid) && strchr(uuid, '-')) { - sql = switch_mprintf("update sip_dialogs set rpid='%q',status='%q' where uuid='%q'", rpid, status_line, uuid); + char *sql = switch_mprintf("update sip_dialogs set rpid='%q',status='%q' where uuid='%q'", rpid, status_line, uuid); sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE); } } - + */ nua_handle_bind(nh, &mod_sofia_globals.keep_private); commit 197e4b71d6eff64a8d3843d58ba99ead4fca970f Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Fri Nov 12 11:36:29 2010 +0100 mod_freetdm: Really avoid overwriting the last element of spanparameters. "if (ftdm_array_len(spanparameters) == paramindex)" is still off-by-one, we want to stop at "ftdm_array_len(spanparameters) - 1", before we overwrite the last (= terminating, NULL) element. NOTE: i'd prefer an "argc, argv"-style interface here Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 879dd05..4fda283 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -2434,7 +2434,7 @@ static void parse_bri_pri_spans(switch_xml_t cfg, switch_xml_t spans) char *var = (char *) switch_xml_attr_soft(param, "name"); char *val = (char *) switch_xml_attr_soft(param, "value"); - if (ftdm_array_len(spanparameters) == paramindex) { + if (ftdm_array_len(spanparameters) - 1 == paramindex) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Too many parameters for ss7 span, ignoring any parameter after %s\n", var); break; } @@ -2594,7 +2594,7 @@ static switch_status_t load_config(void) char *var = (char *) switch_xml_attr_soft(param, "name"); char *val = (char *) switch_xml_attr_soft(param, "value"); - if (ftdm_array_len(spanparameters) == paramindex) { + if (ftdm_array_len(spanparameters) - 1 == paramindex) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Too many parameters for ss7 span, ignoring any parameter after %s\n", var); break; } @@ -3106,7 +3106,7 @@ static switch_status_t load_config(void) char *var = (char *) switch_xml_attr_soft(param, "name"); char *val = (char *) switch_xml_attr_soft(param, "value"); - if (ftdm_array_len(spanparameters) == paramindex) { + if (ftdm_array_len(spanparameters) - 1 == paramindex) { ftdm_log(FTDM_LOG_ERROR, "Too many parameters for libpri span, ignoring everything after '%s'\n", var); break; } @@ -3171,7 +3171,7 @@ static switch_status_t load_config(void) char *var = (char *) switch_xml_attr_soft(param, "name"); char *val = (char *) switch_xml_attr_soft(param, "value"); - if (ftdm_array_len(spanparameters) == paramindex) { + if (ftdm_array_len(spanparameters) - 1 == paramindex) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Too many parameters for boost span, ignoring any parameter after %s\n", var); break; } commit 025c82e76f296253a112896471f54fac9d14d5d5 Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Thu Nov 11 20:21:35 2010 -0500 ivr_enterprise_originate: Fix export of variable from the originator channel to the called channels diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 007d7d9..da76cf6 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -1391,6 +1391,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess data++; } + if (session) { + switch_caller_profile_t *cpp = NULL; + channel = switch_core_session_get_channel(session); + if ((cpp = switch_channel_get_caller_profile(channel))) { + cp = switch_caller_profile_dup(pool, cpp); + } + } + if (ovars) { var_event = ovars; } else { @@ -1436,14 +1444,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess switch_goto_status(SWITCH_STATUS_FALSE, end); } - if (session) { - switch_caller_profile_t *cpp = NULL; - channel = switch_core_session_get_channel(session); - if ((cpp = switch_channel_get_caller_profile(channel))) { - cp = switch_caller_profile_dup(pool, cpp); - } - } - switch_threadattr_create(&thd_attr, pool); switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); commit d0b6117325ded66fdbcb8a8c3630386e671675f9 Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Nov 11 18:43:53 2010 -0500 FIX for windows IO diff --git a/libs/freetdm/cyginstall.sh b/libs/freetdm/cyginstall.sh index 9d486b7..311df93 100644 --- a/libs/freetdm/cyginstall.sh +++ b/libs/freetdm/cyginstall.sh @@ -5,8 +5,8 @@ fsdir=../.. set -x cp Debug/mod/*.dll $fsdir/Debug/mod/ cp mod_freetdm/Debug/*.pdb $fsdir/Debug/mod/ -cp Debug/*.dll $fsdir/Debug/ -cp Debug/*.pdb $fsdir/Debug/ +cp Debug/*.dll $fsdir/Debug/mod/ +cp Debug/*.pdb $fsdir/Debug/mod/ #cp Debug/testsangomaboost.exe $fsdir/Debug/ echo "FRIENDLY REMINDER: RECOMPILE ftmod_wanpipe WHENEVER YOU INSTALL NEW DRIVERS" set +x diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 6974311..98b09e9 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -52,10 +52,10 @@ static void ftdm_sangoma_isdn_process_phy_events(ftdm_span_t *span, ftdm_oob_eve static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan); static void ftdm_sangoma_isdn_process_stack_event (ftdm_span_t *span, sngisdn_event_data_t *sngisdn_event); -static ftdm_io_interface_t g_sngisdn_io_interface; -static sng_isdn_event_interface_t g_sngisdn_event_interface; +static ftdm_io_interface_t g_sngisdn_io_interface; +static sng_isdn_event_interface_t g_sngisdn_event_interface; -ftdm_sngisdn_data_t g_sngisdn_data; +ftdm_sngisdn_data_t g_sngisdn_data; extern ftdm_status_t sngisdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t trace_opt); extern ftdm_status_t sngisdn_check_free_ids(void); @@ -248,6 +248,7 @@ static void ftdm_sangoma_isdn_process_phy_events(ftdm_span_t *span, ftdm_oob_eve sngisdn_snd_event(span, SNG_L1EVENT_ALARM_OFF); if (FTDM_SPAN_IS_BRI(span)) { ftdm_channel_t *ftdmchan; + sngisdn_chan_data_t *sngisdn_info; ftdm_iterator_t *chaniter = NULL; ftdm_iterator_t *curr = NULL; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data; @@ -255,7 +256,7 @@ static void ftdm_sangoma_isdn_process_phy_events(ftdm_span_t *span, ftdm_oob_eve chaniter = ftdm_span_get_chan_iterator(span, NULL); for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { ftdmchan = (ftdm_channel_t*)ftdm_iterator_current(curr); - sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data; + sngisdn_info = (sngisdn_chan_data_t*)ftdmchan->call_data; if (ftdm_test_flag(sngisdn_info, FLAG_ACTIVATING)) { ftdm_clear_flag(sngisdn_info, FLAG_ACTIVATING); @@ -277,8 +278,7 @@ static void ftdm_sangoma_isdn_process_phy_events(ftdm_span_t *span, ftdm_oob_eve static void ftdm_sangoma_isdn_poll_events(ftdm_span_t *span) { - ftdm_status_t ret_status; - ftdm_channel_t *ftdmchan; + ftdm_status_t ret_status; ftdm_iterator_t *chaniter = NULL; ftdm_iterator_t *curr = NULL; @@ -315,7 +315,7 @@ static void *ftdm_sangoma_isdn_dchan_run(ftdm_thread_t *me, void *obj) while (ftdm_running() && !(ftdm_test_flag(span, FTDM_SPAN_STOP_THREAD))) { wflags = FTDM_READ; - status = ftdm_channel_wait(dchan, &wflags, 0); + status = ftdm_channel_wait(dchan, &wflags, 10000); switch(status) { case FTDM_FAIL: ftdm_log_chan_msg(dchan, FTDM_LOG_CRIT, "Failed to wait for d-channel\n"); @@ -331,8 +331,10 @@ static void *ftdm_sangoma_isdn_dchan_run(ftdm_thread_t *me, void *obj) } else { ftdm_log_chan_msg(dchan, FTDM_LOG_WARNING, "Failed to read from channel \n"); } +#ifndef WIN32 /* It is valid on WIN32 for poll to return without errors, but no flags set */ } else { ftdm_log_chan_msg(dchan, FTDM_LOG_CRIT, "Failed to poll for d-channel\n"); +#endif } break; default: @@ -986,7 +988,7 @@ static FIO_SIG_LOAD_FUNCTION(ftdm_sangoma_isdn_init) ftdm_log(FTDM_LOG_INFO, "Loading ftmod_sangoma_isdn...\n"); memset(&g_sngisdn_data, 0, sizeof(g_sngisdn_data)); - + memset(&g_sngisdn_event_interface, 0, sizeof(g_sngisdn_event_interface)); /* set callbacks */ g_sngisdn_event_interface.cc.sng_con_ind = sngisdn_rcv_con_ind; g_sngisdn_event_interface.cc.sng_con_cfm = sngisdn_rcv_con_cfm; @@ -1017,8 +1019,8 @@ static FIO_SIG_LOAD_FUNCTION(ftdm_sangoma_isdn_init) g_sngisdn_event_interface.sta.sng_q931_trc_ind = sngisdn_rcv_q931_trace; g_sngisdn_event_interface.sta.sng_cc_sta_ind = sngisdn_rcv_cc_ind; - g_sngisdn_event_interface.io.sng_data_req = sngisdn_rcv_data_req; - + g_sngisdn_event_interface.io.sng_data_req = sngisdn_rcv_data_req; + for(i=1;i<=MAX_VARIANTS;i++) { ftdm_mutex_create(&g_sngisdn_data.ccs[i].mutex); } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 1632651..c0ee11d 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -37,6 +37,7 @@ extern ftdm_status_t cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm); extern ftdm_status_t cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm); extern ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan); +extern ftdm_status_t cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm); void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c index e7ebc8f..9400064 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c @@ -873,16 +873,30 @@ int16_t sngisdn_rcv_data_req(uint16_t spId, uint8_t *buff, uint32_t length) sngisdn_span_data_t *signal_data = g_sngisdn_data.spans[spId]; ftdm_assert(signal_data, "Received Data request on unconfigured span\n"); - status = signal_data->dchan->fio->wait(signal_data->dchan, &flags, 10); - if (status != FTDM_SUCCESS) { - ftdm_log_chan_msg(signal_data->dchan, FTDM_LOG_WARNING, "transmit timed-out\n"); - return -1; - } - status = signal_data->dchan->fio->write(signal_data->dchan, buff, (ftdm_size_t*)&length); - if (status != FTDM_SUCCESS) { - ftdm_log_chan_msg(signal_data->dchan, FTDM_LOG_CRIT, "Failed to transmit frame\n"); - return -1; - } + do { + flags = FTDM_WRITE; + status = signal_data->dchan->fio->wait(signal_data->dchan, &flags, 1000); + if (status != FTDM_SUCCESS) { + ftdm_log_chan_msg(signal_data->dchan, FTDM_LOG_WARNING, "transmit timed-out\n"); + return -1; + } + + + if ((flags & FTDM_WRITE)) { + status = signal_data->dchan->fio->write(signal_data->dchan, buff, (ftdm_size_t*)&length); + if (status != FTDM_SUCCESS) { + ftdm_log_chan_msg(signal_data->dchan, FTDM_LOG_CRIT, "Failed to transmit frame\n"); + return -1; + } + break; + /* On WIN32, it is possible for poll to return without FTDM_WRITE flag set, so we try to retransmit */ +#ifndef WIN32 + } else { + ftdm_log_chan_msg(signal_data->dchan, FTDM_LOG_WARNING, "Failed to poll for d-channel\n"); + return -1; +#endif + } + } while(1); return 0; } diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index 896b8ee..f40f2b2 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -115,7 +115,7 @@ FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_next_event); static __inline__ int tdmv_api_wait_socket(ftdm_channel_t *ftdmchan, int timeout, int *flags) { -#ifdef LIBSANGOMA_VERSION +#ifdef LIBSANGOMA_VERSION int err; uint32_t inflags = *flags; uint32_t outflags = 0; @@ -130,6 +130,7 @@ static __inline__ int tdmv_api_wait_socket(ftdm_channel_t *ftdmchan, int timeout if (err == SANG_STATUS_APIPOLL_TIMEOUT) { err = 0; } + return err; #else struct pollfd pfds[1]; commit eeaab3a02e507f273bf140845a1962b4c757895d Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Thu Nov 11 23:53:19 2010 +0100 mod_freetdm: Avoid overflowing the spanparameters array of libpri spans, and make other span types use ftdm_array_len() too. Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 0a35913..879dd05 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -2594,7 +2594,7 @@ static switch_status_t load_config(void) char *var = (char *) switch_xml_attr_soft(param, "name"); char *val = (char *) switch_xml_attr_soft(param, "value"); - if (sizeof(spanparameters)/sizeof(spanparameters[0]) == paramindex) { + if (ftdm_array_len(spanparameters) == paramindex) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Too many parameters for ss7 span, ignoring any parameter after %s\n", var); break; } @@ -3106,6 +3106,11 @@ static switch_status_t load_config(void) char *var = (char *) switch_xml_attr_soft(param, "name"); char *val = (char *) switch_xml_attr_soft(param, "value"); + if (ftdm_array_len(spanparameters) == paramindex) { + ftdm_log(FTDM_LOG_ERROR, "Too many parameters for libpri span, ignoring everything after '%s'\n", var); + break; + } + if (!strcasecmp(var, "context")) { context = val; } else if (!strcasecmp(var, "dialplan")) { @@ -3165,7 +3170,8 @@ static switch_status_t load_config(void) for (param = switch_xml_child(myspan, "param"); param; param = param->next) { char *var = (char *) switch_xml_attr_soft(param, "name"); char *val = (char *) switch_xml_attr_soft(param, "value"); - if (sizeof(spanparameters)/sizeof(spanparameters[0]) == paramindex) { + + if (ftdm_array_len(spanparameters) == paramindex) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Too many parameters for boost span, ignoring any parameter after %s\n", var); break; } commit b2f80417907503d55bdc0857a2c9e7e9edc0771f Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Nov 11 16:48:59 2010 -0600 fix file string when being used in ringback diff --git a/src/mod/formats/mod_file_string/mod_file_string.c b/src/mod/formats/mod_file_string/mod_file_string.c index f706000..a222f7b 100644 --- a/src/mod/formats/mod_file_string/mod_file_string.c +++ b/src/mod/formats/mod_file_string/mod_file_string.c @@ -71,7 +71,7 @@ static int next_file(switch_file_handle_t *handle) switch_core_file_close(&context->fh); } - if (context->index == context->argc) { + if (context->index >= context->argc) { return 0; } @@ -110,6 +110,24 @@ static int next_file(switch_file_handle_t *handle) return 1; } + +static switch_status_t file_string_file_seek(switch_file_handle_t *handle, unsigned int *cur_sample, int64_t samples, int whence) +{ + file_string_context_t *context = handle->private_info; + + if (samples == 0 && whence == SEEK_SET) { + context->index = -1; + return SWITCH_STATUS_SUCCESS; + } + + if (!handle->seekable) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "File is not seekable\n"); + return SWITCH_STATUS_NOTIMPL; + } + + return switch_core_file_seek(&context->fh, cur_sample, samples, whence); +} + static switch_status_t file_string_file_open(switch_file_handle_t *handle, const char *path) { file_string_context_t *context; @@ -185,6 +203,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_file_string_load) file_interface->file_open = file_string_file_open; file_interface->file_close = file_string_file_close; file_interface->file_read = file_string_file_read; + file_interface->file_seek = file_string_file_seek; memset(&globals, 0, sizeof(globals)); /* indicate that the module should continue to be loaded */ commit 0100eff6352f26627acf4c22cd1ce108b475c86f Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Nov 11 15:37:48 2010 -0600 update diff --git a/src/switch_core_file.c b/src/switch_core_file.c index af3897e..76b6b29 100644 --- a/src/switch_core_file.c +++ b/src/switch_core_file.c @@ -411,7 +411,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_seek(switch_file_handle_t *fh, int ok = 1; switch_assert(fh != NULL); - switch_assert(fh->file_interface != NULL); if (!switch_test_flag(fh, SWITCH_FILE_OPEN) || !fh->file_interface->file_seek) { ok = 0; commit 1e777c2ce9c70e34bbb27968f4727a92a4f0f249 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Thu Nov 11 22:21:18 2010 +0100 ftmod_libpri: While we're at it, drop the cast too Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 69e007d..1d1685f 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -1187,7 +1187,7 @@ static int handle_facility_aoc_e(const struct pri_subcmd_aoc_e *aoc_e) */ static int on_facility(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) { - struct pri_event_facility *pfac = (struct pri_event_facility *)&pevent->facility; + struct pri_event_facility *pfac = &pevent->facility; int i = 0; if (!pevent) commit e0961aee3a46001633c51053f6fca71317d2265b Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Thu Nov 11 22:17:09 2010 +0100 ftmod_libpri: Dereference facility event correctly, add debug message. Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 787e995..69e007d 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -1187,12 +1187,14 @@ static int handle_facility_aoc_e(const struct pri_subcmd_aoc_e *aoc_e) */ static int on_facility(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) { - struct pri_event_facility *pfac = (struct pri_event_facility *)pevent; + struct pri_event_facility *pfac = (struct pri_event_facility *)&pevent->facility; int i = 0; if (!pevent) return 0; + ftdm_log(FTDM_LOG_DEBUG, "Got a FACILITY event on span %d:%d\n", ftdm_span_get_id(spri->span), pfac->channel); + if (!pfac->subcmds || pfac->subcmds->counter_subcmd <= 0) return 0; commit cd95138427e1ad55641fadd60c161e3899c2b98f Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Nov 11 12:32:29 2010 -0600 FS-2839 diff --git a/src/mod/applications/mod_avmd/buffer.h b/src/mod/applications/mod_avmd/buffer.h index bb5b1b1..b667676 100644 --- a/src/mod/applications/mod_avmd/buffer.h +++ b/src/mod/applications/mod_avmd/buffer.h @@ -78,18 +78,18 @@ extern size_t next_power_of_2(size_t v); #define CALC_BUFF_LEN(fl, bl) (((fl) >= (bl))? next_power_of_2((fl) << 1): next_power_of_2((bl) << 1)) -#define INIT_CIRC_BUFFER(bf, bl, fl) \ +#define INIT_CIRC_BUFFER(bf, bl, fl, s) \ { \ (bf)->buf_len = CALC_BUFF_LEN((fl), (bl)); \ (bf)->mask = (bf)->buf_len - 1; \ - (bf)->buf = (BUFF_TYPE *)calloc((bf)->buf_len, sizeof(BUFF_TYPE)); \ + (bf)->buf = (BUFF_TYPE *) switch_core_session_alloc(s, (bf)->buf_len * sizeof(BUFF_TYPE)); \ assert((bf)->buf != NULL); \ (bf)->pos = 0; \ (bf)->lpos = 0; \ (bf)->backlog = 0; \ } -#define DESTROY_CIRC_BUFFER(b) free((b)->buf) +//#define DESTROY_CIRC_BUFFER(b) free((b)->buf) #define GET_BACKLOG_POS(b) ((b)->lpos - (b)->backlog) #define GET_CURRENT_POS(b) ((b)->lpos) #define GET_CURRENT_SAMPLE(b) GET_SAMPLE((b), GET_CURRENT_POS((b))) diff --git a/src/mod/applications/mod_avmd/mod_avmd.c b/src/mod/applications/mod_avmd/mod_avmd.c index 74372a0..8e6f2e1 100644 --- a/src/mod/applications/mod_avmd/mod_avmd.c +++ b/src/mod/applications/mod_avmd/mod_avmd.c @@ -130,7 +130,7 @@ static void init_avmd_session_data(avmd_session_t *avmd_session, switch_core_se { /*! This is a worst case sample rate estimate */ avmd_session->rate = 48000; - INIT_CIRC_BUFFER(&avmd_session->b, BEEP_LEN(avmd_session->rate), FRAME_LEN(avmd_session->rate)); + INIT_CIRC_BUFFER(&avmd_session->b, BEEP_LEN(avmd_session->rate), FRAME_LEN(avmd_session->rate), fs_session); avmd_session->session = fs_session; avmd_session->pos = 0; @@ -176,6 +176,7 @@ static switch_bool_t avmd_callback(switch_media_bug_t * bug, void *user_data, sw case SWITCH_ABC_TYPE_READ_PING: break; case SWITCH_ABC_TYPE_CLOSE: + break; case SWITCH_ABC_TYPE_READ: break; commit 3be3cd762acdd9750c2b7efe0855c201112ff723 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Nov 11 10:54:04 2010 -0600 add send_silence_when_idle and dmachine honoring to park loop diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 948401e..b5c5632 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -702,7 +702,40 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session, time_t expires = 0; switch_codec_implementation_t read_impl = { 0 }; switch_call_cause_t timeout_cause = SWITCH_CAUSE_NORMAL_CLEARING; + switch_codec_t codec = { 0 }; + int sval = 0; + const char *var; + switch_frame_t write_frame = { 0 }; + unsigned char *abuf = NULL; + switch_codec_implementation_t imp = { 0 }; + + if ((var = switch_channel_get_variable(channel, SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE)) && (sval = atoi(var))) { + switch_core_session_get_read_impl(session, &imp); + if (switch_core_codec_init(&codec, + "L16", + NULL, + imp.samples_per_second, + imp.microseconds_per_packet / 1000, + imp.number_of_channels, + SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, + switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Codec Error L16@%uhz %u channels %dms\n", + imp.samples_per_second, imp.number_of_channels, imp.microseconds_per_packet / 1000); + return SWITCH_STATUS_FALSE; + } + + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Codec Activated L16@%uhz %u channels %dms\n", + imp.samples_per_second, imp.number_of_channels, imp.microseconds_per_packet / 1000); + + write_frame.codec = &codec; + switch_zmalloc(abuf, SWITCH_RECOMMENDED_BUFFER_SIZE); + write_frame.data = abuf; + write_frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE; + write_frame.datalen = imp.decoded_bytes_per_packet; + write_frame.samples = write_frame.datalen / sizeof(int16_t); + } if (switch_channel_test_flag(channel, CF_CONTROLLED)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot park channels that are under control already.\n"); @@ -746,7 +779,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session, } if (rate) { - status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, stream_id); + if (switch_channel_test_flag(channel, CF_SERVICE)) { + switch_cond_next(); + status = SWITCH_STATUS_SUCCESS; + } else { + status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, stream_id); + } } else { switch_yield(20000); @@ -760,111 +798,141 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session, if (!SWITCH_READ_ACCEPTABLE(status)) { break; - } else { - if (expires && switch_epoch_time_now(NULL) >= expires) { - switch_channel_hangup(channel, timeout_cause); - break; - } + } - if (switch_channel_test_flag(channel, CF_UNICAST)) { - if (!switch_channel_media_ready(channel)) { - if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) { - return SWITCH_STATUS_FALSE; - } - } + if (write_frame.data) { + switch_generate_sln_silence((int16_t *) write_frame.data, write_frame.samples, sval); + switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0); + } + + if (expires && switch_epoch_time_now(NULL) >= expires) { + switch_channel_hangup(channel, timeout_cause); + break; + } - if (!conninfo) { - if (!(conninfo = switch_channel_get_private(channel, "unicast"))) { - switch_channel_clear_flag(channel, CF_UNICAST); - } + if (switch_channel_test_flag(channel, CF_UNICAST)) { + if (!switch_channel_media_ready(channel)) { + if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) { + return SWITCH_STATUS_FALSE; + } + } - if (conninfo) { - unicast_thread_launch(conninfo); - } + if (!conninfo) { + if (!(conninfo = switch_channel_get_private(channel, "unicast"))) { + switch_channel_clear_flag(channel, CF_UNICAST); } if (conninfo) { - switch_size_t len = 0; - uint32_t flags = 0; - switch_byte_t decoded[SWITCH_RECOMMENDED_BUFFER_SIZE]; - uint32_t dlen = sizeof(decoded); - switch_status_t tstatus; - switch_byte_t *sendbuf = NULL; - uint32_t sendlen = 0; - - switch_assert(read_frame); - - if (switch_test_flag(read_frame, SFF_CNG)) { - sendlen = bpf; - switch_assert(sendlen <= SWITCH_RECOMMENDED_BUFFER_SIZE); - memset(decoded, 255, sendlen); + unicast_thread_launch(conninfo); + } + } + + if (conninfo) { + switch_size_t len = 0; + uint32_t flags = 0; + switch_byte_t decoded[SWITCH_RECOMMENDED_BUFFER_SIZE]; + uint32_t dlen = sizeof(decoded); + switch_status_t tstatus; + switch_byte_t *sendbuf = NULL; + uint32_t sendlen = 0; + + switch_assert(read_frame); + + if (switch_test_flag(read_frame, SFF_CNG)) { + sendlen = bpf; + switch_assert(sendlen <= SWITCH_RECOMMENDED_BUFFER_SIZE); + memset(decoded, 255, sendlen); + sendbuf = decoded; + tstatus = SWITCH_STATUS_SUCCESS; + } else { + if (switch_test_flag(conninfo, SUF_NATIVE)) { + tstatus = SWITCH_STATUS_NOOP; + } else { + switch_codec_t *read_codec = switch_core_session_get_read_codec(session); + tstatus = switch_core_codec_decode(read_codec, + &conninfo->read_codec, + read_frame->data, + read_frame->datalen, read_impl.actual_samples_per_second, decoded, &dlen, &rate, &flags); + } + switch (tstatus) { + case SWITCH_STATUS_NOOP: + case SWITCH_STATUS_BREAK: + sendbuf = read_frame->data; + sendlen = read_frame->datalen; + tstatus = SWITCH_STATUS_SUCCESS; + break; + case SWITCH_STATUS_SUCCESS: sendbuf = decoded; + sendlen = dlen; tstatus = SWITCH_STATUS_SUCCESS; - } else { - if (switch_test_flag(conninfo, SUF_NATIVE)) { - tstatus = SWITCH_STATUS_NOOP; - } else { - switch_codec_t *read_codec = switch_core_session_get_read_codec(session); - tstatus = switch_core_codec_decode(read_codec, - &conninfo->read_codec, - read_frame->data, - read_frame->datalen, read_impl.actual_samples_per_second, decoded, &dlen, &rate, &flags); - } - switch (tstatus) { - case SWITCH_STATUS_NOOP: - case SWITCH_STATUS_BREAK: - sendbuf = read_frame->data; - sendlen = read_frame->datalen; - tstatus = SWITCH_STATUS_SUCCESS; - break; - case SWITCH_STATUS_SUCCESS: - sendbuf = decoded; - sendlen = dlen; - tstatus = SWITCH_STATUS_SUCCESS; - break; - default: - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Codec Error\n"); - switch_ivr_deactivate_unicast(session); - break; - } + break; + default: + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Codec Error\n"); + switch_ivr_deactivate_unicast(session); + break; } + } - if (tstatus == SWITCH_STATUS_SUCCESS) { - len = sendlen; - if (switch_socket_sendto(conninfo->socket, conninfo->remote_addr, 0, (void *) sendbuf, &len) != SWITCH_STATUS_SUCCESS) { - switch_ivr_deactivate_unicast(session); - } + if (tstatus == SWITCH_STATUS_SUCCESS) { + len = sendlen; + if (switch_socket_sendto(conninfo->socket, conninfo->remote_addr, 0, (void *) sendbuf, &len) != SWITCH_STATUS_SUCCESS) { + switch_ivr_deactivate_unicast(session); } } } + } - switch_ivr_parse_all_events(session); + switch_ivr_parse_all_events(session); - if (switch_channel_has_dtmf(channel)) { - switch_dtmf_t dtmf = { 0 }; - switch_channel_dequeue_dtmf(channel, &dtmf); - if (args && args->input_callback) { - if ((status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen)) != SWITCH_STATUS_SUCCESS) { - break; - } + if (switch_channel_has_dtmf(channel)) { + switch_dtmf_t dtmf = { 0 }; + + if (!args->input_callback && !args->buf && !args->dmachine) { + status = SWITCH_STATUS_BREAK; + break; + } + + switch_channel_dequeue_dtmf(channel, &dtmf); + + if (args->dmachine) { + char ds[2] = {dtmf.digit, '\0'}; + if ((status = switch_ivr_dmachine_feed(args->dmachine, ds, NULL)) != SWITCH_STATUS_SUCCESS) { + break; + } + } else if (args && args->input_callback) { + if ((status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen)) != SWITCH_STATUS_SUCCESS) { + break; } } + } - if (switch_core_session_dequeue_event(session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { - if (args && args->input_callback) { - if ((status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen)) != SWITCH_STATUS_SUCCESS) { - break; - } - } else { - switch_channel_event_set_data(channel, event); - switch_event_fire(&event); + if (switch_core_session_dequeue_event(session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { + if (args && args->input_callback) { + if ((status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen)) != SWITCH_STATUS_SUCCESS) { + break; } + } else { + switch_channel_event_set_data(channel, event); + switch_event_fire(&event); } } + + if (args && args->dmachine) { + if ((status = switch_ivr_dmachine_ping(args->dmachine, NULL)) != SWITCH_STATUS_SUCCESS) { + break; + } + } + } + if (write_frame.codec) { + switch_core_codec_destroy(&codec); + } + + switch_safe_free(abuf); + switch_channel_clear_flag(channel, CF_CONTROLLED); switch_channel_clear_flag(channel, CF_PARK); commit f079f898cb4c0ead58f1e668b711e0fef640e1a4 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Nov 11 10:49:02 2010 -0600 declinatio mortuus obfirmo! diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 67641ae..571c167 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1490,6 +1490,7 @@ void sofia_reg_handle_sip_i_register(nua_t *nua, sofia_profile_t *profile, nua_h int network_port = 0; char *is_nat = NULL; +#if 0 /* This seems to cause undesirable effects so nevermind */ if (sip->sip_to && sip->sip_to->a_url && sip->sip_to->a_url->url_host) { const char *to_host = sip->sip_to->a_url->url_host; if (profile->reg_db_domain) { @@ -1500,6 +1501,7 @@ void sofia_reg_handle_sip_i_register(nua_t *nua, sofia_profile_t *profile, nua_h } } } +#endif sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), &network_port); commit 70dca6dd4b05092a5564bba916b66a3f7b27e7dc Author: root <root@proxy-2.(none)> Date: Thu Nov 11 10:56:10 2010 +0300 Makefile changes for x86_64 arch, thnx Steven Ayre and ptlib include path fix. diff --git a/src/mod/endpoints/mod_h323/Makefile b/src/mod/endpoints/mod_h323/Makefile index 8287b34..57668ee 100644 --- a/src/mod/endpoints/mod_h323/Makefile +++ b/src/mod/endpoints/mod_h323/Makefile @@ -1,7 +1,11 @@ BASE=../../../.. -LOCAL_CFLAGS+=-g -ggdb -I/usr/local/include/ptlib -I/usr/local/include/openh323 -I. -DPTRACING=1 -D_REENTRANT -fno-exceptions -LOCAL_LDFLAGS= -lopenh323 -lpt -lrt -include $(BASE)/build/modmake.rules +export PTLIBDIR = $(shell /usr/bin/ptlib-config --ptlibdir) +LOCAL_CFLAGS+=-g -I$PTLIBDIR -I/usr/include/openh323 -I. -DPTRACING=1 -D_REENTRANT -fno-exceptions +LOCAL_LDFLAGS= -L/usr/lib -lopenh323 -lpt -lrt +ifeq ($(shell uname -m),x86_64) +LOCAL_CFLAGS+=-DP_64BIT +endif +include $(BASE)/build/modmake.rules commit 8b68da37ae026257c9b3ca4f1595f1e839756b02 Author: Moises Silva <moy@sangoma.com> Date: Wed Nov 10 19:51:28 2010 -0500 mod_sangoma_codec: fix G722 diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index 0bc0282..6e6fe58 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -94,7 +94,7 @@ vocallo_codec_t g_codec_map[] = { SNGTC_CODEC_L16_2, 10, "L16", "Sangoma L16 2", 40, 320000, 10000, 80, 320, 320, 16000, 16000, 0 }, { SNGTC_CODEC_G729AB, 18, "G729", "Sangoma G729", 40, 8000, 10000, 80, 160, 10, 8000, 8000, 1 }, { SNGTC_CODEC_G726_32, 122, "G726-32", "Sangoma G.726 32k", 40, 32000, 10000, 80, 160, 40, 8000, 8000, 1 }, - { SNGTC_CODEC_G722, 9, "G722", "Sangoma G722", 20, 64000, 10000, 160, 320, 80, 8000, 16000, 1 }, + { SNGTC_CODEC_G722, 9, "G722", "Sangoma G722", 20, 64000, 10000, 80, 160, 80, 8000, 8000, 1 }, /* manually initialized */ { SNGTC_CODEC_GSM_FR, 3, "GSM", "Sangoma GSM", 20, 13200, 20000, 160, 320, 33, 8000, 8000, 0 }, commit 93aa30076b01be366f8f1c487b7b561f5bd7e074 Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Nov 10 19:23:48 2010 -0500 Fixed conflicts diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c index 1714ac1..d8e6c8e 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c @@ -113,40 +113,6 @@ ftdm_status_t sngisdn_stack_stop(ftdm_span_t *span) } -ftdm_status_t sngisdn_wake_up_phy(ftdm_span_t *span) -{ - L1Mngmt cntrl; - Pst pst; - - sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; - - /* initalize the post structure */ - stack_pst_init(&pst); - - /* insert the destination Entity */ - pst.dstEnt = ENTL1; - - /* initalize the control structure */ - memset(&cntrl, 0, sizeof(cntrl)); - - /* initalize the control header */ - stack_hdr_init(&cntrl.hdr); - - cntrl.hdr.msgType = TCNTRL; /* configuration */ - cntrl.hdr.entId.ent = ENTL1; /* entity */ - cntrl.hdr.entId.inst = S_INST; /* instance */ - cntrl.hdr.elmId.elmnt = STTSAP; /* SAP Specific cntrl */ - - cntrl.t.cntrl.action = AENA; - cntrl.t.cntrl.subAction = SAELMNT; - cntrl.t.cntrl.sapId = signal_data->link_id; - - if (sng_isdn_phy_cntrl(&pst, &cntrl)) { - return FTDM_FAIL; - } - return FTDM_SUCCESS; -} - ftdm_status_t sngisdn_activate_phy(ftdm_span_t *span) { commit 086c397cdc920b67382c3c35be3d9c10c4ff0fd3 Merge: 6cbf8a0 d7a136c Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Nov 10 19:22:27 2010 -0500 Merge branch 'master' into netborder Conflicts: libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c libs/freetdm/src/include/private/ftdm_core.h diff --cc libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 04c3b86,39231a0..6974311 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@@ -48,8 -48,7 +48,7 @@@ static ftdm_status_t ftdm_sangoma_isdn_ ftdm_channel_t* ftdm_sangoma_isdn_process_event_states(ftdm_span_t *span, sngisdn_event_data_t *sngisdn_event); static void ftdm_sangoma_isdn_advance_chan_states(ftdm_channel_t *ftdmchan); static void ftdm_sangoma_isdn_poll_events(ftdm_span_t *span); - +static void ftdm_sangoma_isdn_process_phy_events(ftdm_span_t *span, ftdm_oob_event_t event); - static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan); static void ftdm_sangoma_isdn_process_stack_event (ftdm_span_t *span, sngisdn_event_data_t *sngisdn_event); diff --cc libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c index d8e6c8e,bfc00d0..1714ac1 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c @@@ -113,7 -113,41 +113,41 @@@ ftdm_status_t sngisdn_stack_stop(ftdm_s } -ftdm_status_t sng_isdn_wake_up_phy(ftdm_span_t *span) ++ftdm_status_t sngisdn_wake_up_phy(ftdm_span_t *span) + { + L1Mngmt cntrl; + Pst pst; + + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; + + /* initalize the post structure */ + stack_pst_init(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTL1; + + /* initalize the control structure */ + memset(&cntrl, 0, sizeof(cntrl)); + + /* initalize the control header */ + stack_hdr_init(&cntrl.hdr); + + cntrl.hdr.msgType = TCNTRL; /* configuration */ + cntrl.hdr.entId.ent = ENTL1; /* entity */ + cntrl.hdr.entId.inst = S_INST; /* instance */ + cntrl.hdr.elmId.elmnt = STTSAP; /* SAP Specific cntrl */ + + cntrl.t.cntrl.action = AENA; + cntrl.t.cntrl.subAction = SAELMNT; + cntrl.t.cntrl.sapId = signal_data->link_id; + + if (sng_isdn_phy_cntrl(&pst, &cntrl)) { + return FTDM_FAIL; + } + return FTDM_SUCCESS; + } + -ftdm_status_t sng_isdn_activate_phy(ftdm_span_t *span) +ftdm_status_t sngisdn_activate_phy(ftdm_span_t *span) { /* There is no need to start phy, as it will Q921 will send a activate request to phy when it starts */ diff --cc libs/freetdm/src/include/private/ftdm_core.h index 239eb4a,dbf1080..c5f3c4b --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@@ -222,8 -222,8 +222,7 @@@ extern "C" #define ftdm_is_dtmf(key) ((key > 47 && key < 58) || (key > 64 && key < 69) || (key > 96 && key < 101) || key == 35 || key == 42 || key == 87 || key == 119) -#define FTDM_SPAN_IS_BRI(x) ((x)->trunk_type == FTDM_TRUNK_BRI || (x)->trunk_type == FTDM_TRUNK_BRI_PTMP) - +#define FTDM_SPAN_IS_BRI(x) ((x)->trunk_type == FTDM_TRUNK_BRI || (x)->trunk_type == FTDM_TRUNK_BRI_PTMP) - /*! \brief Copy flags from one arbitrary object to another \command dest the object to copy the flags to commit 588a5cee03c497b2715a68037a424976a76f015f Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Nov 10 18:08:55 2010 -0600 update diff --git a/src/switch_rtp.c b/src/switch_rtp.c index f0eead3..ee1c4ac 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -772,6 +772,11 @@ SWITCH_DECLARE(switch_port_t) switch_rtp_request_port(const char *ip) SWITCH_DECLARE(void) switch_rtp_intentional_bugs(switch_rtp_t *rtp_session, switch_rtp_bug_flag_t bugs) { rtp_session->rtp_bugs = bugs; + + if ((rtp_session->rtp_bugs & RTP_BUG_START_SEQ_AT_ZERO)) { + rtp_session->seq = 0; + } + } @@ -1366,7 +1371,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_ENABLE_RTCP)) { switch_sockaddr_info_get(&rtp_session->rtcp_from_addr, NULL, SWITCH_UNSPEC, 0, 0, pool); } - rtp_session->seq = (rtp_session->rtp_bugs & RTP_BUG_START_SEQ_AT_ZERO) ? 0 : (uint16_t) rand(); + rtp_session->seq = (uint16_t) rand(); rtp_session->ssrc = (uint32_t) ((intptr_t) rtp_session + (uint32_t) switch_epoch_time_now(NULL)); rtp_session->send_msg.header.ssrc = htonl(rtp_session->ssrc); commit 6cbf8a0167d9a3d79ff3846e14bc90dbf4fe7371 Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Nov 10 19:03:15 2010 -0500 freetdm: ISDN - Changes to used ftdm IO for d-channel diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c index 65c9dfc..d64e711 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@ -53,7 +53,6 @@ //#define IODEBUG /* helper macros */ -#define FTDM_SPAN_IS_BRI(x) ((x)->trunk_type == FTDM_TRUNK_BRI || (x)->trunk_type == FTDM_TRUNK_BRI_PTMP) #define FTDM_SPAN_IS_NT(x) (((ftdm_isdn_data_t *)(x)->signal_data)->mode == Q921_NT) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c index a975204..c9691e2 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c @@ -1557,11 +1557,11 @@ static __inline__ ftdm_status_t state_advance(ftdm_channel_t *ftdmchan) ftdm_set_string(event.calling_name, ftdmchan->caller_data.cid_name); ftdm_set_string(event.rdnis.digits, ftdmchan->caller_data.rdnis.digits); if (strlen(ftdmchan->caller_data.rdnis.digits)) { - event.rdnis.digits_count = (uint8_t)strlen(ftdmchan->caller_data.rdnis.digits)+1; - event.rdnis.ton = ftdmchan->caller_data.rdnis.type; - event.rdnis.npi = ftdmchan->caller_data.rdnis.plan; + event.rdnis.digits_count = (uint8_t)strlen(ftdmchan->caller_data.rdnis.digits)+1; + event.rdnis.ton = ftdmchan->caller_data.rdnis.type; + event.rdnis.npi = ftdmchan->caller_data.rdnis.plan; } - + event.calling.screening_ind = ftdmchan->caller_data.screen; event.calling.presentation_ind = ftdmchan->caller_data.pres; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 22c89cb..04c3b86 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -47,6 +47,8 @@ static ftdm_status_t ftdm_sangoma_isdn_start(ftdm_span_t *span); ftdm_channel_t* ftdm_sangoma_isdn_process_event_states(ftdm_span_t *span, sngisdn_event_data_t *sngisdn_event); static void ftdm_sangoma_isdn_advance_chan_states(ftdm_channel_t *ftdmchan); +static void ftdm_sangoma_isdn_poll_events(ftdm_span_t *span); +static void ftdm_sangoma_isdn_process_phy_events(ftdm_span_t *span, ftdm_oob_event_t event); static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan); static void ftdm_sangoma_isdn_process_stack_event (ftdm_span_t *span, sngisdn_event_data_t *sngisdn_event); @@ -56,7 +58,7 @@ static sng_isdn_event_interface_t g_sngisdn_event_interface; ftdm_sngisdn_data_t g_sngisdn_data; -extern ftdm_status_t sng_isdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t trace_opt); +extern ftdm_status_t sngisdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t trace_opt); extern ftdm_status_t sngisdn_check_free_ids(void); ftdm_state_map_t sangoma_isdn_state_map = { @@ -238,6 +240,106 @@ static __inline__ void ftdm_sangoma_isdn_advance_chan_states(ftdm_channel_t *ftd } } +static void ftdm_sangoma_isdn_process_phy_events(ftdm_span_t *span, ftdm_oob_event_t event) +{ + + switch (event) { + /* Check if the span woke up from power-saving mode */ + case FTDM_OOB_ALARM_CLEAR: + sngisdn_snd_event(span, SNG_L1EVENT_ALARM_OFF); + if (FTDM_SPAN_IS_BRI(span)) { + ftdm_channel_t *ftdmchan; + ftdm_iterator_t *chaniter = NULL; + ftdm_iterator_t *curr = NULL; + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data; + + chaniter = ftdm_span_get_chan_iterator(span, NULL); + for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { + ftdmchan = (ftdm_channel_t*)ftdm_iterator_current(curr); + sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data; + + if (ftdm_test_flag(sngisdn_info, FLAG_ACTIVATING)) { + ftdm_clear_flag(sngisdn_info, FLAG_ACTIVATING); + + ftdm_sched_timer(signal_data->sched, "delayed_setup", 1, sngisdn_delayed_setup, (void*) ftdmchan->call_data, NULL); + } + } + ftdm_iterator_free(chaniter); + } + break; + case FTDM_OOB_ALARM_TRAP: + sngisdn_snd_event(span, SNG_L1EVENT_ALARM_ON); + break; + default: + /* Ignore other events for now */ + break; + } +} + +static void ftdm_sangoma_isdn_poll_events(ftdm_span_t *span) +{ + ftdm_status_t ret_status; + ret_status = ftdm_span_poll_event(span, 0, NULL); + switch(ret_status) { + case FTDM_SUCCESS: + { + ftdm_event_t *event; + while (ftdm_span_next_event(span, &event) == FTDM_SUCCESS) { + ftdm_sangoma_isdn_process_phy_events(span, event->enum_id); + } + } + break; + case FTDM_TIMEOUT: + /* No events pending */ + break; + default: + ftdm_log(FTDM_LOG_WARNING, "%s:Failed to poll span event\n", span->name); + } +} + +static void *ftdm_sangoma_isdn_dchan_run(ftdm_thread_t *me, void *obj) +{ + uint8_t data[1000]; + ftdm_status_t status = FTDM_SUCCESS; + ftdm_wait_flag_t wflags = FTDM_READ; + ftdm_span_t *span = (ftdm_span_t*) obj; + ftdm_channel_t *dchan = ((sngisdn_span_data_t*)span->signal_data)->dchan; + ftdm_size_t len = 0; + + + ftdm_assert(dchan, "Span does not have a dchannel"); + ftdm_channel_open_chan(dchan); + + while (ftdm_running() && !(ftdm_test_flag(span, FTDM_SPAN_STOP_THREAD))) { + wflags = FTDM_READ; + status = ftdm_channel_wait(dchan, &wflags, 0); + switch(status) { + case FTDM_FAIL: + ftdm_log_chan_msg(dchan, FTDM_LOG_CRIT, "Failed to wait for d-channel\n"); + break; + case FTDM_TIMEOUT: + break; + case FTDM_SUCCESS: + if ((wflags & FTDM_READ)) { + len = 1000; + status = ftdm_channel_read(dchan, data, &len); + if (status == FTDM_SUCCESS) { + sngisdn_snd_data(span, data, len); + } else { + ftdm_log_chan_msg(dchan, FTDM_LOG_WARNING, "Failed to read from channel \n"); + } + } else { + ftdm_log_chan_msg(dchan, FTDM_LOG_CRIT, "Failed to poll for d-channel\n"); + } + break; + default: + ftdm_log_chan_msg(dchan, FTDM_LOG_CRIT, "Unhandled IO event\n"); + } + } + ftdm_channel_close(&dchan); + return NULL; +} + static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj) { ftdm_interrupt_t *ftdm_sangoma_isdn_int[2]; @@ -300,21 +402,8 @@ static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj) } /* Poll for events, e.g HW DTMF */ - ret_status = ftdm_span_poll_event(span, 0, NULL); - switch(ret_status) { - case FTDM_SUCCESS: - { - ftdm_event_t *event; - while (ftdm_span_next_event(span, &event) == FTDM_SUCCESS); - } - break; - case FTDM_TIMEOUT: - /* No events pending */ - break; - default: - ftdm_log(FTDM_LOG_WARNING, "%s:Failed to poll span event\n", span->name); - } - + ftdm_sangoma_isdn_poll_events(span); + if (ftdm_sched_get_time_to_next_timer(signal_data->sched, &sleep) == FTDM_SUCCESS) { if (sleep < 0 || sleep > SNGISDN_EVENT_POLL_RATE) { sleep = SNGISDN_EVENT_POLL_RATE; @@ -498,8 +587,20 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) } break; case FTDM_CHANNEL_STATE_DIALING: /* outgoing call request */ - { - sngisdn_snd_setup(ftdmchan); + { + if (FTDM_SPAN_IS_BRI(ftdmchan->span) && + ftdm_test_flag(ftdmchan, FTDM_CHANNEL_IN_ALARM) && + ftdm_test_flag(ftdmchan->span, FTDM_SPAN_PWR_SAVING)) { + + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Requesting Line activation\n"); + sngisdn_set_flag(sngisdn_info, FLAG_ACTIVATING); + sngisdn_wake_up_phy(ftdmchan->span); + ftdm_sched_timer(signal_data->sched, "timer_t3", signal_data->timer_t3*1000, sngisdn_t3_timeout, (void*) sngisdn_info, NULL); + } else { + sngisdn_snd_setup(ftdmchan); + } } break; case FTDM_CHANNEL_STATE_PROGRESS: @@ -592,7 +693,7 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) sngisdn_snd_release(ftdmchan, 0); if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) { - sng_isdn_set_avail_rate(ftdmchan->span, SNGISDN_AVAIL_DOWN); + sngisdn_set_avail_rate(ftdmchan->span, SNGISDN_AVAIL_DOWN); } } else { sngisdn_snd_disconnect(ftdmchan); @@ -747,7 +848,7 @@ static FIO_SPAN_SET_SIG_STATUS_FUNCTION(ftdm_sangoma_isdn_set_span_sig_status) static ftdm_status_t ftdm_sangoma_isdn_start(ftdm_span_t *span) { ftdm_log(FTDM_LOG_INFO,"Starting span %s:%u.\n",span->name,span->span_id); - if (sng_isdn_stack_start(span) != FTDM_SUCCESS) { + if (sngisdn_stack_start(span) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_CRIT, "Failed to start span %s\n", span->name); return FTDM_FAIL; } @@ -761,6 +862,12 @@ static ftdm_status_t ftdm_sangoma_isdn_start(ftdm_span_t *span) return FTDM_FAIL; } + /*start the dchan monitor thread*/ + if (ftdm_thread_create_detached(ftdm_sangoma_isdn_dchan_run, span) != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_CRIT,"Failed to start Sangoma ISDN d-channel Monitor Thread!\n"); + return FTDM_FAIL; + } + ftdm_log(FTDM_LOG_DEBUG,"Finished starting span %s\n", span->name); return FTDM_SUCCESS; } @@ -782,7 +889,7 @@ static ftdm_status_t ftdm_sangoma_isdn_stop(ftdm_span_t *span) ftdm_sleep(10); } - if (sng_isdn_stack_stop(span) != FTDM_SUCCESS) { + if (sngisdn_stack_stop(span) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_CRIT, "Failed to stop span %s\n", span->name); } @@ -834,7 +941,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_isdn_span_config) return FTDM_FAIL; } - if (sng_isdn_stack_cfg(span) != FTDM_SUCCESS) { + if (sngisdn_stack_cfg(span) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_CRIT, "Sangoma ISDN Stack configuration failed\n"); return FTDM_FAIL; } @@ -856,9 +963,8 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_isdn_span_config) if (span->trunk_type == FTDM_TRUNK_BRI_PTMP || span->trunk_type == FTDM_TRUNK_BRI) { - - ftdm_set_flag(span, FTDM_SPAN_USE_AV_RATE); - sng_isdn_set_avail_rate(span, SNGISDN_AVAIL_PWR_SAVING); + + sngisdn_set_avail_rate(span, SNGISDN_AVAIL_PWR_SAVING); } /* Initialize scheduling context */ @@ -906,7 +1012,9 @@ static FIO_SIG_LOAD_FUNCTION(ftdm_sangoma_isdn_init) g_sngisdn_event_interface.sta.sng_q921_trc_ind = sngisdn_rcv_q921_trace; g_sngisdn_event_interface.sta.sng_q931_sta_ind = sngisdn_rcv_q931_ind; g_sngisdn_event_interface.sta.sng_q931_trc_ind = sngisdn_rcv_q931_trace; - g_sngisdn_event_interface.sta.sng_cc_sta_ind = sngisdn_rcv_cc_ind; + g_sngisdn_event_interface.sta.sng_cc_sta_ind = sngisdn_rcv_cc_ind; + + g_sngisdn_event_interface.io.sng_data_req = sngisdn_rcv_data_req; for(i=1;i<=MAX_VARIANTS;i++) { ftdm_mutex_create(&g_sngisdn_data.ccs[i].mutex); @@ -914,7 +1022,7 @@ static FIO_SIG_LOAD_FUNCTION(ftdm_sangoma_isdn_init) /* initalize sng_isdn library */ - ftdm_assert_return(!sng_isdn_init(&g_sngisdn_event_interface), FTDM_FAIL, "Failed to initialize stack\n"); + ftdm_assert_return(!sng_isdn_init(&g_sngisdn_event_interface), FTDM_FAIL, "Failed to initialize stack\n"); return FTDM_SUCCESS; } @@ -968,11 +1076,11 @@ static FIO_API_FUNCTION(ftdm_sangoma_isdn_api) goto done; } if (!strcasecmp(trace_opt, "q921")) { - sng_isdn_activate_trace(span, SNGISDN_TRACE_Q921); + sngisdn_activate_trace(span, SNGISDN_TRACE_Q921); } else if (!strcasecmp(trace_opt, "q931")) { - sng_isdn_activate_trace(span, SNGISDN_TRACE_Q931); + sngisdn_activate_trace(span, SNGISDN_TRACE_Q931); } else if (!strcasecmp(trace_opt, "disable")) { - sng_isdn_activate_trace(span, SNGISDN_TRACE_DISABLE); + sngisdn_activate_trace(span, SNGISDN_TRACE_DISABLE); } else { stream->write_function(stream, "-ERR invalid trace option <q921|q931> <span name>\n"); } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index e84392e..75262c9 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -74,6 +74,7 @@ typedef enum { FLAG_DELAYED_REL = (1 << 7), FLAG_SENT_PROCEED = (1 << 8), FLAG_SEND_DISC = (1 << 9), + FLAG_ACTIVATING = (1 << 10), /* Used for BRI only, flag is set after we request line CONNECTED */ } sngisdn_flag_t; @@ -167,6 +168,7 @@ typedef struct sngisdn_chan_data { /* Span specific data */ typedef struct sngisdn_span_data { ftdm_span_t *ftdm_span; + ftdm_channel_t *dchan; uint8_t link_id; uint8_t switchtype; uint8_t signalling; /* SNGISDN_SIGNALING_CPE or SNGISDN_SIGNALING_NET */ @@ -181,6 +183,7 @@ typedef struct sngisdn_span_data { uint8_t facility; int8_t facility_timeout; uint8_t num_local_numbers; + uint8_t timer_t3; char* local_numbers[SNGISDN_NUM_LOCAL_NUMBERS]; ftdm_sched_t *sched; ftdm_queue_t *event_queue; @@ -275,7 +278,7 @@ void stack_hdr_init(Header *hdr); void stack_pst_init(Pst *pst); FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_spInstId(int16_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data); FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_suInstId(int16_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data); -FT_DECLARE_INLINE(ftdm_status_t) sng_isdn_set_avail_rate(ftdm_span_t *ftdmspan, sngisdn_avail_t avail); +FT_DECLARE_INLINE(ftdm_status_t) sngisdn_set_avail_rate(ftdm_span_t *ftdmspan, sngisdn_avail_t avail); /* Outbound Call Control functions */ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan); @@ -290,25 +293,28 @@ void sngisdn_snd_reset(ftdm_channel_t *ftdmchan); void sngisdn_snd_con_complete(ftdm_channel_t *ftdmchan); void sngisdn_snd_info_req(ftdm_channel_t *ftdmchan); void sngisdn_snd_status_enq(ftdm_channel_t *ftdmchan); +void sngisdn_snd_data(ftdm_span_t *span, uint8_t *data, ftdm_size_t len); +void sngisdn_snd_event(ftdm_span_t *span, sng_isdn_l1_event_t l1_event); /* Inbound Call Control functions */ -void sngisdn_rcv_con_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, ConEvnt *conEvnt, int16_t dChan, uint8_t ces); -void sngisdn_rcv_con_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, CnStEvnt *cnStEvnt, int16_t dChan, uint8_t ces); -void sngisdn_rcv_cnst_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, CnStEvnt *cnStEvnt, uint8_t evntType, int16_t dChan, uint8_t ces); -void sngisdn_rcv_disc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, DiscEvnt *discEvnt); -void sngisdn_rcv_rel_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, RelEvnt *relEvnt); -void sngisdn_rcv_dat_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, InfoEvnt *infoEvnt); -void sngisdn_rcv_sshl_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, SsHlEvnt *ssHlEvnt, uint8_t action); -void sngisdn_rcv_sshl_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, SsHlEvnt *ssHlEvnt, uint8_t action); -void sngisdn_rcv_rmrt_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, RmRtEvnt *rmRtEvnt, uint8_t action); -void sngisdn_rcv_rmrt_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, RmRtEvnt *rmRtEvnt, uint8_t action); -void sngisdn_rcv_flc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, StaEvnt *staEvnt); -void sngisdn_rcv_fac_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, FacEvnt *facEvnt, uint8_t evntType, int16_t dChan, uint8_t ces); -void sngisdn_rcv_sta_cfm ( int16_t suId, uint32_t suInstId, uint32_t spInstId, StaEvnt *staEvnt); -void sngisdn_rcv_srv_ind ( int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces); -void sngisdn_rcv_srv_cfm ( int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces); -void sngisdn_rcv_rst_cfm ( int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces, uint8_t evntType); -void sngisdn_rcv_rst_ind ( int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces, uint8_t evntType); +void sngisdn_rcv_con_ind(int16_t suId, uint32_t suInstId, uint32_t spInstId, ConEvnt *conEvnt, int16_t dChan, uint8_t ces); +void sngisdn_rcv_con_cfm(int16_t suId, uint32_t suInstId, uint32_t spInstId, CnStEvnt *cnStEvnt, int16_t dChan, uint8_t ces); +void sngisdn_rcv_cnst_ind(int16_t suId, uint32_t suInstId, uint32_t spInstId, CnStEvnt *cnStEvnt, uint8_t evntType, int16_t dChan, uint8_t ces); +void sngisdn_rcv_disc_ind(int16_t suId, uint32_t suInstId, uint32_t spInstId, DiscEvnt *discEvnt); +void sngisdn_rcv_rel_ind(int16_t suId, uint32_t suInstId, uint32_t spInstId, RelEvnt *relEvnt); +void sngisdn_rcv_dat_ind(int16_t suId, uint32_t suInstId, uint32_t spInstId, InfoEvnt *infoEvnt); +void sngisdn_rcv_sshl_ind(int16_t suId, uint32_t suInstId, uint32_t spInstId, SsHlEvnt *ssHlEvnt, uint8_t action); +void sngisdn_rcv_sshl_cfm(int16_t suId, uint32_t suInstId, uint32_t spInstId, SsHlEvnt *ssHlEvnt, uint8_t action); +void sngisdn_rcv_rmrt_ind(int16_t suId, uint32_t suInstId, uint32_t spInstId, RmRtEvnt *rmRtEvnt, uint8_t action); +void sngisdn_rcv_rmrt_cfm(int16_t suId, uint32_t suInstId, uint32_t spInstId, RmRtEvnt *rmRtEvnt, uint8_t action); +void sngisdn_rcv_flc_ind(int16_t suId, uint32_t suInstId, uint32_t spInstId, StaEvnt *staEvnt); +void sngisdn_rcv_fac_ind(int16_t suId, uint32_t suInstId, uint32_t spInstId, FacEvnt *facEvnt, uint8_t evntType, int16_t dChan, uint8_t ces); +void sngisdn_rcv_sta_cfm(int16_t suId, uint32_t suInstId, uint32_t spInstId, StaEvnt *staEvnt); +void sngisdn_rcv_srv_ind(int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces); +void sngisdn_rcv_srv_cfm(int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces); +void sngisdn_rcv_rst_cfm(int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces, uint8_t evntType); +void sngisdn_rcv_rst_ind(int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces, uint8_t evntType); +int16_t sngisdn_rcv_data_req(uint16_t spId, uint8_t *buff, uint32_t length); void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event); void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event); @@ -364,15 +370,18 @@ static __inline__ void sngisdn_set_flag(sngisdn_chan_data_t *sngisdn_info, sngis void handle_sng_log(uint8_t level, char *fmt,...); void sngisdn_set_span_sig_status(ftdm_span_t *ftdmspan, ftdm_signaling_status_t status); +void sngisdn_delayed_setup(void* p_sngisdn_info); void sngisdn_delayed_release(void* p_sngisdn_info); void sngisdn_delayed_connect(void* p_sngisdn_info); void sngisdn_delayed_disconnect(void* p_sngisdn_info); void sngisdn_facility_timeout(void* p_sngisdn_info); +void sngisdn_t3_timeout(void* p_sngisdn_info); /* Stack management functions */ -ftdm_status_t sng_isdn_stack_cfg(ftdm_span_t *span); -ftdm_status_t sng_isdn_stack_start(ftdm_span_t *span); -ftdm_status_t sng_isdn_stack_stop(ftdm_span_t *span); +ftdm_status_t sngisdn_stack_cfg(ftdm_span_t *span); +ftdm_status_t sngisdn_stack_start(ftdm_span_t *span); +ftdm_status_t sngisdn_stack_stop(ftdm_span_t *span); +ftdm_status_t sngisdn_wake_up_phy(ftdm_span_t *span); void sngisdn_print_phy_stats(ftdm_stream_handle_t *stream, ftdm_span_t *span); void sngisdn_print_spans(ftdm_stream_handle_t *stream); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c index 64d7a24..43e35b6 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c @@ -56,9 +56,11 @@ ftdm_status_t add_local_number(const char* val, ftdm_span_t *span) ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span) { unsigned i; - + ftdm_iterator_t *chaniter = NULL; + ftdm_iterator_t *curr = NULL; sngisdn_dchan_data_t *dchan_data; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data; + switch(span->trunk_type) { case FTDM_TRUNK_T1: if (!strcasecmp(switch_name, "ni2") || @@ -122,9 +124,9 @@ ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span) /* add this span to its ent_cc */ signal_data->cc_id = i; - /* create a new dchan */ /* for NFAS - no-dchan on b-channels only links */ + /* create a new dchan */ /* for NFAS - no-dchan on b-channels-only links */ g_sngisdn_data.num_dchan++; - signal_data->dchan_id = g_sngisdn_data.num_dchan; + signal_data->dchan_id = g_sngisdn_data.num_dchan; dchan_data = &g_sngisdn_data.dchans[signal_data->dchan_id]; dchan_data->num_spans++; @@ -136,16 +138,23 @@ ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span) ftdm_log(FTDM_LOG_DEBUG, "%s: cc_id:%d dchan_id:%d span_id:%d\n", span->name, signal_data->cc_id, signal_data->dchan_id, signal_data->span_id); - /* Add the channels to the span */ - for (i=1;i<=span->chan_count;i++) { - unsigned chan_id; - ftdm_channel_t *ftdmchan = span->channels[i]; - /* NFAS is not supported on E1, so span_id will always be 1 for E1 so this will work for E1 as well */ - chan_id = ((signal_data->span_id-1)*NUM_T1_CHANNELS_PER_SPAN)+ftdmchan->physical_chan_id; - dchan_data->channels[chan_id] = (sngisdn_chan_data_t*)ftdmchan->call_data; - dchan_data->num_chans++; + + chaniter = ftdm_span_get_chan_iterator(span, NULL); + for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { + int32_t chan_id; + ftdm_channel_t *ftdmchan = (ftdm_channel_t*)ftdm_iterator_current(curr); + if (ftdmchan->type == FTDM_CHAN_TYPE_DQ921) { + /* set the d-channel */ + signal_data->dchan = ftdmchan; + } else { + /* Add the channels to the span */ + /* NFAS is not supported on E1, so span_id will always be 1 for E1 so this will work for E1 as well */ + chan_id = ((signal_data->span_id-1)*NUM_T1_CHANNELS_PER_SPAN)+ftdmchan->physical_chan_id; + dchan_data->channels[chan_id] = (sngisdn_chan_data_t*)ftdmchan->call_data; + dchan_data->num_chans++; + } } - + ftdm_iterator_free(chaniter); return FTDM_SUCCESS; } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c index bb46fb7..eabaa7a 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c @@ -38,52 +38,52 @@ extern ftdm_sngisdn_data_t g_sngisdn_data; uint8_t sng_isdn_stack_switchtype(sngisdn_switchtype_t switchtype); -ftdm_status_t sng_isdn_cfg_phy(ftdm_span_t *span); -ftdm_status_t sng_isdn_cfg_q921(ftdm_span_t *span); -ftdm_status_t sng_isdn_cfg_q931(ftdm_span_t *span); -ftdm_status_t sng_isdn_cfg_cc(ftdm_span_t *span); +ftdm_status_t sngisdn_cfg_phy(ftdm_span_t *span); +ftdm_status_t sngisdn_cfg_q921(ftdm_span_t *span); +ftdm_status_t sngisdn_cfg_q931(ftdm_span_t *span); +ftdm_status_t sngisdn_cfg_cc(ftdm_span_t *span); -ftdm_status_t sng_isdn_stack_cfg_phy_gen(void); -ftdm_status_t sng_isdn_stack_cfg_q921_gen(void); -ftdm_status_t sng_isdn_stack_cfg_q931_gen(void); -ftdm_status_t sng_isdn_stack_cfg_cc_gen(void); +ftdm_status_t sngisdn_stack_cfg_phy_gen(void); +ftdm_status_t sngisdn_stack_cfg_q921_gen(void); +ftdm_status_t sngisdn_stack_cfg_q931_gen(void); +ftdm_status_t sngisdn_stack_cfg_cc_gen(void); -ftdm_status_t sng_isdn_stack_cfg_phy_psap(ftdm_span_t *span); -ftdm_status_t sng_isdn_stack_cfg_q921_msap(ftdm_span_t *span); -ftdm_status_t sng_isdn_stack_cfg_q921_dlsap(ftdm_span_t *span, uint8_t management); -ftdm_status_t sng_isdn_stack_cfg_q931_tsap(ftdm_span_t *span); -ftdm_status_t sng_isdn_stack_cfg_q931_dlsap(ftdm_span_t *span); -ftdm_status_t sng_isdn_stack_cfg_q931_lce(ftdm_span_t *span); +ftdm_status_t sngisdn_stack_cfg_phy_psap(ftdm_span_t *span); +ftdm_status_t sngisdn_stack_cfg_q921_msap(ftdm_span_t *span); +ftdm_status_t sngisdn_stack_cfg_q921_dlsap(ftdm_span_t *span, uint8_t management); +ftdm_status_t sngisdn_stack_cfg_q931_tsap(ftdm_span_t *span); +ftdm_status_t sngisdn_stack_cfg_q931_dlsap(ftdm_span_t *span); +ftdm_status_t sngisdn_stack_cfg_q931_lce(ftdm_span_t *span); -ftdm_status_t sng_isdn_stack_cfg_cc_sap(ftdm_span_t *span); +ftdm_status_t sngisdn_stack_cfg_cc_sap(ftdm_span_t *span); -ftdm_status_t sng_isdn_stack_cfg(ftdm_span_t *span) +ftdm_status_t sngisdn_stack_cfg(ftdm_span_t *span) { sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; if (!g_sngisdn_data.gen_config_done) { g_sngisdn_data.gen_config_done = 1; ftdm_log(FTDM_LOG_DEBUG, "Starting general stack configuration\n"); - if(sng_isdn_stack_cfg_phy_gen()!= FTDM_SUCCESS) { + if(sngisdn_stack_cfg_phy_gen()!= FTDM_SUCCESS) { ftdm_log(FTDM_LOG_CRIT, "Failed general physical configuration\n"); return FTDM_FAIL; } ftdm_log(FTDM_LOG_DEBUG, "General stack physical done\n"); - if(sng_isdn_stack_cfg_q921_gen()!= FTDM_SUCCESS) { + if(sngisdn_stack_cfg_q921_gen()!= FTDM_SUCCESS) { ftdm_log(FTDM_LOG_CRIT, "Failed general q921 configuration\n"); return FTDM_FAIL; } ftdm_log(FTDM_LOG_DEBUG, "General stack q921 done\n"); - if(sng_isdn_stack_cfg_q931_gen()!= FTDM_SUCCESS) { + if(sngisdn_stack_cfg_q931_gen()!= FTDM_SUCCESS) { ftdm_log(FTDM_LOG_CRIT, "Failed general q921 configuration\n"); return FTDM_FAIL; } ftdm_log(FTDM_LOG_DEBUG, "General stack q931 done\n"); - if(sng_isdn_stack_cfg_cc_gen()!= FTDM_SUCCESS) { + if(sngisdn_stack_cfg_cc_gen()!= FTDM_SUCCESS) { ftdm_log(FTDM_LOG_CRIT, "Failed general CC configuration\n"); return FTDM_FAIL; } @@ -92,26 +92,26 @@ ftdm_status_t sng_isdn_stack_cfg(ftdm_span_t *span) } /* TODO: for NFAS, should only call these function for spans with d-chans */ - if (sng_isdn_stack_cfg_phy_psap(span) != FTDM_SUCCESS) { + if (sngisdn_stack_cfg_phy_psap(span) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_ERROR, "%s:phy_psap configuration failed\n", span->name); return FTDM_FAIL; } ftdm_log(FTDM_LOG_DEBUG, "%s:phy_psap configuration done\n", span->name); - if (sng_isdn_stack_cfg_q921_msap(span) != FTDM_SUCCESS) { + if (sngisdn_stack_cfg_q921_msap(span) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_ERROR, "%s:q921_msap configuration failed\n", span->name); return FTDM_FAIL; } ftdm_log(FTDM_LOG_DEBUG, "%s:q921_msap configuration done\n", span->name); - if (sng_isdn_stack_cfg_q921_dlsap(span, 0) != FTDM_SUCCESS) { + if (sngisdn_stack_cfg_q921_dlsap(span, 0) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_ERROR, "%s:q921_dlsap configuration failed\n", span->name); return FTDM_FAIL; } ftdm_log(FTDM_LOG_DEBUG, "%s:q921_dlsap configuration done\n", span->name); if (span->trunk_type == FTDM_TRUNK_BRI_PTMP) { - if (sng_isdn_stack_cfg_q921_dlsap(span, 1) != FTDM_SUCCESS) { + if (sngisdn_stack_cfg_q921_dlsap(span, 1) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_ERROR, "%s:q921_dlsap management configuration failed\n", span->name); return FTDM_FAIL; } @@ -119,13 +119,13 @@ ftdm_status_t sng_isdn_stack_cfg(ftdm_span_t *span) } - if (sng_isdn_stack_cfg_q931_dlsap(span) != FTDM_SUCCESS) { + if (sngisdn_stack_cfg_q931_dlsap(span) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_ERROR, "%s:q931_dlsap configuration failed\n", span->name); return FTDM_FAIL; } ftdm_log(FTDM_LOG_DEBUG, "%s:q931_dlsap configuration done\n", span->name); - if (sng_isdn_stack_cfg_q931_lce(span) != FTDM_SUCCESS) { + if (sngisdn_stack_cfg_q931_lce(span) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_ERROR, "%s:q931_lce configuration failed\n", span->name); return FTDM_FAIL; } @@ -134,13 +134,13 @@ ftdm_status_t sng_isdn_stack_cfg(ftdm_span_t *span) if (!g_sngisdn_data.ccs[signal_data->cc_id].config_done) { g_sngisdn_data.ccs[signal_data->cc_id].config_done = 1; /* if BRI, need to configure dlsap_mgmt */ - if (sng_isdn_stack_cfg_q931_tsap(span) != FTDM_SUCCESS) { + if (sngisdn_stack_cfg_q931_tsap(span) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_ERROR, "%s:q931_tsap configuration failed\n", span->name); return FTDM_FAIL; } ftdm_log(FTDM_LOG_DEBUG, "%s:q931_tsap configuration done\n", span->name); - if (sng_isdn_stack_cfg_cc_sap(span) != FTDM_SUCCESS) { + if (sngisdn_stack_cfg_cc_sap(span) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_ERROR, "%s:cc_sap configuration failed\n", span->name); return FTDM_FAIL; } @@ -153,7 +153,7 @@ ftdm_status_t sng_isdn_stack_cfg(ftdm_span_t *span) -ftdm_status_t sng_isdn_stack_cfg_phy_gen(void) +ftdm_status_t sngisdn_stack_cfg_phy_gen(void) { /*local variables*/ L1Mngmt cfg; /*configuration structure*/ @@ -191,14 +191,11 @@ ftdm_status_t sng_isdn_stack_cfg_phy_gen(void) return FTDM_SUCCESS; } -ftdm_status_t sng_isdn_stack_cfg_phy_psap(ftdm_span_t *span) -{ - ftdm_iterator_t *chaniter; - ftdm_iterator_t *curr; +ftdm_status_t sngisdn_stack_cfg_phy_psap(ftdm_span_t *span) +{ L1Mngmt cfg; Pst pst; - int32_t d_channel_fd = -1; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; /* initalize the post structure */ @@ -220,25 +217,13 @@ ftdm_status_t sng_isdn_stack_cfg_phy_psap(ftdm_span_t *span) cfg.hdr.elmId.elmnt = STPSAP; cfg.hdr.elmId.elmntInst1 = signal_data->link_id; - - - /* Find the d-channel */ - chaniter = ftdm_span_get_chan_iterator(span, NULL); - for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { - ftdm_channel_t *ftdmchan = (ftdm_channel_t*)ftdm_iterator_current(curr); - if (ftdmchan->type == FTDM_CHAN_TYPE_DQ921) { - d_channel_fd = (int32_t)ftdmchan->sockfd; - break; - } - } - ftdm_iterator_free(chaniter); - - if(d_channel_fd < 0) { + + if (!signal_data->dchan) { ftdm_log(FTDM_LOG_ERROR, "%s:No d-channels specified\n", span->name); return FTDM_FAIL; - } - - cfg.t.cfg.s.l1PSAP.sockfd = d_channel_fd; + } + + cfg.t.cfg.s.l1PSAP.sockfd = (int32_t)signal_data->dchan->sockfd; switch(span->trunk_type) { case FTDM_TRUNK_E1: @@ -257,7 +242,7 @@ ftdm_status_t sng_isdn_stack_cfg_phy_psap(ftdm_span_t *span) return FTDM_FAIL; } cfg.t.cfg.s.l1PSAP.spId = signal_data->link_id; - + if (sng_isdn_phy_config(&pst, &cfg)) { return FTDM_FAIL; } @@ -265,7 +250,7 @@ ftdm_status_t sng_isdn_stack_cfg_phy_psap(ftdm_span_t *span) } -ftdm_status_t sng_isdn_stack_cfg_q921_gen(void) +ftdm_status_t sngisdn_stack_cfg_q921_gen(void) { BdMngmt cfg; Pst pst; @@ -308,7 +293,7 @@ ftdm_status_t sng_isdn_stack_cfg_q921_gen(void) return FTDM_SUCCESS; } -ftdm_status_t sng_isdn_stack_cfg_q921_msap(ftdm_span_t *span) +ftdm_status_t sngisdn_stack_cfg_q921_msap(ftdm_span_t *span) { BdMngmt cfg; Pst pst; @@ -401,7 +386,7 @@ ftdm_status_t sng_isdn_stack_cfg_q921_msap(ftdm_span_t *span) return FTDM_SUCCESS; } -ftdm_status_t sng_isdn_stack_cfg_q921_dlsap(ftdm_span_t *span, uint8_t management) +ftdm_status_t sngisdn_stack_cfg_q921_dlsap(ftdm_span_t *span, uint8_t management) { BdMngmt cfg; Pst pst; @@ -483,7 +468,7 @@ ftdm_status_t sng_isdn_stack_cfg_q921_dlsap(ftdm_span_t *span, uint8_t managemen return FTDM_SUCCESS; } -ftdm_status_t sng_isdn_stack_cfg_q931_gen(void) +ftdm_status_t sngisdn_stack_cfg_q931_gen(void) { InMngmt cfg; Pst pst; @@ -538,7 +523,7 @@ ftdm_status_t sng_isdn_stack_cfg_q931_gen(void) } /* Link between CC and q931 */ -ftdm_status_t sng_isdn_stack_cfg_q931_tsap(ftdm_span_t *span) +ftdm_status_t sngisdn_stack_cfg_q931_tsap(ftdm_span_t *span) { InMngmt cfg; Pst pst; @@ -601,7 +586,7 @@ ftdm_status_t sng_isdn_stack_cfg_q931_tsap(ftdm_span_t *span) return FTDM_SUCCESS; } -ftdm_status_t sng_isdn_stack_cfg_q931_dlsap(ftdm_span_t *span) +ftdm_status_t sngisdn_stack_cfg_q931_dlsap(ftdm_span_t *span) { InMngmt cfg; Pst pst; @@ -851,7 +836,7 @@ ftdm_status_t sng_isdn_stack_cfg_q931_dlsap(ftdm_span_t *span) return FTDM_SUCCESS; } -ftdm_status_t sng_isdn_stack_cfg_q931_lce(ftdm_span_t *span) +ftdm_status_t sngisdn_stack_cfg_q931_lce(ftdm_span_t *span) { InMngmt cfg; Pst pst; @@ -927,7 +912,7 @@ ftdm_status_t sng_isdn_stack_cfg_q931_lce(ftdm_span_t *span) } -ftdm_status_t sng_isdn_stack_cfg_cc_gen(void) +ftdm_status_t sngisdn_stack_cfg_cc_gen(void) { CcMngmt cfg; Pst pst; @@ -966,7 +951,7 @@ ftdm_status_t sng_isdn_stack_cfg_cc_gen(void) } -ftdm_status_t sng_isdn_stack_cfg_cc_sap(ftdm_span_t *span) +ftdm_status_t sngisdn_stack_cfg_cc_sap(ftdm_span_t *span) { CcMngmt cfg; Pst pst; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c index 27c16c2..d8e6c8e 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c @@ -37,27 +37,27 @@ void stack_resp_hdr_init(Header *hdr); -ftdm_status_t sng_isdn_activate_phy(ftdm_span_t *span); -ftdm_status_t sng_isdn_deactivate_phy(ftdm_span_t *span); +ftdm_status_t sngisdn_activate_phy(ftdm_span_t *span); +ftdm_status_t sngisdn_deactivate_phy(ftdm_span_t *span); -ftdm_status_t sng_isdn_activate_cc(ftdm_span_t *span); -ftdm_status_t sng_isdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t trace_opt); +ftdm_status_t sngisdn_activate_cc(ftdm_span_t *span); +ftdm_status_t sngisdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t trace_opt); -ftdm_status_t sng_isdn_cntrl_q931(ftdm_span_t *span, uint8_t action, uint8_t subaction); -ftdm_status_t sng_isdn_cntrl_q921(ftdm_span_t *span, uint8_t action, uint8_t subaction); +ftdm_status_t sngisdn_cntrl_q931(ftdm_span_t *span, uint8_t action, uint8_t subaction); +ftdm_status_t sngisdn_cntrl_q921(ftdm_span_t *span, uint8_t action, uint8_t subaction); extern ftdm_sngisdn_data_t g_sngisdn_data; -ftdm_status_t sng_isdn_stack_stop(ftdm_span_t *span); +ftdm_status_t sngisdn_stack_stop(ftdm_span_t *span); -ftdm_status_t sng_isdn_stack_start(ftdm_span_t *span) +ftdm_status_t sngisdn_stack_start(ftdm_span_t *span) { sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; - if (sng_isdn_cntrl_q921(span, ABND_ENA, NOTUSED) != FTDM_SUCCESS) { + if (sngisdn_cntrl_q921(span, ABND_ENA, NOTUSED) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_CRIT, "%s:Failed to activate stack q921\n", span->name); return FTDM_FAIL; } @@ -72,7 +72,7 @@ ftdm_status_t sng_isdn_stack_start(ftdm_span_t *span) ftdm_log(FTDM_LOG_DEBUG, "%s:Stack q921 activated\n", span->name); if (!g_sngisdn_data.ccs[signal_data->cc_id].activation_done) { g_sngisdn_data.ccs[signal_data->cc_id].activation_done = 1; - if (sng_isdn_activate_cc(span) != FTDM_SUCCESS) { + if (sngisdn_activate_cc(span) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_CRIT, "%s:Failed to activate stack CC\n", span->name); return FTDM_FAIL; } @@ -80,7 +80,7 @@ ftdm_status_t sng_isdn_stack_start(ftdm_span_t *span) } - if (sng_isdn_cntrl_q931(span, ABND_ENA, SAELMNT) != FTDM_SUCCESS) { + if (sngisdn_cntrl_q931(span, ABND_ENA, SAELMNT) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_CRIT, "%s:Failed to activate stack q931\n", span->name); return FTDM_FAIL; } @@ -90,20 +90,20 @@ ftdm_status_t sng_isdn_stack_start(ftdm_span_t *span) return FTDM_SUCCESS; } -ftdm_status_t sng_isdn_stack_stop(ftdm_span_t *span) +ftdm_status_t sngisdn_stack_stop(ftdm_span_t *span) { /* Stop L1 first, so we do not receive any more frames */ - if (sng_isdn_deactivate_phy(span) != FTDM_SUCCESS) { + if (sngisdn_deactivate_phy(span) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_CRIT, "%s:Failed to deactivate stack phy\n", span->name); return FTDM_FAIL; } - if (sng_isdn_cntrl_q931(span, AUBND_DIS, SAELMNT) != FTDM_SUCCESS) { + if (sngisdn_cntrl_q931(span, AUBND_DIS, SAELMNT) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_CRIT, "%s:Failed to deactivate stack q931\n", span->name); return FTDM_FAIL; } - if (sng_isdn_cntrl_q921(span, AUBND_DIS, SAELMNT) != FTDM_SUCCESS) { + if (sngisdn_cntrl_q921(span, AUBND_DIS, SAELMNT) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_CRIT, "%s:Failed to deactivate stack q921\n", span->name); return FTDM_FAIL; } @@ -113,7 +113,7 @@ ftdm_status_t sng_isdn_stack_stop(ftdm_span_t *span) } -ftdm_status_t sng_isdn_activate_phy(ftdm_span_t *span) +ftdm_status_t sngisdn_activate_phy(ftdm_span_t *span) { /* There is no need to start phy, as it will Q921 will send a activate request to phy when it starts */ @@ -121,7 +121,7 @@ ftdm_status_t sng_isdn_activate_phy(ftdm_span_t *span) return FTDM_SUCCESS; } -ftdm_status_t sng_isdn_deactivate_phy(ftdm_span_t *span) +ftdm_status_t sngisdn_deactivate_phy(ftdm_span_t *span) { L1Mngmt cntrl; Pst pst; @@ -155,8 +155,41 @@ ftdm_status_t sng_isdn_deactivate_phy(ftdm_span_t *span) return FTDM_SUCCESS; } +ftdm_status_t sngisdn_wake_up_phy(ftdm_span_t *span) +{ + L1Mngmt cntrl; + Pst pst; + + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; + + /* initalize the post structure */ + stack_pst_init(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTL1; + + /* initalize the control structure */ + memset(&cntrl, 0, sizeof(cntrl)); + + /* initalize the control header */ + stack_hdr_init(&cntrl.hdr); + + cntrl.hdr.msgType = TCNTRL; /* configuration */ + cntrl.hdr.entId.ent = ENTL1; /* entity */ + cntrl.hdr.entId.inst = S_INST; /* instance */ + cntrl.hdr.elmId.elmnt = STTSAP; /* SAP Specific cntrl */ + + cntrl.t.cntrl.action = AENA; + cntrl.t.cntrl.subAction = SAELMNT; + cntrl.t.cntrl.sapId = signal_data->link_id; + + if (sng_isdn_phy_cntrl(&pst, &cntrl)) { + return FTDM_FAIL; + } + return FTDM_SUCCESS; +} -ftdm_status_t sng_isdn_activate_cc(ftdm_span_t *span) +ftdm_status_t sngisdn_activate_cc(ftdm_span_t *span) { CcMngmt cntrl; Pst pst; @@ -190,7 +223,7 @@ ftdm_status_t sng_isdn_activate_cc(ftdm_span_t *span) return FTDM_SUCCESS; } -ftdm_status_t sng_isdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t trace_opt) +ftdm_status_t sngisdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t trace_opt) { sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; switch (trace_opt) { @@ -199,7 +232,7 @@ ftdm_status_t sng_isdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t tra ftdm_log(FTDM_LOG_INFO, "s%d Disabling q921 trace\n", signal_data->link_id); sngisdn_clear_trace_flag(signal_data, SNGISDN_TRACE_Q921); - if (sng_isdn_cntrl_q921(span, ADISIMM, SATRC) != FTDM_SUCCESS) { + if (sngisdn_cntrl_q921(span, ADISIMM, SATRC) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_ERROR, "s%d Failed to disable q921 trace\n"); } } @@ -207,7 +240,7 @@ ftdm_status_t sng_isdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t tra ftdm_log(FTDM_LOG_INFO, "s%d Disabling q931 trace\n", signal_data->link_id); sngisdn_clear_trace_flag(signal_data, SNGISDN_TRACE_Q931); - if (sng_isdn_cntrl_q931(span, ADISIMM, SATRC) != FTDM_SUCCESS) { + if (sngisdn_cntrl_q931(span, ADISIMM, SATRC) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_ERROR, "s%d Failed to disable q931 trace\n"); } } @@ -217,7 +250,7 @@ ftdm_status_t sng_isdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t tra ftdm_log(FTDM_LOG_INFO, "s%d Enabling q921 trace\n", signal_data->link_id); sngisdn_set_trace_flag(signal_data, SNGISDN_TRACE_Q921); - if (sng_isdn_cntrl_q921(span, AENA, SATRC) != FTDM_SUCCESS) { + if (sngisdn_cntrl_q921(span, AENA, SATRC) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_ERROR, "s%d Failed to enable q921 trace\n"); } } @@ -227,7 +260,7 @@ ftdm_status_t sng_isdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t tra ftdm_log(FTDM_LOG_INFO, "s%d Enabling q931 trace\n", signal_data->link_id); sngisdn_set_trace_flag(signal_data, SNGISDN_TRACE_Q931); - if (sng_isdn_cntrl_q931(span, AENA, SATRC) != FTDM_SUCCESS) { + if (sngisdn_cntrl_q931(span, AENA, SATRC) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_ERROR, "s%d Failed to enable q931 trace\n"); } } @@ -237,7 +270,7 @@ ftdm_status_t sng_isdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t tra } -ftdm_status_t sng_isdn_cntrl_q931(ftdm_span_t *span, uint8_t action, uint8_t subaction) +ftdm_status_t sngisdn_cntrl_q931(ftdm_span_t *span, uint8_t action, uint8_t subaction) { InMngmt cntrl; Pst pst; @@ -276,7 +309,7 @@ ftdm_status_t sng_isdn_cntrl_q931(ftdm_span_t *span, uint8_t action, uint8_t sub } -ftdm_status_t sng_isdn_cntrl_q921(ftdm_span_t *span, uint8_t action, uint8_t subaction) +ftdm_status_t sngisdn_cntrl_q921(ftdm_span_t *span, uint8_t action, uint8_t subaction) { BdMngmt cntrl; Pst pst; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 7ca4085..37613cc 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -539,7 +539,7 @@ void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event) case FTDM_CHANNEL_STATE_DIALING: /* Remote side rejected our SETUP message on outbound call */ if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) { - sng_isdn_set_avail_rate(ftdmchan->span, SNGISDN_AVAIL_DOWN); + sngisdn_set_avail_rate(ftdmchan->span, SNGISDN_AVAIL_DOWN); } /* fall-through */ case FTDM_CHANNEL_STATE_PROGRESS: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 3284d54..bf44cb2 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -600,6 +600,17 @@ void sngisdn_snd_release(ftdm_channel_t *ftdmchan, uint8_t glare) return; } +void sngisdn_snd_data(ftdm_span_t *span, uint8_t *data, ftdm_size_t len) +{ + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data; + sng_isdn_data_ind(signal_data->link_id, data, len); +} + +void sngisdn_snd_event(ftdm_span_t *span, sng_isdn_l1_event_t l1_event) +{ + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data; + sng_isdn_event_ind(signal_data->link_id, l1_event); +} /* For Emacs: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c index 5580f3a..e7ebc8f 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c @@ -736,7 +736,7 @@ void sngisdn_rcv_q931_ind(InMngmt *status) DECODE_LCM_CAUSE(status->t.usta.alarm.cause), status->t.usta.alarm.cause); sngisdn_set_span_sig_status(ftdmspan, FTDM_SIG_STATE_UP); - sng_isdn_set_avail_rate(ftdmspan, SNGISDN_AVAIL_UP); + sngisdn_set_avail_rate(ftdmspan, SNGISDN_AVAIL_UP); } else { ftdm_log(FTDM_LOG_WARNING, "[SNGISDN Q931] s%d: %s: %s(%d): %s(%d)\n", status->t.usta.suId, @@ -745,7 +745,7 @@ void sngisdn_rcv_q931_ind(InMngmt *status) DECODE_LCM_CAUSE(status->t.usta.alarm.cause), status->t.usta.alarm.cause); sngisdn_set_span_sig_status(ftdmspan, FTDM_SIG_STATE_DOWN); - sng_isdn_set_avail_rate(ftdmspan, SNGISDN_AVAIL_PWR_SAVING); + sngisdn_set_avail_rate(ftdmspan, SNGISDN_AVAIL_PWR_SAVING); } } break; @@ -866,6 +866,26 @@ end_of_trace: return; } +int16_t sngisdn_rcv_data_req(uint16_t spId, uint8_t *buff, uint32_t length) +{ + ftdm_status_t status; + ftdm_wait_flag_t flags = FTDM_WRITE; + sngisdn_span_data_t *signal_data = g_sngisdn_data.spans[spId]; + ftdm_assert(signal_data, "Received Data request on unconfigured span\n"); + + status = signal_data->dchan->fio->wait(signal_data->dchan, &flags, 10); + if (status != FTDM_SUCCESS) { + ftdm_log_chan_msg(signal_data->dchan, FTDM_LOG_WARNING, "transmit timed-out\n"); + return -1; + } + status = signal_data->dchan->fio->write(signal_data->dchan, buff, (ftdm_size_t*)&length); + if (status != FTDM_SUCCESS) { + ftdm_log_chan_msg(signal_data->dchan, FTDM_LOG_CRIT, "Failed to transmit frame\n"); + return -1; + } + return 0; +} + void sngisdn_rcv_sng_assert(char *message) { ftdm_assert(0, message); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index f54f7db..a418103 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -137,7 +137,7 @@ FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_spInstId(int16_t cc_id, uint32_ return FTDM_SUCCESS; } -ftdm_status_t sng_isdn_set_avail_rate(ftdm_span_t *span, sngisdn_avail_t avail) +ftdm_status_t sngisdn_set_avail_rate(ftdm_span_t *span, sngisdn_avail_t avail) { if (span->trunk_type == FTDM_TRUNK_BRI || @@ -382,6 +382,39 @@ ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmc return FTDM_SUCCESS; } +void sngisdn_t3_timeout(void* p_sngisdn_info) +{ + sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*)p_sngisdn_info; + ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Timer T3 expired (suId:%d suInstId:%u spInstId:%u)\n", + signal_data->cc_id, sngisdn_info->glare.spInstId, sngisdn_info->glare.suInstId); + ftdm_mutex_lock(ftdmchan->mutex); + if (ftdm_test_flag(sngisdn_info, FLAG_ACTIVATING)){ + /* PHY layer timed-out, need to clear the call */ + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Failed to Wake-Up line (suId:%d suInstId:%u spInstId:%u)\n", + signal_data->cc_id, sngisdn_info->glare.spInstId, sngisdn_info->glare.suInstId); + + ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NO_ROUTE_DESTINATION; + ftdm_clear_flag(sngisdn_info, FLAG_ACTIVATING); + ftdm_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + } + ftdm_mutex_unlock(ftdmchan->mutex); +} + +void sngisdn_delayed_setup(void* p_sngisdn_info) +{ + sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*)p_sngisdn_info; + ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + + ftdm_mutex_lock(ftdmchan->mutex); + sngisdn_snd_setup(ftdmchan); + ftdm_mutex_unlock(ftdmchan->mutex); + return; +} + void sngisdn_delayed_release(void* p_sngisdn_info) { sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*)p_sngisdn_info; diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index 8bdbdd6..239eb4a 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -222,6 +222,8 @@ extern "C" { #define ftdm_is_dtmf(key) ((key > 47 && key < 58) || (key > 64 && key < 69) || (key > 96 && key < 101) || key == 35 || key == 42 || key == 87 || key == 119) +#define FTDM_SPAN_IS_BRI(x) ((x)->trunk_type == FTDM_TRUNK_BRI || (x)->trunk_type == FTDM_TRUNK_BRI_PTMP) + /*! \brief Copy flags from one arbitrary object to another \command dest the object to copy the flags to diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index bddefd9..78ac8f6 100644 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -176,10 +176,11 @@ typedef enum { FTDM_SPAN_USE_CHAN_QUEUE = (1 << 6), FTDM_SPAN_SUGGEST_CHAN_ID = (1 << 7), FTDM_SPAN_USE_AV_RATE = (1 << 8), + FTDM_SPAN_PWR_SAVING = (1 << 9), /* If you use this flag, you MUST call ftdm_span_trigger_signals to deliver the user signals * after having called ftdm_send_span_signal(), which with this flag it will just enqueue the signal * for later delivery */ - FTDM_SPAN_USE_SIGNALS_QUEUE = (1 << 9), + FTDM_SPAN_USE_SIGNALS_QUEUE = (1 << 10), } ftdm_span_flag_t; /*! \brief Channel supported features */ commit a2e16ce83c4a4adb81ae1b24361a57f7004de01f Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Thu Nov 11 00:16:25 2010 +0100 ftmod_libpri: Minor cleanups in ftdm_libpri_configure_span(). Move some things around and remove 'paramindex' var (just use 'i' for that too). Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 79159eb..787e995 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -1639,13 +1639,11 @@ static uint32_t parse_opts(const char *in) */ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) { - uint32_t i; + ftdm_libpri_data_t *isdn_data = NULL; + //ftdm_channel_t *dchan = NULL; uint32_t bchan_count = 0; uint32_t dchan_count = 0; - uint32_t paramindex = 0; - //ftdm_channel_t *dchan = NULL; - ftdm_libpri_data_t *isdn_data; - const char *var, *val; + uint32_t i; if (ftdm_span_get_trunk_type(span) >= FTDM_TRUNK_NONE) { ftdm_log(FTDM_LOG_WARNING, "Invalid trunk type '%s' defaulting to T1.\n", ftdm_span_get_trunk_type_str(span)); @@ -1721,9 +1719,9 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) return FTDM_FAIL; } - for (paramindex = 0; paramindex < 10 && ftdm_parameters[paramindex].var; paramindex++) { - var = ftdm_parameters[paramindex].var; - val = ftdm_parameters[paramindex].val; + for (i = 0; i < 10 && ftdm_parameters[i].var; i++) { + const char *var = ftdm_parameters[i].var; + const char *val = ftdm_parameters[i].val; if (!val) { ftdm_log(FTDM_LOG_ERROR, "Parameter '%s' has no value\n", var); commit 9ff4cfd5699f4f9c6fc6ae0c60c5114ee9557069 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Thu Nov 11 00:03:06 2010 +0100 ftmod_libpri: "ftdm libpri debug <span>" now prints the current debug flags Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index fff3f45..79159eb 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -167,19 +167,23 @@ static void s_pri_message(struct pri *pri, char *s) ftdm_log(FTDM_LOG_DEBUG, "%s", s); } +#define PRI_DEBUG_Q921_ALL (PRI_DEBUG_Q921_RAW | PRI_DEBUG_Q921_DUMP | PRI_DEBUG_Q921_STATE) +#define PRI_DEBUG_Q931_ALL (PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q931_STATE | PRI_DEBUG_Q931_ANOMALY) + static const struct ftdm_libpri_debug { const char *name; const int flags; } ftdm_libpri_debug[] = { + /* NOTE: order is important for print_debug() */ + { "q921_all", PRI_DEBUG_Q921_ALL }, { "q921_raw", PRI_DEBUG_Q921_RAW }, { "q921_dump", PRI_DEBUG_Q921_DUMP }, { "q921_state", PRI_DEBUG_Q921_STATE }, - { "q921_all", (PRI_DEBUG_Q921_RAW | PRI_DEBUG_Q921_DUMP | PRI_DEBUG_Q921_STATE) }, + { "q931_all", PRI_DEBUG_Q931_ALL }, { "q931_dump", PRI_DEBUG_Q931_DUMP }, { "q931_state", PRI_DEBUG_Q931_STATE }, { "q931_anomaly", PRI_DEBUG_Q931_ANOMALY }, - { "q931_all", (PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q931_STATE | PRI_DEBUG_Q931_ANOMALY) }, { "config", PRI_DEBUG_CONFIG }, { "apdu", PRI_DEBUG_APDU }, @@ -217,13 +221,43 @@ static int parse_debug(const char *in, uint32_t *flags) return res; } +static int print_debug(uint32_t flags, char *tmp, const int size) +{ + int offset = 0; + int res = 0; + int i; + + if ((flags & PRI_DEBUG_ALL) == PRI_DEBUG_ALL) { + strcat(tmp, "all"); + return 0; + } + else if (!flags) { + strcat(tmp, "none"); + return 0; + } + + for (i = 0; i < ARRAY_SIZE(ftdm_libpri_debug); i++) { + if ((flags & ftdm_libpri_debug[i].flags) == ftdm_libpri_debug[i].flags) { + res = snprintf(&tmp[offset], size - offset, "%s,", ftdm_libpri_debug[i].name); + if (res <= 0 || res == (size - offset)) + goto out; + offset += res; + flags &= ~ftdm_libpri_debug[i].flags; /* remove detected flags to make *_all work correctly */ + } + } + +out: + tmp[offset - 1] = '\0'; + return 0; +} + static ftdm_status_t ftdm_libpri_start(ftdm_span_t *span); static ftdm_io_interface_t ftdm_libpri_interface; static const char *ftdm_libpri_usage = "Usage:\n" "libpri kill <span>\n" - "libpri debug <span> <all|none|flag,...flagN>\n" + "libpri debug <span> [all|none|flag,...flagN]\n" "\n" "Possible debug flags:\n" "\tq921_raw - Q.921 Raw messages\n" @@ -289,7 +323,7 @@ static FIO_API_FUNCTION(ftdm_libpri_api) } } - if (argc > 2) { + if (argc >= 2) { if (!strcasecmp(argv[0], "debug")) { ftdm_span_t *span = NULL; @@ -302,6 +336,13 @@ static FIO_API_FUNCTION(ftdm_libpri_api) goto done; } + if (argc == 2) { + char tmp[100] = { 0 }; + print_debug(pri_get_debug(isdn_data->spri.pri), tmp, sizeof(tmp)); + stream->write_function(stream, "%s: +OK current debug flags: '%s'\n", __FILE__, tmp); + goto done; + } + if (parse_debug(argv[2], &flags) == -1) { stream->write_function(stream, "%s: -ERR invalid debug flags given\n", __FILE__); goto done; commit b278dd2379e455ef1f256b703fdec1c292bf4179 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Nov 10 16:55:56 2010 -0600 add manual_rtp_bugs to profile and chan var and 3 new RTP bugs SEND_LINEAR_TIMESTAMPS|START_SEQ_AT_ZERO|NEVER_SEND_MARKER RTP_BUG_SEND_LINEAR_TIMESTAMPS = (1 << 3), Our friends at Sonus get real mad when the timestamps are not in perfect sequence even during periods of silence. With this flag, we will only increment the timestamp when write packets even if they are eons apart. RTP_BUG_START_SEQ_AT_ZERO = (1 << 4), Our friends at Sonus also get real mad if the sequence number does not start at 0. Typically, we set this to a random starting value for your saftey. This is a security risk you take upon yourself when you enable this flag. RTP_BUG_NEVER_SEND_MARKER = (1 << 5), Our friends at Sonus are on a roll, They also get easily dumbfounded by marker bits. This flag will never send any. Sheesh.... diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 272d435..c016380 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -596,7 +596,7 @@ typedef enum { */ - RTP_BUG_IGNORE_MARK_BIT = (1 << 2) + RTP_BUG_IGNORE_MARK_BIT = (1 << 2), /* A Huawei SBC has been discovered that sends the mark bit on every single RTP packet. @@ -606,6 +606,34 @@ typedef enum { */ + + RTP_BUG_SEND_LINEAR_TIMESTAMPS = (1 << 3), + + /* + Our friends at Sonus get real mad when the timestamps are not in perfect sequence even during periods of silence. + With this flag, we will only increment the timestamp when write packets even if they are eons apart. + + */ + + RTP_BUG_START_SEQ_AT_ZERO = (1 << 4), + + /* + Our friends at Sonus also get real mad if the sequence number does not start at 0. + Typically, we set this to a random starting value for your saftey. + This is a security risk you take upon yourself when you enable this flag. + */ + + + RTP_BUG_NEVER_SEND_MARKER = (1 << 5), + + /* + Our friends at Sonus are on a roll, They also get easily dumbfounded by marker bits. + This flag will never send any. Sheesh.... + */ + + + + } switch_rtp_bug_flag_t; diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 6978e34..750fb60 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -558,6 +558,7 @@ struct sofia_profile { char *user_agent_filter; uint32_t max_registrations_perext; switch_rtp_bug_flag_t auto_rtp_bugs; + switch_rtp_bug_flag_t manual_rtp_bugs; uint32_t ib_calls; uint32_t ob_calls; uint32_t ib_failed_calls; @@ -1035,3 +1036,4 @@ void sofia_glue_proxy_codec(switch_core_session_t *session, const char *r_sdp); switch_status_t sofia_glue_sdp_map(const char *r_sdp, switch_event_t **fmtp, switch_event_t **pt); void sofia_glue_build_vid_refresh_message(switch_core_session_t *session, const char *pl); void sofia_glue_check_dtmf_type(private_object_t *tech_pvt); +void sofia_glue_parse_rtp_bugs(uint32_t *flag_pole, const char *str); diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 7cb4c5b..e567206 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2220,39 +2220,6 @@ static void parse_domain_tag(sofia_profile_t *profile, switch_xml_t x_domain_tag } } -static void parse_rtp_bugs(sofia_profile_t *profile, const char *str) -{ - - if (switch_stristr("clear", str)) { - profile->auto_rtp_bugs = 0; - } - - if (switch_stristr("CISCO_SKIP_MARK_BIT_2833", str)) { - profile->auto_rtp_bugs |= RTP_BUG_CISCO_SKIP_MARK_BIT_2833; - } - - if (switch_stristr("~CISCO_SKIP_MARK_BIT_2833", str)) { - profile->auto_rtp_bugs &= ~RTP_BUG_CISCO_SKIP_MARK_BIT_2833; - } - - if (switch_stristr("SONUS_SEND_INVALID_TIMESTAMP_2833", str)) { - profile->auto_rtp_bugs |= RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833; - } - - if (switch_stristr("~SONUS_SEND_INVALID_TIMESTAMP_2833", str)) { - profile->auto_rtp_bugs &= ~RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833; - } - - if (switch_stristr("IGNORE_MARK_BIT", str)) { - profile->auto_rtp_bugs |= RTP_BUG_IGNORE_MARK_BIT; - } - - if (switch_stristr("~IGNORE_MARK_BIT", str)) { - profile->auto_rtp_bugs &= ~RTP_BUG_IGNORE_MARK_BIT; - } - -} - switch_status_t reconfig_sofia(sofia_profile_t *profile) { switch_xml_t cfg, xml = NULL, xprofile, profiles, gateways_tag, domain_tag, domains_tag, aliases_tag, alias_tag, settings, param; @@ -2382,7 +2349,9 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) sofia_clear_pflag(profile, PFLAG_MESSAGE_QUERY_ON_FIRST_REGISTER); } } else if (!strcasecmp(var, "auto-rtp-bugs")) { - parse_rtp_bugs(profile, val); + sofia_glue_parse_rtp_bugs(&profile->auto_rtp_bugs, val); + } else if (!strcasecmp(var, "manual-rtp-bugs")) { + sofia_glue_parse_rtp_bugs(&profile->manual_rtp_bugs, val); } else if (!strcasecmp(var, "user-agent-string")) { profile->user_agent = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "auto-restart")) { @@ -3103,7 +3072,9 @@ switch_status_t config_sofia(int reload, char *profile_name) profile->rport_level = 2; } } else if (!strcasecmp(var, "auto-rtp-bugs")) { - parse_rtp_bugs(profile, val); + sofia_glue_parse_rtp_bugs(&profile->auto_rtp_bugs, val); + } else if (!strcasecmp(var, "manual-rtp-bugs")) { + sofia_glue_parse_rtp_bugs(&profile->manual_rtp_bugs, val); } else if (!strcasecmp(var, "dbname")) { profile->dbname = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "presence-hosts")) { diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index fbd270d..6e9aacb 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -3106,7 +3106,11 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f tech_pvt->rtp_bugs |= RTP_BUG_IGNORE_MARK_BIT; } - switch_rtp_intentional_bugs(tech_pvt->rtp_session, tech_pvt->rtp_bugs); + if ((val = switch_channel_get_variable(tech_pvt->channel, "rtp_manual_rtp_bugs"))) { + sofia_glue_parse_rtp_bugs(&tech_pvt->rtp_bugs, val); + } + + switch_rtp_intentional_bugs(tech_pvt->rtp_session, tech_pvt->rtp_bugs | tech_pvt->profile->manual_rtp_bugs); if ((vad_in && inb) || (vad_out && !inb)) { switch_rtp_enable_vad(tech_pvt->rtp_session, tech_pvt->session, &tech_pvt->read_codec, SWITCH_VAD_FLAG_TALKING); @@ -5990,6 +5994,62 @@ void sofia_glue_build_vid_refresh_message(switch_core_session_t *session, const } +void sofia_glue_parse_rtp_bugs(uint32_t *flag_pole, const char *str) +{ + + if (switch_stristr("clear", str)) { + *flag_pole = 0; + } + + if (switch_stristr("CISCO_SKIP_MARK_BIT_2833", str)) { + *flag_pole |= RTP_BUG_CISCO_SKIP_MARK_BIT_2833; + } + + if (switch_stristr("~CISCO_SKIP_MARK_BIT_2833", str)) { + *flag_pole &= ~RTP_BUG_CISCO_SKIP_MARK_BIT_2833; + } + + if (switch_stristr("SONUS_SEND_INVALID_TIMESTAMP_2833", str)) { + *flag_pole |= RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833; + } + + if (switch_stristr("~SONUS_SEND_INVALID_TIMESTAMP_2833", str)) { + *flag_pole &= ~RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833; + } + + if (switch_stristr("IGNORE_MARK_BIT", str)) { + *flag_pole |= RTP_BUG_IGNORE_MARK_BIT; + } + + if (switch_stristr("~IGNORE_MARK_BIT", str)) { + *flag_pole &= ~RTP_BUG_IGNORE_MARK_BIT; + } + + if (switch_stristr("SEND_LINEAR_TIMESTAMPS", str)) { + *flag_pole |= RTP_BUG_SEND_LINEAR_TIMESTAMPS; + } + + if (switch_stristr("~SEND_LINEAR_TIMESTAMPS", str)) { + *flag_pole &= ~RTP_BUG_SEND_LINEAR_TIMESTAMPS; + } + + if (switch_stristr("START_SEQ_AT_ZERO", str)) { + *flag_pole |= RTP_BUG_START_SEQ_AT_ZERO; + } + + if (switch_stristr("~START_SEQ_AT_ZERO", str)) { + *flag_pole &= ~RTP_BUG_START_SEQ_AT_ZERO; + } + + if (switch_stristr("NEVER_SEND_MARKER", str)) { + *flag_pole |= RTP_BUG_NEVER_SEND_MARKER; + } + + if (switch_stristr("~NEVER_SEND_MARKER", str)) { + *flag_pole &= ~RTP_BUG_NEVER_SEND_MARKER; + } +} + diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 1792de0..f0eead3 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1366,7 +1366,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_ENABLE_RTCP)) { switch_sockaddr_info_get(&rtp_session->rtcp_from_addr, NULL, SWITCH_UNSPEC, 0, 0, pool); } - rtp_session->seq = (uint16_t) rand(); + rtp_session->seq = (rtp_session->rtp_bugs & RTP_BUG_START_SEQ_AT_ZERO) ? 0 : (uint16_t) rand(); rtp_session->ssrc = (uint32_t) ((intptr_t) rtp_session + (uint32_t) switch_epoch_time_now(NULL)); rtp_session->send_msg.header.ssrc = htonl(rtp_session->ssrc); @@ -3179,10 +3179,15 @@ static int rtp_common_write(switch_rtp_t *rtp_session, send_msg = &rtp_session->send_msg; send_msg->header.pt = payload; - if (timestamp) { + if (rtp_session->rtp_bugs & RTP_BUG_SEND_LINEAR_TIMESTAMPS) { + rtp_session->ts += rtp_session->samples_per_interval; + if (rtp_session->ts <= rtp_session->last_write_ts && rtp_session->ts > 0) { + rtp_session->ts = rtp_session->last_write_ts + rtp_session->samples_per_interval; + } + } else if (timestamp) { rtp_session->ts = (uint32_t) timestamp; /* Send marker bit if timestamp is lower/same as before (resetted/new timer) */ - if (rtp_session->ts <= rtp_session->last_write_ts) { + if (rtp_session->ts <= rtp_session->last_write_ts && !(rtp_session->rtp_bugs & RTP_BUG_NEVER_SEND_MARKER)) { m++; } } else if (rtp_session->timer.timer_interface) { @@ -3216,8 +3221,8 @@ static int rtp_common_write(switch_rtp_t *rtp_session, rtp_session->cn = 0; m++; } - - send_msg->header.m = m ? 1 : 0; + + send_msg->header.m = (m && !(rtp_session->rtp_bugs & RTP_BUG_NEVER_SEND_MARKER)) ? 1 : 0; memcpy(send_msg->body, data, datalen); bytes = datalen + rtp_header_len; @@ -3287,7 +3292,9 @@ static int rtp_common_write(switch_rtp_t *rtp_session, if (diff >= rtp_session->vad_data.diff_level || ++rtp_session->vad_data.hangunder_hits >= rtp_session->vad_data.hangunder) { switch_set_flag(&rtp_session->vad_data, SWITCH_VAD_FLAG_TALKING); - send_msg->header.m = 1; + if (!(rtp_session->rtp_bugs & RTP_BUG_NEVER_SEND_MARKER)) { + send_msg->header.m = 1; + } rtp_session->vad_data.hangover_hits = rtp_session->vad_data.hangunder_hits = rtp_session->vad_data.cng_count = 0; if (switch_test_flag(&rtp_session->vad_data, SWITCH_VAD_FLAG_EVENTS_TALK)) { switch_event_t *event; @@ -3755,7 +3762,7 @@ SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session, rtp_session->write_msg.header.seq = htons(++rtp_session->seq); rtp_session->write_msg.header.ts = htonl(ts); rtp_session->write_msg.header.pt = payload; - rtp_session->write_msg.header.m = m ? 1 : 0; + rtp_session->write_msg.header.m = (m && !(rtp_session->rtp_bugs & RTP_BUG_NEVER_SEND_MARKER)) ? 1 : 0; memcpy(rtp_session->write_msg.body, data, datalen); bytes = rtp_header_len + datalen; commit ca8c23361bd365dd180a35c4d50241c53c08f246 Author: Moises Silva <moy@sangoma.com> Date: Wed Nov 10 17:27:27 2010 -0500 mod_sangoma_codec: add G722 diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index 63073ed..0bc0282 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -78,6 +78,8 @@ typedef struct vocallo_codec_s { int bpfd; /* bytes per frame decompressed */ int bpfc; /* bytes per frame compressed */ + int sampling_rate; /* declared sampling rate */ + int actual_sampling_rate; /* true sampling rate */ int autoinit; /* initialize on start loop or manually */ } vocallo_codec_t; @@ -85,21 +87,22 @@ typedef struct vocallo_codec_s { #define ILBC_152_PAYLOAD 98 vocallo_codec_t g_codec_map[] = { - { SNGTC_CODEC_PCMU, 0, "PCMU", "Sangoma PCMU", 40, 64000, 10000, 80, 160, 80, 1 }, - { SNGTC_CODEC_PCMA, 8, "PCMA", "Sangoma PCMA", 40, 64000, 10000, 80, 160, 80, 1 }, - { SNGTC_CODEC_L16_1, 10, "L16", "Sangoma L16", 40, 120000, 10000, 80, 160, 160, 1 }, - { SNGTC_CODEC_G729AB, 18, "G729", "Sangoma G729", 40, 8000, 10000, 80, 160, 10, 1 }, - { SNGTC_CODEC_G726_32, 122, "G726-32", "Sangoma G.726 32k", 40, 32000, 10000, 80, 160, 40, 1 }, - { SNGTC_CODEC_GSM_FR, 3, "GSM", "Sangoma GSM", 20, 13200, 20000, 160, 320, 33, 0 }, - { SNGTC_CODEC_ILBC_133, ILBC_133_PAYLOAD, "iLBC", "Sangoma iLBC", -1, -1, -1, -1, -1, -1, 0 }, - { SNGTC_CODEC_ILBC_152, ILBC_152_PAYLOAD, "iLBC", "Sangoma iLBC", -1, -1, -1, -1, -1, -1, 0 }, - { SNGTC_CODEC_G723_1_63, 4, "G723", "Sangoma G723", 90, 6300, 30000, 240, 480, 24, 0}, -#if 0 - /* FIXME: sampling rate seems wrong with this, audioooo soooundssssss sloooooow ... */ - { SNGTC_CODEC_G722, 9, "G722", "Sangoma G722", 20, 64000, 20000, 160, 640, 160, 0 }, -#endif - { SNGTC_CODEC_AMR_1220, 96, "AMR", "Sangoma AMR", 20, 12200, 20000, 160, 320, 0, 0}, - { -1, -1, NULL, NULL, -1, -1, -1, -1, -1, -1 }, + /* auto-init codecs */ + { SNGTC_CODEC_PCMU, 0, "PCMU", "Sangoma PCMU", 40, 64000, 10000, 80, 160, 80, 8000, 8000, 1 }, + { SNGTC_CODEC_PCMA, 8, "PCMA", "Sangoma PCMA", 40, 64000, 10000, 80, 160, 80, 8000, 8000, 1 }, + { SNGTC_CODEC_L16_1, 10, "L16", "Sangoma L16", 40, 120000, 10000, 80, 160, 160, 8000, 8000, 0 }, + { SNGTC_CODEC_L16_2, 10, "L16", "Sangoma L16 2", 40, 320000, 10000, 80, 320, 320, 16000, 16000, 0 }, + { SNGTC_CODEC_G729AB, 18, "G729", "Sangoma G729", 40, 8000, 10000, 80, 160, 10, 8000, 8000, 1 }, + { SNGTC_CODEC_G726_32, 122, "G726-32", "Sangoma G.726 32k", 40, 32000, 10000, 80, 160, 40, 8000, 8000, 1 }, + { SNGTC_CODEC_G722, 9, "G722", "Sangoma G722", 20, 64000, 10000, 160, 320, 80, 8000, 16000, 1 }, + + /* manually initialized */ + { SNGTC_CODEC_GSM_FR, 3, "GSM", "Sangoma GSM", 20, 13200, 20000, 160, 320, 33, 8000, 8000, 0 }, + { SNGTC_CODEC_G723_1_63, 4, "G723", "Sangoma G723", 90, 6300, 30000, 240, 480, 24, 8000, 8000, 0 }, + { SNGTC_CODEC_AMR_1220, 96, "AMR", "Sangoma AMR", 20, 12200, 20000, 160, 320, 0, 8000, 8000, 0 }, + { SNGTC_CODEC_ILBC_133, ILBC_133_PAYLOAD, "iLBC", "Sangoma iLBC", -1, -1, -1, -1, -1, -1, -1, -1, 0 }, + { SNGTC_CODEC_ILBC_152, ILBC_152_PAYLOAD, "iLBC", "Sangoma iLBC", -1, -1, -1, -1, -1, -1, -1, -1, 0 }, + { -1, -1, NULL, NULL, -1, -1, -1, -1, -1, -1, -1, -1, 0 }, }; /* RFC3389 RTP Payload for Comfort Noise */ @@ -323,7 +326,8 @@ static switch_status_t switch_sangoma_init(switch_codec_t *codec, switch_codec_f if (encoding) { sess->encoder.request.usr_priv = sess; sess->encoder.request.a.host_ip = g_rtpip; - sess->encoder.request.a.codec_id = SNGTC_CODEC_L16_1; + sess->encoder.request.a.codec_id = vcodec->actual_sampling_rate == 16000 + ? SNGTC_CODEC_L16_2 : SNGTC_CODEC_L16_1; sess->encoder.request.a.ms = codec->implementation->microseconds_per_packet/1000; sess->encoder.request.b.host_ip = g_rtpip; @@ -338,7 +342,8 @@ static switch_status_t switch_sangoma_init(switch_codec_t *codec, switch_codec_f sess->decoder.request.a.ms = codec->implementation->microseconds_per_packet/1000; sess->decoder.request.b.host_ip = g_rtpip; - sess->decoder.request.b.codec_id = SNGTC_CODEC_L16_1; + sess->decoder.request.b.codec_id = vcodec->actual_sampling_rate == 16000 + ? SNGTC_CODEC_L16_2 : SNGTC_CODEC_L16_1; sess->decoder.request.b.ms = codec->implementation->microseconds_per_packet/1000; } @@ -787,7 +792,6 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses } } else { *decoded_data_len = codec->implementation->decoded_bytes_per_packet; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No output from sangoma decoder, returning silent frame of %d bytes\n", *decoded_data_len); memset(dbuf_linear, 0, *decoded_data_len); } @@ -1191,7 +1195,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loading codecs, register='%s', noregister='%s'\n", g_codec_register_list, g_codec_noregister_list); for (c = 0; g_codec_map[c].codec_id != -1; c++) { - if (g_codec_map[c].codec_id == SNGTC_CODEC_L16_1) { + if (g_codec_map[c].codec_id == SNGTC_CODEC_L16_1 || g_codec_map[c].codec_id == SNGTC_CODEC_L16_2) { /* registering L16 does not make any sense */ continue; } @@ -1241,8 +1245,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) g_codec_map[c].iana, /* the IANA code number, ie http://www.iana.org/assignments/rtp-parameters */ g_codec_map[c].iana_name, /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function), fmtp is used in SDP for format specific parameters */ - 8000, /* samples transferred per second */ - 8000, /* actual samples transferred per second */ + g_codec_map[c].sampling_rate, /* samples transferred per second */ + g_codec_map[c].actual_sampling_rate, /* actual samples transferred per second */ g_codec_map[c].bps, /* bits transferred per second */ g_codec_map[c].mpf * i, /* microseconds per frame */ g_codec_map[c].spf * i, /* samples per frame */ @@ -1333,8 +1337,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) g_codec_map[c].iana, /* the IANA code number, ie http://www.iana.org/assignments/rtp-parameters */ g_codec_map[c].iana_name, /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function), fmtp is used in SDP for format specific parameters */ - 8000, /* samples transferred per second */ - 8000, /* actual samples transferred per second */ + g_codec_map[c].sampling_rate, /* samples transferred per second */ + g_codec_map[c].actual_sampling_rate, /* actual samples transferred per second */ g_codec_map[c].bps, /* bits transferred per second */ g_codec_map[c].mpf * i, /* microseconds per frame */ g_codec_map[c].spf * i, /* samples per frame */ @@ -1349,36 +1353,14 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) } break; - - case SNGTC_CODEC_G722: - switch_core_codec_add_implementation(pool, codec_interface, /* the codec interface we allocated and we want to register with the core */ - SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - g_codec_map[c].iana, /* the IANA code number, ie http://www.iana.org/assignments/rtp-parameters */ - g_codec_map[c].iana_name, /* the IANA code name */ - NULL, /* default fmtp to send (can be overridden by the init function), fmtp is used in SDP for format specific parameters */ - 8000, /* samples transferred per second */ - 16000, /* actual samples transferred per second */ - g_codec_map[c].bps, /* bits transferred per second */ - g_codec_map[c].mpf, /* microseconds per frame */ - g_codec_map[c].spf, /* samples per frame */ - g_codec_map[c].bpfd, /* number of bytes per frame decompressed */ - g_codec_map[c].bpfc, /* number of bytes per frame compressed */ - 1, /* number of channels represented */ - g_codec_map[c].spf, /* number of frames per network packet (I dont think this is used at all) */ - switch_sangoma_init, /* function to initialize a codec session using this implementation */ - switch_sangoma_encode, /* function to encode slinear data into encoded data */ - switch_sangoma_decode, /* function to decode encoded data into slinear data */ - switch_sangoma_destroy); /* deinitalize a codec handle using this implementation */ - break; - case SNGTC_CODEC_AMR_1220: switch_core_codec_add_implementation(pool, codec_interface, /* the codec interface we allocated and we want to register with the core */ SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ g_codec_map[c].iana, /* the IANA code number, ie http://www.iana.org/assignments/rtp-parameters */ g_codec_map[c].iana_name, /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function), fmtp is used in SDP for format specific parameters */ - 8000, /* samples transferred per second */ - 8000, /* actual samples transferred per second */ + g_codec_map[c].sampling_rate, /* samples transferred per second */ + g_codec_map[c].actual_sampling_rate, /* actual samples transferred per second */ g_codec_map[c].bps, /* bits transferred per second */ g_codec_map[c].mpf, /* microseconds per frame */ g_codec_map[c].spf, /* samples per frame */ commit 1074f006a06c09719319797aad6dbee4b837d087 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Wed Nov 10 22:42:18 2010 +0100 ftmod_libpri: Clean up misnamed parameters and variables, remove unused. - Add alias names for parameters: "node" -> "mode" "dp" -> "ton" "switch" -> "dialect" "l1" -> "layer1" (Switching between ftmod_libpri and ftmod_isdn is easier now.) - Removed unused members from struct ftdm_libpri_data and rename misnamed ones Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 822002d..fff3f45 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -191,7 +191,7 @@ static const struct ftdm_libpri_debug { * \param in Debug string to parse for * \return Flags or -1 if nothing matched */ -static int parse_debug(const char *in, int *flags) +static int parse_debug(const char *in, uint32_t *flags) { int res = -1; int i; @@ -295,7 +295,7 @@ static FIO_API_FUNCTION(ftdm_libpri_api) if (ftdm_span_find_by_name(argv[1], &span) == FTDM_SUCCESS) { ftdm_libpri_data_t *isdn_data = span->signal_data; - int flags = 0; + uint32_t flags = 0; if (span->start != ftdm_libpri_start) { stream->write_function(stream, "%s: -ERR invalid span.\n", __FILE__); @@ -598,7 +598,7 @@ static __inline__ void state_advance(ftdm_channel_t *chan) ton = PRI_LOCAL_ISDN; break; default: - ton = isdn_data->dp; + ton = isdn_data->ton; } chan->call_data = call; @@ -612,7 +612,7 @@ static __inline__ void state_advance(ftdm_channel_t *chan) assert(sr); pri_sr_set_channel(sr, ftdm_channel_get_id(chan), 0, 0); - pri_sr_set_bearer(sr, PRI_TRANS_CAP_SPEECH, isdn_data->l1); + pri_sr_set_bearer(sr, PRI_TRANS_CAP_SPEECH, isdn_data->layer1); pri_sr_set_called(sr, caller_data->dnis.digits, ton, 1); pri_sr_set_caller(sr, caller_data->cid_num.digits, @@ -1340,18 +1340,18 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) case FTDM_TRUNK_T1: case FTDM_TRUNK_J1: res = lpwrap_init_pri(&isdn_data->spri, span, isdn_data->dchan, - isdn_data->pswitch, isdn_data->node, isdn_data->debug); + isdn_data->dialect, isdn_data->mode, isdn_data->debug_mask); break; case FTDM_TRUNK_BRI: res = lpwrap_init_bri(&isdn_data->spri, span, isdn_data->dchan, - isdn_data->pswitch, isdn_data->node, 1, isdn_data->debug); + isdn_data->dialect, isdn_data->mode, 1, isdn_data->debug_mask); #ifndef HAVE_LIBPRI_BRI goto out; #endif break; case FTDM_TRUNK_BRI_PTMP: res = lpwrap_init_bri(&isdn_data->spri, span, isdn_data->dchan, - isdn_data->pswitch, isdn_data->node, 0, isdn_data->debug); + isdn_data->dialect, isdn_data->mode, 0, isdn_data->debug_mask); #ifndef HAVE_LIBPRI_BRI goto out; #endif @@ -1395,7 +1395,6 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) } isdn_data->spri.on_loop = check_flags; -// isdn_data->spri.private_info = span; lpwrap_run_pri(&isdn_data->spri); } else { @@ -1473,7 +1472,6 @@ static ftdm_status_t ftdm_libpri_stop(ftdm_span_t *span) static ftdm_status_t ftdm_libpri_start(ftdm_span_t *span) { ftdm_libpri_data_t *isdn_data = span->signal_data; - ftdm_status_t ret; if (ftdm_test_flag(isdn_data, FTMOD_LIBPRI_RUNNING)) { return FTDM_FAIL; @@ -1483,13 +1481,8 @@ static ftdm_status_t ftdm_libpri_start(ftdm_span_t *span) ftdm_clear_flag(span, FTDM_SPAN_IN_THREAD); ftdm_set_flag(isdn_data, FTMOD_LIBPRI_RUNNING); - ret = ftdm_thread_create_detached(ftdm_libpri_run, span); - if (ret != FTDM_SUCCESS) { - return ret; - } - - return ret; + return ftdm_thread_create_detached(ftdm_libpri_run, span); } /** @@ -1497,12 +1490,13 @@ static ftdm_status_t ftdm_libpri_start(ftdm_span_t *span) * \param node Node string to convert * \return -1 on failure, node value on success */ -static int parse_node(const char *node) +static int parse_mode(const char *mode) { - if (!strcasecmp(node, "cpe") || !strcasecmp(node, "user")) + if (!strcasecmp(mode, "cpe") || !strcasecmp(mode, "user")) return PRI_CPE; - if (!strcasecmp(node, "network") || !strcasecmp(node, "net")) + if (!strcasecmp(mode, "network") || !strcasecmp(mode, "net")) return PRI_NETWORK; + return -1; } @@ -1511,23 +1505,23 @@ static int parse_node(const char *node) * \param swtype Swtype string to convert * \return Switch value */ -static int parse_switch(const char *swtype) +static int parse_dialect(const char *dialect) { - if (!strcasecmp(swtype, "ni1")) + if (!strcasecmp(dialect, "ni1")) return PRI_SWITCH_NI1; - if (!strcasecmp(swtype, "ni2")) + if (!strcasecmp(dialect, "ni2")) return PRI_SWITCH_NI2; - if (!strcasecmp(swtype, "dms100")) + if (!strcasecmp(dialect, "dms100")) return PRI_SWITCH_DMS100; - if (!strcasecmp(swtype, "lucent5e") || !strcasecmp(swtype, "5ess")) + if (!strcasecmp(dialect, "lucent5e") || !strcasecmp(dialect, "5ess")) return PRI_SWITCH_LUCENT5E; - if (!strcasecmp(swtype, "att4ess") || !strcasecmp(swtype, "4ess")) + if (!strcasecmp(dialect, "att4ess") || !strcasecmp(dialect, "4ess")) return PRI_SWITCH_ATT4ESS; - if (!strcasecmp(swtype, "euroisdn")) + if (!strcasecmp(dialect, "euroisdn") || !strcasecmp(dialect, "q931")) return PRI_SWITCH_EUROISDN_E1; - if (!strcasecmp(swtype, "gr303eoc")) + if (!strcasecmp(dialect, "gr303eoc")) return PRI_SWITCH_GR303_EOC; - if (!strcasecmp(swtype, "gr303tmc")) + if (!strcasecmp(dialect, "gr303tmc")) return PRI_SWITCH_GR303_TMC; return PRI_SWITCH_DMS100; @@ -1538,9 +1532,9 @@ static int parse_switch(const char *swtype) * \param l1 L1 string to convert * \return L1 value */ -static int parse_l1(const char *l1) +static int parse_layer1(const char *val) { - if (!strcasecmp(l1, "alaw")) + if (!strcasecmp(val, "alaw")) return PRI_LAYER_1_ALAW; return PRI_LAYER_1_ULAW; @@ -1551,17 +1545,17 @@ static int parse_l1(const char *l1) * \param dp DP string to convert * \return DP value */ -static int parse_numplan(const char *dp) +static int parse_ton(const char *ton) { - if (!strcasecmp(dp, "international")) + if (!strcasecmp(ton, "international")) return PRI_INTERNATIONAL_ISDN; - if (!strcasecmp(dp, "national")) + if (!strcasecmp(ton, "national")) return PRI_NATIONAL_ISDN; - if (!strcasecmp(dp, "local")) + if (!strcasecmp(ton, "local")) return PRI_LOCAL_ISDN; - if (!strcasecmp(dp, "private")) + if (!strcasecmp(ton, "private")) return PRI_PRIVATE; - if (!strcasecmp(dp, "unknown")) + if (!strcasecmp(ton, "unknown")) return PRI_UNKNOWN; return PRI_UNKNOWN; @@ -1673,12 +1667,12 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) #endif case FTDM_TRUNK_E1: ftdm_log(FTDM_LOG_NOTICE, "Setting default Layer 1 to ALAW since this is an E1/BRI/BRI PTMP trunk\n"); - isdn_data->l1 = PRI_LAYER_1_ALAW; + isdn_data->layer1 = PRI_LAYER_1_ALAW; break; case FTDM_TRUNK_T1: case FTDM_TRUNK_J1: ftdm_log(FTDM_LOG_NOTICE, "Setting default Layer 1 to ULAW since this is a T1/J1 trunk\n"); - isdn_data->l1 = PRI_LAYER_1_ULAW; + isdn_data->layer1 = PRI_LAYER_1_ULAW; break; default: ftdm_log(FTDM_LOG_ERROR, "Invalid trunk type: '%s'\n", ftdm_span_get_trunk_type_str(span)); @@ -1696,28 +1690,28 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) return FTDM_FAIL; } - if (!strcasecmp(var, "node")) { - if ((isdn_data->node = parse_node(val)) == -1) { + if (!strcasecmp(var, "node") || !strcasecmp(var, "mode")) { + if ((isdn_data->mode = parse_mode(val)) == -1) { ftdm_log(FTDM_LOG_ERROR, "Unknown node type '%s', defaulting to CPE mode\n", val); - isdn_data->node = PRI_CPE; + isdn_data->mode = PRI_CPE; } } - else if (!strcasecmp(var, "switch")) { - isdn_data->pswitch = parse_switch(val); + else if (!strcasecmp(var, "switch") || !strcasecmp(var, "dialect")) { + isdn_data->dialect = parse_dialect(val); } else if (!strcasecmp(var, "opts")) { isdn_data->opts = parse_opts(val); } - else if (!strcasecmp(var, "dp")) { - isdn_data->dp = parse_numplan(val); + else if (!strcasecmp(var, "dp") || !strcasecmp(var, "ton")) { + isdn_data->ton = parse_ton(val); } - else if (!strcasecmp(var, "l1")) { - isdn_data->l1 = parse_l1(val); + else if (!strcasecmp(var, "l1") || !strcasecmp(var, "layer1")) { + isdn_data->layer1 = parse_layer1(val); } else if (!strcasecmp(var, "debug")) { - if (parse_debug(val, &isdn_data->debug) == -1) { + if (parse_debug(val, &isdn_data->debug_mask) == -1) { ftdm_log(FTDM_LOG_ERROR, "Invalid debug flag, ignoring parameter\n"); - isdn_data->debug = 0; + isdn_data->debug_mask = 0; } } else { @@ -1730,9 +1724,6 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) span->start = ftdm_libpri_start; span->stop = ftdm_libpri_stop; span->signal_cb = sig_cb; - //isdn_data->dchans[0] = dchans[0]; - //isdn_data->dchans[1] = dchans[1]; - //isdn_data->dchan = isdn_data->dchans[0]; span->signal_data = isdn_data; span->signal_type = FTDM_SIGTYPE_ISDN; diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h index b11baec..3f47cd2 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h @@ -54,35 +54,20 @@ typedef enum { struct ftdm_libpri_data { ftdm_channel_t *dchan; - ftdm_channel_t *dchans[2]; - struct ftdm_sigmsg sigmsg; - uint32_t flags; - int32_t mode; ftdm_isdn_opts_t opts; + uint32_t flags; + uint32_t debug_mask; - int node; - int pswitch; - char *dialplan; - unsigned int l1; - unsigned int dp; - - int debug; + int mode; + int dialect; + unsigned int layer1; + unsigned int ton; lpwrap_pri_t spri; }; typedef struct ftdm_libpri_data ftdm_libpri_data_t; - -/* b-channel private data */ -struct ftdm_isdn_bchan_data -{ - int32_t digit_timeout; -}; - -typedef struct ftdm_isdn_bchan_data ftdm_isdn_bchan_data_t; - - #endif /* For Emacs: commit 3df1476a6d8d66b21f1802628bcb747f476c879a Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Wed Nov 10 21:17:02 2010 +0100 ftmod_libpri: Major cleanup, enhance configuration checks - Check D and B-channel availability (could be extended to check B-channel count) - Drop usage of spri->private_info, use spri->span instead - Use accessor functions where possible - Rename ftdmchan to chan where possible - Various other cleanups Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> Tested-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 2abe761..822002d 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2007, Anthony Minessale II + * Copyright (c) 2010, Stefan Knoblich <s.knoblich@axsentis.de> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -33,10 +34,30 @@ #include "private/ftdm_core.h" #include "ftmod_libpri.h" +/*** + * Move to core + ***/ #ifndef ARRAY_SIZE #define ARRAY_SIZE(x) (sizeof((x)) / sizeof((x)[0])) #endif +static ftdm_channel_state_t ftdm_channel_get_state(const ftdm_channel_t *chan) +{ + assert(chan); + return chan->state; +} + +static void _ftdm_channel_set_state_force(ftdm_channel_t *chan, const ftdm_channel_state_t state) +{ + assert(chan); + chan->state = state; +} + +static const char *ftdm_span_get_trunk_type_str(const ftdm_span_t *span) +{ + return ftdm_trunk_type2str(span->trunk_type); +} + /** * \brief Unloads libpri IO module * \return Success @@ -258,7 +279,7 @@ static FIO_API_FUNCTION(ftdm_libpri_api) goto done; } - ftdm_clear_flag((&isdn_data->spri), LPWRAP_PRI_READY); + ftdm_clear_flag(&(isdn_data->spri), LPWRAP_PRI_READY); stream->write_function(stream, "%s: +OK killed.\n", __FILE__); goto done; } else { @@ -452,140 +473,155 @@ static ftdm_state_map_t isdn_state_map = { * \brief Handler for channel state change * \param ftdmchan Channel to handle */ -static __inline__ void state_advance(ftdm_channel_t *ftdmchan) +static __inline__ void state_advance(ftdm_channel_t *chan) { - //Q931mes_Generic *gen = (Q931mes_Generic *) ftdmchan->caller_data.raw_data; - ftdm_libpri_data_t *isdn_data = ftdmchan->span->signal_data; + ftdm_libpri_data_t *isdn_data = chan->span->signal_data; + q931_call *call = (q931_call *)chan->call_data; ftdm_status_t status; ftdm_sigmsg_t sig; - q931_call *call = (q931_call *) ftdmchan->call_data; ftdm_log(FTDM_LOG_DEBUG, "%d:%d STATE [%s]\n", - ftdmchan->span_id, ftdmchan->chan_id, ftdm_channel_state2str(ftdmchan->state)); + ftdm_channel_get_span_id(chan), ftdm_channel_get_id(chan), ftdm_channel_get_state_str(chan)); #if 0 - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) && !call) { + if (!ftdm_test_flag(chan, FTDM_CHANNEL_OUTBOUND) && !call) { ftdm_log(FTDM_LOG_WARNING, "NO CALL!!!!\n"); } #endif - memset(&sig, 0, sizeof(sig)); - sig.chan_id = ftdmchan->chan_id; - sig.span_id = ftdmchan->span_id; - sig.channel = ftdmchan; - + sig.chan_id = ftdm_channel_get_id(chan); + sig.span_id = ftdm_channel_get_span_id(chan); + sig.channel = chan; - switch (ftdmchan->state) { + switch (ftdm_channel_get_state(chan)) { case FTDM_CHANNEL_STATE_DOWN: { - ftdmchan->call_data = NULL; - ftdm_channel_done(ftdmchan); + chan->call_data = NULL; + ftdm_channel_done(chan); } break; + case FTDM_CHANNEL_STATE_PROGRESS: { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + if (ftdm_test_flag(chan, FTDM_CHANNEL_OUTBOUND)) { sig.event_id = FTDM_SIGEVENT_PROGRESS; - if ((status = ftdm_span_send_signal(ftdmchan->span, &sig) != FTDM_SUCCESS)) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); + if ((status = ftdm_span_send_signal(ftdm_channel_get_span(chan), &sig) != FTDM_SUCCESS)) { + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP); } } else if (call) { - pri_progress(isdn_data->spri.pri, call, ftdmchan->chan_id, 1); + pri_progress(isdn_data->spri.pri, call, ftdm_channel_get_id(chan), 1); } else { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART); } } break; + case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + if (ftdm_test_flag(chan, FTDM_CHANNEL_OUTBOUND)) { sig.event_id = FTDM_SIGEVENT_PROGRESS_MEDIA; - if ((status = ftdm_span_send_signal(ftdmchan->span, &sig) != FTDM_SUCCESS)) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); + if ((status = ftdm_span_send_signal(ftdm_channel_get_span(chan), &sig) != FTDM_SUCCESS)) { + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP); } } else if (call) { - pri_proceeding(isdn_data->spri.pri, call, ftdmchan->chan_id, 1); + pri_proceeding(isdn_data->spri.pri, call, ftdm_channel_get_id(chan), 1); } else { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART); } } break; + case FTDM_CHANNEL_STATE_RING: { - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + if (!ftdm_test_flag(chan, FTDM_CHANNEL_OUTBOUND)) { if (call) { - pri_acknowledge(isdn_data->spri.pri, call, ftdmchan->chan_id, 0); + pri_acknowledge(isdn_data->spri.pri, call, ftdm_channel_get_id(chan), 0); sig.event_id = FTDM_SIGEVENT_START; - if ((status = ftdm_span_send_signal(ftdmchan->span, &sig) != FTDM_SUCCESS)) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); + if ((status = ftdm_span_send_signal(ftdm_channel_get_span(chan), &sig) != FTDM_SUCCESS)) { + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP); } } else { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART); } } } break; + case FTDM_CHANNEL_STATE_RESTART: { - ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_UNSPECIFIED; + chan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_UNSPECIFIED; sig.event_id = FTDM_SIGEVENT_RESTART; - status = ftdm_span_send_signal(ftdmchan->span, &sig); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + status = ftdm_span_send_signal(ftdm_channel_get_span(chan), &sig); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_DOWN); } break; + case FTDM_CHANNEL_STATE_UP: { - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + if (ftdm_test_flag(chan, FTDM_CHANNEL_OUTBOUND)) { sig.event_id = FTDM_SIGEVENT_UP; - if ((status = ftdm_span_send_signal(ftdmchan->span, &sig) != FTDM_SUCCESS)) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); + if ((status = ftdm_span_send_signal(ftdm_channel_get_span(chan), &sig) != FTDM_SUCCESS)) { + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP); } } else if (call) { pri_answer(isdn_data->spri.pri, call, 0, 1); } else { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART); } } break; + case FTDM_CHANNEL_STATE_DIALING: if (isdn_data) { + ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); struct pri_sr *sr; - int dp; + int ton; if (!(call = pri_new_call(isdn_data->spri.pri))) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + ftdm_log(FTDM_LOG_ERROR, "Failed to create new call on channel %d:%d\n", + ftdm_channel_get_span_id(chan), ftdm_channel_get_id(chan)); + /* TODO: set hangup cause? */ + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART); return; } - dp = ftdmchan->caller_data.dnis.type; - switch(dp) { + ton = caller_data->dnis.type; + switch (ton) { case FTDM_TON_NATIONAL: - dp = PRI_NATIONAL_ISDN; + ton = PRI_NATIONAL_ISDN; break; case FTDM_TON_INTERNATIONAL: - dp = PRI_INTERNATIONAL_ISDN; + ton = PRI_INTERNATIONAL_ISDN; break; case FTDM_TON_SUBSCRIBER_NUMBER: - dp = PRI_LOCAL_ISDN; + ton = PRI_LOCAL_ISDN; break; default: - dp = isdn_data->dp; + ton = isdn_data->dp; } - ftdmchan->call_data = call; + chan->call_data = call; + sr = pri_sr_new(); + if (!sr) { + ftdm_log(FTDM_LOG_ERROR, "Failed to create new setup request on channel %d:%d\n", + ftdm_channel_get_span_id(chan), ftdm_channel_get_id(chan)); + /* TODO: handle error properly */ + } assert(sr); - pri_sr_set_channel(sr, ftdmchan->chan_id, 0, 0); + + pri_sr_set_channel(sr, ftdm_channel_get_id(chan), 0, 0); pri_sr_set_bearer(sr, PRI_TRANS_CAP_SPEECH, isdn_data->l1); - pri_sr_set_called(sr, ftdmchan->caller_data.dnis.digits, dp, 1); - pri_sr_set_caller(sr, ftdmchan->caller_data.cid_num.digits, - (isdn_data->opts & FTMOD_LIBPRI_OPT_OMIT_DISPLAY_IE ? NULL : ftdmchan->caller_data.cid_name), - dp, - (ftdmchan->caller_data.pres != 1 ? PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN : PRES_PROHIB_USER_NUMBER_NOT_SCREENED)); + + pri_sr_set_called(sr, caller_data->dnis.digits, ton, 1); + pri_sr_set_caller(sr, caller_data->cid_num.digits, + ((isdn_data->opts & FTMOD_LIBPRI_OPT_OMIT_DISPLAY_IE) ? NULL : caller_data->cid_name), + ton, + ((caller_data->pres != 1) ? PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN : PRES_PROHIB_USER_NUMBER_NOT_SCREENED)); if (!(isdn_data->opts & FTMOD_LIBPRI_OPT_OMIT_REDIRECTING_NUMBER_IE)) { - pri_sr_set_redirecting(sr, ftdmchan->caller_data.cid_num.digits, dp, + pri_sr_set_redirecting(sr, caller_data->cid_num.digits, ton, PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN, PRI_REDIR_UNCONDITIONAL); } #ifdef HAVE_LIBPRI_AOC @@ -596,39 +632,40 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) } #endif if (pri_setup(isdn_data->spri.pri, call, sr)) { - ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_DESTINATION_OUT_OF_ORDER; - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); + caller_data->hangup_cause = FTDM_CAUSE_DESTINATION_OUT_OF_ORDER; + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP); } pri_sr_free(sr); } - break; + case FTDM_CHANNEL_STATE_HANGUP: { if (call) { - pri_hangup(isdn_data->spri.pri, call, ftdmchan->caller_data.hangup_cause); + ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); + + pri_hangup(isdn_data->spri.pri, call, caller_data->hangup_cause); pri_destroycall(isdn_data->spri.pri, call); - ftdmchan->call_data = NULL; + + chan->call_data = NULL; } - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_DOWN); } break; + case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: break; + case FTDM_CHANNEL_STATE_TERMINATING: { sig.event_id = FTDM_SIGEVENT_STOP; - status = ftdm_span_send_signal(ftdmchan->span, &sig); + status = ftdm_span_send_signal(ftdm_channel_get_span(chan), &sig); /* user moves us to HANGUP and from there we go to DOWN */ } default: break; } - - - - return; } /** @@ -642,15 +679,17 @@ static __inline__ void check_state(ftdm_span_t *span) ftdm_clear_flag_locked(span, FTDM_SPAN_STATE_CHANGE); - for (j = 1; j <= span->chan_count; j++) { - if (ftdm_test_flag((span->channels[j]), FTDM_CHANNEL_STATE_CHANGE)) { - ftdm_channel_lock(span->channels[j]); + for (j = 1; j <= ftdm_span_get_chan_count(span); j++) { + ftdm_channel_t *chan = ftdm_span_get_channel(span, j); - ftdm_clear_flag((span->channels[j]), FTDM_CHANNEL_STATE_CHANGE); - state_advance(span->channels[j]); - ftdm_channel_complete_state(span->channels[j]); + if (ftdm_test_flag(chan, FTDM_CHANNEL_STATE_CHANGE)) { + ftdm_channel_lock(chan); - ftdm_channel_unlock(span->channels[j]); + ftdm_clear_flag(chan, FTDM_CHANNEL_STATE_CHANGE); + state_advance(chan); + ftdm_channel_complete_state(chan); + + ftdm_channel_unlock(chan); } } } @@ -666,6 +705,7 @@ static __inline__ void check_state(ftdm_span_t *span) static int on_info(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) { ftdm_log(FTDM_LOG_DEBUG, "number is: %s\n", pevent->ring.callednum); + if (strlen(pevent->ring.callednum) > 3) { ftdm_log(FTDM_LOG_DEBUG, "final number is: %s\n", pevent->ring.callednum); pri_answer(spri->pri, pevent->ring.call, 0, 1); @@ -682,40 +722,40 @@ static int on_info(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event */ static int on_hangup(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) { - ftdm_span_t *span = spri->private_info; - ftdm_channel_t *ftdmchan = NULL; + ftdm_span_t *span = spri->span; + ftdm_channel_t *chan = ftdm_span_get_channel(span, pevent->hangup.channel); q931_call *call = NULL; - ftdmchan = span->channels[pevent->hangup.channel]; - if (!ftdmchan) { - ftdm_log(FTDM_LOG_CRIT, "-- Hangup on channel %d:%d %s but it's not in use?\n", spri->span->span_id, pevent->hangup.channel); + if (!chan) { + ftdm_log(FTDM_LOG_CRIT, "-- Hangup on channel %d:%d %s but it's not in use?\n", ftdm_span_get_id(spri->span), pevent->hangup.channel); return 0; } - ftdm_channel_lock(ftdmchan); + ftdm_channel_lock(chan); - if (ftdmchan->state >= FTDM_CHANNEL_STATE_TERMINATING) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Ignoring remote hangup in state %s\n", ftdm_channel_state2str(ftdmchan->state)); + if (ftdm_channel_get_state(chan) >= FTDM_CHANNEL_STATE_TERMINATING) { + ftdm_log_chan(chan, FTDM_LOG_DEBUG, "Ignoring remote hangup in state %s\n", ftdm_channel_get_state_str(chan)); goto done; } - if (!ftdmchan->call_data) { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Ignoring remote hangup in state %s with no call data\n", ftdm_channel_state2str(ftdmchan->state)); + if (!chan->call_data) { + ftdm_log_chan(chan, FTDM_LOG_DEBUG, "Ignoring remote hangup in state %s with no call data\n", ftdm_channel_get_state_str(chan)); goto done; } - call = (q931_call *) ftdmchan->call_data; - ftdm_log(FTDM_LOG_DEBUG, "-- Hangup on channel %d:%d\n", spri->span->span_id, pevent->hangup.channel); - ftdmchan->caller_data.hangup_cause = pevent->hangup.cause; + call = (q931_call *)chan->call_data; + + ftdm_log(FTDM_LOG_DEBUG, "-- Hangup on channel %d:%d\n", ftdm_span_get_id(spri->span), pevent->hangup.channel); + pri_release(spri->pri, call, 0); pri_destroycall(spri->pri, call); - ftdmchan->call_data = NULL; - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); -done: - - ftdm_channel_unlock(ftdmchan); + chan->caller_data.hangup_cause = pevent->hangup.cause; + chan->call_data = NULL; + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_TERMINATING); +done: + ftdm_channel_unlock(chan); return 0; } @@ -728,18 +768,16 @@ done: */ static int on_answer(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) { - ftdm_span_t *span = spri->private_info; - ftdm_channel_t *ftdmchan = NULL; - - ftdmchan = span->channels[pevent->answer.channel]; + ftdm_span_t *span = spri->span; + ftdm_channel_t *chan = ftdm_span_get_channel(span, pevent->answer.channel); - if (ftdmchan) { - ftdm_log(FTDM_LOG_DEBUG, "-- Answer on channel %d:%d\n", spri->span->span_id, pevent->answer.channel); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); + if (chan) { + ftdm_log(FTDM_LOG_DEBUG, "-- Answer on channel %d:%d\n", ftdm_span_get_id(span), pevent->answer.channel); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_UP); } else { - ftdm_log(FTDM_LOG_DEBUG, "-- Answer on channel %d:%d %s but it's not in use?\n", spri->span->span_id, pevent->answer.channel, ftdmchan->chan_id); + ftdm_log(FTDM_LOG_DEBUG, "-- Answer on channel %d:%d but it's not in the span?\n", + ftdm_span_get_id(span), pevent->answer.channel); } - return 0; } @@ -752,19 +790,16 @@ static int on_answer(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_even */ static int on_proceed(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) { - ftdm_span_t *span = spri->private_info; - ftdm_channel_t *ftdmchan = NULL; - - ftdmchan = span->channels[pevent->proceeding.channel]; + ftdm_span_t *span = spri->span; + ftdm_channel_t *chan = ftdm_span_get_channel(span, pevent->answer.channel); - if (ftdmchan) { - ftdm_log(FTDM_LOG_DEBUG, "-- Proceeding on channel %d:%d\n", spri->span->span_id, pevent->proceeding.channel); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); + if (chan) { + ftdm_log(FTDM_LOG_DEBUG, "-- Proceeding on channel %d:%d\n", ftdm_span_get_id(span), pevent->proceeding.channel); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); } else { - ftdm_log(FTDM_LOG_DEBUG, "-- Proceeding on channel %d:%d %s but it's not in use?\n", spri->span->span_id, - pevent->proceeding.channel, ftdmchan->chan_id); + ftdm_log(FTDM_LOG_DEBUG, "-- Proceeding on channel %d:%d but it's not in the span?\n", + ftdm_span_get_id(span), pevent->proceeding.channel); } - return 0; } @@ -777,22 +812,20 @@ static int on_proceed(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_eve */ static int on_ringing(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) { - ftdm_span_t *span = spri->private_info; - ftdm_channel_t *ftdmchan = NULL; - - ftdmchan = span->channels[pevent->ringing.channel]; + ftdm_span_t *span = spri->span; + ftdm_channel_t *chan = ftdm_span_get_channel(span, pevent->ringing.channel); - if (ftdmchan) { - ftdm_log(FTDM_LOG_DEBUG, "-- Ringing on channel %d:%d\n", spri->span->span_id, pevent->ringing.channel); + if (chan) { + ftdm_log(FTDM_LOG_DEBUG, "-- Ringing on channel %d:%d\n", ftdm_span_get_id(span), pevent->ringing.channel); /* we may get on_ringing even when we're already in FTDM_CHANNEL_STATE_PROGRESS_MEDIA */ - if (ftdmchan->state == FTDM_CHANNEL_STATE_PROGRESS_MEDIA) { + if (ftdm_channel_get_state(chan) == FTDM_CHANNEL_STATE_PROGRESS_MEDIA) { /* dont try to move to STATE_PROGRESS to avoid annoying veto warning */ return 0; } - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_PROGRESS); } else { - ftdm_log(FTDM_LOG_DEBUG, "-- Ringing on channel %d:%d %s but it's not in use?\n", spri->span->span_id, - pevent->ringing.channel, ftdmchan->chan_id); + ftdm_log(FTDM_LOG_DEBUG, "-- Ringing on channel %d:%d but it's not in the span?\n", + ftdm_span_get_id(span), pevent->ringing.channel); } return 0; @@ -807,50 +840,49 @@ static int on_ringing(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_eve */ static int on_ring(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) { - ftdm_span_t *span = spri->private_info; - ftdm_channel_t *ftdmchan = NULL; + ftdm_span_t *span = spri->span; + ftdm_channel_t *chan = ftdm_span_get_channel(span, pevent->ring.channel); + ftdm_caller_data_t *caller_data = NULL; int ret = 0; - //switch_mutex_lock(globals.channel_mutex); - - ftdmchan = span->channels[pevent->ring.channel]; - if (!ftdmchan || ftdmchan->state != FTDM_CHANNEL_STATE_DOWN || ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)) { - ftdm_log(FTDM_LOG_WARNING, "--Duplicate Ring on channel %d:%d (ignored)\n", spri->span->span_id, pevent->ring.channel); - ret = 0; + if (!chan || ftdm_channel_get_state(chan) != FTDM_CHANNEL_STATE_DOWN || ftdm_test_flag(chan, FTDM_CHANNEL_INUSE)) { + ftdm_log(FTDM_LOG_WARNING, "--Duplicate Ring on channel %d:%d (ignored)\n", ftdm_span_get_id(span), pevent->ring.channel); goto done; } - if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_WARNING, "--Failure opening channel %d:%d (ignored)\n", spri->span->span_id, pevent->ring.channel); - ret = 0; + if (ftdm_channel_open_chan(chan) != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_WARNING, "--Failure opening channel %d:%d (ignored)\n", ftdm_span_get_id(span), pevent->ring.channel); goto done; } - ftdm_log(FTDM_LOG_NOTICE, "-- Ring on channel %d:%d (from %s to %s)\n", spri->span->span_id, pevent->ring.channel, + ftdm_log(FTDM_LOG_NOTICE, "-- Ring on channel %d:%d (from %s to %s)\n", ftdm_span_get_id(span), pevent->ring.channel, pevent->ring.callingnum, pevent->ring.callednum); - memset(&ftdmchan->caller_data, 0, sizeof(ftdmchan->caller_data)); + caller_data = ftdm_channel_get_caller_data(chan); + + memset(caller_data, 0, sizeof(*caller_data)); + + ftdm_set_string(caller_data->cid_num.digits, (char *)pevent->ring.callingnum); + ftdm_set_string(caller_data->ani.digits, (char *)pevent->ring.callingani); + ftdm_set_string(caller_data->dnis.digits, (char *)pevent->ring.callednum); - ftdm_set_string(ftdmchan->caller_data.cid_num.digits, (char *)pevent->ring.callingnum); if (!ftdm_strlen_zero((char *)pevent->ring.callingname)) { - ftdm_set_string(ftdmchan->caller_data.cid_name, (char *)pevent->ring.callingname); + ftdm_set_string(caller_data->cid_name, (char *)pevent->ring.callingname); } else { - ftdm_set_string(ftdmchan->caller_data.cid_name, (char *)pevent->ring.callingnum); + ftdm_set_string(caller_data->cid_name, (char *)pevent->ring.callingnum); } - ftdm_set_string(ftdmchan->caller_data.ani.digits, (char *)pevent->ring.callingani); - ftdm_set_string(ftdmchan->caller_data.dnis.digits, (char *)pevent->ring.callednum); if (pevent->ring.ani2 >= 0) { - snprintf(ftdmchan->caller_data.aniII, 5, "%.2d", pevent->ring.ani2); + snprintf(caller_data->aniII, 5, "%.2d", pevent->ring.ani2); } // scary to trust this pointer, you'd think they would give you a copy of the call data so you own it...... - ftdmchan->call_data = pevent->ring.call; + /* hurr, this valid as along as nobody releases the call */ + chan->call_data = pevent->ring.call; - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RING); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RING); done: - //switch_mutex_unlock(globals.channel_mutex); return ret; } @@ -867,15 +899,15 @@ static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *e ftdm_log(FTDM_LOG_DEBUG, "EVENT [%s][%d][%d:%d] STATE [%s]\n", ftdm_oob_event2str(event->enum_id), event->enum_id, - event->channel->span_id, - event->channel->chan_id, - ftdm_channel_state2str(event->channel->state)); + ftdm_channel_get_span_id(event->channel), + ftdm_channel_get_id(event->channel), + ftdm_channel_get_state_str(event->channel)); - switch(event->enum_id) { + switch (event->enum_id) { case FTDM_OOB_ALARM_TRAP: { - if (event->channel->state != FTDM_CHANNEL_STATE_DOWN) { - if (event->channel->type == FTDM_CHAN_TYPE_B) { + if (ftdm_channel_get_state(event->channel) != FTDM_CHANNEL_STATE_DOWN) { + if (ftdm_channel_get_type(event->channel) == FTDM_CHAN_TYPE_B) { ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_RESTART); } } @@ -883,23 +915,23 @@ static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *e ftdm_set_flag(event->channel, FTDM_CHANNEL_SUSPENDED); ftdm_channel_get_alarms(event->channel, &alarmbits); - ftdm_log(FTDM_LOG_WARNING, "channel %d:%d (%d:%d) has alarms! [%s]\n", - event->channel->span_id, event->channel->chan_id, - event->channel->physical_span_id, event->channel->physical_chan_id, - event->channel->last_error); + ftdm_log(FTDM_LOG_WARNING, "channel %d:%d (%d:%d) has alarms! [%s]\n", + ftdm_channel_get_span_id(event->channel), ftdm_channel_get_id(event->channel), + ftdm_channel_get_ph_span_id(event->channel), ftdm_channel_get_ph_id(event->channel), + ftdm_channel_get_last_error(event->channel)); } break; case FTDM_OOB_ALARM_CLEAR: { - ftdm_log(FTDM_LOG_WARNING, "channel %d:%d (%d:%d) alarms Cleared!\n", event->channel->span_id, event->channel->chan_id, - event->channel->physical_span_id, event->channel->physical_chan_id); + ftdm_log(FTDM_LOG_WARNING, "channel %d:%d (%d:%d) alarms Cleared!\n", + ftdm_channel_get_span_id(event->channel), ftdm_channel_get_id(event->channel), + ftdm_channel_get_ph_span_id(event->channel), ftdm_channel_get_ph_id(event->channel)); ftdm_clear_flag(event->channel, FTDM_CHANNEL_SUSPENDED); ftdm_channel_get_alarms(event->channel, &alarmbits); } break; } - return FTDM_SUCCESS; } @@ -913,7 +945,7 @@ static __inline__ void check_events(ftdm_span_t *span) status = ftdm_span_poll_event(span, 5, NULL); - switch(status) { + switch (status) { case FTDM_SUCCESS: { ftdm_event_t *event; @@ -946,7 +978,7 @@ static __inline__ void check_events(ftdm_span_t *span) */ static int check_flags(lpwrap_pri_t *spri) { - ftdm_span_t *span = spri->private_info; + ftdm_span_t *span = spri->span; if (!ftdm_running() || ftdm_test_flag(span, FTDM_SPAN_STOP_THREAD)) { return -1; @@ -966,24 +998,21 @@ static int check_flags(lpwrap_pri_t *spri) */ static int on_restart(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) { - ftdm_span_t *span = spri->private_info; - ftdm_channel_t *ftdmchan; - - ftdm_log(FTDM_LOG_NOTICE, "-- Restarting %d:%d\n", spri->span->span_id, pevent->restart.channel); + ftdm_span_t *span = spri->span; + ftdm_channel_t *chan = ftdm_span_get_channel(span, pevent->restart.channel); - spri->dchan->state = FTDM_CHANNEL_STATE_UP; - ftdmchan = span->channels[pevent->restart.channel]; + ftdm_log(FTDM_LOG_NOTICE, "-- Restarting %d:%d\n", ftdm_span_get_id(span), pevent->restart.channel); + _ftdm_channel_set_state_force(spri->dchan, FTDM_CHANNEL_STATE_UP); - if (!ftdmchan) { + if (!chan) { return 0; } if (pevent->restart.channel < 1) { - ftdm_set_state_all(ftdmchan->span, FTDM_CHANNEL_STATE_RESTART); + ftdm_set_state_all(span, FTDM_CHANNEL_STATE_RESTART); } else { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RESTART); } - return 0; } @@ -1156,7 +1185,7 @@ static int on_facility(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ev ftdm_log(FTDM_LOG_DEBUG, "FACILITY subcommand %d handler returned %d\n", sub->cmd, res); } - ftdm_log(FTDM_LOG_DEBUG, "Caught Event on span %d %u (%s)\n", spri->span->span_id, event_type, lpwrap_pri_event_str(event_type)); + ftdm_log(FTDM_LOG_DEBUG, "Caught Event on span %d %u (%s)\n", ftdm_span_get_id(spri->span), event_type, lpwrap_pri_event_str(event_type)); return 0; } #endif @@ -1172,27 +1201,27 @@ static int on_dchan_up(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ev { if (!ftdm_test_flag(spri, LPWRAP_PRI_READY)) { ftdm_signaling_status_t status = FTDM_SIG_STATE_UP; - ftdm_channel_t *ftdmchan = NULL; + ftdm_span_t *span = spri->span; ftdm_sigmsg_t sig; int i; - ftdm_log(FTDM_LOG_INFO, "Span %d D-Chan UP!\n", spri->span->span_id); + ftdm_log(FTDM_LOG_INFO, "Span %d D-Channel UP!\n", ftdm_span_get_id(span)); ftdm_set_flag(spri, LPWRAP_PRI_READY); - ftdm_set_state_all(spri->span, FTDM_CHANNEL_STATE_RESTART); + ftdm_set_state_all(span, FTDM_CHANNEL_STATE_RESTART); - ftdm_log(FTDM_LOG_NOTICE, "%d:Signaling link status changed to %s\n", spri->span->span_id, ftdm_signaling_status2str(status)); + ftdm_log(FTDM_LOG_NOTICE, "%d:Signaling link status changed to %s\n", ftdm_span_get_id(span), ftdm_signaling_status2str(status)); - for (i = 1; i <= spri->span->chan_count; i++) { - ftdmchan = spri->span->channels[i]; + for (i = 1; i <= ftdm_span_get_chan_count(span); i++) { + ftdm_channel_t *chan = ftdm_span_get_channel(span, i); memset(&sig, 0, sizeof(sig)); - sig.chan_id = ftdmchan->chan_id; - sig.span_id = ftdmchan->span_id; - sig.channel = ftdmchan; + sig.span_id = ftdm_channel_get_span_id(chan); + sig.chan_id = ftdm_channel_get_id(chan); + sig.channel = chan; sig.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; sig.raw_data = &status; - ftdm_span_send_signal(spri->span, &sig); + ftdm_span_send_signal(span, &sig); } } return 0; @@ -1209,27 +1238,27 @@ static int on_dchan_down(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ { if (ftdm_test_flag(spri, LPWRAP_PRI_READY)) { ftdm_signaling_status_t status = FTDM_SIG_STATE_DOWN; - ftdm_channel_t *ftdmchan = NULL; + ftdm_span_t *span = spri->span; ftdm_sigmsg_t sig; int i; - ftdm_log(FTDM_LOG_INFO, "Span %d D-Chan DOWN!\n", spri->span->span_id); + ftdm_log(FTDM_LOG_INFO, "Span %d D-Channel DOWN!\n", ftdm_span_get_id(span)); ftdm_clear_flag(spri, LPWRAP_PRI_READY); - ftdm_set_state_all(spri->span, FTDM_CHANNEL_STATE_RESTART); + ftdm_set_state_all(span, FTDM_CHANNEL_STATE_RESTART); - ftdm_log(FTDM_LOG_NOTICE, "%d:Signaling link status changed to %s\n", spri->span->span_id, ftdm_signaling_status2str(status)); + ftdm_log(FTDM_LOG_NOTICE, "%d:Signaling link status changed to %s\n", ftdm_span_get_id(span), ftdm_signaling_status2str(status)); - for (i = 1; i <= spri->span->chan_count; i++) { - ftdmchan = spri->span->channels[i]; + for (i = 1; i <= ftdm_span_get_chan_count(span); i++) { + ftdm_channel_t *chan = ftdm_span_get_channel(span, i); memset(&sig, 0, sizeof(sig)); - sig.chan_id = ftdmchan->chan_id; - sig.span_id = ftdmchan->span_id; - sig.channel = ftdmchan; + sig.span_id = ftdm_channel_get_span_id(chan); + sig.chan_id = ftdm_channel_get_id(chan); + sig.channel = chan; sig.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; sig.raw_data = &status; - ftdm_span_send_signal(spri->span, &sig); + ftdm_span_send_signal(span, &sig); } } @@ -1245,7 +1274,7 @@ static int on_dchan_down(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ */ static int on_anything(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) { - ftdm_log(FTDM_LOG_DEBUG, "Caught Event span %d %u (%s)\n", spri->span->span_id, event_type, lpwrap_pri_event_str(event_type)); + ftdm_log(FTDM_LOG_DEBUG, "Caught Event span %d %u (%s)\n", ftdm_span_get_id(spri->span), event_type, lpwrap_pri_event_str(event_type)); return 0; } @@ -1258,7 +1287,7 @@ static int on_anything(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ev */ static int on_io_fail(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) { - ftdm_log(FTDM_LOG_DEBUG, "Caught Event span %d %u (%s)\n", spri->span->span_id, event_type, lpwrap_pri_event_str(event_type)); + ftdm_log(FTDM_LOG_DEBUG, "Caught Event span %d %u (%s)\n", ftdm_span_get_id(spri->span), event_type, lpwrap_pri_event_str(event_type)); return 0; } @@ -1283,21 +1312,25 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) if (!got_d) { int i, x; - for (i = 1, x = 0; i <= span->chan_count; i++) { - if (span->channels[i]->type == FTDM_CHAN_TYPE_DQ921) { - if (ftdm_channel_open(span->span_id, i, &isdn_data->dchan) == FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_DEBUG, "opening d-channel #%d %d:%d\n", x, isdn_data->dchan->span_id, isdn_data->dchan->chan_id); + for (i = 1, x = 0; i <= ftdm_span_get_chan_count(span); i++) { + ftdm_channel_t *chan = ftdm_span_get_channel(span, i); + + if (ftdm_channel_get_type(chan) == FTDM_CHAN_TYPE_DQ921) { + if (ftdm_channel_open(ftdm_span_get_id(span), i, &isdn_data->dchan) == FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_DEBUG, "opening D-Channel #%d %d:%d\n", x, + ftdm_channel_get_span_id(isdn_data->dchan), ftdm_channel_get_id(isdn_data->dchan)); got_d = 1; x++; break; } else { - ftdm_log(FTDM_LOG_ERROR, "failed to open d-channel #%d %d:%d\n", x, span->channels[i]->span_id, span->channels[i]->chan_id); + ftdm_log(FTDM_LOG_ERROR, "failed to open D-Channel #%d %d:%d\n", x, + ftdm_channel_get_span_id(chan), ftdm_channel_get_id(chan)); } } } } if (!got_d || !isdn_data->dchan) { - ftdm_log(FTDM_LOG_ERROR, "Failed to get a D-channel in span %d\n", span->span_id); + ftdm_log(FTDM_LOG_ERROR, "Failed to get a D-Channel in span %d\n", ftdm_span_get_id(span)); break; } @@ -1356,26 +1389,28 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_FACILITY, on_facility); #endif if (down) { - ftdm_log(FTDM_LOG_INFO, "PRI back up on span %d\n", isdn_data->spri.span->span_id); + ftdm_log(FTDM_LOG_INFO, "PRI back up on span %d\n", ftdm_span_get_id(span)); ftdm_set_state_all(span, FTDM_CHANNEL_STATE_RESTART); down = 0; } isdn_data->spri.on_loop = check_flags; - isdn_data->spri.private_info = span; +// isdn_data->spri.private_info = span; lpwrap_run_pri(&isdn_data->spri); } else { - snprintf(span->last_error, sizeof(span->last_error), "PRI init FAIL!"); + ftdm_log(FTDM_LOG_CRIT, "PRI init failed!\n"); + snprintf(span->last_error, sizeof(span->last_error), "PRI init failed!"); + break; } if (!ftdm_running() || ftdm_test_flag(span, FTDM_SPAN_STOP_THREAD)) { break; } - ftdm_log(FTDM_LOG_CRIT, "PRI down on span %d\n", isdn_data->spri.span->span_id); + ftdm_log(FTDM_LOG_CRIT, "PRI down on span %d\n", ftdm_span_get_id(span)); if (isdn_data->spri.dchan) { - isdn_data->spri.dchan->state = FTDM_CHANNEL_STATE_DOWN; + _ftdm_channel_set_state_force(isdn_data->spri.dchan, FTDM_CHANNEL_STATE_DOWN); } if (!down) { @@ -1386,11 +1421,11 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) check_state(span); check_events(span); - down++; + down = 1; ftdm_sleep(5000); } out: - ftdm_log(FTDM_LOG_DEBUG, "PRI thread ended on span %d\n", span->span_id); + ftdm_log(FTDM_LOG_DEBUG, "PRI thread ended on span %d\n", ftdm_span_get_id(span)); ftdm_clear_flag(span, FTDM_SPAN_IN_THREAD); ftdm_clear_flag(isdn_data, FTMOD_LIBPRI_RUNNING); @@ -1437,8 +1472,8 @@ static ftdm_status_t ftdm_libpri_stop(ftdm_span_t *span) */ static ftdm_status_t ftdm_libpri_start(ftdm_span_t *span) { - ftdm_status_t ret; ftdm_libpri_data_t *isdn_data = span->signal_data; + ftdm_status_t ret; if (ftdm_test_flag(isdn_data, FTMOD_LIBPRI_RUNNING)) { return FTDM_FAIL; @@ -1569,39 +1604,60 @@ static uint32_t parse_opts(const char *in) */ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) { - uint32_t i, x = 0; + uint32_t i; + uint32_t bchan_count = 0; + uint32_t dchan_count = 0; uint32_t paramindex = 0; - //ftdm_channel_t *dchans[2] = {0}; + //ftdm_channel_t *dchan = NULL; ftdm_libpri_data_t *isdn_data; const char *var, *val; if (ftdm_span_get_trunk_type(span) >= FTDM_TRUNK_NONE) { - ftdm_log(FTDM_LOG_WARNING, "Invalid trunk type '%s' defaulting to T1.\n", ftdm_trunk_type2str(ftdm_span_get_trunk_type(span))); + ftdm_log(FTDM_LOG_WARNING, "Invalid trunk type '%s' defaulting to T1.\n", ftdm_span_get_trunk_type_str(span)); ftdm_span_set_trunk_type(span, FTDM_TRUNK_T1); } - for (i = 1; i <= span->chan_count; i++) { - if (span->channels[i]->type == FTDM_CHAN_TYPE_DQ921) { - if (x > 1) { + for (i = 1; i <= ftdm_span_get_chan_count(span); i++) { + ftdm_channel_t *chan = ftdm_span_get_channel(span, i); + + switch (ftdm_channel_get_type(chan)) { + case FTDM_CHAN_TYPE_DQ921: + if (dchan_count > 1) { + ftdm_log(FTDM_LOG_ERROR, "Span has more than 2 D-Channels!\n"); snprintf(span->last_error, sizeof(span->last_error), "Span has more than 2 D-Channels!"); return FTDM_FAIL; } else { #if 0 - if (ftdm_channel_open(span->span_id, i, &dchans[x]) == FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_DEBUG, "opening d-channel #%d %d:%d\n", x, dchans[x]->span_id, dchans[x]->chan_id); - dchans[x]->state = FTDM_CHANNEL_STATE_UP; - x++; + if (ftdm_channel_open(ftdm_span_get_id(span), i, &dchan) == FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_DEBUG, "opening D-Channel %d:%d\n", ftdm_channel_get_span_id(dchan), ftdm_channel_get_id(dchan)); + _ftdm_channel_set_state_force(dchan, FTDM_CHANNEL_STATE_UP); + } else { + ftdm_log(FTDM_LOG_ERROR, "Failed to open D-Channel %d:%d\n", ftdm_channel_get_span_id(chan), ftdm_channel_getid(chan)); + snprintf(span->last_error, sizeof(span->last_error), "Failed to open D-Channel %d:%d\n", ftdm_channel_get_span_id(chan), ftdm_channel_getid(chan)); + return FTDM_FAIL; } #endif - x++; + dchan_count++; } + break; + + case FTDM_CHAN_TYPE_B: + bchan_count++; + break; + default: /* Ignore other channel types */ + break; } } - if (!x) { + if (!dchan_count) { ftdm_log(FTDM_LOG_ERROR, "Span has no D-Channel!\n"); snprintf(span->last_error, sizeof(span->last_error), "Span has no D-Channel!"); return FTDM_FAIL; } + if (!bchan_count) { + ftdm_log(FTDM_LOG_ERROR, "Span has no B-Channels!\n"); + snprintf(span->last_error, sizeof(span->last_error), "Span has no B-Channels!"); + return FTDM_FAIL; + } isdn_data = ftdm_malloc(sizeof(*isdn_data)); assert(isdn_data != NULL); @@ -1611,8 +1667,8 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) case FTDM_TRUNK_BRI: case FTDM_TRUNK_BRI_PTMP: #ifndef HAVE_LIBPRI_BRI - ftdm_log(FTDM_LOG_ERROR, "Unsupported trunk type: '%s', libpri too old\n", ftdm_trunk_type2str(ftdm_span_get_trunk_type(span))); - snprintf(span->last_error, sizeof(span->last_error), "Unsupported trunk type [%s], libpri too old", ftdm_trunk_type2str(ftdm_span_get_trunk_type(span))); + ftdm_log(FTDM_LOG_ERROR, "Unsupported trunk type: '%s', libpri too old\n", ftdm_span_get_trunk_type_str(span)); + snprintf(span->last_error, sizeof(span->last_error), "Unsupported trunk type [%s], libpri too old", ftdm_span_get_trunk_type_str(span)); return FTDM_FAIL; #endif case FTDM_TRUNK_E1: @@ -1625,8 +1681,8 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) isdn_data->l1 = PRI_LAYER_1_ULAW; break; default: - ftdm_log(FTDM_LOG_ERROR, "Invalid trunk type: '%s'\n", ftdm_trunk_type2str(ftdm_span_get_trunk_type(span))); - snprintf(span->last_error, sizeof(span->last_error), "Invalid trunk type [%s]", ftdm_trunk_type2str(ftdm_span_get_trunk_type(span))); + ftdm_log(FTDM_LOG_ERROR, "Invalid trunk type: '%s'\n", ftdm_span_get_trunk_type_str(span)); + snprintf(span->last_error, sizeof(span->last_error), "Invalid trunk type [%s]", ftdm_span_get_trunk_type_str(span)); return FTDM_FAIL; } commit f331303404a854d2ea9970bdb3cc2023002744e4 Author: Paulo R. Panhoto <paulo@voicetechnology.com.br> Date: Wed Nov 10 16:27:43 2010 -0200 mod_mp4 -- Supports playback of MP4 files. * depends on libmp4v2 <http://code.google.com/p/mp4v2/> (originally compiled against v1.6.1) * File format details: - Files must be hinted (mpeg4ip can be used to create the hint tracks). - Video track encoding must be supported by FS (e.g. H.263) - Audio track encoding must be PCMU/8000/Mono. The audio track can be created with this tool: <https://asteriskvideo.svn.sourceforge.net/svnroot/asteriskvideo/tools/pcm2mp4.cpp> diff --git a/src/mod/applications/mod_mp4/Makefile b/src/mod/applications/mod_mp4/Makefile new file mode 100644 index 0000000..8c7932a --- /dev/null +++ b/src/mod/applications/mod_mp4/Makefile @@ -0,0 +1,6 @@ +LOCAL_LDFLAGS=-lmp4v2 +LOCAL_SOURCES=mp4_helper.cpp +LOCAL_OBJS=mp4_helper.o + +BASE=../../../.. +include $(BASE)/build/modmake.rules diff --git a/src/mod/applications/mod_mp4/exception.hpp b/src/mod/applications/mod_mp4/exception.hpp new file mode 100644 index 0000000..75f8498 --- /dev/null +++ b/src/mod/applications/mod_mp4/exception.hpp @@ -0,0 +1,59 @@ +/* + +The contents of this file are subject to the Mozilla Public License +Version 1.1 (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.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is MP4 Helper Library to Freeswitch MP4 module. + +The Initial Developer of the Original Code is +Paulo Rogério Panhoto <paulo@voicetechnology.com.br>. +Portions created by the Initial Developer are Copyright (C) +the Initial Developer. All Rights Reserved. + +*/ + +#ifndef EXCEPTION_HPP_ +#define EXCEPTION_HPP_ + +#include <exception> +#include <string> + +class Exception: public std::exception { + public: + Exception() + { + } + + Exception(const std::string & message): message_(message) + { + } + + Exception(const std::exception & e): message_(e.what()) + { + } + + Exception(const Exception & e): message_(e.message_) + { + } + + virtual ~Exception() throw() + { + } + + const char * what() const throw() + { + return message_.c_str(); + } + + private: + std::string message_; +}; + +#endif \ No newline at end of file diff --git a/src/mod/applications/mod_mp4/mod_mp4.cpp b/src/mod/applications/mod_mp4/mod_mp4.cpp new file mode 100644 index 0000000..a1114d1 --- /dev/null +++ b/src/mod/applications/mod_mp4/mod_mp4.cpp @@ -0,0 +1,547 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (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.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * + * The Initial Developer of the Original Code is + * Paulo Rogério Panhoto <paulo@voicetechnology.com.br> + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * mod_mp4 -- MP4 File Format support for video apps. + * + */ + +#include <switch.h> +#include "mp4_helper.hpp" +#include "exception.hpp" + + +#ifndef min +#define min(x, y) ((x) < (y) ? (x) : (y)) +#endif + +SWITCH_MODULE_LOAD_FUNCTION(mod_mp4_load); +SWITCH_MODULE_DEFINITION(mod_mp4, mod_mp4_load, NULL, NULL); + +#define VID_BIT (1 << 31) +#define VERSION 4201 + +/* +struct file_header { + int32_t version; + char video_codec_name[32]; + char video_fmtp[128]; + uint32_t audio_rate; + uint32_t audio_ptime; + switch_time_t created; +}; + +struct record_helper { + switch_core_session_t *session; + switch_mutex_t *mutex; + int fd; + int up; +}; +*/ + +struct AVParams { + switch_core_session_t * session; + switch_channel_t * channel; + switch_timer_t * timer; + switch_frame_t * frame; + switch_mutex_t * mutex; + bool video; + switch_payload_t pt; + MP4::Context * vc; + bool done; + bool * quit; +}; + +static void *SWITCH_THREAD_FUNC record_video_thread(switch_thread_t *thread, void *obj) +{ +/* + record_helper *eh = reinterpret_cast<record_helper *>(obj); + switch_core_session_t *session = eh->session; + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_status_t status; + switch_frame_t *read_frame; + int bytes; + + eh->up = 1; + while (switch_channel_ready(channel)) { + status = switch_core_session_read_video_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); + + if (!SWITCH_READ_ACCEPTABLE(status)) { + break; + } + + if (switch_test_flag(read_frame, SFF_CNG)) { + continue; + } + + bytes = read_frame->packetlen | VID_BIT; + + switch_mutex_lock(eh->mutex); + + if (write(eh->fd, &bytes, sizeof(bytes)) != (int) sizeof(bytes)) { + switch_mutex_unlock(eh->mutex); + break; + } + + if (write(eh->fd, read_frame->packet, read_frame->packetlen) != (int) read_frame->packetlen) { + switch_mutex_unlock(eh->mutex); + break; + } + + switch_mutex_unlock(eh->mutex); + + switch_core_session_write_video_frame(session, read_frame, SWITCH_IO_FLAG_NONE, 0); + } + eh->up = 0; +*/ + return NULL; +} + +SWITCH_STANDARD_APP(record_mp4_function) +{ +/* + switch_status_t status; + switch_frame_t *read_frame; + switch_channel_t *channel = switch_core_session_get_channel(session); + struct record_helper eh = { 0 }; + switch_thread_t *thread; + switch_threadattr_t *thd_attr = NULL; + int fd; + switch_mutex_t *mutex = NULL; + switch_codec_t codec, *vid_codec; + switch_codec_implementation_t read_impl = { }; + int count = 0, sanity = 30; + + switch_core_session_get_read_impl(session, &read_impl); + switch_channel_answer(channel); + + + while (switch_channel_up(channel) && !switch_channel_test_flag(channel, CF_VIDEO)) { + switch_yield(10000); + + if (count) count--; + + if (count == 0) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "%s waiting for video.\n", switch_channel_get_name(channel)); + count = 100; + if (!--sanity) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s timeout waiting for video.\n", + switch_channel_get_name(channel)); + return; + } + } + } + + if (!switch_channel_ready(channel)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "%s not ready.\n", switch_channel_get_name(channel)); + return; + } + +/* + if ((fd = open((char *) data, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRUSR | S_IWUSR)) < 0) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Error opening file %s\n", (char *) data); + return; + } +** + + MP4::Context ctx(reinterpret_cast<char*>(data), true); + + if (switch_core_codec_init(&codec, + "L16", + NULL, + read_impl.samples_per_second, + read_impl.microseconds_per_packet / 1000, + 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, + NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) + { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Audio Codec Activation Success\n"); + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Audio Codec Activation Fail\n"); + goto end; + } + + switch_core_session_set_read_codec(session, &codec); + + if (switch_channel_test_flag(channel, CF_VIDEO)) { + struct file_header h; + memset(&h, 0, sizeof(h)); + vid_codec = switch_core_session_get_video_read_codec(session); + + h.version = VERSION; + h.created = switch_micro_time_now(); + switch_set_string(h.video_codec_name, vid_codec->implementation->iananame); + if (vid_codec->fmtp_in) { + switch_set_string(h.video_fmtp, vid_codec->fmtp_in); + } + h.audio_rate = read_impl.samples_per_second; + h.audio_ptime = read_impl.microseconds_per_packet / 1000; + + if (write(fd, &h, sizeof(h)) != sizeof(h)) { + goto end; + } + + switch_mutex_init(&mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session)); + eh.mutex = mutex; + eh.fd = fd; + eh.session = session; + switch_threadattr_create(&thd_attr, switch_core_session_get_pool(session)); + switch_threadattr_detach_set(thd_attr, 1); + switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); + switch_thread_create(&thread, thd_attr, record_video_thread, &eh, switch_core_session_get_pool(session)); + } + + + while (switch_channel_ready(channel)) { + + status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); + + if (!SWITCH_READ_ACCEPTABLE(status)) { + break; + } + + if (switch_test_flag(read_frame, SFF_CNG)) { + continue; + } + + if (mutex) { + switch_mutex_lock(mutex); + } + + if (write(fd, &read_frame->datalen, sizeof(read_frame->datalen)) != sizeof(read_frame->datalen)) { + if (mutex) { + switch_mutex_unlock(mutex); + } + break; + } + + if (write(fd, read_frame->data, read_frame->datalen) != (int) read_frame->datalen) { + if (mutex) { + switch_mutex_unlock(mutex); + } + break; + } + + if (mutex) { + switch_mutex_unlock(mutex); + } + } + + + end: + + if (eh.up) { + while (eh.up) { + switch_cond_next(); + } + } + + switch_core_session_set_read_codec(session, NULL); + switch_core_codec_destroy(&codec); +*/ +} + +static void *SWITCH_THREAD_FUNC play_video_function(switch_thread_t *thread, void *obj) +{ + AVParams * pt = reinterpret_cast<AVParams*>(obj); + u_int next = 0, first = 0xffffffff; + u_int64_t ts = 0, control = 0; + + bool ok; + bool sent = true; + pt->done = false; + switch_time_t start = switch_time_now(); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pt->session), SWITCH_LOG_DEBUG, "Video thread Started\n"); + while (!*pt->quit && switch_channel_ready(pt->channel)) { + if (pt->video) { + if (sent) { + switch_mutex_lock(pt->mutex); + pt->frame->packetlen = pt->frame->buflen; + ok = pt->vc->getVideoPacket(pt->frame->packet, pt->frame->packetlen, next); + switch_mutex_unlock(pt->mutex); + sent = false; + if (ok) { + switch_rtp_hdr_t *hdr = reinterpret_cast<switch_rtp_hdr_t *>(pt->frame->packet); + if(first == 0xffffffff) first = next; + next -= first; + control = next * 90000LL / pt->vc->videoTrack().track.clock; + control -= first; + hdr->ts = htonl(control); + control = control * 1000 / 90; + if (pt->pt) + hdr->pt = pt->pt; + } else break; + } + + ts = switch_time_now() - start; + int64_t wait = control > ts ? (control - ts) : 0; + + if (wait > 0) { + switch_cond_next(); + // wait the time for the next Video frame + switch_sleep(wait); + } + + if (switch_channel_test_flag(pt->channel, CF_VIDEO)) { + switch_byte_t *data = (switch_byte_t *) pt->frame->packet; + + pt->frame->data = data + 12; + pt->frame->datalen = pt->frame->packetlen - 12; + switch_core_session_write_video_frame(pt->session, pt->frame, SWITCH_IO_FLAG_NONE, 0); + sent = true; + } + + } + } + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pt->session), SWITCH_LOG_DEBUG, "Video thread ended\n"); + pt->done = true; + return NULL; +} + +static void *SWITCH_THREAD_FUNC play_audio_function(switch_thread_t *thread, void *obj) +{ + AVParams * pt = reinterpret_cast<AVParams*>(obj); + u_int next = 0, first = 0xffffffff; + u_int64_t ts = 0, control = 0; + + bool ok; + bool sent = true; + switch_dtmf_t dtmf = {0}; + pt->done = false; + switch_frame_t * read_frame; + + while (!*pt->quit && switch_channel_ready(pt->channel)) { + // event processing. + // -- SEE switch_ivr_play_say.c:1231 && mod_dptools.c:1428 && mod_dptools.c:1919 + switch_core_session_read_frame(pt->session, &read_frame, SWITCH_IO_FLAG_SINGLE_READ, 0); + + if (switch_channel_test_flag(pt->channel, CF_BREAK)) { + switch_channel_clear_flag(pt->channel, CF_BREAK); + break; + } + + switch_ivr_parse_all_events(pt->session); + + if (switch_channel_has_dtmf(pt->channel)) { + switch_channel_dequeue_dtmf(pt->channel, &dtmf); + const char * terminators = switch_channel_get_variable(pt->channel, SWITCH_PLAYBACK_TERMINATORS_VARIABLE); + if (terminators && !strcasecmp(terminators, "none")) terminators = NULL; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pt->session), SWITCH_LOG_DEBUG, "Digit %c\n", dtmf.digit); + if (terminators && strchr(terminators, dtmf.digit)) { + std::string digit(&dtmf.digit, 0, 1); + switch_channel_set_variable(pt->channel, SWITCH_PLAYBACK_TERMINATOR_USED, digit.c_str()); + break; + } + } + + switch_mutex_lock(pt->mutex); + pt->frame->datalen = pt->frame->buflen; + ok = pt->vc->getAudioPacket(pt->frame->data, pt->frame->datalen, next); + switch_mutex_unlock(pt->mutex); + + if (ok) { + if (pt->frame->datalen > (int) pt->frame->buflen) + pt->frame->datalen = pt->frame->buflen; + + switch_core_session_write_frame(pt->session, pt->frame, SWITCH_IO_FLAG_NONE, 0); + switch_core_timer_next(pt->timer); + } + else break; + } + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pt->session), SWITCH_LOG_DEBUG, "Audio done\n"); + *pt->quit = pt->done = true; + return NULL; +} + +SWITCH_STANDARD_APP(play_mp4_function) +{ + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_frame_t write_frame = { 0 }, vid_frame = {0}; + switch_codec_t codec = { 0 }, vid_codec = {0}, *read_vid_codec; + unsigned char *aud_buffer; + unsigned char *vid_buffer; + switch_timer_t timer = { 0 }; + switch_codec_implementation_t read_impl = {}; + bool done = false; + + try { + MP4::Context vc((char *) data); + + switch_payload_t pt = 0; + + switch_core_session_get_read_impl(session, &read_impl); + + aud_buffer = (unsigned char *) switch_core_session_alloc(session, SWITCH_RECOMMENDED_BUFFER_SIZE); + vid_buffer = (unsigned char *) switch_core_session_alloc(session, SWITCH_RECOMMENDED_BUFFER_SIZE); + + /* + if (!vc.isOpen()) + { + char msgbuf[1024]; + sprintf(msgbuf, "PLAYBACK ERROR (%s): FILE NOT FOUND.", (char*) data); + switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, msgbuf); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Error opening file %s\n", (char *) data); + return; + } + + if(!vc.isSupported()) + { + char msgbuf[1024]; + sprintf(msgbuf, "PLAYBACK ERROR (%s): UNSUPPORTED FORMAT OR FILE NOT HINTED.", (char*) data); + switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, msgbuf); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, + "Error reading track info. Maybe this file is not hinted.\n"); + throw 1; + } + */ + + switch_channel_set_variable(channel, "sip_force_video_fmtp", vc.videoTrack().fmtp.c_str()); + switch_channel_answer(channel); + + if ((read_vid_codec = switch_core_session_get_video_read_codec(session))) { + pt = read_vid_codec->agreed_pt; + } + + write_frame.codec = &codec; + write_frame.data = aud_buffer; + write_frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE; + + vid_frame.codec = &vid_codec; + vid_frame.packet = vid_buffer; + vid_frame.data = vid_buffer + 12; + vid_frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE - 12; + switch_set_flag((&vid_frame), SFF_RAW_RTP); + switch_set_flag((&vid_frame), SFF_PROXY_PACKET); + + if (switch_core_timer_init(&timer, "soft", read_impl.microseconds_per_packet / 1000, + read_impl.samples_per_packet, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Timer Activation Fail\n"); + throw 2; + } + + if (switch_core_codec_init(&codec, + vc.audioTrack().codecName, + NULL, + vc.audioTrack().clock, + vc.audioTrack().packetLength, + 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, + NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Audio Codec Activation Success\n"); + } else { + throw Exception("Audio Codec Activation Fail"); + } + + if (switch_core_codec_init(&vid_codec, + vc.videoTrack().track.codecName, + NULL, + 0, + 0, + 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, + NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Video Codec Activation Success\n"); + } else + { + throw Exception("Video Codec Activation Fail"); + } + switch_core_session_set_read_codec(session, &codec); + + AVParams vpt; + vpt.session = session; + vpt.channel = channel; + vpt.frame = &vid_frame; + vpt.timer = &timer; + vpt.video = true; + vpt.pt = pt; + vpt.vc = &vc; + switch_mutex_init(&vpt.mutex, SWITCH_MUTEX_DEFAULT, switch_core_session_get_pool(session)); + vpt.quit = &done; + + switch_threadattr_t * thd_attr; + switch_threadattr_create(&thd_attr, switch_core_session_get_pool(session)); + switch_threadattr_detach_set(thd_attr, 1); + switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); + switch_thread_t *thread; + switch_thread_create(&thread, thd_attr, play_video_function, (void*)&vpt, switch_core_session_get_pool(session)); + + AVParams apt; + apt.session = session; + apt.channel = channel; + apt.frame = &write_frame; + apt.timer = &timer; + apt.video = false; + apt.vc = &vc; + apt.mutex = vpt.mutex; + apt.quit = &done; + play_audio_function(NULL, &apt); + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Waiting for video thread to join.\n"); + while (!vpt.done) { + switch_cond_next(); + } + + switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, "FILE PLAYED"); + } catch(const std::exception & e) + { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s\n", e.what()); + switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, + (std::string("PLAYBACK_FAILED - ") + e.what()).c_str()); + }catch(...) + { + switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, "PLAYBACK_FAILED - See FS logs for detail."); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Exception caught.\n"); + } + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "All done.\n"); + if (timer.interval) switch_core_timer_destroy(&timer); + + switch_core_session_set_read_codec(session, NULL); + + if (switch_core_codec_ready(&codec)) switch_core_codec_destroy(&codec); + + if (switch_core_codec_ready(&vid_codec)) switch_core_codec_destroy(&vid_codec); +} + +SWITCH_MODULE_LOAD_FUNCTION(mod_mp4_load) +{ + switch_application_interface_t *app_interface; + + /* connect my internal structure to the blank pointer passed to me */ + *module_interface = switch_loadable_module_create_module_interface(pool, modname); + + SWITCH_ADD_APP(app_interface, "play_mp4", "play an MP4 file", "play an MP4 file", play_mp4_function, "<file>", SAF_NONE); + //SWITCH_ADD_APP(app_interface, "record_mp4", "record an MP4 file", "record an MP4 file", record_mp4_function, "<file>", SAF_NONE); + + /* indicate that the module should continue to be loaded */ + return SWITCH_STATUS_SUCCESS; +} + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4: + */ diff --git a/src/mod/applications/mod_mp4/mp4_helper.cpp b/src/mod/applications/mod_mp4/mp4_helper.cpp new file mode 100644 index 0000000..a55f5db --- /dev/null +++ b/src/mod/applications/mod_mp4/mp4_helper.cpp @@ -0,0 +1,133 @@ +/* + +The contents of this file are subject to the Mozilla Public License +Version 1.1 (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.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is MP4 Helper Library to the Freeswitch MP4 Module. + +The Initial Developer of the Original Code is +Paulo Rogério Panhoto <paulo@voicetechnology.com.br>. +Portions created by the Initial Developer are Copyright (C) +the Initial Developer. All Rights Reserved. + + +*/ + +#include "mp4_helper.hpp" + +namespace MP4 +{ + + Context::Context(const char * file, bool newFile) + { + if(newFile) create(file); + else open(file); + } + + Context::~Context() + { + close(); + } + + void Context::open(const char * file) + { + fh = MP4Read(file, 0); + if (fh == MP4_INVALID_FILE_HANDLE) throw Exception(file, "Open failed"); + getTracks(file); + } + + void Context::create(const char * file) + { + fh = MP4Create(file); + if (fh == MP4_INVALID_FILE_HANDLE) throw Exception(file, "Create file failed"); + } + + void Context::close() + { + if (!isOpen()) return; + MP4Close(fh); + } + + void Context::getTracks(const char * file) + { + int i = 0; + bool audioTrack = false, videoTrack = false; + + if (!isOpen()) throw Exception(file, "File is closed."); + + for (;;) + { + TrackProperties track; + if((track.hint = MP4FindTrackId(fh, i++, MP4_HINT_TRACK_TYPE, 0)) == MP4_INVALID_TRACK_ID) break; + + MP4GetHintTrackRtpPayload(fh, track.hint, &track.codecName, &track.payload, NULL, NULL); + + track.track = MP4GetHintTrackReferenceTrackId(fh, track.hint); + if(track.track == MP4_INVALID_TRACK_ID) continue; + track.clock = MP4GetTrackTimeScale(fh, track.hint); + + if (!strcmp(MP4GetTrackType(fh, track.track), MP4_AUDIO_TRACK_TYPE)) { + audioTrack = true; + + if(!strncmp(track.codecName, "PCM", 3)) + track.packetLength = 20; + else + track.packetLength = track.clock = 0; + + audio = track; + } else if (!strcmp(MP4GetTrackType(fh, track.track), MP4_VIDEO_TRACK_TYPE)) { + videoTrack = true; + + const char * sdp = MP4GetHintTrackSdp(fh, track.hint); + const char * fmtp = strstr(sdp, "fmtp"); + + if (fmtp) { + // finds beginning of 'fmtp' value; + for(fmtp += 5; *fmtp != ' '; ++fmtp); + ++fmtp; + + const char * eol = fmtp; + for(;*eol != '\r' && *eol != '\n'; ++eol); + video.fmtp = std::string(fmtp, eol); + } + video.track = track; + } + } + + if (!audioTrack || !videoTrack) throw Exception(file, "Missing audio/video track."); + } + + bool Context::getVideoPacket(void * buffer, u_int & size, u_int & ts) + { + return getPacket(video.track.hint, video.track.runtime, true, buffer, size, ts); + } + + bool Context::getAudioPacket(void * buffer, u_int & size, u_int & ts) + { + return getPacket(audio.hint, audio.runtime, false, buffer, size, ts); + } + + bool Context::getPacket(MP4TrackId hint, RuntimeProperties & rt, + bool header, void * buffer, u_int & size, u_int & ts) + { + if (rt.frame == 0 || rt.packet == rt.packetsPerFrame) { + ++rt.frame; + if(!MP4ReadRtpHint(fh, hint, rt.frame, &rt.packetsPerFrame)) + return false; + rt.packet = 0; + rt.last_frame = MP4GetSampleTime(fh, hint, rt.frame); + } + + ts = rt.last_frame; + if (!MP4ReadRtpPacket(fh, hint, rt.packet, (u_int8_t **) &buffer, &size, 0, header, true)) return false; + ++rt.packet; + return true; + } +} \ No newline at end of file diff --git a/src/mod/applications/mod_mp4/mp4_helper.hpp b/src/mod/applications/mod_mp4/mp4_helper.hpp new file mode 100644 index 0000000..e2da307 --- /dev/null +++ b/src/mod/applications/mod_mp4/mp4_helper.hpp @@ -0,0 +1,137 @@ +/* + +The contents of this file are subject to the Mozilla Public License +Version 1.1 (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.mozilla.org/MPL/ + +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. + +The Original Code is MP4 Helper Library to Freeswitch MP4 module. + +The Initial Developer of the Original Code is +Paulo Rogério Panhoto <paulo@voicetechnology.com.br>. +Portions created by the Initial Developer are Copyright (C) +the Initial Developer. All Rights Reserved. + +*/ + +#ifndef MP4_HELPER_HPP_ +#define MP4_HELPER_HPP_ + +#include <mp4.h> +#include <string> +#include <exception> +#include <string> + +namespace MP4 +{ + class Exception: public std::exception { + public: + Exception(const std::string & file, const std::string & error) + : description_(file + ':' + error) + { + } + + const char * what() const throw() + { + return description_.c_str(); + } + + ~Exception() throw() + { + } + + private: + std::string description_; + }; + + struct RuntimeProperties { + u_int32_t frame; // sampleID + u_int16_t packetsPerFrame; + u_int16_t packet; // packetID + u_int32_t last_frame; // timestamp + + RuntimeProperties(): frame(0), packetsPerFrame(0), packet(0) + { + } + }; + + + struct TrackProperties { + MP4TrackId hint; + MP4TrackId track; + + char * codecName; + u_int8_t payload; + u_int32_t clock; + u_int32_t packetLength; // packet Length in time (ms) + + RuntimeProperties runtime; + + TrackProperties(): hint(MP4_INVALID_TRACK_ID), track(MP4_INVALID_TRACK_ID), + codecName(NULL), payload(0), clock(0), packetLength(0) + { + } + }; + + typedef TrackProperties AudioProperties; + + struct VideoProperties { + TrackProperties track; + std::string fmtp; + + VideoProperties() + { + } + + VideoProperties(const TrackProperties & rhs): track(rhs) + { + } + }; + + class Context { + public: + + Context(const char * file, bool create = false); + ~Context(); + + void open(const char * file); + + void create(const char * file); + + void close(); + + // returns: TRUE = has more data, FALSE = end-of-stream or failure + bool getVideoPacket(void * buffer, u_int & size, u_int & ts); + + // returns: TRUE = has more data, FALSE = end-of-stream or failure + bool getAudioPacket(void * buffer, u_int & size, u_int & ts); + + bool isOpen() const { return fh != MP4_INVALID_FILE_HANDLE; } + + bool isSupported() const { return audio.track != MP4_INVALID_TRACK_ID && video.track.track != MP4_INVALID_TRACK_ID; } + + const AudioProperties & audioTrack() const { return audio; } + + const VideoProperties & videoTrack() const { return video; } + + private: + MP4FileHandle fh; + AudioProperties audio; + + VideoProperties video; + + // Prevent copy construction. + Context(const Context &); + + bool getPacket(MP4TrackId hint, RuntimeProperties & rt, + bool header, void * buffer, u_int & size, u_int & ts); + + void getTracks(const char * file); + }; +} +#endif commit 42edb9cfe9a238b355e89afd7b80eedb1fe3738a Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Nov 10 10:30:18 2010 -0600 swig diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index 82ad8ab..13136d9 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -13019,11 +13019,11 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_dow_cmp(char * jarg1, int jarg2) { int jresult ; char *arg1 = (char *) 0 ; int arg2 ; - int result; + switch_bool_t result; arg1 = (char *)jarg1; arg2 = (int)jarg2; - result = (int)switch_dow_cmp((char const *)arg1,arg2); + result = (switch_bool_t)switch_dow_cmp((char const *)arg1,arg2); jresult = result; return jresult; } @@ -15706,6 +15706,29 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_routines_write_video_frame_get(vo } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_routines_state_run_set(void * jarg1, void * jarg2) { + switch_io_routines *arg1 = (switch_io_routines *) 0 ; + switch_io_state_run_t arg2 = (switch_io_state_run_t) 0 ; + + arg1 = (switch_io_routines *)jarg1; + arg2 = (switch_io_state_run_t)jarg2; + if (arg1) (arg1)->state_run = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_routines_state_run_get(void * jarg1) { + void * jresult ; + switch_io_routines *arg1 = (switch_io_routines *) 0 ; + switch_io_state_run_t result; + + arg1 = (switch_io_routines *)jarg1; + result = (switch_io_state_run_t) ((arg1)->state_run); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_routines_resurrect_session_set(void * jarg1, void * jarg2) { switch_io_routines *arg1 = (switch_io_routines *) 0 ; switch_io_resurrect_session_t arg2 = (switch_io_resurrect_session_t) 0 ; @@ -27923,15 +27946,17 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_sound_test(void * jarg1) { } -SWIGEXPORT void SWIGSTDCALL CSharp_switch_process_import(void * jarg1, void * jarg2, char * jarg3) { +SWIGEXPORT void SWIGSTDCALL CSharp_switch_process_import(void * jarg1, void * jarg2, char * jarg3, char * jarg4) { switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; switch_channel_t *arg2 = (switch_channel_t *) 0 ; char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; arg1 = (switch_core_session_t *)jarg1; arg2 = (switch_channel_t *)jarg2; arg3 = (char *)jarg3; - switch_process_import(arg1,arg2,(char const *)arg3); + arg4 = (char *)jarg4; + switch_process_import(arg1,arg2,(char const *)arg3,(char const *)arg4); } @@ -27947,6 +27972,26 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_uuid_exists(char * jarg1) { } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_set_match_callback(void * jarg1, void * jarg2) { + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + switch_ivr_dmachine_callback_t arg2 = (switch_ivr_dmachine_callback_t) 0 ; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (switch_ivr_dmachine_callback_t)jarg2; + switch_ivr_dmachine_set_match_callback(arg1,arg2); +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_set_nonmatch_callback(void * jarg1, void * jarg2) { + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + switch_ivr_dmachine_callback_t arg2 = (switch_ivr_dmachine_callback_t) 0 ; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (switch_ivr_dmachine_callback_t)jarg2; + switch_ivr_dmachine_set_nonmatch_callback(arg1,arg2); +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_create(void * jarg1, char * jarg2, void * jarg3, unsigned long jarg4, unsigned long jarg5, void * jarg6, void * jarg7, void * jarg8) { int jresult ; switch_ivr_dmachine_t **arg1 = (switch_ivr_dmachine_t **) 0 ; @@ -31234,6 +31279,71 @@ SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hook_state_change(void } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_state_run_state_run_set(void * jarg1, void * jarg2) { + switch_io_event_hook_state_run *arg1 = (switch_io_event_hook_state_run *) 0 ; + switch_state_run_hook_t arg2 = (switch_state_run_hook_t) 0 ; + + arg1 = (switch_io_event_hook_state_run *)jarg1; + arg2 = (switch_state_run_hook_t)jarg2; + if (arg1) (arg1)->state_run = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_state_run_state_run_get(void * jarg1) { + void * jresult ; + switch_io_event_hook_state_run *arg1 = (switch_io_event_hook_state_run *) 0 ; + switch_state_run_hook_t result; + + arg1 = (switch_io_event_hook_state_run *)jarg1; + result = (switch_state_run_hook_t) ((arg1)->state_run); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_state_run_next_set(void * jarg1, void * jarg2) { + switch_io_event_hook_state_run *arg1 = (switch_io_event_hook_state_run *) 0 ; + switch_io_event_hook_state_run *arg2 = (switch_io_event_hook_state_run *) 0 ; + + arg1 = (switch_io_event_hook_state_run *)jarg1; + arg2 = (switch_io_event_hook_state_run *)jarg2; + if (arg1) (arg1)->next = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_state_run_next_get(void * jarg1) { + void * jresult ; + switch_io_event_hook_state_run *arg1 = (switch_io_event_hook_state_run *) 0 ; + switch_io_event_hook_state_run *result = 0 ; + + arg1 = (switch_io_event_hook_state_run *)jarg1; + result = (switch_io_event_hook_state_run *) ((arg1)->next); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_event_hook_state_run() { + void * jresult ; + switch_io_event_hook_state_run *result = 0 ; + + result = (switch_io_event_hook_state_run *)new switch_io_event_hook_state_run(); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hook_state_run(void * jarg1) { + switch_io_event_hook_state_run *arg1 = (switch_io_event_hook_state_run *) 0 ; + + arg1 = (switch_io_event_hook_state_run *)jarg1; + delete arg1; + +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_resurrect_session_resurrect_session_set(void * jarg1, void * jarg2) { switch_io_event_hook_resurrect_session *arg1 = (switch_io_event_hook_resurrect_session *) 0 ; switch_resurrect_session_hook_t arg2 = (switch_resurrect_session_hook_t) 0 ; @@ -31552,6 +31662,29 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hooks_state_change_get(void } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hooks_state_run_set(void * jarg1, void * jarg2) { + switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ; + switch_io_event_hook_state_run_t *arg2 = (switch_io_event_hook_state_run_t *) 0 ; + + arg1 = (switch_io_event_hooks *)jarg1; + arg2 = (switch_io_event_hook_state_run_t *)jarg2; + if (arg1) (arg1)->state_run = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hooks_state_run_get(void * jarg1) { + void * jresult ; + switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ; + switch_io_event_hook_state_run_t *result = 0 ; + + arg1 = (switch_io_event_hooks *)jarg1; + result = (switch_io_event_hook_state_run_t *) ((arg1)->state_run); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hooks_resurrect_session_set(void * jarg1, void * jarg2) { switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ; switch_io_event_hook_resurrect_session_t *arg2 = (switch_io_event_hook_resurrect_session_t *) 0 ; @@ -31650,6 +31783,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_state_change(void * } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_state_run(void * jarg1, void * jarg2) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_state_run_hook_t arg2 = (switch_state_run_hook_t) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (switch_state_run_hook_t)jarg2; + result = (switch_status_t)switch_core_event_hook_add_state_run(arg1,arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_read_frame(void * jarg1, void * jarg2) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; @@ -31818,6 +31965,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_state_change(voi } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_state_run(void * jarg1, void * jarg2) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_state_run_hook_t arg2 = (switch_state_run_hook_t) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (switch_state_run_hook_t)jarg2; + result = (switch_status_t)switch_core_event_hook_remove_state_run(arg1,arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_read_frame(void * jarg1, void * jarg2) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index 2beb015..e31d444 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -2984,8 +2984,8 @@ public class freeswitch { return ret; } - public static int switch_dow_cmp(string exp, int val) { - int ret = freeswitchPINVOKE.switch_dow_cmp(exp, val); + public static switch_bool_t switch_dow_cmp(string exp, int val) { + switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_dow_cmp(exp, val); return ret; } @@ -4374,8 +4374,8 @@ public class freeswitch { return ret; } - public static void switch_process_import(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_switch_channel peer_channel, string varname) { - freeswitchPINVOKE.switch_process_import(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_switch_channel.getCPtr(peer_channel), varname); + public static void switch_process_import(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_switch_channel peer_channel, string varname, string prefix) { + freeswitchPINVOKE.switch_process_import(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_switch_channel.getCPtr(peer_channel), varname, prefix); } public static switch_bool_t switch_ivr_uuid_exists(string uuid) { @@ -4383,6 +4383,14 @@ public class freeswitch { return ret; } + public static void switch_ivr_dmachine_set_match_callback(SWIGTYPE_p_switch_ivr_dmachine dmachine, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t match_callback) { + freeswitchPINVOKE.switch_ivr_dmachine_set_match_callback(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(match_callback)); + } + + public static void switch_ivr_dmachine_set_nonmatch_callback(SWIGTYPE_p_switch_ivr_dmachine dmachine, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t nonmatch_callback) { + freeswitchPINVOKE.switch_ivr_dmachine_set_nonmatch_callback(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(nonmatch_callback)); + } + public static switch_status_t switch_ivr_dmachine_create(SWIGTYPE_p_p_switch_ivr_dmachine dmachine_p, string name, SWIGTYPE_p_apr_pool_t pool, uint digit_timeout, uint input_timeout, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t match_callback, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t nonmatch_callback, SWIGTYPE_p_void user_data) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_create(SWIGTYPE_p_p_switch_ivr_dmachine.getCPtr(dmachine_p), name, SWIGTYPE_p_apr_pool_t.getCPtr(pool), digit_timeout, input_timeout, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(match_callback), SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(nonmatch_callback), SWIGTYPE_p_void.getCPtr(user_data)); return ret; @@ -5038,6 +5046,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_core_event_hook_add_state_run(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session__switch_status_t state_run) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_state_run(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(state_run)); + return ret; + } + public static switch_status_t switch_core_event_hook_add_read_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t read_frame) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_read_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(read_frame)); return ret; @@ -5098,6 +5111,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_core_event_hook_remove_state_run(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session__switch_status_t state_run) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_state_run(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(state_run)); + return ret; + } + public static switch_status_t switch_core_event_hook_remove_read_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t read_frame) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_read_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(read_frame)); return ret; @@ -9264,6 +9282,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_write_video_frame_get")] public static extern IntPtr switch_io_routines_write_video_frame_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_state_run_set")] + public static extern void switch_io_routines_state_run_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_state_run_get")] + public static extern IntPtr switch_io_routines_state_run_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_resurrect_session_set")] public static extern void switch_io_routines_resurrect_session_set(HandleRef jarg1, HandleRef jarg2); @@ -12121,11 +12145,17 @@ class freeswitchPINVOKE { public static extern int switch_ivr_sound_test(HandleRef jarg1); [DllImport("mod_managed", EntryPoint="CSharp_switch_process_import")] - public static extern void switch_process_import(HandleRef jarg1, HandleRef jarg2, string jarg3); + public static extern void switch_process_import(HandleRef jarg1, HandleRef jarg2, string jarg3, string jarg4); [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_uuid_exists")] public static extern int switch_ivr_uuid_exists(string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_set_match_callback")] + public static extern void switch_ivr_dmachine_set_match_callback(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_set_nonmatch_callback")] + public static extern void switch_ivr_dmachine_set_nonmatch_callback(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_create")] public static extern int switch_ivr_dmachine_create(HandleRef jarg1, string jarg2, HandleRef jarg3, uint jarg4, uint jarg5, HandleRef jarg6, HandleRef jarg7, HandleRef jarg8); @@ -12897,6 +12927,24 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hook_state_change")] public static extern void delete_switch_io_event_hook_state_change(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_state_run_state_run_set")] + public static extern void switch_io_event_hook_state_run_state_run_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_state_run_state_run_get")] + public static extern IntPtr switch_io_event_hook_state_run_state_run_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_state_run_next_set")] + public static extern void switch_io_event_hook_state_run_next_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_state_run_next_get")] + public static extern IntPtr switch_io_event_hook_state_run_next_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_event_hook_state_run")] + public static extern IntPtr new_switch_io_event_hook_state_run(); + + [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hook_state_run")] + public static extern void delete_switch_io_event_hook_state_run(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_resurrect_session_resurrect_session_set")] public static extern void switch_io_event_hook_resurrect_session_resurrect_session_set(HandleRef jarg1, HandleRef jarg2); @@ -12981,6 +13029,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_state_change_get")] public static extern IntPtr switch_io_event_hooks_state_change_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_state_run_set")] + public static extern void switch_io_event_hooks_state_run_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_state_run_get")] + public static extern IntPtr switch_io_event_hooks_state_run_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_resurrect_session_set")] public static extern void switch_io_event_hooks_resurrect_session_set(HandleRef jarg1, HandleRef jarg2); @@ -13005,6 +13059,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_state_change")] public static extern int switch_core_event_hook_add_state_change(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_state_run")] + public static extern int switch_core_event_hook_add_state_run(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_read_frame")] public static extern int switch_core_event_hook_add_read_frame(HandleRef jarg1, HandleRef jarg2); @@ -13041,6 +13098,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_state_change")] public static extern int switch_core_event_hook_remove_state_change(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_state_run")] + public static extern int switch_core_event_hook_remove_state_run(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_read_frame")] public static extern int switch_core_event_hook_remove_read_frame(HandleRef jarg1, HandleRef jarg2); @@ -21201,6 +21261,7 @@ public enum switch_channel_flag_t { CF_CONSUME_ON_ORIGINATE, CF_PASSTHRU_PTIME_MISMATCH, CF_BRIDGE_NOWRITE, + CF_RECOVERED, CF_FLAG_MAX } @@ -24310,7 +24371,8 @@ namespace FreeSWITCH.Native { SWITCH_FILE_CALLBACK = (1 << 12), SWITCH_FILE_DONE = (1 << 13), SWITCH_FILE_BUFFER_DONE = (1 << 14), - SWITCH_FILE_WRITE_APPEND = (1 << 15) + SWITCH_FILE_WRITE_APPEND = (1 << 15), + SWITCH_FILE_WRITE_OVER = (1 << 16) } } @@ -25990,6 +26052,17 @@ public class switch_io_event_hooks : IDisposable { } } + public switch_io_event_hook_state_run state_run { + set { + freeswitchPINVOKE.switch_io_event_hooks_state_run_set(swigCPtr, switch_io_event_hook_state_run.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_state_run_get(swigCPtr); + switch_io_event_hook_state_run ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_state_run(cPtr, false); + return ret; + } + } + public switch_io_event_hook_resurrect_session resurrect_session { set { freeswitchPINVOKE.switch_io_event_hooks_resurrect_session_set(swigCPtr, switch_io_event_hook_resurrect_session.getCPtr(value)); @@ -26158,6 +26231,75 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class switch_io_event_hook_state_run : IDisposable { + private HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal switch_io_event_hook_state_run(IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new HandleRef(this, cPtr); + } + + internal static HandleRef getCPtr(switch_io_event_hook_state_run obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } + + ~switch_io_event_hook_state_run() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_switch_io_event_hook_state_run(swigCPtr); + } + swigCPtr = new HandleRef(null, IntPtr.Zero); + GC.SuppressFinalize(this); + } + } + + public SWIGTYPE_p_f_p_switch_core_session__switch_status_t state_run { + set { + freeswitchPINVOKE.switch_io_event_hook_state_run_state_run_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_state_run_state_run_get(swigCPtr); + SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_state_run next { + set { + freeswitchPINVOKE.switch_io_event_hook_state_run_next_set(swigCPtr, switch_io_event_hook_state_run.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_state_run_next_get(swigCPtr); + switch_io_event_hook_state_run ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_state_run(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_state_run() : this(freeswitchPINVOKE.new_switch_io_event_hook_state_run(), true) { + } + +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class switch_io_event_hook_video_read_frame : IDisposable { private HandleRef swigCPtr; protected bool swigCMemOwn; @@ -26545,6 +26687,17 @@ public class switch_io_routines : IDisposable { } } + public SWIGTYPE_p_f_p_switch_core_session__switch_status_t state_run { + set { + freeswitchPINVOKE.switch_io_routines_state_run_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_state_run_get(swigCPtr); + SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false); + return ret; + } + } + public SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t resurrect_session { set { freeswitchPINVOKE.switch_io_routines_resurrect_session_set(swigCPtr, SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t.getCPtr(value)); @@ -27578,7 +27731,8 @@ namespace FreeSWITCH.Native { SMBF_STEREO = (1 << 5), SMBF_ANSWER_REQ = (1 << 6), SMBF_THREAD_LOCK = (1 << 7), - SMBF_PRUNE = (1 << 8) + SMBF_PRUNE = (1 << 8), + SMBF_NO_PAUSE = (1 << 9) } } @@ -29660,6 +29814,7 @@ public enum switch_status_t { SWITCH_STATUS_IGNORE, SWITCH_STATUS_TOO_SMALL, SWITCH_STATUS_FOUND, + SWITCH_STATUS_CONTINUE, SWITCH_STATUS_NOT_INITALIZED } commit 6be15e958e3257a5e4efd6ad6fec3b8115104957 Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Nov 10 10:32:50 2010 -0500 freetdm:Fix for RDNIS not set diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 7ca4085..83a8faa 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -135,6 +135,7 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) cpy_calling_num_from_stack(&ftdmchan->caller_data, &conEvnt->cgPtyNmb); cpy_called_num_from_stack(&ftdmchan->caller_data, &conEvnt->cdPtyNmb); cpy_calling_name_from_stack(&ftdmchan->caller_data, &conEvnt->display); + cpy_redir_num_from_stack(&ftdmchan->caller_data, &conEvnt->redirNmb); ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Incoming call: Called No:[%s] Calling No:[%s]\n", ftdmchan->caller_data.dnis.digits, ftdmchan->caller_data.cid_num.digits); if (conEvnt->bearCap[0].eh.pres) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 3284d54..8367687 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -147,6 +147,7 @@ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) cpy_called_num_from_user(&conEvnt.cdPtyNmb, &ftdmchan->caller_data); cpy_calling_num_from_user(&conEvnt.cgPtyNmb, &ftdmchan->caller_data); + cpy_redir_num_from_user(&conEvnt.redirNmb, &ftdmchan->caller_data); cpy_calling_name_from_user(&conEvnt, ftdmchan); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending SETUP (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); commit d7a136cd1a836c4172a16dad2a0000fe5464794d Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Nov 10 10:32:50 2010 -0500 freetdm:Fix for RDNIS not set diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 7ca4085..83a8faa 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -135,6 +135,7 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) cpy_calling_num_from_stack(&ftdmchan->caller_data, &conEvnt->cgPtyNmb); cpy_called_num_from_stack(&ftdmchan->caller_data, &conEvnt->cdPtyNmb); cpy_calling_name_from_stack(&ftdmchan->caller_data, &conEvnt->display); + cpy_redir_num_from_stack(&ftdmchan->caller_data, &conEvnt->redirNmb); ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Incoming call: Called No:[%s] Calling No:[%s]\n", ftdmchan->caller_data.dnis.digits, ftdmchan->caller_data.cid_num.digits); if (conEvnt->bearCap[0].eh.pres) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 425c281..e269809 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -140,6 +140,7 @@ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) cpy_called_num_from_user(&conEvnt.cdPtyNmb, &ftdmchan->caller_data); cpy_calling_num_from_user(&conEvnt.cgPtyNmb, &ftdmchan->caller_data); + cpy_redir_num_from_user(&conEvnt.redirNmb, &ftdmchan->caller_data); cpy_calling_name_from_user(&conEvnt, ftdmchan); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending SETUP (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); commit d872408922ad785b5f2b9a05cffc26e83d61adee Author: Moises Silva <moy@sangoma.com> Date: Tue Nov 9 19:27:45 2010 -0500 freetdm: do not declare some sangoma ISDN functions as inline as that does not work on gcc (Debian 4.3.2-1.1) 4.3.2 and probably other compilers when the inlined function is not defined in the same compilation unit diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index e84392e..953bfee 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -266,16 +266,16 @@ extern ftdm_sngisdn_data_t g_sngisdn_data; ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *span); /* Support functions */ -FT_DECLARE_INLINE(uint32_t) get_unique_suInstId(int16_t cc_id); -FT_DECLARE_INLINE(void) clear_call_data(sngisdn_chan_data_t *sngisdn_info); -FT_DECLARE_INLINE(void) clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info); +FT_DECLARE(uint32_t) get_unique_suInstId(int16_t cc_id); +FT_DECLARE(void) clear_call_data(sngisdn_chan_data_t *sngisdn_info); +FT_DECLARE(void) clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info); void stack_hdr_init(Header *hdr); void stack_pst_init(Pst *pst); -FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_spInstId(int16_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data); -FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_suInstId(int16_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data); -FT_DECLARE_INLINE(ftdm_status_t) sng_isdn_set_avail_rate(ftdm_span_t *ftdmspan, sngisdn_avail_t avail); +FT_DECLARE(ftdm_status_t) get_ftdmchan_by_spInstId(int16_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data); +FT_DECLARE(ftdm_status_t) get_ftdmchan_by_suInstId(int16_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data); +FT_DECLARE(ftdm_status_t) sng_isdn_set_avail_rate(ftdm_span_t *ftdmspan, sngisdn_avail_t avail); /* Outbound Call Control functions */ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index f54f7db..aa34279 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -49,7 +49,7 @@ ftdm_status_t sngisdn_check_free_ids(void); extern ftdm_sngisdn_data_t g_sngisdn_data; void get_memory_info(void); -FT_DECLARE_INLINE(void) clear_call_data(sngisdn_chan_data_t *sngisdn_info) +FT_DECLARE(void) clear_call_data(sngisdn_chan_data_t *sngisdn_info) { uint32_t cc_id = ((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->cc_id; @@ -66,7 +66,7 @@ FT_DECLARE_INLINE(void) clear_call_data(sngisdn_chan_data_t *sngisdn_info) return; } -FT_DECLARE_INLINE(void) clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info) +FT_DECLARE(void) clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info) { ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_DEBUG, "Clearing glare data (suId:%d suInstId:%u spInstId:%u actv-suInstId:%u actv-spInstId:%u)\n", sngisdn_info->glare.suId, @@ -91,7 +91,7 @@ FT_DECLARE_INLINE(void) clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info) } -FT_DECLARE_INLINE(uint32_t) get_unique_suInstId(int16_t cc_id) +FT_DECLARE(uint32_t) get_unique_suInstId(int16_t cc_id) { uint32_t suInstId; ftdm_assert_return((cc_id > 0 && cc_id <=MAX_VARIANTS), FTDM_FAIL, "Invalid cc_id\n"); @@ -113,7 +113,7 @@ FT_DECLARE_INLINE(uint32_t) get_unique_suInstId(int16_t cc_id) return 0; } -FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_suInstId(int16_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data) +FT_DECLARE(ftdm_status_t) get_ftdmchan_by_suInstId(int16_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data) { ftdm_assert_return((cc_id > 0 && cc_id <=MAX_VARIANTS), FTDM_FAIL, "Invalid cc_id\n"); ftdm_assert_return(g_sngisdn_data.ccs[cc_id].activation_done, FTDM_FAIL, "Trying to find call on unconfigured CC\n"); @@ -125,7 +125,7 @@ FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_suInstId(int16_t cc_id, uint32_ return FTDM_SUCCESS; } -FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_spInstId(int16_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data) +FT_DECLARE(ftdm_status_t) get_ftdmchan_by_spInstId(int16_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data) { ftdm_assert_return((cc_id > 0 && cc_id <=MAX_VARIANTS), FTDM_FAIL, "Invalid cc_id\n"); ftdm_assert_return(g_sngisdn_data.ccs[cc_id].activation_done, FTDM_FAIL, "Trying to find call on unconfigured CC\n"); commit 180feff1f4be0cc80f65b921d81ca25ce91fe3b8 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Wed Nov 10 01:28:30 2010 +0100 ftmod_libpri: Completely disable on_facility if AOC support is not available in libpri (= is too old). Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index ed6acda..2abe761 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -1107,7 +1107,6 @@ static int handle_facility_aoc_e(const struct pri_subcmd_aoc_e *aoc_e) ftdm_log(FTDM_LOG_INFO, "AOC-E:\n%s", tmp); return 0; } -#endif /** * \brief Handler for libpri facility events @@ -1132,7 +1131,6 @@ static int on_facility(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ev int res = -1; switch (sub->cmd) { -#ifdef HAVE_LIBPRI_AOC case PRI_SUBCMD_AOC_S: /* AOC-S: Start of call */ res = handle_facility_aoc_s(&sub->u.aoc_s); break; @@ -1151,7 +1149,6 @@ static int on_facility(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ev sub->u.aoc_request_response.charging_request, sub->u.aoc_request_response.charging_response); break; -#endif default: ftdm_log(FTDM_LOG_DEBUG, "FACILITY subcommand %d is not implemented, ignoring\n", sub->cmd); } @@ -1162,6 +1159,7 @@ static int on_facility(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ev ftdm_log(FTDM_LOG_DEBUG, "Caught Event on span %d %u (%s)\n", spri->span->span_id, event_type, lpwrap_pri_event_str(event_type)); return 0; } +#endif /** * \brief Handler for libpri dchan up event @@ -1354,8 +1352,9 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_INFO_RECEIVED, on_info); LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_RESTART, on_restart); LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_IO_FAIL, on_io_fail); +#ifdef HAVE_LIBPRI_AOC LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_FACILITY, on_facility); - +#endif if (down) { ftdm_log(FTDM_LOG_INFO, "PRI back up on span %d\n", isdn_data->spri.span->span_id); ftdm_set_state_all(span, FTDM_CHANNEL_STATE_RESTART); commit cc8d790cfd207e313effff4e4b38646b0c0b52eb Merge: b1cf0d9 31cc250 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Wed Nov 10 00:48:59 2010 +0100 Merge branch 'master' of ssh://git.freeswitch.org/freeswitch commit b1cf0d9a156fec620ca5d34d3f9a678b131cc046 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Wed Nov 10 00:47:16 2010 +0100 ftmod_libpri: Check if a span really has a D-Channel. Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index af5ab5f..d8acf7e 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -1294,7 +1294,7 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) } } } - if (!got_d) { + if (!got_d || !isdn_data->dchan) { ftdm_log(FTDM_LOG_ERROR, "Failed to get a D-channel in span %d\n", span->span_id); break; } @@ -1577,7 +1577,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) ftdm_span_set_trunk_type(span, FTDM_TRUNK_T1); } - for(i = 1; i <= span->chan_count; i++) { + for (i = 1; i <= span->chan_count; i++) { if (span->channels[i]->type == FTDM_CHAN_TYPE_DQ921) { if (x > 1) { snprintf(span->last_error, sizeof(span->last_error), "Span has more than 2 D-Channels!"); @@ -1590,16 +1590,15 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) x++; } #endif + x++; } } } - -#if 0 if (!x) { - snprintf(span->last_error, sizeof(span->last_error), "Span has no D-Channels!"); + ftdm_log(FTDM_LOG_ERROR, "Span has no D-Channel!\n"); + snprintf(span->last_error, sizeof(span->last_error), "Span has no D-Channel!"); return FTDM_FAIL; } -#endif isdn_data = ftdm_malloc(sizeof(*isdn_data)); assert(isdn_data != NULL); commit 31cc2502f7ae9adbfbd541d63eeac7651afeb7e5 Author: Moises Silva <moy@sangoma.com> Date: Tue Nov 9 17:58:27 2010 -0500 mod_sangoma_codec: register AMR diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index 21bfb95..63073ed 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -98,6 +98,7 @@ vocallo_codec_t g_codec_map[] = /* FIXME: sampling rate seems wrong with this, audioooo soooundssssss sloooooow ... */ { SNGTC_CODEC_G722, 9, "G722", "Sangoma G722", 20, 64000, 20000, 160, 640, 160, 0 }, #endif + { SNGTC_CODEC_AMR_1220, 96, "AMR", "Sangoma AMR", 20, 12200, 20000, 160, 320, 0, 0}, { -1, -1, NULL, NULL, -1, -1, -1, -1, -1, -1 }, }; @@ -1227,12 +1228,14 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) /* Now add as many codec implementations as needed, just up to 40ms for now */ if (g_codec_map[c].autoinit) { + int ms = 0; for (i = 1; i <= 4; i++) { - - if ((g_codec_map[c].maxms/10) < i) { - continue; + ms = i * 10; + if (g_codec_map[c].maxms < ms) { + break; } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding %dms implementation of codec %s\n", ms, g_codec_map[c].fs_name); switch_core_codec_add_implementation(pool, codec_interface, /* the codec interface we allocated and we want to register with the core */ SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ g_codec_map[c].iana, /* the IANA code number, ie http://www.iana.org/assignments/rtp-parameters */ @@ -1253,7 +1256,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) switch_sangoma_destroy); /* deinitalize a codec handle using this implementation */ } - } else { /* custom implementation for some codecs */ @@ -1369,6 +1371,27 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) switch_sangoma_destroy); /* deinitalize a codec handle using this implementation */ break; + case SNGTC_CODEC_AMR_1220: + switch_core_codec_add_implementation(pool, codec_interface, /* the codec interface we allocated and we want to register with the core */ + SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ + g_codec_map[c].iana, /* the IANA code number, ie http://www.iana.org/assignments/rtp-parameters */ + g_codec_map[c].iana_name, /* the IANA code name */ + NULL, /* default fmtp to send (can be overridden by the init function), fmtp is used in SDP for format specific parameters */ + 8000, /* samples transferred per second */ + 8000, /* actual samples transferred per second */ + g_codec_map[c].bps, /* bits transferred per second */ + g_codec_map[c].mpf, /* microseconds per frame */ + g_codec_map[c].spf, /* samples per frame */ + g_codec_map[c].bpfd, /* number of bytes per frame decompressed */ + g_codec_map[c].bpfc, /* number of bytes per frame compressed */ + 1, /* number of channels represented */ + g_codec_map[c].spf, /* number of frames per network packet (I dont think this is used at all) */ + switch_sangoma_init, /* function to initialize a codec session using this implementation */ + switch_sangoma_encode, /* function to encode slinear data into encoded data */ + switch_sangoma_decode, /* function to decode encoded data into slinear data */ + switch_sangoma_destroy); /* deinitalize a codec handle using this implementation */ + break; + default: break; } commit c9db28c25ff1d6d8e680b74ac6ddbc83eb029c9d Merge: a0b164c 8d66f38 Author: David Yat Sin <dyatsin@sangoma.com> Date: Tue Nov 9 16:54:24 2010 -0500 Merge branch 'master' of git.sangoma.com:smg_freeswitch diff --cc libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c index d64e711,2b34552..23e6742 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@@ -47,132 -43,126 +43,125 @@@ #include <sys/time.h> #endif - #include "ftdm_isdn.h" + #include "ftmod_isdn.h" #define LINE "--------------------------------------------------------------------------------" - //#define IODEBUG /* helper macros */ -#define FTDM_SPAN_IS_BRI(x) ((x)->trunk_type == FTDM_TRUNK_BRI || (x)->trunk_type == FTDM_TRUNK_BRI_PTMP) #define FTDM_SPAN_IS_NT(x) (((ftdm_isdn_data_t *)(x)->signal_data)->mode == Q921_NT) + #define DEFAULT_NATIONAL_PREFIX "0" + #define DEFAULT_INTERNATIONAL_PREFIX "00" - #ifdef HAVE_LIBPCAP - /*-------------------------------------------------------------------------*/ - /*Q931ToPcap functions*/ + /***************************************************************************************** + * PCAP + * Based on Helmut Kuper's (<helmut.kuper@ewetel.de>) implementation, + * but using a different approach (needs a recent libpcap + wireshark) + *****************************************************************************************/ + #ifdef HAVE_PCAP + #include <arpa/inet.h> /* htons() */ #include <pcap.h> - #endif - #define SNAPLEN 1522 - #define MAX_ETHER_PAYLOAD_SIZE 1500 - #define MIN_ETHER_PAYLOAD_SIZE 42 - #define SIZE_ETHERNET 18 - #define VLANID_OFFSET 15 - #define SIZE_IP 20 - #define SIZE_TCP 20 - #define SIZE_TPKT 4 - #define SIZE_ETHERNET_CRC 4 - #define OVERHEAD SIZE_ETHERNET+SIZE_IP+SIZE_TCP+SIZE_TPKT - #define MAX_Q931_SIZE MAX_ETHER_PAYLOAD_SIZE-SIZE_IP-SIZE_TCP-SIZE_TPKT - #define TPKT_SIZE_OFFSET SIZE_ETHERNET+SIZE_IP+SIZE_TCP+2 - #define IP_SIZE_OFFSET SIZE_ETHERNET+2 - #define TCP_SEQ_OFFSET SIZE_ETHERNET+SIZE_IP+4 - - #ifdef HAVE_LIBPCAP - /*Some globals*/ - unsigned long pcapfilesize = 0; - unsigned long tcp_next_seq_no_send = 0; - unsigned long tcp_next_seq_no_rec = 0; - pcap_dumper_t *pcapfile = NULL; - struct pcap_pkthdr pcaphdr; - pcap_t *pcaphandle = NULL; - char *pcapfn = NULL; - int do_q931ToPcap= 0; - - /*Predefined Ethernet Frame with Q931-over-IP encapsulated - From remote TDM host to FreeSWITCH*/ - L3UCHAR recFrame[SNAPLEN]= { - /*IEEE 802.3 VLAN 802.1q Ethernet Frame Header*/ - 2,0,1,0xAA,0xAA,0xAA,2,0,1,0xBB,0xBB,0xBB,0x81,0,0xE0,0,0x08,0, - /*IPv4 Header (minimal size; no options)*/ - 0x45,0,0,44,0,0,0,0,64,6,0,0,2,2,2,2,1,1,1,1, - /*TCP-Header*/ - 0,0x66,0,0x66,0,0,0,0,0,0,0,0,0x50,0,0,1,0,0,0,0, - /*TPKT-Header RFC 1006*/ - 3,0,0,0 - }; - - /*Predefined Ethernet Frame with Q931-over-IP encapsulated - Frome FreeSWITCH to remote TDM host*/ - L3UCHAR sendFrame[SNAPLEN]= { - /*IEEE 802.3 VLAN 802.1q Ethernet Frame Header*/ - 2,0,1,0xBB,0xBB,0xBB,2,0,1,0xAA,0xAA,0xAA,0x81,0,0xE0,0,0x08,0, - /*IPv4 Header (minimal size; no options)*/ - 0x45,0,0,44,0,0,0,0,64,6,0,0,1,1,1,1,2,2,2,2, - /*TCP-Header*/ - 0,0x66,0,0x66,0,0,0,0,0,0,0,0,0x50,0,0,1,0,0,0,0, - /*TPKT-Header RFC 1006*/ - 3,0,0,0 - }; + #define PCAP_SNAPLEN 1500 - /** - * \brief Opens a pcap file for capture - * \return Success or failure - */ - static ftdm_status_t openPcapFile(void) + struct pcap_context { + pcap_dumper_t *dump; /*!< pcap file handle */ + pcap_t *handle; /*!< pcap lib context */ + char *filename; /*!< capture file name */ + }; + + static inline ftdm_status_t isdn_pcap_is_open(struct ftdm_isdn_data *isdn) { - if(!pcaphandle) - { - pcaphandle = pcap_open_dead(DLT_EN10MB, SNAPLEN); - if (!pcaphandle) - { - ftdm_log(FTDM_LOG_ERROR, "Can't open pcap session: (%s)\n", pcap_geterr(pcaphandle)); - return FTDM_FAIL; - } - } + return (isdn->pcap) ? 1 : 0; + } - if(!pcapfile){ - /* Open the dump file */ - if(!(pcapfile=pcap_dump_open(pcaphandle, pcapfn))){ - ftdm_log(FTDM_LOG_ERROR, "Error opening output file (%s)\n", pcap_geterr(pcaphandle)); - return FTDM_FAIL; - } - } - else{ - ftdm_log(FTDM_LOG_WARNING, "Pcap file is already open!\n"); - return FTDM_FAIL; - } + static inline ftdm_status_t isdn_pcap_capture_both(struct ftdm_isdn_data *isdn) + { + return ((isdn->flags & (FTDM_ISDN_CAPTURE | FTDM_ISDN_CAPTURE_L3ONLY)) == FTDM_ISDN_CAPTURE) ? 1 : 0; + } - ftdm_log(FTDM_LOG_DEBUG, "Pcap file '%s' successfully opened!\n", pcapfn); + static inline ftdm_status_t isdn_pcap_capture_l3only(struct ftdm_isdn_data *isdn) + { + return ((isdn->flags & FTDM_ISDN_CAPTURE) && (isdn->flags & FTDM_ISDN_CAPTURE_L3ONLY)) ? 1 : 0; + } - pcaphdr.ts.tv_sec = 0; - pcaphdr.ts.tv_usec = 0; - pcapfilesize = 24; /*current pcap file header seems to be 24 bytes*/ - tcp_next_seq_no_send = 0; - tcp_next_seq_no_rec = 0; + static ftdm_status_t isdn_pcap_open(struct ftdm_isdn_data *isdn, char *filename) + { + struct pcap_context *pcap = NULL; - return FTDM_SUCCESS; + if (!isdn) { + return FTDM_FAIL; + } + + if (ftdm_strlen_zero(filename)) { + return FTDM_FAIL; + } + + pcap = malloc(sizeof(struct pcap_context)); + if (!pcap) { + ftdm_log(FTDM_LOG_ERROR, "Failed to allocate isdn pcap context\n"); + return FTDM_FAIL; + } + + memset(pcap, 0, sizeof(struct pcap_context)); + + pcap->filename = strdup(filename); + + pcap->handle = pcap_open_dead(DLT_LINUX_LAPD, PCAP_SNAPLEN); + if (!pcap->handle) { + ftdm_log(FTDM_LOG_ERROR, "Failed to open pcap handle\n"); + goto error; + } + + pcap->dump = pcap_dump_open(pcap->handle, pcap->filename); + if (!pcap->dump) { + ftdm_log(FTDM_LOG_ERROR, "Failed to open capture file: %s\n", pcap_geterr(pcap->handle)); + goto error; + } + + ftdm_log(FTDM_LOG_INFO, "Capture file \"%s\" opened\n", pcap->filename); + + isdn->pcap = pcap; + + return FTDM_SUCCESS; + + error: + if (pcap->handle) { + pcap_close(pcap->handle); + } + if (pcap->filename) { + free(pcap->filename); + } + + free(pcap); + + return FTDM_FAIL; } - /** - * \brief Closes a pcap file - * \return Success - */ - static ftdm_status_t closePcapFile(void) + static ftdm_status_t isdn_pcap_close(struct ftdm_isdn_data *isdn) { - if (pcapfile) { - pcap_dump_close(pcapfile); - if (pcaphandle) pcap_close(pcaphandle); - - ftdm_log(FTDM_LOG_DEBUG, "Pcap file closed! File size is %lu bytes.\n", pcapfilesize); + struct pcap_context *pcap = NULL; + long size; - pcaphdr.ts.tv_sec = 0; - pcaphdr.ts.tv_usec = 0; - pcapfile = NULL; - pcaphandle = NULL; - pcapfilesize = 0; - tcp_next_seq_no_send = 0; - tcp_next_seq_no_rec = 0; + if (!isdn || !isdn->pcap) { + return FTDM_FAIL; } + pcap = isdn->pcap; + + isdn->flags &= ~(FTDM_ISDN_CAPTURE | FTDM_ISDN_CAPTURE_L3ONLY); + isdn->pcap = NULL; + + pcap_dump_flush(pcap->dump); + + size = pcap_dump_ftell(pcap->dump); + ftdm_log(FTDM_LOG_INFO, "File \"%s\" captured %ld bytes of data\n", pcap->filename, size); + + pcap_dump_close(pcap->dump); + pcap_close(pcap->handle); + + free(pcap->filename); + free(pcap); - /*We have allways success with this? I think so*/ return FTDM_SUCCESS; } commit a0b164c1322e1d08e3d3a707d8d3ae53551772e1 Author: David Yat Sin <dyatsin@sangoma.com> Date: Tue Nov 9 16:34:34 2010 -0500 freetdm: ISDN - Fix for not waking up the line on power-saving lines diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index f02c9c4..1ede703 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -1751,7 +1751,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_chan(ftdm_channel_t *ftdmchan) goto done; } - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_IN_ALARM)) { + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_IN_ALARM) && !ftdm_test_flag(ftdmchan->span, FTDM_SPAN_PWR_SAVING)) { snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "%s", "Channel is alarmed\n"); ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Cannot open channel when is alarmed\n"); goto done; @@ -3927,6 +3927,11 @@ static ftdm_status_t ftdm_set_channels_alarms(ftdm_span_t *span, int currindex) ftdm_log(FTDM_LOG_ERROR, "%d:%d: Failed to get alarms\n", span->channels[chan_index]->physical_span_id, span->channels[chan_index]->physical_chan_id); return FTDM_FAIL; } + if (span->channels[chan_index]->alarm_flags) { + ftdm_set_flag_locked(span->channels[chan_index], FTDM_CHANNEL_IN_ALARM); + } else { + ftdm_clear_flag_locked(span->channels[chan_index], FTDM_CHANNEL_IN_ALARM); + } } return FTDM_SUCCESS; } diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c index 65c9dfc..d64e711 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@ -53,7 +53,6 @@ //#define IODEBUG /* helper macros */ -#define FTDM_SPAN_IS_BRI(x) ((x)->trunk_type == FTDM_TRUNK_BRI || (x)->trunk_type == FTDM_TRUNK_BRI_PTMP) #define FTDM_SPAN_IS_NT(x) (((ftdm_isdn_data_t *)(x)->signal_data)->mode == Q921_NT) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 22c89cb..39231a0 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -47,6 +47,7 @@ static ftdm_status_t ftdm_sangoma_isdn_start(ftdm_span_t *span); ftdm_channel_t* ftdm_sangoma_isdn_process_event_states(ftdm_span_t *span, sngisdn_event_data_t *sngisdn_event); static void ftdm_sangoma_isdn_advance_chan_states(ftdm_channel_t *ftdmchan); +static void ftdm_sangoma_isdn_poll_events(ftdm_span_t *span); static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan); static void ftdm_sangoma_isdn_process_stack_event (ftdm_span_t *span, sngisdn_event_data_t *sngisdn_event); @@ -238,6 +239,50 @@ static __inline__ void ftdm_sangoma_isdn_advance_chan_states(ftdm_channel_t *ftd } } +static void ftdm_sangoma_isdn_poll_events(ftdm_span_t *span) +{ + ftdm_status_t ret_status; + ftdm_channel_t *ftdmchan; + ftdm_iterator_t *chaniter = NULL; + ftdm_iterator_t *curr = NULL; + + ret_status = ftdm_span_poll_event(span, 0, NULL); + switch(ret_status) { + case FTDM_SUCCESS: + { + ftdm_event_t *event; + while (ftdm_span_next_event(span, &event) == FTDM_SUCCESS) { + + if (FTDM_SPAN_IS_BRI(span)) { + switch (event->enum_id) { + /* Check if the span woke up from power-saving mode */ + case FTDM_OOB_ALARM_CLEAR: + { + chaniter = ftdm_span_get_chan_iterator(span, NULL); + for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { + ftdmchan = (ftdm_channel_t*)ftdm_iterator_current(curr); + sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data; + + if (ftdm_test_flag(sngisdn_info, FLAG_ACTIVATING)) { + ftdm_clear_flag(sngisdn_info, FLAG_ACTIVATING); + sngisdn_snd_setup((ftdm_channel_t*)ftdmchan); + } + } + ftdm_iterator_free(chaniter); + } + } + } + } + } + break; + case FTDM_TIMEOUT: + /* No events pending */ + break; + default: + ftdm_log(FTDM_LOG_WARNING, "%s:Failed to poll span event\n", span->name); + } +} + static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj) { ftdm_interrupt_t *ftdm_sangoma_isdn_int[2]; @@ -300,21 +345,8 @@ static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj) } /* Poll for events, e.g HW DTMF */ - ret_status = ftdm_span_poll_event(span, 0, NULL); - switch(ret_status) { - case FTDM_SUCCESS: - { - ftdm_event_t *event; - while (ftdm_span_next_event(span, &event) == FTDM_SUCCESS); - } - break; - case FTDM_TIMEOUT: - /* No events pending */ - break; - default: - ftdm_log(FTDM_LOG_WARNING, "%s:Failed to poll span event\n", span->name); - } - + ftdm_sangoma_isdn_poll_events(span); + if (ftdm_sched_get_time_to_next_timer(signal_data->sched, &sleep) == FTDM_SUCCESS) { if (sleep < 0 || sleep > SNGISDN_EVENT_POLL_RATE) { sleep = SNGISDN_EVENT_POLL_RATE; @@ -498,8 +530,20 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) } break; case FTDM_CHANNEL_STATE_DIALING: /* outgoing call request */ - { - sngisdn_snd_setup(ftdmchan); + { + if (FTDM_SPAN_IS_BRI(ftdmchan->span) && + ftdm_test_flag(ftdmchan, FTDM_CHANNEL_IN_ALARM) && + ftdm_test_flag(ftdmchan->span, FTDM_SPAN_PWR_SAVING)) { + + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Requesting Line activation\n"); + sngisdn_set_flag(sngisdn_info, FLAG_ACTIVATING); + sng_isdn_wake_up_phy(ftdmchan->span); + ftdm_sched_timer(signal_data->sched, "timer_t3", signal_data->timer_t3*1000, sngisdn_t3_timeout, (void*) sngisdn_info, NULL); + } else { + sngisdn_snd_setup(ftdmchan); + } } break; case FTDM_CHANNEL_STATE_PROGRESS: @@ -856,8 +900,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_isdn_span_config) if (span->trunk_type == FTDM_TRUNK_BRI_PTMP || span->trunk_type == FTDM_TRUNK_BRI) { - - ftdm_set_flag(span, FTDM_SPAN_USE_AV_RATE); + sng_isdn_set_avail_rate(span, SNGISDN_AVAIL_PWR_SAVING); } @@ -914,7 +957,7 @@ static FIO_SIG_LOAD_FUNCTION(ftdm_sangoma_isdn_init) /* initalize sng_isdn library */ - ftdm_assert_return(!sng_isdn_init(&g_sngisdn_event_interface), FTDM_FAIL, "Failed to initialize stack\n"); + ftdm_assert_return(!sng_isdn_init(&g_sngisdn_event_interface), FTDM_FAIL, "Failed to initialize stack\n"); return FTDM_SUCCESS; } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index e84392e..a3d48a8 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -74,6 +74,7 @@ typedef enum { FLAG_DELAYED_REL = (1 << 7), FLAG_SENT_PROCEED = (1 << 8), FLAG_SEND_DISC = (1 << 9), + FLAG_ACTIVATING = (1 << 10), /* Used for BRI only, flag is set after we request line CONNECTED */ } sngisdn_flag_t; @@ -181,6 +182,7 @@ typedef struct sngisdn_span_data { uint8_t facility; int8_t facility_timeout; uint8_t num_local_numbers; + uint8_t timer_t3; char* local_numbers[SNGISDN_NUM_LOCAL_NUMBERS]; ftdm_sched_t *sched; ftdm_queue_t *event_queue; @@ -368,11 +370,13 @@ void sngisdn_delayed_release(void* p_sngisdn_info); void sngisdn_delayed_connect(void* p_sngisdn_info); void sngisdn_delayed_disconnect(void* p_sngisdn_info); void sngisdn_facility_timeout(void* p_sngisdn_info); +void sngisdn_t3_timeout(void* p_sngisdn_info); /* Stack management functions */ ftdm_status_t sng_isdn_stack_cfg(ftdm_span_t *span); ftdm_status_t sng_isdn_stack_start(ftdm_span_t *span); ftdm_status_t sng_isdn_stack_stop(ftdm_span_t *span); +ftdm_status_t sng_isdn_wake_up_phy(ftdm_span_t *span); void sngisdn_print_phy_stats(ftdm_stream_handle_t *stream, ftdm_span_t *span); void sngisdn_print_spans(ftdm_stream_handle_t *stream); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c index 64d7a24..18ca9c3 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c @@ -98,6 +98,8 @@ ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span) ftdm_log(FTDM_LOG_ERROR, "%s:Unsupported switchtype %s for trunktype:%s\n", span->name, switch_name, ftdm_trunk_type2str(span->trunk_type)); return FTDM_FAIL; } + ftdm_set_flag(span, FTDM_SPAN_USE_AV_RATE); + ftdm_set_flag(span, FTDM_SPAN_PWR_SAVING); /* can be > 1 for some BRI variants */ break; default: @@ -179,6 +181,7 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ signal_data->min_digits = 8; signal_data->overlap_dial = SNGISDN_OPT_DEFAULT; signal_data->setup_arb = SNGISDN_OPT_DEFAULT; + signal_data->timer_t3 = 8; signal_data->link_id = span->span_id; span->default_caller_data.bearer_capability = IN_ITC_SPEECH; @@ -189,6 +192,7 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ if (span->trunk_type == FTDM_TRUNK_BRI || span->trunk_type == FTDM_TRUNK_BRI_PTMP) { + ftdm_span_set_npi("unknown", &span->default_caller_data.dnis.plan); ftdm_span_set_ton("unknown", &span->default_caller_data.dnis.type); ftdm_span_set_npi("unknown", &span->default_caller_data.cid_num.plan); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c index 27c16c2..bfc00d0 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c @@ -113,6 +113,40 @@ ftdm_status_t sng_isdn_stack_stop(ftdm_span_t *span) } +ftdm_status_t sng_isdn_wake_up_phy(ftdm_span_t *span) +{ + L1Mngmt cntrl; + Pst pst; + + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; + + /* initalize the post structure */ + stack_pst_init(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTL1; + + /* initalize the control structure */ + memset(&cntrl, 0, sizeof(cntrl)); + + /* initalize the control header */ + stack_hdr_init(&cntrl.hdr); + + cntrl.hdr.msgType = TCNTRL; /* configuration */ + cntrl.hdr.entId.ent = ENTL1; /* entity */ + cntrl.hdr.entId.inst = S_INST; /* instance */ + cntrl.hdr.elmId.elmnt = STTSAP; /* SAP Specific cntrl */ + + cntrl.t.cntrl.action = AENA; + cntrl.t.cntrl.subAction = SAELMNT; + cntrl.t.cntrl.sapId = signal_data->link_id; + + if (sng_isdn_phy_cntrl(&pst, &cntrl)) { + return FTDM_FAIL; + } + return FTDM_SUCCESS; +} + ftdm_status_t sng_isdn_activate_phy(ftdm_span_t *span) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 3284d54..425c281 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -38,13 +38,6 @@ extern ftdm_status_t cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_d extern ftdm_status_t cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm); extern ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan); -void sngisdn_snd_setup(ftdm_channel_t *ftdmchan); -void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan); -void sngisdn_snd_progress(ftdm_channel_t *ftdmchan); -void sngisdn_snd_connect(ftdm_channel_t *ftdmchan); -void sngisdn_snd_disconnect(ftdm_channel_t *ftdmchan); -void sngisdn_snd_release(ftdm_channel_t *ftdmchan, uint8_t glare); - void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index f54f7db..5987823 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -382,6 +382,28 @@ ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmc return FTDM_SUCCESS; } +void sngisdn_t3_timeout(void* p_sngisdn_info) +{ + sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*)p_sngisdn_info; + ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Timer T3 expired (suId:%d suInstId:%u spInstId:%u)\n", + signal_data->cc_id, sngisdn_info->glare.spInstId, sngisdn_info->glare.suInstId); + ftdm_mutex_lock(ftdmchan->mutex); + if (ftdm_test_flag(sngisdn_info, FLAG_ACTIVATING)){ + /* PHY layer timed-out, need to clear the call */ + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Failed to Wake-Up line (suId:%d suInstId:%u spInstId:%u)\n", + signal_data->cc_id, sngisdn_info->glare.spInstId, sngisdn_info->glare.suInstId); + + ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NO_ROUTE_DESTINATION; + ftdm_clear_flag(sngisdn_info, FLAG_ACTIVATING); + ftdm_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + } + ftdm_mutex_unlock(ftdmchan->mutex); +} + void sngisdn_delayed_release(void* p_sngisdn_info) { sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*)p_sngisdn_info; diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index e2d85f7..b95b34d 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -1011,13 +1011,15 @@ static FIO_GET_ALARMS_FUNCTION(wanpipe_get_alarms) } alarms = tdm_api.wp_tdm_cmd.fe_alarms; #endif -#if 1 - /* DAVIDY - Temporary fix: in the current trunk of libsangoma, for BRI, +#ifdef WIN32 + /* Temporary fix: in the current trunk of libsangoma, for BRI, WAN_TE_BIT_ALARM_RED bit is set if the card is in disconnected state, but this has not been ported to Windows-libsangoma yet */ - if (alarms) { - ftdmchan->alarm_flags |= FTDM_ALARM_RED; - alarms = 0; + if (FTDM_SPAN_IS_BRI(ftdmchan->span)) { + if (alarms) { + ftdmchan->alarm_flags |= FTDM_ALARM_RED; + alarms = 0; + } } #endif @@ -1027,6 +1029,7 @@ static FIO_GET_ALARMS_FUNCTION(wanpipe_get_alarms) ftdmchan->alarm_flags |= FTDM_ALARM_RED; alarms &= ~WAN_TE_BIT_ALARM_RED; } + if (alarms & WAN_TE_BIT_ALARM_AIS) { ftdmchan->alarm_flags |= FTDM_ALARM_BLUE; diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index 8bdbdd6..dbf1080 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -222,6 +222,8 @@ extern "C" { #define ftdm_is_dtmf(key) ((key > 47 && key < 58) || (key > 64 && key < 69) || (key > 96 && key < 101) || key == 35 || key == 42 || key == 87 || key == 119) +#define FTDM_SPAN_IS_BRI(x) ((x)->trunk_type == FTDM_TRUNK_BRI || (x)->trunk_type == FTDM_TRUNK_BRI_PTMP) + /*! \brief Copy flags from one arbitrary object to another \command dest the object to copy the flags to diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index bddefd9..78ac8f6 100644 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -176,10 +176,11 @@ typedef enum { FTDM_SPAN_USE_CHAN_QUEUE = (1 << 6), FTDM_SPAN_SUGGEST_CHAN_ID = (1 << 7), FTDM_SPAN_USE_AV_RATE = (1 << 8), + FTDM_SPAN_PWR_SAVING = (1 << 9), /* If you use this flag, you MUST call ftdm_span_trigger_signals to deliver the user signals * after having called ftdm_send_span_signal(), which with this flag it will just enqueue the signal * for later delivery */ - FTDM_SPAN_USE_SIGNALS_QUEUE = (1 << 9), + FTDM_SPAN_USE_SIGNALS_QUEUE = (1 << 10), } ftdm_span_flag_t; /*! \brief Channel supported features */ commit 28f5d287d44035da561d44825318d449a33c54d6 Author: Moises Silva <moy@sangoma.com> Date: Tue Nov 9 14:11:02 2010 -0500 fix previous merge side-effect in build files diff --git a/Freeswitch.2008.sln b/Freeswitch.2008.sln index d31ca4a..01a4cf4 100644 --- a/Freeswitch.2008.sln +++ b/Freeswitch.2008.sln @@ -48,6 +48,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Debug", "Debug", "{6374D55C-FABE-4A02-9CF1-4145308A56C5}" ProjectSection(SolutionItems) = preProject debug\conf\freeswitch.xml = debug\conf\freeswitch.xml + debug\conf\vars.xml = debug\conf\vars.xml EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Build System", "_Build System", "{DB1024A8-41BF-4AD7-9AE6-13202230D1F3}" @@ -58,6 +59,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Build System", "_Build Sys configure.in = configure.in Makefile.am = Makefile.am build\modmake.rules.in = build\modmake.rules.in + build\modules.conf.in = build\modules.conf.in libs\win32\util.vbs = libs\win32\util.vbs EndProjectSection EndProject @@ -90,11 +92,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "autoload_configs", "autoloa conf\autoload_configs\limit.conf.xml = conf\autoload_configs\limit.conf.xml conf\autoload_configs\local_stream.conf.xml = conf\autoload_configs\local_stream.conf.xml conf\autoload_configs\logfile.conf.xml = conf\autoload_configs\logfile.conf.xml + conf\autoload_configs\modules.conf.xml = conf\autoload_configs\modules.conf.xml conf\autoload_configs\openmrcp.conf.xml = conf\autoload_configs\openmrcp.conf.xml conf\autoload_configs\portaudio.conf.xml = conf\autoload_configs\portaudio.conf.xml conf\autoload_configs\rss.conf.xml = conf\autoload_configs\rss.conf.xml conf\autoload_configs\sofia.conf.xml = conf\autoload_configs\sofia.conf.xml conf\autoload_configs\spidermonkey.conf.xml = conf\autoload_configs\spidermonkey.conf.xml + conf\autoload_configs\switch.conf.xml = conf\autoload_configs\switch.conf.xml conf\autoload_configs\syslog.conf.xml = conf\autoload_configs\syslog.conf.xml conf\autoload_configs\voicemail.conf.xml = conf\autoload_configs\voicemail.conf.xml conf\autoload_configs\wanpipe.conf.xml = conf\autoload_configs\wanpipe.conf.xml @@ -119,6 +123,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sip_profiles", "sip_profiles", "{8E2E8798-8B6F-4A55-8E4F-4E6FDE40ED26}" ProjectSection(SolutionItems) = preProject conf\sip_profiles\external.xml = conf\sip_profiles\external.xml + conf\sip_profiles\internal.xml = conf\sip_profiles\internal.xml conf\sip_profiles\nat.xml = conf\sip_profiles\nat.xml EndProjectSection EndProject @@ -207,6 +212,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "autoload_configs", "autoloa EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dialplan", "dialplan", "{D44DD429-FE98-42AA-B5B7-4B4EBE33AEFD}" ProjectSection(SolutionItems) = preProject + debug\conf\dialplan\default.xml = debug\conf\dialplan\default.xml debug\conf\dialplan\US.conf.xml = debug\conf\dialplan\US.conf.xml EndProjectSection EndProject @@ -2207,10 +2213,12 @@ Global {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.All|x64.ActiveCfg = Release|Any CPU {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|Win32.ActiveCfg = Debug|Any CPU {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|Win32.Build.0 = Debug|Any CPU - {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x64.ActiveCfg = Debug|Any CPU + {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x64.ActiveCfg = Debug|x64 + {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x64.Build.0 = Debug|x64 {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|Win32.ActiveCfg = Release|Any CPU {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|Win32.Build.0 = Release|Any CPU - {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x64.ActiveCfg = Release|Any CPU + {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x64.ActiveCfg = Release|x64 + {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x64.Build.0 = Release|x64 {E796E337-DE78-4303-8614-9A590862EE95}.All|Win32.ActiveCfg = Release|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.All|Win32.Build.0 = Release|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.All|x64.ActiveCfg = Release|Win32 diff --git a/build/modules.conf.in b/build/modules.conf.in index 87b4718..37244a1 100644 --- a/build/modules.conf.in +++ b/build/modules.conf.in @@ -63,7 +63,7 @@ endpoints/mod_loopback #endpoints/mod_skypopen #endpoints/mod_h323 #../../libs/openzap/mod_openzap -../../libs/freetdm/mod_freetdm +#../../libs/freetdm/mod_freetdm #asr_tts/mod_unimrcp #asr_tts/mod_flite #asr_tts/mod_pocketsphinx commit 4eef1522502d3b510b22e96bd76612290336f5f9 Merge: 7bd0a5a 8d66f38 Author: Moises Silva <moy@sangoma.com> Date: Tue Nov 9 13:40:46 2010 -0500 Merge remote branch 'smgfs/master' commit 8d66f382129d7fa041a41f3c6d6d8a4d110a5771 Merge: 6335990 dd4fb5b Author: Moises Silva <moy@sangoma.com> Date: Tue Nov 9 12:59:48 2010 -0500 Merge branch 'master' of git://git.freeswitch.org/freeswitch Conflicts: conf/autoload_configs/modules.conf.xml libs/freetdm/src/ftdm_sched.c libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c commit 7bd0a5a63d353c77c2ecfc2921af0cf956bcc043 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Nov 9 11:53:01 2010 -0600 FS-2833 diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 6c43f25..ba4b6d3 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -4324,7 +4324,7 @@ SWITCH_STANDARD_API(uuid_loglevel) #define SQL_ESCAPE_SYNTAX "<string>" SWITCH_STANDARD_API(sql_escape) { - if (zstr(cmd)) { + if (!cmd) { stream->write_function(stream, "-USAGE: %s\n", SQL_ESCAPE_SYNTAX); } else { stream->write_function(stream, "%q", cmd); commit 794db40e526a22d8c8f5a4ebf322bf1de2b5d5fa Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Nov 9 11:49:07 2010 -0600 refactor STFU a bit diff --git a/libs/stfu/stfu.c b/libs/stfu/stfu.c index f305a0f..7c30ab2 100644 --- a/libs/stfu/stfu.c +++ b/libs/stfu/stfu.c @@ -38,7 +38,6 @@ struct stfu_queue { uint32_t array_size; uint32_t array_len; uint32_t wr_len; - uint32_t last_index; }; typedef struct stfu_queue stfu_queue_t; @@ -47,10 +46,12 @@ struct stfu_instance { struct stfu_queue b_queue; struct stfu_queue *in_queue; struct stfu_queue *out_queue; - uint32_t last_ts; + struct stfu_frame *last_frame; + uint32_t last_wr_ts; + uint32_t last_rd_ts; uint32_t interval; uint32_t miss_count; - uint8_t running; + uint32_t max_plc; }; @@ -112,7 +113,7 @@ stfu_status_t stfu_n_resize(stfu_instance_t *i, uint32_t qlen) return s; } -stfu_instance_t *stfu_n_init(uint32_t qlen) +stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_plc) { struct stfu_instance *i; @@ -125,6 +126,13 @@ stfu_instance_t *stfu_n_init(uint32_t qlen) stfu_n_init_aqueue(&i->b_queue, qlen); i->in_queue = &i->a_queue; i->out_queue = &i->b_queue; + + if (max_plc) { + i->max_plc = max_plc; + } else { + i->max_plc = qlen / 2; + } + return i; } @@ -135,10 +143,9 @@ void stfu_n_reset(stfu_instance_t *i) i->in_queue->array_len = 0; i->out_queue->array_len = 0; i->out_queue->wr_len = 0; - i->out_queue->last_index = 0; + i->last_frame = NULL; i->miss_count = 0; - i->last_ts = 0; - i->running = 0; + i->last_wr_ts = 0; i->miss_count = 0; i->interval = 0; } @@ -197,7 +204,7 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void i->in_queue->array_len = 0; i->out_queue->wr_len = 0; - i->out_queue->last_index = 0; + i->last_frame = NULL; i->miss_count = 0; if (stfu_n_process(i, i->out_queue) < 0) { @@ -222,6 +229,8 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void cplen = sizeof(frame->data); } + i->last_rd_ts = ts; + memcpy(frame->data, data, cplen); frame->pt = pt; frame->ts = ts; @@ -231,88 +240,71 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void return STFU_IT_WORKED; } +static int stfu_n_find_frame(stfu_queue_t *queue, uint32_t ts, stfu_frame_t **r_frame, uint32_t *index) +{ + uint32_t i = 0; + stfu_frame_t *frame = NULL; + + assert(r_frame); + assert(index); + + *r_frame = NULL; + + for(i = 0; i < queue->array_len; i++) { + frame = &queue->array[i]; + + if (frame->ts == ts) { + *r_frame = frame; + *index = i; + frame->was_read = 1; + return 1; + } + } + + return 0; +} + stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i) { - uint32_t index, index2; + uint32_t index; uint32_t should_have = 0; - stfu_frame_t *frame = NULL, *rframe = NULL; + stfu_frame_t *rframe = NULL; if (((i->out_queue->wr_len == i->out_queue->array_len) || !i->out_queue->array_len)) { return NULL; } - if (i->running) { - should_have = i->last_ts + i->interval; + if (i->last_wr_ts) { + should_have = i->last_wr_ts + i->interval; } else { should_have = i->out_queue->array[0].ts; } - for(index = 0; index < i->out_queue->array_len; index++) { - if (i->out_queue->array[index].was_read) { - continue; - } - - frame = &i->out_queue->array[index]; - - if (frame->ts != should_have) { - unsigned int tried = 0; - for (index2 = 0; index2 < i->out_queue->array_len; index2++) { - if (i->out_queue->array[index2].was_read) { - continue; - } - tried++; - if (i->out_queue->array[index2].ts == should_have) { - rframe = &i->out_queue->array[index2]; - i->out_queue->last_index = index2; - goto done; - } - } - for (index2 = 0; index2 < i->in_queue->array_len; index2++) { - if (i->in_queue->array[index2].was_read) { - continue; - } - tried++; - if (i->in_queue->array[index2].ts == should_have) { - rframe = &i->in_queue->array[index2]; - goto done; - } - } - - i->miss_count++; - - if (i->miss_count > 10 || (i->in_queue->array_len == i->in_queue->array_size) || - tried >= (i->in_queue->array_size + i->out_queue->array_size)) { - i->running = 0; - i->interval = 0; - i->out_queue->wr_len = i->out_queue->array_size; - return NULL; - } - - i->last_ts = should_have; - rframe = &i->out_queue->int_frame; - rframe->dlen = i->out_queue->array[i->out_queue->last_index].dlen; - /* poor man's plc.. Copy the last frame, but we flag it so you can use a better one if you wish */ - memcpy(rframe->data, i->out_queue->array[i->out_queue->last_index].data, rframe->dlen); - rframe->ts = should_have; - i->out_queue->wr_len++; - i->running = 1; - return rframe; - } else { - rframe = &i->out_queue->array[index]; - i->out_queue->last_index = index; - goto done; - } - } - -done: - - if (rframe) { + if (stfu_n_find_frame(i->out_queue, should_have, &rframe, &index) || stfu_n_find_frame(i->in_queue, should_have, &rframe, &index)) { + i->last_frame = rframe; i->out_queue->wr_len++; - i->last_ts = rframe->ts; + i->last_wr_ts = rframe->ts; rframe->was_read = 1; - i->running = 1; i->miss_count = 0; - } + } else { + i->last_wr_ts = should_have; + rframe = &i->out_queue->int_frame; + + if (i->last_frame && i->last_frame != rframe) { + rframe->dlen = i->last_frame->dlen; + /* poor man's plc.. Copy the last frame, but we flag it so you can use a better one if you wish */ + memcpy(rframe->data, i->last_frame->data, rframe->dlen); + } + + rframe->ts = should_have; + + if (++i->miss_count > i->max_plc) { + i->interval = 0; + i->out_queue->wr_len = i->out_queue->array_size; + i->last_wr_ts = 0; + rframe = NULL; + } + } return rframe; } diff --git a/libs/stfu/stfu.h b/libs/stfu/stfu.h index 17f01e3..900db6f 100644 --- a/libs/stfu/stfu.h +++ b/libs/stfu/stfu.h @@ -96,7 +96,7 @@ typedef struct { void stfu_n_report(stfu_instance_t *i, stfu_report_t *r); void stfu_n_destroy(stfu_instance_t **i); -stfu_instance_t *stfu_n_init(uint32_t qlen); +stfu_instance_t *stfu_n_init(uint32_t qlen, uint32_t max_plc); stfu_status_t stfu_n_resize(stfu_instance_t *i, uint32_t qlen); stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void *data, size_t datalen, int last); stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i); diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 744072c..948401e 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -2190,7 +2190,7 @@ SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint3 qlen = delay_ms / (interval); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Setting delay to %dms (%d frames)\n", delay_ms, qlen); - jb = stfu_n_init(qlen); + jb = stfu_n_init(qlen, 0); write_frame.codec = switch_core_session_get_read_codec(session); diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 6a2fa51..1792de0 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1616,7 +1616,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_stun_ping(switch_rtp_t *rtp_ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t *rtp_session, uint32_t queue_frames) { - rtp_session->jb = stfu_n_init(queue_frames); + rtp_session->jb = stfu_n_init(queue_frames, 0); return SWITCH_STATUS_SUCCESS; } commit 633599021a71f2e61646200c69a9713dae369a9a Author: Moises Silva <moy@sangoma.com> Date: Tue Nov 9 12:22:53 2010 -0500 freetdm: minor changes to ftmod_r2 diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 56c0bc6..0866561 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -403,6 +403,7 @@ static void ftdm_r2_on_call_init(openr2_chan_t *r2chan) if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)) { ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Cannot start call when channel is in use (state = %s)\n", ftdm_channel_state2str(ftdmchan->state)); ftdm_mutex_unlock(ftdmchan->mutex); + return; } if (ftdmchan->state != FTDM_CHANNEL_STATE_DOWN) { @@ -436,9 +437,6 @@ static void ftdm_r2_on_call_init(openr2_chan_t *r2chan) ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); ftdm_mutex_unlock(ftdmchan->mutex); - - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Span is not threaded, not launching thread for this call\n"); - return; } /* only called for incoming calls when the ANI, DNIS etc is complete and the user has to decide either to accept or reject the call */ @@ -447,9 +445,7 @@ static void ftdm_r2_on_call_offered(openr2_chan_t *r2chan, const char *ani, cons ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Call offered with ANI = %s, DNIS = %s, Priority = (%d)\n", ani, dnis, category); - //ftdmchan->caller_data.priority = category; ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RING); - } static void ftdm_r2_on_call_accepted(openr2_chan_t *r2chan, openr2_call_mode_t mode) @@ -602,8 +598,8 @@ static void ftdm_r2_on_line_idle(openr2_chan_t *r2chan) ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Far end unblocked in state %s\n", ftdm_channel_state2str(ftdmchan->state)); ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_SUSPENDED); - /* XXX when should we set/unset this flag? XXX */ - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_SIG_UP); + /* XXX when should we set/unset this flag? XXX */ + ftdm_set_flag(ftdmchan, FTDM_CHANNEL_SIG_UP); } static void ftdm_r2_write_log(openr2_log_level_t level, const char *file, const char *function, int line, const char *message) @@ -1116,7 +1112,7 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_r2_configure_span) memset(r2call, 0, sizeof(*r2call)); openr2_chan_set_logging_func(r2chan, ftdm_r2_on_chan_log); openr2_chan_set_client_data(r2chan, span->channels[i]); - r2call->r2chan = r2chan; + r2call->r2chan = r2chan; span->channels[i]->call_data = r2call; /* value and key are the same so just free one of them */ snprintf(r2call->name, sizeof(r2call->name), "chancall%d", i); @@ -1331,8 +1327,8 @@ static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) { openr2_chan_t *r2chan; - ftdm_r2_call_t *r2call = NULL; - ftdm_channel_t *ftdmchan = NULL; + ftdm_r2_call_t *r2call = NULL; + ftdm_channel_t *ftdmchan = NULL; ftdm_status_t status; ftdm_span_t *span = (ftdm_span_t *) obj; ftdm_r2_data_t *r2data = span->signal_data; @@ -1368,16 +1364,14 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) } #ifndef WIN32 - /* figure out what event to poll each channel for. POLLPRI when the channel is down, - * POLLPRI|POLLIN|POLLOUT otherwise. - */ - memset(poll_events, 0, sizeof(short)*span->chan_count); - for (i = 0; i < span->chan_count; i++) { - r2chan = R2CALL(span->channels[(i+1)])->r2chan; - ftdmchan = openr2_chan_get_client_data(r2chan); - - poll_events[i] = ftdmchan->state == FTDM_CHANNEL_STATE_DOWN ? POLLPRI : (POLLPRI | POLLIN | POLLOUT); - } + /* figure out what event to poll each channel for. POLLPRI when the channel is down, + * POLLPRI|POLLIN|POLLOUT otherwise */ + memset(poll_events, 0, sizeof(short)*span->chan_count); + for (i = 0; i < span->chan_count; i++) { + r2chan = R2CALL(span->channels[(i+1)])->r2chan; + ftdmchan = openr2_chan_get_client_data(r2chan); + poll_events[i] = ftdmchan->state == FTDM_CHANNEL_STATE_DOWN ? POLLPRI : (POLLPRI | POLLIN | POLLOUT); + } status = ftdm_span_poll_event(span, waitms, poll_events); #else @@ -1394,62 +1388,61 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) continue; } - if (FTDM_SUCCESS == status) { + if (FTDM_SUCCESS == status) { ftdm_event_t *event; while (ftdm_span_next_event(span, &event) == FTDM_SUCCESS) { if (event->enum_id == FTDM_OOB_CAS_BITS_CHANGE) { - r2call = R2CALL(event->channel); - r2chan = r2call->r2chan; + r2call = R2CALL(event->channel); + r2chan = r2call->r2chan; ftdm_log(FTDM_LOG_DEBUG, "Handling CAS on channel %d.\n", openr2_chan_get_number(r2chan)); // we only expect CAS and other OOB events on this thread/loop, once a call is started // the MF events (in-band signaling) are handled in the call thread openr2_chan_process_cas_signaling(r2chan); - } else { ftdm_log(FTDM_LOG_DEBUG, "Ignoring event %d on channel %d.\n", event->enum_id, openr2_chan_get_number(r2chan)); // XXX TODO: handle alarms here XXX } } - /* XXX - * when ftdm_span_poll_event() returns FTDM_SUCCESS, means there are events pending on the span. - * is it possible to know on which channels those events are pending, without trasvering the span? - * XXX - */ - for (i = 1; i <= span->chan_count; i++) { - r2chan = R2CALL(span->channels[i])->r2chan; - ftdmchan = openr2_chan_get_client_data(r2chan); - r2call = R2CALL(ftdmchan); - - ftdm_mutex_lock(ftdmchan->mutex); - ftdm_set_flag(r2call, FTDM_R2_PROCESSING); - - if (ftdm_r2_state_advance(ftdmchan)) { - ftdm_clear_flag(r2call, FTDM_R2_PROCESSING); - ftdm_mutex_unlock(ftdmchan->mutex); - continue; - } - - /* handle timeout events first if any */ - openr2_chan_run_schedule(r2chan); - - /* process mf tones, if any */ - if (openr2_chan_get_read_enabled(r2chan)) - openr2_chan_process_mf_signaling(r2chan); - - if (ftdm_r2_state_advance(ftdmchan)) { - ftdm_clear_flag(r2call, FTDM_R2_PROCESSING); - ftdm_mutex_unlock(ftdmchan->mutex); - continue; - } - - ftdm_clear_flag(r2call, FTDM_R2_PROCESSING); - ftdm_mutex_unlock(ftdmchan->mutex); - } + /* XXX + * when ftdm_span_poll_event() returns FTDM_SUCCESS, means there are events pending on the span. + * is it possible to know on which channels those events are pending, without traversing the span? + * XXX */ + for (i = 1; i <= span->chan_count; i++) { + r2chan = R2CALL(span->channels[i])->r2chan; + ftdmchan = openr2_chan_get_client_data(r2chan); + r2call = R2CALL(ftdmchan); + + ftdm_mutex_lock(ftdmchan->mutex); + ftdm_set_flag(r2call, FTDM_R2_PROCESSING); + + if (ftdm_r2_state_advance(ftdmchan)) { + ftdm_clear_flag(r2call, FTDM_R2_PROCESSING); + ftdm_mutex_unlock(ftdmchan->mutex); + continue; + } + + /* handle timeout events first if any */ + openr2_chan_run_schedule(r2chan); + + /* process mf tones, if any */ + if (openr2_chan_get_read_enabled(r2chan)) { + openr2_chan_process_mf_signaling(r2chan); + } + + if (ftdm_r2_state_advance(ftdmchan)) { + ftdm_clear_flag(r2call, FTDM_R2_PROCESSING); + ftdm_mutex_unlock(ftdmchan->mutex); + continue; + } + + ftdm_clear_flag(r2call, FTDM_R2_PROCESSING); + ftdm_mutex_unlock(ftdmchan->mutex); + } } else if (status != FTDM_TIMEOUT) { ftdm_log(FTDM_LOG_ERROR, "ftdm_span_poll_event returned %d.\n", status); - } + } ftdm_sleep(20); } commit dd4fb5bee5641fd2ce5da04979240cc7cff2fc9e Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Nov 9 10:30:06 2010 -0600 add default_lag to fifo diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 8641e29..3943ac6 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -309,6 +309,7 @@ struct fifo_node { char *outbound_name; outbound_strategy_t outbound_strategy; int ring_timeout; + int default_lag; }; typedef struct fifo_node fifo_node_t; @@ -3519,6 +3520,12 @@ static void list_node(fifo_node_t *node, switch_xml_t x_report, int *off, int ve switch_snprintf(tmp, sizeof(buffer), "%u", node->outbound_per_cycle); switch_xml_set_attr_d(x_fifo, "outbound_per_cycle", tmp); + switch_snprintf(tmp, sizeof(buffer), "%u", node->ring_timeout); + switch_xml_set_attr_d(x_fifo, "ring_timeout", tmp); + + switch_snprintf(tmp, sizeof(buffer), "%u", node->default_lag); + switch_xml_set_attr_d(x_fifo, "default_lag", tmp); + switch_snprintf(tmp, sizeof(buffer), "%u", node->outbound_priority); switch_xml_set_attr_d(x_fifo, "outbound_priority", tmp); @@ -3930,6 +3937,7 @@ static switch_status_t load_config(int reload, int del_all) int timeout_i = 60; int lag_i = 10; int ring_timeout = 60; + int default_lag = 30; name = switch_xml_attr(fifo, "name"); @@ -3992,11 +4000,20 @@ static switch_status_t load_config(int reload, int del_all) } } + if ((val = switch_xml_attr(fifo, "outbound_default_lag"))) { + int tmp = atoi(val); + if (tmp > 10) { + default_lag = tmp; + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Invalid default_lag: must be > 10 for queue %s\n", node->name); + } + } + node->ring_timeout = ring_timeout; node->outbound_per_cycle = outbound_per_cycle; node->outbound_priority = outbound_priority; + node->default_lag = default_lag; - if (outbound_strategy) { node->outbound_strategy = parse_strat(outbound_strategy); node->has_outbound = 1; @@ -4028,14 +4045,14 @@ static switch_status_t load_config(int reload, int del_all) if (timeout) { if ((timeout_i = atoi(timeout)) < 10) { - timeout_i = 60; + timeout_i = ring_timeout; } } if (lag) { if ((lag_i = atoi(lag)) < 0) { - lag_i = 10; + lag_i = default_lag; } } commit 3885eea76520bb3cf293e4419889db86be45c313 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Nov 9 09:46:03 2010 -0600 add outbound_ring_timeout param to mod_fifo diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 33697a0..8641e29 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -308,6 +308,7 @@ struct fifo_node { int outbound_per_cycle; char *outbound_name; outbound_strategy_t outbound_strategy; + int ring_timeout; }; typedef struct fifo_node fifo_node_t; @@ -1213,7 +1214,7 @@ static void *SWITCH_THREAD_FUNC ringall_thread_run(switch_thread_t *thread, void switch_event_create_brackets(h->originate_string, '{', '}', ',', &ovars, &parsed); switch_event_del_header(ovars, "fifo_outbound_uuid"); - if (!h->timeout) h->timeout = 60; + if (!h->timeout) h->timeout = node->ring_timeout; if (timeout < h->timeout) timeout = h->timeout; stream.write_function(&stream, "[leg_timeout=%d,fifo_outbound_uuid=%s,fifo_name=%s]%s,", @@ -3928,6 +3929,7 @@ static switch_status_t load_config(int reload, int del_all) int taking_calls_i = 1; int timeout_i = 60; int lag_i = 10; + int ring_timeout = 60; name = switch_xml_attr(fifo, "name"); @@ -3981,7 +3983,16 @@ static switch_status_t load_config(int reload, int del_all) node->has_outbound = 1; } - + if ((val = switch_xml_attr(fifo, "outbound_ring_timeout"))) { + int tmp = atoi(val); + if (tmp > 10) { + ring_timeout = tmp; + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Invalid ring_timeout: must be > 10 for queue %s\n", node->name); + } + } + + node->ring_timeout = ring_timeout; node->outbound_per_cycle = outbound_per_cycle; node->outbound_priority = outbound_priority; commit ff7a617098756610f3e5564d04affc8d48b4652f Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Tue Nov 9 15:51:30 2010 +0100 ftmod_libpri: Bail out with an error message if libpri is too old and selected trunk type is BRI or BRI_PTMP Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index b714b35..af5ab5f 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -1606,9 +1606,14 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) memset(isdn_data, 0, sizeof(*isdn_data)); switch (ftdm_span_get_trunk_type(span)) { - case FTDM_TRUNK_E1: case FTDM_TRUNK_BRI: case FTDM_TRUNK_BRI_PTMP: +#ifndef HAVE_LIBPRI_BRI + ftdm_log(FTDM_LOG_ERROR, "Unsupported trunk type: '%s', libpri too old\n", ftdm_trunk_type2str(ftdm_span_get_trunk_type(span))); + snprintf(span->last_error, sizeof(span->last_error), "Unsupported trunk type [%s], libpri too old", ftdm_trunk_type2str(ftdm_span_get_trunk_type(span))); + return FTDM_FAIL; +#endif + case FTDM_TRUNK_E1: ftdm_log(FTDM_LOG_NOTICE, "Setting default Layer 1 to ALAW since this is an E1/BRI/BRI PTMP trunk\n"); isdn_data->l1 = PRI_LAYER_1_ALAW; break; commit 648eb58fc18c12d29648456a92911a6e905b31c0 Merge: b368694 49b6237 Author: David Yat Sin <dyatsin@sangoma.com> Date: Mon Nov 8 16:13:25 2010 -0500 Merge branch 'master' of git.freeswitch.org:freeswitch commit b36869498f392044859d864ef5973ec496e4851c Author: David Yat Sin <dyatsin@sangoma.com> Date: Mon Nov 8 16:11:06 2010 -0500 freetdm: Fix for ftmod_wanpipe failing to compile because some structures are not compatible with std=c99 diff --git a/libs/freetdm/Makefile.am b/libs/freetdm/Makefile.am index 2177a96..bc92e1d 100644 --- a/libs/freetdm/Makefile.am +++ b/libs/freetdm/Makefile.am @@ -49,6 +49,7 @@ if HAVE_SNG_ISDN INCS += -I/usr/include/sng_isdn endif +FTDM_COMPAT_CFLAGS = $(INCS) -DFTDM_CONFIG_DIR=\"@confdir@\" -DFTDM_MOD_DIR=\"$(moddir)\" @COMP_VENDOR_COMPAT_CFLAGS@ @DEFS@ FTDM_CFLAGS = $(INCS) -DFTDM_CONFIG_DIR=\"@confdir@\" -DFTDM_MOD_DIR=\"$(moddir)\" @COMP_VENDOR_CFLAGS@ @DEFS@ COMPILE = $(CC) $(FTDM_CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(COMPILE) @@ -186,7 +187,9 @@ ftmod_analog_em_la_LIBADD = libfreetdm.la if HAVE_LIBSANGOMA mod_LTLIBRARIES += ftmod_wanpipe.la ftmod_wanpipe_la_SOURCES = $(SRC)/ftmod/ftmod_wanpipe/ftmod_wanpipe.c -ftmod_wanpipe_la_CFLAGS = $(AM_CFLAGS) $(FTDM_CFLAGS) -D__LINUX__ -I/usr/include/wanpipe +#some structures within Wanpipe drivers are not c99 compatible, so we need to compile ftmod_wanpipe +#without c99 flags +ftmod_wanpipe_la_CFLAGS = $(AM_CFLAGS) $(FTDM_COMPAT_CFLAGS) -D__LINUX__ -I/usr/include/wanpipe ftmod_wanpipe_la_LDFLAGS = -shared -module -avoid-version -lsangoma ftmod_wanpipe_la_LIBADD = libfreetdm.la endif diff --git a/libs/freetdm/configure.ac b/libs/freetdm/configure.ac index 2b5ded8..8b878ed 100644 --- a/libs/freetdm/configure.ac +++ b/libs/freetdm/configure.ac @@ -77,11 +77,14 @@ sun) fi ;; *) - COMP_VENDOR_CFLAGS="-std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes" + COMP_VENDOR_COMPAT_CFLAGS="-Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes" + COMP_VENDOR_CFLAGS="-std=c99 $COMP_VENDOR_COMPAT_CFLAGS" ;; esac +AC_SUBST([COMP_VENDOR_COMPAT_CFLAGS]) AC_SUBST([COMP_VENDOR_CFLAGS]) + # Enable debugging AC_ARG_ENABLE([debug], [AC_HELP_STRING([--enable-debug], [build with debug information])], commit 49b6237ed2dc0b536ffd8114e0c5f233e133e3ff Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Nov 8 15:04:51 2010 -0600 avoid hypothetical problem with flushing queue with delayed events diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 1589beb..b3bb638 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -790,10 +790,17 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_message(switch_core_ SWITCH_DECLARE(switch_status_t) switch_core_session_flush_message(switch_core_session_t *session) { + switch_status_t status = SWITCH_STATUS_FALSE; + void *pop; switch_core_session_message_t *message; - while (switch_core_session_dequeue_message(session, &message) == SWITCH_STATUS_SUCCESS) { - switch_core_session_free_message(&message); + switch_assert(session != NULL); + + if (session->message_queue) { + while ((status = (switch_status_t) switch_queue_trypop(session->message_queue, &pop)) == SWITCH_STATUS_SUCCESS) { + message = (switch_core_session_message_t *) pop; + switch_core_session_free_message(&message); + } } return SWITCH_STATUS_SUCCESS; commit f53ce50a4caca7e5e63fa4cc4bf376fd2cb77fd6 Merge: 0a8c1a0 5875905 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Mon Nov 8 20:57:47 2010 +0100 Merge branch 'master' of ssh://git.freeswitch.org/freeswitch commit 0a8c1a04c48f409e827b80ccb8ea562bdca8a9fb Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Mon Nov 8 20:57:21 2010 +0100 ftmod_libpri: Minor cleanups. Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c b/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c index 317c9a5..de4fa2b 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c @@ -35,8 +35,8 @@ #include "private/ftdm_core.h" #include "lpwrap_pri.h" -#ifndef HAVE_GETTIMEOFDAY +#ifndef HAVE_GETTIMEOFDAY #ifdef WIN32 #include <mmsystem.h> @@ -239,8 +239,8 @@ int lpwrap_init_bri(struct lpwrap_pri *spri, ftdm_span_t *span, ftdm_channel_t * int lpwrap_one_loop(struct lpwrap_pri *spri) { fd_set rfds, efds; - struct timeval now = {0,0}, *next; - pri_event *event; + struct timeval now = {0,0}, *next = NULL; + pri_event *event = NULL; event_handler handler; int sel; commit adc26e63165aa22f8ddc580d7462703e67e0ee1b Author: David Yat Sin <dyatsin@sangoma.com> Date: Mon Nov 8 12:30:12 2010 -0500 Fixed compile error diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 396d347..22c89cb 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -300,7 +300,7 @@ static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj) } /* Poll for events, e.g HW DTMF */ - ret_status = ftdm_span_poll_event(span, 0); + ret_status = ftdm_span_poll_event(span, 0, NULL); switch(ret_status) { case FTDM_SUCCESS: { commit 25c56f6dc9eaa46a6c5b33f357b618f596bc905b Author: David Yat Sin <dyatsin@sangoma.com> Date: Mon Nov 1 12:24:11 2010 -0200 freetdm: Merged arnaldo.sng_isdn branch (changes for win32 port) diff --git a/Freeswitch.2008.sln b/Freeswitch.2008.sln index 8e6df5c..5e27743 100644 --- a/Freeswitch.2008.sln +++ b/Freeswitch.2008.sln @@ -48,7 +48,6 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Debug", "Debug", "{6374D55C-FABE-4A02-9CF1-4145308A56C5}" ProjectSection(SolutionItems) = preProject debug\conf\freeswitch.xml = debug\conf\freeswitch.xml - debug\conf\vars.xml = debug\conf\vars.xml EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Build System", "_Build System", "{DB1024A8-41BF-4AD7-9AE6-13202230D1F3}" @@ -59,7 +58,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Build System", "_Build Sys configure.in = configure.in Makefile.am = Makefile.am build\modmake.rules.in = build\modmake.rules.in - build\modules.conf.in = build\modules.conf.in libs\win32\util.vbs = libs\win32\util.vbs EndProjectSection EndProject @@ -92,13 +90,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "autoload_configs", "autoloa conf\autoload_configs\limit.conf.xml = conf\autoload_configs\limit.conf.xml conf\autoload_configs\local_stream.conf.xml = conf\autoload_configs\local_stream.conf.xml conf\autoload_configs\logfile.conf.xml = conf\autoload_configs\logfile.conf.xml - conf\autoload_configs\modules.conf.xml = conf\autoload_configs\modules.conf.xml conf\autoload_configs\openmrcp.conf.xml = conf\autoload_configs\openmrcp.conf.xml conf\autoload_configs\portaudio.conf.xml = conf\autoload_configs\portaudio.conf.xml conf\autoload_configs\rss.conf.xml = conf\autoload_configs\rss.conf.xml conf\autoload_configs\sofia.conf.xml = conf\autoload_configs\sofia.conf.xml conf\autoload_configs\spidermonkey.conf.xml = conf\autoload_configs\spidermonkey.conf.xml - conf\autoload_configs\switch.conf.xml = conf\autoload_configs\switch.conf.xml conf\autoload_configs\syslog.conf.xml = conf\autoload_configs\syslog.conf.xml conf\autoload_configs\voicemail.conf.xml = conf\autoload_configs\voicemail.conf.xml conf\autoload_configs\wanpipe.conf.xml = conf\autoload_configs\wanpipe.conf.xml @@ -123,7 +119,6 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sip_profiles", "sip_profiles", "{8E2E8798-8B6F-4A55-8E4F-4E6FDE40ED26}" ProjectSection(SolutionItems) = preProject conf\sip_profiles\external.xml = conf\sip_profiles\external.xml - conf\sip_profiles\internal.xml = conf\sip_profiles\internal.xml conf\sip_profiles\nat.xml = conf\sip_profiles\nat.xml EndProjectSection EndProject @@ -212,7 +207,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "autoload_configs", "autoloa EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dialplan", "dialplan", "{D44DD429-FE98-42AA-B5B7-4B4EBE33AEFD}" ProjectSection(SolutionItems) = preProject - debug\conf\dialplan\default.xml = debug\conf\dialplan\default.xml debug\conf\dialplan\US.conf.xml = debug\conf\dialplan\US.conf.xml EndProjectSection EndProject @@ -2213,12 +2207,10 @@ Global {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.All|x64.ActiveCfg = Release|Any CPU {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|Win32.ActiveCfg = Debug|Any CPU {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|Win32.Build.0 = Debug|Any CPU - {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x64.ActiveCfg = Debug|x64 - {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x64.Build.0 = Debug|x64 + {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x64.ActiveCfg = Debug|Any CPU {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|Win32.ActiveCfg = Release|Any CPU {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|Win32.Build.0 = Release|Any CPU - {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x64.ActiveCfg = Release|x64 - {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x64.Build.0 = Release|x64 + {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x64.ActiveCfg = Release|Any CPU {E796E337-DE78-4303-8614-9A590862EE95}.All|Win32.ActiveCfg = Release|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.All|Win32.Build.0 = Release|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.All|x64.ActiveCfg = Release|Win32 diff --git a/build/modules.conf.in b/build/modules.conf.in index 67e1fe6..35ec1bb 100644 --- a/build/modules.conf.in +++ b/build/modules.conf.in @@ -63,7 +63,7 @@ endpoints/mod_loopback #endpoints/mod_skypopen #endpoints/mod_h323 #../../libs/openzap/mod_openzap -#../../libs/freetdm/mod_freetdm +../../libs/freetdm/mod_freetdm #asr_tts/mod_unimrcp #asr_tts/mod_flite #asr_tts/mod_pocketsphinx diff --git a/conf/autoload_configs/modules.conf.xml b/conf/autoload_configs/modules.conf.xml index d8ae5e1..37e1b2f 100644 --- a/conf/autoload_configs/modules.conf.xml +++ b/conf/autoload_configs/modules.conf.xml @@ -1,112 +1,15 @@ <configuration name="modules.conf" description="Modules"> <modules> - <!-- Loggers (I'd load these first) --> <load module="mod_console"/> <load module="mod_logfile"/> - <!-- <load module="mod_syslog"/> --> - - <!--<load module="mod_yaml"/>--> - - <!-- Multi-Faceted --> - <!-- mod_enum is a dialplan interface, an application interface and an api command interface --> - <load module="mod_enum"/> - - <!-- XML Interfaces --> - <!-- <load module="mod_xml_rpc"/> --> - <!-- <load module="mod_xml_curl"/> --> - <!-- <load module="mod_xml_cdr"/> --> - - <!-- Event Handlers --> - <load module="mod_cdr_csv"/> - <!-- <load module="mod_event_multicast"/> --> <load module="mod_event_socket"/> - <!-- <load module="mod_zeroconf"/> --> - <!-- <load module="mod_erlang_event"/> --> - - <!-- Directory Interfaces --> - <!-- <load module="mod_ldap"/> --> - - <!-- Endpoints --> - <!-- <load module="mod_dingaling"/> --> - <!-- <load module="mod_portaudio"/> --> - <!-- <load module="mod_alsa"/> --> <load module="mod_sofia"/> - <load module="mod_loopback"/> - <!-- <load module="mod_woomera"/> --> - <!-- <load module="mod_openzap"/> --> - <!-- <load module="mod_unicall"/> --> - <!-- <load module="mod_skinny"/> --> - - <!-- Applications --> <load module="mod_commands"/> - <load module="mod_conference"/> - <load module="mod_db"/> <load module="mod_dptools"/> <load module="mod_expr"/> - <load module="mod_fifo"/> - <load module="mod_hash"/> - <load module="mod_voicemail"/> - <!--<load module="mod_directory"/>--> - <!--<load module="mod_lcr"/>--> - <load module="mod_esf"/> - <load module="mod_fsv"/> - <load module="mod_cluechoo"/> - <load module="mod_valet_parking"/> - <!--<load module="mod_spy"/>--> - - <!-- SNOM Module --> - <!--<load module="mod_snom"/>--> - - <!-- Dialplan Interfaces --> - <!-- <load module="mod_dialplan_directory"/> --> <load module="mod_dialplan_xml"/> - <load module="mod_dialplan_asterisk"/> - - <!-- Codec Interfaces --> - <load module="mod_spandsp"/> - <load module="mod_g723_1"/> - <load module="mod_g729"/> - <load module="mod_amr"/> - <load module="mod_ilbc"/> - <load module="mod_speex"/> - <load module="mod_h26x"/> - <load module="mod_siren"/> - <!--<load module="mod_celt"/>--> - - <!-- File Format Interfaces --> <load module="mod_sndfile"/> <load module="mod_native_file"/> - <!--For icecast/mp3 streams/files--> - <!--<load module="mod_shout"/>--> - <!--For local streams (play all the files in a directory)--> - <load module="mod_local_stream"/> - <load module="mod_tone_stream"/> - <load module="mod_file_string"/> - - <!-- Timers --> - - <!-- Languages --> - <load module="mod_spidermonkey"/> - <!-- <load module="mod_perl"/> --> - <!-- <load module="mod_python"/> --> - <!-- <load module="mod_java"/> --> - <load module="mod_lua"/> - - <!-- ASR /TTS --> - <!-- <load module="mod_flite"/> --> - <!-- <load module="mod_pocketsphinx"/> --> - <!-- <load module="mod_cepstral"/> --> - <!-- <load module="mod_tts_commandline"/> --> - <!-- <load module="mod_rss"/> --> - - <!-- Say --> - <load module="mod_say_en"/> - <load module="mod_say_ru"/> - <!-- <load module="mod_say_zh"/> --> - - <!-- Third party modules --> - <!--<load module="mod_nibblebill"/>--> - </modules> </configuration> diff --git a/libs/freetdm/cyginstall.sh b/libs/freetdm/cyginstall.sh index 93ba624..9d486b7 100644 --- a/libs/freetdm/cyginstall.sh +++ b/libs/freetdm/cyginstall.sh @@ -7,7 +7,7 @@ cp Debug/mod/*.dll $fsdir/Debug/mod/ cp mod_freetdm/Debug/*.pdb $fsdir/Debug/mod/ cp Debug/*.dll $fsdir/Debug/ cp Debug/*.pdb $fsdir/Debug/ -cp Debug/testsangomaboost.exe $fsdir/Debug/ +#cp Debug/testsangomaboost.exe $fsdir/Debug/ echo "FRIENDLY REMINDER: RECOMPILE ftmod_wanpipe WHENEVER YOU INSTALL NEW DRIVERS" set +x diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 8dbbda7..396d347 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -913,7 +913,8 @@ static FIO_SIG_LOAD_FUNCTION(ftdm_sangoma_isdn_init) } /* initalize sng_isdn library */ - sng_isdn_init(&g_sngisdn_event_interface); + + ftdm_assert_return(!sng_isdn_init(&g_sngisdn_event_interface), FTDM_FAIL, "Failed to initialize stack\n"); return FTDM_SUCCESS; } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 7db753e..e84392e 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -266,15 +266,15 @@ extern ftdm_sngisdn_data_t g_sngisdn_data; ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *span); /* Support functions */ -FT_DECLARE_INLINE(uint32_t) get_unique_suInstId(uint8_t cc_id); +FT_DECLARE_INLINE(uint32_t) get_unique_suInstId(int16_t cc_id); FT_DECLARE_INLINE(void) clear_call_data(sngisdn_chan_data_t *sngisdn_info); FT_DECLARE_INLINE(void) clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info); void stack_hdr_init(Header *hdr); void stack_pst_init(Pst *pst); -FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_spInstId(uint8_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data); -FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_suInstId(uint8_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data); +FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_spInstId(int16_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data); +FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_suInstId(int16_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data); FT_DECLARE_INLINE(ftdm_status_t) sng_isdn_set_avail_rate(ftdm_span_t *ftdmspan, sngisdn_avail_t avail); /* Outbound Call Control functions */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c index 5a3e06e..bb46fb7 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c @@ -198,7 +198,7 @@ ftdm_status_t sng_isdn_stack_cfg_phy_psap(ftdm_span_t *span) L1Mngmt cfg; Pst pst; - S32 d_channel_fd = -1; + int32_t d_channel_fd = -1; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; /* initalize the post structure */ @@ -227,7 +227,7 @@ ftdm_status_t sng_isdn_stack_cfg_phy_psap(ftdm_span_t *span) for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { ftdm_channel_t *ftdmchan = (ftdm_channel_t*)ftdm_iterator_current(curr); if (ftdmchan->type == FTDM_CHAN_TYPE_DQ921) { - d_channel_fd = (S32) ftdmchan->sockfd; + d_channel_fd = (int32_t)ftdmchan->sockfd; break; } } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 9adcc08..7ca4085 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -78,7 +78,7 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) break; } - sngisdn_info->suInstId = get_unique_suInstId((int8_t) suId); + sngisdn_info->suInstId = get_unique_suInstId(suId); sngisdn_info->spInstId = spInstId; @@ -205,7 +205,7 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) sngisdn_set_flag(sngisdn_info, FLAG_DELAYED_REL); sngisdn_info->glare.suId = suId; - sngisdn_info->glare.suInstId = get_unique_suInstId((int8_t) suId); + sngisdn_info->glare.suInstId = get_unique_suInstId(suId); sngisdn_info->glare.spInstId = spInstId; sngisdn_info->glare.dChan = dChan; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c index 39c5693..5580f3a 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c @@ -112,7 +112,7 @@ void sngisdn_rcv_con_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, Cn ftdm_assert(g_sngisdn_data.ccs[suId].activation_done != 0, "Con Cfm on unconfigured cc\n"); ftdm_assert(g_sngisdn_data.dchans[dChan].num_spans != 0, "Con Cfm on unconfigured dchan\n"); - if (get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) != FTDM_SUCCESS) { + if (get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); ISDN_FUNC_TRACE_EXIT(__FUNCTION__); return; @@ -156,7 +156,7 @@ void sngisdn_rcv_cnst_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, C ftdm_assert(g_sngisdn_data.ccs[suId].activation_done != 0, "Cnst Ind on unconfigured cc\n"); ftdm_assert(g_sngisdn_data.dchans[dChan].num_spans != 0, "Cnst Ind on unconfigured dchan\n"); - if (get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) != FTDM_SUCCESS) { + if (get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); ISDN_FUNC_TRACE_EXIT(__FUNCTION__); return; @@ -206,8 +206,8 @@ void sngisdn_rcv_disc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, D ftdm_assert(spInstId != 0, "Received DISCONNECT with invalid id"); - if (!(spInstId && get_ftdmchan_by_spInstId((int8_t) suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && - !(suInstId && get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { + if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && + !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); ftdm_assert(0, "Inconsistent call states\n"); @@ -240,8 +240,8 @@ void sngisdn_rcv_rel_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, Re ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - if (!(spInstId && get_ftdmchan_by_spInstId((int8_t) suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && - !(suInstId && get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { + if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && + !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); /* It seems that Trillium has a bug where they sometimes send release twice on a call, so do not crash on these for now */ @@ -274,8 +274,8 @@ void sngisdn_rcv_dat_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, In ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - if (!(spInstId && get_ftdmchan_by_spInstId((int8_t) suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && - !(suInstId && get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { + if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && + !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); ftdm_assert(0, "Inconsistent call states\n"); @@ -307,8 +307,8 @@ void sngisdn_rcv_sshl_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, S ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - if (!(spInstId && get_ftdmchan_by_spInstId((int8_t) suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && - !(suInstId && get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { + if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && + !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); ftdm_assert(0, "Inconsistent call states\n"); @@ -341,8 +341,8 @@ void sngisdn_rcv_sshl_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, S ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - if (!(spInstId && get_ftdmchan_by_spInstId((int8_t) suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && - !(suInstId && get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { + if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && + !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); ftdm_assert(0, "Inconsistent call states\n"); @@ -374,8 +374,8 @@ void sngisdn_rcv_rmrt_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, R ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - if (!(spInstId && get_ftdmchan_by_spInstId((int8_t) suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && - !(suInstId && get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { + if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && + !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); ftdm_assert(0, "Inconsistent call states\n"); @@ -408,8 +408,8 @@ void sngisdn_rcv_rmrt_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, R ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - if (!(spInstId && get_ftdmchan_by_spInstId((int8_t) suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && - !(suInstId && get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { + if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && + !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); ftdm_assert(0, "Inconsistent call states\n"); @@ -442,8 +442,8 @@ void sngisdn_rcv_flc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, St ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - if (!(spInstId && get_ftdmchan_by_spInstId((int8_t) suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && - !(suInstId && get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { + if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && + !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); ftdm_assert(0, "Inconsistent call states\n"); @@ -476,8 +476,8 @@ void sngisdn_rcv_fac_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, Fa ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - if (!(spInstId && get_ftdmchan_by_spInstId((int8_t) suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && - !(suInstId && get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { + if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && + !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); ftdm_assert(0, "Inconsistent call states\n"); @@ -510,8 +510,8 @@ void sngisdn_rcv_sta_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, St ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - if (!(spInstId && get_ftdmchan_by_spInstId((int8_t) suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && - !(suInstId && get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { + if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && + !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); ftdm_assert(0, "Inconsistent call states\n"); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 5cc17a5..f54f7db 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -91,9 +91,10 @@ FT_DECLARE_INLINE(void) clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info) } -FT_DECLARE_INLINE(uint32_t) get_unique_suInstId(uint8_t cc_id) +FT_DECLARE_INLINE(uint32_t) get_unique_suInstId(int16_t cc_id) { uint32_t suInstId; + ftdm_assert_return((cc_id > 0 && cc_id <=MAX_VARIANTS), FTDM_FAIL, "Invalid cc_id\n"); ftdm_mutex_lock(g_sngisdn_data.ccs[cc_id].mutex); suInstId = g_sngisdn_data.ccs[cc_id].last_suInstId; @@ -112,8 +113,9 @@ FT_DECLARE_INLINE(uint32_t) get_unique_suInstId(uint8_t cc_id) return 0; } -FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_suInstId(uint8_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data) +FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_suInstId(int16_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data) { + ftdm_assert_return((cc_id > 0 && cc_id <=MAX_VARIANTS), FTDM_FAIL, "Invalid cc_id\n"); ftdm_assert_return(g_sngisdn_data.ccs[cc_id].activation_done, FTDM_FAIL, "Trying to find call on unconfigured CC\n"); if (g_sngisdn_data.ccs[cc_id].active_suInstIds[suInstId] == NULL) { @@ -123,8 +125,9 @@ FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_suInstId(uint8_t cc_id, uint32_ return FTDM_SUCCESS; } -FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_spInstId(uint8_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data) +FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_spInstId(int16_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data) { + ftdm_assert_return((cc_id > 0 && cc_id <=MAX_VARIANTS), FTDM_FAIL, "Invalid cc_id\n"); ftdm_assert_return(g_sngisdn_data.ccs[cc_id].activation_done, FTDM_FAIL, "Trying to find call on unconfigured CC\n"); if (g_sngisdn_data.ccs[cc_id].active_spInstIds[spInstId] == NULL) { diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index 8694010..e2d85f7 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -1011,6 +1011,16 @@ static FIO_GET_ALARMS_FUNCTION(wanpipe_get_alarms) } alarms = tdm_api.wp_tdm_cmd.fe_alarms; #endif +#if 1 + /* DAVIDY - Temporary fix: in the current trunk of libsangoma, for BRI, + WAN_TE_BIT_ALARM_RED bit is set if the card is in disconnected state, but this has + not been ported to Windows-libsangoma yet */ + if (alarms) { + ftdmchan->alarm_flags |= FTDM_ALARM_RED; + alarms = 0; + } +#endif + ftdmchan->alarm_flags = FTDM_ALARM_NONE; if (alarms & WAN_TE_BIT_ALARM_RED) { diff --git a/libs/freetdm/src/include/ftdm_declare.h b/libs/freetdm/src/include/ftdm_declare.h index 2985ab4..ab3b5c8 100644 --- a/libs/freetdm/src/include/ftdm_declare.h +++ b/libs/freetdm/src/include/ftdm_declare.h @@ -70,7 +70,7 @@ extern "C" { #define FT_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl #define FT_DECLARE_DATA __declspec(dllimport) #endif -#define FT_DECLARE_INLINE(type) type +#define FT_DECLARE_INLINE(type) extern __inline__ type /* why extern? see http://support.microsoft.com/kb/123768 */ #define EX_DECLARE_DATA __declspec(dllexport) #else #if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(HAVE_VISIBILITY) @@ -82,7 +82,7 @@ extern "C" { #define FT_DECLARE_NONSTD(type) type #define FT_DECLARE_DATA #endif -#define FT_DECLARE_INLINE(type) type __inline__ +#define FT_DECLARE_INLINE(type) __inline__ type #define EX_DECLARE_DATA #endif commit 5875905285309a89d1e83463560d8ba93f247512 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Nov 8 10:14:46 2010 -0600 FS-2827 diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index be41760..941db22 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -1363,7 +1363,7 @@ static void *SWITCH_THREAD_FUNC api_exec(switch_thread_t *thread, void *obj) if (acs->console_execute) { if ((status = switch_console_execute(acs->api_cmd, 0, &stream)) != SWITCH_STATUS_SUCCESS) { - stream.write_function(&stream, "%s: Command not found!\n", acs->api_cmd); + stream.write_function(&stream, "-ERR %s Command not found!\n", acs->api_cmd); } } else { status = switch_api_execute(acs->api_cmd, acs->arg, NULL, &stream); @@ -1372,7 +1372,7 @@ static void *SWITCH_THREAD_FUNC api_exec(switch_thread_t *thread, void *obj) if (status == SWITCH_STATUS_SUCCESS) { reply = stream.data; } else { - freply = switch_mprintf("%s: Command not found!\n", acs->api_cmd); + freply = switch_mprintf("-ERR %s Command not found!\n", acs->api_cmd); reply = freply; } commit 10119e9e88b0021c36558172cce1f3a7da0c88d5 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Nov 8 10:13:35 2010 -0600 FS-2824 diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index aa927bf..3c8404d 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -2208,6 +2208,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi SIPTAG_CONTACT_STR(tech_pvt->reply_contact), SOATAG_REUSE_REJECTED(1), SOATAG_ORDERED_USER(1), + SOATAG_RTP_SELECT(1), SOATAG_ADDRESS(tech_pvt->adv_sdp_audio_ip), SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_AUDIO_AUX("cn telephone-event"), TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)), commit 4bbd9a4c0fd9ad4c23921197dc92a63c75656f21 Author: Jeff Lenk <jeff@jefflenk.com> Date: Mon Nov 8 08:05:23 2010 -0600 FS-2825 add additional info when fail diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 9551e5d..509d989 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -702,8 +702,11 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans(switch_ if (runtime.odbc_dbtype == DBTYPE_DEFAULT) { switch_cache_db_execute_sql_real(dbh, "BEGIN", &errmsg); } else { - if (switch_odbc_SQLSetAutoCommitAttr(dbh->native_handle.odbc_dbh, 0) != SWITCH_ODBC_SUCCESS) { - errmsg = strdup("Unable to Set AutoCommit Off.");; + switch_odbc_status_t result; + if ((result = switch_odbc_SQLSetAutoCommitAttr(dbh->native_handle.odbc_dbh, 0)) != SWITCH_ODBC_SUCCESS) { + char tmp[100]; + switch_snprintf(tmp, sizeof(tmp), "%s-%i", "Unable to Set AutoCommit Off", result); + errmsg = strdup(tmp); } } commit 0a0e79e1fe75307956f4410ab6c61205c0649e28 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Mon Nov 8 00:57:50 2010 +0100 ftmod_libpri: clarify why we enable facility conditionally Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 65148f3..b714b35 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -1327,7 +1327,10 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) } #ifdef HAVE_LIBPRI_AOC - /* enable FACILITY on trunk, if needed */ + /* + * Only enable facility on trunk if really required, + * this may help avoid problems on troublesome lines. + */ if (isdn_data->opts & FTMOD_LIBPRI_OPT_FACILITY_AOC) { pri_facility_enable(isdn_data->spri.pri); } commit 9e40c23cdb233bfd67d3ab25f3deba35e96ffb25 Merge: b7d9265 55975c7 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Mon Nov 8 00:54:58 2010 +0100 Merge branch 'master' of ssh://git.freeswitch.org/freeswitch commit b7d92655621e5d2d3542fa945adf6c75946522e5 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Mon Nov 8 00:43:09 2010 +0100 ftmod_libpri: First attempt at getting AOC Facility messages going (and minor cleanups) Requires libpri-1.4.12_beta1 or newer! Completely untested, AOC-S/D/E ChargingRequest operations are sent to NT (DTAG BRI PTMP), but rejected with "Unrecognized Operation". NOTE: FreeTDM core needs support for this to be useful! Only AOC-E events are decoded and sent to the log. To enable: Set (or add) <param name="opts" value="aoc"> in your libpri_spans span config. Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/configure.ac b/libs/freetdm/configure.ac index 7589957..2b5ded8 100644 --- a/libs/freetdm/configure.ac +++ b/libs/freetdm/configure.ac @@ -213,11 +213,23 @@ then [extern void pri_new_bri_cb(void);], [pri_new_bri_cb();] )], - [AC_DEFINE([HAVE_LIBPRI_BRI], [1], [libpri has bri support]) + [AC_DEFINE([HAVE_LIBPRI_BRI], [1], [libpri has BRI support]) AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no]) AC_MSG_NOTICE([You will need libpri-1.4.12_beta1 or newer for BRI support])] ) + + AC_MSG_CHECKING([whether libpri has AOC event support]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [extern void pri_aoc_events_enable(void);], + [pri_aoc_events_enable();] + )], + [AC_DEFINE([HAVE_LIBPRI_AOC], [1], [libpri has AOC event support]) + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + AC_MSG_NOTICE([You will need libpri-1.4.12_beta1 or newer for AOC event support])] + ) LIBS="${save_LIBS}" fi HAVE_LIBPRI="${enable_libpri}" diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index ccb2342..65148f3 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -30,7 +30,6 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include "private/ftdm_core.h" #include "ftmod_libpri.h" @@ -578,7 +577,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) sr = pri_sr_new(); assert(sr); pri_sr_set_channel(sr, ftdmchan->chan_id, 0, 0); - pri_sr_set_bearer(sr, 0, isdn_data->l1); + pri_sr_set_bearer(sr, PRI_TRANS_CAP_SPEECH, isdn_data->l1); pri_sr_set_called(sr, ftdmchan->caller_data.dnis.digits, dp, 1); pri_sr_set_caller(sr, ftdmchan->caller_data.cid_num.digits, (isdn_data->opts & FTMOD_LIBPRI_OPT_OMIT_DISPLAY_IE ? NULL : ftdmchan->caller_data.cid_name), @@ -589,7 +588,13 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) pri_sr_set_redirecting(sr, ftdmchan->caller_data.cid_num.digits, dp, PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN, PRI_REDIR_UNCONDITIONAL); } - +#ifdef HAVE_LIBPRI_AOC + if (isdn_data->opts & FTMOD_LIBPRI_OPT_FACILITY_AOC) { + /* request AOC on call */ + pri_sr_set_aoc_charging_request(sr, (PRI_AOC_REQUEST_S | PRI_AOC_REQUEST_E | PRI_AOC_REQUEST_D)); + ftdm_log(FTDM_LOG_DEBUG, "Requesting AOC-S/D/E on call\n"); + } +#endif if (pri_setup(isdn_data->spri.pri, call, sr)) { ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_DESTINATION_OUT_OF_ORDER; ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); @@ -978,6 +983,182 @@ static int on_restart(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_eve return 0; } +/* + * FACILITY Advice-On-Charge handler + */ +#ifdef HAVE_LIBPRI_AOC +static const char *aoc_billing_id(const int id) +{ + switch (id) { + case PRI_AOC_E_BILLING_ID_NOT_AVAILABLE: + return "not available"; + case PRI_AOC_E_BILLING_ID_NORMAL: + return "normal"; + case PRI_AOC_E_BILLING_ID_REVERSE: + return "reverse"; + case PRI_AOC_E_BILLING_ID_CREDIT_CARD: + return "credit card"; + case PRI_AOC_E_BILLING_ID_CALL_FORWARDING_UNCONDITIONAL: + return "call forwarding unconditional"; + case PRI_AOC_E_BILLING_ID_CALL_FORWARDING_BUSY: + return "call forwarding busy"; + case PRI_AOC_E_BILLING_ID_CALL_FORWARDING_NO_REPLY: + return "call forwarding no reply"; + case PRI_AOC_E_BILLING_ID_CALL_DEFLECTION: + return "call deflection"; + case PRI_AOC_E_BILLING_ID_CALL_TRANSFER: + return "call transfer"; + default: + return "unknown\n"; + } +} + +static float aoc_money_amount(const struct pri_aoc_amount *amount) +{ + switch (amount->multiplier) { + case PRI_AOC_MULTIPLIER_THOUSANDTH: + return amount->cost * 0.001f; + case PRI_AOC_MULTIPLIER_HUNDREDTH: + return amount->cost * 0.01f; + case PRI_AOC_MULTIPLIER_TENTH: + return amount->cost * 0.1f; + case PRI_AOC_MULTIPLIER_TEN: + return amount->cost * 10.0f; + case PRI_AOC_MULTIPLIER_HUNDRED: + return amount->cost * 100.0f; + case PRI_AOC_MULTIPLIER_THOUSAND: + return amount->cost * 1000.0f; + default: + return amount->cost; + } +} + +static int handle_facility_aoc_s(const struct pri_subcmd_aoc_s *aoc_s) +{ + /* Left as an excercise to the reader */ + return 0; +} + +static int handle_facility_aoc_d(const struct pri_subcmd_aoc_d *aoc_d) +{ + /* Left as an excercise to the reader */ + return 0; +} + +static int handle_facility_aoc_e(const struct pri_subcmd_aoc_e *aoc_e) +{ + char tmp[1024] = { 0 }; + int x = 0, offset = 0; + + switch (aoc_e->charge) { + case PRI_AOC_DE_CHARGE_FREE: + strcat(tmp, "\tcharge-type: none\n"); + offset = strlen(tmp); + break; + + case PRI_AOC_DE_CHARGE_CURRENCY: + sprintf(tmp, "\tcharge-type: money\n\tcharge-amount: %.2f\n\tcharge-currency: %s\n", + aoc_money_amount(&aoc_e->recorded.money.amount), + aoc_e->recorded.money.currency); + offset = strlen(tmp); + break; + + case PRI_AOC_DE_CHARGE_UNITS: + strcat(tmp, "\tcharge-type: units\n"); + offset = strlen(tmp); + + for (x = 0; x < aoc_e->recorded.unit.num_items; x++) { + sprintf(&tmp[offset], "\tcharge-amount: %ld (type: %d)\n", + aoc_e->recorded.unit.item[x].number, + aoc_e->recorded.unit.item[x].type); + offset += strlen(&tmp[offset]); + } + break; + + default: + strcat(tmp, "\tcharge-type: not available\n"); + offset = strlen(tmp); + } + + sprintf(&tmp[offset], "\tbilling-id: %s\n", aoc_billing_id(aoc_e->billing_id)); + offset += strlen(&tmp[offset]); + + strcat(&tmp[offset], "\tassociation-type: "); + offset += strlen(&tmp[offset]); + + switch (aoc_e->associated.charging_type) { + case PRI_AOC_E_CHARGING_ASSOCIATION_NOT_AVAILABLE: + strcat(&tmp[offset], "not available\n"); + break; + case PRI_AOC_E_CHARGING_ASSOCIATION_NUMBER: + sprintf(&tmp[offset], "number\n\tassociation-number: %s\n", aoc_e->associated.charge.number.str); + break; + case PRI_AOC_E_CHARGING_ASSOCIATION_ID: + sprintf(&tmp[offset], "id\n\tassociation-id: %d\n", aoc_e->associated.charge.id); + break; + default: + strcat(&tmp[offset], "unknown\n"); + } + + ftdm_log(FTDM_LOG_INFO, "AOC-E:\n%s", tmp); + return 0; +} +#endif + +/** + * \brief Handler for libpri facility events + * \param spri Pri wrapper structure (libpri, span, dchan) + * \param event_type Event type (unused) + * \param pevent Event + * \return 0 + */ +static int on_facility(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) +{ + struct pri_event_facility *pfac = (struct pri_event_facility *)pevent; + int i = 0; + + if (!pevent) + return 0; + + if (!pfac->subcmds || pfac->subcmds->counter_subcmd <= 0) + return 0; + + for (i = 0; i < pfac->subcmds->counter_subcmd; i++) { + struct pri_subcommand *sub = &pfac->subcmds->subcmd[i]; + int res = -1; + + switch (sub->cmd) { +#ifdef HAVE_LIBPRI_AOC + case PRI_SUBCMD_AOC_S: /* AOC-S: Start of call */ + res = handle_facility_aoc_s(&sub->u.aoc_s); + break; + case PRI_SUBCMD_AOC_D: /* AOC-D: During call */ + res = handle_facility_aoc_d(&sub->u.aoc_d); + break; + case PRI_SUBCMD_AOC_E: /* AOC-E: End of call */ + res = handle_facility_aoc_e(&sub->u.aoc_e); + break; + case PRI_SUBCMD_AOC_CHARGING_REQ: + ftdm_log(FTDM_LOG_NOTICE, "AOC Charging Request received\n"); + break; + case PRI_SUBCMD_AOC_CHARGING_REQ_RSP: + ftdm_log(FTDM_LOG_NOTICE, "AOC Charging Request Response received [aoc_s data: %s, req: %x, resp: %x]\n", + sub->u.aoc_request_response.valid_aoc_s ? "yes" : "no", + sub->u.aoc_request_response.charging_request, + sub->u.aoc_request_response.charging_response); + break; +#endif + default: + ftdm_log(FTDM_LOG_DEBUG, "FACILITY subcommand %d is not implemented, ignoring\n", sub->cmd); + } + + ftdm_log(FTDM_LOG_DEBUG, "FACILITY subcommand %d handler returned %d\n", sub->cmd, res); + } + + ftdm_log(FTDM_LOG_DEBUG, "Caught Event on span %d %u (%s)\n", spri->span->span_id, event_type, lpwrap_pri_event_str(event_type)); + return 0; +} + /** * \brief Handler for libpri dchan up event * \param spri Pri wrapper structure (libpri, span, dchan) @@ -1145,6 +1326,13 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) goto out; } +#ifdef HAVE_LIBPRI_AOC + /* enable FACILITY on trunk, if needed */ + if (isdn_data->opts & FTMOD_LIBPRI_OPT_FACILITY_AOC) { + pri_facility_enable(isdn_data->spri.pri); + } +#endif + if (res == 0) { LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_ANY, on_anything); LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_RING, on_ring); @@ -1159,6 +1347,7 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_INFO_RECEIVED, on_info); LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_RESTART, on_restart); LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_IO_FAIL, on_io_fail); + LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_FACILITY, on_facility); if (down) { ftdm_log(FTDM_LOG_INFO, "PRI back up on span %d\n", isdn_data->spri.span->span_id); @@ -1359,7 +1548,9 @@ static uint32_t parse_opts(const char *in) if (strstr(in, "omit_redirecting_number")) { flags |= FTMOD_LIBPRI_OPT_OMIT_REDIRECTING_NUMBER_IE; } - + if (strstr(in, "aoc")) { + flags |= FTMOD_LIBPRI_OPT_FACILITY_AOC; + } return flags; } diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h index 0bf8c46..b11baec 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h @@ -42,8 +42,9 @@ typedef enum { FTMOD_LIBPRI_OPT_SUGGEST_CHANNEL = (1 << 0), FTMOD_LIBPRI_OPT_OMIT_DISPLAY_IE = (1 << 1), FTMOD_LIBPRI_OPT_OMIT_REDIRECTING_NUMBER_IE = (1 << 2), - - FTMOD_LIBPRI_OPT_MAX = (1 << 3) + FTMOD_LIBPRI_OPT_FACILITY_AOC = (1 << 3), + + FTMOD_LIBPRI_OPT_MAX = (1 << 4) } ftdm_isdn_opts_t; typedef enum { diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c b/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c index 5b04abe..317c9a5 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c @@ -92,7 +92,7 @@ static struct lpwrap_pri_event_list LPWRAP_PRI_EVENT_LIST[] = { {8, LPWRAP_PRI_EVENT_ANSWER, "ANSWER"}, {9, LPWRAP_PRI_EVENT_HANGUP_ACK, "HANGUP_ACK"}, {10, LPWRAP_PRI_EVENT_RESTART_ACK, "RESTART_ACK"}, - {11, LPWRAP_PRI_EVENT_FACNAME, "FACNAME"}, + {11, LPWRAP_PRI_EVENT_FACILITY, "FACILITY"}, {12, LPWRAP_PRI_EVENT_INFO_RECEIVED, "INFO_RECEIVED"}, {13, LPWRAP_PRI_EVENT_PROCEEDING, "PROCEEDING"}, {14, LPWRAP_PRI_EVENT_SETUP_ACK, "SETUP_ACK"}, @@ -107,6 +107,9 @@ static struct lpwrap_pri_event_list LPWRAP_PRI_EVENT_LIST[] = { const char *lpwrap_pri_event_str(lpwrap_pri_event_t event_id) { + if (event_id < 0 || event_id >= LPWRAP_PRI_EVENT_MAX) + return ""; + return LPWRAP_PRI_EVENT_LIST[event_id].name; } @@ -114,8 +117,8 @@ static int __pri_lpwrap_read(struct pri *pri, void *buf, int buflen) { struct lpwrap_pri *spri = (struct lpwrap_pri *) pri_get_userdata(pri); ftdm_size_t len = buflen; - int res; ftdm_status_t zst; + int res; if ((zst = ftdm_channel_read(spri->dchan, buf, &len)) != FTDM_SUCCESS) { if (zst == FTDM_FAIL) { @@ -130,25 +133,25 @@ static int __pri_lpwrap_read(struct pri *pri, void *buf, int buflen) } spri->errs = 0; res = (int)len; - memset(&((unsigned char*)buf)[res],0,2); - res+=2; + + memset(&((unsigned char*)buf)[res], 0, 2); + res += 2; #ifdef IODEBUG { char bb[2048] = { 0 }; print_hex_bytes(buf, res - 2, bb, sizeof(bb)); - ftdm_log(FTDM_LOG_DEBUG, "READ %d\n", res-2); + ftdm_log(FTDM_LOG_DEBUG, "READ %d\n", res - 2); } #endif - return res; } static int __pri_lpwrap_write(struct pri *pri, void *buf, int buflen) { struct lpwrap_pri *spri = (struct lpwrap_pri *) pri_get_userdata(pri); - ftdm_size_t len = buflen -2; + ftdm_size_t len = buflen - 2; if (ftdm_channel_write(spri->dchan, buf, buflen, &len) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_CRIT, "span %d D-WRITE FAIL! [%s]\n", spri->span->span_id, spri->dchan->last_error); @@ -161,11 +164,10 @@ static int __pri_lpwrap_write(struct pri *pri, void *buf, int buflen) char bb[2048] = { 0 }; print_hex_bytes(buf, buflen - 2, bb, sizeof(bb)); - ftdm_log(FTDM_LOG_DEBUG, "WRITE %d\n", (int)buflen-2); + ftdm_log(FTDM_LOG_DEBUG, "WRITE %d\n", (int)buflen - 2); } #endif - - return (int) buflen; + return (int)buflen; } int lpwrap_init_pri(struct lpwrap_pri *spri, ftdm_span_t *span, ftdm_channel_t *dchan, int swtype, int node, int debug) @@ -186,6 +188,9 @@ int lpwrap_init_pri(struct lpwrap_pri *spri, ftdm_span_t *span, ftdm_channel_t * size_t buflen = sizeof(buf), len = 0; pri_set_debug(spri->pri, debug); +#ifdef HAVE_LIBPRI_AOC + pri_aoc_events_enable(spri->pri, 1); +#endif ftdm_channel_write(spri->dchan, buf, buflen, &len); ret = 0; @@ -214,6 +219,9 @@ int lpwrap_init_bri(struct lpwrap_pri *spri, ftdm_span_t *span, ftdm_channel_t * size_t buflen = sizeof(buf), len = 0; pri_set_debug(spri->pri, debug); +#ifdef HAVE_LIBPRI_AOC + pri_aoc_events_enable(spri->pri, 1); +#endif ftdm_channel_write(spri->dchan, buf, buflen, &len); ret = 0; @@ -267,9 +275,6 @@ int lpwrap_one_loop(struct lpwrap_pri *spri) now.tv_usec = 100000; sel = select(pri_fd(spri->pri) + 1, &rfds, NULL, &efds, &now); - - event = NULL; - if (!sel) { if ((next = pri_schedule_next(spri->pri))) { gettimeofday(&now, NULL); @@ -284,33 +289,29 @@ int lpwrap_one_loop(struct lpwrap_pri *spri) if (event) { /* 0 is catchall event handler */ - if ((handler = spri->eventmap[event->e] ? spri->eventmap[event->e] : spri->eventmap[0] ? spri->eventmap[0] : NULL)) { + if (event->e < 0 || event->e >= LPWRAP_PRI_EVENT_MAX) { + handler = spri->eventmap[0]; + } else if (spri->eventmap[event->e]) { + handler = spri->eventmap[event->e]; + } else { + handler = spri->eventmap[0]; + } + + if (handler) { handler(spri, event->e, event); } else { ftdm_log(FTDM_LOG_CRIT, "No event handler found for event %d.\n", event->e); } } - - return sel; - - - if ((handler = spri->eventmap[LPWRAP_PRI_EVENT_IO_FAIL] ? spri->eventmap[LPWRAP_PRI_EVENT_IO_FAIL] : spri->eventmap[0] ? spri->eventmap[0] : NULL)) { - handler(spri, LPWRAP_PRI_EVENT_IO_FAIL, NULL); - } - - return -1; } int lpwrap_run_pri(struct lpwrap_pri *spri) { int ret = 0; - for (;;){ - ret = lpwrap_one_loop(spri); - - if (ret < 0) { - + for (;;) { + if ((ret = lpwrap_one_loop(spri)) < 0) { #ifndef WIN32 //This needs to be adressed fror WIN32 still if (errno == EINTR){ /* Igonore an interrupted system call */ @@ -321,9 +322,7 @@ int lpwrap_run_pri(struct lpwrap_pri *spri) break; } } - return ret; - } /* For Emacs: diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.h b/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.h index 4701e27..b62e5fb 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.h +++ b/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.h @@ -51,7 +51,11 @@ typedef enum { LPWRAP_PRI_EVENT_ANSWER = PRI_EVENT_ANSWER, LPWRAP_PRI_EVENT_HANGUP_ACK = PRI_EVENT_HANGUP_ACK, LPWRAP_PRI_EVENT_RESTART_ACK = PRI_EVENT_RESTART_ACK, - LPWRAP_PRI_EVENT_FACNAME = PRI_EVENT_FACNAME, +#ifdef PRI_EVENT_FACILITY + LPWRAP_PRI_EVENT_FACILITY = PRI_EVENT_FACILITY, +#else + LPWRAP_PRI_EVENT_FACILITY = PRI_EVENT_FACNAME, +#endif LPWRAP_PRI_EVENT_INFO_RECEIVED = PRI_EVENT_INFO_RECEIVED, LPWRAP_PRI_EVENT_PROCEEDING = PRI_EVENT_PROCEEDING, LPWRAP_PRI_EVENT_SETUP_ACK = PRI_EVENT_SETUP_ACK, commit 55975c7f3c1cc8eb581b3ffad489698bec88f88b Author: Moises Silva <moy@sangoma.com> Date: Sun Nov 7 16:57:11 2010 -0500 openzap: fix mismatch in enum types diff --git a/libs/openzap/src/ozmod/ozmod_sangoma_boost/ozmod_sangoma_boost.c b/libs/openzap/src/ozmod/ozmod_sangoma_boost/ozmod_sangoma_boost.c index 937c67b..dc22180 100644 --- a/libs/openzap/src/ozmod/ozmod_sangoma_boost/ozmod_sangoma_boost.c +++ b/libs/openzap/src/ozmod/ozmod_sangoma_boost/ozmod_sangoma_boost.c @@ -898,7 +898,7 @@ tryagain: static void handle_call_loop_start(zap_span_t *span, sangomabc_connection_t *mcon, sangomabc_short_event_t *event) { - zap_status_t res = ZAP_FAIL; + zap_state_change_result_t res = ZAP_FAIL; zap_channel_t *zchan; if (!(zchan = find_zchan(span, (sangomabc_short_event_t*)event, 0))) { @@ -923,7 +923,7 @@ static void handle_call_loop_start(zap_span_t *span, sangomabc_connection_t *mco static __inline__ void stop_loop(zap_channel_t *zchan) { - zap_status_t res = ZAP_FAIL; + zap_state_change_result_t res = ZAP_STATE_CHANGE_FAIL; zap_channel_command(zchan, ZAP_COMMAND_DISABLE_LOOP, NULL); /* even when we did not sent a msg we set this flag to avoid sending call stop in the DOWN state handler */ zap_set_flag(zchan, SFLAG_SENT_FINAL_MSG); commit c57d5452a4a8674928953fce3c0cbd51689efb32 Author: Jeff Lenk <jeff@jefflenk.com> Date: Sun Nov 7 14:35:29 2010 -0600 FS-2826 more fixes for sounds diff --git a/Freeswitch.2008.sln b/Freeswitch.2008.sln index 8e6df5c..01a4cf4 100644 --- a/Freeswitch.2008.sln +++ b/Freeswitch.2008.sln @@ -2042,18 +2042,18 @@ Global {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.All|x64.Build.0 = Release|Win32 {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Debug|Win32.ActiveCfg = Debug|Win32 {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Debug|Win32.Build.0 = Debug|Win32 - {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Debug|x64.ActiveCfg = Debug|Win32 - {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Debug|x64.Build.0 = Debug|Win32 + {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Debug|x64.ActiveCfg = Debug|x64 + {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Debug|x64.Build.0 = Debug|x64 {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Release|Win32.ActiveCfg = Release|Win32 {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Release|Win32.Build.0 = Release|Win32 - {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Release|x64.ActiveCfg = Release|Win32 - {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Release|x64.Build.0 = Release|Win32 + {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Release|x64.ActiveCfg = Release|x64 + {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Release|x64.Build.0 = Release|x64 {7EB71250-F002-4ED8-92CA-CA218114537A}.All|Win32.ActiveCfg = Release|Win32 {7EB71250-F002-4ED8-92CA-CA218114537A}.All|x64.ActiveCfg = Release|Win32 {7EB71250-F002-4ED8-92CA-CA218114537A}.Debug|Win32.ActiveCfg = Debug|Win32 - {7EB71250-F002-4ED8-92CA-CA218114537A}.Debug|x64.ActiveCfg = Debug|Win32 + {7EB71250-F002-4ED8-92CA-CA218114537A}.Debug|x64.ActiveCfg = Debug|x64 {7EB71250-F002-4ED8-92CA-CA218114537A}.Release|Win32.ActiveCfg = Release|Win32 - {7EB71250-F002-4ED8-92CA-CA218114537A}.Release|x64.ActiveCfg = Release|Win32 + {7EB71250-F002-4ED8-92CA-CA218114537A}.Release|x64.ActiveCfg = Release|x64 {6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.All|Win32.ActiveCfg = Release|Win32 {6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.All|x64.ActiveCfg = Release|Win32 {6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.Debug|Win32.ActiveCfg = Debug|Win32 @@ -2063,9 +2063,9 @@ Global {464AAB78-5489-4916-BE51-BF8D61822311}.All|Win32.ActiveCfg = Release|Win32 {464AAB78-5489-4916-BE51-BF8D61822311}.All|x64.ActiveCfg = Release|Win32 {464AAB78-5489-4916-BE51-BF8D61822311}.Debug|Win32.ActiveCfg = Debug|Win32 - {464AAB78-5489-4916-BE51-BF8D61822311}.Debug|x64.ActiveCfg = Debug|Win32 + {464AAB78-5489-4916-BE51-BF8D61822311}.Debug|x64.ActiveCfg = Debug|x64 {464AAB78-5489-4916-BE51-BF8D61822311}.Release|Win32.ActiveCfg = Release|Win32 - {464AAB78-5489-4916-BE51-BF8D61822311}.Release|x64.ActiveCfg = Release|Win32 + {464AAB78-5489-4916-BE51-BF8D61822311}.Release|x64.ActiveCfg = Release|x64 {0AD1177E-1FD8-4643-9391-431467A11084}.All|Win32.ActiveCfg = Release|x64 {0AD1177E-1FD8-4643-9391-431467A11084}.All|x64.ActiveCfg = Release|x64 {0AD1177E-1FD8-4643-9391-431467A11084}.All|x64.Build.0 = Release|x64 @@ -2482,24 +2482,24 @@ Global {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.All|x64.Build.0 = Release|Win32 {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Debug|Win32.ActiveCfg = Debug|Win32 {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Debug|Win32.Build.0 = Debug|Win32 - {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Debug|x64.ActiveCfg = Debug|Win32 - {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Debug|x64.Build.0 = Debug|Win32 + {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Debug|x64.ActiveCfg = Debug|x64 + {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Debug|x64.Build.0 = Debug|x64 {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Release|Win32.ActiveCfg = Release|Win32 {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Release|Win32.Build.0 = Release|Win32 - {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Release|x64.ActiveCfg = Release|Win32 - {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Release|x64.Build.0 = Release|Win32 + {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Release|x64.ActiveCfg = Release|x64 + {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Release|x64.Build.0 = Release|x64 {BA599D0A-4310-4505-91DA-6A6447B3E289}.All|Win32.ActiveCfg = Release|Win32 {BA599D0A-4310-4505-91DA-6A6447B3E289}.All|x64.ActiveCfg = Release|Win32 {BA599D0A-4310-4505-91DA-6A6447B3E289}.Debug|Win32.ActiveCfg = Debug|Win32 - {BA599D0A-4310-4505-91DA-6A6447B3E289}.Debug|x64.ActiveCfg = Debug|Win32 + {BA599D0A-4310-4505-91DA-6A6447B3E289}.Debug|x64.ActiveCfg = Debug|x64 {BA599D0A-4310-4505-91DA-6A6447B3E289}.Release|Win32.ActiveCfg = Release|Win32 - {BA599D0A-4310-4505-91DA-6A6447B3E289}.Release|x64.ActiveCfg = Release|Win32 + {BA599D0A-4310-4505-91DA-6A6447B3E289}.Release|x64.ActiveCfg = Release|x64 {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.All|Win32.ActiveCfg = Release|Win32 {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.All|x64.ActiveCfg = Release|Win32 {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Debug|Win32.ActiveCfg = Debug|Win32 - {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Debug|x64.ActiveCfg = Debug|Win32 + {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Debug|x64.ActiveCfg = Debug|x64 {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Release|Win32.ActiveCfg = Release|Win32 - {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Release|x64.ActiveCfg = Release|Win32 + {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Release|x64.ActiveCfg = Release|x64 {70564D74-199A-4452-9C60-19ED5F242F0D}.All|Win32.ActiveCfg = Release|x64 {70564D74-199A-4452-9C60-19ED5F242F0D}.All|x64.ActiveCfg = Release|x64 {70564D74-199A-4452-9C60-19ED5F242F0D}.All|x64.Build.0 = Release|x64 diff --git a/libs/win32/Sound_Files/16khz.2008.vcproj b/libs/win32/Sound_Files/16khz.2008.vcproj index d8f80bb..0269871 100644 --- a/libs/win32/Sound_Files/16khz.2008.vcproj +++ b/libs/win32/Sound_Files/16khz.2008.vcproj @@ -11,6 +11,9 @@ <Platform Name="Win32" /> + <Platform + Name="x64" + /> </Platforms> <ToolFiles> </ToolFiles> @@ -33,7 +36,7 @@ /> <Tool Name="VCPostBuildEventTool" - CommandLine="xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\16000\*.*" "$(OutDir)\sounds\en\us\callie\voicemail\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\16000\*.*" "$(OutDir)\sounds\en\us\callie\ivr\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\16000\*.*" "$(OutDir)\sounds\en\us\callie\conference\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\16000\*.*" "$(OutDir)\sounds\en\us\callie\time\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\16000\*.*" "$(OutDir)\sounds\en\us\callie\digits\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\16000\*.*" "$(OutDir)\sounds\en\us\callie\ascii\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\16000\*.*" "$(OutDir)\sounds\en\us\callie\misc\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\16000\*.*" "$(OutDir)\sounds\en\us\callie\currency\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\16000\*.*" "$(OutDir)\sounds\en\us\callie\phonetic-ascii\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\16000\*.*" "$(OutDir)\sounds\en\us\callie\directory\16000" /C /D /Y /S /I" + CommandLine="xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\16000\*.*" "$(OutDir)\sounds\en\us\callie\voicemail\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\16000\*.*" "$(OutDir)\sounds\en\us\callie\ivr\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\16000\*.*" "$(OutDir)\sounds\en\us\callie\conference\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\16000\*.*" "$(OutDir)\sounds\en\us\callie\time\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\16000\*.*" "$(OutDir)\sounds\en\us\callie\digits\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\16000\*.*" "$(OutDir)\sounds\en\us\callie\ascii\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\16000\*.*" "$(OutDir)\sounds\en\us\callie\misc\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\16000\*.*" "$(OutDir)\sounds\en\us\callie\currency\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\16000\*.*" "$(OutDir)\sounds\en\us\callie\phonetic-ascii\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\16000\*.*" "$(OutDir)\sounds\en\us\callie\directory\16000" /C /D /Y /S /I " /> </Configuration> <Configuration @@ -55,7 +58,52 @@ /> <Tool Name="VCPostBuildEventTool" - CommandLine="xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\16000\*.*" "$(OutDir)\sounds\en\us\callie\voicemail\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\16000\*.*" "$(OutDir)\sounds\en\us\callie\ivr\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\16000\*.*" "$(OutDir)\sounds\en\us\callie\conference\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\16000\*.*" "$(OutDir)\sounds\en\us\callie\time\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\16000\*.*" "$(OutDir)\sounds\en\us\callie\digits\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\16000\*.*" "$(OutDir)\sounds\en\us\callie\ascii\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\16000\*.*" "$(OutDir)\sounds\en\us\callie\misc\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\16000\*.*" "$(OutDir)\sounds\en\us\callie\currency\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\16000\*.*" "$(OutDir)\sounds\en\us\callie\phonetic-ascii\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\16000\*.*" "$(OutDir)\sounds\en\us\callie\directory\16000" /C /D /Y /S /I" + CommandLine="xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\16000\*.*" "$(OutDir)\sounds\en\us\callie\voicemail\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\16000\*.*" "$(OutDir)\sounds\en\us\callie\ivr\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\16000\*.*" "$(OutDir)\sounds\en\us\callie\conference\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\16000\*.*" "$(OutDir)\sounds\en\us\callie\time\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\16000\*.*" "$(OutDir)\sounds\en\us\callie\digits\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\16000\*.*" "$(OutDir)\sounds\en\us\callie\ascii\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\16000\*.*" "$(OutDir)\sounds\en\us\callie\misc\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\16000\*.*" "$(OutDir)\sounds\en\us\callie\currency\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\16000\*.*" "$(OutDir)\sounds\en\us\callie\phonetic-ascii\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\16000\*.*" "$(OutDir)\sounds\en\us\callie\directory\16000" /C /D /Y /S /I " + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="10" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCPostBuildEventTool" + CommandLine="xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\16000\*.*" "$(OutDir)\sounds\en\us\callie\voicemail\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\16000\*.*" "$(OutDir)\sounds\en\us\callie\ivr\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\16000\*.*" "$(OutDir)\sounds\en\us\callie\conference\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\16000\*.*" "$(OutDir)\sounds\en\us\callie\time\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\16000\*.*" "$(OutDir)\sounds\en\us\callie\digits\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\16000\*.*" "$(OutDir)\sounds\en\us\callie\ascii\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\16000\*.*" "$(OutDir)\sounds\en\us\callie\misc\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\16000\*.*" "$(OutDir)\sounds\en\us\callie\currency\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\16000\*.*" "$(OutDir)\sounds\en\us\callie\phonetic-ascii\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\16000\*.*" "$(OutDir)\sounds\en\us\callie\directory\16000" /C /D /Y /S /I " + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="10" + CharacterSet="2" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCPostBuildEventTool" + CommandLine="xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\16000\*.*" "$(OutDir)\sounds\en\us\callie\voicemail\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\16000\*.*" "$(OutDir)\sounds\en\us\callie\ivr\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\16000\*.*" "$(OutDir)\sounds\en\us\callie\conference\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\16000\*.*" "$(OutDir)\sounds\en\us\callie\time\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\16000\*.*" "$(OutDir)\sounds\en\us\callie\digits\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\16000\*.*" "$(OutDir)\sounds\en\us\callie\ascii\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\16000\*.*" "$(OutDir)\sounds\en\us\callie\misc\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\16000\*.*" "$(OutDir)\sounds\en\us\callie\currency\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\16000\*.*" "$(OutDir)\sounds\en\us\callie\phonetic-ascii\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\16000\*.*" "$(OutDir)\sounds\en\us\callie\directory\16000" /C /D /Y /S /I " /> </Configuration> </Configurations> diff --git a/libs/win32/Sound_Files/16khzmusic.2008.vcproj b/libs/win32/Sound_Files/16khzmusic.2008.vcproj index 932d1c5..c09a5ae 100644 --- a/libs/win32/Sound_Files/16khzmusic.2008.vcproj +++ b/libs/win32/Sound_Files/16khzmusic.2008.vcproj @@ -11,6 +11,9 @@ <Platform Name="Win32" /> + <Platform + Name="x64" + /> </Platforms> <ToolFiles> </ToolFiles> @@ -58,6 +61,51 @@ CommandLine="xcopy "$(SolutionDir)libs\sounds\music\16000\*.*" "$(OutDir)\sounds\music\16000" /C /D /Y /S /I " /> </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="10" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCPostBuildEventTool" + CommandLine="xcopy "$(SolutionDir)libs\sounds\music\16000\*.*" "$(OutDir)\sounds\music\16000" /C /D /Y /S /I " + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="10" + CharacterSet="2" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCPostBuildEventTool" + CommandLine="xcopy "$(SolutionDir)libs\sounds\music\16000\*.*" "$(OutDir)\sounds\music\16000" /C /D /Y /S /I " + /> + </Configuration> </Configurations> <References> </References> diff --git a/libs/win32/Sound_Files/32khz.2008.vcproj b/libs/win32/Sound_Files/32khz.2008.vcproj index d2ac0af..cdf3fa9 100644 --- a/libs/win32/Sound_Files/32khz.2008.vcproj +++ b/libs/win32/Sound_Files/32khz.2008.vcproj @@ -11,6 +11,9 @@ <Platform Name="Win32" /> + <Platform + Name="x64" + /> </Platforms> <ToolFiles> </ToolFiles> @@ -33,7 +36,7 @@ /> <Tool Name="VCPostBuildEventTool" - CommandLine="xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\32000\*.*" "$(OutDir)\sounds\en\us\callie\voicemail\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\32000\*.*" "$(OutDir)\sounds\en\us\callie\ivr\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\32000\*.*" "$(OutDir)\sounds\en\us\callie\conference\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\32000\*.*" "$(OutDir)\sounds\en\us\callie\time\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\32000\*.*" "$(OutDir)\sounds\en\us\callie\digits\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\32000\*.*" "$(OutDir)\sounds\en\us\callie\ascii\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\32000\*.*" "$(OutDir)\sounds\en\us\callie\misc\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\32000\*.*" "$(OutDir)\sounds\en\us\callie\currency\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\32000\*.*" "$(OutDir)\sounds\en\us\callie\phonetic-ascii\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\32000\*.*" "$(OutDir)\sounds\en\us\callie\directory\32000" /C /D /Y /S /I" + CommandLine="xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\32000\*.*" "$(OutDir)\sounds\en\us\callie\voicemail\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\32000\*.*" "$(OutDir)\sounds\en\us\callie\ivr\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\32000\*.*" "$(OutDir)\sounds\en\us\callie\conference\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\32000\*.*" "$(OutDir)\sounds\en\us\callie\time\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\32000\*.*" "$(OutDir)\sounds\en\us\callie\digits\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\32000\*.*" "$(OutDir)\sounds\en\us\callie\ascii\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\32000\*.*" "$(OutDir)\sounds\en\us\callie\misc\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\32000\*.*" "$(OutDir)\sounds\en\us\callie\currency\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\32000\*.*" "$(OutDir)\sounds\en\us\callie\phonetic-ascii\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\32000\*.*" "$(OutDir)\sounds\en\us\callie\directory\32000" /C /D /Y /S /I " /> </Configuration> <Configuration @@ -55,7 +58,52 @@ /> <Tool Name="VCPostBuildEventTool" - CommandLine="xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\32000\*.*" "$(OutDir)\sounds\en\us\callie\voicemail\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\32000\*.*" "$(OutDir)\sounds\en\us\callie\ivr\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\32000\*.*" "$(OutDir)\sounds\en\us\callie\conference\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\32000\*.*" "$(OutDir)\sounds\en\us\callie\time\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\32000\*.*" "$(OutDir)\sounds\en\us\callie\digits\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\32000\*.*" "$(OutDir)\sounds\en\us\callie\ascii\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\32000\*.*" "$(OutDir)\sounds\en\us\callie\misc\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\32000\*.*" "$(OutDir)\sounds\en\us\callie\currency\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\32000\*.*" "$(OutDir)\sounds\en\us\callie\phonetic-ascii\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\32000\*.*" "$(OutDir)\sounds\en\us\callie\directory\32000" /C /D /Y /S /I" + CommandLine="xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\32000\*.*" "$(OutDir)\sounds\en\us\callie\voicemail\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\32000\*.*" "$(OutDir)\sounds\en\us\callie\ivr\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\32000\*.*" "$(OutDir)\sounds\en\us\callie\conference\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\32000\*.*" "$(OutDir)\sounds\en\us\callie\time\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\32000\*.*" "$(OutDir)\sounds\en\us\callie\digits\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\32000\*.*" "$(OutDir)\sounds\en\us\callie\ascii\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\32000\*.*" "$(OutDir)\sounds\en\us\callie\misc\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\32000\*.*" "$(OutDir)\sounds\en\us\callie\currency\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\32000\*.*" "$(OutDir)\sounds\en\us\callie\phonetic-ascii\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\32000\*.*" "$(OutDir)\sounds\en\us\callie\directory\32000" /C /D /Y /S /I " + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="10" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCPostBuildEventTool" + CommandLine="xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\32000\*.*" "$(OutDir)\sounds\en\us\callie\voicemail\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\32000\*.*" "$(OutDir)\sounds\en\us\callie\ivr\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\32000\*.*" "$(OutDir)\sounds\en\us\callie\conference\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\32000\*.*" "$(OutDir)\sounds\en\us\callie\time\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\32000\*.*" "$(OutDir)\sounds\en\us\callie\digits\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\32000\*.*" "$(OutDir)\sounds\en\us\callie\ascii\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\32000\*.*" "$(OutDir)\sounds\en\us\callie\misc\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\32000\*.*" "$(OutDir)\sounds\en\us\callie\currency\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\32000\*.*" "$(OutDir)\sounds\en\us\callie\phonetic-ascii\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\32000\*.*" "$(OutDir)\sounds\en\us\callie\directory\32000" /C /D /Y /S /I " + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="10" + CharacterSet="2" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCPostBuildEventTool" + CommandLine="xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\32000\*.*" "$(OutDir)\sounds\en\us\callie\voicemail\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\32000\*.*" "$(OutDir)\sounds\en\us\callie\ivr\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\32000\*.*" "$(OutDir)\sounds\en\us\callie\conference\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\32000\*.*" "$(OutDir)\sounds\en\us\callie\time\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\32000\*.*" "$(OutDir)\sounds\en\us\callie\digits\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\32000\*.*" "$(OutDir)\sounds\en\us\callie\ascii\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\32000\*.*" "$(OutDir)\sounds\en\us\callie\misc\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\32000\*.*" "$(OutDir)\sounds\en\us\callie\currency\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\32000\*.*" "$(OutDir)\sounds\en\us\callie\phonetic-ascii\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\32000\*.*" "$(OutDir)\sounds\en\us\callie\directory\32000" /C /D /Y /S /I " /> </Configuration> </Configurations> diff --git a/libs/win32/Sound_Files/32khzmusic.2008.vcproj b/libs/win32/Sound_Files/32khzmusic.2008.vcproj index aafc1ef..7ff356e 100644 --- a/libs/win32/Sound_Files/32khzmusic.2008.vcproj +++ b/libs/win32/Sound_Files/32khzmusic.2008.vcproj @@ -11,6 +11,9 @@ <Platform Name="Win32" /> + <Platform + Name="x64" + /> </Platforms> <ToolFiles> </ToolFiles> @@ -58,6 +61,51 @@ CommandLine="xcopy "$(SolutionDir)libs\sounds\music\32000\*.*" "$(OutDir)\sounds\music\32000" /C /D /Y /S /I" /> </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="10" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCPostBuildEventTool" + CommandLine="xcopy "$(SolutionDir)libs\sounds\music\32000\*.*" "$(OutDir)\sounds\music\32000" /C /D /Y /S /I" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="10" + CharacterSet="2" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCPostBuildEventTool" + CommandLine="xcopy "$(SolutionDir)libs\sounds\music\32000\*.*" "$(OutDir)\sounds\music\32000" /C /D /Y /S /I" + /> + </Configuration> </Configurations> <References> </References> diff --git a/libs/win32/Sound_Files/8khz.2008.vcproj b/libs/win32/Sound_Files/8khz.2008.vcproj index 413c47d..5f6d368 100644 --- a/libs/win32/Sound_Files/8khz.2008.vcproj +++ b/libs/win32/Sound_Files/8khz.2008.vcproj @@ -11,6 +11,9 @@ <Platform Name="Win32" /> + <Platform + Name="x64" + /> </Platforms> <ToolFiles> </ToolFiles> @@ -33,7 +36,7 @@ /> <Tool Name="VCPostBuildEventTool" - CommandLine="xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\8000\*.*" "$(OutDir)\sounds\en\us\callie\voicemail\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\8000\*.*" "$(OutDir)\sounds\en\us\callie\ivr\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\8000\*.*" "$(OutDir)\sounds\en\us\callie\conference\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\8000\*.*" "$(OutDir)\sounds\en\us\callie\time\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\8000\*.*" "$(OutDir)\sounds\en\us\callie\digits\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\8000\*.*" "$(OutDir)\sounds\en\us\callie\ascii\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\8000\*.*" "$(OutDir)\sounds\en\us\callie\misc\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\8000\*.*" "$(OutDir)\sounds\en\us\callie\currency\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\8000\*.*" "$(OutDir)\sounds\en\us\callie\phonetic-ascii\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\8000\*.*" "$(OutDir)\sounds\en\us\callie\directory\8000" /C /D /Y /S /I" + CommandLine="xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\8000\*.*" "$(OutDir)\sounds\en\us\callie\voicemail\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\8000\*.*" "$(OutDir)\sounds\en\us\callie\ivr\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\8000\*.*" "$(OutDir)\sounds\en\us\callie\conference\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\8000\*.*" "$(OutDir)\sounds\en\us\callie\time\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\8000\*.*" "$(OutDir)\sounds\en\us\callie\digits\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\8000\*.*" "$(OutDir)\sounds\en\us\callie\ascii\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\8000\*.*" "$(OutDir)\sounds\en\us\callie\misc\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\8000\*.*" "$(OutDir)\sounds\en\us\callie\currency\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\8000\*.*" "$(OutDir)\sounds\en\us\callie\phonetic-ascii\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\8000\*.*" "$(OutDir)\sounds\en\us\callie\directory\8000" /C /D /Y /S /I " /> </Configuration> <Configuration @@ -55,7 +58,52 @@ /> <Tool Name="VCPostBuildEventTool" - CommandLine="xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\8000\*.*" "$(OutDir)\sounds\en\us\callie\voicemail\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\8000\*.*" "$(OutDir)\sounds\en\us\callie\ivr\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\8000\*.*" "$(OutDir)\sounds\en\us\callie\conference\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\8000\*.*" "$(OutDir)\sounds\en\us\callie\time\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\8000\*.*" "$(OutDir)\sounds\en\us\callie\digits\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\8000\*.*" "$(OutDir)\sounds\en\us\callie\ascii\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\8000\*.*" "$(OutDir)\sounds\en\us\callie\misc\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\8000\*.*" "$(OutDir)\sounds\en\us\callie\currency\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\8000\*.*" "$(OutDir)\sounds\en\us\callie\phonetic-ascii\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\8000\*.*" "$(OutDir)\sounds\en\us\callie\directory\8000" /C /D /Y /S /I" + CommandLine="xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\8000\*.*" "$(OutDir)\sounds\en\us\callie\voicemail\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\8000\*.*" "$(OutDir)\sounds\en\us\callie\ivr\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\8000\*.*" "$(OutDir)\sounds\en\us\callie\conference\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\8000\*.*" "$(OutDir)\sounds\en\us\callie\time\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\8000\*.*" "$(OutDir)\sounds\en\us\callie\digits\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\8000\*.*" "$(OutDir)\sounds\en\us\callie\ascii\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\8000\*.*" "$(OutDir)\sounds\en\us\callie\misc\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\8000\*.*" "$(OutDir)\sounds\en\us\callie\currency\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\8000\*.*" "$(OutDir)\sounds\en\us\callie\phonetic-ascii\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\8000\*.*" "$(OutDir)\sounds\en\us\callie\directory\8000" /C /D /Y /S /I " + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="10" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCPostBuildEventTool" + CommandLine="xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\8000\*.*" "$(OutDir)\sounds\en\us\callie\voicemail\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\8000\*.*" "$(OutDir)\sounds\en\us\callie\ivr\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\8000\*.*" "$(OutDir)\sounds\en\us\callie\conference\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\8000\*.*" "$(OutDir)\sounds\en\us\callie\time\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\8000\*.*" "$(OutDir)\sounds\en\us\callie\digits\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\8000\*.*" "$(OutDir)\sounds\en\us\callie\ascii\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\8000\*.*" "$(OutDir)\sounds\en\us\callie\misc\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\8000\*.*" "$(OutDir)\sounds\en\us\callie\currency\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\8000\*.*" "$(OutDir)\sounds\en\us\callie\phonetic-ascii\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\8000\*.*" "$(OutDir)\sounds\en\us\callie\directory\8000" /C /D /Y /S /I " + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="10" + CharacterSet="2" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCPostBuildEventTool" + CommandLine="xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\8000\*.*" "$(OutDir)\sounds\en\us\callie\voicemail\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\8000\*.*" "$(OutDir)\sounds\en\us\callie\ivr\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\8000\*.*" "$(OutDir)\sounds\en\us\callie\conference\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\8000\*.*" "$(OutDir)\sounds\en\us\callie\time\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\8000\*.*" "$(OutDir)\sounds\en\us\callie\digits\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\8000\*.*" "$(OutDir)\sounds\en\us\callie\ascii\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\8000\*.*" "$(OutDir)\sounds\en\us\callie\misc\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\8000\*.*" "$(OutDir)\sounds\en\us\callie\currency\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\8000\*.*" "$(OutDir)\sounds\en\us\callie\phonetic-ascii\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\8000\*.*" "$(OutDir)\sounds\en\us\callie\directory\8000" /C /D /Y /S /I " /> </Configuration> </Configurations> diff --git a/libs/win32/Sound_Files/8khzmusic.2008.vcproj b/libs/win32/Sound_Files/8khzmusic.2008.vcproj index 2e46ecf..a89d14f 100644 --- a/libs/win32/Sound_Files/8khzmusic.2008.vcproj +++ b/libs/win32/Sound_Files/8khzmusic.2008.vcproj @@ -11,6 +11,9 @@ <Platform Name="Win32" /> + <Platform + Name="x64" + /> </Platforms> <ToolFiles> </ToolFiles> @@ -58,6 +61,51 @@ CommandLine="xcopy "$(SolutionDir)libs\sounds\music\8000\*.*" "$(OutDir)\sounds\music\8000" /C /D /Y /S /I " /> </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="10" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCPostBuildEventTool" + CommandLine="xcopy "$(SolutionDir)libs\sounds\music\8000\*.*" "$(OutDir)\sounds\music\8000" /C /D /Y /S /I " + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="10" + CharacterSet="2" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCPostBuildEventTool" + CommandLine="xcopy "$(SolutionDir)libs\sounds\music\8000\*.*" "$(OutDir)\sounds\music\8000" /C /D /Y /S /I " + /> + </Configuration> </Configurations> <References> </References> commit ab87f627f77be6fb1453ac1c91b8c896a2f36469 Author: Jeff Lenk <jeff@jefflenk.com> Date: Sun Nov 7 13:05:01 2010 -0600 FS-2826 FreeSwitchCoreLib Visual Studio x64 build error diff --git a/w32/Library/FreeSwitchCore.2008.vcproj b/w32/Library/FreeSwitchCore.2008.vcproj index 0f85d44..ca15da8 100644 --- a/w32/Library/FreeSwitchCore.2008.vcproj +++ b/w32/Library/FreeSwitchCore.2008.vcproj @@ -297,7 +297,7 @@ </Configuration> <Configuration Name="Release|x64" - OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" ConfigurationType="2" InheritedPropertySheets="..\winlibs.vsprops" @@ -382,7 +382,7 @@ /> <Tool Name="VCPostBuildEventTool" - CommandLine="if not exist "$(OutDir)\conf" xcopy "$(SolutionDir)conf\*.*" "$(SolutionDir)$(OutDir)\conf\" /C /D /Y /S if not exist "$(OutDir)\db" md "$(SolutionDir)$(OutDir)\db" if not exist "$(OutDir)\log" md "$(SolutionDir)$(OutDir)\log" if not exist "$(OutDir)\htdocs" md "$(SolutionDir)$(OutDir)\htdocs" if not exist "$(OutDir)\htdocs" xcopy "$(SolutionDir)htdocs\*.*" "$(SolutionDir)$(OutDir)\htdocs\" /C /D /Y /S " + CommandLine="if not exist "$(SolutionDir)$(OutDir)\conf" xcopy "$(SolutionDir)conf\*.*" "$(SolutionDir)$(OutDir)\conf\" /C /D /Y /S if not exist "$(SolutionDir)$(OutDir)\db" md "$(SolutionDir)$(OutDir)\db" if not exist "$(SolutionDir)$(OutDir)\log" md "$(SolutionDir)$(OutDir)\log" if not exist "$(SolutionDir)$(OutDir)\htdocs" md "$(SolutionDir)$(OutDir)\htdocs" if not exist "$(SolutionDir)$(OutDir)\htdocs" xcopy "$(SolutionDir)htdocs\*.*" "$(SolutionDir)$(OutDir)\htdocs\" /C /D /Y /S " /> </Configuration> </Configurations> commit 428d05349a343339820b16d65c742515885e2e49 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Sun Nov 7 19:55:00 2010 +0100 ftmod_libpri: Write fatal error message during span configuration to console (and to span error log). Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 51f7164..ccb2342 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -1424,7 +1424,8 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) isdn_data->l1 = PRI_LAYER_1_ULAW; break; default: - ftdm_log(FTDM_LOG_ERROR, "Invalid trunk type\n"); + ftdm_log(FTDM_LOG_ERROR, "Invalid trunk type: '%s'\n", ftdm_trunk_type2str(ftdm_span_get_trunk_type(span))); + snprintf(span->last_error, sizeof(span->last_error), "Invalid trunk type [%s]", ftdm_trunk_type2str(ftdm_span_get_trunk_type(span))); return FTDM_FAIL; } @@ -1434,6 +1435,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) if (!val) { ftdm_log(FTDM_LOG_ERROR, "Parameter '%s' has no value\n", var); + snprintf(span->last_error, sizeof(span->last_error), "Parameter [%s] has no value", var); return FTDM_FAIL; } @@ -1462,6 +1464,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) } } else { + ftdm_log(FTDM_LOG_ERROR, "Unknown parameter '%s', aborting configuration\n", var); snprintf(span->last_error, sizeof(span->last_error), "Unknown parameter [%s]", var); return FTDM_FAIL; } commit 81515b7bd84247e2005b5a34505bc937fe527711 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Sun Nov 7 17:22:22 2010 +0100 ftmod_libpri: Improve "ftdm libpri debug" usage information. "all" and "none" can only be used alone, other flags are additive. Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 114e656..51f7164 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -203,7 +203,7 @@ static ftdm_io_interface_t ftdm_libpri_interface; static const char *ftdm_libpri_usage = "Usage:\n" "libpri kill <span>\n" - "libpri debug <span> <flag>\n" + "libpri debug <span> <all|none|flag,...flagN>\n" "\n" "Possible debug flags:\n" "\tq921_raw - Q.921 Raw messages\n" commit 78eff1d82195bcf72614d62776a72e6770e05e78 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Sun Nov 7 17:00:54 2010 +0100 freetdm: convert ftmod_libpri (+ libpri_spans) to use new ftdm_configure_span_signaling() interface. This fixes several issues with parameter handling (e.g. default alaw/ulaw selection being totally useless). Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 48bff28..3b74f2e 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -3087,85 +3087,44 @@ static switch_status_t load_config(void) if ((spans = switch_xml_child(cfg, "libpri_spans"))) { for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) { - char *id = (char *) switch_xml_attr(myspan, "id"); char *name = (char *) switch_xml_attr(myspan, "name"); + ftdm_conf_parameter_t spanparameters[10]; ftdm_status_t zstatus = FTDM_FAIL; - const char *context = "default"; + const char *context = "default"; const char *dialplan = "XML"; - - const char *o_node = "cpe"; - const char *o_switch = "dms100"; - const char *o_dp = "unknown"; - const char *o_l1 = "ulaw"; - const char *o_debug = "none"; - const char* opts = "none"; - - uint32_t span_id = 0; + unsigned paramindex = 0; ftdm_span_t *span = NULL; + uint32_t span_id = 0; - - for (param = switch_xml_child(myspan, "param"); param; param = param->next) { + if (!name) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "span missing required attribute 'name'\n"); + continue; + } + + for (param = switch_xml_child(myspan, "param"); param && paramindex < 10; param = param->next) { char *var = (char *) switch_xml_attr_soft(param, "name"); char *val = (char *) switch_xml_attr_soft(param, "value"); - if (!strcasecmp(var, "node")) { - o_node = val; - } else if (!strcasecmp(var, "switch")) { - o_switch = val; - } else if (!strcasecmp(var, "dp")) { - o_dp = val; - } else if (!strcasecmp(var, "l1")) { - o_l1 = val; - } else if (!strcasecmp(var, "debug")) { - o_debug = val; - } else if (!strcasecmp(var, "context")) { + if (!strcasecmp(var, "context")) { context = val; - } else if (!strcasecmp(var, "opts")) { - opts = val; } else if (!strcasecmp(var, "dialplan")) { dialplan = val; - } - } - - if (!id && !name) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "span missing required param 'id'\n"); - continue; - } - - if (name) { - zstatus = ftdm_span_find_by_name(name, &span); - } else { - if (switch_is_number(id)) { - span_id = atoi(id); - zstatus = ftdm_span_find(span_id, &span); - } - - if (zstatus != FTDM_SUCCESS) { - zstatus = ftdm_span_find_by_name(id, &span); + } else { + spanparameters[paramindex].var = var; + spanparameters[paramindex].val = val; + paramindex++; } } + zstatus = ftdm_span_find_by_name(name, &span); if (zstatus != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error finding FreeTDM span id:%s name:%s\n", switch_str_nil(id), switch_str_nil(name)); + ftdm_log(FTDM_LOG_ERROR, "Error finding FreeTDM span %s\n", name); continue; } - if (!span_id) { - span_id = ftdm_span_get_id(span); - } - - - if (ftdm_configure_span(span, "libpri", on_clear_channel_signal, - "node", o_node, - "switch", o_switch, - "dp", o_dp, - "l1", o_l1, - "debug", o_debug, - "opts", opts, - FTDM_TAG_END) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error starting FreeTDM span %d node: %s switch: %s dp: %s l1: %s debug: %s error: %s\n", - span_id, switch_str_nil(o_node), switch_str_nil(o_switch), switch_str_nil(o_dp), switch_str_nil(o_l1), switch_str_nil(o_debug), - ftdm_span_get_last_error(span)); + span_id = ftdm_span_get_id(span); + if (ftdm_configure_span_signaling(span, "libpri", on_clear_channel_signal, spanparameters) != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_ERROR, "Error configuring FreeTDM span %s\n", name); continue; } diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index c8713d3..114e656 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -1367,15 +1367,16 @@ static uint32_t parse_opts(const char *in) * \brief Initialises a libpri span from configuration variables * \param span Span to configure * \param sig_cb Callback function for event signals - * \param ap List of configuration variables + * \param ftdm_parameters List of configuration variables * \return Success or failure */ -static FIO_SIG_CONFIGURE_FUNCTION(ftdm_libpri_configure_span) +static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) { uint32_t i, x = 0; + uint32_t paramindex = 0; //ftdm_channel_t *dchans[2] = {0}; ftdm_libpri_data_t *isdn_data; - char *var, *val; + const char *var, *val; if (ftdm_span_get_trunk_type(span) >= FTDM_TRUNK_NONE) { ftdm_log(FTDM_LOG_WARNING, "Invalid trunk type '%s' defaulting to T1.\n", ftdm_trunk_type2str(ftdm_span_get_trunk_type(span))); @@ -1427,8 +1428,9 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_libpri_configure_span) return FTDM_FAIL; } - while ((var = va_arg(ap, char *))) { - val = va_arg(ap, char *); + for (paramindex = 0; paramindex < 10 && ftdm_parameters[paramindex].var; paramindex++) { + var = ftdm_parameters[paramindex].var; + val = ftdm_parameters[paramindex].val; if (!val) { ftdm_log(FTDM_LOG_ERROR, "Parameter '%s' has no value\n", var); @@ -1497,8 +1499,9 @@ ftdm_module_t ftdm_module = { ftdm_libpri_io_init, ftdm_libpri_unload, ftdm_libpri_init, - ftdm_libpri_configure_span, - NULL + NULL, + NULL, + ftdm_libpri_configure_span }; /* For Emacs: commit dc2a28c27c6ccb2e8f55edbd1d10685f92349b0c Merge: 6e21740 46a9fa3 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Sun Nov 7 15:51:53 2010 +0100 Merge branch 'master' of ssh://git.freeswitch.org/freeswitch commit 6e217401d93091729a7fd7dd22a36a822e6eacb4 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Sun Nov 7 15:48:39 2010 +0100 ftmod_libpri: Rework debug flag handling, make BRI/BRI PTMP default to alaw too (does not work yet) Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 137efae..c8713d3 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -34,6 +34,10 @@ #include "private/ftdm_core.h" #include "ftmod_libpri.h" +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(x) (sizeof((x)) / sizeof((x)[0])) +#endif + /** * \brief Unloads libpri IO module * \return Success @@ -143,54 +147,54 @@ static void s_pri_message(struct pri *pri, char *s) ftdm_log(FTDM_LOG_DEBUG, "%s", s); } +static const struct ftdm_libpri_debug { + const char *name; + const int flags; +} ftdm_libpri_debug[] = { + { "q921_raw", PRI_DEBUG_Q921_RAW }, + { "q921_dump", PRI_DEBUG_Q921_DUMP }, + { "q921_state", PRI_DEBUG_Q921_STATE }, + { "q921_all", (PRI_DEBUG_Q921_RAW | PRI_DEBUG_Q921_DUMP | PRI_DEBUG_Q921_STATE) }, + + { "q931_dump", PRI_DEBUG_Q931_DUMP }, + { "q931_state", PRI_DEBUG_Q931_STATE }, + { "q931_anomaly", PRI_DEBUG_Q931_ANOMALY }, + { "q931_all", (PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q931_STATE | PRI_DEBUG_Q931_ANOMALY) }, + + { "config", PRI_DEBUG_CONFIG }, + { "apdu", PRI_DEBUG_APDU }, + { "aoc", PRI_DEBUG_AOC } +}; + /** * \brief Parses a debug string to flags * \param in Debug string to parse for - * \return Flags + * \return Flags or -1 if nothing matched */ -static int parse_debug(const char *in) +static int parse_debug(const char *in, int *flags) { - int flags = 0; + int res = -1; + int i; - if (!in) { - return 0; - } + if (!in || !flags) + return -1; - if (strstr(in, "q921_raw")) { - flags |= PRI_DEBUG_Q921_RAW; - } - if (strstr(in, "q921_dump")) { - flags |= PRI_DEBUG_Q921_DUMP; - } - if (strstr(in, "q921_state")) { - flags |= PRI_DEBUG_Q921_STATE; - } - if (strstr(in, "config")) { - flags |= PRI_DEBUG_CONFIG; - } - if (strstr(in, "q931_dump")) { - flags |= PRI_DEBUG_Q931_DUMP; - } - if (strstr(in, "q931_state")) { - flags |= PRI_DEBUG_Q931_STATE; - } - if (strstr(in, "q931_anomaly")) { - flags |= PRI_DEBUG_Q931_ANOMALY; - } - if (strstr(in, "apdu")) { - flags |= PRI_DEBUG_APDU; - } - if (strstr(in, "aoc")) { - flags |= PRI_DEBUG_AOC; - } - if (strstr(in, "all")) { - flags |= PRI_DEBUG_ALL; + if (!strcmp(in, "all")) { + *flags = PRI_DEBUG_ALL; + return 0; } if (strstr(in, "none")) { - flags = 0; + *flags = 0; + return 0; } - return flags; + for (i = 0; i < ARRAY_SIZE(ftdm_libpri_debug); i++) { + if (strstr(in, ftdm_libpri_debug[i].name)) { + *flags |= ftdm_libpri_debug[i].flags; + res = 0; + } + } + return res; } static ftdm_status_t ftdm_libpri_start(ftdm_span_t *span); @@ -199,7 +203,25 @@ static ftdm_io_interface_t ftdm_libpri_interface; static const char *ftdm_libpri_usage = "Usage:\n" "libpri kill <span>\n" - "libpri debug <span> <level>\n"; + "libpri debug <span> <flag>\n" + "\n" + "Possible debug flags:\n" + "\tq921_raw - Q.921 Raw messages\n" + "\tq921_dump - Q.921 Decoded messages\n" + "\tq921_state - Q.921 State machine changes\n" + "\tq921_all - Enable all Q.921 debug options\n" + "\n" + "\tq931_dump - Q.931 Messages\n" + "\tq931_state - Q.931 State machine changes\n" + "\tq931_anomaly - Q.931 Anomalies\n" + "\tq931_all - Enable all Q.931 debug options\n" + "\n" + "\tapdu - Application protocol data unit\n" + "\taoc - Advice of Charge messages\n" + "\tconfig - Configuration\n" + "\n" + "\tnone - Disable debugging\n" + "\tall - Enable all debug options\n"; /** * \brief API function to kill or debug a libpri span @@ -253,13 +275,20 @@ static FIO_API_FUNCTION(ftdm_libpri_api) if (ftdm_span_find_by_name(argv[1], &span) == FTDM_SUCCESS) { ftdm_libpri_data_t *isdn_data = span->signal_data; + int flags = 0; + if (span->start != ftdm_libpri_start) { stream->write_function(stream, "%s: -ERR invalid span.\n", __FILE__); goto done; } - pri_set_debug(isdn_data->spri.pri, parse_debug(argv[2])); - stream->write_function(stream, "%s: +OK debug set.\n", __FILE__); + if (parse_debug(argv[2], &flags) == -1) { + stream->write_function(stream, "%s: -ERR invalid debug flags given\n", __FILE__); + goto done; + } + + pri_set_debug(isdn_data->spri.pri, flags); + stream->write_function(stream, "%s: +OK debug %s.\n", __FILE__, (flags) ? "enabled" : "disabled"); goto done; } else { stream->write_function(stream, "%s: -ERR invalid span.\n", __FILE__); @@ -1090,7 +1119,7 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) } /* Initialize libpri trunk */ - switch (span->trunk_type) { + switch (ftdm_span_get_trunk_type(span)) { case FTDM_TRUNK_E1: case FTDM_TRUNK_T1: case FTDM_TRUNK_J1: @@ -1348,9 +1377,9 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_libpri_configure_span) ftdm_libpri_data_t *isdn_data; char *var, *val; - if (span->trunk_type >= FTDM_TRUNK_NONE) { - ftdm_log(FTDM_LOG_WARNING, "Invalid trunk type '%s' defaulting to T1.\n", ftdm_trunk_type2str(span->trunk_type)); - span->trunk_type = FTDM_TRUNK_T1; + if (ftdm_span_get_trunk_type(span) >= FTDM_TRUNK_NONE) { + ftdm_log(FTDM_LOG_WARNING, "Invalid trunk type '%s' defaulting to T1.\n", ftdm_trunk_type2str(ftdm_span_get_trunk_type(span))); + ftdm_span_set_trunk_type(span, FTDM_TRUNK_T1); } for(i = 1; i <= span->chan_count; i++) { @@ -1381,12 +1410,21 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_libpri_configure_span) assert(isdn_data != NULL); memset(isdn_data, 0, sizeof(*isdn_data)); - if (span->trunk_type == FTDM_TRUNK_E1) { - ftdm_log(FTDM_LOG_NOTICE, "Setting default Layer 1 to ALAW since this is an E1 trunk\n"); + switch (ftdm_span_get_trunk_type(span)) { + case FTDM_TRUNK_E1: + case FTDM_TRUNK_BRI: + case FTDM_TRUNK_BRI_PTMP: + ftdm_log(FTDM_LOG_NOTICE, "Setting default Layer 1 to ALAW since this is an E1/BRI/BRI PTMP trunk\n"); isdn_data->l1 = PRI_LAYER_1_ALAW; - } else if (span->trunk_type == FTDM_TRUNK_T1) { - ftdm_log(FTDM_LOG_NOTICE, "Setting default Layer 1 to ULAW since this is a T1 trunk\n"); + break; + case FTDM_TRUNK_T1: + case FTDM_TRUNK_J1: + ftdm_log(FTDM_LOG_NOTICE, "Setting default Layer 1 to ULAW since this is a T1/J1 trunk\n"); isdn_data->l1 = PRI_LAYER_1_ULAW; + break; + default: + ftdm_log(FTDM_LOG_ERROR, "Invalid trunk type\n"); + return FTDM_FAIL; } while ((var = va_arg(ap, char *))) { @@ -1416,7 +1454,10 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_libpri_configure_span) isdn_data->l1 = parse_l1(val); } else if (!strcasecmp(var, "debug")) { - isdn_data->debug = parse_debug(val); + if (parse_debug(val, &isdn_data->debug) == -1) { + ftdm_log(FTDM_LOG_ERROR, "Invalid debug flag, ignoring parameter\n"); + isdn_data->debug = 0; + } } else { snprintf(span->last_error, sizeof(span->last_error), "Unknown parameter [%s]", var); commit 46a9fa3910fa594188cb49b50b014e1ff6a1d403 Author: Moises Silva <moy@sangoma.com> Date: Sat Nov 6 17:14:31 2010 -0400 freetdm: add debugging msgs for zt wait errors diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 3ad4393..48bff28 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -657,7 +657,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch status = ftdm_channel_wait(tech_pvt->ftdmchan, &wflags, chunk); if (status == FTDM_FAIL) { - ftdm_log(FTDM_LOG_WARNING, "failed to wait for I/O\n"); + ftdm_log(FTDM_LOG_ERROR, "Failed to wait for I/O\n"); goto fail; } diff --git a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c index ae93984..692b505 100644 --- a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c +++ b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c @@ -867,7 +867,7 @@ static FIO_WAIT_FUNCTION(zt_wait) { int32_t inflags = 0; int result; - struct pollfd pfds[1]; + struct pollfd pfds[1]; if (*flags & FTDM_READ) { inflags |= POLLIN; @@ -882,13 +882,14 @@ static FIO_WAIT_FUNCTION(zt_wait) } - memset(&pfds[0], 0, sizeof(pfds[0])); - pfds[0].fd = ftdmchan->sockfd; - pfds[0].events = inflags; - result = poll(pfds, 1, to); + memset(&pfds[0], 0, sizeof(pfds[0])); + pfds[0].fd = ftdmchan->sockfd; + pfds[0].events = inflags; + result = poll(pfds, 1, to); *flags = 0; if (pfds[0].revents & POLLERR) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "DAHDI device got POLLERR\n"); result = -1; } @@ -900,6 +901,7 @@ static FIO_WAIT_FUNCTION(zt_wait) if (result < 0){ snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "Poll failed"); + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to poll DAHDI device: %s\n", strerror(errno)); return FTDM_FAIL; } commit b0e622987a6242156ed9009a4f555deb6d882943 Author: Jeff Lenk <jeff@jefflenk.com> Date: Sat Nov 6 13:22:20 2010 -0500 windows fix for last openssl commit diff --git a/libs/win32/openssl/libeay32.2010.vcxproj b/libs/win32/openssl/libeay32.2010.vcxproj index 135f482..ce341a5 100644 --- a/libs/win32/openssl/libeay32.2010.vcxproj +++ b/libs/win32/openssl/libeay32.2010.vcxproj @@ -115,7 +115,12 @@ if not exist "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\e_os.h" xcopy "$ </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PreBuildEvent> - <Command>copy /Y "$(ProjectDir)opensslconf.h" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h"</Command> + <Command>copy /Y "$(ProjectDir)opensslconf.h" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h" +copy /Y "$(ProjectDir)applink.c" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c" +copy /Y "$(ProjectDir)buildinf.h" "$(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h" +copy /Y "$(ProjectDir)libeay32.def" "$(ProjectDir)..\..\openssl-1.0.0a\libeay32.def" +if not exist "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\e_os.h" xcopy "$(ProjectDir)\include\*.*" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\" /C /Y /S +</Command> </PreBuildEvent> <Midl> <TargetEnvironment>X64</TargetEnvironment> @@ -146,7 +151,12 @@ if not exist "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\e_os.h" xcopy "$ </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PreBuildEvent> - <Command>copy /Y "$(ProjectDir)opensslconf.h" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h"</Command> + <Command>copy /Y "$(ProjectDir)opensslconf.h" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h" +copy /Y "$(ProjectDir)applink.c" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c" +copy /Y "$(ProjectDir)buildinf.h" "$(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h" +copy /Y "$(ProjectDir)libeay32.def" "$(ProjectDir)..\..\openssl-1.0.0a\libeay32.def" +if not exist "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\e_os.h" xcopy "$(ProjectDir)\include\*.*" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\" /C /Y /S +</Command> </PreBuildEvent> <ClCompile> <AdditionalOptions>/Gs0 %(AdditionalOptions)</AdditionalOptions> @@ -175,7 +185,12 @@ if not exist "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\e_os.h" xcopy "$ </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PreBuildEvent> - <Command>copy /Y "$(ProjectDir)opensslconf.h" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h"</Command> + <Command>copy /Y "$(ProjectDir)opensslconf.h" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h" +copy /Y "$(ProjectDir)applink.c" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c" +copy /Y "$(ProjectDir)buildinf.h" "$(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h" +copy /Y "$(ProjectDir)libeay32.def" "$(ProjectDir)..\..\openssl-1.0.0a\libeay32.def" +if not exist "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\e_os.h" xcopy "$(ProjectDir)\include\*.*" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\" /C /Y /S +</Command> </PreBuildEvent> <Midl> <TargetEnvironment>X64</TargetEnvironment> commit 583c96af5b31ee14413274add24142dcf5943f09 Merge: b9391cf 1627f6a Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Sat Nov 6 18:28:53 2010 +0100 Merge branch 'master' of ssh://git.freeswitch.org/freeswitch commit b9391cffc2e82c27184e81cd8723677d9e100ce2 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Sat Nov 6 18:28:37 2010 +0100 ftmod_libpri: Fix reversed PTP/PTMP mode parameter diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 9fed12d..137efae 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -1099,14 +1099,14 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) break; case FTDM_TRUNK_BRI: res = lpwrap_init_bri(&isdn_data->spri, span, isdn_data->dchan, - isdn_data->pswitch, isdn_data->node, 0, isdn_data->debug); + isdn_data->pswitch, isdn_data->node, 1, isdn_data->debug); #ifndef HAVE_LIBPRI_BRI goto out; #endif break; case FTDM_TRUNK_BRI_PTMP: res = lpwrap_init_bri(&isdn_data->spri, span, isdn_data->dchan, - isdn_data->pswitch, isdn_data->node, 1, isdn_data->debug); + isdn_data->pswitch, isdn_data->node, 0, isdn_data->debug); #ifndef HAVE_LIBPRI_BRI goto out; #endif diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c b/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c index 2cfdd82..5b04abe 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c @@ -195,9 +195,10 @@ int lpwrap_init_pri(struct lpwrap_pri *spri, ftdm_span_t *span, ftdm_channel_t * return ret; } -int lpwrap_init_bri(struct lpwrap_pri *spri, ftdm_span_t *span, ftdm_channel_t *dchan, int swtype, int node, int ptmp, int debug) +int lpwrap_init_bri(struct lpwrap_pri *spri, ftdm_span_t *span, ftdm_channel_t *dchan, int swtype, int node, int ptp, int debug) { int ret = -1; + #ifdef HAVE_LIBPRI_BRI memset(spri, 0, sizeof(struct lpwrap_pri)); spri->dchan = dchan; @@ -208,7 +209,7 @@ int lpwrap_init_bri(struct lpwrap_pri *spri, ftdm_span_t *span, ftdm_channel_t * return ret; } - if ((spri->pri = pri_new_bri_cb(spri->dchan->sockfd, ptmp, node, swtype, __pri_lpwrap_read, __pri_lpwrap_write, spri))) { + if ((spri->pri = pri_new_bri_cb(spri->dchan->sockfd, ptp, node, swtype, __pri_lpwrap_read, __pri_lpwrap_write, spri))) { unsigned char buf[4] = { 0 }; size_t buflen = sizeof(buf), len = 0; diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.h b/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.h index d3d1c43..4701e27 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.h +++ b/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.h @@ -121,7 +121,7 @@ struct lpwrap_pri_event_list { const char *lpwrap_pri_event_str(lpwrap_pri_event_t event_id); int lpwrap_one_loop(struct lpwrap_pri *spri); int lpwrap_init_pri(struct lpwrap_pri *spri, ftdm_span_t *span, ftdm_channel_t *dchan, int swtype, int node, int debug); -int lpwrap_init_bri(struct lpwrap_pri *spri, ftdm_span_t *span, ftdm_channel_t *dchan, int swtype, int node, int ptmp, int debug); +int lpwrap_init_bri(struct lpwrap_pri *spri, ftdm_span_t *span, ftdm_channel_t *dchan, int swtype, int node, int ptp, int debug); int lpwrap_run_pri(struct lpwrap_pri *spri); #define lpwrap_run_bri(x) lpwrap_run_pri(x) commit 1627f6a541239d14db1db6cefd781c4f8aebd127 Author: Jeff Lenk <jeff@jefflenk.com> Date: Sat Nov 6 12:24:30 2010 -0500 windows openssl fix spaces is build path diff --git a/libs/win32/openssl/libeay32.2008.vcproj b/libs/win32/openssl/libeay32.2008.vcproj index 84cc80b..5681c7c 100644 --- a/libs/win32/openssl/libeay32.2008.vcproj +++ b/libs/win32/openssl/libeay32.2008.vcproj @@ -32,7 +32,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="copy /Y $(ProjectDir)opensslconf.h $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h copy /Y $(ProjectDir)applink.c $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c copy /Y $(ProjectDir)buildinf.h $(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h copy /Y $(ProjectDir)libeay32.def $(ProjectDir)..\..\openssl-1.0.0a\libeay32.def if not exist " $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\e_os.h" xcopy "$(ProjectDir)\include\*.*" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\" /C /Y /S " + CommandLine="copy /Y "$(ProjectDir)opensslconf.h" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h" copy /Y "$(ProjectDir)applink.c" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c" copy /Y "$(ProjectDir)buildinf.h" "$(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h" copy /Y "$(ProjectDir)libeay32.def" "$(ProjectDir)..\..\openssl-1.0.0a\libeay32.def" if not exist " $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\e_os.h" xcopy "$(ProjectDir)\include\*.*" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\" /C /Y /S " /> <Tool Name="VCCustomBuildTool" @@ -116,7 +116,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="copy /Y $(ProjectDir)opensslconf.h $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h copy /Y $(ProjectDir)applink.c $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c copy /Y $(ProjectDir)buildinf.h $(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h copy /Y $(ProjectDir)libeay32.def $(ProjectDir)..\..\openssl-1.0.0a\libeay32.def if not exist " $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\e_os.h" xcopy "$(ProjectDir)\include\*.*" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\" /C /Y /S " + CommandLine="copy /Y "$(ProjectDir)opensslconf.h" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h" copy /Y "$(ProjectDir)applink.c" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c" copy /Y "$(ProjectDir)buildinf.h" "$(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h" copy /Y "$(ProjectDir)libeay32.def" "$(ProjectDir)..\..\openssl-1.0.0a\libeay32.def" if not exist " $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\e_os.h" xcopy "$(ProjectDir)\include\*.*" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\" /C /Y /S " /> <Tool Name="VCCustomBuildTool" @@ -201,7 +201,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="copy /Y $(ProjectDir)opensslconf.h $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h copy /Y $(ProjectDir)applink.c $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c copy /Y $(ProjectDir)buildinf.h $(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h copy /Y $(ProjectDir)libeay32.def $(ProjectDir)..\..\openssl-1.0.0a\libeay32.def if not exist " $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\e_os.h" xcopy "$(ProjectDir)\include\*.*" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\" /C /Y /S " + CommandLine="copy /Y "$(ProjectDir)opensslconf.h" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h" copy /Y "$(ProjectDir)applink.c" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c" copy /Y "$(ProjectDir)buildinf.h" "$(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h" copy /Y "$(ProjectDir)libeay32.def" "$(ProjectDir)..\..\openssl-1.0.0a\libeay32.def" if not exist " $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\e_os.h" xcopy "$(ProjectDir)\include\*.*" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\" /C /Y /S " /> <Tool Name="VCCustomBuildTool" @@ -286,7 +286,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="copy /Y $(ProjectDir)opensslconf.h $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h copy /Y $(ProjectDir)applink.c $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c copy /Y $(ProjectDir)buildinf.h $(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h copy /Y $(ProjectDir)libeay32.def $(ProjectDir)..\..\openssl-1.0.0a\libeay32.def if not exist " $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\e_os.h" xcopy "$(ProjectDir)\include\*.*" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\" /C /Y /S " + CommandLine="copy /Y "$(ProjectDir)opensslconf.h" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h" copy /Y "$(ProjectDir)applink.c" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c" copy /Y "$(ProjectDir)buildinf.h" "$(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h" copy /Y "$(ProjectDir)libeay32.def" "$(ProjectDir)..\..\openssl-1.0.0a\libeay32.def" if not exist " $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\e_os.h" xcopy "$(ProjectDir)\include\*.*" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\" /C /Y /S " /> <Tool Name="VCCustomBuildTool" diff --git a/libs/win32/openssl/libeay32.2010.vcxproj b/libs/win32/openssl/libeay32.2010.vcxproj index 4d0d9a4..135f482 100644 --- a/libs/win32/openssl/libeay32.2010.vcxproj +++ b/libs/win32/openssl/libeay32.2010.vcxproj @@ -81,10 +81,10 @@ </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PreBuildEvent> - <Command>copy /Y $(ProjectDir)opensslconf.h $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h -copy /Y $(ProjectDir)applink.c $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c -copy /Y $(ProjectDir)buildinf.h $(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h -copy /Y $(ProjectDir)libeay32.def $(ProjectDir)..\..\openssl-1.0.0a\libeay32.def + <Command>copy /Y "$(ProjectDir)opensslconf.h" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h" +copy /Y "$(ProjectDir)applink.c" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c" +copy /Y "$(ProjectDir)buildinf.h" "$(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h" +copy /Y "$(ProjectDir)libeay32.def" "$(ProjectDir)..\..\openssl-1.0.0a\libeay32.def" if not exist "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\e_os.h" xcopy "$(ProjectDir)\include\*.*" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\" /C /Y /S </Command> </PreBuildEvent> @@ -115,12 +115,7 @@ if not exist "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\e_os.h" xcopy "$ </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PreBuildEvent> - <Command>copy /Y $(ProjectDir)opensslconf.h $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h -copy /Y $(ProjectDir)applink.c $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c -copy /Y $(ProjectDir)buildinf.h $(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h -copy /Y $(ProjectDir)libeay32.def $(ProjectDir)..\..\openssl-1.0.0a\libeay32.def -if not exist "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\e_os.h" xcopy "$(ProjectDir)\include\*.*" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\" /C /Y /S -</Command> + <Command>copy /Y "$(ProjectDir)opensslconf.h" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h"</Command> </PreBuildEvent> <Midl> <TargetEnvironment>X64</TargetEnvironment> @@ -151,12 +146,7 @@ if not exist "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\e_os.h" xcopy "$ </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PreBuildEvent> - <Command>copy /Y $(ProjectDir)opensslconf.h $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h -copy /Y $(ProjectDir)applink.c $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c -copy /Y $(ProjectDir)buildinf.h $(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h -copy /Y $(ProjectDir)libeay32.def $(ProjectDir)..\..\openssl-1.0.0a\libeay32.def -if not exist "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\e_os.h" xcopy "$(ProjectDir)\include\*.*" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\" /C /Y /S -</Command> + <Command>copy /Y "$(ProjectDir)opensslconf.h" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h"</Command> </PreBuildEvent> <ClCompile> <AdditionalOptions>/Gs0 %(AdditionalOptions)</AdditionalOptions> @@ -185,12 +175,7 @@ if not exist "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\e_os.h" xcopy "$ </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PreBuildEvent> - <Command>copy /Y $(ProjectDir)opensslconf.h $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h -copy /Y $(ProjectDir)applink.c $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c -copy /Y $(ProjectDir)buildinf.h $(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h -copy /Y $(ProjectDir)libeay32.def $(ProjectDir)..\..\openssl-1.0.0a\libeay32.def -if not exist "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\e_os.h" xcopy "$(ProjectDir)\include\*.*" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\" /C /Y /S -</Command> + <Command>copy /Y "$(ProjectDir)opensslconf.h" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h"</Command> </PreBuildEvent> <Midl> <TargetEnvironment>X64</TargetEnvironment> diff --git a/libs/win32/openssl/ssleay32.2008.vcproj b/libs/win32/openssl/ssleay32.2008.vcproj index 1d8654a..fef7e5c 100644 --- a/libs/win32/openssl/ssleay32.2008.vcproj +++ b/libs/win32/openssl/ssleay32.2008.vcproj @@ -29,7 +29,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="copy /Y $(ProjectDir)ssleay32.def $(ProjectDir)..\..\openssl-1.0.0a\ssleay32.def" + CommandLine="copy /Y "$(ProjectDir)ssleay32.def" "$(ProjectDir)..\..\openssl-1.0.0a\ssleay32.def"" /> <Tool Name="VCCustomBuildTool" @@ -108,7 +108,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="copy /Y $(ProjectDir)ssleay32.def $(ProjectDir)..\..\openssl-1.0.0a\ssleay32.def" + CommandLine="copy /Y "$(ProjectDir)ssleay32.def" "$(ProjectDir)..\..\openssl-1.0.0a\ssleay32.def"" /> <Tool Name="VCCustomBuildTool" @@ -188,7 +188,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="copy /Y $(ProjectDir)ssleay32.def $(ProjectDir)..\..\openssl-1.0.0a\ssleay32.def" + CommandLine="copy /Y "$(ProjectDir)ssleay32.def" "$(ProjectDir)..\..\openssl-1.0.0a\ssleay32.def"" /> <Tool Name="VCCustomBuildTool" @@ -268,7 +268,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="copy /Y $(ProjectDir)ssleay32.def $(ProjectDir)..\..\openssl-1.0.0a\ssleay32.def" + CommandLine="copy /Y "$(ProjectDir)ssleay32.def" "$(ProjectDir)..\..\openssl-1.0.0a\ssleay32.def"" /> <Tool Name="VCCustomBuildTool" diff --git a/libs/win32/openssl/ssleay32.2010.vcxproj b/libs/win32/openssl/ssleay32.2010.vcxproj index 1a444bb..5312abe 100644 --- a/libs/win32/openssl/ssleay32.2010.vcxproj +++ b/libs/win32/openssl/ssleay32.2010.vcxproj @@ -80,7 +80,7 @@ </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PreBuildEvent> - <Command>copy /Y $(ProjectDir)ssleay32.def $(ProjectDir)..\..\openssl-1.0.0a\ssleay32.def</Command> + <Command>copy /Y "$(ProjectDir)ssleay32.def" "$(ProjectDir)..\..\openssl-1.0.0a\ssleay32.def"</Command> </PreBuildEvent> <ClCompile> <AdditionalOptions>/Gs0 %(AdditionalOptions)</AdditionalOptions> @@ -107,7 +107,7 @@ </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PreBuildEvent> - <Command>copy /Y $(ProjectDir)ssleay32.def $(ProjectDir)..\..\openssl-1.0.0a\ssleay32.def</Command> + <Command>copy /Y "$(ProjectDir)ssleay32.def" "$(ProjectDir)..\..\openssl-1.0.0a\ssleay32.def"</Command> </PreBuildEvent> <ClCompile> <AdditionalOptions>/Gs0 %(AdditionalOptions)</AdditionalOptions> @@ -134,7 +134,7 @@ </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PreBuildEvent> - <Command>copy /Y $(ProjectDir)ssleay32.def $(ProjectDir)..\..\openssl-1.0.0a\ssleay32.def</Command> + <Command>copy /Y "$(ProjectDir)ssleay32.def" "$(ProjectDir)..\..\openssl-1.0.0a\ssleay32.def"</Command> </PreBuildEvent> <Midl> <TargetEnvironment>X64</TargetEnvironment> @@ -164,7 +164,7 @@ </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PreBuildEvent> - <Command>copy /Y $(ProjectDir)ssleay32.def $(ProjectDir)..\..\openssl-1.0.0a\ssleay32.def</Command> + <Command>copy /Y "$(ProjectDir)ssleay32.def" "$(ProjectDir)..\..\openssl-1.0.0a\ssleay32.def"</Command> </PreBuildEvent> <Midl> <TargetEnvironment>X64</TargetEnvironment> commit 6ca919be615a2a6db1a3096e5068b9b9265ad28a Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Sat Nov 6 18:12:27 2010 +0100 ftmod_libpri: BRI Support requires libpri-1.4.12_beta1 or newer, add message to configure check diff --git a/libs/freetdm/configure.ac b/libs/freetdm/configure.ac index c27d116..7589957 100644 --- a/libs/freetdm/configure.ac +++ b/libs/freetdm/configure.ac @@ -215,7 +215,8 @@ then )], [AC_DEFINE([HAVE_LIBPRI_BRI], [1], [libpri has bri support]) AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no])] + [AC_MSG_RESULT([no]) + AC_MSG_NOTICE([You will need libpri-1.4.12_beta1 or newer for BRI support])] ) LIBS="${save_LIBS}" fi commit 30fb69bbabab3ce098638642680976c463593238 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Sat Nov 6 17:58:41 2010 +0100 ftmod_libpri: temporary segfault fix if libpri does not have BRI support diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 6e09562..9fed12d 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -1100,10 +1100,16 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) case FTDM_TRUNK_BRI: res = lpwrap_init_bri(&isdn_data->spri, span, isdn_data->dchan, isdn_data->pswitch, isdn_data->node, 0, isdn_data->debug); +#ifndef HAVE_LIBPRI_BRI + goto out; +#endif break; case FTDM_TRUNK_BRI_PTMP: res = lpwrap_init_bri(&isdn_data->spri, span, isdn_data->dchan, isdn_data->pswitch, isdn_data->node, 1, isdn_data->debug); +#ifndef HAVE_LIBPRI_BRI + goto out; +#endif break; default: snprintf(span->last_error, sizeof(span->last_error), "Invalid trunk type"); commit 3d5ccf055d90134c48bcbe697daea19d5acafa81 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Sat Nov 6 16:08:07 2010 +0100 ftmod_libpri: Initial support for BRI and various cleanups + double locking fix Fixes: - Fix double locking in check_state(): remove ftdm_mutex_(un)lock calls. New: - Add lpwrap_init_bri() to initialize libpri in BRI mode - Use trunk type to determine PRI/BRI and PTP/PTMP mode (no additional configuration required). - Improve libpri detection code in configure.ac, check whether libpri is usable and if BRI support is available (needs more work) Cleanups: - Whitespace and indentation cleanups - Rename str2* functions to parse_* - Simplify libpri_configure_span() option parsing and bail out on error - Add "ftdm libpri help" command that displays usage information - Coding style cleanups and other (minor) changes Known issues: - BRI PTMP TE Q.921 link does not go beyond TEI ASSIGNED state, SABME requests are ignored by NT (EuroISDN DTAG, DAHDI-2.3.0.1, vzaphfc) Signed-off-by: Stefan Knoblich <s.knoblich@axsentis.de> diff --git a/libs/freetdm/configure.ac b/libs/freetdm/configure.ac index 9f74d94..c27d116 100644 --- a/libs/freetdm/configure.ac +++ b/libs/freetdm/configure.ac @@ -145,21 +145,6 @@ fi AC_MSG_RESULT([${as_nl}<<>> Modules and optional features]) ## -# libpri (TODO: add checks) -# -HAVE_LIBPRI="no" -AC_ARG_WITH([libpri], - [AS_HELP_STRING([--with-libpri], [Install ftmod_libpri])], - [case "${withval}" in - no) enable_libpri="no" ;; - *) enable_libpri="yes" ;; - esac], - [enable_libpri="no"] -) -HAVE_LIBPRI="${enable_libpri}" -AM_CONDITIONAL([HAVE_LIBPRI],[test "${enable_libpri}" = "yes"]) - -## # pritap (TODO: add checks) # HAVE_PRITAP="no" @@ -194,6 +179,50 @@ AC_MSG_RESULT([checking whether to build ftmod_r2... ${HAVE_OPENR2}]) AM_CONDITIONAL([HAVE_OPENR2], [test "${HAVE_OPENR2}" = "yes"]) ## +# Digium libpri (TODO: add checks) +# +HAVE_LIBPRI="no" +AC_ARG_WITH([libpri], + [AS_HELP_STRING([--with-libpri], [Install ftmod_libpri])], + [case "${withval}" in + no) enable_libpri="no" ;; + *) enable_libpri="yes" ;; + esac], + [enable_libpri="no"] +) +if test "${enable_libpri}" != "no" +then + AC_MSG_RESULT([${as_nl}<<>> Digium libpri]) + + save_LIBS="${LIBS}" + LIBS="${LIBS} -lpri" + AC_MSG_CHECKING([whether libpri is usable]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [#include <libpri.h>], + [const char *version = pri_get_version();] + )], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + AC_MSG_ERROR([libpri is not installed or unusable (see config.log for details)])] + ) + + AC_MSG_CHECKING([whether libpri has BRI support]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [extern void pri_new_bri_cb(void);], + [pri_new_bri_cb();] + )], + [AC_DEFINE([HAVE_LIBPRI_BRI], [1], [libpri has bri support]) + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])] + ) + LIBS="${save_LIBS}" +fi +HAVE_LIBPRI="${enable_libpri}" +AM_CONDITIONAL([HAVE_LIBPRI],[test "${enable_libpri}" = "yes"]) + +## # Sangoma Wanpipe # HAVE_LIBSANGOMA="no" diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 444b907..6e09562 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -1,23 +1,23 @@ /* * Copyright (c) 2007, Anthony Minessale II * 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 original author; nor the names of any 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 @@ -140,35 +140,7 @@ static void s_pri_message(char *s) static void s_pri_message(struct pri *pri, char *s) #endif { - ftdm_log(FTDM_LOG_DEBUG, "%s", s); -} - -/** - * \brief Parses an option string to flags - * \param in String to parse for configuration options - * \return Flags - */ -static uint32_t parse_opts(const char *in) -{ - uint32_t flags = 0; - - if (!in) { - return 0; - } - - if (strstr(in, "suggest_channel")) { - flags |= FTMOD_LIBPRI_OPT_SUGGEST_CHANNEL; - } - - if (strstr(in, "omit_display")) { - flags |= FTMOD_LIBPRI_OPT_OMIT_DISPLAY_IE; - } - - if (strstr(in, "omit_redirecting_number")) { - flags |= FTMOD_LIBPRI_OPT_OMIT_REDIRECTING_NUMBER_IE; - } - - return flags; + ftdm_log(FTDM_LOG_DEBUG, "%s", s); } /** @@ -187,43 +159,33 @@ static int parse_debug(const char *in) if (strstr(in, "q921_raw")) { flags |= PRI_DEBUG_Q921_RAW; } - if (strstr(in, "q921_dump")) { flags |= PRI_DEBUG_Q921_DUMP; } - if (strstr(in, "q921_state")) { flags |= PRI_DEBUG_Q921_STATE; } - if (strstr(in, "config")) { flags |= PRI_DEBUG_CONFIG; } - if (strstr(in, "q931_dump")) { flags |= PRI_DEBUG_Q931_DUMP; } - if (strstr(in, "q931_state")) { flags |= PRI_DEBUG_Q931_STATE; } - if (strstr(in, "q931_anomaly")) { flags |= PRI_DEBUG_Q931_ANOMALY; } - if (strstr(in, "apdu")) { flags |= PRI_DEBUG_APDU; } - if (strstr(in, "aoc")) { flags |= PRI_DEBUG_AOC; } - if (strstr(in, "all")) { flags |= PRI_DEBUG_ALL; } - if (strstr(in, "none")) { flags = 0; } @@ -231,9 +193,13 @@ static int parse_debug(const char *in) return flags; } +static ftdm_status_t ftdm_libpri_start(ftdm_span_t *span); static ftdm_io_interface_t ftdm_libpri_interface; -static ftdm_status_t ftdm_libpri_start(ftdm_span_t *span); +static const char *ftdm_libpri_usage = + "Usage:\n" + "libpri kill <span>\n" + "libpri debug <span> <level>\n"; /** * \brief API function to kill or debug a libpri span @@ -244,13 +210,20 @@ static ftdm_status_t ftdm_libpri_start(ftdm_span_t *span); static FIO_API_FUNCTION(ftdm_libpri_api) { char *mycmd = NULL, *argv[10] = { 0 }; - int argc = 0; - + int argc = 0; + if (data) { mycmd = ftdm_strdup(data); argc = ftdm_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); } + if (argc == 1) { + if (!strcasecmp(argv[0], "help") || !strcasecmp(argv[0], "usage")) { + stream->write_function(stream, ftdm_libpri_usage); + goto done; + } + } + if (argc == 2) { if (!strcasecmp(argv[0], "kill")) { int span_id = atoi(argv[1]); @@ -285,7 +258,7 @@ static FIO_API_FUNCTION(ftdm_libpri_api) goto done; } - pri_set_debug(isdn_data->spri.pri, parse_debug(argv[2])); + pri_set_debug(isdn_data->spri.pri, parse_debug(argv[2])); stream->write_function(stream, "%s: +OK debug set.\n", __FILE__); goto done; } else { @@ -295,16 +268,15 @@ static FIO_API_FUNCTION(ftdm_libpri_api) } } - stream->write_function(stream, "%s: -ERR invalid command.\n", __FILE__); - - done: +done: ftdm_safe_free(mycmd); return FTDM_SUCCESS; } + /** * \brief Loads libpri IO module * \param fio FreeTDM IO interface @@ -313,10 +285,10 @@ static FIO_API_FUNCTION(ftdm_libpri_api) static FIO_IO_LOAD_FUNCTION(ftdm_libpri_io_init) { assert(fio != NULL); - memset(&ftdm_libpri_interface, 0, sizeof(ftdm_libpri_interface)); + memset(&ftdm_libpri_interface, 0, sizeof(ftdm_libpri_interface)); ftdm_libpri_interface.name = "libpri"; - ftdm_libpri_interface.api = ftdm_libpri_api; + ftdm_libpri_interface.api = &ftdm_libpri_api; *fio = &ftdm_libpri_interface; @@ -445,8 +417,6 @@ static ftdm_state_map_t isdn_state_map = { {FTDM_CHANNEL_STATE_UP, FTDM_END}, {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_END}, }, - - } }; @@ -461,11 +431,9 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) ftdm_status_t status; ftdm_sigmsg_t sig; q931_call *call = (q931_call *) ftdmchan->call_data; - - - ftdm_log(FTDM_LOG_DEBUG, "%d:%d STATE [%s]\n", - ftdmchan->span_id, ftdmchan->chan_id, ftdm_channel_state2str(ftdmchan->state)); + ftdm_log(FTDM_LOG_DEBUG, "%d:%d STATE [%s]\n", + ftdmchan->span_id, ftdmchan->chan_id, ftdm_channel_state2str(ftdmchan->state)); #if 0 if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) && !call) { @@ -473,7 +441,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) } #endif - + memset(&sig, 0, sizeof(sig)); sig.chan_id = ftdmchan->chan_id; sig.span_id = ftdmchan->span_id; @@ -484,7 +452,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) case FTDM_CHANNEL_STATE_DOWN: { ftdmchan->call_data = NULL; - ftdm_channel_done(ftdmchan); + ftdm_channel_done(ftdmchan); } break; case FTDM_CHANNEL_STATE_PROGRESS: @@ -562,7 +530,6 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) return; } - dp = ftdmchan->caller_data.dnis.type; switch(dp) { case FTDM_TON_NATIONAL: @@ -584,15 +551,18 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) pri_sr_set_channel(sr, ftdmchan->chan_id, 0, 0); pri_sr_set_bearer(sr, 0, isdn_data->l1); pri_sr_set_called(sr, ftdmchan->caller_data.dnis.digits, dp, 1); - pri_sr_set_caller(sr, ftdmchan->caller_data.cid_num.digits, (isdn_data->opts & FTMOD_LIBPRI_OPT_OMIT_DISPLAY_IE ? NULL : ftdmchan->caller_data.cid_name), - dp, (ftdmchan->caller_data.pres != 1 ? PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN : PRES_PROHIB_USER_NUMBER_NOT_SCREENED)); + pri_sr_set_caller(sr, ftdmchan->caller_data.cid_num.digits, + (isdn_data->opts & FTMOD_LIBPRI_OPT_OMIT_DISPLAY_IE ? NULL : ftdmchan->caller_data.cid_name), + dp, + (ftdmchan->caller_data.pres != 1 ? PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN : PRES_PROHIB_USER_NUMBER_NOT_SCREENED)); if (!(isdn_data->opts & FTMOD_LIBPRI_OPT_OMIT_REDIRECTING_NUMBER_IE)) { - pri_sr_set_redirecting(sr, ftdmchan->caller_data.cid_num.digits, dp, PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN, PRI_REDIR_UNCONDITIONAL); + pri_sr_set_redirecting(sr, ftdmchan->caller_data.cid_num.digits, dp, + PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN, PRI_REDIR_UNCONDITIONAL); } if (pri_setup(isdn_data->spri.pri, call, sr)) { - ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_DESTINATION_OUT_OF_ORDER; + ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_DESTINATION_OUT_OF_ORDER; ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); } @@ -606,7 +576,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) pri_hangup(isdn_data->spri.pri, call, ftdmchan->caller_data.hangup_cause); pri_destroycall(isdn_data->spri.pri, call); ftdmchan->call_data = NULL; - } + } ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); } break; @@ -633,21 +603,23 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) */ static __inline__ void check_state(ftdm_span_t *span) { - if (ftdm_test_flag(span, FTDM_SPAN_STATE_CHANGE)) { - uint32_t j; - ftdm_clear_flag_locked(span, FTDM_SPAN_STATE_CHANGE); - for(j = 1; j <= span->chan_count; j++) { - if (ftdm_test_flag((span->channels[j]), FTDM_CHANNEL_STATE_CHANGE)) { - ftdm_mutex_lock(span->channels[j]->mutex); - ftdm_channel_lock(span->channels[j]); - ftdm_clear_flag((span->channels[j]), FTDM_CHANNEL_STATE_CHANGE); - state_advance(span->channels[j]); - ftdm_channel_complete_state(span->channels[j]); - ftdm_mutex_unlock(span->channels[j]->mutex); - ftdm_channel_unlock(span->channels[j]); - } - } - } + if (ftdm_test_flag(span, FTDM_SPAN_STATE_CHANGE)) { + uint32_t j; + + ftdm_clear_flag_locked(span, FTDM_SPAN_STATE_CHANGE); + + for (j = 1; j <= span->chan_count; j++) { + if (ftdm_test_flag((span->channels[j]), FTDM_CHANNEL_STATE_CHANGE)) { + ftdm_channel_lock(span->channels[j]); + + ftdm_clear_flag((span->channels[j]), FTDM_CHANNEL_STATE_CHANGE); + state_advance(span->channels[j]); + ftdm_channel_complete_state(span->channels[j]); + + ftdm_channel_unlock(span->channels[j]); + } + } + } } /** @@ -659,7 +631,6 @@ static __inline__ void check_state(ftdm_span_t *span) */ static int on_info(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) { - ftdm_log(FTDM_LOG_DEBUG, "number is: %s\n", pevent->ring.callednum); if (strlen(pevent->ring.callednum) > 3) { ftdm_log(FTDM_LOG_DEBUG, "final number is: %s\n", pevent->ring.callednum); @@ -681,7 +652,7 @@ static int on_hangup(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_even ftdm_channel_t *ftdmchan = NULL; q931_call *call = NULL; ftdmchan = span->channels[pevent->hangup.channel]; - + if (!ftdmchan) { ftdm_log(FTDM_LOG_CRIT, "-- Hangup on channel %d:%d %s but it's not in use?\n", spri->span->span_id, pevent->hangup.channel); return 0; @@ -698,7 +669,7 @@ static int on_hangup(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_even ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Ignoring remote hangup in state %s with no call data\n", ftdm_channel_state2str(ftdmchan->state)); goto done; } - + call = (q931_call *) ftdmchan->call_data; ftdm_log(FTDM_LOG_DEBUG, "-- Hangup on channel %d:%d\n", spri->span->span_id, pevent->hangup.channel); ftdmchan->caller_data.hangup_cause = pevent->hangup.cause; @@ -727,13 +698,12 @@ static int on_answer(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_even ftdm_channel_t *ftdmchan = NULL; ftdmchan = span->channels[pevent->answer.channel]; - + if (ftdmchan) { ftdm_log(FTDM_LOG_DEBUG, "-- Answer on channel %d:%d\n", spri->span->span_id, pevent->answer.channel); ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); } else { ftdm_log(FTDM_LOG_DEBUG, "-- Answer on channel %d:%d %s but it's not in use?\n", spri->span->span_id, pevent->answer.channel, ftdmchan->chan_id); - } return 0; @@ -750,9 +720,9 @@ static int on_proceed(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_eve { ftdm_span_t *span = spri->private_info; ftdm_channel_t *ftdmchan = NULL; - + ftdmchan = span->channels[pevent->proceeding.channel]; - + if (ftdmchan) { ftdm_log(FTDM_LOG_DEBUG, "-- Proceeding on channel %d:%d\n", spri->span->span_id, pevent->proceeding.channel); ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); @@ -777,7 +747,7 @@ static int on_ringing(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_eve ftdm_channel_t *ftdmchan = NULL; ftdmchan = span->channels[pevent->ringing.channel]; - + if (ftdmchan) { ftdm_log(FTDM_LOG_DEBUG, "-- Ringing on channel %d:%d\n", spri->span->span_id, pevent->ringing.channel); /* we may get on_ringing even when we're already in FTDM_CHANNEL_STATE_PROGRESS_MEDIA */ @@ -808,7 +778,7 @@ static int on_ring(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event int ret = 0; //switch_mutex_lock(globals.channel_mutex); - + ftdmchan = span->channels[pevent->ring.channel]; if (!ftdmchan || ftdmchan->state != FTDM_CHANNEL_STATE_DOWN || ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)) { ftdm_log(FTDM_LOG_WARNING, "--Duplicate Ring on channel %d:%d (ignored)\n", spri->span->span_id, pevent->ring.channel); @@ -821,13 +791,12 @@ static int on_ring(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event ret = 0; goto done; } - ftdm_log(FTDM_LOG_NOTICE, "-- Ring on channel %d:%d (from %s to %s)\n", spri->span->span_id, pevent->ring.channel, pevent->ring.callingnum, pevent->ring.callednum); - + memset(&ftdmchan->caller_data, 0, sizeof(ftdmchan->caller_data)); - + ftdm_set_string(ftdmchan->caller_data.cid_num.digits, (char *)pevent->ring.callingnum); if (!ftdm_strlen_zero((char *)pevent->ring.callingname)) { ftdm_set_string(ftdmchan->caller_data.cid_name, (char *)pevent->ring.callingname); @@ -836,19 +805,18 @@ static int on_ring(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event } ftdm_set_string(ftdmchan->caller_data.ani.digits, (char *)pevent->ring.callingani); ftdm_set_string(ftdmchan->caller_data.dnis.digits, (char *)pevent->ring.callednum); - + if (pevent->ring.ani2 >= 0) { snprintf(ftdmchan->caller_data.aniII, 5, "%.2d", pevent->ring.ani2); } - + // scary to trust this pointer, you'd think they would give you a copy of the call data so you own it...... ftdmchan->call_data = pevent->ring.call; - + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RING); - - done: - //switch_mutex_unlock(globals.channel_mutex); +done: + //switch_mutex_unlock(globals.channel_mutex); return ret; } @@ -861,8 +829,13 @@ static int on_ring(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *event) { ftdm_alarm_flag_t alarmbits; - ftdm_log(FTDM_LOG_DEBUG, "EVENT [%s][%d][%d:%d] STATE [%s]\n", - ftdm_oob_event2str(event->enum_id), event->enum_id, event->channel->span_id, event->channel->chan_id, ftdm_channel_state2str(event->channel->state)); + + ftdm_log(FTDM_LOG_DEBUG, "EVENT [%s][%d][%d:%d] STATE [%s]\n", + ftdm_oob_event2str(event->enum_id), + event->enum_id, + event->channel->span_id, + event->channel->chan_id, + ftdm_channel_state2str(event->channel->state)); switch(event->enum_id) { case FTDM_OOB_ALARM_TRAP: @@ -872,11 +845,9 @@ static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *e ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_RESTART); } } - ftdm_set_flag(event->channel, FTDM_CHANNEL_SUSPENDED); - ftdm_channel_get_alarms(event->channel, &alarmbits); ftdm_log(FTDM_LOG_WARNING, "channel %d:%d (%d:%d) has alarms! [%s]\n", event->channel->span_id, event->channel->chan_id, @@ -886,7 +857,6 @@ static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *e break; case FTDM_OOB_ALARM_CLEAR: { - ftdm_log(FTDM_LOG_WARNING, "channel %d:%d (%d:%d) alarms Cleared!\n", event->channel->span_id, event->channel->chan_id, event->channel->physical_span_id, event->channel->physical_chan_id); @@ -905,14 +875,11 @@ static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *e */ static __inline__ void check_events(ftdm_span_t *span) { - ftdm_status_t status; - - status = ftdm_span_poll_event(span, 5); - - switch(status) { + switch (ftdm_span_poll_event(span, 5)) { case FTDM_SUCCESS: { ftdm_event_t *event; + while (ftdm_span_next_event(span, &event) == FTDM_SUCCESS) { if (event->enum_id == FTDM_OOB_NOOP) { continue; @@ -923,12 +890,12 @@ static __inline__ void check_events(ftdm_span_t *span) } } break; + case FTDM_FAIL: - { - ftdm_log(FTDM_LOG_DEBUG, "Event Failure! %d\n", ftdm_running()); - ftdm_sleep(2000); - } + ftdm_log(FTDM_LOG_DEBUG, "Event Failure! %d\n", ftdm_running()); + ftdm_sleep(2000); break; + default: break; } @@ -949,8 +916,6 @@ static int check_flags(lpwrap_pri_t *spri) check_state(span); check_events(span); - - return 0; } @@ -967,7 +932,7 @@ static int on_restart(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_eve ftdm_channel_t *ftdmchan; ftdm_log(FTDM_LOG_NOTICE, "-- Restarting %d:%d\n", spri->span->span_id, pevent->restart.channel); - + spri->dchan->state = FTDM_CHANNEL_STATE_UP; ftdmchan = span->channels[pevent->restart.channel]; @@ -998,19 +963,23 @@ static int on_dchan_up(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ev ftdm_channel_t *ftdmchan = NULL; ftdm_sigmsg_t sig; int i; + ftdm_log(FTDM_LOG_INFO, "Span %d D-Chan UP!\n", spri->span->span_id); ftdm_set_flag(spri, LPWRAP_PRI_READY); ftdm_set_state_all(spri->span, FTDM_CHANNEL_STATE_RESTART); ftdm_log(FTDM_LOG_NOTICE, "%d:Signaling link status changed to %s\n", spri->span->span_id, ftdm_signaling_status2str(status)); - for(i=1; i <= spri->span->chan_count; i++) { + + for (i = 1; i <= spri->span->chan_count; i++) { ftdmchan = spri->span->channels[i]; + memset(&sig, 0, sizeof(sig)); sig.chan_id = ftdmchan->chan_id; sig.span_id = ftdmchan->span_id; sig.channel = ftdmchan; sig.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; sig.raw_data = &status; + ftdm_span_send_signal(spri->span, &sig); } } @@ -1025,26 +994,29 @@ static int on_dchan_up(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ev * \return 0 */ static int on_dchan_down(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) -{ +{ if (ftdm_test_flag(spri, LPWRAP_PRI_READY)) { ftdm_signaling_status_t status = FTDM_SIG_STATE_DOWN; ftdm_channel_t *ftdmchan = NULL; ftdm_sigmsg_t sig; int i; + ftdm_log(FTDM_LOG_INFO, "Span %d D-Chan DOWN!\n", spri->span->span_id); ftdm_clear_flag(spri, LPWRAP_PRI_READY); ftdm_set_state_all(spri->span, FTDM_CHANNEL_STATE_RESTART); - ftdm_log(FTDM_LOG_NOTICE, "%d:Signaling link status changed to %s\n", spri->span->span_id, ftdm_signaling_status2str(status)); - for(i=1; i <= spri->span->chan_count; i++) { + + for (i = 1; i <= spri->span->chan_count; i++) { ftdmchan = spri->span->channels[i]; + memset(&sig, 0, sizeof(sig)); sig.chan_id = ftdmchan->chan_id; sig.span_id = ftdmchan->span_id; sig.channel = ftdmchan; sig.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; sig.raw_data = &status; + ftdm_span_send_signal(spri->span, &sig); } } @@ -1061,7 +1033,6 @@ static int on_dchan_down(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ */ static int on_anything(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) { - ftdm_log(FTDM_LOG_DEBUG, "Caught Event span %d %u (%s)\n", spri->span->span_id, event_type, lpwrap_pri_event_str(event_type)); return 0; } @@ -1075,7 +1046,6 @@ static int on_anything(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ev */ static int on_io_fail(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_event *pevent) { - ftdm_log(FTDM_LOG_DEBUG, "Caught Event span %d %u (%s)\n", spri->span->span_id, event_type, lpwrap_pri_event_str(event_type)); return 0; } @@ -1084,20 +1054,24 @@ static int on_io_fail(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_eve * \brief Main thread function for libpri span (monitor) * \param me Current thread * \param obj Span to run in this thread + * + * \todo Move all init stuff outside of loop or into ftdm_libpri_configure_span() */ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) { ftdm_span_t *span = (ftdm_span_t *) obj; ftdm_libpri_data_t *isdn_data = span->signal_data; - int i, x = 0; int down = 0; int got_d = 0; - + int res = 0; + ftdm_set_flag(span, FTDM_SPAN_IN_THREAD); - - while(ftdm_running() && !ftdm_test_flag(span, FTDM_SPAN_STOP_THREAD)) { + + while (ftdm_running() && !ftdm_test_flag(span, FTDM_SPAN_STOP_THREAD)) { if (!got_d) { - for(i = 1; i <= span->chan_count; i++) { + int i, x; + + for (i = 1, x = 0; i <= span->chan_count; i++) { if (span->channels[i]->type == FTDM_CHAN_TYPE_DQ921) { if (ftdm_channel_open(span->span_id, i, &isdn_data->dchan) == FTDM_SUCCESS) { ftdm_log(FTDM_LOG_DEBUG, "opening d-channel #%d %d:%d\n", x, isdn_data->dchan->span_id, isdn_data->dchan->chan_id); @@ -1110,22 +1084,33 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) } } } - if (!got_d) { ftdm_log(FTDM_LOG_ERROR, "Failed to get a D-channel in span %d\n", span->span_id); break; } - - - if (lpwrap_init_pri(&isdn_data->spri, - span, // span - isdn_data->dchan, // dchan - isdn_data->pswitch, - isdn_data->node, - isdn_data->debug) < 0) { - snprintf(span->last_error, sizeof(span->last_error), "PRI init FAIL!"); - } else { + /* Initialize libpri trunk */ + switch (span->trunk_type) { + case FTDM_TRUNK_E1: + case FTDM_TRUNK_T1: + case FTDM_TRUNK_J1: + res = lpwrap_init_pri(&isdn_data->spri, span, isdn_data->dchan, + isdn_data->pswitch, isdn_data->node, isdn_data->debug); + break; + case FTDM_TRUNK_BRI: + res = lpwrap_init_bri(&isdn_data->spri, span, isdn_data->dchan, + isdn_data->pswitch, isdn_data->node, 0, isdn_data->debug); + break; + case FTDM_TRUNK_BRI_PTMP: + res = lpwrap_init_bri(&isdn_data->spri, span, isdn_data->dchan, + isdn_data->pswitch, isdn_data->node, 1, isdn_data->debug); + break; + default: + snprintf(span->last_error, sizeof(span->last_error), "Invalid trunk type"); + goto out; + } + + if (res == 0) { LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_ANY, on_anything); LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_RING, on_ring); LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_RINGING, on_ringing); @@ -1148,8 +1133,10 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) isdn_data->spri.on_loop = check_flags; isdn_data->spri.private_info = span; - lpwrap_run_pri(&isdn_data->spri); + lpwrap_run_pri(&isdn_data->spri); + } else { + snprintf(span->last_error, sizeof(span->last_error), "PRI init FAIL!"); } if (!ftdm_running() || ftdm_test_flag(span, FTDM_SPAN_STOP_THREAD)) { @@ -1172,7 +1159,7 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) down++; ftdm_sleep(5000); } - +out: ftdm_log(FTDM_LOG_DEBUG, "PRI thread ended on span %d\n", span->span_id); ftdm_clear_flag(span, FTDM_SPAN_IN_THREAD); @@ -1197,11 +1184,15 @@ static ftdm_status_t ftdm_libpri_stop(ftdm_span_t *span) } ftdm_set_state_all(span, FTDM_CHANNEL_STATE_RESTART); + check_state(span); + ftdm_set_flag(span, FTDM_SPAN_STOP_THREAD); - while(ftdm_test_flag(span, FTDM_SPAN_IN_THREAD)) { + + while (ftdm_test_flag(span, FTDM_SPAN_IN_THREAD)) { ftdm_sleep(100); } + check_state(span); return FTDM_SUCCESS; @@ -1241,7 +1232,7 @@ static ftdm_status_t ftdm_libpri_start(ftdm_span_t *span) * \param node Node string to convert * \return -1 on failure, node value on success */ -static int str2node(char *node) +static int parse_node(const char *node) { if (!strcasecmp(node, "cpe") || !strcasecmp(node, "user")) return PRI_CPE; @@ -1255,7 +1246,7 @@ static int str2node(char *node) * \param swtype Swtype string to convert * \return Switch value */ -static int str2switch(char *swtype) +static int parse_switch(const char *swtype) { if (!strcasecmp(swtype, "ni1")) return PRI_SWITCH_NI1; @@ -1273,6 +1264,7 @@ static int str2switch(char *swtype) return PRI_SWITCH_GR303_EOC; if (!strcasecmp(swtype, "gr303tmc")) return PRI_SWITCH_GR303_TMC; + return PRI_SWITCH_DMS100; } @@ -1281,11 +1273,11 @@ static int str2switch(char *swtype) * \param l1 L1 string to convert * \return L1 value */ -static int str2l1(char *l1) +static int parse_l1(const char *l1) { if (!strcasecmp(l1, "alaw")) return PRI_LAYER_1_ALAW; - + return PRI_LAYER_1_ULAW; } @@ -1294,7 +1286,7 @@ static int str2l1(char *l1) * \param dp DP string to convert * \return DP value */ -static int str2dp(char *dp) +static int parse_numplan(const char *dp) { if (!strcasecmp(dp, "international")) return PRI_INTERNATIONAL_ISDN; @@ -1311,6 +1303,32 @@ static int str2dp(char *dp) } /** + * \brief Parses an option string to flags + * \param in String to parse for configuration options + * \return Flags + */ +static uint32_t parse_opts(const char *in) +{ + uint32_t flags = 0; + + if (!in) { + return 0; + } + + if (strstr(in, "suggest_channel")) { + flags |= FTMOD_LIBPRI_OPT_SUGGEST_CHANNEL; + } + if (strstr(in, "omit_display")) { + flags |= FTMOD_LIBPRI_OPT_OMIT_DISPLAY_IE; + } + if (strstr(in, "omit_redirecting_number")) { + flags |= FTMOD_LIBPRI_OPT_OMIT_REDIRECTING_NUMBER_IE; + } + + return flags; +} + +/** * \brief Initialises a libpri span from configuration variables * \param span Span to configure * \param sig_cb Callback function for event signals @@ -1323,13 +1341,12 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_libpri_configure_span) //ftdm_channel_t *dchans[2] = {0}; ftdm_libpri_data_t *isdn_data; char *var, *val; - char *debug = NULL; if (span->trunk_type >= FTDM_TRUNK_NONE) { ftdm_log(FTDM_LOG_WARNING, "Invalid trunk type '%s' defaulting to T1.\n", ftdm_trunk_type2str(span->trunk_type)); span->trunk_type = FTDM_TRUNK_T1; } - + for(i = 1; i <= span->chan_count; i++) { if (span->channels[i]->type == FTDM_CHAN_TYPE_DQ921) { if (x > 1) { @@ -1346,7 +1363,7 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_libpri_configure_span) } } } - + #if 0 if (!x) { snprintf(span->last_error, sizeof(span->last_error), "Span has no D-Channels!"); @@ -1358,88 +1375,77 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_libpri_configure_span) assert(isdn_data != NULL); memset(isdn_data, 0, sizeof(*isdn_data)); - if (span->trunk_type == FTDM_TRUNK_E1) { - ftdm_log(FTDM_LOG_NOTICE, "Setting default Layer 1 to ALAW since this is an E1 trunk\n"); - isdn_data->l1 = PRI_LAYER_1_ALAW; - } else if (span->trunk_type == FTDM_TRUNK_T1) { - ftdm_log(FTDM_LOG_NOTICE, "Setting default Layer 1 to ULAW since this is a T1 trunk\n"); - isdn_data->l1 = PRI_LAYER_1_ULAW; - } - - while((var = va_arg(ap, char *))) { + if (span->trunk_type == FTDM_TRUNK_E1) { + ftdm_log(FTDM_LOG_NOTICE, "Setting default Layer 1 to ALAW since this is an E1 trunk\n"); + isdn_data->l1 = PRI_LAYER_1_ALAW; + } else if (span->trunk_type == FTDM_TRUNK_T1) { + ftdm_log(FTDM_LOG_NOTICE, "Setting default Layer 1 to ULAW since this is a T1 trunk\n"); + isdn_data->l1 = PRI_LAYER_1_ULAW; + } + + while ((var = va_arg(ap, char *))) { + val = va_arg(ap, char *); + + if (!val) { + ftdm_log(FTDM_LOG_ERROR, "Parameter '%s' has no value\n", var); + return FTDM_FAIL; + } + if (!strcasecmp(var, "node")) { - int node; - if (!(val = va_arg(ap, char *))) { - break; - } - node = str2node(val); - if (-1 == node) { - ftdm_log(FTDM_LOG_ERROR, "Unknown node type %s, defaulting to CPE mode\n", val); - node = PRI_CPE; - } - isdn_data->node = node; - } else if (!strcasecmp(var, "switch")) { - if (!(val = va_arg(ap, char *))) { - break; - } - isdn_data->pswitch = str2switch(val); - } else if (!strcasecmp(var, "opts")) { - if (!(val = va_arg(ap, char *))) { - break; + if ((isdn_data->node = parse_node(val)) == -1) { + ftdm_log(FTDM_LOG_ERROR, "Unknown node type '%s', defaulting to CPE mode\n", val); + isdn_data->node = PRI_CPE; } + } + else if (!strcasecmp(var, "switch")) { + isdn_data->pswitch = parse_switch(val); + } + else if (!strcasecmp(var, "opts")) { isdn_data->opts = parse_opts(val); - } else if (!strcasecmp(var, "dp")) { - if (!(val = va_arg(ap, char *))) { - break; - } - isdn_data->dp = str2dp(val); - } else if (!strcasecmp(var, "l1")) { - if (!(val = va_arg(ap, char *))) { - break; - } - isdn_data->l1 = str2l1(val); - } else if (!strcasecmp(var, "debug")) { - if (!(val = va_arg(ap, char *))) { - break; - } - debug = val; - } else { + } + else if (!strcasecmp(var, "dp")) { + isdn_data->dp = parse_numplan(val); + } + else if (!strcasecmp(var, "l1")) { + isdn_data->l1 = parse_l1(val); + } + else if (!strcasecmp(var, "debug")) { + isdn_data->debug = parse_debug(val); + } + else { snprintf(span->last_error, sizeof(span->last_error), "Unknown parameter [%s]", var); return FTDM_FAIL; } } - + span->start = ftdm_libpri_start; - span->stop = ftdm_libpri_stop; + span->stop = ftdm_libpri_stop; span->signal_cb = sig_cb; //isdn_data->dchans[0] = dchans[0]; //isdn_data->dchans[1] = dchans[1]; //isdn_data->dchan = isdn_data->dchans[0]; - - isdn_data->debug = parse_debug(debug); - span->signal_data = isdn_data; span->signal_type = FTDM_SIGTYPE_ISDN; span->outgoing_call = isdn_outgoing_call; + span->state_map = &isdn_state_map; + span->get_channel_sig_status = isdn_get_channel_sig_status; span->get_span_sig_status = isdn_get_span_sig_status; - + if ((isdn_data->opts & FTMOD_LIBPRI_OPT_SUGGEST_CHANNEL)) { span->channel_request = isdn_channel_request; ftdm_set_flag(span, FTDM_SPAN_SUGGEST_CHAN_ID); } - span->state_map = &isdn_state_map; - return FTDM_SUCCESS; } /** * \brief FreeTDM libpri signaling and IO module definition */ -ftdm_module_t ftdm_module = { +ftdm_module_t ftdm_module = { "libpri", ftdm_libpri_io_init, ftdm_libpri_unload, @@ -1448,7 +1454,6 @@ ftdm_module_t ftdm_module = { NULL }; - /* For Emacs: * Local Variables: * mode:c diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c b/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c index 8dfba34..2cfdd82 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c @@ -1,23 +1,23 @@ /* * Copyright (c) 2009, Anthony Minessale II * 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 original author; nor the names of any 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 @@ -106,7 +106,7 @@ static struct lpwrap_pri_event_list LPWRAP_PRI_EVENT_LIST[] = { #define LINE "--------------------------------------------------------------------------------" const char *lpwrap_pri_event_str(lpwrap_pri_event_t event_id) -{ +{ return LPWRAP_PRI_EVENT_LIST[event_id].name; } @@ -124,7 +124,7 @@ static int __pri_lpwrap_read(struct pri *pri, void *buf, int buflen) } else { ftdm_log(FTDM_LOG_CRIT, "span %d D-READ TIMEOUT\n", spri->span->span_id); } - + ftdm_clear_flag(spri, LPWRAP_PRI_READY); return -1; } @@ -173,21 +173,56 @@ int lpwrap_init_pri(struct lpwrap_pri *spri, ftdm_span_t *span, ftdm_channel_t * int ret = -1; memset(spri, 0, sizeof(struct lpwrap_pri)); - spri->dchan = dchan; - spri->span = span; + spri->span = span; + + if (!spri->dchan) { + ftdm_log(FTDM_LOG_ERROR, "No D-Channel available, unable to create PRI\n"); + return ret; + } - if (spri->dchan && (spri->pri = pri_new_cb(spri->dchan->sockfd, node, swtype, __pri_lpwrap_read, __pri_lpwrap_write, spri))){ + if ((spri->pri = pri_new_cb(spri->dchan->sockfd, node, swtype, __pri_lpwrap_read, __pri_lpwrap_write, spri))) { unsigned char buf[4] = { 0 }; size_t buflen = sizeof(buf), len = 0; + pri_set_debug(spri->pri, debug); - ret = 0; - ftdm_channel_write(spri->dchan, buf, buflen, &len); + + ret = 0; } else { - fprintf(stderr, "Unable to create PRI\n"); + ftdm_log(FTDM_LOG_ERROR, "Unable to create PRI\n"); + } + return ret; +} + +int lpwrap_init_bri(struct lpwrap_pri *spri, ftdm_span_t *span, ftdm_channel_t *dchan, int swtype, int node, int ptmp, int debug) +{ + int ret = -1; +#ifdef HAVE_LIBPRI_BRI + memset(spri, 0, sizeof(struct lpwrap_pri)); + spri->dchan = dchan; + spri->span = span; + + if (!spri->dchan) { + ftdm_log(FTDM_LOG_ERROR, "No D-Channel available, unable to create BRI\n"); + return ret; } + if ((spri->pri = pri_new_bri_cb(spri->dchan->sockfd, ptmp, node, swtype, __pri_lpwrap_read, __pri_lpwrap_write, spri))) { + unsigned char buf[4] = { 0 }; + size_t buflen = sizeof(buf), len = 0; + + pri_set_debug(spri->pri, debug); + ftdm_channel_write(spri->dchan, buf, buflen, &len); + + ret = 0; + } else { + ftdm_log(FTDM_LOG_ERROR, "Unable to create BRI\n"); + } +#else + ftdm_log(FTDM_LOG_ERROR, "Installed libpri version (%s) has no BRI support\n", + pri_get_version()); +#endif return ret; } @@ -198,8 +233,8 @@ int lpwrap_one_loop(struct lpwrap_pri *spri) struct timeval now = {0,0}, *next; pri_event *event; event_handler handler; - int sel; - + int sel; + if (spri->on_loop) { if ((sel = spri->on_loop(spri)) < 0) { return sel; @@ -269,7 +304,7 @@ int lpwrap_one_loop(struct lpwrap_pri *spri) int lpwrap_run_pri(struct lpwrap_pri *spri) { int ret = 0; - + for (;;){ ret = lpwrap_one_loop(spri); @@ -280,7 +315,7 @@ int lpwrap_run_pri(struct lpwrap_pri *spri) /* Igonore an interrupted system call */ continue; } -#endif +#endif ftdm_log(FTDM_LOG_CRIT, "Error = %i [%s]\n", ret, strerror(errno)); break; } @@ -300,4 +335,3 @@ int lpwrap_run_pri(struct lpwrap_pri *spri) * For VIM: * vim:set softtabstop=4 shiftwidth=4 tabstop=4: */ - diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.h b/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.h index f92c5bb..d3d1c43 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.h +++ b/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.h @@ -121,6 +121,8 @@ struct lpwrap_pri_event_list { const char *lpwrap_pri_event_str(lpwrap_pri_event_t event_id); int lpwrap_one_loop(struct lpwrap_pri *spri); int lpwrap_init_pri(struct lpwrap_pri *spri, ftdm_span_t *span, ftdm_channel_t *dchan, int swtype, int node, int debug); +int lpwrap_init_bri(struct lpwrap_pri *spri, ftdm_span_t *span, ftdm_channel_t *dchan, int swtype, int node, int ptmp, int debug); int lpwrap_run_pri(struct lpwrap_pri *spri); +#define lpwrap_run_bri(x) lpwrap_run_pri(x) #endif commit 6787710b0064729c866a2339f0b7abe5ef005e50 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Sat Nov 6 16:06:42 2010 +0100 FreeTDM: Update .gitignore, add files shipped with libtool (build/{libtool,lt*}.m4) and compiled test binaries diff --git a/libs/freetdm/.gitignore b/libs/freetdm/.gitignore index 5018c53..2b06b30 100644 --- a/libs/freetdm/.gitignore +++ b/libs/freetdm/.gitignore @@ -11,6 +11,20 @@ config.* configure libtool aclocal.m4 +build/libtool.m4 +build/ltoptions.m4 +build/ltsugar.m4 +build/ltversion.m4 +build/lt~obsolete.m4 + +testanalog +testapp +testboost +testcid +testpri +testr2 +testsangomaboost +testtones !/sample/boost/Makefile !/sample/dso/Makefile commit 21418b083d59206b390d18ba010e72bf719a348c Merge: b912935 fdd9944 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Sat Nov 6 12:50:22 2010 -0200 Merge branch 'master' of git.sangoma.com:smg_freeswitch commit b912935c6c5322c1b26bfd127222b7cdc339190d Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Sat Nov 6 12:48:22 2010 -0200 freetdm: fixed ftmod_r2 on windows and removed the wrong ftmod_r2 project from freetdm msvc file diff --git a/libs/freetdm/freetdm.2008.sln b/libs/freetdm/freetdm.2008.sln index 4d1f019..f059d94 100644 --- a/libs/freetdm/freetdm.2008.sln +++ b/libs/freetdm/freetdm.2008.sln @@ -63,8 +63,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_sangoma_isdn", "src\f {93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_r2", "src\ftmod\ftmod_r2\ftmod_r2.vcproj", "{94F04D58-5EB8-4B48-8FE5-75EBF468073B}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_r2", "src\ftmod\ftmod_r2\ftmod_r2.2008.vcproj", "{08C3EA27-A51D-47F8-B47D-B189C649CF30}" EndProject Global @@ -162,12 +160,6 @@ Global {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|Win32.ActiveCfg = Release|Win32 {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|Win32.Build.0 = Release|Win32 {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|x64.ActiveCfg = Release|Win32 - {94F04D58-5EB8-4B48-8FE5-75EBF468073B}.Debug|Win32.ActiveCfg = Debug|Win32 - {94F04D58-5EB8-4B48-8FE5-75EBF468073B}.Debug|Win32.Build.0 = Debug|Win32 - {94F04D58-5EB8-4B48-8FE5-75EBF468073B}.Debug|x64.ActiveCfg = Debug|Win32 - {94F04D58-5EB8-4B48-8FE5-75EBF468073B}.Release|Win32.ActiveCfg = Release|Win32 - {94F04D58-5EB8-4B48-8FE5-75EBF468073B}.Release|Win32.Build.0 = Release|Win32 - {94F04D58-5EB8-4B48-8FE5-75EBF468073B}.Release|x64.ActiveCfg = Release|Win32 {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Debug|Win32.ActiveCfg = Debug|Win32 {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Debug|Win32.Build.0 = Debug|Win32 {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Debug|x64.ActiveCfg = Debug|Win32 diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index df9e773..56c0bc6 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -986,6 +986,15 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_r2_configure_span) } if (ftdm_strlen_zero_buf(val)) { ftdm_log(FTDM_LOG_NOTICE, "Ignoring empty R2 advanced_protocol_file parameter\n"); + /* + * TODO: investigate this + * + * despite the fact advanced_protocol_file was initialized as NULL, it's now a bad + * pointer - hence, this workaround. + * this seems to happen only on windows. + * + */ + r2conf.advanced_protocol_file = NULL; continue; } r2conf.advanced_protocol_file = val; commit 77e7f589866a850a4873abfbd04e8dfaf37224ff Author: Jeff Lenk <jeff@jefflenk.com> Date: Fri Nov 5 21:15:03 2010 -0500 VS2010 Swig diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx index 5a2a757..c55a6d6 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx @@ -12702,11 +12702,11 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_dow_cmp(char * jarg1, int jarg2) { int jresult ; char *arg1 = (char *) 0 ; int arg2 ; - int result; + switch_bool_t result; arg1 = (char *)jarg1; arg2 = (int)jarg2; - result = (int)switch_dow_cmp((char const *)arg1,arg2); + result = (switch_bool_t)switch_dow_cmp((char const *)arg1,arg2); jresult = result; return jresult; } @@ -15311,6 +15311,28 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_routines_write_video_frame_get(vo } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_routines_state_run_set(void * jarg1, void * jarg2) { + switch_io_routines *arg1 = (switch_io_routines *) 0 ; + switch_io_state_run_t arg2 = (switch_io_state_run_t) 0 ; + + arg1 = (switch_io_routines *)jarg1; + arg2 = (switch_io_state_run_t)jarg2; + if (arg1) (arg1)->state_run = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_routines_state_run_get(void * jarg1) { + void * jresult ; + switch_io_routines *arg1 = (switch_io_routines *) 0 ; + switch_io_state_run_t result; + + arg1 = (switch_io_routines *)jarg1; + result = (switch_io_state_run_t) ((arg1)->state_run); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_routines_resurrect_session_set(void * jarg1, void * jarg2) { switch_io_routines *arg1 = (switch_io_routines *) 0 ; switch_io_resurrect_session_t arg2 = (switch_io_resurrect_session_t) 0 ; @@ -27235,15 +27257,17 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_sound_test(void * jarg1) { } -SWIGEXPORT void SWIGSTDCALL CSharp_switch_process_import(void * jarg1, void * jarg2, char * jarg3) { +SWIGEXPORT void SWIGSTDCALL CSharp_switch_process_import(void * jarg1, void * jarg2, char * jarg3, char * jarg4) { switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; switch_channel_t *arg2 = (switch_channel_t *) 0 ; char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; arg1 = (switch_core_session_t *)jarg1; arg2 = (switch_channel_t *)jarg2; arg3 = (char *)jarg3; - switch_process_import(arg1,arg2,(char const *)arg3); + arg4 = (char *)jarg4; + switch_process_import(arg1,arg2,(char const *)arg3,(char const *)arg4); } @@ -27259,6 +27283,26 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_uuid_exists(char * jarg1) { } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_set_match_callback(void * jarg1, void * jarg2) { + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + switch_ivr_dmachine_callback_t arg2 = (switch_ivr_dmachine_callback_t) 0 ; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (switch_ivr_dmachine_callback_t)jarg2; + switch_ivr_dmachine_set_match_callback(arg1,arg2); +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_set_nonmatch_callback(void * jarg1, void * jarg2) { + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + switch_ivr_dmachine_callback_t arg2 = (switch_ivr_dmachine_callback_t) 0 ; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (switch_ivr_dmachine_callback_t)jarg2; + switch_ivr_dmachine_set_nonmatch_callback(arg1,arg2); +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_create(void * jarg1, char * jarg2, void * jarg3, unsigned long jarg4, unsigned long jarg5, void * jarg6, void * jarg7, void * jarg8) { int jresult ; switch_ivr_dmachine_t **arg1 = (switch_ivr_dmachine_t **) 0 ; @@ -30494,6 +30538,68 @@ SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hook_state_change(void } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_state_run_state_run_set(void * jarg1, void * jarg2) { + switch_io_event_hook_state_run *arg1 = (switch_io_event_hook_state_run *) 0 ; + switch_state_run_hook_t arg2 = (switch_state_run_hook_t) 0 ; + + arg1 = (switch_io_event_hook_state_run *)jarg1; + arg2 = (switch_state_run_hook_t)jarg2; + if (arg1) (arg1)->state_run = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_state_run_state_run_get(void * jarg1) { + void * jresult ; + switch_io_event_hook_state_run *arg1 = (switch_io_event_hook_state_run *) 0 ; + switch_state_run_hook_t result; + + arg1 = (switch_io_event_hook_state_run *)jarg1; + result = (switch_state_run_hook_t) ((arg1)->state_run); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_state_run_next_set(void * jarg1, void * jarg2) { + switch_io_event_hook_state_run *arg1 = (switch_io_event_hook_state_run *) 0 ; + switch_io_event_hook_state_run *arg2 = (switch_io_event_hook_state_run *) 0 ; + + arg1 = (switch_io_event_hook_state_run *)jarg1; + arg2 = (switch_io_event_hook_state_run *)jarg2; + if (arg1) (arg1)->next = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_state_run_next_get(void * jarg1) { + void * jresult ; + switch_io_event_hook_state_run *arg1 = (switch_io_event_hook_state_run *) 0 ; + switch_io_event_hook_state_run *result = 0 ; + + arg1 = (switch_io_event_hook_state_run *)jarg1; + result = (switch_io_event_hook_state_run *) ((arg1)->next); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_event_hook_state_run() { + void * jresult ; + switch_io_event_hook_state_run *result = 0 ; + + result = (switch_io_event_hook_state_run *)new switch_io_event_hook_state_run(); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hook_state_run(void * jarg1) { + switch_io_event_hook_state_run *arg1 = (switch_io_event_hook_state_run *) 0 ; + + arg1 = (switch_io_event_hook_state_run *)jarg1; + delete arg1; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_resurrect_session_resurrect_session_set(void * jarg1, void * jarg2) { switch_io_event_hook_resurrect_session *arg1 = (switch_io_event_hook_resurrect_session *) 0 ; switch_resurrect_session_hook_t arg2 = (switch_resurrect_session_hook_t) 0 ; @@ -30798,6 +30904,28 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hooks_state_change_get(void } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hooks_state_run_set(void * jarg1, void * jarg2) { + switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ; + switch_io_event_hook_state_run_t *arg2 = (switch_io_event_hook_state_run_t *) 0 ; + + arg1 = (switch_io_event_hooks *)jarg1; + arg2 = (switch_io_event_hook_state_run_t *)jarg2; + if (arg1) (arg1)->state_run = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hooks_state_run_get(void * jarg1) { + void * jresult ; + switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ; + switch_io_event_hook_state_run_t *result = 0 ; + + arg1 = (switch_io_event_hooks *)jarg1; + result = (switch_io_event_hook_state_run_t *) ((arg1)->state_run); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hooks_resurrect_session_set(void * jarg1, void * jarg2) { switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ; switch_io_event_hook_resurrect_session_t *arg2 = (switch_io_event_hook_resurrect_session_t *) 0 ; @@ -30894,6 +31022,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_state_change(void * } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_state_run(void * jarg1, void * jarg2) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_state_run_hook_t arg2 = (switch_state_run_hook_t) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (switch_state_run_hook_t)jarg2; + result = (switch_status_t)switch_core_event_hook_add_state_run(arg1,arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_read_frame(void * jarg1, void * jarg2) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; @@ -31062,6 +31204,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_state_change(voi } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_state_run(void * jarg1, void * jarg2) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_state_run_hook_t arg2 = (switch_state_run_hook_t) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (switch_state_run_hook_t)jarg2; + result = (switch_status_t)switch_core_event_hook_remove_state_run(arg1,arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_read_frame(void * jarg1, void * jarg2) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs index 682b3bd..8c307fc 100644 --- a/src/mod/languages/mod_managed/managed/swig.2010.cs +++ b/src/mod/languages/mod_managed/managed/swig.2010.cs @@ -2994,8 +2994,8 @@ public class freeswitch { return ret; } - public static int switch_dow_cmp(string exp, int val) { - int ret = freeswitchPINVOKE.switch_dow_cmp(exp, val); + public static switch_bool_t switch_dow_cmp(string exp, int val) { + switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_dow_cmp(exp, val); return ret; } @@ -4384,8 +4384,8 @@ public class freeswitch { return ret; } - public static void switch_process_import(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_switch_channel peer_channel, string varname) { - freeswitchPINVOKE.switch_process_import(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_switch_channel.getCPtr(peer_channel), varname); + public static void switch_process_import(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_switch_channel peer_channel, string varname, string prefix) { + freeswitchPINVOKE.switch_process_import(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_switch_channel.getCPtr(peer_channel), varname, prefix); } public static switch_bool_t switch_ivr_uuid_exists(string uuid) { @@ -4393,6 +4393,14 @@ public class freeswitch { return ret; } + public static void switch_ivr_dmachine_set_match_callback(SWIGTYPE_p_switch_ivr_dmachine dmachine, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t match_callback) { + freeswitchPINVOKE.switch_ivr_dmachine_set_match_callback(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(match_callback)); + } + + public static void switch_ivr_dmachine_set_nonmatch_callback(SWIGTYPE_p_switch_ivr_dmachine dmachine, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t nonmatch_callback) { + freeswitchPINVOKE.switch_ivr_dmachine_set_nonmatch_callback(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(nonmatch_callback)); + } + public static switch_status_t switch_ivr_dmachine_create(SWIGTYPE_p_p_switch_ivr_dmachine dmachine_p, string name, SWIGTYPE_p_apr_pool_t pool, uint digit_timeout, uint input_timeout, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t match_callback, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t nonmatch_callback, SWIGTYPE_p_void user_data) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_create(SWIGTYPE_p_p_switch_ivr_dmachine.getCPtr(dmachine_p), name, SWIGTYPE_p_apr_pool_t.getCPtr(pool), digit_timeout, input_timeout, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(match_callback), SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(nonmatch_callback), SWIGTYPE_p_void.getCPtr(user_data)); return ret; @@ -5048,6 +5056,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_core_event_hook_add_state_run(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session__switch_status_t state_run) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_state_run(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(state_run)); + return ret; + } + public static switch_status_t switch_core_event_hook_add_read_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t read_frame) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_read_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(read_frame)); return ret; @@ -5108,6 +5121,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_core_event_hook_remove_state_run(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session__switch_status_t state_run) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_state_run(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(state_run)); + return ret; + } + public static switch_status_t switch_core_event_hook_remove_read_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t read_frame) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_read_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(read_frame)); return ret; @@ -9278,6 +9296,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_write_video_frame_get")] public static extern IntPtr switch_io_routines_write_video_frame_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_state_run_set")] + public static extern void switch_io_routines_state_run_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_state_run_get")] + public static extern IntPtr switch_io_routines_state_run_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_resurrect_session_set")] public static extern void switch_io_routines_resurrect_session_set(HandleRef jarg1, HandleRef jarg2); @@ -12135,11 +12159,17 @@ class freeswitchPINVOKE { public static extern int switch_ivr_sound_test(HandleRef jarg1); [DllImport("mod_managed", EntryPoint="CSharp_switch_process_import")] - public static extern void switch_process_import(HandleRef jarg1, HandleRef jarg2, string jarg3); + public static extern void switch_process_import(HandleRef jarg1, HandleRef jarg2, string jarg3, string jarg4); [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_uuid_exists")] public static extern int switch_ivr_uuid_exists(string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_set_match_callback")] + public static extern void switch_ivr_dmachine_set_match_callback(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_set_nonmatch_callback")] + public static extern void switch_ivr_dmachine_set_nonmatch_callback(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_create")] public static extern int switch_ivr_dmachine_create(HandleRef jarg1, string jarg2, HandleRef jarg3, uint jarg4, uint jarg5, HandleRef jarg6, HandleRef jarg7, HandleRef jarg8); @@ -12911,6 +12941,24 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hook_state_change")] public static extern void delete_switch_io_event_hook_state_change(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_state_run_state_run_set")] + public static extern void switch_io_event_hook_state_run_state_run_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_state_run_state_run_get")] + public static extern IntPtr switch_io_event_hook_state_run_state_run_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_state_run_next_set")] + public static extern void switch_io_event_hook_state_run_next_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_state_run_next_get")] + public static extern IntPtr switch_io_event_hook_state_run_next_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_event_hook_state_run")] + public static extern IntPtr new_switch_io_event_hook_state_run(); + + [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hook_state_run")] + public static extern void delete_switch_io_event_hook_state_run(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_resurrect_session_resurrect_session_set")] public static extern void switch_io_event_hook_resurrect_session_resurrect_session_set(HandleRef jarg1, HandleRef jarg2); @@ -12995,6 +13043,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_state_change_get")] public static extern IntPtr switch_io_event_hooks_state_change_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_state_run_set")] + public static extern void switch_io_event_hooks_state_run_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_state_run_get")] + public static extern IntPtr switch_io_event_hooks_state_run_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_resurrect_session_set")] public static extern void switch_io_event_hooks_resurrect_session_set(HandleRef jarg1, HandleRef jarg2); @@ -13019,6 +13073,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_state_change")] public static extern int switch_core_event_hook_add_state_change(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_state_run")] + public static extern int switch_core_event_hook_add_state_run(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_read_frame")] public static extern int switch_core_event_hook_add_read_frame(HandleRef jarg1, HandleRef jarg2); @@ -13055,6 +13112,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_state_change")] public static extern int switch_core_event_hook_remove_state_change(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_state_run")] + public static extern int switch_core_event_hook_remove_state_run(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_read_frame")] public static extern int switch_core_event_hook_remove_read_frame(HandleRef jarg1, HandleRef jarg2); @@ -21253,6 +21313,7 @@ public enum switch_channel_flag_t { CF_CONSUME_ON_ORIGINATE, CF_PASSTHRU_PTIME_MISMATCH, CF_BRIDGE_NOWRITE, + CF_RECOVERED, CF_FLAG_MAX } @@ -24404,7 +24465,8 @@ namespace FreeSWITCH.Native { SWITCH_FILE_CALLBACK = (1 << 12), SWITCH_FILE_DONE = (1 << 13), SWITCH_FILE_BUFFER_DONE = (1 << 14), - SWITCH_FILE_WRITE_APPEND = (1 << 15) + SWITCH_FILE_WRITE_APPEND = (1 << 15), + SWITCH_FILE_WRITE_OVER = (1 << 16) } } @@ -25611,6 +25673,17 @@ public class switch_io_event_hooks : IDisposable { } } + public switch_io_event_hook_state_run state_run { + set { + freeswitchPINVOKE.switch_io_event_hooks_state_run_set(swigCPtr, switch_io_event_hook_state_run.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_state_run_get(swigCPtr); + switch_io_event_hook_state_run ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_state_run(cPtr, false); + return ret; + } + } + public switch_io_event_hook_resurrect_session resurrect_session { set { freeswitchPINVOKE.switch_io_event_hooks_resurrect_session_set(swigCPtr, switch_io_event_hook_resurrect_session.getCPtr(value)); @@ -26280,6 +26353,77 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class switch_io_event_hook_state_run : IDisposable { + private HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal switch_io_event_hook_state_run(IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new HandleRef(this, cPtr); + } + + internal static HandleRef getCPtr(switch_io_event_hook_state_run obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } + + ~switch_io_event_hook_state_run() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if (swigCPtr.Handle != IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_switch_io_event_hook_state_run(swigCPtr); + } + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + GC.SuppressFinalize(this); + } + } + + public SWIGTYPE_p_f_p_switch_core_session__switch_status_t state_run { + set { + freeswitchPINVOKE.switch_io_event_hook_state_run_state_run_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_state_run_state_run_get(swigCPtr); + SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_state_run next { + set { + freeswitchPINVOKE.switch_io_event_hook_state_run_next_set(swigCPtr, switch_io_event_hook_state_run.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_state_run_next_get(swigCPtr); + switch_io_event_hook_state_run ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_state_run(cPtr, false); + return ret; + } + } + + public switch_io_event_hook_state_run() : this(freeswitchPINVOKE.new_switch_io_event_hook_state_run(), true) { + } + +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.0 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class switch_io_event_hook_video_read_frame : IDisposable { private HandleRef swigCPtr; protected bool swigCMemOwn; @@ -26650,6 +26794,17 @@ public class switch_io_routines : IDisposable { } } + public SWIGTYPE_p_f_p_switch_core_session__switch_status_t state_run { + set { + freeswitchPINVOKE.switch_io_routines_state_run_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_state_run_get(swigCPtr); + SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false); + return ret; + } + } + public SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t resurrect_session { set { freeswitchPINVOKE.switch_io_routines_resurrect_session_set(swigCPtr, SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t.getCPtr(value)); @@ -27720,7 +27875,8 @@ namespace FreeSWITCH.Native { SMBF_STEREO = (1 << 5), SMBF_ANSWER_REQ = (1 << 6), SMBF_THREAD_LOCK = (1 << 7), - SMBF_PRUNE = (1 << 8) + SMBF_PRUNE = (1 << 8), + SMBF_NO_PAUSE = (1 << 9) } } @@ -29826,6 +29982,7 @@ public enum switch_status_t { SWITCH_STATUS_IGNORE, SWITCH_STATUS_TOO_SMALL, SWITCH_STATUS_FOUND, + SWITCH_STATUS_CONTINUE, SWITCH_STATUS_NOT_INITALIZED } commit 40ac860aaa836d5822bad804b91059ac43fb5246 Author: Michael Jerris <mike@jerris.com> Date: Fri Nov 5 20:24:31 2010 -0400 fix missing name and potential segfault in gateway status diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 0804080..aa927bf 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -2293,11 +2293,14 @@ static const char *sofia_state_names[] = { "FAIL_WAIT", "EXPIRED", "NOREG", + "TIMEOUT", NULL }; const char *sofia_state_string(int state) { + if (state >= REG_STATE_LAST) return ""; + return sofia_state_names[state]; } commit e0c37c1f6ec06b44bba38a0370c48d7a275898e8 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Nov 5 18:20:09 2010 -0500 allow process_import to specify a prefix diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index 34c5db8..249ac63 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -840,7 +840,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say_ip(switch_core_session_t *session SWITCH_DECLARE(switch_status_t) switch_ivr_set_user(switch_core_session_t *session, const char *data); SWITCH_DECLARE(switch_status_t) switch_ivr_sound_test(switch_core_session_t *session); -SWITCH_DECLARE(void) switch_process_import(switch_core_session_t *session, switch_channel_t *peer_channel, const char *varname); +SWITCH_DECLARE(void) switch_process_import(switch_core_session_t *session, switch_channel_t *peer_channel, const char *varname, const char *prefix); SWITCH_DECLARE(switch_bool_t) switch_ivr_uuid_exists(const char *uuid); diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 520e062..33697a0 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -998,8 +998,10 @@ static switch_status_t messagehook (switch_core_session_t *session, switch_core_ if (caller_channel) { switch_channel_set_variable(caller_channel, "fifo_role", "caller"); - switch_process_import(consumer_session, caller_channel, "fifo_caller_consumer_import"); - switch_process_import(caller_session, consumer_channel, "fifo_consumer_caller_import"); + switch_process_import(consumer_session, caller_channel, "fifo_caller_consumer_import", + switch_channel_get_variable(consumer_channel, "fifo_import_prefix")); + switch_process_import(caller_session, consumer_channel, "fifo_consumer_caller_import", + switch_channel_get_variable(caller_channel, "fifo_import_prefix")); } @@ -2846,8 +2848,8 @@ SWITCH_STANDARD_APP(fifo_function) switch_core_media_bug_resume(session); switch_core_media_bug_resume(other_session); - switch_process_import(session, other_channel, "fifo_caller_consumer_import"); - switch_process_import(other_session, channel, "fifo_consumer_caller_import"); + switch_process_import(session, other_channel, "fifo_caller_consumer_import", switch_channel_get_variable(channel, "fifo_import_prefix")); + switch_process_import(other_session, channel, "fifo_consumer_caller_import", switch_channel_get_variable(other_channel, "fifo_import_prefix")); if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(channel, event); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FIFO-Name", argv[0]); diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 749f18e..007d7d9 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -1038,7 +1038,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t return status; } -SWITCH_DECLARE(void) switch_process_import(switch_core_session_t *session, switch_channel_t *peer_channel, const char *varname) +SWITCH_DECLARE(void) switch_process_import(switch_core_session_t *session, switch_channel_t *peer_channel, const char *varname, const char *prefix) { const char *import, *val; switch_channel_t *caller_channel; @@ -1054,7 +1054,13 @@ SWITCH_DECLARE(void) switch_process_import(switch_core_session_t *session, switc if ((argc = switch_separate_string(mydata, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) { for (i = 0; i < argc; i++) { if ((val = switch_channel_get_variable(peer_channel, argv[i]))) { - switch_channel_set_variable(caller_channel, argv[i], val); + if (prefix) { + char *var = switch_mprintf("%s%s", prefix, argv[i]); + switch_channel_set_variable(caller_channel, var, val); + free(var); + } else { + switch_channel_set_variable(caller_channel, argv[i], val); + } } } } @@ -3296,7 +3302,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } else { status = SWITCH_STATUS_FALSE; if (caller_channel && peer_channel) { - switch_process_import(oglobals.session, peer_channel, "import"); + switch_process_import(oglobals.session, peer_channel, "import", NULL); } peer_channel = NULL; goto done; @@ -3347,7 +3353,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess if (caller_channel) { switch_channel_set_variable(caller_channel, "originate_disposition", "call accepted"); if (peer_channel) { - switch_process_import(oglobals.session, peer_channel, "import"); + switch_process_import(oglobals.session, peer_channel, "import", NULL); } } switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(oglobals.session), SWITCH_LOG_DEBUG, "Originate Resulted in Success: [%s]\n", commit f69f4a77477d59ee2734dce74f5c984bd9a4d678 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Nov 5 15:24:11 2010 -0500 refactor diff --git a/src/switch_core_state_machine.c b/src/switch_core_state_machine.c index 439f9b7..c77f3f1 100644 --- a/src/switch_core_state_machine.c +++ b/src/switch_core_state_machine.c @@ -409,6 +409,8 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session) message = NULL; } + switch_ivr_parse_all_events(session); + if (switch_channel_get_state(session->channel) == switch_channel_get_running_state(session->channel)) { switch_channel_set_flag(session->channel, CF_THREAD_SLEEPING); if (switch_channel_get_state(session->channel) == switch_channel_get_running_state(session->channel)) { @@ -417,6 +419,8 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session) switch_channel_clear_flag(session->channel, CF_THREAD_SLEEPING); } + switch_ivr_parse_all_events(session); + while (switch_core_session_dequeue_message(session, &message) == SWITCH_STATUS_SUCCESS) { switch_core_session_receive_message(session, message); message = NULL; commit fdd9944ed5b98565d830b6f6f6e03a203ae4c706 Author: Konrad Hammel <konrad@sangoma.com> Date: Fri Nov 5 13:52:41 2010 -0400 freetdm: ss7 - added support for hex characters in calling/called numbers freetdm: ss7 - added support for no-EC present indicatiation in ACM when 64k unrestricted TMR diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index f2e34e6..970d006 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -335,7 +335,26 @@ void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan) acm.bckCallInd.isdnAccInd.pres = PRSNT_NODEF; acm.bckCallInd.isdnAccInd.val = ISDNACC_NONISDN; acm.bckCallInd.echoCtrlDevInd.pres = PRSNT_NODEF; - acm.bckCallInd.echoCtrlDevInd.val = 0x1; /* ec device present */ + switch (ftdmchan->caller_data.bearer_capability) { + /**********************************************************************/ + case (FTDM_BEARER_CAP_SPEECH): + acm.bckCallInd.echoCtrlDevInd.val = 0x1; + break; + /**********************************************************************/ + case (FTDM_BEARER_CAP_64K_UNRESTRICTED): + acm.bckCallInd.echoCtrlDevInd.val = 0x0; + break; + /**********************************************************************/ + case (FTDM_BEARER_CAP_3_1KHZ_AUDIO): + acm.bckCallInd.echoCtrlDevInd.val = 0x1; + break; + /**********************************************************************/ + default: + SS7_ERROR_CHAN(ftdmchan, "Unknown Bearer capability falling back to speech%s\n", " "); + acm.bckCallInd.echoCtrlDevInd.val = 0x1; + break; + /**********************************************************************/ + } /* switch (ftdmchan->caller_data.bearer_capability) */ acm.bckCallInd.sccpMethInd.pres = PRSNT_NODEF; acm.bckCallInd.sccpMethInd.val = SCCPMTH_NOIND; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 4d514ca..4d497b5 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -132,7 +132,8 @@ uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum) tmp[0] = ftdm->cid_num.digits[k]; /* check if the digit is a number and that is not null */ - while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) { + while (!(isxdigit(tmp[0])) && (tmp[0] != '\0')) { + SS7_INFO("Dropping invalid digit: %c\n", tmp[0]); /* move on to the next value */ k++; tmp[0] = ftdm->cid_num.digits[k]; @@ -141,14 +142,15 @@ uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum) /* check if tmp is null or a digit */ if (tmp[0] != '\0') { /* push it into the lower nibble */ - lower = atoi(&tmp[0]); + lower = strtol(&tmp[0], (char **)NULL, 16); /* move to the next digit */ k++; /* grab a digit from the ftdm digits */ tmp[0] = ftdm->cid_num.digits[k]; /* check if the digit is a number and that is not null */ - while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) { + while (!(isxdigit(tmp[0])) && (tmp[0] != '\0')) { + SS7_INFO("Dropping invalid digit: %c\n", tmp[0]); k++; tmp[0] = ftdm->cid_num.digits[k]; } /* while(!(isdigit(tmp))) */ @@ -156,7 +158,7 @@ uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum) /* check if tmp is null or a digit */ if (tmp[0] != '\0') { /* push the digit into the upper nibble */ - upper = (atoi(&tmp[0])) << 4; + upper = (strtol(&tmp[0], (char **)NULL, 16)) << 4; } else { /* there is no upper ... fill in 0 */ upper = 0x0; @@ -243,7 +245,8 @@ uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum) tmp[0] = ftdm->dnis.digits[k]; /* check if the digit is a number and that is not null */ - while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) { + while (!(isxdigit(tmp[0])) && (tmp[0] != '\0')) { + SS7_INFO("Dropping invalid digit: %c\n", tmp[0]); /* move on to the next value */ k++; tmp[0] = ftdm->dnis.digits[k]; @@ -252,14 +255,15 @@ uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum) /* check if tmp is null or a digit */ if (tmp[0] != '\0') { /* push it into the lower nibble */ - lower = atoi(&tmp[0]); + lower = strtol(&tmp[0], (char **)NULL, 16); /* move to the next digit */ k++; /* grab a digit from the ftdm digits */ tmp[0] = ftdm->dnis.digits[k]; /* check if the digit is a number and that is not null */ - while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) { + while (!(isxdigit(tmp[0])) && (tmp[0] != '\0')) { + SS7_INFO("Dropping invalid digit: %c\n", tmp[0]); k++; tmp[0] = ftdm->dnis.digits[k]; } /* while(!(isdigit(tmp))) */ @@ -267,7 +271,7 @@ uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum) /* check if tmp is null or a digit */ if (tmp[0] != '\0') { /* push the digit into the upper nibble */ - upper = (atoi(&tmp[0])) << 4; + upper = (strtol(&tmp[0], (char **)NULL, 16)) << 4; } else { /* there is no upper ... fill in ST */ upper = 0xF0; @@ -984,6 +988,7 @@ ftdm_status_t encode_subAddrIE_nsap(const char *subAddr, char *subAddrIE, int ty /* confirm it is a digit */ if (!isdigit(tmp[0])) { + SS7_INFO("Dropping invalid digit: %c\n", tmp[0]); /* move to the next character in subAddr */ x++; @@ -1068,6 +1073,7 @@ ftdm_status_t encode_subAddrIE_nat(const char *subAddr, char *subAddrIE, int typ /* confirm it is a hex digit */ while ((!isxdigit(tmp[0])) && (tmp[0] != '\0')) { + SS7_INFO("Dropping invalid digit: %c\n", tmp[0]); /* move to the next character in subAddr */ x++; tmp[0] = subAddr[x]; @@ -1084,6 +1090,7 @@ ftdm_status_t encode_subAddrIE_nat(const char *subAddr, char *subAddrIE, int typ /* check if the digit is a hex digit and that is not null */ while (!(isxdigit(tmp[0])) && (tmp[0] != '\0')) { + SS7_INFO("Dropping invalid digit: %c\n", tmp[0]); x++; tmp[0] = subAddr[x]; } /* while(!(isdigit(tmp))) */ commit 8315b954fd22d42547ab72c1f7eb854136998928 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Nov 5 12:26:30 2010 -0500 tweak diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 42f4585..cd25622 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -666,18 +666,19 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess return status; } + switch_mutex_lock(session->codec_write_mutex); + if (!(frame->codec && frame->codec->implementation)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s has received a bad frame with no codec!\n", switch_channel_get_name(session->channel)); switch_channel_hangup(session->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + switch_mutex_unlock(session->codec_write_mutex); return SWITCH_STATUS_FALSE; } switch_assert(frame->codec != NULL); switch_assert(frame->codec->implementation != NULL); - switch_mutex_lock(session->codec_write_mutex); - if (!(switch_core_codec_ready(session->write_codec) && frame->codec) || !switch_channel_ready(session->channel) || !switch_channel_media_ready(session->channel)) { switch_mutex_unlock(session->codec_write_mutex); commit 957262fac1c3da9f2f6face0c929db55ac5a3230 Author: Jeff Lenk <jeff@jefflenk.com> Date: Fri Nov 5 10:36:13 2010 -0500 windows installer fix to last commit diff --git a/w32/Setup/Product.wxs b/w32/Setup/Product.wxs index 775001d..2f072aa 100644 --- a/w32/Setup/Product.wxs +++ b/w32/Setup/Product.wxs @@ -56,6 +56,7 @@ Target="[INSTALLLOCATION]FreeSwitchConsole.exe" WorkingDirectory="INSTALLLOCATION"/> <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/> + <RegistryValue Root="HKCU" Key="Software\FreeSWITCH\FreeSWITCH" Name="installed" Type="integer" Value="1" KeyPath="yes"/> </Component> <Component Id="FSCliShortcut" Guid="D209546C-C728-4d8f-BDB2-29AED8824282"> <Shortcut Id="FSCliStartMenuShortcut" @@ -63,7 +64,7 @@ Description="FreeSWITCH Command Line Interface" Target="[INSTALLLOCATION]fs_cli.exe" WorkingDirectory="INSTALLLOCATION"/> - <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/> + <RegistryValue Root="HKCU" Key="Software\FreeSWITCH\FS_CLI" Name="installed" Type="integer" Value="1" KeyPath="yes"/> </Component> </DirectoryRef> commit 145d64b623d7dbfc629d38da1aa3b6254c5ffa12 Author: Jeff Lenk <jeff@jefflenk.com> Date: Fri Nov 5 10:12:25 2010 -0500 windows wix installer - add more options for fs_cli diff --git a/w32/Setup/Product.wxs b/w32/Setup/Product.wxs index f1fea35..775001d 100644 --- a/w32/Setup/Product.wxs +++ b/w32/Setup/Product.wxs @@ -56,7 +56,14 @@ Target="[INSTALLLOCATION]FreeSwitchConsole.exe" WorkingDirectory="INSTALLLOCATION"/> <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/> - <RegistryValue Root="HKCU" Key="Software\Microsoft\FreeSWITCH" Name="installed" Type="integer" Value="1" KeyPath="yes"/> + </Component> + <Component Id="FSCliShortcut" Guid="D209546C-C728-4d8f-BDB2-29AED8824282"> + <Shortcut Id="FSCliStartMenuShortcut" + Name="FS_Cli" + Description="FreeSWITCH Command Line Interface" + Target="[INSTALLLOCATION]fs_cli.exe" + WorkingDirectory="INSTALLLOCATION"/> + <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/> </Component> </DirectoryRef> @@ -72,8 +79,13 @@ <?if $(var.Platform) = x64 ?> <MergeRef Id="CrtFiles_x64"/> <?endif ?> + </Feature> + <Feature Id="ProductFeatureFreeSWITCH" Title="FreeSWITCH" Level="1"> <ComponentRef Id="ApplicationShortcut" /> </Feature> + <Feature Id="ProductFeatureFSCli" Title="FreeSWITCH Command Line Interface" Level="1"> + <ComponentRef Id="FSCliShortcut" /> + </Feature> <Feature Id="ProductFeatureConf" Title="FreeSWITCH Configuration Sample" Level="1"> <ComponentGroupRef Id="FreeSWITCHConfFiles" /> </Feature> commit 7217b9dc7c141fee27f92d3c23a68a5f8709c8b6 Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Nov 4 17:59:53 2010 -0500 add fs_cli to windows wix install diff --git a/w32/Setup/Setup.wixproj b/w32/Setup/Setup.wixproj index 4df748f..9aba3a1 100644 --- a/w32/Setup/Setup.wixproj +++ b/w32/Setup/Setup.wixproj @@ -48,6 +48,15 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>INSTALLLOCATION</RefTargetDir> </ProjectReference> + <ProjectReference Include="..\..\libs\esl\fs_cli.2010.vcxproj"> + <Name>fs_cli</Name> + <Project>{d2fb8043-d208-4aee-8f18-3b5857c871b9}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>INSTALLLOCATION</RefTargetDir> + </ProjectReference> <ProjectReference Include="..\..\libs\libteletone\libteletone.2010.vcxproj"> <Name>libteletone</Name> <Project>{89385c74-5860-4174-9caf-a39e7c48909c}</Project> commit 5a8695d942ba106ed9864daa38c9068411491209 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Nov 4 19:15:39 2010 -0200 freetdm: added missing EX_DECLARE_DATA diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index d1c57a0..df9e773 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -1727,7 +1727,7 @@ static FIO_SIG_UNLOAD_FUNCTION(ftdm_r2_destroy) return FTDM_SUCCESS; } -ftdm_module_t ftdm_module = { +EX_DECLARE_DATA ftdm_module_t ftdm_module = { "r2", ftdm_r2_io_init, NULL, commit 7dafe4e2c7019be291bd029d7efd9e64cdf51927 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Nov 4 15:40:00 2010 -0500 fail calls with uninitialized frame diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 2478df3..42f4585 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -666,6 +666,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess return status; } + if (!(frame->codec && frame->codec->implementation)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s has received a bad frame with no codec!\n", + switch_channel_get_name(session->channel)); + switch_channel_hangup(session->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + return SWITCH_STATUS_FALSE; + } + switch_assert(frame->codec != NULL); switch_assert(frame->codec->implementation != NULL); commit dcdd38119550b861a45fc34d92e7f93d0a23e7ca Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Nov 4 15:30:02 2010 -0500 fire DTMF event when converting dtmf to inband with start_dtmf_generate diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 23a634c..afd0fdb 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -2187,6 +2187,20 @@ static switch_status_t generate_on_dtmf(switch_core_session_t *session, const sw switch_zmalloc(dt, sizeof(*dt)); *dt = *dtmf; if (switch_queue_trypush(pvt->digit_queue, dt) == SWITCH_STATUS_SUCCESS) { + switch_event_t *event; + + if (switch_event_create(&event, SWITCH_EVENT_DTMF) == SWITCH_STATUS_SUCCESS) { + switch_channel_event_set_data(channel, event); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "DTMF-Digit", "%c", dtmf->digit); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "DTMF-Duration", "%u", dtmf->duration); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "DTMF-Conversion", "native:inband"); + if (switch_channel_test_flag(channel, CF_DIVERT_EVENTS)) { + switch_core_session_queue_event(session, &event); + } else { + switch_event_fire(&event); + } + } + dt = NULL; /* SWITCH_STATUS_FALSE indicates pretend there never was a DTMF commit 2e3163e2bf8098ac4bb41386e59344ef96971344 Author: Arnaldo M Pereira <egghunt@gmail.com> Date: Thu Nov 4 18:26:05 2010 -0200 freetdm: made ftmod_r2 windows compatible and created ftmod_r2.2008.vcproj diff --git a/libs/freetdm/freetdm.2008.sln b/libs/freetdm/freetdm.2008.sln index 61f631f..4d1f019 100644 --- a/libs/freetdm/freetdm.2008.sln +++ b/libs/freetdm/freetdm.2008.sln @@ -63,6 +63,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_sangoma_isdn", "src\f {93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_r2", "src\ftmod\ftmod_r2\ftmod_r2.vcproj", "{94F04D58-5EB8-4B48-8FE5-75EBF468073B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_r2", "src\ftmod\ftmod_r2\ftmod_r2.2008.vcproj", "{08C3EA27-A51D-47F8-B47D-B189C649CF30}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -158,6 +162,18 @@ Global {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|Win32.ActiveCfg = Release|Win32 {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|Win32.Build.0 = Release|Win32 {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|x64.ActiveCfg = Release|Win32 + {94F04D58-5EB8-4B48-8FE5-75EBF468073B}.Debug|Win32.ActiveCfg = Debug|Win32 + {94F04D58-5EB8-4B48-8FE5-75EBF468073B}.Debug|Win32.Build.0 = Debug|Win32 + {94F04D58-5EB8-4B48-8FE5-75EBF468073B}.Debug|x64.ActiveCfg = Debug|Win32 + {94F04D58-5EB8-4B48-8FE5-75EBF468073B}.Release|Win32.ActiveCfg = Release|Win32 + {94F04D58-5EB8-4B48-8FE5-75EBF468073B}.Release|Win32.Build.0 = Release|Win32 + {94F04D58-5EB8-4B48-8FE5-75EBF468073B}.Release|x64.ActiveCfg = Release|Win32 + {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Debug|Win32.ActiveCfg = Debug|Win32 + {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Debug|Win32.Build.0 = Debug|Win32 + {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Debug|x64.ActiveCfg = Debug|Win32 + {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Release|Win32.ActiveCfg = Release|Win32 + {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Release|Win32.Build.0 = Release|Win32 + {08C3EA27-A51D-47F8-B47D-B189C649CF30}.Release|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2008.vcproj b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2008.vcproj new file mode 100644 index 0000000..9ea351b --- /dev/null +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2008.vcproj @@ -0,0 +1,192 @@ +<?xml version="1.0" encoding="UTF-8"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="ftmod_r2" + ProjectGUID="{08C3EA27-A51D-47F8-B47D-B189C649CF30}" + Keyword="Win32Proj" + TargetFrameworkVersion="131072" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories="..\..\include;"c:\Program Files\openr2\include\openr2";"C:\Program Files\openr2\include"" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_R2_EXPORTS;" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="freetdm.lib openr2.lib" + LinkIncremental="2" + AdditionalLibraryDirectories=""C:\Program Files\openr2\lib";"$(OutDir)"" + GenerateDebugInformation="true" + SubSystem="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories="..\..\include;C:\Program Files\openr2\include" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_R2_EXPORTS;" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath=".\ftmod_r2.c" + > + </File> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 637188f..d1c57a0 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -148,6 +148,74 @@ static ftdm_io_interface_t g_ftdm_r2_interface; static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan); + +/* functions not available on windows */ +#ifdef WIN32 +#include <mmsystem.h> + +static __inline int gettimeofday(struct timeval *tp, void *nothing) +{ +#ifdef WITHOUT_MM_LIB + SYSTEMTIME st; + time_t tt; + struct tm tmtm; + /* mktime converts local to UTC */ + GetLocalTime (&st); + tmtm.tm_sec = st.wSecond; + tmtm.tm_min = st.wMinute; + tmtm.tm_hour = st.wHour; + tmtm.tm_mday = st.wDay; + tmtm.tm_mon = st.wMonth - 1; + tmtm.tm_year = st.wYear - 1900; tmtm.tm_isdst = -1; + tt = mktime (&tmtm); + tp->tv_sec = tt; + tp->tv_usec = st.wMilliseconds * 1000; +#else + /** + ** The earlier time calculations using GetLocalTime + ** had a time resolution of 10ms.The timeGetTime, part + ** of multimedia apis offer a better time resolution + ** of 1ms.Need to link against winmm.lib for this + **/ + unsigned long Ticks = 0; + unsigned long Sec =0; + unsigned long Usec = 0; + Ticks = timeGetTime(); + + Sec = Ticks/1000; + Usec = (Ticks - (Sec*1000))*1000; + tp->tv_sec = Sec; + tp->tv_usec = Usec; +#endif /* WITHOUT_MM_LIB */ + (void)nothing; + return 0; +} + +static char *strsep(char **stringp, const char *delim) +{ + char *start = *stringp; + char *ptr; + + if (!start) + return NULL; + + if (!*delim) + ptr = start + strlen(start); + else { + ptr = strpbrk(start, delim); + if (!ptr) { + *stringp = NULL; + return start; + } + } + + *ptr = '\0'; + *stringp = ptr + 1; + + return start; +} +#endif /* WIN32 */ + static ftdm_call_cause_t ftdm_r2_cause_to_ftdm_cause(ftdm_channel_t *fchan, openr2_call_disconnect_cause_t cause) { switch (cause) { @@ -646,24 +714,26 @@ static void ftdm_r2_on_ani_digit_received(openr2_chan_t *r2chan, char digit) } static openr2_event_interface_t ftdm_r2_event_iface = { - .on_call_init = ftdm_r2_on_call_init, - .on_call_offered = ftdm_r2_on_call_offered, - .on_call_accepted = ftdm_r2_on_call_accepted, - .on_call_answered = ftdm_r2_on_call_answered, - .on_call_disconnect = ftdm_r2_on_call_disconnect, - .on_call_end = ftdm_r2_on_call_end, - .on_call_read = ftdm_r2_on_call_read, - .on_hardware_alarm = ftdm_r2_on_hardware_alarm, - .on_os_error = ftdm_r2_on_os_error, - .on_protocol_error = ftdm_r2_on_protocol_error, - .on_line_blocked = ftdm_r2_on_line_blocked, - .on_line_idle = ftdm_r2_on_line_idle, + /* .on_call_init */ ftdm_r2_on_call_init, + /* .on_call_offered */ ftdm_r2_on_call_offered, + /* .on_call_accepted */ ftdm_r2_on_call_accepted, + /* .on_call_answered */ ftdm_r2_on_call_answered, + /* .on_call_disconnect */ ftdm_r2_on_call_disconnect, + /* .on_call_end */ ftdm_r2_on_call_end, + /* .on_call_read */ ftdm_r2_on_call_read, + /* .on_hardware_alarm */ ftdm_r2_on_hardware_alarm, + /* .on_os_error */ ftdm_r2_on_os_error, + /* .on_protocol_error */ ftdm_r2_on_protocol_error, + /* .on_line_blocked */ ftdm_r2_on_line_blocked, + /* .on_line_idle */ ftdm_r2_on_line_idle, + /* cast seems to be needed to get rid of the annoying warning regarding format attribute */ - .on_context_log = (openr2_handle_context_logging_func)ftdm_r2_on_context_log, - .on_dnis_digit_received = ftdm_r2_on_dnis_digit_received, - .on_ani_digit_received = ftdm_r2_on_ani_digit_received, + /* .on_context_log */ (openr2_handle_context_logging_func)ftdm_r2_on_context_log, + /* .on_dnis_digit_received */ ftdm_r2_on_dnis_digit_received, + /* .on_ani_digit_received */ ftdm_r2_on_ani_digit_received, + /* so far we do nothing with billing pulses */ - .on_billing_pulse_received = NULL, + /* .on_billing_pulse_received */ NULL, }; static int ftdm_r2_io_set_cas(openr2_chan_t *r2chan, int cas) @@ -789,16 +859,16 @@ static int ftdm_r2_io_get_oob_event(openr2_chan_t *r2chan, openr2_oob_event_t *e } static openr2_io_interface_t ftdm_r2_io_iface = { - .open = ftdm_r2_io_open, /* never called */ - .close = ftdm_r2_io_close, /* never called */ - .set_cas = ftdm_r2_io_set_cas, - .get_cas = ftdm_r2_io_get_cas, - .flush_write_buffers = ftdm_r2_io_flush_write_buffers, - .write = ftdm_r2_io_write, - .read = ftdm_r2_io_read, - .setup = ftdm_r2_io_setup, /* never called */ - .wait = ftdm_r2_io_wait, - .get_oob_event = ftdm_r2_io_get_oob_event /* never called */ + /* .open */ ftdm_r2_io_open, /* never called */ + /* .close */ ftdm_r2_io_close, /* never called */ + /* .set_cas */ ftdm_r2_io_set_cas, + /* .get_cas */ ftdm_r2_io_get_cas, + /* .flush_write_buffers */ ftdm_r2_io_flush_write_buffers, + /* .write */ ftdm_r2_io_write, + /* .read */ ftdm_r2_io_read, + /* .setup */ ftdm_r2_io_setup, /* never called */ + /* .wait */ ftdm_r2_io_wait, + /* .get_oob_event */ ftdm_r2_io_get_oob_event /* never called */ }; static FIO_SIG_CONFIGURE_FUNCTION(ftdm_r2_configure_span) @@ -812,30 +882,32 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_r2_configure_span) ftdm_r2_span_pvt_t *spanpvt = NULL; ftdm_r2_call_t *r2call = NULL; openr2_chan_t *r2chan = NULL; - - assert(sig_cb != NULL); + openr2_log_level_t tmplevel; + char *clevel; + char *logval = NULL; ft_r2_conf_t r2conf = { - .variant = OR2_VAR_ITU, - .category = OR2_CALLING_PARTY_CATEGORY_NATIONAL_SUBSCRIBER, - .loglevel = OR2_LOG_ERROR | OR2_LOG_WARNING, - .max_ani = 10, - .max_dnis = 4, - .mfback_timeout = -1, - .metering_pulse_timeout = -1, - .allow_collect_calls = -1, - .immediate_accept = -1, - .skip_category = -1, - .forced_release = -1, - .charge_calls = -1, - .get_ani_first = -1, - .call_files = 0, - .mf_files = 0, - .logdir = NULL, - .advanced_protocol_file = NULL + /* .variant */ OR2_VAR_ITU, + /* .category */ OR2_CALLING_PARTY_CATEGORY_NATIONAL_SUBSCRIBER, + /* .loglevel */ OR2_LOG_ERROR | OR2_LOG_WARNING, + /* .max_ani */ 10, + /* .max_dnis */ 4, + /* .mfback_timeout */ -1, + /* .metering_pulse_timeout */ -1, + /* .allow_collect_calls */ -1, + /* .immediate_accept */ -1, + /* .skip_category */ -1, + /* .forced_release */ -1, + /* .charge_calls */ -1, + /* .get_ani_first */ -1, + /* .call_files */ 0, + /* .mf_files */ 0, + /* .logdir */ NULL, + /* .advanced_protocol_file */ NULL }; + assert(sig_cb != NULL); if (span->signal_type) { snprintf(span->last_error, sizeof(span->last_error), "Span is already configured for signalling."); @@ -892,9 +964,7 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_r2_configure_span) ftdm_log(FTDM_LOG_NOTICE, "Ignoring empty R2 logging parameter\n"); continue; } - openr2_log_level_t tmplevel; - char *clevel; - char *logval = ftdm_malloc(strlen(val)+1); /* alloca man page scared me, so better to use good ol' malloc */ + logval = ftdm_malloc(strlen(val)+1); /* alloca man page scared me, so better to use good ol' malloc */ if (!logval) { ftdm_log(FTDM_LOG_WARNING, "Ignoring R2 logging parameter: '%s', failed to alloc memory\n", val); continue; @@ -1288,6 +1358,7 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) } } +#ifndef WIN32 /* figure out what event to poll each channel for. POLLPRI when the channel is down, * POLLPRI|POLLIN|POLLOUT otherwise. */ @@ -1300,6 +1371,9 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) } status = ftdm_span_poll_event(span, waitms, poll_events); +#else + status = ftdm_span_poll_event(span, waitms, NULL); +#endif res = gettimeofday(&start, NULL); if (res) { @@ -1432,6 +1506,10 @@ static FIO_API_FUNCTION(ftdm_r2_api) int span_id = 0; int chan_id = 0; int i = 0; + ftdm_r2_data_t *r2data = NULL; + openr2_chan_t *r2chan = NULL; + openr2_context_t *r2context = NULL; + openr2_variant_t r2variant; if (data) { mycmd = ftdm_strdup(data); @@ -1503,9 +1581,6 @@ static FIO_API_FUNCTION(ftdm_r2_api) if (!strcasecmp(argv[0], "status")) { //openr2_chan_stats_t stats; span_id = atoi(argv[1]); - ftdm_r2_data_t *r2data = NULL; - openr2_chan_t *r2chan = NULL; - openr2_context_t *r2context = NULL; if (ftdm_span_find_by_name(argv[1], &span) == FTDM_SUCCESS || ftdm_span_find(span_id, &span) == FTDM_SUCCESS) { if (span->start != ftdm_r2_start) { @@ -1517,7 +1592,7 @@ static FIO_API_FUNCTION(ftdm_r2_api) goto done; } r2context = r2data->r2context; - openr2_variant_t r2variant = openr2_context_get_variant(r2context); + r2variant = openr2_context_get_variant(r2context); stream->write_function(stream, "Variant: %s\n" "Max ANI: %d\n" commit d205755ae082f9dcf854d836b31d5cd0e5f87e86 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Nov 4 14:38:43 2010 -0500 typo diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index c29c351..7cb4c5b 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2093,10 +2093,10 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag) gateway->reg_timeout_seconds = atoi(timeout_seconds); - if (gateway->retry_seconds < 5) { + if (gateway->reg_timeout_seconds < 5) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid timeout-seconds of %d on gateway %s, using the value of 60 instead.\n", gateway->reg_timeout_seconds, name); - gateway->reg_timeout_seconds = 30; + gateway->reg_timeout_seconds = 60; } commit 56f58c298312c27d23c45ce31efb5e815f5eb115 Author: Geovani Ricardo Wiedenhoft <grw@geovani.(none)> Date: Thu Nov 4 10:04:19 2010 -0200 - flash-to-digits: Defines the digits to be sent when the FLASH is detected on FXS channels; - Updated documentation. diff --git a/src/mod/endpoints/mod_khomp/Install/files/khomp.conf.xml b/src/mod/endpoints/mod_khomp/Install/files/khomp.conf.xml index ec02ca7..45268f3 100644 --- a/src/mod/endpoints/mod_khomp/Install/files/khomp.conf.xml +++ b/src/mod/endpoints/mod_khomp/Install/files/khomp.conf.xml @@ -413,6 +413,12 @@ to be used to initialize a call transfer using PBX-to-PBX signaling. --> <!-- +Defines the digits to be sent when the flash is detected. + +<param name="flash-to-digits" value="*1"/> +--> + +<!-- ;;;;;;;;;;;;;;;;;;;; CONTEXTS WILDCARDS ;;;;;;;;;;;;;;;;;;;;;; For incoming contexts, you can use the following wildcards: @@ -512,16 +518,17 @@ In the example above, the branch numbered 804 will call the number <!-- In this section, you should define options using the following syntax: -'orig_prefix = option1:value | option2:value | option3:value' ... +orig_prefix = option1:value | option2:value | option3:value ... -ex: <param name="804" value="output-volume:+2' /> +ex: <param name="804" value="output-volume:+2" /> In the example above, the branch numbered 804 will have specific configuration for default output volume set to +2. Possible values to options is: context, input-volume, output-volume language, -mohclass, amaflags, accountcode, calleridnum, calleridname, mailbox. +mohclass, amaflags, accountcode, calleridnum, +calleridname, mailbox, flash-to-digits. --> </fxs-options> diff --git a/src/mod/endpoints/mod_khomp/docs/Manual.html b/src/mod/endpoints/mod_khomp/docs/Manual.html index d069955..863ef76 100644 --- a/src/mod/endpoints/mod_khomp/docs/Manual.html +++ b/src/mod/endpoints/mod_khomp/docs/Manual.html @@ -60,6 +60,7 @@ </li><li><b>suppression-delay</b>: Ativa ("yes") ou desativa ("no") o delay necessário para supressão DTMF. Se desativado ("no"), também desativa supressão de DTMFs; </li><li><b>trace</b>: Define opções de depuração. Não deve ser utilizado em produção a não ser que estritamente necessário; </li><li><b>user-transfer-digits</b>: Define uma seqüência de dígitos DTMF para iniciar a transferencia entre o FreeSWITCH® e um outro PABX (utilizando sinalização de usuário, como QSig ou FXO FLASH); +</li><li><b>flash-to-digits</b>: Define os dígitos para serem enviados quando o FLASH é detectado na FXS; </li></ul> <p><br /> </p> @@ -119,7 +120,8 @@ </li><li>accountcode; </li><li>calleridnum; </li><li>calleridname; -</li><li>mailbox. +</li><li>mailbox; +</li><li>flash-to-digits. </li></ul> <p>Cada opção é separada uma da outra por um pipe "|" ou uma barra "/" e definidas após dois pontos ":", exemplo: </p> diff --git a/src/mod/endpoints/mod_khomp/docs/Manual.pdf b/src/mod/endpoints/mod_khomp/docs/Manual.pdf index 665be58..935b299 100644 Binary files a/src/mod/endpoints/mod_khomp/docs/Manual.pdf and b/src/mod/endpoints/mod_khomp/docs/Manual.pdf differ diff --git a/src/mod/endpoints/mod_khomp/docs/README.pdf b/src/mod/endpoints/mod_khomp/docs/README.pdf index a65cc28..2b95cfa 100644 Binary files a/src/mod/endpoints/mod_khomp/docs/README.pdf and b/src/mod/endpoints/mod_khomp/docs/README.pdf differ diff --git a/src/mod/endpoints/mod_khomp/docs/README_en.pdf b/src/mod/endpoints/mod_khomp/docs/README_en.pdf index 2864e40..25be8ab 100644 Binary files a/src/mod/endpoints/mod_khomp/docs/README_en.pdf and b/src/mod/endpoints/mod_khomp/docs/README_en.pdf differ diff --git a/src/mod/endpoints/mod_khomp/docs/User_Guide.html b/src/mod/endpoints/mod_khomp/docs/User_Guide.html index ceb520b..eb5cfc6 100644 --- a/src/mod/endpoints/mod_khomp/docs/User_Guide.html +++ b/src/mod/endpoints/mod_khomp/docs/User_Guide.html @@ -61,6 +61,7 @@ If you need to set advanced parameters of the board and/or signaling, the progra </li><li><b>suppression-delay</b> (former <b>suppressiondelay</b>): Activate ("yes") or disables ("no") the delay necessary to suppress DTMF. If disabled ("no"), also disables suppression of DTMF (local option); </li><li><b>trace</b>: Set debugging options. Should not be used in production unless absolutely necessary; </li><li><b>user-transfer-digits</b>: Defines a sequence of DTMF digits to initiate the transfer between FreeSWITCH® and another PBX (using user signaling, like QSig or FXO FLASH). +</li><li><b>flash-to-digits</b>: Defines the digits to be sent when the FLASH is detected on FXS channels.. </li></ul> <p><br /> </p> @@ -123,7 +124,8 @@ For details, please refer to the configuration file for examples. </li><li>accountcode; </li><li>calleridnum; </li><li>calleridname; -</li><li>mailbox. +</li><li>mailbox; +</li><li>flash-to-digits. </li></ul> <p>Each option is separated from each other by a pipe "|" or a slash "/" and defined after the colon ":". Example: </p> diff --git a/src/mod/endpoints/mod_khomp/docs/User_Guide.pdf b/src/mod/endpoints/mod_khomp/docs/User_Guide.pdf index fd8027b..832596b 100644 Binary files a/src/mod/endpoints/mod_khomp/docs/User_Guide.pdf and b/src/mod/endpoints/mod_khomp/docs/User_Guide.pdf differ diff --git a/src/mod/endpoints/mod_khomp/include/khomp_pvt_kxe1.h b/src/mod/endpoints/mod_khomp/include/khomp_pvt_kxe1.h index 85b1af0..722bd80 100644 --- a/src/mod/endpoints/mod_khomp/include/khomp_pvt_kxe1.h +++ b/src/mod/endpoints/mod_khomp/include/khomp_pvt_kxe1.h @@ -995,6 +995,7 @@ struct KhompPvtFXS: public KhompPvt std::string _language; std::string _accountcode; std::string _mailbox; + std::string _flash; static Opt::OrigToNseqMapType generateNseqMap(); static void dialTimer(KhompPvt * pvt); diff --git a/src/mod/endpoints/mod_khomp/include/opt.h b/src/mod/endpoints/mod_khomp/include/opt.h index 0f93215..3458f9e 100644 --- a/src/mod/endpoints/mod_khomp/include/opt.h +++ b/src/mod/endpoints/mod_khomp/include/opt.h @@ -155,6 +155,7 @@ public: static unsigned int _transferdigittimeout; + static std::string _flash; static std::string _blindxfer; static std::string _atxfer; diff --git a/src/mod/endpoints/mod_khomp/include/revision.h b/src/mod/endpoints/mod_khomp/include/revision.h index bbb7f6b..fe9ef9e 100644 --- a/src/mod/endpoints/mod_khomp/include/revision.h +++ b/src/mod/endpoints/mod_khomp/include/revision.h @@ -1 +1 @@ -#define MOD_KHOMP_VERSION "1.0 - (rev: 5823)" +#define MOD_KHOMP_VERSION "1.0 - (rev: 5841)" diff --git a/src/mod/endpoints/mod_khomp/src/khomp_pvt_kxe1.cpp b/src/mod/endpoints/mod_khomp/src/khomp_pvt_kxe1.cpp index b5acfd1..c0eb1a3 100644 --- a/src/mod/endpoints/mod_khomp/src/khomp_pvt_kxe1.cpp +++ b/src/mod/endpoints/mod_khomp/src/khomp_pvt_kxe1.cpp @@ -2055,6 +2055,7 @@ void BoardE1::KhompPvtFXS::loadOptions() _language = Opt::_global_language; _accountcode = Opt::_accountcode; _mailbox.clear(); + _flash = Opt::_flash; Opt::BranchToOptMapType::iterator it3 = Opt::_branch_options.find(_fxs_orig_addr); @@ -2181,6 +2182,10 @@ bool BoardE1::KhompPvtFXS::parseBranchOptions(std::string options_str) { _mailbox = opt_value; } + else if (opt_name == "flash-to-digits") + { + _flash = opt_value; + } else { DBG(FUNC, PVT_FMT(_target, "[fxs-options] invalid option on branch %s: \"%s\".") % _fxs_orig_addr.c_str() % opt_name.c_str()); @@ -3001,12 +3006,23 @@ bool BoardE1::KhompPvtFXS::onDtmfSendFinish(K3L_EVENT *e) bool BoardE1::KhompPvtFXS::onFlashDetected(K3L_EVENT *e) { - DBG(FUNC, PVT_FMT(_target, "(FXS) c")); + DBG(FUNC, PVT_FMT(_target, "(FXS) c (%s)") % _flash); try { ScopedPvtLock lock(this); + for(std::string::const_iterator it = _flash.begin(); it != _flash.end(); it++) + { + signalDTMF(*it); + } + + DBG(FUNC, PVT_FMT(_target, "(FXS) r")); + + return true; + +/******************************************************************************/ + //Old implementation, not used if(callFXS()->_flags.check(Kflags::FXS_FLASH_TRANSFER)) { DBG(FUNC, PVT_FMT(_target, "(FXS) transfer canceled")); @@ -3043,6 +3059,7 @@ bool BoardE1::KhompPvtFXS::onFlashDetected(K3L_EVENT *e) DBG(FUNC, PVT_FMT(target(), "(FXS) r (unable to start transfer)")); return false; } +/******************************************************************************/ } catch (ScopedLockFailed & err) diff --git a/src/mod/endpoints/mod_khomp/src/opt.cpp b/src/mod/endpoints/mod_khomp/src/opt.cpp index 946f508..8a08023 100644 --- a/src/mod/endpoints/mod_khomp/src/opt.cpp +++ b/src/mod/endpoints/mod_khomp/src/opt.cpp @@ -79,6 +79,7 @@ unsigned int Opt::_fxs_digit_timeout; unsigned int Opt::_transferdigittimeout; +std::string Opt::_flash; std::string Opt::_atxfer; std::string Opt::_blindxfer; @@ -154,7 +155,9 @@ void Opt::initialize(void) Globals::options.add(ConfigOption("transferdigittimeout", _transferdigittimeout, 3000u, 0u, 90000u)); - Globals::options.add(ConfigOption("atxfer", _atxfer, "")); + Globals::options.add(ConfigOption("flash-to-digits", _flash, "*1")); + + Globals::options.add(ConfigOption("atxfer", _atxfer, "")); Globals::options.add(ConfigOption("blindxfer", _blindxfer, "")); Globals::options.add(ConfigOption("delay-ringback-co", _ringback_co_delay, 1500u, 0u, 999000u)); diff --git a/src/mod/endpoints/mod_khomp/src/utils.cpp b/src/mod/endpoints/mod_khomp/src/utils.cpp index a0e6856..cc6eaef 100644 --- a/src/mod/endpoints/mod_khomp/src/utils.cpp +++ b/src/mod/endpoints/mod_khomp/src/utils.cpp @@ -249,6 +249,12 @@ bool MatchExtension::canMatch(std::string & context, std::string & exten, if(finished != std::string::npos) { + if(exten.size() <= 1) + { + DBG(FUNC, FMT("exten=%s size=%d") % exten % exten.size()); + return true; + } + exten.erase(finished); DBG(FUNC, FMT("match exact!!! exten=%s") % exten); return false; commit 20c2740c641ead4f7bef8ba105d02ba3d8523745 Author: Michael Jerris <mike@jerris.com> Date: Wed Nov 3 13:57:59 2010 -0400 set minimum initital sip t1 timer to 1000ms to work around race condition on retry timer firing before all the things that are supposed to be handled by the timer are set. The base resolution on this timer is 500ms, so doubling up makes sure we always hit the initial retry timer on the next run, where everything should be set. The side effect was, 1/2 the time on a request that did not get immediate response, the timer would be fired and cleared, but the action (sending retry) was never done, and a new timer was not set, causing the request to just sit zombied and never retry. A better solution would be to find and correct the race condition so the timer is never set to early and we never hit this condition. diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index 5e1bb2b..aacfc99 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Wed Nov 3 11:46:27 EDT 2010 +Wed Nov 3 13:53:34 EDT 2010 diff --git a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c index 7d3280f..f77cdd3 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c +++ b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c @@ -8176,9 +8176,12 @@ outgoing_send(nta_outgoing_t *orq, int retransmit) if (orq->orq_method == sip_method_ack) ; - else if (!orq->orq_reliable) - outgoing_set_timer(orq, agent->sa_t1); /* Timer A/E */ - else if (orq->orq_try_tcp_instead && !tport_is_connected(tp)) + else if (!orq->orq_reliable) { + /* race condition on initial t1 timer timeout, set minimum initial timeout to 1000ms */ + unsigned t1_timer = agent->sa_t1; + if (t1_timer < 1000) t1_timer = 1000; + outgoing_set_timer(orq, t1_timer); /* Timer A/E */ + } else if (orq->orq_try_tcp_instead && !tport_is_connected(tp)) outgoing_set_timer(orq, agent->sa_t4); /* Timer N3 */ } commit 2043d5a67120d94dc1daab4a9a14a496f6a75735 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Nov 3 12:22:01 2010 -0500 fix display of timeout diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 3c17903..0804080 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -2442,8 +2442,8 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_TRYING) { time_t now = switch_epoch_time_now(NULL); - if (gp->retry > now) { - stream->write_function(stream, " (retry: %ds)", gp->retry - now); + if (gp->reg_timeout > now) { + stream->write_function(stream, " (retry: %ds)", gp->reg_timeout - now); } else { stream->write_function(stream, " (retry: NEVER)"); } commit e5b891eed18d8c6783cdf4a6f234c3cdae02a81b Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Nov 3 10:58:32 2010 -0500 add separate reg timeout from retry sec diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 6a9e4ce..6978e34 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -414,6 +414,7 @@ struct sofia_gateway { time_t expires; time_t retry; time_t ping; + time_t reg_timeout; int pinging; sofia_gateway_status_t status; uint32_t ping_freq; @@ -422,6 +423,7 @@ struct sofia_gateway { int ping_min; uint8_t flags[REG_FLAG_MAX]; int32_t retry_seconds; + int32_t reg_timeout_seconds; int32_t failure_status; reg_state_t state; switch_memory_pool_t *pool; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index ac1251d..c29c351 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1874,6 +1874,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag) *context = profile->context, *expire_seconds = "3600", *retry_seconds = "30", + *timeout_seconds = "60", *from_user = "", *from_domain = NULL, *outbound_proxy = NULL, *register_proxy = NULL, *contact_host = NULL, *contact_params = NULL, *params = NULL, *register_transport = NULL; @@ -1982,6 +1983,8 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag) expire_seconds = val; } else if (!strcmp(var, "retry-seconds")) { retry_seconds = val; + } else if (!strcmp(var, "timeout-seconds")) { + timeout_seconds = val; } else if (!strcmp(var, "retry_seconds")) { // support typo for back compat retry_seconds = val; } else if (!strcmp(var, "from-user")) { @@ -2081,13 +2084,22 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag) } gateway->retry_seconds = atoi(retry_seconds); - + if (gateway->retry_seconds < 5) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid retry-seconds of %d on gateway %s, using the value of 30 instead.\n", gateway->retry_seconds, name); gateway->retry_seconds = 30; } + gateway->reg_timeout_seconds = atoi(timeout_seconds); + + if (gateway->retry_seconds < 5) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid timeout-seconds of %d on gateway %s, using the value of 60 instead.\n", + gateway->reg_timeout_seconds, name); + gateway->reg_timeout_seconds = 30; + } + + gateway->register_scheme = switch_core_strdup(gateway->pool, scheme); gateway->register_context = switch_core_strdup(gateway->pool, context); gateway->register_realm = switch_core_strdup(gateway->pool, realm); diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 2614bd6..67641ae 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -363,7 +363,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now) NUTAG_REGISTRAR(gateway_ptr->register_proxy), NUTAG_OUTBOUND("no-options-keepalive"), NUTAG_OUTBOUND("no-validate"), NUTAG_KEEPALIVE(0), TAG_NULL()); } - gateway_ptr->retry = now + gateway_ptr->retry_seconds; + gateway_ptr->reg_timeout = now + gateway_ptr->reg_timeout_seconds; gateway_ptr->state = REG_STATE_TRYING; switch_safe_free(user_via); user_via = NULL; @@ -408,7 +408,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now) } break; case REG_STATE_TRYING: - if (!gateway_ptr->retry || now >= gateway_ptr->retry) { + if (now >= gateway_ptr->reg_timeout) { gateway_ptr->state = REG_STATE_TIMEOUT; } break; commit fc4d290cb76192fd3847b8d9c003d2ed7167922b Author: Michael Jerris <mike@jerris.com> Date: Wed Nov 3 11:53:39 2010 -0400 add support for NDLB-force-rport=safe param that does force-rport behavior only on endpoints we know are safe to do so on. This is a dirty hack to try to work with certain endpoints behind sonicwall which does not use the same port when it does nat, when the devices do not support rport, while not breaking devices that acutally use different ports that force-rport will break diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index 8a93851..5e1bb2b 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Tue Nov 2 17:57:25 CDT 2010 +Wed Nov 3 11:46:27 EDT 2010 diff --git a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c index abe7e68..7d3280f 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c +++ b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c @@ -1674,7 +1674,7 @@ int agent_set_params(nta_agent_t *agent, tagi_t *tags) progress = 60 * 1000; agent->sa_progress = progress; - if (server_rport > 2) + if (server_rport > 3) server_rport = 1; else if (server_rport < 0) server_rport = 1; @@ -3084,7 +3084,9 @@ int agent_check_request_via(nta_agent_t *agent, rport = su_sprintf(msg_home(msg), "rport=%u", ntohs(from->su_port)); msg_header_replace_param(msg_home(msg), v->v_common, rport); } - else if (agent->sa_server_rport == 2) { + else if (agent->sa_server_rport == 2 || + (agent->sa_server_rport == 3 && sip && sip->sip_user_agent && + sip->sip_user_agent->g_string && !strncasecmp(sip->sip_user_agent->g_string, "Polycom", 7))) { rport = su_sprintf(msg_home(msg), "rport=%u", ntohs(from->su_port)); msg_header_replace_param(msg_home(msg), v->v_common, rport); } diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 0f9e265..ac1251d 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2414,7 +2414,9 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) profile->dtmf_type = DTMF_NONE; } } else if (!strcasecmp(var, "NDLB-force-rport")) { - if (switch_true(val)) { + if (val && !strcasecmp(val, "safe")) { + profile->rport_level = 3; + } else if (switch_true(val)) { profile->rport_level = 2; } } else if (!strcasecmp(var, "caller-id-type")) { @@ -3083,7 +3085,9 @@ switch_status_t config_sofia(int reload, char *profile_name) profile->dtmf_type = DTMF_NONE; } } else if (!strcasecmp(var, "NDLB-force-rport")) { - if (switch_true(val)) { + if (val && !strcasecmp(val, "safe")) { + profile->rport_level = 3; + } else if (switch_true(val)) { profile->rport_level = 2; } } else if (!strcasecmp(var, "auto-rtp-bugs")) { commit 4706d3946d146ef3b4c2bec0ceb916b24445cfb7 Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Tue Nov 2 22:52:09 2010 -0500 skypopen: performance improvements in skypopen_protocol.c and alsa/dummy.c . Added pcm*c to alsa/. Let's hope the larger period in dummy.c does not make problems on ubuntu diff --git a/src/mod/endpoints/mod_skypopen/alsa/dummy.c b/src/mod/endpoints/mod_skypopen/alsa/dummy.c index 6b8c86f..1a369dc 100644 --- a/src/mod/endpoints/mod_skypopen/alsa/dummy.c +++ b/src/mod/endpoints/mod_skypopen/alsa/dummy.c @@ -18,7 +18,6 @@ * */ -//#include <sound/driver.h> //giova #include <linux/init.h> #include <linux/err.h> #include <linux/platform_device.h> @@ -67,7 +66,7 @@ MODULE_SUPPORTED_DEVICE("{{ALSA,Dummy soundcard}}"); #define USE_CHANNELS_MAX 2 #endif #ifndef USE_PERIODS_MIN -#define USE_PERIODS_MIN 1 +#define USE_PERIODS_MIN 10 #endif #ifndef USE_PERIODS_MAX #define USE_PERIODS_MAX 1024 @@ -98,17 +97,17 @@ module_param_array(pcm_substreams, int, NULL, 0444); MODULE_PARM_DESC(pcm_substreams, "PCM substreams # (1-64) for dummy driver."); static struct platform_device *devices[SNDRV_CARDS]; -static struct timer_list giovatimer; -static int giovastarted = 0; -static int giovaindex = 0; -static spinlock_t giovalock; -struct giovadpcm { +static struct timer_list dummytimer; +static int dummystarted = 0; +static int dummyindex = 0; +static spinlock_t dummylock; +struct dummydpcm { struct snd_pcm_substream *substream; struct snd_dummy_pcm *dpcm; int started; int elapsed; }; -static struct giovadpcm giovadpcms[MAX_PCM_SUBSTREAMS]; +static struct dummydpcm dummydpcms[MAX_PCM_SUBSTREAMS]; #define MIXER_ADDR_MASTER 0 #define MIXER_ADDR_LINE 1 @@ -145,19 +144,19 @@ static inline void snd_card_dummy_pcm_timer_start(struct snd_dummy_pcm *dpcm) int i; int found = 0; - for (i = 0; i < giovaindex + 1; i++) { - if (i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS) { - printk("giova, %s:%d, i=%d, giovaindex=%d dpcm=%p\n", __FILE__, __LINE__, i, giovaindex, dpcm); - } + for (i = 0; i < dummyindex + 1; i++) { + //if (i > MAX_PCM_SUBSTREAMS || dummyindex > MAX_PCM_SUBSTREAMS) { + //printk("dummy, %s:%d, i=%d, dummyindex=%d dpcm=%p\n", __FILE__, __LINE__, i, dummyindex, dpcm); + //} - if (giovadpcms[i].dpcm == dpcm) { - giovadpcms[i].started = 1; + if (dummydpcms[i].dpcm == dpcm) { + dummydpcms[i].started = 1; found = 1; } } - if (!found) { - printk("skypopen: start, NOT found?\n"); - } + //if (!found) { + //printk("skypopen: start, NOT found?\n"); + //} } static inline void snd_card_dummy_pcm_timer_stop(struct snd_dummy_pcm *dpcm) @@ -165,14 +164,14 @@ static inline void snd_card_dummy_pcm_timer_stop(struct snd_dummy_pcm *dpcm) int i; int found = 0; - for (i = 0; i < giovaindex + 1; i++) { + for (i = 0; i < dummyindex + 1; i++) { - if (i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS) { - printk("giova, %s:%d, i=%d, giovaindex=%d dpcm=%p\n", __FILE__, __LINE__, i, giovaindex, dpcm); - } - if (giovadpcms[i].dpcm == dpcm) { - giovadpcms[i].started = 0; - giovadpcms[i].elapsed = 0; + //if (i > MAX_PCM_SUBSTREAMS || dummyindex > MAX_PCM_SUBSTREAMS) { + //printk("dummy, %s:%d, i=%d, dummyindex=%d dpcm=%p\n", __FILE__, __LINE__, i, dummyindex, dpcm); + //} + if (dummydpcms[i].dpcm == dpcm) { + dummydpcms[i].started = 0; + dummydpcms[i].elapsed = 0; found = 1; } } @@ -187,7 +186,7 @@ static int snd_card_dummy_pcm_trigger(struct snd_pcm_substream *substream, int c struct snd_dummy_pcm *dpcm = runtime->private_data; int err = 0; - spin_lock_bh(&giovalock); + spin_lock_bh(&dummylock); switch (cmd) { case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_RESUME: @@ -201,7 +200,7 @@ static int snd_card_dummy_pcm_trigger(struct snd_pcm_substream *substream, int c err = -EINVAL; break; } - spin_unlock_bh(&giovalock); + spin_unlock_bh(&dummylock); return 0; } @@ -233,22 +232,26 @@ static void snd_card_dummy_pcm_timer_function(unsigned long data) int i; - giovatimer.expires = 1 + jiffies; - add_timer(&giovatimer); + dummytimer.expires = 1 + jiffies; + add_timer(&dummytimer); - //spin_lock_bh(&giovalock); - for (i = 0; i < giovaindex + 1; i++) { + //spin_lock_bh(&dummylock); + for (i = 0; i < dummyindex + 1; i++) { - if (i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS) { - printk("giova, %s:%d, i=%d, giovaindex=%d dpcm=%p\n", __FILE__, __LINE__, i, giovaindex, dpcm); +#if 0 + if (i > MAX_PCM_SUBSTREAMS || dummyindex > MAX_PCM_SUBSTREAMS) { + printk("dummy, %s:%d, i=%d, dummyindex=%d dpcm=%p\n", __FILE__, __LINE__, i, dummyindex, dpcm); } - if (giovadpcms[i].started != 1) +#endif + if (dummydpcms[i].started != 1) continue; - dpcm = giovadpcms[i].dpcm; + dpcm = dummydpcms[i].dpcm; +#if 0 if (dpcm == NULL) { - printk("giova: timer_func %d %d NULL: continue\n", __LINE__, i); + printk("dummy: timer_func %d %d NULL: continue\n", __LINE__, i); continue; } +#endif //spin_lock_bh(&dpcm->lock); dpcm->pcm_irq_pos += dpcm->pcm_bps * 1; dpcm->pcm_buf_pos += dpcm->pcm_bps * 1; @@ -257,27 +260,31 @@ static void snd_card_dummy_pcm_timer_function(unsigned long data) dpcm->pcm_irq_pos %= dpcm->pcm_period_size * dpcm->pcm_hz; //spin_unlock_bh(&dpcm->lock); //snd_pcm_period_elapsed(dpcm->substream); - giovadpcms[i].elapsed = 1; + dummydpcms[i].elapsed = 1; } else { //spin_unlock_bh(&dpcm->lock); } } - //spin_unlock_bh(&giovalock); - for (i = 0; i < giovaindex + 1; i++) { + //spin_unlock_bh(&dummylock); + for (i = 0; i < dummyindex + 1; i++) { - if (i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS) { - printk("giova, %s:%d, i=%d, giovaindex=%d dpcm=%p\n", __FILE__, __LINE__, i, giovaindex, dpcm); +#if 0 + if (i > MAX_PCM_SUBSTREAMS || dummyindex > MAX_PCM_SUBSTREAMS) { + printk("dummy, %s:%d, i=%d, dummyindex=%d dpcm=%p\n", __FILE__, __LINE__, i, dummyindex, dpcm); } - if (giovadpcms[i].started != 1) +#endif + if (dummydpcms[i].started != 1) continue; - dpcm = giovadpcms[i].dpcm; + dpcm = dummydpcms[i].dpcm; +#if 0 if (dpcm == NULL) { - printk("giova: timer_func %d %d NULL: continue\n", __LINE__, i); + printk("dummy: timer_func %d %d NULL: continue\n", __LINE__, i); continue; } - if (giovadpcms[i].elapsed){ +#endif + if (dummydpcms[i].elapsed){ snd_pcm_period_elapsed(dpcm->substream); - giovadpcms[i].elapsed = 0; + dummydpcms[i].elapsed = 0; } } @@ -294,6 +301,7 @@ static snd_pcm_uframes_t snd_card_dummy_pcm_pointer(struct snd_pcm_substream *su static struct snd_pcm_hardware snd_card_dummy_playback = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_RESUME | SNDRV_PCM_INFO_MMAP_VALID), + //.info = (SNDRV_PCM_INFO_INTERLEAVED), .formats = USE_FORMATS, .rates = USE_RATE, .rate_min = USE_RATE_MIN, @@ -301,7 +309,8 @@ static struct snd_pcm_hardware snd_card_dummy_playback = { .channels_min = USE_CHANNELS_MIN, .channels_max = USE_CHANNELS_MAX, .buffer_bytes_max = MAX_BUFFER_SIZE, - .period_bytes_min = 256, + //.period_bytes_min = 256, + .period_bytes_min = 2048, .period_bytes_max = MAX_PERIOD_SIZE, .periods_min = USE_PERIODS_MIN, .periods_max = USE_PERIODS_MAX, @@ -310,6 +319,7 @@ static struct snd_pcm_hardware snd_card_dummy_playback = { static struct snd_pcm_hardware snd_card_dummy_capture = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_RESUME | SNDRV_PCM_INFO_MMAP_VALID), + //.info = (SNDRV_PCM_INFO_INTERLEAVED), .formats = USE_FORMATS, .rates = USE_RATE, .rate_min = USE_RATE_MIN, @@ -317,7 +327,8 @@ static struct snd_pcm_hardware snd_card_dummy_capture = { .channels_min = USE_CHANNELS_MIN, .channels_max = USE_CHANNELS_MAX, .buffer_bytes_max = MAX_BUFFER_SIZE, - .period_bytes_min = 256, + //.period_bytes_min = 256, + .period_bytes_min = 2048, .period_bytes_max = MAX_PERIOD_SIZE, .periods_min = USE_PERIODS_MIN, .periods_max = USE_PERIODS_MAX, @@ -328,21 +339,21 @@ static void snd_card_dummy_runtime_free(struct snd_pcm_runtime *runtime) { int i; - spin_lock_bh(&giovalock); + spin_lock_bh(&dummylock); - for (i = 0; i < giovaindex; i++) { + for (i = 0; i < dummyindex; i++) { - if (i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS) { - printk("giova, %s:%d, i=%d, giovaindex=%d \n", __FILE__, __LINE__, i, giovaindex); + if (i > MAX_PCM_SUBSTREAMS || dummyindex > MAX_PCM_SUBSTREAMS) { + printk("dummy, %s:%d, i=%d, dummyindex=%d \n", __FILE__, __LINE__, i, dummyindex); } - if ((giovadpcms[i].dpcm == runtime->private_data)) { - giovadpcms[i].started = 0; - giovadpcms[i].elapsed = 0; + if ((dummydpcms[i].dpcm == runtime->private_data)) { + dummydpcms[i].started = 0; + dummydpcms[i].elapsed = 0; } else { } } - spin_unlock_bh(&giovalock); + spin_unlock_bh(&dummylock); kfree(runtime->private_data); } @@ -364,20 +375,20 @@ static struct snd_dummy_pcm *new_pcm_stream(struct snd_pcm_substream *substream) dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL); if (!dpcm) { - printk("giova, %s:%d, giovaindex=%d NO MEMORY!!!!\n", __FILE__, __LINE__, giovaindex); + printk("dummy, %s:%d, dummyindex=%d NO MEMORY!!!!\n", __FILE__, __LINE__, dummyindex); return dpcm; } //init_timer(&dpcm->timer); //spin_lock_init(&dpcm->lock); dpcm->substream = substream; - spin_lock_bh(&giovalock); - for (i = 0; i < giovaindex; i++) { + spin_lock_bh(&dummylock); + for (i = 0; i < dummyindex; i++) { - if (i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS) { - printk("giova, %s:%d, i=%d, giovaindex=%d dpcm=%p\n", __FILE__, __LINE__, i, giovaindex, dpcm); - } - if ((giovadpcms[i].substream == substream)) { + //if (i > MAX_PCM_SUBSTREAMS || dummyindex > MAX_PCM_SUBSTREAMS) { + //printk("dummy, %s:%d, i=%d, dummyindex=%d dpcm=%p\n", __FILE__, __LINE__, i, dummyindex, dpcm); + //} + if ((dummydpcms[i].substream == substream)) { found = 1; break; } @@ -386,32 +397,32 @@ static struct snd_dummy_pcm *new_pcm_stream(struct snd_pcm_substream *substream) if (!found) { - giovadpcms[giovaindex].substream = substream; - giovaindex++; + dummydpcms[dummyindex].substream = substream; + dummyindex++; } found = 0; - for (i = 0; i < giovaindex; i++) { - - if (i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS) { - printk("giova, %s:%d, i=%d, giovaindex=%d dpcm=%p\n", __FILE__, __LINE__, i, giovaindex, dpcm); - } - if (giovadpcms[i].substream == substream) { - giovadpcms[i].dpcm = dpcm; - giovadpcms[i].started = 0; - giovadpcms[i].elapsed = 0; + for (i = 0; i < dummyindex; i++) { + + //if (i > MAX_PCM_SUBSTREAMS || dummyindex > MAX_PCM_SUBSTREAMS) { + //printk("dummy, %s:%d, i=%d, dummyindex=%d dpcm=%p\n", __FILE__, __LINE__, i, dummyindex, dpcm); + //} + if (dummydpcms[i].substream == substream) { + dummydpcms[i].dpcm = dpcm; + dummydpcms[i].started = 0; + dummydpcms[i].elapsed = 0; found = 1; break; } } - spin_unlock_bh(&giovalock); - if (!found) { - printk("skypopen giovaindex=%d NOT found????\n", giovaindex); - } + spin_unlock_bh(&dummylock); + //if (!found) { + //printk("skypopen dummyindex=%d NOT found????\n", dummyindex); + //} return dpcm; } @@ -542,7 +553,7 @@ static int snd_dummy_volume_get(struct snd_kcontrol *kcontrol, struct snd_ctl_el int addr = kcontrol->private_value; if (in_irq()) - printk("giova: line %d we are in HARDWARE IRQ\n", __LINE__); + printk("dummy: line %d we are in HARDWARE IRQ\n", __LINE__); spin_lock_bh(&dummy->mixer_lock); ucontrol->value.integer.value[0] = dummy->mixer_volume[addr][0]; ucontrol->value.integer.value[1] = dummy->mixer_volume[addr][1]; @@ -557,7 +568,7 @@ static int snd_dummy_volume_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el int left, right; if (in_irq()) - printk("giova: line %d we are in HARDWARE IRQ\n", __LINE__); + printk("dummy: line %d we are in HARDWARE IRQ\n", __LINE__); left = ucontrol->value.integer.value[0]; if (left < -50) left = -50; @@ -592,7 +603,7 @@ static int snd_dummy_capsrc_get(struct snd_kcontrol *kcontrol, struct snd_ctl_el int addr = kcontrol->private_value; if (in_irq()) - printk("giova: line %d we are in HARDWARE IRQ\n", __LINE__); + printk("dummy: line %d we are in HARDWARE IRQ\n", __LINE__); spin_lock_bh(&dummy->mixer_lock); ucontrol->value.integer.value[0] = dummy->capture_source[addr][0]; ucontrol->value.integer.value[1] = dummy->capture_source[addr][1]; @@ -607,7 +618,7 @@ static int snd_dummy_capsrc_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el int left, right; if (in_irq()) - printk("giova: line %d we are in HARDWARE IRQ\n", __LINE__); + printk("dummy: line %d we are in HARDWARE IRQ\n", __LINE__); left = ucontrol->value.integer.value[0] & 1; right = ucontrol->value.integer.value[1] & 1; spin_lock_bh(&dummy->mixer_lock); @@ -637,9 +648,9 @@ static int __devinit snd_card_dummy_new_mixer(struct snd_dummy *dummy) unsigned int idx; int err; + return 0; //XXX no mixer spin_lock_init(&dummy->mixer_lock); strcpy(card->mixername, "Dummy Mixer"); - return 0; //giova no mixer for (idx = 0; idx < ARRAY_SIZE(snd_dummy_controls); idx++) { err = snd_ctl_add(card, snd_ctl_new1(&snd_dummy_controls[idx], dummy)); @@ -656,10 +667,6 @@ static int __devinit snd_dummy_probe(struct platform_device *devptr) int idx, err; int dev = devptr->id; - //card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct snd_dummy)); //giova if this gives you problems, comment it out and remove comment from the 4 lines commented below - //if (card == NULL) //giova if this gives you problems, comment it out and remove comment from the 4 lines commented below - //return -ENOMEM; //giova if this gives you problems, comment it out and remove comment from the 4 lines commented below - err = snd_card_create(index[dev], id[dev], THIS_MODULE, sizeof(struct snd_dummy), &card); if (err < 0) @@ -676,9 +683,9 @@ static int __devinit snd_dummy_probe(struct platform_device *devptr) if (err < 0) goto __nodev; } - err = snd_card_dummy_new_mixer(dummy); - if (err < 0) - goto __nodev; + //err = snd_card_dummy_new_mixer(dummy); + //if (err < 0) + //goto __nodev; strcpy(card->driver, "Dummy"); strcpy(card->shortname, "Dummy"); sprintf(card->longname, "Dummy %i", dev + 1); @@ -698,7 +705,7 @@ static int __devinit snd_dummy_probe(struct platform_device *devptr) static int __devexit snd_dummy_remove(struct platform_device *devptr) { - del_timer(&giovatimer); + del_timer(&dummytimer); snd_card_free(platform_get_drvdata(devptr)); platform_set_drvdata(devptr, NULL); return 0; @@ -754,28 +761,28 @@ static int __init alsa_card_dummy_init(void) if (err < 0) return err; - if (!giovastarted) { - giovastarted = 1; - spin_lock_init(&giovalock); + if (!dummystarted) { + dummystarted = 1; + spin_lock_init(&dummylock); - spin_lock_bh(&giovalock); + spin_lock_bh(&dummylock); for (i = 0; i < MAX_PCM_SUBSTREAMS; i++) { - if (i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS) { - printk("giova, %s:%d, i=%d, giovaindex=%d \n", __FILE__, __LINE__, i, giovaindex); - } - giovadpcms[i].substream = NULL; - giovadpcms[i].dpcm = NULL; - giovadpcms[i].started = 0; - giovadpcms[i].elapsed = 0; + //if (i > MAX_PCM_SUBSTREAMS || dummyindex > MAX_PCM_SUBSTREAMS) { + //printk("dummy, %s:%d, i=%d, dummyindex=%d \n", __FILE__, __LINE__, i, dummyindex); + //} + dummydpcms[i].substream = NULL; + dummydpcms[i].dpcm = NULL; + dummydpcms[i].started = 0; + dummydpcms[i].elapsed = 0; } - init_timer(&giovatimer); - giovatimer.data = (unsigned long) &giovadpcms; - giovatimer.function = snd_card_dummy_pcm_timer_function; - giovatimer.expires = 1 + jiffies; - add_timer(&giovatimer); - printk("snd-dummy skypopen driver version: 6, %s:%d working on a machine with %dHZ kernel\n", __FILE__, __LINE__, HZ); - spin_unlock_bh(&giovalock); + init_timer(&dummytimer); + dummytimer.data = (unsigned long) &dummydpcms; + dummytimer.function = snd_card_dummy_pcm_timer_function; + dummytimer.expires = 1 + jiffies; + add_timer(&dummytimer); + printk("snd-dummy skypopen driver version: 9, %s:%d working on a machine with %dHZ kernel\n", __FILE__, __LINE__, HZ); + spin_unlock_bh(&dummylock); } @@ -806,7 +813,7 @@ static int __init alsa_card_dummy_init(void) static void __exit alsa_card_dummy_exit(void) { - del_timer(&giovatimer); + del_timer(&dummytimer); snd_dummy_unregister_all(); } diff --git a/src/mod/endpoints/mod_skypopen/alsa/pcm_lib.c b/src/mod/endpoints/mod_skypopen/alsa/pcm_lib.c new file mode 100644 index 0000000..597a3a6 --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/alsa/pcm_lib.c @@ -0,0 +1,2182 @@ +/* + * Digital Audio (PCM) abstract layer + * Copyright (c) by Jaroslav Kysela <perex@perex.cz> + * Abramo Bagnara <abramo@alsa-project.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 <linux/slab.h> +#include <linux/time.h> +#include <linux/math64.h> +#include <sound/core.h> +#include <sound/control.h> +#include <sound/info.h> +#include <sound/pcm.h> +#include <sound/pcm_params.h> +#include <sound/timer.h> + +/* + * fill ring buffer with silence + * runtime->silence_start: starting pointer to silence area + * runtime->silence_filled: size filled with silence + * runtime->silence_threshold: threshold from application + * runtime->silence_size: maximal size from application + * + * when runtime->silence_size >= runtime->boundary - fill processed area with silence immediately + */ +void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_uframes_t new_hw_ptr) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + snd_pcm_uframes_t frames, ofs, transfer; + + if (runtime->silence_size < runtime->boundary) { + snd_pcm_sframes_t noise_dist, n; + if (runtime->silence_start != runtime->control->appl_ptr) { + n = runtime->control->appl_ptr - runtime->silence_start; + if (n < 0) + n += runtime->boundary; + if ((snd_pcm_uframes_t)n < runtime->silence_filled) + runtime->silence_filled -= n; + else + runtime->silence_filled = 0; + runtime->silence_start = runtime->control->appl_ptr; + } + if (runtime->silence_filled >= runtime->buffer_size) + return; + noise_dist = snd_pcm_playback_hw_avail(runtime) + runtime->silence_filled; + if (noise_dist >= (snd_pcm_sframes_t) runtime->silence_threshold) + return; + frames = runtime->silence_threshold - noise_dist; + if (frames > runtime->silence_size) + frames = runtime->silence_size; + } else { + if (new_hw_ptr == ULONG_MAX) { /* initialization */ + snd_pcm_sframes_t avail = snd_pcm_playback_hw_avail(runtime); + runtime->silence_filled = avail > 0 ? avail : 0; + runtime->silence_start = (runtime->status->hw_ptr + + runtime->silence_filled) % + runtime->boundary; + } else { + ofs = runtime->status->hw_ptr; + frames = new_hw_ptr - ofs; + if ((snd_pcm_sframes_t)frames < 0) + frames += runtime->boundary; + runtime->silence_filled -= frames; + if ((snd_pcm_sframes_t)runtime->silence_filled < 0) { + runtime->silence_filled = 0; + runtime->silence_start = new_hw_ptr; + } else { + runtime->silence_start = ofs; + } + } + frames = runtime->buffer_size - runtime->silence_filled; + } + if (snd_BUG_ON(frames > runtime->buffer_size)) + return; + if (frames == 0) + return; + ofs = runtime->silence_start % runtime->buffer_size; + while (frames > 0) { + transfer = ofs + frames > runtime->buffer_size ? runtime->buffer_size - ofs : frames; + if (runtime->access == SNDRV_PCM_ACCESS_RW_INTERLEAVED || + runtime->access == SNDRV_PCM_ACCESS_MMAP_INTERLEAVED) { + if (substream->ops->silence) { + int err; + err = substream->ops->silence(substream, -1, ofs, transfer); + snd_BUG_ON(err < 0); + } else { + char *hwbuf = runtime->dma_area + frames_to_bytes(runtime, ofs); + snd_pcm_format_set_silence(runtime->format, hwbuf, transfer * runtime->channels); + } + } else { + unsigned int c; + unsigned int channels = runtime->channels; + if (substream->ops->silence) { + for (c = 0; c < channels; ++c) { + int err; + err = substream->ops->silence(substream, c, ofs, transfer); + snd_BUG_ON(err < 0); + } + } else { + size_t dma_csize = runtime->dma_bytes / channels; + for (c = 0; c < channels; ++c) { + char *hwbuf = runtime->dma_area + (c * dma_csize) + samples_to_bytes(runtime, ofs); + snd_pcm_format_set_silence(runtime->format, hwbuf, transfer); + } + } + } + runtime->silence_filled += transfer; + frames -= transfer; + ofs = 0; + } +} + +static void pcm_debug_name(struct snd_pcm_substream *substream, + char *name, size_t len) +{ + snprintf(name, len, "pcmC%dD%d%c:%d", + substream->pcm->card->number, + substream->pcm->device, + substream->stream ? 'c' : 'p', + substream->number); +} + +#define XRUN_DEBUG_BASIC (1<<0) +#define XRUN_DEBUG_STACK (1<<1) /* dump also stack */ +#define XRUN_DEBUG_JIFFIESCHECK (1<<2) /* do jiffies check */ +#define XRUN_DEBUG_PERIODUPDATE (1<<3) /* full period update info */ +#define XRUN_DEBUG_HWPTRUPDATE (1<<4) /* full hwptr update info */ +#define XRUN_DEBUG_LOG (1<<5) /* show last 10 positions on err */ +#define XRUN_DEBUG_LOGONCE (1<<6) /* do above only once */ + +#ifdef CONFIG_SND_PCM_XRUN_DEBUG + +#define xrun_debug(substream, mask) \ + ((substream)->pstr->xrun_debug & (mask)) +#else +#define xrun_debug(substream, mask) 0 +#endif + +#define dump_stack_on_xrun(substream) do { \ + if (xrun_debug(substream, XRUN_DEBUG_STACK)) \ + dump_stack(); \ + } while (0) + +static void xrun(struct snd_pcm_substream *substream) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + + if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) + snd_pcm_gettime(runtime, (struct timespec *)&runtime->status->tstamp); + snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); + if (xrun_debug(substream, XRUN_DEBUG_BASIC)) { + char name[16]; + pcm_debug_name(substream, name, sizeof(name)); + snd_printd(KERN_DEBUG "XRUN: %s\n", name); + dump_stack_on_xrun(substream); + } +} + +#ifdef CONFIG_SND_PCM_XRUN_DEBUG +#define hw_ptr_error(substream, fmt, args...) \ + do { \ + if (xrun_debug(substream, XRUN_DEBUG_BASIC)) { \ + xrun_log_show(substream); \ + if (printk_ratelimit()) { \ + snd_printd("PCM: " fmt, ##args); \ + } \ + dump_stack_on_xrun(substream); \ + } \ + } while (0) + +#define XRUN_LOG_CNT 10 + +struct hwptr_log_entry { + unsigned long jiffies; + snd_pcm_uframes_t pos; + snd_pcm_uframes_t period_size; + snd_pcm_uframes_t buffer_size; + snd_pcm_uframes_t old_hw_ptr; + snd_pcm_uframes_t hw_ptr_base; +}; + +struct snd_pcm_hwptr_log { + unsigned int idx; + unsigned int hit: 1; + struct hwptr_log_entry entries[XRUN_LOG_CNT]; +}; + +static void xrun_log(struct snd_pcm_substream *substream, + snd_pcm_uframes_t pos) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + struct snd_pcm_hwptr_log *log = runtime->hwptr_log; + struct hwptr_log_entry *entry; + + if (log == NULL) { + log = kzalloc(sizeof(*log), GFP_ATOMIC); + if (log == NULL) + return; + runtime->hwptr_log = log; + } else { + if (xrun_debug(substream, XRUN_DEBUG_LOGONCE) && log->hit) + return; + } + entry = &log->entries[log->idx]; + entry->jiffies = jiffies; + entry->pos = pos; + entry->period_size = runtime->period_size; + entry->buffer_size = runtime->buffer_size;; + entry->old_hw_ptr = runtime->status->hw_ptr; + entry->hw_ptr_base = runtime->hw_ptr_base; + log->idx = (log->idx + 1) % XRUN_LOG_CNT; +} + +static void xrun_log_show(struct snd_pcm_substream *substream) +{ + struct snd_pcm_hwptr_log *log = substream->runtime->hwptr_log; + struct hwptr_log_entry *entry; + char name[16]; + unsigned int idx; + int cnt; + + if (log == NULL) + return; + if (xrun_debug(substream, XRUN_DEBUG_LOGONCE) && log->hit) + return; + pcm_debug_name(substream, name, sizeof(name)); + for (cnt = 0, idx = log->idx; cnt < XRUN_LOG_CNT; cnt++) { + entry = &log->entries[idx]; + if (entry->period_size == 0) + break; + snd_printd("hwptr log: %s: j=%lu, pos=%ld/%ld/%ld, " + "hwptr=%ld/%ld\n", + name, entry->jiffies, (unsigned long)entry->pos, + (unsigned long)entry->period_size, + (unsigned long)entry->buffer_size, + (unsigned long)entry->old_hw_ptr, + (unsigned long)entry->hw_ptr_base); + idx++; + idx %= XRUN_LOG_CNT; + } + log->hit = 1; +} + +#else /* ! CONFIG_SND_PCM_XRUN_DEBUG */ + +#define hw_ptr_error(substream, fmt, args...) do { } while (0) +#define xrun_log(substream, pos) do { } while (0) +#define xrun_log_show(substream) do { } while (0) + +#endif + +int snd_pcm_update_state(struct snd_pcm_substream *substream, + struct snd_pcm_runtime *runtime) +{ + snd_pcm_uframes_t avail; + + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + avail = snd_pcm_playback_avail(runtime); + else + avail = snd_pcm_capture_avail(runtime); + if (avail > runtime->avail_max) + runtime->avail_max = avail; + if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) { + if (avail >= runtime->buffer_size) { + snd_pcm_drain_done(substream); + return -EPIPE; + } + } else { + if (avail >= runtime->stop_threshold) { + xrun(substream); + return -EPIPE; + } + } + if (avail >= runtime->control->avail_min) + wake_up(runtime->twake ? &runtime->tsleep : &runtime->sleep); + return 0; +} + +static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream, + unsigned int in_interrupt) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + snd_pcm_uframes_t pos; + snd_pcm_uframes_t old_hw_ptr, new_hw_ptr, hw_base; + snd_pcm_sframes_t hdelta, delta; + unsigned long jdelta; + + old_hw_ptr = runtime->status->hw_ptr; + pos = substream->ops->pointer(substream); + if (pos == SNDRV_PCM_POS_XRUN) { + xrun(substream); + return -EPIPE; + } + if (pos >= runtime->buffer_size) { + if (printk_ratelimit()) { + char name[16]; + pcm_debug_name(substream, name, sizeof(name)); + xrun_log_show(substream); + snd_printd(KERN_ERR "BUG: %s, pos = %ld, " + "buffer size = %ld, period size = %ld\n", + name, pos, runtime->buffer_size, + runtime->period_size); + } + pos = 0; + } + pos -= pos % runtime->min_align; + if (xrun_debug(substream, XRUN_DEBUG_LOG)) + xrun_log(substream, pos); + hw_base = runtime->hw_ptr_base; + new_hw_ptr = hw_base + pos; + if (in_interrupt) { + /* we know that one period was processed */ + /* delta = "expected next hw_ptr" for in_interrupt != 0 */ + delta = runtime->hw_ptr_interrupt + runtime->period_size; + if (delta > new_hw_ptr) { + hw_base += runtime->buffer_size; + if (hw_base >= runtime->boundary) + hw_base = 0; + new_hw_ptr = hw_base + pos; + goto __delta; + } + } + /* new_hw_ptr might be lower than old_hw_ptr in case when */ + /* pointer crosses the end of the ring buffer */ + if (new_hw_ptr < old_hw_ptr) { + hw_base += runtime->buffer_size; + if (hw_base >= runtime->boundary) + hw_base = 0; + new_hw_ptr = hw_base + pos; + } + __delta: + delta = (new_hw_ptr - old_hw_ptr) % runtime->boundary; + if (xrun_debug(substream, in_interrupt ? + XRUN_DEBUG_PERIODUPDATE : XRUN_DEBUG_HWPTRUPDATE)) { + char name[16]; + pcm_debug_name(substream, name, sizeof(name)); + snd_printd("%s_update: %s: pos=%u/%u/%u, " + "hwptr=%ld/%ld/%ld/%ld\n", + in_interrupt ? "period" : "hwptr", + name, + (unsigned int)pos, + (unsigned int)runtime->period_size, + (unsigned int)runtime->buffer_size, + (unsigned long)delta, + (unsigned long)old_hw_ptr, + (unsigned long)new_hw_ptr, + (unsigned long)runtime->hw_ptr_base); + } + /* something must be really wrong */ + if (delta >= runtime->buffer_size + runtime->period_size) { + hw_ptr_error(substream, + "Unexpected hw_pointer value %s" + "(stream=%i, pos=%ld, new_hw_ptr=%ld, " + "old_hw_ptr=%ld)\n", + in_interrupt ? "[Q] " : "[P]", + substream->stream, (long)pos, + (long)new_hw_ptr, (long)old_hw_ptr); + return 0; + } + + /* Do jiffies check only in xrun_debug mode */ + if (!xrun_debug(substream, XRUN_DEBUG_JIFFIESCHECK)) + goto no_jiffies_check; + + /* Skip the jiffies check for hardwares with BATCH flag. + * Such hardware usually just increases the position at each IRQ, + * thus it can't give any strange position. + */ + if (runtime->hw.info & SNDRV_PCM_INFO_BATCH) + goto no_jiffies_check; + hdelta = delta; + if (hdelta < runtime->delay) + goto no_jiffies_check; + hdelta -= runtime->delay; + jdelta = jiffies - runtime->hw_ptr_jiffies; + if (((hdelta * HZ) / runtime->rate) > jdelta + HZ/100) { + delta = jdelta / + (((runtime->period_size * HZ) / runtime->rate) + + HZ/100); + /* move new_hw_ptr according jiffies not pos variable */ + new_hw_ptr = old_hw_ptr; + hw_base = delta; + /* use loop to avoid checks for delta overflows */ + /* the delta value is small or zero in most cases */ + while (delta > 0) { + new_hw_ptr += runtime->period_size; + if (new_hw_ptr >= runtime->boundary) + new_hw_ptr -= runtime->boundary; + delta--; + } + /* align hw_base to buffer_size */ + hw_ptr_error(substream, + "hw_ptr skipping! %s" + "(pos=%ld, delta=%ld, period=%ld, " + "jdelta=%lu/%lu/%lu, hw_ptr=%ld/%ld)\n", + in_interrupt ? "[Q] " : "", + (long)pos, (long)hdelta, + (long)runtime->period_size, jdelta, + ((hdelta * HZ) / runtime->rate), hw_base, + (unsigned long)old_hw_ptr, + (unsigned long)new_hw_ptr); + /* reset values to proper state */ + delta = 0; + hw_base = new_hw_ptr - (new_hw_ptr % runtime->buffer_size); + } + no_jiffies_check: + if (delta > runtime->period_size + runtime->period_size / 2) { + hw_ptr_error(substream, + "Lost interrupts? %s" + "(stream=%i, delta=%ld, new_hw_ptr=%ld, " + "old_hw_ptr=%ld)\n", + in_interrupt ? "[Q] " : "", + substream->stream, (long)delta, + (long)new_hw_ptr, + (long)old_hw_ptr); + } + + if (runtime->status->hw_ptr == new_hw_ptr) + return 0; + + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && + runtime->silence_size > 0) + snd_pcm_playback_silence(substream, new_hw_ptr); + + if (in_interrupt) { + runtime->hw_ptr_interrupt = new_hw_ptr - + (new_hw_ptr % runtime->period_size); + } + runtime->hw_ptr_base = hw_base; + runtime->status->hw_ptr = new_hw_ptr; + runtime->hw_ptr_jiffies = jiffies; + if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) + snd_pcm_gettime(runtime, (struct timespec *)&runtime->status->tstamp); + + return snd_pcm_update_state(substream, runtime); +} + +/* CAUTION: call it with irq disabled */ +int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream) +{ + return snd_pcm_update_hw_ptr0(substream, 0); +} + +/** + * snd_pcm_set_ops - set the PCM operators + * @pcm: the pcm instance + * @direction: stream direction, SNDRV_PCM_STREAM_XXX + * @ops: the operator table + * + * Sets the given PCM operators to the pcm instance. + */ +void snd_pcm_set_ops(struct snd_pcm *pcm, int direction, struct snd_pcm_ops *ops) +{ + struct snd_pcm_str *stream = &pcm->streams[direction]; + struct snd_pcm_substream *substream; + + for (substream = stream->substream; substream != NULL; substream = substream->next) + substream->ops = ops; +} + +EXPORT_SYMBOL(snd_pcm_set_ops); + +/** + * snd_pcm_sync - set the PCM sync id + * @substream: the pcm substream + * + * Sets the PCM sync identifier for the card. + */ +void snd_pcm_set_sync(struct snd_pcm_substream *substream) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + + runtime->sync.id32[0] = substream->pcm->card->number; + runtime->sync.id32[1] = -1; + runtime->sync.id32[2] = -1; + runtime->sync.id32[3] = -1; +} + +EXPORT_SYMBOL(snd_pcm_set_sync); + +/* + * Standard ioctl routine + */ + +static inline unsigned int div32(unsigned int a, unsigned int b, + unsigned int *r) +{ + if (b == 0) { + *r = 0; + return UINT_MAX; + } + *r = a % b; + return a / b; +} + +static inline unsigned int div_down(unsigned int a, unsigned int b) +{ + if (b == 0) + return UINT_MAX; + return a / b; +} + +static inline unsigned int div_up(unsigned int a, unsigned int b) +{ + unsigned int r; + unsigned int q; + if (b == 0) + return UINT_MAX; + q = div32(a, b, &r); + if (r) + ++q; + return q; +} + +static inline unsigned int mul(unsigned int a, unsigned int b) +{ + if (a == 0) + return 0; + if (div_down(UINT_MAX, a) < b) + return UINT_MAX; + return a * b; +} + +static inline unsigned int muldiv32(unsigned int a, unsigned int b, + unsigned int c, unsigned int *r) +{ + u_int64_t n = (u_int64_t) a * b; + if (c == 0) { + snd_BUG_ON(!n); + *r = 0; + return UINT_MAX; + } + n = div_u64_rem(n, c, r); + if (n >= UINT_MAX) { + *r = 0; + return UINT_MAX; + } + return n; +} + +/** + * snd_interval_refine - refine the interval value of configurator + * @i: the interval value to refine + * @v: the interval value to refer to + * + * Refines the interval value with the reference value. + * The interval is changed to the range satisfying both intervals. + * The interval status (min, max, integer, etc.) are evaluated. + * + * Returns non-zero if the value is changed, zero if not changed. + */ +int snd_interval_refine(struct snd_interval *i, const struct snd_interval *v) +{ + int changed = 0; + if (snd_BUG_ON(snd_interval_empty(i))) + return -EINVAL; + if (i->min < v->min) { + i->min = v->min; + i->openmin = v->openmin; + changed = 1; + } else if (i->min == v->min && !i->openmin && v->openmin) { + i->openmin = 1; + changed = 1; + } + if (i->max > v->max) { + i->max = v->max; + i->openmax = v->openmax; + changed = 1; + } else if (i->max == v->max && !i->openmax && v->openmax) { + i->openmax = 1; + changed = 1; + } + if (!i->integer && v->integer) { + i->integer = 1; + changed = 1; + } + if (i->integer) { + if (i->openmin) { + i->min++; + i->openmin = 0; + } + if (i->openmax) { + i->max--; + i->openmax = 0; + } + } else if (!i->openmin && !i->openmax && i->min == i->max) + i->integer = 1; + if (snd_interval_checkempty(i)) { + snd_interval_none(i); + return -EINVAL; + } + return changed; +} + +EXPORT_SYMBOL(snd_interval_refine); + +static int snd_interval_refine_first(struct snd_interval *i) +{ + if (snd_BUG_ON(snd_interval_empty(i))) + return -EINVAL; + if (snd_interval_single(i)) + return 0; + i->max = i->min; + i->openmax = i->openmin; + if (i->openmax) + i->max++; + return 1; +} + +static int snd_interval_refine_last(struct snd_interval *i) +{ + if (snd_BUG_ON(snd_interval_empty(i))) + return -EINVAL; + if (snd_interval_single(i)) + return 0; + i->min = i->max; + i->openmin = i->openmax; + if (i->openmin) + i->min--; + return 1; +} + +void snd_interval_mul(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c) +{ + if (a->empty || b->empty) { + snd_interval_none(c); + return; + } + c->empty = 0; + c->min = mul(a->min, b->min); + c->openmin = (a->openmin || b->openmin); + c->max = mul(a->max, b->max); + c->openmax = (a->openmax || b->openmax); + c->integer = (a->integer && b->integer); +} + +/** + * snd_interval_div - refine the interval value with division + * @a: dividend + * @b: divisor + * @c: quotient + * + * c = a / b + * + * Returns non-zero if the value is changed, zero if not changed. + */ +void snd_interval_div(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c) +{ + unsigned int r; + if (a->empty || b->empty) { + snd_interval_none(c); + return; + } + c->empty = 0; + c->min = div32(a->min, b->max, &r); + c->openmin = (r || a->openmin || b->openmax); + if (b->min > 0) { + c->max = div32(a->max, b->min, &r); + if (r) { + c->max++; + c->openmax = 1; + } else + c->openmax = (a->openmax || b->openmin); + } else { + c->max = UINT_MAX; + c->openmax = 0; + } + c->integer = 0; +} + +/** + * snd_interval_muldivk - refine the interval value + * @a: dividend 1 + * @b: dividend 2 + * @k: divisor (as integer) + * @c: result + * + * c = a * b / k + * + * Returns non-zero if the value is changed, zero if not changed. + */ +void snd_interval_muldivk(const struct snd_interval *a, const struct snd_interval *b, + unsigned int k, struct snd_interval *c) +{ + unsigned int r; + if (a->empty || b->empty) { + snd_interval_none(c); + return; + } + c->empty = 0; + c->min = muldiv32(a->min, b->min, k, &r); + c->openmin = (r || a->openmin || b->openmin); + c->max = muldiv32(a->max, b->max, k, &r); + if (r) { + c->max++; + c->openmax = 1; + } else + c->openmax = (a->openmax || b->openmax); + c->integer = 0; +} + +/** + * snd_interval_mulkdiv - refine the interval value + * @a: dividend 1 + * @k: dividend 2 (as integer) + * @b: divisor + * @c: result + * + * c = a * k / b + * + * Returns non-zero if the value is changed, zero if not changed. + */ +void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k, + const struct snd_interval *b, struct snd_interval *c) +{ + unsigned int r; + if (a->empty || b->empty) { + snd_interval_none(c); + return; + } + c->empty = 0; + c->min = muldiv32(a->min, k, b->max, &r); + c->openmin = (r || a->openmin || b->openmax); + if (b->min > 0) { + c->max = muldiv32(a->max, k, b->min, &r); + if (r) { + c->max++; + c->openmax = 1; + } else + c->openmax = (a->openmax || b->openmin); + } else { + c->max = UINT_MAX; + c->openmax = 0; + } + c->integer = 0; +} + +/* ---- */ + + +/** + * snd_interval_ratnum - refine the interval value + * @i: interval to refine + * @rats_count: number of ratnum_t + * @rats: ratnum_t array + * @nump: pointer to store the resultant numerator + * @denp: pointer to store the resultant denominator + * + * Returns non-zero if the value is changed, zero if not changed. + */ +int snd_interval_ratnum(struct snd_interval *i, + unsigned int rats_count, struct snd_ratnum *rats, + unsigned int *nump, unsigned int *denp) +{ + unsigned int best_num, best_den; + int best_diff; + unsigned int k; + struct snd_interval t; + int err; + unsigned int result_num, result_den; + int result_diff; + + best_num = best_den = best_diff = 0; + for (k = 0; k < rats_count; ++k) { + unsigned int num = rats[k].num; + unsigned int den; + unsigned int q = i->min; + int diff; + if (q == 0) + q = 1; + den = div_up(num, q); + if (den < rats[k].den_min) + continue; + if (den > rats[k].den_max) + den = rats[k].den_max; + else { + unsigned int r; + r = (den - rats[k].den_min) % rats[k].den_step; + if (r != 0) + den -= r; + } + diff = num - q * den; + if (diff < 0) + diff = -diff; + if (best_num == 0 || + diff * best_den < best_diff * den) { + best_diff = diff; + best_den = den; + best_num = num; + } + } + if (best_den == 0) { + i->empty = 1; + return -EINVAL; + } + t.min = div_down(best_num, best_den); + t.openmin = !!(best_num % best_den); + + result_num = best_num; + result_diff = best_diff; + result_den = best_den; + best_num = best_den = best_diff = 0; + for (k = 0; k < rats_count; ++k) { + unsigned int num = rats[k].num; + unsigned int den; + unsigned int q = i->max; + int diff; + if (q == 0) { + i->empty = 1; + return -EINVAL; + } + den = div_down(num, q); + if (den > rats[k].den_max) + continue; + if (den < rats[k].den_min) + den = rats[k].den_min; + else { + unsigned int r; + r = (den - rats[k].den_min) % rats[k].den_step; + if (r != 0) + den += rats[k].den_step - r; + } + diff = q * den - num; + if (diff < 0) + diff = -diff; + if (best_num == 0 || + diff * best_den < best_diff * den) { + best_diff = diff; + best_den = den; + best_num = num; + } + } + if (best_den == 0) { + i->empty = 1; + return -EINVAL; + } + t.max = div_up(best_num, best_den); + t.openmax = !!(best_num % best_den); + t.integer = 0; + err = snd_interval_refine(i, &t); + if (err < 0) + return err; + + if (snd_interval_single(i)) { + if (best_diff * result_den < result_diff * best_den) { + result_num = best_num; + result_den = best_den; + } + if (nump) + *nump = result_num; + if (denp) + *denp = result_den; + } + return err; +} + +EXPORT_SYMBOL(snd_interval_ratnum); + +/** + * snd_interval_ratden - refine the interval value + * @i: interval to refine + * @rats_count: number of struct ratden + * @rats: struct ratden array + * @nump: pointer to store the resultant numerator + * @denp: pointer to store the resultant denominator + * + * Returns non-zero if the value is changed, zero if not changed. + */ +static int snd_interval_ratden(struct snd_interval *i, + unsigned int rats_count, struct snd_ratden *rats, + unsigned int *nump, unsigned int *denp) +{ + unsigned int best_num, best_diff, best_den; + unsigned int k; + struct snd_interval t; + int err; + + best_num = best_den = best_diff = 0; + for (k = 0; k < rats_count; ++k) { + unsigned int num; + unsigned int den = rats[k].den; + unsigned int q = i->min; + int diff; + num = mul(q, den); + if (num > rats[k].num_max) + continue; + if (num < rats[k].num_min) + num = rats[k].num_max; + else { + unsigned int r; + r = (num - rats[k].num_min) % rats[k].num_step; + if (r != 0) + num += rats[k].num_step - r; + } + diff = num - q * den; + if (best_num == 0 || + diff * best_den < best_diff * den) { + best_diff = diff; + best_den = den; + best_num = num; + } + } + if (best_den == 0) { + i->empty = 1; + return -EINVAL; + } + t.min = div_down(best_num, best_den); + t.openmin = !!(best_num % best_den); + + best_num = best_den = best_diff = 0; + for (k = 0; k < rats_count; ++k) { + unsigned int num; + unsigned int den = rats[k].den; + unsigned int q = i->max; + int diff; + num = mul(q, den); + if (num < rats[k].num_min) + continue; + if (num > rats[k].num_max) + num = rats[k].num_max; + else { + unsigned int r; + r = (num - rats[k].num_min) % rats[k].num_step; + if (r != 0) + num -= r; + } + diff = q * den - num; + if (best_num == 0 || + diff * best_den < best_diff * den) { + best_diff = diff; + best_den = den; + best_num = num; + } + } + if (best_den == 0) { + i->empty = 1; + return -EINVAL; + } + t.max = div_up(best_num, best_den); + t.openmax = !!(best_num % best_den); + t.integer = 0; + err = snd_interval_refine(i, &t); + if (err < 0) + return err; + + if (snd_interval_single(i)) { + if (nump) + *nump = best_num; + if (denp) + *denp = best_den; + } + return err; +} + +/** + * snd_interval_list - refine the interval value from the list + * @i: the interval value to refine + * @count: the number of elements in the list + * @list: the value list + * @mask: the bit-mask to evaluate + * + * Refines the interval value from the list. + * When mask is non-zero, only the elements corresponding to bit 1 are + * evaluated. + * + * Returns non-zero if the value is changed, zero if not changed. + */ +int snd_interval_list(struct snd_interval *i, unsigned int count, unsigned int *list, unsigned int mask) +{ + unsigned int k; + struct snd_interval list_range; + + if (!count) { + i->empty = 1; + return -EINVAL; + } + snd_interval_any(&list_range); + list_range.min = UINT_MAX; + list_range.max = 0; + for (k = 0; k < count; k++) { + if (mask && !(mask & (1 << k))) + continue; + if (!snd_interval_test(i, list[k])) + continue; + list_range.min = min(list_range.min, list[k]); + list_range.max = max(list_range.max, list[k]); + } + return snd_interval_refine(i, &list_range); +} + +EXPORT_SYMBOL(snd_interval_list); + +static int snd_interval_step(struct snd_interval *i, unsigned int min, unsigned int step) +{ + unsigned int n; + int changed = 0; + n = (i->min - min) % step; + if (n != 0 || i->openmin) { + i->min += step - n; + changed = 1; + } + n = (i->max - min) % step; + if (n != 0 || i->openmax) { + i->max -= n; + changed = 1; + } + if (snd_interval_checkempty(i)) { + i->empty = 1; + return -EINVAL; + } + return changed; +} + +/* Info constraints helpers */ + +/** + * snd_pcm_hw_rule_add - add the hw-constraint rule + * @runtime: the pcm runtime instance + * @cond: condition bits + * @var: the variable to evaluate + * @func: the evaluation function + * @private: the private data pointer passed to function + * @dep: the dependent variables + * + * Returns zero if successful, or a negative error code on failure. + */ +int snd_pcm_hw_rule_add(struct snd_pcm_runtime *runtime, unsigned int cond, + int var, + snd_pcm_hw_rule_func_t func, void *private, + int dep, ...) +{ + struct snd_pcm_hw_constraints *constrs = &runtime->hw_constraints; + struct snd_pcm_hw_rule *c; + unsigned int k; + va_list args; + va_start(args, dep); + if (constrs->rules_num >= constrs->rules_all) { + struct snd_pcm_hw_rule *new; + unsigned int new_rules = constrs->rules_all + 16; + new = kcalloc(new_rules, sizeof(*c), GFP_KERNEL); + if (!new) + return -ENOMEM; + if (constrs->rules) { + memcpy(new, constrs->rules, + constrs->rules_num * sizeof(*c)); + kfree(constrs->rules); + } + constrs->rules = new; + constrs->rules_all = new_rules; + } + c = &constrs->rules[constrs->rules_num]; + c->cond = cond; + c->func = func; + c->var = var; + c->private = private; + k = 0; + while (1) { + if (snd_BUG_ON(k >= ARRAY_SIZE(c->deps))) + return -EINVAL; + c->deps[k++] = dep; + if (dep < 0) + break; + dep = va_arg(args, int); + } + constrs->rules_num++; + va_end(args); + return 0; +} + +EXPORT_SYMBOL(snd_pcm_hw_rule_add); + +/** + * snd_pcm_hw_constraint_mask - apply the given bitmap mask constraint + * @runtime: PCM runtime instance + * @var: hw_params variable to apply the mask + * @mask: the bitmap mask + * + * Apply the constraint of the given bitmap mask to a 32-bit mask parameter. + */ +int snd_pcm_hw_constraint_mask(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var, + u_int32_t mask) +{ + struct snd_pcm_hw_constraints *constrs = &runtime->hw_constraints; + struct snd_mask *maskp = constrs_mask(constrs, var); + *maskp->bits &= mask; + memset(maskp->bits + 1, 0, (SNDRV_MASK_MAX-32) / 8); /* clear rest */ + if (*maskp->bits == 0) + return -EINVAL; + return 0; +} + +/** + * snd_pcm_hw_constraint_mask64 - apply the given bitmap mask constraint + * @runtime: PCM runtime instance + * @var: hw_params variable to apply the mask + * @mask: the 64bit bitmap mask + * + * Apply the constraint of the given bitmap mask to a 64-bit mask parameter. + */ +int snd_pcm_hw_constraint_mask64(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var, + u_int64_t mask) +{ + struct snd_pcm_hw_constraints *constrs = &runtime->hw_constraints; + struct snd_mask *maskp = constrs_mask(constrs, var); + maskp->bits[0] &= (u_int32_t)mask; + maskp->bits[1] &= (u_int32_t)(mask >> 32); + memset(maskp->bits + 2, 0, (SNDRV_MASK_MAX-64) / 8); /* clear rest */ + if (! maskp->bits[0] && ! maskp->bits[1]) + return -EINVAL; + return 0; +} + +/** + * snd_pcm_hw_constraint_integer - apply an integer constraint to an interval + * @runtime: PCM runtime instance + * @var: hw_params variable to apply the integer constraint + * + * Apply the constraint of integer to an interval parameter. + */ +int snd_pcm_hw_constraint_integer(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var) +{ + struct snd_pcm_hw_constraints *constrs = &runtime->hw_constraints; + return snd_interval_setinteger(constrs_interval(constrs, var)); +} + +EXPORT_SYMBOL(snd_pcm_hw_constraint_integer); + +/** + * snd_pcm_hw_constraint_minmax - apply a min/max range constraint to an interval + * @runtime: PCM runtime instance + * @var: hw_params variable to apply the range + * @min: the minimal value + * @max: the maximal value + * + * Apply the min/max range constraint to an interval parameter. + */ +int snd_pcm_hw_constraint_minmax(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var, + unsigned int min, unsigned int max) +{ + struct snd_pcm_hw_constraints *constrs = &runtime->hw_constraints; + struct snd_interval t; + t.min = min; + t.max = max; + t.openmin = t.openmax = 0; + t.integer = 0; + return snd_interval_refine(constrs_interval(constrs, var), &t); +} + +EXPORT_SYMBOL(snd_pcm_hw_constraint_minmax); + +static int snd_pcm_hw_rule_list(struct snd_pcm_hw_params *params, + struct snd_pcm_hw_rule *rule) +{ + struct snd_pcm_hw_constraint_list *list = rule->private; + return snd_interval_list(hw_param_interval(params, rule->var), list->count, list->list, list->mask); +} + + +/** + * snd_pcm_hw_constraint_list - apply a list of constraints to a parameter + * @runtime: PCM runtime instance + * @cond: condition bits + * @var: hw_params variable to apply the list constraint + * @l: list + * + * Apply the list of constraints to an interval parameter. + */ +int snd_pcm_hw_constraint_list(struct snd_pcm_runtime *runtime, + unsigned int cond, + snd_pcm_hw_param_t var, + struct snd_pcm_hw_constraint_list *l) +{ + return snd_pcm_hw_rule_add(runtime, cond, var, + snd_pcm_hw_rule_list, l, + var, -1); +} + +EXPORT_SYMBOL(snd_pcm_hw_constraint_list); + +static int snd_pcm_hw_rule_ratnums(struct snd_pcm_hw_params *params, + struct snd_pcm_hw_rule *rule) +{ + struct snd_pcm_hw_constraint_ratnums *r = rule->private; + unsigned int num = 0, den = 0; + int err; + err = snd_interval_ratnum(hw_param_interval(params, rule->var), + r->nrats, r->rats, &num, &den); + if (err >= 0 && den && rule->var == SNDRV_PCM_HW_PARAM_RATE) { + params->rate_num = num; + params->rate_den = den; + } + return err; +} + +/** + * snd_pcm_hw_constraint_ratnums - apply ratnums constraint to a parameter + * @runtime: PCM runtime instance + * @cond: condition bits + * @var: hw_params variable to apply the ratnums constraint + * @r: struct snd_ratnums constriants + */ +int snd_pcm_hw_constraint_ratnums(struct snd_pcm_runtime *runtime, + unsigned int cond, + snd_pcm_hw_param_t var, + struct snd_pcm_hw_constraint_ratnums *r) +{ + return snd_pcm_hw_rule_add(runtime, cond, var, + snd_pcm_hw_rule_ratnums, r, + var, -1); +} + +EXPORT_SYMBOL(snd_pcm_hw_constraint_ratnums); + +static int snd_pcm_hw_rule_ratdens(struct snd_pcm_hw_params *params, + struct snd_pcm_hw_rule *rule) +{ + struct snd_pcm_hw_constraint_ratdens *r = rule->private; + unsigned int num = 0, den = 0; + int err = snd_interval_ratden(hw_param_interval(params, rule->var), + r->nrats, r->rats, &num, &den); + if (err >= 0 && den && rule->var == SNDRV_PCM_HW_PARAM_RATE) { + params->rate_num = num; + params->rate_den = den; + } + return err; +} + +/** + * snd_pcm_hw_constraint_ratdens - apply ratdens constraint to a parameter + * @runtime: PCM runtime instance + * @cond: condition bits + * @var: hw_params variable to apply the ratdens constraint + * @r: struct snd_ratdens constriants + */ +int snd_pcm_hw_constraint_ratdens(struct snd_pcm_runtime *runtime, + unsigned int cond, + snd_pcm_hw_param_t var, + struct snd_pcm_hw_constraint_ratdens *r) +{ + return snd_pcm_hw_rule_add(runtime, cond, var, + snd_pcm_hw_rule_ratdens, r, + var, -1); +} + +EXPORT_SYMBOL(snd_pcm_hw_constraint_ratdens); + +static int snd_pcm_hw_rule_msbits(struct snd_pcm_hw_params *params, + struct snd_pcm_hw_rule *rule) +{ + unsigned int l = (unsigned long) rule->private; + int width = l & 0xffff; + unsigned int msbits = l >> 16; + struct snd_interval *i = hw_param_interval(params, SNDRV_PCM_HW_PARAM_SAMPLE_BITS); + if (snd_interval_single(i) && snd_interval_value(i) == width) + params->msbits = msbits; + return 0; +} + +/** + * snd_pcm_hw_constraint_msbits - add a hw constraint msbits rule + * @runtime: PCM runtime instance + * @cond: condition bits + * @width: sample bits width + * @msbits: msbits width + */ +int snd_pcm_hw_constraint_msbits(struct snd_pcm_runtime *runtime, + unsigned int cond, + unsigned int width, + unsigned int msbits) +{ + unsigned long l = (msbits << 16) | width; + return snd_pcm_hw_rule_add(runtime, cond, -1, + snd_pcm_hw_rule_msbits, + (void*) l, + SNDRV_PCM_HW_PARAM_SAMPLE_BITS, -1); +} + +EXPORT_SYMBOL(snd_pcm_hw_constraint_msbits); + +static int snd_pcm_hw_rule_step(struct snd_pcm_hw_params *params, + struct snd_pcm_hw_rule *rule) +{ + unsigned long step = (unsigned long) rule->private; + return snd_interval_step(hw_param_interval(params, rule->var), 0, step); +} + +/** + * snd_pcm_hw_constraint_step - add a hw constraint step rule + * @runtime: PCM runtime instance + * @cond: condition bits + * @var: hw_params variable to apply the step constraint + * @step: step size + */ +int snd_pcm_hw_constraint_step(struct snd_pcm_runtime *runtime, + unsigned int cond, + snd_pcm_hw_param_t var, + unsigned long step) +{ + return snd_pcm_hw_rule_add(runtime, cond, var, + snd_pcm_hw_rule_step, (void *) step, + var, -1); +} + +EXPORT_SYMBOL(snd_pcm_hw_constraint_step); + +static int snd_pcm_hw_rule_pow2(struct snd_pcm_hw_params *params, struct snd_pcm_hw_rule *rule) +{ + static unsigned int pow2_sizes[] = { + 1<<0, 1<<1, 1<<2, 1<<3, 1<<4, 1<<5, 1<<6, 1<<7, + 1<<8, 1<<9, 1<<10, 1<<11, 1<<12, 1<<13, 1<<14, 1<<15, + 1<<16, 1<<17, 1<<18, 1<<19, 1<<20, 1<<21, 1<<22, 1<<23, + 1<<24, 1<<25, 1<<26, 1<<27, 1<<28, 1<<29, 1<<30 + }; + return snd_interval_list(hw_param_interval(params, rule->var), + ARRAY_SIZE(pow2_sizes), pow2_sizes, 0); +} + +/** + * snd_pcm_hw_constraint_pow2 - add a hw constraint power-of-2 rule + * @runtime: PCM runtime instance + * @cond: condition bits + * @var: hw_params variable to apply the power-of-2 constraint + */ +int snd_pcm_hw_constraint_pow2(struct snd_pcm_runtime *runtime, + unsigned int cond, + snd_pcm_hw_param_t var) +{ + return snd_pcm_hw_rule_add(runtime, cond, var, + snd_pcm_hw_rule_pow2, NULL, + var, -1); +} + +EXPORT_SYMBOL(snd_pcm_hw_constraint_pow2); + +static void _snd_pcm_hw_param_any(struct snd_pcm_hw_params *params, + snd_pcm_hw_param_t var) +{ + if (hw_is_mask(var)) { + snd_mask_any(hw_param_mask(params, var)); + params->cmask |= 1 << var; + params->rmask |= 1 << var; + return; + } + if (hw_is_interval(var)) { + snd_interval_any(hw_param_interval(params, var)); + params->cmask |= 1 << var; + params->rmask |= 1 << var; + return; + } + snd_BUG(); +} + +void _snd_pcm_hw_params_any(struct snd_pcm_hw_params *params) +{ + unsigned int k; + memset(params, 0, sizeof(*params)); + for (k = SNDRV_PCM_HW_PARAM_FIRST_MASK; k <= SNDRV_PCM_HW_PARAM_LAST_MASK; k++) + _snd_pcm_hw_param_any(params, k); + for (k = SNDRV_PCM_HW_PARAM_FIRST_INTERVAL; k <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL; k++) + _snd_pcm_hw_param_any(params, k); + params->info = ~0U; +} + +EXPORT_SYMBOL(_snd_pcm_hw_params_any); + +/** + * snd_pcm_hw_param_value - return @params field @var value + * @params: the hw_params instance + * @var: parameter to retrieve + * @dir: pointer to the direction (-1,0,1) or %NULL + * + * Return the value for field @var if it's fixed in configuration space + * defined by @params. Return -%EINVAL otherwise. + */ +int snd_pcm_hw_param_value(const struct snd_pcm_hw_params *params, + snd_pcm_hw_param_t var, int *dir) +{ + if (hw_is_mask(var)) { + const struct snd_mask *mask = hw_param_mask_c(params, var); + if (!snd_mask_single(mask)) + return -EINVAL; + if (dir) + *dir = 0; + return snd_mask_value(mask); + } + if (hw_is_interval(var)) { + const struct snd_interval *i = hw_param_interval_c(params, var); + if (!snd_interval_single(i)) + return -EINVAL; + if (dir) + *dir = i->openmin; + return snd_interval_value(i); + } + return -EINVAL; +} + +EXPORT_SYMBOL(snd_pcm_hw_param_value); + +void _snd_pcm_hw_param_setempty(struct snd_pcm_hw_params *params, + snd_pcm_hw_param_t var) +{ + if (hw_is_mask(var)) { + snd_mask_none(hw_param_mask(params, var)); + params->cmask |= 1 << var; + params->rmask |= 1 << var; + } else if (hw_is_interval(var)) { + snd_interval_none(hw_param_interval(params, var)); + params->cmask |= 1 << var; + params->rmask |= 1 << var; + } else { + snd_BUG(); + } +} + +EXPORT_SYMBOL(_snd_pcm_hw_param_setempty); + +static int _snd_pcm_hw_param_first(struct snd_pcm_hw_params *params, + snd_pcm_hw_param_t var) +{ + int changed; + if (hw_is_mask(var)) + changed = snd_mask_refine_first(hw_param_mask(params, var)); + else if (hw_is_interval(var)) + changed = snd_interval_refine_first(hw_param_interval(params, var)); + else + return -EINVAL; + if (changed) { + params->cmask |= 1 << var; + params->rmask |= 1 << var; + } + return changed; +} + + +/** + * snd_pcm_hw_param_first - refine config space and return minimum value + * @pcm: PCM instance + * @params: the hw_params instance + * @var: parameter to retrieve + * @dir: pointer to the direction (-1,0,1) or %NULL + * + * Inside configuration space defined by @params remove from @var all + * values > minimum. Reduce configuration space accordingly. + * Return the minimum. + */ +int snd_pcm_hw_param_first(struct snd_pcm_substream *pcm, + struct snd_pcm_hw_params *params, + snd_pcm_hw_param_t var, int *dir) +{ + int changed = _snd_pcm_hw_param_first(params, var); + if (changed < 0) + return changed; + if (params->rmask) { + int err = snd_pcm_hw_refine(pcm, params); + if (snd_BUG_ON(err < 0)) + return err; + } + return snd_pcm_hw_param_value(params, var, dir); +} + +EXPORT_SYMBOL(snd_pcm_hw_param_first); + +static int _snd_pcm_hw_param_last(struct snd_pcm_hw_params *params, + snd_pcm_hw_param_t var) +{ + int changed; + if (hw_is_mask(var)) + changed = snd_mask_refine_last(hw_param_mask(params, var)); + else if (hw_is_interval(var)) + changed = snd_interval_refine_last(hw_param_interval(params, var)); + else + return -EINVAL; + if (changed) { + params->cmask |= 1 << var; + params->rmask |= 1 << var; + } + return changed; +} + + +/** + * snd_pcm_hw_param_last - refine config space and return maximum value + * @pcm: PCM instance + * @params: the hw_params instance + * @var: parameter to retrieve + * @dir: pointer to the direction (-1,0,1) or %NULL + * + * Inside configuration space defined by @params remove from @var all + * values < maximum. Reduce configuration space accordingly. + * Return the maximum. + */ +int snd_pcm_hw_param_last(struct snd_pcm_substream *pcm, + struct snd_pcm_hw_params *params, + snd_pcm_hw_param_t var, int *dir) +{ + int changed = _snd_pcm_hw_param_last(params, var); + if (changed < 0) + return changed; + if (params->rmask) { + int err = snd_pcm_hw_refine(pcm, params); + if (snd_BUG_ON(err < 0)) + return err; + } + return snd_pcm_hw_param_value(params, var, dir); +} + +EXPORT_SYMBOL(snd_pcm_hw_param_last); + +/** + * snd_pcm_hw_param_choose - choose a configuration defined by @params + * @pcm: PCM instance + * @params: the hw_params instance + * + * Choose one configuration from configuration space defined by @params. + * The configuration chosen is that obtained fixing in this order: + * first access, first format, first subformat, min channels, + * min rate, min period time, max buffer size, min tick time + */ +int snd_pcm_hw_params_choose(struct snd_pcm_substream *pcm, + struct snd_pcm_hw_params *params) +{ + static int vars[] = { + SNDRV_PCM_HW_PARAM_ACCESS, + SNDRV_PCM_HW_PARAM_FORMAT, + SNDRV_PCM_HW_PARAM_SUBFORMAT, + SNDRV_PCM_HW_PARAM_CHANNELS, + SNDRV_PCM_HW_PARAM_RATE, + SNDRV_PCM_HW_PARAM_PERIOD_TIME, + SNDRV_PCM_HW_PARAM_BUFFER_SIZE, + SNDRV_PCM_HW_PARAM_TICK_TIME, + -1 + }; + int err, *v; + + for (v = vars; *v != -1; v++) { + if (*v != SNDRV_PCM_HW_PARAM_BUFFER_SIZE) + err = snd_pcm_hw_param_first(pcm, params, *v, NULL); + else + err = snd_pcm_hw_param_last(pcm, params, *v, NULL); + if (snd_BUG_ON(err < 0)) + return err; + } + return 0; +} + +static int snd_pcm_lib_ioctl_reset(struct snd_pcm_substream *substream, + void *arg) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + unsigned long flags; + snd_pcm_stream_lock_irqsave(substream, flags); + if (snd_pcm_running(substream) && + snd_pcm_update_hw_ptr(substream) >= 0) + runtime->status->hw_ptr %= runtime->buffer_size; + else + runtime->status->hw_ptr = 0; + snd_pcm_stream_unlock_irqrestore(substream, flags); + return 0; +} + +static int snd_pcm_lib_ioctl_channel_info(struct snd_pcm_substream *substream, + void *arg) +{ + struct snd_pcm_channel_info *info = arg; + struct snd_pcm_runtime *runtime = substream->runtime; + int width; + if (!(runtime->info & SNDRV_PCM_INFO_MMAP)) { + info->offset = -1; + return 0; + } + width = snd_pcm_format_physical_width(runtime->format); + if (width < 0) + return width; + info->offset = 0; + switch (runtime->access) { + case SNDRV_PCM_ACCESS_MMAP_INTERLEAVED: + case SNDRV_PCM_ACCESS_RW_INTERLEAVED: + info->first = info->channel * width; + info->step = runtime->channels * width; + break; + case SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED: + case SNDRV_PCM_ACCESS_RW_NONINTERLEAVED: + { + size_t size = runtime->dma_bytes / runtime->channels; + info->first = info->channel * size * 8; + info->step = width; + break; + } + default: + snd_BUG(); + break; + } + return 0; +} + +static int snd_pcm_lib_ioctl_fifo_size(struct snd_pcm_substream *substream, + void *arg) +{ + struct snd_pcm_hw_params *params = arg; + snd_pcm_format_t format; + int channels, width; + + params->fifo_size = substream->runtime->hw.fifo_size; + if (!(substream->runtime->hw.info & SNDRV_PCM_INFO_FIFO_IN_FRAMES)) { + format = params_format(params); + channels = params_channels(params); + width = snd_pcm_format_physical_width(format); + params->fifo_size /= width * channels; + } + return 0; +} + +/** + * snd_pcm_lib_ioctl - a generic PCM ioctl callback + * @substream: the pcm substream instance + * @cmd: ioctl command + * @arg: ioctl argument + * + * Processes the generic ioctl commands for PCM. + * Can be passed as the ioctl callback for PCM ops. + * + * Returns zero if successful, or a negative error code on failure. + */ +int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream, + unsigned int cmd, void *arg) +{ + switch (cmd) { + case SNDRV_PCM_IOCTL1_INFO: + return 0; + case SNDRV_PCM_IOCTL1_RESET: + return snd_pcm_lib_ioctl_reset(substream, arg); + case SNDRV_PCM_IOCTL1_CHANNEL_INFO: + return snd_pcm_lib_ioctl_channel_info(substream, arg); + case SNDRV_PCM_IOCTL1_FIFO_SIZE: + return snd_pcm_lib_ioctl_fifo_size(substream, arg); + } + return -ENXIO; +} + +EXPORT_SYMBOL(snd_pcm_lib_ioctl); + +/** + * snd_pcm_period_elapsed - update the pcm status for the next period + * @substream: the pcm substream instance + * + * This function is called from the interrupt handler when the + * PCM has processed the period size. It will update the current + * pointer, wake up sleepers, etc. + * + * Even if more than one periods have elapsed since the last call, you + * have to call this only once. + */ +void snd_pcm_period_elapsed(struct snd_pcm_substream *substream) +{ + struct snd_pcm_runtime *runtime; + unsigned long flags; + + if (PCM_RUNTIME_CHECK(substream)) + return; + runtime = substream->runtime; + + if (runtime->transfer_ack_begin) + runtime->transfer_ack_begin(substream); + + //giovanni snd_pcm_stream_lock_irqsave(substream, flags); //giovanni + if (!snd_pcm_running(substream) || + snd_pcm_update_hw_ptr0(substream, 1) < 0) + goto _end; + + if (substream->timer_running) + snd_timer_interrupt(substream->timer, 1); + _end: + //giovanni snd_pcm_stream_unlock_irqrestore(substream, flags); //giovanni + if (runtime->transfer_ack_end) + runtime->transfer_ack_end(substream); + kill_fasync(&runtime->fasync, SIGIO, POLL_IN); +} + +EXPORT_SYMBOL(snd_pcm_period_elapsed); + +/* + * Wait until avail_min data becomes available + * Returns a negative error code if any error occurs during operation. + * The available space is stored on availp. When err = 0 and avail = 0 + * on the capture stream, it indicates the stream is in DRAINING state. + */ +static int wait_for_avail_min(struct snd_pcm_substream *substream, + snd_pcm_uframes_t *availp) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + int is_playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; + wait_queue_t wait; + int err = 0; + snd_pcm_uframes_t avail = 0; + long tout; + + init_waitqueue_entry(&wait, current); + add_wait_queue(&runtime->tsleep, &wait); + for (;;) { + if (signal_pending(current)) { + err = -ERESTARTSYS; + break; + } + set_current_state(TASK_INTERRUPTIBLE); + //giovanni snd_pcm_stream_unlock_irq(substream); + tout = schedule_timeout(msecs_to_jiffies(10000)); + //giovanni snd_pcm_stream_lock_irq(substream); + switch (runtime->status->state) { + case SNDRV_PCM_STATE_SUSPENDED: + err = -ESTRPIPE; + goto _endloop; + case SNDRV_PCM_STATE_XRUN: + err = -EPIPE; + goto _endloop; + case SNDRV_PCM_STATE_DRAINING: + if (is_playback) + err = -EPIPE; + else + avail = 0; /* indicate draining */ + goto _endloop; + case SNDRV_PCM_STATE_OPEN: + case SNDRV_PCM_STATE_SETUP: + case SNDRV_PCM_STATE_DISCONNECTED: + err = -EBADFD; + goto _endloop; + } + if (!tout) { + snd_printd("%s write error (DMA or IRQ trouble?)\n", + is_playback ? "playback" : "capture"); + err = -EIO; + break; + } + if (is_playback) + avail = snd_pcm_playback_avail(runtime); + else + avail = snd_pcm_capture_avail(runtime); + if (avail >= runtime->control->avail_min) + break; + } + _endloop: + remove_wait_queue(&runtime->tsleep, &wait); + *availp = avail; + return err; +} + +static int snd_pcm_lib_write_transfer(struct snd_pcm_substream *substream, + unsigned int hwoff, + unsigned long data, unsigned int off, + snd_pcm_uframes_t frames) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + int err; + char __user *buf = (char __user *) data + frames_to_bytes(runtime, off); + if (substream->ops->copy) { + if ((err = substream->ops->copy(substream, -1, hwoff, buf, frames)) < 0) + return err; + } else { + char *hwbuf = runtime->dma_area + frames_to_bytes(runtime, hwoff); + if (copy_from_user(hwbuf, buf, frames_to_bytes(runtime, frames))) + return -EFAULT; + } + return 0; +} + +typedef int (*transfer_f)(struct snd_pcm_substream *substream, unsigned int hwoff, + unsigned long data, unsigned int off, + snd_pcm_uframes_t size); + +static snd_pcm_sframes_t snd_pcm_lib_write1(struct snd_pcm_substream *substream, + unsigned long data, + snd_pcm_uframes_t size, + int nonblock, + transfer_f transfer) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + snd_pcm_uframes_t xfer = 0; + snd_pcm_uframes_t offset = 0; + int err = 0; + + if (size == 0) + return 0; + + //giovanni snd_pcm_stream_lock_irq(substream); + switch (runtime->status->state) { + case SNDRV_PCM_STATE_PREPARED: + case SNDRV_PCM_STATE_RUNNING: + case SNDRV_PCM_STATE_PAUSED: + break; + case SNDRV_PCM_STATE_XRUN: + err = -EPIPE; + goto _end_unlock; + case SNDRV_PCM_STATE_SUSPENDED: + err = -ESTRPIPE; + goto _end_unlock; + default: + err = -EBADFD; + goto _end_unlock; + } + + runtime->twake = 1; + while (size > 0) { + snd_pcm_uframes_t frames, appl_ptr, appl_ofs; + snd_pcm_uframes_t avail; + snd_pcm_uframes_t cont; + if (runtime->status->state == SNDRV_PCM_STATE_RUNNING) + snd_pcm_update_hw_ptr(substream); + avail = snd_pcm_playback_avail(runtime); + if (!avail) { + if (nonblock) { + err = -EAGAIN; + goto _end_unlock; + } + err = wait_for_avail_min(substream, &avail); + if (err < 0) + goto _end_unlock; + } + frames = size > avail ? avail : size; + cont = runtime->buffer_size - runtime->control->appl_ptr % runtime->buffer_size; + if (frames > cont) + frames = cont; + if (snd_BUG_ON(!frames)) { + runtime->twake = 0; + //giovanni snd_pcm_stream_unlock_irq(substream); + return -EINVAL; + } + appl_ptr = runtime->control->appl_ptr; + appl_ofs = appl_ptr % runtime->buffer_size; + //giovanni snd_pcm_stream_unlock_irq(substream); + err = transfer(substream, appl_ofs, data, offset, frames); + //giovanni snd_pcm_stream_lock_irq(substream); + if (err < 0) + goto _end_unlock; + switch (runtime->status->state) { + case SNDRV_PCM_STATE_XRUN: + err = -EPIPE; + goto _end_unlock; + case SNDRV_PCM_STATE_SUSPENDED: + err = -ESTRPIPE; + goto _end_unlock; + default: + break; + } + appl_ptr += frames; + if (appl_ptr >= runtime->boundary) + appl_ptr -= runtime->boundary; + runtime->control->appl_ptr = appl_ptr; + if (substream->ops->ack) + substream->ops->ack(substream); + + offset += frames; + size -= frames; + xfer += frames; + if (runtime->status->state == SNDRV_PCM_STATE_PREPARED && + snd_pcm_playback_hw_avail(runtime) >= (snd_pcm_sframes_t)runtime->start_threshold) { + err = snd_pcm_start(substream); + if (err < 0) + goto _end_unlock; + } + } + _end_unlock: + runtime->twake = 0; + if (xfer > 0 && err >= 0) + snd_pcm_update_state(substream, runtime); + //giovanni snd_pcm_stream_unlock_irq(substream); + return xfer > 0 ? (snd_pcm_sframes_t)xfer : err; +} + +/* sanity-check for read/write methods */ +static int pcm_sanity_check(struct snd_pcm_substream *substream) +{ + struct snd_pcm_runtime *runtime; + if (PCM_RUNTIME_CHECK(substream)) + return -ENXIO; + runtime = substream->runtime; + if (snd_BUG_ON(!substream->ops->copy && !runtime->dma_area)) + return -EINVAL; + if (runtime->status->state == SNDRV_PCM_STATE_OPEN) + return -EBADFD; + return 0; +} + +snd_pcm_sframes_t snd_pcm_lib_write(struct snd_pcm_substream *substream, const void __user *buf, snd_pcm_uframes_t size) +{ + struct snd_pcm_runtime *runtime; + int nonblock; + int err; + + err = pcm_sanity_check(substream); + if (err < 0) + return err; + runtime = substream->runtime; + nonblock = !!(substream->f_flags & O_NONBLOCK); + + if (runtime->access != SNDRV_PCM_ACCESS_RW_INTERLEAVED && + runtime->channels > 1) + return -EINVAL; + return snd_pcm_lib_write1(substream, (unsigned long)buf, size, nonblock, + snd_pcm_lib_write_transfer); +} + +EXPORT_SYMBOL(snd_pcm_lib_write); + +static int snd_pcm_lib_writev_transfer(struct snd_pcm_substream *substream, + unsigned int hwoff, + unsigned long data, unsigned int off, + snd_pcm_uframes_t frames) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + int err; + void __user **bufs = (void __user **)data; + int channels = runtime->channels; + int c; + if (substream->ops->copy) { + if (snd_BUG_ON(!substream->ops->silence)) + return -EINVAL; + for (c = 0; c < channels; ++c, ++bufs) { + if (*bufs == NULL) { + if ((err = substream->ops->silence(substream, c, hwoff, frames)) < 0) + return err; + } else { + char __user *buf = *bufs + samples_to_bytes(runtime, off); + if ((err = substream->ops->copy(substream, c, hwoff, buf, frames)) < 0) + return err; + } + } + } else { + /* default transfer behaviour */ + size_t dma_csize = runtime->dma_bytes / channels; + for (c = 0; c < channels; ++c, ++bufs) { + char *hwbuf = runtime->dma_area + (c * dma_csize) + samples_to_bytes(runtime, hwoff); + if (*bufs == NULL) { + snd_pcm_format_set_silence(runtime->format, hwbuf, frames); + } else { + char __user *buf = *bufs + samples_to_bytes(runtime, off); + if (copy_from_user(hwbuf, buf, samples_to_bytes(runtime, frames))) + return -EFAULT; + } + } + } + return 0; +} + +snd_pcm_sframes_t snd_pcm_lib_writev(struct snd_pcm_substream *substream, + void __user **bufs, + snd_pcm_uframes_t frames) +{ + struct snd_pcm_runtime *runtime; + int nonblock; + int err; + + err = pcm_sanity_check(substream); + if (err < 0) + return err; + runtime = substream->runtime; + nonblock = !!(substream->f_flags & O_NONBLOCK); + + if (runtime->access != SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) + return -EINVAL; + return snd_pcm_lib_write1(substream, (unsigned long)bufs, frames, + nonblock, snd_pcm_lib_writev_transfer); +} + +EXPORT_SYMBOL(snd_pcm_lib_writev); + +static int snd_pcm_lib_read_transfer(struct snd_pcm_substream *substream, + unsigned int hwoff, + unsigned long data, unsigned int off, + snd_pcm_uframes_t frames) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + int err; + char __user *buf = (char __user *) data + frames_to_bytes(runtime, off); + if (substream->ops->copy) { + if ((err = substream->ops->copy(substream, -1, hwoff, buf, frames)) < 0) + return err; + } else { + char *hwbuf = runtime->dma_area + frames_to_bytes(runtime, hwoff); + if (copy_to_user(buf, hwbuf, frames_to_bytes(runtime, frames))) + return -EFAULT; + } + return 0; +} + +static snd_pcm_sframes_t snd_pcm_lib_read1(struct snd_pcm_substream *substream, + unsigned long data, + snd_pcm_uframes_t size, + int nonblock, + transfer_f transfer) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + snd_pcm_uframes_t xfer = 0; + snd_pcm_uframes_t offset = 0; + int err = 0; + + if (size == 0) + return 0; + + //giovanni snd_pcm_stream_lock_irq(substream); + switch (runtime->status->state) { + case SNDRV_PCM_STATE_PREPARED: + if (size >= runtime->start_threshold) { + err = snd_pcm_start(substream); + if (err < 0) + goto _end_unlock; + } + break; + case SNDRV_PCM_STATE_DRAINING: + case SNDRV_PCM_STATE_RUNNING: + case SNDRV_PCM_STATE_PAUSED: + break; + case SNDRV_PCM_STATE_XRUN: + err = -EPIPE; + goto _end_unlock; + case SNDRV_PCM_STATE_SUSPENDED: + err = -ESTRPIPE; + goto _end_unlock; + default: + err = -EBADFD; + goto _end_unlock; + } + + runtime->twake = 1; + while (size > 0) { + snd_pcm_uframes_t frames, appl_ptr, appl_ofs; + snd_pcm_uframes_t avail; + snd_pcm_uframes_t cont; + if (runtime->status->state == SNDRV_PCM_STATE_RUNNING) + snd_pcm_update_hw_ptr(substream); + avail = snd_pcm_capture_avail(runtime); + if (!avail) { + if (runtime->status->state == + SNDRV_PCM_STATE_DRAINING) { + snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP); + goto _end_unlock; + } + if (nonblock) { + err = -EAGAIN; + goto _end_unlock; + } + err = wait_for_avail_min(substream, &avail); + if (err < 0) + goto _end_unlock; + if (!avail) + continue; /* draining */ + } + frames = size > avail ? avail : size; + cont = runtime->buffer_size - runtime->control->appl_ptr % runtime->buffer_size; + if (frames > cont) + frames = cont; + if (snd_BUG_ON(!frames)) { + runtime->twake = 0; + //giovanni snd_pcm_stream_unlock_irq(substream); + return -EINVAL; + } + appl_ptr = runtime->control->appl_ptr; + appl_ofs = appl_ptr % runtime->buffer_size; + //giovanni snd_pcm_stream_unlock_irq(substream); + err = transfer(substream, appl_ofs, data, offset, frames); + //giovanni snd_pcm_stream_lock_irq(substream); + if (err < 0) + goto _end_unlock; + switch (runtime->status->state) { + case SNDRV_PCM_STATE_XRUN: + err = -EPIPE; + goto _end_unlock; + case SNDRV_PCM_STATE_SUSPENDED: + err = -ESTRPIPE; + goto _end_unlock; + default: + break; + } + appl_ptr += frames; + if (appl_ptr >= runtime->boundary) + appl_ptr -= runtime->boundary; + runtime->control->appl_ptr = appl_ptr; + if (substream->ops->ack) + substream->ops->ack(substream); + + offset += frames; + size -= frames; + xfer += frames; + } + _end_unlock: + runtime->twake = 0; + if (xfer > 0 && err >= 0) + snd_pcm_update_state(substream, runtime); + //giovanni snd_pcm_stream_unlock_irq(substream); + return xfer > 0 ? (snd_pcm_sframes_t)xfer : err; +} + +snd_pcm_sframes_t snd_pcm_lib_read(struct snd_pcm_substream *substream, void __user *buf, snd_pcm_uframes_t size) +{ + struct snd_pcm_runtime *runtime; + int nonblock; + int err; + + err = pcm_sanity_check(substream); + if (err < 0) + return err; + runtime = substream->runtime; + nonblock = !!(substream->f_flags & O_NONBLOCK); + if (runtime->access != SNDRV_PCM_ACCESS_RW_INTERLEAVED) + return -EINVAL; + return snd_pcm_lib_read1(substream, (unsigned long)buf, size, nonblock, snd_pcm_lib_read_transfer); +} + +EXPORT_SYMBOL(snd_pcm_lib_read); + +static int snd_pcm_lib_readv_transfer(struct snd_pcm_substream *substream, + unsigned int hwoff, + unsigned long data, unsigned int off, + snd_pcm_uframes_t frames) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + int err; + void __user **bufs = (void __user **)data; + int channels = runtime->channels; + int c; + if (substream->ops->copy) { + for (c = 0; c < channels; ++c, ++bufs) { + char __user *buf; + if (*bufs == NULL) + continue; + buf = *bufs + samples_to_bytes(runtime, off); + if ((err = substream->ops->copy(substream, c, hwoff, buf, frames)) < 0) + return err; + } + } else { + snd_pcm_uframes_t dma_csize = runtime->dma_bytes / channels; + for (c = 0; c < channels; ++c, ++bufs) { + char *hwbuf; + char __user *buf; + if (*bufs == NULL) + continue; + + hwbuf = runtime->dma_area + (c * dma_csize) + samples_to_bytes(runtime, hwoff); + buf = *bufs + samples_to_bytes(runtime, off); + if (copy_to_user(buf, hwbuf, samples_to_bytes(runtime, frames))) + return -EFAULT; + } + } + return 0; +} + +snd_pcm_sframes_t snd_pcm_lib_readv(struct snd_pcm_substream *substream, + void __user **bufs, + snd_pcm_uframes_t frames) +{ + struct snd_pcm_runtime *runtime; + int nonblock; + int err; + + err = pcm_sanity_check(substream); + if (err < 0) + return err; + runtime = substream->runtime; + if (runtime->status->state == SNDRV_PCM_STATE_OPEN) + return -EBADFD; + + nonblock = !!(substream->f_flags & O_NONBLOCK); + if (runtime->access != SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) + return -EINVAL; + return snd_pcm_lib_read1(substream, (unsigned long)bufs, frames, nonblock, snd_pcm_lib_readv_transfer); +} + +EXPORT_SYMBOL(snd_pcm_lib_readv); diff --git a/src/mod/endpoints/mod_skypopen/alsa/pcm_native.c b/src/mod/endpoints/mod_skypopen/alsa/pcm_native.c new file mode 100644 index 0000000..fe9d42e --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/alsa/pcm_native.c @@ -0,0 +1,3493 @@ +/* + * Digital Audio (PCM) abstract layer + * Copyright (c) by Jaroslav Kysela <perex@perex.cz> + * + * + * 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 <linux/mm.h> +#include <linux/file.h> +#include <linux/slab.h> +#include <linux/smp_lock.h> +#include <linux/time.h> +#include <linux/pm_qos_params.h> +#include <linux/uio.h> +#include <linux/dma-mapping.h> +#include <linux/math64.h> +#include <sound/core.h> +#include <sound/control.h> +#include <sound/info.h> +#include <sound/pcm.h> +#include <sound/pcm_params.h> +#include <sound/timer.h> +#include <sound/minors.h> +#include <asm/io.h> + +/* + * Compatibility + */ + +struct snd_pcm_hw_params_old { + unsigned int flags; + unsigned int masks[SNDRV_PCM_HW_PARAM_SUBFORMAT - + SNDRV_PCM_HW_PARAM_ACCESS + 1]; + struct snd_interval intervals[SNDRV_PCM_HW_PARAM_TICK_TIME - + SNDRV_PCM_HW_PARAM_SAMPLE_BITS + 1]; + unsigned int rmask; + unsigned int cmask; + unsigned int info; + unsigned int msbits; + unsigned int rate_num; + unsigned int rate_den; + snd_pcm_uframes_t fifo_size; + unsigned char reserved[64]; +}; + +#ifdef CONFIG_SND_SUPPORT_OLD_API +#define SNDRV_PCM_IOCTL_HW_REFINE_OLD _IOWR('A', 0x10, struct snd_pcm_hw_params_old) +#define SNDRV_PCM_IOCTL_HW_PARAMS_OLD _IOWR('A', 0x11, struct snd_pcm_hw_params_old) + +static int snd_pcm_hw_refine_old_user(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params_old __user * _oparams); +static int snd_pcm_hw_params_old_user(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params_old __user * _oparams); +#endif +static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream); + +/* + * + */ + +DEFINE_RWLOCK(snd_pcm_link_rwlock); +EXPORT_SYMBOL(snd_pcm_link_rwlock); + +static DECLARE_RWSEM(snd_pcm_link_rwsem); + +static inline mm_segment_t snd_enter_user(void) +{ + mm_segment_t fs = get_fs(); + set_fs(get_ds()); + return fs; +} + +static inline void snd_leave_user(mm_segment_t fs) +{ + set_fs(fs); +} + + + +int snd_pcm_info(struct snd_pcm_substream *substream, struct snd_pcm_info *info) +{ + struct snd_pcm_runtime *runtime; + struct snd_pcm *pcm = substream->pcm; + struct snd_pcm_str *pstr = substream->pstr; + + memset(info, 0, sizeof(*info)); + info->card = pcm->card->number; + info->device = pcm->device; + info->stream = substream->stream; + info->subdevice = substream->number; + strlcpy(info->id, pcm->id, sizeof(info->id)); + strlcpy(info->name, pcm->name, sizeof(info->name)); + info->dev_class = pcm->dev_class; + info->dev_subclass = pcm->dev_subclass; + info->subdevices_count = pstr->substream_count; + info->subdevices_avail = pstr->substream_count - pstr->substream_opened; + strlcpy(info->subname, substream->name, sizeof(info->subname)); + runtime = substream->runtime; + /* AB: FIXME!!! This is definitely nonsense */ + if (runtime) { + info->sync = runtime->sync; + substream->ops->ioctl(substream, SNDRV_PCM_IOCTL1_INFO, info); + } + return 0; +} + +int snd_pcm_info_user(struct snd_pcm_substream *substream, + struct snd_pcm_info __user * _info) +{ + struct snd_pcm_info *info; + int err; + + info = kmalloc(sizeof(*info), GFP_KERNEL); + if (! info) + return -ENOMEM; + err = snd_pcm_info(substream, info); + if (err >= 0) { + if (copy_to_user(_info, info, sizeof(*info))) + err = -EFAULT; + } + kfree(info); + return err; +} + +#undef RULES_DEBUG + +#ifdef RULES_DEBUG +#define HW_PARAM(v) [SNDRV_PCM_HW_PARAM_##v] = #v +char *snd_pcm_hw_param_names[] = { + HW_PARAM(ACCESS), + HW_PARAM(FORMAT), + HW_PARAM(SUBFORMAT), + HW_PARAM(SAMPLE_BITS), + HW_PARAM(FRAME_BITS), + HW_PARAM(CHANNELS), + HW_PARAM(RATE), + HW_PARAM(PERIOD_TIME), + HW_PARAM(PERIOD_SIZE), + HW_PARAM(PERIOD_BYTES), + HW_PARAM(PERIODS), + HW_PARAM(BUFFER_TIME), + HW_PARAM(BUFFER_SIZE), + HW_PARAM(BUFFER_BYTES), + HW_PARAM(TICK_TIME), +}; +#endif + +int snd_pcm_hw_refine(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + unsigned int k; + struct snd_pcm_hardware *hw; + struct snd_interval *i = NULL; + struct snd_mask *m = NULL; + struct snd_pcm_hw_constraints *constrs = &substream->runtime->hw_constraints; + unsigned int rstamps[constrs->rules_num]; + unsigned int vstamps[SNDRV_PCM_HW_PARAM_LAST_INTERVAL + 1]; + unsigned int stamp = 2; + int changed, again; + + params->info = 0; + params->fifo_size = 0; + if (params->rmask & (1 << SNDRV_PCM_HW_PARAM_SAMPLE_BITS)) + params->msbits = 0; + if (params->rmask & (1 << SNDRV_PCM_HW_PARAM_RATE)) { + params->rate_num = 0; + params->rate_den = 0; + } + + for (k = SNDRV_PCM_HW_PARAM_FIRST_MASK; k <= SNDRV_PCM_HW_PARAM_LAST_MASK; k++) { + m = hw_param_mask(params, k); + if (snd_mask_empty(m)) + return -EINVAL; + if (!(params->rmask & (1 << k))) + continue; +#ifdef RULES_DEBUG + printk(KERN_DEBUG "%s = ", snd_pcm_hw_param_names[k]); + printk("%04x%04x%04x%04x -> ", m->bits[3], m->bits[2], m->bits[1], m->bits[0]); +#endif + changed = snd_mask_refine(m, constrs_mask(constrs, k)); +#ifdef RULES_DEBUG + printk("%04x%04x%04x%04x\n", m->bits[3], m->bits[2], m->bits[1], m->bits[0]); +#endif + if (changed) + params->cmask |= 1 << k; + if (changed < 0) + return changed; + } + + for (k = SNDRV_PCM_HW_PARAM_FIRST_INTERVAL; k <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL; k++) { + i = hw_param_interval(params, k); + if (snd_interval_empty(i)) + return -EINVAL; + if (!(params->rmask & (1 << k))) + continue; +#ifdef RULES_DEBUG + printk(KERN_DEBUG "%s = ", snd_pcm_hw_param_names[k]); + if (i->empty) + printk("empty"); + else + printk("%c%u %u%c", + i->openmin ? '(' : '[', i->min, + i->max, i->openmax ? ')' : ']'); + printk(" -> "); +#endif + changed = snd_interval_refine(i, constrs_interval(constrs, k)); +#ifdef RULES_DEBUG + if (i->empty) + printk("empty\n"); + else + printk("%c%u %u%c\n", + i->openmin ? '(' : '[', i->min, + i->max, i->openmax ? ')' : ']'); +#endif + if (changed) + params->cmask |= 1 << k; + if (changed < 0) + return changed; + } + + for (k = 0; k < constrs->rules_num; k++) + rstamps[k] = 0; + for (k = 0; k <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL; k++) + vstamps[k] = (params->rmask & (1 << k)) ? 1 : 0; + do { + again = 0; + for (k = 0; k < constrs->rules_num; k++) { + struct snd_pcm_hw_rule *r = &constrs->rules[k]; + unsigned int d; + int doit = 0; + if (r->cond && !(r->cond & params->flags)) + continue; + for (d = 0; r->deps[d] >= 0; d++) { + if (vstamps[r->deps[d]] > rstamps[k]) { + doit = 1; + break; + } + } + if (!doit) + continue; +#ifdef RULES_DEBUG + printk(KERN_DEBUG "Rule %d [%p]: ", k, r->func); + if (r->var >= 0) { + printk("%s = ", snd_pcm_hw_param_names[r->var]); + if (hw_is_mask(r->var)) { + m = hw_param_mask(params, r->var); + printk("%x", *m->bits); + } else { + i = hw_param_interval(params, r->var); + if (i->empty) + printk("empty"); + else + printk("%c%u %u%c", + i->openmin ? '(' : '[', i->min, + i->max, i->openmax ? ')' : ']'); + } + } +#endif + changed = r->func(params, r); +#ifdef RULES_DEBUG + if (r->var >= 0) { + printk(" -> "); + if (hw_is_mask(r->var)) + printk("%x", *m->bits); + else { + if (i->empty) + printk("empty"); + else + printk("%c%u %u%c", + i->openmin ? '(' : '[', i->min, + i->max, i->openmax ? ')' : ']'); + } + } + printk("\n"); +#endif + rstamps[k] = stamp; + if (changed && r->var >= 0) { + params->cmask |= (1 << r->var); + vstamps[r->var] = stamp; + again = 1; + } + if (changed < 0) + return changed; + stamp++; + } + } while (again); + if (!params->msbits) { + i = hw_param_interval(params, SNDRV_PCM_HW_PARAM_SAMPLE_BITS); + if (snd_interval_single(i)) + params->msbits = snd_interval_value(i); + } + + if (!params->rate_den) { + i = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); + if (snd_interval_single(i)) { + params->rate_num = snd_interval_value(i); + params->rate_den = 1; + } + } + + hw = &substream->runtime->hw; + if (!params->info) + params->info = hw->info & ~SNDRV_PCM_INFO_FIFO_IN_FRAMES; + if (!params->fifo_size) { + m = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); + i = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); + if (snd_mask_min(m) == snd_mask_max(m) && + snd_interval_min(i) == snd_interval_max(i)) { + changed = substream->ops->ioctl(substream, + SNDRV_PCM_IOCTL1_FIFO_SIZE, params); + if (changed < 0) + return changed; + } + } + params->rmask = 0; + return 0; +} + +EXPORT_SYMBOL(snd_pcm_hw_refine); + +static int snd_pcm_hw_refine_user(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params __user * _params) +{ + struct snd_pcm_hw_params *params; + int err; + + params = memdup_user(_params, sizeof(*params)); + if (IS_ERR(params)) + return PTR_ERR(params); + + err = snd_pcm_hw_refine(substream, params); + if (copy_to_user(_params, params, sizeof(*params))) { + if (!err) + err = -EFAULT; + } + + kfree(params); + return err; +} + +static int period_to_usecs(struct snd_pcm_runtime *runtime) +{ + int usecs; + + if (! runtime->rate) + return -1; /* invalid */ + + /* take 75% of period time as the deadline */ + usecs = (750000 / runtime->rate) * runtime->period_size; + usecs += ((750000 % runtime->rate) * runtime->period_size) / + runtime->rate; + + return usecs; +} + +static int calc_boundary(struct snd_pcm_runtime *runtime) +{ + u_int64_t boundary; + + boundary = (u_int64_t)runtime->buffer_size * + (u_int64_t)runtime->period_size; +#if BITS_PER_LONG < 64 + /* try to find lowest common multiple for buffer and period */ + if (boundary > LONG_MAX - runtime->buffer_size) { + u_int32_t remainder = -1; + u_int32_t divident = runtime->buffer_size; + u_int32_t divisor = runtime->period_size; + while (remainder) { + remainder = divident % divisor; + if (remainder) { + divident = divisor; + divisor = remainder; + } + } + boundary = div_u64(boundary, divisor); + if (boundary > LONG_MAX - runtime->buffer_size) + return -ERANGE; + } +#endif + if (boundary == 0) + return -ERANGE; + runtime->boundary = boundary; + while (runtime->boundary * 2 <= LONG_MAX - runtime->buffer_size) + runtime->boundary *= 2; + return 0; +} + +static int snd_pcm_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + struct snd_pcm_runtime *runtime; + int err, usecs; + unsigned int bits; + snd_pcm_uframes_t frames; + + if (PCM_RUNTIME_CHECK(substream)) + return -ENXIO; + runtime = substream->runtime; + snd_pcm_stream_lock_irq(substream); + switch (runtime->status->state) { + case SNDRV_PCM_STATE_OPEN: + case SNDRV_PCM_STATE_SETUP: + case SNDRV_PCM_STATE_PREPARED: + break; + default: + snd_pcm_stream_unlock_irq(substream); + return -EBADFD; + } + snd_pcm_stream_unlock_irq(substream); +#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) + if (!substream->oss.oss) +#endif + if (atomic_read(&substream->mmap_count)) + return -EBADFD; + + params->rmask = ~0U; + err = snd_pcm_hw_refine(substream, params); + if (err < 0) + goto _error; + + err = snd_pcm_hw_params_choose(substream, params); + if (err < 0) + goto _error; + + if (substream->ops->hw_params != NULL) { + err = substream->ops->hw_params(substream, params); + if (err < 0) + goto _error; + } + + runtime->access = params_access(params); + runtime->format = params_format(params); + runtime->subformat = params_subformat(params); + runtime->channels = params_channels(params); + runtime->rate = params_rate(params); + runtime->period_size = params_period_size(params); + runtime->periods = params_periods(params); + runtime->buffer_size = params_buffer_size(params); + runtime->info = params->info; + runtime->rate_num = params->rate_num; + runtime->rate_den = params->rate_den; + + bits = snd_pcm_format_physical_width(runtime->format); + runtime->sample_bits = bits; + bits *= runtime->channels; + runtime->frame_bits = bits; + frames = 1; + while (bits % 8 != 0) { + bits *= 2; + frames *= 2; + } + runtime->byte_align = bits / 8; + runtime->min_align = frames; + + /* Default sw params */ + runtime->tstamp_mode = SNDRV_PCM_TSTAMP_NONE; + runtime->period_step = 1; + runtime->control->avail_min = runtime->period_size; + runtime->start_threshold = 1; + runtime->stop_threshold = runtime->buffer_size; + runtime->silence_threshold = 0; + runtime->silence_size = 0; + err = calc_boundary(runtime); + if (err < 0) + goto _error; + + snd_pcm_timer_resolution_change(substream); + runtime->status->state = SNDRV_PCM_STATE_SETUP; + + pm_qos_remove_requirement(PM_QOS_CPU_DMA_LATENCY, + substream->latency_id); + if ((usecs = period_to_usecs(runtime)) >= 0) + pm_qos_add_requirement(PM_QOS_CPU_DMA_LATENCY, + substream->latency_id, usecs); + return 0; + _error: + /* hardware might be unuseable from this time, + so we force application to retry to set + the correct hardware parameter settings */ + runtime->status->state = SNDRV_PCM_STATE_OPEN; + if (substream->ops->hw_free != NULL) + substream->ops->hw_free(substream); + return err; +} + +static int snd_pcm_hw_params_user(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params __user * _params) +{ + struct snd_pcm_hw_params *params; + int err; + + params = memdup_user(_params, sizeof(*params)); + if (IS_ERR(params)) + return PTR_ERR(params); + + err = snd_pcm_hw_params(substream, params); + if (copy_to_user(_params, params, sizeof(*params))) { + if (!err) + err = -EFAULT; + } + + kfree(params); + return err; +} + +static int snd_pcm_hw_free(struct snd_pcm_substream *substream) +{ + struct snd_pcm_runtime *runtime; + int result = 0; + + if (PCM_RUNTIME_CHECK(substream)) + return -ENXIO; + runtime = substream->runtime; + snd_pcm_stream_lock_irq(substream); + switch (runtime->status->state) { + case SNDRV_PCM_STATE_SETUP: + case SNDRV_PCM_STATE_PREPARED: + break; + default: + snd_pcm_stream_unlock_irq(substream); + return -EBADFD; + } + snd_pcm_stream_unlock_irq(substream); + if (atomic_read(&substream->mmap_count)) + return -EBADFD; + if (substream->ops->hw_free) + result = substream->ops->hw_free(substream); + runtime->status->state = SNDRV_PCM_STATE_OPEN; + pm_qos_remove_requirement(PM_QOS_CPU_DMA_LATENCY, + substream->latency_id); + return result; +} + +static int snd_pcm_sw_params(struct snd_pcm_substream *substream, + struct snd_pcm_sw_params *params) +{ + struct snd_pcm_runtime *runtime; + int err; + + if (PCM_RUNTIME_CHECK(substream)) + return -ENXIO; + runtime = substream->runtime; + snd_pcm_stream_lock_irq(substream); + if (runtime->status->state == SNDRV_PCM_STATE_OPEN) { + snd_pcm_stream_unlock_irq(substream); + return -EBADFD; + } + snd_pcm_stream_unlock_irq(substream); + + if (params->tstamp_mode > SNDRV_PCM_TSTAMP_LAST) + return -EINVAL; + if (params->avail_min == 0) + return -EINVAL; + if (params->silence_size >= runtime->boundary) { + if (params->silence_threshold != 0) + return -EINVAL; + } else { + if (params->silence_size > params->silence_threshold) + return -EINVAL; + if (params->silence_threshold > runtime->buffer_size) + return -EINVAL; + } + err = 0; + snd_pcm_stream_lock_irq(substream); + runtime->tstamp_mode = params->tstamp_mode; + runtime->period_step = params->period_step; + runtime->control->avail_min = params->avail_min; + runtime->start_threshold = params->start_threshold; + runtime->stop_threshold = params->stop_threshold; + runtime->silence_threshold = params->silence_threshold; + runtime->silence_size = params->silence_size; + params->boundary = runtime->boundary; + if (snd_pcm_running(substream)) { + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && + runtime->silence_size > 0) + snd_pcm_playback_silence(substream, ULONG_MAX); + err = snd_pcm_update_state(substream, runtime); + } + snd_pcm_stream_unlock_irq(substream); + return err; +} + +static int snd_pcm_sw_params_user(struct snd_pcm_substream *substream, + struct snd_pcm_sw_params __user * _params) +{ + struct snd_pcm_sw_params params; + int err; + if (copy_from_user(¶ms, _params, sizeof(params))) + return -EFAULT; + err = snd_pcm_sw_params(substream, ¶ms); + if (copy_to_user(_params, ¶ms, sizeof(params))) + return -EFAULT; + return err; +} + +int snd_pcm_status(struct snd_pcm_substream *substream, + struct snd_pcm_status *status) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + + //giovanni snd_pcm_stream_lock_irq(substream); + status->state = runtime->status->state; + status->suspended_state = runtime->status->suspended_state; + if (status->state == SNDRV_PCM_STATE_OPEN) + goto _end; + status->trigger_tstamp = runtime->trigger_tstamp; + if (snd_pcm_running(substream)) { + snd_pcm_update_hw_ptr(substream); + if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) { + status->tstamp = runtime->status->tstamp; + goto _tstamp_end; + } + } + snd_pcm_gettime(runtime, &status->tstamp); + _tstamp_end: + status->appl_ptr = runtime->control->appl_ptr; + status->hw_ptr = runtime->status->hw_ptr; + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + status->avail = snd_pcm_playback_avail(runtime); + if (runtime->status->state == SNDRV_PCM_STATE_RUNNING || + runtime->status->state == SNDRV_PCM_STATE_DRAINING) { + status->delay = runtime->buffer_size - status->avail; + status->delay += runtime->delay; + } else + status->delay = 0; + } else { + status->avail = snd_pcm_capture_avail(runtime); + if (runtime->status->state == SNDRV_PCM_STATE_RUNNING) + status->delay = status->avail + runtime->delay; + else + status->delay = 0; + } + status->avail_max = runtime->avail_max; + status->overrange = runtime->overrange; + runtime->avail_max = 0; + runtime->overrange = 0; + _end: + //giovanni snd_pcm_stream_unlock_irq(substream); + return 0; +} + +static int snd_pcm_status_user(struct snd_pcm_substream *substream, + struct snd_pcm_status __user * _status) +{ + struct snd_pcm_status status; + int res; + + memset(&status, 0, sizeof(status)); + res = snd_pcm_status(substream, &status); + if (res < 0) + return res; + if (copy_to_user(_status, &status, sizeof(status))) + return -EFAULT; + return 0; +} + +static int snd_pcm_channel_info(struct snd_pcm_substream *substream, + struct snd_pcm_channel_info * info) +{ + struct snd_pcm_runtime *runtime; + unsigned int channel; + + channel = info->channel; + runtime = substream->runtime; + //giovanni snd_pcm_stream_lock_irq(substream); + if (runtime->status->state == SNDRV_PCM_STATE_OPEN) { + //giovanni snd_pcm_stream_unlock_irq(substream); + return -EBADFD; + } + //giovanni snd_pcm_stream_unlock_irq(substream); + if (channel >= runtime->channels) + return -EINVAL; + memset(info, 0, sizeof(*info)); + info->channel = channel; + return substream->ops->ioctl(substream, SNDRV_PCM_IOCTL1_CHANNEL_INFO, info); +} + +static int snd_pcm_channel_info_user(struct snd_pcm_substream *substream, + struct snd_pcm_channel_info __user * _info) +{ + struct snd_pcm_channel_info info; + int res; + + if (copy_from_user(&info, _info, sizeof(info))) + return -EFAULT; + res = snd_pcm_channel_info(substream, &info); + if (res < 0) + return res; + if (copy_to_user(_info, &info, sizeof(info))) + return -EFAULT; + return 0; +} + +static void snd_pcm_trigger_tstamp(struct snd_pcm_substream *substream) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + if (runtime->trigger_master == NULL) + return; + if (runtime->trigger_master == substream) { + snd_pcm_gettime(runtime, &runtime->trigger_tstamp); + } else { + snd_pcm_trigger_tstamp(runtime->trigger_master); + runtime->trigger_tstamp = runtime->trigger_master->runtime->trigger_tstamp; + } + runtime->trigger_master = NULL; +} + +struct action_ops { + int (*pre_action)(struct snd_pcm_substream *substream, int state); + int (*do_action)(struct snd_pcm_substream *substream, int state); + void (*undo_action)(struct snd_pcm_substream *substream, int state); + void (*post_action)(struct snd_pcm_substream *substream, int state); +}; + +/* + * this functions is core for handling of linked stream + * Note: the stream state might be changed also on failure + * Note2: call with calling stream lock + link lock + */ +static int snd_pcm_action_group(struct action_ops *ops, + struct snd_pcm_substream *substream, + int state, int do_lock) +{ + struct snd_pcm_substream *s = NULL; + struct snd_pcm_substream *s1; + int res = 0; + + snd_pcm_group_for_each_entry(s, substream) { + if (do_lock && s != substream) + spin_lock_nested(&s->self_group.lock, + SINGLE_DEPTH_NESTING); + res = ops->pre_action(s, state); + if (res < 0) + goto _unlock; + } + snd_pcm_group_for_each_entry(s, substream) { + res = ops->do_action(s, state); + if (res < 0) { + if (ops->undo_action) { + snd_pcm_group_for_each_entry(s1, substream) { + if (s1 == s) /* failed stream */ + break; + ops->undo_action(s1, state); + } + } + s = NULL; /* unlock all */ + goto _unlock; + } + } + snd_pcm_group_for_each_entry(s, substream) { + ops->post_action(s, state); + } + _unlock: + if (do_lock) { + /* unlock streams */ + snd_pcm_group_for_each_entry(s1, substream) { + if (s1 != substream) + spin_unlock(&s1->self_group.lock); + if (s1 == s) /* end */ + break; + } + } + return res; +} + +/* + * Note: call with stream lock + */ +static int snd_pcm_action_single(struct action_ops *ops, + struct snd_pcm_substream *substream, + int state) +{ + int res; + + res = ops->pre_action(substream, state); + if (res < 0) + return res; + res = ops->do_action(substream, state); + if (res == 0) + ops->post_action(substream, state); + else if (ops->undo_action) + ops->undo_action(substream, state); + return res; +} + +/* + * Note: call with stream lock + */ +static int snd_pcm_action(struct action_ops *ops, + struct snd_pcm_substream *substream, + int state) +{ + int res; + + if (snd_pcm_stream_linked(substream)) { + if (!spin_trylock(&substream->group->lock)) { + spin_unlock(&substream->self_group.lock); + spin_lock(&substream->group->lock); + spin_lock(&substream->self_group.lock); + } + res = snd_pcm_action_group(ops, substream, state, 1); + spin_unlock(&substream->group->lock); + } else { + res = snd_pcm_action_single(ops, substream, state); + } + return res; +} + +/* + * Note: don't use any locks before + */ +static int snd_pcm_action_lock_irq(struct action_ops *ops, + struct snd_pcm_substream *substream, + int state) +{ + int res; + + read_lock_irq(&snd_pcm_link_rwlock); + if (snd_pcm_stream_linked(substream)) { + spin_lock(&substream->group->lock); + spin_lock(&substream->self_group.lock); + res = snd_pcm_action_group(ops, substream, state, 1); + spin_unlock(&substream->self_group.lock); + spin_unlock(&substream->group->lock); + } else { + spin_lock(&substream->self_group.lock); + res = snd_pcm_action_single(ops, substream, state); + spin_unlock(&substream->self_group.lock); + } + read_unlock_irq(&snd_pcm_link_rwlock); + return res; +} + +/* + */ +static int snd_pcm_action_nonatomic(struct action_ops *ops, + struct snd_pcm_substream *substream, + int state) +{ + int res; + + down_read(&snd_pcm_link_rwsem); + if (snd_pcm_stream_linked(substream)) + res = snd_pcm_action_group(ops, substream, state, 0); + else + res = snd_pcm_action_single(ops, substream, state); + up_read(&snd_pcm_link_rwsem); + return res; +} + +/* + * start callbacks + */ +static int snd_pcm_pre_start(struct snd_pcm_substream *substream, int state) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + if (runtime->status->state != SNDRV_PCM_STATE_PREPARED) + return -EBADFD; + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && + !snd_pcm_playback_data(substream)) + return -EPIPE; + runtime->trigger_master = substream; + return 0; +} + +static int snd_pcm_do_start(struct snd_pcm_substream *substream, int state) +{ + if (substream->runtime->trigger_master != substream) + return 0; + return substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_START); +} + +static void snd_pcm_undo_start(struct snd_pcm_substream *substream, int state) +{ + if (substream->runtime->trigger_master == substream) + substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_STOP); +} + +static void snd_pcm_post_start(struct snd_pcm_substream *substream, int state) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + snd_pcm_trigger_tstamp(substream); + runtime->hw_ptr_jiffies = jiffies; + runtime->status->state = state; + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && + runtime->silence_size > 0) + snd_pcm_playback_silence(substream, ULONG_MAX); + if (substream->timer) + snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MSTART, + &runtime->trigger_tstamp); +} + +static struct action_ops snd_pcm_action_start = { + .pre_action = snd_pcm_pre_start, + .do_action = snd_pcm_do_start, + .undo_action = snd_pcm_undo_start, + .post_action = snd_pcm_post_start +}; + +/** + * snd_pcm_start - start all linked streams + * @substream: the PCM substream instance + */ +int snd_pcm_start(struct snd_pcm_substream *substream) +{ + return snd_pcm_action(&snd_pcm_action_start, substream, + SNDRV_PCM_STATE_RUNNING); +} + +/* + * stop callbacks + */ +static int snd_pcm_pre_stop(struct snd_pcm_substream *substream, int state) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + if (runtime->status->state == SNDRV_PCM_STATE_OPEN) + return -EBADFD; + runtime->trigger_master = substream; + return 0; +} + +static int snd_pcm_do_stop(struct snd_pcm_substream *substream, int state) +{ + if (substream->runtime->trigger_master == substream && + snd_pcm_running(substream)) + substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_STOP); + return 0; /* unconditonally stop all substreams */ +} + +static void snd_pcm_post_stop(struct snd_pcm_substream *substream, int state) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + if (runtime->status->state != state) { + snd_pcm_trigger_tstamp(substream); + if (substream->timer) + snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MSTOP, + &runtime->trigger_tstamp); + runtime->status->state = state; + } + wake_up(&runtime->sleep); + wake_up(&runtime->tsleep); +} + +static struct action_ops snd_pcm_action_stop = { + .pre_action = snd_pcm_pre_stop, + .do_action = snd_pcm_do_stop, + .post_action = snd_pcm_post_stop +}; + +/** + * snd_pcm_stop - try to stop all running streams in the substream group + * @substream: the PCM substream instance + * @state: PCM state after stopping the stream + * + * The state of each stream is then changed to the given state unconditionally. + */ +int snd_pcm_stop(struct snd_pcm_substream *substream, int state) +{ + return snd_pcm_action(&snd_pcm_action_stop, substream, state); +} + +EXPORT_SYMBOL(snd_pcm_stop); + +/** + * snd_pcm_drain_done - stop the DMA only when the given stream is playback + * @substream: the PCM substream + * + * After stopping, the state is changed to SETUP. + * Unlike snd_pcm_stop(), this affects only the given stream. + */ +int snd_pcm_drain_done(struct snd_pcm_substream *substream) +{ + return snd_pcm_action_single(&snd_pcm_action_stop, substream, + SNDRV_PCM_STATE_SETUP); +} + +/* + * pause callbacks + */ +static int snd_pcm_pre_pause(struct snd_pcm_substream *substream, int push) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + if (!(runtime->info & SNDRV_PCM_INFO_PAUSE)) + return -ENOSYS; + if (push) { + if (runtime->status->state != SNDRV_PCM_STATE_RUNNING) + return -EBADFD; + } else if (runtime->status->state != SNDRV_PCM_STATE_PAUSED) + return -EBADFD; + runtime->trigger_master = substream; + return 0; +} + +static int snd_pcm_do_pause(struct snd_pcm_substream *substream, int push) +{ + if (substream->runtime->trigger_master != substream) + return 0; + /* The jiffies check in snd_pcm_update_hw_ptr*() is done by + * a delta betwen the current jiffies, this gives a large enough + * delta, effectively to skip the check once. + */ + substream->runtime->hw_ptr_jiffies = jiffies - HZ * 1000; + return substream->ops->trigger(substream, + push ? SNDRV_PCM_TRIGGER_PAUSE_PUSH : + SNDRV_PCM_TRIGGER_PAUSE_RELEASE); +} + +static void snd_pcm_undo_pause(struct snd_pcm_substream *substream, int push) +{ + if (substream->runtime->trigger_master == substream) + substream->ops->trigger(substream, + push ? SNDRV_PCM_TRIGGER_PAUSE_RELEASE : + SNDRV_PCM_TRIGGER_PAUSE_PUSH); +} + +static void snd_pcm_post_pause(struct snd_pcm_substream *substream, int push) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + snd_pcm_trigger_tstamp(substream); + if (push) { + runtime->status->state = SNDRV_PCM_STATE_PAUSED; + if (substream->timer) + snd_timer_notify(substream->timer, + SNDRV_TIMER_EVENT_MPAUSE, + &runtime->trigger_tstamp); + wake_up(&runtime->sleep); + wake_up(&runtime->tsleep); + } else { + runtime->status->state = SNDRV_PCM_STATE_RUNNING; + if (substream->timer) + snd_timer_notify(substream->timer, + SNDRV_TIMER_EVENT_MCONTINUE, + &runtime->trigger_tstamp); + } +} + +static struct action_ops snd_pcm_action_pause = { + .pre_action = snd_pcm_pre_pause, + .do_action = snd_pcm_do_pause, + .undo_action = snd_pcm_undo_pause, + .post_action = snd_pcm_post_pause +}; + +/* + * Push/release the pause for all linked streams. + */ +static int snd_pcm_pause(struct snd_pcm_substream *substream, int push) +{ + return snd_pcm_action(&snd_pcm_action_pause, substream, push); +} + +#ifdef CONFIG_PM +/* suspend */ + +static int snd_pcm_pre_suspend(struct snd_pcm_substream *substream, int state) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + if (runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) + return -EBUSY; + runtime->trigger_master = substream; + return 0; +} + +static int snd_pcm_do_suspend(struct snd_pcm_substream *substream, int state) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + if (runtime->trigger_master != substream) + return 0; + if (! snd_pcm_running(substream)) + return 0; + substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_SUSPEND); + return 0; /* suspend unconditionally */ +} + +static void snd_pcm_post_suspend(struct snd_pcm_substream *substream, int state) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + snd_pcm_trigger_tstamp(substream); + if (substream->timer) + snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MSUSPEND, + &runtime->trigger_tstamp); + runtime->status->suspended_state = runtime->status->state; + runtime->status->state = SNDRV_PCM_STATE_SUSPENDED; + wake_up(&runtime->sleep); + wake_up(&runtime->tsleep); +} + +static struct action_ops snd_pcm_action_suspend = { + .pre_action = snd_pcm_pre_suspend, + .do_action = snd_pcm_do_suspend, + .post_action = snd_pcm_post_suspend +}; + +/** + * snd_pcm_suspend - trigger SUSPEND to all linked streams + * @substream: the PCM substream + * + * After this call, all streams are changed to SUSPENDED state. + */ +int snd_pcm_suspend(struct snd_pcm_substream *substream) +{ + int err; + unsigned long flags; + + if (! substream) + return 0; + + snd_pcm_stream_lock_irqsave(substream, flags); + err = snd_pcm_action(&snd_pcm_action_suspend, substream, 0); + snd_pcm_stream_unlock_irqrestore(substream, flags); + return err; +} + +EXPORT_SYMBOL(snd_pcm_suspend); + +/** + * snd_pcm_suspend_all - trigger SUSPEND to all substreams in the given pcm + * @pcm: the PCM instance + * + * After this call, all streams are changed to SUSPENDED state. + */ +int snd_pcm_suspend_all(struct snd_pcm *pcm) +{ + struct snd_pcm_substream *substream; + int stream, err = 0; + + if (! pcm) + return 0; + + for (stream = 0; stream < 2; stream++) { + for (substream = pcm->streams[stream].substream; + substream; substream = substream->next) { + /* FIXME: the open/close code should lock this as well */ + if (substream->runtime == NULL) + continue; + err = snd_pcm_suspend(substream); + if (err < 0 && err != -EBUSY) + return err; + } + } + return 0; +} + +EXPORT_SYMBOL(snd_pcm_suspend_all); + +/* resume */ + +static int snd_pcm_pre_resume(struct snd_pcm_substream *substream, int state) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + if (!(runtime->info & SNDRV_PCM_INFO_RESUME)) + return -ENOSYS; + runtime->trigger_master = substream; + return 0; +} + +static int snd_pcm_do_resume(struct snd_pcm_substream *substream, int state) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + if (runtime->trigger_master != substream) + return 0; + /* DMA not running previously? */ + if (runtime->status->suspended_state != SNDRV_PCM_STATE_RUNNING && + (runtime->status->suspended_state != SNDRV_PCM_STATE_DRAINING || + substream->stream != SNDRV_PCM_STREAM_PLAYBACK)) + return 0; + return substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_RESUME); +} + +static void snd_pcm_undo_resume(struct snd_pcm_substream *substream, int state) +{ + if (substream->runtime->trigger_master == substream && + snd_pcm_running(substream)) + substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_SUSPEND); +} + +static void snd_pcm_post_resume(struct snd_pcm_substream *substream, int state) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + snd_pcm_trigger_tstamp(substream); + if (substream->timer) + snd_timer_notify(substream->timer, SNDRV_TIMER_EVENT_MRESUME, + &runtime->trigger_tstamp); + runtime->status->state = runtime->status->suspended_state; +} + +static struct action_ops snd_pcm_action_resume = { + .pre_action = snd_pcm_pre_resume, + .do_action = snd_pcm_do_resume, + .undo_action = snd_pcm_undo_resume, + .post_action = snd_pcm_post_resume +}; + +static int snd_pcm_resume(struct snd_pcm_substream *substream) +{ + struct snd_card *card = substream->pcm->card; + int res; + + snd_power_lock(card); + if ((res = snd_power_wait(card, SNDRV_CTL_POWER_D0)) >= 0) + res = snd_pcm_action_lock_irq(&snd_pcm_action_resume, substream, 0); + snd_power_unlock(card); + return res; +} + +#else + +static int snd_pcm_resume(struct snd_pcm_substream *substream) +{ + return -ENOSYS; +} + +#endif /* CONFIG_PM */ + +/* + * xrun ioctl + * + * Change the RUNNING stream(s) to XRUN state. + */ +static int snd_pcm_xrun(struct snd_pcm_substream *substream) +{ + struct snd_card *card = substream->pcm->card; + struct snd_pcm_runtime *runtime = substream->runtime; + int result; + + snd_power_lock(card); + if (runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { + result = snd_power_wait(card, SNDRV_CTL_POWER_D0); + if (result < 0) + goto _unlock; + } + + snd_pcm_stream_lock_irq(substream); + switch (runtime->status->state) { + case SNDRV_PCM_STATE_XRUN: + result = 0; /* already there */ + break; + case SNDRV_PCM_STATE_RUNNING: + result = snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN); + break; + default: + result = -EBADFD; + } + snd_pcm_stream_unlock_irq(substream); + _unlock: + snd_power_unlock(card); + return result; +} + +/* + * reset ioctl + */ +static int snd_pcm_pre_reset(struct snd_pcm_substream *substream, int state) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + switch (runtime->status->state) { + case SNDRV_PCM_STATE_RUNNING: + case SNDRV_PCM_STATE_PREPARED: + case SNDRV_PCM_STATE_PAUSED: + case SNDRV_PCM_STATE_SUSPENDED: + return 0; + default: + return -EBADFD; + } +} + +static int snd_pcm_do_reset(struct snd_pcm_substream *substream, int state) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + int err = substream->ops->ioctl(substream, SNDRV_PCM_IOCTL1_RESET, NULL); + if (err < 0) + return err; + runtime->hw_ptr_base = 0; + runtime->hw_ptr_interrupt = runtime->status->hw_ptr - + runtime->status->hw_ptr % runtime->period_size; + runtime->silence_start = runtime->status->hw_ptr; + runtime->silence_filled = 0; + return 0; +} + +static void snd_pcm_post_reset(struct snd_pcm_substream *substream, int state) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + runtime->control->appl_ptr = runtime->status->hw_ptr; + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && + runtime->silence_size > 0) + snd_pcm_playback_silence(substream, ULONG_MAX); +} + +static struct action_ops snd_pcm_action_reset = { + .pre_action = snd_pcm_pre_reset, + .do_action = snd_pcm_do_reset, + .post_action = snd_pcm_post_reset +}; + +static int snd_pcm_reset(struct snd_pcm_substream *substream) +{ + return snd_pcm_action_nonatomic(&snd_pcm_action_reset, substream, 0); +} + +/* + * prepare ioctl + */ +/* we use the second argument for updating f_flags */ +static int snd_pcm_pre_prepare(struct snd_pcm_substream *substream, + int f_flags) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + if (runtime->status->state == SNDRV_PCM_STATE_OPEN || + runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED) + return -EBADFD; + if (snd_pcm_running(substream)) + return -EBUSY; + substream->f_flags = f_flags; + return 0; +} + +static int snd_pcm_do_prepare(struct snd_pcm_substream *substream, int state) +{ + int err; + err = substream->ops->prepare(substream); + if (err < 0) + return err; + return snd_pcm_do_reset(substream, 0); +} + +static void snd_pcm_post_prepare(struct snd_pcm_substream *substream, int state) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + runtime->control->appl_ptr = runtime->status->hw_ptr; + runtime->status->state = SNDRV_PCM_STATE_PREPARED; +} + +static struct action_ops snd_pcm_action_prepare = { + .pre_action = snd_pcm_pre_prepare, + .do_action = snd_pcm_do_prepare, + .post_action = snd_pcm_post_prepare +}; + +/** + * snd_pcm_prepare - prepare the PCM substream to be triggerable + * @substream: the PCM substream instance + * @file: file to refer f_flags + */ +static int snd_pcm_prepare(struct snd_pcm_substream *substream, + struct file *file) +{ + int res; + struct snd_card *card = substream->pcm->card; + int f_flags; + + if (file) + f_flags = file->f_flags; + else + f_flags = substream->f_flags; + + snd_power_lock(card); + if ((res = snd_power_wait(card, SNDRV_CTL_POWER_D0)) >= 0) + res = snd_pcm_action_nonatomic(&snd_pcm_action_prepare, + substream, f_flags); + snd_power_unlock(card); + return res; +} + +/* + * drain ioctl + */ + +static int snd_pcm_pre_drain_init(struct snd_pcm_substream *substream, int state) +{ + substream->runtime->trigger_master = substream; + return 0; +} + +static int snd_pcm_do_drain_init(struct snd_pcm_substream *substream, int state) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + switch (runtime->status->state) { + case SNDRV_PCM_STATE_PREPARED: + /* start playback stream if possible */ + if (! snd_pcm_playback_empty(substream)) { + snd_pcm_do_start(substream, SNDRV_PCM_STATE_DRAINING); + snd_pcm_post_start(substream, SNDRV_PCM_STATE_DRAINING); + } + break; + case SNDRV_PCM_STATE_RUNNING: + runtime->status->state = SNDRV_PCM_STATE_DRAINING; + break; + default: + break; + } + } else { + /* stop running stream */ + if (runtime->status->state == SNDRV_PCM_STATE_RUNNING) { + int new_state = snd_pcm_capture_avail(runtime) > 0 ? + SNDRV_PCM_STATE_DRAINING : SNDRV_PCM_STATE_SETUP; + snd_pcm_do_stop(substream, new_state); + snd_pcm_post_stop(substream, new_state); + } + } + return 0; +} + +static void snd_pcm_post_drain_init(struct snd_pcm_substream *substream, int state) +{ +} + +static struct action_ops snd_pcm_action_drain_init = { + .pre_action = snd_pcm_pre_drain_init, + .do_action = snd_pcm_do_drain_init, + .post_action = snd_pcm_post_drain_init +}; + +static int snd_pcm_drop(struct snd_pcm_substream *substream); + +/* + * Drain the stream(s). + * When the substream is linked, sync until the draining of all playback streams + * is finished. + * After this call, all streams are supposed to be either SETUP or DRAINING + * (capture only) state. + */ +static int snd_pcm_drain(struct snd_pcm_substream *substream, + struct file *file) +{ + struct snd_card *card; + struct snd_pcm_runtime *runtime; + struct snd_pcm_substream *s; + wait_queue_t wait; + int result = 0; + int nonblock = 0; + + card = substream->pcm->card; + runtime = substream->runtime; + + if (runtime->status->state == SNDRV_PCM_STATE_OPEN) + return -EBADFD; + + snd_power_lock(card); + if (runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) { + result = snd_power_wait(card, SNDRV_CTL_POWER_D0); + if (result < 0) { + snd_power_unlock(card); + return result; + } + } + + if (file) { + if (file->f_flags & O_NONBLOCK) + nonblock = 1; + } else if (substream->f_flags & O_NONBLOCK) + nonblock = 1; + + down_read(&snd_pcm_link_rwsem); + snd_pcm_stream_lock_irq(substream); + /* resume pause */ + if (runtime->status->state == SNDRV_PCM_STATE_PAUSED) + snd_pcm_pause(substream, 0); + + /* pre-start/stop - all running streams are changed to DRAINING state */ + result = snd_pcm_action(&snd_pcm_action_drain_init, substream, 0); + if (result < 0) + goto unlock; + /* in non-blocking, we don't wait in ioctl but let caller poll */ + if (nonblock) { + result = -EAGAIN; + goto unlock; + } + + for (;;) { + long tout; + struct snd_pcm_runtime *to_check; + if (signal_pending(current)) { + result = -ERESTARTSYS; + break; + } + /* find a substream to drain */ + to_check = NULL; + snd_pcm_group_for_each_entry(s, substream) { + if (s->stream != SNDRV_PCM_STREAM_PLAYBACK) + continue; + runtime = s->runtime; + if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) { + to_check = runtime; + break; + } + } + if (!to_check) + break; /* all drained */ + init_waitqueue_entry(&wait, current); + add_wait_queue(&to_check->sleep, &wait); + set_current_state(TASK_INTERRUPTIBLE); + snd_pcm_stream_unlock_irq(substream); + up_read(&snd_pcm_link_rwsem); + snd_power_unlock(card); + tout = schedule_timeout(10 * HZ); + snd_power_lock(card); + down_read(&snd_pcm_link_rwsem); + snd_pcm_stream_lock_irq(substream); + remove_wait_queue(&to_check->sleep, &wait); + if (tout == 0) { + if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) + result = -ESTRPIPE; + else { + snd_printd("playback drain error (DMA or IRQ trouble?)\n"); + snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP); + result = -EIO; + } + break; + } + } + + unlock: + snd_pcm_stream_unlock_irq(substream); + up_read(&snd_pcm_link_rwsem); + snd_power_unlock(card); + + return result; +} + +/* + * drop ioctl + * + * Immediately put all linked substreams into SETUP state. + */ +static int snd_pcm_drop(struct snd_pcm_substream *substream) +{ + struct snd_pcm_runtime *runtime; + struct snd_card *card; + int result = 0; + + if (PCM_RUNTIME_CHECK(substream)) + return -ENXIO; + runtime = substream->runtime; + card = substream->pcm->card; + + if (runtime->status->state == SNDRV_PCM_STATE_OPEN || + runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED || + runtime->status->state == SNDRV_PCM_STATE_SUSPENDED) + return -EBADFD; + + snd_pcm_stream_lock_irq(substream); + /* resume pause */ + if (runtime->status->state == SNDRV_PCM_STATE_PAUSED) + snd_pcm_pause(substream, 0); + + snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP); + /* runtime->control->appl_ptr = runtime->status->hw_ptr; */ + snd_pcm_stream_unlock_irq(substream); + + return result; +} + + +/* WARNING: Don't forget to fput back the file */ +static struct file *snd_pcm_file_fd(int fd) +{ + struct file *file; + struct inode *inode; + unsigned int minor; + + file = fget(fd); + if (!file) + return NULL; + inode = file->f_path.dentry->d_inode; + if (!S_ISCHR(inode->i_mode) || + imajor(inode) != snd_major) { + fput(file); + return NULL; + } + minor = iminor(inode); + if (!snd_lookup_minor_data(minor, SNDRV_DEVICE_TYPE_PCM_PLAYBACK) && + !snd_lookup_minor_data(minor, SNDRV_DEVICE_TYPE_PCM_CAPTURE)) { + fput(file); + return NULL; + } + return file; +} + +/* + * PCM link handling + */ +static int snd_pcm_link(struct snd_pcm_substream *substream, int fd) +{ + int res = 0; + struct file *file; + struct snd_pcm_file *pcm_file; + struct snd_pcm_substream *substream1; + + file = snd_pcm_file_fd(fd); + if (!file) + return -EBADFD; + pcm_file = file->private_data; + substream1 = pcm_file->substream; + down_write(&snd_pcm_link_rwsem); + write_lock_irq(&snd_pcm_link_rwlock); + if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN || + substream->runtime->status->state != substream1->runtime->status->state) { + res = -EBADFD; + goto _end; + } + if (snd_pcm_stream_linked(substream1)) { + res = -EALREADY; + goto _end; + } + if (!snd_pcm_stream_linked(substream)) { + substream->group = kmalloc(sizeof(struct snd_pcm_group), GFP_ATOMIC); + if (substream->group == NULL) { + res = -ENOMEM; + goto _end; + } + spin_lock_init(&substream->group->lock); + INIT_LIST_HEAD(&substream->group->substreams); + list_add_tail(&substream->link_list, &substream->group->substreams); + substream->group->count = 1; + } + list_add_tail(&substream1->link_list, &substream->group->substreams); + substream->group->count++; + substream1->group = substream->group; + _end: + write_unlock_irq(&snd_pcm_link_rwlock); + up_write(&snd_pcm_link_rwsem); + fput(file); + return res; +} + +static void relink_to_local(struct snd_pcm_substream *substream) +{ + substream->group = &substream->self_group; + INIT_LIST_HEAD(&substream->self_group.substreams); + list_add_tail(&substream->link_list, &substream->self_group.substreams); +} + +static int snd_pcm_unlink(struct snd_pcm_substream *substream) +{ + struct snd_pcm_substream *s; + int res = 0; + + down_write(&snd_pcm_link_rwsem); + write_lock_irq(&snd_pcm_link_rwlock); + if (!snd_pcm_stream_linked(substream)) { + res = -EALREADY; + goto _end; + } + list_del(&substream->link_list); + substream->group->count--; + if (substream->group->count == 1) { /* detach the last stream, too */ + snd_pcm_group_for_each_entry(s, substream) { + relink_to_local(s); + break; + } + kfree(substream->group); + } + relink_to_local(substream); + _end: + write_unlock_irq(&snd_pcm_link_rwlock); + up_write(&snd_pcm_link_rwsem); + return res; +} + +/* + * hw configurator + */ +static int snd_pcm_hw_rule_mul(struct snd_pcm_hw_params *params, + struct snd_pcm_hw_rule *rule) +{ + struct snd_interval t; + snd_interval_mul(hw_param_interval_c(params, rule->deps[0]), + hw_param_interval_c(params, rule->deps[1]), &t); + return snd_interval_refine(hw_param_interval(params, rule->var), &t); +} + +static int snd_pcm_hw_rule_div(struct snd_pcm_hw_params *params, + struct snd_pcm_hw_rule *rule) +{ + struct snd_interval t; + snd_interval_div(hw_param_interval_c(params, rule->deps[0]), + hw_param_interval_c(params, rule->deps[1]), &t); + return snd_interval_refine(hw_param_interval(params, rule->var), &t); +} + +static int snd_pcm_hw_rule_muldivk(struct snd_pcm_hw_params *params, + struct snd_pcm_hw_rule *rule) +{ + struct snd_interval t; + snd_interval_muldivk(hw_param_interval_c(params, rule->deps[0]), + hw_param_interval_c(params, rule->deps[1]), + (unsigned long) rule->private, &t); + return snd_interval_refine(hw_param_interval(params, rule->var), &t); +} + +static int snd_pcm_hw_rule_mulkdiv(struct snd_pcm_hw_params *params, + struct snd_pcm_hw_rule *rule) +{ + struct snd_interval t; + snd_interval_mulkdiv(hw_param_interval_c(params, rule->deps[0]), + (unsigned long) rule->private, + hw_param_interval_c(params, rule->deps[1]), &t); + return snd_interval_refine(hw_param_interval(params, rule->var), &t); +} + +static int snd_pcm_hw_rule_format(struct snd_pcm_hw_params *params, + struct snd_pcm_hw_rule *rule) +{ + unsigned int k; + struct snd_interval *i = hw_param_interval(params, rule->deps[0]); + struct snd_mask m; + struct snd_mask *mask = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); + snd_mask_any(&m); + for (k = 0; k <= SNDRV_PCM_FORMAT_LAST; ++k) { + int bits; + if (! snd_mask_test(mask, k)) + continue; + bits = snd_pcm_format_physical_width(k); + if (bits <= 0) + continue; /* ignore invalid formats */ + if ((unsigned)bits < i->min || (unsigned)bits > i->max) + snd_mask_reset(&m, k); + } + return snd_mask_refine(mask, &m); +} + +static int snd_pcm_hw_rule_sample_bits(struct snd_pcm_hw_params *params, + struct snd_pcm_hw_rule *rule) +{ + struct snd_interval t; + unsigned int k; + t.min = UINT_MAX; + t.max = 0; + t.openmin = 0; + t.openmax = 0; + for (k = 0; k <= SNDRV_PCM_FORMAT_LAST; ++k) { + int bits; + if (! snd_mask_test(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT), k)) + continue; + bits = snd_pcm_format_physical_width(k); + if (bits <= 0) + continue; /* ignore invalid formats */ + if (t.min > (unsigned)bits) + t.min = bits; + if (t.max < (unsigned)bits) + t.max = bits; + } + t.integer = 1; + return snd_interval_refine(hw_param_interval(params, rule->var), &t); +} + +#if SNDRV_PCM_RATE_5512 != 1 << 0 || SNDRV_PCM_RATE_192000 != 1 << 12 +#error "Change this table" +#endif + +static unsigned int rates[] = { 5512, 8000, 11025, 16000, 22050, 32000, 44100, + 48000, 64000, 88200, 96000, 176400, 192000 }; + +const struct snd_pcm_hw_constraint_list snd_pcm_known_rates = { + .count = ARRAY_SIZE(rates), + .list = rates, +}; + +static int snd_pcm_hw_rule_rate(struct snd_pcm_hw_params *params, + struct snd_pcm_hw_rule *rule) +{ + struct snd_pcm_hardware *hw = rule->private; + return snd_interval_list(hw_param_interval(params, rule->var), + snd_pcm_known_rates.count, + snd_pcm_known_rates.list, hw->rates); +} + +static int snd_pcm_hw_rule_buffer_bytes_max(struct snd_pcm_hw_params *params, + struct snd_pcm_hw_rule *rule) +{ + struct snd_interval t; + struct snd_pcm_substream *substream = rule->private; + t.min = 0; + t.max = substream->buffer_bytes_max; + t.openmin = 0; + t.openmax = 0; + t.integer = 1; + return snd_interval_refine(hw_param_interval(params, rule->var), &t); +} + +int snd_pcm_hw_constraints_init(struct snd_pcm_substream *substream) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + struct snd_pcm_hw_constraints *constrs = &runtime->hw_constraints; + int k, err; + + for (k = SNDRV_PCM_HW_PARAM_FIRST_MASK; k <= SNDRV_PCM_HW_PARAM_LAST_MASK; k++) { + snd_mask_any(constrs_mask(constrs, k)); + } + + for (k = SNDRV_PCM_HW_PARAM_FIRST_INTERVAL; k <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL; k++) { + snd_interval_any(constrs_interval(constrs, k)); + } + + snd_interval_setinteger(constrs_interval(constrs, SNDRV_PCM_HW_PARAM_CHANNELS)); + snd_interval_setinteger(constrs_interval(constrs, SNDRV_PCM_HW_PARAM_BUFFER_SIZE)); + snd_interval_setinteger(constrs_interval(constrs, SNDRV_PCM_HW_PARAM_BUFFER_BYTES)); + snd_interval_setinteger(constrs_interval(constrs, SNDRV_PCM_HW_PARAM_SAMPLE_BITS)); + snd_interval_setinteger(constrs_interval(constrs, SNDRV_PCM_HW_PARAM_FRAME_BITS)); + + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FORMAT, + snd_pcm_hw_rule_format, NULL, + SNDRV_PCM_HW_PARAM_SAMPLE_BITS, -1); + if (err < 0) + return err; + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, + snd_pcm_hw_rule_sample_bits, NULL, + SNDRV_PCM_HW_PARAM_FORMAT, + SNDRV_PCM_HW_PARAM_SAMPLE_BITS, -1); + if (err < 0) + return err; + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, + snd_pcm_hw_rule_div, NULL, + SNDRV_PCM_HW_PARAM_FRAME_BITS, SNDRV_PCM_HW_PARAM_CHANNELS, -1); + if (err < 0) + return err; + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, + snd_pcm_hw_rule_mul, NULL, + SNDRV_PCM_HW_PARAM_SAMPLE_BITS, SNDRV_PCM_HW_PARAM_CHANNELS, -1); + if (err < 0) + return err; + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, + snd_pcm_hw_rule_mulkdiv, (void*) 8, + SNDRV_PCM_HW_PARAM_PERIOD_BYTES, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, -1); + if (err < 0) + return err; + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_FRAME_BITS, + snd_pcm_hw_rule_mulkdiv, (void*) 8, + SNDRV_PCM_HW_PARAM_BUFFER_BYTES, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, -1); + if (err < 0) + return err; + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, + snd_pcm_hw_rule_div, NULL, + SNDRV_PCM_HW_PARAM_FRAME_BITS, SNDRV_PCM_HW_PARAM_SAMPLE_BITS, -1); + if (err < 0) + return err; + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, + snd_pcm_hw_rule_mulkdiv, (void*) 1000000, + SNDRV_PCM_HW_PARAM_PERIOD_SIZE, SNDRV_PCM_HW_PARAM_PERIOD_TIME, -1); + if (err < 0) + return err; + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, + snd_pcm_hw_rule_mulkdiv, (void*) 1000000, + SNDRV_PCM_HW_PARAM_BUFFER_SIZE, SNDRV_PCM_HW_PARAM_BUFFER_TIME, -1); + if (err < 0) + return err; + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIODS, + snd_pcm_hw_rule_div, NULL, + SNDRV_PCM_HW_PARAM_BUFFER_SIZE, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, -1); + if (err < 0) + return err; + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, + snd_pcm_hw_rule_div, NULL, + SNDRV_PCM_HW_PARAM_BUFFER_SIZE, SNDRV_PCM_HW_PARAM_PERIODS, -1); + if (err < 0) + return err; + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, + snd_pcm_hw_rule_mulkdiv, (void*) 8, + SNDRV_PCM_HW_PARAM_PERIOD_BYTES, SNDRV_PCM_HW_PARAM_FRAME_BITS, -1); + if (err < 0) + return err; + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, + snd_pcm_hw_rule_muldivk, (void*) 1000000, + SNDRV_PCM_HW_PARAM_PERIOD_TIME, SNDRV_PCM_HW_PARAM_RATE, -1); + if (err < 0) + return err; + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, + snd_pcm_hw_rule_mul, NULL, + SNDRV_PCM_HW_PARAM_PERIOD_SIZE, SNDRV_PCM_HW_PARAM_PERIODS, -1); + if (err < 0) + return err; + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, + snd_pcm_hw_rule_mulkdiv, (void*) 8, + SNDRV_PCM_HW_PARAM_BUFFER_BYTES, SNDRV_PCM_HW_PARAM_FRAME_BITS, -1); + if (err < 0) + return err; + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, + snd_pcm_hw_rule_muldivk, (void*) 1000000, + SNDRV_PCM_HW_PARAM_BUFFER_TIME, SNDRV_PCM_HW_PARAM_RATE, -1); + if (err < 0) + return err; + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, + snd_pcm_hw_rule_muldivk, (void*) 8, + SNDRV_PCM_HW_PARAM_PERIOD_SIZE, SNDRV_PCM_HW_PARAM_FRAME_BITS, -1); + if (err < 0) + return err; + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, + snd_pcm_hw_rule_muldivk, (void*) 8, + SNDRV_PCM_HW_PARAM_BUFFER_SIZE, SNDRV_PCM_HW_PARAM_FRAME_BITS, -1); + if (err < 0) + return err; + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_TIME, + snd_pcm_hw_rule_mulkdiv, (void*) 1000000, + SNDRV_PCM_HW_PARAM_PERIOD_SIZE, SNDRV_PCM_HW_PARAM_RATE, -1); + if (err < 0) + return err; + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_TIME, + snd_pcm_hw_rule_mulkdiv, (void*) 1000000, + SNDRV_PCM_HW_PARAM_BUFFER_SIZE, SNDRV_PCM_HW_PARAM_RATE, -1); + if (err < 0) + return err; + return 0; +} + +int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + struct snd_pcm_hardware *hw = &runtime->hw; + int err; + unsigned int mask = 0; + + if (hw->info & SNDRV_PCM_INFO_INTERLEAVED) + mask |= 1 << SNDRV_PCM_ACCESS_RW_INTERLEAVED; + if (hw->info & SNDRV_PCM_INFO_NONINTERLEAVED) + mask |= 1 << SNDRV_PCM_ACCESS_RW_NONINTERLEAVED; + if (hw->info & SNDRV_PCM_INFO_MMAP) { + if (hw->info & SNDRV_PCM_INFO_INTERLEAVED) + mask |= 1 << SNDRV_PCM_ACCESS_MMAP_INTERLEAVED; + if (hw->info & SNDRV_PCM_INFO_NONINTERLEAVED) + mask |= 1 << SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED; + if (hw->info & SNDRV_PCM_INFO_COMPLEX) + mask |= 1 << SNDRV_PCM_ACCESS_MMAP_COMPLEX; + } + err = snd_pcm_hw_constraint_mask(runtime, SNDRV_PCM_HW_PARAM_ACCESS, mask); + if (err < 0) + return err; + + err = snd_pcm_hw_constraint_mask64(runtime, SNDRV_PCM_HW_PARAM_FORMAT, hw->formats); + if (err < 0) + return err; + + err = snd_pcm_hw_constraint_mask(runtime, SNDRV_PCM_HW_PARAM_SUBFORMAT, 1 << SNDRV_PCM_SUBFORMAT_STD); + if (err < 0) + return err; + + err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_CHANNELS, + hw->channels_min, hw->channels_max); + if (err < 0) + return err; + + err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_RATE, + hw->rate_min, hw->rate_max); + if (err < 0) + return err; + + err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, + hw->period_bytes_min, hw->period_bytes_max); + if (err < 0) + return err; + + err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS, + hw->periods_min, hw->periods_max); + if (err < 0) + return err; + + err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, + hw->period_bytes_min, hw->buffer_bytes_max); + if (err < 0) + return err; + + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, + snd_pcm_hw_rule_buffer_bytes_max, substream, + SNDRV_PCM_HW_PARAM_BUFFER_BYTES, -1); + if (err < 0) + return err; + + /* FIXME: remove */ + if (runtime->dma_bytes) { + err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 0, runtime->dma_bytes); + if (err < 0) + return -EINVAL; + } + + if (!(hw->rates & (SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_CONTINUOUS))) { + err = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, + snd_pcm_hw_rule_rate, hw, + SNDRV_PCM_HW_PARAM_RATE, -1); + if (err < 0) + return err; + } + + /* FIXME: this belong to lowlevel */ + snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIOD_SIZE); + + return 0; +} + +static void pcm_release_private(struct snd_pcm_substream *substream) +{ + snd_pcm_unlink(substream); +} + +void snd_pcm_release_substream(struct snd_pcm_substream *substream) +{ + substream->ref_count--; + if (substream->ref_count > 0) + return; + + snd_pcm_drop(substream); + if (substream->hw_opened) { + if (substream->ops->hw_free != NULL) + substream->ops->hw_free(substream); + substream->ops->close(substream); + substream->hw_opened = 0; + } + if (substream->pcm_release) { + substream->pcm_release(substream); + substream->pcm_release = NULL; + } + snd_pcm_detach_substream(substream); +} + +EXPORT_SYMBOL(snd_pcm_release_substream); + +int snd_pcm_open_substream(struct snd_pcm *pcm, int stream, + struct file *file, + struct snd_pcm_substream **rsubstream) +{ + struct snd_pcm_substream *substream; + int err; + + err = snd_pcm_attach_substream(pcm, stream, file, &substream); + if (err < 0) + return err; + if (substream->ref_count > 1) { + *rsubstream = substream; + return 0; + } + + err = snd_pcm_hw_constraints_init(substream); + if (err < 0) { + snd_printd("snd_pcm_hw_constraints_init failed\n"); + goto error; + } + + if ((err = substream->ops->open(substream)) < 0) + goto error; + + substream->hw_opened = 1; + + err = snd_pcm_hw_constraints_complete(substream); + if (err < 0) { + snd_printd("snd_pcm_hw_constraints_complete failed\n"); + goto error; + } + + *rsubstream = substream; + return 0; + + error: + snd_pcm_release_substream(substream); + return err; +} + +EXPORT_SYMBOL(snd_pcm_open_substream); + +static int snd_pcm_open_file(struct file *file, + struct snd_pcm *pcm, + int stream, + struct snd_pcm_file **rpcm_file) +{ + struct snd_pcm_file *pcm_file; + struct snd_pcm_substream *substream; + struct snd_pcm_str *str; + int err; + + if (rpcm_file) + *rpcm_file = NULL; + + err = snd_pcm_open_substream(pcm, stream, file, &substream); + if (err < 0) + return err; + + pcm_file = kzalloc(sizeof(*pcm_file), GFP_KERNEL); + if (pcm_file == NULL) { + snd_pcm_release_substream(substream); + return -ENOMEM; + } + pcm_file->substream = substream; + if (substream->ref_count == 1) { + str = substream->pstr; + substream->file = pcm_file; + substream->pcm_release = pcm_release_private; + } + file->private_data = pcm_file; + if (rpcm_file) + *rpcm_file = pcm_file; + return 0; +} + +static int snd_pcm_playback_open(struct inode *inode, struct file *file) +{ + struct snd_pcm *pcm; + int err = nonseekable_open(inode, file); + if (err < 0) + return err; + pcm = snd_lookup_minor_data(iminor(inode), + SNDRV_DEVICE_TYPE_PCM_PLAYBACK); + return snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_PLAYBACK); +} + +static int snd_pcm_capture_open(struct inode *inode, struct file *file) +{ + struct snd_pcm *pcm; + int err = nonseekable_open(inode, file); + if (err < 0) + return err; + pcm = snd_lookup_minor_data(iminor(inode), + SNDRV_DEVICE_TYPE_PCM_CAPTURE); + return snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_CAPTURE); +} + +static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream) +{ + int err; + struct snd_pcm_file *pcm_file; + wait_queue_t wait; + + if (pcm == NULL) { + err = -ENODEV; + goto __error1; + } + err = snd_card_file_add(pcm->card, file); + if (err < 0) + goto __error1; + if (!try_module_get(pcm->card->module)) { + err = -EFAULT; + goto __error2; + } + init_waitqueue_entry(&wait, current); + add_wait_queue(&pcm->open_wait, &wait); + mutex_lock(&pcm->open_mutex); + while (1) { + err = snd_pcm_open_file(file, pcm, stream, &pcm_file); + if (err >= 0) + break; + if (err == -EAGAIN) { + if (file->f_flags & O_NONBLOCK) { + err = -EBUSY; + break; + } + } else + break; + set_current_state(TASK_INTERRUPTIBLE); + mutex_unlock(&pcm->open_mutex); + schedule(); + mutex_lock(&pcm->open_mutex); + if (signal_pending(current)) { + err = -ERESTARTSYS; + break; + } + } + remove_wait_queue(&pcm->open_wait, &wait); + mutex_unlock(&pcm->open_mutex); + if (err < 0) + goto __error; + return err; + + __error: + module_put(pcm->card->module); + __error2: + snd_card_file_remove(pcm->card, file); + __error1: + return err; +} + +static int snd_pcm_release(struct inode *inode, struct file *file) +{ + struct snd_pcm *pcm; + struct snd_pcm_substream *substream; + struct snd_pcm_file *pcm_file; + + pcm_file = file->private_data; + substream = pcm_file->substream; + if (snd_BUG_ON(!substream)) + return -ENXIO; + pcm = substream->pcm; + mutex_lock(&pcm->open_mutex); + snd_pcm_release_substream(substream); + kfree(pcm_file); + mutex_unlock(&pcm->open_mutex); + wake_up(&pcm->open_wait); + module_put(pcm->card->module); + snd_card_file_remove(pcm->card, file); + return 0; +} + +static snd_pcm_sframes_t snd_pcm_playback_rewind(struct snd_pcm_substream *substream, + snd_pcm_uframes_t frames) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + snd_pcm_sframes_t appl_ptr; + snd_pcm_sframes_t ret; + snd_pcm_sframes_t hw_avail; + + if (frames == 0) + return 0; + + snd_pcm_stream_lock_irq(substream); + switch (runtime->status->state) { + case SNDRV_PCM_STATE_PREPARED: + break; + case SNDRV_PCM_STATE_DRAINING: + case SNDRV_PCM_STATE_RUNNING: + if (snd_pcm_update_hw_ptr(substream) >= 0) + break; + /* Fall through */ + case SNDRV_PCM_STATE_XRUN: + ret = -EPIPE; + goto __end; + case SNDRV_PCM_STATE_SUSPENDED: + ret = -ESTRPIPE; + goto __end; + default: + ret = -EBADFD; + goto __end; + } + + hw_avail = snd_pcm_playback_hw_avail(runtime); + if (hw_avail <= 0) { + ret = 0; + goto __end; + } + if (frames > (snd_pcm_uframes_t)hw_avail) + frames = hw_avail; + appl_ptr = runtime->control->appl_ptr - frames; + if (appl_ptr < 0) + appl_ptr += runtime->boundary; + runtime->control->appl_ptr = appl_ptr; + ret = frames; + __end: + snd_pcm_stream_unlock_irq(substream); + return ret; +} + +static snd_pcm_sframes_t snd_pcm_capture_rewind(struct snd_pcm_substream *substream, + snd_pcm_uframes_t frames) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + snd_pcm_sframes_t appl_ptr; + snd_pcm_sframes_t ret; + snd_pcm_sframes_t hw_avail; + + if (frames == 0) + return 0; + + snd_pcm_stream_lock_irq(substream); + switch (runtime->status->state) { + case SNDRV_PCM_STATE_PREPARED: + case SNDRV_PCM_STATE_DRAINING: + break; + case SNDRV_PCM_STATE_RUNNING: + if (snd_pcm_update_hw_ptr(substream) >= 0) + break; + /* Fall through */ + case SNDRV_PCM_STATE_XRUN: + ret = -EPIPE; + goto __end; + case SNDRV_PCM_STATE_SUSPENDED: + ret = -ESTRPIPE; + goto __end; + default: + ret = -EBADFD; + goto __end; + } + + hw_avail = snd_pcm_capture_hw_avail(runtime); + if (hw_avail <= 0) { + ret = 0; + goto __end; + } + if (frames > (snd_pcm_uframes_t)hw_avail) + frames = hw_avail; + appl_ptr = runtime->control->appl_ptr - frames; + if (appl_ptr < 0) + appl_ptr += runtime->boundary; + runtime->control->appl_ptr = appl_ptr; + ret = frames; + __end: + snd_pcm_stream_unlock_irq(substream); + return ret; +} + +static snd_pcm_sframes_t snd_pcm_playback_forward(struct snd_pcm_substream *substream, + snd_pcm_uframes_t frames) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + snd_pcm_sframes_t appl_ptr; + snd_pcm_sframes_t ret; + snd_pcm_sframes_t avail; + + if (frames == 0) + return 0; + + snd_pcm_stream_lock_irq(substream); + switch (runtime->status->state) { + case SNDRV_PCM_STATE_PREPARED: + case SNDRV_PCM_STATE_PAUSED: + break; + case SNDRV_PCM_STATE_DRAINING: + case SNDRV_PCM_STATE_RUNNING: + if (snd_pcm_update_hw_ptr(substream) >= 0) + break; + /* Fall through */ + case SNDRV_PCM_STATE_XRUN: + ret = -EPIPE; + goto __end; + case SNDRV_PCM_STATE_SUSPENDED: + ret = -ESTRPIPE; + goto __end; + default: + ret = -EBADFD; + goto __end; + } + + avail = snd_pcm_playback_avail(runtime); + if (avail <= 0) { + ret = 0; + goto __end; + } + if (frames > (snd_pcm_uframes_t)avail) + frames = avail; + appl_ptr = runtime->control->appl_ptr + frames; + if (appl_ptr >= (snd_pcm_sframes_t)runtime->boundary) + appl_ptr -= runtime->boundary; + runtime->control->appl_ptr = appl_ptr; + ret = frames; + __end: + snd_pcm_stream_unlock_irq(substream); + return ret; +} + +static snd_pcm_sframes_t snd_pcm_capture_forward(struct snd_pcm_substream *substream, + snd_pcm_uframes_t frames) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + snd_pcm_sframes_t appl_ptr; + snd_pcm_sframes_t ret; + snd_pcm_sframes_t avail; + + if (frames == 0) + return 0; + + snd_pcm_stream_lock_irq(substream); + switch (runtime->status->state) { + case SNDRV_PCM_STATE_PREPARED: + case SNDRV_PCM_STATE_DRAINING: + case SNDRV_PCM_STATE_PAUSED: + break; + case SNDRV_PCM_STATE_RUNNING: + if (snd_pcm_update_hw_ptr(substream) >= 0) + break; + /* Fall through */ + case SNDRV_PCM_STATE_XRUN: + ret = -EPIPE; + goto __end; + case SNDRV_PCM_STATE_SUSPENDED: + ret = -ESTRPIPE; + goto __end; + default: + ret = -EBADFD; + goto __end; + } + + avail = snd_pcm_capture_avail(runtime); + if (avail <= 0) { + ret = 0; + goto __end; + } + if (frames > (snd_pcm_uframes_t)avail) + frames = avail; + appl_ptr = runtime->control->appl_ptr + frames; + if (appl_ptr >= (snd_pcm_sframes_t)runtime->boundary) + appl_ptr -= runtime->boundary; + runtime->control->appl_ptr = appl_ptr; + ret = frames; + __end: + snd_pcm_stream_unlock_irq(substream); + return ret; +} + +static int snd_pcm_hwsync(struct snd_pcm_substream *substream) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + int err; + + snd_pcm_stream_lock_irq(substream); + switch (runtime->status->state) { + case SNDRV_PCM_STATE_DRAINING: + if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) + goto __badfd; + case SNDRV_PCM_STATE_RUNNING: + if ((err = snd_pcm_update_hw_ptr(substream)) < 0) + break; + /* Fall through */ + case SNDRV_PCM_STATE_PREPARED: + case SNDRV_PCM_STATE_SUSPENDED: + err = 0; + break; + case SNDRV_PCM_STATE_XRUN: + err = -EPIPE; + break; + default: + __badfd: + err = -EBADFD; + break; + } + snd_pcm_stream_unlock_irq(substream); + return err; +} + +static int snd_pcm_delay(struct snd_pcm_substream *substream, + snd_pcm_sframes_t __user *res) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + int err; + snd_pcm_sframes_t n = 0; + + //giovanni snd_pcm_stream_lock_irq(substream); + switch (runtime->status->state) { + case SNDRV_PCM_STATE_DRAINING: + if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) + goto __badfd; + case SNDRV_PCM_STATE_RUNNING: + if ((err = snd_pcm_update_hw_ptr(substream)) < 0) + break; + /* Fall through */ + case SNDRV_PCM_STATE_PREPARED: + case SNDRV_PCM_STATE_SUSPENDED: + err = 0; + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + n = snd_pcm_playback_hw_avail(runtime); + else + n = snd_pcm_capture_avail(runtime); + n += runtime->delay; + break; + case SNDRV_PCM_STATE_XRUN: + err = -EPIPE; + break; + default: + __badfd: + err = -EBADFD; + break; + } + //giovanni snd_pcm_stream_unlock_irq(substream); + if (!err) + if (put_user(n, res)) + err = -EFAULT; + return err; +} + +static int snd_pcm_sync_ptr(struct snd_pcm_substream *substream, + struct snd_pcm_sync_ptr __user *_sync_ptr) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + struct snd_pcm_sync_ptr sync_ptr; + volatile struct snd_pcm_mmap_status *status; + volatile struct snd_pcm_mmap_control *control; + int err; + + memset(&sync_ptr, 0, sizeof(sync_ptr)); + if (get_user(sync_ptr.flags, (unsigned __user *)&(_sync_ptr->flags))) + return -EFAULT; + if (copy_from_user(&sync_ptr.c.control, &(_sync_ptr->c.control), sizeof(struct snd_pcm_mmap_control))) + return -EFAULT; + status = runtime->status; + control = runtime->control; + if (sync_ptr.flags & SNDRV_PCM_SYNC_PTR_HWSYNC) { + err = snd_pcm_hwsync(substream); + if (err < 0) + return err; + } + //giovanni snd_pcm_stream_lock_irq(substream); + if (!(sync_ptr.flags & SNDRV_PCM_SYNC_PTR_APPL)) + control->appl_ptr = sync_ptr.c.control.appl_ptr; + else + sync_ptr.c.control.appl_ptr = control->appl_ptr; + if (!(sync_ptr.flags & SNDRV_PCM_SYNC_PTR_AVAIL_MIN)) + control->avail_min = sync_ptr.c.control.avail_min; + else + sync_ptr.c.control.avail_min = control->avail_min; + sync_ptr.s.status.state = status->state; + sync_ptr.s.status.hw_ptr = status->hw_ptr; + sync_ptr.s.status.tstamp = status->tstamp; + sync_ptr.s.status.suspended_state = status->suspended_state; + //giovanni snd_pcm_stream_unlock_irq(substream); + if (copy_to_user(_sync_ptr, &sync_ptr, sizeof(sync_ptr))) + return -EFAULT; + return 0; +} + +static int snd_pcm_tstamp(struct snd_pcm_substream *substream, int __user *_arg) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + int arg; + + if (get_user(arg, _arg)) + return -EFAULT; + if (arg < 0 || arg > SNDRV_PCM_TSTAMP_TYPE_LAST) + return -EINVAL; + runtime->tstamp_type = SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY; + if (arg == SNDRV_PCM_TSTAMP_TYPE_MONOTONIC) + runtime->tstamp_type = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC; + return 0; +} + +static int snd_pcm_common_ioctl1(struct file *file, + struct snd_pcm_substream *substream, + unsigned int cmd, void __user *arg) +{ + switch (cmd) { + case SNDRV_PCM_IOCTL_PVERSION: + return put_user(SNDRV_PCM_VERSION, (int __user *)arg) ? -EFAULT : 0; + case SNDRV_PCM_IOCTL_INFO: + return snd_pcm_info_user(substream, arg); + case SNDRV_PCM_IOCTL_TSTAMP: /* just for compatibility */ + return 0; + case SNDRV_PCM_IOCTL_TTSTAMP: + return snd_pcm_tstamp(substream, arg); + case SNDRV_PCM_IOCTL_HW_REFINE: + return snd_pcm_hw_refine_user(substream, arg); + case SNDRV_PCM_IOCTL_HW_PARAMS: + return snd_pcm_hw_params_user(substream, arg); + case SNDRV_PCM_IOCTL_HW_FREE: + return snd_pcm_hw_free(substream); + case SNDRV_PCM_IOCTL_SW_PARAMS: + return snd_pcm_sw_params_user(substream, arg); + case SNDRV_PCM_IOCTL_STATUS: + return snd_pcm_status_user(substream, arg); + case SNDRV_PCM_IOCTL_CHANNEL_INFO: + return snd_pcm_channel_info_user(substream, arg); + case SNDRV_PCM_IOCTL_PREPARE: + return snd_pcm_prepare(substream, file); + case SNDRV_PCM_IOCTL_RESET: + return snd_pcm_reset(substream); + case SNDRV_PCM_IOCTL_START: + return snd_pcm_action_lock_irq(&snd_pcm_action_start, substream, SNDRV_PCM_STATE_RUNNING); + case SNDRV_PCM_IOCTL_LINK: + return snd_pcm_link(substream, (int)(unsigned long) arg); + case SNDRV_PCM_IOCTL_UNLINK: + return snd_pcm_unlink(substream); + case SNDRV_PCM_IOCTL_RESUME: + return snd_pcm_resume(substream); + case SNDRV_PCM_IOCTL_XRUN: + return snd_pcm_xrun(substream); + case SNDRV_PCM_IOCTL_HWSYNC: + return snd_pcm_hwsync(substream); + case SNDRV_PCM_IOCTL_DELAY: + return snd_pcm_delay(substream, arg); + case SNDRV_PCM_IOCTL_SYNC_PTR: + return snd_pcm_sync_ptr(substream, arg); +#ifdef CONFIG_SND_SUPPORT_OLD_API + case SNDRV_PCM_IOCTL_HW_REFINE_OLD: + return snd_pcm_hw_refine_old_user(substream, arg); + case SNDRV_PCM_IOCTL_HW_PARAMS_OLD: + return snd_pcm_hw_params_old_user(substream, arg); +#endif + case SNDRV_PCM_IOCTL_DRAIN: + return snd_pcm_drain(substream, file); + case SNDRV_PCM_IOCTL_DROP: + return snd_pcm_drop(substream); + case SNDRV_PCM_IOCTL_PAUSE: + { + int res; + snd_pcm_stream_lock_irq(substream); + res = snd_pcm_pause(substream, (int)(unsigned long)arg); + snd_pcm_stream_unlock_irq(substream); + return res; + } + } + snd_printd("unknown ioctl = 0x%x\n", cmd); + return -ENOTTY; +} + +static int snd_pcm_playback_ioctl1(struct file *file, + struct snd_pcm_substream *substream, + unsigned int cmd, void __user *arg) +{ + if (snd_BUG_ON(!substream)) + return -ENXIO; + if (snd_BUG_ON(substream->stream != SNDRV_PCM_STREAM_PLAYBACK)) + return -EINVAL; + switch (cmd) { + case SNDRV_PCM_IOCTL_WRITEI_FRAMES: + { + struct snd_xferi xferi; + struct snd_xferi __user *_xferi = arg; + struct snd_pcm_runtime *runtime = substream->runtime; + snd_pcm_sframes_t result; + if (runtime->status->state == SNDRV_PCM_STATE_OPEN) + return -EBADFD; + if (put_user(0, &_xferi->result)) + return -EFAULT; + if (copy_from_user(&xferi, _xferi, sizeof(xferi))) + return -EFAULT; + result = snd_pcm_lib_write(substream, xferi.buf, xferi.frames); + __put_user(result, &_xferi->result); + return result < 0 ? result : 0; + } + case SNDRV_PCM_IOCTL_WRITEN_FRAMES: + { + struct snd_xfern xfern; + struct snd_xfern __user *_xfern = arg; + struct snd_pcm_runtime *runtime = substream->runtime; + void __user **bufs; + snd_pcm_sframes_t result; + if (runtime->status->state == SNDRV_PCM_STATE_OPEN) + return -EBADFD; + if (runtime->channels > 128) + return -EINVAL; + if (put_user(0, &_xfern->result)) + return -EFAULT; + if (copy_from_user(&xfern, _xfern, sizeof(xfern))) + return -EFAULT; + + bufs = memdup_user(xfern.bufs, + sizeof(void *) * runtime->channels); + if (IS_ERR(bufs)) + return PTR_ERR(bufs); + result = snd_pcm_lib_writev(substream, bufs, xfern.frames); + kfree(bufs); + __put_user(result, &_xfern->result); + return result < 0 ? result : 0; + } + case SNDRV_PCM_IOCTL_REWIND: + { + snd_pcm_uframes_t frames; + snd_pcm_uframes_t __user *_frames = arg; + snd_pcm_sframes_t result; + if (get_user(frames, _frames)) + return -EFAULT; + if (put_user(0, _frames)) + return -EFAULT; + result = snd_pcm_playback_rewind(substream, frames); + __put_user(result, _frames); + return result < 0 ? result : 0; + } + case SNDRV_PCM_IOCTL_FORWARD: + { + snd_pcm_uframes_t frames; + snd_pcm_uframes_t __user *_frames = arg; + snd_pcm_sframes_t result; + if (get_user(frames, _frames)) + return -EFAULT; + if (put_user(0, _frames)) + return -EFAULT; + result = snd_pcm_playback_forward(substream, frames); + __put_user(result, _frames); + return result < 0 ? result : 0; + } + } + return snd_pcm_common_ioctl1(file, substream, cmd, arg); +} + +static int snd_pcm_capture_ioctl1(struct file *file, + struct snd_pcm_substream *substream, + unsigned int cmd, void __user *arg) +{ + if (snd_BUG_ON(!substream)) + return -ENXIO; + if (snd_BUG_ON(substream->stream != SNDRV_PCM_STREAM_CAPTURE)) + return -EINVAL; + switch (cmd) { + case SNDRV_PCM_IOCTL_READI_FRAMES: + { + struct snd_xferi xferi; + struct snd_xferi __user *_xferi = arg; + struct snd_pcm_runtime *runtime = substream->runtime; + snd_pcm_sframes_t result; + if (runtime->status->state == SNDRV_PCM_STATE_OPEN) + return -EBADFD; + if (put_user(0, &_xferi->result)) + return -EFAULT; + if (copy_from_user(&xferi, _xferi, sizeof(xferi))) + return -EFAULT; + result = snd_pcm_lib_read(substream, xferi.buf, xferi.frames); + __put_user(result, &_xferi->result); + return result < 0 ? result : 0; + } + case SNDRV_PCM_IOCTL_READN_FRAMES: + { + struct snd_xfern xfern; + struct snd_xfern __user *_xfern = arg; + struct snd_pcm_runtime *runtime = substream->runtime; + void *bufs; + snd_pcm_sframes_t result; + if (runtime->status->state == SNDRV_PCM_STATE_OPEN) + return -EBADFD; + if (runtime->channels > 128) + return -EINVAL; + if (put_user(0, &_xfern->result)) + return -EFAULT; + if (copy_from_user(&xfern, _xfern, sizeof(xfern))) + return -EFAULT; + + bufs = memdup_user(xfern.bufs, + sizeof(void *) * runtime->channels); + if (IS_ERR(bufs)) + return PTR_ERR(bufs); + result = snd_pcm_lib_readv(substream, bufs, xfern.frames); + kfree(bufs); + __put_user(result, &_xfern->result); + return result < 0 ? result : 0; + } + case SNDRV_PCM_IOCTL_REWIND: + { + snd_pcm_uframes_t frames; + snd_pcm_uframes_t __user *_frames = arg; + snd_pcm_sframes_t result; + if (get_user(frames, _frames)) + return -EFAULT; + if (put_user(0, _frames)) + return -EFAULT; + result = snd_pcm_capture_rewind(substream, frames); + __put_user(result, _frames); + return result < 0 ? result : 0; + } + case SNDRV_PCM_IOCTL_FORWARD: + { + snd_pcm_uframes_t frames; + snd_pcm_uframes_t __user *_frames = arg; + snd_pcm_sframes_t result; + if (get_user(frames, _frames)) + return -EFAULT; + if (put_user(0, _frames)) + return -EFAULT; + result = snd_pcm_capture_forward(substream, frames); + __put_user(result, _frames); + return result < 0 ? result : 0; + } + } + return snd_pcm_common_ioctl1(file, substream, cmd, arg); +} + +static long snd_pcm_playback_ioctl(struct file *file, unsigned int cmd, + unsigned long arg) +{ + struct snd_pcm_file *pcm_file; + + pcm_file = file->private_data; + + if (((cmd >> 8) & 0xff) != 'A') + return -ENOTTY; + + return snd_pcm_playback_ioctl1(file, pcm_file->substream, cmd, + (void __user *)arg); +} + +static long snd_pcm_capture_ioctl(struct file *file, unsigned int cmd, + unsigned long arg) +{ + struct snd_pcm_file *pcm_file; + + pcm_file = file->private_data; + + if (((cmd >> 8) & 0xff) != 'A') + return -ENOTTY; + + return snd_pcm_capture_ioctl1(file, pcm_file->substream, cmd, + (void __user *)arg); +} + +int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream, + unsigned int cmd, void *arg) +{ + mm_segment_t fs; + int result; + + fs = snd_enter_user(); + switch (substream->stream) { + case SNDRV_PCM_STREAM_PLAYBACK: + result = snd_pcm_playback_ioctl1(NULL, substream, cmd, + (void __user *)arg); + break; + case SNDRV_PCM_STREAM_CAPTURE: + result = snd_pcm_capture_ioctl1(NULL, substream, cmd, + (void __user *)arg); + break; + default: + result = -EINVAL; + break; + } + snd_leave_user(fs); + return result; +} + +EXPORT_SYMBOL(snd_pcm_kernel_ioctl); + +static ssize_t snd_pcm_read(struct file *file, char __user *buf, size_t count, + loff_t * offset) +{ + struct snd_pcm_file *pcm_file; + struct snd_pcm_substream *substream; + struct snd_pcm_runtime *runtime; + snd_pcm_sframes_t result; + + pcm_file = file->private_data; + substream = pcm_file->substream; + if (PCM_RUNTIME_CHECK(substream)) + return -ENXIO; + runtime = substream->runtime; + if (runtime->status->state == SNDRV_PCM_STATE_OPEN) + return -EBADFD; + if (!frame_aligned(runtime, count)) + return -EINVAL; + count = bytes_to_frames(runtime, count); + result = snd_pcm_lib_read(substream, buf, count); + if (result > 0) + result = frames_to_bytes(runtime, result); + return result; +} + +static ssize_t snd_pcm_write(struct file *file, const char __user *buf, + size_t count, loff_t * offset) +{ + struct snd_pcm_file *pcm_file; + struct snd_pcm_substream *substream; + struct snd_pcm_runtime *runtime; + snd_pcm_sframes_t result; + + pcm_file = file->private_data; + substream = pcm_file->substream; + if (PCM_RUNTIME_CHECK(substream)) + return -ENXIO; + runtime = substream->runtime; + if (runtime->status->state == SNDRV_PCM_STATE_OPEN) + return -EBADFD; + if (!frame_aligned(runtime, count)) + return -EINVAL; + count = bytes_to_frames(runtime, count); + result = snd_pcm_lib_write(substream, buf, count); + if (result > 0) + result = frames_to_bytes(runtime, result); + return result; +} + +static ssize_t snd_pcm_aio_read(struct kiocb *iocb, const struct iovec *iov, + unsigned long nr_segs, loff_t pos) + +{ + struct snd_pcm_file *pcm_file; + struct snd_pcm_substream *substream; + struct snd_pcm_runtime *runtime; + snd_pcm_sframes_t result; + unsigned long i; + void __user **bufs; + snd_pcm_uframes_t frames; + + pcm_file = iocb->ki_filp->private_data; + substream = pcm_file->substream; + if (PCM_RUNTIME_CHECK(substream)) + return -ENXIO; + runtime = substream->runtime; + if (runtime->status->state == SNDRV_PCM_STATE_OPEN) + return -EBADFD; + if (nr_segs > 1024 || nr_segs != runtime->channels) + return -EINVAL; + if (!frame_aligned(runtime, iov->iov_len)) + return -EINVAL; + frames = bytes_to_samples(runtime, iov->iov_len); + bufs = kmalloc(sizeof(void *) * nr_segs, GFP_KERNEL); + if (bufs == NULL) + return -ENOMEM; + for (i = 0; i < nr_segs; ++i) + bufs[i] = iov[i].iov_base; + result = snd_pcm_lib_readv(substream, bufs, frames); + if (result > 0) + result = frames_to_bytes(runtime, result); + kfree(bufs); + return result; +} + +static ssize_t snd_pcm_aio_write(struct kiocb *iocb, const struct iovec *iov, + unsigned long nr_segs, loff_t pos) +{ + struct snd_pcm_file *pcm_file; + struct snd_pcm_substream *substream; + struct snd_pcm_runtime *runtime; + snd_pcm_sframes_t result; + unsigned long i; + void __user **bufs; + snd_pcm_uframes_t frames; + + pcm_file = iocb->ki_filp->private_data; + substream = pcm_file->substream; + if (PCM_RUNTIME_CHECK(substream)) + return -ENXIO; + runtime = substream->runtime; + if (runtime->status->state == SNDRV_PCM_STATE_OPEN) + return -EBADFD; + if (nr_segs > 128 || nr_segs != runtime->channels || + !frame_aligned(runtime, iov->iov_len)) + return -EINVAL; + frames = bytes_to_samples(runtime, iov->iov_len); + bufs = kmalloc(sizeof(void *) * nr_segs, GFP_KERNEL); + if (bufs == NULL) + return -ENOMEM; + for (i = 0; i < nr_segs; ++i) + bufs[i] = iov[i].iov_base; + result = snd_pcm_lib_writev(substream, bufs, frames); + if (result > 0) + result = frames_to_bytes(runtime, result); + kfree(bufs); + return result; +} + +static unsigned int snd_pcm_playback_poll(struct file *file, poll_table * wait) +{ + struct snd_pcm_file *pcm_file; + struct snd_pcm_substream *substream; + struct snd_pcm_runtime *runtime; + unsigned int mask; + snd_pcm_uframes_t avail; + + pcm_file = file->private_data; + + substream = pcm_file->substream; + if (PCM_RUNTIME_CHECK(substream)) + return -ENXIO; + runtime = substream->runtime; + + poll_wait(file, &runtime->sleep, wait); + + //giovanni snd_pcm_stream_lock_irq(substream); + avail = snd_pcm_playback_avail(runtime); + switch (runtime->status->state) { + case SNDRV_PCM_STATE_RUNNING: + case SNDRV_PCM_STATE_PREPARED: + case SNDRV_PCM_STATE_PAUSED: + if (avail >= runtime->control->avail_min) { + mask = POLLOUT | POLLWRNORM; + break; + } + /* Fall through */ + case SNDRV_PCM_STATE_DRAINING: + mask = 0; + break; + default: + mask = POLLOUT | POLLWRNORM | POLLERR; + break; + } + //giovanni snd_pcm_stream_unlock_irq(substream); + return mask; +} + +static unsigned int snd_pcm_capture_poll(struct file *file, poll_table * wait) +{ + struct snd_pcm_file *pcm_file; + struct snd_pcm_substream *substream; + struct snd_pcm_runtime *runtime; + unsigned int mask; + snd_pcm_uframes_t avail; + + pcm_file = file->private_data; + + substream = pcm_file->substream; + if (PCM_RUNTIME_CHECK(substream)) + return -ENXIO; + runtime = substream->runtime; + + poll_wait(file, &runtime->sleep, wait); + + //giovanni snd_pcm_stream_lock_irq(substream); + avail = snd_pcm_capture_avail(runtime); + switch (runtime->status->state) { + case SNDRV_PCM_STATE_RUNNING: + case SNDRV_PCM_STATE_PREPARED: + case SNDRV_PCM_STATE_PAUSED: + if (avail >= runtime->control->avail_min) { + mask = POLLIN | POLLRDNORM; + break; + } + mask = 0; + break; + case SNDRV_PCM_STATE_DRAINING: + if (avail > 0) { + mask = POLLIN | POLLRDNORM; + break; + } + /* Fall through */ + default: + mask = POLLIN | POLLRDNORM | POLLERR; + break; + } + //giovanni snd_pcm_stream_unlock_irq(substream); + return mask; +} + +/* + * mmap support + */ + +/* + * Only on coherent architectures, we can mmap the status and the control records + * for effcient data transfer. On others, we have to use HWSYNC ioctl... + */ +#if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_ALPHA) +/* + * mmap status record + */ +static int snd_pcm_mmap_status_fault(struct vm_area_struct *area, + struct vm_fault *vmf) +{ + struct snd_pcm_substream *substream = area->vm_private_data; + struct snd_pcm_runtime *runtime; + + if (substream == NULL) + return VM_FAULT_SIGBUS; + runtime = substream->runtime; + vmf->page = virt_to_page(runtime->status); + get_page(vmf->page); + return 0; +} + +static const struct vm_operations_struct snd_pcm_vm_ops_status = +{ + .fault = snd_pcm_mmap_status_fault, +}; + +static int snd_pcm_mmap_status(struct snd_pcm_substream *substream, struct file *file, + struct vm_area_struct *area) +{ + struct snd_pcm_runtime *runtime; + long size; + if (!(area->vm_flags & VM_READ)) + return -EINVAL; + runtime = substream->runtime; + size = area->vm_end - area->vm_start; + if (size != PAGE_ALIGN(sizeof(struct snd_pcm_mmap_status))) + return -EINVAL; + area->vm_ops = &snd_pcm_vm_ops_status; + area->vm_private_data = substream; + area->vm_flags |= VM_RESERVED; + return 0; +} + +/* + * mmap control record + */ +static int snd_pcm_mmap_control_fault(struct vm_area_struct *area, + struct vm_fault *vmf) +{ + struct snd_pcm_substream *substream = area->vm_private_data; + struct snd_pcm_runtime *runtime; + + if (substream == NULL) + return VM_FAULT_SIGBUS; + runtime = substream->runtime; + vmf->page = virt_to_page(runtime->control); + get_page(vmf->page); + return 0; +} + +static const struct vm_operations_struct snd_pcm_vm_ops_control = +{ + .fault = snd_pcm_mmap_control_fault, +}; + +static int snd_pcm_mmap_control(struct snd_pcm_substream *substream, struct file *file, + struct vm_area_struct *area) +{ + struct snd_pcm_runtime *runtime; + long size; + if (!(area->vm_flags & VM_READ)) + return -EINVAL; + runtime = substream->runtime; + size = area->vm_end - area->vm_start; + if (size != PAGE_ALIGN(sizeof(struct snd_pcm_mmap_control))) + return -EINVAL; + area->vm_ops = &snd_pcm_vm_ops_control; + area->vm_private_data = substream; + area->vm_flags |= VM_RESERVED; + return 0; +} +#else /* ! coherent mmap */ +/* + * don't support mmap for status and control records. + */ +static int snd_pcm_mmap_status(struct snd_pcm_substream *substream, struct file *file, + struct vm_area_struct *area) +{ + return -ENXIO; +} +static int snd_pcm_mmap_control(struct snd_pcm_substream *substream, struct file *file, + struct vm_area_struct *area) +{ + return -ENXIO; +} +#endif /* coherent mmap */ + +static inline struct page * +snd_pcm_default_page_ops(struct snd_pcm_substream *substream, unsigned long ofs) +{ + void *vaddr = substream->runtime->dma_area + ofs; +#if defined(CONFIG_MIPS) && defined(CONFIG_DMA_NONCOHERENT) + if (substream->dma_buffer.dev.type == SNDRV_DMA_TYPE_DEV) + return virt_to_page(CAC_ADDR(vaddr)); +#endif +#if defined(CONFIG_PPC32) && defined(CONFIG_NOT_COHERENT_CACHE) + if (substream->dma_buffer.dev.type == SNDRV_DMA_TYPE_DEV) { + dma_addr_t addr = substream->runtime->dma_addr + ofs; + addr -= get_dma_offset(substream->dma_buffer.dev.dev); + /* assume dma_handle set via pfn_to_phys() in + * mm/dma-noncoherent.c + */ + return pfn_to_page(addr >> PAGE_SHIFT); + } +#endif + return virt_to_page(vaddr); +} + +/* + * fault callback for mmapping a RAM page + */ +static int snd_pcm_mmap_data_fault(struct vm_area_struct *area, + struct vm_fault *vmf) +{ + struct snd_pcm_substream *substream = area->vm_private_data; + struct snd_pcm_runtime *runtime; + unsigned long offset; + struct page * page; + size_t dma_bytes; + + if (substream == NULL) + return VM_FAULT_SIGBUS; + runtime = substream->runtime; + offset = vmf->pgoff << PAGE_SHIFT; + dma_bytes = PAGE_ALIGN(runtime->dma_bytes); + if (offset > dma_bytes - PAGE_SIZE) + return VM_FAULT_SIGBUS; + if (substream->ops->page) + page = substream->ops->page(substream, offset); + else + page = snd_pcm_default_page_ops(substream, offset); + if (!page) + return VM_FAULT_SIGBUS; + get_page(page); + vmf->page = page; + return 0; +} + +static const struct vm_operations_struct snd_pcm_vm_ops_data = { + .open = snd_pcm_mmap_data_open, + .close = snd_pcm_mmap_data_close, +}; + +static const struct vm_operations_struct snd_pcm_vm_ops_data_fault = { + .open = snd_pcm_mmap_data_open, + .close = snd_pcm_mmap_data_close, + .fault = snd_pcm_mmap_data_fault, +}; + +#ifndef ARCH_HAS_DMA_MMAP_COHERENT +/* This should be defined / handled globally! */ +#ifdef CONFIG_ARM +#define ARCH_HAS_DMA_MMAP_COHERENT +#endif +#endif + +/* + * mmap the DMA buffer on RAM + */ +static int snd_pcm_default_mmap(struct snd_pcm_substream *substream, + struct vm_area_struct *area) +{ + area->vm_flags |= VM_RESERVED; +#ifdef ARCH_HAS_DMA_MMAP_COHERENT + if (!substream->ops->page && + substream->dma_buffer.dev.type == SNDRV_DMA_TYPE_DEV) + return dma_mmap_coherent(substream->dma_buffer.dev.dev, + area, + substream->runtime->dma_area, + substream->runtime->dma_addr, + area->vm_end - area->vm_start); +#endif /* ARCH_HAS_DMA_MMAP_COHERENT */ + /* mmap with fault handler */ + area->vm_ops = &snd_pcm_vm_ops_data_fault; + return 0; +} + +/* + * mmap the DMA buffer on I/O memory area + */ +#if SNDRV_PCM_INFO_MMAP_IOMEM +int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream, + struct vm_area_struct *area) +{ + long size; + unsigned long offset; + + area->vm_page_prot = pgprot_noncached(area->vm_page_prot); + area->vm_flags |= VM_IO; + size = area->vm_end - area->vm_start; + offset = area->vm_pgoff << PAGE_SHIFT; + if (io_remap_pfn_range(area, area->vm_start, + (substream->runtime->dma_addr + offset) >> PAGE_SHIFT, + size, area->vm_page_prot)) + return -EAGAIN; + return 0; +} + +EXPORT_SYMBOL(snd_pcm_lib_mmap_iomem); +#endif /* SNDRV_PCM_INFO_MMAP */ + +/* mmap callback with pgprot_noncached */ +int snd_pcm_lib_mmap_noncached(struct snd_pcm_substream *substream, + struct vm_area_struct *area) +{ + area->vm_page_prot = pgprot_noncached(area->vm_page_prot); + return snd_pcm_default_mmap(substream, area); +} +EXPORT_SYMBOL(snd_pcm_lib_mmap_noncached); + +/* + * mmap DMA buffer + */ +int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file, + struct vm_area_struct *area) +{ + struct snd_pcm_runtime *runtime; + long size; + unsigned long offset; + size_t dma_bytes; + int err; + + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + if (!(area->vm_flags & (VM_WRITE|VM_READ))) + return -EINVAL; + } else { + if (!(area->vm_flags & VM_READ)) + return -EINVAL; + } + runtime = substream->runtime; + if (runtime->status->state == SNDRV_PCM_STATE_OPEN) + return -EBADFD; + if (!(runtime->info & SNDRV_PCM_INFO_MMAP)) + return -ENXIO; + if (runtime->access == SNDRV_PCM_ACCESS_RW_INTERLEAVED || + runtime->access == SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) + return -EINVAL; + size = area->vm_end - area->vm_start; + offset = area->vm_pgoff << PAGE_SHIFT; + dma_bytes = PAGE_ALIGN(runtime->dma_bytes); + if ((size_t)size > dma_bytes) + return -EINVAL; + if (offset > dma_bytes - size) + return -EINVAL; + + area->vm_ops = &snd_pcm_vm_ops_data; + area->vm_private_data = substream; + if (substream->ops->mmap) + err = substream->ops->mmap(substream, area); + else + err = snd_pcm_default_mmap(substream, area); + if (!err) + atomic_inc(&substream->mmap_count); + return err; +} + +EXPORT_SYMBOL(snd_pcm_mmap_data); + +static int snd_pcm_mmap(struct file *file, struct vm_area_struct *area) +{ + struct snd_pcm_file * pcm_file; + struct snd_pcm_substream *substream; + unsigned long offset; + + pcm_file = file->private_data; + substream = pcm_file->substream; + if (PCM_RUNTIME_CHECK(substream)) + return -ENXIO; + + offset = area->vm_pgoff << PAGE_SHIFT; + switch (offset) { + case SNDRV_PCM_MMAP_OFFSET_STATUS: + if (pcm_file->no_compat_mmap) + return -ENXIO; + return snd_pcm_mmap_status(substream, file, area); + case SNDRV_PCM_MMAP_OFFSET_CONTROL: + if (pcm_file->no_compat_mmap) + return -ENXIO; + return snd_pcm_mmap_control(substream, file, area); + default: + return snd_pcm_mmap_data(substream, file, area); + } + return 0; +} + +static int snd_pcm_fasync(int fd, struct file * file, int on) +{ + struct snd_pcm_file * pcm_file; + struct snd_pcm_substream *substream; + struct snd_pcm_runtime *runtime; + + pcm_file = file->private_data; + substream = pcm_file->substream; + if (PCM_RUNTIME_CHECK(substream)) + return -ENXIO; + runtime = substream->runtime; + return fasync_helper(fd, file, on, &runtime->fasync); +} + +/* + * ioctl32 compat + */ +#ifdef CONFIG_COMPAT +#include "pcm_compat.c" +#else +#define snd_pcm_ioctl_compat NULL +#endif + +/* + * To be removed helpers to keep binary compatibility + */ + +#ifdef CONFIG_SND_SUPPORT_OLD_API +#define __OLD_TO_NEW_MASK(x) ((x&7)|((x&0x07fffff8)<<5)) +#define __NEW_TO_OLD_MASK(x) ((x&7)|((x&0xffffff00)>>5)) + +static void snd_pcm_hw_convert_from_old_params(struct snd_pcm_hw_params *params, + struct snd_pcm_hw_params_old *oparams) +{ + unsigned int i; + + memset(params, 0, sizeof(*params)); + params->flags = oparams->flags; + for (i = 0; i < ARRAY_SIZE(oparams->masks); i++) + params->masks[i].bits[0] = oparams->masks[i]; + memcpy(params->intervals, oparams->intervals, sizeof(oparams->intervals)); + params->rmask = __OLD_TO_NEW_MASK(oparams->rmask); + params->cmask = __OLD_TO_NEW_MASK(oparams->cmask); + params->info = oparams->info; + params->msbits = oparams->msbits; + params->rate_num = oparams->rate_num; + params->rate_den = oparams->rate_den; + params->fifo_size = oparams->fifo_size; +} + +static void snd_pcm_hw_convert_to_old_params(struct snd_pcm_hw_params_old *oparams, + struct snd_pcm_hw_params *params) +{ + unsigned int i; + + memset(oparams, 0, sizeof(*oparams)); + oparams->flags = params->flags; + for (i = 0; i < ARRAY_SIZE(oparams->masks); i++) + oparams->masks[i] = params->masks[i].bits[0]; + memcpy(oparams->intervals, params->intervals, sizeof(oparams->intervals)); + oparams->rmask = __NEW_TO_OLD_MASK(params->rmask); + oparams->cmask = __NEW_TO_OLD_MASK(params->cmask); + oparams->info = params->info; + oparams->msbits = params->msbits; + oparams->rate_num = params->rate_num; + oparams->rate_den = params->rate_den; + oparams->fifo_size = params->fifo_size; +} + +static int snd_pcm_hw_refine_old_user(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params_old __user * _oparams) +{ + struct snd_pcm_hw_params *params; + struct snd_pcm_hw_params_old *oparams = NULL; + int err; + + params = kmalloc(sizeof(*params), GFP_KERNEL); + if (!params) + return -ENOMEM; + + oparams = memdup_user(_oparams, sizeof(*oparams)); + if (IS_ERR(oparams)) { + err = PTR_ERR(oparams); + goto out; + } + snd_pcm_hw_convert_from_old_params(params, oparams); + err = snd_pcm_hw_refine(substream, params); + snd_pcm_hw_convert_to_old_params(oparams, params); + if (copy_to_user(_oparams, oparams, sizeof(*oparams))) { + if (!err) + err = -EFAULT; + } + + kfree(oparams); +out: + kfree(params); + return err; +} + +static int snd_pcm_hw_params_old_user(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params_old __user * _oparams) +{ + struct snd_pcm_hw_params *params; + struct snd_pcm_hw_params_old *oparams = NULL; + int err; + + params = kmalloc(sizeof(*params), GFP_KERNEL); + if (!params) + return -ENOMEM; + + oparams = memdup_user(_oparams, sizeof(*oparams)); + if (IS_ERR(oparams)) { + err = PTR_ERR(oparams); + goto out; + } + snd_pcm_hw_convert_from_old_params(params, oparams); + err = snd_pcm_hw_params(substream, params); + snd_pcm_hw_convert_to_old_params(oparams, params); + if (copy_to_user(_oparams, oparams, sizeof(*oparams))) { + if (!err) + err = -EFAULT; + } + + kfree(oparams); +out: + kfree(params); + return err; +} +#endif /* CONFIG_SND_SUPPORT_OLD_API */ + +#ifndef CONFIG_MMU +static unsigned long snd_pcm_get_unmapped_area(struct file *file, + unsigned long addr, + unsigned long len, + unsigned long pgoff, + unsigned long flags) +{ + struct snd_pcm_file *pcm_file = file->private_data; + struct snd_pcm_substream *substream = pcm_file->substream; + struct snd_pcm_runtime *runtime = substream->runtime; + unsigned long offset = pgoff << PAGE_SHIFT; + + switch (offset) { + case SNDRV_PCM_MMAP_OFFSET_STATUS: + return (unsigned long)runtime->status; + case SNDRV_PCM_MMAP_OFFSET_CONTROL: + return (unsigned long)runtime->control; + default: + return (unsigned long)runtime->dma_area + offset; + } +} +#else +# define snd_pcm_get_unmapped_area NULL +#endif + +/* + * Register section + */ + +const struct file_operations snd_pcm_f_ops[2] = { + { + .owner = THIS_MODULE, + .write = snd_pcm_write, + .aio_write = snd_pcm_aio_write, + .open = snd_pcm_playback_open, + .release = snd_pcm_release, + .llseek = no_llseek, + .poll = snd_pcm_playback_poll, + .unlocked_ioctl = snd_pcm_playback_ioctl, + .compat_ioctl = snd_pcm_ioctl_compat, + .mmap = snd_pcm_mmap, + .fasync = snd_pcm_fasync, + .get_unmapped_area = snd_pcm_get_unmapped_area, + }, + { + .owner = THIS_MODULE, + .read = snd_pcm_read, + .aio_read = snd_pcm_aio_read, + .open = snd_pcm_capture_open, + .release = snd_pcm_release, + .llseek = no_llseek, + .poll = snd_pcm_capture_poll, + .unlocked_ioctl = snd_pcm_capture_ioctl, + .compat_ioctl = snd_pcm_ioctl_compat, + .mmap = snd_pcm_mmap, + .fasync = snd_pcm_fasync, + .get_unmapped_area = snd_pcm_get_unmapped_area, + } +}; diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index 496e05c..5c61ee6 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -177,7 +177,7 @@ int skypopen_signaling_read(private_t *tech_pvt) if (tech_pvt->silent_mode) { DEBUGA_SKYPE("Resetting SILENT_MODE on skype_call: %s.\n", SKYPOPEN_P_LOG, id); skypopen_signaling_write(tech_pvt, "SET SILENT_MODE ON"); - switch_sleep(1000); + //switch_sleep(1000); } } if (!strcasecmp(message, "ERROR 68")) { @@ -403,13 +403,13 @@ int skypopen_signaling_read(private_t *tech_pvt) tech_pvt->chatmessages[i].type, tech_pvt->chatmessages[i].id); sprintf(msg_to_skype, "GET CHATMESSAGE %s CHATNAME", id); skypopen_signaling_write(tech_pvt, msg_to_skype); - skypopen_sleep(1000); + //skypopen_sleep(1000); sprintf(msg_to_skype, "GET CHATMESSAGE %s FROM_HANDLE", id); skypopen_signaling_write(tech_pvt, msg_to_skype); - skypopen_sleep(1000); + //skypopen_sleep(1000); sprintf(msg_to_skype, "GET CHATMESSAGE %s FROM_DISPNAME", id); skypopen_signaling_write(tech_pvt, msg_to_skype); - skypopen_sleep(1000); + //skypopen_sleep(1000); sprintf(msg_to_skype, "GET CHATMESSAGE %s BODY", id); skypopen_signaling_write(tech_pvt, msg_to_skype); } @@ -576,7 +576,7 @@ int skypopen_signaling_read(private_t *tech_pvt) skypopen_signaling_write(tech_pvt, msg_to_skype); sprintf(msg_to_skype, "ALTER CALL %s HANGUP", id); skypopen_signaling_write(tech_pvt, msg_to_skype); - skypopen_sleep(10000); + //skypopen_sleep(10000); } if (!strcasecmp(prop, "STATUS")) { @@ -592,10 +592,10 @@ int skypopen_signaling_read(private_t *tech_pvt) SKYPOPEN_P_LOG, id); sprintf(msg_to_skype, "GET CALL %s PARTNER_DISPNAME", id); skypopen_signaling_write(tech_pvt, msg_to_skype); - skypopen_sleep(100); + //skypopen_sleep(100); sprintf(msg_to_skype, "GET CALL %s PARTNER_HANDLE", id); skypopen_signaling_write(tech_pvt, msg_to_skype); - skypopen_sleep(10000); + //skypopen_sleep(10000); } else { /* we are inside an active call */ if (!strcasecmp(tech_pvt->skype_call_id, id)) { @@ -630,7 +630,7 @@ int skypopen_signaling_read(private_t *tech_pvt) SKYPOPEN_P_LOG, id); sprintf(msg_to_skype, "GET CALL %s PARTNER_HANDLE", id); skypopen_signaling_write(tech_pvt, msg_to_skype); - skypopen_sleep(10000); + //skypopen_sleep(10000); } } } else if (!strcasecmp(value, "EARLYMEDIA")) { @@ -645,10 +645,10 @@ int skypopen_signaling_read(private_t *tech_pvt) return CALLFLOW_INCOMING_HANGUP; } } - skypopen_sleep(1000); + //skypopen_sleep(1000); sprintf(msg_to_skype, "ALTER CALL %s SET_INPUT PORT=\"%d\"", id, tech_pvt->tcp_cli_port); skypopen_signaling_write(tech_pvt, msg_to_skype); - skypopen_sleep(1000); + //skypopen_sleep(1000); sprintf(msg_to_skype, "#output ALTER CALL %s SET_OUTPUT PORT=\"%d\"", id, tech_pvt->tcp_srv_port); skypopen_signaling_write(tech_pvt, msg_to_skype); @@ -732,10 +732,10 @@ int skypopen_signaling_read(private_t *tech_pvt) return CALLFLOW_INCOMING_HANGUP; } } - skypopen_sleep(1000); + //skypopen_sleep(1000); sprintf(msg_to_skype, "ALTER CALL %s SET_INPUT PORT=\"%d\"", id, tech_pvt->tcp_cli_port); skypopen_signaling_write(tech_pvt, msg_to_skype); - skypopen_sleep(1000); + //skypopen_sleep(1000); sprintf(msg_to_skype, "#output ALTER CALL %s SET_OUTPUT PORT=\"%d\"", id, tech_pvt->tcp_srv_port); skypopen_signaling_write(tech_pvt, msg_to_skype); } @@ -769,7 +769,7 @@ int skypopen_signaling_read(private_t *tech_pvt) skypopen_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1); tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; tech_pvt->skype_call_id[0] = '\0'; - skypopen_sleep(1000); + //skypopen_sleep(1000); return CALLFLOW_INCOMING_HANGUP; } else if (!strcasecmp(value, "WAITING_REDIAL_COMMAND")) { tech_pvt->skype_callflow = CALLFLOW_STATUS_FAILED; @@ -779,7 +779,7 @@ int skypopen_signaling_read(private_t *tech_pvt) skypopen_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1); tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; tech_pvt->skype_call_id[0] = '\0'; - skypopen_sleep(1000); + //skypopen_sleep(1000); return CALLFLOW_INCOMING_HANGUP; } else { WARNINGA("skype_call: %s, STATUS: %s is not recognized\n", SKYPOPEN_P_LOG, id, value); @@ -1566,8 +1566,8 @@ int skypopen_send_message(private_t *tech_pvt, const char *message_P) unsigned int len = strlen(message_P); XEvent e; - skypopen_sleep(1000); - XFlush(disp); + //skypopen_sleep(1000); + //XFlush(disp); memset(&e, 0, sizeof(e)); e.xclient.type = ClientMessage; @@ -1868,7 +1868,7 @@ void *skypopen_do_skypeapi_thread_func(void *obj) case ClientMessage: if (an_event.xclient.format != 8) { - skypopen_sleep(1000); //0.1 msec + //skypopen_sleep(1000); //0.1 msec break; } @@ -1924,17 +1924,18 @@ void *skypopen_do_skypeapi_thread_func(void *obj) howmany = strlen(b) + 1; howmany = write(SkypopenHandles->fdesc[1], b, howmany); memset(buffer, '\0', 17000); - XFlush(disp); + //XFlush(disp); there_were_continues = 0; } - skypopen_sleep(1000); //0.1 msec + //skypopen_sleep(1000); //0.1 msec break; default: - skypopen_sleep(1000); //0.1 msec + //skypopen_sleep(1000); //0.1 msec break; } //switch event.type } //while XPending + XFlush(disp); } // if select } //while running commit df52cc09524e6a24e7fe72c2bac784e2b9f534c7 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Nov 2 17:58:24 2010 -0500 fix registration overlap timeout snafu diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index ec0a895..8a93851 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Mon May 31 09:47:08 EDT 2010 +Tue Nov 2 17:57:25 CDT 2010 diff --git a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c index 40ee1f8..abe7e68 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c +++ b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c @@ -8660,6 +8660,10 @@ void outgoing_destroy(nta_outgoing_t *orq) orq->orq_destroyed = 1; orq->orq_callback = outgoing_default_cb; orq->orq_magic = NULL; + + if (orq->orq_method != sip_method_invite && + orq->orq_method != sip_method_ack) + outgoing_terminate(orq); } /** @internal Outgoing transaction timer routine. diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 0cd3b38..6a9e4ce 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -343,6 +343,7 @@ typedef enum { REG_STATE_FAIL_WAIT, REG_STATE_EXPIRED, REG_STATE_NOREG, + REG_STATE_TIMEOUT, REG_STATE_LAST } reg_state_t; diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 2f5fb5a..2614bd6 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -369,11 +369,24 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now) user_via = NULL; break; + case REG_STATE_TIMEOUT: + { + nua_handle_t *nh = gateway_ptr->nh; + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Timeout Registering %s\n", gateway_ptr->name); + + gateway_ptr->nh = NULL; + nua_handle_destroy(nh); + gateway_ptr->state = REG_STATE_FAILED; + gateway_ptr->failures++; + gateway_ptr->failure_status = 908; + } + break; case REG_STATE_FAILED: { int sec; - if (gateway_ptr->failure_status == 503) { + if (gateway_ptr->failure_status == 503 || gateway_ptr->failure_status == 908) { sec = gateway_ptr->retry_seconds; } else { sec = gateway_ptr->retry_seconds * (gateway_ptr->failures + 1); @@ -384,8 +397,8 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now) gateway_ptr->state = REG_STATE_FAIL_WAIT; gateway_ptr->failure_status = 0; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s Failed Registration, setting retry to %d seconds.\n", - gateway_ptr->name, sec); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s Failed Registration [%d], setting retry to %d seconds.\n", + gateway_ptr->name, gateway_ptr->failure_status, sec); } break; @@ -396,7 +409,7 @@ void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now) break; case REG_STATE_TRYING: if (!gateway_ptr->retry || now >= gateway_ptr->retry) { - gateway_ptr->state = REG_STATE_FAILED; + gateway_ptr->state = REG_STATE_TIMEOUT; } break; default: commit 97d80d924a2cbad347453a066e7b602fd122a050 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Nov 2 11:50:04 2010 -0500 same as last one in another place diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 5f6747b..3c17903 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -4092,8 +4092,9 @@ static int notify_callback(void *pArg, int argc, char **argv, char **columnNames char *es = argv[5]; char *body = argv[6]; char *id = NULL; - char *p, *contact; - + char *contact; + sofia_destination_t *dst = NULL; + char *route_uri = NULL; if (profile_name && strcasecmp(profile_name, profile->name)) { if ((ext_profile = sofia_glue_find_profile(profile_name))) { @@ -4105,16 +4106,24 @@ static int notify_callback(void *pArg, int argc, char **argv, char **columnNames switch_assert(id); contact = sofia_glue_get_url_from_contact(contact_in, 1); - if ((p = strstr(contact, ";fs_"))) { - *p = '\0'; - } - nh = nua_handle(profile->nua, NULL, NUTAG_URL(contact), SIPTAG_FROM_STR(id), SIPTAG_TO_STR(id), SIPTAG_CONTACT_STR(profile->url), TAG_END()); + dst = sofia_glue_get_destination((char *) contact); + + if (dst->route_uri) { + route_uri = sofia_glue_strip_uri(dst->route_uri); + } + nh = nua_handle(profile->nua, NULL, NUTAG_URL(dst->contact), SIPTAG_FROM_STR(id), SIPTAG_TO_STR(id), SIPTAG_CONTACT_STR(profile->url), TAG_END()); + nua_handle_bind(nh, &mod_sofia_globals.destroy_private); - nua_notify(nh, NUTAG_NEWSUB(1), SIPTAG_EVENT_STR(es), SIPTAG_CONTENT_TYPE_STR(ct), TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)), TAG_END()); + nua_notify(nh, NUTAG_NEWSUB(1), + TAG_IF(dst->route_uri, NUTAG_PROXY(route_uri)), TAG_IF(dst->route, SIPTAG_ROUTE_STR(dst->route)), + SIPTAG_EVENT_STR(es), SIPTAG_CONTENT_TYPE_STR(ct), TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)), TAG_END()); + + switch_safe_free(route_uri); + sofia_glue_free_destination(dst); free(id); free(contact); @@ -4199,7 +4208,7 @@ static void general_event_handler(switch_event_t *event) nua_notify(nh, NUTAG_NEWSUB(1), NUTAG_WITH_THIS(profile->nua), - TAG_IF(dst->route_uri, NUTAG_PROXY(route_uri)), TAG_IF(dst->route, SIPTAG_ROUTE_STR(dst->route)), + TAG_IF(dst->route_uri, NUTAG_PROXY(dst->contact)), TAG_IF(dst->route, SIPTAG_ROUTE_STR(dst->route)), SIPTAG_EVENT_STR(es), TAG_IF(ct, SIPTAG_CONTENT_TYPE_STR(ct)), TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)), TAG_END()); commit 2a1efb288fe33d5915ddb8f467a8208880371172 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Tue Nov 2 13:40:27 2010 -0200 freetdm: added missing sleep to ftmod_r2, which is now running fine diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 1314adf..637188f 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -1288,8 +1288,9 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) } } - /* figure out what event to poll each channel for. POLLIN|POLLOUT for channels that has a call being - * setup, POLLPRI otherwise */ + /* figure out what event to poll each channel for. POLLPRI when the channel is down, + * POLLPRI|POLLIN|POLLOUT otherwise. + */ memset(poll_events, 0, sizeof(short)*span->chan_count); for (i = 0; i < span->chan_count; i++) { r2chan = R2CALL(span->channels[(i+1)])->r2chan; @@ -1365,9 +1366,8 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) } } else if (status != FTDM_TIMEOUT) { ftdm_log(FTDM_LOG_ERROR, "ftdm_span_poll_event returned %d.\n", status); - } else { } - + ftdm_sleep(20); } for (i = 1; i <= span->chan_count; i++) { commit f3ae4d10d78b08a4e1a2e25844251b7f41481f8f Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Tue Nov 2 02:19:18 2010 -0500 skypopen: callflow display reshuffle diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index ef21c20..83c409c 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -113,13 +113,13 @@ char *interface_status[] = { /* should match SKYPOPEN_STATE_xxx in skypopen.h */ "DEAD" }; char *skype_callflow[] = { /* should match CALLFLOW_XXX in skypopen.h */ - "CALL_IDLE", - "CALL_DOWN", - "INCOMING_RNG", + "IDLE", + "DOWN", + "INC_RNG", "CALL_DIALING", "CALL_LINEBUSY", "CALL_ACTIVE", - "INCOMING_HNG", + "INC_HNG", "CALL_RLEASD", "CALL_NOCARR", "CALL_INFLUX", @@ -129,17 +129,17 @@ char *skype_callflow[] = { /* should match CALLFLOW_XXX in skypopen.h */ "CALL_OUTRESTR", "CALL_SECFAIL", "CALL_NOANSWER", - "STATUS_FNSHED", - "STATUS_CANCLED", - "STATUS_FAILED", - "STATUS_REFUSED", - "STATUS_RINGING", - "STATUS_INPROGRS", - "STATUS_UNPLACD", - "STATUS_ROUTING", - "STATUS_EARLYMD", - "INCOMING_CLID", - "STATUS_RMTEHOLD" + "FNSHED", + "CANCLED", + "FAILED", + "REFUSED", + "RINGING", + "INPROGRS", + "UNPLACD", + "ROUTING", + "EARLYMD", + "INC_CLID", + "RMTEHOLD" }; commit 039e4297ac2447029221be27a2e25b05ea9f7c89 Merge: dcb416e 9078142 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Mon Nov 1 23:11:42 2010 -0200 Merge branch 'master' into ftmod_r2 commit dcb416e4fbe60d7e2f3a50ca3362747644c29ec5 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Mon Nov 1 23:08:43 2010 -0200 freetdm: ftmod_r2 non threaded working diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 3ad4393..b7b8e04 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -2007,6 +2007,7 @@ static FIO_SIGNAL_CB_FUNCTION(on_r2_signal) break; case FTDM_SIGEVENT_PROGRESS: + case FTDM_SIGEVENT_PROGRESS_MEDIA: { if ((session = ftdm_channel_get_session(sigmsg->channel, 0))) { channel = switch_core_session_get_channel(session); diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 53d00d1..1314adf 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -255,7 +255,6 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(r2_outgoing_call) { openr2_call_status_t callstatus; ftdm_r2_data_t *r2data; - int safety = 100; r2data = ftdmchan->span->signal_data; @@ -281,24 +280,6 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(r2_outgoing_call) return FTDM_FAIL; } - /* this waiting for flag cleared function releases the ftdmchan lock to give a chance to the monitor thread - * to process openr2 events and dial out, or see if an incoming call is arriving just now, then openr2 will - * call in the monitor thread the on_call_collision or on_call_acknowledged callbacks where this flag - * will be cleared, the lock will be re-acquired here and we continue within this function to inform the user - * whether the call is being placed or collision occurred and another channel must be hunted */ - ftdm_set_flag(R2CALL(ftdmchan), FTDM_R2_WAITING_ACK); - while (safety-- && ftdm_test_flag(R2CALL(ftdmchan), FTDM_R2_WAITING_ACK)) { - ftdm_mutex_unlock(ftdmchan->mutex); - ftdm_sleep(10); - ftdm_mutex_lock(ftdmchan->mutex); - } - - if (ftdm_test_flag(R2CALL(ftdmchan), FTDM_R2_WAITING_ACK)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Waiting ack flag was never cleared!\n"); - ftdm_clear_flag(R2CALL(ftdmchan), FTDM_R2_WAITING_ACK); - return FTDM_FAIL; - } - if (ftdmchan->state != FTDM_CHANNEL_STATE_DIALING) { ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Collision after call attempt, try another channel, new state = %s\n", ftdm_channel_state2str(ftdmchan->state)); @@ -306,7 +287,6 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(r2_outgoing_call) return FTDM_BREAK; } - /* non-threaded implementation, we're done here */ ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "R2 call placed in non-threaded mode\n"); return FTDM_SUCCESS; @@ -329,29 +309,6 @@ static ftdm_status_t ftdm_r2_stop(ftdm_span_t *span) return FTDM_SUCCESS; } -#if 0 -static ftdm_status_t ftdm_r2_sig_write(ftdm_channel_t *ftdmchan, void *data, ftdm_size_t size) -{ - ftdm_r2_call_t *r2call = R2CALL(ftdmchan); - openr2_chan_t *r2chan = r2call->r2chan; - if (openr2_chan_get_read_enabled(r2chan) && !ftdm_test_flag(r2call, FTDM_R2_PROCESSING)) { - if (r2call->txdrops < 10) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "dropping user write because there is R2 processing\n"); - } else if (r2call->txdrops == 10) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "too may drops, not logging any more\n"); - } - r2call->txdrops++; - return FTDM_BREAK; - } - if (!openr2_chan_get_read_enabled(r2chan)) { - ftdm_mutex_lock(ftdmchan->mutex); - //openr2_chan_process_output(r2chan, data, size); - ftdm_mutex_unlock(ftdmchan->mutex); - } - return FTDM_SUCCESS; -} -#endif - static ftdm_status_t ftdm_r2_sig_read(ftdm_channel_t *ftdmchan, void *data, ftdm_size_t size) { openr2_chan_t *r2chan = R2CALL(ftdmchan)->r2chan; @@ -688,24 +645,6 @@ static void ftdm_r2_on_ani_digit_received(openr2_chan_t *r2chan, char digit) R2CALL(ftdmchan)->ani_index = collected_len; } -/* XXX missing on openr2 XXX */ -#if 0 -static void ftdm_r2_on_call_collision(openr2_chan_t *r2chan) -{ - ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Call collision detected, outgoing call attempt failed, state = %s\n", ftdm_channel_state2str(ftdmchan->state)); - ftdm_clear_flag(R2CALL(ftdmchan), FTDM_R2_WAITING_ACK); - ftdm_channel_close(&ftdmchan); -} - -static void ftdm_r2_on_call_acknowledged(openr2_chan_t *r2chan) -{ - ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Outgoing call proceeding\n"); - ftdm_clear_flag(R2CALL(ftdmchan), FTDM_R2_WAITING_ACK); -} -#endif - static openr2_event_interface_t ftdm_r2_event_iface = { .on_call_init = ftdm_r2_on_call_init, .on_call_offered = ftdm_r2_on_call_offered, @@ -725,12 +664,6 @@ static openr2_event_interface_t ftdm_r2_event_iface = { .on_ani_digit_received = ftdm_r2_on_ani_digit_received, /* so far we do nothing with billing pulses */ .on_billing_pulse_received = NULL, - - /* XXX these two events are missing on openr2 XXX */ -#if 0 - .on_call_collision = ftdm_r2_on_call_collision, - .on_call_acknowledged = ftdm_r2_on_call_acknowledged, -#endif }; static int ftdm_r2_io_set_cas(openr2_chan_t *r2chan, int cas) @@ -853,22 +786,6 @@ static int ftdm_r2_io_get_oob_event(openr2_chan_t *r2chan, openr2_oob_event_t *e *event = 0; ftdm_log(FTDM_LOG_ERROR, "I should not be called (I/O get oob event)!!\n"); return 0; - -#if 0 - ftdm_status_t status; - ftdm_event_t *fevent = NULL; - ftdm_channel_t *ftdmchan = openr2_chan_get_fd(r2chan); - *event = OR2_OOB_EVENT_NONE; - status = ftdm_channel_read_event(ftdmchan, &fevent); - if (status != FTDM_SUCCESS) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "failed to retrieve freetdm event!\n"); - return -1; - } - if (fevent->e_type == FTDM_EVENT_OOB && fevent->enum_id == FTDM_OOB_CAS_BITS_CHANGE) { - *event = OR2_OOB_EVENT_CAS_CHANGE; - } - return 0; -#endif } static openr2_io_interface_t ftdm_r2_io_iface = { @@ -1411,8 +1328,10 @@ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) } } - /* XXX when ftdm_span_poll_event() returns FTDM_SUCCESS, means there are events pending on the span, - * is it possible to know on what channel there were events, without traversing the span? XXX + /* XXX + * when ftdm_span_poll_event() returns FTDM_SUCCESS, means there are events pending on the span. + * is it possible to know on which channels those events are pending, without trasvering the span? + * XXX */ for (i = 1; i <= span->chan_count; i++) { r2chan = R2CALL(span->channels[i])->r2chan; @@ -1627,13 +1546,6 @@ static FIO_API_FUNCTION(ftdm_r2_api) char rxavg_str[25]; char txavg_str[25]; r2chan = R2CALL(span->channels[i])->r2chan; -#if 0 - openr2_chan_get_stats(r2chan, &stats); - snprintf(rx_str, sizeof(rx_str), "%lu", stats.rxcount); - snprintf(tx_str, sizeof(tx_str), "%lu", stats.txcount); - snprintf(rxavg_str, sizeof(rxavg_str), "%u", stats.rxavg); - snprintf(txavg_str, sizeof(txavg_str), "%u", stats.txavg); -#endif stream->write_function(stream, "%4d %-12.12s %-12.12s %6s %6s %6s %6s\n", span->channels[i]->chan_id, openr2_chan_get_tx_cas_string(r2chan), commit 04f9b8c6f483408314c320558bb5bdddd0bad513 Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Mon Nov 1 19:11:43 2010 -0500 skypopen: very nice formatted debug output (ok, I go get a life) diff --git a/src/mod/endpoints/mod_skypopen/skypopen.h b/src/mod/endpoints/mod_skypopen/skypopen.h index f256202..f24eacb 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen.h +++ b/src/mod/endpoints/mod_skypopen/skypopen.h @@ -103,14 +103,14 @@ typedef enum { GFLAG_MY_CODEC_PREFS = (1 << 0) } GFLAGS; -#define DEBUGA_SKYPE(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%-*s ["SKYPOPEN_SVN_VERSION "]\t [DEBUG_SKYPE %-5d][%-15s][%s,%s] " __VA_ARGS__ ); -#define DEBUGA_CALL(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%-*s ["SKYPOPEN_SVN_VERSION "]\t [DEBUG_CALL %-5d][%-15s][%s,%s] " __VA_ARGS__ ); -#define DEBUGA_PBX(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%-*s ["SKYPOPEN_SVN_VERSION "]\t [DEBUG_PBX %-5d][%-15s][%s,%s] " __VA_ARGS__ ); -#define ERRORA(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%-*s ["SKYPOPEN_SVN_VERSION "]\t [ERRORA %-5d][%-15s][%s,%s] " __VA_ARGS__ ); -#define WARNINGA(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%-*s["SKYPOPEN_SVN_VERSION "]\t [WARNINGA %-5d][%-15s][%s,%s] " __VA_ARGS__ ); -#define NOTICA(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "%-*s ["SKYPOPEN_SVN_VERSION "]\t [NOTICA %-5d][%-15s][%s,%s] " __VA_ARGS__ ); - -#define SKYPOPEN_P_LOG (int)((25 - (strlen(__FILE__))) + ((__LINE__ - 1000) < 0)), " ", __LINE__, tech_pvt ? tech_pvt->name ? tech_pvt->name : "none" : "none", tech_pvt ? interface_status[tech_pvt->interface_state] : "N/A", tech_pvt ? skype_callflow[tech_pvt->skype_callflow] : "N/A" +#define DEBUGA_SKYPE(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%-*s ["SKYPOPEN_SVN_VERSION "] [DEBUG_SKYPE %-5d][%-15s][%s,%s] " __VA_ARGS__ ); +#define DEBUGA_CALL(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%-*s ["SKYPOPEN_SVN_VERSION "] [DEBUG_CALL %-5d][%-15s][%s,%s] " __VA_ARGS__ ); +#define DEBUGA_PBX(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%-*s ["SKYPOPEN_SVN_VERSION "] [DEBUG_PBX %-5d][%-15s][%s,%s] " __VA_ARGS__ ); +#define ERRORA(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%-*s ["SKYPOPEN_SVN_VERSION "] [ERRORA %-5d][%-15s][%s,%s] " __VA_ARGS__ ); +#define WARNINGA(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%-*s["SKYPOPEN_SVN_VERSION "] [WARNINGA %-5d][%-15s][%s,%s] " __VA_ARGS__ ); +#define NOTICA(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "%-*s ["SKYPOPEN_SVN_VERSION "] [NOTICA %-5d][%-15s][%s,%s] " __VA_ARGS__ ); + +#define SKYPOPEN_P_LOG (int)((20 - (strlen(__FILE__))) + ((__LINE__ - 1000) < 0) + ((__LINE__ - 100) < 0)), " ", __LINE__, tech_pvt ? tech_pvt->name ? tech_pvt->name : "none" : "none", tech_pvt ? interface_status[tech_pvt->interface_state] : "N/A", tech_pvt ? skype_callflow[tech_pvt->skype_callflow] : "N/A" /*********************************/ #define SKYPOPEN_CAUSE_NORMAL 1 commit 35676e7e0461b0d9bb82c9b6021e04cb54c3d6aa Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Nov 1 18:46:59 2010 -0500 parse static route in sip uri in notify by event diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 577887b..5f6747b 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -4175,21 +4175,37 @@ static void general_event_handler(switch_event_t *event) if (to_uri && from_uri && ct && es && profile_name && (profile = sofia_glue_find_profile(profile_name))) { - nua_handle_t *nh = nua_handle(profile->nua, - NULL, - NUTAG_URL(to_uri), - SIPTAG_FROM_STR(from_uri), - SIPTAG_TO_STR(to_uri), - SIPTAG_CONTACT_STR(profile->url), - TAG_END()); + sofia_destination_t *dst = NULL; + nua_handle_t *nh; + char *route_uri = NULL; - nua_handle_bind(nh, &mod_sofia_globals.destroy_private); + dst = sofia_glue_get_destination((char *) to_uri); + + if (dst->route_uri) { + route_uri = sofia_glue_strip_uri(dst->route_uri); + } + + + nh = nua_handle(profile->nua, + NULL, + NUTAG_URL(to_uri), + SIPTAG_FROM_STR(from_uri), + SIPTAG_TO_STR(to_uri), + SIPTAG_CONTACT_STR(profile->url), + TAG_END()); + nua_handle_bind(nh, &mod_sofia_globals.destroy_private); + nua_notify(nh, NUTAG_NEWSUB(1), NUTAG_WITH_THIS(profile->nua), + TAG_IF(dst->route_uri, NUTAG_PROXY(route_uri)), TAG_IF(dst->route, SIPTAG_ROUTE_STR(dst->route)), SIPTAG_EVENT_STR(es), TAG_IF(ct, SIPTAG_CONTENT_TYPE_STR(ct)), TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)), TAG_END()); + + switch_safe_free(route_uri); + sofia_glue_free_destination(dst); + sofia_glue_release_profile(profile); } commit 78f05aef773384a1afb9c6d017a37b6bf67a603d Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Nov 1 18:46:26 2010 -0500 disable status bar in .screenrc diff --git a/support-d/.screenrc b/support-d/.screenrc index 927df86..f04baa0 100644 --- a/support-d/.screenrc +++ b/support-d/.screenrc @@ -1,3 +1,4 @@ +hardstatus alwaysignore startup_message off escape ^\b defscrollback 8000 commit cda952083fa6fa3bbdd90a20b062f1ddf9f97e65 Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Mon Nov 1 18:48:28 2010 -0500 skypopen: nice formatted debug output (I feel so stupid when I use one full hour for things like this, but I like it ;) ) diff --git a/src/mod/endpoints/mod_skypopen/skypopen.h b/src/mod/endpoints/mod_skypopen/skypopen.h index 90f5df0..f256202 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen.h +++ b/src/mod/endpoints/mod_skypopen/skypopen.h @@ -103,14 +103,14 @@ typedef enum { GFLAG_MY_CODEC_PREFS = (1 << 0) } GFLAGS; -#define DEBUGA_SKYPE(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "rev "SKYPOPEN_SVN_VERSION "[%p|%-7lx][DEBUG_SKYPE %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ ); -#define DEBUGA_CALL(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "rev "SKYPOPEN_SVN_VERSION "[%p|%-7lx][DEBUG_CALL %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ ); -#define DEBUGA_PBX(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "rev "SKYPOPEN_SVN_VERSION "[%p|%-7lx][DEBUG_PBX %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ ); -#define ERRORA(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "rev "SKYPOPEN_SVN_VERSION "[%p|%-7lx][ERRORA %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ ); -#define WARNINGA(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "rev "SKYPOPEN_SVN_VERSION "[%p|%-7lx][WARNINGA %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ ); -#define NOTICA(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "rev "SKYPOPEN_SVN_VERSION "[%p|%-7lx][NOTICA %-5d][%-10s][%2d,%2d,%2d] " __VA_ARGS__ ); - -#define SKYPOPEN_P_LOG NULL, (unsigned long)55, __LINE__, tech_pvt ? tech_pvt->name ? tech_pvt->name : "none" : "none", -1, tech_pvt ? tech_pvt->interface_state : -1, tech_pvt ? tech_pvt->skype_callflow : -1 +#define DEBUGA_SKYPE(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%-*s ["SKYPOPEN_SVN_VERSION "]\t [DEBUG_SKYPE %-5d][%-15s][%s,%s] " __VA_ARGS__ ); +#define DEBUGA_CALL(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%-*s ["SKYPOPEN_SVN_VERSION "]\t [DEBUG_CALL %-5d][%-15s][%s,%s] " __VA_ARGS__ ); +#define DEBUGA_PBX(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%-*s ["SKYPOPEN_SVN_VERSION "]\t [DEBUG_PBX %-5d][%-15s][%s,%s] " __VA_ARGS__ ); +#define ERRORA(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%-*s ["SKYPOPEN_SVN_VERSION "]\t [ERRORA %-5d][%-15s][%s,%s] " __VA_ARGS__ ); +#define WARNINGA(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%-*s["SKYPOPEN_SVN_VERSION "]\t [WARNINGA %-5d][%-15s][%s,%s] " __VA_ARGS__ ); +#define NOTICA(...) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "%-*s ["SKYPOPEN_SVN_VERSION "]\t [NOTICA %-5d][%-15s][%s,%s] " __VA_ARGS__ ); + +#define SKYPOPEN_P_LOG (int)((25 - (strlen(__FILE__))) + ((__LINE__ - 1000) < 0)), " ", __LINE__, tech_pvt ? tech_pvt->name ? tech_pvt->name : "none" : "none", tech_pvt ? interface_status[tech_pvt->interface_state] : "N/A", tech_pvt ? skype_callflow[tech_pvt->skype_callflow] : "N/A" /*********************************/ #define SKYPOPEN_CAUSE_NORMAL 1 diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index 8bd5d09..496e05c 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -15,6 +15,8 @@ extern switch_endpoint_interface_t *skypopen_endpoint_interface; int samplerate_skypopen = SAMPLERATE_SKYPOPEN; extern int running; +extern char *interface_status[]; +extern char *skype_callflow[]; /*************************************/ /* suspicious globals FIXME */ commit 5f91e46914359248f62c25f7cb427ec279b2e0f5 Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Mon Nov 1 16:41:23 2010 -0500 skypopen: modifying Makefile.am and skypopen.h to report in revision tag of debug lines the last commit of both mod_skypopen.c and skypopen_protocol.c (so you can have your own commits in the same dir) diff --git a/src/mod/endpoints/mod_skypopen/Makefile.am b/src/mod/endpoints/mod_skypopen/Makefile.am index 56d5a82..b572b58 100644 --- a/src/mod/endpoints/mod_skypopen/Makefile.am +++ b/src/mod/endpoints/mod_skypopen/Makefile.am @@ -2,6 +2,6 @@ include $(top_srcdir)/build/modmake.rulesam MODNAME=mod_skypopen mod_LTLIBRARIES = mod_skypopen.la mod_skypopen_la_SOURCES = mod_skypopen.c skypopen_protocol.c -mod_skypopen_la_CFLAGS = $(AM_CFLAGS) -DSKYPOPEN_SVN_VERSION=\"`git log -1 --format="%h" .`\" -I../../../../libs/spandsp/src -I../../../..//libs/tiff-3.8.2/libtiff +mod_skypopen_la_CFLAGS = $(AM_CFLAGS) -DSKYPOPEN_C_VER=\"`git log -1 --format="%h" skypopen_protocol.c`\" -DMODSKYPOPEN_C_VER=\"`git log -1 --format="%h" mod_skypopen.c`\" -I../../../../libs/spandsp/src -I../../../..//libs/tiff-3.8.2/libtiff mod_skypopen_la_LIBADD = $(switch_builddir)/libfreeswitch.la mod_skypopen_la_LDFLAGS = -L../../../../libs/spandsp/src -avoid-version -module -no-undefined -shared -lX11 -lspandsp diff --git a/src/mod/endpoints/mod_skypopen/skypopen.h b/src/mod/endpoints/mod_skypopen/skypopen.h index ccff65b..90f5df0 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen.h +++ b/src/mod/endpoints/mod_skypopen/skypopen.h @@ -77,6 +77,12 @@ #define SAMPLERATE_SKYPOPEN 16000 #define SAMPLES_PER_FRAME SAMPLERATE_SKYPOPEN/50 +#ifdef SKYPOPEN_C_VER +#ifdef MODSKYPOPEN_C_VER +#define SKYPOPEN_SVN_VERSION MODSKYPOPEN_C_VER"|"SKYPOPEN_C_VER +#endif +#endif + #ifndef SKYPOPEN_SVN_VERSION #define SKYPOPEN_SVN_VERSION SWITCH_VERSION_REVISION #endif /* SKYPOPEN_SVN_VERSION */ commit faa16369057de24ace0c3c9ae4135514c0c35ec4 Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Mon Nov 1 16:14:05 2010 -0500 skypopen: modifying Makefile.am to report on last commit in skypopen directory diff --git a/src/mod/endpoints/mod_skypopen/Makefile.am b/src/mod/endpoints/mod_skypopen/Makefile.am index d696fae..56d5a82 100644 --- a/src/mod/endpoints/mod_skypopen/Makefile.am +++ b/src/mod/endpoints/mod_skypopen/Makefile.am @@ -2,6 +2,6 @@ include $(top_srcdir)/build/modmake.rulesam MODNAME=mod_skypopen mod_LTLIBRARIES = mod_skypopen.la mod_skypopen_la_SOURCES = mod_skypopen.c skypopen_protocol.c -mod_skypopen_la_CFLAGS = $(AM_CFLAGS) -DSKYPOPEN_SVN_VERSION=\"`git describe`\" -I../../../../libs/spandsp/src -I../../../..//libs/tiff-3.8.2/libtiff +mod_skypopen_la_CFLAGS = $(AM_CFLAGS) -DSKYPOPEN_SVN_VERSION=\"`git log -1 --format="%h" .`\" -I../../../../libs/spandsp/src -I../../../..//libs/tiff-3.8.2/libtiff mod_skypopen_la_LIBADD = $(switch_builddir)/libfreeswitch.la mod_skypopen_la_LDFLAGS = -L../../../../libs/spandsp/src -avoid-version -module -no-undefined -shared -lX11 -lspandsp commit 454c238e584f3c5204c9fce3689b50ae81abcd90 Merge: cc1e833 7ac78ac Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Mon Nov 1 20:39:47 2010 +0100 Merge branch 'master' of ssh://git.freeswitch.org/freeswitch commit 7ac78ac21a9ae91461258cb15647e83fb275c162 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Nov 1 10:25:47 2010 -0500 FS-2811 diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 4646473..6c43f25 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -3483,6 +3483,12 @@ SWITCH_STANDARD_API(show_function) char hostname[256] = ""; gethostname(hostname, sizeof(hostname)); + + if (!(cflags & SCF_USE_SQL)) { + stream->write_function(stream, "-ERR SQL DISABLED NO DATA AVAILABLE!\n"); + return SWITCH_STATUS_SUCCESS; + } + if (switch_core_db_handle(&db) != SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "%s", "-ERR Databse Error!\n"); return SWITCH_STATUS_SUCCESS; @@ -3515,11 +3521,6 @@ SWITCH_STANDARD_API(show_function) holder.print_title = 1; - if (!(cflags & SCF_USE_SQL) && command && !strcasecmp(command, "channels")) { - stream->write_function(stream, "-ERR SQL DISABLED NO CHANNEL DATA AVAILABLE!\n"); - goto end; - } - /* If you change the field qty or order of any of these select */ /* statements, you must also change show_callback and friends to match! */ if (!command) { diff --git a/src/switch_console.c b/src/switch_console.c index 9f13823..fdfb09b 100644 --- a/src/switch_console.c +++ b/src/switch_console.c @@ -238,9 +238,14 @@ SWITCH_DECLARE(char *) switch_console_expand_alias(char *cmd, char *arg) char *sql = NULL; char *exp = NULL; switch_cache_db_handle_t *db = NULL; + switch_core_flag_t cflags = switch_core_flags(); int full = 0; + if (!(cflags & SCF_USE_SQL)) { + return NULL; + } + if (switch_core_db_handle(&db) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database Error\n"); return NULL; diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index a85766c..9551e5d 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -1590,6 +1590,8 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_ top: + if (!sql_manager.manage) goto skip; + /* Activate SQL database */ if (switch_core_db_handle(&dbh) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB!\n"); @@ -1707,6 +1709,7 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_ switch_cache_db_execute_sql(dbh, "create index channels1 on channels(hostname)", NULL); switch_cache_db_execute_sql(dbh, "create index calls1 on calls(hostname)", NULL); + skip: if (sql_manager.manage) { if (switch_event_bind_removable("core_db", SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, @@ -1729,7 +1732,7 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_ switch_yield(10000); } - switch_cache_db_release_db_handle(&dbh); + if (sql_manager.manage) switch_cache_db_release_db_handle(&dbh); return SWITCH_STATUS_SUCCESS; } commit 1970ec1d816102d3b67a97a2e1d9ed9013b576dc Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Nov 1 10:03:10 2010 -0500 FS-2810 diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 1811616..fbd270d 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -392,11 +392,6 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32 } } - if (!tech_pvt->rm_encoding && (b_sdp = switch_channel_get_variable(tech_pvt->channel, SWITCH_B_SDP_VARIABLE))) { - sofia_glue_sdp_map(b_sdp, &map, &ptmap); - } - - if (fmtp_out_var) { fmtp_out = fmtp_out_var; } @@ -435,6 +430,10 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32 return; } + if (!tech_pvt->rm_encoding && (b_sdp = switch_channel_get_variable(tech_pvt->channel, SWITCH_B_SDP_VARIABLE))) { + sofia_glue_sdp_map(b_sdp, &map, &ptmap); + } + if (!sr) { if ((var_val = switch_channel_get_variable(tech_pvt->channel, "media_audio_mode"))) { sr = var_val; commit cc1e83397b38d23b4c9b0128993e1a3820f02998 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Mon Nov 1 02:13:27 2010 +0100 FreeTDM: Buildsystem cleanup - Use tabs instead of spaces for indentation - Proper m4 quoting of parameters - Fix broken AC_ARG_* handling: --without-foo/--disable-foo set withval="no"/enableval="no" and the third parameter of the AC_ARG_* macros is always "user provided an --with*-foo/--*able-foo option" _NOT_ "yes", while the fourth parameter is "user didn't provide this option" (= the default if neither --with-foo/--enable-foo nor --without-foo/--disable-foo has been set) - Drop FTDM_CFLAGS in MY_CFLAGS (what was that used for anyway?) - Drop MYLIB - Drop SOLINK (unused) - Rename MY_CFLAGS to FTDM_CFLAGS - Rename all AM_CONDITION variables to HAVE_* for (optional) dependencies and WANT_* for features - Reorder mod_LTLIBRARIES lines - Move some things in configure.ac around to group them - Add -shared to modules LDFLAGS (we don't need "ftmod_foo.a" static modules, do we?) - Import ax_compiler_vendor.m4, drop the macro definition from configure.ac - Add AUTOMAKE_OPTS to Makefile.am and define FreeTDM as a foreign (= non-GNU) project - Add ACLOCAL_FLAGS to Makefile.am and set AC_CONFIG_MACRO_DIR in configure.ac custom m4 macros are kept in the build subdirectory - Enable silent rules for automake-1.11 and newer (use make V=1 to get verbose output) - configure option --with-modinstdir requires a value now and quits with an error message if called without one (e.g. "./configure --without-modinstdir" or "./configure --with-modinstdir") - Add configuration summary screen and category headers for modules in configure output diff --git a/libs/freetdm/Makefile.am b/libs/freetdm/Makefile.am index 33e287f..2177a96 100644 --- a/libs/freetdm/Makefile.am +++ b/libs/freetdm/Makefile.am @@ -29,29 +29,33 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -PREFIX = $(prefix) -SRC = src +ACLOCAL_AMFLAGS = -I build +AUTOMAKE_OPTIONS = foreign + +SRC = src moddir = @modinstdir@ libdir = @libdir@ -library_includedir = $(PREFIX)/include +library_includedir = $(prefix)/include + +INCS = -I$(FT_SRCDIR)/$(SRC)/include -I$(FT_SRCDIR)/$(SRC)/include/private +INCS += -I$(FT_SRCDIR)/$(SRC)/ftmod/ftmod_sangoma_boost -INCS = -I$(FT_SRCDIR)/$(SRC)/include -I$(FT_SRCDIR)/$(SRC)/isdn/include -I$(FT_SRCDIR)/$(SRC)/include/private -INCS += -I$(FT_SRCDIR)/$(SRC)/ftmod/ftmod_sangoma_boost -if SNGSS7 -INCS += -I/usr/include/sng_ss7/ +if HAVE_SNG_SS7 +INCS += -I/usr/include/sng_ss7 endif -if SNGISDN -INCS += -I/usr/include/sng_isdn/ + +if HAVE_SNG_ISDN +INCS += -I/usr/include/sng_isdn endif -MY_CFLAGS = $(INCS) $(FTDM_CFLAGS) -DFTDM_CONFIG_DIR=\"@confdir@\" -DFTDM_MOD_DIR=\"$(moddir)\" @COMP_VENDOR_CFLAGS@ @DEFS@ -COMPILE = $(CC) $(MY_CFLAGS) $(INCS) +FTDM_CFLAGS = $(INCS) -DFTDM_CONFIG_DIR=\"@confdir@\" -DFTDM_MOD_DIR=\"$(moddir)\" @COMP_VENDOR_CFLAGS@ @DEFS@ +COMPILE = $(CC) $(FTDM_CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(COMPILE) -LINK = $(LIBTOOL) --mode=link --tag=CC $(CC) $(MY_CFLAGS) $(LDFLAGS) -o $@ +LINK = $(LIBTOOL) --mode=link --tag=CC $(CC) $(FTDM_CFLAGS) $(LDFLAGS) -o $@ -if DEBUGDTMF -MY_CFLAGS += -DFTDM_DEBUG_DTMF +if WANT_DEBUGDTMF +FTDM_CFLAGS += -DFTDM_DEBUG_DTMF endif @@ -68,246 +72,224 @@ pkgconfig_DATA = freetdm.pc # libfreetdm # libfreetdm_la_SOURCES = \ -$(SRC)/hashtable.c \ -$(SRC)/hashtable_itr.c \ -$(SRC)/ftdm_io.c \ -$(SRC)/ftdm_queue.c \ -$(SRC)/ftdm_sched.c \ -$(SRC)/ftdm_call_utils.c \ -$(SRC)/ftdm_config.c \ -$(SRC)/ftdm_callerid.c \ -$(SRC)/fsk.c \ -$(SRC)/uart.c \ -$(SRC)/g711.c \ -$(SRC)/libteletone_detect.c \ -$(SRC)/libteletone_generate.c \ -$(SRC)/ftdm_buffer.c \ -$(SRC)/ftdm_threadmutex.c \ -$(SRC)/ftdm_dso.c \ -$(SRC)/ftdm_cpu_monitor.c + $(SRC)/hashtable.c \ + $(SRC)/hashtable_itr.c \ + $(SRC)/ftdm_io.c \ + $(SRC)/ftdm_queue.c \ + $(SRC)/ftdm_sched.c \ + $(SRC)/ftdm_call_utils.c \ + $(SRC)/ftdm_config.c \ + $(SRC)/ftdm_callerid.c \ + $(SRC)/fsk.c \ + $(SRC)/uart.c \ + $(SRC)/g711.c \ + $(SRC)/libteletone_detect.c \ + $(SRC)/libteletone_generate.c \ + $(SRC)/ftdm_buffer.c \ + $(SRC)/ftdm_threadmutex.c \ + $(SRC)/ftdm_dso.c \ + $(SRC)/ftdm_cpu_monitor.c library_include_HEADERS = \ -$(SRC)/include/freetdm.h \ -$(SRC)/include/ftdm_declare.h \ -$(SRC)/include/ftdm_threadmutex.h \ -$(SRC)/include/ftdm_os.h \ -$(SRC)/include/ftdm_dso.h + $(SRC)/include/freetdm.h \ + $(SRC)/include/ftdm_declare.h \ + $(SRC)/include/ftdm_threadmutex.h \ + $(SRC)/include/ftdm_os.h \ + $(SRC)/include/ftdm_dso.h lib_LTLIBRARIES = libfreetdm.la -libfreetdm_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) +libfreetdm_la_CFLAGS = $(AM_CFLAGS) $(FTDM_CFLAGS) libfreetdm_la_LDFLAGS = -version-info 1:0:0 $(AM_LDFLAGS) libfreetdm_la_LIBADD = $(LIBS) -MYLIB = libfreetdm.la - core: libfreetdm.la core-install: install-libLTLIBRARIES # # tools & test programs # -noinst_PROGRAMS = testtones detect_tones detect_dtmf testpri testr2 testanalog testapp testcid #testisdn -if HAVE_SCTP -noinst_PROGRAMS += testboost -endif +noinst_PROGRAMS = testtones detect_tones detect_dtmf testpri testr2 testanalog testapp testcid noinst_PROGRAMS += testsangomaboost testapp_SOURCES = $(SRC)/testapp.c testapp_LDADD = libfreetdm.la -testapp_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) +testapp_CFLAGS = $(AM_CFLAGS) $(FTDM_CFLAGS) testcid_SOURCES = $(SRC)/testcid.c testcid_LDADD = libfreetdm.la -testcid_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) +testcid_CFLAGS = $(AM_CFLAGS) $(FTDM_CFLAGS) testtones_SOURCES = $(SRC)/testtones.c testtones_LDADD = libfreetdm.la -testtones_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) +testtones_CFLAGS = $(AM_CFLAGS) $(FTDM_CFLAGS) detect_tones_SOURCES = $(SRC)/detect_tones.c detect_tones_LDADD = libfreetdm.la -detect_tones_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) +detect_tones_CFLAGS = $(AM_CFLAGS) $(FTDM_CFLAGS) detect_dtmf_SOURCES = $(SRC)/detect_dtmf.c detect_dtmf_LDADD = libfreetdm.la -detect_dtmf_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) +detect_dtmf_CFLAGS = $(AM_CFLAGS) $(FTDM_CFLAGS) #testisdn_SOURCES = $(SRC)/testisdn.c #testisdn_LDADD = libfreetdm.la -#testisdn_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) +#testisdn_CFLAGS = $(AM_CFLAGS) $(FTDM_CFLAGS) testpri_SOURCES = $(SRC)/testpri.c testpri_LDADD = libfreetdm.la -testpri_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) +testpri_CFLAGS = $(AM_CFLAGS) $(FTDM_CFLAGS) testr2_SOURCES = $(SRC)/testr2.c testr2_LDADD = libfreetdm.la -testr2_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) +testr2_CFLAGS = $(AM_CFLAGS) $(FTDM_CFLAGS) if HAVE_SCTP +noinst_PROGRAMS += testboost testboost_SOURCES = $(SRC)/testboost.c testboost_LDADD = libfreetdm.la -testboost_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) +testboost_CFLAGS = $(AM_CFLAGS) $(FTDM_CFLAGS) endif testsangomaboost_SOURCES = $(SRC)/testsangomaboost.c testsangomaboost_LDADD = libfreetdm.la -testsangomaboost_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) +testsangomaboost_CFLAGS = $(AM_CFLAGS) $(FTDM_CFLAGS) testanalog_SOURCES = $(SRC)/testanalog.c testanalog_LDADD = libfreetdm.la -testanalog_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) +testanalog_CFLAGS = $(AM_CFLAGS) $(FTDM_CFLAGS) # # ftmod modules # mod_LTLIBRARIES = ftmod_zt.la ftmod_skel.la ftmod_analog.la ftmod_analog_em.la - -if HAVE_SCTP -mod_LTLIBRARIES += ftmod_sangoma_boost.la -endif - -if LIBSANGOMA -mod_LTLIBRARIES += ftmod_wanpipe.la -endif - -if LIBPRI -mod_LTLIBRARIES += ftmod_libpri.la -endif - -if PRITAP -mod_LTLIBRARIES += ftmod_pritap.la -endif - -if SNGSS7 -mod_LTLIBRARIES += ftmod_sangoma_ss7.la -endif - -if SNGISDN -mod_LTLIBRARIES += ftmod_sangoma_isdn.la -endif - -if OPENR2 -mod_LTLIBRARIES += ftmod_r2.la -endif - ftmod_zt_la_SOURCES = $(SRC)/ftmod/ftmod_zt/ftmod_zt.c -ftmod_zt_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) -ftmod_zt_la_LDFLAGS = -module -avoid-version -ftmod_zt_la_LIBADD = $(MYLIB) +ftmod_zt_la_CFLAGS = $(AM_CFLAGS) $(FTDM_CFLAGS) +ftmod_zt_la_LDFLAGS = -shared -module -avoid-version +ftmod_zt_la_LIBADD = libfreetdm.la ftmod_skel_la_SOURCES = $(SRC)/ftmod/ftmod_skel/ftmod_skel.c -ftmod_skel_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) +ftmod_skel_la_CFLAGS = $(AM_CFLAGS) $(FTDM_CFLAGS) ftmod_skel_la_LDFLAGS = -module -avoid-version -ftmod_skel_la_LIBADD = $(MYLIB) +ftmod_skel_la_LIBADD = libfreetdm.la -if LIBSANGOMA +ftmod_analog_la_SOURCES = $(SRC)/ftmod/ftmod_analog/ftmod_analog.c +ftmod_analog_la_CFLAGS = $(AM_CFLAGS) $(FTDM_CFLAGS) +ftmod_analog_la_LDFLAGS = -shared -module -avoid-version +ftmod_analog_la_LIBADD = libfreetdm.la + +ftmod_analog_em_la_SOURCES = $(SRC)/ftmod/ftmod_analog_em/ftmod_analog_em.c +ftmod_analog_em_la_CFLAGS = $(AM_CFLAGS) $(FTDM_CFLAGS) +ftmod_analog_em_la_LDFLAGS = -shared -module -avoid-version +ftmod_analog_em_la_LIBADD = libfreetdm.la + +if HAVE_LIBSANGOMA +mod_LTLIBRARIES += ftmod_wanpipe.la ftmod_wanpipe_la_SOURCES = $(SRC)/ftmod/ftmod_wanpipe/ftmod_wanpipe.c -ftmod_wanpipe_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) -D__LINUX__ -I/usr/include/wanpipe -ftmod_wanpipe_la_LDFLAGS = -module -avoid-version -lsangoma -ftmod_wanpipe_la_LIBADD = $(MYLIB) +ftmod_wanpipe_la_CFLAGS = $(AM_CFLAGS) $(FTDM_CFLAGS) -D__LINUX__ -I/usr/include/wanpipe +ftmod_wanpipe_la_LDFLAGS = -shared -module -avoid-version -lsangoma +ftmod_wanpipe_la_LIBADD = libfreetdm.la endif if HAVE_LIBISDN mod_LTLIBRARIES += ftmod_isdn.la ftmod_isdn_la_SOURCES = $(SRC)/ftmod/ftmod_isdn/ftmod_isdn.c -ftmod_isdn_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) -D_GNU_SOURCE $(LIBISDN_CPPFLAGS) $(PCAP_CPPFLAGS) +ftmod_isdn_la_CFLAGS = $(AM_CFLAGS) $(FTDM_CFLAGS) -D_GNU_SOURCE $(LIBISDN_CPPFLAGS) $(PCAP_CPPFLAGS) ftmod_isdn_la_LDFLAGS = -shared -module -avoid-version $(LIBISDN_LDFLAGS) $(PCAP_LDFLAGS) -ftmod_isdn_la_LIBADD = $(MYLIB) $(LIBISDN_LIBS) $(PCAP_LIBS) +ftmod_isdn_la_LIBADD = libfreetdm.la $(LIBISDN_LIBS) $(PCAP_LIBS) endif -ftmod_analog_la_SOURCES = $(SRC)/ftmod/ftmod_analog/ftmod_analog.c -ftmod_analog_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) -ftmod_analog_la_LDFLAGS = -module -avoid-version -ftmod_analog_la_LIBADD = $(MYLIB) - -ftmod_analog_em_la_SOURCES = $(SRC)/ftmod/ftmod_analog_em/ftmod_analog_em.c -ftmod_analog_em_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) -ftmod_analog_em_la_LDFLAGS = -module -avoid-version -ftmod_analog_em_la_LIBADD = $(MYLIB) - if HAVE_SCTP +mod_LTLIBRARIES += ftmod_sangoma_boost.la ftmod_sangoma_boost_la_SOURCES = $(SRC)/ftmod/ftmod_sangoma_boost/sangoma_boost_client.c $(SRC)/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c -ftmod_sangoma_boost_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) -ftmod_sangoma_boost_la_LDFLAGS = -module -avoid-version -ftmod_sangoma_boost_la_LIBADD = $(MYLIB) +ftmod_sangoma_boost_la_CFLAGS = $(AM_CFLAGS) $(FTDM_CFLAGS) +ftmod_sangoma_boost_la_LDFLAGS = -shared -module -avoid-version +ftmod_sangoma_boost_la_LIBADD = libfreetdm.la endif -if LIBPRI +if HAVE_LIBPRI +mod_LTLIBRARIES += ftmod_libpri.la ftmod_libpri_la_SOURCES = $(SRC)/ftmod/ftmod_libpri/ftmod_libpri.c $(SRC)/ftmod/ftmod_libpri/lpwrap_pri.c -ftmod_libpri_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) -ftmod_libpri_la_LDFLAGS = -module -avoid-version -lpri -ftmod_libpri_la_LIBADD = $(MYLIB) +ftmod_libpri_la_CFLAGS = $(AM_CFLAGS) $(FTDM_CFLAGS) +ftmod_libpri_la_LDFLAGS = -shared -module -avoid-version -lpri +ftmod_libpri_la_LIBADD = libfreetdm.la endif -if PRITAP +if HAVE_PRITAP +mod_LTLIBRARIES += ftmod_pritap.la ftmod_pritap_la_SOURCES = $(SRC)/ftmod/ftmod_pritap/ftmod_pritap.c -ftmod_pritap_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) -ftmod_pritap_la_LDFLAGS = -module -avoid-version -lpri -ftmod_pritap_la_LIBADD = $(MYLIB) +ftmod_pritap_la_CFLAGS = $(AM_CFLAGS) $(FTDM_CFLAGS) +ftmod_pritap_la_LDFLAGS = -shared -module -avoid-version -lpri +ftmod_pritap_la_LIBADD = libfreetdm.la endif -if SNGSS7 -ftmod_sangoma_ss7_la_SOURCES = $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sts.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c -ftmod_sangoma_ss7_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) -D_GNU_SOURCE -ftmod_sangoma_ss7_la_LDFLAGS = -module -avoid-version -lsng_ss7 -ftmod_sangoma_ss7_la_LIBADD = $(MYLIB) +if HAVE_SNG_SS7 +mod_LTLIBRARIES += ftmod_sangoma_ss7.la +ftmod_sangoma_ss7_la_SOURCES = \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sts.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c + +ftmod_sangoma_ss7_la_CFLAGS = $(AM_CFLAGS) $(FTDM_CFLAGS) -D_GNU_SOURCE +ftmod_sangoma_ss7_la_LDFLAGS = -shared -module -avoid-version -lsng_ss7 +ftmod_sangoma_ss7_la_LIBADD = libfreetdm.la endif -if SNGISDN -ftmod_sangoma_isdn_la_SOURCES = $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c \ - $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c \ - $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cntrl.c \ - $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c \ - $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c \ - $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c \ - $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c \ - $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c \ - $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c \ - $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c - - -ftmod_sangoma_isdn_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) -D_GNU_SOURCE -ftmod_sangoma_isdn_la_LDFLAGS = -module -avoid-version -lsng_isdn -ftmod_sangoma_isdn_la_LIBADD = $(MYLIB) +if HAVE_SNG_ISDN +mod_LTLIBRARIES += ftmod_sangoma_isdn.la +ftmod_sangoma_isdn_la_SOURCES = \ + $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c \ + $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c \ + $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cntrl.c \ + $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c \ + $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c \ + $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c \ + $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c \ + $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c \ + $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c \ + $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c + +ftmod_sangoma_isdn_la_CFLAGS = $(AM_CFLAGS) $(FTDM_CFLAGS) -D_GNU_SOURCE +ftmod_sangoma_isdn_la_LDFLAGS = -shared -module -avoid-version -lsng_isdn +ftmod_sangoma_isdn_la_LIBADD = libfreetdm.la endif -if OPENR2 +if HAVE_OPENR2 +mod_LTLIBRARIES += ftmod_r2.la ftmod_r2_la_SOURCES = $(SRC)/ftmod/ftmod_r2/ftmod_r2.c -ftmod_r2_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) -ftmod_r2_la_LDFLAGS = -module -avoid-version -lopenr2 -ftmod_r2_la_LIBADD = $(MYLIB) +ftmod_r2_la_CFLAGS = $(AM_CFLAGS) $(FTDM_CFLAGS) +ftmod_r2_la_LDFLAGS = -shared -module -avoid-version -lopenr2 +ftmod_r2_la_LIBADD = libfreetdm.la endif dox doxygen: doxygen $(FT_SRCDIR)/docs/Doxygen.conf -mod_freetdm/mod_freetdm.$(DYNAMIC_LIB_EXTEN): $(MYLIB) mod_freetdm/mod_freetdm.c - cd mod_freetdm && make +mod_freetdm/mod_freetdm.$(DYNAMIC_LIB_EXTEN): libfreetdm.la mod_freetdm/mod_freetdm.c + $(MAKE) -C mod_freetdm mod_freetdm: mod_freetdm/mod_freetdm.$(DYNAMIC_LIB_EXTEN) mod_freetdm-install: mod_freetdm - cd mod_freetdm && make install + $(MAKE) -C mod_freetdm install mod_freetdm-clean: - @if [ -f mod_freetdm/mod_freetdm.$(DYNAMIC_LIB_EXTEN) ] ; then cd mod_freetdm && make clean ; fi + @if [ -f mod_freetdm/mod_freetdm.$(DYNAMIC_LIB_EXTEN) ] ; then \ + $(MAKE) -C mod_freetdm clean ; \ + fi install-data-local: - $(mkinstalldirs) $(DESTDIR)$(PREFIX) + $(mkinstalldirs) $(DESTDIR)$(prefix) $(mkinstalldirs) $(DESTDIR)@confdir@ @[ -f "$(DESTDIR)@confdir@/freetdm.conf" ] || ( cp conf/*.conf $(DESTDIR)@confdir@) @echo FreeTDM Installed diff --git a/libs/freetdm/build/ax_compiler_vendor.m4 b/libs/freetdm/build/ax_compiler_vendor.m4 new file mode 100644 index 0000000..a24a58d --- /dev/null +++ b/libs/freetdm/build/ax_compiler_vendor.m4 @@ -0,0 +1,15 @@ +AC_DEFUN([AX_COMPILER_VENDOR], +[ +AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor, + [ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=unknown + # note: don't check for gcc first since some other compilers define __GNUC__ + for ventest in intel:__ICC,__ECC,__INTEL_COMPILER ibm:__xlc__,__xlC__,__IBMC__,__IBMCPP__ gnu:__GNUC__ sun:__SUNPRO_C,__SUNPRO_CC hp:__HP_cc,__HP_aCC dec:__DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland:__BORLANDC__,__TURBOC__ comeau:__COMO__ cray:_CRAYC kai:__KCC lcc:__LCC__ metrowerks:__MWERKS__ sgi:__sgi,sgi microsoft:_MSC_VER watcom:__WATCOMC__ portland:__PGI; do + vencpp="defined("`echo $ventest | cut -d: -f2 | sed 's/,/) || defined(/g'`")" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[ +#if !($vencpp) + thisisanerror; +#endif +])], [ax_cv_]_AC_LANG_ABBREV[_compiler_vendor=`echo $ventest | cut -d: -f1`; break]) + done + ]) +]) diff --git a/libs/freetdm/configure.ac b/libs/freetdm/configure.ac index 457e525..9f74d94 100644 --- a/libs/freetdm/configure.ac +++ b/libs/freetdm/configure.ac @@ -1,120 +1,117 @@ # -*- Autoconf -*- # Process this file with autoconf to produce a configure script. -AC_PREREQ(2.59) -AC_INIT([freetdm],[pre-alpha],[bugs@freeswitch.org]) +AC_PREREQ([2.59]) +AC_INIT([freetdm], [pre-alpha], [bugs@freeswitch.org]) AC_CONFIG_SRCDIR([src/ftdm_io.c]) -AC_CONFIG_AUX_DIR(build) -AM_INIT_AUTOMAKE(libfreetdm,0.1) +AC_CONFIG_AUX_DIR([build]) +AC_CONFIG_MACRO_DIR([build]) +AM_INIT_AUTOMAKE([libfreetdm], [0.1]) + +# >=automake-1.11 +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) + +# override some default libtool behavior and invoke AC_PROG_LIBTOOL +# (see http://lists.gnu.org/archive/html/libtool/2007-03/msg00000.html) +m4_defun([_LT_AC_LANG_F77_CONFIG], [:]) +m4_defun([_LT_AC_LANG_GCJ_CONFIG], [:]) +m4_defun([_LT_AC_LANG_RC_CONFIG], [:]) # Checks for programs. AC_PROG_CC AC_PROG_MAKE_SET AM_PROG_CC_C_O +AC_PROG_LIBTOOL +AC_PROG_INSTALL PKG_PROG_PKG_CONFIG -AC_PREFIX_DEFAULT(/usr/local/freetdm) -# AC_PREFIX_DEFAULT does not get expanded until too late so we need to do this to use prefix in this script -if test "x$prefix" = "xNONE" ; then - prefix='/usr/local/freetdm' +AX_COMPILER_VENDOR + +# AC_PREFIX_DEFAULT does not get expanded until too late so we need +# to do this to use prefix in this script +AC_PREFIX_DEFAULT([/usr/local/freetdm]) +if test "x${prefix}" = "xNONE" ; then + prefix='/usr/local/freetdm' fi # Absolute source/build directory FT_SRCDIR=`(cd $srcdir && pwd)` ft_builddir=`pwd` -AC_SUBST(FT_SRCDIR) -AC_SUBST(ft_builddir) +AC_SUBST([FT_SRCDIR]) +AC_SUBST([ft_builddir]) if test "$sysconfdir" = "\${prefix}/etc" ; then - confdir="$prefix/conf" + confdir="$prefix/conf" else - confdir="$sysconfdir" + confdir="$sysconfdir" fi -AC_SUBST(confdir) - -#override some default libtool behavior and invoke AC_PROG_LIBTOOL (see http://lists.gnu.org/archive/html/libtool/2007-03/msg00000.html) -m4_defun([_LT_AC_LANG_F77_CONFIG], [:]) -m4_defun([_LT_AC_LANG_GCJ_CONFIG], [:]) -m4_defun([_LT_AC_LANG_RC_CONFIG], [:]) -#AM_PROG_CC_C_O -AC_PROG_LIBTOOL -AC_PROG_INSTALL +AC_SUBST([confdir]) -# Check for com;iler type -AC_DEFUN([AX_COMPILER_VENDOR], -[ -AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor, - [ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=unknown - # note: don't check for GCC first, since some other compilers define __GNUC__ - for ventest in intel:__ICC,__ECC,__INTEL_COMPILER ibm:__xlc__,__xlC__,__IBMC__,__IBMCPP__ gnu:__GNUC__ sun:__SUNPRO_C,__SUNPRO_CC hp:__HP_cc,__HP_aCC dec:__DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland:__BORLANDC__,__TURBOC__ comeau:__COMO__ cray:_CRAYC kai:__KCC lcc:__LCC__ metrowerks:__MWERKS__ sgi:__sgi,sgi microsoft:_MSC_VER watcom:__WATCOMC__ portland:__PGI; do - vencpp="defined("`echo $ventest | cut -d: -f2 | sed 's/,/) || defined(/g'`")" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[ -#if !($vencpp) - thisisanerror; -#endif -])], [ax_cv_]_AC_LANG_ABBREV[_compiler_vendor=`echo $ventest | cut -d: -f1`; break]) - done - ]) -]) -AC_ARG_ENABLE([enable_64], [AS_HELP_STRING([--enable-64], [Enable 64bit compilation])], [enable_64="$enableval"], [enable_64="no"]) +# Where to install the modules +AC_ARG_WITH([modinstdir], + [AS_HELP_STRING([--with-modinstdir=DIR], [Install modules into this location (default: ${prefix}/mod)])], + [case "${withval}" in + no|yes) AC_MSG_ERROR([Invalid value \"${withval}\", option requires a valid path]) ;; + *) modinstdir="${withval}" ;; + esac], + [modinstdir="${prefix}/mod"] +) +AC_SUBST([modinstdir]) -AX_COMPILER_VENDOR +AC_ARG_ENABLE([enable_64], + [AS_HELP_STRING([--enable-64], [Enable 64bit compilation])], + [enable_64="${enableval}"], + [enable_64="no"] +) case "${ax_cv_c_compiler_vendor}" in gnu) - COMP_VENDOR_CFLAGS="-ffast-math -Wall -Werror -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -O0" - ;; + COMP_VENDOR_CFLAGS="-ffast-math -Wall -Werror -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -O0" + ;; sun) - COMP_VENDOR_CFLAGS="-xc99=all -mt -xCC -D__FUNCTION__=__func__ -xvpara" - if test "$enable_64" = "yes" ; then - COMP_VENDOR_CFLAGS="-m64 $COMP_VENDOR_CFLAGS" - fi - ;; + COMP_VENDOR_CFLAGS="-xc99=all -mt -xCC -D__FUNCTION__=__func__ -xvpara" + if test "$enable_64" != "no" ; then + COMP_VENDOR_CFLAGS="-m64 $COMP_VENDOR_CFLAGS" + fi + ;; *) - COMP_VENDOR_CFLAGS="-std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes" - ;; + COMP_VENDOR_CFLAGS="-std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes" + ;; esac +AC_SUBST([COMP_VENDOR_CFLAGS]) +# Enable debugging +AC_ARG_ENABLE([debug], + [AC_HELP_STRING([--enable-debug], [build with debug information])], + [enable_debug="${enableval}"], + [enable_debug="yes"] +) +if test "${enable_debug}" != "no"; then + AC_DEFINE([DEBUG], [], [Enable extra debugging.]) -#set SOLINK variable based on compiler and host -if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then - SOLINK="-Bdynamic -dy -G" -elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then - case "$host" in - *darwin*) - SOLINK="-dynamic -bundle -force-flat-namespace" - ;; - *-solaris2*) - SOLINK="-shared -Xlinker" - ;; - *) - SOLINK="-shared -Xlinker -x" - ;; - esac -else - AC_ERROR([Please update configure.in with SOLINK values for your compiler]) + if test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then + COMP_VENDOR_CFLAGS="$COMP_VENDOR_CFLAGS -g -ggdb" + fi fi +AC_SUBST([COMP_VENDOR_CFLAGS]) # set DYNAMIC_LIB_EXTEN # we should really be using libtool so we don't need to do this case "$host" in - *cygwin* | *mingw*) - DYNAMIC_LIB_EXTEN="dll" - ;; - *) - DYNAMIC_LIB_EXTEN="so" - ;; +*cygwin* | *mingw*) + DYNAMIC_LIB_EXTEN="dll" + ;; +*) + DYNAMIC_LIB_EXTEN="so" + ;; esac - -AC_SUBST(SOLINK) -AC_SUBST(DYNAMIC_LIB_EXTEN) +AC_SUBST([DYNAMIC_LIB_EXTEN]) AC_CHECK_LIB([dl], [dlopen]) AC_CHECK_LIB([pthread], [pthread_create]) AC_CHECK_LIB([m], [cos]) -AX_LIB_PCAP AC_CHECK_HEADERS([netinet/sctp.h netdb.h sys/select.h]) AM_CONDITIONAL([HAVE_SCTP],[test "${ac_cv_header_netinet_sctp_h}" = "yes"]) @@ -122,98 +119,127 @@ AM_CONDITIONAL([HAVE_SCTP],[test "${ac_cv_header_netinet_sctp_h}" = "yes"]) AC_CHECK_FUNC([gethostbyname_r], [], [AC_CHECK_LIB([nsl], [gethostbyname_r])] ) -if test "$ac_cv_func_gethostbyname_r" = "yes" -o "$ac_cv_lib_nsl_gethostbyname_r" = "yes" ; then - -AC_MSG_CHECKING([whether gethostbyname_r requires five arguments]) - -ac_cv_func_gethostbyname_r_five_args="no" - -AC_TRY_COMPILE([#include <netdb.h>], - [char *name; - struct hostent *he, *res; - char buffer[2048]; - int buflen = 2048; - (void)gethostbyname_r(name, he, buffer, buflen, &res)], - [ac_cv_func_gethostbyname_r_five_args="yes" - AC_DEFINE([HAVE_GETHOSTBYNAME_R_FIVE], [1], [gethostbyname_r has five arguments])] -) - - AC_MSG_RESULT([$ac_cv_func_gethostbyname_r_five_args]) - AC_DEFINE([HAVE_GETHOSTBYNAME_R],[1],[threadsafe gethostbyname]) -fi - -# Enable debugging -AC_ARG_ENABLE(debug, -[AC_HELP_STRING([--enable-debug],[build with debug information])],[enable_debug="$enableval"],[enable_debug="yes"]) - -if test "${enable_debug}" = "yes"; then - AC_DEFINE([DEBUG],[],[Enable extra debugging.]) +if test "$ac_cv_func_gethostbyname_r" = "yes" -o "$ac_cv_lib_nsl_gethostbyname_r" = "yes" +then + AC_MSG_CHECKING([whether gethostbyname_r requires five arguments]) + + ac_cv_func_gethostbyname_r_five_args="no" + + AC_TRY_COMPILE([#include <netdb.h>], + [char *name; + struct hostent *he, *res; + char buffer[2048]; + int buflen = 2048; + (void)gethostbyname_r(name, he, buffer, buflen, &res)], + [ac_cv_func_gethostbyname_r_five_args="yes" + AC_DEFINE([HAVE_GETHOSTBYNAME_R_FIVE], [1], [gethostbyname_r has five arguments])] + ) - if test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then - COMP_VENDOR_CFLAGS="$COMP_VENDOR_CFLAGS -g -ggdb" - fi + AC_MSG_RESULT([$ac_cv_func_gethostbyname_r_five_args]) + AC_DEFINE([HAVE_GETHOSTBYNAME_R], [1], [threadsafe gethostbyname]) fi -# Where to install the modules -AC_ARG_WITH([modinstdir], - [AS_HELP_STRING([--with-modinstdir=DIR], [Install modules into this location (default: $prefix/mod)])], [modinstdir="$withval"], [modinstdir="${prefix}/mod"]) - -AC_SUBST(modinstdir) - +## +## Modules and optional features +## +AC_MSG_RESULT([${as_nl}<<>> Modules and optional features]) -# libpri? +## +# libpri (TODO: add checks) +# +HAVE_LIBPRI="no" AC_ARG_WITH([libpri], - [AS_HELP_STRING([--with-libpri], [Install ftmod_libpri])], [enable_libpri="yes"], [enable_libpri="no"]) -AC_SUBST(enable_libpri) + [AS_HELP_STRING([--with-libpri], [Install ftmod_libpri])], + [case "${withval}" in + no) enable_libpri="no" ;; + *) enable_libpri="yes" ;; + esac], + [enable_libpri="no"] +) +HAVE_LIBPRI="${enable_libpri}" +AM_CONDITIONAL([HAVE_LIBPRI],[test "${enable_libpri}" = "yes"]) -# pritap? +## +# pritap (TODO: add checks) +# +HAVE_PRITAP="no" AC_ARG_WITH([pritap], - [AS_HELP_STRING([--with-pritap], [Install ftmod_pritap])], [enable_pritap="yes"], [enable_pritap="no"]) -AC_SUBST(enable_pritap) + [AS_HELP_STRING([--with-pritap], [Install ftmod_pritap])], + [case "${withval}" in + no) enable_pritap="no" ;; + *) enable_pritab="yes" ;; + esac], + [enable_pritap="no"] +) +HAVE_PRITAP="${enable_pritap}" +AM_CONDITIONAL([HAVE_PRITAP],[test "${enable_pritap}" = "yes"]) # debug dtmf? AC_ARG_WITH([debugdtmf], - [AS_HELP_STRING([--with-debugdtmf], [Debug DTMF])], [enable_debugdtmf="yes"], [enable_debugdtmf="no"]) -AC_SUBST(enable_debugdtmf) - -AC_CHECK_LIB([sangoma], [sangoma_span_chan_toif], [have_libsangoma="yes"]) -AM_CONDITIONAL([LIBSANGOMA],[test "${have_libsangoma}" = "yes"]) - -AM_CONDITIONAL([LIBPRI],[test "${enable_libpri}" = "yes"]) - -AM_CONDITIONAL([PRITAP],[test "${enable_pritap}" = "yes"]) - -AM_CONDITIONAL([DEBUGDTMF],[test "${enable_debugdtmf}" = "yes"]) + [AS_HELP_STRING([--with-debugdtmf], [Debug DTMF])], + [case "${withval}" in + no) enable_debugdtmf="no" ;; + *) enable_debugdtmf="yes" ;; + esac], + [enable_debugdtmf="no"] +) +AM_CONDITIONAL([WANT_DEBUGDTMF], [test "${enable_debugdtmf}" = "yes"]) -AC_CHECK_LIB([sng_ss7], [sng_isup_init], [have_sng_ss7="yes"]) -AM_CONDITIONAL([SNGSS7],[test "${have_sng_ss7}" = "yes"]) +## +# OpenR2 stack +# +HAVE_OPENR2="no" +AC_CHECK_LIB([openr2], [openr2_context_set_io_type], [HAVE_OPENR2="yes"]) +AC_MSG_RESULT([checking whether to build ftmod_r2... ${HAVE_OPENR2}]) +AM_CONDITIONAL([HAVE_OPENR2], [test "${HAVE_OPENR2}" = "yes"]) -AC_CHECK_LIB([sng_isdn], [sng_isdn_init], [have_sng_isdn="yes"]) -AM_CONDITIONAL([SNGISDN],[test "${have_sng_isdn}" = "yes"]) +## +# Sangoma Wanpipe +# +HAVE_LIBSANGOMA="no" +AC_MSG_RESULT([${as_nl}<<>> Sangoma Wanpipe]) +AC_CHECK_LIB([sangoma], [sangoma_span_chan_toif], [HAVE_LIBSANGOMA="yes"]) +AC_MSG_RESULT([checking whether to build ftmod_wanpipe... ${HAVE_LIBSANGOMA}]) +AM_CONDITIONAL([HAVE_LIBSANGOMA], [test "${HAVE_LIBSANGOMA}" = "yes"]) -AC_CHECK_LIB([openr2], [openr2_context_set_io_type], [have_openr2="yes"]) -AM_CONDITIONAL([OPENR2],[test "${have_openr2}" = "yes"]) +## +# Sangoma ISDN stack +# +HAVE_SNG_ISDN="no" +AC_MSG_RESULT([${as_nl}<<>> Sangoma ISDN stack]) +AC_CHECK_LIB([sng_isdn], [sng_isdn_init], [HAVE_SNG_ISDN="yes"]) +AC_MSG_RESULT([checking whether to build ftmod_sangoma_isdn... ${HAVE_SNG_ISDN}]) +AM_CONDITIONAL([HAVE_SNG_ISDN], [test "${HAVE_SNG_ISDN}" = "yes"]) -if test "${have_sng_isdn}" = "yes"; then +if test "${HAVE_SNG_ISDN}" = "yes"; then if test "${build}" == "${host}" then case "${host}" in x86_64-*) - # X86_64 machines need additional flags when compiling against libsng_isdn - CFLAGS="$CFLAGS -DBIT_64 -DALIGN_64BIT" - ;; + # X86_64 machines need additional flags when compiling against libsng_isdn + CFLAGS="$CFLAGS -DBIT_64 -DALIGN_64BIT" + ;; esac fi fi -if test "${have_sng_ss7}" = "yes"; then +## +# Sangoma SS7 stack +# +HAVE_SNG_SS7="no" +AC_MSG_RESULT([${as_nl}<<>> Sangoma SS7 stack]) +AC_CHECK_LIB([sng_ss7], [sng_isup_init], [HAVE_SNG_SS7="yes"]) +AC_MSG_RESULT([checking whether to build ftmod_sangoma_ss7... ${HAVE_SNG_SS7}]) +AM_CONDITIONAL([HAVE_SNG_SS7], [test "${HAVE_SNG_SS7}" = "yes"]) + +if test "${HAVE_SNG_SS7}" = "yes"; then if test "${build}" == "${host}" then case "${host}" in x86_64-*) - # X86_64 machines need additional flags when compiling against libsng_isdn - CFLAGS="$CFLAGS -DBIT_64 -DALIGN_64BIT" - ;; + # X86_64 machines need additional flags when compiling against libsng_isdn + CFLAGS="$CFLAGS -DBIT_64 -DALIGN_64BIT" + ;; esac fi fi @@ -268,14 +294,35 @@ then ], [AC_MSG_ERROR([Need libisdn-0.0.1 or higher])] ) + AX_LIB_PCAP fi AM_CONDITIONAL([HAVE_LIBISDN], [test "${HAVE_LIBISDN}" = "yes"]) -COMP_VENDOR_CFLAGS="$COMP_VENDOR_CFLAGS" -AC_SUBST(COMP_VENDOR_CFLAGS) - AC_MSG_RESULT([${as_nl}<<>> Creating output files]) -AC_CONFIG_FILES([Makefile - freetdm.pc - mod_freetdm/Makefile]) +AC_CONFIG_FILES([ + Makefile + freetdm.pc + mod_freetdm/Makefile +]) AC_OUTPUT + +# +# summary screen +# +AC_MSG_RESULT([ +============================ FreeTDM configuration ============================ + ++ Modules + + Signalling: + ftmod_isdn......................... ${HAVE_LIBISDN} + ftmod_libpri....................... ${HAVE_LIBPRI} + ftmod_sangoma_isdn................. ${HAVE_SNG_ISDN} + ftmod_sangoma_ss7.................. ${HAVE_SNG_SS7} + ftmod_r2........................... ${HAVE_OPENR2} + ftmod_pritap....................... ${HAVE_PRITAP} + I/O: + ftmod_wanpipe...................... ${HAVE_LIBSANGOMA} + +=============================================================================== +]) commit 3428bd3d43199631f00cea23c1d0c1637b1bae75 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Mon Nov 1 00:47:43 2010 +0100 ftmod_isdn: FreeTDM port, first steps - Requires non-public development version of libisdn(!) - Based on older patches from http://oss.axsentis.de/gitweb/?p=ftmod_isdn.git;a=summary - Rework of ftmod_isdn related buildsystem parts (Makefile.am, configure.in and libpcap.m4) diff --git a/libs/freetdm/Makefile.am b/libs/freetdm/Makefile.am index d14013a..33e287f 100644 --- a/libs/freetdm/Makefile.am +++ b/libs/freetdm/Makefile.am @@ -161,7 +161,7 @@ testanalog_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) # # ftmod modules # -mod_LTLIBRARIES = ftmod_zt.la ftmod_skel.la ftmod_analog.la ftmod_analog_em.la #ftmod_isdn.la +mod_LTLIBRARIES = ftmod_zt.la ftmod_skel.la ftmod_analog.la ftmod_analog_em.la if HAVE_SCTP @@ -209,32 +209,13 @@ ftmod_wanpipe_la_LDFLAGS = -module -avoid-version -lsangoma ftmod_wanpipe_la_LIBADD = $(MYLIB) endif -#ftmod_isdn_la_SOURCES = \ -#$(SRC)/isdn/EuroISDNStateNT.c \ -#$(SRC)/isdn/EuroISDNStateTE.c \ -#$(SRC)/isdn/mfifo.c \ -#$(SRC)/isdn/Q921.c \ -#$(SRC)/isdn/Q931api.c \ -#$(SRC)/isdn/Q931.c \ -#$(SRC)/isdn/Q931ie.c \ -#$(SRC)/isdn/Q931mes.c \ -#$(SRC)/isdn/Q931StateNT.c \ -#$(SRC)/isdn/Q931StateTE.c \ -#$(SRC)/isdn/nationalmes.c \ -#$(SRC)/isdn/nationalStateNT.c \ -#$(SRC)/isdn/nationalStateTE.c \ -#$(SRC)/isdn/DMSmes.c \ -#$(SRC)/isdn/DMSStateNT.c \ -#$(SRC)/isdn/DMSStateTE.c \ -#$(SRC)/isdn/5ESSmes.c \ -#$(SRC)/isdn/5ESSStateNT.c \ -#$(SRC)/isdn/5ESSStateTE.c \ -#$(SRC)/isdn/Q932mes.c \ -#$(SRC)/ftmod/ftmod_isdn/ftmod_isdn.c - -#ftmod_isdn_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) -D_GNU_SOURCE -#ftmod_isdn_la_LDFLAGS = $(PCAP_LIB_FLAGS) -module -avoid-version -#ftmod_isdn_la_LIBADD = $(MYLIB) +if HAVE_LIBISDN +mod_LTLIBRARIES += ftmod_isdn.la +ftmod_isdn_la_SOURCES = $(SRC)/ftmod/ftmod_isdn/ftmod_isdn.c +ftmod_isdn_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) -D_GNU_SOURCE $(LIBISDN_CPPFLAGS) $(PCAP_CPPFLAGS) +ftmod_isdn_la_LDFLAGS = -shared -module -avoid-version $(LIBISDN_LDFLAGS) $(PCAP_LDFLAGS) +ftmod_isdn_la_LIBADD = $(MYLIB) $(LIBISDN_LIBS) $(PCAP_LIBS) +endif ftmod_analog_la_SOURCES = $(SRC)/ftmod/ftmod_analog/ftmod_analog.c ftmod_analog_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) diff --git a/libs/freetdm/build/libpcap.m4 b/libs/freetdm/build/libpcap.m4 index c20d345..ea7581e 100644 --- a/libs/freetdm/build/libpcap.m4 +++ b/libs/freetdm/build/libpcap.m4 @@ -2,6 +2,10 @@ dnl libpcap.m4--PCAP libraries and includes dnl Derrick Brashear dnl from KTH krb and Arla dnl $Id: libpcap.m4,v 1.4 2006/01/20 20:21:09 snsimon Exp $ +dnl 2010/10/31 (stkn): +dnl rename: PCAP_INC_FLAGS -> PCAP_CPPFLAGS +dnl rename: PCAP_LIB_FLAGS -> PCAP_LDFLAGS (-L flags only) +dnl add: PCAP_LIBS (libs only) AC_DEFUN([PCAP_INC_WHERE1], [ ac_cv_found_pcap_inc=no @@ -129,12 +133,14 @@ AC_ARG_WITH(pcap-include, AC_MSG_RESULT(yes) PCAP_INC_DIR=$ac_cv_pcap_where_inc PCAP_LIB_DIR=$ac_cv_pcap_where_lib - PCAP_INC_FLAGS="-I${PCAP_INC_DIR}" - PCAP_LIB_FLAGS="-L${PCAP_LIB_DIR} -lpcap" + PCAP_CPPFLAGS="-I${PCAP_INC_DIR}" + PCAP_LDFLAGS="-L${PCAP_LIB_DIR}" + PCAP_LIBS="-lpcap" AC_SUBST(PCAP_INC_DIR) AC_SUBST(PCAP_LIB_DIR) - AC_SUBST(PCAP_INC_FLAGS) - AC_SUBST(PCAP_LIB_FLAGS) + AC_SUBST(PCAP_CPPFLAGS) + AC_SUBST(PCAP_LDFLAGS) + AC_SUBST(PCAP_LIBS) AC_DEFINE([HAVE_LIBPCAP],[1],[libpcap]) else ac_cv_found_pcap=no diff --git a/libs/freetdm/configure.ac b/libs/freetdm/configure.ac index 18f83d8..457e525 100644 --- a/libs/freetdm/configure.ac +++ b/libs/freetdm/configure.ac @@ -12,6 +12,7 @@ AM_INIT_AUTOMAKE(libfreetdm,0.1) AC_PROG_CC AC_PROG_MAKE_SET AM_PROG_CC_C_O +PKG_PROG_PKG_CONFIG AC_PREFIX_DEFAULT(/usr/local/freetdm) # AC_PREFIX_DEFAULT does not get expanded until too late so we need to do this to use prefix in this script @@ -217,8 +218,63 @@ if test "${have_sng_ss7}" = "yes"; then fi fi +## +# libisdn +# +HAVE_LIBISDN="no" +AC_ARG_WITH([libisdn], + [AS_HELP_STRING([--with-libisdn], [Install ftmod_isdn (libisdn stack)])], + [case "${withval}" in + no) with_libisdn="no" ;; + *) with_libisdn="yes" ;; + esac + ], + [with_libisdn="no"] +) +if test "${with_libisdn}" != "no" +then + AC_MSG_RESULT([${as_nl}<<>> ftmod_isdn (libisdn stack)]) + PKG_CHECK_MODULES([libisdn], + [libisdn >= 0.0.1], + [AC_MSG_CHECKING([libisdn version]) + LIBISDN_VERSION="`${PKG_CONFIG} --modversion libisdn`" + if test -z "${LIBISDN_VERSION}"; then + AC_MSG_ERROR([Failed to retrieve libisdn version]) + fi + AC_MSG_RESULT([${LIBISDN_VERSION}]) + + # check features + AC_MSG_CHECKING([for new experimental API]) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [#include <libisdn/version.h> + #if !LIBISDN_FEATURE(API2) + #error "libisdn API v2 not available" + #endif + ], + [;] + )], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])] + ) + + HAVE_LIBISDN="yes" + AC_DEFINE([HAVE_LIBISDN], [1], [libisdn support]) + AC_SUBST([LIBISDN_CFLAGS], [${libisdn_CFLAGS}]) + AC_SUBST([LIBISDN_CPPFLAGS],[${libisdn_CPPFLAGS}]) + AC_SUBST([LIBISDN_LDFLAGS], [${libisdn_LDFLAGS}]) + AC_SUBST([LIBISDN_LIBS], [${libisdn_LIBS}]) + AC_SUBST([LIBISDN_VERSION]) + ], + [AC_MSG_ERROR([Need libisdn-0.0.1 or higher])] + ) +fi +AM_CONDITIONAL([HAVE_LIBISDN], [test "${HAVE_LIBISDN}" = "yes"]) + COMP_VENDOR_CFLAGS="$COMP_VENDOR_CFLAGS" AC_SUBST(COMP_VENDOR_CFLAGS) + +AC_MSG_RESULT([${as_nl}<<>> Creating output files]) AC_CONFIG_FILES([Makefile freetdm.pc mod_freetdm/Makefile]) diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c index 3715e98..7a28107 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@ -1,23 +1,23 @@ /* * Copyright (c) 2007, Anthony Minessale II * 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 original author; nor the names of any 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 @@ -30,267 +30,268 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -/** - * Workaround for missing u_int / u_short types on solaris - */ -#if defined(HAVE_LIBPCAP) && defined(__SunOS) -#define __EXTENSIONS__ +#ifdef HAVE_CONFIG_H +#include "config.h" #endif +#include <private/ftdm_core.h> +#include <libisdn/Q931.h> +#include <libisdn/Q921.h> -#include "private/ftdm_core.h" -#include "Q931.h" -#include "Q921.h" #ifdef WIN32 #include <windows.h> #else #include <sys/time.h> #endif -#include "ftdm_isdn.h" +#include "ftmod_isdn.h" #define LINE "--------------------------------------------------------------------------------" -//#define IODEBUG /* helper macros */ #define FTDM_SPAN_IS_BRI(x) ((x)->trunk_type == FTDM_TRUNK_BRI || (x)->trunk_type == FTDM_TRUNK_BRI_PTMP) #define FTDM_SPAN_IS_NT(x) (((ftdm_isdn_data_t *)(x)->signal_data)->mode == Q921_NT) +#define DEFAULT_NATIONAL_PREFIX "0" +#define DEFAULT_INTERNATIONAL_PREFIX "00" -#ifdef HAVE_LIBPCAP -/*-------------------------------------------------------------------------*/ -/*Q931ToPcap functions*/ +/***************************************************************************************** + * PCAP + * Based on Helmut Kuper's (<helmut.kuper@ewetel.de>) implementation, + * but using a different approach (needs a recent libpcap + wireshark) + *****************************************************************************************/ +#ifdef HAVE_PCAP +#include <arpa/inet.h> /* htons() */ #include <pcap.h> -#endif -#define SNAPLEN 1522 -#define MAX_ETHER_PAYLOAD_SIZE 1500 -#define MIN_ETHER_PAYLOAD_SIZE 42 -#define SIZE_ETHERNET 18 -#define VLANID_OFFSET 15 -#define SIZE_IP 20 -#define SIZE_TCP 20 -#define SIZE_TPKT 4 -#define SIZE_ETHERNET_CRC 4 -#define OVERHEAD SIZE_ETHERNET+SIZE_IP+SIZE_TCP+SIZE_TPKT -#define MAX_Q931_SIZE MAX_ETHER_PAYLOAD_SIZE-SIZE_IP-SIZE_TCP-SIZE_TPKT -#define TPKT_SIZE_OFFSET SIZE_ETHERNET+SIZE_IP+SIZE_TCP+2 -#define IP_SIZE_OFFSET SIZE_ETHERNET+2 -#define TCP_SEQ_OFFSET SIZE_ETHERNET+SIZE_IP+4 - -#ifdef HAVE_LIBPCAP -/*Some globals*/ -unsigned long pcapfilesize = 0; -unsigned long tcp_next_seq_no_send = 0; -unsigned long tcp_next_seq_no_rec = 0; -pcap_dumper_t *pcapfile = NULL; -struct pcap_pkthdr pcaphdr; -pcap_t *pcaphandle = NULL; -char *pcapfn = NULL; -int do_q931ToPcap= 0; - -/*Predefined Ethernet Frame with Q931-over-IP encapsulated - From remote TDM host to FreeSWITCH*/ -L3UCHAR recFrame[SNAPLEN]= { - /*IEEE 802.3 VLAN 802.1q Ethernet Frame Header*/ - 2,0,1,0xAA,0xAA,0xAA,2,0,1,0xBB,0xBB,0xBB,0x81,0,0xE0,0,0x08,0, - /*IPv4 Header (minimal size; no options)*/ - 0x45,0,0,44,0,0,0,0,64,6,0,0,2,2,2,2,1,1,1,1, - /*TCP-Header*/ - 0,0x66,0,0x66,0,0,0,0,0,0,0,0,0x50,0,0,1,0,0,0,0, - /*TPKT-Header RFC 1006*/ - 3,0,0,0 - }; - -/*Predefined Ethernet Frame with Q931-over-IP encapsulated - Frome FreeSWITCH to remote TDM host*/ -L3UCHAR sendFrame[SNAPLEN]= { - /*IEEE 802.3 VLAN 802.1q Ethernet Frame Header*/ - 2,0,1,0xBB,0xBB,0xBB,2,0,1,0xAA,0xAA,0xAA,0x81,0,0xE0,0,0x08,0, - /*IPv4 Header (minimal size; no options)*/ - 0x45,0,0,44,0,0,0,0,64,6,0,0,1,1,1,1,2,2,2,2, - /*TCP-Header*/ - 0,0x66,0,0x66,0,0,0,0,0,0,0,0,0x50,0,0,1,0,0,0,0, - /*TPKT-Header RFC 1006*/ - 3,0,0,0 - }; +#define PCAP_SNAPLEN 1500 -/** - * \brief Opens a pcap file for capture - * \return Success or failure - */ -static ftdm_status_t openPcapFile(void) +struct pcap_context { + pcap_dumper_t *dump; /*!< pcap file handle */ + pcap_t *handle; /*!< pcap lib context */ + char *filename; /*!< capture file name */ +}; + +static inline ftdm_status_t isdn_pcap_is_open(struct ftdm_isdn_data *isdn) { - if(!pcaphandle) - { - pcaphandle = pcap_open_dead(DLT_EN10MB, SNAPLEN); - if (!pcaphandle) - { - ftdm_log(FTDM_LOG_ERROR, "Can't open pcap session: (%s)\n", pcap_geterr(pcaphandle)); - return FTDM_FAIL; - } - } + return (isdn->pcap) ? 1 : 0; +} - if(!pcapfile){ - /* Open the dump file */ - if(!(pcapfile=pcap_dump_open(pcaphandle, pcapfn))){ - ftdm_log(FTDM_LOG_ERROR, "Error opening output file (%s)\n", pcap_geterr(pcaphandle)); - return FTDM_FAIL; - } - } - else{ - ftdm_log(FTDM_LOG_WARNING, "Pcap file is already open!\n"); - return FTDM_FAIL; - } +static inline ftdm_status_t isdn_pcap_capture_both(struct ftdm_isdn_data *isdn) +{ + return ((isdn->flags & (FTDM_ISDN_CAPTURE | FTDM_ISDN_CAPTURE_L3ONLY)) == FTDM_ISDN_CAPTURE) ? 1 : 0; +} - ftdm_log(FTDM_LOG_DEBUG, "Pcap file '%s' successfully opened!\n", pcapfn); +static inline ftdm_status_t isdn_pcap_capture_l3only(struct ftdm_isdn_data *isdn) +{ + return ((isdn->flags & FTDM_ISDN_CAPTURE) && (isdn->flags & FTDM_ISDN_CAPTURE_L3ONLY)) ? 1 : 0; +} - pcaphdr.ts.tv_sec = 0; - pcaphdr.ts.tv_usec = 0; - pcapfilesize = 24; /*current pcap file header seems to be 24 bytes*/ - tcp_next_seq_no_send = 0; - tcp_next_seq_no_rec = 0; +static ftdm_status_t isdn_pcap_open(struct ftdm_isdn_data *isdn, char *filename) +{ + struct pcap_context *pcap = NULL; - return FTDM_SUCCESS; + if (!isdn) { + return FTDM_FAIL; + } + + if (ftdm_strlen_zero(filename)) { + return FTDM_FAIL; + } + + pcap = malloc(sizeof(struct pcap_context)); + if (!pcap) { + ftdm_log(FTDM_LOG_ERROR, "Failed to allocate isdn pcap context\n"); + return FTDM_FAIL; + } + + memset(pcap, 0, sizeof(struct pcap_context)); + + pcap->filename = strdup(filename); + + pcap->handle = pcap_open_dead(DLT_LINUX_LAPD, PCAP_SNAPLEN); + if (!pcap->handle) { + ftdm_log(FTDM_LOG_ERROR, "Failed to open pcap handle\n"); + goto error; + } + + pcap->dump = pcap_dump_open(pcap->handle, pcap->filename); + if (!pcap->dump) { + ftdm_log(FTDM_LOG_ERROR, "Failed to open capture file: %s\n", pcap_geterr(pcap->handle)); + goto error; + } + + ftdm_log(FTDM_LOG_INFO, "Capture file \"%s\" opened\n", pcap->filename); + + isdn->pcap = pcap; + + return FTDM_SUCCESS; + +error: + if (pcap->handle) { + pcap_close(pcap->handle); + } + if (pcap->filename) { + free(pcap->filename); + } + + free(pcap); + + return FTDM_FAIL; } -/** - * \brief Closes a pcap file - * \return Success - */ -static ftdm_status_t closePcapFile(void) +static ftdm_status_t isdn_pcap_close(struct ftdm_isdn_data *isdn) { - if (pcapfile) { - pcap_dump_close(pcapfile); - if (pcaphandle) pcap_close(pcaphandle); - - ftdm_log(FTDM_LOG_DEBUG, "Pcap file closed! File size is %lu bytes.\n", pcapfilesize); + struct pcap_context *pcap = NULL; + long size; - pcaphdr.ts.tv_sec = 0; - pcaphdr.ts.tv_usec = 0; - pcapfile = NULL; - pcaphandle = NULL; - pcapfilesize = 0; - tcp_next_seq_no_send = 0; - tcp_next_seq_no_rec = 0; + if (!isdn || !isdn->pcap) { + return FTDM_FAIL; } + pcap = isdn->pcap; + + isdn->flags &= ~(FTDM_ISDN_CAPTURE | FTDM_ISDN_CAPTURE_L3ONLY); + isdn->pcap = NULL; + + pcap_dump_flush(pcap->dump); + + size = pcap_dump_ftell(pcap->dump); + ftdm_log(FTDM_LOG_INFO, "File \"%s\" captured %ld bytes of data\n", pcap->filename, size); + + pcap_dump_close(pcap->dump); + pcap_close(pcap->handle); + + free(pcap->filename); + free(pcap); - /*We have allways success with this? I think so*/ return FTDM_SUCCESS; } -/** - * \brief Writes a Q931 packet to a pcap file - * \return Success or failure - */ -static ftdm_status_t writeQ931PacketToPcap(L3UCHAR* q931buf, L3USHORT q931size, L3ULONG span_id, L3USHORT direction) +static inline void isdn_pcap_start(struct ftdm_isdn_data *isdn) { - L3UCHAR *frame = NULL; - struct timeval ts; - u_char spanid = (u_char)span_id; - unsigned long *tcp_next_seq_no = NULL; - - spanid=span_id; - - /*The total length of the ethernet frame generated by this function has a min length of 66 - so we don't have to care about padding :)*/ - - - /*FS is sending the packet*/ - if(direction==0){ - frame=sendFrame; - tcp_next_seq_no = &tcp_next_seq_no_send; - } - /*FS is receiving the packet*/ - else{ - frame=recFrame; - tcp_next_seq_no = &tcp_next_seq_no_rec; - } - - /*Set spanid in VLAN-ID tag*/ - frame[VLANID_OFFSET] = spanid; - - /*** Write sent packet ***/ - if(q931size > MAX_Q931_SIZE) - { - /*WARNING*/ - ftdm_log(FTDM_LOG_WARNING, "Q931 packet size is too big (%u)! Ignoring it!\n", q931size); - return FTDM_FAIL; - } + if (!isdn->pcap) + return; - /*Copy q931 buffer into frame*/ - memcpy(frame+OVERHEAD,q931buf,q931size); + isdn->flags |= FTDM_ISDN_CAPTURE; +} - /*Store TCP sequence number in TCP header*/ - frame[TCP_SEQ_OFFSET]=(*tcp_next_seq_no>>24)&0xFF; - frame[TCP_SEQ_OFFSET+1]=(*tcp_next_seq_no>>16)&0xFF; - frame[TCP_SEQ_OFFSET+2]=(*tcp_next_seq_no>>8)&0xFF; - frame[TCP_SEQ_OFFSET+3]=*tcp_next_seq_no & 0xFF; +static inline void isdn_pcap_stop(struct ftdm_isdn_data *isdn) +{ + isdn->flags &= ~FTDM_ISDN_CAPTURE; +} + +#ifndef ETH_P_LAPD +#define ETH_P_LAPD 0x0030 +#endif - /*Store size of TPKT packet*/ - q931size+=4; - frame[TPKT_SIZE_OFFSET]=(q931size>>8)&0xFF; - frame[TPKT_SIZE_OFFSET+1]=q931size&0xFF; +struct isdn_sll_hdr { + uint16_t slltype; + uint16_t sllhatype; + uint16_t slladdrlen; + uint8_t slladdr[8]; + uint16_t sllproto; +}; - /*Calc next TCP sequence number*/ - *tcp_next_seq_no+=q931size; +/* Fake Q.921 I-frame */ +//static const char q921_fake_frame[] = { 0x00, 0x00, 0x00, 0x00 }; - /*Store size of IP packet*/ - q931size+=SIZE_IP+SIZE_TCP; - frame[IP_SIZE_OFFSET]=(q931size>>8)&0xFF; - frame[IP_SIZE_OFFSET+1]=q931size&0xFF; +enum { + ISDN_PCAP_INCOMING = 0, + ISDN_PCAP_INCOMING_BCAST = 1, + ISDN_PCAP_OUTGOING = 4, +}; - pcaphdr.caplen = SIZE_ETHERNET+SIZE_ETHERNET_CRC+q931size; - pcaphdr.len = pcaphdr.caplen; +static ftdm_status_t isdn_pcap_write(struct ftdm_isdn_data *isdn, unsigned char *buf, ftdm_ssize_t len, int direction) +{ + unsigned char frame[PCAP_SNAPLEN]; + struct pcap_context *pcap; + struct isdn_sll_hdr *sll_hdr = (struct isdn_sll_hdr *)frame; + struct pcap_pkthdr hdr; + int offset = sizeof(struct isdn_sll_hdr); + int nbytes; + + if (!isdn || !isdn->pcap || !buf || !len) { + return FTDM_FAIL; + } - /* Set Timestamp */ - /* Get Time in ms. usecs would be better ... */ - gettimeofday(&ts, NULL); - /*Write it into packet header*/ - pcaphdr.ts.tv_sec = ts.tv_sec; - pcaphdr.ts.tv_usec = ts.tv_usec; + pcap = isdn->pcap; + + /* Update SLL header */ + sll_hdr->slltype = htons(direction); + sll_hdr->sllhatype = 0; + sll_hdr->slladdrlen = 1; + sll_hdr->slladdr[0] = (isdn->mode == Q921_NT) ? 1 : 0; /* TODO: NT/TE */ + sll_hdr->sllproto = htons(ETH_P_LAPD); + +#if 0 + /* Q.931-only mode: copy fake Q.921 header */ + if (isdn->flags & FTDM_ISDN_CAPTURE_L3ONLY) { + /* copy fake q921 header */ + memcpy(frame + offset, q921_fake_frame, sizeof(q921_fake_frame)); + offset += sizeof(q921_fake_frame); + } +#endif - pcap_dump((u_char*)pcapfile, &pcaphdr, frame); - pcap_dump_flush(pcapfile); + /* Copy data */ + nbytes = (len > (PCAP_SNAPLEN - offset)) ? (PCAP_SNAPLEN - offset) : len; + memcpy(frame + offset, buf, nbytes); - /*Maintain pcap file size*/ - pcapfilesize+=pcaphdr.caplen; - pcapfilesize+=sizeof(struct pcap_pkthdr); + /* Update timestamp */ + memset(&hdr, 0, sizeof(struct pcap_pkthdr)); + gettimeofday(&hdr.ts, NULL); + hdr.caplen = offset + nbytes; + hdr.len = hdr.caplen; - ftdm_log(FTDM_LOG_DEBUG, "Added %u bytes to pcap file. File size is now %lu, \n", q931size, pcapfilesize); + /* Write packet */ + pcap_dump((unsigned char *)pcap->dump, &hdr, frame); - return FTDM_SUCCESS; + return FTDM_SUCCESS; } +#endif /* HAVE_PCAP */ -#endif + +static L2ULONG ftdm_time_now(void) +{ + return (L2ULONG)ftdm_current_time_in_ms(); +} /** - * \brief Unloads pcap IO - * \return Success or failure + * \brief Returns the signalling status on a channel + * \param ftdmchan Channel to get status on + * \param status Pointer to set signalling status + * \return Success or failure */ -static FIO_IO_UNLOAD_FUNCTION(close_pcap) +static FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(isdn_get_channel_sig_status) { -#ifdef HAVE_LIBPCAP - return closePcapFile(); -#else + *status = FTDM_SIG_STATE_DOWN; + + ftdm_isdn_data_t *isdn_data = ftdmchan->span->signal_data; + if (ftdm_test_flag(isdn_data, FTDM_ISDN_RUNNING)) { + *status = FTDM_SIG_STATE_UP; + } return FTDM_SUCCESS; -#endif } -/*Q931ToPcap functions DONE*/ -/*-------------------------------------------------------------------------*/ - /** - * \brief Gets current time - * \return Current time (in ms) + * \brief Returns the signalling status on a span + * \param span Span to get status on + * \param status Pointer to set signalling status + * \return Success or failure */ -static L2ULONG ftdm_time_now(void) +static FIO_SPAN_GET_SIG_STATUS_FUNCTION(isdn_get_span_sig_status) { - return (L2ULONG)ftdm_current_time_in_ms(); + *status = FTDM_SIG_STATE_DOWN; + + ftdm_isdn_data_t *isdn_data = span->signal_data; + if (ftdm_test_flag(isdn_data, FTDM_ISDN_RUNNING)) { + *status = FTDM_SIG_STATE_UP; + } + return FTDM_SUCCESS; } /** - * \brief Initialises an ISDN channel (outgoing call) - * \param ftdmchan Channel to initiate call on - * \return Success or failure + * \brief Create outgoing channel + * \param ftdmchan Channel to create outgoing call on + * \return Success or failure */ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(isdn_outgoing_call) { @@ -301,14 +302,12 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(isdn_outgoing_call) } /** - * \brief Requests an ISDN channel on a span (outgoing call) - * \param span Span where to get a channel - * \param chan_id Specific channel to get (0 for any) - * \param direction Call direction (inbound, outbound) - * \param caller_data Caller information - * \param ftdmchan Channel to initialise - * \return Success or failure + * \brief Create outgoing channel, let module select the channel to use + * \param span Span to create outgoing call on + * \param caller_data + * \return Success or failure */ +#ifdef __TODO__ static FIO_CHANNEL_REQUEST_FUNCTION(isdn_channel_request) { Q931mes_Generic *gen = (Q931mes_Generic *) caller_data->raw_data; @@ -348,7 +347,7 @@ static FIO_CHANNEL_REQUEST_FUNCTION(isdn_channel_request) BearerCap.ITR = Q931_ITR_64K; /* 64k */ BearerCap.Layer1Ident = 1; BearerCap.UIL1Prot = (codec == FTDM_CODEC_ALAW) ? Q931_UIL1P_G711A : Q931_UIL1P_G711U; /* U-law = 2, A-law = 3 */ - gen->BearerCap = Q931AppendIE((L3UCHAR *) gen, (L3UCHAR *) &BearerCap); + gen->BearerCap = Q931AppendIE(gen, (L3UCHAR *) &BearerCap); /* * Channel ID IE @@ -356,20 +355,20 @@ static FIO_CHANNEL_REQUEST_FUNCTION(isdn_channel_request) Q931InitIEChanID(&ChanID); ChanID.IntType = FTDM_SPAN_IS_BRI(span) ? 0 : 1; /* PRI = 1, BRI = 0 */ - if(!FTDM_SPAN_IS_NT(span)) { + if (!FTDM_SPAN_IS_NT(span)) { ChanID.PrefExcl = (isdn_data->opts & FTDM_ISDN_OPT_SUGGEST_CHANNEL) ? 0 : 1; /* 0 = preferred, 1 exclusive */ } else { ChanID.PrefExcl = 1; /* always exclusive in NT-mode */ } - if(ChanID.IntType) { + if (ChanID.IntType) { ChanID.InfoChanSel = 1; /* None = 0, See Slot = 1, Any = 3 */ ChanID.ChanMapType = 3; /* B-Chan */ ChanID.ChanSlot = (unsigned char)chan_id; } else { ChanID.InfoChanSel = (unsigned char)chan_id & 0x03; /* None = 0, B1 = 1, B2 = 2, Any = 3 */ } - gen->ChanID = Q931AppendIE((L3UCHAR *) gen, (L3UCHAR *) &ChanID); + gen->ChanID = Q931AppendIE(gen, (L3UCHAR *) &ChanID); /* * Progress IE @@ -378,15 +377,15 @@ static FIO_CHANNEL_REQUEST_FUNCTION(isdn_channel_request) Progress.CodStand = Q931_CODING_ITU; /* 0 = ITU */ Progress.Location = 0; /* 0 = User, 1 = Private Network */ Progress.ProgDesc = 3; /* 1 = Not end-to-end ISDN */ - gen->ProgInd = Q931AppendIE((L3UCHAR *)gen, (L3UCHAR *)&Progress); + gen->ProgInd = Q931AppendIE(gen, (L3UCHAR *)&Progress); /* * Display IE */ - if (!(isdn_data->opts & FTDM_ISDN_OPT_OMIT_DISPLAY_IE)) { + if (!(isdn_data->opts & FTDM_ISDN_OPT_OMIT_DISPLAY_IE) && FTDM_SPAN_IS_NT(span)) { Q931InitIEDisplay(&Display); Display.Size = Display.Size + (unsigned char)strlen(caller_data->cid_name); - gen->Display = Q931AppendIE((L3UCHAR *) gen, (L3UCHAR *) &Display); + gen->Display = Q931AppendIE(gen, (L3UCHAR *) &Display); ptrDisplay = Q931GetIEPtr(gen->Display, gen->buf); ftdm_copy_string((char *)ptrDisplay->Display, caller_data->cid_name, strlen(caller_data->cid_name)+1); } @@ -400,7 +399,7 @@ static FIO_CHANNEL_REQUEST_FUNCTION(isdn_channel_request) CallingNum.PresInd = Q931_PRES_ALLOWED; CallingNum.ScreenInd = Q931_SCREEN_USER_NOT_SCREENED; CallingNum.Size = CallingNum.Size + (unsigned char)strlen(caller_data->cid_num.digits); - gen->CallingNum = Q931AppendIE((L3UCHAR *) gen, (L3UCHAR *) &CallingNum); + gen->CallingNum = Q931AppendIE(gen, (L3UCHAR *) &CallingNum); ptrCallingNum = Q931GetIEPtr(gen->CallingNum, gen->buf); ftdm_copy_string((char *)ptrCallingNum->Digit, caller_data->cid_num.digits, strlen(caller_data->cid_num.digits)+1); @@ -411,10 +410,10 @@ static FIO_CHANNEL_REQUEST_FUNCTION(isdn_channel_request) Q931InitIECalledNum(&CalledNum); CalledNum.TypNum = Q931_TON_UNKNOWN; CalledNum.NumPlanID = Q931_NUMPLAN_E164; - CalledNum.Size = CalledNum.Size + (unsigned char)strlen(caller_data->dnis.digits); - gen->CalledNum = Q931AppendIE((L3UCHAR *) gen, (L3UCHAR *) &CalledNum); + CalledNum.Size = CalledNum.Size + (unsigned char)strlen(caller_data->ani.digits); + gen->CalledNum = Q931AppendIE(gen, (L3UCHAR *) &CalledNum); ptrCalledNum = Q931GetIEPtr(gen->CalledNum, gen->buf); - ftdm_copy_string((char *)ptrCalledNum->Digit, caller_data->dnis.digits, strlen(caller_data->dnis.digits)+1); + ftdm_copy_string((char *)ptrCalledNum->Digit, caller_data->ani.digits, strlen(caller_data->ani.digits)+1); /* * High-Layer Compatibility IE (Note: Required for AVM FritzBox) @@ -424,28 +423,28 @@ static FIO_CHANNEL_REQUEST_FUNCTION(isdn_channel_request) HLComp.Interpret = 4; /* only possible value */ HLComp.PresMeth = 1; /* High-layer protocol profile */ HLComp.HLCharID = 1; /* Telephony = 1, Fax G2+3 = 4, Fax G4 = 65 (Class I)/ 68 (Class II or III) */ - gen->HLComp = Q931AppendIE((L3UCHAR *) gen, (L3UCHAR *) &HLComp); + gen->HLComp = Q931AppendIE(gen, (L3UCHAR *) &HLComp); caller_data->call_state = FTDM_CALLER_STATE_DIALING; - Q931Rx43(&isdn_data->q931, (L3UCHAR *) gen, gen->Size); - + Q931Rx43(&isdn_data->q931, gen, gen->Size); + isdn_data->outbound_crv[gen->CRV] = caller_data; //isdn_data->channels_local_crv[gen->CRV] = ftdmchan; while(ftdm_running() && caller_data->call_state == FTDM_CALLER_STATE_DIALING) { ftdm_sleep(1); - + if (!--sanity) { caller_data->call_state = FTDM_CALLER_STATE_FAIL; break; } } isdn_data->outbound_crv[gen->CRV] = NULL; - + if (caller_data->call_state == FTDM_CALLER_STATE_SUCCESS) { ftdm_channel_t *new_chan = NULL; int fail = 1; - + new_chan = NULL; if (caller_data->chan_id < FTDM_MAX_CHANNELS_SPAN && caller_data->chan_id <= span->chan_count) { new_chan = span->channels[caller_data->chan_id]; @@ -456,7 +455,7 @@ static FIO_CHANNEL_REQUEST_FUNCTION(isdn_channel_request) if (new_chan->state == FTDM_CHANNEL_STATE_DOWN || new_chan->state >= FTDM_CHANNEL_STATE_TERMINATING) { int x = 0; ftdm_log(FTDM_LOG_WARNING, "Channel %d:%d ~ %d:%d is already in use waiting for it to become available.\n"); - + for (x = 0; x < 200; x++) { if (!ftdm_test_flag(new_chan, FTDM_CHANNEL_INUSE)) { break; @@ -493,9 +492,9 @@ static FIO_CHANNEL_REQUEST_FUNCTION(isdn_channel_request) } fail = 0; - } + } } - + if (!fail) { *ftdmchan = new_chan; return FTDM_SUCCESS; @@ -510,13 +509,13 @@ static FIO_CHANNEL_REQUEST_FUNCTION(isdn_channel_request) //should we be casting here.. or do we need to translate value? cause.Value = (unsigned char) FTDM_CAUSE_WRONG_CALL_STATE; *cause.Diag = '\0'; - gen->Cause = Q931AppendIE((L3UCHAR *) gen, (L3UCHAR *) &cause); - Q931Rx43(&isdn_data->q931, (L3UCHAR *) gen, gen->Size); + gen->Cause = Q931AppendIE(gen, (L3UCHAR *) &cause); + Q931Rx43(&isdn_data->q931, gen, gen->Size); if (gen->CRV) { Q931ReleaseCRV(&isdn_data->q931, gen->CRV); } - + if (new_chan) { ftdm_log(FTDM_LOG_CRIT, "Channel is busy\n"); } else { @@ -524,20 +523,13 @@ static FIO_CHANNEL_REQUEST_FUNCTION(isdn_channel_request) } } } - + *ftdmchan = NULL; return FTDM_FAIL; } +#endif /* __TODO__ */ -/** - * \brief Handler for Q931 error - * \param pvt Private structure (span?) - * \param id Error number - * \param p1 ?? - * \param p2 ?? - * \return 0 - */ static L3INT ftdm_isdn_931_err(void *pvt, L3INT id, L3INT p1, L3INT p2) { ftdm_log(FTDM_LOG_ERROR, "ERROR: [%s] [%d] [%d]\n", q931_error_to_name(id), p1, p2); @@ -545,21 +537,218 @@ static L3INT ftdm_isdn_931_err(void *pvt, L3INT id, L3INT p1, L3INT p2) } /** - * \brief Handler for Q931 event message - * \param pvt Span to handle - * \param msg Message string - * \param mlen Message string length - * \return 0 + * \brief The new call event handler + * \note W000t!!! \o/ ;D + * \todo A lot + */ +static void ftdm_isdn_call_event(struct Q931_Call *call, struct Q931_CallEvent *event, void *priv) +{ + Q931_TrunkInfo_t *trunk = NULL; + ftdm_isdn_data_t *isdn_data = NULL; + ftdm_span_t *zspan = NULL; + assert(call); + assert(event); + + trunk = Q931CallGetTrunk(call); + assert(trunk); + + zspan = Q931CallGetPrivate(call); + if (!zspan) { + zspan = priv; + Q931CallSetPrivate(call, zspan); + } + assert(zspan); + + isdn_data = zspan->signal_data; + + if (Q931CallIsGlobal(call)) { + /* + * Global event + */ + + ftdm_log(FTDM_LOG_DEBUG, "Received global event from Q.931\n"); + } + else { + ftdm_channel_t *ftdmchan = NULL; + ftdm_sigmsg_t sig; + int call_crv = Q931CallGetCRV(call); + int type; + + /* + * Call-specific event + */ + ftdm_log(FTDM_LOG_DEBUG, "Received call-specific event from Q.931 for call %d [%hu]\n", Q931CallGetCRV(call), Q931CallGetCRV(call)); + + /* + * Try to get associated zap channel + * and init sigmsg struct if there is one + */ + ftdmchan = Q931CallIsOutgoing(call) ? isdn_data->channels_local_crv[call_crv] : isdn_data->channels_remote_crv[call_crv]; + if (ftdmchan) { + memset(&sig, 0, sizeof(ftdm_sigmsg_t)); + sig.chan_id = ftdmchan->chan_id; + sig.span_id = ftdmchan->span_id; + sig.channel = ftdmchan; + } + + type = Q931CallEventGetType(event); + + if (type == Q931_EVENT_TYPE_CRV) { + + ftdm_log(FTDM_LOG_DEBUG, "\tCRV event\n"); + + switch (Q931CallEventGetId(event)) { + case Q931_EVENT_RELEASE_CRV: + { + /* WARNING contains old interface code, yuck! */ + if (!ftdmchan) { + ftdm_log(FTDM_LOG_DEBUG, "Call %d [0x%x] not associated to zap channel\n", call_crv, call_crv); + return; + } + + if (ftdmchan->state != FTDM_CHANNEL_STATE_DOWN) { + ftdm_log(FTDM_LOG_DEBUG, "Channel %d:%d not in DOWN state, cleaning up\n", + ftdmchan->span_id, ftdmchan->chan_id); + + /* + * Send hangup signal to mod_openzap + */ + if (!sig.channel->caller_data.hangup_cause) { + sig.channel->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_CLEARING; + } + + sig.event_id = FTDM_SIGEVENT_STOP; + isdn_data->sig_cb(&sig); + + /* Release zap channel */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + } + return; + } + break; + default: + ftdm_log(FTDM_LOG_ERROR, "Unknown CRV event: %d\n", Q931CallEventGetId(event)); + return; + } + } + else if (type == Q931_EVENT_TYPE_TIMER) { + struct Q931_CallTimerEvent *timer_evt = Q931CallEventGetData(event); + + ftdm_log(FTDM_LOG_DEBUG, "\tTimer event\n"); + assert(timer_evt->id); + + switch (timer_evt->id) { + case Q931_TIMER_T303: + /* + * SETUP timeout + * + * TE-mode: Q931_EVENT_SETUP_CONFIRM (error) + * NT-mode: Q931_EVENT_RELEASE_INDICATION + */ + { + /* WARNING contains old interface code, yuck! */ + if (!ftdmchan) { + ftdm_log(FTDM_LOG_ERROR, "Call %d [0x%x] not associated to zap channel\n", call_crv, call_crv); + return; + } + + ftdm_log(FTDM_LOG_DEBUG, "Call setup failed on channel %d:%d\n", ftdmchan->span_id, ftdmchan->chan_id); + + /* + * Send signal to mod_openzap + */ + sig.channel->caller_data.hangup_cause = FTDM_CAUSE_NETWORK_OUT_OF_ORDER; + + sig.event_id = FTDM_SIGEVENT_STOP; + isdn_data->sig_cb(&sig); + + /* Release zap channel */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + return; + } + break; + + default: + ftdm_log(FTDM_LOG_ERROR, "Unhandled timer event %d\n", timer_evt->id); + } + } + else if (type == Q931_EVENT_TYPE_MESSAGE) { + struct Q931_CallMessageEvent *msg_evt = Q931CallEventGetData(event); + + ftdm_log(FTDM_LOG_DEBUG, "\tMessage event\n"); + assert(msg_evt); + + /* + * Slowly move stuff from the old event handler into this part... + */ + switch (Q931CallEventGetId(event)) { + case Q931_EVENT_SETUP_CONFIRM: + case Q931_EVENT_SETUP_COMPLETE_INDICATION: /* CONNECT */ + { + /* WARNING contains old interface code, yuck! */ + if (!ftdmchan) { + ftdm_log(FTDM_LOG_ERROR, "Call %d [0x%x] not associated to zap channel\n", call_crv, call_crv); + return; + } + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); + } + break; + + default: + ftdm_log(FTDM_LOG_DEBUG, "Not yet handled message event %d\n", Q931CallEventGetId(event)); + } + } + else { + ftdm_log(FTDM_LOG_ERROR, "Unknown event type %d\n", type); + } + } +} + +/** + * Copy callednum, readding prefix as needed */ -static L3INT ftdm_isdn_931_34(void *pvt, L2UCHAR *msg, L2INT mlen) +static void __isdn_get_number(const char *digits, const int ton, char *buf, int size) +{ + int offset = 0; + + if (!digits || !buf || size <= 0) { + return; + } + + switch (ton) { + case Q931_TON_NATIONAL: + offset = strlen(DEFAULT_NATIONAL_PREFIX); + memcpy(buf, DEFAULT_NATIONAL_PREFIX, offset); + break; + case Q931_TON_INTERNATIONAL: + offset = strlen(DEFAULT_INTERNATIONAL_PREFIX); + memcpy(buf, DEFAULT_INTERNATIONAL_PREFIX, offset); + break; + default: + break; + } + + strncpy(&buf[offset], digits, size - (offset + 1)); + buf[size - 1] = '\0'; +} + +#define isdn_get_number(num, buf) \ + __isdn_get_number((const char *)(num)->Digit, (num)->TypNum, (char *)buf, sizeof(buf)) + + +/** + * \brief The old call event handler (err, call message handler) + * \todo This one must die! + */ +static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic *msg, int mlen) { ftdm_span_t *span = (ftdm_span_t *) pvt; ftdm_isdn_data_t *isdn_data = span->signal_data; Q931mes_Generic *gen = (Q931mes_Generic *) msg; - uint32_t chan_id = 0; + int chan_id = 0; int chan_hunt = 0; ftdm_channel_t *ftdmchan = NULL; - ftdm_caller_data_t *caller_data = NULL; +// ftdm_caller_data_t *caller_data = NULL; if (Q931IsIEPresent(gen->ChanID)) { Q931ie_ChanID *chanid = Q931GetIEPtr(gen->ChanID, gen->buf); @@ -580,9 +769,30 @@ static L3INT ftdm_isdn_931_34(void *pvt, L2UCHAR *msg, L2INT mlen) assert(span != NULL); assert(isdn_data != NULL); - + + /* + * Support code for the new event handling system + * Remove this as soon as we have the new api to set up calls + */ +#ifdef __OLD__ + if (gen->CRV) { + struct Q931_Call *call; + + call = Q931GetCallByCRV(&isdn_data->q931, gen->CRV); + if (call && !Q931CallGetPrivate(call)) { + ftdm_log(FTDM_LOG_DEBUG, "Storing reference to current span in call %d [0x%x]\n", gen->CRV, gen->CRV); + Q931CallSetPrivate(call, span); + } + } +#else + if (call && !Q931CallGetPrivate(call)) { + ftdm_log(FTDM_LOG_DEBUG, "Storing reference to current span in call %d [0x%x]\n", gen->CRV, gen->CRV); + Q931CallSetPrivate(call, span); + } +#endif ftdm_log(FTDM_LOG_DEBUG, "Yay I got an event! Type:[%02x] Size:[%d] CRV: %d (%#hx, CTX: %s)\n", gen->MesType, gen->Size, gen->CRV, gen->CRV, gen->CRVFlag ? "Terminator" : "Originator"); +#ifdef __TODO_OR_REMOVE__ if (gen->CRVFlag && (caller_data = isdn_data->outbound_crv[gen->CRV])) { if (chan_id) { caller_data->chan_id = chan_id; @@ -603,9 +813,10 @@ static L3INT ftdm_isdn_931_34(void *pvt, L2UCHAR *msg, L2INT mlen) caller_data->call_state = FTDM_CALLER_STATE_FAIL; break; } - + return 0; } +#endif if (gen->CRVFlag) { ftdmchan = isdn_data->channels_local_crv[gen->CRV]; @@ -630,7 +841,7 @@ static L3INT ftdm_isdn_931_34(void *pvt, L2UCHAR *msg, L2INT mlen) ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); } break; - case 1: + case 1: { /* change status to "maintenance" */ ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_SUSPENDED); ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); @@ -664,7 +875,12 @@ static L3INT ftdm_isdn_931_34(void *pvt, L2UCHAR *msg, L2INT mlen) ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); } else { uint32_t i; + for (i = 1; i < span->chan_count; i++) { + /* Skip channels that are down and D-Channels (#OpenZAP-39) */ + if (span->channels[i]->state == FTDM_CHANNEL_STATE_DOWN || span->channels[i]->type == FTDM_CHAN_TYPE_DQ921) + continue; + ftdm_set_state_locked((span->channels[i]), FTDM_CHANNEL_STATE_RESTART); } } @@ -699,7 +915,7 @@ static L3INT ftdm_isdn_931_34(void *pvt, L2UCHAR *msg, L2INT mlen) sig.channel->caller_data.hangup_cause = (cause) ? cause->Value : FTDM_CAUSE_NORMAL_UNSPECIFIED; sig.event_id = FTDM_SIGEVENT_STOP; - status = ftdm_span_send_signal(ftdmchan->span, &sig); + status = isdn_data->sig_cb(&sig); ftdm_log(FTDM_LOG_DEBUG, "Received %s in state %s, requested hangup for channel %d:%d\n", what, ftdm_channel_state2str(ftdmchan->state), ftdmchan->span_id, chan_id); } @@ -741,17 +957,21 @@ static L3INT ftdm_isdn_931_34(void *pvt, L2UCHAR *msg, L2INT mlen) } break; case Q931mes_CONNECT: +#if 0 /* Handled by new event code */ { if (ftdmchan) { ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); +#if 0 /* Auto-Ack is enabled, we actually don't need this */ gen->MesType = Q931mes_CONNECT_ACKNOWLEDGE; gen->CRVFlag = 0; /* outbound */ - Q931Rx43(&isdn_data->q931, (L3UCHAR *) gen, gen->Size); + Q931Rx43(&isdn_data->q931, gen, gen->Size); +#endif } else { ftdm_log(FTDM_LOG_CRIT, "Received Connect with no matching channel %d\n", chan_id); } } +#endif break; case Q931mes_SETUP: { @@ -771,13 +991,13 @@ static L3INT ftdm_isdn_931_34(void *pvt, L2UCHAR *msg, L2INT mlen) ftdm_channel_state2str(ftdmchan->state)); break; } - + ftdmchan = NULL; /* * Channel selection for incoming calls: */ if (FTDM_SPAN_IS_NT(span) && chan_hunt) { - uint32_t x; + int x; /* * In NT-mode with channel selection "any", @@ -865,14 +1085,21 @@ static L3INT ftdm_isdn_931_34(void *pvt, L2UCHAR *msg, L2INT mlen) memset(ftdmchan->mod_data, 0, sizeof(ftdm_isdn_bchan_data_t)); } - ftdm_set_string(ftdmchan->caller_data.cid_num.digits, (char *)callingnum->Digit); - ftdm_set_string(ftdmchan->caller_data.cid_name, (char *)callingnum->Digit); - ftdm_set_string(ftdmchan->caller_data.ani.digits, (char *)callingnum->Digit); + /* copy number readd prefix as needed */ + isdn_get_number(callingnum, ftdmchan->caller_data.cid_num.digits); + isdn_get_number(callingnum, ftdmchan->caller_data.cid_name); + isdn_get_number(callingnum, ftdmchan->caller_data.ani.digits); + +// ftdm_set_string(ftdmchan->caller_data.cid_num.digits, (char *)callingnum->Digit); +// ftdm_set_string(ftdmchan->caller_data.cid_name, (char *)callingnum->Digit); +// ftdm_set_string(ftdmchan->caller_data.ani.digits, (char *)callingnum->Digit); if (!overlap_dial) { - ftdm_set_string(ftdmchan->caller_data.dnis.digits, (char *)callednum->Digit); +// ftdm_set_string(ftdmchan->caller_data.dnis.digits, (char *)callednum->Digit); + isdn_get_number(callednum, ftdmchan->caller_data.dnis.digits); } - +#ifdef __TODO_OR_REMOVE__ ftdmchan->caller_data.CRV = gen->CRV; +#endif if (cplen > sizeof(ftdmchan->caller_data.raw_data)) { cplen = sizeof(ftdmchan->caller_data.raw_data); } @@ -880,8 +1107,8 @@ static L3INT ftdm_isdn_931_34(void *pvt, L2UCHAR *msg, L2INT mlen) memcpy(ftdmchan->caller_data.raw_data, msg, cplen); ftdmchan->caller_data.raw_data_len = cplen; fail = 0; - } - } + } + } if (fail) { Q931ie_Cause cause; @@ -895,8 +1122,8 @@ static L3INT ftdm_isdn_931_34(void *pvt, L2UCHAR *msg, L2INT mlen) //should we be casting here.. or do we need to translate value? cause.Value = (unsigned char)((fail_cause) ? fail_cause : FTDM_CAUSE_WRONG_CALL_STATE); *cause.Diag = '\0'; - gen->Cause = Q931AppendIE((L3UCHAR *) gen, (L3UCHAR *) &cause); - Q931Rx43(&isdn_data->q931, (L3UCHAR *) gen, gen->Size); + gen->Cause = Q931AppendIE(gen, (L3UCHAR *) &cause); + Q931Rx43(&isdn_data->q931, gen, gen->Size); if (gen->CRV) { Q931ReleaseCRV(&isdn_data->q931, gen->CRV); @@ -907,7 +1134,7 @@ static L3INT ftdm_isdn_931_34(void *pvt, L2UCHAR *msg, L2INT mlen) } else { ftdm_log(FTDM_LOG_CRIT, "Failed to open channel for new setup message\n"); } - + } else { Q931ie_ChanID ChanID; @@ -924,7 +1151,7 @@ static L3INT ftdm_isdn_931_34(void *pvt, L2UCHAR *msg, L2INT mlen) } else { ChanID.InfoChanSel = (unsigned char)ftdmchan->chan_id & 0x03; /* None = 0, B1 = 1, B2 = 2, Any = 3 */ } - gen->ChanID = Q931AppendIE((L3UCHAR *) gen, (L3UCHAR *) &ChanID); + gen->ChanID = Q931AppendIE(gen, (L3UCHAR *) &ChanID); if (overlap_dial) { Q931ie_ProgInd progress; @@ -934,17 +1161,17 @@ static L3INT ftdm_isdn_931_34(void *pvt, L2UCHAR *msg, L2INT mlen) */ progress.IEId = Q931ie_PROGRESS_INDICATOR; progress.Size = sizeof(Q931ie_ProgInd); - progress.CodStand = Q931_CODING_ITU; /* ITU */ + progress.CodStand = Q931_CODING_ITU; /* ITU */ progress.Location = 1; /* private network serving the local user */ progress.ProgDesc = 8; /* call is not end-to-end isdn = 1, in-band information available = 8 */ - gen->ProgInd = Q931AppendIE((L3UCHAR *) gen, (L3UCHAR *) &progress); + gen->ProgInd = Q931AppendIE(gen, (L3UCHAR *) &progress); /* * Send SETUP ACK */ gen->MesType = Q931mes_SETUP_ACKNOWLEDGE; gen->CRVFlag = 1; /* inbound call */ - Q931Rx43(&isdn_data->q931, (L3UCHAR *) gen, gen->Size); + Q931Rx43(&isdn_data->q931, gen, gen->Size); ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DIALTONE); } else { @@ -999,7 +1226,7 @@ static L3INT ftdm_isdn_931_34(void *pvt, L2UCHAR *msg, L2INT mlen) } /* TODO: make this more safe with strncat() */ - pos = (int)strlen(ftdmchan->caller_data.dnis.digits); + pos = strlen(ftdmchan->caller_data.dnis.digits); strcat(&ftdmchan->caller_data.dnis.digits[pos], (char *)callednum->Digit); /* update timer */ @@ -1020,61 +1247,6 @@ static L3INT ftdm_isdn_931_34(void *pvt, L2UCHAR *msg, L2INT mlen) } break; - case Q931mes_STATUS_ENQUIRY: - { - /* - * !! HACK ALERT !! - * - * Map FreeTDM channel states to Q.931 states - */ - Q931ie_CallState state; - Q931ie_Cause cause; - - gen->MesType = Q931mes_STATUS; - gen->CRVFlag = gen->CRVFlag ? 0 : 1; - - state.CodStand = Q931_CODING_ITU; /* ITU-T */ - state.CallState = Q931_U0; /* Default: Null */ - - cause.IEId = Q931ie_CAUSE; - cause.Size = sizeof(Q931ie_Cause); - cause.CodStand = Q931_CODING_ITU; /* ITU */ - cause.Location = 1; /* private network */ - cause.Recom = 1; /* */ - *cause.Diag = '\0'; - - if(ftdmchan) { - switch(ftdmchan->state) { - case FTDM_CHANNEL_STATE_UP: - state.CallState = Q931_U10; /* Active */ - break; - case FTDM_CHANNEL_STATE_RING: - state.CallState = Q931_U6; /* Call present */ - break; - case FTDM_CHANNEL_STATE_DIALING: - state.CallState = Q931_U1; /* Call initiated */ - break; - case FTDM_CHANNEL_STATE_DIALTONE: - state.CallState = Q931_U25; /* Overlap receiving */ - break; - - /* TODO: map missing states */ - - default: - state.CallState = Q931_U0; - } - - cause.Value = 30; /* response to STATUS ENQUIRY */ - } else { - cause.Value = 98; /* */ - } - - gen->CallState = Q931AppendIE((L3UCHAR *) gen, (L3UCHAR *) &state); - gen->Cause = Q931AppendIE((L3UCHAR *) gen, (L3UCHAR *) &cause); - Q931Rx43(&isdn_data->q931, (L3UCHAR *) gen, gen->Size); - } - break; - default: ftdm_log(FTDM_LOG_CRIT, "Received unhandled message %d (%#x)\n", (int)gen->MesType, (int)gen->MesType); break; @@ -1084,17 +1256,10 @@ static L3INT ftdm_isdn_931_34(void *pvt, L2UCHAR *msg, L2INT mlen) return 0; } -/** - * \brief Handler for Q921 read event - * \param pvt Span were message is coming from - * \param ind Q921 indication - * \param tei Terminal Endpoint Identifier - * \param msg Message string - * \param mlen Message string length - * \return 0 on success, 1 on failure - */ static int ftdm_isdn_921_23(void *pvt, Q921DLMsg_t ind, L2UCHAR tei, L2UCHAR *msg, L2INT mlen) { + ftdm_span_t *span = pvt; + ftdm_isdn_data_t *isdn_data = span->signal_data; int ret, offset = (ind == Q921_DL_DATA) ? 4 : 3; char bb[4096] = ""; @@ -1102,20 +1267,14 @@ static int ftdm_isdn_921_23(void *pvt, Q921DLMsg_t ind, L2UCHAR tei, L2UCHAR *ms case Q921_DL_DATA: case Q921_DL_UNIT_DATA: print_hex_bytes(msg + offset, mlen - offset, bb, sizeof(bb)); -#ifdef HAVE_LIBPCAP - /*Q931ToPcap*/ - if(do_q931ToPcap==1){ - ftdm_span_t *span = (ftdm_span_t *) pvt; - if(writeQ931PacketToPcap(msg + offset, mlen - offset, span->span_id, 1) != FTDM_SUCCESS){ - ftdm_log(FTDM_LOG_WARNING, "Couldn't write Q931 buffer to pcap file!\n"); - } - } - /*Q931ToPcap done*/ + ftdm_log(FTDM_LOG_DEBUG, "READ %d\n%s\n%s\n\n", (int)mlen - offset, LINE, bb); +#ifdef HAVE_PCAP + if (isdn_pcap_capture_l3only(isdn_data)) { + isdn_pcap_write(isdn_data, msg, mlen, (ind == Q921_DL_UNIT_DATA) ? ISDN_PCAP_INCOMING_BCAST : ISDN_PCAP_INCOMING); + } #endif - ftdm_log(FTDM_LOG_DEBUG, "READ %d\n%s\n%s\n\n\n", (int)mlen - offset, LINE, bb); - default: - ret = Q931Rx23(pvt, ind, tei, msg, mlen); + ret = Q931Rx23(&isdn_data->q931, ind, tei, msg, mlen); if (ret != 0) ftdm_log(FTDM_LOG_DEBUG, "931 parse error [%d] [%s]\n", ret, q931_error_to_name(ret)); break; @@ -1124,35 +1283,22 @@ static int ftdm_isdn_921_23(void *pvt, Q921DLMsg_t ind, L2UCHAR tei, L2UCHAR *ms return ((ret >= 0) ? 1 : 0); } -/** - * \brief Handler for Q921 write event - * \param pvt Span were message is coming from - * \param msg Message string - * \param mlen Message string length - * \return 0 on success, -1 on failure - */ static int ftdm_isdn_921_21(void *pvt, L2UCHAR *msg, L2INT mlen) { ftdm_span_t *span = (ftdm_span_t *) pvt; ftdm_size_t len = (ftdm_size_t) mlen; ftdm_isdn_data_t *isdn_data = span->signal_data; -#ifdef IODEBUG - char bb[4096] = ""; - print_hex_bytes(msg, len, bb, sizeof(bb)); - print_bits(msg, (int)len, bb, sizeof(bb), FTDM_ENDIAN_LITTLE, 0); - ftdm_log(FTDM_LOG_DEBUG, "WRITE %d\n%s\n%s\n\n", (int)len, LINE, bb); + assert(span != NULL); +#ifdef HAVE_PCAP + if (isdn_pcap_capture_both(isdn_data)) { + isdn_pcap_write(isdn_data, msg, mlen, ISDN_PCAP_OUTGOING); + } #endif - - assert(span != NULL); return ftdm_channel_write(isdn_data->dchan, msg, len, &len) == FTDM_SUCCESS ? 0 : -1; } -/** - * \brief Handler for channel state change - * \param ftdmchan Channel to handle - */ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) { Q931mes_Generic *gen = (Q931mes_Generic *) ftdmchan->caller_data.raw_data; @@ -1160,7 +1306,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) ftdm_sigmsg_t sig; ftdm_status_t status; - ftdm_log(FTDM_LOG_DEBUG, "%d:%d STATE [%s]\n", + ftdm_log(FTDM_LOG_DEBUG, "%d:%d STATE [%s]\n", ftdmchan->span_id, ftdmchan->chan_id, ftdm_channel_state2str(ftdmchan->state)); memset(&sig, 0, sizeof(sig)); @@ -1186,11 +1332,15 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) { if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { sig.event_id = FTDM_SIGEVENT_PROGRESS; - if ((status = ftdm_span_send_signal(ftdmchan->span, &sig) != FTDM_SUCCESS)) { + if ((status = isdn_data->sig_cb(&sig) != FTDM_SUCCESS)) { ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); } } else { + int crv = gen->CRV; + + Q931InitMesGeneric(gen); gen->MesType = Q931mes_CALL_PROCEEDING; + gen->CRV = crv; gen->CRVFlag = 1; /* inbound */ if (FTDM_SPAN_IS_NT(ftdmchan->span)) { @@ -1210,10 +1360,10 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) } else { ChanID.InfoChanSel = (unsigned char)ftdmchan->chan_id & 0x03; /* None = 0, B1 = 1, B2 = 2, Any = 3 */ } - gen->ChanID = Q931AppendIE((L3UCHAR *) gen, (L3UCHAR *) &ChanID); + gen->ChanID = Q931AppendIE(gen, (L3UCHAR *) &ChanID); } - Q931Rx43(&isdn_data->q931, (void *)gen, gen->Size); + Q931Rx43(&isdn_data->q931, gen, gen->Size); } } break; @@ -1230,7 +1380,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) { if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { sig.event_id = FTDM_SIGEVENT_START; - if ((status = ftdm_span_send_signal(ftdmchan->span, &sig) != FTDM_SUCCESS)) { + if ((status = isdn_data->sig_cb(&sig) != FTDM_SUCCESS)) { ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); } } @@ -1240,7 +1390,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) { ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_UNSPECIFIED; sig.event_id = FTDM_SIGEVENT_RESTART; - status = ftdm_span_send_signal(ftdmchan->span, &sig); + status = isdn_data->sig_cb(&sig); ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); } break; @@ -1248,7 +1398,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) { if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { sig.event_id = FTDM_SIGEVENT_PROGRESS_MEDIA; - if ((status = ftdm_span_send_signal(ftdmchan->span, &sig) != FTDM_SUCCESS)) { + if ((status = isdn_data->sig_cb(&sig) != FTDM_SUCCESS)) { ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); } } else { @@ -1260,7 +1410,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) } gen->MesType = Q931mes_ALERTING; gen->CRVFlag = 1; /* inbound call */ - Q931Rx43(&isdn_data->q931, (void *)gen, gen->Size); + Q931Rx43(&isdn_data->q931, gen, gen->Size); } } break; @@ -1268,7 +1418,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) { if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { sig.event_id = FTDM_SIGEVENT_UP; - if ((status = ftdm_span_send_signal(ftdmchan->span, &sig) != FTDM_SUCCESS)) { + if ((status = isdn_data->sig_cb(&sig) != FTDM_SUCCESS)) { ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); } } else { @@ -1281,7 +1431,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) gen->MesType = Q931mes_CONNECT; gen->BearerCap = 0; gen->CRVFlag = 1; /* inbound call */ - Q931Rx43(&isdn_data->q931, (void *)gen, ftdmchan->caller_data.raw_data_len); + Q931Rx43(&isdn_data->q931, gen, ftdmchan->caller_data.raw_data_len); } } break; @@ -1305,7 +1455,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) /* * Q.931 Setup Message - */ + */ Q931InitMesGeneric(gen); gen->MesType = Q931mes_SETUP; gen->CRVFlag = 0; /* outbound(?) */ @@ -1320,7 +1470,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) BearerCap.ITR = Q931_ITR_64K; /* 64k = 16, Packet mode = 0 */ BearerCap.Layer1Ident = 1; BearerCap.UIL1Prot = (codec == FTDM_CODEC_ALAW) ? 3 : 2; /* U-law = 2, A-law = 3 */ - gen->BearerCap = Q931AppendIE((L3UCHAR *) gen, (L3UCHAR *) &BearerCap); + gen->BearerCap = Q931AppendIE(gen, (L3UCHAR *) &BearerCap); /* * ChannelID IE @@ -1335,7 +1485,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) } else { ChanID.InfoChanSel = (unsigned char)ftdmchan->chan_id & 0x03; /* None = 0, B1 = 1, B2 = 2, Any = 3 */ } - gen->ChanID = Q931AppendIE((L3UCHAR *) gen, (L3UCHAR *) &ChanID); + gen->ChanID = Q931AppendIE(gen, (L3UCHAR *) &ChanID); /* * Progress IE @@ -1344,29 +1494,29 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) Progress.CodStand = Q931_CODING_ITU; /* 0 = ITU */ Progress.Location = 0; /* 0 = User, 1 = Private Network */ Progress.ProgDesc = 3; /* 1 = Not end-to-end ISDN */ - gen->ProgInd = Q931AppendIE((L3UCHAR *)gen, (L3UCHAR *)&Progress); + gen->ProgInd = Q931AppendIE(gen, (L3UCHAR *)&Progress); /* * Display IE */ - if (!(isdn_data->opts & FTDM_ISDN_OPT_OMIT_DISPLAY_IE)) { + if (!(isdn_data->opts & FTDM_ISDN_OPT_OMIT_DISPLAY_IE) && FTDM_SPAN_IS_NT(ftdmchan->span)) { Q931InitIEDisplay(&Display); Display.Size = Display.Size + (unsigned char)strlen(ftdmchan->caller_data.cid_name); - gen->Display = Q931AppendIE((L3UCHAR *) gen, (L3UCHAR *) &Display); + gen->Display = Q931AppendIE(gen, (L3UCHAR *) &Display); ptrDisplay = Q931GetIEPtr(gen->Display, gen->buf); ftdm_copy_string((char *)ptrDisplay->Display, ftdmchan->caller_data.cid_name, strlen(ftdmchan->caller_data.cid_name)+1); } /* * CallingNum IE - */ + */ Q931InitIECallingNum(&CallingNum); CallingNum.TypNum = ftdmchan->caller_data.ani.type; CallingNum.NumPlanID = Q931_NUMPLAN_E164; CallingNum.PresInd = Q931_PRES_ALLOWED; CallingNum.ScreenInd = Q931_SCREEN_USER_NOT_SCREENED; CallingNum.Size = CallingNum.Size + (unsigned char)strlen(ftdmchan->caller_data.cid_num.digits); - gen->CallingNum = Q931AppendIE((L3UCHAR *) gen, (L3UCHAR *) &CallingNum); + gen->CallingNum = Q931AppendIE(gen, (L3UCHAR *) &CallingNum); ptrCallingNum = Q931GetIEPtr(gen->CallingNum, gen->buf); ftdm_copy_string((char *)ptrCallingNum->Digit, ftdmchan->caller_data.cid_num.digits, strlen(ftdmchan->caller_data.cid_num.digits)+1); @@ -1374,12 +1524,12 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) * CalledNum IE */ Q931InitIECalledNum(&CalledNum); - CalledNum.TypNum = ftdmchan->caller_data.dnis.type; + CalledNum.TypNum = Q931_TON_UNKNOWN; CalledNum.NumPlanID = Q931_NUMPLAN_E164; - CalledNum.Size = CalledNum.Size + (unsigned char)strlen(ftdmchan->caller_data.dnis.digits); - gen->CalledNum = Q931AppendIE((L3UCHAR *) gen, (L3UCHAR *) &CalledNum); + CalledNum.Size = CalledNum.Size + (unsigned char)strlen(ftdmchan->caller_data.ani.digits); + gen->CalledNum = Q931AppendIE(gen, (L3UCHAR *) &CalledNum); ptrCalledNum = Q931GetIEPtr(gen->CalledNum, gen->buf); - ftdm_copy_string((char *)ptrCalledNum->Digit, ftdmchan->caller_data.dnis.digits, strlen(ftdmchan->caller_data.dnis.digits)+1); + ftdm_copy_string((char *)ptrCalledNum->Digit, ftdmchan->caller_data.ani.digits, strlen(ftdmchan->caller_data.ani.digits)+1); /* * High-Layer Compatibility IE (Note: Required for AVM FritzBox) @@ -1389,10 +1539,24 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) HLComp.Interpret = 4; /* only possible value */ HLComp.PresMeth = 1; /* High-layer protocol profile */ HLComp.HLCharID = Q931_HLCHAR_TELEPHONY; /* Telephony = 1, Fax G2+3 = 4, Fax G4 = 65 (Class I)/ 68 (Class II or III) */ /* TODO: make accessible from user layer */ - gen->HLComp = Q931AppendIE((L3UCHAR *) gen, (L3UCHAR *) &HLComp); + gen->HLComp = Q931AppendIE(gen, (L3UCHAR *) &HLComp); - Q931Rx43(&isdn_data->q931, (L3UCHAR *) gen, gen->Size); + Q931Rx43(&isdn_data->q931, gen, gen->Size); isdn_data->channels_local_crv[gen->CRV] = ftdmchan; + + /* + * Support code for the new event handling system + * Remove this as soon as we have the new api to set up calls + */ + if (gen->CRV) { + struct Q931_Call *call; + + call = Q931GetCallByCRV(&isdn_data->q931, gen->CRV); + if (call) { + ftdm_log(FTDM_LOG_DEBUG, "Storing reference to current span in call %d [0x%x]\n", gen->CRV, gen->CRV); + Q931CallSetPrivate(call, ftdmchan->span); + } + } } break; case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: @@ -1401,7 +1565,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) if(ftdmchan->last_state == FTDM_CHANNEL_STATE_HANGUP) { gen->MesType = Q931mes_RELEASE_COMPLETE; - Q931Rx43(&isdn_data->q931, (L3UCHAR *) gen, gen->Size); + Q931Rx43(&isdn_data->q931, gen, gen->Size); } ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); } @@ -1434,8 +1598,8 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) //cause.Value = (unsigned char) FTDM_CAUSE_UNALLOCATED; cause.Value = (unsigned char) ftdmchan->caller_data.hangup_cause; *cause.Diag = '\0'; - gen->Cause = Q931AppendIE((L3UCHAR *) gen, (L3UCHAR *) &cause); - Q931Rx43(&isdn_data->q931, (L3UCHAR *) gen, gen->Size); + gen->Cause = Q931AppendIE(gen, (L3UCHAR *) &cause); + Q931Rx43(&isdn_data->q931, gen, gen->Size); /* we're done, release channel */ //ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); @@ -1449,8 +1613,8 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) cause.Value = (unsigned char) ftdmchan->caller_data.hangup_cause; *cause.Diag = '\0'; - gen->Cause = Q931AppendIE((L3UCHAR *) gen, (L3UCHAR *) &cause); - Q931Rx43(&isdn_data->q931, (void *)gen, gen->Size); + gen->Cause = Q931AppendIE(gen, (L3UCHAR *) &cause); + Q931Rx43(&isdn_data->q931, gen, gen->Size); /* this will be triggered by the RELEASE_COMPLETE reply */ /* ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); */ @@ -1463,8 +1627,8 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) cause.Value = (unsigned char) ftdmchan->caller_data.hangup_cause; *cause.Diag = '\0'; - gen->Cause = Q931AppendIE((L3UCHAR *) gen, (L3UCHAR *) &cause); - Q931Rx43(&isdn_data->q931, (L3UCHAR *) gen, gen->Size); + gen->Cause = Q931AppendIE(gen, (L3UCHAR *) &cause); + Q931Rx43(&isdn_data->q931, gen, gen->Size); } } break; @@ -1473,20 +1637,16 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) ftdm_log(FTDM_LOG_DEBUG, "Terminating: Direction %s\n", ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) ? "Outbound" : "Inbound"); sig.event_id = FTDM_SIGEVENT_STOP; - status = ftdm_span_send_signal(ftdmchan->span, &sig); + status = isdn_data->sig_cb(&sig); gen->MesType = Q931mes_RELEASE; gen->CRVFlag = ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) ? 0 : 1; - Q931Rx43(&isdn_data->q931, (void *)gen, gen->Size); + Q931Rx43(&isdn_data->q931, gen, gen->Size); } default: break; } } -/** - * \brief Checks current state on a span - * \param span Span to check status on - */ static __inline__ void check_state(ftdm_span_t *span) { if (ftdm_test_flag(span, FTDM_SPAN_STATE_CHANGE)) { @@ -1504,56 +1664,79 @@ static __inline__ void check_state(ftdm_span_t *span) } } -/** - * \brief Processes FreeTDM event on a span - * \param span Span to process event on - * \param event Event to process - * \return Success or failure - */ + static __inline__ ftdm_status_t process_event(ftdm_span_t *span, ftdm_event_t *event) { - ftdm_log(FTDM_LOG_DEBUG, "EVENT [%s][%d:%d] STATE [%s]\n", + ftdm_isdn_data_t *isdn_data = span->signal_data; + ftdm_alarm_flag_t alarmbits; + ftdm_sigmsg_t sig; + + memset(&sig, 0, sizeof(sig)); + sig.chan_id = event->channel->chan_id; + sig.span_id = event->channel->span_id; + sig.channel = event->channel; + + ftdm_log(FTDM_LOG_DEBUG, "EVENT [%s][%d:%d] STATE [%s]\n", ftdm_oob_event2str(event->enum_id), event->channel->span_id, event->channel->chan_id, ftdm_channel_state2str(event->channel->state)); switch(event->enum_id) { case FTDM_OOB_ALARM_TRAP: { + sig.event_id = FTDM_OOB_ALARM_TRAP; if (event->channel->state != FTDM_CHANNEL_STATE_DOWN) { - if (event->channel->type == FTDM_CHAN_TYPE_B) { - ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_RESTART); - } + ftdm_set_state_locked(event->channel, FTDM_CHANNEL_STATE_RESTART); } - - ftdm_set_flag(event->channel, FTDM_CHANNEL_SUSPENDED); - - - ftdm_channel_get_alarms(event->channel); - ftdm_log(FTDM_LOG_WARNING, "channel %d:%d (%d:%d) has alarms! [%s]\n", - event->channel->span_id, event->channel->chan_id, - event->channel->physical_span_id, event->channel->physical_chan_id, + ftdm_channel_get_alarms(event->channel, &alarmbits); + isdn_data->sig_cb(&sig); + ftdm_log(FTDM_LOG_WARNING, "channel %d:%d (%d:%d) has alarms [%s]\n", + event->channel->span_id, event->channel->chan_id, + event->channel->physical_span_id, event->channel->physical_chan_id, event->channel->last_error); } break; case FTDM_OOB_ALARM_CLEAR: { - - ftdm_log(FTDM_LOG_WARNING, "channel %d:%d (%d:%d) alarms Cleared!\n", event->channel->span_id, event->channel->chan_id, - event->channel->physical_span_id, event->channel->physical_chan_id); - + sig.event_id = FTDM_OOB_ALARM_CLEAR; ftdm_clear_flag(event->channel, FTDM_CHANNEL_SUSPENDED); - ftdm_channel_get_alarms(event->channel); + ftdm_channel_get_alarms(event->channel, &alarmbits); + isdn_data->sig_cb(&sig); + } + break; +#ifdef __BROKEN_BY_FREETDM_CONVERSION__ + case FTDM_OOB_DTMF: /* Taken from ozmod_analog, minus the CALLWAITING state handling */ + { + const char * digit_str = (const char *)event->data; + + if(digit_str) { + fio_event_cb_t event_callback = NULL; + + ftdm_channel_queue_dtmf(event->channel, digit_str); + if (span->event_callback) { + event_callback = span->event_callback; + } else if (event->channel->event_callback) { + event_callback = event->channel->event_callback; + } + + if (event_callback) { + event->channel->event_header.channel = event->channel; + event->channel->event_header.e_type = FTDM_EVENT_DTMF; + event->channel->event_header.data = (void *)digit_str; + event_callback(event->channel, &event->channel->event_header); + event->channel->event_header.e_type = FTDM_EVENT_NONE; + event->channel->event_header.data = NULL; + } + ftdm_safe_free(event->data); + } } break; +#endif } return FTDM_SUCCESS; } -/** - * \brief Checks for events on a span - * \param span Span to check for events - */ + static __inline__ void check_events(ftdm_span_t *span) { ftdm_status_t status; @@ -1584,12 +1767,7 @@ static __inline__ void check_events(ftdm_span_t *span) } } -/** - * \brief Retrieves tone generation output to be sent - * \param ts Teletone generator - * \param map Tone map - * \return -1 on error, 0 on success - */ + static int teletone_handler(teletone_generation_session_t *ts, teletone_tone_map_t *map) { ftdm_buffer_t *dt_buffer = ts->user_data; @@ -1603,20 +1781,14 @@ static int teletone_handler(teletone_generation_session_t *ts, teletone_tone_map return 0; } -/** - * \brief Main thread function for tone generation on a span - * \param me Current thread - * \param obj Span to generate tones on - */ static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj) { ftdm_span_t *span = (ftdm_span_t *) obj; ftdm_isdn_data_t *isdn_data = span->signal_data; ftdm_buffer_t *dt_buffer = NULL; - teletone_generation_session_t ts = {{{{0}}}}; + teletone_generation_session_t ts = {{{{0}}}};; unsigned char frame[1024]; - uint32_t x; - int interval = 0; + int x, interval; int offset = 0; ftdm_log(FTDM_LOG_DEBUG, "ISDN tones thread starting.\n"); @@ -1647,7 +1819,7 @@ static void *ftdm_isdn_tones_run(ftdm_thread_t *me, void *obj) ts.duration = ts.rate; /* main loop */ - while(ftdm_running() && ftdm_test_flag(isdn_data, FTDM_ISDN_TONES_RUNNING) && !ftdm_test_flag(isdn_data, FTDM_ISDN_STOP)) { + while(ftdm_running() && ftdm_test_flag(isdn_data, FTDM_ISDN_RUNNING)) { ftdm_wait_flag_t flags; ftdm_status_t status; int last_chan_state = 0; @@ -1799,11 +1971,6 @@ done: return NULL; } -/** - * \brief Main thread function for an ISDN span - * \param me Current thread - * \param obj Span to monitor - */ static void *ftdm_isdn_run(ftdm_thread_t *me, void *obj) { ftdm_span_t *span = (ftdm_span_t *) obj; @@ -1813,15 +1980,16 @@ static void *ftdm_isdn_run(ftdm_thread_t *me, void *obj) int errs = 0; #ifdef WIN32 - timeBeginPeriod(1); + timeBeginPeriod(1); #endif ftdm_log(FTDM_LOG_DEBUG, "ISDN thread starting.\n"); ftdm_set_flag(isdn_data, FTDM_ISDN_RUNNING); Q921Start(&isdn_data->q921); + Q931Start(&isdn_data->q931); - while(ftdm_running() && ftdm_test_flag(isdn_data, FTDM_ISDN_RUNNING) && !ftdm_test_flag(isdn_data, FTDM_ISDN_STOP)) { + while(ftdm_running() && ftdm_test_flag(isdn_data, FTDM_ISDN_RUNNING)) { ftdm_wait_flag_t flags = FTDM_READ; ftdm_status_t status = ftdm_channel_wait(isdn_data->dchan, &flags, 100); @@ -1853,20 +2021,13 @@ static void *ftdm_isdn_run(ftdm_thread_t *me, void *obj) { errs = 0; if (flags & FTDM_READ) { - - if (ftdm_test_flag(isdn_data->dchan, FTDM_CHANNEL_SUSPENDED)) { - ftdm_clear_flag_all(span, FTDM_CHANNEL_SUSPENDED); - } len = sizeof(frame); if (ftdm_channel_read(isdn_data->dchan, frame, &len) == FTDM_SUCCESS) { -#ifdef IODEBUG - char bb[4096] = ""; - print_hex_bytes(frame, len, bb, sizeof(bb)); - - print_bits(frame, (int)len, bb, sizeof(bb), FTDM_ENDIAN_LITTLE, 0); - ftdm_log(FTDM_LOG_DEBUG, "READ %d\n%s\n%s\n\n", (int)len, LINE, bb); +#ifdef HAVE_PCAP + if (isdn_pcap_capture_both(isdn_data)) { + isdn_pcap_write(isdn_data, frame, len, ISDN_PCAP_INCOMING); + } #endif - Q921QueueHDLCFrame(&isdn_data->q921, frame, (int)len); Q921Rx12(&isdn_data->q921); } @@ -1877,45 +2038,28 @@ static void *ftdm_isdn_run(ftdm_thread_t *me, void *obj) break; } } - - done: + +done: ftdm_channel_close(&isdn_data->dchans[0]); ftdm_channel_close(&isdn_data->dchans[1]); ftdm_clear_flag(isdn_data, FTDM_ISDN_RUNNING); #ifdef WIN32 - timeEndPeriod(1); + timeEndPeriod(1); +#endif +#ifdef HAVE_PCAP + if (isdn_pcap_is_open(isdn_data)) { + isdn_pcap_close(isdn_data); + } #endif - ftdm_log(FTDM_LOG_DEBUG, "ISDN thread ended.\n"); return NULL; } -/** - * \brief FreeTDM ISDN signaling module initialisation - * \return Success - */ -static FIO_SIG_LOAD_FUNCTION(ftdm_isdn_init) -{ - Q931Initialize(); - - Q921SetGetTimeCB(ftdm_time_now); - Q931SetGetTimeCB(ftdm_time_now); - - return FTDM_SUCCESS; -} - -/** - * \brief Receives a Q931 indication message - * \param pvt Span were message is coming from - * \param ind Q931 indication - * \param tei Terminal Endpoint Identifier - * \param msg Message string - * \param mlen Message string length - * \return 0 on success - */ static int q931_rx_32(void *pvt, Q921DLMsg_t ind, L3UCHAR tei, L3UCHAR *msg, L3INT mlen) { + ftdm_span_t *span = pvt; + ftdm_isdn_data_t *isdn_data = span->signal_data; int offset = 4; char bb[4096] = ""; @@ -1925,16 +2069,6 @@ static int q931_rx_32(void *pvt, Q921DLMsg_t ind, L3UCHAR tei, L3UCHAR *msg, L3I case Q921_DL_DATA: print_hex_bytes(msg + offset, mlen - offset, bb, sizeof(bb)); -#ifdef HAVE_LIBPCAP - /*Q931ToPcap*/ - if(do_q931ToPcap==1){ - ftdm_span_t *span = (ftdm_span_t *) pvt; - if(writeQ931PacketToPcap(msg + offset, mlen - offset, span->span_id, 0) != FTDM_SUCCESS){ - ftdm_log(FTDM_LOG_WARNING, "Couldn't write Q931 buffer to pcap file!\n"); - } - } - /*Q931ToPcap done*/ -#endif ftdm_log(FTDM_LOG_DEBUG, "WRITE %d\n%s\n%s\n\n", (int)mlen - offset, LINE, bb); break; @@ -1942,17 +2076,14 @@ static int q931_rx_32(void *pvt, Q921DLMsg_t ind, L3UCHAR tei, L3UCHAR *msg, L3I break; } - return Q921Rx32(pvt, ind, tei, msg, mlen); +#ifdef HAVE_PCAP + if (isdn_pcap_capture_l3only(isdn_data)) { + isdn_pcap_write(isdn_data, msg, mlen, ISDN_PCAP_OUTGOING); + } +#endif + return Q921Rx32(&isdn_data->q921, ind, tei, msg, mlen); } -/** - * \brief Logs Q921 message - * \param pvt Span were message is coming from - * \param level Q921 log level - * \param msg Message string - * \param size Message string length - * \return 0 - */ static int ftdm_isdn_q921_log(void *pvt, Q921LogLevel_t level, char *msg, L2INT size) { ftdm_span_t *span = (ftdm_span_t *) pvt; @@ -1961,14 +2092,6 @@ static int ftdm_isdn_q921_log(void *pvt, Q921LogLevel_t level, char *msg, L2INT return 0; } -/** - * \brief Logs Q931 message - * \param pvt Span were message is coming from - * \param level Q931 log level - * \param msg Message string - * \param size Message string length - * \return 0 - */ static L3INT ftdm_isdn_q931_log(void *pvt, Q931LogLevel_t level, char *msg, L3INT size) { ftdm_span_t *span = (ftdm_span_t *) pvt; @@ -1976,9 +2099,7 @@ static L3INT ftdm_isdn_q931_log(void *pvt, Q931LogLevel_t level, char *msg, L3IN ftdm_log("Span", "Q.931", span->span_id, (int)level, "%s", msg); return 0; } -/** - * \brief ISDN state map - */ + static ftdm_state_map_t isdn_state_map = { { { @@ -2003,7 +2124,7 @@ static ftdm_state_map_t isdn_state_map = { ZSD_OUTBOUND, ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_DIALING, FTDM_END}, - {FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_END} + {FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_DOWN, FTDM_END} }, { ZSD_OUTBOUND, @@ -2077,7 +2198,7 @@ static ftdm_state_map_t isdn_state_map = { ZSD_INBOUND, ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_CANCEL, FTDM_CHANNEL_STATE_UP, FTDM_END}, }, { @@ -2086,17 +2207,11 @@ static ftdm_state_map_t isdn_state_map = { {FTDM_CHANNEL_STATE_UP, FTDM_END}, {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_END}, }, - - } }; /** - * \brief Stops an ISDN span - * \param span Span to halt - * \return Success - * - * Sets a stop flag and waits for the threads to end + * \brief Stop signalling on span */ static ftdm_status_t ftdm_isdn_stop(ftdm_span_t *span) { @@ -2105,9 +2220,9 @@ static ftdm_status_t ftdm_isdn_stop(ftdm_span_t *span) if (!ftdm_test_flag(isdn_data, FTDM_ISDN_RUNNING)) { return FTDM_FAIL; } - + ftdm_set_flag(isdn_data, FTDM_ISDN_STOP); - + while(ftdm_test_flag(isdn_data, FTDM_ISDN_RUNNING)) { ftdm_sleep(100); } @@ -2117,15 +2232,10 @@ static ftdm_status_t ftdm_isdn_stop(ftdm_span_t *span) } return FTDM_SUCCESS; - } /** - * \brief Starts an ISDN span - * \param span Span to halt - * \return Success or failure - * - * Launches a thread to monitor the span and a thread to generate tones on the span + * \brief Start signalling on span */ static ftdm_status_t ftdm_isdn_start(ftdm_span_t *span) { @@ -2149,19 +2259,46 @@ static ftdm_status_t ftdm_isdn_start(ftdm_span_t *span) return ret; } -/** - * \brief Parses an option string to flags - * \param in String to parse for configuration options - * \return Flags - */ + +/*###################################################################* + * (text) value parsing / translation + *###################################################################*/ + +static int32_t parse_loglevel(const char *level) +{ + if (!level) { + return -1; + } + + if (!strcasecmp(level, "debug")) { + return FTDM_LOG_LEVEL_DEBUG; + } else if (!strcasecmp(level, "info")) { + return FTDM_LOG_LEVEL_INFO; + } else if (!strcasecmp(level, "notice")) { + return FTDM_LOG_LEVEL_NOTICE; + } else if (!strcasecmp(level, "warning")) { + return FTDM_LOG_LEVEL_WARNING; + } else if (!strcasecmp(level, "error")) { + return FTDM_LOG_LEVEL_ERROR; + } else if (!strcasecmp(level, "alert")) { + return FTDM_LOG_LEVEL_ALERT; + } else if (!strcasecmp(level, "crit")) { + return FTDM_LOG_LEVEL_CRIT; + } else if (!strcasecmp(level, "emerg")) { + return FTDM_LOG_LEVEL_EMERG; + } else { + return -1; + } +} + static uint32_t parse_opts(const char *in) { uint32_t flags = 0; - + if (!in) { return 0; } - + if (strstr(in, "suggest_channel")) { flags |= FTDM_ISDN_OPT_SUGGEST_CHANNEL; } @@ -2177,17 +2314,259 @@ static uint32_t parse_opts(const char *in) return flags; } +static uint32_t parse_dialect(const char *in) +{ + if (!in) { + return Q931_Dialect_Count; + } + +#if __UNSUPPORTED__ + if (!strcasecmp(in, "national")) { + return Q931_Dialect_National; + } + if (!strcasecmp(in, "dms")) { + return Q931_Dialect_DMS; + } +#endif + if (!strcasecmp(in, "5ess")) { + return Q931_Dialect_5ESS; + } + if (!strcasecmp(in, "dss1")) { + return Q931_Dialect_DSS1; + } + if (!strcasecmp(in, "q931")) { + return Q931_Dialect_Q931; + } + return Q931_Dialect_Count; +} + + +/*###################################################################* + * API commands + *###################################################################*/ + +static const char isdn_api_usage[] = +#ifdef HAVE_PCAP + "isdn capture <span> <start> <filename> [q931only]\n" + "isdn capture <span> <stop|suspend|resume>\n" +#endif + "isdn loglevel <span> <q921|q931|all> <loglevel>\n" + "isdn dump <span> calls\n" + "isdn help"; + + /** - * \brief Initialises an ISDN span from configuration variables - * \param span Span to configure - * \param sig_cb Callback function for event signals - * \param ap List of configuration variables - * \return Success or failure + * isdn_api */ -static FIO_SIG_CONFIGURE_FUNCTION(ftdm_isdn_configure_span) +static FIO_API_FUNCTION(isdn_api) +{ + char *mycmd = NULL, *argv[10] = { 0 }; + int argc = 0; + + if (data) { + mycmd = strdup(data); + argc = ftdm_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + } + + if (!argc || !strcasecmp(argv[0], "help")) { + stream->write_function(stream, "%s\n", isdn_api_usage); + goto done; + } + else if (!strcasecmp(argv[0], "dump")) { + ftdm_isdn_data_t *isdn_data = NULL; + ftdm_span_t *span = NULL; + int span_id = 0; + + /* dump <span> calls */ + + if (argc < 3) { + stream->write_function(stream, "-ERR not enough arguments.\n"); + goto done; + } + + span_id = atoi(argv[1]); + + if (ftdm_span_find_by_name(argv[1], &span) == FTDM_SUCCESS || ftdm_span_find(span_id, &span) == FTDM_SUCCESS) { + isdn_data = span->signal_data; + } else { + stream->write_function(stream, "-ERR invalid span.\n"); + goto done; + } + + if (!strcasecmp(argv[2], "calls")) { + /* dump all calls to log */ + Q931DumpAllCalls(&isdn_data->q931); + stream->write_function(stream, "+OK call information dumped to log\n"); + goto done; + } + } + else if (!strcasecmp(argv[0], "loglevel")) { + ftdm_isdn_data_t *isdn_data = NULL; + ftdm_span_t *span = NULL; + int span_id = 0; + int layer = 0; + int level = 0; + + /* loglevel <span> <q921|q931|all> [level] */ + + if (argc < 3) { + stream->write_function(stream, "-ERR not enough arguments.\n"); + goto done; + } + + span_id = atoi(argv[1]); + + if (ftdm_span_find_by_name(argv[1], &span) == FTDM_SUCCESS || ftdm_span_find(span_id, &span) == FTDM_SUCCESS) { + isdn_data = span->signal_data; + } else { + stream->write_function(stream, "-ERR invalid span.\n"); + goto done; + } + + if (!strcasecmp(argv[2], "q921")) { + layer = 0x01; + } else if(!strcasecmp(argv[2], "q931")) { + layer = 0x02; + } else if (!strcasecmp(argv[2], "all")) { + layer = 0x03; + } else { + stream->write_function(stream, "-ERR invalid layer\n"); + goto done; + } + + if (argc > 3) { + /* set loglevel */ + if ((level = parse_loglevel(argv[3])) < 0) { + stream->write_function(stream, "-ERR invalid loglevel\n"); + goto done; + } + + if (layer & 0x01) { /* q921 */ + Q921SetLogLevel(&isdn_data->q921, (Q921LogLevel_t)level); + } + if (layer & 0x02) { /* q931 */ + Q931SetLogLevel(&isdn_data->q931, (Q931LogLevel_t)level); + } + stream->write_function(stream, "+OK loglevel set"); + } else { + /* get loglevel */ + if (layer & 0x01) { + stream->write_function(stream, "Q.921 loglevel: %s\n", + Q921GetLogLevelName(&isdn_data->q921)); + } + if (layer & 0x02) { + stream->write_function(stream, "Q.931 loglevel: %s\n", + Q931GetLogLevelName(&isdn_data->q931)); + } + stream->write_function(stream, "+OK"); + } + goto done; + } +#ifdef HAVE_PCAP + else if (!strcasecmp(argv[0], "capture")) { + ftdm_isdn_data_t *isdn_data = NULL; + ftdm_span_t *span = NULL; + int span_id = 0; + + /* capture <span> <start> <filename> [q931only] */ + /* capture <span> <stop|suspend|resume> */ + + if (argc < 3) { + stream->write_function(stream, "-ERR not enough arguments.\n"); + goto done; + } + + span_id = atoi(argv[1]); + + if (ftdm_span_find_by_name(argv[1], &span) == FTDM_SUCCESS || ftdm_span_find(span_id, &span) == FTDM_SUCCESS) { + isdn_data = span->signal_data; + } else { + stream->write_function(stream, "-ERR invalid span.\n"); + goto done; + } + + if (!strcasecmp(argv[2], "start")) { + char *filename = NULL; + + if (argc < 4) { + stream->write_function(stream, "-ERR not enough parameters.\n"); + goto done; + } + + if (isdn_pcap_is_open(isdn_data)) { + stream->write_function(stream, "-ERR capture is already running.\n"); + goto done; + } + + filename = argv[3]; + + if (isdn_pcap_open(isdn_data, filename) != FTDM_SUCCESS) { + stream->write_function(stream, "-ERR failed to open capture file.\n"); + goto done; + } + + if (argc > 4 && !strcasecmp(argv[4], "q931only")) { + isdn_data->flags |= FTDM_ISDN_CAPTURE_L3ONLY; + } + isdn_pcap_start(isdn_data); + + stream->write_function(stream, "+OK capture started.\n"); + goto done; + } + else if(!strcasecmp(argv[2], "stop")) { + + if (!isdn_pcap_is_open(isdn_data)) { + stream->write_function(stream, "-ERR capture is not running.\n"); + goto done; + } + + isdn_pcap_stop(isdn_data); + isdn_pcap_close(isdn_data); + + stream->write_function(stream, "+OK capture stopped.\n"); + goto done; + } + else if(!strcasecmp(argv[2], "suspend")) { + + if (!isdn_pcap_is_open(isdn_data)) { + stream->write_function(stream, "-ERR capture is not running.\n"); + goto done; + } + isdn_pcap_stop(isdn_data); + + stream->write_function(stream, "+OK capture suspended.\n"); + goto done; + } + else if(!strcasecmp(argv[2], "resume")) { + + if (!isdn_pcap_is_open(isdn_data)) { + stream->write_function(stream, "-ERR capture is not running.\n"); + goto done; + } + isdn_pcap_start(isdn_data); + + stream->write_function(stream, "+OK capture resumed.\n"); + goto done; + } + else { + stream->write_function(stream, "-ERR wrong action.\n"); + goto done; + } + } +#endif + else { + stream->write_function(stream, "-ERR invalid command.\n"); + } +done: + ftdm_safe_free(mycmd); + + return FTDM_SUCCESS; +} + +static FIO_SIG_CONFIGURE_FUNCTION(isdn_configure_span) { uint32_t i, x = 0; - ftdm_channel_t *dchans[2] = {0}; + ftdm_channel_t *dchans[2] = { 0 }; ftdm_isdn_data_t *isdn_data; const char *tonemap = "us"; char *var, *val; @@ -2195,40 +2574,8 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_isdn_configure_span) int32_t digit_timeout = 0; int q921loglevel = -1; int q931loglevel = -1; -#ifdef HAVE_LIBPCAP - int q931topcap = -1; /*Q931ToPcap*/ - int openPcap = 0; /*Flag: open Pcap file please*/ -#endif if (span->signal_type) { -#ifdef HAVE_LIBPCAP - /*Q931ToPcap: Get the content of the q931topcap and pcapfilename args given by mod_freetdm */ - while((var = va_arg(ap, char *))) { - if (!strcasecmp(var, "q931topcap")) { - q931topcap = va_arg(ap, int); - if(q931topcap==1) { - /*PCAP on*/; - openPcap=1; - } else if (q931topcap==0) { - /*PCAP off*/ - if (closePcapFile() != FTDM_SUCCESS) return FTDM_FAIL; - do_q931ToPcap=0; - return FTDM_SUCCESS; - } - } - if (!strcasecmp(var, "pcapfilename")) { - /*Put filename into global var*/ - pcapfn = va_arg(ap, char*); - } - } - /*We know now, that user wants to enable Q931ToPcap and what file name he wants, so open it please*/ - if(openPcap==1){ - if(openPcapFile() != FTDM_SUCCESS) return FTDM_FAIL; - do_q931ToPcap=1; - return FTDM_SUCCESS; - } - /*Q931ToPcap done*/ -#endif snprintf(span->last_error, sizeof(span->last_error), "Span is already configured for signalling [%d].", span->signal_type); return FTDM_FAIL; } @@ -2237,34 +2584,33 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_isdn_configure_span) ftdm_log(FTDM_LOG_WARNING, "Invalid trunk type '%s' defaulting to T1.\n", ftdm_trunk_type2str(span->trunk_type)); span->trunk_type = FTDM_TRUNK_T1; } - + for(i = 1; i <= span->chan_count; i++) { if (span->channels[i]->type == FTDM_CHAN_TYPE_DQ921) { if (x > 1) { snprintf(span->last_error, sizeof(span->last_error), "Span has more than 2 D-Channels!"); return FTDM_FAIL; - } else { - if (ftdm_channel_open(span->span_id, i, &dchans[x]) == FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_DEBUG, "opening d-channel #%d %d:%d\n", x, dchans[x]->span_id, dchans[x]->chan_id); - dchans[x]->state = FTDM_CHANNEL_STATE_UP; - x++; - } + } + + if (ftdm_channel_open(span->span_id, i, &dchans[x]) == FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_DEBUG, "opening d-channel #%d %d:%d\n", x, dchans[x]->span_id, dchans[x]->chan_id); + dchans[x]->state = FTDM_CHANNEL_STATE_UP; + x++; } } } - if (!x) { snprintf(span->last_error, sizeof(span->last_error), "Span has no D-Channels!"); return FTDM_FAIL; } - isdn_data = ftdm_malloc(sizeof(*isdn_data)); + isdn_data = malloc(sizeof(*isdn_data)); assert(isdn_data != NULL); memset(isdn_data, 0, sizeof(*isdn_data)); - + isdn_data->mode = Q931_TE; - dialect = Q931_Dialect_National; - + dialect = Q931_Dialect_Q931; + while((var = va_arg(ap, char *))) { if (!strcasecmp(var, "mode")) { if (!(val = va_arg(ap, char *))) { @@ -2275,8 +2621,9 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_isdn_configure_span) if (!(val = va_arg(ap, char *))) { break; } - dialect = q931_str2Q931Dialect_type(val); + dialect = parse_dialect(val); if (dialect == Q931_Dialect_Count) { + snprintf(span->last_error, sizeof(span->last_error), "Invalid/unknown dialect [%s]!", val); return FTDM_FAIL; } } else if (!strcasecmp(var, "opts")) { @@ -2315,7 +2662,6 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_isdn_configure_span) } } - if (!digit_timeout) { digit_timeout = DEFAULT_DIGIT_TIMEOUT; } @@ -2328,7 +2674,7 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_isdn_configure_span) if (isdn_data->mode == Q931_NT) { ftdm_isdn_bchan_data_t *data; - data = ftdm_malloc((span->chan_count - 1) * sizeof(ftdm_isdn_bchan_data_t)); + data = malloc(span->chan_count * sizeof(ftdm_isdn_bchan_data_t)); if (!data) { return FTDM_FAIL; } @@ -2340,15 +2686,13 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_isdn_configure_span) } } } - - span->start = ftdm_isdn_start; - span->stop = ftdm_isdn_stop; - span->signal_cb = sig_cb; + + isdn_data->sig_cb = sig_cb; isdn_data->dchans[0] = dchans[0]; isdn_data->dchans[1] = dchans[1]; - isdn_data->dchan = isdn_data->dchans[0]; + isdn_data->dchan = isdn_data->dchans[0]; isdn_data->digit_timeout = digit_timeout; - + Q921_InitTrunk(&isdn_data->q921, 0, 0, @@ -2358,55 +2702,104 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_isdn_configure_span) ftdm_isdn_921_21, (Q921Tx23CB_t)ftdm_isdn_921_23, span, - &isdn_data->q931); + span); - Q921SetLogCB(&isdn_data->q921, &ftdm_isdn_q921_log, isdn_data); + Q921SetLogCB(&isdn_data->q921, &ftdm_isdn_q921_log, span); Q921SetLogLevel(&isdn_data->q921, (Q921LogLevel_t)q921loglevel); - - Q931Api_InitTrunk(&isdn_data->q931, + + Q931InitTrunk(&isdn_data->q931, dialect, isdn_data->mode, span->trunk_type, ftdm_isdn_931_34, (Q931Tx32CB_t)q931_rx_32, ftdm_isdn_931_err, - &isdn_data->q921, + span, span); - Q931SetLogCB(&isdn_data->q931, &ftdm_isdn_q931_log, isdn_data); + Q931SetLogCB(&isdn_data->q931, &ftdm_isdn_q931_log, span); Q931SetLogLevel(&isdn_data->q931, (Q931LogLevel_t)q931loglevel); - isdn_data->q931.autoRestartAck = 1; - isdn_data->q931.autoConnectAck = 0; - isdn_data->q931.autoServiceAck = 1; - span->signal_data = isdn_data; - span->signal_type = FTDM_SIGTYPE_ISDN; + /* Register new event hander CB */ + Q931SetCallEventCB(&isdn_data->q931, ftdm_isdn_call_event, span); + + /* TODO: hmm, maybe drop the "Trunk" prefix */ + Q931TrunkSetAutoRestartAck(&isdn_data->q931, 1); + Q931TrunkSetAutoConnectAck(&isdn_data->q931, 1); + Q931TrunkSetAutoServiceAck(&isdn_data->q931, 1); + Q931TrunkSetStatusEnquiry(&isdn_data->q931, 0); + + span->state_map = &isdn_state_map; + span->signal_data = isdn_data; + span->signal_type = FTDM_SIGTYPE_ISDN; + span->start = ftdm_isdn_start; + span->stop = ftdm_isdn_stop; span->outgoing_call = isdn_outgoing_call; + span->get_channel_sig_status = isdn_get_channel_sig_status; + span->get_span_sig_status = isdn_get_span_sig_status; + +#ifdef __TODO__ if ((isdn_data->opts & FTDM_ISDN_OPT_SUGGEST_CHANNEL)) { span->channel_request = isdn_channel_request; - ftdm_set_flag(span, FTDM_SPAN_SUGGEST_CHAN_ID); + span->flags |= FTDM_SPAN_SUGGEST_CHAN_ID; } - span->state_map = &isdn_state_map; - +#endif ftdm_span_load_tones(span, tonemap); return FTDM_SUCCESS; } /** - * \brief FreeTDM ISDN signaling module definition + * ISDN module io interface + * \note This is really ugly... */ -EX_DECLARE_DATA ftdm_module_t ftdm_module = { - "isdn", - NULL, - close_pcap, - ftdm_isdn_init, - ftdm_isdn_configure_span, - NULL +static ftdm_io_interface_t isdn_interface = { + .name = "isdn", + .api = isdn_api }; +/** + * \brief ISDN module io interface init callback + */ +static FIO_IO_LOAD_FUNCTION(isdn_io_load) +{ + assert(fio != NULL); + + *fio = &isdn_interface; + + return FTDM_SUCCESS; +} + +/** + * \brief ISDN module load callback + */ +static FIO_SIG_LOAD_FUNCTION(isdn_load) +{ + Q931Initialize(); + + Q921SetGetTimeCB(ftdm_time_now); + Q931SetGetTimeCB(ftdm_time_now); + + return FTDM_SUCCESS; +} +/** + * \brief ISDN module shutdown callback + */ +static FIO_SIG_UNLOAD_FUNCTION(isdn_unload) +{ + return FTDM_SUCCESS; +}; + +ftdm_module_t ftdm_module = { + .name = "isdn", + .io_load = isdn_io_load, + .io_unload = NULL, + .sig_load = isdn_load, + .sig_unload = isdn_unload, + .sig_configure = isdn_configure_span +}; /* For Emacs: * Local Variables: @@ -2416,5 +2809,5 @@ EX_DECLARE_DATA ftdm_module_t ftdm_module = { * c-basic-offset:4 * End: * For VIM: - * vim:set softtabstop=4 shiftwidth=4 tabstop=4: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab: */ diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftdm_isdn.h b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h similarity index 83% rename from libs/freetdm/src/ftmod/ftmod_isdn/ftdm_isdn.h rename to libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h index 7168abe..95eee90 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftdm_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h @@ -1,23 +1,23 @@ /* * Copyright (c) 2007, Anthony Minessale II * 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 original author; nor the names of any 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 @@ -33,7 +33,6 @@ #ifndef FTDM_ISDN_H #define FTDM_ISDN_H -#include "freetdm.h" #define DEFAULT_DIGIT_TIMEOUT 10000 /* default overlap timeout: 10 seconds */ @@ -42,17 +41,23 @@ typedef enum { FTDM_ISDN_OPT_NONE = 0, FTDM_ISDN_OPT_SUGGEST_CHANNEL = (1 << 0), FTDM_ISDN_OPT_OMIT_DISPLAY_IE = (1 << 1), /*!< Do not send Caller name in outgoing SETUP message (= Display IE) */ - FTDM_ISDN_OPT_DISABLE_TONES = (1 << 2), /*!< Disable tone generating thread (NT mode) */ + FTDM_ISDN_OPT_DISABLE_TONES = (1 << 2), /*!< Disable tone generating thread (NT mode) */ FTDM_ISDN_OPT_MAX = (2 << 0) } ftdm_isdn_opts_t; typedef enum { - FTDM_ISDN_RUNNING = (1 << 0), - FTDM_ISDN_TONES_RUNNING = (1 << 1), - FTDM_ISDN_STOP = (1 << 2) + FTDM_ISDN_RUNNING = (1 << 0), + FTDM_ISDN_TONES_RUNNING = (1 << 1), + FTDM_ISDN_STOP = (1 << 2), + + FTDM_ISDN_CAPTURE = (1 << 3), + FTDM_ISDN_CAPTURE_L3ONLY = (1 << 4) } ftdm_isdn_flag_t; +#ifdef HAVE_PCAP +struct pcap_context; +#endif struct ftdm_isdn_data { Q921Data_t q921; @@ -60,6 +65,7 @@ struct ftdm_isdn_data { ftdm_channel_t *dchan; ftdm_channel_t *dchans[2]; struct ftdm_sigmsg sigmsg; + fio_signal_cb_t sig_cb; uint32_t flags; int32_t mode; int32_t digit_timeout; @@ -67,6 +73,9 @@ struct ftdm_isdn_data { ftdm_caller_data_t *outbound_crv[32768]; ftdm_channel_t *channels_local_crv[32768]; ftdm_channel_t *channels_remote_crv[32768]; +#ifdef HAVE_PCAP + struct pcap_context *pcap; +#endif }; typedef struct ftdm_isdn_data ftdm_isdn_data_t; @@ -75,7 +84,7 @@ typedef struct ftdm_isdn_data ftdm_isdn_data_t; /* b-channel private data */ struct ftdm_isdn_bchan_data { - L2ULONG digit_timeout; + int32_t digit_timeout; }; typedef struct ftdm_isdn_bchan_data ftdm_isdn_bchan_data_t; @@ -91,6 +100,6 @@ typedef struct ftdm_isdn_bchan_data ftdm_isdn_bchan_data_t; * c-basic-offset:4 * End: * For VIM: - * vim:set softtabstop=4 shiftwidth=4 tabstop=4: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab: */ diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ozmod_isdn.2005.vcproj b/libs/freetdm/src/ftmod/ftmod_isdn/ozmod_isdn.2005.vcproj deleted file mode 100644 index 5c8d2ef..0000000 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ozmod_isdn.2005.vcproj +++ /dev/null @@ -1,316 +0,0 @@ -<?xml version="1.0" encoding="Windows-1252"?> -<VisualStudioProject - ProjectType="Visual C++" - Version="8.00" - Name="ftmod_isdn" - ProjectGUID="{729344A5-D5E9-434D-8EE8-AF8C6C795D15}" - RootNamespace="ftmod_isdn" - Keyword="Win32Proj" - > - <Platforms> - <Platform - Name="Win32" - /> - </Platforms> - <ToolFiles> - </ToolFiles> - <Configurations> - <Configuration - Name="Debug|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="2" - CharacterSet="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="0" - AdditionalIncludeDirectories="..\..\isdn\include;..\..\include" - PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FTMOD_ISDN_EXPORTS;_CRT_SECURE_NO_WARNINGS" - MinimalRebuild="true" - BasicRuntimeChecks="3" - RuntimeLibrary="3" - UsePrecompiledHeader="0" - WarningLevel="4" - WarnAsError="true" - DebugInformationFormat="4" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="2" - GenerateDebugInformation="true" - SubSystem="2" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - <Configuration - Name="Release|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="2" - CharacterSet="1" - WholeProgramOptimization="1" - > - <Tool - Name="VCPreBuildEventTool" - /> - <Tool - Name="VCCustomBuildTool" - /> - <Tool - Name="VCXMLDataGeneratorTool" - /> - <Tool - Name="VCWebServiceProxyGeneratorTool" - /> - <Tool - Name="VCMIDLTool" - /> - <Tool - Name="VCCLCompilerTool" - Optimization="2" - EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories="..\..\isdn\include;..\..\include" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FTMOD_ISDN_EXPORTS;_CRT_SECURE_NO_WARNINGS" - RuntimeLibrary="2" - EnableFunctionLevelLinking="true" - UsePrecompiledHeader="0" - WarningLevel="4" - WarnAsError="true" - DebugInformationFormat="3" - /> - <Tool - Name="VCManagedResourceCompilerTool" - /> - <Tool - Name="VCResourceCompilerTool" - /> - <Tool - Name="VCPreLinkEventTool" - /> - <Tool - Name="VCLinkerTool" - LinkIncremental="1" - GenerateDebugInformation="true" - SubSystem="2" - OptimizeReferences="2" - EnableCOMDATFolding="2" - TargetMachine="1" - /> - <Tool - Name="VCALinkTool" - /> - <Tool - Name="VCManifestTool" - /> - <Tool - Name="VCXDCMakeTool" - /> - <Tool - Name="VCBscMakeTool" - /> - <Tool - Name="VCFxCopTool" - /> - <Tool - Name="VCAppVerifierTool" - /> - <Tool - Name="VCWebDeploymentTool" - /> - <Tool - Name="VCPostBuildEventTool" - /> - </Configuration> - </Configurations> - <References> - </References> - <Files> - <Filter - Name="Source Files" - Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" - UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" - > - <File - RelativePath="..\..\isdn\5ESSmes.c" - > - </File> - <File - RelativePath="..\..\isdn\5ESSStateNT.c" - > - </File> - <File - RelativePath="..\..\isdn\5ESSStateTE.c" - > - </File> - <File - RelativePath="..\..\isdn\DMSmes.c" - > - </File> - <File - RelativePath="..\..\isdn\DMSStateNT.c" - > - </File> - <File - RelativePath="..\..\isdn\DMSStateTE.c" - > - </File> - <File - RelativePath="..\..\isdn\EuroISDNStateNT.c" - > - </File> - <File - RelativePath="..\..\isdn\EuroISDNStateTE.c" - > - </File> - <File - RelativePath="..\..\isdn\mfifo.c" - > - </File> - <File - RelativePath="..\..\isdn\nationalmes.c" - > - </File> - <File - RelativePath="..\..\isdn\nationalStateNT.c" - > - </File> - <File - RelativePath="..\..\isdn\nationalStateTE.c" - > - </File> - <File - RelativePath="ftmod_isdn.c" - > - </File> - <File - RelativePath="..\..\isdn\Q921.c" - > - </File> - <File - RelativePath="..\..\isdn\Q931.c" - > - </File> - <File - RelativePath="..\..\isdn\Q931api.c" - > - </File> - <File - RelativePath="..\..\isdn\Q931ie.c" - > - </File> - <File - RelativePath="..\..\isdn\Q931mes.c" - > - </File> - <File - RelativePath="..\..\isdn\Q931StateNT.c" - > - </File> - <File - RelativePath="..\..\isdn\Q931StateTE.c" - > - </File> - <File - RelativePath="..\..\isdn\Q932mes.c" - > - </File> - </Filter> - <Filter - Name="Header Files" - Filter="h;hpp;hxx;hm;inl;inc;xsd" - UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" - > - <File - RelativePath="..\..\isdn\include\5ESS.h" - > - </File> - <File - RelativePath="..\..\isdn\include\DMS.h" - > - </File> - <File - RelativePath="..\..\isdn\include\mfifo.h" - > - </File> - <File - RelativePath="..\..\isdn\include\national.h" - > - </File> - <File - RelativePath="..\..\isdn\include\Q921.h" - > - </File> - <File - RelativePath="..\..\isdn\include\Q921priv.h" - > - </File> - <File - RelativePath="..\..\isdn\include\Q931.h" - > - </File> - <File - RelativePath="..\..\isdn\include\Q931ie.h" - > - </File> - <File - RelativePath="..\..\isdn\include\Q932.h" - > - </File> - <File - RelativePath="ftdm_isdn.h" - > - </File> - </Filter> - </Files> - <Globals> - </Globals> -</VisualStudioProject> commit 1d2b5e304c1780d7bba7fa4f692d9d6b5c7d0cdb Author: cypromis <michal.bielicki@seventhsignal.de> Date: Sun Oct 31 23:22:53 2010 +0100 FS-2808, thx Diego Viola diff --git a/bootstrap.sh b/bootstrap.sh index 4e65c5c..2dd76c4 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -148,7 +148,7 @@ if [ "x$libtoolize" = "x" ]; then exit 1 fi if [ ! -x "$libtoolize" ]; then - echo "$libtoolize does not exist or ist not executable" + echo "$libtoolize does not exist or is not executable" exit 1 fi commit 1b0ec75568cb08e0e1ea6d3459406b40db2eb0eb Author: Jeff Lenk <jeff@jefflenk.com> Date: Sat Oct 30 22:29:26 2010 -0500 fix stuck channel with voicemail and loopback diff --git a/src/mod/endpoints/mod_loopback/mod_loopback.c b/src/mod/endpoints/mod_loopback/mod_loopback.c index 07f6d74..7c69ff2 100644 --- a/src/mod/endpoints/mod_loopback/mod_loopback.c +++ b/src/mod/endpoints/mod_loopback/mod_loopback.c @@ -788,7 +788,7 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s switch_status_t r = SWITCH_STATUS_FALSE; switch_core_session_t *other_session; - if (switch_core_session_get_partner(tech_pvt->other_session, &other_session)) { + if (switch_core_session_get_partner(tech_pvt->other_session, &other_session) == SWITCH_STATUS_SUCCESS) { r = switch_core_session_receive_message(other_session, msg); switch_core_session_rwunlock(other_session); } commit 3e33540a816ba714610be7d736415d176a946e14 Author: Moises Silva <moy@sangoma.com> Date: Fri Oct 29 23:01:25 2010 -0400 mod_sangoma_codec: add G723.1 diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index 429c96e..21bfb95 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -93,6 +93,7 @@ vocallo_codec_t g_codec_map[] = { SNGTC_CODEC_GSM_FR, 3, "GSM", "Sangoma GSM", 20, 13200, 20000, 160, 320, 33, 0 }, { SNGTC_CODEC_ILBC_133, ILBC_133_PAYLOAD, "iLBC", "Sangoma iLBC", -1, -1, -1, -1, -1, -1, 0 }, { SNGTC_CODEC_ILBC_152, ILBC_152_PAYLOAD, "iLBC", "Sangoma iLBC", -1, -1, -1, -1, -1, -1, 0 }, + { SNGTC_CODEC_G723_1_63, 4, "G723", "Sangoma G723", 90, 6300, 30000, 240, 480, 24, 0}, #if 0 /* FIXME: sampling rate seems wrong with this, audioooo soooundssssss sloooooow ... */ { SNGTC_CODEC_G722, 9, "G722", "Sangoma G722", 20, 64000, 20000, 160, 640, 160, 0 }, @@ -1216,7 +1217,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) /* special check for iLBC to add a single codec interface for both ILBC bitrate versions */ if ((g_codec_map[c].codec_id == SNGTC_CODEC_ILBC_152 || g_codec_map[c].codec_id == SNGTC_CODEC_ILBC_133) && ilbc_done) { - break; + continue; } /* SWITCH_ADD_CODEC allocates a codec interface structure from the pool the core gave us and adds it to the internal interface @@ -1322,6 +1323,31 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) ilbc_done = 1; break; + case SNGTC_CODEC_G723_1_63: + + for (i = 1; i <= 3; i++) { + switch_core_codec_add_implementation(pool, codec_interface, /* the codec interface we allocated and we want to register with the core */ + SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ + g_codec_map[c].iana, /* the IANA code number, ie http://www.iana.org/assignments/rtp-parameters */ + g_codec_map[c].iana_name, /* the IANA code name */ + NULL, /* default fmtp to send (can be overridden by the init function), fmtp is used in SDP for format specific parameters */ + 8000, /* samples transferred per second */ + 8000, /* actual samples transferred per second */ + g_codec_map[c].bps, /* bits transferred per second */ + g_codec_map[c].mpf * i, /* microseconds per frame */ + g_codec_map[c].spf * i, /* samples per frame */ + g_codec_map[c].bpfd * i, /* number of bytes per frame decompressed */ + g_codec_map[c].bpfc * i, /* number of bytes per frame compressed */ + 1, /* number of channels represented */ + g_codec_map[c].spf * i, /* number of frames per network packet (I dont think this is used at all) */ + switch_sangoma_init, /* function to initialize a codec session using this implementation */ + switch_sangoma_encode, /* function to encode slinear data into encoded data */ + switch_sangoma_decode, /* function to decode encoded data into slinear data */ + switch_sangoma_destroy); /* deinitalize a codec handle using this implementation */ + } + + break; + case SNGTC_CODEC_G722: switch_core_codec_add_implementation(pool, codec_interface, /* the codec interface we allocated and we want to register with the core */ SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ commit 81a038690aca1da42b1f656b7a9cf48291b427d4 Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Fri Oct 29 22:41:14 2010 -0400 mod_callcenter: Make callcenter_config agent get return the value of the item requested. Also added queue param max-wait-time-with-no-agent-time-reached: If the max-wai-time-with-no-agent is already reached for the queue, then new caller can wait for x ammount of second before it kicked out of the queue rather than get rejected automaticly. diff --git a/conf/autoload_configs/callcenter.conf.xml b/conf/autoload_configs/callcenter.conf.xml index 9140193..a069413 100644 --- a/conf/autoload_configs/callcenter.conf.xml +++ b/conf/autoload_configs/callcenter.conf.xml @@ -13,6 +13,7 @@ <param name="time-base-score" value="system"/> <param name="max-wait-time" value="0"/> <param name="max-wait-time-with-no-agent" value="0"/> + <param name="max-wait-time-with-no-agent-time-reached" value="5"/> <param name="tier-rules-apply" value="false"/> <param name="tier-rule-wait-second" value="300"/> <param name="tier-rule-wait-multiply-level" value="true"/> diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 5abc567..1b0ba13 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -37,7 +37,6 @@ #define CC_AGENT_TYPE_UUID_STANDBY "uuid-standby" #define CC_SQLITE_DB_NAME "callcenter" -#define CC_MAX_TIME_DIFF_CHECK 5 /* TODO drop caller if no agent login dont allow new caller @@ -429,6 +428,7 @@ struct cc_queue { uint32_t max_wait_time; uint32_t max_wait_time_with_no_agent; + uint32_t max_wait_time_with_no_agent_time_reached; switch_mutex_t *mutex; @@ -540,6 +540,7 @@ cc_queue_t *queue_set_config(cc_queue_t *queue) SWITCH_CONFIG_SET_ITEM(queue->config[i++], "max-wait-time", SWITCH_CONFIG_INT, 0, &queue->max_wait_time, 0, &config_int_0_86400, NULL, NULL); SWITCH_CONFIG_SET_ITEM(queue->config[i++], "max-wait-time-with-no-agent", SWITCH_CONFIG_INT, 0, &queue->max_wait_time_with_no_agent, 0, &config_int_0_86400, NULL, NULL); + SWITCH_CONFIG_SET_ITEM(queue->config[i++], "max-wait-time-with-no-agent-time-reached", SWITCH_CONFIG_INT, 0, &queue->max_wait_time_with_no_agent_time_reached, 5, &config_int_0_86400, NULL, NULL); switch_assert(i < CC_QUEUE_CONFIGITEM_COUNT); @@ -890,7 +891,7 @@ cc_status_t cc_agent_get(const char *key, const char *agent, char *ret_result, s done: if (result == CC_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Get Info Agent %s set %s = %s\n", agent, key, res); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Get Info Agent %s %s = %s\n", agent, key, res); } return result; @@ -2023,7 +2024,7 @@ void *SWITCH_THREAD_FUNC cc_member_thread_run(switch_thread_t *thread, void *obj } /* Will drop the caller if no agent was found for more than X secondes */ - if (queue->max_wait_time_with_no_agent > 0 && m->t_member_called < queue->last_agent_exist_check - CC_MAX_TIME_DIFF_CHECK && + if (queue->max_wait_time_with_no_agent > 0 && m->t_member_called < queue->last_agent_exist_check - queue->max_wait_time_with_no_agent_time_reached && queue->last_agent_exist_check - queue->last_agent_exist >= queue->max_wait_time_with_no_agent) { m->member_cancel_reason = CC_MEMBER_CANCEL_REASON_NO_AGENT_TIMEOUT; switch_channel_set_flag_value(member_channel, CF_BREAK, 2); @@ -2465,9 +2466,10 @@ SWITCH_STANDARD_API(cc_config_api_function) } else { const char *key = argv[0 + initial_argc]; const char *agent = argv[1 + initial_argc]; - switch (cc_agent_get(key, agent, NULL, 0)) { + char ret[64]; + switch (cc_agent_get(key, agent, ret, sizeof(ret))) { case CC_STATUS_SUCCESS: - stream->write_function(stream, "%s", "+OK\n"); + stream->write_function(stream, "%s", ret); break; case CC_STATUS_INVALID_KEY: stream->write_function(stream, "%s", "-ERR Invalid Agent Update KEY!\n"); @@ -2632,7 +2634,7 @@ SWITCH_STANDARD_API(cc_config_api_function) } else if (action && !strcasecmp(action, "list")) { if (argc-initial_argc < 1) { switch_hash_index_t *hi; - stream->write_function(stream, "%s", "name|strategy|moh_sound|time_base_score|tier_rules_apply|tier_rule_wait_second|tier_rule_wait_multiply_level|tier_rule_no_agent_no_wait|discard_abandoned_after|abandoned_resume_allowed|max_wait_time|max_wait_time_with_no_agent|record_template\n"); + stream->write_function(stream, "%s", "name|strategy|moh_sound|time_base_score|tier_rules_apply|tier_rule_wait_second|tier_rule_wait_multiply_level|tier_rule_no_agent_no_wait|discard_abandoned_after|abandoned_resume_allowed|max_wait_time|max_wait_time_with_no_agent|max_wait_time_with_no_agent_time_reached|record_template\n"); switch_mutex_lock(globals.mutex); for (hi = switch_hash_first(NULL, globals.queue_hash); hi; hi = switch_hash_next(hi)) { void *val = NULL; @@ -2641,7 +2643,7 @@ SWITCH_STANDARD_API(cc_config_api_function) cc_queue_t *queue; switch_hash_this(hi, &key, &keylen, &val); queue = (cc_queue_t *) val; - stream->write_function(stream, "%s|%s|%s|%s|%s|%d|%s|%s|%d|%s|%d|%d|%s\n", queue->name, queue->strategy, queue->moh, queue->time_base_score, (queue->tier_rules_apply?"true":"false"), queue->tier_rule_wait_second, (queue->tier_rule_wait_multiply_level?"true":"false"), (queue->tier_rule_no_agent_no_wait?"true":"false"), queue->discard_abandoned_after, (queue->abandoned_resume_allowed?"true":"false"), queue->max_wait_time, queue->max_wait_time_with_no_agent, queue->record_template); + stream->write_function(stream, "%s|%s|%s|%s|%s|%d|%s|%s|%d|%s|%d|%d|%d|%s\n", queue->name, queue->strategy, queue->moh, queue->time_base_score, (queue->tier_rules_apply?"true":"false"), queue->tier_rule_wait_second, (queue->tier_rule_wait_multiply_level?"true":"false"), (queue->tier_rule_no_agent_no_wait?"true":"false"), queue->discard_abandoned_after, (queue->abandoned_resume_allowed?"true":"false"), queue->max_wait_time, queue->max_wait_time_with_no_agent, queue->max_wait_time_with_no_agent_time_reached, queue->record_template); queue = NULL; } switch_mutex_unlock(globals.mutex); commit e86af7d7301165c9c2dde4f74b20ab84c0f78d3c Author: Moises Silva <moy@sangoma.com> Date: Fri Oct 29 21:54:30 2010 -0400 mod_sangoma_codec: only register one codec interface for iLBC diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index 6f6641a..429c96e 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -81,6 +81,8 @@ typedef struct vocallo_codec_s { int autoinit; /* initialize on start loop or manually */ } vocallo_codec_t; +#define ILBC_133_PAYLOAD 97 +#define ILBC_152_PAYLOAD 98 vocallo_codec_t g_codec_map[] = { { SNGTC_CODEC_PCMU, 0, "PCMU", "Sangoma PCMU", 40, 64000, 10000, 80, 160, 80, 1 }, @@ -89,8 +91,8 @@ vocallo_codec_t g_codec_map[] = { SNGTC_CODEC_G729AB, 18, "G729", "Sangoma G729", 40, 8000, 10000, 80, 160, 10, 1 }, { SNGTC_CODEC_G726_32, 122, "G726-32", "Sangoma G.726 32k", 40, 32000, 10000, 80, 160, 40, 1 }, { SNGTC_CODEC_GSM_FR, 3, "GSM", "Sangoma GSM", 20, 13200, 20000, 160, 320, 33, 0 }, - { SNGTC_CODEC_ILBC_133, 97, "iLBC", "Sangoma iLBC 13.3k", -1, -1, -1, -1, -1, -1, 0 }, - { SNGTC_CODEC_ILBC_152, 98, "iLBC", "Sangoma iLBC 15.2k", -1, -1, -1, -1, -1, -1, 0 }, + { SNGTC_CODEC_ILBC_133, ILBC_133_PAYLOAD, "iLBC", "Sangoma iLBC", -1, -1, -1, -1, -1, -1, 0 }, + { SNGTC_CODEC_ILBC_152, ILBC_152_PAYLOAD, "iLBC", "Sangoma iLBC", -1, -1, -1, -1, -1, -1, 0 }, #if 0 /* FIXME: sampling rate seems wrong with this, audioooo soooundssssss sloooooow ... */ { SNGTC_CODEC_G722, 9, "G722", "Sangoma G722", 20, 64000, 20000, 160, 640, 160, 0 }, @@ -185,6 +187,17 @@ static vocallo_codec_t *get_codec_from_iana(int iana) return NULL; } +static vocallo_codec_t *get_codec_from_id(int id) +{ + int i; + for (i = 0; g_codec_map[i].codec_id != -1; i++) { + if (id == g_codec_map[i].codec_id) { + return &g_codec_map[i]; + } + } + return NULL; +} + static int sangoma_create_rtp_port(void *usr_priv, uint32_t host_ip, uint32_t *p_rtp_port, void **rtp_fd) { struct in_addr local_ip_addr = { 0 }; @@ -508,9 +521,19 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec } if (encoded_frame.payload != codec->implementation->ianacode) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read unexpected payload %d in Sangoma encoder RTP session, expecting %d\n", - encoded_frame.payload, codec->implementation->ianacode); - break; + if (sess->encoder.request.b.codec_id == SNGTC_CODEC_ILBC_152 || sess->encoder.request.b.codec_id == SNGTC_CODEC_ILBC_133) { + /* since we moved to SOAP based communications, the mapping between vocallo IANA and our IANA does not work, + * some codecs checks cannot be completely done, like iLBC */ + if (encoded_frame.payload != ILBC_152_PAYLOAD && encoded_frame.payload != ILBC_133_PAYLOAD) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read unexpected payload %d in Sangoma encoder RTP session, expecting either %d or %d\n", + encoded_frame.payload, ILBC_152_PAYLOAD, ILBC_133_PAYLOAD); + break; + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read unexpected payload %d in Sangoma encoder RTP session, expecting %d\n", + encoded_frame.payload, codec->implementation->ianacode); + break; + } } if (sess->encoder.queue_windex == sess->encoder.queue_rindex) { @@ -1126,6 +1149,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) switch_codec_interface_t *codec_interface = NULL; switch_api_interface_t *api_interface = NULL; int i = 0, c = 0; + int ilbc_done = 0; + vocallo_codec_t *ilbc_codec = NULL; int detected = 0, activated = 0; /* make sure we have valid configuration */ @@ -1189,6 +1214,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) sngtc_set_iana_code_based_on_codec_id(g_codec_map[c].codec_id, g_codec_map[c].iana); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Mapped codec %d to IANA %d\n", g_codec_map[c].codec_id, g_codec_map[c].iana); + /* special check for iLBC to add a single codec interface for both ILBC bitrate versions */ + if ((g_codec_map[c].codec_id == SNGTC_CODEC_ILBC_152 || g_codec_map[c].codec_id == SNGTC_CODEC_ILBC_133) && ilbc_done) { + break; + } + /* SWITCH_ADD_CODEC allocates a codec interface structure from the pool the core gave us and adds it to the internal interface * list the core keeps, gets a codec id and set the given codec name to it. * At this point there is an empty shell codec interface registered, but not yet implementations */ @@ -1249,44 +1279,47 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) break; case SNGTC_CODEC_ILBC_133: + case SNGTC_CODEC_ILBC_152: + ilbc_codec = get_codec_from_id(SNGTC_CODEC_ILBC_152); switch_core_codec_add_implementation(pool, codec_interface, /* the codec interface we allocated and we want to register with the core */ SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - g_codec_map[c].iana, /* 97, the IANA code number */ - g_codec_map[c].iana_name, /* the IANA code name */ - "mode=30", /* default fmtp to send (can be overridden by the init function), fmtp is used in SDP for format specific parameters */ + ilbc_codec->iana, /* the IANA code number, ie http://www.iana.org/assignments/rtp-parameters */ + ilbc_codec->iana_name, /* the IANA code name */ + "mode=20", /* default fmtp to send (can be overridden by the init function), fmtp is used in SDP for format specific parameters */ 8000, /* samples transferred per second */ 8000, /* actual samples transferred per second */ - 13300, /* bits transferred per second */ - 30000, /* microseconds per frame */ - 240, /* samples per frame */ - 480, /* number of bytes per frame decompressed */ - 50, /* number of bytes per frame compressed */ + 15200, /* bits transferred per second */ + 20000, /* microseconds per frame */ + 160, /* samples per frame */ + 320, /* number of bytes per frame decompressed */ + 38, /* number of bytes per frame compressed */ 1, /* number of channels represented */ 1, /* number of frames per network packet (I dont think this is used at all) */ - switch_sangoma_init, /* function to initialize a codec session using this implementation */ + switch_sangoma_init_ilbc, /* function to initialize a codec session using this implementation */ switch_sangoma_encode, /* function to encode slinear data into encoded data */ switch_sangoma_decode, /* function to decode encoded data into slinear data */ switch_sangoma_destroy); /* deinitalize a codec handle using this implementation */ - break; - case SNGTC_CODEC_ILBC_152: + + ilbc_codec = get_codec_from_id(SNGTC_CODEC_ILBC_133); switch_core_codec_add_implementation(pool, codec_interface, /* the codec interface we allocated and we want to register with the core */ SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - g_codec_map[c].iana, /* the IANA code number, ie http://www.iana.org/assignments/rtp-parameters */ - g_codec_map[c].iana_name, /* the IANA code name */ - "mode=20", /* default fmtp to send (can be overridden by the init function), fmtp is used in SDP for format specific parameters */ + ilbc_codec->iana, /* the IANA code number, ie http://www.iana.org/assignments/rtp-parameters */ + ilbc_codec->iana_name, /* the IANA code name */ + "mode=30", /* default fmtp to send (can be overridden by the init function), fmtp is used in SDP for format specific parameters */ 8000, /* samples transferred per second */ 8000, /* actual samples transferred per second */ - 15200, /* bits transferred per second */ - 20000, /* microseconds per frame */ - 160, /* samples per frame */ - 320, /* number of bytes per frame decompressed */ - 38, /* number of bytes per frame compressed */ + 13300, /* bits transferred per second */ + 30000, /* microseconds per frame */ + 240, /* samples per frame */ + 480, /* number of bytes per frame decompressed */ + 50, /* number of bytes per frame compressed */ 1, /* number of channels represented */ 1, /* number of frames per network packet (I dont think this is used at all) */ - switch_sangoma_init_ilbc, /* function to initialize a codec session using this implementation */ + switch_sangoma_init, /* function to initialize a codec session using this implementation */ switch_sangoma_encode, /* function to encode slinear data into encoded data */ switch_sangoma_decode, /* function to decode encoded data into slinear data */ switch_sangoma_destroy); /* deinitalize a codec handle using this implementation */ + ilbc_done = 1; break; case SNGTC_CODEC_G722: commit 402e383bd759a1c041b39ce63632cd4d65dd0d12 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Oct 29 20:38:59 2010 -0500 fix fifo race in use count dec diff --git a/src/include/switch_core_event_hook.h b/src/include/switch_core_event_hook.h index b60246c..575786f 100644 --- a/src/include/switch_core_event_hook.h +++ b/src/include/switch_core_event_hook.h @@ -45,6 +45,7 @@ typedef struct switch_io_event_hook_kill_channel switch_io_event_hook_kill_chann typedef struct switch_io_event_hook_send_dtmf switch_io_event_hook_send_dtmf_t; typedef struct switch_io_event_hook_recv_dtmf switch_io_event_hook_recv_dtmf_t; typedef struct switch_io_event_hook_state_change switch_io_event_hook_state_change_t; +typedef struct switch_io_event_hook_state_run switch_io_event_hook_state_run_t; typedef struct switch_io_event_hook_resurrect_session switch_io_event_hook_resurrect_session_t; typedef switch_status_t (*switch_outgoing_channel_hook_t) (switch_core_session_t *, switch_event_t *, switch_caller_profile_t *, switch_core_session_t *, switch_originate_flag_t); @@ -58,6 +59,7 @@ typedef switch_status_t (*switch_kill_channel_hook_t) (switch_core_session_t *, typedef switch_status_t (*switch_send_dtmf_hook_t) (switch_core_session_t *, const switch_dtmf_t *, switch_dtmf_direction_t direction); typedef switch_status_t (*switch_recv_dtmf_hook_t) (switch_core_session_t *, const switch_dtmf_t *, switch_dtmf_direction_t direction); typedef switch_status_t (*switch_state_change_hook_t) (switch_core_session_t *); +typedef switch_status_t (*switch_state_run_hook_t) (switch_core_session_t *); typedef switch_call_cause_t (*switch_resurrect_session_hook_t) (switch_core_session_t **, switch_memory_pool_t **, void *); /*! \brief Node in which to store custom receive message callback hooks */ @@ -136,6 +138,13 @@ struct switch_io_event_hook_state_change { struct switch_io_event_hook_state_change *next; }; +/*! \brief Node in which to store state run callback hooks */ +struct switch_io_event_hook_state_run { + /*! the state run channel callback hook */ + switch_state_run_hook_t state_run; + struct switch_io_event_hook_state_run *next; +}; + struct switch_io_event_hook_resurrect_session { switch_resurrect_session_hook_t resurrect_session; @@ -166,6 +175,7 @@ struct switch_io_event_hooks { switch_io_event_hook_recv_dtmf_t *recv_dtmf; /*! a list of state change hooks */ switch_io_event_hook_state_change_t *state_change; + switch_io_event_hook_state_run_t *state_run; switch_io_event_hook_resurrect_session_t *resurrect_session; }; @@ -218,6 +228,7 @@ NEW_HOOK_DECL_ADD_P(outgoing_channel); NEW_HOOK_DECL_ADD_P(receive_message); NEW_HOOK_DECL_ADD_P(receive_event); NEW_HOOK_DECL_ADD_P(state_change); +NEW_HOOK_DECL_ADD_P(state_run); NEW_HOOK_DECL_ADD_P(read_frame); NEW_HOOK_DECL_ADD_P(write_frame); NEW_HOOK_DECL_ADD_P(video_read_frame); @@ -231,6 +242,7 @@ NEW_HOOK_DECL_REM_P(outgoing_channel); NEW_HOOK_DECL_REM_P(receive_message); NEW_HOOK_DECL_REM_P(receive_event); NEW_HOOK_DECL_REM_P(state_change); +NEW_HOOK_DECL_REM_P(state_run); NEW_HOOK_DECL_REM_P(read_frame); NEW_HOOK_DECL_REM_P(write_frame); NEW_HOOK_DECL_REM_P(video_read_frame); diff --git a/src/include/switch_module_interfaces.h b/src/include/switch_module_interfaces.h index a6013a9..ae0ce90 100644 --- a/src/include/switch_module_interfaces.h +++ b/src/include/switch_module_interfaces.h @@ -134,6 +134,7 @@ typedef switch_status_t (*switch_io_send_dtmf_t) (switch_core_session_t *, const typedef switch_status_t (*switch_io_receive_message_t) (switch_core_session_t *, switch_core_session_message_t *); typedef switch_status_t (*switch_io_receive_event_t) (switch_core_session_t *, switch_event_t *); typedef switch_status_t (*switch_io_state_change_t) (switch_core_session_t *); +typedef switch_status_t (*switch_io_state_run_t) (switch_core_session_t *); typedef switch_status_t (*switch_io_read_video_frame_t) (switch_core_session_t *, switch_frame_t **, switch_io_flag_t, int); typedef switch_status_t (*switch_io_write_video_frame_t) (switch_core_session_t *, switch_frame_t *, switch_io_flag_t, int); typedef switch_call_cause_t (*switch_io_resurrect_session_t) (switch_core_session_t **, switch_memory_pool_t **, void *); @@ -174,6 +175,8 @@ struct switch_io_routines { switch_io_read_video_frame_t read_video_frame; /*! write a video frame to a session */ switch_io_write_video_frame_t write_video_frame; + /*! change a sessions channel run state */ + switch_io_state_run_t state_run; /*! resurrect a session */ switch_io_resurrect_session_t resurrect_session; void *padding[10]; diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 4a3cfd5..520e062 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -61,7 +61,8 @@ typedef struct { typedef enum { FIFO_APP_BRIDGE_TAG = (1 << 0), - FIFO_APP_TRACKING = (1 << 1) + FIFO_APP_TRACKING = (1 << 1), + FIFO_APP_DID_HOOK = (1 << 2) } fifo_app_flag_t; @@ -2019,9 +2020,10 @@ static switch_status_t hanguphook(switch_core_session_t *session) switch_channel_t *channel = switch_core_session_get_channel(session); switch_channel_state_t state = switch_channel_get_state(channel); - if (state == CS_HANGUP) { + if (state >= CS_HANGUP && !switch_channel_test_app_flag_key(FIFO_APP_KEY, channel, FIFO_APP_DID_HOOK)) { dec_use_count(session, SWITCH_TRUE); switch_core_event_hook_remove_state_change(session, hanguphook); + switch_channel_set_app_flag_key(FIFO_APP_KEY, channel, FIFO_APP_DID_HOOK); } return SWITCH_STATUS_SUCCESS; @@ -2044,6 +2046,8 @@ SWITCH_STANDARD_APP(fifo_track_call_function) return; } + switch_core_event_hook_add_receive_message(session, messagehook); + switch_core_event_hook_add_state_run(session, hanguphook); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s tracking call on uuid %s!\n", switch_channel_get_name(channel), data); @@ -2085,9 +2089,6 @@ SWITCH_STANDARD_APP(fifo_track_call_function) switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FIFO-Caller-CID-Number", cid_number); switch_event_fire(&event); } - - switch_core_event_hook_add_receive_message(session, messagehook); - switch_core_event_hook_add_state_change(session, hanguphook); } @@ -2493,6 +2494,7 @@ SWITCH_STANDARD_APP(fifo_function) if (switch_core_event_hook_remove_receive_message(session, messagehook) == SWITCH_STATUS_SUCCESS) { dec_use_count(session, SWITCH_FALSE); switch_core_event_hook_remove_state_change(session, hanguphook); + switch_channel_clear_app_flag_key(FIFO_APP_KEY, channel, FIFO_APP_TRACKING); } if (!zstr(strat_str)) { diff --git a/src/switch_core_event_hook.c b/src/switch_core_event_hook.c index 63420f6..102ea20 100644 --- a/src/switch_core_event_hook.c +++ b/src/switch_core_event_hook.c @@ -35,6 +35,7 @@ NEW_HOOK_DECL(outgoing_channel) NEW_HOOK_DECL(receive_message) NEW_HOOK_DECL(receive_event) NEW_HOOK_DECL(state_change) + NEW_HOOK_DECL(state_run) NEW_HOOK_DECL(read_frame) NEW_HOOK_DECL(write_frame) NEW_HOOK_DECL(video_read_frame) diff --git a/src/switch_core_state_machine.c b/src/switch_core_state_machine.c index 27579c2..439f9b7 100644 --- a/src/switch_core_state_machine.c +++ b/src/switch_core_state_machine.c @@ -314,11 +314,25 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session) int proceed = 1; int global_proceed = 1; int do_extra_handlers = 1; + switch_io_event_hook_state_run_t *ptr; + switch_status_t rstatus = SWITCH_STATUS_SUCCESS; switch_channel_set_running_state(session->channel, state); switch_channel_clear_flag(session->channel, CF_TRANSFER); switch_channel_clear_flag(session->channel, CF_REDIRECT); - + + if (session->endpoint_interface->io_routines->state_run) { + rstatus = session->endpoint_interface->io_routines->state_run(session); + } + + if (rstatus == SWITCH_STATUS_SUCCESS) { + for (ptr = session->event_hooks.state_run; ptr; ptr = ptr->next) { + if ((rstatus = ptr->state_run(session)) != SWITCH_STATUS_SUCCESS) { + break; + } + } + } + switch (state) { case CS_NEW: /* Just created, Waiting for first instructions */ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "(%s) State NEW\n", switch_channel_get_name(session->channel)); commit 68abb39eb33fa95d656dc1312acecf7c11a57145 Author: Moises Silva <moy@sangoma.com> Date: Fri Oct 29 21:05:19 2010 -0400 mod_sangoma_codec: add iLBC 13.3k and 15.2k diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index 287bc1b..6f6641a 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -85,12 +85,13 @@ vocallo_codec_t g_codec_map[] = { { SNGTC_CODEC_PCMU, 0, "PCMU", "Sangoma PCMU", 40, 64000, 10000, 80, 160, 80, 1 }, { SNGTC_CODEC_PCMA, 8, "PCMA", "Sangoma PCMA", 40, 64000, 10000, 80, 160, 80, 1 }, + { SNGTC_CODEC_L16_1, 10, "L16", "Sangoma L16", 40, 120000, 10000, 80, 160, 160, 1 }, { SNGTC_CODEC_G729AB, 18, "G729", "Sangoma G729", 40, 8000, 10000, 80, 160, 10, 1 }, { SNGTC_CODEC_G726_32, 122, "G726-32", "Sangoma G.726 32k", 40, 32000, 10000, 80, 160, 40, 1 }, { SNGTC_CODEC_GSM_FR, 3, "GSM", "Sangoma GSM", 20, 13200, 20000, 160, 320, 33, 0 }, + { SNGTC_CODEC_ILBC_133, 97, "iLBC", "Sangoma iLBC 13.3k", -1, -1, -1, -1, -1, -1, 0 }, + { SNGTC_CODEC_ILBC_152, 98, "iLBC", "Sangoma iLBC 15.2k", -1, -1, -1, -1, -1, -1, 0 }, #if 0 - /* FIXME: grandstream crashes with iLBC implementation */ - { SNGTC_CODEC_ILBC, 97, "iLBC", "Sangoma ILBC", -1, -1, -1, -1, -1, -1, 0 }, /* FIXME: sampling rate seems wrong with this, audioooo soooundssssss sloooooow ... */ { SNGTC_CODEC_G722, 9, "G722", "Sangoma G722", 20, 64000, 20000, 160, 640, 160, 0 }, #endif @@ -241,8 +242,8 @@ static int sangoma_create_rtp(void *usr_priv, sngtc_codec_request_leg_t *codec_r sngtc_codec_ipv4_hex_to_str(codec_reply_leg->codec_ip, codec_ip); iana = codec_id_to_iana(codec_req_leg->codec_id); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Creating RTP session for host (%s/%d) vocallo(%s/%d) Iana=%d ms=%d idx=%lu\n", - local_ip, rtp_port, codec_ip, codec_reply_leg->codec_udp_port, iana, + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Creating RTP session for host (%s/%d) vocallo(%s/%d) Iana=%d CodecId=%d ms=%d idx=%lu\n", + local_ip, rtp_port, codec_ip, codec_reply_leg->codec_udp_port, iana, codec_req_leg->codec_id, codec_req_leg->ms*1000, sess->sessid); /* create the RTP socket */ @@ -280,11 +281,11 @@ static switch_status_t switch_sangoma_init(switch_codec_t *codec, switch_codec_f struct sangoma_transcoding_session *sess = NULL; vocallo_codec_t *vcodec; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sangoma init called.\n"); - encoding = (flags & SWITCH_CODEC_FLAG_ENCODE); decoding = (flags & SWITCH_CODEC_FLAG_DECODE); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sangoma init called (encoding = %d, decoding = %d, iana = %d)\n", encoding ? 1 : 0, decoding ? 1 : 0, codec->implementation->ianacode); + if (!(encoding || decoding)) { return SWITCH_STATUS_FALSE; } @@ -331,6 +332,7 @@ static switch_status_t switch_sangoma_init(switch_codec_t *codec, switch_codec_f switch_snprintf(sess->hashkey, sizeof(sess->hashkey), SANGOMA_SESS_HASH_KEY_FORMAT, sess->sessid); switch_core_hash_insert(g_sessions_hash, sess->hashkey, sess); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sangoma init done for codec %s/%s, iana = %d\n", codec->implementation->iananame, vcodec->fs_name, codec->implementation->ianacode); switch_mutex_unlock(g_sessions_lock); codec->private_info = sess; @@ -1162,6 +1164,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loading codecs, register='%s', noregister='%s'\n", g_codec_register_list, g_codec_noregister_list); for (c = 0; g_codec_map[c].codec_id != -1; c++) { + if (g_codec_map[c].codec_id == SNGTC_CODEC_L16_1) { + /* registering L16 does not make any sense */ + continue; + } + /* check if the codec is in the load list, otherwise skip it */ if (strcasecmp(g_codec_register_list, "all") && !strcasestr(g_codec_register_list, g_codec_map[c].iana_name)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Not loading codec %s because was not found in the load list\n", @@ -1241,46 +1248,45 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) switch_sangoma_destroy); /* deinitalize a codec handle using this implementation */ break; - case SNGTC_CODEC_ILBC: + case SNGTC_CODEC_ILBC_133: switch_core_codec_add_implementation(pool, codec_interface, /* the codec interface we allocated and we want to register with the core */ SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - g_codec_map[c].iana, /* the IANA code number, ie http://www.iana.org/assignments/rtp-parameters */ + g_codec_map[c].iana, /* 97, the IANA code number */ g_codec_map[c].iana_name, /* the IANA code name */ - "mode=20", /* default fmtp to send (can be overridden by the init function), fmtp is used in SDP for format specific parameters */ + "mode=30", /* default fmtp to send (can be overridden by the init function), fmtp is used in SDP for format specific parameters */ 8000, /* samples transferred per second */ 8000, /* actual samples transferred per second */ - 15200, /* bits transferred per second */ - 20000, /* microseconds per frame */ - 160, /* samples per frame */ - 320, /* number of bytes per frame decompressed */ - 38, /* number of bytes per frame compressed */ + 13300, /* bits transferred per second */ + 30000, /* microseconds per frame */ + 240, /* samples per frame */ + 480, /* number of bytes per frame decompressed */ + 50, /* number of bytes per frame compressed */ 1, /* number of channels represented */ 1, /* number of frames per network packet (I dont think this is used at all) */ - switch_sangoma_init_ilbc, /* function to initialize a codec session using this implementation */ + switch_sangoma_init, /* function to initialize a codec session using this implementation */ switch_sangoma_encode, /* function to encode slinear data into encoded data */ switch_sangoma_decode, /* function to decode encoded data into slinear data */ switch_sangoma_destroy); /* deinitalize a codec handle using this implementation */ - -#if 0 + break; + case SNGTC_CODEC_ILBC_152: switch_core_codec_add_implementation(pool, codec_interface, /* the codec interface we allocated and we want to register with the core */ SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - g_codec_map[c].iana, /* 97, the IANA code number */ + g_codec_map[c].iana, /* the IANA code number, ie http://www.iana.org/assignments/rtp-parameters */ g_codec_map[c].iana_name, /* the IANA code name */ - "mode=30", /* default fmtp to send (can be overridden by the init function), fmtp is used in SDP for format specific parameters */ + "mode=20", /* default fmtp to send (can be overridden by the init function), fmtp is used in SDP for format specific parameters */ 8000, /* samples transferred per second */ 8000, /* actual samples transferred per second */ - 13300, /* bits transferred per second */ - 30000, /* microseconds per frame */ - 240, /* samples per frame */ - 480, /* number of bytes per frame decompressed */ - 50, /* number of bytes per frame compressed */ + 15200, /* bits transferred per second */ + 20000, /* microseconds per frame */ + 160, /* samples per frame */ + 320, /* number of bytes per frame decompressed */ + 38, /* number of bytes per frame compressed */ 1, /* number of channels represented */ 1, /* number of frames per network packet (I dont think this is used at all) */ - switch_sangoma_init, /* function to initialize a codec session using this implementation */ + switch_sangoma_init_ilbc, /* function to initialize a codec session using this implementation */ switch_sangoma_encode, /* function to encode slinear data into encoded data */ switch_sangoma_decode, /* function to decode encoded data into slinear data */ switch_sangoma_destroy); /* deinitalize a codec handle using this implementation */ -#endif break; case SNGTC_CODEC_G722: commit 90781424bf9ff165ad24062bcaee8fb47a10c384 Author: Konrad Hammel <konrad@sangoma.com> Date: Fri Oct 29 20:17:26 2010 -0400 freetdm: ss7 - added support for reserved national and spare SSF values diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c index 0f81d61..74d37b5 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c @@ -626,6 +626,10 @@ static int ftmod_ss7_parse_mtp_link(ftdm_conf_node_t *mtp_link, sng_mtp_link_t * mtpLink->mtp3.ssf = SSF_NAT; } else if (!strcasecmp(parm->val, "int")) { mtpLink->mtp3.ssf = SSF_INTL; + } else if (!strcasecmp(parm->val, "spare")) { + mtpLink->mtp3.ssf = SSF_SPARE; + } else if (!strcasecmp(parm->val, "res")) { + mtpLink->mtp3.ssf = SSF_RES; } else { SS7_ERROR("\tFound an invalid ssf of \"%s\"!\n", parm->val); return FTDM_FAIL; @@ -1050,6 +1054,12 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface) } else if (!strcasecmp(parm->val, "int")) { sng_isup.ssf = SSF_INTL; sng_isap.ssf = SSF_INTL; + } else if (!strcasecmp(parm->val, "spare")) { + sng_isup.ssf = SSF_SPARE; + sng_isap.ssf = SSF_SPARE; + } else if (!strcasecmp(parm->val, "res")) { + sng_isup.ssf = SSF_RES; + sng_isap.ssf = SSF_RES; } else { SS7_ERROR("\tFound an invalid ssf of \"%s\"!\n", parm->val); return FTDM_FAIL; commit 1d5aa062ee5593de671dcaad5b25a6cc319b7847 Author: Moises Silva <moy@sangoma.com> Date: Fri Oct 29 17:29:27 2010 -0400 mod_sangoma_codec: default to G729 only and remove L16 since it did not make any sense diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index 2f3ea4a..287bc1b 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -85,7 +85,6 @@ vocallo_codec_t g_codec_map[] = { { SNGTC_CODEC_PCMU, 0, "PCMU", "Sangoma PCMU", 40, 64000, 10000, 80, 160, 80, 1 }, { SNGTC_CODEC_PCMA, 8, "PCMA", "Sangoma PCMA", 40, 64000, 10000, 80, 160, 80, 1 }, - { SNGTC_CODEC_L16_1, 10, "L16", "Sangoma L16", 40, 120000, 10000, 80, 160, 160, 1 }, { SNGTC_CODEC_G729AB, 18, "G729", "Sangoma G729", 40, 8000, 10000, 80, 160, 10, 1 }, { SNGTC_CODEC_G726_32, 122, "G726-32", "Sangoma G.726 32k", 40, 32000, 10000, 80, 160, 40, 1 }, { SNGTC_CODEC_GSM_FR, 3, "GSM", "Sangoma GSM", 20, 13200, 20000, 160, 320, 33, 0 }, @@ -102,7 +101,7 @@ vocallo_codec_t g_codec_map[] = #define IANACODE_CN 13 /* default codec list to load, users may override, special codec 'all' registers everything available unless listed in noregister */ -static char g_codec_register_list[1024] = "all"; +static char g_codec_register_list[1024] = "G729"; /* default codec list to NOT load, users may override */ static char g_codec_noregister_list[1024] = ""; commit 3b92f04b8583cd096a0a27bde7aa2de02f2949ad Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Oct 29 14:58:30 2010 -0500 allow PLC flag to make it to the codec diff --git a/libs/stfu/stfu.c b/libs/stfu/stfu.c index 866ae57..f305a0f 100644 --- a/libs/stfu/stfu.c +++ b/libs/stfu/stfu.c @@ -280,7 +280,8 @@ stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i) i->miss_count++; - if (i->miss_count > 10 || (i->in_queue->array_len == i->in_queue->array_size) || tried >= i->in_queue->array_size) { + if (i->miss_count > 10 || (i->in_queue->array_len == i->in_queue->array_size) || + tried >= (i->in_queue->array_size + i->out_queue->array_size)) { i->running = 0; i->interval = 0; i->out_queue->wr_len = i->out_queue->array_size; commit e2a565412a7d13d063ba06527f9abe8a79c283e4 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Oct 29 14:58:22 2010 -0500 allow PLC flag to make it to the codec diff --git a/src/switch_core_io.c b/src/switch_core_io.c index ec3fac6..2478df3 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -105,8 +105,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi switch_io_event_hook_read_frame_t *ptr; switch_status_t status = SWITCH_STATUS_FALSE; int need_codec, perfect, do_bugs = 0, do_resample = 0, is_cng = 0; - unsigned int flag = 0; switch_codec_implementation_t codec_impl; + unsigned int flag = 0; switch_assert(session != NULL); @@ -315,7 +315,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi read_frame->data, read_frame->datalen, session->read_impl.actual_samples_per_second, - session->raw_read_frame.data, &session->raw_read_frame.datalen, &session->raw_read_frame.rate, &flag); + session->raw_read_frame.data, &session->raw_read_frame.datalen, &session->raw_read_frame.rate, + &read_frame->flags); } if (do_resample && ((status == SWITCH_STATUS_SUCCESS) || is_cng)) { @@ -749,7 +750,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess frame->data, frame->datalen, session->write_impl.actual_samples_per_second, - session->raw_write_frame.data, &session->raw_write_frame.datalen, &session->raw_write_frame.rate, &flag); + session->raw_write_frame.data, &session->raw_write_frame.datalen, &session->raw_write_frame.rate, &frame->flags); commit b4562522ed65f61ff429a4bca7a4a6e45c3f9e67 Author: Jeff Lenk <jeff@jefflenk.com> Date: Fri Oct 29 13:51:02 2010 -0500 windows - fix build diff --git a/src/switch.c b/src/switch.c index e252dbe..b04243d 100644 --- a/src/switch.c +++ b/src/switch.c @@ -358,7 +358,9 @@ int main(int argc, char *argv[]) int alt_dirs = 0, log_set = 0, run_set = 0, do_kill = 0; int known_opt; int high_prio = 0; +#ifndef WIN32 int do_wait = 0; +#endif #ifdef __sun switch_core_flag_t flags = SCF_USE_SQL; #else commit d2e255192a6f778def60cafed826a4aa66d40fb6 Author: Moises Silva <moy@sangoma.com> Date: Fri Oct 29 11:04:35 2010 -0400 mod_sangoma_codec: use native L16 for the source codec diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index 63086d6..2f3ea4a 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -33,7 +33,6 @@ */ #include "switch.h" -#include "g711.h" #include <sng_tc/sngtc_node.h> @@ -41,7 +40,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load); SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_sangoma_codec_shutdown); SWITCH_MODULE_DEFINITION(mod_sangoma_codec, mod_sangoma_codec_load, mod_sangoma_codec_shutdown, NULL); -#define IANA_ULAW 0 +#define IANA_LINEAR 10 #define SANGOMA_SESS_HASH_KEY_FORMAT "sngtc%lu" /* it seemed we need higher PTIME than the calling parties, so we assume nobody will use higher ptime than 40 */ @@ -309,7 +308,7 @@ static switch_status_t switch_sangoma_init(switch_codec_t *codec, switch_codec_f if (encoding) { sess->encoder.request.usr_priv = sess; sess->encoder.request.a.host_ip = g_rtpip; - sess->encoder.request.a.codec_id = SNGTC_CODEC_PCMU; + sess->encoder.request.a.codec_id = SNGTC_CODEC_L16_1; sess->encoder.request.a.ms = codec->implementation->microseconds_per_packet/1000; sess->encoder.request.b.host_ip = g_rtpip; @@ -324,7 +323,7 @@ static switch_status_t switch_sangoma_init(switch_codec_t *codec, switch_codec_f sess->decoder.request.a.ms = codec->implementation->microseconds_per_packet/1000; sess->decoder.request.b.host_ip = g_rtpip; - sess->decoder.request.b.codec_id = SNGTC_CODEC_PCMU; + sess->decoder.request.b.codec_id = SNGTC_CODEC_L16_1; sess->decoder.request.b.ms = codec->implementation->microseconds_per_packet/1000; } @@ -406,13 +405,13 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec { /* FS core checks the actual samples per second and microseconds per packet to determine the buffer size in the worst case scenario, no need to check * whether the buffer passed in by the core (encoded_data) will be big enough */ - switch_frame_t ulaw_frame; + switch_frame_t linear_frame; switch_frame_t encoded_frame; switch_status_t sres = SWITCH_STATUS_FALSE; + uint16_t decoded_byteswapped_data[SWITCH_RECOMMENDED_BUFFER_SIZE]; + uint16_t *decoded_data_linear = decoded_data; switch_time_t now_time = 0, difftime = 0; switch_time_t func_start_time = 0, func_end_time = 0; - unsigned char ebuf_ulaw[decoded_data_len / 2]; - short *dbuf_linear; int i = 0; int res = 0; struct sangoma_transcoding_session *sess = codec->private_info; @@ -448,21 +447,20 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec } } - /* transcode to ulaw first */ - dbuf_linear = decoded_data; - - for (i = 0; i < decoded_data_len / sizeof(short); i++) { - ebuf_ulaw[i] = linear_to_ulaw(dbuf_linear[i]); - } - /* do the writing */ - memset(&ulaw_frame, 0, sizeof(ulaw_frame)); - ulaw_frame.source = __FUNCTION__; - ulaw_frame.data = ebuf_ulaw; - ulaw_frame.datalen = i; - ulaw_frame.payload = IANA_ULAW; + memset(&linear_frame, 0, sizeof(linear_frame)); + linear_frame.source = __FUNCTION__; + linear_frame.data = decoded_byteswapped_data; + linear_frame.datalen = decoded_data_len; + linear_frame.payload = IANA_LINEAR; + + /* copy and byte-swap */ + for (i = 0; i < decoded_data_len/2; i++) { + decoded_byteswapped_data[i] = (decoded_data_linear[i] << 8) | (decoded_data_linear[i] >> 8); + } + - res = switch_rtp_write_frame(sess->encoder.txrtp, &ulaw_frame); + res = switch_rtp_write_frame(sess->encoder.txrtp, &linear_frame); if (-1 == res) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to write to Sangoma encoder RTP session.\n"); return SWITCH_STATUS_FALSE; @@ -595,13 +593,15 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses /* FS core checks the actual samples per second and microseconds per packet to determine the buffer size in the worst case scenario, no need to check * whether the buffer passed in by the core will be enough */ switch_frame_t encoded_frame; - switch_frame_t ulaw_frame; + switch_frame_t linear_frame; switch_status_t sres = SWITCH_STATUS_FALSE; switch_time_t now_time = 0, difftime = 0; switch_time_t func_start_time = 0, func_end_time = 0; - short *dbuf_linear; - int i = 0; + uint16_t *dbuf_linear; + uint16_t *linear_frame_data; + uint16_t *rtp_data_linear; int res = 0; + int i = 0; struct sangoma_transcoding_session *sess = codec->private_info; if (sess->decoder.debug_timing) { @@ -669,7 +669,7 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses #if 0 prevread_time = switch_micro_time_now(); #endif - sres = switch_rtp_zerocopy_read_frame(sess->decoder.rxrtp, &ulaw_frame, SWITCH_IO_FLAG_NOBLOCK); + sres = switch_rtp_zerocopy_read_frame(sess->decoder.rxrtp, &linear_frame, SWITCH_IO_FLAG_NOBLOCK); if (sres == SWITCH_STATUS_GENERR) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to read on Sangoma decoder RTP session: %d\n", sres); return SWITCH_STATUS_FALSE; @@ -682,18 +682,18 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%ldus to read on decoding session %lu.\n", (long)difftime, sess->sessid); } #endif - if (0 == ulaw_frame.datalen) { + if (0 == linear_frame.datalen) { break; } - if (ulaw_frame.payload == IANACODE_CN) { + if (linear_frame.payload == IANACODE_CN) { /* confort noise is treated as silence by us */ continue; } - if (ulaw_frame.payload != IANA_ULAW) { + if (linear_frame.payload != IANA_LINEAR) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read unexpected payload %d in Sangoma decoder RTP session, expecting %d\n", - ulaw_frame.payload, IANA_ULAW); + linear_frame.payload, IANA_LINEAR); break; } @@ -709,8 +709,14 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses } } - memcpy(sess->decoder.rtp_queue[sess->decoder.queue_windex].data, ulaw_frame.data, ulaw_frame.datalen); - sess->decoder.rtp_queue[sess->decoder.queue_windex].datalen = ulaw_frame.datalen; + /* byteswap the received data */ + rtp_data_linear = (unsigned short *)sess->decoder.rtp_queue[sess->decoder.queue_windex].data; + linear_frame_data = linear_frame.data; + for (i = 0; i < linear_frame.datalen/2; i++) { + rtp_data_linear[i] = (linear_frame_data[i] << 8) | (linear_frame_data[i] >> 8); + } + sess->decoder.rtp_queue[sess->decoder.queue_windex].datalen = linear_frame.datalen; + SAFE_INDEX_INC(sess->decoder.rtp_queue, sess->decoder.queue_windex); /* monitor the queue size */ @@ -737,17 +743,15 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses /* check sequence and bump lost rx packets count if needed */ if (sess->decoder.lastrxseqno >= 0) { - if (ulaw_frame.seq > (sess->decoder.lastrxseqno + 2) ) { - sess->decoder.rxlost += ulaw_frame.seq - sess->decoder.lastrxseqno - 1; + if (linear_frame.seq > (sess->decoder.lastrxseqno + 2) ) { + sess->decoder.rxlost += linear_frame.seq - sess->decoder.lastrxseqno - 1; } } - sess->decoder.lastrxseqno = ulaw_frame.seq; + sess->decoder.lastrxseqno = linear_frame.seq; - /* pop the data from the queue and transcode it */ - for (i = 0; i < sess->decoder.rtp_queue[sess->decoder.queue_rindex].datalen; i++) { - dbuf_linear[i] = ulaw_to_linear(((char *)sess->decoder.rtp_queue[sess->decoder.queue_rindex].data)[i]); - } - *decoded_data_len = i * 2; + /* pop the data from the queue */ + memcpy(dbuf_linear, sess->decoder.rtp_queue[sess->decoder.queue_rindex].data, sess->decoder.rtp_queue[sess->decoder.queue_rindex].datalen); + *decoded_data_len = sess->decoder.rtp_queue[sess->decoder.queue_rindex].datalen; sess->decoder.rtp_queue[sess->decoder.queue_rindex].datalen = 0; SAFE_INDEX_INC(sess->decoder.rtp_queue, sess->decoder.queue_rindex); sess->decoder.queue_size--; @@ -923,7 +927,7 @@ SWITCH_STANDARD_API(sangoma_function) stats = switch_rtp_get_stats(sess->encoder.rxrtp, NULL); stream->write_function(stream, "=== %s Encoder ===\n", sess->impl->iananame); - stream->write_function(stream, "Tx ULAW from %d.%d.%d.%d:%d to %d.%d.%d.%d:%d\n\n", SNGTC_NIPV4(sess->encoder.reply.a.host_ip), sess->encoder.reply.a.host_udp_port, + stream->write_function(stream, "Tx L16 from %d.%d.%d.%d:%d to %d.%d.%d.%d:%d\n\n", SNGTC_NIPV4(sess->encoder.reply.a.host_ip), sess->encoder.reply.a.host_udp_port, SNGTC_NIPV4(sess->encoder.reply.a.codec_ip), sess->encoder.reply.a.codec_udp_port); stream->write_function(stream, "Rx %s at %d.%d.%d.%d:%d from %d.%d.%d.%d:%d\n\n", sess->impl->iananame, SNGTC_NIPV4(sess->encoder.reply.b.host_ip), sess->encoder.reply.b.host_udp_port, SNGTC_NIPV4(sess->encoder.reply.b.codec_ip), sess->encoder.reply.b.codec_udp_port); @@ -945,7 +949,7 @@ SWITCH_STANDARD_API(sangoma_function) stream->write_function(stream, "=== %s Decoder ===\n", sess->impl->iananame); stream->write_function(stream, "Tx %s from %d.%d.%d.%d:%d to %d.%d.%d.%d:%d\n\n", sess->impl->iananame, SNGTC_NIPV4(sess->decoder.reply.a.host_ip), sess->decoder.reply.a.host_udp_port, SNGTC_NIPV4(sess->decoder.reply.a.codec_ip), sess->decoder.reply.a.codec_udp_port); - stream->write_function(stream, "Rx ULAW at %d.%d.%d.%d:%d from %d.%d.%d.%d:%d\n\n", SNGTC_NIPV4(sess->decoder.reply.b.host_ip), sess->decoder.reply.b.host_udp_port, + stream->write_function(stream, "Rx L16 at %d.%d.%d.%d:%d from %d.%d.%d.%d:%d\n\n", SNGTC_NIPV4(sess->decoder.reply.b.host_ip), sess->decoder.reply.b.host_udp_port, SNGTC_NIPV4(sess->decoder.reply.b.codec_ip), sess->decoder.reply.b.codec_udp_port); stream->write_function(stream, "-- Inbound Stats --\n"); commit d40bb064009539533220a729975b6d160abf3565 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Oct 29 13:00:14 2010 -0500 part2 diff --git a/src/switch.c b/src/switch.c index 5c2cba3..e252dbe 100644 --- a/src/switch.c +++ b/src/switch.c @@ -82,6 +82,7 @@ static void handle_SIGILL(int sig) return; } +#ifndef WIN32 static void handle_SIGUSR2(int sig) { if (sig); @@ -106,6 +107,7 @@ static void handle_SIGCHLD(int sig) return; } +#endif /* kill a freeswitch process running in background mode */ static int freeswitch_kill_background() @@ -272,7 +274,16 @@ void daemonize(int do_wait) if (do_wait) { - unsigned int sanity = 20; + unsigned int sanity = 60; + char *o; + + if ((o = getenv("FREESWITCH_BG_TIMEOUT"))) { + int tmp = atoi(o); + if (tmp > 0) { + sanity = tmp; + } + } + while(--sanity && !system_ready) { if (sanity % 2 == 0) { commit 23d5fc1900d06354b4ad9df21fdf02f256f40e13 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Oct 29 12:43:55 2010 -0500 add -ncwait for Unix based implememtations to make the backgrounder wait to make sure the process starts before detaching diff --git a/src/switch.c b/src/switch.c index a28baba..5c2cba3 100644 --- a/src/switch.c +++ b/src/switch.c @@ -50,7 +50,7 @@ /* pid filename: Stores the process id of the freeswitch process */ #define PIDFILE "freeswitch.pid" static char *pfile = PIDFILE; - +static int system_ready = 0; /* Picky compiler */ #ifdef __ICC @@ -82,6 +82,31 @@ static void handle_SIGILL(int sig) return; } +static void handle_SIGUSR2(int sig) +{ + if (sig); + + system_ready = 1; + + return; +} + +static void handle_SIGCHLD(int sig) +{ + int status = 0; + int pid = 0; + + if (sig); + + pid = wait(&status); + + if (pid > 0) { + system_ready = -1; + } + + return; +} + /* kill a freeswitch process running in background mode */ static int freeswitch_kill_background() { @@ -209,27 +234,31 @@ void WINAPI service_main(DWORD numArgs, char **args) #else -void daemonize(void) +void daemonize(int do_wait) { int fd; pid_t pid; - switch (fork()) { - case 0: - break; - case -1: - fprintf(stderr, "Error Backgrounding (fork)! %d - %s\n", errno, strerror(errno)); - exit(0); - break; - default: - exit(0); - } + if (!do_wait) { + switch (fork()) { + case 0: + break; + case -1: + fprintf(stderr, "Error Backgrounding (fork)! %d - %s\n", errno, strerror(errno)); + exit(0); + break; + default: + exit(0); + } - if (setsid() < 0) { - fprintf(stderr, "Error Backgrounding (setsid)! %d - %s\n", errno, strerror(errno)); - exit(0); + if (setsid() < 0) { + fprintf(stderr, "Error Backgrounding (setsid)! %d - %s\n", errno, strerror(errno)); + exit(0); + } } + pid = fork(); + switch (pid) { case 0: break; @@ -238,10 +267,39 @@ void daemonize(void) exit(0); break; default: - fprintf(stderr, "%d Backgrounding.\n", (int) pid); + { + fprintf(stderr, "%d Backgrounding.\n", (int) pid); + + + if (do_wait) { + unsigned int sanity = 20; + while(--sanity && !system_ready) { + + if (sanity % 2 == 0) { + printf("FreeSWITCH[%d] Waiting for background process pid:%d to be ready.....\n", getpid(), (int) pid); + } + sleep(1); + } + + if (system_ready == 1) { + printf("FreeSWITCH[%d] System Ready pid:%d\n", (int) getpid(), (int) pid); + } else { + printf("FreeSWITCH[%d] Error starting system! pid:%d\n", (int)getpid(), (int) pid); + kill(pid, 9); + exit(-1); + } + + } + + } + exit(0); } + if (do_wait) { + setsid(); + } + /* redirect std* to null */ fd = open("/dev/null", O_RDONLY); if (fd != 0) { @@ -286,9 +344,10 @@ int main(int argc, char *argv[]) int local_argc = argc; char *arg_argv[128] = { 0 }; char *usageDesc; - int alt_dirs = 0, log_set = 0, run_set = 0, kill = 0; + int alt_dirs = 0, log_set = 0, run_set = 0, do_kill = 0; int known_opt; int high_prio = 0; + int do_wait = 0; #ifdef __sun switch_core_flag_t flags = SCF_USE_SQL; #else @@ -343,6 +402,9 @@ int main(int argc, char *argv[]) "\t-nort -- disable clock clock_realtime\n" "\t-stop -- stop freeswitch\n" "\t-nc -- do not output to a console and background\n" +#ifndef WIN32 + "\t-ncwait -- do not output to a console and background but wait until the system is ready before exiting (implies -nc)\n" +#endif "\t-c -- output to a console and stay in the foreground\n" "\t-conf [confdir] -- specify an alternate config dir\n" "\t-log [logdir] -- specify an alternate log dir\n" @@ -518,7 +580,7 @@ int main(int argc, char *argv[]) } if (local_argv[x] && !strcmp(local_argv[x], "-stop")) { - kill++; + do_kill++; known_opt++; } @@ -526,7 +588,13 @@ int main(int argc, char *argv[]) nc++; known_opt++; } - +#ifndef WIN32 + if (local_argv[x] && !strcmp(local_argv[x], "-ncwait")) { + nc++; + do_wait++; + known_opt++; + } +#endif if (local_argv[x] && !strcmp(local_argv[x], "-c")) { nc = 0; known_opt++; @@ -664,7 +732,7 @@ int main(int argc, char *argv[]) strcpy(SWITCH_GLOBAL_dirs.run_dir, SWITCH_GLOBAL_dirs.log_dir); } - if (kill) { + if (do_kill) { return freeswitch_kill_background(); } @@ -678,41 +746,33 @@ int main(int argc, char *argv[]) return 255; } - signal(SIGILL, handle_SIGILL); - signal(SIGTERM, handle_SIGILL); - if (nc) { -#ifdef WIN32 - FreeConsole(); -#else - if (!nf) { - daemonize(); - } -#endif - } #if defined(HAVE_SETRLIMIT) && !defined(__sun) if (!waste && !(flags & SCF_VG)) { + int x; + memset(&rlp, 0, sizeof(rlp)); - getrlimit(RLIMIT_STACK, &rlp); + x = getrlimit(RLIMIT_STACK, &rlp); + if (rlp.rlim_max > SWITCH_THREAD_STACKSIZE) { char buf[1024] = ""; int i = 0; fprintf(stderr, "Error: stacksize %d is too large: run ulimit -s %d or run %s -waste.\nauto-adjusting stack size for optimal performance...\n", (int) (rlp.rlim_max / 1024), SWITCH_THREAD_STACKSIZE / 1024, local_argv[0]); - + memset(&rlp, 0, sizeof(rlp)); rlp.rlim_cur = SWITCH_THREAD_STACKSIZE; rlp.rlim_max = SWITCH_THREAD_STACKSIZE; setrlimit(RLIMIT_STACK, &rlp); - + apr_terminate(); ret = (int) execv(argv[0], argv); - + for (i = 0; i < argc; i++) { switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s ", argv[i]); } - + return system(buf); } @@ -720,6 +780,25 @@ int main(int argc, char *argv[]) #endif + signal(SIGILL, handle_SIGILL); + signal(SIGTERM, handle_SIGILL); +#ifndef WIN32 + if (do_wait) { + signal(SIGUSR2, handle_SIGUSR2); + signal(SIGCHLD, handle_SIGCHLD); + } +#endif + + if (nc) { +#ifdef WIN32 + FreeConsole(); +#else + if (!nf) { + daemonize(do_wait); + } +#endif + } + if (high_prio) { @@ -800,6 +879,12 @@ int main(int argc, char *argv[]) return 255; } +#ifndef WIN32 + if (do_wait) { + kill(getppid(), SIGUSR2); + } +#endif + switch_core_runtime_loop(nc); destroy_status = switch_core_destroy(); commit 3c66b497d66ae180de30bffe449d0421f5d16221 Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Fri Oct 29 01:57:37 2010 -0500 skypopen: fix FS-2784, missing incoming calls to one interfacename diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index 4d02d3a..ef21c20 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -2578,7 +2578,7 @@ int skypopen_partner_handle_ring(private_t *tech_pvt) if (strlen(globals.SKYPOPEN_INTERFACES[i].name)) { giovatech = &globals.SKYPOPEN_INTERFACES[i]; - if ((giovatech->interface_state != SKYPOPEN_STATE_DOWN) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user)) && (!strcmp(giovatech->ring_value, value)) && ((((timenow.tv_sec - giovatech->ring_time.tv_sec) * 1000000) + (timenow.tv_usec - giovatech->ring_time.tv_usec)) < 1000000)) { //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds + if ((giovatech->interface_state != SKYPOPEN_STATE_DEAD) && (giovatech->interface_state != SKYPOPEN_STATE_DOWN) && (giovatech->interface_state != SKYPOPEN_STATE_IDLE) && (strcmp(giovatech->name, tech_pvt->name)) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user)) && (!strcmp(giovatech->ring_value, value)) && ((((timenow.tv_sec - giovatech->ring_time.tv_sec) * 1000000) + (timenow.tv_usec - giovatech->ring_time.tv_usec)) < 1000000)) { //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds found = 1; DEBUGA_SKYPE ("FOUND (name=%s, giovatech->interface_state=%d != SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n", @@ -2655,7 +2655,7 @@ int skypopen_answer(private_t *tech_pvt) if (strlen(globals.SKYPOPEN_INTERFACES[i].name)) { giovatech = &globals.SKYPOPEN_INTERFACES[i]; - if (strlen(giovatech->skype_call_id) && (giovatech->interface_state != SKYPOPEN_STATE_DOWN) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user)) && (!strcmp(giovatech->callid_number, value)) && ((((timenow.tv_sec - giovatech->answer_time.tv_sec) * 1000000) + (timenow.tv_usec - giovatech->answer_time.tv_usec)) < 1000000)) { //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds + if (strlen(giovatech->skype_call_id) && (giovatech->interface_state != SKYPOPEN_STATE_DEAD) && (giovatech->interface_state != SKYPOPEN_STATE_DOWN) && (giovatech->interface_state != SKYPOPEN_STATE_IDLE) && (strcmp(giovatech->name, tech_pvt->name)) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user)) && (!strcmp(giovatech->callid_number, value)) && ((((timenow.tv_sec - giovatech->answer_time.tv_sec) * 1000000) + (timenow.tv_usec - giovatech->answer_time.tv_usec)) < 1000000)) { //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds found = 1; DEBUGA_SKYPE ("FOUND (name=%s, giovatech->interface_state=%d != SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n", @@ -2753,7 +2753,7 @@ int skypopen_transfer(private_t *tech_pvt) giovatech = &globals.SKYPOPEN_INTERFACES[i]; /* let's look for a RINGING one */ - if ((giovatech->interface_state != SKYPOPEN_STATE_DOWN) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user)) && (!strcmp(giovatech->ring_value, value)) && ((((timenow.tv_sec - giovatech->ring_time.tv_sec) * 1000000) + (timenow.tv_usec - giovatech->ring_time.tv_usec)) < 1000000)) { //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds + if ((giovatech->interface_state != SKYPOPEN_STATE_DEAD) && (giovatech->interface_state != SKYPOPEN_STATE_DOWN) && (giovatech->interface_state != SKYPOPEN_STATE_IDLE) && (strcmp(giovatech->name, tech_pvt->name)) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user)) && (!strcmp(giovatech->ring_value, value)) && ((((timenow.tv_sec - giovatech->ring_time.tv_sec) * 1000000) + (timenow.tv_usec - giovatech->ring_time.tv_usec)) < 1000000)) { //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds found = 1; DEBUGA_SKYPE ("FOUND (name=%s, giovatech->interface_state=%d != SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n", @@ -2814,7 +2814,7 @@ int skypopen_transfer(private_t *tech_pvt) if (strlen(globals.SKYPOPEN_INTERFACES[i].name)) { giovatech = &globals.SKYPOPEN_INTERFACES[i]; - if (strlen(giovatech->skype_transfer_call_id) && (giovatech->interface_state != SKYPOPEN_STATE_DOWN) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user)) && (!strcmp(giovatech->transfer_callid_number, value)) && ((((timenow.tv_sec - giovatech->transfer_time.tv_sec) * 1000000) + (timenow.tv_usec - giovatech->transfer_time.tv_usec)) < 1000000)) { //1.0 sec + if (strlen(giovatech->skype_transfer_call_id) && (giovatech->interface_state != SKYPOPEN_STATE_DOWN) && (giovatech->interface_state != SKYPOPEN_STATE_DEAD) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user)) && (!strcmp(giovatech->transfer_callid_number, value)) && ((((timenow.tv_sec - giovatech->transfer_time.tv_sec) * 1000000) + (timenow.tv_usec - giovatech->transfer_time.tv_usec)) < 1000000)) { //1.0 sec found = 1; DEBUGA_SKYPE ("FOUND (name=%s, giovatech->interface_state=%d != SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->transfer_callid_number=%s == value=%s)\n", commit e866e7a1361f7796192fd2974cc055b7196d80a4 Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Oct 28 21:37:12 2010 -0500 windows - fix build - change based on other changes in file diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 3144f9e..4a3cfd5 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -2780,7 +2780,7 @@ SWITCH_STANDARD_APP(fifo_function) switch_channel_set_flag(other_channel, CF_BREAK); while (switch_channel_ready(channel) && switch_channel_ready(other_channel) && - switch_channel_test_app_flag_key(__FILE_, other_channel, FIFO_APP_BRIDGE_TAG)) { + switch_channel_test_app_flag_key(FIFO_APP_KEY, other_channel, FIFO_APP_BRIDGE_TAG)) { status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); if (!SWITCH_READ_ACCEPTABLE(status)) { break; commit 5d647d2c42e3c4833153b5260100baf56a39a85f Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Oct 28 19:34:20 2010 -0500 omfg really diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index d1ba178..3144f9e 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -29,6 +29,7 @@ * */ #include <switch.h> +#define FIFO_APP_KEY "mod_fifo" SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_fifo_shutdown); SWITCH_MODULE_LOAD_FUNCTION(mod_fifo_load); @@ -864,7 +865,7 @@ static void do_unbridge(switch_core_session_t *consumer_session, switch_core_ses caller_channel = switch_core_session_get_channel(caller_session); } - if (switch_channel_test_app_flag(consumer_channel, FIFO_APP_BRIDGE_TAG)) { + if (switch_channel_test_app_flag_key(FIFO_APP_KEY, consumer_channel, FIFO_APP_BRIDGE_TAG)) { char date[80] = ""; switch_time_exp_t tm; switch_time_t ts = switch_micro_time_now(); @@ -874,7 +875,7 @@ static void do_unbridge(switch_core_session_t *consumer_session, switch_core_ses char *sql; switch_event_t *event; - switch_channel_clear_app_flag_key(__FILE__, consumer_channel, FIFO_APP_BRIDGE_TAG); + switch_channel_clear_app_flag_key(FIFO_APP_KEY, consumer_channel, FIFO_APP_BRIDGE_TAG); switch_channel_set_variable(consumer_channel, "fifo_bridged", NULL); ts = switch_micro_time_now(); @@ -984,11 +985,11 @@ static switch_status_t messagehook (switch_core_session_t *session, switch_core_ switch_size_t retsize; const char *ced_name, *ced_number, *cid_name, *cid_number; - if (switch_channel_test_app_flag(consumer_channel, FIFO_APP_BRIDGE_TAG)) { + if (switch_channel_test_app_flag_key(FIFO_APP_KEY, consumer_channel, FIFO_APP_BRIDGE_TAG)) { goto end; } - switch_channel_set_app_flag_key(__FILE__, consumer_channel, FIFO_APP_BRIDGE_TAG); + switch_channel_set_app_flag_key(FIFO_APP_KEY, consumer_channel, FIFO_APP_BRIDGE_TAG); switch_channel_set_variable(consumer_channel, "fifo_bridged", "true"); switch_channel_set_variable(consumer_channel, "fifo_manual_bridge", "true"); @@ -2038,7 +2039,7 @@ SWITCH_STANDARD_APP(fifo_track_call_function) return; } - if (switch_channel_test_app_flag(channel, FIFO_APP_TRACKING)) { + if (switch_channel_test_app_flag_key(FIFO_APP_KEY, channel, FIFO_APP_TRACKING)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s trying to double-track call!\n", switch_channel_get_name(channel)); return; } @@ -2048,7 +2049,7 @@ SWITCH_STANDARD_APP(fifo_track_call_function) add_bridge_call(data); - switch_channel_set_app_flag_key(__FILE__, channel, FIFO_APP_TRACKING); + switch_channel_set_app_flag_key(FIFO_APP_KEY, channel, FIFO_APP_TRACKING); switch_channel_set_variable(channel, "fifo_outbound_uuid", data); switch_channel_set_variable(channel, "fifo_track_call", "true"); @@ -2347,7 +2348,7 @@ SWITCH_STANDARD_APP(fifo_function) switch_channel_set_variable(channel, "fifo_timestamp", date); switch_channel_set_variable(channel, "fifo_serviced_uuid", NULL); - switch_channel_set_app_flag_key(__FILE__, channel, FIFO_APP_BRIDGE_TAG); + switch_channel_set_app_flag_key(FIFO_APP_KEY, channel, FIFO_APP_BRIDGE_TAG); if (chime_list) { char *list_dup = switch_core_session_strdup(session, chime_list); @@ -2422,7 +2423,7 @@ SWITCH_STANDARD_APP(fifo_function) abort: - switch_channel_clear_app_flag_key(__FILE__, channel, FIFO_APP_BRIDGE_TAG); + switch_channel_clear_app_flag_key(FIFO_APP_KEY, channel, FIFO_APP_BRIDGE_TAG); fifo_caller_del(switch_core_session_get_uuid(session)); @@ -2779,7 +2780,7 @@ SWITCH_STANDARD_APP(fifo_function) switch_channel_set_flag(other_channel, CF_BREAK); while (switch_channel_ready(channel) && switch_channel_ready(other_channel) && - switch_channel_test_app_flag(other_channel, FIFO_APP_BRIDGE_TAG)) { + switch_channel_test_app_flag_key(__FILE_, other_channel, FIFO_APP_BRIDGE_TAG)) { status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); if (!SWITCH_READ_ACCEPTABLE(status)) { break; @@ -3083,7 +3084,7 @@ SWITCH_STANDARD_APP(fifo_function) switch_mutex_unlock(globals.mutex); - switch_channel_clear_app_flag_key(__FILE__, channel, FIFO_APP_BRIDGE_TAG); + switch_channel_clear_app_flag_key(FIFO_APP_KEY, channel, FIFO_APP_BRIDGE_TAG); switch_core_media_bug_resume(session); commit 6f2ccbae21199c8ef786903f1ef83f67d9efe4a0 Author: Konrad Hammel <konrad@sangoma.com> Date: Thu Oct 28 17:09:51 2010 -0400 freetdm: ss7 - update to support CCR diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index 7519b27..af3b9ed 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -598,7 +598,7 @@ ftdm_status_t handle_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ /* this is a remote hangup request */ sngss7_set_flag(sngss7_info, FLAG_REMOTE_REL); - +ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL); /* move the state of the channel to CANCEL to end the call */ ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); @@ -613,7 +613,7 @@ ftdm_status_t handle_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ if (siRelEvnt->causeDgn.causeVal.pres) { ftdmchan->caller_data.hangup_cause = siRelEvnt->causeDgn.causeVal.val; } else { - SS7_ERROR("REL does not have a cause code!\n"); + SS7_ERROR("REL does not have a cause ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);code!\n"); ftdmchan->caller_data.hangup_cause = 0; } @@ -625,6 +625,23 @@ ftdm_status_t handle_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ break; /**************************************************************************/ + case FTDM_CHANNEL_STATE_IN_LOOP: + + /* inform the core to unloop the channel*/ + ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL); + + /* since we need to acknowledge the hang up set the flag for remote release */ + sngss7_set_flag(sngss7_info, FLAG_REMOTE_REL); + + /* go to hangup complete to send the RLC */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); + + /* save the call info for the RLC */ + sngss7_info->suInstId = get_unique_id(); + sngss7_info->spInstId = spInstId; + + break; + /**************************************************************************/ default: /* throw the reset flag */ @@ -1293,15 +1310,6 @@ ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint32_t ci /* switch to the IN_LOOP state */ ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IN_LOOP); - /* store the sngss7 ids */ - if (suInstId == 0) { - sngss7_info->suInstId = get_unique_id(); - } else { - sngss7_info->suInstId = suInstId; - } - sngss7_info->spInstId = spInstId; - sngss7_info->globalFlg = globalFlg; - /* unlock the channel again before we exit */ ftdm_mutex_unlock(ftdmchan->mutex); @@ -1662,7 +1670,7 @@ ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ sngss7_set_flag(sngss7_info, FLAG_RESET_TX_RSP); /* go to DOWN */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + /*ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);*/ break; /**********************************************************************/ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index ebb4efa..7612f3d 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -93,7 +93,8 @@ ftdm_state_map_t sangoma_ss7_state_map = { ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_IN_LOOP, FTDM_END}, {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, - FTDM_CHANNEL_STATE_COLLECT, FTDM_CHANNEL_STATE_DOWN, FTDM_END} + FTDM_CHANNEL_STATE_COLLECT, FTDM_CHANNEL_STATE_DOWN, + FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_END} }, { ZSD_INBOUND, @@ -970,6 +971,14 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) ftdm_set_state_locked (ftdmchan, ftdmchan->last_state); break; /******************************************************************/ + case (FTDM_CHANNEL_STATE_IN_LOOP): + /* we screwed up in a COT/CCR, remove the loop */ + ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL); + + /* go to down */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + break; + /******************************************************************/ default: /* KONRAD: find out what the cause code should be */ ftdmchan->caller_data.hangup_cause = 41; commit 6737ae52d9a7ea4ee1b20e12de28ad4903400133 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Oct 28 15:34:42 2010 -0500 FS-2801 diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 833cf6c..0f9e265 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -4684,7 +4684,9 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, if (!switch_channel_get_variable(other_channel, SWITCH_B_SDP_VARIABLE)) { switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, r_sdp); } + switch_mutex_unlock(tech_pvt->sofia_mutex); switch_channel_pre_answer(other_channel); + switch_mutex_lock(tech_pvt->sofia_mutex); switch_core_session_rwunlock(other_session); } goto done; @@ -5112,7 +5114,9 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) { other_channel = switch_core_session_get_channel(other_session); + switch_mutex_unlock(tech_pvt->sofia_mutex); switch_channel_answer(other_channel); + switch_mutex_lock(tech_pvt->sofia_mutex); switch_core_session_rwunlock(other_session); } } @@ -5141,7 +5145,9 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, if (!switch_channel_get_variable(other_channel, SWITCH_B_SDP_VARIABLE)) { switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, r_sdp); } + switch_mutex_unlock(tech_pvt->sofia_mutex); switch_channel_answer(other_channel); + switch_mutex_lock(tech_pvt->sofia_mutex); switch_core_session_rwunlock(other_session); } goto done; commit 3a3c5d261f6b1a84d0b024893115ef5ccdb026e0 Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Thu Oct 28 13:47:15 2010 -0500 skypopen: sk list the DEAD state diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index 9d4c270..4d02d3a 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -109,7 +109,8 @@ char *interface_status[] = { /* should match SKYPOPEN_STATE_xxx in skypopen.h */ "DOUBLE", "SELECTD", "HANG_RQ", - "PREANSW" + "PREANSW", + "DEAD" }; char *skype_callflow[] = { /* should match CALLFLOW_XXX in skypopen.h */ "CALL_IDLE", diff --git a/src/mod/endpoints/mod_skypopen/skypopen.h b/src/mod/endpoints/mod_skypopen/skypopen.h index ddeebdf..ccff65b 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen.h +++ b/src/mod/endpoints/mod_skypopen/skypopen.h @@ -132,7 +132,7 @@ typedef enum { #define SKYPOPEN_STATE_SELECTED 9 #define SKYPOPEN_STATE_HANGUP_REQUESTED 10 #define SKYPOPEN_STATE_PREANSWER 11 -#define SKYPOPEN_STATE_DEAD 99 +#define SKYPOPEN_STATE_DEAD 12 /*********************************/ /* call flow from the device */ #define CALLFLOW_CALL_IDLE 0 commit aea12d1f9ff5ba1ea54c517755762a45cd86221c Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Thu Oct 28 13:22:15 2010 -0500 skypopen: indented diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index 357332d..9d4c270 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -380,7 +380,7 @@ static switch_status_t interface_exists(char *the_interface) if (tech_pvt->running && tech_pvt->SkypopenHandles.disp) { XEvent e; Atom atom1 = XInternAtom(tech_pvt->SkypopenHandles.disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False); - switch_sleep(1000); + switch_sleep(1000); XFlush(tech_pvt->SkypopenHandles.disp); memset(&e, 0, sizeof(e)); e.xclient.type = ClientMessage; @@ -390,7 +390,7 @@ static switch_status_t interface_exists(char *the_interface) e.xclient.format = 8; XSendEvent(tech_pvt->SkypopenHandles.disp, tech_pvt->SkypopenHandles.win, False, 0, &e); - XFlush(tech_pvt->SkypopenHandles.disp); + XFlush(tech_pvt->SkypopenHandles.disp); } #endif } @@ -420,9 +420,9 @@ static switch_status_t interface_exists(char *the_interface) } else { DEBUGA_SKYPE("interface '%s' STILL console\n", SKYPOPEN_P_LOG, the_interface); } - if(strlen(tech_pvt->session_uuid_str)){ + if (strlen(tech_pvt->session_uuid_str)) { - }else{ + } else { memset(&globals.SKYPOPEN_INTERFACES[interface_id], '\0', sizeof(private_t)); } globals.real_interfaces--; @@ -563,7 +563,7 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session) if (tech_pvt->interface_state != SKYPOPEN_STATE_DEAD) { tech_pvt->interface_state = SKYPOPEN_STATE_IDLE; tech_pvt->skype_callflow = CALLFLOW_CALL_IDLE; - }else{ + } else { memset(tech_pvt, '\0', sizeof(private_t)); } switch_core_session_set_private(session, NULL); @@ -1973,7 +1973,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skypopen_load) SWITCH_ADD_API(commands_api_interface, "sk", "Skypopen console commands", sk_function, SK_SYNTAX); SWITCH_ADD_API(commands_api_interface, "skypopen", "Skypopen interface commands", skypopen_function, SKYPOPEN_SYNTAX); - SWITCH_ADD_API(commands_api_interface, "skypopen_chat", "Skypopen_chat interface remote_skypename TEXT", skypopen_chat_function, SKYPOPEN_CHAT_SYNTAX); + SWITCH_ADD_API(commands_api_interface, "skypopen_chat", "Skypopen_chat interface remote_skypename TEXT", skypopen_chat_function, + SKYPOPEN_CHAT_SYNTAX); SWITCH_ADD_CHAT(chat_interface, MDL_CHAT_PROTO, chat_send); if (switch_event_reserve_subclass(MY_EVENT_INCOMING_CHATMESSAGE) != SWITCH_STATUS_SUCCESS) { diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index 44be835..8bd5d09 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -1514,6 +1514,7 @@ int xio_error_handler(Display * dpy) return 0; } + int xio_error_handler2(Display * dpy, XErrorEvent * err) { private_t *tech_pvt = NULL; commit 182da3c128879026e25b10f1f0e26eaf220053d0 Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Thu Oct 28 13:20:17 2010 -0500 skypopen: fixed management of skype clients crash diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index f2f5c2a..357332d 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -174,6 +174,7 @@ int running = 0; struct SkypopenList global_handles_list; extern int xio_error_handler(Display * dpy); extern int X11_errors_handler(Display * dpy, XErrorEvent * err); +extern int xio_error_handler2(Display * dpy, XErrorEvent * err); #endif SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_context, globals.context); @@ -357,6 +358,8 @@ static switch_status_t interface_exists(char *the_interface) globals.SKYPOPEN_INTERFACES[interface_id].running = 0; + tech_pvt->interface_state = SKYPOPEN_STATE_DEAD; + if (globals.SKYPOPEN_INTERFACES[interface_id].skypopen_signaling_thread) { #ifdef WIN32 skypopen_signaling_write(tech_pvt, "DIE"); @@ -377,8 +380,8 @@ static switch_status_t interface_exists(char *the_interface) if (tech_pvt->running && tech_pvt->SkypopenHandles.disp) { XEvent e; Atom atom1 = XInternAtom(tech_pvt->SkypopenHandles.disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False); - switch_sleep(1000); //giovanni - XFlush(tech_pvt->SkypopenHandles.disp); //giovanni + switch_sleep(1000); + XFlush(tech_pvt->SkypopenHandles.disp); memset(&e, 0, sizeof(e)); e.xclient.type = ClientMessage; e.xclient.message_type = atom1; /* leading message */ @@ -387,7 +390,7 @@ static switch_status_t interface_exists(char *the_interface) e.xclient.format = 8; XSendEvent(tech_pvt->SkypopenHandles.disp, tech_pvt->SkypopenHandles.win, False, 0, &e); - XFlush(tech_pvt->SkypopenHandles.disp); //giovanni + XFlush(tech_pvt->SkypopenHandles.disp); } #endif } @@ -399,9 +402,6 @@ static switch_status_t interface_exists(char *the_interface) #ifndef WIN32 if (tech_pvt->SkypopenHandles.disp) { - DEBUGA_SKYPE("REMOVE CLOSIN X\n", SKYPOPEN_P_LOG); - XCloseDisplay(tech_pvt->SkypopenHandles.disp); - DEBUGA_SKYPE("REMOVE CLOSIN X END\n", SKYPOPEN_P_LOG); } #endif @@ -420,7 +420,11 @@ static switch_status_t interface_exists(char *the_interface) } else { DEBUGA_SKYPE("interface '%s' STILL console\n", SKYPOPEN_P_LOG, the_interface); } - memset(&globals.SKYPOPEN_INTERFACES[interface_id], '\0', sizeof(private_t)); + if(strlen(tech_pvt->session_uuid_str)){ + + }else{ + memset(&globals.SKYPOPEN_INTERFACES[interface_id], '\0', sizeof(private_t)); + } globals.real_interfaces--; switch_mutex_unlock(globals.mutex); @@ -473,7 +477,9 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session) if (tech_pvt) { DEBUGA_SKYPE("%s CHANNEL DESTROY %s\n", SKYPOPEN_P_LOG, tech_pvt->name, switch_core_session_get_uuid(session)); - tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; + if (tech_pvt->interface_state != SKYPOPEN_STATE_DEAD) { + tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; + } switch_mutex_lock(tech_pvt->flag_mutex); switch_clear_flag(tech_pvt, TFLAG_IO); @@ -553,13 +559,13 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session) //DEBUGA_SKYPE("debugging_hangup 18\n", SKYPOPEN_P_LOG); *tech_pvt->session_uuid_str = '\0'; - tech_pvt->interface_state = SKYPOPEN_STATE_IDLE; - tech_pvt->skype_callflow = CALLFLOW_CALL_IDLE; -#if 0 - if (tech_pvt->skype_callflow == CALLFLOW_STATUS_FINISHED) { + + if (tech_pvt->interface_state != SKYPOPEN_STATE_DEAD) { + tech_pvt->interface_state = SKYPOPEN_STATE_IDLE; tech_pvt->skype_callflow = CALLFLOW_CALL_IDLE; + }else{ + memset(tech_pvt, '\0', sizeof(private_t)); } -#endif // switch_core_session_set_private(session, NULL); } else { DEBUGA_SKYPE("!!!!!!NO tech_pvt!!!! CHANNEL DESTROY %s\n", SKYPOPEN_P_LOG, switch_core_session_get_uuid(session)); @@ -585,6 +591,9 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session) //DEBUGA_SKYPE("debugging_hangup 1\n", SKYPOPEN_P_LOG); if (tech_pvt) { + if (tech_pvt->interface_state == SKYPOPEN_STATE_DEAD) { + return SWITCH_STATUS_SUCCESS; + } if (!switch_channel_test_flag(channel, CF_ANSWERED)) { if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { tech_pvt->ob_failed_calls++; @@ -684,6 +693,10 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int switch (sig) { case SWITCH_SIG_KILL: DEBUGA_SKYPE("%s CHANNEL got SWITCH_SIG_KILL\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); + if (tech_pvt->interface_state == SKYPOPEN_STATE_DEAD) { + switch_channel_set_state(channel, CS_HANGUP); + return SWITCH_STATUS_SUCCESS; + } tech_pvt->interface_state = SKYPOPEN_STATE_HANGUP_REQUESTED; if (tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD) { DEBUGA_SKYPE("FYI %s CHANNEL in CALLFLOW_STATUS_REMOTEHOLD got SWITCH_SIG_KILL\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); @@ -1387,6 +1400,9 @@ static void *SWITCH_THREAD_FUNC skypopen_signaling_thread_func(switch_thread_t * DEBUGA_SKYPE("skype call ended\n", SKYPOPEN_P_LOG); if (tech_pvt) { + if (tech_pvt->interface_state == SKYPOPEN_STATE_DEAD) { + break; + } session = switch_core_session_locate(tech_pvt->session_uuid_str); if (session) { channel = switch_core_session_get_channel(session); @@ -1935,28 +1951,17 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skypopen_load) // CLOUDTREE (Thomas Hazel) #ifndef WIN32 // XXX: these assumes no one will override - XSetErrorHandler(X11_errors_handler); + //XSetErrorHandler(X11_errors_handler); + //XXX giovanni: seems that if Xserver is up, but skype client is crashed, the error is non fatal. Let's use Thomas handler in this case too + XSetErrorHandler(xio_error_handler2); XSetIOErrorHandler(xio_error_handler); memset(&global_handles_list, 0, sizeof(global_handles_list)); switch_mutex_init(&globals.list_mutex, SWITCH_MUTEX_NESTED, skypopen_module_pool); #endif - // CLOUDTREE (Thomas Hazel) - load_configs no longer locks things up, no need to fail load - load_config(FULL_RELOAD); - - // CLOUDTREE (Thomas Hazel) - setting "running = 1;" use to be located before "load_config" running = 1; - - if (switch_event_reserve_subclass(MY_EVENT_INCOMING_CHATMESSAGE) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass!\n"); - return SWITCH_STATUS_GENERR; - } - - if (switch_event_reserve_subclass(MY_EVENT_INCOMING_RAW) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass!\n"); - return SWITCH_STATUS_GENERR; - } + load_config(FULL_RELOAD); *module_interface = switch_loadable_module_create_module_interface(pool, modname); skypopen_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE); @@ -1968,14 +1973,23 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skypopen_load) SWITCH_ADD_API(commands_api_interface, "sk", "Skypopen console commands", sk_function, SK_SYNTAX); SWITCH_ADD_API(commands_api_interface, "skypopen", "Skypopen interface commands", skypopen_function, SKYPOPEN_SYNTAX); - SWITCH_ADD_API(commands_api_interface, "skypopen_chat", "Skypopen_chat interface remote_skypename TEXT", skypopen_chat_function, - SKYPOPEN_CHAT_SYNTAX); + SWITCH_ADD_API(commands_api_interface, "skypopen_chat", "Skypopen_chat interface remote_skypename TEXT", skypopen_chat_function, SKYPOPEN_CHAT_SYNTAX); SWITCH_ADD_CHAT(chat_interface, MDL_CHAT_PROTO, chat_send); + if (switch_event_reserve_subclass(MY_EVENT_INCOMING_CHATMESSAGE) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass!\n"); + return SWITCH_STATUS_FALSE; + } + + if (switch_event_reserve_subclass(MY_EVENT_INCOMING_RAW) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass!\n"); + return SWITCH_STATUS_FALSE; + } + /* indicate that the module should continue to be loaded */ return SWITCH_STATUS_SUCCESS; - } else - return SWITCH_STATUS_FALSE; + } + return SWITCH_STATUS_FALSE; } SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypopen_shutdown) diff --git a/src/mod/endpoints/mod_skypopen/skypopen.h b/src/mod/endpoints/mod_skypopen/skypopen.h index 7eca73d..ddeebdf 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen.h +++ b/src/mod/endpoints/mod_skypopen/skypopen.h @@ -132,6 +132,7 @@ typedef enum { #define SKYPOPEN_STATE_SELECTED 9 #define SKYPOPEN_STATE_HANGUP_REQUESTED 10 #define SKYPOPEN_STATE_PREANSWER 11 +#define SKYPOPEN_STATE_DEAD 99 /*********************************/ /* call flow from the device */ #define CALLFLOW_CALL_IDLE 0 diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index bab9d54..44be835 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -1514,6 +1514,30 @@ int xio_error_handler(Display * dpy) return 0; } +int xio_error_handler2(Display * dpy, XErrorEvent * err) +{ + private_t *tech_pvt = NULL; + struct SkypopenHandles *handle; + global_x_error = err->error_code; + + ERRORA("Received error code %d from X Server\n\n", SKYPOPEN_P_LOG, global_x_error); + ERRORA("Display error for %d, %s\n", SKYPOPEN_P_LOG, skypopen_list_size(&global_handles_list), dpy->display_name); + + handle = skypopen_list_remove_by_value(&global_handles_list, dpy); + if (handle != NULL) { +#ifdef XIO_ERROR_BY_SETJMP + siglongjmp(handle->ioerror_context, 1); +#endif +#ifdef XIO_ERROR_BY_UCONTEXT + setcontext(&handle->ioerror_context); +#endif + } + + ERRORA("Fatal display error for %p, %s - failed to siglongjmp\n", SKYPOPEN_P_LOG, (void *) handle, dpy->display_name); + + return 0; +} + int X11_errors_handler(Display * dpy, XErrorEvent * err) { @@ -1685,25 +1709,38 @@ void *skypopen_do_skypeapi_thread_func(void *obj) // CLOUDTREE (Thomas Hazel) #ifndef WIN32 { + char interfacename[256]; + skypopen_list_add(&global_handles_list, SkypopenHandles); + sprintf(interfacename, "#%s", tech_pvt->name); #ifdef XIO_ERROR_BY_SETJMP if (sigsetjmp(SkypopenHandles->ioerror_context, 1) != 0) { switch_core_session_t *session = NULL; + tech_pvt->interface_state = SKYPOPEN_STATE_DEAD; ERRORA("Fatal display error for %s - successed to jump\n", SKYPOPEN_P_LOG, tech_pvt->X11_display); session = switch_core_session_locate(tech_pvt->session_uuid_str); if (session) { switch_channel_t *channel = switch_core_session_get_channel(session); - WARNINGA("Closing session %s\n", SKYPOPEN_P_LOG, tech_pvt->skype_user); - switch_channel_hangup(channel, SWITCH_CAUSE_CRASH); + + + switch_mutex_lock(tech_pvt->flag_mutex); + switch_clear_flag(tech_pvt, TFLAG_IO); + switch_clear_flag(tech_pvt, TFLAG_VOICE); + if (switch_test_flag(tech_pvt, TFLAG_PROGRESS)) { + switch_clear_flag(tech_pvt, TFLAG_PROGRESS); + } + switch_mutex_unlock(tech_pvt->flag_mutex); + + switch_core_session_rwunlock(session); + WARNINGA("Closing session for %s\n", SKYPOPEN_P_LOG, interfacename); + switch_channel_hangup(channel, SWITCH_CAUSE_CRASH); } - WARNINGA("Removing skype user %s\n", SKYPOPEN_P_LOG, tech_pvt->skype_user); - tech_pvt->skypopen_api_thread = NULL; - remove_interface(tech_pvt->skype_user, TRUE); - XCloseDisplay(disp); + WARNINGA("Removing skype interface %s\n", SKYPOPEN_P_LOG, interfacename); + remove_interface(interfacename, TRUE); return NULL; } #endif @@ -1712,20 +1749,34 @@ void *skypopen_do_skypeapi_thread_func(void *obj) if (skypopen_list_find(&global_handles_list, SkypopenHandles) == NULL) { switch_core_session_t *session = NULL; + tech_pvt->interface_state = SKYPOPEN_STATE_DEAD; ERRORA("Fatal display error for %s - successed to jump\n", SKYPOPEN_P_LOG, tech_pvt->X11_display); session = switch_core_session_locate(tech_pvt->session_uuid_str); if (session) { switch_channel_t *channel = switch_core_session_get_channel(session); - WARNINGA("Closing session %s\n", SKYPOPEN_P_LOG, tech_pvt->skype_user); - switch_channel_hangup(channel, SWITCH_CAUSE_CRASH); + + + switch_mutex_lock(tech_pvt->flag_mutex); + switch_clear_flag(tech_pvt, TFLAG_IO); + switch_clear_flag(tech_pvt, TFLAG_VOICE); + if (switch_test_flag(tech_pvt, TFLAG_PROGRESS)) { + switch_clear_flag(tech_pvt, TFLAG_PROGRESS); + } + switch_mutex_unlock(tech_pvt->flag_mutex); + + switch_core_session_rwunlock(session); + WARNINGA("Closing session for %s\n", SKYPOPEN_P_LOG, interfacename); + switch_channel_hangup(channel, SWITCH_CAUSE_CRASH); + + //skypopen_sleep(500000); } - WARNINGA("Removing skype user %s\n", SKYPOPEN_P_LOG, tech_pvt->skype_user); - tech_pvt->skypopen_api_thread = NULL; - remove_interface(tech_pvt->skype_user, TRUE); - XCloseDisplay(disp); + WARNINGA("Removing skype interface %s\n", SKYPOPEN_P_LOG, interfacename); + //tech_pvt->skypopen_api_thread = NULL; + remove_interface(interfacename, TRUE); + //XCloseDisplay(disp); return NULL; } #endif commit 38215f9d5c22b31aeca4f5b0e79979d4d50d2eb9 Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Thu Oct 28 04:21:52 2010 -0500 skypopen: indented diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index 5a15853..f2f5c2a 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -447,9 +447,9 @@ static switch_status_t channel_on_init(switch_core_session_t *session) channel = switch_core_session_get_channel(session); switch_assert(channel != NULL); switch_channel_set_variable(channel, "skype_user", tech_pvt->skype_user); - switch_mutex_lock(tech_pvt->flag_mutex); + switch_mutex_lock(tech_pvt->flag_mutex); switch_set_flag(tech_pvt, TFLAG_IO); - switch_mutex_unlock(tech_pvt->flag_mutex); + switch_mutex_unlock(tech_pvt->flag_mutex); /* Move channel's state machine to ROUTING. This means the call is trying to get from the initial start where the call because, to the point @@ -484,21 +484,21 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session) switch_mutex_unlock(tech_pvt->flag_mutex); DEBUGA_SKYPE("audio tcp threads to DIE\n", SKYPOPEN_P_LOG); - conta=0; - while(tech_pvt->tcp_srv_thread){ + conta = 0; + while (tech_pvt->tcp_srv_thread) { switch_sleep(5000); conta++; - if(conta==200){ + if (conta == 200) { ERRORA("tcp_srv_thread is NOT dead, this can LEAK MEMORY\n", SKYPOPEN_P_LOG); break; } } DEBUGA_SKYPE("audio tcp srv thread DEAD %d\n", SKYPOPEN_P_LOG, conta); - conta=0; - while(tech_pvt->tcp_cli_thread){ + conta = 0; + while (tech_pvt->tcp_cli_thread) { switch_sleep(5000); conta++; - if(conta==200){ + if (conta == 200) { ERRORA("tcp_cli_thread is NOT dead, this can LEAK MEMORY\n", SKYPOPEN_P_LOG); break; } @@ -618,7 +618,6 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session) if (globals.calls < 0) { globals.calls = 0; } - //DEBUGA_SKYPE("debugging_hangup 9\n", SKYPOPEN_P_LOG); tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; if (tech_pvt->skype_callflow == CALLFLOW_STATUS_FINISHED) { @@ -869,15 +868,15 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch tech_pvt->read_frame.datalen = 640; } - switch_mutex_lock(tech_pvt->flag_mutex); + switch_mutex_lock(tech_pvt->flag_mutex); switch_set_flag(tech_pvt, TFLAG_VOICE); - switch_mutex_unlock(tech_pvt->flag_mutex); + switch_mutex_unlock(tech_pvt->flag_mutex); while (switch_test_flag(tech_pvt, TFLAG_IO)) { if (switch_test_flag(tech_pvt, TFLAG_BREAK)) { - switch_mutex_lock(tech_pvt->flag_mutex); + switch_mutex_lock(tech_pvt->flag_mutex); switch_clear_flag(tech_pvt, TFLAG_BREAK); - switch_mutex_unlock(tech_pvt->flag_mutex); + switch_mutex_unlock(tech_pvt->flag_mutex); DEBUGA_SKYPE("CHANNEL READ FRAME goto CNG\n", SKYPOPEN_P_LOG); goto cng; } @@ -888,9 +887,9 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch } if (switch_test_flag(tech_pvt, TFLAG_IO) && switch_test_flag(tech_pvt, TFLAG_VOICE)) { - switch_mutex_lock(tech_pvt->flag_mutex); + switch_mutex_lock(tech_pvt->flag_mutex); switch_clear_flag(tech_pvt, TFLAG_VOICE); - switch_mutex_unlock(tech_pvt->flag_mutex); + switch_mutex_unlock(tech_pvt->flag_mutex); if (!tech_pvt->read_frame.datalen) { DEBUGA_SKYPE("CHANNEL READ CONTINUE\n", SKYPOPEN_P_LOG); continue; @@ -916,7 +915,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch if (digit_str[0]) { switch_time_t new_dtmf_timestamp = switch_time_now(); - if ((new_dtmf_timestamp - tech_pvt->old_dtmf_timestamp) > 350000) { + if ((new_dtmf_timestamp - tech_pvt->old_dtmf_timestamp) > 350000) { char *p = digit_str; switch_channel_t *channel = switch_core_session_get_channel(session); @@ -1024,12 +1023,12 @@ static switch_status_t channel_answer_channel(switch_core_session_t *session) tech_pvt = switch_core_session_get_private(session); switch_assert(tech_pvt != NULL); - switch_mutex_lock(tech_pvt->flag_mutex); + switch_mutex_lock(tech_pvt->flag_mutex); switch_clear_flag(tech_pvt, TFLAG_IO); - switch_mutex_unlock(tech_pvt->flag_mutex); + switch_mutex_unlock(tech_pvt->flag_mutex); skypopen_answer(tech_pvt); - while (!switch_test_flag(tech_pvt, TFLAG_IO)) { + while (!switch_test_flag(tech_pvt, TFLAG_IO)) { if (switch_channel_get_state(channel) == CS_RESET) { return SWITCH_STATUS_FALSE; } @@ -1069,9 +1068,9 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s case SWITCH_MESSAGE_INDICATE_PROGRESS: { DEBUGA_SKYPE("%s CHANNEL got SWITCH_MESSAGE_INDICATE_PROGRESS\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); - switch_mutex_lock(tech_pvt->flag_mutex); + switch_mutex_lock(tech_pvt->flag_mutex); switch_set_flag(tech_pvt, TFLAG_PROGRESS); - switch_mutex_unlock(tech_pvt->flag_mutex); + switch_mutex_unlock(tech_pvt->flag_mutex); } break; case SWITCH_MESSAGE_INDICATE_CLEAR_PROGRESS: @@ -1406,21 +1405,21 @@ static void *SWITCH_THREAD_FUNC skypopen_signaling_thread_func(switch_thread_t * tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; DEBUGA_SKYPE("audio tcp threads to DIE\n", SKYPOPEN_P_LOG); - conta=0; - while(tech_pvt->tcp_srv_thread){ + conta = 0; + while (tech_pvt->tcp_srv_thread) { switch_sleep(5000); conta++; - if(conta==200){ + if (conta == 200) { ERRORA("tcp_srv_thread is NOT dead, this can LEAK MEMORY\n", SKYPOPEN_P_LOG); break; } } DEBUGA_SKYPE("audio tcp srv thread DEAD %d\n", SKYPOPEN_P_LOG, conta); - conta=0; - while(tech_pvt->tcp_cli_thread){ + conta = 0; + while (tech_pvt->tcp_cli_thread) { switch_sleep(5000); conta++; - if(conta==200){ + if (conta == 200) { ERRORA("tcp_cli_thread is NOT dead, this can LEAK MEMORY\n", SKYPOPEN_P_LOG); break; } @@ -2018,8 +2017,8 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypopen_shutdown) XEvent e; Atom atom1 = XInternAtom(tech_pvt->SkypopenHandles.disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False); - switch_sleep(1000); - XFlush(tech_pvt->SkypopenHandles.disp); + switch_sleep(1000); + XFlush(tech_pvt->SkypopenHandles.disp); memset(&e, 0, sizeof(e)); e.xclient.type = ClientMessage; e.xclient.message_type = atom1; /* leading message */ @@ -2028,12 +2027,12 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypopen_shutdown) e.xclient.format = 8; XSendEvent(tech_pvt->SkypopenHandles.disp, tech_pvt->SkypopenHandles.win, False, 0, &e); - XFlush(tech_pvt->SkypopenHandles.disp); + XFlush(tech_pvt->SkypopenHandles.disp); } #endif } x = 10; - while (x) { + while (x) { x--; switch_yield(50000); } @@ -2360,7 +2359,7 @@ private_t *find_available_skypopen_interface_rr(private_t *tech_pvt_calling) tech_pvt = &globals.SKYPOPEN_INTERFACES[interface_id]; skype_state = tech_pvt->interface_state; - if ((tech_pvt_calling ? strcmp(tech_pvt->skype_user, tech_pvt_calling->skype_user) : 1) + if ((tech_pvt_calling ? strcmp(tech_pvt->skype_user, tech_pvt_calling->skype_user) : 1) && (SKYPOPEN_STATE_IDLE == skype_state)) { DEBUGA_SKYPE("returning as available skype interface name: %s, state: %d callflow: %d\n", SKYPOPEN_P_LOG, tech_pvt->name, skype_state, tech_pvt->skype_callflow); @@ -2757,7 +2756,7 @@ int skypopen_transfer(private_t *tech_pvt) giovatech = &globals.SKYPOPEN_INTERFACES[i]; /* let's look for a IDLE one */ - if ((giovatech->interface_state == SKYPOPEN_STATE_IDLE) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user))) { + if ((giovatech->interface_state == SKYPOPEN_STATE_IDLE) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user))) { found = 1; DEBUGA_SKYPE ("FOUND (name=%s, giovatech->interface_state=%d == SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n", @@ -3073,7 +3072,7 @@ struct SkypopenHandles *skypopen_list_remove_by_value(struct SkypopenList *list, // CLOUDTREE (THomas Hazel) - is there a capable freeswitch list? struct SkypopenHandles *skypopen_list_remove_by_reference(struct SkypopenList *list, struct SkypopenHandles *handle) { - private_t *tech_pvt=NULL; + private_t *tech_pvt = NULL; switch_mutex_lock(globals.list_mutex); @@ -3081,7 +3080,7 @@ struct SkypopenHandles *skypopen_list_remove_by_reference(struct SkypopenList *l if (handle->managed == SWITCH_FALSE) { // already removed switch_mutex_unlock(globals.list_mutex); - DEBUGA_SKYPE("EXIT REMOVE\n", SKYPOPEN_P_LOG); + DEBUGA_SKYPE("EXIT REMOVE\n", SKYPOPEN_P_LOG); return 0; } diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index 96ab542..bab9d54 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -227,27 +227,29 @@ int skypopen_signaling_read(private_t *tech_pvt) } } else if (!strncasecmp(message, "ERROR 36 Not online", 18)) { char msg_to_skype[256]; - ERRORA("Skype client is not online, eg: not connected to Skype network, probably got a temporary net outage: |||%s|||\n", SKYPOPEN_P_LOG, message); - if(strlen(tech_pvt->skype_call_id)){ - sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id); - skypopen_signaling_write(tech_pvt, msg_to_skype); + ERRORA("Skype client is not online, eg: not connected to Skype network, probably got a temporary net outage: |||%s|||\n", + SKYPOPEN_P_LOG, message); + if (strlen(tech_pvt->skype_call_id)) { + sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id); + skypopen_signaling_write(tech_pvt, msg_to_skype); } - if(strlen(tech_pvt->ring_id)){ - sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->ring_id); - skypopen_signaling_write(tech_pvt, msg_to_skype); + if (strlen(tech_pvt->ring_id)) { + sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->ring_id); + skypopen_signaling_write(tech_pvt, msg_to_skype); } tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; return CALLFLOW_INCOMING_HANGUP; } else if (!strncasecmp(message, "ERROR 589 ALTER CALL", 19)) { char msg_to_skype[256]; - DEBUGA_SKYPE("Skype client was not able to correctly manage tcp audio sockets, probably got a local or remote hangup: |||%s|||\n", SKYPOPEN_P_LOG, message); - if(strlen(tech_pvt->skype_call_id)){ - sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id); - skypopen_signaling_write(tech_pvt, msg_to_skype); + DEBUGA_SKYPE("Skype client was not able to correctly manage tcp audio sockets, probably got a local or remote hangup: |||%s|||\n", + SKYPOPEN_P_LOG, message); + if (strlen(tech_pvt->skype_call_id)) { + sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id); + skypopen_signaling_write(tech_pvt, msg_to_skype); } - if(strlen(tech_pvt->ring_id)){ - sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->ring_id); - skypopen_signaling_write(tech_pvt, msg_to_skype); + if (strlen(tech_pvt->ring_id)) { + sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->ring_id); + skypopen_signaling_write(tech_pvt, msg_to_skype); } tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; return CALLFLOW_INCOMING_HANGUP; @@ -497,7 +499,7 @@ int skypopen_signaling_read(private_t *tech_pvt) //SKYPOPEN_P_LOG, message, obj, id, prop, value, where ? where : "NULL"); if (!strcasecmp(prop, "PARTNER_HANDLE")) { - if (tech_pvt->interface_state == SKYPOPEN_STATE_IDLE){ + if (tech_pvt->interface_state == SKYPOPEN_STATE_IDLE) { /* we are NOT inside an active call */ DEBUGA_SKYPE("Call %s go to skypopen_partner_handle_ring\n", SKYPOPEN_P_LOG, id); skypopen_strncpy(tech_pvt->ring_id, id, sizeof(tech_pvt->ring_id)); @@ -579,7 +581,7 @@ int skypopen_signaling_read(private_t *tech_pvt) if (!strcasecmp(value, "RINGING")) { char msg_to_skype[1024]; - if (tech_pvt->interface_state == SKYPOPEN_STATE_IDLE){ + if (tech_pvt->interface_state == SKYPOPEN_STATE_IDLE) { // CLOUDTREE (Thomas Hazel) skypopen_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1); @@ -604,8 +606,9 @@ int skypopen_signaling_read(private_t *tech_pvt) skypopen_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1); DEBUGA_SKYPE("Our remote party in skype_call %s is RINGING\n", SKYPOPEN_P_LOG, id); if (remote_party_is_ringing(tech_pvt) != SWITCH_STATUS_SUCCESS) { - DEBUGA_SKYPE("We are getting the RINGING from a call we probably canceled, trying to get out hanging up call id: %s.\n", - SKYPOPEN_P_LOG, id); + DEBUGA_SKYPE + ("We are getting the RINGING from a call we probably canceled, trying to get out hanging up call id: %s.\n", + SKYPOPEN_P_LOG, id); sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", id); skypopen_signaling_write(tech_pvt, msg_to_skype); sprintf(msg_to_skype, "ALTER CALL %s HANGUP", id); @@ -735,7 +738,7 @@ int skypopen_signaling_read(private_t *tech_pvt) skypopen_signaling_write(tech_pvt, msg_to_skype); } tech_pvt->skype_callflow = CALLFLOW_STATUS_INPROGRESS; - if(skypopen_answered(tech_pvt)!= SWITCH_STATUS_SUCCESS){ + if (skypopen_answered(tech_pvt) != SWITCH_STATUS_SUCCESS) { sprintf(msg_to_skype, "ALTER CALL %s HANGUP", id); skypopen_signaling_write(tech_pvt, msg_to_skype); } @@ -866,8 +869,8 @@ void *skypopen_do_tcp_srv_thread_func(void *obj) if (!(running && tech_pvt->running)) break; while (tech_pvt && tech_pvt->interface_state != SKYPOPEN_STATE_DOWN - && tech_pvt->interface_state != SKYPOPEN_STATE_IDLE - && tech_pvt->interface_state != SKYPOPEN_STATE_HANGUP_REQUESTED + && tech_pvt->interface_state != SKYPOPEN_STATE_IDLE + && tech_pvt->interface_state != SKYPOPEN_STATE_HANGUP_REQUESTED && (tech_pvt->skype_callflow == CALLFLOW_STATUS_INPROGRESS || tech_pvt->skype_callflow == CALLFLOW_STATUS_EARLYMEDIA || tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD || tech_pvt->skype_callflow == SKYPOPEN_STATE_UP)) { @@ -1026,8 +1029,8 @@ void *skypopen_do_tcp_cli_thread_func(void *obj) if (!(running && tech_pvt->running)) break; while (tech_pvt && tech_pvt->interface_state != SKYPOPEN_STATE_DOWN - && tech_pvt->interface_state != SKYPOPEN_STATE_IDLE - && tech_pvt->interface_state != SKYPOPEN_STATE_HANGUP_REQUESTED + && tech_pvt->interface_state != SKYPOPEN_STATE_IDLE + && tech_pvt->interface_state != SKYPOPEN_STATE_HANGUP_REQUESTED && (tech_pvt->skype_callflow == CALLFLOW_STATUS_INPROGRESS || tech_pvt->skype_callflow == CALLFLOW_STATUS_EARLYMEDIA || tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD || tech_pvt->skype_callflow == SKYPOPEN_STATE_UP)) { @@ -1536,8 +1539,8 @@ int skypopen_send_message(private_t *tech_pvt, const char *message_P) unsigned int len = strlen(message_P); XEvent e; - skypopen_sleep(1000); - XFlush(disp); + skypopen_sleep(1000); + XFlush(disp); memset(&e, 0, sizeof(e)); e.xclient.type = ClientMessage; @@ -1916,9 +1919,9 @@ int inbound_channel_answered(private_t *tech_pvt) channel = switch_core_session_get_channel(session); if (channel) { - switch_mutex_lock(tech_pvt->flag_mutex); + switch_mutex_lock(tech_pvt->flag_mutex); switch_set_flag(tech_pvt, TFLAG_IO); - switch_mutex_unlock(tech_pvt->flag_mutex); + switch_mutex_unlock(tech_pvt->flag_mutex); } else { ERRORA("no channel\n", SKYPOPEN_P_LOG); } @@ -1938,30 +1941,30 @@ int skypopen_answered(private_t *tech_pvt) switch_core_session_t *session = NULL; switch_channel_t *channel = NULL; - if(strlen(tech_pvt->session_uuid_str)){ - session = switch_core_session_locate(tech_pvt->session_uuid_str); - if (session) { - channel = switch_core_session_get_channel(session); + if (strlen(tech_pvt->session_uuid_str)) { + session = switch_core_session_locate(tech_pvt->session_uuid_str); + if (session) { + channel = switch_core_session_get_channel(session); + + if (channel) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { + tech_pvt->interface_state = SKYPOPEN_STATE_UP; + DEBUGA_SKYPE("Outbound Channel Answered! session_uuid_str=%s\n", SKYPOPEN_P_LOG, tech_pvt->session_uuid_str); + outbound_channel_answered(tech_pvt); + } else { + DEBUGA_SKYPE("answered Inbound Channel!\n\n\n\n", SKYPOPEN_P_LOG); + inbound_channel_answered(tech_pvt); + } - if (channel) { - if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { - tech_pvt->interface_state = SKYPOPEN_STATE_UP; - DEBUGA_SKYPE("Outbound Channel Answered! session_uuid_str=%s\n", SKYPOPEN_P_LOG, tech_pvt->session_uuid_str); - outbound_channel_answered(tech_pvt); } else { - DEBUGA_SKYPE("answered Inbound Channel!\n\n\n\n", SKYPOPEN_P_LOG); - inbound_channel_answered(tech_pvt); + ERRORA("no channel after INPROGRESS?\n", SKYPOPEN_P_LOG); + return SWITCH_STATUS_FALSE; } - + switch_core_session_rwunlock(session); } else { - ERRORA("no channel after INPROGRESS?\n", SKYPOPEN_P_LOG); + WARNINGA("no session after INPROGRESS, let's hangup\n", SKYPOPEN_P_LOG); return SWITCH_STATUS_FALSE; } - switch_core_session_rwunlock(session); - } else { - WARNINGA("no session after INPROGRESS, let's hangup\n", SKYPOPEN_P_LOG); - return SWITCH_STATUS_FALSE; - } } else { WARNINGA("no tech_pvt->session_uuid_str after INPROGRESS, let's hangup\n", SKYPOPEN_P_LOG); return SWITCH_STATUS_FALSE; commit bc067ebc69341693f6970cfc43926f88f2971d3d Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Thu Oct 28 04:18:24 2010 -0500 skypopen: cosmetics diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index bff63d7..5a15853 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -387,7 +387,6 @@ static switch_status_t interface_exists(char *the_interface) e.xclient.format = 8; XSendEvent(tech_pvt->SkypopenHandles.disp, tech_pvt->SkypopenHandles.win, False, 0, &e); - //giovanni XSync(tech_pvt->SkypopenHandles.disp, False); XFlush(tech_pvt->SkypopenHandles.disp); //giovanni } #endif @@ -477,10 +476,8 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session) tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; switch_mutex_lock(tech_pvt->flag_mutex); -#if 1 switch_clear_flag(tech_pvt, TFLAG_IO); switch_clear_flag(tech_pvt, TFLAG_VOICE); -#endif//0 if (switch_test_flag(tech_pvt, TFLAG_PROGRESS)) { switch_clear_flag(tech_pvt, TFLAG_PROGRESS); } @@ -598,10 +595,8 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session) tech_pvt->interface_state = SKYPOPEN_STATE_HANGUP_REQUESTED; switch_mutex_lock(tech_pvt->flag_mutex); -#if 1 switch_clear_flag(tech_pvt, TFLAG_IO); switch_clear_flag(tech_pvt, TFLAG_VOICE); -#endif//0 if (switch_test_flag(tech_pvt, TFLAG_PROGRESS)) { switch_clear_flag(tech_pvt, TFLAG_PROGRESS); } @@ -617,33 +612,6 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session) sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id); skypopen_signaling_write(tech_pvt, msg_to_skype); } -#if 0 - switch_sleep(1500000); //XXX 1.5 seconds, let's the audio tcp threads die XXX - //FIXME must not allow using the tech_pvt while this sleeps, so must implement a check on interface_state - - DEBUGA_SKYPE("debugging_hangup 3\n", SKYPOPEN_P_LOG); - switch_mutex_lock(tech_pvt->mutex_thread_audio_cli); - DEBUGA_SKYPE("debugging_hangup cli lock\n", SKYPOPEN_P_LOG); - if (tech_pvt->tcp_cli_thread) { - DEBUGA_SKYPE("debugging_hangup 4\n", SKYPOPEN_P_LOG); - switch_thread_join(&status, tech_pvt->tcp_cli_thread); - tech_pvt->tcp_cli_thread = NULL; - DEBUGA_SKYPE("debugging_hangup 5\n", SKYPOPEN_P_LOG); - } - switch_mutex_unlock(tech_pvt->mutex_thread_audio_cli); - DEBUGA_SKYPE("debugging_hangup cli unlock\n", SKYPOPEN_P_LOG); - switch_mutex_lock(tech_pvt->mutex_thread_audio_srv); - DEBUGA_SKYPE("debugging_hangup srv lock\n", SKYPOPEN_P_LOG); - if (tech_pvt->tcp_srv_thread) { - DEBUGA_SKYPE("debugging_hangup 6\n", SKYPOPEN_P_LOG); - switch_thread_join(&status, tech_pvt->tcp_srv_thread); - tech_pvt->tcp_srv_thread = NULL; - DEBUGA_SKYPE("debugging_hangup 7\n", SKYPOPEN_P_LOG); - } - switch_mutex_unlock(tech_pvt->mutex_thread_audio_srv); - DEBUGA_SKYPE("debugging_hangup srv unlock\n", SKYPOPEN_P_LOG); - DEBUGA_SKYPE("debugging_hangup 8\n", SKYPOPEN_P_LOG); -#endif //0 DEBUGA_SKYPE("%s CHANNEL HANGUP\n", SKYPOPEN_P_LOG, tech_pvt->name); switch_mutex_lock(globals.mutex); globals.calls--; @@ -706,7 +674,6 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int { switch_channel_t *channel = NULL; private_t *tech_pvt = NULL; - //char msg_to_skype[256]; channel = switch_core_session_get_channel(session); switch_assert(channel != NULL); @@ -731,28 +698,13 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int } switch_mutex_lock(tech_pvt->flag_mutex); -#if 1 switch_clear_flag(tech_pvt, TFLAG_IO); switch_clear_flag(tech_pvt, TFLAG_VOICE); switch_set_flag(tech_pvt, TFLAG_HANGUP); -#endif//0 if (switch_test_flag(tech_pvt, TFLAG_PROGRESS)) { switch_clear_flag(tech_pvt, TFLAG_PROGRESS); } switch_mutex_unlock(tech_pvt->flag_mutex); -#if 0 - sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->ring_id); - skypopen_signaling_write(tech_pvt, msg_to_skype); - sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->ring_id); - skypopen_signaling_write(tech_pvt, msg_to_skype); - -#if 1 - sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->skype_call_id); - skypopen_signaling_write(tech_pvt, msg_to_skype); - sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id); - skypopen_signaling_write(tech_pvt, msg_to_skype); -#endif -#endif//0 break; case SWITCH_SIG_BREAK: DEBUGA_SKYPE("%s CHANNEL got SWITCH_SIG_BREAK\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); @@ -964,7 +916,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch if (digit_str[0]) { switch_time_t new_dtmf_timestamp = switch_time_now(); - if ((new_dtmf_timestamp - tech_pvt->old_dtmf_timestamp) > 350000) { //FIXME: make it configurable + if ((new_dtmf_timestamp - tech_pvt->old_dtmf_timestamp) > 350000) { char *p = digit_str; switch_channel_t *channel = switch_core_session_get_channel(session); @@ -1046,7 +998,6 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc switch_mutex_lock(tech_pvt->mutex_audio_cli); if (switch_buffer_freespace(tech_pvt->write_buffer) < frame->datalen) { DEBUGA_SKYPE("NO SPACE WRITE: %d\n", SKYPOPEN_P_LOG, frame->datalen); - //switch_buffer_toss(tech_pvt->write_buffer, frame->datalen); switch_buffer_zero(tech_pvt->write_buffer); no_space = 1; } @@ -1078,7 +1029,7 @@ static switch_status_t channel_answer_channel(switch_core_session_t *session) switch_mutex_unlock(tech_pvt->flag_mutex); skypopen_answer(tech_pvt); - while (!switch_test_flag(tech_pvt, TFLAG_IO)) { //FIXME that would be better with a timeout + while (!switch_test_flag(tech_pvt, TFLAG_IO)) { if (switch_channel_get_state(channel) == CS_RESET) { return SWITCH_STATUS_FALSE; } @@ -1107,7 +1058,6 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s switch_channel_t *channel; private_t *tech_pvt; char msg_to_skype[256]; - //int i; channel = switch_core_session_get_channel(session); switch_assert(channel != NULL); @@ -1136,9 +1086,9 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s skypopen_signaling_write(tech_pvt, msg_to_skype); sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id); skypopen_signaling_write(tech_pvt, msg_to_skype); - switch_mutex_lock(tech_pvt->flag_mutex); + switch_mutex_lock(tech_pvt->flag_mutex); switch_clear_flag(tech_pvt, TFLAG_PROGRESS); - switch_mutex_unlock(tech_pvt->flag_mutex); + switch_mutex_unlock(tech_pvt->flag_mutex); } } break; @@ -1147,11 +1097,10 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s { DEBUGA_SKYPE("%s CHANNEL got SWITCH_MESSAGE_INDICATE_ANSWER\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); - //switch_set_flag(tech_pvt, TFLAG_IO); channel_answer_channel(session); - switch_mutex_lock(tech_pvt->flag_mutex); + switch_mutex_lock(tech_pvt->flag_mutex); switch_clear_flag(tech_pvt, TFLAG_PROGRESS); - switch_mutex_unlock(tech_pvt->flag_mutex); + switch_mutex_unlock(tech_pvt->flag_mutex); if (tech_pvt->read_buffer) { switch_mutex_lock(tech_pvt->mutex_audio_srv); @@ -1480,9 +1429,7 @@ static void *SWITCH_THREAD_FUNC skypopen_signaling_thread_func(switch_thread_t * } switch_mutex_lock(globals.mutex); tech_pvt->ringing_state = SKYPOPEN_RINGING_INIT; - //tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; *tech_pvt->session_uuid_str = '\0'; - //*tech_pvt->skype_call_id = '\0'; *tech_pvt->initial_skype_user = '\0'; *tech_pvt->answer_id = '\0'; *tech_pvt->answer_value = '\0'; @@ -1491,7 +1438,6 @@ static void *SWITCH_THREAD_FUNC skypopen_signaling_thread_func(switch_thread_t * *tech_pvt->callid_number = '\0'; *tech_pvt->callid_name = '\0'; - //switch_sleep(300000); //0.3 sec tech_pvt->skype_callflow = CALLFLOW_CALL_IDLE; tech_pvt->interface_state = SKYPOPEN_STATE_IDLE; switch_mutex_unlock(globals.mutex); @@ -1812,8 +1758,6 @@ static switch_status_t load_config(int reload_type) ("Interface_id=%d is now STARTED, the Skype client to which we are connected gave us the correct CURRENTUSERHANDLE (%s)\n", SKYPOPEN_P_LOG, interface_id, globals.SKYPOPEN_INTERFACES[interface_id].skype_user); - -/* giovanni*/ skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[interface_id], "PROTOCOL 7"); switch_sleep(10000); skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[interface_id], "SET AUTOAWAY OFF"); @@ -1830,7 +1774,6 @@ static switch_status_t load_config(int reload_type) skypopen_signaling_write(&globals.SKYPOPEN_INTERFACES[interface_id], "SET SILENT_MODE ON"); switch_sleep(10000); } -/* giovanni */ } else { ERRORA ("The Skype client to which we are connected FAILED to gave us CURRENTUSERHANDLE=%s, interface_id=%d FAILED to start. No Skype client logged in as '%s' has been found. Please (re)launch a Skype client logged in as '%s'. Skypopen exiting now\n", @@ -2001,12 +1944,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skypopen_load) #endif // CLOUDTREE (Thomas Hazel) - load_configs no longer locks things up, no need to fail load - /*if ( */ load_config(FULL_RELOAD); - /* != SWITCH_STATUS_SUCCESS) { - running = 0; - return SWITCH_STATUS_FALSE; - } - */ + load_config(FULL_RELOAD); // CLOUDTREE (Thomas Hazel) - setting "running = 1;" use to be located before "load_config" running = 1; @@ -2080,8 +2018,8 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypopen_shutdown) XEvent e; Atom atom1 = XInternAtom(tech_pvt->SkypopenHandles.disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False); - switch_sleep(1000); //giovanni - XFlush(tech_pvt->SkypopenHandles.disp); //giovanni + switch_sleep(1000); + XFlush(tech_pvt->SkypopenHandles.disp); memset(&e, 0, sizeof(e)); e.xclient.type = ClientMessage; e.xclient.message_type = atom1; /* leading message */ @@ -2090,13 +2028,12 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypopen_shutdown) e.xclient.format = 8; XSendEvent(tech_pvt->SkypopenHandles.disp, tech_pvt->SkypopenHandles.win, False, 0, &e); - //giovanni XSync(tech_pvt->SkypopenHandles.disp, False); - XFlush(tech_pvt->SkypopenHandles.disp); //giovanni + XFlush(tech_pvt->SkypopenHandles.disp); } #endif } x = 10; - while (x) { //FIXME 0.5 seconds? + while (x) { x--; switch_yield(50000); } @@ -2411,7 +2348,6 @@ private_t *find_available_skypopen_interface_rr(private_t *tech_pvt_calling) /* Fact is the real interface start from 1 */ //XXX no, is just a convention, but you can have it start from 0. I do not, for aestetic reasons :-) - //if (globals.next_interface == 0) globals.next_interface = 1; for (i = 0; i < SKYPOPEN_MAX_INTERFACES; i++) { int interface_id; @@ -2424,9 +2360,7 @@ private_t *find_available_skypopen_interface_rr(private_t *tech_pvt_calling) tech_pvt = &globals.SKYPOPEN_INTERFACES[interface_id]; skype_state = tech_pvt->interface_state; - //DEBUGA_SKYPE("skype interface: %d, name: %s, state: %d\n", SKYPOPEN_P_LOG, interface_id, globals.SKYPOPEN_INTERFACES[interface_id].name, skype_state); if ((tech_pvt_calling ? strcmp(tech_pvt->skype_user, tech_pvt_calling->skype_user) : 1) - //&& (SKYPOPEN_STATE_DOWN == skype_state || 0 == skype_state) && (tech_pvt->skype_callflow == CALLFLOW_STATUS_FINISHED || 0 == tech_pvt->skype_callflow)) {} && (SKYPOPEN_STATE_IDLE == skype_state)) { DEBUGA_SKYPE("returning as available skype interface name: %s, state: %d callflow: %d\n", SKYPOPEN_P_LOG, tech_pvt->name, skype_state, tech_pvt->skype_callflow); @@ -2526,8 +2460,6 @@ SWITCH_STANDARD_API(sk_function) goto end; } - } else if (!strcasecmp(argv[0], "ciapalino")) { - } else if (!strcasecmp(argv[0], "reload")) { if (load_config(SOFT_RELOAD) != SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "sk reload failed\n"); @@ -2623,12 +2555,9 @@ int skypopen_partner_handle_ring(private_t *tech_pvt) char *id = tech_pvt->ring_id; char *value = tech_pvt->ring_value; switch_core_session_t *session = NULL; - //switch_channel_t *channel = NULL; switch_mutex_lock(globals.mutex); - //WARNINGA("PARTNER_HANDLE tech_pvt->skype_call_id=%s, tech_pvt->skype_callflow=%d, tech_pvt->interface_state=%d, tech_pvt->skype_user=%s, tech_pvt->callid_number=%s, tech_pvt->ring_value=%s, tech_pvt->ring_id=%s, tech_pvt->answer_value=%s, tech_pvt->answer_id=%s\n", SKYPOPEN_P_LOG, tech_pvt->skype_call_id, tech_pvt->skype_callflow, tech_pvt->interface_state, tech_pvt->skype_user, tech_pvt->callid_number, tech_pvt->ring_value, tech_pvt->ring_id, tech_pvt->answer_value, tech_pvt->answer_id); - gettimeofday(&timenow, NULL); for (i = 0; !found && i < SKYPOPEN_MAX_INTERFACES; i++) { if (strlen(globals.SKYPOPEN_INTERFACES[i].name)) { @@ -2663,7 +2592,6 @@ int skypopen_partner_handle_ring(private_t *tech_pvt) DEBUGA_SKYPE("NOT FOUND\n", SKYPOPEN_P_LOG); // CLOUDTREE (Thomas Hazel) - //if (tech_pvt && tech_pvt->skype_call_id && !strlen(tech_pvt->skype_call_id)) { if (tech_pvt && tech_pvt->ringing_state == SKYPOPEN_RINGING_INIT) { /* we are not inside an active call */ @@ -2671,9 +2599,6 @@ int skypopen_partner_handle_ring(private_t *tech_pvt) gettimeofday(&tech_pvt->ring_time, NULL); switch_copy_string(tech_pvt->callid_number, value, sizeof(tech_pvt->callid_number) - 1); - - //WARNINGA("PARTNER_HANDLE_RING tech_pvt->skype_call_id=%s, tech_pvt->skype_callflow=%d, tech_pvt->interface_state=%d, tech_pvt->skype_user=%s, tech_pvt->callid_number=%s, tech_pvt->ring_value=%s, tech_pvt->ring_id=%s, tech_pvt->answer_value=%s, tech_pvt->answer_id=%s\n", SKYPOPEN_P_LOG, tech_pvt->skype_call_id, tech_pvt->skype_callflow, tech_pvt->interface_state, tech_pvt->skype_user, tech_pvt->callid_number, tech_pvt->ring_value, tech_pvt->ring_id, tech_pvt->answer_value, tech_pvt->answer_id); - session = switch_core_session_locate(tech_pvt->session_uuid_str); if (session) { switch_core_session_rwunlock(session); @@ -2682,24 +2607,6 @@ int skypopen_partner_handle_ring(private_t *tech_pvt) new_inbound_channel(tech_pvt); -#if 0 - session = switch_core_session_locate(tech_pvt->session_uuid_str); - if (session) { - channel = switch_core_session_get_channel(session); - - switch_core_session_queue_indication(session, SWITCH_MESSAGE_INDICATE_RINGING); - if (channel) { - switch_channel_mark_ring_ready(channel); - } else { - ERRORA("no channel\n", SKYPOPEN_P_LOG); - } - switch_core_session_rwunlock(session); - } else { - ERRORA("no session\n", SKYPOPEN_P_LOG); - - } -#endif //0 - } else if (!tech_pvt || !tech_pvt->skype_call_id) { ERRORA("No Call ID?\n", SKYPOPEN_P_LOG); } else { @@ -2728,8 +2635,6 @@ int skypopen_answer(private_t *tech_pvt) switch_mutex_lock(globals.mutex); - //WARNINGA("ANSWER tech_pvt->skype_call_id=%s, tech_pvt->skype_callflow=%d, tech_pvt->interface_state=%d, tech_pvt->skype_user=%s, tech_pvt->callid_number=%s, tech_pvt->ring_value=%s, tech_pvt->ring_id=%s, tech_pvt->answer_value=%s, tech_pvt->answer_id=%s\n", SKYPOPEN_P_LOG, tech_pvt->skype_call_id, tech_pvt->skype_callflow, tech_pvt->interface_state, tech_pvt->skype_user, tech_pvt->callid_number, tech_pvt->ring_value, tech_pvt->ring_id, tech_pvt->answer_value, tech_pvt->answer_id); - gettimeofday(&timenow, NULL); for (i = 0; !found && i < SKYPOPEN_MAX_INTERFACES; i++) { if (strlen(globals.SKYPOPEN_INTERFACES[i].name)) { @@ -2784,7 +2689,6 @@ int skypopen_answer(private_t *tech_pvt) DEBUGA_SKYPE("NOT FOUND\n", SKYPOPEN_P_LOG); // CLOUDTREE (Thomas Hazel) - //if (tech_pvt && tech_pvt->skype_call_id && !strlen(tech_pvt->skype_call_id)) { if (tech_pvt && tech_pvt->ringing_state == SKYPOPEN_RINGING_INIT) { /* we are not inside an active call */ @@ -2816,7 +2720,6 @@ int skypopen_answer(private_t *tech_pvt) return 0; } -//int skypopen_transfer(private_t * tech_pvt, char *id, char *value) int skypopen_transfer(private_t *tech_pvt) { char msg_to_skype[1024]; @@ -2844,50 +2747,17 @@ int skypopen_transfer(private_t *tech_pvt) if (tech_pvt->interface_state == SKYPOPEN_STATE_PRERING) { tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; } -#if 0 - - - else if (tech_pvt->interface_state != 0 && tech_pvt->interface_state != SKYPOPEN_STATE_DOWN) { - WARNINGA("Why an interface_state %d HERE?\n", SKYPOPEN_P_LOG, tech_pvt->interface_state); - tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; - } - - *tech_pvt->answer_id = '\0'; - *tech_pvt->answer_value = '\0'; - *tech_pvt->ring_id = '\0'; - *tech_pvt->ring_value = '\0'; -#endif //0 break; } } } - - /*****************************************/ -#if 0 - gettimeofday(&timenow, NULL); - for (i = 0; !found && i < SKYPOPEN_MAX_INTERFACES; i++) { - if (strlen(globals.SKYPOPEN_INTERFACES[i].name)) { - - giovatech = &globals.SKYPOPEN_INTERFACES[i]; - if (strlen(giovatech->skype_call_id) && (giovatech->interface_state != SKYPOPEN_STATE_DOWN) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user)) && (!strcmp(giovatech->callid_number, value)) && ((((timenow.tv_sec - giovatech->answer_time.tv_sec) * 1000000) + (timenow.tv_usec - giovatech->answer_time.tv_usec)) < 500000)) { //0.5sec - found = 1; - DEBUGA_SKYPE - ("FOUND (name=%s, giovatech->interface_state=%d != SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n", - SKYPOPEN_P_LOG, giovatech->name, giovatech->interface_state, - giovatech->skype_user, tech_pvt->skype_user, giovatech->callid_number, value) - break; - } - } - } -#endif //0 for (i = 0; !found && i < SKYPOPEN_MAX_INTERFACES; i++) { if (strlen(globals.SKYPOPEN_INTERFACES[i].name)) { giovatech = &globals.SKYPOPEN_INTERFACES[i]; /* let's look for a IDLE one */ - //if ((giovatech->interface_state == SKYPOPEN_STATE_DOWN || giovatech->interface_state == 0) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user))) {} //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds - if ((giovatech->interface_state == SKYPOPEN_STATE_IDLE) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user))) { //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds + if ((giovatech->interface_state == SKYPOPEN_STATE_IDLE) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user))) { found = 1; DEBUGA_SKYPE ("FOUND (name=%s, giovatech->interface_state=%d == SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n", @@ -2896,19 +2766,6 @@ int skypopen_transfer(private_t *tech_pvt) if (tech_pvt->interface_state == SKYPOPEN_STATE_PRERING) { tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; } -#if 0 - - - else if (tech_pvt->interface_state != 0 && tech_pvt->interface_state != SKYPOPEN_STATE_DOWN) { - WARNINGA("Why an interface_state %d HERE?\n", SKYPOPEN_P_LOG, tech_pvt->interface_state); - tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; - } - - *tech_pvt->answer_id = '\0'; - *tech_pvt->answer_value = '\0'; - *tech_pvt->ring_id = '\0'; - *tech_pvt->ring_value = '\0'; -#endif //0 break; } } @@ -2977,11 +2834,8 @@ int skypopen_transfer(private_t *tech_pvt) sprintf(msg_to_skype, "ALTER CALL %s TRANSFER %s", id, available_skypopen_interface->skype_user); skypopen_signaling_write(tech_pvt, msg_to_skype); - if (tech_pvt->interface_state == SKYPOPEN_STATE_SELECTED) { - //FIXME why this? tech_pvt->interface_state = SKYPOPEN_STATE_IDLE; //we marked it SKYPOPEN_STATE_SELECTED just in case it has to make an outbound call - } } else { - /* no skypopen interfaces idle, do nothing */ + /* no skypopen interfaces idle, do hangup */ DEBUGA_SKYPE ("Not answering the skype_call %s, because we are already in a skypopen call(%s) and not transferring, because no other skypopen interfaces are available\n", SKYPOPEN_P_LOG, id, tech_pvt->skype_call_id); diff --git a/src/mod/endpoints/mod_skypopen/skypopen.h b/src/mod/endpoints/mod_skypopen/skypopen.h index b49b6a7..7eca73d 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen.h +++ b/src/mod/endpoints/mod_skypopen/skypopen.h @@ -387,9 +387,7 @@ int skypopen_close_socket(unsigned int fd); private_t *find_available_skypopen_interface_rr(private_t *tech_pvt_calling); int remote_party_is_ringing(private_t *tech_pvt); int remote_party_is_early_media(private_t *tech_pvt); -//int skypopen_answer(private_t * tech_pvt, char *id, char *value); int skypopen_answer(private_t *tech_pvt); -//int skypopen_transfer(private_t * tech_pvt, char *id, char *value); int skypopen_transfer(private_t *tech_pvt); #ifndef WIN32 int skypopen_socket_create_and_bind(private_t *tech_pvt, int *which_port); diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index 97e5e80..96ab542 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -97,10 +97,6 @@ int skypopen_socket_create_and_bind(private_t *tech_pvt, unsigned short *which_p -/* for virtual machines, eg: Linux domU-12-31-39-02-68-28 2.6.18-xenU-ec2-v1.0 #2 SMP Tue Feb 19 10:51:53 EST 2008 i686 athlon i386 GNU/Linux - * use: - * sockbufsize=SAMPLES_PER_FRAME * 8; - */ #ifdef WIN32 sockbufsize = SAMPLES_PER_FRAME * 8; #else @@ -116,10 +112,6 @@ int skypopen_socket_create_and_bind(private_t *tech_pvt, unsigned short *which_p getsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *) &sockbufsize, &size); DEBUGA_SKYPE("2 SO_RCVBUF is %d, size is %d\n", SKYPOPEN_P_LOG, sockbufsize, size); -/* for virtual machines, eg: Linux domU-12-31-39-02-68-28 2.6.18-xenU-ec2-v1.0 #2 SMP Tue Feb 19 10:51:53 EST 2008 i686 athlon i386 GNU/Linux - * use: - * sockbufsize=SAMPLES_PER_FRAME * 8; - */ #ifdef WIN32 sockbufsize = SAMPLES_PER_FRAME * 8; #else @@ -175,11 +167,9 @@ int skypopen_signaling_read(private_t *tech_pvt) a++; if (read_from_pipe[i] == '\0') { - //if (!strstr(message, "DURATION")) { DEBUGA_SKYPE("READING: |||%s||| \n", SKYPOPEN_P_LOG, message); strncpy(tech_pvt->message, message, sizeof(tech_pvt->message)); - //} if (!strcasecmp(message, "SILENT_MODE OFF")) { if (tech_pvt->silent_mode) { @@ -304,7 +294,6 @@ int skypopen_signaling_read(private_t *tech_pvt) if (!strcasecmp(prop, "RECEIVEDAUTHREQUEST")) { char msg_to_skype[256]; DEBUGA_SKYPE("Skype MSG: message: %s, obj: %s, id: %s, prop: %s!\n", SKYPOPEN_P_LOG, message, obj, id, prop); - //TODO: allow authorization based on config param sprintf(msg_to_skype, "SET USER %s ISAUTHORIZED TRUE", id); skypopen_signaling_write(tech_pvt, msg_to_skype); } @@ -508,7 +497,6 @@ int skypopen_signaling_read(private_t *tech_pvt) //SKYPOPEN_P_LOG, message, obj, id, prop, value, where ? where : "NULL"); if (!strcasecmp(prop, "PARTNER_HANDLE")) { - //if (tech_pvt->interface_state != SKYPOPEN_STATE_SELECTED && (!strlen(tech_pvt->skype_call_id) || !strlen(tech_pvt->session_uuid_str))) {} if (tech_pvt->interface_state == SKYPOPEN_STATE_IDLE){ /* we are NOT inside an active call */ DEBUGA_SKYPE("Call %s go to skypopen_partner_handle_ring\n", SKYPOPEN_P_LOG, id); @@ -528,7 +516,6 @@ int skypopen_signaling_read(private_t *tech_pvt) skypopen_strncpy(tech_pvt->ring_value, value, sizeof(tech_pvt->ring_value)); skypopen_strncpy(tech_pvt->answer_id, id, sizeof(tech_pvt->answer_id)); skypopen_strncpy(tech_pvt->answer_value, value, sizeof(tech_pvt->answer_value)); - //skypopen_transfer(tech_pvt, id, value); skypopen_transfer(tech_pvt); } } @@ -592,8 +579,6 @@ int skypopen_signaling_read(private_t *tech_pvt) if (!strcasecmp(value, "RINGING")) { char msg_to_skype[1024]; - //if ((tech_pvt->interface_state != SKYPOPEN_STATE_SELECTED && tech_pvt->interface_state != SKYPOPEN_STATE_DIALING) - //&& (!strlen(tech_pvt->skype_call_id) || !strlen(tech_pvt->session_uuid_str))) {} if (tech_pvt->interface_state == SKYPOPEN_STATE_IDLE){ // CLOUDTREE (Thomas Hazel) skypopen_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1); @@ -632,7 +617,6 @@ int skypopen_signaling_read(private_t *tech_pvt) tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; DEBUGA_SKYPE("we're now DOWN\n", SKYPOPEN_P_LOG); return CALLFLOW_INCOMING_HANGUP; - //skypopen_sleep(10000); } } else { @@ -664,11 +648,6 @@ int skypopen_signaling_read(private_t *tech_pvt) skypopen_signaling_write(tech_pvt, msg_to_skype); remote_party_is_early_media(tech_pvt); - /* CLOUDTREE (Thomas Hazel) - } else if (!strcasecmp(value, "MISSED")) { - DEBUGA_SKYPE("We missed skype_call %s\n", SKYPOPEN_P_LOG, id); - */ - // CLOUDTREE (Thomas Hazel) } else if (!strcasecmp(value, "MISSED") || !strcasecmp(value, "FINISHED")) { if (!strcasecmp(tech_pvt->skype_call_id, id)) { DEBUGA_SKYPE("skype_call %s is MY call, now I'm going DOWN\n", SKYPOPEN_P_LOG, id); @@ -933,7 +912,6 @@ void *skypopen_do_tcp_srv_thread_func(void *obj) if (switch_buffer_freespace(tech_pvt->read_buffer) < len) { switch_buffer_zero(tech_pvt->read_buffer); nospace = 1; - //switch_buffer_toss(tech_pvt->read_buffer, len); } switch_buffer_write(tech_pvt->read_buffer, srv_in, len); } @@ -1022,7 +1000,7 @@ void *skypopen_do_tcp_cli_thread_func(void *obj) if (!(running && tech_pvt->running)) break; FD_ZERO(&fsgio); - togio.tv_usec = 60000; //20msec + togio.tv_usec = 60000; //60msec togio.tv_sec = 0; fdselectgio = s; FD_SET(fdselectgio, &fsgio); @@ -1558,8 +1536,8 @@ int skypopen_send_message(private_t *tech_pvt, const char *message_P) unsigned int len = strlen(message_P); XEvent e; - skypopen_sleep(1000); //giovanni - XFlush(disp); //giovanni + skypopen_sleep(1000); + XFlush(disp); memset(&e, 0, sizeof(e)); e.xclient.type = ClientMessage; @@ -1581,7 +1559,6 @@ int skypopen_send_message(private_t *tech_pvt, const char *message_P) pos += i; } while (pos <= len); - //giovanni XSync(disp, False); XFlush(disp); // CLOUDTREE (Thomas Hazel) @@ -1923,7 +1900,6 @@ void *skypopen_do_skypeapi_thread_func(void *obj) #endif tech_pvt->skypopen_api_thread = NULL; - //XCloseDisplay(disp); return NULL; } @@ -1962,8 +1938,6 @@ int skypopen_answered(private_t *tech_pvt) switch_core_session_t *session = NULL; switch_channel_t *channel = NULL; - //WARNINGA("ANSWERED tech_pvt->skype_call_id=%s, tech_pvt->skype_callflow=%d, tech_pvt->interface_state=%d, tech_pvt->skype_user=%s, tech_pvt->callid_number=%s, tech_pvt->ring_value=%s, tech_pvt->ring_id=%s, tech_pvt->answer_value=%s, tech_pvt->answer_id=%s\n", SKYPOPEN_P_LOG, tech_pvt->skype_call_id, tech_pvt->skype_callflow, tech_pvt->interface_state, tech_pvt->skype_user, tech_pvt->callid_number, tech_pvt->ring_value, tech_pvt->ring_id, tech_pvt->answer_value, tech_pvt->answer_id); - if(strlen(tech_pvt->session_uuid_str)){ session = switch_core_session_locate(tech_pvt->session_uuid_str); if (session) { commit f4a6a07edccdbf914fa4a65982d6a62270cbba37 Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Thu Oct 28 03:53:52 2010 -0500 skypopen: select only IDLE interfaces, destroy the codec after the audio threads, cosmetics diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index fdb6d56..bff63d7 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -213,14 +213,14 @@ static switch_status_t skypopen_codec(private_t *tech_pvt, int sample_rate, int if (switch_core_codec_init (&tech_pvt->read_codec, "L16", NULL, sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) { - ERRORA("Can't load codec?\n", SKYPOPEN_P_LOG); + ERRORA("skypopen_codec: Can't load codec?\n", SKYPOPEN_P_LOG); return SWITCH_STATUS_FALSE; } if (switch_core_codec_init (&tech_pvt->write_codec, "L16", NULL, sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) { - ERRORA("Can't load codec?\n", SKYPOPEN_P_LOG); + ERRORA("skypopen_codec: Can't load codec?\n", SKYPOPEN_P_LOG); switch_core_codec_destroy(&tech_pvt->read_codec); return SWITCH_STATUS_FALSE; } @@ -235,10 +235,11 @@ static switch_status_t skypopen_codec(private_t *tech_pvt, int sample_rate, int switch_core_session_set_write_codec(session, &tech_pvt->write_codec); switch_core_session_rwunlock(session); } else { - ERRORA("no session\n", SKYPOPEN_P_LOG); + ERRORA("skypopen_codec: no session\n", SKYPOPEN_P_LOG); return SWITCH_STATUS_FALSE; } + DEBUGA_SKYPE("codecs UP\n", SKYPOPEN_P_LOG); return SWITCH_STATUS_SUCCESS; } @@ -255,11 +256,11 @@ switch_status_t skypopen_tech_init(private_t *tech_pvt, switch_core_session_t *s switch_core_session_set_private(session, tech_pvt); switch_copy_string(tech_pvt->session_uuid_str, switch_core_session_get_uuid(session), sizeof(tech_pvt->session_uuid_str)); if (!strlen(tech_pvt->session_uuid_str)) { - ERRORA("no tech_pvt->session_uuid_str\n", SKYPOPEN_P_LOG); + ERRORA("skypopen_tech_init: no tech_pvt->session_uuid_str\n", SKYPOPEN_P_LOG); return SWITCH_STATUS_FALSE; } if (skypopen_codec(tech_pvt, SAMPLERATE_SKYPOPEN, 20) != SWITCH_STATUS_SUCCESS) { - ERRORA("skypopen_codec FAILED\n", SKYPOPEN_P_LOG); + ERRORA("skypopen_tech_init: skypopen_codec FAILED\n", SKYPOPEN_P_LOG); return SWITCH_STATUS_FALSE; } @@ -485,29 +486,6 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session) } switch_mutex_unlock(tech_pvt->flag_mutex); - if (switch_core_codec_ready(&tech_pvt->read_codec)) { - switch_core_codec_destroy(&tech_pvt->read_codec); - } - - if (switch_core_codec_ready(&tech_pvt->write_codec)) { - switch_core_codec_destroy(&tech_pvt->write_codec); - } - - if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next) { - switch_core_timer_destroy(&tech_pvt->timer_read); - } - - if (tech_pvt->timer_write.timer_interface && tech_pvt->timer_write.timer_interface->timer_next) { - switch_core_timer_destroy(&tech_pvt->timer_write); - } - - if (tech_pvt->read_buffer) { - switch_buffer_destroy(&tech_pvt->read_buffer); - } - if (tech_pvt->write_buffer) { - switch_buffer_destroy(&tech_pvt->write_buffer); - } - DEBUGA_SKYPE("audio tcp threads to DIE\n", SKYPOPEN_P_LOG); conta=0; while(tech_pvt->tcp_srv_thread){ @@ -530,6 +508,30 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session) } DEBUGA_SKYPE("audio tcp cli thread DEAD %d\n", SKYPOPEN_P_LOG, conta); + + if (switch_core_codec_ready(&tech_pvt->read_codec)) { + switch_core_codec_destroy(&tech_pvt->read_codec); + } + + if (switch_core_codec_ready(&tech_pvt->write_codec)) { + switch_core_codec_destroy(&tech_pvt->write_codec); + } + + DEBUGA_SKYPE("codecs DOWN\n", SKYPOPEN_P_LOG); + if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next) { + switch_core_timer_destroy(&tech_pvt->timer_read); + } + + if (tech_pvt->timer_write.timer_interface && tech_pvt->timer_write.timer_interface->timer_next) { + switch_core_timer_destroy(&tech_pvt->timer_write); + } + + if (tech_pvt->read_buffer) { + switch_buffer_destroy(&tech_pvt->read_buffer); + } + if (tech_pvt->write_buffer) { + switch_buffer_destroy(&tech_pvt->write_buffer); + } //DEBUGA_SKYPE("debugging_hangup 13\n", SKYPOPEN_P_LOG); switch_mutex_lock(tech_pvt->mutex_thread_audio_cli); //DEBUGA_SKYPE("debugging_hangup cli lock\n", SKYPOPEN_P_LOG); @@ -2423,9 +2425,9 @@ private_t *find_available_skypopen_interface_rr(private_t *tech_pvt_calling) tech_pvt = &globals.SKYPOPEN_INTERFACES[interface_id]; skype_state = tech_pvt->interface_state; //DEBUGA_SKYPE("skype interface: %d, name: %s, state: %d\n", SKYPOPEN_P_LOG, interface_id, globals.SKYPOPEN_INTERFACES[interface_id].name, skype_state); - if ((tech_pvt_calling ? strcmp(tech_pvt->skype_user, tech_pvt_calling->skype_user) : 1) - && (SKYPOPEN_STATE_DOWN == skype_state || 0 == skype_state) && (tech_pvt->skype_callflow == CALLFLOW_STATUS_FINISHED - || 0 == tech_pvt->skype_callflow)) { + if ((tech_pvt_calling ? strcmp(tech_pvt->skype_user, tech_pvt_calling->skype_user) : 1) + //&& (SKYPOPEN_STATE_DOWN == skype_state || 0 == skype_state) && (tech_pvt->skype_callflow == CALLFLOW_STATUS_FINISHED || 0 == tech_pvt->skype_callflow)) {} + && (SKYPOPEN_STATE_IDLE == skype_state)) { DEBUGA_SKYPE("returning as available skype interface name: %s, state: %d callflow: %d\n", SKYPOPEN_P_LOG, tech_pvt->name, skype_state, tech_pvt->skype_callflow); if (tech_pvt_calling == NULL) { @@ -2883,8 +2885,9 @@ int skypopen_transfer(private_t *tech_pvt) if (strlen(globals.SKYPOPEN_INTERFACES[i].name)) { giovatech = &globals.SKYPOPEN_INTERFACES[i]; - /* let's look for a DOWN one */ - if ((giovatech->interface_state == SKYPOPEN_STATE_DOWN || giovatech->interface_state == 0) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user))) { //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds + /* let's look for a IDLE one */ + //if ((giovatech->interface_state == SKYPOPEN_STATE_DOWN || giovatech->interface_state == 0) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user))) {} //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds + if ((giovatech->interface_state == SKYPOPEN_STATE_IDLE) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user))) { //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds found = 1; DEBUGA_SKYPE ("FOUND (name=%s, giovatech->interface_state=%d == SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n", @@ -2975,7 +2978,7 @@ int skypopen_transfer(private_t *tech_pvt) sprintf(msg_to_skype, "ALTER CALL %s TRANSFER %s", id, available_skypopen_interface->skype_user); skypopen_signaling_write(tech_pvt, msg_to_skype); if (tech_pvt->interface_state == SKYPOPEN_STATE_SELECTED) { - tech_pvt->interface_state = SKYPOPEN_STATE_IDLE; //we marked it SKYPOPEN_STATE_SELECTED just in case it has to make an outbound call + //FIXME why this? tech_pvt->interface_state = SKYPOPEN_STATE_IDLE; //we marked it SKYPOPEN_STATE_SELECTED just in case it has to make an outbound call } } else { /* no skypopen interfaces idle, do nothing */ diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index 871cc78..97e5e80 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -217,7 +217,7 @@ int skypopen_signaling_read(private_t *tech_pvt) ("Skype got ERROR: |||%s|||, we are trying to use this interface to make or receive a call, but another call is half-active on this interface. Let's the previous one to continue.\n", SKYPOPEN_P_LOG, message); } else if (!strncasecmp(message, "ERROR 99 CALL", 12)) { - WARNINGA("Skype got ERROR: |||%s|||, another call is active on this interface\n\n\n", SKYPOPEN_P_LOG, message); + DEBUGA_SKYPE("Skype got ERROR: |||%s|||, another call is active on this interface\n\n\n", SKYPOPEN_P_LOG, message); tech_pvt->interface_state = SKYPOPEN_STATE_ERROR_DOUBLE_CALL; } else if (!strncasecmp(message, "ERROR 592 ALTER CALL", 19)) { NOTICA("Skype got ERROR about TRANSFERRING, no problem: |||%s|||\n", SKYPOPEN_P_LOG, message); @@ -250,7 +250,7 @@ int skypopen_signaling_read(private_t *tech_pvt) return CALLFLOW_INCOMING_HANGUP; } else if (!strncasecmp(message, "ERROR 589 ALTER CALL", 19)) { char msg_to_skype[256]; - WARNINGA("Skype client was not able to correctly manage tcp audio sockets, probably got a local or remote hangup: |||%s|||\n", SKYPOPEN_P_LOG, message); + DEBUGA_SKYPE("Skype client was not able to correctly manage tcp audio sockets, probably got a local or remote hangup: |||%s|||\n", SKYPOPEN_P_LOG, message); if(strlen(tech_pvt->skype_call_id)){ sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id); skypopen_signaling_write(tech_pvt, msg_to_skype); @@ -619,7 +619,7 @@ int skypopen_signaling_read(private_t *tech_pvt) skypopen_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1); DEBUGA_SKYPE("Our remote party in skype_call %s is RINGING\n", SKYPOPEN_P_LOG, id); if (remote_party_is_ringing(tech_pvt) != SWITCH_STATUS_SUCCESS) { - WARNINGA("We are getting the RINGING from a call we probably canceled, trying to get out hanging up call id: %s.\n", + DEBUGA_SKYPE("We are getting the RINGING from a call we probably canceled, trying to get out hanging up call id: %s.\n", SKYPOPEN_P_LOG, id); sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", id); skypopen_signaling_write(tech_pvt, msg_to_skype); @@ -629,9 +629,10 @@ int skypopen_signaling_read(private_t *tech_pvt) // CLOUDTREE (Thomas Hazel) tech_pvt->ringing_state = SKYPOPEN_RINGING_INIT; tech_pvt->skype_callflow = CALLFLOW_CALL_IDLE; - tech_pvt->interface_state = SKYPOPEN_STATE_IDLE; - WARNINGA("we're back to IDLE\n", SKYPOPEN_P_LOG); - skypopen_sleep(10000); + tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; + DEBUGA_SKYPE("we're now DOWN\n", SKYPOPEN_P_LOG); + return CALLFLOW_INCOMING_HANGUP; + //skypopen_sleep(10000); } } else { @@ -769,7 +770,7 @@ int skypopen_signaling_read(private_t *tech_pvt) } else if (!strcasecmp(value, "LOCALHOLD")) { char msg_to_skype[256]; - WARNINGA("skype_call: %s is now LOCALHOLD, let's hangup\n", SKYPOPEN_P_LOG, id); + DEBUGA_SKYPE("skype_call: %s is now LOCALHOLD, let's hangup\n", SKYPOPEN_P_LOG, id); sprintf(msg_to_skype, "ALTER CALL %s HANGUP", id); skypopen_signaling_write(tech_pvt, msg_to_skype); } else if (!strcasecmp(value, "REMOTEHOLD")) { commit 43aeb3b858d98af26053397c073b26427ee41ab6 Author: Mathieu Rene <mrene@avgs.ca> Date: Thu Oct 28 10:37:06 2010 -0400 switch_dow_cmp: fix logic err in my latest commit diff --git a/src/switch_utils.c b/src/switch_utils.c index 4c0ac32..2872f10 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -2537,7 +2537,7 @@ static inline dow_t _dow_read_token(const char **s) SWITCH_DECLARE(switch_bool_t) switch_dow_cmp(const char *exp, int val) { - dow_t cur, prev = DOW_EOF; + dow_t cur, prev = DOW_EOF, range_start = DOW_EOF; const char *p = exp; while ((cur = _dow_read_token(&p)) != DOW_EOF) { @@ -2545,27 +2545,30 @@ SWITCH_DECLARE(switch_bool_t) switch_dow_cmp(const char *exp, int val) /* Reset state */ cur = prev = DOW_EOF; } else if (cur == DOW_HYPHEN) { - /* Save the current token and move to the next one */ - prev = cur; + /* Save the previous token and move to the next one */ + range_start = prev; } else if (cur == DOW_ERR) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse error for [%s] at position %td (%.6s)\n", exp, p - exp, p); break; } else { /* Valid day found */ - if (prev != DOW_EOF) { /* Evaluating a range */ - if (prev < cur) { - if (val >= prev && val <= cur) { + if (range_start != DOW_EOF) { /* Evaluating a range */ + if (range_start < cur) { + if (val >= range_start && val <= cur) { return SWITCH_TRUE; } } else { - if (val >= cur && val <= prev) { + if (val >= cur && val <= range_start) { return SWITCH_TRUE; } } + range_start = DOW_EOF; } else if (val == cur) { return SWITCH_TRUE; } } + + prev = cur; } return SWITCH_FALSE; commit 6cfdddef6a4da30419c2e52930d8926c5d6f61eb Merge: bc84eb3 19325c4 Author: cypromis <michal.bielicki@seventhsignal.de> Date: Thu Oct 28 00:08:02 2010 +0200 Merge branch 'master' of ssh://git.freeswitch.org/freeswitch commit 5fe38d5f88991bd99088a27d64662c027165085a Author: Konrad Hammel <konrad@sangoma.com> Date: Wed Oct 27 18:07:56 2010 -0400 freetdm: ss7, bug fix in COT handling diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index c492265..7519b27 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -218,7 +218,10 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ /* check if a COT test is requested */ - if ((siConEvnt->natConInd.eh.pres) && (siConEvnt->natConInd.contChkInd.pres)) { + if ((siConEvnt->natConInd.eh.pres) && + (siConEvnt->natConInd.contChkInd.pres) && + (siConEvnt->natConInd.contChkInd.val)) { + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Found COT Request\n", sngss7_info->circuit->cic); /* tell the core to loop the channel */ commit bc84eb339ceb17f09f0d6d236224fba5137e6c28 Author: cypromis <michal.bielicki@seventhsignal.de> Date: Thu Oct 28 00:07:00 2010 +0200 added changes by Gabriel Gunderson fixing path in debian for pythoin and some typos diff --git a/debian/READ_BEFORE_CHANGING_ANYTHING_IN_HERE b/debian/READ_BEFORE_CHANGING_ANYTHING_IN_HERE index e8e1642..17480db 100644 --- a/debian/READ_BEFORE_CHANGING_ANYTHING_IN_HERE +++ b/debian/READ_BEFORE_CHANGING_ANYTHING_IN_HERE @@ -1,11 +1,29 @@ -Please do not change the maintainer -Plase DO send me a note before changing anything here and PLEASE DO MAKE A JIRA FIRST !!!! -This is the result of far too much sleepless time and far too many people broke this far too often so HANDS OFF FOR NOW !!!! -So one more time - -1. Do not perform any changes before verifying with the current maintainer (yes that is me) if they are OK -2. Before the mere idea of a change shall cross your mind create a ticket in Jira and assign it to the current maintainer -3. Yes the current maintainer has also other obligations besides fixing things people break in the debian build files so be patient, it can sometimes take a bit for him to react. -4. This has been a lot of work so please stay away from fixing it to death -5. The maintainer is always right -6. If the maintainer is wrong, look at 5. +Please do not change the maintainer (as found in the control file). + +Please DO send me a note before changing anything here. Also, PLEASE DO MAKE A +JIRA FIRST !!!! + +This request is the result of far too many sleepless nights and far too many +people breaking this far too often. So, HANDS OFF FOR NOW !!!! + +Again, to be perfectly clear: +1. Do not make any changes before verifying that they are OK with the current +maintainer (yes, that is me*). + +2. Before the mere idea of making a change crosses your mind, create a ticket in +Jira and assign it to the current maintainer. + +3. As current maintainer, I have other obligations besides fixing things people +break in the Debian build. So, please be patient; it can sometimes take a +bit for me to respond. + +4. Creating and maintaining this packages has been a lot of work. Please help +me maintain it by not fixing it to death. + +5. The maintainer is always right. + +6. If you believe the maintainer is wrong, please see item #5. + + + +* Michal Bielicki <michal.bielicki@seventhsignal.de> diff --git a/debian/changelog b/debian/changelog index c24db02..8065d93 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,7 +6,7 @@ freeswitch (1.0.head~git.master.20101015.1-1) unstable; urgency=low * cleaned up rules file and module make rules * more trivial changes and updates :) - -- Michal Bielicki <michal.bielicki@seventhsignal.de> Fr, 15 Oct 2010 13:14:02 +0200 + -- Michal Bielicki <michal.bielicki@seventhsignal.de> Fri, 15 Oct 2010 13:14:02 +0200 freeswitch (1.0.head~git.master.20101014.1-1) unstable; urgency=low @@ -19,7 +19,7 @@ freeswitch (1.0.head~git.master.20101014.1-1) unstable; urgency=low * added patches from Julien Duqene (FS-369) * Various trivial changes and updates :) - -- Michal Bielicki <michal.bielicki@seventhsignal.de> Fr, 15 Oct 2010 05:05:02 +0200 + -- Michal Bielicki <michal.bielicki@seventhsignal.de> Fri, 15 Oct 2010 05:05:02 +0200 freeswitch (1.0.head~git.master.20100601.2-1) unstable; urgency=low @@ -65,7 +65,7 @@ freeswitch (1.0.4-1ubuntu2) karmic; urgency=low * upgrade: Add more verbosity when building to make it easier to find build errors. * upgrade: Remove the requirement for EXACTLY automake1.9 and change it to - need atleast automake 1.9 + need at least automake 1.9 * upgrade: Add the modules (directory, cluechoo, and valet_parking) to the build files. These are in the standard build, so they should be here too. @@ -624,7 +624,7 @@ freeswitch (1.0.1-1) unstable; urgency=low * ADD: reboot option for sip phones to flush_inboud_reg sofia profile api command * FIX: add small padding to end of mp3 to avoid cut off mp3 recording * FIX: patch multiple SDP connection lines in sdp for proxy media mode (MODENDP-109) - * FIX: don't parse ringback varable in proxy situations + * FIX: don't parse ringback variable in proxy situations * ADD: per call vm recording ext with vm_message_ext variable * ADD: sip_bye_h prefix to add headers to bye * ENHANCEMENT: more interfaces available in show fsapi command @@ -646,7 +646,7 @@ freeswitch (1.0.1~trunk) unstable; urgency=low - Added mod_say_es and mod_say_nl - Updated descriptions - Added mod_cdr_csv - * Fixed typos and some errors in the previus patch. + * Fixed typos and some errors in the previous patch. * Modified monit script. Now it should work. * The debian build system now bootstrap automagically if it's necessary and all scripts are in place. diff --git a/debian/copyright b/debian/copyright index e2abda7..f95b7df 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,5 +1,5 @@ This package was debianized by Michal Bielicki -<michal.bielicki@seventhsignal.de> on Now 25, 2007. +<michal.bielicki@seventhsignal.de> on Nov 25, 2007. The source was downloaded from http://www.freewitch.org/ diff --git a/debian/freeswitch-python.install b/debian/freeswitch-python.install index 0c073e9..2773f0c 100644 --- a/debian/freeswitch-python.install +++ b/debian/freeswitch-python.install @@ -1,3 +1,3 @@ opt/freeswitch/conf/autoload_configs/python.conf.xml opt/freeswitch/mod/mod_python.so* -usr/lib/python2.5/site-packages/freeswitch.py* +usr/lib/python2.*/*-packages/freeswitch.py* diff --git a/debian/freeswitch.init b/debian/freeswitch.init index 36129cb..1eb71ac 100755 --- a/debian/freeswitch.init +++ b/debian/freeswitch.init @@ -5,7 +5,7 @@ # Required-Stop: $network $local_fs $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 -# Short-Description: The FreeSwitch Voice Switching System +# Short-Description: The FreeSWITCH Voice Switching System # Description: An advanced platform for voice services ### END INIT INFO @@ -16,7 +16,7 @@ # PATH should only include /usr/* if it runs after the mountnfs.sh script PATH=/sbin:/usr/sbin:/bin:/usr/bin:/opt/freeswitch/bin -DESC="FreeSwitch Voice Switching System" +DESC="FreeSWITCH Voice Switching System" NAME=freeswitch DAEMON=/opt/freeswitch/bin/$NAME USER=freeswitch diff --git a/debian/postinst b/debian/postinst index 36d983f..696171e 100755 --- a/debian/postinst +++ b/debian/postinst @@ -24,7 +24,7 @@ case "$1" in if ! getent passwd freeswitch >/dev/null; then adduser --disabled-password --quiet --system \ --home /opt/freeswitch \ - --gecos "FreeSwitch Voice Platform" --ingroup daemon \ + --gecos "FreeSWITCH Voice Platform" --ingroup daemon \ freeswitch adduser freeswitch audio else @@ -32,7 +32,7 @@ case "$1" in echo "Error: pre-existing freeswitch user with non-standard home directory." >&2 exit 1 fi - usermod -d /opt/freeswitch -c "FreeSwitch daemon,,," \ + usermod -d /opt/freeswitch -c "FreeSWITCH daemon,,," \ -g daemon -G audio freeswitch fi commit 3ad8a33b622b1bbcd7a27c969ac13ddcb2a2dad2 Author: Konrad Hammel <konrad@sangoma.com> Date: Mon Oct 25 16:55:03 2010 -0400 freetdm: ss7, bug fix in obci_bita handling freetdm: ss7, added support for SAM freetdm: ss7, updated support for COT in IAM diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index 807b3b6..c492265 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -216,8 +216,20 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ sprintf(nadi, "%d", siConEvnt->cdPtyNum.natAddrInd.val); ftdm_channel_add_var(ftdmchan, "ss7_cld_nadi", nadi); - /* set the state of the channel to collecting...the rest is done by the chan monitor */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); + + /* check if a COT test is requested */ + if ((siConEvnt->natConInd.eh.pres) && (siConEvnt->natConInd.contChkInd.pres)) { + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Found COT Request\n", sngss7_info->circuit->cic); + + /* tell the core to loop the channel */ + ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_LOOP, NULL); + + /* move to in loop state */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IN_LOOP); + } else { + /* set the state of the channel to collecting...the rest is done by the chan monitor */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); + } } /* if (channel is usable */ @@ -256,6 +268,9 @@ handle_glare: default: /* should not have gotten an IAM while in this state */ SS7_ERROR_CHAN(ftdmchan, "Got IAM on channel in invalid state(%s)...reset!\n", ftdm_channel_state2str (ftdmchan->state)); + /* reset the cic */ + sngss7_set_flag(sngss7_info, FLAG_RESET_TX); + /* move the state of the channel to RESTART to force a reset */ ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); @@ -292,6 +307,7 @@ ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circ /**************************************************************************/ case (ADDRCMPLT): SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx ACM\n", sngss7_info->circuit->cic); + switch (ftdmchan->state) { /**********************************************************************/ case FTDM_CHANNEL_STATE_DIALING: @@ -315,14 +331,22 @@ ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circ ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); } - break; + break; /**********************************************************************/ default: /* incorrect state...reset the CIC */ + SS7_ERROR_CHAN(ftdmchan, "RX ACM in invalid state :%s...resetting CIC\n", + ftdm_channel_state2str (ftdmchan->state)); + + /* reset the cic */ + sngss7_set_flag(sngss7_info, FLAG_RESET_TX); + /* go to RESTART */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); - break; + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + break; /**********************************************************************/ } /* switch (ftdmchan->state) */ + + break; /**************************************************************************/ case (MODIFY): SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx MODIFY\n", sngss7_info->circuit->cic); @@ -354,6 +378,34 @@ ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circ /**************************************************************************/ case (SUBSADDR): SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx SAM\n", sngss7_info->circuit->cic); + + /* check the channel state */ + switch (ftdmchan->state) { + /**********************************************************************/ + case (FTDM_CHANNEL_STATE_COLLECT): + + /* confirm that the event contains the subsquent number field */ + if (siCnStEvnt->subNum.eh.pres && siCnStEvnt->subNum.addrSig.pres) { + /* add the digits to the ftdm channel variable */ + append_tknStr_from_sngss7(siCnStEvnt->subNum.addrSig, + ftdmchan->caller_data.dnis.digits, + siCnStEvnt->subNum.oddEven); + } else { + SS7_INFO_CHAN(ftdmchan,"No Called party (DNIS) information in SAM!%s\n", " "); + } + + /* go to idle so that collect state is processed again */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE); + + break; + /**********************************************************************/ + default: + SS7_ERROR_CHAN(ftdmchan, "RX SAM in invalid state :%s...ignoring\n", + ftdm_channel_state2str (ftdmchan->state)); + break; + /**********************************************************************/ + } /* switch (ftdmchan->state) */ + break; /**************************************************************************/ case (EXIT): @@ -830,7 +882,7 @@ ftdm_status_t handle_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ break; /**************************************************************************/ case SIT_STA_CONTCHK: /* continuity check */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx COT start\n", sngss7_info->circuit->cic); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CCR start\n", sngss7_info->circuit->cic); handle_cot_start(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ @@ -840,7 +892,7 @@ ftdm_status_t handle_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ break; /**************************************************************************/ case SIT_STA_STPCONTIN: /* stop continuity */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx COT stop\n", sngss7_info->circuit->cic); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CCR stop\n", sngss7_info->circuit->cic); handle_cot_stop(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ @@ -1225,7 +1277,7 @@ ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint32_t ci /* open the channel if it is not open */ if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) { if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { - SS7_ERROR("Failed to open CIC %d for COT test!\n", sngss7_info->circuit->cic); + SS7_ERROR("Failed to open CIC %d for CCR test!\n", sngss7_info->circuit->cic); /* KONRAD FIX ME */ SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_FAIL; @@ -1290,6 +1342,38 @@ ftdm_status_t handle_cot(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, { SS7_FUNC_TRACE_ENTER(__FUNCTION__); + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + /* lock the channel */ + ftdm_mutex_lock(ftdmchan->mutex); + + switch (ftdmchan->state) { + /**************************************************************************/ + case (FTDM_CHANNEL_STATE_IN_LOOP): + /* tell the core to stop looping the channel */ + ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL); + + /* exit out of the LOOP state and go to collect */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); + + break; + /**************************************************************************/ + default: + /* exit out of the LOOP state to the last state */ + ftdm_set_state_locked(ftdmchan, ftdmchan->last_state); + + break; + /**************************************************************************/ + } /* switch (ftdmchan->state) */ + if ( (siStaEvnt->contInd.eh.pres > 0) && (siStaEvnt->contInd.contInd.pres > 0)) { SS7_INFO("Continuity Test result for CIC = %d (span %d, chan %d) is: \"%s\"\n", g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, @@ -1300,14 +1384,14 @@ ftdm_status_t handle_cot(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SS7_ERROR("Recieved Continuity report containing no results!\n"); } + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_SUCCESS; } /******************************************************************************/ - - -/******************************************************************************/ ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index 587242d..ebb4efa 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -79,7 +79,7 @@ ftdm_state_map_t sangoma_ss7_state_map = { ZSD_INBOUND, ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_IDLE, FTDM_END}, - {FTDM_CHANNEL_STATE_RESTART, FTDM_END} + {FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_COLLECT, FTDM_END} }, { ZSD_INBOUND, @@ -100,7 +100,8 @@ ftdm_state_map_t sangoma_ss7_state_map = { ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_COLLECT, FTDM_END}, {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, - FTDM_CHANNEL_STATE_CANCEL, FTDM_CHANNEL_STATE_RING, FTDM_END} + FTDM_CHANNEL_STATE_CANCEL, FTDM_CHANNEL_STATE_RING, + FTDM_CHANNEL_STATE_IDLE, FTDM_END} }, { ZSD_INBOUND, @@ -526,29 +527,32 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_RING); } else { - SS7_INFO_CHAN(ftdmchan,"Received %d out of %d so far: %s...starting T35\n", - i, - g_ftdm_sngss7_data.min_digits, - ftdmchan->caller_data.dnis.digits); - - /* start ISUP t35 */ - if (ftdm_sched_timer (sngss7_info->t35.sched, - "t35", - sngss7_info->t35.beat, - sngss7_info->t35.callback, - &sngss7_info->t35, - &sngss7_info->t35.hb_timer_id)) { - - SS7_ERROR ("Unable to schedule timer, hanging up call!\n"); - - ftdmchan->caller_data.hangup_cause = 41; - - /* set the flag to indicate this hangup is started from the local side */ - sngss7_set_flag (sngss7_info, FLAG_LOCAL_REL); - - /* end the call */ - ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_CANCEL); - } /* if (ftdm_sched_timer(sngss7_info->t35.sched, */ + /* if we are coming from idle state then we have already been here once before */ + if (ftdmchan->last_state != FTDM_CHANNEL_STATE_IDLE) { + SS7_INFO_CHAN(ftdmchan,"Received %d out of %d so far: %s...starting T35\n", + i, + g_ftdm_sngss7_data.min_digits, + ftdmchan->caller_data.dnis.digits); + + /* start ISUP t35 */ + if (ftdm_sched_timer (sngss7_info->t35.sched, + "t35", + sngss7_info->t35.beat, + sngss7_info->t35.callback, + &sngss7_info->t35, + &sngss7_info->t35.hb_timer_id)) { + + SS7_ERROR ("Unable to schedule timer, hanging up call!\n"); + + ftdmchan->caller_data.hangup_cause = 41; + + /* set the flag to indicate this hangup is started from the local side */ + sngss7_set_flag (sngss7_info, FLAG_LOCAL_REL); + + /* end the call */ + ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_CANCEL); + } /* if (ftdm_sched_timer(sngss7_info->t35.sched, */ + } /* if (ftdmchan->last_state != FTDM_CHANNEL_STATE_IDLE) */ } /* checking ST/#digits */ break; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index 27833cb..378b50e 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -581,6 +581,8 @@ uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum); uint8_t copy_cdPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum); uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum); uint8_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven); +uint8_t append_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven); + int check_for_state_change(ftdm_channel_t *ftdmchan); int check_cics_in_range(sngss7_chan_data_t *sngss7_info); int check_for_reset(sngss7_chan_data_t *sngss7_info); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index 8cbe6d9..f2e34e6 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -341,9 +341,10 @@ void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan) /* fill in any optional parameters */ if (sngss7_test_options(isup_intf, SNGSS7_ACM_OBCI_BITA)) { + SS7_DEBUG_CHAN(ftdmchan, "Found ACM_OBCI_BITA flag:0x%X\n", isup_intf->options); acm.optBckCalInd.eh.pres = PRSNT_NODEF; acm.optBckCalInd.inbndInfoInd.pres = PRSNT_NODEF; - acm.optBckCalInd.inbndInfoInd.val = sngss7_test_options(isup_intf, SNGSS7_ACM_OBCI_BITA); + acm.optBckCalInd.inbndInfoInd.val = 0x1; acm.optBckCalInd.caFwdMayOcc.pres = PRSNT_DEF; acm.optBckCalInd.simpleSegmInd.pres = PRSNT_DEF; acm.optBckCalInd.mlppUserInd.pres = PRSNT_DEF; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 7186639..4d514ca 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -44,6 +44,7 @@ uint32_t sngss7_id; /* PROTOTYPES *****************************************************************/ uint8_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven); +uint8_t append_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven); uint8_t copy_cgPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum); uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum); uint8_t copy_cdPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum); @@ -344,6 +345,49 @@ uint8_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven) } /******************************************************************************/ +uint8_t append_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven) +{ + int i = 0; + int j = 0; + + /* check if the token string is present */ + if (str.pres == 1) { + /* find the length of the digits so far */ + j = strlen(ftdm); + + /* confirm that we found an acceptable length */ + if ( j > 25 ) { + SS7_ERROR("string length exceeds maxium value...aborting append!\n"); + return 1; + } /* if ( j > 25 ) */ + + /* copy in digits */ + for (i = 0; i < str.len; i++) { + /* convert 4 bit integer to char and copy into lower nibblet*/ + sprintf(&ftdm[j], "%X", (str.val[i] & 0x0F)); + /* move along */ + j++; + /* convert 4 bit integer to char and copy into upper nibblet */ + sprintf(&ftdm[j], "%X", ((str.val[i] & 0xF0) >> 4)); + /* move along */ + j++; + } /* for (i = 0; i < str.len; i++) */ + + /* if the odd flag is up the last digit is a fake "0" */ + if ((oddEven.pres == 1) && (oddEven.val == 1)) { + ftdm[j-1] = '\0'; + } else { + ftdm[j] = '\0'; + } /* if ((oddEven.pres == 1) && (oddEven.val == 1)) */ + } else { + SS7_ERROR("Asked to copy tknStr that is not present!\n"); + return 1; + } /* if (str.pres == 1) */ + + return 0; +} + +/******************************************************************************/ int check_for_state_change(ftdm_channel_t *ftdmchan) { commit 19325c43693b6050a1515375eddede4119491502 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Oct 27 16:37:22 2010 -0500 fix race in codec failure condition, then fix bug in sdp parsing (likely a regression from recent codec changes) to never have the problem in the first place so you are double-protected diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index c9b384b..1811616 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -2658,8 +2658,13 @@ switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force) tech_pvt->read_impl.samples_per_second != tech_pvt->rm_rate || tech_pvt->codec_ms != (uint32_t) tech_pvt->read_impl.microseconds_per_packet / 1000) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Changing Codec from %s@%dms to %s@%dms\n", - tech_pvt->read_impl.iananame, tech_pvt->read_impl.microseconds_per_packet / 1000, tech_pvt->rm_encoding, tech_pvt->codec_ms); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, + "Changing Codec from %s@%dms@%dhz to %s@%dms@%luhz\n", + tech_pvt->read_impl.iananame, tech_pvt->read_impl.microseconds_per_packet / 1000, + tech_pvt->read_impl.samples_per_second, + tech_pvt->rm_encoding, + tech_pvt->codec_ms, + tech_pvt->rm_rate); switch_core_session_lock_codec_write(tech_pvt->session); switch_core_session_lock_codec_read(tech_pvt->session); @@ -4429,7 +4434,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s tech_pvt->rm_encoding = switch_core_session_strdup(session, (char *) map->rm_encoding); tech_pvt->iananame = switch_core_session_strdup(session, (char *) mimp->iananame); tech_pvt->pt = (switch_payload_t) map->rm_pt; - tech_pvt->rm_rate = map->rm_rate; + tech_pvt->rm_rate = mimp->samples_per_second; tech_pvt->codec_ms = mimp->microseconds_per_packet / 1000; tech_pvt->bitrate = mimp->bits_per_second; tech_pvt->remote_sdp_audio_ip = switch_core_session_strdup(session, (char *) connection->c_address); diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 766bec7..ec3fac6 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -124,6 +124,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi } switch_mutex_lock(session->codec_read_mutex); + + if (!switch_core_codec_ready(session->read_codec)) { + switch_mutex_unlock(session->codec_read_mutex); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s has no read codec.\n", switch_channel_get_name(session->channel)); + switch_channel_hangup(session->channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION); + *frame = &runtime.dummy_cng_frame; + return SWITCH_STATUS_FALSE; + } + switch_mutex_lock(session->read_codec->mutex); top: @@ -181,6 +190,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi } switch_mutex_lock(session->codec_read_mutex); + + if (!switch_core_codec_ready(session->read_codec)) { + switch_mutex_unlock(session->codec_read_mutex); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s has no read codec.\n", switch_channel_get_name(session->channel)); + switch_channel_hangup(session->channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION); + *frame = &runtime.dummy_cng_frame; + return SWITCH_STATUS_FALSE; + } + switch_mutex_lock(session->read_codec->mutex); if (!switch_core_codec_ready(session->read_codec)) { *frame = NULL; commit 3d547b1c64fd27dd323e5372d39cf518b1381afb Author: Jeff Lenk <jeff@jefflenk.com> Date: Wed Oct 27 16:26:55 2010 -0500 windows installer - clean paths diff --git a/w32/Setup/Setup.wixproj b/w32/Setup/Setup.wixproj index 10dc600..4df748f 100644 --- a/w32/Setup/Setup.wixproj +++ b/w32/Setup/Setup.wixproj @@ -12,26 +12,26 @@ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> <OutputPath>bin\x86\Debug\</OutputPath> <IntermediateOutputPath>obj\X86\$(Configuration)\</IntermediateOutputPath> - <DefineConstants>Debug;FreeSWITCHConfFilesDir=..\..\..\..\..\conf;FreeSWITCHSoundFilesDir=..\..\..\..\..\Win32\debug\sounds;</DefineConstants> + <DefineConstants>Debug;FreeSWITCHConfFilesDir=$(ProjectDir)..\..\conf;FreeSWITCHSoundFilesDir=$(ProjectDir)..\..\Win32\debug\sounds;</DefineConstants> <WixVariables> </WixVariables> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> <OutputPath>bin\x86\release\</OutputPath> <IntermediateOutputPath>obj\X86\$(Configuration)\</IntermediateOutputPath> - <DefineConstants>Debug;FreeSWITCHConfFilesDir=..\..\..\..\..\conf;FreeSWITCHSoundFilesDir=..\..\..\..\..\Win32\release\sounds;</DefineConstants> + <DefineConstants>Debug;FreeSWITCHConfFilesDir=$(ProjectDir)..\..\conf;FreeSWITCHSoundFilesDir=$(ProjectDir)..\..\Win32\release\sounds;</DefineConstants> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' "> <OutputPath>bin\x64\Debug\</OutputPath> <IntermediateOutputPath>obj\X64\$(Configuration)\</IntermediateOutputPath> - <DefineConstants>Debug;FreeSWITCHConfFilesDir=..\..\..\..\..\conf;FreeSWITCHSoundFilesDir=..\..\..\..\..\x64\debug\sounds;</DefineConstants> + <DefineConstants>Debug;FreeSWITCHConfFilesDir=$(ProjectDir)..\..\conf;FreeSWITCHSoundFilesDir=$(ProjectDir)..\..\x64\debug\sounds;</DefineConstants> <WixVariables> </WixVariables> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' "> <OutputPath>bin\x64\Release\</OutputPath> <IntermediateOutputPath>obj\X64\$(Configuration)\</IntermediateOutputPath> - <DefineConstants>Debug;FreeSWITCHConfFilesDir=..\..\..\..\..\conf;FreeSWITCHSoundFilesDir=..\..\..\..\..\x64\release\sounds;</DefineConstants> + <DefineConstants>Debug;FreeSWITCHConfFilesDir=$(ProjectDir)..\..\conf;FreeSWITCHSoundFilesDir=$(ProjectDir)..\..\x64\release\sounds;</DefineConstants> </PropertyGroup> <ItemGroup> <Compile Include="Fragments\FreeSWITCHConfFiles.wxs" /> @@ -735,8 +735,8 @@ </ItemGroup> <Import Project="$(WixTargetsPath)" /> <PropertyGroup> - <PreBuildEvent>"$(WIX)bin\heat.exe" dir "..\..\..\..\..\conf" -cg FreeSWITCHConfFiles -gg -scom -sreg -sfrag -srd -dr CONFLOCATION -var var.FreeSWITCHConfFilesDir -out "$(ProjectDir)Fragments\FreeSWITCHConfFiles.wxs" -"$(WIX)bin\heat.exe" dir "..\..\..\..\..\Win32\Release\sounds" -cg FreeSWITCHSoundFiles8 -gg -scom -sreg -sfrag -srd -dr SOUNDLOCATION -var var.FreeSWITCHSoundFilesDir -out "$(ProjectDir)Fragments\FreeSWITCHSoundFiles8.wxs"</PreBuildEvent> + <PreBuildEvent>"$(WIX)bin\heat.exe" dir "$(ProjectDir)..\..\conf" -cg FreeSWITCHConfFiles -gg -scom -sreg -sfrag -srd -dr CONFLOCATION -var var.FreeSWITCHConfFilesDir -out "$(ProjectDir)Fragments\FreeSWITCHConfFiles.wxs" +"$(WIX)bin\heat.exe" dir "$(ProjectDir)..\..\Win32\Release\sounds" -cg FreeSWITCHSoundFiles8 -gg -scom -sreg -sfrag -srd -dr SOUNDLOCATION -var var.FreeSWITCHSoundFilesDir -out "$(ProjectDir)Fragments\FreeSWITCHSoundFiles8.wxs"</PreBuildEvent> </PropertyGroup> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. commit 28d02700c8ef8c42cd44adcdf0e92184301f24fb Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Oct 27 14:58:01 2010 -0500 typo diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index d9de871..4646473 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -2020,7 +2020,7 @@ SWITCH_STANDARD_API(transfer_function) } -#define DUAL_TRANSFER_SYNTAX "<uuid> <dest-exten>[/<dialplan>][/<context>] <dest-exten>[/<dialplan>][/<context>]" +#define DUAL_TRANSFER_SYNTAX "<uuid> <A-dest-exten>[/<A-dialplan>][/<A-context>] <B-dest-exten>[/<B-dialplan>][/<B-context>]" SWITCH_STANDARD_API(dual_transfer_function) { switch_core_session_t *tsession = NULL, *other_session = NULL; @@ -2029,14 +2029,14 @@ SWITCH_STANDARD_API(dual_transfer_function) char *tuuid, *dest1, *dest2, *dp1 = NULL, *dp2 = NULL, *context1 = NULL, *context2 = NULL; if (zstr(cmd) || !(mycmd = strdup(cmd))) { - stream->write_function(stream, "-USAGE: %s\n", TRANSFER_SYNTAX); + stream->write_function(stream, "-USAGE: %s\n", DUAL_TRANSFER_SYNTAX); return SWITCH_STATUS_SUCCESS; } argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); if (argc != 3) { - stream->write_function(stream, "-USAGE: %s\n", TRANSFER_SYNTAX); + stream->write_function(stream, "-USAGE: %s\n", DUAL_TRANSFER_SYNTAX); goto done; } @@ -2062,7 +2062,7 @@ SWITCH_STANDARD_API(dual_transfer_function) stream->write_function(stream, "-ERR No Such Channel!\n"); goto done; } - + if (switch_core_session_get_partner(tsession, &other_session) == SWITCH_STATUS_SUCCESS) { switch_ivr_session_transfer(other_session, dest2, dp2, context2); switch_core_session_rwunlock(other_session); commit 8bb4d0d413ede1b4b56711b5b67b3a269c1a64b1 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Oct 27 14:09:38 2010 -0500 add the stuff drk_ keeps begging for diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 1fb1c95..d9de871 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -2019,6 +2019,66 @@ SWITCH_STANDARD_API(transfer_function) return SWITCH_STATUS_SUCCESS; } + +#define DUAL_TRANSFER_SYNTAX "<uuid> <dest-exten>[/<dialplan>][/<context>] <dest-exten>[/<dialplan>][/<context>]" +SWITCH_STANDARD_API(dual_transfer_function) +{ + switch_core_session_t *tsession = NULL, *other_session = NULL; + char *mycmd = NULL, *argv[5] = { 0 }; + int argc = 0; + char *tuuid, *dest1, *dest2, *dp1 = NULL, *dp2 = NULL, *context1 = NULL, *context2 = NULL; + + if (zstr(cmd) || !(mycmd = strdup(cmd))) { + stream->write_function(stream, "-USAGE: %s\n", TRANSFER_SYNTAX); + return SWITCH_STATUS_SUCCESS; + } + + argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + + if (argc != 3) { + stream->write_function(stream, "-USAGE: %s\n", TRANSFER_SYNTAX); + goto done; + } + + tuuid = argv[0]; + dest1 = argv[1]; + dest2= argv[2]; + + if ((dp1 = strchr(dest1, '/'))) { + *dp1++ = '\0'; + if ((context1 = strchr(dp1, '/'))) { + *context1++ = '\0'; + } + } + + if ((dp2 = strchr(dest2, '/'))) { + *dp2++ = '\0'; + if ((context2 = strchr(dp2, '/'))) { + *context2++ = '\0'; + } + } + + if (zstr(tuuid) || !(tsession = switch_core_session_locate(tuuid))) { + stream->write_function(stream, "-ERR No Such Channel!\n"); + goto done; + } + + if (switch_core_session_get_partner(tsession, &other_session) == SWITCH_STATUS_SUCCESS) { + switch_ivr_session_transfer(other_session, dest2, dp2, context2); + switch_core_session_rwunlock(other_session); + } + + switch_ivr_session_transfer(tsession, dest1, dp1, context1); + + stream->write_function(stream, "+OK\n"); + + switch_core_session_rwunlock(tsession); + + done: + switch_safe_free(mycmd); + return SWITCH_STATUS_SUCCESS; +} + #define TONE_DETECT_SYNTAX "<uuid> <key> <tone_spec> [<flags> <timeout> <app> <args> <hits>]" SWITCH_STANDARD_API(tone_detect_session_function) { @@ -4630,6 +4690,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) SWITCH_ADD_API(commands_api_interface, "uuid_setvar_multi", "uuid_setvar_multi", uuid_setvar_multi_function, SETVAR_MULTI_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_setvar", "uuid_setvar", uuid_setvar_function, SETVAR_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_transfer", "Transfer a session", transfer_function, TRANSFER_SYNTAX); + SWITCH_ADD_API(commands_api_interface, "uuid_dual_transfer", "Transfer a session and its partner", dual_transfer_function, DUAL_TRANSFER_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_simplify", "Try to cut out of a call path / attended xfer", uuid_simplify_function, SIMPLIFY_SYNTAX); SWITCH_ADD_API(commands_api_interface, "xml_locate", "find some xml", xml_locate_function, "[root | <section> <tag> <tag_attr_name> <tag_attr_val>]"); SWITCH_ADD_API(commands_api_interface, "xml_wrap", "Wrap another api command in xml", xml_wrap_api_function, "<command> <args>"); @@ -4749,6 +4810,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) switch_console_set_complete("add uuid_setvar_multi ::console::list_uuid"); switch_console_set_complete("add uuid_setvar ::console::list_uuid"); switch_console_set_complete("add uuid_transfer ::console::list_uuid"); + switch_console_set_complete("add uuid_dual_transfer ::console::list_uuid"); switch_console_set_complete("add version"); switch_console_set_complete("add uuid_warning ::console::list_uuid"); switch_console_set_complete("add ..."); diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index e8fdcd2..2f5fb5a 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1677,7 +1677,9 @@ void sofia_reg_handle_sip_r_challenge(int status, switch_channel_t *channel = NULL; const char *sip_auth_username = NULL; const char *sip_auth_password = NULL; - + char *dup_user = NULL; + char *dup_pass = NULL; + if (session && (channel = switch_core_session_get_channel(session))) { sip_auth_username = switch_channel_get_variable(channel, "sip_auth_username"); sip_auth_password = switch_channel_get_variable(channel, "sip_auth_password"); @@ -1747,8 +1749,37 @@ void sofia_reg_handle_sip_r_challenge(int status, } } + if (!gateway && !sip_auth_username && sip && sip->sip_to && sip->sip_to->a_url && sip->sip_to->a_url->url_user && sip->sip_to->a_url->url_host) { + switch_xml_t x_user, x_param, x_params; + switch_event_t *locate_params; + + switch_event_create(&locate_params, SWITCH_EVENT_REQUEST_PARAMS); + switch_assert(locate_params); + + switch_event_add_header_string(locate_params, SWITCH_STACK_BOTTOM, "Action", "reverse-auth-lookup"); + + if (switch_xml_locate_user_merged("id", sip->sip_to->a_url->url_user, sip->sip_to->a_url->url_host, NULL, + &x_user, locate_params) == SWITCH_STATUS_SUCCESS) { + if ((x_params = switch_xml_child(x_user, "params"))) { + for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) { + const char *var = switch_xml_attr_soft(x_param, "name"); + const char *val = switch_xml_attr_soft(x_param, "value"); + + if (!strcasecmp(var, "reverse-auth-user")) { + dup_user = strdup(val); + sip_auth_username = dup_user; + } else if (!strcasecmp(var, "reverse-auth-pass")) { + dup_pass = strdup(val); + sip_auth_password = dup_pass; + } + } + switch_xml_free(x_user); + } + } + switch_event_destroy(&locate_params); + } if (!(scheme && realm)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No scheme and realm!\n"); @@ -1787,6 +1818,10 @@ void sofia_reg_handle_sip_r_challenge(int status, end: + + switch_safe_free(dup_user); + switch_safe_free(dup_pass); + if (var_gateway) { sofia_reg_release_gateway(var_gateway); } commit a1ada3e2a929d775bf96085668cd9df207b14cc3 Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Wed Oct 27 12:09:43 2010 -0500 skypopen: windows compile diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index 1e39f1d..fdb6d56 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -397,11 +397,13 @@ static switch_status_t interface_exists(char *the_interface) switch_yield(50000); } +#ifndef WIN32 if (tech_pvt->SkypopenHandles.disp) { DEBUGA_SKYPE("REMOVE CLOSIN X\n", SKYPOPEN_P_LOG); XCloseDisplay(tech_pvt->SkypopenHandles.disp); DEBUGA_SKYPE("REMOVE CLOSIN X END\n", SKYPOPEN_P_LOG); } +#endif if (globals.SKYPOPEN_INTERFACES[interface_id].skypopen_signaling_thread) { switch_thread_join(&status, globals.SKYPOPEN_INTERFACES[interface_id].skypopen_signaling_thread); @@ -2096,11 +2098,13 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypopen_shutdown) x--; switch_yield(50000); } +#ifndef WIN32 if (tech_pvt->SkypopenHandles.disp) { DEBUGA_SKYPE("CLOSIN X\n", SKYPOPEN_P_LOG); XCloseDisplay(tech_pvt->SkypopenHandles.disp); DEBUGA_SKYPE("CLOSIN X END\n", SKYPOPEN_P_LOG); } +#endif if (globals.SKYPOPEN_INTERFACES[interface_id].skypopen_signaling_thread) { switch_thread_join(&status, globals.SKYPOPEN_INTERFACES[interface_id].skypopen_signaling_thread); } commit 99ada6bdbafda2dc1bd797041dff20c7c5e32f3e Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Oct 27 12:00:30 2010 -0500 add events diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index baff8e9..0cd3b38 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -76,6 +76,8 @@ typedef struct private_object private_object_t; #define SOFIA_SESSION_TIMEOUT "sofia_session_timeout" #define MY_EVENT_REGISTER "sofia::register" +#define MY_EVENT_PRE_REGISTER "sofia::pre_register" +#define MY_EVENT_REGISTER_ATTEMPT "sofia::register_attempt" #define MY_EVENT_UNREGISTER "sofia::unregister" #define MY_EVENT_EXPIRE "sofia::expire" #define MY_EVENT_GATEWAY_STATE "sofia::gateway_state" diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 51ce56f..e8fdcd2 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -993,11 +993,37 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand if (authorization) { char *v_contact_str; + const char *username = "unknown"; + const char *realm = reg_host; if ((auth_res = sofia_reg_parse_auth(profile, authorization, sip, sip->sip_request->rq_method_name, key, keylen, network_ip, v_event, exptime, regtype, to_user, &auth_params, ®_count)) == AUTH_STALE) { stale = 1; } + + if (auth_params) { + username = switch_event_get_header(auth_params, "sip_auth_username"); + realm = switch_event_get_header(auth_params, "sip_auth_realm"); + } + if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_REGISTER_ATTEMPT) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "profile-name", profile->name); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "from-user", to_user); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "from-host", reg_host); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "contact", contact_str); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "call-id", call_id); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "rpid", rpid); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "status", reg_desc); + switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "expires", "%ld", (long) exptime); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "to-user", from_user); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "to-host", from_host); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "network-ip", network_ip); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "network-port", network_port_c); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "username", username); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "realm", realm); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "user-agent", agent); + switch_event_fire(&s_event); + } + if (exptime && v_event && *v_event) { char *exp_var; char *allow_multireg = NULL; @@ -1101,6 +1127,23 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand if (!authorization || stale) { const char *realm = profile->challenge_realm; + if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_PRE_REGISTER) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "profile-name", profile->name); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "from-user", to_user); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "from-host", reg_host); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "contact", contact_str); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "call-id", call_id); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "rpid", rpid); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "status", reg_desc); + switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "expires", "%ld", (long) exptime); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "to-user", from_user); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "to-host", from_host); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "network-ip", network_ip); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "network-port", network_port_c); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "user-agent", agent); + switch_event_fire(&s_event); + } + if (zstr(realm) || !strcasecmp(realm, "auto_to")) { realm = to_host; } else if (!strcasecmp(realm, "auto_from")) { commit 91230e01f9b72d7e05f95d64faee7855330dbead Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Oct 27 11:46:39 2010 -0500 used || instead of 'or' in sql stmt diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index c11d5d9..71a827f 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -627,7 +627,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) "from sip_dialogs " "where (presence_id='%q@%q' or " - "(sip_from_user='%q' and (sip_from_host='%q' || sip_to_host='%q')))", + "(sip_from_user='%q' and (sip_from_host='%q' or sip_to_host='%q')))", dh.status, dh.rpid, probe_euser, probe_host, probe_euser, probe_host, probe_host); commit 6ae933a2e9fea6a1e27f6cec442b97b368260821 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Oct 27 11:10:12 2010 -0500 FS-2800 diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 58099de..833cf6c 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -4609,7 +4609,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, } if (status == 183 && !r_sdp) { - if (switch_true(switch_channel_get_variable(channel, "sip_ignore_183nosdp")) || sofia_test_pflag(profile, PFLAG_IGNORE_183NOSDP)) { + if ((channel && switch_true(switch_channel_get_variable(channel, "sip_ignore_183nosdp"))) || sofia_test_pflag(profile, PFLAG_IGNORE_183NOSDP)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Ignoring 183 w/o sdp\n", switch_channel_get_name(channel)); goto done; } commit 5472923024aba61f99edafddc3493d472823668d Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Wed Oct 27 09:30:27 2010 -0500 skypopen: cosmetics diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index 2e01871..1e39f1d 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -2251,7 +2251,7 @@ int start_audio_threads(private_t *tech_pvt) switch_sleep(100000); if (tech_pvt->tcp_cli_thread == NULL || tech_pvt->tcp_srv_thread == NULL) { - ERRORA("tcp_cli_thread or tcp_srv_thread exited\n", SKYPOPEN_P_LOG); + WARNINGA("tcp_cli_thread or tcp_srv_thread exited\n", SKYPOPEN_P_LOG); return -1; } diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index e8e5ef4..871cc78 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -213,7 +213,7 @@ int skypopen_signaling_read(private_t *tech_pvt) if (!strncasecmp(message, "ERROR", 4)) { if (!strncasecmp(message, "ERROR 96 CALL", 12)) { - WARNINGA + DEBUGA_SKYPE ("Skype got ERROR: |||%s|||, we are trying to use this interface to make or receive a call, but another call is half-active on this interface. Let's the previous one to continue.\n", SKYPOPEN_P_LOG, message); } else if (!strncasecmp(message, "ERROR 99 CALL", 12)) { @@ -580,7 +580,7 @@ int skypopen_signaling_read(private_t *tech_pvt) if (!strcasecmp(prop, "DURATION") && (tech_pvt->interface_state == SKYPOPEN_STATE_ERROR_DOUBLE_CALL)) { char msg_to_skype[1024]; skypopen_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1); - ERRORA("We are in a double call situation, trying to get out hanging up call id: %s.\n", SKYPOPEN_P_LOG, id); + WARNINGA("We are in a double call situation, trying to get out hanging up call id: %s.\n", SKYPOPEN_P_LOG, id); sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", id); skypopen_signaling_write(tech_pvt, msg_to_skype); sprintf(msg_to_skype, "ALTER CALL %s HANGUP", id); @@ -743,7 +743,7 @@ int skypopen_signaling_read(private_t *tech_pvt) if (tech_pvt->tcp_cli_thread == NULL) { DEBUGA_SKYPE("START start_audio_threads\n", SKYPOPEN_P_LOG); if (start_audio_threads(tech_pvt)) { - ERRORA("start_audio_threads FAILED\n", SKYPOPEN_P_LOG); + WARNINGA("start_audio_threads FAILED\n", SKYPOPEN_P_LOG); return CALLFLOW_INCOMING_HANGUP; } } commit a5045b1ab02105ea8cc6865482be5abdf04a15e3 Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Wed Oct 27 09:12:17 2010 -0500 skypopen: interface DOWN during hangup, cosmetics diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index 03acda6..2e01871 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -592,6 +592,7 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session) } } + tech_pvt->interface_state = SKYPOPEN_STATE_HANGUP_REQUESTED; switch_mutex_lock(tech_pvt->flag_mutex); #if 1 switch_clear_flag(tech_pvt, TFLAG_IO); @@ -604,7 +605,6 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session) //DEBUGA_SKYPE("debugging_hangup 2\n", SKYPOPEN_P_LOG); - tech_pvt->interface_state = SKYPOPEN_STATE_HANGUP_REQUESTED; if (strlen(tech_pvt->skype_call_id)) { DEBUGA_SKYPE("hanging up skype call: %s\n", SKYPOPEN_P_LOG, tech_pvt->skype_call_id); @@ -648,7 +648,7 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session) } //DEBUGA_SKYPE("debugging_hangup 9\n", SKYPOPEN_P_LOG); - tech_pvt->interface_state = SKYPOPEN_STATE_IDLE; + tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; if (tech_pvt->skype_callflow == CALLFLOW_STATUS_FINISHED) { tech_pvt->skype_callflow = CALLFLOW_CALL_IDLE; } diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index 62e77dc..e8e5ef4 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -213,11 +213,11 @@ int skypopen_signaling_read(private_t *tech_pvt) if (!strncasecmp(message, "ERROR", 4)) { if (!strncasecmp(message, "ERROR 96 CALL", 12)) { - DEBUGA_SKYPE + WARNINGA ("Skype got ERROR: |||%s|||, we are trying to use this interface to make or receive a call, but another call is half-active on this interface. Let's the previous one to continue.\n", SKYPOPEN_P_LOG, message); } else if (!strncasecmp(message, "ERROR 99 CALL", 12)) { - ERRORA("Skype got ERROR: |||%s|||, another call is active on this interface\n\n\n", SKYPOPEN_P_LOG, message); + WARNINGA("Skype got ERROR: |||%s|||, another call is active on this interface\n\n\n", SKYPOPEN_P_LOG, message); tech_pvt->interface_state = SKYPOPEN_STATE_ERROR_DOUBLE_CALL; } else if (!strncasecmp(message, "ERROR 592 ALTER CALL", 19)) { NOTICA("Skype got ERROR about TRANSFERRING, no problem: |||%s|||\n", SKYPOPEN_P_LOG, message); @@ -250,7 +250,7 @@ int skypopen_signaling_read(private_t *tech_pvt) return CALLFLOW_INCOMING_HANGUP; } else if (!strncasecmp(message, "ERROR 589 ALTER CALL", 19)) { char msg_to_skype[256]; - ERRORA("Skype client was not able to correctly manage tcp audio sockets, probably got a local or remote hangup: |||%s|||\n", SKYPOPEN_P_LOG, message); + WARNINGA("Skype client was not able to correctly manage tcp audio sockets, probably got a local or remote hangup: |||%s|||\n", SKYPOPEN_P_LOG, message); if(strlen(tech_pvt->skype_call_id)){ sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id); skypopen_signaling_write(tech_pvt, msg_to_skype); @@ -1979,16 +1979,16 @@ int skypopen_answered(private_t *tech_pvt) } } else { - ERRORA("no channel\n", SKYPOPEN_P_LOG); + ERRORA("no channel after INPROGRESS?\n", SKYPOPEN_P_LOG); return SWITCH_STATUS_FALSE; } switch_core_session_rwunlock(session); } else { - ERRORA("no session after INPROGRESS, let's hangup\n", SKYPOPEN_P_LOG); + WARNINGA("no session after INPROGRESS, let's hangup\n", SKYPOPEN_P_LOG); return SWITCH_STATUS_FALSE; } } else { - ERRORA("no tech_pvt->session_uuid_str after INPROGRESS, let's hangup\n", SKYPOPEN_P_LOG); + WARNINGA("no tech_pvt->session_uuid_str after INPROGRESS, let's hangup\n", SKYPOPEN_P_LOG); return SWITCH_STATUS_FALSE; } return res; commit 99b14db491884cfe81b3fecd4da52348b4b7849f Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Wed Oct 27 08:20:03 2010 -0500 skypopen: manage ERROR 36 Not online, cosmetics, put the interface DOWN when no session and when beginning to destroy diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index 1b976d9..03acda6 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -471,6 +471,7 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session) if (tech_pvt) { DEBUGA_SKYPE("%s CHANNEL DESTROY %s\n", SKYPOPEN_P_LOG, tech_pvt->name, switch_core_session_get_uuid(session)); + tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; switch_mutex_lock(tech_pvt->flag_mutex); #if 1 @@ -510,8 +511,8 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session) while(tech_pvt->tcp_srv_thread){ switch_sleep(5000); conta++; - if(conta==100){ - ERRORA("tcp_srv_thread is NOT dead\n", SKYPOPEN_P_LOG); + if(conta==200){ + ERRORA("tcp_srv_thread is NOT dead, this can LEAK MEMORY\n", SKYPOPEN_P_LOG); break; } } @@ -520,8 +521,8 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session) while(tech_pvt->tcp_cli_thread){ switch_sleep(5000); conta++; - if(conta==100){ - ERRORA("tcp_cli_thread is NOT dead\n", SKYPOPEN_P_LOG); + if(conta==200){ + ERRORA("tcp_cli_thread is NOT dead, this can LEAK MEMORY\n", SKYPOPEN_P_LOG); break; } } @@ -1450,13 +1451,14 @@ static void *SWITCH_THREAD_FUNC skypopen_signaling_thread_func(switch_thread_t * } else { DEBUGA_SKYPE("no session\n", SKYPOPEN_P_LOG); + tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; DEBUGA_SKYPE("audio tcp threads to DIE\n", SKYPOPEN_P_LOG); conta=0; while(tech_pvt->tcp_srv_thread){ switch_sleep(5000); conta++; - if(conta==100){ - ERRORA("tcp_srv_thread is NOT dead\n", SKYPOPEN_P_LOG); + if(conta==200){ + ERRORA("tcp_srv_thread is NOT dead, this can LEAK MEMORY\n", SKYPOPEN_P_LOG); break; } } @@ -1465,8 +1467,8 @@ static void *SWITCH_THREAD_FUNC skypopen_signaling_thread_func(switch_thread_t * while(tech_pvt->tcp_cli_thread){ switch_sleep(5000); conta++; - if(conta==100){ - ERRORA("tcp_cli_thread is NOT dead\n", SKYPOPEN_P_LOG); + if(conta==200){ + ERRORA("tcp_cli_thread is NOT dead, this can LEAK MEMORY\n", SKYPOPEN_P_LOG); break; } } @@ -2312,13 +2314,13 @@ int remote_party_is_ringing(private_t *tech_pvt) session = switch_core_session_locate(tech_pvt->session_uuid_str); } else { ERRORA("No session_uuid_str???\n", SKYPOPEN_P_LOG); - goto bad; + return SWITCH_STATUS_FALSE; } if (session) { channel = switch_core_session_get_channel(session); } else { ERRORA("No session???\n", SKYPOPEN_P_LOG); - goto bad; + return SWITCH_STATUS_FALSE; } if (channel) { switch_channel_mark_ring_ready(channel); @@ -2329,9 +2331,7 @@ int remote_party_is_ringing(private_t *tech_pvt) switch_core_session_rwunlock(session); - return 1; - bad: - return 0; + return SWITCH_STATUS_SUCCESS; } int remote_party_is_early_media(private_t *tech_pvt) diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index dfe74ad..62e77dc 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -235,9 +235,22 @@ int skypopen_signaling_read(private_t *tech_pvt) DEBUGA_SKYPE("Skype got ERROR about a failed action (probably TRYING to HANGUP A CALL), no problem: |||%s|||\n", SKYPOPEN_P_LOG, message); } + } else if (!strncasecmp(message, "ERROR 36 Not online", 18)) { + char msg_to_skype[256]; + ERRORA("Skype client is not online, eg: not connected to Skype network, probably got a temporary net outage: |||%s|||\n", SKYPOPEN_P_LOG, message); + if(strlen(tech_pvt->skype_call_id)){ + sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id); + skypopen_signaling_write(tech_pvt, msg_to_skype); + } + if(strlen(tech_pvt->ring_id)){ + sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->ring_id); + skypopen_signaling_write(tech_pvt, msg_to_skype); + } + tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; + return CALLFLOW_INCOMING_HANGUP; } else if (!strncasecmp(message, "ERROR 589 ALTER CALL", 19)) { char msg_to_skype[256]; - ERRORA("Skype client was not able to correctly manage tcp audio sockets: |||%s|||\n", SKYPOPEN_P_LOG, message); + ERRORA("Skype client was not able to correctly manage tcp audio sockets, probably got a local or remote hangup: |||%s|||\n", SKYPOPEN_P_LOG, message); if(strlen(tech_pvt->skype_call_id)){ sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id); skypopen_signaling_write(tech_pvt, msg_to_skype); @@ -605,9 +618,8 @@ int skypopen_signaling_read(private_t *tech_pvt) tech_pvt->interface_state = SKYPOPEN_STATE_RINGING; skypopen_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1); DEBUGA_SKYPE("Our remote party in skype_call %s is RINGING\n", SKYPOPEN_P_LOG, id); - if (!remote_party_is_ringing(tech_pvt)) { - - WARNINGA("We are getting the RINGING from a call we canceled, trying to get out hanging up call id: %s.\n", + if (remote_party_is_ringing(tech_pvt) != SWITCH_STATUS_SUCCESS) { + WARNINGA("We are getting the RINGING from a call we probably canceled, trying to get out hanging up call id: %s.\n", SKYPOPEN_P_LOG, id); sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", id); skypopen_signaling_write(tech_pvt, msg_to_skype); @@ -757,7 +769,7 @@ int skypopen_signaling_read(private_t *tech_pvt) } else if (!strcasecmp(value, "LOCALHOLD")) { char msg_to_skype[256]; - WARNINGA("skype_call: %s is now LOCALHOLD\n", SKYPOPEN_P_LOG, id); + WARNINGA("skype_call: %s is now LOCALHOLD, let's hangup\n", SKYPOPEN_P_LOG, id); sprintf(msg_to_skype, "ALTER CALL %s HANGUP", id); skypopen_signaling_write(tech_pvt, msg_to_skype); } else if (!strcasecmp(value, "REMOTEHOLD")) { @@ -1972,11 +1984,11 @@ int skypopen_answered(private_t *tech_pvt) } switch_core_session_rwunlock(session); } else { - ERRORA("no session\n", SKYPOPEN_P_LOG); + ERRORA("no session after INPROGRESS, let's hangup\n", SKYPOPEN_P_LOG); return SWITCH_STATUS_FALSE; } } else { - ERRORA("no tech_pvt->session_uuid_str\n", SKYPOPEN_P_LOG); + ERRORA("no tech_pvt->session_uuid_str after INPROGRESS, let's hangup\n", SKYPOPEN_P_LOG); return SWITCH_STATUS_FALSE; } return res; commit 145a7a4b3125bf1cd11161bb3c1fb5f2e15d6145 Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Wed Oct 27 07:09:13 2010 -0500 skypopen: manage failed ALTER I/O (sockets), LOCALHOLD, ANSWER. Use only IDLE interfaces to answer diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index 52afe9c..dfe74ad 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -235,6 +235,19 @@ int skypopen_signaling_read(private_t *tech_pvt) DEBUGA_SKYPE("Skype got ERROR about a failed action (probably TRYING to HANGUP A CALL), no problem: |||%s|||\n", SKYPOPEN_P_LOG, message); } + } else if (!strncasecmp(message, "ERROR 589 ALTER CALL", 19)) { + char msg_to_skype[256]; + ERRORA("Skype client was not able to correctly manage tcp audio sockets: |||%s|||\n", SKYPOPEN_P_LOG, message); + if(strlen(tech_pvt->skype_call_id)){ + sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id); + skypopen_signaling_write(tech_pvt, msg_to_skype); + } + if(strlen(tech_pvt->ring_id)){ + sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->ring_id); + skypopen_signaling_write(tech_pvt, msg_to_skype); + } + tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; + return CALLFLOW_INCOMING_HANGUP; } else { ERRORA("Skype got ERROR: |||%s|||\n", SKYPOPEN_P_LOG, message); tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED; @@ -482,7 +495,8 @@ int skypopen_signaling_read(private_t *tech_pvt) //SKYPOPEN_P_LOG, message, obj, id, prop, value, where ? where : "NULL"); if (!strcasecmp(prop, "PARTNER_HANDLE")) { - if (tech_pvt->interface_state != SKYPOPEN_STATE_SELECTED && (!strlen(tech_pvt->skype_call_id) || !strlen(tech_pvt->session_uuid_str))) { + //if (tech_pvt->interface_state != SKYPOPEN_STATE_SELECTED && (!strlen(tech_pvt->skype_call_id) || !strlen(tech_pvt->session_uuid_str))) {} + if (tech_pvt->interface_state == SKYPOPEN_STATE_IDLE){ /* we are NOT inside an active call */ DEBUGA_SKYPE("Call %s go to skypopen_partner_handle_ring\n", SKYPOPEN_P_LOG, id); skypopen_strncpy(tech_pvt->ring_id, id, sizeof(tech_pvt->ring_id)); @@ -565,8 +579,9 @@ int skypopen_signaling_read(private_t *tech_pvt) if (!strcasecmp(value, "RINGING")) { char msg_to_skype[1024]; - if ((tech_pvt->interface_state != SKYPOPEN_STATE_SELECTED && tech_pvt->interface_state != SKYPOPEN_STATE_DIALING) - && (!strlen(tech_pvt->skype_call_id) || !strlen(tech_pvt->session_uuid_str))) { + //if ((tech_pvt->interface_state != SKYPOPEN_STATE_SELECTED && tech_pvt->interface_state != SKYPOPEN_STATE_DIALING) + //&& (!strlen(tech_pvt->skype_call_id) || !strlen(tech_pvt->session_uuid_str))) {} + if (tech_pvt->interface_state == SKYPOPEN_STATE_IDLE){ // CLOUDTREE (Thomas Hazel) skypopen_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1); @@ -728,7 +743,10 @@ int skypopen_signaling_read(private_t *tech_pvt) skypopen_signaling_write(tech_pvt, msg_to_skype); } tech_pvt->skype_callflow = CALLFLOW_STATUS_INPROGRESS; - skypopen_answered(tech_pvt); + if(skypopen_answered(tech_pvt)!= SWITCH_STATUS_SUCCESS){ + sprintf(msg_to_skype, "ALTER CALL %s HANGUP", id); + skypopen_signaling_write(tech_pvt, msg_to_skype); + } } else { DEBUGA_SKYPE("I'm on %s, skype_call %s is NOT MY call, ignoring\n", SKYPOPEN_P_LOG, tech_pvt->skype_call_id, id); } @@ -737,6 +755,11 @@ int skypopen_signaling_read(private_t *tech_pvt) DEBUGA_SKYPE("Back from REMOTEHOLD!\n", SKYPOPEN_P_LOG); } + } else if (!strcasecmp(value, "LOCALHOLD")) { + char msg_to_skype[256]; + WARNINGA("skype_call: %s is now LOCALHOLD\n", SKYPOPEN_P_LOG, id); + sprintf(msg_to_skype, "ALTER CALL %s HANGUP", id); + skypopen_signaling_write(tech_pvt, msg_to_skype); } else if (!strcasecmp(value, "REMOTEHOLD")) { tech_pvt->skype_callflow = CALLFLOW_STATUS_REMOTEHOLD; DEBUGA_SKYPE("skype_call: %s is now REMOTEHOLD\n", SKYPOPEN_P_LOG, id); @@ -1922,12 +1945,13 @@ int inbound_channel_answered(private_t *tech_pvt) int skypopen_answered(private_t *tech_pvt) { - int res = 0; + int res = SWITCH_STATUS_SUCCESS; switch_core_session_t *session = NULL; switch_channel_t *channel = NULL; //WARNINGA("ANSWERED tech_pvt->skype_call_id=%s, tech_pvt->skype_callflow=%d, tech_pvt->interface_state=%d, tech_pvt->skype_user=%s, tech_pvt->callid_number=%s, tech_pvt->ring_value=%s, tech_pvt->ring_id=%s, tech_pvt->answer_value=%s, tech_pvt->answer_id=%s\n", SKYPOPEN_P_LOG, tech_pvt->skype_call_id, tech_pvt->skype_callflow, tech_pvt->interface_state, tech_pvt->skype_user, tech_pvt->callid_number, tech_pvt->ring_value, tech_pvt->ring_id, tech_pvt->answer_value, tech_pvt->answer_id); + if(strlen(tech_pvt->session_uuid_str)){ session = switch_core_session_locate(tech_pvt->session_uuid_str); if (session) { channel = switch_core_session_get_channel(session); @@ -1944,11 +1968,16 @@ int skypopen_answered(private_t *tech_pvt) } else { ERRORA("no channel\n", SKYPOPEN_P_LOG); + return SWITCH_STATUS_FALSE; } switch_core_session_rwunlock(session); } else { ERRORA("no session\n", SKYPOPEN_P_LOG); - + return SWITCH_STATUS_FALSE; + } + } else { + ERRORA("no tech_pvt->session_uuid_str\n", SKYPOPEN_P_LOG); + return SWITCH_STATUS_FALSE; } return res; } commit 0499be4acd76baefb1267803fd2013954012e16c Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Wed Oct 27 05:29:15 2010 -0500 skypopen: locking flags diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index a5093d7..1b976d9 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -445,7 +445,9 @@ static switch_status_t channel_on_init(switch_core_session_t *session) channel = switch_core_session_get_channel(session); switch_assert(channel != NULL); switch_channel_set_variable(channel, "skype_user", tech_pvt->skype_user); + switch_mutex_lock(tech_pvt->flag_mutex); switch_set_flag(tech_pvt, TFLAG_IO); + switch_mutex_unlock(tech_pvt->flag_mutex); /* Move channel's state machine to ROUTING. This means the call is trying to get from the initial start where the call because, to the point @@ -469,6 +471,17 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session) if (tech_pvt) { DEBUGA_SKYPE("%s CHANNEL DESTROY %s\n", SKYPOPEN_P_LOG, tech_pvt->name, switch_core_session_get_uuid(session)); + + switch_mutex_lock(tech_pvt->flag_mutex); +#if 1 + switch_clear_flag(tech_pvt, TFLAG_IO); + switch_clear_flag(tech_pvt, TFLAG_VOICE); +#endif//0 + if (switch_test_flag(tech_pvt, TFLAG_PROGRESS)) { + switch_clear_flag(tech_pvt, TFLAG_PROGRESS); + } + switch_mutex_unlock(tech_pvt->flag_mutex); + if (switch_core_codec_ready(&tech_pvt->read_codec)) { switch_core_codec_destroy(&tech_pvt->read_codec); } @@ -578,8 +591,16 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session) } } + switch_mutex_lock(tech_pvt->flag_mutex); +#if 1 switch_clear_flag(tech_pvt, TFLAG_IO); switch_clear_flag(tech_pvt, TFLAG_VOICE); +#endif//0 + if (switch_test_flag(tech_pvt, TFLAG_PROGRESS)) { + switch_clear_flag(tech_pvt, TFLAG_PROGRESS); + } + switch_mutex_unlock(tech_pvt->flag_mutex); + //DEBUGA_SKYPE("debugging_hangup 2\n", SKYPOPEN_P_LOG); tech_pvt->interface_state = SKYPOPEN_STATE_HANGUP_REQUESTED; @@ -705,10 +726,10 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int } switch_mutex_lock(tech_pvt->flag_mutex); -#if 0 +#if 1 switch_clear_flag(tech_pvt, TFLAG_IO); switch_clear_flag(tech_pvt, TFLAG_VOICE); - //switch_set_flag(tech_pvt, TFLAG_HANGUP); + switch_set_flag(tech_pvt, TFLAG_HANGUP); #endif//0 if (switch_test_flag(tech_pvt, TFLAG_PROGRESS)) { switch_clear_flag(tech_pvt, TFLAG_PROGRESS); @@ -891,10 +912,15 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch tech_pvt->read_frame.datalen = 640; } + switch_mutex_lock(tech_pvt->flag_mutex); switch_set_flag(tech_pvt, TFLAG_VOICE); + switch_mutex_unlock(tech_pvt->flag_mutex); + while (switch_test_flag(tech_pvt, TFLAG_IO)) { if (switch_test_flag(tech_pvt, TFLAG_BREAK)) { + switch_mutex_lock(tech_pvt->flag_mutex); switch_clear_flag(tech_pvt, TFLAG_BREAK); + switch_mutex_unlock(tech_pvt->flag_mutex); DEBUGA_SKYPE("CHANNEL READ FRAME goto CNG\n", SKYPOPEN_P_LOG); goto cng; } @@ -905,7 +931,9 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch } if (switch_test_flag(tech_pvt, TFLAG_IO) && switch_test_flag(tech_pvt, TFLAG_VOICE)) { + switch_mutex_lock(tech_pvt->flag_mutex); switch_clear_flag(tech_pvt, TFLAG_VOICE); + switch_mutex_unlock(tech_pvt->flag_mutex); if (!tech_pvt->read_frame.datalen) { DEBUGA_SKYPE("CHANNEL READ CONTINUE\n", SKYPOPEN_P_LOG); continue; @@ -1040,7 +1068,9 @@ static switch_status_t channel_answer_channel(switch_core_session_t *session) tech_pvt = switch_core_session_get_private(session); switch_assert(tech_pvt != NULL); + switch_mutex_lock(tech_pvt->flag_mutex); switch_clear_flag(tech_pvt, TFLAG_IO); + switch_mutex_unlock(tech_pvt->flag_mutex); skypopen_answer(tech_pvt); while (!switch_test_flag(tech_pvt, TFLAG_IO)) { //FIXME that would be better with a timeout @@ -1084,13 +1114,15 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s case SWITCH_MESSAGE_INDICATE_PROGRESS: { DEBUGA_SKYPE("%s CHANNEL got SWITCH_MESSAGE_INDICATE_PROGRESS\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); + switch_mutex_lock(tech_pvt->flag_mutex); switch_set_flag(tech_pvt, TFLAG_PROGRESS); + switch_mutex_unlock(tech_pvt->flag_mutex); } break; case SWITCH_MESSAGE_INDICATE_CLEAR_PROGRESS: { DEBUGA_SKYPE("%s CHANNEL got SWITCH_MESSAGE_INDICATE_CLEAR_PROGRESS\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); - if (switch_set_flag(tech_pvt, TFLAG_PROGRESS)) { + if (switch_test_flag(tech_pvt, TFLAG_PROGRESS)) { sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->ring_id); skypopen_signaling_write(tech_pvt, msg_to_skype); sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->ring_id); @@ -1099,7 +1131,9 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s skypopen_signaling_write(tech_pvt, msg_to_skype); sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id); skypopen_signaling_write(tech_pvt, msg_to_skype); + switch_mutex_lock(tech_pvt->flag_mutex); switch_clear_flag(tech_pvt, TFLAG_PROGRESS); + switch_mutex_unlock(tech_pvt->flag_mutex); } } break; @@ -1110,7 +1144,9 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s //switch_set_flag(tech_pvt, TFLAG_IO); channel_answer_channel(session); + switch_mutex_lock(tech_pvt->flag_mutex); switch_clear_flag(tech_pvt, TFLAG_PROGRESS); + switch_mutex_unlock(tech_pvt->flag_mutex); if (tech_pvt->read_buffer) { switch_mutex_lock(tech_pvt->mutex_audio_srv); @@ -1349,7 +1385,9 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi caller_profile->destination_number = rdest; switch_channel_set_flag(channel, CF_OUTBOUND); + switch_mutex_lock(tech_pvt->flag_mutex); switch_set_flag(tech_pvt, TFLAG_OUTBOUND); + switch_mutex_unlock(tech_pvt->flag_mutex); switch_channel_set_state(channel, CS_INIT); skypopen_call(tech_pvt, rdest, 30); switch_mutex_unlock(globals.mutex); diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index 1f9dd01..52afe9c 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -1904,7 +1904,9 @@ int inbound_channel_answered(private_t *tech_pvt) channel = switch_core_session_get_channel(session); if (channel) { + switch_mutex_lock(tech_pvt->flag_mutex); switch_set_flag(tech_pvt, TFLAG_IO); + switch_mutex_unlock(tech_pvt->flag_mutex); } else { ERRORA("no channel\n", SKYPOPEN_P_LOG); } commit 01d0f1bd2ac4c073a0d5be93fbb764e7c3de98a2 Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Tue Oct 26 21:46:52 2010 -0500 skypopen: better management of 'hupall' and KILL diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index b2ff8ef..a5093d7 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -461,6 +461,7 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session) { private_t *tech_pvt = NULL; switch_status_t status; + int conta; tech_pvt = switch_core_session_get_private(session); @@ -490,6 +491,29 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session) if (tech_pvt->write_buffer) { switch_buffer_destroy(&tech_pvt->write_buffer); } + + DEBUGA_SKYPE("audio tcp threads to DIE\n", SKYPOPEN_P_LOG); + conta=0; + while(tech_pvt->tcp_srv_thread){ + switch_sleep(5000); + conta++; + if(conta==100){ + ERRORA("tcp_srv_thread is NOT dead\n", SKYPOPEN_P_LOG); + break; + } + } + DEBUGA_SKYPE("audio tcp srv thread DEAD %d\n", SKYPOPEN_P_LOG, conta); + conta=0; + while(tech_pvt->tcp_cli_thread){ + switch_sleep(5000); + conta++; + if(conta==100){ + ERRORA("tcp_cli_thread is NOT dead\n", SKYPOPEN_P_LOG); + break; + } + } + DEBUGA_SKYPE("audio tcp cli thread DEAD %d\n", SKYPOPEN_P_LOG, conta); + //DEBUGA_SKYPE("debugging_hangup 13\n", SKYPOPEN_P_LOG); switch_mutex_lock(tech_pvt->mutex_thread_audio_cli); //DEBUGA_SKYPE("debugging_hangup cli lock\n", SKYPOPEN_P_LOG); @@ -526,6 +550,7 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session) DEBUGA_SKYPE("!!!!!!NO tech_pvt!!!! CHANNEL DESTROY %s\n", SKYPOPEN_P_LOG, switch_core_session_get_uuid(session)); } + DEBUGA_SKYPE("CHANNEL DESTROYED %s\n", SKYPOPEN_P_LOG, switch_core_session_get_uuid(session)); return SWITCH_STATUS_SUCCESS; } @@ -613,6 +638,8 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session) } //DEBUGA_SKYPE("debugging_hangup 12\n", SKYPOPEN_P_LOG); + switch_channel_set_state(channel, CS_DESTROY); + return SWITCH_STATUS_SUCCESS; } @@ -653,7 +680,7 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int { switch_channel_t *channel = NULL; private_t *tech_pvt = NULL; - char msg_to_skype[256]; + //char msg_to_skype[256]; channel = switch_core_session_get_channel(session); switch_assert(channel != NULL); @@ -664,8 +691,8 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int if (tech_pvt) { switch (sig) { case SWITCH_SIG_KILL: - switch_mutex_lock(tech_pvt->flag_mutex); DEBUGA_SKYPE("%s CHANNEL got SWITCH_SIG_KILL\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); + tech_pvt->interface_state = SKYPOPEN_STATE_HANGUP_REQUESTED; if (tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD) { DEBUGA_SKYPE("FYI %s CHANNEL in CALLFLOW_STATUS_REMOTEHOLD got SWITCH_SIG_KILL\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); } @@ -676,21 +703,30 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int WARNINGA("FYI %s CHANNEL in %d state got SWITCH_SIG_KILL\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel), switch_channel_get_state(channel)); } + + switch_mutex_lock(tech_pvt->flag_mutex); +#if 0 switch_clear_flag(tech_pvt, TFLAG_IO); switch_clear_flag(tech_pvt, TFLAG_VOICE); - switch_set_flag(tech_pvt, TFLAG_HANGUP); + //switch_set_flag(tech_pvt, TFLAG_HANGUP); +#endif//0 if (switch_test_flag(tech_pvt, TFLAG_PROGRESS)) { switch_clear_flag(tech_pvt, TFLAG_PROGRESS); } switch_mutex_unlock(tech_pvt->flag_mutex); +#if 0 sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->ring_id); skypopen_signaling_write(tech_pvt, msg_to_skype); sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->ring_id); skypopen_signaling_write(tech_pvt, msg_to_skype); + +#if 1 sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->skype_call_id); skypopen_signaling_write(tech_pvt, msg_to_skype); sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id); skypopen_signaling_write(tech_pvt, msg_to_skype); +#endif +#endif//0 break; case SWITCH_SIG_BREAK: DEBUGA_SKYPE("%s CHANNEL got SWITCH_SIG_BREAK\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); @@ -1355,6 +1391,7 @@ static void *SWITCH_THREAD_FUNC skypopen_signaling_thread_func(switch_thread_t * if (res == CALLFLOW_INCOMING_HANGUP || tech_pvt->skype_callflow == CALLFLOW_INCOMING_HANGUP) { switch_core_session_t *session = NULL; switch_channel_t *channel = NULL; + int conta; DEBUGA_SKYPE("skype call ended\n", SKYPOPEN_P_LOG); @@ -1374,12 +1411,34 @@ static void *SWITCH_THREAD_FUNC skypopen_signaling_thread_func(switch_thread_t * switch_core_session_rwunlock(session); } else { DEBUGA_SKYPE("no session\n", SKYPOPEN_P_LOG); + + DEBUGA_SKYPE("audio tcp threads to DIE\n", SKYPOPEN_P_LOG); + conta=0; + while(tech_pvt->tcp_srv_thread){ + switch_sleep(5000); + conta++; + if(conta==100){ + ERRORA("tcp_srv_thread is NOT dead\n", SKYPOPEN_P_LOG); + break; + } + } + DEBUGA_SKYPE("audio tcp srv thread DEAD %d\n", SKYPOPEN_P_LOG, conta); + conta=0; + while(tech_pvt->tcp_cli_thread){ + switch_sleep(5000); + conta++; + if(conta==100){ + ERRORA("tcp_cli_thread is NOT dead\n", SKYPOPEN_P_LOG); + break; + } + } + DEBUGA_SKYPE("audio tcp cli thread DEAD %d\n", SKYPOPEN_P_LOG, conta); } switch_mutex_lock(globals.mutex); tech_pvt->ringing_state = SKYPOPEN_RINGING_INIT; - tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; + //tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; *tech_pvt->session_uuid_str = '\0'; - *tech_pvt->skype_call_id = '\0'; + //*tech_pvt->skype_call_id = '\0'; *tech_pvt->initial_skype_user = '\0'; *tech_pvt->answer_id = '\0'; *tech_pvt->answer_value = '\0'; @@ -1387,10 +1446,8 @@ static void *SWITCH_THREAD_FUNC skypopen_signaling_thread_func(switch_thread_t * *tech_pvt->ring_value = '\0'; *tech_pvt->callid_number = '\0'; *tech_pvt->callid_name = '\0'; - switch_mutex_unlock(globals.mutex); - switch_sleep(300000); //0.3 sec - switch_mutex_lock(globals.mutex); + //switch_sleep(300000); //0.3 sec tech_pvt->skype_callflow = CALLFLOW_CALL_IDLE; tech_pvt->interface_state = SKYPOPEN_STATE_IDLE; switch_mutex_unlock(globals.mutex); diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index 15c349e..1f9dd01 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -851,6 +851,8 @@ void *skypopen_do_tcp_srv_thread_func(void *obj) if (!(running && tech_pvt->running)) break; while (tech_pvt && tech_pvt->interface_state != SKYPOPEN_STATE_DOWN + && tech_pvt->interface_state != SKYPOPEN_STATE_IDLE + && tech_pvt->interface_state != SKYPOPEN_STATE_HANGUP_REQUESTED && (tech_pvt->skype_callflow == CALLFLOW_STATUS_INPROGRESS || tech_pvt->skype_callflow == CALLFLOW_STATUS_EARLYMEDIA || tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD || tech_pvt->skype_callflow == SKYPOPEN_STATE_UP)) { @@ -1010,6 +1012,8 @@ void *skypopen_do_tcp_cli_thread_func(void *obj) if (!(running && tech_pvt->running)) break; while (tech_pvt && tech_pvt->interface_state != SKYPOPEN_STATE_DOWN + && tech_pvt->interface_state != SKYPOPEN_STATE_IDLE + && tech_pvt->interface_state != SKYPOPEN_STATE_HANGUP_REQUESTED && (tech_pvt->skype_callflow == CALLFLOW_STATUS_INPROGRESS || tech_pvt->skype_callflow == CALLFLOW_STATUS_EARLYMEDIA || tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD || tech_pvt->skype_callflow == SKYPOPEN_STATE_UP)) { commit 5d03777fe59ecf841f392348edb150037ad5755a Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Tue Oct 26 06:55:46 2010 -0500 skypopen: cleanup continues diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index 82d2635..b2ff8ef 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -490,28 +490,28 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session) if (tech_pvt->write_buffer) { switch_buffer_destroy(&tech_pvt->write_buffer); } - DEBUGA_SKYPE("debugging_hangup 13\n", SKYPOPEN_P_LOG); + //DEBUGA_SKYPE("debugging_hangup 13\n", SKYPOPEN_P_LOG); switch_mutex_lock(tech_pvt->mutex_thread_audio_cli); - DEBUGA_SKYPE("debugging_hangup cli lock\n", SKYPOPEN_P_LOG); + //DEBUGA_SKYPE("debugging_hangup cli lock\n", SKYPOPEN_P_LOG); if (tech_pvt->tcp_cli_thread) { - DEBUGA_SKYPE("debugging_hangup 14\n", SKYPOPEN_P_LOG); + //DEBUGA_SKYPE("debugging_hangup 14\n", SKYPOPEN_P_LOG); switch_thread_join(&status, tech_pvt->tcp_cli_thread); tech_pvt->tcp_cli_thread = NULL; - DEBUGA_SKYPE("debugging_hangup 15\n", SKYPOPEN_P_LOG); + //DEBUGA_SKYPE("debugging_hangup 15\n", SKYPOPEN_P_LOG); } switch_mutex_unlock(tech_pvt->mutex_thread_audio_cli); - DEBUGA_SKYPE("debugging_hangup cli unlock\n", SKYPOPEN_P_LOG); + //DEBUGA_SKYPE("debugging_hangup cli unlock\n", SKYPOPEN_P_LOG); switch_mutex_lock(tech_pvt->mutex_thread_audio_srv); - DEBUGA_SKYPE("debugging_hangup srv lock\n", SKYPOPEN_P_LOG); + //DEBUGA_SKYPE("debugging_hangup srv lock\n", SKYPOPEN_P_LOG); if (tech_pvt->tcp_srv_thread) { - DEBUGA_SKYPE("debugging_hangup 16\n", SKYPOPEN_P_LOG); + //DEBUGA_SKYPE("debugging_hangup 16\n", SKYPOPEN_P_LOG); switch_thread_join(&status, tech_pvt->tcp_srv_thread); tech_pvt->tcp_srv_thread = NULL; - DEBUGA_SKYPE("debugging_hangup 17\n", SKYPOPEN_P_LOG); + //DEBUGA_SKYPE("debugging_hangup 17\n", SKYPOPEN_P_LOG); } switch_mutex_unlock(tech_pvt->mutex_thread_audio_srv); - DEBUGA_SKYPE("debugging_hangup srv unlock\n", SKYPOPEN_P_LOG); - DEBUGA_SKYPE("debugging_hangup 18\n", SKYPOPEN_P_LOG); + //DEBUGA_SKYPE("debugging_hangup srv unlock\n", SKYPOPEN_P_LOG); + //DEBUGA_SKYPE("debugging_hangup 18\n", SKYPOPEN_P_LOG); *tech_pvt->session_uuid_str = '\0'; tech_pvt->interface_state = SKYPOPEN_STATE_IDLE; @@ -542,7 +542,7 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session) tech_pvt = switch_core_session_get_private(session); - DEBUGA_SKYPE("debugging_hangup 1\n", SKYPOPEN_P_LOG); + //DEBUGA_SKYPE("debugging_hangup 1\n", SKYPOPEN_P_LOG); if (tech_pvt) { if (!switch_channel_test_flag(channel, CF_ANSWERED)) { @@ -556,7 +556,7 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session) switch_clear_flag(tech_pvt, TFLAG_IO); switch_clear_flag(tech_pvt, TFLAG_VOICE); - DEBUGA_SKYPE("debugging_hangup 2\n", SKYPOPEN_P_LOG); + //DEBUGA_SKYPE("debugging_hangup 2\n", SKYPOPEN_P_LOG); tech_pvt->interface_state = SKYPOPEN_STATE_HANGUP_REQUESTED; if (strlen(tech_pvt->skype_call_id)) { @@ -600,18 +600,18 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session) globals.calls = 0; } - DEBUGA_SKYPE("debugging_hangup 9\n", SKYPOPEN_P_LOG); + //DEBUGA_SKYPE("debugging_hangup 9\n", SKYPOPEN_P_LOG); tech_pvt->interface_state = SKYPOPEN_STATE_IDLE; if (tech_pvt->skype_callflow == CALLFLOW_STATUS_FINISHED) { tech_pvt->skype_callflow = CALLFLOW_CALL_IDLE; } - DEBUGA_SKYPE("debugging_hangup 10\n", SKYPOPEN_P_LOG); + //DEBUGA_SKYPE("debugging_hangup 10\n", SKYPOPEN_P_LOG); switch_mutex_unlock(globals.mutex); } else { WARNINGA("FYI %s CHANNEL has no tech_pvt in his private\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); - DEBUGA_SKYPE("debugging_hangup 11\n", SKYPOPEN_P_LOG); + //DEBUGA_SKYPE("debugging_hangup 11\n", SKYPOPEN_P_LOG); } - DEBUGA_SKYPE("debugging_hangup 12\n", SKYPOPEN_P_LOG); + //DEBUGA_SKYPE("debugging_hangup 12\n", SKYPOPEN_P_LOG); return SWITCH_STATUS_SUCCESS; } @@ -2124,33 +2124,33 @@ int start_audio_threads(private_t *tech_pvt) switch_threadattr_detach_set(thd_attr, 0); switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); switch_mutex_lock(tech_pvt->mutex_thread_audio_srv); - DEBUGA_SKYPE("debugging_hangup srv lock\n", SKYPOPEN_P_LOG); + //DEBUGA_SKYPE("debugging_hangup srv lock\n", SKYPOPEN_P_LOG); if (switch_thread_create(&tech_pvt->tcp_srv_thread, thd_attr, skypopen_do_tcp_srv_thread, tech_pvt, skypopen_module_pool) == SWITCH_STATUS_SUCCESS) { DEBUGA_SKYPE("started tcp_srv_thread thread.\n", SKYPOPEN_P_LOG); } else { ERRORA("failed to start tcp_srv_thread thread.\n", SKYPOPEN_P_LOG); switch_mutex_unlock(tech_pvt->mutex_thread_audio_srv); - DEBUGA_SKYPE("debugging_hangup srv unlock\n", SKYPOPEN_P_LOG); + //DEBUGA_SKYPE("debugging_hangup srv unlock\n", SKYPOPEN_P_LOG); return -1; } switch_mutex_unlock(tech_pvt->mutex_thread_audio_srv); - DEBUGA_SKYPE("debugging_hangup srv unlock\n", SKYPOPEN_P_LOG); + //DEBUGA_SKYPE("debugging_hangup srv unlock\n", SKYPOPEN_P_LOG); switch_threadattr_create(&thd_attr, skypopen_module_pool); switch_threadattr_detach_set(thd_attr, 0); switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); switch_mutex_lock(tech_pvt->mutex_thread_audio_cli); - DEBUGA_SKYPE("debugging_hangup cli lock\n", SKYPOPEN_P_LOG); + //DEBUGA_SKYPE("debugging_hangup cli lock\n", SKYPOPEN_P_LOG); if (switch_thread_create(&tech_pvt->tcp_cli_thread, thd_attr, skypopen_do_tcp_cli_thread, tech_pvt, skypopen_module_pool) == SWITCH_STATUS_SUCCESS) { DEBUGA_SKYPE("started tcp_cli_thread thread.\n", SKYPOPEN_P_LOG); } else { ERRORA("failed to start tcp_cli_thread thread.\n", SKYPOPEN_P_LOG); switch_mutex_unlock(tech_pvt->mutex_thread_audio_cli); - DEBUGA_SKYPE("debugging_hangup cli unlock\n", SKYPOPEN_P_LOG); + //DEBUGA_SKYPE("debugging_hangup cli unlock\n", SKYPOPEN_P_LOG); return -1; } switch_mutex_unlock(tech_pvt->mutex_thread_audio_cli); - DEBUGA_SKYPE("debugging_hangup cli unlock\n", SKYPOPEN_P_LOG); + //DEBUGA_SKYPE("debugging_hangup cli unlock\n", SKYPOPEN_P_LOG); switch_sleep(100000); if (tech_pvt->tcp_cli_thread == NULL || tech_pvt->tcp_srv_thread == NULL) { diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index 07c461b..15c349e 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -931,12 +931,12 @@ void *skypopen_do_tcp_srv_thread_func(void *obj) DEBUGA_SKYPE("incoming audio (read) server (I am it) EXITING\n", SKYPOPEN_P_LOG); skypopen_close_socket(s); s = -1; - DEBUGA_SKYPE("debugging_hangup PRE srv lock\n", SKYPOPEN_P_LOG); + //DEBUGA_SKYPE("debugging_hangup PRE srv lock\n", SKYPOPEN_P_LOG); switch_mutex_lock(tech_pvt->mutex_thread_audio_srv); - DEBUGA_SKYPE("debugging_hangup srv lock\n", SKYPOPEN_P_LOG); + //DEBUGA_SKYPE("debugging_hangup srv lock\n", SKYPOPEN_P_LOG); tech_pvt->tcp_srv_thread = NULL; switch_mutex_unlock(tech_pvt->mutex_thread_audio_srv); - DEBUGA_SKYPE("debugging_hangup srv unlock\n", SKYPOPEN_P_LOG); + //DEBUGA_SKYPE("debugging_hangup srv unlock\n", SKYPOPEN_P_LOG); return NULL; } @@ -1081,12 +1081,12 @@ void *skypopen_do_tcp_cli_thread_func(void *obj) DEBUGA_SKYPE("outbound audio server (I am it) EXITING\n", SKYPOPEN_P_LOG); skypopen_close_socket(s); s = -1; - DEBUGA_SKYPE("debugging_hangup PRE cli lock\n", SKYPOPEN_P_LOG); + //DEBUGA_SKYPE("debugging_hangup PRE cli lock\n", SKYPOPEN_P_LOG); switch_mutex_lock(tech_pvt->mutex_thread_audio_cli); - DEBUGA_SKYPE("debugging_hangup cli lock\n", SKYPOPEN_P_LOG); + //DEBUGA_SKYPE("debugging_hangup cli lock\n", SKYPOPEN_P_LOG); tech_pvt->tcp_cli_thread = NULL; switch_mutex_unlock(tech_pvt->mutex_thread_audio_cli); - DEBUGA_SKYPE("debugging_hangup cli unlock\n", SKYPOPEN_P_LOG); + //DEBUGA_SKYPE("debugging_hangup cli unlock\n", SKYPOPEN_P_LOG); return NULL; } commit 758254ad420b28d8e5539cca0138b9c6d2c0dd6f Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Tue Oct 26 06:13:25 2010 -0500 skypopen: cleanup begin diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index bd9f10c..82d2635 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -398,9 +398,9 @@ static switch_status_t interface_exists(char *the_interface) } if (tech_pvt->SkypopenHandles.disp) { - NOTICA("REMOVE CLOSIN X\n", SKYPOPEN_P_LOG); + DEBUGA_SKYPE("REMOVE CLOSIN X\n", SKYPOPEN_P_LOG); XCloseDisplay(tech_pvt->SkypopenHandles.disp); - NOTICA("REMOVE CLOSIN X END\n", SKYPOPEN_P_LOG); + DEBUGA_SKYPE("REMOVE CLOSIN X END\n", SKYPOPEN_P_LOG); } if (globals.SKYPOPEN_INTERFACES[interface_id].skypopen_signaling_thread) { @@ -2000,9 +2000,9 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypopen_shutdown) switch_yield(50000); } if (tech_pvt->SkypopenHandles.disp) { - NOTICA("CLOSIN X\n", SKYPOPEN_P_LOG); + DEBUGA_SKYPE("CLOSIN X\n", SKYPOPEN_P_LOG); XCloseDisplay(tech_pvt->SkypopenHandles.disp); - NOTICA("CLOSIN X END\n", SKYPOPEN_P_LOG); + DEBUGA_SKYPE("CLOSIN X END\n", SKYPOPEN_P_LOG); } if (globals.SKYPOPEN_INTERFACES[interface_id].skypopen_signaling_thread) { switch_thread_join(&status, globals.SKYPOPEN_INTERFACES[interface_id].skypopen_signaling_thread); @@ -3121,11 +3121,11 @@ struct SkypopenHandles *skypopen_list_remove_by_reference(struct SkypopenList *l switch_mutex_lock(globals.list_mutex); - NOTICA("BEGIN REMOVE\n", SKYPOPEN_P_LOG); + DEBUGA_SKYPE("BEGIN REMOVE\n", SKYPOPEN_P_LOG); if (handle->managed == SWITCH_FALSE) { // already removed switch_mutex_unlock(globals.list_mutex); - NOTICA("EXIT REMOVE\n", SKYPOPEN_P_LOG); + DEBUGA_SKYPE("EXIT REMOVE\n", SKYPOPEN_P_LOG); return 0; } @@ -3150,7 +3150,7 @@ struct SkypopenHandles *skypopen_list_remove_by_reference(struct SkypopenList *l list->entries--; switch_mutex_unlock(globals.list_mutex); - NOTICA("EXIT REMOVE\n", SKYPOPEN_P_LOG); + DEBUGA_SKYPE("EXIT REMOVE\n", SKYPOPEN_P_LOG); return handle; } diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index 2ea46dc..07c461b 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -1875,7 +1875,7 @@ void *skypopen_do_skypeapi_thread_func(void *obj) running = 0; } - NOTICA("EXITING\n", SKYPOPEN_P_LOG); + DEBUGA_SKYPE("EXITING\n", SKYPOPEN_P_LOG); // CLOUDTREE (Thomas Hazel) #ifndef WIN32 commit 9274deeabbc2f976772cf48a1cd41dc82c430572 Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Tue Oct 26 06:06:05 2010 -0500 skypopen: fixed crash on closing XDisplay before is used by interface shutdown/remove diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index 38d47eb..bd9f10c 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -397,6 +397,12 @@ static switch_status_t interface_exists(char *the_interface) switch_yield(50000); } + if (tech_pvt->SkypopenHandles.disp) { + NOTICA("REMOVE CLOSIN X\n", SKYPOPEN_P_LOG); + XCloseDisplay(tech_pvt->SkypopenHandles.disp); + NOTICA("REMOVE CLOSIN X END\n", SKYPOPEN_P_LOG); + } + if (globals.SKYPOPEN_INTERFACES[interface_id].skypopen_signaling_thread) { switch_thread_join(&status, globals.SKYPOPEN_INTERFACES[interface_id].skypopen_signaling_thread); } @@ -1993,6 +1999,11 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypopen_shutdown) x--; switch_yield(50000); } + if (tech_pvt->SkypopenHandles.disp) { + NOTICA("CLOSIN X\n", SKYPOPEN_P_LOG); + XCloseDisplay(tech_pvt->SkypopenHandles.disp); + NOTICA("CLOSIN X END\n", SKYPOPEN_P_LOG); + } if (globals.SKYPOPEN_INTERFACES[interface_id].skypopen_signaling_thread) { switch_thread_join(&status, globals.SKYPOPEN_INTERFACES[interface_id].skypopen_signaling_thread); } @@ -3106,11 +3117,15 @@ struct SkypopenHandles *skypopen_list_remove_by_value(struct SkypopenList *list, // CLOUDTREE (THomas Hazel) - is there a capable freeswitch list? struct SkypopenHandles *skypopen_list_remove_by_reference(struct SkypopenList *list, struct SkypopenHandles *handle) { + private_t *tech_pvt=NULL; + switch_mutex_lock(globals.list_mutex); + NOTICA("BEGIN REMOVE\n", SKYPOPEN_P_LOG); if (handle->managed == SWITCH_FALSE) { // already removed switch_mutex_unlock(globals.list_mutex); + NOTICA("EXIT REMOVE\n", SKYPOPEN_P_LOG); return 0; } @@ -3135,6 +3150,7 @@ struct SkypopenHandles *skypopen_list_remove_by_reference(struct SkypopenList *l list->entries--; switch_mutex_unlock(globals.list_mutex); + NOTICA("EXIT REMOVE\n", SKYPOPEN_P_LOG); return handle; } diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index 0dc34b7..2ea46dc 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -1883,7 +1883,7 @@ void *skypopen_do_skypeapi_thread_func(void *obj) #endif tech_pvt->skypopen_api_thread = NULL; - XCloseDisplay(disp); + //XCloseDisplay(disp); return NULL; } commit 7d7f23cebbf490db04e9baa93d61477d24c5eba9 Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Tue Oct 26 05:07:22 2010 -0500 skypopen: indented diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index 62461de..38d47eb 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -172,7 +172,7 @@ int running = 0; // CLOUDTREE (THomas Hazel) #ifndef WIN32 struct SkypopenList global_handles_list; -extern int xio_error_handler(Display *dpy); +extern int xio_error_handler(Display * dpy); extern int X11_errors_handler(Display * dpy, XErrorEvent * err); #endif @@ -204,9 +204,9 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id); static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id); static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig); -static switch_status_t skypopen_tech_init(private_t * tech_pvt, switch_core_session_t *session); +static switch_status_t skypopen_tech_init(private_t *tech_pvt, switch_core_session_t *session); -static switch_status_t skypopen_codec(private_t * tech_pvt, int sample_rate, int codec_ms) +static switch_status_t skypopen_codec(private_t *tech_pvt, int sample_rate, int codec_ms) { switch_core_session_t *session = NULL; @@ -243,7 +243,7 @@ static switch_status_t skypopen_codec(private_t * tech_pvt, int sample_rate, int } -switch_status_t skypopen_tech_init(private_t * tech_pvt, switch_core_session_t *session) +switch_status_t skypopen_tech_init(private_t *tech_pvt, switch_core_session_t *session) { switch_assert(tech_pvt != NULL); @@ -349,7 +349,7 @@ static switch_status_t interface_exists(char *the_interface) goto end; } - if (/* CLOUDTREE (Thomas Hazel) */ (force == FALSE) && strlen(globals.SKYPOPEN_INTERFACES[interface_id].session_uuid_str)) { + if ( /* CLOUDTREE (Thomas Hazel) */ (force == FALSE) && strlen(globals.SKYPOPEN_INTERFACES[interface_id].session_uuid_str)) { DEBUGA_SKYPE("interface '%s' is busy\n", SKYPOPEN_P_LOG, the_interface); goto end; } @@ -376,8 +376,8 @@ static switch_status_t interface_exists(char *the_interface) if (tech_pvt->running && tech_pvt->SkypopenHandles.disp) { XEvent e; Atom atom1 = XInternAtom(tech_pvt->SkypopenHandles.disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False); - switch_sleep(1000);//giovanni - XFlush(tech_pvt->SkypopenHandles.disp); //giovanni + switch_sleep(1000); //giovanni + XFlush(tech_pvt->SkypopenHandles.disp); //giovanni memset(&e, 0, sizeof(e)); e.xclient.type = ClientMessage; e.xclient.message_type = atom1; /* leading message */ @@ -387,7 +387,7 @@ static switch_status_t interface_exists(char *the_interface) XSendEvent(tech_pvt->SkypopenHandles.disp, tech_pvt->SkypopenHandles.win, False, 0, &e); //giovanni XSync(tech_pvt->SkypopenHandles.disp, False); - XFlush(tech_pvt->SkypopenHandles.disp); //giovanni + XFlush(tech_pvt->SkypopenHandles.disp); //giovanni } #endif } @@ -470,42 +470,42 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session) switch_core_codec_destroy(&tech_pvt->write_codec); } - if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next){ + if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next) { switch_core_timer_destroy(&tech_pvt->timer_read); } - if (tech_pvt->timer_write.timer_interface && tech_pvt->timer_write.timer_interface->timer_next){ + if (tech_pvt->timer_write.timer_interface && tech_pvt->timer_write.timer_interface->timer_next) { switch_core_timer_destroy(&tech_pvt->timer_write); } - if(tech_pvt->read_buffer){ + if (tech_pvt->read_buffer) { switch_buffer_destroy(&tech_pvt->read_buffer); } - if(tech_pvt->write_buffer){ + if (tech_pvt->write_buffer) { switch_buffer_destroy(&tech_pvt->write_buffer); } - DEBUGA_SKYPE("debugging_hangup 13\n", SKYPOPEN_P_LOG); - switch_mutex_lock(tech_pvt->mutex_thread_audio_cli); - DEBUGA_SKYPE("debugging_hangup cli lock\n", SKYPOPEN_P_LOG); - if (tech_pvt->tcp_cli_thread) { - DEBUGA_SKYPE("debugging_hangup 14\n", SKYPOPEN_P_LOG); - switch_thread_join(&status, tech_pvt->tcp_cli_thread); - tech_pvt->tcp_cli_thread = NULL; - DEBUGA_SKYPE("debugging_hangup 15\n", SKYPOPEN_P_LOG); - } - switch_mutex_unlock(tech_pvt->mutex_thread_audio_cli); - DEBUGA_SKYPE("debugging_hangup cli unlock\n", SKYPOPEN_P_LOG); - switch_mutex_lock(tech_pvt->mutex_thread_audio_srv); - DEBUGA_SKYPE("debugging_hangup srv lock\n", SKYPOPEN_P_LOG); - if (tech_pvt->tcp_srv_thread) { - DEBUGA_SKYPE("debugging_hangup 16\n", SKYPOPEN_P_LOG); - switch_thread_join(&status, tech_pvt->tcp_srv_thread); - tech_pvt->tcp_srv_thread = NULL; - DEBUGA_SKYPE("debugging_hangup 17\n", SKYPOPEN_P_LOG); - } - switch_mutex_unlock(tech_pvt->mutex_thread_audio_srv); - DEBUGA_SKYPE("debugging_hangup srv unlock\n", SKYPOPEN_P_LOG); - DEBUGA_SKYPE("debugging_hangup 18\n", SKYPOPEN_P_LOG); + DEBUGA_SKYPE("debugging_hangup 13\n", SKYPOPEN_P_LOG); + switch_mutex_lock(tech_pvt->mutex_thread_audio_cli); + DEBUGA_SKYPE("debugging_hangup cli lock\n", SKYPOPEN_P_LOG); + if (tech_pvt->tcp_cli_thread) { + DEBUGA_SKYPE("debugging_hangup 14\n", SKYPOPEN_P_LOG); + switch_thread_join(&status, tech_pvt->tcp_cli_thread); + tech_pvt->tcp_cli_thread = NULL; + DEBUGA_SKYPE("debugging_hangup 15\n", SKYPOPEN_P_LOG); + } + switch_mutex_unlock(tech_pvt->mutex_thread_audio_cli); + DEBUGA_SKYPE("debugging_hangup cli unlock\n", SKYPOPEN_P_LOG); + switch_mutex_lock(tech_pvt->mutex_thread_audio_srv); + DEBUGA_SKYPE("debugging_hangup srv lock\n", SKYPOPEN_P_LOG); + if (tech_pvt->tcp_srv_thread) { + DEBUGA_SKYPE("debugging_hangup 16\n", SKYPOPEN_P_LOG); + switch_thread_join(&status, tech_pvt->tcp_srv_thread); + tech_pvt->tcp_srv_thread = NULL; + DEBUGA_SKYPE("debugging_hangup 17\n", SKYPOPEN_P_LOG); + } + switch_mutex_unlock(tech_pvt->mutex_thread_audio_srv); + DEBUGA_SKYPE("debugging_hangup srv unlock\n", SKYPOPEN_P_LOG); + DEBUGA_SKYPE("debugging_hangup 18\n", SKYPOPEN_P_LOG); *tech_pvt->session_uuid_str = '\0'; tech_pvt->interface_state = SKYPOPEN_STATE_IDLE; @@ -538,73 +538,72 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session) DEBUGA_SKYPE("debugging_hangup 1\n", SKYPOPEN_P_LOG); - if(tech_pvt){ - if (!switch_channel_test_flag(channel, CF_ANSWERED)) { - if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { - tech_pvt->ob_failed_calls++; - } else { - tech_pvt->ib_failed_calls++; + if (tech_pvt) { + if (!switch_channel_test_flag(channel, CF_ANSWERED)) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { + tech_pvt->ob_failed_calls++; + } else { + tech_pvt->ib_failed_calls++; + } } - } - switch_clear_flag(tech_pvt, TFLAG_IO); - switch_clear_flag(tech_pvt, TFLAG_VOICE); + switch_clear_flag(tech_pvt, TFLAG_IO); + switch_clear_flag(tech_pvt, TFLAG_VOICE); - DEBUGA_SKYPE("debugging_hangup 2\n", SKYPOPEN_P_LOG); - tech_pvt->interface_state = SKYPOPEN_STATE_HANGUP_REQUESTED; - - if (strlen(tech_pvt->skype_call_id)) { - DEBUGA_SKYPE("hanging up skype call: %s\n", SKYPOPEN_P_LOG, tech_pvt->skype_call_id); - sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->skype_call_id); - skypopen_signaling_write(tech_pvt, msg_to_skype); - sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id); - skypopen_signaling_write(tech_pvt, msg_to_skype); - } + DEBUGA_SKYPE("debugging_hangup 2\n", SKYPOPEN_P_LOG); + tech_pvt->interface_state = SKYPOPEN_STATE_HANGUP_REQUESTED; + if (strlen(tech_pvt->skype_call_id)) { + DEBUGA_SKYPE("hanging up skype call: %s\n", SKYPOPEN_P_LOG, tech_pvt->skype_call_id); + sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->skype_call_id); + skypopen_signaling_write(tech_pvt, msg_to_skype); + sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id); + skypopen_signaling_write(tech_pvt, msg_to_skype); + } #if 0 - switch_sleep(1500000); //XXX 1.5 seconds, let's the audio tcp threads die XXX - //FIXME must not allow using the tech_pvt while this sleeps, so must implement a check on interface_state - - DEBUGA_SKYPE("debugging_hangup 3\n", SKYPOPEN_P_LOG); - switch_mutex_lock(tech_pvt->mutex_thread_audio_cli); - DEBUGA_SKYPE("debugging_hangup cli lock\n", SKYPOPEN_P_LOG); - if (tech_pvt->tcp_cli_thread) { - DEBUGA_SKYPE("debugging_hangup 4\n", SKYPOPEN_P_LOG); - switch_thread_join(&status, tech_pvt->tcp_cli_thread); - tech_pvt->tcp_cli_thread = NULL; - DEBUGA_SKYPE("debugging_hangup 5\n", SKYPOPEN_P_LOG); - } - switch_mutex_unlock(tech_pvt->mutex_thread_audio_cli); - DEBUGA_SKYPE("debugging_hangup cli unlock\n", SKYPOPEN_P_LOG); - switch_mutex_lock(tech_pvt->mutex_thread_audio_srv); - DEBUGA_SKYPE("debugging_hangup srv lock\n", SKYPOPEN_P_LOG); - if (tech_pvt->tcp_srv_thread) { - DEBUGA_SKYPE("debugging_hangup 6\n", SKYPOPEN_P_LOG); - switch_thread_join(&status, tech_pvt->tcp_srv_thread); - tech_pvt->tcp_srv_thread = NULL; - DEBUGA_SKYPE("debugging_hangup 7\n", SKYPOPEN_P_LOG); - } - switch_mutex_unlock(tech_pvt->mutex_thread_audio_srv); - DEBUGA_SKYPE("debugging_hangup srv unlock\n", SKYPOPEN_P_LOG); - DEBUGA_SKYPE("debugging_hangup 8\n", SKYPOPEN_P_LOG); -#endif//0 - DEBUGA_SKYPE("%s CHANNEL HANGUP\n", SKYPOPEN_P_LOG, tech_pvt->name); - switch_mutex_lock(globals.mutex); - globals.calls--; - if (globals.calls < 0) { - globals.calls = 0; - } + switch_sleep(1500000); //XXX 1.5 seconds, let's the audio tcp threads die XXX + //FIXME must not allow using the tech_pvt while this sleeps, so must implement a check on interface_state + + DEBUGA_SKYPE("debugging_hangup 3\n", SKYPOPEN_P_LOG); + switch_mutex_lock(tech_pvt->mutex_thread_audio_cli); + DEBUGA_SKYPE("debugging_hangup cli lock\n", SKYPOPEN_P_LOG); + if (tech_pvt->tcp_cli_thread) { + DEBUGA_SKYPE("debugging_hangup 4\n", SKYPOPEN_P_LOG); + switch_thread_join(&status, tech_pvt->tcp_cli_thread); + tech_pvt->tcp_cli_thread = NULL; + DEBUGA_SKYPE("debugging_hangup 5\n", SKYPOPEN_P_LOG); + } + switch_mutex_unlock(tech_pvt->mutex_thread_audio_cli); + DEBUGA_SKYPE("debugging_hangup cli unlock\n", SKYPOPEN_P_LOG); + switch_mutex_lock(tech_pvt->mutex_thread_audio_srv); + DEBUGA_SKYPE("debugging_hangup srv lock\n", SKYPOPEN_P_LOG); + if (tech_pvt->tcp_srv_thread) { + DEBUGA_SKYPE("debugging_hangup 6\n", SKYPOPEN_P_LOG); + switch_thread_join(&status, tech_pvt->tcp_srv_thread); + tech_pvt->tcp_srv_thread = NULL; + DEBUGA_SKYPE("debugging_hangup 7\n", SKYPOPEN_P_LOG); + } + switch_mutex_unlock(tech_pvt->mutex_thread_audio_srv); + DEBUGA_SKYPE("debugging_hangup srv unlock\n", SKYPOPEN_P_LOG); + DEBUGA_SKYPE("debugging_hangup 8\n", SKYPOPEN_P_LOG); +#endif //0 + DEBUGA_SKYPE("%s CHANNEL HANGUP\n", SKYPOPEN_P_LOG, tech_pvt->name); + switch_mutex_lock(globals.mutex); + globals.calls--; + if (globals.calls < 0) { + globals.calls = 0; + } - DEBUGA_SKYPE("debugging_hangup 9\n", SKYPOPEN_P_LOG); - tech_pvt->interface_state = SKYPOPEN_STATE_IDLE; - if (tech_pvt->skype_callflow == CALLFLOW_STATUS_FINISHED) { - tech_pvt->skype_callflow = CALLFLOW_CALL_IDLE; - } - DEBUGA_SKYPE("debugging_hangup 10\n", SKYPOPEN_P_LOG); - switch_mutex_unlock(globals.mutex); - }else{ + DEBUGA_SKYPE("debugging_hangup 9\n", SKYPOPEN_P_LOG); + tech_pvt->interface_state = SKYPOPEN_STATE_IDLE; + if (tech_pvt->skype_callflow == CALLFLOW_STATUS_FINISHED) { + tech_pvt->skype_callflow = CALLFLOW_CALL_IDLE; + } + DEBUGA_SKYPE("debugging_hangup 10\n", SKYPOPEN_P_LOG); + switch_mutex_unlock(globals.mutex); + } else { WARNINGA("FYI %s CHANNEL has no tech_pvt in his private\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); - DEBUGA_SKYPE("debugging_hangup 11\n", SKYPOPEN_P_LOG); + DEBUGA_SKYPE("debugging_hangup 11\n", SKYPOPEN_P_LOG); } DEBUGA_SKYPE("debugging_hangup 12\n", SKYPOPEN_P_LOG); @@ -656,46 +655,47 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int tech_pvt = switch_core_session_get_private(session); //DEBUGA_SKYPE("%s CHANNEL KILL_CHANNEL\n", SKYPOPEN_P_LOG, tech_pvt->name); - if(tech_pvt){ - switch (sig) { - case SWITCH_SIG_KILL: - switch_mutex_lock(tech_pvt->flag_mutex); - DEBUGA_SKYPE("%s CHANNEL got SWITCH_SIG_KILL\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); - if (tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD) { - DEBUGA_SKYPE("FYI %s CHANNEL in CALLFLOW_STATUS_REMOTEHOLD got SWITCH_SIG_KILL\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); - } - if (switch_channel_get_state(channel) == CS_NEW) { - WARNINGA("FYI %s CHANNEL in CS_NEW state got SWITCH_SIG_KILL\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); - } - if (switch_channel_get_state(channel) != CS_NEW && switch_channel_get_state(channel) < CS_EXECUTE) { - WARNINGA("FYI %s CHANNEL in %d state got SWITCH_SIG_KILL\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel), switch_channel_get_state(channel)); - } - switch_clear_flag(tech_pvt, TFLAG_IO); - switch_clear_flag(tech_pvt, TFLAG_VOICE); - switch_set_flag(tech_pvt, TFLAG_HANGUP); - if(switch_test_flag(tech_pvt, TFLAG_PROGRESS)){ - switch_clear_flag(tech_pvt, TFLAG_PROGRESS); + if (tech_pvt) { + switch (sig) { + case SWITCH_SIG_KILL: + switch_mutex_lock(tech_pvt->flag_mutex); + DEBUGA_SKYPE("%s CHANNEL got SWITCH_SIG_KILL\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); + if (tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD) { + DEBUGA_SKYPE("FYI %s CHANNEL in CALLFLOW_STATUS_REMOTEHOLD got SWITCH_SIG_KILL\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); + } + if (switch_channel_get_state(channel) == CS_NEW) { + WARNINGA("FYI %s CHANNEL in CS_NEW state got SWITCH_SIG_KILL\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); + } + if (switch_channel_get_state(channel) != CS_NEW && switch_channel_get_state(channel) < CS_EXECUTE) { + WARNINGA("FYI %s CHANNEL in %d state got SWITCH_SIG_KILL\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel), + switch_channel_get_state(channel)); + } + switch_clear_flag(tech_pvt, TFLAG_IO); + switch_clear_flag(tech_pvt, TFLAG_VOICE); + switch_set_flag(tech_pvt, TFLAG_HANGUP); + if (switch_test_flag(tech_pvt, TFLAG_PROGRESS)) { + switch_clear_flag(tech_pvt, TFLAG_PROGRESS); + } + switch_mutex_unlock(tech_pvt->flag_mutex); + sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->ring_id); + skypopen_signaling_write(tech_pvt, msg_to_skype); + sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->ring_id); + skypopen_signaling_write(tech_pvt, msg_to_skype); + sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->skype_call_id); + skypopen_signaling_write(tech_pvt, msg_to_skype); + sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id); + skypopen_signaling_write(tech_pvt, msg_to_skype); + break; + case SWITCH_SIG_BREAK: + DEBUGA_SKYPE("%s CHANNEL got SWITCH_SIG_BREAK\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); + switch_mutex_lock(tech_pvt->flag_mutex); + switch_set_flag(tech_pvt, TFLAG_BREAK); + switch_mutex_unlock(tech_pvt->flag_mutex); + break; + default: + break; } - switch_mutex_unlock(tech_pvt->flag_mutex); - sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->ring_id); - skypopen_signaling_write(tech_pvt, msg_to_skype); - sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->ring_id); - skypopen_signaling_write(tech_pvt, msg_to_skype); - sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->skype_call_id); - skypopen_signaling_write(tech_pvt, msg_to_skype); - sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id); - skypopen_signaling_write(tech_pvt, msg_to_skype); - break; - case SWITCH_SIG_BREAK: - DEBUGA_SKYPE("%s CHANNEL got SWITCH_SIG_BREAK\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); - switch_mutex_lock(tech_pvt->flag_mutex); - switch_set_flag(tech_pvt, TFLAG_BREAK); - switch_mutex_unlock(tech_pvt->flag_mutex); - break; - default: - break; - } - }else{ + } else { WARNINGA("FYI %s CHANNEL has no tech_pvt in his private\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); } @@ -741,7 +741,7 @@ static switch_status_t channel_on_reset(switch_core_session_t *session) ERRORA("No session???\n", SKYPOPEN_P_LOG); } if (channel) { - switch_channel_set_state(channel, CS_HANGUP); + switch_channel_set_state(channel, CS_HANGUP); } else { ERRORA("No channel???\n", SKYPOPEN_P_LOG); } @@ -775,7 +775,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch unsigned int i; unsigned int a; size_t bytes_read = 0; - int try=0; + int try = 0; *frame = NULL; @@ -815,17 +815,17 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch - if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next){ + if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next) { switch_core_timer_next(&tech_pvt->timer_read); } -read: + read: if (tech_pvt && tech_pvt->interface_state != SKYPOPEN_STATE_DOWN - && (tech_pvt->skype_callflow == CALLFLOW_STATUS_INPROGRESS - || tech_pvt->skype_callflow == CALLFLOW_STATUS_EARLYMEDIA - || tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD || tech_pvt->skype_callflow == SKYPOPEN_STATE_UP)) { + && (tech_pvt->skype_callflow == CALLFLOW_STATUS_INPROGRESS + || tech_pvt->skype_callflow == CALLFLOW_STATUS_EARLYMEDIA + || tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD || tech_pvt->skype_callflow == SKYPOPEN_STATE_UP)) { switch_mutex_lock(tech_pvt->mutex_audio_srv); if (tech_pvt->read_buffer && switch_buffer_inuse(tech_pvt->read_buffer)) { bytes_read = switch_buffer_read(tech_pvt->read_buffer, tech_pvt->read_frame.data, 640); @@ -833,11 +833,11 @@ read: } switch_mutex_unlock(tech_pvt->mutex_audio_srv); - try=0; + try = 0; if (!bytes_read) { switch_sleep(1000); try++; - if(try < 5) + if (try < 5) goto read; DEBUGA_SKYPE("skypopen_audio_read Silence\n", SKYPOPEN_P_LOG); memset(tech_pvt->read_frame.data, 255, SAMPLES_PER_FRAME * sizeof(short)); @@ -935,7 +935,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc { switch_channel_t *channel = NULL; private_t *tech_pvt = NULL; - int no_space=0; + int no_space = 0; channel = switch_core_session_get_channel(session); switch_assert(channel != NULL); @@ -973,13 +973,13 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc DEBUGA_SKYPE("NO SPACE WRITE: %d\n", SKYPOPEN_P_LOG, frame->datalen); //switch_buffer_toss(tech_pvt->write_buffer, frame->datalen); switch_buffer_zero(tech_pvt->write_buffer); - no_space=1; + no_space = 1; } switch_buffer_write(tech_pvt->write_buffer, frame->data, frame->datalen); switch_mutex_unlock(tech_pvt->mutex_audio_cli); - if(no_space){ + if (no_space) { switch_sleep(20000); - }else{ + } else { tech_pvt->begin_to_write = 1; } @@ -1001,13 +1001,13 @@ static switch_status_t channel_answer_channel(switch_core_session_t *session) switch_clear_flag(tech_pvt, TFLAG_IO); skypopen_answer(tech_pvt); - while(!switch_test_flag(tech_pvt, TFLAG_IO)){ //FIXME that would be better with a timeout - if(switch_channel_get_state(channel) == CS_RESET){ + while (!switch_test_flag(tech_pvt, TFLAG_IO)) { //FIXME that would be better with a timeout + if (switch_channel_get_state(channel) == CS_RESET) { return SWITCH_STATUS_FALSE; } switch_sleep(5000); conta++; - if(conta == 100){ //0.5 seconds + if (conta == 100) { //0.5 seconds return SWITCH_STATUS_FALSE; } } @@ -1025,7 +1025,7 @@ static switch_status_t channel_answer_channel(switch_core_session_t *session) return SWITCH_STATUS_SUCCESS; } -static switch_status_t channel_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg) +static switch_status_t channel_receive_message(switch_core_session_t *session, switch_core_session_message_t * msg) { switch_channel_t *channel; private_t *tech_pvt; @@ -1048,15 +1048,15 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s case SWITCH_MESSAGE_INDICATE_CLEAR_PROGRESS: { DEBUGA_SKYPE("%s CHANNEL got SWITCH_MESSAGE_INDICATE_CLEAR_PROGRESS\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); - if(switch_set_flag(tech_pvt, TFLAG_PROGRESS)){ + if (switch_set_flag(tech_pvt, TFLAG_PROGRESS)) { sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->ring_id); skypopen_signaling_write(tech_pvt, msg_to_skype); sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->ring_id); skypopen_signaling_write(tech_pvt, msg_to_skype); - sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->skype_call_id); - skypopen_signaling_write(tech_pvt, msg_to_skype); - sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id); - skypopen_signaling_write(tech_pvt, msg_to_skype); + sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->skype_call_id); + skypopen_signaling_write(tech_pvt, msg_to_skype); + sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id); + skypopen_signaling_write(tech_pvt, msg_to_skype); switch_clear_flag(tech_pvt, TFLAG_PROGRESS); } } @@ -1064,25 +1064,25 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s case SWITCH_MESSAGE_INDICATE_ANSWER: { - DEBUGA_SKYPE("%s CHANNEL got SWITCH_MESSAGE_INDICATE_ANSWER\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); + DEBUGA_SKYPE("%s CHANNEL got SWITCH_MESSAGE_INDICATE_ANSWER\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); //switch_set_flag(tech_pvt, TFLAG_IO); channel_answer_channel(session); switch_clear_flag(tech_pvt, TFLAG_PROGRESS); - if(tech_pvt->read_buffer){ + if (tech_pvt->read_buffer) { switch_mutex_lock(tech_pvt->mutex_audio_srv); switch_buffer_zero(tech_pvt->read_buffer); - if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next){ + if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next) { switch_core_timer_sync(&tech_pvt->timer_read); } switch_mutex_unlock(tech_pvt->mutex_audio_srv); } - if(tech_pvt->write_buffer){ + if (tech_pvt->write_buffer) { switch_mutex_lock(tech_pvt->mutex_audio_cli); switch_buffer_zero(tech_pvt->write_buffer); - if (tech_pvt->timer_write.timer_interface && tech_pvt->timer_write.timer_interface->timer_next){ + if (tech_pvt->timer_write.timer_interface && tech_pvt->timer_write.timer_interface->timer_next) { switch_core_timer_sync(&tech_pvt->timer_write); } switch_mutex_unlock(tech_pvt->mutex_audio_cli); @@ -1095,46 +1095,46 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s DEBUGA_SKYPE("%s CHANNEL got SWITCH_MESSAGE_INDICATE_AUDIO_SYNC\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); - if(tech_pvt->read_buffer){ - switch_mutex_lock(tech_pvt->mutex_audio_srv); - switch_buffer_zero(tech_pvt->read_buffer); - if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next){ - switch_core_timer_sync(&tech_pvt->timer_read); - } - switch_mutex_unlock(tech_pvt->mutex_audio_srv); + if (tech_pvt->read_buffer) { + switch_mutex_lock(tech_pvt->mutex_audio_srv); + switch_buffer_zero(tech_pvt->read_buffer); + if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next) { + switch_core_timer_sync(&tech_pvt->timer_read); } + switch_mutex_unlock(tech_pvt->mutex_audio_srv); + } - if(tech_pvt->write_buffer){ - switch_mutex_lock(tech_pvt->mutex_audio_cli); - switch_buffer_zero(tech_pvt->write_buffer); - if (tech_pvt->timer_write.timer_interface && tech_pvt->timer_write.timer_interface->timer_next){ - switch_core_timer_sync(&tech_pvt->timer_write); - } - switch_mutex_unlock(tech_pvt->mutex_audio_cli); + if (tech_pvt->write_buffer) { + switch_mutex_lock(tech_pvt->mutex_audio_cli); + switch_buffer_zero(tech_pvt->write_buffer); + if (tech_pvt->timer_write.timer_interface && tech_pvt->timer_write.timer_interface->timer_next) { + switch_core_timer_sync(&tech_pvt->timer_write); } - DEBUGA_SKYPE("Synching audio\n", SKYPOPEN_P_LOG); + switch_mutex_unlock(tech_pvt->mutex_audio_cli); + } + DEBUGA_SKYPE("Synching audio\n", SKYPOPEN_P_LOG); break; case SWITCH_MESSAGE_INDICATE_BRIDGE: DEBUGA_SKYPE("%s CHANNEL got SWITCH_MESSAGE_INDICATE_BRIDGE\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); - if(tech_pvt->read_buffer){ - switch_mutex_lock(tech_pvt->mutex_audio_srv); - switch_buffer_zero(tech_pvt->read_buffer); - if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next){ - switch_core_timer_sync(&tech_pvt->timer_read); - } - switch_mutex_unlock(tech_pvt->mutex_audio_srv); + if (tech_pvt->read_buffer) { + switch_mutex_lock(tech_pvt->mutex_audio_srv); + switch_buffer_zero(tech_pvt->read_buffer); + if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next) { + switch_core_timer_sync(&tech_pvt->timer_read); } + switch_mutex_unlock(tech_pvt->mutex_audio_srv); + } - if(tech_pvt->write_buffer){ - switch_mutex_lock(tech_pvt->mutex_audio_cli); - switch_buffer_zero(tech_pvt->write_buffer); - if (tech_pvt->timer_write.timer_interface && tech_pvt->timer_write.timer_interface->timer_next){ - switch_core_timer_sync(&tech_pvt->timer_write); - } - switch_mutex_unlock(tech_pvt->mutex_audio_cli); + if (tech_pvt->write_buffer) { + switch_mutex_lock(tech_pvt->mutex_audio_cli); + switch_buffer_zero(tech_pvt->write_buffer); + if (tech_pvt->timer_write.timer_interface && tech_pvt->timer_write.timer_interface->timer_next) { + switch_core_timer_sync(&tech_pvt->timer_write); } - DEBUGA_SKYPE("Synching audio\n", SKYPOPEN_P_LOG); + switch_mutex_unlock(tech_pvt->mutex_audio_cli); + } + DEBUGA_SKYPE("Synching audio\n", SKYPOPEN_P_LOG); break; default: @@ -1322,7 +1322,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi * \brief This thread runs during a call, and monitor the interface for signaling, like hangup, caller id, etc most of signaling is handled inside the skypopen_signaling_read function * */ -static void *SWITCH_THREAD_FUNC skypopen_signaling_thread_func(switch_thread_t * thread, void *obj) +static void *SWITCH_THREAD_FUNC skypopen_signaling_thread_func(switch_thread_t *thread, void *obj) { private_t *tech_pvt = obj; int res; @@ -1393,7 +1393,7 @@ static void *SWITCH_THREAD_FUNC skypopen_signaling_thread_func(switch_thread_t * } } } - tech_pvt->skypopen_signaling_thread=NULL; + tech_pvt->skypopen_signaling_thread = NULL; DEBUGA_SKYPE("EXITING\n", SKYPOPEN_P_LOG); return NULL; } @@ -1472,22 +1472,22 @@ static switch_status_t load_config(int reload_type) char *setsockopt = "false"; uint32_t interface_id = 0; - if(globals.context) - context=globals.context; - if(globals.dialplan) - dialplan=globals.dialplan; - if(globals.destination) - destination=globals.destination; - if(globals.skype_user) - skype_user=globals.skype_user; - if(globals.report_incoming_chatmessages) - report_incoming_chatmessages=globals.report_incoming_chatmessages; - if(globals.silent_mode) - silent_mode=globals.silent_mode; - if(globals.write_silence_when_idle) - write_silence_when_idle=globals.write_silence_when_idle; - if(globals.setsockopt) - setsockopt=globals.setsockopt; + if (globals.context) + context = globals.context; + if (globals.dialplan) + dialplan = globals.dialplan; + if (globals.destination) + destination = globals.destination; + if (globals.skype_user) + skype_user = globals.skype_user; + if (globals.report_incoming_chatmessages) + report_incoming_chatmessages = globals.report_incoming_chatmessages; + if (globals.silent_mode) + silent_mode = globals.silent_mode; + if (globals.write_silence_when_idle) + write_silence_when_idle = globals.write_silence_when_idle; + if (globals.setsockopt) + setsockopt = globals.setsockopt; tech_pvt = NULL; @@ -1653,7 +1653,8 @@ static switch_status_t load_config(int reload_type) switch_threadattr_detach_set(skypopen_api_thread_attr, 0); switch_threadattr_stacksize_set(skypopen_api_thread_attr, SWITCH_THREAD_STACKSIZE); switch_thread_create(&globals.SKYPOPEN_INTERFACES[interface_id].skypopen_api_thread, - skypopen_api_thread_attr, skypopen_do_skypeapi_thread, &globals.SKYPOPEN_INTERFACES[interface_id], skypopen_module_pool); + skypopen_api_thread_attr, skypopen_do_skypeapi_thread, &globals.SKYPOPEN_INTERFACES[interface_id], + skypopen_module_pool); switch_sleep(100000); @@ -1758,7 +1759,8 @@ static switch_status_t load_config(int reload_type) DEBUGA_SKYPE("i=%d globals.SKYPOPEN_INTERFACES[%d].report_incoming_chatmessages=%d\n", SKYPOPEN_P_LOG, i, i, globals.SKYPOPEN_INTERFACES[i].report_incoming_chatmessages); DEBUGA_SKYPE("i=%d globals.SKYPOPEN_INTERFACES[%d].silent_mode=%d\n", SKYPOPEN_P_LOG, i, i, globals.SKYPOPEN_INTERFACES[i].silent_mode); - DEBUGA_SKYPE("i=%d globals.SKYPOPEN_INTERFACES[%d].write_silence_when_idle=%d\n", SKYPOPEN_P_LOG, i, i, globals.SKYPOPEN_INTERFACES[i].write_silence_when_idle); + DEBUGA_SKYPE("i=%d globals.SKYPOPEN_INTERFACES[%d].write_silence_when_idle=%d\n", SKYPOPEN_P_LOG, i, i, + globals.SKYPOPEN_INTERFACES[i].write_silence_when_idle); DEBUGA_SKYPE("i=%d globals.SKYPOPEN_INTERFACES[%d].setsockopt=%d\n", SKYPOPEN_P_LOG, i, i, globals.SKYPOPEN_INTERFACES[i].setsockopt); } } @@ -1814,7 +1816,8 @@ static switch_status_t chat_send(const char *proto, const char *from, const char if (strlen(globals.SKYPOPEN_INTERFACES[i].name) && (strncmp(globals.SKYPOPEN_INTERFACES[i].name, hint, strlen(hint)) == 0)) { tech_pvt = &globals.SKYPOPEN_INTERFACES[i]; - DEBUGA_SKYPE("Using interface: globals.SKYPOPEN_INTERFACES[%d].name=|||%s|||\n", SKYPOPEN_P_LOG, i, globals.SKYPOPEN_INTERFACES[i].name); + DEBUGA_SKYPE("Using interface: globals.SKYPOPEN_INTERFACES[%d].name=|||%s|||\n", SKYPOPEN_P_LOG, i, + globals.SKYPOPEN_INTERFACES[i].name); found = 1; break; } @@ -1825,7 +1828,8 @@ static switch_status_t chat_send(const char *proto, const char *from, const char if (strlen(globals.SKYPOPEN_INTERFACES[i].name) && (strncmp(globals.SKYPOPEN_INTERFACES[i].skype_user, from, strlen(from)) == 0)) { tech_pvt = &globals.SKYPOPEN_INTERFACES[i]; - DEBUGA_SKYPE("Using interface: globals.SKYPOPEN_INTERFACES[%d].name=|||%s|||\n", SKYPOPEN_P_LOG, i, globals.SKYPOPEN_INTERFACES[i].name); + DEBUGA_SKYPE("Using interface: globals.SKYPOPEN_INTERFACES[%d].name=|||%s|||\n", SKYPOPEN_P_LOG, i, + globals.SKYPOPEN_INTERFACES[i].name); found = 1; break; } @@ -1880,21 +1884,22 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skypopen_load) memset(&globals, '\0', sizeof(globals)); // CLOUDTREE (Thomas Hazel) - #ifndef WIN32 +#ifndef WIN32 // XXX: these assumes no one will override XSetErrorHandler(X11_errors_handler); XSetIOErrorHandler(xio_error_handler); memset(&global_handles_list, 0, sizeof(global_handles_list)); switch_mutex_init(&globals.list_mutex, SWITCH_MUTEX_NESTED, skypopen_module_pool); - #endif +#endif // CLOUDTREE (Thomas Hazel) - load_configs no longer locks things up, no need to fail load - /*if (*/ load_config(FULL_RELOAD); /* != SWITCH_STATUS_SUCCESS) { - running = 0; - return SWITCH_STATUS_FALSE; - } - */ + /*if ( */ load_config(FULL_RELOAD); + /* != SWITCH_STATUS_SUCCESS) { + running = 0; + return SWITCH_STATUS_FALSE; + } + */ // CLOUDTREE (Thomas Hazel) - setting "running = 1;" use to be located before "load_config" running = 1; @@ -1919,7 +1924,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skypopen_load) SWITCH_ADD_API(commands_api_interface, "sk", "Skypopen console commands", sk_function, SK_SYNTAX); SWITCH_ADD_API(commands_api_interface, "skypopen", "Skypopen interface commands", skypopen_function, SKYPOPEN_SYNTAX); - SWITCH_ADD_API(commands_api_interface, "skypopen_chat", "Skypopen_chat interface remote_skypename TEXT", skypopen_chat_function, SKYPOPEN_CHAT_SYNTAX); + SWITCH_ADD_API(commands_api_interface, "skypopen_chat", "Skypopen_chat interface remote_skypename TEXT", skypopen_chat_function, + SKYPOPEN_CHAT_SYNTAX); SWITCH_ADD_CHAT(chat_interface, MDL_CHAT_PROTO, chat_send); /* indicate that the module should continue to be loaded */ @@ -1960,15 +1966,15 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypopen_shutdown) #ifdef WIN32 if (SendMessage(tech_pvt->SkypopenHandles.win32_hInit_MainWindowHandle, WM_DESTROY, 0, 0) == FALSE) { // let's the skypopen_api_thread_func die DEBUGA_SKYPE("got FALSE here, thread probably was already dead. GetLastError returned: %d\n", SKYPOPEN_P_LOG, GetLastError()); - tech_pvt->skypopen_api_thread=NULL; + tech_pvt->skypopen_api_thread = NULL; } #else if (tech_pvt->SkypopenHandles.disp) { XEvent e; Atom atom1 = XInternAtom(tech_pvt->SkypopenHandles.disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False); - switch_sleep(1000);//giovanni - XFlush(tech_pvt->SkypopenHandles.disp); //giovanni + switch_sleep(1000); //giovanni + XFlush(tech_pvt->SkypopenHandles.disp); //giovanni memset(&e, 0, sizeof(e)); e.xclient.type = ClientMessage; e.xclient.message_type = atom1; /* leading message */ @@ -1978,7 +1984,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypopen_shutdown) XSendEvent(tech_pvt->SkypopenHandles.disp, tech_pvt->SkypopenHandles.win, False, 0, &e); //giovanni XSync(tech_pvt->SkypopenHandles.disp, False); - XFlush(tech_pvt->SkypopenHandles.disp); //giovanni + XFlush(tech_pvt->SkypopenHandles.disp); //giovanni } #endif } @@ -2030,22 +2036,22 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypopen_shutdown) return SWITCH_STATUS_SUCCESS; } -void *SWITCH_THREAD_FUNC skypopen_do_tcp_srv_thread(switch_thread_t * thread, void *obj) +void *SWITCH_THREAD_FUNC skypopen_do_tcp_srv_thread(switch_thread_t *thread, void *obj) { return skypopen_do_tcp_srv_thread_func(obj); } -void *SWITCH_THREAD_FUNC skypopen_do_tcp_cli_thread(switch_thread_t * thread, void *obj) +void *SWITCH_THREAD_FUNC skypopen_do_tcp_cli_thread(switch_thread_t *thread, void *obj) { return skypopen_do_tcp_cli_thread_func(obj); } -void *SWITCH_THREAD_FUNC skypopen_do_skypeapi_thread(switch_thread_t * thread, void *obj) +void *SWITCH_THREAD_FUNC skypopen_do_skypeapi_thread(switch_thread_t *thread, void *obj) { return skypopen_do_skypeapi_thread_func(obj); } -int dtmf_received(private_t * tech_pvt, char *value) +int dtmf_received(private_t *tech_pvt, char *value) { switch_core_session_t *session = NULL; switch_channel_t *channel = NULL; @@ -2082,7 +2088,7 @@ int dtmf_received(private_t * tech_pvt, char *value) return 0; } -int start_audio_threads(private_t * tech_pvt) +int start_audio_threads(private_t *tech_pvt) { switch_threadattr_t *thd_attr = NULL; @@ -2113,7 +2119,7 @@ int start_audio_threads(private_t * tech_pvt) } else { ERRORA("failed to start tcp_srv_thread thread.\n", SKYPOPEN_P_LOG); switch_mutex_unlock(tech_pvt->mutex_thread_audio_srv); - DEBUGA_SKYPE("debugging_hangup srv unlock\n", SKYPOPEN_P_LOG); + DEBUGA_SKYPE("debugging_hangup srv unlock\n", SKYPOPEN_P_LOG); return -1; } switch_mutex_unlock(tech_pvt->mutex_thread_audio_srv); @@ -2129,7 +2135,7 @@ int start_audio_threads(private_t * tech_pvt) } else { ERRORA("failed to start tcp_cli_thread thread.\n", SKYPOPEN_P_LOG); switch_mutex_unlock(tech_pvt->mutex_thread_audio_cli); - DEBUGA_SKYPE("debugging_hangup cli unlock\n", SKYPOPEN_P_LOG); + DEBUGA_SKYPE("debugging_hangup cli unlock\n", SKYPOPEN_P_LOG); return -1; } switch_mutex_unlock(tech_pvt->mutex_thread_audio_cli); @@ -2144,7 +2150,7 @@ int start_audio_threads(private_t * tech_pvt) return 0; } -int new_inbound_channel(private_t * tech_pvt) +int new_inbound_channel(private_t *tech_pvt) { switch_core_session_t *session = NULL; switch_channel_t *channel = NULL; @@ -2191,7 +2197,7 @@ int new_inbound_channel(private_t * tech_pvt) return 0; } -int remote_party_is_ringing(private_t * tech_pvt) +int remote_party_is_ringing(private_t *tech_pvt) { switch_core_session_t *session = NULL; switch_channel_t *channel = NULL; @@ -2222,7 +2228,7 @@ int remote_party_is_ringing(private_t * tech_pvt) return 0; } -int remote_party_is_early_media(private_t * tech_pvt) +int remote_party_is_early_media(private_t *tech_pvt) { switch_core_session_t *session = NULL; switch_channel_t *channel = NULL; @@ -2253,7 +2259,7 @@ int remote_party_is_early_media(private_t * tech_pvt) return 0; } -int outbound_channel_answered(private_t * tech_pvt) +int outbound_channel_answered(private_t *tech_pvt) { switch_core_session_t *session = NULL; switch_channel_t *channel = NULL; @@ -2284,7 +2290,7 @@ int outbound_channel_answered(private_t * tech_pvt) return 0; } -private_t *find_available_skypopen_interface_rr(private_t * tech_pvt_calling) +private_t *find_available_skypopen_interface_rr(private_t *tech_pvt_calling) { private_t *tech_pvt = NULL; int i; @@ -2309,7 +2315,7 @@ private_t *find_available_skypopen_interface_rr(private_t * tech_pvt_calling) //DEBUGA_SKYPE("skype interface: %d, name: %s, state: %d\n", SKYPOPEN_P_LOG, interface_id, globals.SKYPOPEN_INTERFACES[interface_id].name, skype_state); if ((tech_pvt_calling ? strcmp(tech_pvt->skype_user, tech_pvt_calling->skype_user) : 1) && (SKYPOPEN_STATE_DOWN == skype_state || 0 == skype_state) && (tech_pvt->skype_callflow == CALLFLOW_STATUS_FINISHED - || 0 == tech_pvt->skype_callflow)) { + || 0 == tech_pvt->skype_callflow)) { DEBUGA_SKYPE("returning as available skype interface name: %s, state: %d callflow: %d\n", SKYPOPEN_P_LOG, tech_pvt->name, skype_state, tech_pvt->skype_callflow); if (tech_pvt_calling == NULL) { @@ -2495,7 +2501,7 @@ SWITCH_STANDARD_API(skypopen_function) } -int skypopen_partner_handle_ring(private_t * tech_pvt) +int skypopen_partner_handle_ring(private_t *tech_pvt) { char msg_to_skype[1024]; int i; @@ -2518,7 +2524,10 @@ int skypopen_partner_handle_ring(private_t * tech_pvt) giovatech = &globals.SKYPOPEN_INTERFACES[i]; if ((giovatech->interface_state != SKYPOPEN_STATE_DOWN) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user)) && (!strcmp(giovatech->ring_value, value)) && ((((timenow.tv_sec - giovatech->ring_time.tv_sec) * 1000000) + (timenow.tv_usec - giovatech->ring_time.tv_usec)) < 1000000)) { //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds found = 1; - DEBUGA_SKYPE ("FOUND (name=%s, giovatech->interface_state=%d != SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n", SKYPOPEN_P_LOG, giovatech->name, giovatech->interface_state, giovatech->skype_user, tech_pvt->skype_user, giovatech->callid_number, value); + DEBUGA_SKYPE + ("FOUND (name=%s, giovatech->interface_state=%d != SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n", + SKYPOPEN_P_LOG, giovatech->name, giovatech->interface_state, giovatech->skype_user, tech_pvt->skype_user, giovatech->callid_number, + value); if (tech_pvt->interface_state == SKYPOPEN_STATE_PRERING) { tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; } else if (tech_pvt->interface_state != 0 && tech_pvt->interface_state != SKYPOPEN_STATE_DOWN) { @@ -2593,7 +2602,7 @@ int skypopen_partner_handle_ring(private_t * tech_pvt) return 0; } -int skypopen_answer(private_t * tech_pvt) +int skypopen_answer(private_t *tech_pvt) { char msg_to_skype[1024]; int i; @@ -2616,7 +2625,10 @@ int skypopen_answer(private_t * tech_pvt) giovatech = &globals.SKYPOPEN_INTERFACES[i]; if (strlen(giovatech->skype_call_id) && (giovatech->interface_state != SKYPOPEN_STATE_DOWN) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user)) && (!strcmp(giovatech->callid_number, value)) && ((((timenow.tv_sec - giovatech->answer_time.tv_sec) * 1000000) + (timenow.tv_usec - giovatech->answer_time.tv_usec)) < 1000000)) { //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds found = 1; - DEBUGA_SKYPE ("FOUND (name=%s, giovatech->interface_state=%d != SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n", SKYPOPEN_P_LOG, giovatech->name, giovatech->interface_state, giovatech->skype_user, tech_pvt->skype_user, giovatech->callid_number, value); + DEBUGA_SKYPE + ("FOUND (name=%s, giovatech->interface_state=%d != SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n", + SKYPOPEN_P_LOG, giovatech->name, giovatech->interface_state, giovatech->skype_user, tech_pvt->skype_user, giovatech->callid_number, + value); if (tech_pvt->interface_state == SKYPOPEN_STATE_PRERING) { tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; } else if (tech_pvt->interface_state != 0 && tech_pvt->interface_state != SKYPOPEN_STATE_DOWN) { @@ -2691,8 +2703,9 @@ int skypopen_answer(private_t * tech_pvt) switch_mutex_unlock(globals.mutex); return 0; } + //int skypopen_transfer(private_t * tech_pvt, char *id, char *value) -int skypopen_transfer(private_t * tech_pvt) +int skypopen_transfer(private_t *tech_pvt) { char msg_to_skype[1024]; int i; @@ -2712,15 +2725,16 @@ int skypopen_transfer(private_t * tech_pvt) /* let's look for a RINGING one */ if ((giovatech->interface_state != SKYPOPEN_STATE_DOWN) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user)) && (!strcmp(giovatech->ring_value, value)) && ((((timenow.tv_sec - giovatech->ring_time.tv_sec) * 1000000) + (timenow.tv_usec - giovatech->ring_time.tv_usec)) < 1000000)) { //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds found = 1; - DEBUGA_SKYPE ("FOUND (name=%s, giovatech->interface_state=%d != SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n", SKYPOPEN_P_LOG, giovatech->name, giovatech->interface_state, giovatech->skype_user, tech_pvt->skype_user, giovatech->callid_number, value); + DEBUGA_SKYPE + ("FOUND (name=%s, giovatech->interface_state=%d != SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n", + SKYPOPEN_P_LOG, giovatech->name, giovatech->interface_state, giovatech->skype_user, tech_pvt->skype_user, giovatech->callid_number, + value); if (tech_pvt->interface_state == SKYPOPEN_STATE_PRERING) { tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; - } - - -#if 0 - - + } +#if 0 + + else if (tech_pvt->interface_state != 0 && tech_pvt->interface_state != SKYPOPEN_STATE_DOWN) { WARNINGA("Why an interface_state %d HERE?\n", SKYPOPEN_P_LOG, tech_pvt->interface_state); tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; @@ -2762,15 +2776,16 @@ int skypopen_transfer(private_t * tech_pvt) /* let's look for a DOWN one */ if ((giovatech->interface_state == SKYPOPEN_STATE_DOWN || giovatech->interface_state == 0) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user))) { //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds found = 1; - DEBUGA_SKYPE ("FOUND (name=%s, giovatech->interface_state=%d == SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n", SKYPOPEN_P_LOG, giovatech->name, giovatech->interface_state, giovatech->skype_user, tech_pvt->skype_user, giovatech->callid_number, value); + DEBUGA_SKYPE + ("FOUND (name=%s, giovatech->interface_state=%d == SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n", + SKYPOPEN_P_LOG, giovatech->name, giovatech->interface_state, giovatech->skype_user, tech_pvt->skype_user, giovatech->callid_number, + value); if (tech_pvt->interface_state == SKYPOPEN_STATE_PRERING) { tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; - } - - -#if 0 - - + } +#if 0 + + else if (tech_pvt->interface_state != 0 && tech_pvt->interface_state != SKYPOPEN_STATE_DOWN) { WARNINGA("Why an interface_state %d HERE?\n", SKYPOPEN_P_LOG, tech_pvt->interface_state); tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; @@ -2872,7 +2887,7 @@ int skypopen_transfer(private_t * tech_pvt) return 0; } -int incoming_chatmessage(private_t * tech_pvt, int which) +int incoming_chatmessage(private_t *tech_pvt, int which) { switch_event_t *event; switch_core_session_t *session = NULL; @@ -3012,7 +3027,7 @@ int next_port(void) #ifndef WIN32 // CLOUDTREE (THomas Hazel) - is there a capable freeswitch list? -struct SkypopenHandles* skypopen_list_add(struct SkypopenList* list, struct SkypopenHandles* handle) +struct SkypopenHandles *skypopen_list_add(struct SkypopenList *list, struct SkypopenHandles *handle) { switch_mutex_lock(globals.list_mutex); @@ -3027,8 +3042,8 @@ struct SkypopenHandles* skypopen_list_add(struct SkypopenList* list, struct Skyp handle->prev = 0; } else { - ((struct SkypopenHandles*) list->tail)->next = handle; - ((struct SkypopenHandles*) handle)->prev = list->tail; + ((struct SkypopenHandles *) list->tail)->next = handle; + ((struct SkypopenHandles *) handle)->prev = list->tail; } list->tail = handle; @@ -3044,36 +3059,36 @@ struct SkypopenHandles* skypopen_list_add(struct SkypopenList* list, struct Skyp } // CLOUDTREE (THomas Hazel) - is there a capable freeswitch list? -struct SkypopenHandles* skypopen_list_remove_by_value(struct SkypopenList* list, Display* display) +struct SkypopenHandles *skypopen_list_remove_by_value(struct SkypopenList *list, Display * display) { - struct SkypopenHandles* iter; - struct SkypopenHandles* handle = 0; + struct SkypopenHandles *iter; + struct SkypopenHandles *handle = 0; switch_mutex_lock(globals.list_mutex); - iter = (struct SkypopenHandles*) list->head; + iter = (struct SkypopenHandles *) list->head; while (iter != 0) { if (iter->disp == display) { handle = iter; break; } - iter = (struct SkypopenHandles*) iter->next; + iter = (struct SkypopenHandles *) iter->next; } if ((handle != 0) && (handle->managed == SWITCH_TRUE)) { if (handle->prev == 0) { - list->head = ((struct SkypopenHandles*) handle)->next; + list->head = ((struct SkypopenHandles *) handle)->next; } else { - ((struct SkypopenHandles*) handle->prev)->next = ((struct SkypopenHandles*) handle)->next; + ((struct SkypopenHandles *) handle->prev)->next = ((struct SkypopenHandles *) handle)->next; } if (handle->next == 0) { - list->tail = ((struct SkypopenHandles*) handle)->prev; + list->tail = ((struct SkypopenHandles *) handle)->prev; } else { - ((struct SkypopenHandles*) handle->next)->prev = ((struct SkypopenHandles*) handle)->prev; + ((struct SkypopenHandles *) handle->next)->prev = ((struct SkypopenHandles *) handle)->prev; } handle->managed = SWITCH_FALSE; @@ -3089,7 +3104,7 @@ struct SkypopenHandles* skypopen_list_remove_by_value(struct SkypopenList* list, } // CLOUDTREE (THomas Hazel) - is there a capable freeswitch list? -struct SkypopenHandles* skypopen_list_remove_by_reference(struct SkypopenList* list, struct SkypopenHandles* handle) +struct SkypopenHandles *skypopen_list_remove_by_reference(struct SkypopenList *list, struct SkypopenHandles *handle) { switch_mutex_lock(globals.list_mutex); @@ -3100,17 +3115,17 @@ struct SkypopenHandles* skypopen_list_remove_by_reference(struct SkypopenList* l } if (handle->prev == 0) { - list->head = ((struct SkypopenHandles*) handle)->next; + list->head = ((struct SkypopenHandles *) handle)->next; } else { - ((struct SkypopenHandles*) handle->prev)->next = ((struct SkypopenHandles*) handle)->next; + ((struct SkypopenHandles *) handle->prev)->next = ((struct SkypopenHandles *) handle)->next; } if (handle->next == 0) { - list->tail = ((struct SkypopenHandles*) handle)->prev; + list->tail = ((struct SkypopenHandles *) handle)->prev; } else { - ((struct SkypopenHandles*) handle->next)->prev = ((struct SkypopenHandles*) handle)->prev; + ((struct SkypopenHandles *) handle->next)->prev = ((struct SkypopenHandles *) handle)->prev; } handle->managed = SWITCH_FALSE; @@ -3126,21 +3141,21 @@ struct SkypopenHandles* skypopen_list_remove_by_reference(struct SkypopenList* l // CLOUDTREE (THomas Hazel) - is there a capable freeswitch list? #ifdef XIO_ERROR_BY_UCONTEXT -struct SkypopenHandles* skypopen_list_find(struct SkypopenList* list, struct SkypopenHandles* find) +struct SkypopenHandles *skypopen_list_find(struct SkypopenList *list, struct SkypopenHandles *find) { - struct SkypopenHandles* iter; - struct SkypopenHandles* handle = NULL; + struct SkypopenHandles *iter; + struct SkypopenHandles *handle = NULL; switch_mutex_lock(globals.list_mutex); - iter = (struct SkypopenHandles*) list->head; + iter = (struct SkypopenHandles *) list->head; while (iter != NULL) { if (iter == find) { handle = iter; break; } - iter = (struct SkypopenHandles*) iter->next; + iter = (struct SkypopenHandles *) iter->next; } switch_mutex_unlock(globals.list_mutex); @@ -3150,7 +3165,7 @@ struct SkypopenHandles* skypopen_list_find(struct SkypopenList* list, struct Sky #endif // CLOUDTREE (THomas Hazel) - is there a capable freeswitch list? -int skypopen_list_size(struct SkypopenList* list) +int skypopen_list_size(struct SkypopenList *list) { return list->entries; } diff --git a/src/mod/endpoints/mod_skypopen/skypopen.h b/src/mod/endpoints/mod_skypopen/skypopen.h index a67bfb2..b49b6a7 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen.h +++ b/src/mod/endpoints/mod_skypopen/skypopen.h @@ -48,11 +48,11 @@ // CLOUDTREE (Thomas Hazel) #ifdef XIO_ERROR_BY_SETJMP - #include "setjmp.h" +#include "setjmp.h" #endif // CLOUDTREE (Thomas Hazel) #ifdef XIO_ERROR_BY_UCONTEXT - #include "ucontext.h" +#include "ucontext.h" #endif #endif //WIN32 @@ -176,32 +176,32 @@ struct SkypopenHandles { int fdesc[2]; // CLOUDTREE (Thomas Hazel) - #ifdef XIO_ERROR_BY_SETJMP - jmp_buf ioerror_context; - #endif - #ifdef XIO_ERROR_BY_UCONTEXT - ucontext_t ioerror_context; - #endif +#ifdef XIO_ERROR_BY_SETJMP + jmp_buf ioerror_context; +#endif +#ifdef XIO_ERROR_BY_UCONTEXT + ucontext_t ioerror_context; +#endif // CLOUDTREE (Thomas Hazel) - is there a capable freeswitch list? switch_bool_t managed; - void* prev; - void* next; + void *prev; + void *next; }; // CLOUDTREE (Thomas Hazel) - is there a capable freeswitch list? struct SkypopenList { int entries; - void* head; - void* tail; + void *head; + void *tail; }; // CLOUDTREE (Thomas Hazel) - is there a capable freeswitch list? -struct SkypopenHandles* skypopen_list_add(struct SkypopenList* list, struct SkypopenHandles* x); -struct SkypopenHandles* skypopen_list_find(struct SkypopenList* list, struct SkypopenHandles* x); -struct SkypopenHandles* skypopen_list_remove_by_value(struct SkypopenList* list, Display* display); -struct SkypopenHandles* skypopen_list_remove_by_reference(struct SkypopenList* list, struct SkypopenHandles* x); -int skypopen_list_size(struct SkypopenList* list); +struct SkypopenHandles *skypopen_list_add(struct SkypopenList *list, struct SkypopenHandles *x); +struct SkypopenHandles *skypopen_list_find(struct SkypopenList *list, struct SkypopenHandles *x); +struct SkypopenHandles *skypopen_list_remove_by_value(struct SkypopenList *list, Display * display); +struct SkypopenHandles *skypopen_list_remove_by_reference(struct SkypopenList *list, struct SkypopenHandles *x); +int skypopen_list_size(struct SkypopenList *list); #else //WIN32 @@ -352,31 +352,31 @@ struct private_object { typedef struct private_object private_t; -void *SWITCH_THREAD_FUNC skypopen_api_thread_func(switch_thread_t * thread, void *obj); -int skypopen_audio_read(private_t * tech_pvt); -int skypopen_audio_init(private_t * tech_pvt); -int skypopen_signaling_write(private_t * tech_pvt, char *msg_to_skype); -int skypopen_signaling_read(private_t * tech_pvt); +void *SWITCH_THREAD_FUNC skypopen_api_thread_func(switch_thread_t *thread, void *obj); +int skypopen_audio_read(private_t *tech_pvt); +int skypopen_audio_init(private_t *tech_pvt); +int skypopen_signaling_write(private_t *tech_pvt, char *msg_to_skype); +int skypopen_signaling_read(private_t *tech_pvt); -int skypopen_call(private_t * tech_pvt, char *idest, int timeout); -int skypopen_senddigit(private_t * tech_pvt, char digit); +int skypopen_call(private_t *tech_pvt, char *idest, int timeout); +int skypopen_senddigit(private_t *tech_pvt, char digit); void *skypopen_do_tcp_srv_thread_func(void *obj); -void *SWITCH_THREAD_FUNC skypopen_do_tcp_srv_thread(switch_thread_t * thread, void *obj); +void *SWITCH_THREAD_FUNC skypopen_do_tcp_srv_thread(switch_thread_t *thread, void *obj); void *skypopen_do_tcp_cli_thread_func(void *obj); -void *SWITCH_THREAD_FUNC skypopen_do_tcp_cli_thread(switch_thread_t * thread, void *obj); +void *SWITCH_THREAD_FUNC skypopen_do_tcp_cli_thread(switch_thread_t *thread, void *obj); void *skypopen_do_skypeapi_thread_func(void *obj); -void *SWITCH_THREAD_FUNC skypopen_do_skypeapi_thread(switch_thread_t * thread, void *obj); -int dtmf_received(private_t * tech_pvt, char *value); -int start_audio_threads(private_t * tech_pvt); -int new_inbound_channel(private_t * tech_pvt); -int outbound_channel_answered(private_t * tech_pvt); -int skypopen_signaling_write(private_t * tech_pvt, char *msg_to_skype); +void *SWITCH_THREAD_FUNC skypopen_do_skypeapi_thread(switch_thread_t *thread, void *obj); +int dtmf_received(private_t *tech_pvt, char *value); +int start_audio_threads(private_t *tech_pvt); +int new_inbound_channel(private_t *tech_pvt); +int outbound_channel_answered(private_t *tech_pvt); +int skypopen_signaling_write(private_t *tech_pvt, char *msg_to_skype); #if defined(WIN32) && !defined(__CYGWIN__) -int skypopen_pipe_read(switch_file_t * pipe, short *buf, int howmany); -int skypopen_pipe_write(switch_file_t * pipe, short *buf, int howmany); +int skypopen_pipe_read(switch_file_t *pipe, short *buf, int howmany); +int skypopen_pipe_write(switch_file_t *pipe, short *buf, int howmany); /* Visual C do not have strsep ? */ char *strsep(char **stringp, const char *delim); #else @@ -384,20 +384,20 @@ int skypopen_pipe_read(int pipe, short *buf, int howmany); int skypopen_pipe_write(int pipe, short *buf, int howmany); #endif /* WIN32 */ int skypopen_close_socket(unsigned int fd); -private_t *find_available_skypopen_interface_rr(private_t * tech_pvt_calling); -int remote_party_is_ringing(private_t * tech_pvt); -int remote_party_is_early_media(private_t * tech_pvt); +private_t *find_available_skypopen_interface_rr(private_t *tech_pvt_calling); +int remote_party_is_ringing(private_t *tech_pvt); +int remote_party_is_early_media(private_t *tech_pvt); //int skypopen_answer(private_t * tech_pvt, char *id, char *value); -int skypopen_answer(private_t * tech_pvt); +int skypopen_answer(private_t *tech_pvt); //int skypopen_transfer(private_t * tech_pvt, char *id, char *value); -int skypopen_transfer(private_t * tech_pvt); +int skypopen_transfer(private_t *tech_pvt); #ifndef WIN32 -int skypopen_socket_create_and_bind(private_t * tech_pvt, int *which_port); +int skypopen_socket_create_and_bind(private_t *tech_pvt, int *which_port); #else -int skypopen_socket_create_and_bind(private_t * tech_pvt, unsigned short *which_port); +int skypopen_socket_create_and_bind(private_t *tech_pvt, unsigned short *which_port); #endif //WIN32 -int incoming_chatmessage(private_t * tech_pvt, int which); +int incoming_chatmessage(private_t *tech_pvt, int which); int next_port(void); -int skypopen_partner_handle_ring(private_t * tech_pvt); -int skypopen_answered(private_t * tech_pvt); -int inbound_channel_answered(private_t * tech_pvt); +int skypopen_partner_handle_ring(private_t *tech_pvt); +int skypopen_answered(private_t *tech_pvt); +int inbound_channel_answered(private_t *tech_pvt); diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index f48d855..0dc34b7 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -30,9 +30,9 @@ extern switch_status_t remove_interface(char *the_interface, switch_bool_t force #endif /* WIN32 */ /*************************************/ #ifndef WIN32 -int skypopen_socket_create_and_bind(private_t * tech_pvt, int *which_port) +int skypopen_socket_create_and_bind(private_t *tech_pvt, int *which_port) #else -int skypopen_socket_create_and_bind(private_t * tech_pvt, unsigned short *which_port) +int skypopen_socket_create_and_bind(private_t *tech_pvt, unsigned short *which_port) #endif //WIN32 { int s = -1; @@ -107,7 +107,7 @@ int skypopen_socket_create_and_bind(private_t * tech_pvt, unsigned short *which_ sockbufsize = SAMPLES_PER_FRAME * 8; #endif //WIN32 size = sizeof(int); - if(tech_pvt->setsockopt){ + if (tech_pvt->setsockopt) { setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *) &sockbufsize, size); } @@ -126,7 +126,7 @@ int skypopen_socket_create_and_bind(private_t * tech_pvt, unsigned short *which_ sockbufsize = SAMPLES_PER_FRAME * 8; #endif //WIN32 size = sizeof(int); - if(tech_pvt->setsockopt){ + if (tech_pvt->setsockopt) { setsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *) &sockbufsize, size); } @@ -135,16 +135,16 @@ int skypopen_socket_create_and_bind(private_t * tech_pvt, unsigned short *which_ getsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *) &sockbufsize, &size); DEBUGA_SKYPE("2 SO_SNDBUF is %d, size is %d\n", SKYPOPEN_P_LOG, sockbufsize, size); - flag = 0; - getsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, &size); - DEBUGA_SKYPE("TCP_NODELAY is %d\n", SKYPOPEN_P_LOG, flag); - flag = 1; - if(tech_pvt->setsockopt){ - setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, size); + flag = 0; + getsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, &size); + DEBUGA_SKYPE("TCP_NODELAY is %d\n", SKYPOPEN_P_LOG, flag); + flag = 1; + if (tech_pvt->setsockopt) { + setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, size); } - flag = 0; - getsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, &size); - DEBUGA_SKYPE("TCP_NODELAY is %d\n", SKYPOPEN_P_LOG, flag); + flag = 0; + getsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, &size); + DEBUGA_SKYPE("TCP_NODELAY is %d\n", SKYPOPEN_P_LOG, flag); @@ -152,7 +152,7 @@ int skypopen_socket_create_and_bind(private_t * tech_pvt, unsigned short *which_ return s; } -int skypopen_signaling_read(private_t * tech_pvt) +int skypopen_signaling_read(private_t *tech_pvt) { char read_from_pipe[4096]; char message[4096]; @@ -178,7 +178,7 @@ int skypopen_signaling_read(private_t * tech_pvt) //if (!strstr(message, "DURATION")) { DEBUGA_SKYPE("READING: |||%s||| \n", SKYPOPEN_P_LOG, message); - strncpy( tech_pvt->message, message, sizeof(tech_pvt->message) ); + strncpy(tech_pvt->message, message, sizeof(tech_pvt->message)); //} if (!strcasecmp(message, "SILENT_MODE OFF")) { @@ -523,19 +523,19 @@ int skypopen_signaling_read(private_t * tech_pvt) } if (!strcasecmp(prop, "DURATION")) { /* each 20 seconds, we zero the buffers and sync the timers */ if (!((atoi(value) % 20))) { - if(tech_pvt->read_buffer){ + if (tech_pvt->read_buffer) { switch_mutex_lock(tech_pvt->mutex_audio_srv); switch_buffer_zero(tech_pvt->read_buffer); - if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next){ + if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next) { switch_core_timer_sync(&tech_pvt->timer_read); } switch_mutex_unlock(tech_pvt->mutex_audio_srv); } - if(tech_pvt->write_buffer){ + if (tech_pvt->write_buffer) { switch_mutex_lock(tech_pvt->mutex_audio_cli); switch_buffer_zero(tech_pvt->write_buffer); - if (tech_pvt->timer_write.timer_interface && tech_pvt->timer_write.timer_interface->timer_next){ + if (tech_pvt->timer_write.timer_interface && tech_pvt->timer_write.timer_interface->timer_next) { switch_core_timer_sync(&tech_pvt->timer_write); } switch_mutex_unlock(tech_pvt->mutex_audio_cli); @@ -571,7 +571,8 @@ int skypopen_signaling_read(private_t * tech_pvt) skypopen_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1); /* we are NOT inside an active call */ - DEBUGA_SKYPE("NO ACTIVE calls in this moment, skype_call %s is RINGING, to ask PARTNER_DISPNAME and PARTNER_HANDLE\n", SKYPOPEN_P_LOG, id); + DEBUGA_SKYPE("NO ACTIVE calls in this moment, skype_call %s is RINGING, to ask PARTNER_DISPNAME and PARTNER_HANDLE\n", + SKYPOPEN_P_LOG, id); sprintf(msg_to_skype, "GET CALL %s PARTNER_DISPNAME", id); skypopen_signaling_write(tech_pvt, msg_to_skype); skypopen_sleep(100); @@ -589,9 +590,10 @@ int skypopen_signaling_read(private_t * tech_pvt) tech_pvt->interface_state = SKYPOPEN_STATE_RINGING; skypopen_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1); DEBUGA_SKYPE("Our remote party in skype_call %s is RINGING\n", SKYPOPEN_P_LOG, id); - if( !remote_party_is_ringing(tech_pvt)){ + if (!remote_party_is_ringing(tech_pvt)) { - WARNINGA("We are getting the RINGING from a call we canceled, trying to get out hanging up call id: %s.\n", SKYPOPEN_P_LOG, id); + WARNINGA("We are getting the RINGING from a call we canceled, trying to get out hanging up call id: %s.\n", + SKYPOPEN_P_LOG, id); sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", id); skypopen_signaling_write(tech_pvt, msg_to_skype); sprintf(msg_to_skype, "ALTER CALL %s HANGUP", id); @@ -634,11 +636,11 @@ int skypopen_signaling_read(private_t * tech_pvt) skypopen_signaling_write(tech_pvt, msg_to_skype); remote_party_is_early_media(tech_pvt); - /* CLOUDTREE (Thomas Hazel) - } else if (!strcasecmp(value, "MISSED")) { - DEBUGA_SKYPE("We missed skype_call %s\n", SKYPOPEN_P_LOG, id); - */ - // CLOUDTREE (Thomas Hazel) + /* CLOUDTREE (Thomas Hazel) + } else if (!strcasecmp(value, "MISSED")) { + DEBUGA_SKYPE("We missed skype_call %s\n", SKYPOPEN_P_LOG, id); + */ + // CLOUDTREE (Thomas Hazel) } else if (!strcasecmp(value, "MISSED") || !strcasecmp(value, "FINISHED")) { if (!strcasecmp(tech_pvt->skype_call_id, id)) { DEBUGA_SKYPE("skype_call %s is MY call, now I'm going DOWN\n", SKYPOPEN_P_LOG, id); @@ -889,7 +891,7 @@ void *skypopen_do_tcp_srv_thread_func(void *obj) nospace = 0; if (len > 0) { switch_mutex_lock(tech_pvt->mutex_audio_srv); - if(tech_pvt->read_buffer){ + if (tech_pvt->read_buffer) { if (switch_buffer_freespace(tech_pvt->read_buffer) < len) { switch_buffer_zero(tech_pvt->read_buffer); nospace = 1; @@ -1045,11 +1047,11 @@ void *skypopen_do_tcp_cli_thread_func(void *obj) switch_mutex_unlock(tech_pvt->mutex_audio_cli); if (!bytes_to_write) { - if(tech_pvt->write_silence_when_idle){ + if (tech_pvt->write_silence_when_idle) { memset(cli_out, 255, sizeof(cli_out)); bytes_to_write = 640; //DEBUGA_SKYPE("WRITE Silence!\n", SKYPOPEN_P_LOG); - }else{ + } else { continue; } } @@ -1088,7 +1090,7 @@ void *skypopen_do_tcp_cli_thread_func(void *obj) return NULL; } -int skypopen_senddigit(private_t * tech_pvt, char digit) +int skypopen_senddigit(private_t *tech_pvt, char digit) { char msg_to_skype[1024]; @@ -1099,7 +1101,7 @@ int skypopen_senddigit(private_t * tech_pvt, char digit) return 0; } -int skypopen_call(private_t * tech_pvt, char *rdest, int timeout) +int skypopen_call(private_t *tech_pvt, char *rdest, int timeout) { char msg_to_skype[1024]; @@ -1117,7 +1119,7 @@ int skypopen_call(private_t * tech_pvt, char *rdest, int timeout) /* PLATFORM SPECIFIC */ /***************************/ #if defined(WIN32) && !defined(__CYGWIN__) -int skypopen_pipe_read(switch_file_t * pipe, short *buf, int howmany) +int skypopen_pipe_read(switch_file_t *pipe, short *buf, int howmany) { switch_size_t quantity; @@ -1130,7 +1132,7 @@ int skypopen_pipe_read(switch_file_t * pipe, short *buf, int howmany) return howmany; } -int skypopen_pipe_write(switch_file_t * pipe, short *buf, int howmany) +int skypopen_pipe_write(switch_file_t *pipe, short *buf, int howmany) { switch_size_t quantity; @@ -1152,7 +1154,7 @@ int skypopen_close_socket(unsigned int fd) return res; } -int skypopen_audio_init(private_t * tech_pvt) +int skypopen_audio_init(private_t *tech_pvt) { switch_status_t rv; rv = switch_file_pipe_create(&tech_pvt->audiopipe_srv[0], &tech_pvt->audiopipe_srv[1], skypopen_module_pool); @@ -1185,7 +1187,7 @@ int skypopen_close_socket(unsigned int fd) return res; } -int skypopen_audio_init(private_t * tech_pvt) +int skypopen_audio_init(private_t *tech_pvt) { if (pipe(tech_pvt->audiopipe_srv)) { fcntl(tech_pvt->audiopipe_srv[0], F_SETFL, O_NONBLOCK); @@ -1248,7 +1250,7 @@ char return res; } -int skypopen_signaling_write(private_t * tech_pvt, char *msg_to_skype) +int skypopen_signaling_write(private_t *tech_pvt, char *msg_to_skype) { static char acInputRow[1024]; COPYDATASTRUCT oCopyData; @@ -1355,7 +1357,7 @@ LRESULT APIENTRY skypopen_present(HWND hWindow, UINT uiMessage, WPARAM uiParam, return (lReturnCode); } -int win32_Initialize_CreateWindowClass(private_t * tech_pvt) +int win32_Initialize_CreateWindowClass(private_t *tech_pvt) { unsigned char *paucUUIDString; RPC_STATUS lUUIDResult; @@ -1395,14 +1397,14 @@ int win32_Initialize_CreateWindowClass(private_t * tech_pvt) return (fReturnStatus); } -void win32_DeInitialize_DestroyWindowClass(private_t * tech_pvt) +void win32_DeInitialize_DestroyWindowClass(private_t *tech_pvt) { UnregisterClass(tech_pvt->SkypopenHandles.win32_acInit_WindowClassName, tech_pvt->SkypopenHandles.win32_hInit_ProcessHandle); CloseHandle(tech_pvt->SkypopenHandles.win32_hInit_ProcessHandle); tech_pvt->SkypopenHandles.win32_hInit_ProcessHandle = NULL; } -int win32_Initialize_CreateMainWindow(private_t * tech_pvt) +int win32_Initialize_CreateMainWindow(private_t *tech_pvt) { tech_pvt->SkypopenHandles.win32_hInit_MainWindowHandle = CreateWindowEx(WS_EX_APPWINDOW | WS_EX_WINDOWEDGE, @@ -1412,7 +1414,7 @@ int win32_Initialize_CreateMainWindow(private_t * tech_pvt) return (tech_pvt->SkypopenHandles.win32_hInit_MainWindowHandle != NULL ? 1 : 0); } -void win32_DeInitialize_DestroyMainWindow(private_t * tech_pvt) +void win32_DeInitialize_DestroyMainWindow(private_t *tech_pvt) { if (tech_pvt->SkypopenHandles.win32_hInit_MainWindowHandle != NULL) DestroyWindow(tech_pvt->SkypopenHandles.win32_hInit_MainWindowHandle), tech_pvt->SkypopenHandles.win32_hInit_MainWindowHandle = NULL; @@ -1462,7 +1464,7 @@ void *skypopen_do_skypeapi_thread_func(void *obj) win32_DeInitialize_DestroyWindowClass(tech_pvt); } } - tech_pvt->skypopen_api_thread=NULL; + tech_pvt->skypopen_api_thread = NULL; DEBUGA_SKYPE("EXITING\n", SKYPOPEN_P_LOG); return NULL; } @@ -1470,24 +1472,24 @@ void *skypopen_do_skypeapi_thread_func(void *obj) #else /* NOT WIN32 */ // CLOUDTREE (Thomas Hazel) -int xio_error_handler(Display *dpy) +int xio_error_handler(Display * dpy) { private_t *tech_pvt = NULL; - struct SkypopenHandles* handle; + struct SkypopenHandles *handle; ERRORA("Fatal display error for %d, %s\n", SKYPOPEN_P_LOG, skypopen_list_size(&global_handles_list), dpy->display_name); handle = skypopen_list_remove_by_value(&global_handles_list, dpy); if (handle != NULL) { - #ifdef XIO_ERROR_BY_SETJMP - siglongjmp(handle->ioerror_context, 1); - #endif - #ifdef XIO_ERROR_BY_UCONTEXT - setcontext(&handle->ioerror_context); - #endif +#ifdef XIO_ERROR_BY_SETJMP + siglongjmp(handle->ioerror_context, 1); +#endif +#ifdef XIO_ERROR_BY_UCONTEXT + setcontext(&handle->ioerror_context); +#endif } - ERRORA("Fatal display error for %p, %s - failed to siglongjmp\n", SKYPOPEN_P_LOG, (void*) handle, dpy->display_name); + ERRORA("Fatal display error for %p, %s - failed to siglongjmp\n", SKYPOPEN_P_LOG, (void *) handle, dpy->display_name); return 0; } @@ -1502,7 +1504,7 @@ int X11_errors_handler(Display * dpy, XErrorEvent * err) return 0; /* ignore the error */ } -int skypopen_send_message(private_t * tech_pvt, const char *message_P) +int skypopen_send_message(private_t *tech_pvt, const char *message_P) { struct SkypopenHandles *SkypopenHandles = &tech_pvt->SkypopenHandles; Window w_P = SkypopenHandles->skype_win; @@ -1516,8 +1518,8 @@ int skypopen_send_message(private_t * tech_pvt, const char *message_P) unsigned int len = strlen(message_P); XEvent e; -skypopen_sleep(1000);//giovanni - XFlush(disp);//giovanni + skypopen_sleep(1000); //giovanni + XFlush(disp); //giovanni memset(&e, 0, sizeof(e)); e.xclient.type = ClientMessage; @@ -1552,7 +1554,7 @@ skypopen_sleep(1000);//giovanni return 1; } -int skypopen_signaling_write(private_t * tech_pvt, char *msg_to_skype) +int skypopen_signaling_write(private_t *tech_pvt, char *msg_to_skype) { DEBUGA_SKYPE("SENDING: |||%s||||\n", SKYPOPEN_P_LOG, msg_to_skype); @@ -1661,54 +1663,54 @@ void *skypopen_do_skypeapi_thread_func(void *obj) } // CLOUDTREE (Thomas Hazel) - #ifndef WIN32 +#ifndef WIN32 { skypopen_list_add(&global_handles_list, SkypopenHandles); - #ifdef XIO_ERROR_BY_SETJMP - if (sigsetjmp(SkypopenHandles->ioerror_context, 1) != 0) { - switch_core_session_t *session = NULL; - ERRORA("Fatal display error for %s - successed to jump\n", SKYPOPEN_P_LOG, tech_pvt->X11_display); - - session = switch_core_session_locate(tech_pvt->session_uuid_str); - if (session) { - switch_channel_t *channel = switch_core_session_get_channel(session); - WARNINGA("Closing session %s\n", SKYPOPEN_P_LOG, tech_pvt->skype_user); - switch_channel_hangup(channel, SWITCH_CAUSE_CRASH); - switch_core_session_rwunlock(session); - } - - WARNINGA("Removing skype user %s\n", SKYPOPEN_P_LOG, tech_pvt->skype_user); - tech_pvt->skypopen_api_thread = NULL; - remove_interface(tech_pvt->skype_user, TRUE); - XCloseDisplay(disp); - return NULL; +#ifdef XIO_ERROR_BY_SETJMP + if (sigsetjmp(SkypopenHandles->ioerror_context, 1) != 0) { + switch_core_session_t *session = NULL; + ERRORA("Fatal display error for %s - successed to jump\n", SKYPOPEN_P_LOG, tech_pvt->X11_display); + + session = switch_core_session_locate(tech_pvt->session_uuid_str); + if (session) { + switch_channel_t *channel = switch_core_session_get_channel(session); + WARNINGA("Closing session %s\n", SKYPOPEN_P_LOG, tech_pvt->skype_user); + switch_channel_hangup(channel, SWITCH_CAUSE_CRASH); + switch_core_session_rwunlock(session); } - #endif - #ifdef XIO_ERROR_BY_UCONTEXT - getcontext(&SkypopenHandles->ioerror_context); - - if (skypopen_list_find(&global_handles_list, SkypopenHandles) == NULL) { - switch_core_session_t *session = NULL; - ERRORA("Fatal display error for %s - successed to jump\n", SKYPOPEN_P_LOG, tech_pvt->X11_display); - - session = switch_core_session_locate(tech_pvt->session_uuid_str); - if (session) { - switch_channel_t *channel = switch_core_session_get_channel(session); - WARNINGA("Closing session %s\n", SKYPOPEN_P_LOG, tech_pvt->skype_user); - switch_channel_hangup(channel, SWITCH_CAUSE_CRASH); - switch_core_session_rwunlock(session); - } - WARNINGA("Removing skype user %s\n", SKYPOPEN_P_LOG, tech_pvt->skype_user); - tech_pvt->skypopen_api_thread = NULL; - remove_interface(tech_pvt->skype_user, TRUE); - XCloseDisplay(disp); - return NULL; + WARNINGA("Removing skype user %s\n", SKYPOPEN_P_LOG, tech_pvt->skype_user); + tech_pvt->skypopen_api_thread = NULL; + remove_interface(tech_pvt->skype_user, TRUE); + XCloseDisplay(disp); + return NULL; + } +#endif +#ifdef XIO_ERROR_BY_UCONTEXT + getcontext(&SkypopenHandles->ioerror_context); + + if (skypopen_list_find(&global_handles_list, SkypopenHandles) == NULL) { + switch_core_session_t *session = NULL; + ERRORA("Fatal display error for %s - successed to jump\n", SKYPOPEN_P_LOG, tech_pvt->X11_display); + + session = switch_core_session_locate(tech_pvt->session_uuid_str); + if (session) { + switch_channel_t *channel = switch_core_session_get_channel(session); + WARNINGA("Closing session %s\n", SKYPOPEN_P_LOG, tech_pvt->skype_user); + switch_channel_hangup(channel, SWITCH_CAUSE_CRASH); + switch_core_session_rwunlock(session); } - #endif + + WARNINGA("Removing skype user %s\n", SKYPOPEN_P_LOG, tech_pvt->skype_user); + tech_pvt->skypopen_api_thread = NULL; + remove_interface(tech_pvt->skype_user, TRUE); + XCloseDisplay(disp); + return NULL; + } +#endif } - #endif /* NOT WIN32 */ +#endif /* NOT WIN32 */ xfd = XConnectionNumber(disp); fcntl(xfd, F_SETFD, FD_CLOEXEC); @@ -1727,9 +1729,9 @@ void *skypopen_do_skypeapi_thread_func(void *obj) ERRORA("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypopen again\n", SKYPOPEN_P_LOG); // CLOUDTREE (Thomas Hazel) - #ifndef WIN32 +#ifndef WIN32 skypopen_list_remove_by_reference(&global_handles_list, SkypopenHandles); - #endif +#endif XCloseDisplay(disp); running = 0; @@ -1741,9 +1743,9 @@ void *skypopen_do_skypeapi_thread_func(void *obj) ERRORA("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypopen again\n", SKYPOPEN_P_LOG); // CLOUDTREE (Thomas Hazel) - #ifndef WIN32 +#ifndef WIN32 skypopen_list_remove_by_reference(&global_handles_list, SkypopenHandles); - #endif +#endif XCloseDisplay(disp); running = 0; @@ -1771,97 +1773,97 @@ void *skypopen_do_skypeapi_thread_func(void *obj) while (running && tech_pvt->running) { - FD_ZERO(&xfds); - FD_SET(xfd, &xfds); + FD_ZERO(&xfds); + FD_SET(xfd, &xfds); - tv.tv_usec = 100000; - tv.tv_sec = 0; + tv.tv_usec = 100000; + tv.tv_sec = 0; -if (select(xfd+1, &xfds, 0, 0, &tv)){ + if (select(xfd + 1, &xfds, 0, 0, &tv)) { -while(XPending(disp)){ + while (XPending(disp)) { - XNextEvent(disp, &an_event); - if (!(running && tech_pvt->running)) - break; - switch (an_event.type) { - case ClientMessage: + XNextEvent(disp, &an_event); + if (!(running && tech_pvt->running)) + break; + switch (an_event.type) { + case ClientMessage: - if (an_event.xclient.format != 8) { - skypopen_sleep(1000); //0.1 msec - break; - } + if (an_event.xclient.format != 8) { + skypopen_sleep(1000); //0.1 msec + break; + } - for (i = 0; i < 20 && an_event.xclient.data.b[i] != '\0'; ++i) - buf[i] = an_event.xclient.data.b[i]; + for (i = 0; i < 20 && an_event.xclient.data.b[i] != '\0'; ++i) + buf[i] = an_event.xclient.data.b[i]; - buf[i] = '\0'; + buf[i] = '\0'; - if (an_event.xclient.message_type == atom_begin) { - if (strlen(buffer)) { - unsigned int howmany; - howmany = strlen(b) + 1; - howmany = write(SkypopenHandles->fdesc[1], b, howmany); - WARNINGA - ("A begin atom while the previous message is not closed???? value of previous message (between vertical bars) is=|||%s|||, will be lost\n", - SKYPOPEN_P_LOG, buffer); - memset(buffer, '\0', 17000); - } - if (continue_is_broken) { - continue_is_broken = 0; - there_were_continues = 1; - } - } - if (an_event.xclient.message_type == atom_continue) { - if (!strlen(buffer)) { - WARNINGA - ("Got a 'continue' XAtom without a previous 'begin'. It's value (between vertical bars) is=|||%s|||, let's store it and hope next 'begin' will be the good one\n", - SKYPOPEN_P_LOG, buf); - strcat(continuebuffer, buf); - continue_is_broken = 1; - if (!strncmp(buf, "ognised identity", 15)) { - WARNINGA - ("Got a 'continue' XAtom without a previous 'begin'. It's value (between vertical bars) is=|||%s|||. Let's introduce a 1 second delay.\n", - SKYPOPEN_P_LOG, buf); - skypopen_sleep(1000000); //1 sec + if (an_event.xclient.message_type == atom_begin) { + if (strlen(buffer)) { + unsigned int howmany; + howmany = strlen(b) + 1; + howmany = write(SkypopenHandles->fdesc[1], b, howmany); + WARNINGA + ("A begin atom while the previous message is not closed???? value of previous message (between vertical bars) is=|||%s|||, will be lost\n", + SKYPOPEN_P_LOG, buffer); + memset(buffer, '\0', 17000); + } + if (continue_is_broken) { + continue_is_broken = 0; + there_were_continues = 1; + } } + if (an_event.xclient.message_type == atom_continue) { + if (!strlen(buffer)) { + WARNINGA + ("Got a 'continue' XAtom without a previous 'begin'. It's value (between vertical bars) is=|||%s|||, let's store it and hope next 'begin' will be the good one\n", + SKYPOPEN_P_LOG, buf); + strcat(continuebuffer, buf); + continue_is_broken = 1; + if (!strncmp(buf, "ognised identity", 15)) { + WARNINGA + ("Got a 'continue' XAtom without a previous 'begin'. It's value (between vertical bars) is=|||%s|||. Let's introduce a 1 second delay.\n", + SKYPOPEN_P_LOG, buf); + skypopen_sleep(1000000); //1 sec + } + skypopen_sleep(1000); //0.1 msec + break; + } + } + if (continue_is_broken) { + XFlush(disp); + skypopen_sleep(1000); //0.1 msec + continue; + } + strcat(buffer, buf); + strcat(buffer, continuebuffer); + memset(continuebuffer, '\0', 17000); + + if (i < 20 || there_were_continues) { /* last fragment */ + unsigned int howmany; + + howmany = strlen(b) + 1; + howmany = write(SkypopenHandles->fdesc[1], b, howmany); + memset(buffer, '\0', 17000); + XFlush(disp); + there_were_continues = 0; + } + skypopen_sleep(1000); //0.1 msec break; - } - } - if (continue_is_broken) { - XFlush(disp); - skypopen_sleep(1000); //0.1 msec - continue; - } - strcat(buffer, buf); - strcat(buffer, continuebuffer); - memset(continuebuffer, '\0', 17000); - - if (i < 20 || there_were_continues) { /* last fragment */ - unsigned int howmany; - - howmany = strlen(b) + 1; - howmany = write(SkypopenHandles->fdesc[1], b, howmany); - memset(buffer, '\0', 17000); - XFlush(disp); - there_were_continues = 0; - } - - skypopen_sleep(1000); //0.1 msec - break; - default: - skypopen_sleep(1000); //0.1 msec - break; - } //switch event.type - } //while XPending + default: + skypopen_sleep(1000); //0.1 msec + break; + } //switch event.type + } //while XPending -} // if select -} //while running + } // if select + } //while running @@ -1876,18 +1878,18 @@ while(XPending(disp)){ NOTICA("EXITING\n", SKYPOPEN_P_LOG); // CLOUDTREE (Thomas Hazel) - #ifndef WIN32 +#ifndef WIN32 skypopen_list_remove_by_reference(&global_handles_list, SkypopenHandles); - #endif +#endif - tech_pvt->skypopen_api_thread=NULL; + tech_pvt->skypopen_api_thread = NULL; XCloseDisplay(disp); return NULL; } #endif // WIN32 -int inbound_channel_answered(private_t * tech_pvt) +int inbound_channel_answered(private_t *tech_pvt) { int res = 0; switch_core_session_t *session = NULL; @@ -1911,14 +1913,14 @@ int inbound_channel_answered(private_t * tech_pvt) } -int skypopen_answered(private_t * tech_pvt) +int skypopen_answered(private_t *tech_pvt) { int res = 0; switch_core_session_t *session = NULL; switch_channel_t *channel = NULL; - //WARNINGA("ANSWERED tech_pvt->skype_call_id=%s, tech_pvt->skype_callflow=%d, tech_pvt->interface_state=%d, tech_pvt->skype_user=%s, tech_pvt->callid_number=%s, tech_pvt->ring_value=%s, tech_pvt->ring_id=%s, tech_pvt->answer_value=%s, tech_pvt->answer_id=%s\n", SKYPOPEN_P_LOG, tech_pvt->skype_call_id, tech_pvt->skype_callflow, tech_pvt->interface_state, tech_pvt->skype_user, tech_pvt->callid_number, tech_pvt->ring_value, tech_pvt->ring_id, tech_pvt->answer_value, tech_pvt->answer_id); + //WARNINGA("ANSWERED tech_pvt->skype_call_id=%s, tech_pvt->skype_callflow=%d, tech_pvt->interface_state=%d, tech_pvt->skype_user=%s, tech_pvt->callid_number=%s, tech_pvt->ring_value=%s, tech_pvt->ring_id=%s, tech_pvt->answer_value=%s, tech_pvt->answer_id=%s\n", SKYPOPEN_P_LOG, tech_pvt->skype_call_id, tech_pvt->skype_callflow, tech_pvt->interface_state, tech_pvt->skype_user, tech_pvt->callid_number, tech_pvt->ring_value, tech_pvt->ring_id, tech_pvt->answer_value, tech_pvt->answer_id); session = switch_core_session_locate(tech_pvt->session_uuid_str); if (session) { commit 994cdbd183db25e993b61bd1101666cd7d6b31d9 Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Tue Oct 26 04:42:46 2010 -0500 skypopen: lot of improvements in locking and hangup handling diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index 5837cbe..62461de 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -454,6 +454,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session) static switch_status_t channel_on_destroy(switch_core_session_t *session) { private_t *tech_pvt = NULL; + switch_status_t status; tech_pvt = switch_core_session_get_private(session); @@ -483,12 +484,37 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session) if(tech_pvt->write_buffer){ switch_buffer_destroy(&tech_pvt->write_buffer); } + DEBUGA_SKYPE("debugging_hangup 13\n", SKYPOPEN_P_LOG); + switch_mutex_lock(tech_pvt->mutex_thread_audio_cli); + DEBUGA_SKYPE("debugging_hangup cli lock\n", SKYPOPEN_P_LOG); + if (tech_pvt->tcp_cli_thread) { + DEBUGA_SKYPE("debugging_hangup 14\n", SKYPOPEN_P_LOG); + switch_thread_join(&status, tech_pvt->tcp_cli_thread); + tech_pvt->tcp_cli_thread = NULL; + DEBUGA_SKYPE("debugging_hangup 15\n", SKYPOPEN_P_LOG); + } + switch_mutex_unlock(tech_pvt->mutex_thread_audio_cli); + DEBUGA_SKYPE("debugging_hangup cli unlock\n", SKYPOPEN_P_LOG); + switch_mutex_lock(tech_pvt->mutex_thread_audio_srv); + DEBUGA_SKYPE("debugging_hangup srv lock\n", SKYPOPEN_P_LOG); + if (tech_pvt->tcp_srv_thread) { + DEBUGA_SKYPE("debugging_hangup 16\n", SKYPOPEN_P_LOG); + switch_thread_join(&status, tech_pvt->tcp_srv_thread); + tech_pvt->tcp_srv_thread = NULL; + DEBUGA_SKYPE("debugging_hangup 17\n", SKYPOPEN_P_LOG); + } + switch_mutex_unlock(tech_pvt->mutex_thread_audio_srv); + DEBUGA_SKYPE("debugging_hangup srv unlock\n", SKYPOPEN_P_LOG); + DEBUGA_SKYPE("debugging_hangup 18\n", SKYPOPEN_P_LOG); *tech_pvt->session_uuid_str = '\0'; tech_pvt->interface_state = SKYPOPEN_STATE_IDLE; + tech_pvt->skype_callflow = CALLFLOW_CALL_IDLE; +#if 0 if (tech_pvt->skype_callflow == CALLFLOW_STATUS_FINISHED) { tech_pvt->skype_callflow = CALLFLOW_CALL_IDLE; } +#endif // switch_core_session_set_private(session, NULL); } else { DEBUGA_SKYPE("!!!!!!NO tech_pvt!!!! CHANNEL DESTROY %s\n", SKYPOPEN_P_LOG, switch_core_session_get_uuid(session)); @@ -502,15 +528,17 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session) switch_channel_t *channel = NULL; private_t *tech_pvt = NULL; char msg_to_skype[256]; - switch_status_t status; + //switch_status_t status; channel = switch_core_session_get_channel(session); switch_assert(channel != NULL); tech_pvt = switch_core_session_get_private(session); - switch_assert(tech_pvt != NULL); + DEBUGA_SKYPE("debugging_hangup 1\n", SKYPOPEN_P_LOG); + + if(tech_pvt){ if (!switch_channel_test_flag(channel, CF_ANSWERED)) { if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { tech_pvt->ob_failed_calls++; @@ -522,20 +550,44 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session) switch_clear_flag(tech_pvt, TFLAG_IO); switch_clear_flag(tech_pvt, TFLAG_VOICE); + DEBUGA_SKYPE("debugging_hangup 2\n", SKYPOPEN_P_LOG); tech_pvt->interface_state = SKYPOPEN_STATE_HANGUP_REQUESTED; if (strlen(tech_pvt->skype_call_id)) { DEBUGA_SKYPE("hanging up skype call: %s\n", SKYPOPEN_P_LOG, tech_pvt->skype_call_id); + sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->skype_call_id); + skypopen_signaling_write(tech_pvt, msg_to_skype); sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id); skypopen_signaling_write(tech_pvt, msg_to_skype); } +#if 0 + switch_sleep(1500000); //XXX 1.5 seconds, let's the audio tcp threads die XXX + //FIXME must not allow using the tech_pvt while this sleeps, so must implement a check on interface_state + + DEBUGA_SKYPE("debugging_hangup 3\n", SKYPOPEN_P_LOG); + switch_mutex_lock(tech_pvt->mutex_thread_audio_cli); + DEBUGA_SKYPE("debugging_hangup cli lock\n", SKYPOPEN_P_LOG); if (tech_pvt->tcp_cli_thread) { + DEBUGA_SKYPE("debugging_hangup 4\n", SKYPOPEN_P_LOG); switch_thread_join(&status, tech_pvt->tcp_cli_thread); + tech_pvt->tcp_cli_thread = NULL; + DEBUGA_SKYPE("debugging_hangup 5\n", SKYPOPEN_P_LOG); } + switch_mutex_unlock(tech_pvt->mutex_thread_audio_cli); + DEBUGA_SKYPE("debugging_hangup cli unlock\n", SKYPOPEN_P_LOG); + switch_mutex_lock(tech_pvt->mutex_thread_audio_srv); + DEBUGA_SKYPE("debugging_hangup srv lock\n", SKYPOPEN_P_LOG); if (tech_pvt->tcp_srv_thread) { + DEBUGA_SKYPE("debugging_hangup 6\n", SKYPOPEN_P_LOG); switch_thread_join(&status, tech_pvt->tcp_srv_thread); + tech_pvt->tcp_srv_thread = NULL; + DEBUGA_SKYPE("debugging_hangup 7\n", SKYPOPEN_P_LOG); } + switch_mutex_unlock(tech_pvt->mutex_thread_audio_srv); + DEBUGA_SKYPE("debugging_hangup srv unlock\n", SKYPOPEN_P_LOG); + DEBUGA_SKYPE("debugging_hangup 8\n", SKYPOPEN_P_LOG); +#endif//0 DEBUGA_SKYPE("%s CHANNEL HANGUP\n", SKYPOPEN_P_LOG, tech_pvt->name); switch_mutex_lock(globals.mutex); globals.calls--; @@ -543,11 +595,18 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session) globals.calls = 0; } + DEBUGA_SKYPE("debugging_hangup 9\n", SKYPOPEN_P_LOG); tech_pvt->interface_state = SKYPOPEN_STATE_IDLE; if (tech_pvt->skype_callflow == CALLFLOW_STATUS_FINISHED) { tech_pvt->skype_callflow = CALLFLOW_CALL_IDLE; } + DEBUGA_SKYPE("debugging_hangup 10\n", SKYPOPEN_P_LOG); switch_mutex_unlock(globals.mutex); + }else{ + WARNINGA("FYI %s CHANNEL has no tech_pvt in his private\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); + DEBUGA_SKYPE("debugging_hangup 11\n", SKYPOPEN_P_LOG); + } + DEBUGA_SKYPE("debugging_hangup 12\n", SKYPOPEN_P_LOG); return SWITCH_STATUS_SUCCESS; } @@ -595,9 +654,9 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int switch_assert(channel != NULL); tech_pvt = switch_core_session_get_private(session); - switch_assert(tech_pvt != NULL); //DEBUGA_SKYPE("%s CHANNEL KILL_CHANNEL\n", SKYPOPEN_P_LOG, tech_pvt->name); + if(tech_pvt){ switch (sig) { case SWITCH_SIG_KILL: switch_mutex_lock(tech_pvt->flag_mutex); @@ -606,10 +665,10 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int DEBUGA_SKYPE("FYI %s CHANNEL in CALLFLOW_STATUS_REMOTEHOLD got SWITCH_SIG_KILL\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); } if (switch_channel_get_state(channel) == CS_NEW) { - ERRORA("FYI %s CHANNEL in CS_NEW state got SWITCH_SIG_KILL\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); + WARNINGA("FYI %s CHANNEL in CS_NEW state got SWITCH_SIG_KILL\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); } if (switch_channel_get_state(channel) != CS_NEW && switch_channel_get_state(channel) < CS_EXECUTE) { - ERRORA("FYI %s CHANNEL in %d state got SWITCH_SIG_KILL\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel), switch_channel_get_state(channel)); + WARNINGA("FYI %s CHANNEL in %d state got SWITCH_SIG_KILL\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel), switch_channel_get_state(channel)); } switch_clear_flag(tech_pvt, TFLAG_IO); switch_clear_flag(tech_pvt, TFLAG_VOICE); @@ -620,6 +679,12 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int switch_mutex_unlock(tech_pvt->flag_mutex); sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->ring_id); skypopen_signaling_write(tech_pvt, msg_to_skype); + sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->ring_id); + skypopen_signaling_write(tech_pvt, msg_to_skype); + sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->skype_call_id); + skypopen_signaling_write(tech_pvt, msg_to_skype); + sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id); + skypopen_signaling_write(tech_pvt, msg_to_skype); break; case SWITCH_SIG_BREAK: DEBUGA_SKYPE("%s CHANNEL got SWITCH_SIG_BREAK\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); @@ -630,6 +695,9 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int default: break; } + }else{ + WARNINGA("FYI %s CHANNEL has no tech_pvt in his private\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); + } return SWITCH_STATUS_SUCCESS; } @@ -720,8 +788,13 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch tech_pvt->read_frame.flags = SFF_NONE; - if (!switch_channel_ready(channel) || !switch_test_flag(tech_pvt, TFLAG_IO)) { + if (!switch_test_flag(tech_pvt, TFLAG_IO)) { + switch_sleep(20000); + return SWITCH_STATUS_FALSE; + } + if (!switch_channel_ready(channel)) { ERRORA("channel not ready \n", SKYPOPEN_P_LOG); + switch_sleep(20000); return SWITCH_STATUS_FALSE; } @@ -917,6 +990,7 @@ static switch_status_t channel_answer_channel(switch_core_session_t *session) { private_t *tech_pvt; switch_channel_t *channel = NULL; + int conta = 0; channel = switch_core_session_get_channel(session); switch_assert(channel != NULL); @@ -932,6 +1006,10 @@ static switch_status_t channel_answer_channel(switch_core_session_t *session) return SWITCH_STATUS_FALSE; } switch_sleep(5000); + conta++; + if(conta == 100){ //0.5 seconds + return SWITCH_STATUS_FALSE; + } } switch_mutex_lock(globals.mutex); globals.calls++; @@ -973,6 +1051,12 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s if(switch_set_flag(tech_pvt, TFLAG_PROGRESS)){ sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->ring_id); skypopen_signaling_write(tech_pvt, msg_to_skype); + sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->ring_id); + skypopen_signaling_write(tech_pvt, msg_to_skype); + sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->skype_call_id); + skypopen_signaling_write(tech_pvt, msg_to_skype); + sprintf(msg_to_skype, "ALTER CALL %s HANGUP", tech_pvt->skype_call_id); + skypopen_signaling_write(tech_pvt, msg_to_skype); switch_clear_flag(tech_pvt, TFLAG_PROGRESS); } } @@ -1585,6 +1669,8 @@ static switch_status_t load_config(int reload_type) skypopen_audio_init(&globals.SKYPOPEN_INTERFACES[interface_id]); switch_mutex_init(&globals.SKYPOPEN_INTERFACES[interface_id].mutex_audio_srv, SWITCH_MUTEX_NESTED, skypopen_module_pool); switch_mutex_init(&globals.SKYPOPEN_INTERFACES[interface_id].mutex_audio_cli, SWITCH_MUTEX_NESTED, skypopen_module_pool); + switch_mutex_init(&globals.SKYPOPEN_INTERFACES[interface_id].mutex_thread_audio_srv, SWITCH_MUTEX_NESTED, skypopen_module_pool); + switch_mutex_init(&globals.SKYPOPEN_INTERFACES[interface_id].mutex_thread_audio_cli, SWITCH_MUTEX_NESTED, skypopen_module_pool); NOTICA ("WAITING roughly 10 seconds to find a running Skype client and connect to its SKYPE API for interface_id=%d\n", @@ -2020,22 +2106,34 @@ int start_audio_threads(private_t * tech_pvt) switch_threadattr_create(&thd_attr, skypopen_module_pool); switch_threadattr_detach_set(thd_attr, 0); switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); + switch_mutex_lock(tech_pvt->mutex_thread_audio_srv); + DEBUGA_SKYPE("debugging_hangup srv lock\n", SKYPOPEN_P_LOG); if (switch_thread_create(&tech_pvt->tcp_srv_thread, thd_attr, skypopen_do_tcp_srv_thread, tech_pvt, skypopen_module_pool) == SWITCH_STATUS_SUCCESS) { DEBUGA_SKYPE("started tcp_srv_thread thread.\n", SKYPOPEN_P_LOG); } else { ERRORA("failed to start tcp_srv_thread thread.\n", SKYPOPEN_P_LOG); + switch_mutex_unlock(tech_pvt->mutex_thread_audio_srv); + DEBUGA_SKYPE("debugging_hangup srv unlock\n", SKYPOPEN_P_LOG); return -1; } + switch_mutex_unlock(tech_pvt->mutex_thread_audio_srv); + DEBUGA_SKYPE("debugging_hangup srv unlock\n", SKYPOPEN_P_LOG); switch_threadattr_create(&thd_attr, skypopen_module_pool); switch_threadattr_detach_set(thd_attr, 0); switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); + switch_mutex_lock(tech_pvt->mutex_thread_audio_cli); + DEBUGA_SKYPE("debugging_hangup cli lock\n", SKYPOPEN_P_LOG); if (switch_thread_create(&tech_pvt->tcp_cli_thread, thd_attr, skypopen_do_tcp_cli_thread, tech_pvt, skypopen_module_pool) == SWITCH_STATUS_SUCCESS) { DEBUGA_SKYPE("started tcp_cli_thread thread.\n", SKYPOPEN_P_LOG); } else { ERRORA("failed to start tcp_cli_thread thread.\n", SKYPOPEN_P_LOG); + switch_mutex_unlock(tech_pvt->mutex_thread_audio_cli); + DEBUGA_SKYPE("debugging_hangup cli unlock\n", SKYPOPEN_P_LOG); return -1; } + switch_mutex_unlock(tech_pvt->mutex_thread_audio_cli); + DEBUGA_SKYPE("debugging_hangup cli unlock\n", SKYPOPEN_P_LOG); switch_sleep(100000); if (tech_pvt->tcp_cli_thread == NULL || tech_pvt->tcp_srv_thread == NULL) { @@ -2487,6 +2585,8 @@ int skypopen_partner_handle_ring(private_t * tech_pvt) DEBUGA_SKYPE("We're in a call now (%s), let's refuse this one (%s)\n", SKYPOPEN_P_LOG, tech_pvt->skype_call_id, id); sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", id); skypopen_signaling_write(tech_pvt, msg_to_skype); + sprintf(msg_to_skype, "ALTER CALL %s HANGUP", id); + skypopen_signaling_write(tech_pvt, msg_to_skype); } switch_mutex_unlock(globals.mutex); @@ -2528,17 +2628,22 @@ int skypopen_answer(private_t * tech_pvt) if (!zstr(tech_pvt->session_uuid_str)) { session = switch_core_session_locate(tech_pvt->session_uuid_str); } else { - ERRORA("No session???\n", SKYPOPEN_P_LOG); + ERRORA("No session_uuid_str???\n", SKYPOPEN_P_LOG); + break; } if (session) { channel = switch_core_session_get_channel(session); } else { ERRORA("No session???\n", SKYPOPEN_P_LOG); + switch_core_session_rwunlock(session); + break; } if (channel) { switch_channel_set_state(channel, CS_RESET); } else { ERRORA("No channel???\n", SKYPOPEN_P_LOG); + switch_core_session_rwunlock(session); + break; } switch_core_session_rwunlock(session); @@ -2579,6 +2684,8 @@ int skypopen_answer(private_t * tech_pvt) DEBUGA_SKYPE("We're in a call now (%s), let's refuse this one (%s)\n", SKYPOPEN_P_LOG, tech_pvt->skype_call_id, id); sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", id); skypopen_signaling_write(tech_pvt, msg_to_skype); + sprintf(msg_to_skype, "ALTER CALL %s HANGUP", id); + skypopen_signaling_write(tech_pvt, msg_to_skype); } switch_mutex_unlock(globals.mutex); @@ -2752,6 +2859,8 @@ int skypopen_transfer(private_t * tech_pvt) SKYPOPEN_P_LOG, id, tech_pvt->skype_call_id); sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", id); skypopen_signaling_write(tech_pvt, msg_to_skype); + sprintf(msg_to_skype, "ALTER CALL %s HANGUP", id); + skypopen_signaling_write(tech_pvt, msg_to_skype); } switch_sleep(10000); DEBUGA_SKYPE diff --git a/src/mod/endpoints/mod_skypopen/skypopen.h b/src/mod/endpoints/mod_skypopen/skypopen.h index d678ba2..a67bfb2 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen.h +++ b/src/mod/endpoints/mod_skypopen/skypopen.h @@ -307,6 +307,8 @@ struct private_object { short audiobuf_srv[SAMPLES_PER_FRAME]; switch_mutex_t *mutex_audio_srv; int flag_audio_srv; + switch_mutex_t *mutex_thread_audio_cli; + switch_mutex_t *mutex_thread_audio_srv; FILE *phonebook_writing_fp; int skypopen_dir_entry_extension_prefix; diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index b034365..f48d855 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -554,6 +554,8 @@ int skypopen_signaling_read(private_t * tech_pvt) char msg_to_skype[1024]; skypopen_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1); ERRORA("We are in a double call situation, trying to get out hanging up call id: %s.\n", SKYPOPEN_P_LOG, id); + sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", id); + skypopen_signaling_write(tech_pvt, msg_to_skype); sprintf(msg_to_skype, "ALTER CALL %s HANGUP", id); skypopen_signaling_write(tech_pvt, msg_to_skype); skypopen_sleep(10000); @@ -590,6 +592,8 @@ int skypopen_signaling_read(private_t * tech_pvt) if( !remote_party_is_ringing(tech_pvt)){ WARNINGA("We are getting the RINGING from a call we canceled, trying to get out hanging up call id: %s.\n", SKYPOPEN_P_LOG, id); + sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", id); + skypopen_signaling_write(tech_pvt, msg_to_skype); sprintf(msg_to_skype, "ALTER CALL %s HANGUP", id); skypopen_signaling_write(tech_pvt, msg_to_skype); tech_pvt->skype_call_id[0] = '\0'; @@ -925,7 +929,12 @@ void *skypopen_do_tcp_srv_thread_func(void *obj) DEBUGA_SKYPE("incoming audio (read) server (I am it) EXITING\n", SKYPOPEN_P_LOG); skypopen_close_socket(s); s = -1; + DEBUGA_SKYPE("debugging_hangup PRE srv lock\n", SKYPOPEN_P_LOG); + switch_mutex_lock(tech_pvt->mutex_thread_audio_srv); + DEBUGA_SKYPE("debugging_hangup srv lock\n", SKYPOPEN_P_LOG); tech_pvt->tcp_srv_thread = NULL; + switch_mutex_unlock(tech_pvt->mutex_thread_audio_srv); + DEBUGA_SKYPE("debugging_hangup srv unlock\n", SKYPOPEN_P_LOG); return NULL; } @@ -1070,7 +1079,12 @@ void *skypopen_do_tcp_cli_thread_func(void *obj) DEBUGA_SKYPE("outbound audio server (I am it) EXITING\n", SKYPOPEN_P_LOG); skypopen_close_socket(s); s = -1; + DEBUGA_SKYPE("debugging_hangup PRE cli lock\n", SKYPOPEN_P_LOG); + switch_mutex_lock(tech_pvt->mutex_thread_audio_cli); + DEBUGA_SKYPE("debugging_hangup cli lock\n", SKYPOPEN_P_LOG); tech_pvt->tcp_cli_thread = NULL; + switch_mutex_unlock(tech_pvt->mutex_thread_audio_cli); + DEBUGA_SKYPE("debugging_hangup cli unlock\n", SKYPOPEN_P_LOG); return NULL; } commit 01fb67aeca21a0e277958439496a4dd188253f9e Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Mon Oct 25 16:09:10 2010 -0500 skypopen: better checking audio buffers not destroyed diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index 3fc9aaa..b034365 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -597,7 +597,7 @@ int skypopen_signaling_read(private_t * tech_pvt) tech_pvt->ringing_state = SKYPOPEN_RINGING_INIT; tech_pvt->skype_callflow = CALLFLOW_CALL_IDLE; tech_pvt->interface_state = SKYPOPEN_STATE_IDLE; - ERRORA("we're back to IDLE\n", SKYPOPEN_P_LOG, id); + WARNINGA("we're back to IDLE\n", SKYPOPEN_P_LOG); skypopen_sleep(10000); } @@ -885,12 +885,14 @@ void *skypopen_do_tcp_srv_thread_func(void *obj) nospace = 0; if (len > 0) { switch_mutex_lock(tech_pvt->mutex_audio_srv); - if (switch_buffer_freespace(tech_pvt->read_buffer) < len) { - switch_buffer_zero(tech_pvt->read_buffer); - nospace = 1; - //switch_buffer_toss(tech_pvt->read_buffer, len); + if(tech_pvt->read_buffer){ + if (switch_buffer_freespace(tech_pvt->read_buffer) < len) { + switch_buffer_zero(tech_pvt->read_buffer); + nospace = 1; + //switch_buffer_toss(tech_pvt->read_buffer, len); + } + switch_buffer_write(tech_pvt->read_buffer, srv_in, len); } - switch_buffer_write(tech_pvt->read_buffer, srv_in, len); switch_mutex_unlock(tech_pvt->mutex_audio_srv); if (nospace) { DEBUGA_SKYPE("NO SPACE READ: there was no space for: %d\n", SKYPOPEN_P_LOG, len); @@ -1028,7 +1030,7 @@ void *skypopen_do_tcp_cli_thread_func(void *obj) break; } switch_mutex_lock(tech_pvt->mutex_audio_cli); - if (switch_buffer_inuse(tech_pvt->write_buffer)) { + if (tech_pvt->write_buffer && switch_buffer_inuse(tech_pvt->write_buffer)) { bytes_to_write = switch_buffer_read(tech_pvt->write_buffer, cli_out, 640); } switch_mutex_unlock(tech_pvt->mutex_audio_cli); commit f04322e9bb708fcc105c77e3e0cf699625a1597e Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Mon Oct 25 15:36:12 2010 -0500 skypopen: CLOUDTREE patch with some modifications diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index e832887..5837cbe 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -159,12 +159,23 @@ static struct { switch_mutex_t *mutex; private_t *sk_console; int start_port; + + // CLOUDTREE (THomas Hazel) + switch_mutex_t *list_mutex; + } globals; switch_endpoint_interface_t *skypopen_endpoint_interface; switch_memory_pool_t *skypopen_module_pool = NULL; int running = 0; +// CLOUDTREE (THomas Hazel) +#ifndef WIN32 +struct SkypopenList global_handles_list; +extern int xio_error_handler(Display *dpy); +extern int X11_errors_handler(Display * dpy, XErrorEvent * err); +#endif + SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_context, globals.context); SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan); SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_destination, globals.destination); @@ -175,7 +186,7 @@ SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_write_silence_when_idle, globals.wr SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_setsockopt, globals.setsockopt); static switch_status_t interface_exists(char *the_interface); -static switch_status_t remove_interface(char *the_interface); +/* CLOUDTREE (Thomas Hazel) static*/ switch_status_t remove_interface(char *the_interface, /* CLOUDTREE (Thomas Hazel */ switch_bool_t force); static switch_status_t channel_on_init(switch_core_session_t *session); static switch_status_t channel_on_hangup(switch_core_session_t *session); @@ -298,7 +309,7 @@ static switch_status_t interface_exists(char *the_interface) return SWITCH_STATUS_FALSE; } -static switch_status_t remove_interface(char *the_interface) +/* CLOUDTREE (Thomas Hazel) static */ switch_status_t remove_interface(char *the_interface, /* CLOUDTREE (Thomas Hazel) */ switch_bool_t force) { int x = 10; unsigned int howmany = 8; @@ -338,7 +349,7 @@ static switch_status_t remove_interface(char *the_interface) goto end; } - if (strlen(globals.SKYPOPEN_INTERFACES[interface_id].session_uuid_str)) { + if (/* CLOUDTREE (Thomas Hazel) */ (force == FALSE) && strlen(globals.SKYPOPEN_INTERFACES[interface_id].session_uuid_str)) { DEBUGA_SKYPE("interface '%s' is busy\n", SKYPOPEN_P_LOG, the_interface); goto end; } @@ -743,7 +754,7 @@ read: || tech_pvt->skype_callflow == CALLFLOW_STATUS_EARLYMEDIA || tech_pvt->skype_callflow == CALLFLOW_STATUS_REMOTEHOLD || tech_pvt->skype_callflow == SKYPOPEN_STATE_UP)) { switch_mutex_lock(tech_pvt->mutex_audio_srv); - if (switch_buffer_inuse(tech_pvt->read_buffer)) { + if (tech_pvt->read_buffer && switch_buffer_inuse(tech_pvt->read_buffer)) { bytes_read = switch_buffer_read(tech_pvt->read_buffer, tech_pvt->read_frame.data, 640); tech_pvt->read_frame.datalen = bytes_read; } @@ -1232,6 +1243,7 @@ static void *SWITCH_THREAD_FUNC skypopen_signaling_thread_func(switch_thread_t * private_t *tech_pvt = obj; int res; int forever = 1; + switch_event_t *event; if (!tech_pvt) return NULL; @@ -1242,6 +1254,14 @@ static void *SWITCH_THREAD_FUNC skypopen_signaling_thread_func(switch_thread_t * if (!(running && tech_pvt->running)) break; res = skypopen_signaling_read(tech_pvt); + + if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_INCOMING_RAW) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "X-Skype-Response-Code", "%d", res); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "X-Skype-Interface", "%s", tech_pvt->interface_id); + switch_event_add_body(event, "%s", tech_pvt->message); + switch_event_fire(&event); + } + if (res == CALLFLOW_INCOMING_HANGUP || tech_pvt->skype_callflow == CALLFLOW_INCOMING_HANGUP) { switch_core_session_t *session = NULL; switch_channel_t *channel = NULL; @@ -1266,6 +1286,7 @@ static void *SWITCH_THREAD_FUNC skypopen_signaling_thread_func(switch_thread_t * DEBUGA_SKYPE("no session\n", SKYPOPEN_P_LOG); } switch_mutex_lock(globals.mutex); + tech_pvt->ringing_state = SKYPOPEN_RINGING_INIT; tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; *tech_pvt->session_uuid_str = '\0'; *tech_pvt->skype_call_id = '\0'; @@ -1299,6 +1320,9 @@ static switch_status_t load_config(int reload_type) switch_xml_t cfg, xml, global_settings, param, interfaces, myinterface; private_t *tech_pvt = NULL; + // CLOUDTREE (Thomas Hazel) - always try to load configuration + running = 1; + switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, skypopen_module_pool); if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) { ERRORA("open of %s failed\n", SKYPOPEN_P_LOG, cf); @@ -1769,18 +1793,36 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skypopen_load) skypopen_module_pool = pool; memset(&globals, '\0', sizeof(globals)); - running = 1; + // CLOUDTREE (Thomas Hazel) + #ifndef WIN32 + // XXX: these assumes no one will override + XSetErrorHandler(X11_errors_handler); + XSetIOErrorHandler(xio_error_handler); + + memset(&global_handles_list, 0, sizeof(global_handles_list)); + switch_mutex_init(&globals.list_mutex, SWITCH_MUTEX_NESTED, skypopen_module_pool); + #endif - if (load_config(FULL_RELOAD) != SWITCH_STATUS_SUCCESS) { + // CLOUDTREE (Thomas Hazel) - load_configs no longer locks things up, no need to fail load + /*if (*/ load_config(FULL_RELOAD); /* != SWITCH_STATUS_SUCCESS) { running = 0; return SWITCH_STATUS_FALSE; } + */ + + // CLOUDTREE (Thomas Hazel) - setting "running = 1;" use to be located before "load_config" + running = 1; if (switch_event_reserve_subclass(MY_EVENT_INCOMING_CHATMESSAGE) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass!\n"); return SWITCH_STATUS_GENERR; } + if (switch_event_reserve_subclass(MY_EVENT_INCOMING_RAW) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass!\n"); + return SWITCH_STATUS_GENERR; + } + *module_interface = switch_loadable_module_create_module_interface(pool, modname); skypopen_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE); skypopen_endpoint_interface->interface_name = "skypopen"; @@ -1794,7 +1836,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skypopen_load) SWITCH_ADD_API(commands_api_interface, "skypopen_chat", "Skypopen_chat interface remote_skypename TEXT", skypopen_chat_function, SKYPOPEN_CHAT_SYNTAX); SWITCH_ADD_CHAT(chat_interface, MDL_CHAT_PROTO, chat_send); - /* indicate that the module should continue to be loaded */ return SWITCH_STATUS_SUCCESS; } else @@ -1814,6 +1855,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypopen_shutdown) for (interface_id = 0; interface_id < SKYPOPEN_MAX_INTERFACES; interface_id++) { tech_pvt = &globals.SKYPOPEN_INTERFACES[interface_id]; + if (strlen(globals.SKYPOPEN_INTERFACES[interface_id].name)) { if (globals.SKYPOPEN_INTERFACES[interface_id].skypopen_signaling_thread) { #ifdef WIN32 @@ -1888,6 +1930,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skypopen_shutdown) } switch_event_free_subclass(MY_EVENT_INCOMING_CHATMESSAGE); + switch_event_free_subclass(MY_EVENT_INCOMING_RAW); switch_safe_free(globals.context); switch_safe_free(globals.dialplan); @@ -2058,14 +2101,14 @@ int remote_party_is_ringing(private_t * tech_pvt) if (!zstr(tech_pvt->session_uuid_str)) { session = switch_core_session_locate(tech_pvt->session_uuid_str); } else { - ERRORA("No session???\n", SKYPOPEN_P_LOG); - goto done; + ERRORA("No session_uuid_str???\n", SKYPOPEN_P_LOG); + goto bad; } if (session) { channel = switch_core_session_get_channel(session); } else { ERRORA("No session???\n", SKYPOPEN_P_LOG); - goto done; + goto bad; } if (channel) { switch_channel_mark_ring_ready(channel); @@ -2076,7 +2119,8 @@ int remote_party_is_ringing(private_t * tech_pvt) switch_core_session_rwunlock(session); - done: + return 1; + bad: return 0; } @@ -2088,7 +2132,7 @@ int remote_party_is_early_media(private_t * tech_pvt) if (!zstr(tech_pvt->session_uuid_str)) { session = switch_core_session_locate(tech_pvt->session_uuid_str); } else { - ERRORA("No session???\n\n\n", SKYPOPEN_P_LOG); + ERRORA("No session_uuid_str???\n\n\n", SKYPOPEN_P_LOG); goto done; } if (session) { @@ -2276,7 +2320,7 @@ SWITCH_STANDARD_API(sk_function) } } else if (!strcasecmp(argv[0], "remove")) { if (argc == 2) { - if (remove_interface(argv[1]) == SWITCH_STATUS_SUCCESS) { + if (remove_interface(argv[1], FALSE) == SWITCH_STATUS_SUCCESS) { if (interface_exists(argv[1]) == SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "sk remove '%s' failed\n", argv[1]); } else { @@ -2399,7 +2443,9 @@ int skypopen_partner_handle_ring(private_t * tech_pvt) } DEBUGA_SKYPE("NOT FOUND\n", SKYPOPEN_P_LOG); - if (tech_pvt && tech_pvt->skype_call_id && !strlen(tech_pvt->skype_call_id)) { + // CLOUDTREE (Thomas Hazel) + //if (tech_pvt && tech_pvt->skype_call_id && !strlen(tech_pvt->skype_call_id)) { + if (tech_pvt && tech_pvt->ringing_state == SKYPOPEN_RINGING_INIT) { /* we are not inside an active call */ tech_pvt->interface_state = SKYPOPEN_STATE_PRERING; @@ -2508,7 +2554,9 @@ int skypopen_answer(private_t * tech_pvt) } DEBUGA_SKYPE("NOT FOUND\n", SKYPOPEN_P_LOG); - if (tech_pvt && tech_pvt->skype_call_id && !strlen(tech_pvt->skype_call_id)) { + // CLOUDTREE (Thomas Hazel) + //if (tech_pvt && tech_pvt->skype_call_id && !strlen(tech_pvt->skype_call_id)) { + if (tech_pvt && tech_pvt->ringing_state == SKYPOPEN_RINGING_INIT) { /* we are not inside an active call */ tech_pvt->ib_calls++; @@ -2853,6 +2901,151 @@ int next_port(void) return (globals.start_port - 1); } +#ifndef WIN32 +// CLOUDTREE (THomas Hazel) - is there a capable freeswitch list? +struct SkypopenHandles* skypopen_list_add(struct SkypopenList* list, struct SkypopenHandles* handle) +{ + switch_mutex_lock(globals.list_mutex); + + if (handle->managed == SWITCH_TRUE) { + // already added + switch_mutex_unlock(globals.list_mutex); + return 0; + } + + if (list->head == 0) { + list->head = handle; + handle->prev = 0; + + } else { + ((struct SkypopenHandles*) list->tail)->next = handle; + ((struct SkypopenHandles*) handle)->prev = list->tail; + } + + list->tail = handle; + handle->next = 0; + + handle->managed = SWITCH_TRUE; + + list->entries++; + + switch_mutex_unlock(globals.list_mutex); + + return handle; +} + +// CLOUDTREE (THomas Hazel) - is there a capable freeswitch list? +struct SkypopenHandles* skypopen_list_remove_by_value(struct SkypopenList* list, Display* display) +{ + struct SkypopenHandles* iter; + struct SkypopenHandles* handle = 0; + + switch_mutex_lock(globals.list_mutex); + + iter = (struct SkypopenHandles*) list->head; + while (iter != 0) { + if (iter->disp == display) { + handle = iter; + break; + } + + iter = (struct SkypopenHandles*) iter->next; + } + + if ((handle != 0) && (handle->managed == SWITCH_TRUE)) { + if (handle->prev == 0) { + list->head = ((struct SkypopenHandles*) handle)->next; + + } else { + ((struct SkypopenHandles*) handle->prev)->next = ((struct SkypopenHandles*) handle)->next; + } + + if (handle->next == 0) { + list->tail = ((struct SkypopenHandles*) handle)->prev; + + } else { + ((struct SkypopenHandles*) handle->next)->prev = ((struct SkypopenHandles*) handle)->prev; + } + + handle->managed = SWITCH_FALSE; + handle->next = 0; + handle->prev = 0; + + list->entries--; + } + + switch_mutex_unlock(globals.list_mutex); + + return handle; +} + +// CLOUDTREE (THomas Hazel) - is there a capable freeswitch list? +struct SkypopenHandles* skypopen_list_remove_by_reference(struct SkypopenList* list, struct SkypopenHandles* handle) +{ + switch_mutex_lock(globals.list_mutex); + + if (handle->managed == SWITCH_FALSE) { + // already removed + switch_mutex_unlock(globals.list_mutex); + return 0; + } + + if (handle->prev == 0) { + list->head = ((struct SkypopenHandles*) handle)->next; + + } else { + ((struct SkypopenHandles*) handle->prev)->next = ((struct SkypopenHandles*) handle)->next; + } + + if (handle->next == 0) { + list->tail = ((struct SkypopenHandles*) handle)->prev; + + } else { + ((struct SkypopenHandles*) handle->next)->prev = ((struct SkypopenHandles*) handle)->prev; + } + + handle->managed = SWITCH_FALSE; + handle->next = 0; + handle->prev = 0; + + list->entries--; + + switch_mutex_unlock(globals.list_mutex); + + return handle; +} + +// CLOUDTREE (THomas Hazel) - is there a capable freeswitch list? +#ifdef XIO_ERROR_BY_UCONTEXT +struct SkypopenHandles* skypopen_list_find(struct SkypopenList* list, struct SkypopenHandles* find) +{ + struct SkypopenHandles* iter; + struct SkypopenHandles* handle = NULL; + + switch_mutex_lock(globals.list_mutex); + + iter = (struct SkypopenHandles*) list->head; + while (iter != NULL) { + if (iter == find) { + handle = iter; + break; + } + + iter = (struct SkypopenHandles*) iter->next; + } + + switch_mutex_unlock(globals.list_mutex); + + return handle; +} +#endif + +// CLOUDTREE (THomas Hazel) - is there a capable freeswitch list? +int skypopen_list_size(struct SkypopenList* list) +{ + return list->entries; +} +#endif /* NOT WIN32 */ /* For Emacs: * Local Variables: diff --git a/src/mod/endpoints/mod_skypopen/skypopen.h b/src/mod/endpoints/mod_skypopen/skypopen.h index 77e00da..d678ba2 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen.h +++ b/src/mod/endpoints/mod_skypopen/skypopen.h @@ -41,6 +41,20 @@ #include <X11/Xlib.h> #include <X11/Xlibint.h> #include <X11/Xatom.h> + +// CLOUDTREE (Thomas Hazel) +#define XIO_ERROR_BY_SETJMP +//#define XIO_ERROR_BY_UCONTEXT + +// CLOUDTREE (Thomas Hazel) +#ifdef XIO_ERROR_BY_SETJMP + #include "setjmp.h" +#endif +// CLOUDTREE (Thomas Hazel) +#ifdef XIO_ERROR_BY_UCONTEXT + #include "ucontext.h" +#endif + #endif //WIN32 #define SPANDSP_EXPOSE_INTERNAL_STRUCTURES @@ -58,6 +72,7 @@ #endif #define MY_EVENT_INCOMING_CHATMESSAGE "skypopen::incoming_chatmessage" +#define MY_EVENT_INCOMING_RAW "skypopen::incoming_raw" #define SAMPLERATE_SKYPOPEN 16000 #define SAMPLES_PER_FRAME SAMPLERATE_SKYPOPEN/50 @@ -100,6 +115,11 @@ typedef enum { #define SKYPOPEN_CONTROL_ANSWER 2 /*********************************/ +// CLOUDTREE (Thomas Hazel) +#define SKYPOPEN_RINGING_INIT 0 +#define SKYPOPEN_RINGING_PRE 1 + +/*********************************/ #define SKYPOPEN_STATE_IDLE 0 #define SKYPOPEN_STATE_DOWN 1 #define SKYPOPEN_STATE_RING 2 @@ -154,7 +174,35 @@ struct SkypopenHandles { int currentuserhandle; int api_connected; int fdesc[2]; + + // CLOUDTREE (Thomas Hazel) + #ifdef XIO_ERROR_BY_SETJMP + jmp_buf ioerror_context; + #endif + #ifdef XIO_ERROR_BY_UCONTEXT + ucontext_t ioerror_context; + #endif + + // CLOUDTREE (Thomas Hazel) - is there a capable freeswitch list? + switch_bool_t managed; + void* prev; + void* next; +}; + +// CLOUDTREE (Thomas Hazel) - is there a capable freeswitch list? +struct SkypopenList { + int entries; + void* head; + void* tail; }; + +// CLOUDTREE (Thomas Hazel) - is there a capable freeswitch list? +struct SkypopenHandles* skypopen_list_add(struct SkypopenList* list, struct SkypopenHandles* x); +struct SkypopenHandles* skypopen_list_find(struct SkypopenList* list, struct SkypopenHandles* x); +struct SkypopenHandles* skypopen_list_remove_by_value(struct SkypopenList* list, Display* display); +struct SkypopenHandles* skypopen_list_remove_by_reference(struct SkypopenList* list, struct SkypopenHandles* x); +int skypopen_list_size(struct SkypopenList* list); + #else //WIN32 struct SkypopenHandles { @@ -218,6 +266,9 @@ struct private_object { #endif struct SkypopenHandles SkypopenHandles; + // CLOUDTREE (Thomas Hazel) + char ringing_state; + int interface_state; char language[80]; char exten[80]; @@ -294,6 +345,7 @@ struct private_object { char ring_id[256]; char ring_value[256]; + char message[4096]; }; typedef struct private_object private_t; diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index ad69980..3fc9aaa 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -21,8 +21,12 @@ extern int running; #ifdef WIN32 DWORD win32_dwThreadId; #else -XErrorHandler old_handler = 0; -int xerror = 0; + +// CLOUDTREE (Thomas Hazel) +static int global_x_error = Success; +extern struct SkypopenList global_handles_list; +extern switch_status_t remove_interface(char *the_interface, switch_bool_t force); + #endif /* WIN32 */ /*************************************/ #ifndef WIN32 @@ -174,6 +178,8 @@ int skypopen_signaling_read(private_t * tech_pvt) //if (!strstr(message, "DURATION")) { DEBUGA_SKYPE("READING: |||%s||| \n", SKYPOPEN_P_LOG, message); + strncpy( tech_pvt->message, message, sizeof(tech_pvt->message) ); + //} if (!strcasecmp(message, "SILENT_MODE OFF")) { if (tech_pvt->silent_mode) { @@ -559,8 +565,10 @@ int skypopen_signaling_read(private_t * tech_pvt) char msg_to_skype[1024]; if ((tech_pvt->interface_state != SKYPOPEN_STATE_SELECTED && tech_pvt->interface_state != SKYPOPEN_STATE_DIALING) && (!strlen(tech_pvt->skype_call_id) || !strlen(tech_pvt->session_uuid_str))) { - /* we are NOT inside an active call */ + // CLOUDTREE (Thomas Hazel) + skypopen_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1); + /* we are NOT inside an active call */ DEBUGA_SKYPE("NO ACTIVE calls in this moment, skype_call %s is RINGING, to ask PARTNER_DISPNAME and PARTNER_HANDLE\n", SKYPOPEN_P_LOG, id); sprintf(msg_to_skype, "GET CALL %s PARTNER_DISPNAME", id); skypopen_signaling_write(tech_pvt, msg_to_skype); @@ -571,12 +579,28 @@ int skypopen_signaling_read(private_t * tech_pvt) } else { /* we are inside an active call */ if (!strcasecmp(tech_pvt->skype_call_id, id)) { + // CLOUDTREE (Thomas Hazel) + tech_pvt->ringing_state = SKYPOPEN_RINGING_PRE; + /* this is the call in which we are calling out */ tech_pvt->skype_callflow = CALLFLOW_STATUS_RINGING; tech_pvt->interface_state = SKYPOPEN_STATE_RINGING; skypopen_strncpy(tech_pvt->skype_call_id, id, sizeof(tech_pvt->skype_call_id) - 1); DEBUGA_SKYPE("Our remote party in skype_call %s is RINGING\n", SKYPOPEN_P_LOG, id); - remote_party_is_ringing(tech_pvt); + if( !remote_party_is_ringing(tech_pvt)){ + + WARNINGA("We are getting the RINGING from a call we canceled, trying to get out hanging up call id: %s.\n", SKYPOPEN_P_LOG, id); + sprintf(msg_to_skype, "ALTER CALL %s HANGUP", id); + skypopen_signaling_write(tech_pvt, msg_to_skype); + tech_pvt->skype_call_id[0] = '\0'; + // CLOUDTREE (Thomas Hazel) + tech_pvt->ringing_state = SKYPOPEN_RINGING_INIT; + tech_pvt->skype_callflow = CALLFLOW_CALL_IDLE; + tech_pvt->interface_state = SKYPOPEN_STATE_IDLE; + ERRORA("we're back to IDLE\n", SKYPOPEN_P_LOG, id); + skypopen_sleep(10000); + + } } else { DEBUGA_SKYPE ("We are in another call, but skype_call %s is RINGING on us, let's ask PARTNER_HANDLE, so maybe we'll TRANSFER\n", @@ -606,9 +630,12 @@ int skypopen_signaling_read(private_t * tech_pvt) skypopen_signaling_write(tech_pvt, msg_to_skype); remote_party_is_early_media(tech_pvt); + /* CLOUDTREE (Thomas Hazel) } else if (!strcasecmp(value, "MISSED")) { DEBUGA_SKYPE("We missed skype_call %s\n", SKYPOPEN_P_LOG, id); - } else if (!strcasecmp(value, "FINISHED")) { + */ + // CLOUDTREE (Thomas Hazel) + } else if (!strcasecmp(value, "MISSED") || !strcasecmp(value, "FINISHED")) { if (!strcasecmp(tech_pvt->skype_call_id, id)) { DEBUGA_SKYPE("skype_call %s is MY call, now I'm going DOWN\n", SKYPOPEN_P_LOG, id); if (tech_pvt->interface_state != SKYPOPEN_STATE_HANGUP_REQUESTED) { @@ -1425,26 +1452,38 @@ void *skypopen_do_skypeapi_thread_func(void *obj) } #else /* NOT WIN32 */ -int X11_errors_handler(Display * dpy, XErrorEvent * err) + +// CLOUDTREE (Thomas Hazel) +int xio_error_handler(Display *dpy) { private_t *tech_pvt = NULL; - (void) dpy; + struct SkypopenHandles* handle; + + ERRORA("Fatal display error for %d, %s\n", SKYPOPEN_P_LOG, skypopen_list_size(&global_handles_list), dpy->display_name); + + handle = skypopen_list_remove_by_value(&global_handles_list, dpy); + if (handle != NULL) { + #ifdef XIO_ERROR_BY_SETJMP + siglongjmp(handle->ioerror_context, 1); + #endif + #ifdef XIO_ERROR_BY_UCONTEXT + setcontext(&handle->ioerror_context); + #endif + } - xerror = err->error_code; - ERRORA("Received error code %d from X Server\n\n", SKYPOPEN_P_LOG, xerror); - return 0; /* ignore the error */ -} + ERRORA("Fatal display error for %p, %s - failed to siglongjmp\n", SKYPOPEN_P_LOG, (void*) handle, dpy->display_name); -static void X11_errors_trap(void) -{ - xerror = 0; - old_handler = XSetErrorHandler(X11_errors_handler); + return 0; } -static int X11_errors_untrap(void) +int X11_errors_handler(Display * dpy, XErrorEvent * err) { - XSetErrorHandler(old_handler); - return (xerror != BadValue) && (xerror != BadWindow); + private_t *tech_pvt = NULL; + (void) dpy; + + global_x_error = err->error_code; + ERRORA("Received error code %d from X Server\n\n", SKYPOPEN_P_LOG, global_x_error); + return 0; /* ignore the error */ } int skypopen_send_message(private_t * tech_pvt, const char *message_P) @@ -1453,7 +1492,6 @@ int skypopen_send_message(private_t * tech_pvt, const char *message_P) Window w_P = SkypopenHandles->skype_win; Display *disp = SkypopenHandles->disp; Window handle_P = SkypopenHandles->win; - int ok; Atom atom1 = XInternAtom(disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False); @@ -1472,7 +1510,9 @@ skypopen_sleep(1000);//giovanni e.xclient.window = handle_P; e.xclient.format = 8; - X11_errors_trap(); + // CLOUDTREE (Thomas Hazel) + global_x_error = Success; + do { unsigned int i; for (i = 0; i < 20 && i + pos <= len; ++i) @@ -1485,10 +1525,10 @@ skypopen_sleep(1000);//giovanni //giovanni XSync(disp, False); XFlush(disp); - ok = X11_errors_untrap(); - if (!ok) { - ERRORA("Sending message failed with status %d\n", SKYPOPEN_P_LOG, xerror); + // CLOUDTREE (Thomas Hazel) + if (global_x_error != Success) { + ERRORA("Sending message failed with status %d\n", SKYPOPEN_P_LOG, global_x_error); tech_pvt->running = 0; return 0; } @@ -1525,11 +1565,9 @@ int skypopen_present(struct SkypopenHandles *SkypopenHandles) int status; private_t *tech_pvt = NULL; - X11_errors_trap(); status = XGetWindowProperty(SkypopenHandles->disp, DefaultRootWindow(SkypopenHandles->disp), skype_inst, 0, 1, False, XA_WINDOW, &type_ret, &format_ret, &nitems_ret, &bytes_after_ret, &prop); - X11_errors_untrap(); /* sanity check */ if (status != Success || format_ret != 32 || nitems_ret != 1) { @@ -1597,11 +1635,65 @@ void *skypopen_do_skypeapi_thread_func(void *obj) if (!disp) { ERRORA("Cannot open X Display '%s', exiting skype thread\n", SKYPOPEN_P_LOG, tech_pvt->X11_display); running = 0; + + // CLOUDTREE (Thomas Hazel) + tech_pvt->skypopen_api_thread = NULL; + remove_interface(tech_pvt->skype_user, FALSE); return NULL; } else { DEBUGA_SKYPE("X Display '%s' opened\n", SKYPOPEN_P_LOG, tech_pvt->X11_display); } + // CLOUDTREE (Thomas Hazel) + #ifndef WIN32 + { + skypopen_list_add(&global_handles_list, SkypopenHandles); + + #ifdef XIO_ERROR_BY_SETJMP + if (sigsetjmp(SkypopenHandles->ioerror_context, 1) != 0) { + switch_core_session_t *session = NULL; + ERRORA("Fatal display error for %s - successed to jump\n", SKYPOPEN_P_LOG, tech_pvt->X11_display); + + session = switch_core_session_locate(tech_pvt->session_uuid_str); + if (session) { + switch_channel_t *channel = switch_core_session_get_channel(session); + WARNINGA("Closing session %s\n", SKYPOPEN_P_LOG, tech_pvt->skype_user); + switch_channel_hangup(channel, SWITCH_CAUSE_CRASH); + switch_core_session_rwunlock(session); + } + + WARNINGA("Removing skype user %s\n", SKYPOPEN_P_LOG, tech_pvt->skype_user); + tech_pvt->skypopen_api_thread = NULL; + remove_interface(tech_pvt->skype_user, TRUE); + XCloseDisplay(disp); + return NULL; + } + #endif + #ifdef XIO_ERROR_BY_UCONTEXT + getcontext(&SkypopenHandles->ioerror_context); + + if (skypopen_list_find(&global_handles_list, SkypopenHandles) == NULL) { + switch_core_session_t *session = NULL; + ERRORA("Fatal display error for %s - successed to jump\n", SKYPOPEN_P_LOG, tech_pvt->X11_display); + + session = switch_core_session_locate(tech_pvt->session_uuid_str); + if (session) { + switch_channel_t *channel = switch_core_session_get_channel(session); + WARNINGA("Closing session %s\n", SKYPOPEN_P_LOG, tech_pvt->skype_user); + switch_channel_hangup(channel, SWITCH_CAUSE_CRASH); + switch_core_session_rwunlock(session); + } + + WARNINGA("Removing skype user %s\n", SKYPOPEN_P_LOG, tech_pvt->skype_user); + tech_pvt->skypopen_api_thread = NULL; + remove_interface(tech_pvt->skype_user, TRUE); + XCloseDisplay(disp); + return NULL; + } + #endif + } + #endif /* NOT WIN32 */ + xfd = XConnectionNumber(disp); fcntl(xfd, F_SETFD, FD_CLOEXEC); @@ -1617,6 +1709,13 @@ void *skypopen_do_skypeapi_thread_func(void *obj) if (!skypopen_send_message(tech_pvt, buf)) { ERRORA("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypopen again\n", SKYPOPEN_P_LOG); + + // CLOUDTREE (Thomas Hazel) + #ifndef WIN32 + skypopen_list_remove_by_reference(&global_handles_list, SkypopenHandles); + #endif + + XCloseDisplay(disp); running = 0; return NULL; } @@ -1624,6 +1723,13 @@ void *skypopen_do_skypeapi_thread_func(void *obj) snprintf(buf, 512, "PROTOCOL 7"); if (!skypopen_send_message(tech_pvt, buf)) { ERRORA("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypopen again\n", SKYPOPEN_P_LOG); + + // CLOUDTREE (Thomas Hazel) + #ifndef WIN32 + skypopen_list_remove_by_reference(&global_handles_list, SkypopenHandles); + #endif + + XCloseDisplay(disp); running = 0; return NULL; } @@ -1750,8 +1856,16 @@ while(XPending(disp)){ ERRORA("Skype is not running, maybe crashed. Please run/restart Skype and relaunch Skypopen\n", SKYPOPEN_P_LOG); running = 0; } - tech_pvt->skypopen_api_thread=NULL; + NOTICA("EXITING\n", SKYPOPEN_P_LOG); + + // CLOUDTREE (Thomas Hazel) + #ifndef WIN32 + skypopen_list_remove_by_reference(&global_handles_list, SkypopenHandles); + #endif + + tech_pvt->skypopen_api_thread=NULL; + XCloseDisplay(disp); return NULL; } commit 7fce3995df517890340d1b050c67fb62ea7a79af Author: Mathieu Rene <mrene@avgs.ca> Date: Wed Oct 27 09:35:20 2010 -0400 oops diff --git a/src/switch_utils.c b/src/switch_utils.c index b0d04cc..4c0ac32 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -2522,8 +2522,9 @@ static inline dow_t _dow_read_token(const char **s) (*s)++; return DOW_COMA; } else if (**s >= '0' && **s <= '9') { + dow_t r = **s - '0'; (*s)++; - return **s; + return r; } else if ((i = switch_dow_str2int(*s)) && i != -1) { (*s) += 3; return i; commit b639aebd621d1ab8d978333867dc8ce86a20e725 Author: Mathieu Rene <mrene@avgs.ca> Date: Wed Oct 27 00:57:13 2010 -0400 fix dow to support multiple coma-separated conditions. BLUEBOX-133 diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 924dcd2..3a4f8b2 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -711,7 +711,7 @@ SWITCH_DECLARE(int) switch_inet_pton(int af, const char *src, void *dst); SWITCH_DECLARE(const char *) switch_dow_int2str(int val); SWITCH_DECLARE(int) switch_dow_str2int(const char *exp); -SWITCH_DECLARE(int) switch_dow_cmp(const char *exp, int val); +SWITCH_DECLARE(switch_bool_t) switch_dow_cmp(const char *exp, int val); SWITCH_DECLARE(int) switch_number_cmp(const char *exp, int val); SWITCH_DECLARE(int) switch_tod_cmp(const char *exp, int val); diff --git a/src/switch_utils.c b/src/switch_utils.c index 4a0b818..b0d04cc 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -2467,7 +2467,6 @@ SWITCH_DECLARE(int) switch_isxdigit(int c) { return (c < 0 ? 0 : c > 255 ? 0 : ((_switch_ctype_ + 1)[(unsigned char) c] & (_N | _X))); } - static const char *DOW[] = { "sat", "sun", @@ -2475,73 +2474,100 @@ static const char *DOW[] = { "tue", "wed", "thu", - "fri", - "sat", - "sun", - NULL + "fri" }; SWITCH_DECLARE(const char *) switch_dow_int2str(int val) { - if (val >= sizeof(DOW) / sizeof (const char*)) { - return NULL; + if (val >= switch_arraylen(DOW)) { + val = val % switch_arraylen(DOW); } return DOW[val]; } SWITCH_DECLARE(int) switch_dow_str2int(const char *exp) { int ret = -1; - int x = -1; - for (x = 0;; x++) { - if (!DOW[x]) { - break; - } - - if (!strcasecmp(DOW[x], exp)) { - ret = x; + int x; + + for (x = 0; x < switch_arraylen(DOW); x++) { + if (!strncasecmp(DOW[x], exp, 3)) { + ret = x; break; } } return ret; } -SWITCH_DECLARE(int) switch_dow_cmp(const char *exp, int val) -{ - char *dup = strdup(exp); - char *p_start; - char *p_end; - int ret = 0; - int start, end; - - switch_assert(dup); - - p_start = dup; +typedef enum { + DOW_ERR = -2, + DOW_EOF = -1, + DOW_SAT = 0, + DOW_SUN, + DOW_MON, + DOW_TUE, + DOW_WED, + DOW_THU, + DOW_FRI, + DOW_HYPHEN = '-', + DOW_COMA = ',' +} dow_t; - if ((p_end=strchr(dup, '-'))) { - *p_end++ = '\0'; - } else { - p_end = p_start; - } - if (strlen(p_start) == 3) { - start = switch_dow_str2int(p_start); - } else { - start = atol(p_start); - } - if (strlen(p_end) == 3) { - end = switch_dow_str2int(p_end); +static inline dow_t _dow_read_token(const char **s) +{ + int i; + + if (**s == '-') { + (*s)++; + return DOW_HYPHEN; + } else if (**s == ',') { + (*s)++; + return DOW_COMA; + } else if (**s >= '0' && **s <= '9') { + (*s)++; + return **s; + } else if ((i = switch_dow_str2int(*s)) && i != -1) { + (*s) += 3; + return i; + } else if (!**s) { + return DOW_EOF; } else { - end = atol(p_end); - } - /* Following used for this example : mon-sat = 2-0, so we need to make 0(sat) + 7 */ - if (end < start) { - end += 7; - } - if (start != -1 && end != -1 && val >= start && val <= end) { - ret = 1; + return DOW_ERR; } +} - switch_safe_free(dup); +SWITCH_DECLARE(switch_bool_t) switch_dow_cmp(const char *exp, int val) +{ + dow_t cur, prev = DOW_EOF; + const char *p = exp; + + while ((cur = _dow_read_token(&p)) != DOW_EOF) { + if (cur == DOW_COMA) { + /* Reset state */ + cur = prev = DOW_EOF; + } else if (cur == DOW_HYPHEN) { + /* Save the current token and move to the next one */ + prev = cur; + } else if (cur == DOW_ERR) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse error for [%s] at position %td (%.6s)\n", exp, p - exp, p); + break; + } else { + /* Valid day found */ + if (prev != DOW_EOF) { /* Evaluating a range */ + if (prev < cur) { + if (val >= prev && val <= cur) { + return SWITCH_TRUE; + } + } else { + if (val >= cur && val <= prev) { + return SWITCH_TRUE; + } + } + } else if (val == cur) { + return SWITCH_TRUE; + } + } + } - return ret; + return SWITCH_FALSE; } SWITCH_DECLARE(int) switch_number_cmp(const char *exp, int val) commit 17ac6ba9c63d117956e48178f86866019ba32001 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Oct 26 19:34:47 2010 -0500 add record overwrite diff --git a/src/include/switch_types.h b/src/include/switch_types.h index c3622e3..272d435 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1307,7 +1307,8 @@ typedef enum { SWITCH_FILE_CALLBACK = (1 << 12), SWITCH_FILE_DONE = (1 << 13), SWITCH_FILE_BUFFER_DONE = (1 << 14), - SWITCH_FILE_WRITE_APPEND = (1 << 15) + SWITCH_FILE_WRITE_APPEND = (1 << 15), + SWITCH_FILE_WRITE_OVER = (1 << 16) } switch_file_flag_enum_t; typedef uint32_t switch_file_flag_t; diff --git a/src/mod/formats/mod_native_file/mod_native_file.c b/src/mod/formats/mod_native_file/mod_native_file.c index c72743f..272fc5d 100644 --- a/src/mod/formats/mod_native_file/mod_native_file.c +++ b/src/mod/formats/mod_native_file/mod_native_file.c @@ -58,7 +58,7 @@ static switch_status_t native_file_file_open(switch_file_handle_t *handle, const if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) { flags |= SWITCH_FOPEN_WRITE | SWITCH_FOPEN_CREATE; - if (switch_test_flag(handle, SWITCH_FILE_WRITE_APPEND)) { + if (switch_test_flag(handle, SWITCH_FILE_WRITE_APPEND) || switch_test_flag(handle, SWITCH_FILE_WRITE_OVER)) { flags |= SWITCH_FOPEN_READ; } else { flags |= SWITCH_FOPEN_TRUNCATE; diff --git a/src/mod/formats/mod_sndfile/mod_sndfile.c b/src/mod/formats/mod_sndfile/mod_sndfile.c index a0ddba0..2b661ed 100644 --- a/src/mod/formats/mod_sndfile/mod_sndfile.c +++ b/src/mod/formats/mod_sndfile/mod_sndfile.c @@ -82,7 +82,7 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha } if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) { - if (switch_test_flag(handle, SWITCH_FILE_WRITE_APPEND)) { + if (switch_test_flag(handle, SWITCH_FILE_WRITE_APPEND) || switch_test_flag(handle, SWITCH_FILE_WRITE_OVER)) { mode += SFM_RDWR; } else { mode += SFM_WRITE; @@ -208,6 +208,8 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha if (switch_test_flag(handle, SWITCH_FILE_WRITE_APPEND)) { handle->pos = sf_seek(context->handle, 0, SEEK_END); + } else if (switch_test_flag(handle, SWITCH_FILE_WRITE_OVER)) { + handle->pos = sf_seek(context->handle, 0, SEEK_SET); } else { sf_count_t frames = 0; sf_command(context->handle, SFC_FILE_TRUNCATE, &frames, sizeof(frames)); diff --git a/src/switch_core_file.c b/src/switch_core_file.c index 7d5df88..af3897e 100644 --- a/src/switch_core_file.c +++ b/src/switch_core_file.c @@ -407,39 +407,56 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_write(switch_file_handle_t *fh, SWITCH_DECLARE(switch_status_t) switch_core_file_seek(switch_file_handle_t *fh, unsigned int *cur_pos, int64_t samples, int whence) { - size_t bytes = 0; switch_status_t status; - + int ok = 1; + switch_assert(fh != NULL); switch_assert(fh->file_interface != NULL); - if (!switch_test_flag(fh, SWITCH_FILE_OPEN) || !switch_test_flag(fh, SWITCH_FILE_FLAG_READ)) { - return SWITCH_STATUS_FALSE; + if (!switch_test_flag(fh, SWITCH_FILE_OPEN) || !fh->file_interface->file_seek) { + ok = 0; + } else if (switch_test_flag(fh, SWITCH_FILE_FLAG_WRITE)) { + if (!(switch_test_flag(fh, SWITCH_FILE_WRITE_APPEND) || switch_test_flag(fh, SWITCH_FILE_WRITE_OVER))) { + ok = 0; + } + } else if (!switch_test_flag(fh, SWITCH_FILE_FLAG_READ)) { + ok = 0; } - - if (!fh->file_interface->file_seek) { + + if (!ok) { return SWITCH_STATUS_FALSE; } - + if (fh->buffer) { - bytes += switch_buffer_inuse(fh->buffer); switch_buffer_zero(fh->buffer); } if (fh->pre_buffer) { - bytes += switch_buffer_inuse(fh->pre_buffer); switch_buffer_zero(fh->pre_buffer); } if (whence == SWITCH_SEEK_CUR) { - samples -= bytes / sizeof(int16_t); + unsigned int cur = 0; + + if (switch_test_flag(fh, SWITCH_FILE_FLAG_WRITE)) { + fh->file_interface->file_seek(fh, &cur, fh->samples_out, SEEK_SET); + } else { + fh->file_interface->file_seek(fh, &cur, fh->offset_pos, SEEK_SET); + } } switch_set_flag(fh, SWITCH_FILE_SEEK); status = fh->file_interface->file_seek(fh, cur_pos, samples, whence); + if (samples) { fh->offset_pos = *cur_pos; + + if (switch_test_flag(fh, SWITCH_FILE_FLAG_WRITE)) { + fh->samples_out = *cur_pos; + } } + + return status; } diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index b1b20ec..7285b89 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -364,6 +364,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se time_t start = 0; uint32_t org_silence_hits = 0; int asis = 0; + int32_t sample_start = 0; int waste_resources = 0, fill_cng = 0; switch_codec_implementation_t read_impl = { 0 }; switch_frame_t write_frame = { 0 }; @@ -405,6 +406,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se fh->channels = read_impl.number_of_channels; fh->native_rate = read_impl.actual_samples_per_second; + if (fh->samples > 0) { + sample_start = fh->samples; + fh->samples = 0; + } + if ((vval = switch_channel_get_variable(channel, "record_sample_rate"))) { int tmp = 0; @@ -497,6 +503,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se file_flags |= SWITCH_FILE_WRITE_APPEND; } + if (switch_test_flag(fh, SWITCH_FILE_WRITE_OVER) || ((p = switch_channel_get_variable(channel, "RECORD_WRITE_OVER")) && switch_true(p))) { + file_flags |= SWITCH_FILE_WRITE_OVER; + } + if (!fh->prefix) { fh->prefix = prefix; } @@ -507,6 +517,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se return SWITCH_STATUS_GENERR; } + if (sample_start > 0) { + uint32_t pos = 0; + switch_core_file_seek(fh, &pos, sample_start, SEEK_SET); + switch_clear_flag(fh, SWITCH_FILE_SEEK); + fh->samples = 0; + } + + if (switch_test_flag(fh, SWITCH_FILE_NATIVE)) { asis = 1; } commit e10bc0a9656bcf5f44bf4f8ffd80da2c0937c0fb Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Oct 26 15:43:14 2010 -0500 allow {dtmf_type=none} to work in oubound dial strings diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 7028754..577887b 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -80,6 +80,9 @@ static switch_status_t sofia_on_init(switch_core_session_t *session) tech_pvt->read_frame.buflen = SWITCH_RTP_MAX_BUF_LEN; switch_mutex_lock(tech_pvt->sofia_mutex); + + sofia_glue_check_dtmf_type(tech_pvt); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s SOFIA INIT\n", switch_channel_get_name(channel)); if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) { sofia_glue_tech_absorb_sdp(tech_pvt); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 3cb2ddb..baff8e9 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -1029,3 +1029,4 @@ void sofia_glue_global_watchdog(switch_bool_t on); void sofia_glue_proxy_codec(switch_core_session_t *session, const char *r_sdp); switch_status_t sofia_glue_sdp_map(const char *r_sdp, switch_event_t **fmtp, switch_event_t **pt); void sofia_glue_build_vid_refresh_message(switch_core_session_t *session, const char *pl); +void sofia_glue_check_dtmf_type(private_object_t *tech_pvt); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index ddeb0e4..c9b384b 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -336,6 +336,23 @@ static void generate_m(private_object_t *tech_pvt, char *buf, size_t buflen, } +void sofia_glue_check_dtmf_type(private_object_t *tech_pvt) +{ + const char *val; + + if ((val = switch_channel_get_variable(tech_pvt->channel, "dtmf_type"))) { + if (!strcasecmp(val, "rfc2833")) { + tech_pvt->dtmf_type = DTMF_2833; + } else if (!strcasecmp(val, "info")) { + tech_pvt->dtmf_type = DTMF_INFO; + } else if (!strcasecmp(val, "none")) { + tech_pvt->dtmf_type = DTMF_NONE; + } else { + tech_pvt->dtmf_type = tech_pvt->profile->dtmf_type; + } + } +} + void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32_t port, const char *sr, int force) { @@ -357,6 +374,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32 switch_event_t *map = NULL, *ptmap = NULL; const char *b_sdp = NULL; + sofia_glue_check_dtmf_type(tech_pvt); if (!tech_pvt->payload_space) { int i; @@ -797,8 +815,6 @@ void sofia_glue_attach_private(switch_core_session_t *session, sofia_profile_t * tech_pvt->recv_te = tech_pvt->te = profile->te; } - tech_pvt->dtmf_type = profile->dtmf_type; - if (!sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG)) { if (tech_pvt->bcng_pt) { tech_pvt->cng_pt = tech_pvt->bcng_pt; @@ -2904,16 +2920,6 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_DATAWAIT); } - if ((val = switch_channel_get_variable(tech_pvt->channel, "dtmf_type"))) { - if (!strcasecmp(val, "rfc2833")) { - tech_pvt->dtmf_type = DTMF_2833; - } else if (!strcasecmp(val, "info")) { - tech_pvt->dtmf_type = DTMF_INFO; - } else { - tech_pvt->dtmf_type = tech_pvt->profile->dtmf_type; - } - } - if (sofia_test_pflag(tech_pvt->profile, PFLAG_PASS_RFC2833) || ((val = switch_channel_get_variable(tech_pvt->channel, "pass_rfc2833")) && switch_true(val))) { sofia_set_flag(tech_pvt, TFLAG_PASS_RFC2833); commit 08d2ea9d9605249968dd3eeaf14fc6bb5f2fff86 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Oct 26 13:43:21 2010 -0500 update diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index c68f376..749f18e 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -2618,6 +2618,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess check_reject = 0; if (fail_on_single_reject == 1 || switch_stristr(cause_str, fail_on_single_reject_var)) { + force_reason = reason; goto outer_for; } } commit 9d087d457efb756c886ef779fa49df19d9fb07fa Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Oct 26 11:52:28 2010 -0500 pass ring_ready like we do with pre_answer diff --git a/src/mod/endpoints/mod_loopback/mod_loopback.c b/src/mod/endpoints/mod_loopback/mod_loopback.c index 1733557..07f6d74 100644 --- a/src/mod/endpoints/mod_loopback/mod_loopback.c +++ b/src/mod/endpoints/mod_loopback/mod_loopback.c @@ -736,6 +736,11 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s switch_channel_mark_pre_answered(tech_pvt->other_channel); } break; + case SWITCH_MESSAGE_INDICATE_RINGING: + if (tech_pvt->other_channel && !switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { + switch_channel_mark_ring_ready(tech_pvt->other_channel); + } + break; case SWITCH_MESSAGE_INDICATE_BRIDGE: { switch_set_flag_locked(tech_pvt, TFLAG_BRIDGE); commit 1f0b951019b90822af33e2e36574533b027557fc Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Oct 26 10:55:15 2010 -0500 add fwd and rev message scroll keys as default and return to same message when doing a message forward diff --git a/conf/autoload_configs/voicemail.conf.xml b/conf/autoload_configs/voicemail.conf.xml index 14ad98b..06bd6f6 100644 --- a/conf/autoload_configs/voicemail.conf.xml +++ b/conf/autoload_configs/voicemail.conf.xml @@ -33,9 +33,10 @@ <param name="ff-key" value="6"/> <param name="rew-key" value="4"/> <param name="skip-greet-key" value="#"/> - <!--<param name="previous-message-key" value=""/>--> - <!--<param name="next-message-key" value=""/>--> - <!--<param name="skip-info-key" value=""/>--> + <param name="previous-message-key" value="1"/>--> + <param name="next-message-key" value="3"/> + <param name="skip-info-key" value="*"/> + <param name="repeat-message-key" value="0"/> <param name="record-silence-threshold" value="200"/> <param name="record-silence-hits" value="2"/> <param name="web-template-file" value="web-vm.tpl"/> commit 03d29a772b553f823d70ebf57b63eee5b12893d4 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Oct 26 09:45:11 2010 -0500 add fwd and rev message scroll keys as default and return to same message when doing a message forward diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index b2796be..e939d7f 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -69,7 +69,8 @@ typedef enum { typedef enum { VM_MOVE_NEXT, - VM_MOVE_PREV + VM_MOVE_PREV, + VM_MOVE_SAME } msg_move_t; #define VM_PROFILE_CONFIGITEM_COUNT 100 @@ -107,6 +108,7 @@ struct vm_profile { char rew_key[2]; char prev_msg_key[2]; char next_msg_key[2]; + char repeat_msg_key[2]; char urgent_key[2]; char operator_key[2]; char vmain_key[2]; @@ -480,7 +482,7 @@ vm_profile_t *profile_set_config(vm_profile_t *profile) SWITCH_CONFIG_SET_ITEM(profile->config[i++], "skip-greet-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &profile->skip_greet_key, "#", &config_dtmf, NULL, NULL); SWITCH_CONFIG_SET_ITEM(profile->config[i++], "skip-info-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, - &profile->skip_info_key, "", &config_dtmf, NULL, NULL); + &profile->skip_info_key, "*", &config_dtmf, NULL, NULL); SWITCH_CONFIG_SET_ITEM(profile->config[i++], "config-menu-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &profile->config_menu_key, "5", &config_dtmf, NULL, NULL); SWITCH_CONFIG_SET_ITEM(profile->config[i++], "record-greeting-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, @@ -510,9 +512,11 @@ vm_profile_t *profile_set_config(vm_profile_t *profile) SWITCH_CONFIG_SET_ITEM(profile->config[i++], "ff-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &profile->ff_key, "6", &config_dtmf, NULL, NULL); SWITCH_CONFIG_SET_ITEM(profile->config[i++], "rew-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &profile->rew_key, "4", &config_dtmf, NULL, NULL); SWITCH_CONFIG_SET_ITEM(profile->config[i++], "previous-message-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, - &profile->prev_msg_key, "", &config_dtmf, NULL, NULL); + &profile->prev_msg_key, "1", &config_dtmf, NULL, NULL); SWITCH_CONFIG_SET_ITEM(profile->config[i++], "next-message-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, - &profile->next_msg_key, "", &config_dtmf, NULL, NULL); + &profile->next_msg_key, "3", &config_dtmf, NULL, NULL); + SWITCH_CONFIG_SET_ITEM(profile->config[i++], "repeat-message-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, + &profile->repeat_msg_key, "0", &config_dtmf, NULL, NULL); SWITCH_CONFIG_SET_ITEM(profile->config[i++], "urgent-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &profile->urgent_key, "*", &config_dtmf, NULL, NULL); SWITCH_CONFIG_SET_ITEM(profile->config[i++], "operator-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, @@ -823,7 +827,8 @@ static switch_status_t control_playback(switch_core_session_t *session, void *in if (!cc->noexit && (dtmf->digit == *cc->profile->delete_file_key || dtmf->digit == *cc->profile->save_file_key - || dtmf->digit == *cc->profile->prev_msg_key || dtmf->digit == *cc->profile->next_msg_key + || dtmf->digit == *cc->profile->prev_msg_key || dtmf->digit == *cc->profile->next_msg_key + || dtmf->digit == *cc->profile->repeat_msg_key || dtmf->digit == *cc->profile->terminator_key || dtmf->digit == *cc->profile->skip_info_key || dtmf->digit == *cc->profile->email_key || dtmf->digit == *cc->profile->forward_key)) { *cc->buf = dtmf->digit; @@ -1483,6 +1488,8 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t } if (!strcmp(input, profile->prev_msg_key)) { cbt->move = VM_MOVE_PREV; + } else if (!strcmp(input, profile->repeat_msg_key)) { + cbt->move = VM_MOVE_SAME; } else if (!strcmp(input, profile->next_msg_key)) { cbt->move = VM_MOVE_NEXT; } else if (!strcmp(input, profile->listen_file_key)) { @@ -1538,6 +1545,7 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t if (voicemail_inject(cmd, session) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Sent Carbon Copy to %s\n", vm_cc); TRY_CODE(switch_ivr_phrase_macro(session, VM_ACK_MACRO, "saved", NULL, NULL)); + cbt->move = VM_MOVE_SAME; } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to Carbon Copy to %s\n", vm_cc); TRY_CODE(switch_ivr_phrase_macro(session, VM_INVALID_EXTENSION_MACRO, vm_cc, NULL, NULL)); @@ -1884,7 +1892,10 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p } else { cur_message -= 2; } + } else if (cbt.move == VM_MOVE_SAME) { + cur_message -= 1; } + if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) { break; } commit 07adca56cc8ba4a7d5703c920515ec7f4bd3dc66 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Oct 26 09:42:56 2010 -0500 add record_post_process_exec_app and record_post_process_exec_api both can have <app|cmd>:<args> diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 9f5b87d..23a634c 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -928,6 +928,8 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s break; case SWITCH_ABC_TYPE_CLOSE: { + const char *var; + switch_codec_implementation_t read_impl = { 0 }; switch_core_session_get_read_impl(session, &read_impl); @@ -967,6 +969,41 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s switch_file_remove(rh->file, switch_core_session_get_pool(session)); } } + + if ((var = switch_channel_get_variable(channel, "record_post_process_exec_app"))) { + char *app = switch_core_session_strdup(session, var); + char *data; + + if ((data = strchr(app, ':'))) { + *data++ = '\0'; + } + + switch_core_session_execute_application(session, app, data); + } + + if ((var = switch_channel_get_variable(channel, "record_post_process_exec_api"))) { + char *cmd = switch_core_session_strdup(session, var); + char *data, *expanded = NULL; + switch_stream_handle_t stream = { 0 }; + + SWITCH_STANDARD_STREAM(stream); + + if ((data = strchr(cmd, ':'))) { + *data++ = '\0'; + expanded = switch_channel_expand_variables(channel, data); + } + + switch_api_execute(cmd, expanded, session, &stream); + + if (expanded && expanded != data) { + free(expanded); + } + + switch_safe_free(stream.data); + + } + + } break; commit daa08ecd09c3d9314e5eb26314f5a4fcc24a4c1d Author: Michael Jerris <mike@jerris.com> Date: Mon Oct 25 18:04:53 2010 -0400 add var to indicate the fifo name on outcall diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 560b1cd..d1ba178 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -1212,7 +1212,8 @@ static void *SWITCH_THREAD_FUNC ringall_thread_run(switch_thread_t *thread, void if (!h->timeout) h->timeout = 60; if (timeout < h->timeout) timeout = h->timeout; - stream.write_function(&stream, "[leg_timeout=%d,fifo_outbound_uuid=%s]%s,", h->timeout, h->uuid, parsed ? parsed : h->originate_string); + stream.write_function(&stream, "[leg_timeout=%d,fifo_outbound_uuid=%s,fifo_name=%s]%s,", + h->timeout, h->uuid, node->name, parsed ? parsed : h->originate_string); stream2.write_function(&stream2, "%s,", h->uuid); switch_safe_free(parsed); @@ -1505,17 +1506,17 @@ static void *SWITCH_THREAD_FUNC o_thread_run(switch_thread_t *thread, void *obj) switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "originate_timeout", "%d", h->timeout); if (switch_stristr("origination_caller", h->originate_string)) { - originate_string = switch_mprintf("{execute_on_answer='unset fifo_hangup_check',fifo_hangup_check='%q'}%s", - node->name, h->originate_string); + originate_string = switch_mprintf("{execute_on_answer='unset fifo_hangup_check',fifo_name='%q',fifo_hangup_check='%q'}%s", + node->name, node->name, h->originate_string); } else { if (!zstr(node->outbound_name)) { - originate_string = switch_mprintf("{execute_on_answer='unset fifo_hangup_check',fifo_hangup_check='%q'," + originate_string = switch_mprintf("{execute_on_answer='unset fifo_hangup_check',fifo_name='%q',fifo_hangup_check='%q'," "origination_caller_id_name=Queue,origination_caller_id_number='Queue: %q'}%s", - node->name, node->outbound_name, h->originate_string); + node->name, node->name, node->outbound_name, h->originate_string); } else { - originate_string = switch_mprintf("{execute_on_answer='unset fifo_hangup_check',fifo_hangup_check='%q'," + originate_string = switch_mprintf("{execute_on_answer='unset fifo_hangup_check',fifo_name='%q',fifo_hangup_check='%q'," "origination_caller_id_name=Queue,origination_caller_id_number='Queue: %q'}%s", - node->name, node->name, h->originate_string); + node->name, node->name, node->name, h->originate_string); } } commit 09dc7c32f05359e58d26a1ba554431567ec04969 Author: Arnaldo M Pereira <egghunt@gmail.com> Date: Mon Oct 25 19:30:04 2010 -0200 freetdm: added testsangomaboost back to build by default on msvc diff --git a/libs/freetdm/freetdm.2008.sln b/libs/freetdm/freetdm.2008.sln index bdfd0b8..61f631f 100644 --- a/libs/freetdm/freetdm.2008.sln +++ b/libs/freetdm/freetdm.2008.sln @@ -137,6 +137,7 @@ Global {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Release|x64.ActiveCfg = Release|x64 {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Release|x64.Build.0 = Release|x64 {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Debug|Win32.ActiveCfg = Debug|Win32 + {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Debug|Win32.Build.0 = Debug|Win32 {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Debug|x64.ActiveCfg = Debug|x64 {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Debug|x64.Build.0 = Debug|x64 {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Release|Win32.ActiveCfg = Release|Win32 commit a30800632e83bb227660100e81a691b15438f1cf Author: Arnaldo M Pereira <egghunt@gmail.com> Date: Mon Oct 25 19:22:51 2010 -0200 freetdm: reverted wrong changes to freetdm.2008.sln diff --git a/libs/freetdm/freetdm.2008.sln b/libs/freetdm/freetdm.2008.sln index cb3f21d..bdfd0b8 100644 --- a/libs/freetdm/freetdm.2008.sln +++ b/libs/freetdm/freetdm.2008.sln @@ -80,6 +80,7 @@ Global {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|x64.ActiveCfg = Release|x64 {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|x64.Build.0 = Release|x64 {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|Win32.ActiveCfg = Debug|Win32 + {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|Win32.Build.0 = Debug|Win32 {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|x64.ActiveCfg = Debug|x64 {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|x64.Build.0 = Debug|x64 {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Release|Win32.ActiveCfg = Release|Win32 @@ -128,6 +129,7 @@ Global {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Release|Win32.ActiveCfg = Release|Win32 {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Release|x64.ActiveCfg = Release|x64 {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Debug|Win32.ActiveCfg = Debug|Win32 + {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Debug|Win32.Build.0 = Debug|Win32 {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Debug|x64.ActiveCfg = Debug|x64 {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Debug|x64.Build.0 = Debug|x64 {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Release|Win32.ActiveCfg = Release|Win32 @@ -142,6 +144,7 @@ Global {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Release|x64.ActiveCfg = Release|x64 {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Release|x64.Build.0 = Release|x64 {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Debug|Win32.ActiveCfg = Debug|Win32 + {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Debug|Win32.Build.0 = Debug|Win32 {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Debug|x64.ActiveCfg = Debug|x64 {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Debug|x64.Build.0 = Debug|x64 {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|Win32.ActiveCfg = Release|Win32 commit 9a0f638d1914b112b2990407a254afcd86d52bbc Author: Arnaldo M Pereira <egghunt@gmail.com> Date: Mon Oct 25 19:06:59 2010 -0200 freetdm: removed duplicated DELTA_EPOCH_IN_MICROSECS definition diff --git a/libs/freetdm/src/ftdm_sched.c b/libs/freetdm/src/ftdm_sched.c index 73facb3..c48c3e9 100644 --- a/libs/freetdm/src/ftdm_sched.c +++ b/libs/freetdm/src/ftdm_sched.c @@ -35,11 +35,6 @@ #include "private/ftdm_core.h" #ifdef __WINDOWS__ -#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) -#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 -#else /* */ -#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL -#endif /* */ struct ftdm_timezone { int tz_minuteswest; /* minutes W of Greenwich */ int tz_dsttime; /* type of dst correction */ commit 9b3a48e5ce8b4f84259e200e5a2236d2dd52bfc7 Merge: fcf0275 742da18 Author: U-MOISES-3ADA31C5\Administrator <Administrator@moises-3ada31c5.(none)> Date: Mon Oct 25 16:07:46 2010 -0400 Merge branch 'master' into arnaldo.sng_isdn diff --cc libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 725e1bb,5b0e1b5..9adcc08 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@@ -78,8 -77,9 +78,9 @@@ void sngisdn_process_con_ind (sngisdn_e break; } - sngisdn_info->suInstId = get_unique_suInstId(suId); + sngisdn_info->suInstId = get_unique_suInstId((int8_t) suId); sngisdn_info->spInstId = spInstId; + if (conEvnt->cdPtyNmb.eh.pres && signal_data->num_local_numbers) { uint8_t local_number_matched = 0; commit be43052c50ac0d06e5581ac1509583ab7093bacd Author: Jeff Lenk <jeff@jefflenk.com> Date: Mon Oct 25 14:54:13 2010 -0500 fix build diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index ed87258..c68f376 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -1722,7 +1722,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess char *e = NULL; const char *ringback_data = NULL; switch_event_t *var_event = NULL; - uint8_t fail_on_single_reject = 0; + int8_t fail_on_single_reject = 0; char *fail_on_single_reject_var = NULL; char *loop_data = NULL; uint32_t progress_timelimit_sec = 0; commit d09e6c60d985574ea64f3d7eb07a73311ae7d709 Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Mon Oct 25 15:21:39 2010 -0400 switch_xml: snprintf size fix diff --git a/src/switch_xml.c b/src/switch_xml.c index 95b82cb..a7bfe41 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -2761,7 +2761,7 @@ SWITCH_DECLARE(int) switch_xml_std_datetime_check(switch_xml_t xcond) { if (time_match && xtod) { int test = (tm.tm_hour * 60 * 60) + (tm.tm_min * 60) + tm.tm_sec; char tmpdate[10]; - switch_snprintf(tmpdate, 6, "%d:%d:%d", tm.tm_hour, tm.tm_min, tm.tm_sec); + switch_snprintf(tmpdate, 10, "%d:%d:%d", tm.tm_hour, tm.tm_min, tm.tm_sec); time_match = switch_tod_cmp(xtod, test); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, "XML DateTime Check: time of day[%s] =~ %s (%s)\n", tmpdate, xtod, time_match ? "PASS" : "FAIL"); commit cd736a1c777a53d4bed7a62fb06aece8d901708b Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Oct 25 13:03:06 2010 -0500 fix fail_on_single_reject diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 0b5ab77..ed87258 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -1735,6 +1735,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess const char *soft_holding = NULL; early_state_t early_state = { 0 }; int read_packet = 0; + int check_reject = 1; if (strstr(bridgeto, SWITCH_ENT_ORIGINATE_DELIM)) { return switch_ivr_enterprise_originate(session, bleg, cause, bridgeto, timelimit_sec, table, cid_name_override, cid_num_override, @@ -2081,9 +2082,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess If the value is set to 'true' any fail cause will end the attempt otherwise it can contain a comma (,) separated list of cause names which should be considered fatal */ - if ((var = switch_event_get_header(var_event, "fail_on_single_reject")) && switch_true(var)) { + if ((var = switch_event_get_header(var_event, "fail_on_single_reject"))) { fail_on_single_reject_var = strdup(var); - fail_on_single_reject = 1; + if (switch_true(var)) { + fail_on_single_reject = 1; + } else { + fail_on_single_reject = -1; + } } if ((*oglobals.file != '\0') && (!strcmp(oglobals.file, "undef"))) { @@ -2232,6 +2237,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess char *p, *end = NULL; const char *var_begin, *var_end; int q = 0; + check_reject = 1; + oglobals.hups = 0; reason = SWITCH_CAUSE_NONE; @@ -2605,6 +2612,15 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot create outgoing channel of type [%s] cause: [%s]\n", chan_type, switch_channel_cause2str(reason)); if (local_var_event) switch_event_destroy(&local_var_event); + + if (fail_on_single_reject_var) { + const char *cause_str = switch_channel_cause2str(reason); + check_reject = 0; + + if (fail_on_single_reject == 1 || switch_stristr(cause_str, fail_on_single_reject_var)) { + goto outer_for; + } + } continue; } @@ -2848,26 +2864,29 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } goto notready; } - + if ((to = (uint8_t) (elapsed >= (time_t) timelimit_sec)) || (fail_on_single_reject && oglobals.hups)) { int ok = 0; - if (fail_on_single_reject_var && !switch_true(fail_on_single_reject_var)) { - ok = 1; - for (i = 0; i < and_argc; i++) { - switch_channel_t *pchannel; - const char *cause_str; + if (fail_on_single_reject_var) { + if (!switch_true(fail_on_single_reject_var)) { + ok = 1; - if (!originate_status[i].peer_session) { - goto do_continue; - } - pchannel = switch_core_session_get_channel(originate_status[i].peer_session); + for (i = 0; i < and_argc; i++) { + switch_channel_t *pchannel; + const char *cause_str; + + if (!originate_status[i].peer_session) { + continue; + } + pchannel = switch_core_session_get_channel(originate_status[i].peer_session); - if (switch_channel_down(pchannel)) { - cause_str = switch_channel_cause2str(switch_channel_get_cause(pchannel)); - if (switch_stristr(cause_str, fail_on_single_reject_var)) { - ok = 0; - break; + if (switch_channel_down(pchannel)) { + cause_str = switch_channel_cause2str(switch_channel_get_cause(pchannel)); + if (switch_stristr(cause_str, fail_on_single_reject_var)) { + ok = 0; + break; + } } } } @@ -3476,26 +3495,31 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } else { int ok = 0; - if (fail_on_single_reject_var && !switch_true(fail_on_single_reject_var)) { - ok = 1; - for (i = 0; i < and_argc; i++) { - switch_channel_t *pchannel; - const char *cause_str; + if (fail_on_single_reject && check_reject) { - if (!originate_status[i].peer_session) { - continue; - } - pchannel = switch_core_session_get_channel(originate_status[i].peer_session); + if (!switch_true(fail_on_single_reject_var)) { + ok = 1; - if (switch_channel_down(pchannel)) { - cause_str = switch_channel_cause2str(switch_channel_get_cause(pchannel)); - if (switch_stristr(cause_str, fail_on_single_reject_var)) { - ok = 0; - break; + for (i = 0; i < and_argc; i++) { + switch_channel_t *pchannel; + const char *cause_str; + + if (!originate_status[i].peer_session) { + continue; + } + pchannel = switch_core_session_get_channel(originate_status[i].peer_session); + + if (switch_channel_down(pchannel)) { + cause_str = switch_channel_cause2str(switch_channel_get_cause(pchannel)); + if (switch_stristr(cause_str, fail_on_single_reject_var)) { + ok = 0; + break; + } } } } } + if (ok) { goto outer_for; } commit 59d3b84defc23b36f7f9f2036b15c2b78c02f29b Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Oct 25 11:52:43 2010 -0500 profile param ignore-183nosdp, chanvar sip_ignore_183nosdp FS-1978 diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 90f5d3a..3cb2ddb 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -221,6 +221,7 @@ typedef enum { PFLAG_CID_IN_1XX, PFLAG_IN_DIALOG_CHAT, PFLAG_DEL_SUBS_ON_REG, + PFLAG_IGNORE_183NOSDP, /* No new flags below this line */ PFLAG_MAX } PFLAGS; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 5a14c2c..58099de 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2393,6 +2393,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) } else { sofia_clear_pflag(profile, PFLAG_T38_PASSTHRU); } + } else if (!strcasecmp(var, "ignore-183nosdp")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_IGNORE_183NOSDP); + } else { + sofia_clear_pflag(profile, PFLAG_IGNORE_183NOSDP); + } } else if (!strcasecmp(var, "cid-in-1xx")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_CID_IN_1XX); @@ -3050,6 +3056,12 @@ switch_status_t config_sofia(int reload, char *profile_name) } else { sofia_clear_pflag(profile, PFLAG_T38_PASSTHRU); } + } else if (!strcasecmp(var, "ignore-183nosdp")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_IGNORE_183NOSDP); + } else { + sofia_clear_pflag(profile, PFLAG_IGNORE_183NOSDP); + } } else if (!strcasecmp(var, "cid-in-1xx")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_CID_IN_1XX); @@ -4597,6 +4609,10 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, } if (status == 183 && !r_sdp) { + if (switch_true(switch_channel_get_variable(channel, "sip_ignore_183nosdp")) || sofia_test_pflag(profile, PFLAG_IGNORE_183NOSDP)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Ignoring 183 w/o sdp\n", switch_channel_get_name(channel)); + goto done; + } status = 180; } commit 1a1881e80cf698dec5992333ec326f67357d4509 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Oct 25 11:28:02 2010 -0500 FS-2795 diff --git a/src/mod/endpoints/mod_loopback/mod_loopback.c b/src/mod/endpoints/mod_loopback/mod_loopback.c index d3e3f5c..1733557 100644 --- a/src/mod/endpoints/mod_loopback/mod_loopback.c +++ b/src/mod/endpoints/mod_loopback/mod_loopback.c @@ -717,25 +717,14 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s { switch_channel_t *channel; private_t *tech_pvt; - + int done = 1; + channel = switch_core_session_get_channel(session); switch_assert(channel != NULL); tech_pvt = switch_core_session_get_private(session); switch_assert(tech_pvt != NULL); - if (switch_test_flag(tech_pvt, TFLAG_RUNNING_APP)) { - switch_status_t r = SWITCH_STATUS_FALSE; - switch_core_session_t *other_session; - - if (switch_core_session_get_partner(session, &other_session)) { - r = switch_core_session_receive_message(other_session, msg); - switch_core_session_rwunlock(other_session); - } - - return r; - } - switch (msg->message_id) { case SWITCH_MESSAGE_INDICATE_ANSWER: if (tech_pvt->other_channel && !switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { @@ -758,6 +747,7 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s } break; default: + done = 0; break; } @@ -768,6 +758,8 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s { void *pop; + done = 1; + while (switch_queue_trypop(tech_pvt->frame_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) { switch_frame_t *frame = (switch_frame_t *) pop; switch_frame_free(&frame); @@ -787,6 +779,18 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s } + if (!done && tech_pvt->other_session && switch_test_flag(tech_pvt, TFLAG_RUNNING_APP)) { + switch_status_t r = SWITCH_STATUS_FALSE; + switch_core_session_t *other_session; + + if (switch_core_session_get_partner(tech_pvt->other_session, &other_session)) { + r = switch_core_session_receive_message(other_session, msg); + switch_core_session_rwunlock(other_session); + } + + return r; + } + return SWITCH_STATUS_SUCCESS; } commit 742da182180a3bd479828d2477d7263001f77d09 Author: David Yat Sin <dyatsin@sangoma.com> Date: Mon Oct 25 07:32:55 2010 -0700 Added state handler for overlap-receive diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 41833c5..5b0e1b5 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -968,6 +968,18 @@ void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event) //ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); break; } + break; + case 25: /* Overlap receiving */ + switch (ftdmchan->state) { + case FTDM_CHANNEL_STATE_COLLECT: + /* do nothing */ + break; + default: + ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state)); + //ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + break; + } + break; default: ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state)); //ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); commit 1ef3fc9a1b90bb7c57984522397955aa68536a75 Author: Geovani Ricardo Wiedenhoft <grw@geovani.(none)> Date: Mon Oct 25 12:07:31 2010 -0200 - Removed alternative contexts / extensions - New struct for matchs - On calls originated from an FXS branch, the Endpoint searches for a valid extension (digits sent) after the DTMF '#' or after the timeout (option fxs-digit-timeout). That search is done in the context defined in section <fxs-options>, or if no context configured, the search is done in context defined in context-fxs. - Added "dialplan" configuration: Name of the dialplan module in use (default XML) - Group context enabled. If set, the search for a valid extension is done only in that context. - Updated documentation diff --git a/src/mod/endpoints/mod_khomp/Install/files/khomp.conf.xml b/src/mod/endpoints/mod_khomp/Install/files/khomp.conf.xml index 7255fb8..ec02ca7 100644 --- a/src/mod/endpoints/mod_khomp/Install/files/khomp.conf.xml +++ b/src/mod/endpoints/mod_khomp/Install/files/khomp.conf.xml @@ -13,6 +13,13 @@ <!-- Section for main configurations about channels. --> <!-- +Name of the dialplan module in use. +(default = XML) + +<param name="dialplan" value="XML"/> +--> + +<!-- Enable/disable generalized echo cancellation in the channel, for calls passing inside FreeSWITCH (disabled for bridged calls). (default = yes) @@ -115,15 +122,6 @@ accepted, and described in the bottom of this file. --> <!-- -Defines the "alternative" context for calls on FXS channels, which will be -checked if the main context does not match for a call. Some wildcards are -accepted, and described in the bottom of this file. -(default = khomp-DD) - -<param name="context-fxs-alt" value="khomp-DD"/> ---> - -<!-- Defines the incoming context for calls on FXO channels. Some wildcards are accepted, and described in the bottom of this file. (default = khomp-DD-CC) @@ -132,15 +130,6 @@ accepted, and described in the bottom of this file. --> <!-- -Defines the "alternative" context for calls on FXO channels, which will be -checked if the main context does not match for a call. Some wildcards are -accepted, and described in the bottom of this file. -(default = khomp-DD) - -<param name="context-fxo-alt" value="khomp-DD"/> ---> - -<!-- Defines the incoming context for calls on GSM channels. Some wildcards are accepted, and described in the bottom of this file. (default = khomp-DD-CC) @@ -149,15 +138,6 @@ accepted, and described in the bottom of this file. --> <!-- -Defines the "alternative" context for calls on GSM channels, which will be -checked if the main context does not match for a call. Some wildcards are -accepted, and described in the bottom of this file. -(default = khomp-DD) - -<param name="context-gsm-call-alt" value="khomp-DD"/> ---> - -<!-- Defines the incoming context for messages on GSM channels. Some wildcards are accepted, and described in the bottom of this file. (default = khomp-sms-DD-CC) diff --git a/src/mod/endpoints/mod_khomp/docs/Manual.html b/src/mod/endpoints/mod_khomp/docs/Manual.html index fc63f0d..d069955 100644 --- a/src/mod/endpoints/mod_khomp/docs/Manual.html +++ b/src/mod/endpoints/mod_khomp/docs/Manual.html @@ -29,15 +29,13 @@ </p> <pre><b>Sintaxe:</b> <param name="..." value="..."/> </pre> -<ul><li><b>auto-fax-adjustment</b>: Ativa ("yes") ou desativa ("no") o ajuste automático do canal (desabilitar o cancelador de eco e a supressão DTMF) ao detectar tom de FAX; +<ul><li><b>dialplan</b>: Nome do módulo de <i>dialplan</i> em uso. +</li><li><b>auto-fax-adjustment</b>: Ativa ("yes") ou desativa ("no") o ajuste automático do canal (desabilitar o cancelador de eco e a supressão DTMF) ao detectar tom de FAX; </li><li><b>auto-gain-control</b>: Ativa ("yes") ou desativa ("no") a ativação do controle automático de ganho (AGC) pelo Endpoint; </li><li><b>context-digital</b>: Contexto de entrada para ligações em placas digitais (o padrão é "khomp-DD-LL", onde "DD" será substituído, no momento da ligação, pelo número do dispositivo, "LL" pelo número do link, "CCC" pelo número do canal e "SSSS" pelo número serial do dispositivo); </li><li><b>context-fxo</b>: Contexto de entrada para placas FXO (o padrão é "khomp-DD-CC", onde "DD" será substituído, no momento da ligação, pelo número do dispositivo, "CC" pelo número do canal, e "SSSS" pelo número serial do dispositivo); -</li><li><b>context-fxo-alt</b>: Contexto de entrada alternativo para placas FXO (o padrão é vazio, no entanto quando definido, segue a mesma regra de substituição da opção <b>context-fxo</b>); </li><li><b>context-fxs</b>: Contexto de entrada para placas FXS (o padrão é "khomp-DD-CC", onde "DD" será substituído, no momento da ligação, pelo número do dispositivo, "CC" pelo número do canal, e "SSSS" pelo número serial do dispositivo); -</li><li><b>context-fxs-alt</b>: Contexto de entrada alternativo para placas FXS (o padrão é vazio, no entanto quando definido, segue a mesma regra de substituição da opção <b>context-fxs</b>); </li><li><b>context-gsm-call</b> (ou "context-gsm"): Contexto de entrada para ligações GSM (o padrão é "khomp-DD-CC", onde "DD" será substituído no momento da ligação pelo número do dispositivo, "CC" pelo número do canal, e "SSSS" pelo número serial do dispositivo); -</li><li><b>context-gsm-call-alt</b> (ou "context-gsm-alt"): Contexto de entrada alternativo para ligações GSM (o padrão é vazio, no entanto quando definido, segue a mesma regra de substituição da opção <b>context-gsm-call</b>); </li><li><b>context-gsm-sms</b>: Contexto de entrada para SMSs (o padrão é "khomp-sms-DD-CC", onde "DD" será substituído pelo número de dispositivo, "CC" pelo número do canal, e "SSSS" pelo número serial do dispositivo); </li><li><b>context-pr</b>: Contexto de entrada para ligações em placas KPR (o padrão é "khomp-DD-CC", onde "DD" será substituído, no momento da ligação, pelo número do dispositivo, "CC" pelo número do canal); </li><li><b>disconnect-delay</b>: Define o tempo em milissegundos para realizar o processamento de um evento de desconexão, para ignorar situações onde outros equipamentos realizam o duplo atendimento para derrubar chamadas a cobrar; @@ -215,8 +213,8 @@ de entrada no link 1 (segundo link) da placa 0. <br /> </p> <a name="Contextos_de_entrada_em_canais_FXS.2FFXO.2FGSM" id="Contextos_de_entrada_em_canais_FXS.2FFXO.2FGSM"></a><h3> <span class="mw-headline"> Contextos de entrada em canais FXS/FXO/GSM </span></h3> -<p>Da mesma forma que no contexto de placas E1, as ligações de entrada são encaminhadas pelo <i>Endpoint</i> para o FreeSWITCH. Entretanto, estas sinalizações possuem dois contextos pré-definidos, buscados com uma ordem de preferência. -</p><p>O primeiro contexto é pré-definido da seguinte forma, conforme o arquivo <b>khomp.conf.xml</b>: +<p>Da mesma forma que no contexto de placas E1, as ligações de entrada são encaminhadas pelo <i>Endpoint</i> para o FreeSWITCH. +</p><p>O contexto é pré-definido da seguinte forma, conforme o arquivo <b>khomp.conf.xml</b>: </p> <pre><param name="context-gsm" value="khomp-DD-CC"/> ;placas GSM </pre> @@ -224,27 +222,14 @@ de entrada no link 1 (segundo link) da placa 0. </pre> <pre><param name="context-fxo" value="khomp-DD-CC"/> ; placas FXO </pre> -<p>Enquanto o segundo contexto possui o seguinte formato padrão: -</p> -<pre><param name="context-gsm-alt" value="khomp-DD"/> ; placas GSM -</pre> -<pre><param name="context-fxs-alt" value="khomp-DD"/> ; placas FXS -</pre> -<pre><param name="context-fxo-alt" value="khomp-DD"/> ; placas FXO -</pre> -<p>Nestes casos, <b>DD</b> é o número dispositivo (com dois dígitos), e <b>CC</b> é o número do canal da placa. Pode-se utilizar também <b>SSSS</b>, que representa o número serial da placa. +<p><br /> +Nestes casos, <b>DD</b> é o número dispositivo (com dois dígitos), e <b>CC</b> é o número do canal da placa. Pode-se utilizar também <b>SSSS</b>, que representa o número serial da placa. </p> <ul><li> <b>IMPORTANTE</b>: No caso da placa <b>KGSM</b>, as ligações entrantes são <b>sempre</b> encaminhadas para o <i>extension</i> <b>"s"</b> por padrão, visto que o protocolo GSM não identifica o número de destino nas ligações entrantes, apenas o número de origem - quando não omitido. </li></ul> <a name="Prioridade_de_contextos_na_placa_FXS" id="Prioridade_de_contextos_na_placa_FXS"></a><h4> <span class="mw-headline"> Prioridade de contextos na placa FXS </span></h4> -<p>Em ligações originadas a partir de um ramal FXS, o Endpoint driver procura uma extensão válida dos dígitos discados em três contextos diferentes. A prioridade dos contextos é a seguinte: -</p> -<ol><li> Contexto específico do ramal, definido na seção <b><fxs-options></b> do arquivo de configuração do <b>khomp.conf.xml</b>; -</li><li> Contexto definido na opção <b>context-fxs</b>; -</li><li> Contexto definido na opção <b>context-fxs-alt</b>. -</li></ol> -<p>Caso durante a discagem, nenhuma extensão válida puder ser encontrada, a extensão <b>i</b> é procurada nos contextos em ordem de prioridade, e por fim no contexto <b>default</b>. Caso ocorra um <i>timeout</i> durante a discagem (configurável pela opção <b>fxs-digit-timeout</b>, no arquivo <b>khomp.conf.xml</b>) durante a discagem, o mesmo comportamento será aplicado - no entanto, a busca se dará inicialmente pelo número já discado até o <i>timeout</i> e, se não encontrado, a busca nos contextos será repetida para a extensão "t". -<br /> +<p>Em ligações originadas a partir de um ramal FXS, o Endpoint driver procura uma extensão válida (dos dígitos discados) após o dígito <b>#</b> ou após o timeout (configurável pela opção <b>fxs-digit-timeout</b>, no arquivo <b>khomp.conf.xml</b>). Essa busca é realizada no contexto específico do ramal (definido na seção <b><fxs-options></b> do arquivo de configuração <b>khomp.conf.xml</b>), caso não seja configurado, a busca é realizada no contexto definido na opção <b>context-fxs</b>; +</p><p><br /> </p> <a name="Contextos_de_mensagens_SMS_.28apenas_GSM.29" id="Contextos_de_mensagens_SMS_.28apenas_GSM.29"></a><h3> <span class="mw-headline"> Contextos de mensagens SMS (apenas GSM) </span></h3> <p>Mensagens SMS são recebidas pelo <i>Endpoint</i> da Khomp e encaminhadas para o FreeSWITCH como uma ligação normal, mas sem áudio, que possui algumas variáveis ajustadas com informações recebidas na mensagem - para maiores informações sobre estas variáveis, consulte a documentação das variáveis do <i>Endpoint</i>. Este contexto também pode ser alterado, de mesma forma que o contextos acima. @@ -270,7 +255,10 @@ de entrada no link 1 (segundo link) da placa 0. </pre> <p>Neste caso, <b>DD</b> é o número do dispositivo (com dois dígitos), e <b>CC</b> é o número do canal da placa. <br /> -</p><p><br /> +</p> +<a name="Contextos_por_grupo_de_chamada" id="Contextos_por_grupo_de_chamada"></a><h3> <span class="mw-headline">Contextos por grupo de chamada </span></h3> +<p>A seção <b>groups</b>, no arquivo de configuração <b>khomp.conf.xml</b>, pode ser utilizado para definir contextos específicos para determinados grupos de canais. +</p><p>Esta seção é detalhada na seção <b>Configuração do Endpoint</b>. <br /> </p> <a name="Utiliza.C3.A7.C3.A3o_do_application_bridge" id="Utiliza.C3.A7.C3.A3o_do_application_bridge"></a><h3> <span class="mw-headline">Utilização do <i>application</i> bridge </span></h3> diff --git a/src/mod/endpoints/mod_khomp/docs/Manual.pdf b/src/mod/endpoints/mod_khomp/docs/Manual.pdf index ea29f71..665be58 100644 Binary files a/src/mod/endpoints/mod_khomp/docs/Manual.pdf and b/src/mod/endpoints/mod_khomp/docs/Manual.pdf differ diff --git a/src/mod/endpoints/mod_khomp/docs/README.pdf b/src/mod/endpoints/mod_khomp/docs/README.pdf index 698ab83..a65cc28 100644 Binary files a/src/mod/endpoints/mod_khomp/docs/README.pdf and b/src/mod/endpoints/mod_khomp/docs/README.pdf differ diff --git a/src/mod/endpoints/mod_khomp/docs/README_en.pdf b/src/mod/endpoints/mod_khomp/docs/README_en.pdf index e36d6f1..2864e40 100644 Binary files a/src/mod/endpoints/mod_khomp/docs/README_en.pdf and b/src/mod/endpoints/mod_khomp/docs/README_en.pdf differ diff --git a/src/mod/endpoints/mod_khomp/docs/User_Guide.html b/src/mod/endpoints/mod_khomp/docs/User_Guide.html index 1a276b9..ceb520b 100644 --- a/src/mod/endpoints/mod_khomp/docs/User_Guide.html +++ b/src/mod/endpoints/mod_khomp/docs/User_Guide.html @@ -30,17 +30,14 @@ If you need to set advanced parameters of the board and/or signaling, the progra </p> <pre><b>Sintaxe:</b> <param name="..." value="..."/> </pre> -<ul><li><b>auto-fax-adjustment</b>: Enable ("yes") or disables ("no") the automatic adjustment of the channel (disable the echo canceller and the suppression DTMF) tone to detect FAX (local option) ; +<ul><li><b>dialplan</b>: Name of the dialplan module in use. +</li><li><b>auto-fax-adjustment</b>: Enable ("yes") or disables ("no") the automatic adjustment of the channel (disable the echo canceller and the suppression DTMF) tone to detect FAX (local option) ; </li><li><b>auto-gain-control</b>:Enable ("yes") or disables ("no") the activation of the automatic gain control (AGC) by the Endpoint (local option); </li><li><b>context-digital</b>: Context for incoming connections on digital boards (the default is "khomp-DD-LL", where "DD" will be replaced at the time of connection by the device number, "LL" by the number of the link, "CCC" by channel number and "SSSS" for the device serial number); </li><li><b>context-fxo</b>: Context for incoming connections on FXO cards (the default is "khomp-CC-DD", where "DD" will be replaced at the time of connection by the device number, "CC" by channel number, and "SSSS" by the device serial number); -</li><li><b>context-fxo-alt</b>: Alternative input context for FXO cards (the default is empty - when set, follows the same substitution rules for <b>context-fxo</b>); </li><li><b>context-fxs</b>: Context for incoming connections on FXS cards (the default is "khomp-CC-DD", where "DD" will be replaced at the time of connection by the device number, "CC" by channel number, and "SSSS" by the device serial number); -</li><li><b>context-fxs-alt</b>: Alternative input context for FXS cards (the default is empty - when set, follows the same substitution rules for context-fxs); number); </li><li><b>context-gsm-call</b> (or <b>context-gsm</b>): Context of entry for GSM boards (the default is "khomp-CC-DD", where "DD" will be replaced at the time of connection by the device number, "CC" by channel number, and "SSSS" by the device serial number); -</li><li><b>context-gsm-alt-call</b> (or <b>context-gsm-alt</b>): Alternative input context for GSM (the default is zero - when set, follows the same substitution rules for <b>context-gsm-call</b>); </li><li><b>context-gsm-sms</b>: Context for incoming SMSs (the default is "khomp-sms-CC-DD", where "DD" will be replaced by the number of device, "CC" by channel number and "SSSS" by the device's serial number); -</li><li><b>context-gsm-wait</b>: Context used for pre-processing of incoming GSM calls that are on waiting state - to disable this feature, use <b>none</b> (the default is "khomp-wait-CC-DD", where "DD" will be replaced by the number of device, "CC" by channel number and "SSSS" by the device's serial number); </li><li><b>context-pr</b>: Context for incoming connections on boards KPR (default is "khomp-CC-DD", where "DD" will be replaced at the time of connection by the device number, "CC "by channel number); </li><li><b>disconnect-delay</b>: Sets the time in milliseconds to perform processing a disconnect event, to ignore situations where other equipment performing the double service to overthrow collect calls (local option); </li><li><b>echo-canceller</b> (former 'echocanceller): Active ("yes") or disables ("no") echo cancellation automatic Endpoint (local option); @@ -223,8 +220,8 @@ that come from the link 1 (second link) of the board 0. </li><li> The incoming calls on the link <b>1</b> of the board <b>0</b> for the number <b>1111</b> will be redirected to the first link of the first board (b0L0) calling number <b>2345</b>. </li></ol> <a name="Contexts_of_FXS.2FFXO.2FGSM_channels" id="Contexts_of_FXS.2FFXO.2FGSM_channels"></a><h3> <span class="mw-headline"> Contexts of FXS/FXO/GSM channels </span></h3> -<p>Just as in the context of E1 cards, inbound links are forwarded to the Endpoint FreeSwitch. However, these signals have two pre-defined contexts, sought with a preference order. -</p><p>The first context is pre-defined as follows, according to the file <b>khomp.conf.xml</b>: +<p>Just as in the context of E1 cards, inbound links are forwarded to the Endpoint FreeSwitch. +</p><p>The context is pre-defined as follows, according to the file <b>khomp.conf.xml</b>: </p> <pre><param name="context-gsm" value="khomp-DD-CC"/> ;placas GSM </pre> @@ -232,26 +229,12 @@ that come from the link 1 (second link) of the board 0. </pre> <pre><param name="context-fxo" value="khomp-DD-CC"/> ; placas FXO </pre> -<p>There is also an alternative context, which has the following default value: -</p> -<pre><param name="context-gsm-alt" value="khomp-DD"/> ; placas GSM -</pre> -<pre><param name="context-fxs-alt" value="khomp-DD"/> ; placas FXS -</pre> -<pre><param name="context-fxo-alt" value="khomp-DD"/> ; placas FXO -</pre> <p>For these options, <b>DD</b> is the device number (two digits), and <b>CC</b> is the channel number (also two digits). There is also the <b>SSSS</b> format, which represents the serial number board. </p> <ul><li><b>NOTE</b>: In the <b>KGSM</b> board, incoming calls are <b>always</b> redirected to the <b>"s"</b> extension, since the GSM protocol does not identify the target number, only the originator - if not omitted. </li></ul> <a name="Priority_settings_on_the_FXS_branches" id="Priority_settings_on_the_FXS_branches"></a><h4> <span class="mw-headline"> Priority settings on the FXS branches </span></h4> -<p>On calls originated from an FXS branch, the Endpoint searches for a valid extension in three different contexts. The priority of contexts is as follows: -</p> -<ol><li> Branch-specific extension, defined in section <b><fxs-options></b> of file <b>khomp.conf.xml</b>; -</li><li> Context defined in <b>context-fxs</b>; -</li><li> Context defined in <b>context-fxs-alt</b>. -</li></ol> -<p>If no valid extension can be found, the extension <b>i</b> is searched in the contexts above, and also in the <b>default</b> context. If the dialing timeout is reached (option <b>fxs-digit-timeout</b>), the search will consider all digits dialed until the timeout; if no extension is found, it will search extension "t"; if nothing is found again, then extension "i" will be searched; if no extension is found, "fast-busy" cadence will be played. +<p>On calls originated from an FXS branch, the Endpoint searches for a valid extension (digits sent) after the DTMF <b>#</b> or after the <i>timeout</i> (option <b>fxs-digit-timeout</b>). That search is done in the context defined in section <b><fxs-options></b>, or if no context configured, the search is done in context defined in <b>context-fxs</b>. <br /> </p> <a name="Contexts_for_SMS_messages_.28GSM_only.29" id="Contexts_for_SMS_messages_.28GSM_only.29"></a><h3> <span class="mw-headline"> Contexts for SMS messages (GSM only) </span></h3> @@ -278,6 +261,10 @@ that come from the link 1 (second link) of the board 0. </pre> <p>In this case, <b>DD</b> is the device number (two digits), and<b>CC</b> is the channel number (also two digits). The name and format of this context can also be changed through the "context-pr" in the configuration file. <br /> +</p> +<a name="Groups_contexts" id="Groups_contexts"></a><h3> <span class="mw-headline"> Groups contexts </span></h3> +<p>The section <b>groups</b>, in the configuration file <b>khomp.conf.xml</b>, can be used to define specific settings for certain groups of channels. +</p><p>This section is detailed in the section <b>Endpoint Configuration</b>. <br /> </p> <a name="Using_the_bridge_application" id="Using_the_bridge_application"></a><h3> <span class="mw-headline"> Using the <i>bridge</i> application </span></h3> diff --git a/src/mod/endpoints/mod_khomp/docs/User_Guide.pdf b/src/mod/endpoints/mod_khomp/docs/User_Guide.pdf index 2f8c874..fd8027b 100644 Binary files a/src/mod/endpoints/mod_khomp/docs/User_Guide.pdf and b/src/mod/endpoints/mod_khomp/docs/User_Guide.pdf differ diff --git a/src/mod/endpoints/mod_khomp/include/khomp_pvt.h b/src/mod/endpoints/mod_khomp/include/khomp_pvt.h index 5037492..bed6e1e 100644 --- a/src/mod/endpoints/mod_khomp/include/khomp_pvt.h +++ b/src/mod/endpoints/mod_khomp/include/khomp_pvt.h @@ -85,10 +85,6 @@ struct Board /******************************** Channel *************************************/ struct KhompPvt { - // TODO: Here for while, put in right struct, when is ready - typedef std::vector<std::string> ContextListType; - typedef std::vector<std::string> ExtenListType; - typedef SimpleNonBlockLock<25,100> ChanLockType; typedef enum @@ -994,29 +990,26 @@ public: virtual int getActiveChannel(bool invalid_as_not_found); - MatchType matchExtension(std::string &, std::string &, std::string &, bool match_only = false); - - MatchType findExtension(std::string &, std::string &, ContextListType &, std::string &, std::string &, - bool default_ctx = true, bool default_ext = true); - /* Let's validate the contexts */ - virtual bool validContexts(Board::KhompPvt::ContextListType & contexts, std::string extra_string = "") + virtual bool validContexts(MatchExtension::ContextListType & contexts, + std::string extra_string = "") { DBG(FUNC,PVT_FMT(_target,"c")); if(!_group_context.empty()) { - contexts.push_back(_group_context); + contexts.insert(contexts.begin(), _group_context); + //contexts.push_back(_group_context); } - for (Board::KhompPvt::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) + for (MatchExtension::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) replaceTemplate((*i), "DD", _target.device); BEGIN_CONTEXT { K3L_DEVICE_CONFIG & dev_cfg = Globals::k3lapi.device_config(_target.device); - for (Board::KhompPvt::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) + for (MatchExtension::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) replaceTemplate((*i), "SSSS", atoi(dev_cfg.SerialNumber)); } END_CONTEXT diff --git a/src/mod/endpoints/mod_khomp/include/khomp_pvt_fxo.h b/src/mod/endpoints/mod_khomp/include/khomp_pvt_fxo.h index 87eaa29..130c3b3 100644 --- a/src/mod/endpoints/mod_khomp/include/khomp_pvt_fxo.h +++ b/src/mod/endpoints/mod_khomp/include/khomp_pvt_fxo.h @@ -241,7 +241,8 @@ struct KhompPvtFXO: public KhompPvt void setAnswerInfo(int answer_info); bool indicateBusyUnlocked(int cause, bool sent_signaling = false); void reportFailToReceive(int fail_code); - bool validContexts(Board::KhompPvt::ContextListType & contexts, std::string extra_context = ""); + bool validContexts(MatchExtension::ContextListType & contexts, + std::string extra_context = ""); bool isOK(void); diff --git a/src/mod/endpoints/mod_khomp/include/khomp_pvt_gsm.h b/src/mod/endpoints/mod_khomp/include/khomp_pvt_gsm.h index 31ca1a0..d31dba5 100644 --- a/src/mod/endpoints/mod_khomp/include/khomp_pvt_gsm.h +++ b/src/mod/endpoints/mod_khomp/include/khomp_pvt_gsm.h @@ -262,7 +262,8 @@ struct KhompPvtGSM: public KhompPvt _sms->statistics()->clear(); } - bool validContexts(Board::KhompPvt::ContextListType & contexts, std::string extra_context = ""); + bool validContexts(MatchExtension::ContextListType & contexts, + std::string extra_context = ""); SMS * _sms; diff --git a/src/mod/endpoints/mod_khomp/include/khomp_pvt_kxe1.h b/src/mod/endpoints/mod_khomp/include/khomp_pvt_kxe1.h index c87dd23..85b1af0 100644 --- a/src/mod/endpoints/mod_khomp/include/khomp_pvt_kxe1.h +++ b/src/mod/endpoints/mod_khomp/include/khomp_pvt_kxe1.h @@ -191,7 +191,8 @@ struct KhompPvtE1: public KhompPvt bool setupConnection(); bool indicateBusyUnlocked(int cause, bool sent_signaling = false); void setAnswerInfo(int answer_info); - bool validContexts(Board::KhompPvt::ContextListType & contexts, std::string extra_context = ""); + bool validContexts(MatchExtension::ContextListType & contexts, + std::string extra_context = ""); bool isOK(void); bool isPhysicalFree() @@ -931,7 +932,8 @@ struct KhompPvtFXS: public KhompPvt bool alloc(); bool indicateBusyUnlocked(int cause, bool sent_signaling = false); void reportFailToReceive(int fail_code); - bool validContexts(Board::KhompPvt::ContextListType & contexts, std::string extra_context = ""); + bool validContexts(MatchExtension::ContextListType & contexts, + std::string extra_context = ""); bool isOK(void); bool startTransfer(); diff --git a/src/mod/endpoints/mod_khomp/include/khomp_pvt_passive.h b/src/mod/endpoints/mod_khomp/include/khomp_pvt_passive.h index 55b0659..a0a6df0 100644 --- a/src/mod/endpoints/mod_khomp/include/khomp_pvt_passive.h +++ b/src/mod/endpoints/mod_khomp/include/khomp_pvt_passive.h @@ -126,7 +126,8 @@ struct KhompPvtPassive: public KhompPvt return ret; } - bool validContexts(Board::KhompPvt::ContextListType & contexts, std::string extra_context = ""); + bool validContexts(MatchExtension::ContextListType & contexts, + std::string extra_context = ""); /* virtual bool cleanup(CleanupType type = CLN_HARD) diff --git a/src/mod/endpoints/mod_khomp/include/revision.h b/src/mod/endpoints/mod_khomp/include/revision.h index 4665cda..bbb7f6b 100644 --- a/src/mod/endpoints/mod_khomp/include/revision.h +++ b/src/mod/endpoints/mod_khomp/include/revision.h @@ -1 +1 @@ -#define MOD_KHOMP_VERSION "1.0 - (rev: 5796)" +#define MOD_KHOMP_VERSION "1.0 - (rev: 5823)" diff --git a/src/mod/endpoints/mod_khomp/include/utils.h b/src/mod/endpoints/mod_khomp/include/utils.h index 34e9b26..0c71a74 100644 --- a/src/mod/endpoints/mod_khomp/include/utils.h +++ b/src/mod/endpoints/mod_khomp/include/utils.h @@ -601,109 +601,30 @@ static std::string timeToString (time_t time_value) } /******************************************************************************/ /******************************* Match functions ******************************/ -typedef enum -{ - MATCH_NONE, - MATCH_EXACT, - MATCH_MORE -} -MatchType; - -static bool canMatch(std::string & context, std::string & exten, std::string & caller_id, bool match_more = false) +struct MatchExtension { - switch_xml_t xml = NULL; - switch_xml_t xcontext = NULL; - switch_regex_t *re; - int ovector[30]; - - if (switch_xml_locate("dialplan","context","name",context.c_str(),&xml,&xcontext, NULL,SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) - { - switch_xml_t xexten = NULL; - - if(!(xexten = switch_xml_child(xcontext,"extension"))) - { - DBG(FUNC,"extension cannot match, returning"); - - if(xml) - switch_xml_free(xml); - - return false; - } + typedef std::vector<std::string> ContextListType; + typedef std::vector<std::string> ExtenListType; - while(xexten) - { - switch_xml_t xcond = NULL; - - for (xcond = switch_xml_child(xexten, "condition"); xcond; xcond = xcond->next) - { - std::string expression; - - if (switch_xml_child(xcond, "condition")) - { - LOG(ERROR,"Nested conditions are not allowed"); - } - - switch_xml_t xexpression = switch_xml_child(xcond, "expression"); - - if ((xexpression = switch_xml_child(xcond, "expression"))) - { - expression = switch_str_nil(xexpression->txt); - } - else - { - expression = switch_xml_attr_soft(xcond, "expression"); - } - - if(expression.empty() || expression == "^(.*)$") - { - /** - * We're not gonna take it - * No, we ain't gonna take it - * We're not gonna take it anymore - **/ - continue; - } - - int pm = -1; - switch_status_t is_match = SWITCH_STATUS_FALSE; - is_match = switch_regex_match_partial(exten.c_str(),expression.c_str(),&pm); - - if(is_match == SWITCH_STATUS_SUCCESS) - { - if(match_more) - { - if(pm == 1) - { - switch_xml_free(xml); - return true; - } - } - else - { - switch_xml_free(xml); - return true; - } - } - else - { - // not match - } - } - - xexten = xexten->next; - } - } - else + typedef enum { - DBG(FUNC,"context cannot match, returning"); + MATCH_NONE, + MATCH_EXACT, + MATCH_MORE } + MatchType; - if(xml) - switch_xml_free(xml); + static bool canMatch(std::string & context, std::string & exten, + std::string & caller_id, bool match_more = false); - return false; -} + static MatchType matchExtension(std::string &, std::string &, + std::string &, bool match_only = false); + static MatchType findExtension(std::string &, std::string &, + ContextListType &, std::string &, std::string &, + bool default_ctx = true, bool default_ext = true); + +}; /******************************************************************************/ /************************** Thread helper functions ***************************/ typedef int (HandlerType)(void *); diff --git a/src/mod/endpoints/mod_khomp/src/applications.cpp b/src/mod/endpoints/mod_khomp/src/applications.cpp index 3826431..d4a50e0 100644 --- a/src/mod/endpoints/mod_khomp/src/applications.cpp +++ b/src/mod/endpoints/mod_khomp/src/applications.cpp @@ -382,26 +382,27 @@ bool Fax::addFaxFile(const char * filename, bool last) bool SMS::justAlloc(unsigned int count) { /* incoming contexts */ - Board::KhompPvt::ContextListType contexts; + MatchExtension::ContextListType contexts; contexts.push_back(Opt::_context_gsm_sms); /* temporary variables */ std::string context; - std::string exten; + std::string exten("s"); K3L_DEVICE_CONFIG & dev_cfg = Globals::k3lapi.device_config(_pvt->_target.device); - for (Board::KhompPvt::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) + for (MatchExtension::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) { replaceTemplate((*i), "DD", _pvt->_target.device); replaceTemplate((*i), "CC", _pvt->_target.object); replaceTemplate((*i), "SSSS", atoi(dev_cfg.SerialNumber)); } - switch(_pvt->findExtension(exten, context, contexts, _got_sms._type, _got_sms._from, false, true)) + //switch(_pvt->findExtension(exten, context, contexts, _got_sms._type, _got_sms._from, false, true)) + switch(MatchExtension::findExtension(exten, context, contexts, exten, _got_sms._from, false, true)) { - case MATCH_NONE: + case MatchExtension::MATCH_NONE: if( _got_sms._type != "broadcast") { LOG(WARNING, PVT_FMT(_pvt->target(), "unable to find context/exten for incoming SMS (s/%s), processing disabled for this channel.") @@ -437,7 +438,7 @@ bool SMS::justAlloc(unsigned int count) switch_caller_profile_t *caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session), "Khomp_SMS", //username - "XML", //dialplan + Opt::_dialplan.c_str(), //dialplan NULL, //caller_id_name _got_sms._from.c_str(), //caller_id_number NULL, //network_addr diff --git a/src/mod/endpoints/mod_khomp/src/khomp_pvt.cpp b/src/mod/endpoints/mod_khomp/src/khomp_pvt.cpp index 3d1235e..225312b 100644 --- a/src/mod/endpoints/mod_khomp/src/khomp_pvt.cpp +++ b/src/mod/endpoints/mod_khomp/src/khomp_pvt.cpp @@ -592,7 +592,7 @@ switch_status_t Board::KhompPvt::justStart(switch_caller_profile_t *profile) if(call()->_incoming_context.empty()) { - Board::KhompPvt::ContextListType contexts; + MatchExtension::ContextListType contexts; std::string context("default"); if(!validContexts(contexts)) @@ -603,16 +603,16 @@ switch_status_t Board::KhompPvt::justStart(switch_caller_profile_t *profile) return SWITCH_STATUS_FALSE; } - switch(findExtension(exten, context, contexts, _call->_dest_addr, _call->_orig_addr)) + switch(MatchExtension::findExtension(exten, context, contexts, _call->_dest_addr, _call->_orig_addr)) { - case MATCH_NONE: + case MatchExtension::MATCH_NONE: destroy(); owner(NULL); LOG(ERROR, PVT_FMT(_target, "r (unable to find exten/context on incoming call %s/%s)") % _call->_dest_addr % (contexts.size() >= 1 ? contexts[0] : "default")); return SWITCH_STATUS_FALSE; default: - DBG(FUNC, PVT_FMT(_target, "our: context '%s', exten '%s'") % context % exten); + DBG(FUNC, PVT_FMT(_target, "our: dialplan '%s', context '%s', exten '%s'") % Opt::_dialplan % context % exten); break; } @@ -621,12 +621,12 @@ switch_status_t Board::KhompPvt::justStart(switch_caller_profile_t *profile) else { exten = call()->_dest_addr; - DBG(FUNC, PVT_FMT(target(), "already found our: context '%s', exten '%s'") % call()->_incoming_context % exten); + DBG(FUNC, PVT_FMT(target(), "already found our: dialplan '%s', context '%s', exten '%s'") % Opt::_dialplan % call()->_incoming_context % exten); } _caller_profile = switch_caller_profile_new(switch_core_session_get_pool(_session), "Khomp", //username - "XML", //dialplan + Opt::_dialplan.c_str(), //dialplan NULL, //caller_id_name _call->_orig_addr.c_str(), //caller_id_number NULL, //network_addr @@ -1421,91 +1421,6 @@ int Board::KhompPvt::getActiveChannel(bool invalid_as_not_found) return 0; } -MatchType Board::KhompPvt::matchExtension(std::string & context, std::string & exten, - std::string & callerid, bool match_only) -{ - if(!canMatch(context,exten,callerid)) - { - DBG(FUNC, "context/extension cannot match"); - return MATCH_NONE; - } - - if(match_only) - { - DBG(FUNC, "for now we want know if it matches..."); - return MATCH_MORE; - } - - if(!canMatch(context,exten,callerid,true)) - { - DBG(FUNC, "it match exact!"); - return MATCH_EXACT; - } - - return MATCH_MORE; -} - -MatchType Board::KhompPvt::findExtension(std::string & ref_extension, - std::string & ref_context, - ContextListType & contexts, - std::string & extension, - std::string & caller_id, - bool default_ctx, - bool default_ext) -{ - Board::KhompPvt::ExtenListType extens; - - if(!extension.empty()) - { - extens.push_back(extension); - } - - if(default_ext) - { - if (extension != "s") - { - extens.push_back("s"); - } - - extens.push_back("i"); - } - - if(default_ctx) - { - contexts.push_back("default"); - } - - for(Board::KhompPvt::ContextListType::iterator itc = contexts.begin(); itc != contexts.end(); itc++) - { - for(Board::KhompPvt::ExtenListType::iterator ite = extens.begin(); ite != extens.end(); ite++) - { - DBG(FUNC, FMT("trying context '%s' with exten '%s'...") % *itc % *ite); - - MatchType m = matchExtension(*itc, *ite, caller_id, false); - - switch (m) - { - case MATCH_NONE: - continue; - - case MATCH_MORE: - case MATCH_EXACT: - { - ref_context = *itc; - ref_extension = *ite; - - DBG(FUNC, ".... can match context/extension (some way)!"); - - return m; - } - } - } - } - - DBG(FUNC, D("... no context/extension found!")); - return MATCH_NONE; -} - bool Board::KhompPvt::setCollectCall() { DBG(FUNC, PVT_FMT(target(), "c")); diff --git a/src/mod/endpoints/mod_khomp/src/khomp_pvt_fxo.cpp b/src/mod/endpoints/mod_khomp/src/khomp_pvt_fxo.cpp index 1383f5c..f45638b 100644 --- a/src/mod/endpoints/mod_khomp/src/khomp_pvt_fxo.cpp +++ b/src/mod/endpoints/mod_khomp/src/khomp_pvt_fxo.cpp @@ -734,14 +734,15 @@ void BoardFXO::KhompPvtFXO::reportFailToReceive(int fail_code) } -bool BoardFXO::KhompPvtFXO::validContexts(Board::KhompPvt::ContextListType & contexts, std::string extra_context) +bool BoardFXO::KhompPvtFXO::validContexts( + MatchExtension::ContextListType & contexts, std::string extra_context) { DBG(FUNC,PVT_FMT(_target,"(FXO) c")); contexts.push_back(Opt::_context_fxo); contexts.push_back(Opt::_context2_fxo); - for (Board::KhompPvt::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) + for (MatchExtension::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) { replaceTemplate((*i), "CC", _target.object); } diff --git a/src/mod/endpoints/mod_khomp/src/khomp_pvt_gsm.cpp b/src/mod/endpoints/mod_khomp/src/khomp_pvt_gsm.cpp index 2f24c60..1095c5a 100644 --- a/src/mod/endpoints/mod_khomp/src/khomp_pvt_gsm.cpp +++ b/src/mod/endpoints/mod_khomp/src/khomp_pvt_gsm.cpp @@ -511,7 +511,8 @@ int BoardGSM::KhompPvtGSM::callFailFromCause(int cause) return k3l_fail; } -bool BoardGSM::KhompPvtGSM::validContexts(Board::KhompPvt::ContextListType & contexts, std::string extra_context) +bool BoardGSM::KhompPvtGSM::validContexts( + MatchExtension::ContextListType & contexts, std::string extra_context) { DBG(FUNC,PVT_FMT(_target,"(GSM) c")); @@ -540,20 +541,12 @@ bool BoardGSM::KhompPvtGSM::validContexts(Board::KhompPvt::ContextListType & con context += extra_context; contexts.push_back(_group_context); } - - if (!Opt::_context2_gsm_call.empty()) - { - std::string context(Opt::_context2_gsm_call); - context += "-"; - context += extra_context; - contexts.push_back(_group_context); - } } contexts.push_back(Opt::_context_gsm_call); contexts.push_back(Opt::_context2_gsm_call); - for (Board::KhompPvt::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) + for (MatchExtension::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) replaceTemplate((*i), "CC", _target.object); bool ret = Board::KhompPvt::validContexts(contexts,extra_context); diff --git a/src/mod/endpoints/mod_khomp/src/khomp_pvt_kxe1.cpp b/src/mod/endpoints/mod_khomp/src/khomp_pvt_kxe1.cpp index 4dec540..b5acfd1 100644 --- a/src/mod/endpoints/mod_khomp/src/khomp_pvt_kxe1.cpp +++ b/src/mod/endpoints/mod_khomp/src/khomp_pvt_kxe1.cpp @@ -818,13 +818,14 @@ bool BoardE1::KhompPvtE1::application(ApplicationType type, switch_core_session_ return true; } -bool BoardE1::KhompPvtE1::validContexts(Board::KhompPvt::ContextListType & contexts, std::string extra_context) +bool BoardE1::KhompPvtE1::validContexts( + MatchExtension::ContextListType & contexts, std::string extra_context) { DBG(FUNC,PVT_FMT(_target, "(E1) c")); contexts.push_back(Opt::_context_digital); - for (Board::KhompPvt::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) + for (MatchExtension::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) { replaceTemplate((*i), "LL", ((_target.object)/30)); replaceTemplate((*i), "CCC", _target.object); @@ -1903,19 +1904,19 @@ bool BoardE1::KhompPvtR2::onNumberDetected(K3L_EVENT *e) DBG(FUNC, PVT_FMT(_target, "incoming exten %s") % callR2()->_incoming_exten); /* begin context adjusting + processing */ - Board::KhompPvt::ContextListType contexts; + MatchExtension::ContextListType contexts; validContexts(contexts); /* temporary */ - std::string tmp_exten("s"); - std::string tmp_context("default"); + std::string tmp_exten; + std::string tmp_context; std::string tmp_orig(""); - switch (findExtension(tmp_exten, tmp_context, contexts, callR2()->_incoming_exten,tmp_orig, false, false)) + switch (MatchExtension::findExtension(tmp_exten, tmp_context, contexts, callR2()->_incoming_exten,tmp_orig, false, false)) { - case MATCH_EXACT: - case MATCH_NONE: + case MatchExtension::MATCH_EXACT: + case MatchExtension::MATCH_NONE: call()->_flags.set(Kflags::NUMBER_DIAL_FINISHD); DBG(FUNC,FMT("incoming exten matched: %s") % callR2()->_incoming_exten); @@ -1924,7 +1925,7 @@ bool BoardE1::KhompPvtR2::onNumberDetected(K3L_EVENT *e) command(KHOMP_LOG,CM_END_OF_NUMBER); break; - case MATCH_MORE: + case MatchExtension::MATCH_MORE: DBG(FUNC, "didn't match exact extension, waiting..."); // cannot say anything exact about the number, do nothing... break; @@ -2396,18 +2397,19 @@ void BoardE1::KhompPvtFXS::transferTimer(KhompPvt * pvt) } /* begin context adjusting + processing */ - ContextListType contexts; + MatchExtension::ContextListType contexts; pvt_fxs->validContexts(contexts); - std::string tmp_exten("s"); - std::string tmp_context("default"); + std::string tmp_exten; + std::string tmp_context; - switch (pvt_fxs->findExtension(tmp_exten, tmp_context, contexts, pvt_fxs->callFXS()->_flash_transfer, pvt_fxs->call()->_orig_addr, false, false)) + switch (MatchExtension::findExtension(tmp_exten, tmp_context, contexts, pvt_fxs->callFXS()->_flash_transfer, pvt_fxs->call()->_orig_addr, false, false)) { - case MATCH_EXACT: - case MATCH_MORE: + case MatchExtension::MATCH_EXACT: + case MatchExtension::MATCH_MORE: { + pvt_fxs->callFXS()->_flash_transfer = tmp_exten; DBG(FUNC,FMT("incoming exten matched: %s") % pvt_fxs->callFXS()->_flash_transfer); if(!pvt_fxs->transfer(tmp_context)) @@ -2419,7 +2421,7 @@ void BoardE1::KhompPvtFXS::transferTimer(KhompPvt * pvt) break; } - case MATCH_NONE: + case MatchExtension::MATCH_NONE: { DBG(FUNC, PVT_FMT(pvt_fxs->target(), "match none!")); @@ -2702,7 +2704,7 @@ bool BoardE1::KhompPvtFXS::transfer(std::string & context, bool blind) if(blind) { DBG(FUNC, PVT_FMT(_target, "Blind Transfer")); - switch_ivr_session_transfer(peer_session, number.c_str(), "XML", context.c_str()); + switch_ivr_session_transfer(peer_session, number.c_str(), Opt::_dialplan.c_str(), context.c_str()); } else { @@ -2741,7 +2743,7 @@ bool BoardE1::KhompPvtFXS::transfer(std::string & context, bool blind) switch_channel_set_variable(channel, SWITCH_PARK_AFTER_BRIDGE_VARIABLE, "true"); switch_core_event_hook_add_state_change(session(), xferHook); - switch_ivr_session_transfer(session(), number.c_str(), "XML", context.c_str()); + switch_ivr_session_transfer(session(), number.c_str(), Opt::_dialplan.c_str(), context.c_str()); DBG(FUNC, PVT_FMT(target(), "Generating ring")); call()->_indication = INDICA_RING; @@ -2819,16 +2821,17 @@ bool BoardE1::KhompPvtFXS::onDtmfDetected(K3L_EVENT *e) callFXS()->_incoming_exten += e->AddInfo; /* begin context adjusting + processing */ - ContextListType contexts; + MatchExtension::ContextListType contexts; validContexts(contexts); - std::string tmp_exten("s"); - std::string tmp_context("default"); + std::string tmp_exten; + std::string tmp_context; - switch (findExtension(tmp_exten, tmp_context, contexts, callFXS()->_incoming_exten, call()->_orig_addr, false, false)) + switch (MatchExtension::findExtension(tmp_exten, tmp_context, contexts, callFXS()->_incoming_exten, call()->_orig_addr, false, false)) { - case MATCH_EXACT: + case MatchExtension::MATCH_EXACT: + callFXS()->_incoming_exten = tmp_exten; DBG(FUNC,FMT("incoming exten matched: %s") % callFXS()->_incoming_exten); Board::board(_target.device)->_timers.del(callFXS()->_idx_dial); call()->_dest_addr = callFXS()->_incoming_exten; @@ -2837,7 +2840,7 @@ bool BoardE1::KhompPvtFXS::onDtmfDetected(K3L_EVENT *e) alloc(); break; - case MATCH_MORE: + case MatchExtension::MATCH_MORE: DBG(FUNC, PVT_FMT(target(), "match more...")); /* can match, will match more, and it's an external call? */ @@ -2851,23 +2854,23 @@ bool BoardE1::KhompPvtFXS::onDtmfDetected(K3L_EVENT *e) } break; - case MATCH_NONE: + case MatchExtension::MATCH_NONE: DBG(FUNC, PVT_FMT(target(), "match none!")); std::string invalid = "i"; Board::board(_target.device)->_timers.del(callFXS()->_idx_dial); - switch (findExtension(tmp_exten, tmp_context, contexts, invalid, call()->_orig_addr, true, false)) + switch (MatchExtension::findExtension(tmp_exten, tmp_context, contexts, invalid, call()->_orig_addr, true, false)) { - case MATCH_EXACT: + case MatchExtension::MATCH_EXACT: // this dialing is invalid, and we can handle it... call()->_dest_addr = invalid; call()->_incoming_context = tmp_context; alloc(); break; - case MATCH_MORE: - case MATCH_NONE: + case MatchExtension::MATCH_MORE: + case MatchExtension::MATCH_NONE: callFXS()->_flags.set(Kflags::FXS_DIAL_FINISHD); startCadence(PLAY_FASTBUSY); break; @@ -2896,17 +2899,18 @@ bool BoardE1::KhompPvtFXS::onDtmfDetected(K3L_EVENT *e) callFXS()->_flash_transfer += e->AddInfo; /* begin context adjusting + processing */ - ContextListType contexts; + MatchExtension::ContextListType contexts; validContexts(contexts); - std::string tmp_exten("s"); - std::string tmp_context("default"); + std::string tmp_exten; + std::string tmp_context; - switch (findExtension(tmp_exten, tmp_context, contexts, callFXS()->_flash_transfer, call()->_orig_addr, false, false)) + switch (MatchExtension::findExtension(tmp_exten, tmp_context, contexts, callFXS()->_flash_transfer, call()->_orig_addr, false, false)) { - case MATCH_EXACT: + case MatchExtension::MATCH_EXACT: { + callFXS()->_flash_transfer = tmp_exten; DBG(FUNC,FMT("incoming exten matched: %s") % callFXS()->_flash_transfer); if(!transfer(tmp_context)) @@ -2918,7 +2922,7 @@ bool BoardE1::KhompPvtFXS::onDtmfDetected(K3L_EVENT *e) break; } - case MATCH_MORE: + case MatchExtension::MATCH_MORE: DBG(FUNC, PVT_FMT(target(), "match more...")); /* can match, will match more, and it's an external call? */ @@ -2932,7 +2936,7 @@ bool BoardE1::KhompPvtFXS::onDtmfDetected(K3L_EVENT *e) } break; - case MATCH_NONE: + case MatchExtension::MATCH_NONE: { DBG(FUNC, PVT_FMT(target(), "match none!")); @@ -3379,7 +3383,8 @@ void BoardE1::KhompPvtFXS::reportFailToReceive(int fail_code) } } -bool BoardE1::KhompPvtFXS::validContexts(Board::KhompPvt::ContextListType & contexts, std::string extra_context) +bool BoardE1::KhompPvtFXS::validContexts( + MatchExtension::ContextListType & contexts, std::string extra_context) { DBG(FUNC,PVT_FMT(_target, "(FXS) c")); @@ -3389,7 +3394,7 @@ bool BoardE1::KhompPvtFXS::validContexts(Board::KhompPvt::ContextListType & cont contexts.push_back(Opt::_context_fxs); contexts.push_back(Opt::_context2_fxs); - for (Board::KhompPvt::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) + for (MatchExtension::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) { replaceTemplate((*i), "CC", _target.object); } diff --git a/src/mod/endpoints/mod_khomp/src/khomp_pvt_passive.cpp b/src/mod/endpoints/mod_khomp/src/khomp_pvt_passive.cpp index 01c1610..28ccb99 100644 --- a/src/mod/endpoints/mod_khomp/src/khomp_pvt_passive.cpp +++ b/src/mod/endpoints/mod_khomp/src/khomp_pvt_passive.cpp @@ -45,13 +45,14 @@ #include "lock.h" #include "logger.h" -bool BoardPassive::KhompPvtPassive::validContexts(Board::KhompPvt::ContextListType & contexts, std::string extra_context) +bool BoardPassive::KhompPvtPassive::validContexts( + MatchExtension::ContextListType & contexts, std::string extra_context) { DBG(FUNC,PVT_FMT(_target,"(Passive) c")); contexts.push_back(Opt::_context_pr); - for (Board::KhompPvt::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) + for (MatchExtension::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) { replaceTemplate((*i), "CC", _target.object); } @@ -89,16 +90,16 @@ bool BoardPassive::KhompPvtHI::onSeizureStart(K3L_EVENT *e) } /* begin context adjusting + processing */ - ContextListType contexts; + MatchExtension::ContextListType contexts; validContexts(contexts); std::string tmp_exten; std::string tmp_context; - switch (findExtension(tmp_exten, tmp_context, contexts, call()->_dest_addr, call()->_orig_addr, false)) + switch (MatchExtension::findExtension(tmp_exten, tmp_context, contexts, call()->_dest_addr, call()->_orig_addr, false)) { - case MATCH_NONE: + case MatchExtension::MATCH_NONE: destroy(); owner(NULL); LOG(WARNING, PVT_FMT(_target, "(HI) r (unable to find exten/context on incoming call %s/%s)") @@ -111,6 +112,7 @@ bool BoardPassive::KhompPvtHI::onSeizureStart(K3L_EVENT *e) } call()->_incoming_context = tmp_context; + _call->_dest_addr = tmp_exten; startListen(); @@ -209,16 +211,16 @@ bool BoardPassive::KhompPvtKPR::onNewCall(K3L_EVENT *e) } /* begin context adjusting + processing */ - ContextListType contexts; + MatchExtension::ContextListType contexts; validContexts(contexts); std::string tmp_exten; std::string tmp_context; - switch (findExtension(tmp_exten, tmp_context, contexts, call()->_dest_addr, call()->_orig_addr, false)) + switch (MatchExtension::findExtension(tmp_exten, tmp_context, contexts, call()->_dest_addr, call()->_orig_addr, false)) { - case MATCH_NONE: + case MatchExtension::MATCH_NONE: destroy(); owner(NULL); LOG(WARNING, PVT_FMT(_target, "(KPR) r (unable to find exten/context on incoming call %s/%s)") diff --git a/src/mod/endpoints/mod_khomp/src/utils.cpp b/src/mod/endpoints/mod_khomp/src/utils.cpp index 9044e60..a0e6856 100644 --- a/src/mod/endpoints/mod_khomp/src/utils.cpp +++ b/src/mod/endpoints/mod_khomp/src/utils.cpp @@ -236,6 +236,214 @@ const char * answerInfoToString(int answer_info) return NULL; } +/******************************* Match functions ******************************/ +bool MatchExtension::canMatch(std::string & context, std::string & exten, + std::string & caller_id, bool match_more) +{ + if(!match_more) + { + return true; + } + + size_t finished = exten.find('#'); + + if(finished != std::string::npos) + { + exten.erase(finished); + DBG(FUNC, FMT("match exact!!! exten=%s") % exten); + return false; + } + + return true; + +/* + switch_xml_t xml = NULL; + switch_xml_t xcontext = NULL; + switch_regex_t *re; + int ovector[30]; + + if (switch_xml_locate("dialplan","context","name",context.c_str(),&xml,&xcontext, NULL,SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) + { + switch_xml_t xexten = NULL; + + if(!(xexten = switch_xml_child(xcontext,"extension"))) + { + DBG(FUNC,"extension cannot match, returning"); + + if(xml) + switch_xml_free(xml); + + return false; + } + + while(xexten) + { + switch_xml_t xcond = NULL; + + for (xcond = switch_xml_child(xexten, "condition"); xcond; xcond = xcond->next) + { + std::string expression; + + if (switch_xml_child(xcond, "condition")) + { + LOG(ERROR,"Nested conditions are not allowed"); + } + + switch_xml_t xexpression = switch_xml_child(xcond, "expression"); + + if ((xexpression = switch_xml_child(xcond, "expression"))) + { + expression = switch_str_nil(xexpression->txt); + } + else + { + expression = switch_xml_attr_soft(xcond, "expression"); + } + + if(expression.empty() || expression == "^(.*)$") + { + //We're not gonna take it + //No, we ain't gonna take it + // We're not gonna take it anymore + // + continue; + } + + int pm = -1; + switch_status_t is_match = SWITCH_STATUS_FALSE; + is_match = switch_regex_match_partial(exten.c_str(),expression.c_str(),&pm); + + if(is_match == SWITCH_STATUS_SUCCESS) + { + if(match_more) + { + if(pm == 1) + { + switch_xml_free(xml); + return true; + } + } + else + { + switch_xml_free(xml); + return true; + } + } + else + { + // not match + } + } + + xexten = xexten->next; + } + } + else + { + DBG(FUNC,"context cannot match, returning"); + } + + if(xml) + switch_xml_free(xml); + + return false; +*/ +} + + +MatchExtension::MatchType MatchExtension::matchExtension( + std::string & context, + std::string & exten, + std::string & callerid, + bool match_only) +{ + if(!canMatch(context,exten,callerid)) + { + DBG(FUNC, "context/extension cannot match"); + return MATCH_NONE; + } + + if(match_only) + { + DBG(FUNC, "for now we want know if it matches..."); + return MATCH_MORE; + } + + if(!canMatch(context,exten,callerid,true)) + { + DBG(FUNC, "it match exact!"); + return MATCH_EXACT; + } + + return MATCH_MORE; +} + +MatchExtension::MatchType MatchExtension::findExtension( + std::string & ref_extension, + std::string & ref_context, + ContextListType & contexts, + std::string & extension, + std::string & caller_id, + bool default_ctx, + bool default_ext) +{ + ExtenListType extens; + + if(!extension.empty()) + { + extens.push_back(extension); + } + + if(default_ext) + { + if (extension != "s") + { + extens.push_back("s"); + } + + extens.push_back("i"); + } + + if(default_ctx) + { + contexts.push_back("default"); + } + + for(ContextListType::iterator itc = contexts.begin(); itc != contexts.end(); itc++) + { + for(ExtenListType::iterator ite = extens.begin(); ite != extens.end(); ite++) + { + DBG(FUNC, FMT("trying context '%s' with exten '%s'...") % *itc % *ite); + ref_context = *itc; + ref_extension = *ite; + + MatchType m = matchExtension(ref_context, ref_extension, caller_id, false); + + switch (m) + { + case MATCH_NONE: + continue; + + case MATCH_MORE: + case MATCH_EXACT: + { + //ref_context = *itc; + //ref_extension = *ite; + + DBG(FUNC, ".... can match context/extension (some way)!"); + + return m; + } + } + } + } + + ref_context.clear(); + ref_extension.clear(); + + DBG(FUNC, D("... no context/extension found!")); + return MATCH_NONE; +} /******************************** Kommuter ************************************/ bool Kommuter::stop() commit 15070162ffa5dc956b6b0a2026abb2fc434a28e0 Author: Jeff Lenk <jeff@jefflenk.com> Date: Sat Oct 23 09:51:08 2010 -0500 windows installer - correct missing file diff --git a/w32/Setup/Setup.wixproj b/w32/Setup/Setup.wixproj index 20e1213..10dc600 100644 --- a/w32/Setup/Setup.wixproj +++ b/w32/Setup/Setup.wixproj @@ -577,7 +577,7 @@ <DoNotHarvest> </DoNotHarvest> <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> - <RefTargetDir>MODLLOCATION</RefTargetDir> + <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> <ProjectReference Include="..\..\src\mod\languages\mod_managed\mod_managed.2010.vcxproj"> <Name>mod_managed</Name> commit 917ebfe3350844dfc7384cb72ca2a643c785a21f Author: Jeff Lenk <jeff@jefflenk.com> Date: Sat Oct 23 09:38:56 2010 -0500 windows installer - correct missing files diff --git a/w32/Setup/Setup.wixproj b/w32/Setup/Setup.wixproj index 74f3fad..20e1213 100644 --- a/w32/Setup/Setup.wixproj +++ b/w32/Setup/Setup.wixproj @@ -246,6 +246,15 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> + <ProjectReference Include="..\..\src\mod\applications\mod_hash\mod_hash.2010.vcxproj"> + <Name>mod_hash</Name> + <Project>{2e250296-0c08-4342-9c8a-bcbdd0e7df65}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> <ProjectReference Include="..\..\src\mod\applications\mod_lcr\mod_lcr.2010.vcxproj"> <Name>mod_lcr</Name> <Project>{1a3793d1-05d1-4b57-9b0f-5af3e79dc439}</Project> @@ -372,6 +381,15 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> + <ProjectReference Include="..\..\src\mod\codecs\mod_h26x\mod_h26x.2010.vcxproj"> + <Name>mod_h26x</Name> + <Project>{2c3c2423-234b-4772-8899-d3b137e5ca35}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> <ProjectReference Include="..\..\src\mod\codecs\mod_ilbc\mod_ilbc.2010.vcxproj"> <Name>mod_ilbc</Name> <Project>{d3ec0aff-76fc-4210-a825-9a17410660a3}</Project> @@ -408,6 +426,15 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> + <ProjectReference Include="..\..\src\mod\dialplans\mod_dialplan_asterisk\mod_dialplan_asterisk.2010.vcxproj"> + <Name>mod_dialplan_asterisk</Name> + <Project>{e7bc026c-7cc5-45a3-bc7c-3b88eef01f24}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> <ProjectReference Include="..\..\src\mod\dialplans\mod_dialplan_directory\mod_dialplan_directory.2010.vcxproj"> <Name>mod_dialplan_directory</Name> <Project>{a27cca23-1541-4337-81a4-f0a6413078a0}</Project> @@ -453,6 +480,15 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> + <ProjectReference Include="..\..\src\mod\event_handlers\mod_cdr_csv\mod_cdr_csv.2010.vcxproj"> + <Name>mod_cdr_csv</Name> + <Project>{44d7deaf-fda5-495e-8b9d-1439e4f4c21e}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> <ProjectReference Include="..\..\src\mod\event_handlers\mod_event_multicast\mod_event_multicast.2010.vcxproj"> <Name>mod_event_multicast</Name> <Project>{784113ef-44d9-4949-835d-7065d3c7ad08}</Project> @@ -534,6 +570,15 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> + <ProjectReference Include="..\..\src\mod\languages\mod_managed\managed\FreeSWITCH.Managed.2010.csproj"> + <Name>FreeSWITCH.Managed.2010</Name> + <Project>{834e2b2f-5483-4b80-8fe3-fe48ff76e5c0}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLLOCATION</RefTargetDir> + </ProjectReference> <ProjectReference Include="..\..\src\mod\languages\mod_managed\mod_managed.2010.vcxproj"> <Name>mod_managed</Name> <Project>{7b42bda1-72c0-4378-a9b6-5c530f8cd61e}</Project> commit 28c827abd61eb212c4444abe426ac1349879d3ea Author: Jeff Lenk <jeff@jefflenk.com> Date: Sat Oct 23 08:32:38 2010 -0500 windows installer - correct missing file diff --git a/w32/Setup/Setup.wixproj b/w32/Setup/Setup.wixproj index 56d4c99..74f3fad 100644 --- a/w32/Setup/Setup.wixproj +++ b/w32/Setup/Setup.wixproj @@ -133,7 +133,8 @@ <Name>pthread</Name> <Project>{df018947-0fff-4eb3-bdee-441dc81da7a4}</Project> <Private>True</Private> - <DoNotHarvest>True</DoNotHarvest> + <DoNotHarvest> + </DoNotHarvest> <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>INSTALLLOCATION</RefTargetDir> </ProjectReference> commit 6a83988674ec62870f0efac85c428d2b6a238354 Merge: 564940c 9241a35 Author: Andrew Thompson <andrew@hijacked.us> Date: Sat Oct 23 02:06:52 2010 -0400 Merge branch 'master' of git.freeswitch.org:freeswitch commit 564940c27432a34eb4cb94e9a94d9828af39e4a3 Author: Andrew Thompson <andrew@hijacked.us> Date: Sat Oct 23 02:06:09 2010 -0400 Add FreeTDM to modules.conf.xml diff --git a/conf/autoload_configs/modules.conf.xml b/conf/autoload_configs/modules.conf.xml index d8ae5e1..f5627fe 100644 --- a/conf/autoload_configs/modules.conf.xml +++ b/conf/autoload_configs/modules.conf.xml @@ -34,6 +34,7 @@ <load module="mod_sofia"/> <load module="mod_loopback"/> <!-- <load module="mod_woomera"/> --> + <!-- <load module="mod_freetdm"/> --> <!-- <load module="mod_openzap"/> --> <!-- <load module="mod_unicall"/> --> <!-- <load module="mod_skinny"/> --> commit 9241a35e61163f6d07cffb03bcd452fa0e773f36 Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Fri Oct 22 22:16:12 2010 -0400 switch_rtp: Show the UUID of the session in the log when sending RFC2833 DTMF packet and when receiving a RTP DTMF diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 66fc4cc..6a2fa51 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -1881,7 +1881,7 @@ SWITCH_DECLARE(void) switch_rtp_clear_flag(switch_rtp_t *rtp_session, switch_rtp switch_clear_flag_locked(rtp_session, flags); } -static void do_2833(switch_rtp_t *rtp_session) +static void do_2833(switch_rtp_t *rtp_session, switch_core_session_t *session) { switch_frame_flag_t flags = 0; uint32_t samples = rtp_session->samples_per_interval; @@ -1913,7 +1913,7 @@ static void do_2833(switch_rtp_t *rtp_session) rtp_session->stats.outbound.dtmf_packet_count++; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send %s packet for [%c] ts=%u dur=%d/%d/%d seq=%d\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Send %s packet for [%c] ts=%u dur=%d/%d/%d seq=%d\n", loops == 1 ? "middle" : "end", rtp_session->dtmf_data.out_digit, rtp_session->dtmf_data.timestamp_dtmf, rtp_session->dtmf_data.out_digit_sofar, @@ -1977,7 +1977,7 @@ static void do_2833(switch_rtp_t *rtp_session) rtp_session->stats.outbound.raw_bytes += wrote; rtp_session->stats.outbound.dtmf_packet_count++; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send start packet for [%c] ts=%u dur=%d/%d/%d seq=%d\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Send start packet for [%c] ts=%u dur=%d/%d/%d seq=%d\n", rtp_session->dtmf_data.out_digit, rtp_session->dtmf_data.timestamp_dtmf, rtp_session->dtmf_data.out_digit_sofar, @@ -2319,7 +2319,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ poll_status = switch_poll(rtp_session->read_pollfd, 1, &fdr, pt); if (rtp_session->dtmf_data.out_digit_dur > 0) { - do_2833(rtp_session); + do_2833(rtp_session, session); } } @@ -2443,7 +2443,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_BREAK) || (bytes && bytes == 4 && *((int *) &rtp_session->recv_msg) == UINT_MAX)) { switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_BREAK); - do_2833(rtp_session); + do_2833(rtp_session, session); bytes = 0; return_cng_frame(); } @@ -2590,7 +2590,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ } if (check || bytes) { - do_2833(rtp_session); + do_2833(rtp_session, session); } #ifdef ENABLE_ZRTP /* ZRTP Recv */ @@ -2914,9 +2914,10 @@ SWITCH_DECLARE(switch_size_t) switch_rtp_dequeue_dtmf(switch_rtp_t *rtp_session, switch_mutex_lock(rtp_session->dtmf_data.dtmf_mutex); if (switch_queue_trypop(rtp_session->dtmf_data.dtmf_inqueue, &pop) == SWITCH_STATUS_SUCCESS) { + switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session"); _dtmf = (switch_dtmf_t *) pop; *dtmf = *_dtmf; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "RTP RECV DTMF %c:%d\n", dtmf->digit, dtmf->duration); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "RTP RECV DTMF %c:%d\n", dtmf->digit, dtmf->duration); bytes++; free(pop); } commit 3a4759869520615c3517b1afcd0c156545687a1c Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Fri Oct 22 18:34:45 2010 -0400 mod_callcenter: Fix bad return type so it compile on archlinux, thx bougyman diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 56c817a..5abc567 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -850,7 +850,7 @@ cc_status_t cc_agent_del(const char *agent) return result; } -cc_agent_status_t cc_agent_get(const char *key, const char *agent, char *ret_result, size_t ret_result_size) +cc_status_t cc_agent_get(const char *key, const char *agent, char *ret_result, size_t ret_result_size) { cc_status_t result = CC_STATUS_SUCCESS; char *sql; commit 7d7d66342f86d90370519ec369b2f3e130443292 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Oct 22 15:13:44 2010 -0500 reverse perspective of dialog events on non-registered entities diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 7e3163c..c11d5d9 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -61,6 +61,7 @@ struct resub_helper { sofia_profile_t *profile; switch_event_t *event; int rowcount; + int noreg; }; struct presence_helper { @@ -615,6 +616,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) if (!h.rowcount) { + h.noreg++; switch_safe_free(sql); /* find ones with presence_id defined that are not registred */ sql = switch_mprintf("select sip_from_user, sip_from_host, 'Registered', '', '', " @@ -1036,7 +1038,6 @@ static int sofia_presence_resub_callback(void *pArg, int argc, char **argv, char if ((p = strchr(free_me, '@'))) *p = '\0'; user = free_me; } - } if (zstr(proto)) { @@ -1053,6 +1054,9 @@ static int sofia_presence_resub_callback(void *pArg, int argc, char **argv, char switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", user, host); + if (h->noreg) { + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Force-Direction", "inbound"); + } switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", status); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", rpid); @@ -1373,6 +1377,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * if (helper->event) { switch_stream_handle_t stream = { 0 }; const char *direction = switch_str_nil(switch_event_get_header(helper->event, "presence-call-direction")); + const char *force_direction = switch_str_nil(switch_event_get_header(helper->event, "force-direction")); const char *uuid = switch_str_nil(switch_event_get_header(helper->event, "unique-id")); const char *event_status = switch_str_nil(switch_event_get_header(helper->event, "status")); const char *astate = switch_str_nil(switch_event_get_header(helper->event, "astate")); @@ -1395,6 +1400,10 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * if (is_dialog) { SWITCH_STANDARD_STREAM(stream); } + + if (!zstr(force_direction)) { + direction = force_direction; + } if (!strcasecmp(direction, "outbound")) { direction = "recipient"; commit 918705530182133db11d9d0eb589eab970a6d213 Author: Jeff Lenk <jeff@jefflenk.com> Date: Fri Oct 22 14:10:14 2010 -0500 add windows installer start menu item diff --git a/w32/Setup/Product.wxs b/w32/Setup/Product.wxs index bbdac48..f1fea35 100644 --- a/w32/Setup/Product.wxs +++ b/w32/Setup/Product.wxs @@ -43,8 +43,23 @@ <?endif ?> </Directory> </Directory> + <Directory Id="ProgramMenuFolder"> + <Directory Id="ApplicationProgramsFolder" Name="FreeSWITCH"/> + </Directory> </Directory> + <DirectoryRef Id="ApplicationProgramsFolder"> + <Component Id="ApplicationShortcut" Guid="B554D1D1-C8C6-4d46-A3E7-4BA836EF929B"> + <Shortcut Id="ApplicationStartMenuShortcut" + Name="FreeSWITCH" + Description="FreeSWITCH Telephony SoftSwitch" + Target="[INSTALLLOCATION]FreeSwitchConsole.exe" + WorkingDirectory="INSTALLLOCATION"/> + <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/> + <RegistryValue Root="HKCU" Key="Software\Microsoft\FreeSWITCH" Name="installed" Type="integer" Value="1" KeyPath="yes"/> + </Component> + </DirectoryRef> + <Feature Id="ProductFeature" Title="FreeSWITCH Core" Level="1"> <!-- TODO: Remove the comments around this ComponentRef element and the Component above in order to add resources to this installer. --> <!-- <ComponentRef Id="ProductComponent" /> --> @@ -57,7 +72,8 @@ <?if $(var.Platform) = x64 ?> <MergeRef Id="CrtFiles_x64"/> <?endif ?> - </Feature> + <ComponentRef Id="ApplicationShortcut" /> + </Feature> <Feature Id="ProductFeatureConf" Title="FreeSWITCH Configuration Sample" Level="1"> <ComponentGroupRef Id="FreeSWITCHConfFiles" /> </Feature> commit 13d8d33e3d46cc9d9c865af024136155e3990485 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Oct 22 12:33:37 2010 -0500 hack out ogg diff --git a/src/mod/formats/mod_shout/Makefile b/src/mod/formats/mod_shout/Makefile index 6a6c858..0ff6fc6 100644 --- a/src/mod/formats/mod_shout/Makefile +++ b/src/mod/formats/mod_shout/Makefile @@ -51,6 +51,7 @@ $(LAMELA): $(LAME_BUILDDIR)/Makefile $(SHOUT_DIR): $(GETLIB) $(SHOUT).tar.gz + patch -p0 -i hack_out_ogg.diff $(SHOUT_BUILDDIR)/Makefile: $(SHOUT_DIR) mkdir -p $(SHOUT_BUILDDIR) commit da9742d8fa8e71e4b8fffb2e012a0bab7884f774 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Oct 22 12:28:18 2010 -0500 hack out ogg diff --git a/src/mod/formats/mod_shout/hack_out_ogg.diff b/src/mod/formats/mod_shout/hack_out_ogg.diff new file mode 100644 index 0000000..3e9b12f --- /dev/null +++ b/src/mod/formats/mod_shout/hack_out_ogg.diff @@ -0,0 +1,247 @@ +diff -r -u ../../../../libs/libshout-2.2.2/Makefile.am ../../../../libs/libshout-2.2.2a/Makefile.am +--- ../../../../libs/libshout-2.2.2/Makefile.am 2006-01-30 19:42:43.000000000 -0600 ++++ ../../../../libs/libshout-2.2.2a/Makefile.am 2010-10-22 12:07:22.000000000 -0500 +@@ -3,16 +3,14 @@ + AUTOMAKE_OPTIONS = 1.6 foreign + ACLOCAL_AMFLAGS = -I m4 + +-SUBDIRS = include src examples debian doc win32 ++SUBDIRS = include src #examples debian doc win32 + +-EXTRA_DIST = INSTALL m4/shout.m4 m4/ac_config_libconfig_in.m4 m4/acx_pthread.m4 \ +- m4/ogg.m4 m4/vorbis.m4 m4/xiph_compiler.m4 m4/xiph_net.m4 \ +- m4/xiph_types.m4 ++EXTRA_DIST = INSTALL m4/shout.m4 m4/ac_config_libconfig_in.m4 m4/acx_pthread.m4 + + DISTCLEANFILES = shout-config.in + + docdir = $(datadir)/doc/$(PACKAGE) +-doc_DATA = COPYING NEWS README examples/example.c examples/nonblocking.c ++#doc_DATA = COPYING NEWS README examples/example.c examples/nonblocking.c + + m4datadir = $(datadir)/aclocal + m4data_DATA = m4/shout.m4 +diff -r -u ../../../../libs/libshout-2.2.2/Makefile.in ../../../../libs/libshout-2.2.2a/Makefile.in +--- ../../../../libs/libshout-2.2.2/Makefile.in 2006-06-19 15:36:36.000000000 -0500 ++++ ../../../../libs/libshout-2.2.2a/Makefile.in 2010-10-22 12:09:46.000000000 -0500 +@@ -246,14 +246,14 @@ + target_alias = @target_alias@ + AUTOMAKE_OPTIONS = 1.6 foreign + ACLOCAL_AMFLAGS = -I m4 +-SUBDIRS = include src examples debian doc win32 ++SUBDIRS = include src + EXTRA_DIST = INSTALL m4/shout.m4 m4/ac_config_libconfig_in.m4 m4/acx_pthread.m4 \ + m4/ogg.m4 m4/vorbis.m4 m4/xiph_compiler.m4 m4/xiph_net.m4 \ + m4/xiph_types.m4 + + DISTCLEANFILES = shout-config.in + docdir = $(datadir)/doc/$(PACKAGE) +-doc_DATA = COPYING NEWS README examples/example.c examples/nonblocking.c ++ + m4datadir = $(datadir)/aclocal + m4data_DATA = m4/shout.m4 + @HAVE_PKGCONFIG_TRUE@pkgconfigdir = $(libdir)/pkgconfig +diff -r -u ../../../../libs/libshout-2.2.2/configure ../../../../libs/libshout-2.2.2a/configure +--- ../../../../libs/libshout-2.2.2/configure 2006-06-19 15:36:37.000000000 -0500 ++++ ../../../../libs/libshout-2.2.2a/configure 2010-10-22 12:08:39.000000000 -0500 +@@ -22911,7 +22911,7 @@ + + fi + +-SHOUT_REQUIRES="ogg" ++#SHOUT_REQUIRES="ogg" + + + +@@ -23380,10 +23380,6 @@ + + fi + +-VORBIS_LIBS="-lvorbis" +-VORBISFILE_LIBS="-lvorbisfile" +-VORBISENC_LIBS="-lvorbisenc" +- + xt_save_LIBS="$LIBS" + xt_save_LDFLAGS="$LDFLAGS" + xt_save_CPPFLAGS="$CPPFLAGS" +@@ -23580,18 +23576,18 @@ + LIBS="$xt_save_LIBS" + LDFLAGS="$xt_save_LDFLAGS" + +-if test "x$xt_lib_vorbis" = "xok"; then +- : +-else +- VORBIS_CFLAGS="" +- VORBIS_LDFLAGS="" +- VORBIS_LIBS="" +- VORBISFILE_LIBS="" +- VORBISENC_LIBS="" +- { { echo "$as_me:$LINENO: error: requisite Ogg Vorbis library not found" >&5 +-echo "$as_me: error: requisite Ogg Vorbis library not found" >&2;} +- { (exit 1); exit 1; }; } +-fi ++# if test "x$xt_lib_vorbis" = "xok"; then ++# : ++# else ++# VORBIS_CFLAGS="" ++# VORBIS_LDFLAGS="" ++# VORBIS_LIBS="" ++# VORBISFILE_LIBS="" ++# VORBISENC_LIBS="" ++# { { echo "$as_me:$LINENO: error: requisite Ogg Vorbis library not found" >&5 ++# echo "$as_me: error: requisite Ogg Vorbis library not found" >&2;} ++# { (exit 1); exit 1; }; } ++# fi + + + +@@ -23687,10 +23683,6 @@ + + fi + +-VORBIS_LIBS="-lvorbis" +-VORBISFILE_LIBS="-lvorbisfile" +-VORBISENC_LIBS="-lvorbisenc" +- + xt_save_LIBS="$LIBS" + xt_save_LDFLAGS="$LDFLAGS" + xt_save_CPPFLAGS="$CPPFLAGS" +@@ -23887,18 +23879,18 @@ + LIBS="$xt_save_LIBS" + LDFLAGS="$xt_save_LDFLAGS" + +-if test "x$xt_lib_vorbis" = "xok"; then +- : +-else +- VORBIS_CFLAGS="" +- VORBIS_LDFLAGS="" +- VORBIS_LIBS="" +- VORBISFILE_LIBS="" +- VORBISENC_LIBS="" +- { { echo "$as_me:$LINENO: error: requisite Ogg Vorbis library not found" >&5 +-echo "$as_me: error: requisite Ogg Vorbis library not found" >&2;} +- { (exit 1); exit 1; }; } +-fi ++# if test "x$xt_lib_vorbis" = "xok"; then ++# : ++# else ++# VORBIS_CFLAGS="" ++# VORBIS_LDFLAGS="" ++# VORBIS_LIBS="" ++# VORBISFILE_LIBS="" ++# VORBISENC_LIBS="" ++# { { echo "$as_me:$LINENO: error: requisite Ogg Vorbis library not found" >&5 ++# echo "$as_me: error: requisite Ogg Vorbis library not found" >&2;} ++# { (exit 1); exit 1; }; } ++# fi + + + +@@ -25819,7 +25811,7 @@ + + + +- ac_config_files="$ac_config_files Makefile debian/Makefile include/Makefile include/shout/Makefile include/shout/shout.h src/Makefile src/net/Makefile src/timing/Makefile src/thread/Makefile src/avl/Makefile src/httpp/Makefile doc/Makefile examples/Makefile win32/Makefile shout-config shout.pc" ++ ac_config_files="$ac_config_files Makefile debian/Makefile include/Makefile include/shout/Makefile include/shout/shout.h src/Makefile src/net/Makefile src/timing/Makefile src/thread/Makefile src/avl/Makefile src/httpp/Makefile doc/Makefile win32/Makefile shout-config shout.pc" + cat >confcache <<\_ACEOF + # This file is a shell script that caches the results of configure + # tests run on this system so they can be shared between configure +@@ -26423,7 +26415,6 @@ + "src/avl/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/avl/Makefile" ;; + "src/httpp/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/httpp/Makefile" ;; + "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; +- "examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;; + "win32/Makefile" ) CONFIG_FILES="$CONFIG_FILES win32/Makefile" ;; + "shout-config" ) CONFIG_FILES="$CONFIG_FILES shout-config" ;; + "shout.pc" ) CONFIG_FILES="$CONFIG_FILES shout.pc" ;; +diff -r -u ../../../../libs/libshout-2.2.2/src/Makefile.am ../../../../libs/libshout-2.2.2a/src/Makefile.am +--- ../../../../libs/libshout-2.2.2/src/Makefile.am 2006-01-30 19:42:42.000000000 -0600 ++++ ../../../../libs/libshout-2.2.2a/src/Makefile.am 2010-10-22 11:59:57.000000000 -0500 +@@ -20,9 +20,9 @@ + lib_LTLIBRARIES = libshout.la + libshout_la_LDFLAGS = -version-info 5:0:2 + +-EXTRA_DIST = theora.c speex.c +-noinst_HEADERS = shout_ogg.h shout_private.h util.h +-libshout_la_SOURCES = shout.c util.c ogg.c vorbis.c mp3.c $(MAYBE_THEORA) $(MAYBE_SPEEX) ++EXTRA_DIST = ++noinst_HEADERS = shout_private.h util.h ++libshout_la_SOURCES = shout.c util.c mp3.c $(MAYBE_THEORA) $(MAYBE_SPEEX) + AM_CFLAGS = @XIPH_CFLAGS@ + + libshout_la_LIBADD = net/libicenet.la timing/libicetiming.la avl/libiceavl.la\ +diff -r -u ../../../../libs/libshout-2.2.2/src/Makefile.in ../../../../libs/libshout-2.2.2a/src/Makefile.in +--- ../../../../libs/libshout-2.2.2/src/Makefile.in 2006-06-19 15:36:32.000000000 -0500 ++++ ../../../../libs/libshout-2.2.2a/src/Makefile.in 2010-10-22 12:04:24.000000000 -0500 +@@ -42,10 +42,7 @@ + $(srcdir)/Makefile.in + ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 + am__aclocal_m4_deps = $(top_srcdir)/m4/ac_config_libconfig_in.m4 \ +- $(top_srcdir)/m4/acx_pthread.m4 $(top_srcdir)/m4/ogg.m4 \ +- $(top_srcdir)/m4/speex.m4 $(top_srcdir)/m4/theora.m4 \ +- $(top_srcdir)/m4/vorbis.m4 $(top_srcdir)/m4/xiph_compiler.m4 \ +- $(top_srcdir)/m4/xiph_net.m4 $(top_srcdir)/m4/xiph_types.m4 \ ++ $(top_srcdir)/m4/acx_pthread.m4 \ + $(top_srcdir)/configure.ac + am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +@@ -66,11 +63,11 @@ + libshout_la_DEPENDENCIES = net/libicenet.la timing/libicetiming.la \ + avl/libiceavl.la httpp/libicehttpp.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_2) +-am__libshout_la_SOURCES_DIST = shout.c util.c ogg.c vorbis.c mp3.c \ ++am__libshout_la_SOURCES_DIST = shout.c util.c mp3.c \ + theora.c speex.c + @HAVE_THEORA_TRUE@am__objects_1 = theora.lo + @HAVE_SPEEX_TRUE@am__objects_2 = speex.lo +-am_libshout_la_OBJECTS = shout.lo util.lo ogg.lo vorbis.lo mp3.lo \ ++am_libshout_la_OBJECTS = shout.lo util.lo mp3.lo \ + $(am__objects_1) $(am__objects_2) + libshout_la_OBJECTS = $(am_libshout_la_OBJECTS) + DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +@@ -152,10 +149,6 @@ + MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ + MAKEINFO = @MAKEINFO@ + OBJEXT = @OBJEXT@ +-OGG_CFLAGS = @OGG_CFLAGS@ +-OGG_LDFLAGS = @OGG_LDFLAGS@ +-OGG_LIBS = @OGG_LIBS@ +-OGG_PREFIX = @OGG_PREFIX@ + OPT = @OPT@ + PACKAGE = @PACKAGE@ + PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +@@ -257,8 +250,8 @@ + lib_LTLIBRARIES = libshout.la + libshout_la_LDFLAGS = -version-info 5:0:2 + EXTRA_DIST = theora.c speex.c +-noinst_HEADERS = shout_ogg.h shout_private.h util.h +-libshout_la_SOURCES = shout.c util.c ogg.c vorbis.c mp3.c $(MAYBE_THEORA) $(MAYBE_SPEEX) ++noinst_HEADERS = shout_private.h util.h ++libshout_la_SOURCES = shout.c util.c mp3.c $(MAYBE_THEORA) $(MAYBE_SPEEX) + AM_CFLAGS = @XIPH_CFLAGS@ + libshout_la_LIBADD = net/libicenet.la timing/libicetiming.la avl/libiceavl.la\ + httpp/libicehttpp.la $(MAYBE_THREAD_LIB) $(THEORA_LIBS) $(VORBIS_LIBS) +@@ -334,7 +327,7 @@ + -rm -f *.tab.c + + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mp3.Plo@am__quote@ +-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ogg.Plo@am__quote@ ++#@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ogg.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shout.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/speex.Plo@am__quote@ + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/theora.Plo@am__quote@ +diff -r -u ../../../../libs/libshout-2.2.2/src/shout.c ../../../../libs/libshout-2.2.2a/src/shout.c +--- ../../../../libs/libshout-2.2.2/src/shout.c 2008-07-28 11:33:56.000000000 -0500 ++++ ../../../../libs/libshout-2.2.2a/src/shout.c 2010-10-22 12:12:46.000000000 -0500 +@@ -994,10 +994,7 @@ + if ((rc = parse_response(self)) != SHOUTERR_SUCCESS) + goto failure; + +- if (self->format == SHOUT_FORMAT_OGG) { +- if ((rc = self->error = shout_open_ogg(self)) != SHOUTERR_SUCCESS) +- goto failure; +- } else if (self->format == SHOUT_FORMAT_MP3) { ++ if (self->format == SHOUT_FORMAT_MP3) { + if ((rc = self->error = shout_open_mp3(self)) != SHOUTERR_SUCCESS) + goto failure; + } else { commit f3aecdc9ee24b8899406b5256b5ff4d5e971a40f Author: Jeff Lenk <jeff@jefflenk.com> Date: Fri Oct 22 12:20:30 2010 -0500 fix error in mod_curl manifest diff --git a/libs/win32/json/libjson.2008.vcproj b/libs/win32/json/libjson.2008.vcproj index 91a371b..5c09e54 100644 --- a/libs/win32/json/libjson.2008.vcproj +++ b/libs/win32/json/libjson.2008.vcproj @@ -172,7 +172,7 @@ Optimization="2" EnableIntrinsicFunctions="true" AdditionalIncludeDirectories="." - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H;HAVE_STDARG_H;STDC_HEADERS" + PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H;HAVE_STDARG_H;STDC_HEADERS" RuntimeLibrary="2" EnableFunctionLevelLinking="true" UsePrecompiledHeader="0" @@ -236,7 +236,7 @@ Optimization="2" EnableIntrinsicFunctions="true" AdditionalIncludeDirectories="." - PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H;HAVE_STDARG_H;STDC_HEADERS" + PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H;HAVE_STDARG_H;STDC_HEADERS" RuntimeLibrary="2" EnableFunctionLevelLinking="true" UsePrecompiledHeader="0" diff --git a/libs/win32/json/libjson.2010.vcxproj b/libs/win32/json/libjson.2010.vcxproj index 5846ff3..a371ac2 100644 --- a/libs/win32/json/libjson.2010.vcxproj +++ b/libs/win32/json/libjson.2010.vcxproj @@ -96,7 +96,7 @@ <Optimization>MaxSpeed</Optimization> <IntrinsicFunctions>true</IntrinsicFunctions> <AdditionalIncludeDirectories>.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;HAVE_CONFIG_H;HAVE_STDARG_H;STDC_HEADERS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;HAVE_CONFIG_H;HAVE_STDARG_H;STDC_HEADERS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <FunctionLevelLinking>true</FunctionLevelLinking> <WarningLevel>Level3</WarningLevel> @@ -110,7 +110,7 @@ <Optimization>MaxSpeed</Optimization> <IntrinsicFunctions>true</IntrinsicFunctions> <AdditionalIncludeDirectories>.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;HAVE_CONFIG_H;HAVE_STDARG_H;STDC_HEADERS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;HAVE_CONFIG_H;HAVE_STDARG_H;STDC_HEADERS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> <FunctionLevelLinking>true</FunctionLevelLinking> <WarningLevel>Level3</WarningLevel> commit 83c8c1254bc651d8e7b17bc6990aed782bd99354 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Oct 22 11:22:07 2010 -0500 this should have been moved into agressive nat detection not commented diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index c2c85e8..51ce56f 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1470,16 +1470,14 @@ void sofia_reg_handle_sip_i_register(nua_t *nua, sofia_profile_t *profile, nua_h } else if (port && atoi(port) != network_port) { is_nat = "via port"; } + + if (!is_nat && sip->sip_via->v_port && + atoi(sip->sip_via->v_port) == 5060 && network_port != 5060 ) { + is_nat = "via port"; + } } } - /* FS-2773: This causes issues with Cisco phones. - * if (!is_nat && sip && sip->sip_via && sip->sip_via->v_port && - * atoi(sip->sip_via->v_port) == 5060 && network_port != 5060 ) { - * is_nat = "via port"; - * } - */ - if (!is_nat && profile->nat_acl_count) { uint32_t x = 0; int ok = 1; commit 1166f8d0ded8745800ef57115bb5896808f68a5f Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Fri Oct 22 12:21:49 2010 -0400 switch_event: Correct the set of a uniq flag for request_param and channel_data event type. diff --git a/src/include/switch_event.h b/src/include/switch_event.h index 1864e39..41bc75c 100644 --- a/src/include/switch_event.h +++ b/src/include/switch_event.h @@ -345,11 +345,15 @@ SWITCH_DECLARE(switch_status_t) switch_event_create_pres_in_detailed(_In_z_ char */ #define switch_event_create(event, id) switch_event_create_subclass(event, id, SWITCH_EVENT_SUBCLASS_ANY) - static inline switch_status_t switch_event_create_plain(switch_event_t **event, switch_event_types_t event_id) +static inline switch_status_t switch_event_create_plain(switch_event_t **event, switch_event_types_t event_id) { switch_status_t status = switch_event_create(event, SWITCH_EVENT_CLONE); if (status == SWITCH_STATUS_SUCCESS) { (*event)->event_id = event_id; + + if (event_id == SWITCH_EVENT_REQUEST_PARAMS || event_id == SWITCH_EVENT_CHANNEL_DATA) { + (*event)->flags |= EF_UNIQ_HEADERS; + } } return status; commit 564dc7e493c2ebbe86019e73cfbb0877d52197fc Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Oct 21 22:35:24 2010 -0500 return break in mod_sndfile when seek returns failure diff --git a/src/mod/formats/mod_sndfile/mod_sndfile.c b/src/mod/formats/mod_sndfile/mod_sndfile.c index a99759f..a0ddba0 100644 --- a/src/mod/formats/mod_sndfile/mod_sndfile.c +++ b/src/mod/formats/mod_sndfile/mod_sndfile.c @@ -242,16 +242,23 @@ static switch_status_t sndfile_file_close(switch_file_handle_t *handle) static switch_status_t sndfile_file_seek(switch_file_handle_t *handle, unsigned int *cur_sample, int64_t samples, int whence) { sndfile_context *context = handle->private_info; - + sf_count_t count; + switch_status_t r = SWITCH_STATUS_SUCCESS; + if (!handle->seekable) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "File is not seekable\n"); return SWITCH_STATUS_NOTIMPL; } - *cur_sample = (unsigned int) sf_seek(context->handle, samples, whence); - handle->pos = *cur_sample; - - return SWITCH_STATUS_SUCCESS; + if ((count = sf_seek(context->handle, samples, whence)) == ((sf_count_t) -1)) { + r = SWITCH_STATUS_BREAK; + count = sf_seek(context->handle, -1, SEEK_END); + } + + *cur_sample = (unsigned int) count; + handle->pos = *cur_sample; + + return r; } static switch_status_t sndfile_file_read(switch_file_handle_t *handle, void *data, size_t *len) commit 4cf58428363255d9dd05e196cf308ca5cd4e2582 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Oct 21 22:34:16 2010 -0500 fix type in dmachine parser diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 2c0e3c3..9f5b87d 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -302,7 +302,7 @@ static dm_match_t switch_ivr_dmachine_check_match(switch_ivr_dmachine_t *dmachin if (is_timeout) { if (both_bp) { - r_bp = both_bp; + r_bp = exact_bp ? exact_bp : both_bp; } else if (partial_bp) { r_bp = partial_bp; } commit 180c179c7fc474b5310683106ec933ac9774c789 Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Oct 21 17:11:57 2010 -0500 add missing file windows setup diff --git a/w32/Setup/Setup.wixproj b/w32/Setup/Setup.wixproj index 6e59ed6..56d4c99 100644 --- a/w32/Setup/Setup.wixproj +++ b/w32/Setup/Setup.wixproj @@ -129,6 +129,14 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>INSTALLLOCATION</RefTargetDir> </ProjectReference> + <ProjectReference Include="..\..\libs\win32\pthread\pthread.2010.vcxproj"> + <Name>pthread</Name> + <Project>{df018947-0fff-4eb3-bdee-441dc81da7a4}</Project> + <Private>True</Private> + <DoNotHarvest>True</DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>INSTALLLOCATION</RefTargetDir> + </ProjectReference> <ProjectReference Include="..\..\libs\win32\sphinxbase\sphinxbase.2010.vcxproj"> <Name>sphinxbase</Name> <Project>{2f025ead-99bd-40f5-b2cc-f0a28cad7f2d}</Project> commit d2ca8d40466d244011a60c2198fb645ceb1fa983 Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Oct 21 16:18:54 2010 -0500 FS-2050 Core ODBC support for transactions with MSSQL diff --git a/conf/autoload_configs/switch.conf.xml b/conf/autoload_configs/switch.conf.xml index e861b1b..896dd0e 100644 --- a/conf/autoload_configs/switch.conf.xml +++ b/conf/autoload_configs/switch.conf.xml @@ -86,6 +86,7 @@ <!-- <param name="core-db-dsn" value="dsn:username:password" /> --> <!-- The system will create all the db schemas automatically, set this to false to avoid this behaviour--> <!--<param name="auto-create-schemas" value="true"/>--> + <!-- <param name="core-dbtype" value="MSSQL"/> --> </settings> </configuration> diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index ea02f22..3df9001 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -193,6 +193,11 @@ struct switch_media_bug { struct switch_media_bug *next; }; +typedef enum { + DBTYPE_DEFAULT = 0, + DBTYPE_MSSQL = 1, +} switch_dbtype_t; + struct switch_runtime { switch_time_t initiated; switch_time_t reference; @@ -237,6 +242,7 @@ struct switch_runtime { double min_idle_time; int sql_buffer_len; int max_sql_buffer_len; + switch_dbtype_t odbc_dbtype; }; extern struct switch_runtime runtime; diff --git a/src/include/switch_odbc.h b/src/include/switch_odbc.h index 81039f1..b8d4bc2 100644 --- a/src/include/switch_odbc.h +++ b/src/include/switch_odbc.h @@ -58,6 +58,8 @@ SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec(switch_odbc_handle_ char **err); SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec_string(switch_odbc_handle_t *handle, const char *sql, char *resbuf, size_t len, char **err); SWITCH_DECLARE(switch_bool_t) switch_odbc_available(void); +SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_SQLSetAutoCommitAttr(switch_odbc_handle_t *handle, switch_bool_t on); +SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_SQLEndTran(switch_odbc_handle_t *handle, switch_bool_t commit); SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_statement_handle_free(switch_odbc_statement_handle_t *stmt); /*! diff --git a/src/switch_core.c b/src/switch_core.c index 2f89c7b..bd4b00d 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1237,6 +1237,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc runtime.max_dtmf_duration = SWITCH_MAX_DTMF_DURATION; runtime.default_dtmf_duration = SWITCH_DEFAULT_DTMF_DURATION; runtime.min_dtmf_duration = SWITCH_MIN_DTMF_DURATION; + runtime.odbc_dbtype = DBTYPE_DEFAULT; /* INIT APR and Create the pool context */ if (apr_initialize() != SWITCH_STATUS_SUCCESS) { @@ -1590,6 +1591,12 @@ static void switch_load_core_config(const char *file) } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n"); } + } else if (!strcasecmp(var, "core-dbtype") && !zstr(val)) { + if (!strcasecmp(val, "MSSQL")) { + runtime.odbc_dbtype = DBTYPE_MSSQL; + } else { + runtime.odbc_dbtype = DBTYPE_DEFAULT; + } #ifdef ENABLE_ZRTP } else if (!strcasecmp(var, "rtp-enable-zrtp")) { switch_core_set_variable("zrtp_enabled", val); diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 7f99504..a85766c 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -699,7 +699,13 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans(switch_ while (begin_retries > 0) { again = 0; - switch_cache_db_execute_sql_real(dbh, "BEGIN", &errmsg); + if (runtime.odbc_dbtype == DBTYPE_DEFAULT) { + switch_cache_db_execute_sql_real(dbh, "BEGIN", &errmsg); + } else { + if (switch_odbc_SQLSetAutoCommitAttr(dbh->native_handle.odbc_dbh, 0) != SWITCH_ODBC_SUCCESS) { + errmsg = strdup("Unable to Set AutoCommit Off.");; + } + } if (errmsg) { begin_retries--; @@ -712,7 +718,13 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans(switch_ errmsg = NULL; if (again) { - switch_cache_db_execute_sql_real(dbh, "COMMIT", NULL); + if (runtime.odbc_dbtype == DBTYPE_DEFAULT) { + switch_cache_db_execute_sql_real(dbh, "COMMIT", NULL); + } else { + switch_odbc_SQLEndTran(dbh->native_handle.odbc_dbh, 1); + switch_odbc_SQLSetAutoCommitAttr(dbh->native_handle.odbc_dbh, 1); + } + goto again; } @@ -750,7 +762,12 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans(switch_ done: - switch_cache_db_execute_sql_real(dbh, "COMMIT", NULL); + if (runtime.odbc_dbtype == DBTYPE_DEFAULT) { + switch_cache_db_execute_sql_real(dbh, "COMMIT", NULL); + } else { + switch_odbc_SQLEndTran(dbh->native_handle.odbc_dbh, 1); + switch_odbc_SQLSetAutoCommitAttr(dbh->native_handle.odbc_dbh, 1); + } if (dbh->io_mutex) { switch_mutex_unlock(dbh->io_mutex); @@ -1304,6 +1321,7 @@ static void core_event_handler(switch_event_t *event) case SWITCH_EVENT_CHANNEL_BRIDGE: { const char *callee_cid_name, *callee_cid_num, *direction; + char *func_name; direction = switch_event_get_header(event, "other-leg-direction"); @@ -1319,10 +1337,19 @@ static void core_event_handler(switch_event_t *event) new_sql() = switch_mprintf("update channels set call_uuid='%q' where uuid='%s' and hostname='%q'", switch_event_get_header_nil(event, "channel-call-uuid"), switch_event_get_header_nil(event, "unique-id"), switch_core_get_variable("hostname")); - new_sql() = switch_mprintf("insert into calls (call_uuid,call_created,call_created_epoch,function,caller_cid_name," + + if (runtime.odbc_dbtype == DBTYPE_DEFAULT) { + func_name = "function"; + } + else { + func_name = "call_function"; + } + + new_sql() = switch_mprintf("insert into calls (call_uuid,call_created,call_created_epoch,%s,caller_cid_name," "caller_cid_num,caller_dest_num,caller_chan_name,caller_uuid,callee_cid_name," "callee_cid_num,callee_dest_num,callee_chan_name,callee_uuid,hostname) " "values ('%s', '%s', '%ld', '%s','%q','%q','%q','%q','%s','%q','%q','%q','%q','%s','%q')", + func_name, switch_event_get_header_nil(event, "channel-call-uuid"), switch_event_get_header_nil(event, "event-date-local"), (long) switch_epoch_time_now(NULL), @@ -1622,11 +1649,21 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_ { char *err; switch_cache_db_test_reactive(dbh, "select call_uuid, read_bit_rate from channels", "DROP TABLE channels", create_channels_sql); - switch_cache_db_test_reactive(dbh, "select call_uuid from calls", "DROP TABLE calls", create_calls_sql); + if (runtime.odbc_dbtype == DBTYPE_DEFAULT) { + switch_cache_db_test_reactive(dbh, "select call_uuid from calls", "DROP TABLE calls", create_calls_sql); + } else { + char *tmp = switch_string_replace(create_calls_sql, "function", "call_function"); + switch_cache_db_test_reactive(dbh, "select call_uuid from calls", "DROP TABLE calls", tmp); + free(tmp); + } switch_cache_db_test_reactive(dbh, "select ikey from interfaces", "DROP TABLE interfaces", create_interfaces_sql); switch_cache_db_test_reactive(dbh, "select hostname from tasks", "DROP TABLE tasks", create_tasks_sql); - switch_cache_db_execute_sql(dbh, "begin;delete from channels where hostname='';delete from channels where hostname='';commit;", &err); + if (runtime.odbc_dbtype == DBTYPE_DEFAULT) { + switch_cache_db_execute_sql(dbh, "begin;delete from channels where hostname='';delete from channels where hostname='';commit;", &err); + } else { + switch_cache_db_execute_sql(dbh, "delete from channels where hostname='';delete from channels where hostname='';", &err); + } if (err) { runtime.odbc_dsn = NULL; diff --git a/src/switch_odbc.c b/src/switch_odbc.c index c853e14..36c3c99 100644 --- a/src/switch_odbc.c +++ b/src/switch_odbc.c @@ -629,6 +629,32 @@ SWITCH_DECLARE(switch_bool_t) switch_odbc_available(void) #endif } +SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_SQLSetAutoCommitAttr(switch_odbc_handle_t *handle, switch_bool_t on) +{ +#ifdef SWITCH_HAVE_ODBC + if (on) { + return SQLSetConnectAttr(handle->con, SQL_ATTR_AUTOCOMMIT, (SQLPOINTER *) SQL_AUTOCOMMIT_ON, 0 ); + } else { + return SQLSetConnectAttr(handle->con, SQL_ATTR_AUTOCOMMIT, (SQLPOINTER *) SQL_AUTOCOMMIT_OFF, 0 ); + } +#else + return SWITCH_FALSE; +#endif +} + +SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_SQLEndTran(switch_odbc_handle_t *handle, switch_bool_t commit) +{ +#ifdef SWITCH_HAVE_ODBC + if (commit) { + return SQLEndTran(SQL_HANDLE_DBC, handle->con, SQL_COMMIT); + } else { + return SQLEndTran(SQL_HANDLE_DBC, handle->con, SQL_ROLLBACK); + } +#else + return SWITCH_FALSE; +#endif +} + /* For Emacs: * Local Variables: commit fd1736b38fe16131a5496ff7a6866e084d354c32 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Oct 21 12:50:19 2010 -0500 1) Add force-publish-expires to set custom presence update expires delta (-1 means endless) 2) Check how many users are registered when receiving a PUBLISH AND Multiple Registrations is enabled: if there is more than just 1 AND you are sending a offline message: skip publishing it to everyone to prevent clients from thinking themselves has gone offline. diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 87e0a5b..90f5d3a 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -548,6 +548,7 @@ struct sofia_profile { sofia_presence_type_t pres_type; sofia_media_options_t media_options; uint32_t force_subscription_expires; + uint32_t force_publish_expires; char *user_agent_filter; uint32_t max_registrations_perext; switch_rtp_bug_flag_t auto_rtp_bugs; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 2f5cbbd..5a14c2c 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2428,6 +2428,11 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) if (tmp > 0) { profile->force_subscription_expires = tmp; } + } else if (!strcasecmp(var, "force-publish-expires")) { + int tmp = atoi(val); + if (tmp > 0) { + profile->force_publish_expires = tmp; + } } else if (!strcasecmp(var, "inbound-late-negotiation")) { if (switch_true(val)) { sofia_set_flag(profile, TFLAG_LATE_NEGOTIATION); @@ -3104,6 +3109,11 @@ switch_status_t config_sofia(int reload, char *profile_name) if (tmp > 0) { profile->force_subscription_expires = tmp; } + } else if (!strcasecmp(var, "force-publish-expires")) { + int tmp = atoi(val); + if (tmp > 0) { + profile->force_publish_expires = tmp; + } } else if (!strcasecmp(var, "send-message-query-on-register")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_MESSAGE_QUERY_ON_REGISTER); diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index ceb540d..7e3163c 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -2543,7 +2543,7 @@ void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, n char *from_host = NULL; char *rpid = ""; sip_payload_t *payload = sip->sip_payload; - char *event_type; + char *event_type = NULL; char etag[9] = ""; char expstr[30] = ""; long exp = 0, exp_delta = 3600; @@ -2565,13 +2565,22 @@ void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, n exp_delta = (sip->sip_expires ? sip->sip_expires->ex_delta : 3600); - exp = (long) switch_epoch_time_now(NULL) + exp_delta; + if (profile->force_publish_expires) { + exp_delta = profile->force_publish_expires; + } + + if (exp_delta < 0) { + exp = exp_delta; + } else { + exp = (long) switch_epoch_time_now(NULL) + exp_delta; + } if (payload) { switch_xml_t xml, note, person, tuple, status, basic, act; switch_event_t *event; char *sql; char *full_agent = NULL; + int count = 1; pd_dup = strdup(payload->pl_data); @@ -2599,34 +2608,47 @@ void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, n } } - - if ((sql = - switch_mprintf("delete from sip_presence where sip_user='%q' and sip_host='%q' " - " and profile_name='%q' and hostname='%q'", from_user, from_host, profile->name, mod_sofia_globals.hostname))) { - sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); + if (sofia_test_pflag(profile, PFLAG_MULTIREG) && !strcasecmp(open_closed, "closed")) { + char buf[32] = ""; + + sql = switch_mprintf("select count(*) from sip_registrations where sip_user='%q' and orig_server_host='%q'", from_user, from_host); + sofia_glue_execute_sql2str(profile, profile->ireg_mutex, sql, buf, sizeof(buf)); + switch_safe_free(sql); + count = atoi(buf); } + + + /* if (count > 1) let's not and say we did or all the clients who subscribe to their own presence will think they selves is offline */ + + if (count < 2) { + if ((sql = + switch_mprintf("delete from sip_presence where sip_user='%q' and sip_host='%q' " + " and profile_name='%q' and hostname='%q'", from_user, from_host, profile->name, mod_sofia_globals.hostname))) { + sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); + } - if ((sql = - switch_mprintf("insert into sip_presence (sip_user, sip_host, status, rpid, expires, user_agent," - " profile_name, hostname, open_closed) " - "values ('%q','%q','%q','%q',%ld,'%q','%q','%q','%q')", - from_user, from_host, note_txt, rpid, exp, full_agent, profile->name, mod_sofia_globals.hostname, open_closed))) { + if ((sql = + switch_mprintf("insert into sip_presence (sip_user, sip_host, status, rpid, expires, user_agent," + " profile_name, hostname, open_closed) " + "values ('%q','%q','%q','%q',%ld,'%q','%q','%q','%q')", + from_user, from_host, note_txt, rpid, exp, full_agent, profile->name, mod_sofia_globals.hostname, open_closed))) { - sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); - } + sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); + } - event_type = sip_header_as_string(profile->home, (void *) sip->sip_event); + event_type = sip_header_as_string(profile->home, (void *) sip->sip_event); - if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", rpid); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->url); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "user-agent", full_agent); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", from_user, from_host); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", note_txt); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", event_type); - switch_event_fire(&event); + if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", rpid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->url); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "user-agent", full_agent); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", from_user, from_host); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", note_txt); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", event_type); + switch_event_fire(&event); + } } if (event_type) { commit b430da35849396ad777f6459dfb1d3bc02c771f8 Merge: c423e20 df00595 Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Oct 21 13:47:49 2010 -0400 Merge branch 'master' of 192.168.1.169:smg_freeswitch commit df005951ebbbd0e25551158bfcb0f87ee27dfc6f Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Oct 21 10:45:03 2010 -0700 freetdm: Added Print for Called Number, Calling Name on incoming/outgoing calls diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 827647f..41833c5 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -79,6 +79,7 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) sngisdn_info->suInstId = get_unique_suInstId(suId); sngisdn_info->spInstId = spInstId; + if (conEvnt->cdPtyNmb.eh.pres && signal_data->num_local_numbers) { uint8_t local_number_matched = 0; @@ -128,14 +129,12 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) #if 0 /* Export ftdmchan variables here if we need to */ ftdm_channel_add_var(ftdmchan, "isdn_specific_var", "1"); - ftdm_channel_add_var(ftdmchan, "isdn_crap", "morecrap"); - ftdm_channel_add_var(ftdmchan, "isdn_stuff", "s"); - ftdm_channel_add_var(ftdmchan, "isdn_d", "asdsadasdasdsad"); #endif /* Fill in call information */ cpy_calling_num_from_stack(&ftdmchan->caller_data, &conEvnt->cgPtyNmb); cpy_called_num_from_stack(&ftdmchan->caller_data, &conEvnt->cdPtyNmb); cpy_calling_name_from_stack(&ftdmchan->caller_data, &conEvnt->display); + ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Incoming call: Called No:[%s] Calling No:[%s]\n", ftdmchan->caller_data.dnis.digits, ftdmchan->caller_data.cid_num.digits); if (conEvnt->bearCap[0].eh.pres) { ftdmchan->caller_data.bearer_layer1 = sngisdn_get_infoTranCap_from_stack(conEvnt->bearCap[0].usrInfoLyr1Prot.val); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 80a85ce..3284d54 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -143,6 +143,7 @@ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) signal_data->signalling == SNGISDN_SIGNALING_NET) { sngisdn_info->ces = CES_MNGMNT; } + ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Outgoing call: Called No:[%s] Calling No:[%s]\n", ftdmchan->caller_data.dnis.digits, ftdmchan->caller_data.cid_num.digits); cpy_called_num_from_user(&conEvnt.cdPtyNmb, &ftdmchan->caller_data); cpy_calling_num_from_user(&conEvnt.cgPtyNmb, &ftdmchan->caller_data); commit c423e2096c4b71a51abd74ceec0d66f07061ccb1 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Oct 21 12:09:52 2010 -0500 pass indication when in app mode on mod_loopback diff --git a/src/mod/endpoints/mod_loopback/mod_loopback.c b/src/mod/endpoints/mod_loopback/mod_loopback.c index ab4db6a..d3e3f5c 100644 --- a/src/mod/endpoints/mod_loopback/mod_loopback.c +++ b/src/mod/endpoints/mod_loopback/mod_loopback.c @@ -53,7 +53,8 @@ typedef enum { TFLAG_BOWOUT = (1 << 5), TFLAG_BLEG = (1 << 6), TFLAG_APP = (1 << 7), - TFLAG_BOWOUT_USED = (1 << 8) + TFLAG_RUNNING_APP = (1 << 8), + TFLAG_BOWOUT_USED = (1 << 9) } TFLAGS; struct private_object { @@ -321,11 +322,16 @@ static switch_status_t channel_on_routing(switch_core_session_t *session) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL ROUTING\n", switch_channel_get_name(channel)); + if (switch_test_flag(tech_pvt, TFLAG_RUNNING_APP)) { + switch_clear_flag(tech_pvt, TFLAG_RUNNING_APP); + } + if (switch_test_flag(tech_pvt, TFLAG_APP) && !switch_test_flag(tech_pvt, TFLAG_OUTBOUND) && (app = switch_channel_get_variable(channel, "loopback_app"))) { switch_caller_extension_t *extension = NULL; switch_clear_flag(tech_pvt, TFLAG_APP); + switch_set_flag(tech_pvt, TFLAG_RUNNING_APP); arg = switch_channel_get_variable(channel, "loopback_app_arg"); extension = switch_caller_extension_new(session, app, app); @@ -718,6 +724,18 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s tech_pvt = switch_core_session_get_private(session); switch_assert(tech_pvt != NULL); + if (switch_test_flag(tech_pvt, TFLAG_RUNNING_APP)) { + switch_status_t r = SWITCH_STATUS_FALSE; + switch_core_session_t *other_session; + + if (switch_core_session_get_partner(session, &other_session)) { + r = switch_core_session_receive_message(other_session, msg); + switch_core_session_rwunlock(other_session); + } + + return r; + } + switch (msg->message_id) { case SWITCH_MESSAGE_INDICATE_ANSWER: if (tech_pvt->other_channel && !switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { commit cf5c1d216af6dcd4382ffc906511c725c613a4c9 Author: Michael Jerris <mike@jerris.com> Date: Wed Oct 20 16:40:10 2010 -0400 try to pass the 'f' up from wanpipe and do something sane with it diff --git a/libs/openzap/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c b/libs/openzap/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c index 4d16eda..8423aac 100644 --- a/libs/openzap/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c +++ b/libs/openzap/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c @@ -1119,11 +1119,14 @@ ZIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_next_event) event_id = ZAP_OOB_NOOP; //zap_log(ZAP_LOG_WARNING, "%d:%d queue hardware dtmf %s %s\n", zchan->span_id, zchan->chan_id, tmp_dtmf, - //tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_dtmf_type == WAN_EC_TONE_PRESENT ? "on" : "off"); - if (tmp_dtmf[0] == 'f') { - zap_log(ZAP_LOG_DEBUG, "Ignoring fax DTMF event\n"); - break; - } + //tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_dtmf_type == WAN_EC_TONE_PRESENT ? "on" : "off"); + if (tmp_dtmf[0] == 'f') { + if (zap_test_flag(zchan, ZAP_CHANNEL_INUSE)) { + zap_channel_queue_dtmf(zchan, tmp_dtmf); + } + break; + } + if (tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_dtmf_type == WAN_EC_TONE_PRESENT) { zap_set_flag_locked(zchan, ZAP_CHANNEL_MUTE); } diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 945583e..924dcd2 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -322,7 +322,7 @@ SWITCH_DECLARE(unsigned char) switch_char_to_rfc2833(char key); \param key the key to test \return TRUE or FALSE */ -#define is_dtmf(key) ((key > 47 && key < 58) || (key > 64 && key < 69) || (key > 96 && key < 101) || key == 35 || key == 42 || key == 87 || key == 119 || key == 70) +#define is_dtmf(key) ((key > 47 && key < 58) || (key > 64 && key < 69) || (key > 96 && key < 101) || key == 35 || key == 42 || key == 87 || key == 119 || key == 70 || key == 102) #define end_of(_s) *(*_s == '\0' ? _s : _s + strlen(_s) - 1) #define end_of_p(_s) (*_s == '\0' ? _s : _s + strlen(_s) - 1) diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 40214c4..2c0e3c3 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -2334,8 +2334,39 @@ typedef struct { switch_media_bug_t *bug; switch_core_session_t *session; int bug_running; + int detect_fax; } switch_tone_container_t; +static switch_status_t tone_on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf, switch_dtmf_direction_t direction) +{ + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_tone_container_t *cont = switch_channel_get_private(channel, "_tone_detect_"); + switch_event_t *event; + int i; + + if (!cont || !cont->detect_fax || dtmf->digit != 'f') { + return SWITCH_STATUS_SUCCESS; + } + + i = cont->detect_fax; + + if (cont->list[i].callback) { + cont->list[i].callback(cont->session, cont->list[i].app, cont->list[i].data); + } else if (cont->list[i].app) { + if (switch_event_create(&event, SWITCH_EVENT_COMMAND) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-command", "execute"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-name", cont->list[i].app); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-arg", cont->list[i].data); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "lead-frames", "%d", 5); + switch_core_session_queue_private_event(cont->session, &event, SWITCH_FALSE); + } + } + + return SWITCH_STATUS_SUCCESS; + +} + + static switch_bool_t tone_detect_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type) { switch_tone_container_t *cont = (switch_tone_container_t *) user_data; @@ -2467,6 +2498,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_stop_tone_detect_session(switch_core_ cont->list[i].up = 0; } switch_core_media_bug_remove(session, &cont->bug); + if (cont->detect_fax) { + cont->detect_fax = 0; + } return SWITCH_STATUS_SUCCESS; } return SWITCH_STATUS_FALSE; @@ -2481,7 +2515,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_sessi switch_status_t status; switch_tone_container_t *cont = switch_channel_get_private(channel, "_tone_detect_"); char *p, *next; - int i = 0, ok = 0; + int i = 0, ok = 0, detect_fax = 0; switch_media_bug_flag_t bflags = 0; const char *var; switch_codec_implementation_t read_impl = { 0 }; @@ -2534,6 +2568,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_sessi ok++; cont->list[cont->index].map.freqs[i++] = this; } + if (!strncasecmp(p, "1100", 4)) { + detect_fax = cont->index; + } + if (next) { p = next + 1; } @@ -2545,6 +2583,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_sessi return SWITCH_STATUS_FALSE; } + cont->detect_fax = detect_fax; + cont->list[cont->index].key = switch_core_session_strdup(session, key); if (app) { @@ -2612,6 +2652,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_sessi switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s bug already running\n", switch_channel_get_name(channel)); } else { cont->bug_running = 1; + if (cont->detect_fax) { + switch_core_event_hook_add_send_dtmf(session, tone_on_dtmf); + switch_core_event_hook_add_recv_dtmf(session, tone_on_dtmf); + } + if ((status = switch_core_media_bug_add(session, "tone_detect", key, tone_detect_callback, cont, timeout, bflags, &cont->bug)) != SWITCH_STATUS_SUCCESS) { cont->bug_running = 0; commit 51ec6b8845f3aa23ac9b05d6fdc9b14557522516 Author: Moises Silva <moy@sangoma.com> Date: Wed Oct 20 15:54:19 2010 -0400 freetdm: add FreeBSD defines to compile scheduling support in FreeBSD diff --git a/libs/freetdm/src/ftdm_sched.c b/libs/freetdm/src/ftdm_sched.c index a7736ce..00a303a 100644 --- a/libs/freetdm/src/ftdm_sched.c +++ b/libs/freetdm/src/ftdm_sched.c @@ -55,7 +55,7 @@ struct ftdm_sched { struct ftdm_timer { char name[80]; ftdm_timer_id_t id; -#ifdef __linux__ +#if defined(__linux__) || defined(__FreeBSD__) struct timeval time; #endif void *usrdata; @@ -234,7 +234,7 @@ failed: FT_DECLARE(ftdm_status_t) ftdm_sched_run(ftdm_sched_t *sched) { ftdm_status_t status = FTDM_FAIL; -#ifdef __linux__ +#if defined(__linux__) || defined(__FreeBSD__) ftdm_timer_t *runtimer; ftdm_timer_t *timer; ftdm_sched_callback_t callback; @@ -315,7 +315,7 @@ FT_DECLARE(ftdm_status_t) ftdm_sched_timer(ftdm_sched_t *sched, const char *name int ms, ftdm_sched_callback_t callback, void *data, ftdm_timer_id_t *timerid) { ftdm_status_t status = FTDM_FAIL; -#ifdef __linux__ +#if defined(__linux__) || defined(__FreeBSD__) struct timeval now; int rc = 0; ftdm_timer_t *newtimer; @@ -396,7 +396,7 @@ done: FT_DECLARE(ftdm_status_t) ftdm_sched_get_time_to_next_timer(const ftdm_sched_t *sched, int32_t *timeto) { ftdm_status_t status = FTDM_FAIL; -#ifdef __linux__ +#if defined(__linux__) || defined(__FreeBSD__) int res = -1; int ms = 0; struct timeval currtime; commit 268bbf093aa922c84093c1ee8da8264d045c6c72 Author: Moises Silva <moy@sangoma.com> Date: Wed Oct 20 15:35:29 2010 -0400 freetdm: ignore fax events for now diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index 23463e9..314a34a 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -1166,6 +1166,11 @@ FIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_next_event) char tmp_dtmf[2] = { tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_dtmf_digit, 0 }; event_id = FTDM_OOB_NOOP; + if (tmp_dtmf[0] == 'f') { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Ignoring wanpipe DTMF: %c, fax tones will be passed through!\n", tmp_dtmf[0]); + break; + } + if (tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_dtmf_type == WAN_EC_TONE_PRESENT) { ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_MUTE); } commit a4f1cbe5f4a49fbb1624506c0dd8cbe3b05f2894 Author: Moises Silva <moy@sangoma.com> Date: Wed Oct 20 15:30:30 2010 -0400 openzap: ignore fax dtmf event coming from wanpipe diff --git a/libs/openzap/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c b/libs/openzap/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c index 40cf2a5..4d16eda 100644 --- a/libs/openzap/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c +++ b/libs/openzap/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c @@ -1120,6 +1120,10 @@ ZIO_SPAN_NEXT_EVENT_FUNCTION(wanpipe_next_event) //zap_log(ZAP_LOG_WARNING, "%d:%d queue hardware dtmf %s %s\n", zchan->span_id, zchan->chan_id, tmp_dtmf, //tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_dtmf_type == WAN_EC_TONE_PRESENT ? "on" : "off"); + if (tmp_dtmf[0] == 'f') { + zap_log(ZAP_LOG_DEBUG, "Ignoring fax DTMF event\n"); + break; + } if (tdm_api.wp_tdm_cmd.event.wp_tdm_api_event_dtmf_type == WAN_EC_TONE_PRESENT) { zap_set_flag_locked(zchan, ZAP_CHANNEL_MUTE); } commit f0f2dfc5ace0ba634651cd0a6f99c65a01db8acc Author: Konrad Hammel <konrad@sangoma.com> Date: Wed Oct 20 10:14:35 2010 -0400 freetdm: ss7 - bug fix for call-resume and call-suspend handling, added isup interface option for lpa_on_cot diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index ac58abd..807b3b6 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -51,6 +51,8 @@ ftdm_status_t handle_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ ftdm_status_t handle_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt); ftdm_status_t handle_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt); ftdm_status_t handle_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit); +ftdm_status_t handle_susp_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiSuspEvnt *siSuspEvnt); +ftdm_status_t handle_resm_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiResmEvnt *siResmEvnt); ftdm_status_t handle_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); ftdm_status_t handle_reattempt(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); @@ -298,8 +300,21 @@ ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circ /* need to grab the sp instance id */ sngss7_info->spInstId = spInstId; - /* go to PROGRESS */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); + if ((siCnStEvnt->optBckCalInd.eh.pres) && + (siCnStEvnt->optBckCalInd.inbndInfoInd.pres)) { + + if (siCnStEvnt->optBckCalInd.inbndInfoInd.val) { + /* go to PROGRESS_MEDIA */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); + } else { + /* go to PROGRESS */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); + } /* if (inband) */ + } else { + /* go to PROGRESS_MEDIA */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); + } + break; /**********************************************************************/ default: /* incorrect state...reset the CIC */ @@ -734,6 +749,60 @@ ftdm_status_t handle_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t cir } /******************************************************************************/ +ftdm_status_t handle_susp_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiSuspEvnt *siSuspEvnt) +{ + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + + sngss7_chan_data_t *sngss7_info ; + ftdm_channel_t *ftdmchan; + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + /* lock the channel */ + ftdm_mutex_lock(ftdmchan->mutex); + + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Call-Suspend msg\n", sngss7_info->circuit->cic); + + /* unlock the channel */ + ftdm_mutex_unlock(ftdmchan->mutex); + + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_SUCCESS; +} + +/******************************************************************************/ +ftdm_status_t handle_resm_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiResmEvnt *siResmEvnt) +{ + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + + sngss7_chan_data_t *sngss7_info ; + ftdm_channel_t *ftdmchan; + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + /* lock the channel */ + ftdm_mutex_lock(ftdmchan->mutex); + + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Call-Resume msg\n", sngss7_info->circuit->cic); + + /* unlock the channel */ + ftdm_mutex_unlock(ftdmchan->mutex); + + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_SUCCESS; +} + +/******************************************************************************/ ftdm_status_t handle_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { sngss7_chan_data_t *sngss7_info ; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c index 34893cf..06fae0c 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c @@ -52,7 +52,9 @@ void sngss7_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiIn void sngss7_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt); void sngss7_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt); void sngss7_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit); - +void sngss7_resm_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiResmEvnt *siResmEvnt); +void sngss7_susp_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiSuspEvnt *siSuspEvnt); +void sngss7_ssp_sta_cfm(uint32_t infId); /******************************************************************************/ /* FUNCTIONS ******************************************************************/ @@ -442,7 +444,127 @@ void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint } /******************************************************************************/ +void sngss7_susp_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiSuspEvnt *siSuspEvnt) +{ + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + sngss7_event_data_t *sngss7_event = NULL; + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + + /* initalize the sngss7_event */ + sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); + if (sngss7_event == NULL) { + SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + memset(sngss7_event, 0x0, sizeof(*sngss7_event)); + + /* fill in the sngss7_event struct */ + sngss7_event->spInstId = spInstId; + sngss7_event->suInstId = suInstId; + sngss7_event->circuit = circuit; + sngss7_event->event_id = SNGSS7_SUSP_IND_EVENT; + if (siSuspEvnt != NULL) { + memcpy(&sngss7_event->event.siSuspEvnt, siSuspEvnt, sizeof(*siSuspEvnt)); + } + + /* enqueue this event */ + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); + + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + +} + +/******************************************************************************/ +void sngss7_resm_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiResmEvnt *siResmEvnt) +{ + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + sngss7_event_data_t *sngss7_event = NULL; + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + + /* initalize the sngss7_event */ + sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); + if (sngss7_event == NULL) { + SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + memset(sngss7_event, 0x0, sizeof(*sngss7_event)); + + /* fill in the sngss7_event struct */ + sngss7_event->spInstId = spInstId; + sngss7_event->suInstId = suInstId; + sngss7_event->circuit = circuit; + sngss7_event->event_id = SNGSS7_RESM_IND_EVENT; + if (siResmEvnt != NULL) { + memcpy(&sngss7_event->event.siResmEvnt, siResmEvnt, sizeof(*siResmEvnt)); + } + + /* enqueue this event */ + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); + + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + +} + +/******************************************************************************/ +void sngss7_ssp_sta_cfm(uint32_t infId) +{ + SS7_FUNC_TRACE_ENTER(__FUNCTION__); +#if 0 + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + sngss7_event_data_t *sngss7_event = NULL; + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + + /* initalize the sngss7_event */ + sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); + if (sngss7_event == NULL) { + SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + memset(sngss7_event, 0x0, sizeof(*sngss7_event)); + + /* fill in the sngss7_event struct */ + sngss7_event->spInstId = spInstId; + sngss7_event->suInstId = suInstId; + sngss7_event->circuit = circuit; + sngss7_event->event_id = SNGSS7_RESM_IND_EVENT; + if (siSuspEvnt != NULL) { + memcpy(&sngss7_event->event.siResmEvnt, siResmEvnt, sizeof(*siResmEvnt)); + } + + /* enqueue this event */ + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); +#endif + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + +} /******************************************************************************/ /* For Emacs: * Local Variables: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index 2b267e7..587242d 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -208,7 +208,7 @@ ftdm_state_map_t sangoma_ss7_state_map = { {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_CANCEL, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS, - FTDM_CHANNEL_STATE_UP, FTDM_END} + FTDM_CHANNEL_STATE_PROGRESS_MEDIA ,FTDM_CHANNEL_STATE_UP, FTDM_END} }, { ZSD_OUTBOUND, @@ -448,6 +448,17 @@ static void ftdm_sangoma_ss7_process_stack_event (sngss7_event_data_t *sngss7_ev handle_sta_ind(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, sngss7_event->globalFlg, sngss7_event->evntType, &sngss7_event->event.siStaEvnt); break; /**************************************************************************/ + case (SNGSS7_SUSP_IND_EVENT): + handle_susp_ind(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, &sngss7_event->event.siSuspEvnt); + break; + /**************************************************************************/ + case (SNGSS7_RESM_IND_EVENT): + handle_resm_ind(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, &sngss7_event->event.siResmEvnt); + break; + /**************************************************************************/ + case (SNGSS7_SSP_STA_CFM_EVENT): + break; + /**************************************************************************/ default: SS7_ERROR("Unknown Event Id!\n"); break; @@ -469,6 +480,7 @@ static void ftdm_sangoma_ss7_process_stack_event (sngss7_event_data_t *sngss7_ev void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) { sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + sng_isup_inf_t *isup_intf = NULL; int i = 0; ftdm_sigmsg_t sigev; @@ -589,17 +601,16 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) } /*check if the channel is inbound or outbound */ - if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_OUTBOUND)) { /*OUTBOUND...so we were told by the line of this so noifiy the user */ sigev.event_id = FTDM_SIGEVENT_PROGRESS; ftdm_span_send_signal (ftdmchan->span, &sigev); + /* move to progress media */ ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); } else { /* inbound call so we need to send out ACM */ - ft_to_sngss7_acm (ftdmchan); - - ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); + ft_to_sngss7_acm(ftdmchan); } break; @@ -611,6 +622,13 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) break; } + if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + /* inform the user there is media avai */ + sigev.event_id = FTDM_SIGEVENT_PROGRESS_MEDIA; + ftdm_span_send_signal (ftdmchan->span, &sigev); + } + + /* nothing to do at this time */ break; /**************************************************************************/ @@ -1155,11 +1173,15 @@ suspend_goto_restart: ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_RESTART); break; -/**************************************************************************/ + /**************************************************************************/ case FTDM_CHANNEL_STATE_IN_LOOP: /* COT test */ - /* send the lpa */ - ft_to_sngss7_lpa (ftdmchan); + isup_intf = &g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId]; + + if (sngss7_test_options(isup_intf, SNGSS7_LPA_FOR_COT)) { + /* send the lpa */ + ft_to_sngss7_lpa (ftdmchan); + } break; /**************************************************************************/ @@ -1507,9 +1529,9 @@ static FIO_SIG_LOAD_FUNCTION(ftdm_sangoma_ss7_init) sng_event.cc.sng_fac_cfm = sngss7_fac_cfm; sng_event.cc.sng_sta_ind = sngss7_sta_ind; sng_event.cc.sng_umsg_ind = sngss7_umsg_ind; - sng_event.cc.sng_susp_ind = NULL; - sng_event.cc.sng_resm_ind = NULL; - sng_event.cc.sng_ssp_sta_cfm = NULL; + sng_event.cc.sng_susp_ind = sngss7_susp_ind; + sng_event.cc.sng_resm_ind = sngss7_resm_ind; + sng_event.cc.sng_ssp_sta_cfm = sngss7_ssp_sta_cfm; sng_event.sm.sng_log = handle_sng_log; sng_event.sm.sng_mtp1_alarm = handle_sng_mtp1_alarm; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index f41664a..27833cb 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -70,7 +70,10 @@ typedef enum { SNGSS7_FAC_IND_EVENT, SNGSS7_FAC_CFM_EVENT, SNGSS7_UMSG_IND_EVENT, - SNGSS7_STA_IND_EVENT + SNGSS7_STA_IND_EVENT, + SNGSS7_SUSP_IND_EVENT, + SNGSS7_RESM_IND_EVENT, + SNGSS7_SSP_STA_CFM_EVENT } sng_event_type_t; typedef enum { @@ -86,7 +89,8 @@ typedef enum { } sng_flag_t; typedef enum { - SNGSS7_ACM_OBCI_BITA = (1 << 0) /* in-band indication */ + SNGSS7_LPA_FOR_COT = (1 << 0), /* send LPA when COT arrives */ + SNGSS7_ACM_OBCI_BITA = (1 << 10) /* in-band indication */ } sng_intf_options_t; typedef enum { @@ -397,6 +401,8 @@ typedef struct sngss7_event_data SiInfoEvnt siInfoEvnt; SiFacEvnt siFacEvnt; SiStaEvnt siStaEvnt; + SiSuspEvnt siSuspEvnt; + SiResmEvnt siResmEvnt; } event; } sngss7_event_data_t; @@ -526,6 +532,9 @@ void sngss7_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint void sngss7_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt); void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); void sngss7_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit); +void sngss7_resm_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiResmEvnt *siResmEvnt); +void sngss7_susp_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiSuspEvnt *siSuspEvnt); +void sngss7_ssp_sta_cfm(uint32_t infId); /* in ftmod_sangoma_ss7_handle.c */ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); @@ -537,6 +546,8 @@ ftdm_status_t handle_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ ftdm_status_t handle_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt); ftdm_status_t handle_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt); ftdm_status_t handle_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit); +ftdm_status_t handle_susp_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiSuspEvnt *siSuspEvnt); +ftdm_status_t handle_resm_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiResmEvnt *siResmEvnt); ftdm_status_t handle_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); ftdm_status_t handle_reattempt(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c index 5229542..0f81d61 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c @@ -1261,6 +1261,18 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface) SS7_DEBUG("\tInvalid value for \"obci_bita\" option\n"); } /**********************************************************************/ + } else if (!strcasecmp(parm->var, "lpa_on_cot")) { + /**********************************************************************/ + if (*parm->val == '1') { + sngss7_set_options(&sng_isup, SNGSS7_LPA_FOR_COT); + SS7_DEBUG("\tFound Tx LPA on COT enable option\n"); + } else if (*parm->val == '0') { + sngss7_clear_options(&sng_isup, SNGSS7_LPA_FOR_COT); + SS7_DEBUG("\tFound Tx LPA on COT disable option\n"); + } else { + SS7_DEBUG("\tInvalid value for \"lpa_on_cot\" option\n"); + } + /**********************************************************************/ } else { SS7_ERROR("\tFound an invalid parameter \"%s\"!\n", parm->val); return FTDM_FAIL; commit c64f0b80ef3e0bf632302d9694f579fd0b9b7166 Author: Moises Silva <moy@sangoma.com> Date: Wed Oct 20 12:50:42 2010 -0400 mod_sangoma_codec: more diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index e2a1193..63086d6 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -410,7 +410,7 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec switch_frame_t encoded_frame; switch_status_t sres = SWITCH_STATUS_FALSE; switch_time_t now_time = 0, difftime = 0; - switch_time_t func_start_time, func_end_time; + switch_time_t func_start_time = 0, func_end_time = 0; unsigned char ebuf_ulaw[decoded_data_len / 2]; short *dbuf_linear; int i = 0; commit 23180c18e1a95f30c6016a76ae741f8170385a7f Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Oct 20 10:17:45 2010 -0500 changes from devlist diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 07e9cac..ceb540d 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -619,15 +619,15 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) /* find ones with presence_id defined that are not registred */ sql = switch_mprintf("select sip_from_user, sip_from_host, 'Registered', '', '', " "uuid, state, direction, " - "sip_to_user, sip_to_host, '','',''," - "'%q','%q',presence_id " + "sip_to_user, sip_to_host," + "'%q','%q',presence_id, '','','' " "from sip_dialogs " "where (presence_id='%q@%q' or " - "(sip_from_user='%q' and sip_from_host='%q'))", - - dh.status, dh.rpid, probe_euser, probe_host, probe_euser, probe_host); + "(sip_from_user='%q' and (sip_from_host='%q' || sip_to_host='%q')))", + + dh.status, dh.rpid, probe_euser, probe_host, probe_euser, probe_host, probe_host); if (mod_sofia_globals.debug_presence > 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s START_PRESENCE_PROBE_SQL\n", profile->name); @@ -2332,24 +2332,9 @@ void sofia_presence_handle_sip_i_subscribe(int status, su_free(profile->home, full_call_info); } - + } else { - if (!strcasecmp(event, "dialog")) { - switch_event_t *pevent; - if (switch_event_create(&pevent, SWITCH_EVENT_PRESENCE_PROBE) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); - switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "login", profile->url); - //switch_event_add_header(pevent, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, to_host); - switch_event_add_header(pevent, SWITCH_STACK_BOTTOM, "from", "%s@%s", from_user, from_host); - switch_event_add_header(pevent, SWITCH_STACK_BOTTOM, "to", "%s@%s", to_user, to_host); - switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "event_type", "presence"); - switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog"); - switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "event_subtype", "probe"); - switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "proto-specific-event-name", event); - switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "expires", exp_delta_str); - switch_event_fire(&pevent); - } - } else if (!strcasecmp(event, "line-seize")) { + if (!strcasecmp(event, "line-seize")) { char *full_call_info = NULL; char *p; @@ -2437,6 +2422,7 @@ void sofia_presence_handle_sip_i_subscribe(int status, switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "expires", exp_delta_str); switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "event_type", "presence"); switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog"); + switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "expires", exp_delta_str); switch_event_fire(&sevent); } } commit 4f817aea4c258eb47aaf2b4c49f7dd4838349c17 Author: Moises Silva <moy@sangoma.com> Date: Wed Oct 20 10:59:54 2010 -0400 mod_sangoma_codec: more diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index 84a4cdf..e2a1193 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -408,8 +408,8 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec * whether the buffer passed in by the core (encoded_data) will be big enough */ switch_frame_t ulaw_frame; switch_frame_t encoded_frame; - switch_status_t sres; - switch_time_t now_time, difftime; + switch_status_t sres = SWITCH_STATUS_FALSE; + switch_time_t now_time = 0, difftime = 0; switch_time_t func_start_time, func_end_time; unsigned char ebuf_ulaw[decoded_data_len / 2]; short *dbuf_linear; @@ -596,7 +596,7 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses * whether the buffer passed in by the core will be enough */ switch_frame_t encoded_frame; switch_frame_t ulaw_frame; - switch_status_t sres = 0; + switch_status_t sres = SWITCH_STATUS_FALSE; switch_time_t now_time = 0, difftime = 0; switch_time_t func_start_time = 0, func_end_time = 0; short *dbuf_linear; commit 31a4a7f245c07c3db3ecc5fc8c8cf63bc4c4e911 Author: Jeff Lenk <jeff@jefflenk.com> Date: Wed Oct 20 09:54:49 2010 -0500 oops diff --git a/w32/Setup/Product.wxs b/w32/Setup/Product.wxs index 2c783a8..bbdac48 100644 --- a/w32/Setup/Product.wxs +++ b/w32/Setup/Product.wxs @@ -29,7 +29,7 @@ <!-- <Component Id="ProductComponent" Guid="6f1498a7-d029-430b-b9d9-fe12e17bdbab"> --> <!-- TODO: Insert files, registry keys, and other resources here. --> <!-- </Component> --> - <?if $(var.Platform) != x86 ?> + <?if $(var.Platform) != x64 ?> <Merge Id="CrtFiles_x86" SourceFile="$(env.CommonProgramFiles)\Merge Modules\Microsoft_VC100_CRT_x86.msm" DiskId="1" @@ -51,7 +51,7 @@ <!-- Note: The following ComponentGroupRef is required to pull in generated authoring from project references. --> <ComponentGroupRef Id="Product.Generated" /> - <?if $(var.Platform) != x86 ?> + <?if $(var.Platform) != x64 ?> <MergeRef Id="CrtFiles_x86"/> <?endif ?> <?if $(var.Platform) = x64 ?> commit 1cabe8830253de26fbed53fa3cb3b2d9bc8c4a06 Author: Jeff Lenk <jeff@jefflenk.com> Date: Wed Oct 20 09:46:27 2010 -0500 continuation of msbuild enabled automated installers for Win32/X64 diff --git a/w32/Setup/Product.wxs b/w32/Setup/Product.wxs index aa49748..2c783a8 100644 --- a/w32/Setup/Product.wxs +++ b/w32/Setup/Product.wxs @@ -12,23 +12,35 @@ <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Product Id="b004a325-1272-47e5-a415-a74e9fc99865" Name="$(var.ProductName)" Language="1033" Version="1.0.0.0" Manufacturer="FreeSWITCH" UpgradeCode="3af7020b-1348-45e8-a0cf-80909d4eb421"> - <Package InstallerVersion="200" Compressed="yes" /> + <Package InstallerVersion="300" Compressed="yes" /> <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" /> <Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="$(var.PlatformProgramFilesFolder)"> <Directory Id="INSTALLLOCATION" Name="FreeSWITCH"> - <Directory Id="MODLOCATION" Name="mod"> - </Directory> - <Directory Id="CONFLOCATION" Name="conf"> - </Directory> - <Directory Id="SOUNDLOCATION" Name="sounds"> - </Directory> + <Directory Id="MODLOCATION" Name="mod"> + </Directory> + <Directory Id="CONFLOCATION" Name="conf"> + </Directory> + <Directory Id="SOUNDLOCATION" Name="sounds"> + </Directory> <!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. --> <!-- <Component Id="ProductComponent" Guid="6f1498a7-d029-430b-b9d9-fe12e17bdbab"> --> <!-- TODO: Insert files, registry keys, and other resources here. --> <!-- </Component> --> + <?if $(var.Platform) != x86 ?> + <Merge Id="CrtFiles_x86" + SourceFile="$(env.CommonProgramFiles)\Merge Modules\Microsoft_VC100_CRT_x86.msm" + DiskId="1" + Language="1033"/> + <?endif ?> + <?if $(var.Platform) = x64 ?> + <Merge Id="CrtFiles_x64" + SourceFile="$(env.CommonProgramFiles)\Merge Modules\Microsoft_VC100_CRT_x64.msm" + DiskId="1" + Language="1033"/> + <?endif ?> </Directory> </Directory> </Directory> @@ -39,7 +51,13 @@ <!-- Note: The following ComponentGroupRef is required to pull in generated authoring from project references. --> <ComponentGroupRef Id="Product.Generated" /> - </Feature> + <?if $(var.Platform) != x86 ?> + <MergeRef Id="CrtFiles_x86"/> + <?endif ?> + <?if $(var.Platform) = x64 ?> + <MergeRef Id="CrtFiles_x64"/> + <?endif ?> + </Feature> <Feature Id="ProductFeatureConf" Title="FreeSWITCH Configuration Sample" Level="1"> <ComponentGroupRef Id="FreeSWITCHConfFiles" /> </Feature> commit 3baa433e0ba3227e06cd0dd00532d7acd5c6c437 Author: Moises Silva <moy@sangoma.com> Date: Wed Oct 20 10:31:18 2010 -0400 mod_sangoma_codec: fix compilation warning/error diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index 4b43487..84a4cdf 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -596,9 +596,9 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses * whether the buffer passed in by the core will be enough */ switch_frame_t encoded_frame; switch_frame_t ulaw_frame; - switch_status_t sres; - switch_time_t now_time, difftime; - switch_time_t func_start_time, func_end_time; + switch_status_t sres = 0; + switch_time_t now_time = 0, difftime = 0; + switch_time_t func_start_time = 0, func_end_time = 0; short *dbuf_linear; int i = 0; int res = 0; commit ad74326b3f005bb97c3ed0e1bf783c8357b31cf1 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Oct 19 13:58:30 2010 -0500 fix presence update from dp to apply to pidf presence diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index cdaec04..07e9cac 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -728,7 +728,12 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) sync_sla(profile, euser, host, SWITCH_TRUE, SWITCH_TRUE); } - + + if (!strcmp(proto, "dp")) { + sql = switch_mprintf("update sip_presence set rpid='%q',status='%q' where sip_user='%q' and sip_host='%q'", + rpid, status, euser, host); + sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); + } sql = switch_mprintf("select status,rpid from sip_dialogs where sip_from_user='%q' and sip_from_host='%q'", euser, host); sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_dialog_callback, &dh); commit 36851a90b72292446b1e55257e15415da6dd3350 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Oct 19 13:33:07 2010 -0500 dont update display to ring when call is hungup in pidf presence diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 67db5db..cdaec04 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1511,7 +1511,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * } - if (!is_dialog) { + if (!is_dialog && (zstr(astate) || strcasecmp(astate, "hangup"))) { switch_set_string(status_line, status); if (in) { commit 567dab937657cc8b01e4e19211ff554bd92ba7a8 Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Tue Oct 19 11:58:06 2010 -0500 gsmopen: fix alsa_nogsmlib_nocplusplus/mod_gsmopen/Makefile diff --git a/src/mod/endpoints/mod_gsmopen/alsa_nogsmlib_nocplusplus/mod_gsmopen/Makefile b/src/mod/endpoints/mod_gsmopen/alsa_nogsmlib_nocplusplus/mod_gsmopen/Makefile index 070f941..d67bdbb 100644 --- a/src/mod/endpoints/mod_gsmopen/alsa_nogsmlib_nocplusplus/mod_gsmopen/Makefile +++ b/src/mod/endpoints/mod_gsmopen/alsa_nogsmlib_nocplusplus/mod_gsmopen/Makefile @@ -1,6 +1,7 @@ MODNAME=mod_gsmopen SVNDEF := -D'GSMOPEN_SVN_VERSION="$(shell svnversion -n .)"' -LOCAL_CFLAGS += $(SVNDEF) -Wno-error=address -DNO_GSMLIB -I../../../../../../libs/spandsp/src -I../../../../../..//libs/tiff-3.8.2/libtiff +#LOCAL_CFLAGS += $(SVNDEF) -Wno-error=address -DNO_GSMLIB -I../../../../../../libs/spandsp/src -I../../../../../..//libs/tiff-3.8.2/libtiff +LOCAL_CFLAGS += $(SVNDEF) -DNO_GSMLIB -I../../../../../../libs/spandsp/src -I../../../../../..//libs/tiff-3.8.2/libtiff LOCAL_LDFLAGS=-lasound -L../../../../../../libs/spandsp/src -lspandsp LOCAL_OBJS=gsmopen_protocol.o include ../../../../../../build/modmake.rules commit 355c0dbb8feeb89aa6cd3c6199e93725d13adde9 Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Tue Oct 19 11:57:12 2010 -0500 gsmopen: fix FS-2793, compilation stops diff --git a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp index 40a7166..cb440d3 100644 --- a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp +++ b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp @@ -1209,7 +1209,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi switch_call_cause_t *cancel_cause) { private_t *tech_pvt = NULL; - if ((*new_session = switch_core_session_request(gsmopen_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) { + if ((*new_session = switch_core_session_request(gsmopen_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, flags, pool)) != 0) { switch_channel_t *channel = NULL; switch_caller_profile_t *caller_profile; char *rdest; commit 118403c5bfe111614eca66afba0cfd1aa45c9d54 Author: Konrad Hammel <konrad@sangoma.com> Date: Tue Oct 19 10:18:27 2010 -0400 freetdm: ss7 - added support for 64bit to configure.ac diff --git a/libs/freetdm/configure.ac b/libs/freetdm/configure.ac index a8ed67f..18f83d8 100644 --- a/libs/freetdm/configure.ac +++ b/libs/freetdm/configure.ac @@ -205,6 +205,18 @@ if test "${have_sng_isdn}" = "yes"; then fi fi +if test "${have_sng_ss7}" = "yes"; then + if test "${build}" == "${host}" + then + case "${host}" in + x86_64-*) + # X86_64 machines need additional flags when compiling against libsng_isdn + CFLAGS="$CFLAGS -DBIT_64 -DALIGN_64BIT" + ;; + esac + fi +fi + COMP_VENDOR_CFLAGS="$COMP_VENDOR_CFLAGS" AC_SUBST(COMP_VENDOR_CFLAGS) AC_CONFIG_FILES([Makefile commit ee051faef39ff78d7805f1eb8c9f6330a4258032 Author: System Administrator <root@michael-collinss-macbook-pro-2.local> Date: Mon Oct 18 16:21:26 2010 -0700 Add sound prompt diff --git a/docs/phrase/phrase_en.xml b/docs/phrase/phrase_en.xml index 844353c..a028a2a 100644 --- a/docs/phrase/phrase_en.xml +++ b/docs/phrase/phrase_en.xml @@ -426,6 +426,7 @@ <prompt phrase="Barracuda Networks" filename="ivr-barracuda_networks.wav"/> <prompt phrase="CudaTel Communication Server" filename="ivr-cudatel_communication_server.wav"/> <prompt phrase="Please enter the first few letters of the person's first or last name" filename="dir-enter_person_first_or_last.wav"/> + <prompt phrase="There are no calls waiting in this queue." filename="ivr-no_calls_waiting_in_queue.wav"/> <prompt phrase="Brian West" filename="misc-Brian_West.wav"/> <prompt phrase="Anthony Minessale" filename="misc-Anthony_Minessale.wav"/> <prompt phrase="Michael Jerris" filename="misc-Michael_Jerris.wav"/> commit 31b235f16a4ba49048740d3c99a81f80fd0366e4 Author: System Administrator <root@michael-collinss-macbook-pro-2.local> Date: Mon Oct 18 15:32:24 2010 -0700 XML doesn't like missing slashes diff --git a/docs/phrase/phrase_en.xml b/docs/phrase/phrase_en.xml index 65c7017..844353c 100644 --- a/docs/phrase/phrase_en.xml +++ b/docs/phrase/phrase_en.xml @@ -437,7 +437,7 @@ <prompt phrase="Andrew Thompson" filename="misc-Andrew_Thompson.wav"/> <prompt phrase="Graham Saathoff" filename="misc-Graham_Saathoff.wav"/> <prompt phrase="Nicholaus Belluni" filename="misc-Nicholaus_Belluni.wav"/> - <prompt phrase="Sean Heiney" filename="misc-Sean_Heiney.wav"> + <prompt phrase="Sean Heiney" filename="misc-Sean_Heiney.wav"/> </ivr> <misc> <prompt phrase="This call has been secured" filename="call_secured.wav"/> commit 4e0399d05ff51178967374d5cadc3ab99e80cd7f Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Oct 18 15:30:11 2010 -0500 adjust sql stmts in presence to allow even non-registered entities to be tracked diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 55b0c5c..67db5db 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -568,27 +568,39 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) if (probe_euser && probe_host && (profile = sofia_glue_find_profile(probe_host))) { sql = switch_mprintf("select status,rpid from sip_dialogs where sip_from_user='%q' and sip_from_host='%q'", probe_euser, probe_host); sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_dialog_callback, &dh); - switch_safe_free(sql); + h.profile = profile; - sql = switch_mprintf("select sip_registrations.sip_user, sip_registrations.sip_host, sip_registrations.status, " - "sip_registrations.rpid,'', sip_dialogs.uuid, sip_dialogs.state, sip_dialogs.direction, " - "sip_dialogs.sip_to_user, sip_dialogs.sip_to_host, sip_presence.status,sip_presence.rpid,sip_presence.open_closed," + switch_safe_free(sql); + + sql = switch_mprintf("select sip_registrations.sip_user, " + "sip_registrations.sip_host, " + "sip_registrations.status, " + "sip_registrations.rpid, " + "'', " + "sip_dialogs.uuid, " + "sip_dialogs.state, " + "sip_dialogs.direction, " + "sip_dialogs.sip_to_user, " + "sip_dialogs.sip_to_host, " + "sip_presence.status," + "sip_presence.rpid," + "sip_dialogs.presence_id, " + "sip_presence.open_closed," "'%q','%q' " "from sip_registrations left join sip_dialogs on " "(sip_dialogs.sip_from_user = sip_registrations.sip_user " "and (sip_dialogs.sip_from_host = sip_registrations.orig_server_host or " "sip_dialogs.sip_from_host = sip_registrations.sip_host) ) " - - + "left join sip_presence on " "(sip_registrations.sip_user=sip_presence.sip_user and sip_registrations.orig_server_host=sip_presence.sip_host and " "sip_registrations.profile_name=sip_presence.profile_name) " - "where sip_registrations.sip_user='%q' and " + "where sip_dialogs.presence_id='%q@%q' or (sip_registrations.sip_user='%q' and " "(sip_registrations.orig_server_host='%q' or sip_registrations.sip_host='%q' " - "or sip_registrations.presence_hosts like '%%%q%%')", - dh.status, dh.rpid, probe_euser, probe_host, probe_host, probe_host); + "or sip_registrations.presence_hosts like '%%%q%%'))", + dh.status, dh.rpid, probe_euser, probe_host, probe_euser, probe_host, probe_host, probe_host); switch_assert(sql); if (mod_sofia_globals.debug_presence > 0) { @@ -599,10 +611,37 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s DUMP PRESENCE_PROBE_SQL:\n%s\n", profile->name, sql); } - h.profile = profile; sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_resub_callback, &h); - if (mod_sofia_globals.debug_presence > 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s END_PRESENCE_PROBE_SQL\n\n", profile->name); + + + if (!h.rowcount) { + switch_safe_free(sql); + /* find ones with presence_id defined that are not registred */ + sql = switch_mprintf("select sip_from_user, sip_from_host, 'Registered', '', '', " + "uuid, state, direction, " + "sip_to_user, sip_to_host, '','',''," + "'%q','%q',presence_id " + + "from sip_dialogs " + + "where (presence_id='%q@%q' or " + "(sip_from_user='%q' and sip_from_host='%q'))", + + dh.status, dh.rpid, probe_euser, probe_host, probe_euser, probe_host); + + if (mod_sofia_globals.debug_presence > 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s START_PRESENCE_PROBE_SQL\n", profile->name); + } + + if (mod_sofia_globals.debug_presence > 1) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s DUMP PRESENCE_PROBE_SQL:\n%s\n", profile->name, sql); + } + + sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_resub_callback, &h); + + if (mod_sofia_globals.debug_presence > 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s END_PRESENCE_PROBE_SQL\n\n", profile->name); + } } if (!h.rowcount) { @@ -700,7 +739,8 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) "sip_subscriptions.contact,sip_subscriptions.call_id,sip_subscriptions.full_from," "sip_subscriptions.full_via,sip_subscriptions.expires,sip_subscriptions.user_agent," "sip_subscriptions.accept,sip_subscriptions.profile_name" - ",'%q','%q','%q',sip_presence.status,sip_presence.rpid,sip_presence.open_closed,'%q','%q',sip_subscriptions.version " + ",'%q','%q','%q',sip_presence.status,sip_presence.rpid,sip_presence.open_closed,'%q','%q'," + "sip_subscriptions.version, sip_dialogs.presence_id " "from sip_subscriptions " "left join sip_presence on " "(sip_subscriptions.sub_to_user=sip_presence.sip_user and sip_subscriptions.sub_to_host=sip_presence.sip_host and " @@ -710,12 +750,13 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) "(sip_dialogs.sip_from_user = sip_subscriptions.sub_to_user " "and sip_dialogs.sip_from_host = sip_subscriptions.sub_to_host) " - "where sip_subscriptions.expires > -1 and (event='%q' or event='%q') and sub_to_user='%q' " + "where sip_subscriptions.expires > -1 and " + "(event='%q' or event='%q') and (sub_to_user='%q' or sip_dialogs.presence_id like '%q@%%') " "and (sub_to_host='%q' or presence_hosts like '%%%q%%') " "and (sip_subscriptions.profile_name = '%q' or sip_subscriptions.presence_hosts != sip_subscriptions.sub_to_host)", switch_str_nil(status), switch_str_nil(rpid), host, dh.status,dh.rpid, - event_type, alt_event_type, euser, host, host, profile->name))) { + event_type, alt_event_type, euser, euser, host, host, profile->name))) { struct presence_helper helper = { 0 }; @@ -958,6 +999,7 @@ static int sofia_presence_resub_callback(void *pArg, int argc, char **argv, char char *rpid = argv[3]; char *proto = argv[4]; + char *presence_id = NULL; char *to_user = NULL; char *uuid = NULL; char *state = NULL; @@ -965,6 +1007,7 @@ static int sofia_presence_resub_callback(void *pArg, int argc, char **argv, char switch_event_t *event; char to_buf[128] = ""; switch_event_header_t *hp; + char *free_me = NULL; if (argc > 5) { uuid = argv[5]; @@ -979,6 +1022,16 @@ static int sofia_presence_resub_callback(void *pArg, int argc, char **argv, char status = argv[10]; rpid = argv[11]; } + + if (argc > 12 && !zstr(argv[12]) && strchr(argv[12], '@')) { + char *p; + + presence_id = argv[12]; + free_me = strdup(presence_id); + if ((p = strchr(free_me, '@'))) *p = '\0'; + user = free_me; + } + } if (zstr(proto)) { @@ -992,7 +1045,10 @@ static int sofia_presence_resub_callback(void *pArg, int argc, char **argv, char if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", proto ? proto : SOFIA_CHAT_PROTO); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->url); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", user, host); + + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", status); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", rpid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence"); @@ -1028,6 +1084,8 @@ static int sofia_presence_resub_callback(void *pArg, int argc, char **argv, char switch_event_fire(&event); } + switch_safe_free(free_me); + h->rowcount++; return 0; } @@ -1201,7 +1259,9 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * char expires_str[10] = ""; char status_line[256] = ""; char *version = "0"; - + char *presence_id = NULL; + char *free_me = NULL; + //int i; //for(i = 0; i < argc; i++) { @@ -1222,7 +1282,21 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * dialog_status = argv[20]; dialog_rpid = argv[21]; version = argv[22]; + presence_id = argv[23]; + } + + if (!zstr(presence_id) && strchr(presence_id, '@')) { + char *p; + + free_me = strdup(presence_id); + + if ((p = strchr(free_me, '@'))) { + *p = '\0'; + } + + user = free_me; } + in = helper->event && helper->event->event_id == SWITCH_EVENT_PRESENCE_IN; @@ -1567,6 +1641,8 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * end: + switch_safe_free(free_me); + if (ext_profile) { sofia_glue_release_profile(ext_profile); } commit 107199f0da19fd14a61b7970ac8b436660a60e80 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Oct 18 14:47:26 2010 -0500 try this sekil diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 165df88..2549554 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -853,15 +853,15 @@ static switch_status_t hanguphook(switch_core_session_t *session) msg.from = __FILE__; msg.string_arg = switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE); - if (state == CS_ROUTING) { - if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) { - switch_channel_clear_flag_recursive(channel, CF_BRIDGE_ORIGINATOR); - if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == SWITCH_STATUS_SUCCESS) { - switch_channel_event_set_data(channel, event); - switch_event_fire(&event); - } + + if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) { + switch_channel_clear_flag_recursive(channel, CF_BRIDGE_ORIGINATOR); + if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == SWITCH_STATUS_SUCCESS) { + switch_channel_event_set_data(channel, event); + switch_event_fire(&event); } } + switch_core_session_receive_message(session, &msg); switch_core_event_hook_remove_state_change(session, hanguphook); commit d2691a7ff53cd36ddad01abeadf405b627800c24 Author: Konrad Hammel <konrad@sangoma.com> Date: Mon Oct 18 11:07:47 2010 -0400 freetdm: ss7 - updated libSng-SS7 api, fixed spelling mistake in cli, added support for obci_bita diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c index 92284ed..38d3723 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c @@ -616,8 +616,8 @@ static ftdm_status_t handle_print_usuage(ftdm_stream_handle_t *stream) stream->write_function(stream, "Sangoma SS7 CLI usuage:\n\n"); stream->write_function(stream, "Ftmod_sangoma_ss7 general control:\n"); - stream->write_function(stream, "ftdm ss7 set ftace X Y\n"); - stream->write_function(stream, "ftdm ss7 set mtace X Y\n"); + stream->write_function(stream, "ftdm ss7 set ftrace X Y\n"); + stream->write_function(stream, "ftdm ss7 set mtrace X Y\n"); stream->write_function(stream, "\n"); stream->write_function(stream, "Ftmod_sangoma_ss7 information:\n"); stream->write_function(stream, "ftdm ss7 show status link X\n"); @@ -1064,7 +1064,7 @@ static ftdm_status_t handle_show_status(ftdm_stream_handle_t *stream, int span, /* grab the signaling_status */ ftdm_channel_get_sig_status(ftdmchan, &sigstatus); - stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|sig_status=%s|state=%s|", + stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|sig_status=%4s|state=%s|", ckt->span, ckt->chan, ckt->cic, @@ -1281,13 +1281,17 @@ static ftdm_status_t handle_status_link(ftdm_stream_handle_t *stream, char *name (sta.t.ssta.s.snDLSAP.remBlkd) ? "Y":"N", (sta.t.ssta.s.snDLSAP.locInhbt) ? "Y":"N", (sta.t.ssta.s.snDLSAP.rmtInhbt) ? "Y":"N"); - break; + + goto success; } /* move to the next link */ x++; } /* while (id != 0) */ + stream->write_function(stream, "Failed to find link=\"%s\"\n", name); + +success: return FTDM_SUCCESS; } @@ -1313,13 +1317,17 @@ static ftdm_status_t handle_status_linkset(ftdm_stream_handle_t *stream, char *n name, DECODE_LSN_LINKSET_STATUS(sta.t.ssta.s.snLnkSet.state), sta.t.ssta.s.snLnkSet.nmbActLnks); - break; + + goto success; } /* move to the next linkset */ x++; } /* while (id != 0) */ + stream->write_function(stream, "Failed to find link=\"%s\"\n", name); + +success: return FTDM_SUCCESS; } @@ -1342,13 +1350,16 @@ static ftdm_status_t handle_set_inhibit(ftdm_stream_handle_t *stream, char *name /* print the new status of the link */ handle_status_link(stream, &name[0]); - break; + goto success; } /* move to the next linkset */ x++; } /* while (id != 0) */ + stream->write_function(stream, "Failed to find link=\"%s\"\n", name); + +success: return FTDM_SUCCESS; } @@ -1371,13 +1382,16 @@ static ftdm_status_t handle_set_uninhibit(ftdm_stream_handle_t *stream, char *na /* print the new status of the link */ handle_status_link(stream, &name[0]); - break; + goto success; } /* move to the next linkset */ x++; } /* while (id != 0) */ + stream->write_function(stream, "Failed to find link=\"%s\"\n", name); + +success: return FTDM_SUCCESS; } @@ -1440,6 +1454,10 @@ static ftdm_status_t handle_tx_rsc(ftdm_stream_handle_t *stream, int span, int c /* go the next circuit */ x++; } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ + + /* print the status of channels */ + handle_show_status(stream, span, chan, verbose); + return FTDM_SUCCESS; @@ -1505,6 +1523,24 @@ static ftdm_status_t handle_tx_grs(ftdm_stream_handle_t *stream, int span, int c x++; } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ + x=1; + while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { + if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) { + + sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; + ftdmchan = sngss7_info->ftdmchan; + sngss7_span = ftdmchan->span->mod_data; + + if ((ftdmchan->physical_span_id == span) && + ((ftdmchan->physical_chan_id >= chan) && (ftdmchan->physical_chan_id < (chan+range)))) { + + handle_show_status(stream, span, chan, verbose); + } + } /* if ( cic == voice) */ + + /* go the next circuit */ + x++; + } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ return FTDM_SUCCESS; } @@ -1585,6 +1621,25 @@ static ftdm_status_t handle_tx_cgb(ftdm_stream_handle_t *stream, int span, int c /* send the circuit group block */ ft_to_sngss7_cgb(main_chan); + + x=1; + while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { + if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) { + + sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; + ftdmchan = sngss7_info->ftdmchan; + sngss7_span = ftdmchan->span->mod_data; + + if ((ftdmchan->physical_span_id == span) && + ((ftdmchan->physical_chan_id >= chan) && (ftdmchan->physical_chan_id < (chan+range)))) { + + handle_show_status(stream, span, chan, verbose); + } + } /* if ( cic == voice) */ + + /* go the next circuit */ + x++; + } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ return FTDM_SUCCESS; @@ -1666,6 +1721,25 @@ static ftdm_status_t handle_tx_cgu(ftdm_stream_handle_t *stream, int span, int c /* send the circuit group block */ ft_to_sngss7_cgu(main_chan); + + x=1; + while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { + if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) { + + sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; + ftdmchan = sngss7_info->ftdmchan; + sngss7_span = ftdmchan->span->mod_data; + + if ((ftdmchan->physical_span_id == span) && + ((ftdmchan->physical_chan_id >= chan) && (ftdmchan->physical_chan_id < (chan+range)))) { + + handle_show_status(stream, span, chan, verbose); + } + } /* if ( cic == voice) */ + + /* go the next circuit */ + x++; + } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ return FTDM_SUCCESS; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index cff9711..2b267e7 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -1480,7 +1480,7 @@ static FIO_SIG_LOAD_FUNCTION(ftdm_sangoma_ss7_init) sngss7_id = 0; - cmbLinkSetId = 1; + cmbLinkSetId = 0; /* initalize the global gen_config flag */ g_ftdm_sngss7_data.gen_config = 0; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index 5de237d..f41664a 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -86,6 +86,10 @@ typedef enum { } sng_flag_t; typedef enum { + SNGSS7_ACM_OBCI_BITA = (1 << 0) /* in-band indication */ +} sng_intf_options_t; + +typedef enum { SNG_CALLED = 1, SNG_CALLING = 2 } sng_addr_type_t; @@ -205,6 +209,7 @@ typedef struct sng_route { typedef struct sng_isup_intf { uint32_t id; char name[MAX_NAME_LEN]; + uint32_t options; uint32_t flags; uint32_t spc; uint32_t dpc; @@ -721,6 +726,11 @@ void handle_isup_t35(void *userdata); #define sngss7_clear_flag(obj, flag) ((obj)->flags &= ~(flag)) #define sngss7_set_flag(obj, flag) ((obj)->flags |= (flag)) +#define sngss7_test_options(obj, option) ((obj)->options & option) +#define sngss7_clear_options(obj, option) ((obj)->options &= ~(option)) +#define sngss7_set_options(obj, option) ((obj)->options |= (option)) + + #ifdef SS7_PRODUCTION # define SS7_ASSERT \ SS7_INFO_CHAN(ftdmchan,"Production Mode, continuing%s\n", ""); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index 3571a9e..8cbe6d9 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -308,7 +308,8 @@ void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan) { SS7_FUNC_TRACE_ENTER (__FUNCTION__); - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + sng_isup_inf_t *isup_intf = &g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId]; SiCnStEvnt acm; memset (&acm, 0x0, sizeof (acm)); @@ -337,7 +338,18 @@ void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan) acm.bckCallInd.echoCtrlDevInd.val = 0x1; /* ec device present */ acm.bckCallInd.sccpMethInd.pres = PRSNT_NODEF; acm.bckCallInd.sccpMethInd.val = SCCPMTH_NOIND; - + + /* fill in any optional parameters */ + if (sngss7_test_options(isup_intf, SNGSS7_ACM_OBCI_BITA)) { + acm.optBckCalInd.eh.pres = PRSNT_NODEF; + acm.optBckCalInd.inbndInfoInd.pres = PRSNT_NODEF; + acm.optBckCalInd.inbndInfoInd.val = sngss7_test_options(isup_intf, SNGSS7_ACM_OBCI_BITA); + acm.optBckCalInd.caFwdMayOcc.pres = PRSNT_DEF; + acm.optBckCalInd.simpleSegmInd.pres = PRSNT_DEF; + acm.optBckCalInd.mlppUserInd.pres = PRSNT_DEF; + acm.optBckCalInd.usrNetIneractInd.pres = PRSNT_DEF; + } /* if (sngss7_test_options(isup_intf, SNGSS7_ACM_OBCI_BITA)) */ + /* send the ACM request to LibSngSS7 */ sng_cc_con_status (1, sngss7_info->suInstId, diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c index d238462..1235238 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c @@ -50,27 +50,41 @@ int ftmod_ss7_mtplinkSet_sta(uint32_t id, SnMngmt *cfm); int ftmod_ss7_mtplink_sta(uint32_t id, SnMngmt *cfm) { SnMngmt sta; + Pst pst; memset(&sta, 0x0, sizeof(sta)); + /* initalize the post structure */ + smPstInit(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTSN; + sta.hdr.elmId.elmnt = STDLSAP; sta.hdr.elmId.elmntInst1 = g_ftdm_sngss7_data.cfg.mtpLink[id].id; - return(sng_sta_mtp3(&sta, cfm)); + return(sng_sta_mtp3(&pst, &sta, cfm)); } /******************************************************************************/ int ftmod_ss7_mtplinkSet_sta(uint32_t id, SnMngmt *cfm) { SnMngmt sta; + Pst pst; memset(&sta, 0x0, sizeof(sta)); + /* initalize the post structure */ + smPstInit(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTSN; + sta.hdr.elmId.elmnt = STLNKSET; sta.hdr.elmId.elmntInst1 = g_ftdm_sngss7_data.cfg.mtpLinkSet[id].id; sta.hdr.elmId.elmntInst2 = g_ftdm_sngss7_data.cfg.mtpLinkSet[id].links[0]; - return(sng_sta_mtp3(&sta, cfm)); + return(sng_sta_mtp3(&pst, &sta, cfm)); } /******************************************************************************/ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c index 359055f..5229542 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c @@ -1249,6 +1249,18 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface) sng_isup.cld_nadi = atoi(parm->val); SS7_DEBUG("\tFound default CLD_NADI value = %d\n", sng_isup.cld_nadi); /**********************************************************************/ + } else if (!strcasecmp(parm->var, "obci_bita")) { + /**********************************************************************/ + if (*parm->val == '1') { + sngss7_set_options(&sng_isup, SNGSS7_ACM_OBCI_BITA); + SS7_DEBUG("\tFound Optional Backwards Indicator: Bit A (early media) enable option\n"); + } else if (*parm->val == '0') { + sngss7_clear_options(&sng_isup, SNGSS7_ACM_OBCI_BITA); + SS7_DEBUG("\tFound Optional Backwards Indicator: Bit A (early media) disable option\n"); + } else { + SS7_DEBUG("\tInvalid value for \"obci_bita\" option\n"); + } + /**********************************************************************/ } else { SS7_ERROR("\tFound an invalid parameter \"%s\"!\n", parm->val); return FTDM_FAIL; @@ -1671,7 +1683,7 @@ static int ftmod_ss7_fill_in_isup_interface(sng_isup_inf_t *sng_isup) g_ftdm_sngss7_data.cfg.isupIntf[i].isap = sng_isup->isap; g_ftdm_sngss7_data.cfg.isupIntf[i].cld_nadi = sng_isup->cld_nadi; g_ftdm_sngss7_data.cfg.isupIntf[i].clg_nadi = sng_isup->clg_nadi; - + g_ftdm_sngss7_data.cfg.isupIntf[i].options = sng_isup->options; if (sng_isup->t4 != 0) { g_ftdm_sngss7_data.cfg.isupIntf[i].t4 = sng_isup->t4; } else { commit 45a0fb7b23665ecf5540bbe1eb5d43cf6a613e15 Author: Geovani Ricardo Wiedenhoft <grw@geovani.(none)> Date: Mon Oct 18 16:24:57 2010 -0200 Added mod_khomp in modules.conf diff --git a/build/modules.conf.in b/build/modules.conf.in index 67e1fe6..37244a1 100644 --- a/build/modules.conf.in +++ b/build/modules.conf.in @@ -105,5 +105,5 @@ say/mod_say_ru #say/mod_say_th ## Experimental Modules (don't cry if they're broken) -#../../contrib/mod/endpoints/mod_khomp +#endpoints/mod_khomp #../../contrib/mod/xml_int/mod_xml_odbc commit 5fea197b78c7bbefe399241f3aaa78731503902a Author: Geovani Ricardo Wiedenhoft <grw@geovani.(none)> Date: Mon Oct 18 16:17:43 2010 -0200 Added mod_khomp Endpoint. This module has been developed to make a nice, affordable brazilian board called Khomp (http://www.khomp.com.br) compatible with FreeSWITCH. Supported boards: - FXS - FXO - E1 - GSM (boards and usb devices) - Passive record - kommuter diff --git a/src/mod/endpoints/mod_khomp/Install/files/khomp.conf.xml b/src/mod/endpoints/mod_khomp/Install/files/khomp.conf.xml new file mode 100644 index 0000000..7255fb8 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/Install/files/khomp.conf.xml @@ -0,0 +1,549 @@ +<configuration name="khomp.conf" description="Khomp Configuration"> +<!-- Config for all boards --> +<settings> + +<!-- +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;; This is the configuration file for the Khomp ;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Endpoint 1.0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +--> + +<channels> +<!-- Section for main configurations about channels. --> + +<!-- +Enable/disable generalized echo cancellation in the channel, for calls +passing inside FreeSWITCH (disabled for bridged calls). +(default = yes) + +<param name="echo-canceller" value="yes"/> +--> + +<!-- +Enable/disable AGC (auto gain control). Should be used carefully, as it +can make line noise really loud. +(default = yes) + +<param name="auto-gain-control" value="yes"/> +--> + +<!-- +Enable/disable sending DTMFs out-band as a way to pass detected DTMFs to +FreeSWITCH. Needed if FreeSWITCH generates digits for us in bridge application +or is being used for IVR ("URA", in pt_BR). +(default = yes) + +<param name="out-of-band-dtmfs" value="yes"/> +--> + +<!-- +Enable/disable DTMF suppression delay. WARNING: if you disable this, DTMFs +will not be suppressed anymore! You should only use this option if +"out-of-band-dtmfs" is "no". +(default = yes) + +<param name="suppression-delay" value="yes"/> +--> + +<!-- +Adjust connection automagically if a FAX tone is detected. +(default = yes) + +<param name="auto-fax-adjustment" value="yes"/> +--> + +<!-- +Time (is seconds) since connection, when we may detect FAX tone and perform +automagical adjustment. After this, FAX tone detection is ignored. +Possible values: 0 - 9999 +(default = 30). + +<param name="fax-adjustment-timeout" value="30"/> +--> + +<!-- +Enable/disable pulse detection (reported as DTMF digits). +(default = yes) + +<param name="pulse-forwarding" value="yes"/> +--> + +<!-- +Enable correct standard following for R2/MFC protocol. Disabled by default, +as using FreeSWITCH behind a PBX may timeout all outgoing calls without this. +However, you can set this to "yes" if FreeSWITCH is directly connected to a +CO (central office) or to a fast signaling PBX, and have a correct +behaviour for condition obtaining/reporting. +(default = no) + +<param name="r2-strict-behaviour" value="no"/> +--> + +<!-- +Set the delay (in ms) after sending ringback condition where audio stream +should be opened for the channel. Limited to 25ms min, 500ms max. +(default = 250) + +<param name="r2-preconnect-wait" value="250"/> +--> + +<!-- +Enable/disable native bridge mode (known in pt_BR as "trombone") for calls +in the Khomp channel, passing the audio inside the board when both channels +(incoming and outgoing) are of type Khomp. This reduces the echo and the +audio delay, and frees the host from most audio processing. +(default = yes) + +<param name="native-bridge" value="yes"/> +--> + +<!-- +Defines the incoming context for calls on E1 channels. Some wildcards are +accepted, and described in the bottom of this file. +(default = khomp-DD-LL) + +<param name="context-digital" value="khomp-DD-LL"/> +--> + +<!-- +Defines the incoming context for calls on FXS channels. Some wildcards are +accepted, and described in the bottom of this file. +(default = khomp-DD-CC) + +<param name="context-fxs" value="khomp-DD-CC"/> +--> + +<!-- +Defines the "alternative" context for calls on FXS channels, which will be +checked if the main context does not match for a call. Some wildcards are +accepted, and described in the bottom of this file. +(default = khomp-DD) + +<param name="context-fxs-alt" value="khomp-DD"/> +--> + +<!-- +Defines the incoming context for calls on FXO channels. Some wildcards are +accepted, and described in the bottom of this file. +(default = khomp-DD-CC) + +<param name="context-fxo" value="khomp-DD-CC"/> +--> + +<!-- +Defines the "alternative" context for calls on FXO channels, which will be +checked if the main context does not match for a call. Some wildcards are +accepted, and described in the bottom of this file. +(default = khomp-DD) + +<param name="context-fxo-alt" value="khomp-DD"/> +--> + +<!-- +Defines the incoming context for calls on GSM channels. Some wildcards are +accepted, and described in the bottom of this file. +(default = khomp-DD-CC) + +<param name="context-gsm-call" value="khomp-DD-CC"/> +--> + +<!-- +Defines the "alternative" context for calls on GSM channels, which will be +checked if the main context does not match for a call. Some wildcards are +accepted, and described in the bottom of this file. +(default = khomp-DD) + +<param name="context-gsm-call-alt" value="khomp-DD"/> +--> + +<!-- +Defines the incoming context for messages on GSM channels. Some wildcards are +accepted, and described in the bottom of this file. +(default = khomp-sms-DD-CC) + +<param name="context-gsm-sms" value="khomp-sms-DD-CC"/> +--> + +<!-- +Defines the incoming context for calls on Passive Record boards (KPR). Some +wildcards are accepted, and described in the bottom of this file. +(default = khomp-DD-CC) + +<param name="context-pr" value="khomp-DD-CC"/> +--> + +<!-- +Set the logging of messages to console. Possible values (to set more than one, +separate the values with comma): + + errors - Error messages, when something goes really wrong. + warnings - Warnings, used when something might not be going as expected. + messages - Generic messages, used to indicate some information. + events - Show received K3L events as console messages. + commands - Show sent K3L commands as console messages. + audio - Enable messages for K3L audio events (very verbose!). + modem - Enable messages for data received from KGSM modems. + link - Enable logging of link status changes. + standard - Special, enable default messages (RECOMMENDED). + all - Special, enable ALL messages (should not be used naively). + +(default = standard) + +<param name="log-to-console" value="standard"/> +--> + +<!-- +Set the logging of messages to disk. Possible values (to set more than one, +separate the values with comma): + + errors - Error messages, when something goes really wrong. + warnings - Warnings, used when something might not be going as expected. + messages - Generic messages, used to indicate some information. + events - Record received K3L events as log messages. + commands - Record sent K3L commands as log messages. + audio - Enable messages for K3L audio events (very verbose!). + modem - Enable messages for data received from KGSM modems. + link - Enable logging of link status changes. + functions - Enable debugging for functions. Should not be used naively!). + threads - Enable debugging for threads. Should not be used naively!). + locks - Enable debugging for locks. Should not be used naively!). + streams - Enable debugging for streams. Should not be used naively!). + standard - Special, enable default messages (RECOMMENDED). + debugging - Special, enable debug messages (should not be used naively). + all - Special, enable ALL messages (DO NOT USE THIS!). + +(default = standard) + +<param name="log-to-disk" value="standard"/> +--> + +<!-- +Set the low level tracing. DO NOT USE THIS UNLESS YOU WERE ADVISED TO DO SO. +Possible values (to set more than one, separate the values with comma): + +k3l - Enable the low level tracing of board's API. + If you are using 'kserver', this option will take no effect. For + the k3l tracing to proceed, you will need to (re)start kserver + with 'debug' option. E.g. '#> kserver start -debug'. +rdsi - Enable ISDN low level debugging. +r2 - Enable r2 protocol low level debugging. + +(default = <empty>) + +<param name="trace" value=""/> +--> + +<!-- +Set output volume level. Possible values: + + * '+ N' = increase N times; + * '- N' = decrease N times. + * '0' = leave default. + +(default = 0) + +<param name="output-volume" value="0"/> +--> + +<!-- +Set input volume level. Can only be used if AGC (and not pulse detection) +is enabled on the board configuration. Possible values: + + * '+ N' = increase N times; + * '- N' = decrease N times. + * '0' = leave default. + +(default = 0) + +<param name="input-volume" value="0"/> +--> + +<!-- +Sets the default AMA flags, affecting the categorization of entries in +the call detail records. +(default = default) + +<param name="amaflags" value="default"/> +--> + +<!-- +Sets the account code for calls placed on the channel. The account code may +be any alphanumeric string +(default = KhompBoard) + +<param name="accountcode" value="KhompBoard"/> +--> + +<!-- +Set the language of the channel (useful for selecting audio messages of a +specific language on answer). +(default = <empty>) + +<param name="language" value="pt_BR"/> +--> + +<!-- +Set the music on hold class of the channel (useful for selecting a group of +songs to play on hold). +(default = default) + +<param name="mohclass" value="default"/> +--> + +<!-- +Sets the global orig (CALLERID) base for FXS boards. This number is added +to a sequencial number, which is incremented for each FXS board and FXS +channel in the system. + +For more example of how to use this option, see channel README file, +section 'Opcoes do application Bridge', item '<action application="bridge" data="Khomp/r304" />'. +(default = 0) + +<param name="fxs-global-orig" value="0200"/> +--> + +<!-- +Sets the numbers (separated by comma) in which the 'pbx-dialtone' from +FXS boards will be changed to 'co-dialtone' (public tone), when they are +pressed. +(default = <empty>) + +<param name="fxs-co-dialtone" value="0,90"/> +--> + +<!-- +Enable or disable sending number of A throught BINA DTMF signalization to +a FXS branch. +(default = yes) + +<param name="fxs-bina" value="yes"/> +--> + +<!-- +Enable/disable using CTbus for Khomp CTI boards in native bridge. +(WARNING: just used for internal testings!) +(default = no) + +<param name="has-ctbus" value="no"/> +--> + +<!-- +This is the delay time to really disconnect a channel after the disconnect +event arrive. If a connect event comes up in this interval, then the +disconnection is ignored and the call keeps going on. Values in ms. +(default = 0) + +<param name="disconnect-delay" value="0"/> +--> + +<!-- +This timer controls the delay associated with ringback generation in the +Khomp channel, when the other side *does not send audio* - in other words, +this is used when calling peers located at VoIP channels. +Values are in milliseconds. +(default = 1500) + +<param name="delay-ringback-co" value="1500"/> +--> + +<!-- +This timer controls the delay associated with ringback generation in the +Khomp channel when the other side report a continuous stream of audio in +silence - in other words, this is used when the audio is present but does +not have any tone. Values are in milliseconds. +(default = 2500) + +<param name="delay-ringback-pbx" value="2500"/> +--> + +<!-- +Defines if the channel should optimize audio delay by droping longstanding +packets from audio buffer. This guarantees the minimal audio delay for the +user, and avoid delays associated with miscoded SIP clients. However, +depending on the system's scheduling policy (some 2.6 kernel releases), +this may result on excessive drop of packets, and audible audio skipping. +This should not be changed naively. +(default = no) + +<param name="optimize-audio-path" value="no"/> +--> + +<!-- +Defines if the channel should ignore some uncommon DTMF digits detected by +the board (A, B, C and D). This reduces the number of false positives which +may happen sometimes, without affecting correctness on traditional +scenarios. However, if you need to pass those digits througth the board, +you may need to set this option to 'no'. +(default = yes) + +<param name="ignore-letter-dtmfs" value="yes"/> +--> + +<!-- +For KFXO series boards, defines if audio will be allowed being sent into +outgoing calls before it has been connected. +(default = yes) + +<param name="fxo-send-pre-audio" value="yes"/> +--> + +<!-- +Defines the timeout, in seconds, between digits of a FXS board's extension. +(default = 7) + +<param name="fxs-digit-timeout" value="7"/> +--> + +<!-- +Enables/Disables the action of dropping collect calls. If enabled, all +collect calls will be dropped no matter what KDropCollectCall is set to. +(default = no) + +<param name="drop-collect-call" value="no"/> +--> + +<!-- +Defines if the activation and deactivation of Kommuter is done automatically by the channel, +or manually by the user. Possible values: + +auto - Khomp channel driver starts all kommuter devices at initialization and stops them if the module is unloaded. +manual - The user must explicity call the CLI command < khomp kommuter on/off >, that starts or stops the kommuter devices connected to this machine. +(default = auto) + +<param name="kommuter-activation" value="auto"/> +--> + +<!-- +Defines the default value for the Kommuter watchdog in seconds. +All kommuters conected to this machine will be initialized with this value, +and will commute the links after reaching this time with no response of the channel. +The minimum is 0 (will never commute the links), and maximum value is 255 seconds. +(default = 10) + +<param name="kommuter-timeout" value="10"/> +--> + +<!-- +When adjusted to some DTMF digit sequence, it will define those as the digits +to be used to initialize a call transfer using PBX-to-PBX signaling. +(default = empty) + +<param name="user-transfer-digits" value="#2"/> +--> + +<!-- +;;;;;;;;;;;;;;;;;;;; CONTEXTS WILDCARDS ;;;;;;;;;;;;;;;;;;;;;; + +For incoming contexts, you can use the following wildcards: + +'DD' (device number): the sequence number of the board on the +system (can be checked using "khomp summary", valid for all +board models); + +'LL' (link number): the sequence number of link where the call +has arrived on the board. valid only for E1 boards. + +'SSSS' (serial number): the serial number of the board (can +be checked using "khomp summary", and it's valid for all +board models); + +'CC' (channel number): the channel number on which the call +or message has arrived (valid for FXO, FXS and GSM boards); + +'CCC' (channel number): same as above, but valid only for E1 +channels; +--> + +</channels> + +<!-- Section for configuring allocation groups. --> +<groups> +<!-- +In this section, you should define options using the following syntax: + +<groupname> = <allocation-string>[:<context>] + +<param name="pstn" value="b0l0 + b1c38"/> +<param name="pstn" value="b0l0 + b1c38:from-pstn"/> + +You may define your own groups. In the example above, the group +called pstn can be used in the bridge string as <action application="brigde" data="Khomp/Gpstn/..." /> +or <action application="brigde" data="Khomp/Gpstn/..." />. As a result, the allocation string will be +replaced with the one associated with the group "pstn". This is the same +of doing <action application="brigde" data="Khomp/b0l0 + b1c38/... />. +In the second example, a context is also defined which can be used in +extensions.conf for inbound calls on that allocation string's range. +--> +</groups> + +<!-- +Section for configuring cadences used on FXS boards and the whole +channel (fast busy, ringback tones, etc). +--> +<cadences> +<!-- +Default value for cadences. You may define your own cadences, and +also use them in the bridge arguments as "cadence=your_cadence_name". + + "0,0" means a continuous dialtone. + + (default as defined below) + <param name="fast-busy" value="100,100" /> + <param name="ringback" value="1000,4000" /> + <param name="pbx-dialtone" value="1000,100" /> + <param name="vm-dialtone " value="1000,100,100,100" /> + <param name="co-dialtone " value="0,0" /> +--> +</cadences> + + +<!-- Section for configuring CALLERID's associated with FXS boards. --> +<fxs-branches> +<!-- +In this section, you should define options using the following syntax: + +'orig_prefix = serial number 0, serial number 1, ...' + +ex: <param name="880" value="111,222"/> + +In the example above (assuming KFXS-SPX boards 1234 and 4535), the +branches will be numbered from 800 to 829 in board 1234, and from +830 to 859 in board 4535. +--> +</fxs-branches> + +<!-- Section for configuring FXS hotlines. --> +<fxs-hotlines> +<!-- +In this section, you should define options using the following syntax: + +'orig_prefix = destination_number' + +ex: <param name="804" value="32332933" /> + +In the example above, the branch numbered 804 will call the number +3233-2933 (Khomp support number) every time the FXS branch goes off hook. +--> +</fxs-hotlines> + +<!-- Section for configuring specific options for FXS branches. --> +<fxs-options> +<!-- +In this section, you should define options using the following syntax: + +'orig_prefix = option1:value | option2:value | option3:value' ... + +ex: <param name="804" value="output-volume:+2' /> + +In the example above, the branch numbered 804 will have specific +configuration for default output volume set to +2. + +Possible values to options is: +context, input-volume, output-volume language, +mohclass, amaflags, accountcode, calleridnum, calleridname, mailbox. +--> +</fxs-options> + +</settings> +</configuration> diff --git a/src/mod/endpoints/mod_khomp/Makefile b/src/mod/endpoints/mod_khomp/Makefile new file mode 100644 index 0000000..94923c7 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/Makefile @@ -0,0 +1,41 @@ +MODNAME := mod_khomp +VERBOSE := 1 + +ifeq ($(strip $(FREESWITCH_PATH)),) + BASE := ../../../../ +else + BASE := $(FREESWITCH_PATH) +endif + +curr_dir := $(shell pwd) + +versions := -DFS_VERSION_MAJOR=$(shell bash $(curr_dir)/tools/getversion.sh "SWITCH_VERSION_MAJOR" $(BASE)) -DFS_VERSION_MINOR=$(shell bash $(curr_dir)/tools/getversion.sh "SWITCH_VERSION_MINOR" $(BASE)) -DFS_VERSION_MICRO=$(shell bash $(curr_dir)/tools/getversion.sh "SWITCH_VERSION_MICRO" $(BASE)) + +LOCAL_CFLAGS = -I./ -I./include -I./commons -I./support -D_REENTRANT -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DK3L_HOSTSYSTEM -DCOMMONS_LIBRARY_USING_FREESWITCH -g -ggdb #-DDEBUG_FLAGS +LOCAL_CFLAGS += $(versions) + +LOCAL_LDFLAGS = -lk3l + +LOCAL_OBJS = ./commons/k3lapi.o ./commons/k3lutil.o ./commons/config_options.o ./commons/format.o ./commons/strings.o ./commons/ringbuffer.o ./commons/verbose.o ./commons/saved_condition.o ./commons/regex.o ./commons/timer.o ./commons/configurator/configfile.o ./commons/configurator/option.o ./commons/configurator/section.o ./commons/configurator/restriction.o +LOCAL_OBJS += ./support/klog-config.o ./support/klog-options.o ./support/config_defaults.o +LOCAL_OBJS += ./src/globals.o ./src/opt.o ./src/frame.o ./src/utils.o ./src/lock.o ./src/spec.o ./src/applications.o ./src/khomp_pvt_fxo.o ./src/khomp_pvt_gsm.o ./src/khomp_pvt_kxe1.o ./src/khomp_pvt_passive.o ./src/khomp_pvt.o ./src/logger.o ./src/cli.o + +conf_file_name := khomp.conf.xml +conf_file_dir := $(curr_dir)/Install/files +conf_file_dir_alt := $(curr_dir)/conf +conf_file_install = $(sysconfdir)/autoload_configs + +include $(BASE)/build/modmake.rules + +depend_install: + @echo "Copy $(conf_file_name)" + @if test -d $(conf_file_install) ; then \ + if test -f $(conf_file_dir)/$(conf_file_name) ; then \ + cp $(conf_file_dir)/$(conf_file_name) $(conf_file_install)/$(conf_file_name).new ;\ + else \ + cp $(conf_file_dir_alt)/$(conf_file_name) $(conf_file_install)/$(conf_file_name).new ;\ + fi; \ + if test ! -f "$(conf_file_install)/$(conf_file_name)" ; then \ + mv $(conf_file_install)/$(conf_file_name).new $(conf_file_install)/$(conf_file_name) ;\ + fi; \ + fi; diff --git a/src/mod/endpoints/mod_khomp/commons/atomic.hpp b/src/mod/endpoints/mod_khomp/commons/atomic.hpp new file mode 100644 index 0000000..daa598c --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/atomic.hpp @@ -0,0 +1,189 @@ +/* + KHOMP generic endpoint/channel library. + + This code was based on FreeBSD 7.X SVN (sys/i386/include/atomic.h), + with changes regarding optimizations and generalizations, and a + remake of the interface to fit use C++ features. + + Code is distributed under original license. + Original copyright follows: + + * Copyright (c) 1998 Doug Rabson + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + +*/ + +#ifndef _ATOMIC_HPP_ +#define _ATOMIC_HPP_ + +namespace Atomic +{ + // Macros used to insert compare and exchange instructions easily into functions. + + #define MAKE_CMPXCHG_FUNCTION(INS, PTR, EXP, VAL, TYPE) \ + PunnedType pexp; pexp.valtype = EXP; \ + PunnedType pval; pval.valtype = VAL; \ + TYPE vexp = *(pexp.podtype); \ + TYPE vval = *(pval.podtype); \ + TYPE res; \ + unsigned char chg = 0; \ + asm volatile("lock;" INS "sete %1;" \ + : "=a" (res), /* 0 */ \ + "=q" (chg), /* 1 */ \ + "=m" (*(unsigned char **)(PTR)) /* 2 */ \ + : "r" (vval), /* 3 */ \ + "a" (vexp), /* 4 */ \ + "m" (*(unsigned char **)(PTR)) /* 5 */ \ + : "memory"); \ + *(pexp.podtype) = res; \ + return (chg != 0 ? true : false); + + #define MAKE_CMPXCHG8B_FUNCTION(PTR,EXP,VAL) \ + PunnedType pexp; pexp.valtype = EXP; \ + PunnedType pval; pval.valtype = VAL; \ + unsigned long long vexp = *(pexp.podtype); \ + unsigned long long vval = *(pval.podtype); \ + unsigned long long res = (unsigned long long)exp; \ + unsigned char chg = 0; \ + asm volatile("lock; cmpxchg8b %2; sete %1;" \ + : "+A" (vexp), /* 0 (result) */ \ + "=q" (chg) /* 1 */ \ + : "m" (*(unsigned char**)(PTR)), /* 2 */ \ + "b" ((unsigned long)(vval)), \ + "c" ((unsigned long)(vval >> 32))); \ + *(pexp.podtype) = vexp; \ + return (chg != 0 ? true : false); + + // Types used for making CMPXCHG instructions independent from base type. + + template < typename ValType, typename PodType > + union PunnedTypeTemplate + { + ValType * valtype; + PodType * podtype; + }; + + template < int SizeOfType, typename ReturnType > + struct HelperCreateCAS; + + template < typename ValType > + struct HelperCreateCAS<4, ValType> + { + #if !defined(__LP64__) && !defined(__LP64) + typedef unsigned long BaseType; + #else + typedef unsigned int BaseType; + #endif + + typedef PunnedTypeTemplate< ValType, BaseType > PunnedType; + + inline static bool apply(volatile void *p, ValType * exp, ValType now) + { + #if !defined(__LP64__) && !defined(__LP64) + MAKE_CMPXCHG_FUNCTION("cmpxchgl %3,%5;", p, exp, &now, BaseType); + #else + MAKE_CMPXCHG_FUNCTION("cmpxchgl %k3,%5;", p, exp, &now, BaseType); + #endif + } + }; + + template < typename ValType > + struct HelperCreateCAS<8, ValType> + { + #if !defined(__LP64__) && !defined(__LP64) + typedef unsigned long long BaseType; + #else + typedef unsigned long BaseType; + #endif + + typedef PunnedTypeTemplate< ValType, BaseType > PunnedType; + + inline static volatile ValType apply(volatile void *p, ValType * exp, ValType now) + { + #if !defined(__LP64__) && !defined(__LP64) + MAKE_CMPXCHG8B_FUNCTION(p, exp, &now); + #else + MAKE_CMPXCHG_FUNCTION("cmpxchgq %3,%5;", p, exp, &now, BaseType); + #endif + } + + }; + + // The CAS function itself. + + template < typename ValType > + inline bool doCAS(volatile ValType * p, ValType * o, ValType n) + { + return HelperCreateCAS<sizeof(ValType), ValType>::apply(static_cast<volatile void *>(p), o, n); + }; + + template < typename ValType > + inline bool doCAS(volatile ValType * p, ValType o, ValType n) + { + return HelperCreateCAS<sizeof(ValType), ValType>::apply(static_cast<volatile void *>(p), &o, n); + }; + + #undef MAKE_CMPXCHG_32_FUNCTION + #undef MAKE_CMPXCHG_64_FUNCTION + + #define MAKE_LOCKED_TEMPLATE(NAME) \ + template < typename ValType > inline void do##NAME(volatile ValType * p, ValType v); \ + template < typename ValType > inline void do##NAME(volatile ValType * p); + + #define MAKE_LOCKED_FUNCTION(NAME, TYPE, INS, CONS, VAL) \ + template < > inline void do##NAME < TYPE > (volatile TYPE * p, TYPE v){ asm volatile("lock;" INS : "=m" (*p) : CONS (VAL), "m" (*p)); } \ + template < > inline void do##NAME < TYPE > (volatile TYPE * p) { asm volatile("lock;" INS : "=m" (*p) : CONS (1), "m" (*p)); } + + #define MAKE_LOCKED_FUNCTIONS(NAME, TYPE, INS, CONS, VAL) \ + MAKE_LOCKED_FUNCTION(NAME, TYPE, INS, CONS, VAL) \ + MAKE_LOCKED_FUNCTION(NAME, unsigned TYPE, INS, CONS, VAL) + + MAKE_LOCKED_TEMPLATE(Add); + MAKE_LOCKED_TEMPLATE(Sub); + MAKE_LOCKED_TEMPLATE(SetBits); + MAKE_LOCKED_TEMPLATE(ClearBits); + + MAKE_LOCKED_FUNCTIONS(Add, int, "addl %1,%0", "ir", v); + MAKE_LOCKED_FUNCTIONS(Sub, int, "subl %1,%0", "ir", v); + MAKE_LOCKED_FUNCTIONS(SetBits, int, "orl %1,%0", "ir", v); + MAKE_LOCKED_FUNCTIONS(ClearBits, int, "andl %1,%0", "ir", ~v); + + #if !defined(__LP64__) && !defined(__LP64) + + MAKE_LOCKED_FUNCTIONS(Add, long, "addl %1,%0", "ir", v); + MAKE_LOCKED_FUNCTIONS(Sub, long, "subl %1,%0", "ir", v); + MAKE_LOCKED_FUNCTIONS(SetBits, long, "orl %1,%0", "ir", v); + MAKE_LOCKED_FUNCTIONS(ClearBits, long, "andl %1,%0", "ir", ~v); + + #else + + MAKE_LOCKED_FUNCTIONS(Add, long, "addq %1,%0", "ir", v); + MAKE_LOCKED_FUNCTIONS(Sub, long, "subq %1,%0", "ir", v); + MAKE_LOCKED_FUNCTIONS(SetBits, long, "orq %1,%0", "ir", v); + MAKE_LOCKED_FUNCTIONS(ClearBits, long, "andq %1,%0", "ir", ~v); + + #endif +}; + +#endif /* _ATOMIC_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/config_commons.hpp b/src/mod/endpoints/mod_khomp/commons/config_commons.hpp new file mode 100644 index 0000000..de8f327 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/config_commons.hpp @@ -0,0 +1,69 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#ifndef _CONFIG_COMMONS_HPP_ +#define _CONFIG_COMMONS_HPP_ + +/****************************************************************************/ +/* ASTERISK */ +#if defined(COMMONS_LIBRARY_USING_ASTERISK) + #define COMMONS_IMPLEMENTATION asterisk +/****************************************************************************/ +/* CALLWEAVER */ +#elif defined(COMMONS_LIBRARY_USING_CALLWEAVER) + #define COMMONS_IMPLEMENTATION callweaver +/****************************************************************************/ +/* FREESWITCH */ +#elif defined(COMMONS_LIBRARY_USING_FREESWITCH) + #define COMMONS_IMPLEMENTATION freeswitch +/****************************************************************************/ +/* GNU/LINUX (generic) */ +#elif defined(COMMONS_LIBRARY_USING_GNU_LINUX) + #define COMMONS_IMPLEMENTATION gnulinux +/****************************************************************************/ +#else + #error Unknown implementation selected. Please define COMMONS_LIBRARY_USING_* correctly. +#endif + +#define COMMONS_INCLUDE(file) <COMMONS_IMPLEMENTATION/file> + +#endif /* _CONFIG_COMMONS_HPP_ */ + diff --git a/src/mod/endpoints/mod_khomp/commons/config_options.cpp b/src/mod/endpoints/mod_khomp/commons/config_options.cpp new file mode 100644 index 0000000..5383855 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/config_options.cpp @@ -0,0 +1,710 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <config_options.hpp> + +ConfigOption::ConfigOption(std::string name, const ConfigOption::StringType & value, const ConfigOption::StringType defvalue, string_allowed_type allowed, bool list_me) +: _my_name(name), _value_data(new StringData(const_cast<StringType &>(value), defvalue, allowed), true), + _list_me(list_me), _values(NULL), _loaded(false) +{}; + +ConfigOption::ConfigOption(std::string name, const ConfigOption::StringType & value, const ConfigOption::StringType defvalue, bool list_me) +: _my_name(name), _value_data(new StringData(const_cast<StringType &>(value), defvalue, string_allowed_type()), true), + _list_me(list_me), _values(NULL), _loaded(false) +{}; + +ConfigOption::ConfigOption(std::string name, const ConfigOption::SignedIntType & value, const ConfigOption::SignedIntType defvalue, + ConfigOption::SignedIntType min, ConfigOption::SignedIntType max, ConfigOption::SignedIntType step, bool list_me) +: _my_name(name), _value_data(new SignedIntData(const_cast<SignedIntType &>(value), defvalue, Range<SignedIntType>(min, max, step)), true), + _list_me(list_me), _values(NULL), _loaded(false) +{}; + +ConfigOption::ConfigOption(std::string name, const ConfigOption::UnsignedIntType & value, const ConfigOption::UnsignedIntType defvalue, + ConfigOption::UnsignedIntType min, ConfigOption::UnsignedIntType max, ConfigOption::UnsignedIntType step, bool list_me) +: _my_name(name), _value_data(new UnsignedIntData(const_cast<UnsignedIntType &>(value), defvalue, Range<UnsignedIntType>(min, max, step)), true), + _list_me(list_me), _values(NULL), _loaded(false) +{}; + +ConfigOption::ConfigOption(std::string name, const ConfigOption::BooleanType & value, const ConfigOption::BooleanType defvalue, bool list_me) +: _my_name(name), _value_data(new BooleanData(const_cast<BooleanType &>(value), defvalue), true), + _list_me(list_me), _values(NULL), _loaded(false) +{}; + +ConfigOption::ConfigOption(std::string name, ConfigOption::FunctionType fun, std::string defvalue, string_allowed_type allowed, bool list_me) +: _my_name(name), _value_data(new FunctionData(fun, defvalue, allowed), true), + _list_me(list_me), _values(NULL), _loaded(false) +{}; + +ConfigOption::ConfigOption(std::string name, ConfigOption::FunctionType fun, std::string defvalue, bool list_me) +: _my_name(name), _value_data(new FunctionData(fun, defvalue, string_allowed_type()), true), + _list_me(list_me), _values(NULL), _loaded(false) +{}; + +ConfigOption::ConfigOption(const ConfigOption & o) +: _my_name(o._my_name), _value_data(o._value_data), + _list_me(o._list_me), _values(o._values), _loaded(o._loaded) +{}; + +ConfigOption::~ConfigOption(void) +{ + if (_values) + { + for (unsigned int i = 0; _values[i] != NULL; i++) + delete _values[i]; + + delete[] _values; + _values = NULL; + } +}; + +void ConfigOption::set(ConfigOption::StringType value) +{ + switch (_value_data.which()) + { + case ID_STRING: + { + try + { + StringData & tmp = _value_data.get<StringData>(); + + if (tmp.string_allowed.empty()) + { + tmp.string_val = value; + _loaded = true; + } + else + { + if (tmp.string_allowed.find(value) != tmp.string_allowed.end()) + { + tmp.string_val = value; + _loaded = true; + return; + } + + std::string allowed_string; + + for (string_allowed_type::iterator i = tmp.string_allowed.begin(); i != tmp.string_allowed.end(); i++) + { + allowed_string += " '"; + allowed_string += (*i); + allowed_string += "'"; + } + + throw ConfigProcessFailure(STG(FMT("value '%s' not allowed for option '%s' (allowed values:%s)") + % value % _my_name % allowed_string)); + } + break; + } + catch(ValueType::InvalidType & e) + { + throw; + } + } + + case ID_FUN: + { + try + { + FunctionData & tmp = _value_data.get<FunctionData>(); + tmp.fun_val(value); + _loaded = true; + break; + } + catch(ValueType::InvalidType & e) + { + throw; + } + + } + + default: + { + throw ConfigProcessFailure(STG(FMT("option '%s' is not of type string, nor function defined") % _my_name)); + } + } +} + +void ConfigOption::set(ConfigOption::SignedIntType value) +{ + try + { + SignedIntData & tmp = _value_data.get<SignedIntData>(); + + if (value < tmp.sint_Range.minimum) + throw ConfigProcessFailure(STG(FMT("value '%d' out-of-Range for option '%s' (too low)") % value % _my_name)); + + if (value > tmp.sint_Range.maximum) + throw ConfigProcessFailure(STG(FMT("value '%d' out-of-Range for option '%s' (too high)") % value % _my_name)); + + if (((value - tmp.sint_Range.minimum) % tmp.sint_Range.step) != 0) + throw ConfigProcessFailure(STG(FMT("value '%d' out-of-Range for option '%s' (outside allowed step)") % value % _my_name)); + + tmp.sint_val = value; + _loaded = true; + } + catch(ValueType::InvalidType & e) + { + throw; + } +} + +void ConfigOption::set(ConfigOption::UnsignedIntType value) +{ + try + { + UnsignedIntData & tmp = _value_data.get<UnsignedIntData>(); + + if (value < tmp.uint_Range.minimum) + throw ConfigProcessFailure(STG(FMT("value '%d' out-of-Range for option '%s' (too low)") % value % _my_name)); + + if (value > tmp.uint_Range.maximum) + throw ConfigProcessFailure(STG(FMT("value '%d' out-of-Range for option '%s' (too high)") % value % _my_name)); + + if (((value - tmp.uint_Range.minimum) % tmp.uint_Range.step) != 0) + throw ConfigProcessFailure(STG(FMT("value '%d' out-of-Range for option '%s' (outside allowed step)") % value % _my_name)); + + tmp.uint_val = value; + _loaded = true; + } + catch(ValueType::InvalidType & e) + { + throw; + } +} + +void ConfigOption::set(ConfigOption::BooleanType value) +{ + try + { + BooleanData & tmp = _value_data.get<BooleanData>(); + tmp.bool_val = value; + _loaded = true; + } + catch(ValueType::InvalidType & e) + { + throw; + } +} + +std::string & ConfigOption::name(void) { return _my_name; }; + +ConfigOption::value_id_type ConfigOption::type(void) +{ + return (value_id_type) _value_data.which(); +}; + +const char ** ConfigOption::values(void) +{ + if (_values != NULL) + return _values; + + switch ((value_id_type) _value_data.which()) + { + case ConfigOption::ID_BOOL: + { + _values = new const char*[3]; + + _values[0] = strdup("yes"); + _values[1] = strdup("no"); + _values[2] = NULL; + + return _values; + } + + case ConfigOption::ID_SINT: + { + try + { + SignedIntData & tmp = _value_data.get<SignedIntData>(); + + + unsigned int count = ((tmp.sint_Range.maximum - tmp.sint_Range.minimum) / tmp.sint_Range.step) + 1; + unsigned int index = 0; + + _values = new const char*[count + 1]; + + for (SignedIntType i = tmp.sint_Range.minimum; i <= tmp.sint_Range.maximum; i += tmp.sint_Range.step, index++) + _values[index] = strdup(STG(FMT("%d") % i).c_str()); + + _values[index] = NULL; + + return _values; + } + catch(ValueType::InvalidType & e) + { + throw; + } + } + + case ConfigOption::ID_UINT: + { + try + { + UnsignedIntData & tmp = _value_data.get<UnsignedIntData>(); + + unsigned int count = ((tmp.uint_Range.maximum - tmp.uint_Range.minimum) / tmp.uint_Range.step) + 1; + unsigned int index = 0; + + _values = new const char*[count + 1]; + + for (UnsignedIntType i = tmp.uint_Range.minimum; i <= tmp.uint_Range.maximum; i += tmp.uint_Range.step, index++) + _values[index] = strdup(STG(FMT("%d") % i).c_str()); + + _values[index] = NULL; + + return _values; + } + catch(ValueType::InvalidType & e) + { + throw; + } + } + + case ConfigOption::ID_STRING: + { + try + { + StringData & tmp = _value_data.get<StringData>(); + + _values = new const char*[ tmp.string_allowed.size() + 1 ]; + + unsigned int index = 0; + + for (string_allowed_type::iterator i = tmp.string_allowed.begin(); i != tmp.string_allowed.end(); i++, index++) + _values[index] = strdup((*i).c_str()); + + _values[index] = NULL; + + return _values; + } + catch(ValueType::InvalidType & e) + { + throw; + } + } + + case ConfigOption::ID_FUN: + { + try + { + FunctionData & tmp = _value_data.get<FunctionData>(); + + _values = new const char*[ tmp.fun_allowed.size() + 1 ]; + + unsigned int index = 0; + + for (string_allowed_type::iterator i = tmp.fun_allowed.begin(); i != tmp.fun_allowed.end(); i++, index++) + _values[index] = strdup((*i).c_str()); + + _values[index] = NULL; + return _values; + } + catch(ValueType::InvalidType & e) + { + throw; + } + + } + + default: + throw ConfigProcessFailure(STG(FMT("unknown type identifier '%d'") % _value_data.which())); + } +}; + +void ConfigOption::reset(void) +{ + _loaded = false; +}; + +void ConfigOption::commit(void) +{ + if (_loaded) + return; + + switch ((value_id_type) _value_data.which()) + { + case ConfigOption::ID_BOOL: + { + try + { + BooleanData & tmp = _value_data.get<BooleanData>(); + tmp.bool_val = tmp.bool_default; + } + catch(ValueType::InvalidType & e) + { + throw; + } + + break; + } + + case ConfigOption::ID_SINT: + { + try + { + SignedIntData & tmp = _value_data.get<SignedIntData>(); + tmp.sint_val = tmp.sint_default; + } + catch(ValueType::InvalidType & e) + { + throw; + } + break; + } + + case ConfigOption::ID_UINT: + { + try + { + UnsignedIntData & tmp = _value_data.get<UnsignedIntData>(); + tmp.uint_val = tmp.uint_default; + } + catch(ValueType::InvalidType & e) + { + throw; + } + break; + } + + case ConfigOption::ID_STRING: + { + try + { + StringData & tmp = _value_data.get<StringData>(); + tmp.string_val = tmp.string_default; + } + catch(ValueType::InvalidType & e) + { + throw; + } + break; + } + + case ConfigOption::ID_FUN: + { + try + { + FunctionData & tmp = _value_data.get<FunctionData>(); + tmp.fun_val(tmp.fun_default); + } + catch(ValueType::InvalidType & e) + { + throw; + } + break; + } + + default: + throw ConfigProcessFailure(STG(FMT("unknown type identifier '%d'") % _value_data.which())); + } + + _loaded = true; +}; + +void ConfigOption::copy_from(ConfigOption & src) +{ + if (src._value_data.which() != _value_data.which()) + throw ConfigProcessFailure(STG(FMT("unable to copy options, source type differs from destination."))); + + if (!src._loaded) + return; + + switch ((value_id_type) _value_data.which()) + { + case ConfigOption::ID_BOOL: + { + try + { + BooleanData & stmp = src._value_data.get<BooleanData>(); + BooleanData & dtmp = _value_data.get<BooleanData>(); + /* do not copy references, but values.. */ + bool tmpval = stmp.bool_val; + dtmp.bool_val = tmpval; + } + catch(ValueType::InvalidType & e) + { + throw; + } + + break; + } + + case ConfigOption::ID_SINT: + { + try + { + SignedIntData & stmp = src._value_data.get<SignedIntData>(); + SignedIntData & dtmp = _value_data.get<SignedIntData>(); + /* do not copy references, but values.. */ + int tmpval = stmp.sint_val; + dtmp.sint_val = tmpval; + } + catch(ValueType::InvalidType & e) + { + throw; + } + + break; + } + + case ConfigOption::ID_UINT: + { + try + { + UnsignedIntData & stmp = src._value_data.get<UnsignedIntData>(); + UnsignedIntData & dtmp = _value_data.get<UnsignedIntData>(); + /* do not copy references, but values.. */ + unsigned int tmpval = stmp.uint_val; + dtmp.uint_val = tmpval; + } + catch(ValueType::InvalidType & e) + { + throw; + } + + + break; + } + + case ConfigOption::ID_STRING: + { + try + { + StringData & stmp = src._value_data.get<StringData>(); + StringData & dtmp = _value_data.get<StringData>(); + /* do not copy references, but values.. */ + std::string tmpval = stmp.string_val; + dtmp.string_val = tmpval; + } + catch(ValueType::InvalidType & e) + { + throw; + } + + break; + } + + case ConfigOption::ID_FUN: + { + /* TO IMPLEMENT (NEEDS ANOTHER METHOD ON FUNCTION FOR GETTING VALUE) */ + +// FunctionData & tmp = boost::get<FunctionData>(_value_data); +// +// if (!tmp.loaded) +// { +// tmp.fun_val(tmp.fun_default); +// tmp.loaded = true; +// } + break; + } + + default: + throw ConfigProcessFailure(STG(FMT("unknown type identifier '%d'") % _value_data.which())); + } + + _loaded = true; +}; + +/*********************************/ + +bool ConfigOptions::add(ConfigOption option) +{ + //option_map_type::iterator iter2 = _map.begin(); + + //boost::tie(iter2, ok2) + std::pair<option_map_type::iterator, bool> ret = _map.insert(option_pair_type(option.name(), option)); + + return ret.second; +} + +bool ConfigOptions::synonym(std::string equiv_opt, std::string main_opt) +{ + //syn_option_map_type::iterator iter = _syn_map.begin(); + + //boost::tie(iter, ok) + std::pair<syn_option_map_type::iterator, bool> ret = _syn_map.insert(syn_option_pair_type(equiv_opt, main_opt)); + + return ret.second; +} + +ConfigOptions::string_set ConfigOptions::options(void) +{ + string_set res; + + for (option_map_type::iterator i = _map.begin(); i != _map.end(); i++) + res.insert((*i).first); + + return res; +} + +void ConfigOptions::process(const char * name, const char * value) +{ + option_map_type::iterator iter = find_option(name); + + if (iter == _map.end()) + throw ConfigProcessFailure(STG(FMT("unknown option '%s'") % name)); + + try + { + switch ((*iter).second.type()) + { + case ConfigOption::ID_SINT: + set<ConfigOption::SignedIntType>((*iter).first, Strings::toulong(value)); + return; + case ConfigOption::ID_UINT: + set<ConfigOption::UnsignedIntType>((*iter).first, Strings::tolong(value)); + return; + case ConfigOption::ID_BOOL: + set<ConfigOption::BooleanType>((*iter).first, Strings::toboolean(value)); + return; + case ConfigOption::ID_STRING: + case ConfigOption::ID_FUN: + set<ConfigOption::StringType>((*iter).first, std::string(value)); + return; + default: + throw ConfigProcessFailure(STG(FMT("unknown type identifier '%d'") % (*iter).second.type())); + } + } + catch (Strings::invalid_value & e) + { + throw ConfigProcessFailure(STG(FMT("invalid value '%s' for option '%s'") % value % name)); + } +} + +const char ** ConfigOptions::values(const char * name) +{ + option_map_type::iterator iter = find_option(name); + + if (iter == _map.end()) + throw ConfigProcessFailure(STG(FMT("unknown option '%s'") % name)); + + return (*iter).second.values(); +} + +const char ** ConfigOptions::values(void) +{ + if (_values != NULL) + return _values; + + unsigned int count = 0; + + for (option_map_type::iterator i = _map.begin(); i != _map.end(); i++) + if ((*i).second.list_me()) + ++count; + + _values = new const char*[ count + 1 ]; + + unsigned int index = 0; + + for (option_map_type::iterator i = _map.begin(); i != _map.end(); i++) + { + if ((*i).second.list_me()) + { + _values[index] = strdup((*i).first.c_str()); + ++index; + } + } + + _values[index] = NULL; + + return _values; +} + +void ConfigOptions::reset(void) +{ + for (option_map_type::iterator i = _map.begin(); i != _map.end(); i++) + (*i).second.reset(); +} + +ConfigOptions::messages_type ConfigOptions::commit(void) +{ + messages_type msgs; + + for (option_map_type::iterator i = _map.begin(); i != _map.end(); i++) + { + try + { + (*i).second.commit(); + } + catch (ConfigProcessFailure & e) + { + msgs.push_back(e.msg); + } + } + + return msgs; +} + +bool ConfigOptions::loaded(std::string name) +{ + option_map_type::iterator iter = find_option(name); + + if (iter == _map.end()) + return false; + + return iter->second.loaded(); +} + +void ConfigOptions::copy_from(ConfigOptions & source, std::string name) +{ + option_map_type::iterator iter_src = source.find_option(name); + option_map_type::iterator iter_dst = find_option(name); + + if (iter_src == source._map.end()) + throw ConfigProcessFailure(STG(FMT("unknown option '%s' on source") % name)); + + if (iter_dst == _map.end()) + throw ConfigProcessFailure(STG(FMT("unknown option '%s' on destination") % name)); + + iter_dst->second.copy_from(iter_src->second); +} + +ConfigOptions::option_map_type::iterator ConfigOptions::find_option(std::string name) +{ + syn_option_map_type::iterator syn_iter = _syn_map.find(name); + + if (syn_iter != _syn_map.end()) + name = syn_iter->second; + + option_map_type::iterator iter = _map.find(name); + + return iter; +} diff --git a/src/mod/endpoints/mod_khomp/commons/config_options.hpp b/src/mod/endpoints/mod_khomp/commons/config_options.hpp new file mode 100644 index 0000000..3cfe2e1 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/config_options.hpp @@ -0,0 +1,286 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <set> +#include <map> +#include <vector> + +#include <strings.hpp> + +#include <function.hpp> +#include <variant.hpp> +#include <format.hpp> + +#ifndef _CONFIG_OPTIONS_HPP_ +#define _CONFIG_OPTIONS_HPP_ + +struct ConfigProcessFailure +{ + ConfigProcessFailure(std::string _msg): msg(_msg) {}; + std::string msg; +}; + +struct ConfigOption +{ + typedef int SignedIntType; + typedef unsigned int UnsignedIntType; + typedef bool BooleanType; + typedef std::string StringType; + + typedef Function::Function1 < void, std::string > FunctionType; + + typedef std::set < StringType > string_allowed_type; + + /* this should reflect 'variant.which()'! */ + typedef enum + { + ID_SINT = 0, + ID_UINT = 1, + ID_BOOL = 2, + ID_STRING = 3, + ID_FUN = 4, + } + value_id_type; + + template < typename number_type > + struct Range + { + Range(number_type _minimum, number_type _maximum, number_type _step) + : minimum(_minimum), maximum(_maximum), step(_step) {}; + + number_type minimum, maximum, step; + }; + + struct SignedIntData : public VariantBaseType < void > + { + SignedIntData(SignedIntType & _sint_val, SignedIntType _sint_default, Range< SignedIntType > _sint_Range) + : sint_val(_sint_val), sint_default(_sint_default), sint_Range(_sint_Range) {}; + + int which() + { + return ID_SINT; + } + + SignedIntType & sint_val; + SignedIntType sint_default; + Range<SignedIntType> sint_Range; + }; + + struct UnsignedIntData : public VariantBaseType < void > + { + UnsignedIntData(UnsignedIntType & _uint_val, UnsignedIntType _uint_default, Range< UnsignedIntType > _uint_Range) + : uint_val(_uint_val), uint_default(_uint_default), uint_Range(_uint_Range) {}; + + int which() + { + return ID_UINT; + } + + UnsignedIntType & uint_val; + UnsignedIntType uint_default; + Range<UnsignedIntType> uint_Range; + }; + + struct BooleanData : public VariantBaseType < void > + { + BooleanData(BooleanType & _bool_val, BooleanType _bool_default) + : bool_val(_bool_val), bool_default(_bool_default) {}; + + int which() + { + return ID_BOOL; + } + + BooleanType & bool_val; + BooleanType bool_default; + }; + + struct StringData : public VariantBaseType < void > + { + StringData(std::string & _string_val, std::string _string_default, string_allowed_type _string_allowed) + : string_val(_string_val), string_default(_string_default), string_allowed(_string_allowed) {}; + + int which() + { + return ID_STRING; + } + + std::string & string_val; + std::string string_default; + string_allowed_type string_allowed; + }; + + struct FunctionData : public VariantBaseType < void > + { + FunctionData(FunctionType _fun_val, std::string _fun_default, string_allowed_type _fun_allowed) + : fun_val(_fun_val), fun_default(_fun_default), fun_allowed(_fun_allowed) {}; + + int which() + { + return ID_FUN; + } + + FunctionType fun_val; + std::string fun_default; + string_allowed_type fun_allowed; + }; + + + typedef Variant < VariantBaseType < void > > ValueType; + + ConfigOption(std::string, const StringType &, const StringType, string_allowed_type allowed, bool list_me = true); + ConfigOption(std::string, const StringType &, const StringType = "", bool list_me = true); + ConfigOption(std::string, const SignedIntType &, const SignedIntType = 0, SignedIntType min = -INT_MAX, SignedIntType max = INT_MAX, SignedIntType step = 1, bool list_me = true); + ConfigOption(std::string, const UnsignedIntType &, const UnsignedIntType = 0, UnsignedIntType min = 0, UnsignedIntType max = UINT_MAX, UnsignedIntType step = 1, bool list_me = true); + ConfigOption(std::string, const BooleanType &, const BooleanType = false, bool list_me = true); + ConfigOption(std::string, FunctionType, std::string defvalue, string_allowed_type allowed, bool list_me = true); + ConfigOption(std::string, FunctionType, std::string defvalue = "", bool list_me = true); + + ConfigOption(const ConfigOption & o); + + ~ConfigOption(void); + + void set(StringType value); + + void set(SignedIntType value); + void set(UnsignedIntType value); + void set(BooleanType value); + + BooleanType get_bool(){ return _value_data.get<BooleanData>().bool_val; } + std::string get_str(){ return _value_data.get<StringData>().string_val; } + SignedIntType get_sint(){ return _value_data.get<SignedIntData>().sint_val; } + UnsignedIntType get_uint(){ return _value_data.get<UnsignedIntData>().uint_val; } + + std::string & name(void); + value_id_type type(void); + + const char ** values(void); + + void reset(void); + void commit(void); + + bool list_me(void) { return _list_me; }; + bool loaded(void) { return _loaded; }; + + void copy_from(ConfigOption &); + + protected: + std::string _my_name; + ValueType _value_data; + + bool _list_me; + const char ** _values; + bool _loaded; +}; + +struct ConfigOptions +{ + typedef std::vector < std::string > messages_type; + + ConfigOptions(void): _values(NULL) {}; + + typedef std::set < std::string > string_set; + + typedef std::map < std::string, ConfigOption > option_map_type; + typedef std::pair < std::string, ConfigOption > option_pair_type; + + typedef std::map < std::string, std::string > syn_option_map_type; + typedef std::pair < std::string, std::string > syn_option_pair_type; + + bool add(ConfigOption option); + + /* only valid in "process" (for backwards compatibility config files) */ + bool synonym(std::string, std::string); + + template <typename ValueType> + void set(std::string name, ValueType value) + { + option_map_type::iterator iter = _map.find(name); + + if (iter == _map.end()) + throw ConfigProcessFailure(STG(FMT("unknown option: %s") % name)); + + (*iter).second.set(value); + } + + std::string get(std::string name) + { + option_map_type::iterator iter = _map.find(name); + + if (iter == _map.end()) + throw ConfigProcessFailure(STG(FMT("unknown option: %s") % name)); + + switch((*iter).second.type()) + { + case ConfigOption::ID_BOOL: return (*iter).second.get_bool() ? "yes" : "no"; + case ConfigOption::ID_STRING: return (*iter).second.get_str(); + case ConfigOption::ID_UINT: return STG(FMT("%d") % (*iter).second.get_uint()); + case ConfigOption::ID_SINT: return STG(FMT("%d") % (*iter).second.get_sint()); + case ConfigOption::ID_FUN: return ""; + } + } + + string_set options(void); + + void process(const char *, const char *); /* process option from file */ + + void reset(void); /* reset loaded opts */ + messages_type commit(void); /* set defaults */ + + const char ** values(const char *); /* option value */ + const char ** values(void); /* values from options */ + + bool loaded(std::string); /* return if config was loaded */ + + void copy_from(ConfigOptions &, std::string); + + protected: + option_map_type::iterator find_option(std::string); + + protected: + option_map_type _map; + syn_option_map_type _syn_map; + + const char ** _values; +}; + +#endif /* _CONFIG_OPTIONS_HPP_ */ + diff --git a/src/mod/endpoints/mod_khomp/commons/configurator/configfile.cpp b/src/mod/endpoints/mod_khomp/commons/configurator/configfile.cpp new file mode 100644 index 0000000..6aa2e59 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/configurator/configfile.cpp @@ -0,0 +1,241 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ +#include <errno.h> + +#include <configurator/configfile.hpp> + +#if _MSC_VER >= 1400 +#undef close +#endif + +void Configfile::ignore(std::string str) +{ + _ignores.insert(str); +}; + +bool Configfile::select(Section **ptr, std::string str) +{ + /* default section == this! */ + *ptr = this; + + /* always success by default */ + return true; +}; + +bool Configfile::adjust(Section * section, std::string & opt, std::string & val) +{ + return section->load(opt, val); +}; + +bool Configfile::deserialize(std::ifstream& fd) +{ + Section * section = NULL; + + /* default selection! */ + if (!select(§ion)) + { + _errors.push_back("default selection has failed!"); + return false; + } + + size_t count = 0; + + while (fd.good()) + { + std::string str; + + /* read one line! */ + std::getline(fd, str); + + size_t lst = str.size() - 1; + + if (str.size() >= 1 && str[lst] == '\r') //cuida das quebras de linha do tipo \r\n + { + str.erase(lst,1); + --lst; + } + + /* empty line! */ + if (str.size() == 0) + continue; + + /* comment! */ + if (str[0] == '#') + continue; + + ++count; + + if (str[0] == '[' && str[lst] == ']') + { + str.erase(0,1); --lst; + str.erase(lst,1); --lst; + + if (!select(§ion, str)) + { + _errors.push_back(STG(FMT("erroneous section '%s'") % str)); + + /* ignore this section */ + section = NULL; + continue; + } + } + else + { + std::string::size_type pos = str.find('='); + + if (pos == std::string::npos) + { + _errors.push_back(STG(FMT("erroneous separator '%s'") % str)); + continue; + }; + + if (section == NULL) + { + _errors.push_back(STG(FMT("no section for option '%s'") % str)); + continue; + } + + std::string opt(str.substr(0,pos)); + std::string val(str.substr(pos+1)); + + if (_ignores.find(opt) != _ignores.end()) + continue; + + if (val == "@") val = ""; + + if (adjust(section, opt, val)) + continue; + + _errors.push_back(STG(FMT("option '%s' does " + "not exist or '%s' is not a valid value (at section '%s')") + % opt % val % section->name())); + } + } + + // retorna 'true' se arquivo tinha alguma coisa valida. + return (count != 0); +} + +bool Configfile::obtain() +{ + std::ifstream fd(_filename.c_str()); + + if (!fd.is_open()) + { + _errors.push_back(STG(FMT("unable to open file '%s': %s") + % _filename % strerror(errno))); + return false; + }; + + if (!deserialize(fd)) + { + fd.close(); + return false; + } + + fd.close(); + return true; +}; + +void Configfile::recurse(std::ofstream& fd, Section * section) +{ + typedef Section::SectionMap::iterator section_iter; + typedef Section::OptionMap::iterator option_iter; + + for (option_iter i = section->option_begin(); i != section->option_end(); i++) + { + std::string res; + + if ((*i).second.store(res)) + { + if (res == "") res = "@"; + fd << (*i).first << "=" << res << std::endl; + } + } + + if (!section->recursive()) + return; + + for (section_iter j = section->section_begin(); j != section->section_end(); j++) + recurse(fd, (*j).second); +} + +bool Configfile::serialize(std::ofstream& fd) +{ + recurse(fd, this); + return true; +} + +bool Configfile::provide() +{ + std::string tmp(_filename); + tmp += ".new"; + + std::ofstream fd(tmp.c_str()); + + if (!fd.good()) + { + _errors.push_back(STG(FMT("unable to open file '%s': %s") + % tmp % strerror(errno))); + return false; + } + + if (!serialize(fd)) + { + fd.close(); + return false; + } + + fd.close(); + + if (rename(tmp.c_str(), _filename.c_str()) != 0) + { + _errors.push_back(STG(FMT("unable to replace config file '%s': %s") + % _filename % strerror(errno))); + return false; + } + + return true; +} + +#if _MSC_VER >= 1400 +#define close _close +#endif \ No newline at end of file diff --git a/src/mod/endpoints/mod_khomp/commons/configurator/configfile.hpp b/src/mod/endpoints/mod_khomp/commons/configurator/configfile.hpp new file mode 100644 index 0000000..61f4246 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/configurator/configfile.hpp @@ -0,0 +1,90 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <vector> +#include <fstream> +#include <sstream> +#include <set> + +#include <format.hpp> + +#include <configurator/section.hpp> + +#ifndef _CONFIG_CONFIGFILE_HPP_ +#define _CONFIG_CONFIGFILE_HPP_ + +struct Configfile: public Section +{ + typedef std::list < std::string > ErrorVector; + typedef std::set < std::string > NameSet; + + Configfile(std::string name, std::string desc) + : Section(name, desc), _good(false) {}; + + virtual ~Configfile() {}; + + bool good() { return _good; }; + std::string & filename() { return _filename; }; + + ErrorVector & errors() { return _errors; }; + + void ignore(std::string); + + virtual bool obtain(); + virtual bool provide(); + + protected: + virtual bool select(Section **, std::string str = ""); + virtual bool adjust(Section *, std::string & opt, std::string & val); + + virtual bool deserialize(std::ifstream &); + virtual bool serialize(std::ofstream &); + + void recurse(std::ofstream &, Section *); + + protected: + bool _good; + ErrorVector _errors; + NameSet _ignores; + std::string _filename; +}; + +#endif /* _CONFIG_CONFIGFILE_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/configurator/option.cpp b/src/mod/endpoints/mod_khomp/commons/configurator/option.cpp new file mode 100644 index 0000000..083883e --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/configurator/option.cpp @@ -0,0 +1,185 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <configurator/option.hpp> + +bool Option::equals(std::string & value) +{ + switch (_restriction.numeral()) + { + case Restriction::N_UNIQUE: + { + Restriction::Value my_value; + + if (!_restriction.get(Restriction::F_USER, my_value)) + return false; + + return (my_value == value); + } + case Restriction::N_MULTIPLE: + { + Restriction::Vector my_values; + + if (!_restriction.get(Restriction::F_USER, my_values)) + return false; + + for (Restriction::Vector::iterator i = my_values.begin(); i != my_values.end(); i++) + { + if ((*i) == value) + return true; + } + + return false; + } + } + + return false; +} + +bool Option::load(std::string & value) +{ + bool ret = _restriction.set(Restriction::F_FILE, value); + + if (ret) _modified = false; + + return ret; +} + +bool Option::change(std::string & value) +{ + bool ret = _restriction.set(Restriction::F_FILE, value); + + if (ret) _modified = true; + + return ret; +} + +bool Option::store(std::string & value) +{ + switch (_restriction.numeral()) + { + case Restriction::N_UNIQUE: + return _restriction.get(Restriction::F_FILE, value); + + case Restriction::N_MULTIPLE: + { + Restriction::Vector values; + + if (!_restriction.get(Restriction::F_FILE, values)) + return false; + + Strings::Merger strs; + + for (Restriction::Vector::iterator i = values.begin(); i != values.end(); i++) + strs.add(*i); + + value = strs.merge(","); + + return true; + } + + default: + return false; + } +} + +Option::Flags Option::set(const char * value) +{ + std::string str_value(value); + return set(str_value); +} + + +Option::Flags Option::set(Restriction::Value & value) +{ + Restriction::Value last_value, curr_value; + Flags flags; + + bool ret1 = _restriction.get(Restriction::F_USER, last_value); + + if (!_restriction.set(Restriction::F_USER, value)) + return flags; + + flags[F_ADJUSTED] = true; + + bool ret2 = _restriction.get(Restriction::F_USER, curr_value); + + if (!ret1 || (ret2 && (last_value != curr_value))) + { + flags[F_MODIFIED] = true; + _modified = true; + } + + return flags; +} + +Option::Flags Option::set(Restriction::Vector & values) +{ + Restriction::Vector last_values, curr_values; + Flags flags; + + bool ret1 = _restriction.get(Restriction::F_USER, last_values); + + if (!_restriction.set(Restriction::F_USER, values)) + return flags; + + flags[F_ADJUSTED] = true; + + bool ret2 = _restriction.get(Restriction::F_USER, curr_values); + + if (!ret1 || (ret2 && (last_values != curr_values))) + { + flags[F_MODIFIED] = true; + _modified = true; + } + + return flags; +} + +bool Option::get(Restriction::Value & value) +{ + return _restriction.get(Restriction::F_USER, value); +} + +bool Option::get(Restriction::Vector & values) +{ + return _restriction.get(Restriction::F_USER, values); +} diff --git a/src/mod/endpoints/mod_khomp/commons/configurator/option.hpp b/src/mod/endpoints/mod_khomp/commons/configurator/option.hpp new file mode 100644 index 0000000..8aa103a --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/configurator/option.hpp @@ -0,0 +1,122 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <iostream> + +#include <string> +#include <list> +#include <vector> + +#include <strings.hpp> + +#include <configurator/restriction.hpp> + +#ifndef _CONFIG_OPTION_HPP_ +#define _CONFIG_OPTION_HPP_ + +struct Option +{ + enum FlagTypes + { + F_MODIFIED = 0x0, /* if option was modified */ + F_ADJUSTED = 0x1, /* if option was correctly formated */ + }; + + struct Flags: public std::vector<bool> + { + Flags(): std::vector<bool>(2) {}; + }; + + typedef Restriction::Value Value; + typedef Restriction::Vector Vector; + + /* exception */ + struct InvalidDefaultValue + { + InvalidDefaultValue(std::string name, std::string value) + : _name(name), _value(value) {}; + + std::string & name() { return _name; }; + std::string & value() { return _value; }; + + protected: + std::string _name; + std::string _value; + }; + + Option(std::string name, std::string desc, std::string defvalue, Restriction restriction) + : _name(name), _desc(desc), _restriction(restriction), _modified(true) + { + std::string value(defvalue); + + if (!(set(value)[F_ADJUSTED])) + throw InvalidDefaultValue(name, defvalue); + } + + const std::string & name() { return _name; }; + const std::string & description() { return _desc; }; + + Restriction & restriction() { return _restriction; }; + bool modified() { return _modified; }; + + public: + bool load(std::string &); + bool change(std::string &); + bool store(std::string &); + + Flags set(const char *); + Flags set(Value &); + Flags set(Vector &); + + bool get(Value &); + bool get(Vector &); + + bool equals(std::string &); + + protected: + std::string _name; + std::string _desc; + + Restriction _restriction; + bool _modified; +}; + +#endif /* _CONFIG_OPTION_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/configurator/restriction.cpp b/src/mod/endpoints/mod_khomp/commons/configurator/restriction.cpp new file mode 100644 index 0000000..9653a7c --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/configurator/restriction.cpp @@ -0,0 +1,353 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <math.h> +#include <string.h> + +#include <iostream> +#include <strings.hpp> + +#include <configurator/restriction.hpp> + +/* internal helper! */ +bool Restriction::equalNumber(const double a, const double b) +{ + char tmp1[64]; + char tmp2[64]; + + snprintf(tmp1, sizeof(tmp1), "%.3f", a); + snprintf(tmp2, sizeof(tmp2), "%.3f", b); + + if (strncmp(tmp1, tmp2, sizeof(tmp1))) + return false; + + return true; +} + +/* process value to our internal representation */ + +bool Restriction::process(Restriction::Format fmt, + const Restriction::Value & value, Restriction::Value & final) +{ + switch (_bounds) + { + case B_RANGE: + { + if (_kind != K_NUMBER) + return false; + + std::string tmpvalue; + + Restriction::Value::const_iterator itr = value.begin(); + Restriction::Value::const_iterator end = value.end(); + + tmpvalue.reserve(value.size()); + + // f*cking dot/comma notation! + for (; itr != end; ++itr) + tmpvalue += ((*itr) != ',' ? (*itr) : '.'); + + try + { + double newvalue = Strings::todouble(tmpvalue); + + if (newvalue < _init && newvalue > _fini) + return false; + + double res = (newvalue - _init) / _step; + + if (!equalNumber(res, rint(res))) + return false; + + final = value; + return true; + } + catch (...) + { + return false; + } + } + + case B_LIST: + for (List::iterator i = _list.begin(); i != _list.end(); i++) + { + Value & tmp = (*i); + + if (tmp == value) + { + final = value; + return true; + } + } + return false; + + case B_MAPS: + switch (fmt) + { + case F_USER: + { + Map::iterator i = _map_from_usr.find(std::string(value)); + + if (i == _map_from_usr.end()) + return false; + + Value & tmp = (*i).second; + + final = tmp; + return true; + } + + case F_FILE: + { + Map::iterator i = _map_from_cfg.find(std::string(value)); + + if (i == _map_from_cfg.end()) + return false; + + final = value; + return true; + } + + default: + break; + } + return false; + + case B_FREE: + final = value; + return true; + + default: + break; + } + + return false; +} + +/* unprocess the value (outputs the external representation) */ + +bool Restriction::unprocess(Restriction::Format fmt, + const Restriction::Value & value, Restriction::Value & final) +{ + switch (_bounds) + { + case B_MAPS: + + switch (fmt) + { + case F_USER: + { + Map::iterator i = _map_from_cfg.find(std::string(value)); + + if (i == _map_from_cfg.end()) + return false; + + final = (*i).second; + return true; + } + default: + break; + } + + default: + final = value; + return true; + } +} + +/***************************** *****************************/ + +bool Restriction::get(Restriction::Format fmt, Restriction::Value & value) +{ + if (_numeral != N_UNIQUE) + return false; + + if (!unprocess(fmt, _value._unique, value)) + return false; + + return true; +} + +bool Restriction::get(Restriction::Format fmt, Restriction::Vector & values) +{ + if (_numeral != N_MULTIPLE) + return false; + + List & my_values = _value._multiple; + + for (List::iterator i = my_values.begin(); i != my_values.end(); i++) + { + Value & value = (*i); + Value final; + + if (!unprocess(fmt, value, final)) + return false; + + values.push_back(final); + }; + + return true; +} + +/***************************** *****************************/ + +bool Restriction::set(Restriction::Format fmt, Restriction::Value &value) +{ + switch (_numeral) + { + case N_UNIQUE: + { + Value final; + + if (!process(fmt, value, final)) + return false; + + _value._unique = final; + return true; + } + + case N_MULTIPLE: + { + if (value == "@" || value == "#" || value == "") + { + _value._multiple.clear(); + return true; + } + + Strings::vector_type values; + Strings::tokenize(value, values, ","); + + return set(fmt, values); + } + + default: + return false; + } +} + +bool Restriction::set(Restriction::Format fmt, Restriction::Vector & values) +{ + if (_numeral != N_MULTIPLE) + return false; + + if (values.empty()) + { + _value._multiple.clear(); + } + else + { + /* list needed to store temporary values */ + List finals; + + for (Vector::iterator i = values.begin(); i != values.end(); i++) + { + Value & value = (*i); + Value final; + + if (!process(fmt, value, final)) + return false; + + finals.push_back(final); + } + + List & lst = _value._multiple; + + /* need to clear values set before */ + lst.clear(); + + for (List::iterator i = finals.begin(); i != finals.end(); i++) + { + Value value = (*i); + lst.push_back(value); + } + }; + + return true; +} + +/***************************** *****************************/ + +void Restriction::allowed(Restriction::Vector &vals) +{ + switch (_bounds) + { + case B_FREE: + return; + + case B_LIST: + for (List::iterator i = _list.begin(); i != _list.end(); i++) + vals.push_back((*i)); + break; + + case B_MAPS: + for (Map::iterator i = _map_from_usr.begin(); i != _map_from_usr.end(); i++) + vals.push_back((*i).first); + break; + + case B_RANGE: + { + if (_kind != K_NUMBER) + return; + + // is there any fraction? + bool has_fraction = (!equalNumber(_init, rint(_init))) || (!equalNumber(_fini, rint(_fini))) || (!equalNumber(_step, rint(_step))); + + const char * format = (has_fraction ? "%.2f" : "%02.0f"); + + for (double i = _init; i <= _fini; i += _step) + { + char tmp[32]; + snprintf(tmp, sizeof(tmp), format, i); + vals.push_back(std::string(tmp)); + } + break; + } + + default: + break; + } +} + +void Restriction::init_class() +{ + _value._unique.clear(); + _value._multiple.clear(); +} diff --git a/src/mod/endpoints/mod_khomp/commons/configurator/restriction.hpp b/src/mod/endpoints/mod_khomp/commons/configurator/restriction.hpp new file mode 100644 index 0000000..0815ede --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/configurator/restriction.hpp @@ -0,0 +1,321 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <stdarg.h> + +#include <string> +#include <list> +#include <vector> +#include <map> + +#ifndef _CONFIG_RESTRICTION_HPP_ +#define _CONFIG_RESTRICTION_HPP_ + +struct Restriction +{ + /* generic types */ + enum Format + { + F_USER, + F_FILE + }; + + enum Kind + { +// K_INTEGER, +// K_FLOAT, + K_STRING, + K_NUMBER // = K_INTEGER // compatibility + }; + + enum Bounds + { + B_FREE, + B_RANGE, + B_LIST, + B_MAPS + }; + + enum Numeral + { + N_UNIQUE, + N_MULTIPLE + }; + + typedef std::string Value; + + /* types used for data input */ + struct Pair + { + const char *pretty; + const char *value; + }; + + typedef std::pair < Value, Value > PairMap; + typedef std::list < PairMap > ListMap; + + /* types used internally */ + typedef std::map < Value, Value > Map; + typedef std::vector < Value > Vector; + + typedef std::list < Value > List; + typedef std::pair < Value, Value > MapPair; + + struct Generic + { + Value _unique; + List _multiple; + }; + + Restriction(Kind kind, Numeral num) + : _kind(kind), _bounds(B_FREE), _numeral(num), _unit(""), + _init(-1), _fini(-1), _step(-1) + { + init_class(); + } + +/* + Restriction(Kind kind, Numeral num, + int init, int fini, int step = 1) + : _kind(kind), _bounds(B_RANGE), _numeral(num), _unit(unit), + _iinit(init), _ifini(fini), _istep(step), + _finit(-1), _ffini(-1), _fstep(-1) + { + init_class(); + } + + Restriction(Kind kind, Numeral num, + const char *unit, int init, int fini, int step = 1) + : _kind(kind), _bounds(B_RANGE), _numeral(num), _unit(unit), + _iinit(init), _ifini(fini), _istep(step), + _finit(-1), _ffini(-1), _fstep(-1) + { + init_class(); + } + + Restriction(Kind kind, Numeral num, + std::string unit, int init, int fini, int step = 1) + : _kind(kind), _bounds(B_RANGE), _numeral(num), _unit(unit), + _iinit(init), _ifini(fini), _istep(step), + _finit(-1), _ffini(-1), _fstep(-1) + { + init_class(); + } + + Restriction(Kind kind, Numeral num, + float init, float fini, float step = 1) + : _kind(kind), _bounds(B_RANGE), _numeral(num), _unit(unit), + _iinit(-1), _ifini(-1), _istep(-1) + _finit(init), _ffini(fini), _fstep(step), + { + init_class(); + } + + Restriction(Kind kind, Numeral num, + const char *unit, float init, float fini, float step = 1.0) + : _kind(kind), _bounds(B_RANGE), _numeral(num), _unit(unit), + _iinit(-1), _ifini(-1), _istep(-1) + _finit(init), _ffini(fini), _fstep(step), + { + init_class(); + } + + Restriction(Kind kind, Numeral num, + std::string unit, float init, float fini, float step = 1.0) + : _kind(kind), _bounds(B_RANGE), _numeral(num), _unit(unit), + _iinit(-1), _ifini(-1), _istep(-1) + _finit(init), _ffini(fini), _fstep(step), + { + init_class(); + } +*/ + + Restriction(Kind kind, Numeral num, + double init, double fini, double step = 1) + : _kind(kind), _bounds(B_RANGE), _numeral(num), _unit(""), + _init(init), _fini(fini), _step(step) + { + init_class(); + } + + Restriction(Kind kind, Numeral num, + const char *unit, double init, double fini, double step = 1.0) + : _kind(kind), _bounds(B_RANGE), _numeral(num), _unit(unit), + _init(init), _fini(fini), _step(step) + { + init_class(); + } + + Restriction(Kind kind, Numeral num, + std::string unit, double init, double fini, double step = 1.0) + : _kind(kind), _bounds(B_RANGE), _numeral(num), _unit(unit), + _init(init), _fini(fini), _step(step) + { + init_class(); + } + + Restriction(Kind kind, Numeral num, + const char *first, ...) + : _kind(kind), _bounds(B_LIST), _numeral(num), _unit(""), + _init(-1), _fini(-1), _step(-1) + { + _list.push_back(std::string(first)); + + va_list ap; + va_start(ap, first); + + while (true) + { + const char *arg = va_arg(ap, const char *); + + if (arg == NULL) break; + + _list.push_back(std::string(arg)); + } + + init_class(); + } + + Restriction(Kind kind, const char *unit, Numeral num, + const char *first, ...) + : _kind(kind), _bounds(B_LIST), _numeral(num), _unit(unit), + _init(-1), _fini(-1), _step(-1) + { + _list.push_back(std::string(first)); + + va_list ap; + va_start(ap, first); + + while (true) + { + const char *arg = va_arg(ap, const char *); + + if (arg == NULL) break; + + _list.push_back(std::string(arg)); + } + + init_class(); + } + + Restriction(Kind kind, Numeral num, + const struct Pair first, ...) + : _kind(kind), _bounds(B_MAPS), _numeral(num), _unit(""), + _init(-1), _fini(-1), _step(-1) + { + _map_from_usr.insert(MapPair(Value(first.pretty), Value(first.value))); + _map_from_cfg.insert(MapPair(Value(first.value), Value(first.pretty))); + + va_list ap; + va_start(ap, first); + + while (true) + { + Pair arg = va_arg(ap, Pair); + + if (arg.pretty == NULL) break; + + _map_from_usr.insert(MapPair(Value(arg.pretty), Value(arg.value))); + _map_from_cfg.insert(MapPair(Value(arg.value), Value(arg.pretty))); + } + + init_class(); + } + + Restriction(Kind kind, Numeral num, List list) + : _kind(kind), _bounds(B_LIST), _numeral(num), _unit(""), + _init(-1), _fini(-1), _step(-1), _list(list) + { + init_class(); + } + + Restriction(Kind kind, Numeral num, ListMap map) + : _kind(kind), _bounds(B_MAPS), _numeral(num), _unit(""), + _init(-1), _fini(-1), _step(-1) + { + for (ListMap::iterator i = map.begin(); i != map.end(); i++) + { + _map_from_usr.insert(MapPair(Value((*i).first), Value((*i).second))); + _map_from_cfg.insert(MapPair(Value((*i).second), Value((*i).first))); + } + + init_class(); + } + + Kind kind() { return _kind; }; + Bounds bounds() { return _bounds; }; + Numeral numeral() { return _numeral; }; + + Value unit() { return _unit; }; + + bool set(Format, Vector &); + bool set(Format, Value &); + + bool get(Format, Vector &); + bool get(Format, Value &); + + void allowed(Vector &); + + private: + bool process(Format, const Value &, Value &); + bool unprocess(Format, const Value &, Value &); + void init_class(); + + bool equalNumber(const double, const double); + + protected: + Kind _kind; + Bounds _bounds; + Numeral _numeral; + + Value _unit; + + double _init, _fini, _step; + + Map _map_from_usr, + _map_from_cfg; + + List _list; + + Generic _value; +}; + +#endif /* _CONFIG_RESTRICTION_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/configurator/section.cpp b/src/mod/endpoints/mod_khomp/commons/configurator/section.cpp new file mode 100644 index 0000000..5d26858 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/configurator/section.cpp @@ -0,0 +1,130 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <configurator/section.hpp> + +void Section::options(Section::OptionVector & vec) +{ + for (OptionMap::iterator it = _options.begin(); it != _options.end();) + { + vec.push_back(&((*it).second)); + ++it; + } +} + +void Section::sections(Section::SectionVector & vec) +{ + for (SectionMap::iterator it = _sections.begin(); it != _sections.end();) + { + vec.push_back((*it).second); + ++it; + } +} + +/*********/ + +Option * Section::option_find(std::string & str, bool recurse) +{ + OptionMap::iterator i = _options.find(str); + + if (i == _options.end()) + { + if (!recurse) + throw not_found(); + + for (SectionMap::iterator i = _sections.begin(); i != _sections.end(); i++) + { + try + { + return i->second->option_find(str, recurse); + } + catch (not_found & e) + { + /* keep looping! */ + }; + } + + throw not_found(); + } + + return &((*i).second); +} + +Option * Section::option_find(const char * str, bool recurse) +{ + std::string sstr(str); + return option_find(sstr, recurse); +} + +/*********/ + +Section * Section::section_find(std::string & str, bool recurse) +{ + SectionMap::iterator i = _sections.find(str); + + if (i == _sections.end()) + { + if (!recurse) + throw not_found(); + + for (SectionMap::iterator i = _sections.begin(); i != _sections.end(); i++) + { + try + { + return i->second->section_find(str, recurse); + } + catch (not_found & e) + { + /* keep looping! */ + }; + } + + throw not_found(); + } + + return ((*i).second); +} + +Section * Section::section_find(const char * str, bool recurse) +{ + std::string sstr(str); + return section_find(sstr, recurse); +} diff --git a/src/mod/endpoints/mod_khomp/commons/configurator/section.hpp b/src/mod/endpoints/mod_khomp/commons/configurator/section.hpp new file mode 100644 index 0000000..fdb7823 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/configurator/section.hpp @@ -0,0 +1,226 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <string> +#include <vector> +#include <map> +#include <algorithm> +#include <iostream> + +#include <configurator/option.hpp> + +#ifndef _CONFIG_SECTION_HPP_ +#define _CONFIG_SECTION_HPP_ + +struct Section +{ + typedef std::map < std::string, Option > OptionMap; + typedef std::vector< Option * > OptionVector; + + typedef std::map < std::string, Section * > SectionMap; + typedef std::vector < Section * > SectionVector; + + struct not_found {}; /* exception */ + +// protected: + Section(std::string name, std::string desc, bool recursive = true) + : _name(name), _description(desc), _recursive(recursive) {}; + + void add(Option o) + { + _options.insert(std::pair<std::string,Option>(o.name(), o)); + }; + + void del(std::string name) + { + _options.erase(name); + }; + + void add(Section *s) + { + _sections.insert(std::pair<std::string,Section*>(s->name(), s)); + }; + + public: + const std::string & name() { return _name; }; + const std::string & description() { return _description; }; + const bool & recursive() { return _recursive; }; + + OptionMap::iterator option_begin() { return _options.begin(); }; + OptionMap::iterator option_end() { return _options.end(); }; + + SectionMap::iterator section_begin() { return _sections.begin(); }; + SectionMap::iterator section_end() { return _sections.end(); }; + + /**/ + + Option * option_find(const char *, bool recurse = false); + Section * section_find(const char *, bool recurse = false); + + Option * option_find(std::string &, bool recurse = false); + Section * section_find(std::string &, bool recurse = false); + + /**/ + + void options(OptionVector &); + void sections(SectionVector &); + + /**/ + + template <typename F> + bool search_and_apply(std::string &key, std::string &value, F f) + { + OptionMap::iterator i = _options.find(key); + + if (i != _options.end()) + return f((*i).second); + + if (!_recursive) + return false; + + return (find_if(_sections.begin(), _sections.end(), f) != _sections.end()); + } + + private: + struct key_value + { + key_value(std::string &k, std::string &v): _k(k), _v(v) {}; + std::string & _k, & _v; + }; + + struct load_section: protected key_value + { + load_section(std::string &k, std::string &v): key_value(k,v) {}; + + bool operator()(Option &o) { return o.load(_v); }; + bool operator()(SectionMap::value_type &v) { return v.second->load(_k,_v); }; + }; + + struct change_section: protected key_value + { + change_section(std::string &k, std::string &v): key_value(k,v) {}; + + bool operator()(Option &o) { return o.change(_v); }; + bool operator()(SectionMap::value_type &v) { return v.second->change(_k,_v); }; + }; + + struct store_section: protected key_value + { + store_section(std::string &k, std::string &v): key_value(k,v) {}; + + bool operator()(Option &o) { return o.store(_v); }; + bool operator()(SectionMap::value_type &v) { return v.second->store(_k,_v); }; + }; + + struct set_section: protected key_value + { + set_section(std::string &k, std::string &v): key_value(k,v) {}; + + bool operator()(Option &o) { return (o.set(_v))[Option::F_ADJUSTED]; }; + bool operator()(SectionMap::value_type &v) { return v.second->set(_k,_v); }; + }; + + struct get_section: protected key_value + { + get_section(std::string &k, std::string &v): key_value(k,v) {}; + + bool operator()(Option &o) { return o.get(_v); }; + bool operator()(SectionMap::value_type &v) { return v.second->get(_k,_v); }; + }; + + struct modified_section + { + bool operator()(OptionMap::value_type &v) { return v.second.modified(); }; + bool operator()(SectionMap::value_type &v) { return v.second->modified(); }; + }; + + public: + bool load(const char * key, std::string value) + { + std::string skey(key); + return search_and_apply(skey, value, load_section(skey, value)); + } + + bool load(std::string &key, std::string &value) + { + return search_and_apply(key, value, load_section(key, value)); + } + + bool change(std::string &key, std::string &value) + { + return search_and_apply(key, value, change_section(key, value)); + } + + bool store(std::string &key, std::string &value) + { + return search_and_apply(key, value, store_section(key, value)); + } + + bool set(std::string &key, std::string &value) + { + return search_and_apply(key, value, set_section(key, value)); + } + + bool get(std::string &key, std::string &value) + { + return search_and_apply(key, value, get_section(key, value)); + } + + bool modified() + { + return ((find_if(_options.begin(), _options.end(), modified_section()) != _options.end()) || + (find_if(_sections.begin(), _sections.end(), modified_section()) != _sections.end())); + } + + private: + Section() {}; + + protected: + std::string _name; + std::string _description; + + OptionMap _options; + SectionMap _sections; + + bool _recursive; +}; + +#endif /* _CONFIG_SECTION_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/flagger.hpp b/src/mod/endpoints/mod_khomp/commons/flagger.hpp new file mode 100644 index 0000000..49a4add --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/flagger.hpp @@ -0,0 +1,102 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <map> + +#include <initializer.hpp> + +#ifndef _FLAGGER_HPP_ +#define _FLAGGER_HPP_ + +template < typename Flag > +struct Flagger +{ + protected: + struct Bool + { + Bool(): value(false) {}; + Bool(bool &v): value(v) {}; + + bool value; + }; + + typedef std::map< Flag, Bool > Map; + + public: + typedef Initializer< Flag > InitFlags; + + Flagger() {}; + + Flagger(InitFlags flags) + { + for (typename InitFlags::iterator i = flags.begin(); i != flags.end(); i++) + { + Flag & flag = (*i); + _map[flag].value = true; + }; + }; + + void set(Flag elt, bool value = true) + { + _map[elt].value = value; + } + + bool is_set(Flag elt) + { + return _map[elt].value; + } + + Flagger & operator&(Flag elt) + { + set(elt); + return *this; + }; + + bool operator[](Flag elt) + { + return is_set(elt); + }; + + protected: + Map _map; +}; + +#endif /* _FLAGGER_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/format.cpp b/src/mod/endpoints/mod_khomp/commons/format.cpp new file mode 100644 index 0000000..20f7920 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/format.cpp @@ -0,0 +1,331 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include "format.hpp" +//#include <iostream> + +Format::Format(const char * format_string, bool raise_exception) +: _format(format_string), _valid(true), _raise(raise_exception) +{ + initialize(format_string); +} + +/* +Format::Format(std::string & format_string, bool raise_exception) +: _format(NULL), _valid(true), _raise(raise_exception) +{ + initialize(format_string.c_str()); +} +*/ + +Format::Format(std::string format_string, bool raise_exception) +: _format(format_string), _valid(true), _raise(raise_exception) +{ + initialize(format_string.c_str()); +} + +void Format::initialize(const char * format_string) +{ + std::string txt; + + const char * ptr = format_string; + + while (*ptr != '\0') + { + if (*ptr != '%') + { + txt += *ptr; + ++ptr; + continue; + } + + const char * ptr2 = ptr+1; + + if (*ptr2 == '%') + { + txt += *ptr; + + ptr += 2; + continue; + } + + if (!txt.empty()) + push_argument(txt, T_LITERAL); + + std::string arg(1, *ptr); + + ++ptr; + + bool finished = false; + + short long_count = 0; + short short_count = 0; + + while(*ptr != '\0' && !finished) + { + switch (*ptr) + { + case ' ': + // uncomplete format with ' ', make it a literal. + arg += *ptr; + push_argument(arg, T_LITERAL); + finished = true; + break; + + case '%': + // uncomplete format with '%', make it a literal and start a new format. + push_argument(arg, T_LITERAL); + arg += *ptr; + break; + + case 'h': + short_count = std::min<short>(short_count+1, 2); + long_count = 0; + arg += *ptr; + break; + + case 'l': + long_count = std::min<short>(long_count+1, 2); + short_count = 0; + arg += *ptr; + break; + + case 'd': + case 'i': + arg += *ptr; + switch (long_count - short_count) + { + case 2: + push_argument(arg, T_SIGNED_LONG_LONG); + break; + case 1: + push_argument(arg, T_SIGNED_LONG); + break; + case 0: + push_argument(arg, T_SIGNED_INT); + break; + case -1: + push_argument(arg, T_SIGNED_SHORT); + break; + case -2: + push_argument(arg, T_SIGNED_SHORT_SHORT); + break; + default: + break; + } + finished = true; + break; + + case 'o': + case 'u': + case 'x': + case 'X': + arg += *ptr; + switch (long_count - short_count) + { + case 2: + push_argument(arg, T_UNSIGNED_LONG_LONG); + break; + case 1: + push_argument(arg, T_UNSIGNED_LONG); + break; + case 0: + push_argument(arg, T_UNSIGNED_INT); + break; + case -1: + push_argument(arg, T_UNSIGNED_SHORT); + break; + case -2: + push_argument(arg, T_UNSIGNED_SHORT_SHORT); + break; + default: + break; + } + finished = true; + break; + + case 'e': + case 'E': + case 'f': + case 'F': + case 'g': + case 'G': + case 'a': + case 'A': + arg += *ptr; + push_argument(arg, T_FLOAT); + finished = true; + break; + + case 'c': + arg += *ptr; + push_argument(arg, T_CHAR); + finished = true; + break; + + case 's': + arg += *ptr; + push_argument(arg, T_STRING); + finished = true; + break; + + case 'p': + arg += *ptr; + push_argument(arg, T_POINTER); + finished = true; + break; + + case 'C': + case 'S': + case 'm': + case 'n': // unsupported for now. + arg += *ptr; + push_argument(arg, T_ANYTHING); + finished = true; + break; + + default: + arg += *ptr; + break; + } + + ++ptr; + } + + if (!arg.empty()) + push_argument(arg, T_LITERAL); + } + + if (!txt.empty()) + push_argument(txt, T_LITERAL); +} + +void Format::mark_invalid(std::string & msg) +{ + if (_valid) + { + _valid = false; + + std::string finalmsg; + + finalmsg += "** INVALID FORMAT: "; + finalmsg += msg; + finalmsg += " **"; + + _result = finalmsg; + } +} + +void Format::raise_check(void) +{ + if (!_valid && _raise) + throw InvalidFormat(_result); +} + +bool Format::validity_check(void) +{ + raise_check(); + + return _valid; +} + +const Format::Argument * Format::next_argument(void) +{ +// std::cerr << "size: " << _args.size() << std::endl; + + while (true) + { +// std::cerr << "loop size: " << _args.size() << std::endl; + + if (_args.empty()) + return NULL; // throw NoArgumentLeft(); + + const Argument & top = _args.front(); + + if (top.type() == T_LITERAL) + { +// std::cerr << "top type == LITERAL, looping..." << std::endl; + _result += top.fmts(); + pop_argument(); + } + else + { +// std::cerr << "top type: " << top.type() << std::endl; + return ⊤ + } + } +} + +void Format::pop_argument(void) +{ + _args.pop(); +} + +void Format::push_argument(std::string & data, Format::Type type) +{ +// std::cerr << "pushing type (" << type << ") with format (" << data << ")" << std::endl; + + _args.push(Argument(data, type)); + data.clear(); +} + +std::string Format::str() +{ + if (!validity_check()) + return _result; + + if (next_argument() == NULL) + return _result; + + std::string msg; + + msg += "too few arguments passed for format '"; + msg += _format; + msg += "' ("; + msg += _format; + msg += ")"; + + mark_invalid(msg); + + return _result; +} + + diff --git a/src/mod/endpoints/mod_khomp/commons/format.hpp b/src/mod/endpoints/mod_khomp/commons/format.hpp new file mode 100644 index 0000000..b1ebe74 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/format.hpp @@ -0,0 +1,512 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#ifndef _FORMAT_H_ +#define _FORMAT_H_ + +#include <cstring> +#include <cstdlib> +#include <typeinfo> +#include <stdexcept> +#include <string> +#include <queue> +#include <iostream> +#include <stdio.h> + +#ifdef WIN32 // WINDOWS +#include <KHostSystem.h> +#endif + + +/* macros used for shortening lines and making the code clearer */ +#define STG(x) (x).str() +#define FMT(x) Format(x) + +struct Format +{ + static const unsigned int strings_base_length = 64; + static const unsigned int generic_base_length = 64; + + struct InvalidFormat + { + InvalidFormat(std::string msg) : _msg(msg) {} + + std::string _msg; + }; + + explicit Format(const char * format_string, bool raise_exception = false); + explicit Format(std::string format_string, bool raise_exception = false); + + void initialize(const char *); + + std::string str(void); + + //////////////////////////////////////////////////////////// + + protected: + + enum Type + { + T_ANYTHING = 1, + + T_SIGNED_SHORT, + T_SIGNED_SHORT_SHORT, + T_SIGNED_INT, + T_SIGNED_LONG, + T_SIGNED_LONG_LONG, + + T_UNSIGNED_SHORT, + T_UNSIGNED_SHORT_SHORT, + T_UNSIGNED_INT, + T_UNSIGNED_LONG, + T_UNSIGNED_LONG_LONG, + + T_FLOAT, + T_CHAR, + + T_POINTER, + T_STRING, + + T_LITERAL + }; + + struct Argument + { + Argument(std::string fmts, Type type) + : _fmts(fmts), _type(type) {}; + + Type type(void) const { return _type; } + const std::string & fmts(void) const { return _fmts; } + + protected: + std::string _fmts; + Type _type; + }; + + typedef std::queue < Argument > ArgumentQueue; + + //////////////////////////////////////////////////////////// + + public: + + template < typename V > + Format & operator%( V value ) + { + if (!validity_check()) + return *this; + + const Argument * top = next_argument(); + + if (top == NULL) + { + std::string msg; + + msg += "too many arguments passed for format '"; + msg += _format; + msg += "'"; + + mark_invalid(msg); + } + else + { + char temp[generic_base_length]; + + if (!generic_verify(value, top->type())) + { + std::string msg; + + msg += "type mismatch: got type '"; + msg += typeid(value).name(); + msg += "' in format '"; + msg += top->fmts(); + msg += "' ("; + msg += _format; + msg += ")"; + + mark_invalid(msg); + return *this; + } + + snprintf(temp, sizeof(temp), top->fmts().c_str(), value); + _result += temp; + + pop_argument(); + } + + raise_check(); + return *this; + } + + template < typename V > + Format & operator%( V * value ) + { + if (!validity_check()) + return *this; + + const Argument * top = next_argument(); + + if (top == NULL) + { + std::string msg; + + msg += "too many arguments passed for format '"; + msg += _format; + msg += "'"; + + mark_invalid(msg); + } + else + { + switch (top->type()) + { + case T_POINTER: + { + char temp[generic_base_length]; + snprintf(temp, sizeof(temp), top->fmts().c_str(), value); + _result += temp; + break; + } + + case T_STRING: + { + if ((typeid(const char) == typeid(V)) || + (typeid(char) == typeid(V)) || + (typeid(const unsigned char) == typeid(V)) || + (typeid(unsigned char) == typeid(V)) || + (typeid(const void) == typeid(V)) || + (typeid(void) == typeid(V))) + { + int len = strlen((const char*)value)+strings_base_length+1; + + char * temp = new char[len]; + + snprintf(temp, len, top->fmts().c_str(), value); + _result += temp; + + delete[] temp; + } + else + { + std::string msg; + + msg += "type mismatch: got type '"; + msg += typeid(value).name(); + msg += "' in string format ("; + msg += _format; + msg += ")"; + + mark_invalid(msg); + } + break; + } + + default: + { + std::string msg; + + msg += "type mismatch: got pointer/string type in format '"; + msg += top->fmts(); + msg += "' ("; + msg += _format; + msg += ")"; + + mark_invalid(msg); + break; + } + } + + pop_argument(); + } + + raise_check(); + return *this; + } + +/* + Format & operator%( std::string value ) + { + return operator%(value); + } +*/ + + Format & operator%( const std::string value ) + { + if (!validity_check()) + return *this; + + const Argument * top = next_argument(); + + if (top == NULL) + { + std::string msg; + + msg += "too many arguments passed for format '"; + msg += _format; + msg += "'"; + + mark_invalid(msg); + } + else + { + if (top->type() == T_STRING) + { + int len = value.length()+strings_base_length+1; + + char * temp = new char[len]; + + snprintf(temp, len, top->fmts().c_str(), value.c_str()); + _result += temp; + + delete[] temp; + } + else + { + std::string msg; + + msg += "type mismatch: got string type in format '"; + msg += top->fmts(); + msg += "' ("; + msg += _format; + msg += ")"; + + mark_invalid(msg); + } + + pop_argument(); + } + + raise_check(); + return *this; + } + + protected: + + template < typename V > + bool number_verify_signed_short( V value ) + { + return + ((typeid(V) == typeid(short int) || + typeid(V) == typeid(short) || + typeid(V) == typeid(const short int) || + typeid(V) == typeid(const short) || + typeid(V) == typeid(volatile short int) || + typeid(V) == typeid(volatile short)) && + sizeof(V) == sizeof(short)); + } + + template < typename V > + bool number_verify_unsigned_short( V value ) + { + return + ((typeid(V) == typeid(unsigned short int) || + typeid(V) == typeid(unsigned short) || + typeid(V) == typeid(const unsigned short int) || + typeid(V) == typeid(const unsigned short) || + typeid(V) == typeid(volatile unsigned short int) || + typeid(V) == typeid(volatile unsigned short)) && + sizeof(V) == sizeof(unsigned short)); + } + + template < typename V > + bool number_verify_signed_long( V value ) + { + return + ((typeid(V) == typeid(long int) || + typeid(V) == typeid(long) || + typeid(V) == typeid(const long int) || + typeid(V) == typeid(const long) || + typeid(V) == typeid(volatile long int) || + typeid(V) == typeid(volatile long)) && + sizeof(V) == sizeof(long)); + } + + template < typename V > + bool number_verify_unsigned_long( V value ) + { + return + ((typeid(V) == typeid(unsigned long int) || + typeid(V) == typeid(unsigned long) || + typeid(V) == typeid(const unsigned long int) || + typeid(V) == typeid(const unsigned long) || + typeid(V) == typeid(volatile unsigned long int) || + typeid(V) == typeid(volatile unsigned long)) && + sizeof(V) == sizeof(long long)); + } + + template < typename V > + bool number_verify_signed_long_long( V value ) + { + return + ((typeid(V) == typeid(long long int) || + typeid(V) == typeid(long long) || + typeid(V) == typeid(const long long int) || + typeid(V) == typeid(const long long) || + typeid(V) == typeid(volatile long long) || + typeid(V) == typeid(volatile long long int)) && + sizeof(V) == sizeof(long long)); + } + + template < typename V > + bool number_verify_unsigned_long_long( V value ) + { + return + ((typeid(V) == typeid(unsigned long long int) || + typeid(V) == typeid(unsigned long long) || + typeid(V) == typeid(const unsigned long long int) || + typeid(V) == typeid(const unsigned long long) || + typeid(V) == typeid(volatile unsigned long long) || + typeid(V) == typeid(volatile unsigned long long int)) && + sizeof(V) == sizeof(unsigned long long)); + } + + template < typename V > + bool number_verify_signed_int( V value ) + { + return + (sizeof(V) <= sizeof(int) || + typeid(V) == typeid(int) || + typeid(V) == typeid(const int) || + typeid(V) == typeid(volatile int)); + } + + template < typename V > + bool number_verify_unsigned_int( V value ) + { + return + (sizeof(V) <= sizeof(unsigned int) || + typeid(V) == typeid(unsigned int) || + typeid(V) == typeid(const unsigned int) || + typeid(V) == typeid(volatile unsigned int)); + } + + template < typename V > + bool generic_verify( V value, Type type ) + { + switch (type) + { + /* EXCEPTION: consider any number an valid input. */ + case T_SIGNED_INT: + case T_UNSIGNED_INT: + return + (number_verify_signed_int(value) || + number_verify_unsigned_int(value) || + number_verify_signed_long(value) || + number_verify_unsigned_long(value) || + number_verify_signed_short(value) || + number_verify_unsigned_short(value)); + + case T_SIGNED_SHORT_SHORT: + return (typeid(V) == typeid(char) || typeid(V) == typeid(const char)); + + case T_SIGNED_SHORT: + return number_verify_signed_short(value); + + case T_SIGNED_LONG: + return number_verify_signed_long(value); + + case T_SIGNED_LONG_LONG: + return number_verify_signed_long_long(value); + + case T_UNSIGNED_SHORT_SHORT: + return (typeid(V) == typeid(unsigned char) || typeid(V) == typeid(unsigned char)); + + case T_UNSIGNED_SHORT: + return number_verify_unsigned_short(value); + + case T_UNSIGNED_LONG: + return number_verify_unsigned_long(value); + + case T_UNSIGNED_LONG_LONG: + return number_verify_unsigned_long_long(value); + + case T_FLOAT: + return (typeid(V) == typeid(float)) || (typeid(V) == typeid(double) || + typeid(V) == typeid(const float)) || (typeid(V) == typeid(const double)); + + case T_CHAR: + return (typeid(V) == typeid(char)) || (typeid(V) == typeid(unsigned char) || + typeid(V) == typeid(const char)) || (typeid(V) == typeid(const unsigned char)); + + case T_POINTER: + case T_STRING: + return false; + + case T_ANYTHING: + return true; + + case T_LITERAL: + return false; + } + + return false; + }; + + void mark_invalid(std::string &); + + bool validity_check(void); + void raise_check(void); + +/* + struct NoArgumentLeft + { + NoArgumentLeft(): empty(0) {}; + + unsigned int empty; + }; +*/ + + const Argument * next_argument(void); + + void pop_argument(void); + void push_argument(std::string & data, Type type); + + private: + std::string _format; + + bool _valid; + bool _raise; + + std::string _result; + ArgumentQueue _args; +}; + +#endif /* _FORMAT_H_ */ + diff --git a/src/mod/endpoints/mod_khomp/commons/freeswitch/saved_condition.cpp b/src/mod/endpoints/mod_khomp/commons/freeswitch/saved_condition.cpp new file mode 100644 index 0000000..29169f3 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/freeswitch/saved_condition.cpp @@ -0,0 +1,62 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include "saved_condition.hpp" + +bool SavedCondition::wait(unsigned int msec) +{ + bool ret = true; + + switch_mutex_lock(_mutex); + + if (!_signaled) + { + /* msec * 1000 = The amount of time in microseconds to wait. */ + if (switch_thread_cond_timedwait(_condition, _mutex, (switch_interval_time_t)msec * 1000) != 0) + ret = false; + } + + _signaled = false; + + switch_mutex_unlock(_mutex); + + return ret; +} diff --git a/src/mod/endpoints/mod_khomp/commons/freeswitch/saved_condition.hpp b/src/mod/endpoints/mod_khomp/commons/freeswitch/saved_condition.hpp new file mode 100644 index 0000000..8acf0f3 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/freeswitch/saved_condition.hpp @@ -0,0 +1,136 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#ifndef _SAVED_CONDITION_ +#define _SAVED_CONDITION_ + +#include <saved_condition.hpp> + +extern "C" +{ + #include <switch.h> +} + +struct SavedCondition : public SavedConditionCommon// : public RefCounter < SavedCondition > +{ + typedef switch_thread_cond_t BaseConditionType; + typedef switch_mutex_t BaseMutexType; + + SavedCondition(switch_memory_pool_t *pool=NULL): + _pool(pool), + _can_delete_pool(false) + { + if(!_pool) + { + switch_core_new_memory_pool(&_pool); + _can_delete_pool = true; + } + + switch_thread_cond_create(&_condition, _pool); + switch_mutex_init(&_mutex, SWITCH_MUTEX_DEFAULT, _pool); + } + + //SavedCondition(const SavedCondition &); + ~SavedCondition() + { + switch_thread_cond_destroy(_condition); + switch_mutex_destroy(_mutex); + + if(_can_delete_pool) + switch_core_destroy_memory_pool(&_pool); + } + + void signal(void) + { + switch_mutex_lock(_mutex); + + _signaled = true; + switch_thread_cond_signal(_condition); + + switch_mutex_unlock(_mutex); + } + + void broadcast(void) + { + switch_mutex_lock(_mutex); + + _signaled = true; + switch_thread_cond_broadcast(_condition); + + switch_mutex_unlock(_mutex); + } + + void wait(void) + { + switch_mutex_lock(_mutex); + + if (!_signaled) + switch_thread_cond_wait(_condition, _mutex); + + _signaled = false; + + switch_mutex_unlock(_mutex); + } + + bool wait(unsigned int); + + void reset(void) + { + switch_mutex_lock(_mutex); + + _signaled = false; + + switch_mutex_unlock(_mutex); + } + + BaseMutexType * mutex() { return _mutex; }; + BaseConditionType * condition() { return _condition; }; + + protected: + + BaseConditionType *_condition; + BaseMutexType *_mutex; + switch_memory_pool_t *_pool; + bool _can_delete_pool; +}; + +#endif /* _SAVED_CONDITION_ */ + diff --git a/src/mod/endpoints/mod_khomp/commons/freeswitch/simple_lock.hpp b/src/mod/endpoints/mod_khomp/commons/freeswitch/simple_lock.hpp new file mode 100644 index 0000000..530d912 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/freeswitch/simple_lock.hpp @@ -0,0 +1,177 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#ifndef _SIMPLE_LOCK_HPP_ +#define _SIMPLE_LOCK_HPP_ + +#include <simple_lock.hpp> + +extern "C" +{ + #include <switch.h> +} + +template < typename Implementor > +struct SimpleLockBasic: public SimpleLockCommon < Implementor > +{ + typedef SimpleLockCommon < Implementor > Super; + typedef typename Super::Result Result; + + typedef switch_mutex_t BaseMutexType; + + SimpleLockBasic(switch_memory_pool_t *pool = NULL) + : _pool(pool), _can_delete_pool( (_pool == NULL) ) + + { + if(!_pool) + switch_core_new_memory_pool(&_pool); + + //switch_mutex_init(&_mutex, SWITCH_MUTEX_DEFAULT, _pool); + switch_mutex_init(&_mutex, SWITCH_MUTEX_NESTED, _pool); + } + + virtual ~SimpleLockBasic() + { + /* do nothing */ + }; + + void unreference() + { + switch_mutex_destroy(_mutex); + + if (_can_delete_pool) + switch_core_destroy_memory_pool(&_pool); + } + + Result trylock() + { + switch (switch_mutex_trylock(_mutex)) + { + case SWITCH_STATUS_SUCCESS: + return Super::SUCCESS; + case SWITCH_STATUS_FALSE: + case SWITCH_STATUS_TERM: + case SWITCH_STATUS_NOTIMPL: + case SWITCH_STATUS_MEMERR: + case SWITCH_STATUS_GENERR: + case SWITCH_STATUS_SOCKERR: + case SWITCH_STATUS_NOTFOUND: + case SWITCH_STATUS_UNLOAD: + case SWITCH_STATUS_NOUNLOAD: + case SWITCH_STATUS_NOT_INITALIZED: + return Super::FAILURE; + //case SWITCH_STATUS_INUSE: + default: + return Super::ISINUSE; + } + } + + void unlock() + { + switch_mutex_unlock(_mutex); + } + + BaseMutexType * mutex() { return _mutex; }; + + protected: + BaseMutexType *_mutex; + switch_memory_pool_t *_pool; + bool _can_delete_pool; +}; + +struct SimpleLock: public SimpleLockBasic < SimpleLock > +{ + typedef SimpleLockBasic < SimpleLock > Super; + typedef Super::Result Result; + + SimpleLock(switch_memory_pool_t *pool = NULL) + : Super(pool) {}; + + Result lock() + { + switch (switch_mutex_lock(_mutex)) + { + case SWITCH_STATUS_SUCCESS: + return Super::SUCCESS; + case SWITCH_STATUS_FALSE: + case SWITCH_STATUS_TERM: + case SWITCH_STATUS_NOTIMPL: + case SWITCH_STATUS_MEMERR: + case SWITCH_STATUS_GENERR: + case SWITCH_STATUS_SOCKERR: + case SWITCH_STATUS_NOTFOUND: + case SWITCH_STATUS_UNLOAD: + case SWITCH_STATUS_NOUNLOAD: + case SWITCH_STATUS_NOT_INITALIZED: + return Super::FAILURE; + //case SWITCH_STATUS_INUSE: + default: + return Super::ISINUSE; + } + } +}; + +template < unsigned int Retries = 10, unsigned int Interval = 50 > +struct SimpleNonBlockLock: public SimpleLockBasic < SimpleNonBlockLock < Retries, Interval > > +{ + typedef SimpleLockBasic < SimpleNonBlockLock < Retries, Interval > > Super; + typedef typename Super::Result Result; + + SimpleNonBlockLock(switch_memory_pool_t *pool = NULL) + : Super(pool) {}; + + inline Result lock() + { + for (unsigned int i = 0; i < Retries; i++) + { + Result ret = Super::trylock(); + + if (ret != Super::ISINUSE) + return ret; + + usleep(Interval * 1000); + } + + return Super::ISINUSE; + } +}; + +#endif /* _SIMPLE_LOCK_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/freeswitch/thread.hpp b/src/mod/endpoints/mod_khomp/commons/freeswitch/thread.hpp new file mode 100644 index 0000000..af50240 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/freeswitch/thread.hpp @@ -0,0 +1,327 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#ifndef _THREAD_HPP_ +#define _THREAD_HPP_ + +#include <thread.hpp> + +extern "C" +{ + #include <switch.h> +} + +struct Thread : ThreadCommon +{ + typedef switch_thread_t BaseThreadType; + + template<typename T, typename R, typename A> + struct ThreadData : ThreadDataCommon + { + ThreadData(T data, A arg) : _data(data), _arg(arg) {} + + int run() + { + return _data(_arg); + } + + T _data; + A _arg; + }; + + template<typename T, typename R> + struct ThreadData < T, R, void > : ThreadDataCommon + { + ThreadData(T data) : _data(data) {} + + int run() + { + return _data(); + } + + T _data; + }; + + template<typename T, typename A> + struct ThreadData < T, void, A > : ThreadDataCommon + { + ThreadData(T data, A arg) : _data(data), _arg(arg) {} + + int run() + { + _data(_arg); + return 0; + } + + T _data; + A _arg; + }; + + + template<typename T> + struct ThreadData < T, void, void > : ThreadDataCommon + { + ThreadData(T data) : _data(data) {} + + int run() + { + _data(); + return 0; + } + + T _data; + }; + + template<typename T> + Thread(T obj, switch_memory_pool_t *pool=NULL) : + _thread_info(new ThreadData<T, typename DecomposeFunction<T>::Return, void>(obj)), + _pool(pool), + _can_delete_pool(false) + { + if(!_pool) + { + switch_core_new_memory_pool(&_pool); + _can_delete_pool = true; + } + + _thread_info->_thread = this; + _thread_info->_self = NULL; + _thread_info->_attribute = NULL; + + if(switch_threadattr_create( + (switch_threadattr_t **)&_thread_info->_attribute, _pool) != 0) + { + _thread_info->_attribute = NULL; + return; + } + + switch_threadattr_stacksize_set( + (switch_threadattr_t *)_thread_info->_attribute, + SWITCH_THREAD_STACKSIZE); + + if(!priority()) + { + _thread_info->_attribute = NULL; + } + + } + + template<typename T, typename A> + Thread(T obj, A arg, switch_memory_pool_t *pool=NULL) : + _thread_info(new ThreadData<T, typename DecomposeFunction<T>::Return, A>(obj, arg)), + _pool(pool), + _can_delete_pool(false) + { + if(!_pool) + { + switch_core_new_memory_pool(&_pool); + _can_delete_pool = true; + } + + _thread_info->_thread = this; + _thread_info->_self = NULL; + _thread_info->_attribute = NULL; + + if(switch_threadattr_create( + (switch_threadattr_t **)&_thread_info->_attribute, _pool) != 0) + { + _thread_info->_attribute = NULL; + return; + } + + switch_threadattr_stacksize_set( + (switch_threadattr_t *)_thread_info->_attribute, + SWITCH_THREAD_STACKSIZE); + + if(!priority()) + { + _thread_info->_attribute = NULL; + } + + } + + ~Thread() + { + if(_thread_info) + delete _thread_info; + + if (_can_delete_pool) + switch_core_destroy_memory_pool(&_pool); + } + + void detach(bool d = true) + { + if(!_thread_info->_attribute) + return; + + /* Non-zero if detached threads should be created. */ + switch_threadattr_detach_set( + (switch_threadattr_t *)_thread_info->_attribute, d ? 1 : 0); + } + + bool start() + { + if(!_pool || !_thread_info->_attribute) + return false; + + switch_thread_create((switch_thread_t**)&_thread_info->_self, + (switch_threadattr_t *)_thread_info->_attribute, + run, + _thread_info, + _pool); + + if(!_thread_info->_self) + return false; + + return true; + } + + int join() + { + /* + * block until the desired thread stops executing. + * @param retval The return value from the dead thread. + * @param thd The thread to join + * + * SWITCH_DECLARE(switch_status_t) switch_thread_join(switch_status_t *retval, switch_thread_t *thd); + */ + + if(!_thread_info->_self) + return -2; + + int retval = 0; + + if(switch_thread_join((switch_status_t*)&retval, + (switch_thread_t *)_thread_info->_self) != 0) + return -1; + + return retval; + } + + BaseThreadType * self() + { + //switch_thread_self(); + //apr_os_thread_current(); + return (BaseThreadType *)_thread_info->_self; + } + +private: + void exit(int status) + { + /** + * stop the current thread + * @param thd The thread to stop + * @param retval The return value to pass back to any thread that cares + */ + //SWITCH_DECLARE(switch_status_t) switch_thread_exit(switch_thread_t *thd, switch_status_t retval); + switch_thread_exit((switch_thread_t *)_thread_info->_self, (switch_status_t)status); + + } + +#ifndef WIN32 + struct apr_threadattr_t { + apr_pool_t *pool; + pthread_attr_t attr; + }; +#endif + + bool priority() + { +#ifndef WIN32 + struct sched_param param; + + struct apr_threadattr_t *myattr = (struct apr_threadattr_t *)_thread_info->_attribute; + + if (pthread_attr_setschedpolicy( + (pthread_attr_t *)&myattr->attr, SCHED_RR) < 0) + return false; + + if (pthread_attr_getschedparam( + (pthread_attr_t *)&myattr->attr, ¶m) < 0) + return false; + + param.sched_priority = sched_get_priority_max(SCHED_RR); + + if (pthread_attr_setschedparam( + (pthread_attr_t *)&myattr->attr, ¶m) < 0) + return false; + +#endif + return true; + +/* + //BUG in Freeswitch + if(switch_threadattr_priority_increase( + (switch_threadattr_t *)_thread_info->_attribute) != 0) + return false; + + return true; +*/ + } + + +protected: + ThreadDataCommon * _thread_info; + switch_memory_pool_t *_pool; + bool _can_delete_pool; + +protected: + + static void *SWITCH_THREAD_FUNC run(BaseThreadType *thread, void * obj) + { + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + // "Starting new Thread\n"); + + ThreadDataCommon * data = (ThreadDataCommon *)obj; + int retval = data->run(); + + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + // "Stopping new Thread = %d\n", retval); + + ((Thread *)(data->_thread))->exit(retval); + + return NULL; + } + +}; + + +#endif /* _THREAD_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/function.hpp b/src/mod/endpoints/mod_khomp/commons/function.hpp new file mode 100644 index 0000000..c448299 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/function.hpp @@ -0,0 +1,337 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the "LGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <refcounter.hpp> + +#ifndef _FUNCTION_HPP_ +#define _FUNCTION_HPP_ + +namespace Function +{ + struct EmptyFunction {}; + + /**/ + + template < typename FunctionTraits > + struct StorageBase: NEW_REFCOUNTER(StorageBase < FunctionTraits >) + { + typedef typename FunctionTraits::BaseType BaseType; + + typedef typename FunctionTraits::FunType FunType; + typedef typename FunctionTraits::ObjType ObjType; + + template < typename Functor > + StorageBase(Functor f) + : _object(reinterpret_cast<ObjType>(new Functor(f))), + _function(reinterpret_cast<FunType>(&(Functor::operator()))), + _malloced(true) + {}; + + template < typename Functor > + StorageBase(Functor & f, bool malloced) + : _object(reinterpret_cast<ObjType>((malloced ? new Functor(f) : &f))), + _function(reinterpret_cast<FunType>(&(Functor::operator()))), + _malloced(malloced) + {}; + + StorageBase() + : _object(reinterpret_cast<ObjType>(0)), + _function(reinterpret_cast<FunType>(0)), + _malloced(false) + {}; + + StorageBase(const StorageBase & o) + : INC_REFCOUNTER(o, StorageBase < FunctionTraits >), + _object(o._object), _function(o._function), _malloced(o._malloced) + {}; + + virtual ~StorageBase() {}; + + void unreference() + { + // TODO: will this work if we delete a different type? // + if (_malloced) + delete _object; + }; + + template < typename Functor > + void operator=(Functor f) + { + _object = reinterpret_cast<ObjType>(new Functor(f)), + _function = reinterpret_cast<FunType>(&(Functor::operator())); + _malloced = false; + } + + protected: + ObjType _object; + FunType _function; + bool _malloced; + }; + + /**/ + + template < typename R > + struct VTable0 + { + R operator()(void) { return R(); }; + }; + + template < > + struct VTable0< void > + { + void operator()(void) { return; }; + }; + + template < typename R > + struct Function0Traits + { + typedef VTable0<R> BaseType; + + typedef R (BaseType::* FunType)(void); + typedef BaseType * ObjType; + }; + + /**/ + + template < typename R, typename A0 > + struct VTable1 + { + R operator()(A0 a0) { return R(); }; + }; + + template < typename A0 > + struct VTable1< void, A0 > + { + void operator()(A0 a0) { return; }; + }; + + template < typename R, typename A0 > + struct Function1Traits + { + typedef VTable1<R, A0> BaseType; + + typedef R (BaseType::* FunType)(A0); + typedef BaseType * ObjType; + }; + + /**/ + + template < typename R, typename A0, typename A1 > + struct VTable2 + { + R operator()(A0 a0, A1) { return R(); }; + }; + + template < typename A0, typename A1 > + struct VTable2< void, A0, A1 > + { + void operator()(A0 a0, A1 a1) { return; }; + }; + + template < typename R, typename A0, typename A1 > + struct Function2Traits + { + typedef VTable2<R, A0, A1> BaseType; + + typedef R (BaseType::* FunType)(A0, A1); + typedef BaseType * ObjType; + }; + + /**/ + + template < typename R, typename A0, typename A1, typename A2 > + struct VTable3 + { + R operator()(A0 a0, A1 a1, A2 a2) { return R(); }; + }; + + template < typename A0, typename A1, typename A2 > + struct VTable3< void, A0, A1, A2 > + { + void operator()(A0 a0, A1 a1, A2 a2) { return; }; + }; + + template < typename R, typename A0, typename A1, typename A2 > + struct Function3Traits + { + typedef VTable3<R, A0, A1, A2> BaseType; + + typedef R (BaseType::* FunType)(A0, A1, A2); + typedef BaseType * ObjType; + }; + + /**/ + + template < typename R, typename A0, typename A1, typename A2, typename A3 > + struct VTable4 + { + R operator()(A0 a0, A1 a1, A2 a2, A3 a3) { return R(); }; + }; + + template < typename A0, typename A1, typename A2, typename A3 > + struct VTable4< void, A0, A1, A2, A3 > + { + void operator()(A0 a0, A1 a1, A2 a2, A3 a3) { return; }; + }; + + template < typename R, typename A0, typename A1, typename A2, typename A3 > + struct Function4Traits + { + typedef VTable4<R, A0, A1, A2, A3> BaseType; + + typedef R (BaseType::* FunType)(A0, A1, A2, A3); + typedef BaseType * ObjType; + }; + + /**/ + + template < typename R, typename A0 > + struct Function0 : public StorageBase < Function0Traits < R > > + { + typedef StorageBase < Function0Traits < R > > Storage; + + template < typename Functor > + Function0(Functor f): Storage(f) {}; + + template < typename Functor > + Function0(Functor & f, bool m): Storage(f, m) {}; + + Function0() {}; + + R operator()(void) + { + if (reinterpret_cast<void *>(Storage::_object) == 0) + throw EmptyFunction(); + + return ((Storage::_object)->*(Storage::_function))(); + } + }; + + template < typename R, typename A0 > + struct Function1 : public StorageBase < Function1Traits < R, A0 > > + { + typedef StorageBase < Function1Traits < R, A0 > > Storage; + + template < typename Functor > + Function1(Functor f): Storage(f) {}; + + template < typename Functor > + Function1(Functor & f, bool m): Storage(f, m) {}; + + Function1() {}; + + R operator()(A0 a0) + { + if (reinterpret_cast<void *>(Storage::_object) == 0) + throw EmptyFunction(); + + return ((Storage::_object)->*(Storage::_function))(a0); + } + }; + + template < typename R, typename A0, typename A1 > + struct Function2 : public StorageBase < Function2Traits < R, A0, A1 > > + { + typedef StorageBase < Function2Traits < R, A0, A1 > > Storage; + + template < typename Functor > + Function2(Functor f): Storage(f) {}; + + template < typename Functor > + Function2(Functor & f, bool m): Storage(f, m) {}; + + Function2() {}; + + R operator()(A0 a0, A1 a1) + { + if (reinterpret_cast<void *>(Storage::_object) == 0) + throw EmptyFunction(); + + return ((Storage::_object)->*(Storage::_function))(a0, a1); + } + }; + + template < typename R, typename A0, typename A1, typename A2 > + struct Function3 : public StorageBase < Function3Traits < R, A0, A1, A2 > > + { + typedef StorageBase < Function3Traits < R, A0, A1, A2 > > Storage; + + template < typename Functor > + Function3(Functor f): Storage(f) {}; + + template < typename Functor > + Function3(Functor & f, bool m): Storage(f, m) {}; + + Function3() {}; + + R operator()(A0 a0, A1 a1, A2 a2) + { + if (reinterpret_cast<void *>(Storage::_object) == 0) + throw EmptyFunction(); + + return ((Storage::_object)->*(Storage::_function))(a0, a1, a2); + } + }; + + template < typename R, typename A0, typename A1, typename A2, typename A3 > + struct Function4 : public StorageBase < Function4Traits < R, A0, A1, A2, A3 > > + { + typedef StorageBase < Function4Traits < R, A0, A1, A2, A3 > > Storage; + + template < typename Functor > + Function4(Functor f): Storage(f) {}; + + template < typename Functor > + Function4(Functor & f, bool m): Storage(f, m) {}; + + Function4() {}; + + R operator()(A0 a0, A1 a1, A2 a2, A3 a3) + { + if (reinterpret_cast<void *>(Storage::_object) == 0) + throw EmptyFunction(); + + return ((Storage::_object)->*(Storage::_function))(a0, a1, a2, a3); + } + }; +}; + +#endif /* _FUNCTION_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/initializer.hpp b/src/mod/endpoints/mod_khomp/commons/initializer.hpp new file mode 100644 index 0000000..e0e110d --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/initializer.hpp @@ -0,0 +1,80 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <vector> + +#ifndef _INITIALIZER_HPP_ +#define _INITIALIZER_HPP_ + +template < typename Type > +struct Initializer: public std::vector< Type > +{ + typedef std::vector< Type > super; + + Initializer(Type e) { push_back(e); }; + Initializer(Type & e) { push_back(e); }; + + Initializer & operator&(Initializer v) + { + insert(super::end(), v.begin(), v.end()); + return *this; + }; + + Initializer & operator&(Initializer & v) + { + insert(super::end(), v.begin(), v.end()); + return *this; + }; + + Initializer & operator&(Type v) + { + insert(super::end(), v); + return *this; + }; + + Initializer & operator&(Type & v) + { + insert(super::end(), v); + return *this; + }; +}; + +#endif /* _INITIALIZER_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/k3lapi.cpp b/src/mod/endpoints/mod_khomp/commons/k3lapi.cpp new file mode 100644 index 0000000..f5afa13 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/k3lapi.cpp @@ -0,0 +1,313 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <k3lapi.hpp> + +#include <format.hpp> +#include <verbose.hpp> + +K3LAPI::K3LAPI(bool has_exceptions) +: _has_exceptions(has_exceptions), + _device_count(0), _channel_count(0), _link_count(0), + _device_config(0), _channel_config(0), _link_config(0) +{}; + +/* initialize the whole thing! */ + +void K3LAPI::start(void) +{ + /* tie the used k3l to the compiled k3l version */ + char *ret = k3lStart(k3lApiMajorVersion, k3lApiMinorVersion, 0); //k3lApiBuildVersion); + + if (ret && *ret) + throw start_failed(ret); + + /* call init automagically */ + init(); +} + +void K3LAPI::stop(void) +{ + k3lStop(); + fini(); +} + +/* envio de comandos para placa */ + +void K3LAPI::mixer(int32 dev, int32 obj, byte track, KMixerSource src, int32 index) +{ + KMixerCommand mix; + + mix.Track = track; + mix.Source = src; + mix.SourceIndex = index; + + command(dev, obj, CM_MIXER, (const char *) &mix); +} + +void K3LAPI::mixerRecord(int32 dev, int32 obj, byte track, KMixerSource src, int32 index) +{ + /* estes buffers *NAO PODEM SER ESTATICOS*! */ + char cmd[] = { 0x3f, 0x03, (char)obj, (char)track, 0xff, 0xff }; + + switch (src) + { + case kmsChannel: + cmd[4] = 0x05; + cmd[5] = (char)index; + break; + + case kmsNoDelayChannel: + cmd[4] = 0x0a; + cmd[5] = (char)index; + break; + + case kmsGenerator: + cmd[4] = 0x09; + + switch ((KMixerTone)index) + { + case kmtSilence: + cmd[5] = 0x0F; + break; + case kmtDial: + cmd[5] = 0x08; + break; + case kmtBusy: + cmd[5] = 0x0D; + break; + + case kmtFax: + case kmtVoice: + case kmtEndOf425: + case kmtCollect: + case kmtEndOfDtmf: + /* TODO: exception, unable to generate */ + break; + } + break; + + case kmsCTbus: + case kmsPlay: + /* TODO: exception, not implemented! */ + break; + } + + int32 dsp = get_dsp(dev, DSP_AUDIO); + + raw_command(dev, dsp, cmd, sizeof(cmd)); +} + +void K3LAPI::mixerCTbus(int32 dev, int32 obj, byte track, KMixerSource src, int32 index) +{ + KMixerCommand mix; + + mix.Track = track; + mix.Source = src; + mix.SourceIndex = index; + + command(dev, obj, CM_MIXER_CTBUS, (const char *) &mix); +} + +void K3LAPI::command(int32 dev, int32 obj, int32 code, std::string & str) +{ + command(dev, obj, code, str.c_str()); +} + +void K3LAPI::command (int32 dev, int32 obj, int32 code, const char * parms) +{ + K3L_COMMAND cmd; + + cmd.Cmd = code; + cmd.Object = obj; + cmd.Params = (byte *)parms; + + int32 rc = k3lSendCommand(dev, &cmd); + + if (rc != ksSuccess) + throw failed_command(code, dev, obj, rc); +} + +void K3LAPI::raw_command(int32 dev, int32 dsp, std::string & str) +{ + raw_command(dev, dsp, str.data(), str.size()); +} + +void K3LAPI::raw_command(int32 dev, int32 dsp, const char * cmds, int32 size) +{ + std::string str(cmds, size); + + int32 rc = k3lSendRawCommand(dev, dsp, (void *)cmds, size); + + if (rc != ksSuccess) + throw failed_raw_command(dev, dsp, rc); +} + +KLibraryStatus K3LAPI::get_param(K3L_EVENT *ev, const char *name, std::string &res) +{ + char tmp_param[256]; + memset((void*)tmp_param, 0, sizeof(tmp_param)); + + int32 rc = k3lGetEventParam (ev, (sbyte *)name, (sbyte *)tmp_param, sizeof(tmp_param)-1); + + if (rc != ksSuccess) + return (KLibraryStatus)rc; + + res.append(tmp_param, strlen(tmp_param)); + return ksSuccess; +} + +std::string K3LAPI::get_param(K3L_EVENT *ev, const char *name) +{ + std::string res; + + KLibraryStatus rc = get_param(ev, name, res); + + if (rc != ksSuccess) + throw get_param_failed(name, rc); + + return res; +} + +void K3LAPI::init(void) +{ + if (_device_count != 0) return; + + _device_count = k3lGetDeviceCount(); + + _device_type = new KDeviceType[_device_count]; + _device_config = new device_conf_type[_device_count]; + _channel_config = new channel_ptr_conf_type[_device_count]; + _link_config = new link_ptr_conf_type[_device_count]; + _channel_count = new unsigned int[_device_count]; + _link_count = new unsigned int[_device_count]; + + for (unsigned int dev = 0; dev < _device_count; dev++) + { + KLibraryStatus ret = ksSuccess; + + _device_type[dev] = (KDeviceType) k3lGetDeviceType(dev); + + /* caches each device config */ + ret = (KLibraryStatus)k3lGetDeviceConfig(dev, ksoDevice + dev, &(_device_config[dev]), sizeof(_device_config[dev])); + + if (ret != ksSuccess) + throw start_failed(STG(FMT("k3lGetDeviceConfig(dev=%d): %s") % dev % Verbose::status(ret))); + + /* adjust channel/link count for device */ + _channel_count[dev] = _device_config[dev].ChannelCount; + _link_count[dev] = _device_config[dev].LinkCount; + + /* caches each channel config */ + _channel_config[dev] = new channel_conf_type[_channel_count[dev]]; + + for (unsigned int obj = 0; obj < _channel_count[dev]; obj++) + { + ret = (KLibraryStatus)k3lGetDeviceConfig(dev, ksoChannel + obj, &(_channel_config[dev][obj]), sizeof(_channel_config[dev][obj])); + + if (ret != ksSuccess) + throw start_failed(STG(FMT("k3lGetDeviceConfig(dev=%d,chan=%d): %s") % dev % obj % Verbose::status(ret))); + } + + /* adjust link count for device */ + _link_count[dev] = _device_config[dev].LinkCount; + + /* caches each link config */ + _link_config[dev] = new link_conf_type[_link_count[dev]]; + + for (unsigned int obj = 0; obj < _link_count[dev]; obj++) + { + ret = (KLibraryStatus)k3lGetDeviceConfig(dev, ksoLink + obj, &(_link_config[dev][obj]), sizeof(_link_config[dev][obj])); + + if (ret != ksSuccess) + throw start_failed(STG(FMT("k3lGetDeviceConfig(dev=%d,link=%d): %s") % dev % obj % Verbose::status(ret))); + } + } +} + +void K3LAPI::fini(void) +{ + for (unsigned int dev = 0; dev < _device_count; dev++) + { + if (_channel_config[dev]) + { + delete[] _channel_config[dev]; + _channel_config[dev] = NULL; + } + + if (_link_config[dev]) + { + delete[] _link_config[dev]; + _link_config[dev] = NULL; + } + } + + _device_count = 0; + + if (_device_type) { delete[] _device_type; _device_type = NULL; } + if (_device_config) { delete[] _device_config; _device_config = NULL; } + if (_channel_config) { delete[] _channel_config; _channel_config = NULL; } + if (_link_config) { delete[] _link_config; _link_config = NULL; } + if (_channel_count) { delete[] _channel_count; _channel_count = NULL; } + if (_link_count) { delete[] _link_count; _link_count = NULL; } +} + +int32 K3LAPI::get_dsp(int32 dev, K3LAPI::DspType type) +{ + switch (device_type(dev)) + { + case kdtFXO: + case kdtFXOVoIP: +#if K3L_AT_LEAST(1,6,0) + case kdtGSM: + case kdtGSMSpx: +#endif +#if K3L_AT_LEAST(2,1,0) + case kdtGSMUSB: + case kdtGSMUSBSpx: +#endif + return 0; + + default: + return (type == DSP_AUDIO ? 1 : 0); + } +} + diff --git a/src/mod/endpoints/mod_khomp/commons/k3lapi.hpp b/src/mod/endpoints/mod_khomp/commons/k3lapi.hpp new file mode 100644 index 0000000..5965484 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/k3lapi.hpp @@ -0,0 +1,408 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <string> + +#include <k3l.h> + +/* if using full k3l.h (for softpbx), version already defined. */ +#ifndef k3lApiMajorVersion +# include <k3lVersion.h> +#endif + +#ifdef __GNUC_PREREQ +#if __GNUC_PREREQ(4,3) +#include <cstring> +#endif +#endif + +#include <types.hpp> + +#ifndef _K3LAPI_HPP_ +#define _K3LAPI_HPP_ + +struct K3LAPI +{ + /* exceptions */ + + struct start_failed + { + start_failed(const char * _msg) : msg(_msg) {}; + start_failed(std::string _msg) : msg(_msg) {}; + std::string msg; + }; + + struct failed_command + { + failed_command(int32 _code, unsigned short _dev, unsigned short _obj, int32 _rc) + : code(_code), dev(_dev), obj(_obj), rc(_rc) {}; + + int32 code; + unsigned short dev; + unsigned short obj; + int32 rc; + }; + + struct failed_raw_command + { + failed_raw_command(unsigned short _dev, unsigned short _dsp, int32 _rc) + : dev(_dev), dsp(_dsp), rc(_rc) {}; + + unsigned short dev; + unsigned short dsp; + int32 rc; + }; + + struct invalid_device + { + invalid_device(int32 _device) + : device(_device) {}; + + int32 device; + }; + + struct invalid_channel + { + invalid_channel(int32 _device, int32 _channel) + : device(_device), channel(_channel) {}; + + int32 device, channel; + }; + + struct invalid_link + { + invalid_link(unsigned int _device, unsigned int _link) + : device(_device), link(_link) {}; + + int32 device, link; + }; + + struct get_param_failed + { + get_param_failed(std::string _name, int32 _rc) + : name(_name), rc((KLibraryStatus)_rc) {}; + + std::string name; + KLibraryStatus rc; + }; + + typedef K3L_DEVICE_CONFIG device_conf_type; + typedef K3L_CHANNEL_CONFIG channel_conf_type; + typedef K3L_CHANNEL_CONFIG * channel_ptr_conf_type; + typedef K3L_LINK_CONFIG link_conf_type; + typedef K3L_LINK_CONFIG * link_ptr_conf_type; + + /* constructors/destructors */ + + K3LAPI(bool has_exceptions = false); + virtual ~K3LAPI() {}; + + /* (init|final)ialize the whole thing! */ + + void start(void); + void stop(void); + + /* verificacao de intervalos */ + + inline bool valid_device(int32 dev) + { + return (dev >= 0 && dev < ((int32)_device_count)); + } + + inline bool valid_channel(int32 dev, int32 obj) + { + return (valid_device(dev) && obj >= 0 && obj < ((int32)_channel_count[dev])); + } + + inline bool valid_link(int32 dev, int32 obj) + { + return (valid_device(dev) && obj >= 0 && obj < ((int32)_link_count[dev])); + } + + /*! + \brief High level object identifier + Since Khomp works with an object concept, this is used to map the + object id with its proper type. + */ + struct target + { + /*! The types a target can have */ + typedef enum { DEVICE, CHANNEL, MIXER, LINK } target_type; + + target(K3LAPI & k3lapi, target_type type_init, int32 device_value, int32 object_value) + : type(type_init), + device((unsigned short)device_value), + object((unsigned short)object_value) + { + switch (type_init) + { + case DEVICE: + if (!k3lapi.valid_device(device_value)) + throw invalid_device(device_value); + break; + + case CHANNEL: + case MIXER: + if (!k3lapi.valid_channel(device_value, object_value)) + throw invalid_channel(device_value, object_value); + break; + + case LINK: + if (!k3lapi.valid_link(device_value, object_value)) + throw invalid_link(device_value, object_value); + break; + } + + }; + + const target_type type; + + const unsigned short device; + const unsigned short object; + }; + + /* envio de comandos para placa (geral) */ + + void raw_command(int32 dev, int32 dsp, std::string & str); + void raw_command(int32 dev, int32 dsp, const char * cmds, int32 size); + + /* obter dados 'cacheados' (geral) */ + + inline unsigned int device_count(void) + { + return _device_count; + } + + /* envio de comandos para placa (sem identificadores) */ + + void mixer(int32 dev, int32 obj, byte track, KMixerSource src, int32 index); + void mixerRecord(int32 dev, int32 obj, byte track, KMixerSource src, int32 index); + void mixerCTbus(int32 dev, int32 obj, byte track, KMixerSource src, int32 index); + + void command (int32 dev, int32 obj, int32 code, std::string & str); + void command (int32 dev, int32 obj, int32 code, const char * parms = NULL); + + /* obter dados 'cacheados' (sem identificadores) */ + + inline unsigned int channel_count(int32 dev) + { + if (!valid_device(dev)) + { + if (_has_exceptions) + throw invalid_device(dev); + else + return 0; + } + + return _channel_count[dev]; + } + + inline unsigned int link_count(int32 dev) + { + if (!valid_device(dev)) + { + if (_has_exceptions) + throw invalid_device(dev); + else + return 0; + } + + return _link_count[dev]; + } + + inline uint32 channel_stats(int32 dev, int32 obj, uint32 index) + { + if (!valid_channel(dev, obj)) + { + if (_has_exceptions) + throw invalid_channel(dev, obj); + else + return 0; + } + + uint32 res_value = (uint32)-1; + stt_code stt_res = ksFail; + +#if K3L_AT_LEAST(2,1,0) + stt_res = k3lGetChannelStats(dev, obj, index, &res_value); +#endif + + if(stt_res != ksSuccess) + { + return (uint32)-1; + } + + return res_value; + } + + KDeviceType device_type(int32 dev) + { + if (!valid_device(dev)) + { + if (_has_exceptions) + throw invalid_device(dev); + else + return kdtDevTypeCount; + } + + return _device_type[dev]; + } + + + K3L_DEVICE_CONFIG & device_config(int32 dev) + { + if (!valid_device(dev)) + throw invalid_device(dev); + + return _device_config[dev]; + } + + K3L_CHANNEL_CONFIG & channel_config(int32 dev, int32 obj) + { + if (!valid_channel(dev, obj)) + throw invalid_channel(dev, obj); + + return _channel_config[dev][obj]; + } + + K3L_LINK_CONFIG & link_config(int32 dev, int32 obj) + { + if (!valid_link(dev, obj)) + throw invalid_channel(dev, obj); + + return _link_config[dev][obj]; + } + + /* envio de comandos para placa (com identificadores) */ + + void mixer(target & tgt, byte track, KMixerSource src, int32 index) + { + mixer((int32)tgt.device, (int32)tgt.object, track, src, index); + } + + void mixerRecord(target & tgt, byte track, KMixerSource src, int32 index) + { + mixerRecord((int32)tgt.device, (int32)tgt.object, track, src, index); + } + + void mixerCTbus(target & tgt, byte track, KMixerSource src, int32 index) + { + mixerCTbus((int32)tgt.device, (int32)tgt.object, track, src, index); + } + + void command (target & tgt, int32 code, std::string & str) + { + command((int32)tgt.device, (int32)tgt.object, code, str); + }; + + void command (target & tgt, int32 code, const char * parms = NULL) + { + command((int32)tgt.device, (int32)tgt.object, code, parms); + }; + + /* obter dados 'cacheados' (com indentificadores) */ + + inline unsigned int channel_count(target & tgt) + { + return _channel_count[tgt.device]; + } + + inline unsigned int link_count(target & tgt) + { + return _link_count[tgt.device]; + } + + KDeviceType device_type(target & tgt) + { + return _device_type[tgt.device]; + } + + + K3L_DEVICE_CONFIG & device_config(target & tgt) + { + return _device_config[tgt.device]; + } + + K3L_CHANNEL_CONFIG & channel_config(target & tgt) + { + return _channel_config[tgt.device][tgt.object]; + } + + K3L_LINK_CONFIG & link_config(target & tgt) + { + return _link_config[tgt.device][tgt.object]; + } + + /* pega valores em strings de eventos */ + + KLibraryStatus get_param(K3L_EVENT *ev, const char *name, std::string &res); + std::string get_param(K3L_EVENT *ev, const char *name); + + /* inicializa valores em cache */ + + void init(void); + void fini(void); + + /* utilidades diversas e informacoes */ + + enum DspType + { + DSP_AUDIO, + DSP_SIGNALING, + }; + + int32 get_dsp(int32, DspType); + + protected: + + const bool _has_exceptions; + + unsigned int _device_count; + unsigned int * _channel_count; + unsigned int * _link_count; + + device_conf_type * _device_config; + channel_ptr_conf_type * _channel_config; + link_ptr_conf_type * _link_config; + KDeviceType * _device_type; +}; + +#endif /* _K3LAPI_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/k3lutil.cpp b/src/mod/endpoints/mod_khomp/commons/k3lutil.cpp new file mode 100644 index 0000000..83ac82e --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/k3lutil.cpp @@ -0,0 +1,234 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <k3lutil.hpp> + +std::string K3LUtil::channelStatus(int32 dev, int32 channel, + Verbose::Presentation fmt) +{ + try + { + K3L_CHANNEL_CONFIG & config = _k3lapi.channel_config(dev, channel); + K3L_CHANNEL_STATUS status; + + KLibraryStatus ret = (KLibraryStatus) k3lGetDeviceStatus (dev, + channel + ksoChannel, &status, sizeof(status)); + + switch (ret) + { + case ksSuccess: return Verbose::channelStatus(config.Signaling, + status.AddInfo, fmt); + default: return (fmt == Verbose::EXACT ? "<unknown[fail]>" + : "Unknown (fail)"); + } + } + catch(K3LAPI::invalid_channel & e) + { + return (fmt == Verbose::EXACT ? "<unknown[fail]>" : "Unknown (fail)"); + } +} + +std::string K3LUtil::callStatus(int32 dev, int32 channel, + Verbose::Presentation fmt) +{ + K3L_CHANNEL_STATUS status; + + KLibraryStatus ret = (KLibraryStatus) k3lGetDeviceStatus(dev, + channel + ksoChannel, &status, sizeof(status)); + + switch (ret) + { + case ksSuccess: return Verbose::callStatus(status.CallStatus, fmt); + default: return (fmt == Verbose::EXACT ? "<unknown[fail]>" + : "Unknown (fail)"); + } +} + +std::string K3LUtil::linkStatus(int32 dev, int32 link, + Verbose::Presentation fmt, KSignaling sig) +{ + try + { + if (sig == ksigInactive) + { + K3L_LINK_CONFIG & config = _k3lapi.link_config(dev, link); + sig = config.Signaling; + } + + K3L_LINK_STATUS status; + + KLibraryStatus ret = (KLibraryStatus) k3lGetDeviceStatus (dev, + link + ksoLink, &status, sizeof(status)); + + switch (ret) + { + case ksSuccess: return Verbose::linkStatus(sig, status.E1, fmt); + default: return (fmt == Verbose::EXACT ? + "<unknown[failure]>" : "Unknown (failure)"); + } + } + catch(K3LAPI::invalid_channel & e) + { + return (fmt == Verbose::EXACT ? "<unknown[failure]>" + : "Unknown (failure)"); + } +} + +std::string K3LUtil::getLinkStatus(int32 dev, int32 link, + Verbose::Presentation fmt) +{ + switch (_k3lapi.device_type(dev)) + { +#if K3L_AT_LEAST(1,6,0) + case kdtFXS: + case kdtFXSSpx: + return linkStatus(dev, link, fmt, ksigAnalogTerminal); + +#if K3L_AT_LEAST(2,1,0) + case kdtE1FXSSpx: + if (link == 1) + return linkStatus(dev, link, fmt, ksigAnalogTerminal); +#endif +#endif + default: + break; + } + + K3L_LINK_CONFIG & conf = _k3lapi.link_config(dev, link); + + std::string res = linkStatus(dev, link, fmt); + + if (conf.ReceivingClock & 0x01) + res += (fmt == Verbose::EXACT ? ",sync" : " (sync)"); + + return res; +} + +unsigned int K3LUtil::physicalLinkCount(int32 dev, bool count_virtual) +{ + unsigned int number = 0; + + try + { + switch (_k3lapi.device_type(dev)) + { +#if K3L_AT_LEAST(1,6,0) + case kdtFXS: + number = (count_virtual ? (_k3lapi.channel_count(dev) < 50 ? 1 : 2) : 0); + break; + + case kdtFXSSpx: + number = (count_virtual ? (_k3lapi.channel_count(dev) < 30 ? 1 : 2) : 0); + break; +#endif + +#if K3L_AT_LEAST(2,1,0) + case kdtE1FXSSpx: + number = (count_virtual ? 2 : 1); + break; +#endif + + /* E1 boards */ + case kdtE1: + case kdtE1Spx: + case kdtE1IP: + number = _k3lapi.link_count(dev); + break; + + case kdtPR: + case kdtE1GW: + number = 1; + break; + +#if K3L_AT_LEAST(1,6,0) + case kdtFXO: + case kdtFXOVoIP: + case kdtGSM: + case kdtGSMSpx: +#else + case kdtFX: + case kdtFXVoIP: +#endif + case kdtConf: + case kdtGWIP: +#if K3L_AT_LEAST(2,1,0) + case kdtGSMUSB: + case kdtGSMUSBSpx: + case kdtReserved1: // just to avoid warnings. + case kdtDevTypeCount: // just to avoid warnings. +#endif + number = 0; + break; + } + } + catch(K3LAPI::invalid_device & e) + { + return 0; + } + + return number; +} + + +K3LUtil::ErrorCountType K3LUtil::linkErrorCount(int32 dev, int32 link, + Verbose::Presentation fmt) +{ + ErrorCountType result; + K3L_LINK_ERROR_COUNTER status; + + KLibraryStatus ret = (KLibraryStatus) k3lGetDeviceStatus (dev, + link + ksoLinkMon, &status, sizeof(status)); + + switch (ret) + { + case ksSuccess: + for (unsigned int i = klecChangesToLock; i < klecCount; i++) + { + result.push_back(ErrorCountPairType(Verbose::linkErrorCounter + ((KLinkErrorCounter)i, fmt), status.ErrorCounters[i])); + } + /* fall */ + + default: + return result; + } +} + diff --git a/src/mod/endpoints/mod_khomp/commons/k3lutil.hpp b/src/mod/endpoints/mod_khomp/commons/k3lutil.hpp new file mode 100644 index 0000000..e547f3d --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/k3lutil.hpp @@ -0,0 +1,82 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <string> +#include <utility> +#include <list> + +#include <k3lapi.hpp> +#include <verbose.hpp> + +#ifndef _K3LUTIL_HPP_ +#define _K3LUTIL_HPP_ + +struct K3LUtil +{ + typedef std::pair < std::string, unsigned int > ErrorCountPairType; + typedef std::list < ErrorCountPairType > ErrorCountType; + + K3LUtil(K3LAPI & k3lapi): _k3lapi(k3lapi) {}; + + std::string callStatus(int32 dev, int32 channel, + Verbose::Presentation fmt = Verbose::HUMAN); + + std::string channelStatus(int32, int32, + Verbose::Presentation fmt = Verbose::HUMAN); + + std::string linkStatus(int32, int32, + Verbose::Presentation fmt = Verbose::HUMAN, + KSignaling sig = ksigInactive); + + std::string getLinkStatus(int32, int32, + Verbose::Presentation fmt = Verbose::HUMAN); + + unsigned int physicalLinkCount(int32 dev, bool count_virtual = false); + + ErrorCountType linkErrorCount(int32, int32, + Verbose::Presentation fmt = Verbose::HUMAN); + + protected: + K3LAPI & _k3lapi; +}; + +#endif /* _K3LUTIL_HPP_ */ + diff --git a/src/mod/endpoints/mod_khomp/commons/logger.hpp b/src/mod/endpoints/mod_khomp/commons/logger.hpp new file mode 100644 index 0000000..6fcf7bf --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/logger.hpp @@ -0,0 +1,644 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <stdio.h> +#include <sys/time.h> +#include <time.h> + +#include <map> +#include <string> +#include <iostream> + +#include <tagged_union.hpp> +#include <format.hpp> +#include <refcounter.hpp> +#include <flagger.hpp> + +#if defined(COMMONS_LIBRARY_USING_ASTERISK) +extern "C" +{ + #include <asterisk/localtime.h> +} +#elif defined(COMMONS_LIBRARY_USING_CALLWEAVER) +extern "C" +{ + #include <callweaver/localtime.h> +} +#elif defined(COMMONS_LIBRARY_USING_FREESWITCH) +extern "C" +{ + #include <time.h> +} +#endif +/* + +******************************************************************************** +***************************** 'Logger' user manual ***************************** +******************************************************************************** + +* Description: + +This class does the management of log messages for applications. It works with +the following axioms: + +<*> There are several class of messages. +<*> There are some outputs, which may be files, sockets, or a console device. +<*> There are options for classes, for outputs and for the association of both. + +The last rule also shows the order in which options are processed: first the +'classes' options are processed, then 'output' options are processed, and then +the options for the tuple '(class, output)' are processed. + +The options are mapped like this: + + <class-of-message> -> options [prefix, flags] + <output-sink> -> options [prefix] +( <class-of-message>, <output-sink> ) -> options [prefix, flags] + + - "prefix" means a fixed string prefix before the real message. + - "flags" means auxiliary flags (DATETIME, THREADID) which are + used to add information based on OS or process context info. + +* Example of use: + +typedef enum +{ + C_DBG_FUNC, + C_DBG_LOCK, + C_WARNING, + C_ERROR, + C_CLI, +} +AstClassId; + +typedef enum +{ + F_CONSOLE, + F_GENERIC, + F_TRACE, +} +AstOutputId; + +// used to indicate the console log // +struct AstConsoleLog {}; + +struct AstPrinter: public Logger::DefaultPrinter +{ + typedef Logger::DefaultPrinter Super; + + using namespace Tagged; + + using Super::operator()(int); + + // just 2 type of descriptors // + typedef Union < int, Union < AstConsoleLog > > Container; + + ast_printer(std::string & msg): Super(msg) {}; + + bool operator()(const AstConsoleLog & log) + { + ast_console_puts(_msg.c_str()); + return true; + }; + +#if 0 + bool operator()(int log) + { + return Super::operator()(log); + }; +#endif +}; + +bool start_log() +{ + typedef Logger::Manager<AstClassId, AstOutputId, AstPrinter, SimpleLock> LogManager; + + LogManager logger; + + // shortcut definition // + typedef LogManager::Option LogOption; + + FILE * log_file = fopen( "output.log", "a"); + + if (!log_file) + return false; + + logger.add( F_CONSOLE, AstConsoleLog(), "chan_khomp: "); + logger.add( F_GENERIC, log_file); + + logger.classe( C_WARNING ) + & LogOption(F_CONSOLE, "WARNING: ", LogOption::Flags(LogOption::Flag(LogOption::DATETIME))) + & LogOption(F_GENERIC, "W: ", LogOption::Flags(LogOption::Flag(LogOption::DATETIME))) + + logger.classe( C_DBG_LOCK ).enabled(false); + + logger.classe( C_DBG_LOCK ) + & LogOption(F_GENERIC, "L: ", LogOption::Flags + (LogOption::flag_type(LogOption::ENABLED) & + LogOption::flag_type(LogOption::DATETIME)) + + logger(C_WARNING, "eu sou uma mensagem de warning"); + + logger.classe(C_WARNING).set(F_GENERIC, LogOption::ENABLED, true); + logger.classe(C_WARNING).set(F_CONSOLE, LogOption::ENABLED, false); + + logger.classe(C_CLI).prefix("<K>"); + + return true; +} + +void message_the_user(int fd) +{ + logger(C_CLI, fd, "eu sou uma mensagem de cli!"); + logger(C_WARNING, "eu sou um warning"); +} + +******************************************************************************** +******************************************************************************** + +Now, the code..! + +*/ + +#ifndef _LOGGER_HPP_ +#define _LOGGER_HPP_ + +#include <tagged_union.hpp> + +struct Logger +{ + /*** a base struct for printing messages in many ways ***/ + + struct DefaultPrinter + { + typedef Tagged::Union < int, Tagged::Union < FILE *, Tagged::Union < std::ostream * > > > BaseType; + + typedef bool ReturnType; + + DefaultPrinter(std::string & msg): _msg(msg) {}; + + bool operator()(std::ostream * out) + { + (*out) << _msg; + out->flush(); + + return out->good(); + } + + bool operator()(FILE * out) + { + if (fputs(_msg.c_str(), out) < 0) + return false; + + if (fflush(out) < 0) + return false; + + return true; + } + + bool operator()(int out) + { +#ifndef KWIN32 + return (write(out, _msg.c_str(), _msg.size()) == (int)_msg.size()); +#else + // no need for file descriptors on windows + return false; +#endif + } + + std::string & msg() { return _msg; } + + protected: + std::string & _msg; + }; + + /*** manage the printing of messages ***/ + + template <class ClassId, class OutputId, class Printer, class LockType> + struct Manager + { + typedef typename Printer::BaseType BaseType; + + protected: + /* holds a stream, and an optimal message prefix */ + struct OutputOptions + { + OutputOptions(BaseType & stream, std::string & prefix) + : _stream(stream), _prefix(prefix) {}; + + BaseType _stream; + std::string _prefix; + LockType _lock; + }; + + typedef std::map < OutputId, OutputOptions > OutputMap; + + public: + + /* print in a specific 'message class' */ + struct ClassType + { + ClassType(void) + : _enabled(true) + {}; + +// ClassType(ClassType & o) +// : _stream_map(o._stream_map), _prefix(o.prefix), +// _lock(o._lock),_enabled(o._enabled) +// {}; + + /* initializes the options of the (class, stream) pair */ + struct Option + { + typedef enum { ENABLED, DATETIME, THREADID, DATETIMEMS } EnumType; + + typedef Flagger< EnumType > Flags; + typedef typename Flags::InitFlags InitFlags; + + Option(OutputId output, const char * prefix, + Flags flags = InitFlags(ENABLED)) + : _output(output), _prefix(prefix), _flags(flags) {}; + + Option(OutputId output, std::string prefix, + Flags flags = InitFlags(ENABLED)) + : _output(output), _prefix(prefix), _flags(flags) {}; + + Option(OutputId output, + Flags flags = InitFlags(ENABLED)) + : _output(output), _flags(flags) {}; + + OutputId _output; + std::string _prefix; + Flags _flags; + }; + + protected: + + /* holds a prefix and a activation status */ + struct OptionContainer + { + OptionContainer(std::string prefix, typename Option::Flags flags) + : _prefix(prefix), _flags(flags) {}; + + std::string _prefix; + typename Option::Flags _flags; + }; + + typedef std::multimap < OutputId, OptionContainer > OptionMap; + + /* utility function for printing */ + bool print(std::string & msg, BaseType & stream, LockType & lock) + { + lock.lock(); + + Printer p(msg); + bool ret = stream.visit(p); + + lock.unlock(); + + return ret; + }; + +/* + bool print(std::string & msg, BaseType & stream, LockType & lock) + { + lock.lock(); + + Printer p(msg); + bool ret = stream.visit(p); + + lock.unlock(); + + return ret; + }; +*/ + + public: + ClassType & operator&(const Option & value) + { + add(value._output, value._prefix, value._flags); + return *this; + } + + void add(OutputId output_id, std::string prefix, + typename Option::Flags flags) + { + typedef std::pair < OutputId, OptionContainer > pair_type; + _stream_map.insert(pair_type(output_id, OptionContainer(prefix, flags))); + } + + /* get and set methods for active mode */ + void set(OutputId id, typename Option::EnumType flag, bool value = true) + { + typename OptionMap::iterator iter = _stream_map.find(id); + + if (iter == _stream_map.end()) + return; + + (*iter).second._flags.set(flag, value); + } + + bool get(OutputId idx, typename Option::EnumType flag) + { + typename OptionMap::iterator iter = _stream_map.find(idx); + + if (iter == _stream_map.end()) + return false; + + return (*iter).second._flags.is_set(flag); + } + + /* get/adjust the enable/disable value for the class */ + void enabled(bool enabled) { _enabled = enabled; }; + bool enabled() { return _enabled; }; + + /* get/adjust the classe prefix */ + void prefix(const char * prefix) { _prefix = prefix; } + void prefix(std::string & prefix) { _prefix = prefix; } + std::string & prefix() { return _prefix; } + + /* printing function (operator, actually) */ + bool operator()(OutputMap & out_map, std::string & msg) + { + if (!_enabled) + return true; + + typedef typename OptionMap::iterator Iter; + + bool ret = true; + + for (Iter iter = _stream_map.begin(); iter != _stream_map.end(); iter++) + { + OptionContainer & opt = (*iter).second; + + if (!opt._flags[Option::ENABLED]) + continue; + + typename OutputMap::iterator out_iter = out_map.find((*iter).first); + + /* this stream have been added already? if not, skip! */ + if (out_iter == out_map.end()) + continue; + + /* final message */ + std::string out_msg; + + if (opt._flags[Option::DATETIME]) + { +#if defined(COMMONS_LIBRARY_USING_ASTERISK) +#if ASTERISK_AT_LEAST(1,6,0) + struct timeval tv; + struct ast_tm lt; + + gettimeofday(&tv, NULL); + +#else + time_t tv; + struct tm lt; + + time (&tv); +#endif + +#if ASTERISK_AT_LEAST(1,4,5) + ast_localtime (&tv, <, NULL); +#else + localtime_r (&tv, <); +#endif + + out_msg += STG(FMT("[%04d-%02d-%02d %02d:%02d:%02d] ") + % (lt.tm_year + 1900) % (lt.tm_mon + 1) % lt.tm_mday % lt.tm_hour + % lt.tm_min % lt.tm_sec); + +#elif defined(COMMONS_LIBRARY_USING_CALLWEAVER) + time_t tv; + struct tm lt; + + time (&tv); + + localtime_r (&tv, <); + + out_msg += STG(FMT("[%04d-%02d-%02d %02d:%02d:%02d] ") + % (lt.tm_year + 1900) % (lt.tm_mon + 1) % lt.tm_mday % lt.tm_hour + % lt.tm_min % lt.tm_sec); + +#elif defined(COMMONS_LIBRARY_USING_FREESWITCH) + time_t tv; + struct tm lt; + + time (&tv); + + localtime_r (&tv, <); + + out_msg += STG(FMT("[%04d-%02d-%02d %02d:%02d:%02d] ") + % (lt.tm_year + 1900) % (lt.tm_mon + 1) % lt.tm_mday % lt.tm_hour + % lt.tm_min % lt.tm_sec); + +#endif + } + + if (opt._flags[Option::DATETIMEMS]) + { +#if defined(COMMONS_LIBRARY_USING_ASTERISK) +#if ASTERISK_AT_LEAST(1,6,0) + struct timeval tv; + struct ast_tm lt; + + gettimeofday(&tv, NULL); + +#else + time_t tv; + struct tm lt; + + time (&tv); +#endif + +#if ASTERISK_AT_LEAST(1,4,5) + ast_localtime (&tv, <, NULL); +#else + localtime_r (&tv, <); +#endif + +#if ASTERISK_AT_LEAST(1,6,0) + out_msg += STG(FMT("[%04d-%02d-%02d %02d:%02d:%02d:%04d] ") + % (lt.tm_year + 1900) % (lt.tm_mon + 1) % lt.tm_mday % lt.tm_hour % lt.tm_min + % lt.tm_sec % (tv.tv_usec / 1000)); +#else + out_msg += STG(FMT("[%04d-%02d-%02d %02d:%02d:%02d:%04d] ") + % (lt.tm_year + 1900) % (lt.tm_mon + 1) % lt.tm_mday % lt.tm_hour % lt.tm_min + % lt.tm_sec % (tv * 1000)); +#endif + +#elif defined(COMMONS_LIBRARY_USING_CALLWEAVER) + time_t tv; + struct tm lt; + + time (&tv); + + localtime_r (&tv, <); + + out_msg += STG(FMT("[%04d-%02d-%02d %02d:%02d:%02d:%04d] ") + % (lt.tm_year + 1900) % (lt.tm_mon + 1) % lt.tm_mday % lt.tm_hour % lt.tm_min + % lt.tm_sec % (tv * 1000)); + +#elif defined(COMMONS_LIBRARY_USING_FREESWITCH) + time_t tv; + struct tm lt; + + time (&tv); + + localtime_r (&tv, <); + + out_msg += STG(FMT("[%04d-%02d-%02d %02d:%02d:%02d:%04d] ") + % (lt.tm_year + 1900) % (lt.tm_mon + 1) % lt.tm_mday % lt.tm_hour % lt.tm_min + % lt.tm_sec % (tv * 1000)); + +#endif + } + + OutputOptions & out_opt = (*out_iter).second; + + if (opt._flags[Option::THREADID]) + { +#if defined (COMMONS_LIBRARY_USING_ASTERISK) || defined(COMMONS_LIBRARY_USING_CALLWEAVER) || defined(COMMONS_LIBRARY_USING_FREESWITCH) + out_msg += STG(FMT("t=%08p ") % ((void*)pthread_self())); +#endif + } + + out_msg += _prefix; + out_msg += out_opt._prefix; + out_msg += opt._prefix; + out_msg += msg; + out_msg += "\n"; + + ret |= print(out_msg, out_opt._stream, out_opt._lock); + } + + return ret; + } + + bool operator()(BaseType & stream, std::string & msg) + { + std::string final_msg; + + final_msg += _prefix; + final_msg += msg; + final_msg += "\n"; + + return print(final_msg, stream, _lock); + } + + protected: + OptionMap _stream_map; + std::string _prefix; + LockType _lock; + bool _enabled; + }; + + /* util declaration */ + typedef typename ClassType::Option Option; + + /* class_id_type -> ClassType mapper */ + typedef std::map < ClassId, ClassType > ClassMap; + + /* local option pair */ + typedef std::pair < OutputId, OutputOptions > OutputOptionPair; + + void add(OutputId output, BaseType stream, const char * prefix = "") + { + std::string str_prefix(prefix); + + _output_map.insert(OutputOptionPair(output, OutputOptions(stream, str_prefix))); + } + + void add(OutputId output, BaseType stream, std::string prefix) + { + _output_map.insert(OutputOptionPair(output, OutputOptions(stream, prefix))); + } + + ClassType & classe(ClassId classeid) + { + return _classe_map[classeid]; + } + + bool operator()(ClassId classeid, const char * msg) + { + std::string str_msg(msg); + return _classe_map[classeid](_output_map, str_msg); + } + + bool operator()(ClassId classeid, std::string & msg) + { + return _classe_map[classeid](_output_map, msg); + } + + bool operator()(ClassId classeid, Format fmt) + { + std::string str_fmt = STG(fmt); + return _classe_map[classeid](_output_map, str_fmt); + } + + bool operator()(ClassId classeid, BaseType stream, const char * msg) + { + std::string str_msg(msg); + return _classe_map[classeid](stream, str_msg); + } + + bool operator()(ClassId classeid, BaseType stream, std::string & msg) + { + return _classe_map[classeid](stream, msg); + } + + bool operator()(ClassId classeid, BaseType stream, Format fmt) + { + std::string str_fmt = STG(fmt); + return _classe_map[classeid](stream, str_fmt); + } + + protected: + ClassMap _classe_map; + OutputMap _output_map; + }; + + private: + Logger(); +}; + +#endif /* _LOGGER_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/noncopyable.hpp b/src/mod/endpoints/mod_khomp/commons/noncopyable.hpp new file mode 100644 index 0000000..d32faa8 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/noncopyable.hpp @@ -0,0 +1,54 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#ifndef _NONCOPYABLE_HPP_ +#define _NONCOPYABLE_HPP_ + +struct NonCopyable +{ + NonCopyable() {}; + private: + NonCopyable(NonCopyable const &) { }; + NonCopyable & operator=(NonCopyable const &) { return *this; }; +}; + +#endif /* _NONCOPYABLE_HPP_ */ + diff --git a/src/mod/endpoints/mod_khomp/commons/refcounter.hpp b/src/mod/endpoints/mod_khomp/commons/refcounter.hpp new file mode 100644 index 0000000..6ba8ae8 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/refcounter.hpp @@ -0,0 +1,263 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the "LGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +/* This struct uses static polymorphism, and derived classes should implement * + * the "unreference()" method, which should release all resources when called */ + +#ifndef _REFCOUNTER_HPP_ +#define _REFCOUNTER_HPP_ + +#define NEW_REFCOUNTER(...) public ReferenceCounter< __VA_ARGS__ > +#define INC_REFCOUNTER(o, ...) ReferenceCounter< __VA_ARGS__ >(static_cast< const ReferenceCounter < __VA_ARGS__ > & >(o)) + +#include <stdlib.h> + +#include <noncopyable.hpp> +#include <atomic.hpp> + +#ifdef DEBUG +# include <iostream> +#endif + +struct ReferenceData: public NonCopyable +{ + ReferenceData() + : _data_count(1) + {}; + + inline unsigned int increment(void) + { + if (!_data_count) + abort(); + + Atomic::doAdd(&_data_count); + + return _data_count; + } + + inline unsigned int decrement(void) + { + if (!_data_count) + abort(); + + Atomic::doSub(&_data_count); + return _data_count; + } + + volatile unsigned int _data_count; +}; + +template < typename T > +struct ReferenceCounter +{ + typedef T Type; + + ReferenceCounter(bool create_counter = true) + : _reference_count(0) + { + reference_restart(create_counter); + +#ifdef DEBUG + std::cerr << ((void*)this) << ": ReferenceCounter() [ref_count=" + << (_reference_count ? (*_reference_count) : -1) << "]" << std::endl; +#endif + }; + + ReferenceCounter(const ReferenceCounter & o) + : _reference_count(0) + { + reference_reflect(o); + +#ifdef DEBUG + std::cerr << ((void*)this) << ": ReferenceCounter(" << ((void*)(&o)) << ") [ref_count=" + << (_reference_count ? (*_reference_count) : -1) << "]" << std::endl; +#endif + }; + + virtual ~ReferenceCounter() + { +#ifdef DEBUG + std::cerr << ((void*)this) << ": ~ReferenceCounter() [ref_count=" + << (_reference_count ? (*_reference_count) : -1) << "]" << std::endl; +#endif + reference_disconnect(_reference_count); + } + + ReferenceCounter & operator=(const ReferenceCounter & o) + { + reference_reflect(o); + +#ifdef DEBUG + std::cerr << ((void*)this) << ": ReferenceCounter::operator=(" << ((void*)(&o)) << ") [ref_count=" + << (_reference_count ? (*_reference_count) : -1) << "]" << std::endl; +#endif + + return *this; + }; + + protected: + inline void reference_restart(bool create_counter = false) + { + ReferenceData * oldref = _reference_count; + + _reference_count = (create_counter ? new ReferenceData() : 0); + + if (oldref) reference_disconnect(oldref); + } + + inline void reference_reflect(const ReferenceCounter & other) + { + ReferenceData * newref = other._reference_count; + ReferenceData * oldref = _reference_count; + + /* NOTE: increment before, avoid our reference being zero, even * + * for a short period of time. */ + + if (newref) newref->increment(); + + _reference_count = newref; + + if (oldref) reference_disconnect(oldref); + }; + + inline void reference_disconnect(ReferenceData *& counter) + { + if (counter) + { + unsigned int result = counter->decrement(); + + if (!result) + { + static_cast< Type * >(this)->unreference(); + delete counter; + } + + counter = 0; + } + }; + + private: + ReferenceData * _reference_count; +}; + +template < typename T > +struct ReferenceContainer: NEW_REFCOUNTER(ReferenceContainer< T >) +{ + /* type */ + typedef T Type; + + /* shorthand */ + typedef ReferenceCounter < ReferenceContainer< Type > > Counter; + + // TODO: make this a generic exception someday + struct NotFound {}; + + ReferenceContainer() + : Counter(false), + _reference_value(0) + {}; + + ReferenceContainer(Type * value) + : _reference_value(value) + {}; + + ReferenceContainer(const ReferenceContainer & value) + : Counter(false), + _reference_value(0) + { + operator()(value); + }; + + virtual ~ReferenceContainer() + {}; + + ReferenceContainer operator=(const ReferenceContainer & value) + { + operator()(value); + return *this; + }; + + /**/ + + void unreference() + { + if (_reference_value) + { + delete _reference_value; + _reference_value = 0; + } + } + + // simulates a copy constructor + void operator()(const ReferenceContainer & value) + { + Counter::reference_reflect(value); + + _reference_value = const_cast<Type *>(value._reference_value); + }; + + // shortcut for operator below + void operator=(const Type * value) + { + operator()(value); + }; + + // accept value (pointer)! + void operator()(const Type * value) + { + Counter::reference_restart((value != 0)); + + _reference_value = const_cast<Type *>(value); + }; + + // return value (pointer)! + Type * operator()(void) + { + return _reference_value; + }; + + protected: + Type * _reference_value; + + protected: +}; + +#endif /* _REFCOUNTER_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/regex.cpp b/src/mod/endpoints/mod_khomp/commons/regex.cpp new file mode 100644 index 0000000..61f941c --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/regex.cpp @@ -0,0 +1,148 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <regex.hpp> + +#include <string.h> + +void Regex::Expression::initialize(void) +{ + unsigned int tmplen = strlen(_expression); + + bool extflag = (_flags & E_EXTENDED); + + for (unsigned int i = 0; i < tmplen; ++i) + { + switch (_expression[i]) + { + case '\\': + ++i; + + if (!extflag && i < tmplen) + if (_expression[i] == '(') + ++_subcounter; + + break; + + case '(': + if (extflag) + ++_subcounter; + + default: + break; + } + } + + _errorstate = regcomp(&_comp_regex, _expression, _flags); +} + +std::string Regex::Expression::regerror_as_string(void) +{ + unsigned int count = regerror(_errorstate, &_comp_regex, 0, 0) + 1; + + char * msg = new char[count]; + + regerror(_errorstate, &_comp_regex, msg, count); + + std::string tmp(msg, count); + + delete[] msg; + + return tmp; +} + +void Regex::Match::initialize(void) +{ + if (_expression.valid()) + { + _subcounter = (_expression.subcount() + 2); // 0 + N.. + invalid + _submatches = new regmatch_t[_subcounter]; + _have_match = (regexec(_expression.repr(), _basestring.c_str(), + _subcounter, _submatches, _flags) == 0); + } +} + +std::string Regex::Match::replace(std::string rep, unsigned int index) +{ + ReplaceMap tmp; + tmp.insert(ReplacePair(index,rep)); + return replace(tmp); +} + +std::string Regex::Match::replace(Regex::ReplaceMap & map) +{ + if (!_have_match) + return _basestring; + + std::string buffer = _basestring; + + try + { + if (_submatches[0].rm_so != 0 && (map.find(0) != map.end())) + return _basestring.replace(_submatches[0].rm_so, _submatches[0].rm_eo - _submatches[0].rm_so, map.find(0)->second); + + for (unsigned int n = 1; (_submatches[n].rm_so != -1) && (n < _subcounter); n++) + { + //// s f RRR s f RRR s f RRRR s f + //// XXXYYY(ZZZ)AAA(BBB)CCCEEE(FFFF)GGGG + + bool globalsubs = false; + + if (map.find(n) == map.end()) + { + if (map.find(UINT_MAX) == map.end()) + continue; + + globalsubs = true; + } + + buffer = buffer.replace(_submatches[n].rm_so, + _submatches[n].rm_eo - _submatches[n].rm_so, + map.find((globalsubs ? UINT_MAX : n))->second); + } + } + catch (std::out_of_range e) + { + return ""; + } + + return buffer; +} diff --git a/src/mod/endpoints/mod_khomp/commons/regex.hpp b/src/mod/endpoints/mod_khomp/commons/regex.hpp new file mode 100644 index 0000000..daf2014 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/regex.hpp @@ -0,0 +1,252 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <sys/types.h> +#include <limits.h> +#include <stdarg.h> +#include <string.h> +#include <regex.h> + +#include <iostream> +#include <string> +#include <stdexcept> +#include <map> + +#include <refcounter.hpp> +#include <noncopyable.hpp> + +#ifndef _REGEX_HPP_ +#define _REGEX_HPP_ + +struct Regex +{ + enum + { + E_EXTENDED = REG_EXTENDED, + E_IGNORE_CASE = REG_ICASE, + E_NO_SUB_MATCH = REG_NOSUB, + E_EXPLICIT_NEWLINE = REG_NEWLINE, + }; + + enum + { + M_NO_BEGIN_OF_LINE = REG_NOTBOL, + M_NO_END_OF_LINE = REG_NOTEOL, + }; + + enum + { + /* mark replace for full match (submatch "0"). */ + REP_BASE = 0u, + /* mark global string for replace. */ + REP_ALL = UINT_MAX, + }; + + typedef std::pair < unsigned int, std::string > ReplacePair; + typedef std::map < unsigned int, std::string > ReplaceMap; + + struct Expression : public NonCopyable + { + Expression(const char * expression, unsigned int flags = 0) + : _expression(expression), _alloced(false), + _subcounter(0), _errorstate(INT_MAX), _flags(flags) + { + initialize(); + } + + Expression(std::string & expression, unsigned int flags = 0) + : _expression(strdup(expression.c_str())), _alloced(true), + _subcounter(0), _errorstate(INT_MAX), _flags(flags) + { + initialize(); + } + + ~Expression() + { + if (_errorstate != INT_MAX) + regfree(&_comp_regex); + + if (_alloced) + { + delete _expression; + _expression = 0; + } + } + + bool valid(void) { return (_errorstate == 0); } + + unsigned int subcount(void) { return _subcounter; } + const regex_t * repr(void) { return &_comp_regex; } + + std::string error(void) + { + switch (_errorstate) + { + case 0: return ""; + case INT_MAX: return "uninitialized"; + default: return regerror_as_string(); + } + } + + private: + void initialize(void); + std::string regerror_as_string(void); + + protected: + const char * _expression; + bool _alloced; + + unsigned int _subcounter; + + int _errorstate; + regex_t _comp_regex; + + unsigned int _flags; + }; + + struct Match: NEW_REFCOUNTER(Match) + { + Match(const char * basestring, Expression & expression, unsigned int flags = 0) + : _basestring(basestring), _expression(expression), _subcounter(0), _submatches(0), + _have_match(false), _flags(flags) + { + initialize(); + } + + Match(std::string & basestring, Expression & expression, unsigned int flags = 0) + : _basestring(basestring), _expression(expression), _subcounter(0), _submatches(0), + _have_match(false), _flags(flags) + { + initialize(); + } + + Match(const Match & o) + : INC_REFCOUNTER(o, Match), + _basestring(o._basestring), _expression(o._expression), + _subcounter(o._subcounter), _submatches(o._submatches), + _have_match(o._have_match), _flags(o._flags) + { + } + + void unreference() + { + delete[] _submatches; + } + + bool matched(void) + { + return _have_match; + } + + bool matched(unsigned int number) + { + if (_have_match && number < _subcounter) + return (_submatches[number].rm_so != -1); + + return false; + } + + std::string submatch(int number) + { + if (!matched(number)) + return ""; + + return _basestring.substr(_submatches[number].rm_so, + _submatches[number].rm_eo - _submatches[number].rm_so); + } + + /** + * \brief gets a map with all matches + * \return std::map<int,std::string> with all matches + * \note index 0 in map, is the complete string + * \author Eduardo Nunes Pereira + * + * If fails the empty map is returned + */ + std::map<int, std::string> obtain_match_map() + { + int match_counter = 0; + std::map<int,std::string> tmp_map; + while(matched(match_counter)) + { + tmp_map.insert(std::make_pair(match_counter,submatch(match_counter))); + match_counter++; + } + + return tmp_map; + } + + /** + * \brief replaces strings matched by parentesis + * \param each item of the vector is a parentesis replaced + * \return string replaced + * \note The overload method match only one string in parentesis. + * \author Eduardo Nunes Pereira + * + * If fails the empty string is returned. + */ + std::string replace(ReplaceMap &); + std::string replace(std::string, unsigned int index = REP_BASE); + + std::string operator[](int number) + { + return submatch(number); + } + + // NOTE: there is already a way to get subcount defined on EXPRESSION class! + + private: + void initialize(void); + + protected: + std::string _basestring; + Expression & _expression; + + unsigned int _subcounter; + regmatch_t * _submatches; + + bool _have_match; + unsigned int _flags; + }; +}; + +#endif /* _REGEX_HPP_ */ + diff --git a/src/mod/endpoints/mod_khomp/commons/ringbuffer.cpp b/src/mod/endpoints/mod_khomp/commons/ringbuffer.cpp new file mode 100644 index 0000000..428bd29 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/ringbuffer.cpp @@ -0,0 +1,575 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <ringbuffer.hpp> + +/********** BUFFER FUNCTIONS **********/ + +/* writes everything or nothing */ +bool Ringbuffer_traits::traits_provide(char * buffer, const char * value, unsigned int amount, bool skip_overwrite) +{ + /* avoid using different values */ + Buffer_table cache = _pointers; + + const unsigned int reader = cache.reader.complete; + const unsigned int writer = cache.writer.complete; + + const unsigned int dest = cache.writer.complete - 1; + + const bool reader_less = cache.reader.complete < cache.writer.complete; + + if (amount >= _size) + return false; + + bool ret = true; + + /* should we go around the buffer for writing? */ + if (((writer + amount) > _size) && (reader_less || !skip_overwrite)) + { + /* Documentation of the formula used in the 'if' below. + * + * [0|1|2|3|4|5|6|7] => size=8 + * | | + * reader | + * writer + * + * => writer has places [5,6,7,0,1] to write (5 places). + * + * => 8 - (4-2+1) = 8 - (2+1) = 8 - 3 = 5 + * + * > writer goes 1 up, amount goes 1 down. + * > reader goes 1 up, amount goes 1 up. + * > size goes 1 down, amount goes 1 down. + * + */ + + if ((_size - (writer - reader + 1)) <= amount) + { + if (skip_overwrite) + return false; + + do + { + Buffer_pointer extra(cache.reader); + extra.complete = (extra.complete + amount) % _size; + + if (update(cache.reader, extra)) + break; + } + while (true); + + ret = false; + } + + unsigned int wr1 = _size - writer + 1; /* writer is already 1 position after */ + unsigned int wr2 = amount - wr1; + +// fprintf(stderr, "%p> partial write: (%d/%d) %d/%d [%d/%d]\n", this, wr1, wr2, amount, _size, reader, writer); + + /* two partial writes (one at the end, another at the beginning) */ + memcpy((void *) &(buffer[dest]), (const void *) (value), _block * wr1); + memcpy((void *) (buffer), (const void *) &(value[wr1]), _block * wr2); + } + else + { + if (!reader_less && ((reader - writer) <= amount)) + { + if (skip_overwrite) + return false; + + do + { + Buffer_pointer extra(cache.reader); + extra.complete = (extra.complete + amount) % _size; + + if (update(cache.reader, extra)) + break; + } + while (true); + + ret = false; + } + +// fprintf(stderr, "%p> full write: a=%d/s=%d [r=%d/w=%d]\n", this, amount, _size, reader, writer); + + /* we are talking about buffers here, man! */ + memcpy((void *) &(buffer[dest]), (const void *) value, _block * amount); + } + + _pointers.writer.complete = ((dest + amount) % _size) + 1; + _pointers.writer.partial = 1; + +// fprintf(stderr, "%p> write end: %d [block=%d]\n", this, writer, _block); + + return ret; +} + +/* returns the number of itens that have been read */ +unsigned int Ringbuffer_traits::traits_consume(const char * buffer, char * value, unsigned int amount, bool atomic_mode) +{ + /* avoid using different values */ + Buffer_table cache = _pointers; + + const unsigned int writer = _pointers.writer.complete; + const unsigned int reader = _pointers.reader.complete; + + const bool writer_less = writer < reader; + + unsigned int total = 0; + + /* should we go around the buffer for reading? */ + if (writer_less && (reader + amount >= _size)) + { + total = std::min(_size - (reader - writer + 1), amount); + + if ((total == 0) || (atomic_mode && (total < amount))) + return 0; + + unsigned int rd1 = _size - reader; + unsigned int rd2 = total - rd1; + +// fprintf(stderr, "%p> partial read: (%d/%d) %d/%d [%d/%d]\n", this, rd1, rd2, total, _size, reader, writer); + + /* two partial consumes (one at the end, another at the beginning) */ + memcpy((void *) (value), (const void *) &(buffer[reader]), _block * rd1); + memcpy((void *) &(value[rd1]), (const void *) (buffer), _block * rd2); + } + else + { + total = std::min((!writer_less ? writer - (reader + 1) : amount), amount); + + if ((total == 0) || (atomic_mode && (total < amount))) + return 0; + +// fprintf(stderr, "%p> full read: %d/%d [%d/%d]\n", this, total, _size, reader, writer); + + /* we are talking about buffers here, man! */ + memcpy((void *) value, (const void *) &(buffer[reader]), _block * total); + } + + do + { + /* jump the reader forward */ + Buffer_pointer index((cache.reader.complete + total) % _size); + + if (update(cache.reader, index)) + break; + } + while (true); + +// fprintf(stderr, "%p> read end: %d [block=%d]\n", this, reader, _block); + + return total; +} + +/********** TWO-PHASE BUFFER FUNCTIONS ***********/ + +/* returns the number of itens that have been read */ +unsigned int Ringbuffer_traits::traits_consume_begins(const char * buffer, char * value, unsigned int amount, bool atomic_mode) +{ + Buffer_table cache = _pointers; + + /* avoid using different values */ + const unsigned int reader = cache.reader.complete; + const unsigned int writer = cache.writer.complete; + + const bool writer_less = writer < reader; + + unsigned int total = 0; + + /* should we go around the buffer for reading? */ + if (writer_less && (reader + amount >= _size)) + { + total = std::min(_size - (reader - writer + 1), amount); + + if ((total == 0) || (atomic_mode && (total < amount))) + return 0; + + unsigned int rd1 = _size - reader; + unsigned int rd2 = total - rd1; + +// fprintf(stderr, "%p> partial read: (%d/%d) %d/%d [%d/%d]\n", this, rd1, rd2, total, _size, reader, writer); + + /* two partial consumes (one at the end, another at the beginning) */ + memcpy((void *) (value), (const void *) &(buffer[reader]), _block * rd1); + memcpy((void *) &(value[rd1]), (const void *) (buffer), _block * rd2); + } + else + { + total = std::min((!writer_less ? writer - (reader + 1) : amount), amount); + + if ((total == 0) || (atomic_mode && (total < amount))) + return 0; + +// fprintf(stderr, "%p> full read: %d/%d [%d/%d]\n", this, total, _size, reader, writer); + + /* we are talking about buffers here, man! */ + memcpy((void *) value, (const void *) &(buffer[reader]), _block * total); + } + +// fprintf(stderr, "%p> read end: %d [%d]\n", this, _reader, _reader_partial); + + return total; +} + +bool Ringbuffer_traits::traits_consume_commit(unsigned int amount) +{ + /* avoid using different values */ + Buffer_table cache = _pointers; + + const unsigned int writer = cache.writer.complete; + const unsigned int reader = cache.reader.complete; + + const bool writer_less = writer < reader; + + unsigned int total = 0; + + /* should we go around the buffer for reading? */ + if (writer_less && (reader + amount >= _size)) + { + total = std::min(_size - (reader - writer + 1), amount); + + if (total < amount) + return false; + +// fprintf(stderr, "%p> partial read: (%d/%d) %d/%d [%d/%d]\n", this, rd1, rd2, total, _size, reader, writer); + } + else + { + total = std::min((!writer_less ? writer - (reader + 1) : amount), amount); + + if (total < amount) + return false; + +// fprintf(stderr, "%p> full read: %d/%d [%d/%d]\n", this, total, _size, reader, writer); + } + + do + { + /* jump the reader forward */ + Buffer_pointer index(cache.reader); + index.complete = (index.complete + total) % _size; + + if (update(cache.reader, index)) + break; + } + while (true); + +// fprintf(stderr, "%p> read end: %d [%d]\n", this, _reader, _reader_partial); + + return true; +} + +/********** PARTIAL BUFFER FUNCTIONS (bytes) ***********/ + +/* writes everything or nothing */ +bool Ringbuffer_traits::traits_provide_partial(char * buffer, const char * value, unsigned int amount) +{ + /* avoid using different values */ + Buffer_table cache = _pointers; + + const unsigned int reader = (cache.reader.complete * _block) + cache.reader.partial; + const unsigned int writer = ((cache.writer.complete - 1) * _block) + cache.writer.partial; + + const unsigned int size = _size * _block; + const unsigned int dest = writer - 1; + +// fprintf(stderr, "%p> provide partial: %d/%d [%d/%d]\n", this, reader, writer, amount, size); + + const bool reader_less = reader < writer; + + /* should we go around the buffer for writing? */ + if (reader_less && ((writer + amount) > size)) + { + /* Documentation of the formula used in the 'if' below. + * + * [0|1|2|3|4|5|6|7] => size=8 + * | | + * reader | + * writer + * + * => writer has places [5,6,7,0,1] to write (5 places). + * + * => 8 - (4-2+1) = 8 - (2+1) = 8 - 3 = 5 + * + * > writer goes 1 up, amount goes 1 down. + * > reader goes 1 up, amount goes 1 up. + * > size goes 1 down, amount goes 1 down. + * + */ + + if ((size - (writer - reader + 1)) <= amount) + return false; + + unsigned int wr1 = size - writer + 1; /* writer is already 1 position after */ + unsigned int wr2 = amount - wr1; + +// fprintf(stderr, "%p> p partial write: (%d/%d) %d/%d [%d/%d]\n", this, wr1, wr2, amount, size, reader, writer); + + /* two partial writes (one at the end, another at the beginning) */ + memcpy((void *) &(buffer[dest]), (const void *) (value), wr1); + memcpy((void *) (buffer), (const void *) &(value[wr1]), wr2); + } + else + { + if (!reader_less && ((reader - writer) <= amount)) + return false; + +// fprintf(stderr, "%p> p full write: %d/%d [r=%d/w=%d]\n", this, amount, size, reader, writer); + + /* we are talking about buffers here, man! */ + memcpy((void *) &(buffer[dest]), (const void *) value, amount); + } + + unsigned int new_writer = ((dest + amount) % size) + 1; + + /* update "full length position" */ + _pointers.writer.complete = (unsigned int)floor((double) new_writer / (double)_block)+1; + _pointers.writer.partial = (unsigned short)(new_writer % _block); + +// fprintf(stderr, "%p> p write end: %d [block=%d]\n", this, new_writer, _block); + + return true; +} + +/* returns the number of bytes that have been read */ +unsigned int Ringbuffer_traits::traits_consume_partial(const char * buffer, char * value, unsigned int amount) +{ + /* avoid using different values */ + Buffer_table cache = _pointers; + + const unsigned int writer = ((cache.writer.complete - 1) * _block) + cache.writer.partial; + const unsigned int reader = (cache.reader.complete * _block) + cache.reader.partial; + + const unsigned int size = _size * _block; + +// fprintf(stderr, "%p> consume partial: %d/%d [%d/%d]\n", this, reader, writer, amount, size); + + const bool writer_less = writer < reader; + + unsigned int total = 0; + + /* should we go around the buffer for reading? */ + if (writer_less && (reader + amount >= size)) + { + total = std::min(size - (reader - writer + 1), amount); + + if (total == 0) + return 0; + + unsigned int rd1 = size - reader; + unsigned int rd2 = total - rd1; + +// fprintf(stderr, "%p> p partial read: (%d/%d) %d/%d [%d/%d]\n", this, rd1, rd2, total, size, reader, writer); + + /* two partial consumes (one at the end, another at the beginning) */ + memcpy((void *) (value), (const void *) &(buffer[reader]), rd1); + memcpy((void *) &(value[rd1]), (const void *) (buffer), rd2); + } + else + { + total = std::min((writer_less ? amount : writer - (reader + 1)), amount); + + if (total == 0) + return 0; + +// fprintf(stderr, "%p> p full read: %d/%d [r=%d/w=%d]\n", this, total, size, reader, writer); + + /* we are talking about buffers here, man! */ + memcpy((void *) value, (const void *) &(buffer[reader]), total); + } + + do + { + unsigned int new_reader = (((cache.reader.complete * _block) + cache.reader.partial) + total) % size; + + /* jump the reader forward */ + Buffer_pointer index((unsigned int)floor((double)new_reader / (double)_block), + (unsigned short)(new_reader % _block)); + + if (update(cache.reader, index)) + { +// fprintf(stderr, "%p> p read end: %d [block=%d]\n", this, new_reader, _block); + break; + } + } + while (true); + + return total; +} + + + +/********** IO FUNCTIONS **********/ + +/* returns the number of items written to from buffer to stream */ +unsigned int Ringbuffer_traits::traits_put(const char * buffer, std::ostream &fd, unsigned int amount) +{ + /* avoid using different values */ + Buffer_table cache = _pointers; + + const unsigned int reader = cache.reader.complete; + const unsigned int writer = cache.writer.complete; + + const bool writer_less = writer < reader; + + unsigned int total = 0; + + /* should we go around the buffer for reading? */ + if (writer_less && (reader + amount >= _size)) + { + total = std::min(_size - (reader - writer + 1), amount); + + if (total == 0) + return 0; + + unsigned int rd1 = _size - reader; + unsigned int rd2 = total - rd1; + +// fprintf(stderr, "%p> partial read: (%d/%d) %d/%d [%d/%d]\n", this, rd1, rd2, total, _size, reader, writer); + + /* two partial consumes (one at the end, another at the beginning) */ + fd.write((const char *) &(buffer[reader]), _block * rd1); + fd.write((const char *) (buffer), _block * rd2); + } + else + { + total = std::min((!writer_less ? writer - (reader + 1) : amount), amount); + + if (total == 0) + return 0; + +// fprintf(stderr, "%p> full read: %d/%d [%d/%d]\n", this, total, _size, reader, writer); + + /* we are talking about buffers here, man! */ + fd.write((const char *) &(buffer[reader]), _block * total); + } + + do + { + /* jump the reader forward */ + Buffer_pointer index(cache.reader); + index.complete = (index.complete + total) % _size; + + if (update(cache.reader, index)) + break; + } + while (true); + + return total; +} + +/* returns number of items read from stream to buffer */ +unsigned int Ringbuffer_traits::traits_get(char * buffer, std::istream &fd, unsigned int amount) +{ + /* avoid using different values */ + Buffer_table cache = _pointers; + + const unsigned int reader = cache.reader.complete; + const unsigned int writer = cache.writer.complete; + + const unsigned int dest = writer - 1; + + const bool reader_less = reader < writer; + + unsigned int real_amount = 0; + + /* should we go around the buffer for writing? */ + if (reader_less && ((writer + amount) > _size)) + { + /* Documentation of the formula used in the 'if' below. + * + * [0|1|2|3|4|5|6|7] => size=8 + * | | + * reader | + * writer + * + * => writer has places [5,6,7,0,1] to write (5 places). + * + * => 8 - (4-2+1) = 8 - (2+1) = 8 - 3 = 5 + * + * > writer goes 1 up, amount goes 1 down. + * > reader goes 1 up, amount goes 1 up. + * > size goes 1 down, amount goes 1 down. + * + */ + + if ((_size - (writer - reader + 1)) <= amount) + return false; + + unsigned int wr1 = _size - writer + 1; /* writer is already 1 position after */ + unsigned int wr2 = amount - wr1; + +// fprintf(stderr, "%p> partial write: (%d/%d) %d/%d [%d/%d]\n", this, wr1, wr2, amount, _size, reader, writer); + + unsigned int char_amount = 0; + + /* one partial write on the buffer (at the end) */ + fd.read((char *) &(buffer[dest]), _block * wr1); + char_amount += fd.gcount(); + + if (fd.gcount() == (int)(_block * wr1)) + { + /* another partial write on the buffer (at the beginning) */ + fd.read((char *) (buffer), _block * wr2); + char_amount += fd.gcount(); + } + + real_amount = char_amount / _block; + } + else + { + if (!reader_less && ((reader - writer) <= amount)) + return false; + +// fprintf(stderr, "%p> full write: %d/%d [%d/%d]\n", this, amount, _size, reader, writer); + + /* we are talking about buffers here, man! */ + fd.read((char *) &(buffer[dest]), _block * amount); + + real_amount = fd.gcount() / _block; + } + + _pointers.writer.complete = ((dest + real_amount) % _size) + 1; + _pointers.writer.partial = 1; + + return real_amount; +} diff --git a/src/mod/endpoints/mod_khomp/commons/ringbuffer.hpp b/src/mod/endpoints/mod_khomp/commons/ringbuffer.hpp new file mode 100644 index 0000000..39f8ffe --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/ringbuffer.hpp @@ -0,0 +1,416 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +/* WARNING: This is a generic ringbuffer abstraction, which works for single-sized elements, + partial elements, single/multi-elements read/writes. It is not wise to mix some + functions (partial element write / full element write), since it was not designed + with this use in mind. + + Also, it works only for single-reader + single-writer, since it does not depends + on external mutex functions. + */ + +#include <string.h> + +#include <cmath> +#include <iostream> + +#include <noncopyable.hpp> +#include <atomic.hpp> + +#ifndef _RINGBUFFER_HPP_ +#define _RINGBUFFER_HPP_ + +struct Buffer_pointer +{ + Buffer_pointer(unsigned int _complete = 0u, unsigned short _partial = 0u) + : complete(_complete), partial(_partial) + {}; + + Buffer_pointer(const Buffer_pointer & o) + : complete(o.complete), partial(o.partial) + {}; + + Buffer_pointer(const volatile Buffer_pointer & o) + : complete(o.complete), partial(o.partial) + {}; + + void operator=(const volatile Buffer_pointer o) + { + complete = o.complete; + partial = o.partial; + } + + void operator=(const Buffer_pointer o) volatile + { + complete = o.complete; + partial = o.partial; + } + + bool operator==(const Buffer_pointer & o) + { + return (complete == o.complete && partial == o.partial); + } + + unsigned int complete:20; + unsigned short partial:12; +} +__attribute__((packed)); + +struct Buffer_table +{ + Buffer_table() + : reader(0,0), + writer(1,1) + {}; + + Buffer_table(const Buffer_table & o) + : reader(o.reader), writer(o.writer) + {}; + + Buffer_table(const volatile Buffer_table & o) + : reader(o.reader), writer(o.writer) + {}; + + void operator=(const volatile Buffer_table o) + { + reader = o.reader; + writer = o.writer; + } + + void operator=(const Buffer_table o) volatile + { + reader = o.reader; + writer = o.writer; + } + + bool operator==(const Buffer_table & o) + { + return (reader == o.reader && writer == o.writer); + } + + Buffer_pointer reader; + Buffer_pointer writer; +} +__attribute__((packed)); + +struct Ringbuffer_traits +{ + Ringbuffer_traits(unsigned int block, unsigned int size) + : _block(block), _size(size) + {}; + + bool traits_provide( char *, const char *, unsigned int, bool); + unsigned int traits_consume(const char *, char *, unsigned int, bool); + + unsigned int traits_consume_begins(const char *, char *, unsigned int, bool); + bool traits_consume_commit(unsigned int); + + bool traits_provide_partial( char *, const char *, unsigned int); + unsigned int traits_consume_partial(const char *, char *, unsigned int); + + unsigned int traits_get( char *, std::istream &, unsigned int); + unsigned int traits_put(const char *, std::ostream &, unsigned int); + + bool update(Buffer_pointer & cache, Buffer_pointer & update) + { + return Atomic::doCAS(&(_pointers.reader), &cache, update); + } + + protected: + const unsigned int _block; + const unsigned int _size; + + volatile Buffer_table _pointers; +}; + +template <typename T> +struct Ringbuffer: protected Ringbuffer_traits, public NonCopyable +{ + struct BufferFull {}; + struct BufferEmpty {}; + + Ringbuffer(unsigned int size) + : Ringbuffer_traits(sizeof(T), size) + { + _buffer = new T[_size]; + _malloc = true; + }; + + Ringbuffer(unsigned int size, T * buffer) + : Ringbuffer_traits(sizeof(T), size) + { + _buffer = buffer; + _malloc = false; + }; + + ~Ringbuffer() + { + if (_malloc) + delete[] _buffer; + } + + /***** GENERIC RANGE/INDEX CALCULATION FUNCTIONS *****/ + bool may_write(Buffer_table & cache) + { + const unsigned int r = cache.reader.complete; + const unsigned int w = cache.writer.complete; + + return (((r - w) != 1) && (!(r == 0 && w == _size))); + } + + bool may_read(Buffer_table & cache) + { + if ((cache.writer.complete - cache.reader.complete) == 1) + return false; + + return true; + } + + unsigned int writer_next(Buffer_pointer & cache, Buffer_pointer & index) + { + unsigned int dest = cache.complete - 1, + temp = cache.complete + 1; + + if (temp > _size) index.complete = 1; + else index.complete = temp; + + index.partial = 1; + + return dest; + }; + + void reader_next(Buffer_pointer & cache, Buffer_pointer & index) + { + unsigned int temp = cache.complete + 1; + + if (temp == _size) index.complete = 0; + else index.complete = temp; + + index.partial = 0; + } + + /***** BUFFER FUNCTIONS *****/ + + bool provide(const T & value) + { + Buffer_table cache = _pointers; + Buffer_pointer index = _pointers.writer; + + if (!may_write(cache)) + return false; + +// fprintf(stderr, "%p> provide %d/%d!\n", this, reader, writer); + + unsigned int dest = writer_next(cache.writer, index); + + _buffer[dest] = value; + + _pointers.writer = index; + +// fprintf(stderr, "%p> write: %d/%d [%d/%d]\n", this, _pointers.reader, _pointers.writer, _pointers.reader_partial, _pointers.writer_partial); + + return true; + } + + bool consume(T & value) + { + Buffer_table cache = _pointers; + Buffer_pointer index = _pointers.reader; + + if (!may_read(cache)) + return false; + +// fprintf(stderr, "%p> consume %d/%d!\n", this, reader, writer); + + value = _buffer[index.complete]; + + do + { + reader_next(cache.reader, index); + + if (update(cache.reader, index)) + break; + + cache.reader = index; + } + while (true); + +// fprintf(stderr, "%p> read: %d/%d [%d/%d]\n", this, _pointers.reader, _pointers.writer, _pointers.reader_partial, _pointers.writer_partial); + + return true; + } + + /* writes everything or nothing */ + inline bool provide(const T * value, unsigned int amount, bool skip_overwrite = true) + { + return traits_provide((char *)_buffer, (const char *) value, amount, skip_overwrite); + } + + /* returns the number of items that have been read (atomic_mode == true means 'all or nothing') */ + inline unsigned int consume(T * value, unsigned int amount, bool atomic_mode = false) + { + return traits_consume((const char *)_buffer, (char *) value, amount, atomic_mode); + } + + /***** TWO-PHASE BUFFER FUNCTIONS *****/ + + /* returns the number of items that have been read (atomic_mode == true means 'all or nothing') */ + inline unsigned int consume_begins(T * value, unsigned int amount, bool atomic_mode = false) + { + return traits_consume_begins((const char *)_buffer, (char *) value, amount, atomic_mode); + } + + /* returns true if we could commit that much of buffer (use only after consume_begins). * + * note: you may commit less bytes that have been read to keep some data inside the buffer */ + inline bool consume_commit(unsigned int amount) + { + return traits_consume_commit(amount); + } + + /***** TWO-PHASE SINGLE-ELEMENT BUFFER FUNCTIONS *****/ + + T & provider_start(void) + { + Buffer_table cache = _pointers; + + if (!may_write(cache)) + throw BufferFull(); + + unsigned writer = _pointers.writer.complete - 1; + +// fprintf(stderr, "%p> provider start %d/%d!\n", this, reader, writer); + + return _buffer[writer]; + } + + void provider_commit(void) + { + unsigned int temp = _pointers.writer.complete + 1; + +// fprintf(stderr, "%p> provider commit %d!\n", this, temp); + + if (temp > _size) + temp = 1; + + _pointers.writer.complete = temp; + _pointers.writer.partial = 1; + +// fprintf(stderr, "%p> write: %d/%d [%d/%d]\n", this, _pointers.reader, _pointers.writer, _pointers.reader_partial, _pointers.writer_partial); + } + + T & consumer_start(void) + { + Buffer_table cache = _pointers; + + if (!may_read(cache)) + throw BufferEmpty(); + + unsigned int reader = _pointers.reader.complete; + +// fprintf(stderr, "%p> consumer start %d/%d!\n", this, reader, writer); + + return _buffer[reader]; + } + + void consumer_commit(void) + { + Buffer_pointer cache = _pointers.reader; + Buffer_pointer index(cache); + + do + { + reader_next(cache, index); + + if (update(cache, index)) + break; + + cache = index; + } + while (true); + +// fprintf(stderr, "%p> consumer commit %d!\n", this, temp); + +// fprintf(stderr, "%p> read: %d/%d [%d/%d]\n", this, _pointers.reader, _pointers.writer, _pointers.reader_partial, _pointers.writer_partial); + } + + /* writes everything or nothing, but works on bytes (may write incomplete elements) */ + /* WARNING: do not mix this with full element provider */ + inline bool provider_partial(const char *buffer, unsigned int amount) + { + return traits_provide_partial((char *)_buffer, buffer, amount); + } + + /* returns the number of bytes that have been read (may read incomplete elements) */ + /* WARNING: do not mix this with full element consumer */ + inline unsigned int consumer_partial(char *buffer, unsigned int amount) + { + return traits_consume_partial((const char *)_buffer, buffer, amount); + } + + /***** IO FUNCTIONS *****/ + + /* returns the number of items written to from buffer to stream */ + inline unsigned int put(std::ostream &fd, unsigned int amount) + { + return traits_put((char *)_buffer, fd, amount); + } + + /* returns number of items read from stream to buffer */ + inline unsigned int get(std::istream &fd, unsigned int amount) + { + return traits_get((const char *)_buffer, fd, amount); + } + + void clear() + { + _pointers.reader.complete = 0; + _pointers.reader.partial = 0; + _pointers.writer.complete = 1; + _pointers.writer.partial = 1; + } + + protected: + T * _buffer; + bool _malloc; +}; + +#endif /* _RINGBUFFER_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/saved_condition.cpp b/src/mod/endpoints/mod_khomp/commons/saved_condition.cpp new file mode 100644 index 0000000..4c9f80f --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/saved_condition.cpp @@ -0,0 +1,46 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + + +#include <config_commons.hpp> + +#include COMMONS_INCLUDE(saved_condition.cpp) + diff --git a/src/mod/endpoints/mod_khomp/commons/saved_condition.hpp b/src/mod/endpoints/mod_khomp/commons/saved_condition.hpp new file mode 100644 index 0000000..dcfd224 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/saved_condition.hpp @@ -0,0 +1,61 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#ifndef _SAVED_CONDITION_COMMON_HPP_ +#define _SAVED_CONDITION_COMMON_HPP_ + +#include <config_commons.hpp> + +//#include <refcounter.hpp> + +struct SavedConditionCommon +{ + SavedConditionCommon() : _signaled(false) {} + + protected: + bool _signaled; +}; + + +#include COMMONS_INCLUDE(saved_condition.hpp) + +#endif /* _SAVED_CONDITION_COMMON_HPP_ */ + diff --git a/src/mod/endpoints/mod_khomp/commons/scoped_lock.hpp b/src/mod/endpoints/mod_khomp/commons/scoped_lock.hpp new file mode 100644 index 0000000..a85627f --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/scoped_lock.hpp @@ -0,0 +1,95 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <simple_lock.hpp> + +struct ScopedLockBasic +{ + ScopedLockBasic(void) + : _locked(true) {}; + + ScopedLockBasic(bool locked) + : _locked(locked) {}; + + virtual ~ScopedLockBasic() {}; + + protected: + bool _locked; +}; + + +struct ScopedLock : public ScopedLockBasic +{ + struct LockFailed {}; + + ScopedLock(SimpleLock & mutex) + : ScopedLockBasic(false), _mutex(mutex) + { + switch (_mutex.lock()) + { + case SimpleLock::ISINUSE: + case SimpleLock::FAILURE: + throw LockFailed(); + default: + break; + } + + _locked = true; + } + + ~ScopedLock() + { + unlock(); + } + + void unlock() + { + if (_locked) + { + _locked = false; + _mutex.unlock(); + } + } + + protected: + SimpleLock & _mutex; +}; + diff --git a/src/mod/endpoints/mod_khomp/commons/simple_lock.hpp b/src/mod/endpoints/mod_khomp/commons/simple_lock.hpp new file mode 100644 index 0000000..4f6619f --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/simple_lock.hpp @@ -0,0 +1,104 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#ifndef _SIMPLE_LOCK_COMMON_HPP_ +#define _SIMPLE_LOCK_COMMON_HPP_ + +#include <config_commons.hpp> + +#include <unistd.h> +#include <noncopyable.hpp> + +#include <refcounter.hpp> + +/* This struct uses static polymorphism, and derived classes should implement * + * the "lock/trylock/unlock()" methods for correct code compilation. * + * The base class also features reference counting, so derived classes should * + * implement the "unreference()" method for releasing resources. */ + +template < typename Implementor > +struct SimpleLockCommon: NEW_REFCOUNTER( SimpleLockCommon < Implementor > ) +{ + friend class ReferenceCounter < SimpleLockCommon < Implementor > >; + + typedef enum + { + ISINUSE = 0, // operation not succeded (no error) + SUCCESS = 1, // operation succeded (no error) + FAILURE = 2, // mutex or state is somehow invalid (error! run for your life!) + } + Result; + + SimpleLockCommon() + {}; + + SimpleLockCommon(const SimpleLockCommon & o) + : INC_REFCOUNTER(o, SimpleLockCommon) + {}; + + virtual ~SimpleLockCommon() + {}; + + inline Result lock() + { + return static_cast<Implementor*>(this)->lock(); + } + + inline Result trylock() + { + return static_cast<Implementor*>(this)->trylock(); + } + + inline void unlock() + { + static_cast<Implementor*>(this)->unlock(); + } + + protected: + void unreference(void) + { + static_cast<Implementor*>(this)->unreference(); + } +}; + +#include COMMONS_INCLUDE(simple_lock.hpp) + +#endif /* _SIMPLE_LOCK_COMMON_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/strings.cpp b/src/mod/endpoints/mod_khomp/commons/strings.cpp new file mode 100644 index 0000000..5e1cbc7 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/strings.cpp @@ -0,0 +1,247 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <strings.hpp> + +void Strings::Merger::add(std::string s) +{ + _list.push_back(s); +}; + +std::string Strings::Merger::merge(const std::string & sep) +{ + list_type::iterator i = _list.begin(); + + std::string res; + + if (i != _list.end()) + { + res += (*i); + ++i; + }; + + while (i != _list.end()) + { + res += sep; + res += (*i); + ++i; + } + + return res; +}; + +std::string Strings::Merger::merge(const char *sep) +{ + std::string ssep(sep); + return merge(ssep); +} + +unsigned int Strings::tokenize(const std::string & str, Strings::vector_type & tokens, + const std::string & delims, long int max_tokens, bool keep_empty) +{ + std::string::size_type base = 0; + + std::string::size_type init = str.find_first_not_of(delims, 0); + std::string::size_type fini = str.find_first_of(delims, init); + + long int cur_token = 1; + + while (std::string::npos != init) + { + if (keep_empty && base < init) + { + std::string::size_type cur_empty = init - base; + + while (cur_empty && cur_token < max_tokens) + { + tokens.push_back(""); + + ++cur_token; + --cur_empty; + } + } + + if (std::string::npos != fini && cur_token < max_tokens) + { + base = fini + 1; + + tokens.push_back(str.substr(init, fini - init)); + ++cur_token; + } + else + { + base = str.size(); // find_first_of(delims, init); + + tokens.push_back(str.substr(init, str.size() - init)); + break; + } + + init = str.find_first_not_of(delims, fini); + fini = str.find_first_of(delims, init); + } + + if (keep_empty && base != str.size()) + { + std::string::size_type cur_empty = str.size() - base + 1; + + while (cur_empty && cur_token < max_tokens) + { + tokens.push_back(""); + + ++cur_token; + --cur_empty; + } + + if (cur_empty) + { + std::string::size_type pos = base + cur_empty - 1; + tokens.push_back(str.substr(pos, str.size() - pos)); + ++cur_token; + } + } + + return (cur_token - 1); +} + +bool Strings::toboolean(std::string str) +{ + std::string tmp(str); + + Strings::lower(tmp); + + if ((tmp == "true") || (tmp == "yes")) return true; + if ((tmp == "false") || (tmp == "no")) return false; + + throw invalid_value(str); +} + +long Strings::tolong(std::string str, int base) +{ + char *str_end = 0; + + unsigned long value = strtol(str.c_str(), &str_end, base); + + if (str_end && *str_end == 0) + return value; + + throw invalid_value(str); +} + +unsigned long Strings::toulong(std::string str, int base) +{ + char *str_end = 0; + + unsigned long value = strtoul(str.c_str(), &str_end, base); + + if (str_end && *str_end == 0) + return value; + + throw invalid_value(str); +} + +unsigned long long Strings::toulonglong(std::string str, int base) +{ +#if defined(_WINDOWS) || defined(_Windows) || defined(_WIN32) || defined(WIN32) + throw not_implemented(); +#else + char *str_end = 0; + + unsigned long long value = strtoull(str.c_str(), &str_end, base); + + if (str_end && *str_end == 0) + return value; + + throw invalid_value(str); +#endif +} + +double Strings::todouble(std::string str) +{ + char *str_end = 0; + + double value = strtod(str.c_str(), &str_end); + + if (str_end && *str_end == 0) + return value; + + throw invalid_value(str); +} + +std::string Strings::fromboolean(bool value) +{ + if (value) return "true"; + else return "false"; +} + +std::string Strings::lower(std::string str) +{ + std::string res; + + for (std::string::iterator i = str.begin(); i != str.end(); i++) + res += tolower((*i)); + + return res; +} + +std::string Strings::hexadecimal(std::string value) +{ + std::string result; + + for (std::string::iterator i = value.begin(); i != value.end(); i++) + { + if (i != value.begin()) + result += " "; + + result += STG(FMT("%2x") % (unsigned int)(*i)); + } + + return result; +} + +std::string Strings::trim(const std::string& str, const std::string& trim_chars) +{ + std::string result(str); + + result.erase( result.find_last_not_of( trim_chars ) + 1 ); + result.erase( 0, result.find_first_not_of( trim_chars ) ); + + return result; +} diff --git a/src/mod/endpoints/mod_khomp/commons/strings.hpp b/src/mod/endpoints/mod_khomp/commons/strings.hpp new file mode 100644 index 0000000..056b933 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/strings.hpp @@ -0,0 +1,106 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <limits.h> + +#include <list> +#include <vector> +#include <string> + +#include <types.hpp> + +#include <format.hpp> + +/* Generic string funcions */ + +#ifndef _STRINGS_HPP_ +#define _STRINGS_HPP_ + +struct Strings +{ + typedef std::list<std::string> list_type; + typedef std::vector<std::string> vector_type; + + struct Merger + { + void add(std::string); + + std::string merge(const std::string &); + std::string merge(const char *); + + bool empty() { return _list.empty(); }; + + protected: + list_type _list; + }; + + public: + struct invalid_value + { + invalid_value(const char * value): _value(value) {}; + invalid_value(std::string value): _value(value) {}; + + std::string & value() { return _value; } + + protected: + std::string _value; + }; + + struct not_implemented {}; + + static unsigned int tokenize(const std::string &, vector_type &, const std::string & delims = ",;:", + long int max_toxens = LONG_MAX, bool keep_empty = true); + + static bool toboolean(std::string); + static std::string fromboolean(bool); + + static long tolong(std::string, int base = 10); + static unsigned long toulong(std::string, int base = 10); + static unsigned long long toulonglong(std::string, int base = 10); + static double todouble(std::string); + + static std::string lower(std::string); + static std::string hexadecimal(std::string); + + static std::string trim(const std::string&, const std::string& trim_chars = " \f\n\r\t\v"); +}; + +#endif // _STRINGS_HPP_ // diff --git a/src/mod/endpoints/mod_khomp/commons/tagged_union.hpp b/src/mod/endpoints/mod_khomp/commons/tagged_union.hpp new file mode 100644 index 0000000..1616268 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/tagged_union.hpp @@ -0,0 +1,307 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#ifndef _TAGGED_UNION_HPP_ +#define _TAGGED_UNION_HPP_ + +#include <stdexcept> + +#include <iostream> +#include <unistd.h> + +namespace Tagged +{ + struct EmptyUnion + { + friend class Value; + + EmptyUnion() + : _adjusted(false) {}; + + // copy constructor + EmptyUnion(const EmptyUnion & o) + : _adjusted(o._adjusted) {}; + + // copy assignment operator + EmptyUnion & operator=(const EmptyUnion & o) + { + _adjusted = o._adjusted; + return *this; + }; + + ~EmptyUnion() { _adjusted = false; }; + + bool operator==(const EmptyUnion & o) + { + return true; + }; + + public: + void clear(void) { _adjusted = false; }; + protected: + void setup(void) { _adjusted = true; }; + + protected: + bool value_set(void) { return false; }; + bool value_get(void) { return false; }; + + bool value_check(void) { return false; }; + + template < typename S > + bool value_visit(S & visitor, typename S::ReturnType & ret) + { + return false; + }; + + template < typename S > + bool value_visit_void(S & visitor) + { + return false; + }; + + bool adjusted() { return _adjusted; }; + + private: + bool _adjusted; + }; + + template < typename V, typename E = EmptyUnion > + struct Union: public E + { + friend class Value; + + // default constructor + Union() + : _value(0) {}; + + // constructor with initializer + template < typename U > + Union( U value ) + : _value(0) + { + set(value); + }; + + // copy constructor + Union(const Union & o) + : E(static_cast<const E&>(o)), + _value( (o._value ? new const V(*(o._value)) : 0) ) + {}; + + // copy assignment operator + Union & operator=(const Union & o) + { + if (_value) + { + delete _value; + _value = 0; + } + + if (o._value) + { + _value = new const V(*(o._value)); + } + + E::operator=(static_cast<const E&>(o)); + + return *this; + }; + + // destructor + ~Union() + { + if (_value) + { + delete _value; + _value = 0; + } + }; + + // equal sign operator + template < typename U > + void operator=(U value) + { + set(value); + } + + template < typename U > + bool check(void) + { + return value_check(static_cast<const U * const>(0)); + }; + + template < typename U > + const U & get(void) + { + const U * res = 0; + + if (!value_get(&res) || !res) + throw std::runtime_error("type mismatch"); + + return *res; + }; + + template < typename U > + void set(U val) + { + if (E::adjusted()) + clear(); + + if (!value_set(val)) + throw std::runtime_error("unable to set value of invalid type"); + }; + + template < typename S > + typename S::ReturnType visit(S visitor) + { + typename S::ReturnType ret; + + if (!value_visit(visitor, ret)) + throw std::runtime_error("unable to visit empty value"); + + return ret; + }; + + template < typename S > + void visit_void(S visitor) + { + if (!value_visit_void(visitor)) + throw std::runtime_error("unable to visit empty value"); + }; + + void clear() + { + if (_value) + { + delete _value; + _value = 0; + } + + E::clear(); + }; + + // compare (equal) operator + bool operator==(const Union & o) + { + bool are_equal = false; + + if (!_value && !(o._value)) + are_equal = true; + + if (_value && o._value) + are_equal = (*_value == *(o._value)); + + if (are_equal) + return E::operator==(static_cast<const E&>(o)); + + return false; + }; + + // compare types + bool sameType(const Union & o) + { + if ((!(_value) && !(o._value)) || (_value && o._value)) + return E::operator==(static_cast<const E&>(o)); + + return false; + }; + + protected: + using E::value_set; + using E::value_get; + + using E::value_check; + using E::value_visit; + using E::value_visit_void; + + bool value_set(V val) + { + _value = new const V(val); + E::setup(); + + return true; + }; + + bool value_get(const V ** val) + { + if (!_value) + return false; + + *val = _value; + return true; + } + + bool value_check(const V * const junk) + { + (void)junk; + return (_value != 0); + }; + + template < typename S > + bool value_visit(S & visitor, typename S::ReturnType & ret) + { + if (_value) + { + ret = visitor(*const_cast<V*>(_value)); + return true; + }; + + return E::value_visit(visitor, ret); + }; + + template < typename S > + bool value_visit_void(S & visitor) + { + if (_value) + { + visitor(*const_cast<V*>(_value)); + return true; + }; + + return E::value_visit_void(visitor); + }; + + private: + const V * _value; + }; +}; + +#endif /* _TAGGED_UNION_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/thread.hpp b/src/mod/endpoints/mod_khomp/commons/thread.hpp new file mode 100644 index 0000000..e00d7c8 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/thread.hpp @@ -0,0 +1,103 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#ifndef _THREAD_COMMON_HPP_ +#define _THREAD_COMMON_HPP_ + +#include <config_commons.hpp> + +#include <types.hpp> +//#include <function.hpp> + +struct ThreadCommon +{ + protected: + template<typename FuncPtrType> + struct DecomposeFuncPtr; + + template<typename ReturnType, typename ArgType> + struct DecomposeFuncPtr<ReturnType(*)(ArgType)> + { + typedef ReturnType Return; + }; + + template<typename SomeClass> + struct DecomposeFuncPtr + { + typedef void Return; + }; + + template<typename ReturnType> + struct DecomposeFuncPtr<ReturnType(*)()> + { + typedef ReturnType Return; + }; + + template< typename FunctionType > + struct DecomposeFunction + { + typedef typename Select < IsClass< FunctionType >::Result, int, + typename DecomposeFuncPtr< FunctionType >::Return >::Result + Return; + }; + + public: + struct ThreadDataCommon + { + ThreadDataCommon() {} + + virtual ~ThreadDataCommon() {} + + virtual int run() = 0; + + ThreadCommon * _thread; + + void * _self; + void * _attribute; + }; + + ThreadCommon() {} +}; + + +#include COMMONS_INCLUDE(thread.hpp) + +#endif /* _THREAD_COMMON_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/timer.cpp b/src/mod/endpoints/mod_khomp/commons/timer.cpp new file mode 100644 index 0000000..36e32f5 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/timer.cpp @@ -0,0 +1,352 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <timer.hpp> + +TimerTraits::TimerTraits() +: _thread((Thread*)0), _purify(false), _last_tick(0), _age_count(0), _shutdown(false) +{}; + +bool TimerTraits::start (void) +{ + _shutdown = false; + + _condition.reset(); + _finalized.reset(); + + if (!_thread) + { + _thread = new Thread(TimerTraits::loop_thread(this)); + _purify = true; + } + +#if defined(_WINDOWS) || defined(_Windows) || defined(_WIN32) || defined(WIN32) + // set priority ... +#else + pthread_attr_t attrs; + sched_param param; + + if (pthread_attr_init(&attrs) < 0) + return false; + + if (pthread_attr_setschedpolicy(&attrs, SCHED_RR) < 0) + return false; + + if (pthread_attr_getschedparam(&attrs, ¶m) < 0) + return false; + + param.sched_priority = sched_get_priority_max(SCHED_RR); + + if (pthread_attr_setschedparam(&attrs, ¶m) < 0) + return false; + + // set priority... + +// if (pthread_create(&_thread, &attrs, TimerTraits::loop_thread, NULL) < 0) +// return false; + + _thread->start(); +#endif + + return true; +} + +bool TimerTraits::stop (void) +{ + _shutdown = true; + + _condition.signal(); + + _finalized.wait(10000); /* 10 seconds max wait */ + + if (_thread && _purify) + { + delete _thread; + + _thread = (Thread *)0; + _purify = false; + } + + return true; +} + +//----------------------------------------- + +int TimerTraits::loop_thread::operator()(void) +{ + try + { + _timer->loop(); + } + catch( ... ) + { + /* something wrong happened! */ + } + + _timer->_finalized.signal(); + + return 0; +} + +void TimerTraits::execute(ControlSet::iterator init, const TimerTraits::Control & ctrl) +{ + volatile CallbackFuncType func = (volatile CallbackFuncType) ctrl._func; + volatile CallbackDataType data = (volatile CallbackDataType) ctrl._data; + + _timer_set.erase(init); + + _mutex.unlock(); + + func(data); +} + +void TimerTraits::loop (void) +{ + while (true) + { + if (_shutdown) break; + + _mutex.lock(); + + ControlSet::iterator init = _timer_set.begin(); + + if (init == _timer_set.end()) + { + _mutex.unlock(); + _condition.wait(); + } + else + { + const Control & ctrl = *init; + + unsigned int ts_now = TimerTraits::tick(); + + if (_age_count == ctrl._age) + { + if (ts_now < ctrl._msecs) + { + /* age is right, but it is not time to expire yet... */ + volatile unsigned int wait_time = ctrl._msecs - ts_now; + _mutex.unlock(); + _condition.wait(wait_time); /* expire - now */ + } + else + { + /* age is right, and we should expire! */ + execute(init, ctrl); /* called locked, return unlocked */ + } + } + else if (_age_count < ctrl._age) + { + /* age is not there yet (need some time to overlap)... */ + volatile unsigned int wait_time = (UINT_MAX - ts_now) + ctrl._msecs; + _mutex.unlock(); + _condition.wait(wait_time); /* MAX - now + expire */ + } + else + { + /* age has passed, we should have expired before! */ + execute(init, ctrl); /* called locked, return unlocked */ + } + } + } + + _finalized.signal(); +} + +unsigned int TimerTraits::tick() +{ +#if defined(_WINDOWS) || defined(_Windows) || defined(_WIN32) || defined(WIN32) + unsigned int tick = GetTickCount(); +#else + struct timespec ticks; + + // error condition, make the user notice this.. + if (clock_gettime(CLOCK_MONOTONIC, &ticks) < 0) + return 0; + + unsigned int tick = ( ticks.tv_sec * 1000 ) + ( ticks.tv_nsec / 1000000 ); +#endif + + if (_last_tick > tick) + ++_age_count; + + _last_tick = tick; + + return tick; +} + +//----------------------------------------- + +TimerTraits::Index TimerTraits::traits_add_unlocked (unsigned int msecs, const void * func, const void * data, unsigned int value) +{ + unsigned int ms_tick = TimerTraits::tick(); + + unsigned int ms_left = UINT_MAX - ms_tick; + unsigned int ms_real = msecs; + + unsigned int age_num = _age_count; + + if (ms_left < msecs) + { + ms_real -= ms_left; + ++age_num; + } + else + { + ms_real += ms_tick; + } + + ControlSet::iterator it = _timer_set.insert(Control(age_num,ms_real,func,data,value)); + + if (_timer_set.size() == 1 || _timer_set.begin() == it) + { + _condition.signal(); + }; + + return Index(age_num, ms_real, msecs, func, data, value); +} + +TimerTraits::Index TimerTraits::traits_add (unsigned int msecs, const void * func, const void * data, unsigned int value) +{ + _mutex.lock(); + + Index idx = traits_add_unlocked(msecs, func, data, value); + + _mutex.unlock(); + + return idx; +} + +bool TimerTraits::traits_restart (TimerTraits::Index & idx, bool force) +{ + bool ret = false; + + _mutex.lock(); + + if (idx.valid) + { + if (traits_del_unlocked(idx) || force) + { + idx = traits_add_unlocked(idx.delta, idx.func, idx.data, idx.value); + ret = true; + } + } + + _mutex.unlock(); + + return ret; +} + +bool TimerTraits::traits_del_unlocked (TimerTraits::Index & idx) +{ + bool ret = false; + + if (idx.valid) + { + ControlSet::iterator i = _timer_set.lower_bound(Control(idx.era, idx.msec)); + ControlSet::iterator j = _timer_set.upper_bound(Control(idx.era, idx.msec)); + + for (; i != j; i++) + { + const Control & ctrl = (*i); + + if ((idx.value && !(ctrl._value & idx.value))) + continue; + + if (((idx.func && ctrl._func == idx.func) || !idx.func) && ((idx.data && ctrl._data == idx.data) || !idx.data)) + { + if (_timer_set.begin() == i) + _condition.signal(); + + _timer_set.erase(i); + + ret = true; + break; + } + } + + idx.valid = false; + } + + return ret; +} + +bool TimerTraits::traits_del (TimerTraits::Index & idx) +{ + _mutex.lock(); + + bool ret = traits_del_unlocked(idx); + + _mutex.unlock(); + + return ret; +} + +bool TimerTraits::traits_del (const void * func, const void * data, unsigned int value) +{ + bool ret = false; + + _mutex.lock(); + + for (ControlSet::iterator i = _timer_set.begin(); i != _timer_set.end(); i++) + { + const Control & ctrl = (*i); + + if ((value && !(ctrl._value & value))) + continue; + + if (((func && ctrl._func == func) || !func) && ((data && ctrl._data == data) || !data)) + { + if (_timer_set.begin() == i) + _condition.signal(); + + _timer_set.erase(i); + + ret = true; + break; + } + } + + _mutex.unlock(); + + return ret; +} diff --git a/src/mod/endpoints/mod_khomp/commons/timer.hpp b/src/mod/endpoints/mod_khomp/commons/timer.hpp new file mode 100644 index 0000000..382efa1 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/timer.hpp @@ -0,0 +1,224 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#if defined(_WINDOWS) || defined(_Windows) || defined(_WIN32) || defined(WIN32) +#include <windows.h> +#else +#include <sched.h> +#endif + +#include <set> + +#include <simple_lock.hpp> +#include <saved_condition.hpp> +#include <thread.hpp> +#include <refcounter.hpp> + +#ifndef _TIMER_HPP_ +#define _TIMER_HPP_ + +struct TimerTraits +{ + typedef bool (* CallbackFuncType)(const void * volatile); + typedef const void * CallbackDataType; + + TimerTraits(); + + virtual ~TimerTraits() {}; + + protected: + + /* pre-declaration, used below */ + struct ControlCompare; + + struct Control + { + Control(unsigned int age, unsigned int msecs, const void * func = 0, const void * data = 0, unsigned int value = 0) + : _age(age), _msecs(msecs), _func(func), _data(data), _value(value) {} + + unsigned int _age; + + unsigned int _msecs; + + const void * _func; + const void * _data; + + unsigned int _value; + }; + + struct ControlCompare + { + bool operator()(const Control & c1, const Control & c2) const + { + return (c1._age < c2._age ? true : c1._msecs < c2._msecs); + } + }; + + typedef std::multiset < Control, ControlCompare > ControlSet; + + public: + struct Index + { + Index(): era(0), msec(0), valid(false) {}; + + Index(unsigned int _era, unsigned int _msec, unsigned int _delta, const void * _func, const void * _data, unsigned int _value) + : era(_era), msec(_msec), delta(_delta), func(_func), data(_data), value(_value), valid(true) {}; + + unsigned int era; + unsigned int msec; + + unsigned int delta; + + const void * func; + const void * data; + + unsigned int value; + + bool valid; + + void reset(void) { era = 0; msec = 0; valid = false; }; + }; + + /* timer add/remove functions */ + Index traits_add (unsigned int msecs, const void * func, const void * data = 0, unsigned int value = 0); + + bool traits_restart (Index & idx, bool force); + + bool traits_del (Index & idx); + bool traits_del (const void * func, const void * data = 0, unsigned int value = 0); + + /* timer start/stop functions */ + bool start(void); + bool stop(void); + + protected: + Index traits_add_unlocked (unsigned int msecs, const void * func, const void * data, unsigned int value); + + bool traits_del_unlocked (Index & idx); + + protected: + void execute(ControlSet::iterator, const Control &); + + void loop(void); + + struct loop_thread + { + loop_thread(TimerTraits *timer) : _timer(timer) {}; + + int operator()(void); + + protected: + TimerTraits * _timer; + }; + + unsigned int tick(); + + /* variables */ + + SavedCondition _condition; + + SimpleLock _mutex; + Thread * _thread; + bool _purify; + + ControlSet _timer_set; + + unsigned int _last_tick; + unsigned int _age_count; + + SavedCondition _finalized; + bool _shutdown; +}; + +template < typename F, typename D > +struct TimerTemplate: NEW_REFCOUNTER(TimerTemplate< F, D >) +{ + typedef TimerTraits::Index Index; + typedef TimerTraits::Control Control; + + TimerTemplate() + : _timer(new TimerTraits()) + {}; + + TimerTemplate(const TimerTemplate< F, D > & o) + : INC_REFCOUNTER(o, TimerTemplate< F, D >), + _timer(o._timer) + {}; + + void unreference(void) + { + if (_timer) + delete _timer; + }; + + bool start() { return _timer->start(); } + bool stop() { return _timer->stop(); } + + inline Index add(unsigned int msecs, F * func, D data = 0, unsigned int value = 0) + { + return _timer->traits_add(msecs, (const void *)func, (void *)(data), value); + } + + inline bool restart(Index & idx, bool force = false) + { + return _timer->traits_restart(idx, force); + } + + inline bool del(Index & idx) + { + return _timer->traits_del(idx); + } + + inline bool del(F * func, D data, unsigned int value = 0) + { + return _timer->traits_del((const void *)func, (void *)(data), value); + } + + inline bool del(unsigned int value) + { + return _timer->traits_del((const void *)0, (void *)0, value); + } + + protected: + TimerTraits * _timer; +}; + +#endif /* _TIMER_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/types.hpp b/src/mod/endpoints/mod_khomp/commons/types.hpp new file mode 100644 index 0000000..adbd8ab --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/types.hpp @@ -0,0 +1,81 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#ifndef _TYPES_HPP_ +#define _TYPES_HPP_ + +/*** Used for conditional compilation based on K3L version ***/ + +#define K3L_AT_LEAST(major,minor,build) \ + (((k3lApiMajorVersion == major) && ((k3lApiMinorVersion == minor) && (k3lApiBuildVersion >= build)) || \ + ((k3lApiMajorVersion == major) && (k3lApiMinorVersion > minor))) || \ + (k3lApiMajorVersion > major)) + +#define K3L_EXACT(major,minor,build) \ + ((k3lApiMajorVersion == major) && (k3lApiMinorVersion == minor) && (k3lApiBuildVersion >= build)) + +/*** Used for checking information on classes and stuff.. ***/ + +template< typename T > +class IsClass +{ + protected: + template< typename X > static char ( &A( void(X::*)() ) )[1]; + template< typename X > static char ( &A( X ) )[2]; + public: + static bool const Result = sizeof( A< T >(0) ) == 1; +}; + +/*** Used for template metaprogramming ***/ + +template < bool Value, typename Then, typename Else > +struct Select +{ + typedef Then Result; +}; + +template < typename Then, typename Else > +struct Select < false, Then, Else > +{ + typedef Else Result; +}; + +#endif /* _TYPES_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/commons/variant.hpp b/src/mod/endpoints/mod_khomp/commons/variant.hpp new file mode 100644 index 0000000..410a770 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/variant.hpp @@ -0,0 +1,127 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <refcounter.hpp> + +#include <typeinfo> + +#ifndef _VARIANT_H_ +#define _VARIANT_H_ + +/* this is internal, should not be used by the user */ +struct NoArgumentDefined {}; + +template < typename UserReturnType, typename UserArgumentType = NoArgumentDefined > +struct VariantBaseType +{ + typedef UserReturnType ReturnType; + typedef UserArgumentType ArgumentType; + + virtual ~VariantBaseType() {}; + + virtual int which() = 0; + + virtual ReturnType visit(void) { return ReturnType(); }; + virtual ReturnType visit(ArgumentType) { return ReturnType(); }; +}; + +template < typename BaseType = VariantBaseType < void > > +struct Variant: NEW_REFCOUNTER(Variant < BaseType >) +{ + typedef typename BaseType::ReturnType ReturnType; + typedef typename BaseType::ArgumentType ArgumentType; + + struct InvalidType {}; + + Variant(BaseType * value, bool is_owner = false) + : _value(value), _is_owner(is_owner) {}; + + Variant(const Variant & v) + : INC_REFCOUNTER(v, Variant < BaseType >), + _value(v._value), _is_owner(v._is_owner) {}; + + virtual ~Variant() {}; + + void unreference() + { + if (_is_owner && _value) + { + delete _value; + _value = 0; + } + }; + + template < typename ValueType > + ValueType & get(void) + { + try + { + ValueType & ret = dynamic_cast < ValueType & > (*_value); + return ret; + } + catch (std::bad_cast & e) + { + throw InvalidType(); + } + }; + + int which() + { + return _value->which(); + } + + ReturnType visit(void) + { + return _value->visit(); + } + + ReturnType visit(ArgumentType arg) + { + return _value->visit(arg); + } + + protected: + BaseType * _value; + bool _is_owner; +}; + +#endif /* _VARIANT_H_ */ + diff --git a/src/mod/endpoints/mod_khomp/commons/verbose.cpp b/src/mod/endpoints/mod_khomp/commons/verbose.cpp new file mode 100644 index 0000000..182d159 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/verbose.cpp @@ -0,0 +1,3188 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <strings.hpp> +#include <verbose.hpp> + +#define PRESENTATION_CHECK_RETURN(fmt, txtexact, txthuman) \ + { \ + switch(fmt) \ + { \ + case EXACT: return txtexact; \ + case HUMAN: return txthuman; \ + } \ + return txtexact; \ + } + +/********************************************/ + +std::string Verbose::channelStatus(int32 dev, int32 obj, int32 cs, Verbose::Presentation fmt) +{ + try + { + K3L_CHANNEL_CONFIG & config = _api.channel_config(dev, obj); + return Verbose::channelStatus(config.Signaling, cs, fmt); + } + catch (...) + { + return presentation(fmt, "<unknown>", "Unknown"); + } +} + +#if K3L_AT_LEAST(2,0,0) +std::string Verbose::event(int32 obj, K3L_EVENT *ev, R2CountryType r2_country, Verbose::Presentation fmt) +#else +std::string Verbose::event(int32 obj, K3L_EVENT *ev, Verbose::Presentation fmt) +#endif +{ + try + { + K3L_CHANNEL_CONFIG & config = _api.channel_config(ev->DeviceId, obj); +#if K3L_AT_LEAST(2,0,0) + return Verbose::event(config.Signaling, obj, ev, r2_country, fmt); +#else + return Verbose::event(config.Signaling, obj, ev, fmt); +#endif + } + catch (...) + { +#if K3L_AT_LEAST(2,0,0) + return Verbose::event(ksigInactive, obj, ev, r2_country, fmt); +#else + return Verbose::event(ksigInactive, obj, ev, fmt); +#endif + } +} + +/********************************************/ + +std::string Verbose::echoLocation(KEchoLocation ec, Verbose::Presentation fmt) +{ + switch (ec) + { +#if K3L_AT_LEAST(1,5,4) + case kelNetwork: return presentation(fmt, "kelNetwork", "Network"); +#else + case kelE1: return presentation(fmt, "kelE1", "Network"); +#endif + case kelCtBus: return presentation(fmt, "kelCtBus", "CT-Bus"); + }; + + return presentation(fmt, "<unknown>", "Unknown"); +}; + +std::string Verbose::echoCancellerConfig(KEchoCancellerConfig ec, Verbose::Presentation fmt) +{ + switch (ec) + { + case keccNotPresent: return presentation(fmt, "keccNotPresent", "Not Present"); + case keccOneSingleBank: return presentation(fmt, "keccOneSingleBank", "One, Single Bank"); + case keccOneDoubleBank: return presentation(fmt, "keccOneDoubleBank", "One, Double Bank"); + case keccTwoSingleBank: return presentation(fmt, "keccTwoSingleBank", "Two, Single Bank"); + case keccTwoDoubleBank: return presentation(fmt, "keccTwoDoubleBank", "Two, Double Bank"); + case keccFail: return presentation(fmt, "keccFail", "Failure"); + }; + + return presentation(fmt, "<unknown>", "Unknown"); +}; + +// TODO: internal_deviceType / internal_deviceModel + +std::string Verbose::deviceName(KDeviceType dt, int32 model, Verbose::Presentation fmt) +{ + try + { + std::string value; + + value += internal_deviceType(dt); + value += "-"; + value += internal_deviceModel(dt, model); + + return value; + } + catch (internal_not_found & e) + { + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("[type/model='%d/%d']") % (int)dt % (int)model), + STG(FMT("Unknown device type/model (%d/%d)") % (int)dt % (int)model)); + } +} + +std::string Verbose::deviceType(KDeviceType dt, Verbose::Presentation fmt) +{ + try + { + return internal_deviceType(dt); + } + catch (internal_not_found & e) + { + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("[type='%d']") % (int)dt), + STG(FMT("Unknown device type (%d)") % (int)dt)); + } +} + +std::string Verbose::internal_deviceType(KDeviceType dt) +{ + switch (dt) + { + case kdtE1: return "K2E1"; + +#if K3L_AT_LEAST(1,6,0) + case kdtFXO: return "KFXO"; +#else + case kdtFX: return "KFXO"; +#endif + + case kdtConf: return "KCONF"; + case kdtPR: return "KPR"; + case kdtE1GW: return "KE1GW"; + +#if K3L_AT_LEAST(1,6,0) + case kdtFXOVoIP: return "KFXVoIP"; +#else + case kdtFXVoIP: return "KFXVoIP"; +#endif + +#if K3L_AT_LEAST(1,5,0) + case kdtE1IP: return "K2E1"; +#endif +#if K3L_AT_LEAST(1,5,1) + case kdtE1Spx: return "K2E1"; + case kdtGWIP: return "KGWIP"; +#endif + +#if K3L_AT_LEAST(1,6,0) + case kdtFXS: return "KFXS"; + case kdtFXSSpx: return "KFXS"; + case kdtGSM: return "KGSM"; + case kdtGSMSpx: return "KGSM"; +#endif + +#if K3L_AT_LEAST(2,1,0) + case kdtGSMUSB: return "KGSMUSB"; + case kdtGSMUSBSpx: return "KGSMUSB"; + + case kdtE1FXSSpx: return "KE1FXS"; + case kdtDevTypeCount: return "DevTypeCount"; +#endif + +#if K3L_EXACT(2,1,0) + case kdtReserved1: return "Reserved1"; +#endif + +#if K3L_AT_LEAST(2,2,0) + case kdtE1AdHoc: return "KE1AdHoc"; +#endif + } + + throw internal_not_found(); +} + +std::string Verbose::deviceModel(KDeviceType dt, int32 model, Verbose::Presentation fmt) +{ + try + { + return internal_deviceModel(dt, model); + } + catch (internal_not_found & e) + { + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("[model='%d']") % (int)model), + STG(FMT("Unknown device model (%d)") % (int)model)); + } +} + +std::string Verbose::internal_deviceModel(KDeviceType dt, int32 model) +{ + switch (dt) + { + case kdtE1: + switch ((KE1DeviceModel)model) + { + case kdmE1600: return "600"; + case kdmE1600E: return "600E"; +#if K3L_AT_LEAST(2,0,0) + case kdmE1600EX: return "600EX"; +#endif + } + throw internal_not_found(); + +#if K3L_AT_LEAST(1,6,0) + case kdtFXO: + switch ((KFXODeviceModel)model) +#else + case kdtFX: + switch ((KFXDeviceModel)model) +#endif + { +#if K3L_AT_LEAST(1,6,0) + case kdmFXO80: return "80"; + case kdmFXOHI: return "HI"; + case kdmFXO160HI: return "160HI"; +#if K3L_AT_LEAST(2,1,0) + case kdmFXO240HI: return "240HI"; +#endif +#else + case kdmFXO80: return "80"; +#endif + } + + throw internal_not_found(); + + case kdtConf: + switch ((KConfDeviceModel)model) + { + case kdmConf240: return "240"; + case kdmConf120: return "120"; +#if K3L_AT_LEAST(2,0,0) + case kdmConf240EX: return "240EX"; + case kdmConf120EX: return "120EX"; +#endif + } + + throw internal_not_found(); + + case kdtPR: + switch ((KPRDeviceModel)model) + { +#if K3L_AT_LEAST(1,6,0) + case kdmPR300v1: return "300v1"; + case kdmPR300SpxBased: return "300S"; +#if K3L_AT_LEAST(2,0,0) + case kdmPR300EX: return "300EX"; +#endif + case kdmPR300: return "300"; + } +#endif + throw internal_not_found(); + +#if K3L_AT_LEAST(1,4,0) + case kdtE1GW: + switch ((KE1GWDeviceModel)model) + { +#if K3L_AT_LEAST(1,6,0) + case kdmE1GW640: return "640"; +#if K3L_AT_LEAST(2,0,0) + case kdmE1GW640EX: return "640EX"; +#endif +#else + case kdmE1600V: return "600V"; + case kdmE1600EV: return "600EV"; +#endif + } + + throw internal_not_found(); +#endif + +#if K3L_AT_LEAST(1,6,0) + case kdtFXOVoIP: + switch ((KFXOVoIPDeviceModel)model) + { + case kdmFXGW180: return "180"; + } + + throw internal_not_found(); + +#elif K3L_AT_LEAST(1,4,0) + case kdtFXVoIP: + switch ((KFXVoIPDeviceModel)model) + { + case kdmFXO80V: return "80V"; + } + + throw internal_not_found(); +#endif + +#if K3L_AT_LEAST(1,5,0) + case kdtE1IP: + switch ((KE1IPDeviceModel)model) + { +#if K3L_AT_LEAST(1,6,0) + case kdmE1IP: return "E1IP"; +#if K3L_AT_LEAST(2,0,0) + case kdmE1IPEX: return "E1IPEX"; +#endif +#else + case kdmE1600EG: return "600EG"; +#endif + } + + throw internal_not_found(); +#endif + +#if K3L_AT_LEAST(1,5,1) + case kdtE1Spx: + switch ((KE1SpxDeviceModel)model) + { + case kdmE1Spx: return "SPX"; + case kdm2E1Based: return "SPX-2E1"; +#if K3L_AT_LEAST(2,0,0) + case kdmE1SpxEX: return "SPXEX"; +#endif + } + throw internal_not_found(); + + case kdtGWIP: + switch ((KGWIPDeviceModel)model) + { +#if K3L_AT_LEAST(1,6,0) + case kdmGWIP: return "GWIP"; +#if K3L_AT_LEAST(2,0,0) + case kdmGWIPEX: return "GWIPEX"; +#endif +#else + case kdmGW600G: return "600G"; + case kdmGW600EG: return "600EG"; +#endif + } + + throw internal_not_found(); +#endif + +#if K3L_AT_LEAST(1,6,0) + case kdtFXS: + switch ((KFXSDeviceModel)model) + { + case kdmFXS300: return "300"; +#if K3L_AT_LEAST(2,0,0) + case kdmFXS300EX: return "300EX"; +#endif + } + + throw internal_not_found(); + + case kdtFXSSpx: + switch ((KFXSSpxDeviceModel)model) + { + case kdmFXSSpx300: return "SPX"; + case kdmFXSSpx2E1Based: return "SPX-2E1"; +#if K3L_AT_LEAST(2,0,0) + case kdmFXSSpx300EX: return "SPXEX"; +#endif + } + + throw internal_not_found(); + + case kdtGSM: + switch ((KGSMDeviceModel)model) + { + case kdmGSM: return "40"; +#if K3L_AT_LEAST(2,0,0) + case kdmGSMEX: return "40EX"; +#endif + } + + throw internal_not_found(); + + case kdtGSMSpx: + switch ((KGSMSpxDeviceModel)model) + { + case kdmGSMSpx: return "SPX"; +#if K3L_AT_LEAST(2,0,0) + case kdmGSMSpxEX: return "SPXEX"; +#endif + } + + throw internal_not_found(); + +#if K3L_AT_LEAST(2,1,0) + case kdtGSMUSB: + switch ((KGSMUSBDeviceModel)model) + { + case kdmGSMUSB: return "20"; + } + + throw internal_not_found(); + + case kdtGSMUSBSpx: + switch ((KGSMUSBSpxDeviceModel)model) + { + case kdmGSMUSBSpx: return "SPX"; + } + + throw internal_not_found(); + + case kdtE1FXSSpx: + switch ((KGSMSpxDeviceModel)model) + { + case kdmE1FXSSpx: return "SPX"; + case kdmE1FXSSpxEX: return "SPXEX"; + } + + throw internal_not_found(); +#if K3L_AT_LEAST(2,2,0) + case kdtE1AdHoc: + switch((KE1AdHocModel)model) + { + case kdmE1AdHoc100: return "E1AdHoc100"; + case kdmE1AdHoc100E: return "E1AdHoc100E"; + case kdmE1AdHoc240: return "E1AdHoc240"; + case kdmE1AdHoc240E: return "E1AdHoc240E"; + case kdmE1AdHoc400: return "E1AdHoc240"; + case kdmE1AdHoc400E: return "E1AdHoc240E"; + } + throw internal_not_found(); +#endif + +#if K3L_EXACT(2,1,0) + case kdtReserved1: +#endif + case kdtDevTypeCount: + throw internal_not_found(); + +#endif +#endif + } + + throw internal_not_found(); +} + +std::string Verbose::signaling(KSignaling sig, Verbose::Presentation fmt) +{ + switch (sig) + { + case ksigInactive: return presentation(fmt, "ksigInactive", "Inactive"); + case ksigAnalog: return presentation(fmt, "ksigAnalog", "FXO (analog)"); + case ksigContinuousEM: return presentation(fmt, "ksigContinuousEM", "E+M Continuous"); + case ksigPulsedEM: return presentation(fmt, "ksigPulsedEM", "E+M PUlsed"); + case ksigOpenCAS: return presentation(fmt, "ksigOpenCAS", "Open CAS"); + case ksigOpenR2: return presentation(fmt, "ksigOpenR2", "Open R2"); + case ksigR2Digital: return presentation(fmt, "ksigR2Digital", "R2/MFC"); + case ksigUserR2Digital: return presentation(fmt, "ksigUserR2Digital", "R2/Other"); +#if K3L_AT_LEAST(1,4,0) + case ksigSIP: return presentation(fmt, "ksigSIP", "SIP"); +#endif + +#if K3L_AT_LEAST(1,5,1) + case ksigOpenCCS: return presentation(fmt, "ksigOpenCCS", "Open CCS"); + case ksigPRI_EndPoint: return presentation(fmt, "ksigPRI_EndPoint", "ISDN Endpoint"); + case ksigPRI_Network: return presentation(fmt, "ksigPRI_Network", "ISDN Network"); + case ksigPRI_Passive: return presentation(fmt, "ksigPRI_Passive", "ISDN Passive"); +#endif +#if K3L_AT_LEAST(1,5,3) + case ksigLineSide: return presentation(fmt, "ksigLineSide", "Line Side"); +#endif +#if K3L_AT_LEAST(1,6,0) + case ksigAnalogTerminal: return presentation(fmt, "ksigAnalogTerminal", "FXS (analog)"); + case ksigGSM: return presentation(fmt, "ksigGSM", "GSM"); + case ksigCAS_EL7: return presentation(fmt, "ksigCAS_EL7", "CAS EL7"); + case ksigE1LC: return presentation(fmt, "ksigE1LC", "E1 LC"); +#endif +#if K3L_AT_LEAST(2,1,0) + case ksigISUP: return presentation(fmt, "ksigISUP", "ISUP"); +#endif +#if K3L_EXACT(2,1,0) + case ksigFax: return presentation(fmt, "ksigFax", "Fax"); +#endif +#if K3L_AT_LEAST(2,2,0) + case ksigISUPPassive: return presentation(fmt, "ksigISUPPassive", "ISUP Passive"); +#endif + } + + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("[KSignaling='%d']") % (int)sig), + STG(FMT("Unknown signaling (%d)") % (int)sig)); +} + +std::string Verbose::systemObject(KSystemObject so, Verbose::Presentation fmt) +{ + switch (so) + { + case ksoLink: return presentation(fmt, "ksoLink", "Link"); + case ksoLinkMon: return presentation(fmt, "ksoLinkMon", "Link Monitor"); + case ksoChannel: return presentation(fmt, "ksoChannel", "Channel"); +#if K3L_AT_LEAST(2,1,0) + case ksoGsmChannel:return presentation(fmt, "ksoGsmChannel","GsmChannel"); +#endif + case ksoH100: return presentation(fmt, "ksoH100", "H.100"); + case ksoFirmware: return presentation(fmt, "ksoFirmware", "Firmware"); + case ksoDevice: return presentation(fmt, "ksoDevice", "Device"); + case ksoAPI: return presentation(fmt, "ksoAPI", "Software Layer"); + } + + return presentation(fmt, + STG(FMT("[KSystemObject='%d']") % (int)so), + STG(FMT("Unknown object (%d)") % (int)so)); +} + +std::string Verbose::mixerTone(KMixerTone mt, Verbose::Presentation fmt) +{ + switch (mt) + { + case kmtSilence: return presentation(fmt, "kmtSilence", "Silence"); + case kmtDial: return presentation(fmt, "kmtDial", "Dialtone begin"); + case kmtEndOf425: return presentation(fmt, "kmtEndOf425", "Dialtone end"); + case kmtBusy: return presentation(fmt, "kmtBusy", "Busy"); + case kmtFax: return presentation(fmt, "kmtFax", "Fax"); + case kmtVoice: return presentation(fmt, "kmtVoice", "Voice"); +#if K3L_AT_LEAST(1,5,0) + case kmtCollect: return presentation(fmt, "kmtCollect", "Collect Call"); +#endif +#if K3L_AT_LEAST(1,5,1) + case kmtEndOfDtmf: return presentation(fmt, "kmtEndOfDtmf", "DTMF end"); +#endif + } + + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("[KMixerTone='%d']") % (int)mt), + STG(FMT("Unknonwn tone (%d)") % (int)mt)); +} + +std::string Verbose::mixerSource(KMixerSource ms, Verbose::Presentation fmt) +{ + switch (ms) + { + case kmsChannel: return presentation(fmt, "kmsChannel", "Channel"); + case kmsPlay: return presentation(fmt, "kmsPlay", "Player"); + case kmsGenerator: return presentation(fmt, "kmsGenerator", "Generator"); + case kmsCTbus: return presentation(fmt, "kmsCTbus", "CT-bus"); +#if (K3L_AT_LEAST(1,4,0) && !K3L_AT_LEAST(1,6,0)) + case kmsVoIP: return presentation(fmt, "kmsVoIP", "VoIP"); +#endif +#if K3L_AT_LEAST(1,6,0) + case kmsNoDelayChannel: return presentation(fmt, "kmsNoDelayChannel", "No delay channel"); +#endif + } + + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("[KMixerSource='%d']") % (int)ms), + STG(FMT("Unknonwn source (%d)") % (int)ms)); +} + +std::string Verbose::channelFeatures(int32 flags, Verbose::Presentation fmt) +{ + if (0x00 != flags) + { + Strings::Merger strs; + + if (kcfDtmfSuppression & flags) strs.add(presentation(fmt, "DtmfSuppression", "DTMF Suppression")); + if (kcfCallProgress & flags) strs.add(presentation(fmt, "CallProgress", "Call Progress")); + if (kcfPulseDetection & flags) strs.add(presentation(fmt, "PulseDetection", "Pulse Detection")); + if (kcfAudioNotification & flags) strs.add(presentation(fmt, "AudioNotification", "Audio Notification")); + if (kcfEchoCanceller & flags) strs.add(presentation(fmt, "EchoCanceller", "Echo Canceller")); + if (kcfAutoGainControl & flags) strs.add(presentation(fmt, "AutoGainControl", "Input AGC")); + if (kcfHighImpEvents & flags) strs.add(presentation(fmt, "HighImpEvents", "High Impedance Events")); +#if K3L_AT_LEAST(1,6,0) + if (kcfCallAnswerInfo & flags) strs.add(presentation(fmt, "CallAnswerInfo", "Call Answer Info")); +#if !K3L_AT_LEAST(2,2,0) + if (kcfOutputVolume & flags) strs.add(presentation(fmt, "OutputVolume", "Output Volume")); +#endif + if (kcfPlayerAGC & flags) strs.add(presentation(fmt, "PlayerAGC", "Player AGC")); +#endif + + return presentation(fmt, + STG(FMT("kcf{%s}") % strs.merge(",")), + STG(FMT("%s") % strs.merge(", "))); + }; + + PRESENTATION_CHECK_RETURN(fmt, "", "No features"); +} + +std::string Verbose::seizeFail(KSeizeFail sf, Verbose::Presentation fmt) +{ + switch (sf) + { + case ksfChannelLocked: return presentation(fmt, "ksfChannelLocked", "Channel Locked"); + case ksfChannelBusy: return presentation(fmt, "ksfChannelBusy", "Channel Busy"); + case ksfIncomingChannel: return presentation(fmt, "ksfIncomingChannel", "Incoming Channel"); + case ksfDoubleSeizure: return presentation(fmt, "ksfDoubleSeizure", "Double Seizure"); + case ksfCongestion: return presentation(fmt, "ksfCongestion", "Congestion"); + case ksfNoDialTone: return presentation(fmt, "ksfNoDialTone", "No Dial Tone"); + } + + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("[KSeizeFail='%d']") % (int)sf), + STG(FMT("Unknown seize fail (%d)") % (int)sf)); +} + +#if K3L_AT_LEAST(1,5,0) +std::string Verbose::internal_sipFailures(KSIP_Failures code, Verbose::Presentation fmt) +{ + switch (code) + { +#if K3L_AT_LEAST(1,6,0) + case kveResponse_200_OK_Success: return presentation(fmt, "kveResponse_200_OK_Success", "200 OK"); +#endif + case kveRedirection_300_MultipleChoices: return presentation(fmt, "kveRedirection_300_MultipleChoices", "300 Multiple Choices"); + case kveRedirection_301_MovedPermanently: return presentation(fmt, "kveRedirection_301_MovedPermanently", "301 Moved Permanently"); + case kveRedirection_302_MovedTemporarily: return presentation(fmt, "kveRedirection_302_MovedTemporarily", "302 Moved Temporarily"); + case kveRedirection_305_UseProxy: return presentation(fmt, "kveRedirection_305_UseProxy", "305 Use Proxy"); + case kveRedirection_380_AlternativeService: return presentation(fmt, "kveRedirection_380_AlternativeService", "380 Alternate Service"); + case kveFailure_400_BadRequest: return presentation(fmt, "kveFailure_400_BadRequest", "400 Bad Request"); + case kveFailure_401_Unauthorized: return presentation(fmt, "kveFailure_401_Unauthorized", "401 Unauthorized"); + case kveFailure_402_PaymentRequired: return presentation(fmt, "kveFailure_402_PaymentRequired", "402 Payment Required"); + case kveFailure_403_Forbidden: return presentation(fmt, "kveFailure_403_Forbidden", "403 Forbidden"); + case kveFailure_404_NotFound: return presentation(fmt, "kveFailure_404_NotFound", "404 Not Found"); + case kveFailure_405_MethodNotAllowed: return presentation(fmt, "kveFailure_405_MethodNotAllowed", "405 Method Not Allowed"); + case kveFailure_406_NotAcceptable: return presentation(fmt, "kveFailure_406_NotAcceptable", "406 Not Acceptable"); + case kveFailure_407_ProxyAuthenticationRequired: return presentation(fmt, "kveFailure_407_ProxyAuthenticationRequired", "407 Proxy Authentication Required"); + case kveFailure_408_RequestTimeout: return presentation(fmt, "kveFailure_408_RequestTimeout", "408 Request Timeout"); + case kveFailure_410_Gone: return presentation(fmt, "kveFailure_410_Gone", "410 Gone"); + case kveFailure_413_RequestEntityTooLarge: return presentation(fmt, "kveFailure_413_RequestEntityTooLarge", "413 Request Entity Too Large"); + case kveFailure_414_RequestURI_TooLong: return presentation(fmt, "kveFailure_414_RequestURI_TooLong", "414 Request URI Too Long"); + case kveFailure_415_UnsupportedMediaType: return presentation(fmt, "kveFailure_415_UnsupportedMediaType", "415 Unsupported Media Type"); + case kveFailure_416_UnsupportedURI_Scheme: return presentation(fmt, "kveFailure_416_UnsupportedURI_Scheme", "416 Unsupported URI Scheme"); + case kveFailure_420_BadExtension: return presentation(fmt, "kveFailure_420_BadExtension", "420 Bad Extension"); + case kveFailure_421_ExtensionRequired: return presentation(fmt, "kveFailure_421_ExtensionRequired", "421 Extension Required"); + case kveFailure_423_IntervalTooBrief: return presentation(fmt, "kveFailure_423_IntervalTooBrief", "423 Internal Too Brief"); + case kveFailure_480_TemporarilyUnavailable: return presentation(fmt, "kveFailure_480_TemporarilyUnavailable", "480 Temporarily Unavailable"); + case kveFailure_481_CallDoesNotExist: return presentation(fmt, "kveFailure_481_CallDoesNotExist", "481 Call Does Not Exist"); + case kveFailure_482_LoopDetected: return presentation(fmt, "kveFailure_482_LoopDetected", "482 Loop Detected"); + case kveFailure_483_TooManyHops: return presentation(fmt, "kveFailure_483_TooManyHops", "483 Too Many Hops"); + case kveFailure_484_AddressIncomplete: return presentation(fmt, "kveFailure_484_AddressIncomplete", "484 Address Incomplete"); + case kveFailure_485_Ambiguous: return presentation(fmt, "kveFailure_485_Ambiguous", "485 Ambiguous"); + case kveFailure_486_BusyHere: return presentation(fmt, "kveFailure_486_BusyHere", "486 Busy Here"); + case kveFailure_487_RequestTerminated: return presentation(fmt, "kveFailure_487_RequestTerminated", "487 Request Terminated"); + case kveFailure_488_NotAcceptableHere: return presentation(fmt, "kveFailure_488_NotAcceptableHere", "488 Not Acceptable Here"); + case kveFailure_491_RequestPending: return presentation(fmt, "kveFailure_491_RequestPending", "491 Request Pending"); + case kveFailure_493_Undecipherable: return presentation(fmt, "kveFailure_493_Undecipherable", "493 Undecipherable"); + case kveServer_500_InternalError: return presentation(fmt, "kveServer_500_InternalError", "500 Internal Error"); + case kveServer_501_NotImplemented: return presentation(fmt, "kveServer_501_NotImplemented", "501 Not Implemented"); + case kveServer_502_BadGateway: return presentation(fmt, "kveServer_502_BadGateway", "502 Bad Gateway"); + case kveServer_503_ServiceUnavailable: return presentation(fmt, "kveServer_503_ServiceUnavailable", "503 Service Unavailable"); + case kveServer_504_TimeOut: return presentation(fmt, "kveServer_504_TimeOut", "504 Timed Out"); + case kveServer_505_VersionNotSupported: return presentation(fmt, "kveServer_505_VersionNotSupported", "505 Version Not Supported"); + case kveServer_513_MessageTooLarge: return presentation(fmt, "kveServer_513_MessageTooLarge", "513 Message Too Large"); + case kveGlobalFailure_600_BusyEverywhere: return presentation(fmt, "kveGlobalFailure_600_BusyEverywhere", "600 Busy Everywhere"); + case kveGlobalFailure_603_Decline: return presentation(fmt, "kveGlobalFailure_603_Decline", "603 Decline"); + case kveGlobalFailure_604_DoesNotExistAnywhere: return presentation(fmt, "kveGlobalFailure_604_DoesNotExistAnywhere", "604 Does Not Exist Anywhere"); + case kveGlobalFailure_606_NotAcceptable: return presentation(fmt, "kveGlobalFailure_606_NotAcceptable", "606 Not Acceptable"); + } + + throw internal_not_found(); +} + +std::string Verbose::sipFailures(KSIP_Failures code, Verbose::Presentation fmt) +{ + try + { + return internal_sipFailures(code, fmt); + } + catch (internal_not_found & e) + { + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("[KSIP_Failures='%d']") % (int)code), + STG(FMT("Unknown SIP failure (%d)") % (int)code)); + } +} + +#endif + +#if K3L_AT_LEAST(1,5,1) +std::string Verbose::internal_isdnCause(KQ931Cause code, Verbose::Presentation fmt) +{ + switch (code) + { + case kq931cNone: return presentation(fmt, "kq931cNone", "None"); + case kq931cUnallocatedNumber: return presentation(fmt, "kq931cUnallocatedNumber", "Unallocated number"); + case kq931cNoRouteToTransitNet: return presentation(fmt, "kq931cNoRouteToTransitNet", "No route to transmit to network"); + case kq931cNoRouteToDest: return presentation(fmt, "kq931cNoRouteToDest", "No route to destination"); +#if 1 /* this changed during K3L 1.6.0 development cycle... */ + case kq931cSendSpecialInfoTone: return presentation(fmt, "kq931cSendSpecialInfoTone", "Send special information tone"); + case kq931cMisdialedTrunkPrefix: return presentation(fmt, "kq931cMisdialedTrunkPrefix", "Misdialed trunk prefix"); +#endif + case kq931cChannelUnacceptable: return presentation(fmt, "kq931cChannelUnacceptable", "Channel unacceptable"); + case kq931cCallAwarded: return presentation(fmt, "kq931cCallAwarded", "Call awarded"); +#if 1 /* this changed during K3L 1.6.0 development cycle... */ + case kq931cPreemption: return presentation(fmt, "kq931cPreemption", "Preemption"); + case kq931cPreemptionCircuitReuse: return presentation(fmt, "kq931cPreemptionCircuitReuse", "Preemption circuit reuse"); + case kq931cQoR_PortedNumber: return presentation(fmt, "kq931cQoR_PortedNumber", "QoR ported number"); +#endif + case kq931cNormalCallClear: return presentation(fmt, "kq931cNormalCallClear", "Normal call clear"); + case kq931cUserBusy: return presentation(fmt, "kq931cUserBusy", "User busy"); + case kq931cNoUserResponding: return presentation(fmt, "kq931cNoUserResponding", "No user responding"); + case kq931cNoAnswerFromUser: return presentation(fmt, "kq931cNoAnswerFromUser", "No answer from user"); +#if 1 /* this changed during K3L 1.6.0 development cycle... */ + case kq931cSubscriberAbsent: return presentation(fmt, "kq931cSubscriberAbsent", "Subscriber absent"); +#endif + case kq931cCallRejected: return presentation(fmt, "kq931cCallRejected", "Call rejected"); + case kq931cNumberChanged: return presentation(fmt, "kq931cNumberChanged", "Number changed"); +#if 1 /* this changed during K3L 1.6.0 development cycle... */ + case kq931cRedirectionToNewDest: return presentation(fmt, "kq931cRedirectionToNewDest", "Redirection to new destination"); + case kq931cCallRejectedFeatureDest: return presentation(fmt, "kq931cCallRejectedFeatureDest", "Call rejected feature destination"); + case kq931cExchangeRoutingError: return presentation(fmt, "kq931cExchangeRoutingError", "Exchange routing error"); +#endif + case kq931cNonSelectedUserClear: return presentation(fmt, "kq931cNonSelectedUserClear", "Non selected user clear"); + case kq931cDestinationOutOfOrder: return presentation(fmt, "kq931cDestinationOutOfOrder", "Destination out of order"); + case kq931cInvalidNumberFormat: return presentation(fmt, "kq931cInvalidNumberFormat", "Invalid number format"); + case kq931cFacilityRejected: return presentation(fmt, "kq931cFacilityRejected", "Facility rejected"); + case kq931cRespStatusEnquiry: return presentation(fmt, "kq931cRespStatusEnquiry", "Response status enquiry"); + case kq931cNormalUnspecified: return presentation(fmt, "kq931cNormalUnspecified", "Normal unespecified"); + case kq931cNoCircuitChannelAvail: return presentation(fmt, "kq931cNoCircuitChannelAvail", "No circuit channel available"); + case kq931cNetworkOutOfOrder: return presentation(fmt, "kq931cNetworkOutOfOrder", "Network out of order"); +#if 1 /* this changed during K3L 1.6.0 development cycle... */ + case kq931cPermanentFrameConnOutOfService: return presentation(fmt, "kq931cPermanentFrameConnOutOfService", "Permanent frame connection out of service"); + case kq931cPermanentFrameConnOperational: return presentation(fmt, "kq931cPermanentFrameConnOperational", "Permanent frame connection operational"); +#endif + case kq931cTemporaryFailure: return presentation(fmt, "kq931cTemporaryFailure", "Temporary failure"); + case kq931cSwitchCongestion: return presentation(fmt, "kq931cSwitchCongestion", "Switch congestion"); + case kq931cAccessInfoDiscarded: return presentation(fmt, "kq931cAccessInfoDiscarded", "Access information discarded"); + case kq931cRequestedChannelUnav: return presentation(fmt, "kq931cRequestedChannelUnav", "Requested channel unavailable"); + case kq931cPrecedenceCallBlocked: return presentation(fmt, "kq931cPrecedenceCallBlocked", "Precedence call blocked"); + case kq931cResourceUnavailable: return presentation(fmt, "kq931cResourceUnavailable", "Request resource unavailable"); + case kq931cQosUnavailable: return presentation(fmt, "kq931cQosUnavailable", "QoS unavailable"); + case kq931cReqFacilityNotSubsc: return presentation(fmt, "kq931cReqFacilityNotSubsc", "Request facility not subscribed"); + case kq931cOutCallsBarredWithinCUG: return presentation(fmt, "kq931cOutCallsBarredWithinCUG", "Out calls barred within UG"); + case kq931cInCallsBarredWithinCUG: return presentation(fmt, "kq931cInCallsBarredWithinCUG", "In calls barred within UG"); + case kq931cBearerCapabNotAuthor: return presentation(fmt, "kq931cBearerCapabNotAuthor", "Bearer capability not authorized"); + case kq931cBearerCapabNotAvail: return presentation(fmt, "kq931cBearerCapabNotAvail", "Bearer capability not available"); +#if 1 /* this changed during K3L 1.6.0 development cycle... */ + case kq931cInconsistency: return presentation(fmt, "kq931cInconsistency", "Inconsistency"); +#endif + case kq931cServiceNotAvailable: return presentation(fmt, "kq931cServiceNotAvailable", "Service not available"); + case kq931cBcNotImplemented: return presentation(fmt, "kq931cBcNotImplemented", "Bearer capability not implemented"); + case kq931cChannelTypeNotImplem: return presentation(fmt, "kq931cChannelTypeNotImplem", "Channel type not implemented"); + case kq931cReqFacilityNotImplem: return presentation(fmt, "kq931cReqFacilityNotImplem", "Request facility not implemented"); + case kq931cOnlyRestrictedBcAvail: return presentation(fmt, "kq931cOnlyRestrictedBcAvail", "Only restricted bearer capability available"); + case kq931cServiceNotImplemented: return presentation(fmt, "kq931cServiceNotImplemented", "Service not implemented"); + case kq931cInvalidCrv: return presentation(fmt, "kq931cInvalidCrv", "Invalid call reference value"); + case kq931cChannelDoesNotExist: return presentation(fmt, "kq931cChannelDoesNotExist", "Channel does not exist"); + case kq931cCallIdDoesNotExist: return presentation(fmt, "kq931cCallIdDoesNotExist", "Call identification does not exist"); + case kq931cCallIdInUse: return presentation(fmt, "kq931cCallIdInUse", "Call identification in use"); + case kq931cNoCallSuspended: return presentation(fmt, "kq931cNoCallSuspended", "No call suspended"); + case kq931cCallIdCleared: return presentation(fmt, "kq931cCallIdCleared", "Call identification cleared"); +#if 1 /* this changed during K3L 1.6.0 development cycle... */ + case kq931cUserNotMemberofCUG: return presentation(fmt, "kq931cUserNotMemberofCUG", "User not member of UG"); +#endif + case kq931cIncompatibleDestination: return presentation(fmt, "kq931cIncompatibleDestination", "Incompatible destination"); + case kq931cInvalidTransitNetSel: return presentation(fmt, "kq931cInvalidTransitNetSel", "Invalid transit network selected"); + case kq931cInvalidMessage: return presentation(fmt, "kq931cInvalidMessage", "Invalid message"); + case kq931cMissingMandatoryIe: return presentation(fmt, "kq931cMissingMandatoryIe", "Missing mandatory information element"); + case kq931cMsgTypeNotImplemented: return presentation(fmt, "kq931cMsgTypeNotImplemented", "Message type not implemented"); + case kq931cMsgIncompatWithState: return presentation(fmt, "kq931cMsgIncompatWithState", "Message incompatible with state"); + case kq931cIeNotImplemented: return presentation(fmt, "kq931cIeNotImplemented", "Information element not implemented"); + case kq931cInvalidIe: return presentation(fmt, "kq931cInvalidIe", "Invalid information element"); + case kq931cMsgIncompatWithState2: return presentation(fmt, "kq931cMsgIncompatWithState2", "Message incompatible with state (2)"); + case kq931cRecoveryOnTimerExpiry: return presentation(fmt, "kq931cRecoveryOnTimerExpiry", "Recovery on timer expiry"); + case kq931cProtocolError: return presentation(fmt, "kq931cProtocolError", "Protocol error"); +#if 1 /* this changed during K3L 1.6.0 development cycle... */ + case kq931cMessageWithUnrecognizedParam: return presentation(fmt, "kq931cMessageWithUnrecognizedParam", "Message with unrecognized parameters"); + case kq931cProtocolErrorUnspecified: return presentation(fmt, "kq931cProtocolErrorUnspecified", "Protocol error unspecified"); +#endif + case kq931cInterworking: return presentation(fmt, "kq931cInterworking", "Interworking"); + case kq931cCallConnected: return presentation(fmt, "kq931cCallConnected", "Call connected"); + case kq931cCallTimedOut: return presentation(fmt, "kq931cCallTimedOut", "Call timeout"); + case kq931cCallNotFound: return presentation(fmt, "kq931cCallNotFound", "Call not found"); + case kq931cCantReleaseCall: return presentation(fmt, "kq931cCantReleaseCall", "Cannot realese call"); + case kq931cNetworkFailure: return presentation(fmt, "kq931cNetworkFailure", "Network failure"); + case kq931cNetworkRestart: return presentation(fmt, "kq931cNetworkRestart", "Network restart"); + } + + throw internal_not_found(); +} + +std::string Verbose::isdnCause(KQ931Cause code, Verbose::Presentation fmt) +{ + try + { + return internal_isdnCause(code); + } + catch (internal_not_found & e) + { + return STG(FMT("[KQ931Cause='%d']") % (int)code); + } +} +#endif + +#if K3L_AT_LEAST(1,5,2) +std::string Verbose::isdnDebug(int32 flags, Verbose::Presentation fmt) +{ + if (0x00 != flags) + { + Strings::Merger strs; + + if (flags & kidfQ931) strs.add("Q931"); + if (flags & kidfLAPD) strs.add("LAPD"); + if (flags & kidfSystem) strs.add("System"); + + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("kidf{%s}") % strs.merge(",")), + strs.merge(", ")); + } + + return presentation(fmt, "", "No debug active"); +} +#endif + +#if K3L_AT_LEAST(2,0,0) +std::string Verbose::internal_signGroupB(KSignGroupB group, R2CountryType country, Verbose::Presentation fmt) +#else +std::string Verbose::internal_signGroupB(KSignGroupB group, Verbose::Presentation fmt) +#endif +{ +#if K3L_AT_LEAST(2,0,0) + switch (country) + { + case R2_COUNTRY_ARG: + switch ((KSignGroupB_Argentina)group) + { + case kgbArNumberChanged: return presentation(fmt, "kgbArNumberChanged", "Number Changed"); + case kgbArBusy: return presentation(fmt, "kgbArBusy", "Busy"); + case kgbArCongestion: return presentation(fmt, "kgbArCongestion", "Congestion"); + case kgbArInvalidNumber: return presentation(fmt, "kgbArInvalidNumber", "Invalid Number"); + case kgbArLineFreeCharged: return presentation(fmt, "kgbArLineFreeCharged", "Line Free Charged"); + case kgbArLineFreeNotCharged: return presentation(fmt, "kgbArLineFreeNotCharged", "Line Free Not Charged"); + case kgbArLineOutOfOrder: return presentation(fmt, "kgbArLineOutOfOrder", "Line Out Of Order"); + case kgbArNone: return presentation(fmt, "kgbArNone", "None"); + } + break; + + case R2_COUNTRY_BRA: + switch ((KSignGroupB_Brazil)group) + { + case kgbBrLineFreeCharged: return presentation(fmt, "kgbBrLineFreeCharged", "Line Free Charged"); + case kgbBrLineFreeNotCharged: return presentation(fmt, "kgbBrLineFreeNotCharged", "Line Free Not Charged"); + case kgbBrLineFreeChargedLPR: return presentation(fmt, "kgbBrLineFreeChargedLPR", "Line Free Charged PLR"); + case kgbBrBusy: return presentation(fmt, "kgbBrBusy", "Busy"); + case kgbBrNumberChanged: return presentation(fmt, "kgbBrNumberChanged", "Number Changed"); + case kgbBrCongestion: return presentation(fmt, "kgbBrCongestion", "Congestion"); + case kgbBrInvalidNumber: return presentation(fmt, "kgbBrInvalidNumber", "Invalid Number"); + case kgbBrLineOutOfOrder: return presentation(fmt, "kgbBrLineOutOfOrder", "Line Out Of Order"); + case kgbBrNone: return presentation(fmt, "kgbBrNone", "None"); + } + break; + + case R2_COUNTRY_CHI: + switch ((KSignGroupB_Chile)group) + { + case kgbClNumberChanged: return presentation(fmt, "kgbClNumberChanged", "Number Changed"); + case kgbClBusy: return presentation(fmt, "kgbClBusy", "Busy"); + case kgbClCongestion: return presentation(fmt, "kgbClCongestion", "Congestion"); + case kgbClInvalidNumber: return presentation(fmt, "kgbClInvalidNumber", "Invalid Number"); + case kgbClLineFreeCharged: return presentation(fmt, "kgbClLineFreeCharged", "Line Free Charged"); + case kgbClLineFreeNotCharged: return presentation(fmt, "kgbClLineFreeNotCharged", "Line Free Not Charged"); + case kgbClLineOutOfOrder: return presentation(fmt, "kgbClLineOutOfOrder", "Line Out Of Order"); + case kgbClNone: return presentation(fmt, "kgbClNone", "None"); + } + break; + + case R2_COUNTRY_MEX: + switch ((KSignGroupB_Mexico)group) + { + case kgbMxLineFreeCharged: return presentation(fmt, "kgbMxLineFreeCharged", "Line Free Charged"); + case kgbMxBusy: return presentation(fmt, "kgbMxBusy", "Busy"); + case kgbMxLineFreeNotCharged: return presentation(fmt, "kgbMxLineFreeNotCharged", "Line Free Not Charged"); + case kgbMxNone: return presentation(fmt, "kgbMxNone", "None"); + } + break; + + case R2_COUNTRY_URY: + switch ((KSignGroupB_Uruguay)group) + { + case kgbUyNumberChanged: return presentation(fmt, "kgbUyNumberChanged", "Number Changed"); + case kgbUyBusy: return presentation(fmt, "kgbUyBusy", "Busy"); + case kgbUyCongestion: return presentation(fmt, "kgbUyCongestion", "Congestion"); + case kgbUyInvalidNumber: return presentation(fmt, "kgbUyInvalidNumber", "Invalid Number"); + case kgbUyLineFreeCharged: return presentation(fmt, "kgbUyLineFreeCharged", "Line Free Charged"); + case kgbUyLineFreeNotCharged: return presentation(fmt, "kgbUyLineFreeNotCharged", "Line Free Not Charged"); + case kgbUyLineOutOfOrder: return presentation(fmt, "kgbUyLineOutOfOrder", "Line Out Of Order"); + case kgbUyNone: return presentation(fmt, "kgbUyNone", "None"); + } + break; + + case R2_COUNTRY_VEN: + switch ((KSignGroupB_Venezuela)group) + { + case kgbVeLineFreeChargedLPR: return presentation(fmt, "kgbVeLineFreeChargedLPR", "Line Free Charged PLR"); + case kgbVeNumberChanged: return presentation(fmt, "kgbVeNumberChanged", "Number Changed"); + case kgbVeBusy: return presentation(fmt, "kgbVeBusy", "Busy"); + case kgbVeCongestion: return presentation(fmt, "kgbVeCongestion", "Congestion"); + case kgbVeInformationTone: return presentation(fmt, "kgbVeInformationTone", "Information Tone"); + case kgbVeLineFreeCharged: return presentation(fmt, "kgbVeLineFreeCharged", "Line Free Charged"); + case kgbVeLineFreeNotCharged: return presentation(fmt, "kgbVeLineFreeNotCharged", "Line Free Not Charged"); + case kgbVeLineBlocked: return presentation(fmt, "kgbVeLineBlocked", "Line Blocked"); + case kgbVeIntercepted: return presentation(fmt, "kgbVeIntercepted", "Intercepted"); + case kgbVeDataTrans: return presentation(fmt, "kgbVeDataTrans", "Data Transfer"); + case kgbVeNone: return presentation(fmt, "kgbVeNone", "None"); + } + break; + } +#else + switch ((KSignGroupB)group) + { + case kgbLineFreeCharged: return presentation(fmt, "kgbLineFreeCharged", "Line Free Charged"); + case kgbLineFreeNotCharged: return presentation(fmt, "kgbLineFreeNotCharged", "Line Free Not Charged"); + case kgbLineFreeChargedLPR: return presentation(fmt, "kgbLineFreeChargedLPR", "Line Free Charged PLR"); + case kgbBusy: return presentation(fmt, "kgbBusy", "Busy"); + case kgbNumberChanged: return presentation(fmt, "kgbNumberChanged", "Number Changed"); + case kgbCongestion: return presentation(fmt, "kgbCongestion", "Congestion"); + case kgbInvalidNumber: return presentation(fmt, "kgbInvalidNumber", "Invalid Number"); + case kgbLineOutOfOrder: return presentation(fmt, "kgbLineOutOfOrder", "Line Out Of Order"); + case kgbNone: return presentation(fmt, "kgbNone", "None"); + } +#endif + + throw internal_not_found(); +} + +#if K3L_AT_LEAST(2,0,0) +std::string Verbose::signGroupB(KSignGroupB group, R2CountryType r2_country, Verbose::Presentation fmt) +#else +std::string Verbose::signGroupB(KSignGroupB group, Verbose::Presentation fmt) +#endif +{ + try + { +#if K3L_AT_LEAST(2,0,0) + return internal_signGroupB(group, r2_country, fmt); +#else + return internal_signGroupB(group, fmt); +#endif + } + catch (internal_not_found & e) + { + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("[KSignGroupB='%d']") % (int)group), + STG(FMT("Unknown group B (%d)") % (int)group)); + } +} + +#if K3L_AT_LEAST(2,0,0) +std::string Verbose::internal_signGroupII(KSignGroupII group, R2CountryType country, Verbose::Presentation fmt) +#else +std::string Verbose::internal_signGroupII(KSignGroupII group, Verbose::Presentation fmt) +#endif +{ +#if K3L_AT_LEAST(2,0,0) + switch (country) + { + case R2_COUNTRY_ARG: + switch ((KSignGroupII_Argentina)group) + { + case kg2ArOrdinary: return presentation(fmt, "kg2ArOrdinary", "Ordinary"); + case kg2ArPriority: return presentation(fmt, "kg2ArPriority", "Priority"); + case kg2ArMaintenance: return presentation(fmt, "kg2ArMaintenance", "Maintenance"); + case kg2ArLocalPayPhone: return presentation(fmt, "kg2ArLocalPayPhone", "Local pay phone"); + case kg2ArTrunkOperator: return presentation(fmt, "kg2ArTrunkOperator", "Trunk operator"); + case kg2ArDataTrans: return presentation(fmt, "kg2ArDataTrans", "Data transfer"); + case kg2ArCPTP: return presentation(fmt, "kg2ArCPTP", "CPTP"); + case kg2ArSpecialLine: return presentation(fmt, "kg2ArSpecialLine", "Special line"); + case kg2ArMobileUser: return presentation(fmt, "kg2ArMobileUser", "Mobile user"); + case kg2ArPrivateRedLine: return presentation(fmt, "kg2ArPrivateRedLine", "Private red line"); + case kg2ArSpecialPayPhoneLine: return presentation(fmt, "kg2ArSpecialPayPhoneLine", "Special pay phone line"); + } + break; + + case R2_COUNTRY_BRA: + switch ((KSignGroupII_Brazil)group) + { + case kg2BrOrdinary: return presentation(fmt, "kg2BrOrdinary", "Ordinary"); + case kg2BrPriority: return presentation(fmt, "kg2BrPriority", "Priority"); + case kg2BrMaintenance: return presentation(fmt, "kg2BrMaintenance", "Maintenance"); + case kg2BrLocalPayPhone: return presentation(fmt, "kg2BrLocalPayPhone", "Local pay phone"); + case kg2BrTrunkOperator: return presentation(fmt, "kg2BrTrunkOperator", "Trunk operator"); + case kg2BrDataTrans: return presentation(fmt, "kg2BrDataTrans", "Data transfer"); + case kg2BrNonLocalPayPhone: return presentation(fmt, "kg2BrNonLocalPayPhone", "Non local pay phone"); + case kg2BrCollectCall: return presentation(fmt, "kg2BrCollectCall", "Collect call"); + case kg2BrOrdinaryInter: return presentation(fmt, "kg2BrOrdinaryInter", "Ordinary international"); + case kg2BrTransfered: return presentation(fmt, "kg2BrTransfered", "Transfered"); + } + break; + + case R2_COUNTRY_CHI: + switch ((KSignGroupII_Chile)group) + { + case kg2ClOrdinary: return presentation(fmt, "kg2ClOrdinary", "Ordinary"); + case kg2ClPriority: return presentation(fmt, "kg2ClPriority", "Priority"); + case kg2ClMaintenance: return presentation(fmt, "kg2ClMaintenance", "Maintenance"); + case kg2ClTrunkOperator: return presentation(fmt, "kg2ClTrunkOperator", "Trunk operator"); + case kg2ClDataTrans: return presentation(fmt, "kg2ClDataTrans", "Data transfer"); + case kg2ClUnidentifiedSubscriber: return presentation(fmt, "kg2ClUnidentifiedSubscriber", "Unidentified subscriber"); + } + break; + + case R2_COUNTRY_MEX: + switch ((KSignGroupII_Mexico)group) + { + case kg2MxTrunkOperator: return presentation(fmt, "kg2MxTrunkOperator", "Trunk operator"); + case kg2MxOrdinary: return presentation(fmt, "kg2MxOrdinary", "Ordinary"); + case kg2MxMaintenance: return presentation(fmt, "kg2MxMaintenance", "Maintenance"); + } + break; + + case R2_COUNTRY_URY: + switch ((KSignGroupII_Uruguay)group) + { + case kg2UyOrdinary: return presentation(fmt, "kg2UyOrdinary", "Ordinary"); + case kg2UyPriority: return presentation(fmt, "kg2UyPriority", "Priority"); + case kg2UyMaintenance: return presentation(fmt, "kg2UyMaintenance", "Maintenance"); + case kg2UyLocalPayPhone: return presentation(fmt, "kg2UyLocalPayPhone", "Local pay phone"); + case kg2UyTrunkOperator: return presentation(fmt, "kg2UyTrunkOperator", "Trunk operator"); + case kg2UyDataTrans: return presentation(fmt, "kg2UyDataTrans", "Data transfer"); + case kg2UyInternSubscriber: return presentation(fmt, "kg2UyInternSubscriber", "International subscriber"); + } + break; + + case R2_COUNTRY_VEN: + switch ((KSignGroupII_Venezuela)group) + { + case kg2VeOrdinary: return presentation(fmt, "kg2VeOrdinary", "Ordinary"); + case kg2VePriority: return presentation(fmt, "kg2VePriority", "Priority"); + case kg2VeMaintenance: return presentation(fmt, "kg2VeMaintenance", "Maintenance"); + case kg2VeLocalPayPhone: return presentation(fmt, "kg2VeLocalPayPhone", "Local pay phone"); + case kg2VeTrunkOperator: return presentation(fmt, "kg2VeTrunkOperator", "Trunk operator"); + case kg2VeDataTrans: return presentation(fmt, "kg2VeDataTrans", "Data transfer"); + case kg2VeNoTransferFacility: return presentation(fmt, "kg2VeNoTransferFacility", "No transfer facility"); + } + break; + } +#else + switch ((KSignGroupII)group) + { + case kg2Ordinary: return presentation(fmt, "kg2Ordinary", "Ordinary"); + case kg2Priority: return presentation(fmt, "kg2Priority", "Priority"); + case kg2Maintenance: return presentation(fmt, "kg2Maintenance", "Maintenance"); + case kg2LocalPayPhone: return presentation(fmt, "kg2LocalPayPhone", "Local pay phone"); + case kg2TrunkOperator: return presentation(fmt, "kg2TrunkOperator", "Trunk operator"); + case kg2DataTrans: return presentation(fmt, "kg2DataTrans", "Data transfer"); + case kg2NonLocalPayPhone: return presentation(fmt, "kg2NonLocalPayPhone", "Non local pay phone"); + case kg2CollectCall: return presentation(fmt, "kg2CollectCall", "Collect call"); + case kg2OrdinaryInter: return presentation(fmt, "kg2OrdinaryInter", "Ordinary international"); + case kg2Transfered: return presentation(fmt, "kg2Transfered", "Transfered"); + } +#endif + + throw internal_not_found(); +} + +#if K3L_AT_LEAST(2,0,0) +std::string Verbose::signGroupII(KSignGroupII group, R2CountryType r2_country, Verbose::Presentation fmt) +#else +std::string Verbose::signGroupII(KSignGroupII group, Verbose::Presentation fmt) +#endif +{ + try + { +#if K3L_AT_LEAST(2,0,0) + return internal_signGroupII(group, r2_country); +#else + return internal_signGroupII(group); +#endif + } + catch (internal_not_found & e) + { + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("[KSignGroupII='%d']") % (int)group), + STG(FMT("Unknown group II (%d)") % (int)group)); + } +} + +#if K3L_AT_LEAST(2,0,0) +std::string Verbose::callFail(KSignaling sig, R2CountryType country, int32 info, Verbose::Presentation fmt) +#else +std::string Verbose::callFail(KSignaling sig, int32 info, Verbose::Presentation fmt) +#endif +{ + try + { + switch (sig) + { + case ksigInactive: + throw internal_not_found(); + + case ksigAnalog: + if (('a' <= ((char)info) && 'z' >= ((char)info)) || ('A' <= ((char)info) && 'Z' >= ((char)info))) + return STG(FMT("%c") % (char)info); + else + throw internal_not_found(); + +#if K3L_AT_LEAST(1,5,4) + case ksigLineSide: +#endif +#if K3L_EXACT(2,1,0) + case ksigISUP: + case ksigFax: +#endif +#if K3L_AT_LEAST(1,6,0) + case ksigCAS_EL7: + case ksigE1LC: + return "NOT IMPLEMENTED"; + + case ksigAnalogTerminal: +#endif + case ksigContinuousEM: + case ksigPulsedEM: + + case ksigR2Digital: + case ksigOpenR2: +#if K3L_AT_LEAST(2,0,0) + return internal_signGroupB((KSignGroupB)info, country); +#else + return internal_signGroupB((KSignGroupB)info); +#endif + + case ksigOpenCAS: + case ksigUserR2Digital: +#if K3L_AT_LEAST(2,0,0) + return internal_signGroupB((KSignGroupB)info, R2_COUNTRY_BRA); +#else + return internal_signGroupB((KSignGroupB)info); +#endif + +#if K3L_AT_LEAST(1,5,0) + case ksigSIP: + return internal_sipFailures((KSIP_Failures)info); +#endif + +#if K3L_AT_LEAST(1,5,1) + case ksigOpenCCS: + case ksigPRI_EndPoint: + case ksigPRI_Network: + case ksigPRI_Passive: +#if K3L_AT_LEAST(2,2,0) + case ksigISUP: + case ksigISUPPassive: +#endif + return internal_isdnCause((KQ931Cause)info); +#endif + +#if K3L_AT_LEAST(1,6,0) + case ksigGSM: + return internal_gsmCallCause((KGsmCallCause)info); +#endif + } + } + catch (internal_not_found & e) + { + /* this exception is used for breaking the control flow */ + } + + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("[%s, callFail='%d']") % signaling(sig, fmt) % (int)info), + STG(FMT("Unknown call fail code for '%s' (%d)") % signaling(sig, fmt) % (int)info)); +} + +std::string Verbose::channelFail(KSignaling sig, int32 code, Verbose::Presentation fmt) +{ + try + { + switch (sig) + { + case ksigInactive: + case ksigAnalog: + case ksigSIP: +#if K3L_EXACT(2,1,0) + case ksigISUP: + case ksigFax: +#endif + throw internal_not_found(); + +#if K3L_AT_LEAST(1,6,0) + case ksigGSM: + return internal_gsmMobileCause((KGsmMobileCause)code); + + case ksigAnalogTerminal: + case ksigCAS_EL7: + case ksigE1LC: +#endif + + case ksigContinuousEM: + case ksigPulsedEM: + + case ksigLineSide: + + case ksigOpenCAS: + case ksigOpenR2: + case ksigR2Digital: + case ksigUserR2Digital: + switch ((KChannelFail)code) + { + case kfcRemoteFail: return presentation(fmt, "kfcRemoteFail", "Remote failure"); + case kfcLocalFail: return presentation(fmt, "kfcLocalFail", "Local failure"); + case kfcRemoteLock: return presentation(fmt, "kfcRemoteLock", "Remote lock"); + case kfcLineSignalFail: return presentation(fmt, "kfcLineSignalFail", "Line signal failure"); + case kfcAcousticSignalFail: return presentation(fmt, "kfcAcousticSignalFail", "Acoustic signal failure"); + } + + throw internal_not_found(); + +#if K3L_AT_LEAST(1,5,1) + case ksigOpenCCS: + case ksigPRI_EndPoint: + case ksigPRI_Network: + case ksigPRI_Passive: +#if K3L_AT_LEAST(2,2,0) + case ksigISUP: + case ksigISUPPassive: +#endif + return internal_isdnCause((KQ931Cause)code); +#endif + } + } + catch (internal_not_found & e) + { + /* this exception is used for breaking the control flow */ + } + + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("[%s, channelFail='%d']") % signaling(sig, fmt) % (int)code), + STG(FMT("Unknown channel fail code for '%s' (%d)") % signaling(sig, fmt) % (int)code)); +} + +std::string Verbose::internalFail(KInternalFail inf, Verbose::Presentation fmt) +{ + switch (inf) + { + case kifInterruptCtrl: return presentation(fmt, "kifInterruptCtrl", "Interrupt control"); + case kifCommunicationFail: return presentation(fmt, "kifCommunicationFail", "Communication failure"); + case kifProtocolFail: return presentation(fmt, "kifProtocolFail", "Protocol failure"); + case kifInternalBuffer: return presentation(fmt, "kifInternalBuffer", "Internal buffer"); + case kifMonitorBuffer: return presentation(fmt, "kifMonitorBuffer", "Monitor buffer"); + case kifInitialization: return presentation(fmt, "kifInitialization", "Initialization"); + case kifInterfaceFail: return presentation(fmt, "kifInterfaceFail", "Interface failure"); + case kifClientCommFail: return presentation(fmt, "kifClientCommFail", "Client communication failure"); + } + + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("[KInternalFail='%d']") % (int)inf), + STG(FMT("Unknown internal failure (%d)") % (int)inf)); +} + +std::string Verbose::linkErrorCounter(KLinkErrorCounter ec, Verbose::Presentation fmt) +{ + switch (ec) + { + case klecChangesToLock: return presentation(fmt, "klecChangesToLock", "Changes to lock"); + case klecLostOfSignal: return presentation(fmt, "klecLostOfSignal", "Lost of signal"); + case klecAlarmNotification: return presentation(fmt, "klecAlarmNotification", "Alarm notification"); + case klecLostOfFrame: return presentation(fmt, "klecLostOfFrame", "Lost of frame"); + case klecLostOfMultiframe: return presentation(fmt, "klecLostOfMultiframe", "Lost of multiframe"); + case klecRemoteAlarm: return presentation(fmt, "klecRemoteAlarm", "Remote alarm"); + case klecUnknowAlarm: return presentation(fmt, "klecUnknowAlarm", "Slip alarm"); + case klecPRBS: return presentation(fmt, "klecPRBS", "PRBS"); + case klecWrogrBits: return presentation(fmt, "klecWrongBits", "Wrong bits"); + case klecJitterVariation: return presentation(fmt, "klecJitterVariation", "Jitter variation"); + case klecFramesWithoutSync: return presentation(fmt, "klecFramesWithoutSync", "Frames without sync"); + case klecMultiframeSignal: return presentation(fmt, "klecMultiframeSignal", "Multiframe Signal"); + case klecFrameError: return presentation(fmt, "klecFrameError", "Frame error"); + case klecBipolarViolation: return presentation(fmt, "klecBipolarViolation", "Bipolar violation"); + case klecCRC4: return presentation(fmt, "klecCRC4", "CRC4 error"); + case klecCount: return ""; /* this should never be verbosed */ + } + + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("[KLinkErrorCounter='%d']") % (int)ec), + STG(FMT("Unknown link error counter (%d)") % (int)ec)); +} + +std::string Verbose::callStatus(KCallStatus code, Verbose::Presentation fmt) +{ + switch (code) + { + case kcsFree: return presentation(fmt, "kcsFree", "Free"); + case kcsIncoming: return presentation(fmt, "kcsIncoming", "Incoming"); + case kcsOutgoing: return presentation(fmt, "kcsOutgoing", "Outgoing"); + case kcsFail: return presentation(fmt, "kcsFail", "Failure"); + } + + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("[KCallStatus='%d']") % (int)code), + STG(FMT("Unknown call status (%d)") % (int)code)); +} + +std::string Verbose::linkStatus(KSignaling sig, int32 code, Verbose::Presentation fmt) +{ + switch (sig) + { + case ksigInactive: + return presentation(fmt, "[ksigInactive]", "Inactive trunk"); + + case ksigAnalog: + return presentation(fmt, "[ksigAnalog]", "Analog trunk"); + +#if K3L_AT_LEAST(1,4,1) + case ksigSIP: + return presentation(fmt, "[ksigSIP]", "SIP trunk"); +#endif + +#if K3L_AT_LEAST(1,6,0) + case ksigGSM: + return presentation(fmt, "[ksigGSM]", "GSM trunk"); +#endif + +#if K3L_EXACT(2,1,0) + case ksigFax: + return presentation(fmt, "[ksigFax]", "FAX"); +#endif + case ksigContinuousEM: + case ksigPulsedEM: + + case ksigOpenCAS: + case ksigOpenR2: + case ksigR2Digital: + case ksigUserR2Digital: + +#if K3L_AT_LEAST(1,5,1) + case ksigOpenCCS: + case ksigPRI_EndPoint: + case ksigPRI_Network: + case ksigPRI_Passive: +#endif +#if K3L_AT_LEAST(1,5,3) + case ksigLineSide: +#endif +#if K3L_AT_LEAST(1,6,0) + case ksigAnalogTerminal: + case ksigCAS_EL7: + case ksigE1LC: +#endif +#if K3L_AT_LEAST(2,2,0) + case ksigISUP: + case ksigISUPPassive: +#endif + if (kesOk == code) + { + return presentation(fmt, "kesOk", "Up"); + } + else + { + Strings::Merger strs; + + if (kesSignalLost & code) strs.add(presentation(fmt, "SignalLost", "Signal lost")); + if (kesNetworkAlarm & code) strs.add(presentation(fmt, "NetworkAlarm", "Network alarm")); + if (kesFrameSyncLost & code) strs.add(presentation(fmt, "FrameSyncLost", "Frame sync lost")); + if (kesMultiframeSyncLost & code) strs.add(presentation(fmt, "MultiframeSyncLost", "Multiframe sync lost")); + if (kesRemoteAlarm & code) strs.add(presentation(fmt, "RemoteAlarm", "Remote alarm")); + if (kesHighErrorRate & code) strs.add(presentation(fmt, "HighErrorRate", "High error rate")); + if (kesUnknownAlarm & code) strs.add(presentation(fmt, "UnknownAlarm", "Slip alarm")); + if (kesE1Error & code) strs.add(presentation(fmt, "E1Error", "E1 error")); + + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("kes{%s}") % strs.merge(",")), + strs.merge(", ")); + } + } + + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("[%s, linkStatus='%d']") % signaling(sig) % (int)code), + STG(FMT("Unknown link status for '%s' (%d)") % signaling(sig) % (int)code)); +} + +std::string Verbose::channelStatus(KSignaling sig, int32 flags, Verbose::Presentation fmt) +{ + try + { + switch (sig) + { + case ksigInactive: + return presentation(fmt, "[ksigInactive]", "Inactive channel"); + +#if K3L_AT_LEAST(1,4,1) + case ksigSIP: + return presentation(fmt, "[ksigSIP]", "SIP channel"); +#endif +#if K3L_EXACT(2,1,0) + case ksigISUP: + return presentation(fmt, "[ksigISUP]", "ISUP trunk"); + case ksigFax: + return presentation(fmt, "[ksigFax]", "FAX"); +#endif + + case ksigAnalog: +#if K3L_AT_LEAST(1,6,0) + switch ((KFXOChannelStatus)flags) +#else + switch ((KFXChannelStatus)flags) +#endif + { + case kfcsDisabled: return presentation(fmt, "kfcsDisabled", "Disabled"); + case kfcsEnabled: return presentation(fmt, "kfcsEnabled", "Enabled"); + } + + throw internal_not_found(); + +#if K3L_AT_LEAST(1,6,0) + case ksigAnalogTerminal: + switch ((KFXSChannelStatus)flags) + { + case kfxsOnHook: return presentation(fmt, "kfxsOnHook", "On Hook"); + case kfxsOffHook: return presentation(fmt, "kfxsOffHook", "Off Hook"); + case kfxsRinging: return presentation(fmt, "kfxsRinging", "Ringing"); + case kfxsFail: return presentation(fmt, "kfxsFail", "Failure"); + } + + throw internal_not_found(); + + case ksigGSM: + switch ((KGsmChannelStatus)flags) + { + case kgsmIdle: return presentation(fmt, "kgsmIdle", "Idle"); + case kgsmCallInProgress: return presentation(fmt, "kgsmCallInProgress", "Call in progress"); + case kgsmSMSInProgress: return presentation(fmt, "kgsmSMSInProgress", "SMS in progress"); + case kgsmModemError: return presentation(fmt, "kgsmModemError", "Modem error"); + case kgsmSIMCardError: return presentation(fmt, "kgsmSIMCardError", "SIM card error"); + case kgsmNetworkError: return presentation(fmt, "kgsmNetworkError", "Network error"); + case kgsmNotReady: return presentation(fmt, "kgsmNotReady", "Initializing"); + } + + throw internal_not_found(); +#endif + + /* deprecated, but still.. */ + case ksigPulsedEM: + case ksigContinuousEM: + + case ksigOpenCAS: + case ksigOpenR2: + case ksigR2Digital: + case ksigUserR2Digital: + +#if K3L_AT_LEAST(1,5,1) + case ksigOpenCCS: + case ksigPRI_EndPoint: + case ksigPRI_Network: + case ksigPRI_Passive: +#endif +#if K3L_AT_LEAST(1,5,3) + case ksigLineSide: +#endif +#if K3L_AT_LEAST(1,6,0) + case ksigCAS_EL7: + case ksigE1LC: +#endif +#if K3L_AT_LEAST(2,2,0) + case ksigISUP: + case ksigISUPPassive: +#endif + { + if (flags == kecsFree) + { + return presentation(fmt, "kecsFree", "Free"); + } + else + { + Strings::Merger strs; + + if (flags & kecsBusy) + strs.add("Busy"); + + switch (flags & 0x06) + { + case kecsOutgoing: + strs.add("Outgoing"); + break; + case kecsIncoming: + strs.add("Incoming"); + break; + case kecsLocked: + strs.add("Locked"); + default: + break; + } + + int32 value = (flags & 0xf0); + + if (kecsOutgoingLock & value) + strs.add(presentation(fmt, "OutgoingLock", "Outgoing Lock")); + + if (kecsLocalFail & value) + strs.add(presentation(fmt, "LocalFail", "Local Failure")); + + if (kecsIncomingLock & value) + strs.add(presentation(fmt, "IncomingLock", "Incoming Lock")); + + if (kecsRemoteLock & value) + strs.add(presentation(fmt, "RemoteLock", "Remote Lock")); + + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("kecs{%s}") % strs.merge(",")), + strs.merge(", ")); + } + + throw internal_not_found(); + } + } + } + catch (internal_not_found & e) + { + /* we use this exception to break the control flow */ + } + + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("[%s, channelStatus='%d']") % signaling(sig) % flags), + STG(FMT("Unknown channel status for '%s' (%d)") % signaling(sig) % flags)); +} + +std::string Verbose::status(KLibraryStatus code, Verbose::Presentation fmt) +{ + switch (code) + { + case ksSuccess: return presentation(fmt, "ksSuccess", "Success"); + case ksFail: return presentation(fmt, "ksFail", "Failure"); + case ksTimeOut: return presentation(fmt, "ksTimeOut", "Time Out"); + case ksBusy: return presentation(fmt, "ksBusy", "Busy"); + case ksLocked: return presentation(fmt, "ksLocked", "Locked"); + case ksInvalidParams: return presentation(fmt, "ksInvalidParams", "Invalid Parameters"); + case ksEndOfFile: return presentation(fmt, "ksEndOfFile", "End of File"); + case ksInvalidState: return presentation(fmt, "ksInvalidState", "Invalid State"); + case ksServerCommFail: return presentation(fmt, "ksServerCommFail", "Communication Failure"); + case ksOverflow: return presentation(fmt, "ksOverflow", "Overflow"); + case ksUnderrun: return presentation(fmt, "ksUnderrun", "Underrun"); + +#if K3L_AT_LEAST(1,4,0) + case ksNotFound: return presentation(fmt, "ksNotFound", "Not Found"); + case ksNotAvailable: return presentation(fmt, "ksNotAvaiable", "Not Available"); +#endif + } + + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("[KLibraryStatus='%d']") % (int)code), + STG(FMT("Unknown library status (%d)") % (int)code)); +} + +std::string Verbose::h100configIndex(KH100ConfigIndex code, Verbose::Presentation fmt) +{ + switch (code) + { + case khciDeviceMode: return presentation(fmt, "khciDeviceMode", "Device Mode"); + case khciMasterGenClock: return presentation(fmt, "khciMasterGenClock", "Master Generated Clock"); + case khciCTNetRefEnable: return presentation(fmt, "khciCTNetRefEnable", "CTBus Network Reference Enable"); + case khciSCbusEnable: return presentation(fmt, "khciSCbusEnable", "SCBus Enable"); + case khciHMVipEnable: return presentation(fmt, "khciHMVipEnable", "HMVip Enable"); + case khciMVip90Enable: return presentation(fmt, "khciMVip90Enable", "MVip90 Enable"); + case khciCTbusDataEnable: return presentation(fmt, "khciCTbusDataEnable", "CTBus Data Enable"); + case khciCTbusFreq03_00: return presentation(fmt, "khciCTbusFreq03_00", "CTBus Frequency 03 00"); // TODO: find better name + case khciCTbusFreq07_04: return presentation(fmt, "khciCTbusFreq07_04", "CTBus Frequency 07 04"); // TODO: find better name + case khciCTbusFreq11_08: return presentation(fmt, "khciCTbusFreq11_08", "CTBus Frequency 11 08"); // TODO: find better name + case khciCTbusFreq15_12: return presentation(fmt, "khciCTbusFreq15_12", "CTBus Frequency 15 12"); // TODO: find better name + case khciMax: return presentation(fmt, "khciMax", "Max"); // TODO: find better name + case khciMasterDevId: return presentation(fmt, "khciMasterDevId", "Master Device Number"); + case khciSecMasterDevId: return presentation(fmt, "khciSecMasterDevId", "Secondary Master Device Number"); + case khciCtNetrefDevId: return presentation(fmt, "khciCtNetrefDevId", "CTBus Network Reference Device Number"); +#if K3L_AT_LEAST(1,6,0) + case khciMaxH100ConfigIndex: return ""; /* do not verbose this value */ +#endif + } + + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("[KH100ConfigIndex='%d']") % (int)code), + STG(FMT("Unknown H.100 config index (%d)") % (int)code)); +} + +#if K3L_AT_LEAST(1,6,0) +std::string Verbose::callStartInfo(KCallStartInfo code, Verbose::Presentation fmt) +{ + switch (code) + { + case kcsiHumanAnswer: return presentation(fmt, "kcsiHumanAnswer", "Human Answer"); + case kcsiAnsweringMachine: return presentation(fmt, "kcsiAnsweringMachine", "Answering Machine"); + case kcsiCellPhoneMessageBox: return presentation(fmt, "kcsiCellPhoneMessageBox", "Cell Phone Message Box"); + case kcsiCarrierMessage: return presentation(fmt, "kcsiCarrierMessage", "Carrier Message"); + case kcsiUnknown: return presentation(fmt, "kcsiUnknown", "Unknown"); + } + + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("[KCallStartInfo='%d']") % (int)code), + STG(FMT("Unknown call answer info (%d)") % (int)code)); +} + +std::string Verbose::gsmCallCause(KGsmCallCause code, Verbose::Presentation fmt) +{ + try + { + return internal_gsmCallCause(code, fmt); + } + catch (internal_not_found & e) + { + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("[KGsmCallCause='%d']") % (int)code), + STG(FMT("Unknown GSM call cause (%d)") % (int)code)); + } +} + +std::string Verbose::internal_gsmCallCause(KGsmCallCause code, Verbose::Presentation fmt) +{ + switch (code) + { + case kgccNone: return presentation(fmt, "kgccNone", "None"); + case kgccUnallocatedNumber: return presentation(fmt, "kgccUnallocatedNumber", "Unallocated number"); + case kgccNoRouteToDest: return presentation(fmt, "kgccNoRouteToDest", "No route to destination"); + case kgccChannelUnacceptable: return presentation(fmt, "kgccChannelUnacceptable", "Channel unacceptable"); + case kgccOperatorDeterminedBarring: return presentation(fmt, "kgccOperatorDeterminedBarring", "Operator determined barring"); + case kgccNormalCallClear: return presentation(fmt, "kgccNormalCallClear", "Normal call clear"); + case kgccUserBusy: return presentation(fmt, "kgccUserBusy", "User busy"); + case kgccNoUserResponding: return presentation(fmt, "kgccNoUserResponding", "No user responding"); + case kgccNoAnswerFromUser: return presentation(fmt, "kgccNoAnswerFromUser", "No answer from user"); + case kgccCallRejected: return presentation(fmt, "kgccCallRejected", "Call rejected"); + case kgccNumberChanged: return presentation(fmt, "kgccNumberChanged", "Number changed"); + case kgccNonSelectedUserClear: return presentation(fmt, "kgccNonSelectedUserClear", "Non Selected user clear"); + case kgccDestinationOutOfOrder: return presentation(fmt, "kgccDestinationOutOfOrder", "Destination out of order"); + case kgccInvalidNumberFormat: return presentation(fmt, "kgccInvalidNumberFormat", "Invalid number format"); + case kgccFacilityRejected: return presentation(fmt, "kgccFacilityRejected", "Facility rejected"); + case kgccRespStatusEnquiry: return presentation(fmt, "kgccRespStatusEnquiry", "Response status enquiry"); + case kgccNormalUnspecified: return presentation(fmt, "kgccNormalUnspecified", "Normal, unspecified"); + case kgccNoCircuitChannelAvail: return presentation(fmt, "kgccNoCircuitChannelAvail", "No circuit channel available"); + case kgccNetworkOutOfOrder: return presentation(fmt, "kgccNetworkOutOfOrder", "Network out of order"); + case kgccTemporaryFailure: return presentation(fmt, "kgccTemporaryFailure", "Temporary failure"); + case kgccSwitchCongestion: return presentation(fmt, "kgccSwitchCongestion", "Switch congestion"); + case kgccAccessInfoDiscarded: return presentation(fmt, "kgccAccessInfoDiscarded", "Access information discarded"); + case kgccRequestedChannelUnav: return presentation(fmt, "kgccRequestedChannelUnav", "Requested channel unavailable"); + case kgccResourceUnavailable: return presentation(fmt, "kgccResourceUnavailable", "Resource unavailable"); + case kgccQosUnavailable: return presentation(fmt, "kgccQosUnavailable", "QoS unavailable"); + case kgccReqFacilityNotSubsc: return presentation(fmt, "kgccReqFacilityNotSubsc", "Request facility not subscribed"); + case kgccCallBarredWitchCUG: return presentation(fmt, "kgccCallBarredWitchCUG", "Call barred with UG"); + case kgccBearerCapabNotAuthor: return presentation(fmt, "kgccBearerCapabNotAuthor", "Bearer capability not authorized"); + case kgccBearerCapabNotAvail: return presentation(fmt, "kgccBearerCapabNotAvail", "Bearer capability not available"); + case kgccServiceNotAvailable: return presentation(fmt, "kgccServiceNotAvailable", "Service not available"); + case kgccBcNotImplemented: return presentation(fmt, "kgccBcNotImplemented", "Bearer capability not implemented"); + case kgccReqFacilityNotImplem: return presentation(fmt, "kgccReqFacilityNotImplem", "Request facility not implemented"); + case kgccOnlyRestrictedBcAvail: return presentation(fmt, "kgccOnlyRestrictedBcAvail", "Only restricted bearer capability available"); + case kgccServiceNotImplemented: return presentation(fmt, "kgccServiceNotImplemented", "Service not implemented"); + case kgccInvalidCrv: return presentation(fmt, "kgccInvalidCrv", "Invalid call reference value"); + case kgccUserNotMemberOfCUG: return presentation(fmt, "kgccUserNotMemberOfCUG", "User not member of UG"); + case kgccIncompatibleDestination: return presentation(fmt, "kgccIncompatibleDestination", "Incompatible destination"); + case kgccInvalidTransitNetSel: return presentation(fmt, "kgccInvalidTransitNetSel", "Invalid transit network selected"); + case kgccInvalidMessage: return presentation(fmt, "kgccInvalidMessage", "Invalid message"); + case kgccMissingMandatoryIe: return presentation(fmt, "kgccMissingMandatoryIe", "Missing mandatory information element"); + case kgccMsgTypeNotImplemented: return presentation(fmt, "kgccMsgTypeNotImplemented", "Message type not implemented"); + case kgccMsgIncompatWithState: return presentation(fmt, "kgccMsgIncompatWithState", "Message incompatible with state"); + case kgccIeNotImplemented: return presentation(fmt, "kgccIeNotImplemented", "Information element not implemented"); + case kgccInvalidIe: return presentation(fmt, "kgccInvalidIe", "Invalid information element"); + case kgccMsgIncompatWithState2: return presentation(fmt, "kgccMsgIncompatWithState2", "Message incompatible with state (2)"); + case kgccRecoveryOnTimerExpiry: return presentation(fmt, "kgccRecoveryOnTimerExpiry", "Recovery on timer expiry"); + case kgccProtocolError: return presentation(fmt, "kgccProtocolError", "Protocol error"); + case kgccInterworking: return presentation(fmt, "kgccInterworking", "Interworking"); + } + + throw internal_not_found(); +} + +std::string Verbose::gsmMobileCause(KGsmMobileCause code, Verbose::Presentation fmt) +{ + try + { + return internal_gsmMobileCause(code, fmt); + } + catch (internal_not_found & e) + { + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("[KGsmMobileCause='%d']") % (int)code), + STG(FMT("Unknown GSM mobile cause (%d)") % (int)code)); + } +} + +std::string Verbose::internal_gsmMobileCause(KGsmMobileCause code, Verbose::Presentation fmt) +{ + switch (code) + { + case kgmcPhoneFailure: return presentation(fmt, "kgmcPhoneFailure", "Phone failure"); + case kgmcNoConnectionToPhone: return presentation(fmt, "kgmcNoConnectionToPhone", "No connection to phone"); + case kgmcPhoneAdaptorLinkReserved: return presentation(fmt, "kgmcPhoneAdaptorLinkReserved", "Phone adaptor link reserved"); +#if 0 /* this changed during K3L 1.6.0 development cycle... */ + case kgmcCoperationNotAllowed: return presentation(fmt, "kgmcCoperationNotAllowed", ""); + case kgmcCoperationNotSupported: return presentation(fmt, "kgmcCoperationNotSupported", ""); +#else + case kgmcOperationNotAllowed: return presentation(fmt, "kgmcOperationNotAllowed", "Operation not allowed"); + case kgmcOperationNotSupported: return presentation(fmt, "kgmcOperationNotSupported", "Operation not supported"); +#endif + case kgmcPH_SIMPINRequired: return presentation(fmt, "kgmcPH_SIMPINRequired", "Phone SIM PIN required"); + case kgmcPH_FSIMPINRequired: return presentation(fmt, "kgmcPH_FSIMPINRequired", "Phone FSIM PIN required"); + case kgmcPH_FSIMPUKRequired: return presentation(fmt, "kgmcPH_FSIMPUKRequired", "Phone FSIM PUK required"); + case kgmcSIMNotInserted: return presentation(fmt, "kgmcSIMNotInserted", "SIM not inserted"); + case kgmcSIMPINRequired: return presentation(fmt, "kgmcSIMPINRequired", "SIM PIN required"); + case kgmcSIMPUKRequired: return presentation(fmt, "kgmcSIMPUKRequired", "SIM PUK required"); + case kgmcSIMFailure: return presentation(fmt, "kgmcSIMFailure", "SIM failure"); + case kgmcSIMBusy: return presentation(fmt, "kgmcSIMBusy", "SIM busy"); + case kgmcSIMWrong: return presentation(fmt, "kgmcSIMWrong", "SIM wrong"); + case kgmcIncorrectPassword: return presentation(fmt, "kgmcIncorrectPassword", "Incorrect password"); + case kgmcSIMPIN2Required: return presentation(fmt, "kgmcSIMPIN2Required", "SIM PIN2 required"); + case kgmcSIMPUK2Required: return presentation(fmt, "kgmcSIMPUK2Required", "SIM PUK2 required"); + case kgmcMemoryFull: return presentation(fmt, "kgmcMemoryFull", "Memory full"); + case kgmcInvalidIndex: return presentation(fmt, "kgmcInvalidIndex", "Invalid index"); + case kgmcNotFound: return presentation(fmt, "kgmcNotFound", "Not found"); + case kgmcMemoryFailure: return presentation(fmt, "kgmcMemoryFailure", "Memory failure"); + case kgmcTextStringTooLong: return presentation(fmt, "kgmcTextStringTooLong", "Text string too long"); + case kgmcInvalidCharInTextString: return presentation(fmt, "kgmcInvalidCharInTextString", "Invalid character in text string"); + case kgmcDialStringTooLong: return presentation(fmt, "kgmcDialStringTooLong", "Dial string too long"); + case kgmcInvalidCharInDialString: return presentation(fmt, "kgmcInvalidCharInDialString", "Invalid character in dial string"); + case kgmcNoNetworkService: return presentation(fmt, "kgmcNoNetworkService", "No network service"); + case kgmcNetworkTimeout: return presentation(fmt, "kgmcNetworkTimeout", "Network timeout"); + case kgmcNetworkNotAllowed: return presentation(fmt, "kgmcNetworkNotAllowed", "Network not allowed"); + case kgmcCommandAborted: return presentation(fmt, "kgmcCommandAborted", "Command aborted"); + case kgmcNumParamInsteadTextParam: return presentation(fmt, "kgmcNumParamInsteadTextParam", "Number parameter instead of text parameter"); + case kgmcTextParamInsteadNumParam: return presentation(fmt, "kgmcTextParamInsteadNumParam", "Text parameter instead of number parameter"); + case kgmcNumericParamOutOfBounds: return presentation(fmt, "kgmcNumericParamOutOfBounds", "Numeric parameter out of bounds"); + case kgmcTextStringTooShort: return presentation(fmt, "kgmcTextStringTooShort", "Text string too short"); + case kgmcNetworkPINRequired: return presentation(fmt, "kgmcNetworkPINRequired", "Network PIN required"); + case kgmcNetworkPUKRequired: return presentation(fmt, "kgmcNetworkPUKRequired", "Network PUK required"); + case kgmcNetworkSubsetPINRequired: return presentation(fmt, "kgmcNetworkSubsetPINRequired", "Network subset PIN required"); + case kgmcNetworkSubnetPUKRequired: return presentation(fmt, "kgmcNetworkSubnetPUKRequired", "Network subset PUK required"); + case kgmcServiceProviderPINRequired: return presentation(fmt, "kgmcServiceProviderPINRequired", "Network service provider PIN required"); + case kgmcServiceProviderPUKRequired: return presentation(fmt, "kgmcServiceProviderPUKRequired", "Network service provider PUK required"); + case kgmcCorporatePINRequired: return presentation(fmt, "kgmcCorporatePINRequired", "Corporate PIN required"); + case kgmcCorporatePUKRequired: return presentation(fmt, "kgmcCorporatePUKRequired", "Corporate PUK required"); + case kgmcSIMServiceOptNotSupported: return presentation(fmt, "kgmcSIMServiceOptNotSupported", "SIM Service option not supported"); + case kgmcUnknown: return presentation(fmt, "kgmcUnknown", "Unknown"); + case kgmcIllegalMS_N3: return presentation(fmt, "kgmcIllegalMS_N3", "Illegal MS #3"); + case kgmcIllegalME_N6: return presentation(fmt, "kgmcIllegalME_N6", "Illegal MS #6"); + case kgmcGPRSServicesNotAllowed_N7: return presentation(fmt, "kgmcGPRSServicesNotAllowed_N7", "GPRS service not allowed #7"); + case kgmcPLMNNotAllowed_No11: return presentation(fmt, "kgmcPLMNNotAllowed_No11", "PLMN not allowed #11"); + case kgmcLocationAreaNotAllowed_N12: return presentation(fmt, "kgmcLocationAreaNotAllowed_N12", "Location area not allowed #12"); + case kgmcRoamingNotAllowed_N13: return presentation(fmt, "kgmcRoamingNotAllowed_N13", "Roaming not allowed #13"); + case kgmcServiceOptNotSupported_N32: return presentation(fmt, "kgmcServiceOptNotSupported_N32", "Service option not supported #32"); + case kgmcReqServOptNotSubscribed_N33: return presentation(fmt, "kgmcReqServOptNotSubscribed_N33", "Registration service option not subscribed #33"); + case kgmcServOptTempOutOfOrder_N34: return presentation(fmt, "kgmcServOptTempOutOfOrder_N34", "Service option temporary out of order #34"); + case kgmcLongContextActivation: return presentation(fmt, "kgmcLongContextActivation", "Long context activation"); + case kgmcUnspecifiedGPRSError: return presentation(fmt, "kgmcUnspecifiedGPRSError", "Unspecified GPRS error"); + case kgmcPDPAuthenticationFailure: return presentation(fmt, "kgmcPDPAuthenticationFailure", "PDP authentication failure"); + case kgmcInvalidMobileClass: return presentation(fmt, "kgmcInvalidMobileClass", "Invalid mobile class"); + case kgmcGPRSDisconnectionTmrActive: return presentation(fmt, "kgmcGPRSDisconnectionTmrActive", "GPRS disconnection TMR active"); + case kgmcTooManyActiveCalls: return presentation(fmt, "kgmcTooManyActiveCalls", "Too many active calls"); + case kgmcCallRejected: return presentation(fmt, "kgmcCallRejected", "Call rejected"); + case kgmcUnansweredCallPending: return presentation(fmt, "kgmcUnansweredCallPending", "Unanswered call pending"); + case kgmcUnknownCallingError: return presentation(fmt, "kgmcUnknownCallingError", "Unknown calling error"); + case kgmcNoPhoneNumRecognized: return presentation(fmt, "kgmcNoPhoneNumRecognized", "No phone number recognized"); + case kgmcCallStateNotIdle: return presentation(fmt, "kgmcCallStateNotIdle", "Call state not idle"); + case kgmcCallInProgress: return presentation(fmt, "kgmcCallInProgress", "Call in progress"); + case kgmcDialStateError: return presentation(fmt, "kgmcDialStateError", "Dial state error"); + case kgmcUnlockCodeRequired: return presentation(fmt, "kgmcUnlockCodeRequired", "Unlock code required"); + case kgmcNetworkBusy: return presentation(fmt, "kgmcNetworkBusy", "Network busy"); + case kgmcInvalidPhoneNumber: return presentation(fmt, "kgmcInvalidPhoneNumber", "Invalid phone number"); + case kgmcNumberEntryAlreadyStarted: return presentation(fmt, "kgmcNumberEntryAlreadyStarted", "Number entry already started"); + case kgmcCancelledByUser: return presentation(fmt, "kgmcCancelledByUser", "Cancelled by user"); + case kgmcNumEntryCouldNotBeStarted: return presentation(fmt, "kgmcNumEntryCouldNotBeStarted", "Number entry could not be started"); + case kgmcDataLost: return presentation(fmt, "kgmcDataLost", "Data lost"); + case kgmcInvalidBessageBodyLength: return presentation(fmt, "kgmcInvalidBessageBodyLength", "Invalid message body length"); + case kgmcInactiveSocket: return presentation(fmt, "kgmcInactiveSocket", "Inactive socket"); + case kgmcSocketAlreadyOpen: return presentation(fmt, "kgmcSocketAlreadyOpen", "Socket already open"); +#if K3L_AT_LEAST(2,1,0) + case kgmcSuccess: return presentation(fmt, "kgmcSuccess", "Success"); +#endif + } + + throw internal_not_found(); +} + +std::string Verbose::gsmSmsCause(KGsmSmsCause code, Verbose::Presentation fmt) +{ + try + { + return internal_gsmSmsCause(code, fmt); + } + catch (internal_not_found & e) + { + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("[KGsmSmsCause='%d']") % (int)code), + STG(FMT("Unknown GSM SMS cause (%d)") % (int)code)); + } +} + +std::string Verbose::internal_gsmSmsCause(KGsmSmsCause code, Verbose::Presentation fmt) +{ + switch (code) + { +#if K3L_AT_LEAST(2,1,0) + case kgscNone: return presentation(fmt, "kgscNone", "None"); +#endif + case kgscUnassigned: return presentation(fmt, "kgscUnassigned", "Unassigned number"); + case kgscOperatorDeterminedBarring: return presentation(fmt, "kgscOperatorDeterminedBarring", "Operator determined barring"); + case kgscCallBarred: return presentation(fmt, "kgscCallBarred", "Call barred"); + case kgscSMSTransferRejected: return presentation(fmt, "kgscSMSTransferRejected", "SMS transfer rejected"); + case kgscDestinationOutOfService: return presentation(fmt, "kgscDestinationOutOfService", "Destination out of service"); + case kgscUnidentifiedSubscriber: return presentation(fmt, "kgscUnidentifiedSubscriber", "Unidentified subscriber"); + case kgscFacilityRejected: return presentation(fmt, "kgscFacilityRejected", "Facility rejected"); + case kgscUnknownSubscriber: return presentation(fmt, "kgscUnknownSubscriber", "Unknown subscriber"); + case kgscNetworkOutOfOrder: return presentation(fmt, "kgscNetworkOutOfOrder", "Network out of order"); + case kgscTemporaryFailure: return presentation(fmt, "kgscTemporaryFailure", "Temporary failure"); + case kgscCongestion: return presentation(fmt, "kgscCongestion", "Congestion"); + case kgscResourcesUnavailable: return presentation(fmt, "kgscResourcesUnavailable", "Resources unavailable"); + case kgscFacilityNotSubscribed: return presentation(fmt, "kgscFacilityNotSubscribed", "Facility not subscribed"); + case kgscFacilityNotImplemented: return presentation(fmt, "kgscFacilityNotImplemented", "Facility not implemented"); + case kgscInvalidSMSTransferRefValue: return presentation(fmt, "kgscInvalidSMSTransferRefValue", "Invalid SMS transfer reference value"); + case kgscInvalidMessage: return presentation(fmt, "kgscInvalidMessage", "Invalid message"); + case kgscInvalidMandatoryInformation: return presentation(fmt, "kgscInvalidMandatoryInformation", "Invalid mandatory information"); + case kgscMessageTypeNonExistent: return presentation(fmt, "kgscMessageTypeNonExistent", "Message type non existent"); + case kgscMsgNotCompatWithSMProtState: return presentation(fmt, "kgscMsgNotCompatWithSMProtState", "Message not compatible with SMS protection state"); + case kgscInformationElementNonExiste: return presentation(fmt, "kgscInformationElementNonExiste", "Information element non existent"); + case kgscProtocolError: return presentation(fmt, "kgscProtocolError", "Protocol error"); + case kgscInterworking: return presentation(fmt, "kgscInterworking", "Interworking"); + case kgscTelematicInterworkingNotSup: return presentation(fmt, "kgscTelematicInterworkingNotSup", "Telematic interworking not supported"); + case kgscSMSTypeZeroNotSupported: return presentation(fmt, "kgscSMSTypeZeroNotSupported", "SMS type zero not supported"); + case kgscCannotReplaceSMS: return presentation(fmt, "kgscCannotReplaceSMS", "Cannot replace SMS"); + case kgscUnspecifiedTPPIDError: return presentation(fmt, "kgscUnspecifiedTPPIDError", "Unspecified TPPID error"); + case kgscAlphabetNotSupported: return presentation(fmt, "kgscAlphabetNotSupported", "Alphabet not supported"); + case kgscMessageClassNotSupported: return presentation(fmt, "kgscMessageClassNotSupported", "Message class not supported"); + case kgscUnspecifiedTPDCSError: return presentation(fmt, "kgscUnspecifiedTPDCSError", "Unspecified TPDCS error"); + case kgscCommandCannotBeActioned: return presentation(fmt, "kgscCommandCannotBeActioned", "Command cannot be actioned"); + case kgscCommandUnsupported: return presentation(fmt, "kgscCommandUnsupported", "Command unsupported"); + case kgscUnspecifiedTPCommandError: return presentation(fmt, "kgscUnspecifiedTPCommandError", "Unspecified TP command error"); + case kgscTPDUNotSupported: return presentation(fmt, "kgscTPDUNotSupported", "TPDU not supported"); + case kgscSCBusy: return presentation(fmt, "kgscSCBusy", "SC busy"); + case kgscNoSCSubscription: return presentation(fmt, "kgscNoSCSubscription", "No SC subscription"); + case kgscSCSystemFailure: return presentation(fmt, "kgscSCSystemFailure", "SC system failure"); + case kgscInvalidSMEAddress: return presentation(fmt, "kgscInvalidSMEAddress", "Invalid SME address"); + case kgscDestinationSMEBarred: return presentation(fmt, "kgscDestinationSMEBarred", "Destination SME barred"); + case kgscSMRejectedDuplicateSM: return presentation(fmt, "kgscSMRejectedDuplicateSM", "SM rejected duplicate SM"); + case kgscTPVPFNotSupported: return presentation(fmt, "kgscTPVPFNotSupported", "TPVPF not supported"); + case kgscTPVPNotSupported: return presentation(fmt, "kgscTPVPNotSupported", "TPVP not supported"); + case kgscSIMSMSStorageFull: return presentation(fmt, "kgscSIMSMSStorageFull", "SIM SMS storage full"); + case kgscNoSMSStorageCapabilityInSIM: return presentation(fmt, "kgscNoSMSStorageCapabilityInSIM", "No SMS storage capability in SIM"); + case kgscErrorInMS: return presentation(fmt, "kgscErrorInMS", "Error in SMS"); + case kgscMemoryCapacityExceeded: return presentation(fmt, "kgscMemoryCapacityExceeded", "Memory capatity exceeded"); + case kgscSIMDataDownloadError: return presentation(fmt, "kgscSIMDataDownloadError", "SIM data download error"); + case kgscUnspecifiedError: return presentation(fmt, "kgscUnspecifiedError", "Unspecified error"); + case kgscPhoneFailure: return presentation(fmt, "kgscPhoneFailure", "Phone failure"); + case kgscSmsServiceReserved: return presentation(fmt, "kgscSmsServiceReserved", "SMS service reserved"); + case kgscOperationNotAllowed: return presentation(fmt, "kgscOperationNotAllowed", "Operation not allowed"); + case kgscOperationNotSupported: return presentation(fmt, "kgscOperationNotSupported", "Operation not supported"); + case kgscInvalidPDUModeParameter: return presentation(fmt, "kgscInvalidPDUModeParameter", "Invalid PDU mode parameter"); + case kgscInvalidTextModeParameter: return presentation(fmt, "kgscInvalidTextModeParameter", "Invalid text mode parameter"); + case kgscSIMNotInserted: return presentation(fmt, "kgscSIMNotInserted", "SIM not inserted"); + case kgscSIMPINNecessary: return presentation(fmt, "kgscSIMPINNecessary", "SIM PIN necessary"); + case kgscPH_SIMPINNecessary: return presentation(fmt, "kgscPH_SIMPINNecessary", "Phone SIM PIN necessary"); + case kgscSIMFailure: return presentation(fmt, "kgscSIMFailure", "SIM failure"); + case kgscSIMBusy: return presentation(fmt, "kgscSIMBusy", "SIM busy"); + case kgscSIMWrong: return presentation(fmt, "kgscSIMWrong", "SIM wrong"); + case kgscMemoryFailure: return presentation(fmt, "kgscMemoryFailure", "Memory failure"); + case kgscInvalidMemoryIndex: return presentation(fmt, "kgscInvalidMemoryIndex", "Invalid memory index"); + case kgscMemoryFull: return presentation(fmt, "kgscMemoryFull", "Memory full"); + case kgscSMSCAddressUnknown: return presentation(fmt, "kgscSMSCAddressUnknown", "SMSC address unknown"); + case kgscNoNetworkService: return presentation(fmt, "kgscNoNetworkService", "No network service"); + case kgscNetworkTimeout: return presentation(fmt, "kgscNetworkTimeout", "Network timeout"); + case kgscUnknownError: return presentation(fmt, "kgscUnknownError", "Unknown error"); + case kgscNetworkBusy: return presentation(fmt, "kgscNetworkBusy", "Network busy"); + case kgscInvalidDestinationAddress: return presentation(fmt, "kgscInvalidDestinationAddress", "Invalid destination address"); + case kgscInvalidMessageBodyLength: return presentation(fmt, "kgscInvalidMessageBodyLength", "Invalid message body length"); + case kgscPhoneIsNotInService: return presentation(fmt, "kgscPhoneIsNotInService", "Phone is not in service"); + case kgscInvalidPreferredMemStorage: return presentation(fmt, "kgscInvalidPreferredMemStorage", "Invalid preferred memory storage"); + case kgscUserTerminated: return presentation(fmt, "kgscUserTerminated", "User terminated"); + } + + throw internal_not_found(); +} + +std::string Verbose::q931ProgressIndication(KQ931ProgressIndication code, Verbose::Presentation fmt) +{ + try + { + return internal_q931ProgressIndication(code); + } + catch (internal_not_found & e) + { + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("[KQ931ProgressIndication='%d']") % (int)code), + STG(FMT("Unknown Q931 progress indication (%d)") % (int)code)); + } +} + +std::string Verbose::internal_q931ProgressIndication(KQ931ProgressIndication code, Verbose::Presentation fmt) +{ + switch (code) + { + case kq931pTonesMaybeAvailable: return presentation(fmt, "kq931pTonesMaybeAvailable", "Tones may be available"); + case kq931pDestinationIsNonIsdn: return presentation(fmt, "kq931pDestinationIsNonIsdn", "Destination is not ISDN"); + case kq931pOriginationIsNonIsdn: return presentation(fmt, "kq931pOriginationIsNonIsdn", "Origination is not ISDN"); + case kq931pCallReturnedToIsdn: return presentation(fmt, "kq931pCallReturnedToIsdn", "Call returned to ISDN"); + case kq931pTonesAvailable: return presentation(fmt, "kq931pTonesAvailable", "Tones available"); + } + + throw internal_not_found(); +} + +#endif /* K3L_AT_LEAST(1,6,0) */ + + + + +#if K3L_AT_LEAST(2,1,0) +std::string Verbose::faxResult(KFaxResult code, Verbose::Presentation fmt) +{ + switch (code) + { + case kfaxrEndOfTransmission: return presentation(fmt, "kfaxrEndOfTransmission", "EndOfTransmission"); + case kfaxrStoppedByCommand: return presentation(fmt, "kfaxrStoppedByCommand", "StoppedByCommand"); + case kfaxrProtocolTimeout: return presentation(fmt, "kfaxrProtocolTimeout", "ProtocolTimeout"); + case kfaxrProtocolError: return presentation(fmt, "kfaxrProtocolError", "ProtocolError"); + case kfaxrRemoteDisconnection: return presentation(fmt, "kfaxrRemoteDisconnection", "RemoteDisconnection"); + case kfaxrFileError: return presentation(fmt, "kfaxrFileError", "FileError"); + case kfaxrUnknown: return presentation(fmt, "kfaxrUnknown", "Unknown"); + case kfaxrEndOfReception: return presentation(fmt, "kfaxrEndOfReception", "EndOfReception"); + case kfaxrCompatibilityError: return presentation(fmt, "kfaxrCompatibilityError", "CompatibilityError"); + case kfaxrQualityError: return presentation(fmt, "kfaxrQualityError", "QualityError"); + } + + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("[KFaxResult='%d']") % (int)code), + STG(FMT("Unknown fax result (%d)") % (int)code)); +} + +std::string Verbose::faxFileErrorCause(KFaxFileErrorCause code, Verbose::Presentation fmt) +{ + switch (code) + { + case kfaxfecTransmissionStopped: return presentation(fmt, "kfaxfecTransmissionStopped", "TransmissionStopped"); + case kfaxfecTransmissionError: return presentation(fmt, "kfaxfecTransmissionError", "TransmissionError"); + case kfaxfecListCleared: return presentation(fmt, "kfaxfecListCleared", "ListCleared"); + case kfaxfecCouldNotOpen: return presentation(fmt, "kfaxfecCouldNotOpen", "CouldNotOpen"); + case kfaxfecInvalidHeader: return presentation(fmt, "kfaxfecInvalidHeader", "InvalidHeader"); + case kfaxfecDataNotFound: return presentation(fmt, "kfaxfecDataNotFound", "DataNotFound"); + case kfaxfecInvalidHeight: return presentation(fmt, "kfaxfecInvalidHeight", "InvalidHeight"); + case kfaxfecUnsupportedWidth: return presentation(fmt, "kfaxfecUnsupportedWidth", "UnsupportedWidth"); + case kfaxfecUnsupportedCompression: return presentation(fmt, "kfaxfecUnsupportedCompression", "UnsupportedCompression"); + case kfaxfecUnsupportedRowsPerStrip: return presentation(fmt, "kfaxfecUnsupportedRowsPerStrip", "UnsupportedRowsPerStrip"); + case kfaxfecUnknown: return presentation(fmt, "kfaxfecUnknown", "Unknown"); + } + + PRESENTATION_CHECK_RETURN(fmt, + STG(FMT("[KFaxFileErrorCause='%d']") % (int)code), + STG(FMT("Unknown fax file error cause (%d)") % (int)code)); +} + +#endif + + +/********/ + +std::string Verbose::commandName(int32 code) +{ + switch ((kcommand)code) + { + case K_CM_SEIZE: return "CM_SEIZE"; + case K_CM_SYNC_SEIZE: return "CM_SYNC_SEIZE"; + case K_CM_DIAL_DTMF: return "CM_DIAL_DTMF"; +#if K3L_AT_LEAST(1,6,0) + case K_CM_SIP_REGISTER: return "CM_SIP_REGISTER"; +#endif + case K_CM_DISCONNECT: return "CM_DISCONNECT"; + case K_CM_CONNECT: return "CM_CONNECT"; + case K_CM_PRE_CONNECT: return "CM_PRE_CONNECT"; + case K_CM_CAS_CHANGE_LINE_STT: return "CM_CAS_CHANGE_LINE_STT"; + case K_CM_CAS_SEND_MFC: return "CM_CAS_SEND_MFC"; + case K_CM_SET_FORWARD_CHANNEL: return "CM_SET_FORWARD_CHANNEL"; + case K_CM_CAS_SET_MFC_DETECT_MODE: return "CM_CAS_SET_MFC_DETECT_MODE"; + case K_CM_DROP_COLLECT_CALL: return "CM_DROP_COLLECT_CALL"; + +#if K3L_AT_LEAST(1,5,0) + case K_CM_MAKE_CALL: return "CM_MAKE_CALL"; +#endif + +#if K3L_AT_LEAST(1,4,0) + case K_CM_RINGBACK: return "CM_RINGBACK"; +#endif + +#if K3L_AT_LEAST(1,5,1) + case K_CM_USER_INFORMATION: return "CM_USER_INFORMATION"; +#endif + +#if K3L_AT_LEAST(1,4,0) && !K3L_AT_LEAST(2,2,0) + case K_CM_VOIP_SEIZE: return "CM_VOIP_SEIZE"; + +#if !K3L_AT_LEAST(2,0,0) + /* internal commands */ + case K_CM_VOIP_START_DEBUG: return "CM_VOIP_START_DEBUG"; + case K_CM_VOIP_STOP_DEBUG: return "CM_VOIP_STOP_DEBUG"; + case K_CM_VOIP_DUMP_STAT: return "CM_VOIP_DUMP_STAT"; +#endif +#endif + +#if K3L_AT_LEAST(1,5,2) && !K3L_AT_LEAST(2,0,0) + /* internal command */ + case K_CM_ISDN_DEBUG: return "CM_ISDN_DEBUG"; +#endif + + case K_CM_LOCK_INCOMING: return "CM_LOCK_INCOMING"; + case K_CM_UNLOCK_INCOMING: return "CM_UNLOCK_INCOMING"; + case K_CM_LOCK_OUTGOING: return "CM_LOCK_OUTGOING"; + case K_CM_UNLOCK_OUTGOING: return "CM_UNLOCK_OUTGOING"; + + case K_CM_START_SEND_FAIL: return "CM_START_SEND_FAIL"; + case K_CM_STOP_SEND_FAIL: return "CM_STOP_SEND_FAIL"; + +#if K3L_AT_LEAST(1,5,3) + case K_CM_END_OF_NUMBER: return "CM_END_OF_NUMBER"; +#endif + +#if K3L_AT_LEAST(1,6,0) + case K_CM_SS_TRANSFER: return "CM_SS_TRANSFER"; + case K_CM_GET_SMS: return "CM_GET_SMS"; + case K_CM_PREPARE_SMS: return "CM_PREPARE_SMS"; + case K_CM_SEND_SMS: return "CM_SEND_SMS"; +#endif +#if K3L_HAS_MPTY_SUPPORT + case K_CM_HOLD_SWITCH: return "CM_HOLD_SWITCH"; + case K_CM_MPTY_CONF: return "CM_MPTY_CONF"; + case K_CM_MPTY_SPLIT: return "CM_MPTY_SPLIT"; +#endif + + case K_CM_ENABLE_DTMF_SUPPRESSION: return "CM_ENABLE_DTMF_SUPPRESSION"; + case K_CM_DISABLE_DTMF_SUPPRESSION: return "CM_DISABLE_DTMF_SUPPRESSION"; + case K_CM_ENABLE_AUDIO_EVENTS: return "CM_ENABLE_AUDIO_EVENTS"; + case K_CM_DISABLE_AUDIO_EVENTS: return "CM_DISABLE_AUDIO_EVENTS"; + case K_CM_ENABLE_CALL_PROGRESS: return "CM_ENABLE_CALL_PROGRESS"; + case K_CM_DISABLE_CALL_PROGRESS: return "CM_DISABLE_CALL_PROGRESS"; + case K_CM_FLASH: return "CM_FLASH"; + case K_CM_ENABLE_PULSE_DETECTION: return "CM_ENABLE_PULSE_DETECTION"; + case K_CM_DISABLE_PULSE_DETECTION: return "CM_DISABLE_PULSE_DETECTION"; + case K_CM_ENABLE_ECHO_CANCELLER: return "CM_ENABLE_ECHO_CANCELLER"; + case K_CM_DISABLE_ECHO_CANCELLER: return "CM_DISABLE_ECHO_CANCELLER"; + case K_CM_ENABLE_AGC: return "CM_ENABLE_AGC"; + case K_CM_DISABLE_AGC: return "CM_DISABLE_AGC"; + case K_CM_ENABLE_HIGH_IMP_EVENTS: return "CM_ENABLE_HIGH_IMP_EVENTS"; + case K_CM_DISABLE_HIGH_IMP_EVENTS: return "CM_DISABLE_HIGH_IMP_EVENTS"; + +#if K3L_AT_LEAST(1,6,0) + case K_CM_ENABLE_CALL_ANSWER_INFO: return "CM_ENABLE_CALL_ANSWER_INFO"; + case K_CM_DISABLE_CALL_ANSWER_INFO: return "CM_DISABLE_CALL_ANSWER_INFO"; +#endif + + case K_CM_RESET_LINK: return "CM_RESET_LINK"; + +#if K3L_AT_LEAST(1,6,0) + case K_CM_CLEAR_LINK_ERROR_COUNTER: return "CM_CLEAR_LINK_ERROR_COUNTER"; +#endif + + case K_CM_SEND_DTMF: return "CM_SEND_DTMF"; + case K_CM_STOP_AUDIO: return "CM_STOP_AUDIO"; + case K_CM_HARD_RESET: return "CM_HARD_RESET"; + + case K_CM_SEND_TO_CTBUS: return "CM_SEND_TO_CTBUS"; + case K_CM_RECV_FROM_CTBUS: return "CM_RECV_FROM_CTBUS"; + case K_CM_SETUP_H100: return "CM_SETUP_H100"; + + case K_CM_MIXER: return "CM_MIXER"; + case K_CM_CLEAR_MIXER: return "CM_CLEAR_MIXER"; + case K_CM_PLAY_FROM_FILE: return "CM_PLAY_FROM_FILE"; + case K_CM_RECORD_TO_FILE: return "CM_RECORD_TO_FILE"; + case K_CM_PLAY_FROM_STREAM: return "CM_PLAY_FROM_STREAM"; + case K_CM_STOP_PLAY: return "CM_STOP_PLAY"; + case K_CM_STOP_RECORD: return "CM_STOP_RECORD"; + case K_CM_PAUSE_PLAY: return "CM_PAUSE_PLAY"; + case K_CM_PAUSE_RECORD: return "CM_PAUSE_RECORD"; + case K_CM_INCREASE_VOLUME: return "CM_INCREASE_VOLUME"; + case K_CM_DECREASE_VOLUME: return "CM_DECREASE_VOLUME"; + case K_CM_LISTEN: return "CM_LISTEN"; + case K_CM_STOP_LISTEN: return "CM_STOP_LISTEN"; + case K_CM_PREPARE_FOR_LISTEN: return "CM_PREPARE_FOR_LISTEN"; + + case K_CM_PLAY_SOUND_CARD: return "CM_PLAY_SOUND_CARD"; + case K_CM_STOP_SOUND_CARD: return "CM_STOP_SOUND_CARD"; + + case K_CM_MIXER_CTBUS: return "CM_MIXER_CTBUS"; + case K_CM_PLAY_FROM_STREAM_EX: return "CM_PLAY_FROM_STREAM_EX"; + case K_CM_ENABLE_PLAYER_AGC: return "CM_ENABLE_PLAYER_AGC"; + case K_CM_DISABLE_PLAYER_AGC: return "CM_DISABLE_PLAYER_AGC"; + case K_CM_START_STREAM_BUFFER: return "CM_START_STREAM_BUFFER"; + case K_CM_ADD_STREAM_BUFFER: return "CM_ADD_STREAM_BUFFER"; + case K_CM_STOP_STREAM_BUFFER: return "CM_STOP_STREAM_BUFFER"; + case K_CM_SEND_BEEP: return "CM_SEND_BEEP"; + case K_CM_SEND_BEEP_CONF: return "CM_SEND_BEEP_CONF"; + case K_CM_ADD_TO_CONF: return "CM_ADD_TO_CONF"; + case K_CM_REMOVE_FROM_CONF: return "CM_REMOVE_FROM_CONF"; + case K_CM_RECORD_TO_FILE_EX: return "CM_RECORD_TO_FILE_EX"; + +#if K3L_AT_LEAST(1,5,4) + case K_CM_SET_VOLUME: return "CM_SET_VOLUME"; +#endif + case K_CM_SET_LINE_CONDITION: return "CM_SET_LINE_CONDITION"; + case K_CM_SEND_LINE_CONDITION: return "CM_SEND_LINE_CONDITION"; + case K_CM_SET_CALLER_CATEGORY: return "CM_SET_CALLER_CATEGORY"; + case K_CM_DIAL_MFC: return "CM_DIAL_MFC"; + + case K_CM_INTERNAL_PLAY: return "CM_INTERNAL_PLAY"; + case K_CM_RESUME_PLAY: return "CM_RESUME_PLAY"; + case K_CM_RESUME_RECORD: return "CM_RESUME_RECORD"; + case K_CM_INTERNAL_PLAY_EX: return "CM_INTERNAL_PLAY_EX"; +#if !K3L_AT_LEAST(2,0,0) + case K_CM_PING: return "CM_PING"; +#if K3L_AT_LEAST(1,6,0) + case K_CM_LOG_REQUEST: return "CM_LOG_REQUEST"; + case K_CM_LOG_CREATE_DISPATCHER: return "CM_LOG_CREATE_DISPATCHER"; + case K_CM_LOG_DESTROY_DISPATCHER: return "CM_LOG_DESTROY_DISPATCHER"; +#endif +#endif + +#if K3L_AT_LEAST(1,6,0) + case K_CM_START_CADENCE: return "CM_START_CADENCE"; + case K_CM_STOP_CADENCE: return "CM_STOP_CADENCE"; + case K_CM_CHECK_NEW_SMS: return "CM_CHECK_NEW_SMS"; + case K_CM_SEND_TO_MODEM: return "CM_SEND_TO_MODEM"; +#endif +#if K3L_AT_LEAST(2,1,0) + case K_CM_START_FAX_TX: return "CM_START_FAX_TX"; + case K_CM_STOP_FAX_TX: return "CM_STOP_FAX_TX"; + case K_CM_ADD_FAX_FILE: return "CM_ADD_FAX_FILE"; + case K_CM_ADD_FAX_PAGE_BREAK: return "CM_ADD_FAX_PAGE_BREAK"; + case K_CM_START_FAX_RX: return "CM_START_FAX_RX"; + case K_CM_STOP_FAX_RX: return "CM_STOP_FAX_RX"; + case K_CM_SIM_CARD_SELECT: return "CM_SIM_CARD_SELECT"; +#endif + +#if K3L_AT_LEAST(2,1,0) + case K_CM_NOTIFY_WATCHDOG: return "CM_NOTIFY_WATCHDOG"; + case K_CM_STOP_WATCHDOG: return "CM_STOP_WATCHDOG"; + case K_CM_WATCHDOG_COUNT: return "CM_WATCHDOG_COUNT"; + case K_CM_START_WATCHDOG: return "CM_START_WATCHDOG"; +#endif + + } + + return STG(FMT("[command='%d']") % code); +} + +std::string Verbose::eventName(int32 code) +{ + switch ((kevent)code) + { + case K_EV_CHANNEL_FREE: return "EV_CHANNEL_FREE"; + case K_EV_CONNECT: return "EV_CONNECT"; + case K_EV_DISCONNECT: return "EV_DISCONNECT"; + case K_EV_CALL_SUCCESS: return "EV_CALL_SUCCESS"; + case K_EV_CALL_FAIL: return "EV_CALL_FAIL"; + case K_EV_NO_ANSWER: return "EV_NO_ANSWER"; + case K_EV_BILLING_PULSE: return "EV_BILLING_PULSE"; + case K_EV_SEIZE_SUCCESS: return "EV_SEIZE_SUCCESS"; + case K_EV_SEIZE_FAIL: return "EV_SEIZE_FAIL"; + case K_EV_SEIZURE_START: return "EV_SEIZURE_START"; + case K_EV_CAS_LINE_STT_CHANGED: return "EV_CAS_LINE_STT_CHANGED"; + case K_EV_CAS_MFC_RECV: return "EV_CAS_MFC_RECV"; + +#if K3L_AT_LEAST(1,5,0) + case K_EV_NEW_CALL: return "EV_NEW_CALL"; +#endif + +#if K3L_AT_LEAST(1,5,1) + case K_EV_USER_INFORMATION: return "EV_USER_INFORMATION"; +#endif + +#if K3L_AT_LEAST(1,5,3) + case K_EV_DIALED_DIGIT: return "EV_DIALED_DIGIT"; +#endif + +#if K3L_AT_LEAST(1,6,0) + case K_EV_SIP_REGISTER_INFO: return "EV_SIP_REGISTER_INFO"; +#endif + +#if K3L_AT_LEAST(1,4,0) + case K_EV_CALL_HOLD_START: return "EV_CALL_HOLD_START"; + case K_EV_CALL_HOLD_STOP: return "EV_CALL_HOLD_STOP"; +#endif + +#if K3L_AT_LEAST(1,6,0) + case K_EV_SS_TRANSFER_FAIL: return "EV_SS_TRANSFER_FAIL"; + case K_EV_FLASH: return "EV_FLASH"; +#endif + + case K_EV_DTMF_DETECTED: return "EV_DTMF_DETECTED"; + case K_EV_DTMF_SEND_FINISH: return "EV_DTMF_SEND_FINISH"; + case K_EV_AUDIO_STATUS: return "EV_AUDIO_STATUS"; + case K_EV_CADENCE_RECOGNIZED: return "EV_CADENCE_RECOGNIZED"; + + case K_EV_END_OF_STREAM: return "EV_END_OF_STREAM"; + case K_EV_PULSE_DETECTED: return "EV_PULSE_DETECTED"; + +#if K3L_AT_LEAST(1,5,1) + case K_EV_POLARITY_REVERSAL: return "EV_POLARITY_REVERSAL"; +#endif + +#if K3L_AT_LEAST(1,6,0) + case K_EV_ISDN_PROGRESS_INDICATOR: return "EV_ISDN_PROGRESS_INDICATOR"; + case K_EV_CALL_ANSWER_INFO: return "EV_CALL_ANSWER_INFO"; + case K_EV_COLLECT_CALL: return "EV_COLLECT_CALL"; + case K_EV_SIP_DTMF_DETECTED: return "EV_SIP_DTMF_DETECTED"; + + case K_EV_RECV_FROM_MODEM: return "EV_RECV_FROM_MODEM"; + case K_EV_NEW_SMS: return "EV_NEW_SMS"; + case K_EV_SMS_INFO: return "EV_SMS_INFO"; + case K_EV_SMS_DATA: return "EV_SMS_DATA"; + case K_EV_SMS_SEND_RESULT: return "EV_SMS_SEND_RESULT"; + case K_EV_RING_DETECTED: return "EV_RING_DETECTED"; + case K_EV_PHYSICAL_LINK_DOWN: return "EV_PHYSICAL_LINK_DOWN"; + case K_EV_PHYSICAL_LINK_UP: return "EV_PHYSICAL_LINK_UP"; +#endif +#if K3L_HAS_MPTY_SUPPORT + case K_EV_CALL_MPTY_START: return "EV_CALL_MPTY_START"; + case K_EV_CALL_MPTY_STOP: return "EV_CALL_MPTY_STOP"; + case K_EV_GSM_COMMAND_STATUS: return "EV_GSM_COMMAND_STATUS"; +#endif +#if !K3L_AT_LEAST(2,0,0) + case K_EV_PONG: return "EV_PONG"; +#endif + case K_EV_CHANNEL_FAIL: return "EV_CHANNEL_FAIL"; + case K_EV_REFERENCE_FAIL: return "EV_REFERENCE_FAIL"; + case K_EV_INTERNAL_FAIL: return "EV_INTERNAL_FAIL"; + case K_EV_HARDWARE_FAIL: return "EV_HARDWARE_FAIL"; + case K_EV_LINK_STATUS: return "EV_LINK_STATUS"; + +#if K3L_AT_LEAST(1,4,0) + case K_EV_CLIENT_RECONNECT: return "EV_CLIENT_RECONNECT"; + case K_EV_VOIP_SEIZURE: return "EV_VOIP_SEIZURE"; +#endif + case K_EV_SEIZURE: return "EV_SEIZURE"; +#if K3L_AT_LEAST(2,1,0) + case K_EV_FAX_CHANNEL_FREE: return "EV_FAX_CHANNEL_FREE"; + case K_EV_FAX_FILE_SENT: return "EV_FAX_FILE_SENT"; + case K_EV_FAX_FILE_FAIL: return "EV_FAX_FILE_FAIL"; + /*case K_EV_FAX_MESSAGE_CONFIRMATION:return "EV_FAX_MESSAGE_CONFIRMATION";*/ + case K_EV_FAX_TX_TIMEOUT: return "EV_FAX_TX_TIMEOUT"; + case K_EV_FAX_PAGE_CONFIRMATION:return "EV_FAX_PAGE_CONFIRMATION"; + case K_EV_FAX_REMOTE_INFO: return "EV_FAX_REMOTE_INFO"; +#endif + +#if K3L_AT_LEAST(2,1,0) + case K_EV_WATCHDOG_COUNT: return "EV_WATCHDOG_COUNT"; +#endif + } + + return STG(FMT("[event='%d']") % code); +} + + +#if K3L_AT_LEAST(2,0,0) +std::string Verbose::command(int32 dev, K3L_COMMAND *k3lcmd, R2CountryType r2_country, Verbose::Presentation fmt) +#else +std::string Verbose::command(int32 dev, K3L_COMMAND *k3lcmd, Verbose::Presentation fmt) +#endif +{ +#if K3L_AT_LEAST(2,0,0) + return command(k3lcmd->Cmd, dev, k3lcmd->Object, (const char *) k3lcmd->Params, r2_country, fmt); +#else + return command(k3lcmd->Cmd, dev, k3lcmd->Object, (const char *) k3lcmd->Params, fmt); +#endif +} + +#if K3L_AT_LEAST(2,0,0) +std::string Verbose::command(int32 cmd_code, int32 dev_idx, int32 obj_idx, const char * params, R2CountryType r2_country, Verbose::Presentation fmt) +#else +std::string Verbose::command(int32 cmd_code, int32 dev_idx, int32 obj_idx, const char * params, Verbose::Presentation fmt) +#endif +{ + unsigned short int dev = (unsigned short int) dev_idx; + unsigned short int obj = (unsigned short int) obj_idx; + + kcommand code = (kcommand) cmd_code; + + std::string buf, extra; + + switch (code) + { + case K_CM_SEIZE: + case K_CM_SYNC_SEIZE: + //case K_CM_VOIP_SEIZE://deprecated + case K_CM_DIAL_MFC: + case K_CM_DIAL_DTMF: + + case K_CM_CONNECT: + case K_CM_PRE_CONNECT: + case K_CM_DISCONNECT: + case K_CM_DROP_COLLECT_CALL: + + case K_CM_START_SEND_FAIL: + case K_CM_STOP_SEND_FAIL: + + case K_CM_ENABLE_DTMF_SUPPRESSION: + case K_CM_DISABLE_DTMF_SUPPRESSION: + case K_CM_ENABLE_AUDIO_EVENTS: + case K_CM_DISABLE_AUDIO_EVENTS: + case K_CM_ENABLE_CALL_PROGRESS: + case K_CM_DISABLE_CALL_PROGRESS: + case K_CM_ENABLE_PULSE_DETECTION: + case K_CM_DISABLE_PULSE_DETECTION: + case K_CM_ENABLE_ECHO_CANCELLER: + case K_CM_DISABLE_ECHO_CANCELLER: + case K_CM_ENABLE_AGC: + case K_CM_DISABLE_AGC: + case K_CM_ENABLE_HIGH_IMP_EVENTS: + case K_CM_DISABLE_HIGH_IMP_EVENTS: + + case K_CM_FLASH: + case K_CM_RESET_LINK: + case K_CM_CLEAR_MIXER: + + case K_CM_LOCK_INCOMING: + case K_CM_UNLOCK_INCOMING: + case K_CM_LOCK_OUTGOING: + case K_CM_UNLOCK_OUTGOING: + + case K_CM_INCREASE_VOLUME: + case K_CM_DECREASE_VOLUME: + + case K_CM_STOP_RECORD: + case K_CM_PAUSE_RECORD: + case K_CM_RESUME_RECORD: + + case K_CM_STOP_LISTEN: + + case K_CM_PLAY_SOUND_CARD: + case K_CM_STOP_SOUND_CARD: + case K_CM_RINGBACK: +#if K3L_AT_LEAST(1,4,0) && !K3L_AT_LEAST(2,0,0) + case K_CM_VOIP_START_DEBUG: + case K_CM_VOIP_STOP_DEBUG: + case K_CM_VOIP_DUMP_STAT: +#endif + +#if K3L_AT_LEAST(1,5,3) + case K_CM_END_OF_NUMBER: +#endif + +#if K3L_AT_LEAST(1,5,4) + case K_CM_SET_VOLUME: +#endif + +#if K3L_AT_LEAST(1,6,0) + case K_CM_ENABLE_CALL_ANSWER_INFO: + case K_CM_DISABLE_CALL_ANSWER_INFO: + + case K_CM_SS_TRANSFER: + + case K_CM_CHECK_NEW_SMS: + case K_CM_GET_SMS: + case K_CM_PREPARE_SMS: + case K_CM_SEND_SMS: + + case K_CM_START_CADENCE: + case K_CM_STOP_CADENCE: + case K_CM_SEND_TO_MODEM: +#endif +#if K3L_HAS_MPTY_SUPPORT + case K_CM_HOLD_SWITCH: + case K_CM_MPTY_CONF: + case K_CM_MPTY_SPLIT: +#endif +#if K3L_AT_LEAST(2,1,0) + case K_CM_SIM_CARD_SELECT: +#endif + if (params != NULL) + { + extra += "param='"; + extra += (params ? params : "<empty>"); + extra += "'"; + + return show(buf, commandName(code), Target(CHANNEL, dev, obj), extra); + } + else + { + return show(buf, commandName(code), Target(CHANNEL, dev, obj)); + } + + case K_CM_SEND_DTMF: /* ?? */ + return show(buf, commandName(code), Target(CHANNEL, dev, obj)); + + /****/ + + case K_CM_STOP_AUDIO: + extra = "stop='"; + switch ((params ? (int)(*params) : -1)) + { + case 1: extra += "tx"; + case 2: extra += "rx"; + case 3: extra += "tx+rx"; + default: extra += "<unknown>"; + } + extra = "'"; + + return show(buf, commandName(code), Target(CHANNEL, dev, obj), extra); + + /****/ + +#if K3L_AT_LEAST(1,5,2) && !K3L_AT_LEAST(2,0,0) + case K_CM_ISDN_DEBUG: + extra = "flags='"; + extra += isdnDebug((unsigned long)params); + extra += "'"; + + return show(buf, commandName(code), Target(NONE), extra); +#endif + + /****/ + +#if K3L_AT_LEAST(1,5,1) + case K_CM_USER_INFORMATION: +#endif + if (params != NULL) + { + KUserInformation * userinfo = (KUserInformation *)params; + + std::string tmp((const char*) userinfo->UserInfo, userinfo->UserInfoLength); + + extra = STG(FMT("proto='%d',length='%d',data='%s'") + % userinfo->ProtocolDescriptor % userinfo->UserInfoLength % tmp); + + return show(buf, commandName(code), Target(CHANNEL, dev, obj), extra); + } + else + { + return show(buf, commandName(code), Target(CHANNEL, dev, obj)); + } + + /****/ + + + + case K_CM_CAS_CHANGE_LINE_STT: + { + const char status = (params ? *params : 0x00); + + extra += "status='"; + extra += (status & 0x01 ? "1" : "0"); + extra += (status & 0x02 ? "1" : "0"); + extra += (status & 0x04 ? "1" : "0"); + extra += (status & 0x08 ? "1" : "0"); + extra += "'"; + + return show(buf, commandName(code), Target(CHANNEL, dev, obj), extra); + } + + case K_CM_CAS_SEND_MFC: + { + char mfc = (params ? *params : 0xff); + + extra = STG(FMT("mfc='%d'") % (int) mfc); + + return show(buf, commandName(code), Target(CHANNEL, dev, obj), extra); + } + + case K_CM_CAS_SET_MFC_DETECT_MODE: + { + int mode = (params ? *((int *)params) : -1); + + extra = STG(FMT("mode='%d'") % mode); + + return show(buf, commandName(code), Target(CHANNEL, dev, obj), extra); + } + + case K_CM_SET_FORWARD_CHANNEL: + { + int channel = (params ? *((int*) params) : -1); + + extra = STG(FMT("forward='%03d'") % channel); + + return show(buf, commandName(code), Target(CHANNEL, dev, obj), extra); + } + +#if K3L_AT_LEAST(1,5,0) + case K_CM_MAKE_CALL: + extra = "options='"; + extra += (params ? params : "<empty>"); + extra += "'"; + + return show(buf, commandName(code), Target(CHANNEL, dev, obj), extra); +#endif + + case K_CM_MIXER: + case K_CM_MIXER_CTBUS: + { + if (params) + { + KMixerCommand *m = (KMixerCommand*)params; + + std::string src = mixerSource((KMixerSource)m->Source); + std::string idx("<unknown>"); + + switch (m->Source) + { + case kmsChannel: + case kmsPlay: + case kmsCTbus: +#if (K3L_AT_LEAST(1,4,0) && !K3L_AT_LEAST(1,6,0)) + case kmsVoIP: +#endif +#if K3L_AT_LEAST(1,6,0) + case kmsNoDelayChannel: +#endif + idx = STG(FMT("%02d") % (int)m->SourceIndex); + break; + + case kmsGenerator: + idx = mixerTone((KMixerTone)m->SourceIndex); + break; + }; + + extra = STG(FMT("track='%d',src='%s',index='%s'") % (int)m->Track % src % idx); + } + else + { + extra = "<unknown>"; + } + + return show(buf, commandName(code), Target(MIXER, dev, obj), extra); + }; + + case K_CM_PLAY_FROM_FILE: + extra = "file='"; + extra += (params ? params : "<empty>"); + extra += "'"; + + return show(buf, commandName(code), Target(PLAYER, dev, obj), extra); + + case K_CM_RECORD_TO_FILE: + extra = "file='"; + extra += (params ? params : "<empty>"); + extra += "'"; + + return show(buf, commandName(code), Target(PLAYER, dev, obj), extra); + + case K_CM_RECORD_TO_FILE_EX: + extra = "params='"; + extra += (params ? params : "<empty>"); + extra += "'"; + + return show(buf, commandName(code), Target(PLAYER, dev, obj), extra); + + case K_CM_PLAY_FROM_STREAM: + case K_CM_ADD_STREAM_BUFFER: + { + struct buffer_param + { + const void * ptr; + const int size; + } + *p = (buffer_param *) params; + + std::stringstream stream; + + extra = STG(FMT("buffer='%p',size='%d'") + % (const void *) p->ptr % (const int) p->size); + + return show(buf, commandName(code), Target(PLAYER, dev, obj), extra); + } + + case K_CM_PLAY_FROM_STREAM_EX: + { + struct buffer_param + { + const void * ptr; + const int size; + const char codec; + } + *p = (buffer_param *) params; + + std::string codec; + + switch (p->codec) + { + case 0: codec = "A-Law"; + case 1: codec = "PCM-08khz"; + case 2: codec = "PCM-11khz"; + default: codec = "<unknown>"; + } + + std::stringstream stream; + + extra = STG(FMT("buffer='%p',size='%d',codec='%s'") + % (const void *) p->ptr % (const int) p->size % codec); + + return show(buf, commandName(code), Target(PLAYER, dev, obj), extra); + } + + case K_CM_STOP_PLAY: + case K_CM_PAUSE_PLAY: + case K_CM_RESUME_PLAY: + + case K_CM_START_STREAM_BUFFER: + case K_CM_STOP_STREAM_BUFFER: + + case K_CM_ENABLE_PLAYER_AGC: + case K_CM_DISABLE_PLAYER_AGC: + + case K_CM_SEND_BEEP: + case K_CM_SEND_BEEP_CONF: + + case K_CM_INTERNAL_PLAY: + case K_CM_INTERNAL_PLAY_EX: + return show(buf, commandName(code), Target(PLAYER, dev, obj)); + + case K_CM_ADD_TO_CONF: + extra += "conference='"; + extra += (params ? (int) (*params) : -1); + extra += "'"; + + return show(buf, commandName(code), Target(MIXER, dev, obj), extra); + + case CM_REMOVE_FROM_CONF: + return show(buf, commandName(code), Target(MIXER, dev, obj)); + + case K_CM_LISTEN: + case K_CM_PREPARE_FOR_LISTEN: + { + int msecs = (params ? *((int*)params) : -1); + + extra = STG(FMT("msecs='%d'") % msecs); + + return show(buf, commandName(code), Target(PLAYER, dev, obj), extra); + } + + case K_CM_SEND_TO_CTBUS: + case K_CM_RECV_FROM_CTBUS: + { + KCtbusCommand *p = (KCtbusCommand*)(params); + + extra = STG(FMT("stream='%02d',timeslot='%02d',enable='%d'") + % (int)p->Stream % (int)p->TimeSlot % (int)p->Enable); + + return show(buf, commandName(code), Target(CHANNEL, dev, obj), extra); + } + + case K_CM_SET_LINE_CONDITION: + case K_CM_SEND_LINE_CONDITION: + extra = "condition='"; +#if K3L_AT_LEAST(2,0,0) + extra += signGroupB((KSignGroupB) *((int *) params), r2_country); +#else + extra += signGroupB((KSignGroupB) *((int *) params)); +#endif + extra += "'"; + + return show(buf, commandName(code), Target(CHANNEL, dev, obj), extra); + + case K_CM_SET_CALLER_CATEGORY: + extra = "category='"; +#if K3L_AT_LEAST(2,0,0) + extra += signGroupII((KSignGroupII) *((int *) params), r2_country); +#else + extra += signGroupII((KSignGroupII) *((int *) params)); +#endif + extra += "'"; + + return show(buf, commandName(code), Target(CHANNEL, dev, obj), extra); + +#if K3L_AT_LEAST(1,6,0) + case K_CM_CLEAR_LINK_ERROR_COUNTER: + return show(buf, commandName(code), Target(LINK, dev, obj)); + + case K_CM_SIP_REGISTER: + if (params != NULL) + { + extra += "param='"; + extra += (params ? params : "<empty>"); + extra += "'"; + + return show(buf, commandName(code), Target(DEVICE, dev), extra); + } + else + { + return show(buf, commandName(code), Target(DEVICE, dev)); + } +#endif + + case K_CM_SETUP_H100: + extra += "option='"; + extra += h100configIndex((KH100ConfigIndex)obj_idx); + extra += "'value='"; + extra += (params ? STG(FMT("%02d") % (int)(*params)) : "<empty>"); + extra += "'"; + + return show(buf, commandName(code), Target(DEVICE, dev), extra); + + case K_CM_HARD_RESET: + return show(buf, commandName(code), Target(LINK, dev, obj)); + +#if !K3L_AT_LEAST(2,0,0) + /* como funciona? */ + case K_CM_LOG_REQUEST: + case K_CM_LOG_CREATE_DISPATCHER: + case K_CM_LOG_DESTROY_DISPATCHER: + + case K_CM_PING: +#endif + return show(buf, commandName(code), Target(NONE)); +#if K3L_AT_LEAST(2,1,0) + case K_CM_START_FAX_TX: + case K_CM_START_FAX_RX: + case K_CM_ADD_FAX_FILE: + extra = "params='"; + extra += (params ? params : "<empty>"); + extra += "'"; + return show(buf, commandName(code), Target(CHANNEL, dev, obj), extra); + case K_CM_STOP_FAX_TX: + case K_CM_STOP_FAX_RX: + case K_CM_ADD_FAX_PAGE_BREAK: + return show(buf, commandName(code), Target(CHANNEL, dev, obj)); +#endif + +#if K3L_AT_LEAST(2,1,0) + case K_CM_NOTIFY_WATCHDOG: + case K_CM_STOP_WATCHDOG: + case K_CM_START_WATCHDOG: + return show(buf, commandName(code) , Target(DEVICE, obj)); + case K_CM_WATCHDOG_COUNT: + return show(buf, commandName(code) , Target(NONE)); +#endif + + } + + /* default command handler */ + return show(buf, commandName(code), Target(CHANNEL, dev, obj)); +} + +#if K3L_AT_LEAST(2,0,0) +std::string Verbose::event(KSignaling sig, int32 obj_idx, K3L_EVENT *ev, R2CountryType r2_country, Verbose::Presentation fmt) +#else +std::string Verbose::event(KSignaling sig, int32 obj_idx, K3L_EVENT *ev, Verbose::Presentation fmt) +#endif +{ + unsigned short int dev = (unsigned short int) ev->DeviceId; + unsigned short int obj = (unsigned short int) obj_idx; + + kevent code = (kevent) ev->Code; + + std::string buf, extra; + + switch (code) + { + case K_EV_CHANNEL_FREE: + case K_EV_SEIZE_SUCCESS: + case K_EV_CALL_SUCCESS: + case K_EV_NO_ANSWER: + case K_EV_CONNECT: + case K_EV_DTMF_SEND_FINISH: + case K_EV_SEIZURE_START: + case K_EV_BILLING_PULSE: + case K_EV_REFERENCE_FAIL: + +#if K3L_AT_LEAST(1,4,0) + case K_EV_CALL_HOLD_START: + case K_EV_CALL_HOLD_STOP: +#endif + +#if K3L_AT_LEAST(1,5,0) + case K_EV_NEW_CALL: +#endif + +#if K3L_AT_LEAST(1,6,0) + case K_EV_FLASH: + case K_EV_POLARITY_REVERSAL: + case K_EV_COLLECT_CALL: + case K_EV_SS_TRANSFER_FAIL: + case K_EV_RING_DETECTED: +#endif +#if K3L_HAS_MPTY_SUPPORT + case K_EV_CALL_MPTY_START: + case K_EV_CALL_MPTY_STOP: +#endif + break; + +#if K3L_AT_LEAST(1,6,0) + case K_EV_RECV_FROM_MODEM: + case K_EV_SMS_INFO: + case K_EV_SMS_DATA: + extra = "data='"; + extra += (ev->Params ? (const char *)(ev->Params) : "<empty>"); + extra += "'"; + + return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); +#endif + +#if K3L_AT_LEAST(1,6,0) + case K_EV_SMS_SEND_RESULT: + extra = "result='"; +#if K3L_AT_LEAST(2,0,0) + extra += gsmSmsCause((KGsmSmsCause)ev->AddInfo); +#else + extra += gsmCallCause((KGsmCallCause)ev->AddInfo); +#endif + extra += "'"; + return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); + +#if K3L_HAS_MPTY_SUPPORT + case K_EV_GSM_COMMAND_STATUS: + extra = "result='"; + extra += gsmMobileCause((KGsmMobileCause)ev->AddInfo); + extra += "'"; + return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); +#endif + + case K_EV_CALL_ANSWER_INFO: + extra = "info='"; + extra += callStartInfo((KCallStartInfo)ev->AddInfo); + extra += "'"; + return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); + + case K_EV_NEW_SMS: + if (ev->AddInfo != 0) + { + extra = "messages='"; + extra += STG(FMT("%d") % ev->AddInfo); + extra += "'"; + return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); + } + else + { + return show(buf, eventName(code), Target(CHANNEL, dev, obj)); + } + + case K_EV_ISDN_PROGRESS_INDICATOR: + if (ev->AddInfo != 0) + { + extra = "indication='"; + extra += q931ProgressIndication((KQ931ProgressIndication)ev->AddInfo); + extra += "'"; + return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); + } + else + { + return show(buf, eventName(code), Target(CHANNEL, dev, obj)); + } +#endif + + case K_EV_CAS_LINE_STT_CHANGED: + extra = STG(FMT("[a=%d,b=%d,c=%d,d=%d]") + % ((ev->AddInfo & 0x8) >> 3) % ((ev->AddInfo & 0x4) >> 2) + % ((ev->AddInfo & 0x2) >> 1) % (ev->AddInfo & 0x1)); + + return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); + + case K_EV_CAS_MFC_RECV: + extra = STG(FMT("digit='%d'") % ev->AddInfo); + + return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); + + case K_EV_CALL_FAIL: + extra = "cause='"; +#if K3L_AT_LEAST(2,0,0) + extra += callFail(sig, r2_country, ev->AddInfo); +#else + extra += callFail(sig, ev->AddInfo); +#endif + extra += "'"; + + if (ev->Params != NULL && ev->ParamSize != 0) + { + if (!extra.empty()) + extra += ","; + + extra += "params='"; + extra += (const char *) ev->Params; + extra += "'"; + } + + return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); + + case K_EV_DISCONNECT: + switch (sig) + { +#if K3L_AT_LEAST(1,5,1) + case ksigOpenCCS: + case ksigPRI_EndPoint: + case ksigPRI_Network: + case ksigPRI_Passive: + extra = "cause='"; + extra += isdnCause((KQ931Cause) ev->AddInfo); + extra += "'"; +#endif + default: + break; + } + + if (ev->Params != NULL && ev->ParamSize != 0) + { + if (!extra.empty()) + extra += ","; + + extra += "params='"; + extra += (const char *) ev->Params; + extra += "'"; + } + + if (!extra.empty()) + return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); + else + return show(buf, eventName(code), Target(CHANNEL, dev, obj)); + + break; + +#if K3L_AT_LEAST(1,6,0) + case K_EV_SIP_DTMF_DETECTED: +#endif + case K_EV_DTMF_DETECTED: + case K_EV_PULSE_DETECTED: + case K_EV_DIALED_DIGIT: + extra = STG(FMT("digit='%c'") % (char)ev->AddInfo); + + return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); + + case K_EV_SEIZURE: + { + KIncomingSeizeParams *n = (KIncomingSeizeParams *) + ( ((char*)ev) + sizeof(K3L_EVENT) ); + + extra += "orig_addr='"; + extra += n->NumberA; + extra += "',dest_addr='"; + extra += n->NumberB; + extra += "'"; + + return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); + } + +#if K3L_AT_LEAST(1,4,0) + case K_EV_VOIP_SEIZURE: + { + char *numB = ((char*)ev) + sizeof(K3L_EVENT); + char *numA = numB + 61; + + extra = "numberA='"; + extra += numA; + extra += "',numberB='"; + extra += numB; + extra += "'"; + + return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); + } +#endif + + + case K_EV_END_OF_STREAM: + return show(buf, eventName(code), Target(PLAYER, dev, obj)); + + case K_EV_AUDIO_STATUS: + extra = "tone='"; + extra += mixerTone((KMixerTone)ev->AddInfo); + extra += "'"; + + return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); + + case K_EV_CADENCE_RECOGNIZED: + extra = STG(FMT("cadence='%c'") % (char)(ev->AddInfo)); + + return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); + + case K_EV_CHANNEL_FAIL: + extra = "reason='"; + extra += channelFail(sig, ev->AddInfo); + extra += "'"; + + return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); + + case K_EV_SEIZE_FAIL: + extra = "reason='"; + extra += seizeFail((KSeizeFail) ev->AddInfo); + extra += "'"; + + return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); + + case K_EV_INTERNAL_FAIL: + extra = "reason='"; + extra += internalFail((KInternalFail) ev->AddInfo); + extra += "'"; + + return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); + + case K_EV_HARDWARE_FAIL: + extra = "component='"; + extra += systemObject((KSystemObject) ev->AddInfo); + extra += "'"; + + switch (ev->AddInfo) + { + case ksoChannel: + return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); + case ksoLink: + return show(buf, eventName(code), Target(LINK, dev, obj), extra); + case ksoLinkMon: + case ksoH100: + case ksoFirmware: + case ksoDevice: + return show(buf, eventName(code), Target(DEVICE, dev), extra); + case ksoAPI: + return show(buf, eventName(code), Target(NONE), extra); + } + + + case K_EV_LINK_STATUS: + // EV_LINK_STATUS has always zero in ObjectInfo (and AddInfo!) + /* fall throught... */ + +#if K3L_AT_LEAST(1,6,0) + case K_EV_PHYSICAL_LINK_UP: + case K_EV_PHYSICAL_LINK_DOWN: + return show(buf, eventName(code), Target(LINK, dev, obj)); +#endif + +#if K3L_AT_LEAST(1,5,1) + case K_EV_USER_INFORMATION: + { + KUserInformation *info = (KUserInformation *)(ev->Params); + + std::string data((const char *)info->UserInfo, + std::min<size_t>(info->UserInfoLength, KMAX_USER_USER_LEN)); + + extra = STG(FMT("proto='%d',length='%d',data='%s'") + % info->ProtocolDescriptor % info->UserInfoLength % data); + + return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); + } +#endif + +#if K3L_AT_LEAST(1,6,0) + case K_EV_SIP_REGISTER_INFO: + extra = "params='"; + extra += (ev->Params ? (const char *) (ev->Params) : "<unknown>"); + extra += "',status='"; + extra += sipFailures((KSIP_Failures)(ev->AddInfo)); + extra += "'"; + + return show(buf, eventName(code), Target(DEVICE, dev), extra); +#endif + +#if !K3L_AT_LEAST(2,0,0) + case K_EV_PONG: +#endif + +#if K3L_AT_LEAST(1,4,0) + case K_EV_CLIENT_RECONNECT: +#endif + return show(buf, eventName(code), Target(NONE)); + +#if K3L_AT_LEAST(2,1,0) + case K_EV_FAX_CHANNEL_FREE: + extra = "status='"; + extra += faxResult((KFaxResult)ev->AddInfo); + extra += "'"; + return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); + + case K_EV_FAX_FILE_SENT: + extra = "filename='"; + extra += (ev->Params ? (const char *) (ev->Params) : "<unknown>"); + extra += "'"; + return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); + + case K_EV_FAX_FILE_FAIL: + extra = "cause='"; + extra += faxFileErrorCause((KFaxFileErrorCause)ev->AddInfo); + extra += "',filename='"; + extra += (ev->Params ? (const char *) (ev->Params) : "<unknown>"); + extra += "'"; + return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); + + case K_EV_FAX_REMOTE_INFO: + extra = ((ev->Params && ev->ParamSize != 0) ? (const char *) ev->Params : ""); + return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); + + /*case K_EV_FAX_MESSAGE_CONFIRMATION:*/ + case K_EV_FAX_PAGE_CONFIRMATION: + case K_EV_FAX_TX_TIMEOUT: + return show(buf, eventName(code), Target(CHANNEL, dev, obj)); +#endif + +#if K3L_AT_LEAST(2,1,0) + case K_EV_WATCHDOG_COUNT: + extra = STG(FMT("count='%d'") % (char)ev->AddInfo); + return show(buf , eventName(code), Target(NONE), extra); +#endif + + } + + // default handler... + if (ev->Params != NULL && ev->ParamSize != 0) + { + extra += "params='"; + extra.append((const char *) ev->Params, (unsigned int) std::max<int>(ev->ParamSize - 1, 0)); + extra += "'"; + + return show(buf, eventName(code), Target(CHANNEL, dev, obj), extra); + } + else + return show(buf, eventName(code), Target(CHANNEL, dev, obj)); +} + +/********************************************/ + +std::string Verbose::show(std::string & buf, std::string name, Target tgt, std::string & extra) +{ + if (tgt.type == NONE) + { + generate(buf, name, tgt, extra); + } + else + { + std::string tmp(","); + tmp += extra; + + generate(buf, name, tgt, tmp); + } + + return buf; +} + +std::string Verbose::show(std::string & buf, std::string name, Target tgt) +{ + std::string tmp(""); + + generate(buf, name, tgt, tmp); + return buf; +} + +void Verbose::generate(std::string &buf, std::string &name, Target tgt, std::string &extra) +{ + switch (tgt.type) + { + case NONE: + if (extra.empty()) + buf += STG(FMT("<%s>") % name); + else + buf += STG(FMT("<%s> (%s)") % name % extra); + break; + + case DEVICE: + buf += STG(FMT("<%s> (d=%02d%s)") + % name % tgt.device % extra); + break; + + default: + { + const char *kind = "o"; + + switch (tgt.type) + { + case CHANNEL: + kind = "c"; + break; + case PLAYER: + kind = "p"; + break; + case MIXER: + kind = "m"; + break; + case LINK: + kind = "l"; + default: + break; + } + + buf += STG(FMT("<%s> (d=%02d,%s=%03d%s)") + % name % tgt.device % kind % tgt.object % extra); + break; + } + } +} + diff --git a/src/mod/endpoints/mod_khomp/commons/verbose.hpp b/src/mod/endpoints/mod_khomp/commons/verbose.hpp new file mode 100644 index 0000000..4668ea6 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/commons/verbose.hpp @@ -0,0 +1,505 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <string> +#include <sstream> +#include <map> + +#include <k3l.h> + +// k3lApiMajorVersion +#ifndef CM_PING +# include <k3lVersion.h> +# include <KTools.h> +#endif + +#include <types.hpp> +#include <k3lapi.hpp> +#include <format.hpp> + +#ifndef _VERBOSE_HPP_ +#define _VERBOSE_HPP_ + +struct Verbose +{ + typedef enum + { + K_CM_SEIZE = CM_SEIZE, + K_CM_SYNC_SEIZE = CM_SYNC_SEIZE, +#if K3L_AT_LEAST(1,6,0) + K_CM_SIP_REGISTER = CM_SIP_REGISTER, +#endif + K_CM_DIAL_DTMF = CM_DIAL_DTMF, + K_CM_DISCONNECT = CM_DISCONNECT, + K_CM_CONNECT = CM_CONNECT, + K_CM_PRE_CONNECT = CM_PRE_CONNECT, + K_CM_CAS_CHANGE_LINE_STT = CM_CAS_CHANGE_LINE_STT, + K_CM_CAS_SEND_MFC = CM_CAS_SEND_MFC, + K_CM_SET_FORWARD_CHANNEL = CM_SET_FORWARD_CHANNEL, + K_CM_CAS_SET_MFC_DETECT_MODE = CM_CAS_SET_MFC_DETECT_MODE, + K_CM_DROP_COLLECT_CALL = CM_DROP_COLLECT_CALL, + K_CM_MAKE_CALL = CM_MAKE_CALL, + K_CM_RINGBACK = CM_RINGBACK, + K_CM_USER_INFORMATION = CM_USER_INFORMATION, +#if !K3L_AT_LEAST(2,2,0) + K_CM_VOIP_SEIZE = CM_VOIP_SEIZE, //deprecated +#endif + K_CM_LOCK_INCOMING = CM_LOCK_INCOMING, + K_CM_UNLOCK_INCOMING = CM_UNLOCK_INCOMING, + K_CM_LOCK_OUTGOING = CM_LOCK_OUTGOING, + K_CM_UNLOCK_OUTGOING = CM_UNLOCK_OUTGOING, + K_CM_START_SEND_FAIL = CM_START_SEND_FAIL, + K_CM_STOP_SEND_FAIL = CM_STOP_SEND_FAIL, + K_CM_END_OF_NUMBER = CM_END_OF_NUMBER, +#if K3L_AT_LEAST(1,6,0) + K_CM_SS_TRANSFER = CM_SS_TRANSFER, + K_CM_GET_SMS = CM_GET_SMS, + K_CM_PREPARE_SMS = CM_PREPARE_SMS, + K_CM_SEND_SMS = CM_SEND_SMS, +#endif +#if K3L_HAS_MPTY_SUPPORT + K_CM_HOLD_SWITCH = CM_HOLD_SWITCH, + K_CM_MPTY_CONF = CM_MPTY_CONF, + K_CM_MPTY_SPLIT = CM_MPTY_SPLIT, +#endif + K_CM_ENABLE_DTMF_SUPPRESSION = CM_ENABLE_DTMF_SUPPRESSION, + K_CM_DISABLE_DTMF_SUPPRESSION = CM_DISABLE_DTMF_SUPPRESSION, + K_CM_ENABLE_AUDIO_EVENTS = CM_ENABLE_AUDIO_EVENTS, + K_CM_DISABLE_AUDIO_EVENTS = CM_DISABLE_AUDIO_EVENTS, + K_CM_ENABLE_CALL_PROGRESS = CM_ENABLE_CALL_PROGRESS, + K_CM_DISABLE_CALL_PROGRESS = CM_DISABLE_CALL_PROGRESS, + K_CM_FLASH = CM_FLASH, + K_CM_ENABLE_PULSE_DETECTION = CM_ENABLE_PULSE_DETECTION, + K_CM_DISABLE_PULSE_DETECTION = CM_DISABLE_PULSE_DETECTION, + K_CM_ENABLE_ECHO_CANCELLER = CM_ENABLE_ECHO_CANCELLER, + K_CM_DISABLE_ECHO_CANCELLER = CM_DISABLE_ECHO_CANCELLER, + K_CM_ENABLE_AGC = CM_ENABLE_AGC, + K_CM_DISABLE_AGC = CM_DISABLE_AGC, + K_CM_ENABLE_HIGH_IMP_EVENTS = CM_ENABLE_HIGH_IMP_EVENTS, + K_CM_DISABLE_HIGH_IMP_EVENTS = CM_DISABLE_HIGH_IMP_EVENTS, +#if K3L_AT_LEAST(1,6,0) + K_CM_ENABLE_CALL_ANSWER_INFO = CM_ENABLE_CALL_ANSWER_INFO, + K_CM_DISABLE_CALL_ANSWER_INFO = CM_DISABLE_CALL_ANSWER_INFO, +#endif + K_CM_RESET_LINK = CM_RESET_LINK, +#if K3L_AT_LEAST(1,6,0) + K_CM_CLEAR_LINK_ERROR_COUNTER = CM_CLEAR_LINK_ERROR_COUNTER, +#endif + K_CM_SEND_DTMF = CM_SEND_DTMF, + K_CM_STOP_AUDIO = CM_STOP_AUDIO, + K_CM_HARD_RESET = CM_HARD_RESET, + K_CM_SEND_TO_CTBUS = CM_SEND_TO_CTBUS, + K_CM_RECV_FROM_CTBUS = CM_RECV_FROM_CTBUS, + K_CM_SETUP_H100 = CM_SETUP_H100, + K_CM_MIXER = CM_MIXER, + K_CM_CLEAR_MIXER = CM_CLEAR_MIXER, + K_CM_PLAY_FROM_FILE = CM_PLAY_FROM_FILE, + K_CM_RECORD_TO_FILE = CM_RECORD_TO_FILE, + K_CM_PLAY_FROM_STREAM = CM_PLAY_FROM_STREAM, + K_CM_INTERNAL_PLAY = CM_INTERNAL_PLAY, + K_CM_STOP_PLAY = CM_STOP_PLAY, + K_CM_STOP_RECORD = CM_STOP_RECORD, + K_CM_PAUSE_PLAY = CM_PAUSE_PLAY, + K_CM_PAUSE_RECORD = CM_PAUSE_RECORD, + K_CM_RESUME_PLAY = CM_RESUME_PLAY, + K_CM_RESUME_RECORD = CM_RESUME_RECORD, + K_CM_INCREASE_VOLUME = CM_INCREASE_VOLUME, + K_CM_DECREASE_VOLUME = CM_DECREASE_VOLUME, + K_CM_LISTEN = CM_LISTEN, + K_CM_STOP_LISTEN = CM_STOP_LISTEN, + K_CM_PREPARE_FOR_LISTEN = CM_PREPARE_FOR_LISTEN, + K_CM_PLAY_SOUND_CARD = CM_PLAY_SOUND_CARD, + K_CM_STOP_SOUND_CARD = CM_STOP_SOUND_CARD, + K_CM_MIXER_CTBUS = CM_MIXER_CTBUS, + K_CM_PLAY_FROM_STREAM_EX = CM_PLAY_FROM_STREAM_EX, + K_CM_INTERNAL_PLAY_EX = CM_INTERNAL_PLAY_EX, + K_CM_ENABLE_PLAYER_AGC = CM_ENABLE_PLAYER_AGC, + K_CM_DISABLE_PLAYER_AGC = CM_DISABLE_PLAYER_AGC, + K_CM_START_STREAM_BUFFER = CM_START_STREAM_BUFFER, + K_CM_ADD_STREAM_BUFFER = CM_ADD_STREAM_BUFFER, + K_CM_STOP_STREAM_BUFFER = CM_STOP_STREAM_BUFFER, + K_CM_SEND_BEEP = CM_SEND_BEEP, + K_CM_SEND_BEEP_CONF = CM_SEND_BEEP_CONF, + K_CM_ADD_TO_CONF = CM_ADD_TO_CONF, + K_CM_REMOVE_FROM_CONF = CM_REMOVE_FROM_CONF, + K_CM_RECORD_TO_FILE_EX = CM_RECORD_TO_FILE_EX, + K_CM_SET_VOLUME = CM_SET_VOLUME, + K_CM_SET_LINE_CONDITION = CM_SET_LINE_CONDITION, + K_CM_SEND_LINE_CONDITION = CM_SEND_LINE_CONDITION, + K_CM_SET_CALLER_CATEGORY = CM_SET_CALLER_CATEGORY, + K_CM_DIAL_MFC = CM_DIAL_MFC, +#if !K3L_AT_LEAST(2,0,0) + K_CM_VOIP_START_DEBUG = CM_VOIP_START_DEBUG, + K_CM_VOIP_STOP_DEBUG = CM_VOIP_STOP_DEBUG, + K_CM_VOIP_DUMP_STAT = CM_VOIP_DUMP_STAT, + K_CM_ISDN_DEBUG = CM_ISDN_DEBUG, + K_CM_PING = CM_PING, + K_CM_LOG_REQUEST = CM_LOG_REQUEST, + K_CM_LOG_CREATE_DISPATCHER = CM_LOG_CREATE_DISPATCHER, + K_CM_LOG_DESTROY_DISPATCHER = CM_LOG_DESTROY_DISPATCHER, +#endif +#if K3L_AT_LEAST(1,6,0) + K_CM_START_CADENCE = CM_START_CADENCE, + K_CM_STOP_CADENCE = CM_STOP_CADENCE, + K_CM_CHECK_NEW_SMS = CM_CHECK_NEW_SMS, + K_CM_SEND_TO_MODEM = CM_SEND_TO_MODEM, +#endif +#if K3L_AT_LEAST(2,1,0) + K_CM_START_FAX_TX = CM_START_FAX_TX, + K_CM_STOP_FAX_TX = CM_STOP_FAX_TX, + K_CM_ADD_FAX_FILE = CM_ADD_FAX_FILE, + K_CM_ADD_FAX_PAGE_BREAK = CM_ADD_FAX_PAGE_BREAK, + K_CM_START_FAX_RX = CM_START_FAX_RX, + K_CM_STOP_FAX_RX = CM_STOP_FAX_RX, + K_CM_SIM_CARD_SELECT = CM_SIM_CARD_SELECT, +#endif + +#if K3L_AT_LEAST(2,1,0) + K_CM_NOTIFY_WATCHDOG = CM_NOTIFY_WATCHDOG, + K_CM_STOP_WATCHDOG = CM_STOP_WATCHDOG, + K_CM_WATCHDOG_COUNT = CM_WATCHDOG_COUNT, + K_CM_START_WATCHDOG = CM_START_WATCHDOG, +#endif + + } + kcommand; + + typedef enum + { + K_EV_CHANNEL_FREE = EV_CHANNEL_FREE, + K_EV_CONNECT = EV_CONNECT, + K_EV_DISCONNECT = EV_DISCONNECT, + K_EV_CALL_SUCCESS = EV_CALL_SUCCESS, + K_EV_CALL_FAIL = EV_CALL_FAIL, + K_EV_NO_ANSWER = EV_NO_ANSWER, + K_EV_BILLING_PULSE = EV_BILLING_PULSE, + K_EV_SEIZE_SUCCESS = EV_SEIZE_SUCCESS, + K_EV_SEIZE_FAIL = EV_SEIZE_FAIL, + K_EV_SEIZURE_START = EV_SEIZURE_START, + K_EV_CAS_LINE_STT_CHANGED = EV_CAS_LINE_STT_CHANGED, + K_EV_CAS_MFC_RECV = EV_CAS_MFC_RECV, + K_EV_NEW_CALL = EV_NEW_CALL, + K_EV_USER_INFORMATION = EV_USER_INFORMATION, + K_EV_DIALED_DIGIT = EV_DIALED_DIGIT, +#if K3L_AT_LEAST(1,6,0) + K_EV_SIP_REGISTER_INFO = EV_SIP_REGISTER_INFO, + K_EV_RING_DETECTED = EV_RING_DETECTED, +#endif + K_EV_CALL_HOLD_START = EV_CALL_HOLD_START, + K_EV_CALL_HOLD_STOP = EV_CALL_HOLD_STOP, +#if K3L_AT_LEAST(1,6,0) + K_EV_SS_TRANSFER_FAIL = EV_SS_TRANSFER_FAIL, + K_EV_FLASH = EV_FLASH, +#endif + K_EV_DTMF_DETECTED = EV_DTMF_DETECTED, + K_EV_DTMF_SEND_FINISH = EV_DTMF_SEND_FINISH, + K_EV_AUDIO_STATUS = EV_AUDIO_STATUS, + K_EV_CADENCE_RECOGNIZED = EV_CADENCE_RECOGNIZED, + K_EV_END_OF_STREAM = EV_END_OF_STREAM, + K_EV_PULSE_DETECTED = EV_PULSE_DETECTED, + K_EV_POLARITY_REVERSAL = EV_POLARITY_REVERSAL, +#if K3L_AT_LEAST(1,6,0) + K_EV_ISDN_PROGRESS_INDICATOR = EV_ISDN_PROGRESS_INDICATOR, + K_EV_CALL_ANSWER_INFO = EV_CALL_ANSWER_INFO, + K_EV_COLLECT_CALL = EV_COLLECT_CALL, + K_EV_SIP_DTMF_DETECTED = EV_SIP_DTMF_DETECTED, + K_EV_RECV_FROM_MODEM = EV_RECV_FROM_MODEM, + K_EV_NEW_SMS = EV_NEW_SMS, + K_EV_SMS_INFO = EV_SMS_INFO, + K_EV_SMS_DATA = EV_SMS_DATA, + K_EV_SMS_SEND_RESULT = EV_SMS_SEND_RESULT, +#endif +#if K3L_HAS_MPTY_SUPPORT + K_EV_CALL_MPTY_START = EV_CALL_MPTY_START, + K_EV_CALL_MPTY_STOP = EV_CALL_MPTY_STOP, + K_EV_GSM_COMMAND_STATUS = EV_GSM_COMMAND_STATUS, +#endif + K_EV_CHANNEL_FAIL = EV_CHANNEL_FAIL, + K_EV_REFERENCE_FAIL = EV_REFERENCE_FAIL, + K_EV_INTERNAL_FAIL = EV_INTERNAL_FAIL, + K_EV_HARDWARE_FAIL = EV_HARDWARE_FAIL, + K_EV_LINK_STATUS = EV_LINK_STATUS, +#if K3L_AT_LEAST(1,6,0) + K_EV_PHYSICAL_LINK_UP = EV_PHYSICAL_LINK_UP, + K_EV_PHYSICAL_LINK_DOWN = EV_PHYSICAL_LINK_DOWN, +#endif + K_EV_CLIENT_RECONNECT = EV_CLIENT_RECONNECT, + K_EV_VOIP_SEIZURE = EV_VOIP_SEIZURE, + K_EV_SEIZURE = EV_SEIZURE, + +#if K3L_AT_LEAST(2,1,0) + K_EV_FAX_CHANNEL_FREE = EV_FAX_CHANNEL_FREE, + K_EV_FAX_FILE_SENT = EV_FAX_FILE_SENT, + K_EV_FAX_FILE_FAIL = EV_FAX_FILE_FAIL, + K_EV_FAX_MESSAGE_CONFIRMATION = EV_FAX_MESSAGE_CONFIRMATION, + K_EV_FAX_TX_TIMEOUT = EV_FAX_TX_TIMEOUT, + K_EV_FAX_PAGE_CONFIRMATION = EV_FAX_PAGE_CONFIRMATION, + K_EV_FAX_REMOTE_INFO = EV_FAX_REMOTE_INFO, +#endif + +#if K3L_AT_LEAST(2,1,0) + K_EV_WATCHDOG_COUNT = EV_WATCHDOG_COUNT, +#endif + +#if !K3L_AT_LEAST(2,0,0) + K_EV_PONG = EV_PONG, +#endif + } + kevent; + + typedef enum + { + R2_COUNTRY_ARG = 1, + R2_COUNTRY_BRA = 2, + R2_COUNTRY_CHI = 3, + R2_COUNTRY_MEX = 4, + R2_COUNTRY_URY = 5, + R2_COUNTRY_VEN = 6 + } + R2CountryType; + + typedef enum + { + HUMAN, + EXACT + } + Presentation; + + /* dynamic (object) stuff */ + + Verbose(K3LAPI & api): _api(api) {}; + +#if K3L_AT_LEAST(2,0,0) + std::string event(int32, K3L_EVENT*, R2CountryType r2_country = R2_COUNTRY_BRA, + Presentation fmt = HUMAN); +#else + std::string event(int32, K3L_EVENT*, Presentation fmt = HUMAN); +#endif + + std::string channelStatus(int32, int32, int32, Presentation fmt = HUMAN); + + /* end of dynamic (object) stuff */ + + protected: + K3LAPI & _api; + + /* used internally */ + struct internal_not_found {}; + + public: + + /* static (class) stuff */ + + static std::string echoLocation(KEchoLocation, Presentation fmt = HUMAN); + static std::string echoCancellerConfig(KEchoCancellerConfig, Presentation fmt = HUMAN); + +#if K3L_AT_LEAST(2,0,0) + static std::string event(KSignaling, int32, K3L_EVENT*, R2CountryType = R2_COUNTRY_BRA, + Presentation fmt = HUMAN); +#else + static std::string event(KSignaling, int32, K3L_EVENT*, Presentation fmt = HUMAN); +#endif + +#if K3L_AT_LEAST(2,0,0) + static std::string command(int32, K3L_COMMAND*, R2CountryType = R2_COUNTRY_BRA, + Presentation fmt = HUMAN); + static std::string command(int32, int32, int32, const char *, R2CountryType = R2_COUNTRY_BRA, + Presentation fmt = HUMAN); +#else + static std::string command(int32, K3L_COMMAND*, Presentation fmt = HUMAN); + static std::string command(int32, int32, int32, const char *, Presentation fmt = HUMAN); +#endif + + + static std::string deviceName(KDeviceType, int32, Presentation fmt = HUMAN); + + static std::string deviceType(KDeviceType, Presentation fmt = HUMAN); + static std::string deviceModel(KDeviceType, int32, Presentation fmt = HUMAN); + + static std::string channelFeatures(int32, Presentation fmt = HUMAN); + static std::string signaling(KSignaling, Presentation fmt = HUMAN); + static std::string systemObject(KSystemObject, Presentation fmt = HUMAN); + static std::string mixerTone(KMixerTone, Presentation fmt = HUMAN); + static std::string mixerSource(KMixerSource, Presentation fmt = HUMAN); + + static std::string seizeFail(KSeizeFail, Presentation fmt = HUMAN); + +#if K3L_AT_LEAST(2,0,0) + static std::string callFail(KSignaling, R2CountryType, int32, Presentation fmt = HUMAN); +#else + static std::string callFail(KSignaling, int32, Presentation fmt = HUMAN); +#endif + + static std::string channelFail(KSignaling, int32, Presentation fmt = HUMAN); + static std::string internalFail(KInternalFail, Presentation fmt = HUMAN); + + static std::string linkErrorCounter(KLinkErrorCounter, Presentation fmt = HUMAN); + + static std::string linkStatus(KSignaling, int32, Presentation fmt = HUMAN); + static std::string channelStatus(KSignaling, int32, Presentation fmt = HUMAN); + static std::string callStatus(KCallStatus, Presentation fmt = HUMAN); + static std::string status(KLibraryStatus, Presentation fmt = HUMAN); + +#if K3L_AT_LEAST(2,0,0) + static std::string signGroupB(KSignGroupB, R2CountryType contry = R2_COUNTRY_BRA, + Presentation fmt = HUMAN); +#else + static std::string signGroupB(KSignGroupB, Presentation fmt = HUMAN); +#endif + +#if K3L_AT_LEAST(2,0,0) + static std::string signGroupII(KSignGroupII, R2CountryType contry = R2_COUNTRY_BRA, + Presentation fmt = HUMAN); +#else + static std::string signGroupII(KSignGroupII, Presentation fmt = HUMAN); +#endif + + static std::string h100configIndex(KH100ConfigIndex, Presentation fmt = HUMAN); + + static std::string eventName(int32); + static std::string commandName(int32); + +#if K3L_AT_LEAST(1,5,0) + static std::string sipFailures(KSIP_Failures, Presentation fmt = HUMAN); +#endif + +#if K3L_AT_LEAST(1,5,1) + static std::string isdnCause(KQ931Cause, Presentation fmt = HUMAN); +#endif + +#if K3L_AT_LEAST(1,5,2) + static std::string isdnDebug(int32, Presentation fmt = HUMAN); +#endif + +#if K3L_AT_LEAST(1,6,0) + static std::string callStartInfo(KCallStartInfo, Presentation fmt = HUMAN); + + static std::string gsmCallCause(KGsmCallCause, Presentation fmt = HUMAN); + static std::string gsmMobileCause(KGsmMobileCause, Presentation fmt = HUMAN); + static std::string gsmSmsCause(KGsmSmsCause, Presentation fmt = HUMAN); + + static std::string q931ProgressIndication(KQ931ProgressIndication, + Presentation fmt = HUMAN); +#endif + +#if K3L_AT_LEAST(2,1,0) + static std::string faxResult(KFaxResult code, Presentation fmt = HUMAN); + static std::string faxFileErrorCause(KFaxFileErrorCause code, Presentation fmt = HUMAN); +#endif + + /* end of static (class) stuff */ + + private: + static std::string internal_deviceType(KDeviceType); + static std::string internal_deviceModel(KDeviceType, int32); + +#if K3L_AT_LEAST(1,5,0) + static std::string internal_sipFailures(KSIP_Failures, Presentation fmt = HUMAN); +#endif +#if K3L_AT_LEAST(1,5,1) + static std::string internal_isdnCause(KQ931Cause, Presentation fmt = HUMAN); +#endif + +#if K3L_AT_LEAST(2,0,0) + static std::string internal_signGroupB(KSignGroupB, R2CountryType contry, Presentation fmt = HUMAN); + static std::string internal_signGroupII(KSignGroupII, R2CountryType contry, Presentation fmt = HUMAN); +#else + static std::string internal_signGroupB(KSignGroupB, Presentation fmt = HUMAN); + static std::string internal_signGroupII(KSignGroupII, Presentation fmt = HUMAN); +#endif + +#if K3L_AT_LEAST(1,6,0) + static std::string internal_gsmCallCause(KGsmCallCause, Presentation fmt = HUMAN); + static std::string internal_gsmMobileCause(KGsmMobileCause, Presentation fmt = HUMAN); + static std::string internal_gsmSmsCause(KGsmSmsCause, Presentation fmt = HUMAN); + + static std::string internal_q931ProgressIndication(KQ931ProgressIndication, Presentation fmt = HUMAN); +#endif + + private: + enum Type + { + DEVICE, + CHANNEL, + PLAYER, + MIXER, + LINK, + NONE + }; + + struct Target + { + Target(Type _type) + : type(_type), device(-1), object(-1) + {}; + + Target(Type _type, int32 _device) + : type(_type), device(_device), object(-1) + {}; + + Target(Type _type, int32 _device, int32 _object) + : type(_type), device(_device), object(_object) + {}; + + Type type; + int32 device; + int32 object; + }; + + static void generate(std::string &, std::string &, Target, std::string &); + + static std::string show(std::string &, std::string, Target, std::string &); + static std::string show(std::string &, std::string, Target); + + template < typename ReturnType > + static ReturnType presentation(Presentation fmt, ReturnType str_exact, ReturnType str_human) + { + switch (fmt) + { + case HUMAN: return str_human; + case EXACT: return str_exact; + }; + + return str_exact; + } +}; + +#endif /* _VERBOSE_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/docs/Manual.html b/src/mod/endpoints/mod_khomp/docs/Manual.html new file mode 100644 index 0000000..fc63f0d --- /dev/null +++ b/src/mod/endpoints/mod_khomp/docs/Manual.html @@ -0,0 +1,1093 @@ +<html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Mod Khomp: Manual</title></head><body> +<a name="Considera.C3.A7.C3.B5es_iniciais" id="Considera.C3.A7.C3.B5es_iniciais"></a><h1> <span class="mw-headline"> Considerações iniciais </span></h1> +<p>Este documento aborda informações sobre o <i>Endpoint</i> da Khomp como um todo, desde opções disponíveis de configuração, os <i>applications</i> disponibilizados, os possíveis comandos de <b>CLI</b>, entre outros. +</p><p>Para procedimentos sobre a instalação, favor consultar o <a href=".htmlMod_Khomp/README" title="Mod Khomp/README">README do Endpoint</a>. +<br /> +</p> +<a name="Configura.C3.A7.C3.A3o" id="Configura.C3.A7.C3.A3o"></a><h1> <span class="mw-headline"> Configuração </span></h1> +<p>Configurar o Endpoint da Khomp é uma tarefa que consiste de três etapas: +</p> +<ul><li> Configuração das placas, através da K3L; +</li><li> Configuração do Endpoint; +</li><li> Configuração do FreeSWITCH. +</li></ul> +<p>Estas etapas são descritas mais detalhadamente abaixo. +<br /> +</p> +<a name="Configura.C3.A7.C3.A3o_da_API_K3L" id="Configura.C3.A7.C3.A3o_da_API_K3L"></a><h2> <span class="mw-headline"> Configuração da API K3L </span></h2> +<p>Esta etapa é realizada de maneira semi-automatizada através do programa <b>khompwizard</b>, um assistente que configura os parâmetros básicos das placas do sistema. Esse assistente inicializa os arquivos de configuração através de informações obtidas do usuário, quando estas forem necessárias, inicializando as configurações menos utilizadas com os valores padrões. +</p><p>Normalmente, este programa é executado automaticamente após a instalação do sistema. Entretanto, pode ser necessário executá-lo manualmente caso uma atualização esteja sendo realizada, ou se novas placas foram adicionadas no sistema após a instalação dos <i>drivers</i> da placa. +</p><p>Caso seja necessária a configuração de parâmetros avançados da placa e/ou da sinalização, o programa <b>k3lconfig</b> permite acessar todas as configurações disponíveis de cada placa instalada. Para maiores informações sobre este programa, consulte a documentação do mesmo. Para soluções de problemas de sincronismo, consulte a seção <a href="#Solu.C3.A7.C3.A3o_de_problemas" title="">Solução de problemas</a> sobre o procedimento de configuração manual das placas. +<br /> +</p> +<a name="Configura.C3.A7.C3.A3o_do_Endpoint" id="Configura.C3.A7.C3.A3o_do_Endpoint"></a><h2> <span class="mw-headline"> Configuração do Endpoint </span></h2> +<p>A configuração padrão do sistema costuma atender à maior parte das necessidades. Entretanto, as configurações do Endpoint da Khomp podem ser modificadas através do arquivo de configuração '<b>/usr/local/freeswitch/conf/autoload_configs/khomp.conf.xml'</b>. +</p><p>A lista de opções é a seguinte: +</p> +<a name=".3Cchannels.3E" id=".3Cchannels.3E"></a><h4> <span class="mw-headline"> <channels> </span></h4> +<p>Define as configurações gerais de todos os canais da Khomp. +</p> +<pre><b>Sintaxe:</b> <param name="..." value="..."/> +</pre> +<ul><li><b>auto-fax-adjustment</b>: Ativa ("yes") ou desativa ("no") o ajuste automático do canal (desabilitar o cancelador de eco e a supressão DTMF) ao detectar tom de FAX; +</li><li><b>auto-gain-control</b>: Ativa ("yes") ou desativa ("no") a ativação do controle automático de ganho (AGC) pelo Endpoint; +</li><li><b>context-digital</b>: Contexto de entrada para ligações em placas digitais (o padrão é "khomp-DD-LL", onde "DD" será substituído, no momento da ligação, pelo número do dispositivo, "LL" pelo número do link, "CCC" pelo número do canal e "SSSS" pelo número serial do dispositivo); +</li><li><b>context-fxo</b>: Contexto de entrada para placas FXO (o padrão é "khomp-DD-CC", onde "DD" será substituído, no momento da ligação, pelo número do dispositivo, "CC" pelo número do canal, e "SSSS" pelo número serial do dispositivo); +</li><li><b>context-fxo-alt</b>: Contexto de entrada alternativo para placas FXO (o padrão é vazio, no entanto quando definido, segue a mesma regra de substituição da opção <b>context-fxo</b>); +</li><li><b>context-fxs</b>: Contexto de entrada para placas FXS (o padrão é "khomp-DD-CC", onde "DD" será substituído, no momento da ligação, pelo número do dispositivo, "CC" pelo número do canal, e "SSSS" pelo número serial do dispositivo); +</li><li><b>context-fxs-alt</b>: Contexto de entrada alternativo para placas FXS (o padrão é vazio, no entanto quando definido, segue a mesma regra de substituição da opção <b>context-fxs</b>); +</li><li><b>context-gsm-call</b> (ou "context-gsm"): Contexto de entrada para ligações GSM (o padrão é "khomp-DD-CC", onde "DD" será substituído no momento da ligação pelo número do dispositivo, "CC" pelo número do canal, e "SSSS" pelo número serial do dispositivo); +</li><li><b>context-gsm-call-alt</b> (ou "context-gsm-alt"): Contexto de entrada alternativo para ligações GSM (o padrão é vazio, no entanto quando definido, segue a mesma regra de substituição da opção <b>context-gsm-call</b>); +</li><li><b>context-gsm-sms</b>: Contexto de entrada para SMSs (o padrão é "khomp-sms-DD-CC", onde "DD" será substituído pelo número de dispositivo, "CC" pelo número do canal, e "SSSS" pelo número serial do dispositivo); +</li><li><b>context-pr</b>: Contexto de entrada para ligações em placas KPR (o padrão é "khomp-DD-CC", onde "DD" será substituído, no momento da ligação, pelo número do dispositivo, "CC" pelo número do canal); +</li><li><b>disconnect-delay</b>: Define o tempo em milissegundos para realizar o processamento de um evento de desconexão, para ignorar situações onde outros equipamentos realizam o duplo atendimento para derrubar chamadas a cobrar; +</li><li><b>echo-canceller</b>: Ativa ("yes") ou desativa ("no") o cancelamento de eco automático pelo Endpoint; +</li><li><b>fxo-send-pre-audio</b>: Quando ativada ("yes") libera canal de áudio sainte antes da conexão da chamada em placas KFXO (o valor padrão é "yes"); +</li><li><b>fxs-global-orig</b>: Número inicial para numeração seqüencial de ramais das placas <b>KFXS</b> que não estiverem listadas na seção <b><fxs-branches></b> (a numeração segue ordem crescente por número da placa e número do canal físico) (o padrão é "0"); +</li><li><b>fxs-co-dialtone</b>: Seqüências de números, separados por vírgula, que disparam um tom contínuo (de central pública) em ramais FXS (ex: "0,99" faz com que, ao discar "0" ou "99", o usuário receba o tom de linha contínuo) (o padrão é vazio); +</li><li><b>fxs-bina</b>: Quando ativada ("yes"), ligações para ramais FXS enviarão os dígitos correspondentes ao telefone de origem em sinalização BINA DTMF (o valor padrão é "no"); +</li><li><b>input-volume</b>: Define o volume de entrada das ligações, varia de -10 a +10 ; +</li><li><b>kommuter-activation</b>: Define se a ativação de dispositivos kommuter encontrados no sistema será feita de forma automática ("auto"), ou de forma manual ("manual") pelo usuário, através do comando "khomp kommuter on/off"; +</li><li><b>kommuter-timeout</b>: Define o <i>timeout</i> (em segundos) com que os kommuters serão inicializados. Se chegarem a este <i>timeout</i> sem receberem notificação do channel, os dispositivos irão comutar para o estado "desligado". O valor mínimo é "0" , onde os links permanecerão sempre comutados no estado "ligado", e o valor máximo é "255"; +</li><li><b>language</b>: Define idioma para ligações nas placas Khomp; +</li><li><b>log-to-console</b>: Define mensagens de log que devem ser impressas na console; +</li><li><b>log-to-disk</b>: Define mensagens de log que devem ser salvar em disco; +</li><li><b>out-of-band-dtmfs</b>: Ativa ("yes") ou desativa ("no") a supressão DTMF e o envio destes out-of-band; +</li><li><b>output-volume</b>: Define o volume de saída das ligações, varia de -10 a +10 ; +</li><li><b>pulse-forwarding</b>: Ativa ("yes") ou desativa ("no") a detecção de pulsos e a conversão dos mesmos em DTMFs; +</li><li><b>r2-preconnect-wait</b>: Define o tempo de espera do envio da sinalização de ringback, no protocolo R2/MFC, para iniciar o envio de áudio de silêncio. Apenas utilizado quando "r2-strict-behaviour" estiver ajustado para "no"; +</li><li><b>r2-strict-behaviour</b>: Ativa ("yes") ou desativa ("no") o comportamento da sinalização R2/MFC conforme a norma define. O padrão é "no", e pode ser alterado para "yes" caso seja necessário receber/enviar dados precisos da sinalização do protocolo (condição de B, por exemplo); +</li><li><b>ringback-delay-co</b>: Define o tempo de <i>delay</i> para ativar a geração de tom de controle de chamada (<i>ringback</i>) pelo Endpoint da Khomp quando há uma indicação de <i>ringback</i>, e não há áudio sendo enviado por quem indicou a situação de controle da chamada; +</li><li><b>ringback-delay-pbx</b>: Define o tempo de <i>delay</i> para ativar a geração de controle de chamada (<i>ringback</i>) pelo Endpoint da Khomp quando há uma indicação de <i>ringback</i>, e o áudio de controle enviado não possui nenhum tom (ou seja, está em silêncio); +</li><li><b>suppression-delay</b>: Ativa ("yes") ou desativa ("no") o delay necessário para supressão DTMF. Se desativado ("no"), também desativa supressão de DTMFs; +</li><li><b>trace</b>: Define opções de depuração. Não deve ser utilizado em produção a não ser que estritamente necessário; +</li><li><b>user-transfer-digits</b>: Define uma seqüência de dígitos DTMF para iniciar a transferencia entre o FreeSWITCH® e um outro PABX (utilizando sinalização de usuário, como QSig ou FXO FLASH); +</li></ul> +<p><br /> +</p> +<a name=".3Cgroups.3E" id=".3Cgroups.3E"></a><h4> <span class="mw-headline"> <groups> </span></h4> +<p>Define os grupos para serem usados na alocação de canal. +</p><p>Neste caso, as opções são usadas para definir nomes para <i>strings de alocação de canais</i>. O formato segue o padrão <param name="nome grupo" value="string alocação"/>, onde as <i>strings de alocação de canais</i> são as mesmas utilizadas no application bridge, e <i>nome do grupo</i> é um nome arbitrário escolhido pelo usuário. +</p> +<dl><dd>Por exemplo, para definir o grupo <b>pstn</b> como os canais 0 e 5 da placa 0, deveria-se utilizar a linha: +</dd></dl> +<pre><param name="pstn" value="b0c0 + b0c5"/> +</pre> +<p>Este grupo, por sua vez, poderia ser usado no <i>application bridge</i> como <b><action application="bridge" data="Khomp/Gpstn/..."/></b>. +</p> +<dl><dd>Pode-se também associar um determinado contexto de entrada a um grupo de canais, bastando especificar um nome de contexto após a <i>string</i> de alocação, separado por ':' da mesma. +</dd></dl> +<p>Por exemplo, para definir o mesmo grupo <b>pstn</b> acima como os canais 0 até 20 da placa 0, com contexto de entrada <b>from-pstn</b>, poderia-se utilizar a linha: +</p> +<pre><param name="pstn" value="b0c0-20:from-pstn"/> +</pre> +<p>Este grupo, por sua vez, poderia ser usado no <i>application bridge</i> como <b><action application="bridge" data="Khomp/Gpstn/..."/></b>, e todas as ligações vindas destes canais seriam tratadas no contexto <b>from-pstn</b>. +<br /> +</p> +<a name=".3Ccadences.3E" id=".3Ccadences.3E"></a><h4> <span class="mw-headline"> <cadences> </span></h4> +<p>Define configurações de cadências para o Endpoint. +</p><p>Neste caso, as opções são nomes de cadências e um ou dois pares de números, que definem os intervalos de tom e silêncio a ser utilizado nas cadências. Para maiores detalhes, favor consultar o arquivo de configuração. +<br /> +</p> +<a name=".3Cfxs-branches.3E" id=".3Cfxs-branches.3E"></a><h4> <span class="mw-headline"> <fxs-branches> </span></h4> +<p>Define números de origem para a placa KFXS. +</p><p>Neste caso, as opções são seqüências de prefixos de ramais e números seriais das placas, que definem os números base dos endereços de origem, e a ordem numérica das placas. O formato das opções é: +</p> +<pre><param name="prefixo" value="serial1, serial2, ...."/> +</pre> +<p>Por exemplo, para definir que as placas K0374 e K2352 devem ser numeradas seqüencialmente, partido do ramal 200, basta escrever: +</p> +<pre><param name="200" value="374, 2352"/> +</pre> +<p>Para maiores detalhes, favor consultar o arquivo de configuração. +<br /> +</p> +<a name=".3Cfxs-hotlines.3E" id=".3Cfxs-hotlines.3E"></a><h4> <span class="mw-headline"> <fxs-hotlines> </span></h4> +<p>Define hotlines para a placa KFXS. +</p><p>Neste caso, as opções são seqüências de ramais e números de destino, definindo os ramais listados nesta seção para serem tratados como "hotlines". Para cada ramal listado, o número de destino especificado será discado quando o ramal for retirado do gancho. Exemplo: +</p> +<pre><param name="100" value="1234"/> +<param name="200" value="4321"/> +</pre> +<p>No primeiro exemplo, o ramal de número 100 irá telefonar para número 1234 ao ser retirado do gancho; no segundo, o ramal de número 200 irá telefonar para o número 4321 ao ser retirado do gancho. +</p> +<a name=".3Cfxs-options.3E" id=".3Cfxs-options.3E"></a><h4> <span class="mw-headline"> <fxs-options> </span></h4> +<p>Permite definir configurações específicas por ramal FXS. +</p><p>Neste caso, as configurações são números de ramais (baseado nos definidos na seção <fxs-branches>), e as opções e seus valores. As opções disponíveis são: +</p> +<ul><li>context; +</li><li>input-volume; +</li><li>output-volume; +</li><li>accountcode; +</li><li>calleridnum; +</li><li>calleridname; +</li><li>mailbox. +</li></ul> +<p>Cada opção é separada uma da outra por um pipe "|" ou uma barra "/" e definidas após dois pontos ":", exemplo: +</p> +<pre> <param name="200" value="language:en|context:master-branch" /> +</pre> +<p>Para maiores informações sobre a sintaxe e exemplos, favor consultar o arquivo de configuração. +</p><p><br /> +</p><p>Para maiores informações, consultar o arquivo de configuração '<b>khomp.conf.xml'</b>. +<br /> +</p> +<a name="Configura.C3.A7.C3.A3o_do_FreeSWITCH" id="Configura.C3.A7.C3.A3o_do_FreeSWITCH"></a><h2> <span class="mw-headline"> Configuração do FreeSWITCH </span></h2> +<p>Quando as ligações são recebidas nas placas e dispositivos Khomp, estas são encaminhadas pelo <i>Endpoint</i> da Khomp para contextos específicos dentro do plano de discagem do FreeSWITCH®. Estes contextos podem ser alterados através do arquivo de configurações <b>khomp.conf.xml</b>, disponível no diretório de configuração do FreeSWITCH (por padrão, "<b>/usr/local/freeswitch/conf/autoload_configs</b>"). +</p><p>Para maiores detalhes sobre os contextos específicos, consultar a seção de <a href="#Configura.C3.A7.C3.A3o_do_Endpoint" title="">Configuração do Endpoint</a>. +</p><p>Abaixo, encontram-se informações de como configurar os contextos de entrada de chamadas: +<br /> +</p><p><br /> +</p> +<a name="Contextos_de_entrada_em_canais_E1" id="Contextos_de_entrada_em_canais_E1"></a><h3> <span class="mw-headline"> Contextos de entrada em canais E1 </span></h3> +<p>Para placas E1, as ligações de entrada por padrão chegam em um contexto pré-definido conforme a opção <b>context-digital</b>: +</p> +<pre><param name="context-digital" value="khomp-DD-LL"/> +</pre> +<p>Este contexto padrão define que as ligações serão redirecionadas de acordo com o número da placa e número do <i>link</i>: <b>DD</b> é o número dispositivo (com dois dígitos), e <b>LL</b> é o número do <i>link</i> (também com dois dígitos). +</p><p>Entretanto, é possível configurar outros contextos de entrada, com formatos diferenciados. Pode-se utilizar a opção <b>CCC</b>, que significa o número do canal na placa (com três dígitos), e <b>SSSS</b>, que representa o número serial da placa (com quatro dígitos). +</p><p>Exemplos de configuração no arquivo <b>khomp.conf.xml</b>: +</p> +<pre><!-- número seqüencial da placa e do link (ex: khomp-01-00) --> +<param name="context-digital" value="khomp-DD-LL"/> +</pre> +<pre><!-- número serial da placa e seqüencial do link (ex: khomp-3049-00) --> +<param name="context-digital" value="khomp-SSSS-LL"/> +</pre> +<pre><!-- número seqüencial da placa e do canal (ex: khomp-00-001) --> +<param name="context-digital" value="khomp-DD-CCC"/> +</pre> +<pre><!-- recebe todas as chamadas em um só contexto (khomp-digital) --> +<param name="context-digital" value="khomp-digital"/> +</pre> +<p>Abaixo um exemplo de contexto no plano de discagem: +<!-- NEED 6 --> +</p> +<pre><!-- +Este contexto presente em seu arquivo de dialplan, irá manipular chamadas +de entrada no link 0 (primeiro link) da placa 0. +--> +<context name="khomp-00-00"> + . + . + . +</context> +</pre> +<p>Outro exemplo, utilizando o mesmo formato: +<!-- NEED 6 --> +</p> +<pre><!-- +Este contexto presente em seu arquivo de dialplan, irá manipular chamadas +de entrada no link 1 (segundo link) da placa 0. +--> +<context name="khomp-00-01> + . + . + . +</context> +</pre> +<p>Um exemplo completo, com algumas ações simples: +<!-- NEED 10 --> +</p> +<pre><context name="khomp-00-00"> + <extension name="exemplo_1"> + <condition field="destination_number" expression="^1234$"> + <action application="bridge" data="Khomp/b0L1/2345"/> + </condition> + </extension> + <extension name="exemplo_2"> + <condition field="destination_number" expression="^23(\d{2})$"> + <action application="bridge" data="sofia/${use_profile}/11$1@${sip_from_host}"/> + </condition> + </extension> +</context> +</pre> +<pre><context name="khomp-00-01"> + <extension name="exemplo_3"> + <condition field="destination_number" expression="^1111$"> + <action application="bridge" data="Khomp/b0L0/2345"/> + </condition> + </extension> +</context> +</pre> +<p>Este plano de discagem define o recebimento de chamadas na placa <b>0</b> e no link <b>0</b>, redirecionando chamadas para o número 1234 feitas para o link <b>1</b> da placa <b>0</b>, pro ramal/telefone <b>2345</b>, e redirecionando qualquer número de quatro dígitos começado com <b>23</b> para telefones SIP de quatro dígitos começados com <b>11</b> mais os dois últimos dígitos recebidos. +</p><p>Também há mais uma extensão definida, onde as ligações recebidas no link <b>1</b> da placa <b>0</b> para o número <b>1111</b>, são redirecionadas para o link <b>0</b> da placa <b>0</b>, para o telefone/ramal <b>2345</b>. +<br /> +</p> +<a name="Contextos_de_entrada_em_canais_FXS.2FFXO.2FGSM" id="Contextos_de_entrada_em_canais_FXS.2FFXO.2FGSM"></a><h3> <span class="mw-headline"> Contextos de entrada em canais FXS/FXO/GSM </span></h3> +<p>Da mesma forma que no contexto de placas E1, as ligações de entrada são encaminhadas pelo <i>Endpoint</i> para o FreeSWITCH. Entretanto, estas sinalizações possuem dois contextos pré-definidos, buscados com uma ordem de preferência. +</p><p>O primeiro contexto é pré-definido da seguinte forma, conforme o arquivo <b>khomp.conf.xml</b>: +</p> +<pre><param name="context-gsm" value="khomp-DD-CC"/> ;placas GSM +</pre> +<pre><param name="context-fxs" value="khomp-DD-CC"/> ; placas FXS +</pre> +<pre><param name="context-fxo" value="khomp-DD-CC"/> ; placas FXO +</pre> +<p>Enquanto o segundo contexto possui o seguinte formato padrão: +</p> +<pre><param name="context-gsm-alt" value="khomp-DD"/> ; placas GSM +</pre> +<pre><param name="context-fxs-alt" value="khomp-DD"/> ; placas FXS +</pre> +<pre><param name="context-fxo-alt" value="khomp-DD"/> ; placas FXO +</pre> +<p>Nestes casos, <b>DD</b> é o número dispositivo (com dois dígitos), e <b>CC</b> é o número do canal da placa. Pode-se utilizar também <b>SSSS</b>, que representa o número serial da placa. +</p> +<ul><li> <b>IMPORTANTE</b>: No caso da placa <b>KGSM</b>, as ligações entrantes são <b>sempre</b> encaminhadas para o <i>extension</i> <b>"s"</b> por padrão, visto que o protocolo GSM não identifica o número de destino nas ligações entrantes, apenas o número de origem - quando não omitido. +</li></ul> +<a name="Prioridade_de_contextos_na_placa_FXS" id="Prioridade_de_contextos_na_placa_FXS"></a><h4> <span class="mw-headline"> Prioridade de contextos na placa FXS </span></h4> +<p>Em ligações originadas a partir de um ramal FXS, o Endpoint driver procura uma extensão válida dos dígitos discados em três contextos diferentes. A prioridade dos contextos é a seguinte: +</p> +<ol><li> Contexto específico do ramal, definido na seção <b><fxs-options></b> do arquivo de configuração do <b>khomp.conf.xml</b>; +</li><li> Contexto definido na opção <b>context-fxs</b>; +</li><li> Contexto definido na opção <b>context-fxs-alt</b>. +</li></ol> +<p>Caso durante a discagem, nenhuma extensão válida puder ser encontrada, a extensão <b>i</b> é procurada nos contextos em ordem de prioridade, e por fim no contexto <b>default</b>. Caso ocorra um <i>timeout</i> durante a discagem (configurável pela opção <b>fxs-digit-timeout</b>, no arquivo <b>khomp.conf.xml</b>) durante a discagem, o mesmo comportamento será aplicado - no entanto, a busca se dará inicialmente pelo número já discado até o <i>timeout</i> e, se não encontrado, a busca nos contextos será repetida para a extensão "t". +<br /> +</p> +<a name="Contextos_de_mensagens_SMS_.28apenas_GSM.29" id="Contextos_de_mensagens_SMS_.28apenas_GSM.29"></a><h3> <span class="mw-headline"> Contextos de mensagens SMS (apenas GSM) </span></h3> +<p>Mensagens SMS são recebidas pelo <i>Endpoint</i> da Khomp e encaminhadas para o FreeSWITCH como uma ligação normal, mas sem áudio, que possui algumas variáveis ajustadas com informações recebidas na mensagem - para maiores informações sobre estas variáveis, consulte a documentação das variáveis do <i>Endpoint</i>. Este contexto também pode ser alterado, de mesma forma que o contextos acima. +</p><p>Esta ligação entra no seguinte contexto, conforme o arquivo <b>khomp.conf.xml</b>: +</p> +<pre><param name="context-gsm-sms" value="khomp-sms-DD-CC"/> +</pre> +<p>Onde <b>DD</b> é o número dispositivo (com dois dígitos), e <b>CC</b> é o número do canal (também com dois dígitos). Por exemplo: +</p> +<pre><context name="khomp-sms-00-01"> + <extension name="sms"> + <condition field="destination_number" expression="^s$"> + <action application="log" data="DEBUG KSmsType=${KSmsType}"/> + <action application="log" data="DEBUG KSmsBody=${KSmsBody}"/> + </condition> + </extension> +</context> +</pre> +<a name="Contexto_de_entrada_em_canais_Khomp_PR_.28KPR.29" id="Contexto_de_entrada_em_canais_Khomp_PR_.28KPR.29"></a><h3> <span class="mw-headline"> Contexto de entrada em canais Khomp_PR (KPR) </span></h3> +<p>Para estas placas, as ligações de entrada possuem um contexto pré-definido, conforme exemplo abaixo: +</p> +<pre><param name="context-pr" value="khomp-DD-CC"/> +</pre> +<p>Neste caso, <b>DD</b> é o número do dispositivo (com dois dígitos), e <b>CC</b> é o número do canal da placa. +<br /> +</p><p><br /> +<br /> +</p> +<a name="Utiliza.C3.A7.C3.A3o_do_application_bridge" id="Utiliza.C3.A7.C3.A3o_do_application_bridge"></a><h3> <span class="mw-headline">Utilização do <i>application</i> bridge </span></h3> +<p>O aplicativo (ou <i>application</i>) <b>bridge</b> é responsável por gerar chamadas no FreeSWITCH a partir de um <i>dialplan</i>. Este aplicativo pode ser utilizado para gerar chamadas a partir de diversos tipos de <i>Endpoints</i>, sendo que cada <i>Endpoint</i> segue um formato específico para definir tanto as opções quanto os canais de comunicações a serem utilizados. +</p> +<a name="Campos_relativos_ao_Endpoint" id="Campos_relativos_ao_Endpoint"></a><h4> <span class="mw-headline"> Campos relativos ao <i>Endpoint</i> </span></h4> +<p>Quando utilizado para canais da <b>Khomp</b>, a <i>string</i> de <b>bridge</b> pode ter dois, três ou quatro campos separados por uma barra (/). Algumas <i>strings</i> de exemplo: +<!-- NEED 11 --> +</p> +<pre><action application="bridge" data="Khomp/B2L0/32625644"/> +<action application="bridge" data="Khomp/*B2L0/32625644"/> +<action application="bridge" data="Khomp/S0411/99991234"/> +<action application="bridge" data="Khomp/Gpstn/99991234"/> +<action application="bridge" data="Khomp/*Gpstn/99991234"/> +<action application="bridge" data="Khomp/B2C58/32625644/category=4:orig=4855553232"/> +<action application="bridge" data="Khomp/b0c9"/> +<action application="bridge" data="Khomp/b0c1+b0c14"/> +<action application="bridge" data="Khomp/r304"/> +</pre> +<p>Nos cinco primeiros exemplos, temos três campos sendo especificados; no sexto, quatros campos são utilizados; e por fim, nos três últimos exemplos, apenas dois são utilizados. +</p><p>Sobre os campos utilizados, segue a descrição: +</p> +<ul><li> <b>1° campo</b>, 'Khomp': identifica o tipo do <i>Endpoint</i> em questão; +</li><li> <b>2° campo</b>, 'B2L0', 'S0411', 'Gpstn', etc: representa a <b>Política de Alocação de Canais</b>; +</li><li> <b>3° campo</b>, '32625644' e '99991234': são os números de destino, para onde será efetuada a ligação (ausente em placas <b>KFXS</b>); +</li><li> <b>4° campo</b>, 'category=4:orig=4855553232': opções adicionais não-obrigatórias, detalhadas mais à frente. +</li></ul> +<p>OBS: A <i>string</i> de <b>bridge</b> com somente dois campos é específica à ligações para uma placa KFXS, onde o destino está atrelado automaticamente ao canal alocado, ou ao ramal especificado. +</p> +<a name="Pol.C3.ADtica_de_aloca.C3.A7.C3.A3o_de_canais" id="Pol.C3.ADtica_de_aloca.C3.A7.C3.A3o_de_canais"></a><h4> <span class="mw-headline"> Política de alocação de canais </span></h4> +<p>A política de alocação de canais, no módulo da <b>Khomp</b>, pode ser especificado na própria <i>string</i> de <i>bridge</i> ou através de grupos, no arquivo de configuração <b>khomp.conf.xml</b>. Para especificar placas, canais e links a serem alocados existe a seguinte sintaxe disponível (considerando X, Y e Z como números quaisquer): +</p> +<ul><li> b<b>X</b> -- busca os canais na placa 'X', de maneira crescente. +</li><li> b<b>X</b>L<b>Y</b> -- busca canais no link 'Y' da placa 'X', fazendo uma procura crescente (com relação ao número dos canais). +</li><li> b<b>X</b>c<b>Y</b> -- utiliza apenas o canal 'Y' da placa 'X'. +</li><li> b<b>X</b>c<b>Y</b>-<b>Z</b> -- busca por canais, iniciando do canal 'Y' e indo até o canal 'Z' (inclusive), da placa 'X', de maneira crescente. +</li><li> B<b>X</b>c<b>Y</b>-<b>Z</b> -- idem ao anterior, de maneira decrescente. +</li><li> s<b>X</b> -- busca os canais na placa de serial 'X', de maneira crescente. +</li><li> s<b>X</b>L<b>Y</b> -- busca canais no link 'Y' da placa de serial 'X', fazendo uma procura crescente (com relação ao número dos canais). +</li><li> s<b>X</b>c<b>Y</b> -- utiliza apenas o canal 'Y' da placa de serial 'X'. +</li><li> s<b>X</b>c<b>Y</b>-<b>Z</b> -- busca por canais, iniciando do canal 'Y' e indo até o canal 'Z' (inclusive), da placa de serial 'X', de maneira crescente. +</li><li> S<b>X</b>c<b>Y</b>-<b>Z</b> -- idem ao anterior, de maneira decrescente. +</li></ul> +<p>Para buscar por ramais de placas <b>KFXS</b> de acordo com o número do ramal, pode ser utilizada a seguinte sintaxe (considerando X e Y números de ramais válidos): +</p> +<ul><li> r<b>X</b> -- busca ramal 'X'. +</li><li> R<b>X</b> -- equivalente ao anterior. +</li><li> r<b>X</b>-<b>Y</b> -- busca de ramal 'X' a 'Y', ordem crescente. +</li><li> R<b>X</b>-<b>Y</b> -- busca de ramal 'X' a 'Y', ordem decrescente. +</li></ul> +<p>É interessante notar que apenas a capitalização da letra 'B', 'S' ou 'R' define a ordem de busca dos canais; se minúscula, crescente, e se maiúscula, decrescente. +</p><p>Já para a alocação de canais através de grupos, existe a seguinte sintaxe disponível: +</p> +<ul><li> Ggroupname -- utiliza a string de <i>bridge</i> definida ao grupo "groupname" no arquivo de configuração; já detalhado na seção de configuração do Endpoint. +</li><li> ggroupname -- equivalente ao anterior. +</li></ul> +<a name="Agrupando_aloca.C3.A7.C3.B5es_de_canais" id="Agrupando_aloca.C3.A7.C3.B5es_de_canais"></a><h4> <span class="mw-headline"> Agrupando alocações de canais </span></h4> +<p>Existem casos onde é necessário buscar canais mais de um determinado dispositivo, ou determinado grupo de ramais. Para isto, existe uma extensão disponível na string de alocação, que diz respeito ao uso do símbolo de soma (<b>+</b>) para concatenar várias <i>strings</i> de ligação, da seguinte forma: <!-- NEED 6 --> +</p> +<pre><action application="bridge" data="Khomp/B1L0+B2L0/32332933"/> +<action application="bridge" data="Khomp/*B2+B3+B4/99887766"/> +<action application="bridge" data="Khomp/S0411+B1L0/99887766"/> +<action application="bridge" data="Khomp/Gpstn1+Gpstn2/99991234"/> +<action application="bridge" data="Khomp/*gOperadora1+gOperadora2/98891234"/> +</pre> +<p>Esta extensão está disponível tanto no <i>application</i> <b>bridge</b> quanto na especificação de grupos, e pode ser utilizada para agrupar qualquer <i>string</i> de alocação válida à outra. O processamento das <i>strings</i> de alocação se dá da esquerda para a direita - exceto quanto utilizando a alocação cíclica, onde <b>todos</b> os canais especificados são verificados simultaneamente. +</p> +<a name="Escolha_c.C3.ADclica_e.2Fou_justa" id="Escolha_c.C3.ADclica_e.2Fou_justa"></a><h4> <span class="mw-headline"> Escolha cíclica e/ou <i>justa</i> </span></h4> +<p>Uma variação da alocação de canais é através de uma escolha cíclica e/ou <i>justa</i>, que consiste em escolher o canal que <b>completou</b> - até o momento - o menor número de ligações <b>saintes</b>. Essa forma é caracterizada por um asterisco (<b>*</b>) antes da string de alocação de canais (conforme pode ser verificado acima, no segundo e quinto exemplos). +</p><p>Quando iniciada com um asterisco (<b>*</b>), as outras formas de alocação subseqüentes (crescente, decrescente, etc) são utilizadas para decidir, entre os canais com menor número de ligações saintes, qual será verificado primeiro para realizar a chamada. +</p> +<ul><li><b>AVISO: O uso da alocação justa e/ou cíclica é recomendável <u>somente</u> em placas analógicas (KFXO), de ramais (KFXS) e de interface celular (KGSM)</b>. Conexões E1 tendem a alocar os canais de maneira crescente ou decrescente de um lado (na operadora, por exemplo), e o inverso do outro (no PABX, por exemplo), para evitar problemas de dupla ocupação (o que pode ocorrer na sinalização R2/MFC). A alocação cíclica/justa também consome mais recursos de memória e processamento que a alocação tradicional, o que é agravado ainda mais pelo fato de placas E1 terem um número muito maior de canais (30 por link).<br /><br />Por estes motivos, alocações justas e/ou cíclicas devem ser utilizadas apenas em sinalizações onde isso pode representar alguma diferença real, como equalizar a tarifação das linhas, o uso das mesmas, ou o número de ligações recebidas por cada ponto de atendimento (PA). +</li></ul> +<a name="Op.C3.A7.C3.B5es_dispon.C3.ADves" id="Op.C3.A7.C3.B5es_dispon.C3.ADves"></a><h4> <span class="mw-headline"> Opções disponíves </span></h4> +<ul><li><b>orig</b>: Define o número de origem a ser utilizado na chamada, <b>sem alterar a variável ${origination_caller_id_number}</b>. Ou seja, a opção <b>orig</b> serve <b>apenas</b> para repassar um número de origem diferente do ${origination_caller_id_number}. Caso o FreeSWITCH já tenha ajustado a variável ${origination_caller_id_number}, o que é o comportamento padrão, o Endpoint utiliza este valor automaticamente como referência do número de origem, sem ser necessário repassar nenhuma opção adicional.<br /><br />Nas placas <b>KGSM</b>, se ajustado para <b>restricted</b>, omite o número de origem. Exemplo:<br /> +</li></ul> +<pre> + <action application="bridge" data="Khomp/b0/99887766/orig=restricted"/> +</pre> +<ul><li><b>category</b>: Quando ajustado para um valor numérico, define a categoria do número de A. Disponível apenas em sinalização R2/MFC; +</li><li><b>uui</b>: Quando ajustado para um número e uma string de texto, separados por cerquilha ("#"), envia uma mensagem "User-to-User" para a outra ponta, antes de realizar a chamada, utilizando o descritor como o número e a mensagem como o texto. Disponível apenas em sinalização RDSI (ISDN); +</li><li><b>ring_cadence</b>: Quando ajustado para um identificador, utiliza cadência definida com este nome na seção "cadences" do arquivo de configuração do Endpoint da Khomp para chamar o canal desejado. Disponível apenas em sinalização FXS; +</li><li><b>ring</b>: Quando ajustado para dois números, separados por ponto ("."), define as cadências de chamada de um ramal FXS para estes valores, sendo o primeiro relativo ao tempo de chamando, e o segundo, ao tempo de silêncio; +</li><li><b>ring_ext</b>: Quando ajustado para dois números, separados por ponto ("."), define as cadências de chamada extendidas (a serem executadas depois da cadência principal) de um ramal FXS para estes valores, sendo o primeiro relativo ao tempo de chamando, e o segundo, ao tempo de silêncio; +</li><li><b>usr_xfer</b>: Quando ajustado para uma seqüência de dígitos DTMF, define estes como dígitos a serem utilizados para iniciar uma transferência entre PABXes (utilizando sinalizações de usuário); +</li><li><b>drop_on</b>: Quando ajustado para "message_box", "human_answer", "answering_machine", "carrier_message", "unknown" ou uma lista destes (separados por mais ("+") ou ponto (".")), faz com que a chamada seja derrubada ao detectar tons de caixa postal, atendimento humano, secretária eletrônica, mensagens da operadora, ou algum atendimento desconhecido - respectivamente. Disponível em sinalizações digitais (links E1 e placas KGSM). Adicionalmente, a informação de atendimento é reportada para o usuário na variável KCallAnswerInfo; +</li><li><b>answer_info</b>: Opção booleana (não necessita de valor). Quando especificada, reporta informações de atendimento para o usuário através da variável KCallAnswerInfo; +</li><li><b>pre</b>: Quando ajustado para uma seqüência de dígitos DTMF, utiliza estes para pre-alocar um canal de saída em um PABX analógico, discando o número de B desejado a seguir. Somente disponível para sinalização analógica (FXO); +</li><li><b>pre_answer</b>: Opção booleana (não necessita de valor). Quando especificada, "antende" o canal antes de a ligação ser completada permitindo, por exemplo, que DTMFs possam ser enviados - útil para utilizar em um <b>DISA</b>; +</li><li><b>output_volume</b>: Define o volume de saída da ligação. Varia de -10 a +10; +</li><li><b>input_volume</b>: Define o volume de entrada da ligação. Varia de -10 a +10; +</li></ul> +<p><br /> +</p> +<a name="Lista_das_vari.C3.A1veis" id="Lista_das_vari.C3.A1veis"></a><h3> <span class="mw-headline"> Lista das variáveis </span></h3> +<p>Segue lista de variáveis disponíveis no Endpoint: +</p> +<ul><li><b>KDropCollectCall</b>: Quando definida antes do atendimento (ao receber uma chamada), ativa ("yes") ou desativa ("no", padrão) o derrubamento de chamadas à cobrar baseado na sinalização recebida da central pública; através do duplo atendimento; ou através do reconhecimento por áudio de uma chamada à cobrar (pode ser definido de maneira global); +</li><li><b>KR2SendCondition</b>: Quando definida antes do envio de ringback pelo FreeSWITCH (ao receber uma chamada), ajusta a condição de B para o valor numérico que foi ajustada. Apenas disponível para sinalização R2; +</li><li><b>KR2GotCategory</b>: Ajustada pelo Endpoint ao receber uma chamada entrante, e possui a categoria do número de A. Apenas disponível para sinalização R2; +</li><li><b>KR2GotCondition</b>: Ajustada pelo Endpoint, e disponível após o retorno de uma chamada realizada pelo FreeSWITCH. Contém a condição de B recebida ao realizar a chamada. Apenas disponível para sinalização R2; +</li><li><b>KISDNGotCause</b>: Ajustada pelo Endpoint, e disponível após o retorno de uma chamada realizada pelo FreeSWITCH. Contém o código de <i>cause</i> do ISDN recebido ao realizar a chamada. Apenas disponível para sinalização ISDN; +</li><li><b>KCallAnswerInfo</b>: Ajustada pelo Endpoint, e disponível após o retorno de uma chamada realizada pelo FreeSWITCH. Contém as informações de atendimento detectadas ao realizar a chamada e está disponível apenas para sinalizações digitais (E1, GSM); +</li><li><b>KSmsDelivered</b>: Ajustada pelo Endpoint ao enviar uma mensagem SMS com o <i>application</i> <b>KSendSMS</b>, e define se a mensagem foi entregue com sucesso ("yes") ou não ("no"); +</li><li><b>KSmsErrorCode</b>: Ajustada pelo Endpoint ao enviar uma mensagem SMS com o <i>application</i> <b>KSendSMS</b>, e define o código de erro ao enviar a mensagem; +</li><li><b>KSmsErrorName</b>: Ajustada pelo Endpoint ao enviar uma mensagem SMS com o <i>application</i> <b>KSendSMS</b>, contém o nome do erro em forma textual, ou "None" caso não tenha ocorrido nenhum erro. +</li><li><b>KSmsType</b>: Ajustada pelo Endpoint no contexto de entrada das mensagens SMS, define o tipo da mensagem recebida (pode conter os valores "message", "confirm" ou "broadcast"; +</li><li><b>KSmsFrom</b>: Ajustada pelo Endpoint no contexto de entrada das mensagens SMS, define o número de origem da mensagem recebida (disponível em tipos "message" e "confirm"); +</li><li><b>KSmsDate</b>: Ajustada pelo Endpoint no contexto de entrada das mensagens SMS, define a data de envio da mensagem (disponível em tipos "message" e "confirm"); +</li><li><b>KSmsSize</b>: Ajustada pelo Endpoint no contexto de entrada das mensagens SMS, contém o tamanho (em bytes) da mensagem recebida (disponível em tipos "message" e "broadcast"); +</li><li><b>KSmsMode</b>: Ajustada pelo Endpoint no contexto de entrada das mensagens SMS, contém o tipo codificação da mensagem recebida (disponível em tipos "message" e "broadcast"); +</li><li><b>KSmsBody</b>: Ajustada pelo Endpoint no contexto de entrada das mensagens SMS, contém o texto da mensagem recebida (disponível em tipos "message" e "broadcast"); +</li><li><b>KSmsDelivery</b>: Ajustada pelo Endpoint no contexto de entrada das mensagens SMS, contém a data de entrega de mensagem enviada anteriormente cuja confirmação foi requisitada (disponível no tipo "confirm"); +</li><li><b>KSmsStatus</b>: Ajustada pelo Endpoint no contexto de entrada das mensagens SMS, contém o <i>status</i> de envio de mensagem anteriormente cuja confirmação foi requisitada (disponível no tipo "confirm"); +</li><li><b>KSmsSerial</b>: Ajustada pelo Endpoint no contexto de entrada das mensagens SMS, contém o número de série da mensagem recebida (disponível no tipo "broadcast"); +</li><li><b>KSmsPage</b>: Ajustada pelo Endpoint no contexto de entrada das mensagens SMS, contém o número da página relativo à mensagem recebida (disponível no tipo "broadcast"); +</li><li><b>KSmsPages</b>: Ajustada pelo Endpoint no contexto de entrada das mensagens SMS, contém o número total de páginas a serem recebidas (disponível no tipo "broadcast"); +</li><li><b>KUserInfoDescriptor</b>: Define/informa descritor do protoloco utilizado na mensagem User-to-User Information (RDSI). +</li><li><b>KUserInfoData</b>: Define/informa os dados na mensagem User-to-User Information (RDSI). +</li><li><b>KFaxSent</b>: Ajustada pelo Endpoint ao enviar FAX com o application KSendFax, e define se o FAX foi enviado com sucesso ("yes") ou não ("no"); +</li><li><b>KFaxReceived</b>: Ajustada pelo Endpoint ao receber FAX com o application KReceiveFax, e define se o FAX foi recebido com sucesso ("yes") ou não ("no"); +</li><li><b>KFaxResult</b>: Ajustada pelo Endpoint ao enviar ou receber FAX com o application KSendFax ou KReceiveFax, respectivamente, e define o seu resultado. +</li></ul> +<p><br /> +</p> +<a name="Descri.C3.A7.C3.A3o_das_vari.C3.A1veis" id="Descri.C3.A7.C3.A3o_das_vari.C3.A1veis"></a><h3> <span class="mw-headline"> Descrição das variáveis </span></h3> +<p>Abaixo, segue uma explanação sobre como utilizar as variáveis do Endpoint da Khomp disponíveis no dialplan, tanto para comunicar quanto para receber informações: +</p><p><br /> +</p> +<a name="KDropCollectCall" id="KDropCollectCall"></a><h4> <span class="mw-headline"> KDropCollectCall </span></h4> +<p>Quando ativada, faz com que o Endpoint da Khomp derrube chamadas a cobrar através de duplo atendimento (disponível para sinalizações 'R2 Digital' e FXO), através da informação disponível no protocolo RDSI e R2/MFC, ou através da detecção do áudio de chamada a cobrar (disponível para qualquer sinalização digital por link E1, e para sinalização GSM). +</p><p>Esta variável é útil para derrubar chamadas a cobrar para determinados ramais, e deve ser ajustado <b>obrigatoriamente</b> antes de realizar qualquer tipo de atendimento - aplicações como <b>playback</b> e <b>bridge</b> devem ser executadas sempre após ajustar esta variável, por exemplo. +</p><p>Para melhor funcionalidade, é recomendado também que nenhum estado de chamada (<i>ringback</i>) seja enviado antes desta variável ser ajustada, então aplicações devem ser executadas apenas após o ajuste correto desta variável. +</p><p>Esta variável pode ser ajustada localmente e globalmente, tanto para <b>yes</b> quanto para <b>no</b>. O ajuste da variável global para <b>yes</b> fará com que todas as chamadas a cobrar sejam derrubadas, a não ser que a chamada específica seja ajustada para <b>no</b> - isto permite a criação de um filtro global de chamadas a cobrar, com algumas poucas exceções. +</p><p>Ativando a variável dentro do contexto <b>default</b>: +<!-- NEED 5 --> +</p><p><context name="default"> +</p> +<pre><extension name="exemplo"> + . + . + . + <action aplication="set" data="KDropCollectCall=yes"/> + . + . + . +</extension> +</pre> +<p></context> +</p><p>Ativando a variável no contexto global, lembrando que a mesma deve ser configurada no arquivo <b>vars.xml</b>: +<!-- NEED 5 --> +</p> +<pre><X-PRE-PROCESS cmd="set" data="KDropCollectCall=yes"/> +</pre> +<a name="KR2SendCondition" id="KR2SendCondition"></a><h4> <span class="mw-headline"> KR2SendCondition </span></h4> +<p>Ao receber uma chamada, pode ser definida antes do envio de ringback pelo FreeSWITCH (ou seja, antes do FreeSWITCH executar as aplicações answer, ou bridge). Quando utilizada em sinalização R2/MFC, esta variável ajusta a condição de B para o valor numérico desejado. +</p><p>Exemplo: +<!-- NEED 6 --> +</p> +<pre><!-- Condição "NUMBER CHANGED", avisa ao chamador que o número de B mudou. --> +<action application="KR2SendCondition" data="3"/> +</pre> +<a name="KR2GotCategory" id="KR2GotCategory"></a><h4> <span class="mw-headline"> KR2GotCategory </span></h4> +<p>Ao receber uma chamada, é ajustada pelo Endpoint com a categoria recebida do número que originou a chamada. É ajustada na sinalização R2/MFC, e pode ser consultada em qualquer local do dialplan. +</p><p>Exemplo: +<!-- NEED 3 --> +</p> +<pre><action application="log" data="DEBUG KR2GotCategory [${KR2GotCategory}]"/> +</pre> +<a name="KR2GotCondition" id="KR2GotCondition"></a><h4> <span class="mw-headline"> KR2GotCondition </span></h4> +<p>Variável ajustada pelo Endpoint, e disponível após o retorno de uma chamada realizada pelo FreeSWITCH. Contém a condição de B recebida ao realizar a chamada. Disponível apenas para sinalização R2/MFC. +</p><p>Exemplo: +<!-- NEED 3 --> +</p> +<pre><action application="log" data="DEBUG KR2GotCondition [${KR2GotCondition}]"/> +</pre> +<a name="KUserInfoDescriptor" id="KUserInfoDescriptor"></a><h4> <span class="mw-headline"> KUserInfoDescriptor </span></h4> +<p>Variável ajustada pelo Endpoint no contexto de entrada, a partir de informações recebidas pela rede RDSI através da funcionalidade User-to-User Information. Contém o número do descritor do protocolo utilizado pela outra ponta, e normalmente contém valor '0', mas este valor é dependente da aplicação utilizada. +</p><p>Maiores informações, consultar a especificação ITU-T Q931 (mais precisamente, a tabela 4-26 da especificação). +</p><p>Exemplo (trabalhando com o número do descritor do protocolo): <!-- NEED 3 --> +</p> +<pre><action application="log" data="DEBUG KUserInfoDescriptor [${KUserInfoDescriptor}]"/> +</pre> +<a name="KUserInfoData" id="KUserInfoData"></a><h4> <span class="mw-headline"> KUserInfoData </span></h4> +<p>Variável ajustada pelo Endpoint no contexto de entrada, a partir de informações recebidas pela rede RDSI através da funcionalidade User-to-User Information. Contém os dados propriamente ditos, que foram recebidos, em forma de uma 'string' de texto. +</p><p>Maiores informações sobre este recurso, consultar a especificação ITU-T Q931. +</p><p>Exemplo (trabalhando com os dados recebidos): <!-- NEED 3 --> +</p> +<pre><action application="log" data="DEBUG KUserInfoData [${KUserInfoData}]"/> +</pre> +<p>É importante salientar que as variáveis são sensíveis à capitalização das letras (case sensitive). +</p> +<a name="KCallAnswerInfo" id="KCallAnswerInfo"></a><h4> <span class="mw-headline"> KCallAnswerInfo </span></h4> +<p>Variável ajustada pelo Endpoint em ligações de saída, representando o tipo de atendimento realizado pela outra ponta. Pode conter os seguintes valores: +</p> +<dl><dd><ul><li> "MessageBox" (*): detectada caixa postal de um telefone celular; +</li><li> "CarrierMessage": mensagem de operadora enviada antes do atendimento; +</li><li> "AnsweringMachine" (**): atendimento por secretária eletrônica; +</li><li> "HumanAnswer" (**): atendimento humano; +</li><li> "Unknown": tipo de atendimento desconhecido; +</li><li> "Fax": reportado quando um tom de fax for detectado. +</li></ul> +</dd></dl> +<p><br /> +(*) Este tipo de atendimento é detectado por sinais em determinadas freqüências que são enviados antes da chamada entrar em uma caixa postal, e variam conforme a operadora. O algoritmo captura a maior parte das caixas postais, mas pode falhar se não existir um sinal claro, ou se o mesmo não estiver dentro dos padrões mais utilizados; +</p><p>(**) A diferenciação entre estes dois tipos de atendimento depende de configuração específica utilizando o programa <b>k3lanswerinfoconfig</b>, sendo a detecção apenas baseada em heurísticas e <b>nunca</b> com precisão de 100%. +<br /> +</p> +<a name="Comandos_de_console" id="Comandos_de_console"></a><h1> <span class="mw-headline">Comandos de console </span></h1> +<p>Lista de comandos disponíveis no console do FreeSWITCH para o Endpoint da Khomp: +</p><p><br /> +</p> +<ul><li> <b>khomp channels disconnect </b>: Desconecta um ou vários canais. Este comando envia uma mensagem diretamente para o canal físico da placa em questão, requisitando a desconexão. Use com cautela; +</li><li> <b>khomp channels unblock </b>: Desbloqueia canais bloqueados para entrada ou para saída. Somente disponível em sinalização digital via link E1; +</li><li> <b>khomp clear links</b>: Limpa os contadores de erros nos links; +</li><li> <b>khomp clear statistics</b>: Limpa as estatísticas de ligações dos canais, ou as estatísticas de um canal específico; +</li><li> <b>khomp get </b>: Obtém as opções diversas do Endpoint da Khomp; +</li><li> <b>khomp kommuter </b>: Ativa ou desativa os kommuters ligados via USB nesta máquina. Somente acessível quando a configuração "kommuter-activation" estiver setada como "manual"; +</li><li> <b>khomp kommuter count</b>: Obtém a quantidade de kommuters ligados via USB nesta máquina; +</li><li> <b>khomp log console</b>: Ajusta opções de logs no console. +</li><li> <b>khomp log disk</b>: : Ajusta opções de log em disco. +<ul><li> <b>khomp log console</b> e <b>khomp log disk</b> dispõem de opções auxiliares <b>no</b>, que inverte a escolha de mensagens, e <b>just</b>, que generaliza a escolha. Exemplos: +<ul><li> <b>khomp log disk just commands events</b> (Habilita <i>somente</i> o registro de comandos e eventos da API em disco). +</li><li> <b>khomp log disk no commands</b> (Desabilita o registro em disco de comandos enviados à API). +</li><li> <b>khomp log disk warnings</b> (Habilita <i>também</i> o registro em disco dos avisos do Endpoint). +</li></ul> +</li><li> Mais informações sobre as opções de <i>log</i> nos comando "<b>help khomp log disk</b>" ou "<b>help khomp log console</b>". +</li></ul> +</li><li> <b>khomp log rotate</b>: Rotaciona arquivos de log do Endpoint; +</li><li> <b>khomp log status</b>: Mostra mensagens de log atualmente sendo escritas em disco e mostradas no console; +</li><li> <b>khomp log trace isdn</b>: Ativa a depuração da sinalização RDSI (ISDN); +</li><li> <b>khomp log trace k3l </b>: Ativa a depuração de baixo nível da API K3L; +</li><li> <b>khomp log trace r2 </b>: Ativa a depuração de baixo nível da sinalização R2/MFC; +</li><li> <b>khomp reset links</b>: Envia um comando de reset para um determinado link E1 de uma determinada placa; +</li><li> <b>khomp revision</b>: Mostra número da versão e revisão do Endpoint; +</li><li> <b>khomp select sim</b>: Seleciona o SIM card, disponível nas placas KGSM; +</li><li> <b>khomp send command </b>: Envia comando da API K3L diretamente para a placa. Apenas para depuração de problemas, pode compromenter a estabilidade do sistema se utilizado de maneira incorreta; +</li><li> <b>khomp send raw command </b>: Envia um comando diretamente para o DSP da placa. Apenas para depuração de problemas, pode compromenter a estabilidade do sistema se utilizado de maneira incorreta; +</li><li> <b>khomp set </b>: Ajusta opções diversas do Endpoint da Khomp; +</li><li> <b>khomp show calls </b>: Mostra estados das chamadas Khomp, podendo listar também por placa ou canal específico; +</li><li> <b>khomp show channels </b>: Mostra o estado dos canais Khomp, podendo listar também por placa específica; +</li><li> <b>khomp show links</b>: Mostra estados dos links E1 disponíveis. +</li><li> <b>khomp show statistics </b>: Mostra as estatísticas de ligações dos canais, ou as estatísticas de um canal específico; +</li><li> <b>khomp sms </b>: Envia uma mensagem SMS utilizando canais da placa KGSM para um determinado número; +</li><li> <b>khomp summary </b>:Imprime um sumário das placas do sistema e de suas características; +</li></ul> +<p><br /> +</p> +<a name="Recursos_adicionais" id="Recursos_adicionais"></a><h1> <span class="mw-headline">Recursos adicionais </span></h1> +<p>Este capítulo trata de recursos adicionais do Endpoint, relacionados às funcionalidades especiais presentes em algumas sinalizações. +<br /> +</p> +<a name="Aplica.C3.A7.C3.B5es_.28applications.29_e_canais" id="Aplica.C3.A7.C3.B5es_.28applications.29_e_canais"></a><h2> <span class="mw-headline">Aplicações (applications) e canais </span></h2> +<p>O Endpoint da Khomp, além de registrar um tipo de canal de comunicação "Khomp", registra também os seguintes itens: +<br /> +</p> +<a name="Aplica.C3.A7.C3.A3o_.22KUserTransfer.22" id="Aplica.C3.A7.C3.A3o_.22KUserTransfer.22"></a><h3> <span class="mw-headline">Aplicação "KUserTransfer" </span></h3> +<p>Realiza o processo de transferência do canal atual para o ramal <i>número'</i> utilizando o protocolo de sinalização QSig (Single Step Call Transfer) para placas E1 configuradas com sinalização RDSI (ISDN), ou utiliza comando de FLASH para linhas FXO, LineSide, CAS_EL7 e E1LC. +</p><p>A sintaxe segue: +</p> +<pre><action application="KUserTransfer" data="<b>número</b>[,opções])"/> +</pre> +<p>Exemplo: +</p> +<pre><action application="answer"/> +<action application="KUserTransfer" data="2345"/> +</pre> +<p>Os campos têm o seguinte significado: +</p> +<ul><li><b>número</b>: Número para onde a ligação deve ser transferida. +</li><li><b>opções</b>: Define as opções de transferência a utilizar, que são: +<ul><li><b>n</b>: Aguarda até o canal ser desconectado. +</li></ul> +</li></ul> +<p><br /> +</p><p><br /> +</p> +<a name="Aplica.C3.A7.C3.A3o_.22KSendSMS.22" id="Aplica.C3.A7.C3.A3o_.22KSendSMS.22"></a><h3> <span class="mw-headline">Aplicação "KSendSMS" </span></h3> +<p>Esta aplicação tem a função de enviar mensagens SMS através das placas KGSM da Khomp, utilizando os módulos e SIM cards presentes na placa para tal. A sintaxe da aplicação é a seguinte: +</p> +<pre><action application="KSendSMS" data="recurso|destino|mensagem" /> +</pre> +<p>Podendo cada campo ser resumido em: +</p> +<ul><li><b>recurso</b>: Segue uma sintaxe idêntica à alocação de canais do application Bridge, e define qual modem utilizar; +</li><li><b>destino</b>: Número para onde enviar a mensagem, podendo ser precedido ou sucedido por <b>!</b> para requisitar uma mensagem de confirmação de envio; +</li><li><b>mensagem</b>: Texto (sem aspas) que deve ser enviado para <b>destino</b>. +</li></ul> +<p>Após o envio da mensagem, as variáveis <b>KSmsDelivered</b> e <b>KSmsErrorCode</b> conterão o resultado do envio da mensagem. Para maiores informações sobre estas, favor consultar a seção sobre as variáveis utilizadas no Endpoint. +</p><p>Exemplos de uso desta aplicação seguem abaixo: +</p> +<ul><li>Envia "Mensagem de teste." para telefone "99887766" utilizando o modem "1" (segundo modem) da placa "0": +</li></ul> +<pre><action application="log" data="DEBUG Enviando SMS..." /> +<action application="KSendSMS" data="b0c1|99887766|Mensagem de teste" /> +</pre> +<ul><li>Envia "Mensagem de teste." para telefone "99887766" utilizando o primeiro modem livre da placa "0", e verifica retorno do envio: +</li></ul> +<pre><action application="log" data="DEBUG Enviando SMS..." /> +<action application="KSendSMS" data="b0|99887766|Mensagem de teste" /> +<action application="log" data="DEBUG Enviou? ${KSmsDelivered}" /> +<action application="log" data="DEBUG Codigo: ${KSmsErrorCode}" /> +<action application="log" data="DEBUG Descr.: ${KSmsErrorName}" /> +</pre> +<ul><li>Envia "Mensagem de teste." para telefone "99887766" utilizando o primeiro modem livre da placa "0", ou para o primeiro canal livre da placa "1" (se não houver canal livre na primeira placa): +</li></ul> +<pre><action application="log" data="DEBUG Enviando SMS..." /> +<action application="KSendSMS" data="b0+b1|99887766|Mensagem de teste" /> +</pre> +<ul><li>Envia "Mensagem de teste." para telefone "99887766" utilizando o primeiro modem livre da placa "0", requisitando confirmação: +</li></ul> +<pre><action application="log" data="DEBUG Enviando SMS..." /> +<action application="KSendSMS" data="b0|99887766!|Mensagem de teste" /> +</pre> +<p><br /> +</p> +<a name="Aplica.C3.A7.C3.A3o_.22KEchoCanceller.22" id="Aplica.C3.A7.C3.A3o_.22KEchoCanceller.22"></a><h3> <span class="mw-headline"> Aplicação "KEchoCanceller" </span></h3> +<p>Esta aplicação tem a função de habilitar ou desabilitar o cancelador de eco do canal. +</p> +<pre><action application="KEchoCanceller" data="<b>ação</b>[,opções])"/> +</pre> +<p>Onde: +</p> +<ul><li><b>ação</b>: Pode ser <b>on</b> para habilitar o cancelador de eco, e <b>off</b> para desabilitar; +</li></ul> +<p>Exemplo de uso desta aplicação: +</p> +<pre><action application="KEchoCanceller" data="off"/> +</pre> +<p><br /> +</p> +<a name="Aplica.C3.A7.C3.A3o_.22KAutoGainControl.22" id="Aplica.C3.A7.C3.A3o_.22KAutoGainControl.22"></a><h3> <span class="mw-headline"> Aplicação "KAutoGainControl" </span></h3> +<p>Esta aplicação tem a função de habilitar ou desabilitar o controle automático de ganho no canal. +</p> +<pre><action application="KAutoGainControl" data="<b>ação</b>[,opções])"/> +</pre> +<p>Onde: +</p> +<ul><li><b>ação</b>: Pode ser <b>on</b> para habilitar o controle automático de ganho, e <b>off</b> para desabilitar; +</li></ul> +<p>Exemplo de uso desta aplicação: +</p> +<pre><action application="KAutoGainControl" data="on"/> +</pre> +<p><br /> +</p> +<a name="Aplica.C3.A7.C3.A3o_.22KDTMFSuppression.22" id="Aplica.C3.A7.C3.A3o_.22KDTMFSuppression.22"></a><h3> <span class="mw-headline"> Aplicação "KDTMFSuppression" </span></h3> +<p>Esta aplicação tem a função de habilitar ou desabilitar a supressão de DTMF do canal. A sintaxe da aplicação é a seguinte: +</p> +<pre><action applicatin="KDTMFSuppression" value="<b>ação</b>[,opções])"/> +</pre> +<p>Onde: +</p> +<ul><li><b>ação</b>: Pode ser <b>on</b> para habilitar a supressão DTMF, e <b>off</b> para desabilitar; +</li></ul> +<p>É importante notar que quando desabilitada a supressão de DTMF, os DTMFs serão passados <i>inband</i> e não serão mais reportados ao FreeSWITCH. Dessa forma o FreeSWITCH não reconhecerá os DTMFs, o que pode ocasionar em mau funcionamento de aplicações como por exemplo, URAs. +</p><p>Exemplo de uso desta aplicação: +</p> +<pre><action applicatin="KDTMFSuppression" value="off"/> +</pre> +<p><br /> +</p> +<a name="Aplica.C3.A7.C3.A3o_.22KSetVolume.22" id="Aplica.C3.A7.C3.A3o_.22KSetVolume.22"></a><h3> <span class="mw-headline"> Aplicação "KSetVolume" </span></h3> +<p>Esta aplicação tem a função de ajustar o volume de entrade e saída de canais da Khomp, sendo a sua sintaxe a seguinte: +</p> +<pre><action application="KSetVolume" data="<volume>"/> +<action application="KSetVolume" data="<output-volume>|<input-volume>"/> +</pre> +<p>Onde os campos possuem o seguinte significado: +</p> +<ul><li><b>volume</b>: Ajusta o volume de entrada e saída (-10 a +10); +</li><li><b>output-volume</b>: Ajusta o volume de saída (-10 a +10, "none" para não alterar); +</li><li><b>input-volume</b>: Ajusta o volume de entrada (-10 a +10, "none" para não alterar). +</li></ul> +<p><br /> +</p> +<a name="Aplica.C3.A7.C3.A3o_.22KAdjustForFax.22" id="Aplica.C3.A7.C3.A3o_.22KAdjustForFax.22"></a><h3> <span class="mw-headline"> Aplicação "KAdjustForFax" </span></h3> +<p>Esta aplicação tem a função de ajustar um canal da Khomp para o recebimento de sinal de FAX/modem, otimizando o canal de comunicação para o tráfego de dados. Sintaxe: +</p> +<pre><action application="KAdjustForFax" data=""/> +</pre> +<p>Esta aplicação não recebe parâmetros. Exemplo de utilização: +</p> +<pre><action application="KAdjustForFax" data=""/> +</pre> +<p><br /> +</p> +<a name="Aplica.C3.A7.C3.A3o_.22KSendFax.22" id="Aplica.C3.A7.C3.A3o_.22KSendFax.22"></a><h3> <span class="mw-headline"> Aplicação "KSendFax" </span></h3> +<p>Esta aplicação tem a função de enviar fax utilizando canais digitais ou FXO da Khomp em ligações pré-estabelecidas, sendo a sua sintaxe a seguinte: +</p> +<pre><action application="KSendFax" data="<arquivo>[:<arquivo2>[:...]][|<faxid>]"/> +</pre> +<p><strong>Esta aplicação necessita de uma licença adquirida à parte para ser utilizada em canais digitais</strong>. Os campos possuem os seguintes significados: +</p> +<ul><li><b>arquivos</b>: Arquivos a serem enviados para o fax devem estar encapsulados no formato TIFF e possuírem resolução de 98, 196 ou 392 dpi; +</li><li><b>faxid</b>: Número do fax. Caso não seja especificado, o valor será obtido pela id da ligação, e caso esta, também não seja válida, o número do fax será o configurado como padrão na K3L. +</li></ul> +<p>Exemplo de uso desta aplicação: +</p> +<pre><action application="KSendFax" data="/tmp/fax.tif:/home/root/fax2.tif,1234"/> +</pre> +<p><br /> +</p> +<a name="Aplica.C3.A7.C3.A3o_.22KReceiveFax.22" id="Aplica.C3.A7.C3.A3o_.22KReceiveFax.22"></a><h3> <span class="mw-headline"> Aplicação "KReceiveFax" </span></h3> +<p>Esta aplicação tem a função de receber fax utilizando canais digitais ou FXO da Khomp, sendo a sua sintaxe a seguinte: +</p> +<pre><action application="KReceiveFax" data="<arquivo>[|<faxid>]/> +</pre> +<p><strong>Esta aplicação necessita de uma licença adquirida à parte para ser utilizada em canais digitais</strong>. Os campos possuem os seguintes significados: +</p> +<ul><li><b>arquivo</b>: Nome que será atribuído ao arquivo de fax recebido. +</li><li><b>faxid</b>: Número do fax. Caso não seja especificado, o valor será obtido pela id da ligação, e caso esta, também não seja válida, o número do fax será o configurado como padrão na K3L. +</li></ul> +<p>Exemplo de uso desta aplicação: +</p> +<pre><action application="answer" /> +<action application="KReceiveFax" data="/tmp/fax.tif"/> +</pre> +<p><br /> +</p> +<a name="Canal_.22Khomp_SMS.22" id="Canal_.22Khomp_SMS.22"></a><h3> <span class="mw-headline"> Canal "Khomp_SMS" </span></h3> +<p>Este canal de comunicação é utilizado para receber mensagens SMS e criar ligações entrantes no FreeSWITCH para cada mensagem recebida. Este canal não possui qualquer tipo de tratamento ou processamento de áudio, e é chamado com cinco variáveis ajustadas: +</p> +<ul><li><b>KSmsFrom</b>, contendo o número de origem de quem enviou a mensagem; +</li><li><b>KSmsDate</b>, que define a data/hora do recebimento da mensagem; +</li><li><b>KSmsSize</b>, representando o tamanho da mensagem (em bytes); +</li><li><b>KSmsMode</b>, contendo a codificação utilizada para transmitir a mensagem; +</li><li><b>KSmsBody</b>, que é a mensagem em si. +</li></ul> +<p>O processamento do dialplan do FreeSWITCH pode ser utilizado para guardar esta mensagem em um banco de dados, executar alguma aplicação, entre outros. Entretanto, a única ação aceita por este channel é desligamento (hangup) - ou seja, esta ligação entrante não pode ser considerada uma ligação comum. +<br /> +</p> +<a name="Canal_.22Khomp_PR.22" id="Canal_.22Khomp_PR.22"></a><h3> <span class="mw-headline"> Canal "Khomp_PR" </span></h3> +<p>Este canal de comunicação é utilizado para receber ligações em placas de gravação passiva (família <b>KPR</b> e <b>KFXO-HI</b>), criando ligações entrantes no FreeSWITCH para cada chamada recebida. Este canal permite apenas o recebimento de áudio capturado do <i>link</i>, não permitindo tanto o envio de mensagens de áudio quanto o de sinalizações de controle. +</p><p>O processamento do dialplan do FreeSWITCH pode ser utilizado para gravar dados sobre esta ligação em um banco de dados, executar alguma aplicação especial e/ou algum <i>application</i> de gravação (como o <b>record</b>), entre outros. Entretanto, a única ação aceita por este channel é desligamento (hangup) - ou seja, esta ligação entrante não pode ser considerada uma ligação comum. +<br /> +</p><p><br /> +</p> +<a name="C.C3.B3digos_e_significados" id="C.C3.B3digos_e_significados"></a><h1> <span class="mw-headline">Códigos e significados </span></h1> +<p>Este capítulo apresenta os códigos presentes no Endpoint da Khomp e seus significados, utilizados nos comandos de console: +<br /> +</p> +<a name="Estados_de_canais" id="Estados_de_canais"></a><h2> <span class="mw-headline">Estados de canais </span></h2> +<p>Refletem o estado do canal relativo à placa. No caso de links E1, o estado pode ter uma ou mais das seguintes opções: +</p> +<ul><li> <b>Free</b>: o canal está livre; +</li><li> <b>Busy</b>: o canal não está livre (ou ocupado, ou em falha); +</li><li> <b>Outgoing</b>: o canal possui uma ligação de saída; +</li><li> <b>Incoming</b>: o canal possui uma ligação de entrada; +</li><li> <b>Locked</b>: o canal está bloqueado; +</li><li> <b>Outgoing Lock</b>: o canal está bloqueado para chamadas saintes; +</li><li> <b>Local Fail</b>: o canal possui uma falha local (nesta ponta); +</li><li> <b>Incoming Lock</b>: o canal está bloqueado para chamadas entrantes; +</li><li> <b>Remote Lock</b>: há um bloqueio remoto (na outra ponta) neste canal. +</li></ul> +<p>No caso de um canal FXS, o estado é definido por um destes valores: +</p> +<ul><li> <b>On Hook</b>: o telefone conectado neste canal está no gancho ou desconectado; +</li><li> <b>Off Hook</b>: o telefone conectado neste canal está fora do gancho; +</li><li> <b>Ringing</b>: o canal está sendo chamado; +</li><li> <b>Failure</b>: o canal está em falha devido a problemas de comunicação entre a central e a placa. +</li></ul> +<p>No caso de um canal GSM, o estado também é definido por um dos valores a seguir: +</p> +<ul><li> <b>Idle</b>: o canal está livre e disponível para realizar chamadas; +</li><li> <b>Call In Progress</b>: o canal está ocupado em uma ligação; +</li><li> <b>Modem Error</b>: ocorreu um erro na comunicação com o modem do canal; +</li><li> <b>SIM Card Error</b>: o SIM card não está presente ou não foi inserido/detectado corretamente; +</li><li> <b>Network Error</b>: ocorreu um erro ao comunicar-se com a rede; +</li><li> <b>Not Ready</b>: o modem está sendo inicializado no canal. +</li></ul> +<p>E no caso de um canal FXO, os estados serão os seguintes: +</p> +<ul><li> <b>Disabled</b>: o canal está desabilitado; +</li><li> <b>Enabled</b>: o canal está habilitado. +</li></ul> +<p><br /> +</p> +<a name="Estados_de_chamada" id="Estados_de_chamada"></a><h2> <span class="mw-headline"> Estados de chamada </span></h2> +<p>Define o estado de cada canal relativo ao software, que pode ser:: +</p> +<ul><li><b>Free</b>: o canal está livre; +</li><li><b>Incoming</b>: o canal está recebendo uma chamada; +</li><li><b>Outgoing</b>: o canal está realizando uma chamada; +</li><li><b>Failure</b>: o canal está em falha. +</li></ul> +<p><br /> +</p> +<a name="Estados_da_chamada_FreeSWITCH" id="Estados_da_chamada_FreeSWITCH"></a><h2> <span class="mw-headline"> Estados da chamada FreeSWITCH </span></h2> +<p>Reflete diretamente o estado de chamada controlado pelo FreeSWITCH, que pode se +</p> +<ul><li> <b>new</b>: Canal é recém criado; +</li><li> <b>init</b>: Canal foi inicializado; +</li><li> <b>routing</b>: Canal está procurando uma extensão para executar; +</li><li> <b>execute</b>: Canal está executando seu dialplan; +</li><li> <b>ex_media</b>: Canal está trocando media com outro canal; +</li><li> <b>cs_media</b>: Canal está consumindo toda media; +</li><li> <b>hangup</b>: O canal está marcada para hangup e pronto para terminar. +</li></ul> +<p><br /> +</p> +<a name="C.C3.B3digos_GSM" id="C.C3.B3digos_GSM"></a><h2> <span class="mw-headline"> Códigos GSM </span></h2> +<p>Os seguintes códigos numéricos são reportados: +</p> +<a name="C.C3.B3digos_de_SMS_.28SMS_cause.29" id="C.C3.B3digos_de_SMS_.28SMS_cause.29"></a><h3> <span class="mw-headline"> Códigos de SMS (<i>SMS cause</i>) </span></h3> +<pre>1 Unassigned number +8 Operator determined barring +10 Call barred +21 SMS transfer rejected +27 Destination out of service +28 Unidentified subscriber +29 Facility rejected +30 Unknown subscriber +38 Network out of order +41 Temporary failure +42 Congestion +47 Resources unavailable +50 Facility not subscribed +69 Facility not implemented +81 Invalid SMS transfer reference value +95 Invalid message +96 Invalid mandatory information +97 Message type non existent +98 Message not compatible with SMS protection state +99 Information element non existent +111 Protocol error +127 Interworking +128 Telematic interworking not supported +129 SMS type zero not supported +130 Cannot replace SMS +143 Unspecified TPPID error +144 Alphabet not supported +145 Message class not supported +159 Unspecified TPDCS error +160 Command cannot be actioned +161 Command unsupported +175 Unspecified TP command error +176 TPDU not supported +192 SC busy +193 No SC subscription +194 SC system failure +195 Invalid SME address +196 Destination SME barred +197 SM rejected duplicate SM +198 TPVPF not supported +199 TPVP not supported +208 SIM SMS storage full +209 No SMS storage capability in SIM +210 Error in SMS +211 Memory capatity exceeded +213 SIM data download error +255 Unspecified error +300 Phone failure +301 SMS service reserved +302 Operation not allowed +303 Operation not supported +304 Invalid PDU mode parameter +305 Invalid text mode parameter +310 SIM not inserted +311 SIM PIN necessary +312 Phone SIM PIN necessary +313 SIM failure +314 SIM busy +315 SIM wrong +320 Memory failure +321 Invalid memory index +322 Memory full +330 SMSC address unknown +331 No network service +332 Network timeout +500 Unknown error +512 Network busy +513 Invalid destination address +514 Invalid message body length +515 Phone is not in service +516 Invalid preferred memory storage +517 User terminated +</pre> +<a name="C.C3.B3digos_de_chamada_.28call_cause.29" id="C.C3.B3digos_de_chamada_.28call_cause.29"></a><h3> <span class="mw-headline"> Códigos de chamada (<i>call cause</i>) </span></h3> +<pre>1 Unallocated number +3 No route to destination +6 Channel unacceptable +8 Operator determined barring +16 Normal call clear +17 User busy +18 No user responding +19 No answer from user +21 Call rejected +22 Number changed +26 Non Selected user clear +27 Destination out of order +28 Invalid number format +29 Facility rejected +30 Response status enquiry +31 Normal, unspecified +34 No circuit channel available +38 Network out of order +41 Temporary failure +42 Switch congestion +43 Access information discarded +44 Requested channel unavailable +47 Resource unavailable +49 QoS unavailable +50 Request facility not subscribed +55 Call barred with UG +57 Bearer capability not authorized +58 Bearer capability not available +63 Service not available +65 Bearer capability not implemented +69 Request facility not implemented +70 Only restricted bearer capability available +79 Service not implemented +81 Invalid call reference value +82 User not member of UG +88 Incompatible destination +91 Invalid transit network selected +95 Invalid message +96 Missing mandatory information element +97 Message type not implemented +98 Message incompatible with state +99 Information element not implemented +100 Invalid information element +101 Message incompatible with state (2) +102 Recovery on timer expiry +111 Protocol error +127 Interworking +</pre> +<a name="C.C3.B3digos_gerais_.28mobile_cause.29" id="C.C3.B3digos_gerais_.28mobile_cause.29"></a><h3> <span class="mw-headline"> Códigos gerais (<i>mobile cause</i>) </span></h3> +<pre>0 Phone failure +1 No connection to phone +2 Phone adaptor link reserved +3 Operation not allowed +4 Operation not supported +5 Phone SIM PIN required +6 Phone FSIM PIN required +7 Phone FSIM PUK required +10 SIM not inserted +11 SIM PIN required +12 SIM PUK required +13 SIM failure +14 SIM busy +15 SIM wrong +16 Incorrect password +17 SIM PIN2 required +18 SIM PUK2 required +20 Memory full +21 Invalid index +22 Not found +23 Memory failure +24 Text string too long +25 Invalid character in text string +26 Dial string too long +27 Invalid character in dial string +30 No network service +31 Network timeout +32 Network not allowed +33 Command aborted +34 Number parameter instead of text parameter +35 Text parameter instead of number parameter +36 Numeric parameter out of bounds +37 Text string too short +40 Network PIN required +41 Network PUK required +42 Network subset PIN required +43 Network subset PUK required +44 Network service provider PIN required +45 Network service provider PUK required +46 Corporate PIN required +47 Corporate PUK required +60 SIM Service option not supported +100 Unknown +103 Illegal MS #3 +106 Illegal MS #6 +107 GPRS service not allowed #7 +111 PLMN not allowed #11 +112 Location area not allowed #12 +113 Roaming not allowed #13 +132 Service option not supported #32 +133 Registration service option not subscribed #33 +134 Service option temporary out of order #34 +147 Long context activation +148 Unspecified GPRS error +149 PDP authentication failure +150 Invalid mobile class +151 GPRS disconnection TMR active +256 Too many active calls +257 Call rejected +258 Unanswered call pending +259 Unknown calling error +260 No phone number recognized +261 Call state not idle +262 Call in progress +263 Dial state error +264 Unlock code required +265 Network busy +266 Invalid phone number +267 Number entry already started +268 Cancelled by user +269 Number entry could not be started +280 Data lost +281 Invalid message body length +282 Inactive socket +283 Socket already open +</pre> +<p><br /> +</p> +<a name="Solu.C3.A7.C3.A3o_de_problemas" id="Solu.C3.A7.C3.A3o_de_problemas"></a><h1> <span class="mw-headline"> Solução de problemas </span></h1> +<p>Nesta seção, erros e suas soluções mais comuns são apresentados. +</p> +<a name="Erro_durante_a_instala.C3.A7.C3.A3o_do_m.C3.B3dulo_de_kernel" id="Erro_durante_a_instala.C3.A7.C3.A3o_do_m.C3.B3dulo_de_kernel"></a><h2> <span class="mw-headline"> Erro durante a instalação do módulo de kernel </span></h2> +<p>Durante a instalação do <i>Endpoint</i> da Khomp, podem ocorrer as seguintes mensagens: +<!-- NEED 3 --> +</p> +<pre>K3L: WARNING: Unable to find a module for [...] +</pre> +<p>ou +<!-- NEED 8 --> +</p> +<pre>install: ****** THE KERNEL MODULE HAS NOT BEEN INSTALLED: ******* +install: +install: ** Please, untar the file kpdriver*.tar.gz located in: ** +install: ** '/usr/src/khomp/' ** +install: ** then check the README.txt ** +install: ** for knowing how to proceed with the installation. ** +</pre> +<p>Neste caso, será necessário compilar os <i>drivers</i> manualmente para o seu sistema. Prossiga para o item abaixo para maiores informações. +<br /> +</p> +<a name="Compilandos_os_drivers_e_iniciando_os_servi.C3.A7os" id="Compilandos_os_drivers_e_iniciando_os_servi.C3.A7os"></a><h3> <span class="mw-headline">Compilandos os <i>drivers</i> e iniciando os serviços </span></h3> +<p>Basta seguir ao diretório <b>/usr/src/khomp</b>, descompactar o arquivo "kpdriver_2.0.0<b>XX</b>.tar.gz", e acompanhar procedimentos descritos no arquivo <b>README.txt</b>. +</p><p>Após realizar a compilação e a instalação do módulo, basta carregá-lo no sistema, configurar as placas, e iniciar o servidor de processos da Khomp. +</p><p>Para carregar o driver de kernel, é necessário executar o seguinte comando: +<!-- NEED 3 --> +</p> +<pre># /etc/init.d/khompdrv start +</pre> +<p>Para configurar as placas, por sua vez, necessário executar o comando: +<!-- NEED 3 --> +</p> +<pre># khompwizard +</pre> +<p>Isto executará um assistente de configuração, que irá perguntar a sinalização utilizada no sistema, bem como outros parâmetros de utilização das placas. +</p><p>Caso seja necessário configurar outros parâmetros adicionais, pode-se utilizar o seguinte comando: +<!-- NEED 3 --> +</p> +<pre># k3lconfig +</pre> +<p>Este configurador, por sua vez, mostra todas as opções possíveis de configuração da placa. Os parâmetros que não forem configurados assumem os valores padrão automaticamente, e são compatíveis com a maior parte dos sistemas. Maiores detalhes sobre este programa podem ser obtidos na seção de número '2'. +</p><p><br /> +</p> +<ul><li> <b>IMPORTANTE</b>: Para o FreeSWITCH iniciar, é preciso que a placa da khomp esteja configurada e todos módulos estejam rodando (conforme mostrado acima). <b>Caso a placa não esteja configurada, o FreeSWITCH não iniciará</b>.<br /><br />Se você deseja rodar o sistema sem a placa da Khomp, é preciso configurar o FreeSWITCH para ele não carregar o módulo da Khomp. Para isso, abra o arquivo "<i>/usr/local/freeswitch/conf/autoload_configs/modules.conf.xml</i>", e comente a linha que carrega o módulo:<br /> +</li></ul> +<pre> + <!-- <load module="mod_khomp" /> --> +</pre><br /> +<p>Quando a placa da Khomp estiver devidamente configurada e os módulos da khomp carregados (explicado acima), lembre-se de descomentar esta linha no arquivo. +</p><p><br /> +Por fim, para carregar o servidor de processos, basta executar o seguinte comando: +<!-- NEED 3 --> +</p> +<pre># kserver start +</pre> +<p>Após realizar estes procedimentos, o Endpoint já estará operacional, e o FreeSWITCH já pode ser carregado. +<br /> +</p> +<a name="Configurando_par.C3.A2metros_especiais_de_sinaliza.C3.A7.C3.A3o_ou_.C3.A1udio" id="Configurando_par.C3.A2metros_especiais_de_sinaliza.C3.A7.C3.A3o_ou_.C3.A1udio"></a><h2> <span class="mw-headline">Configurando parâmetros especiais de sinalização ou áudio </span></h2> +<p>Para configurar parâmetros especiais de sincronismo e/ou sinalização, é possível utilizar o programa "k3lconfig": basta selecionar a placa desejada, e as opções das placas serão apresentadas, divididas em seções e subseções para facilitar o acesso. Não é necessário efetuar a configuração de todos os parâmetros: os valores padrão são assumidos, caso não sejam configurados. +</p><p>Para ajustar a sinalização do link, basta - depois de selecionar a placa - entrar na seção "Opções de sinalização", e em seguida, em "Sinalização da linha". Para escolher uma sinalização específica, basta utilizar as teclas de direcionamento (setas) até selecioná-la, pressionar 'espaço', e confirmar a opção pressionando 'Enter' sobre o botão "Confirmar". +</p><p>Por fim, para salvar as configurações modificadas, basta sair do programa: ele irá mostrar uma janela, com opções para salvar ou não as alterações realizadas. +</p><p>É importante notar que <b>não é necessário alterar/ativar as seguintes opções</b>: +</p> +<ul><li> Cancelamento de eco automático; +</li><li> Supressão de DTMFs automática; +</li><li> Controle de ganho (AGC) automático. +</li></ul> +<p>Estas opções <b>são controladas pelo Endpoint</b>, e devem estar <b>desabilitadas</b> no 'k3lconfig'. +<br /> +</p> +<a name="Inicializa.C3.A7.C3.A3o_autom.C3.A1tica_dos_servi.C3.A7os_e_m.C3.B3dulos_de_kernel" id="Inicializa.C3.A7.C3.A3o_autom.C3.A1tica_dos_servi.C3.A7os_e_m.C3.B3dulos_de_kernel"></a><h2> <span class="mw-headline">Inicialização automática dos serviços e módulos de <i>kernel</i> </span></h2> +<p>Se a carga dos módulos de <i>kernel</i> ou a inicialização dos serviços da Khomp não for realizada automaticamente na inicialização do sistema, é possível realizar esta instalação manualmente, criando um <i>link</i> para os <i>scripts</i> <b>/etc/init.d/khompdrv</b> e <b>/etc/init.d/kserver</b> no diretório de inicialização do sistema. +</p><p>Na caso da distribuição <b>Debian</b>, o <i>script</i> de carga dos módulos de <i>kernel</i> seria <i>linkado</i> dentro do diretório <i>/etc/rcS.d/</i>, enquanto o <i>script</i> de inicialização dos serviços seria <i>linkado</i> dentro dos diretórios <i>/etc/rc2.d</i>, <i>/etc/rc3.d</i>, <i>/etc/rc4.d</i>, <i>/etc/rc5.d</i>, da seguinte forma: +</p><p><!-- NEED 6 --> +</p> +<pre># ln -s /etc/init.d/khompdrv /etc/rcS.d/S19khompdrv +# ln -s /etc/init.d/kserver /etc/rc2.d/S20kserver +# ln -s /etc/init.d/kserver /etc/rc3.d/S20kserver +# ln -s /etc/init.d/kserver /etc/rc4.d/S20kserver +# ln -s /etc/init.d/kserver /etc/rc5.d/S20kserver +</pre> +<p>É interessante verificar as normas da sua distribuição para inicializar os serviços de acordo com o que é esperado pela inicialização da mesma. +<br /> +</p> +<a name="Ap.C3.AAndice" id="Ap.C3.AAndice"></a><h1> <span class="mw-headline"> Apêndice </span></h1> +<p>Nesta seção, encontram-se informações úteis sobre o Endpoint e componentes relacionados. +</p> +<a name="Disposi.C3.A7.C3.A3o_dos_arquivos" id="Disposi.C3.A7.C3.A3o_dos_arquivos"></a><h2> <span class="mw-headline"> Disposição dos arquivos </span></h2> +<p>Os diretórios criados/modificados nesta instalação são: +<!-- NEED 20 --> +</p> +<pre>/etc/init.d/ -- Scripts de inicialização; + +/etc/khomp/ -- Arquivos de firmware e configurações; + +/usr/local/freeswitch/conf/ -- Configurações do FreeSWITCH e Endpoint; + +/usr/doc/khomp/ -- Documentação das placas, do mod_khomp e dos utilitários; + +/usr/sbin/ -- Utilitários e servidor de processos; + +/usr/lib/ -- Bibliotecas compartilhadas da K3L; + +/usr/local/freeswitch/mod/ -- Módulo 'mod_khomp.so'; + +/var/log/khomp2.1/ -- Diretório de logs da K3L e Endpoint +</pre> +<p><br /> +O <i>script</i> <b>/etc/init.d/khompdrv</b> é responsável por carregar os módulos <i>kpci9030.ko</i> e <i>kpex8311.ko</i> no <i>kernel</i>, que deve ser realizada automaticamente na inicialização do sistema. Em caso de problemas, verifique a seção <a href="#Solu.C3.A7.C3.A3o_de_problemas" title="">Solução de problemas</a>. +<br /> +</p><p><br /> +</p></body></html> \ No newline at end of file diff --git a/src/mod/endpoints/mod_khomp/docs/Manual.pdf b/src/mod/endpoints/mod_khomp/docs/Manual.pdf new file mode 100644 index 0000000..ea29f71 Binary files /dev/null and b/src/mod/endpoints/mod_khomp/docs/Manual.pdf differ diff --git a/src/mod/endpoints/mod_khomp/docs/README.html b/src/mod/endpoints/mod_khomp/docs/README.html new file mode 100644 index 0000000..e4cae5a --- /dev/null +++ b/src/mod/endpoints/mod_khomp/docs/README.html @@ -0,0 +1,39 @@ +<html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Mod Khomp: README</title></head><body><a name="Guia_R.C3.A1pido" id="Guia_R.C3.A1pido"></a><h1> <span class="mw-headline"> Guia Rápido </span></h1> +<p>Depois de instalar a placa no sistema, e executar o programa de instalação pela primeira vez, os <i>drivers</i> e serviços da Khomp serão adicionados na inicialização do sistema, e automaticamente carregados. +</p><p>Se o sistema possuir pelo menos uma placa de tronco E1 e/ou uma placa FXO, uma tela de configuração básica deverá ser apresentada ao final do processo, questionando parâmetros de sinalização - no caso de existirem placas E1 - e/ou realizando o ajuste de cadências - no caso de existirem placas FXO. +</p><p>Se todas estas etapas foram executadas com sucesso, prossiga para o item <b>Utilizando o <i>Endpoint</i> da Khomp</b>. Caso algum problema ocorra, consulte o <a href=".htmlMod_Khomp/Manual" title="Mod Khomp/Manual">Manual do Endpoint</a>, seguindo para a seção de <a href=".htmlMod_Khomp/Manual#Solu.C3.A7.C3.A3o_de_problemas" title="Mod Khomp/Manual">Solução de problemas</a>. +</p> +<a name="Utilizando_o_Endpoint_da_Khomp" id="Utilizando_o_Endpoint_da_Khomp"></a><h1> <span class="mw-headline"> Utilizando o <i>Endpoint</i> da Khomp </span></h1> +<p>Após a instalação e inicialização dos serviços necessários pela Khomp, o FreeSWITCH já pode ser carregado ou inicializado. +</p> +<ul><li> <b>AVISO</b>: É imprescindível que o <b>FreeSWITCH</b> não seja executado utilizando a opção que desabilita o escalonamento em tempo real (-nort), <b>especialmente</b> se este estiver sendo executado lado-a-lado com servidores <i>web</i> ou servidores de banco de dados. Não realizar este procedimento pode resultar em perda de qualidade do áudio, gerando um sério comprometimento no andamento das ligações do sistema. +</li></ul> +<p>Após a inicialização do FreeSWITCH, pode-se verificar se o módulo da Khomp foi carregado através do seguinte comando:<br /> +</p> +<pre> freeswitch@hostname> module_exists mod_khomp +</pre> +<p>A próxima linha deverá responder algo tipo: +</p> +<pre> true +</pre> +<p>Para verificar se o FreeSWITCH reconheceu todas as placas, digite: +</p> +<pre> freeswitch@hostname> khomp summary +</pre> +<p>A saída desse comando mostrará detalhes de todas placas reconhecidas. +</p><p>No caso de uma placa de tronco E1, pode-se verificar o estado dos links com o seguinte comando: +</p> +<pre> freeswitch@hostname> khomp show links +</pre> +<p>O estado dos canais individuais, por sua vez, pode ser aferido com o comando: +</p> +<pre> freeswitch@hostname> khomp show channels +</pre> +<p>Para mais detalhes sobre os comandos do Endpoint da khomp digite no console do FreeSWITCH: +</p> +<pre> freeswitch@hostname> help khomp +</pre> +<ul><li> <b>IMPORTANTE</b>: Para fazer completo uso da sua placa Khomp, será preciso configurar suas regras de discagem, seja através do arquivo <i>default.xml</i> ou de um aplicativo externo, definindo regras específicas para realizar ao receber ligações.<br /><br />No <a href=".htmlMod_Khomp/Manual" title="Mod Khomp/Manual">Manual do Endpoint</a>, podem ser encontradas informações sobre o formato dos contextos de entrada (responsáveis por receber as ligações) e sobre as opções disponíveis no application Bridge (responsável por realizar ligações) que podem ser utilizadas com o Endpoint da Khomp, além de outras funcionalidades especiais providas pelo mesmo. +</li></ul> +<p><br /> +</p></body></html> \ No newline at end of file diff --git a/src/mod/endpoints/mod_khomp/docs/README.pdf b/src/mod/endpoints/mod_khomp/docs/README.pdf new file mode 100644 index 0000000..698ab83 Binary files /dev/null and b/src/mod/endpoints/mod_khomp/docs/README.pdf differ diff --git a/src/mod/endpoints/mod_khomp/docs/README_en.html b/src/mod/endpoints/mod_khomp/docs/README_en.html new file mode 100644 index 0000000..5d44b82 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/docs/README_en.html @@ -0,0 +1,40 @@ +<html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Mod Khomp: README: en</title></head><body><a name="Quick_guide" id="Quick_guide"></a><h1> <span class="mw-headline"> Quick guide </span></h1> +<p>After installing the card in the system and run the installation program for the first time, the <i>drivers</i> and Khomp services will be added at system startup, and automatically loaded. +</p><p>If your system has at least one E1 trunk card and / or an FXO card, a basic setup screen will be presented at the end of the process, questioning signaling parameters - if there are signs E1 - and/or performing the adjustment cadences - where that FXO cards. +</p><p>If all these steps were performed successfully, proceed to the item <b>Using Khomp Endpoint</b>. If a problem occurs, see the <a href=".htmlMod_Khomp/User_Guide" title="Mod Khomp/User Guide">User Guide</a>, in the section <a href=".htmlMod_Khomp/User_Guide#Troubleshooting" title="Mod Khomp/User Guide">Troubleshooting</a>. +</p> +<a name="Using_the_Khomp_Endpoint" id="Using_the_Khomp_Endpoint"></a><h1> <span class="mw-headline"> Using the Khomp Endpoint </span></h1> +<p>After installation and startup services required by Khomp, FreeSWITCH can now be loaded or initialized. +</p> +<ul><li><b>WARNING</b>: It is imperative that the<b>FreeSWITCH</b> is not executed using the option that disables the escalation in real time (-nort), <b>especially</b> if this is running side-by server-side with web servers or database. Failure to do so may result in loss of audio quality, causing a serious commitment on the progress of system connections. +</li></ul> +<p>After initialization of FreeSWITCH, you can verify that the module was loaded Khomp through the following command: <br /> +</p><p><br /> +</p> +<pre> freeswitch@hostname> module_exists mod_khomp +</pre> +<p>The next line should answer something like: +</p> +<pre> true +</pre> +<p>To verify that the FreeSwitch recognize all the cards, type: +</p> +<pre> freeswitch@hostname> khomp summary +</pre> +<p>The output of this command will show details of all cards accepted. +</p><p>In the case of an E1 card, you can check the status of links with the following command: +</p> +<pre> freeswitch@hostname> khomp show links +</pre> +<p>The state of individual channels, in turn, can be measured with the command: +</p> +<pre> freeswitch@hostname> khomp show channels +</pre> +<p>For more details on the commands of the Endpoint khomp type in the console of FreeSWITCH: +</p> +<pre> freeswitch@hostname> help khomp +</pre> +<ul><li><b>IMPORTANT</b>: To make full use of your card Khomp, you must configure your dialing rules, either through the extension.conf or from an external application by setting specific rules for conduct by receiving connections. <br /> In the <a href=".htmlMod_Khomp/User_Guide" title="Mod Khomp/User Guide">User Guide</a>, information can be found on the format of input contexts (responsible for receiving calls) and on the options available on application Dial (responsible for make calls) that can be used with the Endpoint Khomp, and other special features provided by it. +</li></ul> +<p><br /> +</p></body></html> \ No newline at end of file diff --git a/src/mod/endpoints/mod_khomp/docs/README_en.pdf b/src/mod/endpoints/mod_khomp/docs/README_en.pdf new file mode 100644 index 0000000..e36d6f1 Binary files /dev/null and b/src/mod/endpoints/mod_khomp/docs/README_en.pdf differ diff --git a/src/mod/endpoints/mod_khomp/docs/User_Guide.html b/src/mod/endpoints/mod_khomp/docs/User_Guide.html new file mode 100644 index 0000000..1a276b9 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/docs/User_Guide.html @@ -0,0 +1,1099 @@ +<html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Mod Khomp: User Guide</title></head><body> +<a name="First_considerations" id="First_considerations"></a><h1> <span class="mw-headline"> First considerations </span></h1> +<p>This document covers information about the <i>Endpoint</i> of Khomp as a whole, include the options, <i>applications</i>, <b>CLI</b> commands, among others. +</p><p>For first installation procedures, please see the <a href=".htmlMod_Khomp/README/en" title="Mod Khomp/README/en">README</a>. +<br /> +</p> +<a name="Configuration" id="Configuration"></a><h1> <span class="mw-headline"> Configuration </span></h1> +<p>Configuring the Khomp Endpoint is a task that consists of three steps: +</p> +<ul><li> Configuration of the boards through the K3L; +</li><li> Setting up the Endpoint; +</li><li> Setting up the FreeSWITCH. +</li></ul> +<p>These steps are described more fully below. +<br /> +</p> +<a name="K3L_API_Configuration" id="K3L_API_Configuration"></a><h2> <span class="mw-headline"> K3L API Configuration </span></h2> +<p>This step is carried out in a semi-automated way using the <b>khompwizard</b> program, a wizard that configures the basic parameters of the system boards. This wizard initializes the configuration files using information from the user when they are needed, initializing the standard settings to default values. +</p><p>Typically, this program runs automatically after installation of the system. However, you may need to run it manually if an update is being performed, or if new cards were added to the system after installing new drivers. +</p><p><br /> +If you need to set advanced parameters of the board and/or signaling, the program <b>k3lconfig</b> allows you to access all the available settings for each installed card. For more information about this program, check the <b><a href="http://169.254.1.3/kdevwiki/wikidocs/index.php?title=K3lconfig_-_User%27s_Guide&action=edit&redlink=1" class="new" title="K3lconfig - User's Guide (página não existe)">k3lconfig User's Guide</a></b>. For solving synchronization issues, check the <a href="#_Troubleshooting" title="">Troubleshooting</a> section for manual configuration of the boards. +<br /> +</p> +<a name="Endpoint_Configuration" id="Endpoint_Configuration"></a><h2> <span class="mw-headline"> Endpoint Configuration </span></h2> +<p>The system's default configuration normally meet most user's needs. However, the configuration of the Endpoint Khomp can be modified through the configuration file '<b>/usr/local/freeswitch/conf/autoload_configs/khomp.conf.xml'</b>. +</p><p>The list of options is as follows: +</p> +<a name=".3Cchannels.3E" id=".3Cchannels.3E"></a><h4> <span class="mw-headline"> <channels> </span></h4> +<p>Define general settings of all channels of Khomp: +</p> +<pre><b>Sintaxe:</b> <param name="..." value="..."/> +</pre> +<ul><li><b>auto-fax-adjustment</b>: Enable ("yes") or disables ("no") the automatic adjustment of the channel (disable the echo canceller and the suppression DTMF) tone to detect FAX (local option) ; +</li><li><b>auto-gain-control</b>:Enable ("yes") or disables ("no") the activation of the automatic gain control (AGC) by the Endpoint (local option); +</li><li><b>context-digital</b>: Context for incoming connections on digital boards (the default is "khomp-DD-LL", where "DD" will be replaced at the time of connection by the device number, "LL" by the number of the link, "CCC" by channel number and "SSSS" for the device serial number); +</li><li><b>context-fxo</b>: Context for incoming connections on FXO cards (the default is "khomp-CC-DD", where "DD" will be replaced at the time of connection by the device number, "CC" by channel number, and "SSSS" by the device serial number); +</li><li><b>context-fxo-alt</b>: Alternative input context for FXO cards (the default is empty - when set, follows the same substitution rules for <b>context-fxo</b>); +</li><li><b>context-fxs</b>: Context for incoming connections on FXS cards (the default is "khomp-CC-DD", where "DD" will be replaced at the time of connection by the device number, "CC" by channel number, and "SSSS" by the device serial number); +</li><li><b>context-fxs-alt</b>: Alternative input context for FXS cards (the default is empty - when set, follows the same substitution rules for context-fxs); number); +</li><li><b>context-gsm-call</b> (or <b>context-gsm</b>): Context of entry for GSM boards (the default is "khomp-CC-DD", where "DD" will be replaced at the time of connection by the device number, "CC" by channel number, and "SSSS" by the device serial number); +</li><li><b>context-gsm-alt-call</b> (or <b>context-gsm-alt</b>): Alternative input context for GSM (the default is zero - when set, follows the same substitution rules for <b>context-gsm-call</b>); +</li><li><b>context-gsm-sms</b>: Context for incoming SMSs (the default is "khomp-sms-CC-DD", where "DD" will be replaced by the number of device, "CC" by channel number and "SSSS" by the device's serial number); +</li><li><b>context-gsm-wait</b>: Context used for pre-processing of incoming GSM calls that are on waiting state - to disable this feature, use <b>none</b> (the default is "khomp-wait-CC-DD", where "DD" will be replaced by the number of device, "CC" by channel number and "SSSS" by the device's serial number); +</li><li><b>context-pr</b>: Context for incoming connections on boards KPR (default is "khomp-CC-DD", where "DD" will be replaced at the time of connection by the device number, "CC "by channel number); +</li><li><b>disconnect-delay</b>: Sets the time in milliseconds to perform processing a disconnect event, to ignore situations where other equipment performing the double service to overthrow collect calls (local option); +</li><li><b>echo-canceller</b> (former 'echocanceller): Active ("yes") or disables ("no") echo cancellation automatic Endpoint (local option); +</li><li><b>fxo-send-pre-audio</b>: When enabled ("yes") releases audio channel before the outgoing call connection boards KFXO (the default value is "yes"); +</li><li><b>fxs-global-orig</b>: Start number for sequencial branch numbering in FXS cards that are not listed in the <b>[fxs-branches]</b> section (the numbering follows ascending order from board number and physical channel number) (default is "0"); +</li><li><b>fxs-co-dialtone</b>: Sequences of numbers, separated by commas, which fires a continuous tone (of central office) in FXS branches (eg: "0,99" means that, when you dial "0" or "99", the user will hear a continuous dial tone) (default is empty); +</li><li><b>fxs-bina</b>: When enabled ("yes"), calls to FXS lines will send digits corresponding to the source phone identification using BINA DTMF signaling (the default value is "no") (local option); +</li><li><b>input-volume</b>: Sets the volume gain for incoming audio (entering the board), from -10 to +10 (local option); +</li><li><b>kommuter-activation</b>: Sets whether to activate devices kommuter found in the system will be done automatically ("auto") by the channel, or manually ("manual") by the user through the command "khomp kommuter on/off" +</li><li><b>kommuter-timeout</b>: Sets the timeout (in seconds) for initializing the kommuter devices. If this timeout is reached without receiving notification of the channel, the devices will switch back to "off" condition. The minimum value is "0", where the links will always remain switched "on", and the maximum is "255"; +</li><li><b>language</b>: Set language to Khomp channel calls (local option); +</li><li><b>log-to-console</b>: Set log messages to be printed on the console; +</li><li><b>log-to-disk</b> (old "log"): Set log messages to be saved to disk; +</li><li><b>out-of-band-DTMF</b> (former <b>dtmfsuppression</b>): Activate ("yes") or disables ("no") the removal and DTMF sending these out-of-band (local option); +</li><li><b>output-volume</b>: Define o volume de saída das ligações, varia de -10 a +10 ; +</li><li><b>pulse-forwarding</b> (former 'pulsedetection): Active ("yes") or disables ("no") for the detection of pulses and converting them into DTMF (local option); +</li><li><b>r2-preconnect-wait</b> (former 'r2preconnectwait): Sets the timeout sending the ringback signaling, protocol R2/MFC to start sending audio silence. Only used when "r2-strict-Behavior" is set to "no" (local option); +</li><li><b>r2-strict-Behaviour</b>: Enable ("yes") or disables ("no") the behavior of signaling R2/MFC as the standard sets. The default is "no", and can be changed to "yes" if needed to receive / send data precise signaling protocol (condition B, for example) (local option); +</li><li><b>ringback-delay-co</b>: Sets the delay to enable the generation of call control tone (ringback) by the Endpoint Khomp when there is an ringback indication from signaling and there is no audio being sent by the channel which indicated the situation (local option); +</li><li><b>ringback-delay-pbx</b>: Sets the delay to enable the generation of call control tone (ringback) by the Endpoint Khomp when there is an ringback indication, and the audio has no tone (silence) (local option); +</li><li><b>suppression-delay</b> (former <b>suppressiondelay</b>): Activate ("yes") or disables ("no") the delay necessary to suppress DTMF. If disabled ("no"), also disables suppression of DTMF (local option); +</li><li><b>trace</b>: Set debugging options. Should not be used in production unless absolutely necessary; +</li><li><b>user-transfer-digits</b>: Defines a sequence of DTMF digits to initiate the transfer between FreeSWITCH® and another PBX (using user signaling, like QSig or FXO FLASH). +</li></ul> +<p><br /> +</p> +<a name=".3Cgroups.3E" id=".3Cgroups.3E"></a><h4> <span class="mw-headline"> <groups> </span></h4> +<p>Defines the groups to be used in channel allocation. +</p><p>In this case, the options are used to define names for <i>strings allocation of channels</i>. The format follows the standard <b><group name> = <allocation string></b>, where the <b>allocation string</b> is the same string used in the bridge application, and <b>group name</b> is an arbitrary name chosen by the user. +</p> +<dl><dd>For example, to define the group <b>pstn</b> as the channels 0 and 5 of the board 0, the following line could be used: +</dd></dl> +<pre><param name="pstn" value="b0c0 + b0c5"/> +</pre> +<p>This group, in turn, could be used in the <i>bridge application</i> as <b><action application="bridge" data="Khomp/Gpstn/..."/></b>. +</p> +<dl><dd>You can associate a given input context to a channel group, simply specify a name of context string after the allocation, separated by ':'. +</dd></dl> +<p>For example, to define the same group <b>pstn</b> as channels 0 to 20 of card 0, and defining the incoming context to for channels in this groups to <b>from-pstn</b>, one could use the line: +</p> +<pre><param name="pstn" value="b0c0-20:from-pstn"/> +</pre> +<p>This group would be used the same way as before in the <i>bridge application</i>, and all the calls coming from these channels would be treated in context <b>from-pstn</b>. +<br /> +</p> +<a name=".3Ccadences.3E" id=".3Ccadences.3E"></a><h4> <span class="mw-headline"> <cadences> </span></h4> +<p>Defines settings for the Endpoint cadences. +</p><p>In this case, the options are names cadences, followed by one or two pairs of numbers - that define the ranges of tone and silence to be used in cadences. +For details, please refer to the configuration file for examples. +<br /> +</p> +<a name=".3Cfxs-branches.3E" id=".3Cfxs-branches.3E"></a><h4> <span class="mw-headline"> <fxs-branches> </span></h4> +<p>Defines source numbers for the board KFXS. +</p><p>In this case, the options are sequences of prefixes of branches and serial numbers of the boards, which define the basic numbers of source addresses, and the numerical order of the boards. The format of the options is: +</p> +<pre><param name="prefixo" value="serial1, serial2, ...."/> +</pre> +<p>For example, if two <b>KFXS-300 SPX</b> boards with serial numbers <b>K0374</b> and <b>K2352</b> must be numbered sequentially, starting from branch 200, you may write: +</p> +<pre><param name="200" value="374, 2352"/> +</pre> +<p>This will define the first branch of board '<i>K0374</i> as number 200, the second as 201, and so one. The first branch from board K2352 will have number 230 (as K0374 has 30 channels), the second will be numbered 231, and so on - until the last channel, numbered 259. +</p><p>For more details, please refer to the configuration file for other exemples. +<br /> +</p> +<a name=".3Cfxs-hotlines.3E" id=".3Cfxs-hotlines.3E"></a><h4> <span class="mw-headline"> <fxs-hotlines> </span></h4> +<p>Sets hotlines for the KFXS based boards +</p><p>In this case, the options are sequences of branches and sequences of destination numbers, which define branches to be treated as "hotlines" and numbers to be dialed when they are take off hook. For instance: +</p> +<pre><param name="100" value="1234"/> +<param name="200" value="4321"/> +</pre> +<p>In the first line, the branch numbered 100 will call extension 1234 when taken off hook, while in the second one, branch 200 will call number 4321 when taken off hook. +<br /> +</p> +<a name=".3Cfxs-options.3E" id=".3Cfxs-options.3E"></a><h4> <span class="mw-headline"> <fxs-options> </span></h4> +<p>Allows you to set specific settings for FXS extension. +</p><p>In this case, the settings are extension numbers (based on those defined in the <b><fxs-branches></b>), and the options and their values. +</p> +<ul><li>context; +</li><li>input-volume; +</li><li>output-volume; +</li><li>accountcode; +</li><li>calleridnum; +</li><li>calleridname; +</li><li>mailbox. +</li></ul> +<p>Each option is separated from each other by a pipe "|" or a slash "/" and defined after the colon ":". Example: +</p> +<pre><param name="200" value="language:en|context:master-branch" /> +</pre> +<p>For more information on the syntax and examples, please refer to the configuration file. +</p><p>For more information visit the configuration file '<b>khomp.conf.xml'</b>. +<br /> +</p> +<a name="FreeSWITCH_Configuration" id="FreeSWITCH_Configuration"></a><h2> <span class="mw-headline"> FreeSWITCH Configuration </span></h2> +<p>When connections are received on the boards and devices Khomp, they are forwarded by the <i>Endpoint</i> to specific contexts within the dialplan of FreeSWITCH®. These settings can be changed via the configuration file <b>khomp.conf.xml</b>, available on the FreeSWITCH configuration directory (by default, "<b>/usr/local/freeswitch/conf/autoload_configs</b>"). +</p><p>For details about the specific contexts, see section <a href="#Endpoint_Configuration" title="">Endpoint configuration</a>. +</p><p>Below are details of how to configure the settings for incoming calls +<br /> +</p><p><br /> +</p> +<a name="Contexts_for_E1_channels" id="Contexts_for_E1_channels"></a><h3> <span class="mw-headline"> Contexts for E1 channels </span></h3> +<p>For E1 boards, inbound contexts are predefined as option <b>context-digital</b> with default value as following: +</p> +<pre><param name="context-digital" value="khomp-DD-LL"/> +</pre> +<p>This standard defines the context that links will be redirected in accordance with the number of the board and number of the link: <b>DD</b> is the device number (two digits), and <b>LL</b> is the number of the link (also with two digits). +</p><p>However, it is possible to configure other inbound contexts, with different formats. There is format <b>CCC</b>, which means the channel number on the card (three digits), and <b>SSSS</b>, which represents the serial board number (with four digits). +</p><p>Examples for configuration entries (<b>khomp.conf.xml</b>): +</p> +<pre><!-- Serial board number and sequential link (ex: khomp-01-00) --> +<param name="context-digital" value="khomp-DD-LL"/> +</pre> +<pre><!-- Serial board number and sequential link (ex: khomp-3049-00) --> +<param name="context-digital" value="khomp-SSSS-LL"/> +</pre> +<pre><!-- Sequential board number and the channel (ex: khomp-00-001) --> +<param name="context-digital" value="khomp-DD-CCC"/> +</pre> +<pre><!-- Receive all calls in one context (khomp-digital) --> +<param name="context-digital" value="khomp-digital"/> +</pre> +<p>Follows an example the context usage inside the dialplan: +<!-- NEED 6 --> +</p> +<pre><!-- +The present context in 'extensions.conf' will handle calls +that come from the link 0 (first link) of the board 0. +--> +<context name="khomp-00-00"> + . + . + . +</context> +</pre> +<p>Another example, using the same format: +<!-- NEED 6 --> +</p> +<pre><!-- +The present context in 'extensions.conf' will handle calls +that come from the link 1 (second link) of the board 0. +--> +<context name="khomp-00-01> + . + . + . +</context> +</pre> +<p>A complete example, with a few simple actions: +<!-- NEED 10 --> +</p> +<pre><context name="khomp-00-00"> + <extension name="exemplo_1"> + <condition field="destination_number" expression="^1234$"> + <action application="bridge" data="Khomp/b0L1/2345"/> + </condition> + </extension> + <extension name="exemplo_2"> + <condition field="destination_number" expression="^23(\d{2})$"> + <action application="bridge" data="sofia/${use_profile}/11$1@${sip_from_host}"/> + </condition> + </extension> +</context> +</pre> +<pre><context name="khomp-00-01"> + <extension name="exemplo_3"> + <condition field="destination_number" expression="^1111$"> + <action application="bridge" data="Khomp/b0L0/2345"/> + </condition> + </extension> +</context> +</pre> +<p>This dialplan defines that: +</p> +<ol><li> The incoming calls on the link <b>0</b> of the board <b>0</b> will have the following handling: +<ul><li> Calls to the extension 1234 for will be redirected to the second link on the first board (b0L1), calling number <b>2345</b>; +</li><li> Calls to any four digit number starting with<b>23</b> will be redirected to SIP phones numbered <b>11</b> plus the last two digits of the number dialed. +</li></ul> +</li><li> The incoming calls on the link <b>1</b> of the board <b>0</b> for the number <b>1111</b> will be redirected to the first link of the first board (b0L0) calling number <b>2345</b>. +</li></ol> +<a name="Contexts_of_FXS.2FFXO.2FGSM_channels" id="Contexts_of_FXS.2FFXO.2FGSM_channels"></a><h3> <span class="mw-headline"> Contexts of FXS/FXO/GSM channels </span></h3> +<p>Just as in the context of E1 cards, inbound links are forwarded to the Endpoint FreeSwitch. However, these signals have two pre-defined contexts, sought with a preference order. +</p><p>The first context is pre-defined as follows, according to the file <b>khomp.conf.xml</b>: +</p> +<pre><param name="context-gsm" value="khomp-DD-CC"/> ;placas GSM +</pre> +<pre><param name="context-fxs" value="khomp-DD-CC"/> ; placas FXS +</pre> +<pre><param name="context-fxo" value="khomp-DD-CC"/> ; placas FXO +</pre> +<p>There is also an alternative context, which has the following default value: +</p> +<pre><param name="context-gsm-alt" value="khomp-DD"/> ; placas GSM +</pre> +<pre><param name="context-fxs-alt" value="khomp-DD"/> ; placas FXS +</pre> +<pre><param name="context-fxo-alt" value="khomp-DD"/> ; placas FXO +</pre> +<p>For these options, <b>DD</b> is the device number (two digits), and <b>CC</b> is the channel number (also two digits). There is also the <b>SSSS</b> format, which represents the serial number board. +</p> +<ul><li><b>NOTE</b>: In the <b>KGSM</b> board, incoming calls are <b>always</b> redirected to the <b>"s"</b> extension, since the GSM protocol does not identify the target number, only the originator - if not omitted. +</li></ul> +<a name="Priority_settings_on_the_FXS_branches" id="Priority_settings_on_the_FXS_branches"></a><h4> <span class="mw-headline"> Priority settings on the FXS branches </span></h4> +<p>On calls originated from an FXS branch, the Endpoint searches for a valid extension in three different contexts. The priority of contexts is as follows: +</p> +<ol><li> Branch-specific extension, defined in section <b><fxs-options></b> of file <b>khomp.conf.xml</b>; +</li><li> Context defined in <b>context-fxs</b>; +</li><li> Context defined in <b>context-fxs-alt</b>. +</li></ol> +<p>If no valid extension can be found, the extension <b>i</b> is searched in the contexts above, and also in the <b>default</b> context. If the dialing timeout is reached (option <b>fxs-digit-timeout</b>), the search will consider all digits dialed until the timeout; if no extension is found, it will search extension "t"; if nothing is found again, then extension "i" will be searched; if no extension is found, "fast-busy" cadence will be played. +<br /> +</p> +<a name="Contexts_for_SMS_messages_.28GSM_only.29" id="Contexts_for_SMS_messages_.28GSM_only.29"></a><h3> <span class="mw-headline"> Contexts for SMS messages (GSM only) </span></h3> +<p>SMS messages are received by the Khomp <i>Endpoint</i> and forwarded to FreeSWITCH as a normal connection but no audio, which has some variables set with information received in the message - for more information on these variables, see the documentation of the variables of the <i>Endpoint</i>. This context can also be modified in the same way as the above contexts. +</p><p>The default value for this option follows (<b>khomp.conf.xml</b>): +</p> +<pre><param name="context-gsm-sms" value="khomp-sms-DD-CC"/> +</pre> +<p>Where <b>DD</b> is the device number (two digits), and <b>CC</b> is the channel number (also with two digits). For example: +</p> +<pre><context name="khomp-sms-00-01"> + <extension name="sms"> + <condition field="destination_number" expression="^s$"> + <action application="log" data="DEBUG KSmsType=${KSmsType}"/> + <action application="log" data="DEBUG KSmsBody=${KSmsBody}"/> + </condition> + </extension> +</context> +</pre> +<a name="Contexts_for_Khomp_PR_channels_.28KPR.29" id="Contexts_for_Khomp_PR_channels_.28KPR.29"></a><h3> <span class="mw-headline"> Contexts for Khomp_PR channels (KPR) </span></h3> +<p>For these cards, inbound links have a pre-defined context, as shown below: +</p> +<pre><param name="context-pr" value="khomp-DD-CC"/> +</pre> +<p>In this case, <b>DD</b> is the device number (two digits), and<b>CC</b> is the channel number (also two digits). The name and format of this context can also be changed through the "context-pr" in the configuration file. +<br /> +<br /> +</p> +<a name="Using_the_bridge_application" id="Using_the_bridge_application"></a><h3> <span class="mw-headline"> Using the <i>bridge</i> application </span></h3> +<p>The <b>bridge</b> application is responsible for generating calls from the FreeSWITCH from a dialplan. This application can be used to generate calls from different Endpoints technologies, following a specific format to define destination, dialing options and define the communication <i>Endpoint</i> to be used. +</p> +<a name="Fields_relating_to_the_Khomp_Endpoint" id="Fields_relating_to_the_Khomp_Endpoint"></a><h4> <span class="mw-headline"> Fields relating to the Khomp <i>Endpoint</i> </span></h4> +<p>When used for <b>Khomp</b> channels, the <i>bridge</i> <i>string</i> can have two, three or four fields separated by slash (/). Some example strings: +<!-- NEED 11 --> +</p> +<pre><action application="bridge" data="Khomp/B2L0/32625644"/> +<action application="bridge" data="Khomp/*B2L0/32625644"/> +<action application="bridge" data="Khomp/S0411/99991234"/> +<action application="bridge" data="Khomp/Gpstn/99991234"/> +<action application="bridge" data="Khomp/*Gpstn/99991234"/> +<action application="bridge" data="Khomp/B2C58/32625644/category=4:orig=4855553232"/> +<action application="bridge" data="Khomp/b0c9"/> +<action application="bridge" data="Khomp/b0c1+b0c14"/> +<action application="bridge" data="Khomp/r304"/> +</pre> +<p>In the first five examples, three fields have been specified; in the sixth, four fields are used; in the last three examples, just two are used. +</p><p>The fields description for the Khomp Endpoint: +</p> +<ul><li><b>1st</b> field: <b>Khomp</b>: identifying the type of <i>Endpoint</i> in question; +</li><li><b>2nd</b> field: <b>B2L0</b>, <b>S0411</b>, <b>Gpstn</b>, etc: represents the <b>Policy for channel allocation</b> (detailed below); +</li><li><b>3rd</b> field: <b>32625644</b> and <b>99991234</b>: the destination numbers (missing for calls to <b> KFXS</b> channels); +</li><li><b>4th</b> field: <b>category=4:orig=4855553232</b>: additional options, detailed below. +</li></ul> +<p>NOTE: The <i>bridge</i> allocation string with only two fields is specific to the KFXS boards, where the destination is the channel itself. +</p> +<a name="Policy_for_channel_allocation" id="Policy_for_channel_allocation"></a><h4> <span class="mw-headline"> Policy for channel allocation </span></h4> +<p>The policy for allocation of channels on the <b>Khomp</b> Endpoint can be specified in the <b>bridge</b> string itself or in the <b>groups</b> section (inside the configuration file <b>khomp.conx.conf</b>). To specify boards, links and channels, the following syntax is available (considering X, Y and Z as any numbers): +</p> +<ul><li> b<b>X</b> -- search the channels on the board <b>X</b>, ascending order; +</li><li> b<b>X</b>L<b>Y</b> -- search channel on the link <b>Y</b> from <b>X</b> board, ascending order; +</li><li> b<b>X</b>c<b>Y</b> -- try to allocate channel <b>Y</b> from board <b>X</b>; +</li><li> b<b>X</b>c<b>Y</b>-<b>Z</b> -- search for channels starting from channel <b>Y</b> to channel <b>Z</b> (inclusive) of board <b>X</b>, ascending order; +</li><li> B<b>X</b>c<b>Y</b>-<b>Z</b> -- same as above, but descending order; +</li><li> s<b>X</b> -- search the channels on the board of serial number <b>X</b>, ascending order; +</li><li> s<b>X</b>L<b>Y</b> -- search channel on the link <b>Y</b> from board of serial number <b>X</b>, ascending order; +</li><li> s<b>X</b>c<b>Y</b> -- try to allocate channel <b>Y</b> from board of serial number <b>X</b>; +</li><li> s<b>X</b>c<b>Y</b>-<b>Z</b> -- search for channels starting from channel <b>Y</b> to channel <b>Z</b> (inclusive) from board of serial number <b>X</b>, ascending order; +</li><li> S<b>X</b>c<b>Y</b>-<b>Z</b>-- same as above, but descending order. +</li></ul> +<p>To search for extensions of cards<b>KFXS</b> according to the extension number, can be used the following syntax (whereas X and Y valid extension numbers): +</p> +<ul><li> r<b>X</b>- search branch numbered <b>X</b>; +</li><li> R<b>X</b>- equivalent to the above; +</li><li> r<b>X</b>-<b>Y</b>- search from branch <b>X</b> to <b>Y</b>, ascending order; +</li><li> R<b>X</b>-<b>Y</b>- search from branch <b>X</b> to <b>Y</b>, descending order. +</li></ul> +<p>The capitalization of the letter 'B', 'S' or 'R' defines the search order of the channels: if capitalized, order is descending; otherwise, ascending. +</p><p>As for the allocation of channels across groups, the following syntax is available: +</p> +<ul><li> ggroupname - uses the string defined the group "groupname" in the configuration file (detailed in the configuration section of the Endpoint). +</li><li> Ggroupname - equivalent to the above. +</li></ul> +<a name="Grouping_channel_allocations" id="Grouping_channel_allocations"></a><h3> <span class="mw-headline"> Grouping channel allocations </span></h3> +<p>There are cases where you need to get more channels for a particular device or particular group of extensions. For this, there is an extension available in string allocation, with respect to the use of token sum (<b>+</b>) to concatenate multiple strings<i>binding</i>, as follows: +<!-- NEED 6 --> +</p> +<pre><action application="bridge" data="Khomp/B1L0+B2L0/32332933"/> +<action application="bridge" data="Khomp/*B2+B3+B4/99887766"/> +<action application="bridge" data="Khomp/S0411+B1L0/99887766"/> +<action application="bridge" data="Khomp/Gpstn1+Gpstn2/99991234"/> +<action application="bridge" data="Khomp/*gOperadora1+gOperadora2/98891234"/> +</pre> +<p>This grouping is available for the <i>application</i> <b>bridge</b> and on the specification of groups. The processing of allocation takes place from left to right - except when using cyclic channel allocation, where<b>all</b> the specified channels are scanned simultaneously. +</p> +<a name="Cyclical_and.2For_fair_allocation" id="Cyclical_and.2For_fair_allocation"></a><h4> <span class="mw-headline"> Cyclical and/or <i>fair</i> allocation </span></h4> +<p>Another way for allocation of channels is the cyclic and/or <i>fair</i> allocation, which chooses the channel that has <b>completed</b> the the lowest number of <b>outgoing</b> calls. This mode of allocation may be used by passing an asterisk (<b>*</b>) before the allocation string of channels (as can be seen in the section above, in the second and fifth examples). +</p><p>When started with an asterisk (<b>*</b>), other forms of allocation (increasing, decreasing, etc) are used to decide what channel will be allocated when there are two or more channels with less number of outgoing calls. +</p> +<ul><li><b>WARNING: The use of fair and/or cyclic is recommended <u>only</u> for analog (KFXO), branches (KFXS) and cellular interface (KGSM) boards</b>. E1 connections should allocate channels in one way (ascending/descending) from one side and the opposite on the other to avoid problems of double seizure (which may occur in R2/MFC signaling). Fair/cyclic allocation also costs more in memory and processor footprint, which tends to be a higher cost in E1 due to the higher number of channels (30 in each link).<br /><br /> For these reasons, fair/cyclic allocations should only be used on signalizations where it can represent any real difference, like equalizing the charge costs of the lines, the total usage, or the number of connections received by each branch. +</li></ul> +<a name="Available_options" id="Available_options"></a><h4> <span class="mw-headline"> Available options </span></h4> +<ul><li><b>orig</b>: Sets the originator number, <b>without changing the variable ${CALLERID(num)}</b>. That is, the option <b>orig</b> serves <b>only</b> to pass a number of different source of${origination_caller_id_number}. If FreeSWITCH has already set the variable ${origination_caller_id_number}, which is the default behavior, Endpoint automatically uses this value as a reference to the number of origin, without having to pass any additional options.<br /><br />On the boards <b>KGSM</b>, is set to <b>restricted</b>, omits the number of origin. Example:<br /> +</li></ul> +<pre> + <action application="bridge" data="Khomp/b0/99887766/orig=restricted"/> +</pre> +<ul><li><b>category</b>: When set to a numeric value, sets the category of outgoing call to this value (available only in R2/MFC signaling); +</li><li><b>uui</b>: When adjusted for a number and a string of text, separated by hash ("#"), sends a "UserToUser" to the other end before making the call - the first value will be the descriptor and the second one will be the message as the text (available only in ISDN signaling); +</li><li><b>ring_cadence</b>: When set to a cadence name (listed in the <b>[cadences]</b> section), uses this for ringing FXS channels; +</li><li><b>ring</b>: When set to two numbers separated by a dot ("."), defines the cadences to be used while ringing a FXS channel - the first time is the ringing time, and the second one, the silence time; +</li><li><b>ring_ext</b>: When set to two numbers separated by a dot ("."), defines the extended cadences to be used while ringing a FXS channel, executed after the <b>ring</b> specification - the first time +</li><li><b>usr_xfer</b>: Defines a group of DTMF digits to initiate a transfer between PBXes (using QSig or FXO FLASH, for instance); +</li><li><b>drop_on</b>: When set to "message_box", "human_answer", "answering_machine", "carrier_message", "unknown" or a list them - separated by plus sign ("+") or dot ("." ) - drops the call when detect voice mail box, human answer, answering machine messages, operator messages, or unknown answer pattern - respectively. Available in digital signals (E1 links and boards KGSM). Additionally, the information service is reported to the user in the variable<b>KCallAnswerInfo</b>; +</li><li><b>answer_info</b>: When specified (take no parameters), report answer information to the user through the variable<b>KCallAnswerInfo</b> +</li><li><b>pre</b>: When set to a string of DTMF digits, uses these to pre-allocate an output channel in an analog PABX, dial the desired number of B below. Only available for signaling analog (FXO); +</li><li><b>pre_answer</b>: When set (need no value), answers the channel before the connection is completed - allowing, for instance, DTMF tones to sent (useful for use in a <b>DISA</b>); +</li><li><b>output_volume</b>: Sets the output volume of the link (ranges from -10 to +10); +</li><li><b>input_volume</b>: Sets the volume of inbound link (ranges from -10 to +10); +</li></ul> +<p><br /> +</p> +<a name="List_of_variables" id="List_of_variables"></a><h3> <span class="mw-headline"> List of variables </span></h3> +<p>Here's a list of variables available in the Endpoint: +</p> +<ul><li><b>KDropCollectCall</b>: When set before ringing or answer an incoming call, enables ("yes") or disables ("no", default) the drop of collect calls based on signaling received from the central public, double answer, audio tone recognition (can be defined globally); +</li><li><b>KR2SendCondition</b>: When set to a numeric value, before the ringing an incoming call, adjusts the condition for this Endpoint to this value (available only on R2 signaling); +</li><li><b>KR2GotCategory</b>: Adjusted by the Endpoint when an incoming call is received, with the category number of the caller (only available on R2 signaling); +</li><li><b>KR2GotCondition *</b>: Adjusted by the Endpoint, available after returning from a call made by FreeSWITCH (<b>bridge</b> application). Has the condition of the remote end received when making the call (available only for R2 signaling); +</li><li><b>KISDNGotCause *</b>: Adjusted by the Endpoint, available after returning from a call made by FreeSWITCH (<b>bridge</b> application). Has the ISDN "cause" code received when making the call (available only for ISDN signaling); +</li><li><b>KCallAnswerInfo *</b>: Adjusted by the Endpoint, available after returning from a call made by FreeSWITCH (<b>bridge</b> application). Contains the service information identified to make the call (available only for digital signaling - E1 and GSM); +</li><li><b>KSmsDelivered</b>: Adjusted by the Endpoint when sending a SMS message with the application <b>KSendSMS</b>, saying whether the message was delivered successfully ("yes") or not ("no"); +</li><li><b>KSmsErrorCode</b>: Adjusted by the Endpoint when sending a SMS message with the application <b>KSendSMS</b>, containing the error code that happened when sending the message; +</li><li><b>KSmsErrorName</b>: Adjusted by the Endpoint when sending a SMS message with the application <b>KSendSMS</b>, contains the name of the error or "None" if there has been no error; +</li><li><b>KSmsType</b>: Adjusted for the input Endpoint in the context of SMS messages, defines the type of message received (can contain the values "message", "confirm" or "broadcast"; +</li><li><b>KSmsFrom</b>: Adjusted for the input Endpoint in the context of SMS messages, sets the number of origin of the received message (available on types" message "and" confirm "); +</li><li><b>KSmsDate</b>: Adjusted for the input Endpoint in the context of SMS messages, sets the date of sending the message (available on types "message" and "confirm"); +</li><li><b>KSmsSize</b>: Adjusted for the input Endpoint in the context of SMS messages, contains the size (in bytes) of the received message (available on types "message" and "broadcast"); +</li><li><b>KSmsMode</b>: Adjusted for the input Endpoint in the context of SMS messages, contains the encoding type of the received message (available on types "message" and "broadcast"); +</li><li><b>KSmsBody</b>: Adjusted for the input Endpoint in the context of SMS messages, contains the text of the received message (available in types "message" and "broadcast"); +</li><li><b>KSmsDelivery</b>: Adjusted for the input Endpoint in the context of SMS messages, containing the date of delivery of the message sent earlier (available in type "confirm"); +</li><li><b>KSmsStatus</b>: Adjusted for the input Endpoint in the context of SMS messages, contains the status of the message sent earlier (available on the type "confirm"); +</li><li><b>KSmsSerial</b>: Adjusted for the input Endpoint in the context of SMS messages, contains the serial number of the received message (available on the type "broadcast"); +</li><li><b>KSmsPage</b>: Adjusted for the input Endpoint in the context of SMS messages, contains the page number of the received message (available on the type broadcast"); +</li><li><b>KSmsPages</b>: Adjusted for the input Endpoint in the context of SMS messages, contains the total number of pages to be received (available in type "broadcast"); +</li><li><b>KUserInfoDescriptor</b>: Sets/reports protocol descriptor of the User-to-User Information message (ISDN). +</li><li><b>KUserInfoData</b>: Sets/reports data in the User-to-User Information message (ISDN). +</li><li><b>KFaxSent</b>: Adjusted by the Endpoint when sending FAX with <b>KSendFax</b> application, and determines whether the fax was successfully sent ("yes") or not ("No"); +</li><li><b>KFaxReceived</b>: Adjusted by channel when receiving FAX with <b>KReceiveFax</b> application, and determines whether the fax was successfully received ("yes") or not ("no"); +</li><li><b>KFaxResult</b>: Adjusted by the channel when sending or receiving FAX with the application <b>KSendFax</b> or <b>KReceiveFax</b> (respectively), and defines the result of execution. +</li></ul> +<p><br /> +</p> +<a name="Description_of_variables" id="Description_of_variables"></a><h3> <span class="mw-headline"> Description of variables </span></h3> +<p>Below, follows an explanation on how to use variables of Khomp Endpoint in the dialplan, to communicate and/or to receive information: +</p><p><br /> +</p> +<a name="KDropCollectCall" id="KDropCollectCall"></a><h4> <span class="mw-headline"> KDropCollectCall </span></h4> +<p>When activated, causes the Endpoint to drop Khomp collect calls through dual service (available for signaling 'R2 Digital' and FXO), through information available on the ISDN protocol and R2/MFC, or by detecting the audio call collect (available for any digital signage for E1, and GSM signaling). +</p><p>This variable is useful to filter collect calls to certain extensions, and <b>must</b> be set before making any type of answer - applications such as <b>playback</b> and <b>bridge</b> should always be executed after setting this variable, for example. +</p><p>For better functionality, is also recommended that no call status (<i>ringback</i>) is sent before this variable is set, so applications should be performed only after the correct setting of this variable. +</p><p>This variable can be set locally and globally, both to <b>yes</b> or <b>no</b>. The adjustment of global variable to <b>yes</b> will drop all the collect calls, unless the particular call is set to <b>no</b> - this allows the creation of a global filter of collect calls, with few exceptions. +</p><p>Enabling the variable in context <b>default</b>: +</p><p><!-- NEED 5 --> +<context name="default"> +</p> +<pre><extension name="example"> + . + . + . + <action aplication="set" data="KDropCollectCall=yes"/> + . + . + . +</extension> +</pre> +<p></context> +</p><p>Enabling the variable in the global context, remembering that it must be configured in the file <b>vars.xml</b>: +<!-- NEED 5 --> +</p> +<pre><X-PRE-PROCESS cmd="set" data="KDropCollectCall=yes"/> +</pre> +<a name="KR2SendCondition" id="KR2SendCondition"></a><h4> <span class="mw-headline"> KR2SendCondition </span></h4> +<p>When you receive a call, can be set before sending ringback by FreeSWITCH (ie, before the run FreeSWITCH applications <b>answer</b>, <b>bridge</b>). When used in signaling R2/MFC, this variable sets the condition for B to the numeric value desired. +</p><p>Exemplo: +<!-- NEED 6 --> +</p> +<pre><!-- Condition "NUMBER CHANGED" warns the caller that the number of B has changed. --> +<action application="KR2SendCondition" data="3"/> +</pre> +<a name="KR2GotCategory" id="KR2GotCategory"></a><h4> <span class="mw-headline"> KR2GotCategory </span></h4> +<p>When you receive a call, is set by the Endpoint with the category received from the number that originated the call. It is set in signaling R2/MFC, and can be found anywhere in the dialplan. +</p><p>Example: +<!-- NEED 3 --> +</p> +<pre><action application="log" data="DEBUG KR2GotCategory [${KR2GotCategory}]"/> +</pre> +<a name="KR2GotCondition" id="KR2GotCondition"></a><h4> <span class="mw-headline"> KR2GotCondition </span></h4> +<p>Variable adjusted by the Endpoint, and available after returning from a call made by FreeSWITCH. Has the condition of B received when making the call. Available only for signaling R2/MFC. +</p><p>Example: +<!-- NEED 3 --> +</p> +<pre><action application="log" data="DEBUG KR2GotCondition [${KR2GotCondition}]"/> +</pre> +<a name="KUserInfoDescriptor" id="KUserInfoDescriptor"></a><h4> <span class="mw-headline"> KUserInfoDescriptor </span></h4> +<p>Variable adjusted by the Endpoint in the context of entry, from information received by the ISDN network functionality through user-to-User Information. Contains the descriptor number of the protocol used by the other end, and usually contains the value '0 ', but this is dependent on application. +</p><p>For further information, consult the specification ITU-T Q931 (more precisely, the specification table 4-26). +</p><p>Example (working with the descriptor number of the protocol): +<!-- NEED 3 --> +</p> +<pre><action application="log" data="DEBUG KUserInfoDescriptor [${KUserInfoDescriptor}]"/> +</pre> +<a name="KUserInfoData" id="KUserInfoData"></a><h4> <span class="mw-headline"> KUserInfoData </span></h4> +<p>Variable adjusted by the channel in the context of entry, from information received by the ISDN network functionality through user-to-User Information. Contains the actual data, which were received in the form of a string of text. +</p><p>More information about this feature, see the specification ITU-T Q931. +</p><p>Example (working with the data received): +<!-- NEED 3 --> +</p> +<pre><action application="log" data="DEBUG KUserInfoData [${KUserInfoData}]"/> +</pre> +<p>It is important to note that the variables are sensitive to the capitalization of letters (case sensitive). +</p> +<a name="KCallAnswerInfo" id="KCallAnswerInfo"></a><h4> <span class="mw-headline"> KCallAnswerInfo </span></h4> +<p>Variable adjusted by the Endpoint. It is set in outbound connections, representing the type of answer performed by the other end. May contain the following values: +</p> +<dl><dd><ul><li> "MessageBox" (*): detected mailbox of a cell phone; +</li><li> "CarrierMessage": message sent before the service provider; +</li><li> "AnsweringMachine" (**): answering answering machine; +</li><li> "HumanAnswer" (**): human service; +</li><li> "Fax": reported when a fax tone is detected. +</li><li> "Unknown": unknown type of care; +</li></ul> +</dd></dl> +<p>(*) This type of service is detected by signals at certain frequencies that are sent before the call comes into a mailbox, and vary by operator. The algorithm captures most of the mailboxes, but can fail if there is not a clear signal, or if it is not within the standards most commonly used; +</p><p>(**) The difference between these two types of care depends on the specific configuration using the program <b>k3lanswerinfoconfig</b>, with the detection only based on heuristics and <b>never</b> with an accuracy of 100%. +<br /> +</p> +<a name="Console_commands" id="Console_commands"></a><h1> <span class="mw-headline"> Console commands </span></h1> +<p>List of available commands in the console for the FreeSWITCH Endpoint of Khomp: +</p><p><br /> +</p> +<ul><li> <b>khomp channels disconnect </b>: Disconnect one or more channels. This command sends a message directly to the physical channel of the card in question, requesting a disconnection. Use with caution; +</li><li> <b>khomp channels unblock </b>: Unlock blocked channels for input or output. Only available in digital signage via E1; +</li><li> <b>khomp clear links</b>: Clears error counters on the links; +</li><li> <b>khomp clear statistics</b>: Clears the statistics of channel connections, or statistics for a particular channel; +</li><li> <b>khomp get </b>: Gets the number of options Endpoint Khomp; +</li><li> <b>khomp kommuter </b>: Enables or disables kommuters connected via USB on this machine. Only accessible when the configuration "kommuter-activation" is set to "manual". +</li><li> <b>khomp kommuter count</b>: Gets the amount of kommuters connected via USB on this machine; +</li><li> <b>khomp log console</b>: Sets options in the console logs; +</li><li> <b>khomp log disk</b>: Sets logging options to disk; +<ul><li> <b>khomp log console</b> and <b>khomp log disk</b> have auxiliary options <b>No</b>, which reverses the selection of messages, and <b>just</b>, which generalizes the choice. Examples: +<ul><li> <b>khomp log disk just commands events</b> (Enables <b>only</b> logging to the disk of commands and events); +</li><li> <b>khomp log disk no commands </b> (Disable logging to the disk of commands sent to board); +</li><li> <b>khomp log disk warnings</b> (Enables also logging to the disk of warnings from Endpoint). +</li></ul> +</li><li> More information on options for the <b>log</b> command, type: "<b>help khomp log disk</b>" or "<b>help console log khomp</b>". +</li></ul> +</li><li> <b>khomp log rotate</b>: Rotate log files from the Endpoint; +</li><li> <b>khomp log status</b>: Shows log messages currently being written to disk and displayed on the console; +</li><li> <b>khomp log trace isdn</b>: Enable Debugging ISDN signaling; +</li><li> <b>khomp log trace k3l </b>: Enables debugging low-level API K3L; +</li><li> <b>khomp log trace r2 </b>: Enables debugging low-level signaling R2/MFC; +</li><li> <b>khomp reset links</b>: Sends a reset command for a specific <b>E1</b> of a particular <i>card</i>; +</li><li> <b>khomp revision</b>: Shows version number and revision of the Endpoint; +</li><li> <b>khomp select sim</b>: Select the SIM card, available on the boards KGSM; +</li><li> <b>khomp send command </b>: Sends command API K3L directly to the board (only for debugging, may compromise the stability of the system if used improperly); +</li><li> <b>khomp send raw command </b>: Sends a command directly to the DSP board (only for debugging, may compromise the stability of the system if used improperly); +</li><li> <b>khomp set </b>: Sets various options of the Endpoint Khomp; +</li><li> <b>khomp show calls </b>: Shows states for calls, may also listing specific channels or boards; +</li><li> <b>khomp show channels </b>: Shows the status of the channels Khomp and may also list specific adapter; +</li><li> <b>khomp show links</b>: Display states of E1 links available. +</li><li> <b>khomp show statistics </b>: Shows the statistics of channel connections, or statistics for a particular channel; +</li><li> <b>khomp sms </b>: Send an SMS message for a given number, using KGSM channels; +</li><li> <b>khomp summary </b>: Prints a summary of system boards and their features; +</li></ul> +<p><br /> +</p> +<a name="Additional_features" id="Additional_features"></a><h1> <span class="mw-headline"> Additional features </span></h1> +<p>This chapter discusses additional features of the Endpoint, related to the special features present in certain signs. +<br /> +</p> +<a name="Aplica.C3.A7.C3.B5es_.28applications.29_e_canais" id="Aplica.C3.A7.C3.B5es_.28applications.29_e_canais"></a><h2> <span class="mw-headline">Aplicações (applications) e canais </span></h2> +<p>The Endpoint Khomp, and to record a type of communication channel "Khomp" also records the following items: +<br /> +</p> +<a name=".22KUserTransfer.22_application" id=".22KUserTransfer.22_application"></a><h3> <span class="mw-headline"> "KUserTransfer" application </span></h3> +<p>Performs the transfer process from the current channel <i>number</i> for the extension using the signaling protocol QSig (Single Step Call Transfer) for boards configured with E1 ISDN signaling (ISDN), or use the FLASH command for FXO. +</p><p>The syntax follows: +</p> +<pre> <action application="KUserTransfer" data="<b>number</b>[,options])"/> +</pre> +<p>Example: +</p> +<pre><action application="answer"/> +<action application="KUserTransfer" data="2345"/> +</pre> +<p>The fields have the following meanings: +</p> +<ul><li><b>number</b>: Number where the link should be transferred. +</li><li><b>options</b>: Sets the transfer options to be used, which are: +<ul><li><b> N</b>: Wait until the channel is disconnected. +</li></ul> +</li></ul> +<p><br /> +</p> +<a name="Application_.22KSendSMS.22" id="Application_.22KSendSMS.22"></a><h3> <span class="mw-headline"> Application "KSendSMS" </span></h3> +<p>This application has the function of sending SMS messages through the boards of KGSM Khomp using modules and SIM cards in the board to do so. The syntax of the application is as follows: +</p> +<pre><action application="KSendSMS" data="resource | destination | message" /> +</pre> +<p>Each field can be summarized in: +</p> +<ul><li><b>resource</b>: The following is a syntax identical to the allocation of channels Dial application, and defines what modem use; +</li><li><b>destination</b>: Number where to send the message, may be preceded or succeeded by<b>!</b> to request a confirmation of transmission; +</li><li><b>message</b>: Text (without quotes) to be sent to<b>destination</b>. +</li></ul> +<p>After sending the message, the variables <b>KSmsDelivered</b> and <b>KSmsErrorCode</b> will contain the result of the post. For more information about these, please consult the section on variables used in the Endpoint. +</p><p>Examples of use of this application are as follows: +</p> +<ul><li> Sends "Test message." phone for "99887766" using the modem "1" (second modem) card "0": +</li></ul> +<pre><action application="log" data="DEBUG Sending SMS ..." /> +<action application="KSendSMS" data="b0c1|99887766|Test message" /> +</pre> +<ul><li> Sends "Test message." phone for "99887766" using the first free modem card "0", and checks the return shipment: +</li></ul> +<pre><action application="log" data="DEBUG Sending SMS ..." /> +<action application="KSendSMS" data="b0|99887766|Test message" /> +<action application="log" data="DEBUG Sent? ${KSmsDelivered}" /> +<action application="log" data="DEBUG Code: ${KSmsErrorCode}" /> +<action application="log" data="DEBUG Desc: ${KSmsErrorName}" /> +</pre> +<ul><li> Sends "Test message." phone for "99887766" using the first free modem card "0", or the first free channel board "1" (if no free channel at the first sign): +</li></ul> +<pre><action application="log" data="DEBUG Sending SMS ..." /> +<action application="KSendSMS" data="b0+b1|99887766|Test message" /> +</pre> +<ul><li> Sends "Test message." phone for "99887766" using the first free modem card "0", requesting confirmation: +</li></ul> +<pre><action application="log" data="DEBUG Sending SMS ..." /> +<action application="KSendSMS" data="b0|99887766!|Test message" /> +</pre> +<p><br /> +</p> +<a name="Application_.22KEchoCanceller.22" id="Application_.22KEchoCanceller.22"></a><h3> <span class="mw-headline"> Application "KEchoCanceller" </span></h3> +<p>This application has the function to enable or disable the echo canceller channel. +</p> +<pre><action application="KEchoCanceller" data="<b>action</b>[,options])"/> +</pre> +<p>Where: +</p> +<ul><li><b>actions</b>: It is <b>on</b> to enable the echo canceller, and <b>off</b> to disable; +</li></ul> +<p>Example usage of this application: +</p> +<pre><action application="KEchoCanceller" data="off"/> +</pre> +<p><br /> +</p> +<a name="Application_.22KAutoGainControl.22" id="Application_.22KAutoGainControl.22"></a><h3> <span class="mw-headline"> Application "KAutoGainControl" </span></h3> +<p>This application has the function to enable or disable the automatic gain control in the channel. +</p> +<pre><action application="KAutoGainControl" data="<b>action</b>[,options])"/> +</pre> +<p>Where: +</p> +<ul><li><b>actions</b>: It is <b>on</b> to enable the automatic gain control, and <b>off</b> to disable; +</li></ul> +<p>Example usage of this application: +</p> +<pre> <action application="KAutoGainControl" data="on"/> +</pre> +<p><br /> +</p> +<a name="Application_.22KDTMFSuppression.22" id="Application_.22KDTMFSuppression.22"></a><h3> <span class="mw-headline"> Application "KDTMFSuppression" </span></h3> +<p>This application has the function to enable or disable the suppression of DTMF channel. The syntax of the application is as follows: +</p> +<pre><action applicatin="KDTMFSuppression" value="<b>action</b>[,options])"/> +</pre> +<p>Where: +</p> +<ul><li><b>actions</b>: It is<b>on</b> to enable DTMF suppression, and <b>off</b> to disable; +</li></ul> +<p>It is important to note that when disabled suppression of DTMF, DTMF tones are passed inband <i>and</i> will not be reported to FreeSWITCH. Thus FreeSWITCH does not recognize the DTMF tones, which may result in malfunction of applications such as IVR. +</p><p>Example usage of this application: +</p> +<pre><action applicatin="KDTMFSuppression" value="off"/> +</pre> +<p><br /> +</p> +<a name="Application_.22KSetVolume.22" id="Application_.22KSetVolume.22"></a><h3> <span class="mw-headline"> Application "KSetVolume" </span></h3> +<p>This application has the function to adjust the volume of incoming and outgoing channels Khomp, and its syntax as follows: +</p> +<pre><action application="KSetVolume" data="<volume>"/> +<action application="KSetVolume" data="<output-volume>|<input-volume>"/> +</pre> +<p>Where the fields have the following meanings: +</p> +<ul><li><b>volume</b>: Sets the volume of input and output (-10 to +10); +</li><li><b>output-volume</b>: Sets the output volume (-10 to +10, "none" for no change); +</li><li><b>input-volume</b>: Sets the input level (-10 to +10, "none" for no change). +</li></ul> +<p><br /> +</p> +<a name="Application_.22KAdjustForFax.22" id="Application_.22KAdjustForFax.22"></a><h3> <span class="mw-headline"> Application "KAdjustForFax" </span></h3> +<p>This application has the function of setting a channel for receiving Khomp signal FAX/modem, optimizing the communication channel for data traffic. Syntax: +</p> +<pre><action application="KAdjustForFax" data=""/> +</pre> +<p>This application does not receive parameters. Example of use: +</p> +<pre><action application="KAdjustForFax" data=""/> +</pre> +<p><br /> +</p> +<a name="Application_.22KSendFax.22" id="Application_.22KSendFax.22"></a><h3> <span class="mw-headline"> Application "KSendFax" </span></h3> +<p>This application has the function to send faxes using digital channels or FXO connections Khomp in pre-established, and its syntax as follows: +</p> +<pre><action application="KSendFax" data="<file>[:<file2>[:...]][|<faxid>]"/> +</pre> +<p><strong>This application requires a license purchased separately to be used in digital (non-FXO) channels</strong>. Fields have the following meanings: +</p> +<ul><li><b>file</b>: Files to be sent to the fax should be encapsulated in TIFF format and have a resolution of 98, 196 or 392 dpi; +</li><li><b>faxid</b>: the fax number. If not specified, the value is obtained by the id of the link, and if this also is not valid, the fax number will be set as default in K3L. +</li></ul> +<p>Example usage of this application: +</p> +<pre><action application="KSendFax" data="/tmp/fax.tif:/home/root/fax2.tif,1234"/> +</pre> +<p><br /> +</p> +<a name="Application_.22KReceiveFax.22" id="Application_.22KReceiveFax.22"></a><h3> <span class="mw-headline"> Application "KReceiveFax" </span></h3> +<p>This application has the function of receiving digital channels or fax using the FXO Khomp, and its syntax as follows: +</p> +<pre><action application="KReceiveFax" data="<file>[|<faxid>]/> +</pre> +<p><strong>This application requires a license purchased separately to be used in digital (non-FXO) channels</strong>. Fields have the following meanings: +</p> +<ul><li><b>file</b>: Name that file will be assigned to incoming fax. +</li><li><b>faxid</b>: the fax number. If not specified, the value is obtained by the id of the link, and if this also is not valid, the fax number will be set as default in K3L. +</li></ul> +<p>Example usage of this application: +</p> +<pre><action application="answer" /> +<action application="KReceiveFax" data="/tmp/fax.tif"/> +</pre> +<p><br /> +</p> +<a name="Channel_.22Khomp_SMS.22" id="Channel_.22Khomp_SMS.22"></a><h3> <span class="mw-headline"> Channel "Khomp_SMS" </span></h3> +<p>This communication channel is used to receive SMS and create incoming links in FreeSWITCH for each message received. This channel does not have any treatment or audio processing, and is called with five variables set: +</p> +<ul><li><b>KSmsFrom</b>, containing the number of source who sent the message; +</li><li><b>KSmsDate</b>, which sets the date/time of receipt of the message; +</li><li><b>KSmsSize</b>, representing the message size (in bytes); +</li><li><b>KSmsMode</b>, containing the encoding used to transmit the message; +</li><li><b>KSmsBody</b>, that is the message itself. +</li></ul> +<p>The FreeSWITCH dialplan processing can be used to store this message in a database, run any application, among others. However, the only action accepted by this channel is shutdown (Hangup), so this incoming call should be considered a special dialplan execution without audio streams or channel allocation. +<br /> +</p> +<a name="Channel_.22Khomp_PR.22" id="Channel_.22Khomp_PR.22"></a><h3> <span class="mw-headline"> Channel "Khomp_PR" </span></h3> +<p>This communication channel is used to receive calls on boards passive recording (<b>KPR family</b> and <b>KFXO-HI</b>), creating incoming links on FreeSWITCH for each incoming call. This channel allows only receiving audio captured the <i>link</i>by not allowing both the transmission of audio signalings as the control. +</p><p>The FreeSWITCH dialplan processing can be used to record data on this link in a database, perform some special application and/or some recording application (such as <b>record</b>), among others. However, the only action accepted by this channel is shutdown (Hangup), so this should not be considered a common call. +<br /> +</p> +<a name="Codes_and_meanings" id="Codes_and_meanings"></a><h1> <span class="mw-headline"> Codes and meanings </span></h1> +<p>This chapter presents the codes present in the channel Khomp and their meanings, used in both events as in the AMI console commands: +<br /> +</p> +<a name="Channel_state" id="Channel_state"></a><h2> <span class="mw-headline"> Channel state </span></h2> +<p>Reflect the state of the channel on the board. In the case of E1 links, the state may have one or more of the following: +</p> +<ul><li><b>Free</b>: the channel is free; +</li><li><b>Busy</b>: the channel is not free (or occupied, or failure); +</li><li><b>Outgoing</b>: the channel has an output connection; +</li><li><b>Incoming</b>: the channel has an input connection; +</li><li><b>Locked</b>: the channel is blocked; +</li><li><b>Outgoing Lock</b>: The channel is blocked for outgoing calls; +</li><li><b>Local Fail</b>: The channel has a fault (at this point); +</li><li><b>Incoming Lock</b>: the channel is blocked for incoming calls; +</li><li><b>Remote Lock</b>: there is a remote lock (at the other end) in this channel. +</li></ul> +<p>In the case of a FXS channel, the state is defined by one of these values: +</p> +<ul><li><b>On Hook</b>: the phone connected to this channel is on-hook or disconnected; +</li><li><b>Off Hook</b>: the phone connected to this channel is off the hook; +</li><li><b>Ringing</b>: the channel is being called; +</li><li><b>Failure</b>: the channel is in failure due to communication problems between the central and the plate. +</li></ul> +<p>In the case of a GSM channel, the state is defined by one of the following values: +</p> +<ul><li><b>Idle</b>: the channel is free and available for calls; +</li><li><b>Call In Progress</b>: the channel is busy on a call; +</li><li><b>SMS In Progress</b>: the channel is busy sending / receiving SMS messages; +</li><li><b>Modem Error</b>: an error occurred communicating with the modem channel; +</li><li><b>SIM Card Error</b>: The SIM card is not present or is not inserted / detected correctly; +</li><li><b>Network Error</b>: an error occurred while communicating with the network; +</li><li><b>Not Ready</b>: The modem is initializing the channel. +</li></ul> +<p>And in the case of an FXO channel, the states are as follows: +</p> +<ul><li><b>Disabled</b>: the channel is disabled; +</li><li><b>Enabled</b>: the channel is enabled. +</li></ul> +<p><br /> +</p> +<a name="Call_state" id="Call_state"></a><h2> <span class="mw-headline"> Call state </span></h2> +<p>Defines the logical state for each channel, which can be: +</p> +<ul><li><b>Free</b>: the channel is free; +</li><li><b>Incoming</b>: the channel is receiving a call; +</li><li><b>Outgoing</b>: the channel is making a call; +</li><li><b>Failure</b>: the channel is in fault. +</li></ul> +<p><br /> +</p> +<a name="FreeSWITCH_call_states" id="FreeSWITCH_call_states"></a><h2> <span class="mw-headline"> FreeSWITCH call states </span></h2> +<p>Directly reflects the call state controlled by FreeSWITCH, which can be: +</p><p><br /> +</p> +<ul><li> <b>new</b>: Channel is newly created; +</li><li> <b>init</b>: Channel has been initialized; +</li><li> <b>routing</b>: Channel is looking for an extension to execute; +</li><li> <b>execute</b>: Channel is executing its dialplan; +</li><li> <b>ex_media</b>: Channel is exchanging media with another channel; +</li><li> <b>cs_media</b>: Channel is consuming all media; +</li><li> <b>hangup</b>: Channel is flagged for hangup and ready to end. +</li></ul> +<p><br /> +</p> +<a name="GSM_Codes" id="GSM_Codes"></a><h2> <span class="mw-headline"> GSM Codes </span></h2> +<p>The following numeric codes are reported: +</p> +<a name="SMS_codes_.28SMS_causes.29" id="SMS_codes_.28SMS_causes.29"></a><h3> <span class="mw-headline"> SMS codes (SMS causes) </span></h3> +<pre>1 Unassigned number +8 Operator determined barring +10 Call barred +21 SMS transfer rejected +27 Destination out of service +28 Unidentified subscriber +29 Facility rejected +30 Unknown subscriber +38 Network out of order +41 Temporary failure +42 Congestion +47 Resources unavailable +50 Facility not subscribed +69 Facility not implemented +81 Invalid SMS transfer reference value +95 Invalid message +96 Invalid mandatory information +97 Message type non existent +98 Message not compatible with SMS protection state +99 Information element non existent +111 Protocol error +127 Interworking +128 Telematic interworking not supported +129 SMS type zero not supported +130 Cannot replace SMS +143 Unspecified TPPID error +144 Alphabet not supported +145 Message class not supported +159 Unspecified TPDCS error +160 Command cannot be actioned +161 Command unsupported +175 Unspecified TP command error +176 TPDU not supported +192 SC busy +193 No SC subscription +194 SC system failure +195 Invalid SME address +196 Destination SME barred +197 SM rejected duplicate SM +198 TPVPF not supported +199 TPVP not supported +208 SIM SMS storage full +209 No SMS storage capability in SIM +210 Error in SMS +211 Memory capatity exceeded +213 SIM data download error +255 Unspecified error +300 Phone failure +301 SMS service reserved +302 Operation not allowed +303 Operation not supported +304 Invalid PDU mode parameter +305 Invalid text mode parameter +310 SIM not inserted +311 SIM PIN necessary +312 Phone SIM PIN necessary +313 SIM failure +314 SIM busy +315 SIM wrong +320 Memory failure +321 Invalid memory index +322 Memory full +330 SMSC address unknown +331 No network service +332 Network timeout +500 Unknown error +512 Network busy +513 Invalid destination address +514 Invalid message body length +515 Phone is not in service +516 Invalid preferred memory storage +517 User terminated +</pre> +<a name="Call_codes_.28call_causes.29" id="Call_codes_.28call_causes.29"></a><h3> <span class="mw-headline"> Call codes (call causes) </span></h3> +<pre>1 Unallocated number +3 No route to destination +6 Channel unacceptable +8 Operator determined barring +16 Normal call clear +17 User busy +18 No user responding +19 No answer from user +21 Call rejected +22 Number changed +26 Non Selected user clear +27 Destination out of order +28 Invalid number format +29 Facility rejected +30 Response status enquiry +31 Normal, unspecified +34 No circuit channel available +38 Network out of order +41 Temporary failure +42 Switch congestion +43 Access information discarded +44 Requested channel unavailable +47 Resource unavailable +49 QoS unavailable +50 Request facility not subscribed +55 Call barred with UG +57 Bearer capability not authorized +58 Bearer capability not available +63 Service not available +65 Bearer capability not implemented +69 Request facility not implemented +70 Only restricted bearer capability available +79 Service not implemented +81 Invalid call reference value +82 User not member of UG +88 Incompatible destination +91 Invalid transit network selected +95 Invalid message +96 Missing mandatory information element +97 Message type not implemented +98 Message incompatible with state +99 Information element not implemented +100 Invalid information element +101 Message incompatible with state (2) +102 Recovery on timer expiry +111 Protocol error +127 Interworking +</pre> +<a name="General_codes_.28mobile_causes.29" id="General_codes_.28mobile_causes.29"></a><h3> <span class="mw-headline"> General codes (mobile causes) </span></h3> +<pre>0 Phone failure +1 No connection to phone +2 Phone adaptor link reserved +3 Operation not allowed +4 Operation not supported +5 Phone SIM PIN required +6 Phone FSIM PIN required +7 Phone FSIM PUK required +10 SIM not inserted +11 SIM PIN required +12 SIM PUK required +13 SIM failure +14 SIM busy +15 SIM wrong +16 Incorrect password +17 SIM PIN2 required +18 SIM PUK2 required +20 Memory full +21 Invalid index +22 Not found +23 Memory failure +24 Text string too long +25 Invalid character in text string +26 Dial string too long +27 Invalid character in dial string +30 No network service +31 Network timeout +32 Network not allowed +33 Command aborted +34 Number parameter instead of text parameter +35 Text parameter instead of number parameter +36 Numeric parameter out of bounds +37 Text string too short +40 Network PIN required +41 Network PUK required +42 Network subset PIN required +43 Network subset PUK required +44 Network service provider PIN required +45 Network service provider PUK required +46 Corporate PIN required +47 Corporate PUK required +60 SIM Service option not supported +100 Unknown +103 Illegal MS #3 +106 Illegal MS #6 +107 GPRS service not allowed #7 +111 PLMN not allowed #11 +112 Location area not allowed #12 +113 Roaming not allowed #13 +132 Service option not supported #32 +133 Registration service option not subscribed #33 +134 Service option temporary out of order #34 +147 Long context activation +148 Unspecified GPRS error +149 PDP authentication failure +150 Invalid mobile class +151 GPRS disconnection TMR active +256 Too many active calls +257 Call rejected +258 Unanswered call pending +259 Unknown calling error +260 No phone number recognized +261 Call state not idle +262 Call in progress +263 Dial state error +264 Unlock code required +265 Network busy +266 Invalid phone number +267 Number entry already started +268 Cancelled by user +269 Number entry could not be started +280 Data lost +281 Invalid message body length +282 Inactive socket +283 Socket already open +</pre> +<p><br /> +</p> +<a name="Troubleshooting" id="Troubleshooting"></a><h1> <span class="mw-headline"> Troubleshooting </span></h1> +<p>In this section, errors and their most common solutions are presented. +</p> +<a name="Error_during_installation_of_kernel_module" id="Error_during_installation_of_kernel_module"></a><h2> <span class="mw-headline"> Error during installation of kernel module </span></h2> +<p>During installation of the <i>Endpoint</i>of Khomp may occur the following messages: +<!-- NEED 3 --> +</p> +<pre>K3L: WARNING: Unable to find a module for [...] +</pre> +<p>or +<!-- NEED 8 --> +</p> +<pre>install: ****** THE KERNEL MODULE HAS NOT BEEN INSTALLED: ******* +install: +install: ** Please, untar the file kpdriver*.tar.gz located in: ** +install: ** '/usr/src/khomp/' ** +install: ** then check the README.txt ** +install: ** for knowing how to proceed with the installation. ** +</pre> +<p>In this case, you must compile the drivers manually to your system. Proceed to the item below for more information. +<br /> +</p> +<a name="Compiling_the_drivers_and_starting_the_services" id="Compiling_the_drivers_and_starting_the_services"></a><h3> <span class="mw-headline"> Compiling the drivers and starting the services </span></h3> +<p>Just follow to the directory <b>/usr/src/khomp</b>, unpack the file "kpdriver_2.0.0<b>XX</b>.tar.gz", and follow procedures described in the file <b>README_en.txt</b>. +</p><p>After performing compilation and installation of the module, just load it into the system, configuring the boards and start the server processes Khomp. +</p><p>To load the kernel driver, you must run the following command: +<!-- NEED 3 --> +</p> +<pre># /etc/init.d/khompdrv start +</pre> +<p>To set up the boards, in turn, must run the command: +<!-- NEED 3 --> +</p> +<pre># khompwizard +</pre> +<p>This will run a setup wizard that will ask the signaling used in the system, as well as other parameters of use of the boards. +</p><p>If necessary configure other additional parameters you can use the following command: +<!-- NEED 3 --> +</p> +<pre># k3lconfig +</pre> +<p>This configurator, in turn, shows all possible options for card configuration. The parameters that are not configured automatically assume the default values, and are compatible with most systems. More details about this program can be obtained from the section number '2 '. +</p> +<ul><li> <b>ATTENTION'<i>: To start FreeSWITCH®, it is necessary that the board is configured Khomp and all modules are running (as shown above). </i></b><i>If the card is not configured, FreeSWITCH will not start<b>.<br /> <br /> If you want to run the system without the board Khomp, you need to configure FreeSWITCH for it does not load the module Khomp. To do this, open the "</b></i><b>/usr/local/freeswitch/conf/autoload_configs/modules.conf.xml</b> and comment the line:<br /> +</li></ul> +<pre> +<!-- <load module="mod_khomp" /> --> +</pre><br /> +<p>When the board Khomp is properly configured and loaded modules khomp (explained above), remember to uncomment this line in the file. +</p><p>Finally, to load the server process, simply run the following command: +<!-- NEED 3 --> +</p> +<pre># kserver start +</pre> +<p>After performing these procedures, the Endpoint is already operational, and FreeSWITCH can now be loaded. +<br /> +</p> +<a name="Setting_up_special_parameters_for_audio_or_signaling" id="Setting_up_special_parameters_for_audio_or_signaling"></a><h2> <span class="mw-headline"> Setting up special parameters for audio or signaling </span></h2> +<p>To set specific parameters of timing and/or signaling, you can use the program "k3lconfig": simply select the card you want, and options of the boards will be presented, divided into sections and subsections for easy access. It is not necessary to effect the configuration of all parameters: default values are assumed, if not configured. +</p><p>To adjust the signaling link, simply - after selecting the card - enter the "Options signaling, and then in" Signs of the line. " To choose a particular signaling, just use the direction keys (arrows) to select it, press 'space', and confirm the option by pressing 'Enter' on the "Confirm" button. +</p><p>Finally, to save the modified settings, just exit the program: it will display a window with options to save the changes made or not. +</p><p>Please not that <b>the following options are required to be unchanged from the defaults</b>: +</p> +<ul><li> Automatic echo cancellation; +</li><li> DTMF suppression; +</li><li> Automatic Gain Control (AGC). +</li></ul> +<p>These options are <b>controlled by Endpoint</b> and should be <b>disabled</b> in 'k3lconfig' (the default configuration). +<br /> +</p> +<a name="Automatic_load_of_services_and_kernel_modules" id="Automatic_load_of_services_and_kernel_modules"></a><h2> <span class="mw-headline"> Automatic load of services and kernel modules </span></h2> +<p>If the loading of <i>kernel</i> module or Khomp services startup is not performed automatically at startup, you can perform this installation manually, creating a <i>link</i> for the <i>scripts</i> <b>/etc/init.d/khompdrv</b> and <b>/etc/init.d/kserver</b> in the system startup directory. +</p><p>In the case of <b>Debian</b>-based distributions the <i>script</i> for loading <i>kernel</i> modules would be <i>linked</i> within the directory <i>/etc/rcS.d</i>, while the services loader would be <i>linked</i> within the directories <i>/etc/rc2.d</i>, <i>/etc/rc3.d</i>, <i>/etc/rc4.d</i>, <i>/etc/rc5.d</i> as follows: +</p><p><!-- NEED 6 --> +</p> +<pre># ln -s /etc/init.d/khompdrv /etc/rcS.d/S19khompdrv +# ln -s /etc/init.d/kserver /etc/rc2.d/S20kserver +# ln -s /etc/init.d/kserver /etc/rc3.d/S20kserver +# ln -s /etc/init.d/kserver /etc/rc4.d/S20kserver +# ln -s /etc/init.d/kserver /etc/rc5.d/S20kserver +</pre> +<p>Please check the rules of your distribution to initialize the services in accordance with what is expected by the start of it. +<br /> +</p> +<a name="Ap.C3.AAndice" id="Ap.C3.AAndice"></a><h1> <span class="mw-headline"> Apêndice </span></h1> +<p>Nesta seção, encontram-se informações úteis sobre o Endpoint e componentes relacionados. +</p> +<a name="Arrangement_of_installed_files" id="Arrangement_of_installed_files"></a><h2> <span class="mw-headline"> Arrangement of installed files </span></h2> +<p>The directories created/modified in this facility are: +<!-- NEED 20 --> +</p> +<pre>/etc/init.d/ -- Startup scripts; + +/etc/khomp/ -- Firmware files and settings; + +/usr/local/freeswitch/conf/ -- Settings for FreeSWITCH and Endpoint; + +/usr/doc/khomp/ -- Docs for the boards, Channel, and utilities; + +/usr/sbin/ -- Utilities and server processes; + +/usr/lib/ -- Shared libraries; + +/usr/local/freeswitch/mod/ -- Endpoint module; + +/var/log/khomp2.1/ -- Log directory for K3L and Endpoint; +</pre> +<p>The script <b>/etc/init.d/khompdrv</b> is responsible for loading modules <b>kpci9030.ko</b> and <b>kpex8311.ko</b> in the kernel, which should be carried out automatically at system startup. In case of problems, check the <a href="#Troubleshooting" title="">Troubleshooting</a> section. +</p><p><br /> +</p><p><br /> +</p></body></html> \ No newline at end of file diff --git a/src/mod/endpoints/mod_khomp/docs/User_Guide.pdf b/src/mod/endpoints/mod_khomp/docs/User_Guide.pdf new file mode 100644 index 0000000..2f8c874 Binary files /dev/null and b/src/mod/endpoints/mod_khomp/docs/User_Guide.pdf differ diff --git a/src/mod/endpoints/mod_khomp/include/applications.h b/src/mod/endpoints/mod_khomp/include/applications.h new file mode 100644 index 0000000..75f55ec --- /dev/null +++ b/src/mod/endpoints/mod_khomp/include/applications.h @@ -0,0 +1,962 @@ +/******************************************************************************* + + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2010 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the LGPL + License. If you do not delete the provisions above, a recipient may use your + version of this file under either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*******************************************************************************/ + +#ifndef _APPLICATIONS_H_ +#define _APPLICATIONS_H_ + +#include "lock.h" +#include "khomp_pvt.h" + +struct Application +{ + Application(Board::KhompPvt * pvt) : _pvt(pvt) {} + ~Application() {} + + Statistics * statistics() { return _app_statistics; } + + template <typename T> + T* statistics() { return static_cast<T*>(_app_statistics); } + + Board::KhompPvt *_pvt; + Statistics *_app_statistics; +}; + +/*************************** FAX **********************************************/ +struct Fax +{ + Fax(Board::KhompPvt * pvt) : _pvt(pvt) {} + + /* + bool clear(Board::KhompPvt * pvt) + { + _pvt = pvt; + return true; + } + */ + + bool adjustForFax(); + + bool sendFax(switch_core_session_t * session, const char *data); + bool receiveFax(switch_core_session_t * session, const char *data); + + bool onFaxChannelRelease(K3L_EVENT *e); + + bool startFaxTX(const char * orig_addr = NULL); + bool stopFaxTX(); + bool startFaxRX(const char * filename, const char * orig_addr = NULL); + bool stopFaxRX(); + bool addFaxFile(const char * filename, bool last = true); + + + Board::KhompPvt *_pvt; + + /* used by app FAX */ + SavedCondition _fax_cond; + KFaxResult _fax_result; + +}; + +/*************************** TRANSFER *****************************************/ +template <typename T, bool flash = true> +struct Transfer +{ + Transfer(Board::KhompPvt * pvt) : _pvt(pvt), _is_ok(false) {} + + bool clear() + { + if(!_is_ok) + { + _call = dynamic_cast<T *>(_pvt->call()); + + _is_ok = true; + + if(!_call) + { + DBG(FUNC, D("Error in cast")); + _is_ok = false; + } + } + + _call->_flags.clear(Kflags::XFER_DIALING); + + return true; + } + + bool userTransfer(switch_core_session_t * session, const char *data) + { + DBG(FUNC, PVT_FMT(_pvt->target(), "c")); + + std::string dest(""); + std::string opts(""); + + try + { + Strings::vector_type params; + + Strings::tokenize((const char *)data, params, "|,", 2); + + dest = params[0]; + + if (params.size() > 1) + { + // other options go here... + } + + ScopedPvtLock lock(_pvt); + + int timeout = 5; + + if(!_pvt->call()->_flags.check(Kflags::REALLY_CONNECTED) && !_pvt->loopWhileFlagTimed(Kflags::REALLY_CONNECTED, timeout, false)) + return false; + + DBG(FUNC, PVT_FMT(_pvt->target(), "flashing channel!")); + + _pvt->command(KHOMP_LOG, CM_FLASH); + + lock.unlock(); + + timeout = 15; // 15 * 200000 = 3s + + do + { + usleep(200000); + timeout--; + + ScopedPvtLock lock2(_pvt); + + if(!_pvt->call()->_flags.check(Kflags::IS_INCOMING) && !_pvt->call()->_flags.check(Kflags::IS_OUTGOING)) + { + DBG(FUNC, PVT_FMT(_pvt->target(), "unable to do a user transfer, channel disconnected")); + return false; + } + + } + while(timeout); + + ScopedPvtLock lock3(_pvt); + + _pvt->command(KHOMP_LOG, CM_DIAL_DTMF, dest.c_str()); + + _pvt->call()->_flags.set(Kflags::WAIT_SEND_DTMF); + + lock3.unlock(); + + timeout = 300; // 300 * 200000 = 60s + + do + { + usleep(200000); + timeout--; + + ScopedPvtLock lock4(_pvt); + + if(!_pvt->call()->_flags.check(Kflags::WAIT_SEND_DTMF)) + break; + } + while(timeout); + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_pvt->target(),"r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + + DBG(FUNC, PVT_FMT(_pvt->target(), "r")); + return true; + } + + /* User transfer functions */ + bool doUserXferUnlocked() + { + DBG(FUNC, PVT_FMT(_pvt->target(), "c (flashing channel!)")); + + bool ret = false; + + ret = _pvt->command(KHOMP_LOG, CM_FLASH); + + DBG(FUNC, PVT_FMT(_pvt->target(), "r (%s)") % (ret ? "true" : "false")); + return ret; + } + + bool checkUserXferUnlocked(std::string digit) + { + DBG(FUNC, PVT_FMT(_pvt->target(), "c (CM_FLASH)")); + + + if (_call->_user_xfer_digits.empty()) + { + _call->_digits_buffer += digit; + DBG(FUNC, PVT_FMT(_pvt->target(), "r (disabled)")); + return false; + } + + _call->_user_xfer_buffer += digit; + + /* temporary buffer */ + std::string tmp = _call->_user_xfer_buffer; + + unsigned int amount = tmp.size(); + + try + { + + if (amount == _call->_user_xfer_digits.size()) + { + if (tmp == _call->_user_xfer_digits) + { + bool ret = doUserXferUnlocked(); + + _call->_user_xfer_buffer.clear(); + _call->_digits_buffer.clear(); + + Board::board(_pvt->target().device)->_timers.del(_idx_xfer_dial); + + DBG(FUNC, PVT_FMT(_pvt->target(), "r (ret=%s, done xfer)") % (ret ? "true" : "false")); + return ret; + } + + _call->_digits_buffer += tmp[0]; + _call->_user_xfer_buffer.erase(0, 1); + DBG(FUNC, PVT_FMT(_pvt->target(), "r (false, no xfer)")); + return false; + } + + if (tmp == _call->_user_xfer_digits.substr(0,amount)) + { + if (!(_call->_flags.check(Kflags::XFER_DIALING))) + { + _call->_flags.set(Kflags::XFER_DIALING); + _idx_xfer_dial = Board::board(_pvt->target().device)->_timers.add(Opt::_transferdigittimeout, &userXferTimer, _pvt, TM_VAL_CALL); + } + else + { + Board::board(_pvt->target().device)->_timers.restart(_idx_xfer_dial); + } + + DBG(FUNC, PVT_FMT(_pvt->target(), "r (true, buffering)")); + return true; + } + + } + catch (K3LAPI::invalid_device & err) + { + LOG(ERROR, PVT_FMT(_pvt->target(), "Unable to get device: %d!") % err.device); + } + + _call->_digits_buffer += tmp[0]; + _call->_user_xfer_buffer.erase(0, 1); + DBG(FUNC, PVT_FMT(_pvt->target(), "r (false, buffering)")); + + return false; + + } + + static void userXferTimer(Board::KhompPvt * pvt) + { + DBG(FUNC, PVT_FMT(pvt->target(), "c")); + + T * call = static_cast<T *>(pvt->call()); + + try + { + ScopedPvtLock lock(pvt); + + if (!call->_user_xfer_buffer.empty()) + { + pvt->command(KHOMP_LOG, CM_DIAL_DTMF, call->_user_xfer_buffer.c_str()); + + /* clear the buffer that has been send */ + call->_user_xfer_buffer.clear(); + } + + call->_flags.clear(Kflags::XFER_DIALING); + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(pvt->target(),"r (unable to lock %s!)") % err._msg.c_str() ); + return; + } + + DBG(FUNC, PVT_FMT(pvt->target(), "r")); + } + + bool _is_ok; + T * _call; + Board::KhompPvt * _pvt; + Board::ChanTimer::Index _idx_xfer_dial; +}; + +template<typename T> +struct Transfer<T, false> +{ + Transfer(Board::KhompPvt * pvt) : _pvt(pvt), _is_ok(false) {} + + bool clear() + { + if(!_is_ok) + { + _call = dynamic_cast<T *>(_pvt->call()); + + _is_ok = true; + + if(!_call) + { + DBG(FUNC, D("Error in cast")); + _is_ok = false; + } + } + + _call->_flags.clear(Kflags::XFER_DIALING); + _call->_flags.clear(Kflags::XFER_QSIG_DIALING); + + return true; + } + + bool userTransfer(switch_core_session_t * session, const char *data) + { + DBG(FUNC, PVT_FMT(_pvt->target(), "c")); + + std::string dest(""); + + bool opt_nowait = false; + + try + { + Strings::vector_type params; + + Strings::tokenize((const char *)data, params, "|,", 2); + + dest = params[0]; + + if (params.size() > 1) + { + opt_nowait = (params[1].find('n') != std::string::npos); + + // other options go here... + } + + ScopedPvtLock lock(_pvt); + + int timeout = 5; + + if(!_pvt->call()->_flags.check(Kflags::REALLY_CONNECTED) && !_pvt->loopWhileFlagTimed(Kflags::REALLY_CONNECTED, timeout, false)) + return false; + + DBG(FUNC, PVT_FMT(_pvt->target(), "ss_transfer on channel!")); + + _pvt->command(KHOMP_LOG, CM_SS_TRANSFER, + STG(FMT("transferred_to=\"%s\" await_connect=\"%d\"") + % dest % (opt_nowait ? 0 : 1)).c_str()); + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_pvt->target(),"r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + + DBG(FUNC, PVT_FMT(_pvt->target(), "r")); + return true; + } + + /* User transfer functions */ + bool doUserXferUnlocked(void) + { + DBG(FUNC, PVT_FMT(_pvt->target(), "c")); + + bool ret = false; + + if (_call->_flags.check(Kflags::XFER_QSIG_DIALING)) + { + DBG(FUNC, PVT_FMT(_pvt->target(), "ss_transfer on channel!")); + + _call->_flags.clear(Kflags::XFER_DIALING); + _call->_flags.clear(Kflags::XFER_QSIG_DIALING); + + ret = _pvt->command(KHOMP_LOG, CM_SS_TRANSFER, + STG(FMT("transferred_to=\"%s\" await_connect=\"1\"") % _call->_qsig_number).c_str()); + } + else + { + DBG(FUNC, PVT_FMT(_pvt->target(), "starting to store digits for ss_transfer...")); + _call->_flags.set(Kflags::XFER_QSIG_DIALING); + + _xfer_thread = threadCreate(Transfer<T, false>::userXferPlayback,(void*) _pvt); + _xfer_thread->start(); + + ret = true; + } + + DBG(FUNC, PVT_FMT(_pvt->target(), "r (%s)") % (ret ? "true" : "false")); + return ret; + + } + + bool checkUserXferUnlocked(std::string digit) + { + DBG(FUNC, PVT_FMT(_pvt->target(), "c (CM_SS_TRANSFER)")); + + + if (_call->_user_xfer_digits.empty()) + { + _call->_digits_buffer += digit; + DBG(FUNC, PVT_FMT(_pvt->target(), "r (disabled)")); + return false; + } + + _call->_user_xfer_buffer += digit; + + DBG(FUNC, PVT_FMT(_pvt->target(), "c digits=[%s] buffer=[%s]") % _call->_user_xfer_digits % _call->_user_xfer_buffer ); + + /* temporary buffer */ + std::string tmp = _call->_user_xfer_buffer; + + unsigned int amount = tmp.size(); + + try + { + + if (amount == _call->_user_xfer_digits.size()) + { + if (tmp == _call->_user_xfer_digits) + { + bool ret = doUserXferUnlocked(); + + _call->_user_xfer_buffer.clear(); + _call->_qsig_number.clear(); + _call->_digits_buffer.clear(); + + if(!_call->_flags.check(Kflags::XFER_QSIG_DIALING)) + { + Board::board(_pvt->target().device)->_timers.del(_idx_xfer_dial); + + DBG(FUNC, PVT_FMT(_pvt->target(), "r (ret=%s, done xfer)") % (ret ? "true" : "false")); + } + else + { + Board::board(_pvt->target().device)->_timers.restart(_idx_xfer_dial); + DBG(FUNC, PVT_FMT(_pvt->target(), "r (waiting digits for transfer)")); + } + return ret; + } + + if (_call->_flags.check(Kflags::XFER_QSIG_DIALING)) + { + DBG(FUNC, PVT_FMT(_pvt->target(), "putting digits ('%s') on transfer-to number!") % tmp); + + _call->_qsig_number += tmp[0]; + _call->_user_xfer_buffer.erase(0, 1); + Board::board(_pvt->target().device)->_timers.restart(_idx_xfer_dial); + + DBG(FUNC, PVT_FMT(_pvt->target(), "r (true, qsig transfer)")); + return true; + } + + _call->_digits_buffer += tmp[0]; + _call->_user_xfer_buffer.erase(0, 1); + DBG(FUNC, PVT_FMT(_pvt->target(), "r (false, no qsig)")); + return false; + } + + if (tmp == _call->_user_xfer_digits.substr(0,amount)) + { + if (!(_call->_flags.check(Kflags::XFER_DIALING) || _call->_flags.check(Kflags::XFER_QSIG_DIALING))) + { + _call->_flags.set(Kflags::XFER_DIALING); + _idx_xfer_dial = Board::board(_pvt->target().device)->_timers.add(Opt::_transferdigittimeout, &userXferTimer, _pvt, TM_VAL_CALL); + } + else + { + Board::board(_pvt->target().device)->_timers.restart(_idx_xfer_dial); + } + + DBG(FUNC, PVT_FMT(_pvt->target(), "r (true, buffering)")); + return true; + } + + if (_call->_flags.check(Kflags::XFER_QSIG_DIALING)) + { + DBG(FUNC, PVT_FMT(_pvt->target(), "putting digits ('%s') on transfer-to number!") % tmp); + + _call->_qsig_number += tmp[0]; + _call->_user_xfer_buffer.erase(0, 1); + + Board::board(_pvt->target().device)->_timers.restart(_idx_xfer_dial); + DBG(FUNC, PVT_FMT(_pvt->target(), "r (true, qsig buffering)")); + return true; + } + + } + catch (K3LAPI::invalid_device & err) + { + LOG(ERROR, PVT_FMT(_pvt->target(), "Unable to get device: %d!") % err.device); + } + + _call->_digits_buffer += tmp[0]; + _call->_user_xfer_buffer.erase(0, 1); + DBG(FUNC, PVT_FMT(_pvt->target(), "r (false, buffering)")); + + return false; + } + + static void userXferTimer(Board::KhompPvt * pvt) + { + DBG(FUNC, PVT_FMT(pvt->target(), "c")); + + T * call = static_cast<T *>(pvt->call()); + + try + { + ScopedPvtLock lock(pvt); + + if (!call->_user_xfer_buffer.empty()) + { + pvt->command(KHOMP_LOG, CM_DIAL_DTMF, call->_user_xfer_buffer.c_str()); + + /* clear the buffer that has been send */ + call->_user_xfer_buffer.clear(); + } + + if (!call->_qsig_number.empty()) + { + pvt->command(KHOMP_LOG, CM_SS_TRANSFER, + STG(FMT("transferred_to=\"%s\" await_connect=\"1\"") % call->_qsig_number).c_str()); + + /* clear the buffer that has been send */ + call->_qsig_number.clear(); + } + + call->_flags.clear(Kflags::XFER_DIALING); + call->_flags.clear(Kflags::XFER_QSIG_DIALING); + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(pvt->target(),"r (unable to lock %s!)") % err._msg.c_str() ); + return; + } + + DBG(FUNC, PVT_FMT(pvt->target(), "r")); + } + + static switch_status_t dtmfCallback(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen) + { + char sbuf[3]; + + if(!session) + { + DBG(FUNC,D("session is NULL")) + return SWITCH_STATUS_FALSE; + } + + switch_channel_t * chan = switch_core_session_get_channel(session); + + if(!chan) + { + DBG(FUNC,D("channel is NULL")) + return SWITCH_STATUS_FALSE; + } + + switch_core_session_t *peer_session = switch_core_session_locate(switch_channel_get_variable(chan,SWITCH_SIGNAL_BOND_VARIABLE)); + + if(!peer_session) + { + DBG(FUNC,D("session is NULL")) + return SWITCH_STATUS_FALSE; + } + + switch (itype) + { + case SWITCH_INPUT_TYPE_DTMF: + { + switch_dtmf_t *dtmf = (switch_dtmf_t *) input; + + Board::KhompPvt * tech_pvt = static_cast< Board::KhompPvt* >(switch_core_session_get_private(peer_session)); + if(!tech_pvt) + { + DBG(FUNC,D("Init: pvt is NULL")) + switch_core_session_rwunlock(peer_session); + return SWITCH_STATUS_FALSE; + } + + char s[] = { dtmf->digit, '\0' }; + tech_pvt->sendDtmf(s); + + break; + } + default: + break; + } + + switch_core_session_rwunlock(peer_session); + return SWITCH_STATUS_SUCCESS; + } + + + static int userXferPlayback(void * pvt_ptr) + { + /* get pointer... */ + Board::KhompPvt * pvt = static_cast < Board::KhompPvt * > (pvt_ptr); + + DBG(FUNC, PVT_FMT(pvt->target(), "c")); + + try + { + ScopedPvtLock lock(pvt); + + /* get the owner */ + switch_channel_t * chan = pvt->getFSChannel(); + + /* get other side of the bridge */ + switch_core_session_t * peer_session = NULL; + switch_core_session_get_partner(pvt->session(),&peer_session); + + if(!peer_session) + { + DBG(FUNC, PVT_FMT(pvt->target(), "r (session is null)")); + return NULL; + } + + switch_channel_t * peer = switch_core_session_get_channel(peer_session); + + /* put the channel in hold */ + //switch_core_session_t *session = switch_core_session_locate(switch_channel_get_variable(chan,SWITCH_SIGNAL_BOND_VARIABLE)); + //switch_channel_t *chan_core = switch_core_session_get_channel(session); + + const char *stream; + + if (!(stream = switch_channel_get_variable(chan, SWITCH_HOLD_MUSIC_VARIABLE))) + { + stream = "silence"; + } + + DBG(FUNC, PVT_FMT(pvt->target(), "stream=%s") % stream); + + if (stream && strcasecmp(stream, "silence")) + { + /* Freeswitch not get/put frames */ + //switch_channel_set_flag(channel, CF_HOLD); + switch_ivr_broadcast(switch_core_session_get_uuid(pvt->session()),stream, SMF_ECHO_ALEG | SMF_LOOP | SMF_PRIORITY); + } + + switch_core_session_rwunlock(peer_session); + lock.unlock(); + + /* kickstart my heart */ + switch_input_args_t args = {0}; + args.input_callback = dtmfCallback; + + /* wait while xfering... */ + while (true) + { + switch_ivr_collect_digits_callback(peer_session,&args,1000,0); + ScopedPvtLock lock2(pvt); + + if (!pvt->call()->_flags.check(Kflags::XFER_QSIG_DIALING)) + { + break; + } + + lock2.unlock(); + } + + //switch_channel_clear_flag(channel, CF_HOLD); + + switch_channel_stop_broadcast(chan); + switch_channel_wait_for_flag(chan, CF_BROADCAST, SWITCH_FALSE, 5000, NULL); + switch_core_session_rwunlock(pvt->session()); + switch_core_session_rwunlock(peer_session); + + //switch_ivr_unhold_uuid(switch_channel_get_variable(chan,SWITCH_SIGNAL_BOND_VARIABLE)); + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(pvt->target(),"r (unable to lock %s!)") % err._msg.c_str() ); + return NULL; + } + catch (Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR, PVT_FMT(pvt->target(), "r (%s)") % err._msg.c_str() ); + return NULL; + } + + DBG(FUNC, PVT_FMT(pvt->target(), "r")); + + return NULL; + } + + bool _is_ok; + T * _call; + Board::KhompPvt * _pvt; + Thread * _xfer_thread; + Board::ChanTimer::Index _idx_xfer_dial; +}; + +/*************************** SMS **********************************************/ +struct SMS : public Application +{ + typedef std::list< switch_core_session_t *> OwnersList; + + struct SMSStatistics : public Statistics + { + SMSStatistics(): + _sms_number_incoming(0), + _sms_number_outgoing(0), + _sms_number_confirm(0), + _sms_number_broadcast(0) {}; + + void incrementIncoming() + { + _sms_number_incoming++; + } + + void incrementOutgoing() + { + _sms_number_outgoing++; + } + + void incrementConfirm() + { + _sms_number_confirm++; + } + + void incrementBroadcast() + { + _sms_number_broadcast++; + } + + std::string getDetailed() + { + std::string tmpBuffer; + + tmpBuffer.append(STG(FMT("Number of incoming SMS: \t%d\n") % _sms_number_incoming)); + tmpBuffer.append(STG(FMT("Number of outgoing SMS: \t%d\n") % _sms_number_outgoing)); + tmpBuffer.append(STG(FMT("Number of broadcast SMS: \t%d\n") % _sms_number_broadcast)); + tmpBuffer.append(STG(FMT("Number of confirm SMS: \t%d\n") % _sms_number_confirm)); + + return tmpBuffer; + } + + void clear() + { + _sms_number_incoming = 0; + _sms_number_outgoing = 0; + _sms_number_confirm = 0; + _sms_number_broadcast = 0; + } + + unsigned int _sms_number_incoming; + unsigned int _sms_number_outgoing; + unsigned int _sms_number_confirm; + unsigned int _sms_number_broadcast; + }; + + SMS(Board::KhompPvt * pvt) : + Application(pvt), + _thread(NULL), + _shutdown(false), + _can_receive(false), + _can_send(false), + _result(0), + _mutex(Globals::module_pool), + _cond(Globals::module_pool), + _buffer(8) + { + _cond.reset(); + _app_statistics = new SMSStatistics(); + } + + ~SMS() + { + stop(); + delete _app_statistics; + } + + struct ReceiveData + { + ReceiveData() {}; + + ReceiveData(const ReceiveData & o) + { + _type = o._type; + _from = o._from; + _date = o._date; + _size = o._size; + _coding = o._coding; + _serial = o._serial; + _id = o._id; + _page = o._page; + _pages = o._pages; + _sc_date = o._sc_date; + _status = o._status; + _body = o._body; + }; + + void clear(void) + { + /* reset data stuff */ + _type.clear(); + _from.clear(); + _date.clear(); + _size.clear(); + _coding.clear(); + _serial.clear(); + _id.clear(); + _page.clear(); + _pages.clear(); + _sc_date.clear(); + _status.clear(); + _body.clear(); + }; + + std::string _type; + std::string _from; + std::string _date; + std::string _size; + std::string _coding; + std::string _serial; + std::string _id; + std::string _page; + std::string _pages; + std::string _sc_date; + std::string _status; + std::string _body; + }; + + struct SendData + { + SendData(): _conf(false) {}; + + SendData(const SendData & o) + { + _dest = o._dest; + _body = o._body; + _conf = o._conf; + }; + + void clear(void) + { + /* reset data stuff */ + _dest.clear(); + _body.clear(); + _conf = false; + }; + + std::string _dest; + std::string _body; + bool _conf; + }; + + struct Request + { + /* "empty" constructor */ + Request(): _finished(NULL), _cause(NULL) {}; + + /* "real" constructor */ + Request(SendData & send_sms, volatile bool * finished, volatile KGsmCallCause * cause) + : _send_sms(send_sms), _finished(finished), _cause(cause) + {}; + + SendData _send_sms; + + volatile bool * _finished; + volatile KGsmCallCause * _cause; + }; + + bool start() + { + _pvt->call()->_flags.clear(Kflags::SMS_DOING_UPLOAD); + + _thread = threadCreate(&smsThread, (void*) this); + _thread->start(); + } + + bool stop() + { + if(!_thread) + { + return false; + } + + _shutdown = true; + _cond.signal(); + _thread->join(); + delete _thread; + _thread = NULL; + + return true; + } + + bool justAlloc(unsigned int count = 0); + bool justStart(); + + bool sendSMS(switch_core_session_t * session, const char *data); + + + bool onNewSMS(K3L_EVENT *e); + bool onSMSInfo(K3L_EVENT *e); + bool onSMSData(K3L_EVENT *e); + bool onSMSSendResult(K3L_EVENT *e); + + Thread *_thread; + bool _shutdown; + bool _can_receive; + bool _can_send; + ReceiveData _got_sms; + SendData _send_sms; + int _result; + SavedCondition _cond; + Globals::Mutex _mutex; + Ringbuffer < SMS::Request > _buffer; + OwnersList _owners; + + static int smsThread(void * sms_ptr); +}; + +/******************************************************************************/ + + +#endif /* _APPLICATIONS_H_ */ + diff --git a/src/mod/endpoints/mod_khomp/include/cli.h b/src/mod/endpoints/mod_khomp/include/cli.h new file mode 100644 index 0000000..214e2aa --- /dev/null +++ b/src/mod/endpoints/mod_khomp/include/cli.h @@ -0,0 +1,1143 @@ +/******************************************************************************* + + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2010 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the LGPL + License. If you do not delete the provisions above, a recipient may use your + version of this file under either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*******************************************************************************/ + +#ifndef _CLI_H_ +#define _CLI_H_ + +#include "globals.h" +#include "logger.h" + +struct Command +{ + /* print in client the usage */ + void printUsage(switch_stream_handle_t *stream) + { + if(stream) + { + printBrief(stream); + K::Logger::Logg2(C_CLI,stream, +"------------------------------ Description --------------------------------"); + K::Logger::Logg2(C_CLI,stream, +"---------------------------------------------------------------------------"); + K::Logger::Logg2(C_CLI,stream,(char*) usage.c_str()); + K::Logger::Logg2(C_CLI,stream, +"---------------------------------------------------------------------------"); + } + else + { + LOG(ERROR,FMT("Invalid stream for commmand: %s") % complete_name); + } + } + + /* print in client the brief */ + void printBrief(switch_stream_handle_t *stream) + { + if(stream) + { + K::Logger::Logg2(C_CLI,stream, +"---------------------------------------------------------------------------"); + K::Logger::Logg2(C_CLI,stream, +"-------------------------------- Brief ------------------------------------"); + K::Logger::Logg2(C_CLI,stream, +"---------------------------------------------------------------------------"); + K::Logger::Logg2(C_CLI,stream,(char*) brief.c_str()); + K::Logger::Logg2(C_CLI,stream, +"---------------------------------------------------------------------------"); + } + else + { + LOG(ERROR,FMT("Invalid stream for commmand: %s") % complete_name); + } + } + + /* pure virtual */ + virtual bool execute(int argc, char *argv[]) = 0; + + std::string complete_name; /* specify the command in console */ + std::vector<std::string> options; /* extra options for command */ + std::string brief; /* brief of the command, a path */ + std::string usage; /* usage of the command, a help */ +}; + +struct Cli +{ + /* Useful definitions --------------------------------------------------- */ + typedef switch_status_t (APIFunc)(const char*, switch_core_session_t*, switch_stream_handle_t*); + typedef std::vector<Command*> Commands; + + /* register our commands, but you must create the command function */ + static void registerCommands(APIFunc func,switch_loadable_module_interface_t **mod_int); + + /* delete the commands */ + static void unregisterCommands() + { + switch_console_set_complete("del khomp"); + } + + /* stream is very useful */ + static void setStream(switch_stream_handle_t *s) + { + if(!s) + { + LOG(ERROR,"Invalid stream passed"); + return; + } + + stream = s; + } + + /* gets the khomp usage */ + static void printKhompUsage() + { + if(stream) + { + K::Logger::Logg2(C_CLI,stream,(char*) _khomp_usage.c_str()); + } + else + { + LOG(ERROR,"Invalid stream for command: printKhompUsage"); + } + } + + /* is responsible for parse and execute all commands */ + static bool parseCommands(int argc, char *argv[]); + + /* The Commands --------------------------------------------------------- */ + + /* khomp summary */ + static struct _KhompSummary : public Command + { + _KhompSummary(bool on_cli_term = true): + _on_cli_term(on_cli_term) + { + complete_name = "summary"; + + options.push_back("verbose"); + options.push_back("concise"); + + brief = "Print system info."; + usage = \ +"Prints detailed info about the system like API version and \n" \ +"boards characteristics like DSPs version.\n\n" \ +"Usage: khomp summary [concise]"; + + _commands.push_back(this); + }; + + bool execute(int argc, char *argv[]); + bool _on_cli_term; /* indicates if message is sent to fs_cli */ + } KhompSummary; + + /* khomp show calls */ + static struct _KhompShowCalls : public Command + { + _KhompShowCalls() + { + complete_name = "show calls"; + brief = \ +"Show each Khomp channel which have more than one call state associated."; + + usage = \ +"Show each Khomp channel which have more than one call state associated.\n\n" \ +"Usage: khomp show calls [<board> [<channel>]]"; + + _commands.push_back(this); + }; + + bool execute(int argc, char *argv[]); + + /* support function for _KhompShowCalls */ + void showCalls(unsigned int device, unsigned int object, std::string &buffer); + } KhompShowCalls; + + /* khomp channels disconnect */ + static struct _KhompChannelsDisconnect : public Command + { + _KhompChannelsDisconnect() + { + complete_name = "channels disconnect"; + brief = "Disconnect a(ll) channel(s)."; + usage = \ +"Disconnects channels in boards, or specific board/channel if parameter \n" \ +"is supplied.\n\n" \ +"Usage: khomp channels disconnect {all | <board> all | <board> <channel>}\n" \ +"\tboard -- Number of the board (start from 0).\n" \ +"\tchannel -- Number of the channel (start from 0).\n" \ +"e.g. khomp channels disconnect all - Disconnect all channels of all boards.\n"\ +"e.g. khomp channels disconnect 0 5 - Disconnect channel 5 of board 0."; + _commands.push_back(this); + }; + + bool execute(int argc, char *argv[]); + + /* support function for _KhompChannelsDisconnect */ + bool forceDisconnect(unsigned int device, unsigned int channel); + } KhompChannelsDisconnect; + + /* khomp channels unblock */ + static struct _KhompChannelsUnblock : public Command + { + _KhompChannelsUnblock() + { + complete_name = "channels unblock"; + brief = "Unblock a(ll) channel(s)."; + + usage = \ +"The board will request to the PBX or network where it is connected to \n" \ +"unblock the channel if its blocked.\n\n" \ +"Usage: khomp channels unblock {all | <board> all | <board> <channel>}\n" \ +"\tboard -- Number of the board (start from 0).\n" \ +"\tchannel -- Number of the channel (start from 0).\n" \ +"e.g. khomp channels unblock all - Unblock all channels of all boards.\n" \ +"e.g. khomp channels unblock 0 all - Unblock all channels of board 0.\n" \ +"e.g. khomp channels unblock 1 20 - Unblock channel 20 of board 1."; + + _commands.push_back(this); + }; + + bool execute(int argc, char *argv[]); + } KhompChannelsUnblock; + + /* khomp show statistics */ + static struct _KhompShowStatistics : public Command + { + _KhompShowStatistics() + { + complete_name = "show statistics"; + + options.push_back("verbose"); + options.push_back("detailed"); + + brief = "Shows statistics of the channels."; + + usage = \ +"Shows statistics of the channels, like number of calls incoming \n" \ +"and outgoing, status, status time.\n\n" \ +"Usage: khomp show statistics [{verbose [<board> [<channel>]]} | \n" \ +" {detailed <board> <channel>}]\n" \ +"\tboard -- Number of the board (start from 0).\n" \ +"\tchannel -- Number of the channel (start from 0).\n" \ +"e.g. khomp channels statistics - Shows general statistics \n" \ +" of all boards.\n" \ +"e.g. khomp channels statistics 0 - Shows general statistics \n" \ +" of board 0.\n" \ +"e.g. khomp channels statistics verbose - Shows general statistics \n" \ +" of all boards.\n" \ +"e.g. khomp channels statistics verbose 0 - Shows general statistics \n" \ +" of board 0.\n" \ +"e.g. khomp channels statistics detailed 0 2 - Shows detailed statistics \n" \ +" of channel 2 on board 0."; + + _commands.push_back(this); + }; + + bool execute(int argc, char *argv[]); + + /* support functions */ + void cliStatistics(unsigned int device); + void cliDetailedStatistics(unsigned int device, unsigned int channel); + + } KhompShowStatistics; + + /* khomp show channels */ + static struct _KhompShowChannels: public Command + { + _KhompShowChannels() + { + complete_name = "show channels"; + + options.push_back("verbose"); + options.push_back("concise"); + + brief = "Show all channels status."; + usage = \ +"List the status of each channel, both on asterisk point of view and on \n" \ +"khomp API point of view.\n\n" \ +"Usage: \n" \ +"khomp show channels [{<board> [<channel>]} | \n" \ + "{{concise|verbose} [<board> [<channel>]]}]\n" \ +"\tboard -- Number of the board (start from 0).\n" \ +"e.g. khomp show channels - List status of all channels of all boards.\n" \ +"e.g. khomp show channels concise 0 - List status of all channels of \n" \ +" board 0 in a concise way."; + + _commands.push_back(this); + }; + + /* support function for _KhompShowChannels */ + void showChannel(unsigned int device, bool concise, unsigned int channel); + void showChannels(unsigned int device, bool concise); + + bool execute(int argc, char *argv[]); + } KhompShowChannels; + + /* khomp show links */ + static struct _KhompShowLinks: public Command + { + _KhompShowLinks() + { + complete_name = "show links"; + + options.push_back("verbose"); + options.push_back("concise"); + options.push_back("errors"); + options.push_back("errors verbose"); + options.push_back("errors concise"); + + brief = "Show E1 link(s) status/errors counters in a concise \n" \ + "way or not."; + + usage = \ +"Prints information about the signaling, syncronization and general \n" \ +"status/the error counters of each link on the board. It prints in \n" \ +"a concise way for parsing facilities.\n\n" \ +"Usage: \n" \ +"khomp show links [[errors] [{<board>} | {{concise|verbose} [<board>]}]]\n" \ +"e.g. khomp show links - Show all links of all boards.\n" \ +"e.g. khomp show links errors - Show error counters of all links of \n" \ +" all boards.\n" \ +"e.g. khomp show links errors 0 - Show error counters of all links of \n" \ +" board 0."; + + _commands.push_back(this); + }; + + /* support function for _KhompShowLinks */ + void showLinks(unsigned int device, bool concise); + void showErrors(unsigned int device, bool concise); + + bool execute(int argc, char *argv[]); + } KhompShowLinks; + + /* khomp clear links */ + static struct _KhompClearLinks: public Command + { + _KhompClearLinks() + { + complete_name = "clear links"; + + brief = "Clear the error counters of the links."; + + usage = \ +"Clear the error counters of the links.\n\n" \ +"Usage: khomp clear links [<board> [<link>]]\n" \ +"\tboard -- Number of the board (start from 0).\n" \ +"\tlink -- Number of the link (start from 0).\n" \ +"e.g. khomp clear links 0 -- Clear error counters of all links of board 0."; + + _commands.push_back(this); + }; + + /* support function for _KhompClearLinks */ + void clearLink(unsigned int device, unsigned int link); + + bool execute(int argc, char *argv[]); + } KhompClearLinks; + + /* khomp clear statistics */ + static struct _KhompClearStatistics: public Command + { + _KhompClearStatistics() + { + complete_name = "clear statistics"; + + brief = "Clear statistics of the channels."; + + usage = \ +"Clear statistics of the channels, like number of calls incoming \n" \ +"and outgoing, status, status time.\n\n" \ +"Usage: khomp clear statistics [<board> [<channel>]]\n" \ +"\tboard -- Number of the board (start from 0).\n" \ +"\tchannel -- Number of the channel (start from 0).\n" \ +"e.g. khomp clear statistics 0 -- Clear statistics of board 0."; + _commands.push_back(this); + }; + + bool execute(int argc, char *argv[]); + } KhompClearStatistics; + + + /* khomp reset links */ + static struct _KhompResetLinks: public Command + { + _KhompResetLinks() + { + complete_name = "reset links"; + + brief = "Reset the specified link."; + + usage = \ +"Reset the specified link.\n\n" \ +"Usage: khomp reset links [<board> [<link>]]\n" \ +"\tboard -- Number of the board (start from 0).\n" \ +"\tlink -- Number of the link (start from 0).\n" \ +"e.g. khomp reset links 0 1 -- Reset link 1 of board 0."; + + _commands.push_back(this); + }; + + /* support function for _KhompResetLinks */ + void resetLink(unsigned int device, unsigned int link); + + bool execute(int argc, char *argv[]); + } KhompResetLinks; + + /* khomp sms */ + static struct _KhompSMS : public Command + { + _KhompSMS() + { + complete_name = "sms"; + brief = "Send an SMS message using a Khomp KGSM board."; + + usage = \ +"Send an SMS message using a Khomp KGSM board.\n\n" \ +"Usage: khomp sms <device> <destination> <message..>\n" \ +"\tdevice -- Device to use (same string used in Dial for \n" \ +"\t channel allocation).\n" \ +"\tdestination -- Phone number of the destination.\n" \ +"\tmessage -- Message to send.\n" \ +"e.g. khomp sms b0 99887766 Oi, tudo bem?"; + + _commands.push_back(this); + }; + + bool execute(int argc, char *argv[]); + } KhompSMS; + + /* khomp log console */ + static struct _KhompLogConsole : public Command + { + _KhompLogConsole() + { + complete_name = "log console"; + + options.push_back("errors"); + options.push_back("warnings"); + options.push_back("messages"); + options.push_back("events"); + options.push_back("commands"); + options.push_back("audio"); + options.push_back("modem"); + options.push_back("link"); + options.push_back("cas"); + options.push_back("standard"); + options.push_back("all"); + options.push_back("no"); + options.push_back("just"); + + brief = "Enables/disables showing console messages for the channel."; + usage = \ +"Enables/disables showing channel messages, where <options> can be:\n" \ +"\terrors -- Error messages, when something goes really \n" \ +"\t wrong. Enabled by default.\n" \ +"\twarnings -- Warnings, used when something might not be \n" \ +"\t going as expected. Enabled by default.\n" \ +"\tmessages -- Generic messages, used to indicate some \n" \ +"\t information. Enabled by default.\n" \ +"\tevents -- Show received K3L events as console \n" \ +"\t messages. Disabled by default.\n" \ +"\tcommands -- Show sent K3L commands as console \n" \ +"\t messages. Disabled by default.\n" \ +"\taudio -- Enable messages for K3L audio events. \n" \ +"\t Disabled by default (very verbose!).\n" \ +"\tmodem -- Enable messages for data received from \n" \ +"\t KGSM modems. Disabled by default.\n" \ +"\tlink -- Enable logging of link status changes. \n" \ +"\t Enabled by default.\n" \ +"\tcas -- Enable logging of MFCs and line state \n" \ +"\t changes in KPR board. Disabled by default.\n" \ +"\tstandard -- Special identifier, enable default \n" \ +"\t console messages.\n" \ +"\tall -- Special identifier, enable ALL console \n" \ +"\t messages (should not be used naively).\n\n" \ +"Usage: khomp log console <options>\n" \ +"e.g. khomp log console standard"; + + _commands.push_back(this); + } + + bool execute(int argc, char *argv[]); + } KhompLogConsole; + + /* khomp log disk */ + static struct _KhompLogDisk : public Command + { + _KhompLogDisk() + { + complete_name = "log disk"; + + options.push_back("errors"); + options.push_back("warnings"); + options.push_back("messages"); + options.push_back("events"); + options.push_back("commands"); + options.push_back("audio"); + options.push_back("modem"); + options.push_back("link"); + options.push_back("cas"); + options.push_back("functions"); + options.push_back("threads"); + options.push_back("locks"); + options.push_back("streams"); + options.push_back("standard"); + options.push_back("debugging"); + options.push_back("all"); + options.push_back("no"); + options.push_back("just"); + + brief = "Enables/disables logging to file messages for the channel."; + usage = \ +"Enables/disables the logging of channel messages to disk, where <options> \n" \ +"can be:\n" \ +"\terrors -- Error messages, when something goes really \n" \ +"\t wrong. Enabled by default.\n" \ +"\twarnings -- Warnings, used when something might not be \n" \ +"\t going as expected. Enabled by default.\n" \ +"\tmessages -- Generic messages, used to indicate some \n" \ +"\t information. Enabled by default.\n" \ +"\tevents -- Record received K3L events as log messages. \n" \ +"\t Disabled by default.\n" \ +"\tcommands -- Record sent K3L commands as log messages. \n" \ +"\t Disabled by default.\n" \ +"\taudio -- Enable messages for K3L audio events. \n" \ +"\t Disabled by default (very verbose!).\n" \ +"\tmodem -- Enable messages for data received from \n" \ +"\t KGSM modems. Disabled by default.\n" \ +"\tlink -- Enable logging of link status changes. \n" \ +"\t Enabled by default.\n" \ +"\tcas -- Enable logging of MFCs and line state \n" \ +"\t changes in KPR board. Disabled by default.\n" \ +"\tfunctions -- Enable debugging for functions. Disabled \n" \ +"\t by default (should not be used naively!).\n" \ +"\tthreads -- Enable debugging for threads. Disabled by \n" \ +"\t default (should not be used naively!).\n" \ +"\tlocks -- Enable debugging for locks. Disabled by \n" \ +"\t default (should not be used naively!).\n" \ +"\tstreams -- Enable debugging for streams. Disabled by \n" \ +"\t default (should not be used naively!).\n" \ +"\tstandard -- Special identifier, enable default messages.\n" \ +"\tdebugging -- Special identifier, enable debugging messages \n" \ +"\t (should not be used naively).\n" \ +"\tall -- Special identifier, enable ALL disk \n" \ +"\t messages (DO NOT USE THIS!).\n\n" \ +"Usage: khomp log disk <options>\n" \ +"e.g. khomp log disk <options>"; + + _commands.push_back(this); + } + + bool execute(int argc, char *argv[]); + } KhompLogDisk; + + /* khomp log trace k3l */ + static struct _KhompLogTraceK3L : public Command + { + _KhompLogTraceK3L() + { + complete_name = "log trace k3l"; + + options.push_back("on"); + options.push_back("off"); + + brief = "Set K3L tracing (debug) option."; + + usage = \ +"Sets the low-level log for K3L API. Should not be set for long time \n" \ +"periods.\n\n" \ +"Usage: khomp log trace k3l {on|off}\n" \ +"e.g. khomp log trace k3l on"; + + _commands.push_back(this); + } + + bool execute(int argc, char *argv[]); + } KhompLogTraceK3L; + + /* khomp log trace ISDN */ + static struct _KhompLogTraceISDN : public Command + { + _KhompLogTraceISDN() + { + complete_name = "log trace isdn"; + + options.push_back("q931"); + options.push_back("lapd"); + options.push_back("system"); + options.push_back("off"); + + brief = "Set ISDN signaling trace."; + + usage = \ +"Sets the low-level log for ISDN signalling. Should not be set for \n" \ +"long time periods.\n\n" \ +"Usage: khomp log trace isdn <what>[,<what2>[,..]]\n" \ +"\twhat -- \"q931\", \"lapd\", \"system\" or \"off\" \n" \ +"\t (comma-separated values).\n" \ +"e.g. khomp log trace isdn q931,system"; + + _commands.push_back(this); + } + + bool execute(int argc, char *argv[]); + } KhompLogTraceISDN; + + /* khomp log trace R2 */ + static struct _KhompLogTraceR2 : public Command + { + _KhompLogTraceR2() + { + complete_name = "log trace r2"; + + options.push_back("on"); + options.push_back("off"); + + brief = "Set R2 signaling trace."; + + usage = \ +"Sets the low-level log monitor for R2 digital signalling. Should not \n" \ +"be set for long time periods.\n\n" \ +"Usage: khomp log trace r2 {on|off}\n" \ +"e.g. khomp log trace r2 on"; + + _commands.push_back(this); + } + + bool execute(int argc, char *argv[]); + } KhompLogTraceR2; + + /* khomp get */ + static struct _KhompGet : public Command + { + _KhompGet() + { + complete_name = "get"; + + options.push_back("echo-canceller"); + options.push_back("out-of-band-dtmfs"); + options.push_back("auto-fax-adjustment"); + options.push_back("pulse-forwarding"); + options.push_back("r2-strict-behaviour"); + options.push_back("r2-preconnect-wait"); + options.push_back("native-bridge"); + options.push_back("suppression-delay"); + options.push_back("context-fxo"); + options.push_back("context-fxo-alt"); + options.push_back("context-fxs"); + options.push_back("context-fxs-alt"); + options.push_back("context-gsm-call"); + options.push_back("context-gsm-call-alt"); + options.push_back("context-gsm-sms"); + options.push_back("context-digital"); + options.push_back("output-volume"); + options.push_back("input-volume"); + + brief = "Get configuration options in the Khomp channel."; + + usage = \ +"Usage: khomp get <option>\n" \ +"<option> -- Shown below, with a short description each.\n\n" \ +"Option Description\n" \ +"echo-canceller Gets the echo cancellation procedures if they are \n" \ +" avaliable.\n" \ +"out-of-band-dtmfs Gets DTMFs to be sent out-of-band (using ast_frames) \n" \ +" instead of in-band (audio).\n" \ +"auto-fax-adjustment Gets the automatic adjustment for FAX (mainly, \n" \ +" disables the echo canceller).\n" \ +"pulse-forwarding Gets the forwarding of detected pulses as DTMF tones.\n" \ +"r2-strict-behaviour Gets the R2 protocol behavior while answering lines.\n" \ +"r2-preconnect-wait Sets the R2 protocol delay to pre-connect after \n" \ +" sending ringback signal.\n" \ +"native-bridge Enable/disable the native bridge mode for the channel.\n"\ +"suppression-delay Enable/disable the internal buffer for DTMF \n" \ +" suppression.\n" \ +"context-fxo Context (may be a template) for receiving FXO calls.\n" \ +"context-fxo-alt Alternative context (may be a template) for \n" \ +" receiving FXO calls.\n" \ +"context-fxs Context (may be a template) for receiving FXS calls.\n" \ +"context-fxs-alt Alternative context (may be a template) for \n" \ +" receiving FXS calls.\n" \ +"context-gsm-call Context (may be a template) for receiving GSM calls.\n" \ +"context-gsm-call-alt Alternative context (may be a template) for \n" \ +" receiving GSM calls.\n" \ +"context-gsm-sms Context (may be a template) for receiving GSM \n" \ +" messages.\n" \ +"context-digital Context (may be a template) for receiving digital \n" \ +" (E1) calls.\n" \ +"output-volume Gets the volume multiplier to be applied by the \n" \ +" board over the output audio.\n" \ +"input-volume Gets the volume multiplier to be applied by the \n" \ +" board over the input audio.\n\n" \ +"FOR ALL COMMANDS, CHECK THE DOCUMENTATION."; + + _commands.push_back(this); + }; + + bool execute(int argc, char *argv[]); + } KhompGet; + + /* khomp set */ + static struct _KhompSet : public Command + { + _KhompSet() + { + complete_name = "set"; + + options.push_back("echo-canceller"); + options.push_back("out-of-band-dtmfs"); + options.push_back("auto-fax-adjustment"); + options.push_back("pulse-forwarding"); + options.push_back("r2-strict-behaviour"); + options.push_back("r2-preconnect-wait"); + options.push_back("native-bridge"); + options.push_back("suppression-delay"); + options.push_back("context-fxo"); + options.push_back("context-fxo-alt"); + options.push_back("context-fxs"); + options.push_back("context-fxs-alt"); + options.push_back("context-gsm-call"); + options.push_back("context-gsm-call-alt"); + options.push_back("context-gsm-sms"); + options.push_back("context-digital"); + options.push_back("output-volume"); + options.push_back("input-volume"); + brief = "Ajust configuration options in the Khomp channel."; + + usage = \ +"Usage: khomp set <option> <value>\n" \ +"\t<option> -- Shown below, with a short description each.\n" \ +"\t<value> -- Depends on the option. Check the documentation for \n" \ +"\t more info.\n\n" \ +"Option Description\n" \ +"echo-canceller Sets the echo cancellation procedures if they are \n" \ +" avaliable.\n" \ +"out-of-band-dtmfs Sets DTMFs to be sent out-of-band (using ast_frames) \n" \ +" instead of in-band (audio).\n" \ +"auto-fax-adjustment Sets the automatic adjustment for FAX (mainly, \n" \ +" disables the echo canceller).\n" \ +"pulse-forwarding Sets the forwarding of detected pulses as DTMF tones.\n" \ +"r2-strict-behaviour Sets the R2 protocol behavior while answering lines.\n" \ +"r2-preconnect-wait Sets the R2 protocol delay to pre-connect after \n" \ +" sending ringback signal.\n" \ +"native-bridge Enable/disable the native bridge mode for the channel.\n"\ +"suppression-delay Enable/disable the internal buffer for DTMF \n" \ +" suppression.\n" \ +"context-fxo Context (may be a template) for receiving FXO calls.\n" \ +"context-fxo-alt Alternative context (may be a template) for \n" \ +" receiving FXO calls.\n" \ +"context-fxs Context (may be a template) for receiving FXS calls.\n" \ +"context-fxs-alt Alternative context (may be a template) for \n" \ +" receiving FXS calls.\n" \ +"context-gsm-call Context (may be a template) for receiving GSM calls.\n" \ +"context-gsm-call-alt Alternative context (may be a template) for \n" \ +" receiving GSM calls.\n" \ +"context-gsm-sms Context (may be a template) for receiving GSM \n" \ +" messages.\n" \ +"context-digital Context (may be a template) for receiving digital \n" \ +" (E1) calls.\n" \ +"output-volume Sets the volume multiplier to be applied by the \n" \ +" board over the output audio.\n" \ +"input-volume Sets the volume multiplier to be applied by the \n" \ +" board over the input audio.\n\n" \ +"FOR ALL COMMANDS, CHECK THE DOCUMENTATION."; + + _commands.push_back(this); + }; + + bool execute(int argc, char *argv[]); + } KhompSet; + + /* khomp log rotate */ + static struct _KhompLogRotate : public Command + { + _KhompLogRotate() + { + complete_name = "log rotate"; + brief = "Rotate the files where the messages are being logged."; + + usage = \ +"Rotate the files where the messages are being logged.\n\n" \ +"Usage: khomp log rotate"; + + _commands.push_back(this); + } + + bool execute(int argc, char *argv[]); + } KhompLogRotate; + + /* khomp log status */ + static struct _KhompLogStatus : public Command + { + _KhompLogStatus() + { + complete_name = "log status"; + brief = "Show the status of the messages."; + + usage = \ +"Show the status of the message system (enabled/disabled messages).\n\n" \ +"Usage: khomp log status"; + + _commands.push_back(this); + } + + bool execute(int argc, char *argv[]); + } KhompLogStatus; + + /* khomp revision */ + static struct _KhompRevision : public Command + { + _KhompRevision() + { + complete_name = "revision"; + brief = "Show revision number."; + + usage = \ +"Show the internal revision number for this channel.\n\n" \ +"Usage: khomp revision"; + + _commands.push_back(this); + } + + bool execute(int argc, char *argv[]); + } KhompRevision; + + /* khomp send command */ + static struct _KhompSendCommand : public Command + { + _KhompSendCommand() + { + complete_name = "send command"; + brief = "Send an K3L API command directly to the board."; + + usage = \ +"Send an K3L API command directly to the board.\n" \ +"WARNING: This command is for debugging only - just use if you know \n" \ +"what you are doing!\n\n" \ +"Usage: khomp send command <board> <channel> <command> [argument]\n" \ +"\tboard -- Number of the board (start from 0).\n" \ +"\tchannel -- Number of the channel (start from 0).\n" \ +"\tcommand -- Number of API command (should be consulted in separate docs).\n"\ +"\targument -- Optimal string to use as parameter for the command.\n" \ +"e.g. khomp send command 0 1 4 123456 - Send DTMFs 123456 throught \n" \ +" channel 1 on board 0."; + + _commands.push_back(this); + }; + + bool execute(int argc, char *argv[]); + } KhompSendCommand; + + /* khomp send raw */ + static struct _KhompSendRawCommand : public Command + { + _KhompSendRawCommand() + { + complete_name = "send raw command"; + brief = "Send an command directly to a DSP at the board."; + + usage = \ +"Send an command directly to some DSP at the board.\n" \ +"WARNING: This command is for debugging only - just use if you know \n" \ +"what you are doing!\n\n" \ +"Usage: khomp send raw command <board> <dsp> <c0> <c1> [...]\n" \ +"\tboard -- Number of the board (start from 0).\n" \ +"\tchannel -- Number of the channel (start from 0).\n" \ +"\tdsp -- Number of the DSP.\n" \ +"\tc0, c1, ... -- Hexadecimal numbers for the command.\n" \ +"e.g. khomp send raw command 0 1 0x4a 0x00 0x00 - Disables the internal \n" \ +" audio delay on board 0."; + + _commands.push_back(this); + }; + + bool execute(int argc, char *argv[]); + } KhompSendRawCommand; + + /* khomp select sim */ + static struct _KhompSelectSim : public Command + { + _KhompSelectSim() + { + complete_name = "select sim"; + + brief = "Select SIM card, available to Khomp KGSM boards."; + + usage = \ +"Select SIM card, available to Khomp KGSM boards.\n\n" \ +"Usage: khomp select sim <board> <channel> <sim_card>\n" \ +"\tboard -- Number of the board (start from 0).\n" \ +"\tchannel -- Number of the channel (start from 0), identifies \n" \ +"\t the modem inside the board.\n" \ +"\tsim_card -- Number for the SIM card to select.\n" \ +"e.g. khomp select sim 0 0 2"; + + _commands.push_back(this); + }; + + bool execute(int argc, char *argv[]); + } KhompSelectSim; + + /* khomp kommuter */ + static struct _KhompKommuterOnOff : public Command + { + _KhompKommuterOnOff() + { + complete_name = "kommuter"; + + options.push_back("on"); + options.push_back("off"); + + brief = "Activate and deactives the Kommuter devices."; + + usage = \ +"Manually activates or deactivates all kommuters connected to this machine.\n" \ +"This command will only be sent if kommuter-activation variable in \n" \ +"khomp.conf is set to manual. All kommuter devices will be configure with \n" \ +"the timeout defined in kommuter-timeout.\n\n" \ +"Usage: khomp kommuter {on|off}\n" \ +"\ton -- Turn ON kommuter devices on this machine.\n" \ +"\toff -- Turn OFF kommuter devices on this machine."; + + _commands.push_back(this); + }; + + bool execute(int argc, char *argv[]); + } KhompKommuterOnOff; + + /* khomp kommuter count */ + static struct _KhompKommuterCount : public Command + { + _KhompKommuterCount() + { + complete_name = "kommuter count"; + + brief = "Prints the number of Kommuter devices."; + + usage = \ +"Prints the number of Kommuter devices connected to this machine.\n\n" \ +"Usage: khomp kommuter count"; + + _commands.push_back(this); + }; + + bool execute(int argc, char *argv[]); + } KhompKommuterCount; + +protected: + static switch_stream_handle_t* stream; + static switch_loadable_module_interface_t **module_interface; + static Commands _commands; + static std::string _khomp_usage; +}; + +/******************************************************************************/ +/******************************* Command Tree ********************************* + +This tree is a overview for all commands in our module, +when a command is added, deleted or modified, please, update our tree. + ++ khomp +| ++ ---- channels +| | +- + ---- disconnect +| | +- + ---- unblock +| ++ ---- show +| | +- + ---- calls +| | +- + ---- channels +| | | +- - + ---- verbose +| | | +- - + ---- concise +| | +- + ---- statistics +| | | +- - + ---- detailed +| | | +- - + ---- verbose +| | +- + ---- links +| | +- + ---- errors +| | +- + ---- verbose +| | +- + ---- concise +| ++ ---- reset +| | +- + ---- links +| ++ ---- clear +| | +- + ---- links +| | +- + ---- errors +| | +- + ---- statistics +| ++ ---- log +| | +- + ---- console +| | | +- - + ---- errors +| | | +- - + ---- warnings +| | | +- - + ---- messages +| | | +- - + ---- events +| | | +- - + ---- commands +| | | +- - + ---- audio +| | | +- - + ---- link +| | | +- - + ---- cas +| | | +- - + ---- standard +| | | +- - + ---- all +| | +- + ---- disk +| | | +- - + ---- errors +| | | +- - + ---- warnings +| | | +- - + ---- messages +| | | +- - + ---- events +| | | +- - + ---- commands +| | | +- - + ---- audio +| | | +- - + ---- modem +| | | +- - + ---- link +| | | +- - + ---- cas +| | | +- - + ---- functions +| | | +- - + ---- threads +| | | +- - + ---- locks +| | | +- - + ---- streams +| | | +- - + ---- standard +| | | +- - + ---- debugging +| | | +- - + ---- all +| | +- + ---- rotate +| | +- + ---- status +| | +- + ---- trace +| | +- + ---- isdn +| | | +- - + ---- q931 +| | | +- - + ---- lapd +| | | +- - + ---- system +| | | +- - + ---- off +| | +- + ---- k3l +| | | +- - + ---- on +| | | +- - + ---- off +| | +- + ---- r2 +| | +- + ---- on +| | +- + ---- off +| ++ ---- send +| | +- + ---- command +| | +- + ---- raw +| ++ ---- get +| ++ ---- set +| ++ ---- select +| | +- + ---- sim +| ++ ---- sms +| ++ ---- summary +| | +- + ---- concise +| | +- + ---- verbose +| ++ ---- revision +| ++ ---- kommuter + | + + ---- on + | + + ---- off + + ******************************************************************************/ +/******************************************************************************/ + +#endif + diff --git a/src/mod/endpoints/mod_khomp/include/defs.h b/src/mod/endpoints/mod_khomp/include/defs.h new file mode 100644 index 0000000..f296882 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/include/defs.h @@ -0,0 +1,211 @@ +/******************************************************************************* + + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2010 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the LGPL + License. If you do not delete the provisions above, a recipient may use your + version of this file under either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*******************************************************************************/ + +#ifndef _DEFS_H_ +#define _DEFS_H_ + +/* formatation macros */ +#include "switch_version.h" +#include "revision.h" + +#define KHOMP_LOG __FILE__, __SWITCH_FUNC__, __LINE__ +#define KHOMP_EVENT_MAINT "khomp::maintenance" + +#define OBJ_FMT(dev,obj,msg) \ + FMT("%s (d=%02d,c=%03d) " msg) % __SWITCH_FUNC__ % dev % obj + +#define OBJ_MSG(dev,obj,msg) \ + "%s (d=%02d,c=%03d) " msg, __SWITCH_FUNC__, dev, obj + +#define PVT_FMT(tgt,msg) \ + FMT("%s (d=%02hu,c=%03hu) " msg) % __SWITCH_FUNC__ % tgt.device % tgt.object + +#define PVT_MSG(tgt,msg) \ + "%s (d=%02hu,c=%03hu) " msg, __SWITCH_FUNC__, tgt.device, tgt.object + +#define D(x) ( FMT( "%s: " x ) % __func__ ) + +#define STR(fmt) \ + STG(fmt).c_str() + +/* version controller macro */ +#define SWITCH_LESS_THAN(x,y,z) \ + (FS_VERSION_MICRO != -1) && \ + (((FS_VERSION_MAJOR == x) && (FS_VERSION_MINOR == y) && (FS_VERSION_MICRO <= z)) || \ + ((FS_VERSION_MAJOR == x) && (FS_VERSION_MINOR < y)) || (FS_VERSION_MAJOR < x)) + +/* signalling groups macro */ +#define CASE_R2_SIG \ + case ksigR2Digital: \ + case ksigContinuousEM: \ + case ksigPulsedEM: \ + case ksigUserR2Digital: \ + case ksigOpenCAS: \ + case ksigOpenR2 +/* + case ksigLineSide: \ + case ksigCAS_EL7: \ + case ksigE1LC +*/ + +#define CASE_RDSI_SIG \ + case ksigPRI_EndPoint: \ + case ksigPRI_Network: \ + case ksigPRI_Passive: \ + case ksigOpenCCS + +#define CASE_FLASH_GRP \ + case ksigLineSide: \ + case ksigCAS_EL7: \ + case ksigE1LC + +/******************************************************************************/ + +/* Buffering size constants */ + +#define SILENCE_PACKS 2 + +#define KHOMP_READ_PACKET_TIME 16 // board sample (ms) + +#define KHOMP_READ_PACKET_SIZE (KHOMP_READ_PACKET_TIME * 8) // asterisk sample size (bytes) + +#define KHOMP_MIN_READ_PACKET_SIZE (10 * 8) // min size to return on khomp_read +#define KHOMP_MAX_READ_PACKET_SIZE (30 * 8) // max size to return on khomp_read + +#define KHOMP_AUDIO_BUFFER_SIZE (KHOMP_READ_PACKET_SIZE * 8) // buffer size (bytes) + +/* debug and log macros */ +#define DBG(x,y) \ + { \ + if (K::Logger::Logg.classe( C_DBG_##x ).enabled()) \ + K::Logger::Logg( C_DBG_##x , y ); \ + } + +#define LOG(x,y) \ + { \ + K::Logger::Logg( C_##x , y ); \ + } + +#define LOGC(x,y) \ + { \ + if (K::Logger::Logg.classe( C_##x ).enabled()) \ + LOG( x , y ); \ + } + +/* useful to debug arguments */ +#define DEBUG_CLI_CMD() \ +{ \ + K::Logger::Logg2(C_CLI,stream,FMT("argc: %d ") % argc); \ + for(int i = 0;i< argc;i++) \ + K::Logger::Logg2(C_CLI,stream,FMT("argv[%d]:%s ") % i % argv[i]); \ +} + +/* macros to cli commands */ +#define ARG_CMP(a,b) (argv[a] && !strncasecmp(argv[a],b,sizeof(b))) +#define EXEC_CLI_CMD(command) Cli::command.execute(argc,argv) + +/* macro to string treats */ +#define SAFE_sprintf(a, ...) snprintf(a,sizeof(a), __VA_ARGS__) +#define SAFE_strcasecmp(a,b) strncasecmp(a, b, sizeof(b)) + +/* tags for timers */ +#define TM_VAL_CALL (unsigned int)0x01 +#define TM_VAL_CHANNEL (unsigned int)0x02 + +/* macro to creating contexts */ +#define BEGIN_CONTEXT do +#define END_CONTEXT while(false); + +/* Define log type */ +typedef enum +{ + C_CLI, /* cli msgs */ + + C_ERROR, /* errors */ + C_WARNING, /* warnings */ + C_MESSAGE, /* normal msgs */ + + C_EVENT, /* k3l events */ + C_COMMAND, /* k3l commands */ + + C_AUDIO_EV, /* k3l audio events */ + C_MODEM_EV, /* gsm modem events */ + C_LINK_STT, /* link status msgs */ + C_CAS_MSGS, /* cas events msgs */ + + C_DBG_FUNC, + C_DBG_LOCK, + C_DBG_THRD, + C_DBG_STRM, + + C_DBG_CONF, +} +class_type; + +typedef enum +{ + O_CONSOLE, + O_GENERIC, + O_R2TRACE, +} +output_type; + +typedef enum +{ + SCE_SHOW_WARNING, + SCE_SHOW_DEBUG, + SCE_SHOW_SAME, + SCE_HIDE +} +send_cmd_error_type; + +typedef enum +{ + T_UNKNOWN = 2, + T_TRUE = 1, + T_FALSE = 0, +} +TriState; + + +#endif diff --git a/src/mod/endpoints/mod_khomp/include/frame.h b/src/mod/endpoints/mod_khomp/include/frame.h new file mode 100644 index 0000000..87b968b --- /dev/null +++ b/src/mod/endpoints/mod_khomp/include/frame.h @@ -0,0 +1,160 @@ +/******************************************************************************* + + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2010 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the LGPL + License. If you do not delete the provisions above, a recipient may use your + version of this file under either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*******************************************************************************/ + +#ifndef _FRAME_HPP_ +#define _FRAME_HPP_ + +#include <stdlib.h> +#include <sys/mman.h> + +#include <ringbuffer.hpp> + +#include "globals.h" + +struct FrameStorage +{ + static const unsigned int frame_count = 24;//6; + static const unsigned int audio_count = 24;//4; + + FrameStorage(switch_codec_t * codec, int packet_size); + virtual ~FrameStorage(); + + inline switch_frame_t * next_frame(void) + { + return &(_frames[next_index()]); + } + + inline unsigned int next_index() + { + unsigned int tmp = _index; + + if (++_index >= frame_count) + _index = 0; + + return tmp; + } + + inline switch_frame_t * cng_frame(void) + { + return &_cng_frame; + } + + char * audio_buffer() + { + return _buffer; + }; + + private: + switch_frame_t _cng_frame; + + switch_frame_t * _frames; + char * _buffer; + + unsigned int _index; +}; + +/* Internal frame array structure. */ +template < int S > +struct FrameManager: protected FrameStorage +{ + typedef char Packet[ S ]; + + typedef Ringbuffer < Packet > AudioBuffer; + + FrameManager(switch_codec_t * codec) + : FrameStorage(codec, S), + _audio(audio_count, (Packet*)audio_buffer()) + {}; + +// ~FrameManager(); + + // may throw Ringbuffer::BufferEmpty + switch_frame_t * pick(void) + { + try + { + /* try to consume from buffer.. */ + Packet & a = _audio.consumer_start(); + + switch_frame * f = next_frame(); + + /* adjust pointer */ + f->data = (char *)(&a); + + /* advance now */ + _audio.consumer_commit(); + + return f; + } + catch (...) // AudioBuffer::BufferEmpty & e) + { + return NULL; + } + } + + // may throw Ringbuffer::BufferFull + bool give(const char * buf, unsigned int size) + { + return _audio.provider_partial(buf, size); + } + + switch_frame_t * cng(void) + { + return cng_frame(); + } + + void clear() + { + _audio.clear(); + } + + protected: + AudioBuffer _audio; + + unsigned int _index; +}; + +typedef FrameManager < Globals::switch_packet_size > FrameSwitchManager; +typedef FrameManager < Globals::boards_packet_size > FrameBoardsManager; + +#endif /* _FRAME_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/include/globals.h b/src/mod/endpoints/mod_khomp/include/globals.h new file mode 100644 index 0000000..f212d63 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/include/globals.h @@ -0,0 +1,119 @@ +/******************************************************************************* + + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2010 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the LGPL + License. If you do not delete the provisions above, a recipient may use your + version of this file under either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*******************************************************************************/ + +#ifndef _GLOBALS_H_ +#define _GLOBALS_H_ +#include "k3lapi.hpp" + +#include <config_options.hpp> +#include <k3lutil.hpp> +#include <verbose.hpp> +#include <regex.hpp> +#include <timer.hpp> + +#include <vector> +#include <string> +#include <fstream> + +#include <simple_lock.hpp> + +extern "C" +{ + #include <switch.h> +} + +/* As this is a static-variable-only struct, member variable * + * names need not to get "_" in front of the name */ + +struct Globals +{ + typedef void * global_timer_data; + typedef void (global_timer_func)(global_timer_data); + typedef TimerTemplate < global_timer_func, global_timer_data > GlobalTimer; + + typedef SimpleNonBlockLock<25,100> Mutex; + + /* FreeSWITCH variables for packets and buffer */ + // in ms + static const unsigned int switch_packet_duration = 30; + static const unsigned int boards_packet_duration = 24; + // in bytes + static const unsigned int switch_packet_size = switch_packet_duration * 8; + static const unsigned int boards_packet_size = boards_packet_duration * 8; + static const unsigned int cng_buffer_size = (switch_packet_size > boards_packet_size ? switch_packet_size : boards_packet_size); + + /* Father */ + static K3LAPI k3lapi; + + /* Son */ + static K3LUtil k3lutil; + + /* Holy Spirit */ + static Verbose verbose; + + /* Global timer */ + static GlobalTimer * global_timer; + + /* Mutex to KhompPvt allocation */ + static Mutex khomp_alloc_mutex; + + /* Config options class */ + static ConfigOptions options; + + /* FreeSWITCH Articular Ligaments */ + static switch_endpoint_interface_t * khomp_endpoint_interface; + static switch_endpoint_interface_t * khomp_sms_endpoint_interface; + static switch_endpoint_interface_t * khomp_pr_endpoint_interface; + static switch_application_interface_t * khomp_app_inteface; + static switch_api_interface_t * api_interface; + static switch_memory_pool_t * module_pool; + + /* Still a nice workaround */ + volatile static bool logs_being_rotated; + + /* Trace flags */ + static bool flag_trace_rdsi; +}; + +#endif /* _GLOBALS_H_ */ + diff --git a/src/mod/endpoints/mod_khomp/include/k3l.h b/src/mod/endpoints/mod_khomp/include/k3l.h new file mode 100644 index 0000000..046bd66 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/include/k3l.h @@ -0,0 +1,1996 @@ +/******************************************************************************* + + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2010 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the LGPL + License. If you do not delete the provisions above, a recipient may use your + version of this file under either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*******************************************************************************/ + +#ifndef _GENERATED_K3L_H_ +#define _GENERATED_K3L_H_ +#if !defined KLTYPEDEFS_H +#define KLTYPEDEFS_H +#if defined( _WINDOWS ) || defined( _Windows ) || defined( _WIN32 ) + #ifndef KWIN32 + #define KWIN32 1 + #endif +#endif + +#ifdef KWIN32 + typedef __int64 int64; + typedef unsigned __int64 uint64; + #define Kstdcall __stdcall +#else + typedef long long int64; + typedef unsigned long long uint64; + #define Kstdcall +#endif +typedef int int32; +typedef unsigned int uint32; +typedef uint64 intptr; +typedef intptr stackint; +typedef short int int16; +typedef unsigned short int uint16; +typedef char int8; +typedef unsigned char uint8; +typedef unsigned char byte; +typedef char sbyte; +typedef double float64; +typedef float float32; +typedef int32 stt_code; + +enum KLibraryStatus +{ + ksSuccess = 0, + ksFail = 1, + ksTimeOut = 2, + ksBusy = 3, + ksLocked = 4, + ksInvalidParams = 5, + ksEndOfFile = 6, + ksInvalidState = 7, + ksServerCommFail = 8, + ksOverflow = 9, + ksUnderrun = 10, + ksNotFound = 11, + ksNotAvailable = 12 +}; +enum KTxRx +{ + kNoTxRx = 0x0, + kTx = 0x1, + kRx = 0x2, + kBoth = 0x3 +}; + +#define KMAX_SERIAL_NUMBER 12 +#define KMAX_E1_CHANNELS 30 +#define KMAX_DIAL_NUMBER 20 +#define KMAX_ADDRESS 60 +#define KMAX_DSP_NAME 8 +#define KMAX_STR_VERSION 80 +#define KMAX_BUFFER_ADDRESSES 16 +#define KMAX_LOG 1024 +#define KMAX_SIP_DATA 248 +#define KMAX_GSM_CALLS 6 +#define KMAX_GSM_OPER_NAME 32 +#define KMAX_GSM_IMEI_SIZE 16 +#endif +#if !defined KVOIPDEFS_H +#define KVOIPDEFS_H +enum KRejectReason +{ + UserBusy = 0, + UserNotFound, + NoAnswer, + Decline, + ServiceUnavailable, + ServerInternalError, + UnknownRejectReason +}; +enum KSIP_Failures +{ + kveResponse_200_OK_Success = 200, + kveRedirection_300_MultipleChoices = 300, + kveRedirection_301_MovedPermanently = 301, + kveRedirection_302_MovedTemporarily = 302, + kveRedirection_305_UseProxy = 305, + kveRedirection_380_AlternativeService = 380, + kveFailure_400_BadRequest = 400, + kveFailure_401_Unauthorized = 401, + kveFailure_402_PaymentRequired = 402, + kveFailure_403_Forbidden = 403, + kveFailure_404_NotFound = 404, + kveFailure_405_MethodNotAllowed = 405, + kveFailure_406_NotAcceptable = 406, + kveFailure_407_ProxyAuthenticationRequired = 407, + kveFailure_408_RequestTimeout = 408, + kveFailure_410_Gone = 410, + kveFailure_413_RequestEntityTooLarge = 413, + kveFailure_414_RequestURI_TooLong = 414, + kveFailure_415_UnsupportedMediaType = 415, + kveFailure_416_UnsupportedURI_Scheme = 416, + kveFailure_420_BadExtension = 420, + kveFailure_421_ExtensionRequired = 421, + kveFailure_423_IntervalTooBrief = 423, + kveFailure_480_TemporarilyUnavailable = 480, + kveFailure_481_CallDoesNotExist = 481, + kveFailure_482_LoopDetected = 482, + kveFailure_483_TooManyHops = 483, + kveFailure_484_AddressIncomplete = 484, + kveFailure_485_Ambiguous = 485, + kveFailure_486_BusyHere = 486, + kveFailure_487_RequestTerminated = 487, + kveFailure_488_NotAcceptableHere = 488, + kveFailure_491_RequestPending = 491, + kveFailure_493_Undecipherable = 493, + kveServer_500_InternalError = 500, + kveServer_501_NotImplemented = 501, + kveServer_502_BadGateway = 502, + kveServer_503_ServiceUnavailable = 503, + kveServer_504_TimeOut = 504, + kveServer_505_VersionNotSupported = 505, + kveServer_513_MessageTooLarge = 513, + kveGlobalFailure_600_BusyEverywhere = 600, + kveGlobalFailure_603_Decline = 603, + kveGlobalFailure_604_DoesNotExistAnywhere = 604, + kveGlobalFailure_606_NotAcceptable = 606 +}; +enum KVoIPRegTypes +{ + kvrtRegister = 0, + kvrtUnregister = 1 +}; + +struct KVoIPCallParams +{ + sbyte ToUser[ KMAX_ADDRESS + 1 ]; + sbyte FromUser[ KMAX_ADDRESS + 1 ]; + sbyte FromUserIP[ KMAX_ADDRESS + 1 ]; +}; +struct KVoIPEvRegisterParams +{ + KVoIPRegTypes Register; + sbyte User[ KMAX_ADDRESS + 1 ]; + sbyte ProxyIP[ KMAX_ADDRESS + 1 ]; +}; +struct KVoIPSeize +{ + sbyte FromUser[ KMAX_ADDRESS + 1 ]; + sbyte ToUser[ KMAX_ADDRESS + 1 ]; + sbyte ProxyIP[ KMAX_ADDRESS + 1 ]; +}; +#endif +#if !defined KLDEFS_H +#define KLDEFS_H + + + +#define CM_SEIZE 0x01 + +#define CM_SYNC_SEIZE 0x02 + +#define CM_SIP_REGISTER 0x03 + +#define CM_DIAL_DTMF 0x04 + +#define CM_DISCONNECT 0x05 + +#define CM_CONNECT 0x06 + +#define CM_PRE_CONNECT 0x07 + +#define CM_CAS_CHANGE_LINE_STT 0x08 + +#define CM_CAS_SEND_MFC 0x09 + +#define CM_SET_FORWARD_CHANNEL 0x0A + +#define CM_CAS_SET_MFC_DETECT_MODE 0x0B + +#define CM_DROP_COLLECT_CALL 0x0C + +#define CM_MAKE_CALL 0x0D + +#define CM_RINGBACK 0x0E + +#define CM_USER_INFORMATION 0x0F + +#define CM_VOIP_SEIZE 0x23 + + +#define CM_LOCK_INCOMING 0x10 + +#define CM_UNLOCK_INCOMING 0x11 + +#define CM_LOCK_OUTGOING 0x12 + +#define CM_UNLOCK_OUTGOING 0x13 + +#define CM_START_SEND_FAIL 0x14 + +#define CM_STOP_SEND_FAIL 0x15 + +#define CM_END_OF_NUMBER 0x16 + +#define CM_SEND_SIP_DATA 0x17 + +#define CM_SS_TRANSFER 0x18 + +#define CM_GET_SMS 0x19 + +#define CM_PREPARE_SMS 0x1A + +#define CM_SEND_SMS 0x1B + +#define CM_SEND_TO_MODEM 0x1C + +#define CM_CHECK_NEW_SMS 0x1D + +#define CM_ISDN_SEND_SUBADDRESSES 0x1E + +#define CM_CT_TRANSFER 0x1F + +#define CM_ENABLE_DTMF_SUPPRESSION 0x30 + +#define CM_DISABLE_DTMF_SUPPRESSION 0x31 + +#define CM_ENABLE_AUDIO_EVENTS 0x32 + +#define CM_DISABLE_AUDIO_EVENTS 0x33 + +#define CM_ENABLE_CALL_PROGRESS 0x34 + +#define CM_DISABLE_CALL_PROGRESS 0x35 + +#define CM_FLASH 0x36 + +#define CM_ENABLE_PULSE_DETECTION 0x37 + +#define CM_DISABLE_PULSE_DETECTION 0x38 + +#define CM_ENABLE_ECHO_CANCELLER 0x39 + +#define CM_DISABLE_ECHO_CANCELLER 0x3A + +#define CM_ENABLE_AGC 0x3B + +#define CM_DISABLE_AGC 0x3C + +#define CM_ENABLE_HIGH_IMP_EVENTS 0x3D + +#define CM_DISABLE_HIGH_IMP_EVENTS 0x3E + +#define CM_ENABLE_CALL_ANSWER_INFO 0x40 + +#define CM_DISABLE_CALL_ANSWER_INFO 0x41 + +#define CM_START_WATCHDOG 0x45 + +#define CM_STOP_WATCHDOG 0x46 + +#define CM_NOTIFY_WATCHDOG 0x47 + +#define CM_WATCHDOG_COUNT 0x48 + +#define CM_HOLD_SWITCH 0x4A + +#define CM_MPTY_CONF 0x4B + +#define CM_MPTY_SPLIT 0x4C + +#define CM_SIM_CARD_SELECT 0x4D + +#define CM_START_FAX_TX 0x50 + +#define CM_STOP_FAX_TX 0x51 + +#define CM_ADD_FAX_FILE 0x52 + +#define CM_ADD_FAX_PAGE_BREAK 0x53 + +#define CM_START_FAX_RX 0x54 + +#define CM_STOP_FAX_RX 0x55 + +#define CM_RESET_LINK 0xF1 + +#define CM_CLEAR_LINK_ERROR_COUNTER 0xF2 + +#define CM_SEND_DEVICE_SECURITY_KEY 0xF3 + +#define CM_RESET_MODEM 0xF4 + +#define CM_ISDN_DISABLE_LINK 0xF5 + +#define CM_ISDN_ENABLE_LINK 0xF6 + + +#define EV_CHANNEL_FREE 0x01 + +#define EV_CONNECT 0x03 + +#define EV_DISCONNECT 0x04 + +#define EV_CALL_SUCCESS 0x05 + +#define EV_CALL_FAIL 0x06 + +#define EV_NO_ANSWER 0x07 + +#define EV_BILLING_PULSE 0x08 + +#define EV_SEIZE_SUCCESS 0x09 + +#define EV_SEIZE_FAIL 0x0A + +#define EV_SEIZURE_START 0x0B + +#define EV_CAS_LINE_STT_CHANGED 0x0C + +#define EV_CAS_MFC_RECV 0x0D + +#define EV_NEW_CALL 0x0E + +#define EV_USER_INFORMATION 0x0F + +#define EV_DIALED_DIGIT 0x10 + +#define EV_SIP_REGISTER_INFO 0x11 + +#define EV_RING_DETECTED 0x12 + +#define EV_ISDN_SUBADDRESSES 0x13 + +#define EV_CALL_HOLD_START 0x16 + +#define EV_CALL_HOLD_STOP 0x17 + +#define EV_SS_TRANSFER_FAIL 0x18 + +#define EV_FLASH 0x19 + +#define EV_ISDN_PROGRESS_INDICATOR 0x1A + +#define EV_CT_TRANSFER_SUCCESS 0x1B + +#define EV_CT_TRANSFER_FAIL 0x1C + +#define EV_DTMF_DETECTED 0x20 + +#define EV_DTMF_SEND_FINISH 0x21 + +#define EV_AUDIO_STATUS 0x22 + +#define EV_CADENCE_RECOGNIZED 0x23 +#define EV_CALL_PROGRESS EV_CADENCE_RECOGNIZED + +#define EV_END_OF_STREAM 0x24 + +#define EV_PULSE_DETECTED 0x25 + +#define EV_POLARITY_REVERSAL 0x26 + +#define EV_CALL_ANSWER_INFO 0x27 + +#define EV_COLLECT_CALL 0x28 + +#define EV_SIP_DTMF_DETECTED 0x29 + +#define EV_SIP_DATA 0x2A + +#define EV_RECV_FROM_MODEM 0x42 + +#define EV_NEW_SMS 0x43 + +#define EV_SMS_INFO 0x44 + +#define EV_SMS_DATA 0x45 + +#define EV_SMS_SEND_RESULT 0x46 + +#define EV_CALL_MPTY_START 0x47 + +#define EV_CALL_MPTY_STOP 0x48 + +#define EV_GSM_COMMAND_STATUS 0x49 + +#define EV_WATCHDOG_COUNT 0x60 + +#define EV_CHANNEL_FAIL 0x30 + +#define EV_REFERENCE_FAIL 0x31 + +#define EV_INTERNAL_FAIL 0x32 + +#define EV_HARDWARE_FAIL 0x33 + +#define EV_LINK_STATUS 0x34 + +#define EV_PHYSICAL_LINK_UP 0x35 + +#define EV_PHYSICAL_LINK_DOWN 0x36 + +#define EV_CLIENT_RECONNECT 0xF0 + +#define EV_CLIENT_AUDIOLISTENER_TIMEOUT 0xF1 + +#define EV_CLIENT_BUFFERED_AUDIOLISTENER_OVERFLOW 0xF2 + +#define EV_REQUEST_DEVICE_SECURITY_KEY 0xF3 + +#define EV_DISK_IS_FULL 0xF4 + + +#define CM_SEND_DTMF 0xD1 + +#define CM_STOP_AUDIO 0xD2 + +#define CM_HARD_RESET 0xF0 + +#define EV_VOIP_SEIZURE 0x40 + +#define EV_SEIZURE 0x41 + +#define EV_FAX_CHANNEL_FREE 0x50 + +#define EV_FAX_FILE_SENT 0x51 +#define EV_FAX_FILE_FAIL 0x52 +#define EV_FAX_MESSAGE_CONFIRMATION 0x53 +#define EV_FAX_TX_TIMEOUT 0x54 +#define EV_FAX_PAGE_CONFIRMATION EV_FAX_MESSAGE_CONFIRMATION +#define EV_FAX_REMOTE_INFO 0x55 + +#endif + + #define FC_REMOTE_FAIL 0x01 + #define FC_LOCAL_FAIL 0x02 + + #define FC_REMOTE_LOCK 0x03 + + #define FC_LINE_SIGNAL_FAIL 0x04 + #define FC_ACOUSTIC_SIGNAL_FAIL 0x05 + +enum KChannelFail +{ + kfcRemoteFail = FC_REMOTE_FAIL, + kfcLocalFail = FC_LOCAL_FAIL, + kfcRemoteLock = FC_REMOTE_LOCK, + kfcLineSignalFail = FC_LINE_SIGNAL_FAIL, + kfcAcousticSignalFail = FC_ACOUSTIC_SIGNAL_FAIL +}; + + #define ER_INTERRUPT_CTRL 0x01 + #define ER_COMMUNICATION_FAIL 0x02 + #define ER_PROTOCOL_FAIL 0x03 + #define ER_INTERNAL_BUFFER 0x04 + #define ER_MONITOR_BUFFER 0x05 + #define ER_INITIALIZATION 0x06 + #define ER_INTERFACE_FAIL 0x07 + #define ER_CLIENT_COMM_FAIL 0x08 + #define ER_POLL_CTRL 0x09 + #define ER_EVT_BUFFER_CTRL 0x0A + + #define ER_INVALID_CONFIG_VALUE 0x0B + + #define ER_INTERNAL_GENERIC_FAIL 0x0C + +enum KInternalFail +{ + kifInterruptCtrl = ER_INTERRUPT_CTRL, + kifCommunicationFail = ER_COMMUNICATION_FAIL, + kifProtocolFail = ER_PROTOCOL_FAIL, + kifInternalBuffer = ER_INTERNAL_BUFFER, + kifMonitorBuffer = ER_MONITOR_BUFFER, + kifInitialization = ER_INITIALIZATION, + kifInterfaceFail = ER_INTERFACE_FAIL, + kifClientCommFail = ER_CLIENT_COMM_FAIL +}; + + #define FS_CHANNEL_LOCKED 0x01 + #define FS_INCOMING_CHANNEL 0x02 + #define FS_CHANNEL_NOT_FREE 0x03 + #define FS_DOUBLE_SEIZE 0x04 + #define FS_LOCAL_CONGESTION 0x06 + #define FS_NO_DIAL_TONE 0x07 +enum KSeizeFail +{ + ksfChannelLocked = FS_CHANNEL_LOCKED, + ksfIncomingChannel = FS_INCOMING_CHANNEL, + ksfChannelBusy = FS_CHANNEL_NOT_FREE, + ksfDoubleSeizure = FS_DOUBLE_SEIZE, + ksfCongestion = FS_LOCAL_CONGESTION, + ksfNoDialTone = FS_NO_DIAL_TONE +}; +#if !defined KH100DEFS_H +#define KH100DEFS_H + +#define CM_SEND_TO_CTBUS 0x90 + +#define CM_RECV_FROM_CTBUS 0x91 + +#define CM_SEND_RANGE_TO_CTBUS 0x92 + +#define CM_SETUP_H100 0x93 + +enum KH100ConfigIndex +{ + khciDeviceMode = 0, + khciMasterGenClock = 1, + khciCTNetRefEnable = 4, + khciSCbusEnable = 6, + khciHMVipEnable = 7, + khciMVip90Enable = 8, + khciCTbusDataEnable = 9, + khciCTbusFreq03_00 = 10, + khciCTbusFreq07_04 = 11, + khciCTbusFreq11_08 = 12, + khciCTbusFreq15_12 = 13, + khciMax = 14, + khciMasterDevId = 20, + khciSecMasterDevId = 21, + khciCtNetrefDevId = 22, + khciMaxH100ConfigIndex +}; + +enum KMasterPLLClockReference +{ + h100_Ref_FreeRun = 0, + h100_Ref_holdover = 1, + h100_Automatic = 2, + h100_Ref_ctnetref = 7, + h100_Ref_link0 = 8, + h100_Ref_link1 = 9 +}; +enum KSlavePLLClockReference +{ + h100_PllLoc_ClkA = 0, + h100_PllLoc_ClkB = 1, + h100_PllLoc_SCBus = 2, + h100_PllLoc_MVIP90 = 3, + h100_PllLoc_Link0 = 4, + h100_PllLoc_Link1 = 5, + h100_PllLoc_Error = 6 +}; + +#define H100_DEVICE_MODE khciDeviceMode + enum KH100Mode + { + h100_Slave, + h100_Master, + h100_StandbyMaster, + h100_Diagnostic, + h100_NotConnected + }; +#define H100_MASTER_GEN_CLOCK khciMasterGenClock + enum KH100SelectCtbusClock + { + h100_scClockA, + h100_scClockB + }; + +#define H100_CT_NETREF_ENABLE khciCTNetRefEnable + enum KH100CtNetref + { + h100_nrOff, + h100_nrEnable + }; +#define H100_SCBUS_ENABLE khciSCbusEnable + enum KH100ScbusEnable + { + h100_seOff, + h100_seOn2Mhz, + h100_seOn4Mhz, + h100_seOn8Mhz + }; +#define H100_HMVIP_ENABLE khciHMVipEnable + +#define H100_MVIP90_ENABLE khciMVip90Enable + +#define H100_CTBUS_DATA_ENABLE khciCTbusDataEnable + +enum KH100Enable +{ + h100_On = 0x01, + h100_Off = 0x00 +}; + +#define H100_CTBUS_FREQ_03_00 khciCTbusFreq03_00 +#define H100_CTBUS_FREQ_07_04 khciCTbusFreq07_04 +#define H100_CTBUS_FREQ_11_08 khciCTbusFreq11_08 +#define H100_CTBUS_FREQ_15_12 khciCTbusFreq15_12 + +enum KH100CtbusFreq +{ + h100_cf_2Mhz = 0, + h100_cf_4Mhz = 1, + h100_cf_8Mhz = 2 +}; + +#endif + +#define CM_MIXER 0x60 + +#define CM_CLEAR_MIXER 0x61 + +#define CM_PLAY_FROM_FILE 0x62 + +#define CM_RECORD_TO_FILE 0x63 + +#define CM_PLAY_FROM_STREAM 0x64 + +#define CM_INTERNAL_PLAY 0x65 + +#define CM_STOP_PLAY 0x66 + +#define CM_STOP_RECORD 0x67 + +#define CM_PAUSE_PLAY 0x68 + +#define CM_PAUSE_RECORD 0x69 + +#define CM_RESUME_PLAY 0x6A + +#define CM_RESUME_RECORD 0x6B + +#define CM_INCREASE_VOLUME 0x6C + +#define CM_DECREASE_VOLUME 0x6D + +#define CM_LISTEN 0x6E + +#define CM_STOP_LISTEN 0x6F + +#define CM_PREPARE_FOR_LISTEN 0x70 + +#define CM_PLAY_SOUND_CARD 0x71 + +#define CM_STOP_SOUND_CARD 0x72 + +#define CM_MIXER_CTBUS 0x73 + +#define CM_PLAY_FROM_STREAM_EX 0x74 + +#define CM_INTERNAL_PLAY_EX 0x75 + +#define CM_ENABLE_PLAYER_AGC 0x76 + +#define CM_DISABLE_PLAYER_AGC 0x77 + +#define CM_START_STREAM_BUFFER 0x78 + +#define CM_ADD_STREAM_BUFFER 0x79 + +#define CM_STOP_STREAM_BUFFER 0x7A + +#define CM_SEND_BEEP 0x7B + +#define CM_SEND_BEEP_CONF 0x7C + +#define CM_ADD_TO_CONF 0x7D + +#define CM_REMOVE_FROM_CONF 0x7E + +#define CM_RECORD_TO_FILE_EX 0x7F + +#define CM_SET_VOLUME 0xA0 + +#define CM_START_CADENCE 0xA1 + +#define CM_STOP_CADENCE 0xA2 +#if !defined KR2D_H +#define KR2D_H + +#define CM_SET_LINE_CONDITION 0x80 + +#define CM_SEND_LINE_CONDITION 0x81 + +#define CM_SET_CALLER_CATEGORY 0x82 + + +#define CM_DIAL_MFC 0x83 + + + +enum KSignGroupII_Brazil +{ + kg2BrOrdinary = 0x01, + kg2BrPriority = 0x02, + kg2BrMaintenance = 0x03, + kg2BrLocalPayPhone = 0x04, + kg2BrTrunkOperator = 0x05, + kg2BrDataTrans = 0x06, + kg2BrNonLocalPayPhone = 0x07, + kg2BrCollectCall = 0x08, + kg2BrOrdinaryInter = 0x09, + kg2BrTransfered = 0x0B, +}; + +enum KSignGroupB_Brazil +{ + kgbBrLineFreeCharged = 0x01, + kgbBrBusy = 0x02, + kgbBrNumberChanged = 0x03, + kgbBrCongestion = 0x04, + kgbBrLineFreeNotCharged = 0x05, + kgbBrLineFreeChargedLPR = 0x06, + kgbBrInvalidNumber = 0x07, + kgbBrLineOutOfOrder = 0x08, + kgbBrNone = 0xFF +}; + + +enum KSignGroupII_Argentina +{ + kg2ArOrdinary = 0x01, + kg2ArPriority = 0x02, + kg2ArMaintenance = 0x03, + kg2ArLocalPayPhone = 0x04, + kg2ArTrunkOperator = 0x05, + kg2ArDataTrans = 0x06, + kg2ArCPTP = 0x0B, + kg2ArSpecialLine = 0x0C, + kg2ArMobileUser = 0x0D, + kg2ArPrivateRedLine = 0x0E, + kg2ArSpecialPayPhoneLine = 0x0F, +}; + +enum KSignGroupB_Argentina +{ + kgbArNumberChanged = 0x02, + kgbArBusy = 0x03, + kgbArCongestion = 0x04, + kgbArInvalidNumber = 0x05, + kgbArLineFreeCharged = 0x06, + kgbArLineFreeNotCharged = 0x07, + kgbArLineOutOfOrder = 0x08, + kgbArNone = 0xFF +}; + + +enum KSignGroupII_Chile +{ + kg2ClOrdinary = 0x01, + kg2ClPriority = 0x02, + kg2ClMaintenance = 0x03, + kg2ClTrunkOperator = 0x05, + kg2ClDataTrans = 0x06, + kg2ClUnidentifiedSubscriber = 0x0B, +}; + +enum KSignGroupB_Chile +{ + kgbClNumberChanged = 0x02, + kgbClBusy = 0x03, + kgbClCongestion = 0x04, + kgbClInvalidNumber = 0x05, + kgbClLineFreeCharged = 0x06, + kgbClLineFreeNotCharged = 0x07, + kgbClLineOutOfOrder = 0x08, + kgbClNone = 0xFF +}; + + +enum KSignGroupII_Mexico +{ + kg2MxTrunkOperator = 0x01, + kg2MxOrdinary = 0x02, + kg2MxMaintenance = 0x06, +}; + +enum KSignGroupB_Mexico +{ + kgbMxLineFreeCharged = 0x01, + kgbMxBusy = 0x02, + kgbMxLineFreeNotCharged = 0x05, + kgbMxNone = 0xFF +}; + + +enum KSignGroupII_Uruguay +{ + kg2UyOrdinary = 0x01, + kg2UyPriority = 0x02, + kg2UyMaintenance = 0x03, + kg2UyLocalPayPhone = 0x04, + kg2UyTrunkOperator = 0x05, + kg2UyDataTrans = 0x06, + kg2UyInternSubscriber = 0x07, +}; + +enum KSignGroupB_Uruguay +{ + kgbUyNumberChanged = 0x02, + kgbUyBusy = 0x03, + kgbUyCongestion = 0x04, + kgbUyInvalidNumber = 0x05, + kgbUyLineFreeCharged = 0x06, + kgbUyLineFreeNotCharged = 0x07, + kgbUyLineOutOfOrder = 0x08, + kgbUyNone = 0xFF +}; + + +enum KSignGroupII_Venezuela +{ + kg2VeOrdinary = 0x01, + kg2VePriority = 0x02, + kg2VeMaintenance = 0x03, + kg2VeLocalPayPhone = 0x04, + kg2VeTrunkOperator = 0x05, + kg2VeDataTrans = 0x06, + kg2VeNoTransferFacility = 0x07, +}; + +enum KSignGroupB_Venezuela +{ + kgbVeLineFreeChargedLPR = 0x01, + kgbVeNumberChanged = 0x02, + kgbVeBusy = 0x03, + kgbVeCongestion = 0x04, + kgbVeInformationTone = 0x05, + kgbVeLineFreeCharged = 0x06, + kgbVeLineFreeNotCharged = 0x07, + kgbVeLineBlocked = 0x08, + kgbVeIntercepted = 0x09, + kgbVeDataTrans = 0x0A, + kgbVeNone = 0xFF +}; + + + + + +enum KSignGroupB +{ + kgbLineFreeCharged = 0x01, + kgbLineFreeNotCharged = 0x05, + kgbLineFreeChargedLPR = 0x06, + kgbBusy = 0x02, + kgbNumberChanged = 0x03, + kgbCongestion = 0x04, + kgbInvalidNumber = 0x07, + kgbLineOutOfOrder = 0x08, + kgbNone = 0xFF +}; +#define STT_GB_LINEFREE_CHARGED 0x01 +#define STT_GB_LINEFREE_NOTCHARGED 0x05 +#define STT_GB_LINEFREE_CHARGED_LPR 0x06 +#define STT_GB_BUSY 0x02 +#define STT_GB_NUMBER_CHANGED 0x03 +#define STT_GB_CONGESTION 0x04 +#define STT_GB_UNALLOCATED_NUMBER 0x07 +#define STT_GB_LINE_OUT_OF_ORDER 0x08 +#define STT_GB_NONE 0xFF + +enum KSignGroupII +{ + kg2Ordinary = 0x01, + kg2Priority = 0x02, + kg2Maintenance = 0x03, + kg2LocalPayPhone = 0x04, + kg2TrunkOperator = 0x05, + kg2DataTrans = 0x06, + kg2NonLocalPayPhone = 0x07, + kg2CollectCall = 0x08, + kg2OrdinaryInter = 0x09, + kg2Transfered = 0x0B, +}; +#define STT_GII_ORDINARY 0x01 +#define STT_GII_PRIORITY 0x02 +#define STT_GII_MAINTENANCE 0x03 +#define STT_GII_LOCAL_PAY_PHONE 0x04 +#define STT_GII_TRUNK_OPERATOR 0x05 +#define STT_GII_DATA_TRANS 0x06 +#define STT_GII_NON_LOCAL_PAY_PHONE 0x07 +#define STT_GII_COLLECT_CALL 0x08 +#define STT_GII_ORDINARY_INTERNATIONAL 0x09 +#define STT_GII_TRANSFERED 0x0B +#endif +#ifndef _KISDN_H_ +#define _KISDN_H_ +#define KMAX_USER_USER_LEN 32 +#define KMAX_SUBADRESS_INFORMATION_LEN 20 + +enum KQ931Cause +{ + kq931cNone = 0, + kq931cUnallocatedNumber = 1, + kq931cNoRouteToTransitNet = 2, + kq931cNoRouteToDest = 3, + kq931cSendSpecialInfoTone = 4, + kq931cMisdialedTrunkPrefix = 5, + kq931cChannelUnacceptable = 6, + kq931cCallAwarded = 7, + kq931cPreemption = 8, + kq931cPreemptionCircuitReuse = 9, + kq931cQoR_PortedNumber = 14, + kq931cNormalCallClear = 16, + kq931cUserBusy = 17, + kq931cNoUserResponding = 18, + kq931cNoAnswerFromUser = 19, + kq931cSubscriberAbsent = 20, + kq931cCallRejected = 21, + kq931cNumberChanged = 22, + kq931cRedirectionToNewDest = 23, + kq931cCallRejectedFeatureDest = 24, + kq931cExchangeRoutingError = 25, + kq931cNonSelectedUserClear = 26, + kq931cDestinationOutOfOrder = 27, + kq931cInvalidNumberFormat = 28, + kq931cFacilityRejected = 29, + kq931cRespStatusEnquiry = 30, + kq931cNormalUnspecified = 31, + kq931cNoCircuitChannelAvail = 34, + kq931cNetworkOutOfOrder = 38, + kq931cPermanentFrameConnOutOfService = 39, + kq931cPermanentFrameConnOperational = 40, + kq931cTemporaryFailure = 41, + kq931cSwitchCongestion = 42, + kq931cAccessInfoDiscarded = 43, + kq931cRequestedChannelUnav = 44, + kq931cPrecedenceCallBlocked = 46, + kq931cResourceUnavailable = 47, + kq931cQosUnavailable = 49, + kq931cReqFacilityNotSubsc = 50, + kq931cOutCallsBarredWithinCUG = 53, + kq931cInCallsBarredWithinCUG = 55, + kq931cBearerCapabNotAuthor = 57, + kq931cBearerCapabNotAvail = 58, + kq931cInconsistency = 62, + kq931cServiceNotAvailable = 63, + kq931cBcNotImplemented = 65, + kq931cChannelTypeNotImplem = 66, + kq931cReqFacilityNotImplem = 69, + kq931cOnlyRestrictedBcAvail = 70, + kq931cServiceNotImplemented = 79, + kq931cInvalidCrv = 81, + kq931cChannelDoesNotExist = 82, + kq931cCallIdDoesNotExist = 83, + kq931cCallIdInUse = 84, + kq931cNoCallSuspended = 85, + kq931cCallIdCleared = 86, + kq931cUserNotMemberofCUG = 87, + kq931cIncompatibleDestination = 88, + kq931cInvalidTransitNetSel = 91, + kq931cInvalidMessage = 95, + kq931cMissingMandatoryIe = 96, + kq931cMsgTypeNotImplemented = 97, + kq931cMsgIncompatWithState = 98, + kq931cIeNotImplemented = 99, + kq931cInvalidIe = 100, + kq931cMsgIncompatWithState2 = 101, + kq931cRecoveryOnTimerExpiry = 102, + kq931cProtocolError = 103, + kq931cMessageWithUnrecognizedParam = 110, + kq931cProtocolErrorUnspecified = 111, + kq931cInterworking = 127, + kq931cCallConnected = 128, + kq931cCallTimedOut = 129, + kq931cCallNotFound = 130, + kq931cCantReleaseCall = 131, + kq931cNetworkFailure = 132, + kq931cNetworkRestart = 133, + kq931cLastValidCause = kq931cNetworkRestart, +}; + +enum KQ931ProgressIndication +{ + kq931pTonesMaybeAvailable = 1, + kq931pDestinationIsNonIsdn = 2, + kq931pOriginationIsNonIsdn = 3, + kq931pCallReturnedToIsdn = 4, + kq931pTonesAvailable = 8, +}; + +enum KQ931Hlc +{ + kq931hTelefony = 0x81, + k1931hFaxGroup23 = 0x84, + k1931hFaxGroup4 = 0xa1, + kq931hTeletexF184 = 0xa4, + kq931hTeletexF220 = 0xa8, + kq931hTeletexf200 = 0xb1, + kq931hVideotex = 0xb2, + kq931hTelexF60 = 0xb5, + kq931hMhs = 0xb8, + kq931hOsiApp = 0xc1, + kq931hMaintenance = 0xde, + kq931hManagement = 0xdf, +}; + +enum KQ931BearerCapability +{ + kq931bSpeech = 0x00, + kq931bUnrestrictedDigital = 0x08, + kq931bAudio31kHz = 0x10, + kq931bAudio7kHz = 0x11, + kq931bVideo = 0x18, +}; + +enum KQ931TypeOfNumber +{ + kq931tUnknownNumber = 0x00, + kq931tInternationalNumber = 0x10, + kq931tNationalNumber = 0x20, + kq931tNetworkSpecificNumber = 0x30, + kq931tSubscriberNumber = 0x40, + kq931tAbbreviatedNumber = 0x60, + kq931tReservedNumber = 0x70, + kq931tDefaultNumber = kq931tUnknownNumber, +}; + +enum KQ931NumberingPlan +{ + kq931pUnknownPlan = 0x00, + kq931pIsdnPlan = 0x01, + kq931pDataPlan = 0x03, + kq931pTelexPlan = 0x04, + kq931pNationalPlan = 0x08, + kq931pPrivatePlan = 0x09, + kq931pReservedPlan = 0x0F, + kq931pDefaultPlan = kq931pUnknownPlan, +}; + +enum KQ931UserInfoProtocolDescriptor +{ + kq931uuUserSpecific = 0x00, + kq931uuOSI_HighLayer = 0x01, + kq931uuX244 = 0x02, + kq931uuIA5_Chars = 0x04, + kq931uuX208_X209 = 0x05, + kq931uuV120 = 0x07, + kq931uuQ931_CallControl = 0x08, + kq931uuNational = 0x40 +}; +enum KQ931PresentationIndicator +{ + kq931piPresentationAllowed = 0x00, + kq931piPresentationRestricted = 0x01, + kq931piNumberNotAvailableDueToInterworking = 0x02, +}; +enum KQ931ScreeningIndicator +{ + kq931siUserProvidedNotScreened = 0x00, + kq931siUserProvidedVerifiedAndPassed = 0x01, + kq931siUserProvidedVerifiedAndFailed = 0x02, + kq931siNetworkProvided = 0x03, +}; +enum KQ931TypeOfSubaddress +{ + kq931tsNSAP = 0x00, + kq931tsUserSpecified = 0x01, +}; +#endif +#ifndef KGSM_H +#define KGSM_H + +enum KGsmCallCause +{ + kgccNone = 0, + kgccUnallocatedNumber = 1, + kgccNoRouteToDest = 3, + kgccChannelUnacceptable = 6, + kgccOperatorDeterminedBarring = 8, + kgccNormalCallClear = 16, + kgccUserBusy = 17, + kgccNoUserResponding = 18, + kgccNoAnswerFromUser = 19, + kgccCallRejected = 21, + kgccNumberChanged = 22, + kgccNonSelectedUserClear = 26, + kgccDestinationOutOfOrder = 27, + kgccInvalidNumberFormat = 28, + kgccFacilityRejected = 29, + kgccRespStatusEnquiry = 30, + kgccNormalUnspecified = 31, + kgccNoCircuitChannelAvail = 34, + kgccNetworkOutOfOrder = 38, + kgccTemporaryFailure = 41, + kgccSwitchCongestion = 42, + kgccAccessInfoDiscarded = 43, + kgccRequestedChannelUnav = 44, + kgccResourceUnavailable = 47, + kgccQosUnavailable = 49, + kgccReqFacilityNotSubsc = 50, + kgccCallBarredWitchCUG = 55, + kgccBearerCapabNotAuthor = 57, + kgccBearerCapabNotAvail = 58, + kgccServiceNotAvailable = 63, + kgccBcNotImplemented = 65, + kgccReqFacilityNotImplem = 69, + kgccOnlyRestrictedBcAvail = 70, + kgccServiceNotImplemented = 79, + kgccInvalidCrv = 81, + kgccUserNotMemberOfCUG = 82, + kgccIncompatibleDestination = 88, + kgccInvalidTransitNetSel = 91, + kgccInvalidMessage = 95, + kgccMissingMandatoryIe = 96, + kgccMsgTypeNotImplemented = 97, + kgccMsgIncompatWithState = 98, + kgccIeNotImplemented = 99, + kgccInvalidIe = 100, + kgccMsgIncompatWithState2 = 101, + kgccRecoveryOnTimerExpiry = 102, + kgccProtocolError = 111, + kgccInterworking = 127, +}; + +enum KGsmMobileCause +{ + kgmcPhoneFailure = 0, + kgmcNoConnectionToPhone = 1, + kgmcPhoneAdaptorLinkReserved = 2, + kgmcOperationNotAllowed = 3, + kgmcOperationNotSupported = 4, + kgmcPH_SIMPINRequired = 5, + kgmcPH_FSIMPINRequired = 6, + kgmcPH_FSIMPUKRequired = 7, + kgmcSIMNotInserted = 10, + kgmcSIMPINRequired = 11, + kgmcSIMPUKRequired = 12, + kgmcSIMFailure = 13, + kgmcSIMBusy = 14, + kgmcSIMWrong = 15, + kgmcIncorrectPassword = 16, + kgmcSIMPIN2Required = 17, + kgmcSIMPUK2Required = 18, + kgmcMemoryFull = 20, + kgmcInvalidIndex = 21, + kgmcNotFound = 22, + kgmcMemoryFailure = 23, + kgmcTextStringTooLong = 24, + kgmcInvalidCharInTextString = 25, + kgmcDialStringTooLong = 26, + kgmcInvalidCharInDialString = 27, + kgmcNoNetworkService = 30, + kgmcNetworkTimeout = 31, + kgmcNetworkNotAllowed = 32, + kgmcCommandAborted = 33, + kgmcNumParamInsteadTextParam = 34, + kgmcTextParamInsteadNumParam = 35, + kgmcNumericParamOutOfBounds = 36, + kgmcTextStringTooShort = 37, + kgmcNetworkPINRequired = 40, + kgmcNetworkPUKRequired = 41, + kgmcNetworkSubsetPINRequired = 42, + kgmcNetworkSubnetPUKRequired = 43, + kgmcServiceProviderPINRequired = 44, + kgmcServiceProviderPUKRequired = 45, + kgmcCorporatePINRequired = 46, + kgmcCorporatePUKRequired = 47, + kgmcSIMServiceOptNotSupported = 60, + kgmcUnknown = 100, + kgmcIllegalMS_N3 = 103, + kgmcIllegalME_N6 = 106, + kgmcGPRSServicesNotAllowed_N7 = 107, + kgmcPLMNNotAllowed_No11 = 111, + kgmcLocationAreaNotAllowed_N12 = 112, + kgmcRoamingNotAllowed_N13 = 113, + kgmcServiceOptNotSupported_N32 = 132, + kgmcReqServOptNotSubscribed_N33 = 133, + kgmcServOptTempOutOfOrder_N34 = 134, + kgmcLongContextActivation = 147, + kgmcUnspecifiedGPRSError = 148, + kgmcPDPAuthenticationFailure = 149, + kgmcInvalidMobileClass = 150, + kgmcGPRSDisconnectionTmrActive = 151, + kgmcTooManyActiveCalls = 256, + kgmcCallRejected = 257, + kgmcUnansweredCallPending = 258, + kgmcUnknownCallingError = 259, + kgmcNoPhoneNumRecognized = 260, + kgmcCallStateNotIdle = 261, + kgmcCallInProgress = 262, + kgmcDialStateError = 263, + kgmcUnlockCodeRequired = 264, + kgmcNetworkBusy = 265, + kgmcInvalidPhoneNumber = 266, + kgmcNumberEntryAlreadyStarted = 267, + kgmcCancelledByUser = 268, + kgmcNumEntryCouldNotBeStarted = 269, + kgmcDataLost = 280, + kgmcInvalidBessageBodyLength = 281, + kgmcInactiveSocket = 282, + kgmcSocketAlreadyOpen = 283, + + kgmcSuccess = 0x7fff +}; + +enum KGsmSmsCause +{ + kgscNone = 0, + kgscUnassigned = 1, + kgscOperatorDeterminedBarring = 8, + kgscCallBarred = 10, + kgscSMSTransferRejected = 21, + kgscDestinationOutOfService = 27, + kgscUnidentifiedSubscriber = 28, + kgscFacilityRejected = 29, + kgscUnknownSubscriber = 30, + kgscNetworkOutOfOrder = 38, + kgscTemporaryFailure = 41, + kgscCongestion = 42, + kgscResourcesUnavailable = 47, + kgscFacilityNotSubscribed = 50, + kgscFacilityNotImplemented = 69, + kgscInvalidSMSTransferRefValue = 81, + kgscInvalidMessage = 95, + kgscInvalidMandatoryInformation = 96, + kgscMessageTypeNonExistent = 97, + kgscMsgNotCompatWithSMProtState = 98, + kgscInformationElementNonExiste = 99, + kgscProtocolError = 111, + kgscInterworking = 127, + kgscTelematicInterworkingNotSup = 128, + kgscSMSTypeZeroNotSupported = 129, + kgscCannotReplaceSMS = 130, + kgscUnspecifiedTPPIDError = 143, + kgscAlphabetNotSupported = 144, + kgscMessageClassNotSupported = 145, + kgscUnspecifiedTPDCSError = 159, + kgscCommandCannotBeActioned = 160, + kgscCommandUnsupported = 161, + kgscUnspecifiedTPCommandError = 175, + kgscTPDUNotSupported = 176, + kgscSCBusy = 192, + kgscNoSCSubscription = 193, + kgscSCSystemFailure = 194, + kgscInvalidSMEAddress = 195, + kgscDestinationSMEBarred = 196, + kgscSMRejectedDuplicateSM = 197, + kgscTPVPFNotSupported = 198, + kgscTPVPNotSupported = 199, + kgscSIMSMSStorageFull = 208, + kgscNoSMSStorageCapabilityInSIM = 209, + kgscErrorInMS = 210, + kgscMemoryCapacityExceeded = 211, + kgscSIMDataDownloadError = 213, + kgscUnspecifiedError = 255, + kgscPhoneFailure = 300, + kgscSmsServiceReserved = 301, + kgscOperationNotAllowed = 302, + kgscOperationNotSupported = 303, + kgscInvalidPDUModeParameter = 304, + kgscInvalidTextModeParameter = 305, + kgscSIMNotInserted = 310, + kgscSIMPINNecessary = 311, + kgscPH_SIMPINNecessary = 312, + kgscSIMFailure = 313, + kgscSIMBusy = 314, + kgscSIMWrong = 315, + kgscMemoryFailure = 320, + kgscInvalidMemoryIndex = 321, + kgscMemoryFull = 322, + kgscSMSCAddressUnknown = 330, + kgscNoNetworkService = 331, + kgscNetworkTimeout = 332, + kgscUnknownError = 500, + kgscNetworkBusy = 512, + kgscInvalidDestinationAddress = 513, + kgscInvalidMessageBodyLength = 514, + kgscPhoneIsNotInService = 515, + kgscInvalidPreferredMemStorage = 516, + kgscUserTerminated = 517 +}; + +enum KGsmRegistryStatus +{ + kgrsNotRegistered = 0x00, + kgrsRegistered = 0x01, + kgrsSearching = 0x02, + kgrsDenied = 0x03, + kgrsUnknown = 0x04, + kgrsRoaming = 0x05, + kgrsInitializing = 0xff, +}; +enum KGsmCallStatus +{ + kgcstActive = 0x0, + kgcstHeld = 0x1, + kgcstDialing = 0x2, + kgcstAlerting = 0x3, + kgcstIncoming = 0x4, + kgcstWaiting = 0x5, + kgcstReleased = 0x6, +}; +enum KGsmCallMode +{ + kgcmVoice = 0x0, + kgcmData = 0x1, + kgcmFax = 0x2, + kgcmUnknown = 0x3 +}; +enum KGsmCallFlags +{ + kgcflMultiparty = 0x01, + kgcflInternationalNumber = 0x02, + kgcflMobileTerminatedCall = 0x04, +}; +enum KGsmChannelFeatures +{ + kgcfMultiparty = 0x01, + kgcfCallForward = 0x02, +}; +#endif +#ifndef K3L_STATS_H +#define K3L_STATS_H + +enum KGeneralCallStatIndex +{ + kcsiInbound, + kcsiOutbound, + kcsiOutCompleted, + kcsiOutFailed, + kcsiRemoteDisc, + kcsiLocalDisc, + kcsiLastGeneralCallStat +}; + +enum KFailedCallStatIndex +{ + kcsiFailedBusy = kcsiLastGeneralCallStat, + kcsiFailedNoAnswer, + kcsiFailedRejected, + kcsiFailedAddrChanged, + kcsiFailedInvalidAddr, + kcsiFailedOutOfService, + kcsiFailedCongestion, + kcsiFailedNetworkFailure, + kcsiFailedOther, + kcsiLastFailedCallStat +}; +const uint32 kcsiMaxCallStats = kcsiLastFailedCallStat; +typedef uint32 KStatIndex; + +#endif +#ifndef k3lVersion_h +#define k3lVersion_h +#define k3lApiMajorVersion 2 +#define k3lApiMinorVersion 1 +#define k3lApiBuildVersion 0 +#endif +#if !defined K3L_H +#define K3L_H + +enum KDeviceType +{ + kdtE1 = 0, + kdtFXO = 1, + kdtConf = 2, + kdtPR = 3, + kdtE1GW = 4, + kdtFXOVoIP = 5, + kdtE1IP = 6, + kdtE1Spx = 7, + kdtGWIP = 8, + kdtFXS = 9, + kdtFXSSpx = 10, + kdtGSM = 11, + kdtGSMSpx = 12, + kdtReserved1 = 13, + kdtGSMUSB = 14, + kdtGSMUSBSpx = 15, + kdtE1FXSSpx = 16, + kdtDevTypeCount +}; +enum KSignaling +{ + ksigInactive = 0, + ksigR2Digital = 1, + ksigContinuousEM = 2, + ksigPulsedEM = 3, + ksigUserR2Digital = 4, + ksigAnalog = 5, + ksigOpenCAS = 6, + ksigOpenR2 = 7, + ksigSIP = 8, + ksigOpenCCS = 9, + ksigPRI_EndPoint = 10, + ksigAnalogTerminal = 11, + ksigPRI_Network = 12, + ksigPRI_Passive = 13, + ksigLineSide = 14, + ksigCAS_EL7 = 15, + ksigGSM = 16, + ksigE1LC = 17, + ksigISUP = 18, + ksigFax = 19, +}; +enum KE1DeviceModel +{ + kdmE1600 = 0, + kdmE1600E = 1, + kdmE1600EX = 2 +}; +enum KE1GWDeviceModel +{ + kdmE1GW640 = 1, + kdmE1GW640EX = 2 +}; +enum KE1IPDeviceModel +{ + kdmE1IP = 1, + kdmE1IPEX = 2 +}; +enum KGWIPDeviceModel +{ + kdmGWIP = 1, + kdmGWIPEX = 2 +}; +enum KFXODeviceModel +{ + kdmFXO80 = 0, + kdmFXOHI = 1, + kdmFXO160HI = 2, + kdmFXO240HI = 3 +}; +enum KFXOVoIPDeviceModel +{ + kdmFXGW180 = kdmFXO80 +}; +enum KConfDeviceModel +{ + kdmConf240 = 0, + kdmConf120 = 1, + kdmConf240EX = 2, + kdmConf120EX = 3 +}; +enum KPRDeviceModel +{ + kdmPR300v1 = 0, + kdmPR300 = 1, + kdmPR300SpxBased = 2, + kdmPR300EX = 3 +}; +enum KFXSDeviceModel +{ + kdmFXS300 = 1, + kdmFXS300EX = 2 +}; +enum KFXSSpxDeviceModel +{ + kdmFXSSpx300 = 0, + kdmFXSSpx2E1Based = 1, + kdmFXSSpx300EX = 2 +}; +enum KE1SpxDeviceModel +{ + kdmE1Spx = 0, + kdm2E1Based = 1, + kdmE1SpxEX = 2 +}; +enum KGSMDeviceModel +{ + kdmGSM = 0, + kdmGSMEX = 1 +}; +enum KGSMSpxDeviceModel +{ + kdmGSMSpx = 0, + kdmGSMSpxEX = 1 +}; +enum KGSMUSBDeviceModel +{ + kdmGSMUSB = 0 +}; +enum KGSMUSBSpxDeviceModel +{ + kdmGSMUSBSpx = 0 +}; +enum KE1FXSDeviceModel +{ + kdmE1FXSSpx = 0, + kdmE1FXSSpxEX = 1 +}; +enum KSystemObject +{ + ksoLink = 0x00, + ksoLinkMon = 0x20, + ksoFirmware = 0x80, + ksoDevice = 0x100, + ksoAPI = 0x150, + ksoH100 = 0x200, + ksoChannel = 0x1000, + ksoGsmChannel = 0x2000, +}; +enum KFirmwareId +{ + kfiE1600A, + kfiE1600B, + kfiFXO80, + kfiGSM40, + kfiGSMUSB +}; +enum KE1Status +{ + kesOk = 0x00, + kesSignalLost = 0x01, + kesNetworkAlarm = 0x02, + kesFrameSyncLost = 0x04, + kesMultiframeSyncLost = 0x08, + kesRemoteAlarm = 0x10, + kesHighErrorRate = 0x20, + kesUnknownAlarm = 0x40, + kesE1Error = 0x80, + kesNotInitialized = 0xFF +}; +enum KE1ChannelStatus +{ + kecsFree = 0x00, + kecsBusy = 0x01, + kecsOutgoing = 0x02, + kecsIncoming = 0x04, + kecsLocked = 0x06, + kecsOutgoingLock = 0x10, + kecsLocalFail = 0x20, + kecsIncomingLock = 0x40, + kecsRemoteLock = 0x80 +}; +enum KVoIPChannelStatus +{ + kipcsFree = kecsFree, + kipcsOutgoingLock = kecsOutgoingLock, + kipcsIncomingLock = kecsIncomingLock +}; +enum KFXOChannelStatus +{ + kfcsDisabled = 0x00, + kfcsEnabled = 0x01 +}; +enum KFXSChannelStatus +{ + kfxsOnHook, + kfxsOffHook, + kfxsRinging, + kfxsFail +}; +enum KGsmChannelStatus +{ + kgsmIdle, + kgsmCallInProgress, + kgsmSMSInProgress, + kgsmModemError, + kgsmSIMCardError, + kgsmNetworkError, + kgsmNotReady +}; +enum KCallStatus +{ + kcsFree = 0x00, + kcsIncoming = 0x01, + kcsOutgoing = 0x02, + kcsFail = 0x04 +}; +enum KCallStartInfo +{ + kcsiHumanAnswer, + kcsiAnsweringMachine, + kcsiCellPhoneMessageBox, + kcsiUnknown, + kcsiCarrierMessage +}; +enum KChannelFeatures +{ + kcfDtmfSuppression = 0x0001, + kcfCallProgress = 0x0002, + kcfPulseDetection = 0x0004, + kcfAudioNotification= 0x0008, + kcfEchoCanceller = 0x0010, + kcfAutoGainControl = 0x0020, + kcfHighImpEvents = 0x0080, + kcfCallAnswerInfo = 0x0100, + kcfOutputVolume = 0x0200, + kcfPlayerAGC = 0x0400 +}; +enum KMixerSource +{ + kmsChannel, + kmsPlay, + kmsGenerator, + kmsCTbus, + kmsNoDelayChannel +}; +struct KMixerCommand +{ + int32 Track; + int32 Source; + int32 SourceIndex; +}; +struct KPlayFromStreamCommand +{ + void *Buffer; + uint32 BufferSize; + int32 CodecIndex; +}; +struct KBufferParam +{ + void *Buffer; + uint32 BufferSize; +}; +enum KMixerTone +{ + kmtSilence = 0x00, + kmtDial = 0x01, + kmtBusy = 0x02, + kmtFax = 0x03, + kmtVoice = 0x04, + kmtEndOf425 = 0x05, + kmtCollect = 0x06, + kmtEndOfDtmf= 0x07, +}; +struct K3L_CHANNEL_STATUS +{ + KCallStatus CallStatus; + KMixerTone AudioStatus; + int32 AddInfo; + int32 EnabledFeatures; +}; +struct K3L_GSM_CALL_STATUS +{ + KGsmCallStatus Status; + KGsmCallMode Mode; + char Number[ KMAX_DIAL_NUMBER ]; + int32 Flags; +}; +struct K3L_GSM_CHANNEL_STATUS +{ + uint8 SignalStrength; + uint8 ErrorRate; + KGsmRegistryStatus RegistryStatus; + char OperName[ KMAX_GSM_OPER_NAME ]; + K3L_GSM_CALL_STATUS CallStatus[ KMAX_GSM_CALLS ]; + int32 UnreadSmsCount; + int32 EnabledFeatures; + char IMEI[ KMAX_GSM_IMEI_SIZE ]; + unsigned char SIM; + unsigned char Reserved[15]; +}; +struct K3L_LINK_STATUS +{ + int16 E1; + byte Channels[ KMAX_E1_CHANNELS ]; +}; +enum KPllErrors +{ + kpeClockAError = 0x01, + kpeClockBError = 0x02, + kpeSCbusError = 0x04, + kpeMVIPError = 0x08, + kpeMasterPllError = 0x10, + kpeModeError = 0x20, + kpeLocalRefError = 0x40, + kpeInternalError = 0x80 +}; +struct K3L_H100_STATUS +{ + int32 Mode; + int32 MasterClock; + int32 Enable; + int32 Reference; + int32 SCbus; + int32 HMVIP; + int32 MVIP90; + int32 CT_NETREF; + int32 PllLocalRef; + int32 PllErrors; +}; +enum KEchoLocation +{ + kelNetwork = 0x0, + kelCtBus = 0x1 +}; +enum KCodecIndex +{ + kci8kHzALAW = 0x00, + kci8kHzPCM = 0x01, + kci11kHzPCM = 0x02, + kci8kHzGSM = 0x03, + kci8kHzADPCM= 0x04, + kci8kHzULAW = 0x05, + kciLastCodecEntryMark +}; +enum KEchoCancellerConfig +{ + keccNotPresent, + keccOneSingleBank, + keccOneDoubleBank, + keccTwoSingleBank, + keccTwoDoubleBank, + keccFail +}; +struct K3L_DEVICE_CONFIG +{ + int32 LinkCount; + int32 ChannelCount; + int32 EnabledChannelCount; + int32 MixerCount; + int32 MixerCapacity; + int32 WorkStatus; + int32 DeviceModel; + int32 H100_Mode; + int32 PciBus; + int32 PciSlot; + int32 PlayerCount; + int32 VoIPChannelCount; + int32 CTbusCount; + KEchoCancellerConfig EchoConfig; + KEchoLocation EchoLocation; + sbyte SerialNumber[ KMAX_SERIAL_NUMBER ]; +}; + +typedef K3L_DEVICE_CONFIG K3L_E1_DEVICE_CONFIG; +typedef K3L_DEVICE_CONFIG K3L_FX_DEVICE_CONFIG; +struct K3L_API_CONFIG +{ + int32 MajorVersion; + int32 MinorVersion; + int32 BuildVersion; + int32 SvnRevision; + int32 RawCmdLogging; + int32 VpdVersionNeeded; + sbyte StrVersion[ KMAX_STR_VERSION ]; +}; +struct K3L_LINK_CONFIG +{ + KSignaling Signaling; + int32 IncomingDigitsRequest; + int32 IdentificationRequestPos; + int32 ChannelCount; + int32 ReceivingClock; + sbyte NumberA[ KMAX_DIAL_NUMBER + 1 + 3 ]; +}; +struct K3L_CHANNEL_CONFIG +{ + KSignaling Signaling; + int32 AutoEnableFeatures; + int32 CapableFeatures; +}; +struct K3L_E1600A_FW_CONFIG +{ + int32 MfcExchangersCount; + int32 MonitorBufferSize; + sbyte FwVersion[ KMAX_STR_VERSION ]; + sbyte DspVersion[ KMAX_DSP_NAME ]; +}; +struct K3L_E1600B_FW_CONFIG +{ + int32 AudioBufferSize; + int32 FilterCount; + int32 MixerCount; + int32 MixerCapacity; + sbyte FwVersion[ KMAX_STR_VERSION ]; + sbyte DspVersion[ KMAX_DSP_NAME ]; +}; +typedef K3L_E1600B_FW_CONFIG K3L_GSM40_FW_CONFIG; +typedef K3L_E1600B_FW_CONFIG K3L_FXO80_FW_CONFIG; +typedef K3L_E1600B_FW_CONFIG K3L_GSMUSB_FW_CONFIG; +struct K3L_COMMAND +{ + int32 Object; + int32 Cmd; + byte *Params; +}; + +enum KEventObjectId +{ + koiDevice = 0x00, + koiChannel = 0x01, + koiPlayer = 0x02, + koiLink = 0x03, + koiSystem = 0x04 +}; + +struct K3L_EVENT +{ + int32 Code; + int32 AddInfo; + int32 DeviceId; + int32 ObjectInfo; + void *Params; + int32 ParamSize; + int32 ObjectId; +}; +struct KIncomingSeizeParams +{ + sbyte NumberB[ KMAX_DIAL_NUMBER + 1 ]; + sbyte NumberA[ KMAX_DIAL_NUMBER + 1 ]; + sbyte Padding[2]; +}; +struct KCtbusCommand +{ + int32 Stream; + int32 TimeSlot; + int32 Enable; +}; +struct KUserInformation +{ + int32 ProtocolDescriptor; + int32 UserInfoLength; + byte UserInfo[ KMAX_USER_USER_LEN ]; +}; +struct KISDNSubaddressInformation +{ + KQ931TypeOfSubaddress TypeOfSubaddress; + bool OddNumberOfSignals; + int32 InformationLength; + byte Information[ KMAX_SUBADRESS_INFORMATION_LEN ]; +}; +struct KISDNSubaddresses +{ + KISDNSubaddressInformation Called; + KISDNSubaddressInformation Calling; +}; +enum KCTTransferResult +{ + TransferByJoin = 0, + TransferByRerouteing = 1 +}; +enum KLinkErrorCounter +{ + klecChangesToLock = 0, + klecLostOfSignal = 1, + klecAlarmNotification = 2, + klecLostOfFrame = 3, + klecLostOfMultiframe = 4, + klecRemoteAlarm = 5, + klecSlipAlarm = 6, + klecUnknowAlarm = klecSlipAlarm, + klecPRBS = 7, + klecWrogrBits = 8, + klecJitterVariation = 9, + klecFramesWithoutSync = 10, + klecMultiframeSignal = 11, + klecFrameError = 12, + klecBipolarViolation = 13, + klecCRC4 = 14, + klecCount = 15 +}; +struct K3L_LINK_ERROR_COUNTER +{ + int32 ErrorCounters[ klecCount ]; +}; +struct KSipData +{ + int32 DataLength; + byte Data[ KMAX_SIP_DATA ]; +}; + +enum KLibParams +{ + klpDebugFirmware, + klpResetFwOnStartup, + klpResetFwOnShutdown, + klpSeizureEventCompat, + klpDisableTDMBufferWarnings, + klpDisableInternalVoIP, + klpLogCallControl, + klpDoNotLogApiInterface, + klpMaxParams +}; + +enum KFaxChannelStatus +{ + kfaxcsFree, + kfaxcsWaitingForFaxSignal, + kfaxcsSendingFax, + kfaxcsReceivingFax, + kfaxcsFail +}; +enum KFaxResult +{ + kfaxrEndOfTransmission, + kfaxrStoppedByCommand, + kfaxrProtocolTimeout, + kfaxrProtocolError, + kfaxrRemoteDisconnection, + kfaxrFileError, + kfaxrUnknown, + kfaxrEndOfReception, + kfaxrCompatibilityError, + kfaxrQualityError, + kfaxrChannelReleased +}; +enum KFaxFileErrorCause +{ + kfaxfecTransmissionStopped, + kfaxfecTransmissionError, + kfaxfecListCleared, + kfaxfecCouldNotOpen, + kfaxfecInvalidHeader, + kfaxfecDataNotFound, + kfaxfecInvalidHeight, + kfaxfecUnsupportedWidth, + kfaxfecUnsupportedCompression, + kfaxfecUnsupportedRowsPerStrip, + kfaxfecUnknown +}; + +typedef stt_code ( Kstdcall K3L_CALLBACK )(); +typedef stt_code ( Kstdcall K3L_MONITOR_CALLBACK )( byte *, byte ); +typedef stt_code ( Kstdcall K3L_EVENT_CALLBACK )( int32 Object, K3L_EVENT * ); +typedef stt_code ( Kstdcall *K3L_THREAD_CALLBACK )( void * ); +typedef void ( Kstdcall K3L_AUDIO_CALLBACK )( int32 DevId, int32 Channel, byte *Buffer, int32 Size ); +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif +extern "C" +{ +sbyte *Kstdcall k3lStart( int32 Major, int32 Minor, int32 Build ); +void Kstdcall k3lStop(); +void Kstdcall k3lRegisterEventHandler( K3L_EVENT_CALLBACK *Function ); +void Kstdcall k3lRegisterAudioListener( K3L_AUDIO_CALLBACK *Player, K3L_AUDIO_CALLBACK *Recorder ); +int32 Kstdcall k3lSendCommand( int32 DeviceId, K3L_COMMAND *Cmd ); +int32 Kstdcall k3lSendRawCommand( int32 DeviceId, int32 IntfId, void *Command, int32 CmdSize ); +int32 Kstdcall k3lRegisterMonitor( K3L_MONITOR_CALLBACK *EventMonitor, K3L_MONITOR_CALLBACK *CommandMonitor, K3L_MONITOR_CALLBACK *BufferMonitor ); +int32 Kstdcall k3lGetDeviceConfig( int32 DeviceId, int32 Object, void *Data, int32 DataSize ); +int32 Kstdcall k3lGetDeviceStatus( int32 DeviceId, int32 Object, void *Data, int32 DataSize ); +int32 Kstdcall k3lGetDeviceCount(); +int32 Kstdcall k3lGetDeviceType( int32 DeviceId ); +int32 Kstdcall k3lGetEventParam( K3L_EVENT *Evt, const sbyte *Name, sbyte *Buffer, int32 BufferSize ); +int32 Kstdcall k3lSetGlobalParam( int32 ParamIndex, int32 ParamValue ); +int32 Kstdcall k3lGetChannelStats( int32 DevId, int32 Channel, KStatIndex si, uint32 *StatData ); +} +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif +#endif + + +enum KISDNDebugFlag +{ + kidfQ931 = 0x01, + kidfLAPD = 0x02, + kidfSystem = 0x04, + kidfInvalid = 0x08, +}; + +#define CM_VOIP_START_DEBUG 0x20 +#define CM_VOIP_STOP_DEBUG 0x21 +#define CM_VOIP_DUMP_STAT 0x22 + +#define CM_ISDN_DEBUG 0x24 + +#define CM_PING 0x123456 +#define EV_PONG 0x654321 + +#define CM_LOG_UPDATE 0x100 +#define EV_LOG_UPDATE 0x100 + +#endif /* _GENERATED_K3L_H_ */ diff --git a/src/mod/endpoints/mod_khomp/include/khomp_pvt.h b/src/mod/endpoints/mod_khomp/include/khomp_pvt.h new file mode 100644 index 0000000..5037492 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/include/khomp_pvt.h @@ -0,0 +1,1289 @@ +/******************************************************************************* + + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2010 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the LGPL + License. If you do not delete the provisions above, a recipient may use your + version of this file under either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*******************************************************************************/ + +#ifndef _KHOMP_PVT_H_ +#define _KHOMP_PVT_H_ + +#include <timer.hpp> +#include "globals.h" +#include "frame.h" +#include "opt.h" +#include "logger.h" +#include "defs.h" + +/*! + \brief Callback generated from K3L API for every new event on the board. + \param[in] obj Object ID (could be a channel or a board, depends on device type) which generated the event. + \param[in] e The event itself. + \return ksSuccess if the event was treated + \see K3L_EVENT Event specification + */ +extern "C" int32 Kstdcall khompEventCallback (int32, K3L_EVENT *); + +/*! + \brief Callback generated from K3L API everytime audio is available on the board. + @param[in] deviceid Board on which we get the event + @param[in] objectid The channel we are getting the audio from + @param[out] read_buffer The audio buffer itself (RAW) + @param[in] read_size The buffer size, meaning the amount of data to be read + \return ksSuccess if the event was treated + */ +extern "C" void Kstdcall khompAudioListener (int32, int32, byte *, int32); + +/******************************************************************************/ +/********************************* Board **************************************/ +/******************************************************************************/ +struct Board +{ + /* Timers */ + struct KhompPvt; + typedef KhompPvt * ChanTimerData; + typedef void (ChanTimerFunc)(ChanTimerData); + typedef TimerTemplate < ChanTimerFunc, ChanTimerData > ChanTimer; + +/******************************************************************************/ +/******************************** Channel *************************************/ +struct KhompPvt +{ + // TODO: Here for while, put in right struct, when is ready + typedef std::vector<std::string> ContextListType; + typedef std::vector<std::string> ExtenListType; + + typedef SimpleNonBlockLock<25,100> ChanLockType; + + typedef enum + { + CI_MESSAGE_BOX = 0x01, + CI_HUMAN_ANSWER = 0x02, + CI_ANSWERING_MACHINE = 0x04, + CI_CARRIER_MESSAGE = 0x08, + CI_UNKNOWN = 0x10, + CI_FAX = 0x20, + } + CallInfoType; + + struct InitFailure {}; + + struct InvalidSwitchChannel + { + typedef enum { NULL_SWITCH_CHANNEL, NULL_SWITCH_SESSION_PASSED, NULL_SWITCH_VALUE, FAILED } FailType; + + InvalidSwitchChannel(FailType fail, std::string msg) + : _fail(fail),_msg(msg) {}; + + std::string _msg; + FailType _fail; + }; + + typedef enum + { + PLAY_NONE = 0, + PLAY_VM_TONE, + PLAY_PBX_TONE, + PLAY_PUB_TONE, + PLAY_RINGBACK, + PLAY_FASTBUSY, + } + CadencesType; + + typedef enum + { + INDICA_NONE = 0, + INDICA_RING, + INDICA_BUSY, + INDICA_FAST_BUSY, + } + IndicationType; + + typedef enum + { + CLN_HARD, + CLN_SOFT, + CLN_FAIL, + } + CleanupType; + +/********************************** Call **************************************/ + struct Call + { + struct CallStatistics : public Statistics + { + CallStatistics(Call *call): + _call(call), + _total_time_incoming(0), + _total_time_outgoing(0), + _total_idle_time(0), + _channel_fails(0) + { + time(&_base_idle_time); + time(&_base_time); + } + + void idle() + { + if (_call->_flags.check(Kflags::IS_INCOMING) || + _call->_flags.check(Kflags::IS_OUTGOING) || + _call->_indication == INDICA_RING || + _call->_indication == INDICA_BUSY) + { + return; + } + + time_t tmp; + time (&tmp); + + _total_idle_time += (tmp - _base_idle_time); + time (&_base_idle_time); + } + + void incrementNewCall() + { + time (&_base_time); + } + + void incrementHangup() + { + time_t tmp; + time (&tmp); + + if (_call->_flags.check(Kflags::IS_OUTGOING)) + { + _total_time_outgoing += (tmp - _base_time); + time (&_base_time); + } + else if (_call->_flags.check(Kflags::IS_INCOMING)) + { + _total_time_incoming += (tmp - _base_time); + time (&_base_time); + } + + time(&_base_idle_time); + } + + void incrementChannelFail() + { + _channel_fails++; + } + + std::string getDetailed() + { + /* buffer our data to return at the end */ + std::string strBuffer; + + /* very very important yet! */ + idle(); + + std::string str_incoming_time = timeToString(_total_time_incoming); + std::string str_outgoing_time = timeToString(_total_time_outgoing); + std::string str_idle_time = timeToString(_total_idle_time); + + strBuffer.append(STG(FMT("Total Incoming Time: \t%s\n") % str_incoming_time)); + strBuffer.append(STG(FMT("Total Outgoing Time: \t%s\n") % str_outgoing_time)); + strBuffer.append(STG(FMT("Total Idle Time: \t%s\n") % str_idle_time)); + strBuffer.append(STG(FMT("Number of channel fails: \t%d\n") % _channel_fails)); + + return strBuffer; + } + + void clear() + { + time(&_base_time); + time(&_base_idle_time); + + _total_idle_time = 0; + _channel_fails = 0; + + _total_time_incoming = 0; + _total_time_outgoing = 0; + } + + time_t _base_time; + time_t _total_time_incoming; + time_t _total_time_outgoing; + time_t _total_idle_time; + time_t _base_idle_time; /* base time for idle time refreshing */ + unsigned int _channel_fails;/* number of channel fails*/ + + protected: + Call *_call; /* associate to call, useful */ + }; + + Call() + { + clear(); + _call_statistics = new CallStatistics(this); + } + + virtual ~Call() { delete _call_statistics; } + + CallStatistics * statistics() { return _call_statistics; }; + + virtual bool process(std::string name, std::string value = "") + { + if (name == "pre_answer") + { + _pre_answer = true; + } + else if (name == "orig") + { + DBG(FUNC, FMT("orig addr adjusted (%s).") % value.c_str()); + _orig_addr = value; + } + else if (name == "dest") + { + _dest_addr = value; + } + + else if (name == "input_volume" || name == "output_volume") + { + try + { + //std::string type((name == "input_volume")?"input":"output"); + + int i = Strings::tolong(value); + + if (i < -10 || i > 10) + { + LOG(ERROR, FMT("Could not set '%s': '%s' is not a valid number between -10 and 10.") % name % value); + } + else + { + DBG(FUNC, FMT("Changing '%s' volume to '%s'.") % name % value); + if(name == "input_volume") + _input_volume = i; + else + _output_volume = i; + } + } + catch (Strings::invalid_value & e) + { + LOG(ERROR, D("invalid numeric value: %s") % e.value()); + } + } + + else + { + return false; + } + + return true; + } + + virtual bool clear() + { + + _orig_addr.clear(); + _dest_addr.clear(); + _incoming_context.clear(); + _queued_digits_buffer.clear(); + _pre_answer = false; + _is_progress_sent = false; + _collect_call = false; + _hangup_cause = 0; + _cleanup_upon_hangup = false; + _input_volume = 999; + _output_volume = 999; + + _var_dtmf_state = T_UNKNOWN; + _var_echo_state = T_UNKNOWN; + _var_gain_state = T_UNKNOWN; + + _flags.clearAll(); + + _cadence = PLAY_NONE; + _indication = INDICA_NONE; + + return true; + } + + /* used while answering calls */ + std::string _orig_addr; + std::string _dest_addr; + + std::string _incoming_context; + + std::string _queued_digits_buffer; + + /* should freeswitch answer before connect event? */ + bool _pre_answer; + + bool _is_progress_sent; + + /* is a collect call? */ + bool _collect_call; + + int _hangup_cause; + + bool _cleanup_upon_hangup; + + int _input_volume; + int _output_volume; + + TriState _var_dtmf_state; + TriState _var_echo_state; + TriState _var_gain_state; + + Kflags _flags; + + CadencesType _cadence; + IndicationType _indication; + + ChanTimer::Index _idx_co_ring; + ChanTimer::Index _idx_pbx_ring; + + CallStatistics *_call_statistics; + }; +/******************************************************************************/ +public: + + /* KhompPvt constructor */ + KhompPvt(K3LAPI::target & target); + + /* KhompPvt destructor */ + virtual ~KhompPvt() + { + delete _pvt_statistics; + _session = NULL; + } + + struct PvtStatistics : public Statistics + { + PvtStatistics(KhompPvt * pvt): + _pvt(pvt) {} + + std::string getDetailedRates(); + std::string getDetailed(); + std::string getRow(); + + void clear() + { + _pvt->call()->statistics()->clear(); + } + + KhompPvt * _pvt; + }; + + /* Virtual Methods */ + + /*! + \defgroup KhompEvents + Callbacks that boards can implement to produce the expected + particular behaviour. Refer to Khomp documentation for a + detailed description of each method. + */ + /*@{*/ + virtual bool onChannelRelease(K3L_EVENT *); + virtual bool onNewCall(K3L_EVENT *); + virtual bool onCallSuccess(K3L_EVENT *); + virtual bool onCallFail(K3L_EVENT *); + virtual bool onConnect(K3L_EVENT *); + virtual bool onDisconnect(K3L_EVENT *); + virtual bool onAudioStatus(K3L_EVENT *); + virtual bool onCollectCall(K3L_EVENT *); + virtual bool onSeizureStart(K3L_EVENT *); + virtual bool onDtmfDetected(K3L_EVENT *); + virtual bool onNoAnswer(K3L_EVENT *); + virtual bool onDtmfSendFinish(K3L_EVENT *); + virtual bool onEvUntreated(K3L_EVENT *); + virtual bool eventHandler(K3L_EVENT *); + /*@}*/ + + virtual bool doChannelAnswer(CommandRequest &); + virtual bool doChannelHangup(CommandRequest &); + bool commandHandler(CommandRequest &); + + virtual int makeCall(std::string params = ""); + virtual bool setupConnection(); + + virtual int causeFromCallFail(int fail) { return SWITCH_CAUSE_USER_BUSY; }; + virtual int callFailFromCause(int cause) { return -1; }; + virtual void reportFailToReceive(int fail_code) + { + call()->_indication = INDICA_FAST_BUSY; + } + virtual bool setCollectCall(); + + virtual bool indicateBusyUnlocked(int cause, bool sent_signaling = false); + + virtual bool cleanup(CleanupType type = CLN_HARD); + + virtual RingbackDefs::RingbackStType sendRingBackStatus(int rb_value = RingbackDefs::RB_SEND_DEFAULT) + { + return RingbackDefs::RBST_UNSUPPORTED; + } + + virtual bool sendPreAudio(int rb_value = RingbackDefs::RB_SEND_NOTHING) + { + if (rb_value != RingbackDefs::RB_SEND_NOTHING) + { + if(sendRingBackStatus(rb_value) == RingbackDefs::RBST_FAILURE) + return false; + } + + return true; + } + + virtual bool isOK(void) { return false; } + virtual bool isPhysicalFree() { return false; } + virtual bool isFree(bool just_phy = false); + + virtual bool hasNumberDial() { return true; } + + virtual void getSpecialVariables() + { + try + { + const char * str_sup = getFSChannelVar("KDTMFSuppression"); + const char * str_agc = getFSChannelVar("KAutoGainControl"); + const char * str_eco = getFSChannelVar("KEchoCanceller"); + + call()->_var_dtmf_state = (str_sup ? ((!SAFE_strcasecmp(str_sup, "true") || !SAFE_strcasecmp(str_sup, "on"))? T_TRUE : T_FALSE) : T_UNKNOWN); + call()->_var_echo_state = (str_eco ? (!SAFE_strcasecmp(str_eco, "true") ? T_TRUE : T_FALSE) : T_UNKNOWN); + call()->_var_gain_state = (str_agc ? (!SAFE_strcasecmp(str_agc, "true") ? T_TRUE : T_FALSE) : T_UNKNOWN); + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR, PVT_FMT(_target, "%s") % err._msg.c_str()); + } + + try + { + char * volume = (char*) getFSChannelVar("KSetVolume"); + + if(!volume) + { + return; + } + + std::string datastr(volume); + + Strings::trim(datastr); + + Strings::vector_type params; + Strings::tokenize(datastr, params, "|,", 2); + + int inpvol = INT_MAX; + int outvol = INT_MAX; + + /**/ if (params.size() == 1) + { + int vol = (params[0] != "none" ? Strings::tolong(params[0]) : INT_MAX); + + inpvol = vol; + outvol = vol; + } + else if (params.size() == 2) + { + inpvol = (params[0] != "none" ? Strings::tolong(params[0]) : INT_MAX); + outvol = (params[1] != "none" ? Strings::tolong(params[1]) : INT_MAX); + } + else + { + LOG(ERROR, "invalid number of arguments for KSetVolume!"); + return; + } + + if (inpvol != INT_MAX) + { + if(_call->_input_volume < -10 || _call->_input_volume > 10) + { + _call->_input_volume = inpvol; + } + } + + if (outvol != INT_MAX) + { + if(_call->_output_volume < -10 || _call->_output_volume > 10) + { + _call->_output_volume = outvol; + } + } + + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR, PVT_FMT(_target, "%s") % err._msg.c_str()); + } + catch (Strings::invalid_value e) + { + LOG(ERROR, FMT("invalid numeric value: %s") % e.value()); + } + } + + virtual void setSpecialVariables() {} + + virtual bool application(ApplicationType type, switch_core_session_t * session, const char *data) + { + switch(type) + { + case FAX_ADJUST: + case FAX_SEND: + case FAX_RECEIVE: + LOG(ERROR, PVT_FMT(_target, "not a digital and not " + "a fxo Khomp channel, fax not supported")); + break; + default: + LOG(ERROR, PVT_FMT(_target, + "application not supported")); + break; + } + + return false; + } + + /* statistics functions */ + virtual std::string getStatistics(Statistics::Type type); + virtual void clearStatistics() + { + _pvt_statistics->clear(); + } + + virtual bool indicateRinging(); + virtual bool sendDtmf(std::string digit); + + /* Methods */ + + bool indicateProgress(); + + bool signalDTMF(char d); + + bool loopWhileFlagTimed(Kflags::FlagType flag, int &timeout, bool clear = true) + { + bool pvt_locked = true; + bool quit = false; + + unsigned int sleeps = 0; + + while ((timeout != 0) && !quit) + { + for (; (sleeps < 10) && !quit; sleeps++) + { + /* unlock our pvt struct */ + if (pvt_locked) + { + _mutex.unlock(); + pvt_locked = false; + } + + /* wait a little while (100ms is good?) */ + usleep (100000); + ++sleeps; + + /* re-lock pvt struct */ + switch (_mutex.lock()) + { + case SimpleLock::ISINUSE: + case SimpleLock::FAILURE: + LOG(ERROR, PVT_FMT(_target, "unable to lock pvt_mutex, trying again.")); + + sched_yield(); + continue; + + default: + break; + } + + pvt_locked = true; + + if(clear) + { + if(!call()->_flags.check(flag)) + { + quit = true; + break; + } + } + else + { + if(call()->_flags.check(flag)) + { + quit = true; + break; + } + + } + } + + /* decrement timeout, zero "sleeps". */ + timeout = (timeout > 0) ? timeout - 1 : timeout; + sleeps = 0; + } + + /* pvt should always be locked when retuning here. */ + return pvt_locked; + } + + K3LAPI::target & target() + { + return _target; + } + + void session(switch_core_session_t * newSession) + { + _session = newSession; + } + + switch_core_session_t * session() + { + return _session; + } + + void owner(switch_core_session_t * owner) { _owner = owner; } + + switch_core_session_t * owner() const { return _owner; } + + /* + Returns the FreeSWITCH channel (switch_channel_t) + Can throw InvalidSwitchChannel, so must be carefull + */ + switch_channel_t * getFSChannel() + { + if(!session()) + throw InvalidSwitchChannel(InvalidSwitchChannel::NULL_SWITCH_SESSION_PASSED,"null switch_core_session_t"); + switch_channel_t *c = switch_core_session_get_channel(session()); + if(!c) + throw InvalidSwitchChannel(InvalidSwitchChannel::NULL_SWITCH_CHANNEL,"null switch_channel_t obtained"); + return c; + } + + /* + Returns the FreeSWITCH channel (switch_channel_t) from given session + Can throw InvalidSwitchChannel, so must be carefull + */ + static switch_channel_t * getFSChannel(switch_core_session_t * s) + { + if(!s) + throw InvalidSwitchChannel(InvalidSwitchChannel::NULL_SWITCH_SESSION_PASSED,"null switch_core_session_t passed"); + switch_channel_t *c = switch_core_session_get_channel(s); + if(!c) + throw InvalidSwitchChannel(InvalidSwitchChannel::NULL_SWITCH_CHANNEL,"null switch_channel_t obtained"); + return c; + } + + /* + Returns the FreeSWITCH partner session (switch_core_session_t) + Can throw InvalidSwitchChannel, so must be carefull + Don't forget to unlock [unlockPartner(switch_core_session_t*)] + */ + switch_core_session_t * getFSLockedPartnerSession() + { + if(!session()) + throw InvalidSwitchChannel(InvalidSwitchChannel::NULL_SWITCH_SESSION_PASSED,"null switch_core_session_t"); + + switch_core_session_t * p_s = NULL; + switch_core_session_get_partner(session(), &p_s); + + if(!p_s) + throw InvalidSwitchChannel(InvalidSwitchChannel::NULL_SWITCH_SESSION_PASSED,"null switch_core_session_t (partner)"); + return p_s; + } + + /* Unlock a partner session */ + void unlockPartner(switch_core_session_t * s) + { + if(!s) + throw InvalidSwitchChannel(InvalidSwitchChannel::NULL_SWITCH_SESSION_PASSED,"null switch_core_session_t passed"); + switch_core_session_rwunlock(s); + } + + /* Get the uuid of session */ + char * getUUID() + { + if(!session()) + throw InvalidSwitchChannel(InvalidSwitchChannel::NULL_SWITCH_SESSION_PASSED,"null switch_core_session_t"); + return switch_core_session_get_uuid(session()); + } + + /* Get the uuid of given session */ + char * getUUID(switch_core_session_t * s) + { + if(!s) + throw InvalidSwitchChannel(InvalidSwitchChannel::NULL_SWITCH_SESSION_PASSED,"null switch_core_session_t passed"); + return switch_core_session_get_uuid(s); + } + + /* + Set a variable into a FS channel + Can throw InvalidSwitchChannel, so must be carefull + */ + void setFSChannelVar(const char * name, const char * value) + { + if(!name || !value) + return; + + switch_channel_t *c = getFSChannel(_owner); + if(!c) + throw InvalidSwitchChannel(InvalidSwitchChannel::NULL_SWITCH_CHANNEL,"null switch_channel_t obtained"); + switch_channel_set_variable(c,name,value); + } + + /* + Set a variable into a FS channel + Can throw InvalidSwitchChannel, so must be carefull + */ + void setFSChannelVar(switch_channel_t *c, const char * name, const char * value) + { + if(!c) + throw InvalidSwitchChannel(InvalidSwitchChannel::NULL_SWITCH_CHANNEL,"null switch_channel_t obtained"); + + if(!name || !value) + return; + + switch_channel_set_variable(c,name,value); + } + + /* + Get a varibale from a FS channel + Can throw InvalidSwitchChannel, so must be carefull + */ + const char * getFSChannelVar(const char * value) + { + if(!value) + throw InvalidSwitchChannel(InvalidSwitchChannel::NULL_SWITCH_VALUE, "value is null"); + + switch_channel_t *c = getFSChannel(_owner); + if(!c) + throw InvalidSwitchChannel(InvalidSwitchChannel::NULL_SWITCH_CHANNEL,"null switch_channel_t obtained"); + return switch_channel_get_variable(c,value); + } + + /* + Get a varibale from a FS from a given channel + Can throw InvalidSwitchChannel, so must be carefull + */ + const char * getFSChannelVar(switch_channel_t *c, const char * value) + { + if(!c) + throw InvalidSwitchChannel(InvalidSwitchChannel::NULL_SWITCH_CHANNEL,"null switch_channel_t obtained"); + if(!value) + throw InvalidSwitchChannel(InvalidSwitchChannel::NULL_SWITCH_VALUE, "value is null"); + return switch_channel_get_variable(c,value); + } + + /* Set a global variable (without any throw) */ + void setFSGlobalVar(const char * name, const char * value) + { + if(!name || !value) + return; + + switch_core_set_variable(name,value); + } + + /* Get a global variable (without any throw) */ + const char * getFSGlobalVar(const char * name) + { + if(!name) + return NULL; + + return switch_core_get_variable(name); + } + + bool mixer(const char *file, const char *func, int line, + byte track, KMixerSource src, int32 index) + { + KMixerCommand mix; + + mix.Track = track; + mix.Source = src; + mix.SourceIndex = index; + + return command(file, func, line, CM_MIXER, (const char *)&mix); + } + + /* Error handling for send command */ + bool command(const char *file, const char *func, int line, int code, + const char *params = NULL, bool log = true) + { + try + { + Globals::k3lapi.command(_target, code, params); + } + catch(K3LAPI::failed_command & e) + { + if(log) + { + DBG(FUNC, OBJ_FMT(e.dev,e.obj,"Command '%s' has failed with error '%s'") + % Verbose::commandName(e.code).c_str() + % Verbose::status((KLibraryStatus)e.rc).c_str()); + } + + return false; + } + + return true; + } + + //TODO: Unir os dois metodos + int commandState(const char *file, const char *func, int line, int code, + const char *params = NULL) + { + try + { + Globals::k3lapi.command(_target, code, params); + } + catch(K3LAPI::failed_command & e) + { + LOG(ERROR,OBJ_FMT(e.dev,e.obj,"Command '%s' has failed with error '%s'") + % Verbose::commandName(e.code).c_str() + % Verbose::status((KLibraryStatus)e.rc).c_str()); + + return e.rc; + } + + return ksSuccess; + } + + /*! + \brief Will init part of our private structure and setup all the read/write + buffers along with the proper codecs. Right now, only PCMA. + */ + switch_status_t justAlloc(bool is_answering = true, switch_memory_pool_t **pool = NULL); + switch_status_t justStart(switch_caller_profile_t *profile = NULL); + + void destroy(switch_core_session_t * s = NULL); + void destroyAll(); + + void doHangup(); + + void setHangupCause(int cause, bool set_now = false) + { + if(_call->_hangup_cause) + { + + DBG(FUNC,PVT_FMT(_target,"cause already set to %s") % switch_channel_cause2str((switch_call_cause_t) _call->_hangup_cause)); + return; + } + + if(!session()) + { + DBG(FUNC,PVT_FMT(_target,"session is null")); + return; + } + + switch_channel_t * channel = NULL; + + try + { + channel = getFSChannel(); + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + DBG(FUNC, PVT_FMT(_target,"%s") % err._msg.c_str()); + return; + } + + int cause_from_freeswitch = switch_channel_get_cause(channel); + if(cause_from_freeswitch != SWITCH_CAUSE_NONE) + { + DBG(FUNC,PVT_FMT(_target,"cause already set to %s from freeswitch") % switch_channel_cause2str((switch_call_cause_t)cause_from_freeswitch)); + _call->_hangup_cause = cause_from_freeswitch; + return; + } + + if(!cause) + { + DBG(FUNC,PVT_FMT(_target,"cause not defined")); + } + else + { + DBG(FUNC,PVT_FMT(_target,"setting cause to '%s'") % switch_channel_cause2str((switch_call_cause_t) cause)); + _call->_hangup_cause = cause; + + // not set variable in channel owner + if(set_now) + { + switch_channel_hangup(channel, (switch_call_cause_t)_call->_hangup_cause); + } + } + } + + bool startCadence(CadencesType type); + bool stopCadence() + { + if(call()->_cadence != PLAY_NONE) + { + call()->_cadence = PLAY_NONE; + + command(KHOMP_LOG, CM_STOP_CADENCE); + } + } + + bool startStream(bool enable_mixer = true); + bool stopStream(bool enable_mixer = true); + + bool startListen(bool conn_rx = true); + bool stopListen(void); + + bool obtainRX(bool with_delay = false); + bool obtainTX(); + + bool setVolume(const char * type, int volume); + bool setVolume() + { + bool ret = false; + + if(_call->_input_volume >= -10 && _call->_input_volume <= 10) + { + setVolume("input", _call->_input_volume); + ret = true; + } + + if(_call->_output_volume >= -10 && _call->_output_volume <= 10) + { + setVolume("output", _call->_output_volume); + ret = true; + } + + return ret; + } + + KSignaling getSignaling(void) + { + return Globals::k3lapi.channel_config(_target.device,_target.object).Signaling; + } + + std::string getStateString(void); + + bool dtmfSuppression(bool enable); + bool echoCancellation(bool enable); + virtual bool autoGainControl(bool enable); + + /* Timer callbacks */ + static void pbxRingGen(Board::KhompPvt * pvt); + static void coRingGen(Board::KhompPvt * pvt); + + virtual int getActiveChannel(bool invalid_as_not_found); + + MatchType matchExtension(std::string &, std::string &, std::string &, bool match_only = false); + + MatchType findExtension(std::string &, std::string &, ContextListType &, std::string &, std::string &, + bool default_ctx = true, bool default_ext = true); + + /* Let's validate the contexts */ + virtual bool validContexts(Board::KhompPvt::ContextListType & contexts, std::string extra_string = "") + { + DBG(FUNC,PVT_FMT(_target,"c")); + + if(!_group_context.empty()) + { + contexts.push_back(_group_context); + } + + for (Board::KhompPvt::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) + replaceTemplate((*i), "DD", _target.device); + + BEGIN_CONTEXT + { + K3L_DEVICE_CONFIG & dev_cfg = Globals::k3lapi.device_config(_target.device); + + for (Board::KhompPvt::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) + replaceTemplate((*i), "SSSS", atoi(dev_cfg.SerialNumber)); + } + END_CONTEXT + + DBG(FUNC,PVT_FMT(_target,"r")); + return true; + } + + void cleanupBuffers() + { + DBG(FUNC,PVT_FMT(_target, "Cleanup buffers")); + + _reader_frames.clear(); + _writer_frames.clear(); + + for(unsigned int i = 0; i < SILENCE_PACKS; i++) + { + /* add silence to the read buffer */ + if (!_reader_frames.give((const char *)Board::_cng_buffer, Globals::switch_packet_size)) + { + LOG(ERROR, PVT_FMT(target(), "Problem in Reader Buffer")); + } + + /* add silence to the writer buffer */ + if (!_writer_frames.give((const char *)Board::_cng_buffer, Globals::boards_packet_size)) + { + LOG(ERROR, PVT_FMT(target(), "Problem in Writer Buffer")); + } + } + } + + bool freeState() + { + return !(_call->_flags.check(Kflags::IS_INCOMING) || _call->_flags.check(Kflags::IS_OUTGOING)); + } + + Call * call() { return _call; } + + K3LAPI::target _target; /*!< The device/channel pair to bind this pvt to */ + ChanLockType _mutex; /*!< Used for *our* internal locking */ + Call *_call; + switch_core_session_t *_session; /*!< The session to which this pvt is associated with */ + switch_core_session_t *_owner; + bool _has_fail; + + switch_caller_profile_t *_caller_profile; + + switch_codec_t _read_codec; + switch_codec_t _write_codec; + + FrameSwitchManager _reader_frames; + FrameBoardsManager _writer_frames; + + std::string _group_context; + + PvtStatistics *_pvt_statistics; +}; + +/******************************************************************************/ +/******************************************************************************/ + typedef std::vector < Board * > VectorBoard; + typedef std::vector < KhompPvt * > VectorChannel; /*!< Collection of pointers of KhompPvts */ + + /* + these (below) are going to rule the elements ordering in our multiset + (used as a "ordering-save priority queue"). + */ + struct PvtCallCompare + { + bool operator() (KhompPvt * pvt1, KhompPvt * pvt2) const + { + /* true if pvt1 precedes pvt2 */ + return (Board::getStats(pvt1->target().device,pvt1->target().object,kcsiOutbound) < + Board::getStats(pvt2->target().device,pvt2->target().object,kcsiOutbound)); + return true; + } + }; + + typedef std::multiset< KhompPvt *, PvtCallCompare > PriorityCallQueue; + +public: + + /* Board constructor */ + Board(int id) : _device_id(id) {} + + /* Board destructor */ + virtual ~Board() {} + + int id() { return _device_id; } + + KhompPvt * channel(int obj) + { + try + { + KhompPvt * pvt = _channels.at(obj); + + if(!pvt) + { + throw; + } + + return pvt; + } + catch (...) + { + throw K3LAPI::invalid_channel(_device_id, obj); + } + } + + ChanEventHandler * chanEventHandler() { return _event_handler; } + + ChanCommandHandler * chanCommandHandler() { return _command_handler; } + + virtual void initializeChannels(void); + void finalizeChannels(void); + + virtual bool eventHandler(const int obj, K3L_EVENT *e) + { + DBG(STRM, D("(Generic Board) c")); + + bool ret = true; + + switch(e->Code) + { + case EV_REQUEST_DEVICE_SECURITY_KEY: + break; + default: + try + { + ret = channel(obj)->eventHandler(e); + } + catch (K3LAPI::invalid_channel & invalid) + { + LOG(ERROR, OBJ_FMT(_device_id,obj,"(Generic Board) r (invalid channel on event '%s')") + % Verbose::eventName(e->Code).c_str()); + + return false; + } + + break; + } + + DBG(STRM, D("(Generic Board) r")); + + return ret; + } + +public: + ChanTimer _timers; +protected: + const int _device_id; + ChanEventHandler * _event_handler; /* The device event handler */ + ChanCommandHandler * _command_handler; /* The device command handler */ + VectorChannel _channels; + +public: + /* static stuff */ + static bool initializeK3L(void); + static bool finalizeK3L(void); + static bool initializeHandlers(void); + static bool finalizeHandlers(void); + static void initializeBoards(void); + static void finalizeBoards(void); + static void initializeCngBuffer(void); + static bool initialize(void); + static bool finalize(void); + + /* Thread Device Event Handler */ + static int eventThread(void *); + + /* Thread Device Command Handler */ + static int commandThread(void *); + + /*! + \brief Lookup channels and boards when dialed. + \param allocation_string The dialstring as put on Dialplan. [Khomp/[a|A|0-board_high]/[a|A|0-channel_high]/dest]. + \param new_session Session allocated for this call. + \param[out] cause Cause returned. Returns NULL if suceeded if not, the proper cause. + \return KhompPvt to be used on the call. + */ + static KhompPvt * find_channel(char* allocation_string, switch_core_session_t * new_session, switch_call_cause_t * cause); + static void khomp_add_event_board_data(const K3LAPI::target target, switch_event_t *event); + + static Board * board(int dev) + { + try + { + Board * b = _boards.at(dev); + + if(!b) + { + throw; + } + + return b; + } + catch(...) + { + throw K3LAPI::invalid_device(dev); + } + } + + static KhompPvt * get(int32 device, int32 object) + { + //if (!Globals::k3lapi.valid_channel(device, object)) + // throw K3LAPI::invalid_channel(device, object); + + try + { + return board(device)->channel(object); + } + catch(...) + { + throw K3LAPI::invalid_channel(device, object); + } + } + + static KhompPvt * get(K3LAPI::target & target) + { + //if (!Globals::k3lapi.valid_channel(target.device, target.object)) + // throw K3LAPI::invalid_channel(target.device, target.object); + + try + { + return board(target.device)->channel(target.object); + //return KhompPvt::_pvts[target.device][target.object]; + } + catch(...) + { + return NULL; + //throw K3LAPI::invalid_channel(target.device, target.object); + } + } + + static unsigned int getStats(int32 device, int32 object, uint32 index) + { + unsigned int stats = (unsigned int)-1; + + try + { + stats = Globals::k3lapi.channel_stats(device, object, index); + } + catch(K3LAPI::invalid_channel & err) + { + //K::logger::logg(C_WARNING, B(dev,channel, "Command get_stats has failed with error '%s'.") % + // Verbose::status((KLibraryStatus) stt_res)); + } + + return stats; + } + + static KhompPvt * queueFindFree(PriorityCallQueue &pqueue); + static void queueAddChannel(PriorityCallQueue &pqueue, unsigned int board, unsigned int object); + static KhompPvt * findFree(unsigned int board, unsigned int object, bool fully_available = true); + static void applyGlobalVolume(void); + +public: + + static VectorBoard _boards; + static char _cng_buffer[Globals::cng_buffer_size]; + + static Kommuter kommuter; + +}; + +/******************************************************************************/ +/******************************************************************************/ +/******************************************************************************/ + +#endif /* _KHOMP_PVT_H_*/ diff --git a/src/mod/endpoints/mod_khomp/include/khomp_pvt_fxo.h b/src/mod/endpoints/mod_khomp/include/khomp_pvt_fxo.h new file mode 100644 index 0000000..87eaa29 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/include/khomp_pvt_fxo.h @@ -0,0 +1,376 @@ +/******************************************************************************* + + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2010 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the LGPL + License. If you do not delete the provisions above, a recipient may use your + version of this file under either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*******************************************************************************/ + +#ifndef _KHOMP_PVT_FXO_H_ +#define _KHOMP_PVT_FXO_H_ + +#include "khomp_pvt.h" +#include "applications.h" + +/******************************************************************************/ +/********************************* FXO Board **********************************/ +/******************************************************************************/ +struct BoardFXO: public Board +{ +/******************************************************************************/ +/******************************** FXO Channel *********************************/ +struct KhompPvtFXO: public KhompPvt +{ +/********************************** FXO Call **********************************/ + struct CallFXO : public Call + { + CallFXO() {} + + bool process(std::string name, std::string value = "") + { + if (name == "pre") + { + DBG(FUNC, D("pre digits adjusted (%s).") % value); + _pre_digits = value; + } + else if (name == "answer_info") + { + _call_info_report = true; + } + else if (name == "drop_on") + { + _call_info_report = true; + + Strings::vector_type drop_item; + Strings::tokenize (value, drop_item, ".+"); + + for (Strings::vector_type::iterator i = drop_item.begin(); i != drop_item.end(); i++) + { + + if ((*i) == "message_box") _call_info_drop |= CI_MESSAGE_BOX; + else if ((*i) == "human_answer") _call_info_drop |= CI_HUMAN_ANSWER; + else if ((*i) == "answering_machine") _call_info_drop |= CI_ANSWERING_MACHINE; + else if ((*i) == "carrier_message") _call_info_drop |= CI_CARRIER_MESSAGE; + else if ((*i) == "unknown") _call_info_drop |= CI_UNKNOWN; + else + { + LOG(ERROR, FMT("unknown paramenter to 'calldrop' Dial option: '%s'.") % (*i)); + continue; + } + + DBG(FUNC, FMT("droping call on '%s'.") % (*i)); + } + } + else if (name == "usr_xfer") + { + _user_xfer_digits = value; + } + else + { + return Call::process(name, value); + } + + return true; + } + + bool clear() + { + _pre_digits.clear(); + _call_info_report = false; + _call_info_drop = 0; + + _user_xfer_digits = Opt::_user_xfer; + _user_xfer_buffer.clear(); + _digits_buffer.clear(); + + _var_fax_adjust = T_UNKNOWN; + + return Call::clear(); + } + + std::string _pre_digits; + + /* report what we got? */ + bool _call_info_report; + + /* what call info flags should make us drop the call? */ + long int _call_info_drop; + + /* used for xfer on user signaling */ + std::string _user_xfer_digits; + std::string _user_xfer_buffer; + std::string _digits_buffer; + + TriState _var_fax_adjust; + + //ChanTimer::Index _idx_disconnect; + }; +/******************************************************************************/ + KhompPvtFXO(K3LAPI::target & target) : KhompPvt(target) + { + _fax = new Fax(this); + _transfer = new Transfer<CallFXO>(this); + command(KHOMP_LOG, CM_ENABLE_CALL_ANSWER_INFO); + } + + ~KhompPvtFXO() + { + delete _fax; + delete _transfer; + } + + CallFXO * callFXO() + { + return (CallFXO *)call(); + } + + int makeCall(std::string params = ""); + bool doChannelAnswer(CommandRequest &); + + bool onNewCall(K3L_EVENT *e); + bool onDisconnect(K3L_EVENT *e); + bool onChannelRelease(K3L_EVENT *e); + bool onCallSuccess(K3L_EVENT *e); + bool onCallFail(K3L_EVENT *e); + bool onAudioStatus(K3L_EVENT *e); + bool onSeizeSuccess(K3L_EVENT *e); + bool onDtmfDetected(K3L_EVENT *e); + bool onDtmfSendFinish(K3L_EVENT *); + bool onCallAnswerInfo(K3L_EVENT *e); + + virtual bool eventHandler(K3L_EVENT *e) + { + DBG(STRM, D("(FXO) c")); + + bool ret = true; + + switch(e->Code) + { + case EV_NEW_CALL: + ret = onNewCall(e); + break; + case EV_DISCONNECT: + ret = onDisconnect(e); + break; + case EV_CHANNEL_FREE: + case EV_CHANNEL_FAIL: + ret = onChannelRelease(e); + break; + case EV_CALL_SUCCESS: + ret = onCallSuccess(e); + break; + case EV_CALL_FAIL: + ret = onCallFail(e); + break; + case EV_AUDIO_STATUS: + ret = onAudioStatus(e); + break; + case EV_SEIZE_SUCCESS: + ret = onSeizeSuccess(e); + break; + case EV_DTMF_DETECTED: + case EV_PULSE_DETECTED: + ret = onDtmfDetected(e); + break; + case EV_DTMF_SEND_FINISH: + ret = onDtmfSendFinish(e); + break; + case EV_CALL_ANSWER_INFO: + ret = onCallAnswerInfo(e); + break; + case EV_FAX_CHANNEL_FREE: + ret = _fax->onFaxChannelRelease(e); + break; + case EV_FAX_FILE_SENT: + case EV_FAX_FILE_FAIL: + case EV_FAX_TX_TIMEOUT: + case EV_FAX_PAGE_CONFIRMATION: + case EV_FAX_REMOTE_INFO: + break; + case EV_POLARITY_REVERSAL: + break; + default: + ret = KhompPvt::eventHandler(e); + break; + } + + DBG(STRM, D("(FXO) r")); + + return ret; + } + + bool application(ApplicationType type, switch_core_session_t * session, const char *data); + + bool setupConnection(); + bool autoGainControl(bool enable); + void setAnswerInfo(int answer_info); + bool indicateBusyUnlocked(int cause, bool sent_signaling = false); + void reportFailToReceive(int fail_code); + bool validContexts(Board::KhompPvt::ContextListType & contexts, std::string extra_context = ""); + + bool isOK(void); + + bool isPhysicalFree() + { + K3L_CHANNEL_STATUS status; + + if (k3lGetDeviceStatus (_target.device, _target.object + ksoChannel, &status, sizeof (status)) != ksSuccess) + return false; + + bool physically_free = (status.AddInfo == kfcsEnabled); + + if(status.CallStatus != kcsFree || !physically_free) + { + DBG(FUNC, PVT_FMT(_target, "call status not free, or not physically free!")); + return false; + } + + return true; + } + + virtual bool cleanup(CleanupType type = CLN_HARD) + { + //Board::board(_target.device)->_timers.del(callFXO()->_idx_disconnect); + //callFXO()->_idx_disconnect.reset(); + + call()->_flags.clear(Kflags::CALL_WAIT_SEIZE); + call()->_flags.clear(Kflags::EARLY_RINGBACK); + + _transfer->clear(); + + switch (type) + { + case CLN_HARD: + case CLN_FAIL: + call()->_flags.clear(Kflags::FAX_DETECTED); + break; + case CLN_SOFT: + break; + } + + return KhompPvt::cleanup(type); + } + + virtual void getSpecialVariables() + { + try + { + const char * str_fax = getFSChannelVar("KAdjustForFax"); + + callFXO()->_var_fax_adjust = (str_fax ? (!SAFE_strcasecmp(str_fax, "true") ? T_TRUE : T_FALSE) : T_UNKNOWN); + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR, PVT_FMT(_target, "(FXO) %s") % err._msg.c_str()); + } + + KhompPvt::getSpecialVariables(); + } + + bool sendDtmf(std::string digit); + + /* used by app FAX */ + Fax * _fax; + + Transfer<CallFXO> * _transfer; + +// static void delayedDisconnect(Board::KhompPvt * pvt); + +}; +/******************************************************************************/ +/******************************************************************************/ + BoardFXO(int id) : Board(id) {} + + void initializeChannels(void) + { + LOG(MESSAGE, "(FXO) loading channels ..."); + + for (unsigned obj = 0; obj < Globals::k3lapi.channel_count(_device_id); obj++) + { + K3LAPI::target tgt(Globals::k3lapi, K3LAPI::target::CHANNEL, _device_id, obj); + KhompPvt * pvt; + + switch(Globals::k3lapi.channel_config(_device_id, obj).Signaling) + { + case ksigAnalog: + pvt = new BoardFXO::KhompPvtFXO(tgt); + pvt->_call = new BoardFXO::KhompPvtFXO::CallFXO(); + DBG(FUNC, "(FXO) FXO channel"); + break; + default: + pvt = new Board::KhompPvt(tgt); + pvt->_call = new Board::KhompPvt::Call(); + DBG(FUNC, FMT("(FXO) signaling %d unknown") % Globals::k3lapi.channel_config(_device_id, obj).Signaling); + break; + } + + _channels.push_back(pvt); + + pvt->cleanup(); + + } + } + + /* + virtual bool eventHandler(const int obj, K3L_EVENT *e) + { + DBG(STRM, D("(FXO Board) c")); + + bool ret = true; + + switch(e->Code) + { + case : + break; + default: + ret = Board::eventHandler(obj, e); + break; + } + + DBG(STRM, D("(FXO Board) r")); + + return ret; + } + */ + +}; +/******************************************************************************/ +/******************************************************************************/ +/******************************************************************************/ +#endif /* _KHOMP_PVT_FXO_H_*/ + diff --git a/src/mod/endpoints/mod_khomp/include/khomp_pvt_gsm.h b/src/mod/endpoints/mod_khomp/include/khomp_pvt_gsm.h new file mode 100644 index 0000000..31ca1a0 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/include/khomp_pvt_gsm.h @@ -0,0 +1,332 @@ +/******************************************************************************* + + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2010 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the LGPL + License. If you do not delete the provisions above, a recipient may use your + version of this file under either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*******************************************************************************/ + +#ifndef _KHOMP_PVT_GSM_H_ +#define _KHOMP_PVT_GSM_H_ + +#include "khomp_pvt.h" +#include "applications.h" + +/******************************************************************************/ +/********************************* GSM Board **********************************/ +/******************************************************************************/ +struct BoardGSM: public Board +{ +/******************************************************************************/ +/******************************** GSM Channel *********************************/ +struct KhompPvtGSM: public KhompPvt +{ +/********************************** GSM Call **********************************/ + struct CallGSM : public Call + { + CallGSM() {} + + bool process(std::string name, std::string value = "") + { + if (name == "answer_info") + { + _call_info_report = true; + } + else if (name == "drop_on") + { + _call_info_report = true; + + Strings::vector_type drop_item; + Strings::tokenize (value, drop_item, ".+"); + + for (Strings::vector_type::iterator i = drop_item.begin(); i != drop_item.end(); i++) + { + + if ((*i) == "message_box") _call_info_drop |= CI_MESSAGE_BOX; + else if ((*i) == "human_answer") _call_info_drop |= CI_HUMAN_ANSWER; + else if ((*i) == "answering_machine") _call_info_drop |= CI_ANSWERING_MACHINE; + else if ((*i) == "carrier_message") _call_info_drop |= CI_CARRIER_MESSAGE; + else if ((*i) == "unknown") _call_info_drop |= CI_UNKNOWN; + else + { + LOG(ERROR, FMT("unknown paramenter to 'calldrop' Dial option: '%s'.") % (*i)); + continue; + } + + DBG(FUNC, FMT("droping call on '%s'.") % (*i)); + } + } + else + { + return Call::process(name, value); + } + + return true; + } + + bool clear() + { + _call_info_report = false; + _call_info_drop = 0; + + return Call::clear(); + } + + /* report what we got? */ + bool _call_info_report; + + /* what call info flags should make us drop the call? */ + long int _call_info_drop; + }; + +/******************************************************************************/ + KhompPvtGSM(K3LAPI::target & target) : KhompPvt(target) + { + _sms = new SMS(this); + command(KHOMP_LOG, CM_ENABLE_CALL_ANSWER_INFO); + } + + ~KhompPvtGSM() + { + delete _sms; + } + + CallGSM * callGSM() + { + return (CallGSM *)call(); + } + + int makeCall(std::string params = ""); + bool doChannelAnswer(CommandRequest &); + bool doChannelHangup(CommandRequest &); + + //bool onNewCall(K3L_EVENT *e); + bool onChannelRelease(K3L_EVENT *e); + bool onCallFail(K3L_EVENT *e); + bool onCallSuccess(K3L_EVENT *e); + bool onCallAnswerInfo(K3L_EVENT *e); + bool onDisconnect(K3L_EVENT *e); + //bool onDtmfDetected(K3L_EVENT *e); + + virtual bool eventHandler(K3L_EVENT *e) + { + DBG(STRM, D("(GSM) c")); + + bool ret = true; + + switch(e->Code) + { + /* + case EV_NEW_CALL: + onNewCall(e); + break; + */ + case EV_CHANNEL_FREE: + case EV_CHANNEL_FAIL: + ret = onChannelRelease(e); + break; + case EV_CALL_SUCCESS: + ret = onCallSuccess(e); + break; + case EV_DISCONNECT: + ret = onDisconnect(e); + break; + case EV_CALL_FAIL: + ret = onCallFail(e); + break; + case EV_CALL_ANSWER_INFO: + ret = onCallAnswerInfo(e); + break; + case EV_RECV_FROM_MODEM: + break; + case EV_NEW_SMS: + ret = _sms->onNewSMS(e); + break; + case EV_SMS_INFO: + ret = _sms->onSMSInfo(e); + break; + case EV_SMS_DATA: + ret = _sms->onSMSData(e); + break; + case EV_SMS_SEND_RESULT: + ret = _sms->onSMSSendResult(e); + break; + default: + ret = KhompPvt::eventHandler(e); + break; + } + + DBG(STRM, D("(GSM) r")); + + return ret; + } + + bool application(ApplicationType type, switch_core_session_t * session, const char *data); + + bool setupConnection(); + void setAnswerInfo(int answer_info); + bool indicateBusyUnlocked(int cause, bool sent_signaling = false); + void reportFailToReceive(int fail_code); + int causeFromCallFail(int fail); + int callFailFromCause(int cause); + bool isOK(void); + + bool isPhysicalFree() + { + K3L_CHANNEL_STATUS status; + + if (k3lGetDeviceStatus (_target.device, _target.object + ksoChannel, &status, sizeof (status)) != ksSuccess) + return false; + + bool physically_free = (status.AddInfo == kgsmIdle); + + if(status.CallStatus != kcsFree || !physically_free) + { + DBG(FUNC, PVT_FMT(_target, "call status not free, or not physically free!")); + return false; + } + + return true; + } + + bool sendPreAudio(int rb_value = RingbackDefs::RB_SEND_NOTHING) + { + return false; + } + + bool selectSimCard(const char * sim_card) + { + return command(KHOMP_LOG, CM_SIM_CARD_SELECT, sim_card); + } + + std::string getStatistics(Statistics::Type type) + { + switch(type) + { + case Statistics::DETAILED: + { + /* buffer our data to return at the end */ + std::string strBuffer; + + strBuffer.append(_pvt_statistics->getDetailed()); + strBuffer.append(_sms->statistics()->getDetailed()); + return strBuffer; + } + case Statistics::ROW: + { + return _pvt_statistics->getRow(); + } + default: + return ""; + } + } + + void clearStatistics() + { + KhompPvt::clearStatistics(); + _sms->statistics()->clear(); + } + + bool validContexts(Board::KhompPvt::ContextListType & contexts, std::string extra_context = ""); + + SMS * _sms; + +}; +/******************************************************************************/ +/******************************************************************************/ + BoardGSM(int id) : Board(id) {} + + void initializeChannels(void) + { + LOG(MESSAGE, "(GSM) loading channels ..."); + + for (unsigned obj = 0; obj < Globals::k3lapi.channel_count(_device_id); obj++) + { + K3LAPI::target tgt(Globals::k3lapi, K3LAPI::target::CHANNEL, _device_id, obj); + KhompPvt * pvt; + + switch(Globals::k3lapi.channel_config(_device_id, obj).Signaling) + { + case ksigGSM: + pvt = new BoardGSM::KhompPvtGSM(tgt); + pvt->_call = new BoardGSM::KhompPvtGSM::CallGSM(); + ((BoardGSM::KhompPvtGSM *)pvt)->_sms->start(); + DBG(FUNC, "(GSM) GSM channel"); + break; + default: + pvt = new Board::KhompPvt(tgt); + pvt->_call = new Board::KhompPvt::Call(); + DBG(FUNC, FMT("(GSM) signaling %d unknown") % Globals::k3lapi.channel_config(_device_id, obj).Signaling); + break; + } + + _channels.push_back(pvt); + + pvt->cleanup(); + + } + } + +/* + virtual bool eventHandler(const int obj, K3L_EVENT *e) + { + DBG(STRM, D("(GSM Board) c")); + + bool ret = true; + + switch(e->Code) + { + case : + break; + default: + ret = Board::eventHandler(obj, e); + break; + } + + DBG(STRM, D("(GSM Board) r")); + + return ret; + } +*/ + +}; +/******************************************************************************/ +/******************************************************************************/ +/******************************************************************************/ +#endif /* _KHOMP_PVT_GSM_H_*/ + diff --git a/src/mod/endpoints/mod_khomp/include/khomp_pvt_kxe1.h b/src/mod/endpoints/mod_khomp/include/khomp_pvt_kxe1.h new file mode 100644 index 0000000..c87dd23 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/include/khomp_pvt_kxe1.h @@ -0,0 +1,1122 @@ +/******************************************************************************* + + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2010 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the LGPL + License. If you do not delete the provisions above, a recipient may use your + version of this file under either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*******************************************************************************/ + +#ifndef _KHOMP_PVT_E1_H_ +#define _KHOMP_PVT_E1_H_ + +#include "khomp_pvt.h" + +#include "applications.h" + +/******************************************************************************/ +/********************************** E1 Board **********************************/ +/******************************************************************************/ +struct BoardE1: public Board +{ +/******************************************************************************/ +/********************************* E1 Channel *********************************/ +struct KhompPvtE1: public KhompPvt +{ +/*********************************** E1 Call **********************************/ + struct CallE1 : public Call + { + CallE1() {} + + bool process(std::string name, std::string value = "") + { + if (name == "answer_info") + { + _call_info_report = true; + } + else if (name == "drop_on") + { + _call_info_report = true; + + Strings::vector_type drop_item; + Strings::tokenize (value, drop_item, ".+"); + + for (Strings::vector_type::iterator i = drop_item.begin(); i != drop_item.end(); i++) + { + + if ((*i) == "message_box") _call_info_drop |= CI_MESSAGE_BOX; + else if ((*i) == "human_answer") _call_info_drop |= CI_HUMAN_ANSWER; + else if ((*i) == "answering_machine") _call_info_drop |= CI_ANSWERING_MACHINE; + else if ((*i) == "carrier_message") _call_info_drop |= CI_CARRIER_MESSAGE; + else if ((*i) == "unknown") _call_info_drop |= CI_UNKNOWN; + else + { + LOG(ERROR, FMT("unknown paramenter to 'calldrop' Dial option: '%s'.") % (*i)); + continue; + } + + DBG(FUNC, FMT("droping call on '%s'.") % (*i)); + } + } + else + { + return Call::process(name, value); + } + + return true; + } + + bool clear() + { + _call_info_report = false; + _call_info_drop = 0; + + _var_fax_adjust = T_UNKNOWN; + + return Call::clear(); + } + + /* report what we got? */ + bool _call_info_report; + + /* what call info flags should make us drop the call? */ + long int _call_info_drop; + + TriState _var_fax_adjust; + + ChanTimer::Index _idx_disconnect; + + }; +/******************************************************************************/ + KhompPvtE1(K3LAPI::target & target) : KhompPvt(target) + { + _fax = new Fax(this); + command(KHOMP_LOG,CM_ENABLE_CALL_ANSWER_INFO); + } + + ~KhompPvtE1() + { + delete _fax; + } + + CallE1 * callE1() + { + return (CallE1 *)call(); + } + + int makeCall(std::string params = ""); + + bool onChannelRelease(K3L_EVENT *e); + bool onCallSuccess(K3L_EVENT *e); + bool onAudioStatus(K3L_EVENT *e); + bool onCallAnswerInfo(K3L_EVENT *e); + bool onDisconnect(K3L_EVENT *e); + + virtual bool eventHandler(K3L_EVENT *e) + { + DBG(STRM, D("(E1) c")); + + bool ret = true; + + switch(e->Code) + { + case EV_CHANNEL_FREE: + case EV_CHANNEL_FAIL: + ret = onChannelRelease(e); + break; + case EV_CALL_ANSWER_INFO: + ret = onCallAnswerInfo(e); + break; + case EV_DISCONNECT: + ret = onDisconnect(e); + break; + case EV_AUDIO_STATUS: + ret = onAudioStatus(e); + break; + case EV_FAX_CHANNEL_FREE: + ret = _fax->onFaxChannelRelease(e); + break; + case EV_FAX_FILE_SENT: + case EV_FAX_FILE_FAIL: + case EV_FAX_TX_TIMEOUT: + case EV_FAX_PAGE_CONFIRMATION: + case EV_FAX_REMOTE_INFO: + break; + default: + ret = KhompPvt::eventHandler(e); + break; + } + + DBG(STRM, D("(E1) r")); + + return ret; + } + + bool application(ApplicationType type, switch_core_session_t * session, const char *data); + + bool setupConnection(); + bool indicateBusyUnlocked(int cause, bool sent_signaling = false); + void setAnswerInfo(int answer_info); + bool validContexts(Board::KhompPvt::ContextListType & contexts, std::string extra_context = ""); + bool isOK(void); + + bool isPhysicalFree() + { + K3L_CHANNEL_STATUS status; + + if (k3lGetDeviceStatus (_target.device, _target.object + ksoChannel, &status, sizeof (status)) != ksSuccess) + return false; + + bool physically_free = (status.AddInfo == kecsFree); + + if(status.CallStatus != kcsFree || !physically_free) + { + DBG(FUNC, PVT_FMT(_target, "call status not free, or not physically free!")); + return false; + } + + return true; + } + + virtual bool cleanup(CleanupType type = CLN_HARD) + { + try + { + Board::board(_target.device)->_timers.del(callE1()->_idx_disconnect); + } + catch (K3LAPI::invalid_device & err) + { + LOG(ERROR, PVT_FMT(target(), "Unable to get device: %d!") % err.device); + } + + callE1()->_idx_disconnect.reset(); + + switch (type) + { + case CLN_HARD: + case CLN_FAIL: + call()->_flags.clear(Kflags::FAX_DETECTED); + break; + case CLN_SOFT: + break; + } + + return KhompPvt::cleanup(type); + } + + virtual void getSpecialVariables() + { + try + { + const char * str_fax = getFSChannelVar("KAdjustForFax"); + + callE1()->_var_fax_adjust = (str_fax ? (!SAFE_strcasecmp(str_fax, "true") ? T_TRUE : T_FALSE) : T_UNKNOWN); + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR, PVT_FMT(_target, "(E1) %s") % err._msg.c_str()); + } + + KhompPvt::getSpecialVariables(); + } + + /* used by app FAX */ + Fax * _fax; + + static void delayedDisconnect(Board::KhompPvt * pvt); +}; +/******************************************************************************/ +/********************************** ISDN Channel ******************************/ +struct KhompPvtISDN: public KhompPvtE1 +{ +/********************************** ISDN Call *********************************/ + struct CallISDN : public CallE1 + { + + CallISDN() {} + + bool process(std::string name, std::string value = "") + { + if (name == "uui") + { + Strings::vector_type values; + Strings::tokenize(value, values, "#", 2); + + try + { + std::string uui_proto_s = values[0]; + std::string uui_data_s = values[1]; + + _uui_descriptor = Strings::toulong(uui_proto_s); + _uui_information.append(uui_data_s); + + DBG(FUNC, FMT("uui adjusted (%s, '%s')!") % uui_proto_s.c_str() % uui_data_s.c_str()); + } + catch (...) + { + LOG(ERROR, FMT("invalid uui protocol descriptor: '%s' is not a number.") % value.c_str()); + } + } + else if (name == "usr_xfer") + { + _user_xfer_digits = value; + } + else + { + return CallE1::process(name, value); + } + + return true; + } + + bool clear() + { + _uui_descriptor = -1; + _uui_information.clear(); + _isdn_cause = -1; + + _user_xfer_digits = Opt::_user_xfer; + _user_xfer_buffer.clear(); + _digits_buffer.clear(); + _qsig_number.clear(); + + return CallE1::clear(); + } + + /* used for isdn EV_USER_INFORMATION */ + long int _uui_descriptor; + std::string _uui_information; + long int _isdn_cause; + + /* what should we dial to trigger an user-signaled transfer? */ + /* used for xfer on user signaling */ + std::string _user_xfer_digits; + std::string _user_xfer_buffer; + std::string _digits_buffer; + std::string _qsig_number; + + }; +/******************************************************************************/ + KhompPvtISDN(K3LAPI::target & target) : KhompPvtE1(target) + { + _transfer = new Transfer<CallISDN, false>(this); + } + + ~KhompPvtISDN() + { + delete _transfer; + } + + CallISDN * callISDN() + { + return (CallISDN *)call(); + } + + int makeCall(std::string params = ""); + bool doChannelAnswer(CommandRequest &); + + bool onSyncUserInformation(K3L_EVENT *e); + bool onIsdnProgressIndicator(K3L_EVENT *e); + bool onNewCall(K3L_EVENT *e); + bool onCallSuccess(K3L_EVENT *e); + bool onCallFail(K3L_EVENT *e); + + virtual bool eventHandler(K3L_EVENT *e) + { + DBG(STRM, D("(ISDN) c")); + + bool ret = true; + + switch(e->Code) + { + case EV_USER_INFORMATION: + ret = onSyncUserInformation(e); + break; + case EV_ISDN_PROGRESS_INDICATOR: + ret = onIsdnProgressIndicator(e); + break; + case EV_NEW_CALL: + ret = onNewCall(e); + break; + case EV_CALL_SUCCESS: + ret = onCallSuccess(e); + break; + case EV_CALL_FAIL: + ret = onCallFail(e); + break; + case EV_SS_TRANSFER_FAIL: + break; + default: + ret = KhompPvtE1::eventHandler(e); + break; + } + + DBG(STRM, D("(ISDN) r")); + + return ret; + } + + bool application(ApplicationType type, switch_core_session_t * session, const char *data); + + int causeFromCallFail(int fail); + int callFailFromCause(int cause); + void reportFailToReceive(int fail_code); + RingbackDefs::RingbackStType sendRingBackStatus(int rb_value = RingbackDefs::RB_SEND_DEFAULT); + bool sendPreAudio(int rb_value = RingbackDefs::RB_SEND_NOTHING); + bool sendDtmf(std::string digit); + + virtual bool cleanup(CleanupType type = CLN_HARD) + { + _transfer->clear(); + + /* + switch (type) + { + case CLN_HARD: + case CLN_FAIL: + break; + case CLN_SOFT: + break; + } + */ + + return KhompPvtE1::cleanup(type); + } + + virtual void setSpecialVariables() + { + try + { + /* rdsi user info */ + if (callISDN()->_uui_descriptor != -1) + { + DBG(FUNC,"Setting ISDN descriptor"); + + std::string descriptor = STG(FMT("%d") % callISDN()->_uui_descriptor); + + setFSChannelVar("KUserInfoDescriptor", descriptor.c_str()); + setFSChannelVar("KUserInfoData", callISDN()->_uui_information.c_str()); + + callISDN()->_uui_descriptor = -1; + callISDN()->_uui_information.clear(); + } + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR, PVT_FMT(_target, "(ISDN) %s") % err._msg.c_str()); + } + + KhompPvtE1::setSpecialVariables(); + } + + Transfer<CallISDN, false> * _transfer; + +}; +/******************************************************************************/ +/********************************* R2 Channel *********************************/ +struct KhompPvtR2: public KhompPvtE1 +{ +/********************************* R2 Call ************************************/ + struct CallR2 : public CallE1 + { + + CallR2() {} + + + bool process(std::string name, std::string value = "") + { + if (name == "category") + { + try + { + unsigned long int category = Strings::toulong (value); + DBG(FUNC, FMT("r2 category adjusted (%s)!") % value.c_str()); + _r2_category = category; + } + catch (...) + { + LOG(ERROR, FMT("invalid r2 category: '%s' is not a number.") % value.c_str()); + } + + } + else + { + return CallE1::process(name, value); + } + return true; + } + + bool clear() + { + _r2_category = -1; + _r2_condition = -1; + + return CallE1::clear(); + } + + long int _r2_category; + long int _r2_condition; + + ChanTimer::Index _idx_number_dial; + std::string _incoming_exten; + }; +/******************************************************************************/ + KhompPvtR2(K3LAPI::target & target) : KhompPvtE1(target) + { + K3L_E1600A_FW_CONFIG dspAcfg; + + if (k3lGetDeviceConfig(_target.device, ksoFirmware + kfiE1600A, &dspAcfg, sizeof(dspAcfg)) != ksSuccess) + { + DBG(FUNC, PVT_FMT(target, "unable to get signaling locality for board: assuming brazilian signaling")); + + _r2_country = Verbose::R2_COUNTRY_BRA; + + return; + } + Regex::Expression e(".+\\((Arg|Bra|Chi|Mex|Ury|Ven)\\).+", Regex::E_EXTENDED); + std::string fwname(dspAcfg.FwVersion); + + Regex::Match what(fwname, e); + + if (!what.matched() || !what.matched(1)) + { + DBG(FUNC, PVT_FMT(target, "invalid firmware string, unable to find country code: assuming brazilian signaling.\n")); + + _r2_country = Verbose::R2_COUNTRY_BRA; + return; + } + + std::string country = what.submatch(1); + + /**/ if (country == "Arg") + _r2_country = Verbose::R2_COUNTRY_ARG; + else if (country == "Bra") + _r2_country = Verbose::R2_COUNTRY_BRA; + else if (country == "Chi") + _r2_country = Verbose::R2_COUNTRY_CHI; + else if (country == "Mex") + _r2_country = Verbose::R2_COUNTRY_MEX; + else if (country == "Ury") + _r2_country = Verbose::R2_COUNTRY_URY; + else if (country == "Ven") + _r2_country = Verbose::R2_COUNTRY_VEN; + else + { + DBG(FUNC, PVT_FMT(target, "invalid firmware string (%s), assuming brazilian signaling.") % country.c_str()); + + _r2_country = Verbose::R2_COUNTRY_BRA; + return; + } + + DBG(FUNC, PVT_FMT(target, "adjusting country signaling to code '%s'...") + % country.c_str()); + + } + + ~KhompPvtR2() {} + + CallR2 * callR2() + { + return (CallR2 *)call(); + } + + int makeCall(std::string params = ""); + bool doChannelAnswer(CommandRequest &); + bool doChannelHangup(CommandRequest &); + + bool onNewCall(K3L_EVENT *e); + bool onCallSuccess(K3L_EVENT *e); + bool onCallFail(K3L_EVENT *e); + bool onNumberDetected(K3L_EVENT *e); + + virtual bool eventHandler(K3L_EVENT *e) + { + DBG(STRM, D("(R2) c")); + + bool ret = true; + + switch(e->Code) + { + case EV_NEW_CALL: + ret = onNewCall(e); + break; + case EV_CALL_SUCCESS: + ret = onCallSuccess(e); + break; + case EV_CALL_FAIL: + ret = onCallFail(e); + break; + case EV_DIALED_DIGIT: + ret = onNumberDetected(e); + break; + default: + ret = KhompPvtE1::eventHandler(e); + break; + } + + DBG(STRM, D("(R2) r")); + + return ret; + + } + + int causeFromCallFail(int fail); + int callFailFromCause(int cause); + void reportFailToReceive(int fail_code); + RingbackDefs::RingbackStType sendRingBackStatus(int rb_value = RingbackDefs::RB_SEND_DEFAULT); + bool sendPreAudio(int rb_value = RingbackDefs::RB_SEND_NOTHING); + bool indicateRinging(); + + virtual void setSpecialVariables() + { + try + { + /* r2 caller category */ + if (callR2()->_r2_category != -1) + { + setFSChannelVar("KR2GotCategory",Verbose::signGroupII((KSignGroupII)callR2()->_r2_category).c_str()); + } + + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR, PVT_FMT(_target, "(R2) %s") % err._msg.c_str()); + } + + KhompPvtE1::setSpecialVariables(); + } + + virtual bool cleanup(CleanupType type = CLN_HARD) + { + call()->_flags.clear(Kflags::NEEDS_RINGBACK_CMD); + call()->_flags.clear(Kflags::NUMBER_DIAL_ONGOING); + call()->_flags.clear(Kflags::NUMBER_DIAL_FINISHD); + + switch (type) + { + case CLN_HARD: + case CLN_FAIL: + break; + case CLN_SOFT: + break; + } + + return KhompPvtE1::cleanup(type); + } + + static void numberDialTimer(Board::KhompPvt * pvt); + +public: + Verbose::R2CountryType _r2_country; + +}; +/******************************************************************************/ +/********************************* FLASH Channel ******************************/ +/* ksigLineSide ksigCAS_EL7 ksigE1LC */ +struct KhompPvtFlash: public KhompPvtR2 +{ +/********************************* R2 Call ************************************/ + struct CallFlash : public CallR2 + { + + CallFlash() {} + + bool process(std::string name, std::string value = "") + { + if (name == "usr_xfer") + { + _user_xfer_digits = value; + } + else + { + return CallR2::process(name, value); + } + + return true; + } + + bool clear() + { + _user_xfer_digits = Opt::_user_xfer; + _user_xfer_buffer.clear(); + _digits_buffer.clear(); + + return CallR2::clear(); + } + + /* used for xfer on user signaling */ + std::string _user_xfer_digits; + std::string _user_xfer_buffer; + std::string _digits_buffer; + + }; +/******************************************************************************/ + KhompPvtFlash(K3LAPI::target & target) : KhompPvtR2(target) + { + _transfer = new Transfer<CallFlash>(this); + } + + ~KhompPvtFlash() + { + delete _transfer; + } + + CallFlash * callFlash() + { + return (CallFlash *)call(); + } + + bool application(ApplicationType type, switch_core_session_t * session, const char *data); + + bool sendDtmf(std::string digit); + + virtual bool cleanup(CleanupType type = CLN_HARD) + { + _transfer->clear(); + + /* + switch (type) + { + case CLN_HARD: + case CLN_FAIL: + break; + case CLN_SOFT: + break; + } + */ + + return KhompPvtR2::cleanup(type); + } + + Transfer<CallFlash> * _transfer; +}; +/******************************************************************************/ +/********************************* FSX Channel ********************************/ +struct KhompPvtFXS: public KhompPvt +{ +/********************************** FXS Call **********************************/ + struct CallFXS : public Call + { + CallFXS() {} + + bool process(std::string name, std::string value = "") + { + if (name == "ring") + { + Strings::vector_type ring_item; + Strings::tokenize (value, ring_item, "."); + + if (ring_item.size() != 2) + { + LOG(ERROR, FMT("invalid values on ring string: two numbers, dot separated, are needed.")); + return false; + } + + try + { + unsigned long int time_on = Strings::toulong (ring_item[0]); + unsigned long int time_off = Strings::toulong (ring_item[1]); + + _ring_on = time_on; + _ring_off = time_off; + + DBG(FUNC, D("ring values adjusted (%i,%i).") % time_on % time_off); + } + catch (...) + { + LOG(ERROR, FMT("invalid number on ring string.")); + } + } + else if (name == "ring_ext") + { + if (_ring_on == -1) // so ring was not set. + { + LOG(ERROR, FMT("ring_ext only make sense if ring values are set.")); + return false; + } + + Strings::vector_type ring_item; + Strings::tokenize (value, ring_item, "."); + + if (ring_item.size() != 2) + { + LOG(ERROR, FMT("invalid values on ring_ext string: two numbers, dot separated, are needed.")); + return false; + } + + try + { + unsigned long int time_on = Strings::toulong (ring_item[0]); + unsigned long int time_off = Strings::toulong (ring_item[1]); + + _ring_on_ext = time_on; + _ring_off_ext = time_off; + + DBG(FUNC, D("ring_ext values adjusted (%i,%i).") % time_on % time_off); + } + catch (...) + { + LOG(ERROR, FMT("invalid number on ring_ext string.")); + } + } + else if (name == "ring_cadence") + { + Opt::CadencesMapType::iterator i = Opt::_cadences.find(value); + + if (i != Opt::_cadences.end()) + { + CadenceType cadence = (*i).second; + + _ring_on = cadence.ring; + _ring_off = cadence.ring_s; + _ring_on_ext = cadence.ring_ext; + _ring_off_ext = cadence.ring_ext_s; + + DBG(FUNC, D("cadence adjusted (%i,%i,%i,%i).") + % cadence.ring + % cadence.ring_s + % cadence.ring_ext + % cadence.ring_ext_s); + } + else + { + LOG(ERROR, FMT("unable to find cadence '%s'!") % value); + } + } + else + { + return Call::process(name, value); + } + + return true; + } + + bool clear() + { + _ring_on = -1; + _ring_off = -1; + _ring_on_ext = -1; + _ring_off_ext = -1; + + _incoming_exten.clear(); + _flash_transfer.clear(); + + _uuid_other_session.clear(); + + return Call::clear(); + } + + long int _ring_on; + long int _ring_off; + long int _ring_on_ext; + long int _ring_off_ext; + + ChanTimer::Index _idx_dial; + + std::string _incoming_exten; + + ChanTimer::Index _idx_transfer; + + std::string _flash_transfer; + std::string _uuid_other_session; + + + }; +/******************************************************************************/ + KhompPvtFXS(K3LAPI::target & target) : KhompPvt(target) + { + //command(KHOMP_LOG,CM_ENABLE_CALL_ANSWER_INFO); + /* sequence numbers on FXS */ + static Opt::OrigToNseqMapType fxs_nseq = generateNseqMap(); + + load(fxs_nseq); + } + + ~KhompPvtFXS() {} + + CallFXS * callFXS() + { + return (CallFXS *)call(); + } + + int makeCall(std::string params = ""); + bool doChannelAnswer(CommandRequest &); + bool doChannelHangup(CommandRequest &); + + bool onChannelRelease(K3L_EVENT *e); + bool onSeizureStart(K3L_EVENT *); + bool onCallSuccess(K3L_EVENT *); + bool onDtmfDetected(K3L_EVENT *); + //bool onDtmfSendFinish(K3L_EVENT *); + bool onFlashDetected(K3L_EVENT *); + + virtual bool eventHandler(K3L_EVENT *e) + { + DBG(STRM, D("(FXS) c")); + + bool ret = true; + + switch(e->Code) + { + case EV_CHANNEL_FREE: + case EV_CHANNEL_FAIL: + ret = onChannelRelease(e); + break; + case EV_SEIZURE_START: + ret = onSeizureStart(e); + break; + case EV_CALL_SUCCESS: + ret = onCallSuccess(e); + break; + case EV_DTMF_DETECTED: + case EV_PULSE_DETECTED: + ret = onDtmfDetected(e); + break; + /* + case EV_DTMF_SEND_FINISH: + ret = onDtmfSendFinish(e); + break; + */ + case EV_FLASH: + ret = onFlashDetected(e); + break; + default: + ret = KhompPvt::eventHandler(e); + break; + } + + DBG(STRM, D("(FXS) r")); + + return ret; + } + + bool setupConnection(); + void load(Opt::OrigToNseqMapType & fxs_nseq); + void loadOptions(); + bool parseBranchOptions(std::string options_str); + bool alloc(); + bool indicateBusyUnlocked(int cause, bool sent_signaling = false); + void reportFailToReceive(int fail_code); + bool validContexts(Board::KhompPvt::ContextListType & contexts, std::string extra_context = ""); + bool isOK(void); + + bool startTransfer(); + bool stopTransfer(); + bool transfer(std::string & context, bool blind = false); + + bool hasNumberDial() { return false; } + + bool isPhysicalFree() + { + K3L_CHANNEL_STATUS status; + + if (k3lGetDeviceStatus (_target.device, _target.object + ksoChannel, &status, sizeof (status)) != ksSuccess) + return false; + + bool physically_free = (status.AddInfo == kfxsOnHook); + + if(status.CallStatus != kcsFree || !physically_free) + { + DBG(FUNC, PVT_FMT(_target, "call status not free, or not physically free!")); + return false; + } + + return true; + } + + virtual bool cleanup(CleanupType type = CLN_HARD) + { + callFXS()->_flags.clear(Kflags::FXS_DIAL_ONGOING); + callFXS()->_flags.clear(Kflags::FXS_DIAL_FINISHD); + callFXS()->_flags.clear(Kflags::FXS_FLASH_TRANSFER); + + switch (type) + { + case CLN_HARD: + case CLN_FAIL: + callFXS()->_flags.clear(Kflags::FXS_OFFHOOK); + break; + case CLN_SOFT: + break; + } + + return KhompPvt::cleanup(type); + } + + + /* number based on fxs-global-orig */ + std::string _fxs_fisical_addr; + /* the branch number, possibly the new calleridnum */ + std::string _fxs_orig_addr; + std::string _calleridname; + int _amaflags; + std::string _callgroup; + std::string _pickupgroup; + std::string _context; + int _input_volume; + int _output_volume; + std::string _mohclass; + std::string _language; + std::string _accountcode; + std::string _mailbox; + + static Opt::OrigToNseqMapType generateNseqMap(); + static void dialTimer(KhompPvt * pvt); + static void transferTimer(KhompPvt * pvt); + + static std::string padOrig(std::string orig_base, unsigned int padding) + { + unsigned int orig_size = orig_base.size(); + unsigned int orig_numb = 0; + + try + { + orig_numb = Strings::toulong(orig_base); + } + catch(Strings::invalid_value & e) + { + LOG(ERROR, D("invalid numeric value: %s") % e.value()); + } + + return STG(FMT(STG(FMT("%%0%dd") % orig_size)) % (orig_numb + padding)); + } + + /* + virtual void getSpecialVariables() + { + try + { + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR, PVT_FMT(_target, "(FXS) %s") % err._msg.c_str()); + } + + KhompPvt::getSpecialVariables(); + } + */ + +}; +/******************************************************************************/ +/******************************************************************************/ + BoardE1(int id) : Board(id) {} + + void initializeChannels(void) + { + LOG(MESSAGE, "(E1) loading channels ..."); + + for (unsigned obj = 0; obj < Globals::k3lapi.channel_count(_device_id); obj++) + { + K3LAPI::target tgt(Globals::k3lapi, K3LAPI::target::CHANNEL, _device_id, obj); + KhompPvt * pvt; + + switch(Globals::k3lapi.channel_config(_device_id, obj).Signaling) + { + CASE_RDSI_SIG: + pvt = new BoardE1::KhompPvtISDN(tgt); + pvt->_call = new BoardE1::KhompPvtISDN::CallISDN(); + DBG(FUNC, "(E1) ISDN channel"); + break; + CASE_R2_SIG: + pvt = new BoardE1::KhompPvtR2(tgt); + pvt->_call = new BoardE1::KhompPvtR2::CallR2(); + pvt->command(KHOMP_LOG, CM_DISCONNECT); + DBG(FUNC, "(E1) R2 channel"); + break; + CASE_FLASH_GRP: + pvt = new BoardE1::KhompPvtFlash(tgt); + pvt->_call = new BoardE1::KhompPvtFlash::CallFlash(); + pvt->command(KHOMP_LOG, CM_DISCONNECT); + DBG(FUNC, "(E1) \"Flash\" channel"); + break; + case ksigAnalogTerminal: + pvt = new BoardE1::KhompPvtFXS(tgt); + pvt->_call = new BoardE1::KhompPvtFXS::CallFXS(); + DBG(FUNC, "(E1) FXS channel"); + break; + default: + pvt = new Board::KhompPvt(tgt); + pvt->_call = new Board::KhompPvt::Call(); + DBG(FUNC, FMT("(E1) signaling %d unknown") % Globals::k3lapi.channel_config(_device_id, obj).Signaling); + break; + } + + _channels.push_back(pvt); + + pvt->cleanup(); + + } + } + + bool onLinkStatus(K3L_EVENT *e); + + virtual bool eventHandler(const int obj, K3L_EVENT *e) + { + DBG(STRM, D("(E1 Board) c")); + + int ret = true; + + switch(e->Code) + { + case EV_LINK_STATUS: + case EV_PHYSICAL_LINK_DOWN: + case EV_PHYSICAL_LINK_UP: + + if (K::Logger::Logg.classe(C_LINK_STT).enabled() || K::Logger::Logg.classe(C_EVENT).enabled()) + { + std::string msg = Globals::verbose.event (obj, e) + "."; + LOG(LINK_STT, msg); + } + + ret = onLinkStatus(e); + break; + default: + ret = Board::eventHandler(obj, e); + break; + } + + DBG(STRM, D("(E1 Board) r")); + + return ret; + } + +}; +/******************************************************************************/ +/******************************************************************************/ +/******************************************************************************/ +#endif /* _KHOMP_PVT_H_*/ + diff --git a/src/mod/endpoints/mod_khomp/include/khomp_pvt_passive.h b/src/mod/endpoints/mod_khomp/include/khomp_pvt_passive.h new file mode 100644 index 0000000..55b0659 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/include/khomp_pvt_passive.h @@ -0,0 +1,304 @@ +/******************************************************************************* + + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2010 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the LGPL + License. If you do not delete the provisions above, a recipient may use your + version of this file under either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*******************************************************************************/ + +#ifndef _KHOMP_PVT_PASSIVE_H_ +#define _KHOMP_PVT_PASSIVE_H_ + +#include "khomp_pvt.h" +#include "applications.h" + +/******************************************************************************/ +/******************************** Passive Board *******************************/ +/******************************************************************************/ +struct BoardPassive: public Board +{ +/******************************************************************************/ +/******************************** Passive Channel *****************************/ +struct KhompPvtPassive: public KhompPvt +{ +/******************************** Passive Call ********************************/ +/* + struct CallPassive : public Call + { + CallPassive() {} + + bool process(std::string name, std::string value = "") + { + } + else + { + return Call::process(name, value); + } + + return true; + } + + bool clear() + { + return Call::clear(); + } + + }; +*/ +/******************************************************************************/ + KhompPvtPassive(K3LAPI::target & target) : KhompPvt(target) + { + } + + ~KhompPvtPassive() + { + } +/* + CallPassive * callPassive() + { + return (CallPassive *)call(); + } +*/ + + virtual bool eventHandler(K3L_EVENT *e) + { + DBG(STRM, D("(Passive) c")); + + bool ret = true; + + switch(e->Code) + { + case EV_CHANNEL_FREE: + case EV_CHANNEL_FAIL: + ret = onChannelRelease(e); + break; +/* + case EV_CALL_SUCCESS: + case EV_CALL_FAIL: + case EV_PULSE_DETECTED: +*/ + case EV_DISCONNECT: + case EV_DTMF_DETECTED: + case EV_AUDIO_STATUS: + break; + default: + ret = true; + break; + } + + DBG(STRM, D("(Passive) r")); + + return ret; + } + + bool validContexts(Board::KhompPvt::ContextListType & contexts, std::string extra_context = ""); + +/* + virtual bool cleanup(CleanupType type = CLN_HARD) + { + switch (type) + { + case CLN_HARD: + case CLN_FAIL: + break; + case CLN_SOFT: + break; + } + + return KhompPvt::cleanup(type); + } +*/ + +}; +/******************************************************************************/ +/********************************** HI Channel ********************************/ +struct KhompPvtHI: public KhompPvtPassive +{ + KhompPvtHI(K3LAPI::target & target) : KhompPvtPassive(target) + { + } + + ~KhompPvtHI() + { + } + + bool onSeizureStart(K3L_EVENT *e); + + virtual bool eventHandler(K3L_EVENT *e) + { + DBG(STRM, D("(HI) c")); + + bool ret = true; + + switch(e->Code) + { + case EV_SEIZURE_START: + ret = onSeizureStart(e); + break; + case EV_RING_DETECTED: + case EV_POLARITY_REVERSAL: + break; + default: + ret = KhompPvtPassive::eventHandler(e); + break; + } + + DBG(STRM, D("(HI) r")); + + return ret; + } + +}; +/******************************************************************************/ +/********************************* KPR Channel ********************************/ +struct KhompPvtKPR: public KhompPvtPassive +{ + KhompPvtKPR(K3LAPI::target & target) : KhompPvtPassive(target) + { + } + + ~KhompPvtKPR() + { + } + + bool onNewCall(K3L_EVENT *e); +/* + bool onConnect(K3L_EVENT *e); +*/ + + virtual bool eventHandler(K3L_EVENT *e) + { + DBG(STRM, D("(KPR) c")); + + bool ret = true; + + switch(e->Code) + { + case EV_NEW_CALL: + ret = onNewCall(e); + break; + case EV_CONNECT: + break; + case EV_SEIZURE_START: + case EV_CAS_MFC_RECV: + case EV_CAS_LINE_STT_CHANGED: + case EV_LINK_STATUS: + break; + default: + ret = KhompPvtPassive::eventHandler(e); + break; + } + + DBG(STRM, D("(KPR) r")); + + return ret; + } + + bool obtainBoth(); + +}; +/******************************************************************************/ +/******************************************************************************/ + BoardPassive(int id) : Board(id) {} + + void initializeChannels(void) + { + LOG(MESSAGE, "(Passive) loading channels ..."); + + for (unsigned obj = 0; obj < Globals::k3lapi.channel_count(_device_id); obj++) + { + K3LAPI::target tgt(Globals::k3lapi, K3LAPI::target::CHANNEL, _device_id, obj); + KhompPvt * pvt; + + switch(Globals::k3lapi.channel_config(_device_id, obj).Signaling) + { + case ksigAnalog: + pvt = new BoardPassive::KhompPvtHI(tgt); + pvt->_call = new BoardPassive::KhompPvtHI::Call(); + DBG(FUNC, "(Passive) HI channel"); + break; + CASE_RDSI_SIG: + CASE_R2_SIG: + CASE_FLASH_GRP: + case ksigAnalogTerminal: + pvt = new BoardPassive::KhompPvtKPR(tgt); + pvt->_call = new BoardPassive::KhompPvtKPR::Call(); + DBG(FUNC, "(Passive) KPR channel"); + break; + default: + pvt = new Board::KhompPvt(tgt); + pvt->_call = new Board::KhompPvt::Call(); + DBG(FUNC, FMT("(Passive) signaling %d unknown") % Globals::k3lapi.channel_config(_device_id, obj).Signaling); + break; + } + + _channels.push_back(pvt); + + pvt->cleanup(); + + } + } + + /* + virtual bool eventHandler(const int obj, K3L_EVENT *e) + { + DBG(STRM, D("(Passive Board) c")); + + bool ret = true; + + switch(e->Code) + { + case : + break; + default: + ret = Board::eventHandler(obj, e); + break; + } + + DBG(STRM, D("(Passive Board) r")); + + return ret; + } + */ + +}; +/******************************************************************************/ +/******************************************************************************/ +/******************************************************************************/ +#endif /* _KHOMP_PVT_PASSIVE_H_*/ + diff --git a/src/mod/endpoints/mod_khomp/include/lock.h b/src/mod/endpoints/mod_khomp/include/lock.h new file mode 100644 index 0000000..621b724 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/include/lock.h @@ -0,0 +1,86 @@ +/******************************************************************************* + + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2010 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the LGPL + License. If you do not delete the provisions above, a recipient may use your + version of this file under either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*******************************************************************************/ + +#ifndef CHAN_LOCK_H +#define CHAN_LOCK_H + +#include <scoped_lock.hpp> +#include "khomp_pvt.h" + + +struct ScopedLockFailed +{ + typedef enum { NULL_PVT, NULL_SOFT_CHAN, FAILED, ALLOC_FAILED } FailType; + + ScopedLockFailed(FailType fail, std::string msg) + : _fail(fail), _msg(msg) {}; + + FailType _fail; + std::string _msg; +}; + + +struct ScopedPvtLock: public ScopedLockBasic +{ + typedef Board::KhompPvt KhompPvt; + + ScopedPvtLock(KhompPvt * pvt); + ~ScopedPvtLock(); + + void unlock(); + + protected: + KhompPvt * _pvt; +}; + + +struct ScopedAllocLock : public ScopedLockBasic +{ + ScopedAllocLock(); + ~ScopedAllocLock(); + + void unlock(); + +}; + +#endif /* CHAN_LOCK_H */ diff --git a/src/mod/endpoints/mod_khomp/include/logger.h b/src/mod/endpoints/mod_khomp/include/logger.h new file mode 100644 index 0000000..554a48d --- /dev/null +++ b/src/mod/endpoints/mod_khomp/include/logger.h @@ -0,0 +1,141 @@ +/******************************************************************************* + + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2010 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the LGPL + License. If you do not delete the provisions above, a recipient may use your + version of this file under either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*******************************************************************************/ + +#ifndef _Logger_H_ +#define _Logger_H_ + +#include <switch.h> +#include <string> +#include <simple_lock.hpp> +#include <logger.hpp> +#include <configurator/configfile.hpp> +#include <klog-config.hpp> +#include "defs.h" +#include "format.hpp" + +namespace K +{ + struct LogConfig + { + static bool set(Logfile &, const char *, const char *, bool); + static bool commit(Logfile &); + }; + + struct SwitchConsoleLog {}; + + struct SwitchPrinter: public Logger::DefaultPrinter + { + typedef Logger::DefaultPrinter Super; + typedef Tagged::Union < std::ostream *, Tagged::Union < int, Tagged::Union < SwitchConsoleLog > > > BaseType; + + SwitchPrinter(std::string & msg): Super(msg) {}; + + using Super::operator(); + + bool operator()(const SwitchConsoleLog & ignored) + { + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN,SWITCH_LOG_CONSOLE,"%s",_msg.c_str()); + return true; + }; + }; + + /* Log manager declaration. */ + typedef Logger::Manager <class_type, output_type, SwitchPrinter, SimpleLock> LogManager; + + /* Forward declaration */ + struct LogInternalManager; + + struct Logger + { + /* Logger instance. */ + static LogManager Logg; + + /* Util Logger instance. */ + static LogInternalManager Logg2; + + static bool start(); + static void stop(); + static bool rotate(); + static void processLogConsole(switch_stream_handle_t *s, const std::string options, bool invert, bool unique); + static void processLogDisk(switch_stream_handle_t *s, const std::string options, bool invert, bool unique); + + private: + static std::string base_path; + static std::ofstream generic_file; + }; + + /* Internal logging facility declaration */ + struct LogInternalManager + { + bool operator()(class_type classe, switch_stream_handle_t *stream, const char *args) + { + switch (classe) + { + case C_CLI: + stream->write_function(stream,"%s\n",args); + return true; + default: + return K::Logger::Logg(classe, args); + } + } + + bool operator()(class_type classe, switch_stream_handle_t *stream, Format &fmt) + { + return K::Logger::Logg2(classe,stream,(char*) STR(fmt)); + } + + bool operator()(class_type classe, switch_stream_handle_t *stream, const char *fmt, const char *args) + { + switch (classe) + { + case C_CLI: + stream->write_function(stream,fmt,args); + return true; + default: + return K::Logger::Logg(classe, FMT(fmt) % args); + } + } + }; +}; + +#endif /* _Logger_H_ */ diff --git a/src/mod/endpoints/mod_khomp/include/opt.h b/src/mod/endpoints/mod_khomp/include/opt.h new file mode 100644 index 0000000..0f93215 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/include/opt.h @@ -0,0 +1,250 @@ +/******************************************************************************* + + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2010 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the LGPL + License. If you do not delete the provisions above, a recipient may use your + version of this file under either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*******************************************************************************/ + +#ifndef _OPT_H_ +#define _OPT_H_ + +#include <string> +#include <map> +#include <vector> +#include "switch.h" +#include "utils.h" + +struct CadenceType +{ + CadenceType(void) + : ring(0), ring_s(0), ring_ext(0), ring_ext_s(0) {}; + + CadenceType(unsigned int _ring, unsigned int _ring_s) + : ring(_ring), ring_s(_ring_s), ring_ext(0), ring_ext_s(0) {}; + + CadenceType(unsigned int _ring, unsigned int _ring_s, unsigned int _ring_ext, unsigned int _ring_ext_s) + : ring(_ring), ring_s(_ring_s), ring_ext(_ring_ext), ring_ext_s(_ring_ext_s) {}; + + unsigned int ring; + unsigned int ring_s; + unsigned int ring_ext; + unsigned int ring_ext_s; +}; + +struct CSpan { + std::string _dialplan; + std::string _context; + std::string _dialstring; +}; + +struct Opt +{ + typedef std::pair < std::string, CadenceType > CadencesPairType; + typedef std::map < std::string, CadenceType > CadencesMapType; + + typedef std::map < std::string, std::string > OrigToDestMapType; + typedef std::pair < std::string, std::string > OrigToDestPairType; + typedef std::vector < std::string > DestVectorType; + + typedef std::map < unsigned int, std::string > BoardToOrigMapType; + typedef std::pair < unsigned int, std::string > BoardToOrigPairType; + + typedef std::map < std::string, unsigned int > OrigToNseqMapType; + typedef std::pair < std::string, unsigned int > OrigToNseqPairType; + + typedef std::pair < unsigned int,unsigned int > ObjectIdType; + typedef std::pair < std::string, ObjectIdType > BranchToObjectPairType; + typedef std::map < std::string, ObjectIdType > BranchToObjectMapType; + + typedef std::map < std::string, std::string > BranchToOptMapType; + typedef std::pair < std::string, std::string > BranchToOptPairType; + + typedef std::map < std::string, std::string > GroupToDestMapType; + typedef std::pair < std::string, std::string > GroupToDestPairType; + + typedef std::pair < std::string, CSpan > SpanPairType; + + typedef enum + { + GFLAG_MY_CODEC_PREFS = (1 << 0) + } + GFLAGS; + + static void initialize(void); + static void obtain(void); + static void commit(void); + static void printConfiguration(switch_stream_handle_t*); + +protected: + + static void loadConfiguration(const char *, const char **, bool show_errors = true); + static void cleanConfiguration(void); + + static switch_xml_t processSimpleXML(switch_xml_t &xml, const std::string& child_name); + static void processGroupXML(switch_xml_t &xml); + static void processCadenceXML(switch_xml_t &xml); + static void processFXSBranchesXML(switch_xml_t &xml); + static void processFXSHotlines(switch_xml_t &xml); + static void processFXSOptions(switch_xml_t &xml); + +public: + static bool _debug; + static std::string _dialplan; + static std::string _context; + static std::map < std::string, CSpan > _spans; + static GroupToDestMapType _groups; + static CadencesMapType _cadences; + + static bool _echo_canceller; + static bool _auto_gain_control; + static bool _out_of_band_dtmfs; + static bool _suppression_delay; + static bool _pulse_forwarding; + static bool _native_bridge; + static bool _recording; + static bool _has_ctbus; + static bool _fxs_bina; + static bool _fxo_send_pre_audio; + static bool _drop_collect_call; + static bool _ignore_letter_dtmfs; + static bool _optimize_audio_path; + + static bool _auto_fax_adjustment; + static unsigned int _fax_adjustment_timeout; + + static bool _r2_strict_behaviour; + static unsigned int _r2_preconnect_wait; + + static unsigned int _fxs_digit_timeout; + + static unsigned int _transferdigittimeout; + + static std::string _blindxfer; + static std::string _atxfer; + + static unsigned int _ringback_co_delay; + static unsigned int _ringback_pbx_delay; + + static unsigned int _disconnect_delay; + + static int _input_volume; + static int _output_volume; + + static DestVectorType _fxs_co_dialtone; + static OrigToDestMapType _fxs_hotline; + static std::string _fxs_global_orig_base; + + static BoardToOrigMapType _fxs_orig_base; + static BranchToObjectMapType _fxs_branch_map; + static BranchToOptMapType _branch_options; + + static std::string _global_mohclass; + static std::string _global_language; + + static std::string _record_prefix; + + static std::string _context_gsm_call; + static std::string _context2_gsm_call; + static std::string _context_gsm_sms; + static std::string _context_fxo; + static std::string _context2_fxo; + static std::string _context_fxs; + static std::string _context2_fxs; + static std::string _context_digital; + static std::string _context_pr; + static std::string _user_xfer; + + static int _amaflags; + static std::string _callgroup; + static std::string _pickupgroup; /* or intercept */ + + static std::string _accountcode; + + static unsigned int _kommuter_timeout; + static std::string _kommuter_activation; + + static unsigned int _audio_packet_size; + +protected: + + struct ProcessFXSCODialtone + { + void operator()(std::string options); + }; + + struct ProcessRecordPrefix + { + void operator()(std::string path); + }; + + struct ProcessAMAFlags + { + void operator()(std::string options); + }; + + struct ProcessCallGroup + { + void operator()(std::string options); + }; + + struct ProcessPickupGroup + { + void operator()(std::string options); + }; + + struct ProcessLogOptions + { + ProcessLogOptions(output_type output): _output(output) {}; + + void operator()(std::string options); + + protected: + output_type _output; + }; + + struct ProcessTraceOptions + { + void operator()(std::string options); + }; +}; + + + +#endif /* _OPT_H_ */ + diff --git a/src/mod/endpoints/mod_khomp/include/revision.h b/src/mod/endpoints/mod_khomp/include/revision.h new file mode 100644 index 0000000..4665cda --- /dev/null +++ b/src/mod/endpoints/mod_khomp/include/revision.h @@ -0,0 +1 @@ +#define MOD_KHOMP_VERSION "1.0 - (rev: 5796)" diff --git a/src/mod/endpoints/mod_khomp/include/spec.h b/src/mod/endpoints/mod_khomp/include/spec.h new file mode 100644 index 0000000..119607b --- /dev/null +++ b/src/mod/endpoints/mod_khomp/include/spec.h @@ -0,0 +1,98 @@ +/******************************************************************************* + + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2010 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the LGPL + License. If you do not delete the provisions above, a recipient may use your + version of this file under either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*******************************************************************************/ + +#ifndef _SPEC_HPP_ +#define _SPEC_HPP_ + +#include <function.hpp> +#include "khomp_pvt.h" + +typedef enum +{ + SPR_CONTINUE, + SPR_SUCCESS, + SPR_FAIL, +} +SpecRetType; + +typedef enum +{ + SPF_FIRST = 0x01, + SPF_CYCLIC = 0x02, +} +SpecFlagType; + +typedef unsigned int SpecFlagsType; + + +typedef Function::Function3 < bool, unsigned int, unsigned int, SpecFlagsType & > SpecFunType; + + +//SpecRetType processSpecAtom(std::string &, SpecFlagsType &, SpecFunType &); +//SpecRetType processSpecAtoms(std::string &, SpecFlagsType &, SpecFunType &); +//bool processCallChannelString(std::string &, Board::KhompPvt *&, int *, bool need_free = true); + +/* Request a Board::KhompPvt based on dialplan string. + +-- Format of dialplan string. -- + +Dial(Khomp/B2C58/4832625644) + | | | | + | | | | + | | | | + | | | +- Destination number. + | | | + | | +- Identifier for board 2, channel 58. + | | + | +- Khomp channel identifier. + | + +- Dial Application. +*/ + +Board::KhompPvt * processDialString(const char *, int *); +void processGroupString(); + +Board::KhompPvt * processSMSString(const char *, int *); + +#endif /* _SPEC_HPP_ */ + diff --git a/src/mod/endpoints/mod_khomp/include/utils.h b/src/mod/endpoints/mod_khomp/include/utils.h new file mode 100644 index 0000000..34e9b26 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/include/utils.h @@ -0,0 +1,772 @@ +/******************************************************************************* + + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2010 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the LGPL + License. If you do not delete the provisions above, a recipient may use your + version of this file under either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*******************************************************************************/ + +#ifndef _UTILS_H_ +#define _UTILS_H_ + +#include <bitset> +#include <refcounter.hpp> +#include <ringbuffer.hpp> +#include <simple_lock.hpp> +#include <saved_condition.hpp> +#include <thread.hpp> +#include "globals.h" +#include "logger.h" +#include "defs.h" + +/******************************************************************************/ +/************************** Defining applications *****************************/ + +typedef enum +{ + FAX_ADJUST, + FAX_SEND, + FAX_RECEIVE, + USER_TRANSFER, + SMS_CHECK, + SMS_SEND, + SELECT_SIM_CARD, +} +ApplicationType; + +/******************************************************************************/ +/***************** Abstraction for defining channel flags *********************/ + +struct Kflags +{ + typedef enum + { + CONNECTED = 0, + REALLY_CONNECTED, + + IS_OUTGOING, + IS_INCOMING, + + STREAM_UP, + LISTEN_UP, + + GEN_CO_RING, + GEN_PBX_RING, + + HAS_PRE_AUDIO, + HAS_CALL_FAIL, + + DROP_COLLECT, + + NEEDS_RINGBACK_CMD, //R2 + EARLY_RINGBACK, //FXO + + FAX_DETECTED, //Digital, FXO + FAX_SENDING, //Digital, FXO + FAX_RECEIVING, //Digital, FXO + + OUT_OF_BAND_DTMFS, + + KEEP_DTMF_SUPPRESSION, + KEEP_ECHO_CANCELLATION, + KEEP_AUTO_GAIN_CONTROL, + + WAIT_SEND_DTMF, + + CALL_WAIT_SEIZE, //FXO + + NUMBER_DIAL_FINISHD, //R2 + NUMBER_DIAL_ONGOING, //R2 + + FXS_OFFHOOK, //FXS + FXS_DIAL_FINISHD, //FXS + FXS_DIAL_ONGOING, //FXS + FXS_FLASH_TRANSFER, //FXS + + XFER_QSIG_DIALING, //ISDN + XFER_DIALING, //ISDN, FXO + + SMS_DOING_UPLOAD, //GSM + + /* + NOW LOADING ... + + BRIDGED, + */ + + /* Do not remove this last FLAG */ + INVALID_FLAG + } + FlagType; + + struct Flag + { + const char *_name; + bool _value; + }; + + Kflags() { init(); }; + + void init(); + + inline const char * name(FlagType bit) { return _flags[bit]._name; } + + inline bool check(FlagType bit) + { +#ifdef DEBUG_FLAGS + DBG(FUNC, D("Flag %s=%s") % name(bit) % + (_flags[bit]._value ? "TRUE" : "FALSE")); +#endif + return _flags[bit]._value; + } + + inline void set(FlagType bit) + { +#ifdef DEBUG_FLAGS + DBG(FUNC, D("Flag %s") % name(bit)); +#endif + _flags[bit]._value = true; + } + + inline void clear(FlagType bit) + { +#ifdef DEBUG_FLAGS + DBG(FUNC, D("Flag %s") % name(bit)); +#endif + _flags[bit]._value = false; + } + + inline void clearAll() + { + unsigned int index = 0; + for(; (FlagType)index < INVALID_FLAG; index++) + { + if(_flags[index]._value) + { + DBG(FUNC, D("Flag %s was not clean!") % name((FlagType)index)); + clear((FlagType)index); + } + } + } + + protected: + Flag _flags[INVALID_FLAG+1]; +}; + +/******************************************************************************/ +/************************* Commands and Events Handler ************************/ +struct CommandRequest +{ + typedef enum + { + NONE = 0, + COMMAND, + ACTION + } + ReqType; + + typedef enum + { + CNONE = 0, + + /* Commands */ + CMD_CALL, + CMD_ANSWER, + CMD_HANGUP, + + /* Actions */ + FLUSH_REC_STREAM, + FLUSH_REC_BRIDGE, + START_RECORD, + STOP_RECORD + + } + CodeType; + + typedef enum + { + RFA_CLOSE, + RFA_KEEP_OPEN, + RFA_REMOVE + } + RecFlagType; + + /* "empty" constructor */ + CommandRequest() : + _type(NONE), + _code(CNONE), + _obj(-1) + {} + + CommandRequest(ReqType type, CodeType code, int obj) : + _type(type), + _code(code), + _obj(obj) + {} + + CommandRequest(const CommandRequest & cmd) : + _type(cmd._type), + _code(cmd._code), + _obj(cmd._obj) + {} + + ~CommandRequest() {} + + void operator=(const CommandRequest & cmd) + { + _type = cmd._type; + _code = cmd._code; + _obj = cmd._obj; + } + + void mirror(const CommandRequest & cmd_request) + { + _type = cmd_request._type; + _code = cmd_request._code; + _obj = cmd_request._obj; + } + + short type() { return _type; } + + short code() { return _code; } + + int obj() { return _obj; } + +private: + short _type; + short _code; + int _obj; +}; + +struct EventRequest +{ + /* "empty" constructor */ + EventRequest(bool can_delete = true) : + _delete(can_delete), + _obj(-1) + { + if(can_delete) + _event = new K3L_EVENT(); + } + + /* Temporary constructor */ + EventRequest(int obj, K3L_EVENT * ev) : + _delete(false), + _obj(obj), + _event(ev) + {} + + //EventRequest(const EventRequest & ev) : _obj(ev._obj) {} + + ~EventRequest() + { + + if(!_delete || !_event) + return; + + if(_event->ParamSize) + free(_event->Params); + + delete _event; + } + + void operator=(const EventRequest & ev) + { + _delete = false; + _obj = ev._obj; + _event = ev._event; + + } + + void mirror(const EventRequest & ev_request) + { + //Checar o _event + + if(_event->ParamSize) + { + free(_event->Params); + } + + _event->Params = NULL; + + _obj = ev_request._obj; + + K3L_EVENT * ev = ev_request._event; + + if(!ev) + { + clearEvent(); + return; + } + + _event->Code = ev->Code; // API code + _event->AddInfo = ev->AddInfo; // Parameter 1 + _event->DeviceId = ev->DeviceId; // Hardware information + _event->ObjectInfo = ev->ObjectInfo; // Additional object information + _event->ParamSize = ev->ParamSize; // Size of parameter buffer + _event->ObjectId = ev->ObjectId; // KEventObjectId: Event thrower object id + + if(ev->ParamSize) + { + // Pointer to the parameter buffer + _event->Params = malloc(ev->ParamSize+1); + memcpy(_event->Params, ev->Params, ev->ParamSize); + ((char *)(_event->Params))[ev->ParamSize] = 0; + } + } + + bool clearEvent() + { + _event->Code = -1; + _event->AddInfo = -1; + _event->DeviceId = -1; + _event->ObjectInfo = -1; + _event->ParamSize = 0; + _event->ObjectId = -1; + } + + int obj() { return _obj; } + + K3L_EVENT * event() { return _event; } + + +private: + bool _delete; + int _obj; + K3L_EVENT * _event; +}; + +template < typename R, int S > +struct GenericFifo +{ + typedef R RequestType; + typedef SimpleNonBlockLock<25,100> LockType; + + GenericFifo(int device) : + _device(device), + _shutdown(false), + _buffer(S), + _mutex(Globals::module_pool), + _cond(Globals::module_pool) + {}; + + int _device; + bool _shutdown; + Ringbuffer < RequestType > _buffer; + LockType _mutex; /* to sync write acess to event list */ + SavedCondition _cond; + Thread *_thread; + +}; + +typedef GenericFifo < CommandRequest, 250 > CommandFifo; +typedef GenericFifo < EventRequest, 500 > EventFifo; + +/* Used inside KhompPvt to represent an command handler */ +struct ChanCommandHandler: NEW_REFCOUNTER(ChanCommandHandler) +{ + typedef int (HandlerType)(void *); + + ChanCommandHandler(int device, HandlerType * handler) + { + _fifo = new CommandFifo(device); + /* device event handler */ + _fifo->_thread = new Thread(handler, (void *)this, Globals::module_pool); + if(_fifo->_thread->start()) + { + DBG(FUNC,"Device command handler started"); + } + else + { + LOG(ERROR, "Device command handler error"); + } + } + + ChanCommandHandler(const ChanCommandHandler & cmd) + : INC_REFCOUNTER(cmd, ChanCommandHandler), + _fifo(cmd._fifo) + {}; + + void unreference(); + + CommandFifo * fifo() + { + return _fifo; + } + + void signal() + { + _fifo->_cond.signal(); + }; + + bool writeNoSignal(const CommandRequest &); + bool write(const CommandRequest &); + +protected: + CommandFifo * _fifo; +}; + +/* Used inside KhompPvt to represent an event handler */ +struct ChanEventHandler: NEW_REFCOUNTER(ChanEventHandler) +{ + typedef int (HandlerType)(void *); + + ChanEventHandler(int device, HandlerType * handler) + { + _fifo = new EventFifo(device); + /* device event handler */ + _fifo->_thread = new Thread(handler, (void *)this, Globals::module_pool); + if(_fifo->_thread->start()) + { + DBG(FUNC,"Device event handler started"); + } + else + { + LOG(ERROR, "Device event handler error"); + } + } + + ChanEventHandler(const ChanEventHandler & evt) + : INC_REFCOUNTER(evt, ChanEventHandler), + _fifo(evt._fifo) + {}; + + void unreference(); + + EventFifo * fifo() + { + return _fifo; + } + + void signal() + { + _fifo->_cond.signal(); + }; + + bool provide(const EventRequest &); + bool writeNoSignal(const EventRequest &); + bool write(const EventRequest &); + +protected: + EventFifo * _fifo; +}; + + +/******************************************************************************/ +/****************************** Internal **************************************/ +struct RingbackDefs +{ + enum + { + RB_SEND_DEFAULT = -1, + RB_SEND_NOTHING = -2, + }; + + typedef enum + { + RBST_SUCCESS, + RBST_UNSUPPORTED, + RBST_FAILURE, + } + RingbackStType; +}; + +/******************************************************************************/ +/******************************* Others ***************************************/ +static bool checkTrueString(const char * str) +{ + if (str && *str) + { + if (!SAFE_strcasecmp(str, "yes") || !SAFE_strcasecmp(str, "true") || + !SAFE_strcasecmp(str, "enabled") || !SAFE_strcasecmp(str, "sim")) + { + return true; + } + } + + return false; +} + +static bool checkFalseString(const char * str) +{ + if (str && *str) + { + if (!SAFE_strcasecmp(str, "no") || !SAFE_strcasecmp(str, "false") || + !SAFE_strcasecmp(str, "disabled") || !SAFE_strcasecmp(str, "não")) + { + return true; + } + } + + return false; +} + +static TriState getTriStateValue(const char * str) +{ + if (str) + { + /**/ if (checkTrueString(str)) return T_TRUE; + else if (checkFalseString(str)) return T_FALSE; + else /***********************************/ return T_UNKNOWN; + } + + return T_UNKNOWN; +} + +const char * answerInfoToString(int answer_info); + +static bool replaceTemplate(std::string & haystack, const std::string & needed, int value) +{ + Regex::Expression e(std::string(needed).c_str()); + Regex::Match r(haystack,e); + + if(!r.matched()) return false; + + int len; + std::string fmt; + std::string tmp; + + // if needed isn't "SSSS" the length of needed will give string format + // if needed is "SSSS" the length of value will give string format + std::string ssss("SSSS"); + + if (ssss != needed) + { + len = needed.size(); + fmt = STG(FMT("%%0%dd") % len); + tmp = STG(FMT(fmt) % value); + } + else + { + len = (STG(FMT("%d") % value)).size(); + fmt = STG(FMT("%%%dd") % len); + tmp = STG(FMT(fmt) % value); + } + + haystack = r.replace(STG(FMT(fmt) % value)); + + DBG(FUNC,FMT("haystack: %s") % haystack); + return true; +} + + +static std::string timeToString (time_t time_value) +{ + int horas = (int)time_value / 3600; + + if (horas > 0) + time_value -= horas * 3600; + + int minutos = (int)time_value / 60; + + if (minutos > 0) + time_value -= minutos * 60; + + return STG(FMT("%02d:%02d:%02d") % horas % minutos % (int)time_value); +} +/******************************************************************************/ +/******************************* Match functions ******************************/ +typedef enum +{ + MATCH_NONE, + MATCH_EXACT, + MATCH_MORE +} +MatchType; + +static bool canMatch(std::string & context, std::string & exten, std::string & caller_id, bool match_more = false) +{ + switch_xml_t xml = NULL; + switch_xml_t xcontext = NULL; + switch_regex_t *re; + int ovector[30]; + + if (switch_xml_locate("dialplan","context","name",context.c_str(),&xml,&xcontext, NULL,SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) + { + switch_xml_t xexten = NULL; + + if(!(xexten = switch_xml_child(xcontext,"extension"))) + { + DBG(FUNC,"extension cannot match, returning"); + + if(xml) + switch_xml_free(xml); + + return false; + } + + while(xexten) + { + switch_xml_t xcond = NULL; + + for (xcond = switch_xml_child(xexten, "condition"); xcond; xcond = xcond->next) + { + std::string expression; + + if (switch_xml_child(xcond, "condition")) + { + LOG(ERROR,"Nested conditions are not allowed"); + } + + switch_xml_t xexpression = switch_xml_child(xcond, "expression"); + + if ((xexpression = switch_xml_child(xcond, "expression"))) + { + expression = switch_str_nil(xexpression->txt); + } + else + { + expression = switch_xml_attr_soft(xcond, "expression"); + } + + if(expression.empty() || expression == "^(.*)$") + { + /** + * We're not gonna take it + * No, we ain't gonna take it + * We're not gonna take it anymore + **/ + continue; + } + + int pm = -1; + switch_status_t is_match = SWITCH_STATUS_FALSE; + is_match = switch_regex_match_partial(exten.c_str(),expression.c_str(),&pm); + + if(is_match == SWITCH_STATUS_SUCCESS) + { + if(match_more) + { + if(pm == 1) + { + switch_xml_free(xml); + return true; + } + } + else + { + switch_xml_free(xml); + return true; + } + } + else + { + // not match + } + } + + xexten = xexten->next; + } + } + else + { + DBG(FUNC,"context cannot match, returning"); + } + + if(xml) + switch_xml_free(xml); + + return false; +} + +/******************************************************************************/ +/************************** Thread helper functions ***************************/ +typedef int (HandlerType)(void *); +static Thread * threadCreate(HandlerType * handler,void * arg) +{ + Thread *t = new Thread(handler, (void *) arg, Globals::module_pool); + return t; +} + +/******************************************************************************/ +/******************************** Kommuter ************************************/ +struct Kommuter +{ + Kommuter() : + _kommuter_count(-1), + _kwtd_timer_on(false) + {} + + bool start() + { + /* Checks for kommuter */ + try + { + Globals::k3lapi.command(-1,-1,CM_WATCHDOG_COUNT); + } + catch(K3LAPI::failed_command & e) + { + LOG(WARNING , "libkwd.so used by Kommuter devices is not available."); + return false; + } + + return true; + } + + bool stop(); + + bool initialize(K3L_EVENT *e); + + /* Index of the WatchDog timer */ + TimerTraits::Index _kwtd_timer_index; + int _kommuter_count; + bool _kwtd_timer_on; + + /* Timer to control our dog (totó) */ + static void wtdKickTimer(void *); + +}; + +/******************************************************************************/ +/******************************* Statistics ***********************************/ +struct Statistics +{ + typedef enum + { + DETAILED = 0, + ROW + } + Type; + + virtual std::string getDetailed() { return ""; } + virtual void clear() {} +}; + +/******************************************************************************/ +/******************************************************************************/ +#endif /* _UTILS_H_ */ diff --git a/src/mod/endpoints/mod_khomp/install.sh b/src/mod/endpoints/mod_khomp/install.sh new file mode 100755 index 0000000..8cc60f2 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/install.sh @@ -0,0 +1,93 @@ +#!/bin/bash + +############################################################################### +# KHOMP generic endpoint/channel library. +# Copyright (C) 2007-2010 Khomp Ind. & Com. + +# The contents of this file are subject to the Mozilla Public License +# Version 1.1 (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.mozilla.org/MPL/ + +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for +# the specific language governing rights and limitations under the License. + +# Alternatively, the contents of this file may be used under the terms of the +# "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which +# case the provisions of "LGPL License" are applicable instead of those above. + +# If you wish to allow use of your version of this file only under the terms of +# the LGPL License and not to allow others to use your version of this file +# under the MPL, indicate your decision by deleting the provisions above and +# replace them with the notice and other provisions required by the LGPL +# License. If you do not delete the provisions above, a recipient may use your +# version of this file under either the MPL or the LGPL License. + +# The LGPL header follows below: + +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# This library 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 +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License +# along with this library; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +############################################################################### + + +clean() +{ + printf "$1" + exit 1 +} + +if [ `whoami` != 'root' ] +then + clean "Need to be root\n" +fi + +if [ "w$FREESWITCH_PATH" == "w" ] +then + clean "FreeSWITCH source PATH is needed: \n\tSet \"FREESWITCH_PATH=\"\n" +fi + +if ! which 'kserver' &> /dev/null +then + echo "k3l will be installed" + K3L_FILE="k3l_2.1_client.sh" + + if [ "w`uname -m | grep x86_64`" == "w" ] + then + echo "Downloading i686 package" + wget -t15 -c --progress=bar:force -O $K3L_FILE.gz http://www.khomp.com.br/binaries/softpbx/freeswitch/k3l_2.1_client_i686.sh.g... + else + echo "Downloading x86_64 package" + wget -t15 -c --progress=bar:force -O $K3L_FILE.gz http://www.khomp.com.br/binaries/softpbx/freeswitch/k3l_2.1_client_x86-64.sh... + fi + + gunzip $K3L_FILE.gz + chmod 0755 $K3L_FILE + + (./$K3L_FILE) || clean "Error on k3l install\n" + + rm $K3L_FILE +fi + +if [ "w`kserver --version | grep 2.1`" == "w" ] +then + clean "k3l version 2.1 must be installed: \n\tUninstall the old version of k3l and try again\n" +fi + +make || clean "Error on compilation\n" + +make install || clean "Error on installation\n" + +echo "Successfully installed!" + diff --git a/src/mod/endpoints/mod_khomp/mod_khomp.cpp b/src/mod/endpoints/mod_khomp/mod_khomp.cpp new file mode 100644 index 0000000..d09a8a3 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/mod_khomp.cpp @@ -0,0 +1,1509 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org> + * + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (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.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * + * The Initial Developer of the Original Code is + * Anthony Minessale II <anthm@freeswitch.org> + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Khomp development team + * Geovani Ricardo Wiedenhoft <grw.freeswitch (at) gmail.com> + * Leonardo Lang <lang.freeswitch (at) gmail.com> + * Eduardo Nunes <eduardonunesp (at) gmail.com> + * Joao Mesquita <mesquita (at) khomp.com.br> + * Raul Fragoso <raulfragoso (at) gmail.com> + * + * + * mod_khomp.c -- Khomp board Endpoint Module + * + */ + +/** + \mainpage Khomp board Endpoint Module + + \section Introduction + This module has been developed to make a nice, affordable brazilian board + called Khomp (http://www.khomp.com.br) compatible with FreeSWITCH. + This module is supported by the manufacturer. + + \section Contributors + \li Khomp development team + \li Geovani Ricardo Wiedenhoft <grw.freeswitch (at) gmail.com> + \li Leonardo Lang <lang.freeswitch (at) gmail.com> + \li Eduardo Nunes <eduardonunesp (at) gmail.com> + \li Joao Mesquita <jmesquita (at) gmail.com> + \li Raul Fragoso <raulfragoso (at) gmail.com> +**/ + +/** + * @file mod_khomp.cpp + * @brief Khomp Endpoint Module + * @see mod_khomp + */ + +#include <string> +#include "khomp_pvt.h" +#include "spec.h" +#include "lock.h" +#include "logger.h" +#include "opt.h" +#include "globals.h" +#include "cli.h" + +extern "C" void Kstdcall khompAudioListener(int32 deviceid, int32 objectid, + byte * read_buffer, int32 read_size); + +/*! + \brief Load the module. Expadend by a FreeSWITCH macro. + Things we do here: + \li Initialize a static structure on KhompPvt + \li Load the configuration + \li Start the K3L API, responsible for connecting to KServer + \li Register mod APIs and APPs + \li Register audio callback for KServer + \li Register event callback for KServer + \see Opt Where all the configs are handled + \see khompEventCallback To where we bind the event handler + \see khompAudioListener To where we bind the audio handlers + */ +SWITCH_MODULE_LOAD_FUNCTION(mod_khomp_load); +SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_khomp_shutdown); +SWITCH_MODULE_DEFINITION(mod_khomp, mod_khomp_load, mod_khomp_shutdown, NULL); + +/*! + \defgroup fs_states FreeSWITCH State Handlers + We get called back from FreeSWITCH core everytime we make a + transition to any of these states. Refer to FreeSWITCH docs for a + detailed explanation of each state. + */ +/*@{*/ +switch_status_t khompInit(switch_core_session_t *session); +switch_status_t khompRouting(switch_core_session_t *session); +switch_status_t khompExecute(switch_core_session_t *session); +switch_status_t khompHangup(switch_core_session_t *session); +switch_status_t khompExchangeMedia(switch_core_session_t *session); +switch_status_t khompSoftExecute(switch_core_session_t *session); +switch_status_t khompDestroy(switch_core_session_t *session); +/*@}*/ + +switch_state_handler_table_t khomp_state_handlers = { + khompInit, /*.on_init */ + khompRouting, /*.on_routing */ + khompExecute, /*.on_execute */ + khompHangup, /*.on_hangup */ + khompExchangeMedia, /*.on_exchange_media */ + khompSoftExecute, /*.on_soft_execute */ + NULL, /*.on_consume_media */ + NULL, /*.on_hibernate */ + NULL, /*.on_reset */ + NULL, /*.on_park*/ + NULL, /*.on_reporting*/ + khompDestroy /*.on_destroy*/ +}; + +switch_status_t khompSMSDestroy(switch_core_session_t *session); + +switch_state_handler_table_t khomp_sms_state_handlers = { + khompInit, /*.on_init */ + khompRouting, /*.on_routing */ + khompExecute, /*.on_execute */ + NULL, /*.on_hangup */ + khompExchangeMedia, /*.on_exchange_media */ + khompSoftExecute, /*.on_soft_execute */ + NULL, /*.on_consume_media */ + NULL, /*.on_hibernate */ + NULL, /*.on_reset */ + NULL, /*.on_park*/ + NULL, /*.on_reporting*/ + khompSMSDestroy /*.on_destroy*/ +}; + +switch_status_t khompPRHangup(switch_core_session_t *session); + +switch_state_handler_table_t khomp_pr_state_handlers = { + khompInit, /*.on_init */ + khompRouting, /*.on_routing */ + khompExecute, /*.on_execute */ + khompPRHangup, /*.on_hangup */ + khompExchangeMedia, /*.on_exchange_media */ + khompSoftExecute, /*.on_soft_execute */ + NULL, /*.on_consume_media */ + NULL, /*.on_hibernate */ + NULL, /*.on_reset */ + NULL, /*.on_park*/ + NULL, /*.on_reporting*/ + khompDestroy /*.on_destroy*/ +}; + +/* Callbacks for FreeSWITCH */ +switch_call_cause_t khompCall( + switch_core_session_t *session, + switch_event_t *var_event, + switch_caller_profile_t *outbound_profile, + switch_core_session_t **new_session, + switch_memory_pool_t **pool, + switch_originate_flag_t flags, + switch_call_cause_t *cancel_cause); +switch_status_t khompRead(switch_core_session_t *session, + switch_frame_t **frame, + switch_io_flag_t flags, + int stream_id); +switch_status_t khompWrite(switch_core_session_t *session, + switch_frame_t *frame, + switch_io_flag_t flags, + int stream_id); +switch_status_t khompKill(switch_core_session_t *session, + int sig); +switch_status_t khompDigit(switch_core_session_t *session, + const switch_dtmf_t *dtmf); +switch_status_t khompReceiveMessage(switch_core_session_t *session, + switch_core_session_message_t *msg); +switch_status_t khompReceiveEvent(switch_core_session_t *session, + switch_event_t *event); + +/*! + \ingroup fs_states + */ +switch_io_routines_t khomp_io_routines = { + khompCall, /*.outgoing_channel */ + khompRead, /*.read_frame */ + khompWrite, /*.write_frame */ + khompKill, /*.kill_channel */ + khompDigit, /*.send_dtmf */ + khompReceiveMessage, /*.receive_message */ + khompReceiveEvent /*.receive_event */ +}; + +switch_io_routines_t khomp_sms_io_routines = { + NULL, /*.outgoing_channel */ + NULL, /*.read_frame */ + NULL, /*.write_frame */ + khompKill, /*.kill_channel */ + NULL, /*.send_dtmf */ + NULL, /*.receive_message */ + NULL /*.receive_event */ +}; + +switch_status_t khompPRWrite(switch_core_session_t *session, + switch_frame_t *frame, + switch_io_flag_t flags, + int stream_id); + +switch_io_routines_t khomp_pr_io_routines = { + NULL, /*.outgoing_channel */ + khompRead, /*.read_frame */ + khompPRWrite, /*.write_frame */ + khompKill, /*.kill_channel */ + NULL, /*.send_dtmf */ + NULL, /*.receive_message */ + NULL /*.receive_event */ +}; + +/* Macros to define specific API functions */ +SWITCH_STANDARD_API(apiKhomp); + +/*! + \brief Print link status. [khomp show links] + */ +void apiPrintLinks(switch_stream_handle_t* stream, unsigned int device, + unsigned int link); +/*! + \brief Print board channel status. [khomp show channels] + */ +void apiPrintChannels(switch_stream_handle_t* stream); + +/*! + \brief State methods they get called when the state changes to the specific state + returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next + so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it. +*/ +switch_status_t khompInit(switch_core_session_t *session) +{ + DBG(FUNC, "CHANNEL INIT") + switch_channel_t *channel = switch_core_session_get_channel(session); + + if(!channel) + { + DBG(FUNC, D("Channel is NULL")); + return SWITCH_STATUS_FALSE; + } + + /* Move channel's state machine to ROUTING. This means the call is trying + to get from the initial start where the call because, to the point + where a destination has been identified. If the channel is simply + left in the initial state, nothing will happen. */ + switch_channel_set_state(channel, CS_ROUTING); + + return SWITCH_STATUS_SUCCESS; +} + +switch_status_t khompRouting(switch_core_session_t *session) +{ + DBG(FUNC, "CHANNEL ROUTING"); + return SWITCH_STATUS_SUCCESS; +} + +switch_status_t khompExecute(switch_core_session_t *session) +{ + + DBG(FUNC, "CHANNEL EXECUTE"); + return SWITCH_STATUS_SUCCESS; +} + +switch_status_t khompHangup(switch_core_session_t *session) +{ + DBG(FUNC, D("c")); + + Board::KhompPvt *tech_pvt = NULL; + + if(!session) + { + LOG(ERROR, D("r (Session is NULL)")); + return SWITCH_STATUS_SUCCESS; + } + + tech_pvt = static_cast<Board::KhompPvt*>(switch_core_session_get_private(session)); + if(!tech_pvt) + { + DBG(FUNC, D("r (pvt is NULL)")); + return SWITCH_STATUS_FALSE; + } + + try + { + ScopedPvtLock lock(tech_pvt); + + if(tech_pvt->freeState()) + { + DBG(FUNC, PVT_FMT(tech_pvt->target(), "r (Already disconnected)")); + return SWITCH_STATUS_SUCCESS; + } + + tech_pvt->setHangupCause(SWITCH_CAUSE_NORMAL_CLEARING, true); + + //tech_pvt->doHangup(); + + lock.unlock(); + + CommandRequest c_req(CommandRequest::COMMAND, CommandRequest::CMD_HANGUP, tech_pvt->target().object); + + Board::board(tech_pvt->target().device)->chanCommandHandler()->write(c_req); + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(tech_pvt->target(), "r (unable to lock: %s!)") % err._msg.c_str()); + return SWITCH_STATUS_FALSE; + } + catch (K3LAPI::invalid_device & err) + { + LOG(ERROR, PVT_FMT(tech_pvt->target(), "r (unable to get device: %d!)") % err.device); + return SWITCH_STATUS_FALSE; + } + + DBG(FUNC, D("r")) + + return SWITCH_STATUS_SUCCESS; +} + +switch_status_t khompPRHangup(switch_core_session_t *session) +{ + DBG(FUNC, D("CHANNEL HANGUP")) +} + + +switch_status_t khompDestroy(switch_core_session_t *session) +{ + DBG(FUNC, D("c")) + + if(!session) + { + DBG(FUNC, D("r (session is null)")) + return SWITCH_STATUS_SUCCESS; + } + + Board::KhompPvt *tech_pvt = NULL; + + tech_pvt = static_cast<Board::KhompPvt*>(switch_core_session_get_private(session)); + + if(!tech_pvt) + { + DBG(FUNC, D("r (pvt is null)")) + return SWITCH_STATUS_FALSE; + } + try + { + ScopedPvtLock lock(tech_pvt); + + switch_core_session_set_private(session, NULL); + tech_pvt->destroyAll(); + } + catch (ScopedLockFailed & err) + { + DBG(FUNC, PVT_FMT(tech_pvt->target(), "r (unable to lock: %s!)") % err._msg.c_str()); + } + + DBG(FUNC, D("r")) + + return SWITCH_STATUS_SUCCESS; +} + +switch_status_t khompSMSDestroy(switch_core_session_t *session) +{ + DBG(FUNC, D("c")) + + if(!session) + { + DBG(FUNC, D("r (session is null)")) + return SWITCH_STATUS_SUCCESS; + } +/* + Board::KhompPvt *tech_pvt = NULL; + + tech_pvt = static_cast<Board::KhompPvt*>(switch_core_session_get_private(session)); + + if(!tech_pvt) + { + DBG(FUNC, D("r (pvt is null)")) + return SWITCH_STATUS_FALSE; + } + + try + { + ScopedPvtLock lock(tech_pvt); +*/ + switch_core_session_set_private(session, NULL); +/* + + } + catch (ScopedLockFailed & err) + { + DBG(FUNC, PVT_FMT(tech_pvt->target(), "r (unable to lock: %s!)") % err._msg.c_str()); + } +*/ + + DBG(FUNC, D("r")) + + return SWITCH_STATUS_SUCCESS; +} + +switch_status_t khompKill(switch_core_session_t *session, int sig) +{ + //DBG(FUNC,FMT("CHANNEL KILL, kill = %d") % sig) + Board::KhompPvt *tech_pvt = NULL; + + tech_pvt = static_cast<Board::KhompPvt*>(switch_core_session_get_private(session)); + + if(!tech_pvt) + { + return SWITCH_STATUS_FALSE; + } + + switch (sig) + { + case SWITCH_SIG_NONE: + DBG(FUNC, PVT_FMT(tech_pvt->target(), "CHANNEL KILL, NONE!")); + break; + case SWITCH_SIG_KILL: + DBG(FUNC, PVT_FMT(tech_pvt->target(), "CHANNEL KILL, SIGKILL!")); + //switch_thread_cond_signal(tech_pvt->_cond); + break; + case SWITCH_SIG_XFER: + DBG(FUNC, PVT_FMT(tech_pvt->target(), "CHANNEL KILL, SIGXFER!")); + break; + case SWITCH_SIG_BREAK: + DBG(FUNC, PVT_FMT(tech_pvt->target(), "CHANNEL KILL, BREAK!")); + break; + default: + DBG(FUNC, PVT_FMT(tech_pvt->target(), "CHANNEL KILL, WHAT?!")); + break; + } + + return SWITCH_STATUS_SUCCESS; +} + +switch_status_t khompExchangeMedia(switch_core_session_t *session) +{ + DBG(FUNC, "CHANNEL LOOPBACK") + return SWITCH_STATUS_SUCCESS; +} + +switch_status_t khompSoftExecute(switch_core_session_t *session) +{ + DBG(FUNC, "CHANNEL TRANSMIT") + return SWITCH_STATUS_SUCCESS; +} + +switch_status_t khompDigit(switch_core_session_t *session, const switch_dtmf_t *dtmf) +{ + Board::KhompPvt *tech_pvt = static_cast<Board::KhompPvt*>(switch_core_session_get_private(session)); + if(!tech_pvt) + { + LOG(ERROR, D("pvt is NULL")); + return SWITCH_STATUS_FALSE; + } + + DBG(FUNC, PVT_FMT(tech_pvt->target(), "c (%c)") % dtmf->digit); + + try + { + ScopedPvtLock lock(tech_pvt); + + char s[] = { dtmf->digit, '\0' }; + + tech_pvt->sendDtmf(s); + } + catch(ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(tech_pvt->target(), "r (unable to lock: %s!)") % err._msg.c_str()); + return SWITCH_STATUS_FALSE; + } + + DBG(FUNC, PVT_FMT(tech_pvt->target(), "r")); + + return SWITCH_STATUS_SUCCESS; +} + +switch_status_t khompRead(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id) +{ + Board::KhompPvt *tech_pvt = NULL; + //switch_time_t started = switch_time_now(); + //unsigned int elapsed; + //switch_byte_t *data; + + tech_pvt = static_cast<Board::KhompPvt*>(switch_core_session_get_private(session)); + if(!tech_pvt) + { + DBG(FUNC, D("pvt is NULL")) + return SWITCH_STATUS_FALSE; + } + + *frame = NULL; + + while (true) + { + /* + if (switch_test_flag(tech_pvt, TFLAG_BREAK)) + { + switch_clear_flag_locked(tech_pvt, TFLAG_BREAK); + + *frame = tech_pvt->_reader_frames.cng(); + return SWITCH_STATUS_SUCCESS; + } + */ + + if (tech_pvt->call()->_flags.check(Kflags::LISTEN_UP)) + { + *frame = tech_pvt->_reader_frames.pick(); + + if (!*frame) + { + //Reader buffer empty, waiting... + switch_cond_next(); + continue; + } + } + else + { + switch_yield(20000); + *frame = tech_pvt->_reader_frames.cng(); + } +/* +#ifdef BIGENDIAN + if (switch_test_flag(tech_pvt, TFLAG_LINEAR)) + { + switch_swap_linear((*frame)->data, (int) (*frame)->datalen / 2); + } +#endif +*/ + return SWITCH_STATUS_SUCCESS; + } + + return SWITCH_STATUS_FALSE; +} + +switch_status_t khompWrite(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id) +{ + Board::KhompPvt *tech_pvt = NULL; + + tech_pvt = static_cast<Board::KhompPvt*>(switch_core_session_get_private(session)); + if(!tech_pvt) + { + LOG(ERROR, D("pvt is NULL")); + return SWITCH_STATUS_FALSE; + } + +/* +#ifdef BIGENDIAN + if (switch_test_flag(tech_pvt, TFLAG_LINEAR)) + { + switch_swap_linear(frame->data, (int) frame->datalen / 2); + } +#endif +*/ + + if (frame) // && frame->flags != SFF_CNG) + { + if(frame->datalen != 0 && tech_pvt->call()->_flags.check(Kflags::GEN_CO_RING)) + { + tech_pvt->call()->_flags.clear(Kflags::GEN_CO_RING); + + try + { + Board::board(tech_pvt->target().device)->_timers.del(tech_pvt->call()->_idx_co_ring); + } + catch (K3LAPI::invalid_device & err) + { + LOG(ERROR, PVT_FMT(tech_pvt->target(), "Unable to get device: %d!") % err.device); + } + + if(tech_pvt->call()->_cadence != Board::KhompPvt::PLAY_VM_TONE) + { + tech_pvt->stopCadence(); + } + } + + if (!tech_pvt->_writer_frames.give((const char *)frame->data, (size_t)frame->datalen)) + { + DBG(STRM, PVT_FMT(tech_pvt->target(), "Writer buffer full!")); + //Writer buffer full! + } + } + + return SWITCH_STATUS_SUCCESS; + +} + +switch_status_t khompPRWrite(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id) +{ + /* + Board::KhompPvt *tech_pvt = NULL; + + tech_pvt = static_cast<Board::KhompPvt*>(switch_core_session_get_private(session)); + if(!tech_pvt) + { + DBG(FUNC, D("pvt is NULL")); + return SWITCH_STATUS_FALSE; + } + */ + + return SWITCH_STATUS_SUCCESS; +} + +switch_status_t khompAnswer(switch_core_session_t *session) +{ + Board::KhompPvt *tech_pvt; + switch_channel_t *channel = NULL; + + channel = switch_core_session_get_channel(session); + + if(!channel) + { + LOG(ERROR, D("channel is NULL")); + return SWITCH_STATUS_FALSE; + } + + tech_pvt = static_cast<Board::KhompPvt*>(switch_core_session_get_private(session)); + + if(!tech_pvt) + { + LOG(ERROR, D("pvt is NULL")); + return SWITCH_STATUS_FALSE; + } + + DBG(FUNC, PVT_FMT(tech_pvt->target(), "CHANNEL ANSWER")); + + try + { + ScopedPvtLock lock(tech_pvt); + + if(!tech_pvt->session() || !tech_pvt->call()->_flags.check(Kflags::IS_INCOMING)) + { + LOG(ERROR, PVT_FMT(tech_pvt->target(), "Channel is not connected")); + return SWITCH_STATUS_FALSE; + } + + tech_pvt->getSpecialVariables(); + + tech_pvt->setVolume(); + + tech_pvt->setCollectCall(); + + if (!tech_pvt->call()->_flags.check(Kflags::CONNECTED)) + { + /* we can unlock it now */ + lock.unlock(); + + CommandRequest c_req(CommandRequest::COMMAND, CommandRequest::CMD_ANSWER, tech_pvt->target().object); + + Board::board(tech_pvt->target().device)->chanCommandHandler()->write(c_req); + + } + else + { + DBG(FUNC, PVT_FMT(tech_pvt->target(), "channel is already connected")); + } + + //Esperar o atendimento EV_CONNECT + //if (!khomp_pvt::loop_while_flag_timed(pvt, c, kflags::REALLY_CONNECTED, timeout, &lock, false)) { return SWITCH_STATUS_FALSE; } + + + } + catch (K3LAPI::invalid_device & err) + { + LOG(ERROR, D("unable to get device: %d!") % err.device); + return SWITCH_STATUS_FALSE; + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(tech_pvt->target(), "unable to lock: %s!") % err._msg.c_str()); + return SWITCH_STATUS_FALSE; + + } + + return SWITCH_STATUS_SUCCESS; +} + + +switch_status_t khompReceiveMessage(switch_core_session_t *session, switch_core_session_message_t *msg) +{ + Board::KhompPvt *tech_pvt; + + if(!session) + { + LOG(ERROR, D("session is NULL")); + return SWITCH_STATUS_FALSE; + } + + if(!msg) + { + LOG(ERROR, D("msg is NULL")); + return SWITCH_STATUS_FALSE; + } + + tech_pvt = (Board::KhompPvt *) switch_core_session_get_private(session); + if(!tech_pvt) + { + LOG(ERROR, D("pvt is NULL")); + return SWITCH_STATUS_FALSE; + } + + switch (msg->message_id) { + case SWITCH_MESSAGE_REDIRECT_AUDIO: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_REDIRECT_AUDIO")); + break; + case SWITCH_MESSAGE_TRANSMIT_TEXT: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_TRANSMIT_TEXT")); + break; + case SWITCH_MESSAGE_INDICATE_ANSWER: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_ANSWER")); + return khompAnswer(session); + break; + case SWITCH_MESSAGE_INDICATE_PROGRESS: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_PROGRESS")); + tech_pvt->indicateProgress(); + break; + case SWITCH_MESSAGE_INDICATE_BRIDGE: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_BRIDGE")); + break; + case SWITCH_MESSAGE_INDICATE_UNBRIDGE: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_UNBRIDGE")); + break; + case SWITCH_MESSAGE_INDICATE_TRANSFER: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_TRANSFER")); + break; + case SWITCH_MESSAGE_INDICATE_RINGING: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_RINGING")); + tech_pvt->indicateRinging(); + break; + case SWITCH_MESSAGE_INDICATE_MEDIA: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_MEDIA")); + break; + case SWITCH_MESSAGE_INDICATE_NOMEDIA: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_NOMEDIA")); + break; + case SWITCH_MESSAGE_INDICATE_HOLD: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_HOLD")); + break; + case SWITCH_MESSAGE_INDICATE_UNHOLD: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_UNHOLD")); + break; + case SWITCH_MESSAGE_INDICATE_REDIRECT: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_REDIRECT")); + break; + case SWITCH_MESSAGE_INDICATE_RESPOND: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_RESPOND")); + break; + case SWITCH_MESSAGE_INDICATE_BROADCAST: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_BROADCAST")); + break; + case SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT")); + break; + case SWITCH_MESSAGE_INDICATE_DEFLECT: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_DEFLECT")); + break; + case SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ")); + break; + case SWITCH_MESSAGE_INDICATE_DISPLAY: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_DISPLAY")); + break; + case SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY")); + break; + case SWITCH_MESSAGE_INDICATE_AUDIO_SYNC: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_AUDIO_SYNC")); + break; + case SWITCH_MESSAGE_INDICATE_REQUEST_IMAGE_MEDIA: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_REQUEST_IMAGE_MEDIA")); + break; + case SWITCH_MESSAGE_INDICATE_UUID_CHANGE: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_UUID_CHANGE")); + break; + case SWITCH_MESSAGE_INDICATE_SIMPLIFY: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_SIMPLIFY")); + break; + case SWITCH_MESSAGE_INDICATE_DEBUG_AUDIO: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_DEBUG_AUDIO")); + break; + case SWITCH_MESSAGE_INDICATE_PROXY_MEDIA: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_PROXY_MEDIA")); + break; + case SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC")); + break; + case SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC_COMPLETE: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC_COMPLETE")); + break; + case SWITCH_MESSAGE_INVALID: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "SWITCH_MESSAGE_INVALID")); + break; + default: + DBG(FUNC, PVT_FMT(tech_pvt->_target, "unknown message received [%d].") % msg->message_id % (msg->from ? msg->from : 0)); + break; + } + + return SWITCH_STATUS_SUCCESS; +} + +/*! + \brief Make sure when you have 2 sessions in the same scope that you pass + the appropriate one to the routines that allocate memory or you will have + 1 channel with memory allocated from another channel's pool! +*/ +switch_call_cause_t khompCall + (switch_core_session_t *session, + switch_event_t *var_event, + switch_caller_profile_t *outbound_profile, + switch_core_session_t **new_session, + switch_memory_pool_t **pool, + switch_originate_flag_t flags, + switch_call_cause_t *cancel_cause) +{ + if (!outbound_profile) + { + LOG(ERROR, D("No caller profile")); + //switch_core_session_destroy(new_session); + return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; + } + + Board::KhompPvt *tech_pvt; + int cause = (int)SWITCH_CAUSE_SUCCESS; + + try + { + ScopedAllocLock alloc_lock; + + // got the pvt + tech_pvt = processDialString(outbound_profile->destination_number,&cause); + + if(tech_pvt == NULL || cause != SWITCH_CAUSE_SUCCESS) + { + LOG(ERROR, D("unable to find free channel")); + return (cause == SWITCH_CAUSE_SUCCESS) ? SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER : (switch_call_cause_t) cause; + } + + ScopedPvtLock lock(tech_pvt); + + if(tech_pvt->justAlloc(false, pool) != SWITCH_STATUS_SUCCESS) + { + tech_pvt->cleanup(Board::KhompPvt::CLN_HARD); + LOG(ERROR, PVT_FMT(tech_pvt->target(), "Initilization Error!")); + return SWITCH_CAUSE_UNALLOCATED_NUMBER; + } + + tech_pvt->owner((session ? session : tech_pvt->session())); + // get the session to FS + *new_session = tech_pvt->session(); + + if(tech_pvt->justStart(outbound_profile) != SWITCH_STATUS_SUCCESS) + { + *new_session = NULL; + tech_pvt->cleanup(Board::KhompPvt::CLN_HARD); + LOG(ERROR, PVT_FMT(tech_pvt->target(), "unable to justStart")); + return SWITCH_CAUSE_UNALLOCATED_NUMBER; + } + + alloc_lock.unlock(); + + tech_pvt->getSpecialVariables(); + + tech_pvt->setVolume(); + + if(tech_pvt->makeCall() != ksSuccess) + { + *new_session = NULL; + tech_pvt->cleanup(Board::KhompPvt::CLN_HARD); + LOG(ERROR, PVT_FMT(tech_pvt->target(), "unable to makeCall")); + return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; + } + + tech_pvt->setFSChannelVar("KCallAnswerInfo", "Unknown"); + } + catch(ScopedLockFailed & err) + { + if(err._fail == ScopedLockFailed::ALLOC_FAILED) + { + LOG(ERROR, PVT_FMT(tech_pvt->target(), "unable to global alloc lock")); + } + else + { + tech_pvt->cleanup(Board::KhompPvt::CLN_HARD); + LOG(ERROR, PVT_FMT(tech_pvt->target(), "unable to lock: %s!") % err._msg.c_str()); + } + return SWITCH_CAUSE_INTERWORKING; + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR, PVT_FMT(tech_pvt->target(), "%s") % err._msg.c_str()); + } + + return SWITCH_CAUSE_SUCCESS; +} + +switch_status_t khompReceiveEvent(switch_core_session_t *session, switch_event_t *event) +{ + struct Board::KhompPvt *tech_pvt = static_cast<Board::KhompPvt*>(switch_core_session_get_private(session)); + char *body = switch_event_get_body(event); + //switch_assert(tech_pvt != NULL); + + if(!tech_pvt) + { + LOG(ERROR, D("pvt is NULL")); + return SWITCH_STATUS_FALSE; + } + + DBG(FUNC, PVT_FMT(tech_pvt->target(), "Receive Event id[%d] name[%s] body=[%s]") % event->event_id % event->headers->name % body); + + if (!body) { + body = (char *)""; + } + + return SWITCH_STATUS_SUCCESS; +} + +/* A simple idea of app */ +SWITCH_STANDARD_APP(klogFunction) +{ + if (zstr(data)) + { + LOG(ERROR, D("No data specified")); + } + else + { + LOG(MESSAGE, FMT("KLOG: %s") % std::string(data)); + } +} + +void setVariable(switch_core_session_t * session, const char * variable, const char * data) +{ + if(!session) + { + LOG(ERROR, FMT("Session is NULL in %s") % variable); + return; + } + + if (zstr(data)) + { + LOG(ERROR, FMT("No %s specified") % variable); + return; + } + + if(strcasecmp(data, "on") && strcasecmp(data, "off")) + { + LOG(ERROR, FMT("On %s specify on or off") % variable); + return; + } + + switch_channel_t *c = switch_core_session_get_channel(session); + + if(!c) + { + LOG(ERROR, FMT("Channel is NULL in %s") % variable); + return; + } + + switch_channel_set_variable(c, variable, (!strcasecmp(data, "on") ? "true" : "false" )); + + DBG(FUNC,FMT("%s set %s") % variable % data); +} + +SWITCH_STANDARD_APP(kdtmfSuppressionFunction) +{ + setVariable(session, "KDTMFSuppression", data); +} + +SWITCH_STANDARD_APP(kechoCancellerFunction) +{ + setVariable(session, "KEchoCanceller", data); +} + +SWITCH_STANDARD_APP(kautoGainControlFunction) +{ + setVariable(session, "KAutoGainControl", data); +} + +SWITCH_STANDARD_APP(kr2SendConditionFunction) +{ + setVariable(session, "KR2SendCondition", data); +} + +SWITCH_STANDARD_APP(kadjustForFaxFunction) +{ + if(!session) + { + LOG(ERROR, D("Session is NULL")); + return; + } + + Board::KhompPvt *tech_pvt = static_cast<Board::KhompPvt*>(switch_core_session_get_private(session)); + + if(!tech_pvt) + { + LOG(ERROR, D("pvt is NULL")); + return; + } + + DBG(FUNC, PVT_FMT(tech_pvt->target(), "Application KAdjustForFax")); + + try + { + ScopedPvtLock lock(tech_pvt); + + if(tech_pvt->application(FAX_ADJUST, session, data)) + { + /* adjust the flag */ + tech_pvt->call()->_flags.set(Kflags::FAX_DETECTED); + } + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(tech_pvt->target(), "unable to lock: %s!") % err._msg.c_str()); + return; + } +} + +SWITCH_STANDARD_APP(ksendFaxFunction) +{ + if(!session) + { + LOG(ERROR, D("Session is NULL")); + return; + } + + + Board::KhompPvt *tech_pvt = static_cast<Board::KhompPvt*>(switch_core_session_get_private(session)); + + if(!tech_pvt) + { + LOG(ERROR, D("pvt is NULL")); + return; + } + + DBG(FUNC, PVT_FMT(tech_pvt->target(), "Application KSendFax")); + + tech_pvt->application(FAX_SEND, session, data); +} + +SWITCH_STANDARD_APP(kreceiveFaxFunction) +{ + if(!session) + { + LOG(ERROR, D("Session is NULL")); + return; + } + + + Board::KhompPvt *tech_pvt = static_cast<Board::KhompPvt*>(switch_core_session_get_private(session)); + + if(!tech_pvt) + { + LOG(ERROR, D("pvt is NULL")); + return; + } + + DBG(FUNC, PVT_FMT(tech_pvt->target(), "Application KReceiveFax")); + + tech_pvt->application(FAX_RECEIVE, session, data); +} + +SWITCH_STANDARD_APP(kUserTransferFunction) +{ + if(!session) + { + LOG(ERROR, D("Session is NULL")); + return; + } + + if (zstr(data)) + { + LOG(ERROR, D("No number specified")); + return; + } + + Board::KhompPvt *tech_pvt = static_cast<Board::KhompPvt*>(switch_core_session_get_private(session)); + + if(!tech_pvt) + { + DBG(FUNC, D("pvt is NULL")); + return; + } + + DBG(FUNC, PVT_FMT(tech_pvt->target(), "Application KUserTransfer")); + + tech_pvt->application(USER_TRANSFER, session, data); +} + +SWITCH_STANDARD_APP(ksetVolumeFunction) +{ + if(!session) + { + LOG(ERROR, D("Session is NULL")); + return; + } + + if (zstr(data)) + { + LOG(ERROR, D("No KSetVolume specified")); + return; + } + + switch_channel_t *c = switch_core_session_get_channel(session); + + if(!c) + { + LOG(ERROR, D("Channel is NULL")); + return; + } + + switch_channel_set_variable(c, "KSetVolume", data); + + DBG(FUNC, FMT("KSetVolume set %s") % data); +} + +SWITCH_STANDARD_APP(kSendSMSFunction) +{ + if(!session) + { + LOG(ERROR, D("Session is NULL")); + return; + } + + switch_channel_t *channel = switch_core_session_get_channel(session); + + if(!channel) + { + LOG(ERROR, D("Channel is NULL")); + return; + } + + switch_channel_set_variable(channel, "KSmsDelivered", "no"); + switch_channel_set_variable(channel, "KSmsErrorCode", "42"); + switch_channel_set_variable(channel, "KSmsErrorName", Verbose::gsmSmsCause((KGsmSmsCause)42).c_str()); + + if (zstr(data)) + { + LOG(ERROR, D("No data specified")); + return; + } + + int cause = (int)SWITCH_CAUSE_SUCCESS; + + try + { + ScopedAllocLock alloc_lock; + + Board::KhompPvt *tech_pvt = processSMSString(data, &cause); + + if(!tech_pvt) + { + DBG(FUNC, D("pvt is NULL, cause '%d'") % cause); + return; + } + + DBG(FUNC, PVT_FMT(tech_pvt->target(), "Application KSendSMS")); + + ScopedPvtLock lock(tech_pvt); + + alloc_lock.unlock(); + + tech_pvt->application(SMS_SEND, session, data); + + } + catch(ScopedLockFailed & err) + { + if(err._fail == ScopedLockFailed::ALLOC_FAILED) + { + LOG(ERROR, D("unable to global alloc lock")); + } + else + { + LOG(ERROR, D("unable to lock: %s!") % err._msg.c_str()); + } + } + +} + +SWITCH_STANDARD_APP(kSelectSimCardFunction) +{ + if(!session) + { + LOG(ERROR, D("Session is NULL")); + return; + } + + if (zstr(data)) + { + LOG(ERROR, D("invalid number of arguments")); + return; + } + + int dev = -1; + int obj = -1; + + try + { + std::string datastr((const char*) data); + Strings::trim(datastr); + + Strings::vector_type params; + Strings::tokenize(datastr, params, "|,",3); + + std::string num("0"); + + if (params.size() == 3) + { + dev = Strings::tolong(params[0]); + obj = Strings::tolong(params[1]); + num = params[2]; + + /* just check for validity */ + (void)Strings::tolong(params[2]); + } + else + { + LOG(ERROR, D("Invalid number of arguments!")); + return; + } + + if (!Globals::k3lapi.valid_device(dev)) + { + LOG(ERROR, D("ERROR: Invalid device number '%d'!") % dev); + return; + } + + if (!Globals::k3lapi.valid_channel(dev, obj)) + { + LOG(ERROR, D("ERROR: Invalid channel number '%d' on device '%d'!") % obj % dev); + return; + } + + if(!Board::get(dev, obj)->application(SELECT_SIM_CARD, NULL, num.c_str())) + { + LOG(ERROR, D("ERROR: Unable to select sim card")); + } + } + catch (Strings::invalid_value & e) + { + LOG(ERROR, D("invalid numeric value: %s") % e.value()); + } + catch(...) + { + LOG(ERROR, D("ERROR: Unable to select sim card")); + } +} + +SWITCH_MODULE_LOAD_FUNCTION(mod_khomp_load) +{ + /* start log early */ + if(!K::Logger::start()) + { + return SWITCH_STATUS_FALSE; + } + + /* Two bodies can not occupy the same space at the same time */ + if(switch_loadable_module_exists("mod_kommuter") == SWITCH_STATUS_SUCCESS) + { + LOG(ERROR, D("Kommuter module for FreeSWITCH is already loaded.")); + return SWITCH_STATUS_FALSE; + } + + //TODO: must put the autorevision variable here + LOG(MESSAGE, "loading Khomp module"); + + /* get a reference for the module pool */ + Globals::module_pool = pool; + + /* start config system! */ + Opt::initialize(); + + if(!Board::initializeK3L()) + { + return SWITCH_STATUS_TERM; + } + + /* read configuration first */ + Opt::obtain(); + + /* + Spawn our k3l global var that will be used along the module + for sending info to the boards + */ + + if(!Board::initialize()) + { + LOG(ERROR, "Error while initialize Board struct"); + return SWITCH_STATUS_TERM; + } + + /* apply global volume now */ + if(Opt::_input_volume != 0 || Opt::_output_volume != 0) + Board::applyGlobalVolume(); + + Opt::commit(); + + /* create module interface, set state handlers and give a name */ + *module_interface = switch_loadable_module_create_module_interface(pool, "mod_khomp"); + Globals::khomp_endpoint_interface = static_cast<switch_endpoint_interface_t*>(switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE)); + Globals::khomp_endpoint_interface->interface_name = "khomp"; + Globals::khomp_endpoint_interface->io_routines = &khomp_io_routines; + Globals::khomp_endpoint_interface->state_handler = &khomp_state_handlers; + + + Globals::khomp_sms_endpoint_interface = static_cast<switch_endpoint_interface_t*>(switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE)); + Globals::khomp_sms_endpoint_interface->interface_name = "khomp_SMS"; + Globals::khomp_sms_endpoint_interface->io_routines = &khomp_sms_io_routines; + Globals::khomp_sms_endpoint_interface->state_handler = &khomp_sms_state_handlers; + + Globals::khomp_pr_endpoint_interface = static_cast<switch_endpoint_interface_t*>(switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE)); + Globals::khomp_pr_endpoint_interface->interface_name = "khomp_PR"; + Globals::khomp_pr_endpoint_interface->io_routines = &khomp_pr_io_routines; + Globals::khomp_pr_endpoint_interface->state_handler = &khomp_pr_state_handlers; + + /* Register cli commands */ + Cli::registerCommands(apiKhomp,module_interface); + + /* Add applications */ + SWITCH_ADD_APP(Globals::khomp_app_inteface, "KLog", "KLog", "KLog log every string to khomp log system", klogFunction, "<value>", SAF_SUPPORT_NOMEDIA); + SWITCH_ADD_APP(Globals::khomp_app_inteface, "KDTMFSuppression", "KDTMFSuppression", "KDTMFSuppresion", kdtmfSuppressionFunction, "on|off", SAF_SUPPORT_NOMEDIA); + SWITCH_ADD_APP(Globals::khomp_app_inteface, "KEchoCanceller", "KEchoCanceller", "KEchoCanceller", kechoCancellerFunction, "on|off", SAF_SUPPORT_NOMEDIA); + SWITCH_ADD_APP(Globals::khomp_app_inteface, "KAutoGainControl", "KAutoGainControl", "KAutoGainControl", kautoGainControlFunction, "on|off", SAF_SUPPORT_NOMEDIA); + SWITCH_ADD_APP(Globals::khomp_app_inteface, "KSetVolume", "KSetVolume", "KSetVolume", ksetVolumeFunction, "value|value", SAF_SUPPORT_NOMEDIA); + SWITCH_ADD_APP(Globals::khomp_app_inteface, "KR2SendCondition", "KR2SendCondition", "KR2SendCondition", kr2SendConditionFunction, "value|value", SAF_SUPPORT_NOMEDIA); + + SWITCH_ADD_APP(Globals::khomp_app_inteface, "KAdjustForFax", "KAdjustForFax", "KAdjustForFax", kadjustForFaxFunction, "", SAF_SUPPORT_NOMEDIA); + SWITCH_ADD_APP(Globals::khomp_app_inteface, "KSendFax", "KSendFax", "KSendFax", ksendFaxFunction, "<infilename>[:<infilename2>[:...]][|<faxid>]", SAF_SUPPORT_NOMEDIA); + SWITCH_ADD_APP(Globals::khomp_app_inteface, "KReceiveFax", "KReceiveFax", "KReceiveFax", kreceiveFaxFunction, "<outfilename>[|<faxid>]", SAF_SUPPORT_NOMEDIA); + + SWITCH_ADD_APP(Globals::khomp_app_inteface, "KUserTransfer", "KUserTransfer", "KUserTransfer", kUserTransferFunction, "number", SAF_SUPPORT_NOMEDIA); + + SWITCH_ADD_APP(Globals::khomp_app_inteface, "KSendSMS", "KSendSMS", "KSendSMS", kSendSMSFunction, "resource|destination|message", SAF_SUPPORT_NOMEDIA); + + SWITCH_ADD_APP(Globals::khomp_app_inteface, "KSelectSimCard", "KSelectSimCard", "KSelectSimCard", kSelectSimCardFunction, "<board>|<channel>|<sim_card>", SAF_SUPPORT_NOMEDIA); + + Board::initializeHandlers(); + + Board::kommuter.start(); + + /* indicate that the module should continue to be loaded */ + return SWITCH_STATUS_SUCCESS; +} + +SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_khomp_shutdown) +{ + Board::kommuter.stop(); + + Cli::unregisterCommands(); + + /* Finnish him! */ + DBG(FUNC, "Unloading mod_khomp...") + + Board::finalizeHandlers(); + + Board::finalize(); + + DBG(FUNC, "Successfully Unloaded mod_khomp") + + K::Logger::stop(); + + return SWITCH_STATUS_SUCCESS; +} + +/*! + \brief khomp API definition + TODO: Add as xml modifier +*/ +SWITCH_STANDARD_API(apiKhomp) +{ + char *argv[10] = { 0 }; + int argc = 0; + void *val; + char *myarg = NULL; + switch_status_t status = SWITCH_STATUS_SUCCESS; + + /* We should not ever get a session here */ + if (session) return SWITCH_STATUS_FALSE; + + /* Set the stream for Cli class */ + Cli::setStream(stream); + + if (zstr(cmd)) + { + Cli::printKhompUsage(); + return status; + } + + if (!(myarg = strdup(cmd))) return SWITCH_STATUS_MEMERR; + + + if ((argc = switch_separate_string(myarg, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 1) { + Cli::printKhompUsage(); + goto done; + } + + /* Parse all commands */ + Cli::parseCommands(argc,argv); + +done: + switch_safe_free(myarg); + return status; +} + +extern "C" void Kstdcall khompAudioListener (int32 deviceid, int32 objectid, byte * read_buffer, int32 read_size) +{ + try + { + + //If NULL get throws K3LAPI::invalid_channel exception. + Board::KhompPvt * pvt = Board::get(deviceid, objectid); + + /* add listener audio to the read buffer */ + if (!pvt->_reader_frames.give((const char *)read_buffer, read_size)) + { + DBG(STRM, PVT_FMT(pvt->target(), "Reader buffer full (read_size: %d)") % read_size); + } + + if (!pvt->call()->_flags.check(Kflags::STREAM_UP)) + { + DBG(STRM, PVT_FMT(pvt->target(), "Stream not enabled, skipping write...")); + return; + } + + /* will be used below for CM_ADD_STREAM_BUFFER */ + struct + { + const byte * buff; + size_t size; + } + write_packet = { (const byte *)0, 0 }; + + /* push audio from the write buffer */ + switch_frame_t * fr = pvt->_writer_frames.pick(); + + if (!fr) + { + //Writer buffer empty! + DBG(STRM, PVT_FMT(pvt->target(), "Writer buffer empty (silence to board)")); + + write_packet.buff = (const byte *) Board::_cng_buffer; + write_packet.size = (size_t) Globals::boards_packet_size; + + pvt->command(KHOMP_LOG, CM_ADD_STREAM_BUFFER, + (const char *)&write_packet); + return; + } + + + /* what is the frame type? */ + switch (fr->flags) + { + case SFF_NONE: + { + write_packet.buff = (const byte *) fr->data; + write_packet.size = (size_t) fr->datalen; + + + pvt->command(KHOMP_LOG, CM_ADD_STREAM_BUFFER, + (const char *)&write_packet); + + break; + } + + case SFF_CNG: + { + write_packet.buff = (const byte *) Board::_cng_buffer; + write_packet.size = (size_t) Globals::boards_packet_size; + + pvt->command(KHOMP_LOG, CM_ADD_STREAM_BUFFER, + (const char *)&write_packet); + + break; + } + + default: + DBG(FUNC, PVT_FMT(pvt->target(), "DROPPING AUDIO...")); + /* TODO: log something here... */ + break; + } + + } + catch (K3LAPI::invalid_channel & err) + { + LOG(ERROR, OBJ_FMT(deviceid, objectid, "Invalid channel...")); + return; + } + catch (...) + { + LOG(ERROR, OBJ_FMT(deviceid, objectid, "Unexpected error...")); + return; + } +} + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab: + */ diff --git a/src/mod/endpoints/mod_khomp/src/applications.cpp b/src/mod/endpoints/mod_khomp/src/applications.cpp new file mode 100644 index 0000000..3826431 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/src/applications.cpp @@ -0,0 +1,968 @@ +/******************************************************************************* + + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2010 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the LGPL + License. If you do not delete the provisions above, a recipient may use your + version of this file under either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*******************************************************************************/ + +#include "applications.h" +#include "lock.h" + +bool Fax::adjustForFax() +{ + /* Don't worry, let the man work */ + DBG(FUNC, PVT_FMT(_pvt->target(),"Channel is now being adjusted for fax!")); + + try + { + ScopedPvtLock lock(_pvt); + + _pvt->echoCancellation(false); + _pvt->dtmfSuppression(false); + _pvt->autoGainControl(false); + + _pvt->call()->_input_volume = 0; + _pvt->setVolume("input" , 0); + _pvt->call()->_output_volume = 0; + _pvt->setVolume("output", 0); + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_pvt->target(), "r (unable to lock: %s!)") % err._msg.c_str()); + return false; + } + + return true; +} + +bool Fax::sendFax(switch_core_session_t * session, const char *data) +{ + DBG(FUNC, PVT_FMT(_pvt->target(), "c (%s)") % data); + + try + { + switch_channel_t *channel = _pvt->getFSChannel(session); + + switch_channel_set_variable(channel, "KFaxSent", "no"); + switch_channel_set_variable(channel, "KFaxResult", "none"); + + std::string fax_string((const char *)data); + Strings::vector_type fax_args; + Strings::vector_type fax_files; + + Strings::tokenize(fax_string, fax_args, "|,"); + + if(fax_args.size() != 1 && fax_args.size() != 2) + { + LOG(ERROR, PVT_FMT(_pvt->target(), "r (invalid string '%s': wrong number of separators.)") % fax_string); + return false; + } + + Strings::tokenize(fax_args[0], fax_files, ":"); + + if(fax_files.size() <= 0) + { + LOG(ERROR, PVT_FMT(_pvt->target(), "r (invalid string '%s': wrong number of separators.)") % fax_string); + return false; + } + + ScopedPvtLock lock(_pvt); + + std::string id; + + if(fax_args.size() == 2) + { + id = fax_args[1]; + } + else if(!_pvt->call()->_orig_addr.empty()) + { + id = _pvt->call()->_orig_addr; + } + + const char * orig_addr = id.empty() ? NULL : id.c_str(); + + int timeout = 5; + + if(!_pvt->call()->_flags.check(Kflags::REALLY_CONNECTED) && !_pvt->loopWhileFlagTimed(Kflags::REALLY_CONNECTED, timeout, false)) + return false; + + if(!startFaxTX(orig_addr)) + { + LOG(ERROR, PVT_FMT(_pvt->target(), "r (unable to start send fax)")); + return false; + } + + for(unsigned int i = 0; i < fax_files.size() ; ++i) + { + if (!addFaxFile(fax_files[i].c_str(), (i == fax_files.size()-1)? true : false)) + { + DBG(FUNC, D("unable to add fax file='%s'") + % fax_files[i].c_str()); + } + } + + _fax_cond.reset(); + + lock.unlock(); + + _fax_cond.wait(); + + switch_channel_set_variable(channel, "KFaxSent", ((_fax_result == kfaxrEndOfTransmission) ? "yes" : "no")); + switch_channel_set_variable(channel, "KFaxResult", (Verbose::faxResult((KFaxResult)_fax_result).c_str())); + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_pvt->target(), "r (unable to lock: %s!)") % err._msg.c_str()); + return false; + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR, PVT_FMT(_pvt->target(), "r (%s)") % err._msg.c_str()); + return false; + } + + DBG(FUNC, PVT_FMT(_pvt->target(), "r")); + return true; +} + + +bool Fax::receiveFax(switch_core_session_t * session, const char *data) +{ + DBG(FUNC, PVT_FMT(_pvt->target(), "c (%s)") % data); + + try + { + switch_channel_t *channel = _pvt->getFSChannel(session); + + switch_channel_set_variable(channel, "KFaxReceived", "no"); + switch_channel_set_variable(channel, "KFaxResult", "none"); + + std::string fax_string((const char *)data); + Strings::vector_type fax_args; + + Strings::tokenize(fax_string, fax_args, "|,"); + + if(fax_args.size() != 1 && fax_args.size() != 2) + { + LOG(ERROR, PVT_FMT(_pvt->target(), "r (invalid string '%s': wrong number of separators.)") % fax_string); + return false; + } + + ScopedPvtLock lock(_pvt); + + std::string id; + + if(fax_args.size() == 2) + { + id = fax_args[1]; + } + else if(!_pvt->call()->_dest_addr.empty()) + { + id = _pvt->call()->_dest_addr; + } + + const char * orig_addr = id.empty() ? NULL : id.c_str(); + + int timeout = 5; + + if(!_pvt->call()->_flags.check(Kflags::REALLY_CONNECTED) && !_pvt->loopWhileFlagTimed(Kflags::REALLY_CONNECTED, timeout, false)) + return false; + + if(!startFaxRX(fax_args[0].c_str(), orig_addr)) + { + LOG(ERROR, PVT_FMT(_pvt->target(), "r (unable to start receive fax)")); + return false; + } + + _fax_cond.reset(); + + lock.unlock(); + + _fax_cond.wait(); + + switch_channel_set_variable(channel, "KFaxReceived", ((_fax_result == kfaxrEndOfReception) ? "yes" : "no")); + switch_channel_set_variable(channel, "KFaxResult", (Verbose::faxResult((KFaxResult)_fax_result).c_str())); + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_pvt->target(), "r (unable to lock: %s!)") % err._msg.c_str()); + return false; + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR, PVT_FMT(_pvt->target(), "r (%s)") % err._msg.c_str()); + return false; + } + + DBG(FUNC, PVT_FMT(_pvt->target(), "r")); + + return true; +} + +bool Fax::onFaxChannelRelease(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_pvt->target(), "c")); + + try + { + ScopedPvtLock lock(_pvt); + + if (_pvt->call()->_flags.check(Kflags::FAX_SENDING)) + { + _pvt->call()->_flags.clear(Kflags::FAX_SENDING); + + /* make audio come back.. */ + _pvt->startStream(false); + _pvt->startListen(); + } + else if (_pvt->call()->_flags.check(Kflags::FAX_RECEIVING)) + { + _pvt->call()->_flags.clear(Kflags::FAX_RECEIVING); + + /* make audio come back.. */ + _pvt->startStream(false); + _pvt->startListen(); + } + + _fax_result = (KFaxResult)e->AddInfo; + + _fax_cond.signal(); + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_pvt->target(), "r (unable to lock %s!)") % err._msg.c_str()); + return false; + }; + + DBG(FUNC, PVT_FMT(_pvt->target(), "r")); + + return true; +} + +bool Fax::startFaxTX(const char * orig_addr) +{ + /* no audio after this point, so stop streams! */ + _pvt->stopStream(false); + _pvt->stopListen(); + + std::string id; + + if(orig_addr) + id = STG(FMT("orig_addr=\"%s\"") % orig_addr); + + const char * param = id.empty() ? NULL : id.c_str(); + + + if (!_pvt->command(KHOMP_LOG, CM_START_FAX_TX, param)) + { + _pvt->startStream(false); + _pvt->startListen(); + return false; + } + + _pvt->call()->_flags.set(Kflags::FAX_SENDING); + + return true; + +} + +bool Fax::stopFaxTX(void) +{ + /* EV_FAX_CHANNEL_FREE , EV_FAX_FILE_FAIL */ + if (!_pvt->command(KHOMP_LOG, CM_STOP_FAX_TX)) + return false; + + _pvt->call()->_flags.clear(Kflags::FAX_SENDING); + + /* make audio come back.. */ + _pvt->startStream(false); + _pvt->startListen(); + + return true; +} + + + +bool Fax::startFaxRX(const char * filename, const char * orig_addr) +{ + if(!filename) + return false; + + std::string param = STG(FMT("filename=\"%s\"") % filename); + + if(orig_addr) + param += STG(FMT(" orig_addr=\"%s\"") % orig_addr); + + /* no audio after this point, so stop streams! */ + _pvt->stopStream(false); + _pvt->stopListen(); + + if (!_pvt->command(KHOMP_LOG, CM_START_FAX_RX, param.c_str())) + { + _pvt->startStream(false); + _pvt->startListen(); + return false; + } + + _pvt->call()->_flags.set(Kflags::FAX_RECEIVING); + + return true; +} + +bool Fax::stopFaxRX() +{ + /* Events: EV_FAX_CHANNEL_FREE */ + if (!_pvt->command(KHOMP_LOG, CM_STOP_FAX_RX)) + return false; + + _pvt->call()->_flags.clear(Kflags::FAX_RECEIVING); + + /* make audio come back.. */ + _pvt->startStream(false); + _pvt->startListen(); + + return true; +} + +bool Fax::addFaxFile(const char * filename, bool last) +{ + /* Events: EV_FAX_FILE_SENT , EV_FAX_FILE_FAIL , EV_FAX_TX_TIMEOUT */ + if(!filename) + return false; + + std::string params = STG(FMT("filename=\"%s\" last=\"%s\"") % filename + % (last ? "true": "false")); + + if (!_pvt->command(KHOMP_LOG, CM_ADD_FAX_FILE, params.c_str())) + return false; + + return true; +} + +/******************************************************************************/ +bool SMS::justAlloc(unsigned int count) +{ + /* incoming contexts */ + Board::KhompPvt::ContextListType contexts; + + contexts.push_back(Opt::_context_gsm_sms); + + /* temporary variables */ + std::string context; + std::string exten; + + K3L_DEVICE_CONFIG & dev_cfg = Globals::k3lapi.device_config(_pvt->_target.device); + + for (Board::KhompPvt::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) + { + replaceTemplate((*i), "DD", _pvt->_target.device); + replaceTemplate((*i), "CC", _pvt->_target.object); + replaceTemplate((*i), "SSSS", atoi(dev_cfg.SerialNumber)); + } + + switch(_pvt->findExtension(exten, context, contexts, _got_sms._type, _got_sms._from, false, true)) + { + case MATCH_NONE: + if( _got_sms._type != "broadcast") + { + LOG(WARNING, PVT_FMT(_pvt->target(), "unable to find context/exten for incoming SMS (s/%s), processing disabled for this channel.") + % (contexts.size() >= 1 ? contexts[0] : "default")); + + } + + return false; + + default: + DBG(FUNC, PVT_FMT(_pvt->target(), "our: context '%s', exten '%s'") % context % exten); + break; + } + + for(unsigned int c = 0; c < count; c++) + { + +#if SWITCH_LESS_THAN(1,0,6) + switch_core_session_t *session = switch_core_session_request(Globals::khomp_sms_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL); +#else + switch_core_session_t *session = switch_core_session_request(Globals::khomp_sms_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL); +#endif + + if(!session) + { + LOG(ERROR, PVT_FMT(_pvt->target(), "Initilization Error, session not created!")); + return false; + } + + switch_core_session_add_stream(session, NULL); + + switch_core_session_set_private(session, _pvt); + + switch_caller_profile_t *caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session), + "Khomp_SMS", //username + "XML", //dialplan + NULL, //caller_id_name + _got_sms._from.c_str(), //caller_id_number + NULL, //network_addr + _got_sms._from.c_str(), //ani + NULL, //aniii + NULL, //rdnis + (char *) "mod_khomp", //source + context.c_str(), //context + exten.c_str()); //destination_number + + if(!caller_profile) + { + _pvt->destroy(session); + LOG(ERROR, PVT_FMT(_pvt->target(), "r (Cannot create caller profile)")); + return false; + } + + switch_channel_t *channel = switch_core_session_get_channel(session); + + if(!channel) + { + _pvt->destroy(session); + LOG(ERROR, PVT_FMT(_pvt->target(), "r (Cannot get channel)")); + return false; + } + + std::string name = STG(FMT("Khomp_SMS/%hu/%hu") + % _pvt->target().device + % _pvt->target().object); + + switch_channel_set_name(channel, name.c_str()); + switch_channel_set_caller_profile(channel, caller_profile); + + //DBG(FUNC, PVT_FMT(_pvt->target(), "Connect inbound SMS channel %s") % name.c_str()); + + switch_channel_set_state(channel, CS_INIT); + + + _owners.push_front(session); + } + + return true; +} + +bool SMS::justStart() +{ + OwnersList::iterator i = _owners.begin(); + + if(i == _owners.end()) + { + LOG(ERROR, PVT_FMT(_pvt->target(), "Cannot get session")); + return false; + } + + switch_core_session_t *session = (*i); + + _owners.pop_front(); + + if(!session) + { + LOG(ERROR, PVT_FMT(_pvt->target(), "Cannot get session")); + return false; + } + + switch_channel_t *channel = switch_core_session_get_channel(session); + + if(!channel) + { + _pvt->destroy(session); + LOG(ERROR, PVT_FMT(_pvt->target(), "r (Cannot get channel)")); + return false; + } + + switch_channel_set_variable(channel, "KSmsType", _got_sms._type.c_str()); + + if (_got_sms._type == "message" || _got_sms._type == "confirm") + { + switch_channel_set_variable(channel, "KSmsFrom", _got_sms._from.c_str()); + switch_channel_set_variable(channel, "KSmsDate", _got_sms._date.c_str()); + } + + if(_got_sms._type == "confirm") + { + switch_channel_set_variable(channel, "KSmsDelivery", _got_sms._sc_date.c_str()); + switch_channel_set_variable(channel, "KSmsStatus", _got_sms._status.c_str()); + } + else + { + if(_got_sms._type == "broadcast") + { + switch_channel_set_variable(channel, "KSmsSerial", _got_sms._serial.c_str()); + switch_channel_set_variable(channel, "KSmsPage", _got_sms._page.c_str()); + switch_channel_set_variable(channel, "KSmsPages", _got_sms._pages.c_str()); + } + switch_channel_set_variable(channel, "KSmsSize", _got_sms._size.c_str()); + switch_channel_set_variable(channel, "KSmsMode", _got_sms._coding.c_str()); + switch_channel_set_variable(channel, "KSmsBody", _got_sms._body.c_str()); + } + + + if (switch_core_session_thread_launch(session) != SWITCH_STATUS_SUCCESS) + { + _pvt->destroy(session); + LOG(ERROR, PVT_FMT(_pvt->target(), "Error spawning thread")); + return false; + } + + return true; +} + +bool SMS::sendSMS(switch_core_session_t * session, const char *data) +{ + DBG(FUNC, PVT_FMT(_pvt->target(), "(SMS) c")); + + volatile bool finished = false; + volatile KGsmCallCause result = kgccNone; + + try + { + //ScopedAllocLock alloc_lock; + + if(!_can_send) + { + LOG(ERROR, PVT_FMT(_pvt->target(), "(SMS) r (cannot send SMS messages, modem NOT initialized!)")); + return false; + } + + std::string sms_string((const char *)data); + Strings::vector_type sms_args; + + Strings::tokenize(sms_string, sms_args, "/|,", 3); + + if (sms_args.size() != 3) + { + LOG(ERROR, PVT_FMT(_pvt->target(), "(SMS) r (invalid dial string '%s': wrong number of separators.)") % sms_string); + return false; + } + + std::string dest(sms_args[1]); + + bool conf = false; + + if (dest[0] == '!') + { + dest.erase(0,1); + conf = true; + } + + if (dest[dest.size()-1] == '!') + { + dest.erase(dest.size()-1,1); + conf = true; + } + + // get options/values + + _send_sms._dest = dest; + _send_sms._conf = conf; + _send_sms._body = sms_args[2]; + + Request request_sms(_send_sms, &finished, &result); + + _mutex.lock(); + bool status = _buffer.provide(request_sms); + _mutex.unlock(); + + _pvt->_mutex.unlock(); + + if(status) + _cond.signal(); + + while (!finished) + { + usleep(200000); + } + + _pvt->_mutex.lock(); + + switch_channel_t *channel = _pvt->getFSChannel(session); + + switch_channel_set_variable(channel, "KSmsDelivered", ((KGsmSmsCause)result == ((KGsmSmsCause)0) ? "yes" : "no")); + switch_channel_set_variable(channel, "KSmsErrorCode", STG(FMT("%d") % result).c_str()); + switch_channel_set_variable(channel, "KSmsErrorName", ((KGsmSmsCause)result == ((KGsmSmsCause)0) ? "None" : Verbose::gsmSmsCause((KGsmSmsCause)result).c_str())); + + } + catch(ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_pvt->target(), "(SMS) r (unable to global alloc lock)")); + return false; + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR, PVT_FMT(_pvt->target(), "(SMS) %s") % err._msg.c_str()); + //return false; + } + + bool ret = ((KGsmSmsCause)result == ((KGsmSmsCause)0)); + + DBG(FUNC, PVT_FMT(_pvt->target(), "(SMS) r (%s)") % (ret ? "true" : "false")); + + //return (KGsmSmsCause)result; + return ret; +} + +bool SMS::onNewSMS(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_pvt->target(), "(SMS) c")); + + bool ret = true; + + try + { + ScopedPvtLock lock(_pvt); + + if(!_can_receive) + { + DBG(FUNC, PVT_FMT(_pvt->target(), "(SMS) received new SMS message(s), but receiving is disabled. keeping the message(s) at the SIM card.")); + ret = false; + } + else if(!justAlloc(e->AddInfo)) + { + LOG(WARNING, PVT_FMT(_pvt->target(), "(SMS) unable to allocate channel for new SMS message(s). disabling processing to prevent messages from being lost.")); + _can_receive = false; + ret = false; + } + else + { + + DBG(FUNC, PVT_FMT(_pvt->target(), "downloading %d SMS message(s) on the SIM card.") % e->AddInfo); + + _pvt->command(KHOMP_LOG, CM_GET_SMS); + } + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_pvt->target(), "(SMS) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_pvt->target(), "(SMS) r")); + + return ret; +} + +bool SMS::onSMSInfo(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_pvt->target(), "(SMS) c")); + + try + { + ScopedPvtLock lock(_pvt); + + Globals::k3lapi.get_param(e, "sms_type", _got_sms._type); + Globals::k3lapi.get_param(e, "sms_from", _got_sms._from); + Globals::k3lapi.get_param(e, "sms_date", _got_sms._date); + Globals::k3lapi.get_param(e, "sms_size", _got_sms._size); + Globals::k3lapi.get_param(e, "sms_coding", _got_sms._coding); + Globals::k3lapi.get_param(e, "sms_serial", _got_sms._serial); + Globals::k3lapi.get_param(e, "sms_id", _got_sms._id); + Globals::k3lapi.get_param(e, "sms_page", _got_sms._page); + Globals::k3lapi.get_param(e, "sms_pages", _got_sms._pages); + Globals::k3lapi.get_param(e, "sms_sc_date", _got_sms._sc_date); + Globals::k3lapi.get_param(e, "sms_status", _got_sms._status); + + //DBG(FUNC, PVT_FMT(_pvt->target(), "(SMS) type=%s from=%s date=%s size=%s coding=%s serial=%s id=%s page=%s pages=%s sc_date=%s status=%s") % _got_sms._type % _got_sms._from % _got_sms._date % _got_sms._size % _got_sms._coding % _got_sms._serial % _got_sms._id % _got_sms._page % _got_sms._pages % _got_sms._sc_date % _got_sms._status); + + if (_owners.empty() && !justAlloc(1) && (_got_sms._type.compare("broadcast") != 0)) + { + // this error is fatal + LOG(ERROR, PVT_FMT(_pvt->target(), "unable to allocate channel, new SMS message from %s will not be sent to dialplan!") % _got_sms._from); + return false; + } + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_pvt->target(), "(SMS) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_pvt->target(), "(SMS) r")); + + return true; +} + +bool SMS::onSMSData(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_pvt->target(), "(SMS) c")); + + try + { + ScopedPvtLock lock(_pvt); + + if (_owners.empty()) + { + if(_got_sms._type != "broadcast") + { + LOG(WARNING, PVT_FMT(_pvt->target(), "unable to allocate channel for new SMS message(s). disabling processing to prevent messages from being lost.")); + _can_receive = false; + } + } + else + { + _got_sms._body = (const char *)(e->Params ? e->Params : ""); + + if(!justStart()) + { + if(_got_sms._type != "broadcast") + { + LOG(ERROR, PVT_FMT(_pvt->target(), "unable to receive SMS from '%s', something wrong!") % _got_sms._from); + LOG(ERROR, PVT_FMT(_pvt->target(), "disabling SMS processing to prevent messages from being lost.")); + + _can_receive = false; + } + } + } + + if(_can_receive) + { + /* stats update! */ + if(_got_sms._type == "message") + { + statistics<SMSStatistics>()->incrementIncoming(); + } + else if(_got_sms._type == "confirm") + { + statistics<SMSStatistics>()->incrementConfirm(); + } + else + { + statistics<SMSStatistics>()->incrementBroadcast(); + } + } + + /* reset data stuff */ + _got_sms.clear(); + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_pvt->target(), "(SMS) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_pvt->target(), "(SMS) r")); + return true; +} + +bool SMS::onSMSSendResult(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_pvt->target(), "(SMS) c")); + + try + { + ScopedPvtLock lock(_pvt); + + _result = (KGsmCallCause)e->AddInfo; + _pvt->call()->_flags.clear(Kflags::SMS_DOING_UPLOAD); + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_pvt->target(), "(SMS) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_pvt->target(), "(SMS) r")); + + return true; +} + +int SMS::smsThread(void * sms_ptr) +{ + SMS * sms = static_cast < SMS * > (sms_ptr); + + Board::KhompPvt * pvt = static_cast < Board::KhompPvt * > (sms->_pvt); + + DBG(THRD, PVT_FMT(pvt->target(), "c")); + + bool loop = true; + + while(loop) + { + if(sms->_cond.wait(1000)) + { + if(sms->_shutdown) + return 0; + } + + try + { + ScopedPvtLock lock(pvt); + + K3L_CHANNEL_STATUS status; + + KLibraryStatus ret = (KLibraryStatus) k3lGetDeviceStatus( + pvt->_target.device, + pvt->_target.object + ksoChannel, + &status, + sizeof(status)); + + if (ret == ksSuccess) + { + switch (status.AddInfo) + { + case kgsmModemError: + case kgsmSIMCardError: + return 0; + + case kgsmIdle: + { + /* pede registro do canal.. */ + pvt->command(KHOMP_LOG, CM_SEND_TO_MODEM, "AT+COPS?"); + + /* pede estado da antena.. */ + pvt->command(KHOMP_LOG, CM_SEND_TO_MODEM, "AT+CSQ?"); + + /* forca tipo padrao a ser message... */ + sms->_got_sms._type = "message"; + + /* pre-aloca canal para receber mensagens SMS. */ + if (sms->justAlloc()) + { + /* habilita processamento de SMSs entrantes */ + sms->_can_receive = true; + + /* envia comando para "limpar" SMSs do SIM card */ + pvt->command(KHOMP_LOG, CM_CHECK_NEW_SMS); + } + + sms->_got_sms.clear(); + + /* sai fora do loop! */ + loop = false; + } + default: + break; + } + } + } + catch (ScopedLockFailed & err) + { + DBG(FUNC, PVT_FMT(pvt->_target, "unable to obtain lock: %s") % err._msg.c_str()); + } + + } + + sms->_can_send = true; + + while(true) + { + Request request_sms; + + DBG(THRD, PVT_FMT(pvt->_target, "begin")); + + while(!sms->_buffer.consume(request_sms)) + { + DBG(THRD, PVT_FMT(pvt->_target, "buffer empty")); + + sms->_cond.wait(); + + DBG(THRD, PVT_FMT(pvt->_target, "waked up!")); + + if(sms->_shutdown) + return 0; + } + + DBG(THRD, PVT_FMT(pvt->_target, "processing buffer...")); + + try + { + int timeout = 30; + + ScopedPvtLock lock(pvt); + + pvt->call()->_flags.set(Kflags::SMS_DOING_UPLOAD); + + if (pvt->command(KHOMP_LOG, CM_PREPARE_SMS, request_sms._send_sms._body.c_str())) + { + std::string extra = (request_sms._send_sms._conf ? " sms_confirm=\"TRUE\"" : ""); + + if (pvt->command(KHOMP_LOG, CM_SEND_SMS, + STG(FMT("sms_to=\"%s\"%s") % request_sms._send_sms._dest % extra).c_str())) + { + if (!pvt->loopWhileFlagTimed(Kflags::SMS_DOING_UPLOAD, timeout)) + break; + } + else + { + sms->_result = kgccResourceUnavailable; + } + } + else + { + sms->_result = kgccInvalidMessage; + } + + pvt->call()->_flags.clear(Kflags::SMS_DOING_UPLOAD); + + if (request_sms._cause) + *(request_sms._cause) = (KGsmCallCause)sms->_result; + + if (request_sms._finished) + *(request_sms._finished) = true; + + if (sms->_result == kgccNone) + { + /* stats update if sent! */ + sms->statistics<SMSStatistics>()->incrementOutgoing(); + } + + sms->_send_sms.clear(); + + } + catch (ScopedLockFailed & err) + { + DBG(FUNC, PVT_FMT(pvt->_target, "unable to obtain lock: %s") % err._msg.c_str()); + } + + DBG(FUNC, PVT_FMT(pvt->target(), "ok, going to loop...")); + + } + + + DBG(FUNC, PVT_FMT(pvt->target(), "r")); + + return 0; +} + diff --git a/src/mod/endpoints/mod_khomp/src/cli.cpp b/src/mod/endpoints/mod_khomp/src/cli.cpp new file mode 100644 index 0000000..709abb9 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/src/cli.cpp @@ -0,0 +1,2408 @@ +/******************************************************************************* + + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2010 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the LGPL + License. If you do not delete the provisions above, a recipient may use your + version of this file under either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*******************************************************************************/ + +#include "cli.h" +#include "k3l.h" +#include "lock.h" +#include "khomp_pvt.h" +#include "spec.h" + +/* our stream and interface handlers */ +switch_stream_handle_t *Cli::stream; +switch_loadable_module_interface_t **Cli::module_interface; + +/* contains all commands */ +Cli::Commands Cli::_commands; + +/* khomp all commands usage */ +std::string Cli::_khomp_usage; + +/* register our commands, but you must create the command function */ +void Cli::registerCommands(APIFunc func,switch_loadable_module_interface_t **mod_int) +{ + if(!mod_int || !*mod_int) + { + LOG(ERROR,"Invalid module passed"); + return; + } + + /* the manual */ + _khomp_usage = \ +"---------------------------------------------------------------------------\n"\ +"---------------------------------- HELP -----------------------------------\n"\ +"---------------------------------------------------------------------------\n"\ +" khomp channels disconnect {all | <board> all | <board> <channel>}\n" \ +" khomp channels unblock {all | <board> all | <board> <channel>}\n" \ +" khomp clear links [<board> [<link>]]\n" \ +" khomp clear statistics [<board> [<channel>]]\n" \ +" khomp get <option>\n" \ +" khomp kommuter {on|off}\n" \ +" khomp kommuter count\n" \ +" khomp log console <options>\n" \ +" khomp log disk <options>\n" \ +" khomp log rotate\n" \ +" khomp log status\n" \ +" khomp log trace isdn <what>[,<what2>[,..]]\n" \ +" khomp log trace k3l {on|off}\n" \ +" khomp log trace r2 {on|off}\n" \ +" khomp reset links [<board> [<link>]]\n" \ +" khomp revision\n" \ +" khomp select sim <board> <channel> <sim_card>\n" \ +" khomp send command <board> <channel> <command> [argument]\n" \ +" khomp send raw command <board> <dsp> <c0> <c1> [...]\n" \ +" khomp set <option> <value>\n" \ +" khomp show calls [<board> [<channel>]]\n" \ +" khomp show channels [{<board> [<channel>]} | \n" \ +" {{concise|verbose} [<board> [<channel>]]}]\n" \ +" khomp show links [[errors] [{<board>} | {{concise|verbose} [<board>]}]]\n" \ +" khomp show statistics [{verbose [<board> [<channel>]]} | \n" \ +" {detailed <board> <channel>}]\n" \ +" khomp sms <device> <destination> <message..>\n" \ +" khomp summary [concise]\n" \ +"---------------------------------------------------------------------------\n\n"; + + /* we need this module_inteface, is used by SWITCH_ADD_API, there's no escape */ + module_interface = mod_int; + + /* khomp cli commands */ + SWITCH_ADD_API(Globals::api_interface, "khomp", "Khomp Menu", func, _khomp_usage.c_str()); + + /* insert commands in list */ + for(Commands::iterator itr = _commands.begin();itr != _commands.end();itr++) + { + switch_console_set_complete(STR(FMT("add khomp %s") % (*itr)->complete_name)); + + /* if we have options, let's insert them */ + if((*itr)->options.size() > 0) + { + std::vector<std::string>::iterator itr_option = (*itr)->options.begin(); + while(itr_option != (*itr)->options.end()) + { + switch_console_set_complete(STR(FMT("add khomp %s %s") % (*itr)->complete_name % *itr_option)); + itr_option++; + } + } + } +} + +/* is responsible for parse and execute all commands */ +bool Cli::parseCommands(int argc, char *argv[]) +{ + /* khomp summary */ + if (ARG_CMP(0, "summary")) + return EXEC_CLI_CMD(Cli::KhompSummary); + + /* khomp show */ + else if(ARG_CMP(0, "show")) + { + /* khomp show calls */ + if(ARG_CMP(1, "calls")) + return EXEC_CLI_CMD(Cli::KhompShowCalls); + + /* khomp show channels */ + if(ARG_CMP(1, "channels")) + return EXEC_CLI_CMD(Cli::KhompShowChannels); + + /* khomp show links */ + if(ARG_CMP(1, "links")) + return EXEC_CLI_CMD(Cli::KhompShowLinks); + + /* khomp show statistics */ + if(ARG_CMP(1, "statistics")) + return EXEC_CLI_CMD(Cli::KhompShowStatistics); + } + + /* khomp clear */ + else if(ARG_CMP(0, "clear")) + { + /* khomp clear links */ + if(ARG_CMP(1, "links")) + return EXEC_CLI_CMD(Cli::KhompClearLinks); + + /* khomp clear statistics */ + if(ARG_CMP(1, "statistics")) + return EXEC_CLI_CMD(Cli::KhompClearStatistics); + } + + /* khomp reset */ + else if(ARG_CMP(0, "reset")) + { + /* khomp reset links */ + if(ARG_CMP(1, "links")) + return EXEC_CLI_CMD(Cli::KhompResetLinks); + + } + + /* khomp sms */ + else if(ARG_CMP(0, "sms")) + { + return EXEC_CLI_CMD(Cli::KhompSMS); + } + + /* khomp log */ + else if(ARG_CMP(0, "log")) + { + /* khomp log console */ + if(ARG_CMP(1, "console")) + return EXEC_CLI_CMD(Cli::KhompLogConsole); + + /* khomp log disk */ + if(ARG_CMP(1, "disk")) + return EXEC_CLI_CMD(Cli::KhompLogDisk); + + /* khomp log status */ + if(ARG_CMP(1, "status")) + return EXEC_CLI_CMD(Cli::KhompLogStatus); + + /* khomp log rotate */ + if(ARG_CMP(1, "rotate")) + return EXEC_CLI_CMD(Cli::KhompLogRotate); + + /* khomp log trace */ + if(ARG_CMP(1, "trace")) + { + /* khomp log trace k3l */ + if(ARG_CMP(2, "k3l")) + return EXEC_CLI_CMD(Cli::KhompLogTraceK3L); + + /* khomp log trace isdn */ + if(ARG_CMP(2, "isdn")) + return EXEC_CLI_CMD(Cli::KhompLogTraceISDN); + + /* khomp log trace r2 */ + if(ARG_CMP(2, "r2")) + return EXEC_CLI_CMD(Cli::KhompLogTraceR2); + } + } + + /* khomp channels */ + else if(ARG_CMP(0, "channels")) + { + /* khomp channels disconnect */ + if(ARG_CMP(1, "disconnect")) + return EXEC_CLI_CMD(Cli::KhompChannelsDisconnect); + + /* khomp channels unblock */ + if(ARG_CMP(1, "unblock")) + return EXEC_CLI_CMD(Cli::KhompChannelsUnblock); + } + + /* khomp get */ + else if(ARG_CMP(0, "get")) + return EXEC_CLI_CMD(Cli::KhompGet); + + /* khomp set */ + else if(ARG_CMP(0, "set")) + return EXEC_CLI_CMD(Cli::KhompSet); + + /* khomp reivision */ + else if(ARG_CMP(0, "revision")) + return EXEC_CLI_CMD(Cli::KhompRevision); + + /* khomp send */ + else if(ARG_CMP(0, "send")) + { + /* khomp send command */ + if(ARG_CMP(1, "command")) + return EXEC_CLI_CMD(Cli::KhompSendCommand); + + /* khomp send raw */ + if(ARG_CMP(1, "raw")) + return EXEC_CLI_CMD(Cli::KhompSendRawCommand); + } + + /* khomp select */ + else if(ARG_CMP(0, "select")) + { + /* khomp select sim */ + if(ARG_CMP(1, "sim")) + return EXEC_CLI_CMD(Cli::KhompSelectSim); + + } + + /* khomp kommuter */ + else if(ARG_CMP(0, "kommuter")) + { + if(ARG_CMP(1, "on") || ARG_CMP(1, "off")) + return EXEC_CLI_CMD(Cli::KhompKommuterOnOff); + + if(ARG_CMP(1, "count")) + return EXEC_CLI_CMD(Cli::KhompKommuterCount); + } + + /* if everything fails, i'm here to support */ + printKhompUsage(); + + return false; +} + +/******************************************************************************/ +/******************** Defining the static initialization **********************/ + +Cli::_KhompSummary Cli::KhompSummary; +Cli::_KhompShowCalls Cli::KhompShowCalls; +Cli::_KhompShowChannels Cli::KhompShowChannels; +Cli::_KhompShowLinks Cli::KhompShowLinks; +Cli::_KhompShowStatistics Cli::KhompShowStatistics; +Cli::_KhompClearLinks Cli::KhompClearLinks; +Cli::_KhompClearStatistics Cli::KhompClearStatistics; +Cli::_KhompResetLinks Cli::KhompResetLinks; +Cli::_KhompChannelsDisconnect Cli::KhompChannelsDisconnect; +Cli::_KhompChannelsUnblock Cli::KhompChannelsUnblock; +Cli::_KhompSMS Cli::KhompSMS; +Cli::_KhompLogConsole Cli::KhompLogConsole; +Cli::_KhompLogDisk Cli::KhompLogDisk; +Cli::_KhompLogStatus Cli::KhompLogStatus; +Cli::_KhompLogRotate Cli::KhompLogRotate; +Cli::_KhompLogTraceK3L Cli::KhompLogTraceK3L; +Cli::_KhompLogTraceISDN Cli::KhompLogTraceISDN; +Cli::_KhompLogTraceR2 Cli::KhompLogTraceR2; +Cli::_KhompGet Cli::KhompGet; +Cli::_KhompSet Cli::KhompSet; +Cli::_KhompRevision Cli::KhompRevision; +Cli::_KhompSendCommand Cli::KhompSendCommand; +Cli::_KhompSendRawCommand Cli::KhompSendRawCommand; +Cli::_KhompSelectSim Cli::KhompSelectSim; +Cli::_KhompKommuterOnOff Cli::KhompKommuterOnOff; +Cli::_KhompKommuterCount Cli::KhompKommuterCount; + +/******************************************************************************/ +/*************************** Defining the commands ****************************/ +/*! + \brief Print a system summary for all the boards. [khomp summary] + */ +bool Cli::_KhompSummary::execute(int argc, char *argv[]) +{ + if(argc < 1 || argc > 2) + { + printUsage(stream); + return false; + } + + /* show concise ? */ + bool concise = ARG_CMP(1, "concise") ? true:false; + + class_type classe = ( !_on_cli_term ? C_MESSAGE : C_CLI ); + K3L_API_CONFIG apiCfg; + + if (!concise) + { + K::Logger::Logg2(classe, stream, " ------------------------------------------------------------------"); + K::Logger::Logg2(classe, stream, "|---------------------- Khomp System Summary ----------------------|"); + K::Logger::Logg2(classe, stream, "|------------------------------------------------------------------|"); + } + + if (k3lGetDeviceConfig(-1, ksoAPI, &apiCfg, sizeof(apiCfg)) == ksSuccess) + { + if (concise) + { + K::Logger::Logg2(classe, stream, FMT("%d.%d.%d;%d;%s") + % apiCfg.MajorVersion % apiCfg.MinorVersion % apiCfg.BuildVersion + % apiCfg.VpdVersionNeeded % apiCfg.StrVersion); + } + else + { + K::Logger::Logg2(classe, stream, FMT("| K3L API %d.%d.%d [m.VPD %d] - %-38s |") + % apiCfg.MajorVersion % apiCfg.MinorVersion % apiCfg.BuildVersion + % apiCfg.VpdVersionNeeded % apiCfg.StrVersion); + } + } + +#ifndef MOD_KHOMP_VERSION +#define MOD_KHOMP_VERSION "unknown" +#endif + +#ifndef SWITCH_VERSION_FULL +#define SWITCH_VERSION_FULL "unknown" +#endif + + std::string khomp_endpoint_rev(MOD_KHOMP_VERSION); + std::string freeswitch_rev(SWITCH_VERSION_FULL); + + if (concise) + { + K::Logger::Logg2(classe, stream, FMT("%s") % khomp_endpoint_rev); + K::Logger::Logg2(classe, stream, FMT("%s") % freeswitch_rev); + } + else + { + K::Logger::Logg2(classe, stream, FMT("| Khomp Endpoint - %-47s |") % khomp_endpoint_rev); + K::Logger::Logg2(classe, stream, FMT("| FreeSWITCH - %-51s |") % freeswitch_rev); + } + + + for (unsigned int i = 0; i < Globals::k3lapi.device_count(); i++) + { + K3L_DEVICE_CONFIG & devCfg = Globals::k3lapi.device_config(i); + + std::string tipo = Verbose::deviceName((KDeviceType)Globals::k3lapi.device_type(i), devCfg.DeviceModel); + + if (!concise) + K::Logger::Logg2(classe, stream, " ------------------------------------------------------------------"); + + switch (Globals::k3lapi.device_type(i)) + { + /* E1 boards */ + case kdtE1: + case kdtConf: + case kdtPR: + case kdtE1GW: + case kdtE1IP: + case kdtE1Spx: + case kdtGWIP: + case kdtFXS: + case kdtFXSSpx: + case kdtE1FXSSpx: + { + K3L_E1600A_FW_CONFIG dspAcfg; + K3L_E1600B_FW_CONFIG dspBcfg; + + if ((k3lGetDeviceConfig(i, ksoFirmware + kfiE1600A, &dspAcfg, sizeof(dspAcfg)) == ksSuccess) && + (k3lGetDeviceConfig(i, ksoFirmware + kfiE1600B, &dspBcfg, sizeof(dspBcfg)) == ksSuccess)) + { + if (concise) + { + K::Logger::Logg2(classe, stream, FMT("%02u;%s;%d;%d;%d;%s;%s;%02d;%02d;%s;%s;%s;%s") + % i % tipo % atoi(devCfg.SerialNumber) % devCfg.ChannelCount % devCfg.LinkCount + % dspAcfg.DspVersion % dspBcfg.DspVersion % devCfg.PciBus % devCfg.PciSlot + % dspAcfg.FwVersion % dspBcfg.FwVersion + % Verbose::echoCancellerConfig(devCfg.EchoConfig) + % Verbose::echoLocation(devCfg.EchoLocation)); + } + else + { + K::Logger::Logg2(classe, stream, FMT("| [[ %02u ]] %s, serial '%s', %02d channels, %d links.%s|") + % i % tipo % devCfg.SerialNumber % devCfg.ChannelCount % devCfg.LinkCount + % std::string(std::max<int>(0, 22 - tipo.size() - strlen(devCfg.SerialNumber)), ' ')); + K::Logger::Logg2(classe, stream, FMT("| * DSP A: %s, DSP B: %s - PCI bus: %02d, PCI slot: %02d %s|") + % dspAcfg.DspVersion % dspBcfg.DspVersion % devCfg.PciBus % devCfg.PciSlot + % std::string(18 - strlen(dspAcfg.DspVersion) - strlen(dspBcfg.DspVersion), ' ')); + K::Logger::Logg2(classe, stream, FMT("| * %-62s |") % dspAcfg.FwVersion); + K::Logger::Logg2(classe, stream, FMT("| * %-62s |") % dspBcfg.FwVersion); + + K::Logger::Logg2(classe, stream, FMT("| * Echo Canceller: %-20s - Location: %-12s |") + % Verbose::echoCancellerConfig(devCfg.EchoConfig) + % Verbose::echoLocation(devCfg.EchoLocation)); + } + } + + break; + } + + /* analog boards */ + case kdtFXO: + case kdtFXOVoIP: + /* + TODO: This not found + case kdtFX: + case kdtFXVoIP: + */ + { + K3L_FXO80_FW_CONFIG dspCfg; + + if (k3lGetDeviceConfig(i, ksoFirmware + kfiFXO80, &dspCfg, sizeof(dspCfg)) == ksSuccess) + { + if (concise) + { + K::Logger::Logg2(classe, stream, FMT("%02u;%s;%d;%d;%s;%02d;%02d;%s") + % i % tipo % atoi(devCfg.SerialNumber) % devCfg.ChannelCount + % dspCfg.DspVersion % devCfg.PciBus % devCfg.PciSlot + % dspCfg.FwVersion); + } + else + { + K::Logger::Logg2(classe, stream, FMT("| [[ %02u ]] %s, serial '%s', %02d channels. %s|") + % i % tipo % devCfg.SerialNumber % devCfg.ChannelCount + % std::string(std::max<int>(0, 30 - tipo.size() - strlen(devCfg.SerialNumber)), ' ')); + K::Logger::Logg2(classe, stream, FMT("| * DSP: %s - PCI bus: %02d, PCI slot: %02d%s|") + % dspCfg.DspVersion % devCfg.PciBus % devCfg.PciSlot + % std::string(30 - strlen(dspCfg.DspVersion), ' ')); + K::Logger::Logg2(classe, stream, FMT("| * %-63s|") % dspCfg.FwVersion); + } + } + + if (Globals::k3lapi.device_type(i) == kdtFXOVoIP) + { + if (!concise) + { + K::Logger::Logg2(classe, stream, FMT("| * Echo Canceller: %-20s - Location: %-12s |") + % Verbose::echoCancellerConfig(devCfg.EchoConfig) + % Verbose::echoLocation(devCfg.EchoLocation)); + } + } + + break; + } + case kdtGSM: + case kdtGSMSpx: + { + K3L_GSM40_FW_CONFIG dspCfg; + + if (k3lGetDeviceConfig(i, ksoFirmware + kfiGSM40, &dspCfg, sizeof(dspCfg)) == ksSuccess) + { + if (concise) + { + K::Logger::Logg2(classe, stream, FMT("%02d;%s;%d;%d;%s;%02d;%02d;%s") + % i % tipo % atoi(devCfg.SerialNumber) % devCfg.ChannelCount + % dspCfg.DspVersion % devCfg.PciBus % devCfg.PciSlot + % dspCfg.FwVersion); + } + else + { + K::Logger::Logg2(classe, stream, FMT("| [[ %02d ]] %s, serial '%s', %02d channels. %s|") + % i % tipo % devCfg.SerialNumber % devCfg.ChannelCount + % std::string(std::max<int>(0, 30 - tipo.size() - strlen(devCfg.SerialNumber)), ' ')); + + K::Logger::Logg2(classe, stream, FMT("| * DSP: %s - PCI bus: %02d, PCI slot: %02d%s|") + % dspCfg.DspVersion % devCfg.PciBus % devCfg.PciSlot + % std::string(std::max<int>(30 - strlen(dspCfg.DspVersion), 0), ' ')); + + K::Logger::Logg2(classe, stream, FMT("| * %-62s |") % dspCfg.FwVersion); + } + } + + break; + } + case kdtGSMUSB: + case kdtGSMUSBSpx: + { + K3L_GSMUSB_FW_CONFIG dspCfg; + + if (k3lGetDeviceConfig(i, ksoFirmware + kfiGSMUSB, &dspCfg, sizeof(dspCfg)) == ksSuccess) + { + if (concise) + { + K::Logger::Logg2(classe, stream, FMT("%02d;%s;%d;%d;%s;%02d;%02d;%s") + % i % tipo % atoi(devCfg.SerialNumber) % devCfg.ChannelCount + % dspCfg.DspVersion % devCfg.PciBus % devCfg.PciSlot + % dspCfg.FwVersion); + } + else + { + K::Logger::Logg2(classe, stream, FMT("| [[ %02d ]] %s, serial '%s', %02d channels. %s|") + % i % tipo % devCfg.SerialNumber % devCfg.ChannelCount + % std::string(std::max<int>(0, 30 - tipo.size() - strlen(devCfg.SerialNumber)), ' ')); + + int size = strlen(dspCfg.DspVersion) + strlen(dspCfg.FwVersion); + + K::Logger::Logg2(classe, stream, FMT("| * DSP: %s - %s%s|") + % dspCfg.DspVersion % dspCfg.FwVersion + % std::string(std::max<int>(55 - size, 0), ' ')); + } + } + + break; + } + + default: + K::Logger::Logg2(classe, stream, FMT("| [[ %02d ]] Unknown type '%02d'! Please contact Khomp support for help! |") + % i % Globals::k3lapi.device_type(i)); + break; + } + } + + if (!concise) + K::Logger::Logg2(classe,stream, " ------------------------------------------------------------------"); + + return true; +} + +/* support function for _KhompShowCalls */ +void Cli::_KhompShowCalls::showCalls(unsigned int d, unsigned int o, std::string &buffer) +{ + buffer += STR(FMT("| %d,%02d | unused | %11s | %-36s |\n") + % d + % o + % Globals::k3lutil.callStatus(d,o) + % Globals::k3lutil.channelStatus(d,o)); +} + +bool Cli::_KhompShowCalls::execute(int argc, char *argv[]) +{ + if(argc > 4) + { + printUsage(stream); + return false; + } + + int device = argv[2] ? atoi(argv[2]) : -1; + int object = argv[3] ? atoi(argv[3]) : -1; + + int d = -1; + int o = -1; + + if (device != -1) + { + d = device; + + if (!Globals::k3lapi.valid_device(d)) + { + K::Logger::Logg2(C_CLI, stream, FMT("ERROR: No such device %d!") % d); + return false; + } + } + + if (object != -1) + { + o = object; + + if (!Globals::k3lapi.valid_channel(d,o)) + { + K::Logger::Logg2(C_CLI, stream, FMT("ERROR: No such chanel %d for device %d!") % o % d); + return false; + } + } + + /* keep the channels reponse */ + std::string buffer(""); + + try + { + /**/ if (d != -1 && o != -1) + { + showCalls(d,o,buffer); + } + else if (d != -1 && o == -1) + { + for (unsigned int i = 0; i < Globals::k3lapi.channel_count(d); i++) + { + buffer += " ------------------------------------------------------------------------\n"; + showCalls(d,i,buffer); + } + } + else if (d == -1 && o == -1) + { + for (unsigned int i = 0; i < Globals::k3lapi.device_count(); i++) + { + buffer += " ------------------------------------------------------------------------\n"; + for (unsigned int j = 0; j < Globals::k3lapi.channel_count(i); j++) + { + showCalls(i,j,buffer); + } + } + } + } + catch(K3LAPI::invalid_channel & err) + { + K::Logger::Logg2(C_CLI, stream, "ERROR: No such chanel"); + return false; + } + + //TODO: The information shown here, must be reviewed cuz is the same of show channels + K::Logger::Logg2(C_CLI, stream, " ------------------------------------------------------------------------"); + K::Logger::Logg2(C_CLI, stream, "|------------------------------- Khomp Calls ----------------------------|"); + K::Logger::Logg2(C_CLI, stream, " ------------------------------------------------------------------------ "); + K::Logger::Logg2(C_CLI, stream, "| hw | freeSWITCH | khomp call | khomp channel |"); + K::Logger::Logg2(C_CLI, stream, "| id | status | status | status |"); + K::Logger::Logg2(C_CLI, stream, "%s", (char*) buffer.c_str()); + K::Logger::Logg2(C_CLI, stream, " ------------------------------------------------------------------------"); + + return true; +} + +bool Cli::_KhompChannelsDisconnect::forceDisconnect(unsigned int device, unsigned int channel) +{ + bool ret = false; + Board::KhompPvt *pvt = NULL; + + try + { + pvt = Board::get(device,channel); + ScopedPvtLock lock(pvt); + + ret = pvt->command(KHOMP_LOG,CM_DISCONNECT); + DBG(FUNC,PVT_FMT(pvt->target(),"Command CM_DISCONNECT sent!")); + } + catch (K3LAPI::invalid_channel & err) + { + K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Unable to find channel %d on device %d!") % err.channel % err.device ); + } + catch (ScopedLockFailed & err) + { + K::Logger::Logg2(C_CLI,stream,FMT("error: channel %d at device %d could not be locked: %s!") + % channel + % device + % err._msg.c_str()); + } + + return ret; +} + +bool Cli::_KhompChannelsDisconnect::execute(int argc, char *argv[]) +{ + if (argc < 3 || argc > 4) + { + printUsage(stream); + return false; + } + + switch (argc) + { + case 3: + { + if (!ARG_CMP(2, "all")) + { + K::Logger::Logg2(C_CLI, stream, "usage: khomp channels disconnect < all | <boardid> < all | <channelid> > >"); + return false; + } + + K::Logger::Logg2(C_CLI, stream, "NOTICE: Disconnecting all channels on all boards!"); + + for (unsigned int dev = 0; dev < Globals::k3lapi.device_count(); dev++) + { + for (unsigned int chan = 0; chan < Globals::k3lapi.channel_count(dev); chan++) + forceDisconnect(dev,chan); + } + break; + } + case 4: + { + unsigned int dev = atoi(argv[2]); + + if (ARG_CMP(3, "all")) + { + K::Logger::Logg2(C_CLI, stream, FMT("NOTICE: Disconnecting all channels on board %d!") % dev); + + for (unsigned int chan = 0; chan < Globals::k3lapi.channel_count(dev); chan++) + forceDisconnect(dev,chan); + } + + unsigned int channel = atoi(argv[3]); + + if (dev >= Globals::k3lapi.device_count()) + { + K::Logger::Logg2(C_CLI, stream, FMT("ERROR: No such device: %d!") % dev); + return false; + } + + + K::Logger::Logg2(C_CLI, stream, FMT("NOTICE: Disconnecting channel %d on board %d!") % channel % dev); + + forceDisconnect(dev,channel); + break; + } + + default: + break; + } + + return true; +} + +bool Cli::_KhompChannelsUnblock::execute(int argc, char *argv[]) +{ + if (argc != 4 && argc != 3) + { + printUsage(stream); + return false; + } + + switch (argc) + { + case 3: + { + K::Logger::Logg2(C_CLI, stream, "NOTICE: Unblocking all channels on all devices!"); + for (unsigned int dev = 0; dev < Globals::k3lapi.device_count(); dev++) + { + for (unsigned int chan = 0; chan < Globals::k3lapi.channel_count(dev); chan++) + { + try + { + Globals::k3lapi.command(dev,chan,CM_UNLOCK_INCOMING); + Globals::k3lapi.command(dev,chan,CM_UNLOCK_OUTGOING); + } + catch(K3LAPI::failed_command &e) + { + if (K::Logger::Logg.classe(C_WARNING).enabled()) + { + LOG(WARNING, FMT("Command '%s' has failed with error '%s'.") + % Verbose::commandName(e.code) % Verbose::status((KLibraryStatus)e.rc)); + } + + return false; + } + } + } + break; + } + case 4: + { + int dev = atoi (argv[2]); + + if ( !SAFE_strcasecmp(argv[3], "all") ) + { + if (!Globals::k3lapi.valid_device( dev )) + { + K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Unable to find device: %d!") % dev ); + return false; + } + + K::Logger::Logg2(C_CLI, stream, FMT("NOTICE: Unblocking all channels on device %d!") % dev); + + for (unsigned int i = 0; i < Globals::k3lapi.channel_count(dev); i++) + { + try + { + Globals::k3lapi.command(dev,i,CM_UNLOCK_INCOMING); + Globals::k3lapi.command(dev,i,CM_UNLOCK_OUTGOING); + } + catch(K3LAPI::failed_command &e) + { + if (K::Logger::Logg.classe(C_WARNING).enabled()) + { + LOG(WARNING, FMT("Command '%s' has failed with error '%s'.") + % Verbose::commandName(e.code) % Verbose::status((KLibraryStatus)e.rc)); + } + + return false; + } + } + } + else + { + int obj = atoi (argv[3]); + + if (!Globals::k3lapi.valid_channel(dev, obj)) + { + K::Logger::Logg2(C_CLI, stream, FMT("ERROR: No such channel %d at device %d!") % obj % dev); + return false; + } + + K::Logger::Logg2(C_CLI, stream, FMT("NOTICE: Unblocking channel %d on device %d!") % obj % dev); + + try + { + Globals::k3lapi.command(dev,obj,CM_UNLOCK_INCOMING); + Globals::k3lapi.command(dev,obj,CM_UNLOCK_OUTGOING); + } + catch(K3LAPI::failed_command &e) + { + if (K::Logger::Logg.classe(C_WARNING).enabled()) + { + LOG(WARNING, FMT("Command '%s' has failed with error '%s'.") + % Verbose::commandName(e.code) % Verbose::status((KLibraryStatus)e.rc)); + } + + return false; + } + } + break; + } + default: + break; + } + + return true; +} + +void Cli::_KhompShowStatistics::cliStatistics(unsigned int device) +{ + for (unsigned int channel = 0; channel < Globals::k3lapi.channel_count(device); channel++) + { + try + { + Board::KhompPvt *pvt = Board::get(device, channel); + K::Logger::Logg2(C_CLI,stream,pvt->getStatistics(Statistics::ROW).c_str()); + } + catch (K3LAPI::invalid_channel & err) + { + K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Unable to find channel %d on device %d!") % err.channel % err.device ); + } + } +} + +void Cli::_KhompShowStatistics::cliDetailedStatistics(unsigned int device, unsigned int channel) +{ + try + { + Board::KhompPvt *pvt = Board::get(device, channel); + K::Logger::Logg2(C_CLI,stream,"----------------------------------------------"); + K::Logger::Logg2(C_CLI,stream,FMT("Detailed statistics of: Device %02d - Channel %02d") % pvt->target().device % pvt->target().object); + K::Logger::Logg2(C_CLI,stream,pvt->getStatistics(Statistics::DETAILED).c_str()); + K::Logger::Logg2(C_CLI,stream,"----------------------------------------------"); + } + catch (K3LAPI::invalid_channel & err) + { + K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Unable to find channel %d on device %d!") % err.channel % err.device ); + } +} + +bool Cli::_KhompShowStatistics::execute(int argc, char *argv[]) +{ + if (argc < 2 || argc > 5) + { + printUsage(stream); + return false; + } + unsigned int dev = UINT_MAX; + unsigned int obj = UINT_MAX; + int detailed = 0, verbose = 0; + + detailed = ((argc > 2) && (!strcasecmp(argv[2], "detailed")) ? 1 : 0 ); + verbose = ((argc > 2) && (!strcasecmp(argv[2], "verbose")) ? 1 : 0 ); + + try + { + + if(argc > (2+detailed+verbose)) + { + dev = Strings::tolong(argv[2+detailed+verbose]); + if (!Globals::k3lapi.valid_device(dev)) + { + K::Logger::Logg2(C_CLI, stream, "ERROR: No such device!"); + return false; + } + } + + if (argc > (3+detailed+verbose)) + { + std::string object(argv[3+detailed+verbose]); + obj = Strings::tolong(object); + + if (!Globals::k3lapi.valid_channel(dev, obj)) + { + K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Unable to find channel %d on device %d!") % obj % dev ); + return false; + } + } + } + catch (Strings::invalid_value e) + { + K::Logger::Logg2(C_CLI, stream, "ERROR: Invalid numeric value!"); + return false; + } + + std::string header; + header.append( " ------------------------------------------------------------------------------------\n"); + header.append( "|----------------------------- Khomp Endpoint Statistics ----------------------------|\n"); + header.append( "|------------------------------------------------------------------------------------|\n"); + header.append( "| hw | total calls | channel | FreeSWITCH | channel | status |\n"); + header.append( "| id | incoming | outgoing | failed | fails | status | state | time |\n"); + header.append( " ------------------------------------------------------------------------------------"); + std::string footer; + footer.append( " ------------------------------------------------------------------------------------"); + + try + { + if (obj != UINT_MAX) + { + if(detailed != 0) + { + cliDetailedStatistics (dev, obj); + } + else + { + K::Logger::Logg2(C_CLI,stream,header.c_str()); + Board::KhompPvt *pvt = Board::get(dev, obj); + K::Logger::Logg2(C_CLI,stream,pvt->getStatistics(Statistics::ROW).c_str()); + K::Logger::Logg2(C_CLI,stream,footer.c_str()); + } + } + else + { + if(detailed != 0) + { + printUsage(stream); + return false; + } + + K::Logger::Logg2(C_CLI,stream,header.c_str()); + + if (dev == UINT_MAX) + { + for (dev = 0; dev < Globals::k3lapi.device_count(); dev++) + cliStatistics (dev); + } + else + { + cliStatistics (dev); + } + + K::Logger::Logg2(C_CLI,stream,footer.c_str()); + } + } + catch(K3LAPI::invalid_channel &e) + { + K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Unable to find channel %d on device %d!") % obj % dev ); + } + + return true; +} + +void Cli::_KhompShowChannels::showChannel(unsigned int device, bool concise, unsigned int channel) +{ + try + { + + Board::KhompPvt *pvt = Board::get(device, channel); + + DBG(FUNC, PVT_FMT(pvt->target(), "found channel..")); + + /* skip inactive channels */ + if (pvt->getSignaling() == ksigInactive) + return; + + DBG(FUNC, PVT_FMT(pvt->target(), "is valid..")); + + /* make sure the states wont start 'dancing' at random.. */ + ScopedPvtLock lock(pvt); + + std::string tmp_call = Globals::k3lutil.callStatus( + pvt->target().device, + pvt->target().object, + (concise ? Verbose::EXACT : Verbose::HUMAN)); + + std::string tmp_chan = Globals::k3lutil.channelStatus( + pvt->target().device, + pvt->target().object, + (concise ? Verbose::EXACT : Verbose::HUMAN)); + + if (concise) + { + std::string state = pvt->getStateString(); + + if (pvt->getSignaling() == ksigGSM) + { + K3L_GSM_CHANNEL_STATUS gsmStatus; + + if (k3lGetDeviceStatus(device, channel + ksoGsmChannel, &gsmStatus, sizeof(gsmStatus)) != ksSuccess) + return; + + const unsigned int sign_numb = (gsmStatus.SignalStrength != 255 ? gsmStatus.SignalStrength : 0); + + std::string gsm_registry = (strlen(gsmStatus.OperName) != 0 ? gsmStatus.OperName : "<none>"); + + K::Logger::Logg2(C_CLI, stream, FMT("B%02dC%02d:%s:%s:%s:%d%%:%s") + % device % channel % state % tmp_call % tmp_chan + % sign_numb % gsm_registry); + } + else + { + K::Logger::Logg2(C_CLI, stream, FMT("B%02dC%02d:%s:%s:%s") + % device % channel % state % tmp_call % tmp_chan); + } + } + else + { + if (pvt->getSignaling() == ksigGSM) + { + K3L_GSM_CHANNEL_STATUS gsmStatus; + + if (k3lGetDeviceStatus(device, channel + ksoGsmChannel, &gsmStatus, sizeof(gsmStatus)) != ksSuccess) + return; + + const unsigned int sign_numb = (gsmStatus.SignalStrength != 255 ? gsmStatus.SignalStrength : 0); + + const unsigned int full_size = 10; + const unsigned int sign_size = std::min((sign_numb * full_size) / 100, full_size); + + std::string tmp_antenna_level; + + for (unsigned int i = 0; i < sign_size; i++) + tmp_antenna_level += '*'; + + for (unsigned int i = sign_size; i < full_size; i++) + tmp_antenna_level += ' '; + + tmp_chan += " ("; + tmp_chan += (strlen(gsmStatus.OperName) != 0 ? gsmStatus.OperName : "..."); + tmp_chan += ")"; + + K::Logger::Logg2(C_CLI, stream, FMT("| %d,%02d | %8s | %8s | %-23s | %02d%% |%s|") + % device % channel % pvt->getStateString() % tmp_call % tmp_chan + % sign_numb % tmp_antenna_level); + } + else + { + K::Logger::Logg2(C_CLI, stream, FMT("| %d,%02d | %8s | %8s | %-40s |") + % device % channel % pvt->getStateString() % tmp_call % tmp_chan); + } + } + } + catch (K3LAPI::invalid_channel & err) + { + K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Unable to find channel %d on device %d!") % err.channel % err.device ); + } + catch (...) + { + K::Logger::Logg2(C_CLI, stream, "ERROR: Unexpected error..., skipping"); + } +} + +void Cli::_KhompShowChannels::showChannels(unsigned int device, bool concise) +{ + for (unsigned int channel = 0; channel < Globals::k3lapi.channel_count(device); channel++) + { + showChannel(device, concise, channel); + } +} + +bool Cli::_KhompShowChannels::execute(int argc, char *argv[]) +{ + unsigned int dev = UINT_MAX; + int concise = 0, verbose = 0; + + bool onlyShowOneChannel = false; + unsigned int channelToShow = 0; + + if (argc > 5) + { + Cli::KhompShowChannels.printUsage(stream); + return false; + } + + concise = ( ((argc == 3) || (argc == 4) || (argc == 5) ) && (ARG_CMP(2, "concise")) ? 1 : 0 ); + verbose = ( ((argc == 3) || (argc == 4) || (argc == 5) ) && (ARG_CMP(2, "verbose")) ? 1 : 0 ); + + if (argc >= (3 + concise + verbose)) + { + dev = atoi (argv[2 + concise + verbose]); + + if (!Globals::k3lapi.valid_device(dev)) + { + K::Logger::Logg2(C_CLI, stream, "ERROR: no such device!"); + return false; + } + + if (argc == ( 4 + concise + verbose )) + { + onlyShowOneChannel = true; + channelToShow = atoi (argv[3 + concise + verbose]); + } + } + + if (concise == 0) + { + K::Logger::Logg2(C_CLI, stream, " -----------------------------------------------------------------------"); + K::Logger::Logg2(C_CLI, stream, "|-------------------- Khomp Channels and Connections -------------------|"); + K::Logger::Logg2(C_CLI, stream, "|-----------------------------------------------------------------------|"); + K::Logger::Logg2(C_CLI, stream, "| hw |freeSWITCH| call | channel |"); + K::Logger::Logg2(C_CLI, stream, "| id | status | status | status |"); + K::Logger::Logg2(C_CLI, stream, " -----------------------------------------------------------------------"); + } + + if ( onlyShowOneChannel ) + { + if ( channelToShow < Globals::k3lapi.channel_count(dev) ) + { + showChannel (dev,(concise == 0 ? false : true), channelToShow); + } + else + { + K::Logger::Logg2(C_CLI, stream, "ERROR: no such channel!"); + } + } + else if (dev == UINT_MAX) + { + for (dev = 0; dev < Globals::k3lapi.device_count(); dev++) + { + showChannels(dev, (concise == 0 ? false : true)); + } + } + else + { + showChannels ( dev, (concise == 0 ? false : true)); + } + + if (concise == 0) + K::Logger::Logg2(C_CLI, stream, " -----------------------------------------------------------------------"); + + return true; +} + +void Cli::_KhompShowLinks::showLinks(unsigned int device, bool concise) +{ + if (!concise) + K::Logger::Logg2(C_CLI, stream, "|------------------------------------------------------------------------|"); + + switch (Globals::k3lutil.physicalLinkCount(device, true)) + { + case 1: + { + std::string str_link0 = Globals::k3lutil.getLinkStatus(device, 0, (concise ? Verbose::EXACT : Verbose::HUMAN)); + + if (concise) + K::Logger::Logg2(C_MESSAGE, stream, FMT("B%02dL00:%s") % device % str_link0); + else + K::Logger::Logg2(C_CLI, stream, FMT("| Link '0' on board '%d': %-47s |") % device % str_link0); + break; + } + + case 2: + { + std::string str_link0 = Globals::k3lutil.getLinkStatus(device, 0, (concise ? Verbose::EXACT : Verbose::HUMAN)); + std::string str_link1 = Globals::k3lutil.getLinkStatus(device, 1, (concise ? Verbose::EXACT : Verbose::HUMAN)); + + if (concise) + { + K::Logger::Logg2(C_MESSAGE, stream, FMT("B%02dL00:%s") % device % str_link0); + K::Logger::Logg2(C_MESSAGE, stream, FMT("B%02dL01:%s") % device % str_link1); + } + else + { + K::Logger::Logg2(C_CLI, stream, FMT("|------ Link '0' on board '%d' ------||------ Link '1' on board '%d' ------|") + % device % device); + + K::Logger::Logg2(C_CLI, stream, FMT("| %-33s || %-33s |") % str_link0 % str_link1); + } + + break; + } + default: + { + if (concise) + K::Logger::Logg2(C_MESSAGE, stream, FMT("B%02dLXX:NoLinksAvailable") % device); + else + K::Logger::Logg2(C_CLI, stream, FMT("| Board '%d': %-59s |") % device % "No links available."); + break; + } + } + +} + +void Cli::_KhompShowLinks::showErrors(unsigned int device, bool concise) +{ + + if (!concise) + K::Logger::Logg2(C_CLI, stream, "|-----------------------------------------------------------------------|"); + + switch (Globals::k3lutil.physicalLinkCount(device, true)) + { + case 2: + { + K3LUtil::ErrorCountType link0 = Globals::k3lutil.linkErrorCount( + device, 0, (concise ? Verbose::EXACT : Verbose::HUMAN)); + K3LUtil::ErrorCountType link1 = Globals::k3lutil.linkErrorCount( + device, 1, (concise ? Verbose::EXACT : Verbose::HUMAN)); + + if (concise) + { + for (K3LUtil::ErrorCountType::iterator i = link0.begin(); i != link0.end(); i++) + K::Logger::Logg2(C_CLI, stream, FMT("%d:0:%s:%d") % device % i->first % i->second); + + for (K3LUtil::ErrorCountType::iterator i = link1.begin(); i != link1.end(); i++) + K::Logger::Logg2(C_CLI, stream, FMT("%d:1:%s:%d") % device % i->first % i->second); + } + else + { + K::Logger::Logg2(C_CLI, stream, FMT("|----- Link '0' on board '%d' ------| |----- Link '1' on board '%d' ------|") % device % device); + K::Logger::Logg2(C_CLI, stream, "|----------------------------------| |----------------------------------|"); + K::Logger::Logg2(C_CLI, stream, "| Error type | Number | | Error type | Number |"); + K::Logger::Logg2(C_CLI, stream, "|----------------------------------| |----------------------------------|"); + + K3LUtil::ErrorCountType::iterator i = link0.begin(); + K3LUtil::ErrorCountType::iterator j = link1.begin(); + + for (; i != link0.end() && j != link1.end(); i++, j++) + { + K::Logger::Logg2(C_CLI, stream, FMT("| %22s | %-7d | | %22s | %-7d |") + % i->first % i->second % j->first % j->second); + } + } + + break; + } + + case 1: + { + K3LUtil::ErrorCountType link0 = Globals::k3lutil.linkErrorCount(device, 0, (concise ? Verbose::EXACT : Verbose::HUMAN)); + + if (concise) + { + for (K3LUtil::ErrorCountType::iterator i = link0.begin(); i != link0.end(); i++) + K::Logger::Logg2(C_CLI, stream, FMT("%d:0:%s:%d") % device % i->first % i->second); + } + else + { + K::Logger::Logg2(C_CLI, stream, FMT("|------------------------ Link '0' on board '%d' ------------------------|") % device); + K::Logger::Logg2(C_CLI, stream, "|-----------------------------------------------------------------------|"); + K::Logger::Logg2(C_CLI, stream, "| Error type | Number |"); + K::Logger::Logg2(C_CLI, stream, "|-----------------------------------------------------------------------|"); + + for (K3LUtil::ErrorCountType::iterator i = link0.begin(); i != link0.end(); i++) + K::Logger::Logg2(C_CLI, stream, FMT("| %52s | %-14d |") % i->first % i->second); + } + + break; + } + + case 0: + { + if (!concise) + K::Logger::Logg2(C_CLI, stream, FMT("| No links detected on board %d! |") % device); + + break; + } + } +} + +bool Cli::_KhompShowLinks::execute(int argc, char *argv[]) +{ + if(argc < 2 || argc > 5) + { + printUsage(stream); + return false; + } + + unsigned int dev = UINT_MAX; + int concise = 0, verbose = 0, errors = 0; + + errors = ( (argc > 2) && (!strcasecmp(argv[2],"errors")) ? 1 : 0 ); + + concise = ( (argc > (2+errors)) && (!strcasecmp(argv[(2+errors)],"concise")) ? 1 : 0 ); + verbose = ( (argc > (2+errors)) && (!strcasecmp(argv[(2+errors)],"verbose")) ? 1 : 0 ); + + if(argc > (2+errors+concise+verbose)) + { + dev = atoi(argv[(2+errors+concise+verbose)]); + + if (!Globals::k3lapi.valid_device(dev)) + { + K::Logger::Logg2(C_CLI, stream, "ERROR: no such device!"); + return false; + } + } + + if (!concise) + { + K::Logger::Logg2(C_CLI, stream, " ------------------------------------------------------------------------"); + if(!errors) + { + K::Logger::Logg2(C_CLI, stream, "|--------------------------- Khomp Links List ---------------------------|"); + } + else + { + K::Logger::Logg2(C_CLI, stream, "|-------------------- Khomp Errors Counters on Links -------------------|"); + } + } + + if (dev == UINT_MAX) + { + for (dev = 0; dev < Globals::k3lapi.device_count(); dev++) + { + if(!errors) + { + showLinks (dev, (concise == 1)); + } + else + { + showErrors(dev, (concise == 1)); + } + } + } + else + { + if(!errors) + { + showLinks (dev, (concise == 1)); + } + else + { + showErrors(dev, (concise == 1)); + } + } + + if (!concise) + { + K::Logger::Logg2(C_CLI, stream, " ------------------------------------------------------------------------"); + } + + return true; +} + +void Cli::_KhompClearLinks::clearLink(unsigned int device, unsigned int link) +{ + try + { + Globals::k3lapi.command(device, link, CM_CLEAR_LINK_ERROR_COUNTER); + } + catch(K3LAPI::failed_command & e) + { + K::Logger::Logg2(C_CLI, stream, + FMT("ERROR: Command has failed with error '%s'") + % Verbose::status((KLibraryStatus)e.rc).c_str()); + } +} + +bool Cli::_KhompClearLinks::execute(int argc, char *argv[]) +{ + if(argc < 2 || argc > 4) + { + printUsage(stream); + return false; + } + + unsigned int dev = UINT_MAX; + unsigned int obj = UINT_MAX; + + if(argc > 2) + { + dev = atoi(argv[2]); + + if (!Globals::k3lapi.valid_device(dev)) + { + K::Logger::Logg2(C_CLI, stream, + FMT("ERROR: no such device %d!") % dev); + return false; + } + + if(argc > 3) + { + obj = atoi(argv[3]); + + if(!Globals::k3lapi.valid_link(dev, obj)) + { + K::Logger::Logg2(C_CLI, stream, + FMT("ERROR: No such link %d on device %d!") % obj % dev); + return false; + } + } + } + + if(dev == UINT_MAX) + { + K::Logger::Logg2(C_CLI, stream, + "NOTICE: Reseting error count of all links..."); + + for (unsigned int d = 0; d < Globals::k3lapi.device_count(); d++) + { + unsigned int link_count = Globals::k3lutil.physicalLinkCount(d, true); + + for (unsigned int o = 0; o < link_count; o++) + clearLink(d, o); + } + } + else + { + if (obj == UINT_MAX) + { + K::Logger::Logg2(C_CLI, stream, + FMT("NOTICE: Reseting error count of all links on device %d...") + % dev); + unsigned int link_count = Globals::k3lutil.physicalLinkCount(dev, true); + + for (unsigned int o = 0; o < link_count; o++) + clearLink(dev, o); + } + else + { + K::Logger::Logg2(C_CLI, stream, + FMT("NOTICE: Reseting error count of link %d on device %d...") + % obj % dev); + + clearLink(dev, obj); + } + } + + return true; +} + +bool Cli::_KhompClearStatistics::execute(int argc, char *argv[]) +{ + if(argc < 2 || argc > 4) + { + printUsage(stream); + return false; + } + + try + { + + unsigned int dev = UINT_MAX; + unsigned int obj = UINT_MAX; + + if(argc > 2) + { + dev = atoi(argv[2]); + + if (!Globals::k3lapi.valid_device(dev)) + { + K::Logger::Logg2(C_CLI, stream, + FMT("ERROR: no such device %d!") % dev); + return false; + } + + if(argc > 3) + { + obj = atoi(argv[3]); + + + if(!Globals::k3lapi.valid_channel(dev, obj)) + { + K::Logger::Logg2(C_CLI, stream, + FMT("ERROR: No such channel %d on device %d!") % obj % dev); + return false; + } + } + } + + if(dev == UINT_MAX) + { + K::Logger::Logg2(C_CLI, stream, "NOTICE: Reseting statistics of all channels..."); + + for (unsigned int d = 0; d < Globals::k3lapi.device_count(); d++) + { + for (unsigned int o = 0; o < Globals::k3lapi.channel_count(d); o++) + Board::get(d, o)->clearStatistics(); + } + } + else + { + if (obj == UINT_MAX) + { + K::Logger::Logg2(C_CLI, stream, FMT("NOTICE: Reseting statistics of all channels from board %d...") % dev); + + for (unsigned int o = 0; o < Globals::k3lapi.channel_count(dev); o++) + Board::get(dev, o)->clearStatistics(); + } + else + { + K::Logger::Logg2(C_CLI, stream, FMT("NOTICE: Reseting statistics of channel %d from board %d") % obj % dev); + Board::get(dev, obj)->clearStatistics(); + } + } + + } + catch (K3LAPI::invalid_channel & err) + { + K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Unable to find channel %d on device %d!") % err.channel % err.device ); + return false; + } + + return true; +} + +void Cli::_KhompResetLinks::resetLink(unsigned int device, unsigned int link) +{ + try + { + Globals::k3lapi.command(device, link, CM_RESET_LINK); + } + catch(K3LAPI::failed_command & e) + { + K::Logger::Logg2(C_CLI, stream, + FMT("ERROR: Command has failed with error '%s'") + % Verbose::status((KLibraryStatus)e.rc).c_str()); + } +} + +bool Cli::_KhompResetLinks::execute(int argc, char *argv[]) +{ + if(argc < 2 || argc > 4) + { + printUsage(stream); + return false; + } + + unsigned int dev = UINT_MAX; + unsigned int obj = UINT_MAX; + + if(argc > 2) + { + dev = atoi(argv[2]); + + if (!Globals::k3lapi.valid_device(dev)) + { + K::Logger::Logg2(C_CLI, stream, + FMT("ERROR: no such device %d!") % dev); + return false; + } + + if(argc > 3) + { + obj = atoi(argv[3]); + + if(!Globals::k3lapi.valid_link(dev, obj)) + { + K::Logger::Logg2(C_CLI, stream, + FMT("ERROR: No such link %d on device %d!") % obj % dev); + return false; + } + } + } + + if(dev == UINT_MAX) + { + K::Logger::Logg2(C_CLI, stream, + "NOTICE: Reseting all links..."); + + for (unsigned int d = 0; d < Globals::k3lapi.device_count(); d++) + { + unsigned int link_count = Globals::k3lutil.physicalLinkCount(d, true); + + for (unsigned int o = 0; o < link_count; o++) + resetLink(d, o); + } + } + else + { + if (obj == UINT_MAX) + { + K::Logger::Logg2(C_CLI, stream, + FMT("NOTICE: Reseting all links on device %d...") + % dev); + unsigned int link_count = Globals::k3lutil.physicalLinkCount(dev, true); + + for (unsigned int o = 0; o < link_count; o++) + resetLink(dev, o); + } + else + { + K::Logger::Logg2(C_CLI, stream, + FMT("NOTICE: Reseting link %d on device %d...") + % obj % dev); + + resetLink(dev, obj); + } + } + + return true; +} + +bool Cli::_KhompSMS::execute(int argc, char *argv[]) +{ + if(argc < 4) + { + printUsage(stream); + return false; + } + + std::string devs(argv[1]); + std::string numb(argv[2]); + std::string mesg(argv[3]); + + for (unsigned int i = 4; i < (unsigned int)argc; i++) + { + mesg += " "; + mesg += argv[i]; + } + + Board::KhompPvt * pvt = NULL; + + bool enable_retry = false; + + size_t pos = numb.find('r'); + if (pos != std::string::npos) + { + numb.erase(pos,1); + enable_retry = true; + } + + std::string begin; + + if(devs[0] != 'b' && devs[0] != 'B') + { + begin = "b"; + } + + std::string complete = begin + devs + "/" + numb + "/" + mesg; + int cause; + + try + { + for (unsigned int ntry = 0; ntry < 15; ++ntry) + { + ScopedAllocLock alloc_lock; + + pvt = processSMSString(complete.c_str(), &cause); + + /* NOTE: go directly to the pvt check below! */ + if (!enable_retry || pvt) + break; + + alloc_lock.unlock(); + + K::Logger::Logg2(C_CLI, stream, FMT("WARNING: '%s': No available channel, trying again...") % devs); + usleep(2500000); + } + + if (!pvt) + { + K::Logger::Logg2(C_CLI, stream, FMT("ERROR: '%s': No available channel %s") % devs % (enable_retry ? "after 15 retries, giving up!" : "")); + return false; + } + + ScopedPvtLock lock(pvt); + + if(!pvt->application(SMS_SEND, NULL, complete.c_str())) + { + K::Logger::Logg2(C_CLI, stream, "ERROR: Message could not be sent"); + return false; + } + + } + catch(ScopedLockFailed & err) + { + if(err._fail == ScopedLockFailed::ALLOC_FAILED) + { + K::Logger::Logg2(C_CLI, stream, "ERROR: unable to global alloc lock"); + } + else + { + K::Logger::Logg2(C_CLI, stream, FMT("ERROR: unable to lock: %s!") % err._msg.c_str()); + } + return false; + } + + K::Logger::Logg2(C_CLI, stream, "Message sent successfully!"); + + return true; +} + +bool Cli::_KhompLogConsole::execute(int argc, char *argv[]) +{ + if (argc < 3) + { + printUsage(stream); + return false; + } + + bool invert = false; + bool unique = false; + + std::string extra(argv[2]); + + unsigned int total_args = argc - 2; /* remove "khomp log console" */ + + if (extra == "no") + { + invert = true; + --total_args; + } + else if (extra == "just") + { + unique = true; + --total_args; + } + + unsigned int first_args = argc - total_args; + + std::string options; + + for (unsigned int i = first_args; i < (unsigned int)argc; i++) + { + options += argv[i]; + options += ","; + } + + K::Logger::processLogConsole(stream, options, invert, unique); + return true; +} + +bool Cli::_KhompLogDisk::execute(int argc, char *argv[]) +{ + if (argc < 3) + { + printUsage(stream); + return false; + } + + bool invert = false; + bool unique = false; + + std::string extra(argv[2]); + + unsigned int total_args = argc - 2; /* remove "khomp log disk" */ + + if (extra == "no") + { + invert = true; + --total_args; + } + else if (extra == "just") + { + unique = true; + --total_args; + } + + unsigned int first_args = argc - total_args; + + std::string options; + + for (unsigned int i = first_args; i < (unsigned int)argc; i++) + { + options += argv[i]; + options += ","; + } + + K::Logger::processLogDisk(stream, options, invert, unique); + return true; +} + +bool Cli::_KhompLogStatus::execute(int argc, char *argv[]) +{ + if(argc != 2) + { + printUsage(stream); + return false; + } + + Strings::Merger m1; + + bool flag1_errors = K::Logger::Logg.classe(C_ERROR).get(O_CONSOLE, K::LogManager::Option::ENABLED); + bool flag1_warnings = K::Logger::Logg.classe(C_WARNING).get(O_CONSOLE, K::LogManager::Option::ENABLED); + bool flag1_messages = K::Logger::Logg.classe(C_MESSAGE).get(O_CONSOLE, K::LogManager::Option::ENABLED); + bool flag1_events = K::Logger::Logg.classe(C_EVENT).get(O_CONSOLE, K::LogManager::Option::ENABLED); + bool flag1_commands = K::Logger::Logg.classe(C_COMMAND).get(O_CONSOLE, K::LogManager::Option::ENABLED); + bool flag1_audio = K::Logger::Logg.classe(C_AUDIO_EV).get(O_CONSOLE, K::LogManager::Option::ENABLED); + bool flag1_modem = K::Logger::Logg.classe(C_MODEM_EV).get(O_CONSOLE, K::LogManager::Option::ENABLED); + bool flag1_links = K::Logger::Logg.classe(C_LINK_STT).get(O_CONSOLE, K::LogManager::Option::ENABLED); + bool flag1_cas = K::Logger::Logg.classe(C_CAS_MSGS).get(O_CONSOLE, K::LogManager::Option::ENABLED); + + if (flag1_errors) m1.add("errors"); + if (flag1_warnings) m1.add("warnings"); + if (flag1_messages) m1.add("messages"); + if (flag1_events) m1.add("events"); + if (flag1_commands) m1.add("commands"); + if (flag1_audio) m1.add("audio"); + if (flag1_modem) m1.add("modem"); + if (flag1_links) m1.add("link"); + if (flag1_cas) m1.add("cas"); + + K::Logger::Logg2(C_CLI, stream, " "); + + if (!m1.empty()) K::Logger::Logg2(C_CLI, stream, FMT("Enabled console messages: %s.") % m1.merge(", ")); + else /* ----- */ K::Logger::Logg2(C_CLI, stream, "There are no console messages enabled."); + + bool flag2_errors = K::Logger::Logg.classe(C_ERROR).get(O_GENERIC, K::LogManager::Option::ENABLED); + bool flag2_warnings = K::Logger::Logg.classe(C_WARNING).get(O_GENERIC, K::LogManager::Option::ENABLED); + bool flag2_messages = K::Logger::Logg.classe(C_MESSAGE).get(O_GENERIC, K::LogManager::Option::ENABLED); + bool flag2_events = K::Logger::Logg.classe(C_EVENT).get(O_GENERIC, K::LogManager::Option::ENABLED); + bool flag2_commands = K::Logger::Logg.classe(C_COMMAND).get(O_GENERIC, K::LogManager::Option::ENABLED); + bool flag2_audio = K::Logger::Logg.classe(C_AUDIO_EV).get(O_GENERIC, K::LogManager::Option::ENABLED); + bool flag2_modem = K::Logger::Logg.classe(C_MODEM_EV).get(O_GENERIC, K::LogManager::Option::ENABLED); + bool flag2_links = K::Logger::Logg.classe(C_LINK_STT).get(O_GENERIC, K::LogManager::Option::ENABLED); + bool flag2_cas = K::Logger::Logg.classe(C_CAS_MSGS).get(O_GENERIC, K::LogManager::Option::ENABLED); + bool flag2_functions = K::Logger::Logg.classe(C_DBG_FUNC).enabled(); + bool flag2_threads = K::Logger::Logg.classe(C_DBG_THRD).enabled(); + bool flag2_locks = K::Logger::Logg.classe(C_DBG_LOCK).enabled(); + bool flag2_streams = K::Logger::Logg.classe(C_DBG_STRM).enabled(); + + Strings::Merger m2; + + if (flag2_errors) m2.add("errors"); + if (flag2_warnings) m2.add("warnings"); + if (flag2_messages) m2.add("messages"); + if (flag2_events) m2.add("events"); + if (flag2_commands) m2.add("commands"); + if (flag2_audio) m2.add("audio"); + if (flag2_modem) m2.add("modem"); + if (flag2_links) m2.add("link"); + if (flag2_cas) m2.add("cas"); + if (flag2_functions) m2.add("functions"); + if (flag2_threads) m2.add("threads"); + if (flag2_locks) m2.add("locks"); + if (flag2_streams) m2.add("streams"); + + if (!m2.empty()) K::Logger::Logg2(C_CLI, stream, FMT("Enabled log-on-disk messages: %s.") % m2.merge(", ")); + else /* ----- */ K::Logger::Logg2(C_CLI, stream, "There are no log-on-disk messages enabled."); + + if (Globals::flag_trace_rdsi) K::Logger::Logg2(C_CLI, stream, "The ISDN (RDSI) low-level tracing is enabled."); + + K::Logger::Logg2(C_CLI, stream, " "); + + return true; +} + +bool Cli::_KhompLogRotate::execute(int argc, char *argv[]) +{ + if (argc != 2) + { + printUsage(stream); + return false; + } + + if (!K::Logger::rotate()) + { + return false; + } + + return true; +} + +bool Cli::_KhompLogTraceK3L::execute(int argc, char *argv[]) +{ + if (argc != 4) + { + printUsage(stream); + return false; + } + + std::string str_on("on"); + std::string str_off("off"); + + bool value = false; + + if (str_on == argv[3]) value = true; + else if (str_off == argv[3]) value = false; + else + { + K::Logger::Logg2(C_CLI, stream, "ERROR: Please use 'on' or 'off' to enable or disable."); + return false; + } + + K::Logger::Logg2(C_CLI, stream, FMT("NOTICE: %sbling k3l debug messages.") % (value ? "Ena" : "Disa")); + + Logfile logfile; + + K::LogConfig::set(logfile, "K3L", "Value", value); + K::LogConfig::set(logfile, "K3L", "CallProgress", value); + K::LogConfig::set(logfile, "K3L", "CallAnalyzer", value); + K::LogConfig::set(logfile, "K3L", "CadenceRecog", value); + K::LogConfig::set(logfile, "K3L", "CallControl", value); + K::LogConfig::set(logfile, "K3L", "Fax", value); + + if (K::LogConfig::commit(logfile)) + { + try + { + Globals::k3lapi.command(-1, -1, CM_LOG_UPDATE); + } + catch(...) + { + LOG(ERROR,"Error while send command CM_LOG_UPDATE"); + } + } + + return true; +} + +bool Cli::_KhompLogTraceISDN::execute(int argc, char *argv[]) +{ + if (argc < 4) + { + printUsage(stream); + return false; + } + + bool active = true; + + bool change_lapd = false; + bool change_q931 = false; + + std::string what; + + for (unsigned int i = 4; i < (unsigned int)argc; i++) + { + what += argv[i]; + what += ","; + } + + Strings::vector_type values; + Strings::tokenize(what, values, ","); + + for (Strings::vector_type::iterator i = values.begin(); i != values.end(); i++) + { + if ((*i) == "q931") change_q931 = true; + if ((*i) == "lapd") change_lapd = true; + if ((*i) == "off") active = false; + } + + Logfile logfile; + + K::LogConfig::set(logfile, "ISDN", "Value", active); + + if (change_lapd || !active) + K::LogConfig::set(logfile, "ISDN", "Lapd", active); + + if (change_q931 || !active) + K::LogConfig::set(logfile, "ISDN", "Q931", active); + + if (K::LogConfig::commit(logfile)) + { + try + { + Globals::k3lapi.command(-1, -1, CM_LOG_UPDATE); + + if (active) + { + K::Logger::Logg2(C_CLI, stream, FMT("NOTICE: Activating the following ISDN debug option(s): %s") % what); + Globals::flag_trace_rdsi = true; + } + else + { + K::Logger::Logg2(C_CLI, stream, "NOTICE: Deactivating ISDN debug options"); + Globals::flag_trace_rdsi = false; + } + } + catch(...) + { + if (active) + K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Unable to activate the following ISDN debug option(s): %s") % what); + else + K::Logger::Logg2(C_CLI, stream, "ERROR: Unable to deactivate ISDN debug options"); + } + + return false; + } + + return true; +} + +bool Cli::_KhompLogTraceR2::execute(int argc, char *argv[]) +{ + if (argc != 4) + { + printUsage(stream); + return false; + } + + try + { + std::string str_off("off"); + std::string str_on("on" ); + + bool enable = false; + + if (str_on == argv[3]) enable = true; + else if (str_off == argv[3]) enable = false; + + if (enable) + { + K::Logger::Logg2(C_CLI, stream, "NOTICE: All channels of all devices will be monitored!" ); + } + else + { + K::Logger::Logg2(C_CLI, stream, "NOTICE: Deactivating R2 debug options" ); + } + + Logfile logfile; + + K::LogConfig::set(logfile, "R2", "Value", enable); + K::LogConfig::set(logfile, "R2", "Signaling", enable); + K::LogConfig::set(logfile, "R2", "States", enable); + + if (K::LogConfig::commit(logfile)) + { + try + { + Globals::k3lapi.command(-1, -1, CM_LOG_UPDATE); + } + catch(...) + { + LOG(ERROR,"Error while send command CM_LOG_UPDATE"); + } + } + } + catch (Strings::invalid_value e) + { + K::Logger::Logg2(C_CLI, stream, "ERROR: Invalid numeric value in arguments."); + return false; + } + + return true; +} + +bool Cli::_KhompGet::execute(int argc, char *argv[]) +{ + if (argc < 2) + { + printUsage(stream); + return false; + } + + std::string arg(argv[1]); + + try + { + std::string res = Globals::options.get((const char*) argv[1]); + K::Logger::Logg2(C_CLI, stream, FMT("Result for command %s is %s.") % std::string(argv[1]) % res); + }catch(ConfigProcessFailure &e){ + K::Logger::Logg2(C_CLI, stream, (char*) e.msg.c_str()); + } + + return true; +} + +bool Cli::_KhompSet::execute(int argc, char *argv[]) +{ + if (argc < 3) + { + printUsage(stream); + return false; + } + + std::string args; + + const unsigned int first = 2; + + for (unsigned int i = first; i < (unsigned int)argc; i++) + { + if (i != first) { args += " "; } + + args += argv[i]; + } + + try + { + Globals::options.process((const char *) argv[1], (const char *) args.c_str()); + } + catch (ConfigProcessFailure &e) + { + K::Logger::Logg2(C_CLI,stream, FMT("config processing error: %s.") % e.msg.c_str()); + } + + return true; +} + +bool Cli::_KhompRevision::execute(int argc, char *argv[]) +{ +#ifndef MOD_KHOMP_VERSION +#define MOD_KHOMP_VERSION "unknown" +#endif + +#ifndef SWITCH_VERSION_FULL +#define SWITCH_VERSION_FULL "unknown" +#endif + + std::string khomp_endpoint_rev(MOD_KHOMP_VERSION); + std::string freeswitch_rev(SWITCH_VERSION_FULL); + + K::Logger::Logg2(C_CLI, stream, FMT("Khomp Endpoint - %s") % khomp_endpoint_rev); + K::Logger::Logg2(C_CLI, stream, FMT("FreeSWITCH - %s") % freeswitch_rev); + return true; +} + +bool Cli::_KhompSendCommand::execute(int argc, char *argv[]) +{ + if (argc < 5 || argc > 6) + { + printUsage(stream); + return false; + } + + unsigned int dev = atoi (argv[2]); + + if (dev >= Globals::k3lapi.device_count()) + { + K::Logger::Logg2(C_CLI, stream, FMT("ERROR: No such device: %d!") % dev); + return false; + } + + unsigned int num = atoi (argv[4]); + + if (num >= 256) + { + K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Invalid command number: %d!") % num); + return false; + } + + unsigned int obj = atoi (argv[3]); + + try + { + switch (argc) + { + case 5: Globals::k3lapi.command(dev,obj, num); break; + case 6: Globals::k3lapi.command(dev,obj, num,argv[5]); break; + default: /* what-a-hell ?! */ break; + } + } + catch(K3LAPI::failed_command &e) + { + if (K::Logger::Logg.classe(C_WARNING).enabled()) + { + LOG(WARNING, FMT("Command '%s' has failed with error '%s'.") + % Verbose::commandName(e.code) % Verbose::status((KLibraryStatus)e.rc)); + } + + return false; + } + + return true; +} + +bool Cli::_KhompSendRawCommand::execute(int argc, char *argv[]) +{ + if (argc < 6) + { + printUsage(stream); + return false; + } + + unsigned int dev = atoi (argv[3]); + + if (dev >= Globals::k3lapi.device_count()) + { + K::Logger::Logg2(C_CLI, stream, FMT("ERROR: No such device: %d!") % dev); + return false; + } + + unsigned int dsp = atoi (argv[4]); + + if (dsp >= 2) + { + K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Invalid DSP number: %d!") % dsp); + return false; + } + + const unsigned int base = 5; + char commands[(argc - base)]; + + for (int i = base, j = 0; i < argc; i++, j++) + { + if (sscanf(argv[i], "%hhx", &(commands[j])) != 1) + { + K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Invalid hexadecimal sequence: '%s'!") % argv[i]); + return false; + } + } + + try + { + Globals::k3lapi.raw_command(dev, dsp, commands, (argc - base)); + } + catch(K3LAPI::failed_raw_command &e) + { + if (K::Logger::Logg.classe(C_WARNING).enabled()) + { + LOG(WARNING, FMT("(dev=%d,dsp=%d): Raw command '%s' has failed with error '%s'.") + % e.dev + % e.dsp + % Strings::hexadecimal(std::string((char*) commands,(argc - base))) + % Verbose::status((KLibraryStatus)e.rc)); + } + + return false; + } + + return true; +} + +bool Cli::_KhompSelectSim::execute(int argc, char *argv[]) +{ + if(argc != 5) + { + printUsage(stream); + return false; + } + + std::string dev_str(argv[2]); + std::string obj_str(argv[3]); + std::string num_str(argv[4]); + + try + { + unsigned int dev = Strings::tolong(dev_str); + unsigned int obj = Strings::tolong(obj_str); + + if (!Globals::k3lapi.valid_device(dev)) + { + K::Logger::Logg2(C_CLI, stream, + FMT("ERROR: no such device %d!") % dev); + return false; + } + + if (!Globals::k3lapi.valid_channel(dev, obj)) + { + K::Logger::Logg2(C_CLI, stream, + FMT("ERROR: No such channel %d on device %d!") % obj % dev); + return false; + } + + /* just check for validity */ + (void)Strings::tolong(num_str); + + + if(!Board::get(dev, obj)->application(SELECT_SIM_CARD, NULL, num_str.c_str())) + { + K::Logger::Logg2(C_CLI, stream, "ERROR: Unable to select sim card"); + return false; + } + + } + catch (Strings::invalid_value & e) + { + K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Invalid number '%s'!") % e.value()); + return false; + } + catch (K3LAPI::invalid_channel & err) + { + K::Logger::Logg2(C_CLI, stream, FMT("ERROR: Unable to find channel %d on device %d!") % err.channel % err.device ); + return false; + } + catch(...) + { + K::Logger::Logg2(C_CLI, stream, "ERROR: Unable to select sim card"); + return false; + } + + return true; +} + +bool Cli::_KhompKommuterOnOff::execute(int argc, char *argv[]) +{ + if(argc != 2) + { + printUsage(stream); + return false; + } + + switch (Board::kommuter._kommuter_count) + { + case -1: K::Logger::Logg2(C_CLI, stream, "ERROR: libkwd.so required for kommuter could not be found." ); return false; + case 0: K::Logger::Logg2(C_CLI, stream, "ERROR: none Kommuter was found on the system." ); return false; + } + + if (Opt::_kommuter_activation == "auto") + { + K::Logger::Logg2(C_CLI, stream, "ERROR: Kommuter is set to be started automatically by kommuter-activation configuration."); + return false; + } + + bool on_off = ARG_CMP(1, "on") ? true : false; + + int ret = 0; + if (on_off) + { + int timeout = Opt::_kommuter_timeout; + K::Logger::Logg2(C_CLI, stream, FMT("NOTICE: Activating Kommuters with timeout of %d seconds .") % timeout); + bool start_timer = false; + + std::string param= STG(FMT("timeout=%d") % timeout); + + for (int kommuter = 0; kommuter < Board::kommuter._kommuter_count; kommuter++) + { + try + { + Globals::k3lapi.command(-1, kommuter, CM_START_WATCHDOG, (char*) param.c_str()); + start_timer = true; + } + catch(K3LAPI::failed_command & e) + { + switch(e.rc) + { + case ksInvalidParams: + K::Logger::Logg2(C_CLI,stream,FMT("ERROR: invalid timeout '%d' for Kommuter device '%d' timeout. Mininum is 0, maximum is 255.") + % timeout % kommuter); + break; + default: + K::Logger::Logg2(C_CLI,stream,FMT("ERROR: could not start the kommuter device number '%d'.") % kommuter); + break; + } + } + catch(...) + { + K::Logger::Logg2(C_CLI, stream, FMT("ERROR: could not start the Kommuter device number '%d'.") % kommuter); + } + } + + if (timeout == 0) + { + DBG(FUNC, D("kommuter watchdog timer not created because timeout is 0.")); + return false; + } + + if (start_timer) + { + if (!Globals::global_timer) + { + K::Logger::Logg2(C_CLI, stream , "Error creating the timer for kommuter."); + return true; + } + else if (Board::kommuter._kwtd_timer_on) + { + Globals::global_timer->restart( Board::kommuter._kwtd_timer_index, true ); + DBG(FUNC, D("kommuter watchdog timer restarted.")); + } + else + { + Board::kommuter._kwtd_timer_index = Globals::global_timer->add(((timeout < 5) ? (timeout*500) : 2000), &Kommuter::wtdKickTimer); + Board::kommuter._kwtd_timer_on = true; + DBG(FUNC, D("kommuter watchdog timer created and started.")); + } + } + } + else + { + K::Logger::Logg2(C_CLI, stream, "NOTICE: Deactivating Kommuters."); + + if (Board::kommuter._kwtd_timer_on) + { + Globals::global_timer->del( Board::kommuter._kwtd_timer_index); + Board::kommuter._kwtd_timer_on = false; + } + + for(int kommuter = 0; kommuter < Board::kommuter._kommuter_count; kommuter++) + { + try + { + Globals::k3lapi.command(-1, kommuter, CM_STOP_WATCHDOG); + return true; + } + catch(K3LAPI::failed_command & e) + { + K::Logger::Logg2(C_CLI,stream,FMT("ERROR: Kommuter device '%d' was not initialized.") % kommuter); + } + catch(...) + { + K::Logger::Logg2(C_CLI, stream,FMT("ERROR: could not disable kommuter device '%d' for some unknow reason.") % kommuter); + } + } + } + + return false; +} + +bool Cli::_KhompKommuterCount::execute(int argc, char *argv[]) +{ + if(argc != 2) + { + printUsage(stream); + return false; + } + + if(Board::kommuter._kommuter_count == -1) + { + K::Logger::Logg2(C_CLI, stream, + "ERROR: libkwd.so required for kommuter could not be found." ); + return false; + } + + K::Logger::Logg2(C_CLI, stream, + FMT("Kommuter devices detected = [%d]") + % Board::kommuter._kommuter_count); + + return true; +} + diff --git a/src/mod/endpoints/mod_khomp/src/frame.cpp b/src/mod/endpoints/mod_khomp/src/frame.cpp new file mode 100644 index 0000000..ea52636 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/src/frame.cpp @@ -0,0 +1,124 @@ +/******************************************************************************* + + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2010 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the LGPL + License. If you do not delete the provisions above, a recipient may use your + version of this file under either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*******************************************************************************/ + +#include "frame.h" + +#define ALLOC(T,s) ((T*)calloc(1,s)) + +/* Internal frame manager structure. */ +FrameStorage::FrameStorage(switch_codec_t * codec, int packet_size) +: _frames(ALLOC(switch_frame_t, frame_count * sizeof(switch_frame_t))), + _buffer(ALLOC( char, audio_count * packet_size)), + _index(0) +{ + for (unsigned int i = 0; i < frame_count; i++) + { + _frames[i].codec = codec; + _frames[i].source = "mod_khomp"; + + _frames[i].packet = 0; + _frames[i].packetlen = 0; + _frames[i].extra_data = 0; + + _frames[i].data = (char *)0; + _frames[i].datalen = packet_size; + _frames[i].buflen = packet_size; + + _frames[i].samples = packet_size; // packet_duration * 8 + _frames[i].rate = 8000; + _frames[i].payload = 0; + + _frames[i].timestamp = 0u; + + _frames[i].seq = 0u; + _frames[i].ssrc = 0u; + _frames[i].m = SWITCH_FALSE; + _frames[i].flags = SFF_NONE; + } + + _cng_frame.codec = codec; + _cng_frame.source = "mod_khomp"; + _cng_frame.packet = 0; + _cng_frame.packetlen = 0; + _cng_frame.extra_data = 0; + + _cng_frame.data = (void*)"A"; + _cng_frame.datalen = 2; + _cng_frame.buflen = 2; + + _cng_frame.samples = packet_size; + _cng_frame.rate = 8000; + _cng_frame.payload = 0; + + _cng_frame.timestamp = 0u; + + _cng_frame.seq = 0u; + _cng_frame.ssrc = 0u; + _cng_frame.m = SWITCH_FALSE; + _cng_frame.flags = SFF_CNG; + +// if (mlock(&_frames, frames_size) < 0) +// { +// DBG(CONF, F("Unable to lock ast_frame buffer memory in RAM: %s") % strerror(errno)); +// std::cerr << "chan_khomp: Unable to lock ast_frame buffer memory in RAM: " +// << strerror(errno) << ". " +// << "This is not a catastrophic failure, but may cause unpredictable " +// << "audio delay under extreme load conditions." << std::endl; +// } +// +// if (mlock(&_buffer, buffer_size) < 0) +// { +// DBG(CONF, F("Unable to lock audio buffer memory in RAM: %s") % strerror(errno)); +// std::cerr << "chan_khomp: Unable to lock temporary audio buffer memory in RAM: " +// << strerror(errno) << ". " +// << "This is not a catastrophic failure, but may cause unpredictable " +// << "audio delay under extreme load conditions." << std::endl; +// } +}; + +FrameStorage::~FrameStorage() +{ + free(_frames); + free(_buffer); +} + diff --git a/src/mod/endpoints/mod_khomp/src/globals.cpp b/src/mod/endpoints/mod_khomp/src/globals.cpp new file mode 100644 index 0000000..cdc20ef --- /dev/null +++ b/src/mod/endpoints/mod_khomp/src/globals.cpp @@ -0,0 +1,66 @@ +/******************************************************************************* + + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2010 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the LGPL + License. If you do not delete the provisions above, a recipient may use your + version of this file under either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*******************************************************************************/ + +#include "globals.h" + +K3LAPI Globals::k3lapi; +K3LUtil Globals::k3lutil(Globals::k3lapi); +Verbose Globals::verbose(Globals::k3lapi); + +/* Global Timer */ +Globals::GlobalTimer * Globals::global_timer = NULL; + +Globals::Mutex Globals::khomp_alloc_mutex; + +ConfigOptions Globals::options; + +switch_endpoint_interface_t * Globals::khomp_endpoint_interface = NULL; +switch_endpoint_interface_t * Globals::khomp_sms_endpoint_interface = NULL; +switch_endpoint_interface_t * Globals::khomp_pr_endpoint_interface = NULL; +switch_application_interface_t * Globals::khomp_app_inteface = NULL; +switch_api_interface_t * Globals::api_interface = NULL; +switch_memory_pool_t * Globals::module_pool = NULL; + +volatile bool Globals::logs_being_rotated = false; + +bool Globals::flag_trace_rdsi = false; diff --git a/src/mod/endpoints/mod_khomp/src/khomp_pvt.cpp b/src/mod/endpoints/mod_khomp/src/khomp_pvt.cpp new file mode 100644 index 0000000..3d1235e --- /dev/null +++ b/src/mod/endpoints/mod_khomp/src/khomp_pvt.cpp @@ -0,0 +1,2516 @@ +/******************************************************************************* + + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2010 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the LGPL + License. If you do not delete the provisions above, a recipient may use your + version of this file under either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*******************************************************************************/ + +#include "khomp_pvt.h" +#include "lock.h" +#include "khomp_pvt_kxe1.h" +#include "khomp_pvt_gsm.h" +#include "khomp_pvt_fxo.h" +#include "khomp_pvt_passive.h" +#include "utils.h" + +Board::VectorBoard Board::_boards; +char Board::_cng_buffer[Globals::cng_buffer_size]; +Kommuter Board::kommuter; + + +Board::KhompPvt::KhompPvt(K3LAPI::target & target) : + _target(target), + _mutex(Globals::module_pool), + _session(NULL), + _caller_profile(NULL), + _reader_frames(&_read_codec), + _writer_frames(&_write_codec) +{ + _read_codec.implementation = NULL; + _write_codec.implementation = NULL; + + _pvt_statistics = new PvtStatistics(this); +} + +bool Board::initializeK3L(void) +{ + LOG(MESSAGE, "starting K3L API ..."); + + /* Start the API and connect to KServer */ + k3lSetGlobalParam (klpResetFwOnStartup, 1); + k3lSetGlobalParam (klpDisableInternalVoIP, 1); + + try + { + Globals::k3lapi.start(); + } + catch (K3LAPI::start_failed & e) + { + LOG(ERROR,FMT("loading K3L API failed: %s") % e.msg); + return false; + } + + LOG(MESSAGE, "the K3L API have been started!"); + + return true; +} + +bool Board::finalizeK3L(void) +{ + /* Stop the API and disconnect to KServer */ + try + { + Globals::k3lapi.stop(); + } + catch(...) + { + LOG(ERROR, "K3L not stopped"); + return false; + } + LOG(MESSAGE, "K3L stopped.."); + return true; +} + +bool Board::initializeHandlers(void) +{ + Globals::global_timer = new Globals::GlobalTimer; + Globals::global_timer->start(); + + if (Globals::k3lapi.device_count() == 0) + return false; + + for (VectorBoard::iterator it_dev = _boards.begin(); + it_dev != _boards.end(); + it_dev++) + { + Board * device = *it_dev; + device->_event_handler = new ChanEventHandler(device->id(), &eventThread); + device->_command_handler = new ChanCommandHandler(device->id(), &commandThread); + + device->_timers.start(); + } + + k3lRegisterEventHandler( khompEventCallback ); + k3lRegisterAudioListener( NULL, khompAudioListener ); + + LOG(MESSAGE, "K3l event and audio handlers registered."); + + return true; +} + +bool Board::finalizeHandlers(void) +{ + /* if timer still ticks, stop him */ + if(Globals::global_timer != NULL) + { + Globals::global_timer->stop(); + delete Globals::global_timer; + Globals::global_timer = NULL; + } + + if (Globals::k3lapi.device_count() == 0) + return false; + + k3lRegisterEventHandler( NULL ); + k3lRegisterAudioListener( NULL, NULL ); + + + for (VectorBoard::iterator it_dev = _boards.begin(); + it_dev != _boards.end(); + it_dev++) + { + Board * device = *it_dev; + // stop event handler for device + ChanEventHandler * evt_handler = device->_event_handler; + evt_handler->fifo()->_shutdown = true; + evt_handler->signal(); + delete evt_handler; + device->_event_handler = NULL; + // stop command handler for device + ChanCommandHandler * cmd_handler = device->_command_handler; + cmd_handler->fifo()->_shutdown = true; + cmd_handler->signal(); + delete cmd_handler; + device->_command_handler = NULL; + // stop timer + device->_timers.stop(); + } + + /* wait every thread to finalize */ + sleep(1); + + LOG(MESSAGE, "K3l event and audio handlers unregistered."); + + return true; + +} + +void Board::initializeBoards(void) +{ + + for (unsigned dev = 0; dev < Globals::k3lapi.device_count(); dev++) + { + LOG(MESSAGE,FMT("loading device %d..." ) % dev); + + switch(Globals::k3lapi.device_type(dev)) + { + case kdtE1: + case kdtE1Spx: + case kdtE1GW: + case kdtE1IP: + case kdtE1FXSSpx: + case kdtFXS: + case kdtFXSSpx: + _boards.push_back(new BoardE1(dev)); + break; + case kdtGSM: + case kdtGSMSpx: + case kdtGSMUSB: + case kdtGSMUSBSpx: + _boards.push_back(new BoardGSM(dev)); + break; + case kdtFXO: + case kdtFXOVoIP: + switch(Globals::k3lapi.device_config(dev).DeviceModel) + { + case kdmFXO80: + _boards.push_back(new BoardFXO(dev)); + break; + default: + _boards.push_back(new BoardPassive(dev)); + break; + } + break; + case kdtPR: + _boards.push_back(new BoardPassive(dev)); + break; + default: + _boards.push_back(new Board(dev)); + LOG(ERROR,FMT("device type %d unknown" ) % Globals::k3lapi.device_type(dev)); + break; + } + + _boards.back()->initializeChannels(); + } +} + +void Board::initializeChannels(void) +{ + LOG(MESSAGE, "loading channels ..."); + + for (unsigned obj = 0; obj < Globals::k3lapi.channel_count(_device_id); obj++) + { + K3LAPI::target tgt(Globals::k3lapi, K3LAPI::target::CHANNEL, _device_id, obj); + + KhompPvt * pvt; + + switch(Globals::k3lapi.channel_config(_device_id, obj).Signaling) + { + case ksigInactive: + default: + pvt = new Board::KhompPvt(tgt); + pvt->_call = new Board::KhompPvt::Call(); + DBG(FUNC, FMT("signaling %d unknown") % Globals::k3lapi.channel_config(_device_id, obj).Signaling); + break; + } + + _channels.push_back(pvt); + + pvt->cleanup(); + } +} + +void Board::finalizeBoards(void) +{ + LOG(MESSAGE, "finalizing boards ..."); + + for (VectorBoard::iterator it_dev = _boards.begin(); + it_dev != _boards.end(); + it_dev++) + { + Board * & device_ref = *it_dev; + Board * device_ptr = device_ref; + + device_ptr->finalizeChannels(); + + device_ref = (Board *) NULL; + + delete device_ptr; + } + +} + +void Board::finalizeChannels() +{ + LOG(MESSAGE, "finalizing channels ..."); + for (VectorChannel::iterator it_obj = _channels.begin(); + it_obj != _channels.end(); + it_obj++) + { + KhompPvt * & pvt_ref = *it_obj; + KhompPvt * pvt_ptr = pvt_ref; + + if(!pvt_ptr) + continue; + + try + { + ScopedPvtLock lock(pvt_ptr); + + if(pvt_ptr->session()) + { + //TODO: Tratamento para desconectar do canal do FreeSwitch. + pvt_ptr->cleanup(); + } + + delete pvt_ptr->_call; + pvt_ptr->_call = NULL; + + pvt_ref = (KhompPvt *) NULL; + } + catch(...) + { + /* keep walking! */ + } + + delete pvt_ptr; + } +} + +void Board::initializeCngBuffer(void) +{ + bool turn = true; + + for (unsigned int i = 0; i < Globals::cng_buffer_size; i++) + { + _cng_buffer[i] = (turn ? 0xD5 : 0xD4); + turn = !turn; + } +} + +bool Board::initialize(void) +{ + initializeCngBuffer(); + + initializeBoards(); + + return true; +} + +bool Board::finalize(void) +{ + finalizeBoards(); + + return finalizeK3L(); +} + +void Board::khomp_add_event_board_data(const K3LAPI::target target, switch_event_t *event) +{ + + //if (!event) { + //TODO: RAISE! + //} + + try + { + if (target.type == K3LAPI::target::CHANNEL) + { + switch_core_session_t * s = get(target.device, target.object)->session(); + switch_channel_event_set_data(Board::KhompPvt::getFSChannel(s), event); + } + + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Khomp-DeviceId", "%u", target.device); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Khomp-Object", "%u", target.object); + } + catch(K3LAPI::invalid_channel & err) + { + LOG(ERROR, PVT_FMT(target, "Invalid channel")); + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR, PVT_FMT(target, "No valid channel: %s") % err._msg.c_str()); + } +} + +std::string Board::KhompPvt::getStatistics(Statistics::Type type) +{ + switch(type) + { + case Statistics::DETAILED: + { + return _pvt_statistics->getDetailed(); + } + case Statistics::ROW: + { + return _pvt_statistics->getRow(); + } + default: + return ""; + } +} + +std::string Board::KhompPvt::PvtStatistics::getDetailedRates() +{ + /* skip inactive channels */ + //if (_pvt->getSignaling() == ksigInactive) return ""; + + /* buffer our data to return at the end */ + std::string strBuffer; + + /* this values come from kserver */ + unsigned int call_incoming = Globals::k3lapi.channel_stats( + _pvt->target().device, _pvt->target().object, kcsiInbound); + unsigned int call_outgoing = Globals::k3lapi.channel_stats( + _pvt->target().device, _pvt->target().object, kcsiOutbound); + + float occupation_rate = 100.0; + + if (_pvt->call()->statistics()->_total_idle_time > 0) + { + occupation_rate = 100 * ( + _pvt->call()->statistics()->_total_time_incoming + + _pvt->call()->statistics()->_total_time_outgoing + ) / ( + _pvt->call()->statistics()->_total_idle_time + + _pvt->call()->statistics()->_total_time_incoming + + _pvt->call()->statistics()->_total_time_outgoing); + } + + strBuffer.append(STG(FMT("Occupation rate: \t\t%0.2f%%\n") % occupation_rate)); + + if (call_incoming > 0) + { + std::string str_calls_incoming_mean = timeToString ( (time_t) (_pvt->call()->statistics()->_total_time_incoming / call_incoming) ); + strBuffer.append(STG(FMT("Mean duration time of incoming calls: %s\n") % str_calls_incoming_mean)); + } + + if (call_outgoing > 0) + { + std::string str_calls_outgoing_mean = timeToString ( (time_t) (_pvt->call()->statistics()->_total_time_outgoing / call_outgoing) ); + strBuffer.append(STG(FMT("Mean duration time of outgoing calls: %s\n") % str_calls_outgoing_mean)); + } + + return strBuffer; +} + +std::string Board::KhompPvt::PvtStatistics::getDetailed() +{ + /* skip inactive channels */ + //if (_pvt->getSignaling() == ksigInactive) return ""; + + /* buffer our data to return at the end */ + std::string strBuffer; + + strBuffer.append(_pvt->call()->statistics()->getDetailed()); + + /* this values come from kserver */ + unsigned int call_incoming = Globals::k3lapi.channel_stats( + _pvt->target().device, _pvt->target().object, kcsiInbound); + unsigned int call_outgoing = Globals::k3lapi.channel_stats( + _pvt->target().device, _pvt->target().object, kcsiOutbound); + unsigned int call_fails = Globals::k3lapi.channel_stats( + _pvt->target().device, _pvt->target().object, kcsiOutFailed); + + strBuffer.append(STG(FMT("Number of incoming calls: \t%d\n") % call_incoming)); + strBuffer.append(STG(FMT("Number of outgoing calls: \t%d\n") % call_outgoing)); + strBuffer.append(STG(FMT("Number of calls failed: \t%d\n") % call_fails)); + + strBuffer.append(getDetailedRates()); + + return strBuffer; +} + +std::string Board::KhompPvt::PvtStatistics::getRow() +{ + /* skip inactive channels */ + //if (_pvt->getSignaling() == ksigInactive) return ""; + + time_t action_time; + time (&action_time); + + action_time -= _pvt->call()->statistics()->_base_time; + + uint32 calls_incoming = Globals::k3lapi.channel_stats( + _pvt->target().device, _pvt->target().object, kcsiInbound); + uint32 calls_outgoing = Globals::k3lapi.channel_stats( + _pvt->target().device, _pvt->target().object, kcsiOutbound); + uint32 call_fails = Globals::k3lapi.channel_stats( + _pvt->target().device, _pvt->target().object, kcsiOutFailed); + + std::string string_time = " n/a "; + std::string call_type = " none "; + + if (_pvt->call()->_flags.check(Kflags::IS_INCOMING)) + call_type = "incoming"; + else if (_pvt->call()->_flags.check(Kflags::IS_OUTGOING)) + call_type = "outgoing"; + + if (_pvt->owner()) + { + string_time = timeToString(action_time); + } + + return STG(FMT("| %d,%02d | %8d | %8d | %8d | %7d | %10s | %8s | %8s |") + % _pvt->target().device + % _pvt->target().object + % calls_incoming + % calls_outgoing + % _pvt->call()->statistics()->_channel_fails + % call_fails + % _pvt->getStateString() + % call_type + % string_time); +} + +switch_status_t Board::KhompPvt::justAlloc(bool is_answering, switch_memory_pool_t **pool) +{ + DBG(FUNC, PVT_FMT(target(), "c")); + + if(is_answering) + { + /* Create a new session on incoming call */ + call()->_flags.set(Kflags::IS_INCOMING); + if(!session()) + { +#if SWITCH_LESS_THAN(1,0,6) + session(switch_core_session_request(Globals::khomp_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)); +#else + session(switch_core_session_request(Globals::khomp_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL)); +#endif + } + else + { + DBG(FUNC, PVT_FMT(target(), "Session already created")); + } + } + else + { + /* Create a new session on outgoing call */ + call()->_flags.set(Kflags::IS_OUTGOING); +#if SWITCH_LESS_THAN(1,0,6) + session(switch_core_session_request(Globals::khomp_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)); +#else + session(switch_core_session_request(Globals::khomp_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, SOF_NONE, pool)); +#endif + } + + if(!session()) + { + LOG(ERROR, PVT_FMT(target(), "r (Initilization Error, session not created!)")); + return SWITCH_STATUS_FALSE; + } + + switch_core_session_add_stream(session(), NULL); + + if (switch_core_codec_init(&_read_codec, "PCMA", NULL, 8000, Globals::switch_packet_duration, 1, + SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, + (pool ? *pool : NULL)) != SWITCH_STATUS_SUCCESS) + { + destroy(); + LOG(ERROR, PVT_FMT(target(), "r (Error while init read codecs)")); + return SWITCH_STATUS_FALSE; + } + + if (switch_core_codec_init(&_write_codec, "PCMA", NULL, 8000, Globals::switch_packet_duration, 1, + SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, + (pool ? *pool : NULL)) != SWITCH_STATUS_SUCCESS) + { + destroy(); + LOG(ERROR, PVT_FMT(target(), "r (Error while init write codecs)")); + return SWITCH_STATUS_FALSE; + } + + //TODO: Retirar daqui +// switch_mutex_init(&flag_mutex, SWITCH_MUTEX_NESTED, +// switch_core_session_get_pool(_session)); + + switch_core_session_set_private(_session, this); + + if((switch_core_session_set_read_codec(_session, &_read_codec) != + SWITCH_STATUS_SUCCESS) || + (switch_core_session_set_write_codec(_session, &_write_codec) != + SWITCH_STATUS_SUCCESS)) + { + destroy(); + LOG(ERROR, PVT_FMT(target(), "r (Error while set read codecs)")); + return SWITCH_STATUS_FALSE; + } + + DBG(FUNC, PVT_FMT(target(), "r")); + return SWITCH_STATUS_SUCCESS; +} + +switch_status_t Board::KhompPvt::justStart(switch_caller_profile_t *profile) +{ + DBG(FUNC, PVT_FMT(target(), "c")); + + try + { + switch_channel_t *channel = getFSChannel(); + + if(call()->_flags.check(Kflags::IS_INCOMING)) + { + std::string exten("s"); + + owner(_session); + + if(call()->_incoming_context.empty()) + { + Board::KhompPvt::ContextListType contexts; + std::string context("default"); + + if(!validContexts(contexts)) + { + destroy(); + owner(NULL); + LOG(ERROR, PVT_FMT(_target, "r (Invalid context)")); + return SWITCH_STATUS_FALSE; + } + + switch(findExtension(exten, context, contexts, _call->_dest_addr, _call->_orig_addr)) + { + case MATCH_NONE: + destroy(); + owner(NULL); + LOG(ERROR, PVT_FMT(_target, "r (unable to find exten/context on incoming call %s/%s)") + % _call->_dest_addr % (contexts.size() >= 1 ? contexts[0] : "default")); + return SWITCH_STATUS_FALSE; + default: + DBG(FUNC, PVT_FMT(_target, "our: context '%s', exten '%s'") % context % exten); + break; + } + + call()->_incoming_context = context; + } + else + { + exten = call()->_dest_addr; + DBG(FUNC, PVT_FMT(target(), "already found our: context '%s', exten '%s'") % call()->_incoming_context % exten); + } + + _caller_profile = switch_caller_profile_new(switch_core_session_get_pool(_session), + "Khomp", //username + "XML", //dialplan + NULL, //caller_id_name + _call->_orig_addr.c_str(), //caller_id_number + NULL, //network_addr + _call->_orig_addr.c_str(), //ani + NULL, //aniii + NULL, //rdnis + (char *) "mod_khomp", //source + call()->_incoming_context.c_str(), //context + exten.c_str()); //destination_number + + if(!_caller_profile) + { + destroy(); + owner(NULL); + LOG(ERROR, PVT_FMT(_target, "r (Cannot create caller profile)")); + return SWITCH_STATUS_FALSE; + } + + std::string name = STG(FMT("Khomp/%hu/%hu/%s") + % target().device + % target().object + % _call->_dest_addr); + + DBG(FUNC, PVT_FMT(target(), "Connect inbound channel %s") % name.c_str()); + + switch_channel_set_name(channel, name.c_str()); + switch_channel_set_caller_profile(channel, _caller_profile); + + switch_channel_set_state(channel, CS_INIT); + + setSpecialVariables(); + + if (switch_core_session_thread_launch(_session) != SWITCH_STATUS_SUCCESS) + { + destroy(); + owner(NULL); + LOG(ERROR, PVT_FMT(target(), "r (Error spawning thread)")); + return SWITCH_STATUS_FALSE; + } + } + else if(call()->_flags.check(Kflags::IS_OUTGOING)) + { + if(_call->_orig_addr.empty()) + _call->_orig_addr = profile->caller_id_number; + + switch_channel_set_name(channel, STG(FMT("Khomp/%hu/%hu/%s") + % target().device + % target().object + % (!_call->_dest_addr.empty() ? _call->_dest_addr.c_str() : "")).c_str()); + _caller_profile = switch_caller_profile_clone(_session, profile); + switch_channel_set_caller_profile(channel, _caller_profile); + + switch_channel_set_flag(channel, CF_OUTBOUND); + switch_channel_set_state(channel, CS_INIT); + } + else + { + DBG(FUNC, PVT_FMT(target(), "r (Not INCOMING or OUTGOING)")); + return SWITCH_STATUS_FALSE; + } + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + destroy(); + owner(NULL); + DBG(FUNC, PVT_FMT(target(), "r (%s)") % err._msg.c_str()); + return SWITCH_STATUS_FALSE; + } + + DBG(FUNC, PVT_FMT(target(), "r")); + return SWITCH_STATUS_SUCCESS; +} + +int Board::KhompPvt::makeCall(std::string params) +{ + DBG(FUNC, PVT_FMT(target(), "Dialing to %s from %s") + % _call->_dest_addr.c_str() + % _call->_orig_addr.c_str()); + + /* Lets make the call! */ + std::string full_params; + + if(!_call->_dest_addr.empty()) + full_params += STG(FMT(" dest_addr=\"%s\"") + % _call->_dest_addr); + + if(!params.empty()) + full_params += STG(FMT(" %s") + % params); + + DBG(FUNC, PVT_FMT(target(), "We are calling with params: %s.") % full_params.c_str()); + + int ret = commandState(KHOMP_LOG, CM_MAKE_CALL, (full_params != "" ? full_params.c_str() : NULL)); + + if(ret != ksSuccess) + { + destroy(); + cleanup(CLN_FAIL); + } + + return ret; +} + +bool Board::KhompPvt::signalDTMF(char d) +{ + DBG(FUNC, PVT_FMT(target(), "c (dtmf=%c)") % d); + + try + { + switch_dtmf_t dtmf = { (char) d, switch_core_default_dtmf_duration(0) }; + switch_channel_queue_dtmf(getFSChannel(), &dtmf); + } + catch (Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR, PVT_FMT(target(), "r (Received a DTMF, but %s)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(target(), "r")); + + return true; +} + +bool Board::KhompPvt::indicateBusyUnlocked(int cause, bool sent_signaling) +{ + DBG(FUNC, PVT_FMT(target(), "c")); + + /* already playing! */ + if (call()->_indication != INDICA_NONE) + { + if (call()->_indication == INDICA_RING) + { + DBG(FUNC, PVT_FMT(target(), "ringback being disabled")); + + if(call()->_cadence == PLAY_RINGBACK) + stopCadence(); + + try + { + call()->_flags.clear(Kflags::GEN_PBX_RING); + call()->_flags.clear(Kflags::GEN_CO_RING); + + Board::board(_target.device)->_timers.del(call()->_idx_pbx_ring); + Board::board(_target.device)->_timers.del(call()->_idx_co_ring); + } + catch (K3LAPI::invalid_device & err) + { + LOG(ERROR, PVT_FMT(_target, "Unable to get device: %d!") % err.device); + } + + mixer(KHOMP_LOG, 1, kmsGenerator, kmtSilence); + call()->_indication = INDICA_NONE; + } + else + { + DBG(FUNC, PVT_FMT(target(), "r (already playing something: %d)") + % call()->_indication); + return false; + } + } + + setHangupCause(cause, false); + + call()->_indication = INDICA_BUSY; + + DBG(FUNC, PVT_FMT(target(), "r")); + + return true; +} + +void Board::KhompPvt::destroy(switch_core_session_t * s) +{ + switch_core_session_t * tmp_session; + + if(!s) + { + if(!_session) + return; + + tmp_session = _session; + } + else + { + tmp_session = s; + + } + + switch_core_session_destroy(&tmp_session); +} + +void Board::KhompPvt::destroyAll() +{ + if(_session) + { + switch_core_session_set_private(_session, NULL); + _session = NULL; + } + + if(_caller_profile) + { + //DBG(FUNC, PVT_FMT(target(), "Profile != NULL")); + //TODO: Destruir + _caller_profile = NULL; + } + + if (switch_core_codec_ready(&_read_codec)) { + //if(session()) + // switch_core_session_lock_codec_read(_session); + switch_core_codec_destroy(&_read_codec); + _read_codec.implementation = NULL; + //if(session()) + // switch_core_session_unlock_codec_read(_session); + } + + if (switch_core_codec_ready(&_write_codec)) { + //if(session()) + // switch_core_session_lock_codec_write(_session); + switch_core_codec_destroy(&_write_codec); + _write_codec.implementation = NULL; + //if(session()) + // switch_core_session_unlock_codec_write(_session); + } + +} + +void Board::KhompPvt::doHangup() +{ + owner(NULL); + + try + { + switch_channel_t *channel = getFSChannel(); + + int cause_from_freeswitch = switch_channel_get_cause(channel); + if(cause_from_freeswitch != SWITCH_CAUSE_NONE) + { + DBG(FUNC, PVT_FMT(_target, "cause already set to %s from freeswitch") % switch_channel_cause2str((switch_call_cause_t)cause_from_freeswitch)); + } + else + { + DBG(FUNC, PVT_FMT(target(), "Hangup channel \"%s\"") % switch_channel_get_name(channel)); + + switch_channel_hangup(channel, (switch_call_cause_t)call()->_hangup_cause); + } + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + //DBG(FUNC, PVT_FMT(target(), "Hangup channel already done")); + } +} + +bool Board::KhompPvt::cleanup(CleanupType type) +{ +// flags = 0; + + _reader_frames.clear(); + _writer_frames.clear(); + + call()->_flags.clear(Kflags::CONNECTED); + + //call()->_flags.clear(Kflags::BRIDGED); + + call()->_flags.clear(Kflags::DROP_COLLECT); + + call()->_flags.clear(Kflags::OUT_OF_BAND_DTMFS); + + call()->_flags.clear(Kflags::WAIT_SEND_DTMF); + + call()->_flags.clear(Kflags::GEN_PBX_RING); + call()->_flags.clear(Kflags::GEN_CO_RING); + + try + { + Board::board(_target.device)->_timers.del(call()->_idx_pbx_ring); + Board::board(_target.device)->_timers.del(call()->_idx_co_ring); + } + catch (K3LAPI::invalid_device & err) + { + LOG(ERROR, PVT_FMT(_target, "Unable to get device: %d!") % err.device); + } + + call()->_idx_pbx_ring.reset(); + call()->_idx_co_ring.reset(); + + switch (type) + { + case CLN_HARD: + case CLN_FAIL: + call()->_flags.clear(Kflags::KEEP_DTMF_SUPPRESSION); + call()->_flags.clear(Kflags::KEEP_ECHO_CANCELLATION); + call()->_flags.clear(Kflags::KEEP_AUTO_GAIN_CONTROL); + + stopStream(); + stopListen(); + doHangup(); + call()->_flags.clear(Kflags::IS_INCOMING); + call()->_flags.clear(Kflags::IS_OUTGOING); + call()->_flags.clear(Kflags::REALLY_CONNECTED); + call()->_flags.clear(Kflags::HAS_PRE_AUDIO); + call()->_flags.clear(Kflags::HAS_CALL_FAIL); + + /* pára cadências e limpa estado das flags */ + stopCadence(); + + if (call()->_indication != INDICA_NONE) + { + call()->_indication = INDICA_NONE; + + mixer(KHOMP_LOG, 1, kmsGenerator, kmtSilence); + } + + if(call()->_input_volume >= -10 && call()->_input_volume <= 10) + setVolume("input" , Opt::_input_volume); + + if(call()->_output_volume >= -10 && call()->_output_volume <= 10) + setVolume("output", Opt::_output_volume); + + return _call->clear(); + case CLN_SOFT: + if(call()->_cadence != PLAY_FASTBUSY) + { + /* pára cadências e limpa estado das flags */ + stopCadence(); + } + + if (call()->_indication == INDICA_RING) + { + call()->_indication = INDICA_NONE; + + mixer(KHOMP_LOG, 1, kmsGenerator, kmtSilence); + } + break; + } + + return true; +} + +bool Board::KhompPvt::isFree(bool just_phy) +{ + //DBG(FUNC, DP(this, "c")); + try + { + bool is_physical_free = isPhysicalFree(); + + /* if we got here, is physically free */ + if (!is_physical_free || just_phy) + return is_physical_free; + + ScopedPvtLock lock(this); + + if(session()) + return false; + + /* + if (!is_gsm()) + { + if (calls.at(0).owner != NULL) + { + DBG(FUNC, DP(this, "we have owner, not free!")); + return false; + } + } + else + { + for (int i = 0; i < 6; i++) + { + + call_data_type & data = calls.at(i); + + if (data.owner != NULL) + return false; + } + } + */ + + bool free_state = !(_call->_flags.check(Kflags::IS_INCOMING) || _call->_flags.check(Kflags::IS_OUTGOING)); + + DBG(FUNC, PVT_FMT(target(), "[free = %s]") % (free_state ? "yes" : "no")); + return free_state; + } + catch (ScopedLockFailed & err) + { + DBG(FUNC, PVT_FMT(target(), "unable to obtain lock: %s") % err._msg.c_str()); + } + + return false; +} + +Board::KhompPvt * Board::queueFindFree(PriorityCallQueue &pqueue) +{ + for (PriorityCallQueue::iterator i = pqueue.begin(); i != pqueue.end(); i++) + { + KhompPvt *pvt = (*i); + if (pvt && pvt->isFree()) + { + return pvt; + } + } + + DBG(FUNC, D("found no free channel for fair allocation!")); + return NULL; +} + +void Board::queueAddChannel(PriorityCallQueue &pqueue, unsigned int board, unsigned int object) +{ + try + { + KhompPvt * pvt = get(board, object); + pqueue.insert(pvt); + } + catch(K3LAPI::invalid_channel & err) + { + //... + } +} + +Board::KhompPvt * Board::findFree(unsigned int board, unsigned int object, bool fully_available) +{ + try + { + KhompPvt * pvt = get(board, object); + return ((fully_available ? pvt->isFree() : pvt->isOK()) ? pvt : NULL); + } + catch(K3LAPI::invalid_channel & err) + { + } + return NULL; +} + +void Board::applyGlobalVolume(void) +{ + DBG(FUNC, "c"); + + for (unsigned int dev = 0; dev < Globals::k3lapi.device_count(); dev++) + { + for (unsigned int obj = 0; obj < Globals::k3lapi.channel_count(dev); obj++) + { + try + { + Board::get(dev,obj)->setVolume("input", Opt::_input_volume); + Board::get(dev,obj)->setVolume("output",Opt::_output_volume); + } + catch(K3LAPI::invalid_channel & err) + { + DBG(FUNC, OBJ_FMT(dev, obj, "Channel not found")); + } + } + } + + DBG(FUNC, "r"); +} + +bool Board::KhompPvt::startCadence(CadencesType type) +{ + DBG(FUNC, PVT_FMT(target(), "c")); + + std::string tone(""); + + /**/ if (type == PLAY_VM_TONE) tone = "vm-dialtone"; + else if (type == PLAY_PBX_TONE) tone = "pbx-dialtone"; + else if (type == PLAY_PUB_TONE) tone = "co-dialtone"; + else if (type == PLAY_RINGBACK) tone = "ringback"; + else if (type == PLAY_FASTBUSY) tone = "fast-busy"; + + + if (tone != "") + { + call()->_cadence = type; + + Opt::CadencesMapType::iterator i = Opt::_cadences.find(tone); + std::string cmd_params; + + if (i != Opt::_cadences.end()) + { + CadenceType cadence = (*i).second; + + if (cadence.ring == 0 && cadence.ring_s == 0) + { + cmd_params = "cadence_times=\"continuous\" mixer_track=1"; + } + else if (cadence.ring_ext == 0 && cadence.ring_ext_s == 0) + { + cmd_params = STG(FMT("cadence_times=\"%d,%d\" mixer_track=1") + % cadence.ring % cadence.ring_s); + } + else + { + cmd_params = STG(FMT("cadence_times=\"%d,%d,%d,%d\" mixer_track=1") + % cadence.ring % cadence.ring_s % cadence.ring_ext % cadence.ring_ext_s); + } + + command(KHOMP_LOG,CM_START_CADENCE,cmd_params.c_str()); + } + else + { + LOG(ERROR, PVT_FMT(_target, "r (cadence '%s' not found)") % tone); + return false; + } + } + else + { + LOG(ERROR, PVT_FMT(_target, "r (unknown cadence requested )")); + return false; + } + + DBG(FUNC, PVT_FMT(target(), "r")); + return true; +} + +/* Helper functions - based on code from chan_khomp */ +bool Board::KhompPvt::startStream(bool enable_mixer) +{ + if (call()->_flags.check(Kflags::STREAM_UP)) + return true; + + if(enable_mixer) + { + if(!mixer(KHOMP_LOG, 0, kmsPlay, _target.object)) + return false; + } + + if(!command(KHOMP_LOG, CM_START_STREAM_BUFFER)) + return false; + + call()->_flags.set(Kflags::STREAM_UP); + + return true; +} + +bool Board::KhompPvt::stopStream(bool enable_mixer) +{ + if (!call()->_flags.check(Kflags::STREAM_UP)) + return true; + + call()->_flags.clear(Kflags::STREAM_UP); + + if(enable_mixer) + { + if(!mixer(KHOMP_LOG, 0, kmsGenerator, kmtSilence)) + return false; + } + + if(!command(KHOMP_LOG, CM_STOP_STREAM_BUFFER)) + return false; + + return true; +} + +bool Board::KhompPvt::startListen(bool conn_rx) +{ + if(call()->_flags.check(Kflags::LISTEN_UP)) + return true; + + const size_t buffer_size = Globals::boards_packet_duration; + + if(conn_rx) + { + if(!obtainRX(false)) //no delay, by default.. + return false; + } + + if(!command(KHOMP_LOG, CM_LISTEN, (const char *) &buffer_size)) + return false; + + call()->_flags.set(Kflags::LISTEN_UP); + + return true; +} + +bool Board::KhompPvt::stopListen(void) +{ + if(!call()->_flags.check(Kflags::LISTEN_UP)) + return true; + + call()->_flags.clear(Kflags::LISTEN_UP); + + if(!command(KHOMP_LOG, CM_STOP_LISTEN)) + { + return false; + } + + return true; +} + +bool Board::KhompPvt::obtainRX(bool with_delay) +{ + try + { + Globals::k3lapi.mixerRecord(_target, 0, (with_delay ? kmsChannel : kmsNoDelayChannel), target().object); + Globals::k3lapi.mixerRecord(_target, 1, kmsGenerator, kmtSilence); + } + catch(K3LAPI::failed_raw_command & e) + { + LOG(ERROR, PVT_FMT(target(), "ERROR sending mixer record command!")); + return false; + } + return true; +} + +bool Board::KhompPvt::obtainTX() +{ + /* estes buffers *NAO PODEM SER ESTATICOS*! */ + char cmd1[] = { 0x3f, 0x03, 0xff, 0x00, 0x00, 0xff }; + char cmd2[] = { 0x3f, 0x03, 0xff, 0x01, 0x09, 0x0f }; + + cmd1[2] = cmd1[5] = cmd2[2] = _target.object; + + try + { + int dsp = Globals::k3lapi.get_dsp(_target.device, K3LAPI::DSP_AUDIO); + + Globals::k3lapi.raw_command(_target.device, dsp, cmd1, sizeof(cmd1)); + + Globals::k3lapi.raw_command(_target.device, dsp, cmd2, sizeof(cmd2)); + + } + catch(K3LAPI::failed_raw_command & e) + { + LOG(ERROR, PVT_FMT(target(), "ERROR sending mixer command!")); + return false; + } + + return true; +} + +bool Board::KhompPvt::sendDtmf(std::string digit) +{ + if(!call()->_flags.check(Kflags::STREAM_UP)) + { + DBG(FUNC, PVT_FMT(target(), "stream down, not sending dtmf")); + return false; + } + + if(!call()->_flags.check(Kflags::OUT_OF_BAND_DTMFS)) + { + DBG(FUNC, PVT_FMT(target(), "dtmf suppression disabled, not generating dtmf")); + return false; + } + + if(digit.empty()) + { + DBG(FUNC, PVT_FMT(target(), "not sending dtmf (there is nothing to send)")); + return false; + } + + if(call()->_flags.check(Kflags::WAIT_SEND_DTMF)) + { + DBG(FUNC, PVT_FMT(target(), "queueing dtmf (%s)") % digit); + call()->_queued_digits_buffer += digit; + return true; + } + + DBG(FUNC, PVT_FMT(target(), "sending dtmf (%s)") % digit); + + call()->_flags.set(Kflags::WAIT_SEND_DTMF); + + return command(KHOMP_LOG, CM_DIAL_DTMF, digit.c_str()); +} + +bool Board::KhompPvt::setVolume(const char * type, int volume) +{ + std::string arg = STG(FMT("volume=\"%d\" type=\"%s\"") % volume % type); + DBG(FUNC, PVT_FMT(_target, "%s") % arg); + return command(KHOMP_LOG,CM_SET_VOLUME,arg.c_str()); +} + +std::string Board::KhompPvt::getStateString(void) +{ + try + { + switch_channel_t *c = getFSChannel(); + if(!c) return "unused"; + + switch_channel_state_t state = switch_channel_get_state(c); + + /* shortcut */ + typedef std::string S; + + switch (state) + { + case CS_NEW: return S("new"); + case CS_INIT: return S("init"); + case CS_ROUTING: return S("routing"); + case CS_SOFT_EXECUTE: return S("sf_exec"); + case CS_EXECUTE: return S("execute"); + case CS_EXCHANGE_MEDIA: return S("ex_media"); + case CS_PARK: return S("park"); + case CS_CONSUME_MEDIA: return S("cs_media"); + case CS_HIBERNATE: return S("hibernat"); + case CS_RESET: return S("reset"); + case CS_HANGUP: return S("hangup"); + case CS_REPORTING: return S("reportg"); + case CS_DESTROY: return S("destroy"); + case CS_NONE: return S("none"); + default: + return STG(FMT("none (%d)") % state); + } + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + return "unused"; + } +} + +bool Board::KhompPvt::dtmfSuppression(bool enable) +{ + if (!command(KHOMP_LOG, (enable ? CM_ENABLE_DTMF_SUPPRESSION : CM_DISABLE_DTMF_SUPPRESSION))) + return false; + + if (enable) call()->_flags.set(Kflags::OUT_OF_BAND_DTMFS); + else call()->_flags.clear(Kflags::OUT_OF_BAND_DTMFS); + + DBG(FUNC, PVT_FMT(_target, "flag OUT_OF_BAND_DTMFS is : %s") % + (call()->_flags.check(Kflags::OUT_OF_BAND_DTMFS) ? "true" : "false")); + + return true; +} + +bool Board::KhompPvt::echoCancellation(bool enable) +{ + K3L_DEVICE_CONFIG & devCfg = Globals::k3lapi.device_config(_target.device); + + /* echo canceller should not be used for non-echo cancellable channels */ + switch (devCfg.EchoConfig) + { + case keccFail: + if (!enable) + return true; + + LOG(ERROR, PVT_FMT(_target, "unable to activate echo cancellation")); + return false; + + case keccNotPresent: + DBG(FUNC, PVT_FMT(_target, "echo cancellation not present, not %s.") % (enable ? "enabling" : "disabling")); + return true; + + default: + return command(KHOMP_LOG,(enable ? CM_ENABLE_ECHO_CANCELLER : CM_DISABLE_ECHO_CANCELLER)); + } +} + +bool Board::KhompPvt::autoGainControl(bool enable) +{ + bool ret = command(KHOMP_LOG,(enable ? CM_ENABLE_AGC : CM_DISABLE_AGC));//, SCE_SHOW_DEBUG); + return ret; +} + +void Board::KhompPvt::pbxRingGen(Board::KhompPvt * pvt) +{ + DBG(FUNC, PVT_FMT(pvt->target(), "Generating pbx ring")); + + try + { + ScopedPvtLock lock(pvt); + + if (!pvt->call()->_flags.check(Kflags::GEN_PBX_RING)) + return; + + if (!pvt->obtainTX()) + return; + + pvt->startCadence(PLAY_RINGBACK); + } + catch (...) + { + LOG(ERROR, PVT_FMT(pvt->target(), "unable to lock!")); + } +} + +void Board::KhompPvt::coRingGen(Board::KhompPvt * pvt) +{ + DBG(FUNC, PVT_FMT(pvt->target(), "Generating co ring")); + + try + { + ScopedPvtLock lock(pvt); + + if (!pvt->call()->_flags.check(Kflags::GEN_CO_RING)) + return; + + pvt->startCadence(PLAY_RINGBACK); + } + catch (...) + { + LOG(ERROR, PVT_FMT(pvt->target(), "unable to lock the pvt !")); + } +} + +int Board::KhompPvt::getActiveChannel(bool invalid_as_not_found) +{ + // AT CONSTRUCTION + return 0; +} + +MatchType Board::KhompPvt::matchExtension(std::string & context, std::string & exten, + std::string & callerid, bool match_only) +{ + if(!canMatch(context,exten,callerid)) + { + DBG(FUNC, "context/extension cannot match"); + return MATCH_NONE; + } + + if(match_only) + { + DBG(FUNC, "for now we want know if it matches..."); + return MATCH_MORE; + } + + if(!canMatch(context,exten,callerid,true)) + { + DBG(FUNC, "it match exact!"); + return MATCH_EXACT; + } + + return MATCH_MORE; +} + +MatchType Board::KhompPvt::findExtension(std::string & ref_extension, + std::string & ref_context, + ContextListType & contexts, + std::string & extension, + std::string & caller_id, + bool default_ctx, + bool default_ext) +{ + Board::KhompPvt::ExtenListType extens; + + if(!extension.empty()) + { + extens.push_back(extension); + } + + if(default_ext) + { + if (extension != "s") + { + extens.push_back("s"); + } + + extens.push_back("i"); + } + + if(default_ctx) + { + contexts.push_back("default"); + } + + for(Board::KhompPvt::ContextListType::iterator itc = contexts.begin(); itc != contexts.end(); itc++) + { + for(Board::KhompPvt::ExtenListType::iterator ite = extens.begin(); ite != extens.end(); ite++) + { + DBG(FUNC, FMT("trying context '%s' with exten '%s'...") % *itc % *ite); + + MatchType m = matchExtension(*itc, *ite, caller_id, false); + + switch (m) + { + case MATCH_NONE: + continue; + + case MATCH_MORE: + case MATCH_EXACT: + { + ref_context = *itc; + ref_extension = *ite; + + DBG(FUNC, ".... can match context/extension (some way)!"); + + return m; + } + } + } + } + + DBG(FUNC, D("... no context/extension found!")); + return MATCH_NONE; +} + +bool Board::KhompPvt::setCollectCall() +{ + DBG(FUNC, PVT_FMT(target(), "c")); + // NEEDS LOCK !? + + std::vector< TriState > confvalues; + + // temporary! + const char * tmp_var = NULL; + + // get option configuration value + confvalues.push_back(Opt::_drop_collect_call ? T_TRUE : T_FALSE); + DBG(FUNC, PVT_FMT(_target, "option drop collect call is '%s'") % (Opt::_drop_collect_call ? "yes" : "no")); + + // get global filter configuration value + tmp_var = switch_core_get_variable("KDropCollectCall"); + confvalues.push_back(getTriStateValue(tmp_var)); + DBG(FUNC, PVT_FMT(_target, "global KDropCollectCall was '%s'") % (tmp_var ? tmp_var : "(empty)")); + + try + { + // get local filter configuration value + tmp_var = switch_channel_get_variable(getFSChannel(), "KDropCollectCall"); + confvalues.push_back(getTriStateValue(tmp_var)); + DBG(FUNC, PVT_FMT(_target, "local KDropCollectCall was '%s'") % (tmp_var ? tmp_var : "(empty)")); + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR, PVT_FMT(_target, "Cannot obtain the channel variable: %s") % err._msg.c_str()); + } + + // store last state assigned + bool last_state = false; + + // validate the states + std::vector< TriState >::const_iterator end = confvalues.end(); + for (std::vector< TriState >::const_iterator i = confvalues.begin(); i != end; ++i) + { + switch(*i) + { + case T_TRUE: + last_state = true; + break; + case T_FALSE: + last_state = false; + break; + case T_UNKNOWN: + default: + break; + } + } + + if (last_state) + call()->_flags.set(Kflags::DROP_COLLECT); + else + call()->_flags.clear(Kflags::DROP_COLLECT); + + DBG(FUNC, PVT_FMT(_target, "drop collect call flag: %s.") % (last_state ? "set" : "unset")); + + return last_state; +} + +bool Board::KhompPvt::onChannelRelease(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(target(), "c")); + + try + { + ScopedPvtLock lock(this); + + if (e->Code == EV_CHANNEL_FAIL) + { + call()->statistics()->incrementChannelFail(); + _has_fail = true; + setHangupCause(SWITCH_CAUSE_NETWORK_OUT_OF_ORDER); + cleanup(CLN_HARD); + } + else + { + if(call()->_flags.check(Kflags::REALLY_CONNECTED)) + { + call()->statistics()->incrementHangup(); + } + + setHangupCause(SWITCH_CAUSE_NORMAL_CLEARING); + cleanup(CLN_HARD); + } + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(target(), "r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(target(), "r")); + return true; +} + +//TODO: This method must return more information about the channel allocation +bool Board::KhompPvt::onNewCall(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(target(), "c")); + + std::string orig_addr, dest_addr; + + Globals::k3lapi.get_param(e, "orig_addr", orig_addr); + Globals::k3lapi.get_param(e, "dest_addr", dest_addr); + + if(dest_addr.empty()) + { + dest_addr="s"; + } + + try + { + ScopedPvtLock lock(this); + + _call->_orig_addr = orig_addr; + _call->_dest_addr = dest_addr; + + if (justAlloc(true) != SWITCH_STATUS_SUCCESS) + { + int fail_code = callFailFromCause(SWITCH_CAUSE_UNALLOCATED_NUMBER); + setHangupCause(SWITCH_CAUSE_UNALLOCATED_NUMBER); + cleanup(CLN_FAIL); + reportFailToReceive(fail_code); + + LOG(ERROR, PVT_FMT(target(), "r (Initilization Error on alloc!)")); + return false; + } + + if (justStart() != SWITCH_STATUS_SUCCESS) + { + int fail_code = callFailFromCause(SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL); + setHangupCause(SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL); + cleanup(CLN_FAIL); + reportFailToReceive(fail_code); + + LOG(ERROR, PVT_FMT(target(), "r (Initilization Error on start!)")); + return false; + } + } + catch (ScopedLockFailed & err) + { + cleanup(CLN_FAIL); + LOG(ERROR, PVT_FMT(target(), "r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + catch (Board::KhompPvt::InvalidSwitchChannel & err) + { + cleanup(CLN_FAIL); + LOG(ERROR, PVT_FMT(target(), "r (%s)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(target(), "r")); + return true; +} + +bool Board::KhompPvt::onDisconnect(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_target, "c")); + +/* + try + { + ScopedPvtLock lock(this); + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } +*/ + + DBG(FUNC, PVT_FMT(_target, "r")); + return true; +} + +bool Board::KhompPvt::onAudioStatus(K3L_EVENT *e) +{ + try + { + if(e->AddInfo != kmtSilence) + { + if(call()->_flags.check(Kflags::GEN_PBX_RING)) + { + DBG(FUNC, PVT_FMT(_target, "PBX ringback being disabled...")); + ScopedPvtLock lock(this); + + call()->_flags.clear(Kflags::GEN_PBX_RING); + Board::board(_target.device)->_timers.del(call()->_idx_pbx_ring); + + if(call()->_cadence != PLAY_VM_TONE) + { + stopCadence(); + } + + if (!call()->_flags.check(Kflags::CONNECTED)) + { + obtainRX(Opt::_suppression_delay); + + //Marcar para o Freeswitch que jah tem audio passando + if (call()->_flags.check(Kflags::IS_OUTGOING)) + switch_channel_mark_pre_answered(getFSChannel()); + + } + } + + if (!call()->_is_progress_sent && call()->_flags.check(Kflags::HAS_CALL_FAIL)) + { + + ScopedPvtLock lock(this); + + DBG(FUNC, PVT_FMT(_target, "Audio status progress")); + + call()->_is_progress_sent = true; + //Sinaliza para o Freeswitch PROGRESS + + DBG(FUNC, PVT_FMT(_target, "Pre answer")); + + //pvt->signal_state(AST_CONTROL_PROGRESS); + switch_channel_pre_answer(getFSChannel()); + } + } + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "unable to lock %s!") % err._msg.c_str() ); + return false; + + } + catch (Board::KhompPvt::InvalidSwitchChannel & err) + { + cleanup(CLN_FAIL); + LOG(ERROR, PVT_FMT(target(), "r (%s)") % err._msg.c_str() ); + return false; + } + catch (K3LAPI::invalid_device & err) + { + LOG(ERROR, PVT_FMT(_target, "r (unable to get device: %d!)") % err.device); + return false; + } + + return true; +} + +bool Board::KhompPvt::onCollectCall(K3L_EVENT *e) +{ + try + { + ScopedPvtLock lock(this); + + //TODO: AMI ? + //K::internal::ami_event(pvt, EVENT_FLAG_CALL, "CollectCall", + // STG(FMT("Channel: Khomp/B%dC%d\r\n") % pvt->boardid % pvt->objectid)); + + if (Opt::_drop_collect_call || _call->_flags.check(Kflags::DROP_COLLECT)) + { + /* disconnect! */ + //TODO: SCE_HIDE !? + command(KHOMP_LOG,CM_DISCONNECT); +// command(KHOMP_LOG,CM_DISCONNECT,SCE_HIDE); + + } + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "unable to lock %s!") % err._msg.c_str() ); + return false; + } + + return true; +} + +bool Board::KhompPvt::onSeizureStart(K3L_EVENT *e) +{ +/* + try + { + ScopedPvtLock lock(this); + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "unable to lock %s!") % err._msg.c_str() ); + return false; + } +*/ + return true; +} + +bool Board::KhompPvt::setupConnection() +{ + if(!call()->_flags.check(Kflags::IS_INCOMING) && !call()->_flags.check(Kflags::IS_OUTGOING)) + { + DBG(FUNC, PVT_FMT(_target, "Channel already disconnected")); + return false; + } + + if(call()->_cadence != PLAY_VM_TONE) + { + stopCadence(); + } + + if (call()->_indication != INDICA_NONE) + { + call()->_indication = INDICA_NONE; + + mixer(KHOMP_LOG, 1, kmsGenerator, kmtSilence); + } + + if(call()->_flags.check(Kflags::GEN_PBX_RING)) + { + call()->_flags.clear(Kflags::GEN_PBX_RING); + Board::board(_target.device)->_timers.del(call()->_idx_pbx_ring); + } + + if(call()->_flags.check(Kflags::GEN_CO_RING)) + { + call()->_flags.clear(Kflags::GEN_CO_RING); + Board::board(_target.device)->_timers.del(call()->_idx_co_ring); + } + + if (!call()->_flags.check(Kflags::CONNECTED)) + call()->_flags.set(Kflags::CONNECTED); + + if (!call()->_flags.check(Kflags::REALLY_CONNECTED)) + call()->_flags.set(Kflags::REALLY_CONNECTED); + + /* Sinalizar para o Freeswitch o atendimento */ + + DBG(FUNC, PVT_FMT(_target, "Call will be answered.")); + + if(call()->_flags.check(Kflags::IS_INCOMING)) + { + switch_channel_answer(getFSChannel()); + } + else if(call()->_flags.check(Kflags::IS_OUTGOING)) + { + switch_channel_mark_answered(getFSChannel()); + } + + call()->statistics()->incrementNewCall(); + + return true; +} + + +bool Board::KhompPvt::onConnect(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_target, "c")); + + try + { + ScopedPvtLock lock(this); + + return setupConnection(); + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + catch (Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR, PVT_FMT(target(), "r (%s)") % err._msg.c_str() ); + return false; + } + catch (K3LAPI::invalid_device & err) + { + LOG(ERROR, PVT_FMT(_target, "r (unable to get device: %d!)") % err.device); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "r")); + + return true; +} + +bool Board::KhompPvt::onCallSuccess(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_target, "c")); + + try + { + ScopedPvtLock lock(this); + + switch_channel_mark_ring_ready(getFSChannel()); + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + catch (Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR, PVT_FMT(target(), "r (%s)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "r")); + + return true; +} + +bool Board::KhompPvt::onCallFail(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_target, "c")); + try + { + ScopedPvtLock lock(this); + + call()->_flags.set(Kflags::HAS_CALL_FAIL); + + //TODO: Notificar o Freeswitch: call fail + + cleanup(CLN_SOFT); + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "r")); + + return true; +} + +bool Board::KhompPvt::onNoAnswer(K3L_EVENT *e) +{ + /* TODO: Destroy sessions and channels */ + DBG(FUNC, PVT_FMT(_target, "No one answered the call.")); + + // TODO: Set channel variable if we get this event + // TODO: Fire an event so ESL can get it? + // Call Analyser has to be enabled on k3lconfig + DBG(FUNC, PVT_FMT(_target, "Detected: \"%s\"") % Verbose::callStartInfo((KCallStartInfo)e->AddInfo).c_str()); + + // Fire a custom event about this + switch_event_t * event; + if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, KHOMP_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) + { + Board::khomp_add_event_board_data(_target, event); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, + "EV_CALL_ANSWER_INFO", + Verbose::callStartInfo((KCallStartInfo)e->AddInfo).c_str()); + + switch_event_fire(&event); + } + return true; +} + +bool Board::KhompPvt::onDtmfDetected(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_target, "c (dtmf=%c)") % (char) e->AddInfo); + + try + { + ScopedPvtLock lock(this); + + if (call()->_flags.check(Kflags::IS_INCOMING) || call()->_flags.check(Kflags::IS_OUTGOING)) /* is a valid call? */ + { + char digit = (char) e->AddInfo; + + //TODO: WTHeck ? + //if (!call()->_flags.check(Kflags::OUT_OF_BAND_DTMFS) && !call()->_flags.check(Kflags::BRIDGED)) + if (!call()->_flags.check(Kflags::OUT_OF_BAND_DTMFS)) + { + /* we do not queue dtmfs as we do not need to resend them */ + DBG(FUNC, PVT_FMT(_target, "r (not queueing dtmf, not needed.)")); + return true; + } + + if (Opt::_ignore_letter_dtmfs) + { + switch (e->AddInfo) + { + case 'A': case 'a': + case 'B': case 'b': + case 'C': case 'c': + case 'D': case 'd': + DBG(FUNC, PVT_FMT(_target, "r (not queueing dtmf, letter digit ignored!)")); + return true; + default: + break; + } + } + + signalDTMF(e->AddInfo); + } + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "r")); + return true; +} + +bool Board::KhompPvt::onDtmfSendFinish(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_target, "c")); + + try + { + ScopedPvtLock lock(this); + + if (call()->_flags.check(Kflags::WAIT_SEND_DTMF)) + { + if(!call()->_queued_digits_buffer.empty()) + { + DBG(FUNC, PVT_FMT(target(), "sending dtmf (%s)") + % call()->_queued_digits_buffer); + + command(KHOMP_LOG, CM_DIAL_DTMF, + call()->_queued_digits_buffer.c_str()); + + /* clear the buffer that has been send */ + call()->_queued_digits_buffer.clear(); + } + else + { + DBG(FUNC, PVT_FMT(target(), + "finished sending some digits, cleaning up!")); + call()->_flags.clear(Kflags::WAIT_SEND_DTMF); + } + } + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "r")); + + return true; +} + +bool Board::KhompPvt::onEvUntreated(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_target, "New Event has just arrived with untreated code \"%d\" \"%s\"") % e->Code % Globals::verbose.event(_target.object, e)); + + return false; +} + +bool Board::KhompPvt::eventHandler(K3L_EVENT *e) +{ + DBG(STRM, D("c")); + + bool ret = true; + + switch(e->Code) + { + case EV_CHANNEL_FREE: + case EV_CHANNEL_FAIL: + ret = onChannelRelease(e); + break; + + case EV_NEW_CALL: + ret = onNewCall(e); + break; + + case EV_CALL_SUCCESS: + ret = onCallSuccess(e); + break; + + case EV_CALL_FAIL: + ret = onCallFail(e); + break; + + case EV_CONNECT: + ret = onConnect(e); + break; + + case EV_DISCONNECT: + ret = onDisconnect(e); + break; + + case EV_AUDIO_STATUS: + ret = onAudioStatus(e); + break; + + case EV_NO_ANSWER: + ret = onNoAnswer(e); + break; + + case EV_DTMF_DETECTED: + ret = onDtmfDetected(e); + break; + + case EV_DTMF_SEND_FINISH: + ret = onDtmfSendFinish(e); + break; + + case EV_COLLECT_CALL: + ret = onCollectCall(e); + break; + + case EV_SEIZURE_START: + ret = onSeizureStart(e); + break; + + case EV_CADENCE_RECOGNIZED: + break; + + default: + ret = onEvUntreated(e); + break; + } + + DBG(STRM, D("r")); + + return ret; +} + +bool Board::KhompPvt::indicateProgress() +{ + DBG(FUNC, PVT_FMT(_target, "c")); + + int ret = false; + + try + { + ScopedPvtLock lock(this); + + if (!call()->_flags.check(Kflags::CONNECTED)) + { + bool has_audio = sendPreAudio(RingbackDefs::RB_SEND_NOTHING); + + if (has_audio) + { + /* start grabbing audio */ + startListen(); + /* start stream if it is not already */ + startStream(); + + ret = true; + } + } + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "r")); + + return ret; +} + +bool Board::KhompPvt::indicateRinging() +{ + DBG(FUNC, PVT_FMT(_target, "c")); + + bool ret = false; + try + { + ScopedPvtLock lock(this); + + /* already playing! */ + if (call()->_indication != INDICA_NONE) + { + DBG(FUNC, PVT_FMT(_target, "r (already playing something: %d)") + % call()->_indication); + return false; + } + + // any collect calls ? + setCollectCall(); + + call()->_indication = INDICA_RING; + + bool send_ringback = true; + + if (!call()->_flags.check(Kflags::CONNECTED)) + { + int ringback_value = RingbackDefs::RB_SEND_DEFAULT; + + bool do_drop_call = Opt::_drop_collect_call + || call()->_flags.check(Kflags::DROP_COLLECT); + + if (do_drop_call && call()->_collect_call) + { + ringback_value = kq931cCallRejected; + DBG(FUNC, PVT_FMT(_target, "ringback value adjusted to refuse collect call: %d") % ringback_value); + } + + // send ringback too? + send_ringback = sendPreAudio(ringback_value); + + if (!send_ringback) + { + // warn the developer which may be debugging some "i do not have ringback!" issue. + DBG(FUNC, PVT_FMT(_target, " not sending pre connection audio")); + } + + } + + if (send_ringback) + { + call()->_flags.set(Kflags::GEN_CO_RING); + call()->_idx_co_ring = Board::board(_target.device)->_timers.add(Opt::_ringback_co_delay, &Board::KhompPvt::coRingGen,this); + + /* start grabbing audio */ + startListen(); + + /* start stream if it is not already */ + startStream(); + + ret = true; + } + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + catch (K3LAPI::invalid_device & err) + { + LOG(ERROR, PVT_FMT(_target, "r (unable to get device: %d!)") % err.device); + return false; + } + + + DBG(FUNC, PVT_FMT(_target, "r")); + return ret; +} + +bool Board::KhompPvt::doChannelAnswer(CommandRequest &cmd) +{ + DBG(FUNC, PVT_FMT(_target, "c")); + + try + { + ScopedPvtLock lock(this); + + call()->_flags.set(Kflags::CONNECTED); + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "r")); + return true; +} + +bool Board::KhompPvt::doChannelHangup(CommandRequest &cmd) +{ + DBG(FUNC, PVT_FMT(_target, "c")); + + bool answered = true; + bool disconnected = false; + + try + { + ScopedPvtLock lock(this); + + if (call()->_flags.check(Kflags::IS_INCOMING)) + { + DBG(FUNC, PVT_FMT(_target, "disconnecting incoming channel")); + + //disconnected = command(KHOMP_LOG, CM_DISCONNECT); + } + else if (call()->_flags.check(Kflags::IS_OUTGOING)) + { + if(call()->_cleanup_upon_hangup) + { + DBG(FUNC, PVT_FMT(_target, "disconnecting not allocated outgoing channel...")); + + disconnected = command(KHOMP_LOG, CM_DISCONNECT); + cleanup(KhompPvt::CLN_HARD); + answered = false; + + } + else + { + DBG(FUNC, PVT_FMT(_target, "disconnecting outgoing channel...")); + + disconnected = command(KHOMP_LOG, CM_DISCONNECT); + } + } + else + { + DBG(FUNC, PVT_FMT(_target, "already disconnected")); + return true; + } + + if(answered) + { + indicateBusyUnlocked(SWITCH_CAUSE_USER_BUSY, disconnected); + } + + if (call()->_flags.check(Kflags::IS_INCOMING)) + { + DBG(FUNC, PVT_FMT(_target, "disconnecting incoming channel...")); + disconnected = command(KHOMP_LOG, CM_DISCONNECT); + } + + stopStream(); + + stopListen(); + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + + DBG(FUNC, PVT_FMT(_target, "r")); + return true; +} + +bool Board::KhompPvt::commandHandler(CommandRequest &cmd) +{ + DBG(STRM, PVT_FMT(target(), "c")); + + bool ret = true; + + switch(cmd.type()) + { + case CommandRequest::COMMAND: + switch(cmd.code()) + { + case CommandRequest::CMD_CALL: + break; + case CommandRequest::CMD_ANSWER: + ret = doChannelAnswer(cmd); + break; + case CommandRequest::CMD_HANGUP: + ret = doChannelHangup(cmd); + break; + default: + ret = false; + } + break; + + case CommandRequest::ACTION: + break; + + default: + ret = false; + } + + DBG(STRM, PVT_FMT(target(), "r")); + return ret; +} + +int Board::eventThread(void *void_evt) +{ + EventRequest evt(false); + EventFifo * fifo = static_cast < ChanEventHandler * >(void_evt)->fifo(); + int devid = fifo->_device; + + for(;;) + { + DBG(THRD, D("(d=%d) c") % devid); + while(1) + { + try + { + evt = fifo->_buffer.consumer_start(); + break; + } + catch(...) //BufferEmpty & e + { + DBG(THRD, D("(d=%d) buffer empty") % devid); + + fifo->_cond.wait(); + + if (fifo->_shutdown) + return 0; + + DBG(THRD, D("(d=%d) waked up!") % devid); + } + } + + /*while (!fifo->_buffer.consume(evt)) + { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(d=%d) buffer empty\n", fifo->_device); + + fifo->_cond.wait(); + + if (fifo->_shutdown) + return 0; + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(d=%d) waked up!\n", fifo->_device); + }*/ + + DBG(THRD, D("(d=%d) processing buffer...") % devid); + + try + { + if(!board(devid)->eventHandler(evt.obj(), evt.event())) + { + LOG(ERROR, D("(d=%d) Error on event (%d) \"%s\"") + % devid + % evt.event()->Code + % Globals::verbose.event(evt.obj(), evt.event())); + } + } + catch (K3LAPI::invalid_device & invalid) + { + LOG(ERROR, D("invalid device on event '%s'") + % Verbose::eventName(evt.event()->Code).c_str()); + } + + fifo->_buffer.consumer_commit(); + + } + + return 0; +} + +int Board::commandThread(void *void_evt) +{ + CommandFifo * fifo = static_cast < ChanCommandHandler * >(void_evt)->fifo(); + int devid = fifo->_device; + + for(;;) + { + CommandRequest cmd; + + DBG(THRD, D("(d=%d) Command c") % devid); + + while (!fifo->_buffer.consume(cmd)) + { + DBG(THRD, D("(d=%d) Command buffer empty") % devid); + fifo->_cond.wait(); + + if (fifo->_shutdown) + return 0; + + DBG(THRD, D("(d=%d) Command waked up!") % devid); + } + + DBG(THRD, D("(d=%d) Command processing buffer...") % devid); + + + try + { + if(!get(devid, cmd.obj())->commandHandler(cmd)) + { + LOG(ERROR, D("(d=%d) Error on command(%d)") % devid % cmd.code()); + } + } + catch (K3LAPI::invalid_channel & invalid) + { + LOG(ERROR, OBJ_FMT(devid,cmd.obj(), "invalid device on command '%d'") % cmd.code()); + } + + } + + + return 0; +} + +/* This is the callback function for API events. It selects the event * + * on a switch and forwards to the real implementation. */ +extern "C" int32 Kstdcall khompEventCallback(int32 obj, K3L_EVENT * e) +{ + //if (K::Logger::Logg.classe(C_EVENT).enabled()) + // std::string msg = Globals::verbose.event (obj, e) + "."; + LOGC(EVENT, FMT("%s.") % Globals::verbose.event(obj, e)); + + switch(e->Code) + { + case EV_WATCHDOG_COUNT: + Board::kommuter.initialize(e); + break; + case EV_HARDWARE_FAIL: + case EV_DISK_IS_FULL: + case EV_CLIENT_RECONNECT: + case EV_CLIENT_BUFFERED_AUDIOLISTENER_OVERFLOW: + LOG(ERROR, D("Audio client buffered overflow")); + break; + case EV_CLIENT_AUDIOLISTENER_TIMEOUT: + LOG(ERROR, "Timeout on audio listener, registering audio listener again"); + k3lRegisterAudioListener( NULL, khompAudioListener ); + break; + default: + try + { + EventRequest e_req(obj, e); + Board::board(e->DeviceId)->chanEventHandler()->write(e_req); + } + catch (K3LAPI::invalid_device & err) + { + LOG(ERROR, D("Unable to get device: %d!") % err.device); + return ksFail; + } + break; + } + + return ksSuccess; +} + diff --git a/src/mod/endpoints/mod_khomp/src/khomp_pvt_fxo.cpp b/src/mod/endpoints/mod_khomp/src/khomp_pvt_fxo.cpp new file mode 100644 index 0000000..1383f5c --- /dev/null +++ b/src/mod/endpoints/mod_khomp/src/khomp_pvt_fxo.cpp @@ -0,0 +1,791 @@ +/******************************************************************************* + + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2010 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the LGPL + License. If you do not delete the provisions above, a recipient may use your + version of this file under either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*******************************************************************************/ + +#include "khomp_pvt_fxo.h" +#include "lock.h" +#include "logger.h" + +int BoardFXO::KhompPvtFXO::makeCall(std::string params) +{ + DBG(FUNC,PVT_FMT(_target, "(FXO) c")); + + int ret = ksSuccess; + + /* we always have audio */ + call()->_flags.set(Kflags::HAS_PRE_AUDIO); + + if(callFXO()->_call_info_drop == 0 && !callFXO()->_call_info_report) + { + command(KHOMP_LOG, CM_DISABLE_CALL_ANSWER_INFO); + } + + if (!callFXO()->_pre_digits.empty()) + { + /* Seize the line at local PABX. */ + + callFXO()->_flags.set(Kflags::CALL_WAIT_SEIZE); + + if (!command(KHOMP_LOG, CM_SEIZE, call()->_orig_addr.c_str())) + return ksFail; + + int timeout = 150; + + if(!loopWhileFlagTimed(Kflags::CALL_WAIT_SEIZE, timeout)) + return ksFail; + + if (callFXO()->_flags.check(Kflags::CALL_WAIT_SEIZE) || (timeout <= 0)) + return ksFail; + + /* Grab line from local PABX. */ + + callFXO()->_flags.set(Kflags::WAIT_SEND_DTMF); + + if (!command(KHOMP_LOG, CM_DIAL_DTMF, callFXO()->_pre_digits.c_str())) + return ksFail; + + if(!loopWhileFlagTimed(Kflags::WAIT_SEND_DTMF, timeout)) + return ksFail; + + if (callFXO()->_flags.check(Kflags::WAIT_SEND_DTMF) || (timeout <= 0)) + return ksFail; + + /* Seize line from public central (works because the * + * continuous cadence is always detected by the k3l api. */ + + callFXO()->_flags.set(Kflags::CALL_WAIT_SEIZE); + + if (!command(KHOMP_LOG, CM_SEIZE, call()->_orig_addr.c_str())) + return ksFail; + + if(!loopWhileFlagTimed(Kflags::CALL_WAIT_SEIZE, timeout)) + return ksFail; + + if (callFXO()->_flags.check(Kflags::CALL_WAIT_SEIZE) || (timeout <= 0)) + return ksFail; + + /* we want the audio as soon as dialing ends */ + callFXO()->_flags.set(Kflags::EARLY_RINGBACK); + + if (!command(KHOMP_LOG, CM_DIAL_DTMF, call()->_dest_addr.c_str())) + return ksFail; + } + else + { + /* we want the audio as soon as dialing ends */ + callFXO()->_flags.set(Kflags::EARLY_RINGBACK); + + + if(!call()->_orig_addr.empty()) + params += STG(FMT(" orig_addr=\"%s\"") % _call->_orig_addr); + + + ret = KhompPvt::makeCall(params); + + if(ret != ksSuccess) + { + LOG(ERROR, PVT_FMT(target(), "Fail on make call")); + } + + call()->_cleanup_upon_hangup = (ret == ksInvalidParams); + } + + DBG(FUNC,PVT_FMT(_target, "(FXO) r")); + return ret; +} + +bool BoardFXO::KhompPvtFXO::doChannelAnswer(CommandRequest &cmd) +{ + DBG(FUNC, PVT_FMT(_target, "(FXO) c")); + + bool ret = true; + + try + { + ScopedPvtLock lock(this); + + // is this a collect call? + bool has_recv_collect_call = _call->_collect_call; + + if(has_recv_collect_call) + DBG(FUNC, PVT_FMT(target(), "receive a collect call")); + + if(call()->_flags.check(Kflags::DROP_COLLECT)) + DBG(FUNC, PVT_FMT(target(), "flag DROP_COLLECT == true")); + + // do we have to drop collect calls? + bool has_drop_collect_call = call()->_flags.check(Kflags::DROP_COLLECT); + + // do we have to drop THIS call? + bool do_drop_call = has_drop_collect_call && has_recv_collect_call; + + if(!do_drop_call) + { + command(KHOMP_LOG, CM_CONNECT); + } + + if(has_drop_collect_call) + { + if(has_recv_collect_call) + { + usleep(75000); + + DBG(FUNC, PVT_FMT(target(), "disconnecting collect call doChannelAnswer FXO")); + command(KHOMP_LOG,CM_DISCONNECT); + + // thou shalt not talk anymore! + stopListen(); + stopStream(); + } + else + { + DBG(FUNC, PVT_FMT(target(), "dropping collect call at doChannelAnswer FXO")); + command(KHOMP_LOG, CM_DROP_COLLECT_CALL); + } + } + + ret = KhompPvt::doChannelAnswer(cmd); + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target,"(FXO) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "(FXO) r")); + + return ret; +} + +bool BoardFXO::KhompPvtFXO::onNewCall(K3L_EVENT *e) +{ + DBG(FUNC,PVT_FMT(_target,"(FXO) c")); + + bool ret = true; + + try + { + ScopedPvtLock lock(this); + + /* we always have audio */ + call()->_flags.set(Kflags::HAS_PRE_AUDIO); + + ret = KhompPvt::onNewCall(e); + + if(!ret) + return false; + + startListen(); + startStream(); + + } + catch(ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(target(), "(FXO) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "(FXO) r")); + + return ret; +} + +bool BoardFXO::KhompPvtFXO::onDisconnect(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_target, "(FXO) c")); + + bool ret = true; + + try + { + ScopedPvtLock lock(this); + + command(KHOMP_LOG, CM_DISCONNECT); + + ret = KhompPvt::onDisconnect(e); + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(target(), "(FXO) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "(FXO) r")); + + return ret; +} + +bool BoardFXO::KhompPvtFXO::onChannelRelease(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_target, "(FXO) c")); + + bool ret = true; + + try + { + ScopedPvtLock lock(this); + + if (call()->_flags.check(Kflags::FAX_SENDING)) + { + DBG(FUNC, PVT_FMT(_target, "stopping fax tx")); + _fax->stopFaxTX(); + } + else if (call()->_flags.check(Kflags::FAX_RECEIVING)) + { + DBG(FUNC, PVT_FMT(_target, "stopping fax rx")); + _fax->stopFaxRX(); + } + + command(KHOMP_LOG, CM_ENABLE_CALL_ANSWER_INFO); + + ret = KhompPvt::onChannelRelease(e); + } + catch(ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(target(), "(FXO) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "(FXO) r")); + return ret; +} + +bool BoardFXO::KhompPvtFXO::onCallSuccess(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_target, "(FXO) c")); + + bool ret = true; + + try + { + ScopedPvtLock lock(this); + + ret = KhompPvt::onCallSuccess(e); + + if (call()->_pre_answer) + { + dtmfSuppression(Opt::_out_of_band_dtmfs && !call()->_flags.check(Kflags::FAX_DETECTED)); + + startListen(); + startStream(); + } + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "(FXO) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "(FXO) r")); + + return ret; +} + +bool BoardFXO::KhompPvtFXO::onCallFail(K3L_EVENT *e) +{ + bool ret = true; + try + { + ScopedPvtLock lock(this); + + command(KHOMP_LOG, CM_DISCONNECT); + + setHangupCause(causeFromCallFail(e->AddInfo), true); + + ret = KhompPvt::onCallFail(e); + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(target(), "unable to lock %s!") % err._msg.c_str() ); + return false; + } + + return ret; +} + +bool BoardFXO::KhompPvtFXO::onAudioStatus(K3L_EVENT *e) +{ + DBG(STRM, PVT_FMT(_target, "(FXO) c")); + + try + { + //ScopedPvtLock lock(this); + + if(e->AddInfo == kmtFax) + { + DBG(FUNC, PVT_FMT(_target, "Fax detected")); + + bool already_detected = call()->_flags.check(Kflags::FAX_DETECTED); + BEGIN_CONTEXT + { + if(already_detected) + break; + + ScopedPvtLock lock(this); + + if (callFXO()->_call_info_drop != 0 || callFXO()->_call_info_report) + { + /* we did not detected fax yet, send answer info! */ + setAnswerInfo(Board::KhompPvt::CI_FAX); + + if (callFXO()->_call_info_drop & Board::KhompPvt::CI_FAX) + { + /* fastest way to force a disconnection */ + command(KHOMP_LOG,CM_DISCONNECT);//,SCE_HIDE); + } + } + + if (Opt::_auto_fax_adjustment) + { + DBG(FUNC, PVT_FMT(_target, "communication will be adjusted for fax!")); + _fax->adjustForFax(); + } + } + END_CONTEXT + + if (!already_detected) + { + ScopedPvtLock lock(this); + + /* adjust the flag */ + call()->_flags.set(Kflags::FAX_DETECTED); + } + } + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "(FXO) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + bool ret = KhompPvt::onAudioStatus(e); + + DBG(STRM, PVT_FMT(_target, "(FXO) r")); + + return ret; +} + +bool BoardFXO::KhompPvtFXO::onSeizeSuccess(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_target, "(FXO) c")); + + try + { + ScopedPvtLock lock(this); + + callFXO()->_flags.clear(Kflags::CALL_WAIT_SEIZE); + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "(FXO) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "(FXO) r")); + + return true; +} + +bool BoardFXO::KhompPvtFXO::onDtmfDetected(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_target, "(FXO) c")); + + bool ret = true; + + try + { + ScopedPvtLock lock(this); + + if (callFXO()->_flags.check(Kflags::WAIT_SEND_DTMF) || + callFXO()->_flags.check(Kflags::CALL_WAIT_SEIZE)) + { + /* waiting digit or seize means DEADLOCK if we try to + * queue something below. */ + DBG(FUNC, PVT_FMT(_target, "not queueing dtmf, waiting stuff!")); + return true; + } + + ret = KhompPvt::onDtmfDetected(e); + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "(FXO) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "(FXO) r")); + + return ret; +} + +bool BoardFXO::KhompPvtFXO::onDtmfSendFinish(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_target, "(FXO) c")); + + bool ret = true; + + try + { + ScopedPvtLock lock(this); + + ret = KhompPvt::onDtmfSendFinish(e); + + if (callFXO()->_flags.check(Kflags::EARLY_RINGBACK)) + { + callFXO()->_flags.clear(Kflags::EARLY_RINGBACK); + + /* start grabbing */ + startListen(); + + /* activate resources early... */ + bool fax_detected = callFXO()->_flags.check(Kflags::FAX_DETECTED); + + bool res_out_of_band_dtmf = Opt::_suppression_delay && Opt::_out_of_band_dtmfs && !fax_detected; + bool res_echo_cancellator = Opt::_echo_canceller && !fax_detected; + bool res_auto_gain_cntrol = Opt::_auto_gain_control && !fax_detected; + + if (!call()->_flags.check(Kflags::KEEP_DTMF_SUPPRESSION)) + dtmfSuppression(res_out_of_band_dtmf); + + if (!call()->_flags.check(Kflags::KEEP_ECHO_CANCELLATION)) + echoCancellation(res_echo_cancellator); + + if (!call()->_flags.check(Kflags::KEEP_AUTO_GAIN_CONTROL)) + autoGainControl(res_auto_gain_cntrol); + + /* start sending audio if wanted so */ + if (Opt::_fxo_send_pre_audio) + startStream(); + + //TODO: Verificar isso aqui + if (call()->_pre_answer) + { + /* tell the user we are answered! */ + switch_channel_mark_answered(getFSChannel()); + //pvt->signal_state(AST_CONTROL_ANSWER); + } + else + { + /* are we ringing, now? lets try this way! */ + switch_channel_mark_ring_ready(getFSChannel()); + //pvt->signal_state(AST_CONTROL_RINGING); + } + } + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "(FXO) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR, PVT_FMT(_target, "(FXO) r (no valid channel: %s)") % err._msg.c_str()); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "(FXO) r")); + + return ret; +} + +bool BoardFXO::KhompPvtFXO::onCallAnswerInfo(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_target, "(FXO) c")); + try + { + ScopedPvtLock lock(this); + + int info_code = -1; + + switch (e->AddInfo) + { + case kcsiCellPhoneMessageBox: + info_code = CI_MESSAGE_BOX; + break; + case kcsiHumanAnswer: + info_code = CI_HUMAN_ANSWER; + break; + case kcsiAnsweringMachine: + info_code = CI_ANSWERING_MACHINE; + break; + case kcsiCarrierMessage: + info_code = CI_CARRIER_MESSAGE; + break; + case kcsiUnknown: + info_code = CI_UNKNOWN; + break; + default: + DBG(FUNC, PVT_FMT(_target, "got an unknown call answer info '%d', ignoring...") % e->AddInfo); + break; + } + + if (info_code != -1) + { + if (callFXO()->_call_info_report) + { + //TODO: HOW WE TREAT THAT + // make the channel export this + setAnswerInfo(info_code); + } + + if (callFXO()->_call_info_drop & info_code) + { + command(KHOMP_LOG,CM_DISCONNECT); + } + } + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target,"(FXO) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "(FXO) r")); + return true; +} + +bool BoardFXO::KhompPvtFXO::application(ApplicationType type, switch_core_session_t * session, const char *data) +{ + switch(type) + { + case FAX_ADJUST: + return _fax->adjustForFax(); + case FAX_SEND: + return _fax->sendFax(session, data); + case FAX_RECEIVE: + return _fax->receiveFax(session, data); + case USER_TRANSFER: + return _transfer->userTransfer(session, data); + default: + return KhompPvt::application(type, session, data); + } + + return true; +} + +bool BoardFXO::KhompPvtFXO::setupConnection() +{ + if(!call()->_flags.check(Kflags::IS_INCOMING) && !call()->_flags.check(Kflags::IS_OUTGOING)) + { + DBG(FUNC,PVT_FMT(_target, "Channel already disconnected")); + return false; + } + + callFXO()->_flags.clear(Kflags::CALL_WAIT_SEIZE); + callFXO()->_flags.clear(Kflags::WAIT_SEND_DTMF); + + /* if received some disconnect from 'drop collect call' + feature of some pbx, then leave the call rock and rolling */ + //Board::board(_target.device)->_timers.del(callFXO()->_idx_disconnect); + + bool fax_detected = callFXO()->_flags.check(Kflags::FAX_DETECTED) || (callFXO()->_var_fax_adjust == T_TRUE); + + bool res_out_of_band_dtmf = (call()->_var_dtmf_state == T_UNKNOWN || fax_detected ? + Opt::_suppression_delay && Opt::_out_of_band_dtmfs && !fax_detected : (call()->_var_dtmf_state == T_TRUE)); + + bool res_echo_cancellator = (call()->_var_echo_state == T_UNKNOWN || fax_detected ? + Opt::_echo_canceller && !fax_detected : (call()->_var_echo_state == T_TRUE)); + + bool res_auto_gain_cntrol = (call()->_var_gain_state == T_UNKNOWN || fax_detected ? + Opt::_auto_gain_control && !fax_detected : (call()->_var_gain_state == T_TRUE)); + + if (!call()->_flags.check(Kflags::REALLY_CONNECTED)) + { + obtainRX(res_out_of_band_dtmf); + + /* esvazia buffers de leitura/escrita */ + cleanupBuffers(); + + if (!call()->_flags.check(Kflags::KEEP_DTMF_SUPPRESSION)) + dtmfSuppression(res_out_of_band_dtmf); + + if (!call()->_flags.check(Kflags::KEEP_ECHO_CANCELLATION)) + echoCancellation(res_echo_cancellator); + + if (!call()->_flags.check(Kflags::KEEP_AUTO_GAIN_CONTROL)) + autoGainControl(res_auto_gain_cntrol); + + startListen(false); + + startStream(); + + DBG(FUNC, PVT_FMT(_target, "(FXO) Audio callbacks initialized successfully")); + } + + return KhompPvt::setupConnection(); +} + +bool BoardFXO::KhompPvtFXO::autoGainControl(bool enable) +{ + bool ret = KhompPvt::autoGainControl(enable); + + /* enable this AGC also, can be very useful */ + ret &= command(KHOMP_LOG, (enable ? CM_ENABLE_PLAYER_AGC : CM_DISABLE_PLAYER_AGC)); + return ret; +} + +void BoardFXO::KhompPvtFXO::setAnswerInfo(int answer_info) +{ + const char * value = answerInfoToString(answer_info); + + if (value == NULL) + { + DBG(FUNC, PVT_FMT(_target,"signaled unknown call answer info '%d', using 'Unknown'...") % answer_info); + value = "Unknown"; + } + + DBG(FUNC,PVT_FMT(_target,"KCallAnswerInfo: %s") % value); + + try + { + setFSChannelVar("KCallAnswerInfo", value); + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR,PVT_FMT(_target,"Cannot obtain the channel variable: %s") % err._msg.c_str()); + } +} + +bool BoardFXO::KhompPvtFXO::indicateBusyUnlocked(int cause, bool sent_signaling) +{ + DBG(FUNC, PVT_FMT(_target, "(FXO) c")); + + if(!KhompPvt::indicateBusyUnlocked(cause, sent_signaling)) + { + DBG(FUNC, PVT_FMT(_target, "(FXO) r (false)")); + return false; + } + + if(call()->_flags.check(Kflags::IS_INCOMING)) + { + if(!call()->_flags.check(Kflags::CONNECTED) && !sent_signaling) + { + //we are talking about branches, not trunks + command(KHOMP_LOG, CM_CONNECT); + command(KHOMP_LOG, CM_DISCONNECT); + } + else + { + //already connected or sent signaling... + mixer(KHOMP_LOG, 1, kmsGenerator, kmtBusy); + } + } + else if(call()->_flags.check(Kflags::IS_OUTGOING)) + { + //already connected or sent signaling... + mixer(KHOMP_LOG, 1, kmsGenerator, kmtBusy); + } + + DBG(FUNC,PVT_FMT(_target, "(FXO) r")); + + return true; +} + +void BoardFXO::KhompPvtFXO::reportFailToReceive(int fail_code) +{ + KhompPvt::reportFailToReceive(fail_code); + + command(KHOMP_LOG, CM_CONNECT); + + command(KHOMP_LOG, CM_DISCONNECT); + +} + +bool BoardFXO::KhompPvtFXO::validContexts(Board::KhompPvt::ContextListType & contexts, std::string extra_context) +{ + DBG(FUNC,PVT_FMT(_target,"(FXO) c")); + + contexts.push_back(Opt::_context_fxo); + contexts.push_back(Opt::_context2_fxo); + + for (Board::KhompPvt::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) + { + replaceTemplate((*i), "CC", _target.object); + } + + bool ret = Board::KhompPvt::validContexts(contexts,extra_context); + + DBG(FUNC,PVT_FMT(_target,"(FXO) r")); + + return ret; +} + +bool BoardFXO::KhompPvtFXO::isOK() +{ + try + { + ScopedPvtLock lock(this); + + K3L_CHANNEL_STATUS status; + + if (k3lGetDeviceStatus (_target.device, _target.object + ksoChannel, &status, sizeof (status)) != ksSuccess) + return false; + + return (status.AddInfo == kfcsEnabled); + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(target(), "unable to lock %s!") % err._msg.c_str() ); + } + + return false; +} + +bool BoardFXO::KhompPvtFXO::sendDtmf(std::string digit) +{ + if(_transfer->checkUserXferUnlocked(digit)) + { + DBG(FUNC, PVT_FMT(target(), "started (or waiting for) an user xfer")); + return true; + } + + bool ret = KhompPvt::sendDtmf(callFXO()->_digits_buffer); + + callFXO()->_digits_buffer.clear(); + + return ret; +} + diff --git a/src/mod/endpoints/mod_khomp/src/khomp_pvt_gsm.cpp b/src/mod/endpoints/mod_khomp/src/khomp_pvt_gsm.cpp new file mode 100644 index 0000000..2f24c60 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/src/khomp_pvt_gsm.cpp @@ -0,0 +1,565 @@ +/******************************************************************************* + + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2010 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the LGPL + License. If you do not delete the provisions above, a recipient may use your + version of this file under either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*******************************************************************************/ + +#include "khomp_pvt_gsm.h" +#include "lock.h" +#include "logger.h" + +bool BoardGSM::KhompPvtGSM::isOK() +{ + try + { + ScopedPvtLock lock(this); + + K3L_CHANNEL_STATUS status; + + if (k3lGetDeviceStatus (_target.device, _target.object + ksoChannel, &status, sizeof (status)) != ksSuccess) + return false; + + switch (status.AddInfo) + { + case kgsmModemError: + case kgsmSIMCardError: + case kgsmNetworkError: + case kgsmNotReady: + return false; + default: + return true; + } + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(target(), "unable to lock %s!") % err._msg.c_str() ); + } + + return false; +} + +bool BoardGSM::KhompPvtGSM::onChannelRelease(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_target, "(GSM) c")); + + bool ret = true; + + try + { + ScopedPvtLock lock(this); + + call()->_flags.clear(Kflags::HAS_PRE_AUDIO); + command(KHOMP_LOG, CM_ENABLE_CALL_ANSWER_INFO); + + ret = KhompPvt::onChannelRelease(e); + } + catch(ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(target(), "(GSM) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "(GSM) r")); + return ret; +} + +bool BoardGSM::KhompPvtGSM::onCallSuccess(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_target, "(GSM) c")); + + bool ret = true; + + try + { + ScopedPvtLock lock(this); + + ret = KhompPvt::onCallSuccess(e); + + if (call()->_pre_answer) + { + dtmfSuppression(Opt::_out_of_band_dtmfs); + + startListen(); + startStream(); + } + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "(GSM) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "(GSM) r")); + + return ret; +} + +void BoardGSM::KhompPvtGSM::setAnswerInfo(int answer_info) +{ + const char * value = answerInfoToString(answer_info); + + if (value == NULL) + { + DBG(FUNC, PVT_FMT(_target,"signaled unknown call answer info '%d', using 'Unknown'...") % answer_info); + value = "Unknown"; + } + + DBG(FUNC,PVT_FMT(_target,"KCallAnswerInfo: %s") % value); + + try + { + setFSChannelVar("KCallAnswerInfo",value); + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR,PVT_FMT(_target,"Cannot obtain the channel variable: %s") % err._msg.c_str()); + } +} + +bool BoardGSM::KhompPvtGSM::onCallAnswerInfo(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_target, "(GSM) c")); + try + { + ScopedPvtLock lock(this); + + int info_code = -1; + + switch (e->AddInfo) + { + case kcsiCellPhoneMessageBox: + info_code = CI_MESSAGE_BOX; + break; + case kcsiHumanAnswer: + info_code = CI_HUMAN_ANSWER; + break; + case kcsiAnsweringMachine: + info_code = CI_ANSWERING_MACHINE; + break; + case kcsiCarrierMessage: + info_code = CI_CARRIER_MESSAGE; + break; + case kcsiUnknown: + info_code = CI_UNKNOWN; + break; + default: + DBG(FUNC, PVT_FMT(_target, "got an unknown call answer info '%d', ignoring...") % e->AddInfo); + break; + } + + if (info_code != -1) + { + if (callGSM()->_call_info_report) + { + //TODO: HOW WE TREAT THAT + // make the channel export this + setAnswerInfo(info_code); + } + + if (callGSM()->_call_info_drop & info_code) + { + command(KHOMP_LOG, CM_SEND_TO_MODEM, "ATH"); + } + } + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target,"(GSM) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "(GSM) r")); + return true; +} + +/* +bool BoardGSM::KhompPvtGSM::onDtmfDetected(K3L_EVENT *e) +{ + bool ret = KhompPvt::onDtmfDetected(e); + + try + { + ScopedPvtLock lock(this); + + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "(GSM) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + return ret; +} + +bool BoardGSM::KhompPvtGSM::onNewCall(K3L_EVENT *e) +{ + DBG(FUNC,PVT_FMT(_target,"(GSM) c")); + + try + { + ScopedPvtLock lock(this); + + bool ret = KhompPvtGSM::onNewCall(e); + + } + catch(ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(target(), "(GSM) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "(GSM) r")); + + return ret; +} +*/ + + + +bool BoardGSM::KhompPvtGSM::onCallFail(K3L_EVENT *e) +{ + bool ret = true; + try + { + ScopedPvtLock lock(this); + + //K::internal::gsm_cleanup_and_restart(pvt, owner_nr, true); + setHangupCause(causeFromCallFail(e->AddInfo), true); + + ret = KhompPvt::onCallFail(e); + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(target(), "unable to lock %s!") % err._msg.c_str() ); + return false; + } + + return ret; +} + +bool BoardGSM::KhompPvtGSM::onDisconnect(K3L_EVENT *e) +{ + bool ret = true; + try + { + ScopedPvtLock lock(this); + + //gsm_cleanup_and_restart(pvt, (int)evt.gsm_call_ref); + + ret = KhompPvt::onDisconnect(e); + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(target(), "(GSM) unable to lock %s!") % err._msg.c_str() ); + return false; + } + + return ret; +} + +int BoardGSM::KhompPvtGSM::makeCall(std::string params) +{ + DBG(FUNC,PVT_FMT(_target, "(GSM) c")); + + if(callGSM()->_call_info_drop == 0 && !callGSM()->_call_info_report) + { + command(KHOMP_LOG, CM_DISABLE_CALL_ANSWER_INFO); + } + + int ret = KhompPvt::makeCall(params); + + if(ret != ksSuccess) + { + LOG(ERROR, PVT_FMT(target(), "Fail on make call")); + } + + call()->_cleanup_upon_hangup = (ret == ksInvalidParams || ret == ksInvalidState); + + DBG(FUNC,PVT_FMT(_target, "(GSM) r")); + return ret; +} + +bool BoardGSM::KhompPvtGSM::doChannelAnswer(CommandRequest &cmd) +{ + DBG(FUNC, PVT_FMT(_target, "(GSM) c")); + + bool ret = true; + + try + { + ScopedPvtLock lock(this); + + command(KHOMP_LOG, CM_CONNECT); + + ret = KhompPvt::doChannelAnswer(cmd); + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target,"(GSM) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "(GSM) r")); + + return ret; +} + +bool BoardGSM::KhompPvtGSM::doChannelHangup(CommandRequest &cmd) +{ + DBG(FUNC, PVT_FMT(_target, "(GSM) c")); + + bool ret = true; + + try + { + ScopedPvtLock lock(this); + + int owner_nr = 0; + + command(KHOMP_LOG, CM_DISCONNECT, + STG(FMT("gsm_call_ref=%d") % (int)owner_nr).c_str()); + + + //ret = KhompPvt::doChannelHangup(cmd); + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target,"(GSM) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "(GSM) r")); + + return ret; +} + +bool BoardGSM::KhompPvtGSM::application(ApplicationType type, switch_core_session_t * session, const char *data) +{ + switch(type) + { + case SMS_CHECK: + return true; + case SMS_SEND: + return _sms->sendSMS(session, data); + case SELECT_SIM_CARD: + return selectSimCard(data); + default: + return KhompPvt::application(type, session, data); + } + + return true; +} + +bool BoardGSM::KhompPvtGSM::setupConnection() +{ + if(!call()->_flags.check(Kflags::IS_INCOMING) && !call()->_flags.check(Kflags::IS_OUTGOING)) + { + DBG(FUNC,PVT_FMT(_target, "Channel already disconnected")); + return false; + } + + bool res_out_of_band_dtmf = (call()->_var_dtmf_state == T_UNKNOWN ? + Opt::_suppression_delay && Opt::_out_of_band_dtmfs : (call()->_var_dtmf_state == T_TRUE)); + + bool res_echo_cancellator = (call()->_var_echo_state == T_UNKNOWN ? + Opt::_echo_canceller : (call()->_var_echo_state == T_TRUE)); + + + bool res_auto_gain_cntrol = (call()->_var_gain_state == T_UNKNOWN ? + Opt::_auto_gain_control : (call()->_var_gain_state == T_TRUE)); + + + if (!call()->_flags.check(Kflags::REALLY_CONNECTED)) + { + obtainRX(res_out_of_band_dtmf); + + /* esvazia buffers de leitura/escrita */ + cleanupBuffers(); + + if (!call()->_flags.check(Kflags::KEEP_DTMF_SUPPRESSION)) + dtmfSuppression(res_out_of_band_dtmf); + + if (!call()->_flags.check(Kflags::KEEP_ECHO_CANCELLATION)) + echoCancellation(res_echo_cancellator); + + if (!call()->_flags.check(Kflags::KEEP_AUTO_GAIN_CONTROL)) + autoGainControl(res_auto_gain_cntrol); + + startListen(false); + + startStream(); + + DBG(FUNC, PVT_FMT(_target, "(GSM) Audio callbacks initialized successfully")); + } + + return Board::KhompPvt::setupConnection(); +} + +bool BoardGSM::KhompPvtGSM::indicateBusyUnlocked(int cause, bool sent_signaling) +{ + DBG(FUNC, PVT_FMT(_target, "(GSM) c")); + + if(!KhompPvt::indicateBusyUnlocked(cause, sent_signaling)) + { + DBG(FUNC, PVT_FMT(_target, "(GSM) r (false)")); + return false; + } + + if(call()->_flags.check(Kflags::IS_INCOMING)) + { + if(!call()->_flags.check(Kflags::CONNECTED) && !sent_signaling) + { + /* we are talking about branches, not trunks */ + command(KHOMP_LOG, CM_DISCONNECT); + } + else + { + /* already connected or sent signaling... */ + mixer(KHOMP_LOG, 1, kmsGenerator, kmtBusy); + } + } + else if(call()->_flags.check(Kflags::IS_OUTGOING)) + { + /* already connected or sent signaling... */ + mixer(KHOMP_LOG, 1, kmsGenerator, kmtBusy); + } + + DBG(FUNC,PVT_FMT(_target, "(GSM) r")); + + return true; +} + +void BoardGSM::KhompPvtGSM::reportFailToReceive(int fail_code) +{ + KhompPvt::reportFailToReceive(fail_code); + + command(KHOMP_LOG, CM_CONNECT); + + /* K3L may fail depending on its configuration (GsmModem) */ + if (!command(KHOMP_LOG, CM_DISCONNECT)) + { + int owner_nr = 0; + command(KHOMP_LOG, CM_DISCONNECT, + STG(FMT("gsm_call_ref=\"%d\"") % owner_nr).c_str()); + } + +} + +int BoardGSM::KhompPvtGSM::causeFromCallFail(int fail) +{ + int switch_cause = SWITCH_CAUSE_USER_BUSY; + + if (fail <= 127) + switch_cause = fail; + else + switch_cause = SWITCH_CAUSE_INTERWORKING; + + return switch_cause; +} + +int BoardGSM::KhompPvtGSM::callFailFromCause(int cause) +{ + int k3l_fail = -1; // default + + if (cause <= 127) + k3l_fail = cause; + else + k3l_fail = kgccInterworking; + + return k3l_fail; +} + +bool BoardGSM::KhompPvtGSM::validContexts(Board::KhompPvt::ContextListType & contexts, std::string extra_context) +{ + DBG(FUNC,PVT_FMT(_target,"(GSM) c")); + + if (!extra_context.empty()) + { + if (!_group_context.empty()) + { + std::string pvt_context(_group_context); + pvt_context += "-"; + pvt_context += extra_context; + contexts.push_back(pvt_context); + } + + if (!Opt::_context_gsm_call.empty()) + { + std::string context(Opt::_context_gsm_call); + context += "-"; + context += extra_context; + contexts.push_back(_group_context); + } + + if (!Opt::_context2_gsm_call.empty()) + { + std::string context(Opt::_context2_gsm_call); + context += "-"; + context += extra_context; + contexts.push_back(_group_context); + } + + if (!Opt::_context2_gsm_call.empty()) + { + std::string context(Opt::_context2_gsm_call); + context += "-"; + context += extra_context; + contexts.push_back(_group_context); + } + } + + contexts.push_back(Opt::_context_gsm_call); + contexts.push_back(Opt::_context2_gsm_call); + + for (Board::KhompPvt::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) + replaceTemplate((*i), "CC", _target.object); + + bool ret = Board::KhompPvt::validContexts(contexts,extra_context); + + DBG(FUNC,PVT_FMT(_target,"(GSM) r")); + + return ret; +} + diff --git a/src/mod/endpoints/mod_khomp/src/khomp_pvt_kxe1.cpp b/src/mod/endpoints/mod_khomp/src/khomp_pvt_kxe1.cpp new file mode 100644 index 0000000..4dec540 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/src/khomp_pvt_kxe1.cpp @@ -0,0 +1,3425 @@ +/******************************************************************************* + + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2010 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the LGPL + License. If you do not delete the provisions above, a recipient may use your + version of this file under either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*******************************************************************************/ + +#include "khomp_pvt_kxe1.h" +#include "lock.h" +#include "logger.h" + + +bool BoardE1::KhompPvtE1::isOK() +{ + try + { + ScopedPvtLock lock(this); + + K3L_CHANNEL_STATUS status; + + if (k3lGetDeviceStatus (_target.device, _target.object + ksoChannel, &status, sizeof (status)) != ksSuccess) + return false; + + return ((status.AddInfo == kecsFree) || + (!(status.AddInfo & kecsLocalFail) && + !(status.AddInfo & kecsRemoteLock))); + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(target(), "unable to lock %s!") % err._msg.c_str() ); + } + + return false; +} + +bool BoardE1::KhompPvtE1::onChannelRelease(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_target, "(E1) c")); + + bool ret = true; + + try + { + ScopedPvtLock lock(this); + + if (call()->_flags.check(Kflags::FAX_SENDING)) + { + DBG(FUNC, PVT_FMT(_target, "stopping fax tx")); + _fax->stopFaxTX(); + } + else if (call()->_flags.check(Kflags::FAX_RECEIVING)) + { + DBG(FUNC, PVT_FMT(_target, "stopping fax rx")); + _fax->stopFaxRX(); + } + + call()->_flags.clear(Kflags::HAS_PRE_AUDIO); + + command(KHOMP_LOG, CM_ENABLE_CALL_ANSWER_INFO); + + ret = KhompPvt::onChannelRelease(e); + + } + catch(ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(target(), "(E1) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "(E1) r")); + return ret; +} + +bool BoardE1::KhompPvtE1::onCallSuccess(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_target, "(E1) c")); + + bool ret; + + try + { + ScopedPvtLock lock(this); + + ret = KhompPvt::onCallSuccess(e); + + if (call()->_pre_answer) + { + dtmfSuppression(Opt::_out_of_band_dtmfs && !call()->_flags.check(Kflags::FAX_DETECTED)); + + startListen(); + startStream(); + } + else + { + call()->_flags.set(Kflags::GEN_PBX_RING); + call()->_idx_pbx_ring = Board::board(_target.device)->_timers.add(Opt::_ringback_pbx_delay, + &Board::KhompPvt::pbxRingGen,this, TM_VAL_CALL); + } + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "(E1) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + catch (K3LAPI::invalid_device & err) + { + LOG(ERROR, PVT_FMT(_target, "(E1) r (unable to get device: %d!)") % err.device); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "(E1) r")); + + return ret; +} + +bool BoardE1::KhompPvtE1::onAudioStatus(K3L_EVENT *e) +{ + //DBG(FUNC, PVT_FMT(_target, "(E1) c")); + + try + { + //ScopedPvtLock lock(this); + + if(e->AddInfo == kmtFax) + { + DBG(FUNC, PVT_FMT(_target, "Fax detected")); + + bool already_detected = call()->_flags.check(Kflags::FAX_DETECTED); + BEGIN_CONTEXT + { + if(already_detected) + break; + + ScopedPvtLock lock(this); + + if (callE1()->_call_info_drop != 0 || callE1()->_call_info_report) + { + /* we did not detected fax yet, send answer info! */ + setAnswerInfo(Board::KhompPvt::CI_FAX); + + if (callE1()->_call_info_drop & Board::KhompPvt::CI_FAX) + { + /* fastest way to force a disconnection */ + command(KHOMP_LOG,CM_DISCONNECT);//,SCE_HIDE); + } + } + + if (Opt::_auto_fax_adjustment) + { + DBG(FUNC, PVT_FMT(_target, "communication will be adjusted for fax!")); + _fax->adjustForFax(); + } + } + END_CONTEXT + + if (!already_detected) + { + ScopedPvtLock lock(this); + + /* adjust the flag */ + call()->_flags.set(Kflags::FAX_DETECTED); + } + } + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "unable to lock %s!") % err._msg.c_str() ); + return false; + } + + bool ret = KhompPvt::onAudioStatus(e); + + //DBG(FUNC, PVT_FMT(_target, "(E1) r")); + + return ret; +} + +bool BoardE1::KhompPvtE1::onCallAnswerInfo(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_target, "(E1) c")); + try + { + ScopedPvtLock lock(this); + + int info_code = -1; + + switch (e->AddInfo) + { + case kcsiCellPhoneMessageBox: + info_code = CI_MESSAGE_BOX; + break; + case kcsiHumanAnswer: + info_code = CI_HUMAN_ANSWER; + break; + case kcsiAnsweringMachine: + info_code = CI_ANSWERING_MACHINE; + break; + case kcsiCarrierMessage: + info_code = CI_CARRIER_MESSAGE; + break; + case kcsiUnknown: + info_code = CI_UNKNOWN; + break; + default: + DBG(FUNC, PVT_FMT(_target, "got an unknown call answer info '%d', ignoring...") % e->AddInfo); + break; + } + + if (info_code != -1) + { + if (callE1()->_call_info_report) + { + //TODO: HOW WE TREAT THAT + // make the channel export this + setAnswerInfo(info_code); + } + + if (callE1()->_call_info_drop & info_code) + { + // fastest way to force a disconnection + //K::util::sendCmd(pvt->boardid, pvt->objectid, CM_DISCONNECT, true, false); + command(KHOMP_LOG,CM_DISCONNECT/*,SCE_HIDE ?*/); + } + } + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "(E1) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "(E1) r")); + return true; +} + +bool BoardE1::KhompPvtE1::onDisconnect(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_target, "(E1) c")); + + bool ret = true; + + try + { + ScopedPvtLock lock(this); + + if (call()->_flags.check(Kflags::IS_OUTGOING) || + call()->_flags.check(Kflags::IS_INCOMING)) + { + if(Opt::_disconnect_delay == 0) + { + DBG(FUNC, PVT_FMT(_target, "queueing disconnecting outgoing channel!")); + command(KHOMP_LOG, CM_DISCONNECT); + } + else + { + callE1()->_idx_disconnect = Board::board(_target.device)->_timers.add( + 1000 * Opt::_disconnect_delay,&BoardE1::KhompPvtE1::delayedDisconnect,this); + } + } + else + { + /* in the case of a disconnect confirm is needed and a call + was not started e.g. just after a ev_seizure_start */ + command(KHOMP_LOG, CM_DISCONNECT); + } + + ret = KhompPvt::onDisconnect(e); + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "(E1) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + catch (K3LAPI::invalid_device & err) + { + LOG(ERROR, PVT_FMT(_target, "(E1) r (unable to get device: %d!)") % err.device); + return false; + } + + DBG(FUNC,PVT_FMT(_target, "(E1) r")); + return ret; +} + +void BoardE1::KhompPvtE1::delayedDisconnect(Board::KhompPvt * pvt) +{ + DBG(FUNC,PVT_FMT(pvt->target(), "Delayed disconnect")); + + try + { + ScopedPvtLock lock(pvt); + + DBG(FUNC, PVT_FMT(pvt->target(), "queueing disconnecting outgoing channel after delaying!")); + + pvt->command(KHOMP_LOG,CM_DISCONNECT); + pvt->cleanup(CLN_HARD); + } + catch (...) + { + LOG(ERROR, PVT_FMT(pvt->target(), "r (unable to lock the pvt !)")); + } +} + +bool BoardE1::onLinkStatus(K3L_EVENT *e) +{ + DBG(FUNC, D("Link %02d on board %02d changed") % e->AddInfo % e->DeviceId); + + /* Fire a custom event about this */ + /* + switch_event_t * event; + if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, KHOMP_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) + { + //khomp_add_event_board_data(e->AddInfo, event); + Board::khomp_add_event_board_data(K3LAPI::target(Globals::k3lapi, K3LAPI::target::LINK, e->DeviceId, e->AddInfo), event); + + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "EV_LINK_STATUS", "%d", e->AddInfo); + switch_event_fire(&event); + } + */ + + return true; +} + +bool BoardE1::KhompPvtISDN::onSyncUserInformation(K3L_EVENT *e) +{ + KUserInformation * info = (KUserInformation *) (((char*)e) + sizeof(K3L_EVENT)); + + callISDN()->_uui_descriptor = info->ProtocolDescriptor; + + /* clean string */ + callISDN()->_uui_information.clear(); + + if (info->UserInfoLength) + { + /* append to a clean string */ + callISDN()->_uui_information.append((const char *)info->UserInfo, info->UserInfoLength); + } + + return true; +} + +bool BoardE1::KhompPvtISDN::onIsdnProgressIndicator(K3L_EVENT *e) +{ + //TODO: Do we need return something ? + try + { + ScopedPvtLock lock(this); + + switch (e->AddInfo) + { + case kq931pTonesMaybeAvailable: + case kq931pTonesAvailable: + if (!call()->_is_progress_sent) + { + call()->_is_progress_sent = true; + + //Sinaliza para o Freeswitch PROGRESS + DBG(FUNC, PVT_FMT(_target, "Pre answer")); + + //pvt->signal_state(SWITCH_CONTROL_PROGRESS); + //switch_channel_pre_answer(channel); + switch_channel_mark_pre_answered(getFSChannel()); + + } + break; + case kq931pDestinationIsNonIsdn: + case kq931pOriginationIsNonIsdn: + case kq931pCallReturnedToIsdn: + default: + break; + } + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(target(), "unable to lock %s!") % err._msg.c_str() ); + return false; + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR,PVT_FMT(_target, "No valid channel: %s") % err._msg.c_str()); + return false; + } + + return true; +} + +bool BoardE1::KhompPvtISDN::onNewCall(K3L_EVENT *e) +{ + DBG(FUNC,PVT_FMT(_target, "(ISDN) c")); + + bool isdn_reverse_charge = false; + std::string isdn_reverse_charge_str; + bool ret; + + try + { + isdn_reverse_charge_str = Globals::k3lapi.get_param(e, "isdn_reverse_charge"); + isdn_reverse_charge = Strings::toboolean(isdn_reverse_charge_str); + } + catch(K3LAPI::get_param_failed & err) + { + /* do nothing, maybe the parameter is not sent */ + } + catch (Strings::invalid_value & err) + { + LOG(ERROR, PVT_FMT(_target, "unable to get param '%s'") % err.value().c_str()); + } + + try + { + ScopedPvtLock lock(this); + + if(session()) + { + bool pvt_locked = true; + bool is_ok = false; + + DBG(FUNC, PVT_FMT(_target, "Session has not been destroyed yet, waiting for khompDestroy")); + + for(unsigned int sleeps = 0; sleeps < 20; sleeps++) + { + /* unlock our pvt struct */ + if(pvt_locked) + { + _mutex.unlock(); + pvt_locked = false; + } + + /* wait a little while (100ms is good?) */ + usleep (100000); + + /* re-lock pvt struct */ + switch (_mutex.lock()) + { + case SimpleLock::ISINUSE: + case SimpleLock::FAILURE: + LOG(ERROR, PVT_FMT(_target, "unable to lock pvt_mutex, trying again.")); + sched_yield(); + continue; + + default: + break; + } + + pvt_locked = true; + + if(!session()) + { + is_ok = true; + break; + } + } + + if(is_ok) + { + DBG(FUNC, PVT_FMT(_target, "Session destroyed properly")); + } + else + { + LOG(ERROR, PVT_FMT(target(), "(ISDN) r (Session was not destroyed, stopping to wait)")); + return false; + } + } + + if(isdn_reverse_charge) + { + call()->_collect_call = true; + } + + ret = KhompPvtE1::onNewCall(e); + } + catch(ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(target(), "(ISDN) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "(ISDN) r")); + + return ret; +} + +bool BoardE1::KhompPvtISDN::onCallSuccess(K3L_EVENT *e) +{ + bool ret = true; + + try + { + ScopedPvtLock lock(this); + + if(e->AddInfo > 0) + { + callISDN()->_isdn_cause = e->AddInfo; + setFSChannelVar("KISDNGotCause", Verbose::isdnCause((KQ931Cause)callISDN()->_isdn_cause).c_str()); + } + + ret = KhompPvtE1::onCallSuccess(e); + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(target(), "unable to lock %s!") % err._msg.c_str() ); + return false; + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR,PVT_FMT(_target, "%s") % err._msg.c_str()); + return false; + } + + return ret; +} + +bool BoardE1::KhompPvtISDN::onCallFail(K3L_EVENT *e) +{ + bool ret = true; + + try + { + ScopedPvtLock lock(this); + + if(e->AddInfo > 0) + { + callISDN()->_isdn_cause = e->AddInfo; + setFSChannelVar("KISDNGotCause", Verbose::isdnCause((KQ931Cause)callISDN()->_isdn_cause).c_str()); + } + + setHangupCause(causeFromCallFail(e->AddInfo),true); + + ret = KhompPvtE1::onCallFail(e); + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(target(), "unable to lock %s!") % err._msg.c_str() ); + return false; + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR,PVT_FMT(_target, "%s") % err._msg.c_str()); + return false; + } + + return ret; +} + +RingbackDefs::RingbackStType BoardE1::KhompPvtISDN::sendRingBackStatus(int rb_value) +{ + DBG(FUNC, PVT_FMT(target(), "this is the rdsi ringback procedure")); + + + std::string cause = (rb_value == -1 ? "" : STG(FMT("isdn_cause=\"%d\"") % rb_value)); + return (command(KHOMP_LOG, CM_RINGBACK, cause.c_str()) ? + RingbackDefs::RBST_SUCCESS : RingbackDefs::RBST_FAILURE); +} + +bool BoardE1::KhompPvtISDN::sendPreAudio(int rb_value) +{ + if(!KhompPvtE1::sendPreAudio(rb_value)) + return false; + + + DBG(FUNC,PVT_FMT(_target, "doing the ISDN pre_connect")); + + if (call()->_flags.check(Kflags::HAS_PRE_AUDIO)) + { + DBG(FUNC, PVT_FMT(target(), "already pre_connect")); + return true; + } + else + { + bool result = command(KHOMP_LOG, CM_PRE_CONNECT); + + if (result) + call()->_flags.set(Kflags::HAS_PRE_AUDIO); + + return result; + } +} + +bool BoardE1::KhompPvtISDN::application(ApplicationType type, switch_core_session_t * session, const char *data) +{ + switch(type) + { + case USER_TRANSFER: + return _transfer->userTransfer(session, data); + default: + return KhompPvtE1::application(type, session, data); + } + + return true; +} + +bool BoardE1::KhompPvtISDN::sendDtmf(std::string digit) +{ + if(_transfer->checkUserXferUnlocked(digit)) + { + DBG(FUNC, PVT_FMT(target(), "started (or waiting for) an user xfer")); + return true; + } + + bool ret = KhompPvtE1::sendDtmf(callISDN()->_digits_buffer); + + callISDN()->_digits_buffer.clear(); + + return ret; +} + +int BoardE1::KhompPvtE1::makeCall(std::string params) +{ + if(callE1()->_call_info_drop == 0 && !callE1()->_call_info_report) + { + command(KHOMP_LOG, CM_DISABLE_CALL_ANSWER_INFO); + } + + if(!_call->_orig_addr.empty()) + params += STG(FMT(" orig_addr=\"%s\"") % _call->_orig_addr); + + int ret = KhompPvt::makeCall(params); + + if(ret == ksSuccess) + { + startListen(); + } + else + { + LOG(ERROR, PVT_FMT(target(), "Fail on make call")); + } + + return ret; +} + +bool BoardE1::KhompPvtE1::indicateBusyUnlocked(int cause, bool sent_signaling) +{ + DBG(FUNC, PVT_FMT(_target, "(E1) c")); + + if(!KhompPvt::indicateBusyUnlocked(cause, sent_signaling)) + { + DBG(FUNC, PVT_FMT(_target, "(E1) r (false)")); + return false; + } + + if(call()->_flags.check(Kflags::IS_INCOMING)) + { + if(!call()->_flags.check(Kflags::CONNECTED) && !sent_signaling) + { + if(!call()->_flags.check(Kflags::HAS_PRE_AUDIO)) + { + int rb_value = callFailFromCause(call()->_hangup_cause); + DBG(FUNC, PVT_FMT(target(), "sending the busy status")); + + if (sendRingBackStatus(rb_value) == RingbackDefs::RBST_UNSUPPORTED) + { + DBG(FUNC, PVT_FMT(target(), "falling back to audio indication!")); + /* stop the line audio */ + stopStream(); + + /* just pre connect, no ringback */ + if (!sendPreAudio()) + DBG(FUNC, PVT_FMT(target(), "everything else failed, just sending audio indication...")); + + /* be very specific about the situation. */ + mixer(KHOMP_LOG, 1, kmsGenerator, kmtBusy); + } + } + else + { + DBG(FUNC, PVT_FMT(target(), "going to play busy")); + + /* stop the line audio */ + stopStream(); + + /* be very specific about the situation. */ + mixer(KHOMP_LOG, 1, kmsGenerator, kmtBusy); + + } + } + else + { + /* already connected or sent signaling... */ + mixer(KHOMP_LOG, 1, kmsGenerator, kmtBusy); + } + + } + else if(call()->_flags.check(Kflags::IS_OUTGOING)) + { + /* already connected or sent signaling... */ + mixer(KHOMP_LOG, 1, kmsGenerator, kmtBusy); + } + + DBG(FUNC,PVT_FMT(_target, "(E1) r")); + + return true; +} + +void BoardE1::KhompPvtE1::setAnswerInfo(int answer_info) +{ + const char * value = answerInfoToString(answer_info); + + if (value == NULL) + { + DBG(FUNC, PVT_FMT(_target, "signaled unknown call answer info '%d', using 'Unknown'...") % answer_info); + value = "Unknown"; + } + + DBG(FUNC,PVT_FMT(_target, "KCallAnswerInfo: %s") % value); + + try + { + setFSChannelVar("KCallAnswerInfo",value); + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR,PVT_FMT(_target, "%s") % err._msg.c_str()); + } +} + +bool BoardE1::KhompPvtE1::setupConnection() +{ + if(!call()->_flags.check(Kflags::IS_INCOMING) && !call()->_flags.check(Kflags::IS_OUTGOING)) + { + DBG(FUNC,PVT_FMT(_target, "Channel already disconnected")); + return false; + } + + /* if received some disconnect from 'drop collect call' + feature of some pbx, then leave the call rock and rolling */ + Board::board(_target.device)->_timers.del(callE1()->_idx_disconnect); + + bool fax_detected = callE1()->_flags.check(Kflags::FAX_DETECTED) || (callE1()->_var_fax_adjust == T_TRUE); + + bool res_out_of_band_dtmf = (call()->_var_dtmf_state == T_UNKNOWN || fax_detected ? + Opt::_suppression_delay && Opt::_out_of_band_dtmfs && !fax_detected : (call()->_var_dtmf_state == T_TRUE)); + + bool res_echo_cancellator = (call()->_var_echo_state == T_UNKNOWN || fax_detected ? + Opt::_echo_canceller && !fax_detected : (call()->_var_echo_state == T_TRUE)); + + bool res_auto_gain_cntrol = (call()->_var_gain_state == T_UNKNOWN || fax_detected ? + Opt::_auto_gain_control && !fax_detected : (call()->_var_gain_state == T_TRUE)); + + if (!call()->_flags.check(Kflags::REALLY_CONNECTED)) + { + obtainRX(res_out_of_band_dtmf); + + /* esvazia buffers de leitura/escrita */ + cleanupBuffers(); + + if (!call()->_flags.check(Kflags::KEEP_DTMF_SUPPRESSION)) + dtmfSuppression(res_out_of_band_dtmf); + + if (!call()->_flags.check(Kflags::KEEP_ECHO_CANCELLATION)) + echoCancellation(res_echo_cancellator); + + if (!call()->_flags.check(Kflags::KEEP_AUTO_GAIN_CONTROL)) + autoGainControl(res_auto_gain_cntrol); + + startListen(false); + + startStream(); + + DBG(FUNC, PVT_FMT(_target, "(E1) Audio callbacks initialized successfully")); + } + + return Board::KhompPvt::setupConnection(); +} + +bool BoardE1::KhompPvtE1::application(ApplicationType type, switch_core_session_t * session, const char *data) +{ + switch(type) + { + case FAX_ADJUST: + return _fax->adjustForFax(); + case FAX_SEND: + return _fax->sendFax(session, data); + case FAX_RECEIVE: + return _fax->receiveFax(session, data); + default: + return KhompPvt::application(type, session, data); + } + + return true; +} + +bool BoardE1::KhompPvtE1::validContexts(Board::KhompPvt::ContextListType & contexts, std::string extra_context) +{ + DBG(FUNC,PVT_FMT(_target, "(E1) c")); + + contexts.push_back(Opt::_context_digital); + + for (Board::KhompPvt::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) + { + replaceTemplate((*i), "LL", ((_target.object)/30)); + replaceTemplate((*i), "CCC", _target.object); + } + + bool ret = Board::KhompPvt::validContexts(contexts,extra_context); + + DBG(FUNC,PVT_FMT(_target, "(E1) r")); + + return ret; +} + +int BoardE1::KhompPvtISDN::makeCall(std::string params) +{ + DBG(FUNC,PVT_FMT(_target, "(ISDN) c")); + + CallISDN * call = callISDN(); + + if(call->_uui_descriptor != -1) + { + DBG(FUNC,PVT_FMT(_target, "got userinfo")); + + /* grab this information first, avoiding latter side-effects */ + const char * info_data = call->_uui_information.c_str(); + size_t info_size = std::min(call->_uui_information.size(), (size_t)KMAX_USER_USER_LEN); + + KUserInformation info; + + info.ProtocolDescriptor = call->_uui_descriptor; + info.UserInfoLength = info_size; + + memcpy((void *) info.UserInfo, (const void *) info_data, info_size); + + if (!command(KHOMP_LOG, CM_USER_INFORMATION, (const char *)&info)) + { + LOG(ERROR,PVT_FMT(_target, "UUI could not be sent before dialing!")); + } + + call->_uui_descriptor = -1; + call->_uui_information.clear(); + } + + int ret = KhompPvtE1::makeCall(params); + + call->_cleanup_upon_hangup = (ret == ksInvalidParams || ret == ksBusy); + + DBG(FUNC,PVT_FMT(_target, "(ISDN) r")); + + return ret; +} + +void BoardE1::KhompPvtISDN::reportFailToReceive(int fail_code) +{ + KhompPvt::reportFailToReceive(fail_code); + + if(fail_code != -1) + { + DBG(FUNC,PVT_FMT(_target, "sending a 'unknown number' message/audio")); + + if(sendRingBackStatus(fail_code) == RingbackDefs::RBST_UNSUPPORTED) + { + sendPreAudio(RingbackDefs::RB_SEND_DEFAULT); + startCadence(PLAY_FASTBUSY); + } + } + else + { + DBG(FUNC, PVT_FMT(_target, "sending fast busy audio directly")); + + sendPreAudio(RingbackDefs::RB_SEND_DEFAULT); + startCadence(PLAY_FASTBUSY); + } +} + +bool BoardE1::KhompPvtISDN::doChannelAnswer(CommandRequest &cmd) +{ + bool ret = true; + + try + { + ScopedPvtLock lock(this); + + // is this a collect call? + bool has_recv_collect_call = _call->_collect_call; + + if(has_recv_collect_call) + DBG(FUNC, PVT_FMT(target(), "receive a collect call")); + + if(call()->_flags.check(Kflags::DROP_COLLECT)) + DBG(FUNC, PVT_FMT(target(), "flag DROP_COLLECT == true")); + + // do we have to drop collect calls? + bool has_drop_collect_call = call()->_flags.check(Kflags::DROP_COLLECT); + + // do we have to drop THIS call? + bool do_drop_call = has_drop_collect_call && has_recv_collect_call; + + if(!do_drop_call) + { + command(KHOMP_LOG, CM_CONNECT); + } + else + { + usleep(75000); + + DBG(FUNC, PVT_FMT(target(), "disconnecting collect call doChannelAnswer ISDN")); + command(KHOMP_LOG,CM_DISCONNECT); + + // thou shalt not talk anymore! + stopListen(); + stopStream(); + } + + ret = KhompPvtE1::doChannelAnswer(cmd); + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "unable to lock %s!") % err._msg.c_str() ); + return false; + } + + return ret; +} + +int BoardE1::KhompPvtR2::makeCall(std::string params) +{ + DBG(FUNC,PVT_FMT(_target, "(R2) c")); + + if (callR2()->_r2_category != -1) + params += STG(FMT(" r2_categ_a=\"%ld\"") + % callR2()->_r2_category); + + int ret = KhompPvtE1::makeCall(params); + + call()->_cleanup_upon_hangup = (ret == ksInvalidParams); + + DBG(FUNC,PVT_FMT(_target, "(R2) r")); + + return ret; +} + +bool BoardE1::KhompPvtR2::doChannelAnswer(CommandRequest &cmd) +{ + bool ret = true; + + try + { + ScopedPvtLock lock(this); + + // is this a collect call? + bool has_recv_collect_call = _call->_collect_call; + + if(has_recv_collect_call) + DBG(FUNC, PVT_FMT(target(), "receive a collect call")); + + if(call()->_flags.check(Kflags::DROP_COLLECT)) + DBG(FUNC, PVT_FMT(target(), "flag DROP_COLLECT == true")); + + // do we have to drop collect calls? + bool has_drop_collect_call = call()->_flags.check(Kflags::DROP_COLLECT); + + // do we have to drop THIS call? + bool do_drop_call = has_drop_collect_call && has_recv_collect_call; + + bool do_send_ring = call()->_flags.check(Kflags::NEEDS_RINGBACK_CMD); + + // do we have to send ringback? yes we need !!! + if(do_send_ring) + { + call()->_flags.clear(Kflags::NEEDS_RINGBACK_CMD); + std::string cause = ( do_drop_call ? STG(FMT("r2_cond_b=\"%d\"") % kgbBusy) : "" ); + command(KHOMP_LOG,CM_RINGBACK,cause.c_str()); + + usleep(75000); + } + + if(!(do_drop_call && do_send_ring)) + { + command(KHOMP_LOG, CM_CONNECT); + } + + if(has_drop_collect_call && !do_send_ring) + { + if(has_recv_collect_call) + { + usleep(75000); + + DBG(FUNC, PVT_FMT(target(), "disconnecting collect call doChannelAnswer R2")); + command(KHOMP_LOG,CM_DISCONNECT); + + // thou shalt not talk anymore! + stopListen(); + stopStream(); + } + else + { + DBG(FUNC, PVT_FMT(target(), "dropping collect call at doChannelAnswer")); + command(KHOMP_LOG, CM_DROP_COLLECT_CALL); + } + } + + ret = KhompPvtE1::doChannelAnswer(cmd); + } + catch (ScopedLockFailed & err) + { + LOG(ERROR,PVT_FMT(_target, "unable to lock %s!") % err._msg.c_str() ); + return false; + } + + return ret; +} + +bool BoardE1::KhompPvtR2::doChannelHangup(CommandRequest &cmd) +{ + DBG(FUNC, PVT_FMT(_target, "(R2) c")); + + bool answered = true; + bool disconnected = false; + + try + { + ScopedPvtLock lock(this); + + if (call()->_flags.check(Kflags::IS_INCOMING)) + { + DBG(FUNC,PVT_FMT(_target, "disconnecting incoming channel")); + + //disconnected = command(KHOMP_LOG, CM_DISCONNECT); + } + else if (call()->_flags.check(Kflags::IS_OUTGOING)) + { + if(call()->_cleanup_upon_hangup) + { + DBG(FUNC,PVT_FMT(_target, "disconnecting not allocated outgoing channel...")); + + disconnected = command(KHOMP_LOG, CM_DISCONNECT); + cleanup(KhompPvt::CLN_HARD); + answered = false; + + } + else + { + DBG(FUNC,PVT_FMT(_target, "disconnecting outgoing channel...")); + + disconnected = command(KHOMP_LOG, CM_DISCONNECT); + } + } + else + { + DBG(FUNC,PVT_FMT(_target, "already disconnected")); + return true; + } + + if(answered) + { + indicateBusyUnlocked(SWITCH_CAUSE_USER_BUSY, disconnected); + } + + if (call()->_flags.check(Kflags::IS_INCOMING) && !call()->_flags.check(Kflags::NEEDS_RINGBACK_CMD)) + { + DBG(FUNC,PVT_FMT(_target, "disconnecting incoming channel...")); + disconnected = command(KHOMP_LOG, CM_DISCONNECT); + } + + stopStream(); + + stopListen(); + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "(R2) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + + DBG(FUNC, PVT_FMT(_target, "(R2) r")); + return true; +} + +int BoardE1::KhompPvtISDN::causeFromCallFail(int fail) +{ + int switch_cause = SWITCH_CAUSE_USER_BUSY; + + if (fail <= 127) + switch_cause = fail; + else + switch_cause = SWITCH_CAUSE_INTERWORKING; + + return switch_cause; +} + +void BoardE1::KhompPvtR2::reportFailToReceive(int fail_code) +{ + KhompPvt::reportFailToReceive(fail_code); + + if (Opt::_r2_strict_behaviour && fail_code != -1) + { + DBG(FUNC,PVT_FMT(_target, "sending a 'unknown number' message/audio")); + + if(sendRingBackStatus(fail_code) == RingbackDefs::RBST_UNSUPPORTED) + { + sendPreAudio(RingbackDefs::RB_SEND_DEFAULT); + startCadence(PLAY_FASTBUSY); + } + } + else + { + DBG(FUNC, PVT_FMT(_target, "sending fast busy audio directly")); + + sendPreAudio(RingbackDefs::RB_SEND_DEFAULT); + startCadence(PLAY_FASTBUSY); + } +} + +int BoardE1::KhompPvtR2::causeFromCallFail(int fail) +{ + int switch_cause = SWITCH_CAUSE_USER_BUSY; + + try + { + bool handled = false; + + switch (_r2_country) + { + case Verbose::R2_COUNTRY_ARG: + switch (fail) + { + case kgbArBusy: + switch_cause = SWITCH_CAUSE_USER_BUSY; + break; + case kgbArNumberChanged: + switch_cause = SWITCH_CAUSE_NUMBER_CHANGED; + break; + case kgbArCongestion: + switch_cause = SWITCH_CAUSE_NORMAL_CIRCUIT_CONGESTION; + break; + case kgbArInvalidNumber: + switch_cause = SWITCH_CAUSE_UNALLOCATED_NUMBER; + break; + case kgbArLineOutOfOrder: + switch_cause = SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL; + break; + } + handled = true; + break; + + case Verbose::R2_COUNTRY_BRA: + switch (fail) + { + case kgbBrBusy: + switch_cause = SWITCH_CAUSE_USER_BUSY; + break; + case kgbBrNumberChanged: + switch_cause = SWITCH_CAUSE_NUMBER_CHANGED; + break; + case kgbBrCongestion: + switch_cause = SWITCH_CAUSE_NORMAL_CIRCUIT_CONGESTION; + break; + case kgbBrInvalidNumber: + switch_cause = SWITCH_CAUSE_UNALLOCATED_NUMBER; + break; + case kgbBrLineOutOfOrder: + switch_cause = SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL; + break; + } + handled = true; + break; + case Verbose::R2_COUNTRY_CHI: + switch (fail) + { + case kgbClBusy: + switch_cause = SWITCH_CAUSE_USER_BUSY; + break; + case kgbClNumberChanged: + switch_cause = SWITCH_CAUSE_NUMBER_CHANGED; + break; + case kgbClCongestion: + switch_cause = SWITCH_CAUSE_NORMAL_CIRCUIT_CONGESTION; + break; + case kgbClInvalidNumber: + switch_cause = SWITCH_CAUSE_UNALLOCATED_NUMBER; + break; + case kgbClLineOutOfOrder: + switch_cause = SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL; + break; + } + handled = true; + break; + + case Verbose::R2_COUNTRY_MEX: + switch (fail) + { + case kgbMxBusy: + switch_cause = SWITCH_CAUSE_USER_BUSY; + break; + } + handled = true; + break; + + case Verbose::R2_COUNTRY_URY: + switch (fail) + { + case kgbUyBusy: + switch_cause = SWITCH_CAUSE_USER_BUSY; + break; + case kgbUyNumberChanged: + switch_cause = SWITCH_CAUSE_NUMBER_CHANGED; + break; + case kgbUyCongestion: + switch_cause = SWITCH_CAUSE_NORMAL_CIRCUIT_CONGESTION; + break; + case kgbUyInvalidNumber: + switch_cause = SWITCH_CAUSE_UNALLOCATED_NUMBER; + break; + case kgbUyLineOutOfOrder: + switch_cause = SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL; + break; + } + handled = true; + break; + case Verbose::R2_COUNTRY_VEN: + switch (fail) + { + case kgbVeBusy: + switch_cause = SWITCH_CAUSE_USER_BUSY; + break; + case kgbVeNumberChanged: + switch_cause = SWITCH_CAUSE_NUMBER_CHANGED; + break; + case kgbVeCongestion: + switch_cause = SWITCH_CAUSE_NORMAL_CIRCUIT_CONGESTION; + break; + case kgbVeLineBlocked: + switch_cause = SWITCH_CAUSE_OUTGOING_CALL_BARRED; + break; + } + handled = true; + break; + } + + if (!handled) + throw std::runtime_error(""); + } + catch (...) + { + LOG(ERROR, + PVT_FMT(_target, "country signaling not found, unable to report R2 hangup code..")); + } + + return switch_cause; + +} + +int BoardE1::KhompPvtR2::callFailFromCause(int cause) +{ + int k3l_fail = -1; // default + + try + { + bool handled = false; + + switch (_r2_country) + { + case Verbose::R2_COUNTRY_ARG: + switch (cause) + { + case SWITCH_CAUSE_UNALLOCATED_NUMBER: + case SWITCH_CAUSE_NO_ROUTE_TRANSIT_NET: + case SWITCH_CAUSE_NO_ROUTE_DESTINATION: + case SWITCH_CAUSE_INVALID_NUMBER_FORMAT: + case SWITCH_CAUSE_FACILITY_NOT_SUBSCRIBED: + case SWITCH_CAUSE_INCOMPATIBLE_DESTINATION: + + case SWITCH_CAUSE_INCOMING_CALL_BARRED: /* ?? */ + case SWITCH_CAUSE_OUTGOING_CALL_BARRED: /* ?? */ + k3l_fail = kgbArInvalidNumber; + break; + + case SWITCH_CAUSE_USER_BUSY: + case SWITCH_CAUSE_NO_USER_RESPONSE: + case SWITCH_CAUSE_CALL_REJECTED: + k3l_fail = kgbArBusy; + break; + + case SWITCH_CAUSE_NUMBER_CHANGED: + k3l_fail = kgbArNumberChanged; + break; + + case SWITCH_CAUSE_NORMAL_CIRCUIT_CONGESTION: + case SWITCH_CAUSE_SWITCH_CONGESTION: + + case SWITCH_CAUSE_NORMAL_CLEARING: + case SWITCH_CAUSE_NORMAL_UNSPECIFIED: + case SWITCH_CAUSE_CALL_AWARDED_DELIVERED: /* ?? */ + // this preserves semantics.. + k3l_fail = kgbArCongestion; + break; + + case SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL: + case SWITCH_CAUSE_CHANNEL_UNACCEPTABLE: + case SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER: + case SWITCH_CAUSE_NETWORK_OUT_OF_ORDER: + case SWITCH_CAUSE_FACILITY_REJECTED: + case SWITCH_CAUSE_FACILITY_NOT_IMPLEMENTED: + case SWITCH_CAUSE_CHAN_NOT_IMPLEMENTED: + default: + k3l_fail = kgbArLineOutOfOrder; + break; + } + handled = true; + break; + + case Verbose::R2_COUNTRY_BRA: + switch (cause) + { + case SWITCH_CAUSE_UNALLOCATED_NUMBER: + case SWITCH_CAUSE_NO_ROUTE_TRANSIT_NET: + case SWITCH_CAUSE_NO_ROUTE_DESTINATION: + case SWITCH_CAUSE_INVALID_NUMBER_FORMAT: + case SWITCH_CAUSE_FACILITY_NOT_SUBSCRIBED: + case SWITCH_CAUSE_INCOMPATIBLE_DESTINATION: + + case SWITCH_CAUSE_INCOMING_CALL_BARRED: /* ?? */ + case SWITCH_CAUSE_OUTGOING_CALL_BARRED: /* ?? */ + k3l_fail = kgbBrInvalidNumber; + break; + + case SWITCH_CAUSE_USER_BUSY: + case SWITCH_CAUSE_NO_USER_RESPONSE: + case SWITCH_CAUSE_CALL_REJECTED: + k3l_fail = kgbBrBusy; + break; + + case SWITCH_CAUSE_NUMBER_CHANGED: + k3l_fail = kgbBrNumberChanged; + break; + + case SWITCH_CAUSE_NORMAL_CIRCUIT_CONGESTION: + case SWITCH_CAUSE_SWITCH_CONGESTION: + + case SWITCH_CAUSE_NORMAL_CLEARING: + case SWITCH_CAUSE_NORMAL_UNSPECIFIED: + case SWITCH_CAUSE_CALL_AWARDED_DELIVERED: /* ?? */ + // this preserves semantics.. + k3l_fail = kgbBrCongestion; + break; + + case SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL: + case SWITCH_CAUSE_CHANNEL_UNACCEPTABLE: + case SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER: + case SWITCH_CAUSE_NETWORK_OUT_OF_ORDER: + case SWITCH_CAUSE_FACILITY_REJECTED: + case SWITCH_CAUSE_FACILITY_NOT_IMPLEMENTED: + case SWITCH_CAUSE_CHAN_NOT_IMPLEMENTED: + default: + k3l_fail = kgbBrLineOutOfOrder; + break; + } + handled = true; + break; + + case Verbose::R2_COUNTRY_CHI: + switch (cause) + { + case SWITCH_CAUSE_UNALLOCATED_NUMBER: + case SWITCH_CAUSE_NO_ROUTE_TRANSIT_NET: + case SWITCH_CAUSE_NO_ROUTE_DESTINATION: + case SWITCH_CAUSE_INVALID_NUMBER_FORMAT: + case SWITCH_CAUSE_FACILITY_NOT_SUBSCRIBED: + case SWITCH_CAUSE_INCOMPATIBLE_DESTINATION: + + case SWITCH_CAUSE_INCOMING_CALL_BARRED: /* ?? */ + case SWITCH_CAUSE_OUTGOING_CALL_BARRED: /* ?? */ + k3l_fail = kgbClInvalidNumber; + break; + + case SWITCH_CAUSE_USER_BUSY: + case SWITCH_CAUSE_NO_USER_RESPONSE: + case SWITCH_CAUSE_CALL_REJECTED: + k3l_fail = kgbClBusy; + break; + + case SWITCH_CAUSE_NUMBER_CHANGED: + k3l_fail = kgbClNumberChanged; + break; + + case SWITCH_CAUSE_NORMAL_CIRCUIT_CONGESTION: + case SWITCH_CAUSE_SWITCH_CONGESTION: + + case SWITCH_CAUSE_NORMAL_CLEARING: + case SWITCH_CAUSE_NORMAL_UNSPECIFIED: + case SWITCH_CAUSE_CALL_AWARDED_DELIVERED: /* ?? */ + // this preserves semantics.. + k3l_fail = kgbClCongestion; + break; + + case SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL: + case SWITCH_CAUSE_CHANNEL_UNACCEPTABLE: + case SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER: + case SWITCH_CAUSE_NETWORK_OUT_OF_ORDER: + case SWITCH_CAUSE_FACILITY_REJECTED: + case SWITCH_CAUSE_FACILITY_NOT_IMPLEMENTED: + case SWITCH_CAUSE_CHAN_NOT_IMPLEMENTED: + default: + k3l_fail = kgbClLineOutOfOrder; + break; + } + handled = true; + break; + + + case Verbose::R2_COUNTRY_MEX: + k3l_fail = kgbMxBusy; + handled = true; + break; + + + case Verbose::R2_COUNTRY_URY: + switch (cause) + { + case SWITCH_CAUSE_UNALLOCATED_NUMBER: + case SWITCH_CAUSE_NO_ROUTE_TRANSIT_NET: + case SWITCH_CAUSE_NO_ROUTE_DESTINATION: + case SWITCH_CAUSE_INVALID_NUMBER_FORMAT: + case SWITCH_CAUSE_FACILITY_NOT_SUBSCRIBED: + case SWITCH_CAUSE_INCOMPATIBLE_DESTINATION: + + case SWITCH_CAUSE_INCOMING_CALL_BARRED: /* ?? */ + case SWITCH_CAUSE_OUTGOING_CALL_BARRED: /* ?? */ + k3l_fail = kgbUyInvalidNumber; + break; + + case SWITCH_CAUSE_USER_BUSY: + case SWITCH_CAUSE_NO_USER_RESPONSE: + case SWITCH_CAUSE_CALL_REJECTED: + k3l_fail = kgbUyBusy; + break; + + case SWITCH_CAUSE_NUMBER_CHANGED: + k3l_fail = kgbUyNumberChanged; + break; + + case SWITCH_CAUSE_NORMAL_CIRCUIT_CONGESTION: + case SWITCH_CAUSE_SWITCH_CONGESTION: + + case SWITCH_CAUSE_NORMAL_CLEARING: + case SWITCH_CAUSE_NORMAL_UNSPECIFIED: + case SWITCH_CAUSE_CALL_AWARDED_DELIVERED: /* ?? */ + // this preserves semantics.. + k3l_fail = kgbUyCongestion; + break; + + case SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL: + case SWITCH_CAUSE_CHANNEL_UNACCEPTABLE: + case SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER: + case SWITCH_CAUSE_NETWORK_OUT_OF_ORDER: + case SWITCH_CAUSE_FACILITY_REJECTED: + case SWITCH_CAUSE_FACILITY_NOT_IMPLEMENTED: + case SWITCH_CAUSE_CHAN_NOT_IMPLEMENTED: + default: + k3l_fail = kgbUyLineOutOfOrder; + break; + } + handled = true; + break; + + + case Verbose::R2_COUNTRY_VEN: + switch (cause) + { + case SWITCH_CAUSE_INCOMING_CALL_BARRED: + case SWITCH_CAUSE_OUTGOING_CALL_BARRED: + k3l_fail = kgbVeLineBlocked; + break; + + case SWITCH_CAUSE_NUMBER_CHANGED: + k3l_fail = kgbVeNumberChanged; + break; + + case SWITCH_CAUSE_NORMAL_CIRCUIT_CONGESTION: + case SWITCH_CAUSE_SWITCH_CONGESTION: + + case SWITCH_CAUSE_NORMAL_CLEARING: + case SWITCH_CAUSE_NORMAL_UNSPECIFIED: + case SWITCH_CAUSE_CALL_AWARDED_DELIVERED: /* ?? */ + // this preserves semantics.. + k3l_fail = kgbVeCongestion; + break; + + case SWITCH_CAUSE_UNALLOCATED_NUMBER: + case SWITCH_CAUSE_NO_ROUTE_TRANSIT_NET: + case SWITCH_CAUSE_NO_ROUTE_DESTINATION: + case SWITCH_CAUSE_INVALID_NUMBER_FORMAT: + case SWITCH_CAUSE_FACILITY_NOT_SUBSCRIBED: + case SWITCH_CAUSE_INCOMPATIBLE_DESTINATION: + + case SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL: + case SWITCH_CAUSE_CHANNEL_UNACCEPTABLE: + case SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER: + case SWITCH_CAUSE_NETWORK_OUT_OF_ORDER: + case SWITCH_CAUSE_FACILITY_REJECTED: + case SWITCH_CAUSE_FACILITY_NOT_IMPLEMENTED: + case SWITCH_CAUSE_CHAN_NOT_IMPLEMENTED: + + case SWITCH_CAUSE_USER_BUSY: + case SWITCH_CAUSE_NO_USER_RESPONSE: + case SWITCH_CAUSE_CALL_REJECTED: + default: + k3l_fail = kgbVeBusy; + break; + } + + handled = true; + break; + + } + + if (!handled) + throw std::runtime_error(""); + } + catch(...) + { + LOG(ERROR,PVT_FMT(_target, "country signaling not found, unable to report R2 hangup code.")); + } + + return k3l_fail; +} + +int BoardE1::KhompPvtISDN::callFailFromCause(int cause) +{ + int k3l_fail = -1; // default + + if (cause <= 127) + k3l_fail = cause; + else + k3l_fail = kq931cInterworking; + + return k3l_fail; +} + +RingbackDefs::RingbackStType BoardE1::KhompPvtR2::sendRingBackStatus(int rb_value) +{ + DBG(FUNC,PVT_FMT(_target, "(p=%p) this is the r2 ringback procedure") % this); + + std::string cause = (rb_value == -1 ? "" : STG(FMT("r2_cond_b=\"%d\"") % rb_value)); + return (command(KHOMP_LOG, CM_RINGBACK, cause.c_str()) ? + RingbackDefs::RBST_SUCCESS : RingbackDefs::RBST_FAILURE); +} + +bool BoardE1::KhompPvtR2::sendPreAudio(int rb_value) +{ + DBG(FUNC,PVT_FMT(_target, "must send R2 preaudio ?")); + if(!KhompPvtE1::sendPreAudio(rb_value)) + return false; + + + DBG(FUNC,PVT_FMT(_target, "doing the R2 pre_connect wait...")); + + /* wait some ms, just to be sure the command has been sent. */ + usleep(Opt::_r2_preconnect_wait * 1000); + + if (call()->_flags.check(Kflags::HAS_PRE_AUDIO)) + { + DBG(FUNC, PVT_FMT(target(), "(p=%p) already pre_connect") % this); + return true; + } + else + { + bool result = command(KHOMP_LOG, CM_PRE_CONNECT); + + if (result) + call()->_flags.set(Kflags::HAS_PRE_AUDIO); + + return result; + } +} + +void BoardE1::KhompPvtR2::numberDialTimer(Board::KhompPvt * pvt) +{ + try + { + ScopedPvtLock lock(pvt); + + if (!pvt->call()->_flags.check(Kflags::NUMBER_DIAL_ONGOING) || + pvt->call()->_flags.check(Kflags::NUMBER_DIAL_FINISHD)) + { + return; + } + + pvt->call()->_flags.set(Kflags::NUMBER_DIAL_FINISHD); + + static_cast<BoardE1::KhompPvtR2*>(pvt)->callR2()->_incoming_exten.clear(); + pvt->command(KHOMP_LOG, CM_END_OF_NUMBER); + } + catch (...) + { + // TODO: log something. + } +} + +bool BoardE1::KhompPvtR2::indicateRinging() +{ + DBG(FUNC, PVT_FMT(_target, "(R2) c")); + + bool ret = false; + try + { + ScopedPvtLock lock(this); + + /* already playing! */ + if (call()->_indication != INDICA_NONE) + { + DBG(FUNC, PVT_FMT(_target, "(R2) r (already playing something: %d)") % call()->_indication); + return false; + } + + // any collect calls ? + setCollectCall(); + + call()->_indication = INDICA_RING; + + bool send_ringback = true; + + if (!call()->_flags.check(Kflags::CONNECTED)) + { + int ringback_value = RingbackDefs::RB_SEND_DEFAULT; + + bool do_drop_call = Opt::_drop_collect_call + || call()->_flags.check(Kflags::DROP_COLLECT); + + if (do_drop_call && call()->_collect_call) + { + ringback_value = kgbBusy; + DBG(FUNC, PVT_FMT(_target, "ringback value adjusted to refuse collect call: %d") % ringback_value); + } + + const char *condition_string = getFSChannelVar("KR2SendCondition"); + + try + { + if (condition_string) + { + ringback_value = Strings::toulong(condition_string); + DBG(FUNC, PVT_FMT(_target, "KR2SendCondition adjusted ringback value to %d") % ringback_value); + } + } + catch (Strings::invalid_value e) + { + LOG(ERROR, PVT_FMT(_target, "invalid value '%s', adjusted in KR2SendCondition: not a valid number.") + % condition_string); + } + + if (Opt::_r2_strict_behaviour) + { + /* send ringback too? */ + send_ringback = sendPreAudio(ringback_value); + + if (!send_ringback) + { + /* warn the developer which may be debugging some "i do not have ringback!" issue. */ + DBG(FUNC, PVT_FMT(_target, "not sending pre connection audio")); + } + + call()->_flags.clear(Kflags::NEEDS_RINGBACK_CMD); + } + + } + + if (send_ringback) + { + DBG(FUNC, PVT_FMT(_target, "Send ringback!")); + + call()->_flags.set(Kflags::GEN_CO_RING); + call()->_idx_co_ring = Board::board(_target.device)->_timers.add(Opt::_ringback_co_delay, &Board::KhompPvt::coRingGen,this); + + /* start grabbing audio */ + startListen(); + + /* start stream if it is not already */ + startStream(); + + ret = true; + } + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "(R2) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR,PVT_FMT(_target, "(R2) r (%s)") % err._msg.c_str()); + return false; + } + catch (K3LAPI::invalid_device & err) + { + LOG(ERROR, PVT_FMT(_target, "(R2) r (unable to get device: %d!)") % err.device); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "(R2) r")); + return ret; +} + +bool BoardE1::KhompPvtR2::onNewCall(K3L_EVENT *e) +{ + DBG(FUNC,PVT_FMT(_target, "(R2) c")); + + std::string r2_categ_a; + + int status = Globals::k3lapi.get_param(e, "r2_categ_a", r2_categ_a); + + try + { + ScopedPvtLock lock(this); + + if (status == ksSuccess && !r2_categ_a.empty()) + { + + try + { + callR2()->_r2_category = Strings::toulong(r2_categ_a); + } + catch (Strings::invalid_value e) + { + /* do nothing */ + }; + + /* channel will know if is a collect call or not */ + if (callR2()->_r2_category == kg2CollectCall) + { + call()->_collect_call = true; + } + } + + bool ret = KhompPvtE1::onNewCall(e); + + if(!ret) + return false; + + if (!Opt::_r2_strict_behaviour) + { + bool do_drop_collect = Opt::_drop_collect_call; + const char* drop_str = getFSGlobalVar("KDropCollectCall"); + + if(checkTrueString(drop_str)) + { + do_drop_collect = true; + call()->_flags.set(Kflags::DROP_COLLECT); + DBG(FUNC,PVT_FMT(_target, "Setting DROP_COLLECT flag")); + } + + // keeping the hardcore mode + if (do_drop_collect && call()->_collect_call) + { + // kill, kill, kill!!! + DBG(FUNC,PVT_FMT(_target, "dropping collect call at onNewCall")); + sendRingBackStatus(callFailFromCause(SWITCH_CAUSE_CALL_REJECTED)); + usleep(75000); + } + else + { + // send ringback too! + sendPreAudio(RingbackDefs::RB_SEND_DEFAULT); + startStream(); + } + } + else + { + _call->_flags.set(Kflags::NEEDS_RINGBACK_CMD); + } + } + catch(ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(target(), "(R2) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC,PVT_FMT(_target, "(R2) r")); + + return true; +} + +bool BoardE1::KhompPvtR2::onCallSuccess(K3L_EVENT *e) +{ + try + { + ScopedPvtLock lock(this); + + if(e->AddInfo > 0) + { + callR2()->_r2_condition = e->AddInfo; + setFSChannelVar("KR2GotCondition", Verbose::signGroupB((KSignGroupB)callR2()->_r2_condition).c_str()); + } + + KhompPvtE1::onCallSuccess(e); + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(target(), "unable to lock %s!") % err._msg.c_str() ); + return false; + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR,PVT_FMT(_target, "%s") % err._msg.c_str()); + return false; + } + + return true; +} + +bool BoardE1::KhompPvtR2::onCallFail(K3L_EVENT *e) +{ + bool ret = true; + + try + { + ScopedPvtLock lock(this); + + if(e->AddInfo > 0) + { + callR2()->_r2_condition = e->AddInfo; + setFSChannelVar("KR2GotCondition", Verbose::signGroupB((KSignGroupB)callR2()->_r2_condition).c_str()); + } + + setHangupCause(causeFromCallFail(e->AddInfo),true); + + ret = KhompPvtE1::onCallFail(e); + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(target(), "unable to lock %s!") % err._msg.c_str() ); + return false; + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR,PVT_FMT(_target, "%s") % err._msg.c_str()); + return false; + } + + return ret; +} + +bool BoardE1::KhompPvtR2::onNumberDetected(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_target, "(digit=%d) c") % e->AddInfo); + + try + { + ScopedPvtLock lock(this); + + if (call()->_flags.check(Kflags::NUMBER_DIAL_FINISHD)) + return false; + + if (!call()->_flags.check(Kflags::NUMBER_DIAL_ONGOING)) + { + DBG(FUNC, PVT_FMT(_target, "incoming number start...")); + + call()->_flags.set(Kflags::NUMBER_DIAL_ONGOING); + callR2()->_incoming_exten.clear(); + + callR2()->_idx_number_dial = Board::board(_target.device)->_timers.add(4000, + &BoardE1::KhompPvtR2::numberDialTimer, this, TM_VAL_CALL); + } + else + { + Board::board(_target.device)->_timers.restart(callR2()->_idx_number_dial); + } + + callR2()->_incoming_exten += e->AddInfo; + + DBG(FUNC, PVT_FMT(_target, "incoming exten %s") % callR2()->_incoming_exten); + + /* begin context adjusting + processing */ + Board::KhompPvt::ContextListType contexts; + + validContexts(contexts); + + /* temporary */ + std::string tmp_exten("s"); + std::string tmp_context("default"); + std::string tmp_orig(""); + + switch (findExtension(tmp_exten, tmp_context, contexts, callR2()->_incoming_exten,tmp_orig, false, false)) + { + case MATCH_EXACT: + case MATCH_NONE: + call()->_flags.set(Kflags::NUMBER_DIAL_FINISHD); + + DBG(FUNC,FMT("incoming exten matched: %s") % callR2()->_incoming_exten); + + callR2()->_incoming_exten.clear(); + command(KHOMP_LOG,CM_END_OF_NUMBER); + break; + + case MATCH_MORE: + DBG(FUNC, "didn't match exact extension, waiting..."); + // cannot say anything exact about the number, do nothing... + break; + } + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(target(), "unable to lock %s!") % err._msg.c_str() ); + return false; + } + catch (K3LAPI::invalid_device & err) + { + LOG(ERROR, PVT_FMT(_target, "unable to get device: %d!") % err.device); + return false; + } + + return true; +} + +bool BoardE1::KhompPvtFlash::application(ApplicationType type, switch_core_session_t * session, const char *data) +{ + switch(type) + { + case USER_TRANSFER: + return _transfer->userTransfer(session, data); + default: + return KhompPvtR2::application(type, session, data); + } + + return true; +} + +bool BoardE1::KhompPvtFlash::sendDtmf(std::string digit) +{ + if(_transfer->checkUserXferUnlocked(digit)) + { + DBG(FUNC, PVT_FMT(target(), "started (or waiting for) an user xfer")); + return true; + } + + bool ret = KhompPvtR2::sendDtmf(callFlash()->_digits_buffer); + + callFlash()->_digits_buffer.clear(); + + return ret; +} + +Opt::OrigToNseqMapType BoardE1::KhompPvtFXS::generateNseqMap() +{ + Opt::OrigToNseqMapType fxs_nseq; /* sequence numbers on FXS */ + + fxs_nseq.insert(Opt::OrigToNseqPairType("", 0)); /* global sequence */ + + for (Opt::BoardToOrigMapType::iterator i = Opt::_fxs_orig_base.begin(); i != Opt::_fxs_orig_base.end(); i++) + { + fxs_nseq.insert(Opt::OrigToNseqPairType((*i).second, 0)); + } + + return fxs_nseq; +} + + +void BoardE1::KhompPvtFXS::load(Opt::OrigToNseqMapType & fxs_nseq) +{ + Opt::BoardToOrigMapType::iterator it1 = Opt::_fxs_orig_base.find(_target.device); + Opt::OrigToNseqMapType::iterator it2; + + std::string orig_base("invalid"); /* will have orig base */ + + if (it1 == Opt::_fxs_orig_base.end()) + { + it2 = fxs_nseq.find(""); + orig_base = Opt::_fxs_global_orig_base; + } + else + { + it2 = fxs_nseq.find((*it1).second); + orig_base = (*it1).second; + } + + if (it2 == fxs_nseq.end()) + { + LOG(ERROR, PVT_FMT(_target, "could not find sequence number for FXS channel")); + + /* Ok, load the default options */ + loadOptions(); + } + else + { + try + { + /* generate orig_addr, padding to the original size (adding zeros at left) */ + _fxs_fisical_addr = padOrig(orig_base, (*it2).second); + + /* Set this branch options to get right callerid before mapping */ + loadOptions(); + + /* makes a "reverse mapping" for Dial using 'r' identifiers */ + Opt::_fxs_branch_map.insert(Opt::BranchToObjectPairType(_fxs_orig_addr, + Opt::ObjectIdType(_target.device, _target.object))); + + /* increment sequence number */ + ++((*it2).second); + } + catch (Strings::invalid_value e) + { + LOG(ERROR, PVT_FMT(_target, "expected an integer, got string '%s'") + % e.value() ); + } + } +} + +void BoardE1::KhompPvtFXS::loadOptions() +{ + /* the fxs_orig_addr can be reset on parse_branch_options */ + _fxs_orig_addr = _fxs_fisical_addr; + + /* Initialize fxs default options */ + _calleridname.clear(); + _amaflags = Opt::_amaflags; + _callgroup = Opt::_callgroup; + _pickupgroup = Opt::_pickupgroup; + _context.clear(); + _input_volume = Opt::_input_volume; + _output_volume = Opt::_output_volume; + _mohclass = Opt::_global_mohclass; + _language = Opt::_global_language; + _accountcode = Opt::_accountcode; + _mailbox.clear(); + + Opt::BranchToOptMapType::iterator it3 = Opt::_branch_options.find(_fxs_orig_addr); + + if (it3 != Opt::_branch_options.end()) + { + parseBranchOptions(it3->second); + } + + //TODO: Implementar o setVolume para levar em consideracao que o + // padrao pode ser o da FXS + if (_input_volume != Opt::_input_volume) + setVolume("input", _input_volume); + if (_output_volume != Opt::_output_volume) + setVolume("output", _output_volume); +} + +bool BoardE1::KhompPvtFXS::parseBranchOptions(std::string options_str) +{ + Strings::vector_type options; + Strings::tokenize(options_str, options, "|/"); + + if (options.size() < 1) + { + DBG(FUNC, PVT_FMT(_target, "[fxs-options] no options are set for branch %s.") % + _fxs_orig_addr.c_str()); + return false; + } + + try + { + for (Strings::vector_type::iterator it = options.begin(); it != options.end(); it++) + { + Strings::vector_type par; + Strings::tokenize(Strings::trim(*it), par, ":"); + + if ( par.size() != 2 ) + { + LOG(WARNING, PVT_FMT(_target, "[fxs-options] error on parsing options for branch %s.") % _fxs_orig_addr.c_str()); + return false; + } + + std::string opt_name = Strings::trim(par.at(0)); + std::string opt_value = Strings::trim(par.at(1)); + + if (opt_name == "pickupgroup") + { + _pickupgroup = opt_value;//ast_get_group(opt_value.c_str()); + } + else if (opt_name == "callgroup") + { + _callgroup = opt_value;//ast_get_group(opt_value.c_str()); + } + /* + else if (opt_name == "amaflags") + { + int amaflags = ast_cdr_amaflags2int(opt_value.c_str()); + + if (amaflags < 0) + DBG(FUNC, PVT_FMT(_target, "[fxs-options] invalid AMA flags on branch %s.") % _fxs_orig_addr.c_str()); + else + _amaflags = amaflags; + } + */ + else if (opt_name == "context") + { + _context = opt_value; + } + else if (opt_name == "input-volume") + { + long long volume = Strings::tolong(opt_value); + + if ( (volume < -10) || (volume > 10) ) + { + DBG(FUNC, PVT_FMT(_target, "[fxs-options] input-volume on branch %s.") % _fxs_orig_addr.c_str()); + } + else + { + _input_volume = volume; + } + } + else if (opt_name == "output-volume") + { + long long volume = Strings::tolong(opt_value); + + if ( (volume < -10) || (volume > 10) ) + { + DBG(FUNC, PVT_FMT(_target, "[fxs-options] ouput-volume on branch %s.") % _fxs_orig_addr.c_str()); + } + else + { + _output_volume = volume; + } + } + else if (opt_name == "language") + { + _language = opt_value; + } + else if (opt_name == "mohclass") + { + _mohclass = opt_value; + } + else if (opt_name == "accountcode") + { + _accountcode = opt_value; + } + else if (opt_name == "calleridnum") // conscious ultra chuncho! + { + Opt::BranchToOptMapType::iterator it3 = Opt::_branch_options.find(_fxs_orig_addr); + + if (it3 != Opt::_branch_options.end()) + { + Opt::_branch_options.insert(Opt::BranchToOptPairType(opt_value, it3->second)); + + Opt::_branch_options.erase(it3); + } + + _fxs_orig_addr = opt_value; + } + else if (opt_name == "calleridname") + { + _calleridname = opt_value; + } + else if (opt_name == "mailbox") + { + _mailbox = opt_value; + } + else + { + DBG(FUNC, PVT_FMT(_target, "[fxs-options] invalid option on branch %s: \"%s\".") % _fxs_orig_addr.c_str() % opt_name.c_str()); + } + } + } + catch (Strings::invalid_value e) + { + LOG(WARNING, PVT_FMT(_target, "[fxs-options] number expected on Khomp configuration file, got '%s'.") % e.value().c_str()); + return false; + } + + return true; +} + +bool BoardE1::KhompPvtFXS::alloc() +{ + DBG(FUNC, PVT_FMT(_target, "(FXS) c")); + + callFXS()->_flags.set(Kflags::FXS_DIAL_FINISHD); + + if(justStart(/*need_context*/) != SWITCH_STATUS_SUCCESS) + { + int fail_code = callFailFromCause(SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL); + setHangupCause(SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL); + cleanup(CLN_FAIL); + reportFailToReceive(fail_code); + LOG(ERROR, PVT_FMT(target(), "(FXS) r (Initilization Error on start!)")); + return false; + } + + startListen(); + startStream(); + + /* do this procedures early (as audio is already being heard) */ + dtmfSuppression(Opt::_out_of_band_dtmfs && !callFXS()->_flags.check(Kflags::FAX_DETECTED)); + echoCancellation(Opt::_echo_canceller && !callFXS()->_flags.check(Kflags::FAX_DETECTED)); + autoGainControl(Opt::_auto_gain_control && !callFXS()->_flags.check(Kflags::FAX_DETECTED)); + + /* if it does not need context, probably it's a pickupcall and will + not pass throw setup_connection, so we start recording here*/ + //if (!need_context && K::opt::recording && !pvt->is_recording) + //startRecord(); + + DBG(FUNC, "(FXS) r"); + return true; +} + + +bool BoardE1::KhompPvtFXS::onSeizureStart(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_target, "(FXS) c")); + + bool ret = true; + + try + { + ScopedPvtLock lock(this); + + /* we always have audio */ + call()->_flags.set(Kflags::HAS_PRE_AUDIO); + + ret = KhompPvt::onSeizureStart(e); + + if (justAlloc(true) != SWITCH_STATUS_SUCCESS) + { + int fail_code = callFailFromCause(SWITCH_CAUSE_UNALLOCATED_NUMBER); + setHangupCause(SWITCH_CAUSE_UNALLOCATED_NUMBER); + cleanup(CLN_FAIL); + reportFailToReceive(fail_code); + LOG(ERROR,PVT_FMT(_target, "(FXS) r (Initilization Error on alloc!)")); + return false; + } + + /* desabilita para evitar problemas de detecção de DTMF */ + echoCancellation(false); + autoGainControl(false); + + call()->_orig_addr = _fxs_orig_addr; + + Opt::OrigToDestMapType::iterator i = Opt::_fxs_hotline.find(_fxs_orig_addr); + + if (i != Opt::_fxs_hotline.end()) + { + /* make it burn! */ + call()->_dest_addr = (*i).second; + alloc(); + } + else + { + /* normal line */ + if (!_mailbox.empty() /*&& (ast_app_has_voicemail(pvt->fxs_opt.mailbox.c_str(), NULL) == 1)*/) + startCadence(PLAY_VM_TONE); + else + startCadence(PLAY_PBX_TONE); + + call()->_flags.clear(Kflags::FXS_DIAL_ONGOING); + call()->_flags.set(Kflags::FXS_OFFHOOK); + } + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR,PVT_FMT(_target, "(FXS) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "(FXS) r")); + + return ret; +} + +bool BoardE1::KhompPvtFXS::onCallSuccess(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_target, "(FXS) c")); + + bool ret; + + try + { + ScopedPvtLock lock(this); + + ret = KhompPvt::onCallSuccess(e); + + if (call()->_pre_answer) + { + dtmfSuppression(Opt::_out_of_band_dtmfs); + + startListen(); + startStream(); + } + else + { + call()->_flags.set(Kflags::GEN_PBX_RING); + call()->_idx_pbx_ring = Board::board(_target.device)->_timers.add( + Opt::_ringback_pbx_delay, + &Board::KhompPvt::pbxRingGen, + this, + TM_VAL_CALL); + } + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "(FXS) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + catch (K3LAPI::invalid_device & err) + { + LOG(ERROR, PVT_FMT(_target, "(FXS) r (unable to get device: %d!)") % err.device); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "(FXS) r")); + + return ret; +} + +void BoardE1::KhompPvtFXS::dialTimer(KhompPvt * pvt) +{ + DBG(FUNC, PVT_FMT(pvt->target(), "FXS Dial timer")); + + try + { + ScopedPvtLock lock(pvt); + + KhompPvtFXS * pvt_fxs = static_cast<BoardE1::KhompPvtFXS*>(pvt); + + if(!pvt_fxs->callFXS()->_flags.check(Kflags::FXS_DIAL_ONGOING) + || pvt_fxs->callFXS()->_flags.check(Kflags::FXS_DIAL_FINISHD)) + return; + + pvt_fxs->call()->_dest_addr = pvt_fxs->callFXS()->_incoming_exten; + pvt_fxs->alloc(); + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(pvt->target(), "unable to lock %s!") % err._msg.c_str()); + } + +} + +void BoardE1::KhompPvtFXS::transferTimer(KhompPvt * pvt) +{ + DBG(FUNC, PVT_FMT(pvt->target(), "c")); + + try + { + ScopedPvtLock lock(pvt); + + KhompPvtFXS * pvt_fxs = static_cast<BoardE1::KhompPvtFXS*>(pvt); + + if(!pvt_fxs->callFXS()->_flags.check(Kflags::FXS_FLASH_TRANSFER)) + { + DBG(FUNC, PVT_FMT(pvt->target(), "r (Flag not set)")); + return; + } + + pvt_fxs->callFXS()->_flags.clear(Kflags::FXS_FLASH_TRANSFER); + + if(pvt_fxs->callFXS()->_flash_transfer.empty()) + { + DBG(FUNC, PVT_FMT(pvt->target(), "r (Number is empty)")); + + if(!pvt_fxs->stopTransfer()) + { + pvt_fxs->cleanup(KhompPvt::CLN_HARD); + DBG(FUNC, PVT_FMT(pvt_fxs->target(), "r (unable to stop transfer)")); + return; + } + + return; + } + + /* begin context adjusting + processing */ + ContextListType contexts; + + pvt_fxs->validContexts(contexts); + + std::string tmp_exten("s"); + std::string tmp_context("default"); + + switch (pvt_fxs->findExtension(tmp_exten, tmp_context, contexts, pvt_fxs->callFXS()->_flash_transfer, pvt_fxs->call()->_orig_addr, false, false)) + { + case MATCH_EXACT: + case MATCH_MORE: + { + DBG(FUNC,FMT("incoming exten matched: %s") % pvt_fxs->callFXS()->_flash_transfer); + + if(!pvt_fxs->transfer(tmp_context)) + { + pvt_fxs->cleanup(KhompPvt::CLN_HARD); + DBG(FUNC, PVT_FMT(pvt_fxs->target(), "r (unable to transfer)")); + return; + } + + break; + } + case MATCH_NONE: + { + DBG(FUNC, PVT_FMT(pvt_fxs->target(), "match none!")); + + if(!pvt_fxs->stopTransfer()) + { + pvt_fxs->cleanup(KhompPvt::CLN_HARD); + DBG(FUNC, PVT_FMT(pvt_fxs->target(), "r (unable to stop transfer)")); + return; + } + + break; + } + } + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(pvt->target(), "r (unable to lock %s!)") % err._msg.c_str()); + return; + } + + DBG(FUNC, PVT_FMT(pvt->target(), "r")); + +} + +bool BoardE1::KhompPvtFXS::onChannelRelease(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_target, "(FXS) c")); + + bool ret = true; + + try + { + ScopedPvtLock lock(this); + + if(!callFXS()->_uuid_other_session.empty() && session()) + { + /* + switch_core_session_t *hold_session; + + if ((hold_session = switch_core_session_locate(callFXS()->_uuid_other_session.c_str()))) + { + switch_channel_t * hold = switch_core_session_get_channel(hold_session); + switch_channel_stop_broadcast(hold); + switch_channel_wait_for_flag(hold, CF_BROADCAST, SWITCH_FALSE, 5000, NULL); + switch_core_session_rwunlock(hold_session); + } + */ + try + { + /* get other side of the bridge */ + switch_core_session_t * peer_session = getFSLockedPartnerSession(); + unlockPartner(peer_session); + DBG(FUNC, PVT_FMT(target(), "bridge with the new session")); + switch_ivr_uuid_bridge(getUUID(peer_session), callFXS()->_uuid_other_session.c_str()); + + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + DBG(FUNC, PVT_FMT(target(), "no partner: %s!") % err._msg.c_str()); + } + + callFXS()->_uuid_other_session.clear(); + } + + ret = KhompPvt::onChannelRelease(e); + + } + catch(ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(target(), "(FXS) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "(FXS) r")); + return ret; + +} + +bool BoardE1::KhompPvtFXS::startTransfer() +{ + DBG(FUNC, PVT_FMT(target(), "c")); + + try + { + switch_core_session_t *peer_session = getFSLockedPartnerSession(); + switch_channel_t *peer_channel = getFSChannel(peer_session); + + const char *stream = NULL; + + if (!(stream = getFSChannelVar(peer_channel, SWITCH_HOLD_MUSIC_VARIABLE))) + { + stream = "silence"; + } + + unlockPartner(peer_session); + + DBG(FUNC, PVT_FMT(target(), "stream=%s") % stream); + + if (stream && strcasecmp(stream, "silence")) + { + // Freeswitch not get/put frames + //switch_channel_set_flag(channel, CF_HOLD); + switch_ivr_broadcast(getUUID(peer_session), stream, SMF_ECHO_ALEG | SMF_LOOP); + } + + callFXS()->_flags.set(Kflags::FXS_FLASH_TRANSFER); + + startCadence(PLAY_PBX_TONE); + + callFXS()->_idx_transfer = Board::board(_target.device)->_timers.add(Opt::_fxs_digit_timeout * 1000, &BoardE1::KhompPvtFXS::transferTimer, this, TM_VAL_CALL); + + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + //cleanup(KhompPvt::CLN_HARD); + LOG(ERROR, PVT_FMT(target(), "r (no valid partner %s!)") % err._msg.c_str()); + return false; + } + catch (K3LAPI::invalid_device & err) + { + LOG(ERROR, PVT_FMT(_target, "unable to get device: %d!") % err.device); + } + + //switch_ivr_hold_uuid(switch_core_session_get_uuid(session()), NULL, SWITCH_TRUE); + DBG(FUNC, PVT_FMT(target(), "r")); + + return true; +} + +bool BoardE1::KhompPvtFXS::stopTransfer() +{ + DBG(FUNC, PVT_FMT(target(), "c")); + + callFXS()->_flags.clear(Kflags::FXS_FLASH_TRANSFER); + + callFXS()->_flash_transfer.clear(); + + stopCadence(); + + try + { + Board::board(_target.device)->_timers.del(callFXS()->_idx_transfer); + } + catch (K3LAPI::invalid_device & err) + { + LOG(ERROR, PVT_FMT(_target, "unable to get device: %d!") % err.device); + } + + try + { + /* get other side of the bridge */ + switch_core_session_t * peer_session = getFSLockedPartnerSession(); + switch_channel_t * peer_channel = getFSChannel(peer_session); + + switch_channel_stop_broadcast(peer_channel); + switch_channel_wait_for_flag(peer_channel, CF_BROADCAST, SWITCH_FALSE, 5000, NULL); + + unlockPartner(peer_session); + + //switch_ivr_unhold_uuid(switch_core_session_get_uuid(session())); + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR, PVT_FMT(target(), "r (no valid partner %s!)") % err._msg.c_str()); + return false; + } + + DBG(FUNC, PVT_FMT(target(), "r")); + return true; +} + +static switch_status_t xferHook(switch_core_session_t *session) +{ + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_channel_state_t state = switch_channel_get_state(channel); + + DBG(FUNC, D("state change=%d") % state); + + if (state == CS_PARK) + { + switch_core_event_hook_remove_state_change(session, xferHook); + + BoardE1::KhompPvtFXS * pvt = static_cast<BoardE1::KhompPvtFXS*>(switch_core_session_get_private(session)); + + if(!pvt) + { + DBG(FUNC, D("pvt is NULL")); + return SWITCH_STATUS_FALSE; + } + + try + { + ScopedPvtLock lock(pvt); + + if(!pvt->callFXS()->_uuid_other_session.empty()) + { + DBG(FUNC, D("bridge after park")); + std::string number = pvt->callFXS()->_uuid_other_session; + pvt->callFXS()->_uuid_other_session.clear(); + + switch_ivr_uuid_bridge(pvt->getUUID(), number.c_str()); + } + } + catch(ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(pvt->target(), "unable to lock: %s!") % err._msg.c_str()); + return SWITCH_STATUS_FALSE; + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR, PVT_FMT(pvt->target(), "%s!") % err._msg.c_str()); + return SWITCH_STATUS_FALSE; + } + + } + else if (state == CS_HANGUP) + { + switch_core_event_hook_remove_state_change(session, xferHook); +/* + BoardE1::KhompPvtFXS * pvt = static_cast<BoardE1::KhompPvtFXS*>(switch_core_session_get_private(session)); + + if(!pvt) + { + DBG(FUNC, D("pvt is NULL")); + return SWITCH_STATUS_FALSE; + } + + try + { + ScopedPvtLock lock(pvt); + + if(!pvt->callFXS()->_uuid_other_session.empty()) + { + DBG(FUNC, D("bridge after hangup")); + std::string number = pvt->callFXS()->_uuid_other_session; + pvt->callFXS()->_uuid_other_session.clear(); + + switch_ivr_uuid_bridge(switch_core_session_get_uuid(session), number.c_str()); + } + } + catch(ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(pvt->target(), "unable to lock: %s!") % err._msg.c_str()); + } +*/ + } + + return SWITCH_STATUS_SUCCESS; +} + +bool BoardE1::KhompPvtFXS::transfer(std::string & context, bool blind) +{ + DBG(FUNC, PVT_FMT(target(), "c")); + + callFXS()->_flags.clear(Kflags::FXS_FLASH_TRANSFER); + + std::string number = callFXS()->_flash_transfer; + callFXS()->_flash_transfer.clear(); + + try + { + Board::board(_target.device)->_timers.del(callFXS()->_idx_transfer); + } + catch (K3LAPI::invalid_device & err) + { + LOG(ERROR, PVT_FMT(_target, "unable to get device: %d!") % err.device); + } + + try + { + /* get other side of the bridge */ + switch_core_session_t * peer_session = getFSLockedPartnerSession(); + switch_channel_t * peer_channel = getFSChannel(peer_session); + + switch_channel_stop_broadcast(peer_channel); + switch_channel_wait_for_flag(peer_channel, CF_BROADCAST, SWITCH_FALSE, 5000, NULL); + + unlockPartner(peer_session); + + if(blind) + { + DBG(FUNC, PVT_FMT(_target, "Blind Transfer")); + switch_ivr_session_transfer(peer_session, number.c_str(), "XML", context.c_str()); + } + else + { + DBG(FUNC, PVT_FMT(_target, "Attended Transfer")); + + if(!callFXS()->_uuid_other_session.empty()) + { + DBG(FUNC, PVT_FMT(target(), "second transfer, hang up session")); + } + else + { + DBG(FUNC, PVT_FMT(target(), "first transfer")); + callFXS()->_uuid_other_session = getUUID(peer_session); + const char *stream = NULL; + + if (!(stream = switch_channel_get_variable(peer_channel, SWITCH_HOLD_MUSIC_VARIABLE))) + { + stream = "silence"; + } + + DBG(FUNC, PVT_FMT(target(), "transfer stream=%s") % stream); + + if (stream && strcasecmp(stream, "silence")) + { + std::string moh = STR(FMT("endless_playback:%s,park") % stream); + switch_ivr_session_transfer(peer_session, moh.c_str(), "inline", NULL); + } + else + { + switch_ivr_session_transfer(peer_session, "endless_playback:local_stream://moh,park", "inline", NULL); + //switch_ivr_session_transfer(peer_session, "park", "inline", NULL); + } + } + + switch_channel_t * channel = getFSChannel(); + switch_channel_set_variable(channel, SWITCH_PARK_AFTER_BRIDGE_VARIABLE, "true"); + switch_core_event_hook_add_state_change(session(), xferHook); + + switch_ivr_session_transfer(session(), number.c_str(), "XML", context.c_str()); + + DBG(FUNC, PVT_FMT(target(), "Generating ring")); + call()->_indication = INDICA_RING; + call()->_flags.set(Kflags::GEN_CO_RING); + startCadence(PLAY_RINGBACK); + + /* + try + { + call()->_idx_co_ring = Board::board(_target.device)->_timers.add(Opt::_ringback_co_delay, &Board::KhompPvt::coRingGen,this); + } + catch (K3LAPI::invalid_device & err) + { + LOG(ERROR, PVT_FMT(_target, "unable to get device: %d!") % err.device); + } + */ + } + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR, PVT_FMT(target(), "r (no valid partner %s!)") % err._msg.c_str()); + return false; + } + + DBG(FUNC, PVT_FMT(target(), "r")); + + return true; +} + +bool BoardE1::KhompPvtFXS::onDtmfDetected(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_target, "(FXS) c (dtmf=%c)") % (char) e->AddInfo); + + bool ret = true; + + try + { + ScopedPvtLock lock(this); + + if (call()->_flags.check(Kflags::IS_INCOMING) && + callFXS()->_flags.check(Kflags::FXS_OFFHOOK) && + !callFXS()->_flags.check(Kflags::FXS_DIAL_FINISHD)) + { + DBG(FUNC, PVT_FMT(_target, "dialing")); + + if (call()->_cadence == PLAY_PBX_TONE) + { + stopCadence(); + } + + if (call()->_cadence == PLAY_PUB_TONE) + { + stopCadence(); + //call()->_cadence = PLAY_NONE; + //mixer(KHOMP_LOG, 1, kmsGenerator, kmtSilence); + } + + if (!callFXS()->_flags.check(Kflags::FXS_DIAL_ONGOING)) + { + DBG(FUNC, PVT_FMT(_target, "dialing started now, clearing stuff..")); + + callFXS()->_flags.set(Kflags::FXS_DIAL_ONGOING); + + callFXS()->_incoming_exten.clear(); + + mixer(KHOMP_LOG, 1, kmsGenerator, kmtSilence); + + callFXS()->_idx_dial = Board::board(_target.device)->_timers.add(Opt::_fxs_digit_timeout * 1000, &BoardE1::KhompPvtFXS::dialTimer, this, TM_VAL_CALL); + } + else + { + Board::board(_target.device)->_timers.restart(callFXS()->_idx_dial); + } + + callFXS()->_incoming_exten += e->AddInfo; + + /* begin context adjusting + processing */ + ContextListType contexts; + + validContexts(contexts); + + std::string tmp_exten("s"); + std::string tmp_context("default"); + + switch (findExtension(tmp_exten, tmp_context, contexts, callFXS()->_incoming_exten, call()->_orig_addr, false, false)) + { + case MATCH_EXACT: + DBG(FUNC,FMT("incoming exten matched: %s") % callFXS()->_incoming_exten); + Board::board(_target.device)->_timers.del(callFXS()->_idx_dial); + call()->_dest_addr = callFXS()->_incoming_exten; + call()->_incoming_context = tmp_context; + + alloc(); + break; + + case MATCH_MORE: + DBG(FUNC, PVT_FMT(target(), "match more...")); + + /* can match, will match more, and it's an external call? */ + for (Opt::DestVectorType::iterator i = Opt::_fxs_co_dialtone.begin(); i != Opt::_fxs_co_dialtone.end(); i++) + { + if (callFXS()->_incoming_exten == (*i)) + { + startCadence(PLAY_PUB_TONE); + break; + } + } + + break; + case MATCH_NONE: + DBG(FUNC, PVT_FMT(target(), "match none!")); + + std::string invalid = "i"; + + Board::board(_target.device)->_timers.del(callFXS()->_idx_dial); + + switch (findExtension(tmp_exten, tmp_context, contexts, invalid, call()->_orig_addr, true, false)) + { + case MATCH_EXACT: + // this dialing is invalid, and we can handle it... + call()->_dest_addr = invalid; + call()->_incoming_context = tmp_context; + alloc(); + break; + case MATCH_MORE: + case MATCH_NONE: + callFXS()->_flags.set(Kflags::FXS_DIAL_FINISHD); + startCadence(PLAY_FASTBUSY); + break; + } + break; + } + } + else if(callFXS()->_flags.check(Kflags::FXS_OFFHOOK) && + callFXS()->_flags.check(Kflags::FXS_FLASH_TRANSFER)) + { + Board::board(_target.device)->_timers.restart(callFXS()->_idx_transfer); + DBG(FUNC, PVT_FMT(target(), "Flash Transfer")); + + if (call()->_cadence == PLAY_PBX_TONE) + { + stopCadence(); + } + + if (call()->_cadence == PLAY_PUB_TONE) + { + stopCadence(); + //call()->_cadence = PLAY_NONE; + //mixer(KHOMP_LOG, 1, kmsGenerator, kmtSilence); + } + + callFXS()->_flash_transfer += e->AddInfo; + + /* begin context adjusting + processing */ + ContextListType contexts; + + validContexts(contexts); + + std::string tmp_exten("s"); + std::string tmp_context("default"); + + switch (findExtension(tmp_exten, tmp_context, contexts, callFXS()->_flash_transfer, call()->_orig_addr, false, false)) + { + case MATCH_EXACT: + { + DBG(FUNC,FMT("incoming exten matched: %s") % callFXS()->_flash_transfer); + + if(!transfer(tmp_context)) + { + cleanup(KhompPvt::CLN_HARD); + DBG(FUNC, PVT_FMT(target(), "(FXS) r (unable to transfer)")); + return false; + } + + break; + } + case MATCH_MORE: + DBG(FUNC, PVT_FMT(target(), "match more...")); + + /* can match, will match more, and it's an external call? */ + for (Opt::DestVectorType::iterator i = Opt::_fxs_co_dialtone.begin(); i != Opt::_fxs_co_dialtone.end(); i++) + { + if (callFXS()->_flash_transfer == (*i)) + { + startCadence(PLAY_PUB_TONE); + break; + } + } + + break; + case MATCH_NONE: + { + DBG(FUNC, PVT_FMT(target(), "match none!")); + + if(!stopTransfer()) + { + cleanup(KhompPvt::CLN_HARD); + DBG(FUNC, PVT_FMT(target(), "(FXS) r (unable to stop transfer)")); + return false; + } + + break; + } + } + } + else + { + ret = KhompPvt::onDtmfDetected(e); + } + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "(FXS) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + catch (K3LAPI::invalid_device & err) + { + LOG(ERROR, PVT_FMT(_target, "(FXS) r (unable to get device: %d!)") % err.device); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "(FXS) r")); + + return ret; +} + +/* +bool BoardE1::KhompPvtFXS::onDtmfSendFinish(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_target, "(FXS) c")); + + bool ret = true; + + try + { + ScopedPvtLock lock(this); + + ret = KhompPvt::onDtmfSendFinish(e); + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "(FXS) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "(FXS) r")); + + return ret; +} +*/ + +bool BoardE1::KhompPvtFXS::onFlashDetected(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_target, "(FXS) c")); + + try + { + ScopedPvtLock lock(this); + + if(callFXS()->_flags.check(Kflags::FXS_FLASH_TRANSFER)) + { + DBG(FUNC, PVT_FMT(_target, "(FXS) transfer canceled")); + + if(!stopTransfer()) + { + cleanup(KhompPvt::CLN_HARD); + DBG(FUNC, PVT_FMT(target(), "(FXS) r (unable to stop transfer)")); + return false; + } + + DBG(FUNC, PVT_FMT(target(), "(FXS) r")); + return true; + } + + if(call()->_flags.check(Kflags::IS_INCOMING)) + { + DBG(FUNC, PVT_FMT(_target, "incoming call")); + } + else if(call()->_flags.check(Kflags::IS_OUTGOING)) + { + DBG(FUNC, PVT_FMT(_target, "outgoing call")); + } + else + { + DBG(FUNC, PVT_FMT(_target, "(FXS) r (!incoming and !outgoing call)")); + return true; + } + + echoCancellation(false); + + if(!startTransfer()) + { + DBG(FUNC, PVT_FMT(target(), "(FXS) r (unable to start transfer)")); + return false; + } + + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(_target, "(FXS) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "(FXS) r")); + + return true; +} + +int BoardE1::KhompPvtFXS::makeCall(std::string params) +{ + DBG(FUNC,PVT_FMT(_target, "(FXS) c")); + + /* we always have audio */ + call()->_flags.set(Kflags::HAS_PRE_AUDIO); + + if (Opt::_fxs_bina && !call()->_orig_addr.empty()) + { + /* Sending Bina DTMF*/ + callFXS()->_flags.set(Kflags::WAIT_SEND_DTMF); + + std::stringstream dial_bina; + + dial_bina << "A1" << call()->_orig_addr << "C"; + + if (!command(KHOMP_LOG, CM_DIAL_DTMF, dial_bina.str().c_str())) + { + return ksFail; + //throw call_error("something went while sending BINA digits to FXS branch"); + } + + int timeout = 150; + + if(!loopWhileFlagTimed(Kflags::WAIT_SEND_DTMF, timeout)) + return ksFail; + //throw call_error("call has been dropped while sending digits"); + + if(timeout <= 0) + return ksFail; + //throw call_error("sending number of A caused timeout of this call"); + } + + if(!call()->_orig_addr.empty()) + params += STG(FMT(" orig_addr=\"%s\"") % _call->_orig_addr); + + if (callFXS()->_ring_on != -1) + params += STG(FMT(" ring_on=\"%ld\"") % callFXS()->_ring_on); + + if (callFXS()->_ring_off != -1) + params += STG(FMT(" ring_off=\"%ld\"") % callFXS()->_ring_off); + + if (callFXS()->_ring_on_ext != -1) + params += STG(FMT(" ring_on_ext=\"%ld\"") % callFXS()->_ring_on_ext); + + if (callFXS()->_ring_off_ext != -1) + params += STG(FMT(" ring_off_ext=\"%ld\"") % callFXS()->_ring_off_ext); + + int ret = KhompPvt::makeCall(params); + + if(ret == ksSuccess) + { + try + { + switch_channel_mark_ring_ready(getFSChannel()); + //signal_state(AST_CONTROL_RINGING); + } + catch(Board::KhompPvt::InvalidSwitchChannel & err) + { + LOG(ERROR, PVT_FMT(_target, "No valid channel: %s") % err._msg.c_str()); + } + } + else + { + LOG(ERROR, PVT_FMT(target(), "Fail on make call")); + } + + call()->_cleanup_upon_hangup = (ret == ksInvalidParams || ret == ksInvalidState); + + DBG(FUNC,PVT_FMT(_target, "(FXS) r")); + return ret; +} + +bool BoardE1::KhompPvtFXS::doChannelAnswer(CommandRequest &cmd) +{ + DBG(FUNC, PVT_FMT(_target, "(FXS) c")); + + bool ret = true; + + try + { + ScopedPvtLock lock(this); + + setupConnection(); + + ret = KhompPvt::doChannelAnswer(cmd); + } + catch (ScopedLockFailed & err) + { + LOG(ERROR,PVT_FMT(_target, "(FXS) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "(FXS) r")); + + return ret; +} + +bool BoardE1::KhompPvtFXS::doChannelHangup(CommandRequest &cmd) +{ + DBG(FUNC, PVT_FMT(_target, "(FXS) c")); + + bool ret = true; + + bool answered = true; + bool disconnected = false; + + try + { + ScopedPvtLock lock(this); + + if(!callFXS()->_uuid_other_session.empty()) + { + DBG(FUNC,PVT_FMT(_target, "unable to transfer")); + + switch_core_session_t *hold_session; + + if ((hold_session = switch_core_session_locate(callFXS()->_uuid_other_session.c_str()))) + { + switch_channel_t *hold_channel = switch_core_session_get_channel(hold_session); + switch_core_session_rwunlock(hold_session); + + if(hold_channel) + switch_channel_hangup(hold_channel, (switch_call_cause_t)call()->_hangup_cause); + //switch_channel_hangup(hold_channel, SWITCH_CAUSE_ATTENDED_TRANSFER); + } + callFXS()->_uuid_other_session.clear(); + } + + if (call()->_flags.check(Kflags::IS_INCOMING)) + { + DBG(FUNC,PVT_FMT(_target, "disconnecting incoming channel")); + + } + else if (call()->_flags.check(Kflags::IS_OUTGOING)) + { + if (!call()->_flags.check(Kflags::FXS_OFFHOOK)) + { + DBG(FUNC, PVT_FMT(_target, "disconnecting not answered outgoing FXS channel...")); + disconnected = command(KHOMP_LOG, CM_DISCONNECT); + cleanup(KhompPvt::CLN_HARD); + answered = false; + + } + else if(call()->_cleanup_upon_hangup) + { + DBG(FUNC,PVT_FMT(_target, "disconnecting not allocated outgoing channel...")); + + disconnected = command(KHOMP_LOG, CM_DISCONNECT); + cleanup(KhompPvt::CLN_HARD); + answered = false; + + } + else + { + DBG(FUNC,PVT_FMT(_target, "disconnecting outgoing channel...")); + + disconnected = command(KHOMP_LOG, CM_DISCONNECT); + } + } + else + { + DBG(FUNC,PVT_FMT(_target, "already disconnected")); + return true; + } + + if(answered) + { + indicateBusyUnlocked(SWITCH_CAUSE_USER_BUSY, disconnected); + } + + if (call()->_flags.check(Kflags::IS_INCOMING) && !call()->_flags.check(Kflags::NEEDS_RINGBACK_CMD)) + { + DBG(FUNC,PVT_FMT(_target, "disconnecting incoming channel...")); + disconnected = command(KHOMP_LOG, CM_DISCONNECT); + } + + stopStream(); + + stopListen(); + + //ret = KhompPvt::doChannelHangup(cmd); + } + catch (ScopedLockFailed & err) + { + LOG(ERROR,PVT_FMT(_target, "(FXS) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "(FXS) r")); + + return ret; +} + +bool BoardE1::KhompPvtFXS::setupConnection() +{ + if(!call()->_flags.check(Kflags::IS_INCOMING) && !call()->_flags.check(Kflags::IS_OUTGOING)) + { + DBG(FUNC,PVT_FMT(_target, "Channel already disconnected")); + return false; + } + + bool res_out_of_band_dtmf = (call()->_var_dtmf_state == T_UNKNOWN ? + Opt::_suppression_delay && Opt::_out_of_band_dtmfs : (call()->_var_dtmf_state == T_TRUE)); + + bool res_echo_cancellator = (call()->_var_echo_state == T_UNKNOWN ? + Opt::_echo_canceller : (call()->_var_echo_state == T_TRUE)); + + + bool res_auto_gain_cntrol = (call()->_var_gain_state == T_UNKNOWN ? + Opt::_auto_gain_control : (call()->_var_gain_state == T_TRUE)); + + + if (!call()->_flags.check(Kflags::REALLY_CONNECTED)) + { + obtainRX(res_out_of_band_dtmf); + + /* esvazia buffers de leitura/escrita */ + cleanupBuffers(); + + if (!call()->_flags.check(Kflags::KEEP_DTMF_SUPPRESSION)) + dtmfSuppression(res_out_of_band_dtmf); + + if (!call()->_flags.check(Kflags::KEEP_ECHO_CANCELLATION)) + echoCancellation(res_echo_cancellator); + + if (!call()->_flags.check(Kflags::KEEP_AUTO_GAIN_CONTROL)) + autoGainControl(res_auto_gain_cntrol); + + startListen(false); + + startStream(); + + DBG(FUNC, PVT_FMT(_target, "(FXS) Audio callbacks initialized successfully")); + } + + call()->_flags.set(Kflags::FXS_OFFHOOK); + + return KhompPvt::setupConnection(); +} + +bool BoardE1::KhompPvtFXS::indicateBusyUnlocked(int cause, bool sent_signaling) +{ + DBG(FUNC, PVT_FMT(_target, "(FXS) c")); + + if(!KhompPvt::indicateBusyUnlocked(cause, sent_signaling)) + { + DBG(FUNC, PVT_FMT(_target, "(FXS) r (false)")); + return false; + } + + if(call()->_flags.check(Kflags::IS_INCOMING)) + { + if(!call()->_flags.check(Kflags::CONNECTED) && !sent_signaling) + { + if(!call()->_flags.check(Kflags::HAS_PRE_AUDIO)) + { + int rb_value = callFailFromCause(call()->_hangup_cause); + DBG(FUNC, PVT_FMT(target(), "sending the busy status")); + + if (sendRingBackStatus(rb_value) == RingbackDefs::RBST_UNSUPPORTED) + { + DBG(FUNC, PVT_FMT(target(), "falling back to audio indication!")); + /* stop the line audio */ + stopStream(); + + /* just pre connect, no ringback */ + if (!sendPreAudio()) + DBG(FUNC, PVT_FMT(target(), "everything else failed, just sending audio indication...")); + + /* be very specific about the situation. */ + mixer(KHOMP_LOG, 1, kmsGenerator, kmtBusy); + } + } + else + { + DBG(FUNC, PVT_FMT(target(), "going to play busy")); + + /* stop the line audio */ + stopStream(); + + /* be very specific about the situation. */ + mixer(KHOMP_LOG, 1, kmsGenerator, kmtBusy); + + } + } + else + { + /* already connected or sent signaling... */ + mixer(KHOMP_LOG, 1, kmsGenerator, kmtBusy); + } + + } + else if(call()->_flags.check(Kflags::IS_OUTGOING)) + { + /* already connected or sent signaling... */ + mixer(KHOMP_LOG, 1, kmsGenerator, kmtBusy); + } + + DBG(FUNC,PVT_FMT(_target, "(FXS) r")); + + return true; +} + +void BoardE1::KhompPvtFXS::reportFailToReceive(int fail_code) +{ + KhompPvt::reportFailToReceive(fail_code); + + if(fail_code != -1) + { + DBG(FUNC,PVT_FMT(_target, "sending a 'unknown number' message/audio")); + + if(sendRingBackStatus(fail_code) == RingbackDefs::RBST_UNSUPPORTED) + { + sendPreAudio(RingbackDefs::RB_SEND_DEFAULT); + startCadence(PLAY_FASTBUSY); + } + } + else + { + DBG(FUNC, PVT_FMT(_target, "sending fast busy audio directly")); + + sendPreAudio(RingbackDefs::RB_SEND_DEFAULT); + startCadence(PLAY_FASTBUSY); + } +} + +bool BoardE1::KhompPvtFXS::validContexts(Board::KhompPvt::ContextListType & contexts, std::string extra_context) +{ + DBG(FUNC,PVT_FMT(_target, "(FXS) c")); + + if(!_context.empty()) + contexts.push_back(_context); + + contexts.push_back(Opt::_context_fxs); + contexts.push_back(Opt::_context2_fxs); + + for (Board::KhompPvt::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) + { + replaceTemplate((*i), "CC", _target.object); + } + + bool ret = Board::KhompPvt::validContexts(contexts,extra_context); + + DBG(FUNC,PVT_FMT(_target, "(FXS) r")); + + return ret; +} + +bool BoardE1::KhompPvtFXS::isOK() +{ + try + { + ScopedPvtLock lock(this); + + K3L_CHANNEL_STATUS status; + + if (k3lGetDeviceStatus (_target.device, _target.object + ksoChannel, &status, sizeof (status)) != ksSuccess) + return false; + + return (status.AddInfo != kfxsFail); + } + catch (ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(target(), "unable to lock %s!") % err._msg.c_str() ); + } + + return false; +} + + diff --git a/src/mod/endpoints/mod_khomp/src/khomp_pvt_passive.cpp b/src/mod/endpoints/mod_khomp/src/khomp_pvt_passive.cpp new file mode 100644 index 0000000..01c1610 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/src/khomp_pvt_passive.cpp @@ -0,0 +1,288 @@ +/******************************************************************************* + + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2010 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the LGPL + License. If you do not delete the provisions above, a recipient may use your + version of this file under either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*******************************************************************************/ + +#include "khomp_pvt_passive.h" +#include "lock.h" +#include "logger.h" + +bool BoardPassive::KhompPvtPassive::validContexts(Board::KhompPvt::ContextListType & contexts, std::string extra_context) +{ + DBG(FUNC,PVT_FMT(_target,"(Passive) c")); + + contexts.push_back(Opt::_context_pr); + + for (Board::KhompPvt::ContextListType::iterator i = contexts.begin(); i != contexts.end(); i++) + { + replaceTemplate((*i), "CC", _target.object); + } + + bool ret = Board::KhompPvt::validContexts(contexts,extra_context); + + DBG(FUNC,PVT_FMT(_target,"(Passive) r")); + + return ret; +} + +bool BoardPassive::KhompPvtHI::onSeizureStart(K3L_EVENT *e) +{ + DBG(FUNC,PVT_FMT(_target,"(HI) c")); + + try + { + ScopedPvtLock lock(this); + + _call->_orig_addr.clear(); + _call->_dest_addr = "s"; + +#if SWITCH_LESS_THAN(1,0,6) + session(switch_core_session_request(Globals::khomp_pr_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)); +#else + session(switch_core_session_request(Globals::khomp_pr_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL)); +#endif + + if (justAlloc(true) != SWITCH_STATUS_SUCCESS) + { + setHangupCause(SWITCH_CAUSE_UNALLOCATED_NUMBER); + cleanup(CLN_FAIL); + LOG(ERROR, PVT_FMT(target(), "(HI) r (Initilization Error on alloc!)")); + return false; + } + + /* begin context adjusting + processing */ + ContextListType contexts; + + validContexts(contexts); + + std::string tmp_exten; + std::string tmp_context; + + switch (findExtension(tmp_exten, tmp_context, contexts, call()->_dest_addr, call()->_orig_addr, false)) + { + case MATCH_NONE: + destroy(); + owner(NULL); + LOG(WARNING, PVT_FMT(_target, "(HI) r (unable to find exten/context on incoming call %s/%s)") + % _call->_dest_addr % (contexts.size() >= 1 ? contexts[0] : "default")); + return false; + default: + DBG(FUNC, PVT_FMT(_target, "(HI) our: context '%s', exten '%s'") % tmp_context % tmp_exten); + break; + + } + + call()->_incoming_context = tmp_context; + + startListen(); + + if (justStart() != SWITCH_STATUS_SUCCESS) + { + setHangupCause(SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL); + cleanup(CLN_FAIL); + LOG(ERROR, PVT_FMT(target(), "(HI) r (Initilization Error on start!)")); + return false; + } + + call()->_flags.set(Kflags::REALLY_CONNECTED); + call()->statistics()->incrementNewCall(); + + } + catch(ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(target(), "(HI) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "(HI) r")); + + return true; +} + +bool BoardPassive::KhompPvtKPR::onNewCall(K3L_EVENT *e) +{ + DBG(FUNC, PVT_FMT(_target, "(KPR) c")); + + try + { + std::string orig_addr, dest_addr; + + Globals::k3lapi.get_param(e, "orig_addr", orig_addr); + Globals::k3lapi.get_param(e, "dest_addr", dest_addr); + + if(dest_addr.empty()) + { + dest_addr="s"; + } + + bool isdn_reverse_charge = false; + std::string isdn_reverse_charge_str; + int isdn_status = Globals::k3lapi.get_param(e, "isdn_reverse_charge", isdn_reverse_charge_str); + + if (isdn_status == ksSuccess && !isdn_reverse_charge_str.empty()) + { + try + { + isdn_reverse_charge = Strings::toboolean(isdn_reverse_charge_str); + } + catch (Strings::invalid_value & err) + { + } + } + + long int r2_category = -1; + std::string r2_categ_a; + int r2_status = Globals::k3lapi.get_param(e, "r2_categ_a", r2_categ_a); + + if (r2_status == ksSuccess && !r2_categ_a.empty()) + { + try + { + r2_category = Strings::toulong(r2_categ_a); + } + catch (Strings::invalid_value e) + { + } + + } + + ScopedPvtLock lock(this); + + _call->_orig_addr = orig_addr; + _call->_dest_addr = dest_addr; + + if(isdn_reverse_charge || r2_category == kg2CollectCall) + { + call()->_collect_call = true; + } + +#if SWITCH_LESS_THAN(1,0,6) + session(switch_core_session_request(Globals::khomp_pr_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)); +#else + session(switch_core_session_request(Globals::khomp_pr_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL)); +#endif + + if (justAlloc(true) != SWITCH_STATUS_SUCCESS) + { + setHangupCause(SWITCH_CAUSE_UNALLOCATED_NUMBER); + cleanup(CLN_FAIL); + LOG(ERROR, PVT_FMT(target(), "(KPR) r (Initilization Error on alloc!)")); + return false; + } + + /* begin context adjusting + processing */ + ContextListType contexts; + + validContexts(contexts); + + std::string tmp_exten; + std::string tmp_context; + + switch (findExtension(tmp_exten, tmp_context, contexts, call()->_dest_addr, call()->_orig_addr, false)) + { + case MATCH_NONE: + destroy(); + owner(NULL); + LOG(WARNING, PVT_FMT(_target, "(KPR) r (unable to find exten/context on incoming call %s/%s)") + % _call->_dest_addr % (contexts.size() >= 1 ? contexts[0] : "default")); + return false; + default: + DBG(FUNC, PVT_FMT(_target, "(KPR) our: context '%s', exten '%s'") % tmp_context % tmp_exten); + break; + + } + + call()->_incoming_context = tmp_context; + _call->_dest_addr = tmp_exten; + + obtainBoth(); + + startListen(false); + + if (justStart() != SWITCH_STATUS_SUCCESS) + { + setHangupCause(SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL); + cleanup(CLN_FAIL); + LOG(ERROR, PVT_FMT(target(), "(KPR) r (Initilization Error on start!)")); + return false; + } + + call()->_flags.set(Kflags::REALLY_CONNECTED); + call()->statistics()->incrementNewCall(); + + } + catch(ScopedLockFailed & err) + { + LOG(ERROR, PVT_FMT(target(), "(KPR) r (unable to lock %s!)") % err._msg.c_str() ); + return false; + } + + DBG(FUNC, PVT_FMT(_target, "(KPR) r")); + return true; +} + +bool BoardPassive::KhompPvtKPR::obtainBoth() +{ + /* estes buffers *NAO PODEM SER ESTATICOS*! */ + char cmd1[] = { 0x3f, 0x03, 0xff, 0x00, 0x05, 0xff }; + char cmd2[] = { 0x3f, 0x03, 0xff, 0x01, 0x05, 0xff }; + + cmd1[2] = cmd1[5] = cmd2[2] = _target.object; + cmd2[5] = _target.object + 30; + + try + { + int dsp = Globals::k3lapi.get_dsp(_target.device, K3LAPI::DSP_AUDIO); + + Globals::k3lapi.raw_command(_target.device, dsp, cmd1, sizeof(cmd1)); + + Globals::k3lapi.raw_command(_target.device, dsp, cmd2, sizeof(cmd2)); + + } + catch(K3LAPI::failed_raw_command & e) + { + LOG(ERROR, PVT_FMT(target(), "ERROR sending mixer command!")); + return false; + } + + return true; +} + diff --git a/src/mod/endpoints/mod_khomp/src/lock.cpp b/src/mod/endpoints/mod_khomp/src/lock.cpp new file mode 100644 index 0000000..01d1689 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/src/lock.cpp @@ -0,0 +1,138 @@ +/******************************************************************************* + + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2010 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the LGPL + License. If you do not delete the provisions above, a recipient may use your + version of this file under either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*******************************************************************************/ + +#include "lock.h" + +/* ScopedPvtLock */ + +ScopedPvtLock::ScopedPvtLock(KhompPvt * pvt) +: ScopedLockBasic(false), _pvt(pvt) +{ + //DBG(LOCK, DP(_pvt, "c")); + + if (! _pvt) + throw ScopedLockFailed(ScopedLockFailed::NULL_PVT, "null KhompPvt"); + + switch(_pvt->_mutex.lock()) + { + case SimpleLock::FAILURE: + throw ScopedLockFailed(ScopedLockFailed::FAILED, "Failure"); + break; + case SimpleLock::ISINUSE: + throw ScopedLockFailed(ScopedLockFailed::FAILED, "In use"); + break; + default: + break; + } + + _locked = true; + + //DBG(LOCK, DP(_pvt, "r")); +} + +ScopedPvtLock::~ScopedPvtLock() +{ + //DBG(LOCK, DP(_pvt, "c")); + unlock(); + //DBG(LOCK, DP(_pvt, "r")); +} + +void ScopedPvtLock::unlock() +{ + //DBG(LOCK, DP(_pvt, "c")); + + if (_locked) + { + //DBG(LOCK, DP(_pvt, "unlocking!")); + + _locked = false; + _pvt->_mutex.unlock(); + } + + //DBG(LOCK, DP(_pvt, "r")); +} + +ScopedAllocLock::ScopedAllocLock() +: ScopedLockBasic(false) +{ + //DBG(LOCK, DP(_pvt, "c")); + + switch(Globals::khomp_alloc_mutex.lock()) + { + case SimpleLock::FAILURE: + throw ScopedLockFailed(ScopedLockFailed::ALLOC_FAILED, "Failure"); + break; + case SimpleLock::ISINUSE: + throw ScopedLockFailed(ScopedLockFailed::ALLOC_FAILED, "In use"); + break; + default: + break; + } + + _locked = true; + + //DBG(LOCK, DP(_pvt, "r")); +} + +ScopedAllocLock::~ScopedAllocLock() +{ + //DBG(LOCK, DP(_pvt, "c")); + unlock(); + //DBG(LOCK, DP(_pvt, "r")); +} + +void ScopedAllocLock::unlock() +{ + //DBG(LOCK, DP(_pvt, "c")); + + if (_locked) + { + //DBG(LOCK, DP(_pvt, "unlocking!")); + + _locked = false; + Globals::khomp_alloc_mutex.unlock(); + } + + //DBG(LOCK, DP(_pvt, "r")); +} + diff --git a/src/mod/endpoints/mod_khomp/src/logger.cpp b/src/mod/endpoints/mod_khomp/src/logger.cpp new file mode 100644 index 0000000..c68518a --- /dev/null +++ b/src/mod/endpoints/mod_khomp/src/logger.cpp @@ -0,0 +1,437 @@ +/******************************************************************************* + + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2010 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the LGPL + License. If you do not delete the provisions above, a recipient may use your + version of this file under either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*******************************************************************************/ + +#include "logger.h" +#include "globals.h" + +namespace K +{ + LogManager Logger::Logg; + LogInternalManager Logger::Logg2; + + std::string Logger::base_path; + std::ofstream Logger::generic_file; + + bool LogConfig::set(Logfile & file, const char * section, const char * option, bool value) + { + Section * sec = file.root().section_find(section); + + if (!sec) + return false; + + Option * opt = sec->option_find(option); + + if (!opt) + return false; + + opt->set( value ? "Ativado" : "Desativado" ); + + return true; + } + + bool LogConfig::commit(Logfile & file) + { + return file.provide(); + } + + bool Logger::start() + { + /* we love shortcuts! */ + typedef LogManager::Option LogOpt; + + typedef LogOpt::Flags Flags; + typedef LogOpt::InitFlags FL; + + /* configures default log levels */ + Logger::Logg.classe(C_ERROR) + & LogOpt(O_CONSOLE, "ERROR: ", Flags(FL(LogOpt::DATETIME) & FL(LogOpt::ENABLED))) + & LogOpt(O_GENERIC, "E: ", Flags(FL(LogOpt::DATETIME) & FL(LogOpt::THREADID) & FL(LogOpt::ENABLED))); + + Logger::Logg.classe(C_WARNING) + & LogOpt(O_CONSOLE, "WARNING: ", Flags(FL(LogOpt::DATETIME) & FL(LogOpt::ENABLED))) + & LogOpt(O_GENERIC, "W: ", Flags(FL(LogOpt::DATETIME) & FL(LogOpt::THREADID) & FL(LogOpt::ENABLED))); + + Logger::Logg.classe(C_MESSAGE) + & LogOpt(O_CONSOLE, Flags(FL(LogOpt::ENABLED))) + & LogOpt(O_GENERIC, "M: ", Flags(FL(LogOpt::DATETIME) & FL(LogOpt::THREADID) & FL(LogOpt::ENABLED))); + + /* k3l messages */ + Logger::Logg.classe(C_COMMAND) + & LogOpt(O_CONSOLE, Flags(FL(LogOpt::DATETIME))) + & LogOpt(O_GENERIC, "c: ", Flags(FL(LogOpt::DATETIME) & FL(LogOpt::THREADID))); + + Logger::Logg.classe(C_EVENT) + & LogOpt(O_CONSOLE, Flags(FL(LogOpt::DATETIME))) + & LogOpt(O_GENERIC, "e: ", Flags(FL(LogOpt::DATETIME) & FL(LogOpt::THREADID))); + + Logger::Logg.classe(C_AUDIO_EV) + & LogOpt(O_CONSOLE, Flags(FL(LogOpt::DATETIME))) + & LogOpt(O_GENERIC, "a: ", Flags(FL(LogOpt::DATETIME) & FL(LogOpt::THREADID))); + + Logger::Logg.classe(C_MODEM_EV) + & LogOpt(O_CONSOLE, Flags(FL(LogOpt::DATETIME))) + & LogOpt(O_GENERIC, "m: ", Flags(FL(LogOpt::DATETIME) & FL(LogOpt::THREADID) & FL(LogOpt::ENABLED))); + + Logger::Logg.classe(C_LINK_STT) + & LogOpt(O_CONSOLE, Flags(FL(LogOpt::DATETIME) & FL(LogOpt::ENABLED))) + & LogOpt(O_GENERIC, "s: ", Flags(FL(LogOpt::DATETIME) & FL(LogOpt::THREADID) & FL(LogOpt::ENABLED))); + + Logger::Logg.classe(C_CAS_MSGS) + & LogOpt(O_CONSOLE, Flags(FL(LogOpt::DATETIME) & FL(LogOpt::ENABLED))) + & LogOpt(O_GENERIC, "p: ", Flags(FL(LogOpt::DATETIME) & FL(LogOpt::THREADID) & FL(LogOpt::ENABLED))); + + /* channel debug */ + Logger::Logg.classe(C_DBG_FUNC) + & LogOpt(O_GENERIC, "F: ", Flags(FL(LogOpt::DATETIME) & FL(LogOpt::THREADID) & FL(LogOpt::ENABLED))); + + Logger::Logg.classe(C_DBG_LOCK) + & LogOpt(O_GENERIC, "L: ", Flags(FL(LogOpt::DATETIME) & FL(LogOpt::THREADID) & FL(LogOpt::ENABLED))); + + Logger::Logg.classe(C_DBG_THRD) + & LogOpt(O_GENERIC, "T: ", Flags(FL(LogOpt::DATETIME) & FL(LogOpt::THREADID) & FL(LogOpt::ENABLED))); + + Logger::Logg.classe(C_DBG_STRM) + & LogOpt(O_GENERIC, "S: ", Flags(FL(LogOpt::DATETIME) & FL(LogOpt::THREADID) & FL(LogOpt::ENABLED))); + + Logger::Logg.classe(C_DBG_CONF) + & LogOpt(O_GENERIC, "C: ", Flags(FL(LogOpt::DATETIME) & FL(LogOpt::THREADID) & FL(LogOpt::ENABLED))); + + Logger::Logg.classe(C_DBG_FUNC).enabled(false); + Logger::Logg.classe(C_DBG_LOCK).enabled(false); + Logger::Logg.classe(C_DBG_THRD).enabled(false); + Logger::Logg.classe(C_DBG_STRM).enabled(false); + + /* we debug config file loading, by default */ + Logger::Logg.classe(C_DBG_CONF).enabled(true); + + /* adds a prefix to the cli messages */ + Logger::Logg.classe(C_CLI).prefix("<K> "); + + /* inserts default console log before opening files */ + Logger::Logg.add(O_CONSOLE,SwitchConsoleLog(), "mod_khomp: "); + + time_t tv; + struct tm lt; + + /* get local time! */ + time (&tv); + localtime_r (&tv, <); + + base_path = STG(FMT("/var/log/khomp%d.%d/mod_khomp-%04d%02d%02d_%02d%02d%02d/") + % k3lApiMajorVersion % k3lApiMinorVersion % (lt.tm_year + 1900) % (lt.tm_mon + 1) + % lt.tm_mday % lt.tm_hour % lt.tm_min % lt.tm_sec ); + + // NOTE: ALWAYS unlink, as we may have a dangling symlink lying around... + std::string link_path = STG(FMT("/var/log/khomp%d.%d/current") % k3lApiMajorVersion % k3lApiMinorVersion ); + unlink(link_path.c_str()); + + if (mkdir(base_path.c_str(), 493 /*755*/) < 0 && errno != EEXIST) + { + Logger::Logg(C_ERROR, D("unable to create log directory '%s': %s!") % base_path % strerror(errno)); + return false; + } + + if (symlink(base_path.c_str(), link_path.c_str())) + { + Logger::Logg(C_ERROR, D("unable to create symlink to latest log directory '%s': %s!") % base_path % strerror(errno)); + } + + std::string gen_tmp = base_path + std::string("generic.log"); + generic_file.open(gen_tmp.c_str()); + + if (!generic_file.good()) + { + Logger::Logg(C_ERROR, D("could not open file '%s': %s") % gen_tmp % strerror(errno)); + return false; + } + + /* inserts other file descriptors (TODO: delete this when stopping logs) */ + Logger::Logg.add(O_GENERIC, &generic_file); + return true; + } + + void Logger::stop() + { + if(generic_file.is_open()) + { + generic_file.close(); + } + } + + bool Logger::rotate() + { + std::string new_gen; + + for (unsigned int i = 0;; i++) + { + std::string tmp = base_path + STG(FMT("generic.%d.log") % i); + + if (access(tmp.c_str(), R_OK|W_OK) != 0 && errno == ENOENT) + { + new_gen = tmp; + break; + } + } + + std::string old_gen = base_path + "generic.log"; + + if (rename(old_gen.c_str(), new_gen.c_str()) != 0) + { + Logger::Logg(C_ERROR, FMT("unable to move generic log file: %s.") % strerror(errno)); + return false; + } + + Globals::logs_being_rotated = true; + + generic_file.close(); + generic_file.open(old_gen.c_str()); + + Globals::logs_being_rotated = false; + + return true; + } + + void Logger::processLogConsole(switch_stream_handle_t *s, const std::string options, bool invert, bool unique) + { + class_type classe = ( !s ? C_MESSAGE : C_CLI ); + + Strings::vector_type tokens; + Strings::tokenize(options, tokens, ","); + + bool flag_errors = false; + bool flag_warnings = false; + bool flag_messages = false; + bool flag_events = false; + bool flag_commands = false; + bool flag_audio = false; + bool flag_modem = false; + bool flag_link = false; + bool flag_cas = false; + + Strings::Merger strs; + + for (Strings::vector_type::iterator i = tokens.begin(); i != tokens.end(); i++) + { + std::string tok = Strings::trim(*i); + + /**/ if ((tok) == "errors") flag_errors = true; + else if ((tok) == "warnings") flag_warnings = true; + else if ((tok) == "messages") flag_messages = true; + else if ((tok) == "events") flag_events = true; + else if ((tok) == "commands") flag_commands = true; + else if ((tok) == "audio") flag_audio = true; + else if ((tok) == "modem") flag_modem = true; + else if ((tok) == "link") flag_link = true; + else if ((tok) == "cas") flag_cas = true; + else if ((tok) == "standard") + { + flag_errors = true; + flag_warnings = true; + flag_messages = true; + flag_link = true; + } + else if ((tok) == "all") + { + flag_errors = true; + flag_warnings = true; + flag_messages = true; + flag_events = true; + flag_commands = true; + flag_audio = true; + flag_modem = true; + flag_link = true; + flag_cas = true; + } + else + { + K::Logger::Logg2(classe, s, FMT("WARNING: The following console message option is not valid and will be ignored: %s.") % (tok) ); + continue; + } + + strs.add(tok); + } + + if ((unique && !flag_errors) || flag_errors) K::Logger::Logg.classe(C_ERROR) .set(O_CONSOLE, LogManager::Option::ENABLED, (!invert && flag_errors)); + if ((unique && !flag_warnings) || flag_warnings) K::Logger::Logg.classe(C_WARNING) .set(O_CONSOLE, LogManager::Option::ENABLED, (!invert && flag_warnings)); + if ((unique && !flag_messages) || flag_messages) K::Logger::Logg.classe(C_MESSAGE) .set(O_CONSOLE, LogManager::Option::ENABLED, (!invert && flag_messages)); + if ((unique && !flag_events) || flag_events) K::Logger::Logg.classe(C_EVENT) .set(O_CONSOLE, LogManager::Option::ENABLED, (!invert && flag_events)); + if ((unique && !flag_commands) || flag_commands) K::Logger::Logg.classe(C_COMMAND) .set(O_CONSOLE, LogManager::Option::ENABLED, (!invert && flag_commands)); + if ((unique && !flag_audio) || flag_audio) K::Logger::Logg.classe(C_AUDIO_EV).set(O_CONSOLE, LogManager::Option::ENABLED, (!invert && flag_audio)); + if ((unique && !flag_modem) || flag_modem) K::Logger::Logg.classe(C_MODEM_EV).set(O_CONSOLE, LogManager::Option::ENABLED, (!invert && flag_modem)); + if ((unique && !flag_link) || flag_link) K::Logger::Logg.classe(C_LINK_STT).set(O_CONSOLE, LogManager::Option::ENABLED, (!invert && flag_link)); + if ((unique && !flag_cas) || flag_cas) K::Logger::Logg.classe(C_CAS_MSGS).set(O_CONSOLE, LogManager::Option::ENABLED, (!invert && flag_cas)); + + if (!strs.empty()) + { + K::Logger::Logg2(classe, s, FMT("NOTICE: %s %sthe following console messages: %s.") + % (invert ? "Disabling" : "Enabling") + % (unique ? "just " : "") % strs.merge(", ")); + } + else + { + K::Logger::Logg2(classe, s, "WARNING: No valid console messages have been specified, doing nothing."); + } + } + + void Logger::processLogDisk(switch_stream_handle_t *s, const std::string options, bool invert, bool unique) + { + class_type classe = ( !s ? C_MESSAGE : C_CLI ); + + Strings::vector_type tokens; + Strings::tokenize(options, tokens, ","); + + bool flag_errors = false; + bool flag_warnings = false; + bool flag_messages = false; + bool flag_events = false; + bool flag_commands = false; + bool flag_audio = false; + bool flag_modem = false; + bool flag_link = false; + bool flag_cas = false; + bool flag_functions = false; + bool flag_threads = false; + bool flag_locks = false; + bool flag_streams = false; + + Strings::Merger strs; + + for (Strings::vector_type::iterator i = tokens.begin(); i != tokens.end(); i++) + { + std::string tok = Strings::trim(*i); + + /**/ if ((tok) == "errors") flag_errors = true; + else if ((tok) == "warnings") flag_warnings = true; + else if ((tok) == "messages") flag_messages = true; + else if ((tok) == "events") flag_events = true; + else if ((tok) == "commands") flag_commands = true; + else if ((tok) == "audio") flag_audio = true; + else if ((tok) == "modem") flag_modem = true; + else if ((tok) == "link") flag_link = true; + else if ((tok) == "cas") flag_cas = true; + else if ((tok) == "functions") flag_functions = true; + else if ((tok) == "threads") flag_threads = true; + else if ((tok) == "locks") flag_locks = true; + else if ((tok) == "streams") flag_streams = true; + else if ((tok) == "standard") + { + flag_errors = true; + flag_warnings = true; + flag_messages = true; + flag_link = true; + } + else if ((tok) == "debugging") + { + flag_errors = true; + flag_warnings = true; + flag_messages = true; + flag_commands = true; + flag_events = true; + flag_audio = true; + flag_modem = true; + flag_link = true; + flag_cas = true; + flag_functions = true; + } + else if ((tok) == "all") + { + flag_errors = true; + flag_warnings = true; + flag_messages = true; + flag_events = true; + flag_commands = true; + flag_audio = true; + flag_modem = true; + flag_link = true; + flag_cas = true; + flag_functions = true; + flag_threads = true; + flag_locks = true; + flag_streams = true; + } + else + { + /* do not show! */ + continue; + } + + strs.add(tok); + } + + if ((unique && !flag_errors) || flag_errors) K::Logger::Logg.classe(C_ERROR) .set(O_GENERIC, LogManager::Option::ENABLED, (!invert && flag_errors)); + if ((unique && !flag_warnings) || flag_warnings) K::Logger::Logg.classe(C_WARNING) .set(O_GENERIC, LogManager::Option::ENABLED, (!invert && flag_warnings)); + if ((unique && !flag_messages) || flag_messages) K::Logger::Logg.classe(C_MESSAGE) .set(O_GENERIC, LogManager::Option::ENABLED, (!invert && flag_messages)); + if ((unique && !flag_events) || flag_events) K::Logger::Logg.classe(C_EVENT) .set(O_GENERIC, LogManager::Option::ENABLED, (!invert && flag_events)); + if ((unique && !flag_commands) || flag_commands) K::Logger::Logg.classe(C_COMMAND) .set(O_GENERIC, LogManager::Option::ENABLED, (!invert && flag_commands)); + if ((unique && !flag_audio) || flag_audio) K::Logger::Logg.classe(C_AUDIO_EV).set(O_GENERIC, LogManager::Option::ENABLED, (!invert && flag_audio)); + if ((unique && !flag_modem) || flag_modem) K::Logger::Logg.classe(C_MODEM_EV).set(O_GENERIC, LogManager::Option::ENABLED, (!invert && flag_modem)); + if ((unique && !flag_link) || flag_link) K::Logger::Logg.classe(C_LINK_STT).set(O_GENERIC, LogManager::Option::ENABLED, (!invert && flag_link)); + if ((unique && !flag_cas) || flag_cas) K::Logger::Logg.classe(C_CAS_MSGS).set(O_GENERIC, LogManager::Option::ENABLED, (!invert && flag_cas)); + if ((unique && !flag_functions) || flag_functions) K::Logger::Logg.classe(C_DBG_FUNC).enabled(!invert && flag_functions); + if ((unique && !flag_threads) || flag_threads) K::Logger::Logg.classe(C_DBG_THRD).enabled(!invert && flag_threads); + if ((unique && !flag_locks) || flag_locks) K::Logger::Logg.classe(C_DBG_LOCK).enabled(!invert && flag_locks); + if ((unique && !flag_streams) || flag_streams) K::Logger::Logg.classe(C_DBG_STRM).enabled(!invert && flag_streams); + + if (!strs.empty()) + { + K::Logger::Logg2(classe, s, FMT("NOTICE: %s %sthe logging of the following messages: %s.") + % (invert ? "Disabling" : "Enabling") + % (unique ? "just " : "") % strs.merge(", ")); + + if ((flag_streams || flag_locks) && !invert) + { + K::Logger::Logg2(classe, s, "WARNING: You have enabled *INTENSIVE* debug messages for the Khomp channel!"); + K::Logger::Logg2(classe, s, "WARNING: Don't *EVER* use these options on production systems, unless you *REALLY* know what you are doing!"); + } + else if ((flag_functions || flag_threads) && !invert) + { + K::Logger::Logg2(classe, s, "WARNING: You have enabled some debug messages for the Khomp channel."); + K::Logger::Logg2(classe, s, "WARNING: Do not use these options on production systems unless you really know what you are doing!"); + } + } + else + { + K::Logger::Logg2(classe, s, "WARNING: No valid log messages have been specified, doing nothing."); + } + } +} diff --git a/src/mod/endpoints/mod_khomp/src/opt.cpp b/src/mod/endpoints/mod_khomp/src/opt.cpp new file mode 100644 index 0000000..946f508 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/src/opt.cpp @@ -0,0 +1,772 @@ +/******************************************************************************* + + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2010 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the LGPL + License. If you do not delete the provisions above, a recipient may use your + version of this file under either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*******************************************************************************/ + +#include "opt.h" +#include "globals.h" +#include "defs.h" +#include "logger.h" +#include "spec.h" + +bool Opt::_debug; +std::string Opt::_dialplan; +std::string Opt::_context; +std::string Opt::_user_xfer; +std::map < std::string, CSpan > Opt::_spans; +Opt::GroupToDestMapType Opt::_groups; +Opt::CadencesMapType Opt::_cadences; + +bool Opt::_echo_canceller; +bool Opt::_auto_gain_control; +bool Opt::_out_of_band_dtmfs; +bool Opt::_suppression_delay; +bool Opt::_pulse_forwarding; +bool Opt::_native_bridge; +bool Opt::_recording; +bool Opt::_has_ctbus; +bool Opt::_fxs_bina; +bool Opt::_fxo_send_pre_audio; +bool Opt::_drop_collect_call; +bool Opt::_ignore_letter_dtmfs; +bool Opt::_optimize_audio_path; + +bool Opt::_auto_fax_adjustment; +unsigned int Opt::_fax_adjustment_timeout; + +bool Opt::_r2_strict_behaviour; +unsigned int Opt::_r2_preconnect_wait; + +unsigned int Opt::_fxs_digit_timeout; + +unsigned int Opt::_transferdigittimeout; + +std::string Opt::_atxfer; +std::string Opt::_blindxfer; + +unsigned int Opt::_ringback_co_delay; +unsigned int Opt::_ringback_pbx_delay; + +unsigned int Opt::_disconnect_delay; + +int Opt::_input_volume; +int Opt::_output_volume; + +Opt::DestVectorType Opt::_fxs_co_dialtone; +Opt::OrigToDestMapType Opt::_fxs_hotline; +std::string Opt::_fxs_global_orig_base; + +Opt::BoardToOrigMapType Opt::_fxs_orig_base; +Opt::BranchToObjectMapType Opt::_fxs_branch_map; +Opt::BranchToOptMapType Opt::_branch_options; + +std::string Opt::_global_mohclass; +std::string Opt::_global_language; + +std::string Opt::_record_prefix; + +std::string Opt::_context_gsm_call; +std::string Opt::_context2_gsm_call; +std::string Opt::_context_gsm_sms; +std::string Opt::_context_fxo; +std::string Opt::_context2_fxo; +std::string Opt::_context_fxs; +std::string Opt::_context2_fxs; +std::string Opt::_context_digital; +std::string Opt::_context_pr; + +int Opt::_amaflags; +std::string Opt::_callgroup; +std::string Opt::_pickupgroup; + +std::string Opt::_accountcode; + +unsigned int Opt::_kommuter_timeout; +std::string Opt::_kommuter_activation; + +unsigned int Opt::_audio_packet_size; + +void Opt::initialize(void) +{ + Globals::options.add(ConfigOption("debug", _debug, false)); + Globals::options.add(ConfigOption("dialplan", _dialplan, "XML")); + Globals::options.add(ConfigOption("context", _context, "default")); + + Globals::options.add(ConfigOption("echo-canceller", _echo_canceller, true)); + Globals::options.add(ConfigOption("auto-gain-control", _auto_gain_control, true)); + Globals::options.add(ConfigOption("out-of-band-dtmfs", _out_of_band_dtmfs, true)); + Globals::options.add(ConfigOption("suppression-delay", _suppression_delay, true)); + Globals::options.add(ConfigOption("pulse-forwarding", _pulse_forwarding, false)); + Globals::options.add(ConfigOption("native-bridge", _native_bridge, true)); + Globals::options.add(ConfigOption("recording", _recording, true)); + Globals::options.add(ConfigOption("has-ctbus", _has_ctbus, false)); + Globals::options.add(ConfigOption("fxs-bina", _fxs_bina, true)); + Globals::options.add(ConfigOption("fxo-send-pre-audio", _fxo_send_pre_audio, true)); + Globals::options.add(ConfigOption("drop-collect-call", _drop_collect_call, false)); + Globals::options.add(ConfigOption("ignore-letter-dtmfs", _ignore_letter_dtmfs, false)); + Globals::options.add(ConfigOption("optimize-audio-path", _optimize_audio_path, false)); + + Globals::options.add(ConfigOption("auto-fax-adjustment", _auto_fax_adjustment, true)); + Globals::options.add(ConfigOption("fax-adjustment-timeout", _fax_adjustment_timeout, 30u, 3u, 9999u)); + + Globals::options.add(ConfigOption("r2-strict-behaviour", _r2_strict_behaviour, false)); + Globals::options.add(ConfigOption("r2-preconnect-wait", _r2_preconnect_wait, 250u, 25u, 500u)); + + Globals::options.add(ConfigOption("fxs-digit-timeout", _fxs_digit_timeout, 7u, 1u, 30u)); + + Globals::options.add(ConfigOption("transferdigittimeout", _transferdigittimeout, 3000u, 0u, 90000u)); + + Globals::options.add(ConfigOption("atxfer", _atxfer, "")); + Globals::options.add(ConfigOption("blindxfer", _blindxfer, "")); + + Globals::options.add(ConfigOption("delay-ringback-co", _ringback_co_delay, 1500u, 0u, 999000u)); + Globals::options.add(ConfigOption("delay-ringback-pbx", _ringback_pbx_delay, 2500u, 0u, 999000u)); + + Globals::options.add(ConfigOption("disconnect-delay", _disconnect_delay, 0u, 0u, 100000u)); + + Globals::options.add(ConfigOption("input-volume", _input_volume, 0, -10, 10)); + Globals::options.add(ConfigOption("output-volume", _output_volume, 0, -10, 10)); + + + Globals::options.add(ConfigOption("fxs-co-dialtone", ProcessFXSCODialtone(), "")); + Globals::options.add(ConfigOption("fxs-global-orig", _fxs_global_orig_base, "0")); + + Globals::options.add(ConfigOption("language", _global_language, "")); + Globals::options.add(ConfigOption("mohclass", _global_mohclass, "")); + + Globals::options.add(ConfigOption("record-prefix", ProcessRecordPrefix(), "/var/spool/freeswitch/monitor/")); + + Globals::options.add(ConfigOption("context-fxo", _context_fxo, "khomp-DD-CC")); + Globals::options.add(ConfigOption("context-fxo-alt", _context2_fxo, "khomp-DD")); + Globals::options.add(ConfigOption("context-fxs", _context_fxs, "khomp-DD-CC")); + Globals::options.add(ConfigOption("context-fxs-alt", _context2_fxs, "khomp-DD")); + Globals::options.add(ConfigOption("context-gsm-call", _context_gsm_call, "khomp-DD-CC")); + Globals::options.add(ConfigOption("context-gsm-call-alt", _context2_gsm_call, "khomp-DD")); + Globals::options.add(ConfigOption("context-gsm-sms", _context_gsm_sms, "khomp-sms-DD-CC")); + Globals::options.add(ConfigOption("context-digital", _context_digital, "khomp-DD-LL")); + Globals::options.add(ConfigOption("context-pr", _context_pr, "khomp-DD-CC")); + + Globals::options.add(ConfigOption("amaflags", ProcessAMAFlags(), "default")); + Globals::options.add(ConfigOption("callgroup", _callgroup, "0")); + Globals::options.add(ConfigOption("pickupgroup", _pickupgroup, "0")); + //Globals::options.add(ConfigOption("callgroup", ProcessCallGroup(), "0")); + //Globals::options.add(ConfigOption("pickupgroup", ProcessPickupGroup(), "0")); + + Globals::options.add(ConfigOption("accountcode", _accountcode, "")); + + ConfigOption::string_allowed_type kommuter_allowed; + kommuter_allowed.insert("auto"); + kommuter_allowed.insert("manual"); + + Globals::options.add(ConfigOption("kommuter-activation", _kommuter_activation , "auto", kommuter_allowed)); + Globals::options.add(ConfigOption("kommuter-timeout", _kommuter_timeout ,(unsigned int) 10 , (unsigned int) 0 , (unsigned int) 255)); + + Globals::options.add(ConfigOption("audio-packet-length", _audio_packet_size, + (unsigned int)KHOMP_READ_PACKET_SIZE, (unsigned int)KHOMP_MIN_READ_PACKET_SIZE, (unsigned int)KHOMP_MAX_READ_PACKET_SIZE, 8u)); + + Globals::options.add(ConfigOption("log-to-disk", ProcessLogOptions(O_GENERIC), "standard", false)); + Globals::options.add(ConfigOption("log-to-console", ProcessLogOptions(O_CONSOLE), "standard", false)); + + Globals::options.add(ConfigOption("trace", ProcessTraceOptions(), "", false)); + Globals::options.add(ConfigOption("user-transfer-digits", _user_xfer, "")); + + /* aliases */ + Globals::options.synonym("context-gsm", "context-gsm-call"); + Globals::options.synonym("context-gsm-alt", "context-gsm-call-alt"); + Globals::options.synonym("echocanceller", "echo-canceller"); + Globals::options.synonym("dtmfsuppression", "out-of-band-dtmfs"); + Globals::options.synonym("dtmfsupression", "out-of-band-dtmfs"); + Globals::options.synonym("pulsedetection", "pulse-forwarding"); + Globals::options.synonym("r2preconnectwait", "r2-preconnect-wait"); + Globals::options.synonym("bridge", "native-bridge"); + Globals::options.synonym("suppressiondelay", "suppression-delay"); + Globals::options.synonym("log", "log-to-disk"); + Globals::options.synonym("volume", "output-volume"); + Globals::options.synonym("disconnectdelay", "disconnect-delay"); + +} + +void Opt::obtain(void) +{ + /* everything should start clean! */ + cleanConfiguration(); + + /* reset loaded options */ + Globals::options.reset(); + + loadConfiguration("khomp.conf", NULL); + + /* commit, loading defaults where needed */ + ConfigOptions::messages_type msgs = Globals::options.commit(); + + /* config already full loaded at this point, so we can use our own log system... */ + for (ConfigOptions::messages_type::iterator i = msgs.begin(); i != msgs.end(); i++) + { + DBG(FUNC,FMT("%s") % (*i).c_str()); + } +} + +void Opt::commit(void) +{ + processGroupString(); + + /* Check FXS hotlines correcteness */ + OrigToDestMapType::const_iterator endOfHotlines = _fxs_hotline.end(); + + for (OrigToDestMapType::const_iterator i = _fxs_hotline.begin(); i != endOfHotlines; i++) + { + BranchToObjectMapType::const_iterator j = _fxs_branch_map.find(i->first); + + if (j == _fxs_branch_map.end()) + { + LOG(ERROR, FMT("unable to find branch '%s': hotline '%s' to '%s' is invalid!") + % i->first % i->first % i->second); + } + } + + /* Check FXS options correcteness */ + BranchToOptMapType::const_iterator endOfOptions = _branch_options.end(); + + for (BranchToOptMapType::const_iterator i = _branch_options.begin(); i != endOfOptions; i++) + { + BranchToObjectMapType::const_iterator j = _fxs_branch_map.find(i->first); + if (j == _fxs_branch_map.end()) + { + LOG(ERROR, FMT("unable to find branch '%s' for options '%s'") + % i->first % i->second); + } + } +} + +void Opt::loadConfiguration(const char *file_name, const char **section, bool show_errors) +{ + switch_xml_t cfg, xml, settings; + + if (!(xml = switch_xml_open_cfg(file_name, &cfg, NULL))) { + LOG(ERROR,FMT("Open of %s failed") % file_name); + return; + } + + /* Load all the global settings pertinent to all boards */ + settings = processSimpleXML(cfg,"settings"); + + /* Process channel settings */ + processSimpleXML(settings,"channels"); + + /* Process groups settings */ + processGroupXML(settings); + + /* Process cadence settings */ + processCadenceXML(settings); + + /* Process fxs branches settings */ + processFXSBranchesXML(settings); + + /* Process hotlines settings */ + processFXSHotlines(settings); + + /* Process fxs options settings */ + processFXSOptions(settings); + + switch_xml_free(xml); +} + +void Opt::printConfiguration(switch_stream_handle_t* stream) +{ + for( std::map<std::string, CSpan>::iterator ii=_spans.begin(); ii!=_spans.end(); ++ii ) + { + stream->write_function(stream, + "Span: %s.\nDialplan: %s.\nContext: %s.\nDialstring: %s.\n\n", + (*ii).first.c_str(), + (*ii).second._dialplan.c_str(), + (*ii).second._context.c_str(), + (*ii).second._dialstring.c_str()); + } +} + +void Opt::cleanConfiguration(void) +{ + _fxs_orig_base.clear(); + _fxs_hotline.clear(); + _fxs_co_dialtone.clear(); + _fxs_branch_map.clear(); + _branch_options.clear(); + + _groups.clear(); + _cadences.clear(); + + _cadences.insert(CadencesPairType("fast-busy", CadenceType(100,100))); + _cadences.insert(CadencesPairType("ringback", CadenceType(1000,4000))); + _cadences.insert(CadencesPairType("pbx-dialtone", CadenceType(1000,100))); + _cadences.insert(CadencesPairType("co-dialtone", CadenceType(0,0))); + _cadences.insert(CadencesPairType("vm-dialtone", CadenceType(1000,100,100,100))); +} + +void Opt::ProcessFXSCODialtone::operator()(std::string options) // const +{ + Strings::vector_type tokens; + Strings::tokenize(options, tokens, ","); + + for (Strings::vector_type::iterator i = tokens.begin(); i != tokens.end(); i++) + _fxs_co_dialtone.push_back(*i); +} + +void Opt::ProcessRecordPrefix::operator()(std::string path) // const +{ + if (mkdir(path.c_str(), 493 /* 0755 */) < 0 && errno != EEXIST) + { + throw ConfigProcessFailure("the default recording directory could not be created."); + } + else + { + _record_prefix = path; + } +} + +void Opt::ProcessAMAFlags::operator()(std::string options) +{ +/* + //TODO: Do we need this ? + amaflags = ast_cdr_amaflags2int(options.c_str()); + + if (amaflags < 0) + throw ConfigProcessFailure(STG(FMT("invalid AMA flags: %s") % options)); +*/ +} + +//TODO: Check this +void Opt::ProcessCallGroup::operator()(std::string options) +{ +// _callgroup = options.c_str(); +} + +//TODO: Check this +void Opt::ProcessPickupGroup::operator()(std::string options) +{ +// _pickupgroup = options.c_str(); +} + +void Opt::ProcessLogOptions::operator()(std::string options) +{ + switch (_output) + { + case O_GENERIC: + K::Logger::processLogDisk(NULL, options, false, true); + break; + + case O_CONSOLE: + K::Logger::processLogConsole(NULL, options, false, true); + break; + + default: + throw ConfigProcessFailure("attempt to process unknown log file configuration"); + break; + } +} + +void Opt::ProcessTraceOptions::operator()(std::string options) +{ + Strings::vector_type tokens; + Strings::tokenize(options, tokens, ","); + + bool enable_k3l_tracing = false; + bool enable_r2_tracing = false; + bool enable_rdsi_tracing = false; + + for (Strings::vector_type::iterator i = tokens.begin(); i != tokens.end(); i++) + { + std::string tok = Strings::trim(*i); + + if (tok == "k3l") + { + enable_k3l_tracing = true; + } + else if (tok == "r2") + { + enable_r2_tracing = true; + } + else if (tok == "rdsi") + { + enable_rdsi_tracing = true; + } + } + + Logfile logfile; + + /* k3l tracing */ + if (enable_k3l_tracing) + { + K::LogConfig::set(logfile, "K3L", "Value", enable_k3l_tracing); + K::LogConfig::set(logfile, "K3L", "CallProgress", enable_k3l_tracing); + K::LogConfig::set(logfile, "K3L", "CallAnalyzer", enable_k3l_tracing); + K::LogConfig::set(logfile, "K3L", "CadenceRecog", enable_k3l_tracing); + K::LogConfig::set(logfile, "K3L", "CallControl", enable_k3l_tracing); + K::LogConfig::set(logfile, "K3L", "Fax", enable_k3l_tracing); + } + + /* r2 tracing */ + K::LogConfig::set(logfile, "R2", "Value", enable_r2_tracing); + K::LogConfig::set(logfile, "R2", "Signaling", enable_r2_tracing); + K::LogConfig::set(logfile, "R2", "States", enable_r2_tracing); + + /* ISDN tracing */ + if (enable_rdsi_tracing ^ Globals::flag_trace_rdsi) + { + K::LogConfig::set(logfile, "ISDN", "Value", enable_rdsi_tracing); + K::LogConfig::set(logfile, "ISDN", "Lapd", enable_rdsi_tracing); + K::LogConfig::set(logfile, "ISDN", "Q931", enable_rdsi_tracing); + } + + try + { + Globals::k3lapi.command(-1, -1, CM_LOG_UPDATE); + } + catch(...) + { + LOG(ERROR,"Error while send command CM_LOG_UPDATE"); + } +} + +switch_xml_t Opt::processSimpleXML(switch_xml_t &xml, const std::string& child_name) +{ + switch_xml_t param, child; + + if ((child = switch_xml_child(xml, child_name.c_str()))) + { + for (param = switch_xml_child(child, "param"); param; param = param->next) + { + char *var = (char *) switch_xml_attr_soft(param, "name"); + char *val = (char *) switch_xml_attr_soft(param, "value"); + + try + { + DBG(FUNC,FMT("loading '%s' options: '%s'...") + % var + % val); + + Globals::options.process(var, val); + } + catch (ConfigProcessFailure e) + { + LOG(ERROR,FMT("config processing error: %s. [%s=%s]") + % e.msg.c_str() + % var + % val); + + } + } + } + + return child; +} + +void Opt::processGroupXML(switch_xml_t &xml) +{ + switch_xml_t param, child; + + if ((child = switch_xml_child(xml,"groups"))) + { + for (param = switch_xml_child(child, "param"); param; param = param->next) + { + char *var = (char *) switch_xml_attr_soft(param, "name"); + char *val = (char *) switch_xml_attr_soft(param, "value"); + + try + { + DBG(FUNC,FMT("loading group '%s' options: '%s'...") + % var + % val); + + _groups.insert(GroupToDestPairType(var,val)); + + } + catch (ConfigProcessFailure e) + { + LOG(ERROR,FMT("config processing error: %s. [%s=%s]") + % e.msg.c_str() + % var + % val); + } + } + } +} + +void Opt::processCadenceXML(switch_xml_t &xml) +{ + switch_xml_t param, child; + + if ((child = switch_xml_child(xml,"cadences"))) + { + for (param = switch_xml_child(child, "param"); param; param = param->next) + { + char *var = (char *) switch_xml_attr_soft(param, "name"); + char *val = (char *) switch_xml_attr_soft(param, "value"); + + try + { + DBG(FUNC,FMT("loading cadences '%s' options: '%s'...") + % var + % val); + + Strings::vector_type values; + Strings::tokenize(val, values, " :,."); + + if (values.size() != 2 && values.size() != 4) + { + LOG(WARNING, FMT("file '%s': wrong number of arguments at cadence '%s'!") + % "khomp.conf.xml" + % var); + } + else + { + CadenceType cadence; + + cadence.ring = Strings::toulong(Strings::trim(values[0])); + cadence.ring_s = Strings::toulong(Strings::trim(values[1])); + + if (values.size() == 4) + { + cadence.ring_ext = Strings::toulong(Strings::trim(values[2])); + cadence.ring_ext_s = Strings::toulong(Strings::trim(values[3])); + } + + _cadences.erase(var); /* erases previous (possibly predefined) cadence */ + _cadences.insert(CadencesPairType(var, cadence)); + } + } + catch (ConfigProcessFailure e) + { + LOG(ERROR,FMT("config processing error: %s. [%s=%s]") + % e.msg.c_str() + % var + % val); + + } + catch (Strings::invalid_value e) + { + LOG(ERROR,FMT("file '%s': number expected at cadence '%s', got '%s'.") + % "khomp.conf.xml" + % var + % e.value().c_str()); + } + } + } +} + +void Opt::processFXSBranchesXML(switch_xml_t &xml) +{ + switch_xml_t param, child; + + if ((child = switch_xml_child(xml,"fxs-branches"))) + { + for (param = switch_xml_child(child, "param"); param; param = param->next) + { + char *var = (char *) switch_xml_attr_soft(param, "name"); + char *val = (char *) switch_xml_attr_soft(param, "value"); + + + DBG(FUNC,FMT("loading fxs-branches '%s' options: '%s'...") + % var + % val); + + try + { + unsigned long orig_number = Strings::toulong(var); + + /* gcc! stop complaining! */ + (void)orig_number; + + Strings::vector_type boards; + Strings::tokenize(val, boards, " :,"); + + if (boards.size() < 1) + { + DBG(FUNC,FMT("file '%s': orig number '%s' without any board!") + % "khomp.conf.xml" + % var); + continue; + } + + for (Strings::vector_type::iterator iter = boards.begin(); iter != boards.end(); iter++) + { + /* quebrar em strings por vÃrgula/espaço */ + unsigned long serial_number = Strings::toulong(Strings::trim(*iter)); + + bool found = false; + + for (unsigned int device = 0; device < Globals::k3lapi.device_count(); device++) + { + K3L_DEVICE_CONFIG & conf = Globals::k3lapi.device_config(device); + + std::string str_serial(conf.SerialNumber); + + if (Strings::toulong(str_serial) == serial_number) + { + found = true; + + _fxs_orig_base.insert(BoardToOrigPairType(device, var)); + break; + } + } + + if (!found) + { + LOG(WARNING, FMT("file 'khomp.conf.xml': board with serial number '%u' not found!") + % serial_number); + + break; + } + } + } + catch (ConfigProcessFailure e) + { + LOG(ERROR,FMT("config processing error: %s. [%s=%s]") + % e.msg.c_str() + % var + % val); + } + catch (Strings::invalid_value & e) + { + LOG(ERROR, D("invalid numeric value: %s") % e.value()); + } + catch (...) + { + LOG(ERROR, D("config processing error...")); + } + } + } +} + +void Opt::processFXSHotlines(switch_xml_t &xml) +{ + switch_xml_t param, child; + + if ((child = switch_xml_child(xml,"fxs-hotlines"))) + { + for (param = switch_xml_child(child, "param"); param; param = param->next) + { + char *var = (char *) switch_xml_attr_soft(param, "name"); + char *val = (char *) switch_xml_attr_soft(param, "value"); + + try + { + DBG(FUNC,FMT("loading fxs-hotlines '%s' options: '%s'...") + % var + % val); + + unsigned long orig_number = Strings::toulong(var); + + (void)orig_number; /* stop complaining! */ + + _fxs_hotline.insert(OrigToDestPairType(var, val)); + + } + catch (ConfigProcessFailure e) + { + LOG(ERROR,FMT("config processing error: %s. [%s=%s]") + % e.msg.c_str() + % var + % val); + } + catch (Strings::invalid_value e) + { + LOG(WARNING, FMT("file '%s': number expected, got '%s'!") + % "khomp.conf.xml" % e.value().c_str()); + } + } + } +} + +void Opt::processFXSOptions(switch_xml_t &xml) +{ + switch_xml_t param, child; + + if ((child = switch_xml_child(xml,"fxs-options"))) + { + for (param = switch_xml_child(child, "param"); param; param = param->next) + { + char *var = (char *) switch_xml_attr_soft(param, "name"); + char *val = (char *) switch_xml_attr_soft(param, "value"); + + try + { + DBG(FUNC,FMT("loading fxs-options '%s' options: '%s'...") + % var + % val); + + Strings::vector_type branches; + Strings::tokenize(var, branches, " ,"); + + if (branches.size() < 1) + { + //TODO: Get linenumber + LOG(WARNING, FMT("file '%s': no branches specified in line %d!") + % "khomp.conf.xml" % 0); + } + else + { + for (Strings::vector_type::iterator iter = branches.begin(); + iter != branches.end(); iter++) + { + std::string tmp_branch = Strings::trim(*iter); + + unsigned long branch_number = Strings::toulong(tmp_branch); + (void) branch_number; + + _branch_options.insert(BranchToOptPairType(tmp_branch, val)); + } + } + } + catch (ConfigProcessFailure e) + { + LOG(ERROR,FMT("config processing error: %s. [%s=%s]") + % e.msg.c_str() + % var + % val); + } + catch (Strings::invalid_value e) + { + LOG(WARNING, FMT("file '%s': number expected, got '%s'!") + % "khomp.conf.xml" % e.value().c_str()); + } + } + } +} diff --git a/src/mod/endpoints/mod_khomp/src/spec.cpp b/src/mod/endpoints/mod_khomp/src/spec.cpp new file mode 100644 index 0000000..5af0263 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/src/spec.cpp @@ -0,0 +1,885 @@ +/******************************************************************************* + + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2010 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the LGPL + License. If you do not delete the provisions above, a recipient may use your + version of this file under either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*******************************************************************************/ + +#include <regex.hpp> +#include "spec.h" +#include "logger.h" +#include "khomp_pvt.h" +#include "khomp_pvt_kxe1.h" + +/************************** Forward declaration *******************************/ +static SpecRetType processSpecAtom(std::string &, SpecFlagsType &, SpecFunType &); +static SpecRetType processSpecAtoms(std::string &, SpecFlagsType &, SpecFunType &); + +static bool processCallChannelString(std::string &, Board::KhompPvt *&, int *, bool need_free = true); + +/******************************************************************************/ + +static SpecRetType processSpecAtom(std::string & atom, SpecFlagsType & flags, SpecFunType & fun) +{ + std::string allocstr = Strings::trim(atom); + + DBG(FUNC, D("allocation string 'atom': %s") % allocstr.c_str()); + + /* check if is a group */ + if (allocstr.size() >= 1 && (allocstr[0] == 'g' || allocstr[0] == 'G')) + { + std::string group_name = allocstr.substr(1); + + Opt::GroupToDestMapType::iterator it = Opt::_groups.find(group_name); + + if (it == Opt::_groups.end()) + { + LOG(ERROR, FMT("invalid dial string '%s': no valid group found!") % allocstr.c_str()); + return SPR_FAIL; + } + + allocstr = it->second; + return processSpecAtoms(allocstr, flags, fun); + } + + Regex::Expression e("(((([bB])[ ]*([0-9]+))|(([sS])[ ]*([0-9]+)))[ ]*(([cClL])[ ]*([0-9]+)[ ]*([-][ ]*([0-9]+))?)?)|(([rR])[ ]*([0-9]+)[ ]*([-][ ]*([0-9]+))?)", Regex::E_EXTENDED); + + Regex::Match what(allocstr, e); + + if (!what.matched()) + { + LOG(ERROR, FMT("invalid dial string '%s': this is not a valid expression.") % allocstr.c_str()); + return SPR_FAIL; + } + + bool reverse = true; + + try + { + + unsigned long int board_id = UINT_MAX; + + if (what.matched(3)) //matched [bB] + { + board_id = Strings::toulong(what.submatch(5)); + + DBG(FUNC, D("board matched: %d") % board_id); + + + if (board_id >= Globals::k3lapi.device_count()) + { + LOG(ERROR, FMT("invalid dial string '%s': no such board '%d'.") % allocstr.c_str() % board_id); + return SPR_FAIL; + } + + switch ((what.submatch(4))[0]) + { + case 'b': reverse = false; break; + case 'B': reverse = true; break; + } + } + + else if (what.matched(6)) //matched [sS] + { + unsigned int serial_id = Strings::toulong(what.submatch(8)); + + DBG(FUNC, D("serial matched: %d") % serial_id); + + for (unsigned int i = 0; i < Globals::k3lapi.device_count(); i++) + { + + K3L_DEVICE_CONFIG conf = Globals::k3lapi.device_config(i); + + unsigned int tmp = Strings::toulong((const char *)conf.SerialNumber); + + if (tmp == serial_id) + { + board_id = i; + break; + } + } + + if (board_id == UINT_MAX) + { + LOG(ERROR, FMT("invalid dial string '%s': there is no board with serial '%04d'.") % allocstr.c_str() % serial_id); + return SPR_FAIL; + } + + switch ((what.submatch(7))[0]) + { + case 's': reverse = false; break; + case 'S': reverse = true; break; + } + } + else if (what.matched(14)) //matched [rR] + { + std::string base_addr = what.submatch(16); + + unsigned int branch_id = Strings::toulong(base_addr); + + if (what.matched(17)) + { + unsigned int branch2_id = Strings::toulong(what.submatch(18)); + + DBG(FUNC, D("branch range matched (%d to %d)") % branch_id % branch2_id); + + switch ((what.submatch(15))[0]) + { + case 'r': reverse = false; break; + case 'R': reverse = true; break; + } + + if (!reverse) + { + for (unsigned int i = branch_id; i <= branch2_id; i++) + { + std::string call_addr = BoardE1::KhompPvtFXS::padOrig(base_addr, i - branch_id); + Opt::BranchToObjectMapType::iterator i = Opt::_fxs_branch_map.find(call_addr); + + if (i == Opt::_fxs_branch_map.end()) + { + LOG(WARNING, FMT("invalid value '%s': there is no such branch number.") % call_addr); + return SPR_FAIL; + } + + if (!fun(i->second.first, i->second.second, flags)) + return SPR_SUCCESS; + } + } + else + { + for (unsigned int i = branch2_id; i >= branch_id; i--) + { + std::string call_addr = BoardE1::KhompPvtFXS::padOrig(base_addr, i - branch_id); + + Opt::BranchToObjectMapType::iterator i = Opt::_fxs_branch_map.find(call_addr); + + if (i == Opt::_fxs_branch_map.end()) + { + LOG(WARNING, FMT("invalid value '%s': there is no such branch number.") % call_addr); + return SPR_FAIL; + } + + if (!fun(i->second.first, i->second.second, flags)) + return SPR_SUCCESS; + } + } + } + else + { + DBG(FUNC, D("branch matched: %s") % base_addr); + + Opt::BranchToObjectMapType::iterator i = Opt::_fxs_branch_map.find(base_addr); + + if (i == Opt::_fxs_branch_map.end()) + { + LOG(WARNING, FMT("invalid value '%s': there is no such branch number.") % base_addr); + return SPR_FAIL; + } + + if (!fun(i->second.first, i->second.second, flags)) + return SPR_SUCCESS; + } + } + + else + { + LOG(ERROR, FMT("invalid dial string '%s': unknown allocation method.") % allocstr.c_str()); + return SPR_FAIL; + } + + if (what.matched(9)) // matched something about links/channels [cClL]n|[cC]n-m + { + DBG(FUNC, D("channel/link matched")); + unsigned long int object_id = Strings::toulong(what.submatch(11)); + + if (what.matched(12)) + { + + DBG(FUNC, D("channel range matched")); // matched [cC]n-m + + if ((what.submatch(10))[0] != 'c' && (what.submatch(10))[0] != 'C') + { + LOG(ERROR, FMT("invalid dial string '%s': range just allowed for channels.") % allocstr.c_str()); + return SPR_FAIL; + } + + unsigned long int object2_id = Strings::toulong(what.submatch(13)); + + DBG(FUNC, D("(d=%d,lo=%d,up=%d,r=%s) c") % board_id % object_id % object2_id % (reverse ? "true" : "false")); + + if (reverse) + { + for (unsigned int obj = std::min<unsigned int>(object2_id + 1, Globals::k3lapi.channel_count(board_id)); obj > 0 && obj > object_id; obj--) + { + if (!fun(board_id, obj-1, flags)) + return SPR_SUCCESS; + } + } + else + { + for (unsigned int obj = object_id; obj < std::min<unsigned int>(Globals::k3lapi.channel_count(board_id), object2_id + 1); obj++) + { + if (!fun(board_id, obj, flags)) + return SPR_SUCCESS; + } + } + + } + + else // matched [cClL]n + { + DBG(FUNC, D("individual channel/link matched")); + + switch ((what.submatch(10))[0]) + { + case 'C': + case 'c': + DBG(FUNC, D("individual channel matched")); + + if (!fun(board_id, object_id, flags)) + return SPR_SUCCESS; + + return SPR_CONTINUE; + + case 'l': + case 'L': + DBG(FUNC, D("individual link matched")); + + switch (Globals::k3lapi.device_type(board_id)) + { + case kdtE1: + case kdtPR: + case kdtE1GW: + case kdtE1IP: + case kdtE1Spx: +#if K3L_AT_LEAST(2,1,0) + case kdtE1FXSSpx: +#endif + { + unsigned int link_first = object_id * 30; + unsigned int link_final = ((object_id + 1) * 30); + + if (reverse) + { + for (unsigned int obj = std::min(link_final, Globals::k3lapi.channel_count(board_id)); obj > 0 && obj > link_first; obj--) + { + if (!fun(board_id, obj-1, flags)) + return SPR_SUCCESS; + } + } + else + { + for (unsigned int obj = link_first; obj < std::min(Globals::k3lapi.channel_count(board_id), link_final); obj++) + { + if (!fun(board_id, obj, flags)) + return SPR_SUCCESS; + } + } + return SPR_CONTINUE; + + } + + default: + LOG(ERROR, FMT("invalid dial string '%s': board '%d' does not have links.") + % allocstr.c_str() % board_id); + return SPR_FAIL; + } + + default: + LOG(ERROR, FMT("invalid dial string '%s': invalid object specification.") % allocstr.c_str()); + return SPR_FAIL; + } + } + } + else if (what.matched(3) || what.matched(6)) // matched something about boards [bBsS] + { + if (reverse) + { + for (unsigned int obj = Globals::k3lapi.channel_count(board_id); obj > 0; obj--) + { + if (!fun(board_id, obj-1, flags)) + return SPR_SUCCESS; + } + } + else + { + for (unsigned int obj = 0; obj < Globals::k3lapi.channel_count(board_id); obj++) + { + if (!fun(board_id, obj, flags)) + return SPR_SUCCESS; + } + } + } + + } + catch (Strings::invalid_value e) + { + LOG(ERROR, FMT("invalid dial string '%s': invalid numeric value specified.") % allocstr.c_str()); + return SPR_FAIL; + } + catch (Function::EmptyFunction & e) + { + LOG(ERROR, FMT("invalid function.")); + return SPR_FAIL; + } + + return SPR_CONTINUE; +} + +static SpecRetType processSpecAtoms(std::string & gotatoms, SpecFlagsType & flags, SpecFunType & fun) +{ + std::string atoms(gotatoms); + + DBG(FUNC, D("allocation string 'atoms': %s") % atoms); + + + if (!atoms.empty() && (atoms.at(0) == '*')) //so it is a "cyclical" allocation + { + atoms.erase(0, 1); + + if (flags & SPF_FIRST) + { + if (!(flags & SPF_CYCLIC)) + { + DBG(FUNC, D("got a cyclic/fair allocation (%s), priorizing less used channels...") % atoms); + flags |= SPF_CYCLIC; + } + } + else + { + DBG(FUNC, D("cyclic/fair allocation NOT at first string, ignoring...")); + } + } + + + Strings::vector_type boundaries; + Strings::tokenize(atoms, boundaries, "+"); + + if (boundaries.size() < 1) + { + LOG(ERROR, FMT("invalid dial string '%s': no allocation string found!") % atoms); + return SPR_FAIL; + } + + for (Strings::vector_type::iterator iter = boundaries.begin(); iter != boundaries.end(); iter++) + { + switch (processSpecAtom(*iter, flags, fun)) + { + // if had some error processing dialstring, bail out.. + case SPR_FAIL: + return SPR_FAIL; + + // found someone? return ASAP! + case SPR_SUCCESS: + return SPR_SUCCESS; + + // else, keep going.. + case SPR_CONTINUE: + break; + } + + flags &= ~SPF_FIRST; + } + + /* found nothing, but this is NOT an error */ + return SPR_CONTINUE; +} + +struct funProcessCallChannelString +{ + funProcessCallChannelString(int *cause, bool need_free) + : _cause(cause), _need_free(need_free), + _all_fail(true), //_fxs_only(true), + _pvt(NULL) + {}; + + bool operator()(unsigned int dev, unsigned int obj, SpecFlagsType & flags) + { + try + { + Board::KhompPvt *tmp = Board::get(dev, obj); + + // used for cause definition + if (_all_fail) + _all_fail = (tmp ? !tmp->isOK() : true); + } + catch (K3LAPI::invalid_channel & err) + { + _all_fail = true; + } + + //used for precise cause definition + //if (_fxs_only) + // _fxs_only = (tmp ? tmp->is_fxs() : false); + + if (flags & SPF_CYCLIC) + { + Board::queueAddChannel(_channels, dev, obj); + return true; + } + else + { + _pvt = Board::findFree(dev, obj, _need_free); + return (_pvt == NULL); + } + return true; + } + + Board::KhompPvt * pvt(SpecFlagsType & flags) + { + + if ((flags & SPF_CYCLIC) && !_pvt) + { + //we have no pvt 'till now, lets find a suitable one.. + _pvt = Board::queueFindFree(_channels); + } + + if (!_pvt && _cause && !(*_cause)) + { + + if (_all_fail) + { + // all channels are in fail + *_cause = SWITCH_CAUSE_NETWORK_OUT_OF_ORDER; + } + else + { + //if (_fxs_only) + // *_cause = SWITCH_CAUSE_USER_BUSY; + //else + *_cause = SWITCH_CAUSE_SWITCH_CONGESTION; + } + } + + return _pvt; + } + + int * _cause; + + bool _need_free; + + bool _all_fail; + //bool _fxs_only; //TODO: futuro implementar a parte de FXS + + Board::KhompPvt * _pvt; + Board::PriorityCallQueue _channels; +}; + +struct funProcessSMSChannelString +{ + + funProcessSMSChannelString(int *cause) + : _cause(cause), _all_fail(true), _pvt(NULL) + {}; + + bool operator()(unsigned int dev, unsigned int obj, SpecFlagsType & flags) + { + Board::KhompPvt *pvt = Board::findFree(dev, obj); + + if (pvt) + { + // found something? check if its GSM + if (pvt->application(SMS_CHECK, NULL, NULL)) + { + // used for cause definition + if (_all_fail) + _all_fail = (pvt ? !pvt->isOK() : true); + + if (flags & SPF_CYCLIC) + { + Board::queueAddChannel(_channels, dev, obj); + return true; + } + else + { + _pvt = pvt; + return false; + } + } + else + { + // not gsm, return ASAP and stop search + LOG(ERROR, PVT_FMT(pvt->target(), "channel is NOT a GSM channel! unable to send message!")); + return false; + } + } + + // keep searching + return true; + } + + Board::KhompPvt * pvt(SpecFlagsType & flags) + { + if ((flags & SPF_CYCLIC) && !_pvt) + { + // we have no pvt 'till now, lets find a suitable one.. + _pvt = Board::queueFindFree(_channels); + } + + if (!_pvt && _cause && !(*_cause)) + { + if (_all_fail) + { + // all channels are in fail + *_cause = SWITCH_CAUSE_NETWORK_OUT_OF_ORDER; + } + else + { + // otherwise, congestion.. + *_cause = SWITCH_CAUSE_SWITCH_CONGESTION; + } + } + + return _pvt; + } + + int * _cause; + + bool _need_free; + + bool _all_fail; + + Board::KhompPvt * _pvt; + Board::PriorityCallQueue _channels; +}; + +struct FunProcessGroupString +{ + /* used for group processing */ + FunProcessGroupString(std::string ctx) + : _ctx(ctx) {}; + + FunProcessGroupString(const FunProcessGroupString &o) + : _ctx(o._ctx) {}; + + bool operator()(unsigned int dev, unsigned int obj, SpecFlagsType & flags) const + { + try + { + Board::KhompPvt * pvt = Board::get(dev,obj); + + DBG(CONF, FMT("loading context %s for channel %d,%d") % _ctx % dev % obj); + + if (pvt) pvt->_group_context = _ctx; + } + catch (K3LAPI::invalid_channel & err) + { + } + + return true; + } + + + std::string _ctx; +}; + +static bool processCallChannelString(std::string & str, Board::KhompPvt *& pvt, int * cause, bool need_free) +{ + funProcessCallChannelString proc(cause, need_free); + + SpecFlagsType flags = SPF_FIRST; + SpecFunType fun(proc, false); // = ReferenceWrapper < SpecFunType > (proc); + + bool ret = true; + + switch (processSpecAtoms(str, flags, fun)) + { + case SPR_FAIL: + DBG(FUNC, D("SPR_FAIL: %p") % cause); + + if (cause) + *cause = SWITCH_CAUSE_INVALID_NUMBER_FORMAT; + + ret = false; + break; + case SPR_SUCCESS: + case SPR_CONTINUE: + pvt = proc.pvt(flags); + DBG(FUNC, D("pvt = %p") % pvt); + + if (!pvt && cause && !(*cause)) + *cause = SWITCH_CAUSE_INTERWORKING; + + ret = true; + break; + } + + return ret; +} + +bool processSMSChannelString(std::string & str, Board::KhompPvt *& pvt, int *cause) +{ + funProcessSMSChannelString proc(cause); + + SpecFlagsType flags = SPF_FIRST; + SpecFunType fun(proc, false); + + switch (processSpecAtoms(str, flags, fun)) + { + case SPR_FAIL: + DBG(FUNC, FMT("SPR_FAIL: %p") % cause); + if (cause) + *cause = SWITCH_CAUSE_INVALID_NUMBER_FORMAT; + return false; + + case SPR_SUCCESS: + case SPR_CONTINUE: + pvt = proc.pvt(flags); + DBG(FUNC, FMT("pvt = %p") % pvt); + + if (!pvt && cause && !(*cause)) + *cause = SWITCH_CAUSE_INTERWORKING; + + return true; + } + + return true; +} + +Board::KhompPvt * processDialString (const char *dial_charv, int *cause) +{ + DBG(FUNC, D("c (%p, %p)") % dial_charv % cause); + std::string dial_string(dial_charv); + Strings::vector_type dial_args; + + Strings::tokenize(dial_string, dial_args, "/"); + + Board::KhompPvt *pvt = NULL; + + DBG(FUNC, FMT("processing dial string [%d] : '%s'") % dial_args.size() % dial_string); + + if ((dial_args.size() < 1 && dial_args.size() > 3)) + { + LOG(ERROR, FMT("invalid dial string '%s': wrong number of separators ('/').") % dial_string); + return NULL; + } + + bool dial_string_ok = processCallChannelString(dial_args[0], pvt, cause, true); + + if (pvt == NULL) + { + if (dial_string_ok) + LOG(WARNING, "unable to allocate channel -- no free channel found!"); + return NULL; + } + + DBG(FUNC, PVT_FMT(pvt->target(), "pvt %p") % pvt); + + unsigned int opt_size = (pvt->hasNumberDial() ? 3 : 2); + unsigned int opt_arg = opt_size - 1; + + if (dial_args.size() == opt_size) + { + Strings::vector_type options_args; + Strings::tokenize (dial_args[opt_arg], options_args, ":"); + + for (Strings::vector_type::iterator opt_arg = options_args.begin(); + opt_arg != options_args.end(); opt_arg++) + { + std::string str = (*opt_arg); + + Strings::vector_type option_item; + Strings::tokenize (str, option_item, "="); + + switch (option_item.size()) + { + case 2: + { + std::string index (option_item[0]); + std::string value (option_item[1]); + + if(pvt->call()->process(index, value)) + continue; + + break; + } + + case 1: + { + std::string index (option_item[0]); + + if(pvt->call()->process(index)) + continue; + + break; + } + + default: + { + LOG(ERROR, FMT("invalid option specification '%s'.") % str); + continue; + } + } + LOG(ERROR, FMT("unknown option name '%s', ignoring...") % str); + } + } + + if(pvt->hasNumberDial()) + { + if (dial_args.size() <= 1) + { + LOG(ERROR, FMT("invalid dial string '%s': missing destination number!") % dial_string); + return NULL; + } + + std::string name ("dest"); + std::string value (dial_args[1]); + + pvt->call()->process(name, value); + + //pvt->call()->dest_addr = dial_args[1]; + } + + return pvt; +}; + +Board::KhompPvt * processSMSString (const char *sms_charv, int *cause) +{ + std::string sms_string(sms_charv); + Strings::vector_type sms_args; + + Strings::tokenize(sms_string, sms_args, "/|,", 3); // '/' is a backward compatibility feature! + + DBG(FUNC, FMT("processing SMS string [%d] : '%s'") % sms_args.size() % sms_string); + + if (sms_args.size () != 3) + { + LOG(ERROR, FMT("invalid dial string '%s': wrong number of separators.") % sms_string); + return NULL; + } + + Board::KhompPvt *pvt = NULL; + + bool dial_string_ok = processSMSChannelString(sms_args[0], pvt, cause); + + if (pvt == NULL) + { + if (dial_string_ok) + { + LOG(WARNING, "unable to allocate channel -- no free channel found!"); + } + + return NULL; + } + else + { + if (!pvt->application(SMS_CHECK, NULL, NULL)) + { + LOG(ERROR, PVT_FMT(pvt->target(), "allocated channel is NOT a GSM channel! unable to send message!")); + + return NULL; + } + } + + +/* + std::string dest(sms_args[1]); + + bool conf = false; + + if (dest[0] == '!') + { + dest.erase(0,1); + conf = true; + } + + if (dest[dest.size()-1] == '!') + { + dest.erase(dest.size()-1,1); + conf = true; + } + + // get options/values + pvt->send_sms.sms_dest = dest; + pvt->send_sms.sms_conf = conf; + pvt->send_sms.sms_body = sms_args[2]; +*/ + + return pvt; +}; + +void processGroupString() +{ + for (Opt::GroupToDestMapType::iterator i = Opt::_groups.begin(); i != Opt::_groups.end(); i++) + { + const std::string & name = (*i).first; + std::string & opts = (*i).second; + + Strings::vector_type tokens; + Strings::tokenize(opts, tokens, ",:", 2); + + if (tokens.size() != 2 && tokens.size() != 1) + { + LOG(WARNING, FMT("wrong number of arguments at group '%s', ignoring group!\n") % name.c_str()); + opts.clear(); + continue; + } + + if (tokens.size() < 2) + continue; + FunProcessGroupString proc(tokens[1]); + + SpecFlagsType flags = SPF_FIRST; + SpecFunType fun(proc, false); + + switch (processSpecAtoms(tokens[0], flags, fun)) + { + case SPR_CONTINUE: + // remove context from spec + opts = tokens[0]; + + // log this! + DBG(CONF, FMT("group '%s' is now '%s', with context '%s'...") + % name % tokens[0] % tokens[1]); + break; + + default: + LOG(WARNING, FMT("skipping group '%s', bad configuration!\n") % name.c_str()); + + // "zero" group + opts.clear(); + + // log this! + DBG(CONF, FMT("group '%s' have misconfigured options, ignoring...") % name); + break; + } + } +} + diff --git a/src/mod/endpoints/mod_khomp/src/utils.cpp b/src/mod/endpoints/mod_khomp/src/utils.cpp new file mode 100644 index 0000000..9044e60 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/src/utils.cpp @@ -0,0 +1,393 @@ +/******************************************************************************* + + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2010 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the LGPL + License. If you do not delete the provisions above, a recipient may use your + version of this file under either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*******************************************************************************/ + +#include <utils.h> +#include "khomp_pvt.h" + + +void Kflags::init() +{ + _flags[CONNECTED]._name = "CONNECTED"; + _flags[CONNECTED]._value = false; + _flags[REALLY_CONNECTED]._name = "REALLY_CONNECTED"; + _flags[REALLY_CONNECTED]._value = false; + _flags[IS_OUTGOING]._name = "IS_OUTGOING"; + _flags[IS_OUTGOING]._value = false; + _flags[IS_INCOMING]._name = "IS_INCOMING"; + _flags[IS_INCOMING]._value = false; + _flags[STREAM_UP]._name = "STREAM_UP"; + _flags[STREAM_UP]._value = false; + _flags[LISTEN_UP]._name = "LISTEN_UP"; + _flags[LISTEN_UP]._value = false; + _flags[GEN_CO_RING]._name = "GEN_CO_RING"; + _flags[GEN_CO_RING]._value = false; + _flags[GEN_PBX_RING]._name = "GEN_PBX_RING"; + _flags[GEN_PBX_RING]._value = false; + _flags[HAS_PRE_AUDIO]._name = "HAS_PRE_AUDIO"; + _flags[HAS_PRE_AUDIO]._value = false; + _flags[HAS_CALL_FAIL]._name = "HAS_CALL_FAIL"; + _flags[HAS_CALL_FAIL]._value = false; + _flags[DROP_COLLECT]._name = "DROP_COLLECT"; + _flags[DROP_COLLECT]._value = false; + _flags[NEEDS_RINGBACK_CMD]._name = "NEEDS_RINGBACK_CMD"; + _flags[NEEDS_RINGBACK_CMD]._value = false; + _flags[EARLY_RINGBACK]._name = "EARLY_RINGBACK"; + _flags[EARLY_RINGBACK]._value = false; + _flags[FAX_DETECTED]._name = "FAX_DETECTED"; + _flags[FAX_DETECTED]._value = false; + _flags[FAX_SENDING]._name = "FAX_SENDING"; + _flags[FAX_SENDING]._value = false; + _flags[FAX_RECEIVING]._name = "FAX_RECEIVING"; + _flags[FAX_RECEIVING]._value = false; + _flags[OUT_OF_BAND_DTMFS]._name = "OUT_OF_BAND_DTMFS"; + _flags[OUT_OF_BAND_DTMFS]._value = false; + _flags[KEEP_DTMF_SUPPRESSION]._name = "KEEP_DTMF_SUPPRESSION"; + _flags[KEEP_DTMF_SUPPRESSION]._value = false; + _flags[KEEP_ECHO_CANCELLATION]._name = "KEEP_ECHO_CANCELLATION"; + _flags[KEEP_ECHO_CANCELLATION]._value = false; + _flags[KEEP_AUTO_GAIN_CONTROL]._name = "KEEP_AUTO_GAIN_CONTROL"; + _flags[KEEP_AUTO_GAIN_CONTROL]._value = false; + _flags[WAIT_SEND_DTMF]._name = "WAIT_SEND_DTMF"; + _flags[WAIT_SEND_DTMF]._value = false; + _flags[CALL_WAIT_SEIZE]._name = "CALL_WAIT_SEIZE"; + _flags[CALL_WAIT_SEIZE]._value = false; + _flags[NUMBER_DIAL_FINISHD]._name = "NUMBER_DIAL_FINISHD"; + _flags[NUMBER_DIAL_FINISHD]._value = false; + _flags[NUMBER_DIAL_ONGOING]._name = "NUMBER_DIAL_ONGOING"; + _flags[NUMBER_DIAL_ONGOING]._value = false; + + _flags[FXS_OFFHOOK]._name = "FXS_OFFHOOK"; + _flags[FXS_OFFHOOK]._value = false; + _flags[FXS_DIAL_FINISHD]._name = "FXS_DIAL_FINISHD"; + _flags[FXS_DIAL_FINISHD]._value = false; + _flags[FXS_DIAL_ONGOING]._name = "FXS_DIAL_ONGOING"; + _flags[FXS_DIAL_ONGOING]._value = false; + _flags[FXS_FLASH_TRANSFER]._name = "FXS_FLASH_TRANSFER"; + _flags[FXS_FLASH_TRANSFER]._value = false; + _flags[XFER_QSIG_DIALING]._name = "XFER_QSIG_DIALING"; + _flags[XFER_QSIG_DIALING]._value = false; + _flags[XFER_DIALING]._name = "XFER_DIALING"; + _flags[XFER_DIALING]._value = false; + + _flags[SMS_DOING_UPLOAD]._name = "SMS_DOING_UPLOAD"; + _flags[SMS_DOING_UPLOAD]._value = false; + + /* + NOW LOADING ... + + _flags[BRIDGED]._name = "BRIDGED"; + _flags[BRIDGED]._value = false; + */ + + _flags[INVALID_FLAG]._name = "INVALID_FLAG"; + _flags[INVALID_FLAG]._value = false; +} + + +/* Command */ + +bool ChanCommandHandler::writeNoSignal(const CommandRequest & cmd) +{ + _fifo->_mutex.lock(); + bool status = _fifo->_buffer.provide(cmd); + _fifo->_mutex.unlock(); + return status; +}; + +bool ChanCommandHandler::write(const CommandRequest & cmd) +{ + bool status = writeNoSignal(cmd); + + if (status) signal(); + + return status; +}; + +void ChanCommandHandler::unreference() +{ + + if (!_fifo) + return; + + if(_fifo->_thread) + { + _fifo->_thread->join(); + delete _fifo->_thread; + _fifo->_thread = NULL; + } + + delete _fifo; + _fifo = NULL; +}; + + +/* Event */ + +bool ChanEventHandler::provide(const EventRequest & evt) +{ + _fifo->_mutex.lock(); + bool status = _fifo->_buffer.provide(evt); + _fifo->_mutex.unlock(); + return status; +}; + +bool ChanEventHandler::writeNoSignal(const EventRequest & evt) +{ + bool status = true; + _fifo->_mutex.lock(); + + try + { + _fifo->_buffer.provider_start().mirror(evt); + _fifo->_buffer.provider_commit(); + } + catch(...) //BufferFull & e + { + status = false; + } + + _fifo->_mutex.unlock(); + return status; +}; + +bool ChanEventHandler::write(const EventRequest & evt) +{ + bool status = writeNoSignal(evt); + + if (status) signal(); + + return status; +}; + +void ChanEventHandler::unreference() +{ + + if (!_fifo) + return; + + if(_fifo->_thread) + { + _fifo->_thread->join(); + delete _fifo->_thread; + _fifo->_thread = NULL; + } + + delete _fifo; + _fifo = NULL; +}; + +const char * answerInfoToString(int answer_info) +{ + switch (answer_info) + { + case Board::KhompPvt::CI_MESSAGE_BOX: + return "MessageBox"; + case Board::KhompPvt::CI_HUMAN_ANSWER: + return "HumanAnswer"; + case Board::KhompPvt::CI_ANSWERING_MACHINE: + return "AnsweringMachine"; + case Board::KhompPvt::CI_CARRIER_MESSAGE: + return "CarrierMessage"; + case Board::KhompPvt::CI_UNKNOWN: + return "Unknown"; + case Board::KhompPvt::CI_FAX: + return "Fax"; + } + + return NULL; +} + +/******************************** Kommuter ************************************/ +bool Kommuter::stop() +{ + if(_kwtd_timer_on) + { + Globals::global_timer->del(_kwtd_timer_index); + _kwtd_timer_on = false; + } + + /* stop all watches */ + if (Opt::_kommuter_activation == "auto") + { + for (int kommuter = 0 ; kommuter < _kommuter_count ; kommuter++) + { + try + { + Globals::k3lapi.command(-1, kommuter, CM_STOP_WATCHDOG); + LOG(MESSAGE, FMT("kommuter device (%d) was stoped at finalize_module().") % kommuter); + } + catch(K3LAPI::failed_command & e) + { + LOG(ERROR, FMT("could not stop the Kommuter device (%d) at finalize_module().") % kommuter); + } + + } + } + + return true; +} + +bool Kommuter::initialize(K3L_EVENT *e) +{ + /* get total of kommuter devices */ + _kommuter_count = e->AddInfo; + + if(Opt::_kommuter_activation == "manual") + { + if (_kommuter_count > 0) + { + LOG(WARNING, "Kommuter devices were found on your system, but activation is set to manual. To activate this devices use the command 'khomp kommuter on'."); + } + + return true; + } + + if (_kommuter_count > 0) + { + bool start_timer = false; + int timeout = Opt::_kommuter_timeout; + + std::string param = STG(FMT("timeout=%d") % timeout); + + for (int kommuter = 0; kommuter < _kommuter_count; kommuter++) + { + try + { + Globals::k3lapi.command(-1, kommuter, CM_START_WATCHDOG, param.c_str()); + start_timer = true; + } + catch(K3LAPI::failed_command & e) + { + switch(e.rc) + { + case ksInvalidParams: + LOG(ERROR, FMT("invalid timeout '%d' for Kommuter device '%d' timeout. Mininum is 0, maximum is 255.") + % timeout % kommuter); + break; + default: + LOG(ERROR, FMT("could not start the kommuter device number '%d'.") % kommuter); + break; + + } + } + catch(...) + { + LOG(ERROR, FMT("could not start the kommuter device number '%d'.") % kommuter); + } + } + + if(timeout == 0) + { + DBG(FUNC, D("kommuter watchdog timer not created because timeout is 0.")); + return true; + } + + if (start_timer) + { + if (!Globals::global_timer) + { + LOG(ERROR, D("error creating the timer for kommuter.")); + } + else + { + _kwtd_timer_index = Globals::global_timer->add((timeout < 5 ? (timeout*500) : 2000), &wtdKickTimer); + _kwtd_timer_on = true; + + DBG(FUNC, D("kommuter watchdog timer created and started.")); + } + } + } + else + { + DBG(FUNC, D("no kommuter devices were found on system.")); + } + + return true; +} + +void Kommuter::wtdKickTimer(void *) +{ + try + { + bool restart_timer = false; + + for (int kommuter = 0; kommuter < Board::kommuter._kommuter_count; kommuter++) + { + try + { + Globals::k3lapi.command(-1, kommuter, CM_NOTIFY_WATCHDOG); + restart_timer = true; + DBG(FUNC, D("Kommuter device (%d) notified.") % kommuter); + } + catch(K3LAPI::failed_command & e) + { + switch(e.rc) + { + case ksInvalidState: + LOG(ERROR, FMT("Kommuter device '%d' was not initialized.") % kommuter); + break; + case ksNotAvailable: + LOG(ERROR, FMT("Kommuter device '%d' not found.") % kommuter); + break; + case ksFail: + LOG(ERROR, FMT("Kommuter notify command has failed for device '%d'.") % kommuter); + break; + default: + LOG(ERROR, FMT("Kommuter device '%d' could not be notified for some unknow reason.") % kommuter); + break; + } + } + } + + if(restart_timer) + { + Globals::global_timer->restart( Board::kommuter._kwtd_timer_index, true ); + DBG(FUNC, D("Kommuter timer restarted.")); + } + } + catch (...) + { + return; + } +} + diff --git a/src/mod/endpoints/mod_khomp/support/config_defaults.cpp b/src/mod/endpoints/mod_khomp/support/config_defaults.cpp new file mode 100644 index 0000000..9cf809e --- /dev/null +++ b/src/mod/endpoints/mod_khomp/support/config_defaults.cpp @@ -0,0 +1,50 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <config_defaults.hpp> + +/* boolean value */ +Restriction::Pair booleanValue[3] = +{ + { "Ativado", "true" }, + { "Desativado", "false" }, + { NULL , NULL }, +}; diff --git a/src/mod/endpoints/mod_khomp/support/config_defaults.hpp b/src/mod/endpoints/mod_khomp/support/config_defaults.hpp new file mode 100644 index 0000000..b3b77cf --- /dev/null +++ b/src/mod/endpoints/mod_khomp/support/config_defaults.hpp @@ -0,0 +1,75 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <configurator/restriction.hpp> + +#ifndef _CONFIG_DEFAULTS_HPP_ +#define _CONFIG_DEFAULTS_HPP_ + +/* default khomp config directory */ +#define KHOMP_CONFIG_DIR "/etc/khomp/config" + +/* define util macro for text conversion */ +#define CONV(s) \ + encoder::recode_env(encoder::C_ISO88591, s) + +/* define another util macro for text conversion */ +#define CONVU(s) \ + encoder::recode_env(encoder::C_UTF8, s) + +/* shortcut */ +#define K(x) Restriction::K_##x +#define N(x) Restriction::N_##x +#define B(x) Restriction::B_##x + +/* boolean value */ +extern Restriction::Pair booleanValue[3]; + +/* nasty shortcuts */ +#define BOOLEAN_VALUE booleanValue[0], booleanValue[1], booleanValue[2] + +#define BOOLEAN_ALWAYS_TRUE booleanValue[0], booleanValue[2] +#define BOOLEAN_ALWAYS_FALSE booleanValue[1], booleanValue[2] + +#define BOOLEAN_TRUE booleanValue[0].pretty +#define BOOLEAN_FALSE booleanValue[1].pretty + +#endif /* _CONFIG_DEFAULTS_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/support/klog-config.cpp b/src/mod/endpoints/mod_khomp/support/klog-config.cpp new file mode 100644 index 0000000..d2d743a --- /dev/null +++ b/src/mod/endpoints/mod_khomp/support/klog-config.cpp @@ -0,0 +1,122 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <config_defaults.hpp> + +#include <support/klog-config.hpp> + +Logfile::Logfile() +: Configfile("Options", "Log Options") +{ + _filename = STG(FMT("%s/klog.cfg") % KHOMP_CONFIG_DIR); + + // necessario? + add(&_logoptions); + + /* Obtain configuration, if file exists. */ + _good = obtain(); +} + +Logfile::~Logfile() +{ + /* nothing for now */ +}; + +bool Logfile::select(Section ** ptr, std::string str) +{ + // default section, needed for API compliance. + if (str == "") + *ptr = &_logoptions; + else + { + try + { + *ptr = _logoptions.section_find(str); + } + catch (Section::not_found e) + { + _errors.push_back(STG(FMT("unsupported section '%s', ignoring!") % str)); + } + } + + return (*ptr != 0); +}; + +bool Logfile::serialize(std::ofstream &fd) +{ + typedef std::vector < std::string > StrList; + + StrList vec; + + vec.push_back("KLogger"); + vec.push_back("K3L"); + vec.push_back("IntfK3L"); + vec.push_back("IntfK3L_C"); + vec.push_back("ISDN"); + vec.push_back("R2"); + vec.push_back("Firmware"); + vec.push_back("Audio"); + vec.push_back("SS7"); + vec.push_back("SIP"); + vec.push_back("GSM"); + vec.push_back("Timer"); + + for (StrList::iterator i = vec.begin(); i != vec.end(); i++) + { + fd << "[" << (*i) << "]" << std::endl; + + try + { + Section * sec = _logoptions.section_find(*i); + recurse(fd, sec); + } + catch (Section::not_found e) + { + _errors.push_back(STG(FMT("unable to find section '%s' in memory, ignoring!") % (*i))); + } + + fd << std::endl; + } + + fd << "# precisa ter um caracter sobrando no final!" << std::endl; + + return true; +} diff --git a/src/mod/endpoints/mod_khomp/support/klog-config.hpp b/src/mod/endpoints/mod_khomp/support/klog-config.hpp new file mode 100644 index 0000000..6e3e75a --- /dev/null +++ b/src/mod/endpoints/mod_khomp/support/klog-config.hpp @@ -0,0 +1,69 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#pragma GCC visibility push(default) +#include <stdexcept> +#pragma GCC visibility pop + +#include <format.hpp> + +#include <configurator/configfile.hpp> + +#include <support/klog-options.hpp> + +#ifndef _KLOG_CONFIG_HPP_ +#define _KLOG_CONFIG_HPP_ + +struct Logfile: public Configfile +{ + Logfile(); + ~Logfile(); + + bool select(Section **, std::string str = ""); + bool serialize(std::ofstream &); + + Section & root() { return _logoptions; }; + + protected: + LogOptions _logoptions; +}; + +#endif /* _KLOG_CONFIG_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/support/klog-options.cpp b/src/mod/endpoints/mod_khomp/support/klog-options.cpp new file mode 100644 index 0000000..3cb7e3e --- /dev/null +++ b/src/mod/endpoints/mod_khomp/support/klog-options.cpp @@ -0,0 +1,158 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <config_defaults.hpp> + +#include <support/klog-options.hpp> + +LogOptions::KLogger::KLogger() +: Section("KLogger", "KLogger", false) +{ + add(Option("Value", "Enable log class?", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); + add(Option("FullLog", "Log everything", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); +}; + +LogOptions::K3L::K3L() +: Section("K3L", "K3L", false) +{ + add(Option("Value", "Enable log class?", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); + add(Option("CallProgress", "Call Progress events", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); + add(Option("CallAnalyzer", "Call Analyzer events", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); + add(Option("CadenceRecog", "Cadences recognized", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); + add(Option("CallControl", "Call control", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); + add(Option("Fax", "Fax stack", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); +}; + +LogOptions::IntfK3L::IntfK3L() +: Section("IntfK3L", "IntfK3L", false) +{ + add(Option("Value", "Enable log class?", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); + add(Option("AudioEvent", "Audio events", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); +}; + +LogOptions::IntfK3L_C::IntfK3L_C() +: Section("IntfK3L_C", "IntfK3L_C", false) +{ + add(Option("Value", "Enable log class?", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); + add(Option("AudioEvent", "Audio events", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); +}; + +LogOptions::ISDN::ISDN() +: Section("ISDN", "ISDN", false) +{ + add(Option("Value", "Enable log class?", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); + add(Option("Lapd", "LAPD layer log", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); + add(Option("Q931", "Q.931 layer log", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); +}; + +LogOptions::R2::R2() +: Section("R2", "R2", false) +{ + add(Option("Value", "Enable log class?", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); + add(Option("Signaling", "R2 Signaling log", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); + add(Option("States", "R2 States Log", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); +}; + +LogOptions::Firmware::Firmware() +: Section("Firmware", "Firmware", false) +{ + add(Option("Value", "Enable log class?", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); + add(Option("FwHdlcMsg", "HDLC messages", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); + add(Option("FwLinkErrors", "Link errors", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); + add(Option("FwModemChar", "MODEM char TX/RX", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); +}; + +LogOptions::Audio::Audio() +: Section("Audio", "Audio", false) +{ + add(Option("Value", "Enable log class?", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); + add(Option("DSP", "DSP audio messages", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); + add(Option("K3L", "K3L audio messages", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); +}; + +LogOptions::SS7::SS7() +: Section("SS7", "SS7", false) +{ + add(Option("Value", "Enable log class?", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); + add(Option("MTP2States", "MTP2 States", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); + add(Option("MTP2Debug", "MTP2 Debug", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); + add(Option("MTP3Management", "MTP3 Management", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); + add(Option("MTP3Test", "MTP3 Test", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); + add(Option("MTP3Debug", "MTP3 Debug", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); + add(Option("ISUPStates", "ISUP States", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); + add(Option("ISUPDebug", "ISUP Debug", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); + add(Option("ISUPMessages", "ISUP Messages", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); +}; + +LogOptions::SIP::SIP() +: Section("SIP", "SIP", false) +{ + add(Option("Value", "Enable log class?", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); +}; + +LogOptions::GSM::GSM() +: Section("GSM", "GSM", false) +{ + add(Option("Value", "Enable log class?", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); +}; + +LogOptions::Timer::Timer() +: Section("Timer", "Timer", false) +{ + add(Option("Value", "Enable log class?", BOOLEAN_FALSE, Restriction(K(STRING), N(UNIQUE), BOOLEAN_VALUE))); +}; + +LogOptions::LogOptions() +: Section("Options", "KLog Options", false) +{ + add(&_klogger); + add(&_k3l); + add(&_intfk3l); + add(&_intfk3lc); + add(&_isdn); + add(&_r2); + add(&_firmware); + add(&_audio); + add(&_ss7); + add(&_sip); + add(&_gsm); + add(&_timer); +}; diff --git a/src/mod/endpoints/mod_khomp/support/klog-options.hpp b/src/mod/endpoints/mod_khomp/support/klog-options.hpp new file mode 100644 index 0000000..b700947 --- /dev/null +++ b/src/mod/endpoints/mod_khomp/support/klog-options.hpp @@ -0,0 +1,81 @@ +/* + KHOMP generic endpoint/channel library. + Copyright (C) 2007-2009 Khomp Ind. & Com. + + The contents of this file are subject to the Mozilla Public License Version 1.1 + (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" basis, + WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for + the specific language governing rights and limitations under the License. + + Alternatively, the contents of this file may be used under the terms of the + "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which + case the provisions of "LGPL License" are applicable instead of those above. + + If you wish to allow use of your version of this file only under the terms of + the LGPL License and not to allow others to use your version of this file under + the MPL, indicate your decision by deleting the provisions above and replace them + with the notice and other provisions required by the LGPL License. If you do not + delete the provisions above, a recipient may use your version of this file under + either the MPL or the LGPL License. + + The LGPL header follows below: + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +*/ + +#include <types.hpp> + +#include <configurator/option.hpp> +#include <configurator/section.hpp> + +#ifndef _KLOG_OPTIONS_HPP_ +#define _KLOG_OPTIONS_HPP_ + +struct LogOptions: public Section +{ + struct KLogger: public Section { KLogger(); }; + struct K3L: public Section { K3L(); }; + struct IntfK3L: public Section { IntfK3L(); }; + struct IntfK3L_C: public Section { IntfK3L_C(); }; + struct ISDN: public Section { ISDN(); }; + struct R2: public Section { R2(); }; + struct Firmware: public Section { Firmware(); }; + struct Audio: public Section { Audio(); }; + struct SS7: public Section { SS7(); }; + struct SIP: public Section { SIP(); }; + struct GSM: public Section { GSM(); }; + struct Timer: public Section { Timer(); }; + + LogOptions(); + + KLogger _klogger; + K3L _k3l; + IntfK3L _intfk3l; + IntfK3L_C _intfk3lc; + ISDN _isdn; + R2 _r2; + Firmware _firmware; + Audio _audio; + SS7 _ss7; + SIP _sip; + GSM _gsm; + Timer _timer; +}; + +#endif /* _KLOG_OPTIONS_HPP_ */ diff --git a/src/mod/endpoints/mod_khomp/tools/getversion.sh b/src/mod/endpoints/mod_khomp/tools/getversion.sh new file mode 100755 index 0000000..d22bf2b --- /dev/null +++ b/src/mod/endpoints/mod_khomp/tools/getversion.sh @@ -0,0 +1,51 @@ +#/bin/bash + +############################################################################### +# KHOMP generic endpoint/channel library. +# Copyright (C) 2007-2010 Khomp Ind. & Com. + +# The contents of this file are subject to the Mozilla Public License +# Version 1.1 (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.mozilla.org/MPL/ + +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for +# the specific language governing rights and limitations under the License. + +# Alternatively, the contents of this file may be used under the terms of the +# "GNU Lesser General Public License 2.1" license (the âLGPL" License), in which +# case the provisions of "LGPL License" are applicable instead of those above. + +# If you wish to allow use of your version of this file only under the terms of +# the LGPL License and not to allow others to use your version of this file +# under the MPL, indicate your decision by deleting the provisions above and +# replace them with the notice and other provisions required by the LGPL +# License. If you do not delete the provisions above, a recipient may use your +# version of this file under either the MPL or the LGPL License. + +# The LGPL header follows below: + +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. + +# This library 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 +# Lesser General Public License for more details. + +# You should have received a copy of the GNU Lesser General Public License +# along with this library; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +############################################################################### + +version=`grep "#define $1" $2/src/include/switch_version.h | sed -r "s/#define\s+$1.*\"(.*)\"/\1/g"` + +if [ "$version" == "head" ] +then + echo -1 +else + echo $version +fi commit fcf027550c824bc49c55b79ff07abe14b328f368 Author: Arnaldo M Pereira <arnaldo@sangoma.com> Date: Mon Oct 18 15:37:28 2010 -0200 removed macro FREETDM_EXPORTS from msvc ftmod_sangoma_isdn build, changed visibility on e other functions and added EX_DECLARE_DATA to ftmod_sangoma_isdn module definition. now building and loading on win32, but not working. diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj index e5d6b74..e3930d8 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj @@ -41,7 +41,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories=""C:\Program Files\libsng_isdn\include";"C:\Program Files\libsng_isdn\include\sng_isdn";../../include;"C:\Program Files\Sangoma\include"" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;FREETDM_EXPORTS;" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;" MinimalRebuild="true" ExceptionHandling="0" BasicRuntimeChecks="3" diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 0ed5902..803e637 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -1010,7 +1010,7 @@ static FIO_IO_LOAD_FUNCTION(ftdm_sangoma_isdn_io_init) return FTDM_SUCCESS; } -ftdm_module_t ftdm_module = +EX_DECLARE_DATA ftdm_module_t ftdm_module = { "sangoma_isdn", /* char name[256]; */ ftdm_sangoma_isdn_io_init, /* fio_io_load_t */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 81121af..7db753e 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -266,16 +266,16 @@ extern ftdm_sngisdn_data_t g_sngisdn_data; ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *span); /* Support functions */ -uint32_t get_unique_suInstId(uint8_t cc_id); +FT_DECLARE_INLINE(uint32_t) get_unique_suInstId(uint8_t cc_id); FT_DECLARE_INLINE(void) clear_call_data(sngisdn_chan_data_t *sngisdn_info); FT_DECLARE_INLINE(void) clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info); void stack_hdr_init(Header *hdr); void stack_pst_init(Pst *pst); -ftdm_status_t get_ftdmchan_by_spInstId(uint8_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data); -ftdm_status_t get_ftdmchan_by_suInstId(uint8_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data); -ftdm_status_t sng_isdn_set_avail_rate(ftdm_span_t *ftdmspan, sngisdn_avail_t avail); +FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_spInstId(uint8_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data); +FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_suInstId(uint8_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data); +FT_DECLARE_INLINE(ftdm_status_t) sng_isdn_set_avail_rate(ftdm_span_t *ftdmspan, sngisdn_avail_t avail); /* Outbound Call Control functions */ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan); commit 8366b54d096a7c506c95d7aca1cbdb878f37cb3d Author: Arnaldo M Pereira <arnaldo@sangoma.com> Date: Mon Oct 18 13:27:58 2010 -0200 added some casts and type changes to ftmod_sangoma_isdn, to avoid compilation warnings on msvc diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c index 7f3c4c3..5a3e06e 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c @@ -227,7 +227,7 @@ ftdm_status_t sng_isdn_stack_cfg_phy_psap(ftdm_span_t *span) for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { ftdm_channel_t *ftdmchan = (ftdm_channel_t*)ftdm_iterator_current(curr); if (ftdmchan->type == FTDM_CHAN_TYPE_DQ921) { - d_channel_fd = ftdmchan->sockfd; + d_channel_fd = (S32) ftdmchan->sockfd; break; } } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index cb32730..725e1bb 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -78,7 +78,7 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) break; } - sngisdn_info->suInstId = get_unique_suInstId(suId); + sngisdn_info->suInstId = get_unique_suInstId((int8_t) suId); sngisdn_info->spInstId = spInstId; if (conEvnt->cdPtyNmb.eh.pres && signal_data->num_local_numbers) { @@ -206,7 +206,7 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) sngisdn_set_flag(sngisdn_info, FLAG_DELAYED_REL); sngisdn_info->glare.suId = suId; - sngisdn_info->glare.suInstId = get_unique_suInstId(suId); + sngisdn_info->glare.suInstId = get_unique_suInstId((int8_t) suId); sngisdn_info->glare.spInstId = spInstId; sngisdn_info->glare.dChan = dChan; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c index 5580f3a..39c5693 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c @@ -112,7 +112,7 @@ void sngisdn_rcv_con_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, Cn ftdm_assert(g_sngisdn_data.ccs[suId].activation_done != 0, "Con Cfm on unconfigured cc\n"); ftdm_assert(g_sngisdn_data.dchans[dChan].num_spans != 0, "Con Cfm on unconfigured dchan\n"); - if (get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) != FTDM_SUCCESS) { + if (get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); ISDN_FUNC_TRACE_EXIT(__FUNCTION__); return; @@ -156,7 +156,7 @@ void sngisdn_rcv_cnst_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, C ftdm_assert(g_sngisdn_data.ccs[suId].activation_done != 0, "Cnst Ind on unconfigured cc\n"); ftdm_assert(g_sngisdn_data.dchans[dChan].num_spans != 0, "Cnst Ind on unconfigured dchan\n"); - if (get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) != FTDM_SUCCESS) { + if (get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); ISDN_FUNC_TRACE_EXIT(__FUNCTION__); return; @@ -206,8 +206,8 @@ void sngisdn_rcv_disc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, D ftdm_assert(spInstId != 0, "Received DISCONNECT with invalid id"); - if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && - !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { + if (!(spInstId && get_ftdmchan_by_spInstId((int8_t) suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && + !(suInstId && get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); ftdm_assert(0, "Inconsistent call states\n"); @@ -240,8 +240,8 @@ void sngisdn_rcv_rel_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, Re ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && - !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { + if (!(spInstId && get_ftdmchan_by_spInstId((int8_t) suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && + !(suInstId && get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); /* It seems that Trillium has a bug where they sometimes send release twice on a call, so do not crash on these for now */ @@ -274,8 +274,8 @@ void sngisdn_rcv_dat_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, In ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && - !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { + if (!(spInstId && get_ftdmchan_by_spInstId((int8_t) suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && + !(suInstId && get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); ftdm_assert(0, "Inconsistent call states\n"); @@ -307,8 +307,8 @@ void sngisdn_rcv_sshl_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, S ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && - !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { + if (!(spInstId && get_ftdmchan_by_spInstId((int8_t) suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && + !(suInstId && get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); ftdm_assert(0, "Inconsistent call states\n"); @@ -341,8 +341,8 @@ void sngisdn_rcv_sshl_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, S ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && - !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { + if (!(spInstId && get_ftdmchan_by_spInstId((int8_t) suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && + !(suInstId && get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); ftdm_assert(0, "Inconsistent call states\n"); @@ -374,8 +374,8 @@ void sngisdn_rcv_rmrt_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, R ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && - !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { + if (!(spInstId && get_ftdmchan_by_spInstId((int8_t) suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && + !(suInstId && get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); ftdm_assert(0, "Inconsistent call states\n"); @@ -408,8 +408,8 @@ void sngisdn_rcv_rmrt_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, R ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && - !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { + if (!(spInstId && get_ftdmchan_by_spInstId((int8_t) suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && + !(suInstId && get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); ftdm_assert(0, "Inconsistent call states\n"); @@ -442,8 +442,8 @@ void sngisdn_rcv_flc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, St ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && - !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { + if (!(spInstId && get_ftdmchan_by_spInstId((int8_t) suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && + !(suInstId && get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); ftdm_assert(0, "Inconsistent call states\n"); @@ -476,8 +476,8 @@ void sngisdn_rcv_fac_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, Fa ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && - !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { + if (!(spInstId && get_ftdmchan_by_spInstId((int8_t) suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && + !(suInstId && get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); ftdm_assert(0, "Inconsistent call states\n"); @@ -510,8 +510,8 @@ void sngisdn_rcv_sta_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, St ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && - !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { + if (!(spInstId && get_ftdmchan_by_spInstId((int8_t) suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && + !(suInstId && get_ftdmchan_by_suInstId((int8_t) suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); ftdm_assert(0, "Inconsistent call states\n"); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c index 7d4d347..624d35c 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c @@ -100,7 +100,7 @@ uint8_t get_bits(uint8_t octet, uint8_t bitLo, uint8_t bitHi) void sngisdn_trace_q921(char* str, uint8_t* data, uint32_t data_len) { int str_len; - int i; + uint32_t i; uint8_t sapi, cr, ea, tei, ns, nr, pf, p, cmd; uint8_t frame_format = 0; @@ -649,7 +649,7 @@ uint32_t sngisdn_decode_ie(char *str, uint32_t *str_len, uint8_t current_codeset void print_hex_dump(char* str, uint32_t *str_len, uint8_t* data, uint32_t index_start, uint32_t index_end) { - int k; + uint32_t k; *str_len += sprintf(&str[*str_len], " [ "); for(k=index_start; k <= index_end; k++) { if (k && !(k%32)) { commit 4f6871698f788d1f0c9dff9c75732bee7ca5751e Author: Arnaldo M Pereira <egghunt@gmail.com> Date: Mon Oct 18 13:26:01 2010 -0200 disabled 64bit compatibility check on msvc build, hard coded FREETDM_EXPORTS to ensure its set diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj index dd83318..e5d6b74 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj @@ -41,13 +41,13 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories=""C:\Program Files\libsng_isdn\include";"C:\Program Files\libsng_isdn\include\sng_isdn";../../include;"C:\Program Files\Sangoma\include"" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;FREETDM_EXPORTS;" MinimalRebuild="true" + ExceptionHandling="0" BasicRuntimeChecks="3" - RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="true" + Detect64BitPortabilityProblems="false" DebugInformationFormat="4" /> <Tool @@ -122,7 +122,7 @@ RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" - Detect64BitPortabilityProblems="true" + Detect64BitPortabilityProblems="false" DebugInformationFormat="3" /> <Tool commit f8d8a395cc80784438a0bb670f04716bc71121b7 Merge: 1ffff09 afb00ef Author: Andrew Thompson <andrew@hijacked.us> Date: Mon Oct 18 03:19:16 2010 -0400 Merge branch 'master' of git.freeswitch.org:freeswitch commit 1ffff099c164244b25429a0b726639c167d179f1 Author: Andrew Thompson <andrew@hijacked.us> Date: Mon Oct 18 03:18:35 2010 -0400 Avoid checking the lengh of a null string. diff --git a/src/mod/event_handlers/mod_erlang_event/ei_helpers.c b/src/mod/event_handlers/mod_erlang_event/ei_helpers.c index 9935aff..aca2497 100644 --- a/src/mod/event_handlers/mod_erlang_event/ei_helpers.c +++ b/src/mod/event_handlers/mod_erlang_event/ei_helpers.c @@ -377,10 +377,11 @@ switch_status_t initialise_ei(struct ei_cnode_s *ec) // init the resolver res_init(); } - if (!zstr_buf(_res.dnsrch[0])) { + if (_res.dnsrch[0] && !zstr_buf(_res.dnsrch[0])) { strncat(thishostname, ".", 1); strncat(thishostname, _res.dnsrch[0], EI_MAXHOSTNAMELEN - strlen(thishostname)); } + } snprintf(thisnodename, MAXNODELEN + 1, "%s@%s", prefs.nodename, thishostname); } commit afb00ef5a11cb78d0c62a23e4856289a5d475f25 Author: Anthony Minessale <anthm@freeswitch.org> Date: Sun Oct 17 18:52:03 2010 -0500 tweaks diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 7959d31..40214c4 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -383,7 +383,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t * if (dmachine->last_matching_binding->callback) { s = dmachine->last_matching_binding->callback(&dmachine->match); - + switch(s) { case SWITCH_STATUS_CONTINUE: r = SWITCH_STATUS_SUCCESS; @@ -391,7 +391,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t * case SWITCH_STATUS_SUCCESS: break; default: - r = SWITCH_STATUS_NOTFOUND; + r = SWITCH_STATUS_BREAK; break; } } @@ -407,7 +407,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t * case SWITCH_STATUS_SUCCESS: break; default: - r = SWITCH_STATUS_NOTFOUND; + r = SWITCH_STATUS_BREAK; break; } @@ -422,7 +422,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t * r = SWITCH_STATUS_SUCCESS; } - if (r != SWITCH_STATUS_FOUND && r != SWITCH_STATUS_SUCCESS) { + if (r != SWITCH_STATUS_FOUND && r != SWITCH_STATUS_SUCCESS && r != SWITCH_STATUS_BREAK) { switch_set_string(dmachine->last_failed_digits, dmachine->digits); dmachine->match.match_digits = dmachine->last_failed_digits; @@ -439,7 +439,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t * case SWITCH_STATUS_SUCCESS: break; default: - r = SWITCH_STATUS_NOTFOUND; + r = SWITCH_STATUS_BREAK; break; } diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index c99745d..b1b20ec 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -1130,6 +1130,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess uint32_t pos = 0; switch_core_file_seek(fh, &pos, 0, SEEK_SET); switch_core_file_seek(fh, &pos, sample_start, SEEK_CUR); + switch_clear_flag(fh, SWITCH_FILE_SEEK); } if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_TITLE, &p) == SWITCH_STATUS_SUCCESS) { @@ -1319,6 +1320,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess } } + fh->offset_pos += asis ? bread : bread / 2; + if (bread < framelen) { memset(abuf + bread, 255, framelen - bread); } @@ -1338,9 +1341,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess } switch_buffer_write(fh->audio_buffer, abuf, asis ? olen : olen * 2); olen = switch_buffer_read(fh->audio_buffer, abuf, framelen); + fh->offset_pos += olen / 2; + if (!asis) { olen /= 2; } + } if (done || olen <= 0) { @@ -1455,7 +1461,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess } more_data = 0; - write_frame.samples = (uint32_t) olen; if (asis) { @@ -1480,7 +1485,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess switch_change_sln_volume(write_frame.data, write_frame.datalen / 2, fh->vol); } - fh->offset_pos += write_frame.samples / 2; status = switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0); if (timeout_samples) { commit 81a9f8ef1e216edaece16a765f1dfa98807f02ff Author: Anthony Minessale <anthm@freeswitch.org> Date: Sun Oct 17 16:13:47 2010 -0500 timeout instantly when you have exact match and are equal to max digits diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 964a77e..7959d31 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -281,6 +281,7 @@ static dm_match_t switch_ivr_dmachine_check_match(switch_ivr_dmachine_t *dmachin if (!exact_bp && !strcmp(bp->digits, dmachine->digits)) { best = DM_MATCH_EXACT; exact_bp = bp; + if (dmachine->cur_digit_len == dmachine->max_digit_len) break; } if (!(both_bp && partial_bp) && !strncmp(dmachine->digits, bp->digits, strlen(dmachine->digits))) { commit dc40a7789c5edbcded79b14a57e8527beb5a0426 Author: Andrew Thompson <andrew@hijacked.us> Date: Sun Oct 17 16:19:38 2010 -0400 Arrays are 0 indexed in C, duh diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index f2a20f3..8565e1a 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -1041,7 +1041,7 @@ static int read_cookie_from_file(char *filename) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to read cookie file %s : %d.\n", filename, errno); } - cookie[MAXATOMLEN+1] = '\0'; + cookie[MAXATOMLEN] = '\0'; /* replace any end of line characters with a null */ if ((end = strchr(cookie, '\n'))) { commit 4680cbb2dd95472ffa4f4cd34e0fb6cff28109ad Author: Andrew Thompson <andrew@hijacked.us> Date: Fri Oct 15 23:41:35 2010 -0400 mod_erlang_event: Update config file with new option and add some comments diff --git a/conf/autoload_configs/erlang_event.conf.xml b/conf/autoload_configs/erlang_event.conf.xml index ec14e21..62deb84 100644 --- a/conf/autoload_configs/erlang_event.conf.xml +++ b/conf/autoload_configs/erlang_event.conf.xml @@ -2,7 +2,16 @@ <settings> <param name="listen-ip" value="0.0.0.0"/> <param name="listen-port" value="8031"/> + <!-- Specify the first part of the node name + (the host part after the @ will be autodetected) + OR pass a complete nodename to avoid autodetection + eg. freeswitch@example or freeswitch@example.com. + If you pass a complete node name, the 'shortname' parameter has no effect. --> + <param name="nodename" value="freeswitch"/> + <!-- Specify this OR 'cookie-file' or $HOME/.erlang.cookie will be read --> <param name="cookie" value="ClueCon"/> + <!-- Read a cookie from an arbitary erlang cookie file instead --> + <!--<param name="cookie-file" value="/tmp/erlang.cookie"/>--> <param name="shortname" value="true"/> <!-- in additon to cookie, optionally restrict by ACL --> <!--<param name="apply-inbound-acl" value="lan"/>--> commit 094ffe37ccbead1e98a69da0306ae8d2e7f3978f Author: Andrew Thompson <andrew@hijacked.us> Date: Fri Oct 15 23:27:24 2010 -0400 mod_erlang_event: Support for reading erlang cookie from a file mod_erlang_event will now try to read $HOME/.erlang.cookie if no cookie is specified in the config file. You can specify an arbitary cookie file via the 'cookie-file' parameter in the config file. The cookie file MUST be readable by the user freeswitch is running as (either the owner or root) and the file MUST NOT be readable/writeable/executable by any other user (eg 0400 permissions). Thanks to James Aimonetti for the idea and the original patch. diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index 848a2c5..f2a20f3 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -1015,6 +1015,53 @@ static void launch_listener_thread(listener_t *listener) } +static int read_cookie_from_file(char *filename) { + int fd; + char cookie[MAXATOMLEN+1]; + char *end; + struct stat buf; + ssize_t res; + + if (!stat(filename, &buf)) { + if ((buf.st_mode & S_IRWXG) || (buf.st_mode & S_IRWXO)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s must only be accessible by owner only.\n", filename); + return 2; + } + if (buf.st_size > MAXATOMLEN) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s contains a cookie larger than the maximum atom size of %d.\n", filename, MAXATOMLEN); + return 2; + } + fd = open(filename, O_RDONLY); + if (fd < 1) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to open cookie file %s : %d.\n", filename, errno); + return 2; + } + + if ((res = read(fd, cookie, MAXATOMLEN)) < 1) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to read cookie file %s : %d.\n", filename, errno); + } + + cookie[MAXATOMLEN+1] = '\0'; + + /* replace any end of line characters with a null */ + if ((end = strchr(cookie, '\n'))) { + *end = '\0'; + } + + if ((end = strchr(cookie, '\r'))) { + *end = '\0'; + } + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Read %d bytes from cookie file %s.\n", (int)res, filename); + + set_pref_cookie(cookie); + return 0; + } else { + /* don't error here, because we might be blindly trying to read $HOME/.erlang.cookie, and that can fail silently */ + return 1; + } +} + static int config(void) { @@ -1041,6 +1088,10 @@ static int config(void) prefs.port = (uint16_t) atoi(val); } else if (!strcmp(var, "cookie")) { set_pref_cookie(val); + } else if (!strcmp(var, "cookie-file")) { + if (read_cookie_from_file(val) == 1) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to read cookie from %s\n", val); + } } else if (!strcmp(var, "nodename")) { set_pref_nodename(val); } else if (!strcmp(var, "compat-rel")) { @@ -1075,7 +1126,21 @@ static int config(void) } if (zstr(prefs.cookie)) { - set_pref_cookie("ClueCon"); + int res; + char* home_dir = getenv("HOME"); + char path_buf[1024]; + + if (!zstr(home_dir)) { + /* $HOME/.erlang.cookie */ + switch_snprintf(path_buf, sizeof(path_buf), "%s%s%s", home_dir, SWITCH_PATH_SEPARATOR, ".erlang.cookie"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking for cookie at path: %s\n", path_buf); + + res = read_cookie_from_file(path_buf); + if (res) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No cookie or valid cookie file specified, using default cookie\n"); + set_pref_cookie("ClueCon"); + } + } } if (!prefs.port) { commit f6f123025970e0c3b204dd6ddbc7393bc68122b1 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Oct 15 19:01:59 2010 -0500 up diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 467ea93..964a77e 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -358,7 +358,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t * { switch_bool_t is_timeout = switch_ivr_dmachine_check_timeout(dmachine); dm_match_t is_match = switch_ivr_dmachine_check_match(dmachine, is_timeout); - switch_status_t r; + switch_status_t r, s; int clear = 0; if (zstr(dmachine->digits) && !is_timeout) { @@ -381,17 +381,37 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t * dmachine->match.type = DM_MATCH_POSITIVE; if (dmachine->last_matching_binding->callback) { - if (dmachine->last_matching_binding->callback(&dmachine->match) == SWITCH_STATUS_CONTINUE) { + s = dmachine->last_matching_binding->callback(&dmachine->match); + + switch(s) { + case SWITCH_STATUS_CONTINUE: r = SWITCH_STATUS_SUCCESS; + break; + case SWITCH_STATUS_SUCCESS: + break; + default: + r = SWITCH_STATUS_NOTFOUND; + break; } } if (dmachine->match_callback) { dmachine->match.user_data = dmachine->user_data; - if (dmachine->match_callback(&dmachine->match) == SWITCH_STATUS_CONTINUE) { + s = dmachine->match_callback(&dmachine->match); + + switch(s) { + case SWITCH_STATUS_CONTINUE: r = SWITCH_STATUS_SUCCESS; + break; + case SWITCH_STATUS_SUCCESS: + break; + default: + r = SWITCH_STATUS_NOTFOUND; + break; } + } + clear++; } else if (is_timeout) { r = SWITCH_STATUS_TIMEOUT; @@ -409,9 +429,19 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t * if (dmachine->nonmatch_callback) { dmachine->match.user_data = dmachine->user_data; - if (dmachine->nonmatch_callback(&dmachine->match) == SWITCH_STATUS_CONTINUE) { + s = dmachine->nonmatch_callback(&dmachine->match); + + switch(s) { + case SWITCH_STATUS_CONTINUE: r = SWITCH_STATUS_SUCCESS; + break; + case SWITCH_STATUS_SUCCESS: + break; + default: + r = SWITCH_STATUS_NOTFOUND; + break; } + } clear++; commit f87dd96375448ae1d038708ff55743e24b451eaf Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Oct 15 18:00:49 2010 -0500 more dmachine improvements diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index fb02384..34c5db8 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -845,6 +845,8 @@ SWITCH_DECLARE(switch_bool_t) switch_ivr_uuid_exists(const char *uuid); +SWITCH_DECLARE(void) switch_ivr_dmachine_set_match_callback(switch_ivr_dmachine_t *dmachine, switch_ivr_dmachine_callback_t match_callback); +SWITCH_DECLARE(void) switch_ivr_dmachine_set_nonmatch_callback(switch_ivr_dmachine_t *dmachine, switch_ivr_dmachine_callback_t nonmatch_callback); SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_create(switch_ivr_dmachine_t **dmachine_p, const char *name, switch_memory_pool_t *pool, diff --git a/src/include/switch_types.h b/src/include/switch_types.h index cf27cb7..c3622e3 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -840,6 +840,7 @@ typedef enum { SWITCH_STATUS_IGNORE, SWITCH_STATUS_TOO_SMALL, SWITCH_STATUS_FOUND, + SWITCH_STATUS_CONTINUE, SWITCH_STATUS_NOT_INITALIZED } switch_status_t; diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index dae7ee0..467ea93 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -72,6 +72,21 @@ struct switch_ivr_dmachine { void *user_data; }; + +SWITCH_DECLARE(void) switch_ivr_dmachine_set_match_callback(switch_ivr_dmachine_t *dmachine, switch_ivr_dmachine_callback_t match_callback) +{ + + dmachine->match_callback = match_callback; + +} + +SWITCH_DECLARE(void) switch_ivr_dmachine_set_nonmatch_callback(switch_ivr_dmachine_t *dmachine, switch_ivr_dmachine_callback_t nonmatch_callback) +{ + + dmachine->nonmatch_callback = nonmatch_callback; + +} + SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_create(switch_ivr_dmachine_t **dmachine_p, const char *name, switch_memory_pool_t *pool, @@ -366,12 +381,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t * dmachine->match.type = DM_MATCH_POSITIVE; if (dmachine->last_matching_binding->callback) { - dmachine->last_matching_binding->callback(&dmachine->match); + if (dmachine->last_matching_binding->callback(&dmachine->match) == SWITCH_STATUS_CONTINUE) { + r = SWITCH_STATUS_SUCCESS; + } } if (dmachine->match_callback) { dmachine->match.user_data = dmachine->user_data; - dmachine->match_callback(&dmachine->match); + if (dmachine->match_callback(&dmachine->match) == SWITCH_STATUS_CONTINUE) { + r = SWITCH_STATUS_SUCCESS; + } } clear++; } else if (is_timeout) { @@ -390,7 +409,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t * if (dmachine->nonmatch_callback) { dmachine->match.user_data = dmachine->user_data; - dmachine->nonmatch_callback(&dmachine->match); + if (dmachine->nonmatch_callback(&dmachine->match) == SWITCH_STATUS_CONTINUE) { + r = SWITCH_STATUS_SUCCESS; + } } clear++; commit 6772c795e029639e48fc0b6e2248de5c919f9c41 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Oct 15 17:59:00 2010 -0500 FS-2787 diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 0d69bdb..2f5cbbd 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -3406,7 +3406,7 @@ switch_status_t config_sofia(int reload, char *profile_name) } else { sofia_clear_pflag(profile, PFLAG_NAT_OPTIONS_PING); } - } else if (!strcasecmp(var, "all-options-ping")) { + } else if (!strcasecmp(var, "all-reg-options-ping")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_ALL_REG_OPTIONS_PING); } else { diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 81cd534..c2c85e8 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -676,14 +676,16 @@ void sofia_reg_check_expire(sofia_profile_t *profile, time_t now, int reboot) if (sofia_test_pflag(profile, PFLAG_ALL_REG_OPTIONS_PING)) { switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid," "expires,user_agent,server_user,server_host,profile_name" - " from sip_registrations where hostname='%s'", mod_sofia_globals.hostname); + " from sip_registrations where hostname='%s' and " + "profile_name='%s'", mod_sofia_globals.hostname, profile->name); sofia_glue_execute_sql_callback(profile, NULL, sql, sofia_reg_nat_callback, profile); } else if (sofia_test_pflag(profile, PFLAG_NAT_OPTIONS_PING)) { switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid," "expires,user_agent,server_user,server_host,profile_name" " from sip_registrations where (status like '%%NAT%%' " - "or contact like '%%fs_nat=yes%%') and hostname='%s'", mod_sofia_globals.hostname); + "or contact like '%%fs_nat=yes%%') and hostname='%s' " + "and profile_name='%s'", mod_sofia_globals.hostname, profile->name); sofia_glue_execute_sql_callback(profile, NULL, sql, sofia_reg_nat_callback, profile); } commit afaf1fac0527ff6bff70120a309c94eb6494b28e Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Oct 15 17:53:38 2010 -0500 ilbc tweak diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 8358d1f..ddeb0e4 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -2667,6 +2667,7 @@ switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force) NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Can't load codec?\n"); switch_goto_status(SWITCH_STATUS_FALSE, end); + switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION); } if (switch_core_codec_init_with_bitrate(&tech_pvt->write_codec, @@ -2679,6 +2680,7 @@ switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force) SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE | tech_pvt->profile->codec_flags, NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Can't load codec?\n"); + switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION); switch_goto_status(SWITCH_STATUS_FALSE, end); } @@ -4320,12 +4322,12 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s map_bit_rate = switch_known_bitrate(map->rm_pt); if (!ptime && !strcasecmp(map->rm_encoding, "g723")) { - codec_ms = 30; + ptime = codec_ms = 30; } if (zstr(map->rm_fmtp)) { if (!strcasecmp(map->rm_encoding, "ilbc")) { - codec_ms = 30; + ptime = codec_ms = 30; } } else { if ((switch_core_codec_parse_fmtp(map->rm_encoding, map->rm_fmtp, map->rm_rate, &codec_fmtp)) == SWITCH_STATUS_SUCCESS) { diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 7e63e88..766bec7 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -119,6 +119,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi return SWITCH_STATUS_SUCCESS; } switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s has no read codec.\n", switch_channel_get_name(session->channel)); + switch_channel_hangup(session->channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION); return SWITCH_STATUS_FALSE; } @@ -630,6 +631,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess if (!(session->write_codec && switch_core_codec_ready(session->write_codec)) && !pass_cng) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s has no write codec.\n", switch_channel_get_name(session->channel)); + switch_channel_hangup(session->channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION); return SWITCH_STATUS_FALSE; } commit 9ccf10282df8bf66b10e68c3908b19d5f52123c0 Author: Arnaldo M Pereira <egghunt@gmail.com> Date: Fri Oct 15 18:26:25 2010 -0300 created macro FT_DECLARE_INLINE, to declare inline functions on ftmod_sangoma_isdn. also added msvc project file for the module, its now linking against libsng_isdn on win32 diff --git a/libs/freetdm/freetdm.2008.sln b/libs/freetdm/freetdm.2008.sln index aeaaf25..cb3f21d 100644 --- a/libs/freetdm/freetdm.2008.sln +++ b/libs/freetdm/freetdm.2008.sln @@ -80,7 +80,6 @@ Global {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|x64.ActiveCfg = Release|x64 {93B8812C-3EC4-4F78-8970-FFBFC99E167D}.Release|x64.Build.0 = Release|x64 {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|Win32.ActiveCfg = Debug|Win32 - {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|Win32.Build.0 = Debug|Win32 {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|x64.ActiveCfg = Debug|x64 {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Debug|x64.Build.0 = Debug|x64 {BB833648-BAFF-4BE2-94DB-F8BB043C588C}.Release|Win32.ActiveCfg = Release|Win32 @@ -124,6 +123,7 @@ Global {E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Release|Win32.ActiveCfg = Release|Win32 {E886B4D5-AB4F-4092-B8F4-3B06E1E462EF}.Release|x64.ActiveCfg = Release|x64 {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Debug|Win32.ActiveCfg = Debug|Win32 + {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Debug|Win32.Build.0 = Debug|Win32 {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Debug|x64.ActiveCfg = Debug|x64 {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Release|Win32.ActiveCfg = Release|Win32 {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Release|x64.ActiveCfg = Release|x64 @@ -135,7 +135,6 @@ Global {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Release|x64.ActiveCfg = Release|x64 {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Release|x64.Build.0 = Release|x64 {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Debug|Win32.ActiveCfg = Debug|Win32 - {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Debug|Win32.Build.0 = Debug|Win32 {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Debug|x64.ActiveCfg = Debug|x64 {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Debug|x64.Build.0 = Debug|x64 {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Release|Win32.ActiveCfg = Release|Win32 @@ -143,7 +142,6 @@ Global {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Release|x64.ActiveCfg = Release|x64 {2B1BAF36-0241-43E7-B865-A8338AD48E2E}.Release|x64.Build.0 = Release|x64 {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Debug|Win32.ActiveCfg = Debug|Win32 - {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Debug|Win32.Build.0 = Debug|Win32 {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Debug|x64.ActiveCfg = Debug|x64 {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Debug|x64.Build.0 = Debug|x64 {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|Win32.ActiveCfg = Release|Win32 diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj index 06fc3b8..dd83318 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj @@ -6,7 +6,7 @@ ProjectGUID="{B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}" RootNamespace="ftmod_sangoma_isdn" Keyword="Win32Proj" - TargetFrameworkVersion="0" + TargetFrameworkVersion="131072" > <Platforms> <Platform @@ -18,8 +18,8 @@ <Configurations> <Configuration Name="Debug|Win32" - OutputDirectory="Debug" - IntermediateDirectory="Debug" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" ConfigurationType="2" > <Tool @@ -41,7 +41,8 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories=""C:\Program Files\libsng_isdn\include";"C:\Program Files\libsng_isdn\include\sng_isdn";../../include;"C:\Program Files\Sangoma\include"" - PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;" + MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="0" @@ -60,11 +61,13 @@ /> <Tool Name="VCLinkerTool" - AdditionalDependencies="libsng_isdn.lib freetdm.lib" + AdditionalDependencies="freetdm.lib libsng_isdn.lib" LinkIncremental="2" - AdditionalLibraryDirectories=""C:\Documents and Settings\arnaldo\Desktop\smg_freeswitch.win32\libs\freetdm\Debug";"C:\Program Files\libsng_isdn\lib";"$(OutDir)";"C:\Program Files\Sangoma\api\lib\x86"" + AdditionalLibraryDirectories=""$(OutDir)";"C:\Program Files\libsng_isdn\lib";"C:\Program Files\Sangoma\api\lib\x86"" GenerateDebugInformation="true" - SubSystem="2" + SubSystem="1" + RandomizedBaseAddress="1" + DataExecutionPrevention="0" TargetMachine="1" /> <Tool @@ -91,9 +94,10 @@ </Configuration> <Configuration Name="Release|Win32" - OutputDirectory="Release" - IntermediateDirectory="Release" - ConfigurationType="1" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="2" + WholeProgramOptimization="1" > <Tool Name="VCPreBuildEventTool" @@ -112,8 +116,10 @@ /> <Tool Name="VCCLCompilerTool" - PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;" - RuntimeLibrary="2" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="3" UsePrecompiledHeader="0" WarningLevel="3" Detect64BitPortabilityProblems="true" diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index d575fcd..81121af 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -267,8 +267,8 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ /* Support functions */ uint32_t get_unique_suInstId(uint8_t cc_id); -void clear_call_data(sngisdn_chan_data_t *sngisdn_info); -void clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info); +FT_DECLARE_INLINE(void) clear_call_data(sngisdn_chan_data_t *sngisdn_info); +FT_DECLARE_INLINE(void) clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info); void stack_hdr_init(Header *hdr); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 691e310..12ffd14 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -49,7 +49,7 @@ ftdm_status_t sngisdn_check_free_ids(void); extern ftdm_sngisdn_data_t g_sngisdn_data; void get_memory_info(void); -void __inline__ clear_call_data(sngisdn_chan_data_t *sngisdn_info) +FT_DECLARE_INLINE(void) clear_call_data(sngisdn_chan_data_t *sngisdn_info) { uint32_t cc_id = ((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->cc_id; @@ -66,7 +66,7 @@ void __inline__ clear_call_data(sngisdn_chan_data_t *sngisdn_info) return; } -void __inline__ clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info) +FT_DECLARE_INLINE(void) clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info) { ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_DEBUG, "Clearing glare data (suId:%d suInstId:%u spInstId:%u actv-suInstId:%u actv-spInstId:%u)\n", sngisdn_info->glare.suId, @@ -91,7 +91,7 @@ void __inline__ clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info) } -uint32_t __inline__ get_unique_suInstId(uint8_t cc_id) +FT_DECLARE_INLINE(uint32_t) get_unique_suInstId(uint8_t cc_id) { uint32_t suInstId; ftdm_mutex_lock(g_sngisdn_data.ccs[cc_id].mutex); @@ -112,7 +112,7 @@ uint32_t __inline__ get_unique_suInstId(uint8_t cc_id) return 0; } -ftdm_status_t __inline__ get_ftdmchan_by_suInstId(uint8_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data) +FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_suInstId(uint8_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data) { ftdm_assert_return(g_sngisdn_data.ccs[cc_id].activation_done, FTDM_FAIL, "Trying to find call on unconfigured CC\n"); @@ -123,7 +123,7 @@ ftdm_status_t __inline__ get_ftdmchan_by_suInstId(uint8_t cc_id, uint32_t suInst return FTDM_SUCCESS; } -ftdm_status_t __inline__ get_ftdmchan_by_spInstId(uint8_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data) +FT_DECLARE_INLINE(ftdm_status_t) get_ftdmchan_by_spInstId(uint8_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data) { ftdm_assert_return(g_sngisdn_data.ccs[cc_id].activation_done, FTDM_FAIL, "Trying to find call on unconfigured CC\n"); diff --git a/libs/freetdm/src/include/ftdm_declare.h b/libs/freetdm/src/include/ftdm_declare.h index a3fc119..2985ab4 100644 --- a/libs/freetdm/src/include/ftdm_declare.h +++ b/libs/freetdm/src/include/ftdm_declare.h @@ -70,6 +70,7 @@ extern "C" { #define FT_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl #define FT_DECLARE_DATA __declspec(dllimport) #endif +#define FT_DECLARE_INLINE(type) type #define EX_DECLARE_DATA __declspec(dllexport) #else #if (defined(__GNUC__) || defined(__SUNPRO_CC) || defined (__SUNPRO_C)) && defined(HAVE_VISIBILITY) @@ -81,6 +82,7 @@ extern "C" { #define FT_DECLARE_NONSTD(type) type #define FT_DECLARE_DATA #endif +#define FT_DECLARE_INLINE(type) type __inline__ #define EX_DECLARE_DATA #endif commit 743c87883b9125f6f60dd52ff94e82371ec06ea3 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Oct 15 12:55:59 2010 -0500 tweak diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 06f5459..4fd6a67 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -111,6 +111,8 @@ static switch_status_t digit_nomatch_action_callback(switch_ivr_dmachine_match_t switch_event_t *event; switch_status_t status; + switch_channel_set_variable(channel, "last_non_matching_digits", match->match_digits); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Digit NOT match binding [%s]\n", switch_channel_get_name(channel), match->match_digits); @@ -141,6 +143,8 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match) char *string = act->string; switch_channel_t *channel = switch_core_session_get_channel(act->session); + switch_channel_set_variable(channel, "last_matching_digits", match->match_digits); + if (switch_event_create_plain(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(act->session), SWITCH_LOG_DEBUG, "%s Digit match binding [%s][%s]\n", switch_channel_get_name(channel), act->string, act->value); commit 89351e02528f7048306923ae57566f62f6c9d3fb Author: Konrad Hammel <konrad@sangoma.com> Date: Fri Oct 15 13:40:20 2010 -0400 freetdm: ss7 - added support for sending sub-address values freetdm: ss7 - switch back to sending RSC at startup rather then GRS diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index 30cb316..cff9711 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -1332,7 +1332,7 @@ static ftdm_status_t ftdm_sangoma_ss7_start(ftdm_span_t * span) sngss7_clear_flag(sngss7_info, FLAG_INFID_PAUSED); sngss7_set_flag(sngss7_info, FLAG_INFID_RESUME); } -#if 1 +#if 0 /* throw the grp reset flag */ sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX); if (x == 1) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index a358236..5de237d 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -58,6 +58,8 @@ #define SNGSS7_EVENT_QUEUE_SIZE 100 +#define MAX_SIZEOF_SUBADDR_IE 24 /* as per Q931 4.5.9 */ + typedef enum { SNGSS7_CON_IND_EVENT = 0, SNGSS7_CON_CFM_EVENT, @@ -83,6 +85,11 @@ typedef enum { SNGSS7_PAUSED = (1 << 7) } sng_flag_t; +typedef enum { + SNG_CALLED = 1, + SNG_CALLING = 2 +} sng_addr_type_t; + typedef struct sng_mtp_link { char name[MAX_NAME_LEN]; uint32_t id; @@ -579,6 +586,8 @@ ftdm_status_t clear_rx_grs_data(sngss7_chan_data_t *sngss7_info); ftdm_status_t clear_rx_gra_data(sngss7_chan_data_t *sngss7_info); ftdm_status_t clear_tx_grs_data(sngss7_chan_data_t *sngss7_info); +ftdm_status_t encode_subAddrIE_nsap(const char *subAddr, char *subAddrIE, int type); +ftdm_status_t encode_subAddrIE_nat(const char *subAddr, char *subAddrIE, int type); /* in ftmod_sangoma_ss7_timers.c */ void handle_isup_t35(void *userdata); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index 973fbf4..3571a9e 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -76,6 +76,9 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;; const char *clg_nadi = NULL; const char *cld_nadi = NULL; + const char *clg_subAddr = NULL; + const char *cld_subAddr = NULL; + char subAddrIE[MAX_SIZEOF_SUBADDR_IE]; SiConEvnt iam; sngss7_info->suInstId = get_unique_id (); @@ -186,7 +189,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) /* check if the user would like a custom NADI value for the calling Pty Num */ clg_nadi = ftdm_channel_get_var(ftdmchan, "ss7_clg_nadi"); if ((clg_nadi != NULL) && (*clg_nadi)) { - SS7_DEBUG_CHAN(ftdmchan,"Found user supplied NADI value \"%s\"\n", clg_nadi); + SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Calling NADI value \"%s\"\n", clg_nadi); iam.cgPtyNum.natAddrInd.val = atoi(clg_nadi); } else { iam.cgPtyNum.natAddrInd.val = g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId].clg_nadi; @@ -195,14 +198,93 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) cld_nadi = ftdm_channel_get_var(ftdmchan, "ss7_cld_nadi"); if ((cld_nadi != NULL) && (*cld_nadi)) { - SS7_DEBUG_CHAN(ftdmchan,"Found user supplied NADI value \"%s\"\n", cld_nadi); + SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Called NADI value \"%s\"\n", cld_nadi); iam.cdPtyNum.natAddrInd.val = atoi(cld_nadi); } else { iam.cdPtyNum.natAddrInd.val = g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId].cld_nadi; SS7_DEBUG_CHAN(ftdmchan,"No user supplied NADI value found for CLD, using \"%d\"\n", iam.cdPtyNum.natAddrInd.val); + } + /* check if the user would like us to send a clg_sub-address */ + clg_subAddr = ftdm_channel_get_var(ftdmchan, "ss7_clg_subaddr"); + if ((clg_subAddr != NULL) && (*clg_subAddr)) { + SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Calling Sub-Address value \"%s\"\n", clg_subAddr); + + /* clean out the subAddrIE */ + memset(subAddrIE, 0x0, sizeof(subAddrIE)); + + /* check the first character in the sub-address to see what type of encoding to use */ + switch (clg_subAddr[0]) { + case '0': /* NSAP */ + encode_subAddrIE_nsap(&clg_subAddr[1], subAddrIE, SNG_CALLING); + break; + case '1': /* national variant */ + encode_subAddrIE_nat(&clg_subAddr[1], subAddrIE, SNG_CALLING); + break; + default: + SS7_ERROR_CHAN(ftdmchan,"Invalid Calling Sub-Address encoding requested: %c\n", clg_subAddr[0]); + break; + } /* switch (cld_subAddr[0]) */ + + + /* if subaddIE is still empty don't copy it in */ + if (subAddrIE[0] != '0') { + /* check if the clg_subAddr has already been added */ + if (iam.accTrnspt.eh.pres == PRSNT_NODEF) { + /* append the subAddrIE */ + memcpy(&iam.accTrnspt.infoElmts.val[iam.accTrnspt.infoElmts.len], subAddrIE, (subAddrIE[1] + 2)); + iam.accTrnspt.infoElmts.len = iam.accTrnspt.infoElmts.len +subAddrIE[1] + 2; + } else { + /* fill in from the beginning */ + iam.accTrnspt.eh.pres = PRSNT_NODEF; + iam.accTrnspt.infoElmts.pres = PRSNT_NODEF; + memcpy(iam.accTrnspt.infoElmts.val, subAddrIE, (subAddrIE[1] + 2)); + iam.accTrnspt.infoElmts.len = subAddrIE[1] + 2; + } /* if (iam.accTrnspt.eh.pres */ + } /* if (subAddrIE[0] != '0') */ } + /* check if the user would like us to send a cld_sub-address */ + cld_subAddr = ftdm_channel_get_var(ftdmchan, "ss7_cld_subaddr"); + if ((cld_subAddr != NULL) && (*cld_subAddr)) { + SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Called Sub-Address value \"%s\"\n", cld_subAddr); + + /* clean out the subAddrIE */ + memset(subAddrIE, 0x0, sizeof(subAddrIE)); + + /* check the first character in the sub-address to see what type of encoding to use */ + switch (cld_subAddr[0]) { + case '0': /* NSAP */ + encode_subAddrIE_nsap(&cld_subAddr[1], subAddrIE, SNG_CALLED); + break; + case '1': /* national variant */ + encode_subAddrIE_nat(&cld_subAddr[1], subAddrIE, SNG_CALLED); + break; + default: + SS7_ERROR_CHAN(ftdmchan,"Invalid Called Sub-Address encoding requested: %c\n", cld_subAddr[0]); + break; + } /* switch (cld_subAddr[0]) */ + + /* if subaddIE is still empty don't copy it in */ + if (subAddrIE[0] != '0') { + /* check if the cld_subAddr has already been added */ + if (iam.accTrnspt.eh.pres == PRSNT_NODEF) { + /* append the subAddrIE */ + memcpy(&iam.accTrnspt.infoElmts.val[iam.accTrnspt.infoElmts.len], subAddrIE, (subAddrIE[1] + 2)); + iam.accTrnspt.infoElmts.len = iam.accTrnspt.infoElmts.len +subAddrIE[1] + 2; + } else { + /* fill in from the beginning */ + iam.accTrnspt.eh.pres = PRSNT_NODEF; + iam.accTrnspt.infoElmts.pres = PRSNT_NODEF; + memcpy(iam.accTrnspt.infoElmts.val, subAddrIE, (subAddrIE[1] + 2)); + iam.accTrnspt.infoElmts.len = subAddrIE[1] + 2; + } /* if (iam.accTrnspt.eh.pres */ + } /* if (subAddrIE[0] != '0') */ + } /* if ((cld_subAddr != NULL) && (*cld_subAddr)) */ + + + + sng_cc_con_request (sngss7_info->spId, sngss7_info->suInstId, sngss7_info->spInstId, diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 41db1fe..7186639 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -71,6 +71,9 @@ ftdm_status_t clear_tx_rsc_flags(sngss7_chan_data_t *sngss7_info); ftdm_status_t clear_rx_grs_data(sngss7_chan_data_t *sngss7_info); ftdm_status_t clear_rx_gra_data(sngss7_chan_data_t *sngss7_info); ftdm_status_t clear_tx_grs_data(sngss7_chan_data_t *sngss7_info); + +ftdm_status_t encode_subAddrIE_nsap(const char *subAddr, char *subAddrIE, int type); +ftdm_status_t encode_subAddrIE_nat(const char *subAddr, char *subAddrIE, int type); /******************************************************************************/ /* FUNCTIONS ******************************************************************/ @@ -884,6 +887,214 @@ ftdm_status_t clear_tx_rsc_flags(sngss7_chan_data_t *sngss7_info) } /******************************************************************************/ +ftdm_status_t encode_subAddrIE_nsap(const char *subAddr, char *subAddrIE, int type) +{ + /* Q931 4.5.9 + * 8 7 6 5 4 3 2 1 (octet) + * + * 0 1 1 1 0 0 0 1 (spare 8) ( IE id 1-7) + * X X X X X X X X (length of IE contents) + * 1 0 0 0 Z 0 0 0 (ext 8) (NSAP type 5-7) (odd/even 4) (spare 1-3) + * X X X X X X X X (sub address encoded in ia5) + */ + + int x = 0; + int p = 0; + int len = 0; + char tmp[2]; + + /* initalize the second element of tmp to \0 so that atoi doesn't go to far */ + tmp[1]='\0'; + + /* set octet 1 aka IE id */ + p = 0; + switch(type) { + /**************************************************************************/ + case SNG_CALLED: /* called party sub address */ + subAddrIE[p] = 0x71; + break; + /**************************************************************************/ + case SNG_CALLING: /* calling party sub address */ + subAddrIE[p] = 0x6d; + break; + /**************************************************************************/ + default: /* not good */ + SS7_ERROR("Sub-Address type is invalid: %d\n", type); + return FTDM_FAIL; + break; + /**************************************************************************/ + } /* switch(type) */ + + /* set octet 3 aka type and o/e */ + p = 2; + subAddrIE[p] = 0x80; + + /* set the subAddrIE pointer octet 4 */ + p = 3; + + /* loop through all digits in subAddr and insert them into subAddrIE */ + while (subAddr[x] != '\0') { + + /* grab a character */ + tmp[0] = subAddr[x]; + + /* confirm it is a digit */ + if (!isdigit(tmp[0])) { + /* move to the next character in subAddr */ + x++; + + /* restart the loop */ + continue; + } + + /* convert the character to IA5 encoding and write into subAddrIE */ + subAddrIE[p] = atoi(&tmp[0]); /* lower nibble is the digit */ + subAddrIE[p] |= 0x3 << 4; /* upper nibble is 0x3 */ + + /* increment address length counter */ + len++; + + /* increment the subAddrIE pointer */ + p++; + + /* move to the next character in subAddr */ + x++; + + } /* while (subAddr[x] != '\0') */ + + /* set octet 2 aka length of subaddr */ + p = 1; + subAddrIE[p] = len + 1; + + + return FTDM_SUCCESS; +} + +/******************************************************************************/ +ftdm_status_t encode_subAddrIE_nat(const char *subAddr, char *subAddrIE, int type) +{ + /* Q931 4.5.9 + * 8 7 6 5 4 3 2 1 (octet) + * + * 0 1 1 1 0 0 0 1 (spare 8) ( IE id 1-7) + * X X X X X X X X (length of IE contents) + * 1 0 0 0 Z 0 0 0 (ext 8) (NSAP type 5-7) (odd/even 4) (spare 1-3) + * X X X X X X X X (sub address encoded in ia5) + */ + + int x = 0; + int p = 0; + int len = 0; + char tmp[2]; + int flag = 0; + int odd = 0; + uint8_t lower = 0x0; + uint8_t upper = 0x0; + + /* initalize the second element of tmp to \0 so that atoi doesn't go to far */ + tmp[1]='\0'; + + /* set octet 1 aka IE id */ + p = 0; + switch(type) { + /**************************************************************************/ + case SNG_CALLED: /* called party sub address */ + subAddrIE[p] = 0x71; + break; + /**************************************************************************/ + case SNG_CALLING: /* calling party sub address */ + subAddrIE[p] = 0x6d; + break; + /**************************************************************************/ + default: /* not good */ + SS7_ERROR("Sub-Address type is invalid: %d\n", type); + return FTDM_FAIL; + break; + /**************************************************************************/ + } /* switch(type) */ + + /* set the subAddrIE pointer octet 4 */ + p = 3; + + /* loop through all digits in subAddr and insert them into subAddrIE */ + while (1) { + + /* grab a character */ + tmp[0] = subAddr[x]; + + /* confirm it is a hex digit */ + while ((!isxdigit(tmp[0])) && (tmp[0] != '\0')) { + /* move to the next character in subAddr */ + x++; + tmp[0] = subAddr[x]; + } + + /* check if tmp is null or a digit */ + if (tmp[0] != '\0') { + /* push it into the lower nibble using strtol to allow a-f chars */ + lower = strtol(&tmp[0], (char **)NULL, 16); + /* move to the next digit */ + x++; + /* grab a digit from the ftdm digits */ + tmp[0] = subAddr[x]; + + /* check if the digit is a hex digit and that is not null */ + while (!(isxdigit(tmp[0])) && (tmp[0] != '\0')) { + x++; + tmp[0] = subAddr[x]; + } /* while(!(isdigit(tmp))) */ + + /* check if tmp is null or a digit */ + if (tmp[0] != '\0') { + /* push the digit into the upper nibble using strtol to allow a-f chars */ + upper = (strtol(&tmp[0], (char **)NULL, 16)) << 4; + } else { + /* there is no upper ... fill in spare */ + upper = 0x00; + /* throw the odd flag since we need to buffer */ + odd = 1; + /* throw the end flag */ + flag = 1; + } /* if (tmp != '\0') */ + } else { + /* keep the odd flag down */ + odd = 0; + + /* throw the flag */ + flag = 1; + + /* bounce out right away */ + break; + } + + /* fill in the octet */ + subAddrIE[p] = upper | lower; + + /* increment address length counter */ + len++; + + /* if the flag is we're through all the digits */ + if (flag) break; + + /* increment the subAddrIE pointer */ + p++; + + /* move to the next character in subAddr */ + x++; + + } /* while (subAddr[x] != '\0') */ + + /* set octet 2 aka length of subaddr */ + p = 1; + subAddrIE[p] = len + 1; + + /* set octet 3 aka type and o/e */ + p = 2; + subAddrIE[p] = 0xa0 | (odd << 3); + + + return FTDM_SUCCESS; +} /******************************************************************************/ /* For Emacs: commit b2d9e55c27c934eb19f348377001cd4beecf218d Author: Arnaldo M Pereira <egghunt@gmail.com> Date: Fri Oct 15 11:08:46 2010 -0300 added ftmod_sangoma_isdn.2008.vcproj and changed freetdm solution file to include ftmod_sangoma_isdn to the build process diff --git a/libs/freetdm/freetdm.2008.sln b/libs/freetdm/freetdm.2008.sln index 66ea292..aeaaf25 100644 --- a/libs/freetdm/freetdm.2008.sln +++ b/libs/freetdm/freetdm.2008.sln @@ -58,6 +58,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testsangomaboost", "msvc\te {93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ftmod_sangoma_isdn", "src\ftmod\ftmod_sangoma_isdn\ftmod_sangoma_isdn.2008.vcproj", "{B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}" + ProjectSection(ProjectDependencies) = postProject + {93B8812C-3EC4-4F78-8970-FFBFC99E167D} = {93B8812C-3EC4-4F78-8970-FFBFC99E167D} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -123,7 +128,6 @@ Global {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Release|Win32.ActiveCfg = Release|Win32 {1A145EE9-BBD8-45E5-98CD-EB4BE99E1DCD}.Release|x64.ActiveCfg = Release|x64 {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Debug|Win32.ActiveCfg = Debug|Win32 - {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Debug|Win32.Build.0 = Debug|Win32 {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Debug|x64.ActiveCfg = Debug|x64 {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Debug|x64.Build.0 = Debug|x64 {D021EF2A-460D-4827-A0F7-41FDECF46F1B}.Release|Win32.ActiveCfg = Release|Win32 @@ -146,6 +150,12 @@ Global {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|Win32.Build.0 = Release|Win32 {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|x64.ActiveCfg = Release|x64 {0DA69C18-4FA1-4E8C-89CE-12498637C5BE}.Release|x64.Build.0 = Release|x64 + {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Debug|Win32.ActiveCfg = Debug|Win32 + {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Debug|Win32.Build.0 = Debug|Win32 + {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Debug|x64.ActiveCfg = Debug|Win32 + {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|Win32.ActiveCfg = Release|Win32 + {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|Win32.Build.0 = Release|Win32 + {B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}.Release|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj new file mode 100644 index 0000000..06fc3b8 --- /dev/null +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj @@ -0,0 +1,235 @@ +<?xml version="1.0" encoding="UTF-8"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="ftmod_sangoma_isdn" + ProjectGUID="{B2AF4EA6-0CD7-4529-9EB5-5AF43DB90395}" + RootNamespace="ftmod_sangoma_isdn" + Keyword="Win32Proj" + TargetFrameworkVersion="0" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="Debug" + IntermediateDirectory="Debug" + ConfigurationType="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories=""C:\Program Files\libsng_isdn\include";"C:\Program Files\libsng_isdn\include\sng_isdn";../../include;"C:\Program Files\Sangoma\include"" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;" + BasicRuntimeChecks="3" + RuntimeLibrary="3" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="libsng_isdn.lib freetdm.lib" + LinkIncremental="2" + AdditionalLibraryDirectories=""C:\Documents and Settings\arnaldo\Desktop\smg_freeswitch.win32\libs\freetdm\Debug";"C:\Program Files\libsng_isdn\lib";"$(OutDir)";"C:\Program Files\Sangoma\api\lib\x86"" + GenerateDebugInformation="true" + SubSystem="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="Release" + IntermediateDirectory="Release" + ConfigurationType="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + LinkIncremental="2" + GenerateDebugInformation="true" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <File + RelativePath=".\ftmod_sangoma_isdn.h" + > + </File> + <File + RelativePath=".\ftmod_sangoma_isdn_trace.h" + > + </File> + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath=".\ftmod_sangoma_isdn.c" + > + </File> + <File + RelativePath=".\ftmod_sangoma_isdn_cfg.c" + > + </File> + <File + RelativePath=".\ftmod_sangoma_isdn_cntrl.c" + > + </File> + <File + RelativePath=".\ftmod_sangoma_isdn_stack_cfg.c" + > + </File> + <File + RelativePath=".\ftmod_sangoma_isdn_stack_cntrl.c" + > + </File> + <File + RelativePath=".\ftmod_sangoma_isdn_stack_hndl.c" + > + </File> + <File + RelativePath=".\ftmod_sangoma_isdn_stack_out.c" + > + </File> + <File + RelativePath=".\ftmod_sangoma_isdn_stack_rcv.c" + > + </File> + <File + RelativePath=".\ftmod_sangoma_isdn_support.c" + > + </File> + <File + RelativePath=".\ftmod_sangoma_isdn_trace.c" + > + </File> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> commit bbba1148ab93b41502d39f989ca2104f831185ef Author: Moises Silva <moy@sangoma.com> Date: Fri Oct 15 06:52:13 2010 -0400 mod_sangoma_codec: flush sockets on first use diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index 19f460b..4b43487 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -366,6 +366,29 @@ static switch_status_t switch_sangoma_init_ilbc(switch_codec_t *codec, switch_co return switch_sangoma_init(codec, flags, codec_settings); } + +static void flush_rtp(switch_rtp_t *rtp) +{ + switch_status_t sres; + switch_frame_t read_frame; + int flushed = 0; + int sanity = 1000; + while (sanity--) { + sres = switch_rtp_zerocopy_read_frame(rtp, &read_frame, SWITCH_IO_FLAG_NOBLOCK); + if (sres == SWITCH_STATUS_GENERR) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to read on Sangoma encoder RTP session while flushing: %d\n", sres); + return; + } + if (!read_frame.datalen) { + break; + } + flushed++; + } + if (!sanity) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Insanely big UDP queue!\n"); + } +} + #define SAFE_INDEX_INC(array, index) \ (index)++; \ if ((index) == switch_arraylen((array))) { \ @@ -415,6 +438,7 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec sess->encoder.txrtp = sess->encoder.reply.tx_fd; sess->encoder.rxrtp = sess->encoder.reply.rx_fd; switch_mutex_unlock(g_sessions_lock); + flush_rtp(sess->encoder.rxrtp); } if (sess->encoder.debug_timing && sess->encoder.last_func_call_time) { @@ -452,7 +476,6 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec sess->encoder.tx++; /* do the reading */ - memset(&encoded_frame, 0, sizeof(encoded_frame)); for ( ; ; ) { #if 0 prevread_time = switch_micro_time_now(); @@ -610,6 +633,7 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses sess->decoder.txrtp = sess->decoder.reply.tx_fd; sess->decoder.rxrtp = sess->decoder.reply.rx_fd; switch_mutex_unlock(g_sessions_lock); + flush_rtp(sess->decoder.rxrtp); } if (sess->decoder.debug_timing && sess->decoder.last_func_call_time) { @@ -641,7 +665,6 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses sess->decoder.tx++; /* do the reading */ - memset(&ulaw_frame, 0, sizeof(ulaw_frame)); for ( ; ; ) { #if 0 prevread_time = switch_micro_time_now(); commit e5459d34bf368791a31cac5bbe6ed96d6a88c26b Author: cypromis <michal.bielicki@seventhsignal.de> Date: Fri Oct 15 13:16:16 2010 +0200 fix changelog diff --git a/debian/changelog b/debian/changelog index 5fafb62..c24db02 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +freeswitch (1.0.head~git.master.20101015.1-1) unstable; urgency=low + + * reintroduced mod_flite + * disabled the patching stuff introduced by Julien ... needs an overwork + * reintroduced mod_tts_commandline + * cleaned up rules file and module make rules + * more trivial changes and updates :) + + -- Michal Bielicki <michal.bielicki@seventhsignal.de> Fr, 15 Oct 2010 13:14:02 +0200 + freeswitch (1.0.head~git.master.20101014.1-1) unstable; urgency=low * replaced mod_openzap with mod_freetdm @@ -9,7 +19,7 @@ freeswitch (1.0.head~git.master.20101014.1-1) unstable; urgency=low * added patches from Julien Duqene (FS-369) * Various trivial changes and updates :) - -- Michal Bielicki <michal.bielicki@seventhsignal.de> Fr, 14 Oct 2010 05:05:02 +0200 + -- Michal Bielicki <michal.bielicki@seventhsignal.de> Fr, 15 Oct 2010 05:05:02 +0200 freeswitch (1.0.head~git.master.20100601.2-1) unstable; urgency=low commit ca94fb2beaa66bece9a4a261a798905a77b3829a Author: cypromis <michal.bielicki@seventhsignal.de> Date: Fri Oct 15 12:45:52 2010 +0200 adding tts_commandline diff --git a/debian/rules b/debian/rules index c296839..94aee73 100755 --- a/debian/rules +++ b/debian/rules @@ -17,7 +17,7 @@ export APPLICATION_MODULES_NY= applications/mod_nibblebill applications/mod_redi applications/mod_valet_parking applications/mod_vmd applications/mod_voicemail export APPLICATIONS_MODULES= $(APPLICATION_MODULES_AE) $(APPLICATION_MODULES_FM) $(APPLICATION_MODULES_NY) $(APPLICATION_MODULES_VZ) -export ASR_TTS_MODULES= asr_tts/mod_pocketsphinx asr_tts/mod_flite +export ASR_TTS_MODULES= asr_tts/mod_pocketsphinx asr_tts/mod_flite asr_tts/mod_tts_commandline export CODECS_MODULES= codecs/mod_bv codecs/mod_h26x codecs/mod_speex codecs/mod_celt codecs/mod_codec2 codecs/mod_ilbc codecs/mod_mp4v \ codecs/mod_silk codecs/mod_siren codecs/mod_theora export DIALPLANS_MODULES= dialplans/mod_dialplan_asterisk dialplans/mod_dialplan_directory dialplans/mod_dialplan_xml commit a4aa5ceb2ea13e692f2458ad5666ccda01a22b2c Author: cypromis <michal.bielicki@seventhsignal.de> Date: Fri Oct 15 12:19:55 2010 +0200 my typonese rules ... sorry for the mod_spandsp.sp ... diff --git a/debian/freeswitch.install b/debian/freeswitch.install index fa706ba..3c838cd 100644 --- a/debian/freeswitch.install +++ b/debian/freeswitch.install @@ -156,7 +156,7 @@ opt/freeswitch/mod/mod_skypopen.so* opt/freeswitch/mod/mod_sndfile.so* opt/freeswitch/mod/mod_snom.so* opt/freeswitch/mod/mod_sofia.so* -opt/freeswitch/mod/mod_spandsp.sp* +opt/freeswitch/mod/mod_spandsp.so* opt/freeswitch/mod/mod_speex.so* opt/freeswitch/mod/mod_spy.so* opt/freeswitch/mod/mod_syslog.so* commit 880ab2c0b49e7d58d4c82a892fbeaade473e134c Author: cypromis <michal.bielicki@seventhsignal.de> Date: Fri Oct 15 11:49:28 2010 +0200 get flite back in and try to compile on more RAM .... it will not compile on less than 768 I think diff --git a/debian/rules b/debian/rules index 436e7cf..c296839 100755 --- a/debian/rules +++ b/debian/rules @@ -17,7 +17,7 @@ export APPLICATION_MODULES_NY= applications/mod_nibblebill applications/mod_redi applications/mod_valet_parking applications/mod_vmd applications/mod_voicemail export APPLICATIONS_MODULES= $(APPLICATION_MODULES_AE) $(APPLICATION_MODULES_FM) $(APPLICATION_MODULES_NY) $(APPLICATION_MODULES_VZ) -export ASR_TTS_MODULES= asr_tts/mod_pocketsphinx +export ASR_TTS_MODULES= asr_tts/mod_pocketsphinx asr_tts/mod_flite export CODECS_MODULES= codecs/mod_bv codecs/mod_h26x codecs/mod_speex codecs/mod_celt codecs/mod_codec2 codecs/mod_ilbc codecs/mod_mp4v \ codecs/mod_silk codecs/mod_siren codecs/mod_theora export DIALPLANS_MODULES= dialplans/mod_dialplan_asterisk dialplans/mod_dialplan_directory dialplans/mod_dialplan_xml commit 471d717d82dd0de84c2961522dd679c0eb2babdd Author: cypromis <michal.bielicki@seventhsignal.de> Date: Fri Oct 15 11:24:52 2010 +0200 if you cannot type ... you have to have a lot of time to find the error when it finally popps up while recompiling ... typo in debian/rules ... diff --git a/debian/rules b/debian/rules index af36958..436e7cf 100755 --- a/debian/rules +++ b/debian/rules @@ -7,7 +7,7 @@ export DEB_DH_INSTALL_SOURCEDIR=debian/tmp export PASSTHRU_CODEC_MODULES=codecs/mod_g729 codecs/mod_g723_1 codecs/mod_amr codecs/mod_amrwb # Modules listed by those built by default, then those that are added in this package export APPLICATION_MODULES_AE= applications/mod_avmd applications/mod_callcenter applications/mod_cidlookup applications/mod_cluechoo \ - applications/mod_commands applications/mod_conference applciations/mod_curl applications/mod_db applications/mod_directory \ + applications/mod_commands applications/mod_conference applications/mod_curl applications/mod_db applications/mod_directory \ applications/mod_distributor applications/mod_dptools applications/mod_easyroute applications/mod_enum \ applications/mod_esf applications/mod_expr export APPLICATION_MODULES_FM= applications/mod_fifo applications/mod_fsv applications/mod_hash applications/mod_lcr applications/mod_limit \ commit ddf34ab39a0e4987b60135478f4e1a1b4d4e3185 Author: cypromis <michal.bielicki@seventhsignal.de> Date: Fri Oct 15 10:53:48 2010 +0200 mod_curl is back in the packaged game and some weird source dir from debian ;)) diff --git a/debian/rules b/debian/rules index d6e5eb5..af36958 100755 --- a/debian/rules +++ b/debian/rules @@ -7,7 +7,7 @@ export DEB_DH_INSTALL_SOURCEDIR=debian/tmp export PASSTHRU_CODEC_MODULES=codecs/mod_g729 codecs/mod_g723_1 codecs/mod_amr codecs/mod_amrwb # Modules listed by those built by default, then those that are added in this package export APPLICATION_MODULES_AE= applications/mod_avmd applications/mod_callcenter applications/mod_cidlookup applications/mod_cluechoo \ - applications/mod_commands applications/mod_conference applications/mod_db applications/mod_directory \ + applications/mod_commands applications/mod_conference applciations/mod_curl applications/mod_db applications/mod_directory \ applications/mod_distributor applications/mod_dptools applications/mod_easyroute applications/mod_enum \ applications/mod_esf applications/mod_expr export APPLICATION_MODULES_FM= applications/mod_fifo applications/mod_fsv applications/mod_hash applications/mod_lcr applications/mod_limit \ diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/freeswitch.spec b/freeswitch.spec index a2c975b..ceacfba 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -331,7 +331,7 @@ export QA_RPATHS=$[ 0x0001|0x0002 ] # ###################################################################################################################### APPLICATION_MODULES_AE="applications/mod_avmd applications/mod_callcenter applications/mod_cidlookup applications/mod_cluechoo \ - applications/mod_commands applications/mod_conference applications/mod_db applications/mod_directory \ + applications/mod_commands applications/mod_conference applications/mod_curl applications/mod_db applications/mod_directory \ applications/mod_distributor applications/mod_dptools applications/mod_easyroute applications/mod_enum \ applications/mod_esf applications/mod_expr" APPLICATION_MODULES_FM="applications/mod_fifo applications/mod_fsv applications/mod_hash applications/mod_lcr applications/mod_limit \ @@ -753,6 +753,7 @@ fi %{prefix}/mod/mod_console.so* %{prefix}/mod/mod_commands.so* %{prefix}/mod/mod_conference.so* +%{prefix}/mod/mod_curl.so* %{prefix}/mod/mod_db.so* %{prefix}/mod/mod_dialplan_asterisk.so* %{prefix}/mod/mod_dialplan_directory.so* @@ -949,6 +950,8 @@ fi # ###################################################################################################################### %changelog +* Fri Oct 15 2010 - michal.bielicki@seventhsignal.de +- added mod_curl * Sat Oct 09 2010 - michal.bielicki@seventhsignal.de - added mod_silk - added mod_codec2 commit faffbaaadb9d1588de332520c3848d2677b3966b Author: cypromis <michal.bielicki@seventhsignal.de> Date: Fri Oct 15 10:23:37 2010 +0200 fix dependency to python-dev for debian packages diff --git a/debian/control b/debian/control index e578287..f5068bf 100644 --- a/debian/control +++ b/debian/control @@ -6,7 +6,7 @@ Uploaders: Michal Bielicki <michal.bielicki@seventhsignal.pl>, Gabriel Gunderson Build-Depends: debhelper (>= 7), wget, automake (>=1.9), autoconf, libtool, unixodbc-dev, libasound2-dev, libcurl3-openssl-dev|libcurl4-openssl-dev, libssl-dev, ncurses-dev, libogg-dev, libvorbis-dev, libperl-dev, libgdbm-dev, - libdb-dev, libgnutls-dev, libtiff4-dev, python, libx11-dev, uuid-dev + libdb-dev, libgnutls-dev, libtiff4-dev, python-dev, libx11-dev, uuid-dev Homepage: http://freeswitch.org/ Standards-Version: 3.9.1 Vcs-Git: git://git.freeswitch.org/freeswitch.git diff --git a/debian/freeswitch-python.config b/debian/freeswitch-python.config new file mode 100644 index 0000000..1c1746c --- /dev/null +++ b/debian/freeswitch-python.config @@ -0,0 +1 @@ +opt/freeswitch/conf/autoload_configs/python.conf.xml diff --git a/debian/freeswitch-python.install b/debian/freeswitch-python.install new file mode 100644 index 0000000..0c073e9 --- /dev/null +++ b/debian/freeswitch-python.install @@ -0,0 +1,3 @@ +opt/freeswitch/conf/autoload_configs/python.conf.xml +opt/freeswitch/mod/mod_python.so* +usr/lib/python2.5/site-packages/freeswitch.py* commit 9686a38f92414dd0a7f01e684195a24c898cbb31 Author: cypromis <michal.bielicki@seventhsignal.de> Date: Fri Oct 15 09:19:44 2010 +0200 seems endpoints need spandsp done so spandsp (basically all app modules) have to be made before endpoints diff --git a/debian/rules b/debian/rules index 1f09ac8..d6e5eb5 100755 --- a/debian/rules +++ b/debian/rules @@ -7,32 +7,34 @@ export DEB_DH_INSTALL_SOURCEDIR=debian/tmp export PASSTHRU_CODEC_MODULES=codecs/mod_g729 codecs/mod_g723_1 codecs/mod_amr codecs/mod_amrwb # Modules listed by those built by default, then those that are added in this package export APPLICATION_MODULES_AE= applications/mod_avmd applications/mod_callcenter applications/mod_cidlookup applications/mod_cluechoo \ - applications/mod_commands applications/mod_conference applications/mod_db applications/mod_directory \ - applications/mod_distributor applications/mod_dptools applications/mod_easyroute applications/mod_enum \ - applications/mod_esf applications/mod_expr + applications/mod_commands applications/mod_conference applications/mod_db applications/mod_directory \ + applications/mod_distributor applications/mod_dptools applications/mod_easyroute applications/mod_enum \ + applications/mod_esf applications/mod_expr export APPLICATION_MODULES_FM= applications/mod_fifo applications/mod_fsv applications/mod_hash applications/mod_lcr applications/mod_limit \ - applications/mod_memcache + applications/mod_memcache export APPLICATION_MODULES_NY= applications/mod_nibblebill applications/mod_redis applications/mod_rss applications/mod_snom \ - applications/mod_spandsp applications/mod_spy applications/mod_stress \ - applications/mod_valet_parking applications/mod_vmd applications/mod_voicemail + applications/mod_spandsp applications/mod_spy applications/mod_stress \ + applications/mod_valet_parking applications/mod_vmd applications/mod_voicemail export APPLICATIONS_MODULES= $(APPLICATION_MODULES_AE) $(APPLICATION_MODULES_FM) $(APPLICATION_MODULES_NY) $(APPLICATION_MODULES_VZ) export ASR_TTS_MODULES= asr_tts/mod_pocketsphinx export CODECS_MODULES= codecs/mod_bv codecs/mod_h26x codecs/mod_speex codecs/mod_celt codecs/mod_codec2 codecs/mod_ilbc codecs/mod_mp4v \ - codecs/mod_silk codecs/mod_siren codecs/mod_theora + codecs/mod_silk codecs/mod_siren codecs/mod_theora export DIALPLANS_MODULES= dialplans/mod_dialplan_asterisk dialplans/mod_dialplan_directory dialplans/mod_dialplan_xml export ENDPOINTS_MODULES= endpoints/mod_dingaling endpoints/mod_portaudio endpoints/mod_sofia endpoints/mod_loopback \ - ../../libs/freetdm/mod_freetdm endpoints/mod_skypopen endpoints/mod_skinny + ../../libs/freetdm/mod_freetdm endpoints/mod_skypopen endpoints/mod_skinny export EVENT_HANDLERS_MODULES=event_handlers/mod_event_multicast event_handlers/mod_event_socket event_handlers/mod_cdr_csv export FORMATS_MODULES= formats/mod_file_string formats/mod_local_stream formats/mod_native_file formats/mod_portaudio_stream \ - formats/mod_shout formats/mod_sndfile formats/mod_tone_stream + formats/mod_shout formats/mod_sndfile formats/mod_tone_stream export LANGUAGES_MODULES=languages/mod_spidermonkey languages/mod_perl languages/mod_lua languages/mod_python export LOGGERS_MODULES=loggers/mod_console loggers/mod_logfile loggers/mod_syslog export SAY_MODULES=say/mod_say_en say/mod_say_it say/mod_say_de say/mod_say_fr say/mod_say_es say/mod_say_nl say/mod_say_ru export XML_INT_MODULES=xml_int/mod_xml_rpc xml_int/mod_xml_curl xml_int/mod_xml_cdr -export MYMODULES= $(ENDPOINTS_MODULES) $(PASSTHRU_CODEC_MODULES) $(APPLICATIONS_MODULES) $(ASR_TTS_MODULES) $(CODECS_MODULES) $(DIALPLANS_MODULES) $(EVENT_HANDLERS_MODULES) $(FORMATS_MODULES) $(LANGUAGES_MODULES) $(LOGGERS_MODULES) $(SAY_MODULES) $(XML_INT_MODULES) +export MYMODULES= $(PASSTHRU_CODEC_MODULES) $(APPLICATIONS_MODULES) $(ASR_TTS_MODULES) $(CODECS_MODULES) $(DIALPLANS_MODULES) $(ENDPOINTS_MODULES) $(EVENT_HANDLERS_MODULES) $(FORMATS_MODULES) $(LANGUAGES_MODULES) $(LOGGERS_MODULES) $(SAY_MODULES) $(XML_INT_MODULES) export MODULES=$(MYMODULES) + + ifndef AUTOCONF AUTOCONFS := $(wildcard /usr/bin/autoconf*) AUTOCONF = $(shell which autoconf) commit 33ea6e9c8fda0aa084733c2996aacd394f901787 Author: cypromis <michal.bielicki@seventhsignal.de> Date: Fri Oct 15 08:02:15 2010 +0200 no scripts dir diff --git a/debian/freeswitch.install b/debian/freeswitch.install index 7e119d6..fa706ba 100644 --- a/debian/freeswitch.install +++ b/debian/freeswitch.install @@ -4,7 +4,6 @@ opt/freeswitch/bin/fs_encode opt/freeswitch/bin/fs_ivrd opt/freeswitch/bin/fsxs opt/freeswitch/bin/gentls_cert -opt/freeswitch/bin/scripts opt/freeswitch/conf/autoload_configs/acl.conf.xml opt/freeswitch/conf/autoload_configs/alsa.conf.xml opt/freeswitch/conf/autoload_configs/callcenter.conf.xml commit 9eb57ee5219b45e70796a3383e26fdcb3bfc8a06 Author: cypromis <michal.bielicki@seventhsignal.de> Date: Fri Oct 15 07:47:19 2010 +0200 no bins in scripts dir diff --git a/debian/freeswitch.install b/debian/freeswitch.install index 4462b71..7e119d6 100644 --- a/debian/freeswitch.install +++ b/debian/freeswitch.install @@ -4,7 +4,7 @@ opt/freeswitch/bin/fs_encode opt/freeswitch/bin/fs_ivrd opt/freeswitch/bin/fsxs opt/freeswitch/bin/gentls_cert -opt/freeswitch/bin/scripts/* +opt/freeswitch/bin/scripts opt/freeswitch/conf/autoload_configs/acl.conf.xml opt/freeswitch/conf/autoload_configs/alsa.conf.xml opt/freeswitch/conf/autoload_configs/callcenter.conf.xml commit 374d13e7b6df41ed17c39260fbb9e17c3f2912ff Author: cypromis <michal.bielicki@seventhsignal.de> Date: Fri Oct 15 06:53:46 2010 +0200 forgot one more entry diff --git a/debian/rules b/debian/rules index f38818b..1f09ac8 100755 --- a/debian/rules +++ b/debian/rules @@ -188,7 +188,7 @@ build-stamp: config.status touch $@ -clean: .pc/applied-patches +clean: # .pc/applied-patches dh_testdir dh_testroot rm -f build-stamp commit 0c89de8fb6367e296849c1fe408c10e735b50763 Author: cypromis <michal.bielicki@seventhsignal.de> Date: Fri Oct 15 06:51:55 2010 +0200 need more testing of the .pc applied_patches stuff .. this does not work as advertised yet diff --git a/debian/changelog b/debian/changelog index 6c94670..5fafb62 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -freeswitch (1.0.head-git.master,20101014.1-1) unstable; urgency=low +freeswitch (1.0.head~git.master.20101014.1-1) unstable; urgency=low * replaced mod_openzap with mod_freetdm * added mod_theora diff --git a/debian/rules b/debian/rules index 2f91ae5..f38818b 100755 --- a/debian/rules +++ b/debian/rules @@ -173,7 +173,7 @@ config.status: configure for i in $(MODULES); do echo $$i >> modules.conf; done ./configure --prefix=/opt/freeswitch --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) ${FEATURES} -configure: bootstrap.sh .pc/applied-patches +configure: bootstrap.sh # .pc/applied-patches dh_testdir test -e /usr/share/misc/config.sub && cp -f /usr/share/misc/config.sub build/config/config.sub test -e /usr/share/misc/config.guess && cp -f /usr/share/misc/config.guess build/config/config.guess commit e0632e64982ca433c46912818229748e2f16f6f9 Author: cypromis <michal.bielicki@seventhsignal.de> Date: Fri Oct 15 06:17:38 2010 +0200 added warning message to debian subdir diff --git a/debian/READ_BEFORE_CHANGING_ANYTHING_IN_HERE b/debian/READ_BEFORE_CHANGING_ANYTHING_IN_HERE index 6172ffd..e8e1642 100644 --- a/debian/READ_BEFORE_CHANGING_ANYTHING_IN_HERE +++ b/debian/READ_BEFORE_CHANGING_ANYTHING_IN_HERE @@ -1,3 +1,11 @@ Please do not change the maintainer Plase DO send me a note before changing anything here and PLEASE DO MAKE A JIRA FIRST !!!! This is the result of far too much sleepless time and far too many people broke this far too often so HANDS OFF FOR NOW !!!! +So one more time + +1. Do not perform any changes before verifying with the current maintainer (yes that is me) if they are OK +2. Before the mere idea of a change shall cross your mind create a ticket in Jira and assign it to the current maintainer +3. Yes the current maintainer has also other obligations besides fixing things people break in the debian build files so be patient, it can sometimes take a bit for him to react. +4. This has been a lot of work so please stay away from fixing it to death +5. The maintainer is always right +6. If the maintainer is wrong, look at 5. commit ce3055e65aed26ae73c4aadc12cd6101230fd429 Author: cypromis <michal.bielicki@seventhsignal.de> Date: Fri Oct 15 06:16:12 2010 +0200 PLEASE NEVER CHANGE ANYTHING IN THE DEBIAN DIRECTORY YOURSELF. ALWAYS CREATE A JIRA FIRST AND WAIT FOR THE CURRENT MAINTAINER TO DO THE CHANGES diff --git a/debian/READ_BEFORE_CHANGING_ANYTHING_IN_HERE b/debian/READ_BEFORE_CHANGING_ANYTHING_IN_HERE new file mode 100644 index 0000000..6172ffd --- /dev/null +++ b/debian/READ_BEFORE_CHANGING_ANYTHING_IN_HERE @@ -0,0 +1,3 @@ +Please do not change the maintainer +Plase DO send me a note before changing anything here and PLEASE DO MAKE A JIRA FIRST !!!! +This is the result of far too much sleepless time and far too many people broke this far too often so HANDS OFF FOR NOW !!!! commit 364e78e29286a6ca4ac84083f4f979ef557e1c4e Author: cypromis <michal.bielicki@seventhsignal.de> Date: Fri Oct 15 05:57:12 2010 +0200 o you my tab why are you leaving me ??? diff --git a/debian/rules b/debian/rules index a0fe20e..2f91ae5 100755 --- a/debian/rules +++ b/debian/rules @@ -25,7 +25,7 @@ export ENDPOINTS_MODULES= endpoints/mod_dingaling endpoints/mod_portaudio endpoi ../../libs/freetdm/mod_freetdm endpoints/mod_skypopen endpoints/mod_skinny export EVENT_HANDLERS_MODULES=event_handlers/mod_event_multicast event_handlers/mod_event_socket event_handlers/mod_cdr_csv export FORMATS_MODULES= formats/mod_file_string formats/mod_local_stream formats/mod_native_file formats/mod_portaudio_stream \ - formats/mod_shout formats/mod_sndfile formats/mod_tone_stream + formats/mod_shout formats/mod_sndfile formats/mod_tone_stream export LANGUAGES_MODULES=languages/mod_spidermonkey languages/mod_perl languages/mod_lua languages/mod_python export LOGGERS_MODULES=loggers/mod_console loggers/mod_logfile loggers/mod_syslog export SAY_MODULES=say/mod_say_en say/mod_say_it say/mod_say_de say/mod_say_fr say/mod_say_es say/mod_say_nl say/mod_say_ru @@ -56,113 +56,113 @@ ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) endif .pc/applied-patches: - @echo - @echo \ \ Sorry, currently this package cannot be built directly from upstream - @echo \ \ source git/tarball: patches are needed for policy compliance, and the - @echo \ \ "new 3.0 (quilt) source format requires patches to be already applied." - @echo - @echo \ \ Please first convert this tree by running: - @echo -e \\t./debian/rules upstream-convert - @echo - @echo \ \ Note that this will insert an entry in debian/changelog, rename the - @echo \ \ current directory to the version number there, create a .orig.tar.bz2 - @echo \ \ archive and apply all the patches in debian/patches/series. - @echo - @echo \ \ Using git-buildpackage is not recommended for now. - @echo - @exit 1 + @echo + @echo \ \ Sorry, currently this package cannot be built directly from upstream + @echo \ \ source git/tarball: patches are needed for policy compliance, and the + @echo \ \ "new 3.0 (quilt) source format requires patches to be already applied." + @echo + @echo \ \ Please first convert this tree by running: + @echo -e \\t./debian/rules upstream-convert + @echo + @echo \ \ Note that this will insert an entry in debian/changelog, rename the + @echo \ \ current directory to the version number there, create a .orig.tar.bz2 + @echo \ \ archive and apply all the patches in debian/patches/series. + @echo + @echo \ \ Using git-buildpackage is not recommended for now. + @echo + @exit 1 upstream-convert: - @dh_testdir - @test -s .pc/applied-patches && \ - echo "Aborted: patches are already applied." && \ - exit 1 || exit 0 - # update (or not) version number in debian/changelog - @set -e ; \ - echo Checking version number ; \ - v1="$$(dpkg-parsechangelog | sed -e '/^Version: / ! d' -e 's/^Version: //')" ; \ - v2="$${v1}" ; \ - echo " Current version: $${v1}" ; \ - if [ "$$(which git)" = "" -o ! -d .git ] ; then \ - echo Git not available. Keeping current version number. ; \ - exit 0 ; \ - fi ; \ - if [ "$$(which debchange)" = "" ] ; then \ - echo debchange not available. Keeping current version number. ; \ - exit 0 ; \ - fi ; \ - if echo -n "$${v1}" | grep -q '~git\.[a-z0-9]\+\.20[0-9]\{6\}\.[0-9]\+-[^-]\+$$' ; then \ - maj1="$$(echo -n "$${v1}" | sed -e 's/^\([^.]\+\)\..*$$/\1/')" ; \ - min1="$$(echo -n "$${v1}" | sed -e 's/^[^.]\+\.\([^.]\+\)\..*$$/\1/')" ; \ - mic1="$$(echo -n "$${v1}" | sed -e 's/^[^.]\+\.[^.]\+\.\([a-zA-Z0-9]\+\).*$$/\1/')" ; \ - b1="$$(echo -n "$${v1}" | sed -e 's/^.*~git\.\([a-z0-9]\+\)\.\(20[0-9]\{6\}\)\.[0-9]\+-[^-]\+$$/\1/')" ; \ - d1="$$(echo -n "$${v1}" | sed -e 's/^.*\.\(20[0-9]\{6\}\)\.[0-9]\+-[^-]\+$$/\1/')" ; \ - n1="$$(echo -n "$${v1}" | sed -e 's/^.*\.20[0-9]\{6\}\.\([0-9]\+\)-[^-]\+$$/\1/')" ; \ - maj2="$$(sed -e '/^AC_SUBST(SWITCH_VERSION_MAJOR/ ! d' -e 's/^.*\[\([^\[]\+\)\][^\]]*$$/\1/' configure.in)" ; \ - min2="$$(sed -e '/^AC_SUBST(SWITCH_VERSION_MINOR/ ! d' -e 's/^.*\[\([^\[]\+\)\][^\]]*$$/\1/' configure.in)" ; \ - mic2="$$(sed -e '/^AC_SUBST(SWITCH_VERSION_MICRO/ ! d' -e 's/^.*\[\([^\[]\+\)\][^\]]*$$/\1/' configure.in)" ; \ - b2="$$(git branch | sed -e '/^[^*]/ d' -e 's/* \(.*\)/\1/')" ; \ - d2="$$(TZ=UTC git log --date=local -1 --format='%ai' | sed -e 's/^\(....\).\(..\).\(..\).*$$/\1\2\3/')" ; \ - n2="$$(TZ=UTC git log --date=local --format=oneline --since="$${d2::4}-$${d2:4:2}-$${d2:6:2} 00:00" | wc -l)" ; \ - if [ "$${b2}" != "$$(echo "$${b2}" | tr -dc a-z0-9)" ] ; then \ - echo Invalid branch name "'$${b2}'". Aborted. ; \ - exit 1; \ - fi ; \ - if [ "$${b1}.$${d1}.$${n1}" != "$${b2}.$${d2}.$${n2}" \ - -o "$${maj1}.$${min1}.$${mic1}" != "$${maj2}.$${min2}.$${mic2}" ] ; then \ - v2="$$(echo -n "$${maj2}.$${min2}.$${mic2}")" ; \ - v2="$${v2}$$(echo -n "$${v1}" | sed -e 's/^[^.]\+\.[^.]\+\.[^.]\+\(.*\)~git\..*$$/\1/')" ; \ - v2="$${v2}~git.$${b2}.$${d2}.$${n2}-1" ; \ - echo " New version: $${v2}" ; \ - echo Updating debian/changelog with new version number ; \ - debchange -v "$${v2}" "New upstream release" ; \ - else \ - echo Version number already correct, no change. ; \ - fi ; \ - else \ - echo 'Not a ~git. version number. Keeping current version number.' ; \ - fi - # rename (or not) current directory to match packagename-version.number - @set -e ; \ - echo Checking directory name ; \ - d1="$$(basename "$$(cd . && echo "$$PWD")")" ; \ - d2="$$(dpkg-parsechangelog | sed -e '/^Source: / ! d' -e 's/^Source: //')" ; \ - d2="$${d2}-$$(dpkg-parsechangelog | sed -e '/^Version: / ! d' -e 's/^Version: \(.*\)-[^-]\+$$/\1/')" ; \ - if [ "$${d1}" != "$${d2}" ] ; then \ - if [ -e "../$${d2}" ] ; then \ - test . -ef "../$${d2}" && exit 0 ; \ - echo Aborted: directory "../$${d2}" already exists. ; \ - exit 1 ; \ - fi ; \ - echo Renaming current directory to "$${d2}" ; \ - mv ../$${d1} ../$${d2} ; \ - fi - # create .orig.tar.bz2 - @set -e ; \ - n="$$(dpkg-parsechangelog | sed -e '/^Source: / ! d' -e 's/^Source: //')" ; \ - d="$${n}-$$(dpkg-parsechangelog | sed -e '/^Version: / ! d' -e 's/^Version: \(.*\)-[^-]\+$$/\1/')" ; \ - n="$${n}_$$(dpkg-parsechangelog | sed -e '/^Version: / ! d' -e 's/^Version: \(.*\)-[^-]\+$$/\1/').orig.tar.bz2" ; \ - echo "Creating source archive $${n}" ; \ - cd .. && tar cjf "$${n}" --exclude='.git*' "$${d}" - # apply patches - @set -e ; \ - echo "Applying patches in debian/patches/series" ; \ - QUILT_PATCHES=debian/patches ; \ - export QUILT_PATCHES ; \ - while quilt next ; do \ - quilt push -v ; \ - quilt refresh ; \ - done - # remind user to change dir - @echo Done. - @echo - @if [ "$(CURDIR)" != "$$PWD" ] ; then \ - echo \ \ You should now tell your shell to update its current working directory: ; \ - echo -e \\t'cd $$(pwd)' ; \ - echo \ \ or ; \ - echo -e "\\tcd $$PWD" ; \ - echo ; \ - fi + @dh_testdir + @test -s .pc/applied-patches && \ + echo "Aborted: patches are already applied." && \ + exit 1 || exit 0 + # update (or not) version number in debian/changelog + @set -e ; \ + echo Checking version number ; \ + v1="$$(dpkg-parsechangelog | sed -e '/^Version: / ! d' -e 's/^Version: //')" ; \ + v2="$${v1}" ; \ + echo " Current version: $${v1}" ; \ + if [ "$$(which git)" = "" -o ! -d .git ] ; then \ + echo Git not available. Keeping current version number. ; \ + exit 0 ; \ + fi ; \ + if [ "$$(which debchange)" = "" ] ; then \ + echo debchange not available. Keeping current version number. ; \ + exit 0 ; \ + fi ; \ + if echo -n "$${v1}" | grep -q '~git\.[a-z0-9]\+\.20[0-9]\{6\}\.[0-9]\+-[^-]\+$$' ; then \ + maj1="$$(echo -n "$${v1}" | sed -e 's/^\([^.]\+\)\..*$$/\1/')" ; \ + min1="$$(echo -n "$${v1}" | sed -e 's/^[^.]\+\.\([^.]\+\)\..*$$/\1/')" ; \ + mic1="$$(echo -n "$${v1}" | sed -e 's/^[^.]\+\.[^.]\+\.\([a-zA-Z0-9]\+\).*$$/\1/')" ; \ + b1="$$(echo -n "$${v1}" | sed -e 's/^.*~git\.\([a-z0-9]\+\)\.\(20[0-9]\{6\}\)\.[0-9]\+-[^-]\+$$/\1/')" ; \ + d1="$$(echo -n "$${v1}" | sed -e 's/^.*\.\(20[0-9]\{6\}\)\.[0-9]\+-[^-]\+$$/\1/')" ; \ + n1="$$(echo -n "$${v1}" | sed -e 's/^.*\.20[0-9]\{6\}\.\([0-9]\+\)-[^-]\+$$/\1/')" ; \ + maj2="$$(sed -e '/^AC_SUBST(SWITCH_VERSION_MAJOR/ ! d' -e 's/^.*\[\([^\[]\+\)\][^\]]*$$/\1/' configure.in)" ; \ + min2="$$(sed -e '/^AC_SUBST(SWITCH_VERSION_MINOR/ ! d' -e 's/^.*\[\([^\[]\+\)\][^\]]*$$/\1/' configure.in)" ; \ + mic2="$$(sed -e '/^AC_SUBST(SWITCH_VERSION_MICRO/ ! d' -e 's/^.*\[\([^\[]\+\)\][^\]]*$$/\1/' configure.in)" ; \ + b2="$$(git branch | sed -e '/^[^*]/ d' -e 's/* \(.*\)/\1/')" ; \ + d2="$$(TZ=UTC git log --date=local -1 --format='%ai' | sed -e 's/^\(....\).\(..\).\(..\).*$$/\1\2\3/')" ; \ + n2="$$(TZ=UTC git log --date=local --format=oneline --since="$${d2::4}-$${d2:4:2}-$${d2:6:2} 00:00" | wc -l)" ; \ + if [ "$${b2}" != "$$(echo "$${b2}" | tr -dc a-z0-9)" ] ; then \ + echo Invalid branch name "'$${b2}'". Aborted. ; \ + exit 1; \ + fi ; \ + if [ "$${b1}.$${d1}.$${n1}" != "$${b2}.$${d2}.$${n2}" \ + -o "$${maj1}.$${min1}.$${mic1}" != "$${maj2}.$${min2}.$${mic2}" ] ; then \ + v2="$$(echo -n "$${maj2}.$${min2}.$${mic2}")" ; \ + v2="$${v2}$$(echo -n "$${v1}" | sed -e 's/^[^.]\+\.[^.]\+\.[^.]\+\(.*\)~git\..*$$/\1/')" ; \ + v2="$${v2}~git.$${b2}.$${d2}.$${n2}-1" ; \ + echo " New version: $${v2}" ; \ + echo Updating debian/changelog with new version number ; \ + debchange -v "$${v2}" "New upstream release" ; \ + else \ + echo Version number already correct, no change. ; \ + fi ; \ + else \ + echo 'Not a ~git. version number. Keeping current version number.' ; \ + fi + # rename (or not) current directory to match packagename-version.number + @set -e ; \ + echo Checking directory name ; \ + d1="$$(basename "$$(cd . && echo "$$PWD")")" ; \ + d2="$$(dpkg-parsechangelog | sed -e '/^Source: / ! d' -e 's/^Source: //')" ; \ + d2="$${d2}-$$(dpkg-parsechangelog | sed -e '/^Version: / ! d' -e 's/^Version: \(.*\)-[^-]\+$$/\1/')" ; \ + if [ "$${d1}" != "$${d2}" ] ; then \ + if [ -e "../$${d2}" ] ; then \ + test . -ef "../$${d2}" && exit 0 ; \ + echo Aborted: directory "../$${d2}" already exists. ; \ + exit 1 ; \ + fi ; \ + echo Renaming current directory to "$${d2}" ; \ + mv ../$${d1} ../$${d2} ; \ + fi + # create .orig.tar.bz2 + @set -e ; \ + n="$$(dpkg-parsechangelog | sed -e '/^Source: / ! d' -e 's/^Source: //')" ; \ + d="$${n}-$$(dpkg-parsechangelog | sed -e '/^Version: / ! d' -e 's/^Version: \(.*\)-[^-]\+$$/\1/')" ; \ + n="$${n}_$$(dpkg-parsechangelog | sed -e '/^Version: / ! d' -e 's/^Version: \(.*\)-[^-]\+$$/\1/').orig.tar.bz2" ; \ + echo "Creating source archive $${n}" ; \ + cd .. && tar cjf "$${n}" --exclude='.git*' "$${d}" + # apply patches + @set -e ; \ + echo "Applying patches in debian/patches/series" ; \ + QUILT_PATCHES=debian/patches ; \ + export QUILT_PATCHES ; \ + while quilt next ; do \ + quilt push -v ; \ + quilt refresh ; \ + done + # remind user to change dir + @echo Done. + @echo + @if [ "$(CURDIR)" != "$$PWD" ] ; then \ + echo \ \ You should now tell your shell to update its current working directory: ; \ + echo -e \\t'cd $$(pwd)' ; \ + echo \ \ or ; \ + echo -e "\\tcd $$PWD" ; \ + echo ; \ + fi config.status: configure @@ -174,10 +174,10 @@ config.status: configure ./configure --prefix=/opt/freeswitch --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) ${FEATURES} configure: bootstrap.sh .pc/applied-patches - dh_testdir - test -e /usr/share/misc/config.sub && cp -f /usr/share/misc/config.sub build/config/config.sub - test -e /usr/share/misc/config.guess && cp -f /usr/share/misc/config.guess build/config/config.guess - AUTOCONF=${AUTOCONF} ./bootstrap.sh + dh_testdir + test -e /usr/share/misc/config.sub && cp -f /usr/share/misc/config.sub build/config/config.sub + test -e /usr/share/misc/config.guess && cp -f /usr/share/misc/config.guess build/config/config.guess + AUTOCONF=${AUTOCONF} ./bootstrap.sh build: build-stamp commit 45fb4d271e6b2c6f0aff6d13ea51e4e54b7244d3 Merge: b98401c 1368684 Author: cypromis <michal.bielicki@seventhsignal.de> Date: Fri Oct 15 05:43:31 2010 +0200 Merge branch 'master' of ssh://git.freeswitch.org/freeswitch commit b98401c9903374e2b9a5f5469d87805427343664 Author: cypromis <michal.bielicki@seventhsignal.de> Date: Fri Oct 15 05:43:25 2010 +0200 FS-369 except for adduser change, openzap patches (openzap is gone) and some other minor stuff diff --git a/debian/changelog b/debian/changelog index 2965a92..6c94670 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,12 +1,42 @@ -freeswitch (1.0.7-1headgit1) maverick; urgency=low - * upgrade: Added mod_amrwb - * switched from openzap to freetdm - * added codec2 theora and other codecs - * mod:soundtouch does not build since soundtouch lib is broken on debian - * mod_flite does not build (requires massive memory for flite to build) - * upgrade version to 1.0.7 ... 1.0.6 was last realease - - -- Michal Bielicki <michal.bielicki@seventhsignal.de> Wed, 13 Oct 2010 22:58:48 -0200 +freeswitch (1.0.head-git.master,20101014.1-1) unstable; urgency=low + + * replaced mod_openzap with mod_freetdm + * added mod_theora + * added mod_codec2 + * added mod_amrwb + * added mod_portaudio_stream + * cleaned up rules file and module make rules + * added patches from Julien Duqene (FS-369) + * Various trivial changes and updates :) + + -- Michal Bielicki <michal.bielicki@seventhsignal.de> Fr, 14 Oct 2010 05:05:02 +0200 + +freeswitch (1.0.head~git.master.20100601.2-1) unstable; urgency=low + + * Various trivial changes and updates. + * Change upstream package version numbering scheme for unreleased versions: + new format is major.minor.micro~git.branch.date.commits-1 + * Change source format to 3.0 (quilt). + * Upgrade debhelper compatibility to version 7. + * Update maintainer data and copyright file; now includes the full text + of the MPL since it is not (yet?) available in /usr/share/common-licenses/ + + * Build and install mod_file_string.so (FSBUILD-247) + * Work around build failure caused by clean rules for openzap. + + * Remove several libraries from explicit dependencies, there were no special + version requirements and they should be picked up by dh_shlibdeps. + * Add dh_makeshlibs and make dh_shlibsdeps work again. + * Move openssl to Suggests: as it is not a required package to install or + run freeswitch. + + * Add upstream-convert rule to apply patches, generate orig tarball + and set package version. + * Add check to ensure debian patches are applied before attempting build. + * Fix clean rule to avoid unwanted tree change before building orig.tar + archives with git-buildpackage. + + -- Julien Plissonneau Duquene <exp-end-2010-06-88a41947@aqiii.org> Tue, 01 Jun 2010 09:53:44 -0400 freeswitch (1.0.6-1ubuntu1) maverick; urgency=low diff --git a/debian/compat b/debian/compat index b8626c4..7f8f011 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -4 +7 diff --git a/debian/control b/debian/control index b3c7141..e578287 100644 --- a/debian/control +++ b/debian/control @@ -2,18 +2,22 @@ Source: freeswitch Section: comm Priority: extra Maintainer: FreeSWITCH developers <freeswitch-dev@lists.freeswitch.org> -Uploaders: Michal Bielicki <michal.bielicki@voiceworks.pl>, Gabriel Gunderson <gabe@gundy.org>, William King <quentusrex@gmail.com>, Mathieu Parent <sathieu@debian.org> -Build-Depends: debhelper (>= 5), fakeroot, wget, automake (>=1.9), autoconf, libtool, unixodbc-dev, libasound2-dev, libcurl3-openssl-dev|libcurl4-openssl-dev, libssl-dev, ncurses-dev, libogg-dev, libvorbis-dev, libperl-dev, libgdbm-dev, libdb-dev, libgnutls-dev, libtiff4-dev, python-dev, libx11-dev, uuid-dev +Uploaders: Michal Bielicki <michal.bielicki@seventhsignal.pl>, Gabriel Gunderson <gabe@gundy.org>, William King <quentusrex@gmail.com>, Mathieu Parent <sathieu@debian.org> +Build-Depends: debhelper (>= 7), wget, automake (>=1.9), autoconf, libtool, + unixodbc-dev, libasound2-dev, libcurl3-openssl-dev|libcurl4-openssl-dev, + libssl-dev, ncurses-dev, libogg-dev, libvorbis-dev, libperl-dev, libgdbm-dev, + libdb-dev, libgnutls-dev, libtiff4-dev, python, libx11-dev, uuid-dev Homepage: http://freeswitch.org/ Standards-Version: 3.9.1 -Vcs-Svn: http://svn.freeswitch.org/svn/freeswitch/trunk/ -Vcs-Browser: http://fisheye.freeswitch.org/browse/FreeSWITCH +Vcs-Git: git://git.freeswitch.org/freeswitch.git +Vcs-Browser: http://fisheye.freeswitch.org/browse/freeswitch.git Package: freeswitch Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, unixodbc, libasound2, libcurl3, openssl, libncurses5, libvorbis0a, libuuid1 +Depends: ${shlibs:Depends}, ${misc:Depends} Recommends: freeswitch-lang-en -Suggests: freeswitch-spidermonkey, freeswitch-lua, freeswitch-perl, freeswitch-sounds-music-8000, monit +Suggests: freeswitch-spidermonkey, freeswitch-lua, freeswitch-perl, + freeswitch-sounds-music-8000, monit, openssl Description: open source telephony platform FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a @@ -48,8 +52,8 @@ Description: development libraries and header files for FreeSWITCH gateway or a media server to host IVR applications using simple scripts or XML to control the callflow. . - This package contains the include files used if you wish to compile a package which requires FreeSWITCH's - source file headers. + This package contains the include files used if you wish to compile a package + which require FreeSWITCH's source file headers. Package: freeswitch-spidermonkey Architecture: any @@ -152,7 +156,8 @@ Package: freeswitch-lang-en Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch Recommends: freeswitch-sounds-en-us-callie-8000 -Suggests: freeswitch-sounds-en-us-callie-16000, freeswitch-sounds-en-us-callie-32000, freeswitch-sounds-en-us-callie-48000 +Suggests: freeswitch-sounds-en-us-callie-16000, freeswitch-sounds-en-us-callie-32000, + freeswitch-sounds-en-us-callie-48000 Description: English language files for FreeSWITCH FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a @@ -232,7 +237,8 @@ Package: freeswitch-lang-ru Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch Recommends: freeswitch-sounds-ru-ru-elena-8000 -Suggests: freeswitch-sounds-ru-ru-elena-16000, freeswitch-sounds-ru-ru-elena-32000, freeswitch-sounds-ru-ru-elena-48000 +Suggests: freeswitch-sounds-ru-ru-elena-16000, freeswitch-sounds-ru-ru-elena-32000, + freeswitch-sounds-ru-ru-elena-48000 Description: Russian language files for FreeSWITCH FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a @@ -246,4 +252,14 @@ Description: Russian language files for FreeSWITCH Package: freeswitch-freetdm Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch -Description: FreeTDM is a signaling and board API abstraction used mainly by the FreeSWITCH project to place calls in TDM and analog telephony circuits. The library was previously named "OpenZAP". Sangoma has worked along with the FreeSWITCH developers in this library so Sangoma's customers can also use it to do custom development. The library is still under heavy development but the overall API does not change often. The intention of the library is to present a consistent API for different telephony signaling stacks and board I/O APIs. FreeTDM can either be used as a standalone API or along with FreeSWITCH as an endpoint (mod_freetdm). If you want to use it as a part of FreeSWITCH remember following the FreeSWITCH configuration section. +Description: FreeTDM is a signaling and board API abstraction used mainly by the + FreeSWITCH project to place calls in TDM and analog telephony circuits. The library + was previously named "OpenZAP". Sangoma has worked along with the FreeSWITCH + developers in this library so Sangoma's customers can also use it to do custom + development. The library is still under heavy development but the overall API + does not change often. The intention of the library is to present a consistent + API for different telephony signaling stacks and board I/O APIs. FreeTDM can + either be used as a standalone API or along with FreeSWITCH as an endpoint + (mod_freetdm). If you want to use it as a part of FreeSWITCH remember following + the FreeSWITCH configuration section. + This package contains all the freetdm modules and libs and submodules diff --git a/debian/copyright b/debian/copyright index 45eb67b..e2abda7 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,51 +1,538 @@ This package was debianized by Michal Bielicki -<michal.bielicki@voiceworks.pl> on Now 25, 2007. - -The current Debian maintainer is Nicholas Amorim <nicholas@montrealconsultoria.com.br> +<michal.bielicki@seventhsignal.de> on Now 25, 2007. The source was downloaded from http://www.freewitch.org/ -Upstream authors: -Anthony Minessale II <anthmct@yahoo.com> -Portions created by the Initial Developer are Copyright (C) 2006-2009 -the Initial Developer. All Rights Reserved. +Upstream maintainers: + Current: Michal Bielicki <michal.bielicki@seventhsignal.de> + Past: Nicholas Amorim <nicholas@montrealconsultoria.com.br> +See changelog.Debian.gz for a full list of contributors. -The PRIMARY AUTHORS are (and/or have been): +The Initial Developer of the Original Code is +Anthony Minessale II <anthm@freeswitch.org> +Portions created by the Initial Developer are Copyright (C) + the Initial Developer. All Rights Reserved. - Anthony Minessale II <anthmct@yahoo.com> - Primary developer of all core components - and many of the included modules. Much of freeswitch is based on his work. - - Michael Jerris <mike@jerris.com> - Windows porter and responsible for the - windows\msvc build system. + The PRIMARY AUTHORS are (and/or have been): + + Anthony Minessale II <anthm@freeswitch.org> - Primary developer of all core + components and many of the included modules. Much of freeswitch is based + on his work. + + Michael Jerris <mike@jerris.com> - Windows porter and responsible for the + windows\msvc build system. And here is an inevitably incomplete list of MUCH-APPRECIATED CONTRIBUTORS -- people who have submitted patches, reported bugs, and generally made Freeswitch that much better: - Brian K. West - For countless hours of work on BSD and Mac support, finding countless bugs, and moral support. Xcode project files. - Joshua Colp - For his help making mod_exosip possible (which we are now getting rid of but oh well), - and for just being a swell guy! (until he backstabbed us, c'est la vie) - Michal "cypromis" Bielicki (michal.bielicki AT voiceworks.pl) - Solaris porting, and autotools enhancements, debian, rpm and solaris packaging. - James Martelletti <james@nerdc0re.com> - All around cool guy (mod_syslog) - Johny Kadarisman <jkr888@gmail.com> - Yossi Neiman of Cartis Solutions, Inc. <freeswitch AT cartissolutions.com> - implementation of mod_cdr (perldd, mysql, csv) - Stefan Knoblich - Various patches and support. Thanks. - Justin Unger - <justinunger at gmail dot com> Lots of help with patches and SIP testing. Thanks! - Paul D. Tinsley - Various patches and support. <pdt at jackhammer.org> - Ken Rice - <krice AT suspicious.org> - xmlcdr, sofia improvements, load testing. - Neal Horman <neal at wanlink dot com> - conference improvements, switch_ivr menu additions and other tweaks. - Johny Kadarisman <jkr888 at gmail.com> - mod_python fixups. - Michael Murdock <mike at mmurdock dot org> - testing, documentation, bug finding and usability enhancements. - Matt Klein <mklein@nmedia.net> - Jonas Gauffin <jonas at gauffin dot org> - Bugfixes and additions in mod_spidermonkey_odbc - Damjan Jovanovic <moctodliamgtavojtodnajmad backwards> - mod_java + Brian K. West - For countless hours of work on BSD and Mac support, finding + countless bugs, and moral support. Xcode project files. + Joshua Colp - For his help making mod_exosip possible (which we are now + getting rid of but oh well), and for just being a swell guy! + Michal "cypromis" Bielicki (michal.bielicki AT voiceworks.pl) - Solaris + porting, and autotools enhancements, debian, rpm and solaris packaging. + James Martelletti <james@nerdc0re.com> - All around cool guy (mod_syslog) + Johny Kadarisman <jkr888@gmail.com> + Yossi Neiman of Cartis Solutions, Inc. <freeswitch AT cartissolutions.com> - + implementation of mod_cdr (perldd, mysql, csv) + Stefan Knoblich - Sofia TLS, various patches and support. Thanks. + Justin Unger - <justinunger at gmail dot com> Lots of help with patches and + SIP testing. Thanks! + Paul D. Tinsley - Various patches and support. <pdt at jackhammer.org> + Ken Rice - <krice AT suspicious.org> - xmlcdr, sofia improvements, load + testing, 1 liners here and there. + Neal Horman <neal at wanlink dot com> - conference improvements, switch_ivr + menu additions and other tweaks. + Johny Kadarisman <jkr888 at gmail.com> - mod_python fixups. + Michael Murdock <mike at mmurdock dot org> - testing, documentation, bug + finding and usability enhancements. + Matt Klein <mklein@nmedia.net> + Jonas Gauffin <jonas at gauffin dot org> - mod_cdr_odbc, + mod_spidermonkey_socket, Bugfixes and additions in mod_spidermonkey_odbc and + mod_spidermonkey, .net event socket library. + Damjan Jovanovic <moctodliamgtavojtodnajmad backwards> - mod_java + Juan Jose Comellas <juanjo@comellas.org> - Patch to switch_utils for arg + parsing. + Dale Thatcher <freeswitch at dalethatcher dot com> - Additions to + mod_conference. + Simon Perreault & Marc Blanchet from Viagenie.ca - IPv6 Support. A big THANK YOU goes to: -Justin Cassidy - Build related cleanups and automatic build setup. -Bret McDanel - Javascript Documentation, constant feedback and input, many other things I am sure I am forgetting. + Justin Cassidy - Build related cleanups and automatic build setup. + Bret McDanel - Javascript Documentation, constant feedback and input, many + other things I am sure I am forgetting. + + + MOZILLA PUBLIC LICENSE + Version 1.1 + + --------------- + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the + Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to + the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original + Code, prior Modifications used by a Contributor, and the Modifications + made by that particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the + combination of the Original Code and Modifications, in each case + including portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally + accepted in the software development community for the electronic + transfer of data. + + 1.5. "Executable" means Covered Code in any form other than Source + Code. + + 1.6. "Initial Developer" means the individual or entity identified + as the Initial Developer in the Source Code notice required by Exhibit + A. + + 1.7. "Larger Work" means a work which combines Covered Code or + portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum + extent possible, whether at the time of the initial grant or + subsequently acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the + substance or structure of either the Original Code or any previous + Modifications. When Covered Code is released as a series of files, a + Modification is: + A. Any addition to or deletion from the contents of a file + containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or + previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code + which is described in the Source Code notice required by Exhibit A as + Original Code, and which, at the time of its release under this + License is not already Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or + hereafter acquired, including without limitation, method, process, + and apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for + making modifications to it, including all modules it contains, plus + any associated interface definition files, scripts used to control + compilation and installation of an Executable, or source code + differential comparisons against either the Original Code or another + well known, available Covered Code of the Contributor's choice. The + Source Code can be in a compressed or archival form, provided the + appropriate decompression or de-archiving software is widely available + for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity + exercising rights under, and complying with all of the terms of, this + License or a future version of this License issued under Section 6.1. + For legal entities, "You" includes any entity which controls, is + controlled by, or is under common control with You. For purposes of + this definition, "control" means (a) the power, direct or indirect, + to cause the direction or management of such entity, whether by + contract or otherwise, or (b) ownership of more than fifty percent + (50%) of the outstanding shares or beneficial ownership of such + entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, + non-exclusive license, subject to third party intellectual property + claims: + (a) under intellectual property rights (other than patent or + trademark) Licensable by Initial Developer to use, reproduce, + modify, display, perform, sublicense and distribute the Original + Code (or portions thereof) with or without Modifications, and/or + as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or + selling of Original Code, to make, have made, use, practice, + sell, and offer for sale, and/or otherwise dispose of the + Original Code (or portions thereof). + + (c) the licenses granted in this Section 2.1(a) and (b) are + effective on the date Initial Developer first distributes + Original Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is + granted: 1) for code that You delete from the Original Code; 2) + separate from the Original Code; or 3) for infringements caused + by: i) the modification of the Original Code or ii) the + combination of the Original Code with other software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor + hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Contributor, to use, reproduce, modify, + display, perform, sublicense and distribute the Modifications + created by such Contributor (or portions thereof) either on an + unmodified basis, with other Modifications, as Covered Code + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or + selling of Modifications made by that Contributor either alone + and/or in combination with its Contributor Version (or portions + of such combination), to make, use, sell, offer for sale, have + made, and/or otherwise dispose of: 1) Modifications made by that + Contributor (or portions thereof); and 2) the combination of + Modifications made by that Contributor with its Contributor + Version (or portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are + effective on the date Contributor first makes Commercial Use of + the Covered Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is + granted: 1) for any code that Contributor has deleted from the + Contributor Version; 2) separate from the Contributor Version; + 3) for infringements caused by: i) third party modifications of + Contributor Version or ii) the combination of Modifications made + by that Contributor with other software (except as part of the + Contributor Version) or other devices; or 4) under Patent Claims + infringed by Covered Code in the absence of Modifications made by + that Contributor. + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are + governed by the terms of this License, including without limitation + Section 2.2. The Source Code version of Covered Code may be + distributed only under the terms of this License or a future version + of this License released under Section 6.1, and You must include a + copy of this License with every copy of the Source Code You + distribute. You may not offer or impose any terms on any Source Code + version that alters or restricts the applicable version of this + License or the recipients' rights hereunder. However, You may include + an additional document offering the additional rights described in + Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be + made available in Source Code form under the terms of this License + either on the same media as an Executable version or via an accepted + Electronic Distribution Mechanism to anyone to whom you made an + Executable version available; and if made available via Electronic + Distribution Mechanism, must remain available for at least twelve (12) + months after the date it initially became available, or at least six + (6) months after a subsequent version of that particular Modification + has been made available to such recipients. You are responsible for + ensuring that the Source Code version remains available even if the + Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a + file documenting the changes You made to create that Covered Code and + the date of any change. You must include a prominent statement that + the Modification is derived, directly or indirectly, from Original + Code provided by the Initial Developer and including the name of the + Initial Developer in (a) the Source Code, and (b) in any notice in an + Executable version or related documentation in which You describe the + origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's + intellectual property rights is required to exercise the rights + granted by such Contributor under Sections 2.1 or 2.2, + Contributor must include a text file with the Source Code + distribution titled "LEGAL" which describes the claim and the + party making the claim in sufficient detail that a recipient will + know whom to contact. If Contributor obtains such knowledge after + the Modification is made available as described in Section 3.2, + Contributor shall promptly modify the LEGAL file in all copies + Contributor makes available thereafter and shall take other steps + (such as notifying appropriate mailing lists or newsgroups) + reasonably calculated to inform those who received the Covered + Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming + interface and Contributor has knowledge of patent licenses which + are reasonably necessary to implement that API, Contributor must + also include this information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to + Section 3.4(a) above, Contributor believes that Contributor's + Modifications are Contributor's original creation(s) and/or + Contributor has sufficient rights to grant the rights conveyed by + this License. + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source + Code. If it is not possible to put such notice in a particular Source + Code file due to its structure, then You must include such notice in a + location (such as a relevant directory) where a user would be likely + to look for such a notice. If You created one or more Modification(s) + You may add your name as a Contributor to the notice described in + Exhibit A. You must also duplicate this License in any documentation + for the Source Code where You describe recipients' rights or ownership + rights relating to Covered Code. You may choose to offer, and to + charge a fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Code. However, You + may do so only on Your own behalf, and not on behalf of the Initial + Developer or any Contributor. You must make it absolutely clear than + any such warranty, support, indemnity or liability obligation is + offered by You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred by the + Initial Developer or such Contributor as a result of warranty, + support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the + requirements of Section 3.1-3.5 have been met for that Covered Code, + and if You include a notice stating that the Source Code version of + the Covered Code is available under the terms of this License, + including a description of how and where You have fulfilled the + obligations of Section 3.2. The notice must be conspicuously included + in any notice in an Executable version, related documentation or + collateral in which You describe recipients' rights relating to the + Covered Code. You may distribute the Executable version of Covered + Code or ownership rights under a license of Your choice, which may + contain terms different from this License, provided that You are in + compliance with the terms of this License and that the license for the + Executable version does not attempt to limit or alter the recipient's + rights in the Source Code version from the rights set forth in this + License. If You distribute the Executable version under a different + license You must make it absolutely clear that any terms which differ + from this License are offered by You alone, not by the Initial + Developer or any Contributor. You hereby agree to indemnify the + Initial Developer and every Contributor for any liability incurred by + the Initial Developer or such Contributor as a result of any such + terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code + not governed by the terms of this License and distribute the Larger + Work as a single product. In such a case, You must make sure the + requirements of this License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this + License with respect to some or all of the Covered Code due to + statute, judicial order, or regulation then You must: (a) comply with + the terms of this License to the maximum extent possible; and (b) + describe the limitations and the code they affect. Such description + must be included in the LEGAL file described in Section 3.4 and must + be included with all distributions of the Source Code. Except to the + extent prohibited by statute or regulation, such description must be + sufficiently detailed for a recipient of ordinary skill to be able to + understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has + attached the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised + and/or new versions of the License from time to time. Each version + will be given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the + License, You may always continue to use it under the terms of that + version. You may also choose to use such Covered Code under the terms + of any subsequent version of the License published by Netscape. No one + other than Netscape has the right to modify the terms applicable to + Covered Code created under this License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may + only do in order to apply it to code which is not already Covered Code + governed by this License), You must (a) rename Your license so that + the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", + "MPL", "NPL" or any confusingly similar phrase do not appear in your + license (except to note that your license differs from this License) + and (b) otherwise make it clear that Your version of the license + contains terms which differ from the Mozilla Public License and + Netscape Public License. (Filling in the name of the Initial + Developer, Original Code or Contributor in the notice described in + Exhibit A shall not of themselves be deemed to be modifications of + this License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF + DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. + THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE + IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, + YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE + COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER + OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate + automatically if You fail to comply with terms herein and fail to cure + such breach within 30 days of becoming aware of the breach. All + sublicenses to the Covered Code which are properly granted shall + survive any termination of this License. Provisions which, by their + nature, must remain in effect beyond the termination of this License + shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement + claim (excluding declatory judgment actions) against Initial Developer + or a Contributor (the Initial Developer or Contributor against whom + You file such action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly + infringes any patent, then any and all rights granted by such + Participant to You under Sections 2.1 and/or 2.2 of this License + shall, upon 60 days notice from Participant terminate prospectively, + unless if within 60 days after receipt of notice You either: (i) + agree in writing to pay Participant a mutually agreeable reasonable + royalty for Your past and future use of Modifications made by such + Participant, or (ii) withdraw Your litigation claim with respect to + the Contributor Version against such Participant. If within 60 days + of notice, a reasonable royalty and payment arrangement are not + mutually agreed upon in writing by the parties or the litigation claim + is not withdrawn, the rights granted by Participant to You under + Sections 2.1 and/or 2.2 automatically terminate at the expiration of + the 60 day notice period specified above. + + (b) any software, hardware, or device, other than such Participant's + Contributor Version, directly or indirectly infringes any patent, then + any rights granted to You by such Participant under Sections 2.1(b) + and 2.2(b) are revoked effective as of the date You first made, used, + sold, distributed, or had made, Modifications made by that + Participant. + + 8.3. If You assert a patent infringement claim against Participant + alleging that such Participant's Contributor Version directly or + indirectly infringes any patent where such claim is resolved (such as + by license or settlement) prior to the initiation of patent + infringement litigation, then the reasonable value of the licenses + granted by such Participant under Sections 2.1 or 2.2 shall be taken + into account in determining the amount or value of any payment or + license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, + all end user license agreements (excluding distributors and resellers) + which have been validly granted by You or any distributor hereunder + prior to termination shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL + DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, + OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR + ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY + CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, + WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY + RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW + PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE + EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO + THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in + 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer + software" and "commercial computer software documentation," as such + terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 + C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), + all U.S. Government End Users acquire Covered Code with only those + rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. This License shall be governed by + California law provisions (except to the extent applicable law, if + any, provides otherwise), excluding its conflict-of-law provisions. + With respect to disputes in which at least one party is a citizen of, + or an entity chartered or registered to do business in the United + States of America, any litigation relating to this License shall be + subject to the jurisdiction of the Federal Courts of the Northern + District of California, with venue lying in Santa Clara County, + California, with the losing party responsible for costs, including + without limitation, court costs and reasonable attorneys' fees and + expenses. The application of the United Nations Convention on + Contracts for the International Sale of Goods is expressly excluded. + Any law or regulation which provides that the language of a contract + shall be construed against the drafter shall not apply to this + License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or indirectly, + out of its utilization of rights under this License and You agree to + work with Initial Developer and Contributors to distribute such + responsibility on an equitable basis. Nothing herein is intended or + shall be deemed to constitute any admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as + "Multiple-Licensed". "Multiple-Licensed" means that the Initial + Developer permits you to utilize portions of the Covered Code under + Your choice of the NPL or the alternative licenses, if any, specified + by the Initial Developer in the file described in Exhibit A. + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License + Version 1.1 (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.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. + Portions created by ______________________ are Copyright (C) ______ + _______________________. All Rights Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms + of the _____ license (the "[___] License"), in which case the + provisions of [______] License are applicable instead of those + above. If you wish to allow use of your version of this file only + under the terms of the [____] License and not to allow others to use + your version of this file under the MPL, indicate your decision by + deleting the provisions above and replace them with the notice and + other provisions required by the [___] License. If you do not delete + the provisions above, a recipient may use your version of this file + under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of + the notices in the Source Code files of the Original Code. You should + use the text of this Exhibit A rather than the text found in the + Original Code Source Code for Your Modifications.] + -You are free to distribute this software under the terms of -the MPL Mozilla Public License. On Debian systems, the complete -text of the GNU General Public License can be found in the file -'/usr/share/common-licenses/MPL'. diff --git a/debian/postinst b/debian/postinst index 31a2536..36d983f 100755 --- a/debian/postinst +++ b/debian/postinst @@ -27,6 +27,13 @@ case "$1" in --gecos "FreeSwitch Voice Platform" --ingroup daemon \ freeswitch adduser freeswitch audio + else + if [ "$(getent passwd freeswitch | cut -d : -f 6)" != "/opt/freeswitch" ]; then + echo "Error: pre-existing freeswitch user with non-standard home directory." >&2 + exit 1 + fi + usermod -d /opt/freeswitch -c "FreeSwitch daemon,,," \ + -g daemon -G audio freeswitch fi mkdir -p /opt/freeswitch diff --git a/debian/postrm b/debian/postrm index 9dbbeb0..97718df 100755 --- a/debian/postrm +++ b/debian/postrm @@ -1,5 +1,5 @@ #!/bin/sh -# postrm script for openfire +# postrm script for freeswitch # # see: dh_installdeb(1) diff --git a/debian/rules b/debian/rules index c771904..a0fe20e 100755 --- a/debian/rules +++ b/debian/rules @@ -1,6 +1,4 @@ #!/usr/bin/make -f -# Sample debian/rules that uses debhelper. -# This file is public domain software, originally written by Joey Hess. # Uncomment this to turn on verbose mode. export DH_VERBOSE=1 @@ -57,6 +55,116 @@ ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) FEATURES += --disable-optimization endif +.pc/applied-patches: + @echo + @echo \ \ Sorry, currently this package cannot be built directly from upstream + @echo \ \ source git/tarball: patches are needed for policy compliance, and the + @echo \ \ "new 3.0 (quilt) source format requires patches to be already applied." + @echo + @echo \ \ Please first convert this tree by running: + @echo -e \\t./debian/rules upstream-convert + @echo + @echo \ \ Note that this will insert an entry in debian/changelog, rename the + @echo \ \ current directory to the version number there, create a .orig.tar.bz2 + @echo \ \ archive and apply all the patches in debian/patches/series. + @echo + @echo \ \ Using git-buildpackage is not recommended for now. + @echo + @exit 1 + +upstream-convert: + @dh_testdir + @test -s .pc/applied-patches && \ + echo "Aborted: patches are already applied." && \ + exit 1 || exit 0 + # update (or not) version number in debian/changelog + @set -e ; \ + echo Checking version number ; \ + v1="$$(dpkg-parsechangelog | sed -e '/^Version: / ! d' -e 's/^Version: //')" ; \ + v2="$${v1}" ; \ + echo " Current version: $${v1}" ; \ + if [ "$$(which git)" = "" -o ! -d .git ] ; then \ + echo Git not available. Keeping current version number. ; \ + exit 0 ; \ + fi ; \ + if [ "$$(which debchange)" = "" ] ; then \ + echo debchange not available. Keeping current version number. ; \ + exit 0 ; \ + fi ; \ + if echo -n "$${v1}" | grep -q '~git\.[a-z0-9]\+\.20[0-9]\{6\}\.[0-9]\+-[^-]\+$$' ; then \ + maj1="$$(echo -n "$${v1}" | sed -e 's/^\([^.]\+\)\..*$$/\1/')" ; \ + min1="$$(echo -n "$${v1}" | sed -e 's/^[^.]\+\.\([^.]\+\)\..*$$/\1/')" ; \ + mic1="$$(echo -n "$${v1}" | sed -e 's/^[^.]\+\.[^.]\+\.\([a-zA-Z0-9]\+\).*$$/\1/')" ; \ + b1="$$(echo -n "$${v1}" | sed -e 's/^.*~git\.\([a-z0-9]\+\)\.\(20[0-9]\{6\}\)\.[0-9]\+-[^-]\+$$/\1/')" ; \ + d1="$$(echo -n "$${v1}" | sed -e 's/^.*\.\(20[0-9]\{6\}\)\.[0-9]\+-[^-]\+$$/\1/')" ; \ + n1="$$(echo -n "$${v1}" | sed -e 's/^.*\.20[0-9]\{6\}\.\([0-9]\+\)-[^-]\+$$/\1/')" ; \ + maj2="$$(sed -e '/^AC_SUBST(SWITCH_VERSION_MAJOR/ ! d' -e 's/^.*\[\([^\[]\+\)\][^\]]*$$/\1/' configure.in)" ; \ + min2="$$(sed -e '/^AC_SUBST(SWITCH_VERSION_MINOR/ ! d' -e 's/^.*\[\([^\[]\+\)\][^\]]*$$/\1/' configure.in)" ; \ + mic2="$$(sed -e '/^AC_SUBST(SWITCH_VERSION_MICRO/ ! d' -e 's/^.*\[\([^\[]\+\)\][^\]]*$$/\1/' configure.in)" ; \ + b2="$$(git branch | sed -e '/^[^*]/ d' -e 's/* \(.*\)/\1/')" ; \ + d2="$$(TZ=UTC git log --date=local -1 --format='%ai' | sed -e 's/^\(....\).\(..\).\(..\).*$$/\1\2\3/')" ; \ + n2="$$(TZ=UTC git log --date=local --format=oneline --since="$${d2::4}-$${d2:4:2}-$${d2:6:2} 00:00" | wc -l)" ; \ + if [ "$${b2}" != "$$(echo "$${b2}" | tr -dc a-z0-9)" ] ; then \ + echo Invalid branch name "'$${b2}'". Aborted. ; \ + exit 1; \ + fi ; \ + if [ "$${b1}.$${d1}.$${n1}" != "$${b2}.$${d2}.$${n2}" \ + -o "$${maj1}.$${min1}.$${mic1}" != "$${maj2}.$${min2}.$${mic2}" ] ; then \ + v2="$$(echo -n "$${maj2}.$${min2}.$${mic2}")" ; \ + v2="$${v2}$$(echo -n "$${v1}" | sed -e 's/^[^.]\+\.[^.]\+\.[^.]\+\(.*\)~git\..*$$/\1/')" ; \ + v2="$${v2}~git.$${b2}.$${d2}.$${n2}-1" ; \ + echo " New version: $${v2}" ; \ + echo Updating debian/changelog with new version number ; \ + debchange -v "$${v2}" "New upstream release" ; \ + else \ + echo Version number already correct, no change. ; \ + fi ; \ + else \ + echo 'Not a ~git. version number. Keeping current version number.' ; \ + fi + # rename (or not) current directory to match packagename-version.number + @set -e ; \ + echo Checking directory name ; \ + d1="$$(basename "$$(cd . && echo "$$PWD")")" ; \ + d2="$$(dpkg-parsechangelog | sed -e '/^Source: / ! d' -e 's/^Source: //')" ; \ + d2="$${d2}-$$(dpkg-parsechangelog | sed -e '/^Version: / ! d' -e 's/^Version: \(.*\)-[^-]\+$$/\1/')" ; \ + if [ "$${d1}" != "$${d2}" ] ; then \ + if [ -e "../$${d2}" ] ; then \ + test . -ef "../$${d2}" && exit 0 ; \ + echo Aborted: directory "../$${d2}" already exists. ; \ + exit 1 ; \ + fi ; \ + echo Renaming current directory to "$${d2}" ; \ + mv ../$${d1} ../$${d2} ; \ + fi + # create .orig.tar.bz2 + @set -e ; \ + n="$$(dpkg-parsechangelog | sed -e '/^Source: / ! d' -e 's/^Source: //')" ; \ + d="$${n}-$$(dpkg-parsechangelog | sed -e '/^Version: / ! d' -e 's/^Version: \(.*\)-[^-]\+$$/\1/')" ; \ + n="$${n}_$$(dpkg-parsechangelog | sed -e '/^Version: / ! d' -e 's/^Version: \(.*\)-[^-]\+$$/\1/').orig.tar.bz2" ; \ + echo "Creating source archive $${n}" ; \ + cd .. && tar cjf "$${n}" --exclude='.git*' "$${d}" + # apply patches + @set -e ; \ + echo "Applying patches in debian/patches/series" ; \ + QUILT_PATCHES=debian/patches ; \ + export QUILT_PATCHES ; \ + while quilt next ; do \ + quilt push -v ; \ + quilt refresh ; \ + done + # remind user to change dir + @echo Done. + @echo + @if [ "$(CURDIR)" != "$$PWD" ] ; then \ + echo \ \ You should now tell your shell to update its current working directory: ; \ + echo -e \\t'cd $$(pwd)' ; \ + echo \ \ or ; \ + echo -e "\\tcd $$PWD" ; \ + echo ; \ + fi + + config.status: configure dh_testdir rm -f modules.conf @@ -65,15 +173,12 @@ config.status: configure for i in $(MODULES); do echo $$i >> modules.conf; done ./configure --prefix=/opt/freeswitch --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) ${FEATURES} -configure: - if test ! -f Makefile.in ; then \ - if test -f ./bootstrap.sh ; then \ - AUTOCONF=${AUTOCONF} ./bootstrap.sh ; \ - else \ - echo "No Makefile.in and no known way to bootstrap." ; \ - exit 1; \ - fi; \ - fi; +configure: bootstrap.sh .pc/applied-patches + dh_testdir + test -e /usr/share/misc/config.sub && cp -f /usr/share/misc/config.sub build/config/config.sub + test -e /usr/share/misc/config.guess && cp -f /usr/share/misc/config.guess build/config/config.guess + AUTOCONF=${AUTOCONF} ./bootstrap.sh + build: build-stamp build-stamp: config.status @@ -83,19 +188,13 @@ build-stamp: config.status touch $@ -clean: +clean: .pc/applied-patches dh_testdir dh_testroot rm -f build-stamp -$(MAKE) update-clean -ifneq "$(wildcard /usr/share/misc/config.sub)" "" - cp -f /usr/share/misc/config.sub build/config/config.sub -endif -ifneq "$(wildcard /usr/share/misc/config.guess)" "" - cp -f /usr/share/misc/config.guess build/config/config.guess -endif - rm -f config.status + rm -f configure config.status rm -f */*/config.status rm -f */*/*/config.status dh_clean @@ -103,8 +202,8 @@ endif install: build dh_testdir dh_testroot - dh_clean -k - dh_installdirs -A --sourcedir=debian/tmp + dh_prep + dh_installdirs -A VERBOSE=1 $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install @@ -123,11 +222,12 @@ binary-arch: build install cp debian/monit/freeswitch.monitrc debian/freeswitch/etc/monit/freeswitch.monitrc dh_install --sourcedir=debian/tmp dh_link - dh_strip --dbg-package=freeswitch + dh_strip --dbg-package=freeswitch-dbg dh_compress dh_fixperms --exclude /opt/freeswitch/conf + dh_makeshlibs + dh_shlibdeps dh_installdeb - dh_shlibdeps --exclude=/opt/freeswitch dh_gencontrol dh_md5sums dh_builddeb diff --git a/debian/sounds/freeswitch-sounds-en-us-callie/debian/changelog b/debian/sounds/freeswitch-sounds-en-us-callie/debian/changelog index adb1dfc..9ca1d1a 100644 --- a/debian/sounds/freeswitch-sounds-en-us-callie/debian/changelog +++ b/debian/sounds/freeswitch-sounds-en-us-callie/debian/changelog @@ -1,3 +1,12 @@ +freeswitch-sounds-en-us-callie (1.0.head-git.master,20101014.1-1) unstable; urgency=low + + * Change upstream package version numbering scheme for unreleased versions: + new format is major.minor.micro~git.branch.date.commits-1 + * Change source format to 3.0 (quilt). + * Upgrade debhelper compatibility to version 7. + + -- Michal Bielicki <michal.bielicki@seventhsignal.de> Fr, 14 Oct 2010 05:05:02 +0200 + freeswitch-sounds-en-us-callie (1.0.12-0ubuntu1) jaunty; urgency=low * Initial: This is the initial working build of the en-us-callie sounds diff --git a/debian/sounds/freeswitch-sounds-en-us-callie/debian/control b/debian/sounds/freeswitch-sounds-en-us-callie/debian/control index 1af616a..3408328 100644 --- a/debian/sounds/freeswitch-sounds-en-us-callie/debian/control +++ b/debian/sounds/freeswitch-sounds-en-us-callie/debian/control @@ -2,8 +2,9 @@ Source: freeswitch-sounds-en-us-callie Maintainer: Freeswitch Debian Team <debian@freeswitch.org> Section: net Priority: extra -Build-Depends: debhelper (>= 5), fakeroot, sox -Standards-Version: 3.7.3 +Build-Depends: debhelper (>= 7), sox +Homepage: http://www.freeswitch.org/ +Standards-Version: 3.8.4 Package: freeswitch-sounds-en-us-callie-8000 Architecture: all @@ -47,14 +48,18 @@ Description: English language sounds for the FreeSWITCH(TM) (48000) Package: freeswitch-sounds-en-us-callie Architecture: all Depends: sox, freeswitch-sounds-en-us-callie-48000 -Conflicts: freeswitch-sounds-en-us-callie-omega, freeswitch-sounds-en-us-callie-8000, freeswitch-sounds-en-us-callie-16000, freeswitch-sounds-en-us-callie-32000 +Conflicts: freeswitch-sounds-en-us-callie-omega, + freeswitch-sounds-en-us-callie-8000, freeswitch-sounds-en-us-callie-16000, + freeswitch-sounds-en-us-callie-32000 Description: English language files for FreeSWITCH(TM) This package generates the 8k, 16k, and 32k from the installed 48k sounds. You can select which ones you want. Package: freeswitch-sounds-en-us-callie-omega Architecture: all -Depends: freeswitch-sounds-en-us-callie-48000, freeswitch-sounds-en-us-callie-32000, freeswitch-sounds-en-us-callie-16000, freeswitch-sounds-en-us-callie-8000 +Depends: freeswitch-sounds-en-us-callie-48000, + freeswitch-sounds-en-us-callie-32000, freeswitch-sounds-en-us-callie-16000, + freeswitch-sounds-en-us-callie-8000 Conflicts: freeswitch-sounds-en-us-callie Description: English language files for FreeSWITCH(TM) This package depends on the pregenerated 8khz, 16khz, 32khz, and 48khz sounds diff --git a/debian/sounds/freeswitch-sounds-music/debian/changelog b/debian/sounds/freeswitch-sounds-music/debian/changelog index 5f18ff3..2d639c0 100644 --- a/debian/sounds/freeswitch-sounds-music/debian/changelog +++ b/debian/sounds/freeswitch-sounds-music/debian/changelog @@ -1,3 +1,12 @@ +freeswitch-sounds-music (1.0.head-git.master,20101014.1-1) unstable; urgency=low + + * Change upstream package version numbering scheme for unreleased versions: + new format is major.minor.micro~git.branch.date.commits-1 + * Change source format to 3.0 (quilt). + * Upgrade debhelper compatibility to version 7. + + -- Michal Bielicki <michal.bielicki@seventhsignal.de> Fr, 14 Oct 2010 05:05:02 +0200 + freeswitch-sounds-music (1.0.8-0ubuntu3) jaunty; urgency=low * Fixed: empty binary files for some packages diff --git a/debian/sounds/freeswitch-sounds-music/debian/control b/debian/sounds/freeswitch-sounds-music/debian/control index d03c2aa..20cfd5e 100644 --- a/debian/sounds/freeswitch-sounds-music/debian/control +++ b/debian/sounds/freeswitch-sounds-music/debian/control @@ -1,9 +1,10 @@ Source: freeswitch-sounds-music -Maintainer: Freeswitch Debian Team <debian@freeswitch.org> +Maintainer: Freeswitch development Team <freeswitch-dev@freeswitch.org> Section: net Priority: extra -Build-Depends: debhelper (>= 5), fakeroot, sox -Standards-Version: 3.7.3 +Build-Depends: debhelper (>= 7), sox +Homepage: http://www.freeswitch.org/ +Standards-Version: 3.8.4 Package: freeswitch-sounds-music-8000 Architecture: all @@ -47,14 +48,18 @@ Description: music for FreeSWITCH(TM) (48000) Package: freeswitch-sounds-music Architecture: all Depends: sox, freeswitch-sounds-music-48000 -Conflicts: freeswitch-sounds-music-omega, freeswitch-sounds-music-8000, freeswitch-sounds-music-16000, freeswitch-sounds-music-32000 +Conflicts: freeswitch-sounds-music-omega, + freeswitch-sounds-music-8000, freeswitch-sounds-music-16000, + freeswitch-sounds-music-32000 Description: Music for FreeSWITCH(TM) This package generates the 8k, 16k, and 32k from the installed 48k sounds. You can select which ones you want. Package: freeswitch-sounds-music-omega Architecture: all -Depends: freeswitch-sounds-music-48000, freeswitch-sounds-music-32000, freeswitch-sounds-music-16000, freeswitch-sounds-music-8000 +Depends: freeswitch-sounds-music-48000, + freeswitch-sounds-music-32000, freeswitch-sounds-music-16000, + freeswitch-sounds-music-8000 Conflicts: freeswitch-sounds-music Description: Music for FreeSWITCH(TM) This package depends on the pregenerated 8khz, 16khz, 32khz, and 48khz sounds diff --git a/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/changelog b/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/changelog index b7de592..38cc529 100644 --- a/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/changelog +++ b/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/changelog @@ -1,3 +1,12 @@ +freeswitch-sounds-ru-ru-elena (1.0.head-git.master,20101014.1-1) unstable; urgency=low + + * Change upstream package version numbering scheme for unreleased versions: + new format is major.minor.micro~git.branch.date.commits-1 + * Change source format to 3.0 (quilt). + * Upgrade debhelper compatibility to version 7. + + -- Michal Bielicki <michal.bielicki@seventhsignal.de> Fr, 14 Oct 2010 05:05:02 +0200 + freeswitch-sounds-ru-ru-elena (1.0.12-0ubuntu3) jaunty; urgency=low * Fixed: Empty binary package bug caused by the second ru folder being diff --git a/debian/substvars b/debian/substvars index 6229324..e69de29 100644 --- a/debian/substvars +++ b/debian/substvars @@ -1 +0,0 @@ -shlibs:Depends=libc6 (>= 2.3.6-6), libdb4.4, libgcc1 (>= 1:4.1.1-12), libsasl2-2, libssl0.9.8 (>= 0.9.8c-1), libstdc++6 (>= 4.1.1-12), libuuid1, zlib1g (>= 1:1.2.1) diff --git a/libs/libsndfile/M4/lt~obsolete.m4 b/libs/libsndfile/M4/lt~obsolete.m4 index 637bb20..c573da9 100644 --- a/libs/libsndfile/M4/lt~obsolete.m4 +++ b/libs/libsndfile/M4/lt~obsolete.m4 @@ -1,13 +1,13 @@ # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # -# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. +# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# serial 4 lt~obsolete.m4 +# serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # @@ -77,7 +77,6 @@ m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) -m4_ifndef([AC_LIBTOOL_RC], [AC_DEFUN([AC_LIBTOOL_RC])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) @@ -90,3 +89,10 @@ m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) +m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) +m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) +m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) +m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) +m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) +m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) commit 1368684460de9bbb25e91e2e17b3e127855d7fed Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Oct 14 22:25:44 2010 -0500 continuation of msbuild enabled automated installers for Win32/X64 diff --git a/w32/Setup/Product.wxs b/w32/Setup/Product.wxs new file mode 100644 index 0000000..aa49748 --- /dev/null +++ b/w32/Setup/Product.wxs @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Platform specific variables --> +<?if $(var.Platform) = x64 ?> +<?define Win64 = "yes" ?> +<?define ProductName = "FreeSWITCH (64 bit)" ?> +<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?> +<?else ?> +<?define Win64 = "no" ?> +<?define ProductName = "FreeSWITCH" ?> +<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?> +<?endif ?> + +<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> + <Product Id="b004a325-1272-47e5-a415-a74e9fc99865" Name="$(var.ProductName)" Language="1033" Version="1.0.0.0" Manufacturer="FreeSWITCH" UpgradeCode="3af7020b-1348-45e8-a0cf-80909d4eb421"> + <Package InstallerVersion="200" Compressed="yes" /> + + <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" /> + + <Directory Id="TARGETDIR" Name="SourceDir"> + <Directory Id="$(var.PlatformProgramFilesFolder)"> + <Directory Id="INSTALLLOCATION" Name="FreeSWITCH"> + <Directory Id="MODLOCATION" Name="mod"> + </Directory> + <Directory Id="CONFLOCATION" Name="conf"> + </Directory> + <Directory Id="SOUNDLOCATION" Name="sounds"> + </Directory> + <!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. --> + <!-- <Component Id="ProductComponent" Guid="6f1498a7-d029-430b-b9d9-fe12e17bdbab"> --> + <!-- TODO: Insert files, registry keys, and other resources here. --> + <!-- </Component> --> + </Directory> + </Directory> + </Directory> + + <Feature Id="ProductFeature" Title="FreeSWITCH Core" Level="1"> + <!-- TODO: Remove the comments around this ComponentRef element and the Component above in order to add resources to this installer. --> + <!-- <ComponentRef Id="ProductComponent" /> --> + + <!-- Note: The following ComponentGroupRef is required to pull in generated authoring from project references. --> + <ComponentGroupRef Id="Product.Generated" /> + </Feature> + <Feature Id="ProductFeatureConf" Title="FreeSWITCH Configuration Sample" Level="1"> + <ComponentGroupRef Id="FreeSWITCHConfFiles" /> + </Feature> + <Feature Id="ProductFeatureSounds" Title="FreeSWITCH Sounds 8Khz" Level="1"> + <ComponentGroupRef Id="FreeSWITCHSoundFiles8" /> + </Feature> + <UIRef Id="WixUI_Mondo" /> + </Product> +</Wix> diff --git a/w32/Setup/Setup.wixproj b/w32/Setup/Setup.wixproj index 03fd609..6e59ed6 100644 --- a/w32/Setup/Setup.wixproj +++ b/w32/Setup/Setup.wixproj @@ -12,26 +12,26 @@ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> <OutputPath>bin\x86\Debug\</OutputPath> <IntermediateOutputPath>obj\X86\$(Configuration)\</IntermediateOutputPath> - <DefineConstants>Debug;FreeSWITCHConfFilesDir=..\..\..\..\conf;FreeSWITCHSoundFilesDir=..\..\..\..\Win32\debug\sounds;</DefineConstants> + <DefineConstants>Debug;FreeSWITCHConfFilesDir=..\..\..\..\..\conf;FreeSWITCHSoundFilesDir=..\..\..\..\..\Win32\debug\sounds;</DefineConstants> <WixVariables> </WixVariables> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> <OutputPath>bin\x86\release\</OutputPath> <IntermediateOutputPath>obj\X86\$(Configuration)\</IntermediateOutputPath> - <DefineConstants>Debug;FreeSWITCHConfFilesDir=..\..\..\..\conf;FreeSWITCHSoundFilesDir=..\..\..\..\Win32\release\sounds;</DefineConstants> + <DefineConstants>Debug;FreeSWITCHConfFilesDir=..\..\..\..\..\conf;FreeSWITCHSoundFilesDir=..\..\..\..\..\Win32\release\sounds;</DefineConstants> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' "> <OutputPath>bin\x64\Debug\</OutputPath> <IntermediateOutputPath>obj\X64\$(Configuration)\</IntermediateOutputPath> - <DefineConstants>Debug;FreeSWITCHConfFilesDir=..\..\..\..\conf;FreeSWITCHSoundFilesDir=..\..\..\..\x64\debug\sounds;</DefineConstants> + <DefineConstants>Debug;FreeSWITCHConfFilesDir=..\..\..\..\..\conf;FreeSWITCHSoundFilesDir=..\..\..\..\..\x64\debug\sounds;</DefineConstants> <WixVariables> </WixVariables> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' "> <OutputPath>bin\x64\Release\</OutputPath> <IntermediateOutputPath>obj\X64\$(Configuration)\</IntermediateOutputPath> - <DefineConstants>Debug;FreeSWITCHConfFilesDir=..\..\..\..\conf;FreeSWITCHSoundFilesDir=..\..\..\..\x64\release\sounds;</DefineConstants> + <DefineConstants>Debug;FreeSWITCHConfFilesDir=..\..\..\..\..\conf;FreeSWITCHSoundFilesDir=..\..\..\..\..\x64\release\sounds;</DefineConstants> </PropertyGroup> <ItemGroup> <Compile Include="Fragments\FreeSWITCHConfFiles.wxs" /> @@ -39,7 +39,7 @@ <Compile Include="Product.wxs" /> </ItemGroup> <ItemGroup> - <ProjectReference Include="..\libs\broadvoice\src\libbroadvoice.2010.vcxproj"> + <ProjectReference Include="..\..\libs\broadvoice\src\libbroadvoice.2010.vcxproj"> <Name>libbroadvoice</Name> <Project>{cf70f278-3364-4395-a2e1-23501c9b8ad2}</Project> <Private>True</Private> @@ -48,7 +48,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>INSTALLLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\libs\libteletone\libteletone.2010.vcxproj"> + <ProjectReference Include="..\..\libs\libteletone\libteletone.2010.vcxproj"> <Name>libteletone</Name> <Project>{89385c74-5860-4174-9caf-a39e7c48909c}</Project> <Private>True</Private> @@ -57,7 +57,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>INSTALLLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\libs\spandsp\src\libspandsp.2010.vcxproj"> + <ProjectReference Include="..\..\libs\spandsp\src\libspandsp.2010.vcxproj"> <Name>libspandsp</Name> <Project>{1cbb0077-18c5-455f-801c-0a0ce7b0bbf5}</Project> <Private>True</Private> @@ -66,7 +66,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>INSTALLLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\libs\win32\apr-util\libaprutil.2010.vcxproj"> + <ProjectReference Include="..\..\libs\win32\apr-util\libaprutil.2010.vcxproj"> <Name>libaprutil</Name> <Project>{f057da7f-79e5-4b00-845c-ef446ef055e3}</Project> <Private>True</Private> @@ -75,7 +75,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>INSTALLLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\libs\win32\apr\libapr.2010.vcxproj"> + <ProjectReference Include="..\..\libs\win32\apr\libapr.2010.vcxproj"> <Name>libapr</Name> <Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project> <Private>True</Private> @@ -84,7 +84,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>INSTALLLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\libs\win32\js\js.2010.vcxproj"> + <ProjectReference Include="..\..\libs\win32\js\js.2010.vcxproj"> <Name>js</Name> <Project>{204fa0de-305d-4414-ae2e-f195a23f390d}</Project> <Private>True</Private> @@ -93,7 +93,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>INSTALLLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\libs\win32\openssl\libeay32.2010.vcxproj"> + <ProjectReference Include="..\..\libs\win32\openssl\libeay32.2010.vcxproj"> <Name>libeay32</Name> <Project>{d331904d-a00a-4694-a5a3-fcff64ab5dbe}</Project> <Private>True</Private> @@ -102,7 +102,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>INSTALLLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\libs\win32\openssl\openssl.2010.vcxproj"> + <ProjectReference Include="..\..\libs\win32\openssl\openssl.2010.vcxproj"> <Name>openssl __Libraries\openssl\openssl_</Name> <Project>{25bd39b1-c8bf-4676-a738-9cabd9c6bc79}</Project> <Private>True</Private> @@ -111,7 +111,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>INSTALLLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\libs\win32\openssl\ssleay32.2010.vcxproj"> + <ProjectReference Include="..\..\libs\win32\openssl\ssleay32.2010.vcxproj"> <Name>ssleay32</Name> <Project>{b4b62169-5ad4-4559-8707-3d933ac5db39}</Project> <Private>True</Private> @@ -120,7 +120,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>INSTALLLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\libs\win32\pocketsphinx\pocketsphinx.2010.vcxproj"> + <ProjectReference Include="..\..\libs\win32\pocketsphinx\pocketsphinx.2010.vcxproj"> <Name>pocketsphinx</Name> <Project>{94001a0e-a837-445c-8004-f918f10d0226}</Project> <Private>True</Private> @@ -129,7 +129,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>INSTALLLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\libs\win32\sphinxbase\sphinxbase.2010.vcxproj"> + <ProjectReference Include="..\..\libs\win32\sphinxbase\sphinxbase.2010.vcxproj"> <Name>sphinxbase</Name> <Project>{2f025ead-99bd-40f5-b2cc-f0a28cad7f2d}</Project> <Private>True</Private> @@ -138,7 +138,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>INSTALLLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\applications\mod_avmd\mod_avmd.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\applications\mod_avmd\mod_avmd.2010.vcxproj"> <Name>mod_avmd</Name> <Project>{990baa76-89d3-4e38-8479-c7b28784efc8}</Project> <Private>True</Private> @@ -147,7 +147,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\applications\mod_commands\mod_commands.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\applications\mod_commands\mod_commands.2010.vcxproj"> <Name>mod_commands</Name> <Project>{30a5b29c-983e-4580-9fd0-d647ccdcc7eb}</Project> <Private>True</Private> @@ -156,7 +156,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\applications\mod_conference\mod_conference.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\applications\mod_conference\mod_conference.2010.vcxproj"> <Name>mod_conference</Name> <Project>{c24fb505-05d7-4319-8485-7540b44c8603}</Project> <Private>True</Private> @@ -165,7 +165,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\applications\mod_curl\mod_curl.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\applications\mod_curl\mod_curl.2010.vcxproj"> <Name>mod_curl</Name> <Project>{ef300386-a8df-4372-b6d8-fb9bffca9aed}</Project> <Private>True</Private> @@ -174,7 +174,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\applications\mod_db\mod_db.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\applications\mod_db\mod_db.2010.vcxproj"> <Name>mod_db</Name> <Project>{f6a33240-8f29-48bd-98f0-826995911799}</Project> <Private>True</Private> @@ -183,7 +183,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\applications\mod_dptools\mod_dptools.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\applications\mod_dptools\mod_dptools.2010.vcxproj"> <Name>mod_dptools</Name> <Project>{b5881a85-fe70-4f64-8607-2caae52669c6}</Project> <Private>True</Private> @@ -192,7 +192,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\applications\mod_enum\mod_enum.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\applications\mod_enum\mod_enum.2010.vcxproj"> <Name>mod_enum</Name> <Project>{71a967d5-0e99-4cef-a587-98836ee6f2ef}</Project> <Private>True</Private> @@ -201,7 +201,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\applications\mod_esf\mod_esf.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\applications\mod_esf\mod_esf.2010.vcxproj"> <Name>mod_esf</Name> <Project>{3850d93a-5f24-4922-bc1c-74d08c37c256}</Project> <Private>True</Private> @@ -210,7 +210,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\applications\mod_expr\mod_expr.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\applications\mod_expr\mod_expr.2010.vcxproj"> <Name>mod_expr</Name> <Project>{65a6273d-fcab-4c55-b09e-65100141a5d4}</Project> <Private>True</Private> @@ -219,7 +219,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\applications\mod_fifo\mod_fifo.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\applications\mod_fifo\mod_fifo.2010.vcxproj"> <Name>mod_fifo</Name> <Project>{75df7f29-2fbf-47f7-b5af-5b4952dc1abd}</Project> <Private>True</Private> @@ -228,7 +228,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\applications\mod_fsv\mod_fsv.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\applications\mod_fsv\mod_fsv.2010.vcxproj"> <Name>mod_fsv</Name> <Project>{e3246d17-e29b-4ab5-962a-c69b0c5837bb}</Project> <Private>True</Private> @@ -237,7 +237,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\applications\mod_lcr\mod_lcr.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\applications\mod_lcr\mod_lcr.2010.vcxproj"> <Name>mod_lcr</Name> <Project>{1a3793d1-05d1-4b57-9b0f-5af3e79dc439}</Project> <Private>True</Private> @@ -246,7 +246,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\applications\mod_nibblebill\mod_nibblebill.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\applications\mod_nibblebill\mod_nibblebill.2010.vcxproj"> <Name>mod_nibblebill</Name> <Project>{3c977801-fe88-48f2-83d3-fa2ebff6688e}</Project> <Private>True</Private> @@ -255,7 +255,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\applications\mod_rss\mod_rss.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\applications\mod_rss\mod_rss.2010.vcxproj"> <Name>mod_rss</Name> <Project>{b69247fa-ecd6-40ed-8e44-5ca6c3baf9a4}</Project> <Private>True</Private> @@ -264,7 +264,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\applications\mod_snom\mod_snom.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\applications\mod_snom\mod_snom.2010.vcxproj"> <Name>mod_snom</Name> <Project>{2a3d00c6-588d-4e86-81ac-9ef5ede86e03}</Project> <Private>True</Private> @@ -273,7 +273,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\applications\mod_spandsp\mod_spandsp.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\applications\mod_spandsp\mod_spandsp.2010.vcxproj"> <Name>mod_spandsp</Name> <Project>{1e21afe0-6fdb-41d2-942d-863607c24b91}</Project> <Private>True</Private> @@ -282,7 +282,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\applications\mod_valet_parking\mod_valet_parking.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\applications\mod_valet_parking\mod_valet_parking.2010.vcxproj"> <Name>mod_valet_parking</Name> <Project>{432db165-1eb2-4781-a9c0-71e62610b20a}</Project> <Private>True</Private> @@ -291,7 +291,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\applications\mod_vmd\mod_vmd.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\applications\mod_vmd\mod_vmd.2010.vcxproj"> <Name>mod_vmd</Name> <Project>{14e4a972-9cfb-436d-b0a5-4943f3f80d47}</Project> <Private>True</Private> @@ -300,7 +300,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\applications\mod_voicemail\mod_voicemail.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\applications\mod_voicemail\mod_voicemail.2010.vcxproj"> <Name>mod_voicemail</Name> <Project>{d7f1e3f2-a3f4-474c-8555-15122571af52}</Project> <Private>True</Private> @@ -309,7 +309,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\asr_tts\mod_pocketsphinx\mod_pocketsphinx.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\asr_tts\mod_pocketsphinx\mod_pocketsphinx.2010.vcxproj"> <Name>mod_pocketsphinx</Name> <Project>{2286da73-9fc5-45bc-a508-85994c3317ab}</Project> <Private>True</Private> @@ -318,7 +318,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\asr_tts\mod_unimrcp\mod_unimrcp.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\asr_tts\mod_unimrcp\mod_unimrcp.2010.vcxproj"> <Name>mod_unimrcp</Name> <Project>{d07c378a-f5f7-438f-adf3-4ac4fb1883cd}</Project> <Private>True</Private> @@ -327,7 +327,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\codecs\mod_amr\mod_amr.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\codecs\mod_amr\mod_amr.2010.vcxproj"> <Name>mod_amr</Name> <Project>{8deb383c-4091-4f42-a56f-c9e46d552d79}</Project> <Private>True</Private> @@ -336,7 +336,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\codecs\mod_celt\mod_celt.vcxproj"> + <ProjectReference Include="..\..\src\mod\codecs\mod_celt\mod_celt.vcxproj"> <Name>mod_celt</Name> <Project>{4d418176-3b33-47e6-a63e-01ba34add21c}</Project> <Private>True</Private> @@ -345,7 +345,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\codecs\mod_g723_1\mod_g723_1.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\codecs\mod_g723_1\mod_g723_1.2010.vcxproj"> <Name>mod_g723_1</Name> <Project>{fea1eef7-876f-48de-88bf-c0e3e606d758}</Project> <Private>True</Private> @@ -354,7 +354,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\codecs\mod_g729\mod_g729.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\codecs\mod_g729\mod_g729.2010.vcxproj"> <Name>mod_g729</Name> <Project>{1d95cd95-0de2-48c3-ac23-d5c7d1c9c0f0}</Project> <Private>True</Private> @@ -363,7 +363,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\codecs\mod_ilbc\mod_ilbc.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\codecs\mod_ilbc\mod_ilbc.2010.vcxproj"> <Name>mod_ilbc</Name> <Project>{d3ec0aff-76fc-4210-a825-9a17410660a3}</Project> <Private>True</Private> @@ -372,7 +372,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\codecs\mod_silk\mod_silk.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\codecs\mod_silk\mod_silk.2010.vcxproj"> <Name>mod_silk</Name> <Project>{afa983d6-4569-4f88-ba94-555ed00fd9a8}</Project> <Private>True</Private> @@ -381,7 +381,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\codecs\mod_siren\mod_siren.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\codecs\mod_siren\mod_siren.2010.vcxproj"> <Name>mod_siren</Name> <Project>{0b6c905b-142e-4999-b39d-92ff7951e921}</Project> <Private>True</Private> @@ -390,7 +390,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\codecs\mod_speex\mod_speex.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\codecs\mod_speex\mod_speex.2010.vcxproj"> <Name>mod_speex</Name> <Project>{5580d60e-0f77-4716-9cd4-b8e5986fa375}</Project> <Private>True</Private> @@ -399,7 +399,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\dialplans\mod_dialplan_directory\mod_dialplan_directory.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\dialplans\mod_dialplan_directory\mod_dialplan_directory.2010.vcxproj"> <Name>mod_dialplan_directory</Name> <Project>{a27cca23-1541-4337-81a4-f0a6413078a0}</Project> <Private>True</Private> @@ -408,7 +408,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\dialplans\mod_dialplan_xml\mod_dialplan_xml.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\dialplans\mod_dialplan_xml\mod_dialplan_xml.2010.vcxproj"> <Name>mod_dialplan_xml</Name> <Project>{07113b25-d3af-4e04-ba77-4cd1171f022c}</Project> <Private>True</Private> @@ -417,7 +417,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\endpoints\mod_loopback\mod_loopback.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\endpoints\mod_loopback\mod_loopback.2010.vcxproj"> <Name>mod_loopback</Name> <Project>{b3f424ec-3d8f-417c-b244-3919d5e1a577}</Project> <Private>True</Private> @@ -426,7 +426,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\endpoints\mod_portaudio\mod_PortAudio.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\endpoints\mod_portaudio\mod_PortAudio.2010.vcxproj"> <Name>mod_PortAudio</Name> <Project>{5fd31a25-5d83-4794-8bee-904dad84ce71}</Project> <Private>True</Private> @@ -435,7 +435,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\endpoints\mod_sofia\mod_sofia.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\endpoints\mod_sofia\mod_sofia.2010.vcxproj"> <Name>mod_sofia</Name> <Project>{0df3abd0-ddc0-4265-b778-07c66780979b}</Project> <Private>True</Private> @@ -444,7 +444,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\event_handlers\mod_event_multicast\mod_event_multicast.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\event_handlers\mod_event_multicast\mod_event_multicast.2010.vcxproj"> <Name>mod_event_multicast</Name> <Project>{784113ef-44d9-4949-835d-7065d3c7ad08}</Project> <Private>True</Private> @@ -453,7 +453,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\event_handlers\mod_event_socket\mod_event_socket.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\event_handlers\mod_event_socket\mod_event_socket.2010.vcxproj"> <Name>mod_event_socket</Name> <Project>{05515420-16de-4e63-be73-85be85ba5142}</Project> <Private>True</Private> @@ -462,7 +462,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\formats\mod_file_string\mod_file_string.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\formats\mod_file_string\mod_file_string.2010.vcxproj"> <Name>mod_file_string</Name> <Project>{70564d74-199a-4452-9c60-19ed5f242f0d}</Project> <Private>True</Private> @@ -471,7 +471,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\formats\mod_local_stream\mod_local_stream.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\formats\mod_local_stream\mod_local_stream.2010.vcxproj"> <Name>mod_local_stream</Name> <Project>{2ca40887-1622-46a1-a7f9-17fd7e7e545b}</Project> <Private>True</Private> @@ -480,7 +480,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\formats\mod_native_file\mod_native_file.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\formats\mod_native_file\mod_native_file.2010.vcxproj"> <Name>mod_native_file</Name> <Project>{9254c4b0-6f60-42b6-bb3a-36d63fc001c7}</Project> <Private>True</Private> @@ -489,7 +489,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\formats\mod_sndfile\mod_sndfile.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\formats\mod_sndfile\mod_sndfile.2010.vcxproj"> <Name>mod_sndfile</Name> <Project>{afac0568-7548-42d5-9f6a-8d3400a1e4f6}</Project> <Private>True</Private> @@ -498,7 +498,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\formats\mod_tone_stream\mod_tone_stream.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\formats\mod_tone_stream\mod_tone_stream.2010.vcxproj"> <Name>mod_tone_stream</Name> <Project>{6ff941ac-82c5-429f-aa4c-ad2fb9e5da52}</Project> <Private>True</Private> @@ -507,7 +507,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\languages\mod_lua\lua\lua.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\languages\mod_lua\lua\lua.2010.vcxproj"> <Name>lua51</Name> <Project>{d0b36172-cd76-454a-9b89-990025266c2a}</Project> <Private>True</Private> @@ -516,7 +516,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>INSTALLLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\languages\mod_lua\mod_lua.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\languages\mod_lua\mod_lua.2010.vcxproj"> <Name>mod_lua</Name> <Project>{7b077e7f-1be7-4291-ab86-55e527b25cac}</Project> <Private>True</Private> @@ -525,7 +525,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\languages\mod_managed\mod_managed.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\languages\mod_managed\mod_managed.2010.vcxproj"> <Name>mod_managed</Name> <Project>{7b42bda1-72c0-4378-a9b6-5c530f8cd61e}</Project> <Private>True</Private> @@ -534,7 +534,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\loggers\mod_console\mod_console.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\loggers\mod_console\mod_console.2010.vcxproj"> <Name>mod_console</Name> <Project>{1c453396-d912-4213-89fd-9b489162b7b5}</Project> <Private>True</Private> @@ -543,7 +543,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\loggers\mod_logfile\mod_logfile.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\loggers\mod_logfile\mod_logfile.2010.vcxproj"> <Name>mod_logfile</Name> <Project>{d0bcac02-d94b-46b8-9b49-cddcc2bd7909}</Project> <Private>True</Private> @@ -552,7 +552,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\say\mod_say_de\mod_say_de.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\say\mod_say_de\mod_say_de.2010.vcxproj"> <Name>mod_say_de</Name> <Project>{5bc072db-3826-48ea-af34-fe32aa01e83b}</Project> <Private>True</Private> @@ -561,7 +561,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\say\mod_say_en\mod_say_en.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\say\mod_say_en\mod_say_en.2010.vcxproj"> <Name>mod_say_en</Name> <Project>{988cacf7-3fcb-4992-be69-77872ae67dc8}</Project> <Private>True</Private> @@ -570,7 +570,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\say\mod_say_es\mod_say_es.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\say\mod_say_es\mod_say_es.2010.vcxproj"> <Name>mod_say_es</Name> <Project>{fa429e98-8b03-45e6-a096-a4bc5e821de4}</Project> <Private>True</Private> @@ -579,7 +579,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\say\mod_say_fr\mod_say_fr.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\say\mod_say_fr\mod_say_fr.2010.vcxproj"> <Name>mod_say_fr</Name> <Project>{06e3a538-ab32-44f2-b477-755ff9cb5d37}</Project> <Private>True</Private> @@ -588,7 +588,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\say\mod_say_it\mod_say_it.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\say\mod_say_it\mod_say_it.2010.vcxproj"> <Name>mod_say_it</Name> <Project>{6d1bec70-4dcd-4fe9-adbd-4a43a67e4d05}</Project> <Private>True</Private> @@ -597,7 +597,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\say\mod_say_nl\mod_say_nl.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\say\mod_say_nl\mod_say_nl.2010.vcxproj"> <Name>mod_say_nl</Name> <Project>{a4b122cf-5196-476b-8c0e-d8bd59ac3c14}</Project> <Private>True</Private> @@ -606,7 +606,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\say\mod_say_ru\mod_say_ru.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\say\mod_say_ru\mod_say_ru.2010.vcxproj"> <Name>mod_say_ru</Name> <Project>{0382e8fd-cfdc-41c0-8b03-792c7c84fc31}</Project> <Private>True</Private> @@ -615,7 +615,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\say\mod_say_zh\mod_say_zh.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\say\mod_say_zh\mod_say_zh.2010.vcxproj"> <Name>mod_say_zh</Name> <Project>{b6a9fb7a-1cc4-442b-812d-ec33e4e4a36e}</Project> <Private>True</Private> @@ -624,7 +624,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\xml_int\mod_xml_cdr\mod_xml_cdr.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\xml_int\mod_xml_cdr\mod_xml_cdr.2010.vcxproj"> <Name>mod_xml_cdr</Name> <Project>{08dad348-9e0a-4a2e-97f1-f1e7e24a7836}</Project> <Private>True</Private> @@ -633,7 +633,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\xml_int\mod_xml_curl\mod_xml_curl.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\xml_int\mod_xml_curl\mod_xml_curl.2010.vcxproj"> <Name>mod_xml_curl</Name> <Project>{ab91a099-7690-4ecf-8994-e458f4ea1ed4}</Project> <Private>True</Private> @@ -642,7 +642,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\src\mod\xml_int\mod_xml_rpc\mod_xml_rpc.2010.vcxproj"> + <ProjectReference Include="..\..\src\mod\xml_int\mod_xml_rpc\mod_xml_rpc.2010.vcxproj"> <Name>mod_xml_rpc</Name> <Project>{cbec7225-0c21-4da8-978e-1f158f8ad950}</Project> <Private>True</Private> @@ -651,7 +651,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>MODLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\w32\Console\FreeSwitchConsole.2010.vcxproj"> + <ProjectReference Include="..\..\w32\Console\FreeSwitchConsole.2010.vcxproj"> <Name>FreeSwitchConsole</Name> <Project>{1af3a893-f7be-43dd-b697-8ab2397c0d67}</Project> <Private>True</Private> @@ -660,7 +660,7 @@ <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> <RefTargetDir>INSTALLLOCATION</RefTargetDir> </ProjectReference> - <ProjectReference Include="..\w32\Library\FreeSwitchCore.2010.vcxproj"> + <ProjectReference Include="..\..\w32\Library\FreeSwitchCore.2010.vcxproj"> <Name>FreeSwitchCoreLib</Name> <Project>{202d7a4e-760d-4d0e-afa1-d7459ced30ff}</Project> <Private>True</Private> @@ -681,8 +681,8 @@ </ItemGroup> <Import Project="$(WixTargetsPath)" /> <PropertyGroup> - <PreBuildEvent>"$(WIX)bin\heat.exe" dir "..\..\..\..\conf" -cg FreeSWITCHConfFiles -gg -scom -sreg -sfrag -srd -dr CONFLOCATION -var var.FreeSWITCHConfFilesDir -out "$(ProjectDir)Fragments\FreeSWITCHConfFiles.wxs" -"$(WIX)bin\heat.exe" dir "..\..\..\..\Win32\Release\sounds" -cg FreeSWITCHSoundFiles8 -gg -scom -sreg -sfrag -srd -dr SOUNDLOCATION -var var.FreeSWITCHSoundFilesDir -out "$(ProjectDir)Fragments\FreeSWITCHSoundFiles8.wxs"</PreBuildEvent> + <PreBuildEvent>"$(WIX)bin\heat.exe" dir "..\..\..\..\..\conf" -cg FreeSWITCHConfFiles -gg -scom -sreg -sfrag -srd -dr CONFLOCATION -var var.FreeSWITCHConfFilesDir -out "$(ProjectDir)Fragments\FreeSWITCHConfFiles.wxs" +"$(WIX)bin\heat.exe" dir "..\..\..\..\..\Win32\Release\sounds" -cg FreeSWITCHSoundFiles8 -gg -scom -sreg -sfrag -srd -dr SOUNDLOCATION -var var.FreeSWITCHSoundFilesDir -out "$(ProjectDir)Fragments\FreeSWITCHSoundFiles8.wxs"</PreBuildEvent> </PropertyGroup> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. commit df5b3498ed0fe9d8f0bbdfcff15daf0544dbf153 Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Thu Oct 14 22:36:51 2010 -0400 mod_voicemail: FS-1776 Add support for per user operator exten override param vm-operator-extension diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 758e5dc..b2796be 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -2893,6 +2893,7 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p char *read_flags = NORMAL_FLAG_STRING; int priority = 3; int email_attach = 1; + char *operator_ext = NULL; char buf[2]; char key_buf[80]; char *greet_path = NULL; @@ -2973,6 +2974,8 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p vm_enabled = !switch_false(val); } else if (!strcasecmp(var, "vm-message-ext")) { vm_ext = switch_core_session_strdup(session, val); + } else if (!strcasecmp(var, "vm-operator-extension")) { + operator_ext = switch_core_session_strdup(session, val); } } } @@ -3089,12 +3092,13 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p greet_key_press: if (switch_stristr(buf, profile->login_keys)) { voicemail_check_main(session, profile, domain_name, id, 0); - } else if (!zstr(profile->operator_ext) && !zstr(profile->operator_key) && !strcasecmp(buf, profile->operator_key) ) { + } else if ((!zstr(profile->operator_ext) || !zstr(operator_ext)) && !zstr(profile->operator_key) && !strcasecmp(buf, profile->operator_key) ) { int argc; char *argv[4]; char *mycmd; - if (!zstr(profile->operator_ext) && (mycmd = switch_core_session_strdup(session, profile->operator_ext))) { + if ((!zstr(operator_ext) && (mycmd = switch_core_session_strdup(session, operator_ext))) || + (!zstr(profile->operator_ext) && (mycmd = switch_core_session_strdup(session, profile->operator_ext)))) { argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); if (argc >= 1 && argc <= 4) { switch_ivr_session_transfer(session, argv[0], argv[1], argv[2]); commit 484e0abe7a02e604efba883a8482762e548cd045 Merge: fe9921c f6bcf83 Author: Michal Bielicki <cypromis@debian-buildtesst> Date: Fri Oct 15 04:17:34 2010 +0200 Merge branch 'master' of git@git.freeswitch.org:freeswitch commit fe9921c9b0371d7836624c14779b3f9f67d76847 Author: Michal Bielicki <cypromis@debian-buildtesst> Date: Fri Oct 15 04:17:27 2010 +0200 unimrcp does not build on debian, will have to further analyse diff --git a/debian/freeswitch.conffiles b/debian/freeswitch.conffiles index 1d2cd26..20da33d 100644 --- a/debian/freeswitch.conffiles +++ b/debian/freeswitch.conffiles @@ -92,7 +92,6 @@ /opt/freeswitch/conf/sip_profiles/internal.xml /opt/freeswitch/conf/skinny_profiles/internal.xml /opt/freeswitch/conf/tetris.ttml -/opt/freeswitch/conf/tones.conf /opt/freeswitch/conf/vars.xml /opt/freeswitch/conf/voicemail.tpl /opt/freeswitch/conf/web-vm.tpl diff --git a/debian/freeswitch.install b/debian/freeswitch.install index f0c6fa8..4462b71 100644 --- a/debian/freeswitch.install +++ b/debian/freeswitch.install @@ -164,7 +164,6 @@ opt/freeswitch/mod/mod_syslog.so* opt/freeswitch/mod/mod_theora.so* opt/freeswitch/mod/mod_tone_stream.so* opt/freeswitch/mod/mod_tts_commandline.so* -opt/freeswitch/mod/mod_unimrcp.so* opt/freeswitch/mod/mod_valet_parking.so* opt/freeswitch/mod/mod_vmd.so* opt/freeswitch/mod/mod_voicemail.so* diff --git a/debian/rules b/debian/rules index 0e5f4a3..c771904 100755 --- a/debian/rules +++ b/debian/rules @@ -19,13 +19,12 @@ export APPLICATION_MODULES_NY= applications/mod_nibblebill applications/mod_redi applications/mod_valet_parking applications/mod_vmd applications/mod_voicemail export APPLICATIONS_MODULES= $(APPLICATION_MODULES_AE) $(APPLICATION_MODULES_FM) $(APPLICATION_MODULES_NY) $(APPLICATION_MODULES_VZ) -export ASR_TTS_MODULES= asr_tts/mod_pocketsphinx asr_tts/mod_unimrcp +export ASR_TTS_MODULES= asr_tts/mod_pocketsphinx export CODECS_MODULES= codecs/mod_bv codecs/mod_h26x codecs/mod_speex codecs/mod_celt codecs/mod_codec2 codecs/mod_ilbc codecs/mod_mp4v \ codecs/mod_silk codecs/mod_siren codecs/mod_theora export DIALPLANS_MODULES= dialplans/mod_dialplan_asterisk dialplans/mod_dialplan_directory dialplans/mod_dialplan_xml -export ENDPOINTS_MODULES= endpoints/mod_dingaling endpoints/mod_portaudio endpoints/mod_sofia \ - endpoints/mod_loopback ../../libs/freetdm/mod_freetdm endpoints/mod_skypopen \ - endpoints/mod_skinny +export ENDPOINTS_MODULES= endpoints/mod_dingaling endpoints/mod_portaudio endpoints/mod_sofia endpoints/mod_loopback \ + ../../libs/freetdm/mod_freetdm endpoints/mod_skypopen endpoints/mod_skinny export EVENT_HANDLERS_MODULES=event_handlers/mod_event_multicast event_handlers/mod_event_socket event_handlers/mod_cdr_csv export FORMATS_MODULES= formats/mod_file_string formats/mod_local_stream formats/mod_native_file formats/mod_portaudio_stream \ formats/mod_shout formats/mod_sndfile formats/mod_tone_stream @@ -33,7 +32,7 @@ export LANGUAGES_MODULES=languages/mod_spidermonkey languages/mod_perl languages export LOGGERS_MODULES=loggers/mod_console loggers/mod_logfile loggers/mod_syslog export SAY_MODULES=say/mod_say_en say/mod_say_it say/mod_say_de say/mod_say_fr say/mod_say_es say/mod_say_nl say/mod_say_ru export XML_INT_MODULES=xml_int/mod_xml_rpc xml_int/mod_xml_curl xml_int/mod_xml_cdr -export MYMODULES=$(PASSTHRU_CODEC_MODULES) $(APPLICATIONS_MODULES) $(ASR_TTS_MODULES) $(CODECS_MODULES) $(DIALPLANS_MODULES) $(ENDPOINTS_MODULES) $(EVENT_HANDLERS_MODULES) $(FORMATS_MODULES) $(LANGUAGES_MODULES) $(LOGGERS_MODULES) $(SAY_MODULES) $(XML_INT_MODULES) +export MYMODULES= $(ENDPOINTS_MODULES) $(PASSTHRU_CODEC_MODULES) $(APPLICATIONS_MODULES) $(ASR_TTS_MODULES) $(CODECS_MODULES) $(DIALPLANS_MODULES) $(EVENT_HANDLERS_MODULES) $(FORMATS_MODULES) $(LANGUAGES_MODULES) $(LOGGERS_MODULES) $(SAY_MODULES) $(XML_INT_MODULES) export MODULES=$(MYMODULES) ifndef AUTOCONF commit f6bcf830112e9778a2b79471810e7fc3fbf3dad6 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Oct 14 20:56:19 2010 -0500 expand vars in data element diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index b9127c9..4cbb052 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -112,7 +112,8 @@ struct caller_control_actions; typedef struct caller_control_actions { char *binded_dtmf; - void *data; + char *data; + char *expanded_data; } caller_control_action_t; typedef struct caller_control_menu_info { @@ -1790,7 +1791,7 @@ static void conference_loop_fn_event(conference_member_t *member, caller_control conference_add_event_member_data(member, event); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "dtmf"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "DTMF-Key", action->binded_dtmf); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Data", action->data); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Data", action->expanded_data); switch_event_fire(&event); } } @@ -1809,12 +1810,12 @@ static void conference_loop_fn_transfer(conference_member_t *member, caller_cont if (test_eflag(member->conference, EFLAG_DTMF) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) { conference_add_event_member_data(member, event); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "transfer"); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Dialplan", action->data); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Dialplan", action->expanded_data); switch_event_fire(&event); } switch_clear_flag_locked(member, MFLAG_RUNNING); - if ((mydata = switch_core_session_strdup(member->session, action->data))) { + if ((mydata = switch_core_session_strdup(member->session, action->expanded_data))) { if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) { if (argc > 0) { exten = argv[0]; @@ -1827,7 +1828,7 @@ static void conference_loop_fn_transfer(conference_member_t *member, caller_cont } } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_ERROR, "Empty transfer string [%s]\n", (char *) action->data); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_ERROR, "Empty transfer string [%s]\n", (char *) action->expanded_data); goto done; } } else { @@ -1853,14 +1854,16 @@ static void conference_loop_fn_exec_app(conference_member_t *member, caller_cont switch_event_t *event = NULL; switch_channel_t *channel = NULL; + if (!action->expanded_data) return; + if (test_eflag(member->conference, EFLAG_DTMF) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) { conference_add_event_member_data(member, event); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "execute_app"); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application", action->data); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application", action->expanded_data); switch_event_fire(&event); } - if ((mydata = switch_core_session_strdup(member->session, action->data))) { + if ((mydata = switch_core_session_strdup(member->session, action->expanded_data))) { if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) { if (argc > 0) { app = argv[0]; @@ -1870,7 +1873,8 @@ static void conference_loop_fn_exec_app(conference_member_t *member, caller_cont } } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_ERROR, "Empty execute app string [%s]\n", (char *) action->data); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_ERROR, "Empty execute app string [%s]\n", + (char *) action->expanded_data); goto done; } } else { @@ -1882,6 +1886,7 @@ static void conference_loop_fn_exec_app(conference_member_t *member, caller_cont switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_ERROR, "Unable to find application.\n"); goto done; } + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_DEBUG, "Execute app: %s, %s\n", app, arg); channel = switch_core_session_get_channel(member->session); @@ -1892,6 +1897,7 @@ static void conference_loop_fn_exec_app(conference_member_t *member, caller_cont switch_core_session_set_read_codec(member->session, &member->read_codec); switch_channel_clear_app_flag(channel, CF_APP_TAGGED); done: + return; } @@ -6372,16 +6378,30 @@ typedef struct { static switch_status_t dmachine_dispatcher(switch_ivr_dmachine_match_t *match) { key_binding_t *binding = match->user_data; + switch_channel_t *channel; if (!binding) return SWITCH_STATUS_FALSE; + channel = switch_core_session_get_channel(binding->member->session); + switch_channel_set_variable(channel, "conference_last_matching_digits", match->match_digits); + + if (binding->action.data) { + binding->action.expanded_data = switch_channel_expand_variables(channel, binding->action.data); + } + binding->handler(binding->member, &binding->action); + + if (binding->action.expanded_data != binding->action.data) { + free(binding->action.expanded_data); + binding->action.expanded_data = NULL; + } + switch_set_flag_locked(binding->member, MFLAG_FLUSH_BUFFER); return SWITCH_STATUS_SUCCESS; } -static void do_binding(conference_member_t *member, conf_key_callback_t handler, const char *digits, void *data) +static void do_binding(conference_member_t *member, conf_key_callback_t handler, const char *digits, const char *data) { key_binding_t *binding; @@ -6391,7 +6411,7 @@ static void do_binding(conference_member_t *member, conf_key_callback_t handler, binding->action.binded_dtmf = switch_core_strdup(member->pool, digits); if (data) { - binding->action.data = switch_core_strdup(member->pool, (char *)data); + binding->action.data = switch_core_strdup(member->pool, data); } binding->handler = handler; @@ -6465,7 +6485,7 @@ static void member_bind_controls(conference_member_t *member, const char *contro switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s binding '%s' to '%s'\n", switch_core_session_get_name(member->session), digits, key); - do_binding(member, control_mappings[i].handler, digits, (void *) data); + do_binding(member, control_mappings[i].handler, digits, data); } } } commit 4d5389bd94438b4cdd3bd2389804a79dd9bfcc79 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Oct 14 20:07:26 2010 -0500 FS-2781 diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index fef059c..b9127c9 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -682,7 +682,7 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe conference_stop_file(conference, FILE_STOP_ASYNC); } - if (!switch_channel_test_app_flag_key("conf_silent", channel, CONF_SILENT_REQ)) { + if (!switch_channel_test_app_flag_key("conf_silent", channel, CONF_SILENT_REQ) && !zstr(conference->enter_sound)) { conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), switch_test_flag(conference, CFLAG_WAIT_MOD) ? 0 : 1); } @@ -2868,6 +2868,10 @@ static switch_status_t conference_play_file(conference_obj_t *conference, char * switch_assert(conference != NULL); + if (zstr(file)) { + return SWITCH_STATUS_NOTFOUND; + } + switch_mutex_lock(conference->mutex); switch_mutex_lock(conference->member_mutex); count = conference->count; commit ac19f73cc4c965413821b0432bdff5e908e0593f Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Oct 14 18:58:28 2010 -0500 refactor conference to use switch_ivr_dmachine for the digit parsing controls are now bound to each member separately based on conference_controls channel var, then the caller-controls param in the profile or a default to "default" please test and report any issues in jira http://jira.freeswitch.org diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 31d2158..fef059c 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -97,29 +97,6 @@ static struct { switch_event_node_t *node; } globals; -typedef enum { - CALLER_CONTROL_MUTE, - CALLER_CONTROL_MUTE_ON, - CALLER_CONTROL_MUTE_OFF, - CALLER_CONTROL_DEAF_MUTE, - CALLER_CONTROL_ENERGY_UP, - CALLER_CONTROL_ENERGY_EQU_CONF, - CALLER_CONTROL_ENERGY_DN, - CALLER_CONTROL_VOL_TALK_UP, - CALLER_CONTROL_VOL_TALK_ZERO, - CALLER_CONTROL_VOL_TALK_DN, - CALLER_CONTROL_VOL_LISTEN_UP, - CALLER_CONTROL_VOL_LISTEN_ZERO, - CALLER_CONTROL_VOL_LISTEN_DN, - CALLER_CONTROL_HANGUP, - CALLER_CONTROL_MENU, - CALLER_CONTROL_DIAL, - CALLER_CONTROL_EVENT, - CALLER_CONTROL_LOCK, - CALLER_CONTROL_TRANSFER, - CALLER_CONTROL_EXEC_APP -} caller_control_t; - /* forward declaration for conference_obj and caller_control */ struct conference_member; typedef struct conference_member conference_member_t; @@ -133,15 +110,7 @@ typedef struct call_list call_list_t; struct caller_control_actions; -typedef struct caller_control_fn_table { - char *key; - char *digits; - caller_control_t action; - void (*handler) (conference_member_t *, struct caller_control_actions *); -} caller_control_fn_table_t; - typedef struct caller_control_actions { - caller_control_fn_table_t *fndesc; char *binded_dtmf; void *data; } caller_control_action_t; @@ -271,12 +240,12 @@ typedef struct conference_obj { uint32_t max_members; char *maxmember_sound; uint32_t announce_count; - switch_ivr_digit_stream_parser_t *dtmf_parser; char *pin; char *pin_sound; char *bad_pin_sound; char *profile_name; char *domain; + char *caller_controls; uint32_t flags; member_flag_t mflags; switch_call_cause_t bridge_hangup_cause; @@ -362,8 +331,6 @@ struct conference_member { uint32_t resample_out_len; conference_file_node_t *fnode; conference_relationship_t *relationships; - switch_ivr_digit_stream_parser_t *dtmf_parser; - switch_ivr_digit_stream_t *digit_stream; switch_speech_handle_t lsh; switch_speech_handle_t *sh; uint32_t verbose_events; @@ -371,6 +338,7 @@ struct conference_member { uint32_t avg_itt; uint32_t avg_tally; struct conference_member *next; + switch_ivr_dmachine_t *dmachine; }; /* Record Node */ @@ -414,6 +382,7 @@ static void conference_send_all_dtmf(conference_member_t *member, conference_obj static switch_status_t conference_say(conference_obj_t *conference, const char *text, uint32_t leadin); static void conference_list(conference_obj_t *conference, switch_stream_handle_t *stream, char *delim); static conference_obj_t *conference_find(char *name); +static void member_bind_controls(conference_member_t *member, const char *controls); SWITCH_STANDARD_API(conf_api_main); @@ -656,6 +625,7 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe char msg[512]; /* conference count announcement */ call_list_t *call_list = NULL; switch_channel_t *channel; + const char *controls = NULL; switch_assert(conference != NULL); switch_assert(member != NULL); @@ -765,6 +735,24 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe } switch_channel_clear_app_flag_key("conf_silent", channel, CONF_SILENT_REQ); + + + switch_ivr_dmachine_create(&member->dmachine, "mod_conference", NULL, 500, 0, NULL, NULL, NULL); + + controls = switch_channel_get_variable(channel, "conference_controls"); + + if (zstr(controls)) { + controls = conference->caller_controls; + } + + if (zstr(controls)) { + controls = "default"; + } + + if (strcasecmp(controls, "none")) { + member_bind_controls(member, controls); + } + } unlock_member(member); switch_mutex_unlock(member->audio_out_mutex); @@ -795,6 +783,8 @@ static switch_status_t conference_del_member(conference_obj_t *conference, confe member->sh = NULL; unlock_member(member); + switch_ivr_dmachine_destroy(&member->dmachine); + switch_mutex_lock(conference->mutex); switch_mutex_lock(conference->member_mutex); switch_mutex_lock(member->audio_in_mutex); @@ -1462,8 +1452,6 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, v switch_thread_rwlock_unlock(conference->rwlock); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write Lock OFF\n"); - switch_ivr_digit_stream_parser_destroy(conference->dtmf_parser); - if (conference->sh) { switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE; switch_core_speech_close(&conference->lsh, &flags); @@ -1693,6 +1681,7 @@ static void conference_loop_fn_volume_talk_zero(conference_member_t *member, cal switch_snprintf(msg, sizeof(msg), "Volume level %d", member->volume_out_level); conference_member_say(member, msg, 0); + } static void conference_loop_fn_volume_talk_dn(conference_member_t *member, caller_control_action_t *action) @@ -2307,29 +2296,6 @@ static void launch_conference_loop_input(conference_member_t *member, switch_mem switch_thread_create(&thread, thd_attr, conference_loop_input, member, pool); } -static caller_control_fn_table_t ccfntbl[] = { - {"mute", "0", CALLER_CONTROL_MUTE, conference_loop_fn_mute_toggle}, - {"mute on", NULL, CALLER_CONTROL_MUTE_ON, conference_loop_fn_mute_on}, - {"mute off", NULL, CALLER_CONTROL_MUTE_OFF, conference_loop_fn_mute_off}, - {"deaf mute", "*", CALLER_CONTROL_DEAF_MUTE, conference_loop_fn_deafmute_toggle}, - {"energy up", "9", CALLER_CONTROL_ENERGY_UP, conference_loop_fn_energy_up}, - {"energy equ", "8", CALLER_CONTROL_ENERGY_EQU_CONF, conference_loop_fn_energy_equ_conf}, - {"energy dn", "7", CALLER_CONTROL_ENERGY_DN, conference_loop_fn_energy_dn}, - {"vol talk up", "3", CALLER_CONTROL_VOL_TALK_UP, conference_loop_fn_volume_talk_up}, - {"vol talk zero", "2", CALLER_CONTROL_VOL_TALK_ZERO, conference_loop_fn_volume_talk_zero}, - {"vol talk dn", "1", CALLER_CONTROL_VOL_TALK_DN, conference_loop_fn_volume_talk_dn}, - {"vol listen up", "6", CALLER_CONTROL_VOL_LISTEN_UP, conference_loop_fn_volume_listen_up}, - {"vol listen zero", "5", CALLER_CONTROL_VOL_LISTEN_ZERO, conference_loop_fn_volume_listen_zero}, - {"vol listen dn", "4", CALLER_CONTROL_VOL_LISTEN_DN, conference_loop_fn_volume_listen_dn}, - {"hangup", "#", CALLER_CONTROL_HANGUP, conference_loop_fn_hangup}, - {"event", NULL, CALLER_CONTROL_EVENT, conference_loop_fn_event}, - {"lock", NULL, CALLER_CONTROL_LOCK, conference_loop_fn_lock_toggle}, - {"transfer", NULL, CALLER_CONTROL_TRANSFER, conference_loop_fn_transfer}, - {"execute_application", NULL, CALLER_CONTROL_EXEC_APP, conference_loop_fn_exec_app} -}; - -#define CCFNTBL_QTY (sizeof(ccfntbl)/sizeof(ccfntbl[0])) - /* marshall frames from the conference (or file or tts output) to the call leg */ /* NB. this starts the input thread after some initial setup for the call leg */ static void conference_loop_output(conference_member_t *member) @@ -2400,13 +2366,6 @@ static void conference_loop_output(conference_member_t *member) /* Start the input thread */ launch_conference_loop_input(member, switch_core_session_get_pool(member->session)); - /* build a digit stream object */ - if (member->conference->dtmf_parser != NULL - && switch_ivr_digit_stream_new(member->conference->dtmf_parser, &member->digit_stream) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_ERROR, - "Danger Will Robinson, there is no digit parser stream object\n"); - } - if ((call_list = switch_channel_get_private(channel, "_conference_autocall_list_"))) { const char *cid_name = switch_channel_get_variable(channel, "conference_auto_outcall_caller_id_name"); const char *cid_num = switch_channel_get_variable(channel, "conference_auto_outcall_caller_id_number"); @@ -2457,9 +2416,7 @@ static void conference_loop_output(conference_member_t *member) while (switch_test_flag(member, MFLAG_RUNNING) && switch_test_flag(member, MFLAG_ITHREAD) && switch_channel_ready(channel)) { char dtmf[128] = ""; - char *digit; switch_event_t *event; - caller_control_action_t *caller_action = NULL; int use_timer = 0; switch_buffer_t *use_buffer = NULL; uint32_t mux_used = 0; @@ -2513,40 +2470,13 @@ static void conference_loop_output(conference_member_t *member) if (switch_test_flag(member, MFLAG_DIST_DTMF)) { conference_send_all_dtmf(member, member->conference, dtmf); - } else { - if (member->conference->dtmf_parser != NULL) { - for (digit = dtmf; *digit && caller_action == NULL; digit++) { - caller_action = (caller_control_action_t *) - switch_ivr_digit_stream_parser_feed(member->conference->dtmf_parser, member->digit_stream, *digit); - } - } + } else if (member->dmachine) { + switch_ivr_dmachine_feed(member->dmachine, dtmf, NULL); } - /* otherwise, clock the parser so that it can handle digit timeout detection */ - } else if (member->conference->dtmf_parser != NULL) { - caller_action = (caller_control_action_t *) switch_ivr_digit_stream_parser_feed(member->conference->dtmf_parser, member->digit_stream, '\0'); + } else if (member->dmachine) { + switch_ivr_dmachine_ping(member->dmachine, NULL); } - /* if a caller action has been detected, handle it */ - if (caller_action != NULL && caller_action->fndesc != NULL && caller_action->fndesc->handler != NULL) { - char *param = NULL; - - if (caller_action->fndesc->action != CALLER_CONTROL_MENU) { - param = caller_action->data; - } -#ifdef INTENSE_DEBUG - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), - SWITCH_LOG_INFO, - "executing caller control '%s' param '%s' on call '%u, %s\n", - caller_action->fndesc->key, param ? param : "none", member->id, switch_channel_get_name(channel)); -#endif - - caller_action->fndesc->handler(member, caller_action); - - /* set up for next pass */ - caller_action = NULL; - } - - use_buffer = NULL; mux_used = (uint32_t) switch_buffer_inuse(member->mux_buffer); @@ -2656,10 +2586,6 @@ static void conference_loop_output(conference_member_t *member) } /* Rinse ... Repeat */ - if (member->digit_stream != NULL) { - switch_ivr_digit_stream_destroy(&member->digit_stream); - } - switch_clear_flag_locked(member, MFLAG_RUNNING); switch_core_timer_destroy(&timer); @@ -4375,8 +4301,9 @@ static switch_status_t conf_api_sub_transfer(conference_obj_t *conference, switc if ((profiles = switch_xml_child(cfg, "profiles"))) { xml_cfg.profile = switch_xml_find_child(profiles, "profile", "name", profile_name); } - - xml_cfg.controls = switch_xml_child(cfg, "caller-controls"); + + /* Create the conference object. */ + new_conference = conference_new(conf_name, xml_cfg, pool); /* Release the config registry handle */ if (cxml) { @@ -4384,9 +4311,6 @@ static switch_status_t conf_api_sub_transfer(conference_obj_t *conference, switc cxml = NULL; } - /* Create the conference object. */ - new_conference = conference_new(conf_name, xml_cfg, pool); - if (!new_conference) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n"); if (pool != NULL) { @@ -5455,8 +5379,6 @@ SWITCH_STANDARD_APP(conference_function) xml_cfg.profile = switch_xml_find_child(profiles, "profile", "name", profile_name); } - xml_cfg.controls = switch_xml_child(cfg, "caller-controls"); - /* if this is a bridging call, and it's not a duplicate, build a */ /* conference object, and skip pin handling, and locked checking */ @@ -5788,9 +5710,6 @@ SWITCH_STANDARD_APP(conference_function) switch_buffer_destroy(&member.resample_buffer); switch_buffer_destroy(&member.audio_buffer); switch_buffer_destroy(&member.mux_buffer); - if (conference && member.dtmf_parser != conference->dtmf_parser) { - switch_ivr_digit_stream_parser_destroy(member.dtmf_parser); - } if (conference) { switch_mutex_lock(conference->mutex); @@ -5939,88 +5858,6 @@ static switch_status_t chat_send(const char *proto, const char *from, const char return SWITCH_STATUS_SUCCESS; } -static switch_status_t conf_default_controls(conference_obj_t *conference) -{ - switch_status_t status = SWITCH_STATUS_FALSE; - uint32_t i; - caller_control_action_t *action; - - switch_assert(conference != NULL); - - for (i = 0, status = SWITCH_STATUS_SUCCESS; status == SWITCH_STATUS_SUCCESS && i < CCFNTBL_QTY; i++) { - if (!zstr(ccfntbl[i].digits)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, - "Installing default caller control action '%s' bound to '%s'.\n", ccfntbl[i].key, ccfntbl[i].digits); - action = (caller_control_action_t *) switch_core_alloc(conference->pool, sizeof(caller_control_action_t)); - if (action != NULL) { - action->fndesc = &ccfntbl[i]; - action->data = NULL; - status = switch_ivr_digit_stream_parser_set_event(conference->dtmf_parser, ccfntbl[i].digits, action); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "unable to alloc memory for caller control binding '%s' to '%s'\n", ccfntbl[i].key, ccfntbl[i].digits); - status = SWITCH_STATUS_MEMERR; - } - } - } - - return status; -} - -static switch_status_t conference_new_install_caller_controls_custom(conference_obj_t *conference, switch_xml_t xml_controls, switch_xml_t xml_menus) -{ - switch_status_t status = SWITCH_STATUS_FALSE; - switch_xml_t xml_kvp; - - switch_assert(conference != NULL); - - if (!xml_controls) { - return status; - } - - /* parse the controls tree for caller control digit strings */ - for (xml_kvp = switch_xml_child(xml_controls, "control"); xml_kvp; xml_kvp = xml_kvp->next) { - char *key = (char *) switch_xml_attr(xml_kvp, "action"); - char *val = (char *) switch_xml_attr(xml_kvp, "digits"); - char *data = (char *) switch_xml_attr_soft(xml_kvp, "data"); - - if (!zstr(key) && !zstr(val)) { - uint32_t i; - - /* scan through all of the valid actions, and if found, */ - /* set the new caller control action digit string, then */ - /* stop scanning the table, and go to the next xml kvp. */ - for (i = 0, status = SWITCH_STATUS_NOOP; i < CCFNTBL_QTY && status == SWITCH_STATUS_NOOP; i++) { - - if (strcasecmp(ccfntbl[i].key, key) == 0) { - - caller_control_action_t *action; - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Installing caller control action '%s' bound to '%s'.\n", key, val); - action = (caller_control_action_t *) switch_core_alloc(conference->pool, sizeof(caller_control_action_t)); - if (action != NULL) { - action->fndesc = &ccfntbl[i]; - action->data = (void *) switch_core_strdup(conference->pool, data); - action->binded_dtmf = switch_core_strdup(conference->pool, val); - status = switch_ivr_digit_stream_parser_set_event(conference->dtmf_parser, val, action); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "unable to alloc memory for caller control binding '%s' to '%s'\n", ccfntbl[i].key, ccfntbl[i].digits); - status = SWITCH_STATUS_MEMERR; - } - } - } - if (status == SWITCH_STATUS_NOOP) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid caller control action name '%s'.\n", key); - } - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid caller control config entry pair action = '%s' digits = '%s'\n", key, val); - } - } - - return status; -} - static conference_obj_t *conference_find(char *name) { conference_obj_t *conference; @@ -6263,7 +6100,8 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m conference->comfort_noise_level = comfort_noise_level; conference->caller_id_name = switch_core_strdup(conference->pool, caller_id_name); conference->caller_id_number = switch_core_strdup(conference->pool, caller_id_number); - + conference->caller_controls = switch_core_strdup(conference->pool, caller_controls); + if (!zstr(perpetual_sound)) { conference->perpetual_sound = switch_core_strdup(conference->pool, perpetual_sound); @@ -6387,7 +6225,6 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m } conference->rate = rate; conference->interval = interval; - conference->dtmf_parser = NULL; conference->eflags = 0xFFFFFFFF; if (!zstr(suppress_events)) { @@ -6405,27 +6242,6 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m conference->verbose_events = 1; } - /* caller control configuration chores */ - if (switch_ivr_digit_stream_parser_new(conference->pool, &conference->dtmf_parser) == SWITCH_STATUS_SUCCESS) { - - /* if no controls, or default controls specified, install default */ - if (caller_controls == NULL || *caller_controls == '\0' || strcasecmp(caller_controls, "default") == 0) { - status = conf_default_controls(conference); - } else if (strcasecmp(caller_controls, "none") != 0) { - /* try to build caller control if the group has been specified and != "none" */ - switch_xml_t xml_controls = switch_xml_find_child(cfg.controls, "group", "name", caller_controls); - status = conference_new_install_caller_controls_custom(conference, xml_controls, NULL); - - if (status != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to install caller controls group '%s'\n", caller_controls); - } - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "No caller controls installed.\n"); - } - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to allocate caller control digit parser.\n"); - } - /* Activate the conference mutex for exclusivity */ switch_mutex_init(&conference->mutex, SWITCH_MUTEX_NESTED, conference->pool); switch_mutex_init(&conference->flag_mutex, SWITCH_MUTEX_NESTED, conference->pool); @@ -6540,6 +6356,131 @@ static void send_presence(switch_event_types_t id) } } +typedef void (*conf_key_callback_t) (conference_member_t *, struct caller_control_actions *); + +typedef struct { + conference_member_t *member; + caller_control_action_t action; + conf_key_callback_t handler; +} key_binding_t; + + +static switch_status_t dmachine_dispatcher(switch_ivr_dmachine_match_t *match) +{ + key_binding_t *binding = match->user_data; + + if (!binding) return SWITCH_STATUS_FALSE; + + binding->handler(binding->member, &binding->action); + switch_set_flag_locked(binding->member, MFLAG_FLUSH_BUFFER); + + return SWITCH_STATUS_SUCCESS; +} + +static void do_binding(conference_member_t *member, conf_key_callback_t handler, const char *digits, void *data) +{ + key_binding_t *binding; + + binding = switch_core_alloc(member->pool, sizeof(*binding)); + binding->member = member; + + binding->action.binded_dtmf = switch_core_strdup(member->pool, digits); + + if (data) { + binding->action.data = switch_core_strdup(member->pool, (char *)data); + } + + binding->handler = handler; + switch_ivr_dmachine_bind(member->dmachine, "conf", digits, 0, dmachine_dispatcher, binding); + +} + +struct _mapping { + const char *name; + conf_key_callback_t handler; +}; + +static struct _mapping control_mappings[] = { + {"mute", conference_loop_fn_mute_toggle}, + {"mute on", conference_loop_fn_mute_on}, + {"mute off", conference_loop_fn_mute_off}, + {"deaf mute", conference_loop_fn_deafmute_toggle}, + {"energy up", conference_loop_fn_energy_up}, + {"energy equ", conference_loop_fn_energy_equ_conf}, + {"energy dn", conference_loop_fn_energy_dn}, + {"vol talk up", conference_loop_fn_volume_talk_up}, + {"vol talk zero", conference_loop_fn_volume_talk_zero}, + {"vol talk dn", conference_loop_fn_volume_talk_dn}, + {"vol listen up", conference_loop_fn_volume_listen_up}, + {"vol listen zero", conference_loop_fn_volume_listen_zero}, + {"vol listen dn", conference_loop_fn_volume_listen_dn}, + {"hangup", conference_loop_fn_hangup}, + {"event", conference_loop_fn_event}, + {"lock", conference_loop_fn_lock_toggle}, + {"transfer", conference_loop_fn_transfer}, + {"execute_application", conference_loop_fn_exec_app} +}; +#define MAPPING_LEN (sizeof(control_mappings)/sizeof(control_mappings[0])) + +static void member_bind_controls(conference_member_t *member, const char *controls) +{ + switch_xml_t cxml, cfg, xgroups, xcontrol; + switch_event_t *params; + int i; + + switch_event_create(¶ms, SWITCH_EVENT_REQUEST_PARAMS); + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "Conf-Name", member->conference->name); + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "Action", "request-controls"); + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "Controls", controls); + + if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, params))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", global_cf_name); + goto end; + } + + if (!(xgroups = switch_xml_child(cfg, "caller-controls"))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find caller-controls in %s\n", global_cf_name); + goto end; + } + + if (!(xgroups = switch_xml_find_child(xgroups, "group", "name", controls))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find caller-controls in %s\n", global_cf_name); + goto end; + } + + + for (xcontrol = switch_xml_child(xgroups, "control"); xcontrol; xcontrol = xcontrol->next) { + const char *key = switch_xml_attr(xcontrol, "action"); + const char *digits = switch_xml_attr(xcontrol, "digits"); + const char *data = switch_xml_attr_soft(xcontrol, "data"); + + if (zstr(key) || zstr(digits)) continue; + + for(i = 0; i < MAPPING_LEN; i++) { + if (!strcasecmp(key, control_mappings[i].name)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s binding '%s' to '%s'\n", + switch_core_session_get_name(member->session), digits, key); + + do_binding(member, control_mappings[i].handler, digits, (void *) data); + } + } + } + + end: + + /* Release the config registry handle */ + if (cxml) { + switch_xml_free(cxml); + cxml = NULL; + } + + if (params) switch_event_destroy(¶ms); + +} + + + + /* Called by FreeSWITCH when the module loads */ SWITCH_MODULE_LOAD_FUNCTION(mod_conference_load) { commit 2fe0e00e4556a34bd5cc2873ad57afbbc9691b4d Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Oct 14 18:52:14 2010 -0500 update dmachine code diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 299c24d..dae7ee0 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -223,11 +223,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_bind(switch_ivr_dmachine_t * } if (binding->is_regex) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Digit parser %s: binding realm: %s regex: %s key: %.4d callback: %p data: %p\n", - dmachine->name, realm, digits, key, (void *)(intptr_t) callback, user_data); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Digit parser %s: binding %s/%s/%d callback: %p data: %p\n", + dmachine->name, digits, realm, key, (void *)(intptr_t) callback, user_data); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Digit parser %s: binding realm %s digits: %4s key: %.4d callback: %p data: %p\n", - dmachine->name, realm, digits, key, (void *)(intptr_t) callback, user_data); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Digit parser %s: binding %s/%s/%d callback: %p data: %p\n", + dmachine->name, digits, realm, key, (void *)(intptr_t) callback, user_data); } return SWITCH_STATUS_SUCCESS; @@ -244,60 +244,61 @@ typedef enum { static dm_match_t switch_ivr_dmachine_check_match(switch_ivr_dmachine_t *dmachine, switch_bool_t is_timeout) { dm_match_t best = DM_MATCH_NONE; - switch_ivr_dmachine_binding_t *bp, *exact_bp = NULL; - int exact_count = 0, partial_count = 0, both_count = 0; + switch_ivr_dmachine_binding_t *bp, *exact_bp = NULL, *partial_bp = NULL, *both_bp = NULL, *r_bp = NULL; - if (!dmachine->cur_digit_len || !dmachine->realm) goto end; for(bp = dmachine->realm->binding_list; bp; bp = bp->next) { - if (bp->is_regex) { switch_status_t r_status = switch_regex_match(dmachine->digits, bp->digits); if (r_status == SWITCH_STATUS_SUCCESS) { if (is_timeout) { best = DM_MATCH_EXACT; - exact_count++; exact_bp = bp; break; } best = DM_MATCH_PARTIAL; - partial_count++; - continue; } } else { + if (!exact_bp && !strcmp(bp->digits, dmachine->digits)) { - exact_bp = bp; best = DM_MATCH_EXACT; - exact_count++; - continue; + exact_bp = bp; } - if (!strncmp(dmachine->digits, bp->digits, strlen(dmachine->digits))) { - if (best == DM_MATCH_EXACT) { - if (is_timeout) { - best = DM_MATCH_EXACT; - exact_count++; - exact_bp = bp; - } else { - best = DM_MATCH_BOTH; - both_count++; - } + if (!(both_bp && partial_bp) && !strncmp(dmachine->digits, bp->digits, strlen(dmachine->digits))) { + if (exact_bp) { + best = DM_MATCH_BOTH; + both_bp = bp; } else { best = DM_MATCH_PARTIAL; - partial_count++; + partial_bp = bp; } - break; } + + if (both_bp && exact_bp && partial_bp) break; } } end: + + if (is_timeout) { + if (both_bp) { + r_bp = both_bp; + } else if (partial_bp) { + r_bp = partial_bp; + } + } + + if (best == DM_MATCH_EXACT && exact_bp) { + r_bp = exact_bp; + } + - if (!both_count && exact_bp) { - dmachine->last_matching_binding = exact_bp; + if (r_bp) { + dmachine->last_matching_binding = r_bp; switch_set_string(dmachine->last_matching_digits, dmachine->digits); best = DM_MATCH_EXACT; } @@ -343,7 +344,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t * switch_bool_t is_timeout = switch_ivr_dmachine_check_timeout(dmachine); dm_match_t is_match = switch_ivr_dmachine_check_match(dmachine, is_timeout); switch_status_t r; - + int clear = 0; + if (zstr(dmachine->digits) && !is_timeout) { r = SWITCH_STATUS_SUCCESS; } else if (dmachine->cur_digit_len > dmachine->max_digit_len) { @@ -362,7 +364,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t * dmachine->is_match = 1; dmachine->match.type = DM_MATCH_POSITIVE; - + if (dmachine->last_matching_binding->callback) { dmachine->last_matching_binding->callback(&dmachine->match); } @@ -371,10 +373,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t * dmachine->match.user_data = dmachine->user_data; dmachine->match_callback(&dmachine->match); } - + clear++; } else if (is_timeout) { r = SWITCH_STATUS_TIMEOUT; - } else if (dmachine->cur_digit_len == dmachine->max_digit_len) { + } else if (is_match == DM_MATCH_NONE && dmachine->cur_digit_len == dmachine->max_digit_len) { r = SWITCH_STATUS_NOTFOUND; } else { r = SWITCH_STATUS_SUCCESS; @@ -390,9 +392,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t * dmachine->match.user_data = dmachine->user_data; dmachine->nonmatch_callback(&dmachine->match); } + + clear++; } - if (r != SWITCH_STATUS_SUCCESS) { + if (clear) { switch_ivr_dmachine_clear(dmachine); } @@ -414,6 +418,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_feed(switch_ivr_dmachine_t * SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_clear(switch_ivr_dmachine_t *dmachine) { + memset(dmachine->digits, 0, sizeof(dmachine->digits)); dmachine->cur_digit_len = 0; dmachine->last_digit_time = 0; commit 1752405754633af7282af3b82043487d567fed7e Author: Michal Bielicki <cypromis@debian-buildtesst> Date: Fri Oct 15 01:07:15 2010 +0200 added include path for openjdk6 includes on debian diff --git a/libs/esl/java/Makefile b/libs/esl/java/Makefile index a1e5f93..9474a83 100644 --- a/libs/esl/java/Makefile +++ b/libs/esl/java/Makefile @@ -1,4 +1,4 @@ -LOCAL_CFLAGS=-I../src/include -I/usr/java/jdk1.6.0_14/include -I/usr/java/jdk1.6.0_14/include/linux +LOCAL_CFLAGS=-I../src/include -I/usr/java/jdk1.6.0_14/include -I/usr/java/jdk1.6.0_14/include/linux -I/usr/lib/jvm/java-6-openjdk/include/ GCC_WARNING_JUNK=-w CLASSES=org/freeswitch/esl/* commit 5b7ba536d70cd0e4f312063b71abc33e5b8c30bd Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Oct 14 16:32:31 2010 -0500 move to proper location diff --git a/Freeswitch.2010.sln b/Freeswitch.2010.sln index 4b67f51..5722802 100644 --- a/Freeswitch.2010.sln +++ b/Freeswitch.2010.sln @@ -705,7 +705,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_h323", "src\mod\endpoin EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_distributor", "src\mod\applications\mod_distributor\mod_distributor.2010.vcxproj", "{5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}" EndProject -Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "Setup", "Setup\Setup.wixproj", "{47213370-B933-487D-9F45-BCA26D7E2B6F}" +Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "Setup", "w32\Setup\Setup.wixproj", "{47213370-B933-487D-9F45-BCA26D7E2B6F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/Setup/Setup.wixproj b/w32/Setup/Setup.wixproj similarity index 100% rename from Setup/Setup.wixproj rename to w32/Setup/Setup.wixproj commit 3da5dd0e362256f4550ff35c3da6ec9312060058 Author: Michal Bielicki <cypromis@debian-buildtesst> Date: Thu Oct 14 22:47:08 2010 +0200 typo in debian rules file made freetdm disappear diff --git a/debian/rules b/debian/rules index 0c1aae9..0e5f4a3 100755 --- a/debian/rules +++ b/debian/rules @@ -24,7 +24,7 @@ export CODECS_MODULES= codecs/mod_bv codecs/mod_h26x codecs/mod_speex codecs/mod codecs/mod_silk codecs/mod_siren codecs/mod_theora export DIALPLANS_MODULES= dialplans/mod_dialplan_asterisk dialplans/mod_dialplan_directory dialplans/mod_dialplan_xml export ENDPOINTS_MODULES= endpoints/mod_dingaling endpoints/mod_portaudio endpoints/mod_sofia \ - endpoints/mod_loopback ../../libs/frieetdm/mod_freetdm endpoints/mod_skypopen \ + endpoints/mod_loopback ../../libs/freetdm/mod_freetdm endpoints/mod_skypopen \ endpoints/mod_skinny export EVENT_HANDLERS_MODULES=event_handlers/mod_event_multicast event_handlers/mod_event_socket event_handlers/mod_cdr_csv export FORMATS_MODULES= formats/mod_file_string formats/mod_local_stream formats/mod_native_file formats/mod_portaudio_stream \ commit a346530fa42b1e128538b61ace8ec73a845470ac Merge: ea5a8c9 36f8385 Author: Michal Bielicki <cypromis@debian-buildtesst> Date: Thu Oct 14 22:30:17 2010 +0200 Merge branch 'master' of git@git.freeswitch.org:freeswitch commit ea5a8c91f6427a3f12048609ec95000ecbab9b30 Author: Michal Bielicki <cypromis@debian-buildtesst> Date: Thu Oct 14 22:29:29 2010 +0200 more deb packaging cleanups diff --git a/debian/changelog b/debian/changelog index f35e705..2965a92 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,13 @@ freeswitch (1.0.7-1headgit1) maverick; urgency=low * upgrade: Added mod_amrwb + * switched from openzap to freetdm + * added codec2 theora and other codecs + * mod:soundtouch does not build since soundtouch lib is broken on debian + * mod_flite does not build (requires massive memory for flite to build) * upgrade version to 1.0.7 ... 1.0.6 was last realease -- Michal Bielicki <michal.bielicki@seventhsignal.de> Wed, 13 Oct 2010 22:58:48 -0200 + freeswitch (1.0.6-1ubuntu1) maverick; urgency=low [ Gabriel Gunderson ] diff --git a/debian/freeswitch-freetdm.debhelper.log b/debian/freeswitch-freetdm.debhelper.log deleted file mode 100644 index 60ff8f9..0000000 --- a/debian/freeswitch-freetdm.debhelper.log +++ /dev/null @@ -1,4 +0,0 @@ -dh_installdirs -dh_installdocs -dh_installchangelogs -dh_installinit diff --git a/debian/freeswitch-freetdm/usr/share/doc/freeswitch-freetdm/changelog.Debian b/debian/freeswitch-freetdm/usr/share/doc/freeswitch-freetdm/changelog.Debian deleted file mode 100644 index f35e705..0000000 --- a/debian/freeswitch-freetdm/usr/share/doc/freeswitch-freetdm/changelog.Debian +++ /dev/null @@ -1,799 +0,0 @@ -freeswitch (1.0.7-1headgit1) maverick; urgency=low - * upgrade: Added mod_amrwb - * upgrade version to 1.0.7 ... 1.0.6 was last realease - - -- Michal Bielicki <michal.bielicki@seventhsignal.de> Wed, 13 Oct 2010 22:58:48 -0200 -freeswitch (1.0.6-1ubuntu1) maverick; urgency=low - - [ Gabriel Gunderson ] - * upgrade: Added mod_callcenter and pulled out Python into its own - package. - - [ Mathieu Parent ] - * Updated Uploaders list - * Updated Standards-Version to 3.9.1 - - -- Mathieu Parent <sathieu@debian.org> Thu, 23 Sep 2010 15:34:00 +0200 - -freeswitch (1.0.4-1ubuntu2) karmic; urgency=low - - * upgrade: Add more verbosity when building to make it easier to find build - errors. - * upgrade: Remove the requirement for EXACTLY automake1.9 and change it to - need atleast automake 1.9 - * upgrade: Add the modules (directory, cluechoo, and valet_parking) to the - build files. These are in the standard build, so they should be here too. - - -- William King <quentusrex@gmail.com> Fri, 18 Dec 2009 14:27:42 -0800 - -freeswitch (1.0.4-1ubuntu1) karmic; urgency=low - - * upgrade: Pulling out the sounds into separate source files for easier management. - - -- William King <quentusrex@gmail.com> Sun, 15 Nov 2009 16:38:13 -0800 - -freeswitch (1.0.4-1) unstable; urgency=low - - * new - - -- Mike Jerris <mike@jerris.com> Mon, 18 Feb 2009 17:39:00 -0500 - -freeswitch (1.0.3-1) unstable; urgency=low - - * build: add targets cd-sounds[-install] and cd-moh[-install] for 48k sounds (r:11151) - * build: autoconf detect odbc library (FSBUILD-8) - * build: fix sound install on windows build (r:11635,11638) - * build: fix configure --sysconfdir (FSBUILD-84) - * build: fix uclibc build (MODLANG-99) - * build: fix adduser in debian (FSBUILD-122, FSBUILD-102) - * core: fix buffering issues (r:11101,11145,11152-11157,11162,11191,11200) - * core: fix c leg no hangup when converting attended to blind transfer before b leg answers (MODENDP-165/r:11061) - * core: fix codec and media handling issues (r:11104) - * core: fix double close of file handles and add recording of native files (r:11108-11113,11482,11483) - * core: fix file resampling issue (r:11090) - * core: fix incorrect call progress timestamps in timetable (r:11186-11187/FSCORE-268) - * core: fix media handling issues (r:11079-11082) - * core: fix multiple 2833 dtmf handling issues (r:11149,11261,11262,11266,11293,11294,11338/FSCORE-266,FSCORE-273) - * core: send more event types verbos bridge,unbridge,park,unpark (r:11097-11098) - * core: Prevent media setup on failed originates (r:11462/FSCORE-279) - * core: fix recorded soundfiles had random data at end of file (r:11491/MODAPP-205) - * core: fix user for windows service (r:11538/FSCORE-277) - * core: modify variable expansion code to expand in more places and to fix potential security issue from injecting variables (r:11569,11570) - * core: look for soundfiles in more locations based on rate (r:11601/MODFORM-23) - * core: state machine veto behavior changed (r:11610) - * core: add enable_file_write_buffering variable (r:11677) - * core: fix garbled audio on media bug during bridge using stateful codecs (FSCORE-288) - * core: fix tone detect running multiple bugs when detecting multiple tones - * core: add {instant_ringback=true} to make ringback not wait for indication to generate ringback - * core: fix segfault from race condition on multiple reloadxml calls (MOODAPP-211) - * core: modify xml locking so phrases do not lock the xml for the duration of playing them - * core: replace resampler with the speexdsp resampler - * core: fix windows calling convention on threads launched that return a value to fix shutdown segfault (FSCORE-298) - * core: do not auto-export origination_caller_id_* to avoid confusion (r:12052) - * core: API visibility support (GCC/SUNCC) (FSCORE-264) - * core: fix leak in exposed event class serialize method (r:12068) - * core: add volume as possible return value from input callback on embedded languages (r:12114) - * core: add resampler to seech handles (r:12141) - * core: add api.getTime to embedded languages (r:12149) - * freeswitch: allow you to specify -htdocs dir at runtime. (r:11614) - * fs_cli: add "debug" command to change the esl debug level at runtime (r:11057) - * iksemel: update to 1.3 (r:11645) - * libesl: fix disconnect failure (r:11078,11083) - * libesl: fix solaris build (r:11067,11068) - * libesl: add c++ wrapper and swigged wrappers for multiple scripting languages - * libg722_1: fix dct4.h code generator to include the "f" (r:11188-11189,11367) - * libilbc: update to new library from Steve Underwood - * mod_amrwb: add amr wideband passthrough codec (r:11971) - * mod_cepstral: fix failure return code handling (MODASRTTS-9) - * mod_conference: add 'conference xml_list' and 'conference [conf_name] xml_list' (r:11062-11063) - * mod_conference: make conference verbose-events param to control if events have all the channel data or not (r:11073-11077) - * mod_conference: add MINTWO flag to end conference when down to 1 participant (r:11523) - * mod_conference: refactor conference record function (r:11626) - * mod_conference: add conference list summary command (MODAPP-197) - * mod_conference: fix Deadlock or coredump on conference commands play, transfer (MODAPP-209) - * mod_dahdi_codec: added (MODCODEC-7) - * mod_dialplan_xml: make previous auto hunt feature optional and off by defaule use auto_hunt=true session or global variable to enable (r:12144) - * mod_dptools: Add failure_causes channel variable (r:12058) - * mod_easyroute: add configuration file example for custom-query (r:11055) - * mod_easyroute: add custom-query configuration option (r:11054) - * mod_easyroute: fix build error when not configured for odbc (r:11478) - * mod_easyroute: fix memory leak (r:11611) - * mod_erlang_event: add ability to spawn a process (module/function) outbound on a specified node. (r:11460,11477) - * mod_erlang_event: Fix some issues with standing up a new outbound listener and cleaning up after a failed session (r:11479) - * mod_erlang_event: Fix setting up a listener for an outbound session if one doesn't already exist (r:11488) - * mod_erlang_event: add "erlang" fscli command (r:11488) - * mod_erlang_event: Monitor spawned outbound processes for premature exits (r:11489) - * mod_erlang_event: Allow the event encoding strategy to be configurable; choices are string or binary (r:11495) - * mod_erlang_event: Allow certain tuple elements to be binaries or strings, to reduce conversion requirements on the erlang side (r:11496) - * mod_erlang_event: Support sending a message to a registered process to request a pid (when spawning won't cut it) (r:11499) - * mod_erlang_event: Ensure events received while a pid session is being created aren't discarded but are queued instead (r:11500) - * mod_erlang_event: Add freeswitch.erl - An erlang module to make talking to mod_erlang_event more painless (r:11525) - * mod_erlang_event: use rpc:call instead of spawn and to make the registered process argument to handlecall optional (r:11542) - * mod_event_socket: add ability to use a comma sep list of events on event-sink create-listener (r:11056) - * mod_event_socket: add debug logging to event-sink (r:11060) - * mod_event_socket: fix race condition (r:11680,12146) - * mod_dptools: add all modifier to break command (r:11557,11558) - * mod_dptools: add sound_test application (r:11658) - * mod_fax: Dont hangup after sending/receiving faxes - * mod_fifo: pause media bugs while not in a bridge (r:11466,11490) - * mod_fifo: allow unpark during chime list playing (r:11555/MODAPP-206) - * mod_fifo: fix outbound fifos doesn't check if the consumer is in the fifo in question. (r:11561/MODAPP-207) - * mod_fifo: Fix segfault when no argument were supplied to fifo_member call (MODAPP-210) - * mod_lcr: added (r:11180,11184,11532,11609) - * mod_limit: fix memory corruption caused by race condition when using limit hash (r:11070-11071) - * mod_limit: Fix transfer bug, fix leak and make the channel hangup if the extension is \!hangup_cause (r:11604,11932) - * mod_limit: add write different channel variables per realm_id (r:11608) - * mod_limit: Make max argument optional on the limit app, set the limit_usage variable to current count after inserting call in the db (r:11955) - * mod_lua: Create empty argv table when no args are passed to a Lua script (r:11559) - * mod_lua: use dll for lua windows build (FSCORE-299) - * mod_openmrcp: removed (r:11176-11179) - * mod_opal: added - * mod_pocketsphinx: fix leak (r:11974) - * mod_portaudio: fix stuck channels on outbound calls (r:11160,11470,11471,11472,11475,11476,11485) - * mod_python: fix build when site dir is not /usr/lib/python2.4 (r:12070) - * mod_say_en: add short form date/time (MODAPP-180) - * mod_sofia: add auto-rtp-bugs profile option to make rtp bug compensation configurable (r :11146-11147) - * mod_sofia: add support in sdp for a=maxptime (r:11103) - * mod_sofia: fix codec change race condition (r:11143) - * mod_sofia: fix notify event wasn't allowing content-length 0 (r:11106/MODENDP-167) - * mod_sofia: fix sending extra sdp in 200 OK when using 100rel in violation of sdp o/a protocol draft-ietf-sipping-sip-offeranswer-10 (r:11088) - * mod_sofia: fix sip_auto_answer=true (r:11069) - * mod_sofia: improve outbound registration error message (r:11059) - * mod_sofia: reset media timeout on re-invite (r:11161) - * mod_sofia: fix segfault due to missing contact header in invite (r:11463/MODENDP-177) - * mod_sofia: allow <params> tag in gateways as well as <variables> with direction inbound/outbound (default both) and call counter (r:11468) - * mod_sofia: add support or SLA, works with Polycom and Snom(Sylantro mode). (r:11562/MODENDP-179) - * mod_sofia: tolerate missing user in the request uri (r:11636) - * mod_sofia: Add purpose=gateways and profile=[name] so xml_curl requests make sense (MDXMLINT-46) - * mod_sofia: Add disable-srv and disable-naptr params to sip profiles (default false) (MODENDP-183) - * mod_sofia: add outbound-proxy param (MODENDP-184) - * mod_sofia: fix segfault with stun-enabled=false (SFSIP-120) - * mod_sofia: Profile Name in Expire Event is incorrect (MODENDP-185) - * mod_sofia: add "scrooge" mode to "inbound-codec-negotiation" (r:11881) - * mod_sofia: Add context to reconfig_sofia (r:12080) - * mod_sofia: fix segfault when calling from a Cisco 7940 using bypass_media (FSCORE-301) - * mod_sofia: ilbc to default to 30 if no mode= fmtp is defined on the inbound (r:12110) - * mod_sofia: fix challenge-realm (r:12113) - * mod_sofia: Segmentation fault when running killgw command on sofia profile without specifying a gateway (MODENDP-189) - * mod_sofia: gateways will inherit the context from its parent unless manually provided (r:12138) - * mod_sndfile: Add IMA ADPCM support (MODFORM-22) - * mod_spidermonkey: fix loading of spidermonkey modules (r:11084-11085) - * mod_spidermonkey: block some unwanted behaviours in session.originate - * mod_spidermonkey_socket: fix gc blocking (MODLANG-97) - * mod_xml_rpc: fixed authentication using @domain syntax (r:11064) - * mod_xml_rpc: fix http content types sent in responses (r:11099,11148,11150) - * mod_voicemail: voicemail insert into the proper fields (MODAPP-190) - * mod_voipcodecs: add G.726 24k (r:12083) - * sofia-sip: update to current sofia-sip repository - * spandsp: sync to latest snapshot and fix windows build - * speex: updated to 1.2rc1 - * sqlite: fix random assert on windows (FSCORE-292) - - -- Mike Jerris <mike@jerris.com> Mon, 18 Feb 2009 17:39:00 -0500 - -freeswitch (1.0.2-1) unstable; urgency=low - - * all: don't add module interfaces before returning from error conditions in module load functions (MDXMLINT-36) - * all: fixed multiple memory leaks - * all: improved module unloading/reloading support - * build: add support for --switchconfdir (FSBUILD-84) - * build: fixed netbsd build - * build: make freeswitch stop graceflly with /etc/init.d/freeswitch stop on debian add working dir to start-stop-dir so freeswitch dumps core in workdir - * build: multiple packaging fixes - * build: user freeswitch not added to audio group on deb install (FSBUILD-95) - * Configuration: many updates to default configuration - * core: Add ability to choose uuid from originate string, originate_uuid var (use at your own risk) - * core: add bridge_generate_comfort_noise option for bridge to generate comfort noise to the A leg when there is no audio on the B leg - * core: add chan vars to param event during hangup hook - * core: add exec directive to xml preprocessor (not available on windows) - * core: add force_transfer_dialplan and force_transfer_context variables - * core: add hashing to event header lookup - * core: add hits to tone_detect - * core: add last_dtmf_duration variable - * core: add msleep function to swigged languages - * core: add park_after_bridge variable - * core: add per leg timeouts and specific cause codes in reject_on_single_fail - * core: add runtime selection of the module dir (FSCORE-198) - * core: add scheduler support for heartbeat - * core: add session heartbeat feature - * core: add session.destroy psuedo method to sort of destroy a session at least for the sake of FS - * core: add session.unsetInputCallback - * core: add strftime format string validation for user supplied values - * core: add vars param to switch_ivr_originate for recursion (MODAPP-175) - * core: added a "group" concept to the user directory - * core: added ability to do dns lookup to find ip with host: like stun: (FSCORE-219) - * core: added better locking for codec changes during a call - * core: added current_application and current_application_data variables - * core: added error/ magic endpoint so modules can return error causes in situations like sofia_contact - * core: added read_result channel variable - * core: added support for "F" to indicate flash in dtmf (FSCORE-213) - * core: allow calls to be stolen from originate - * core: allow you to get the privacy bits in the caller_profile - * core: change dso code to load symbols local - * core: changes core flags to be array based so we have more - * core: eavesdrop causes the people being eavesdropped on to not hear ach other (MODAPP-140) - * core: expose time table to variable interface via caller field lookup - * core: fix 100% cpu when sending parked call to moh (FSCORE-234) - * core: fix bridge app to make sure both channels are ready for media when one is only in ringing state - * core: fix buffer overflow (FSCORE-188) - * core: fix conference dial by allowing multiple braces in originate, fix bad pointer op (FSCORE-208) - * core: fix double detection of DTMF in IVR (FSCORE-221) - * core: fix hangup_after_bridge is false on a bridge started with the intercept app - * core: fix issue where pid file is accidentally truncated - * core: fix ivr timeout (FSCORE-181) - * core: fix memory leak in alias tab completion code - * core: fix min digits in read app - * core: fix out-of-bounds pointer in variable expansion (FSCORE-171) - * core: fix segfault in media bugs when in bypass media (FSCORE-193) - * core: fix segfault on gtalk to sip calls (FSCORE-212) - * core: fix segfault on reloadxml (FSCORE-176) - * core: fix segfault on trasfering eavesdopping party (FSCORE-210) - * core: fix segfault using switch_system function (FSCORE-196) - * core: fix session.bridge - * core: fix setting effective_caller_id_name / effective_caller_id_number on bridge dialstring (MODAPP-122) - * core: fix stream_raw_write (MODAPP-145) - * core: fix using resampling on ringback file - * core: fixed performance bottleneck in sqlite db's - * core: fixed race in reloadxml - * core: increment app before execute in case it returns to execute it will go to the next item in the list and not the same - * core: ivr menu max_failures and max_timeouts now default to 3 if not specified or invalid (less than 1) values are specified (FSCORE-244) - * core: ivr_menu max-timeouts option, result in ivr_menu_status var (FSCORE-183) - * core: let b legs use park_after_bridge too - * core: make events less verbose unless verbose_events is set - * core: parse private events during originate - * core: pass pdd data to a leg on oubound calls using bridge - * core: prevent crash in crazy situation with xml interface lookup failures (FSCORE-169) - * core: reduce cpu requirement for generated comfort noise - * core: remove interface names from core db on unload - * core: reworked timing resulting in significant performance increase and better rtp timing - * core: rewrite switch_play_and_get_digits (MODAPP-166) - * core: session.recordFile never terminates (MODLANG-79) - * core: session.transfer make dialplan and context optional - * core: set_user app now sets domain vars as well as user vars - * core: tone_detect not triggering app after tone detection (MODAPP-182) - * core: unprivileged user setting bigger stack for switch_system thread failure (FSCORE-197) - * core: user_exists returns false when fetching a user from XML Curl or other xml interfaces - * libesl: added c event socket library and fs_cli - * libsndfile: fix autoconf 2.62 support (LBSNDF-5) - * mod commands: add "all" modifier to "break" command - * mod_celt: added new module - * mod_commands: Add support for more than 2 variables to uuid_setvar_multi (MODAPP-171) - * mod_commands: Add support for passing the cause of hangup to the uuid_kill command (FSCORE-217) - * mod_commands: add attr lookup to user_data - * mod_commands: add domain_exists fsapi command - * mod_commands: add eval fsapi command - * mod_commands: add flush_dtmf app and uuid_flush_dtmf api command - * mod_commands: add fsctl send_sighup, fsctl shutdown asap, unsched_api commands - * mod_commands: add fsctl shutdown [elegant|restart|cancel] - * mod_commands: add new syntax to uuid_setvar to allow you to unset a var. <uuid> <var> [value] (MODAPP-167) - * mod_commands: add reload fsapi command to reload a module - * mod_commands: add system fsapi and application (MODAPP-138) - * mod_commands: added hupall fsapi command - * mod_commands: added strftime_tz api command - * mod_commands: break all now stops broadcast too - * mod_commands: fix api command sent through sched_api was getting the last char lopped off - * mod_commands: fix race on transfer with -both - * mod_commands: fix system dialplan app problems (MODAPP-86) - * mod_commands: only send content-type on status when it really is http. - * mod_conference: add fsapi to stop async playback too - * mod_conference: add video caps to mod_conference with video follow audio - * mod_conference: better sound prefix handling when using say: and allow say: on kick sounds. - * mod_conference: fix race in record - * mod_conference: fix runaway thread when floor holder has no video and other people do have video - * mod_conference: fix seg when kicking many members quickly (MODAPP-129) - * mod_conference: fix segfault on invalid chat event - * mod_conference: perpetual sound does not auto-mute, you can do that yourself if you want it - * mod_dialplan_xml: add Hunt- vars in dialplan lookup after transfer - * mod_dialplan_xml: fail call on extensions with nested conditions - * mod_dingaling: (LBDING-7) fix segfault on os x - * mod_dingaling: end call on ice timeout - * mod_dingaling: fix presence on jabber to be less protocol ambiguous - * mod_dingaling: fix segfault (LBDING-10) - * mod_dingaling: update to support latest client from google - * mod_dptools: add a mechanism to tell if a file played from sendmsg over event socket - * mod_dptools: add playback_terminator support to phrase and say app - * mod_dptools: add playback_terminator_used variable (MODAPP-132) - * mod_dptools: add presence application - * mod_dptools: fix originate api not parsing users properly (FSCORE-246) - * mod_dptools: fix record and record_session to create directory if it does not exist (FSCORE-250) - * mod_dptools: fixed limit and + parsing bug in record_session app (MODAPP-148) - * mod_dptools: remove_bugs added to remove all media bugs on a session - * mod_erlang_event: add new module - * mod_event_socket: missing : after Content-Length in event socket (MODEVENT-33) - * mod_event_socket: add event socket listener filters - * mod_event_socket: add stateful listener fsapi commands for ajax-y type event interface over http - * mod_event_socket: fix arg parsing errors (MODEVENT-34) - * mod_event_socket: fix shutdown segfault race (MODEVENT-32) - * mod_event_socket: inbound connection to event_socket can now take over an existing channel with 'myevents <uuid>' to take on the behaviour of an outbound socket - * mod_event_socket: let any channel get messages - * mod_event_socket: make event socket wait for hangup on outbound mode and send disconnect message - * mod_expr: fix endless loop - * mod_fax: new module - * mod_fifo: add fifo_consumer_wrapup_time var (MODAPP-117) - * mod_fifo: added callback agents - * mod_fifo: honor keyword silence (MODAPP-118) - * mod_flite: added windows build - * mod_fsv: fix in a windows enviroment opening the record file in text mode. (MODAPP-169) - * mod_http: added new module - * mod_java: updated to new module api to support read/write locks on interface - * mod_limit: accept dialplan context for transfer (MODAPP-161) - * mod_limit: added hashtable based limit functions - * mod_limit: prevent empty error log message (MODAPP-134) - * mod_local_stream: add start_local_stream and stop_local_stream fsapi commands to start/stop dynamically (MODFORM-13) - * mod_local_stream: fix leak and improve error checking - * mod_local_stream: fix seg when no timer name specified in config file. (MODFORM-16) - * mod_loopback: add new module - * mod_lua: add local scripts directory support (MODLANG-86) - * mod_lua: don't eval blank string - * mod_lua: fix originate - * mod_lua: fix segfault (MODLANG-77) - * mod_lua: update to lua 5.1.4 (MODLANG-87) - * mod_lumenvox: removed - * mod_managed: new module replaces mod_mono now supports native .net runtime on windows as well - * mod_opal: added to trunk (still very beta) - * mod_perl: fix segfault (MODLANG-77) - * mod_pocketsphinx: fix rpm build - * mod_portaudio: fix cpu race on inbound call to pa when no ring file is set - * mod_radius_cdr: dictionary update for cause code changes (MODEVENT-27) - * mod_radius_cdr: fix unload (MODEVENT-29) - * mod_shout: add stereo recording broadcast support - * mod_shout: added windows build - * mod_shout: fix segfault when recording mp3's (MODFORM-12) - * mod_shout: improved stability of mp3 decoding - * mod_siren: added new module - * mod_sndfile added support to record 16bit for the various rates including 48kHz - * mod_sofia: Add filter to "sofia status profile XXX" (MODENDP-138) - * mod_sofia: Add force-register-db-domain which works in conjunction with force-register-domain. - * mod_sofia: Add optional <variables> and <params> tag to <gateway> tag. - * mod_sofia: Challenge the right realm when to_host is outside the users domain. (MODENDP-136) - * mod_sofia: Improve notify messages through a proxy (MODENDP-147) - * mod_sofia: MWI for multiple domains (MODAPP-126) - * mod_sofia: Move "a=sendrecv" from session to media section of SDP (MODENDP-148) - * mod_sofia: add 200 OK re-invite without sdp - * mod_sofia: add custom sofia::gateway_state event (MODENDP-112) - * mod_sofia: add fire events for the refer SIP NOTIFY event package (MODENDP-152) - * mod_sofia: add more params for xml_curl directory lookup - * mod_sofia: add new auto vals for challenge-realm param <param name="challenge-realm" value="auto_from|auto_to|<hardcoded_val>"/> - * mod_sofia: add option to turn of auto_restart of sofia profiles on ip change - * mod_sofia: add params to use sip callid as uuid on inbound calls and uuid as sip callid on outbound calls - * mod_sofia: add parsing of Privacy header for privacy info (MODENDP-133) - * mod_sofia: add proto_specific_hangup_cause to both legs - * mod_sofia: add proxy 3pcc mode - * mod_sofia: add redirect variable to channel as well as partner channe (MODENDP-135) - * mod_sofia: add sip-forbid-register to user params to refuse to let a certian user register - * mod_sofia: add sip: into register-proxy when it's not specified - * mod_sofia: add sip_history_info var for inbound invites. - * mod_sofia: add sip_via_protocol variable - * mod_sofia: add sofia xmlstatus (MODENDP-156) - * mod_sofia: add support for params other than Replaces in Refer-To (MODENDP-143) - * mod_sofia: add support for profiles sharing databases so that you can have a domain that uses multiple profiles for split dns type setups - * mod_sofia: add support for refer transfer involving multiple machines - * mod_sofia: add support to send a notify in the invite dialog by specifying the uuid of the call. (SFSIP-92) - * mod_sofia: add suppress_from_cidname var to not have display name in from header (MODENDP-153) - * mod_sofia: added sip_hangup_disposition variable - * mod_sofia: allow send_message and notify events to send a message/notify without a body if needed. - * mod_sofia: append -1 .. -N postfix after any X-headers as vars that have the same name - * mod_sofia: cache auth_gateway_name in sofia for challenged bye - * mod_sofia: cancel proxy or no-media mode if you purposely answer or pre_answer - * mod_sofia: correct result code mapping for Unallocated Number (MODENDP-124) - * mod_sofia: disable 100rel by default - * mod_sofia: don't accept crypto in the RTP/AVP (MODENDP-126) - * mod_sofia: don't put CN in sdp answer if it was not in the offer. - * mod_sofia: fix Incorrect IP address shows up in SDP "o" field when multiple external IPs available and FS not bound to first (MODENDP-132) - * mod_sofia: fix Wrong RTP media port destination after reinvite/UNHOLD (SFSIP-82) - * mod_sofia: fix bug on linksys where they lie about the ptime and handle linksys transfer problem - * mod_sofia: fix chat (send an IM) assumes that the user's profile is the same as their domain, which isn't necessarily so (SFSIP-83) - * mod_sofia: fix dtmf handling of broken info dtmf endpoints - * mod_sofia: fix eyebeam presence to be RFC compliant (MODENDP-144) - * mod_sofia: fix ip change detection when in proxy mode - * mod_sofia: fix register_proxy ignoring the paramaters (MODENDP-121) - * mod_sofia: fix remote session refresh triggers request glare (MODENDP-131) - * mod_sofia: fix rtp auto adjust running when it should not - * mod_sofia: fix rtp sent to wrong port after some re-INVITE scenarios (MODENDP-141) - * mod_sofia: fix sending of cn packets across bridge when we shouldn't - * mod_sofia: fix sqlite issue with select of the sip contact - * mod_sofia: fixed segfault on invalid presence payload - * mod_sofia: gateway ping needs to look for 501 (SFSIP-78) - * mod_sofia: handle multi contact register responses and register timeout better - * mod_sofia: improve gateway resilience - * mod_sofia: log ip and port you get reply to invite from - * mod_sofia: make multiple-registations=true use the contact method and call-id option to do it the old way - * mod_sofia: make proxy mode pull the port from m=image as well - * mod_sofia: make register-proxy preserve the url composed from proxy but target the packets to desired address (MODENDP-121) - * mod_sofia: many fixes for sonus rtp issues silence_when_idle=400 chanvar to send generated silence duing sleeps etc - * mod_sofia: many fixes in presence handling - * mod_sofia: passthrough t.38 fixes - * mod_sofia: pick ipv4 or ipv6 based on sipip instead of having mixed in sdp - * mod_sofia: send NOTIFY on TCP/UDP depending on the SUBSCRIBE (SFSIP-104) - * mod_sofia: setting profile option multiple-registrations=contact key multi reg off the contact string - * mod_sofia: wait for a reply on refer - * mod_soundtouch: fixes and improvements, many options changed (MODAPP-149) - * mod_soundtouch: updated to new module api - * mod_spidermonkey: Segmentation fault in check_hangup_hook at mod_spidermonkey.c:1589 (MODLANG-74) - * mod_spidermonkey: fix bug in apiExecute - * mod_spidermonkey: fix memory pool handling and leaks - * mod_spidermonkey: limit recursion busting through the stack (FSCORE-202) - * mod_spidermonkey: make session.getVariable return blank string not the word false - * mod_spidermonkey_curl: add optional content-type arg - * mod_spidermonkey_odbc: fix numRows and add numCols - * mod_spidermonkey_odbc: fix segfault (MODLANG-75) - * mod_stress: new module for voice stress analysis - * mod_syslog: don't log blank lines (FSCORE-163) - * mod_tone_stream: let silence_stream://0 indicate perpetual silence - * mod_vmd: add new module to detect voicemail "beep" - * mod_voicemail: Add vm_alternate_greet_id param to directory entry (MODAPP-174) - * mod_voicemail: Patch to add voicemail preference controlling date announcement new param 'play-date-announcement' to values 'first' 'last' or 'never' defaults to first to retain previous behavior (MODAPP-121) - * mod_voicemail: Update mwi light after delete vm via web. (MODAPP-124) - * mod_voicemail: add ability to get to options without listening to every saved message (MODAPP-115) - * mod_voicemail: add ability to skip greeting when leaving a voicemail. (MODAPP-181) - * mod_voicemail: add change-pass-key config file option - * mod_voicemail: add forwarding support - * mod_voicemail: add local dtmf driven alternat vm pass - * mod_voicemail: add proper notification of a vm message being too short - * mod_voicemail: add support for auth via a1-hash - * mod_voicemail: add the "storage-dir" parameter to be set on a per-user basis (MODAPP-133) - * mod_voicemail: add voicemail_greeting_path variable - * mod_voicemail: added voicemail_alternate_greet_id variable - * mod_voicemail: allow changing of password from voicemail to update user directory if using non-static config (MODAPP-156) - * mod_voicemail: created email date (int overflow) (MODAPP-125) - * mod_voicemail: don't try to deliver vm when no file was recorded. (MODAPP-133) - * mod_voicemail: fix MWI with xml_curl used for directory (MODAPP-176) - * mod_voicemail: fix Voicemail messages occasionally lost / stranded (MODAPP-178) - * mod_voicemail: fix invalid event after message deleted (MODAPP-170) - * mod_voicemail: fix mwi for phones with multiple registrations problem (MODAPP-153) - * mod_voicemail: fix voicemail segfault on incorrect password (FSCORE-187) - * mod_voicemail: fix voicemail_inject error handling (MODAPP-133) - * mod_voicemail: fix voicemail_inject usage api call - * mod_voicemail: improve error checking (MODAPP-142) - * mod_voicemail: localize notification emails (MODAPP-139) - * mod_voicemail: make more multi-domain friendly (MODAPP-162) - * mod_voicemail: make playback created file macros optional (MODAPP-150) - * mod_voicemail: recognize operator key in more places (MODAPP-159) - * mod_voicemail: web interface displays incorrect created / last heard dates (MODAPP-123) - * mod_wanpipe: removed - * mod_xml_cdr: add https support - * mod_xml_cdr: add optional a-leg prefix to xml cdr filenames (MDXMLINT-39) - * mod_xml_cdr: add support for fallback webserver for cdr posting (FSCORE-238) - * mod_xml_curl: Allow specification of HTTP method, and dynamic expansion of variables in URI. (MDXMLINT-41) - * mod_xml_curl: added redirect following (max 10) - * mod_xml_ldap: almost a complete rewrite of this module - * mod_xml_rpc: allow setting of global realm without a global user (MDXMLINT-45) - * mod_xml_rpc: fix multiple segfaults - * mod_xml_rpc: fix segfault on originate via http - * sofia-sip: updated to 1.12.10 (plus a few patches) - - -- Mike Jerris <mike@jerris.com> Mon, 29 Dec 2008 14:46:00 -0500 - -freeswitch (1.0.1-1) unstable; urgency=low - - * FIX: prevent intercept race condition that can also be solved with continue_on_fail=originator_cancel - * FIX: NULL dereference detected by klockwork (www.klockwork.com) - * FIX: don't open failed local stream (MODFORM-9) - * FIX: instability in mod_local_stream in failure scenarios - * FIX: xmlrpc-c build on OS X 10.4 (FSBUILD-47) - * ENHANCEMENT: Added tab completion on many api commands in console - * ENHANCEMENT: polycom BLF support - * FIX: many sip NAT related fixes in mod_sofia - * FIX: support sip unregister with Contact: * - * FIX: multiple segfaults in xmlrpc-c - * FIX: sip unregister event being skipped - * FIX: hangup properly on malformed sip 3pcc calls being used as a way to ping - * ADD: enable-3pcc sofia profile param, it is now disabled by default. - * ADD: presence events to sip proxy mode - * ADD: legs param to cdr_csv - * ADD: support for perl as an embedded lanugage - * ENHANCEMENT: many new api's and functions to the embedded languages including api support, xml interface support, auto start scripts, and many new objects - * CHANGE: python embedded language api changed to match perl, lua, java - * FIX: many stability fixes in embedded langauges perl, lua, java, python - * ADD: failed_xml_cdr magic channel variable - * FIX: access free memory error in mod_sofia when using respond app - * ENHNACEMENT: make global_setvar only have 2 fields so you can set foo=bar=blah w/o quotes - * FIX: mod_spidermonkey keep hangup hook in the session thread - * ENHANCEMENT: mod_ldap added sasl support and search filters - * ADD: answered, waitForAnswer and mediaReady methods to embedded language Session object - * ENHANCEMENT: mod_voicemail param change to allow notification emails using templates - * ADD: per user acl in sofia - * FIX: deadlock in mod_portaudio - * ENHANCEMENT: blank username in sip will trigger a lookup for the user "nobody" - * ADD: import variable to import variables from a peer channel at time of originate - * FIX: api type fix for c++ modules when incorrectly using enums - * FIX: eliminate need for escaped , in [] on originate - * ADD: NDLB-force-rport option to force behavior as if rport was sent in the via - * ENHANCEMENT: honor execute_on_answer on outbound legs too - * ADD: execute_on_ring variable - * FIX: Seg fault in CoreSession() class destructor - * ADD: per channel caller id in originate - * ADD: sip_outgoing_call_id variable - * FIX: multiple memory leaks in mod_sofia - * FIX: find_local_ip IPv6 support - * ADD: variable expansion to on execute vars.(FSCORE-114) - * ADD: count optional arg to show calls and show channels (MODAPP-103) - * FIX: MODEVENT-25 (WSAWOULDBLOCK error on socket send in windows) in event socket - * FIX: multiple fixes to the logic in mod_say_zh - * ADD: inter digit timeout to swigged embedded languages getDigits method. (MODLANG-65) - * ADD: Linksys P-RTP-Stat SIP header values (SFSIP-66) - * FIX: small leak in core - * ADD: progress_timeout var to originate - * UPDATE: portaudio library - * FIX: added timeout to iax read - * ADD: 'pa rescan' to portaudio to look for new devices - * FIX: wait for broadcast to start when starting async hold to avoid race - * FIX: mod_rss, don't always play the first news feed - * FIX: mod_rss inverval to use the session inteval (audio problems on 30ms channels) - * ADD: Path: support in mod_sofia on register - * FIX: mod_shout record stream - * ENHANCEMENT: mod_voicemail support for effective_caller_id_name/number - * ADD: url encode/decode api calls - * FIX: "nua()" in debug information in sofia instead of the real function name - * FIX: better handling of sips: uris - * FIX: don't seg when using more than SWITCH_MAX_CODECS and bump SWITCH_MAX_CODECS to 50 (we have more than 30 in tree) (MODFORM-10) - * ADD: mod_yaml - * FIX: segfault on freeswitch startup if installed directories are removed - * FIX: segfault when intercept with inbound_late_negotiation=true set - * FIX: dont flood logs with eavesdrop messages (MODAPP-101) - * FIX: don't destroy a codec that has not been created (MODAPP-101) - * ENHANCEMENT: allows the "eavesdrop_group" variable to contain several groups, comma separated. (MODAPP-101) - * FIX: cross compile (FSBUILD-53) - * FIX: add header that Nuaunce considers mandatory (MODASRTTS-5) - * ADD: write locks to the core and a function to unregister event bindings (adds better ability to unload modules) - * ENHANCEMENT: make modules unbind events and un-reserve subclasses on module unload - * ADD: removable xml hook bindings - * ADD: EventConsumer object to embedded languages so you can make event handlers - * FIX: sending CN with supress-cng true - * FIX: segfault in the event system when trying to remove NULL event - * ADD: flags to turn off srtp auth and rtp auto adj (FSCORE-149 && MODENDP-115) - * FIX: use lighter math and avoid infinite loop in port allocator (FSCORE-148) - * ENHANCEMENT: let conference pin entry start during prompt (MODAPP-111) - * ADD: mod_pocketsphinx - * FIX: Misuse of SQLRowCount, issues with MSSQL (MODAPP-105) - * FIX: segfaults in mod_python with dtmf callback - * ENHANCEMENT: mod_conference auto-record parameter (MODAPP-112) - * ENHANCEMENT: reload support to many modules - * FIX: mod_sofia add replaces to supported header - * ENHANCEMENT: add args callback to sleep so you can process dtmf and events while "sleeping" - * ADD: mod_flite - * ENHANCEMENT: switch_xml converted back to c code and support double globs on windows - * ENHANCEMENT: mod_sofia support for adding and removing gateways without restarting profiles - * ADD: extract contact header info into A channel when unhandled 3xx response is received (MODENDP-116) - * FIX: outbound event_socket + late negotiation - * ADD: copy_xml_cdr variable - * ADD: silence_stream (like tone_stream but silent) - * ADD: module_exists api call - * ADD: emailer implementation for windows - * ADD: wait_for_silence application - * FIX: no error message generated if OS is unable to load a module ( due to dependency/installation issues ) - * FIX: segfault in media bugs - * FIX: acl lists not correctly matching all ip adresses - * FIX: mod_spidermonkey exit() does not stop script when called from the hangup callback (return "exit" from the callback) - * FIX: mod_syslog works again - * FIX: crash on terminal resize - * FIX: audio problems on big endian - * ENHANCEMENT: Disable multiple registrations on a per-device basis (MODENDP-117) - * ADD: fifo_consumer_exit_key variable (MODAPP-100) - * ADD: cidr based user auth in mod_sofia - * ADD: uuid_send_dtmf fsapi command (MODAPP-114) - * ADD: server registration fiels to sip_registration database (MODENDP-118) - * FIX: use a variable, realm or to host to find gateway when it's not obvious (handles challenged REFER) - * ADD: timeout to curl run in javascript - * ADD: voicemail_inject fsapi command - * ADD: reboot option for sip phones to flush_inboud_reg sofia profile api command - * FIX: add small padding to end of mp3 to avoid cut off mp3 recording - * FIX: patch multiple SDP connection lines in sdp for proxy media mode (MODENDP-109) - * FIX: don't parse ringback varable in proxy situations - * ADD: per call vm recording ext with vm_message_ext variable - * ADD: sip_bye_h prefix to add headers to bye - * ENHANCEMENT: more interfaces available in show fsapi command - * FIX: don't leak in buffers on realloc fail - * FIX: fail out of a conference call if write fails - * ADD: auto ip-change detection - * ADD: mod_snom - * FIX: mod_sofia don't send sipfrag on transfer to cisco so they don't hang up the call - - -- Mike Jerris <mike@jerris.com> Thu, 24 Jul 2008 07:00:00 -0500 - -freeswitch (1.0.1~trunk) unstable; urgency=low - - * Updated revision number - * Fixed init problem reported by Jay Binks (FSSCRIPTS-1) - * Added a patch to the debian build system add more features (thanks to Hadley Rich) (FSBUILD-45) - - Added en-us-callie sounds and music on hold packages - - Added recommends and suggests - - Added mod_say_es and mod_say_nl - - Updated descriptions - - Added mod_cdr_csv - * Fixed typos and some errors in the previus patch. - * Modified monit script. Now it should work. - * The debian build system now bootstrap automagically if it's necessary and all scripts are in place. - - -- Massimo Cetra <devel@navynet.it> Sun, 6 Jul 2008 16:30:00 +0100 - -freeswitch (1.0.0-1) unstable; urgency=low - - * Enhanced sofia sip nat handling - * Many fixes found by Klockwork (www.klocwork.com) - * Added disable_app_log variable - * Fixed mod_local_stream with rates on windows - * Fixed finding of files in rate dirs on windows - * Fixed memory corruption from sofia_contact function - * Added sofia profile param NDLB-received-in-nat-reg-contact - * Added sofia profile param aggressive-nat-detection - * Fixed video sip calls in proxy media mode - * Added bridge_terminate_key var - * Update xmlrpc-c lib to trunk revision from upstream, fix windows xmlrpc - * Enhanced nat handling in proxy media mode in sip - * Add progress media to timetable so you can calculate pdd - * Fixed seg when using unicast on socket when call has no read_codec - * Fixed missed log events on busy box - * Added -bleg to intercept - * Enhance configure detection of python - * Fixed build on solaris and freebsd for several modules - * Added param "vm-email-only" to make voicemail sent by email only (previously default behavior) - * Added param "vm-mailto-notify" to allow sending a notification email - * Fixed mod_java build - * Fixed mwi failures for some devices that don't subscribe - * Removed fsapi functions (killchan, transfer, session_displace, reject) - * Removed fsapi functions (session_record, broadcast, hold, media) - * Many updates to sofia-sip library including over 100 fixes - - -- Michael Jerris <mike@jerris.com> Tue, 27 May 2008 01:30:00 -0400 - -freeswitch (1.0~rc6-1) unstable; urgency=low - - * Changed to not allow pass_2833 on transcoded calls - (it never worked, now it will tell you) - * Enhanced sofia sip nat handling - * Fix libedit build on solaris - * Fix session timers in mod_sofia - * Fix conference fire-call - * Change: add var_event down into the endpoints so chans - with no parents can still pass options - * Added enable-post-var param to xml_rpc - * Fix mod_lua build on solaris - * Many fixes found by Klockwork (www.klocwork.com) - * Add unregister event in mod_sofia - * Enhance python configure detection - * Add vm_boxcount api func - * Fixed att_xfer issue - * Fix sip now includes the Allow-Events header in more places - - -- Michael Jerris <mike@jerris.com> Tue, 13 May 2008 02:01:00 -0400 - -freeswitch (1.0~rc5-1) unstable; urgency=low - - * Changed internal state names to avoid confusion - Fixed video negotiation - Enhanced accuracy of windows timer - Fixed mod_ldap build - Added dialplan and context to sql table for channels - Multiple fixes to mod_lua and mod_perl - Fixed logic bug in fifo causing segfault - internal changes to sip stack so we can remove a hash redundant to the stack - Fixed multiple memory leaks in mod_sofia - Fixed event fetch segfault on sip subscribe - Fixed segfault on timer rollover in sofia on 64bit - Fixed audio timing issues in mod_portaudio - Changed names of sip profiles in default config to avoid confusion - Fixed memory usage leak-like behavior when playing files requiring resampling - Removed some unused api's - Fix rtp timeout when playing moh - Removed some un-needed libraries and files from tree - Fixed multiple issues in sip stack including multiple segfaults - Added support for sip transfers on bypass_media and proxy_media calls - Added say application - Fixed --disable-debug configure option - Enhanced switch_cpp wrapper (and perl, python, lua, java) - Fixed segfault on inavalid stun response - Fixed configure help output - Fixed segfault on mp3 playback - Fixed assert on invalid sdp (missing m= line) - Added configurable windows service name - Fixed proxy mode call transition to non proxy call - Fixed solaris build of voipcodecs - Fixed sofia seg when call failure edge case - - -- Michael Jerris <mike@jerris.com> Tue, 13 May 2008 02:01:00 -0400 - -freeswitch (1.0~8327) unstable; urgency=low - - * Adding perl and lua separate packages - * Adding mod_voipcodecs - - -- root <root@fs.navynet.it> Tue, 6 May 2008 09:46:26 +0000 - -freeswitch (1.0~rc4-1) unstable; urgency=low - * Add tab completion in cli - Add "inline" dialplan - Fixed segfault in enum - Enhance enum to fork dial equal priority entries - Added auto-reload to enum - Fixed odbc bug is mod_sofia presence handling - Add presence for conference and dial an eavesdrop - Fix stack overflow segfault when recursively parking calls - Fixed race is sofia registration handling - Enhance sofia registration, unregister on keep-alive OPTIONS failure - Added internal routing loop detection/avoidance - Fixed race in bgapi in event socket - Fixed vars to execute apps before bridge "bridge_pre_execute_aleg_app" and "bridge_pre_execute_bleg_app" - Fixed re-setting sound prefix to no prefix after a pharse - Enhanced setting of bracket vars from originate so they show in the CHANNEL_ORIGINATE event - Add "enable-timer" and "enable-100rel" options to turn off default behaviors in sofia - Add originate_timeout to originate vars - Fixed hanging channels in mod_portaudio - Added auto time sync on vps migration to different hardware - Fixed seg on transfer when both legs are not sip - Added configurable dtmf duration defaults - Enhanced voicemail, allow interruption of hello message - Fixed voicemail to not light up light on saved messages - Enhance mod_amr honor disable dtx in fmtp (MODCODEC-3) - Fixed bootstrap to install automake dependencies so you can use tarball without same version of automake installed - Fixed MODLANG-56 (bad audio on originate and javascript streamFile) - Added hold/unhold dialplan apps - Enhanced sofia error checking to outlaw 0.0.0.0 in sofia ip params - Backport fixes from sofia-sip tree - Fixed MSVC build - Fixed segfault on sip SUBSCRIBE with Expires: 0 - Added mod_say_zh - Added --with-pyton and --with-pyton-config configure options - Added mod_lua - Enhanced switch_cpp wrapper in core and normalized interfaces for perl, python, lua, and java - Fixed multiple issues in cpp wrapper and the languages perl, python, lua and java - Added back mod_perl - Added sofia gateway option ping to adjust options ping frequency - Added .net event socket lib to contrib - Fixed passing of exact response codes of sip across a bridge - Added mod_reference, reference endpoint module - Enhanced build so you can now make commented out modules using "make mod_name" - - -- Michael Jerris <mike@jerris.com> Wed, 23 Apr 2008 12:58:00 -0400 - -freeswitch (1.0~rc3-1) unstable; urgency=low - * Enhance xml menu system - fixes upstream from sofia-sip library - Enhance mod_fifo - added close method to ODBC spidermonkey class - Fix multiple bugs in the cpp wrapper used in mod_java and mod_python - Fix hung sip channel issue using respond app or on re-invite with bypass media after 1xx or 2xx responses - - -- Michael Jerris <mike@jerris.com> Wed, 9 Apr 2008 12:58:22 -0400 - -freeswitch (1.0~rc2-1) unstable; urgency=low - * Fixed speex protocol negotiation issues (8k vs 16k) - Fixed mod_iax race conditions - Fixed ptime negotiation issues when re-packetizing - Added ip based acl lists - * - -- Michael Jerris <mike@jerris.com> Wed, 9 Apr 2008 12:58:22 -0400 - -freeswitch (1.0~rc1-1) unstable; urgency=low - * loads of fixes - new cdr-csv module - new spidermonkey-curl module - - -- Michal Bielicki <michal.bielicki@voiceworks.pl> Mon, 14 Jan 2008 23:37:04 +0100 - -freeswitch (1.0~beta3-1) unstable; urgency=low - - * Additional scripts for changing the user to freeswitch - Added Startup Scripts - Monit integration - Settings file for integration into init - init.d file - added user freeswitch to own and run all off freeswitch - cleaned up config file control - new upstream release - split off codec pakcages - split off spidermonkey packages - - -- Michal Bielicki <michal.bielicki@voiceworks.pl> Tue, 27 Nov 2007 13:20:21 +0100 - -freeswitch (1.0~beta2-1) unstable; urgency=low - - * New upstream release - - -- Paul van Genderen <paulvg@member.fsf.org> Wed, 17 Oct 2007 19:32:09 +0200 - -freeswitch (1.0~beta1-1) unstable; urgency=low - - * New packages. - - -- Robert McQueen <robot101@debian.org> Sun, 12 Nov 2006 17:32:23 -0500 diff --git a/debian/freeswitch-freetdm/usr/share/doc/freeswitch-freetdm/copyright b/debian/freeswitch-freetdm/usr/share/doc/freeswitch-freetdm/copyright deleted file mode 100644 index 45eb67b..0000000 --- a/debian/freeswitch-freetdm/usr/share/doc/freeswitch-freetdm/copyright +++ /dev/null @@ -1,51 +0,0 @@ -This package was debianized by Michal Bielicki -<michal.bielicki@voiceworks.pl> on Now 25, 2007. - -The current Debian maintainer is Nicholas Amorim <nicholas@montrealconsultoria.com.br> - -The source was downloaded from http://www.freewitch.org/ - -Upstream authors: -Anthony Minessale II <anthmct@yahoo.com> -Portions created by the Initial Developer are Copyright (C) 2006-2009 -the Initial Developer. All Rights Reserved. - -The PRIMARY AUTHORS are (and/or have been): - - Anthony Minessale II <anthmct@yahoo.com> - Primary developer of all core components - and many of the included modules. Much of freeswitch is based on his work. - - Michael Jerris <mike@jerris.com> - Windows porter and responsible for the - windows\msvc build system. - -And here is an inevitably incomplete list of MUCH-APPRECIATED CONTRIBUTORS -- -people who have submitted patches, reported bugs, and generally made Freeswitch -that much better: - - Brian K. West - For countless hours of work on BSD and Mac support, finding countless bugs, and moral support. Xcode project files. - Joshua Colp - For his help making mod_exosip possible (which we are now getting rid of but oh well), - and for just being a swell guy! (until he backstabbed us, c'est la vie) - Michal "cypromis" Bielicki (michal.bielicki AT voiceworks.pl) - Solaris porting, and autotools enhancements, debian, rpm and solaris packaging. - James Martelletti <james@nerdc0re.com> - All around cool guy (mod_syslog) - Johny Kadarisman <jkr888@gmail.com> - Yossi Neiman of Cartis Solutions, Inc. <freeswitch AT cartissolutions.com> - implementation of mod_cdr (perldd, mysql, csv) - Stefan Knoblich - Various patches and support. Thanks. - Justin Unger - <justinunger at gmail dot com> Lots of help with patches and SIP testing. Thanks! - Paul D. Tinsley - Various patches and support. <pdt at jackhammer.org> - Ken Rice - <krice AT suspicious.org> - xmlcdr, sofia improvements, load testing. - Neal Horman <neal at wanlink dot com> - conference improvements, switch_ivr menu additions and other tweaks. - Johny Kadarisman <jkr888 at gmail.com> - mod_python fixups. - Michael Murdock <mike at mmurdock dot org> - testing, documentation, bug finding and usability enhancements. - Matt Klein <mklein@nmedia.net> - Jonas Gauffin <jonas at gauffin dot org> - Bugfixes and additions in mod_spidermonkey_odbc - Damjan Jovanovic <moctodliamgtavojtodnajmad backwards> - mod_java - -A big THANK YOU goes to: - -Justin Cassidy - Build related cleanups and automatic build setup. -Bret McDanel - Javascript Documentation, constant feedback and input, many other things I am sure I am forgetting. - -You are free to distribute this software under the terms of -the MPL Mozilla Public License. On Debian systems, the complete -text of the GNU General Public License can be found in the file -'/usr/share/common-licenses/MPL'. diff --git a/debian/freeswitch.install b/debian/freeswitch.install index aa240a7..f0c6fa8 100644 --- a/debian/freeswitch.install +++ b/debian/freeswitch.install @@ -100,7 +100,6 @@ opt/freeswitch/conf/sip_profiles/internal-ipv6.xml opt/freeswitch/conf/sip_profiles/internal.xml opt/freeswitch/conf/skinny_profiles/internal.xml opt/freeswitch/conf/tetris.ttml -opt/freeswitch/conf/tones.conf opt/freeswitch/conf/vars.xml opt/freeswitch/conf/voicemail.tpl opt/freeswitch/conf/web-vm.tpl @@ -158,7 +157,6 @@ opt/freeswitch/mod/mod_skypopen.so* opt/freeswitch/mod/mod_sndfile.so* opt/freeswitch/mod/mod_snom.so* opt/freeswitch/mod/mod_sofia.so* -opt/freeswitch/mod/mod_soundtouch.so* opt/freeswitch/mod/mod_spandsp.sp* opt/freeswitch/mod/mod_speex.so* opt/freeswitch/mod/mod_spy.so* diff --git a/debian/rules b/debian/rules index 442d82e..0c1aae9 100755 --- a/debian/rules +++ b/debian/rules @@ -15,7 +15,7 @@ export APPLICATION_MODULES_AE= applications/mod_avmd applications/mod_callcenter export APPLICATION_MODULES_FM= applications/mod_fifo applications/mod_fsv applications/mod_hash applications/mod_lcr applications/mod_limit \ applications/mod_memcache export APPLICATION_MODULES_NY= applications/mod_nibblebill applications/mod_redis applications/mod_rss applications/mod_snom \ - applications/mod_soundtouch applications/mod_spandsp applications/mod_spy applications/mod_stress \ + applications/mod_spandsp applications/mod_spy applications/mod_stress \ applications/mod_valet_parking applications/mod_vmd applications/mod_voicemail export APPLICATIONS_MODULES= $(APPLICATION_MODULES_AE) $(APPLICATION_MODULES_FM) $(APPLICATION_MODULES_NY) $(APPLICATION_MODULES_VZ) @@ -23,7 +23,6 @@ export ASR_TTS_MODULES= asr_tts/mod_pocketsphinx asr_tts/mod_unimrcp export CODECS_MODULES= codecs/mod_bv codecs/mod_h26x codecs/mod_speex codecs/mod_celt codecs/mod_codec2 codecs/mod_ilbc codecs/mod_mp4v \ codecs/mod_silk codecs/mod_siren codecs/mod_theora export DIALPLANS_MODULES= dialplans/mod_dialplan_asterisk dialplans/mod_dialplan_directory dialplans/mod_dialplan_xml -export DIRECTORIES_MODULES= export ENDPOINTS_MODULES= endpoints/mod_dingaling endpoints/mod_portaudio endpoints/mod_sofia \ endpoints/mod_loopback ../../libs/frieetdm/mod_freetdm endpoints/mod_skypopen \ endpoints/mod_skinny @@ -33,9 +32,8 @@ export FORMATS_MODULES= formats/mod_file_string formats/mod_local_stream formats export LANGUAGES_MODULES=languages/mod_spidermonkey languages/mod_perl languages/mod_lua languages/mod_python export LOGGERS_MODULES=loggers/mod_console loggers/mod_logfile loggers/mod_syslog export SAY_MODULES=say/mod_say_en say/mod_say_it say/mod_say_de say/mod_say_fr say/mod_say_es say/mod_say_nl say/mod_say_ru -export TIMERS_MODULES= export XML_INT_MODULES=xml_int/mod_xml_rpc xml_int/mod_xml_curl xml_int/mod_xml_cdr -export MYMODULES=$(PASSTHRU_CODEC_MODULES) $(APPLICATIONS_MODULES) $(ASR_TTS_MODULES) $(CODECS_MODULES) $(DIALPLANS_MODULES) $(DIRECTORIES_MODULES) $(ENDPOINTS_MODULES) $(EVENT_HANDLERS_MODULES) $(FORMATS_MODULES) $(LANGUAGES_MODULES) $(LOGGERS_MODULES) $(SAY_MODULES) $(TIMERS_MODULES) $(XML_INT_MODULES) +export MYMODULES=$(PASSTHRU_CODEC_MODULES) $(APPLICATIONS_MODULES) $(ASR_TTS_MODULES) $(CODECS_MODULES) $(DIALPLANS_MODULES) $(ENDPOINTS_MODULES) $(EVENT_HANDLERS_MODULES) $(FORMATS_MODULES) $(LANGUAGES_MODULES) $(LOGGERS_MODULES) $(SAY_MODULES) $(XML_INT_MODULES) export MODULES=$(MYMODULES) ifndef AUTOCONF commit 38a64b696d674e415934d1f269468d0465a09bf1 Merge: b63767b db9c8c9 Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Oct 14 15:10:07 2010 -0400 Merge branch 'master' of homer:smg_freeswitch commit b63767bcb8a02c9542c072c722d72b04d20eae2f Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Oct 14 14:52:17 2010 -0400 Added poll for events on b-channels diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 0ed5902..89626a2 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -265,10 +265,12 @@ static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj) } while (ftdm_running() && !(ftdm_test_flag(span, FTDM_SPAN_STOP_THREAD))) { - /* find out why we returned from the interrupt queue */ - ret_status = ftdm_interrupt_multiple_wait(ftdm_sangoma_isdn_int, 2, sleep); + /* Check if there are any timers to process */ ftdm_sched_run(signal_data->sched); + + ret_status = ftdm_interrupt_multiple_wait(ftdm_sangoma_isdn_int, 2, sleep); + /* find out why we returned from the interrupt queue */ switch (ret_status) { case FTDM_SUCCESS: /* there was a state change on the span */ /* process all pending state changes */ @@ -289,13 +291,30 @@ static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj) /* twiddle */ break; case FTDM_FAIL: - ftdm_log(FTDM_LOG_ERROR,"ftdm_interrupt_wait returned error!\non span = %s\n", span->name); + ftdm_log(FTDM_LOG_ERROR,"%s:ftdm_interrupt_wait returned error!\n", span->name); break; default: - ftdm_log(FTDM_LOG_ERROR,"ftdm_interrupt_wait returned with unknown code on span = %s\n", span->name); + ftdm_log(FTDM_LOG_ERROR,"%s:ftdm_interrupt_wait returned with unknown code\n", span->name); break; } + + /* Poll for events, e.g HW DTMF */ + ret_status = ftdm_span_poll_event(span, 0); + switch(ret_status) { + case FTDM_SUCCESS: + { + ftdm_event_t *event; + while (ftdm_span_next_event(span, &event) == FTDM_SUCCESS); + } + break; + case FTDM_TIMEOUT: + /* No events pending */ + break; + default: + ftdm_log(FTDM_LOG_WARNING, "%s:Failed to poll span event\n", span->name); + } + if (ftdm_sched_get_time_to_next_timer(signal_data->sched, &sleep) == FTDM_SUCCESS) { if (sleep < 0 || sleep > SNGISDN_EVENT_POLL_RATE) { sleep = SNGISDN_EVENT_POLL_RATE; commit db9c8c9db6ecfc6dd196c377dd91ccbd604d445b Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Oct 14 14:19:54 2010 -0400 Fix for destination_number_ton and destination_number_npi not set on incoming calls diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 691e310..a77fb05 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -188,11 +188,11 @@ ftdm_status_t cpy_called_num_from_stack(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPt } if (cdPtyNmb->nmbPlanId.pres == PRSNT_NODEF) { - ftdm->cid_num.plan = cdPtyNmb->nmbPlanId.val; + ftdm->dnis.plan = cdPtyNmb->nmbPlanId.val; } if (cdPtyNmb->typeNmb0.pres == PRSNT_NODEF) { - ftdm->cid_num.type = cdPtyNmb->typeNmb0.val; + ftdm->dnis.type = cdPtyNmb->typeNmb0.val; } if (cdPtyNmb->nmbDigits.pres == PRSNT_NODEF) { commit eb10a9ef8df21fc0e0064fae58bb43a401085a83 Author: Michal Bielicki <cypromis@debian-buildtesst> Date: Thu Oct 14 19:01:00 2010 +0200 updated modules in .debs to sync with .spec. left out flite since it requres more than 384mb to build debs with. diff --git a/debian/changelog b/debian/changelog index 7f4e8d7..f35e705 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,8 @@ +freeswitch (1.0.7-1headgit1) maverick; urgency=low + * upgrade: Added mod_amrwb + * upgrade version to 1.0.7 ... 1.0.6 was last realease + + -- Michal Bielicki <michal.bielicki@seventhsignal.de> Wed, 13 Oct 2010 22:58:48 -0200 freeswitch (1.0.6-1ubuntu1) maverick; urgency=low [ Gabriel Gunderson ] diff --git a/debian/control b/debian/control index 92b4e6a..b3c7141 100644 --- a/debian/control +++ b/debian/control @@ -123,6 +123,19 @@ Description: pass through AMR codec support for FreeSWITCH . This package contains the mod_amr codec module. +Package: freeswitch-codec-passthru-amrwb +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch +Description: pass through AMRWB codec support for FreeSWITCH + FreeSWITCH is an open source telephony platform designed to facilitate the + creation of voice and chat driven products scaling from a soft-phone up to a + soft-switch. It can be used as a simple switching engine, a PBX, a media + gateway or a media server to host IVR applications using simple scripts or XML + to control the callflow. + . + This package contains the mod_amrwb codec module. + + Package: freeswitch-codec-passthru-g729 Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch @@ -229,3 +242,8 @@ Description: Russian language files for FreeSWITCH . This package contains the mod_say_ru module and available language configuration files. + +Package: freeswitch-freetdm +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch +Description: FreeTDM is a signaling and board API abstraction used mainly by the FreeSWITCH project to place calls in TDM and analog telephony circuits. The library was previously named "OpenZAP". Sangoma has worked along with the FreeSWITCH developers in this library so Sangoma's customers can also use it to do custom development. The library is still under heavy development but the overall API does not change often. The intention of the library is to present a consistent API for different telephony signaling stacks and board I/O APIs. FreeTDM can either be used as a standalone API or along with FreeSWITCH as an endpoint (mod_freetdm). If you want to use it as a part of FreeSWITCH remember following the FreeSWITCH configuration section. diff --git a/debian/freeswitch.conffiles b/debian/freeswitch.conffiles index a6f9ce3..1d2cd26 100644 --- a/debian/freeswitch.conffiles +++ b/debian/freeswitch.conffiles @@ -83,10 +83,8 @@ /opt/freeswitch/conf/ivr_menus/demo_ivr.xml /opt/freeswitch/conf/jingle_profiles/client.xml /opt/freeswitch/conf/jingle_profiles/server.xml -/opt/freeswitch/conf/m3ua.conf /opt/freeswitch/conf/mime.types /opt/freeswitch/conf/notify-voicemail.tpl -/opt/freeswitch/conf/pika.conf /opt/freeswitch/conf/sip_profiles/external/example.xml /opt/freeswitch/conf/sip_profiles/external.xml /opt/freeswitch/conf/sip_profiles/internal/example.xml @@ -98,4 +96,3 @@ /opt/freeswitch/conf/vars.xml /opt/freeswitch/conf/voicemail.tpl /opt/freeswitch/conf/web-vm.tpl -/opt/freeswitch/conf/zt.conf diff --git a/debian/freeswitch.install b/debian/freeswitch.install index 087d167..aa240a7 100644 --- a/debian/freeswitch.install +++ b/debian/freeswitch.install @@ -1,5 +1,6 @@ opt/freeswitch/bin/freeswitch opt/freeswitch/bin/fs_cli +opt/freeswitch/bin/fs_encode opt/freeswitch/bin/fs_ivrd opt/freeswitch/bin/fsxs opt/freeswitch/bin/gentls_cert @@ -31,7 +32,6 @@ opt/freeswitch/conf/autoload_configs/memcache.conf.xml opt/freeswitch/conf/autoload_configs/modules.conf.xml opt/freeswitch/conf/autoload_configs/nibblebill.conf.xml opt/freeswitch/conf/autoload_configs/opal.conf.xml -opt/freeswitch/conf/autoload_configs/openzap.conf.xml opt/freeswitch/conf/autoload_configs/pocketsphinx.conf.xml opt/freeswitch/conf/autoload_configs/portaudio.conf.xml opt/freeswitch/conf/autoload_configs/post_load_modules.conf.xml @@ -91,11 +91,8 @@ opt/freeswitch/conf/fur_elise.ttml opt/freeswitch/conf/ivr_menus/demo_ivr.xml opt/freeswitch/conf/jingle_profiles/client.xml opt/freeswitch/conf/jingle_profiles/server.xml -opt/freeswitch/conf/m3ua.conf opt/freeswitch/conf/mime.types opt/freeswitch/conf/notify-voicemail.tpl -opt/freeswitch/conf/openzap.conf -opt/freeswitch/conf/pika.conf opt/freeswitch/conf/sip_profiles/external/example.xml opt/freeswitch/conf/sip_profiles/external.xml opt/freeswitch/conf/sip_profiles/internal/example.xml @@ -106,66 +103,71 @@ opt/freeswitch/conf/tetris.ttml opt/freeswitch/conf/tones.conf opt/freeswitch/conf/vars.xml opt/freeswitch/conf/voicemail.tpl -opt/freeswitch/conf/wanpipe.conf opt/freeswitch/conf/web-vm.tpl -opt/freeswitch/conf/zt.conf opt/freeswitch/htdocs/* opt/freeswitch/lib/libfreeswitch*.so* -opt/freeswitch/lib/libopenzap*.so* +opt/freeswitch/mod/mod_avmd.so* +opt/freeswitch/mod/mod_bv.so* opt/freeswitch/mod/mod_callcenter.so* opt/freeswitch/mod/mod_cdr_csv.so* opt/freeswitch/mod/mod_celt.so* opt/freeswitch/mod/mod_cidlookup.so* opt/freeswitch/mod/mod_cluechoo.so* +opt/freeswitch/mod/mod_console.so* +opt/freeswitch/mod/mod_codec2.so* opt/freeswitch/mod/mod_commands.so* opt/freeswitch/mod/mod_conference.so* opt/freeswitch/mod/mod_console.so* opt/freeswitch/mod/mod_curl.so* +opt/freeswitch/mod/mod_db.so* opt/freeswitch/mod/mod_dialplan*.so* opt/freeswitch/mod/mod_dingaling.so* opt/freeswitch/mod/mod_directory.so* +opt/freeswitch/mod/mod_distributor.so* opt/freeswitch/mod/mod_dptools.so* opt/freeswitch/mod/mod_easyroute.so* opt/freeswitch/mod/mod_enum.so* opt/freeswitch/mod/mod_esf.so* opt/freeswitch/mod/mod_event_*.so* opt/freeswitch/mod/mod_expr.so* -opt/freeswitch/mod/mod_spandsp.so* opt/freeswitch/mod/mod_fifo.so* +opt/freeswitch/mod/mod_file_string.so* +opt/freeswitch/mod/mod_flite.so* opt/freeswitch/mod/mod_fsv.so* +opt/freeswitch/mod/mod_hash.so* opt/freeswitch/mod/mod_h26x.so* opt/freeswitch/mod/mod_ilbc.so* opt/freeswitch/mod/mod_lcr.so* -opt/freeswitch/mod/mod_db.so* -opt/freeswitch/mod/mod_hash.so* +opt/freeswitch/mod/mod_limit.so* opt/freeswitch/mod/mod_local_stream.so* opt/freeswitch/mod/mod_logfile.so* opt/freeswitch/mod/mod_loopback.so* +opt/freeswitch/mod/mod_memcache.so* +opt/freeswitch/mod/mod_mp4v.so* opt/freeswitch/mod/mod_native_file.so* opt/freeswitch/mod/mod_nibblebill.so* -opt/freeswitch/mod/mod_openzap.so opt/freeswitch/mod/mod_portaudio.so* +opt/freeswitch/mod/mod_portaudio_stream.so* +opt/freeswitch/mod/mod_redis.so* opt/freeswitch/mod/mod_rss.so* opt/freeswitch/mod/mod_shout.so* +opt/freeswitch/mod/mod_silk.so* opt/freeswitch/mod/mod_siren.so* opt/freeswitch/mod/mod_skinny.so* opt/freeswitch/mod/mod_skypopen.so* opt/freeswitch/mod/mod_sndfile.so* opt/freeswitch/mod/mod_snom.so* opt/freeswitch/mod/mod_sofia.so* +opt/freeswitch/mod/mod_soundtouch.so* +opt/freeswitch/mod/mod_spandsp.sp* opt/freeswitch/mod/mod_speex.so* opt/freeswitch/mod/mod_spy.so* opt/freeswitch/mod/mod_syslog.so* +opt/freeswitch/mod/mod_theora.so* opt/freeswitch/mod/mod_tone_stream.so* opt/freeswitch/mod/mod_tts_commandline.so* +opt/freeswitch/mod/mod_unimrcp.so* opt/freeswitch/mod/mod_valet_parking.so* opt/freeswitch/mod/mod_vmd.so* opt/freeswitch/mod/mod_voicemail.so* opt/freeswitch/mod/mod_xml_*.so* -opt/freeswitch/mod/ozmod_analog_em.so* -opt/freeswitch/mod/ozmod_analog.so* -opt/freeswitch/mod/ozmod_isdn.so* -opt/freeswitch/mod/ozmod_skel.so* -opt/freeswitch/mod/ozmod_ss7_boost.so* -opt/freeswitch/mod/ozmod_wanpipe.so* -opt/freeswitch/mod/ozmod_zt.so* diff --git a/debian/rules b/debian/rules index 114ad64..442d82e 100755 --- a/debian/rules +++ b/debian/rules @@ -6,33 +6,36 @@ export DH_VERBOSE=1 export DH_OPTIONS export DEB_DH_INSTALL_SOURCEDIR=debian/tmp -export PASSTHRU_CODEC_MODULES=codecs/mod_g729 codecs/mod_g723_1 codecs/mod_amr +export PASSTHRU_CODEC_MODULES=codecs/mod_g729 codecs/mod_g723_1 codecs/mod_amr codecs/mod_amrwb # Modules listed by those built by default, then those that are added in this package -export APPLICATIONS_MODULES=applications/mod_cluechoo applications/mod_commands applications/mod_conference applications/mod_dptools \ - applications/mod_enum applications/mod_esf applications/mod_expr applications/mod_fifo applications/mod_fsv \ - applications/mod_hash applications/mod_db applications/mod_valet_parking applications/mod_voicemail applications/mod_rss \ - applications/mod_spandsp applications/mod_cidlookup applications/mod_curl applications/mod_easyroute \ - applications/mod_lcr applications/mod_nibblebill applications/mod_snom \ - applications/mod_spy applications/mod_vmd applications/mod_directory applications/mod_callcenter -export ASR_TTS_MODULES=asr_tts/mod_tts_commandline -export CODECS_MODULES=codecs/mod_ilbc codecs/mod_h26x codecs/mod_speex codecs/mod_siren codecs/mod_celt -export DIALPLANS_MODULES=dialplans/mod_dialplan_asterisk dialplans/mod_dialplan_directory dialplans/mod_dialplan_xml +export APPLICATION_MODULES_AE= applications/mod_avmd applications/mod_callcenter applications/mod_cidlookup applications/mod_cluechoo \ + applications/mod_commands applications/mod_conference applications/mod_db applications/mod_directory \ + applications/mod_distributor applications/mod_dptools applications/mod_easyroute applications/mod_enum \ + applications/mod_esf applications/mod_expr +export APPLICATION_MODULES_FM= applications/mod_fifo applications/mod_fsv applications/mod_hash applications/mod_lcr applications/mod_limit \ + applications/mod_memcache +export APPLICATION_MODULES_NY= applications/mod_nibblebill applications/mod_redis applications/mod_rss applications/mod_snom \ + applications/mod_soundtouch applications/mod_spandsp applications/mod_spy applications/mod_stress \ + applications/mod_valet_parking applications/mod_vmd applications/mod_voicemail + +export APPLICATIONS_MODULES= $(APPLICATION_MODULES_AE) $(APPLICATION_MODULES_FM) $(APPLICATION_MODULES_NY) $(APPLICATION_MODULES_VZ) +export ASR_TTS_MODULES= asr_tts/mod_pocketsphinx asr_tts/mod_unimrcp +export CODECS_MODULES= codecs/mod_bv codecs/mod_h26x codecs/mod_speex codecs/mod_celt codecs/mod_codec2 codecs/mod_ilbc codecs/mod_mp4v \ + codecs/mod_silk codecs/mod_siren codecs/mod_theora +export DIALPLANS_MODULES= dialplans/mod_dialplan_asterisk dialplans/mod_dialplan_directory dialplans/mod_dialplan_xml export DIRECTORIES_MODULES= -export DOTNET_MODULES= -export ENDPOINTS_MODULES=endpoints/mod_dingaling endpoints/mod_portaudio endpoints/mod_sofia \ - endpoints/mod_loopback ../../libs/openzap/mod_openzap endpoints/mod_skypopen \ - endpoints/mod_skinny +export ENDPOINTS_MODULES= endpoints/mod_dingaling endpoints/mod_portaudio endpoints/mod_sofia \ + endpoints/mod_loopback ../../libs/frieetdm/mod_freetdm endpoints/mod_skypopen \ + endpoints/mod_skinny export EVENT_HANDLERS_MODULES=event_handlers/mod_event_multicast event_handlers/mod_event_socket event_handlers/mod_cdr_csv -export FORMATS_MODULES=formats/mod_local_stream formats/mod_native_file formats/mod_sndfile formats/mod_tone_stream formats/mod_shout +export FORMATS_MODULES= formats/mod_file_string formats/mod_local_stream formats/mod_native_file formats/mod_portaudio_stream \ + formats/mod_shout formats/mod_sndfile formats/mod_tone_stream export LANGUAGES_MODULES=languages/mod_spidermonkey languages/mod_perl languages/mod_lua languages/mod_python export LOGGERS_MODULES=loggers/mod_console loggers/mod_logfile loggers/mod_syslog export SAY_MODULES=say/mod_say_en say/mod_say_it say/mod_say_de say/mod_say_fr say/mod_say_es say/mod_say_nl say/mod_say_ru export TIMERS_MODULES= -export DISABLED_MODULES=applications/mod_memcache applications/mod_soundtouch directories/mod_ldap languages/mod_java \ - asr_tts/mod_cepstral asr_tts/mod_lumenvox endpoints/mod_wanpipe \ - event_handlers/mod_event_test event_handlers/mod_radius_cdr event_handlers/mod_zeroconf export XML_INT_MODULES=xml_int/mod_xml_rpc xml_int/mod_xml_curl xml_int/mod_xml_cdr -export MYMODULES=$(PASSTHRU_CODEC_MODULES) $(APPLICATIONS_MODULES) $(ASR_TTS_MODULES) $(CODECS_MODULES) $(DIALPLANS_MODULES) $(DIRECTORIES_MODULES) $(DOTNET_MODULES) $(ENDPOINTS_MODULES) $(EVENT_HANDLERS_MODULES) $(FORMATS_MODULES) $(LANGUAGES_MODULES) $(LOGGERS_MODULES) $(SAY_MODULES) $(TIMERS_MODULES) $(XML_INT_MODULES) +export MYMODULES=$(PASSTHRU_CODEC_MODULES) $(APPLICATIONS_MODULES) $(ASR_TTS_MODULES) $(CODECS_MODULES) $(DIALPLANS_MODULES) $(DIRECTORIES_MODULES) $(ENDPOINTS_MODULES) $(EVENT_HANDLERS_MODULES) $(FORMATS_MODULES) $(LANGUAGES_MODULES) $(LOGGERS_MODULES) $(SAY_MODULES) $(TIMERS_MODULES) $(XML_INT_MODULES) export MODULES=$(MYMODULES) ifndef AUTOCONF commit 60c21ddbc2b682fb1c41c7826969de112dd15b19 Author: Michal Bielicki <cypromis@debian-buildtesst> Date: Thu Oct 14 18:59:42 2010 +0200 added amrwb to debian packages and moved from openzap to freetdm diff --git a/debian/freeswitch-codec-passthru-amrwb.install b/debian/freeswitch-codec-passthru-amrwb.install new file mode 100644 index 0000000..022462d --- /dev/null +++ b/debian/freeswitch-codec-passthru-amrwb.install @@ -0,0 +1 @@ +opt/freeswitch/mod/mod_amrwb.so* diff --git a/debian/freeswitch-freetdm.conffiles b/debian/freeswitch-freetdm.conffiles new file mode 100644 index 0000000..f14e37f --- /dev/null +++ b/debian/freeswitch-freetdm.conffiles @@ -0,0 +1,6 @@ +opt/freeswitch/conf/tones.conf +opt/freeswitch/conf/autoload_configs/freetdm.conf.xml +opt/freeswitch/conf/pika.conf +opt/freeswitch/conf/freetdm.conf +opt/freeswitch/conf/wanpipe.conf +opt/freeswitch/conf/zt.conf diff --git a/debian/freeswitch-freetdm.debhelper.log b/debian/freeswitch-freetdm.debhelper.log new file mode 100644 index 0000000..60ff8f9 --- /dev/null +++ b/debian/freeswitch-freetdm.debhelper.log @@ -0,0 +1,4 @@ +dh_installdirs +dh_installdocs +dh_installchangelogs +dh_installinit diff --git a/debian/freeswitch-freetdm.install b/debian/freeswitch-freetdm.install new file mode 100644 index 0000000..cdca887 --- /dev/null +++ b/debian/freeswitch-freetdm.install @@ -0,0 +1,10 @@ +opt/freeswitch/conf/tones.conf +opt/freeswitch/conf/autoload_configs/freetdm.conf.xml +opt/freeswitch/conf/pika.conf +opt/freeswitch/conf/freetdm.conf +opt/freeswitch/conf/wanpipe.conf +opt/freeswitch/conf/zt.conf +opt/freeswitch/lib/libfreetdm.so* +opt/freeswitch/mod/mod_freetdm.so* +opt/freeswitch/mod/ftm*.so* + diff --git a/debian/freeswitch-freetdm/usr/share/doc/freeswitch-freetdm/changelog.Debian b/debian/freeswitch-freetdm/usr/share/doc/freeswitch-freetdm/changelog.Debian new file mode 100644 index 0000000..f35e705 --- /dev/null +++ b/debian/freeswitch-freetdm/usr/share/doc/freeswitch-freetdm/changelog.Debian @@ -0,0 +1,799 @@ +freeswitch (1.0.7-1headgit1) maverick; urgency=low + * upgrade: Added mod_amrwb + * upgrade version to 1.0.7 ... 1.0.6 was last realease + + -- Michal Bielicki <michal.bielicki@seventhsignal.de> Wed, 13 Oct 2010 22:58:48 -0200 +freeswitch (1.0.6-1ubuntu1) maverick; urgency=low + + [ Gabriel Gunderson ] + * upgrade: Added mod_callcenter and pulled out Python into its own + package. + + [ Mathieu Parent ] + * Updated Uploaders list + * Updated Standards-Version to 3.9.1 + + -- Mathieu Parent <sathieu@debian.org> Thu, 23 Sep 2010 15:34:00 +0200 + +freeswitch (1.0.4-1ubuntu2) karmic; urgency=low + + * upgrade: Add more verbosity when building to make it easier to find build + errors. + * upgrade: Remove the requirement for EXACTLY automake1.9 and change it to + need atleast automake 1.9 + * upgrade: Add the modules (directory, cluechoo, and valet_parking) to the + build files. These are in the standard build, so they should be here too. + + -- William King <quentusrex@gmail.com> Fri, 18 Dec 2009 14:27:42 -0800 + +freeswitch (1.0.4-1ubuntu1) karmic; urgency=low + + * upgrade: Pulling out the sounds into separate source files for easier management. + + -- William King <quentusrex@gmail.com> Sun, 15 Nov 2009 16:38:13 -0800 + +freeswitch (1.0.4-1) unstable; urgency=low + + * new + + -- Mike Jerris <mike@jerris.com> Mon, 18 Feb 2009 17:39:00 -0500 + +freeswitch (1.0.3-1) unstable; urgency=low + + * build: add targets cd-sounds[-install] and cd-moh[-install] for 48k sounds (r:11151) + * build: autoconf detect odbc library (FSBUILD-8) + * build: fix sound install on windows build (r:11635,11638) + * build: fix configure --sysconfdir (FSBUILD-84) + * build: fix uclibc build (MODLANG-99) + * build: fix adduser in debian (FSBUILD-122, FSBUILD-102) + * core: fix buffering issues (r:11101,11145,11152-11157,11162,11191,11200) + * core: fix c leg no hangup when converting attended to blind transfer before b leg answers (MODENDP-165/r:11061) + * core: fix codec and media handling issues (r:11104) + * core: fix double close of file handles and add recording of native files (r:11108-11113,11482,11483) + * core: fix file resampling issue (r:11090) + * core: fix incorrect call progress timestamps in timetable (r:11186-11187/FSCORE-268) + * core: fix media handling issues (r:11079-11082) + * core: fix multiple 2833 dtmf handling issues (r:11149,11261,11262,11266,11293,11294,11338/FSCORE-266,FSCORE-273) + * core: send more event types verbos bridge,unbridge,park,unpark (r:11097-11098) + * core: Prevent media setup on failed originates (r:11462/FSCORE-279) + * core: fix recorded soundfiles had random data at end of file (r:11491/MODAPP-205) + * core: fix user for windows service (r:11538/FSCORE-277) + * core: modify variable expansion code to expand in more places and to fix potential security issue from injecting variables (r:11569,11570) + * core: look for soundfiles in more locations based on rate (r:11601/MODFORM-23) + * core: state machine veto behavior changed (r:11610) + * core: add enable_file_write_buffering variable (r:11677) + * core: fix garbled audio on media bug during bridge using stateful codecs (FSCORE-288) + * core: fix tone detect running multiple bugs when detecting multiple tones + * core: add {instant_ringback=true} to make ringback not wait for indication to generate ringback + * core: fix segfault from race condition on multiple reloadxml calls (MOODAPP-211) + * core: modify xml locking so phrases do not lock the xml for the duration of playing them + * core: replace resampler with the speexdsp resampler + * core: fix windows calling convention on threads launched that return a value to fix shutdown segfault (FSCORE-298) + * core: do not auto-export origination_caller_id_* to avoid confusion (r:12052) + * core: API visibility support (GCC/SUNCC) (FSCORE-264) + * core: fix leak in exposed event class serialize method (r:12068) + * core: add volume as possible return value from input callback on embedded languages (r:12114) + * core: add resampler to seech handles (r:12141) + * core: add api.getTime to embedded languages (r:12149) + * freeswitch: allow you to specify -htdocs dir at runtime. (r:11614) + * fs_cli: add "debug" command to change the esl debug level at runtime (r:11057) + * iksemel: update to 1.3 (r:11645) + * libesl: fix disconnect failure (r:11078,11083) + * libesl: fix solaris build (r:11067,11068) + * libesl: add c++ wrapper and swigged wrappers for multiple scripting languages + * libg722_1: fix dct4.h code generator to include the "f" (r:11188-11189,11367) + * libilbc: update to new library from Steve Underwood + * mod_amrwb: add amr wideband passthrough codec (r:11971) + * mod_cepstral: fix failure return code handling (MODASRTTS-9) + * mod_conference: add 'conference xml_list' and 'conference [conf_name] xml_list' (r:11062-11063) + * mod_conference: make conference verbose-events param to control if events have all the channel data or not (r:11073-11077) + * mod_conference: add MINTWO flag to end conference when down to 1 participant (r:11523) + * mod_conference: refactor conference record function (r:11626) + * mod_conference: add conference list summary command (MODAPP-197) + * mod_conference: fix Deadlock or coredump on conference commands play, transfer (MODAPP-209) + * mod_dahdi_codec: added (MODCODEC-7) + * mod_dialplan_xml: make previous auto hunt feature optional and off by defaule use auto_hunt=true session or global variable to enable (r:12144) + * mod_dptools: Add failure_causes channel variable (r:12058) + * mod_easyroute: add configuration file example for custom-query (r:11055) + * mod_easyroute: add custom-query configuration option (r:11054) + * mod_easyroute: fix build error when not configured for odbc (r:11478) + * mod_easyroute: fix memory leak (r:11611) + * mod_erlang_event: add ability to spawn a process (module/function) outbound on a specified node. (r:11460,11477) + * mod_erlang_event: Fix some issues with standing up a new outbound listener and cleaning up after a failed session (r:11479) + * mod_erlang_event: Fix setting up a listener for an outbound session if one doesn't already exist (r:11488) + * mod_erlang_event: add "erlang" fscli command (r:11488) + * mod_erlang_event: Monitor spawned outbound processes for premature exits (r:11489) + * mod_erlang_event: Allow the event encoding strategy to be configurable; choices are string or binary (r:11495) + * mod_erlang_event: Allow certain tuple elements to be binaries or strings, to reduce conversion requirements on the erlang side (r:11496) + * mod_erlang_event: Support sending a message to a registered process to request a pid (when spawning won't cut it) (r:11499) + * mod_erlang_event: Ensure events received while a pid session is being created aren't discarded but are queued instead (r:11500) + * mod_erlang_event: Add freeswitch.erl - An erlang module to make talking to mod_erlang_event more painless (r:11525) + * mod_erlang_event: use rpc:call instead of spawn and to make the registered process argument to handlecall optional (r:11542) + * mod_event_socket: add ability to use a comma sep list of events on event-sink create-listener (r:11056) + * mod_event_socket: add debug logging to event-sink (r:11060) + * mod_event_socket: fix race condition (r:11680,12146) + * mod_dptools: add all modifier to break command (r:11557,11558) + * mod_dptools: add sound_test application (r:11658) + * mod_fax: Dont hangup after sending/receiving faxes + * mod_fifo: pause media bugs while not in a bridge (r:11466,11490) + * mod_fifo: allow unpark during chime list playing (r:11555/MODAPP-206) + * mod_fifo: fix outbound fifos doesn't check if the consumer is in the fifo in question. (r:11561/MODAPP-207) + * mod_fifo: Fix segfault when no argument were supplied to fifo_member call (MODAPP-210) + * mod_lcr: added (r:11180,11184,11532,11609) + * mod_limit: fix memory corruption caused by race condition when using limit hash (r:11070-11071) + * mod_limit: Fix transfer bug, fix leak and make the channel hangup if the extension is \!hangup_cause (r:11604,11932) + * mod_limit: add write different channel variables per realm_id (r:11608) + * mod_limit: Make max argument optional on the limit app, set the limit_usage variable to current count after inserting call in the db (r:11955) + * mod_lua: Create empty argv table when no args are passed to a Lua script (r:11559) + * mod_lua: use dll for lua windows build (FSCORE-299) + * mod_openmrcp: removed (r:11176-11179) + * mod_opal: added + * mod_pocketsphinx: fix leak (r:11974) + * mod_portaudio: fix stuck channels on outbound calls (r:11160,11470,11471,11472,11475,11476,11485) + * mod_python: fix build when site dir is not /usr/lib/python2.4 (r:12070) + * mod_say_en: add short form date/time (MODAPP-180) + * mod_sofia: add auto-rtp-bugs profile option to make rtp bug compensation configurable (r :11146-11147) + * mod_sofia: add support in sdp for a=maxptime (r:11103) + * mod_sofia: fix codec change race condition (r:11143) + * mod_sofia: fix notify event wasn't allowing content-length 0 (r:11106/MODENDP-167) + * mod_sofia: fix sending extra sdp in 200 OK when using 100rel in violation of sdp o/a protocol draft-ietf-sipping-sip-offeranswer-10 (r:11088) + * mod_sofia: fix sip_auto_answer=true (r:11069) + * mod_sofia: improve outbound registration error message (r:11059) + * mod_sofia: reset media timeout on re-invite (r:11161) + * mod_sofia: fix segfault due to missing contact header in invite (r:11463/MODENDP-177) + * mod_sofia: allow <params> tag in gateways as well as <variables> with direction inbound/outbound (default both) and call counter (r:11468) + * mod_sofia: add support or SLA, works with Polycom and Snom(Sylantro mode). (r:11562/MODENDP-179) + * mod_sofia: tolerate missing user in the request uri (r:11636) + * mod_sofia: Add purpose=gateways and profile=[name] so xml_curl requests make sense (MDXMLINT-46) + * mod_sofia: Add disable-srv and disable-naptr params to sip profiles (default false) (MODENDP-183) + * mod_sofia: add outbound-proxy param (MODENDP-184) + * mod_sofia: fix segfault with stun-enabled=false (SFSIP-120) + * mod_sofia: Profile Name in Expire Event is incorrect (MODENDP-185) + * mod_sofia: add "scrooge" mode to "inbound-codec-negotiation" (r:11881) + * mod_sofia: Add context to reconfig_sofia (r:12080) + * mod_sofia: fix segfault when calling from a Cisco 7940 using bypass_media (FSCORE-301) + * mod_sofia: ilbc to default to 30 if no mode= fmtp is defined on the inbound (r:12110) + * mod_sofia: fix challenge-realm (r:12113) + * mod_sofia: Segmentation fault when running killgw command on sofia profile without specifying a gateway (MODENDP-189) + * mod_sofia: gateways will inherit the context from its parent unless manually provided (r:12138) + * mod_sndfile: Add IMA ADPCM support (MODFORM-22) + * mod_spidermonkey: fix loading of spidermonkey modules (r:11084-11085) + * mod_spidermonkey: block some unwanted behaviours in session.originate + * mod_spidermonkey_socket: fix gc blocking (MODLANG-97) + * mod_xml_rpc: fixed authentication using @domain syntax (r:11064) + * mod_xml_rpc: fix http content types sent in responses (r:11099,11148,11150) + * mod_voicemail: voicemail insert into the proper fields (MODAPP-190) + * mod_voipcodecs: add G.726 24k (r:12083) + * sofia-sip: update to current sofia-sip repository + * spandsp: sync to latest snapshot and fix windows build + * speex: updated to 1.2rc1 + * sqlite: fix random assert on windows (FSCORE-292) + + -- Mike Jerris <mike@jerris.com> Mon, 18 Feb 2009 17:39:00 -0500 + +freeswitch (1.0.2-1) unstable; urgency=low + + * all: don't add module interfaces before returning from error conditions in module load functions (MDXMLINT-36) + * all: fixed multiple memory leaks + * all: improved module unloading/reloading support + * build: add support for --switchconfdir (FSBUILD-84) + * build: fixed netbsd build + * build: make freeswitch stop graceflly with /etc/init.d/freeswitch stop on debian add working dir to start-stop-dir so freeswitch dumps core in workdir + * build: multiple packaging fixes + * build: user freeswitch not added to audio group on deb install (FSBUILD-95) + * Configuration: many updates to default configuration + * core: Add ability to choose uuid from originate string, originate_uuid var (use at your own risk) + * core: add bridge_generate_comfort_noise option for bridge to generate comfort noise to the A leg when there is no audio on the B leg + * core: add chan vars to param event during hangup hook + * core: add exec directive to xml preprocessor (not available on windows) + * core: add force_transfer_dialplan and force_transfer_context variables + * core: add hashing to event header lookup + * core: add hits to tone_detect + * core: add last_dtmf_duration variable + * core: add msleep function to swigged languages + * core: add park_after_bridge variable + * core: add per leg timeouts and specific cause codes in reject_on_single_fail + * core: add runtime selection of the module dir (FSCORE-198) + * core: add scheduler support for heartbeat + * core: add session heartbeat feature + * core: add session.destroy psuedo method to sort of destroy a session at least for the sake of FS + * core: add session.unsetInputCallback + * core: add strftime format string validation for user supplied values + * core: add vars param to switch_ivr_originate for recursion (MODAPP-175) + * core: added a "group" concept to the user directory + * core: added ability to do dns lookup to find ip with host: like stun: (FSCORE-219) + * core: added better locking for codec changes during a call + * core: added current_application and current_application_data variables + * core: added error/ magic endpoint so modules can return error causes in situations like sofia_contact + * core: added read_result channel variable + * core: added support for "F" to indicate flash in dtmf (FSCORE-213) + * core: allow calls to be stolen from originate + * core: allow you to get the privacy bits in the caller_profile + * core: change dso code to load symbols local + * core: changes core flags to be array based so we have more + * core: eavesdrop causes the people being eavesdropped on to not hear ach other (MODAPP-140) + * core: expose time table to variable interface via caller field lookup + * core: fix 100% cpu when sending parked call to moh (FSCORE-234) + * core: fix bridge app to make sure both channels are ready for media when one is only in ringing state + * core: fix buffer overflow (FSCORE-188) + * core: fix conference dial by allowing multiple braces in originate, fix bad pointer op (FSCORE-208) + * core: fix double detection of DTMF in IVR (FSCORE-221) + * core: fix hangup_after_bridge is false on a bridge started with the intercept app + * core: fix issue where pid file is accidentally truncated + * core: fix ivr timeout (FSCORE-181) + * core: fix memory leak in alias tab completion code + * core: fix min digits in read app + * core: fix out-of-bounds pointer in variable expansion (FSCORE-171) + * core: fix segfault in media bugs when in bypass media (FSCORE-193) + * core: fix segfault on gtalk to sip calls (FSCORE-212) + * core: fix segfault on reloadxml (FSCORE-176) + * core: fix segfault on trasfering eavesdopping party (FSCORE-210) + * core: fix segfault using switch_system function (FSCORE-196) + * core: fix session.bridge + * core: fix setting effective_caller_id_name / effective_caller_id_number on bridge dialstring (MODAPP-122) + * core: fix stream_raw_write (MODAPP-145) + * core: fix using resampling on ringback file + * core: fixed performance bottleneck in sqlite db's + * core: fixed race in reloadxml + * core: increment app before execute in case it returns to execute it will go to the next item in the list and not the same + * core: ivr menu max_failures and max_timeouts now default to 3 if not specified or invalid (less than 1) values are specified (FSCORE-244) + * core: ivr_menu max-timeouts option, result in ivr_menu_status var (FSCORE-183) + * core: let b legs use park_after_bridge too + * core: make events less verbose unless verbose_events is set + * core: parse private events during originate + * core: pass pdd data to a leg on oubound calls using bridge + * core: prevent crash in crazy situation with xml interface lookup failures (FSCORE-169) + * core: reduce cpu requirement for generated comfort noise + * core: remove interface names from core db on unload + * core: reworked timing resulting in significant performance increase and better rtp timing + * core: rewrite switch_play_and_get_digits (MODAPP-166) + * core: session.recordFile never terminates (MODLANG-79) + * core: session.transfer make dialplan and context optional + * core: set_user app now sets domain vars as well as user vars + * core: tone_detect not triggering app after tone detection (MODAPP-182) + * core: unprivileged user setting bigger stack for switch_system thread failure (FSCORE-197) + * core: user_exists returns false when fetching a user from XML Curl or other xml interfaces + * libesl: added c event socket library and fs_cli + * libsndfile: fix autoconf 2.62 support (LBSNDF-5) + * mod commands: add "all" modifier to "break" command + * mod_celt: added new module + * mod_commands: Add support for more than 2 variables to uuid_setvar_multi (MODAPP-171) + * mod_commands: Add support for passing the cause of hangup to the uuid_kill command (FSCORE-217) + * mod_commands: add attr lookup to user_data + * mod_commands: add domain_exists fsapi command + * mod_commands: add eval fsapi command + * mod_commands: add flush_dtmf app and uuid_flush_dtmf api command + * mod_commands: add fsctl send_sighup, fsctl shutdown asap, unsched_api commands + * mod_commands: add fsctl shutdown [elegant|restart|cancel] + * mod_commands: add new syntax to uuid_setvar to allow you to unset a var. <uuid> <var> [value] (MODAPP-167) + * mod_commands: add reload fsapi command to reload a module + * mod_commands: add system fsapi and application (MODAPP-138) + * mod_commands: added hupall fsapi command + * mod_commands: added strftime_tz api command + * mod_commands: break all now stops broadcast too + * mod_commands: fix api command sent through sched_api was getting the last char lopped off + * mod_commands: fix race on transfer with -both + * mod_commands: fix system dialplan app problems (MODAPP-86) + * mod_commands: only send content-type on status when it really is http. + * mod_conference: add fsapi to stop async playback too + * mod_conference: add video caps to mod_conference with video follow audio + * mod_conference: better sound prefix handling when using say: and allow say: on kick sounds. + * mod_conference: fix race in record + * mod_conference: fix runaway thread when floor holder has no video and other people do have video + * mod_conference: fix seg when kicking many members quickly (MODAPP-129) + * mod_conference: fix segfault on invalid chat event + * mod_conference: perpetual sound does not auto-mute, you can do that yourself if you want it + * mod_dialplan_xml: add Hunt- vars in dialplan lookup after transfer + * mod_dialplan_xml: fail call on extensions with nested conditions + * mod_dingaling: (LBDING-7) fix segfault on os x + * mod_dingaling: end call on ice timeout + * mod_dingaling: fix presence on jabber to be less protocol ambiguous + * mod_dingaling: fix segfault (LBDING-10) + * mod_dingaling: update to support latest client from google + * mod_dptools: add a mechanism to tell if a file played from sendmsg over event socket + * mod_dptools: add playback_terminator support to phrase and say app + * mod_dptools: add playback_terminator_used variable (MODAPP-132) + * mod_dptools: add presence application + * mod_dptools: fix originate api not parsing users properly (FSCORE-246) + * mod_dptools: fix record and record_session to create directory if it does not exist (FSCORE-250) + * mod_dptools: fixed limit and + parsing bug in record_session app (MODAPP-148) + * mod_dptools: remove_bugs added to remove all media bugs on a session + * mod_erlang_event: add new module + * mod_event_socket: missing : after Content-Length in event socket (MODEVENT-33) + * mod_event_socket: add event socket listener filters + * mod_event_socket: add stateful listener fsapi commands for ajax-y type event interface over http + * mod_event_socket: fix arg parsing errors (MODEVENT-34) + * mod_event_socket: fix shutdown segfault race (MODEVENT-32) + * mod_event_socket: inbound connection to event_socket can now take over an existing channel with 'myevents <uuid>' to take on the behaviour of an outbound socket + * mod_event_socket: let any channel get messages + * mod_event_socket: make event socket wait for hangup on outbound mode and send disconnect message + * mod_expr: fix endless loop + * mod_fax: new module + * mod_fifo: add fifo_consumer_wrapup_time var (MODAPP-117) + * mod_fifo: added callback agents + * mod_fifo: honor keyword silence (MODAPP-118) + * mod_flite: added windows build + * mod_fsv: fix in a windows enviroment opening the record file in text mode. (MODAPP-169) + * mod_http: added new module + * mod_java: updated to new module api to support read/write locks on interface + * mod_limit: accept dialplan context for transfer (MODAPP-161) + * mod_limit: added hashtable based limit functions + * mod_limit: prevent empty error log message (MODAPP-134) + * mod_local_stream: add start_local_stream and stop_local_stream fsapi commands to start/stop dynamically (MODFORM-13) + * mod_local_stream: fix leak and improve error checking + * mod_local_stream: fix seg when no timer name specified in config file. (MODFORM-16) + * mod_loopback: add new module + * mod_lua: add local scripts directory support (MODLANG-86) + * mod_lua: don't eval blank string + * mod_lua: fix originate + * mod_lua: fix segfault (MODLANG-77) + * mod_lua: update to lua 5.1.4 (MODLANG-87) + * mod_lumenvox: removed + * mod_managed: new module replaces mod_mono now supports native .net runtime on windows as well + * mod_opal: added to trunk (still very beta) + * mod_perl: fix segfault (MODLANG-77) + * mod_pocketsphinx: fix rpm build + * mod_portaudio: fix cpu race on inbound call to pa when no ring file is set + * mod_radius_cdr: dictionary update for cause code changes (MODEVENT-27) + * mod_radius_cdr: fix unload (MODEVENT-29) + * mod_shout: add stereo recording broadcast support + * mod_shout: added windows build + * mod_shout: fix segfault when recording mp3's (MODFORM-12) + * mod_shout: improved stability of mp3 decoding + * mod_siren: added new module + * mod_sndfile added support to record 16bit for the various rates including 48kHz + * mod_sofia: Add filter to "sofia status profile XXX" (MODENDP-138) + * mod_sofia: Add force-register-db-domain which works in conjunction with force-register-domain. + * mod_sofia: Add optional <variables> and <params> tag to <gateway> tag. + * mod_sofia: Challenge the right realm when to_host is outside the users domain. (MODENDP-136) + * mod_sofia: Improve notify messages through a proxy (MODENDP-147) + * mod_sofia: MWI for multiple domains (MODAPP-126) + * mod_sofia: Move "a=sendrecv" from session to media section of SDP (MODENDP-148) + * mod_sofia: add 200 OK re-invite without sdp + * mod_sofia: add custom sofia::gateway_state event (MODENDP-112) + * mod_sofia: add fire events for the refer SIP NOTIFY event package (MODENDP-152) + * mod_sofia: add more params for xml_curl directory lookup + * mod_sofia: add new auto vals for challenge-realm param <param name="challenge-realm" value="auto_from|auto_to|<hardcoded_val>"/> + * mod_sofia: add option to turn of auto_restart of sofia profiles on ip change + * mod_sofia: add params to use sip callid as uuid on inbound calls and uuid as sip callid on outbound calls + * mod_sofia: add parsing of Privacy header for privacy info (MODENDP-133) + * mod_sofia: add proto_specific_hangup_cause to both legs + * mod_sofia: add proxy 3pcc mode + * mod_sofia: add redirect variable to channel as well as partner channe (MODENDP-135) + * mod_sofia: add sip-forbid-register to user params to refuse to let a certian user register + * mod_sofia: add sip: into register-proxy when it's not specified + * mod_sofia: add sip_history_info var for inbound invites. + * mod_sofia: add sip_via_protocol variable + * mod_sofia: add sofia xmlstatus (MODENDP-156) + * mod_sofia: add support for params other than Replaces in Refer-To (MODENDP-143) + * mod_sofia: add support for profiles sharing databases so that you can have a domain that uses multiple profiles for split dns type setups + * mod_sofia: add support for refer transfer involving multiple machines + * mod_sofia: add support to send a notify in the invite dialog by specifying the uuid of the call. (SFSIP-92) + * mod_sofia: add suppress_from_cidname var to not have display name in from header (MODENDP-153) + * mod_sofia: added sip_hangup_disposition variable + * mod_sofia: allow send_message and notify events to send a message/notify without a body if needed. + * mod_sofia: append -1 .. -N postfix after any X-headers as vars that have the same name + * mod_sofia: cache auth_gateway_name in sofia for challenged bye + * mod_sofia: cancel proxy or no-media mode if you purposely answer or pre_answer + * mod_sofia: correct result code mapping for Unallocated Number (MODENDP-124) + * mod_sofia: disable 100rel by default + * mod_sofia: don't accept crypto in the RTP/AVP (MODENDP-126) + * mod_sofia: don't put CN in sdp answer if it was not in the offer. + * mod_sofia: fix Incorrect IP address shows up in SDP "o" field when multiple external IPs available and FS not bound to first (MODENDP-132) + * mod_sofia: fix Wrong RTP media port destination after reinvite/UNHOLD (SFSIP-82) + * mod_sofia: fix bug on linksys where they lie about the ptime and handle linksys transfer problem + * mod_sofia: fix chat (send an IM) assumes that the user's profile is the same as their domain, which isn't necessarily so (SFSIP-83) + * mod_sofia: fix dtmf handling of broken info dtmf endpoints + * mod_sofia: fix eyebeam presence to be RFC compliant (MODENDP-144) + * mod_sofia: fix ip change detection when in proxy mode + * mod_sofia: fix register_proxy ignoring the paramaters (MODENDP-121) + * mod_sofia: fix remote session refresh triggers request glare (MODENDP-131) + * mod_sofia: fix rtp auto adjust running when it should not + * mod_sofia: fix rtp sent to wrong port after some re-INVITE scenarios (MODENDP-141) + * mod_sofia: fix sending of cn packets across bridge when we shouldn't + * mod_sofia: fix sqlite issue with select of the sip contact + * mod_sofia: fixed segfault on invalid presence payload + * mod_sofia: gateway ping needs to look for 501 (SFSIP-78) + * mod_sofia: handle multi contact register responses and register timeout better + * mod_sofia: improve gateway resilience + * mod_sofia: log ip and port you get reply to invite from + * mod_sofia: make multiple-registations=true use the contact method and call-id option to do it the old way + * mod_sofia: make proxy mode pull the port from m=image as well + * mod_sofia: make register-proxy preserve the url composed from proxy but target the packets to desired address (MODENDP-121) + * mod_sofia: many fixes for sonus rtp issues silence_when_idle=400 chanvar to send generated silence duing sleeps etc + * mod_sofia: many fixes in presence handling + * mod_sofia: passthrough t.38 fixes + * mod_sofia: pick ipv4 or ipv6 based on sipip instead of having mixed in sdp + * mod_sofia: send NOTIFY on TCP/UDP depending on the SUBSCRIBE (SFSIP-104) + * mod_sofia: setting profile option multiple-registrations=contact key multi reg off the contact string + * mod_sofia: wait for a reply on refer + * mod_soundtouch: fixes and improvements, many options changed (MODAPP-149) + * mod_soundtouch: updated to new module api + * mod_spidermonkey: Segmentation fault in check_hangup_hook at mod_spidermonkey.c:1589 (MODLANG-74) + * mod_spidermonkey: fix bug in apiExecute + * mod_spidermonkey: fix memory pool handling and leaks + * mod_spidermonkey: limit recursion busting through the stack (FSCORE-202) + * mod_spidermonkey: make session.getVariable return blank string not the word false + * mod_spidermonkey_curl: add optional content-type arg + * mod_spidermonkey_odbc: fix numRows and add numCols + * mod_spidermonkey_odbc: fix segfault (MODLANG-75) + * mod_stress: new module for voice stress analysis + * mod_syslog: don't log blank lines (FSCORE-163) + * mod_tone_stream: let silence_stream://0 indicate perpetual silence + * mod_vmd: add new module to detect voicemail "beep" + * mod_voicemail: Add vm_alternate_greet_id param to directory entry (MODAPP-174) + * mod_voicemail: Patch to add voicemail preference controlling date announcement new param 'play-date-announcement' to values 'first' 'last' or 'never' defaults to first to retain previous behavior (MODAPP-121) + * mod_voicemail: Update mwi light after delete vm via web. (MODAPP-124) + * mod_voicemail: add ability to get to options without listening to every saved message (MODAPP-115) + * mod_voicemail: add ability to skip greeting when leaving a voicemail. (MODAPP-181) + * mod_voicemail: add change-pass-key config file option + * mod_voicemail: add forwarding support + * mod_voicemail: add local dtmf driven alternat vm pass + * mod_voicemail: add proper notification of a vm message being too short + * mod_voicemail: add support for auth via a1-hash + * mod_voicemail: add the "storage-dir" parameter to be set on a per-user basis (MODAPP-133) + * mod_voicemail: add voicemail_greeting_path variable + * mod_voicemail: added voicemail_alternate_greet_id variable + * mod_voicemail: allow changing of password from voicemail to update user directory if using non-static config (MODAPP-156) + * mod_voicemail: created email date (int overflow) (MODAPP-125) + * mod_voicemail: don't try to deliver vm when no file was recorded. (MODAPP-133) + * mod_voicemail: fix MWI with xml_curl used for directory (MODAPP-176) + * mod_voicemail: fix Voicemail messages occasionally lost / stranded (MODAPP-178) + * mod_voicemail: fix invalid event after message deleted (MODAPP-170) + * mod_voicemail: fix mwi for phones with multiple registrations problem (MODAPP-153) + * mod_voicemail: fix voicemail segfault on incorrect password (FSCORE-187) + * mod_voicemail: fix voicemail_inject error handling (MODAPP-133) + * mod_voicemail: fix voicemail_inject usage api call + * mod_voicemail: improve error checking (MODAPP-142) + * mod_voicemail: localize notification emails (MODAPP-139) + * mod_voicemail: make more multi-domain friendly (MODAPP-162) + * mod_voicemail: make playback created file macros optional (MODAPP-150) + * mod_voicemail: recognize operator key in more places (MODAPP-159) + * mod_voicemail: web interface displays incorrect created / last heard dates (MODAPP-123) + * mod_wanpipe: removed + * mod_xml_cdr: add https support + * mod_xml_cdr: add optional a-leg prefix to xml cdr filenames (MDXMLINT-39) + * mod_xml_cdr: add support for fallback webserver for cdr posting (FSCORE-238) + * mod_xml_curl: Allow specification of HTTP method, and dynamic expansion of variables in URI. (MDXMLINT-41) + * mod_xml_curl: added redirect following (max 10) + * mod_xml_ldap: almost a complete rewrite of this module + * mod_xml_rpc: allow setting of global realm without a global user (MDXMLINT-45) + * mod_xml_rpc: fix multiple segfaults + * mod_xml_rpc: fix segfault on originate via http + * sofia-sip: updated to 1.12.10 (plus a few patches) + + -- Mike Jerris <mike@jerris.com> Mon, 29 Dec 2008 14:46:00 -0500 + +freeswitch (1.0.1-1) unstable; urgency=low + + * FIX: prevent intercept race condition that can also be solved with continue_on_fail=originator_cancel + * FIX: NULL dereference detected by klockwork (www.klockwork.com) + * FIX: don't open failed local stream (MODFORM-9) + * FIX: instability in mod_local_stream in failure scenarios + * FIX: xmlrpc-c build on OS X 10.4 (FSBUILD-47) + * ENHANCEMENT: Added tab completion on many api commands in console + * ENHANCEMENT: polycom BLF support + * FIX: many sip NAT related fixes in mod_sofia + * FIX: support sip unregister with Contact: * + * FIX: multiple segfaults in xmlrpc-c + * FIX: sip unregister event being skipped + * FIX: hangup properly on malformed sip 3pcc calls being used as a way to ping + * ADD: enable-3pcc sofia profile param, it is now disabled by default. + * ADD: presence events to sip proxy mode + * ADD: legs param to cdr_csv + * ADD: support for perl as an embedded lanugage + * ENHANCEMENT: many new api's and functions to the embedded languages including api support, xml interface support, auto start scripts, and many new objects + * CHANGE: python embedded language api changed to match perl, lua, java + * FIX: many stability fixes in embedded langauges perl, lua, java, python + * ADD: failed_xml_cdr magic channel variable + * FIX: access free memory error in mod_sofia when using respond app + * ENHNACEMENT: make global_setvar only have 2 fields so you can set foo=bar=blah w/o quotes + * FIX: mod_spidermonkey keep hangup hook in the session thread + * ENHANCEMENT: mod_ldap added sasl support and search filters + * ADD: answered, waitForAnswer and mediaReady methods to embedded language Session object + * ENHANCEMENT: mod_voicemail param change to allow notification emails using templates + * ADD: per user acl in sofia + * FIX: deadlock in mod_portaudio + * ENHANCEMENT: blank username in sip will trigger a lookup for the user "nobody" + * ADD: import variable to import variables from a peer channel at time of originate + * FIX: api type fix for c++ modules when incorrectly using enums + * FIX: eliminate need for escaped , in [] on originate + * ADD: NDLB-force-rport option to force behavior as if rport was sent in the via + * ENHANCEMENT: honor execute_on_answer on outbound legs too + * ADD: execute_on_ring variable + * FIX: Seg fault in CoreSession() class destructor + * ADD: per channel caller id in originate + * ADD: sip_outgoing_call_id variable + * FIX: multiple memory leaks in mod_sofia + * FIX: find_local_ip IPv6 support + * ADD: variable expansion to on execute vars.(FSCORE-114) + * ADD: count optional arg to show calls and show channels (MODAPP-103) + * FIX: MODEVENT-25 (WSAWOULDBLOCK error on socket send in windows) in event socket + * FIX: multiple fixes to the logic in mod_say_zh + * ADD: inter digit timeout to swigged embedded languages getDigits method. (MODLANG-65) + * ADD: Linksys P-RTP-Stat SIP header values (SFSIP-66) + * FIX: small leak in core + * ADD: progress_timeout var to originate + * UPDATE: portaudio library + * FIX: added timeout to iax read + * ADD: 'pa rescan' to portaudio to look for new devices + * FIX: wait for broadcast to start when starting async hold to avoid race + * FIX: mod_rss, don't always play the first news feed + * FIX: mod_rss inverval to use the session inteval (audio problems on 30ms channels) + * ADD: Path: support in mod_sofia on register + * FIX: mod_shout record stream + * ENHANCEMENT: mod_voicemail support for effective_caller_id_name/number + * ADD: url encode/decode api calls + * FIX: "nua()" in debug information in sofia instead of the real function name + * FIX: better handling of sips: uris + * FIX: don't seg when using more than SWITCH_MAX_CODECS and bump SWITCH_MAX_CODECS to 50 (we have more than 30 in tree) (MODFORM-10) + * ADD: mod_yaml + * FIX: segfault on freeswitch startup if installed directories are removed + * FIX: segfault when intercept with inbound_late_negotiation=true set + * FIX: dont flood logs with eavesdrop messages (MODAPP-101) + * FIX: don't destroy a codec that has not been created (MODAPP-101) + * ENHANCEMENT: allows the "eavesdrop_group" variable to contain several groups, comma separated. (MODAPP-101) + * FIX: cross compile (FSBUILD-53) + * FIX: add header that Nuaunce considers mandatory (MODASRTTS-5) + * ADD: write locks to the core and a function to unregister event bindings (adds better ability to unload modules) + * ENHANCEMENT: make modules unbind events and un-reserve subclasses on module unload + * ADD: removable xml hook bindings + * ADD: EventConsumer object to embedded languages so you can make event handlers + * FIX: sending CN with supress-cng true + * FIX: segfault in the event system when trying to remove NULL event + * ADD: flags to turn off srtp auth and rtp auto adj (FSCORE-149 && MODENDP-115) + * FIX: use lighter math and avoid infinite loop in port allocator (FSCORE-148) + * ENHANCEMENT: let conference pin entry start during prompt (MODAPP-111) + * ADD: mod_pocketsphinx + * FIX: Misuse of SQLRowCount, issues with MSSQL (MODAPP-105) + * FIX: segfaults in mod_python with dtmf callback + * ENHANCEMENT: mod_conference auto-record parameter (MODAPP-112) + * ENHANCEMENT: reload support to many modules + * FIX: mod_sofia add replaces to supported header + * ENHANCEMENT: add args callback to sleep so you can process dtmf and events while "sleeping" + * ADD: mod_flite + * ENHANCEMENT: switch_xml converted back to c code and support double globs on windows + * ENHANCEMENT: mod_sofia support for adding and removing gateways without restarting profiles + * ADD: extract contact header info into A channel when unhandled 3xx response is received (MODENDP-116) + * FIX: outbound event_socket + late negotiation + * ADD: copy_xml_cdr variable + * ADD: silence_stream (like tone_stream but silent) + * ADD: module_exists api call + * ADD: emailer implementation for windows + * ADD: wait_for_silence application + * FIX: no error message generated if OS is unable to load a module ( due to dependency/installation issues ) + * FIX: segfault in media bugs + * FIX: acl lists not correctly matching all ip adresses + * FIX: mod_spidermonkey exit() does not stop script when called from the hangup callback (return "exit" from the callback) + * FIX: mod_syslog works again + * FIX: crash on terminal resize + * FIX: audio problems on big endian + * ENHANCEMENT: Disable multiple registrations on a per-device basis (MODENDP-117) + * ADD: fifo_consumer_exit_key variable (MODAPP-100) + * ADD: cidr based user auth in mod_sofia + * ADD: uuid_send_dtmf fsapi command (MODAPP-114) + * ADD: server registration fiels to sip_registration database (MODENDP-118) + * FIX: use a variable, realm or to host to find gateway when it's not obvious (handles challenged REFER) + * ADD: timeout to curl run in javascript + * ADD: voicemail_inject fsapi command + * ADD: reboot option for sip phones to flush_inboud_reg sofia profile api command + * FIX: add small padding to end of mp3 to avoid cut off mp3 recording + * FIX: patch multiple SDP connection lines in sdp for proxy media mode (MODENDP-109) + * FIX: don't parse ringback varable in proxy situations + * ADD: per call vm recording ext with vm_message_ext variable + * ADD: sip_bye_h prefix to add headers to bye + * ENHANCEMENT: more interfaces available in show fsapi command + * FIX: don't leak in buffers on realloc fail + * FIX: fail out of a conference call if write fails + * ADD: auto ip-change detection + * ADD: mod_snom + * FIX: mod_sofia don't send sipfrag on transfer to cisco so they don't hang up the call + + -- Mike Jerris <mike@jerris.com> Thu, 24 Jul 2008 07:00:00 -0500 + +freeswitch (1.0.1~trunk) unstable; urgency=low + + * Updated revision number + * Fixed init problem reported by Jay Binks (FSSCRIPTS-1) + * Added a patch to the debian build system add more features (thanks to Hadley Rich) (FSBUILD-45) + - Added en-us-callie sounds and music on hold packages + - Added recommends and suggests + - Added mod_say_es and mod_say_nl + - Updated descriptions + - Added mod_cdr_csv + * Fixed typos and some errors in the previus patch. + * Modified monit script. Now it should work. + * The debian build system now bootstrap automagically if it's necessary and all scripts are in place. + + -- Massimo Cetra <devel@navynet.it> Sun, 6 Jul 2008 16:30:00 +0100 + +freeswitch (1.0.0-1) unstable; urgency=low + + * Enhanced sofia sip nat handling + * Many fixes found by Klockwork (www.klocwork.com) + * Added disable_app_log variable + * Fixed mod_local_stream with rates on windows + * Fixed finding of files in rate dirs on windows + * Fixed memory corruption from sofia_contact function + * Added sofia profile param NDLB-received-in-nat-reg-contact + * Added sofia profile param aggressive-nat-detection + * Fixed video sip calls in proxy media mode + * Added bridge_terminate_key var + * Update xmlrpc-c lib to trunk revision from upstream, fix windows xmlrpc + * Enhanced nat handling in proxy media mode in sip + * Add progress media to timetable so you can calculate pdd + * Fixed seg when using unicast on socket when call has no read_codec + * Fixed missed log events on busy box + * Added -bleg to intercept + * Enhance configure detection of python + * Fixed build on solaris and freebsd for several modules + * Added param "vm-email-only" to make voicemail sent by email only (previously default behavior) + * Added param "vm-mailto-notify" to allow sending a notification email + * Fixed mod_java build + * Fixed mwi failures for some devices that don't subscribe + * Removed fsapi functions (killchan, transfer, session_displace, reject) + * Removed fsapi functions (session_record, broadcast, hold, media) + * Many updates to sofia-sip library including over 100 fixes + + -- Michael Jerris <mike@jerris.com> Tue, 27 May 2008 01:30:00 -0400 + +freeswitch (1.0~rc6-1) unstable; urgency=low + + * Changed to not allow pass_2833 on transcoded calls + (it never worked, now it will tell you) + * Enhanced sofia sip nat handling + * Fix libedit build on solaris + * Fix session timers in mod_sofia + * Fix conference fire-call + * Change: add var_event down into the endpoints so chans + with no parents can still pass options + * Added enable-post-var param to xml_rpc + * Fix mod_lua build on solaris + * Many fixes found by Klockwork (www.klocwork.com) + * Add unregister event in mod_sofia + * Enhance python configure detection + * Add vm_boxcount api func + * Fixed att_xfer issue + * Fix sip now includes the Allow-Events header in more places + + -- Michael Jerris <mike@jerris.com> Tue, 13 May 2008 02:01:00 -0400 + +freeswitch (1.0~rc5-1) unstable; urgency=low + + * Changed internal state names to avoid confusion + Fixed video negotiation + Enhanced accuracy of windows timer + Fixed mod_ldap build + Added dialplan and context to sql table for channels + Multiple fixes to mod_lua and mod_perl + Fixed logic bug in fifo causing segfault + internal changes to sip stack so we can remove a hash redundant to the stack + Fixed multiple memory leaks in mod_sofia + Fixed event fetch segfault on sip subscribe + Fixed segfault on timer rollover in sofia on 64bit + Fixed audio timing issues in mod_portaudio + Changed names of sip profiles in default config to avoid confusion + Fixed memory usage leak-like behavior when playing files requiring resampling + Removed some unused api's + Fix rtp timeout when playing moh + Removed some un-needed libraries and files from tree + Fixed multiple issues in sip stack including multiple segfaults + Added support for sip transfers on bypass_media and proxy_media calls + Added say application + Fixed --disable-debug configure option + Enhanced switch_cpp wrapper (and perl, python, lua, java) + Fixed segfault on inavalid stun response + Fixed configure help output + Fixed segfault on mp3 playback + Fixed assert on invalid sdp (missing m= line) + Added configurable windows service name + Fixed proxy mode call transition to non proxy call + Fixed solaris build of voipcodecs + Fixed sofia seg when call failure edge case + + -- Michael Jerris <mike@jerris.com> Tue, 13 May 2008 02:01:00 -0400 + +freeswitch (1.0~8327) unstable; urgency=low + + * Adding perl and lua separate packages + * Adding mod_voipcodecs + + -- root <root@fs.navynet.it> Tue, 6 May 2008 09:46:26 +0000 + +freeswitch (1.0~rc4-1) unstable; urgency=low + * Add tab completion in cli + Add "inline" dialplan + Fixed segfault in enum + Enhance enum to fork dial equal priority entries + Added auto-reload to enum + Fixed odbc bug is mod_sofia presence handling + Add presence for conference and dial an eavesdrop + Fix stack overflow segfault when recursively parking calls + Fixed race is sofia registration handling + Enhance sofia registration, unregister on keep-alive OPTIONS failure + Added internal routing loop detection/avoidance + Fixed race in bgapi in event socket + Fixed vars to execute apps before bridge "bridge_pre_execute_aleg_app" and "bridge_pre_execute_bleg_app" + Fixed re-setting sound prefix to no prefix after a pharse + Enhanced setting of bracket vars from originate so they show in the CHANNEL_ORIGINATE event + Add "enable-timer" and "enable-100rel" options to turn off default behaviors in sofia + Add originate_timeout to originate vars + Fixed hanging channels in mod_portaudio + Added auto time sync on vps migration to different hardware + Fixed seg on transfer when both legs are not sip + Added configurable dtmf duration defaults + Enhanced voicemail, allow interruption of hello message + Fixed voicemail to not light up light on saved messages + Enhance mod_amr honor disable dtx in fmtp (MODCODEC-3) + Fixed bootstrap to install automake dependencies so you can use tarball without same version of automake installed + Fixed MODLANG-56 (bad audio on originate and javascript streamFile) + Added hold/unhold dialplan apps + Enhanced sofia error checking to outlaw 0.0.0.0 in sofia ip params + Backport fixes from sofia-sip tree + Fixed MSVC build + Fixed segfault on sip SUBSCRIBE with Expires: 0 + Added mod_say_zh + Added --with-pyton and --with-pyton-config configure options + Added mod_lua + Enhanced switch_cpp wrapper in core and normalized interfaces for perl, python, lua, and java + Fixed multiple issues in cpp wrapper and the languages perl, python, lua and java + Added back mod_perl + Added sofia gateway option ping to adjust options ping frequency + Added .net event socket lib to contrib + Fixed passing of exact response codes of sip across a bridge + Added mod_reference, reference endpoint module + Enhanced build so you can now make commented out modules using "make mod_name" + + -- Michael Jerris <mike@jerris.com> Wed, 23 Apr 2008 12:58:00 -0400 + +freeswitch (1.0~rc3-1) unstable; urgency=low + * Enhance xml menu system + fixes upstream from sofia-sip library + Enhance mod_fifo + added close method to ODBC spidermonkey class + Fix multiple bugs in the cpp wrapper used in mod_java and mod_python + Fix hung sip channel issue using respond app or on re-invite with bypass media after 1xx or 2xx responses + + -- Michael Jerris <mike@jerris.com> Wed, 9 Apr 2008 12:58:22 -0400 + +freeswitch (1.0~rc2-1) unstable; urgency=low + * Fixed speex protocol negotiation issues (8k vs 16k) + Fixed mod_iax race conditions + Fixed ptime negotiation issues when re-packetizing + Added ip based acl lists + * + -- Michael Jerris <mike@jerris.com> Wed, 9 Apr 2008 12:58:22 -0400 + +freeswitch (1.0~rc1-1) unstable; urgency=low + * loads of fixes + new cdr-csv module + new spidermonkey-curl module + + -- Michal Bielicki <michal.bielicki@voiceworks.pl> Mon, 14 Jan 2008 23:37:04 +0100 + +freeswitch (1.0~beta3-1) unstable; urgency=low + + * Additional scripts for changing the user to freeswitch + Added Startup Scripts + Monit integration + Settings file for integration into init + init.d file + added user freeswitch to own and run all off freeswitch + cleaned up config file control + new upstream release + split off codec pakcages + split off spidermonkey packages + + -- Michal Bielicki <michal.bielicki@voiceworks.pl> Tue, 27 Nov 2007 13:20:21 +0100 + +freeswitch (1.0~beta2-1) unstable; urgency=low + + * New upstream release + + -- Paul van Genderen <paulvg@member.fsf.org> Wed, 17 Oct 2007 19:32:09 +0200 + +freeswitch (1.0~beta1-1) unstable; urgency=low + + * New packages. + + -- Robert McQueen <robot101@debian.org> Sun, 12 Nov 2006 17:32:23 -0500 diff --git a/debian/freeswitch-freetdm/usr/share/doc/freeswitch-freetdm/copyright b/debian/freeswitch-freetdm/usr/share/doc/freeswitch-freetdm/copyright new file mode 100644 index 0000000..45eb67b --- /dev/null +++ b/debian/freeswitch-freetdm/usr/share/doc/freeswitch-freetdm/copyright @@ -0,0 +1,51 @@ +This package was debianized by Michal Bielicki +<michal.bielicki@voiceworks.pl> on Now 25, 2007. + +The current Debian maintainer is Nicholas Amorim <nicholas@montrealconsultoria.com.br> + +The source was downloaded from http://www.freewitch.org/ + +Upstream authors: +Anthony Minessale II <anthmct@yahoo.com> +Portions created by the Initial Developer are Copyright (C) 2006-2009 +the Initial Developer. All Rights Reserved. + +The PRIMARY AUTHORS are (and/or have been): + + Anthony Minessale II <anthmct@yahoo.com> - Primary developer of all core components + and many of the included modules. Much of freeswitch is based on his work. + + Michael Jerris <mike@jerris.com> - Windows porter and responsible for the + windows\msvc build system. + +And here is an inevitably incomplete list of MUCH-APPRECIATED CONTRIBUTORS -- +people who have submitted patches, reported bugs, and generally made Freeswitch +that much better: + + Brian K. West - For countless hours of work on BSD and Mac support, finding countless bugs, and moral support. Xcode project files. + Joshua Colp - For his help making mod_exosip possible (which we are now getting rid of but oh well), + and for just being a swell guy! (until he backstabbed us, c'est la vie) + Michal "cypromis" Bielicki (michal.bielicki AT voiceworks.pl) - Solaris porting, and autotools enhancements, debian, rpm and solaris packaging. + James Martelletti <james@nerdc0re.com> - All around cool guy (mod_syslog) + Johny Kadarisman <jkr888@gmail.com> + Yossi Neiman of Cartis Solutions, Inc. <freeswitch AT cartissolutions.com> - implementation of mod_cdr (perldd, mysql, csv) + Stefan Knoblich - Various patches and support. Thanks. + Justin Unger - <justinunger at gmail dot com> Lots of help with patches and SIP testing. Thanks! + Paul D. Tinsley - Various patches and support. <pdt at jackhammer.org> + Ken Rice - <krice AT suspicious.org> - xmlcdr, sofia improvements, load testing. + Neal Horman <neal at wanlink dot com> - conference improvements, switch_ivr menu additions and other tweaks. + Johny Kadarisman <jkr888 at gmail.com> - mod_python fixups. + Michael Murdock <mike at mmurdock dot org> - testing, documentation, bug finding and usability enhancements. + Matt Klein <mklein@nmedia.net> + Jonas Gauffin <jonas at gauffin dot org> - Bugfixes and additions in mod_spidermonkey_odbc + Damjan Jovanovic <moctodliamgtavojtodnajmad backwards> - mod_java + +A big THANK YOU goes to: + +Justin Cassidy - Build related cleanups and automatic build setup. +Bret McDanel - Javascript Documentation, constant feedback and input, many other things I am sure I am forgetting. + +You are free to distribute this software under the terms of +the MPL Mozilla Public License. On Debian systems, the complete +text of the GNU General Public License can be found in the file +'/usr/share/common-licenses/MPL'. commit 36f8385bc85b4a34a9787fc0fde7c9c8f0b987e9 Author: Moises Silva <moy@sangoma.com> Date: Tue Oct 12 13:19:48 2010 -0400 mod_sangoma_codec: update stats to include more verbose rtp tx/rx format information diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index 697134b..19f460b 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -898,37 +898,40 @@ SWITCH_STANDARD_API(sangoma_function) if (sess->encoder.rxrtp) { stats = switch_rtp_get_stats(sess->encoder.rxrtp, NULL); - stream->write_function(stream, "=== Encoder ===\n"); + stream->write_function(stream, "=== %s Encoder ===\n", sess->impl->iananame); - stream->write_function(stream, "Remote address: %s:%d\n\n", switch_rtp_get_remote_host(sess->encoder.rxrtp), switch_rtp_get_remote_port(sess->encoder.rxrtp)); + stream->write_function(stream, "Tx ULAW from %d.%d.%d.%d:%d to %d.%d.%d.%d:%d\n\n", SNGTC_NIPV4(sess->encoder.reply.a.host_ip), sess->encoder.reply.a.host_udp_port, + SNGTC_NIPV4(sess->encoder.reply.a.codec_ip), sess->encoder.reply.a.codec_udp_port); + stream->write_function(stream, "Rx %s at %d.%d.%d.%d:%d from %d.%d.%d.%d:%d\n\n", sess->impl->iananame, SNGTC_NIPV4(sess->encoder.reply.b.host_ip), sess->encoder.reply.b.host_udp_port, + SNGTC_NIPV4(sess->encoder.reply.b.codec_ip), sess->encoder.reply.b.codec_udp_port); - stream->write_function(stream, "-- Encoder Inbound Stats --\n"); + + stream->write_function(stream, "-- Inbound Stats --\n"); stream->write_function(stream, "Rx Discarded: %lu\n", sess->encoder.rxdiscarded); sangoma_print_stats(stream, &stats->inbound); stats = switch_rtp_get_stats(sess->encoder.txrtp, NULL); - stream->write_function(stream, "-- Encoder Outbound Stats --\n"); + stream->write_function(stream, "-- Outbound Stats --\n"); sangoma_print_stats(stream, &stats->outbound); - } else { - stream->write_function(stream, "\n=== No Encoder ===\n\n"); } if (sess->decoder.rxrtp) { stats = switch_rtp_get_stats(sess->decoder.rxrtp, NULL); - stream->write_function(stream, "=== Decoder ===\n"); - stream->write_function(stream, "Remote address: %s:%d\n\n", switch_rtp_get_remote_host(sess->decoder.rxrtp), switch_rtp_get_remote_port(sess->decoder.rxrtp)); + stream->write_function(stream, "=== %s Decoder ===\n", sess->impl->iananame); + stream->write_function(stream, "Tx %s from %d.%d.%d.%d:%d to %d.%d.%d.%d:%d\n\n", sess->impl->iananame, SNGTC_NIPV4(sess->decoder.reply.a.host_ip), sess->decoder.reply.a.host_udp_port, + SNGTC_NIPV4(sess->decoder.reply.a.codec_ip), sess->decoder.reply.a.codec_udp_port); + stream->write_function(stream, "Rx ULAW at %d.%d.%d.%d:%d from %d.%d.%d.%d:%d\n\n", SNGTC_NIPV4(sess->decoder.reply.b.host_ip), sess->decoder.reply.b.host_udp_port, + SNGTC_NIPV4(sess->decoder.reply.b.codec_ip), sess->decoder.reply.b.codec_udp_port); - stream->write_function(stream, "-- Decoder Inbound Stats --\n"); + stream->write_function(stream, "-- Inbound Stats --\n"); stream->write_function(stream, "Rx Discarded: %lu\n", sess->decoder.rxdiscarded); sangoma_print_stats(stream, &stats->inbound); stats = switch_rtp_get_stats(sess->decoder.txrtp, NULL); - stream->write_function(stream, "-- Decoder Outbound Stats --\n"); + stream->write_function(stream, "-- Outbound Stats --\n"); sangoma_print_stats(stream, &stats->outbound); - } else { - stream->write_function(stream, "\n=== No Decoder ===\n\n"); } } else if (!strcasecmp(argv[0], "debug")) { struct sangoma_transcoding_session *sess; commit c4d1df76191fd4562d5e2fb202fb8ffe39437f38 Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Oct 14 14:45:15 2010 -0500 continuation of msbuild enabled automated installers for Win32/X64 diff --git a/Freeswitch.2010.sln b/Freeswitch.2010.sln index a7af2ca..4b67f51 100644 --- a/Freeswitch.2010.sln +++ b/Freeswitch.2010.sln @@ -711,2237 +711,2902 @@ Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 All|x64 = All|x64 - All|x86 = All|x86 + All|x64 Setup = All|x64 Setup + All|x86 Setup = All|x86 Setup Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 + Debug|x64 Setup = Debug|x64 Setup + Debug|x86 Setup = Debug|x86 Setup Release|Win32 = Release|Win32 Release|x64 = Release|x64 - Release|x86 = Release|x86 + Release|x64 Setup = Release|x64 Setup + Release|x86 Setup = Release|x86 Setup EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.All|Win32.ActiveCfg = Release|x64 {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.All|x64.ActiveCfg = Release|x64 {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.All|x64.Build.0 = Release|x64 - {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.All|x86.ActiveCfg = Release|x64 + {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.All|x64 Setup.ActiveCfg = Release|x64 + {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.All|x64 Setup.Build.0 = Release|x64 + {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.All|x86 Setup.ActiveCfg = Release|x64 {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Debug|Win32.ActiveCfg = Debug|Win32 {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Debug|Win32.Build.0 = Debug|Win32 {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Debug|x64.ActiveCfg = Debug|x64 {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Debug|x64.Build.0 = Debug|x64 - {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Debug|x86.ActiveCfg = Debug|x64 + {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Release|Win32.ActiveCfg = Release|Win32 {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Release|Win32.Build.0 = Release|Win32 {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Release|x64.ActiveCfg = Release|x64 {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Release|x64.Build.0 = Release|x64 - {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Release|x86.ActiveCfg = Release|x64 + {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Release|x64 Setup.ActiveCfg = Release|x64 + {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Release|x86 Setup.ActiveCfg = Release|Win32 {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.All|Win32.ActiveCfg = Release|x64 {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.All|x64.ActiveCfg = Release|x64 {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.All|x64.Build.0 = Release|x64 - {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.All|x86.ActiveCfg = Release|x64 + {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.All|x64 Setup.ActiveCfg = Release|x64 + {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.All|x64 Setup.Build.0 = Release|x64 + {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.All|x86 Setup.ActiveCfg = Release|x64 {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Debug|Win32.ActiveCfg = Debug|Win32 {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Debug|Win32.Build.0 = Debug|Win32 {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Debug|x64.ActiveCfg = Debug|x64 {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Debug|x64.Build.0 = Debug|x64 - {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Debug|x86.ActiveCfg = Debug|x64 + {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Release|Win32.ActiveCfg = Release|Win32 {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Release|Win32.Build.0 = Release|Win32 {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Release|x64.ActiveCfg = Release|x64 {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Release|x64.Build.0 = Release|x64 - {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Release|x86.ActiveCfg = Release|x64 + {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Release|x64 Setup.ActiveCfg = Release|x64 + {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Release|x86 Setup.ActiveCfg = Release|Win32 {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.All|Win32.ActiveCfg = Release Passthrough|x64 {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.All|x64.ActiveCfg = Release Passthrough|x64 {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.All|x64.Build.0 = Release Passthrough|x64 - {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.All|x86.ActiveCfg = Release|x64 + {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.All|x64 Setup.ActiveCfg = Release Passthrough|x64 + {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.All|x64 Setup.Build.0 = Release Passthrough|x64 + {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.All|x86 Setup.ActiveCfg = Release Passthrough|x64 {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Debug|Win32.ActiveCfg = Debug Passthrough|Win32 {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Debug|Win32.Build.0 = Debug Passthrough|Win32 {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Debug|x64.ActiveCfg = Debug Passthrough|x64 {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Debug|x64.Build.0 = Debug Passthrough|x64 - {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Debug|x86.ActiveCfg = Debug|x64 + {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Debug|x64 Setup.ActiveCfg = Debug Passthrough|x64 + {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Debug|x86 Setup.ActiveCfg = Debug Passthrough|Win32 {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Release|Win32.ActiveCfg = Release Passthrough|Win32 {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Release|Win32.Build.0 = Release Passthrough|Win32 {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Release|x64.ActiveCfg = Release Passthrough|x64 {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Release|x64.Build.0 = Release Passthrough|x64 - {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Release|x86.ActiveCfg = Release|x64 + {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Release|x64 Setup.ActiveCfg = Release Passthrough|x64 + {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Release|x86 Setup.ActiveCfg = Release Passthrough|Win32 {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.All|Win32.ActiveCfg = Release|x64 {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.All|x64.ActiveCfg = Release|x64 {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.All|x64.Build.0 = Release|x64 - {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.All|x86.ActiveCfg = Release|x64 + {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.All|x64 Setup.ActiveCfg = Release|x64 + {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.All|x64 Setup.Build.0 = Release|x64 + {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.All|x86 Setup.ActiveCfg = Release|x64 {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Debug|Win32.ActiveCfg = Debug|Win32 {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Debug|Win32.Build.0 = Debug|Win32 {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Debug|x64.ActiveCfg = Debug|x64 {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Debug|x64.Build.0 = Debug|x64 - {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Debug|x86.ActiveCfg = Debug|x64 + {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|Win32.ActiveCfg = Release|Win32 {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|Win32.Build.0 = Release|Win32 {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|x64.ActiveCfg = Release|x64 {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|x64.Build.0 = Release|x64 - {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|x86.ActiveCfg = Release|x64 + {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|x64 Setup.ActiveCfg = Release|x64 + {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|x86 Setup.ActiveCfg = Release|Win32 {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.All|Win32.ActiveCfg = Release|x64 {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.All|x64.ActiveCfg = Release|x64 {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.All|x64.Build.0 = Release|x64 - {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.All|x86.ActiveCfg = Release|x64 + {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.All|x64 Setup.ActiveCfg = Release|x64 + {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.All|x64 Setup.Build.0 = Release|x64 + {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.All|x86 Setup.ActiveCfg = Release|x64 {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Debug|Win32.ActiveCfg = Debug|Win32 {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Debug|Win32.Build.0 = Debug|Win32 {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Debug|x64.ActiveCfg = Debug|x64 {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Debug|x64.Build.0 = Debug|x64 - {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Debug|x86.ActiveCfg = Debug|x64 + {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Release|Win32.ActiveCfg = Release|Win32 {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Release|Win32.Build.0 = Release|Win32 {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Release|x64.ActiveCfg = Release|x64 {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Release|x64.Build.0 = Release|x64 - {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Release|x86.ActiveCfg = Release|x64 + {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Release|x64 Setup.ActiveCfg = Release|x64 + {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Release|x86 Setup.ActiveCfg = Release|Win32 {5580D60E-0F77-4716-9CD4-B8E5986FA375}.All|Win32.ActiveCfg = Release|x64 {5580D60E-0F77-4716-9CD4-B8E5986FA375}.All|x64.ActiveCfg = Release|x64 {5580D60E-0F77-4716-9CD4-B8E5986FA375}.All|x64.Build.0 = Release|x64 - {5580D60E-0F77-4716-9CD4-B8E5986FA375}.All|x86.ActiveCfg = Release|x64 + {5580D60E-0F77-4716-9CD4-B8E5986FA375}.All|x64 Setup.ActiveCfg = Release|x64 + {5580D60E-0F77-4716-9CD4-B8E5986FA375}.All|x64 Setup.Build.0 = Release|x64 + {5580D60E-0F77-4716-9CD4-B8E5986FA375}.All|x86 Setup.ActiveCfg = Release|x64 {5580D60E-0F77-4716-9CD4-B8E5986FA375}.Debug|Win32.ActiveCfg = Debug|Win32 {5580D60E-0F77-4716-9CD4-B8E5986FA375}.Debug|Win32.Build.0 = Debug|Win32 {5580D60E-0F77-4716-9CD4-B8E5986FA375}.Debug|x64.ActiveCfg = Debug|x64 {5580D60E-0F77-4716-9CD4-B8E5986FA375}.Debug|x64.Build.0 = Debug|x64 - {5580D60E-0F77-4716-9CD4-B8E5986FA375}.Debug|x86.ActiveCfg = Debug|x64 + {5580D60E-0F77-4716-9CD4-B8E5986FA375}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {5580D60E-0F77-4716-9CD4-B8E5986FA375}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|Win32.ActiveCfg = Release|Win32 {5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|Win32.Build.0 = Release|Win32 {5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|x64.ActiveCfg = Release|x64 {5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|x64.Build.0 = Release|x64 - {5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|x86.ActiveCfg = Release|x64 + {5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|x64 Setup.ActiveCfg = Release|x64 + {5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|x86 Setup.ActiveCfg = Release|Win32 {1A1FF289-4FD6-4285-A422-D31DD67A4723}.All|Win32.ActiveCfg = Release|Win32 {1A1FF289-4FD6-4285-A422-D31DD67A4723}.All|x64.ActiveCfg = Release|Win32 - {1A1FF289-4FD6-4285-A422-D31DD67A4723}.All|x86.ActiveCfg = Release|Win32 + {1A1FF289-4FD6-4285-A422-D31DD67A4723}.All|x64 Setup.ActiveCfg = Release|Win32 + {1A1FF289-4FD6-4285-A422-D31DD67A4723}.All|x86 Setup.ActiveCfg = Release|Win32 {1A1FF289-4FD6-4285-A422-D31DD67A4723}.Debug|Win32.ActiveCfg = Debug|Win32 {1A1FF289-4FD6-4285-A422-D31DD67A4723}.Debug|x64.ActiveCfg = Debug|Win32 - {1A1FF289-4FD6-4285-A422-D31DD67A4723}.Debug|x86.ActiveCfg = Debug|Win32 + {1A1FF289-4FD6-4285-A422-D31DD67A4723}.Debug|x64 Setup.ActiveCfg = Debug|Win32 + {1A1FF289-4FD6-4285-A422-D31DD67A4723}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {1A1FF289-4FD6-4285-A422-D31DD67A4723}.Release|Win32.ActiveCfg = Release|Win32 {1A1FF289-4FD6-4285-A422-D31DD67A4723}.Release|x64.ActiveCfg = Release|Win32 - {1A1FF289-4FD6-4285-A422-D31DD67A4723}.Release|x86.ActiveCfg = Release|Win32 + {1A1FF289-4FD6-4285-A422-D31DD67A4723}.Release|x64 Setup.ActiveCfg = Release|Win32 + {1A1FF289-4FD6-4285-A422-D31DD67A4723}.Release|x86 Setup.ActiveCfg = Release|Win32 {07113B25-D3AF-4E04-BA77-4CD1171F022C}.All|Win32.ActiveCfg = Release|x64 {07113B25-D3AF-4E04-BA77-4CD1171F022C}.All|x64.ActiveCfg = Release|x64 {07113B25-D3AF-4E04-BA77-4CD1171F022C}.All|x64.Build.0 = Release|x64 - {07113B25-D3AF-4E04-BA77-4CD1171F022C}.All|x86.ActiveCfg = Release|x64 + {07113B25-D3AF-4E04-BA77-4CD1171F022C}.All|x64 Setup.ActiveCfg = Release|x64 + {07113B25-D3AF-4E04-BA77-4CD1171F022C}.All|x64 Setup.Build.0 = Release|x64 + {07113B25-D3AF-4E04-BA77-4CD1171F022C}.All|x86 Setup.ActiveCfg = Release|x64 {07113B25-D3AF-4E04-BA77-4CD1171F022C}.Debug|Win32.ActiveCfg = Debug|Win32 {07113B25-D3AF-4E04-BA77-4CD1171F022C}.Debug|Win32.Build.0 = Debug|Win32 {07113B25-D3AF-4E04-BA77-4CD1171F022C}.Debug|x64.ActiveCfg = Debug|x64 {07113B25-D3AF-4E04-BA77-4CD1171F022C}.Debug|x64.Build.0 = Debug|x64 - {07113B25-D3AF-4E04-BA77-4CD1171F022C}.Debug|x86.ActiveCfg = Debug|x64 + {07113B25-D3AF-4E04-BA77-4CD1171F022C}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {07113B25-D3AF-4E04-BA77-4CD1171F022C}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {07113B25-D3AF-4E04-BA77-4CD1171F022C}.Release|Win32.ActiveCfg = Release|Win32 {07113B25-D3AF-4E04-BA77-4CD1171F022C}.Release|Win32.Build.0 = Release|Win32 {07113B25-D3AF-4E04-BA77-4CD1171F022C}.Release|x64.ActiveCfg = Release|x64 {07113B25-D3AF-4E04-BA77-4CD1171F022C}.Release|x64.Build.0 = Release|x64 - {07113B25-D3AF-4E04-BA77-4CD1171F022C}.Release|x86.ActiveCfg = Release|x64 + {07113B25-D3AF-4E04-BA77-4CD1171F022C}.Release|x64 Setup.ActiveCfg = Release|x64 + {07113B25-D3AF-4E04-BA77-4CD1171F022C}.Release|x86 Setup.ActiveCfg = Release|Win32 {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.All|Win32.ActiveCfg = Release MS-LDAP|x64 {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.All|x64.ActiveCfg = Release MS-LDAP|x64 {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.All|x64.Build.0 = Release MS-LDAP|x64 - {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.All|x86.ActiveCfg = Release|x64 + {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.All|x64 Setup.ActiveCfg = Release MS-LDAP|x64 + {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.All|x64 Setup.Build.0 = Release MS-LDAP|x64 + {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.All|x86 Setup.ActiveCfg = Release MS-LDAP|x64 {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Debug|Win32.ActiveCfg = Debug MS-LDAP|Win32 {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Debug|Win32.Build.0 = Debug MS-LDAP|Win32 {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Debug|x64.ActiveCfg = Debug MS-LDAP|x64 {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Debug|x64.Build.0 = Debug MS-LDAP|x64 - {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Debug|x86.ActiveCfg = Debug|x64 + {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Debug|x64 Setup.ActiveCfg = Debug MS-LDAP|x64 + {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Debug|x86 Setup.ActiveCfg = Debug MS-LDAP|Win32 {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Release|Win32.ActiveCfg = Release MS-LDAP|Win32 {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Release|Win32.Build.0 = Release MS-LDAP|Win32 {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Release|x64.ActiveCfg = Release MS-LDAP|x64 {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Release|x64.Build.0 = Release MS-LDAP|x64 - {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Release|x86.ActiveCfg = Release|x64 + {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Release|x64 Setup.ActiveCfg = Release MS-LDAP|x64 + {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Release|x86 Setup.ActiveCfg = Release MS-LDAP|Win32 {A27CCA23-1541-4337-81A4-F0A6413078A0}.All|Win32.ActiveCfg = Release|x64 {A27CCA23-1541-4337-81A4-F0A6413078A0}.All|x64.ActiveCfg = Release|x64 {A27CCA23-1541-4337-81A4-F0A6413078A0}.All|x64.Build.0 = Release|x64 - {A27CCA23-1541-4337-81A4-F0A6413078A0}.All|x86.ActiveCfg = Release|x64 + {A27CCA23-1541-4337-81A4-F0A6413078A0}.All|x64 Setup.ActiveCfg = Release|x64 + {A27CCA23-1541-4337-81A4-F0A6413078A0}.All|x64 Setup.Build.0 = Release|x64 + {A27CCA23-1541-4337-81A4-F0A6413078A0}.All|x86 Setup.ActiveCfg = Release|x64 {A27CCA23-1541-4337-81A4-F0A6413078A0}.Debug|Win32.ActiveCfg = Debug|Win32 {A27CCA23-1541-4337-81A4-F0A6413078A0}.Debug|Win32.Build.0 = Debug|Win32 {A27CCA23-1541-4337-81A4-F0A6413078A0}.Debug|x64.ActiveCfg = Debug|x64 {A27CCA23-1541-4337-81A4-F0A6413078A0}.Debug|x64.Build.0 = Debug|x64 - {A27CCA23-1541-4337-81A4-F0A6413078A0}.Debug|x86.ActiveCfg = Debug|x64 + {A27CCA23-1541-4337-81A4-F0A6413078A0}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {A27CCA23-1541-4337-81A4-F0A6413078A0}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {A27CCA23-1541-4337-81A4-F0A6413078A0}.Release|Win32.ActiveCfg = Release|Win32 {A27CCA23-1541-4337-81A4-F0A6413078A0}.Release|Win32.Build.0 = Release|Win32 {A27CCA23-1541-4337-81A4-F0A6413078A0}.Release|x64.ActiveCfg = Release|x64 {A27CCA23-1541-4337-81A4-F0A6413078A0}.Release|x64.Build.0 = Release|x64 - {A27CCA23-1541-4337-81A4-F0A6413078A0}.Release|x86.ActiveCfg = Release|x64 + {A27CCA23-1541-4337-81A4-F0A6413078A0}.Release|x64 Setup.ActiveCfg = Release|x64 + {A27CCA23-1541-4337-81A4-F0A6413078A0}.Release|x86 Setup.ActiveCfg = Release|Win32 {784113EF-44D9-4949-835D-7065D3C7AD08}.All|Win32.ActiveCfg = Release|x64 {784113EF-44D9-4949-835D-7065D3C7AD08}.All|x64.ActiveCfg = Release|x64 {784113EF-44D9-4949-835D-7065D3C7AD08}.All|x64.Build.0 = Release|x64 - {784113EF-44D9-4949-835D-7065D3C7AD08}.All|x86.ActiveCfg = Release|x64 + {784113EF-44D9-4949-835D-7065D3C7AD08}.All|x64 Setup.ActiveCfg = Release|x64 + {784113EF-44D9-4949-835D-7065D3C7AD08}.All|x64 Setup.Build.0 = Release|x64 + {784113EF-44D9-4949-835D-7065D3C7AD08}.All|x86 Setup.ActiveCfg = Release|x64 {784113EF-44D9-4949-835D-7065D3C7AD08}.Debug|Win32.ActiveCfg = Debug|Win32 {784113EF-44D9-4949-835D-7065D3C7AD08}.Debug|Win32.Build.0 = Debug|Win32 {784113EF-44D9-4949-835D-7065D3C7AD08}.Debug|x64.ActiveCfg = Debug|x64 {784113EF-44D9-4949-835D-7065D3C7AD08}.Debug|x64.Build.0 = Debug|x64 - {784113EF-44D9-4949-835D-7065D3C7AD08}.Debug|x86.ActiveCfg = Debug|x64 + {784113EF-44D9-4949-835D-7065D3C7AD08}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {784113EF-44D9-4949-835D-7065D3C7AD08}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {784113EF-44D9-4949-835D-7065D3C7AD08}.Release|Win32.ActiveCfg = Release|Win32 {784113EF-44D9-4949-835D-7065D3C7AD08}.Release|Win32.Build.0 = Release|Win32 {784113EF-44D9-4949-835D-7065D3C7AD08}.Release|x64.ActiveCfg = Release|x64 {784113EF-44D9-4949-835D-7065D3C7AD08}.Release|x64.Build.0 = Release|x64 - {784113EF-44D9-4949-835D-7065D3C7AD08}.Release|x86.ActiveCfg = Release|x64 + {784113EF-44D9-4949-835D-7065D3C7AD08}.Release|x64 Setup.ActiveCfg = Release|x64 + {784113EF-44D9-4949-835D-7065D3C7AD08}.Release|x86 Setup.ActiveCfg = Release|Win32 {89385C74-5860-4174-9CAF-A39E7C48909C}.All|Win32.ActiveCfg = Release|x64 {89385C74-5860-4174-9CAF-A39E7C48909C}.All|x64.ActiveCfg = Release|x64 {89385C74-5860-4174-9CAF-A39E7C48909C}.All|x64.Build.0 = Release|x64 - {89385C74-5860-4174-9CAF-A39E7C48909C}.All|x86.ActiveCfg = Release|x64 + {89385C74-5860-4174-9CAF-A39E7C48909C}.All|x64 Setup.ActiveCfg = Release|x64 + {89385C74-5860-4174-9CAF-A39E7C48909C}.All|x64 Setup.Build.0 = Release|x64 + {89385C74-5860-4174-9CAF-A39E7C48909C}.All|x86 Setup.ActiveCfg = Release|x64 {89385C74-5860-4174-9CAF-A39E7C48909C}.Debug|Win32.ActiveCfg = Debug|Win32 {89385C74-5860-4174-9CAF-A39E7C48909C}.Debug|Win32.Build.0 = Debug|Win32 {89385C74-5860-4174-9CAF-A39E7C48909C}.Debug|x64.ActiveCfg = Debug|x64 {89385C74-5860-4174-9CAF-A39E7C48909C}.Debug|x64.Build.0 = Debug|x64 - {89385C74-5860-4174-9CAF-A39E7C48909C}.Debug|x86.ActiveCfg = Debug|x64 + {89385C74-5860-4174-9CAF-A39E7C48909C}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {89385C74-5860-4174-9CAF-A39E7C48909C}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {89385C74-5860-4174-9CAF-A39E7C48909C}.Release|Win32.ActiveCfg = Release|Win32 {89385C74-5860-4174-9CAF-A39E7C48909C}.Release|Win32.Build.0 = Release|Win32 {89385C74-5860-4174-9CAF-A39E7C48909C}.Release|x64.ActiveCfg = Release|x64 {89385C74-5860-4174-9CAF-A39E7C48909C}.Release|x64.Build.0 = Release|x64 - {89385C74-5860-4174-9CAF-A39E7C48909C}.Release|x86.ActiveCfg = Release|x64 + {89385C74-5860-4174-9CAF-A39E7C48909C}.Release|x64 Setup.ActiveCfg = Release|x64 + {89385C74-5860-4174-9CAF-A39E7C48909C}.Release|x86 Setup.ActiveCfg = Release|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|Win32.ActiveCfg = Release|x64 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|x64.ActiveCfg = Release|x64 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|x64.Build.0 = Release|x64 - {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|x86.ActiveCfg = Release|x64 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|x64 Setup.ActiveCfg = Release|x64 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|x64 Setup.Build.0 = Release|x64 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|x86 Setup.ActiveCfg = Release|x64 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|Win32.ActiveCfg = Debug|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|Win32.Build.0 = Debug|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|x64.ActiveCfg = Debug|x64 - {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|x86.ActiveCfg = Debug|x64 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|Win32.ActiveCfg = Release|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|Win32.Build.0 = Release|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|x64.ActiveCfg = Release|x64 - {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|x86.ActiveCfg = Release|x64 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|x64 Setup.ActiveCfg = Release|x64 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|x86 Setup.ActiveCfg = Release|Win32 {692F6330-4D87-4C82-81DF-40DB5892636E}.All|Win32.ActiveCfg = Release|x64 {692F6330-4D87-4C82-81DF-40DB5892636E}.All|x64.ActiveCfg = Release|x64 {692F6330-4D87-4C82-81DF-40DB5892636E}.All|x64.Build.0 = Release|x64 - {692F6330-4D87-4C82-81DF-40DB5892636E}.All|x86.ActiveCfg = Release|x64 + {692F6330-4D87-4C82-81DF-40DB5892636E}.All|x64 Setup.ActiveCfg = Release|x64 + {692F6330-4D87-4C82-81DF-40DB5892636E}.All|x64 Setup.Build.0 = Release|x64 + {692F6330-4D87-4C82-81DF-40DB5892636E}.All|x86 Setup.ActiveCfg = Release|x64 {692F6330-4D87-4C82-81DF-40DB5892636E}.Debug|Win32.ActiveCfg = Debug|Win32 {692F6330-4D87-4C82-81DF-40DB5892636E}.Debug|x64.ActiveCfg = Debug|x64 - {692F6330-4D87-4C82-81DF-40DB5892636E}.Debug|x86.ActiveCfg = Debug|x64 + {692F6330-4D87-4C82-81DF-40DB5892636E}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {692F6330-4D87-4C82-81DF-40DB5892636E}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {692F6330-4D87-4C82-81DF-40DB5892636E}.Release|Win32.ActiveCfg = Release|Win32 {692F6330-4D87-4C82-81DF-40DB5892636E}.Release|x64.ActiveCfg = Release|x64 - {692F6330-4D87-4C82-81DF-40DB5892636E}.Release|x86.ActiveCfg = Release|x64 + {692F6330-4D87-4C82-81DF-40DB5892636E}.Release|x64 Setup.ActiveCfg = Release|x64 + {692F6330-4D87-4C82-81DF-40DB5892636E}.Release|x86 Setup.ActiveCfg = Release|Win32 {D3EC0AFF-76FC-4210-A825-9A17410660A3}.All|Win32.ActiveCfg = Release|x64 {D3EC0AFF-76FC-4210-A825-9A17410660A3}.All|x64.ActiveCfg = Release|x64 {D3EC0AFF-76FC-4210-A825-9A17410660A3}.All|x64.Build.0 = Release|x64 - {D3EC0AFF-76FC-4210-A825-9A17410660A3}.All|x86.ActiveCfg = Release|x64 + {D3EC0AFF-76FC-4210-A825-9A17410660A3}.All|x64 Setup.ActiveCfg = Release|x64 + {D3EC0AFF-76FC-4210-A825-9A17410660A3}.All|x64 Setup.Build.0 = Release|x64 + {D3EC0AFF-76FC-4210-A825-9A17410660A3}.All|x86 Setup.ActiveCfg = Release|x64 {D3EC0AFF-76FC-4210-A825-9A17410660A3}.Debug|Win32.ActiveCfg = Debug|Win32 {D3EC0AFF-76FC-4210-A825-9A17410660A3}.Debug|Win32.Build.0 = Debug|Win32 {D3EC0AFF-76FC-4210-A825-9A17410660A3}.Debug|x64.ActiveCfg = Debug|x64 {D3EC0AFF-76FC-4210-A825-9A17410660A3}.Debug|x64.Build.0 = Debug|x64 - {D3EC0AFF-76FC-4210-A825-9A17410660A3}.Debug|x86.ActiveCfg = Debug|x64 + {D3EC0AFF-76FC-4210-A825-9A17410660A3}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {D3EC0AFF-76FC-4210-A825-9A17410660A3}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {D3EC0AFF-76FC-4210-A825-9A17410660A3}.Release|Win32.ActiveCfg = Release|Win32 {D3EC0AFF-76FC-4210-A825-9A17410660A3}.Release|Win32.Build.0 = Release|Win32 {D3EC0AFF-76FC-4210-A825-9A17410660A3}.Release|x64.ActiveCfg = Release|x64 {D3EC0AFF-76FC-4210-A825-9A17410660A3}.Release|x64.Build.0 = Release|x64 - {D3EC0AFF-76FC-4210-A825-9A17410660A3}.Release|x86.ActiveCfg = Release|x64 + {D3EC0AFF-76FC-4210-A825-9A17410660A3}.Release|x64 Setup.ActiveCfg = Release|x64 + {D3EC0AFF-76FC-4210-A825-9A17410660A3}.Release|x86 Setup.ActiveCfg = Release|Win32 {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.All|Win32.ActiveCfg = Release|x64 {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.All|x64.ActiveCfg = Release|x64 {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.All|x64.Build.0 = Release|x64 - {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.All|x86.ActiveCfg = Release|x64 + {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.All|x64 Setup.ActiveCfg = Release|x64 + {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.All|x64 Setup.Build.0 = Release|x64 + {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.All|x86 Setup.ActiveCfg = Release|x64 {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Debug|Win32.ActiveCfg = Debug|Win32 {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Debug|Win32.Build.0 = Debug|Win32 {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Debug|x64.ActiveCfg = Debug|x64 {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Debug|x64.Build.0 = Debug|x64 - {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Debug|x86.ActiveCfg = Debug|x64 + {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Release|Win32.ActiveCfg = Release|Win32 {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Release|Win32.Build.0 = Release|Win32 {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Release|x64.ActiveCfg = Release|x64 {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Release|x64.Build.0 = Release|x64 - {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Release|x86.ActiveCfg = Release|x64 + {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Release|x64 Setup.ActiveCfg = Release|x64 + {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Release|x86 Setup.ActiveCfg = Release|Win32 {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.All|Win32.ActiveCfg = Release|x64 {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.All|x64.ActiveCfg = Release|x64 {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.All|x64.Build.0 = Release|x64 - {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.All|x86.ActiveCfg = Release|x64 + {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.All|x64 Setup.ActiveCfg = Release|x64 + {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.All|x64 Setup.Build.0 = Release|x64 + {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.All|x86 Setup.ActiveCfg = Release|x64 {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Debug|Win32.ActiveCfg = Debug|Win32 {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Debug|Win32.Build.0 = Debug|Win32 {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Debug|x64.ActiveCfg = Debug|x64 {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Debug|x64.Build.0 = Debug|x64 - {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Debug|x86.ActiveCfg = Debug|x64 + {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Release|Win32.ActiveCfg = Release|Win32 {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Release|Win32.Build.0 = Release|Win32 {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Release|x64.ActiveCfg = Release|x64 {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Release|x64.Build.0 = Release|x64 - {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Release|x86.ActiveCfg = Release|x64 + {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Release|x64 Setup.ActiveCfg = Release|x64 + {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Release|x86 Setup.ActiveCfg = Release|Win32 {1C453396-D912-4213-89FD-9B489162B7B5}.All|Win32.ActiveCfg = Release|x64 {1C453396-D912-4213-89FD-9B489162B7B5}.All|x64.ActiveCfg = Release|x64 {1C453396-D912-4213-89FD-9B489162B7B5}.All|x64.Build.0 = Release|x64 - {1C453396-D912-4213-89FD-9B489162B7B5}.All|x86.ActiveCfg = Release|x64 + {1C453396-D912-4213-89FD-9B489162B7B5}.All|x64 Setup.ActiveCfg = Release|x64 + {1C453396-D912-4213-89FD-9B489162B7B5}.All|x64 Setup.Build.0 = Release|x64 + {1C453396-D912-4213-89FD-9B489162B7B5}.All|x86 Setup.ActiveCfg = Release|x64 {1C453396-D912-4213-89FD-9B489162B7B5}.Debug|Win32.ActiveCfg = Debug|Win32 {1C453396-D912-4213-89FD-9B489162B7B5}.Debug|Win32.Build.0 = Debug|Win32 {1C453396-D912-4213-89FD-9B489162B7B5}.Debug|x64.ActiveCfg = Debug|x64 {1C453396-D912-4213-89FD-9B489162B7B5}.Debug|x64.Build.0 = Debug|x64 - {1C453396-D912-4213-89FD-9B489162B7B5}.Debug|x86.ActiveCfg = Debug|x64 + {1C453396-D912-4213-89FD-9B489162B7B5}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {1C453396-D912-4213-89FD-9B489162B7B5}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {1C453396-D912-4213-89FD-9B489162B7B5}.Release|Win32.ActiveCfg = Release|Win32 {1C453396-D912-4213-89FD-9B489162B7B5}.Release|Win32.Build.0 = Release|Win32 {1C453396-D912-4213-89FD-9B489162B7B5}.Release|x64.ActiveCfg = Release|x64 {1C453396-D912-4213-89FD-9B489162B7B5}.Release|x64.Build.0 = Release|x64 - {1C453396-D912-4213-89FD-9B489162B7B5}.Release|x86.ActiveCfg = Release|x64 + {1C453396-D912-4213-89FD-9B489162B7B5}.Release|x64 Setup.ActiveCfg = Release|x64 + {1C453396-D912-4213-89FD-9B489162B7B5}.Release|x86 Setup.ActiveCfg = Release|Win32 {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.All|Win32.ActiveCfg = Release|x64 {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.All|x64.ActiveCfg = Release|x64 {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.All|x64.Build.0 = Release|x64 - {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.All|x86.ActiveCfg = Release|x64 + {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.All|x64 Setup.ActiveCfg = Release|x64 + {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.All|x64 Setup.Build.0 = Release|x64 + {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.All|x86 Setup.ActiveCfg = Release|x64 {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Debug|Win32.ActiveCfg = Debug|Win32 {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Debug|Win32.Build.0 = Debug|Win32 {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Debug|x64.ActiveCfg = Debug|x64 {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Debug|x64.Build.0 = Debug|x64 - {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Debug|x86.ActiveCfg = Debug|x64 + {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|Win32.ActiveCfg = Release|Win32 {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|Win32.Build.0 = Release|Win32 {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|x64.ActiveCfg = Release|x64 {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|x64.Build.0 = Release|x64 - {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|x86.ActiveCfg = Release|x64 + {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|x64 Setup.ActiveCfg = Release|x64 + {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|x86 Setup.ActiveCfg = Release|Win32 {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.All|Win32.ActiveCfg = Release|x64 {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.All|x64.ActiveCfg = Release|x64 {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.All|x64.Build.0 = Release|x64 - {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.All|x86.ActiveCfg = Release|x64 + {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.All|x64 Setup.ActiveCfg = Release|x64 + {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.All|x64 Setup.Build.0 = Release|x64 + {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.All|x86 Setup.ActiveCfg = Release|x64 {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Debug|Win32.ActiveCfg = Debug|Win32 {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Debug|Win32.Build.0 = Debug|Win32 {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Debug|x64.ActiveCfg = Debug|x64 {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Debug|x64.Build.0 = Debug|x64 - {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Debug|x86.ActiveCfg = Debug|x64 + {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|Win32.ActiveCfg = Release|Win32 {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|Win32.Build.0 = Release|Win32 {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|x64.ActiveCfg = Release|x64 {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|x64.Build.0 = Release|x64 - {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|x86.ActiveCfg = Release|x64 + {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|x64 Setup.ActiveCfg = Release|x64 + {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|x86 Setup.ActiveCfg = Release|Win32 {C24FB505-05D7-4319-8485-7540B44C8603}.All|Win32.ActiveCfg = Release|x64 {C24FB505-05D7-4319-8485-7540B44C8603}.All|x64.ActiveCfg = Release|x64 {C24FB505-05D7-4319-8485-7540B44C8603}.All|x64.Build.0 = Release|x64 - {C24FB505-05D7-4319-8485-7540B44C8603}.All|x86.ActiveCfg = Release|x64 + {C24FB505-05D7-4319-8485-7540B44C8603}.All|x64 Setup.ActiveCfg = Release|x64 + {C24FB505-05D7-4319-8485-7540B44C8603}.All|x64 Setup.Build.0 = Release|x64 + {C24FB505-05D7-4319-8485-7540B44C8603}.All|x86 Setup.ActiveCfg = Release|x64 {C24FB505-05D7-4319-8485-7540B44C8603}.Debug|Win32.ActiveCfg = Debug|Win32 {C24FB505-05D7-4319-8485-7540B44C8603}.Debug|Win32.Build.0 = Debug|Win32 {C24FB505-05D7-4319-8485-7540B44C8603}.Debug|x64.ActiveCfg = Debug|x64 {C24FB505-05D7-4319-8485-7540B44C8603}.Debug|x64.Build.0 = Debug|x64 - {C24FB505-05D7-4319-8485-7540B44C8603}.Debug|x86.ActiveCfg = Debug|x64 + {C24FB505-05D7-4319-8485-7540B44C8603}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {C24FB505-05D7-4319-8485-7540B44C8603}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {C24FB505-05D7-4319-8485-7540B44C8603}.Release|Win32.ActiveCfg = Release|Win32 {C24FB505-05D7-4319-8485-7540B44C8603}.Release|Win32.Build.0 = Release|Win32 {C24FB505-05D7-4319-8485-7540B44C8603}.Release|x64.ActiveCfg = Release|x64 {C24FB505-05D7-4319-8485-7540B44C8603}.Release|x64.Build.0 = Release|x64 - {C24FB505-05D7-4319-8485-7540B44C8603}.Release|x86.ActiveCfg = Release|x64 + {C24FB505-05D7-4319-8485-7540B44C8603}.Release|x64 Setup.ActiveCfg = Release|x64 + {C24FB505-05D7-4319-8485-7540B44C8603}.Release|x86 Setup.ActiveCfg = Release|Win32 {B5881A85-FE70-4F64-8607-2CAAE52669C6}.All|Win32.ActiveCfg = Release|x64 {B5881A85-FE70-4F64-8607-2CAAE52669C6}.All|x64.ActiveCfg = Release|x64 {B5881A85-FE70-4F64-8607-2CAAE52669C6}.All|x64.Build.0 = Release|x64 - {B5881A85-FE70-4F64-8607-2CAAE52669C6}.All|x86.ActiveCfg = Release|x64 + {B5881A85-FE70-4F64-8607-2CAAE52669C6}.All|x64 Setup.ActiveCfg = Release|x64 + {B5881A85-FE70-4F64-8607-2CAAE52669C6}.All|x64 Setup.Build.0 = Release|x64 + {B5881A85-FE70-4F64-8607-2CAAE52669C6}.All|x86 Setup.ActiveCfg = Release|x64 {B5881A85-FE70-4F64-8607-2CAAE52669C6}.Debug|Win32.ActiveCfg = Debug|Win32 {B5881A85-FE70-4F64-8607-2CAAE52669C6}.Debug|Win32.Build.0 = Debug|Win32 {B5881A85-FE70-4F64-8607-2CAAE52669C6}.Debug|x64.ActiveCfg = Debug|x64 {B5881A85-FE70-4F64-8607-2CAAE52669C6}.Debug|x64.Build.0 = Debug|x64 - {B5881A85-FE70-4F64-8607-2CAAE52669C6}.Debug|x86.ActiveCfg = Debug|x64 + {B5881A85-FE70-4F64-8607-2CAAE52669C6}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {B5881A85-FE70-4F64-8607-2CAAE52669C6}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {B5881A85-FE70-4F64-8607-2CAAE52669C6}.Release|Win32.ActiveCfg = Release|Win32 {B5881A85-FE70-4F64-8607-2CAAE52669C6}.Release|Win32.Build.0 = Release|Win32 {B5881A85-FE70-4F64-8607-2CAAE52669C6}.Release|x64.ActiveCfg = Release|x64 {B5881A85-FE70-4F64-8607-2CAAE52669C6}.Release|x64.Build.0 = Release|x64 - {B5881A85-FE70-4F64-8607-2CAAE52669C6}.Release|x86.ActiveCfg = Release|x64 + {B5881A85-FE70-4F64-8607-2CAAE52669C6}.Release|x64 Setup.ActiveCfg = Release|x64 + {B5881A85-FE70-4F64-8607-2CAAE52669C6}.Release|x86 Setup.ActiveCfg = Release|Win32 {05515420-16DE-4E63-BE73-85BE85BA5142}.All|Win32.ActiveCfg = Release|x64 {05515420-16DE-4E63-BE73-85BE85BA5142}.All|x64.ActiveCfg = Release|x64 {05515420-16DE-4E63-BE73-85BE85BA5142}.All|x64.Build.0 = Release|x64 - {05515420-16DE-4E63-BE73-85BE85BA5142}.All|x86.ActiveCfg = Release|x64 + {05515420-16DE-4E63-BE73-85BE85BA5142}.All|x64 Setup.ActiveCfg = Release|x64 + {05515420-16DE-4E63-BE73-85BE85BA5142}.All|x64 Setup.Build.0 = Release|x64 + {05515420-16DE-4E63-BE73-85BE85BA5142}.All|x86 Setup.ActiveCfg = Release|x64 {05515420-16DE-4E63-BE73-85BE85BA5142}.Debug|Win32.ActiveCfg = Debug|Win32 {05515420-16DE-4E63-BE73-85BE85BA5142}.Debug|Win32.Build.0 = Debug|Win32 {05515420-16DE-4E63-BE73-85BE85BA5142}.Debug|x64.ActiveCfg = Debug|x64 {05515420-16DE-4E63-BE73-85BE85BA5142}.Debug|x64.Build.0 = Debug|x64 - {05515420-16DE-4E63-BE73-85BE85BA5142}.Debug|x86.ActiveCfg = Debug|x64 + {05515420-16DE-4E63-BE73-85BE85BA5142}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {05515420-16DE-4E63-BE73-85BE85BA5142}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {05515420-16DE-4E63-BE73-85BE85BA5142}.Release|Win32.ActiveCfg = Release|Win32 {05515420-16DE-4E63-BE73-85BE85BA5142}.Release|Win32.Build.0 = Release|Win32 {05515420-16DE-4E63-BE73-85BE85BA5142}.Release|x64.ActiveCfg = Release|x64 {05515420-16DE-4E63-BE73-85BE85BA5142}.Release|x64.Build.0 = Release|x64 - {05515420-16DE-4E63-BE73-85BE85BA5142}.Release|x86.ActiveCfg = Release|x64 + {05515420-16DE-4E63-BE73-85BE85BA5142}.Release|x64 Setup.ActiveCfg = Release|x64 + {05515420-16DE-4E63-BE73-85BE85BA5142}.Release|x86 Setup.ActiveCfg = Release|Win32 {1906D736-08BD-4EE1-924F-B536249B9A54}.All|Win32.ActiveCfg = Release DLL|x64 {1906D736-08BD-4EE1-924F-B536249B9A54}.All|x64.ActiveCfg = Release DLL|x64 {1906D736-08BD-4EE1-924F-B536249B9A54}.All|x64.Build.0 = Release DLL|x64 - {1906D736-08BD-4EE1-924F-B536249B9A54}.All|x86.ActiveCfg = Release|x64 + {1906D736-08BD-4EE1-924F-B536249B9A54}.All|x64 Setup.ActiveCfg = Release DLL|x64 + {1906D736-08BD-4EE1-924F-B536249B9A54}.All|x64 Setup.Build.0 = Release DLL|x64 + {1906D736-08BD-4EE1-924F-B536249B9A54}.All|x86 Setup.ActiveCfg = Release DLL|x64 {1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|Win32.ActiveCfg = Debug|Win32 {1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|Win32.Build.0 = Debug|Win32 {1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|x64.ActiveCfg = Debug|x64 {1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|x64.Build.0 = Debug|x64 - {1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|x86.ActiveCfg = Debug|x64 + {1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {1906D736-08BD-4EE1-924F-B536249B9A54}.Release|Win32.ActiveCfg = Release|Win32 {1906D736-08BD-4EE1-924F-B536249B9A54}.Release|Win32.Build.0 = Release|Win32 {1906D736-08BD-4EE1-924F-B536249B9A54}.Release|x64.ActiveCfg = Release|x64 {1906D736-08BD-4EE1-924F-B536249B9A54}.Release|x64.Build.0 = Release|x64 - {1906D736-08BD-4EE1-924F-B536249B9A54}.Release|x86.ActiveCfg = Release|x64 + {1906D736-08BD-4EE1-924F-B536249B9A54}.Release|x64 Setup.ActiveCfg = Release|x64 + {1906D736-08BD-4EE1-924F-B536249B9A54}.Release|x86 Setup.ActiveCfg = Release|Win32 {EEF031CB-FED8-451E-A471-91EC8D4F6750}.All|Win32.ActiveCfg = Release Dll|x64 {EEF031CB-FED8-451E-A471-91EC8D4F6750}.All|x64.ActiveCfg = Release Dll|x64 {EEF031CB-FED8-451E-A471-91EC8D4F6750}.All|x64.Build.0 = Release Dll|x64 - {EEF031CB-FED8-451E-A471-91EC8D4F6750}.All|x86.ActiveCfg = Release|x64 + {EEF031CB-FED8-451E-A471-91EC8D4F6750}.All|x64 Setup.ActiveCfg = Release Dll|x64 + {EEF031CB-FED8-451E-A471-91EC8D4F6750}.All|x64 Setup.Build.0 = Release Dll|x64 + {EEF031CB-FED8-451E-A471-91EC8D4F6750}.All|x86 Setup.ActiveCfg = Release Dll|x64 {EEF031CB-FED8-451E-A471-91EC8D4F6750}.Debug|Win32.ActiveCfg = Debug|Win32 {EEF031CB-FED8-451E-A471-91EC8D4F6750}.Debug|Win32.Build.0 = Debug|Win32 {EEF031CB-FED8-451E-A471-91EC8D4F6750}.Debug|x64.ActiveCfg = Debug|x64 {EEF031CB-FED8-451E-A471-91EC8D4F6750}.Debug|x64.Build.0 = Debug|x64 - {EEF031CB-FED8-451E-A471-91EC8D4F6750}.Debug|x86.ActiveCfg = Debug|x64 + {EEF031CB-FED8-451E-A471-91EC8D4F6750}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {EEF031CB-FED8-451E-A471-91EC8D4F6750}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {EEF031CB-FED8-451E-A471-91EC8D4F6750}.Release|Win32.ActiveCfg = Release|Win32 {EEF031CB-FED8-451E-A471-91EC8D4F6750}.Release|Win32.Build.0 = Release|Win32 {EEF031CB-FED8-451E-A471-91EC8D4F6750}.Release|x64.ActiveCfg = Release|x64 {EEF031CB-FED8-451E-A471-91EC8D4F6750}.Release|x64.Build.0 = Release|x64 - {EEF031CB-FED8-451E-A471-91EC8D4F6750}.Release|x86.ActiveCfg = Release|x64 + {EEF031CB-FED8-451E-A471-91EC8D4F6750}.Release|x64 Setup.ActiveCfg = Release|x64 + {EEF031CB-FED8-451E-A471-91EC8D4F6750}.Release|x86 Setup.ActiveCfg = Release|Win32 {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.All|Win32.ActiveCfg = Release DLL|x64 {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.All|x64.ActiveCfg = Release DLL|x64 {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.All|x64.Build.0 = Release DLL|x64 - {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.All|x86.ActiveCfg = Release|x64 + {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.All|x64 Setup.ActiveCfg = Release DLL|x64 + {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.All|x64 Setup.Build.0 = Release DLL|x64 + {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.All|x86 Setup.ActiveCfg = Release DLL|x64 {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Debug|Win32.ActiveCfg = Debug|Win32 {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Debug|Win32.Build.0 = Debug|Win32 {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Debug|x64.ActiveCfg = Debug|x64 {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Debug|x64.Build.0 = Debug|x64 - {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Debug|x86.ActiveCfg = Debug|x64 + {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Release|Win32.ActiveCfg = Release|Win32 {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Release|Win32.Build.0 = Release|Win32 {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Release|x64.ActiveCfg = Release|x64 {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Release|x64.Build.0 = Release|x64 - {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Release|x86.ActiveCfg = Release|x64 + {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Release|x64 Setup.ActiveCfg = Release|x64 + {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Release|x86 Setup.ActiveCfg = Release|Win32 {8D04B550-D240-4A44-8A18-35DA3F7038D9}.All|Win32.ActiveCfg = Release DLL|x64 {8D04B550-D240-4A44-8A18-35DA3F7038D9}.All|x64.ActiveCfg = Release DLL|x64 {8D04B550-D240-4A44-8A18-35DA3F7038D9}.All|x64.Build.0 = Release DLL|x64 - {8D04B550-D240-4A44-8A18-35DA3F7038D9}.All|x86.ActiveCfg = Release|x64 + {8D04B550-D240-4A44-8A18-35DA3F7038D9}.All|x64 Setup.ActiveCfg = Release DLL|x64 + {8D04B550-D240-4A44-8A18-35DA3F7038D9}.All|x64 Setup.Build.0 = Release DLL|x64 + {8D04B550-D240-4A44-8A18-35DA3F7038D9}.All|x86 Setup.ActiveCfg = Release DLL|x64 {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Debug|Win32.ActiveCfg = Debug|Win32 {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Debug|Win32.Build.0 = Debug|Win32 {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Debug|x64.ActiveCfg = Debug|x64 {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Debug|x64.Build.0 = Debug|x64 - {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Debug|x86.ActiveCfg = Debug|x64 + {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Release|Win32.ActiveCfg = Release|Win32 {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Release|Win32.Build.0 = Release|Win32 {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Release|x64.ActiveCfg = Release|x64 {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Release|x64.Build.0 = Release|x64 - {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Release|x86.ActiveCfg = Release|x64 + {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Release|x64 Setup.ActiveCfg = Release|x64 + {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Release|x86 Setup.ActiveCfg = Release|Win32 {1CED5987-A529-46DC-B30F-870D85FF9C94}.All|Win32.ActiveCfg = Release|x64 {1CED5987-A529-46DC-B30F-870D85FF9C94}.All|x64.ActiveCfg = Release|x64 {1CED5987-A529-46DC-B30F-870D85FF9C94}.All|x64.Build.0 = Release|x64 - {1CED5987-A529-46DC-B30F-870D85FF9C94}.All|x86.ActiveCfg = Release|x64 + {1CED5987-A529-46DC-B30F-870D85FF9C94}.All|x64 Setup.ActiveCfg = Release|x64 + {1CED5987-A529-46DC-B30F-870D85FF9C94}.All|x64 Setup.Build.0 = Release|x64 + {1CED5987-A529-46DC-B30F-870D85FF9C94}.All|x86 Setup.ActiveCfg = Release|x64 {1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|Win32.ActiveCfg = Debug|Win32 {1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|Win32.Build.0 = Debug|Win32 {1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|x64.ActiveCfg = Debug|x64 {1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|x64.Build.0 = Debug|x64 - {1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|x86.ActiveCfg = Debug|x64 + {1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|Win32.ActiveCfg = Release|Win32 {1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|Win32.Build.0 = Release|Win32 {1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|x64.ActiveCfg = Release|x64 {1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|x64.Build.0 = Release|x64 - {1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|x86.ActiveCfg = Release|x64 + {1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|x64 Setup.ActiveCfg = Release|x64 + {1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|x86 Setup.ActiveCfg = Release|Win32 {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.All|Win32.ActiveCfg = Release|x64 {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.All|x64.ActiveCfg = Release|x64 {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.All|x64.Build.0 = Release|x64 - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.All|x86.ActiveCfg = Release|x64 + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.All|x64 Setup.ActiveCfg = Release|x64 + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.All|x64 Setup.Build.0 = Release|x64 + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.All|x86 Setup.ActiveCfg = Release|x64 {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Debug|Win32.ActiveCfg = Debug|Win32 {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Debug|Win32.Build.0 = Debug|Win32 {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Debug|x64.ActiveCfg = Debug|x64 {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Debug|x64.Build.0 = Debug|x64 - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Debug|x86.ActiveCfg = Debug|x64 + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Release|Win32.ActiveCfg = Release|Win32 {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Release|Win32.Build.0 = Release|Win32 {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Release|x64.ActiveCfg = Release|x64 {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Release|x64.Build.0 = Release|x64 - {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Release|x86.ActiveCfg = Release|x64 + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Release|x64 Setup.ActiveCfg = Release|x64 + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Release|x86 Setup.ActiveCfg = Release|Win32 {F057DA7F-79E5-4B00-845C-EF446EF055E3}.All|Win32.ActiveCfg = Release|x64 {F057DA7F-79E5-4B00-845C-EF446EF055E3}.All|x64.ActiveCfg = Release|x64 {F057DA7F-79E5-4B00-845C-EF446EF055E3}.All|x64.Build.0 = Release|x64 - {F057DA7F-79E5-4B00-845C-EF446EF055E3}.All|x86.ActiveCfg = Release|x64 + {F057DA7F-79E5-4B00-845C-EF446EF055E3}.All|x64 Setup.ActiveCfg = Release|x64 + {F057DA7F-79E5-4B00-845C-EF446EF055E3}.All|x64 Setup.Build.0 = Release|x64 + {F057DA7F-79E5-4B00-845C-EF446EF055E3}.All|x86 Setup.ActiveCfg = Release|x64 {F057DA7F-79E5-4B00-845C-EF446EF055E3}.Debug|Win32.ActiveCfg = Debug|Win32 {F057DA7F-79E5-4B00-845C-EF446EF055E3}.Debug|Win32.Build.0 = Debug|Win32 {F057DA7F-79E5-4B00-845C-EF446EF055E3}.Debug|x64.ActiveCfg = Debug|x64 {F057DA7F-79E5-4B00-845C-EF446EF055E3}.Debug|x64.Build.0 = Debug|x64 - {F057DA7F-79E5-4B00-845C-EF446EF055E3}.Debug|x86.ActiveCfg = Debug|x64 + {F057DA7F-79E5-4B00-845C-EF446EF055E3}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {F057DA7F-79E5-4B00-845C-EF446EF055E3}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|Win32.ActiveCfg = Release|Win32 {F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|Win32.Build.0 = Release|Win32 {F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|x64.ActiveCfg = Release|x64 {F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|x64.Build.0 = Release|x64 - {F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|x86.ActiveCfg = Release|x64 + {F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|x64 Setup.ActiveCfg = Release|x64 + {F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|x86 Setup.ActiveCfg = Release|Win32 {E727E8F6-935D-46FE-8B0E-37834748A0E3}.All|Win32.ActiveCfg = Release|x64 {E727E8F6-935D-46FE-8B0E-37834748A0E3}.All|x64.ActiveCfg = Release|x64 {E727E8F6-935D-46FE-8B0E-37834748A0E3}.All|x64.Build.0 = Release|x64 - {E727E8F6-935D-46FE-8B0E-37834748A0E3}.All|x86.ActiveCfg = Release|x64 + {E727E8F6-935D-46FE-8B0E-37834748A0E3}.All|x64 Setup.ActiveCfg = Release|x64 + {E727E8F6-935D-46FE-8B0E-37834748A0E3}.All|x64 Setup.Build.0 = Release|x64 + {E727E8F6-935D-46FE-8B0E-37834748A0E3}.All|x86 Setup.ActiveCfg = Release|x64 {E727E8F6-935D-46FE-8B0E-37834748A0E3}.Debug|Win32.ActiveCfg = Debug|Win32 {E727E8F6-935D-46FE-8B0E-37834748A0E3}.Debug|Win32.Build.0 = Debug|Win32 {E727E8F6-935D-46FE-8B0E-37834748A0E3}.Debug|x64.ActiveCfg = Debug|x64 {E727E8F6-935D-46FE-8B0E-37834748A0E3}.Debug|x64.Build.0 = Debug|x64 - {E727E8F6-935D-46FE-8B0E-37834748A0E3}.Debug|x86.ActiveCfg = Debug|x64 + {E727E8F6-935D-46FE-8B0E-37834748A0E3}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {E727E8F6-935D-46FE-8B0E-37834748A0E3}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {E727E8F6-935D-46FE-8B0E-37834748A0E3}.Release|Win32.ActiveCfg = Release|Win32 {E727E8F6-935D-46FE-8B0E-37834748A0E3}.Release|Win32.Build.0 = Release|Win32 {E727E8F6-935D-46FE-8B0E-37834748A0E3}.Release|x64.ActiveCfg = Release|x64 {E727E8F6-935D-46FE-8B0E-37834748A0E3}.Release|x64.Build.0 = Release|x64 - {E727E8F6-935D-46FE-8B0E-37834748A0E3}.Release|x86.ActiveCfg = Release|x64 + {E727E8F6-935D-46FE-8B0E-37834748A0E3}.Release|x64 Setup.ActiveCfg = Release|x64 + {E727E8F6-935D-46FE-8B0E-37834748A0E3}.Release|x86 Setup.ActiveCfg = Release|Win32 {3D0370CA-BED2-4657-A475-32375CBCB6E4}.All|Win32.ActiveCfg = Release|x64 {3D0370CA-BED2-4657-A475-32375CBCB6E4}.All|x64.ActiveCfg = Release|x64 {3D0370CA-BED2-4657-A475-32375CBCB6E4}.All|x64.Build.0 = Release|x64 - {3D0370CA-BED2-4657-A475-32375CBCB6E4}.All|x86.ActiveCfg = Release|x64 + {3D0370CA-BED2-4657-A475-32375CBCB6E4}.All|x64 Setup.ActiveCfg = Release|x64 + {3D0370CA-BED2-4657-A475-32375CBCB6E4}.All|x64 Setup.Build.0 = Release|x64 + {3D0370CA-BED2-4657-A475-32375CBCB6E4}.All|x86 Setup.ActiveCfg = Release|x64 {3D0370CA-BED2-4657-A475-32375CBCB6E4}.Debug|Win32.ActiveCfg = Debug|Win32 {3D0370CA-BED2-4657-A475-32375CBCB6E4}.Debug|Win32.Build.0 = Debug|Win32 {3D0370CA-BED2-4657-A475-32375CBCB6E4}.Debug|x64.ActiveCfg = Debug|x64 {3D0370CA-BED2-4657-A475-32375CBCB6E4}.Debug|x64.Build.0 = Debug|x64 - {3D0370CA-BED2-4657-A475-32375CBCB6E4}.Debug|x86.ActiveCfg = Debug|x64 + {3D0370CA-BED2-4657-A475-32375CBCB6E4}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {3D0370CA-BED2-4657-A475-32375CBCB6E4}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {3D0370CA-BED2-4657-A475-32375CBCB6E4}.Release|Win32.ActiveCfg = Release|Win32 {3D0370CA-BED2-4657-A475-32375CBCB6E4}.Release|Win32.Build.0 = Release|Win32 {3D0370CA-BED2-4657-A475-32375CBCB6E4}.Release|x64.ActiveCfg = Release|x64 {3D0370CA-BED2-4657-A475-32375CBCB6E4}.Release|x64.Build.0 = Release|x64 - {3D0370CA-BED2-4657-A475-32375CBCB6E4}.Release|x86.ActiveCfg = Release|x64 + {3D0370CA-BED2-4657-A475-32375CBCB6E4}.Release|x64 Setup.ActiveCfg = Release|x64 + {3D0370CA-BED2-4657-A475-32375CBCB6E4}.Release|x86 Setup.ActiveCfg = Release|Win32 {87EE9DA4-DE1E-4448-8324-183C98DCA588}.All|Win32.ActiveCfg = Debug|x64 {87EE9DA4-DE1E-4448-8324-183C98DCA588}.All|x64.ActiveCfg = Debug|x64 {87EE9DA4-DE1E-4448-8324-183C98DCA588}.All|x64.Build.0 = Debug|x64 - {87EE9DA4-DE1E-4448-8324-183C98DCA588}.All|x86.ActiveCfg = Release|x64 + {87EE9DA4-DE1E-4448-8324-183C98DCA588}.All|x64 Setup.ActiveCfg = Debug|x64 + {87EE9DA4-DE1E-4448-8324-183C98DCA588}.All|x64 Setup.Build.0 = Debug|x64 + {87EE9DA4-DE1E-4448-8324-183C98DCA588}.All|x86 Setup.ActiveCfg = Debug|x64 {87EE9DA4-DE1E-4448-8324-183C98DCA588}.Debug|Win32.ActiveCfg = Debug|Win32 {87EE9DA4-DE1E-4448-8324-183C98DCA588}.Debug|Win32.Build.0 = Debug|Win32 {87EE9DA4-DE1E-4448-8324-183C98DCA588}.Debug|x64.ActiveCfg = Debug|x64 {87EE9DA4-DE1E-4448-8324-183C98DCA588}.Debug|x64.Build.0 = Debug|x64 - {87EE9DA4-DE1E-4448-8324-183C98DCA588}.Debug|x86.ActiveCfg = Debug|x64 + {87EE9DA4-DE1E-4448-8324-183C98DCA588}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {87EE9DA4-DE1E-4448-8324-183C98DCA588}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|Win32.ActiveCfg = Release|Win32 {87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|Win32.Build.0 = Release|Win32 {87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|x64.ActiveCfg = Release|x64 {87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|x64.Build.0 = Release|x64 - {87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|x86.ActiveCfg = Release|x64 + {87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|x64 Setup.ActiveCfg = Release|x64 + {87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|x86 Setup.ActiveCfg = Release|Win32 {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.All|Win32.ActiveCfg = Debug|x64 {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.All|x64.ActiveCfg = Debug|x64 {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.All|x64.Build.0 = Debug|x64 - {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.All|x86.ActiveCfg = Release|x64 + {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.All|x64 Setup.ActiveCfg = Debug|x64 + {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.All|x64 Setup.Build.0 = Debug|x64 + {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.All|x86 Setup.ActiveCfg = Debug|x64 {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|Win32.ActiveCfg = Debug|Win32 {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|Win32.Build.0 = Debug|Win32 {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|x64.ActiveCfg = Debug|x64 {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|x64.Build.0 = Debug|x64 - {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|x86.ActiveCfg = Debug|x64 + {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Release|Win32.ActiveCfg = Release|Win32 {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Release|Win32.Build.0 = Release|Win32 {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Release|x64.ActiveCfg = Release|x64 {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Release|x64.Build.0 = Release|x64 - {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Release|x86.ActiveCfg = Release|x64 + {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Release|x64 Setup.ActiveCfg = Release|x64 + {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Release|x86 Setup.ActiveCfg = Release|Win32 {204FA0DE-305D-4414-AE2E-F195A23F390D}.All|Win32.ActiveCfg = Debug|x64 {204FA0DE-305D-4414-AE2E-F195A23F390D}.All|x64.ActiveCfg = Debug|x64 {204FA0DE-305D-4414-AE2E-F195A23F390D}.All|x64.Build.0 = Debug|x64 - {204FA0DE-305D-4414-AE2E-F195A23F390D}.All|x86.ActiveCfg = Release|x64 + {204FA0DE-305D-4414-AE2E-F195A23F390D}.All|x64 Setup.ActiveCfg = Debug|x64 + {204FA0DE-305D-4414-AE2E-F195A23F390D}.All|x64 Setup.Build.0 = Debug|x64 + {204FA0DE-305D-4414-AE2E-F195A23F390D}.All|x86 Setup.ActiveCfg = Debug|x64 {204FA0DE-305D-4414-AE2E-F195A23F390D}.Debug|Win32.ActiveCfg = Debug|Win32 {204FA0DE-305D-4414-AE2E-F195A23F390D}.Debug|Win32.Build.0 = Debug|Win32 {204FA0DE-305D-4414-AE2E-F195A23F390D}.Debug|x64.ActiveCfg = Debug|x64 {204FA0DE-305D-4414-AE2E-F195A23F390D}.Debug|x64.Build.0 = Debug|x64 - {204FA0DE-305D-4414-AE2E-F195A23F390D}.Debug|x86.ActiveCfg = Debug|x64 + {204FA0DE-305D-4414-AE2E-F195A23F390D}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {204FA0DE-305D-4414-AE2E-F195A23F390D}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {204FA0DE-305D-4414-AE2E-F195A23F390D}.Release|Win32.ActiveCfg = Release|Win32 {204FA0DE-305D-4414-AE2E-F195A23F390D}.Release|Win32.Build.0 = Release|Win32 {204FA0DE-305D-4414-AE2E-F195A23F390D}.Release|x64.ActiveCfg = Release|x64 {204FA0DE-305D-4414-AE2E-F195A23F390D}.Release|x64.Build.0 = Release|x64 - {204FA0DE-305D-4414-AE2E-F195A23F390D}.Release|x86.ActiveCfg = Release|x64 + {204FA0DE-305D-4414-AE2E-F195A23F390D}.Release|x64 Setup.ActiveCfg = Release|x64 + {204FA0DE-305D-4414-AE2E-F195A23F390D}.Release|x86 Setup.ActiveCfg = Release|Win32 {0DF3ABD0-DDC0-4265-B778-07C66780979B}.All|Win32.ActiveCfg = Release|x64 {0DF3ABD0-DDC0-4265-B778-07C66780979B}.All|x64.ActiveCfg = Release|x64 {0DF3ABD0-DDC0-4265-B778-07C66780979B}.All|x64.Build.0 = Release|x64 - {0DF3ABD0-DDC0-4265-B778-07C66780979B}.All|x86.ActiveCfg = Release|x64 + {0DF3ABD0-DDC0-4265-B778-07C66780979B}.All|x64 Setup.ActiveCfg = Release|x64 + {0DF3ABD0-DDC0-4265-B778-07C66780979B}.All|x64 Setup.Build.0 = Release|x64 + {0DF3ABD0-DDC0-4265-B778-07C66780979B}.All|x86 Setup.ActiveCfg = Release|x64 {0DF3ABD0-DDC0-4265-B778-07C66780979B}.Debug|Win32.ActiveCfg = Debug|Win32 {0DF3ABD0-DDC0-4265-B778-07C66780979B}.Debug|Win32.Build.0 = Debug|Win32 {0DF3ABD0-DDC0-4265-B778-07C66780979B}.Debug|x64.ActiveCfg = Debug|x64 {0DF3ABD0-DDC0-4265-B778-07C66780979B}.Debug|x64.Build.0 = Debug|x64 - {0DF3ABD0-DDC0-4265-B778-07C66780979B}.Debug|x86.ActiveCfg = Debug|x64 + {0DF3ABD0-DDC0-4265-B778-07C66780979B}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {0DF3ABD0-DDC0-4265-B778-07C66780979B}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {0DF3ABD0-DDC0-4265-B778-07C66780979B}.Release|Win32.ActiveCfg = Release|Win32 {0DF3ABD0-DDC0-4265-B778-07C66780979B}.Release|Win32.Build.0 = Release|Win32 {0DF3ABD0-DDC0-4265-B778-07C66780979B}.Release|x64.ActiveCfg = Release|x64 {0DF3ABD0-DDC0-4265-B778-07C66780979B}.Release|x64.Build.0 = Release|x64 - {0DF3ABD0-DDC0-4265-B778-07C66780979B}.Release|x86.ActiveCfg = Release|x64 + {0DF3ABD0-DDC0-4265-B778-07C66780979B}.Release|x64 Setup.ActiveCfg = Release|x64 + {0DF3ABD0-DDC0-4265-B778-07C66780979B}.Release|x86 Setup.ActiveCfg = Release|Win32 {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.All|Win32.ActiveCfg = Release|Win32 {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.All|Win32.Build.0 = Release|Win32 {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.All|x64.ActiveCfg = Release|Win32 {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.All|x64.Build.0 = Release|Win32 - {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.All|x86.ActiveCfg = Release|Win32 + {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.All|x64 Setup.ActiveCfg = Release|Win32 + {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.All|x64 Setup.Build.0 = Release|Win32 + {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.All|x86 Setup.ActiveCfg = Release|Win32 + {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.All|x86 Setup.Build.0 = Release|Win32 {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Debug|Win32.ActiveCfg = Debug|Win32 {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Debug|Win32.Build.0 = Debug|Win32 {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Debug|x64.ActiveCfg = Debug|Win32 {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Debug|x64.Build.0 = Debug|Win32 - {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Debug|x86.ActiveCfg = Debug|Win32 + {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Debug|x64 Setup.ActiveCfg = Debug|Win32 + {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Release|Win32.ActiveCfg = Release|Win32 {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Release|Win32.Build.0 = Release|Win32 {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Release|x64.ActiveCfg = Release|Win32 {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Release|x64.Build.0 = Release|Win32 - {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Release|x86.ActiveCfg = Release|Win32 + {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Release|x64 Setup.ActiveCfg = Release|Win32 + {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Release|x86 Setup.ActiveCfg = Release|Win32 {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.All|Win32.ActiveCfg = Release DLL|x64 {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.All|x64.ActiveCfg = Release DLL|x64 {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.All|x64.Build.0 = Release DLL|x64 - {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.All|x86.ActiveCfg = Release|x64 + {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.All|x64 Setup.ActiveCfg = Release DLL|x64 + {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.All|x64 Setup.Build.0 = Release DLL|x64 + {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.All|x86 Setup.ActiveCfg = Release DLL|x64 {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Debug|Win32.ActiveCfg = Debug DLL|Win32 {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Debug|Win32.Build.0 = Debug DLL|Win32 {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Debug|x64.ActiveCfg = Debug DLL|x64 {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Debug|x64.Build.0 = Debug DLL|x64 - {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Debug|x86.ActiveCfg = Debug|x64 + {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Debug|x64 Setup.ActiveCfg = Debug DLL|x64 + {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Debug|x86 Setup.ActiveCfg = Debug DLL|Win32 {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Release|Win32.ActiveCfg = Release DLL|Win32 {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Release|Win32.Build.0 = Release DLL|Win32 {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Release|x64.ActiveCfg = Release DLL|x64 {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Release|x64.Build.0 = Release DLL|x64 - {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Release|x86.ActiveCfg = Release|x64 + {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Release|x64 Setup.ActiveCfg = Release DLL|x64 + {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Release|x86 Setup.ActiveCfg = Release DLL|Win32 {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.All|Win32.ActiveCfg = Release Passthrough|x64 {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.All|x64.ActiveCfg = Release Passthrough|x64 {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.All|x64.Build.0 = Release Passthrough|x64 - {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.All|x86.ActiveCfg = Release|x64 + {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.All|x64 Setup.ActiveCfg = Release Passthrough|x64 + {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.All|x64 Setup.Build.0 = Release Passthrough|x64 + {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.All|x86 Setup.ActiveCfg = Release Passthrough|x64 {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Debug|Win32.ActiveCfg = Debug Passthrough|Win32 {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Debug|Win32.Build.0 = Debug Passthrough|Win32 {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Debug|x64.ActiveCfg = Debug Passthrough|x64 {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Debug|x64.Build.0 = Debug Passthrough|x64 - {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Debug|x86.ActiveCfg = Debug|x64 + {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Debug|x64 Setup.ActiveCfg = Debug Passthrough|x64 + {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Debug|x86 Setup.ActiveCfg = Debug Passthrough|Win32 {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|Win32.ActiveCfg = Release Passthrough|Win32 {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|Win32.Build.0 = Release Passthrough|Win32 {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|x64.ActiveCfg = Release Passthrough|x64 {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|x64.Build.0 = Release Passthrough|x64 - {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|x86.ActiveCfg = Release|x64 + {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|x64 Setup.ActiveCfg = Release Passthrough|x64 + {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|x86 Setup.ActiveCfg = Release Passthrough|Win32 {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.All|Win32.ActiveCfg = Release|x64 {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.All|x64.ActiveCfg = Release|x64 {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.All|x64.Build.0 = Release|x64 - {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.All|x86.ActiveCfg = Release|x64 + {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.All|x64 Setup.ActiveCfg = Release|x64 + {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.All|x64 Setup.Build.0 = Release|x64 + {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.All|x86 Setup.ActiveCfg = Release|x64 {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Debug|Win32.ActiveCfg = Debug|Win32 {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Debug|Win32.Build.0 = Debug|Win32 {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Debug|x64.ActiveCfg = Debug|x64 {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Debug|x64.Build.0 = Debug|x64 - {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Debug|x86.ActiveCfg = Debug|x64 + {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Release|Win32.ActiveCfg = Release|Win32 {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Release|Win32.Build.0 = Release|Win32 {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Release|x64.ActiveCfg = Release|x64 {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Release|x64.Build.0 = Release|x64 - {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Release|x86.ActiveCfg = Release|x64 + {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Release|x64 Setup.ActiveCfg = Release|x64 + {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Release|x86 Setup.ActiveCfg = Release|Win32 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.All|Win32.ActiveCfg = Release|x64 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.All|x64.ActiveCfg = Release|x64 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.All|x64.Build.0 = Release|x64 - {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.All|x86.ActiveCfg = Release|x64 + {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.All|x64 Setup.ActiveCfg = Release|x64 + {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.All|x64 Setup.Build.0 = Release|x64 + {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.All|x86 Setup.ActiveCfg = Release|x64 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|Win32.ActiveCfg = Debug|Win32 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|Win32.Build.0 = Debug|Win32 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|x64.ActiveCfg = Debug|x64 - {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|x86.ActiveCfg = Debug|x64 + {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|Win32.ActiveCfg = Release|Win32 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|Win32.Build.0 = Release|Win32 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|x64.ActiveCfg = Release|x64 - {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|x86.ActiveCfg = Release|x64 + {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|x64 Setup.ActiveCfg = Release|x64 + {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|x86 Setup.ActiveCfg = Release|Win32 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.All|Win32.ActiveCfg = Release|x64 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.All|x64.ActiveCfg = Release|x64 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.All|x64.Build.0 = Release|x64 - {8F992C49-6C51-412F-B2A3-34EAB708EB65}.All|x86.ActiveCfg = Release|x64 + {8F992C49-6C51-412F-B2A3-34EAB708EB65}.All|x64 Setup.ActiveCfg = Release|x64 + {8F992C49-6C51-412F-B2A3-34EAB708EB65}.All|x64 Setup.Build.0 = Release|x64 + {8F992C49-6C51-412F-B2A3-34EAB708EB65}.All|x86 Setup.ActiveCfg = Release|x64 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|Win32.ActiveCfg = Debug|Win32 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|Win32.Build.0 = Debug|Win32 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|x64.ActiveCfg = Debug|x64 - {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|x86.ActiveCfg = Debug|x64 + {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|Win32.ActiveCfg = Release|Win32 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|Win32.Build.0 = Release|Win32 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|x64.ActiveCfg = Release|x64 - {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|x86.ActiveCfg = Release|x64 + {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|x64 Setup.ActiveCfg = Release|x64 + {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|x86 Setup.ActiveCfg = Release|Win32 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|Win32.ActiveCfg = Release|x64 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|x64.ActiveCfg = Release|x64 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|x64.Build.0 = Release|x64 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|x86.ActiveCfg = Release|x64 + {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|x64 Setup.ActiveCfg = Release|x64 + {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|x64 Setup.Build.0 = Release|x64 + {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|x86 Setup.ActiveCfg = Release|x64 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|Win32.ActiveCfg = Debug|Win32 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|Win32.Build.0 = Debug|Win32 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|x64.ActiveCfg = Debug|x64 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|x64.Build.0 = Debug|x64 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|x86.ActiveCfg = Debug|x64 + {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|Win32.ActiveCfg = Release|Win32 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|Win32.Build.0 = Release|Win32 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|x64.ActiveCfg = Release|x64 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|x64.Build.0 = Release|x64 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|x86.ActiveCfg = Release|x64 + {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|x64 Setup.ActiveCfg = Release|x64 + {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|x86 Setup.ActiveCfg = Release|Win32 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|Win32.ActiveCfg = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|x64.ActiveCfg = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|x64.Build.0 = Release|x64 - {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|x86.ActiveCfg = Release|x64 + {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|x64 Setup.ActiveCfg = Release|x64 + {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|x64 Setup.Build.0 = Release|x64 + {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|x86 Setup.ActiveCfg = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|Win32.ActiveCfg = Debug|Win32 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|Win32.Build.0 = Debug|Win32 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|x64.ActiveCfg = Debug|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|x64.Build.0 = Debug|x64 - {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|x86.ActiveCfg = Debug|x64 + {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|Win32.ActiveCfg = Release|Win32 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|Win32.Build.0 = Release|Win32 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|x64.ActiveCfg = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|x64.Build.0 = Release|x64 - {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|x86.ActiveCfg = Release|x64 + {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|x64 Setup.ActiveCfg = Release|x64 + {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|x86 Setup.ActiveCfg = Release|Win32 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.All|Win32.ActiveCfg = Release|x64 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.All|x64.ActiveCfg = Release|x64 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.All|x64.Build.0 = Release|x64 - {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.All|x86.ActiveCfg = Release|x64 + {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.All|x64 Setup.ActiveCfg = Release|x64 + {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.All|x64 Setup.Build.0 = Release|x64 + {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.All|x86 Setup.ActiveCfg = Release|x64 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|Win32.ActiveCfg = Debug|Win32 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|Win32.Build.0 = Debug|Win32 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|x64.ActiveCfg = Debug|x64 - {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|x86.ActiveCfg = Debug|x64 + {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|Win32.ActiveCfg = Release|Win32 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|Win32.Build.0 = Release|Win32 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|x64.ActiveCfg = Release|x64 - {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|x86.ActiveCfg = Release|x64 + {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|x64 Setup.ActiveCfg = Release|x64 + {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|x86 Setup.ActiveCfg = Release|Win32 {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.All|Win32.ActiveCfg = Release|x64 {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.All|x64.ActiveCfg = Release|x64 {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.All|x64.Build.0 = Release|x64 - {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.All|x86.ActiveCfg = Release|x64 + {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.All|x64 Setup.ActiveCfg = Release|x64 + {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.All|x64 Setup.Build.0 = Release|x64 + {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.All|x86 Setup.ActiveCfg = Release|x64 {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Debug|Win32.ActiveCfg = Debug|Win32 {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Debug|Win32.Build.0 = Debug|Win32 {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Debug|x64.ActiveCfg = Debug|x64 {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Debug|x64.Build.0 = Debug|x64 - {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Debug|x86.ActiveCfg = Debug|x64 + {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Release|Win32.ActiveCfg = Release|Win32 {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Release|Win32.Build.0 = Release|Win32 {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Release|x64.ActiveCfg = Release|x64 {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Release|x64.Build.0 = Release|x64 - {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Release|x86.ActiveCfg = Release|x64 + {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Release|x64 Setup.ActiveCfg = Release|x64 + {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Release|x86 Setup.ActiveCfg = Release|Win32 {988CACF7-3FCB-4992-BE69-77872AE67DC8}.All|Win32.ActiveCfg = Release|x64 {988CACF7-3FCB-4992-BE69-77872AE67DC8}.All|x64.ActiveCfg = Release|x64 {988CACF7-3FCB-4992-BE69-77872AE67DC8}.All|x64.Build.0 = Release|x64 - {988CACF7-3FCB-4992-BE69-77872AE67DC8}.All|x86.ActiveCfg = Release|x64 + {988CACF7-3FCB-4992-BE69-77872AE67DC8}.All|x64 Setup.ActiveCfg = Release|x64 + {988CACF7-3FCB-4992-BE69-77872AE67DC8}.All|x64 Setup.Build.0 = Release|x64 + {988CACF7-3FCB-4992-BE69-77872AE67DC8}.All|x86 Setup.ActiveCfg = Release|x64 {988CACF7-3FCB-4992-BE69-77872AE67DC8}.Debug|Win32.ActiveCfg = Debug|Win32 {988CACF7-3FCB-4992-BE69-77872AE67DC8}.Debug|Win32.Build.0 = Debug|Win32 {988CACF7-3FCB-4992-BE69-77872AE67DC8}.Debug|x64.ActiveCfg = Debug|x64 {988CACF7-3FCB-4992-BE69-77872AE67DC8}.Debug|x64.Build.0 = Debug|x64 - {988CACF7-3FCB-4992-BE69-77872AE67DC8}.Debug|x86.ActiveCfg = Debug|x64 + {988CACF7-3FCB-4992-BE69-77872AE67DC8}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {988CACF7-3FCB-4992-BE69-77872AE67DC8}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {988CACF7-3FCB-4992-BE69-77872AE67DC8}.Release|Win32.ActiveCfg = Release|Win32 {988CACF7-3FCB-4992-BE69-77872AE67DC8}.Release|Win32.Build.0 = Release|Win32 {988CACF7-3FCB-4992-BE69-77872AE67DC8}.Release|x64.ActiveCfg = Release|x64 {988CACF7-3FCB-4992-BE69-77872AE67DC8}.Release|x64.Build.0 = Release|x64 - {988CACF7-3FCB-4992-BE69-77872AE67DC8}.Release|x86.ActiveCfg = Release|x64 + {988CACF7-3FCB-4992-BE69-77872AE67DC8}.Release|x64 Setup.ActiveCfg = Release|x64 + {988CACF7-3FCB-4992-BE69-77872AE67DC8}.Release|x86 Setup.ActiveCfg = Release|Win32 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.All|Win32.ActiveCfg = Release DirectSound|x64 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.All|x64.ActiveCfg = Release DirectSound|x64 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.All|x64.Build.0 = Release DirectSound|x64 - {0A18A071-125E-442F-AFF7-A3F68ABECF99}.All|x86.ActiveCfg = Release|x64 + {0A18A071-125E-442F-AFF7-A3F68ABECF99}.All|x64 Setup.ActiveCfg = Release DirectSound|x64 + {0A18A071-125E-442F-AFF7-A3F68ABECF99}.All|x64 Setup.Build.0 = Release DirectSound|x64 + {0A18A071-125E-442F-AFF7-A3F68ABECF99}.All|x86 Setup.ActiveCfg = Release DirectSound|x64 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|Win32.ActiveCfg = Debug|Win32 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|Win32.Build.0 = Debug|Win32 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x64.ActiveCfg = Debug|x64 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x64.Build.0 = Debug|x64 - {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x86.ActiveCfg = Debug|x64 + {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|Win32.ActiveCfg = Release|Win32 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|Win32.Build.0 = Release|Win32 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x64.ActiveCfg = Release|x64 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x64.Build.0 = Release|x64 - {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x86.ActiveCfg = Release|x64 + {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x64 Setup.ActiveCfg = Release|x64 + {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x86 Setup.ActiveCfg = Release|Win32 {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.All|Win32.ActiveCfg = Release|x64 {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.All|x64.ActiveCfg = Release|x64 {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.All|x64.Build.0 = Release|x64 - {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.All|x86.ActiveCfg = Release|x64 + {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.All|x64 Setup.ActiveCfg = Release|x64 + {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.All|x64 Setup.Build.0 = Release|x64 + {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.All|x86 Setup.ActiveCfg = Release|x64 {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Debug|Win32.ActiveCfg = Debug|Win32 {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Debug|Win32.Build.0 = Debug|Win32 {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Debug|x64.ActiveCfg = Debug|x64 {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Debug|x64.Build.0 = Debug|x64 - {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Debug|x86.ActiveCfg = Debug|x64 + {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Release|Win32.ActiveCfg = Release|Win32 {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Release|Win32.Build.0 = Release|Win32 {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Release|x64.ActiveCfg = Release|x64 {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Release|x64.Build.0 = Release|x64 - {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Release|x86.ActiveCfg = Release|x64 + {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Release|x64 Setup.ActiveCfg = Release|x64 + {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Release|x86 Setup.ActiveCfg = Release|Win32 {8DEB383C-4091-4F42-A56F-C9E46D552D79}.All|Win32.ActiveCfg = Release Passthrough|x64 {8DEB383C-4091-4F42-A56F-C9E46D552D79}.All|x64.ActiveCfg = Release Passthrough|x64 {8DEB383C-4091-4F42-A56F-C9E46D552D79}.All|x64.Build.0 = Release Passthrough|x64 - {8DEB383C-4091-4F42-A56F-C9E46D552D79}.All|x86.ActiveCfg = Release|x64 + {8DEB383C-4091-4F42-A56F-C9E46D552D79}.All|x64 Setup.ActiveCfg = Release Passthrough|x64 + {8DEB383C-4091-4F42-A56F-C9E46D552D79}.All|x64 Setup.Build.0 = Release Passthrough|x64 + {8DEB383C-4091-4F42-A56F-C9E46D552D79}.All|x86 Setup.ActiveCfg = Release Passthrough|x64 {8DEB383C-4091-4F42-A56F-C9E46D552D79}.Debug|Win32.ActiveCfg = Debug Passthrough|Win32 {8DEB383C-4091-4F42-A56F-C9E46D552D79}.Debug|Win32.Build.0 = Debug Passthrough|Win32 {8DEB383C-4091-4F42-A56F-C9E46D552D79}.Debug|x64.ActiveCfg = Debug Passthrough|x64 {8DEB383C-4091-4F42-A56F-C9E46D552D79}.Debug|x64.Build.0 = Debug Passthrough|x64 - {8DEB383C-4091-4F42-A56F-C9E46D552D79}.Debug|x86.ActiveCfg = Debug|x64 + {8DEB383C-4091-4F42-A56F-C9E46D552D79}.Debug|x64 Setup.ActiveCfg = Debug Passthrough|x64 + {8DEB383C-4091-4F42-A56F-C9E46D552D79}.Debug|x86 Setup.ActiveCfg = Debug Passthrough|Win32 {8DEB383C-4091-4F42-A56F-C9E46D552D79}.Release|Win32.ActiveCfg = Release Passthrough|Win32 {8DEB383C-4091-4F42-A56F-C9E46D552D79}.Release|Win32.Build.0 = Release Passthrough|Win32 {8DEB383C-4091-4F42-A56F-C9E46D552D79}.Release|x64.ActiveCfg = Release Passthrough|x64 {8DEB383C-4091-4F42-A56F-C9E46D552D79}.Release|x64.Build.0 = Release Passthrough|x64 - {8DEB383C-4091-4F42-A56F-C9E46D552D79}.Release|x86.ActiveCfg = Release|x64 + {8DEB383C-4091-4F42-A56F-C9E46D552D79}.Release|x64 Setup.ActiveCfg = Release Passthrough|x64 + {8DEB383C-4091-4F42-A56F-C9E46D552D79}.Release|x86 Setup.ActiveCfg = Release Passthrough|Win32 {2C3C2423-234B-4772-8899-D3B137E5CA35}.All|Win32.ActiveCfg = Release|x64 {2C3C2423-234B-4772-8899-D3B137E5CA35}.All|x64.ActiveCfg = Release|x64 {2C3C2423-234B-4772-8899-D3B137E5CA35}.All|x64.Build.0 = Release|x64 - {2C3C2423-234B-4772-8899-D3B137E5CA35}.All|x86.ActiveCfg = Release|x64 + {2C3C2423-234B-4772-8899-D3B137E5CA35}.All|x64 Setup.ActiveCfg = Release|x64 + {2C3C2423-234B-4772-8899-D3B137E5CA35}.All|x64 Setup.Build.0 = Release|x64 + {2C3C2423-234B-4772-8899-D3B137E5CA35}.All|x86 Setup.ActiveCfg = Release|x64 {2C3C2423-234B-4772-8899-D3B137E5CA35}.Debug|Win32.ActiveCfg = Debug|Win32 {2C3C2423-234B-4772-8899-D3B137E5CA35}.Debug|Win32.Build.0 = Debug|Win32 {2C3C2423-234B-4772-8899-D3B137E5CA35}.Debug|x64.ActiveCfg = Debug|x64 {2C3C2423-234B-4772-8899-D3B137E5CA35}.Debug|x64.Build.0 = Debug|x64 - {2C3C2423-234B-4772-8899-D3B137E5CA35}.Debug|x86.ActiveCfg = Debug|x64 + {2C3C2423-234B-4772-8899-D3B137E5CA35}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {2C3C2423-234B-4772-8899-D3B137E5CA35}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {2C3C2423-234B-4772-8899-D3B137E5CA35}.Release|Win32.ActiveCfg = Release|Win32 {2C3C2423-234B-4772-8899-D3B137E5CA35}.Release|Win32.Build.0 = Release|Win32 {2C3C2423-234B-4772-8899-D3B137E5CA35}.Release|x64.ActiveCfg = Release|x64 {2C3C2423-234B-4772-8899-D3B137E5CA35}.Release|x64.Build.0 = Release|x64 - {2C3C2423-234B-4772-8899-D3B137E5CA35}.Release|x86.ActiveCfg = Release|x64 + {2C3C2423-234B-4772-8899-D3B137E5CA35}.Release|x64 Setup.ActiveCfg = Release|x64 + {2C3C2423-234B-4772-8899-D3B137E5CA35}.Release|x86 Setup.ActiveCfg = Release|Win32 {3850D93A-5F24-4922-BC1C-74D08C37C256}.All|Win32.ActiveCfg = Release|x64 {3850D93A-5F24-4922-BC1C-74D08C37C256}.All|x64.ActiveCfg = Release|x64 {3850D93A-5F24-4922-BC1C-74D08C37C256}.All|x64.Build.0 = Release|x64 - {3850D93A-5F24-4922-BC1C-74D08C37C256}.All|x86.ActiveCfg = Release|x64 + {3850D93A-5F24-4922-BC1C-74D08C37C256}.All|x64 Setup.ActiveCfg = Release|x64 + {3850D93A-5F24-4922-BC1C-74D08C37C256}.All|x64 Setup.Build.0 = Release|x64 + {3850D93A-5F24-4922-BC1C-74D08C37C256}.All|x86 Setup.ActiveCfg = Release|x64 {3850D93A-5F24-4922-BC1C-74D08C37C256}.Debug|Win32.ActiveCfg = Debug|Win32 {3850D93A-5F24-4922-BC1C-74D08C37C256}.Debug|Win32.Build.0 = Debug|Win32 {3850D93A-5F24-4922-BC1C-74D08C37C256}.Debug|x64.ActiveCfg = Debug|x64 {3850D93A-5F24-4922-BC1C-74D08C37C256}.Debug|x64.Build.0 = Debug|x64 - {3850D93A-5F24-4922-BC1C-74D08C37C256}.Debug|x86.ActiveCfg = Debug|x64 + {3850D93A-5F24-4922-BC1C-74D08C37C256}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {3850D93A-5F24-4922-BC1C-74D08C37C256}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {3850D93A-5F24-4922-BC1C-74D08C37C256}.Release|Win32.ActiveCfg = Release|Win32 {3850D93A-5F24-4922-BC1C-74D08C37C256}.Release|Win32.Build.0 = Release|Win32 {3850D93A-5F24-4922-BC1C-74D08C37C256}.Release|x64.ActiveCfg = Release|x64 {3850D93A-5F24-4922-BC1C-74D08C37C256}.Release|x64.Build.0 = Release|x64 - {3850D93A-5F24-4922-BC1C-74D08C37C256}.Release|x86.ActiveCfg = Release|x64 + {3850D93A-5F24-4922-BC1C-74D08C37C256}.Release|x64 Setup.ActiveCfg = Release|x64 + {3850D93A-5F24-4922-BC1C-74D08C37C256}.Release|x86 Setup.ActiveCfg = Release|Win32 {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.All|Win32.ActiveCfg = Release|x64 {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.All|x64.ActiveCfg = Release|x64 {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.All|x64.Build.0 = Release|x64 - {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.All|x86.ActiveCfg = Release|x64 + {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.All|x64 Setup.ActiveCfg = Release|x64 + {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.All|x64 Setup.Build.0 = Release|x64 + {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.All|x86 Setup.ActiveCfg = Release|x64 {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Debug|Win32.ActiveCfg = Debug|Win32 {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Debug|Win32.Build.0 = Debug|Win32 {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Debug|x64.ActiveCfg = Debug|x64 {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Debug|x64.Build.0 = Debug|x64 - {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Debug|x86.ActiveCfg = Debug|x64 + {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Release|Win32.ActiveCfg = Release|Win32 {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Release|Win32.Build.0 = Release|Win32 {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Release|x64.ActiveCfg = Release|x64 {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Release|x64.Build.0 = Release|x64 - {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Release|x86.ActiveCfg = Release|x64 + {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Release|x64 Setup.ActiveCfg = Release|x64 + {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Release|x86 Setup.ActiveCfg = Release|Win32 {028C7278-05D7-4E18-82FE-BE231B844F41}.All|Win32.ActiveCfg = Release|x64 {028C7278-05D7-4E18-82FE-BE231B844F41}.All|x64.ActiveCfg = Release|x64 {028C7278-05D7-4E18-82FE-BE231B844F41}.All|x64.Build.0 = Release|x64 - {028C7278-05D7-4E18-82FE-BE231B844F41}.All|x86.ActiveCfg = Release|x64 + {028C7278-05D7-4E18-82FE-BE231B844F41}.All|x64 Setup.ActiveCfg = Release|x64 + {028C7278-05D7-4E18-82FE-BE231B844F41}.All|x64 Setup.Build.0 = Release|x64 + {028C7278-05D7-4E18-82FE-BE231B844F41}.All|x86 Setup.ActiveCfg = Release|x64 {028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|Win32.ActiveCfg = Debug|Win32 {028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|Win32.Build.0 = Debug|Win32 {028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|x64.ActiveCfg = Debug|x64 - {028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|x86.ActiveCfg = Debug|x64 + {028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {028C7278-05D7-4E18-82FE-BE231B844F41}.Release|Win32.ActiveCfg = Release|Win32 {028C7278-05D7-4E18-82FE-BE231B844F41}.Release|Win32.Build.0 = Release|Win32 {028C7278-05D7-4E18-82FE-BE231B844F41}.Release|x64.ActiveCfg = Release|x64 - {028C7278-05D7-4E18-82FE-BE231B844F41}.Release|x86.ActiveCfg = Release|x64 + {028C7278-05D7-4E18-82FE-BE231B844F41}.Release|x64 Setup.ActiveCfg = Release|x64 + {028C7278-05D7-4E18-82FE-BE231B844F41}.Release|x86 Setup.ActiveCfg = Release|Win32 {D7F1E3F2-A3F4-474C-8555-15122571AF52}.All|Win32.ActiveCfg = Release|x64 {D7F1E3F2-A3F4-474C-8555-15122571AF52}.All|x64.ActiveCfg = Release|x64 {D7F1E3F2-A3F4-474C-8555-15122571AF52}.All|x64.Build.0 = Release|x64 - {D7F1E3F2-A3F4-474C-8555-15122571AF52}.All|x86.ActiveCfg = Release|x64 + {D7F1E3F2-A3F4-474C-8555-15122571AF52}.All|x64 Setup.ActiveCfg = Release|x64 + {D7F1E3F2-A3F4-474C-8555-15122571AF52}.All|x64 Setup.Build.0 = Release|x64 + {D7F1E3F2-A3F4-474C-8555-15122571AF52}.All|x86 Setup.ActiveCfg = Release|x64 {D7F1E3F2-A3F4-474C-8555-15122571AF52}.Debug|Win32.ActiveCfg = Debug|Win32 {D7F1E3F2-A3F4-474C-8555-15122571AF52}.Debug|Win32.Build.0 = Debug|Win32 {D7F1E3F2-A3F4-474C-8555-15122571AF52}.Debug|x64.ActiveCfg = Debug|x64 {D7F1E3F2-A3F4-474C-8555-15122571AF52}.Debug|x64.Build.0 = Debug|x64 - {D7F1E3F2-A3F4-474C-8555-15122571AF52}.Debug|x86.ActiveCfg = Debug|x64 + {D7F1E3F2-A3F4-474C-8555-15122571AF52}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {D7F1E3F2-A3F4-474C-8555-15122571AF52}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {D7F1E3F2-A3F4-474C-8555-15122571AF52}.Release|Win32.ActiveCfg = Release|Win32 {D7F1E3F2-A3F4-474C-8555-15122571AF52}.Release|Win32.Build.0 = Release|Win32 {D7F1E3F2-A3F4-474C-8555-15122571AF52}.Release|x64.ActiveCfg = Release|x64 {D7F1E3F2-A3F4-474C-8555-15122571AF52}.Release|x64.Build.0 = Release|x64 - {D7F1E3F2-A3F4-474C-8555-15122571AF52}.Release|x86.ActiveCfg = Release|x64 + {D7F1E3F2-A3F4-474C-8555-15122571AF52}.Release|x64 Setup.ActiveCfg = Release|x64 + {D7F1E3F2-A3F4-474C-8555-15122571AF52}.Release|x86 Setup.ActiveCfg = Release|Win32 {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.All|Win32.ActiveCfg = Release|x64 {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.All|x64.ActiveCfg = Release|x64 {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.All|x64.Build.0 = Release|x64 - {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.All|x86.ActiveCfg = Release|x64 + {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.All|x64 Setup.ActiveCfg = Release|x64 + {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.All|x64 Setup.Build.0 = Release|x64 + {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.All|x86 Setup.ActiveCfg = Release|x64 {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Debug|Win32.ActiveCfg = Debug|Win32 {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Debug|Win32.Build.0 = Debug|Win32 {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Debug|x64.ActiveCfg = Debug|x64 {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Debug|x64.Build.0 = Debug|x64 - {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Debug|x86.ActiveCfg = Debug|x64 + {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Release|Win32.ActiveCfg = Release|Win32 {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Release|Win32.Build.0 = Release|Win32 {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Release|x64.ActiveCfg = Release|x64 {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Release|x64.Build.0 = Release|x64 - {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Release|x86.ActiveCfg = Release|x64 + {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Release|x64 Setup.ActiveCfg = Release|x64 + {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Release|x86 Setup.ActiveCfg = Release|Win32 {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.All|Win32.ActiveCfg = Release|x64 {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.All|x64.ActiveCfg = Release|x64 {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.All|x64.Build.0 = Release|x64 - {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.All|x86.ActiveCfg = Release|x64 + {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.All|x64 Setup.ActiveCfg = Release|x64 + {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.All|x64 Setup.Build.0 = Release|x64 + {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.All|x86 Setup.ActiveCfg = Release|x64 {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Debug|Win32.ActiveCfg = Debug|Win32 {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Debug|Win32.Build.0 = Debug|Win32 {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Debug|x64.ActiveCfg = Debug|x64 {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Debug|x64.Build.0 = Debug|x64 - {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Debug|x86.ActiveCfg = Debug|x64 + {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Release|Win32.ActiveCfg = Release|Win32 {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Release|Win32.Build.0 = Release|Win32 {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Release|x64.ActiveCfg = Release|x64 {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Release|x64.Build.0 = Release|x64 - {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Release|x86.ActiveCfg = Release|x64 + {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Release|x64 Setup.ActiveCfg = Release|x64 + {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Release|x86 Setup.ActiveCfg = Release|Win32 {06E3A538-AB32-44F2-B477-755FF9CB5D37}.All|Win32.ActiveCfg = Release|x64 {06E3A538-AB32-44F2-B477-755FF9CB5D37}.All|x64.ActiveCfg = Release|x64 {06E3A538-AB32-44F2-B477-755FF9CB5D37}.All|x64.Build.0 = Release|x64 - {06E3A538-AB32-44F2-B477-755FF9CB5D37}.All|x86.ActiveCfg = Release|x64 + {06E3A538-AB32-44F2-B477-755FF9CB5D37}.All|x64 Setup.ActiveCfg = Release|x64 + {06E3A538-AB32-44F2-B477-755FF9CB5D37}.All|x64 Setup.Build.0 = Release|x64 + {06E3A538-AB32-44F2-B477-755FF9CB5D37}.All|x86 Setup.ActiveCfg = Release|x64 {06E3A538-AB32-44F2-B477-755FF9CB5D37}.Debug|Win32.ActiveCfg = Debug|Win32 {06E3A538-AB32-44F2-B477-755FF9CB5D37}.Debug|Win32.Build.0 = Debug|Win32 {06E3A538-AB32-44F2-B477-755FF9CB5D37}.Debug|x64.ActiveCfg = Debug|x64 {06E3A538-AB32-44F2-B477-755FF9CB5D37}.Debug|x64.Build.0 = Debug|x64 - {06E3A538-AB32-44F2-B477-755FF9CB5D37}.Debug|x86.ActiveCfg = Debug|x64 + {06E3A538-AB32-44F2-B477-755FF9CB5D37}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {06E3A538-AB32-44F2-B477-755FF9CB5D37}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {06E3A538-AB32-44F2-B477-755FF9CB5D37}.Release|Win32.ActiveCfg = Release|Win32 {06E3A538-AB32-44F2-B477-755FF9CB5D37}.Release|Win32.Build.0 = Release|Win32 {06E3A538-AB32-44F2-B477-755FF9CB5D37}.Release|x64.ActiveCfg = Release|x64 {06E3A538-AB32-44F2-B477-755FF9CB5D37}.Release|x64.Build.0 = Release|x64 - {06E3A538-AB32-44F2-B477-755FF9CB5D37}.Release|x86.ActiveCfg = Release|x64 + {06E3A538-AB32-44F2-B477-755FF9CB5D37}.Release|x64 Setup.ActiveCfg = Release|x64 + {06E3A538-AB32-44F2-B477-755FF9CB5D37}.Release|x86 Setup.ActiveCfg = Release|Win32 {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.All|Win32.ActiveCfg = Release|x64 {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.All|x64.ActiveCfg = Release|x64 {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.All|x64.Build.0 = Release|x64 - {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.All|x86.ActiveCfg = Release|x64 + {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.All|x64 Setup.ActiveCfg = Release|x64 + {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.All|x64 Setup.Build.0 = Release|x64 + {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.All|x86 Setup.ActiveCfg = Release|x64 {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Debug|Win32.ActiveCfg = Debug|Win32 {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Debug|Win32.Build.0 = Debug|Win32 {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Debug|x64.ActiveCfg = Debug|x64 {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Debug|x64.Build.0 = Debug|x64 - {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Debug|x86.ActiveCfg = Debug|x64 + {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Release|Win32.ActiveCfg = Release|Win32 {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Release|Win32.Build.0 = Release|Win32 {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Release|x64.ActiveCfg = Release|x64 {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Release|x64.Build.0 = Release|x64 - {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Release|x86.ActiveCfg = Release|x64 + {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Release|x64 Setup.ActiveCfg = Release|x64 + {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Release|x86 Setup.ActiveCfg = Release|Win32 {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.All|Win32.ActiveCfg = Release|x64 {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.All|x64.ActiveCfg = Release|x64 {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.All|x64.Build.0 = Release|x64 - {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.All|x86.ActiveCfg = Release|x64 + {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.All|x64 Setup.ActiveCfg = Release|x64 + {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.All|x64 Setup.Build.0 = Release|x64 + {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.All|x86 Setup.ActiveCfg = Release|x64 {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Debug|Win32.ActiveCfg = Debug|Win32 {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Debug|Win32.Build.0 = Debug|Win32 {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Debug|x64.ActiveCfg = Debug|x64 {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Debug|x64.Build.0 = Debug|x64 - {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Debug|x86.ActiveCfg = Debug|x64 + {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Release|Win32.ActiveCfg = Release|Win32 {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Release|Win32.Build.0 = Release|Win32 {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Release|x64.ActiveCfg = Release|x64 {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Release|x64.Build.0 = Release|x64 - {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Release|x86.ActiveCfg = Release|x64 + {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Release|x64 Setup.ActiveCfg = Release|x64 + {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Release|x86 Setup.ActiveCfg = Release|Win32 {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.All|Win32.ActiveCfg = Release|x64 {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.All|x64.ActiveCfg = Release|x64 {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.All|x64.Build.0 = Release|x64 - {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.All|x86.ActiveCfg = Release|x64 + {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.All|x64 Setup.ActiveCfg = Release|x64 + {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.All|x64 Setup.Build.0 = Release|x64 + {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.All|x86 Setup.ActiveCfg = Release|x64 {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Debug|Win32.ActiveCfg = Debug|Win32 {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Debug|Win32.Build.0 = Debug|Win32 {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Debug|x64.ActiveCfg = Debug|x64 {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Debug|x64.Build.0 = Debug|x64 - {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Debug|x86.ActiveCfg = Debug|x64 + {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Release|Win32.ActiveCfg = Release|Win32 {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Release|Win32.Build.0 = Release|Win32 {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Release|x64.ActiveCfg = Release|x64 {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Release|x64.Build.0 = Release|x64 - {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Release|x86.ActiveCfg = Release|x64 + {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Release|x64 Setup.ActiveCfg = Release|x64 + {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Release|x86 Setup.ActiveCfg = Release|Win32 {F6A33240-8F29-48BD-98F0-826995911799}.All|Win32.ActiveCfg = Release|x64 {F6A33240-8F29-48BD-98F0-826995911799}.All|x64.ActiveCfg = Release|x64 {F6A33240-8F29-48BD-98F0-826995911799}.All|x64.Build.0 = Release|x64 - {F6A33240-8F29-48BD-98F0-826995911799}.All|x86.ActiveCfg = Release|x64 + {F6A33240-8F29-48BD-98F0-826995911799}.All|x64 Setup.ActiveCfg = Release|x64 + {F6A33240-8F29-48BD-98F0-826995911799}.All|x64 Setup.Build.0 = Release|x64 + {F6A33240-8F29-48BD-98F0-826995911799}.All|x86 Setup.ActiveCfg = Release|x64 {F6A33240-8F29-48BD-98F0-826995911799}.Debug|Win32.ActiveCfg = Debug|Win32 {F6A33240-8F29-48BD-98F0-826995911799}.Debug|Win32.Build.0 = Debug|Win32 {F6A33240-8F29-48BD-98F0-826995911799}.Debug|x64.ActiveCfg = Debug|x64 {F6A33240-8F29-48BD-98F0-826995911799}.Debug|x64.Build.0 = Debug|x64 - {F6A33240-8F29-48BD-98F0-826995911799}.Debug|x86.ActiveCfg = Debug|x64 + {F6A33240-8F29-48BD-98F0-826995911799}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {F6A33240-8F29-48BD-98F0-826995911799}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {F6A33240-8F29-48BD-98F0-826995911799}.Release|Win32.ActiveCfg = Release|Win32 {F6A33240-8F29-48BD-98F0-826995911799}.Release|Win32.Build.0 = Release|Win32 {F6A33240-8F29-48BD-98F0-826995911799}.Release|x64.ActiveCfg = Release|x64 {F6A33240-8F29-48BD-98F0-826995911799}.Release|x64.Build.0 = Release|x64 - {F6A33240-8F29-48BD-98F0-826995911799}.Release|x86.ActiveCfg = Release|x64 + {F6A33240-8F29-48BD-98F0-826995911799}.Release|x64 Setup.ActiveCfg = Release|x64 + {F6A33240-8F29-48BD-98F0-826995911799}.Release|x86 Setup.ActiveCfg = Release|Win32 {65A6273D-FCAB-4C55-B09E-65100141A5D4}.All|Win32.ActiveCfg = Release|x64 {65A6273D-FCAB-4C55-B09E-65100141A5D4}.All|x64.ActiveCfg = Release|x64 {65A6273D-FCAB-4C55-B09E-65100141A5D4}.All|x64.Build.0 = Release|x64 - {65A6273D-FCAB-4C55-B09E-65100141A5D4}.All|x86.ActiveCfg = Release|x64 + {65A6273D-FCAB-4C55-B09E-65100141A5D4}.All|x64 Setup.ActiveCfg = Release|x64 + {65A6273D-FCAB-4C55-B09E-65100141A5D4}.All|x64 Setup.Build.0 = Release|x64 + {65A6273D-FCAB-4C55-B09E-65100141A5D4}.All|x86 Setup.ActiveCfg = Release|x64 {65A6273D-FCAB-4C55-B09E-65100141A5D4}.Debug|Win32.ActiveCfg = Debug|Win32 {65A6273D-FCAB-4C55-B09E-65100141A5D4}.Debug|Win32.Build.0 = Debug|Win32 {65A6273D-FCAB-4C55-B09E-65100141A5D4}.Debug|x64.ActiveCfg = Debug|x64 {65A6273D-FCAB-4C55-B09E-65100141A5D4}.Debug|x64.Build.0 = Debug|x64 - {65A6273D-FCAB-4C55-B09E-65100141A5D4}.Debug|x86.ActiveCfg = Debug|x64 + {65A6273D-FCAB-4C55-B09E-65100141A5D4}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {65A6273D-FCAB-4C55-B09E-65100141A5D4}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {65A6273D-FCAB-4C55-B09E-65100141A5D4}.Release|Win32.ActiveCfg = Release|Win32 {65A6273D-FCAB-4C55-B09E-65100141A5D4}.Release|Win32.Build.0 = Release|Win32 {65A6273D-FCAB-4C55-B09E-65100141A5D4}.Release|x64.ActiveCfg = Release|x64 {65A6273D-FCAB-4C55-B09E-65100141A5D4}.Release|x64.Build.0 = Release|x64 - {65A6273D-FCAB-4C55-B09E-65100141A5D4}.Release|x86.ActiveCfg = Release|x64 + {65A6273D-FCAB-4C55-B09E-65100141A5D4}.Release|x64 Setup.ActiveCfg = Release|x64 + {65A6273D-FCAB-4C55-B09E-65100141A5D4}.Release|x86 Setup.ActiveCfg = Release|Win32 {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.All|Win32.ActiveCfg = Release|x64 {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.All|x64.ActiveCfg = Release|x64 {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.All|x64.Build.0 = Release|x64 - {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.All|x86.ActiveCfg = Release|x64 + {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.All|x64 Setup.ActiveCfg = Release|x64 + {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.All|x64 Setup.Build.0 = Release|x64 + {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.All|x86 Setup.ActiveCfg = Release|x64 {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Debug|Win32.ActiveCfg = Debug|Win32 {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Debug|Win32.Build.0 = Debug|Win32 {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Debug|x64.ActiveCfg = Debug|x64 {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Debug|x64.Build.0 = Debug|x64 - {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Debug|x86.ActiveCfg = Debug|x64 + {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Release|Win32.ActiveCfg = Release|Win32 {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Release|Win32.Build.0 = Release|Win32 {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Release|x64.ActiveCfg = Release|x64 {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Release|x64.Build.0 = Release|x64 - {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Release|x86.ActiveCfg = Release|x64 + {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Release|x64 Setup.ActiveCfg = Release|x64 + {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Release|x86 Setup.ActiveCfg = Release|Win32 {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.All|Win32.ActiveCfg = Release|x64 {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.All|x64.ActiveCfg = Release|x64 {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.All|x64.Build.0 = Release|x64 - {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.All|x86.ActiveCfg = Release|x64 + {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.All|x64 Setup.ActiveCfg = Release|x64 + {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.All|x64 Setup.Build.0 = Release|x64 + {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.All|x86 Setup.ActiveCfg = Release|x64 {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Debug|Win32.ActiveCfg = Debug|Win32 {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Debug|Win32.Build.0 = Debug|Win32 {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Debug|x64.ActiveCfg = Debug|x64 {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Debug|x64.Build.0 = Debug|x64 - {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Debug|x86.ActiveCfg = Debug|x64 + {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Release|Win32.ActiveCfg = Release|Win32 {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Release|Win32.Build.0 = Release|Win32 {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Release|x64.ActiveCfg = Release|x64 {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Release|x64.Build.0 = Release|x64 - {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Release|x86.ActiveCfg = Release|x64 + {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Release|x64 Setup.ActiveCfg = Release|x64 + {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Release|x86 Setup.ActiveCfg = Release|Win32 {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.All|Win32.ActiveCfg = Release|x64 {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.All|x64.ActiveCfg = Release|x64 {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.All|x64.Build.0 = Release|x64 - {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.All|x86.ActiveCfg = Release|x64 + {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.All|x64 Setup.ActiveCfg = Release|x64 + {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.All|x64 Setup.Build.0 = Release|x64 + {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.All|x86 Setup.ActiveCfg = Release|x64 {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Debug|Win32.ActiveCfg = Debug|Win32 {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Debug|Win32.Build.0 = Debug|Win32 {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Debug|x64.ActiveCfg = Debug|x64 {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Debug|x64.Build.0 = Debug|x64 - {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Debug|x86.ActiveCfg = Debug|x64 + {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Release|Win32.ActiveCfg = Release|Win32 {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Release|Win32.Build.0 = Release|Win32 {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Release|x64.ActiveCfg = Release|x64 {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Release|x64.Build.0 = Release|x64 - {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Release|x86.ActiveCfg = Release|x64 + {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Release|x64 Setup.ActiveCfg = Release|x64 + {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Release|x86 Setup.ActiveCfg = Release|Win32 {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.All|Win32.ActiveCfg = Release|x64 {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.All|x64.ActiveCfg = Release|x64 {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.All|x64.Build.0 = Release|x64 - {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.All|x86.ActiveCfg = Release|x64 + {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.All|x64 Setup.ActiveCfg = Release|x64 + {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.All|x64 Setup.Build.0 = Release|x64 + {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.All|x86 Setup.ActiveCfg = Release|x64 {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Debug|Win32.ActiveCfg = Debug|Win32 {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Debug|Win32.Build.0 = Debug|Win32 {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Debug|x64.ActiveCfg = Debug|x64 {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Debug|x64.Build.0 = Debug|x64 - {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Debug|x86.ActiveCfg = Debug|x64 + {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Release|Win32.ActiveCfg = Release|Win32 {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Release|Win32.Build.0 = Release|Win32 {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Release|x64.ActiveCfg = Release|x64 {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Release|x64.Build.0 = Release|x64 - {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Release|x86.ActiveCfg = Release|x64 + {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Release|x64 Setup.ActiveCfg = Release|x64 + {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Release|x86 Setup.ActiveCfg = Release|Win32 {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.All|Win32.ActiveCfg = Release|x64 {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.All|x64.ActiveCfg = Release|x64 {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.All|x64.Build.0 = Release|x64 - {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.All|x86.ActiveCfg = Release|x64 + {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.All|x64 Setup.ActiveCfg = Release|x64 + {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.All|x64 Setup.Build.0 = Release|x64 + {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.All|x86 Setup.ActiveCfg = Release|x64 {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Debug|Win32.ActiveCfg = Debug|Win32 {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Debug|Win32.Build.0 = Debug|Win32 {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Debug|x64.ActiveCfg = Debug|x64 {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Debug|x64.Build.0 = Debug|x64 - {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Debug|x86.ActiveCfg = Debug|x64 + {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Release|Win32.ActiveCfg = Release|Win32 {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Release|Win32.Build.0 = Release|Win32 {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Release|x64.ActiveCfg = Release|x64 {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Release|x64.Build.0 = Release|x64 - {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Release|x86.ActiveCfg = Release|x64 + {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Release|x64 Setup.ActiveCfg = Release|x64 + {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Release|x86 Setup.ActiveCfg = Release|Win32 {36E854E3-CE12-4348-A125-CCF3F9D74813}.All|Win32.ActiveCfg = Release|x64 {36E854E3-CE12-4348-A125-CCF3F9D74813}.All|x64.ActiveCfg = Release|x64 {36E854E3-CE12-4348-A125-CCF3F9D74813}.All|x64.Build.0 = Release|x64 - {36E854E3-CE12-4348-A125-CCF3F9D74813}.All|x86.ActiveCfg = Release|x64 + {36E854E3-CE12-4348-A125-CCF3F9D74813}.All|x64 Setup.ActiveCfg = Release|x64 + {36E854E3-CE12-4348-A125-CCF3F9D74813}.All|x64 Setup.Build.0 = Release|x64 + {36E854E3-CE12-4348-A125-CCF3F9D74813}.All|x86 Setup.ActiveCfg = Release|x64 {36E854E3-CE12-4348-A125-CCF3F9D74813}.Debug|Win32.ActiveCfg = Debug|Win32 {36E854E3-CE12-4348-A125-CCF3F9D74813}.Debug|Win32.Build.0 = Debug|Win32 {36E854E3-CE12-4348-A125-CCF3F9D74813}.Debug|x64.ActiveCfg = Debug|x64 - {36E854E3-CE12-4348-A125-CCF3F9D74813}.Debug|x86.ActiveCfg = Debug|x64 + {36E854E3-CE12-4348-A125-CCF3F9D74813}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {36E854E3-CE12-4348-A125-CCF3F9D74813}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|Win32.ActiveCfg = Release|Win32 {36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|Win32.Build.0 = Release|Win32 {36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|x64.ActiveCfg = Release|x64 - {36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|x86.ActiveCfg = Release|x64 + {36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|x64 Setup.ActiveCfg = Release|x64 + {36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|x86 Setup.ActiveCfg = Release|Win32 {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.All|Win32.ActiveCfg = Release|x64 {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.All|x64.ActiveCfg = Release|x64 {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.All|x64.Build.0 = Release|x64 - {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.All|x86.ActiveCfg = Release|x64 + {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.All|x64 Setup.ActiveCfg = Release|x64 + {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.All|x64 Setup.Build.0 = Release|x64 + {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.All|x86 Setup.ActiveCfg = Release|x64 {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Debug|Win32.ActiveCfg = Debug|Win32 {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Debug|Win32.Build.0 = Debug|Win32 {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Debug|x64.ActiveCfg = Debug|x64 {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Debug|x64.Build.0 = Debug|x64 - {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Debug|x86.ActiveCfg = Debug|x64 + {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|Win32.ActiveCfg = Release|Win32 {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|Win32.Build.0 = Release|Win32 {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|x64.ActiveCfg = Release|x64 {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|x64.Build.0 = Release|x64 - {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|x86.ActiveCfg = Release|x64 + {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|x64 Setup.ActiveCfg = Release|x64 + {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|x86 Setup.ActiveCfg = Release|Win32 {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.All|Win32.ActiveCfg = Release|x64 {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.All|x64.ActiveCfg = Release|x64 {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.All|x64.Build.0 = Release|x64 - {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.All|x86.ActiveCfg = Release|x64 + {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.All|x64 Setup.ActiveCfg = Release|x64 + {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.All|x64 Setup.Build.0 = Release|x64 + {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.All|x86 Setup.ActiveCfg = Release|x64 {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Debug|Win32.ActiveCfg = Debug|Win32 {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Debug|Win32.Build.0 = Debug|Win32 {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Debug|x64.ActiveCfg = Debug|x64 {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Debug|x64.Build.0 = Debug|x64 - {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Debug|x86.ActiveCfg = Debug|x64 + {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|Win32.ActiveCfg = Release|Win32 {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|Win32.Build.0 = Release|Win32 {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|x64.ActiveCfg = Release|x64 {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|x64.Build.0 = Release|x64 - {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|x86.ActiveCfg = Release|x64 + {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|x64 Setup.ActiveCfg = Release|x64 + {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|x86 Setup.ActiveCfg = Release|Win32 {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.All|Win32.ActiveCfg = Release|x64 {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.All|x64.ActiveCfg = Release|x64 {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.All|x64.Build.0 = Release|x64 - {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.All|x86.ActiveCfg = Release|x64 + {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.All|x64 Setup.ActiveCfg = Release|x64 + {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.All|x64 Setup.Build.0 = Release|x64 + {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.All|x86 Setup.ActiveCfg = Release|x64 {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Debug|Win32.ActiveCfg = Debug|Win32 {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Debug|Win32.Build.0 = Debug|Win32 {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Debug|x64.ActiveCfg = Debug|x64 {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Debug|x64.Build.0 = Debug|x64 - {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Debug|x86.ActiveCfg = Debug|x64 + {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|Win32.ActiveCfg = Release|Win32 {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|Win32.Build.0 = Release|Win32 {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|x64.ActiveCfg = Release|x64 {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|x64.Build.0 = Release|x64 - {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|x86.ActiveCfg = Release|x64 + {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|x64 Setup.ActiveCfg = Release|x64 + {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|x86 Setup.ActiveCfg = Release|Win32 {0D108721-EAE8-4BAF-8102-D8960EC93647}.All|Win32.ActiveCfg = Debug|x64 {0D108721-EAE8-4BAF-8102-D8960EC93647}.All|x64.ActiveCfg = Debug|x64 {0D108721-EAE8-4BAF-8102-D8960EC93647}.All|x64.Build.0 = Debug|x64 - {0D108721-EAE8-4BAF-8102-D8960EC93647}.All|x86.ActiveCfg = Release|x64 + {0D108721-EAE8-4BAF-8102-D8960EC93647}.All|x64 Setup.ActiveCfg = Debug|x64 + {0D108721-EAE8-4BAF-8102-D8960EC93647}.All|x64 Setup.Build.0 = Debug|x64 + {0D108721-EAE8-4BAF-8102-D8960EC93647}.All|x86 Setup.ActiveCfg = Debug|x64 {0D108721-EAE8-4BAF-8102-D8960EC93647}.Debug|Win32.ActiveCfg = Debug|Win32 {0D108721-EAE8-4BAF-8102-D8960EC93647}.Debug|Win32.Build.0 = Debug|Win32 {0D108721-EAE8-4BAF-8102-D8960EC93647}.Debug|x64.ActiveCfg = Debug|x64 {0D108721-EAE8-4BAF-8102-D8960EC93647}.Debug|x64.Build.0 = Debug|x64 - {0D108721-EAE8-4BAF-8102-D8960EC93647}.Debug|x86.ActiveCfg = Debug|x64 + {0D108721-EAE8-4BAF-8102-D8960EC93647}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {0D108721-EAE8-4BAF-8102-D8960EC93647}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|Win32.ActiveCfg = Release|Win32 {0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|Win32.Build.0 = Release|Win32 {0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|x64.ActiveCfg = Release|x64 {0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|x64.Build.0 = Release|x64 - {0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|x86.ActiveCfg = Release|x64 + {0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|x64 Setup.ActiveCfg = Release|x64 + {0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|x86 Setup.ActiveCfg = Release|Win32 {B535402E-38D2-4D54-8360-423ACBD17192}.All|Win32.ActiveCfg = Release|x64 {B535402E-38D2-4D54-8360-423ACBD17192}.All|x64.ActiveCfg = Release|x64 {B535402E-38D2-4D54-8360-423ACBD17192}.All|x64.Build.0 = Release|x64 - {B535402E-38D2-4D54-8360-423ACBD17192}.All|x86.ActiveCfg = Release|x64 + {B535402E-38D2-4D54-8360-423ACBD17192}.All|x64 Setup.ActiveCfg = Release|x64 + {B535402E-38D2-4D54-8360-423ACBD17192}.All|x64 Setup.Build.0 = Release|x64 + {B535402E-38D2-4D54-8360-423ACBD17192}.All|x86 Setup.ActiveCfg = Release|x64 {B535402E-38D2-4D54-8360-423ACBD17192}.Debug|Win32.ActiveCfg = Debug|Win32 {B535402E-38D2-4D54-8360-423ACBD17192}.Debug|Win32.Build.0 = Debug|Win32 {B535402E-38D2-4D54-8360-423ACBD17192}.Debug|x64.ActiveCfg = Debug|x64 {B535402E-38D2-4D54-8360-423ACBD17192}.Debug|x64.Build.0 = Debug|x64 - {B535402E-38D2-4D54-8360-423ACBD17192}.Debug|x86.ActiveCfg = Debug|x64 + {B535402E-38D2-4D54-8360-423ACBD17192}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {B535402E-38D2-4D54-8360-423ACBD17192}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {B535402E-38D2-4D54-8360-423ACBD17192}.Release|Win32.ActiveCfg = Release|Win32 {B535402E-38D2-4D54-8360-423ACBD17192}.Release|Win32.Build.0 = Release|Win32 {B535402E-38D2-4D54-8360-423ACBD17192}.Release|x64.ActiveCfg = Release|x64 {B535402E-38D2-4D54-8360-423ACBD17192}.Release|x64.Build.0 = Release|x64 - {B535402E-38D2-4D54-8360-423ACBD17192}.Release|x86.ActiveCfg = Release|x64 + {B535402E-38D2-4D54-8360-423ACBD17192}.Release|x64 Setup.ActiveCfg = Release|x64 + {B535402E-38D2-4D54-8360-423ACBD17192}.Release|x86 Setup.ActiveCfg = Release|Win32 {4F92B672-DADB-4047-8D6A-4BB3796733FD}.All|Win32.ActiveCfg = Release|Win32 {4F92B672-DADB-4047-8D6A-4BB3796733FD}.All|Win32.Build.0 = Release|Win32 {4F92B672-DADB-4047-8D6A-4BB3796733FD}.All|x64.ActiveCfg = Release|Win32 {4F92B672-DADB-4047-8D6A-4BB3796733FD}.All|x64.Build.0 = Release|Win32 - {4F92B672-DADB-4047-8D6A-4BB3796733FD}.All|x86.ActiveCfg = Release|Win32 + {4F92B672-DADB-4047-8D6A-4BB3796733FD}.All|x64 Setup.ActiveCfg = Release|Win32 + {4F92B672-DADB-4047-8D6A-4BB3796733FD}.All|x64 Setup.Build.0 = Release|Win32 + {4F92B672-DADB-4047-8D6A-4BB3796733FD}.All|x86 Setup.ActiveCfg = Release|Win32 + {4F92B672-DADB-4047-8D6A-4BB3796733FD}.All|x86 Setup.Build.0 = Release|Win32 {4F92B672-DADB-4047-8D6A-4BB3796733FD}.Debug|Win32.ActiveCfg = Debug|Win32 {4F92B672-DADB-4047-8D6A-4BB3796733FD}.Debug|Win32.Build.0 = Debug|Win32 {4F92B672-DADB-4047-8D6A-4BB3796733FD}.Debug|x64.ActiveCfg = Debug|Win32 {4F92B672-DADB-4047-8D6A-4BB3796733FD}.Debug|x64.Build.0 = Debug|Win32 - {4F92B672-DADB-4047-8D6A-4BB3796733FD}.Debug|x86.ActiveCfg = Debug|Win32 + {4F92B672-DADB-4047-8D6A-4BB3796733FD}.Debug|x64 Setup.ActiveCfg = Debug|Win32 + {4F92B672-DADB-4047-8D6A-4BB3796733FD}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {4F92B672-DADB-4047-8D6A-4BB3796733FD}.Release|Win32.ActiveCfg = Release|Win32 {4F92B672-DADB-4047-8D6A-4BB3796733FD}.Release|Win32.Build.0 = Release|Win32 {4F92B672-DADB-4047-8D6A-4BB3796733FD}.Release|x64.ActiveCfg = Release|Win32 {4F92B672-DADB-4047-8D6A-4BB3796733FD}.Release|x64.Build.0 = Release|Win32 - {4F92B672-DADB-4047-8D6A-4BB3796733FD}.Release|x86.ActiveCfg = Release|Win32 + {4F92B672-DADB-4047-8D6A-4BB3796733FD}.Release|x64 Setup.ActiveCfg = Release|Win32 + {4F92B672-DADB-4047-8D6A-4BB3796733FD}.Release|x86 Setup.ActiveCfg = Release|Win32 {2DEE4895-1134-439C-B688-52203E57D878}.All|Win32.ActiveCfg = Release|Win32 {2DEE4895-1134-439C-B688-52203E57D878}.All|Win32.Build.0 = Release|Win32 {2DEE4895-1134-439C-B688-52203E57D878}.All|x64.ActiveCfg = Release|Win32 {2DEE4895-1134-439C-B688-52203E57D878}.All|x64.Build.0 = Release|Win32 - {2DEE4895-1134-439C-B688-52203E57D878}.All|x86.ActiveCfg = Release|Win32 + {2DEE4895-1134-439C-B688-52203E57D878}.All|x64 Setup.ActiveCfg = Release|Win32 + {2DEE4895-1134-439C-B688-52203E57D878}.All|x64 Setup.Build.0 = Release|Win32 + {2DEE4895-1134-439C-B688-52203E57D878}.All|x86 Setup.ActiveCfg = Release|Win32 + {2DEE4895-1134-439C-B688-52203E57D878}.All|x86 Setup.Build.0 = Release|Win32 {2DEE4895-1134-439C-B688-52203E57D878}.Debug|Win32.ActiveCfg = Debug|Win32 {2DEE4895-1134-439C-B688-52203E57D878}.Debug|Win32.Build.0 = Debug|Win32 {2DEE4895-1134-439C-B688-52203E57D878}.Debug|x64.ActiveCfg = Debug|Win32 {2DEE4895-1134-439C-B688-52203E57D878}.Debug|x64.Build.0 = Debug|Win32 - {2DEE4895-1134-439C-B688-52203E57D878}.Debug|x86.ActiveCfg = Debug|Win32 + {2DEE4895-1134-439C-B688-52203E57D878}.Debug|x64 Setup.ActiveCfg = Debug|Win32 + {2DEE4895-1134-439C-B688-52203E57D878}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {2DEE4895-1134-439C-B688-52203E57D878}.Release|Win32.ActiveCfg = Release|Win32 {2DEE4895-1134-439C-B688-52203E57D878}.Release|Win32.Build.0 = Release|Win32 {2DEE4895-1134-439C-B688-52203E57D878}.Release|x64.ActiveCfg = Release|Win32 {2DEE4895-1134-439C-B688-52203E57D878}.Release|x64.Build.0 = Release|Win32 - {2DEE4895-1134-439C-B688-52203E57D878}.Release|x86.ActiveCfg = Release|Win32 + {2DEE4895-1134-439C-B688-52203E57D878}.Release|x64 Setup.ActiveCfg = Release|Win32 + {2DEE4895-1134-439C-B688-52203E57D878}.Release|x86 Setup.ActiveCfg = Release|Win32 {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.All|Win32.ActiveCfg = Release|Win32 {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.All|Win32.Build.0 = Release|Win32 {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.All|x64.ActiveCfg = Release|Win32 {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.All|x64.Build.0 = Release|Win32 - {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.All|x86.ActiveCfg = Release|Win32 + {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.All|x64 Setup.ActiveCfg = Release|Win32 + {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.All|x64 Setup.Build.0 = Release|Win32 + {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.All|x86 Setup.ActiveCfg = Release|Win32 + {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.All|x86 Setup.Build.0 = Release|Win32 {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Debug|Win32.ActiveCfg = Debug|Win32 {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Debug|Win32.Build.0 = Debug|Win32 {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Debug|x64.ActiveCfg = Debug|Win32 {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Debug|x64.Build.0 = Debug|Win32 - {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Debug|x86.ActiveCfg = Debug|Win32 + {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Debug|x64 Setup.ActiveCfg = Debug|Win32 + {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Release|Win32.ActiveCfg = Release|Win32 {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Release|Win32.Build.0 = Release|Win32 {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Release|x64.ActiveCfg = Release|Win32 {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Release|x64.Build.0 = Release|Win32 - {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Release|x86.ActiveCfg = Release|Win32 + {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Release|x64 Setup.ActiveCfg = Release|Win32 + {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Release|x86 Setup.ActiveCfg = Release|Win32 {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.All|Win32.ActiveCfg = Debug|x64 {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.All|x64.ActiveCfg = Debug|x64 {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.All|x64.Build.0 = Debug|x64 - {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.All|x86.ActiveCfg = Release|x64 + {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.All|x64 Setup.ActiveCfg = Debug|x64 + {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.All|x64 Setup.Build.0 = Debug|x64 + {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.All|x86 Setup.ActiveCfg = Debug|x64 {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Debug|Win32.ActiveCfg = Debug|Win32 {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Debug|Win32.Build.0 = Debug|Win32 {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Debug|x64.ActiveCfg = Debug|x64 {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Debug|x64.Build.0 = Debug|x64 - {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Debug|x86.ActiveCfg = Debug|x64 + {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Release|Win32.ActiveCfg = Release|Win32 {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Release|Win32.Build.0 = Release|Win32 {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Release|x64.ActiveCfg = Release|x64 {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Release|x64.Build.0 = Release|x64 - {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Release|x86.ActiveCfg = Release|x64 + {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Release|x64 Setup.ActiveCfg = Release|x64 + {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Release|x86 Setup.ActiveCfg = Release|Win32 {94001A0E-A837-445C-8004-F918F10D0226}.All|Win32.ActiveCfg = Debug|x64 {94001A0E-A837-445C-8004-F918F10D0226}.All|x64.ActiveCfg = Debug|x64 {94001A0E-A837-445C-8004-F918F10D0226}.All|x64.Build.0 = Debug|x64 - {94001A0E-A837-445C-8004-F918F10D0226}.All|x86.ActiveCfg = Release|x64 + {94001A0E-A837-445C-8004-F918F10D0226}.All|x64 Setup.ActiveCfg = Debug|x64 + {94001A0E-A837-445C-8004-F918F10D0226}.All|x64 Setup.Build.0 = Debug|x64 + {94001A0E-A837-445C-8004-F918F10D0226}.All|x86 Setup.ActiveCfg = Debug|x64 {94001A0E-A837-445C-8004-F918F10D0226}.Debug|Win32.ActiveCfg = Debug|Win32 {94001A0E-A837-445C-8004-F918F10D0226}.Debug|Win32.Build.0 = Debug|Win32 {94001A0E-A837-445C-8004-F918F10D0226}.Debug|x64.ActiveCfg = Debug|x64 {94001A0E-A837-445C-8004-F918F10D0226}.Debug|x64.Build.0 = Debug|x64 - {94001A0E-A837-445C-8004-F918F10D0226}.Debug|x86.ActiveCfg = Debug|x64 + {94001A0E-A837-445C-8004-F918F10D0226}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {94001A0E-A837-445C-8004-F918F10D0226}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {94001A0E-A837-445C-8004-F918F10D0226}.Release|Win32.ActiveCfg = Release|Win32 {94001A0E-A837-445C-8004-F918F10D0226}.Release|Win32.Build.0 = Release|Win32 {94001A0E-A837-445C-8004-F918F10D0226}.Release|x64.ActiveCfg = Release|x64 {94001A0E-A837-445C-8004-F918F10D0226}.Release|x64.Build.0 = Release|x64 - {94001A0E-A837-445C-8004-F918F10D0226}.Release|x86.ActiveCfg = Release|x64 + {94001A0E-A837-445C-8004-F918F10D0226}.Release|x64 Setup.ActiveCfg = Release|x64 + {94001A0E-A837-445C-8004-F918F10D0226}.Release|x86 Setup.ActiveCfg = Release|Win32 {2286DA73-9FC5-45BC-A508-85994C3317AB}.All|Win32.ActiveCfg = Release|x64 {2286DA73-9FC5-45BC-A508-85994C3317AB}.All|x64.ActiveCfg = Release|x64 {2286DA73-9FC5-45BC-A508-85994C3317AB}.All|x64.Build.0 = Release|x64 - {2286DA73-9FC5-45BC-A508-85994C3317AB}.All|x86.ActiveCfg = Release|x64 + {2286DA73-9FC5-45BC-A508-85994C3317AB}.All|x64 Setup.ActiveCfg = Release|x64 + {2286DA73-9FC5-45BC-A508-85994C3317AB}.All|x64 Setup.Build.0 = Release|x64 + {2286DA73-9FC5-45BC-A508-85994C3317AB}.All|x86 Setup.ActiveCfg = Release|x64 {2286DA73-9FC5-45BC-A508-85994C3317AB}.Debug|Win32.ActiveCfg = Debug|Win32 {2286DA73-9FC5-45BC-A508-85994C3317AB}.Debug|Win32.Build.0 = Debug|Win32 {2286DA73-9FC5-45BC-A508-85994C3317AB}.Debug|x64.ActiveCfg = Debug|x64 {2286DA73-9FC5-45BC-A508-85994C3317AB}.Debug|x64.Build.0 = Debug|x64 - {2286DA73-9FC5-45BC-A508-85994C3317AB}.Debug|x86.ActiveCfg = Debug|x64 + {2286DA73-9FC5-45BC-A508-85994C3317AB}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {2286DA73-9FC5-45BC-A508-85994C3317AB}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {2286DA73-9FC5-45BC-A508-85994C3317AB}.Release|Win32.ActiveCfg = Release|Win32 {2286DA73-9FC5-45BC-A508-85994C3317AB}.Release|Win32.Build.0 = Release|Win32 {2286DA73-9FC5-45BC-A508-85994C3317AB}.Release|x64.ActiveCfg = Release|x64 {2286DA73-9FC5-45BC-A508-85994C3317AB}.Release|x64.Build.0 = Release|x64 - {2286DA73-9FC5-45BC-A508-85994C3317AB}.Release|x86.ActiveCfg = Release|x64 + {2286DA73-9FC5-45BC-A508-85994C3317AB}.Release|x64 Setup.ActiveCfg = Release|x64 + {2286DA73-9FC5-45BC-A508-85994C3317AB}.Release|x86 Setup.ActiveCfg = Release|Win32 {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.All|Win32.ActiveCfg = Release|Win32 {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.All|Win32.Build.0 = Release|Win32 {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.All|x64.ActiveCfg = Release|Win32 {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.All|x64.Build.0 = Release|Win32 - {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.All|x86.ActiveCfg = Release|Win32 + {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.All|x64 Setup.ActiveCfg = Release|Win32 + {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.All|x64 Setup.Build.0 = Release|Win32 + {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.All|x86 Setup.ActiveCfg = Release|Win32 + {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.All|x86 Setup.Build.0 = Release|Win32 {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Debug|Win32.ActiveCfg = Debug|Win32 {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Debug|Win32.Build.0 = Debug|Win32 {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Debug|x64.ActiveCfg = Debug|Win32 {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Debug|x64.Build.0 = Debug|Win32 - {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Debug|x86.ActiveCfg = Debug|Win32 + {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Debug|x64 Setup.ActiveCfg = Debug|Win32 + {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Release|Win32.ActiveCfg = Release|Win32 {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Release|Win32.Build.0 = Release|Win32 {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Release|x64.ActiveCfg = Release|Win32 {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Release|x64.Build.0 = Release|Win32 - {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Release|x86.ActiveCfg = Release|Win32 + {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Release|x64 Setup.ActiveCfg = Release|Win32 + {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Release|x86 Setup.ActiveCfg = Release|Win32 {87A1FE3D-F410-4C8E-9591-8C625985BC70}.All|Win32.ActiveCfg = Release|Win32 {87A1FE3D-F410-4C8E-9591-8C625985BC70}.All|x64.ActiveCfg = Release|Win32 - {87A1FE3D-F410-4C8E-9591-8C625985BC70}.All|x86.ActiveCfg = Release|Win32 + {87A1FE3D-F410-4C8E-9591-8C625985BC70}.All|x64 Setup.ActiveCfg = Release|Win32 + {87A1FE3D-F410-4C8E-9591-8C625985BC70}.All|x86 Setup.ActiveCfg = Release|Win32 {87A1FE3D-F410-4C8E-9591-8C625985BC70}.Debug|Win32.ActiveCfg = Debug|Win32 {87A1FE3D-F410-4C8E-9591-8C625985BC70}.Debug|x64.ActiveCfg = Debug|Win32 - {87A1FE3D-F410-4C8E-9591-8C625985BC70}.Debug|x86.ActiveCfg = Debug|Win32 + {87A1FE3D-F410-4C8E-9591-8C625985BC70}.Debug|x64 Setup.ActiveCfg = Debug|Win32 + {87A1FE3D-F410-4C8E-9591-8C625985BC70}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {87A1FE3D-F410-4C8E-9591-8C625985BC70}.Release|Win32.ActiveCfg = Release|Win32 {87A1FE3D-F410-4C8E-9591-8C625985BC70}.Release|x64.ActiveCfg = Release|Win32 - {87A1FE3D-F410-4C8E-9591-8C625985BC70}.Release|x86.ActiveCfg = Release|Win32 + {87A1FE3D-F410-4C8E-9591-8C625985BC70}.Release|x64 Setup.ActiveCfg = Release|Win32 + {87A1FE3D-F410-4C8E-9591-8C625985BC70}.Release|x86 Setup.ActiveCfg = Release|Win32 {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.All|Win32.ActiveCfg = Release|Win32 {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.All|Win32.Build.0 = Release|Win32 {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.All|x64.ActiveCfg = Release|Win32 {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.All|x64.Build.0 = Release|Win32 - {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.All|x86.ActiveCfg = Release|x64 + {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.All|x64 Setup.ActiveCfg = Release|Win32 + {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.All|x64 Setup.Build.0 = Release|Win32 + {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.All|x86 Setup.ActiveCfg = Release|Win32 + {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.All|x86 Setup.Build.0 = Release|Win32 {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Debug|Win32.ActiveCfg = Debug|Win32 {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Debug|Win32.Build.0 = Debug|Win32 {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Debug|x64.ActiveCfg = Debug|x64 {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Debug|x64.Build.0 = Debug|x64 - {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Debug|x86.ActiveCfg = Debug|x64 + {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Release|Win32.ActiveCfg = Release|Win32 {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Release|Win32.Build.0 = Release|Win32 {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Release|x64.ActiveCfg = Release|x64 {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Release|x64.Build.0 = Release|x64 - {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Release|x86.ActiveCfg = Release|x64 + {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Release|x64 Setup.ActiveCfg = Release|x64 + {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Release|x86 Setup.ActiveCfg = Release|Win32 {7EB71250-F002-4ED8-92CA-CA218114537A}.All|Win32.ActiveCfg = Release|Win32 {7EB71250-F002-4ED8-92CA-CA218114537A}.All|x64.ActiveCfg = Release|Win32 - {7EB71250-F002-4ED8-92CA-CA218114537A}.All|x86.ActiveCfg = Release|x64 + {7EB71250-F002-4ED8-92CA-CA218114537A}.All|x64 Setup.ActiveCfg = Release|Win32 + {7EB71250-F002-4ED8-92CA-CA218114537A}.All|x86 Setup.ActiveCfg = Release|Win32 {7EB71250-F002-4ED8-92CA-CA218114537A}.Debug|Win32.ActiveCfg = Debug|Win32 {7EB71250-F002-4ED8-92CA-CA218114537A}.Debug|x64.ActiveCfg = Debug|x64 - {7EB71250-F002-4ED8-92CA-CA218114537A}.Debug|x86.ActiveCfg = Debug|x64 + {7EB71250-F002-4ED8-92CA-CA218114537A}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {7EB71250-F002-4ED8-92CA-CA218114537A}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {7EB71250-F002-4ED8-92CA-CA218114537A}.Release|Win32.ActiveCfg = Release|Win32 {7EB71250-F002-4ED8-92CA-CA218114537A}.Release|x64.ActiveCfg = Release|x64 - {7EB71250-F002-4ED8-92CA-CA218114537A}.Release|x86.ActiveCfg = Release|x64 + {7EB71250-F002-4ED8-92CA-CA218114537A}.Release|x64 Setup.ActiveCfg = Release|x64 + {7EB71250-F002-4ED8-92CA-CA218114537A}.Release|x86 Setup.ActiveCfg = Release|Win32 {6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.All|Win32.ActiveCfg = Release|Win32 {6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.All|x64.ActiveCfg = Release|Win32 - {6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.All|x86.ActiveCfg = Release|Win32 + {6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.All|x64 Setup.ActiveCfg = Release|Win32 + {6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.All|x86 Setup.ActiveCfg = Release|Win32 {6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.Debug|Win32.ActiveCfg = Debug|Win32 {6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.Debug|x64.ActiveCfg = Debug|Win32 - {6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.Debug|x86.ActiveCfg = Debug|Win32 + {6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.Debug|x64 Setup.ActiveCfg = Debug|Win32 + {6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.Release|Win32.ActiveCfg = Release|Win32 {6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.Release|x64.ActiveCfg = Release|Win32 - {6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.Release|x86.ActiveCfg = Release|Win32 + {6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.Release|x64 Setup.ActiveCfg = Release|Win32 + {6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.Release|x86 Setup.ActiveCfg = Release|Win32 {464AAB78-5489-4916-BE51-BF8D61822311}.All|Win32.ActiveCfg = Release|Win32 {464AAB78-5489-4916-BE51-BF8D61822311}.All|x64.ActiveCfg = Release|Win32 - {464AAB78-5489-4916-BE51-BF8D61822311}.All|x86.ActiveCfg = Release|x64 + {464AAB78-5489-4916-BE51-BF8D61822311}.All|x64 Setup.ActiveCfg = Release|Win32 + {464AAB78-5489-4916-BE51-BF8D61822311}.All|x86 Setup.ActiveCfg = Release|Win32 {464AAB78-5489-4916-BE51-BF8D61822311}.Debug|Win32.ActiveCfg = Debug|Win32 {464AAB78-5489-4916-BE51-BF8D61822311}.Debug|x64.ActiveCfg = Debug|x64 - {464AAB78-5489-4916-BE51-BF8D61822311}.Debug|x86.ActiveCfg = Debug|x64 + {464AAB78-5489-4916-BE51-BF8D61822311}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {464AAB78-5489-4916-BE51-BF8D61822311}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {464AAB78-5489-4916-BE51-BF8D61822311}.Release|Win32.ActiveCfg = Release|Win32 {464AAB78-5489-4916-BE51-BF8D61822311}.Release|x64.ActiveCfg = Release|x64 - {464AAB78-5489-4916-BE51-BF8D61822311}.Release|x86.ActiveCfg = Release|x64 + {464AAB78-5489-4916-BE51-BF8D61822311}.Release|x64 Setup.ActiveCfg = Release|x64 + {464AAB78-5489-4916-BE51-BF8D61822311}.Release|x86 Setup.ActiveCfg = Release|Win32 {0AD1177E-1FD8-4643-9391-431467A11084}.All|Win32.ActiveCfg = Release|x64 {0AD1177E-1FD8-4643-9391-431467A11084}.All|x64.ActiveCfg = Release|x64 {0AD1177E-1FD8-4643-9391-431467A11084}.All|x64.Build.0 = Release|x64 - {0AD1177E-1FD8-4643-9391-431467A11084}.All|x86.ActiveCfg = Release|x64 + {0AD1177E-1FD8-4643-9391-431467A11084}.All|x64 Setup.ActiveCfg = Release|x64 + {0AD1177E-1FD8-4643-9391-431467A11084}.All|x64 Setup.Build.0 = Release|x64 + {0AD1177E-1FD8-4643-9391-431467A11084}.All|x86 Setup.ActiveCfg = Release|x64 {0AD1177E-1FD8-4643-9391-431467A11084}.Debug|Win32.ActiveCfg = Debug|Win32 {0AD1177E-1FD8-4643-9391-431467A11084}.Debug|Win32.Build.0 = Debug|Win32 {0AD1177E-1FD8-4643-9391-431467A11084}.Debug|x64.ActiveCfg = Debug|x64 {0AD1177E-1FD8-4643-9391-431467A11084}.Debug|x64.Build.0 = Debug|x64 - {0AD1177E-1FD8-4643-9391-431467A11084}.Debug|x86.ActiveCfg = Debug|x64 + {0AD1177E-1FD8-4643-9391-431467A11084}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {0AD1177E-1FD8-4643-9391-431467A11084}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {0AD1177E-1FD8-4643-9391-431467A11084}.Release|Win32.ActiveCfg = Release|Win32 {0AD1177E-1FD8-4643-9391-431467A11084}.Release|Win32.Build.0 = Release|Win32 {0AD1177E-1FD8-4643-9391-431467A11084}.Release|x64.ActiveCfg = Release|x64 {0AD1177E-1FD8-4643-9391-431467A11084}.Release|x64.Build.0 = Release|x64 - {0AD1177E-1FD8-4643-9391-431467A11084}.Release|x86.ActiveCfg = Release|x64 + {0AD1177E-1FD8-4643-9391-431467A11084}.Release|x64 Setup.ActiveCfg = Release|x64 + {0AD1177E-1FD8-4643-9391-431467A11084}.Release|x86 Setup.ActiveCfg = Release|Win32 {66444AEE-554C-11DD-A9F0-8C5D56D89593}.All|Win32.ActiveCfg = Release Static|x64 {66444AEE-554C-11DD-A9F0-8C5D56D89593}.All|x64.ActiveCfg = Release Static|x64 {66444AEE-554C-11DD-A9F0-8C5D56D89593}.All|x64.Build.0 = Release Static|x64 - {66444AEE-554C-11DD-A9F0-8C5D56D89593}.All|x86.ActiveCfg = Release|x64 + {66444AEE-554C-11DD-A9F0-8C5D56D89593}.All|x64 Setup.ActiveCfg = Release Static|x64 + {66444AEE-554C-11DD-A9F0-8C5D56D89593}.All|x64 Setup.Build.0 = Release Static|x64 + {66444AEE-554C-11DD-A9F0-8C5D56D89593}.All|x86 Setup.ActiveCfg = Release Static|x64 {66444AEE-554C-11DD-A9F0-8C5D56D89593}.Debug|Win32.ActiveCfg = Debug|Win32 {66444AEE-554C-11DD-A9F0-8C5D56D89593}.Debug|x64.ActiveCfg = Debug|x64 - {66444AEE-554C-11DD-A9F0-8C5D56D89593}.Debug|x86.ActiveCfg = Debug|x64 + {66444AEE-554C-11DD-A9F0-8C5D56D89593}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {66444AEE-554C-11DD-A9F0-8C5D56D89593}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {66444AEE-554C-11DD-A9F0-8C5D56D89593}.Release|Win32.ActiveCfg = Release|Win32 {66444AEE-554C-11DD-A9F0-8C5D56D89593}.Release|x64.ActiveCfg = Release|x64 - {66444AEE-554C-11DD-A9F0-8C5D56D89593}.Release|x86.ActiveCfg = Release|x64 + {66444AEE-554C-11DD-A9F0-8C5D56D89593}.Release|x64 Setup.ActiveCfg = Release|x64 + {66444AEE-554C-11DD-A9F0-8C5D56D89593}.Release|x86 Setup.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.All|Win32.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.All|Win32.Build.0 = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.All|x64.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.All|x64.Build.0 = Release|Win32 - {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.All|x86.ActiveCfg = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.All|x64 Setup.ActiveCfg = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.All|x64 Setup.Build.0 = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.All|x86 Setup.ActiveCfg = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.All|x86 Setup.Build.0 = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Debug|Win32.ActiveCfg = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Debug|Win32.Build.0 = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Debug|x64.ActiveCfg = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Debug|x64.Build.0 = Debug|Win32 - {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Debug|x86.ActiveCfg = Debug|Win32 + {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Debug|x64 Setup.ActiveCfg = Debug|Win32 + {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Release|Win32.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Release|Win32.Build.0 = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Release|x64.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Release|x64.Build.0 = Release|Win32 - {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Release|x86.ActiveCfg = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Release|x64 Setup.ActiveCfg = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Release|x86 Setup.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.All|Win32.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.All|Win32.Build.0 = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.All|x64.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.All|x64.Build.0 = Release|Win32 - {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.All|x86.ActiveCfg = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.All|x64 Setup.ActiveCfg = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.All|x64 Setup.Build.0 = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.All|x86 Setup.ActiveCfg = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.All|x86 Setup.Build.0 = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|Win32.ActiveCfg = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|Win32.Build.0 = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|x64.ActiveCfg = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|x64.Build.0 = Debug|Win32 - {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|x86.ActiveCfg = Debug|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|x64 Setup.ActiveCfg = Debug|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Release|Win32.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Release|Win32.Build.0 = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Release|x64.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Release|x64.Build.0 = Release|Win32 - {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Release|x86.ActiveCfg = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Release|x64 Setup.ActiveCfg = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Release|x86 Setup.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.All|Win32.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.All|Win32.Build.0 = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.All|x64.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.All|x64.Build.0 = Release|Win32 - {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.All|x86.ActiveCfg = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.All|x64 Setup.ActiveCfg = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.All|x64 Setup.Build.0 = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.All|x86 Setup.ActiveCfg = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.All|x86 Setup.Build.0 = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Debug|Win32.ActiveCfg = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Debug|Win32.Build.0 = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Debug|x64.ActiveCfg = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Debug|x64.Build.0 = Debug|Win32 - {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Debug|x86.ActiveCfg = Debug|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Debug|x64 Setup.ActiveCfg = Debug|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Release|Win32.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Release|Win32.Build.0 = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Release|x64.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Release|x64.Build.0 = Release|Win32 - {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Release|x86.ActiveCfg = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Release|x64 Setup.ActiveCfg = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Release|x86 Setup.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.All|Win32.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.All|Win32.Build.0 = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.All|x64.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.All|x64.Build.0 = Release|Win32 - {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.All|x86.ActiveCfg = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.All|x64 Setup.ActiveCfg = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.All|x64 Setup.Build.0 = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.All|x86 Setup.ActiveCfg = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.All|x86 Setup.Build.0 = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Debug|Win32.ActiveCfg = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Debug|Win32.Build.0 = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Debug|x64.ActiveCfg = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Debug|x64.Build.0 = Debug|Win32 - {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Debug|x86.ActiveCfg = Debug|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Debug|x64 Setup.ActiveCfg = Debug|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Release|Win32.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Release|Win32.Build.0 = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Release|x64.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Release|x64.Build.0 = Release|Win32 - {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Release|x86.ActiveCfg = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Release|x64 Setup.ActiveCfg = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Release|x86 Setup.ActiveCfg = Release|Win32 {E316772F-5D8F-4F2A-8F71-094C3E859D34}.All|Win32.ActiveCfg = Debug|x64 {E316772F-5D8F-4F2A-8F71-094C3E859D34}.All|x64.ActiveCfg = Debug|x64 {E316772F-5D8F-4F2A-8F71-094C3E859D34}.All|x64.Build.0 = Debug|x64 - {E316772F-5D8F-4F2A-8F71-094C3E859D34}.All|x86.ActiveCfg = Release|x64 + {E316772F-5D8F-4F2A-8F71-094C3E859D34}.All|x64 Setup.ActiveCfg = Debug|x64 + {E316772F-5D8F-4F2A-8F71-094C3E859D34}.All|x64 Setup.Build.0 = Debug|x64 + {E316772F-5D8F-4F2A-8F71-094C3E859D34}.All|x86 Setup.ActiveCfg = Debug|x64 {E316772F-5D8F-4F2A-8F71-094C3E859D34}.Debug|Win32.ActiveCfg = Debug|Win32 {E316772F-5D8F-4F2A-8F71-094C3E859D34}.Debug|Win32.Build.0 = Debug|Win32 {E316772F-5D8F-4F2A-8F71-094C3E859D34}.Debug|x64.ActiveCfg = Debug|x64 {E316772F-5D8F-4F2A-8F71-094C3E859D34}.Debug|x64.Build.0 = Debug|x64 - {E316772F-5D8F-4F2A-8F71-094C3E859D34}.Debug|x86.ActiveCfg = Debug|x64 + {E316772F-5D8F-4F2A-8F71-094C3E859D34}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {E316772F-5D8F-4F2A-8F71-094C3E859D34}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {E316772F-5D8F-4F2A-8F71-094C3E859D34}.Release|Win32.ActiveCfg = Release|Win32 {E316772F-5D8F-4F2A-8F71-094C3E859D34}.Release|Win32.Build.0 = Release|Win32 {E316772F-5D8F-4F2A-8F71-094C3E859D34}.Release|x64.ActiveCfg = Release|x64 {E316772F-5D8F-4F2A-8F71-094C3E859D34}.Release|x64.Build.0 = Release|x64 - {E316772F-5D8F-4F2A-8F71-094C3E859D34}.Release|x86.ActiveCfg = Release|x64 + {E316772F-5D8F-4F2A-8F71-094C3E859D34}.Release|x64 Setup.ActiveCfg = Release|x64 + {E316772F-5D8F-4F2A-8F71-094C3E859D34}.Release|x86 Setup.ActiveCfg = Release|Win32 {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.All|Win32.ActiveCfg = Debug|x64 {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.All|x64.ActiveCfg = Debug|x64 {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.All|x64.Build.0 = Debug|x64 - {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.All|x86.ActiveCfg = Release|x64 + {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.All|x64 Setup.ActiveCfg = Debug|x64 + {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.All|x64 Setup.Build.0 = Debug|x64 + {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.All|x86 Setup.ActiveCfg = Debug|x64 {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Debug|Win32.ActiveCfg = Debug|Win32 {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Debug|Win32.Build.0 = Debug|Win32 {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Debug|x64.ActiveCfg = Debug|x64 {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Debug|x64.Build.0 = Debug|x64 - {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Debug|x86.ActiveCfg = Debug|x64 + {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Release|Win32.ActiveCfg = Release|Win32 {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Release|Win32.Build.0 = Release|Win32 {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Release|x64.ActiveCfg = Release|x64 {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Release|x64.Build.0 = Release|x64 - {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Release|x86.ActiveCfg = Release|x64 + {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Release|x64 Setup.ActiveCfg = Release|x64 + {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Release|x86 Setup.ActiveCfg = Release|Win32 {38FE0559-9910-43A8-9E45-3E5004C27692}.All|Win32.ActiveCfg = Release|x64 {38FE0559-9910-43A8-9E45-3E5004C27692}.All|x64.ActiveCfg = Release|x64 {38FE0559-9910-43A8-9E45-3E5004C27692}.All|x64.Build.0 = Release|x64 - {38FE0559-9910-43A8-9E45-3E5004C27692}.All|x86.ActiveCfg = Release|x64 + {38FE0559-9910-43A8-9E45-3E5004C27692}.All|x64 Setup.ActiveCfg = Release|x64 + {38FE0559-9910-43A8-9E45-3E5004C27692}.All|x64 Setup.Build.0 = Release|x64 + {38FE0559-9910-43A8-9E45-3E5004C27692}.All|x86 Setup.ActiveCfg = Release|x64 {38FE0559-9910-43A8-9E45-3E5004C27692}.Debug|Win32.ActiveCfg = Debug|Win32 {38FE0559-9910-43A8-9E45-3E5004C27692}.Debug|Win32.Build.0 = Debug|Win32 {38FE0559-9910-43A8-9E45-3E5004C27692}.Debug|x64.ActiveCfg = Debug|x64 {38FE0559-9910-43A8-9E45-3E5004C27692}.Debug|x64.Build.0 = Debug|x64 - {38FE0559-9910-43A8-9E45-3E5004C27692}.Debug|x86.ActiveCfg = Debug|x64 + {38FE0559-9910-43A8-9E45-3E5004C27692}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {38FE0559-9910-43A8-9E45-3E5004C27692}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {38FE0559-9910-43A8-9E45-3E5004C27692}.Release|Win32.ActiveCfg = Release|Win32 {38FE0559-9910-43A8-9E45-3E5004C27692}.Release|Win32.Build.0 = Release|Win32 {38FE0559-9910-43A8-9E45-3E5004C27692}.Release|x64.ActiveCfg = Release|x64 {38FE0559-9910-43A8-9E45-3E5004C27692}.Release|x64.Build.0 = Release|x64 - {38FE0559-9910-43A8-9E45-3E5004C27692}.Release|x86.ActiveCfg = Release|x64 + {38FE0559-9910-43A8-9E45-3E5004C27692}.Release|x64 Setup.ActiveCfg = Release|x64 + {38FE0559-9910-43A8-9E45-3E5004C27692}.Release|x86 Setup.ActiveCfg = Release|Win32 {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.All|Win32.ActiveCfg = Debug|x64 {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.All|x64.ActiveCfg = Debug|x64 {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.All|x64.Build.0 = Debug|x64 - {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.All|x86.ActiveCfg = Release|x64 + {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.All|x64 Setup.ActiveCfg = Debug|x64 + {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.All|x64 Setup.Build.0 = Debug|x64 + {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.All|x86 Setup.ActiveCfg = Debug|x64 {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Debug|Win32.ActiveCfg = Debug|Win32 {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Debug|Win32.Build.0 = Debug|Win32 {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Debug|x64.ActiveCfg = Debug|x64 {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Debug|x64.Build.0 = Debug|x64 - {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Debug|x86.ActiveCfg = Debug|x64 + {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|Win32.ActiveCfg = Release|Win32 {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|Win32.Build.0 = Release|Win32 {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|x64.ActiveCfg = Release|x64 {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|x64.Build.0 = Release|x64 - {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|x86.ActiveCfg = Release|x64 + {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|x64 Setup.ActiveCfg = Release|x64 + {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|x86 Setup.ActiveCfg = Release|Win32 {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.All|Win32.ActiveCfg = Release|x64 {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.All|x64.ActiveCfg = Release|x64 {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.All|x64.Build.0 = Release|x64 - {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.All|x86.ActiveCfg = Release|x64 + {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.All|x64 Setup.ActiveCfg = Release|x64 + {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.All|x64 Setup.Build.0 = Release|x64 + {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.All|x86 Setup.ActiveCfg = Release|x64 {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|Win32.ActiveCfg = Debug|Win32 {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|Win32.Build.0 = Debug|Win32 {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|x64.ActiveCfg = Debug|x64 {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|x64.Build.0 = Debug|x64 - {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|x86.ActiveCfg = Debug|x64 + {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|Win32.ActiveCfg = Release|Win32 {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|Win32.Build.0 = Release|Win32 {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|x64.ActiveCfg = Release|x64 {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|x64.Build.0 = Release|x64 - {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|x86.ActiveCfg = Release|x64 + {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|x64 Setup.ActiveCfg = Release|x64 + {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|x86 Setup.ActiveCfg = Release|Win32 {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.All|Win32.ActiveCfg = Release|x64 {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.All|x64.ActiveCfg = Release|x64 {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.All|x64.Build.0 = Release|x64 - {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.All|x86.ActiveCfg = Release|x64 + {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.All|x64 Setup.ActiveCfg = Release|x64 + {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.All|x64 Setup.Build.0 = Release|x64 + {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.All|x86 Setup.ActiveCfg = Release|x64 {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Debug|Win32.ActiveCfg = Debug|Win32 {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Debug|Win32.Build.0 = Debug|Win32 {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Debug|x64.ActiveCfg = Debug|x64 {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Debug|x64.Build.0 = Debug|x64 - {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Debug|x86.ActiveCfg = Debug|x64 + {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|Win32.ActiveCfg = Release|Win32 {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|Win32.Build.0 = Release|Win32 {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|x64.ActiveCfg = Release|x64 {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|x64.Build.0 = Release|x64 - {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|x86.ActiveCfg = Release|x64 + {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|x64 Setup.ActiveCfg = Release|x64 + {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|x86 Setup.ActiveCfg = Release|Win32 {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.All|Win32.ActiveCfg = Release_Mono|x64 {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.All|x64.ActiveCfg = Release_Mono|x64 {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.All|x64.Build.0 = Release_Mono|x64 - {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.All|x86.ActiveCfg = Release_Mono|x64 + {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.All|x64 Setup.ActiveCfg = Release_Mono|x64 + {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.All|x64 Setup.Build.0 = Release_Mono|x64 + {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.All|x86 Setup.ActiveCfg = Release_Mono|x64 {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Debug|Win32.ActiveCfg = Debug_CLR|Win32 {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Debug|Win32.Build.0 = Debug_CLR|Win32 {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Debug|x64.ActiveCfg = Debug_CLR|x64 {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Debug|x64.Build.0 = Debug_CLR|x64 - {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Debug|x86.ActiveCfg = Debug_Mono|x64 + {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Debug|x64 Setup.ActiveCfg = Debug_CLR|x64 + {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Debug|x86 Setup.ActiveCfg = Debug_CLR|Win32 {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Release|Win32.ActiveCfg = Release_CLR|Win32 {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Release|Win32.Build.0 = Release_CLR|Win32 {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Release|x64.ActiveCfg = Release_CLR|x64 {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Release|x64.Build.0 = Release_CLR|x64 - {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Release|x86.ActiveCfg = Release_Mono|x64 + {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Release|x64 Setup.ActiveCfg = Release_CLR|x64 + {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Release|x86 Setup.ActiveCfg = Release_CLR|Win32 {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.All|Win32.ActiveCfg = Release|Any CPU {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.All|x64.ActiveCfg = Release|Any CPU - {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.All|x86.ActiveCfg = Release|x64 + {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.All|x64 Setup.ActiveCfg = Release|Any CPU + {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.All|x86 Setup.ActiveCfg = Release|Any CPU {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|Win32.ActiveCfg = Debug|Any CPU {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|Win32.Build.0 = Debug|Any CPU {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x64.ActiveCfg = Debug|x64 {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x64.Build.0 = Debug|x64 - {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x86.ActiveCfg = Debug|x64 + {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x86 Setup.ActiveCfg = Debug|Any CPU {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|Win32.ActiveCfg = Release|Any CPU {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|Win32.Build.0 = Release|Any CPU {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x64.ActiveCfg = Release|x64 {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x64.Build.0 = Release|x64 - {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x86.ActiveCfg = Release|x64 + {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x64 Setup.ActiveCfg = Release|x64 + {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x86 Setup.ActiveCfg = Release|Any CPU {E796E337-DE78-4303-8614-9A590862EE95}.All|Win32.ActiveCfg = Release|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.All|Win32.Build.0 = Release|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.All|x64.ActiveCfg = Release|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.All|x64.Build.0 = Release|Win32 - {E796E337-DE78-4303-8614-9A590862EE95}.All|x86.ActiveCfg = Release|Win32 + {E796E337-DE78-4303-8614-9A590862EE95}.All|x64 Setup.ActiveCfg = Release|Win32 + {E796E337-DE78-4303-8614-9A590862EE95}.All|x64 Setup.Build.0 = Release|Win32 + {E796E337-DE78-4303-8614-9A590862EE95}.All|x86 Setup.ActiveCfg = Release|Win32 + {E796E337-DE78-4303-8614-9A590862EE95}.All|x86 Setup.Build.0 = Release|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.Debug|Win32.ActiveCfg = Debug|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.Debug|Win32.Build.0 = Debug|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.Debug|x64.ActiveCfg = Debug|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.Debug|x64.Build.0 = Debug|Win32 - {E796E337-DE78-4303-8614-9A590862EE95}.Debug|x86.ActiveCfg = Debug|Win32 + {E796E337-DE78-4303-8614-9A590862EE95}.Debug|x64 Setup.ActiveCfg = Debug|Win32 + {E796E337-DE78-4303-8614-9A590862EE95}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.Release|Win32.ActiveCfg = Release|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.Release|Win32.Build.0 = Release|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.Release|x64.ActiveCfg = Release|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.Release|x64.Build.0 = Release|Win32 - {E796E337-DE78-4303-8614-9A590862EE95}.Release|x86.ActiveCfg = Release|Win32 + {E796E337-DE78-4303-8614-9A590862EE95}.Release|x64 Setup.ActiveCfg = Release|Win32 + {E796E337-DE78-4303-8614-9A590862EE95}.Release|x86 Setup.ActiveCfg = Release|Win32 {419C8F80-D858-4B48-A25C-AF4007608137}.All|Win32.ActiveCfg = Release|x64 {419C8F80-D858-4B48-A25C-AF4007608137}.All|x64.ActiveCfg = Release|x64 {419C8F80-D858-4B48-A25C-AF4007608137}.All|x64.Build.0 = Release|x64 - {419C8F80-D858-4B48-A25C-AF4007608137}.All|x86.ActiveCfg = Release|x64 + {419C8F80-D858-4B48-A25C-AF4007608137}.All|x64 Setup.ActiveCfg = Release|x64 + {419C8F80-D858-4B48-A25C-AF4007608137}.All|x64 Setup.Build.0 = Release|x64 + {419C8F80-D858-4B48-A25C-AF4007608137}.All|x86 Setup.ActiveCfg = Release|x64 {419C8F80-D858-4B48-A25C-AF4007608137}.Debug|Win32.ActiveCfg = Debug|Win32 {419C8F80-D858-4B48-A25C-AF4007608137}.Debug|Win32.Build.0 = Debug|Win32 {419C8F80-D858-4B48-A25C-AF4007608137}.Debug|x64.ActiveCfg = Debug|x64 {419C8F80-D858-4B48-A25C-AF4007608137}.Debug|x64.Build.0 = Debug|x64 - {419C8F80-D858-4B48-A25C-AF4007608137}.Debug|x86.ActiveCfg = Debug|x64 + {419C8F80-D858-4B48-A25C-AF4007608137}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {419C8F80-D858-4B48-A25C-AF4007608137}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {419C8F80-D858-4B48-A25C-AF4007608137}.Release|Win32.ActiveCfg = Release|Win32 {419C8F80-D858-4B48-A25C-AF4007608137}.Release|Win32.Build.0 = Release|Win32 {419C8F80-D858-4B48-A25C-AF4007608137}.Release|x64.ActiveCfg = Release|x64 {419C8F80-D858-4B48-A25C-AF4007608137}.Release|x64.Build.0 = Release|x64 - {419C8F80-D858-4B48-A25C-AF4007608137}.Release|x86.ActiveCfg = Release|x64 + {419C8F80-D858-4B48-A25C-AF4007608137}.Release|x64 Setup.ActiveCfg = Release|x64 + {419C8F80-D858-4B48-A25C-AF4007608137}.Release|x86 Setup.ActiveCfg = Release|Win32 {B3F424EC-3D8F-417C-B244-3919D5E1A577}.All|Win32.ActiveCfg = Release|x64 {B3F424EC-3D8F-417C-B244-3919D5E1A577}.All|x64.ActiveCfg = Release|x64 {B3F424EC-3D8F-417C-B244-3919D5E1A577}.All|x64.Build.0 = Release|x64 - {B3F424EC-3D8F-417C-B244-3919D5E1A577}.All|x86.ActiveCfg = Release|x64 + {B3F424EC-3D8F-417C-B244-3919D5E1A577}.All|x64 Setup.ActiveCfg = Release|x64 + {B3F424EC-3D8F-417C-B244-3919D5E1A577}.All|x64 Setup.Build.0 = Release|x64 + {B3F424EC-3D8F-417C-B244-3919D5E1A577}.All|x86 Setup.ActiveCfg = Release|x64 {B3F424EC-3D8F-417C-B244-3919D5E1A577}.Debug|Win32.ActiveCfg = Debug|Win32 {B3F424EC-3D8F-417C-B244-3919D5E1A577}.Debug|Win32.Build.0 = Debug|Win32 {B3F424EC-3D8F-417C-B244-3919D5E1A577}.Debug|x64.ActiveCfg = Debug|x64 {B3F424EC-3D8F-417C-B244-3919D5E1A577}.Debug|x64.Build.0 = Debug|x64 - {B3F424EC-3D8F-417C-B244-3919D5E1A577}.Debug|x86.ActiveCfg = Debug|x64 + {B3F424EC-3D8F-417C-B244-3919D5E1A577}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {B3F424EC-3D8F-417C-B244-3919D5E1A577}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {B3F424EC-3D8F-417C-B244-3919D5E1A577}.Release|Win32.ActiveCfg = Release|Win32 {B3F424EC-3D8F-417C-B244-3919D5E1A577}.Release|Win32.Build.0 = Release|Win32 {B3F424EC-3D8F-417C-B244-3919D5E1A577}.Release|x64.ActiveCfg = Release|x64 {B3F424EC-3D8F-417C-B244-3919D5E1A577}.Release|x64.Build.0 = Release|x64 - {B3F424EC-3D8F-417C-B244-3919D5E1A577}.Release|x86.ActiveCfg = Release|x64 + {B3F424EC-3D8F-417C-B244-3919D5E1A577}.Release|x64 Setup.ActiveCfg = Release|x64 + {B3F424EC-3D8F-417C-B244-3919D5E1A577}.Release|x86 Setup.ActiveCfg = Release|Win32 {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.All|Win32.ActiveCfg = Release|x64 {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.All|x64.ActiveCfg = Release|x64 {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.All|x64.Build.0 = Release|x64 - {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.All|x86.ActiveCfg = Release|x64 + {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.All|x64 Setup.ActiveCfg = Release|x64 + {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.All|x64 Setup.Build.0 = Release|x64 + {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.All|x86 Setup.ActiveCfg = Release|x64 {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Debug|Win32.ActiveCfg = Debug|Win32 {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Debug|Win32.Build.0 = Debug|Win32 {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Debug|x64.ActiveCfg = Debug|x64 {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Debug|x64.Build.0 = Debug|x64 - {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Debug|x86.ActiveCfg = Debug|x64 + {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Release|Win32.ActiveCfg = Release|Win32 {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Release|Win32.Build.0 = Release|Win32 {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Release|x64.ActiveCfg = Release|x64 {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Release|x64.Build.0 = Release|x64 - {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Release|x86.ActiveCfg = Release|x64 + {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Release|x64 Setup.ActiveCfg = Release|x64 + {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Release|x86 Setup.ActiveCfg = Release|Win32 {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.All|Win32.ActiveCfg = Release|x64 {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.All|x64.ActiveCfg = Release|x64 {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.All|x64.Build.0 = Release|x64 - {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.All|x86.ActiveCfg = Release|x64 + {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.All|x64 Setup.ActiveCfg = Release|x64 + {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.All|x64 Setup.Build.0 = Release|x64 + {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.All|x86 Setup.ActiveCfg = Release|x64 {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Debug|Win32.ActiveCfg = Debug|Win32 {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Debug|Win32.Build.0 = Debug|Win32 {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Debug|x64.ActiveCfg = Debug|x64 {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Debug|x64.Build.0 = Debug|x64 - {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Debug|x86.ActiveCfg = Debug|x64 + {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Release|Win32.ActiveCfg = Release|Win32 {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Release|Win32.Build.0 = Release|Win32 {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Release|x64.ActiveCfg = Release|x64 {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Release|x64.Build.0 = Release|x64 - {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Release|x86.ActiveCfg = Release|x64 + {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Release|x64 Setup.ActiveCfg = Release|x64 + {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Release|x86 Setup.ActiveCfg = Release|Win32 {0B6C905B-142E-4999-B39D-92FF7951E921}.All|Win32.ActiveCfg = Release|x64 {0B6C905B-142E-4999-B39D-92FF7951E921}.All|x64.ActiveCfg = Release|x64 {0B6C905B-142E-4999-B39D-92FF7951E921}.All|x64.Build.0 = Release|x64 - {0B6C905B-142E-4999-B39D-92FF7951E921}.All|x86.ActiveCfg = Release|x64 + {0B6C905B-142E-4999-B39D-92FF7951E921}.All|x64 Setup.ActiveCfg = Release|x64 + {0B6C905B-142E-4999-B39D-92FF7951E921}.All|x64 Setup.Build.0 = Release|x64 + {0B6C905B-142E-4999-B39D-92FF7951E921}.All|x86 Setup.ActiveCfg = Release|x64 {0B6C905B-142E-4999-B39D-92FF7951E921}.Debug|Win32.ActiveCfg = Debug|Win32 {0B6C905B-142E-4999-B39D-92FF7951E921}.Debug|Win32.Build.0 = Debug|Win32 {0B6C905B-142E-4999-B39D-92FF7951E921}.Debug|x64.ActiveCfg = Debug|x64 {0B6C905B-142E-4999-B39D-92FF7951E921}.Debug|x64.Build.0 = Debug|x64 - {0B6C905B-142E-4999-B39D-92FF7951E921}.Debug|x86.ActiveCfg = Debug|x64 + {0B6C905B-142E-4999-B39D-92FF7951E921}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {0B6C905B-142E-4999-B39D-92FF7951E921}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {0B6C905B-142E-4999-B39D-92FF7951E921}.Release|Win32.ActiveCfg = Release|Win32 {0B6C905B-142E-4999-B39D-92FF7951E921}.Release|Win32.Build.0 = Release|Win32 {0B6C905B-142E-4999-B39D-92FF7951E921}.Release|x64.ActiveCfg = Release|x64 {0B6C905B-142E-4999-B39D-92FF7951E921}.Release|x64.Build.0 = Release|x64 - {0B6C905B-142E-4999-B39D-92FF7951E921}.Release|x86.ActiveCfg = Release|x64 + {0B6C905B-142E-4999-B39D-92FF7951E921}.Release|x64 Setup.ActiveCfg = Release|x64 + {0B6C905B-142E-4999-B39D-92FF7951E921}.Release|x86 Setup.ActiveCfg = Release|Win32 {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.All|Win32.ActiveCfg = Release|x64 {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.All|x64.ActiveCfg = Release|x64 {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.All|x64.Build.0 = Release|x64 - {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.All|x86.ActiveCfg = Release|x64 + {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.All|x64 Setup.ActiveCfg = Release|x64 + {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.All|x64 Setup.Build.0 = Release|x64 + {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.All|x86 Setup.ActiveCfg = Release|x64 {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Debug|Win32.ActiveCfg = Debug|Win32 {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Debug|Win32.Build.0 = Debug|Win32 {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Debug|x64.ActiveCfg = Debug|x64 {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Debug|x64.Build.0 = Debug|x64 - {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Debug|x86.ActiveCfg = Debug|x64 + {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Release|Win32.ActiveCfg = Release|Win32 {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Release|Win32.Build.0 = Release|Win32 {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Release|x64.ActiveCfg = Release|x64 {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Release|x64.Build.0 = Release|x64 - {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Release|x86.ActiveCfg = Release|x64 + {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Release|x64 Setup.ActiveCfg = Release|x64 + {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Release|x86 Setup.ActiveCfg = Release|Win32 {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.All|Win32.ActiveCfg = Release|x64 {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.All|x64.ActiveCfg = Release|x64 {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.All|x64.Build.0 = Release|x64 - {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.All|x86.ActiveCfg = Release|x64 + {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.All|x64 Setup.ActiveCfg = Release|x64 + {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.All|x64 Setup.Build.0 = Release|x64 + {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.All|x86 Setup.ActiveCfg = Release|x64 {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Debug|Win32.ActiveCfg = Debug|Win32 {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Debug|Win32.Build.0 = Debug|Win32 {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Debug|x64.ActiveCfg = Debug|x64 {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Debug|x64.Build.0 = Debug|x64 - {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Debug|x86.ActiveCfg = Debug|x64 + {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Release|Win32.ActiveCfg = Release|Win32 {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Release|Win32.Build.0 = Release|Win32 {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Release|x64.ActiveCfg = Release|x64 {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Release|x64.Build.0 = Release|x64 - {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Release|x86.ActiveCfg = Release|x64 + {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Release|x64 Setup.ActiveCfg = Release|x64 + {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Release|x86 Setup.ActiveCfg = Release|Win32 {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.All|Win32.ActiveCfg = Release|x64 {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.All|x64.ActiveCfg = Release|x64 {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.All|x64.Build.0 = Release|x64 - {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.All|x86.ActiveCfg = Release|x64 + {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.All|x64 Setup.ActiveCfg = Release|x64 + {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.All|x64 Setup.Build.0 = Release|x64 + {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.All|x86 Setup.ActiveCfg = Release|x64 {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Debug|Win32.ActiveCfg = Debug|Win32 {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Debug|Win32.Build.0 = Debug|Win32 {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Debug|x64.ActiveCfg = Debug|x64 {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Debug|x64.Build.0 = Debug|x64 - {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Debug|x86.ActiveCfg = Debug|x64 + {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Release|Win32.ActiveCfg = Release|Win32 {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Release|Win32.Build.0 = Release|Win32 {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Release|x64.ActiveCfg = Release|x64 {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Release|x64.Build.0 = Release|x64 - {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Release|x86.ActiveCfg = Release|x64 + {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Release|x64 Setup.ActiveCfg = Release|x64 + {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Release|x86 Setup.ActiveCfg = Release|Win32 {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.All|Win32.ActiveCfg = Release|x64 {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.All|x64.ActiveCfg = Release|x64 {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.All|x64.Build.0 = Release|x64 - {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.All|x86.ActiveCfg = Release|x64 + {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.All|x64 Setup.ActiveCfg = Release|x64 + {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.All|x64 Setup.Build.0 = Release|x64 + {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.All|x86 Setup.ActiveCfg = Release|x64 {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Debug|Win32.ActiveCfg = Debug|Win32 {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Debug|Win32.Build.0 = Debug|Win32 {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Debug|x64.ActiveCfg = Debug|x64 {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Debug|x64.Build.0 = Debug|x64 - {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Debug|x86.ActiveCfg = Debug|x64 + {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Release|Win32.ActiveCfg = Release|Win32 {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Release|Win32.Build.0 = Release|Win32 {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Release|x64.ActiveCfg = Release|x64 {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Release|x64.Build.0 = Release|x64 - {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Release|x86.ActiveCfg = Release|x64 + {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Release|x64 Setup.ActiveCfg = Release|x64 + {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Release|x86 Setup.ActiveCfg = Release|Win32 {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|Win32.ActiveCfg = Release|x64 {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|x64.ActiveCfg = Release|x64 {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|x64.Build.0 = Release|x64 - {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|x86.ActiveCfg = Release|x64 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|x64 Setup.ActiveCfg = Release|x64 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|x64 Setup.Build.0 = Release|x64 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|x86 Setup.ActiveCfg = Release|x64 {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|Win32.ActiveCfg = Debug|Win32 {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|Win32.Build.0 = Debug|Win32 {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|x64.ActiveCfg = Debug|x64 {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|x64.Build.0 = Debug|x64 - {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|x86.ActiveCfg = Debug|x64 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|Win32.ActiveCfg = Release|Win32 {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|Win32.Build.0 = Release|Win32 {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|x64.ActiveCfg = Release|x64 {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|x64.Build.0 = Release|x64 - {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|x86.ActiveCfg = Release|x64 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|x64 Setup.ActiveCfg = Release|x64 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|x86 Setup.ActiveCfg = Release|Win32 {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|Win32.ActiveCfg = Release|x64 {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|x64.ActiveCfg = Release|x64 {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|x64.Build.0 = Release|x64 - {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|x86.ActiveCfg = Release|x64 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|x64 Setup.ActiveCfg = Release|x64 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|x64 Setup.Build.0 = Release|x64 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|x86 Setup.ActiveCfg = Release|x64 {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|Win32.ActiveCfg = Debug|Win32 {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|Win32.Build.0 = Debug|Win32 {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|x64.ActiveCfg = Debug|x64 {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|x64.Build.0 = Debug|x64 - {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|x86.ActiveCfg = Debug|x64 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|Win32.ActiveCfg = Release|Win32 {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|Win32.Build.0 = Release|Win32 {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|x64.ActiveCfg = Release|x64 {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|x64.Build.0 = Release|x64 - {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|x86.ActiveCfg = Release|x64 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|x64 Setup.ActiveCfg = Release|x64 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|x86 Setup.ActiveCfg = Release|Win32 {E972C52F-9E85-4D65-B19C-031E511E9DB4}.All|Win32.ActiveCfg = Release_WM5_PPC_ARM|x64 {E972C52F-9E85-4D65-B19C-031E511E9DB4}.All|x64.ActiveCfg = Release_WM5_PPC_ARM|x64 {E972C52F-9E85-4D65-B19C-031E511E9DB4}.All|x64.Build.0 = Release_WM5_PPC_ARM|x64 - {E972C52F-9E85-4D65-B19C-031E511E9DB4}.All|x86.ActiveCfg = Release_WM5_PPC_ARM|x64 + {E972C52F-9E85-4D65-B19C-031E511E9DB4}.All|x64 Setup.ActiveCfg = Release_WM5_PPC_ARM|x64 + {E972C52F-9E85-4D65-B19C-031E511E9DB4}.All|x64 Setup.Build.0 = Release_WM5_PPC_ARM|x64 + {E972C52F-9E85-4D65-B19C-031E511E9DB4}.All|x86 Setup.ActiveCfg = Release_WM5_PPC_ARM|x64 {E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|Win32.ActiveCfg = Debug|Win32 {E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|Win32.Build.0 = Debug|Win32 {E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|x64.ActiveCfg = Debug|x64 {E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|x64.Build.0 = Debug|x64 - {E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|x86.ActiveCfg = Debug|x64 + {E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|Win32.ActiveCfg = Release|Win32 {E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|Win32.Build.0 = Release|Win32 {E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|x64.ActiveCfg = Release|x64 {E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|x64.Build.0 = Release|x64 - {E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|x86.ActiveCfg = Release|x64 + {E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|x64 Setup.ActiveCfg = Release|x64 + {E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|x86 Setup.ActiveCfg = Release|Win32 {03207781-0D1C-4DB3-A71D-45C608F28DBD}.All|Win32.ActiveCfg = Release_Static_SSE|x64 {03207781-0D1C-4DB3-A71D-45C608F28DBD}.All|x64.ActiveCfg = Release_Static_SSE|x64 {03207781-0D1C-4DB3-A71D-45C608F28DBD}.All|x64.Build.0 = Release_Static_SSE|x64 - {03207781-0D1C-4DB3-A71D-45C608F28DBD}.All|x86.ActiveCfg = Release|x64 + {03207781-0D1C-4DB3-A71D-45C608F28DBD}.All|x64 Setup.ActiveCfg = Release_Static_SSE|x64 + {03207781-0D1C-4DB3-A71D-45C608F28DBD}.All|x64 Setup.Build.0 = Release_Static_SSE|x64 + {03207781-0D1C-4DB3-A71D-45C608F28DBD}.All|x86 Setup.ActiveCfg = Release_Static_SSE|x64 {03207781-0D1C-4DB3-A71D-45C608F28DBD}.Debug|Win32.ActiveCfg = Debug|Win32 {03207781-0D1C-4DB3-A71D-45C608F28DBD}.Debug|Win32.Build.0 = Debug|Win32 {03207781-0D1C-4DB3-A71D-45C608F28DBD}.Debug|x64.ActiveCfg = Debug|x64 {03207781-0D1C-4DB3-A71D-45C608F28DBD}.Debug|x64.Build.0 = Debug|x64 - {03207781-0D1C-4DB3-A71D-45C608F28DBD}.Debug|x86.ActiveCfg = Debug|x64 + {03207781-0D1C-4DB3-A71D-45C608F28DBD}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {03207781-0D1C-4DB3-A71D-45C608F28DBD}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release|Win32.ActiveCfg = Release|Win32 {03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release|Win32.Build.0 = Release|Win32 {03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release|x64.ActiveCfg = Release|x64 {03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release|x64.Build.0 = Release|x64 - {03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release|x86.ActiveCfg = Release|x64 + {03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release|x64 Setup.ActiveCfg = Release|x64 + {03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release|x86 Setup.ActiveCfg = Release|Win32 {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.All|Win32.ActiveCfg = Release|x64 {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.All|x64.ActiveCfg = Release|x64 {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.All|x64.Build.0 = Release|x64 - {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.All|x86.ActiveCfg = Release|x64 + {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.All|x64 Setup.ActiveCfg = Release|x64 + {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.All|x64 Setup.Build.0 = Release|x64 + {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.All|x86 Setup.ActiveCfg = Release|x64 {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Debug|Win32.ActiveCfg = Debug|Win32 {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Debug|Win32.Build.0 = Debug|Win32 {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Debug|x64.ActiveCfg = Debug|x64 {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Debug|x64.Build.0 = Debug|x64 - {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Debug|x86.ActiveCfg = Debug|x64 + {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Release|Win32.ActiveCfg = Release|Win32 {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Release|Win32.Build.0 = Release|Win32 {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Release|x64.ActiveCfg = Release|x64 {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Release|x64.Build.0 = Release|x64 - {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Release|x86.ActiveCfg = Release|x64 + {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Release|x64 Setup.ActiveCfg = Release|x64 + {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Release|x86 Setup.ActiveCfg = Release|Win32 {D0B36172-CD76-454A-9B89-990025266C2A}.All|Win32.ActiveCfg = Release|x64 {D0B36172-CD76-454A-9B89-990025266C2A}.All|x64.ActiveCfg = Release|x64 {D0B36172-CD76-454A-9B89-990025266C2A}.All|x64.Build.0 = Release|x64 - {D0B36172-CD76-454A-9B89-990025266C2A}.All|x86.ActiveCfg = Release|x64 + {D0B36172-CD76-454A-9B89-990025266C2A}.All|x64 Setup.ActiveCfg = Release|x64 + {D0B36172-CD76-454A-9B89-990025266C2A}.All|x64 Setup.Build.0 = Release|x64 + {D0B36172-CD76-454A-9B89-990025266C2A}.All|x86 Setup.ActiveCfg = Release|x64 {D0B36172-CD76-454A-9B89-990025266C2A}.Debug|Win32.ActiveCfg = Debug|Win32 {D0B36172-CD76-454A-9B89-990025266C2A}.Debug|Win32.Build.0 = Debug|Win32 {D0B36172-CD76-454A-9B89-990025266C2A}.Debug|x64.ActiveCfg = Debug|x64 {D0B36172-CD76-454A-9B89-990025266C2A}.Debug|x64.Build.0 = Debug|x64 - {D0B36172-CD76-454A-9B89-990025266C2A}.Debug|x86.ActiveCfg = Debug|x64 + {D0B36172-CD76-454A-9B89-990025266C2A}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {D0B36172-CD76-454A-9B89-990025266C2A}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {D0B36172-CD76-454A-9B89-990025266C2A}.Release|Win32.ActiveCfg = Release|Win32 {D0B36172-CD76-454A-9B89-990025266C2A}.Release|Win32.Build.0 = Release|Win32 {D0B36172-CD76-454A-9B89-990025266C2A}.Release|x64.ActiveCfg = Release|x64 {D0B36172-CD76-454A-9B89-990025266C2A}.Release|x64.Build.0 = Release|x64 - {D0B36172-CD76-454A-9B89-990025266C2A}.Release|x86.ActiveCfg = Release|x64 + {D0B36172-CD76-454A-9B89-990025266C2A}.Release|x64 Setup.ActiveCfg = Release|x64 + {D0B36172-CD76-454A-9B89-990025266C2A}.Release|x86 Setup.ActiveCfg = Release|Win32 {05C9FB27-480E-4D53-B3B7-6338E2526666}.All|Win32.ActiveCfg = Release|Win32 {05C9FB27-480E-4D53-B3B7-6338E2526666}.All|Win32.Build.0 = Release|Win32 {05C9FB27-480E-4D53-B3B7-6338E2526666}.All|x64.ActiveCfg = Release|Win32 - {05C9FB27-480E-4D53-B3B7-6338E2526666}.All|x86.ActiveCfg = Release|Win32 + {05C9FB27-480E-4D53-B3B7-6338E2526666}.All|x64 Setup.ActiveCfg = Release|Win32 + {05C9FB27-480E-4D53-B3B7-6338E2526666}.All|x86 Setup.ActiveCfg = Release|Win32 + {05C9FB27-480E-4D53-B3B7-6338E2526666}.All|x86 Setup.Build.0 = Release|Win32 {05C9FB27-480E-4D53-B3B7-6338E2526666}.Debug|Win32.ActiveCfg = Debug|Win32 {05C9FB27-480E-4D53-B3B7-6338E2526666}.Debug|x64.ActiveCfg = Debug|Win32 - {05C9FB27-480E-4D53-B3B7-6338E2526666}.Debug|x86.ActiveCfg = Debug|Win32 + {05C9FB27-480E-4D53-B3B7-6338E2526666}.Debug|x64 Setup.ActiveCfg = Debug|Win32 + {05C9FB27-480E-4D53-B3B7-6338E2526666}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {05C9FB27-480E-4D53-B3B7-6338E2526666}.Release|Win32.ActiveCfg = Release|Win32 {05C9FB27-480E-4D53-B3B7-6338E2526666}.Release|x64.ActiveCfg = Release|Win32 - {05C9FB27-480E-4D53-B3B7-6338E2526666}.Release|x86.ActiveCfg = Release|Win32 + {05C9FB27-480E-4D53-B3B7-6338E2526666}.Release|x64 Setup.ActiveCfg = Release|Win32 + {05C9FB27-480E-4D53-B3B7-6338E2526666}.Release|x86 Setup.ActiveCfg = Release|Win32 {CC1DD008-9406-448D-A0AD-33C3186CFADB}.All|Win32.ActiveCfg = Release|Win32 {CC1DD008-9406-448D-A0AD-33C3186CFADB}.All|x64.ActiveCfg = Release|Win32 - {CC1DD008-9406-448D-A0AD-33C3186CFADB}.All|x86.ActiveCfg = Release|x64 + {CC1DD008-9406-448D-A0AD-33C3186CFADB}.All|x64 Setup.ActiveCfg = Release|Win32 + {CC1DD008-9406-448D-A0AD-33C3186CFADB}.All|x86 Setup.ActiveCfg = Release|Win32 {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Debug|Win32.ActiveCfg = Debug|Win32 {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Debug|x64.ActiveCfg = Debug|x64 - {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Debug|x86.ActiveCfg = Debug|x64 + {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Release|Win32.ActiveCfg = Release|Win32 {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Release|x64.ActiveCfg = Release|x64 - {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Release|x86.ActiveCfg = Release|x64 + {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Release|x64 Setup.ActiveCfg = Release|x64 + {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Release|x86 Setup.ActiveCfg = Release|Win32 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.ActiveCfg = All|Win32 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.Build.0 = All|Win32 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|x64.ActiveCfg = All|Win32 - {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|x86.ActiveCfg = All|Win32 + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|x64 Setup.ActiveCfg = All|Win32 + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|x86 Setup.ActiveCfg = All|Win32 + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|x86 Setup.Build.0 = All|Win32 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|Win32.ActiveCfg = All|Win32 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|Win32.Build.0 = All|Win32 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|x64.ActiveCfg = All|Win32 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|x64.Build.0 = All|Win32 - {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|x86.ActiveCfg = All|Win32 + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|x64 Setup.ActiveCfg = All|Win32 + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|x86 Setup.ActiveCfg = All|Win32 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|Win32.ActiveCfg = All|Win32 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|Win32.Build.0 = All|Win32 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|x64.ActiveCfg = All|Win32 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|x64.Build.0 = All|Win32 - {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|x86.ActiveCfg = All|Win32 + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|x64 Setup.ActiveCfg = All|Win32 + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|x86 Setup.ActiveCfg = All|Win32 {329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|Win32.ActiveCfg = All|Win32 {329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|Win32.Build.0 = All|Win32 {329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|x64.ActiveCfg = All|Win32 - {329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|x86.ActiveCfg = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|x64 Setup.ActiveCfg = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|x86 Setup.ActiveCfg = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|x86 Setup.Build.0 = All|Win32 {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|Win32.ActiveCfg = All|Win32 {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|Win32.Build.0 = All|Win32 {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|x64.ActiveCfg = All|Win32 {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|x64.Build.0 = All|Win32 - {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|x86.ActiveCfg = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|x64 Setup.ActiveCfg = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|x86 Setup.ActiveCfg = All|Win32 {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|Win32.ActiveCfg = All|Win32 {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|Win32.Build.0 = All|Win32 {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|x64.ActiveCfg = All|Win32 {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|x64.Build.0 = All|Win32 - {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|x86.ActiveCfg = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|x64 Setup.ActiveCfg = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|x86 Setup.ActiveCfg = All|Win32 {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.All|Win32.ActiveCfg = Release|x64 {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.All|x64.ActiveCfg = Release|x64 {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.All|x64.Build.0 = Release|x64 - {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.All|x86.ActiveCfg = Release|x64 + {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.All|x64 Setup.ActiveCfg = Release|x64 + {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.All|x64 Setup.Build.0 = Release|x64 + {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.All|x86 Setup.ActiveCfg = Release|x64 {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.Debug|Win32.ActiveCfg = Debug|Win32 {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.Debug|x64.ActiveCfg = Debug|x64 - {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.Debug|x86.ActiveCfg = Debug|x64 + {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.Release|Win32.ActiveCfg = Release|Win32 {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.Release|x64.ActiveCfg = Release|x64 - {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.Release|x86.ActiveCfg = Release|x64 + {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.Release|x64 Setup.ActiveCfg = Release|x64 + {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.Release|x86 Setup.ActiveCfg = Release|Win32 {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.All|Win32.ActiveCfg = Release|Win32 {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.All|Win32.Build.0 = Release|Win32 {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.All|x64.ActiveCfg = Release|Win32 - {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.All|x86.ActiveCfg = Release|Win32 + {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.All|x64 Setup.ActiveCfg = Release|Win32 + {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.All|x86 Setup.ActiveCfg = Release|Win32 + {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.All|x86 Setup.Build.0 = Release|Win32 {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.Debug|Win32.ActiveCfg = Debug|Win32 {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.Debug|x64.ActiveCfg = Debug|Win32 - {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.Debug|x86.ActiveCfg = Debug|Win32 + {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.Debug|x64 Setup.ActiveCfg = Debug|Win32 + {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.Release|Win32.ActiveCfg = Release|Win32 {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.Release|x64.ActiveCfg = Release|Win32 - {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.Release|x86.ActiveCfg = Release|Win32 + {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.Release|x64 Setup.ActiveCfg = Release|Win32 + {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.Release|x86 Setup.ActiveCfg = Release|Win32 {1F0A8A77-E661-418F-BB92-82172AE43803}.All|Win32.ActiveCfg = Release|Win32 {1F0A8A77-E661-418F-BB92-82172AE43803}.All|x64.ActiveCfg = Release|Win32 - {1F0A8A77-E661-418F-BB92-82172AE43803}.All|x86.ActiveCfg = Release|Win32 + {1F0A8A77-E661-418F-BB92-82172AE43803}.All|x64 Setup.ActiveCfg = Release|Win32 + {1F0A8A77-E661-418F-BB92-82172AE43803}.All|x86 Setup.ActiveCfg = Release|Win32 {1F0A8A77-E661-418F-BB92-82172AE43803}.Debug|Win32.ActiveCfg = Debug|Win32 {1F0A8A77-E661-418F-BB92-82172AE43803}.Debug|x64.ActiveCfg = Debug|Win32 - {1F0A8A77-E661-418F-BB92-82172AE43803}.Debug|x86.ActiveCfg = Debug|Win32 + {1F0A8A77-E661-418F-BB92-82172AE43803}.Debug|x64 Setup.ActiveCfg = Debug|Win32 + {1F0A8A77-E661-418F-BB92-82172AE43803}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {1F0A8A77-E661-418F-BB92-82172AE43803}.Release|Win32.ActiveCfg = Release|Win32 {1F0A8A77-E661-418F-BB92-82172AE43803}.Release|x64.ActiveCfg = Release|Win32 - {1F0A8A77-E661-418F-BB92-82172AE43803}.Release|x86.ActiveCfg = Release|Win32 + {1F0A8A77-E661-418F-BB92-82172AE43803}.Release|x64 Setup.ActiveCfg = Release|Win32 + {1F0A8A77-E661-418F-BB92-82172AE43803}.Release|x86 Setup.ActiveCfg = Release|Win32 {4F5C9D55-98EF-4256-8311-32D7BD360406}.All|Win32.ActiveCfg = Release|Win32 {4F5C9D55-98EF-4256-8311-32D7BD360406}.All|Win32.Build.0 = Release|Win32 {4F5C9D55-98EF-4256-8311-32D7BD360406}.All|x64.ActiveCfg = Release|Win32 {4F5C9D55-98EF-4256-8311-32D7BD360406}.All|x64.Build.0 = Release|Win32 - {4F5C9D55-98EF-4256-8311-32D7BD360406}.All|x86.ActiveCfg = Release|Win32 + {4F5C9D55-98EF-4256-8311-32D7BD360406}.All|x64 Setup.ActiveCfg = Release|Win32 + {4F5C9D55-98EF-4256-8311-32D7BD360406}.All|x64 Setup.Build.0 = Release|Win32 + {4F5C9D55-98EF-4256-8311-32D7BD360406}.All|x86 Setup.ActiveCfg = Release|Win32 + {4F5C9D55-98EF-4256-8311-32D7BD360406}.All|x86 Setup.Build.0 = Release|Win32 {4F5C9D55-98EF-4256-8311-32D7BD360406}.Debug|Win32.ActiveCfg = Debug|Win32 {4F5C9D55-98EF-4256-8311-32D7BD360406}.Debug|Win32.Build.0 = Debug|Win32 {4F5C9D55-98EF-4256-8311-32D7BD360406}.Debug|x64.ActiveCfg = Debug|Win32 {4F5C9D55-98EF-4256-8311-32D7BD360406}.Debug|x64.Build.0 = Debug|Win32 - {4F5C9D55-98EF-4256-8311-32D7BD360406}.Debug|x86.ActiveCfg = Debug|Win32 + {4F5C9D55-98EF-4256-8311-32D7BD360406}.Debug|x64 Setup.ActiveCfg = Debug|Win32 + {4F5C9D55-98EF-4256-8311-32D7BD360406}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {4F5C9D55-98EF-4256-8311-32D7BD360406}.Release|Win32.ActiveCfg = Release|Win32 {4F5C9D55-98EF-4256-8311-32D7BD360406}.Release|Win32.Build.0 = Release|Win32 {4F5C9D55-98EF-4256-8311-32D7BD360406}.Release|x64.ActiveCfg = Release|Win32 {4F5C9D55-98EF-4256-8311-32D7BD360406}.Release|x64.Build.0 = Release|Win32 - {4F5C9D55-98EF-4256-8311-32D7BD360406}.Release|x86.ActiveCfg = Release|Win32 + {4F5C9D55-98EF-4256-8311-32D7BD360406}.Release|x64 Setup.ActiveCfg = Release|Win32 + {4F5C9D55-98EF-4256-8311-32D7BD360406}.Release|x86 Setup.ActiveCfg = Release|Win32 {E10571C4-E7F4-4608-B5F2-B22E7EB95400}.All|Win32.ActiveCfg = Release|Win32 {E10571C4-E7F4-4608-B5F2-B22E7EB95400}.All|x64.ActiveCfg = Release|Win32 - {E10571C4-E7F4-4608-B5F2-B22E7EB95400}.All|x86.ActiveCfg = Release|Win32 + {E10571C4-E7F4-4608-B5F2-B22E7EB95400}.All|x64 Setup.ActiveCfg = Release|Win32 + {E10571C4-E7F4-4608-B5F2-B22E7EB95400}.All|x86 Setup.ActiveCfg = Release|Win32 {E10571C4-E7F4-4608-B5F2-B22E7EB95400}.Debug|Win32.ActiveCfg = Debug|Win32 {E10571C4-E7F4-4608-B5F2-B22E7EB95400}.Debug|x64.ActiveCfg = Debug|Win32 - {E10571C4-E7F4-4608-B5F2-B22E7EB95400}.Debug|x86.ActiveCfg = Debug|Win32 + {E10571C4-E7F4-4608-B5F2-B22E7EB95400}.Debug|x64 Setup.ActiveCfg = Debug|Win32 + {E10571C4-E7F4-4608-B5F2-B22E7EB95400}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {E10571C4-E7F4-4608-B5F2-B22E7EB95400}.Release|Win32.ActiveCfg = Release|Win32 {E10571C4-E7F4-4608-B5F2-B22E7EB95400}.Release|x64.ActiveCfg = Release|Win32 - {E10571C4-E7F4-4608-B5F2-B22E7EB95400}.Release|x86.ActiveCfg = Release|Win32 + {E10571C4-E7F4-4608-B5F2-B22E7EB95400}.Release|x64 Setup.ActiveCfg = Release|Win32 + {E10571C4-E7F4-4608-B5F2-B22E7EB95400}.Release|x86 Setup.ActiveCfg = Release|Win32 {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.All|Win32.ActiveCfg = Release|Win32 {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.All|Win32.Build.0 = Release|Win32 {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.All|x64.ActiveCfg = Release|Win32 {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.All|x64.Build.0 = Release|Win32 - {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.All|x86.ActiveCfg = Release|x64 + {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.All|x64 Setup.ActiveCfg = Release|Win32 + {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.All|x64 Setup.Build.0 = Release|Win32 + {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.All|x86 Setup.ActiveCfg = Release|Win32 + {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.All|x86 Setup.Build.0 = Release|Win32 {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Debug|Win32.ActiveCfg = Debug|Win32 {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Debug|Win32.Build.0 = Debug|Win32 {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Debug|x64.ActiveCfg = Debug|x64 {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Debug|x64.Build.0 = Debug|x64 - {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Debug|x86.ActiveCfg = Debug|x64 + {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Release|Win32.ActiveCfg = Release|Win32 {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Release|Win32.Build.0 = Release|Win32 {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Release|x64.ActiveCfg = Release|x64 {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Release|x64.Build.0 = Release|x64 - {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Release|x86.ActiveCfg = Release|x64 + {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Release|x64 Setup.ActiveCfg = Release|x64 + {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Release|x86 Setup.ActiveCfg = Release|Win32 {BA599D0A-4310-4505-91DA-6A6447B3E289}.All|Win32.ActiveCfg = Release|Win32 {BA599D0A-4310-4505-91DA-6A6447B3E289}.All|x64.ActiveCfg = Release|Win32 - {BA599D0A-4310-4505-91DA-6A6447B3E289}.All|x86.ActiveCfg = Release|x64 + {BA599D0A-4310-4505-91DA-6A6447B3E289}.All|x64 Setup.ActiveCfg = Release|Win32 + {BA599D0A-4310-4505-91DA-6A6447B3E289}.All|x86 Setup.ActiveCfg = Release|Win32 {BA599D0A-4310-4505-91DA-6A6447B3E289}.Debug|Win32.ActiveCfg = Debug|Win32 {BA599D0A-4310-4505-91DA-6A6447B3E289}.Debug|x64.ActiveCfg = Debug|x64 - {BA599D0A-4310-4505-91DA-6A6447B3E289}.Debug|x86.ActiveCfg = Debug|x64 + {BA599D0A-4310-4505-91DA-6A6447B3E289}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {BA599D0A-4310-4505-91DA-6A6447B3E289}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {BA599D0A-4310-4505-91DA-6A6447B3E289}.Release|Win32.ActiveCfg = Release|Win32 {BA599D0A-4310-4505-91DA-6A6447B3E289}.Release|x64.ActiveCfg = Release|x64 - {BA599D0A-4310-4505-91DA-6A6447B3E289}.Release|x86.ActiveCfg = Release|x64 + {BA599D0A-4310-4505-91DA-6A6447B3E289}.Release|x64 Setup.ActiveCfg = Release|x64 + {BA599D0A-4310-4505-91DA-6A6447B3E289}.Release|x86 Setup.ActiveCfg = Release|Win32 {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.All|Win32.ActiveCfg = Release|Win32 {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.All|x64.ActiveCfg = Release|Win32 - {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.All|x86.ActiveCfg = Release|x64 + {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.All|x64 Setup.ActiveCfg = Release|Win32 + {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.All|x86 Setup.ActiveCfg = Release|Win32 {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Debug|Win32.ActiveCfg = Debug|Win32 {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Debug|x64.ActiveCfg = Debug|x64 - {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Debug|x86.ActiveCfg = Debug|x64 + {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Release|Win32.ActiveCfg = Release|Win32 {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Release|x64.ActiveCfg = Release|x64 - {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Release|x86.ActiveCfg = Release|x64 + {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Release|x64 Setup.ActiveCfg = Release|x64 + {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Release|x86 Setup.ActiveCfg = Release|Win32 {70564D74-199A-4452-9C60-19ED5F242F0D}.All|Win32.ActiveCfg = Release|x64 {70564D74-199A-4452-9C60-19ED5F242F0D}.All|x64.ActiveCfg = Release|x64 {70564D74-199A-4452-9C60-19ED5F242F0D}.All|x64.Build.0 = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.All|x86.ActiveCfg = Release|x64 + {70564D74-199A-4452-9C60-19ED5F242F0D}.All|x64 Setup.ActiveCfg = Release|x64 + {70564D74-199A-4452-9C60-19ED5F242F0D}.All|x64 Setup.Build.0 = Release|x64 + {70564D74-199A-4452-9C60-19ED5F242F0D}.All|x86 Setup.ActiveCfg = Release|x64 {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|Win32.ActiveCfg = Debug|Win32 {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|Win32.Build.0 = Debug|Win32 {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|x64.ActiveCfg = Debug|x64 {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|x64.Build.0 = Debug|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|x86.ActiveCfg = Debug|x64 + {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|Win32.ActiveCfg = Release|Win32 {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|Win32.Build.0 = Release|Win32 {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|x64.ActiveCfg = Release|x64 {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|x64.Build.0 = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|x86.ActiveCfg = Release|x64 + {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|x64 Setup.ActiveCfg = Release|x64 + {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|x86 Setup.ActiveCfg = Release|Win32 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|Win32.ActiveCfg = Release|x64 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|x64.ActiveCfg = Release|x64 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|x64.Build.0 = Release|x64 - {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|x86.ActiveCfg = Release|x64 + {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|x64 Setup.ActiveCfg = Release|x64 + {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|x64 Setup.Build.0 = Release|x64 + {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|x86 Setup.ActiveCfg = Release|x64 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Debug|Win32.ActiveCfg = Debug|Win32 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Debug|Win32.Build.0 = Debug|Win32 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Debug|x64.ActiveCfg = Debug|x64 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Debug|x64.Build.0 = Debug|x64 - {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Debug|x86.ActiveCfg = Debug|x64 + {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Release|Win32.ActiveCfg = Release|Win32 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Release|Win32.Build.0 = Release|Win32 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Release|x64.ActiveCfg = Release|x64 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Release|x64.Build.0 = Release|x64 - {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Release|x86.ActiveCfg = Release|x64 + {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Release|x64 Setup.ActiveCfg = Release|x64 + {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Release|x86 Setup.ActiveCfg = Release|Win32 {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.All|Win32.ActiveCfg = Release|x64 {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.All|Win32.Build.0 = Release|x64 {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.All|x64.ActiveCfg = Release|x64 {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.All|x64.Build.0 = Release|x64 - {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.All|x86.ActiveCfg = Release|x64 + {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.All|x64 Setup.ActiveCfg = Release|x64 + {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.All|x64 Setup.Build.0 = Release|x64 + {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.All|x86 Setup.ActiveCfg = Release|x64 + {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.All|x86 Setup.Build.0 = Release|x64 {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Debug|Win32.ActiveCfg = Debug|Win32 {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Debug|Win32.Build.0 = Debug|Win32 {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Debug|x64.ActiveCfg = Debug|x64 {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Debug|x64.Build.0 = Debug|x64 - {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Debug|x86.ActiveCfg = Debug|x64 + {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Release|Win32.ActiveCfg = Release|Win32 {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Release|Win32.Build.0 = Release|Win32 {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Release|x64.ActiveCfg = Release|x64 {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Release|x64.Build.0 = Release|x64 - {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Release|x86.ActiveCfg = Release|x64 + {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Release|x64 Setup.ActiveCfg = Release|x64 + {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Release|x86 Setup.ActiveCfg = Release|Win32 {432DB165-1EB2-4781-A9C0-71E62610B20A}.All|Win32.ActiveCfg = Release|x64 {432DB165-1EB2-4781-A9C0-71E62610B20A}.All|x64.ActiveCfg = Release|x64 - {432DB165-1EB2-4781-A9C0-71E62610B20A}.All|x86.ActiveCfg = Release|x64 + {432DB165-1EB2-4781-A9C0-71E62610B20A}.All|x64 Setup.ActiveCfg = Release|x64 + {432DB165-1EB2-4781-A9C0-71E62610B20A}.All|x86 Setup.ActiveCfg = Release|x64 {432DB165-1EB2-4781-A9C0-71E62610B20A}.Debug|Win32.ActiveCfg = Debug|Win32 {432DB165-1EB2-4781-A9C0-71E62610B20A}.Debug|Win32.Build.0 = Debug|Win32 {432DB165-1EB2-4781-A9C0-71E62610B20A}.Debug|x64.ActiveCfg = Debug|x64 {432DB165-1EB2-4781-A9C0-71E62610B20A}.Debug|x64.Build.0 = Debug|x64 - {432DB165-1EB2-4781-A9C0-71E62610B20A}.Debug|x86.ActiveCfg = Debug|x64 + {432DB165-1EB2-4781-A9C0-71E62610B20A}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {432DB165-1EB2-4781-A9C0-71E62610B20A}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {432DB165-1EB2-4781-A9C0-71E62610B20A}.Release|Win32.ActiveCfg = Release|Win32 {432DB165-1EB2-4781-A9C0-71E62610B20A}.Release|Win32.Build.0 = Release|Win32 {432DB165-1EB2-4781-A9C0-71E62610B20A}.Release|x64.ActiveCfg = Release|x64 {432DB165-1EB2-4781-A9C0-71E62610B20A}.Release|x64.Build.0 = Release|x64 - {432DB165-1EB2-4781-A9C0-71E62610B20A}.Release|x86.ActiveCfg = Release|x64 + {432DB165-1EB2-4781-A9C0-71E62610B20A}.Release|x64 Setup.ActiveCfg = Release|x64 + {432DB165-1EB2-4781-A9C0-71E62610B20A}.Release|x86 Setup.ActiveCfg = Release|Win32 {CF70F278-3364-4395-A2E1-23501C9B8AD2}.All|Win32.ActiveCfg = Release|Win32 {CF70F278-3364-4395-A2E1-23501C9B8AD2}.All|Win32.Build.0 = Release|Win32 {CF70F278-3364-4395-A2E1-23501C9B8AD2}.All|x64.ActiveCfg = Release|Win32 - {CF70F278-3364-4395-A2E1-23501C9B8AD2}.All|x86.ActiveCfg = Release|x64 + {CF70F278-3364-4395-A2E1-23501C9B8AD2}.All|x64 Setup.ActiveCfg = Release|Win32 + {CF70F278-3364-4395-A2E1-23501C9B8AD2}.All|x86 Setup.ActiveCfg = Release|Win32 + {CF70F278-3364-4395-A2E1-23501C9B8AD2}.All|x86 Setup.Build.0 = Release|Win32 {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|Win32.ActiveCfg = Debug|Win32 {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|Win32.Build.0 = Debug|Win32 {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|x64.ActiveCfg = Debug|x64 {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|x64.Build.0 = Debug|x64 - {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|x86.ActiveCfg = Debug|x64 + {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|Win32.ActiveCfg = Release|Win32 {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|Win32.Build.0 = Release|Win32 {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|x64.ActiveCfg = Release|x64 {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|x64.Build.0 = Release|x64 - {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|x86.ActiveCfg = Release|x64 + {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|x64 Setup.ActiveCfg = Release|x64 + {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|x86 Setup.ActiveCfg = Release|Win32 {D5C87B19-150D-4EF3-A671-96589BD2D14A}.All|Win32.ActiveCfg = Release|x64 {D5C87B19-150D-4EF3-A671-96589BD2D14A}.All|x64.ActiveCfg = Release|x64 {D5C87B19-150D-4EF3-A671-96589BD2D14A}.All|x64.Build.0 = Release|x64 - {D5C87B19-150D-4EF3-A671-96589BD2D14A}.All|x86.ActiveCfg = Release|x64 + {D5C87B19-150D-4EF3-A671-96589BD2D14A}.All|x64 Setup.ActiveCfg = Release|x64 + {D5C87B19-150D-4EF3-A671-96589BD2D14A}.All|x64 Setup.Build.0 = Release|x64 + {D5C87B19-150D-4EF3-A671-96589BD2D14A}.All|x86 Setup.ActiveCfg = Release|x64 {D5C87B19-150D-4EF3-A671-96589BD2D14A}.Debug|Win32.ActiveCfg = Debug|Win32 {D5C87B19-150D-4EF3-A671-96589BD2D14A}.Debug|Win32.Build.0 = Debug|Win32 {D5C87B19-150D-4EF3-A671-96589BD2D14A}.Debug|x64.ActiveCfg = Debug|x64 {D5C87B19-150D-4EF3-A671-96589BD2D14A}.Debug|x64.Build.0 = Debug|x64 - {D5C87B19-150D-4EF3-A671-96589BD2D14A}.Debug|x86.ActiveCfg = Debug|x64 + {D5C87B19-150D-4EF3-A671-96589BD2D14A}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {D5C87B19-150D-4EF3-A671-96589BD2D14A}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {D5C87B19-150D-4EF3-A671-96589BD2D14A}.Release|Win32.ActiveCfg = Release|Win32 {D5C87B19-150D-4EF3-A671-96589BD2D14A}.Release|Win32.Build.0 = Release|Win32 {D5C87B19-150D-4EF3-A671-96589BD2D14A}.Release|x64.ActiveCfg = Release|x64 {D5C87B19-150D-4EF3-A671-96589BD2D14A}.Release|x64.Build.0 = Release|x64 - {D5C87B19-150D-4EF3-A671-96589BD2D14A}.Release|x86.ActiveCfg = Release|x64 + {D5C87B19-150D-4EF3-A671-96589BD2D14A}.Release|x64 Setup.ActiveCfg = Release|x64 + {D5C87B19-150D-4EF3-A671-96589BD2D14A}.Release|x86 Setup.ActiveCfg = Release|Win32 {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.All|Win32.ActiveCfg = Release|Win32 {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.All|Win32.Build.0 = Release|Win32 {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.All|x64.ActiveCfg = Release|Win32 - {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.All|x86.ActiveCfg = Release|x64 + {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.All|x64 Setup.ActiveCfg = Release|Win32 + {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.All|x86 Setup.ActiveCfg = Release|Win32 + {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.All|x86 Setup.Build.0 = Release|Win32 {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|Win32.ActiveCfg = Debug|Win32 {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|Win32.Build.0 = Debug|Win32 {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|x64.ActiveCfg = Debug|x64 {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|x64.Build.0 = Debug|x64 - {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|x86.ActiveCfg = Debug|x64 + {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|Win32.ActiveCfg = Release|Win32 {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|Win32.Build.0 = Release|Win32 {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|x64.ActiveCfg = Release|x64 {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|x64.Build.0 = Release|x64 - {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|x86.ActiveCfg = Release|x64 + {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|x64 Setup.ActiveCfg = Release|x64 + {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|x86 Setup.ActiveCfg = Release|Win32 {B5A00BFA-6083-4FAE-A097-71642D6473B5}.All|Win32.ActiveCfg = Release|Win32 {B5A00BFA-6083-4FAE-A097-71642D6473B5}.All|Win32.Build.0 = Release|Win32 {B5A00BFA-6083-4FAE-A097-71642D6473B5}.All|x64.ActiveCfg = Release|Win32 - {B5A00BFA-6083-4FAE-A097-71642D6473B5}.All|x86.ActiveCfg = Release|x64 + {B5A00BFA-6083-4FAE-A097-71642D6473B5}.All|x64 Setup.ActiveCfg = Release|Win32 + {B5A00BFA-6083-4FAE-A097-71642D6473B5}.All|x86 Setup.ActiveCfg = Release|Win32 + {B5A00BFA-6083-4FAE-A097-71642D6473B5}.All|x86 Setup.Build.0 = Release|Win32 {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|Win32.ActiveCfg = Debug|Win32 {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|Win32.Build.0 = Debug|Win32 {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|x64.ActiveCfg = Debug|x64 {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|x64.Build.0 = Debug|x64 - {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|x86.ActiveCfg = Debug|x64 + {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|Win32.ActiveCfg = Release|Win32 {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|Win32.Build.0 = Release|Win32 {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|x64.ActiveCfg = Release|x64 {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|x64.Build.0 = Release|x64 - {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|x86.ActiveCfg = Release|x64 + {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|x64 Setup.ActiveCfg = Release|x64 + {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|x86 Setup.ActiveCfg = Release|Win32 {1C320193-46A6-4B34-9C56-8AB584FC1B56}.All|Win32.ActiveCfg = Release|Win32 {1C320193-46A6-4B34-9C56-8AB584FC1B56}.All|Win32.Build.0 = Release|Win32 {1C320193-46A6-4B34-9C56-8AB584FC1B56}.All|x64.ActiveCfg = Release|Win32 - {1C320193-46A6-4B34-9C56-8AB584FC1B56}.All|x86.ActiveCfg = Release|x64 + {1C320193-46A6-4B34-9C56-8AB584FC1B56}.All|x64 Setup.ActiveCfg = Release|Win32 + {1C320193-46A6-4B34-9C56-8AB584FC1B56}.All|x86 Setup.ActiveCfg = Release|Win32 + {1C320193-46A6-4B34-9C56-8AB584FC1B56}.All|x86 Setup.Build.0 = Release|Win32 {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|Win32.ActiveCfg = Debug|Win32 {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|Win32.Build.0 = Debug|Win32 {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|x64.ActiveCfg = Debug|x64 {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|x64.Build.0 = Debug|x64 - {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|x86.ActiveCfg = Debug|x64 + {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|Win32.ActiveCfg = Release|Win32 {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|Win32.Build.0 = Release|Win32 {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|x64.ActiveCfg = Release|x64 {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|x64.Build.0 = Release|x64 - {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|x86.ActiveCfg = Release|x64 + {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|x64 Setup.ActiveCfg = Release|x64 + {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|x86 Setup.ActiveCfg = Release|Win32 {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.All|Win32.ActiveCfg = Release|Win32 {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.All|Win32.Build.0 = Release|Win32 {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.All|x64.ActiveCfg = Release|Win32 - {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.All|x86.ActiveCfg = Release|x64 + {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.All|x64 Setup.ActiveCfg = Release|Win32 + {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.All|x86 Setup.ActiveCfg = Release|Win32 + {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.All|x86 Setup.Build.0 = Release|Win32 {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|Win32.ActiveCfg = Debug|Win32 {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|Win32.Build.0 = Debug|Win32 {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|x64.ActiveCfg = Debug|x64 {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|x64.Build.0 = Debug|x64 - {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|x86.ActiveCfg = Debug|x64 + {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|Win32.ActiveCfg = Release|Win32 {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|Win32.Build.0 = Release|Win32 {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|x64.ActiveCfg = Release|x64 {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|x64.Build.0 = Release|x64 - {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|x86.ActiveCfg = Release|x64 + {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|x64 Setup.ActiveCfg = Release|x64 + {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|x86 Setup.ActiveCfg = Release|Win32 {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.All|Win32.ActiveCfg = Release|Win32 {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.All|Win32.Build.0 = Release|Win32 {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.All|x64.ActiveCfg = Release|Win32 - {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.All|x86.ActiveCfg = Release|x64 + {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.All|x64 Setup.ActiveCfg = Release|Win32 + {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.All|x86 Setup.ActiveCfg = Release|Win32 + {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.All|x86 Setup.Build.0 = Release|Win32 {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|Win32.ActiveCfg = Debug|Win32 {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|Win32.Build.0 = Debug|Win32 {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|x64.ActiveCfg = Debug|x64 {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|x64.Build.0 = Debug|x64 - {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|x86.ActiveCfg = Debug|x64 + {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|Win32.ActiveCfg = Release|Win32 {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|Win32.Build.0 = Release|Win32 {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|x64.ActiveCfg = Release|x64 {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|x64.Build.0 = Release|x64 - {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|x86.ActiveCfg = Release|x64 + {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|x64 Setup.ActiveCfg = Release|x64 + {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|x86 Setup.ActiveCfg = Release|Win32 {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.All|Win32.ActiveCfg = Release|Win32 {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.All|Win32.Build.0 = Release|Win32 {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.All|x64.ActiveCfg = Release|Win32 - {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.All|x86.ActiveCfg = Release|x64 + {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.All|x64 Setup.ActiveCfg = Release|Win32 + {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.All|x86 Setup.ActiveCfg = Release|Win32 + {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.All|x86 Setup.Build.0 = Release|Win32 {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|Win32.ActiveCfg = Debug|Win32 {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|Win32.Build.0 = Debug|Win32 {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|x64.ActiveCfg = Debug|x64 {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|x64.Build.0 = Debug|x64 - {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|x86.ActiveCfg = Debug|x64 + {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|Win32.ActiveCfg = Release|Win32 {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|Win32.Build.0 = Release|Win32 {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|x64.ActiveCfg = Release|x64 {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|x64.Build.0 = Release|x64 - {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|x86.ActiveCfg = Release|x64 + {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|x64 Setup.ActiveCfg = Release|x64 + {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|x86 Setup.ActiveCfg = Release|Win32 {504B3154-7A4F-459D-9877-B951021C3F1F}.All|Win32.ActiveCfg = Release|Win32 {504B3154-7A4F-459D-9877-B951021C3F1F}.All|Win32.Build.0 = Release|Win32 {504B3154-7A4F-459D-9877-B951021C3F1F}.All|x64.ActiveCfg = Release|Win32 - {504B3154-7A4F-459D-9877-B951021C3F1F}.All|x86.ActiveCfg = Release|x64 + {504B3154-7A4F-459D-9877-B951021C3F1F}.All|x64 Setup.ActiveCfg = Release|Win32 + {504B3154-7A4F-459D-9877-B951021C3F1F}.All|x86 Setup.ActiveCfg = Release|Win32 + {504B3154-7A4F-459D-9877-B951021C3F1F}.All|x86 Setup.Build.0 = Release|Win32 {504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|Win32.ActiveCfg = Debug|Win32 {504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|Win32.Build.0 = Debug|Win32 {504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|x64.ActiveCfg = Debug|x64 {504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|x64.Build.0 = Debug|x64 - {504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|x86.ActiveCfg = Debug|x64 + {504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {504B3154-7A4F-459D-9877-B951021C3F1F}.Release|Win32.ActiveCfg = Release|Win32 {504B3154-7A4F-459D-9877-B951021C3F1F}.Release|Win32.Build.0 = Release|Win32 {504B3154-7A4F-459D-9877-B951021C3F1F}.Release|x64.ActiveCfg = Release|x64 {504B3154-7A4F-459D-9877-B951021C3F1F}.Release|x64.Build.0 = Release|x64 - {504B3154-7A4F-459D-9877-B951021C3F1F}.Release|x86.ActiveCfg = Release|x64 + {504B3154-7A4F-459D-9877-B951021C3F1F}.Release|x64 Setup.ActiveCfg = Release|x64 + {504B3154-7A4F-459D-9877-B951021C3F1F}.Release|x86 Setup.ActiveCfg = Release|Win32 {746F3632-5BB2-4570-9453-31D6D58A7D8E}.All|Win32.ActiveCfg = Release|Win32 {746F3632-5BB2-4570-9453-31D6D58A7D8E}.All|Win32.Build.0 = Release|Win32 {746F3632-5BB2-4570-9453-31D6D58A7D8E}.All|x64.ActiveCfg = Release|Win32 - {746F3632-5BB2-4570-9453-31D6D58A7D8E}.All|x86.ActiveCfg = Release|x64 + {746F3632-5BB2-4570-9453-31D6D58A7D8E}.All|x64 Setup.ActiveCfg = Release|Win32 + {746F3632-5BB2-4570-9453-31D6D58A7D8E}.All|x86 Setup.ActiveCfg = Release|Win32 + {746F3632-5BB2-4570-9453-31D6D58A7D8E}.All|x86 Setup.Build.0 = Release|Win32 {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|Win32.ActiveCfg = Debug|Win32 {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|Win32.Build.0 = Debug|Win32 {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|x64.ActiveCfg = Debug|x64 {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|x64.Build.0 = Debug|x64 - {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|x86.ActiveCfg = Debug|x64 + {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|Win32.ActiveCfg = Release|Win32 {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|Win32.Build.0 = Release|Win32 {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|x64.ActiveCfg = Release|x64 {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|x64.Build.0 = Release|x64 - {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|x86.ActiveCfg = Release|x64 + {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|x64 Setup.ActiveCfg = Release|x64 + {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|x86 Setup.ActiveCfg = Release|Win32 {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.All|Win32.ActiveCfg = Release|Win32 {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.All|Win32.Build.0 = Release|Win32 {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.All|x64.ActiveCfg = Release|Win32 - {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.All|x86.ActiveCfg = Release|x64 + {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.All|x64 Setup.ActiveCfg = Release|Win32 + {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.All|x86 Setup.ActiveCfg = Release|Win32 + {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.All|x86 Setup.Build.0 = Release|Win32 {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|Win32.ActiveCfg = Debug|Win32 {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|Win32.Build.0 = Debug|Win32 {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|x64.ActiveCfg = Debug|x64 {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|x64.Build.0 = Debug|x64 - {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|x86.ActiveCfg = Debug|x64 + {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|Win32.ActiveCfg = Release|Win32 {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|Win32.Build.0 = Release|Win32 {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|x64.ActiveCfg = Release|x64 {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|x64.Build.0 = Release|x64 - {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|x86.ActiveCfg = Release|x64 + {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|x64 Setup.ActiveCfg = Release|x64 + {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|x86 Setup.ActiveCfg = Release|Win32 {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.All|Win32.ActiveCfg = Release|x64 {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.All|x64.ActiveCfg = Release|x64 {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.All|x64.Build.0 = Release|x64 - {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.All|x86.ActiveCfg = Release|x64 + {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.All|x64 Setup.ActiveCfg = Release|x64 + {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.All|x64 Setup.Build.0 = Release|x64 + {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.All|x86 Setup.ActiveCfg = Release|x64 {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Debug|Win32.ActiveCfg = Debug|Win32 {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Debug|Win32.Build.0 = Debug|Win32 {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Debug|x64.ActiveCfg = Debug|x64 {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Debug|x64.Build.0 = Debug|x64 - {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Debug|x86.ActiveCfg = Debug|x64 + {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Release|Win32.ActiveCfg = Release|Win32 {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Release|Win32.Build.0 = Release|Win32 {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Release|x64.ActiveCfg = Release|x64 {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Release|x64.Build.0 = Release|x64 - {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Release|x86.ActiveCfg = Release|x64 + {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Release|x64 Setup.ActiveCfg = Release|x64 + {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Release|x86 Setup.ActiveCfg = Release|Win32 {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.All|Win32.ActiveCfg = Release|Win32 {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.All|Win32.Build.0 = Release|Win32 {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.All|x64.ActiveCfg = Release|Win32 - {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.All|x86.ActiveCfg = Release|Win32 + {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.All|x64 Setup.ActiveCfg = Release|Win32 + {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.All|x86 Setup.ActiveCfg = Release|Win32 + {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.All|x86 Setup.Build.0 = Release|Win32 {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Debug|Win32.ActiveCfg = Debug|Win32 {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Debug|Win32.Build.0 = Debug|Win32 {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Debug|x64.ActiveCfg = Debug|Win32 {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Debug|x64.Build.0 = Debug|Win32 - {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Debug|x86.ActiveCfg = Debug|Win32 + {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Debug|x64 Setup.ActiveCfg = Debug|Win32 + {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Release|Win32.ActiveCfg = Release|Win32 {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Release|Win32.Build.0 = Release|Win32 {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Release|x64.ActiveCfg = Release|Win32 {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Release|x64.Build.0 = Release|Win32 - {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Release|x86.ActiveCfg = Release|Win32 + {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Release|x64 Setup.ActiveCfg = Release|Win32 + {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Release|x86 Setup.ActiveCfg = Release|Win32 {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.All|Win32.ActiveCfg = Release|x64 {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.All|x64.ActiveCfg = Release|x64 {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.All|x64.Build.0 = Release|x64 - {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.All|x86.ActiveCfg = Release|x64 + {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.All|x64 Setup.ActiveCfg = Release|x64 + {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.All|x64 Setup.Build.0 = Release|x64 + {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.All|x86 Setup.ActiveCfg = Release|x64 {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Debug|Win32.ActiveCfg = Debug|Win32 {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Debug|Win32.Build.0 = Debug|Win32 {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Debug|x64.ActiveCfg = Debug|x64 {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Debug|x64.Build.0 = Debug|x64 - {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Debug|x86.ActiveCfg = Debug|x64 + {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Release|Win32.ActiveCfg = Release|Win32 {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Release|Win32.Build.0 = Release|Win32 {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Release|x64.ActiveCfg = Release|x64 {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Release|x64.Build.0 = Release|x64 - {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Release|x86.ActiveCfg = Release|x64 + {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Release|x64 Setup.ActiveCfg = Release|x64 + {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Release|x86 Setup.ActiveCfg = Release|Win32 {4D418176-3B33-47E6-A63E-01BA34ADD21C}.All|Win32.ActiveCfg = Release Passthrough|x64 {4D418176-3B33-47E6-A63E-01BA34ADD21C}.All|x64.ActiveCfg = Release Passthrough|x64 {4D418176-3B33-47E6-A63E-01BA34ADD21C}.All|x64.Build.0 = Release Passthrough|x64 - {4D418176-3B33-47E6-A63E-01BA34ADD21C}.All|x86.ActiveCfg = Release Passthrough|x64 + {4D418176-3B33-47E6-A63E-01BA34ADD21C}.All|x64 Setup.ActiveCfg = Release Passthrough|x64 + {4D418176-3B33-47E6-A63E-01BA34ADD21C}.All|x64 Setup.Build.0 = Release Passthrough|x64 + {4D418176-3B33-47E6-A63E-01BA34ADD21C}.All|x86 Setup.ActiveCfg = Release Passthrough|x64 {4D418176-3B33-47E6-A63E-01BA34ADD21C}.Debug|Win32.ActiveCfg = Debug|Win32 {4D418176-3B33-47E6-A63E-01BA34ADD21C}.Debug|Win32.Build.0 = Debug|Win32 {4D418176-3B33-47E6-A63E-01BA34ADD21C}.Debug|x64.ActiveCfg = Debug|x64 {4D418176-3B33-47E6-A63E-01BA34ADD21C}.Debug|x64.Build.0 = Debug|x64 - {4D418176-3B33-47E6-A63E-01BA34ADD21C}.Debug|x86.ActiveCfg = Debug|x64 + {4D418176-3B33-47E6-A63E-01BA34ADD21C}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {4D418176-3B33-47E6-A63E-01BA34ADD21C}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {4D418176-3B33-47E6-A63E-01BA34ADD21C}.Release|Win32.ActiveCfg = Release|Win32 {4D418176-3B33-47E6-A63E-01BA34ADD21C}.Release|Win32.Build.0 = Release|Win32 {4D418176-3B33-47E6-A63E-01BA34ADD21C}.Release|x64.ActiveCfg = Release|x64 {4D418176-3B33-47E6-A63E-01BA34ADD21C}.Release|x64.Build.0 = Release|x64 - {4D418176-3B33-47E6-A63E-01BA34ADD21C}.Release|x86.ActiveCfg = Release|x64 + {4D418176-3B33-47E6-A63E-01BA34ADD21C}.Release|x64 Setup.ActiveCfg = Release|x64 + {4D418176-3B33-47E6-A63E-01BA34ADD21C}.Release|x86 Setup.ActiveCfg = Release|Win32 {7D3122C7-C9D0-3748-81F8-F0DDCB40BF5E}.All|Win32.ActiveCfg = Release|Win32 {7D3122C7-C9D0-3748-81F8-F0DDCB40BF5E}.All|Win32.Build.0 = Release|Win32 {7D3122C7-C9D0-3748-81F8-F0DDCB40BF5E}.All|x64.ActiveCfg = Release|Win32 - {7D3122C7-C9D0-3748-81F8-F0DDCB40BF5E}.All|x86.ActiveCfg = Release|Win32 + {7D3122C7-C9D0-3748-81F8-F0DDCB40BF5E}.All|x64 Setup.ActiveCfg = Release|Win32 + {7D3122C7-C9D0-3748-81F8-F0DDCB40BF5E}.All|x86 Setup.ActiveCfg = Release|Win32 + {7D3122C7-C9D0-3748-81F8-F0DDCB40BF5E}.All|x86 Setup.Build.0 = Release|Win32 {7D3122C7-C9D0-3748-81F8-F0DDCB40BF5E}.Debug|Win32.ActiveCfg = Debug|Win32 {7D3122C7-C9D0-3748-81F8-F0DDCB40BF5E}.Debug|x64.ActiveCfg = Debug|Win32 - {7D3122C7-C9D0-3748-81F8-F0DDCB40BF5E}.Debug|x86.ActiveCfg = Debug|Win32 + {7D3122C7-C9D0-3748-81F8-F0DDCB40BF5E}.Debug|x64 Setup.ActiveCfg = Debug|Win32 + {7D3122C7-C9D0-3748-81F8-F0DDCB40BF5E}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {7D3122C7-C9D0-3748-81F8-F0DDCB40BF5E}.Release|Win32.ActiveCfg = Release|Win32 {7D3122C7-C9D0-3748-81F8-F0DDCB40BF5E}.Release|x64.ActiveCfg = Release|Win32 - {7D3122C7-C9D0-3748-81F8-F0DDCB40BF5E}.Release|x86.ActiveCfg = Release|Win32 + {7D3122C7-C9D0-3748-81F8-F0DDCB40BF5E}.Release|x64 Setup.ActiveCfg = Release|Win32 + {7D3122C7-C9D0-3748-81F8-F0DDCB40BF5E}.Release|x86 Setup.ActiveCfg = Release|Win32 {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.All|Win32.ActiveCfg = Release|x64 {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.All|x64.ActiveCfg = Release|x64 {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.All|x64.Build.0 = Release|x64 - {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.All|x86.ActiveCfg = Release|x64 + {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.All|x64 Setup.ActiveCfg = Release|x64 + {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.All|x64 Setup.Build.0 = Release|x64 + {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.All|x86 Setup.ActiveCfg = Release|x64 {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.Debug|Win32.ActiveCfg = Debug|Win32 {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.Debug|Win32.Build.0 = Debug|Win32 {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.Debug|x64.ActiveCfg = Debug|x64 {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.Debug|x64.Build.0 = Debug|x64 - {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.Debug|x86.ActiveCfg = Debug|x64 + {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.Release|Win32.ActiveCfg = Release|Win32 {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.Release|Win32.Build.0 = Release|Win32 {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.Release|x64.ActiveCfg = Release|x64 {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.Release|x64.Build.0 = Release|x64 - {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.Release|x86.ActiveCfg = Release|x64 + {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.Release|x64 Setup.ActiveCfg = Release|x64 + {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.Release|x86 Setup.ActiveCfg = Release|Win32 {B808178B-82F0-4CF4-A2B1-921939FA24D0}.All|Win32.ActiveCfg = Release|Win32 {B808178B-82F0-4CF4-A2B1-921939FA24D0}.All|Win32.Build.0 = Release|Win32 {B808178B-82F0-4CF4-A2B1-921939FA24D0}.All|x64.ActiveCfg = Release|Win32 - {B808178B-82F0-4CF4-A2B1-921939FA24D0}.All|x86.ActiveCfg = Release|Win32 + {B808178B-82F0-4CF4-A2B1-921939FA24D0}.All|x64 Setup.ActiveCfg = Release|Win32 + {B808178B-82F0-4CF4-A2B1-921939FA24D0}.All|x86 Setup.ActiveCfg = Release|Win32 + {B808178B-82F0-4CF4-A2B1-921939FA24D0}.All|x86 Setup.Build.0 = Release|Win32 {B808178B-82F0-4CF4-A2B1-921939FA24D0}.Debug|Win32.ActiveCfg = Debug|Win32 {B808178B-82F0-4CF4-A2B1-921939FA24D0}.Debug|Win32.Build.0 = Debug|Win32 {B808178B-82F0-4CF4-A2B1-921939FA24D0}.Debug|x64.ActiveCfg = Debug|Win32 {B808178B-82F0-4CF4-A2B1-921939FA24D0}.Debug|x64.Build.0 = Debug|Win32 - {B808178B-82F0-4CF4-A2B1-921939FA24D0}.Debug|x86.ActiveCfg = Debug|Win32 + {B808178B-82F0-4CF4-A2B1-921939FA24D0}.Debug|x64 Setup.ActiveCfg = Debug|Win32 + {B808178B-82F0-4CF4-A2B1-921939FA24D0}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {B808178B-82F0-4CF4-A2B1-921939FA24D0}.Release|Win32.ActiveCfg = Release|Win32 {B808178B-82F0-4CF4-A2B1-921939FA24D0}.Release|Win32.Build.0 = Release|Win32 {B808178B-82F0-4CF4-A2B1-921939FA24D0}.Release|x64.ActiveCfg = Release|Win32 {B808178B-82F0-4CF4-A2B1-921939FA24D0}.Release|x64.Build.0 = Release|Win32 - {B808178B-82F0-4CF4-A2B1-921939FA24D0}.Release|x86.ActiveCfg = Release|Win32 + {B808178B-82F0-4CF4-A2B1-921939FA24D0}.Release|x64 Setup.ActiveCfg = Release|Win32 + {B808178B-82F0-4CF4-A2B1-921939FA24D0}.Release|x86 Setup.ActiveCfg = Release|Win32 {9778F1C0-09BC-4698-8EBC-BD982247209A}.All|Win32.ActiveCfg = Release|x64 {9778F1C0-09BC-4698-8EBC-BD982247209A}.All|x64.ActiveCfg = Release|x64 {9778F1C0-09BC-4698-8EBC-BD982247209A}.All|x64.Build.0 = Release|x64 - {9778F1C0-09BC-4698-8EBC-BD982247209A}.All|x86.ActiveCfg = Release|x64 + {9778F1C0-09BC-4698-8EBC-BD982247209A}.All|x64 Setup.ActiveCfg = Release|x64 + {9778F1C0-09BC-4698-8EBC-BD982247209A}.All|x64 Setup.Build.0 = Release|x64 + {9778F1C0-09BC-4698-8EBC-BD982247209A}.All|x86 Setup.ActiveCfg = Release|x64 {9778F1C0-09BC-4698-8EBC-BD982247209A}.Debug|Win32.ActiveCfg = Debug|Win32 {9778F1C0-09BC-4698-8EBC-BD982247209A}.Debug|Win32.Build.0 = Debug|Win32 {9778F1C0-09BC-4698-8EBC-BD982247209A}.Debug|x64.ActiveCfg = Debug|x64 {9778F1C0-09BC-4698-8EBC-BD982247209A}.Debug|x64.Build.0 = Debug|x64 - {9778F1C0-09BC-4698-8EBC-BD982247209A}.Debug|x86.ActiveCfg = Debug|x64 + {9778F1C0-09BC-4698-8EBC-BD982247209A}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {9778F1C0-09BC-4698-8EBC-BD982247209A}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {9778F1C0-09BC-4698-8EBC-BD982247209A}.Release|Win32.ActiveCfg = Release|Win32 {9778F1C0-09BC-4698-8EBC-BD982247209A}.Release|Win32.Build.0 = Release|Win32 {9778F1C0-09BC-4698-8EBC-BD982247209A}.Release|x64.ActiveCfg = Release|x64 {9778F1C0-09BC-4698-8EBC-BD982247209A}.Release|x64.Build.0 = Release|x64 - {9778F1C0-09BC-4698-8EBC-BD982247209A}.Release|x86.ActiveCfg = Release|x64 + {9778F1C0-09BC-4698-8EBC-BD982247209A}.Release|x64 Setup.ActiveCfg = Release|x64 + {9778F1C0-09BC-4698-8EBC-BD982247209A}.Release|x86 Setup.ActiveCfg = Release|Win32 {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.All|Win32.ActiveCfg = Release|x64 {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.All|x64.ActiveCfg = Release|x64 {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.All|x64.Build.0 = Release|x64 - {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.All|x86.ActiveCfg = Release|x64 + {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.All|x64 Setup.ActiveCfg = Release|x64 + {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.All|x64 Setup.Build.0 = Release|x64 + {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.All|x86 Setup.ActiveCfg = Release|x64 {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.Debug|Win32.ActiveCfg = Debug|Win32 {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.Debug|Win32.Build.0 = Debug|Win32 {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.Debug|x64.ActiveCfg = Debug|x64 {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.Debug|x64.Build.0 = Debug|x64 - {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.Debug|x86.ActiveCfg = Debug|x64 + {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.Release|Win32.ActiveCfg = Release|Win32 {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.Release|Win32.Build.0 = Release|Win32 {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.Release|x64.ActiveCfg = Release|x64 {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.Release|x64.Build.0 = Release|x64 - {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.Release|x86.ActiveCfg = Release|x64 + {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.Release|x64 Setup.ActiveCfg = Release|x64 + {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.Release|x86 Setup.ActiveCfg = Release|Win32 {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.All|Win32.ActiveCfg = Release|Win32 {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.All|Win32.Build.0 = Release|Win32 {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.All|x64.ActiveCfg = Release|Win32 - {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.All|x86.ActiveCfg = Release|x64 + {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.All|x64 Setup.ActiveCfg = Release|Win32 + {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.All|x86 Setup.ActiveCfg = Release|Win32 + {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.All|x86 Setup.Build.0 = Release|Win32 {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.Debug|Win32.ActiveCfg = Debug|Win32 {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.Debug|Win32.Build.0 = Debug|Win32 {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.Debug|x64.ActiveCfg = Debug|x64 {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.Debug|x64.Build.0 = Debug|x64 - {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.Debug|x86.ActiveCfg = Debug|x64 + {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.Release|Win32.ActiveCfg = Release|Win32 {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.Release|Win32.Build.0 = Release|Win32 {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.Release|x64.ActiveCfg = Release|x64 {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.Release|x64.Build.0 = Release|x64 - {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.Release|x86.ActiveCfg = Release|x64 + {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.Release|x64 Setup.ActiveCfg = Release|x64 + {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.Release|x86 Setup.ActiveCfg = Release|Win32 {990BAA76-89D3-4E38-8479-C7B28784EFC8}.All|Win32.ActiveCfg = Release|Win32 {990BAA76-89D3-4E38-8479-C7B28784EFC8}.All|Win32.Build.0 = Release|Win32 {990BAA76-89D3-4E38-8479-C7B28784EFC8}.All|x64.ActiveCfg = Release|Win32 - {990BAA76-89D3-4E38-8479-C7B28784EFC8}.All|x86.ActiveCfg = Release|x64 + {990BAA76-89D3-4E38-8479-C7B28784EFC8}.All|x64 Setup.ActiveCfg = Release|Win32 + {990BAA76-89D3-4E38-8479-C7B28784EFC8}.All|x86 Setup.ActiveCfg = Release|Win32 + {990BAA76-89D3-4E38-8479-C7B28784EFC8}.All|x86 Setup.Build.0 = Release|Win32 {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Debug|Win32.ActiveCfg = Debug|Win32 {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Debug|Win32.Build.0 = Debug|Win32 {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Debug|x64.ActiveCfg = Debug|x64 {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Debug|x64.Build.0 = Debug|x64 - {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Debug|x86.ActiveCfg = Debug|x64 + {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Release|Win32.ActiveCfg = Release|Win32 {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Release|Win32.Build.0 = Release|Win32 {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Release|x64.ActiveCfg = Release|x64 {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Release|x64.Build.0 = Release|x64 - {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Release|x86.ActiveCfg = Release|x64 + {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Release|x64 Setup.ActiveCfg = Release|x64 + {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Release|x86 Setup.ActiveCfg = Release|Win32 {1E21AFE0-6FDB-41D2-942D-863607C24B91}.All|Win32.ActiveCfg = Release|x64 {1E21AFE0-6FDB-41D2-942D-863607C24B91}.All|x64.ActiveCfg = Release|x64 {1E21AFE0-6FDB-41D2-942D-863607C24B91}.All|x64.Build.0 = Release|x64 - {1E21AFE0-6FDB-41D2-942D-863607C24B91}.All|x86.ActiveCfg = Release|x64 + {1E21AFE0-6FDB-41D2-942D-863607C24B91}.All|x64 Setup.ActiveCfg = Release|x64 + {1E21AFE0-6FDB-41D2-942D-863607C24B91}.All|x64 Setup.Build.0 = Release|x64 + {1E21AFE0-6FDB-41D2-942D-863607C24B91}.All|x86 Setup.ActiveCfg = Release|x64 {1E21AFE0-6FDB-41D2-942D-863607C24B91}.Debug|Win32.ActiveCfg = Debug|Win32 {1E21AFE0-6FDB-41D2-942D-863607C24B91}.Debug|Win32.Build.0 = Debug|Win32 {1E21AFE0-6FDB-41D2-942D-863607C24B91}.Debug|x64.ActiveCfg = Debug|x64 {1E21AFE0-6FDB-41D2-942D-863607C24B91}.Debug|x64.Build.0 = Debug|x64 - {1E21AFE0-6FDB-41D2-942D-863607C24B91}.Debug|x86.ActiveCfg = Debug|x64 + {1E21AFE0-6FDB-41D2-942D-863607C24B91}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {1E21AFE0-6FDB-41D2-942D-863607C24B91}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {1E21AFE0-6FDB-41D2-942D-863607C24B91}.Release|Win32.ActiveCfg = Release|Win32 {1E21AFE0-6FDB-41D2-942D-863607C24B91}.Release|Win32.Build.0 = Release|Win32 {1E21AFE0-6FDB-41D2-942D-863607C24B91}.Release|x64.ActiveCfg = Release|x64 {1E21AFE0-6FDB-41D2-942D-863607C24B91}.Release|x64.Build.0 = Release|x64 - {1E21AFE0-6FDB-41D2-942D-863607C24B91}.Release|x86.ActiveCfg = Release|x64 + {1E21AFE0-6FDB-41D2-942D-863607C24B91}.Release|x64 Setup.ActiveCfg = Release|x64 + {1E21AFE0-6FDB-41D2-942D-863607C24B91}.Release|x86 Setup.ActiveCfg = Release|Win32 {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.All|Win32.ActiveCfg = Release|x64 {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.All|x64.ActiveCfg = Release|x64 {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.All|x64.Build.0 = Release|x64 - {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.All|x86.ActiveCfg = Release|x64 + {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.All|x64 Setup.ActiveCfg = Release|x64 + {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.All|x64 Setup.Build.0 = Release|x64 + {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.All|x86 Setup.ActiveCfg = Release|x64 {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.Debug|Win32.ActiveCfg = Debug|Win32 {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.Debug|Win32.Build.0 = Debug|Win32 {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.Debug|x64.ActiveCfg = Debug|x64 {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.Debug|x64.Build.0 = Debug|x64 - {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.Debug|x86.ActiveCfg = Debug|x64 + {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.Release|Win32.ActiveCfg = Release|Win32 {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.Release|Win32.Build.0 = Release|Win32 {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.Release|x64.ActiveCfg = Release|x64 {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.Release|x64.Build.0 = Release|x64 - {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.Release|x86.ActiveCfg = Release|x64 + {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.Release|x64 Setup.ActiveCfg = Release|x64 + {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.Release|x86 Setup.ActiveCfg = Release|Win32 {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.All|Win32.ActiveCfg = Release|x64 {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.All|x64.ActiveCfg = Release|x64 {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.All|x64.Build.0 = Release|x64 - {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.All|x86.ActiveCfg = Release|x64 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.All|x64 Setup.ActiveCfg = Release|x64 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.All|x64 Setup.Build.0 = Release|x64 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.All|x86 Setup.ActiveCfg = Release|x64 {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Debug|Win32.ActiveCfg = Debug|Win32 {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Debug|Win32.Build.0 = Debug|Win32 {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Debug|x64.ActiveCfg = Debug|x64 {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Debug|x64.Build.0 = Debug|x64 - {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Debug|x86.ActiveCfg = Debug|x64 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Release|Win32.ActiveCfg = Release|Win32 {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Release|Win32.Build.0 = Release|Win32 {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Release|x64.ActiveCfg = Release|x64 {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Release|x64.Build.0 = Release|x64 - {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Release|x86.ActiveCfg = Release|x64 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Release|x64 Setup.ActiveCfg = Release|x64 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Release|x86 Setup.ActiveCfg = Release|Win32 {B4B62169-5AD4-4559-8707-3D933AC5DB39}.All|Win32.ActiveCfg = Release|x64 {B4B62169-5AD4-4559-8707-3D933AC5DB39}.All|x64.ActiveCfg = Release|x64 {B4B62169-5AD4-4559-8707-3D933AC5DB39}.All|x64.Build.0 = Release|x64 - {B4B62169-5AD4-4559-8707-3D933AC5DB39}.All|x86.ActiveCfg = Release|x64 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.All|x64 Setup.ActiveCfg = Release|x64 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.All|x64 Setup.Build.0 = Release|x64 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.All|x86 Setup.ActiveCfg = Release|x64 {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Debug|Win32.ActiveCfg = Debug|Win32 {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Debug|Win32.Build.0 = Debug|Win32 {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Debug|x64.ActiveCfg = Debug|x64 {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Debug|x64.Build.0 = Debug|x64 - {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Debug|x86.ActiveCfg = Debug|x64 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Release|Win32.ActiveCfg = Release|Win32 {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Release|Win32.Build.0 = Release|Win32 {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Release|x64.ActiveCfg = Release|x64 {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Release|x64.Build.0 = Release|x64 - {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Release|x86.ActiveCfg = Release|x64 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Release|x64 Setup.ActiveCfg = Release|x64 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Release|x86 Setup.ActiveCfg = Release|Win32 {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.All|Win32.ActiveCfg = Release|x64 {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.All|x64.ActiveCfg = Release|x64 {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.All|x64.Build.0 = Release|x64 - {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.All|x86.ActiveCfg = Release|x64 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.All|x64 Setup.ActiveCfg = Release|x64 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.All|x64 Setup.Build.0 = Release|x64 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.All|x86 Setup.ActiveCfg = Release|x64 {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Debug|Win32.ActiveCfg = Debug|Win32 {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Debug|Win32.Build.0 = Debug|Win32 {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Debug|x64.ActiveCfg = Debug|x64 {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Debug|x64.Build.0 = Debug|x64 - {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Debug|x86.ActiveCfg = Debug|x64 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|Win32.ActiveCfg = Release|Win32 {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|Win32.Build.0 = Release|Win32 {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|x64.ActiveCfg = Release|x64 {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|x64.Build.0 = Release|x64 - {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|x86.ActiveCfg = Release|x64 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|x64 Setup.ActiveCfg = Release|x64 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|x86 Setup.ActiveCfg = Release|Win32 {D578E676-7EC8-4548-BD8B-845C635F14AD}.All|Win32.ActiveCfg = Release|Win32 {D578E676-7EC8-4548-BD8B-845C635F14AD}.All|Win32.Build.0 = Release|Win32 {D578E676-7EC8-4548-BD8B-845C635F14AD}.All|x64.ActiveCfg = Release|Win32 - {D578E676-7EC8-4548-BD8B-845C635F14AD}.All|x86.ActiveCfg = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.All|x64 Setup.ActiveCfg = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.All|x86 Setup.ActiveCfg = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.All|x86 Setup.Build.0 = Release|Win32 {D578E676-7EC8-4548-BD8B-845C635F14AD}.Debug|Win32.ActiveCfg = Debug|Win32 {D578E676-7EC8-4548-BD8B-845C635F14AD}.Debug|Win32.Build.0 = Debug|Win32 {D578E676-7EC8-4548-BD8B-845C635F14AD}.Debug|x64.ActiveCfg = Debug|Win32 {D578E676-7EC8-4548-BD8B-845C635F14AD}.Debug|x64.Build.0 = Debug|Win32 - {D578E676-7EC8-4548-BD8B-845C635F14AD}.Debug|x86.ActiveCfg = Debug|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Debug|x64 Setup.ActiveCfg = Debug|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {D578E676-7EC8-4548-BD8B-845C635F14AD}.Release|Win32.ActiveCfg = Release|Win32 {D578E676-7EC8-4548-BD8B-845C635F14AD}.Release|Win32.Build.0 = Release|Win32 {D578E676-7EC8-4548-BD8B-845C635F14AD}.Release|x64.ActiveCfg = Release|Win32 {D578E676-7EC8-4548-BD8B-845C635F14AD}.Release|x64.Build.0 = Release|Win32 - {D578E676-7EC8-4548-BD8B-845C635F14AD}.Release|x86.ActiveCfg = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Release|x64 Setup.ActiveCfg = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Release|x86 Setup.ActiveCfg = Release|Win32 {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.All|Win32.ActiveCfg = Release|x64 {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.All|x64.ActiveCfg = Release|x64 {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.All|x64.Build.0 = Release|x64 - {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.All|x86.ActiveCfg = Release|x64 + {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.All|x64 Setup.ActiveCfg = Release|x64 + {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.All|x64 Setup.Build.0 = Release|x64 + {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.All|x86 Setup.ActiveCfg = Release|x64 {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|Win32.ActiveCfg = Debug|Win32 {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|Win32.Build.0 = Debug|Win32 {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|x64.ActiveCfg = Debug|x64 {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|x64.Build.0 = Debug|x64 - {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|x86.ActiveCfg = Debug|x64 + {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|Win32.ActiveCfg = Release|Win32 {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|Win32.Build.0 = Release|Win32 {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|x64.ActiveCfg = Release|x64 {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|x64.Build.0 = Release|x64 - {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|x86.ActiveCfg = Release|x64 + {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|x64 Setup.ActiveCfg = Release|x64 + {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|x86 Setup.ActiveCfg = Release|Win32 {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.All|Win32.ActiveCfg = Release|x64 {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.All|x64.ActiveCfg = Release|x64 {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.All|x64.Build.0 = Release|x64 - {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.All|x86.ActiveCfg = Release|x64 + {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.All|x64 Setup.ActiveCfg = Release|x64 + {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.All|x64 Setup.Build.0 = Release|x64 + {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.All|x86 Setup.ActiveCfg = Release|x64 {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.Debug|Win32.ActiveCfg = Debug|Win32 {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.Debug|x64.ActiveCfg = Debug|x64 - {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.Debug|x86.ActiveCfg = Debug|x64 + {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.Release|Win32.ActiveCfg = Release|Win32 {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.Release|x64.ActiveCfg = Release|x64 - {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.Release|x86.ActiveCfg = Release|x64 + {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.Release|x64 Setup.ActiveCfg = Release|x64 + {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.Release|x86 Setup.ActiveCfg = Release|Win32 {05C9FB27-480E-4D53-B3B7-7338E2514666}.All|Win32.ActiveCfg = Release|Win32 {05C9FB27-480E-4D53-B3B7-7338E2514666}.All|Win32.Build.0 = Release|Win32 {05C9FB27-480E-4D53-B3B7-7338E2514666}.All|x64.ActiveCfg = Release|Win32 - {05C9FB27-480E-4D53-B3B7-7338E2514666}.All|x86.ActiveCfg = Release|x64 + {05C9FB27-480E-4D53-B3B7-7338E2514666}.All|x64 Setup.ActiveCfg = Release|Win32 + {05C9FB27-480E-4D53-B3B7-7338E2514666}.All|x86 Setup.ActiveCfg = Release|Win32 + {05C9FB27-480E-4D53-B3B7-7338E2514666}.All|x86 Setup.Build.0 = Release|Win32 {05C9FB27-480E-4D53-B3B7-7338E2514666}.Debug|Win32.ActiveCfg = Debug|Win32 {05C9FB27-480E-4D53-B3B7-7338E2514666}.Debug|x64.ActiveCfg = Debug|x64 - {05C9FB27-480E-4D53-B3B7-7338E2514666}.Debug|x86.ActiveCfg = Debug|x64 + {05C9FB27-480E-4D53-B3B7-7338E2514666}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {05C9FB27-480E-4D53-B3B7-7338E2514666}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {05C9FB27-480E-4D53-B3B7-7338E2514666}.Release|Win32.ActiveCfg = Release|Win32 {05C9FB27-480E-4D53-B3B7-7338E2514666}.Release|x64.ActiveCfg = Release|x64 - {05C9FB27-480E-4D53-B3B7-7338E2514666}.Release|x86.ActiveCfg = Release|x64 + {05C9FB27-480E-4D53-B3B7-7338E2514666}.Release|x64 Setup.ActiveCfg = Release|x64 + {05C9FB27-480E-4D53-B3B7-7338E2514666}.Release|x86 Setup.ActiveCfg = Release|Win32 {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.All|Win32.ActiveCfg = Release|x64 {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.All|x64.ActiveCfg = Release|x64 {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.All|x64.Build.0 = Release|x64 - {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.All|x86.ActiveCfg = Release|x64 + {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.All|x64 Setup.ActiveCfg = Release|x64 + {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.All|x64 Setup.Build.0 = Release|x64 + {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.All|x86 Setup.ActiveCfg = Release|x64 {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.Debug|Win32.ActiveCfg = Debug|Win32 {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.Debug|x64.ActiveCfg = Debug|x64 - {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.Debug|x86.ActiveCfg = Debug|x64 + {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.Release|Win32.ActiveCfg = Release|Win32 {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.Release|x64.ActiveCfg = Release|x64 - {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.Release|x86.ActiveCfg = Release|x64 + {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.Release|x64 Setup.ActiveCfg = Release|x64 + {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.Release|x86 Setup.ActiveCfg = Release|Win32 {47213370-B933-487D-9F45-BCA26D7E2B6F}.All|Win32.ActiveCfg = Release|x86 {47213370-B933-487D-9F45-BCA26D7E2B6F}.All|x64.ActiveCfg = Release|x86 - {47213370-B933-487D-9F45-BCA26D7E2B6F}.All|x86.ActiveCfg = Release|x86 - {47213370-B933-487D-9F45-BCA26D7E2B6F}.All|x86.Build.0 = Release|x86 + {47213370-B933-487D-9F45-BCA26D7E2B6F}.All|x64 Setup.ActiveCfg = Release|x86 + {47213370-B933-487D-9F45-BCA26D7E2B6F}.All|x86 Setup.ActiveCfg = Release|x86 {47213370-B933-487D-9F45-BCA26D7E2B6F}.Debug|Win32.ActiveCfg = Debug|x86 {47213370-B933-487D-9F45-BCA26D7E2B6F}.Debug|x64.ActiveCfg = Debug|x64 - {47213370-B933-487D-9F45-BCA26D7E2B6F}.Debug|x86.ActiveCfg = Debug|x86 - {47213370-B933-487D-9F45-BCA26D7E2B6F}.Debug|x86.Build.0 = Debug|x86 + {47213370-B933-487D-9F45-BCA26D7E2B6F}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {47213370-B933-487D-9F45-BCA26D7E2B6F}.Debug|x64 Setup.Build.0 = Debug|x64 + {47213370-B933-487D-9F45-BCA26D7E2B6F}.Debug|x86 Setup.ActiveCfg = Debug|x86 + {47213370-B933-487D-9F45-BCA26D7E2B6F}.Debug|x86 Setup.Build.0 = Debug|x86 {47213370-B933-487D-9F45-BCA26D7E2B6F}.Release|Win32.ActiveCfg = Release|x86 {47213370-B933-487D-9F45-BCA26D7E2B6F}.Release|x64.ActiveCfg = Release|x64 - {47213370-B933-487D-9F45-BCA26D7E2B6F}.Release|x86.ActiveCfg = Release|x86 - {47213370-B933-487D-9F45-BCA26D7E2B6F}.Release|x86.Build.0 = Release|x86 + {47213370-B933-487D-9F45-BCA26D7E2B6F}.Release|x64 Setup.ActiveCfg = Release|x64 + {47213370-B933-487D-9F45-BCA26D7E2B6F}.Release|x64 Setup.Build.0 = Release|x64 + {47213370-B933-487D-9F45-BCA26D7E2B6F}.Release|x86 Setup.ActiveCfg = Release|x86 + {47213370-B933-487D-9F45-BCA26D7E2B6F}.Release|x86 Setup.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.2010.vcxproj b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.2010.vcxproj index ca533a4..7028e53 100644 --- a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.2010.vcxproj +++ b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.2010.vcxproj @@ -189,6 +189,9 @@ <ProjectReference Include="..\..\..\..\libs\win32\openssl\ssleay32.2010.vcxproj"> <Project>{b4b62169-5ad4-4559-8707-3d933ac5db39}</Project> </ProjectReference> + <ProjectReference Include="..\..\..\..\libs\win32\pthread\pthread.2010.vcxproj"> + <Project>{df018947-0fff-4eb3-bdee-441dc81da7a4}</Project> + </ProjectReference> <ProjectReference Include="..\..\..\..\libs\win32\sofia\libsofia_sip_ua_static.2010.vcxproj"> <Project>{70a49bc2-7500-41d0-b75d-edcc5be987a0}</Project> </ProjectReference> commit 16b3218ebe9cdcb51a4a2f60862ddd3bfd761da9 Merge: c465c43 38a64b6 Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Oct 14 15:31:00 2010 -0400 Merge branch 'master' of homer:smg_freeswitch commit c465c435dcf0b9c0b52ec5249247534b2cfbc4b4 Author: Brian West <brian@freeswitch.org> Date: Thu Oct 14 12:18:40 2010 -0500 If we discard a recording lets set a variable to let us know this took place diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index b8c8a69..299c24d 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -906,6 +906,7 @@ static switch_bool_t record_callback(switch_media_bug_t *bug, void *user_data, s switch_core_file_close(rh->fh); if (rh->fh->samples_out < rh->fh->samplerate * rh->min_sec) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Discarding short file %s\n", rh->file); + switch_channel_set_variable(channel, "RECORD_DISCARDED", "true"); switch_file_remove(rh->file, switch_core_session_get_pool(session)); } } commit 0559cc50da3dd8e7aa74eb6276e732c08d6cf8b9 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Oct 13 20:23:55 2010 -0500 fix att_xfer reported by woody dickson on the mailing list diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 7cda473..b8c8a69 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -1066,11 +1066,17 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session switch_core_session_message_t msg = { 0 }; char cid_buf[1024] = ""; switch_caller_profile_t *cp = NULL; + uint32_t sanity = 600; if (!switch_channel_media_ready(channel)) { goto end; } + while(switch_channel_state_change_pending(tchannel)) { + switch_yield(10000); + if (!--sanity) break; + } + if (!switch_channel_media_ready(tchannel)) { goto end; } commit dfa78985b4f6994f43b877b96d0a6dcb81cfdc01 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Oct 13 19:27:45 2010 -0500 Change codec behaviour channel_variable: sdp_m_per_ptime Adds a new m= line for each distinct ptime in codec list. When this variable is not set: When mixing codecs with various ptime in a codec list, they will now be allowed to co-exist in the sdp but it will send no ptime attr. This means the ptime preferences on the offer will be ignored when mixing codecs with various ptimes. When receiving a codec list with no ptime attr, the ptime will be chosen from local preference instead of assuming 20ms This means if offer contains PCMU with not ptime and FS has PCMU@40i Dynamic payloads will now start at 98 and increment per additional dynamic codec per call. So now you can add CELT@32000h,CELT@48000h and each one will be auto-assigned a dynamic paylaod type. diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 36954d2..7028754 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1031,13 +1031,10 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f if (codec_ms != tech_pvt->codec_ms) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, - "We were told to use ptime %d but what they meant to say was %d\n" - "This issue has so far been identified to happen on the following broken platforms/devices:\n" - "Linksys/Sipura aka Cisco\n" - "ShoreTel\n" - "Sonus/L3\n" - "We will try to fix it but some of the devices on this list are so broken,\n" - "who knows what will happen..\n", (int) tech_pvt->codec_ms, (int) codec_ms); + "Asynchronous PTIME not supported, changing our end from %d to %d\n", + (int) tech_pvt->codec_ms, + (int) codec_ms + ); switch_channel_set_variable_printf(channel, "sip_h_X-Broken-PTIME", "Adv=%d;Sent=%d", (int) tech_pvt->codec_ms, (int) codec_ms); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index cf4b9a3..87e0a5b 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -705,6 +705,8 @@ struct private_object { char *user_via; char *redirected; sofia_cid_type_t cid_type; + switch_payload_t payload_space; + switch_payload_t ianacodes[SWITCH_MAX_CODECS]; }; struct callback_t { diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 35111a8..8358d1f 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -185,6 +185,158 @@ void sofia_glue_set_image_sdp(private_object_t *tech_pvt, switch_t38_options_t * } +static void generate_m(private_object_t *tech_pvt, char *buf, size_t buflen, + switch_port_t port, + int cur_ptime, const char *append_audio, const char *sr, int use_cng, int cng_type, switch_event_t *map) +{ + int i = 0; + int rate; + int already_did[128] = { 0 }; + int ptime = 0, noptime = 0; + + switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "m=audio %d RTP/%sAVP", + port, (!zstr(tech_pvt->local_crypto_key) && sofia_test_flag(tech_pvt, TFLAG_SECURE)) ? "S" : ""); + + + + for (i = 0; i < tech_pvt->num_codecs; i++) { + const switch_codec_implementation_t *imp = tech_pvt->codecs[i]; + + if (imp->codec_type != SWITCH_CODEC_TYPE_AUDIO) { + continue; + } + + if (!noptime) { + if (!cur_ptime) { + if (ptime) { + if (ptime != imp->microseconds_per_packet / 1000) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, + "Codec %s payload %d added to sdp wanting ptime %d but it's already %d (%s:%d:%d), disabling ptime.\n", + imp->iananame, + tech_pvt->ianacodes[i], + imp->microseconds_per_packet / 1000, + ptime, + tech_pvt->codecs[0]->iananame, + tech_pvt->codecs[0]->ianacode, + ptime); + ptime = 0; + noptime = 1; + } + } else { + ptime = imp->microseconds_per_packet / 1000; + } + } else { + if ((imp->microseconds_per_packet / 1000) != cur_ptime) { + continue; + } + } + } + + if (tech_pvt->ianacodes[i] < 128) { + if (already_did[tech_pvt->ianacodes[i]]) { + continue; + } + + already_did[tech_pvt->ianacodes[i]] = 1; + } + + + switch_snprintf(buf + strlen(buf), buflen - strlen(buf), " %d", tech_pvt->ianacodes[i]); + } + + if (tech_pvt->dtmf_type == DTMF_2833 && tech_pvt->te > 95) { + switch_snprintf(buf + strlen(buf), buflen - strlen(buf), " %d", tech_pvt->te); + } + + if (!sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) && cng_type && use_cng) { + switch_snprintf(buf + strlen(buf), buflen - strlen(buf), " %d", cng_type); + } + + switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "\n"); + + + memset(already_did, 0, sizeof(already_did)); + + for (i = 0; i < tech_pvt->num_codecs; i++) { + const switch_codec_implementation_t *imp = tech_pvt->codecs[i]; + char *fmtp = imp->fmtp; + + if (imp->codec_type != SWITCH_CODEC_TYPE_AUDIO) { + continue; + } + + if (!noptime) { + if (!cur_ptime) { + if (!ptime) { + ptime = imp->microseconds_per_packet / 1000; + } + } else { + if ((imp->microseconds_per_packet / 1000) != cur_ptime) { + continue; + } + } + } + + if (tech_pvt->ianacodes[i] < 128) { + if (already_did[tech_pvt->ianacodes[i]]) { + continue; + } + + already_did[tech_pvt->ianacodes[i]] = 1; + } + + + rate = imp->samples_per_second; + + if (map) { + char key[128] = ""; + char *check = NULL; + switch_snprintf(key, sizeof(key), "%s:%u", imp->iananame, imp->bits_per_second); + + if ((check = switch_event_get_header(map, key)) || (check = switch_event_get_header(map, imp->iananame))) { + fmtp = check; + } + } + + if (tech_pvt->ianacodes[i] > 95) { + switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtpmap:%d %s/%d\n", tech_pvt->ianacodes[i], imp->iananame, rate); + } + + if (fmtp) { + switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=fmtp:%d %s\n", tech_pvt->ianacodes[i], fmtp); + } + } + + + if (tech_pvt->dtmf_type == DTMF_2833 && tech_pvt->te > 95) { + switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtpmap:%d telephone-event/8000\na=fmtp:%d 0-16\n", tech_pvt->te, tech_pvt->te); + } + + if (!cng_type) { + //switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtpmap:%d CN/8000\n", cng_type); + //} else { + switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=silenceSupp:off - - - -\n"); + } + + if (append_audio) { + switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "%s%s", append_audio, end_of(append_audio) == '\n' ? "" : "\n"); + } + + if (!cur_ptime) { + cur_ptime = ptime; + } + + if (!noptime && cur_ptime) { + switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=ptime:%d\n", cur_ptime); + } + + if (sr) { + switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=%s\n", sr); + } + +} + + void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32_t port, const char *sr, int force) { char buf[2048]; @@ -205,6 +357,23 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32 switch_event_t *map = NULL, *ptmap = NULL; const char *b_sdp = NULL; + + if (!tech_pvt->payload_space) { + int i; + + tech_pvt->payload_space = 98; + + for (i = 0; i < tech_pvt->num_codecs; i++) { + const switch_codec_implementation_t *imp = tech_pvt->codecs[i]; + + tech_pvt->ianacodes[i] = imp->ianacode; + + if (tech_pvt->ianacodes[i] > 64) { + tech_pvt->ianacodes[i] = tech_pvt->payload_space++; + } + } + } + if (!tech_pvt->rm_encoding && (b_sdp = switch_channel_get_variable(tech_pvt->channel, SWITCH_B_SDP_VARIABLE))) { sofia_glue_sdp_map(b_sdp, &map, &ptmap); } @@ -278,155 +447,100 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32 "o=%s %010u %010u IN %s %s\n" "s=%s\n" "c=IN %s %s\n" "t=0 0\n" - "%sm=audio %d RTP/%sAVP", - username, tech_pvt->owner_id, tech_pvt->session_id, family, ip, username, family, ip, srbuf, port, (!zstr(tech_pvt->local_crypto_key) - && sofia_test_flag(tech_pvt, - TFLAG_SECURE)) ? - "S" : ""); + "%s", + username, tech_pvt->owner_id, tech_pvt->session_id, family, ip, username, family, ip, srbuf); if (tech_pvt->rm_encoding) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->pt); - } else if (tech_pvt->num_codecs) { - int i; - int already_did[128] = { 0 }; - for (i = 0; i < tech_pvt->num_codecs; i++) { - const switch_codec_implementation_t *imp = tech_pvt->codecs[i]; - - if (imp->codec_type != SWITCH_CODEC_TYPE_AUDIO) { - continue; - } - - if (imp->ianacode < 128) { - if (already_did[imp->ianacode]) { - continue; - } + switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "m=audio %d RTP/%sAVP", + port, (!zstr(tech_pvt->local_crypto_key) && sofia_test_flag(tech_pvt, TFLAG_SECURE)) ? "S" : ""); - already_did[imp->ianacode] = 1; - } + switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->pt); - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", imp->ianacode); - if (!ptime) { - ptime = imp->microseconds_per_packet / 1000; - } + if (tech_pvt->dtmf_type == DTMF_2833 && tech_pvt->te > 95) { + switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->te); } - } - - if (tech_pvt->dtmf_type == DTMF_2833 && tech_pvt->te > 95) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->te); - } - - if (!sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) && tech_pvt->cng_pt && use_cng) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->cng_pt); - } - - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "\n"); - + + if (!sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) && tech_pvt->cng_pt && use_cng) { + switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->cng_pt); + } + + switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "\n"); - if (tech_pvt->rm_encoding) { rate = tech_pvt->rm_rate; switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", tech_pvt->agreed_pt, tech_pvt->rm_encoding, rate); if (fmtp_out) { switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", tech_pvt->agreed_pt, fmtp_out); } + if (tech_pvt->read_codec.implementation && !ptime) { ptime = tech_pvt->read_codec.implementation->microseconds_per_packet / 1000; } - } else if (tech_pvt->num_codecs) { - int i; - int already_did[128] = { 0 }; - for (i = 0; i < tech_pvt->num_codecs; i++) { - const switch_codec_implementation_t *imp = tech_pvt->codecs[i]; - char *fmtp = imp->fmtp; - - if (imp->codec_type != SWITCH_CODEC_TYPE_AUDIO) { - continue; + + if (tech_pvt->dtmf_type == DTMF_2833 && tech_pvt->te > 95) { + switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d telephone-event/8000\na=fmtp:%d 0-16\n", tech_pvt->te, tech_pvt->te); + } + if (!sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) && tech_pvt->cng_pt && use_cng) { + switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d CN/8000\n", tech_pvt->cng_pt); + if (!tech_pvt->rm_encoding) { + tech_pvt->cng_pt = 0; } + } else { + switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=silenceSupp:off - - - -\n"); + } - if (imp->ianacode < 128) { - if (already_did[imp->ianacode]) { - continue; - } + if (append_audio) { + switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s%s", append_audio, end_of(append_audio) == '\n' ? "" : "\n"); + } - already_did[imp->ianacode] = 1; - } + if (ptime) { + switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=ptime:%d\n", ptime); + } - rate = imp->samples_per_second; + if (sr) { + switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=%s\n", sr); + } + - if (map) { - char key[128] = ""; - char *check = NULL; - switch_snprintf(key, sizeof(key), "%s:%u", imp->iananame, imp->bits_per_second); + } else if (tech_pvt->num_codecs) { + int i; + int cur_ptime = 0, this_ptime = 0, cng_type = 0; - if ((check = switch_event_get_header(map, key)) || (check = switch_event_get_header(map, imp->iananame))) { - fmtp = check; - } - } - - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", imp->ianacode, imp->iananame, rate); - if (fmtp) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", imp->ianacode, fmtp); - } - } - } + if (!sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) && tech_pvt->cng_pt && use_cng) { + cng_type = tech_pvt->cng_pt; - if (tech_pvt->dtmf_type == DTMF_2833 && tech_pvt->te > 95) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d telephone-event/8000\na=fmtp:%d 0-16\n", tech_pvt->te, tech_pvt->te); - } - if (!sofia_test_pflag(tech_pvt->profile, PFLAG_SUPPRESS_CNG) && tech_pvt->cng_pt && use_cng) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d CN/8000\n", tech_pvt->cng_pt); - if (!tech_pvt->rm_encoding) { - tech_pvt->cng_pt = 0; + if (!tech_pvt->rm_encoding) { + tech_pvt->cng_pt = 0; + } } - } else { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=silenceSupp:off - - - -\n"); - } - if (append_audio) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s%s", append_audio, end_of(append_audio) == '\n' ? "" : "\n"); - } - - if (ptime) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=ptime:%d\n", ptime); - } - - if (sr) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=%s\n", sr); - } + if (!switch_true(switch_channel_get_variable(tech_pvt->channel, "sdp_m_per_ptime"))) { + generate_m(tech_pvt, buf, sizeof(buf), port, 0, append_audio, sr, use_cng, cng_type, map); + } else { - if (!zstr(tech_pvt->local_crypto_key) && sofia_test_flag(tech_pvt, TFLAG_SECURE)) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=crypto:%s\n", tech_pvt->local_crypto_key); - //switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=encryption:optional\n"); -#if 0 - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "m=audio %d RTP/AVP", port); - - if (tech_pvt->rm_encoding) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->pt); - } else if (tech_pvt->num_codecs) { - int i; - int already_did[128] = { 0 }; for (i = 0; i < tech_pvt->num_codecs; i++) { const switch_codec_implementation_t *imp = tech_pvt->codecs[i]; - + if (imp->codec_type != SWITCH_CODEC_TYPE_AUDIO) { continue; } - - if (imp->ianacode < 128) { - if (already_did[imp->ianacode]) { - continue; - } - - already_did[imp->ianacode] = 1; + + this_ptime = imp->microseconds_per_packet / 1000; + + if (cur_ptime != this_ptime) { + cur_ptime = this_ptime; + generate_m(tech_pvt, buf, sizeof(buf), port, cur_ptime, append_audio, sr, use_cng, cng_type, map); } - - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", imp->ianacode); + } } - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "\na=crypto:%s\n", tech_pvt->local_crypto_key); -#endif + } + + if (!zstr(tech_pvt->local_crypto_key) && sofia_test_flag(tech_pvt, TFLAG_SECURE)) { + switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=crypto:%s\n", tech_pvt->local_crypto_key); + //switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=encryption:optional\n"); } if (sofia_test_flag(tech_pvt, TFLAG_VIDEO)) { @@ -451,14 +565,14 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32 continue; } - if (imp->ianacode < 128) { - if (already_did[imp->ianacode]) { + if (tech_pvt->ianacodes[i] < 128) { + if (already_did[tech_pvt->ianacodes[i]]) { continue; } - already_did[imp->ianacode] = 1; + already_did[tech_pvt->ianacodes[i]] = 1; } - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", imp->ianacode); + switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->ianacodes[i]); if (!ptime) { ptime = imp->microseconds_per_packet / 1000; } @@ -498,37 +612,11 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32 int i; int already_did[128] = { 0 }; -#if 0 - switch_event_t *event; - char *buf; - int level = SWITCH_LOG_INFO; - - if (switch_event_create_plain(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) { - switch_channel_event_set_data(switch_core_session_get_channel(tech_pvt->session), event); - switch_event_serialize(event, &buf, SWITCH_FALSE); - switch_assert(buf); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), level, "CHANNEL_DATA:\n%s\n", buf); - switch_event_destroy(&event); - free(buf); - } -#endif - for (i = 0; i < tech_pvt->num_codecs; i++) { const switch_codec_implementation_t *imp = tech_pvt->codecs[i]; char *fmtp = NULL; - uint32_t ianacode = imp->ianacode; -#if 0 - const char *str; + uint32_t ianacode = tech_pvt->ianacodes[i]; - - - if ((str = switch_event_get_header(ptmap, imp->iananame))) { - int tmp = atoi(str); - if (tmp > 0) { - ianacode = tmp; - } - } -#endif if (imp->codec_type != SWITCH_CODEC_TYPE_VIDEO) { continue; } @@ -562,7 +650,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32 } if (!zstr(fmtp) && strcasecmp(fmtp, "_blank_")) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", imp->ianacode, fmtp); + switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", ianacode, fmtp); } } @@ -578,7 +666,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32 if (ptmap) { switch_event_destroy(&ptmap); } - + sofia_glue_tech_set_local_sdp(tech_pvt, buf, SWITCH_TRUE); } @@ -4219,28 +4307,38 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s last = tech_pvt->num_codecs; } - if (maxptime && (!ptime || ptime > maxptime)) { - ptime = maxptime; + codec_ms = ptime; + + if (maxptime && (!codec_ms || codec_ms > maxptime)) { + codec_ms = maxptime; } - if (!ptime) { - ptime = switch_default_ptime(rm_encoding, map->rm_pt); + if (!codec_ms) { + codec_ms = switch_default_ptime(rm_encoding, map->rm_pt); } map_bit_rate = switch_known_bitrate(map->rm_pt); - - if (!zstr(map->rm_fmtp)) { + + if (!ptime && !strcasecmp(map->rm_encoding, "g723")) { + codec_ms = 30; + } + + if (zstr(map->rm_fmtp)) { + if (!strcasecmp(map->rm_encoding, "ilbc")) { + codec_ms = 30; + } + } else { if ((switch_core_codec_parse_fmtp(map->rm_encoding, map->rm_fmtp, map->rm_rate, &codec_fmtp)) == SWITCH_STATUS_SUCCESS) { if (codec_fmtp.bits_per_second) { map_bit_rate = codec_fmtp.bits_per_second; } if (codec_fmtp.microseconds_per_packet) { - ptime = (codec_fmtp.microseconds_per_packet / 1000); + codec_ms = (codec_fmtp.microseconds_per_packet / 1000); } } } - codec_ms = ptime; + for (i = first; i < last && i < tech_pvt->num_codecs; i++) { const switch_codec_implementation_t *imp = tech_pvt->codecs[i]; @@ -4251,7 +4349,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s } switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Audio Codec Compare [%s:%d:%u:%d:%u]/[%s:%d:%u:%d:%u]\n", - rm_encoding, map->rm_pt, (int) map->rm_rate, codec_ms, map_bit_rate, + rm_encoding, map->rm_pt, (int) map->rm_rate, ptime, map_bit_rate, imp->iananame, imp->ianacode, codec_rate, imp->microseconds_per_packet / 1000, bit_rate); if ((zstr(map->rm_encoding) || (tech_pvt->profile->ndlb & PFLAG_NDLB_ALLOW_BAD_IANANAME)) && map->rm_pt < 96) { match = (map->rm_pt == imp->ianacode) ? 1 : 0; @@ -4270,7 +4368,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s "Bah HUMBUG! Sticking with %s@%uh@%ui\n", imp->iananame, imp->samples_per_second, imp->microseconds_per_packet / 1000); } else { - if ((codec_ms && codec_ms * 1000 != imp->microseconds_per_packet) || map->rm_rate != codec_rate) { + if ((ptime && codec_ms && codec_ms * 1000 != imp->microseconds_per_packet) || map->rm_rate != codec_rate) { near_rate = map->rm_rate; near_match = imp; match = 0; @@ -4337,7 +4435,9 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s } if (match) { - if (sofia_glue_tech_set_codec(tech_pvt, 1) != SWITCH_STATUS_SUCCESS) { + if (sofia_glue_tech_set_codec(tech_pvt, 1) == SWITCH_STATUS_SUCCESS) { + got_audio = 1; + } else { match = 0; } } diff --git a/src/switch_core.c b/src/switch_core.c index 1275b90..2f89c7b 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1423,7 +1423,7 @@ static void switch_load_core_config(const char *file) { switch_xml_t xml = NULL, cfg = NULL; - switch_core_hash_insert(runtime.ptimes, "ilbc", &d_30); + //switch_core_hash_insert(runtime.ptimes, "ilbc", &d_30); switch_core_hash_insert(runtime.ptimes, "G723", &d_30); if ((xml = switch_xml_open_cfg(file, &cfg, NULL))) { diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 5645ea5..7aee9a7 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -1547,12 +1547,91 @@ SWITCH_DECLARE(switch_management_interface_t *) switch_loadable_module_get_manag return switch_core_hash_find_locked(loadable_modules.management_hash, relative_oid, loadable_modules.mutex); } +#ifdef DEBUG_CODEC_SORTING +static void do_print(const switch_codec_implementation_t **array, int arraylen) +{ + int i; + + for(i = 0; i < arraylen; i++) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "DEBUG %d %s:%d %d\n", i, array[i]->iananame, array[i]->ianacode, array[i]->microseconds_per_packet / 1000); + } + +} +#endif + +/* helper only -- bounds checking enforced by caller */ +static void do_swap(const switch_codec_implementation_t **array, int a, int b) +{ + const switch_codec_implementation_t *tmp = array[b]; + array[b] = array[a]; + array[a] = tmp; +} + +static void switch_loadable_module_sort_codecs(const switch_codec_implementation_t **array, int arraylen) +{ + int i = 0, sorted_ptime = 0; + +#ifdef DEBUG_CODEC_SORTING + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "--BEFORE\n"); + do_print(array, arraylen); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "--BEFORE\n"); +#endif + + for (i = 0; i < arraylen; i++) { + int this_ptime = array[i]->microseconds_per_packet / 1000; + + if (!sorted_ptime) { + sorted_ptime = this_ptime; +#ifdef DEBUG_CODEC_SORTING + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "sorted1 = %d\n", sorted_ptime); +#endif + } + + if (this_ptime != sorted_ptime) { + int j; + int swapped = 0; + +#ifdef DEBUG_CODEC_SORTING + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%d != %d\n", this_ptime, sorted_ptime); +#endif + for(j = i; j < arraylen; j++) { + int check_ptime = array[j]->microseconds_per_packet / 1000; + + if (check_ptime == sorted_ptime) { +#ifdef DEBUG_CODEC_SORTING + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "swap %d %d ptime %d\n", i, j, check_ptime); +#endif + do_swap(array, i, j); + swapped = 1; + break; + } + } + + if (!swapped) { + sorted_ptime = this_ptime; +#ifdef DEBUG_CODEC_SORTING + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "sorted2 = %d\n", sorted_ptime); +#endif + } + } + } + +#ifdef DEBUG_CODEC_SORTING + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "--AFTER\n"); + do_print(array, arraylen); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "--AFTER\n"); +#endif + +} + + SWITCH_DECLARE(int) switch_loadable_module_get_codecs(const switch_codec_implementation_t **array, int arraylen) { switch_hash_index_t *hi; void *val; switch_codec_interface_t *codec_interface; - int i = 0, lock = 0; + int i = 0; const switch_codec_implementation_t *imp; switch_mutex_lock(loadable_modules.mutex); @@ -1564,10 +1643,6 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs(const switch_codec_impleme for (imp = codec_interface->implementations; imp; imp = imp->next) { uint32_t default_ptime = switch_default_ptime(imp->iananame, imp->ianacode); - if (lock && imp->microseconds_per_packet != lock) { - continue; - } - if (imp->microseconds_per_packet / 1000 == (int)default_ptime) { array[i++] = imp; goto found; @@ -1578,9 +1653,6 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs(const switch_codec_impleme found: - if (!lock && i > 0) - lock = array[i - 1]->microseconds_per_packet; - if (i > arraylen) { break; } @@ -1588,13 +1660,15 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs(const switch_codec_impleme switch_mutex_unlock(loadable_modules.mutex); + switch_loadable_module_sort_codecs(array, i); + return i; } SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_implementation_t **array, int arraylen, char **prefs, int preflen) { - int x, i = 0, lock = 0; + int x, i = 0; switch_codec_interface_t *codec_interface; const switch_codec_implementation_t *imp; @@ -1635,9 +1709,6 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_ uint32_t default_ptime = switch_default_ptime(imp->iananame, imp->ianacode); if (imp->codec_type != SWITCH_CODEC_TYPE_VIDEO) { - if (lock && imp->microseconds_per_packet != lock) { - continue; - } if ((!interval && (uint32_t) (imp->microseconds_per_packet / 1000) != default_ptime) || (interval && (uint32_t) (imp->microseconds_per_packet / 1000) != interval)) { @@ -1664,10 +1735,6 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_ for (imp = codec_interface->implementations; imp; imp = imp->next) { if (imp->codec_type != SWITCH_CODEC_TYPE_VIDEO) { - if (lock && imp->microseconds_per_packet != lock) { - continue; - } - if (interval && (uint32_t) (imp->microseconds_per_packet / 1000) != interval) { continue; } @@ -1689,10 +1756,6 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_ found: - if (!lock && i > 0) { - lock = array[i - 1]->microseconds_per_packet; - } - UNPROTECT_INTERFACE(codec_interface); if (i > arraylen) { @@ -1704,6 +1767,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_ switch_mutex_unlock(loadable_modules.mutex); + switch_loadable_module_sort_codecs(array, i); return i; } commit 3cd8766b9c9bc04002e2b9d62bec852364ad2314 Author: Michael S Collins <msc@freeswitch.org> Date: Wed Oct 13 16:43:05 2010 -0700 Minor typos in phrase_en.xml diff --git a/docs/phrase/phrase_en.xml b/docs/phrase/phrase_en.xml index 318aba1..65c7017 100644 --- a/docs/phrase/phrase_en.xml +++ b/docs/phrase/phrase_en.xml @@ -384,14 +384,14 @@ <prompt phrase="Good morning." filename="ivr-good_morning.wav"/> <prompt phrase="Good afternoon." filename="ivr-good_afternoon.wav"/> <prompt phrase="Good evening." filename="ivr-good_evening.wav"/> - <prompt phrase="Thank you." filename="ivr-Thank you.wav"/> + <prompt phrase="Thank you." filename="ivr-Thank_you.wav"/> <prompt phrase="For..." filename="ivr-for.wav"/> <prompt phrase="We are experiencing longer than usual hold times." filename="ivr-longer_than_usual_hold_times.wav"/> <prompt phrase="You are the..." filename="ivr-you_are_the.wav"/> <prompt phrase="One moment please." filename="ivr-one_moment_please.wav"/> <prompt phrase="Your call will be answered in the order it was received." filename="ivr-call_answered_order_received.wav"/> <prompt phrase="Please enter the conference number, followed by the pound key" filename="conf-enter_conf_number.wav"/> - <prompt phrase="Enter the conference PIN number, followed by the pound key." filename="ivr-enter_conf_pin.wav"/> + <prompt phrase="Enter the conference PIN number, followed by the pound key." filename="conf-enter_conf_pin.wav"/> <prompt phrase="...has entered the conference." filename="conf-has_joined.wav"/> <prompt phrase="...has left the conference." filename="conf-has_left.wav"/> <prompt phrase="You entered..." filename="ivr-you_entered.wav"/> @@ -403,27 +403,29 @@ <prompt phrase="If this is correct, press 1. If not, press 2." filename="ivr-if_correct_one_if_not_two.wav"/> <prompt phrase="To repeat this information..." filename="ivr-repeat_this_information.wav"/> <prompt phrase="No no no!" filename="ivr-no_no_no.wav"/> - <prompt phrase="Do you mean to press that key?" filename="ivr-did_you_mean_to_press_key.wav"/> + <prompt phrase="Did you mean to press that key?" filename="ivr-did_you_mean_to_press_key.wav"/> <prompt phrase="Seriously. Did you REALLY mean to press that key?" filename="ivr-seriously_mean_to_press_key.wav"/> <prompt phrase="Oh what-EVER." filename="ivr-oh_whatever.wav"/> <prompt phrase="That's it! One more mistake and I WILL hang up on your ass." filename="ivr-one_more_mistake.wav"/> <prompt phrase="Congratulations, you pressed star. This does not mean you ARE a star. It simply means that you can press buttons and probably have fingers." filename="ivr-congratulations_you_pressed_star.wav"/> - <prompt phrase="All of our engineers are busy assisting other sales guys with demonstrating how cool the CudaTel is. Please stay on the line and your call will be answered in the order it was received." filename="ivr-engineers_busy_assisting_other_sales.wav"/> + <prompt phrase="All of our engineers are busy assisting other sales guys with demonstrating how cool the CudaTel is." filename="ivr-engineers_busy_assisting_other_sales.wav"/> <prompt phrase="The person you are trying to reach is not available and does not have voicemail." filename="vm-not_available_no_voicemail.wav"/> <prompt phrase="This message will self-destruct in 5, 4, 3, 2, 1..." filename="ivr-message_self_destruct.wav"/> <prompt phrase="You are already muted." filename="conf-you_are_already_muted.wav"/> <prompt phrase="You are now bi-directionally muted." filename="conf-you_are_now_bidirectionally_muted.wav"/> <prompt phrase="All your call are belong to us." filename="ivr-all_your_call_are_belong_to_us.wav"/> <prompt phrase="I just love the way you press those touch tones!" filename="ivr-love_those_touch_tones.wav"/> - <prompt phrase="Yes we have no bananas." filename="ivr-yes_we_have_no_bananas.wav"/> + <prompt phrase="Yes, we have no bananas." filename="ivr-yes_we_have_no_bananas.wav"/> <prompt phrase="Dude, you suck!" filename="ivr-dude_you_suck.wav"/> <prompt phrase="Your call is very important to us, but your sanity is not, so we will be happy to keep you on hold, forever torturing you with our annoying hold music." filename="ivr-on_hold_indefinitely.wav"/> <prompt phrase="...has left the building." filename="ivr-has_left_the_building.wav"/> <prompt phrase="This phone is unassigned and may not be used to make external calls." filename="ivr-phone_is_unassigned.wav"/> <prompt phrase="This phone is not configured properly." filename="ivr-phone_not_configured.wav"/> + <prompt phrase="Congratulations! This phone is configured properly and may now be assigned to a user." filename="ivr-phone_is_configured_properly.wav"/> <prompt phrase="Please contact the system administrator for assistance." filename="ivr-contact_system_administrator.wav"/> <prompt phrase="Barracuda Networks" filename="ivr-barracuda_networks.wav"/> <prompt phrase="CudaTel Communication Server" filename="ivr-cudatel_communication_server.wav"/> + <prompt phrase="Please enter the first few letters of the person's first or last name" filename="dir-enter_person_first_or_last.wav"/> <prompt phrase="Brian West" filename="misc-Brian_West.wav"/> <prompt phrase="Anthony Minessale" filename="misc-Anthony_Minessale.wav"/> <prompt phrase="Michael Jerris" filename="misc-Michael_Jerris.wav"/> commit fe638ad614f6ac632da23caca430a76e27ca1e98 Merge: 4eb3ec1 c019084 Author: Moises Silva <moy@sangoma.com> Date: Wed Oct 13 18:19:22 2010 -0400 Merge remote branch 'smg_freeswitch/master' commit 4eb3ec14488275e63a223441a021d2ee65574c70 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Oct 13 16:55:40 2010 -0500 update last diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 64a76d4..31d2158 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -40,6 +40,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_conference_load); SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_conference_shutdown); SWITCH_MODULE_DEFINITION(mod_conference, mod_conference_load, mod_conference_shutdown, NULL); +typedef enum { + CONF_SILENT_REQ = (1 << 0), + CONF_SILENT_DONE = (1 << 1) +} conf_app_flag_t; + static const char global_app_name[] = "conference"; static char *global_cf_name = "conference.conf"; static char *cf_pin_url_param_name = "X-ConfPin="; @@ -706,8 +711,8 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe /* stop MoH if any */ conference_stop_file(conference, FILE_STOP_ASYNC); } - if (conference->enter_sound && (!switch_channel_test_flag(channel, CF_RECOVERED) || - switch_true(switch_channel_get_variable(channel, "conference_silent_entry")))) { + + if (!switch_channel_test_app_flag_key("conf_silent", channel, CONF_SILENT_REQ)) { conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), switch_test_flag(conference, CFLAG_WAIT_MOD) ? 0 : 1); } @@ -721,8 +726,8 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe switch_snprintf(saymsg, sizeof(saymsg), "Auto Calling %d parties", call_list->iteration); conference_member_say(member, saymsg, 0); } else { - if (zstr(conference->special_announce) && (!switch_channel_test_flag(channel, CF_RECOVERED) || - switch_true(switch_channel_get_variable(channel, "conference_silent_entry")))) { + + if (!switch_channel_test_app_flag_key("conf_silent", channel, CONF_SILENT_REQ)) { /* announce the total number of members in the conference */ if (conference->count >= conference->announce_count && conference->announce_count > 1) { switch_snprintf(msg, sizeof(msg), "There are %d callers", conference->count); @@ -752,14 +757,14 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe switch_set_flag(conference, CFLAG_ENFORCE_MIN); } - if (test_eflag(conference, EFLAG_ADD_MEMBER) && (!switch_channel_test_flag(channel, CF_RECOVERED) || - switch_true(switch_channel_get_variable(channel, "conference_silent_entry"))) && + if (!switch_channel_test_app_flag_key("conf_silent", channel, CONF_SILENT_REQ) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) { conference_add_event_member_data(member, event); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "add-member"); switch_event_fire(&event); } + switch_channel_clear_app_flag_key("conf_silent", channel, CONF_SILENT_REQ); } unlock_member(member); switch_mutex_unlock(member->audio_out_mutex); @@ -2411,8 +2416,7 @@ static void conference_loop_output(conference_member_t *member) const char *prefix = switch_channel_get_variable(channel, "conference_auto_outcall_prefix"); int to = 60; - if (ann && (!switch_channel_test_flag(channel, CF_RECOVERED) || - switch_true(switch_channel_get_variable(channel, "conference_silent_entry")))) { + if (ann && !switch_channel_test_app_flag_key("conf_silent", channel, CONF_SILENT_REQ)) { member->conference->special_announce = switch_core_strdup(member->conference->pool, ann); } @@ -5333,7 +5337,6 @@ static int setup_media(conference_member_t *member, conference_obj_t *conference } - /* Application interface function that is called from the dialplan to join the channel to a conference */ SWITCH_STANDARD_APP(conference_function) { @@ -5358,7 +5361,10 @@ SWITCH_STANDARD_APP(conference_function) switch_event_t *params = NULL; int locked = 0; - + if (!switch_channel_test_app_flag_key("conf_silent", channel, CONF_SILENT_DONE) && + (switch_channel_test_flag(channel, CF_RECOVERED) || switch_true(switch_channel_get_variable(channel, "conference_silent_entry")))) { + switch_channel_set_app_flag_key("conf_silent", channel, CONF_SILENT_REQ); + } if (switch_channel_answer(channel) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Channel answer failed.\n"); @@ -5661,8 +5667,7 @@ SWITCH_STANDARD_APP(conference_function) } } - if (conference->special_announce && (!switch_channel_test_flag(channel, CF_RECOVERED) || - switch_true(switch_channel_get_variable(channel, "conference_silent_entry")))) { + if (conference->special_announce && !switch_channel_test_app_flag_key("conf_silent", channel, CONF_SILENT_REQ)) { conference_local_play_file(conference, session, conference->special_announce, CONF_DEFAULT_LEADIN, NULL, 0); } commit f42c90365cb253a7956e90e5620a0074e5712936 Author: Brian West <brian@freeswitch.org> Date: Wed Oct 13 16:51:46 2010 -0500 FS-2778: force_local_ip_v4 / _v6 not handled properly in switch_find_local_ip diff --git a/src/switch_utils.c b/src/switch_utils.c index ea5bd37..4a0b818 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -1071,10 +1071,12 @@ SWITCH_DECLARE(switch_status_t) switch_find_local_ip(char *buf, int len, int *ma case AF_INET: if (force_local_ip_v4) { switch_copy_string(buf, force_local_ip_v4, len); + return SWITCH_STATUS_SUCCESS; } case AF_INET6: if (force_local_ip_v6) { switch_copy_string(buf, force_local_ip_v6, len); + return SWITCH_STATUS_SUCCESS; } default: break; commit 54dcb64a4dd2b4e9a20c7d7eaed23e6465570b02 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Oct 13 16:21:53 2010 -0500 typo diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 13d323f..35111a8 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -5000,7 +5000,7 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName const char *var = switch_xml_attr_soft(param, "app_name"); const char *val = switch_xml_attr_soft(param, "app_data"); /* skip announcement type apps */ - if (strcasecmp(var, "speak") && strcasecmp(var, "playback") && strcasecmp(var, "gentones" || strcasecmp(var, "say"))) { + if (strcasecmp(var, "speak") && strcasecmp(var, "playback") && strcasecmp(var, "gentones") && strcasecmp(var, "say")) { switch_caller_extension_add_application(session, extension, var, val); } } commit c0190847e32fb35170ece910812e51bfb33829ba Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Oct 13 14:18:38 2010 -0700 Changed permissions for devel-bootstrap.sh diff --git a/devel-bootstrap.sh b/devel-bootstrap.sh old mode 100644 new mode 100755 commit 93c2ed941a5c659f701dd8987e23dbb3156f1daa Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Oct 13 16:17:36 2010 -0500 silent recovery diff --git a/src/include/switch_types.h b/src/include/switch_types.h index d027549..cf27cb7 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1063,6 +1063,7 @@ typedef enum { CF_CONSUME_ON_ORIGINATE, CF_PASSTHRU_PTIME_MISMATCH, CF_BRIDGE_NOWRITE, + CF_RECOVERED, /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ CF_FLAG_MAX } switch_channel_flag_t; diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index ac57dc0..64a76d4 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -698,20 +698,21 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe switch_clear_flag(conference, CFLAG_WAIT_MOD); } + channel = switch_core_session_get_channel(member->session); + switch_channel_set_variable_printf(channel, "conference_member_id", "%d", member->id); + if (conference->count > 1) { if (conference->moh_sound && !switch_test_flag(conference, CFLAG_WAIT_MOD)) { /* stop MoH if any */ conference_stop_file(conference, FILE_STOP_ASYNC); } - if (conference->enter_sound) { + if (conference->enter_sound && (!switch_channel_test_flag(channel, CF_RECOVERED) || + switch_true(switch_channel_get_variable(channel, "conference_silent_entry")))) { conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), switch_test_flag(conference, CFLAG_WAIT_MOD) ? 0 : 1); } } - channel = switch_core_session_get_channel(member->session); - switch_channel_set_variable_printf(channel, "conference_member_id", "%d", member->id); - call_list = (call_list_t *) switch_channel_get_private(channel, "_conference_autocall_list_"); @@ -720,7 +721,8 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe switch_snprintf(saymsg, sizeof(saymsg), "Auto Calling %d parties", call_list->iteration); conference_member_say(member, saymsg, 0); } else { - if (zstr(conference->special_announce)) { + if (zstr(conference->special_announce) && (!switch_channel_test_flag(channel, CF_RECOVERED) || + switch_true(switch_channel_get_variable(channel, "conference_silent_entry")))) { /* announce the total number of members in the conference */ if (conference->count >= conference->announce_count && conference->announce_count > 1) { switch_snprintf(msg, sizeof(msg), "There are %d callers", conference->count); @@ -750,7 +752,8 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe switch_set_flag(conference, CFLAG_ENFORCE_MIN); } - if (test_eflag(conference, EFLAG_ADD_MEMBER) && + if (test_eflag(conference, EFLAG_ADD_MEMBER) && (!switch_channel_test_flag(channel, CF_RECOVERED) || + switch_true(switch_channel_get_variable(channel, "conference_silent_entry"))) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) { conference_add_event_member_data(member, event); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "add-member"); @@ -2408,7 +2411,8 @@ static void conference_loop_output(conference_member_t *member) const char *prefix = switch_channel_get_variable(channel, "conference_auto_outcall_prefix"); int to = 60; - if (ann) { + if (ann && (!switch_channel_test_flag(channel, CF_RECOVERED) || + switch_true(switch_channel_get_variable(channel, "conference_silent_entry")))) { member->conference->special_announce = switch_core_strdup(member->conference->pool, ann); } @@ -5657,7 +5661,8 @@ SWITCH_STANDARD_APP(conference_function) } } - if (conference->special_announce) { + if (conference->special_announce && (!switch_channel_test_flag(channel, CF_RECOVERED) || + switch_true(switch_channel_get_variable(channel, "conference_silent_entry")))) { conference_local_play_file(conference, session, conference->special_announce, CONF_DEFAULT_LEADIN, NULL, 0); } diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index cb8b257..13d323f 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -4999,7 +4999,10 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName for (param = switch_xml_child(x_extension, "application"); param; param = param->next) { const char *var = switch_xml_attr_soft(param, "app_name"); const char *val = switch_xml_attr_soft(param, "app_data"); - switch_caller_extension_add_application(session, extension, var, val); + /* skip announcement type apps */ + if (strcasecmp(var, "speak") && strcasecmp(var, "playback") && strcasecmp(var, "gentones" || strcasecmp(var, "say"))) { + switch_caller_extension_add_application(session, extension, var, val); + } } } diff --git a/src/switch_channel.c b/src/switch_channel.c index 9e76b46..0b1b6e8 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -1335,6 +1335,10 @@ SWITCH_DECLARE(void) switch_channel_set_flag_value(switch_channel_t *channel, sw switch_channel_set_variable(channel, "is_outbound", "true"); } + if (flag == CF_RECOVERED) { + switch_channel_set_variable(channel, "recovered", "true"); + } + } SWITCH_DECLARE(void) switch_channel_set_flag_recursive(switch_channel_t *channel, switch_channel_flag_t flag) @@ -1349,6 +1353,10 @@ SWITCH_DECLARE(void) switch_channel_set_flag_recursive(switch_channel_t *channel if (flag == CF_OUTBOUND) { switch_channel_set_variable(channel, "is_outbound", "true"); } + + if (flag == CF_RECOVERED) { + switch_channel_set_variable(channel, "recovered", "true"); + } } @@ -1461,6 +1469,10 @@ SWITCH_DECLARE(void) switch_channel_clear_flag(switch_channel_t *channel, switch if (flag == CF_OUTBOUND) { switch_channel_set_variable(channel, "is_outbound", NULL); } + + if (flag == CF_RECOVERED) { + switch_channel_set_variable(channel, "recovered", NULL); + } } diff --git a/src/switch_core_session.c b/src/switch_core_session.c index c8aca7d..1589beb 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -1437,7 +1437,7 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_xml(switch_e } } } - + if ((callflow = switch_xml_child(xml, "callflow"))) { if ((tag2 = switch_xml_child(callflow, "caller_profile"))) { switch_caller_profile_t *caller_profile; @@ -1528,6 +1528,8 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_xml(switch_e } + + switch_channel_set_flag(channel, CF_RECOVERED); } diff --git a/src/switch_core_state_machine.c b/src/switch_core_state_machine.c index 2b8a6ce..27579c2 100644 --- a/src/switch_core_state_machine.c +++ b/src/switch_core_state_machine.c @@ -156,9 +156,13 @@ static void switch_core_standard_on_execute(switch_core_session_t *session) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Standard EXECUTE\n", switch_channel_get_name(session->channel)); + if (switch_channel_get_variable(session->channel, "recovered") && !switch_channel_test_flag(session->channel, CF_RECOVERED)) { + switch_channel_set_flag(session->channel, CF_RECOVERED); + } + top: switch_channel_clear_flag(session->channel, CF_RESET); - + if ((extension = switch_channel_get_caller_extension(session->channel)) == 0) { switch_channel_hangup(session->channel, SWITCH_CAUSE_NORMAL_CLEARING); return; commit fee4f5507b31e76040533489c7ed4b52352deb66 Author: Arnaldo M Pereira <egghunt@gmail.com> Date: Wed Oct 13 17:15:21 2010 -0300 freetdm: fixes to build on win32 diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index bc92835..d575fcd 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -38,8 +38,12 @@ #include <stdio.h> #include <string.h> #include <stdarg.h> +#ifdef HAVE_STDINT_H #include <stdint.h> +#endif +#ifdef HAVE_UNISTD_H #include <unistd.h> +#endif #include <ctype.h> #include "private/ftdm_core.h" diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c index cea8ac0..27c16c2 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c @@ -158,7 +158,7 @@ ftdm_status_t sng_isdn_deactivate_phy(ftdm_span_t *span) ftdm_status_t sng_isdn_activate_cc(ftdm_span_t *span) { - CcMngmt cntrl;; + CcMngmt cntrl; Pst pst; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; @@ -239,7 +239,7 @@ ftdm_status_t sng_isdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t tra ftdm_status_t sng_isdn_cntrl_q931(ftdm_span_t *span, uint8_t action, uint8_t subaction) { - InMngmt cntrl;; + InMngmt cntrl; Pst pst; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 827647f..cb32730 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -42,7 +42,6 @@ extern ftdm_status_t cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Displ /* Remote side transmit a SETUP */ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); unsigned i; int16_t suId = sngisdn_event->suId; uint32_t suInstId = sngisdn_event->suInstId; @@ -54,6 +53,8 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; ConEvnt *conEvnt = &sngisdn_event->event.conEvnt; + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n"); ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_DEBUG, "Processing SETUP (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); @@ -241,8 +242,6 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) /* Remote side transmit a CONNECT or CONNECT ACK */ void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - int16_t suId = sngisdn_event->suId; uint32_t suInstId = sngisdn_event->suInstId; uint32_t spInstId = sngisdn_event->spInstId; @@ -250,6 +249,8 @@ void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event) sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + /* Function does not require any info from conStEvnt struct for now */ /* CnStEvnt *cnStEvnt = &sngisdn_event->event.cnStEvnt; */ @@ -313,8 +314,6 @@ void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event) void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - int16_t suId = sngisdn_event->suId; uint32_t suInstId = sngisdn_event->suInstId; uint32_t spInstId = sngisdn_event->spInstId; @@ -328,6 +327,8 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) CnStEvnt *cnStEvnt = &sngisdn_event->event.cnStEvnt; + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n"); ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing %s (suId:%u suInstId:%u spInstId:%u ces:%d)\n", @@ -445,8 +446,6 @@ sngisdn_process_cnst_ind_end: void sngisdn_process_disc_ind (sngisdn_event_data_t *sngisdn_event) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - int16_t suId = sngisdn_event->suId; uint32_t suInstId = sngisdn_event->suInstId; uint32_t spInstId = sngisdn_event->spInstId; @@ -455,6 +454,8 @@ void sngisdn_process_disc_ind (sngisdn_event_data_t *sngisdn_event) DiscEvnt *discEvnt = &sngisdn_event->event.discEvnt; + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing DISCONNECT (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n"); @@ -502,7 +503,6 @@ void sngisdn_process_disc_ind (sngisdn_event_data_t *sngisdn_event) void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); int16_t suId = sngisdn_event->suId; uint32_t suInstId = sngisdn_event->suInstId; uint32_t spInstId = sngisdn_event->spInstId; @@ -511,6 +511,8 @@ void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event) RelEvnt *relEvnt = &sngisdn_event->event.relEvnt; + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing RELEASE/RELEASE COMPLETE (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n"); @@ -597,7 +599,6 @@ void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event) void sngisdn_process_dat_ind (sngisdn_event_data_t *sngisdn_event) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); int16_t suId = sngisdn_event->suId; uint32_t suInstId = sngisdn_event->suInstId; uint32_t spInstId = sngisdn_event->spInstId; @@ -605,6 +606,8 @@ void sngisdn_process_dat_ind (sngisdn_event_data_t *sngisdn_event) sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + /* Function does not require any info from infoEvnt struct for now */ /* InfoEvnt *infoEvnt = &sngisdn_event->event.infoEvnt; */ @@ -615,7 +618,6 @@ void sngisdn_process_dat_ind (sngisdn_event_data_t *sngisdn_event) void sngisdn_process_sshl_ind (sngisdn_event_data_t *sngisdn_event) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); int16_t suId = sngisdn_event->suId; uint32_t suInstId = sngisdn_event->suInstId; uint32_t spInstId = sngisdn_event->spInstId; @@ -623,6 +625,8 @@ void sngisdn_process_sshl_ind (sngisdn_event_data_t *sngisdn_event) sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + /* Function does not require any info from ssHlEvnt struct for now */ /* SsHlEvnt *ssHlEvnt = &sngisdn_event->event.ssHlEvnt; */ @@ -633,14 +637,15 @@ void sngisdn_process_sshl_ind (sngisdn_event_data_t *sngisdn_event) void sngisdn_process_sshl_cfm (sngisdn_event_data_t *sngisdn_event) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); int16_t suId = sngisdn_event->suId; uint32_t suInstId = sngisdn_event->suInstId; uint32_t spInstId = sngisdn_event->spInstId; - + sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + /* Function does not require any info from ssHlEvnt struct for now */ /* SsHlEvnt *ssHlEvnt = &sngisdn_event->event.ssHlEvnt; */ @@ -651,7 +656,6 @@ void sngisdn_process_sshl_cfm (sngisdn_event_data_t *sngisdn_event) void sngisdn_process_rmrt_ind (sngisdn_event_data_t *sngisdn_event) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); int16_t suId = sngisdn_event->suId; uint32_t suInstId = sngisdn_event->suInstId; uint32_t spInstId = sngisdn_event->spInstId; @@ -659,6 +663,8 @@ void sngisdn_process_rmrt_ind (sngisdn_event_data_t *sngisdn_event) sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + /* Function does not require any info from ssHlEvnt struct for now */ /* RmRtEvnt *rmRtEvnt = &sngisdn_event->event.rmRtEvnt; */ @@ -669,7 +675,6 @@ void sngisdn_process_rmrt_ind (sngisdn_event_data_t *sngisdn_event) void sngisdn_process_rmrt_cfm (sngisdn_event_data_t *sngisdn_event) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); int16_t suId = sngisdn_event->suId; uint32_t suInstId = sngisdn_event->suInstId; uint32_t spInstId = sngisdn_event->spInstId; @@ -677,6 +682,8 @@ void sngisdn_process_rmrt_cfm (sngisdn_event_data_t *sngisdn_event) sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + /* Function does not require any info from ssHlEvnt struct for now */ /* RmRtEvnt *rmRtEvnt = &sngisdn_event->event.rmRtEvnt; */ @@ -687,7 +694,6 @@ void sngisdn_process_rmrt_cfm (sngisdn_event_data_t *sngisdn_event) void sngisdn_process_flc_ind (sngisdn_event_data_t *sngisdn_event) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); int16_t suId = sngisdn_event->suId; uint32_t suInstId = sngisdn_event->suInstId; uint32_t spInstId = sngisdn_event->spInstId; @@ -695,6 +701,8 @@ void sngisdn_process_flc_ind (sngisdn_event_data_t *sngisdn_event) sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + /* Function does not require any info from ssHlEvnt struct for now */ /* StaEvnt *staEvnt = &sngisdn_event->event.staEvnt; */ @@ -705,8 +713,6 @@ void sngisdn_process_flc_ind (sngisdn_event_data_t *sngisdn_event) void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - int16_t suId = sngisdn_event->suId; uint32_t suInstId = sngisdn_event->suInstId; uint32_t spInstId = sngisdn_event->spInstId; @@ -717,6 +723,8 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event) FacEvnt *facEvnt = &sngisdn_event->event.facEvnt; + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing FACILITY IND (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); switch (ftdmchan->state) { @@ -758,8 +766,6 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event) void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - int16_t suId = sngisdn_event->suId; uint32_t suInstId = sngisdn_event->suInstId; uint32_t spInstId = sngisdn_event->spInstId; @@ -770,6 +776,8 @@ void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event) uint8_t call_state = 0; + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + if (staEvnt->callSte.eh.pres && staEvnt->callSte.callGlblSte.pres) { call_state = staEvnt->callSte.callGlblSte.val; } @@ -983,11 +991,12 @@ void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event) void sngisdn_process_srv_ind (sngisdn_event_data_t *sngisdn_event) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); int16_t suId = sngisdn_event->suId; int16_t dChan = sngisdn_event->dChan; uint8_t ces = sngisdn_event->ces; + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + /* Function does not require any info from ssHlEvnt struct for now */ /*Srv *srvEvnt = &sngisdn_event->event.srvEvnt;*/ @@ -998,11 +1007,12 @@ void sngisdn_process_srv_ind (sngisdn_event_data_t *sngisdn_event) void sngisdn_process_srv_cfm (sngisdn_event_data_t *sngisdn_event) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); int16_t suId = sngisdn_event->suId; int16_t dChan = sngisdn_event->dChan; uint8_t ces = sngisdn_event->ces; + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + /* Function does not require any info from ssHlEvnt struct for now */ /*Srv *srvEvnt = &sngisdn_event->event.srvEvnt;*/ @@ -1013,12 +1023,13 @@ void sngisdn_process_srv_cfm (sngisdn_event_data_t *sngisdn_event) void sngisdn_process_rst_cfm (sngisdn_event_data_t *sngisdn_event) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); int16_t suId = sngisdn_event->suId; int16_t dChan = sngisdn_event->dChan; uint8_t ces = sngisdn_event->ces; uint8_t evntType = sngisdn_event->evntType; + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + /* Function does not require any info from ssHlEvnt struct for now */ /*Rst *rstEvnt = &sngisdn_event->event.rstEvnt;*/ @@ -1030,12 +1041,13 @@ void sngisdn_process_rst_cfm (sngisdn_event_data_t *sngisdn_event) void sngisdn_process_rst_ind (sngisdn_event_data_t *sngisdn_event) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); int16_t suId = sngisdn_event->suId; int16_t dChan = sngisdn_event->dChan; uint8_t ces = sngisdn_event->ces; uint8_t evntType = sngisdn_event->evntType; + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + /* Function does not require any info from ssHlEvnt struct for now */ /*Rst *rstEvnt = &sngisdn_event->event.rstEvnt;*/ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c index 9bf6053..5580f3a 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c @@ -43,11 +43,12 @@ extern void get_memory_info(void); void sngisdn_rcv_con_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, ConEvnt *conEvnt, int16_t dChan, uint8_t ces) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); uint8_t bchan_no = 0; sngisdn_chan_data_t *sngisdn_info = NULL; sngisdn_event_data_t *sngisdn_event = NULL; + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + ftdm_assert(g_sngisdn_data.ccs[suId].activation_done != 0, "Con Ind on unconfigured cc\n"); ftdm_assert(g_sngisdn_data.dchans[dChan].num_spans != 0, "Con Ind on unconfigured dchan\n"); @@ -103,10 +104,11 @@ void sngisdn_rcv_con_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, Co void sngisdn_rcv_con_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, CnStEvnt *cnStEvnt, int16_t dChan, uint8_t ces) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); sngisdn_chan_data_t *sngisdn_info = NULL; sngisdn_event_data_t *sngisdn_event = NULL; + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + ftdm_assert(g_sngisdn_data.ccs[suId].activation_done != 0, "Con Cfm on unconfigured cc\n"); ftdm_assert(g_sngisdn_data.dchans[dChan].num_spans != 0, "Con Cfm on unconfigured dchan\n"); @@ -146,10 +148,11 @@ void sngisdn_rcv_con_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, Cn void sngisdn_rcv_cnst_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, CnStEvnt *cnStEvnt, uint8_t evntType, int16_t dChan, uint8_t ces) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); sngisdn_chan_data_t *sngisdn_info = NULL; sngisdn_event_data_t *sngisdn_event = NULL; + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + ftdm_assert(g_sngisdn_data.ccs[suId].activation_done != 0, "Cnst Ind on unconfigured cc\n"); ftdm_assert(g_sngisdn_data.dchans[dChan].num_spans != 0, "Cnst Ind on unconfigured dchan\n"); @@ -196,10 +199,11 @@ void sngisdn_rcv_cnst_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, C void sngisdn_rcv_disc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, DiscEvnt *discEvnt) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); sngisdn_chan_data_t *sngisdn_info = NULL; sngisdn_event_data_t *sngisdn_event = NULL; + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + ftdm_assert(spInstId != 0, "Received DISCONNECT with invalid id"); if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && @@ -231,9 +235,10 @@ void sngisdn_rcv_disc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, D void sngisdn_rcv_rel_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, RelEvnt *relEvnt) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); sngisdn_chan_data_t *sngisdn_info = NULL; sngisdn_event_data_t *sngisdn_event = NULL; + + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { @@ -264,10 +269,11 @@ void sngisdn_rcv_rel_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, Re void sngisdn_rcv_dat_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, InfoEvnt *infoEvnt) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); sngisdn_chan_data_t *sngisdn_info; sngisdn_event_data_t *sngisdn_event = NULL; + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { @@ -296,9 +302,10 @@ void sngisdn_rcv_dat_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, In void sngisdn_rcv_sshl_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, SsHlEvnt *ssHlEvnt, uint8_t action) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); sngisdn_chan_data_t *sngisdn_info; sngisdn_event_data_t *sngisdn_event = NULL; + + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { @@ -329,9 +336,10 @@ void sngisdn_rcv_sshl_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, S void sngisdn_rcv_sshl_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, SsHlEvnt *ssHlEvnt, uint8_t action) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); sngisdn_chan_data_t *sngisdn_info; sngisdn_event_data_t *sngisdn_event = NULL; + + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { @@ -361,9 +369,10 @@ void sngisdn_rcv_sshl_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, S } void sngisdn_rcv_rmrt_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, RmRtEvnt *rmRtEvnt, uint8_t action) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); sngisdn_chan_data_t *sngisdn_info; sngisdn_event_data_t *sngisdn_event = NULL; + + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { @@ -394,9 +403,10 @@ void sngisdn_rcv_rmrt_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, R void sngisdn_rcv_rmrt_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, RmRtEvnt *rmRtEvnt, uint8_t action) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); sngisdn_chan_data_t *sngisdn_info; sngisdn_event_data_t *sngisdn_event = NULL; + + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { @@ -427,9 +437,10 @@ void sngisdn_rcv_rmrt_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, R void sngisdn_rcv_flc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, StaEvnt *staEvnt) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); sngisdn_chan_data_t *sngisdn_info; sngisdn_event_data_t *sngisdn_event = NULL; + + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { @@ -460,9 +471,10 @@ void sngisdn_rcv_flc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, St void sngisdn_rcv_fac_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, FacEvnt *facEvnt, uint8_t evntType, int16_t dChan, uint8_t ces) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); sngisdn_chan_data_t *sngisdn_info; sngisdn_event_data_t *sngisdn_event = NULL; + + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { @@ -493,9 +505,10 @@ void sngisdn_rcv_fac_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, Fa void sngisdn_rcv_sta_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, StaEvnt *staEvnt) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); sngisdn_chan_data_t *sngisdn_info; sngisdn_event_data_t *sngisdn_event = NULL; + + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { @@ -525,11 +538,12 @@ void sngisdn_rcv_sta_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, St void sngisdn_rcv_srv_ind (int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); unsigned i; sngisdn_span_data_t *signal_data; sngisdn_event_data_t *sngisdn_event = NULL; + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + ftdm_log(FTDM_LOG_INFO, "Received SERVICE IND (dChan:%d ces:%u)\n", dChan, ces); /* Enqueue the event to each span within the dChan */ @@ -554,11 +568,12 @@ void sngisdn_rcv_srv_ind (int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces void sngisdn_rcv_srv_cfm (int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); unsigned i; sngisdn_span_data_t *signal_data = NULL; sngisdn_event_data_t *sngisdn_event = NULL; + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + ftdm_log(FTDM_LOG_INFO, "Received SERVICE CFM (dChan:%d ces:%u)\n", dChan, ces); /* Enqueue the event to each span within the dChan */ @@ -582,11 +597,12 @@ void sngisdn_rcv_srv_cfm (int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces void sngisdn_rcv_rst_ind (int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces, uint8_t evntType) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); unsigned i; sngisdn_span_data_t *signal_data = NULL; sngisdn_event_data_t *sngisdn_event = NULL; + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + ftdm_log(FTDM_LOG_INFO, "Received RESTART IND (dChan:%d ces:%u type:%u)\n", dChan, ces, evntType); /* Enqueue the event to each span within the dChan */ @@ -612,11 +628,12 @@ void sngisdn_rcv_rst_ind (int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces void sngisdn_rcv_rst_cfm (int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces, uint8_t evntType) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); unsigned i; sngisdn_span_data_t *signal_data; sngisdn_event_data_t *sngisdn_event = NULL; + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + ftdm_log(FTDM_LOG_INFO, "Received RESTART CFM (dChan:%d ces:%u type:%u)\n", dChan, ces, evntType); /* Enqueue the event to each span within the dChan */ commit ffd28c193079a1e720a32b85b0a4727bcc869f92 Author: Jeff Lenk <jeff@jefflenk.com> Date: Wed Oct 13 10:59:34 2010 -0500 fix build windows diff --git a/src/switch_utils.c b/src/switch_utils.c index aa8f413..ea5bd37 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -1515,7 +1515,7 @@ SWITCH_DECLARE(char *) get_addr6(char *buf, switch_size_t len, struct sockaddr_i if (sa) { #if defined(NTDDI_VERSION) - switch_inet_ntop6((unsigned char*)sa->sin6_addr, buf, len); + switch_inet_ntop6((unsigned char*)&(sa->sin6_addr), buf, len); #else inet_ntop(AF_INET6, &(sa->sin6_addr), buf, len); #endif commit 4e5911c2914392c2c2b5fa2d22773064bc9177fb Author: Brian West <brian@freeswitch.org> Date: Wed Oct 13 09:17:31 2010 -0500 FS-2776: FS uses IPv6 under Proxy mode, and SIP Phone uses 6to4 tunneling IPv6 address, cause hearing nothing. diff --git a/src/switch_utils.c b/src/switch_utils.c index b887904..aa8f413 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -1515,9 +1515,9 @@ SWITCH_DECLARE(char *) get_addr6(char *buf, switch_size_t len, struct sockaddr_i if (sa) { #if defined(NTDDI_VERSION) - switch_inet_ntop6((unsigned char*)sa, buf, len); + switch_inet_ntop6((unsigned char*)sa->sin6_addr, buf, len); #else - inet_ntop(AF_INET6, sa, buf, len); + inet_ntop(AF_INET6, &(sa->sin6_addr), buf, len); #endif } commit 890871ba4d564fb8940e927b0733e57e894808a7 Author: Brian West <brian@freeswitch.org> Date: Wed Oct 13 09:12:58 2010 -0500 FS-2777: You know this is only an example of how to use FreeSWITCH, this config needs to be rewritten its turning into a beast diff --git a/conf/dialplan/default.xml b/conf/dialplan/default.xml index 8bdcfa0..42a3bcc 100644 --- a/conf/dialplan/default.xml +++ b/conf/dialplan/default.xml @@ -95,7 +95,7 @@ <extension name="global-intercept"> <condition field="destination_number" expression="^886$"> <action application="answer"/> - <action application="intercept" data="${hash(select/${domain_name}-last_dial/global)}"/> + <action application="intercept" data="${hash(select/${domain_name}-last_dial_ext/global)}"/> <action application="sleep" data="2000"/> </condition> </extension> @@ -103,7 +103,7 @@ <extension name="group-intercept"> <condition field="destination_number" expression="^\*8$"> <action application="answer"/> - <action application="intercept" data="${hash(select/${domain_name}-last_dial/${callgroup})}"/> + <action application="intercept" data="${hash(select/${domain_name}-last_dial_ext/${callgroup})}"/> <action application="sleep" data="2000"/> </condition> </extension> @@ -260,6 +260,8 @@ <action application="set" data="continue_on_fail=true"/> <action application="hash" data="insert/${domain_name}-call_return/${dialed_extension}/${caller_id_number}"/> <action application="hash" data="insert/${domain_name}-last_dial_ext/${dialed_extension}/${uuid}"/> + <action application="hash" data="insert/${domain_name}-last_dial_ext/${called_party_callgroup}/${uuid}"/> + <action application="hash" data="insert/${domain_name}-last_dial_ext/global/${uuid}"/> <action application="set" data="called_party_callgroup=${user_data(${dialed_extension}@${domain_name} var callgroup)}"/> <!--<action application="export" data="nolocal:sip_secure_media=${user_data(${dialed_extension}@${domain_name} var sip_secure_media)}"/>--> <action application="hash" data="insert/${domain_name}-last_dial/${called_party_callgroup}/${uuid}"/> commit 70d592aeba20e74a17480a548db3d217d94b5283 Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Wed Oct 13 01:40:18 2010 -0400 mod_callcenter: Allow to get queue info via api diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index ddd2cd5..56c817a 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -2631,7 +2631,21 @@ SWITCH_STANDARD_API(cc_config_api_function) } } else if (action && !strcasecmp(action, "list")) { if (argc-initial_argc < 1) { - stream->write_function(stream, "%s", "-ERR Invalid!\n"); + switch_hash_index_t *hi; + stream->write_function(stream, "%s", "name|strategy|moh_sound|time_base_score|tier_rules_apply|tier_rule_wait_second|tier_rule_wait_multiply_level|tier_rule_no_agent_no_wait|discard_abandoned_after|abandoned_resume_allowed|max_wait_time|max_wait_time_with_no_agent|record_template\n"); + switch_mutex_lock(globals.mutex); + for (hi = switch_hash_first(NULL, globals.queue_hash); hi; hi = switch_hash_next(hi)) { + void *val = NULL; + const void *key; + switch_ssize_t keylen; + cc_queue_t *queue; + switch_hash_this(hi, &key, &keylen, &val); + queue = (cc_queue_t *) val; + stream->write_function(stream, "%s|%s|%s|%s|%s|%d|%s|%s|%d|%s|%d|%d|%s\n", queue->name, queue->strategy, queue->moh, queue->time_base_score, (queue->tier_rules_apply?"true":"false"), queue->tier_rule_wait_second, (queue->tier_rule_wait_multiply_level?"true":"false"), (queue->tier_rule_no_agent_no_wait?"true":"false"), queue->discard_abandoned_after, (queue->abandoned_resume_allowed?"true":"false"), queue->max_wait_time, queue->max_wait_time_with_no_agent, queue->record_template); + queue = NULL; + } + switch_mutex_unlock(globals.mutex); + stream->write_function(stream, "%s", "+OK\n"); goto done; } else { const char *queue_name = argv[0 + initial_argc]; commit 4b86794dea0406ea09c6fc92911c48d87d7c1f4b Author: Mathieu Rene <mrene@avgs.ca> Date: Tue Oct 12 16:52:16 2010 -0400 typo diff --git a/src/fs_encode.c b/src/fs_encode.c index 15e6538..9517802 100644 --- a/src/fs_encode.c +++ b/src/fs_encode.c @@ -224,8 +224,8 @@ end: return r; usage: printf("Usage: %s [options] input output\n\n", argv[0]); - printf("The output must end in the format, eg: myfile.SPEEX\n"); - printf("\t\t -l module[,module]\t Load additional modules (coma-separated)\n"); + printf("The output must end in the format, e.g., myfile.SPEEX\n"); + printf("\t\t -l module[,module]\t Load additional modules (comma-separated)\n"); printf("\t\t -f format\t\t fmtp to pass to the codec\n"); printf("\t\t -p ptime\t\t ptime to use while encoding\n"); printf("\t\t -r rate\t\t sampling rate\n"); commit cd124ad802326bcad36c2342b46b65e6290c50ae Author: Moises Silva <moy@sangoma.com> Date: Tue Oct 12 12:19:17 2010 -0400 mod_sangoma_codec: more timing debug code diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index da8d7fe..697134b 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -137,6 +137,7 @@ struct codec_data { /* avg Rx time */ switch_time_t avgrxus; switch_time_t last_rx_time; + switch_time_t last_func_call_time; /* RTP queue. The bigger the queue, the bigger the possible delay */ struct sangoma_rtp_payload rtp_queue[SANGOMA_RTP_QUEUE_SIZE]; @@ -386,7 +387,7 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec switch_frame_t encoded_frame; switch_status_t sres; switch_time_t now_time, difftime; - switch_time_t prevread_time, afterread_time; + switch_time_t func_start_time, func_end_time; unsigned char ebuf_ulaw[decoded_data_len / 2]; short *dbuf_linear; int i = 0; @@ -394,7 +395,7 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec struct sangoma_transcoding_session *sess = codec->private_info; if (sess->encoder.debug_timing) { - prevread_time = switch_micro_time_now(); + func_start_time = switch_micro_time_now(); } /* start assuming we will not encode anything */ @@ -416,13 +417,10 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec switch_mutex_unlock(g_sessions_lock); } - if (sess->encoder.debug_timing) { - now_time = switch_micro_time_now(); - if (sess->encoder.last_rx_time) { - difftime = now_time - sess->encoder.last_rx_time; - if (difftime > 25000 || difftime < 15000) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "%ldus since last read on encoding session %lu.\n", (long)difftime, sess->sessid); - } + if (sess->encoder.debug_timing && sess->encoder.last_func_call_time) { + difftime = func_start_time - sess->encoder.last_func_call_time; + if (difftime > 25000 || difftime < 15000) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "%ldus since last read on encoding session %lu\n", (long)difftime, sess->sessid); } } @@ -551,11 +549,12 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec } if (sess->encoder.debug_timing) { - afterread_time = switch_micro_time_now(); - difftime = afterread_time - prevread_time; + func_end_time = switch_micro_time_now(); + difftime = func_end_time - func_start_time; if (difftime > 5000) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "%ldus to execute encoding function in session %lu.\n", (long)difftime, sess->sessid); } + sess->encoder.last_func_call_time = func_end_time; } return SWITCH_STATUS_SUCCESS; } @@ -576,14 +575,14 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses switch_frame_t ulaw_frame; switch_status_t sres; switch_time_t now_time, difftime; - switch_time_t prevread_time, afterread_time; + switch_time_t func_start_time, func_end_time; short *dbuf_linear; int i = 0; int res = 0; struct sangoma_transcoding_session *sess = codec->private_info; if (sess->decoder.debug_timing) { - prevread_time = switch_micro_time_now(); + func_start_time = switch_micro_time_now(); } dbuf_linear = decoded_data; @@ -613,13 +612,10 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses switch_mutex_unlock(g_sessions_lock); } - if (sess->decoder.debug_timing) { - now_time = switch_micro_time_now(); - if (sess->decoder.last_rx_time) { - difftime = now_time - sess->decoder.last_rx_time; - if (difftime > 25000 || difftime < 15000) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%ldms since last read on decoding session %lu.\n", (long)difftime, sess->sessid); - } + if (sess->decoder.debug_timing && sess->decoder.last_func_call_time) { + difftime = func_start_time - sess->decoder.last_func_call_time; + if (difftime > 25000 || difftime < 15000) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%ldms since last read on decoding session %lu.\n", (long)difftime, sess->sessid); } } @@ -743,11 +739,12 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses } if (sess->decoder.debug_timing) { - afterread_time = switch_micro_time_now(); - difftime = afterread_time - prevread_time; + func_end_time = switch_micro_time_now(); + difftime = func_end_time - func_start_time; if (difftime > 5000) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%ldus to execute decoding function in session %lu.\n", (long)difftime, sess->sessid); } + sess->decoder.last_func_call_time = func_end_time; } return SWITCH_STATUS_SUCCESS; commit 6e06ba09eb808f8a439b1bad3ef1d334537d6a2d Author: Moises Silva <moy@sangoma.com> Date: Tue Oct 12 11:58:40 2010 -0400 mod_sangoma_codec: ignore cng frames diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index 60ac3ef..da8d7fe 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -476,8 +476,18 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec break; } - if (encoded_frame.payload != codec->implementation->ianacode - && encoded_frame.payload != IANACODE_CN) { + if (encoded_frame.payload == IANACODE_CN) { + /* confort noise is treated as silence by us */ + continue; + } + + if (encoded_frame.datalen != codec->implementation->encoded_bytes_per_packet) { + /* seen when silence suppression is enabled */ + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Ignoring encoded frame of %d bytes intead of %d bytes\n", encoded_frame.datalen, codec->implementation->encoded_bytes_per_packet); + continue; + } + + if (encoded_frame.payload != codec->implementation->ianacode) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read unexpected payload %d in Sangoma encoder RTP session, expecting %d\n", encoded_frame.payload, codec->implementation->ianacode); break; @@ -657,13 +667,18 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses break; } - if (ulaw_frame.payload != IANA_ULAW - && ulaw_frame.payload != IANACODE_CN) { + if (ulaw_frame.payload == IANACODE_CN) { + /* confort noise is treated as silence by us */ + continue; + } + + if (ulaw_frame.payload != IANA_ULAW) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read unexpected payload %d in Sangoma decoder RTP session, expecting %d\n", ulaw_frame.payload, IANA_ULAW); break; } + if (sess->decoder.queue_windex == sess->decoder.queue_rindex) { if (sess->decoder.rtp_queue[sess->decoder.queue_rindex].datalen) { /* if there is something where we want to write, we're dropping it */ commit 70964c3a2c137f608cf0e756377c8471f7d5d82b Author: Moises Silva <moy@sangoma.com> Date: Tue Oct 12 09:31:05 2010 -0400 mod_sangoma_codec: add some debug code diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index c84dac4..60ac3ef 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -108,6 +108,12 @@ static char g_codec_register_list[1024] = "all"; /* default codec list to NOT load, users may override */ static char g_codec_noregister_list[1024] = ""; +#define SANGOMA_RTP_QUEUE_SIZE 4 +struct sangoma_rtp_payload { + uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE]; + int32_t datalen; +}; + struct codec_data { /* sngtc request and reply */ sngtc_codec_request_t request; @@ -132,6 +138,13 @@ struct codec_data { switch_time_t avgrxus; switch_time_t last_rx_time; + /* RTP queue. The bigger the queue, the bigger the possible delay */ + struct sangoma_rtp_payload rtp_queue[SANGOMA_RTP_QUEUE_SIZE]; + uint8_t queue_windex; + uint8_t queue_rindex; + uint8_t queue_size; + uint8_t queue_max_ever; + unsigned debug_timing:1; }; struct sangoma_transcoding_session { @@ -352,6 +365,12 @@ static switch_status_t switch_sangoma_init_ilbc(switch_codec_t *codec, switch_co return switch_sangoma_init(codec, flags, codec_settings); } +#define SAFE_INDEX_INC(array, index) \ + (index)++; \ + if ((index) == switch_arraylen((array))) { \ + (index) = 0; \ + } + static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec_t *other_codec, /* codec that was used by the other side */ void *decoded_data, /* decoded data that we must encode */ uint32_t decoded_data_len /* decoded data length */ , @@ -367,12 +386,17 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec switch_frame_t encoded_frame; switch_status_t sres; switch_time_t now_time, difftime; + switch_time_t prevread_time, afterread_time; unsigned char ebuf_ulaw[decoded_data_len / 2]; short *dbuf_linear; int i = 0; int res = 0; struct sangoma_transcoding_session *sess = codec->private_info; + if (sess->encoder.debug_timing) { + prevread_time = switch_micro_time_now(); + } + /* start assuming we will not encode anything */ *encoded_data_len = 0; @@ -392,6 +416,16 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec switch_mutex_unlock(g_sessions_lock); } + if (sess->encoder.debug_timing) { + now_time = switch_micro_time_now(); + if (sess->encoder.last_rx_time) { + difftime = now_time - sess->encoder.last_rx_time; + if (difftime > 25000 || difftime < 15000) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "%ldus since last read on encoding session %lu.\n", (long)difftime, sess->sessid); + } + } + } + /* transcode to ulaw first */ dbuf_linear = decoded_data; @@ -422,12 +456,22 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec /* do the reading */ memset(&encoded_frame, 0, sizeof(encoded_frame)); for ( ; ; ) { +#if 0 + prevread_time = switch_micro_time_now(); +#endif sres = switch_rtp_zerocopy_read_frame(sess->encoder.rxrtp, &encoded_frame, SWITCH_IO_FLAG_NOBLOCK); if (sres == SWITCH_STATUS_GENERR) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to read on Sangoma encoder RTP session: %d\n", sres); return SWITCH_STATUS_FALSE; } +#if 0 + afterread_time = switch_micro_time_now(); + difftime = afterread_time - prevread_time; + if (difftime > 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%ldus to read on encoding session %lu.\n", (long)difftime, sess->sessid); + } +#endif if (0 == encoded_frame.datalen) { break; } @@ -439,19 +483,32 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec break; } - if (*encoded_data_len) { - sess->encoder.rxdiscarded++; + if (sess->encoder.queue_windex == sess->encoder.queue_rindex) { + if (sess->encoder.rtp_queue[sess->encoder.queue_rindex].datalen) { + /* if there is something where we want to write, we're dropping it */ + sess->encoder.rxdiscarded++; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Discarding encoded frame of %d bytes from RTP session %lu, windex = %d, rindex = %d\n", + sess->encoder.rtp_queue[sess->encoder.queue_rindex].datalen, sess->sessid, sess->encoder.queue_windex, sess->encoder.queue_rindex); + SAFE_INDEX_INC(sess->encoder.rtp_queue, sess->encoder.queue_rindex); + sess->encoder.queue_size--; + } } - memcpy(encoded_data, encoded_frame.data, encoded_frame.datalen); - *encoded_data_len = encoded_frame.datalen; - } + memcpy(sess->encoder.rtp_queue[sess->encoder.queue_windex].data, encoded_frame.data, encoded_frame.datalen); + sess->encoder.rtp_queue[sess->encoder.queue_windex].datalen = encoded_frame.datalen; + SAFE_INDEX_INC(sess->encoder.rtp_queue, sess->encoder.queue_windex); - /* update encoding stats if we received a frame */ - if (*encoded_data_len) { - if (*encoded_data_len != codec->implementation->encoded_bytes_per_packet) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Returning odd encoded frame of %d bytes intead of %d bytes\n", *encoded_data_len, codec->implementation->encoded_bytes_per_packet); + /* monitor the queue size */ + sess->encoder.queue_size++; + if (sess->encoder.queue_size > sess->encoder.queue_max_ever) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Encoder Rx queue for RTP session %lu is now %d, windex = %d, rindex = %d\n", sess->sessid, sess->encoder.queue_size, + sess->encoder.queue_windex, sess->encoder.queue_rindex); + sess->encoder.queue_max_ever = sess->encoder.queue_size; } + } + + /* update encoding stats if we have a frame to give */ + if (sess->encoder.rtp_queue[sess->encoder.queue_rindex].datalen) { sess->encoder.rx++; now_time = switch_micro_time_now(); if (!sess->encoder.last_rx_time) { @@ -469,10 +526,27 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec } } sess->encoder.lastrxseqno = encoded_frame.seq; + + /* pop the data from the queue */ + *encoded_data_len = sess->encoder.rtp_queue[sess->encoder.queue_rindex].datalen; + memcpy(encoded_data, sess->encoder.rtp_queue[sess->encoder.queue_rindex].data, *encoded_data_len); + sess->encoder.rtp_queue[sess->encoder.queue_rindex].datalen = 0; + SAFE_INDEX_INC(sess->encoder.rtp_queue, sess->encoder.queue_rindex); + sess->encoder.queue_size--; + if (*encoded_data_len != codec->implementation->encoded_bytes_per_packet) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Returning odd encoded frame of %d bytes intead of %d bytes\n", *encoded_data_len, codec->implementation->encoded_bytes_per_packet); + } } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No output from sangoma encoder\n"); } + if (sess->encoder.debug_timing) { + afterread_time = switch_micro_time_now(); + difftime = afterread_time - prevread_time; + if (difftime > 5000) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "%ldus to execute encoding function in session %lu.\n", (long)difftime, sess->sessid); + } + } return SWITCH_STATUS_SUCCESS; } @@ -492,11 +566,16 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses switch_frame_t ulaw_frame; switch_status_t sres; switch_time_t now_time, difftime; + switch_time_t prevread_time, afterread_time; short *dbuf_linear; int i = 0; int res = 0; struct sangoma_transcoding_session *sess = codec->private_info; + if (sess->decoder.debug_timing) { + prevread_time = switch_micro_time_now(); + } + dbuf_linear = decoded_data; /* start assuming we will not decode anything */ @@ -524,6 +603,16 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses switch_mutex_unlock(g_sessions_lock); } + if (sess->decoder.debug_timing) { + now_time = switch_micro_time_now(); + if (sess->decoder.last_rx_time) { + difftime = now_time - sess->decoder.last_rx_time; + if (difftime > 25000 || difftime < 15000) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%ldms since last read on decoding session %lu.\n", (long)difftime, sess->sessid); + } + } + } + /* do the writing */ memset(&encoded_frame, 0, sizeof(encoded_frame)); encoded_frame.source = __FUNCTION__; @@ -548,12 +637,22 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses /* do the reading */ memset(&ulaw_frame, 0, sizeof(ulaw_frame)); for ( ; ; ) { +#if 0 + prevread_time = switch_micro_time_now(); +#endif sres = switch_rtp_zerocopy_read_frame(sess->decoder.rxrtp, &ulaw_frame, SWITCH_IO_FLAG_NOBLOCK); if (sres == SWITCH_STATUS_GENERR) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to read on Sangoma decoder RTP session: %d\n", sres); return SWITCH_STATUS_FALSE; } +#if 0 + afterread_time = switch_micro_time_now(); + difftime = afterread_time - prevread_time; + if (difftime > 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%ldus to read on decoding session %lu.\n", (long)difftime, sess->sessid); + } +#endif if (0 == ulaw_frame.datalen) { break; } @@ -565,21 +664,31 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses break; } - if (*decoded_data_len) { - sess->decoder.rxdiscarded++; + if (sess->decoder.queue_windex == sess->decoder.queue_rindex) { + if (sess->decoder.rtp_queue[sess->decoder.queue_rindex].datalen) { + /* if there is something where we want to write, we're dropping it */ + sess->decoder.rxdiscarded++; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Discarding decoded frame of %d bytes from RTP session %lu, windex = %d, rindex = %d\n", + sess->decoder.rtp_queue[sess->decoder.queue_rindex].datalen, sess->sessid, sess->decoder.queue_windex, sess->decoder.queue_rindex); + SAFE_INDEX_INC(sess->decoder.rtp_queue, sess->decoder.queue_rindex); + sess->decoder.queue_size--; + } } - /* transcode to linear */ - for (i = 0; i < ulaw_frame.datalen; i++) { - dbuf_linear[i] = ulaw_to_linear(((char *)ulaw_frame.data)[i]); + memcpy(sess->decoder.rtp_queue[sess->decoder.queue_windex].data, ulaw_frame.data, ulaw_frame.datalen); + sess->decoder.rtp_queue[sess->decoder.queue_windex].datalen = ulaw_frame.datalen; + SAFE_INDEX_INC(sess->decoder.rtp_queue, sess->decoder.queue_windex); + + /* monitor the queue size */ + sess->decoder.queue_size++; + if (sess->decoder.queue_size > sess->decoder.queue_max_ever) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Encoder Rx queue for RTP session %lu is now %d, windex = %d, rindex = %d\n", sess->sessid, sess->decoder.queue_size, + sess->decoder.queue_windex, sess->decoder.queue_rindex); + sess->decoder.queue_max_ever = sess->decoder.queue_size; } - *decoded_data_len = i * 2; } - if (*decoded_data_len) { - if (*decoded_data_len != codec->implementation->decoded_bytes_per_packet) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Returning odd decoded frame of %d bytes intead of %d bytes\n", *decoded_data_len, codec->implementation->decoded_bytes_per_packet); - } + if (sess->decoder.rtp_queue[sess->decoder.queue_rindex].datalen) { /* update decoding stats */ sess->decoder.rx++; @@ -599,12 +708,33 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses } } sess->decoder.lastrxseqno = ulaw_frame.seq; + + /* pop the data from the queue and transcode it */ + for (i = 0; i < sess->decoder.rtp_queue[sess->decoder.queue_rindex].datalen; i++) { + dbuf_linear[i] = ulaw_to_linear(((char *)sess->decoder.rtp_queue[sess->decoder.queue_rindex].data)[i]); + } + *decoded_data_len = i * 2; + sess->decoder.rtp_queue[sess->decoder.queue_rindex].datalen = 0; + SAFE_INDEX_INC(sess->decoder.rtp_queue, sess->decoder.queue_rindex); + sess->decoder.queue_size--; + + if (*decoded_data_len != codec->implementation->decoded_bytes_per_packet) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Returning odd decoded frame of %d bytes intead of %d bytes\n", *decoded_data_len, codec->implementation->decoded_bytes_per_packet); + } } else { *decoded_data_len = codec->implementation->decoded_bytes_per_packet; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No output from sangoma decoder, returning silent frame of %d bytes\n", *decoded_data_len); memset(dbuf_linear, 0, *decoded_data_len); } + if (sess->decoder.debug_timing) { + afterread_time = switch_micro_time_now(); + difftime = afterread_time - prevread_time; + if (difftime > 5000) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%ldus to execute decoding function in session %lu.\n", (long)difftime, sess->sessid); + } + } + return SWITCH_STATUS_SUCCESS; } @@ -652,7 +782,7 @@ static void sangoma_print_stats(switch_stream_handle_t *stream, switch_rtp_numbe stream->write_function(stream, "Flush packet count: %lu\n\n\n", stats->flush_packet_count); } -#define SANGOMA_SYNTAX "settings|sessions|stats <session>" +#define SANGOMA_SYNTAX "settings|sessions|stats <session>|debug <session>|nodebug <session>" SWITCH_STANDARD_API(sangoma_function) { char *argv[10] = { 0 }; @@ -788,6 +918,48 @@ SWITCH_STANDARD_API(sangoma_function) } else { stream->write_function(stream, "\n=== No Decoder ===\n\n"); } + } else if (!strcasecmp(argv[0], "debug")) { + struct sangoma_transcoding_session *sess; + unsigned long sessid = 0; + int ret = 0; + if (argc < 2) { + stream->write_function(stream, "%s", SANGOMA_SYNTAX); + goto done; + } + ret = sscanf(argv[1], "%lu", &sessid); + if (ret != 1) { + stream->write_function(stream, "%s", SANGOMA_SYNTAX); + goto done; + } + sess = sangoma_find_session(sessid); + if (!sess) { + stream->write_function(stream, "Failed to find session %lu\n", sessid); + goto done; + } + sess->encoder.debug_timing = 1; + sess->decoder.debug_timing = 1; + stream->write_function(stream, "Debug enabled for transcoding session: %lu\n", sessid); + } else if (!strcasecmp(argv[0], "nodebug")) { + struct sangoma_transcoding_session *sess; + unsigned long sessid = 0; + int ret = 0; + if (argc < 2) { + stream->write_function(stream, "%s", SANGOMA_SYNTAX); + goto done; + } + ret = sscanf(argv[1], "%lu", &sessid); + if (ret != 1) { + stream->write_function(stream, "%s", SANGOMA_SYNTAX); + goto done; + } + sess = sangoma_find_session(sessid); + if (!sess) { + stream->write_function(stream, "Failed to find session %lu\n", sessid); + goto done; + } + sess->encoder.debug_timing = 0; + sess->decoder.debug_timing = 0; + stream->write_function(stream, "Debug disabled for transcoding session: %lu\n", sessid); } else { stream->write_function(stream, "Unknown Command [%s]\n", argv[0]); } @@ -1103,6 +1275,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) switch_console_set_complete("add sangoma_codec settings"); switch_console_set_complete("add sangoma_codec sessions"); switch_console_set_complete("add sangoma_codec stats"); + switch_console_set_complete("add sangoma_codec debug"); + switch_console_set_complete("add sangoma_codec nodebug"); return SWITCH_STATUS_SUCCESS; } commit 3eab7f5a8945cdd65c7e1a0c96cf1f80147a9bf2 Author: Mathieu Rene <mrene@avgs.ca> Date: Tue Oct 12 16:24:44 2010 -0400 fs_encode: err/logging on stderr diff --git a/src/fs_encode.c b/src/fs_encode.c index 6704077..15e6538 100644 --- a/src/fs_encode.c +++ b/src/fs_encode.c @@ -120,7 +120,7 @@ int main(int argc, char *argv[]) format++; if (switch_core_init(SCF_MINIMAL, verbose, &err) != SWITCH_STATUS_SUCCESS) { - printf("Cannot init core [%s]\n", err); + fprintf(stderr, "Cannot init core [%s]\n", err); goto end; } @@ -128,24 +128,24 @@ int main(int argc, char *argv[]) for (i = 0; i < extra_modules_count; i++) { if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) extra_modules[i], SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) { - printf("Cannot init %s [%s]\n", extra_modules[i], err); + fprintf(stderr, "Cannot init %s [%s]\n", extra_modules[i], err); goto end; } } if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) "mod_sndfile", SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) { - printf("Cannot init mod_sndfile [%s]\n", err); + fprintf(stderr, "Cannot init mod_sndfile [%s]\n", err); goto end; } if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) "mod_native_file", SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) { - printf("Cannot init mod_native_file [%s]\n", err); + fprintf(stderr, "Cannot init mod_native_file [%s]\n", err); goto end; } switch_core_new_memory_pool(&pool); if (verbose) { - fprintf(stderr, "Opening file %s\n", input); + fprintf(stderr, "Opening file %s\n", input); } if (switch_core_file_open(&fh_input, input, channels, rate, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) { fprintf(stderr, "Couldn't open %s\n", input); @@ -175,7 +175,7 @@ int main(int argc, char *argv[]) switch_assert(sizeof(buf) >= len * 2); if (verbose) { - printf("Frame size is %d\n", blocksize); + fprintf(stderr, "Frame size is %d\n", blocksize); } while (switch_core_file_read(&fh_input, buf, &len) == SWITCH_STATUS_SUCCESS) { commit 18131a58a54d10b10b5cbc80ab983dcbcffb3021 Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Tue Oct 12 16:06:49 2010 -0400 mod_conference: Fix deadlock diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index ed62da1..ac57dc0 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -2582,6 +2582,7 @@ static void conference_loop_output(conference_member_t *member) } if (switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + switch_mutex_unlock(member->audio_out_mutex); break; } } commit 3c4d7f1d48d15c815055eb343de1a9fb48a75a72 Author: Mathieu Rene <mrene@avgs.ca> Date: Tue Oct 12 15:48:24 2010 -0400 fs_encode: encode by [ptime] ms so we don't end up with partial frames, destroy codec when done diff --git a/src/fs_encode.c b/src/fs_encode.c index abfd23f..6704077 100644 --- a/src/fs_encode.c +++ b/src/fs_encode.c @@ -64,10 +64,11 @@ int main(int argc, char *argv[]) int rate = 8000; switch_file_handle_t fh_input = { 0 }, fh_output = { 0 }; switch_codec_t codec = { 0 }; - char buf[1024]; + char buf[2048]; switch_size_t len = sizeof(buf)/2; switch_memory_pool_t *pool; int bitrate = 0; + int blocksize; for (i = 1; i < argc; i++) { if (argv[i][0] == '-') { @@ -169,9 +170,16 @@ int main(int argc, char *argv[]) fprintf(stderr, "Couldn't initialize codec for %s@%dh@%di\n", format, rate, ptime); goto end; } + + blocksize = len = (rate*ptime)/1000; + switch_assert(sizeof(buf) >= len * 2); + + if (verbose) { + printf("Frame size is %d\n", blocksize); + } while (switch_core_file_read(&fh_input, buf, &len) == SWITCH_STATUS_SUCCESS) { - char encode_buf[1024]; + char encode_buf[2048]; uint32_t encoded_len = sizeof(buf); uint32_t encoded_rate = rate; unsigned int flags = 0; @@ -182,18 +190,25 @@ int main(int argc, char *argv[]) } len = encoded_len; + if (switch_core_file_write(&fh_output, encode_buf, &len) != SWITCH_STATUS_SUCCESS) { fprintf(stderr, "Write error\n"); goto end; } - len = sizeof(buf)/2; + if (len != encoded_len) { + printf("Short write: wrote %"SWITCH_SIZE_T_FMT"/%d bytes\n", len, encoded_len); + } + + len = blocksize; } r = 0; end: + switch_core_codec_destroy(&codec); + if (fh_input.file_interface) { switch_core_file_close(&fh_input); } diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index c467a23..7f99504 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -62,6 +62,10 @@ SWITCH_DECLARE(switch_status_t) _switch_core_db_handle(switch_cache_db_handle_t { switch_cache_db_connection_options_t options = { {0} }; switch_status_t r; + + if (!sql_manager.manage) { + return SWITCH_STATUS_FALSE; + } if (!zstr(runtime.odbc_dsn)) { options.odbc_options.dsn = runtime.odbc_dsn; commit 69555111d740458207f72f33a25478f249de6c59 Author: Jeff Lenk <jeff@jefflenk.com> Date: Tue Oct 12 14:08:17 2010 -0500 start of msbuild enabled automated installers for Win32/X64 diff --git a/Freeswitch.2010.sln b/Freeswitch.2010.sln index 4729745..a7af2ca 100644 --- a/Freeswitch.2010.sln +++ b/Freeswitch.2010.sln @@ -705,1734 +705,2243 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_h323", "src\mod\endpoin EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_distributor", "src\mod\applications\mod_distributor\mod_distributor.2010.vcxproj", "{5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}" EndProject +Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "Setup", "Setup\Setup.wixproj", "{47213370-B933-487D-9F45-BCA26D7E2B6F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 All|x64 = All|x64 + All|x86 = All|x86 Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 Release|Win32 = Release|Win32 Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.All|Win32.ActiveCfg = Release|x64 {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.All|x64.ActiveCfg = Release|x64 {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.All|x64.Build.0 = Release|x64 + {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.All|x86.ActiveCfg = Release|x64 {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Debug|Win32.ActiveCfg = Debug|Win32 {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Debug|Win32.Build.0 = Debug|Win32 {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Debug|x64.ActiveCfg = Debug|x64 {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Debug|x64.Build.0 = Debug|x64 + {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Debug|x86.ActiveCfg = Debug|x64 {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Release|Win32.ActiveCfg = Release|Win32 {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Release|Win32.Build.0 = Release|Win32 {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Release|x64.ActiveCfg = Release|x64 {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Release|x64.Build.0 = Release|x64 + {1AF3A893-F7BE-43DD-B697-8AB2397C0D67}.Release|x86.ActiveCfg = Release|x64 {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.All|Win32.ActiveCfg = Release|x64 {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.All|x64.ActiveCfg = Release|x64 {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.All|x64.Build.0 = Release|x64 + {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.All|x86.ActiveCfg = Release|x64 {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Debug|Win32.ActiveCfg = Debug|Win32 {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Debug|Win32.Build.0 = Debug|Win32 {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Debug|x64.ActiveCfg = Debug|x64 {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Debug|x64.Build.0 = Debug|x64 + {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Debug|x86.ActiveCfg = Debug|x64 {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Release|Win32.ActiveCfg = Release|Win32 {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Release|Win32.Build.0 = Release|Win32 {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Release|x64.ActiveCfg = Release|x64 {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Release|x64.Build.0 = Release|x64 + {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}.Release|x86.ActiveCfg = Release|x64 {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.All|Win32.ActiveCfg = Release Passthrough|x64 {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.All|x64.ActiveCfg = Release Passthrough|x64 {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.All|x64.Build.0 = Release Passthrough|x64 + {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.All|x86.ActiveCfg = Release|x64 {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Debug|Win32.ActiveCfg = Debug Passthrough|Win32 {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Debug|Win32.Build.0 = Debug Passthrough|Win32 {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Debug|x64.ActiveCfg = Debug Passthrough|x64 {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Debug|x64.Build.0 = Debug Passthrough|x64 + {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Debug|x86.ActiveCfg = Debug|x64 {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Release|Win32.ActiveCfg = Release Passthrough|Win32 {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Release|Win32.Build.0 = Release Passthrough|Win32 {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Release|x64.ActiveCfg = Release Passthrough|x64 {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Release|x64.Build.0 = Release Passthrough|x64 + {1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0}.Release|x86.ActiveCfg = Release|x64 {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.All|Win32.ActiveCfg = Release|x64 {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.All|x64.ActiveCfg = Release|x64 {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.All|x64.Build.0 = Release|x64 + {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.All|x86.ActiveCfg = Release|x64 {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Debug|Win32.ActiveCfg = Debug|Win32 {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Debug|Win32.Build.0 = Debug|Win32 {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Debug|x64.ActiveCfg = Debug|x64 {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Debug|x64.Build.0 = Debug|x64 + {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Debug|x86.ActiveCfg = Debug|x64 {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|Win32.ActiveCfg = Release|Win32 {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|Win32.Build.0 = Release|Win32 {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|x64.ActiveCfg = Release|x64 {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|x64.Build.0 = Release|x64 + {AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|x86.ActiveCfg = Release|x64 {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.All|Win32.ActiveCfg = Release|x64 {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.All|x64.ActiveCfg = Release|x64 {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.All|x64.Build.0 = Release|x64 + {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.All|x86.ActiveCfg = Release|x64 {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Debug|Win32.ActiveCfg = Debug|Win32 {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Debug|Win32.Build.0 = Debug|Win32 {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Debug|x64.ActiveCfg = Debug|x64 {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Debug|x64.Build.0 = Debug|x64 + {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Debug|x86.ActiveCfg = Debug|x64 {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Release|Win32.ActiveCfg = Release|Win32 {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Release|Win32.Build.0 = Release|Win32 {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Release|x64.ActiveCfg = Release|x64 {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Release|x64.Build.0 = Release|x64 + {5FD31A25-5D83-4794-8BEE-904DAD84CE71}.Release|x86.ActiveCfg = Release|x64 {5580D60E-0F77-4716-9CD4-B8E5986FA375}.All|Win32.ActiveCfg = Release|x64 {5580D60E-0F77-4716-9CD4-B8E5986FA375}.All|x64.ActiveCfg = Release|x64 {5580D60E-0F77-4716-9CD4-B8E5986FA375}.All|x64.Build.0 = Release|x64 + {5580D60E-0F77-4716-9CD4-B8E5986FA375}.All|x86.ActiveCfg = Release|x64 {5580D60E-0F77-4716-9CD4-B8E5986FA375}.Debug|Win32.ActiveCfg = Debug|Win32 {5580D60E-0F77-4716-9CD4-B8E5986FA375}.Debug|Win32.Build.0 = Debug|Win32 {5580D60E-0F77-4716-9CD4-B8E5986FA375}.Debug|x64.ActiveCfg = Debug|x64 {5580D60E-0F77-4716-9CD4-B8E5986FA375}.Debug|x64.Build.0 = Debug|x64 + {5580D60E-0F77-4716-9CD4-B8E5986FA375}.Debug|x86.ActiveCfg = Debug|x64 {5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|Win32.ActiveCfg = Release|Win32 {5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|Win32.Build.0 = Release|Win32 {5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|x64.ActiveCfg = Release|x64 {5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|x64.Build.0 = Release|x64 + {5580D60E-0F77-4716-9CD4-B8E5986FA375}.Release|x86.ActiveCfg = Release|x64 {1A1FF289-4FD6-4285-A422-D31DD67A4723}.All|Win32.ActiveCfg = Release|Win32 {1A1FF289-4FD6-4285-A422-D31DD67A4723}.All|x64.ActiveCfg = Release|Win32 + {1A1FF289-4FD6-4285-A422-D31DD67A4723}.All|x86.ActiveCfg = Release|Win32 {1A1FF289-4FD6-4285-A422-D31DD67A4723}.Debug|Win32.ActiveCfg = Debug|Win32 {1A1FF289-4FD6-4285-A422-D31DD67A4723}.Debug|x64.ActiveCfg = Debug|Win32 + {1A1FF289-4FD6-4285-A422-D31DD67A4723}.Debug|x86.ActiveCfg = Debug|Win32 {1A1FF289-4FD6-4285-A422-D31DD67A4723}.Release|Win32.ActiveCfg = Release|Win32 {1A1FF289-4FD6-4285-A422-D31DD67A4723}.Release|x64.ActiveCfg = Release|Win32 + {1A1FF289-4FD6-4285-A422-D31DD67A4723}.Release|x86.ActiveCfg = Release|Win32 {07113B25-D3AF-4E04-BA77-4CD1171F022C}.All|Win32.ActiveCfg = Release|x64 {07113B25-D3AF-4E04-BA77-4CD1171F022C}.All|x64.ActiveCfg = Release|x64 {07113B25-D3AF-4E04-BA77-4CD1171F022C}.All|x64.Build.0 = Release|x64 + {07113B25-D3AF-4E04-BA77-4CD1171F022C}.All|x86.ActiveCfg = Release|x64 {07113B25-D3AF-4E04-BA77-4CD1171F022C}.Debug|Win32.ActiveCfg = Debug|Win32 {07113B25-D3AF-4E04-BA77-4CD1171F022C}.Debug|Win32.Build.0 = Debug|Win32 {07113B25-D3AF-4E04-BA77-4CD1171F022C}.Debug|x64.ActiveCfg = Debug|x64 {07113B25-D3AF-4E04-BA77-4CD1171F022C}.Debug|x64.Build.0 = Debug|x64 + {07113B25-D3AF-4E04-BA77-4CD1171F022C}.Debug|x86.ActiveCfg = Debug|x64 {07113B25-D3AF-4E04-BA77-4CD1171F022C}.Release|Win32.ActiveCfg = Release|Win32 {07113B25-D3AF-4E04-BA77-4CD1171F022C}.Release|Win32.Build.0 = Release|Win32 {07113B25-D3AF-4E04-BA77-4CD1171F022C}.Release|x64.ActiveCfg = Release|x64 {07113B25-D3AF-4E04-BA77-4CD1171F022C}.Release|x64.Build.0 = Release|x64 + {07113B25-D3AF-4E04-BA77-4CD1171F022C}.Release|x86.ActiveCfg = Release|x64 {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.All|Win32.ActiveCfg = Release MS-LDAP|x64 {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.All|x64.ActiveCfg = Release MS-LDAP|x64 {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.All|x64.Build.0 = Release MS-LDAP|x64 + {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.All|x86.ActiveCfg = Release|x64 {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Debug|Win32.ActiveCfg = Debug MS-LDAP|Win32 {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Debug|Win32.Build.0 = Debug MS-LDAP|Win32 {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Debug|x64.ActiveCfg = Debug MS-LDAP|x64 {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Debug|x64.Build.0 = Debug MS-LDAP|x64 + {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Debug|x86.ActiveCfg = Debug|x64 {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Release|Win32.ActiveCfg = Release MS-LDAP|Win32 {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Release|Win32.Build.0 = Release MS-LDAP|Win32 {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Release|x64.ActiveCfg = Release MS-LDAP|x64 {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Release|x64.Build.0 = Release MS-LDAP|x64 + {EC3E5C7F-EE09-47E2-80FE-546363D14A98}.Release|x86.ActiveCfg = Release|x64 {A27CCA23-1541-4337-81A4-F0A6413078A0}.All|Win32.ActiveCfg = Release|x64 {A27CCA23-1541-4337-81A4-F0A6413078A0}.All|x64.ActiveCfg = Release|x64 {A27CCA23-1541-4337-81A4-F0A6413078A0}.All|x64.Build.0 = Release|x64 + {A27CCA23-1541-4337-81A4-F0A6413078A0}.All|x86.ActiveCfg = Release|x64 {A27CCA23-1541-4337-81A4-F0A6413078A0}.Debug|Win32.ActiveCfg = Debug|Win32 {A27CCA23-1541-4337-81A4-F0A6413078A0}.Debug|Win32.Build.0 = Debug|Win32 {A27CCA23-1541-4337-81A4-F0A6413078A0}.Debug|x64.ActiveCfg = Debug|x64 {A27CCA23-1541-4337-81A4-F0A6413078A0}.Debug|x64.Build.0 = Debug|x64 + {A27CCA23-1541-4337-81A4-F0A6413078A0}.Debug|x86.ActiveCfg = Debug|x64 {A27CCA23-1541-4337-81A4-F0A6413078A0}.Release|Win32.ActiveCfg = Release|Win32 {A27CCA23-1541-4337-81A4-F0A6413078A0}.Release|Win32.Build.0 = Release|Win32 {A27CCA23-1541-4337-81A4-F0A6413078A0}.Release|x64.ActiveCfg = Release|x64 {A27CCA23-1541-4337-81A4-F0A6413078A0}.Release|x64.Build.0 = Release|x64 + {A27CCA23-1541-4337-81A4-F0A6413078A0}.Release|x86.ActiveCfg = Release|x64 {784113EF-44D9-4949-835D-7065D3C7AD08}.All|Win32.ActiveCfg = Release|x64 {784113EF-44D9-4949-835D-7065D3C7AD08}.All|x64.ActiveCfg = Release|x64 {784113EF-44D9-4949-835D-7065D3C7AD08}.All|x64.Build.0 = Release|x64 + {784113EF-44D9-4949-835D-7065D3C7AD08}.All|x86.ActiveCfg = Release|x64 {784113EF-44D9-4949-835D-7065D3C7AD08}.Debug|Win32.ActiveCfg = Debug|Win32 {784113EF-44D9-4949-835D-7065D3C7AD08}.Debug|Win32.Build.0 = Debug|Win32 {784113EF-44D9-4949-835D-7065D3C7AD08}.Debug|x64.ActiveCfg = Debug|x64 {784113EF-44D9-4949-835D-7065D3C7AD08}.Debug|x64.Build.0 = Debug|x64 + {784113EF-44D9-4949-835D-7065D3C7AD08}.Debug|x86.ActiveCfg = Debug|x64 {784113EF-44D9-4949-835D-7065D3C7AD08}.Release|Win32.ActiveCfg = Release|Win32 {784113EF-44D9-4949-835D-7065D3C7AD08}.Release|Win32.Build.0 = Release|Win32 {784113EF-44D9-4949-835D-7065D3C7AD08}.Release|x64.ActiveCfg = Release|x64 {784113EF-44D9-4949-835D-7065D3C7AD08}.Release|x64.Build.0 = Release|x64 + {784113EF-44D9-4949-835D-7065D3C7AD08}.Release|x86.ActiveCfg = Release|x64 {89385C74-5860-4174-9CAF-A39E7C48909C}.All|Win32.ActiveCfg = Release|x64 {89385C74-5860-4174-9CAF-A39E7C48909C}.All|x64.ActiveCfg = Release|x64 {89385C74-5860-4174-9CAF-A39E7C48909C}.All|x64.Build.0 = Release|x64 + {89385C74-5860-4174-9CAF-A39E7C48909C}.All|x86.ActiveCfg = Release|x64 {89385C74-5860-4174-9CAF-A39E7C48909C}.Debug|Win32.ActiveCfg = Debug|Win32 {89385C74-5860-4174-9CAF-A39E7C48909C}.Debug|Win32.Build.0 = Debug|Win32 {89385C74-5860-4174-9CAF-A39E7C48909C}.Debug|x64.ActiveCfg = Debug|x64 {89385C74-5860-4174-9CAF-A39E7C48909C}.Debug|x64.Build.0 = Debug|x64 + {89385C74-5860-4174-9CAF-A39E7C48909C}.Debug|x86.ActiveCfg = Debug|x64 {89385C74-5860-4174-9CAF-A39E7C48909C}.Release|Win32.ActiveCfg = Release|Win32 {89385C74-5860-4174-9CAF-A39E7C48909C}.Release|Win32.Build.0 = Release|Win32 {89385C74-5860-4174-9CAF-A39E7C48909C}.Release|x64.ActiveCfg = Release|x64 {89385C74-5860-4174-9CAF-A39E7C48909C}.Release|x64.Build.0 = Release|x64 + {89385C74-5860-4174-9CAF-A39E7C48909C}.Release|x86.ActiveCfg = Release|x64 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|Win32.ActiveCfg = Release|x64 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|x64.ActiveCfg = Release|x64 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|x64.Build.0 = Release|x64 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.All|x86.ActiveCfg = Release|x64 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|Win32.ActiveCfg = Debug|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|Win32.Build.0 = Debug|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|x64.ActiveCfg = Debug|x64 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|x86.ActiveCfg = Debug|x64 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|Win32.ActiveCfg = Release|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|Win32.Build.0 = Release|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|x64.ActiveCfg = Release|x64 + {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|x86.ActiveCfg = Release|x64 {692F6330-4D87-4C82-81DF-40DB5892636E}.All|Win32.ActiveCfg = Release|x64 {692F6330-4D87-4C82-81DF-40DB5892636E}.All|x64.ActiveCfg = Release|x64 {692F6330-4D87-4C82-81DF-40DB5892636E}.All|x64.Build.0 = Release|x64 + {692F6330-4D87-4C82-81DF-40DB5892636E}.All|x86.ActiveCfg = Release|x64 {692F6330-4D87-4C82-81DF-40DB5892636E}.Debug|Win32.ActiveCfg = Debug|Win32 {692F6330-4D87-4C82-81DF-40DB5892636E}.Debug|x64.ActiveCfg = Debug|x64 + {692F6330-4D87-4C82-81DF-40DB5892636E}.Debug|x86.ActiveCfg = Debug|x64 {692F6330-4D87-4C82-81DF-40DB5892636E}.Release|Win32.ActiveCfg = Release|Win32 {692F6330-4D87-4C82-81DF-40DB5892636E}.Release|x64.ActiveCfg = Release|x64 + {692F6330-4D87-4C82-81DF-40DB5892636E}.Release|x86.ActiveCfg = Release|x64 {D3EC0AFF-76FC-4210-A825-9A17410660A3}.All|Win32.ActiveCfg = Release|x64 {D3EC0AFF-76FC-4210-A825-9A17410660A3}.All|x64.ActiveCfg = Release|x64 {D3EC0AFF-76FC-4210-A825-9A17410660A3}.All|x64.Build.0 = Release|x64 + {D3EC0AFF-76FC-4210-A825-9A17410660A3}.All|x86.ActiveCfg = Release|x64 {D3EC0AFF-76FC-4210-A825-9A17410660A3}.Debug|Win32.ActiveCfg = Debug|Win32 {D3EC0AFF-76FC-4210-A825-9A17410660A3}.Debug|Win32.Build.0 = Debug|Win32 {D3EC0AFF-76FC-4210-A825-9A17410660A3}.Debug|x64.ActiveCfg = Debug|x64 {D3EC0AFF-76FC-4210-A825-9A17410660A3}.Debug|x64.Build.0 = Debug|x64 + {D3EC0AFF-76FC-4210-A825-9A17410660A3}.Debug|x86.ActiveCfg = Debug|x64 {D3EC0AFF-76FC-4210-A825-9A17410660A3}.Release|Win32.ActiveCfg = Release|Win32 {D3EC0AFF-76FC-4210-A825-9A17410660A3}.Release|Win32.Build.0 = Release|Win32 {D3EC0AFF-76FC-4210-A825-9A17410660A3}.Release|x64.ActiveCfg = Release|x64 {D3EC0AFF-76FC-4210-A825-9A17410660A3}.Release|x64.Build.0 = Release|x64 + {D3EC0AFF-76FC-4210-A825-9A17410660A3}.Release|x86.ActiveCfg = Release|x64 {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.All|Win32.ActiveCfg = Release|x64 {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.All|x64.ActiveCfg = Release|x64 {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.All|x64.Build.0 = Release|x64 + {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.All|x86.ActiveCfg = Release|x64 {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Debug|Win32.ActiveCfg = Debug|Win32 {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Debug|Win32.Build.0 = Debug|Win32 {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Debug|x64.ActiveCfg = Debug|x64 {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Debug|x64.Build.0 = Debug|x64 + {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Debug|x86.ActiveCfg = Debug|x64 {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Release|Win32.ActiveCfg = Release|Win32 {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Release|Win32.Build.0 = Release|Win32 {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Release|x64.ActiveCfg = Release|x64 {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Release|x64.Build.0 = Release|x64 + {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Release|x86.ActiveCfg = Release|x64 {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.All|Win32.ActiveCfg = Release|x64 {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.All|x64.ActiveCfg = Release|x64 {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.All|x64.Build.0 = Release|x64 + {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.All|x86.ActiveCfg = Release|x64 {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Debug|Win32.ActiveCfg = Debug|Win32 {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Debug|Win32.Build.0 = Debug|Win32 {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Debug|x64.ActiveCfg = Debug|x64 {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Debug|x64.Build.0 = Debug|x64 + {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Debug|x86.ActiveCfg = Debug|x64 {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Release|Win32.ActiveCfg = Release|Win32 {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Release|Win32.Build.0 = Release|Win32 {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Release|x64.ActiveCfg = Release|x64 {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Release|x64.Build.0 = Release|x64 + {30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.Release|x86.ActiveCfg = Release|x64 {1C453396-D912-4213-89FD-9B489162B7B5}.All|Win32.ActiveCfg = Release|x64 {1C453396-D912-4213-89FD-9B489162B7B5}.All|x64.ActiveCfg = Release|x64 {1C453396-D912-4213-89FD-9B489162B7B5}.All|x64.Build.0 = Release|x64 + {1C453396-D912-4213-89FD-9B489162B7B5}.All|x86.ActiveCfg = Release|x64 {1C453396-D912-4213-89FD-9B489162B7B5}.Debug|Win32.ActiveCfg = Debug|Win32 {1C453396-D912-4213-89FD-9B489162B7B5}.Debug|Win32.Build.0 = Debug|Win32 {1C453396-D912-4213-89FD-9B489162B7B5}.Debug|x64.ActiveCfg = Debug|x64 {1C453396-D912-4213-89FD-9B489162B7B5}.Debug|x64.Build.0 = Debug|x64 + {1C453396-D912-4213-89FD-9B489162B7B5}.Debug|x86.ActiveCfg = Debug|x64 {1C453396-D912-4213-89FD-9B489162B7B5}.Release|Win32.ActiveCfg = Release|Win32 {1C453396-D912-4213-89FD-9B489162B7B5}.Release|Win32.Build.0 = Release|Win32 {1C453396-D912-4213-89FD-9B489162B7B5}.Release|x64.ActiveCfg = Release|x64 {1C453396-D912-4213-89FD-9B489162B7B5}.Release|x64.Build.0 = Release|x64 + {1C453396-D912-4213-89FD-9B489162B7B5}.Release|x86.ActiveCfg = Release|x64 {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.All|Win32.ActiveCfg = Release|x64 {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.All|x64.ActiveCfg = Release|x64 {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.All|x64.Build.0 = Release|x64 + {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.All|x86.ActiveCfg = Release|x64 {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Debug|Win32.ActiveCfg = Debug|Win32 {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Debug|Win32.Build.0 = Debug|Win32 {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Debug|x64.ActiveCfg = Debug|x64 {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Debug|x64.Build.0 = Debug|x64 + {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Debug|x86.ActiveCfg = Debug|x64 {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|Win32.ActiveCfg = Release|Win32 {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|Win32.Build.0 = Release|Win32 {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|x64.ActiveCfg = Release|x64 {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|x64.Build.0 = Release|x64 + {CBEC7225-0C21-4DA8-978E-1F158F8AD950}.Release|x86.ActiveCfg = Release|x64 {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.All|Win32.ActiveCfg = Release|x64 {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.All|x64.ActiveCfg = Release|x64 {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.All|x64.Build.0 = Release|x64 + {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.All|x86.ActiveCfg = Release|x64 {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Debug|Win32.ActiveCfg = Debug|Win32 {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Debug|Win32.Build.0 = Debug|Win32 {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Debug|x64.ActiveCfg = Debug|x64 {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Debug|x64.Build.0 = Debug|x64 + {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Debug|x86.ActiveCfg = Debug|x64 {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|Win32.ActiveCfg = Release|Win32 {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|Win32.Build.0 = Release|Win32 {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|x64.ActiveCfg = Release|x64 {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|x64.Build.0 = Release|x64 + {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}.Release|x86.ActiveCfg = Release|x64 {C24FB505-05D7-4319-8485-7540B44C8603}.All|Win32.ActiveCfg = Release|x64 {C24FB505-05D7-4319-8485-7540B44C8603}.All|x64.ActiveCfg = Release|x64 {C24FB505-05D7-4319-8485-7540B44C8603}.All|x64.Build.0 = Release|x64 + {C24FB505-05D7-4319-8485-7540B44C8603}.All|x86.ActiveCfg = Release|x64 {C24FB505-05D7-4319-8485-7540B44C8603}.Debug|Win32.ActiveCfg = Debug|Win32 {C24FB505-05D7-4319-8485-7540B44C8603}.Debug|Win32.Build.0 = Debug|Win32 {C24FB505-05D7-4319-8485-7540B44C8603}.Debug|x64.ActiveCfg = Debug|x64 {C24FB505-05D7-4319-8485-7540B44C8603}.Debug|x64.Build.0 = Debug|x64 + {C24FB505-05D7-4319-8485-7540B44C8603}.Debug|x86.ActiveCfg = Debug|x64 {C24FB505-05D7-4319-8485-7540B44C8603}.Release|Win32.ActiveCfg = Release|Win32 {C24FB505-05D7-4319-8485-7540B44C8603}.Release|Win32.Build.0 = Release|Win32 {C24FB505-05D7-4319-8485-7540B44C8603}.Release|x64.ActiveCfg = Release|x64 {C24FB505-05D7-4319-8485-7540B44C8603}.Release|x64.Build.0 = Release|x64 + {C24FB505-05D7-4319-8485-7540B44C8603}.Release|x86.ActiveCfg = Release|x64 {B5881A85-FE70-4F64-8607-2CAAE52669C6}.All|Win32.ActiveCfg = Release|x64 {B5881A85-FE70-4F64-8607-2CAAE52669C6}.All|x64.ActiveCfg = Release|x64 {B5881A85-FE70-4F64-8607-2CAAE52669C6}.All|x64.Build.0 = Release|x64 + {B5881A85-FE70-4F64-8607-2CAAE52669C6}.All|x86.ActiveCfg = Release|x64 {B5881A85-FE70-4F64-8607-2CAAE52669C6}.Debug|Win32.ActiveCfg = Debug|Win32 {B5881A85-FE70-4F64-8607-2CAAE52669C6}.Debug|Win32.Build.0 = Debug|Win32 {B5881A85-FE70-4F64-8607-2CAAE52669C6}.Debug|x64.ActiveCfg = Debug|x64 {B5881A85-FE70-4F64-8607-2CAAE52669C6}.Debug|x64.Build.0 = Debug|x64 + {B5881A85-FE70-4F64-8607-2CAAE52669C6}.Debug|x86.ActiveCfg = Debug|x64 {B5881A85-FE70-4F64-8607-2CAAE52669C6}.Release|Win32.ActiveCfg = Release|Win32 {B5881A85-FE70-4F64-8607-2CAAE52669C6}.Release|Win32.Build.0 = Release|Win32 {B5881A85-FE70-4F64-8607-2CAAE52669C6}.Release|x64.ActiveCfg = Release|x64 {B5881A85-FE70-4F64-8607-2CAAE52669C6}.Release|x64.Build.0 = Release|x64 + {B5881A85-FE70-4F64-8607-2CAAE52669C6}.Release|x86.ActiveCfg = Release|x64 {05515420-16DE-4E63-BE73-85BE85BA5142}.All|Win32.ActiveCfg = Release|x64 {05515420-16DE-4E63-BE73-85BE85BA5142}.All|x64.ActiveCfg = Release|x64 {05515420-16DE-4E63-BE73-85BE85BA5142}.All|x64.Build.0 = Release|x64 + {05515420-16DE-4E63-BE73-85BE85BA5142}.All|x86.ActiveCfg = Release|x64 {05515420-16DE-4E63-BE73-85BE85BA5142}.Debug|Win32.ActiveCfg = Debug|Win32 {05515420-16DE-4E63-BE73-85BE85BA5142}.Debug|Win32.Build.0 = Debug|Win32 {05515420-16DE-4E63-BE73-85BE85BA5142}.Debug|x64.ActiveCfg = Debug|x64 {05515420-16DE-4E63-BE73-85BE85BA5142}.Debug|x64.Build.0 = Debug|x64 + {05515420-16DE-4E63-BE73-85BE85BA5142}.Debug|x86.ActiveCfg = Debug|x64 {05515420-16DE-4E63-BE73-85BE85BA5142}.Release|Win32.ActiveCfg = Release|Win32 {05515420-16DE-4E63-BE73-85BE85BA5142}.Release|Win32.Build.0 = Release|Win32 {05515420-16DE-4E63-BE73-85BE85BA5142}.Release|x64.ActiveCfg = Release|x64 {05515420-16DE-4E63-BE73-85BE85BA5142}.Release|x64.Build.0 = Release|x64 + {05515420-16DE-4E63-BE73-85BE85BA5142}.Release|x86.ActiveCfg = Release|x64 {1906D736-08BD-4EE1-924F-B536249B9A54}.All|Win32.ActiveCfg = Release DLL|x64 {1906D736-08BD-4EE1-924F-B536249B9A54}.All|x64.ActiveCfg = Release DLL|x64 {1906D736-08BD-4EE1-924F-B536249B9A54}.All|x64.Build.0 = Release DLL|x64 + {1906D736-08BD-4EE1-924F-B536249B9A54}.All|x86.ActiveCfg = Release|x64 {1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|Win32.ActiveCfg = Debug|Win32 {1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|Win32.Build.0 = Debug|Win32 {1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|x64.ActiveCfg = Debug|x64 {1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|x64.Build.0 = Debug|x64 + {1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|x86.ActiveCfg = Debug|x64 {1906D736-08BD-4EE1-924F-B536249B9A54}.Release|Win32.ActiveCfg = Release|Win32 {1906D736-08BD-4EE1-924F-B536249B9A54}.Release|Win32.Build.0 = Release|Win32 {1906D736-08BD-4EE1-924F-B536249B9A54}.Release|x64.ActiveCfg = Release|x64 {1906D736-08BD-4EE1-924F-B536249B9A54}.Release|x64.Build.0 = Release|x64 + {1906D736-08BD-4EE1-924F-B536249B9A54}.Release|x86.ActiveCfg = Release|x64 {EEF031CB-FED8-451E-A471-91EC8D4F6750}.All|Win32.ActiveCfg = Release Dll|x64 {EEF031CB-FED8-451E-A471-91EC8D4F6750}.All|x64.ActiveCfg = Release Dll|x64 {EEF031CB-FED8-451E-A471-91EC8D4F6750}.All|x64.Build.0 = Release Dll|x64 + {EEF031CB-FED8-451E-A471-91EC8D4F6750}.All|x86.ActiveCfg = Release|x64 {EEF031CB-FED8-451E-A471-91EC8D4F6750}.Debug|Win32.ActiveCfg = Debug|Win32 {EEF031CB-FED8-451E-A471-91EC8D4F6750}.Debug|Win32.Build.0 = Debug|Win32 {EEF031CB-FED8-451E-A471-91EC8D4F6750}.Debug|x64.ActiveCfg = Debug|x64 {EEF031CB-FED8-451E-A471-91EC8D4F6750}.Debug|x64.Build.0 = Debug|x64 + {EEF031CB-FED8-451E-A471-91EC8D4F6750}.Debug|x86.ActiveCfg = Debug|x64 {EEF031CB-FED8-451E-A471-91EC8D4F6750}.Release|Win32.ActiveCfg = Release|Win32 {EEF031CB-FED8-451E-A471-91EC8D4F6750}.Release|Win32.Build.0 = Release|Win32 {EEF031CB-FED8-451E-A471-91EC8D4F6750}.Release|x64.ActiveCfg = Release|x64 {EEF031CB-FED8-451E-A471-91EC8D4F6750}.Release|x64.Build.0 = Release|x64 + {EEF031CB-FED8-451E-A471-91EC8D4F6750}.Release|x86.ActiveCfg = Release|x64 {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.All|Win32.ActiveCfg = Release DLL|x64 {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.All|x64.ActiveCfg = Release DLL|x64 {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.All|x64.Build.0 = Release DLL|x64 + {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.All|x86.ActiveCfg = Release|x64 {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Debug|Win32.ActiveCfg = Debug|Win32 {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Debug|Win32.Build.0 = Debug|Win32 {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Debug|x64.ActiveCfg = Debug|x64 {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Debug|x64.Build.0 = Debug|x64 + {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Debug|x86.ActiveCfg = Debug|x64 {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Release|Win32.ActiveCfg = Release|Win32 {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Release|Win32.Build.0 = Release|Win32 {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Release|x64.ActiveCfg = Release|x64 {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Release|x64.Build.0 = Release|x64 + {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}.Release|x86.ActiveCfg = Release|x64 {8D04B550-D240-4A44-8A18-35DA3F7038D9}.All|Win32.ActiveCfg = Release DLL|x64 {8D04B550-D240-4A44-8A18-35DA3F7038D9}.All|x64.ActiveCfg = Release DLL|x64 {8D04B550-D240-4A44-8A18-35DA3F7038D9}.All|x64.Build.0 = Release DLL|x64 + {8D04B550-D240-4A44-8A18-35DA3F7038D9}.All|x86.ActiveCfg = Release|x64 {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Debug|Win32.ActiveCfg = Debug|Win32 {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Debug|Win32.Build.0 = Debug|Win32 {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Debug|x64.ActiveCfg = Debug|x64 {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Debug|x64.Build.0 = Debug|x64 + {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Debug|x86.ActiveCfg = Debug|x64 {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Release|Win32.ActiveCfg = Release|Win32 {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Release|Win32.Build.0 = Release|Win32 {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Release|x64.ActiveCfg = Release|x64 {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Release|x64.Build.0 = Release|x64 + {8D04B550-D240-4A44-8A18-35DA3F7038D9}.Release|x86.ActiveCfg = Release|x64 {1CED5987-A529-46DC-B30F-870D85FF9C94}.All|Win32.ActiveCfg = Release|x64 {1CED5987-A529-46DC-B30F-870D85FF9C94}.All|x64.ActiveCfg = Release|x64 {1CED5987-A529-46DC-B30F-870D85FF9C94}.All|x64.Build.0 = Release|x64 + {1CED5987-A529-46DC-B30F-870D85FF9C94}.All|x86.ActiveCfg = Release|x64 {1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|Win32.ActiveCfg = Debug|Win32 {1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|Win32.Build.0 = Debug|Win32 {1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|x64.ActiveCfg = Debug|x64 {1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|x64.Build.0 = Debug|x64 + {1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|x86.ActiveCfg = Debug|x64 {1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|Win32.ActiveCfg = Release|Win32 {1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|Win32.Build.0 = Release|Win32 {1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|x64.ActiveCfg = Release|x64 {1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|x64.Build.0 = Release|x64 + {1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|x86.ActiveCfg = Release|x64 {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.All|Win32.ActiveCfg = Release|x64 {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.All|x64.ActiveCfg = Release|x64 {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.All|x64.Build.0 = Release|x64 + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.All|x86.ActiveCfg = Release|x64 {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Debug|Win32.ActiveCfg = Debug|Win32 {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Debug|Win32.Build.0 = Debug|Win32 {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Debug|x64.ActiveCfg = Debug|x64 {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Debug|x64.Build.0 = Debug|x64 + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Debug|x86.ActiveCfg = Debug|x64 {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Release|Win32.ActiveCfg = Release|Win32 {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Release|Win32.Build.0 = Release|Win32 {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Release|x64.ActiveCfg = Release|x64 {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Release|x64.Build.0 = Release|x64 + {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Release|x86.ActiveCfg = Release|x64 {F057DA7F-79E5-4B00-845C-EF446EF055E3}.All|Win32.ActiveCfg = Release|x64 {F057DA7F-79E5-4B00-845C-EF446EF055E3}.All|x64.ActiveCfg = Release|x64 {F057DA7F-79E5-4B00-845C-EF446EF055E3}.All|x64.Build.0 = Release|x64 + {F057DA7F-79E5-4B00-845C-EF446EF055E3}.All|x86.ActiveCfg = Release|x64 {F057DA7F-79E5-4B00-845C-EF446EF055E3}.Debug|Win32.ActiveCfg = Debug|Win32 {F057DA7F-79E5-4B00-845C-EF446EF055E3}.Debug|Win32.Build.0 = Debug|Win32 {F057DA7F-79E5-4B00-845C-EF446EF055E3}.Debug|x64.ActiveCfg = Debug|x64 {F057DA7F-79E5-4B00-845C-EF446EF055E3}.Debug|x64.Build.0 = Debug|x64 + {F057DA7F-79E5-4B00-845C-EF446EF055E3}.Debug|x86.ActiveCfg = Debug|x64 {F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|Win32.ActiveCfg = Release|Win32 {F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|Win32.Build.0 = Release|Win32 {F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|x64.ActiveCfg = Release|x64 {F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|x64.Build.0 = Release|x64 + {F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|x86.ActiveCfg = Release|x64 {E727E8F6-935D-46FE-8B0E-37834748A0E3}.All|Win32.ActiveCfg = Release|x64 {E727E8F6-935D-46FE-8B0E-37834748A0E3}.All|x64.ActiveCfg = Release|x64 {E727E8F6-935D-46FE-8B0E-37834748A0E3}.All|x64.Build.0 = Release|x64 + {E727E8F6-935D-46FE-8B0E-37834748A0E3}.All|x86.ActiveCfg = Release|x64 {E727E8F6-935D-46FE-8B0E-37834748A0E3}.Debug|Win32.ActiveCfg = Debug|Win32 {E727E8F6-935D-46FE-8B0E-37834748A0E3}.Debug|Win32.Build.0 = Debug|Win32 {E727E8F6-935D-46FE-8B0E-37834748A0E3}.Debug|x64.ActiveCfg = Debug|x64 {E727E8F6-935D-46FE-8B0E-37834748A0E3}.Debug|x64.Build.0 = Debug|x64 + {E727E8F6-935D-46FE-8B0E-37834748A0E3}.Debug|x86.ActiveCfg = Debug|x64 {E727E8F6-935D-46FE-8B0E-37834748A0E3}.Release|Win32.ActiveCfg = Release|Win32 {E727E8F6-935D-46FE-8B0E-37834748A0E3}.Release|Win32.Build.0 = Release|Win32 {E727E8F6-935D-46FE-8B0E-37834748A0E3}.Release|x64.ActiveCfg = Release|x64 {E727E8F6-935D-46FE-8B0E-37834748A0E3}.Release|x64.Build.0 = Release|x64 + {E727E8F6-935D-46FE-8B0E-37834748A0E3}.Release|x86.ActiveCfg = Release|x64 {3D0370CA-BED2-4657-A475-32375CBCB6E4}.All|Win32.ActiveCfg = Release|x64 {3D0370CA-BED2-4657-A475-32375CBCB6E4}.All|x64.ActiveCfg = Release|x64 {3D0370CA-BED2-4657-A475-32375CBCB6E4}.All|x64.Build.0 = Release|x64 + {3D0370CA-BED2-4657-A475-32375CBCB6E4}.All|x86.ActiveCfg = Release|x64 {3D0370CA-BED2-4657-A475-32375CBCB6E4}.Debug|Win32.ActiveCfg = Debug|Win32 {3D0370CA-BED2-4657-A475-32375CBCB6E4}.Debug|Win32.Build.0 = Debug|Win32 {3D0370CA-BED2-4657-A475-32375CBCB6E4}.Debug|x64.ActiveCfg = Debug|x64 {3D0370CA-BED2-4657-A475-32375CBCB6E4}.Debug|x64.Build.0 = Debug|x64 + {3D0370CA-BED2-4657-A475-32375CBCB6E4}.Debug|x86.ActiveCfg = Debug|x64 {3D0370CA-BED2-4657-A475-32375CBCB6E4}.Release|Win32.ActiveCfg = Release|Win32 {3D0370CA-BED2-4657-A475-32375CBCB6E4}.Release|Win32.Build.0 = Release|Win32 {3D0370CA-BED2-4657-A475-32375CBCB6E4}.Release|x64.ActiveCfg = Release|x64 {3D0370CA-BED2-4657-A475-32375CBCB6E4}.Release|x64.Build.0 = Release|x64 + {3D0370CA-BED2-4657-A475-32375CBCB6E4}.Release|x86.ActiveCfg = Release|x64 {87EE9DA4-DE1E-4448-8324-183C98DCA588}.All|Win32.ActiveCfg = Debug|x64 {87EE9DA4-DE1E-4448-8324-183C98DCA588}.All|x64.ActiveCfg = Debug|x64 {87EE9DA4-DE1E-4448-8324-183C98DCA588}.All|x64.Build.0 = Debug|x64 + {87EE9DA4-DE1E-4448-8324-183C98DCA588}.All|x86.ActiveCfg = Release|x64 {87EE9DA4-DE1E-4448-8324-183C98DCA588}.Debug|Win32.ActiveCfg = Debug|Win32 {87EE9DA4-DE1E-4448-8324-183C98DCA588}.Debug|Win32.Build.0 = Debug|Win32 {87EE9DA4-DE1E-4448-8324-183C98DCA588}.Debug|x64.ActiveCfg = Debug|x64 {87EE9DA4-DE1E-4448-8324-183C98DCA588}.Debug|x64.Build.0 = Debug|x64 + {87EE9DA4-DE1E-4448-8324-183C98DCA588}.Debug|x86.ActiveCfg = Debug|x64 {87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|Win32.ActiveCfg = Release|Win32 {87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|Win32.Build.0 = Release|Win32 {87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|x64.ActiveCfg = Release|x64 {87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|x64.Build.0 = Release|x64 + {87EE9DA4-DE1E-4448-8324-183C98DCA588}.Release|x86.ActiveCfg = Release|x64 {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.All|Win32.ActiveCfg = Debug|x64 {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.All|x64.ActiveCfg = Debug|x64 {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.All|x64.Build.0 = Debug|x64 + {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.All|x86.ActiveCfg = Release|x64 {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|Win32.ActiveCfg = Debug|Win32 {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|Win32.Build.0 = Debug|Win32 {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|x64.ActiveCfg = Debug|x64 {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|x64.Build.0 = Debug|x64 + {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|x86.ActiveCfg = Debug|x64 {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Release|Win32.ActiveCfg = Release|Win32 {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Release|Win32.Build.0 = Release|Win32 {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Release|x64.ActiveCfg = Release|x64 {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Release|x64.Build.0 = Release|x64 + {155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Release|x86.ActiveCfg = Release|x64 {204FA0DE-305D-4414-AE2E-F195A23F390D}.All|Win32.ActiveCfg = Debug|x64 {204FA0DE-305D-4414-AE2E-F195A23F390D}.All|x64.ActiveCfg = Debug|x64 {204FA0DE-305D-4414-AE2E-F195A23F390D}.All|x64.Build.0 = Debug|x64 + {204FA0DE-305D-4414-AE2E-F195A23F390D}.All|x86.ActiveCfg = Release|x64 {204FA0DE-305D-4414-AE2E-F195A23F390D}.Debug|Win32.ActiveCfg = Debug|Win32 {204FA0DE-305D-4414-AE2E-F195A23F390D}.Debug|Win32.Build.0 = Debug|Win32 {204FA0DE-305D-4414-AE2E-F195A23F390D}.Debug|x64.ActiveCfg = Debug|x64 {204FA0DE-305D-4414-AE2E-F195A23F390D}.Debug|x64.Build.0 = Debug|x64 + {204FA0DE-305D-4414-AE2E-F195A23F390D}.Debug|x86.ActiveCfg = Debug|x64 {204FA0DE-305D-4414-AE2E-F195A23F390D}.Release|Win32.ActiveCfg = Release|Win32 {204FA0DE-305D-4414-AE2E-F195A23F390D}.Release|Win32.Build.0 = Release|Win32 {204FA0DE-305D-4414-AE2E-F195A23F390D}.Release|x64.ActiveCfg = Release|x64 {204FA0DE-305D-4414-AE2E-F195A23F390D}.Release|x64.Build.0 = Release|x64 + {204FA0DE-305D-4414-AE2E-F195A23F390D}.Release|x86.ActiveCfg = Release|x64 {0DF3ABD0-DDC0-4265-B778-07C66780979B}.All|Win32.ActiveCfg = Release|x64 {0DF3ABD0-DDC0-4265-B778-07C66780979B}.All|x64.ActiveCfg = Release|x64 {0DF3ABD0-DDC0-4265-B778-07C66780979B}.All|x64.Build.0 = Release|x64 + {0DF3ABD0-DDC0-4265-B778-07C66780979B}.All|x86.ActiveCfg = Release|x64 {0DF3ABD0-DDC0-4265-B778-07C66780979B}.Debug|Win32.ActiveCfg = Debug|Win32 {0DF3ABD0-DDC0-4265-B778-07C66780979B}.Debug|Win32.Build.0 = Debug|Win32 {0DF3ABD0-DDC0-4265-B778-07C66780979B}.Debug|x64.ActiveCfg = Debug|x64 {0DF3ABD0-DDC0-4265-B778-07C66780979B}.Debug|x64.Build.0 = Debug|x64 + {0DF3ABD0-DDC0-4265-B778-07C66780979B}.Debug|x86.ActiveCfg = Debug|x64 {0DF3ABD0-DDC0-4265-B778-07C66780979B}.Release|Win32.ActiveCfg = Release|Win32 {0DF3ABD0-DDC0-4265-B778-07C66780979B}.Release|Win32.Build.0 = Release|Win32 {0DF3ABD0-DDC0-4265-B778-07C66780979B}.Release|x64.ActiveCfg = Release|x64 {0DF3ABD0-DDC0-4265-B778-07C66780979B}.Release|x64.Build.0 = Release|x64 + {0DF3ABD0-DDC0-4265-B778-07C66780979B}.Release|x86.ActiveCfg = Release|x64 {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.All|Win32.ActiveCfg = Release|Win32 {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.All|Win32.Build.0 = Release|Win32 {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.All|x64.ActiveCfg = Release|Win32 {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.All|x64.Build.0 = Release|Win32 + {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.All|x86.ActiveCfg = Release|Win32 {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Debug|Win32.ActiveCfg = Debug|Win32 {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Debug|Win32.Build.0 = Debug|Win32 {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Debug|x64.ActiveCfg = Debug|Win32 {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Debug|x64.Build.0 = Debug|Win32 + {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Debug|x86.ActiveCfg = Debug|Win32 {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Release|Win32.ActiveCfg = Release|Win32 {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Release|Win32.Build.0 = Release|Win32 {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Release|x64.ActiveCfg = Release|Win32 {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Release|x64.Build.0 = Release|Win32 + {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.Release|x86.ActiveCfg = Release|Win32 {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.All|Win32.ActiveCfg = Release DLL|x64 {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.All|x64.ActiveCfg = Release DLL|x64 {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.All|x64.Build.0 = Release DLL|x64 + {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.All|x86.ActiveCfg = Release|x64 {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Debug|Win32.ActiveCfg = Debug DLL|Win32 {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Debug|Win32.Build.0 = Debug DLL|Win32 {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Debug|x64.ActiveCfg = Debug DLL|x64 {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Debug|x64.Build.0 = Debug DLL|x64 + {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Debug|x86.ActiveCfg = Debug|x64 {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Release|Win32.ActiveCfg = Release DLL|Win32 {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Release|Win32.Build.0 = Release DLL|Win32 {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Release|x64.ActiveCfg = Release DLL|x64 {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Release|x64.Build.0 = Release DLL|x64 + {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}.Release|x86.ActiveCfg = Release|x64 {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.All|Win32.ActiveCfg = Release Passthrough|x64 {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.All|x64.ActiveCfg = Release Passthrough|x64 {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.All|x64.Build.0 = Release Passthrough|x64 + {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.All|x86.ActiveCfg = Release|x64 {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Debug|Win32.ActiveCfg = Debug Passthrough|Win32 {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Debug|Win32.Build.0 = Debug Passthrough|Win32 {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Debug|x64.ActiveCfg = Debug Passthrough|x64 {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Debug|x64.Build.0 = Debug Passthrough|x64 + {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Debug|x86.ActiveCfg = Debug|x64 {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|Win32.ActiveCfg = Release Passthrough|Win32 {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|Win32.Build.0 = Release Passthrough|Win32 {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|x64.ActiveCfg = Release Passthrough|x64 {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|x64.Build.0 = Release Passthrough|x64 + {FEA1EEF7-876F-48DE-88BF-C0E3E606D758}.Release|x86.ActiveCfg = Release|x64 {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.All|Win32.ActiveCfg = Release|x64 {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.All|x64.ActiveCfg = Release|x64 {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.All|x64.Build.0 = Release|x64 + {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.All|x86.ActiveCfg = Release|x64 {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Debug|Win32.ActiveCfg = Debug|Win32 {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Debug|Win32.Build.0 = Debug|Win32 {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Debug|x64.ActiveCfg = Debug|x64 {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Debug|x64.Build.0 = Debug|x64 + {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Debug|x86.ActiveCfg = Debug|x64 {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Release|Win32.ActiveCfg = Release|Win32 {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Release|Win32.Build.0 = Release|Win32 {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Release|x64.ActiveCfg = Release|x64 {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Release|x64.Build.0 = Release|x64 + {9254C4B0-6F60-42B6-BB3A-36D63FC001C7}.Release|x86.ActiveCfg = Release|x64 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.All|Win32.ActiveCfg = Release|x64 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.All|x64.ActiveCfg = Release|x64 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.All|x64.Build.0 = Release|x64 + {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.All|x86.ActiveCfg = Release|x64 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|Win32.ActiveCfg = Debug|Win32 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|Win32.Build.0 = Debug|Win32 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|x64.ActiveCfg = Debug|x64 + {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|x86.ActiveCfg = Debug|x64 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|Win32.ActiveCfg = Release|Win32 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|Win32.Build.0 = Release|Win32 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|x64.ActiveCfg = Release|x64 + {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|x86.ActiveCfg = Release|x64 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.All|Win32.ActiveCfg = Release|x64 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.All|x64.ActiveCfg = Release|x64 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.All|x64.Build.0 = Release|x64 + {8F992C49-6C51-412F-B2A3-34EAB708EB65}.All|x86.ActiveCfg = Release|x64 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|Win32.ActiveCfg = Debug|Win32 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|Win32.Build.0 = Debug|Win32 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|x64.ActiveCfg = Debug|x64 + {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|x86.ActiveCfg = Debug|x64 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|Win32.ActiveCfg = Release|Win32 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|Win32.Build.0 = Release|Win32 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|x64.ActiveCfg = Release|x64 + {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|x86.ActiveCfg = Release|x64 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|Win32.ActiveCfg = Release|x64 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|x64.ActiveCfg = Release|x64 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|x64.Build.0 = Release|x64 + {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|x86.ActiveCfg = Release|x64 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|Win32.ActiveCfg = Debug|Win32 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|Win32.Build.0 = Debug|Win32 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|x64.ActiveCfg = Debug|x64 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|x64.Build.0 = Debug|x64 + {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|x86.ActiveCfg = Debug|x64 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|Win32.ActiveCfg = Release|Win32 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|Win32.Build.0 = Release|Win32 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|x64.ActiveCfg = Release|x64 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|x64.Build.0 = Release|x64 + {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|x86.ActiveCfg = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|Win32.ActiveCfg = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|x64.ActiveCfg = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|x64.Build.0 = Release|x64 + {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|x86.ActiveCfg = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|Win32.ActiveCfg = Debug|Win32 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|Win32.Build.0 = Debug|Win32 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|x64.ActiveCfg = Debug|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|x64.Build.0 = Debug|x64 + {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|x86.ActiveCfg = Debug|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|Win32.ActiveCfg = Release|Win32 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|Win32.Build.0 = Release|Win32 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|x64.ActiveCfg = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|x64.Build.0 = Release|x64 + {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|x86.ActiveCfg = Release|x64 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.All|Win32.ActiveCfg = Release|x64 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.All|x64.ActiveCfg = Release|x64 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.All|x64.Build.0 = Release|x64 + {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.All|x86.ActiveCfg = Release|x64 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|Win32.ActiveCfg = Debug|Win32 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|Win32.Build.0 = Debug|Win32 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|x64.ActiveCfg = Debug|x64 + {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|x86.ActiveCfg = Debug|x64 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|Win32.ActiveCfg = Release|Win32 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|Win32.Build.0 = Release|Win32 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|x64.ActiveCfg = Release|x64 + {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|x86.ActiveCfg = Release|x64 {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.All|Win32.ActiveCfg = Release|x64 {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.All|x64.ActiveCfg = Release|x64 {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.All|x64.Build.0 = Release|x64 + {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.All|x86.ActiveCfg = Release|x64 {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Debug|Win32.ActiveCfg = Debug|Win32 {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Debug|Win32.Build.0 = Debug|Win32 {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Debug|x64.ActiveCfg = Debug|x64 {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Debug|x64.Build.0 = Debug|x64 + {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Debug|x86.ActiveCfg = Debug|x64 {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Release|Win32.ActiveCfg = Release|Win32 {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Release|Win32.Build.0 = Release|Win32 {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Release|x64.ActiveCfg = Release|x64 {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Release|x64.Build.0 = Release|x64 + {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Release|x86.ActiveCfg = Release|x64 {988CACF7-3FCB-4992-BE69-77872AE67DC8}.All|Win32.ActiveCfg = Release|x64 {988CACF7-3FCB-4992-BE69-77872AE67DC8}.All|x64.ActiveCfg = Release|x64 {988CACF7-3FCB-4992-BE69-77872AE67DC8}.All|x64.Build.0 = Release|x64 + {988CACF7-3FCB-4992-BE69-77872AE67DC8}.All|x86.ActiveCfg = Release|x64 {988CACF7-3FCB-4992-BE69-77872AE67DC8}.Debug|Win32.ActiveCfg = Debug|Win32 {988CACF7-3FCB-4992-BE69-77872AE67DC8}.Debug|Win32.Build.0 = Debug|Win32 {988CACF7-3FCB-4992-BE69-77872AE67DC8}.Debug|x64.ActiveCfg = Debug|x64 {988CACF7-3FCB-4992-BE69-77872AE67DC8}.Debug|x64.Build.0 = Debug|x64 + {988CACF7-3FCB-4992-BE69-77872AE67DC8}.Debug|x86.ActiveCfg = Debug|x64 {988CACF7-3FCB-4992-BE69-77872AE67DC8}.Release|Win32.ActiveCfg = Release|Win32 {988CACF7-3FCB-4992-BE69-77872AE67DC8}.Release|Win32.Build.0 = Release|Win32 {988CACF7-3FCB-4992-BE69-77872AE67DC8}.Release|x64.ActiveCfg = Release|x64 {988CACF7-3FCB-4992-BE69-77872AE67DC8}.Release|x64.Build.0 = Release|x64 + {988CACF7-3FCB-4992-BE69-77872AE67DC8}.Release|x86.ActiveCfg = Release|x64 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.All|Win32.ActiveCfg = Release DirectSound|x64 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.All|x64.ActiveCfg = Release DirectSound|x64 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.All|x64.Build.0 = Release DirectSound|x64 + {0A18A071-125E-442F-AFF7-A3F68ABECF99}.All|x86.ActiveCfg = Release|x64 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|Win32.ActiveCfg = Debug|Win32 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|Win32.Build.0 = Debug|Win32 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x64.ActiveCfg = Debug|x64 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x64.Build.0 = Debug|x64 + {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Debug|x86.ActiveCfg = Debug|x64 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|Win32.ActiveCfg = Release|Win32 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|Win32.Build.0 = Release|Win32 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x64.ActiveCfg = Release|x64 {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x64.Build.0 = Release|x64 + {0A18A071-125E-442F-AFF7-A3F68ABECF99}.Release|x86.ActiveCfg = Release|x64 {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.All|Win32.ActiveCfg = Release|x64 {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.All|x64.ActiveCfg = Release|x64 {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.All|x64.Build.0 = Release|x64 + {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.All|x86.ActiveCfg = Release|x64 {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Debug|Win32.ActiveCfg = Debug|Win32 {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Debug|Win32.Build.0 = Debug|Win32 {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Debug|x64.ActiveCfg = Debug|x64 {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Debug|x64.Build.0 = Debug|x64 + {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Debug|x86.ActiveCfg = Debug|x64 {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Release|Win32.ActiveCfg = Release|Win32 {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Release|Win32.Build.0 = Release|Win32 {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Release|x64.ActiveCfg = Release|x64 {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Release|x64.Build.0 = Release|x64 + {08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}.Release|x86.ActiveCfg = Release|x64 {8DEB383C-4091-4F42-A56F-C9E46D552D79}.All|Win32.ActiveCfg = Release Passthrough|x64 {8DEB383C-4091-4F42-A56F-C9E46D552D79}.All|x64.ActiveCfg = Release Passthrough|x64 {8DEB383C-4091-4F42-A56F-C9E46D552D79}.All|x64.Build.0 = Release Passthrough|x64 + {8DEB383C-4091-4F42-A56F-C9E46D552D79}.All|x86.ActiveCfg = Release|x64 {8DEB383C-4091-4F42-A56F-C9E46D552D79}.Debug|Win32.ActiveCfg = Debug Passthrough|Win32 {8DEB383C-4091-4F42-A56F-C9E46D552D79}.Debug|Win32.Build.0 = Debug Passthrough|Win32 {8DEB383C-4091-4F42-A56F-C9E46D552D79}.Debug|x64.ActiveCfg = Debug Passthrough|x64 {8DEB383C-4091-4F42-A56F-C9E46D552D79}.Debug|x64.Build.0 = Debug Passthrough|x64 + {8DEB383C-4091-4F42-A56F-C9E46D552D79}.Debug|x86.ActiveCfg = Debug|x64 {8DEB383C-4091-4F42-A56F-C9E46D552D79}.Release|Win32.ActiveCfg = Release Passthrough|Win32 {8DEB383C-4091-4F42-A56F-C9E46D552D79}.Release|Win32.Build.0 = Release Passthrough|Win32 {8DEB383C-4091-4F42-A56F-C9E46D552D79}.Release|x64.ActiveCfg = Release Passthrough|x64 {8DEB383C-4091-4F42-A56F-C9E46D552D79}.Release|x64.Build.0 = Release Passthrough|x64 + {8DEB383C-4091-4F42-A56F-C9E46D552D79}.Release|x86.ActiveCfg = Release|x64 {2C3C2423-234B-4772-8899-D3B137E5CA35}.All|Win32.ActiveCfg = Release|x64 {2C3C2423-234B-4772-8899-D3B137E5CA35}.All|x64.ActiveCfg = Release|x64 {2C3C2423-234B-4772-8899-D3B137E5CA35}.All|x64.Build.0 = Release|x64 + {2C3C2423-234B-4772-8899-D3B137E5CA35}.All|x86.ActiveCfg = Release|x64 {2C3C2423-234B-4772-8899-D3B137E5CA35}.Debug|Win32.ActiveCfg = Debug|Win32 {2C3C2423-234B-4772-8899-D3B137E5CA35}.Debug|Win32.Build.0 = Debug|Win32 {2C3C2423-234B-4772-8899-D3B137E5CA35}.Debug|x64.ActiveCfg = Debug|x64 {2C3C2423-234B-4772-8899-D3B137E5CA35}.Debug|x64.Build.0 = Debug|x64 + {2C3C2423-234B-4772-8899-D3B137E5CA35}.Debug|x86.ActiveCfg = Debug|x64 {2C3C2423-234B-4772-8899-D3B137E5CA35}.Release|Win32.ActiveCfg = Release|Win32 {2C3C2423-234B-4772-8899-D3B137E5CA35}.Release|Win32.Build.0 = Release|Win32 {2C3C2423-234B-4772-8899-D3B137E5CA35}.Release|x64.ActiveCfg = Release|x64 {2C3C2423-234B-4772-8899-D3B137E5CA35}.Release|x64.Build.0 = Release|x64 + {2C3C2423-234B-4772-8899-D3B137E5CA35}.Release|x86.ActiveCfg = Release|x64 {3850D93A-5F24-4922-BC1C-74D08C37C256}.All|Win32.ActiveCfg = Release|x64 {3850D93A-5F24-4922-BC1C-74D08C37C256}.All|x64.ActiveCfg = Release|x64 {3850D93A-5F24-4922-BC1C-74D08C37C256}.All|x64.Build.0 = Release|x64 + {3850D93A-5F24-4922-BC1C-74D08C37C256}.All|x86.ActiveCfg = Release|x64 {3850D93A-5F24-4922-BC1C-74D08C37C256}.Debug|Win32.ActiveCfg = Debug|Win32 {3850D93A-5F24-4922-BC1C-74D08C37C256}.Debug|Win32.Build.0 = Debug|Win32 {3850D93A-5F24-4922-BC1C-74D08C37C256}.Debug|x64.ActiveCfg = Debug|x64 {3850D93A-5F24-4922-BC1C-74D08C37C256}.Debug|x64.Build.0 = Debug|x64 + {3850D93A-5F24-4922-BC1C-74D08C37C256}.Debug|x86.ActiveCfg = Debug|x64 {3850D93A-5F24-4922-BC1C-74D08C37C256}.Release|Win32.ActiveCfg = Release|Win32 {3850D93A-5F24-4922-BC1C-74D08C37C256}.Release|Win32.Build.0 = Release|Win32 {3850D93A-5F24-4922-BC1C-74D08C37C256}.Release|x64.ActiveCfg = Release|x64 {3850D93A-5F24-4922-BC1C-74D08C37C256}.Release|x64.Build.0 = Release|x64 + {3850D93A-5F24-4922-BC1C-74D08C37C256}.Release|x86.ActiveCfg = Release|x64 {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.All|Win32.ActiveCfg = Release|x64 {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.All|x64.ActiveCfg = Release|x64 {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.All|x64.Build.0 = Release|x64 + {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.All|x86.ActiveCfg = Release|x64 {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Debug|Win32.ActiveCfg = Debug|Win32 {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Debug|Win32.Build.0 = Debug|Win32 {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Debug|x64.ActiveCfg = Debug|x64 {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Debug|x64.Build.0 = Debug|x64 + {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Debug|x86.ActiveCfg = Debug|x64 {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Release|Win32.ActiveCfg = Release|Win32 {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Release|Win32.Build.0 = Release|Win32 {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Release|x64.ActiveCfg = Release|x64 {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Release|x64.Build.0 = Release|x64 + {2CA40887-1622-46A1-A7F9-17FD7E7E545B}.Release|x86.ActiveCfg = Release|x64 {028C7278-05D7-4E18-82FE-BE231B844F41}.All|Win32.ActiveCfg = Release|x64 {028C7278-05D7-4E18-82FE-BE231B844F41}.All|x64.ActiveCfg = Release|x64 {028C7278-05D7-4E18-82FE-BE231B844F41}.All|x64.Build.0 = Release|x64 + {028C7278-05D7-4E18-82FE-BE231B844F41}.All|x86.ActiveCfg = Release|x64 {028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|Win32.ActiveCfg = Debug|Win32 {028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|Win32.Build.0 = Debug|Win32 {028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|x64.ActiveCfg = Debug|x64 + {028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|x86.ActiveCfg = Debug|x64 {028C7278-05D7-4E18-82FE-BE231B844F41}.Release|Win32.ActiveCfg = Release|Win32 {028C7278-05D7-4E18-82FE-BE231B844F41}.Release|Win32.Build.0 = Release|Win32 {028C7278-05D7-4E18-82FE-BE231B844F41}.Release|x64.ActiveCfg = Release|x64 + {028C7278-05D7-4E18-82FE-BE231B844F41}.Release|x86.ActiveCfg = Release|x64 {D7F1E3F2-A3F4-474C-8555-15122571AF52}.All|Win32.ActiveCfg = Release|x64 {D7F1E3F2-A3F4-474C-8555-15122571AF52}.All|x64.ActiveCfg = Release|x64 {D7F1E3F2-A3F4-474C-8555-15122571AF52}.All|x64.Build.0 = Release|x64 + {D7F1E3F2-A3F4-474C-8555-15122571AF52}.All|x86.ActiveCfg = Release|x64 {D7F1E3F2-A3F4-474C-8555-15122571AF52}.Debug|Win32.ActiveCfg = Debug|Win32 {D7F1E3F2-A3F4-474C-8555-15122571AF52}.Debug|Win32.Build.0 = Debug|Win32 {D7F1E3F2-A3F4-474C-8555-15122571AF52}.Debug|x64.ActiveCfg = Debug|x64 {D7F1E3F2-A3F4-474C-8555-15122571AF52}.Debug|x64.Build.0 = Debug|x64 + {D7F1E3F2-A3F4-474C-8555-15122571AF52}.Debug|x86.ActiveCfg = Debug|x64 {D7F1E3F2-A3F4-474C-8555-15122571AF52}.Release|Win32.ActiveCfg = Release|Win32 {D7F1E3F2-A3F4-474C-8555-15122571AF52}.Release|Win32.Build.0 = Release|Win32 {D7F1E3F2-A3F4-474C-8555-15122571AF52}.Release|x64.ActiveCfg = Release|x64 {D7F1E3F2-A3F4-474C-8555-15122571AF52}.Release|x64.Build.0 = Release|x64 + {D7F1E3F2-A3F4-474C-8555-15122571AF52}.Release|x86.ActiveCfg = Release|x64 {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.All|Win32.ActiveCfg = Release|x64 {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.All|x64.ActiveCfg = Release|x64 {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.All|x64.Build.0 = Release|x64 + {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.All|x86.ActiveCfg = Release|x64 {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Debug|Win32.ActiveCfg = Debug|Win32 {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Debug|Win32.Build.0 = Debug|Win32 {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Debug|x64.ActiveCfg = Debug|x64 {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Debug|x64.Build.0 = Debug|x64 + {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Debug|x86.ActiveCfg = Debug|x64 {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Release|Win32.ActiveCfg = Release|Win32 {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Release|Win32.Build.0 = Release|Win32 {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Release|x64.ActiveCfg = Release|x64 {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Release|x64.Build.0 = Release|x64 + {5BC072DB-3826-48EA-AF34-FE32AA01E83B}.Release|x86.ActiveCfg = Release|x64 {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.All|Win32.ActiveCfg = Release|x64 {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.All|x64.ActiveCfg = Release|x64 {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.All|x64.Build.0 = Release|x64 + {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.All|x86.ActiveCfg = Release|x64 {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Debug|Win32.ActiveCfg = Debug|Win32 {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Debug|Win32.Build.0 = Debug|Win32 {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Debug|x64.ActiveCfg = Debug|x64 {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Debug|x64.Build.0 = Debug|x64 + {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Debug|x86.ActiveCfg = Debug|x64 {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Release|Win32.ActiveCfg = Release|Win32 {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Release|Win32.Build.0 = Release|Win32 {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Release|x64.ActiveCfg = Release|x64 {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Release|x64.Build.0 = Release|x64 + {FA429E98-8B03-45E6-A096-A4BC5E821DE4}.Release|x86.ActiveCfg = Release|x64 {06E3A538-AB32-44F2-B477-755FF9CB5D37}.All|Win32.ActiveCfg = Release|x64 {06E3A538-AB32-44F2-B477-755FF9CB5D37}.All|x64.ActiveCfg = Release|x64 {06E3A538-AB32-44F2-B477-755FF9CB5D37}.All|x64.Build.0 = Release|x64 + {06E3A538-AB32-44F2-B477-755FF9CB5D37}.All|x86.ActiveCfg = Release|x64 {06E3A538-AB32-44F2-B477-755FF9CB5D37}.Debug|Win32.ActiveCfg = Debug|Win32 {06E3A538-AB32-44F2-B477-755FF9CB5D37}.Debug|Win32.Build.0 = Debug|Win32 {06E3A538-AB32-44F2-B477-755FF9CB5D37}.Debug|x64.ActiveCfg = Debug|x64 {06E3A538-AB32-44F2-B477-755FF9CB5D37}.Debug|x64.Build.0 = Debug|x64 + {06E3A538-AB32-44F2-B477-755FF9CB5D37}.Debug|x86.ActiveCfg = Debug|x64 {06E3A538-AB32-44F2-B477-755FF9CB5D37}.Release|Win32.ActiveCfg = Release|Win32 {06E3A538-AB32-44F2-B477-755FF9CB5D37}.Release|Win32.Build.0 = Release|Win32 {06E3A538-AB32-44F2-B477-755FF9CB5D37}.Release|x64.ActiveCfg = Release|x64 {06E3A538-AB32-44F2-B477-755FF9CB5D37}.Release|x64.Build.0 = Release|x64 + {06E3A538-AB32-44F2-B477-755FF9CB5D37}.Release|x86.ActiveCfg = Release|x64 {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.All|Win32.ActiveCfg = Release|x64 {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.All|x64.ActiveCfg = Release|x64 {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.All|x64.Build.0 = Release|x64 + {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.All|x86.ActiveCfg = Release|x64 {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Debug|Win32.ActiveCfg = Debug|Win32 {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Debug|Win32.Build.0 = Debug|Win32 {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Debug|x64.ActiveCfg = Debug|x64 {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Debug|x64.Build.0 = Debug|x64 + {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Debug|x86.ActiveCfg = Debug|x64 {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Release|Win32.ActiveCfg = Release|Win32 {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Release|Win32.Build.0 = Release|Win32 {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Release|x64.ActiveCfg = Release|x64 {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Release|x64.Build.0 = Release|x64 + {6D1BEC70-4DCD-4FE9-ADBD-4A43A67E4D05}.Release|x86.ActiveCfg = Release|x64 {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.All|Win32.ActiveCfg = Release|x64 {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.All|x64.ActiveCfg = Release|x64 {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.All|x64.Build.0 = Release|x64 + {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.All|x86.ActiveCfg = Release|x64 {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Debug|Win32.ActiveCfg = Debug|Win32 {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Debug|Win32.Build.0 = Debug|Win32 {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Debug|x64.ActiveCfg = Debug|x64 {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Debug|x64.Build.0 = Debug|x64 + {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Debug|x86.ActiveCfg = Debug|x64 {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Release|Win32.ActiveCfg = Release|Win32 {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Release|Win32.Build.0 = Release|Win32 {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Release|x64.ActiveCfg = Release|x64 {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Release|x64.Build.0 = Release|x64 + {A4B122CF-5196-476B-8C0E-D8BD59AC3C14}.Release|x86.ActiveCfg = Release|x64 {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.All|Win32.ActiveCfg = Release|x64 {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.All|x64.ActiveCfg = Release|x64 {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.All|x64.Build.0 = Release|x64 + {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.All|x86.ActiveCfg = Release|x64 {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Debug|Win32.ActiveCfg = Debug|Win32 {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Debug|Win32.Build.0 = Debug|Win32 {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Debug|x64.ActiveCfg = Debug|x64 {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Debug|x64.Build.0 = Debug|x64 + {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Debug|x86.ActiveCfg = Debug|x64 {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Release|Win32.ActiveCfg = Release|Win32 {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Release|Win32.Build.0 = Release|Win32 {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Release|x64.ActiveCfg = Release|x64 {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Release|x64.Build.0 = Release|x64 + {75DF7F29-2FBF-47F7-B5AF-5B4952DC1ABD}.Release|x86.ActiveCfg = Release|x64 {F6A33240-8F29-48BD-98F0-826995911799}.All|Win32.ActiveCfg = Release|x64 {F6A33240-8F29-48BD-98F0-826995911799}.All|x64.ActiveCfg = Release|x64 {F6A33240-8F29-48BD-98F0-826995911799}.All|x64.Build.0 = Release|x64 + {F6A33240-8F29-48BD-98F0-826995911799}.All|x86.ActiveCfg = Release|x64 {F6A33240-8F29-48BD-98F0-826995911799}.Debug|Win32.ActiveCfg = Debug|Win32 {F6A33240-8F29-48BD-98F0-826995911799}.Debug|Win32.Build.0 = Debug|Win32 {F6A33240-8F29-48BD-98F0-826995911799}.Debug|x64.ActiveCfg = Debug|x64 {F6A33240-8F29-48BD-98F0-826995911799}.Debug|x64.Build.0 = Debug|x64 + {F6A33240-8F29-48BD-98F0-826995911799}.Debug|x86.ActiveCfg = Debug|x64 {F6A33240-8F29-48BD-98F0-826995911799}.Release|Win32.ActiveCfg = Release|Win32 {F6A33240-8F29-48BD-98F0-826995911799}.Release|Win32.Build.0 = Release|Win32 {F6A33240-8F29-48BD-98F0-826995911799}.Release|x64.ActiveCfg = Release|x64 {F6A33240-8F29-48BD-98F0-826995911799}.Release|x64.Build.0 = Release|x64 + {F6A33240-8F29-48BD-98F0-826995911799}.Release|x86.ActiveCfg = Release|x64 {65A6273D-FCAB-4C55-B09E-65100141A5D4}.All|Win32.ActiveCfg = Release|x64 {65A6273D-FCAB-4C55-B09E-65100141A5D4}.All|x64.ActiveCfg = Release|x64 {65A6273D-FCAB-4C55-B09E-65100141A5D4}.All|x64.Build.0 = Release|x64 + {65A6273D-FCAB-4C55-B09E-65100141A5D4}.All|x86.ActiveCfg = Release|x64 {65A6273D-FCAB-4C55-B09E-65100141A5D4}.Debug|Win32.ActiveCfg = Debug|Win32 {65A6273D-FCAB-4C55-B09E-65100141A5D4}.Debug|Win32.Build.0 = Debug|Win32 {65A6273D-FCAB-4C55-B09E-65100141A5D4}.Debug|x64.ActiveCfg = Debug|x64 {65A6273D-FCAB-4C55-B09E-65100141A5D4}.Debug|x64.Build.0 = Debug|x64 + {65A6273D-FCAB-4C55-B09E-65100141A5D4}.Debug|x86.ActiveCfg = Debug|x64 {65A6273D-FCAB-4C55-B09E-65100141A5D4}.Release|Win32.ActiveCfg = Release|Win32 {65A6273D-FCAB-4C55-B09E-65100141A5D4}.Release|Win32.Build.0 = Release|Win32 {65A6273D-FCAB-4C55-B09E-65100141A5D4}.Release|x64.ActiveCfg = Release|x64 {65A6273D-FCAB-4C55-B09E-65100141A5D4}.Release|x64.Build.0 = Release|x64 + {65A6273D-FCAB-4C55-B09E-65100141A5D4}.Release|x86.ActiveCfg = Release|x64 {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.All|Win32.ActiveCfg = Release|x64 {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.All|x64.ActiveCfg = Release|x64 {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.All|x64.Build.0 = Release|x64 + {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.All|x86.ActiveCfg = Release|x64 {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Debug|Win32.ActiveCfg = Debug|Win32 {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Debug|Win32.Build.0 = Debug|Win32 {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Debug|x64.ActiveCfg = Debug|x64 {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Debug|x64.Build.0 = Debug|x64 + {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Debug|x86.ActiveCfg = Debug|x64 {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Release|Win32.ActiveCfg = Release|Win32 {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Release|Win32.Build.0 = Release|Win32 {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Release|x64.ActiveCfg = Release|x64 {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Release|x64.Build.0 = Release|x64 + {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24}.Release|x86.ActiveCfg = Release|x64 {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.All|Win32.ActiveCfg = Release|x64 {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.All|x64.ActiveCfg = Release|x64 {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.All|x64.Build.0 = Release|x64 + {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.All|x86.ActiveCfg = Release|x64 {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Debug|Win32.ActiveCfg = Debug|Win32 {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Debug|Win32.Build.0 = Debug|Win32 {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Debug|x64.ActiveCfg = Debug|x64 {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Debug|x64.Build.0 = Debug|x64 + {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Debug|x86.ActiveCfg = Debug|x64 {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Release|Win32.ActiveCfg = Release|Win32 {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Release|Win32.Build.0 = Release|Win32 {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Release|x64.ActiveCfg = Release|x64 {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Release|x64.Build.0 = Release|x64 + {D0BCAC02-D94B-46B8-9B49-CDDCC2BD7909}.Release|x86.ActiveCfg = Release|x64 {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.All|Win32.ActiveCfg = Release|x64 {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.All|x64.ActiveCfg = Release|x64 {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.All|x64.Build.0 = Release|x64 + {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.All|x86.ActiveCfg = Release|x64 {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Debug|Win32.ActiveCfg = Debug|Win32 {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Debug|Win32.Build.0 = Debug|Win32 {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Debug|x64.ActiveCfg = Debug|x64 {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Debug|x64.Build.0 = Debug|x64 + {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Debug|x86.ActiveCfg = Debug|x64 {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Release|Win32.ActiveCfg = Release|Win32 {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Release|Win32.Build.0 = Release|Win32 {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Release|x64.ActiveCfg = Release|x64 {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Release|x64.Build.0 = Release|x64 + {44D7DEAF-FDA5-495E-8B9D-1439E4F4C21E}.Release|x86.ActiveCfg = Release|x64 {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.All|Win32.ActiveCfg = Release|x64 {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.All|x64.ActiveCfg = Release|x64 {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.All|x64.Build.0 = Release|x64 + {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.All|x86.ActiveCfg = Release|x64 {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Debug|Win32.ActiveCfg = Debug|Win32 {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Debug|Win32.Build.0 = Debug|Win32 {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Debug|x64.ActiveCfg = Debug|x64 {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Debug|x64.Build.0 = Debug|x64 + {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Debug|x86.ActiveCfg = Debug|x64 {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Release|Win32.ActiveCfg = Release|Win32 {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Release|Win32.Build.0 = Release|Win32 {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Release|x64.ActiveCfg = Release|x64 {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Release|x64.Build.0 = Release|x64 + {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52}.Release|x86.ActiveCfg = Release|x64 {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.All|Win32.ActiveCfg = Release|x64 {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.All|x64.ActiveCfg = Release|x64 {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.All|x64.Build.0 = Release|x64 + {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.All|x86.ActiveCfg = Release|x64 {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Debug|Win32.ActiveCfg = Debug|Win32 {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Debug|Win32.Build.0 = Debug|Win32 {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Debug|x64.ActiveCfg = Debug|x64 {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Debug|x64.Build.0 = Debug|x64 + {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Debug|x86.ActiveCfg = Debug|x64 {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Release|Win32.ActiveCfg = Release|Win32 {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Release|Win32.Build.0 = Release|Win32 {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Release|x64.ActiveCfg = Release|x64 {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Release|x64.Build.0 = Release|x64 + {E3246D17-E29B-4AB5-962A-C69B0C5837BB}.Release|x86.ActiveCfg = Release|x64 {36E854E3-CE12-4348-A125-CCF3F9D74813}.All|Win32.ActiveCfg = Release|x64 {36E854E3-CE12-4348-A125-CCF3F9D74813}.All|x64.ActiveCfg = Release|x64 {36E854E3-CE12-4348-A125-CCF3F9D74813}.All|x64.Build.0 = Release|x64 + {36E854E3-CE12-4348-A125-CCF3F9D74813}.All|x86.ActiveCfg = Release|x64 {36E854E3-CE12-4348-A125-CCF3F9D74813}.Debug|Win32.ActiveCfg = Debug|Win32 {36E854E3-CE12-4348-A125-CCF3F9D74813}.Debug|Win32.Build.0 = Debug|Win32 {36E854E3-CE12-4348-A125-CCF3F9D74813}.Debug|x64.ActiveCfg = Debug|x64 + {36E854E3-CE12-4348-A125-CCF3F9D74813}.Debug|x86.ActiveCfg = Debug|x64 {36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|Win32.ActiveCfg = Release|Win32 {36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|Win32.Build.0 = Release|Win32 {36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|x64.ActiveCfg = Release|x64 + {36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|x86.ActiveCfg = Release|x64 {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.All|Win32.ActiveCfg = Release|x64 {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.All|x64.ActiveCfg = Release|x64 {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.All|x64.Build.0 = Release|x64 + {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.All|x86.ActiveCfg = Release|x64 {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Debug|Win32.ActiveCfg = Debug|Win32 {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Debug|Win32.Build.0 = Debug|Win32 {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Debug|x64.ActiveCfg = Debug|x64 {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Debug|x64.Build.0 = Debug|x64 + {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Debug|x86.ActiveCfg = Debug|x64 {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|Win32.ActiveCfg = Release|Win32 {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|Win32.Build.0 = Release|Win32 {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|x64.ActiveCfg = Release|x64 {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|x64.Build.0 = Release|x64 + {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.Release|x86.ActiveCfg = Release|x64 {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.All|Win32.ActiveCfg = Release|x64 {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.All|x64.ActiveCfg = Release|x64 {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.All|x64.Build.0 = Release|x64 + {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.All|x86.ActiveCfg = Release|x64 {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Debug|Win32.ActiveCfg = Debug|Win32 {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Debug|Win32.Build.0 = Debug|Win32 {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Debug|x64.ActiveCfg = Debug|x64 {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Debug|x64.Build.0 = Debug|x64 + {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Debug|x86.ActiveCfg = Debug|x64 {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|Win32.ActiveCfg = Release|Win32 {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|Win32.Build.0 = Release|Win32 {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|x64.ActiveCfg = Release|x64 {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|x64.Build.0 = Release|x64 + {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9}.Release|x86.ActiveCfg = Release|x64 {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.All|Win32.ActiveCfg = Release|x64 {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.All|x64.ActiveCfg = Release|x64 {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.All|x64.Build.0 = Release|x64 + {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.All|x86.ActiveCfg = Release|x64 {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Debug|Win32.ActiveCfg = Debug|Win32 {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Debug|Win32.Build.0 = Debug|Win32 {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Debug|x64.ActiveCfg = Debug|x64 {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Debug|x64.Build.0 = Debug|x64 + {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Debug|x86.ActiveCfg = Debug|x64 {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|Win32.ActiveCfg = Release|Win32 {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|Win32.Build.0 = Release|Win32 {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|x64.ActiveCfg = Release|x64 {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|x64.Build.0 = Release|x64 + {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA}.Release|x86.ActiveCfg = Release|x64 {0D108721-EAE8-4BAF-8102-D8960EC93647}.All|Win32.ActiveCfg = Debug|x64 {0D108721-EAE8-4BAF-8102-D8960EC93647}.All|x64.ActiveCfg = Debug|x64 {0D108721-EAE8-4BAF-8102-D8960EC93647}.All|x64.Build.0 = Debug|x64 + {0D108721-EAE8-4BAF-8102-D8960EC93647}.All|x86.ActiveCfg = Release|x64 {0D108721-EAE8-4BAF-8102-D8960EC93647}.Debug|Win32.ActiveCfg = Debug|Win32 {0D108721-EAE8-4BAF-8102-D8960EC93647}.Debug|Win32.Build.0 = Debug|Win32 {0D108721-EAE8-4BAF-8102-D8960EC93647}.Debug|x64.ActiveCfg = Debug|x64 {0D108721-EAE8-4BAF-8102-D8960EC93647}.Debug|x64.Build.0 = Debug|x64 + {0D108721-EAE8-4BAF-8102-D8960EC93647}.Debug|x86.ActiveCfg = Debug|x64 {0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|Win32.ActiveCfg = Release|Win32 {0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|Win32.Build.0 = Release|Win32 {0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|x64.ActiveCfg = Release|x64 {0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|x64.Build.0 = Release|x64 + {0D108721-EAE8-4BAF-8102-D8960EC93647}.Release|x86.ActiveCfg = Release|x64 {B535402E-38D2-4D54-8360-423ACBD17192}.All|Win32.ActiveCfg = Release|x64 {B535402E-38D2-4D54-8360-423ACBD17192}.All|x64.ActiveCfg = Release|x64 {B535402E-38D2-4D54-8360-423ACBD17192}.All|x64.Build.0 = Release|x64 + {B535402E-38D2-4D54-8360-423ACBD17192}.All|x86.ActiveCfg = Release|x64 {B535402E-38D2-4D54-8360-423ACBD17192}.Debug|Win32.ActiveCfg = Debug|Win32 {B535402E-38D2-4D54-8360-423ACBD17192}.Debug|Win32.Build.0 = Debug|Win32 {B535402E-38D2-4D54-8360-423ACBD17192}.Debug|x64.ActiveCfg = Debug|x64 {B535402E-38D2-4D54-8360-423ACBD17192}.Debug|x64.Build.0 = Debug|x64 + {B535402E-38D2-4D54-8360-423ACBD17192}.Debug|x86.ActiveCfg = Debug|x64 {B535402E-38D2-4D54-8360-423ACBD17192}.Release|Win32.ActiveCfg = Release|Win32 {B535402E-38D2-4D54-8360-423ACBD17192}.Release|Win32.Build.0 = Release|Win32 {B535402E-38D2-4D54-8360-423ACBD17192}.Release|x64.ActiveCfg = Release|x64 {B535402E-38D2-4D54-8360-423ACBD17192}.Release|x64.Build.0 = Release|x64 + {B535402E-38D2-4D54-8360-423ACBD17192}.Release|x86.ActiveCfg = Release|x64 {4F92B672-DADB-4047-8D6A-4BB3796733FD}.All|Win32.ActiveCfg = Release|Win32 {4F92B672-DADB-4047-8D6A-4BB3796733FD}.All|Win32.Build.0 = Release|Win32 {4F92B672-DADB-4047-8D6A-4BB3796733FD}.All|x64.ActiveCfg = Release|Win32 {4F92B672-DADB-4047-8D6A-4BB3796733FD}.All|x64.Build.0 = Release|Win32 + {4F92B672-DADB-4047-8D6A-4BB3796733FD}.All|x86.ActiveCfg = Release|Win32 {4F92B672-DADB-4047-8D6A-4BB3796733FD}.Debug|Win32.ActiveCfg = Debug|Win32 {4F92B672-DADB-4047-8D6A-4BB3796733FD}.Debug|Win32.Build.0 = Debug|Win32 {4F92B672-DADB-4047-8D6A-4BB3796733FD}.Debug|x64.ActiveCfg = Debug|Win32 {4F92B672-DADB-4047-8D6A-4BB3796733FD}.Debug|x64.Build.0 = Debug|Win32 + {4F92B672-DADB-4047-8D6A-4BB3796733FD}.Debug|x86.ActiveCfg = Debug|Win32 {4F92B672-DADB-4047-8D6A-4BB3796733FD}.Release|Win32.ActiveCfg = Release|Win32 {4F92B672-DADB-4047-8D6A-4BB3796733FD}.Release|Win32.Build.0 = Release|Win32 {4F92B672-DADB-4047-8D6A-4BB3796733FD}.Release|x64.ActiveCfg = Release|Win32 {4F92B672-DADB-4047-8D6A-4BB3796733FD}.Release|x64.Build.0 = Release|Win32 + {4F92B672-DADB-4047-8D6A-4BB3796733FD}.Release|x86.ActiveCfg = Release|Win32 {2DEE4895-1134-439C-B688-52203E57D878}.All|Win32.ActiveCfg = Release|Win32 {2DEE4895-1134-439C-B688-52203E57D878}.All|Win32.Build.0 = Release|Win32 {2DEE4895-1134-439C-B688-52203E57D878}.All|x64.ActiveCfg = Release|Win32 {2DEE4895-1134-439C-B688-52203E57D878}.All|x64.Build.0 = Release|Win32 + {2DEE4895-1134-439C-B688-52203E57D878}.All|x86.ActiveCfg = Release|Win32 {2DEE4895-1134-439C-B688-52203E57D878}.Debug|Win32.ActiveCfg = Debug|Win32 {2DEE4895-1134-439C-B688-52203E57D878}.Debug|Win32.Build.0 = Debug|Win32 {2DEE4895-1134-439C-B688-52203E57D878}.Debug|x64.ActiveCfg = Debug|Win32 {2DEE4895-1134-439C-B688-52203E57D878}.Debug|x64.Build.0 = Debug|Win32 + {2DEE4895-1134-439C-B688-52203E57D878}.Debug|x86.ActiveCfg = Debug|Win32 {2DEE4895-1134-439C-B688-52203E57D878}.Release|Win32.ActiveCfg = Release|Win32 {2DEE4895-1134-439C-B688-52203E57D878}.Release|Win32.Build.0 = Release|Win32 {2DEE4895-1134-439C-B688-52203E57D878}.Release|x64.ActiveCfg = Release|Win32 {2DEE4895-1134-439C-B688-52203E57D878}.Release|x64.Build.0 = Release|Win32 + {2DEE4895-1134-439C-B688-52203E57D878}.Release|x86.ActiveCfg = Release|Win32 {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.All|Win32.ActiveCfg = Release|Win32 {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.All|Win32.Build.0 = Release|Win32 {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.All|x64.ActiveCfg = Release|Win32 {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.All|x64.Build.0 = Release|Win32 + {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.All|x86.ActiveCfg = Release|Win32 {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Debug|Win32.ActiveCfg = Debug|Win32 {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Debug|Win32.Build.0 = Debug|Win32 {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Debug|x64.ActiveCfg = Debug|Win32 {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Debug|x64.Build.0 = Debug|Win32 + {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Debug|x86.ActiveCfg = Debug|Win32 {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Release|Win32.ActiveCfg = Release|Win32 {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Release|Win32.Build.0 = Release|Win32 {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Release|x64.ActiveCfg = Release|Win32 {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Release|x64.Build.0 = Release|Win32 + {AF8163EE-FA76-4904-A11D-7D70A1B5BA2E}.Release|x86.ActiveCfg = Release|Win32 {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.All|Win32.ActiveCfg = Debug|x64 {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.All|x64.ActiveCfg = Debug|x64 {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.All|x64.Build.0 = Debug|x64 + {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.All|x86.ActiveCfg = Release|x64 {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Debug|Win32.ActiveCfg = Debug|Win32 {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Debug|Win32.Build.0 = Debug|Win32 {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Debug|x64.ActiveCfg = Debug|x64 {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Debug|x64.Build.0 = Debug|x64 + {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Debug|x86.ActiveCfg = Debug|x64 {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Release|Win32.ActiveCfg = Release|Win32 {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Release|Win32.Build.0 = Release|Win32 {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Release|x64.ActiveCfg = Release|x64 {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Release|x64.Build.0 = Release|x64 + {2F025EAD-99BD-40F5-B2CC-F0A28CAD7F2D}.Release|x86.ActiveCfg = Release|x64 {94001A0E-A837-445C-8004-F918F10D0226}.All|Win32.ActiveCfg = Debug|x64 {94001A0E-A837-445C-8004-F918F10D0226}.All|x64.ActiveCfg = Debug|x64 {94001A0E-A837-445C-8004-F918F10D0226}.All|x64.Build.0 = Debug|x64 + {94001A0E-A837-445C-8004-F918F10D0226}.All|x86.ActiveCfg = Release|x64 {94001A0E-A837-445C-8004-F918F10D0226}.Debug|Win32.ActiveCfg = Debug|Win32 {94001A0E-A837-445C-8004-F918F10D0226}.Debug|Win32.Build.0 = Debug|Win32 {94001A0E-A837-445C-8004-F918F10D0226}.Debug|x64.ActiveCfg = Debug|x64 {94001A0E-A837-445C-8004-F918F10D0226}.Debug|x64.Build.0 = Debug|x64 + {94001A0E-A837-445C-8004-F918F10D0226}.Debug|x86.ActiveCfg = Debug|x64 {94001A0E-A837-445C-8004-F918F10D0226}.Release|Win32.ActiveCfg = Release|Win32 {94001A0E-A837-445C-8004-F918F10D0226}.Release|Win32.Build.0 = Release|Win32 {94001A0E-A837-445C-8004-F918F10D0226}.Release|x64.ActiveCfg = Release|x64 {94001A0E-A837-445C-8004-F918F10D0226}.Release|x64.Build.0 = Release|x64 + {94001A0E-A837-445C-8004-F918F10D0226}.Release|x86.ActiveCfg = Release|x64 {2286DA73-9FC5-45BC-A508-85994C3317AB}.All|Win32.ActiveCfg = Release|x64 {2286DA73-9FC5-45BC-A508-85994C3317AB}.All|x64.ActiveCfg = Release|x64 {2286DA73-9FC5-45BC-A508-85994C3317AB}.All|x64.Build.0 = Release|x64 + {2286DA73-9FC5-45BC-A508-85994C3317AB}.All|x86.ActiveCfg = Release|x64 {2286DA73-9FC5-45BC-A508-85994C3317AB}.Debug|Win32.ActiveCfg = Debug|Win32 {2286DA73-9FC5-45BC-A508-85994C3317AB}.Debug|Win32.Build.0 = Debug|Win32 {2286DA73-9FC5-45BC-A508-85994C3317AB}.Debug|x64.ActiveCfg = Debug|x64 {2286DA73-9FC5-45BC-A508-85994C3317AB}.Debug|x64.Build.0 = Debug|x64 + {2286DA73-9FC5-45BC-A508-85994C3317AB}.Debug|x86.ActiveCfg = Debug|x64 {2286DA73-9FC5-45BC-A508-85994C3317AB}.Release|Win32.ActiveCfg = Release|Win32 {2286DA73-9FC5-45BC-A508-85994C3317AB}.Release|Win32.Build.0 = Release|Win32 {2286DA73-9FC5-45BC-A508-85994C3317AB}.Release|x64.ActiveCfg = Release|x64 {2286DA73-9FC5-45BC-A508-85994C3317AB}.Release|x64.Build.0 = Release|x64 + {2286DA73-9FC5-45BC-A508-85994C3317AB}.Release|x86.ActiveCfg = Release|x64 {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.All|Win32.ActiveCfg = Release|Win32 {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.All|Win32.Build.0 = Release|Win32 {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.All|x64.ActiveCfg = Release|Win32 {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.All|x64.Build.0 = Release|Win32 + {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.All|x86.ActiveCfg = Release|Win32 {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Debug|Win32.ActiveCfg = Debug|Win32 {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Debug|Win32.Build.0 = Debug|Win32 {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Debug|x64.ActiveCfg = Debug|Win32 {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Debug|x64.Build.0 = Debug|Win32 + {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Debug|x86.ActiveCfg = Debug|Win32 {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Release|Win32.ActiveCfg = Release|Win32 {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Release|Win32.Build.0 = Release|Win32 {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Release|x64.ActiveCfg = Release|Win32 {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Release|x64.Build.0 = Release|Win32 + {3CE1DC99-8246-4DB1-A709-74F19F08EC67}.Release|x86.ActiveCfg = Release|Win32 {87A1FE3D-F410-4C8E-9591-8C625985BC70}.All|Win32.ActiveCfg = Release|Win32 {87A1FE3D-F410-4C8E-9591-8C625985BC70}.All|x64.ActiveCfg = Release|Win32 + {87A1FE3D-F410-4C8E-9591-8C625985BC70}.All|x86.ActiveCfg = Release|Win32 {87A1FE3D-F410-4C8E-9591-8C625985BC70}.Debug|Win32.ActiveCfg = Debug|Win32 {87A1FE3D-F410-4C8E-9591-8C625985BC70}.Debug|x64.ActiveCfg = Debug|Win32 + {87A1FE3D-F410-4C8E-9591-8C625985BC70}.Debug|x86.ActiveCfg = Debug|Win32 {87A1FE3D-F410-4C8E-9591-8C625985BC70}.Release|Win32.ActiveCfg = Release|Win32 {87A1FE3D-F410-4C8E-9591-8C625985BC70}.Release|x64.ActiveCfg = Release|Win32 + {87A1FE3D-F410-4C8E-9591-8C625985BC70}.Release|x86.ActiveCfg = Release|Win32 {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.All|Win32.ActiveCfg = Release|Win32 {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.All|Win32.Build.0 = Release|Win32 {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.All|x64.ActiveCfg = Release|Win32 {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.All|x64.Build.0 = Release|Win32 + {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.All|x86.ActiveCfg = Release|x64 {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Debug|Win32.ActiveCfg = Debug|Win32 {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Debug|Win32.Build.0 = Debug|Win32 {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Debug|x64.ActiveCfg = Debug|x64 {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Debug|x64.Build.0 = Debug|x64 + {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Debug|x86.ActiveCfg = Debug|x64 {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Release|Win32.ActiveCfg = Release|Win32 {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Release|Win32.Build.0 = Release|Win32 {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Release|x64.ActiveCfg = Release|x64 {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Release|x64.Build.0 = Release|x64 + {7A8D8174-B355-4114-AFC1-04777CB9DE0A}.Release|x86.ActiveCfg = Release|x64 {7EB71250-F002-4ED8-92CA-CA218114537A}.All|Win32.ActiveCfg = Release|Win32 {7EB71250-F002-4ED8-92CA-CA218114537A}.All|x64.ActiveCfg = Release|Win32 + {7EB71250-F002-4ED8-92CA-CA218114537A}.All|x86.ActiveCfg = Release|x64 {7EB71250-F002-4ED8-92CA-CA218114537A}.Debug|Win32.ActiveCfg = Debug|Win32 {7EB71250-F002-4ED8-92CA-CA218114537A}.Debug|x64.ActiveCfg = Debug|x64 + {7EB71250-F002-4ED8-92CA-CA218114537A}.Debug|x86.ActiveCfg = Debug|x64 {7EB71250-F002-4ED8-92CA-CA218114537A}.Release|Win32.ActiveCfg = Release|Win32 {7EB71250-F002-4ED8-92CA-CA218114537A}.Release|x64.ActiveCfg = Release|x64 + {7EB71250-F002-4ED8-92CA-CA218114537A}.Release|x86.ActiveCfg = Release|x64 {6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.All|Win32.ActiveCfg = Release|Win32 {6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.All|x64.ActiveCfg = Release|Win32 + {6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.All|x86.ActiveCfg = Release|Win32 {6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.Debug|Win32.ActiveCfg = Debug|Win32 {6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.Debug|x64.ActiveCfg = Debug|Win32 + {6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.Debug|x86.ActiveCfg = Debug|Win32 {6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.Release|Win32.ActiveCfg = Release|Win32 {6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.Release|x64.ActiveCfg = Release|Win32 + {6E49F6C2-ADDA-4BFB-81FE-AB9AF51B455F}.Release|x86.ActiveCfg = Release|Win32 {464AAB78-5489-4916-BE51-BF8D61822311}.All|Win32.ActiveCfg = Release|Win32 {464AAB78-5489-4916-BE51-BF8D61822311}.All|x64.ActiveCfg = Release|Win32 + {464AAB78-5489-4916-BE51-BF8D61822311}.All|x86.ActiveCfg = Release|x64 {464AAB78-5489-4916-BE51-BF8D61822311}.Debug|Win32.ActiveCfg = Debug|Win32 {464AAB78-5489-4916-BE51-BF8D61822311}.Debug|x64.ActiveCfg = Debug|x64 + {464AAB78-5489-4916-BE51-BF8D61822311}.Debug|x86.ActiveCfg = Debug|x64 {464AAB78-5489-4916-BE51-BF8D61822311}.Release|Win32.ActiveCfg = Release|Win32 {464AAB78-5489-4916-BE51-BF8D61822311}.Release|x64.ActiveCfg = Release|x64 + {464AAB78-5489-4916-BE51-BF8D61822311}.Release|x86.ActiveCfg = Release|x64 {0AD1177E-1FD8-4643-9391-431467A11084}.All|Win32.ActiveCfg = Release|x64 {0AD1177E-1FD8-4643-9391-431467A11084}.All|x64.ActiveCfg = Release|x64 {0AD1177E-1FD8-4643-9391-431467A11084}.All|x64.Build.0 = Release|x64 + {0AD1177E-1FD8-4643-9391-431467A11084}.All|x86.ActiveCfg = Release|x64 {0AD1177E-1FD8-4643-9391-431467A11084}.Debug|Win32.ActiveCfg = Debug|Win32 {0AD1177E-1FD8-4643-9391-431467A11084}.Debug|Win32.Build.0 = Debug|Win32 {0AD1177E-1FD8-4643-9391-431467A11084}.Debug|x64.ActiveCfg = Debug|x64 {0AD1177E-1FD8-4643-9391-431467A11084}.Debug|x64.Build.0 = Debug|x64 + {0AD1177E-1FD8-4643-9391-431467A11084}.Debug|x86.ActiveCfg = Debug|x64 {0AD1177E-1FD8-4643-9391-431467A11084}.Release|Win32.ActiveCfg = Release|Win32 {0AD1177E-1FD8-4643-9391-431467A11084}.Release|Win32.Build.0 = Release|Win32 {0AD1177E-1FD8-4643-9391-431467A11084}.Release|x64.ActiveCfg = Release|x64 {0AD1177E-1FD8-4643-9391-431467A11084}.Release|x64.Build.0 = Release|x64 + {0AD1177E-1FD8-4643-9391-431467A11084}.Release|x86.ActiveCfg = Release|x64 {66444AEE-554C-11DD-A9F0-8C5D56D89593}.All|Win32.ActiveCfg = Release Static|x64 {66444AEE-554C-11DD-A9F0-8C5D56D89593}.All|x64.ActiveCfg = Release Static|x64 {66444AEE-554C-11DD-A9F0-8C5D56D89593}.All|x64.Build.0 = Release Static|x64 + {66444AEE-554C-11DD-A9F0-8C5D56D89593}.All|x86.ActiveCfg = Release|x64 {66444AEE-554C-11DD-A9F0-8C5D56D89593}.Debug|Win32.ActiveCfg = Debug|Win32 {66444AEE-554C-11DD-A9F0-8C5D56D89593}.Debug|x64.ActiveCfg = Debug|x64 + {66444AEE-554C-11DD-A9F0-8C5D56D89593}.Debug|x86.ActiveCfg = Debug|x64 {66444AEE-554C-11DD-A9F0-8C5D56D89593}.Release|Win32.ActiveCfg = Release|Win32 {66444AEE-554C-11DD-A9F0-8C5D56D89593}.Release|x64.ActiveCfg = Release|x64 + {66444AEE-554C-11DD-A9F0-8C5D56D89593}.Release|x86.ActiveCfg = Release|x64 {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.All|Win32.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.All|Win32.Build.0 = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.All|x64.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.All|x64.Build.0 = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.All|x86.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Debug|Win32.ActiveCfg = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Debug|Win32.Build.0 = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Debug|x64.ActiveCfg = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Debug|x64.Build.0 = Debug|Win32 + {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Debug|x86.ActiveCfg = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Release|Win32.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Release|Win32.Build.0 = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Release|x64.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Release|x64.Build.0 = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82FDD086DB1B}.Release|x86.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.All|Win32.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.All|Win32.Build.0 = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.All|x64.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.All|x64.Build.0 = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.All|x86.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|Win32.ActiveCfg = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|Win32.Build.0 = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|x64.ActiveCfg = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|x64.Build.0 = Debug|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Debug|x86.ActiveCfg = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Release|Win32.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Release|Win32.Build.0 = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Release|x64.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Release|x64.Build.0 = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB2086DB1B}.Release|x86.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.All|Win32.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.All|Win32.Build.0 = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.All|x64.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.All|x64.Build.0 = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.All|x86.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Debug|Win32.ActiveCfg = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Debug|Win32.Build.0 = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Debug|x64.ActiveCfg = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Debug|x64.Build.0 = Debug|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Debug|x86.ActiveCfg = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Release|Win32.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Release|Win32.Build.0 = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Release|x64.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Release|x64.Build.0 = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB3086DB1B}.Release|x86.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.All|Win32.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.All|Win32.Build.0 = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.All|x64.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.All|x64.Build.0 = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.All|x86.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Debug|Win32.ActiveCfg = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Debug|Win32.Build.0 = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Debug|x64.ActiveCfg = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Debug|x64.Build.0 = Debug|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Debug|x86.ActiveCfg = Debug|Win32 {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Release|Win32.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Release|Win32.Build.0 = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Release|x64.ActiveCfg = Release|Win32 {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Release|x64.Build.0 = Release|Win32 + {D5D2BF72-29FE-4982-A9FA-82AB1086DB1B}.Release|x86.ActiveCfg = Release|Win32 {E316772F-5D8F-4F2A-8F71-094C3E859D34}.All|Win32.ActiveCfg = Debug|x64 {E316772F-5D8F-4F2A-8F71-094C3E859D34}.All|x64.ActiveCfg = Debug|x64 {E316772F-5D8F-4F2A-8F71-094C3E859D34}.All|x64.Build.0 = Debug|x64 + {E316772F-5D8F-4F2A-8F71-094C3E859D34}.All|x86.ActiveCfg = Release|x64 {E316772F-5D8F-4F2A-8F71-094C3E859D34}.Debug|Win32.ActiveCfg = Debug|Win32 {E316772F-5D8F-4F2A-8F71-094C3E859D34}.Debug|Win32.Build.0 = Debug|Win32 {E316772F-5D8F-4F2A-8F71-094C3E859D34}.Debug|x64.ActiveCfg = Debug|x64 {E316772F-5D8F-4F2A-8F71-094C3E859D34}.Debug|x64.Build.0 = Debug|x64 + {E316772F-5D8F-4F2A-8F71-094C3E859D34}.Debug|x86.ActiveCfg = Debug|x64 {E316772F-5D8F-4F2A-8F71-094C3E859D34}.Release|Win32.ActiveCfg = Release|Win32 {E316772F-5D8F-4F2A-8F71-094C3E859D34}.Release|Win32.Build.0 = Release|Win32 {E316772F-5D8F-4F2A-8F71-094C3E859D34}.Release|x64.ActiveCfg = Release|x64 {E316772F-5D8F-4F2A-8F71-094C3E859D34}.Release|x64.Build.0 = Release|x64 + {E316772F-5D8F-4F2A-8F71-094C3E859D34}.Release|x86.ActiveCfg = Release|x64 {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.All|Win32.ActiveCfg = Debug|x64 {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.All|x64.ActiveCfg = Debug|x64 {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.All|x64.Build.0 = Debug|x64 + {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.All|x86.ActiveCfg = Release|x64 {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Debug|Win32.ActiveCfg = Debug|Win32 {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Debug|Win32.Build.0 = Debug|Win32 {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Debug|x64.ActiveCfg = Debug|x64 {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Debug|x64.Build.0 = Debug|x64 + {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Debug|x86.ActiveCfg = Debug|x64 {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Release|Win32.ActiveCfg = Release|Win32 {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Release|Win32.Build.0 = Release|Win32 {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Release|x64.ActiveCfg = Release|x64 {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Release|x64.Build.0 = Release|x64 + {D3D8B329-20BE-475E-9E83-653CEA0E0EF5}.Release|x86.ActiveCfg = Release|x64 {38FE0559-9910-43A8-9E45-3E5004C27692}.All|Win32.ActiveCfg = Release|x64 {38FE0559-9910-43A8-9E45-3E5004C27692}.All|x64.ActiveCfg = Release|x64 {38FE0559-9910-43A8-9E45-3E5004C27692}.All|x64.Build.0 = Release|x64 + {38FE0559-9910-43A8-9E45-3E5004C27692}.All|x86.ActiveCfg = Release|x64 {38FE0559-9910-43A8-9E45-3E5004C27692}.Debug|Win32.ActiveCfg = Debug|Win32 {38FE0559-9910-43A8-9E45-3E5004C27692}.Debug|Win32.Build.0 = Debug|Win32 {38FE0559-9910-43A8-9E45-3E5004C27692}.Debug|x64.ActiveCfg = Debug|x64 {38FE0559-9910-43A8-9E45-3E5004C27692}.Debug|x64.Build.0 = Debug|x64 + {38FE0559-9910-43A8-9E45-3E5004C27692}.Debug|x86.ActiveCfg = Debug|x64 {38FE0559-9910-43A8-9E45-3E5004C27692}.Release|Win32.ActiveCfg = Release|Win32 {38FE0559-9910-43A8-9E45-3E5004C27692}.Release|Win32.Build.0 = Release|Win32 {38FE0559-9910-43A8-9E45-3E5004C27692}.Release|x64.ActiveCfg = Release|x64 {38FE0559-9910-43A8-9E45-3E5004C27692}.Release|x64.Build.0 = Release|x64 + {38FE0559-9910-43A8-9E45-3E5004C27692}.Release|x86.ActiveCfg = Release|x64 {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.All|Win32.ActiveCfg = Debug|x64 {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.All|x64.ActiveCfg = Debug|x64 {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.All|x64.Build.0 = Debug|x64 + {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.All|x86.ActiveCfg = Release|x64 {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Debug|Win32.ActiveCfg = Debug|Win32 {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Debug|Win32.Build.0 = Debug|Win32 {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Debug|x64.ActiveCfg = Debug|x64 {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Debug|x64.Build.0 = Debug|x64 + {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Debug|x86.ActiveCfg = Debug|x64 {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|Win32.ActiveCfg = Release|Win32 {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|Win32.Build.0 = Release|Win32 {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|x64.ActiveCfg = Release|x64 {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|x64.Build.0 = Release|x64 + {0FEEAEC6-4399-4C46-B7DB-62ECE80D15B4}.Release|x86.ActiveCfg = Release|x64 {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.All|Win32.ActiveCfg = Release|x64 {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.All|x64.ActiveCfg = Release|x64 {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.All|x64.Build.0 = Release|x64 + {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.All|x86.ActiveCfg = Release|x64 {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|Win32.ActiveCfg = Debug|Win32 {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|Win32.Build.0 = Debug|Win32 {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|x64.ActiveCfg = Debug|x64 {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|x64.Build.0 = Debug|x64 + {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Debug|x86.ActiveCfg = Debug|x64 {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|Win32.ActiveCfg = Release|Win32 {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|Win32.Build.0 = Release|Win32 {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|x64.ActiveCfg = Release|x64 {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|x64.Build.0 = Release|x64 + {2A3D00C6-588D-4E86-81AC-9EF5EDE86E03}.Release|x86.ActiveCfg = Release|x64 {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.All|Win32.ActiveCfg = Release|x64 {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.All|x64.ActiveCfg = Release|x64 {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.All|x64.Build.0 = Release|x64 + {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.All|x86.ActiveCfg = Release|x64 {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Debug|Win32.ActiveCfg = Debug|Win32 {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Debug|Win32.Build.0 = Debug|Win32 {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Debug|x64.ActiveCfg = Debug|x64 {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Debug|x64.Build.0 = Debug|x64 + {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Debug|x86.ActiveCfg = Debug|x64 {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|Win32.ActiveCfg = Release|Win32 {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|Win32.Build.0 = Release|Win32 {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|x64.ActiveCfg = Release|x64 {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|x64.Build.0 = Release|x64 + {B6A9FB7A-1CC4-442B-812D-EC33E4E4A36E}.Release|x86.ActiveCfg = Release|x64 {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.All|Win32.ActiveCfg = Release_Mono|x64 {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.All|x64.ActiveCfg = Release_Mono|x64 {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.All|x64.Build.0 = Release_Mono|x64 + {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.All|x86.ActiveCfg = Release_Mono|x64 {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Debug|Win32.ActiveCfg = Debug_CLR|Win32 {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Debug|Win32.Build.0 = Debug_CLR|Win32 {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Debug|x64.ActiveCfg = Debug_CLR|x64 {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Debug|x64.Build.0 = Debug_CLR|x64 + {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Debug|x86.ActiveCfg = Debug_Mono|x64 {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Release|Win32.ActiveCfg = Release_CLR|Win32 {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Release|Win32.Build.0 = Release_CLR|Win32 {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Release|x64.ActiveCfg = Release_CLR|x64 {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Release|x64.Build.0 = Release_CLR|x64 + {7B42BDA1-72C0-4378-A9B6-5C530F8CD61E}.Release|x86.ActiveCfg = Release_Mono|x64 {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.All|Win32.ActiveCfg = Release|Any CPU {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.All|x64.ActiveCfg = Release|Any CPU + {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.All|x86.ActiveCfg = Release|x64 {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|Win32.ActiveCfg = Debug|Any CPU {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|Win32.Build.0 = Debug|Any CPU {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x64.ActiveCfg = Debug|x64 {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x64.Build.0 = Debug|x64 + {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x86.ActiveCfg = Debug|x64 {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|Win32.ActiveCfg = Release|Any CPU {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|Win32.Build.0 = Release|Any CPU {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x64.ActiveCfg = Release|x64 {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x64.Build.0 = Release|x64 + {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x86.ActiveCfg = Release|x64 {E796E337-DE78-4303-8614-9A590862EE95}.All|Win32.ActiveCfg = Release|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.All|Win32.Build.0 = Release|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.All|x64.ActiveCfg = Release|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.All|x64.Build.0 = Release|Win32 + {E796E337-DE78-4303-8614-9A590862EE95}.All|x86.ActiveCfg = Release|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.Debug|Win32.ActiveCfg = Debug|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.Debug|Win32.Build.0 = Debug|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.Debug|x64.ActiveCfg = Debug|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.Debug|x64.Build.0 = Debug|Win32 + {E796E337-DE78-4303-8614-9A590862EE95}.Debug|x86.ActiveCfg = Debug|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.Release|Win32.ActiveCfg = Release|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.Release|Win32.Build.0 = Release|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.Release|x64.ActiveCfg = Release|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.Release|x64.Build.0 = Release|Win32 + {E796E337-DE78-4303-8614-9A590862EE95}.Release|x86.ActiveCfg = Release|Win32 {419C8F80-D858-4B48-A25C-AF4007608137}.All|Win32.ActiveCfg = Release|x64 {419C8F80-D858-4B48-A25C-AF4007608137}.All|x64.ActiveCfg = Release|x64 {419C8F80-D858-4B48-A25C-AF4007608137}.All|x64.Build.0 = Release|x64 + {419C8F80-D858-4B48-A25C-AF4007608137}.All|x86.ActiveCfg = Release|x64 {419C8F80-D858-4B48-A25C-AF4007608137}.Debug|Win32.ActiveCfg = Debug|Win32 {419C8F80-D858-4B48-A25C-AF4007608137}.Debug|Win32.Build.0 = Debug|Win32 {419C8F80-D858-4B48-A25C-AF4007608137}.Debug|x64.ActiveCfg = Debug|x64 {419C8F80-D858-4B48-A25C-AF4007608137}.Debug|x64.Build.0 = Debug|x64 + {419C8F80-D858-4B48-A25C-AF4007608137}.Debug|x86.ActiveCfg = Debug|x64 {419C8F80-D858-4B48-A25C-AF4007608137}.Release|Win32.ActiveCfg = Release|Win32 {419C8F80-D858-4B48-A25C-AF4007608137}.Release|Win32.Build.0 = Release|Win32 {419C8F80-D858-4B48-A25C-AF4007608137}.Release|x64.ActiveCfg = Release|x64 {419C8F80-D858-4B48-A25C-AF4007608137}.Release|x64.Build.0 = Release|x64 + {419C8F80-D858-4B48-A25C-AF4007608137}.Release|x86.ActiveCfg = Release|x64 {B3F424EC-3D8F-417C-B244-3919D5E1A577}.All|Win32.ActiveCfg = Release|x64 {B3F424EC-3D8F-417C-B244-3919D5E1A577}.All|x64.ActiveCfg = Release|x64 {B3F424EC-3D8F-417C-B244-3919D5E1A577}.All|x64.Build.0 = Release|x64 + {B3F424EC-3D8F-417C-B244-3919D5E1A577}.All|x86.ActiveCfg = Release|x64 {B3F424EC-3D8F-417C-B244-3919D5E1A577}.Debug|Win32.ActiveCfg = Debug|Win32 {B3F424EC-3D8F-417C-B244-3919D5E1A577}.Debug|Win32.Build.0 = Debug|Win32 {B3F424EC-3D8F-417C-B244-3919D5E1A577}.Debug|x64.ActiveCfg = Debug|x64 {B3F424EC-3D8F-417C-B244-3919D5E1A577}.Debug|x64.Build.0 = Debug|x64 + {B3F424EC-3D8F-417C-B244-3919D5E1A577}.Debug|x86.ActiveCfg = Debug|x64 {B3F424EC-3D8F-417C-B244-3919D5E1A577}.Release|Win32.ActiveCfg = Release|Win32 {B3F424EC-3D8F-417C-B244-3919D5E1A577}.Release|Win32.Build.0 = Release|Win32 {B3F424EC-3D8F-417C-B244-3919D5E1A577}.Release|x64.ActiveCfg = Release|x64 {B3F424EC-3D8F-417C-B244-3919D5E1A577}.Release|x64.Build.0 = Release|x64 + {B3F424EC-3D8F-417C-B244-3919D5E1A577}.Release|x86.ActiveCfg = Release|x64 {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.All|Win32.ActiveCfg = Release|x64 {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.All|x64.ActiveCfg = Release|x64 {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.All|x64.Build.0 = Release|x64 + {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.All|x86.ActiveCfg = Release|x64 {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Debug|Win32.ActiveCfg = Debug|Win32 {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Debug|Win32.Build.0 = Debug|Win32 {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Debug|x64.ActiveCfg = Debug|x64 {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Debug|x64.Build.0 = Debug|x64 + {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Debug|x86.ActiveCfg = Debug|x64 {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Release|Win32.ActiveCfg = Release|Win32 {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Release|Win32.Build.0 = Release|Win32 {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Release|x64.ActiveCfg = Release|x64 {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Release|x64.Build.0 = Release|x64 + {14E4A972-9CFB-436D-B0A5-4943F3F80D47}.Release|x86.ActiveCfg = Release|x64 {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.All|Win32.ActiveCfg = Release|x64 {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.All|x64.ActiveCfg = Release|x64 {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.All|x64.Build.0 = Release|x64 + {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.All|x86.ActiveCfg = Release|x64 {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Debug|Win32.ActiveCfg = Debug|Win32 {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Debug|Win32.Build.0 = Debug|Win32 {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Debug|x64.ActiveCfg = Debug|x64 {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Debug|x64.Build.0 = Debug|x64 + {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Debug|x86.ActiveCfg = Debug|x64 {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Release|Win32.ActiveCfg = Release|Win32 {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Release|Win32.Build.0 = Release|Win32 {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Release|x64.ActiveCfg = Release|x64 {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Release|x64.Build.0 = Release|x64 + {1BC8A8EC-E03B-44DF-BCD9-088650F4D29C}.Release|x86.ActiveCfg = Release|x64 {0B6C905B-142E-4999-B39D-92FF7951E921}.All|Win32.ActiveCfg = Release|x64 {0B6C905B-142E-4999-B39D-92FF7951E921}.All|x64.ActiveCfg = Release|x64 {0B6C905B-142E-4999-B39D-92FF7951E921}.All|x64.Build.0 = Release|x64 + {0B6C905B-142E-4999-B39D-92FF7951E921}.All|x86.ActiveCfg = Release|x64 {0B6C905B-142E-4999-B39D-92FF7951E921}.Debug|Win32.ActiveCfg = Debug|Win32 {0B6C905B-142E-4999-B39D-92FF7951E921}.Debug|Win32.Build.0 = Debug|Win32 {0B6C905B-142E-4999-B39D-92FF7951E921}.Debug|x64.ActiveCfg = Debug|x64 {0B6C905B-142E-4999-B39D-92FF7951E921}.Debug|x64.Build.0 = Debug|x64 + {0B6C905B-142E-4999-B39D-92FF7951E921}.Debug|x86.ActiveCfg = Debug|x64 {0B6C905B-142E-4999-B39D-92FF7951E921}.Release|Win32.ActiveCfg = Release|Win32 {0B6C905B-142E-4999-B39D-92FF7951E921}.Release|Win32.Build.0 = Release|Win32 {0B6C905B-142E-4999-B39D-92FF7951E921}.Release|x64.ActiveCfg = Release|x64 {0B6C905B-142E-4999-B39D-92FF7951E921}.Release|x64.Build.0 = Release|x64 + {0B6C905B-142E-4999-B39D-92FF7951E921}.Release|x86.ActiveCfg = Release|x64 {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.All|Win32.ActiveCfg = Release|x64 {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.All|x64.ActiveCfg = Release|x64 {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.All|x64.Build.0 = Release|x64 + {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.All|x86.ActiveCfg = Release|x64 {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Debug|Win32.ActiveCfg = Debug|Win32 {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Debug|Win32.Build.0 = Debug|Win32 {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Debug|x64.ActiveCfg = Debug|x64 {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Debug|x64.Build.0 = Debug|x64 + {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Debug|x86.ActiveCfg = Debug|x64 {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Release|Win32.ActiveCfg = Release|Win32 {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Release|Win32.Build.0 = Release|Win32 {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Release|x64.ActiveCfg = Release|x64 {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Release|x64.Build.0 = Release|x64 + {CF405366-9558-4AE8-90EF-5E21B51CCB4E}.Release|x86.ActiveCfg = Release|x64 {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.All|Win32.ActiveCfg = Release|x64 {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.All|x64.ActiveCfg = Release|x64 {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.All|x64.Build.0 = Release|x64 + {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.All|x86.ActiveCfg = Release|x64 {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Debug|Win32.ActiveCfg = Debug|Win32 {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Debug|Win32.Build.0 = Debug|Win32 {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Debug|x64.ActiveCfg = Debug|x64 {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Debug|x64.Build.0 = Debug|x64 + {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Debug|x86.ActiveCfg = Debug|x64 {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Release|Win32.ActiveCfg = Release|Win32 {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Release|Win32.Build.0 = Release|Win32 {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Release|x64.ActiveCfg = Release|x64 {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Release|x64.Build.0 = Release|x64 + {D2FB8043-D208-4AEE-8F18-3B5857C871B9}.Release|x86.ActiveCfg = Release|x64 {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.All|Win32.ActiveCfg = Release|x64 {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.All|x64.ActiveCfg = Release|x64 {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.All|x64.Build.0 = Release|x64 + {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.All|x86.ActiveCfg = Release|x64 {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Debug|Win32.ActiveCfg = Debug|Win32 {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Debug|Win32.Build.0 = Debug|Win32 {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Debug|x64.ActiveCfg = Debug|x64 {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Debug|x64.Build.0 = Debug|x64 + {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Debug|x86.ActiveCfg = Debug|x64 {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Release|Win32.ActiveCfg = Release|Win32 {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Release|Win32.Build.0 = Release|Win32 {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Release|x64.ActiveCfg = Release|x64 {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Release|x64.Build.0 = Release|x64 + {329FD5B0-EF28-4606-86D0-F6EA21CF8E36}.Release|x86.ActiveCfg = Release|x64 {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.All|Win32.ActiveCfg = Release|x64 {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.All|x64.ActiveCfg = Release|x64 {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.All|x64.Build.0 = Release|x64 + {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.All|x86.ActiveCfg = Release|x64 {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Debug|Win32.ActiveCfg = Debug|Win32 {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Debug|Win32.Build.0 = Debug|Win32 {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Debug|x64.ActiveCfg = Debug|x64 {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Debug|x64.Build.0 = Debug|x64 + {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Debug|x86.ActiveCfg = Debug|x64 {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Release|Win32.ActiveCfg = Release|Win32 {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Release|Win32.Build.0 = Release|Win32 {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Release|x64.ActiveCfg = Release|x64 {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Release|x64.Build.0 = Release|x64 + {1A3793D1-05D1-4B57-9B0F-5AF3E79DC439}.Release|x86.ActiveCfg = Release|x64 {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|Win32.ActiveCfg = Release|x64 {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|x64.ActiveCfg = Release|x64 {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|x64.Build.0 = Release|x64 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.All|x86.ActiveCfg = Release|x64 {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|Win32.ActiveCfg = Debug|Win32 {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|Win32.Build.0 = Debug|Win32 {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|x64.ActiveCfg = Debug|x64 {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|x64.Build.0 = Debug|x64 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Debug|x86.ActiveCfg = Debug|x64 {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|Win32.ActiveCfg = Release|Win32 {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|Win32.Build.0 = Release|Win32 {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|x64.ActiveCfg = Release|x64 {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|x64.Build.0 = Release|x64 + {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|x86.ActiveCfg = Release|x64 {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|Win32.ActiveCfg = Release|x64 {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|x64.ActiveCfg = Release|x64 {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|x64.Build.0 = Release|x64 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.All|x86.ActiveCfg = Release|x64 {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|Win32.ActiveCfg = Debug|Win32 {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|Win32.Build.0 = Debug|Win32 {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|x64.ActiveCfg = Debug|x64 {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|x64.Build.0 = Debug|x64 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Debug|x86.ActiveCfg = Debug|x64 {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|Win32.ActiveCfg = Release|Win32 {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|Win32.Build.0 = Release|Win32 {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|x64.ActiveCfg = Release|x64 {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|x64.Build.0 = Release|x64 + {1CBB0077-18C5-455F-801C-0A0CE7B0BBF5}.Release|x86.ActiveCfg = Release|x64 {E972C52F-9E85-4D65-B19C-031E511E9DB4}.All|Win32.ActiveCfg = Release_WM5_PPC_ARM|x64 {E972C52F-9E85-4D65-B19C-031E511E9DB4}.All|x64.ActiveCfg = Release_WM5_PPC_ARM|x64 {E972C52F-9E85-4D65-B19C-031E511E9DB4}.All|x64.Build.0 = Release_WM5_PPC_ARM|x64 + {E972C52F-9E85-4D65-B19C-031E511E9DB4}.All|x86.ActiveCfg = Release_WM5_PPC_ARM|x64 {E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|Win32.ActiveCfg = Debug|Win32 {E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|Win32.Build.0 = Debug|Win32 {E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|x64.ActiveCfg = Debug|x64 {E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|x64.Build.0 = Debug|x64 + {E972C52F-9E85-4D65-B19C-031E511E9DB4}.Debug|x86.ActiveCfg = Debug|x64 {E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|Win32.ActiveCfg = Release|Win32 {E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|Win32.Build.0 = Release|Win32 {E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|x64.ActiveCfg = Release|x64 {E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|x64.Build.0 = Release|x64 + {E972C52F-9E85-4D65-B19C-031E511E9DB4}.Release|x86.ActiveCfg = Release|x64 {03207781-0D1C-4DB3-A71D-45C608F28DBD}.All|Win32.ActiveCfg = Release_Static_SSE|x64 {03207781-0D1C-4DB3-A71D-45C608F28DBD}.All|x64.ActiveCfg = Release_Static_SSE|x64 {03207781-0D1C-4DB3-A71D-45C608F28DBD}.All|x64.Build.0 = Release_Static_SSE|x64 + {03207781-0D1C-4DB3-A71D-45C608F28DBD}.All|x86.ActiveCfg = Release|x64 {03207781-0D1C-4DB3-A71D-45C608F28DBD}.Debug|Win32.ActiveCfg = Debug|Win32 {03207781-0D1C-4DB3-A71D-45C608F28DBD}.Debug|Win32.Build.0 = Debug|Win32 {03207781-0D1C-4DB3-A71D-45C608F28DBD}.Debug|x64.ActiveCfg = Debug|x64 {03207781-0D1C-4DB3-A71D-45C608F28DBD}.Debug|x64.Build.0 = Debug|x64 + {03207781-0D1C-4DB3-A71D-45C608F28DBD}.Debug|x86.ActiveCfg = Debug|x64 {03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release|Win32.ActiveCfg = Release|Win32 {03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release|Win32.Build.0 = Release|Win32 {03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release|x64.ActiveCfg = Release|x64 {03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release|x64.Build.0 = Release|x64 + {03207781-0D1C-4DB3-A71D-45C608F28DBD}.Release|x86.ActiveCfg = Release|x64 {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.All|Win32.ActiveCfg = Release|x64 {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.All|x64.ActiveCfg = Release|x64 {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.All|x64.Build.0 = Release|x64 + {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.All|x86.ActiveCfg = Release|x64 {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Debug|Win32.ActiveCfg = Debug|Win32 {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Debug|Win32.Build.0 = Debug|Win32 {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Debug|x64.ActiveCfg = Debug|x64 {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Debug|x64.Build.0 = Debug|x64 + {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Debug|x86.ActiveCfg = Debug|x64 {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Release|Win32.ActiveCfg = Release|Win32 {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Release|Win32.Build.0 = Release|Win32 {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Release|x64.ActiveCfg = Release|x64 {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Release|x64.Build.0 = Release|x64 + {9A5DDF08-C88C-4A35-B7F6-D605228446BD}.Release|x86.ActiveCfg = Release|x64 {D0B36172-CD76-454A-9B89-990025266C2A}.All|Win32.ActiveCfg = Release|x64 {D0B36172-CD76-454A-9B89-990025266C2A}.All|x64.ActiveCfg = Release|x64 {D0B36172-CD76-454A-9B89-990025266C2A}.All|x64.Build.0 = Release|x64 + {D0B36172-CD76-454A-9B89-990025266C2A}.All|x86.ActiveCfg = Release|x64 {D0B36172-CD76-454A-9B89-990025266C2A}.Debug|Win32.ActiveCfg = Debug|Win32 {D0B36172-CD76-454A-9B89-990025266C2A}.Debug|Win32.Build.0 = Debug|Win32 {D0B36172-CD76-454A-9B89-990025266C2A}.Debug|x64.ActiveCfg = Debug|x64 {D0B36172-CD76-454A-9B89-990025266C2A}.Debug|x64.Build.0 = Debug|x64 + {D0B36172-CD76-454A-9B89-990025266C2A}.Debug|x86.ActiveCfg = Debug|x64 {D0B36172-CD76-454A-9B89-990025266C2A}.Release|Win32.ActiveCfg = Release|Win32 {D0B36172-CD76-454A-9B89-990025266C2A}.Release|Win32.Build.0 = Release|Win32 {D0B36172-CD76-454A-9B89-990025266C2A}.Release|x64.ActiveCfg = Release|x64 {D0B36172-CD76-454A-9B89-990025266C2A}.Release|x64.Build.0 = Release|x64 + {D0B36172-CD76-454A-9B89-990025266C2A}.Release|x86.ActiveCfg = Release|x64 {05C9FB27-480E-4D53-B3B7-6338E2526666}.All|Win32.ActiveCfg = Release|Win32 {05C9FB27-480E-4D53-B3B7-6338E2526666}.All|Win32.Build.0 = Release|Win32 {05C9FB27-480E-4D53-B3B7-6338E2526666}.All|x64.ActiveCfg = Release|Win32 + {05C9FB27-480E-4D53-B3B7-6338E2526666}.All|x86.ActiveCfg = Release|Win32 {05C9FB27-480E-4D53-B3B7-6338E2526666}.Debug|Win32.ActiveCfg = Debug|Win32 {05C9FB27-480E-4D53-B3B7-6338E2526666}.Debug|x64.ActiveCfg = Debug|Win32 + {05C9FB27-480E-4D53-B3B7-6338E2526666}.Debug|x86.ActiveCfg = Debug|Win32 {05C9FB27-480E-4D53-B3B7-6338E2526666}.Release|Win32.ActiveCfg = Release|Win32 {05C9FB27-480E-4D53-B3B7-6338E2526666}.Release|x64.ActiveCfg = Release|Win32 + {05C9FB27-480E-4D53-B3B7-6338E2526666}.Release|x86.ActiveCfg = Release|Win32 {CC1DD008-9406-448D-A0AD-33C3186CFADB}.All|Win32.ActiveCfg = Release|Win32 {CC1DD008-9406-448D-A0AD-33C3186CFADB}.All|x64.ActiveCfg = Release|Win32 + {CC1DD008-9406-448D-A0AD-33C3186CFADB}.All|x86.ActiveCfg = Release|x64 {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Debug|Win32.ActiveCfg = Debug|Win32 {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Debug|x64.ActiveCfg = Debug|x64 + {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Debug|x86.ActiveCfg = Debug|x64 {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Release|Win32.ActiveCfg = Release|Win32 {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Release|x64.ActiveCfg = Release|x64 + {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Release|x86.ActiveCfg = Release|x64 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.ActiveCfg = All|Win32 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.Build.0 = All|Win32 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|x64.ActiveCfg = All|Win32 + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|x86.ActiveCfg = All|Win32 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|Win32.ActiveCfg = All|Win32 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|Win32.Build.0 = All|Win32 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|x64.ActiveCfg = All|Win32 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|x64.Build.0 = All|Win32 + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Debug|x86.ActiveCfg = All|Win32 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|Win32.ActiveCfg = All|Win32 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|Win32.Build.0 = All|Win32 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|x64.ActiveCfg = All|Win32 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|x64.Build.0 = All|Win32 + {DEE932AB-5911-4700-9EEB-8C7090A0A330}.Release|x86.ActiveCfg = All|Win32 {329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|Win32.ActiveCfg = All|Win32 {329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|Win32.Build.0 = All|Win32 {329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|x64.ActiveCfg = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.All|x86.ActiveCfg = All|Win32 {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|Win32.ActiveCfg = All|Win32 {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|Win32.Build.0 = All|Win32 {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|x64.ActiveCfg = All|Win32 {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|x64.Build.0 = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Debug|x86.ActiveCfg = All|Win32 {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|Win32.ActiveCfg = All|Win32 {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|Win32.Build.0 = All|Win32 {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|x64.ActiveCfg = All|Win32 {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|x64.Build.0 = All|Win32 + {329A6FA0-0FCC-4435-A950-E670AEFA9838}.Release|x86.ActiveCfg = All|Win32 {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.All|Win32.ActiveCfg = Release|x64 {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.All|x64.ActiveCfg = Release|x64 {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.All|x64.Build.0 = Release|x64 + {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.All|x86.ActiveCfg = Release|x64 {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.Debug|Win32.ActiveCfg = Debug|Win32 {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.Debug|x64.ActiveCfg = Debug|x64 + {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.Debug|x86.ActiveCfg = Debug|x64 {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.Release|Win32.ActiveCfg = Release|Win32 {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.Release|x64.ActiveCfg = Release|x64 + {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}.Release|x86.ActiveCfg = Release|x64 {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.All|Win32.ActiveCfg = Release|Win32 {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.All|Win32.Build.0 = Release|Win32 {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.All|x64.ActiveCfg = Release|Win32 + {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.All|x86.ActiveCfg = Release|Win32 {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.Debug|Win32.ActiveCfg = Debug|Win32 {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.Debug|x64.ActiveCfg = Debug|Win32 + {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.Debug|x86.ActiveCfg = Debug|Win32 {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.Release|Win32.ActiveCfg = Release|Win32 {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.Release|x64.ActiveCfg = Release|Win32 + {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F}.Release|x86.ActiveCfg = Release|Win32 {1F0A8A77-E661-418F-BB92-82172AE43803}.All|Win32.ActiveCfg = Release|Win32 {1F0A8A77-E661-418F-BB92-82172AE43803}.All|x64.ActiveCfg = Release|Win32 + {1F0A8A77-E661-418F-BB92-82172AE43803}.All|x86.ActiveCfg = Release|Win32 {1F0A8A77-E661-418F-BB92-82172AE43803}.Debug|Win32.ActiveCfg = Debug|Win32 {1F0A8A77-E661-418F-BB92-82172AE43803}.Debug|x64.ActiveCfg = Debug|Win32 + {1F0A8A77-E661-418F-BB92-82172AE43803}.Debug|x86.ActiveCfg = Debug|Win32 {1F0A8A77-E661-418F-BB92-82172AE43803}.Release|Win32.ActiveCfg = Release|Win32 {1F0A8A77-E661-418F-BB92-82172AE43803}.Release|x64.ActiveCfg = Release|Win32 + {1F0A8A77-E661-418F-BB92-82172AE43803}.Release|x86.ActiveCfg = Release|Win32 {4F5C9D55-98EF-4256-8311-32D7BD360406}.All|Win32.ActiveCfg = Release|Win32 {4F5C9D55-98EF-4256-8311-32D7BD360406}.All|Win32.Build.0 = Release|Win32 {4F5C9D55-98EF-4256-8311-32D7BD360406}.All|x64.ActiveCfg = Release|Win32 {4F5C9D55-98EF-4256-8311-32D7BD360406}.All|x64.Build.0 = Release|Win32 + {4F5C9D55-98EF-4256-8311-32D7BD360406}.All|x86.ActiveCfg = Release|Win32 {4F5C9D55-98EF-4256-8311-32D7BD360406}.Debug|Win32.ActiveCfg = Debug|Win32 {4F5C9D55-98EF-4256-8311-32D7BD360406}.Debug|Win32.Build.0 = Debug|Win32 {4F5C9D55-98EF-4256-8311-32D7BD360406}.Debug|x64.ActiveCfg = Debug|Win32 {4F5C9D55-98EF-4256-8311-32D7BD360406}.Debug|x64.Build.0 = Debug|Win32 + {4F5C9D55-98EF-4256-8311-32D7BD360406}.Debug|x86.ActiveCfg = Debug|Win32 {4F5C9D55-98EF-4256-8311-32D7BD360406}.Release|Win32.ActiveCfg = Release|Win32 {4F5C9D55-98EF-4256-8311-32D7BD360406}.Release|Win32.Build.0 = Release|Win32 {4F5C9D55-98EF-4256-8311-32D7BD360406}.Release|x64.ActiveCfg = Release|Win32 {4F5C9D55-98EF-4256-8311-32D7BD360406}.Release|x64.Build.0 = Release|Win32 + {4F5C9D55-98EF-4256-8311-32D7BD360406}.Release|x86.ActiveCfg = Release|Win32 {E10571C4-E7F4-4608-B5F2-B22E7EB95400}.All|Win32.ActiveCfg = Release|Win32 {E10571C4-E7F4-4608-B5F2-B22E7EB95400}.All|x64.ActiveCfg = Release|Win32 + {E10571C4-E7F4-4608-B5F2-B22E7EB95400}.All|x86.ActiveCfg = Release|Win32 {E10571C4-E7F4-4608-B5F2-B22E7EB95400}.Debug|Win32.ActiveCfg = Debug|Win32 {E10571C4-E7F4-4608-B5F2-B22E7EB95400}.Debug|x64.ActiveCfg = Debug|Win32 + {E10571C4-E7F4-4608-B5F2-B22E7EB95400}.Debug|x86.ActiveCfg = Debug|Win32 {E10571C4-E7F4-4608-B5F2-B22E7EB95400}.Release|Win32.ActiveCfg = Release|Win32 {E10571C4-E7F4-4608-B5F2-B22E7EB95400}.Release|x64.ActiveCfg = Release|Win32 + {E10571C4-E7F4-4608-B5F2-B22E7EB95400}.Release|x86.ActiveCfg = Release|Win32 {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.All|Win32.ActiveCfg = Release|Win32 {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.All|Win32.Build.0 = Release|Win32 {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.All|x64.ActiveCfg = Release|Win32 {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.All|x64.Build.0 = Release|Win32 + {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.All|x86.ActiveCfg = Release|x64 {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Debug|Win32.ActiveCfg = Debug|Win32 {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Debug|Win32.Build.0 = Debug|Win32 {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Debug|x64.ActiveCfg = Debug|x64 {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Debug|x64.Build.0 = Debug|x64 + {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Debug|x86.ActiveCfg = Debug|x64 {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Release|Win32.ActiveCfg = Release|Win32 {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Release|Win32.Build.0 = Release|Win32 {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Release|x64.ActiveCfg = Release|x64 {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Release|x64.Build.0 = Release|x64 + {D1ABE208-6442-4FB4-9AAD-1677E41BC870}.Release|x86.ActiveCfg = Release|x64 {BA599D0A-4310-4505-91DA-6A6447B3E289}.All|Win32.ActiveCfg = Release|Win32 {BA599D0A-4310-4505-91DA-6A6447B3E289}.All|x64.ActiveCfg = Release|Win32 + {BA599D0A-4310-4505-91DA-6A6447B3E289}.All|x86.ActiveCfg = Release|x64 {BA599D0A-4310-4505-91DA-6A6447B3E289}.Debug|Win32.ActiveCfg = Debug|Win32 {BA599D0A-4310-4505-91DA-6A6447B3E289}.Debug|x64.ActiveCfg = Debug|x64 + {BA599D0A-4310-4505-91DA-6A6447B3E289}.Debug|x86.ActiveCfg = Debug|x64 {BA599D0A-4310-4505-91DA-6A6447B3E289}.Release|Win32.ActiveCfg = Release|Win32 {BA599D0A-4310-4505-91DA-6A6447B3E289}.Release|x64.ActiveCfg = Release|x64 + {BA599D0A-4310-4505-91DA-6A6447B3E289}.Release|x86.ActiveCfg = Release|x64 {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.All|Win32.ActiveCfg = Release|Win32 {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.All|x64.ActiveCfg = Release|Win32 + {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.All|x86.ActiveCfg = Release|x64 {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Debug|Win32.ActiveCfg = Debug|Win32 {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Debug|x64.ActiveCfg = Debug|x64 + {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Debug|x86.ActiveCfg = Debug|x64 {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Release|Win32.ActiveCfg = Release|Win32 {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Release|x64.ActiveCfg = Release|x64 + {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Release|x86.ActiveCfg = Release|x64 {70564D74-199A-4452-9C60-19ED5F242F0D}.All|Win32.ActiveCfg = Release|x64 {70564D74-199A-4452-9C60-19ED5F242F0D}.All|x64.ActiveCfg = Release|x64 {70564D74-199A-4452-9C60-19ED5F242F0D}.All|x64.Build.0 = Release|x64 + {70564D74-199A-4452-9C60-19ED5F242F0D}.All|x86.ActiveCfg = Release|x64 {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|Win32.ActiveCfg = Debug|Win32 {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|Win32.Build.0 = Debug|Win32 {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|x64.ActiveCfg = Debug|x64 {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|x64.Build.0 = Debug|x64 + {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|x86.ActiveCfg = Debug|x64 {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|Win32.ActiveCfg = Release|Win32 {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|Win32.Build.0 = Release|Win32 {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|x64.ActiveCfg = Release|x64 {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|x64.Build.0 = Release|x64 + {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|x86.ActiveCfg = Release|x64 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|Win32.ActiveCfg = Release|x64 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|x64.ActiveCfg = Release|x64 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|x64.Build.0 = Release|x64 + {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|x86.ActiveCfg = Release|x64 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Debug|Win32.ActiveCfg = Debug|Win32 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Debug|Win32.Build.0 = Debug|Win32 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Debug|x64.ActiveCfg = Debug|x64 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Debug|x64.Build.0 = Debug|x64 + {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Debug|x86.ActiveCfg = Debug|x64 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Release|Win32.ActiveCfg = Release|Win32 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Release|Win32.Build.0 = Release|Win32 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Release|x64.ActiveCfg = Release|x64 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Release|x64.Build.0 = Release|x64 + {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.Release|x86.ActiveCfg = Release|x64 {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.All|Win32.ActiveCfg = Release|x64 {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.All|Win32.Build.0 = Release|x64 {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.All|x64.ActiveCfg = Release|x64 {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.All|x64.Build.0 = Release|x64 + {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.All|x86.ActiveCfg = Release|x64 {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Debug|Win32.ActiveCfg = Debug|Win32 {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Debug|Win32.Build.0 = Debug|Win32 {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Debug|x64.ActiveCfg = Debug|x64 {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Debug|x64.Build.0 = Debug|x64 + {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Debug|x86.ActiveCfg = Debug|x64 {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Release|Win32.ActiveCfg = Release|Win32 {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Release|Win32.Build.0 = Release|Win32 {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Release|x64.ActiveCfg = Release|x64 {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Release|x64.Build.0 = Release|x64 + {0382E8FD-CFDC-41C0-8B03-792C7C84FC31}.Release|x86.ActiveCfg = Release|x64 {432DB165-1EB2-4781-A9C0-71E62610B20A}.All|Win32.ActiveCfg = Release|x64 {432DB165-1EB2-4781-A9C0-71E62610B20A}.All|x64.ActiveCfg = Release|x64 + {432DB165-1EB2-4781-A9C0-71E62610B20A}.All|x86.ActiveCfg = Release|x64 {432DB165-1EB2-4781-A9C0-71E62610B20A}.Debug|Win32.ActiveCfg = Debug|Win32 {432DB165-1EB2-4781-A9C0-71E62610B20A}.Debug|Win32.Build.0 = Debug|Win32 {432DB165-1EB2-4781-A9C0-71E62610B20A}.Debug|x64.ActiveCfg = Debug|x64 {432DB165-1EB2-4781-A9C0-71E62610B20A}.Debug|x64.Build.0 = Debug|x64 + {432DB165-1EB2-4781-A9C0-71E62610B20A}.Debug|x86.ActiveCfg = Debug|x64 {432DB165-1EB2-4781-A9C0-71E62610B20A}.Release|Win32.ActiveCfg = Release|Win32 {432DB165-1EB2-4781-A9C0-71E62610B20A}.Release|Win32.Build.0 = Release|Win32 {432DB165-1EB2-4781-A9C0-71E62610B20A}.Release|x64.ActiveCfg = Release|x64 {432DB165-1EB2-4781-A9C0-71E62610B20A}.Release|x64.Build.0 = Release|x64 + {432DB165-1EB2-4781-A9C0-71E62610B20A}.Release|x86.ActiveCfg = Release|x64 {CF70F278-3364-4395-A2E1-23501C9B8AD2}.All|Win32.ActiveCfg = Release|Win32 {CF70F278-3364-4395-A2E1-23501C9B8AD2}.All|Win32.Build.0 = Release|Win32 {CF70F278-3364-4395-A2E1-23501C9B8AD2}.All|x64.ActiveCfg = Release|Win32 + {CF70F278-3364-4395-A2E1-23501C9B8AD2}.All|x86.ActiveCfg = Release|x64 {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|Win32.ActiveCfg = Debug|Win32 {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|Win32.Build.0 = Debug|Win32 {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|x64.ActiveCfg = Debug|x64 {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|x64.Build.0 = Debug|x64 + {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Debug|x86.ActiveCfg = Debug|x64 {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|Win32.ActiveCfg = Release|Win32 {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|Win32.Build.0 = Release|Win32 {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|x64.ActiveCfg = Release|x64 {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|x64.Build.0 = Release|x64 + {CF70F278-3364-4395-A2E1-23501C9B8AD2}.Release|x86.ActiveCfg = Release|x64 {D5C87B19-150D-4EF3-A671-96589BD2D14A}.All|Win32.ActiveCfg = Release|x64 {D5C87B19-150D-4EF3-A671-96589BD2D14A}.All|x64.ActiveCfg = Release|x64 {D5C87B19-150D-4EF3-A671-96589BD2D14A}.All|x64.Build.0 = Release|x64 + {D5C87B19-150D-4EF3-A671-96589BD2D14A}.All|x86.ActiveCfg = Release|x64 {D5C87B19-150D-4EF3-A671-96589BD2D14A}.Debug|Win32.ActiveCfg = Debug|Win32 {D5C87B19-150D-4EF3-A671-96589BD2D14A}.Debug|Win32.Build.0 = Debug|Win32 {D5C87B19-150D-4EF3-A671-96589BD2D14A}.Debug|x64.ActiveCfg = Debug|x64 {D5C87B19-150D-4EF3-A671-96589BD2D14A}.Debug|x64.Build.0 = Debug|x64 + {D5C87B19-150D-4EF3-A671-96589BD2D14A}.Debug|x86.ActiveCfg = Debug|x64 {D5C87B19-150D-4EF3-A671-96589BD2D14A}.Release|Win32.ActiveCfg = Release|Win32 {D5C87B19-150D-4EF3-A671-96589BD2D14A}.Release|Win32.Build.0 = Release|Win32 {D5C87B19-150D-4EF3-A671-96589BD2D14A}.Release|x64.ActiveCfg = Release|x64 {D5C87B19-150D-4EF3-A671-96589BD2D14A}.Release|x64.Build.0 = Release|x64 + {D5C87B19-150D-4EF3-A671-96589BD2D14A}.Release|x86.ActiveCfg = Release|x64 {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.All|Win32.ActiveCfg = Release|Win32 {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.All|Win32.Build.0 = Release|Win32 {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.All|x64.ActiveCfg = Release|Win32 + {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.All|x86.ActiveCfg = Release|x64 {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|Win32.ActiveCfg = Debug|Win32 {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|Win32.Build.0 = Debug|Win32 {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|x64.ActiveCfg = Debug|x64 {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|x64.Build.0 = Debug|x64 + {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|x86.ActiveCfg = Debug|x64 {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|Win32.ActiveCfg = Release|Win32 {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|Win32.Build.0 = Release|Win32 {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|x64.ActiveCfg = Release|x64 {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|x64.Build.0 = Release|x64 + {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|x86.ActiveCfg = Release|x64 {B5A00BFA-6083-4FAE-A097-71642D6473B5}.All|Win32.ActiveCfg = Release|Win32 {B5A00BFA-6083-4FAE-A097-71642D6473B5}.All|Win32.Build.0 = Release|Win32 {B5A00BFA-6083-4FAE-A097-71642D6473B5}.All|x64.ActiveCfg = Release|Win32 + {B5A00BFA-6083-4FAE-A097-71642D6473B5}.All|x86.ActiveCfg = Release|x64 {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|Win32.ActiveCfg = Debug|Win32 {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|Win32.Build.0 = Debug|Win32 {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|x64.ActiveCfg = Debug|x64 {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|x64.Build.0 = Debug|x64 + {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|x86.ActiveCfg = Debug|x64 {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|Win32.ActiveCfg = Release|Win32 {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|Win32.Build.0 = Release|Win32 {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|x64.ActiveCfg = Release|x64 {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|x64.Build.0 = Release|x64 + {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|x86.ActiveCfg = Release|x64 {1C320193-46A6-4B34-9C56-8AB584FC1B56}.All|Win32.ActiveCfg = Release|Win32 {1C320193-46A6-4B34-9C56-8AB584FC1B56}.All|Win32.Build.0 = Release|Win32 {1C320193-46A6-4B34-9C56-8AB584FC1B56}.All|x64.ActiveCfg = Release|Win32 + {1C320193-46A6-4B34-9C56-8AB584FC1B56}.All|x86.ActiveCfg = Release|x64 {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|Win32.ActiveCfg = Debug|Win32 {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|Win32.Build.0 = Debug|Win32 {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|x64.ActiveCfg = Debug|x64 {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|x64.Build.0 = Debug|x64 + {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|x86.ActiveCfg = Debug|x64 {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|Win32.ActiveCfg = Release|Win32 {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|Win32.Build.0 = Release|Win32 {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|x64.ActiveCfg = Release|x64 {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|x64.Build.0 = Release|x64 + {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|x86.ActiveCfg = Release|x64 {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.All|Win32.ActiveCfg = Release|Win32 {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.All|Win32.Build.0 = Release|Win32 {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.All|x64.ActiveCfg = Release|Win32 + {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.All|x86.ActiveCfg = Release|x64 {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|Win32.ActiveCfg = Debug|Win32 {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|Win32.Build.0 = Debug|Win32 {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|x64.ActiveCfg = Debug|x64 {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|x64.Build.0 = Debug|x64 + {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|x86.ActiveCfg = Debug|x64 {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|Win32.ActiveCfg = Release|Win32 {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|Win32.Build.0 = Release|Win32 {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|x64.ActiveCfg = Release|x64 {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|x64.Build.0 = Release|x64 + {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|x86.ActiveCfg = Release|x64 {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.All|Win32.ActiveCfg = Release|Win32 {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.All|Win32.Build.0 = Release|Win32 {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.All|x64.ActiveCfg = Release|Win32 + {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.All|x86.ActiveCfg = Release|x64 {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|Win32.ActiveCfg = Debug|Win32 {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|Win32.Build.0 = Debug|Win32 {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|x64.ActiveCfg = Debug|x64 {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|x64.Build.0 = Debug|x64 + {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|x86.ActiveCfg = Debug|x64 {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|Win32.ActiveCfg = Release|Win32 {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|Win32.Build.0 = Release|Win32 {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|x64.ActiveCfg = Release|x64 {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|x64.Build.0 = Release|x64 + {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|x86.ActiveCfg = Release|x64 {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.All|Win32.ActiveCfg = Release|Win32 {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.All|Win32.Build.0 = Release|Win32 {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.All|x64.ActiveCfg = Release|Win32 + {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.All|x86.ActiveCfg = Release|x64 {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|Win32.ActiveCfg = Debug|Win32 {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|Win32.Build.0 = Debug|Win32 {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|x64.ActiveCfg = Debug|x64 {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|x64.Build.0 = Debug|x64 + {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|x86.ActiveCfg = Debug|x64 {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|Win32.ActiveCfg = Release|Win32 {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|Win32.Build.0 = Release|Win32 {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|x64.ActiveCfg = Release|x64 {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|x64.Build.0 = Release|x64 + {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|x86.ActiveCfg = Release|x64 {504B3154-7A4F-459D-9877-B951021C3F1F}.All|Win32.ActiveCfg = Release|Win32 {504B3154-7A4F-459D-9877-B951021C3F1F}.All|Win32.Build.0 = Release|Win32 {504B3154-7A4F-459D-9877-B951021C3F1F}.All|x64.ActiveCfg = Release|Win32 + {504B3154-7A4F-459D-9877-B951021C3F1F}.All|x86.ActiveCfg = Release|x64 {504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|Win32.ActiveCfg = Debug|Win32 {504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|Win32.Build.0 = Debug|Win32 {504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|x64.ActiveCfg = Debug|x64 {504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|x64.Build.0 = Debug|x64 + {504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|x86.ActiveCfg = Debug|x64 {504B3154-7A4F-459D-9877-B951021C3F1F}.Release|Win32.ActiveCfg = Release|Win32 {504B3154-7A4F-459D-9877-B951021C3F1F}.Release|Win32.Build.0 = Release|Win32 {504B3154-7A4F-459D-9877-B951021C3F1F}.Release|x64.ActiveCfg = Release|x64 {504B3154-7A4F-459D-9877-B951021C3F1F}.Release|x64.Build.0 = Release|x64 + {504B3154-7A4F-459D-9877-B951021C3F1F}.Release|x86.ActiveCfg = Release|x64 {746F3632-5BB2-4570-9453-31D6D58A7D8E}.All|Win32.ActiveCfg = Release|Win32 {746F3632-5BB2-4570-9453-31D6D58A7D8E}.All|Win32.Build.0 = Release|Win32 {746F3632-5BB2-4570-9453-31D6D58A7D8E}.All|x64.ActiveCfg = Release|Win32 + {746F3632-5BB2-4570-9453-31D6D58A7D8E}.All|x86.ActiveCfg = Release|x64 {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|Win32.ActiveCfg = Debug|Win32 {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|Win32.Build.0 = Debug|Win32 {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|x64.ActiveCfg = Debug|x64 {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|x64.Build.0 = Debug|x64 + {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|x86.ActiveCfg = Debug|x64 {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|Win32.ActiveCfg = Release|Win32 {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|Win32.Build.0 = Release|Win32 {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|x64.ActiveCfg = Release|x64 {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|x64.Build.0 = Release|x64 + {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|x86.ActiveCfg = Release|x64 {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.All|Win32.ActiveCfg = Release|Win32 {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.All|Win32.Build.0 = Release|Win32 {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.All|x64.ActiveCfg = Release|Win32 + {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.All|x86.ActiveCfg = Release|x64 {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|Win32.ActiveCfg = Debug|Win32 {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|Win32.Build.0 = Debug|Win32 {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|x64.ActiveCfg = Debug|x64 {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|x64.Build.0 = Debug|x64 + {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|x86.ActiveCfg = Debug|x64 {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|Win32.ActiveCfg = Release|Win32 {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|Win32.Build.0 = Release|Win32 {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|x64.ActiveCfg = Release|x64 {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|x64.Build.0 = Release|x64 + {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|x86.ActiveCfg = Release|x64 {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.All|Win32.ActiveCfg = Release|x64 {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.All|x64.ActiveCfg = Release|x64 {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.All|x64.Build.0 = Release|x64 + {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.All|x86.ActiveCfg = Release|x64 {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Debug|Win32.ActiveCfg = Debug|Win32 {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Debug|Win32.Build.0 = Debug|Win32 {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Debug|x64.ActiveCfg = Debug|x64 {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Debug|x64.Build.0 = Debug|x64 + {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Debug|x86.ActiveCfg = Debug|x64 {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Release|Win32.ActiveCfg = Release|Win32 {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Release|Win32.Build.0 = Release|Win32 {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Release|x64.ActiveCfg = Release|x64 {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Release|x64.Build.0 = Release|x64 + {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Release|x86.ActiveCfg = Release|x64 {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.All|Win32.ActiveCfg = Release|Win32 {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.All|Win32.Build.0 = Release|Win32 {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.All|x64.ActiveCfg = Release|Win32 + {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.All|x86.ActiveCfg = Release|Win32 {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Debug|Win32.ActiveCfg = Debug|Win32 {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Debug|Win32.Build.0 = Debug|Win32 {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Debug|x64.ActiveCfg = Debug|Win32 {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Debug|x64.Build.0 = Debug|Win32 + {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Debug|x86.ActiveCfg = Debug|Win32 {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Release|Win32.ActiveCfg = Release|Win32 {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Release|Win32.Build.0 = Release|Win32 {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Release|x64.ActiveCfg = Release|Win32 {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Release|x64.Build.0 = Release|Win32 + {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Release|x86.ActiveCfg = Release|Win32 {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.All|Win32.ActiveCfg = Release|x64 {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.All|x64.ActiveCfg = Release|x64 {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.All|x64.Build.0 = Release|x64 + {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.All|x86.ActiveCfg = Release|x64 {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Debug|Win32.ActiveCfg = Debug|Win32 {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Debug|Win32.Build.0 = Debug|Win32 {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Debug|x64.ActiveCfg = Debug|x64 {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Debug|x64.Build.0 = Debug|x64 + {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Debug|x86.ActiveCfg = Debug|x64 {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Release|Win32.ActiveCfg = Release|Win32 {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Release|Win32.Build.0 = Release|Win32 {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Release|x64.ActiveCfg = Release|x64 {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Release|x64.Build.0 = Release|x64 + {ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Release|x86.ActiveCfg = Release|x64 {4D418176-3B33-47E6-A63E-01BA34ADD21C}.All|Win32.ActiveCfg = Release Passthrough|x64 {4D418176-3B33-47E6-A63E-01BA34ADD21C}.All|x64.ActiveCfg = Release Passthrough|x64 {4D418176-3B33-47E6-A63E-01BA34ADD21C}.All|x64.Build.0 = Release Passthrough|x64 + {4D418176-3B33-47E6-A63E-01BA34ADD21C}.All|x86.ActiveCfg = Release Passthrough|x64 {4D418176-3B33-47E6-A63E-01BA34ADD21C}.Debug|Win32.ActiveCfg = Debug|Win32 {4D418176-3B33-47E6-A63E-01BA34ADD21C}.Debug|Win32.Build.0 = Debug|Win32 {4D418176-3B33-47E6-A63E-01BA34ADD21C}.Debug|x64.ActiveCfg = Debug|x64 {4D418176-3B33-47E6-A63E-01BA34ADD21C}.Debug|x64.Build.0 = Debug|x64 + {4D418176-3B33-47E6-A63E-01BA34ADD21C}.Debug|x86.ActiveCfg = Debug|x64 {4D418176-3B33-47E6-A63E-01BA34ADD21C}.Release|Win32.ActiveCfg = Release|Win32 {4D418176-3B33-47E6-A63E-01BA34ADD21C}.Release|Win32.Build.0 = Release|Win32 {4D418176-3B33-47E6-A63E-01BA34ADD21C}.Release|x64.ActiveCfg = Release|x64 {4D418176-3B33-47E6-A63E-01BA34ADD21C}.Release|x64.Build.0 = Release|x64 + {4D418176-3B33-47E6-A63E-01BA34ADD21C}.Release|x86.ActiveCfg = Release|x64 {7D3122C7-C9D0-3748-81F8-F0DDCB40BF5E}.All|Win32.ActiveCfg = Release|Win32 {7D3122C7-C9D0-3748-81F8-F0DDCB40BF5E}.All|Win32.Build.0 = Release|Win32 {7D3122C7-C9D0-3748-81F8-F0DDCB40BF5E}.All|x64.ActiveCfg = Release|Win32 + {7D3122C7-C9D0-3748-81F8-F0DDCB40BF5E}.All|x86.ActiveCfg = Release|Win32 {7D3122C7-C9D0-3748-81F8-F0DDCB40BF5E}.Debug|Win32.ActiveCfg = Debug|Win32 {7D3122C7-C9D0-3748-81F8-F0DDCB40BF5E}.Debug|x64.ActiveCfg = Debug|Win32 + {7D3122C7-C9D0-3748-81F8-F0DDCB40BF5E}.Debug|x86.ActiveCfg = Debug|Win32 {7D3122C7-C9D0-3748-81F8-F0DDCB40BF5E}.Release|Win32.ActiveCfg = Release|Win32 {7D3122C7-C9D0-3748-81F8-F0DDCB40BF5E}.Release|x64.ActiveCfg = Release|Win32 + {7D3122C7-C9D0-3748-81F8-F0DDCB40BF5E}.Release|x86.ActiveCfg = Release|Win32 {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.All|Win32.ActiveCfg = Release|x64 {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.All|x64.ActiveCfg = Release|x64 {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.All|x64.Build.0 = Release|x64 + {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.All|x86.ActiveCfg = Release|x64 {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.Debug|Win32.ActiveCfg = Debug|Win32 {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.Debug|Win32.Build.0 = Debug|Win32 {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.Debug|x64.ActiveCfg = Debug|x64 {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.Debug|x64.Build.0 = Debug|x64 + {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.Debug|x86.ActiveCfg = Debug|x64 {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.Release|Win32.ActiveCfg = Release|Win32 {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.Release|Win32.Build.0 = Release|Win32 {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.Release|x64.ActiveCfg = Release|x64 {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.Release|x64.Build.0 = Release|x64 + {EF300386-A8DF-4372-B6D8-FB9BFFCA9AED}.Release|x86.ActiveCfg = Release|x64 {B808178B-82F0-4CF4-A2B1-921939FA24D0}.All|Win32.ActiveCfg = Release|Win32 {B808178B-82F0-4CF4-A2B1-921939FA24D0}.All|Win32.Build.0 = Release|Win32 {B808178B-82F0-4CF4-A2B1-921939FA24D0}.All|x64.ActiveCfg = Release|Win32 + {B808178B-82F0-4CF4-A2B1-921939FA24D0}.All|x86.ActiveCfg = Release|Win32 {B808178B-82F0-4CF4-A2B1-921939FA24D0}.Debug|Win32.ActiveCfg = Debug|Win32 {B808178B-82F0-4CF4-A2B1-921939FA24D0}.Debug|Win32.Build.0 = Debug|Win32 {B808178B-82F0-4CF4-A2B1-921939FA24D0}.Debug|x64.ActiveCfg = Debug|Win32 {B808178B-82F0-4CF4-A2B1-921939FA24D0}.Debug|x64.Build.0 = Debug|Win32 + {B808178B-82F0-4CF4-A2B1-921939FA24D0}.Debug|x86.ActiveCfg = Debug|Win32 {B808178B-82F0-4CF4-A2B1-921939FA24D0}.Release|Win32.ActiveCfg = Release|Win32 {B808178B-82F0-4CF4-A2B1-921939FA24D0}.Release|Win32.Build.0 = Release|Win32 {B808178B-82F0-4CF4-A2B1-921939FA24D0}.Release|x64.ActiveCfg = Release|Win32 {B808178B-82F0-4CF4-A2B1-921939FA24D0}.Release|x64.Build.0 = Release|Win32 + {B808178B-82F0-4CF4-A2B1-921939FA24D0}.Release|x86.ActiveCfg = Release|Win32 {9778F1C0-09BC-4698-8EBC-BD982247209A}.All|Win32.ActiveCfg = Release|x64 {9778F1C0-09BC-4698-8EBC-BD982247209A}.All|x64.ActiveCfg = Release|x64 {9778F1C0-09BC-4698-8EBC-BD982247209A}.All|x64.Build.0 = Release|x64 + {9778F1C0-09BC-4698-8EBC-BD982247209A}.All|x86.ActiveCfg = Release|x64 {9778F1C0-09BC-4698-8EBC-BD982247209A}.Debug|Win32.ActiveCfg = Debug|Win32 {9778F1C0-09BC-4698-8EBC-BD982247209A}.Debug|Win32.Build.0 = Debug|Win32 {9778F1C0-09BC-4698-8EBC-BD982247209A}.Debug|x64.ActiveCfg = Debug|x64 {9778F1C0-09BC-4698-8EBC-BD982247209A}.Debug|x64.Build.0 = Debug|x64 + {9778F1C0-09BC-4698-8EBC-BD982247209A}.Debug|x86.ActiveCfg = Debug|x64 {9778F1C0-09BC-4698-8EBC-BD982247209A}.Release|Win32.ActiveCfg = Release|Win32 {9778F1C0-09BC-4698-8EBC-BD982247209A}.Release|Win32.Build.0 = Release|Win32 {9778F1C0-09BC-4698-8EBC-BD982247209A}.Release|x64.ActiveCfg = Release|x64 {9778F1C0-09BC-4698-8EBC-BD982247209A}.Release|x64.Build.0 = Release|x64 + {9778F1C0-09BC-4698-8EBC-BD982247209A}.Release|x86.ActiveCfg = Release|x64 {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.All|Win32.ActiveCfg = Release|x64 {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.All|x64.ActiveCfg = Release|x64 {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.All|x64.Build.0 = Release|x64 + {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.All|x86.ActiveCfg = Release|x64 {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.Debug|Win32.ActiveCfg = Debug|Win32 {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.Debug|Win32.Build.0 = Debug|Win32 {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.Debug|x64.ActiveCfg = Debug|x64 {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.Debug|x64.Build.0 = Debug|x64 + {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.Debug|x86.ActiveCfg = Debug|x64 {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.Release|Win32.ActiveCfg = Release|Win32 {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.Release|Win32.Build.0 = Release|Win32 {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.Release|x64.ActiveCfg = Release|x64 {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.Release|x64.Build.0 = Release|x64 + {AFA983D6-4569-4F88-BA94-555ED00FD9A8}.Release|x86.ActiveCfg = Release|x64 {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.All|Win32.ActiveCfg = Release|Win32 {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.All|Win32.Build.0 = Release|Win32 {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.All|x64.ActiveCfg = Release|Win32 + {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.All|x86.ActiveCfg = Release|x64 {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.Debug|Win32.ActiveCfg = Debug|Win32 {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.Debug|Win32.Build.0 = Debug|Win32 {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.Debug|x64.ActiveCfg = Debug|x64 {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.Debug|x64.Build.0 = Debug|x64 + {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.Debug|x86.ActiveCfg = Debug|x64 {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.Release|Win32.ActiveCfg = Release|Win32 {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.Release|Win32.Build.0 = Release|Win32 {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.Release|x64.ActiveCfg = Release|x64 {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.Release|x64.Build.0 = Release|x64 + {56B91D01-9150-4BBF-AFA1-5B68AB991B76}.Release|x86.ActiveCfg = Release|x64 {990BAA76-89D3-4E38-8479-C7B28784EFC8}.All|Win32.ActiveCfg = Release|Win32 {990BAA76-89D3-4E38-8479-C7B28784EFC8}.All|Win32.Build.0 = Release|Win32 {990BAA76-89D3-4E38-8479-C7B28784EFC8}.All|x64.ActiveCfg = Release|Win32 + {990BAA76-89D3-4E38-8479-C7B28784EFC8}.All|x86.ActiveCfg = Release|x64 {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Debug|Win32.ActiveCfg = Debug|Win32 {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Debug|Win32.Build.0 = Debug|Win32 {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Debug|x64.ActiveCfg = Debug|x64 {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Debug|x64.Build.0 = Debug|x64 + {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Debug|x86.ActiveCfg = Debug|x64 {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Release|Win32.ActiveCfg = Release|Win32 {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Release|Win32.Build.0 = Release|Win32 {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Release|x64.ActiveCfg = Release|x64 {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Release|x64.Build.0 = Release|x64 + {990BAA76-89D3-4E38-8479-C7B28784EFC8}.Release|x86.ActiveCfg = Release|x64 {1E21AFE0-6FDB-41D2-942D-863607C24B91}.All|Win32.ActiveCfg = Release|x64 {1E21AFE0-6FDB-41D2-942D-863607C24B91}.All|x64.ActiveCfg = Release|x64 {1E21AFE0-6FDB-41D2-942D-863607C24B91}.All|x64.Build.0 = Release|x64 + {1E21AFE0-6FDB-41D2-942D-863607C24B91}.All|x86.ActiveCfg = Release|x64 {1E21AFE0-6FDB-41D2-942D-863607C24B91}.Debug|Win32.ActiveCfg = Debug|Win32 {1E21AFE0-6FDB-41D2-942D-863607C24B91}.Debug|Win32.Build.0 = Debug|Win32 {1E21AFE0-6FDB-41D2-942D-863607C24B91}.Debug|x64.ActiveCfg = Debug|x64 {1E21AFE0-6FDB-41D2-942D-863607C24B91}.Debug|x64.Build.0 = Debug|x64 + {1E21AFE0-6FDB-41D2-942D-863607C24B91}.Debug|x86.ActiveCfg = Debug|x64 {1E21AFE0-6FDB-41D2-942D-863607C24B91}.Release|Win32.ActiveCfg = Release|Win32 {1E21AFE0-6FDB-41D2-942D-863607C24B91}.Release|Win32.Build.0 = Release|Win32 {1E21AFE0-6FDB-41D2-942D-863607C24B91}.Release|x64.ActiveCfg = Release|x64 {1E21AFE0-6FDB-41D2-942D-863607C24B91}.Release|x64.Build.0 = Release|x64 + {1E21AFE0-6FDB-41D2-942D-863607C24B91}.Release|x86.ActiveCfg = Release|x64 {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.All|Win32.ActiveCfg = Release|x64 {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.All|x64.ActiveCfg = Release|x64 {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.All|x64.Build.0 = Release|x64 + {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.All|x86.ActiveCfg = Release|x64 {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.Debug|Win32.ActiveCfg = Debug|Win32 {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.Debug|Win32.Build.0 = Debug|Win32 {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.Debug|x64.ActiveCfg = Debug|x64 {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.Debug|x64.Build.0 = Debug|x64 + {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.Debug|x86.ActiveCfg = Debug|x64 {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.Release|Win32.ActiveCfg = Release|Win32 {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.Release|Win32.Build.0 = Release|Win32 {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.Release|x64.ActiveCfg = Release|x64 {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.Release|x64.Build.0 = Release|x64 + {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.Release|x86.ActiveCfg = Release|x64 {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.All|Win32.ActiveCfg = Release|x64 {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.All|x64.ActiveCfg = Release|x64 {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.All|x64.Build.0 = Release|x64 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.All|x86.ActiveCfg = Release|x64 {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Debug|Win32.ActiveCfg = Debug|Win32 {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Debug|Win32.Build.0 = Debug|Win32 {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Debug|x64.ActiveCfg = Debug|x64 {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Debug|x64.Build.0 = Debug|x64 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Debug|x86.ActiveCfg = Debug|x64 {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Release|Win32.ActiveCfg = Release|Win32 {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Release|Win32.Build.0 = Release|Win32 {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Release|x64.ActiveCfg = Release|x64 {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Release|x64.Build.0 = Release|x64 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Release|x86.ActiveCfg = Release|x64 {B4B62169-5AD4-4559-8707-3D933AC5DB39}.All|Win32.ActiveCfg = Release|x64 {B4B62169-5AD4-4559-8707-3D933AC5DB39}.All|x64.ActiveCfg = Release|x64 {B4B62169-5AD4-4559-8707-3D933AC5DB39}.All|x64.Build.0 = Release|x64 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.All|x86.ActiveCfg = Release|x64 {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Debug|Win32.ActiveCfg = Debug|Win32 {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Debug|Win32.Build.0 = Debug|Win32 {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Debug|x64.ActiveCfg = Debug|x64 {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Debug|x64.Build.0 = Debug|x64 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Debug|x86.ActiveCfg = Debug|x64 {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Release|Win32.ActiveCfg = Release|Win32 {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Release|Win32.Build.0 = Release|Win32 {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Release|x64.ActiveCfg = Release|x64 {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Release|x64.Build.0 = Release|x64 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Release|x86.ActiveCfg = Release|x64 {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.All|Win32.ActiveCfg = Release|x64 {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.All|x64.ActiveCfg = Release|x64 {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.All|x64.Build.0 = Release|x64 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.All|x86.ActiveCfg = Release|x64 {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Debug|Win32.ActiveCfg = Debug|Win32 {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Debug|Win32.Build.0 = Debug|Win32 {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Debug|x64.ActiveCfg = Debug|x64 {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Debug|x64.Build.0 = Debug|x64 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Debug|x86.ActiveCfg = Debug|x64 {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|Win32.ActiveCfg = Release|Win32 {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|Win32.Build.0 = Release|Win32 {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|x64.ActiveCfg = Release|x64 {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|x64.Build.0 = Release|x64 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|x86.ActiveCfg = Release|x64 {D578E676-7EC8-4548-BD8B-845C635F14AD}.All|Win32.ActiveCfg = Release|Win32 {D578E676-7EC8-4548-BD8B-845C635F14AD}.All|Win32.Build.0 = Release|Win32 {D578E676-7EC8-4548-BD8B-845C635F14AD}.All|x64.ActiveCfg = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.All|x86.ActiveCfg = Release|Win32 {D578E676-7EC8-4548-BD8B-845C635F14AD}.Debug|Win32.ActiveCfg = Debug|Win32 {D578E676-7EC8-4548-BD8B-845C635F14AD}.Debug|Win32.Build.0 = Debug|Win32 {D578E676-7EC8-4548-BD8B-845C635F14AD}.Debug|x64.ActiveCfg = Debug|Win32 {D578E676-7EC8-4548-BD8B-845C635F14AD}.Debug|x64.Build.0 = Debug|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Debug|x86.ActiveCfg = Debug|Win32 {D578E676-7EC8-4548-BD8B-845C635F14AD}.Release|Win32.ActiveCfg = Release|Win32 {D578E676-7EC8-4548-BD8B-845C635F14AD}.Release|Win32.Build.0 = Release|Win32 {D578E676-7EC8-4548-BD8B-845C635F14AD}.Release|x64.ActiveCfg = Release|Win32 {D578E676-7EC8-4548-BD8B-845C635F14AD}.Release|x64.Build.0 = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Release|x86.ActiveCfg = Release|Win32 {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.All|Win32.ActiveCfg = Release|x64 {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.All|x64.ActiveCfg = Release|x64 {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.All|x64.Build.0 = Release|x64 + {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.All|x86.ActiveCfg = Release|x64 {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|Win32.ActiveCfg = Debug|Win32 {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|Win32.Build.0 = Debug|Win32 {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|x64.ActiveCfg = Debug|x64 {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|x64.Build.0 = Debug|x64 + {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|x86.ActiveCfg = Debug|x64 {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|Win32.ActiveCfg = Release|Win32 {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|Win32.Build.0 = Release|Win32 {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|x64.ActiveCfg = Release|x64 {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|x64.Build.0 = Release|x64 + {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|x86.ActiveCfg = Release|x64 {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.All|Win32.ActiveCfg = Release|x64 {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.All|x64.ActiveCfg = Release|x64 {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.All|x64.Build.0 = Release|x64 + {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.All|x86.ActiveCfg = Release|x64 {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.Debug|Win32.ActiveCfg = Debug|Win32 {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.Debug|x64.ActiveCfg = Debug|x64 + {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.Debug|x86.ActiveCfg = Debug|x64 {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.Release|Win32.ActiveCfg = Release|Win32 {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.Release|x64.ActiveCfg = Release|x64 + {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.Release|x86.ActiveCfg = Release|x64 {05C9FB27-480E-4D53-B3B7-7338E2514666}.All|Win32.ActiveCfg = Release|Win32 {05C9FB27-480E-4D53-B3B7-7338E2514666}.All|Win32.Build.0 = Release|Win32 {05C9FB27-480E-4D53-B3B7-7338E2514666}.All|x64.ActiveCfg = Release|Win32 + {05C9FB27-480E-4D53-B3B7-7338E2514666}.All|x86.ActiveCfg = Release|x64 {05C9FB27-480E-4D53-B3B7-7338E2514666}.Debug|Win32.ActiveCfg = Debug|Win32 {05C9FB27-480E-4D53-B3B7-7338E2514666}.Debug|x64.ActiveCfg = Debug|x64 + {05C9FB27-480E-4D53-B3B7-7338E2514666}.Debug|x86.ActiveCfg = Debug|x64 {05C9FB27-480E-4D53-B3B7-7338E2514666}.Release|Win32.ActiveCfg = Release|Win32 {05C9FB27-480E-4D53-B3B7-7338E2514666}.Release|x64.ActiveCfg = Release|x64 + {05C9FB27-480E-4D53-B3B7-7338E2514666}.Release|x86.ActiveCfg = Release|x64 {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.All|Win32.ActiveCfg = Release|x64 {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.All|x64.ActiveCfg = Release|x64 {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.All|x64.Build.0 = Release|x64 + {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.All|x86.ActiveCfg = Release|x64 {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.Debug|Win32.ActiveCfg = Debug|Win32 {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.Debug|x64.ActiveCfg = Debug|x64 + {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.Debug|x86.ActiveCfg = Debug|x64 {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.Release|Win32.ActiveCfg = Release|Win32 {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.Release|x64.ActiveCfg = Release|x64 + {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.Release|x86.ActiveCfg = Release|x64 + {47213370-B933-487D-9F45-BCA26D7E2B6F}.All|Win32.ActiveCfg = Release|x86 + {47213370-B933-487D-9F45-BCA26D7E2B6F}.All|x64.ActiveCfg = Release|x86 + {47213370-B933-487D-9F45-BCA26D7E2B6F}.All|x86.ActiveCfg = Release|x86 + {47213370-B933-487D-9F45-BCA26D7E2B6F}.All|x86.Build.0 = Release|x86 + {47213370-B933-487D-9F45-BCA26D7E2B6F}.Debug|Win32.ActiveCfg = Debug|x86 + {47213370-B933-487D-9F45-BCA26D7E2B6F}.Debug|x64.ActiveCfg = Debug|x64 + {47213370-B933-487D-9F45-BCA26D7E2B6F}.Debug|x86.ActiveCfg = Debug|x86 + {47213370-B933-487D-9F45-BCA26D7E2B6F}.Debug|x86.Build.0 = Debug|x86 + {47213370-B933-487D-9F45-BCA26D7E2B6F}.Release|Win32.ActiveCfg = Release|x86 + {47213370-B933-487D-9F45-BCA26D7E2B6F}.Release|x64.ActiveCfg = Release|x64 + {47213370-B933-487D-9F45-BCA26D7E2B6F}.Release|x86.ActiveCfg = Release|x86 + {47213370-B933-487D-9F45-BCA26D7E2B6F}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Setup/Setup.wixproj b/Setup/Setup.wixproj new file mode 100644 index 0000000..03fd609 --- /dev/null +++ b/Setup/Setup.wixproj @@ -0,0 +1,695 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <ProductVersion>3.5</ProductVersion> + <ProjectGuid>{47213370-b933-487d-9f45-bca26d7e2b6f}</ProjectGuid> + <SchemaVersion>2.0</SchemaVersion> + <OutputName>FreeSWITCH</OutputName> + <OutputType>Package</OutputType> + <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath> + <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> + <OutputPath>bin\x86\Debug\</OutputPath> + <IntermediateOutputPath>obj\X86\$(Configuration)\</IntermediateOutputPath> + <DefineConstants>Debug;FreeSWITCHConfFilesDir=..\..\..\..\conf;FreeSWITCHSoundFilesDir=..\..\..\..\Win32\debug\sounds;</DefineConstants> + <WixVariables> + </WixVariables> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> + <OutputPath>bin\x86\release\</OutputPath> + <IntermediateOutputPath>obj\X86\$(Configuration)\</IntermediateOutputPath> + <DefineConstants>Debug;FreeSWITCHConfFilesDir=..\..\..\..\conf;FreeSWITCHSoundFilesDir=..\..\..\..\Win32\release\sounds;</DefineConstants> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' "> + <OutputPath>bin\x64\Debug\</OutputPath> + <IntermediateOutputPath>obj\X64\$(Configuration)\</IntermediateOutputPath> + <DefineConstants>Debug;FreeSWITCHConfFilesDir=..\..\..\..\conf;FreeSWITCHSoundFilesDir=..\..\..\..\x64\debug\sounds;</DefineConstants> + <WixVariables> + </WixVariables> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' "> + <OutputPath>bin\x64\Release\</OutputPath> + <IntermediateOutputPath>obj\X64\$(Configuration)\</IntermediateOutputPath> + <DefineConstants>Debug;FreeSWITCHConfFilesDir=..\..\..\..\conf;FreeSWITCHSoundFilesDir=..\..\..\..\x64\release\sounds;</DefineConstants> + </PropertyGroup> + <ItemGroup> + <Compile Include="Fragments\FreeSWITCHConfFiles.wxs" /> + <Compile Include="Fragments\FreeSWITCHSoundFiles8.wxs" /> + <Compile Include="Product.wxs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\libs\broadvoice\src\libbroadvoice.2010.vcxproj"> + <Name>libbroadvoice</Name> + <Project>{cf70f278-3364-4395-a2e1-23501c9b8ad2}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>INSTALLLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\libs\libteletone\libteletone.2010.vcxproj"> + <Name>libteletone</Name> + <Project>{89385c74-5860-4174-9caf-a39e7c48909c}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>INSTALLLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\libs\spandsp\src\libspandsp.2010.vcxproj"> + <Name>libspandsp</Name> + <Project>{1cbb0077-18c5-455f-801c-0a0ce7b0bbf5}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>INSTALLLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\libs\win32\apr-util\libaprutil.2010.vcxproj"> + <Name>libaprutil</Name> + <Project>{f057da7f-79e5-4b00-845c-ef446ef055e3}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>INSTALLLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\libs\win32\apr\libapr.2010.vcxproj"> + <Name>libapr</Name> + <Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>INSTALLLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\libs\win32\js\js.2010.vcxproj"> + <Name>js</Name> + <Project>{204fa0de-305d-4414-ae2e-f195a23f390d}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>INSTALLLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\libs\win32\openssl\libeay32.2010.vcxproj"> + <Name>libeay32</Name> + <Project>{d331904d-a00a-4694-a5a3-fcff64ab5dbe}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>INSTALLLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\libs\win32\openssl\openssl.2010.vcxproj"> + <Name>openssl __Libraries\openssl\openssl_</Name> + <Project>{25bd39b1-c8bf-4676-a738-9cabd9c6bc79}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>INSTALLLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\libs\win32\openssl\ssleay32.2010.vcxproj"> + <Name>ssleay32</Name> + <Project>{b4b62169-5ad4-4559-8707-3d933ac5db39}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>INSTALLLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\libs\win32\pocketsphinx\pocketsphinx.2010.vcxproj"> + <Name>pocketsphinx</Name> + <Project>{94001a0e-a837-445c-8004-f918f10d0226}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>INSTALLLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\libs\win32\sphinxbase\sphinxbase.2010.vcxproj"> + <Name>sphinxbase</Name> + <Project>{2f025ead-99bd-40f5-b2cc-f0a28cad7f2d}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>INSTALLLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\applications\mod_avmd\mod_avmd.2010.vcxproj"> + <Name>mod_avmd</Name> + <Project>{990baa76-89d3-4e38-8479-c7b28784efc8}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\applications\mod_commands\mod_commands.2010.vcxproj"> + <Name>mod_commands</Name> + <Project>{30a5b29c-983e-4580-9fd0-d647ccdcc7eb}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\applications\mod_conference\mod_conference.2010.vcxproj"> + <Name>mod_conference</Name> + <Project>{c24fb505-05d7-4319-8485-7540b44c8603}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\applications\mod_curl\mod_curl.2010.vcxproj"> + <Name>mod_curl</Name> + <Project>{ef300386-a8df-4372-b6d8-fb9bffca9aed}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\applications\mod_db\mod_db.2010.vcxproj"> + <Name>mod_db</Name> + <Project>{f6a33240-8f29-48bd-98f0-826995911799}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\applications\mod_dptools\mod_dptools.2010.vcxproj"> + <Name>mod_dptools</Name> + <Project>{b5881a85-fe70-4f64-8607-2caae52669c6}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\applications\mod_enum\mod_enum.2010.vcxproj"> + <Name>mod_enum</Name> + <Project>{71a967d5-0e99-4cef-a587-98836ee6f2ef}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\applications\mod_esf\mod_esf.2010.vcxproj"> + <Name>mod_esf</Name> + <Project>{3850d93a-5f24-4922-bc1c-74d08c37c256}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\applications\mod_expr\mod_expr.2010.vcxproj"> + <Name>mod_expr</Name> + <Project>{65a6273d-fcab-4c55-b09e-65100141a5d4}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\applications\mod_fifo\mod_fifo.2010.vcxproj"> + <Name>mod_fifo</Name> + <Project>{75df7f29-2fbf-47f7-b5af-5b4952dc1abd}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\applications\mod_fsv\mod_fsv.2010.vcxproj"> + <Name>mod_fsv</Name> + <Project>{e3246d17-e29b-4ab5-962a-c69b0c5837bb}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\applications\mod_lcr\mod_lcr.2010.vcxproj"> + <Name>mod_lcr</Name> + <Project>{1a3793d1-05d1-4b57-9b0f-5af3e79dc439}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\applications\mod_nibblebill\mod_nibblebill.2010.vcxproj"> + <Name>mod_nibblebill</Name> + <Project>{3c977801-fe88-48f2-83d3-fa2ebff6688e}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\applications\mod_rss\mod_rss.2010.vcxproj"> + <Name>mod_rss</Name> + <Project>{b69247fa-ecd6-40ed-8e44-5ca6c3baf9a4}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\applications\mod_snom\mod_snom.2010.vcxproj"> + <Name>mod_snom</Name> + <Project>{2a3d00c6-588d-4e86-81ac-9ef5ede86e03}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\applications\mod_spandsp\mod_spandsp.2010.vcxproj"> + <Name>mod_spandsp</Name> + <Project>{1e21afe0-6fdb-41d2-942d-863607c24b91}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\applications\mod_valet_parking\mod_valet_parking.2010.vcxproj"> + <Name>mod_valet_parking</Name> + <Project>{432db165-1eb2-4781-a9c0-71e62610b20a}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\applications\mod_vmd\mod_vmd.2010.vcxproj"> + <Name>mod_vmd</Name> + <Project>{14e4a972-9cfb-436d-b0a5-4943f3f80d47}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\applications\mod_voicemail\mod_voicemail.2010.vcxproj"> + <Name>mod_voicemail</Name> + <Project>{d7f1e3f2-a3f4-474c-8555-15122571af52}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\asr_tts\mod_pocketsphinx\mod_pocketsphinx.2010.vcxproj"> + <Name>mod_pocketsphinx</Name> + <Project>{2286da73-9fc5-45bc-a508-85994c3317ab}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\asr_tts\mod_unimrcp\mod_unimrcp.2010.vcxproj"> + <Name>mod_unimrcp</Name> + <Project>{d07c378a-f5f7-438f-adf3-4ac4fb1883cd}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\codecs\mod_amr\mod_amr.2010.vcxproj"> + <Name>mod_amr</Name> + <Project>{8deb383c-4091-4f42-a56f-c9e46d552d79}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\codecs\mod_celt\mod_celt.vcxproj"> + <Name>mod_celt</Name> + <Project>{4d418176-3b33-47e6-a63e-01ba34add21c}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\codecs\mod_g723_1\mod_g723_1.2010.vcxproj"> + <Name>mod_g723_1</Name> + <Project>{fea1eef7-876f-48de-88bf-c0e3e606d758}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\codecs\mod_g729\mod_g729.2010.vcxproj"> + <Name>mod_g729</Name> + <Project>{1d95cd95-0de2-48c3-ac23-d5c7d1c9c0f0}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\codecs\mod_ilbc\mod_ilbc.2010.vcxproj"> + <Name>mod_ilbc</Name> + <Project>{d3ec0aff-76fc-4210-a825-9a17410660a3}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\codecs\mod_silk\mod_silk.2010.vcxproj"> + <Name>mod_silk</Name> + <Project>{afa983d6-4569-4f88-ba94-555ed00fd9a8}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\codecs\mod_siren\mod_siren.2010.vcxproj"> + <Name>mod_siren</Name> + <Project>{0b6c905b-142e-4999-b39d-92ff7951e921}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\codecs\mod_speex\mod_speex.2010.vcxproj"> + <Name>mod_speex</Name> + <Project>{5580d60e-0f77-4716-9cd4-b8e5986fa375}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\dialplans\mod_dialplan_directory\mod_dialplan_directory.2010.vcxproj"> + <Name>mod_dialplan_directory</Name> + <Project>{a27cca23-1541-4337-81a4-f0a6413078a0}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\dialplans\mod_dialplan_xml\mod_dialplan_xml.2010.vcxproj"> + <Name>mod_dialplan_xml</Name> + <Project>{07113b25-d3af-4e04-ba77-4cd1171f022c}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\endpoints\mod_loopback\mod_loopback.2010.vcxproj"> + <Name>mod_loopback</Name> + <Project>{b3f424ec-3d8f-417c-b244-3919d5e1a577}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\endpoints\mod_portaudio\mod_PortAudio.2010.vcxproj"> + <Name>mod_PortAudio</Name> + <Project>{5fd31a25-5d83-4794-8bee-904dad84ce71}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\endpoints\mod_sofia\mod_sofia.2010.vcxproj"> + <Name>mod_sofia</Name> + <Project>{0df3abd0-ddc0-4265-b778-07c66780979b}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\event_handlers\mod_event_multicast\mod_event_multicast.2010.vcxproj"> + <Name>mod_event_multicast</Name> + <Project>{784113ef-44d9-4949-835d-7065d3c7ad08}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\event_handlers\mod_event_socket\mod_event_socket.2010.vcxproj"> + <Name>mod_event_socket</Name> + <Project>{05515420-16de-4e63-be73-85be85ba5142}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\formats\mod_file_string\mod_file_string.2010.vcxproj"> + <Name>mod_file_string</Name> + <Project>{70564d74-199a-4452-9c60-19ed5f242f0d}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\formats\mod_local_stream\mod_local_stream.2010.vcxproj"> + <Name>mod_local_stream</Name> + <Project>{2ca40887-1622-46a1-a7f9-17fd7e7e545b}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\formats\mod_native_file\mod_native_file.2010.vcxproj"> + <Name>mod_native_file</Name> + <Project>{9254c4b0-6f60-42b6-bb3a-36d63fc001c7}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\formats\mod_sndfile\mod_sndfile.2010.vcxproj"> + <Name>mod_sndfile</Name> + <Project>{afac0568-7548-42d5-9f6a-8d3400a1e4f6}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\formats\mod_tone_stream\mod_tone_stream.2010.vcxproj"> + <Name>mod_tone_stream</Name> + <Project>{6ff941ac-82c5-429f-aa4c-ad2fb9e5da52}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\languages\mod_lua\lua\lua.2010.vcxproj"> + <Name>lua51</Name> + <Project>{d0b36172-cd76-454a-9b89-990025266c2a}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>INSTALLLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\languages\mod_lua\mod_lua.2010.vcxproj"> + <Name>mod_lua</Name> + <Project>{7b077e7f-1be7-4291-ab86-55e527b25cac}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\languages\mod_managed\mod_managed.2010.vcxproj"> + <Name>mod_managed</Name> + <Project>{7b42bda1-72c0-4378-a9b6-5c530f8cd61e}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\loggers\mod_console\mod_console.2010.vcxproj"> + <Name>mod_console</Name> + <Project>{1c453396-d912-4213-89fd-9b489162b7b5}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\loggers\mod_logfile\mod_logfile.2010.vcxproj"> + <Name>mod_logfile</Name> + <Project>{d0bcac02-d94b-46b8-9b49-cddcc2bd7909}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\say\mod_say_de\mod_say_de.2010.vcxproj"> + <Name>mod_say_de</Name> + <Project>{5bc072db-3826-48ea-af34-fe32aa01e83b}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\say\mod_say_en\mod_say_en.2010.vcxproj"> + <Name>mod_say_en</Name> + <Project>{988cacf7-3fcb-4992-be69-77872ae67dc8}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\say\mod_say_es\mod_say_es.2010.vcxproj"> + <Name>mod_say_es</Name> + <Project>{fa429e98-8b03-45e6-a096-a4bc5e821de4}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\say\mod_say_fr\mod_say_fr.2010.vcxproj"> + <Name>mod_say_fr</Name> + <Project>{06e3a538-ab32-44f2-b477-755ff9cb5d37}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\say\mod_say_it\mod_say_it.2010.vcxproj"> + <Name>mod_say_it</Name> + <Project>{6d1bec70-4dcd-4fe9-adbd-4a43a67e4d05}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\say\mod_say_nl\mod_say_nl.2010.vcxproj"> + <Name>mod_say_nl</Name> + <Project>{a4b122cf-5196-476b-8c0e-d8bd59ac3c14}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\say\mod_say_ru\mod_say_ru.2010.vcxproj"> + <Name>mod_say_ru</Name> + <Project>{0382e8fd-cfdc-41c0-8b03-792c7c84fc31}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\say\mod_say_zh\mod_say_zh.2010.vcxproj"> + <Name>mod_say_zh</Name> + <Project>{b6a9fb7a-1cc4-442b-812d-ec33e4e4a36e}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\xml_int\mod_xml_cdr\mod_xml_cdr.2010.vcxproj"> + <Name>mod_xml_cdr</Name> + <Project>{08dad348-9e0a-4a2e-97f1-f1e7e24a7836}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\xml_int\mod_xml_curl\mod_xml_curl.2010.vcxproj"> + <Name>mod_xml_curl</Name> + <Project>{ab91a099-7690-4ecf-8994-e458f4ea1ed4}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\src\mod\xml_int\mod_xml_rpc\mod_xml_rpc.2010.vcxproj"> + <Name>mod_xml_rpc</Name> + <Project>{cbec7225-0c21-4da8-978e-1f158f8ad950}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>MODLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\w32\Console\FreeSwitchConsole.2010.vcxproj"> + <Name>FreeSwitchConsole</Name> + <Project>{1af3a893-f7be-43dd-b697-8ab2397c0d67}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>INSTALLLOCATION</RefTargetDir> + </ProjectReference> + <ProjectReference Include="..\w32\Library\FreeSwitchCore.2010.vcxproj"> + <Name>FreeSwitchCoreLib</Name> + <Project>{202d7a4e-760d-4d0e-afa1-d7459ced30ff}</Project> + <Private>True</Private> + <DoNotHarvest> + </DoNotHarvest> + <RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups> + <RefTargetDir>INSTALLLOCATION</RefTargetDir> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <WixExtension Include="WixUIExtension"> + <HintPath>$(WixExtDir)\WixUIExtension.dll</HintPath> + <Name>WixUIExtension</Name> + </WixExtension> + </ItemGroup> + <ItemGroup> + <Folder Include="Fragments" /> + </ItemGroup> + <Import Project="$(WixTargetsPath)" /> + <PropertyGroup> + <PreBuildEvent>"$(WIX)bin\heat.exe" dir "..\..\..\..\conf" -cg FreeSWITCHConfFiles -gg -scom -sreg -sfrag -srd -dr CONFLOCATION -var var.FreeSWITCHConfFilesDir -out "$(ProjectDir)Fragments\FreeSWITCHConfFiles.wxs" +"$(WIX)bin\heat.exe" dir "..\..\..\..\Win32\Release\sounds" -cg FreeSWITCHSoundFiles8 -gg -scom -sreg -sfrag -srd -dr SOUNDLOCATION -var var.FreeSWITCHSoundFilesDir -out "$(ProjectDir)Fragments\FreeSWITCHSoundFiles8.wxs"</PreBuildEvent> + </PropertyGroup> + <!-- + To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Wix.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> +</Project> \ No newline at end of file commit b9a8bcd5c3d2fa0be826cac19c24d4a13a9bb0bc Author: Mathieu Rene <mrene@avgs.ca> Date: Tue Oct 12 14:31:28 2010 -0400 fs_encode: add bitrate argument diff --git a/src/fs_encode.c b/src/fs_encode.c index 0f5b034..abfd23f 100644 --- a/src/fs_encode.c +++ b/src/fs_encode.c @@ -67,6 +67,7 @@ int main(int argc, char *argv[]) char buf[1024]; switch_size_t len = sizeof(buf)/2; switch_memory_pool_t *pool; + int bitrate = 0; for (i = 1; i < argc; i++) { if (argv[i][0] == '-') { @@ -90,6 +91,9 @@ int main(int argc, char *argv[]) case 'r': rate = atoi(argv[++i]); break; + case 'b': + bitrate = atoi(argv[++i]); + break; case 'v': verbose = SWITCH_TRUE; break; @@ -116,7 +120,6 @@ int main(int argc, char *argv[]) if (switch_core_init(SCF_MINIMAL, verbose, &err) != SWITCH_STATUS_SUCCESS) { printf("Cannot init core [%s]\n", err); - r = 1; goto end; } @@ -125,20 +128,17 @@ int main(int argc, char *argv[]) for (i = 0; i < extra_modules_count; i++) { if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) extra_modules[i], SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) { printf("Cannot init %s [%s]\n", extra_modules[i], err); - r = 1; goto end; } } if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) "mod_sndfile", SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) { printf("Cannot init mod_sndfile [%s]\n", err); - r = 1; goto end; } if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) "mod_native_file", SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) { printf("Cannot init mod_native_file [%s]\n", err); - r = 1; goto end; } @@ -148,7 +148,6 @@ int main(int argc, char *argv[]) } if (switch_core_file_open(&fh_input, input, channels, rate, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) { fprintf(stderr, "Couldn't open %s\n", input); - r = 1; goto end; } @@ -158,7 +157,6 @@ int main(int argc, char *argv[]) } if (switch_core_file_open(&fh_output, output, channels, rate, SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_NATIVE, NULL) != SWITCH_STATUS_SUCCESS) { fprintf(stderr, "Couldn't open %s\n", output); - r = 1; goto end; } @@ -167,7 +165,7 @@ int main(int argc, char *argv[]) goto end; } - if (switch_core_codec_init(&codec, format, fmtp, rate, ptime, channels, SWITCH_CODEC_FLAG_ENCODE, NULL, pool) != SWITCH_STATUS_SUCCESS) { + if (switch_core_codec_init_with_bitrate(&codec, format, fmtp, rate, ptime, channels, bitrate, SWITCH_CODEC_FLAG_ENCODE, NULL, pool) != SWITCH_STATUS_SUCCESS) { fprintf(stderr, "Couldn't initialize codec for %s@%dh@%di\n", format, rate, ptime); goto end; } @@ -213,10 +211,11 @@ usage: printf("Usage: %s [options] input output\n\n", argv[0]); printf("The output must end in the format, eg: myfile.SPEEX\n"); printf("\t\t -l module[,module]\t Load additional modules (coma-separated)\n"); - printf("\t\t -f format\t fmtp to pass to the codec\n"); - printf("\t\t -p ptime\t ptime to use while encoding\n"); - printf("\t\t -r rate\t sampling rate\n"); - printf("\t\t -v\t verbose\n"); + printf("\t\t -f format\t\t fmtp to pass to the codec\n"); + printf("\t\t -p ptime\t\t ptime to use while encoding\n"); + printf("\t\t -r rate\t\t sampling rate\n"); + printf("\t\t -b bitrate\t\t codec bitrate (if supported)\n"); + printf("\t\t -v\t\t\t verbose\n"); return 1; } commit c25476b5687402312533d40f546775bd2919de8a Author: Mathieu Rene <mrene@avgs.ca> Date: Tue Oct 12 14:23:55 2010 -0400 fs_encode: check for file.file_interface before closing diff --git a/src/fs_encode.c b/src/fs_encode.c index 03468e8..0f5b034 100644 --- a/src/fs_encode.c +++ b/src/fs_encode.c @@ -195,8 +195,14 @@ int main(int argc, char *argv[]) r = 0; end: - switch_core_file_close(&fh_input); - switch_core_file_close(&fh_output); + + if (fh_input.file_interface) { + switch_core_file_close(&fh_input); + } + + if (fh_output.file_interface) { + switch_core_file_close(&fh_output); + } if (pool) { switch_core_destroy_memory_pool(&pool); commit 19e86f7c24ca3c302e261f3f683f8f98d9bf3d9a Author: Mathieu Rene <mrene@avgs.ca> Date: Tue Oct 12 14:21:08 2010 -0400 fix Makefile.am typo in last commit diff --git a/Makefile.am b/Makefile.am index be6440d..944511d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -282,11 +282,11 @@ fs_cli_LDADD = libs/libedit/src/.libs/libedit.a endif ## -## fs_encode +## fs_encode () ## fs_encode_SOURCES = src/fs_encode.c fs_encode_CFLAGS = $(AM_CFLAGS) -fs_encode_lDFlAGS = $(AM_LDFLAGS) $(CORE_LIBS) +fs_encode_LDFLAGS = $(AM_LDFLAGS) $(CORE_LIBS) fs_encode_LDADD = libfreeswitch.la ## commit 89b1760159ab644277baf14068032ba6f57d7c01 Author: Mathieu Rene <mrene@avgs.ca> Date: Tue Oct 12 12:35:44 2010 -0400 Add fs_encode tool diff --git a/Makefile.am b/Makefile.am index b11e3ff..be6440d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -267,7 +267,7 @@ src/include/switch_swigable_cpp.h: $(switch_srcdir)/src/include/switch_cpp.h ## ## Applications ## -bin_PROGRAMS = freeswitch fs_cli fs_ivrd tone2wav +bin_PROGRAMS = freeswitch fs_cli fs_ivrd tone2wav fs_encode ## ## fs_cli () @@ -282,6 +282,14 @@ fs_cli_LDADD = libs/libedit/src/.libs/libedit.a endif ## +## fs_encode +## +fs_encode_SOURCES = src/fs_encode.c +fs_encode_CFLAGS = $(AM_CFLAGS) +fs_encode_lDFlAGS = $(AM_LDFLAGS) $(CORE_LIBS) +fs_encode_LDADD = libfreeswitch.la + +## ## tone2wav () ## tone2wav_SOURCES = src/tone2wav.c diff --git a/src/fs_encode.c b/src/fs_encode.c new file mode 100644 index 0000000..03468e8 --- /dev/null +++ b/src/fs_encode.c @@ -0,0 +1,226 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (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.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * + * The Initial Developer of the Original Code is + * Anthony Minessale II <anthm@freeswitch.org> + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Mathieu Rene <mrene@avgs.ca> + * + * fs_encode.c -- Encode a native file + * + */ + +#ifndef _XOPEN_SOURCE +#define _XOPEN_SOURCE 600 +#endif + +#ifndef WIN32 +#ifdef HAVE_SETRLIMIT +#include <sys/resource.h> +#endif +#endif + +#include <switch.h> +#include <switch_version.h> + + +/* Picky compiler */ +#ifdef __ICC +#pragma warning (disable:167) +#endif + +int main(int argc, char *argv[]) +{ + int r = 1; + switch_bool_t verbose = SWITCH_FALSE; + const char *err = NULL; + int i; + char *extra_modules[100] = { 0 }; + int extra_modules_count = 0; + int cmd_fail = 0; + const char *fmtp = ""; + int ptime = 20; + const char *input, *output, *format = NULL; + int channels = 1; + int rate = 8000; + switch_file_handle_t fh_input = { 0 }, fh_output = { 0 }; + switch_codec_t codec = { 0 }; + char buf[1024]; + switch_size_t len = sizeof(buf)/2; + switch_memory_pool_t *pool; + + for (i = 1; i < argc; i++) { + if (argv[i][0] == '-') { + switch(argv[i][1]) { + case 'l': + i++; + /* Load extra modules */ + if (strchr(argv[i], ',')) { + extra_modules_count = switch_split(argv[i], ',', extra_modules); + } else { + extra_modules_count = 1; + extra_modules[0] = argv[i]; + } + break; + case 'f': + fmtp = argv[++i]; + break; + case 'p': + ptime = atoi(argv[++i]); + break; + case 'r': + rate = atoi(argv[++i]); + break; + case 'v': + verbose = SWITCH_TRUE; + break; + default: + printf("Command line option not recognized: %s\n", argv[i]); + cmd_fail = 1; + } + } else { + break; + } + } + + if (argc - i < 2 || cmd_fail) { + goto usage; + } + + input = argv[i++]; + output = argv[i++]; + if (zstr(input) || zstr(output) || !(format = strchr(output, '.'))) { + goto usage; + } + + format++; + + if (switch_core_init(SCF_MINIMAL, verbose, &err) != SWITCH_STATUS_SUCCESS) { + printf("Cannot init core [%s]\n", err); + r = 1; + goto end; + } + + switch_loadable_module_init(SWITCH_FALSE); + + for (i = 0; i < extra_modules_count; i++) { + if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) extra_modules[i], SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) { + printf("Cannot init %s [%s]\n", extra_modules[i], err); + r = 1; + goto end; + } + } + + if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) "mod_sndfile", SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) { + printf("Cannot init mod_sndfile [%s]\n", err); + r = 1; + goto end; + } + + if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) "mod_native_file", SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) { + printf("Cannot init mod_native_file [%s]\n", err); + r = 1; + goto end; + } + + switch_core_new_memory_pool(&pool); + if (verbose) { + fprintf(stderr, "Opening file %s\n", input); + } + if (switch_core_file_open(&fh_input, input, channels, rate, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) { + fprintf(stderr, "Couldn't open %s\n", input); + r = 1; + goto end; + } + + + if (verbose) { + fprintf(stderr, "Opening file %s\n", output); + } + if (switch_core_file_open(&fh_output, output, channels, rate, SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_NATIVE, NULL) != SWITCH_STATUS_SUCCESS) { + fprintf(stderr, "Couldn't open %s\n", output); + r = 1; + goto end; + } + + if (switch_test_flag(&fh_input, SWITCH_FILE_NATIVE)) { + fprintf(stderr, "Input as native file is not implemented\n"); + goto end; + } + + if (switch_core_codec_init(&codec, format, fmtp, rate, ptime, channels, SWITCH_CODEC_FLAG_ENCODE, NULL, pool) != SWITCH_STATUS_SUCCESS) { + fprintf(stderr, "Couldn't initialize codec for %s@%dh@%di\n", format, rate, ptime); + goto end; + } + + while (switch_core_file_read(&fh_input, buf, &len) == SWITCH_STATUS_SUCCESS) { + char encode_buf[1024]; + uint32_t encoded_len = sizeof(buf); + uint32_t encoded_rate = rate; + unsigned int flags = 0; + + if (switch_core_codec_encode(&codec, NULL, buf, len*2, rate, encode_buf, &encoded_len, &encoded_rate, &flags) != SWITCH_STATUS_SUCCESS) { + fprintf(stderr, "Codec encoder error\n"); + goto end; + } + + len = encoded_len; + if (switch_core_file_write(&fh_output, encode_buf, &len) != SWITCH_STATUS_SUCCESS) { + fprintf(stderr, "Write error\n"); + goto end; + } + + len = sizeof(buf)/2; + } + + r = 0; + +end: + switch_core_file_close(&fh_input); + switch_core_file_close(&fh_output); + + if (pool) { + switch_core_destroy_memory_pool(&pool); + } + switch_core_destroy(); + return r; +usage: + printf("Usage: %s [options] input output\n\n", argv[0]); + printf("The output must end in the format, eg: myfile.SPEEX\n"); + printf("\t\t -l module[,module]\t Load additional modules (coma-separated)\n"); + printf("\t\t -f format\t fmtp to pass to the codec\n"); + printf("\t\t -p ptime\t ptime to use while encoding\n"); + printf("\t\t -r rate\t sampling rate\n"); + printf("\t\t -v\t verbose\n"); + return 1; +} + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4: + */ diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 7e08f71..5645ea5 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -1270,11 +1270,11 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init(switch_bool_t autolo switch_core_hash_init_nocase(&loadable_modules.dialplan_hash, loadable_modules.pool); switch_mutex_init(&loadable_modules.mutex, SWITCH_MUTEX_NESTED, loadable_modules.pool); - if (!autoload) return SWITCH_STATUS_SUCCESS; - switch_loadable_module_load_module("", "CORE_SOFTTIMER_MODULE", SWITCH_FALSE, &err); switch_loadable_module_load_module("", "CORE_PCM_MODULE", SWITCH_FALSE, &err); + if (!autoload) return SWITCH_STATUS_SUCCESS; + if ((xml = switch_xml_open_cfg(cf, &cfg, NULL))) { switch_xml_t mods, ld; if ((mods = switch_xml_child(cfg, "modules"))) { commit c1d41dd989539b8dfdaa19aaf21adf73eaf8b15a Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Oct 12 12:28:04 2010 -0500 only pause recording media bugs in fifo diff --git a/src/include/switch_types.h b/src/include/switch_types.h index b1fc627..d027549 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1266,7 +1266,8 @@ typedef enum { SMBF_STEREO = (1 << 5), SMBF_ANSWER_REQ = (1 << 6), SMBF_THREAD_LOCK = (1 << 7), - SMBF_PRUNE = (1 << 8) + SMBF_PRUNE = (1 << 8), + SMBF_NO_PAUSE = (1 << 9) } switch_media_bug_flag_enum_t; typedef uint32_t switch_media_bug_flag_t; diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c index aa7d05c..0059241 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c @@ -140,7 +140,7 @@ switch_status_t spandsp_inband_dtmf_session(switch_core_session_t *session) } if ((status = switch_core_media_bug_add(session, "spandsp_dtmf_detect", NULL, - inband_dtmf_callback, pvt, 0, SMBF_READ_REPLACE, &bug)) != SWITCH_STATUS_SUCCESS) { + inband_dtmf_callback, pvt, 0, SMBF_READ_REPLACE | SMBF_NO_PAUSE, &bug)) != SWITCH_STATUS_SUCCESS) { return status; } diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 4e6d2fc..7e63e88 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -367,13 +367,17 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi } } - if (session->bugs && !switch_channel_test_flag(session->channel, CF_PAUSE_BUGS)) { + if (session->bugs) { switch_media_bug_t *bp; switch_bool_t ok = SWITCH_TRUE; int prune = 0; switch_thread_rwlock_rdlock(session->bug_rwlock); for (bp = session->bugs; bp; bp = bp->next) { + if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) { + continue; + } + if (!switch_channel_test_flag(session->channel, CF_ANSWERED) && switch_core_media_bug_test_flag(bp, SMBF_ANSWER_REQ)) { continue; } @@ -528,12 +532,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi if (flag & SFF_CNG) { switch_set_flag((*frame), SFF_CNG); } - if (session->bugs && !switch_channel_test_flag(session->channel, CF_PAUSE_BUGS)) { + if (session->bugs) { switch_media_bug_t *bp; switch_bool_t ok = SWITCH_TRUE; int prune = 0; switch_thread_rwlock_rdlock(session->bug_rwlock); for (bp = session->bugs; bp; bp = bp->next) { + if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) { + continue; + } + if (!switch_channel_test_flag(session->channel, CF_ANSWERED) && switch_core_media_bug_test_flag(bp, SMBF_ANSWER_REQ)) { continue; } @@ -814,7 +822,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess - if (session->bugs && !switch_channel_test_flag(session->channel, CF_PAUSE_BUGS)) { + if (session->bugs) { switch_media_bug_t *bp; int prune = 0; @@ -825,6 +833,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess continue; } + if (switch_channel_test_flag(session->channel, CF_PAUSE_BUGS) && !switch_core_media_bug_test_flag(bp, SMBF_NO_PAUSE)) { + continue; + } + if (!switch_channel_test_flag(session->channel, CF_ANSWERED) && switch_core_media_bug_test_flag(bp, SMBF_ANSWER_REQ)) { continue; } diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 9bfa27e..7cda473 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -827,10 +827,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_displace_session(switch_core_session_ if (flags && strchr(flags, 'r')) { status = switch_core_media_bug_add(session, "displace", file, - read_displace_callback, dh, to, SMBF_WRITE_REPLACE | SMBF_READ_REPLACE, &bug); + read_displace_callback, dh, to, SMBF_WRITE_REPLACE | SMBF_READ_REPLACE | SMBF_NO_PAUSE, &bug); } else { status = switch_core_media_bug_add(session, "displace", file, - write_displace_callback, dh, to, SMBF_WRITE_REPLACE | SMBF_READ_REPLACE, &bug); + write_displace_callback, dh, to, SMBF_WRITE_REPLACE | SMBF_READ_REPLACE | SMBF_NO_PAUSE, &bug); } if (status != SWITCH_STATUS_SUCCESS) { @@ -1166,7 +1166,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session if (switch_core_media_bug_add(tsession, "eavesdrop", uuid, eavesdrop_callback, ep, 0, - SMBF_READ_STREAM | SMBF_WRITE_STREAM | SMBF_READ_REPLACE | SMBF_WRITE_REPLACE | SMBF_READ_PING | SMBF_THREAD_LOCK, + SMBF_READ_STREAM | SMBF_WRITE_STREAM | SMBF_READ_REPLACE | SMBF_WRITE_REPLACE | + SMBF_READ_PING | SMBF_THREAD_LOCK | SMBF_NO_PAUSE, &bug) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot attach bug\n"); goto end; @@ -1622,7 +1623,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_preprocess_session(switch_core_sessio switch_media_bug_t *bug; switch_status_t status; time_t to = 0; - switch_media_bug_flag_t flags = 0; + switch_media_bug_flag_t flags = SMBF_NO_PAUSE; switch_codec_implementation_t read_impl = { 0 }; pp_cb_t *cb; int update = 0; @@ -1885,7 +1886,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_audio(switch_core_session_t * switch_status_t status; switch_session_audio_t *pvt; switch_codec_implementation_t read_impl = { 0 }; - int existing = 0, c_read = 0, c_write = 0, flags = 0; + int existing = 0, c_read = 0, c_write = 0, flags = SMBF_NO_PAUSE; if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) { return SWITCH_STATUS_FALSE; @@ -2035,7 +2036,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_inband_dtmf_session(switch_core_sessi } if ((status = switch_core_media_bug_add(session, "inband_dtmf", NULL, - inband_dtmf_callback, pvt, 0, SMBF_READ_REPLACE, &bug)) != SWITCH_STATUS_SUCCESS) { + inband_dtmf_callback, pvt, 0, SMBF_READ_REPLACE | SMBF_NO_PAUSE, &bug)) != SWITCH_STATUS_SUCCESS) { return status; } @@ -2236,7 +2237,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_inband_dtmf_generate_session(switch_c if ((status = switch_core_media_bug_add(session, "inband_dtmf_generate", NULL, inband_dtmf_generate_callback, pvt, 0, - pvt->read ? SMBF_READ_REPLACE : SMBF_WRITE_REPLACE, &bug)) != SWITCH_STATUS_SUCCESS) { + SMBF_NO_PAUSE | pvt->read ? SMBF_READ_REPLACE : SMBF_WRITE_REPLACE , &bug)) != SWITCH_STATUS_SUCCESS) { return status; } @@ -2540,6 +2541,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_sessi } } + bflags |= SMBF_NO_PAUSE; + if (cont->bug_running) { status = SWITCH_STATUS_SUCCESS; switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s bug already running\n", switch_channel_get_name(channel)); @@ -3192,7 +3195,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t * } if ((status = switch_core_media_bug_add(session, "detect_speech", key, - speech_callback, sth, 0, SMBF_READ_STREAM, &sth->bug)) != SWITCH_STATUS_SUCCESS) { + speech_callback, sth, 0, SMBF_READ_STREAM | SMBF_NO_PAUSE, &sth->bug)) != SWITCH_STATUS_SUCCESS) { switch_core_asr_close(ah, &flags); return status; } commit 42f534fa6ac5de9e21e54fdd95d12b3d060e537d Author: Brian West <brian@freeswitch.org> Date: Tue Oct 12 11:41:28 2010 -0500 FS-2773 diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 285dc8a..81cd534 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1471,10 +1471,12 @@ void sofia_reg_handle_sip_i_register(nua_t *nua, sofia_profile_t *profile, nua_h } } - if (!is_nat && sip && sip->sip_via && sip->sip_via->v_port && - atoi(sip->sip_via->v_port) == 5060 && network_port != 5060 ) { - is_nat = "via port"; - } + /* FS-2773: This causes issues with Cisco phones. + * if (!is_nat && sip && sip->sip_via && sip->sip_via->v_port && + * atoi(sip->sip_via->v_port) == 5060 && network_port != 5060 ) { + * is_nat = "via port"; + * } + */ if (!is_nat && profile->nat_acl_count) { uint32_t x = 0; commit ef1114dd178e5930ba69841b0f1120787fd0ef60 Merge: 4455d58 14361c0 Author: David Yat Sin <dyatsin@sangoma.com> Date: Tue Oct 12 08:03:04 2010 -0700 Merge branch 'master' of git://git.freeswitch.org/freeswitch commit 14361c09074f43ca87484d87212c5f24055a9769 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Oct 12 09:32:15 2010 -0500 FS-620 diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 7464a42..cb8b257 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1425,9 +1425,12 @@ void sofia_glue_tech_patch_sdp(private_object_t *tech_pvt) } if (tech_pvt->adv_sdp_audio_ip && !strncmp("c=IN IP", p, 7)) { - strncpy(q, p, 9); - p += 9; - q += 9; + strncpy(q, p, 7); + p += 7; + q += 7; + strncpy(q, strchr(tech_pvt->adv_sdp_audio_ip, ':') ? "6 " : "4 ", 2); + p +=2; + q +=2; strncpy(q, tech_pvt->adv_sdp_audio_ip, strlen(tech_pvt->adv_sdp_audio_ip)); q += strlen(tech_pvt->adv_sdp_audio_ip); commit ec9fddacceaf86ebddc32095e458aceb832333db Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Oct 11 18:38:30 2010 -0500 add some more dmachine code for args parsing diff --git a/src/switch_ivr.c b/src/switch_ivr.c index ef360d3..744072c 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -232,7 +232,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session, if you return anything but SWITCH_STATUS_SUCCESS the playback will stop. */ if (switch_channel_has_dtmf(channel)) { - if (!args->input_callback && !args->buf) { + if (!args->input_callback && !args->buf && !args->dmachine) { status = SWITCH_STATUS_BREAK; break; } @@ -271,6 +271,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session, break; } + if (args && args->dmachine) { + if ((status = switch_ivr_dmachine_ping(args->dmachine, NULL)) != SWITCH_STATUS_SUCCESS) { + break; + } + } + if (sval && write_frame.datalen) { switch_generate_sln_silence((int16_t *) write_frame.data, write_frame.samples, sval); switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0); @@ -923,12 +929,21 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_s if (switch_channel_has_dtmf(channel)) { - if (!args->input_callback && !args->buf) { + if (!args->input_callback && !args->buf && !args->dmachine) { status = SWITCH_STATUS_BREAK; break; } switch_channel_dequeue_dtmf(channel, &dtmf); - status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen); + + if (args->dmachine) { + char ds[2] = {dtmf.digit, '\0'}; + if ((status = switch_ivr_dmachine_feed(args->dmachine, ds, NULL)) != SWITCH_STATUS_SUCCESS) { + break; + } + } else if (args->input_callback) { + status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen); + } + if (digit_timeout) { digit_started = switch_micro_time_now(); } diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index fd2f1a9..c99745d 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -842,7 +842,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *sessi if you return anything but SWITCH_STATUS_SUCCESS the playback will stop. */ if (switch_channel_has_dtmf(channel)) { - if (!args->input_callback && !args->buf) { + if (!args->input_callback && !args->buf && !args->dmachine) { status = SWITCH_STATUS_BREAK; done = 1; break; @@ -1253,7 +1253,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess if you return anything but SWITCH_STATUS_SUCCESS the playback will stop. */ if (switch_channel_has_dtmf(channel)) { - if (!args->input_callback && !args->buf) { + if (!args->input_callback && !args->buf && !args->dmachine) { status = SWITCH_STATUS_BREAK; done = 1; break; @@ -1959,7 +1959,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session * if you return anything but SWITCH_STATUS_SUCCESS the playback will stop. */ if (switch_channel_has_dtmf(channel)) { - if (!args->input_callback && !args->buf) { + if (!args->input_callback && !args->buf && !args->dmachine) { status = SWITCH_STATUS_BREAK; done = 1; break; commit 20d17baae2cf9cbe39b60d3b4942f9433139c919 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Oct 11 16:36:04 2010 -0500 set idle pattern to 255 instead of 0 to prevent clipping sound on short frames from mod_native_file FS-2772 diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index c5b7a61..fd2f1a9 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -1292,7 +1292,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess if (framelen > FILE_STARTSAMPLES) { framelen = FILE_STARTSAMPLES; } - memset(abuf, 0, framelen); + memset(abuf, 255, framelen); olen = ilen; do_speed = 0; } else if (fh->sp_audio_buffer && (eof || (switch_buffer_inuse(fh->sp_audio_buffer) > (switch_size_t) (framelen)))) { @@ -1305,7 +1305,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess } if (bread < framelen) { - memset(abuf + bread, 0, framelen - bread); + memset(abuf + bread, 255, framelen - bread); } olen = asis ? framelen : ilen; @@ -1320,7 +1320,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess } if (bread < framelen) { - memset(abuf + bread, 0, framelen - bread); + memset(abuf + bread, 255, framelen - bread); } olen = asis ? framelen : ilen; @@ -1408,10 +1408,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess last_speed = fh->speed; continue; } - + if (olen < llen) { uint8_t *dp = (uint8_t *) write_frame.data; - memset(dp + (int) olen, 0, (int) (llen - olen)); + memset(dp + (int) olen, 255, (int) (llen - olen)); olen = llen; } @@ -1476,7 +1476,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess } #endif #endif - if (fh->vol) { + if (!asis && fh->vol) { switch_change_sln_volume(write_frame.data, write_frame.datalen / 2, fh->vol); } commit c0fddf054c2c7fe0bb077293808f2046521ee305 Author: Mathieu Rene <mrene@avgs.ca> Date: Mon Oct 11 13:42:58 2010 -0400 runtime/shutdown mixed up diff --git a/src/mod/applications/mod_redis/mod_redis.c b/src/mod/applications/mod_redis/mod_redis.c index 75dfd6f..d20ab93 100755 --- a/src/mod/applications/mod_redis/mod_redis.c +++ b/src/mod/applications/mod_redis/mod_redis.c @@ -34,7 +34,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_redis_load); SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_redis_shutdown); -SWITCH_MODULE_DEFINITION(mod_redis, mod_redis_load, NULL, mod_redis_shutdown); +SWITCH_MODULE_DEFINITION(mod_redis, mod_redis_load, mod_redis_shutdown, NULL); static struct{ char *host; commit 57cd1c98503496b458614e462f51a8b904ccf709 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Oct 11 12:31:50 2010 -0500 fix regression diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index fea8b83..758e5dc 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -2343,8 +2343,8 @@ static switch_status_t deliver_vm(vm_profile_t *profile, char *convert_cmd = profile->convert_cmd; char *convert_ext = profile->convert_ext; int del_file = 0; - char *id = switch_core_session_strdup(session, switch_xml_attr(x_user, "id")); + if (!params) { switch_event_create(&local_event, SWITCH_EVENT_REQUEST_PARAMS); params = local_event; @@ -2646,7 +2646,7 @@ static switch_status_t deliver_vm(vm_profile_t *profile, if ((vm_cc = switch_channel_get_variable(channel, "vm_cc"))) { char *cmd = switch_core_session_sprintf(session, "%s %s %s '%s' %s@%s %s", - vm_cc, file_path, caller_id_number, caller_id_name, id, domain_name, read_flags); + vm_cc, file_path, caller_id_number, caller_id_name, myid, domain_name, read_flags); if (voicemail_inject(cmd, session) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Sent Carbon Copy to %s\n", vm_cc); commit bac79ba18c9e008f0f85b959716ec99599c27dfb Author: Jeff Lenk <jeff@jefflenk.com> Date: Sun Oct 10 13:32:45 2010 -0500 Add mod_distributor to VS2010 - not built by default diff --git a/Freeswitch.2010.sln b/Freeswitch.2010.sln index c865b68..4729745 100644 --- a/Freeswitch.2010.sln +++ b/Freeswitch.2010.sln @@ -703,6 +703,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_directory", "src\mod\ap EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_h323", "src\mod\endpoints\mod_h323\mod_h323.2010.vcxproj", "{05C9FB27-480E-4D53-B3B7-7338E2514666}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_distributor", "src\mod\applications\mod_distributor\mod_distributor.2010.vcxproj", "{5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -2424,6 +2426,13 @@ Global {05C9FB27-480E-4D53-B3B7-7338E2514666}.Debug|x64.ActiveCfg = Debug|x64 {05C9FB27-480E-4D53-B3B7-7338E2514666}.Release|Win32.ActiveCfg = Release|Win32 {05C9FB27-480E-4D53-B3B7-7338E2514666}.Release|x64.ActiveCfg = Release|x64 + {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.All|Win32.ActiveCfg = Release|x64 + {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.All|x64.ActiveCfg = Release|x64 + {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.All|x64.Build.0 = Release|x64 + {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.Debug|Win32.ActiveCfg = Debug|Win32 + {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.Debug|x64.ActiveCfg = Debug|x64 + {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.Release|Win32.ActiveCfg = Release|Win32 + {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}.Release|x64.ActiveCfg = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2470,6 +2479,7 @@ Global {1E21AFE0-6FDB-41D2-942D-863607C24B91} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {2E250296-0C08-4342-9C8A-BCBDD0E7DF65} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {B889A18E-70A7-44B5-B2C9-47798D4F43B3} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} + {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {07113B25-D3AF-4E04-BA77-4CD1171F022C} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4} {A27CCA23-1541-4337-81A4-F0A6413078A0} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4} {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4} diff --git a/src/mod/applications/mod_distributor/mod_distributor.2010.vcxproj b/src/mod/applications/mod_distributor/mod_distributor.2010.vcxproj new file mode 100644 index 0000000..368cfa1 --- /dev/null +++ b/src/mod/applications/mod_distributor/mod_distributor.2010.vcxproj @@ -0,0 +1,130 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>mod_distributor</ProjectName> + <ProjectGuid>{5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F}</ProjectGuid> + <RootNamespace>mod_distributor</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\..\w32\module_release.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\..\w32\module_debug.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\..\w32\module_release.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\..\w32\module_debug.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + </ClCompile> + <Link> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + </ClCompile> + <Link> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + </ClCompile> + <Link> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + </ClCompile> + <Link> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="mod_distributor.c" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\..\w32\Library\FreeSwitchCore.2010.vcxproj"> + <Project>{202d7a4e-760d-4d0e-afa1-d7459ced30ff}</Project> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file commit 4b6ef3021831b98dcd2cb1905b17dc876cf94da4 Author: Jeff Lenk <jeff@jefflenk.com> Date: Sun Oct 10 11:23:43 2010 -0500 Move FreeSWITCH.Managed to correct location diff --git a/Freeswitch.2008.sln b/Freeswitch.2008.sln index 27c94a2..8e6df5c 100644 --- a/Freeswitch.2008.sln +++ b/Freeswitch.2008.sln @@ -2213,10 +2213,12 @@ Global {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.All|x64.ActiveCfg = Release|Any CPU {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|Win32.ActiveCfg = Debug|Any CPU {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|Win32.Build.0 = Debug|Any CPU - {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x64.ActiveCfg = Debug|Any CPU + {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x64.ActiveCfg = Debug|x64 + {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x64.Build.0 = Debug|x64 {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|Win32.ActiveCfg = Release|Any CPU {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|Win32.Build.0 = Release|Any CPU - {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x64.ActiveCfg = Release|Any CPU + {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x64.ActiveCfg = Release|x64 + {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x64.Build.0 = Release|x64 {E796E337-DE78-4303-8614-9A590862EE95}.All|Win32.ActiveCfg = Release|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.All|Win32.Build.0 = Release|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.All|x64.ActiveCfg = Release|Win32 diff --git a/src/mod/languages/mod_managed/managed/FreeSWITCH.Managed.csproj b/src/mod/languages/mod_managed/managed/FreeSWITCH.Managed.csproj index 7875d8e..9b8f827 100644 --- a/src/mod/languages/mod_managed/managed/FreeSWITCH.Managed.csproj +++ b/src/mod/languages/mod_managed/managed/FreeSWITCH.Managed.csproj @@ -19,7 +19,7 @@ <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> - <OutputPath>..\..\..\..\..\managed\debug\</OutputPath> + <OutputPath>..\..\..\..\..\Debug\mod\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> @@ -27,11 +27,27 @@ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> - <OutputPath>..\..\..\..\..\managed\release\</OutputPath> + <OutputPath>..\..\..\..\..\Release\mod\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' "> + <DebugSymbols>true</DebugSymbols> + <OutputPath>..\..\..\..\..\x64\Debug\mod\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <DebugType>full</DebugType> + <PlatformTarget>x64</PlatformTarget> + <ErrorReport>prompt</ErrorReport> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' "> + <OutputPath>..\..\..\..\..\x64\Release\mod\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <Optimize>true</Optimize> + <DebugType>pdbonly</DebugType> + <PlatformTarget>x64</PlatformTarget> + <ErrorReport>prompt</ErrorReport> + </PropertyGroup> <ItemGroup> <Reference Include="System" /> <Reference Include="System.Core"> commit 5b2664c0a9bc1d43a0b4bf808ce492a90deabec5 Author: Jeff Lenk <jeff@jefflenk.com> Date: Sat Oct 9 22:19:22 2010 -0500 tweak swig script for mod_managed diff --git a/src/mod/languages/mod_managed/runswig.2010.cmd b/src/mod/languages/mod_managed/runswig.2010.cmd new file mode 100644 index 0000000..288c420 --- /dev/null +++ b/src/mod/languages/mod_managed/runswig.2010.cmd @@ -0,0 +1,10 @@ +move freeswitch_wrap.cxx freeswitch_wrap.bak +\dev\swig20\swig.exe -I..\..\..\include -v -O -c++ -csharp -namespace FreeSWITCH.Native -dllimport mod_managed -DSWIG_CSHARP_NO_STRING_HELPER freeswitch.i +del swig.csx +move freeswitch_wrap.cxx freeswitch_wrap.2010.cxx +move freeswitch_wrap.bak freeswitch_wrap.cxx +@ECHO OFF +for %%X in (*.cs) do type %%X >> swig.csx +@ECHO ON +move swig.csx managed\swig.2010.cs +del *.cs diff --git a/src/mod/languages/mod_managed/runswig.cmd b/src/mod/languages/mod_managed/runswig.cmd index 9b1a659..631a507 100644 --- a/src/mod/languages/mod_managed/runswig.cmd +++ b/src/mod/languages/mod_managed/runswig.cmd @@ -1,4 +1,4 @@ -\dev\swig\swig.exe -I..\..\..\include -v -O -c++ -csharp -namespace FreeSWITCH.Native -dllimport mod_managed -DSWIG_CSHARP_NO_STRING_HELPER freeswitch.i +\dev\swig135\swig.exe -I..\..\..\include -v -O -c++ -csharp -namespace FreeSWITCH.Native -dllimport mod_managed -DSWIG_CSHARP_NO_STRING_HELPER freeswitch.i del swig.csx @ECHO OFF for %%X in (*.cs) do type %%X >> swig.csx commit a82d424fbf320556a15923afb5059bcc5613ddf5 Author: Anthony Minessale <anthm@freeswitch.org> Date: Sat Oct 9 09:00:23 2010 -0500 swigall diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index ad4d63d..82ad8ab 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -1820,6 +1820,29 @@ SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_dtmf_t_duration_get(void * ja } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_dtmf_t_flags_set(void * jarg1, int jarg2) { + switch_dtmf_t *arg1 = (switch_dtmf_t *) 0 ; + int32_t arg2 ; + + arg1 = (switch_dtmf_t *)jarg1; + arg2 = (int32_t)jarg2; + if (arg1) (arg1)->flags = arg2; + +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_dtmf_t_flags_get(void * jarg1) { + int jresult ; + switch_dtmf_t *arg1 = (switch_dtmf_t *) 0 ; + int32_t result; + + arg1 = (switch_dtmf_t *)jarg1; + result = (int32_t) ((arg1)->flags); + jresult = result; + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_dtmf_t() { void * jresult ; switch_dtmf_t *result = 0 ; @@ -4075,6 +4098,17 @@ SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_console_callback_match(void * j } +SWIGEXPORT int SWIGSTDCALL CSharp_DMACHINE_MAX_DIGIT_LEN_get() { + int jresult ; + int result; + + result = (int) 512; + + jresult = result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_match_dmachine_set(void * jarg1, void * jarg2) { switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; switch_ivr_dmachine_t *arg2 = (switch_ivr_dmachine_t *) 0 ; @@ -4150,6 +4184,29 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_match_match_key_get(void * } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_match_type_set(void * jarg1, int jarg2) { + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + dm_match_type_t arg2 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + arg2 = (dm_match_type_t)jarg2; + if (arg1) (arg1)->type = arg2; + +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_match_type_get(void * jarg1) { + int jresult ; + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + dm_match_type_t result; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + result = (dm_match_type_t) ((arg1)->type); + jresult = result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_match_user_data_set(void * jarg1, void * jarg2) { switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; void *arg2 = (void *) 0 ; @@ -7273,6 +7330,28 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_soft_unlock(void * jarg1) } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_set_dmachine(void * jarg1, void * jarg2) { + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_ivr_dmachine_t *arg2 = (switch_ivr_dmachine_t *) 0 ; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (switch_ivr_dmachine_t *)jarg2; + switch_core_session_set_dmachine(arg1,arg2); +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_dmachine(void * jarg1) { + void * jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_ivr_dmachine_t *result = 0 ; + + arg1 = (switch_core_session_t *)jarg1; + result = (switch_ivr_dmachine_t *)switch_core_session_get_dmachine(arg1); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_get_uuid() { char * jresult ; char *result = 0 ; @@ -10649,6 +10728,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_in_thread(void * jarg1) { } +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_default_ptime(char * jarg1, unsigned long jarg2) { + unsigned long jresult ; + char *arg1 = (char *) 0 ; + uint32_t arg2 ; + uint32_t result; + + arg1 = (char *)jarg1; + arg2 = (uint32_t)jarg2; + result = (uint32_t)switch_default_ptime((char const *)arg1,arg2); + jresult = (unsigned long)result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_module_name_set(void * jarg1, char * jarg2) { switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; char *arg2 = (char *) 0 ; @@ -12292,20 +12385,6 @@ SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_char_to_rfc2833(char jarg1) { } -SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_default_ptime(char * jarg1, unsigned long jarg2) { - unsigned long jresult ; - char *arg1 = (char *) 0 ; - uint32_t arg2 ; - uint32_t result; - - arg1 = (char *)jarg1; - arg2 = (uint32_t)jarg2; - result = (uint32_t)switch_default_ptime((char const *)arg1,arg2); - jresult = (unsigned long)result; - return jresult; -} - - SWIGEXPORT char * SWIGSTDCALL CSharp_switch_sanitize_number(char * jarg1) { char * jresult ; char *arg1 = (char *) 0 ; @@ -27196,6 +27275,18 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_broadcast(char * jarg1, char * jarg } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_broadcast_in_thread(void * jarg1, char * jarg2, int jarg3) { + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + int arg3 ; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (int)jarg3; + switch_ivr_broadcast_in_thread(arg1,(char const *)arg2,arg3); +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_transfer_variable(void * jarg1, void * jarg2, char * jarg3) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; @@ -27856,19 +27947,27 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_uuid_exists(char * jarg1) { } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_create(void * jarg1, void * jarg2, unsigned long jarg3, unsigned long jarg4) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_create(void * jarg1, char * jarg2, void * jarg3, unsigned long jarg4, unsigned long jarg5, void * jarg6, void * jarg7, void * jarg8) { int jresult ; switch_ivr_dmachine_t **arg1 = (switch_ivr_dmachine_t **) 0 ; - switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ; - uint32_t arg3 ; + char *arg2 = (char *) 0 ; + switch_memory_pool_t *arg3 = (switch_memory_pool_t *) 0 ; uint32_t arg4 ; + uint32_t arg5 ; + switch_ivr_dmachine_callback_t arg6 = (switch_ivr_dmachine_callback_t) 0 ; + switch_ivr_dmachine_callback_t arg7 = (switch_ivr_dmachine_callback_t) 0 ; + void *arg8 = (void *) 0 ; switch_status_t result; arg1 = (switch_ivr_dmachine_t **)jarg1; - arg2 = (switch_memory_pool_t *)jarg2; - arg3 = (uint32_t)jarg3; + arg2 = (char *)jarg2; + arg3 = (switch_memory_pool_t *)jarg3; arg4 = (uint32_t)jarg4; - result = (switch_status_t)switch_ivr_dmachine_create(arg1,arg2,arg3,arg4); + arg5 = (uint32_t)jarg5; + arg6 = (switch_ivr_dmachine_callback_t)jarg6; + arg7 = (switch_ivr_dmachine_callback_t)jarg7; + arg8 = (void *)jarg8; + result = (switch_status_t)switch_ivr_dmachine_create(arg1,(char const *)arg2,arg3,arg4,arg5,arg6,arg7,arg8); jresult = result; return jresult; } @@ -27882,21 +27981,23 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_destroy(void * jarg1) { } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_bind(void * jarg1, char * jarg2, int jarg3, void * jarg4, void * jarg5) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_bind(void * jarg1, char * jarg2, char * jarg3, int jarg4, void * jarg5, void * jarg6) { int jresult ; switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; char *arg2 = (char *) 0 ; - int32_t arg3 ; - switch_ivr_dmachine_callback_t arg4 = (switch_ivr_dmachine_callback_t) 0 ; - void *arg5 = (void *) 0 ; + char *arg3 = (char *) 0 ; + int32_t arg4 ; + switch_ivr_dmachine_callback_t arg5 = (switch_ivr_dmachine_callback_t) 0 ; + void *arg6 = (void *) 0 ; switch_status_t result; arg1 = (switch_ivr_dmachine_t *)jarg1; arg2 = (char *)jarg2; - arg3 = (int32_t)jarg3; - arg4 = (switch_ivr_dmachine_callback_t)jarg4; - arg5 = (void *)jarg5; - result = (switch_status_t)switch_ivr_dmachine_bind(arg1,(char const *)arg2,arg3,arg4,arg5); + arg3 = (char *)jarg3; + arg4 = (int32_t)jarg4; + arg5 = (switch_ivr_dmachine_callback_t)jarg5; + arg6 = (void *)jarg6; + result = (switch_status_t)switch_ivr_dmachine_bind(arg1,(char const *)arg2,(char const *)arg3,arg4,arg5,arg6); jresult = result; return jresult; } @@ -27956,6 +28057,18 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_ivr_dmachine_get_match(void * jarg1) } +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_ivr_dmachine_get_failed_digits(void * jarg1) { + char * jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + char *result = 0 ; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + result = (char *)switch_ivr_dmachine_get_failed_digits(arg1); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_set_digit_timeout_ms(void * jarg1, unsigned long jarg2) { switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; uint32_t arg2 ; @@ -27976,6 +28089,34 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_set_input_timeout_ms(void } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_clear_realm(void * jarg1, char * jarg2) { + int jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (char *)jarg2; + result = (switch_status_t)switch_ivr_dmachine_clear_realm(arg1,(char const *)arg2); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_set_realm(void * jarg1, char * jarg2) { + int jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (char *)jarg2; + result = (switch_status_t)switch_ivr_dmachine_set_realm(arg1,(char const *)arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RTP_MAX_BUF_LEN_get() { int jresult ; int result; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index a1b556b..2beb015 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -436,6 +436,22 @@ public class CoreSession : IDisposable { namespace FreeSWITCH.Native { +public enum dm_match_type_t { + DM_MATCH_POSITIVE, + DM_MATCH_NEGATIVE +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + using System; using System.Runtime.InteropServices; @@ -503,6 +519,21 @@ public class DTMF : IDisposable { namespace FreeSWITCH.Native { +public enum dtmf_flag_t { + DTMF_FLAG_SKIP_PROCESS = (1 << 0) +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + using System; using System.Runtime.InteropServices; @@ -1291,6 +1322,16 @@ public class freeswitch { freeswitchPINVOKE.switch_core_session_soft_unlock(SWIGTYPE_p_switch_core_session.getCPtr(session)); } + public static void switch_core_session_set_dmachine(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_switch_ivr_dmachine dmachine) { + freeswitchPINVOKE.switch_core_session_set_dmachine(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine)); + } + + public static SWIGTYPE_p_switch_ivr_dmachine switch_core_session_get_dmachine(SWIGTYPE_p_switch_core_session session) { + IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_dmachine(SWIGTYPE_p_switch_core_session.getCPtr(session)); + SWIGTYPE_p_switch_ivr_dmachine ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_ivr_dmachine(cPtr, false); + return ret; + } + public static string switch_core_get_uuid() { string ret = freeswitchPINVOKE.switch_core_get_uuid(); return ret; @@ -2304,6 +2345,11 @@ public class freeswitch { return ret; } + public static uint switch_default_ptime(string name, uint number) { + uint ret = freeswitchPINVOKE.switch_default_ptime(name, number); + return ret; + } + public static switch_status_t switch_loadable_module_init(switch_bool_t autoload) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_init((int)autoload); return ret; @@ -2725,11 +2771,6 @@ public class freeswitch { return ret; } - public static uint switch_default_ptime(string name, uint number) { - uint ret = freeswitchPINVOKE.switch_default_ptime(name, number); - return ret; - } - public static string switch_sanitize_number(string number) { string ret = freeswitchPINVOKE.switch_sanitize_number(number); return ret; @@ -4134,6 +4175,10 @@ public class freeswitch { return ret; } + public static void switch_ivr_broadcast_in_thread(SWIGTYPE_p_switch_core_session session, string app, int flags) { + freeswitchPINVOKE.switch_ivr_broadcast_in_thread(SWIGTYPE_p_switch_core_session.getCPtr(session), app, flags); + } + public static switch_status_t switch_ivr_transfer_variable(SWIGTYPE_p_switch_core_session sessa, SWIGTYPE_p_switch_core_session sessb, string var) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_transfer_variable(SWIGTYPE_p_switch_core_session.getCPtr(sessa), SWIGTYPE_p_switch_core_session.getCPtr(sessb), var); return ret; @@ -4338,8 +4383,8 @@ public class freeswitch { return ret; } - public static switch_status_t switch_ivr_dmachine_create(SWIGTYPE_p_p_switch_ivr_dmachine dmachine_p, SWIGTYPE_p_apr_pool_t pool, uint digit_timeout, uint input_timeout) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_create(SWIGTYPE_p_p_switch_ivr_dmachine.getCPtr(dmachine_p), SWIGTYPE_p_apr_pool_t.getCPtr(pool), digit_timeout, input_timeout); + public static switch_status_t switch_ivr_dmachine_create(SWIGTYPE_p_p_switch_ivr_dmachine dmachine_p, string name, SWIGTYPE_p_apr_pool_t pool, uint digit_timeout, uint input_timeout, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t match_callback, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t nonmatch_callback, SWIGTYPE_p_void user_data) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_create(SWIGTYPE_p_p_switch_ivr_dmachine.getCPtr(dmachine_p), name, SWIGTYPE_p_apr_pool_t.getCPtr(pool), digit_timeout, input_timeout, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(match_callback), SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(nonmatch_callback), SWIGTYPE_p_void.getCPtr(user_data)); return ret; } @@ -4347,8 +4392,8 @@ public class freeswitch { freeswitchPINVOKE.switch_ivr_dmachine_destroy(SWIGTYPE_p_p_switch_ivr_dmachine.getCPtr(dmachine)); } - public static switch_status_t switch_ivr_dmachine_bind(SWIGTYPE_p_switch_ivr_dmachine dmachine, string digits, int key, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t callback, SWIGTYPE_p_void user_data) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_bind(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), digits, key, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(callback), SWIGTYPE_p_void.getCPtr(user_data)); + public static switch_status_t switch_ivr_dmachine_bind(SWIGTYPE_p_switch_ivr_dmachine dmachine, string realm, string digits, int key, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t callback, SWIGTYPE_p_void user_data) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_bind(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), realm, digits, key, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(callback), SWIGTYPE_p_void.getCPtr(user_data)); return ret; } @@ -4373,6 +4418,11 @@ public class freeswitch { return ret; } + public static string switch_ivr_dmachine_get_failed_digits(SWIGTYPE_p_switch_ivr_dmachine dmachine) { + string ret = freeswitchPINVOKE.switch_ivr_dmachine_get_failed_digits(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine)); + return ret; + } + public static void switch_ivr_dmachine_set_digit_timeout_ms(SWIGTYPE_p_switch_ivr_dmachine dmachine, uint digit_timeout_ms) { freeswitchPINVOKE.switch_ivr_dmachine_set_digit_timeout_ms(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), digit_timeout_ms); } @@ -4381,6 +4431,16 @@ public class freeswitch { freeswitchPINVOKE.switch_ivr_dmachine_set_input_timeout_ms(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), input_timeout_ms); } + public static switch_status_t switch_ivr_dmachine_clear_realm(SWIGTYPE_p_switch_ivr_dmachine dmachine, string realm) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_clear_realm(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), realm); + return ret; + } + + public static switch_status_t switch_ivr_dmachine_set_realm(SWIGTYPE_p_switch_ivr_dmachine dmachine, string realm) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_set_realm(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), realm); + return ret; + } + public static switch_status_t switch_rtp_add_crypto_key(SWIGTYPE_p_switch_rtp rtp_session, switch_rtp_crypto_direction_t direction, uint index, switch_rtp_crypto_key_type_t type, SWIGTYPE_p_unsigned_char key, SWIGTYPE_p_switch_size_t keylen) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_add_crypto_key(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), (int)direction, index, (int)type, SWIGTYPE_p_unsigned_char.getCPtr(key), SWIGTYPE_p_switch_size_t.getCPtr(keylen)); if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); @@ -5298,6 +5358,7 @@ public class freeswitch { public static readonly int SWITCH_CORE_QUEUE_LEN = freeswitchPINVOKE.SWITCH_CORE_QUEUE_LEN_get(); public static readonly int SWITCH_MAX_MANAGEMENT_BUFFER_LEN = freeswitchPINVOKE.SWITCH_MAX_MANAGEMENT_BUFFER_LEN_get(); public static readonly int SWITCH_RTP_CNG_PAYLOAD = freeswitchPINVOKE.SWITCH_RTP_CNG_PAYLOAD_get(); + public static readonly int DMACHINE_MAX_DIGIT_LEN = freeswitchPINVOKE.DMACHINE_MAX_DIGIT_LEN_get(); public static readonly int SWITCH_API_VERSION = freeswitchPINVOKE.SWITCH_API_VERSION_get(); public static readonly int SWITCH_CORE_DB_OK = freeswitchPINVOKE.SWITCH_CORE_DB_OK_get(); public static readonly int SWITCH_CORE_DB_ERROR = freeswitchPINVOKE.SWITCH_CORE_DB_ERROR_get(); @@ -5948,6 +6009,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_dtmf_t_duration_get")] public static extern uint switch_dtmf_t_duration_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_dtmf_t_flags_set")] + public static extern void switch_dtmf_t_flags_set(HandleRef jarg1, int jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_dtmf_t_flags_get")] + public static extern int switch_dtmf_t_flags_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_dtmf_t")] public static extern IntPtr new_switch_dtmf_t(); @@ -6503,6 +6570,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_console_callback_match")] public static extern void delete_switch_console_callback_match(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_DMACHINE_MAX_DIGIT_LEN_get")] + public static extern int DMACHINE_MAX_DIGIT_LEN_get(); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_dmachine_set")] public static extern void switch_ivr_dmachine_match_dmachine_set(HandleRef jarg1, HandleRef jarg2); @@ -6521,6 +6591,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_match_key_get")] public static extern int switch_ivr_dmachine_match_match_key_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_type_set")] + public static extern void switch_ivr_dmachine_match_type_set(HandleRef jarg1, int jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_type_get")] + public static extern int switch_ivr_dmachine_match_type_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_user_data_set")] public static extern void switch_ivr_dmachine_match_user_data_set(HandleRef jarg1, HandleRef jarg2); @@ -7271,6 +7347,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_soft_unlock")] public static extern void switch_core_session_soft_unlock(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_dmachine")] + public static extern void switch_core_session_set_dmachine(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_dmachine")] + public static extern IntPtr switch_core_session_get_dmachine(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_get_uuid")] public static extern string switch_core_get_uuid(); @@ -8039,6 +8121,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_in_thread")] public static extern int switch_core_session_in_thread(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_default_ptime")] + public static extern uint switch_default_ptime(string jarg1, uint jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_module_name_set")] public static extern void switch_loadable_module_interface_module_name_set(HandleRef jarg1, string jarg2); @@ -8405,9 +8490,6 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_char_to_rfc2833")] public static extern byte switch_char_to_rfc2833(char jarg1); - [DllImport("mod_managed", EntryPoint="CSharp_switch_default_ptime")] - public static extern uint switch_default_ptime(string jarg1, uint jarg2); - [DllImport("mod_managed", EntryPoint="CSharp_switch_sanitize_number")] public static extern string switch_sanitize_number(string jarg1); @@ -11918,6 +12000,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_broadcast")] public static extern int switch_ivr_broadcast(string jarg1, string jarg2, uint jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_broadcast_in_thread")] + public static extern void switch_ivr_broadcast_in_thread(HandleRef jarg1, string jarg2, int jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_transfer_variable")] public static extern int switch_ivr_transfer_variable(HandleRef jarg1, HandleRef jarg2, string jarg3); @@ -12042,13 +12127,13 @@ class freeswitchPINVOKE { public static extern int switch_ivr_uuid_exists(string jarg1); [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_create")] - public static extern int switch_ivr_dmachine_create(HandleRef jarg1, HandleRef jarg2, uint jarg3, uint jarg4); + public static extern int switch_ivr_dmachine_create(HandleRef jarg1, string jarg2, HandleRef jarg3, uint jarg4, uint jarg5, HandleRef jarg6, HandleRef jarg7, HandleRef jarg8); [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_destroy")] public static extern void switch_ivr_dmachine_destroy(HandleRef jarg1); [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_bind")] - public static extern int switch_ivr_dmachine_bind(HandleRef jarg1, string jarg2, int jarg3, HandleRef jarg4, HandleRef jarg5); + public static extern int switch_ivr_dmachine_bind(HandleRef jarg1, string jarg2, string jarg3, int jarg4, HandleRef jarg5, HandleRef jarg6); [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_feed")] public static extern int switch_ivr_dmachine_feed(HandleRef jarg1, string jarg2, HandleRef jarg3); @@ -12062,12 +12147,21 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_get_match")] public static extern IntPtr switch_ivr_dmachine_get_match(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_get_failed_digits")] + public static extern string switch_ivr_dmachine_get_failed_digits(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_set_digit_timeout_ms")] public static extern void switch_ivr_dmachine_set_digit_timeout_ms(HandleRef jarg1, uint jarg2); [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_set_input_timeout_ms")] public static extern void switch_ivr_dmachine_set_input_timeout_ms(HandleRef jarg1, uint jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_clear_realm")] + public static extern int switch_ivr_dmachine_clear_realm(HandleRef jarg1, string jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_set_realm")] + public static extern int switch_ivr_dmachine_set_realm(HandleRef jarg1, string jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RTP_MAX_BUF_LEN_get")] public static extern int SWITCH_RTP_MAX_BUF_LEN_get(); @@ -21106,6 +21200,7 @@ public enum switch_channel_flag_t { CF_MEDIA_SET, CF_CONSUME_ON_ORIGINATE, CF_PASSTHRU_PTIME_MISMATCH, + CF_BRIDGE_NOWRITE, CF_FLAG_MAX } @@ -23642,6 +23737,16 @@ public class switch_dtmf_t : IDisposable { } } + public int flags { + set { + freeswitchPINVOKE.switch_dtmf_t_flags_set(swigCPtr, value); + } + get { + int ret = freeswitchPINVOKE.switch_dtmf_t_flags_get(swigCPtr); + return ret; + } + } + public switch_dtmf_t() : this(freeswitchPINVOKE.new_switch_dtmf_t(), true) { } @@ -26561,6 +26666,16 @@ public class switch_ivr_dmachine_match : IDisposable { } } + public dm_match_type_t type { + set { + freeswitchPINVOKE.switch_ivr_dmachine_match_type_set(swigCPtr, (int)value); + } + get { + dm_match_type_t ret = (dm_match_type_t)freeswitchPINVOKE.switch_ivr_dmachine_match_type_get(swigCPtr); + return ret; + } + } + public SWIGTYPE_p_void user_data { set { freeswitchPINVOKE.switch_ivr_dmachine_match_user_data_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value)); commit 1a4ee982fbf3bcfd348c8928d85dd4410aa3d48c Author: Michal Bielicki <michal.bielicki@seventhsignal.de> Date: Sat Oct 9 09:07:48 2010 +0200 freeswitch.spec moved to support freetdm instead of openzap including hooks to compile with libsng_isdn and wanpipe. Added mod_silk, mod_codec2 mod_cidlookup, mod_mp4v. Added runtime requirements and build dependencies. This one is a major change diff --git a/freeswitch.spec b/freeswitch.spec index 69daa1d..a2c975b 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -5,7 +5,7 @@ # # includes module(s): freeswitch-devel freeswitch-codec-passthru-amr freeswitch-codec-passthru-amrwb freeswitch-codec-passthru-g729 # freeswitch-codec-passthru-g7231 freeswitch-lua freeswitch-perl freeswitch-python freeswitch-spidermonkey -# freeswitch-lan-de freeswitch-lang-en freeswitch-lang-fr freeswitch-lang-ru freeswitch-openzap +# freeswitch-lan-de freeswitch-lang-en freeswitch-lang-fr freeswitch-lang-ru freeswitch-freetdm # # Initial Version Copyright (C) 2007 Peter Nixon and Michal Bielicki, All Rights Reserved. # @@ -54,23 +54,23 @@ Vendor: http://www.freeswitch.org/ # ###################################################################################################################### Source0: http://files.freeswitch.org/%{name}-%{version}.tar.bz2 -Source1: http://files.freeswitch.org/downloads/libs/celt-0.7.1.tar.gz -Source2: http://files.freeswitch.org/downloads/libs/flite-1.3.99-latest.tar.gz -Source3: http://files.freeswitch.org/downloads/libs/lame-3.97.tar.gz -Source4: http://files.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz -Source5: http://files.freeswitch.org/downloads/libs/mpg123.tar.gz -Source6: http://files.freeswitch.org/downloads/libs/openldap-2.4.11.tar.gz -Source7: http://files.freeswitch.org/downloads/libs/pocketsphinx-0.5.99-20091212.tar.... -Source8: http://files.freeswitch.org/downloads/libs/soundtouch-1.3.1.tar.gz -Source9: http://files.freeswitch.org/downloads/libs/sphinxbase-0.4.99-20091212.tar.gz -Source10: http://files.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.t... -Source11: http://files.freeswitch.org/downloads/libs/libmemcached-0.32.tar.gz -Prefix: %{prefix} +Source1: http://files.freeswitch.org/downloads/libs/celt-0.7.1.tar.gz +Source2: http://files.freeswitch.org/downloads/libs/flite-1.3.99-latest.tar.gz +Source3: http://files.freeswitch.org/downloads/libs/lame-3.97.tar.gz +Source4: http://files.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz +Source5: http://files.freeswitch.org/downloads/libs/mpg123.tar.gz +Source6: http://files.freeswitch.org/downloads/libs/openldap-2.4.11.tar.gz +Source7: http://files.freeswitch.org/downloads/libs/pocketsphinx-0.5.99-20091212.tar.... +Source8: http://files.freeswitch.org/downloads/libs/soundtouch-1.3.1.tar.gz +Source9: http://files.freeswitch.org/downloads/libs/sphinxbase-0.4.99-20091212.tar.gz +Source10: http://files.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.t... +Source11: http://files.freeswitch.org/downloads/libs/libmemcached-0.32.tar.gz +Prefix: %{prefix} ###################################################################################################################### # -# Build Dependencies +# Build Dependencies # ###################################################################################################################### @@ -103,6 +103,7 @@ BuildRequires: alsa-lib-devel BuildRequires: which BuildRequires: zlib-devel BuildRequires: e2fsprogs-devel +BuildRequires: libtheora-devel Requires: alsa-lib Requires: libogg Requires: libvorbis @@ -117,6 +118,7 @@ Requires: gdbm Requires: zlib Requires: libtiff Requires: python +Requires: libtheora %if %{?suse_version:1}0 %if 0%{?suse_version} > 910 @@ -271,13 +273,17 @@ Group: System/LibrariesRequires: %{name} = %{version}-%{release} German language phrases module and directory structure for say module and voicemail -%package openzap +%package freetdm Summary: Provides a unified interface to hardware TDM cards and ss7 stacks for FreeSWITCH Group: System/Libraries Requires: %{name} = %{version}-%{release} +%{?with_sang_isdn: Requires: wanpipe } +%{?with_sang_isdn: Requires: libsng_isdn } +%{?with_sang_isdn: BuildRequires: wanpipe } +%{?with_sang_isdn: BuildRequires: libang_isdn } -%description openzap -OpenZAP +%description freetdm +FreeTDM ###################################################################################################################### # @@ -324,13 +330,15 @@ export QA_RPATHS=$[ 0x0001|0x0002 ] # Application Modules # ###################################################################################################################### -APPLICATION_MODULES_AE="applications/mod_avmd applications/mod_callcenter applications/mod_cluechoo applications/mod_commands applications/mod_conference applications/mod_db applications/mod_directory applications/mod_distributor applications/mod_dptools applications/mod_easyroute applications/mod_enum applications/mod_esf applications/mod_expr" - -APPLICATION_MODULES_FM="applications/mod_fifo applications/mod_fsv applications/mod_hash applications/mod_lcr applications/mod_limit applications/mod_memcache" - -APPLICATION_MODULES_NY="applications/mod_nibblebill applications/mod_redis applications/mod_rss applications/mod_soundtouch applications/mod_spandsp applications/mod_stress applications/mod_spy " - -APPLICATION_MODULES_VZ="applications/mod_valet_parking applications/mod_vmd applications/mod_voicemail" +APPLICATION_MODULES_AE="applications/mod_avmd applications/mod_callcenter applications/mod_cidlookup applications/mod_cluechoo \ + applications/mod_commands applications/mod_conference applications/mod_db applications/mod_directory \ + applications/mod_distributor applications/mod_dptools applications/mod_easyroute applications/mod_enum \ + applications/mod_esf applications/mod_expr" +APPLICATION_MODULES_FM="applications/mod_fifo applications/mod_fsv applications/mod_hash applications/mod_lcr applications/mod_limit \ + applications/mod_memcache" +APPLICATION_MODULES_NY="applications/mod_nibblebill applications/mod_redis applications/mod_rss applications/mod_snom \ + applications/mod_soundtouch applications/mod_spandsp applications/mod_spy applications/mod_stress \ + applications/mod_valet_parking applications/mod_vmd applications/mod_voicemail" APPLICATIONS_MODULES="$APPLICATION_MODULES_AE $APPLICATION_MODULES_FM $APPLICATION_MODULES_NY $APPLICATION_MODULES_VZ" ###################################################################################################################### @@ -344,8 +352,8 @@ ASR_TTS_MODULES="asr_tts/mod_pocketsphinx asr_tts/mod_flite asr_tts/mod_unimrcp" # Codecs # ###################################################################################################################### -CODECS_MODULES="codecs/mod_bv codecs/mod_h26x codecs/mod_speex codecs/mod_celt codecs/mod_codec2 codecs/mod_ilbc codecs/mod_mp4 \ - codec/mod_silk codecs/mod_siren codecs/mod_theora" +CODECS_MODULES="codecs/mod_bv codecs/mod_h26x codecs/mod_speex codecs/mod_celt codecs/mod_codec2 codecs/mod_ilbc codecs/mod_mp4v \ + codecs/mod_silk codecs/mod_siren codecs/mod_theora" ###################################################################################################################### # # Dialplan Modules @@ -363,19 +371,23 @@ DIRECTORIES_MODULES="" # Endpoints # ###################################################################################################################### -ENDPOINTS_MODULES="endpoints/mod_dingaling endpoints/mod_portaudio endpoints/mod_sofia ../../libs/openzap/mod_openzap endpoints/mod_loopback" +ENDPOINTS_MODULES="endpoints/mod_dingaling endpoints/mod_loopback ../../libs/freetdm/mod_freetdm endpoints/mod_portaudio \ + endpoints/mod_sofia" + ###################################################################################################################### # # Event Handlers # ###################################################################################################################### -EVENT_HANDLERS_MODULES="event_handlers/mod_event_multicast event_handlers/mod_event_socket event_handlers/mod_cdr_csv" +EVENT_HANDLERS_MODULES="event_handlers/mod_cdr_csv event_handlers/mod_event_socket event_handlers/mod_event_multicast" ###################################################################################################################### # # File and Audio Format Handlers # ###################################################################################################################### -FORMATS_MODULES="formats/mod_local_stream formats/mod_native_file formats/mod_sndfile formats/mod_portaudio_stream formats/mod_tone_stream formats/mod_shout formats/mod_file_string" +FORMATS_MODULES="formats/mod_file_string formats/mod_local_stream formats/mod_native_file formats/mod_portaudio_stream \ + formats/mod_shout formats/mod_sndfile formats/mod_tone_stream" + ###################################################################################################################### # # Embedded Languages @@ -417,7 +429,9 @@ XML_INT_MODULES="xml_int/mod_xml_cdr xml_int/mod_xml_curl xml_int/mod_xml_rpc" # Create one environment variable out of all the module defs # ###################################################################################################################### -MYMODULES="$PASSTHRU_CODEC_MODULES $APPLICATIONS_MODULES $CODECS_MODULES $DIALPLANS_MODULES $DIRECTORIES_MODULES $ENDPOINTS_MODULES $ASR_TTS_MODULES $EVENT_HANDLERS_MODULES $FORMATS_MODULES $LANGUAGES_MODULES $LOGGERS_MODULES $SAY_MODULES $TIMERS_MODULES $XML_INT_MODULES" +MYMODULES="$PASSTHRU_CODEC_MODULES $APPLICATIONS_MODULES $CODECS_MODULES $DIALPLANS_MODULES $DIRECTORIES_MODULES \ +$ENDPOINTS_MODULES $ASR_TTS_MODULES $EVENT_HANDLERS_MODULES $FORMATS_MODULES $LANGUAGES_MODULES $LOGGERS_MODULES \ +$SAY_MODULES $TIMERS_MODULES $XML_INT_MODULES" ###################################################################################################################### # @@ -450,10 +464,10 @@ fi --prefix=%{prefix} \ --infodir=%{_infodir} \ --mandir=%{_mandir} \ - --sysconfdir=%{sysconfdir} \ - --libdir=%{prefix}/lib \ - --enable-core-libedit-support \ - --enable-core-odbc-support \ + --sysconfdir=%{sysconfdir} \ + --libdir=%{prefix}/lib \ + --enable-core-libedit-support \ + --enable-core-odbc-support \ %ifos linux %if 0%{?fedora_version} >= 8 %else @@ -733,7 +747,9 @@ fi %{prefix}/mod/mod_callcenter.so* %{prefix}/mod/mod_cdr_csv.so* %{prefix}/mod/mod_celt.so* +%{prefix}/mod/mod_cidlookup.so* %{prefix}/mod/mod_cluechoo.so* +%{prefix}/mod/mod_codec2.so* %{prefix}/mod/mod_console.so* %{prefix}/mod/mod_commands.so* %{prefix}/mod/mod_conference.so* @@ -764,6 +780,7 @@ fi %{prefix}/mod/mod_logfile.so* %{prefix}/mod/mod_loopback.so* %{prefix}/mod/mod_memcache.so* +%{prefix}/mod/mod_mp4v.so* %{prefix}/mod/mod_native_file.so* %{prefix}/mod/mod_nibblebill.so* %{prefix}/mod/mod_pocketsphinx.so* @@ -772,8 +789,10 @@ fi %{prefix}/mod/mod_redis.so* %{prefix}/mod/mod_rss.so* %{prefix}/mod/mod_shout.so* +%{prefix}/mod/mod_silk.so* %{prefix}/mod/mod_siren.so* %{prefix}/mod/mod_sndfile.so* +%{prefix}/mod/mod_snom.so* %{prefix}/mod/mod_sofia.so* %{prefix}/mod/mod_soundtouch.so* %{prefix}/mod/mod_spandsp.so* @@ -781,6 +800,7 @@ fi %{prefix}/mod/mod_spy.so* %{prefix}/mod/mod_stress.so* %{prefix}/mod/mod_syslog.so* +%{prefix}/mod/mod_theora.so* %{prefix}/mod/mod_tone_stream.so* %{prefix}/mod/mod_unimrcp.so* %{prefix}/mod/mod_valet_parking.so* @@ -807,17 +827,17 @@ fi # OpenZAP Module for TDM Interaction # ###################################################################################################################### -%files openzap +%files freetdm %defattr(-, freeswitch, daemon) %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/tones.conf -%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/openzap.conf.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/freetdm.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/pika.conf -%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/openzap.conf +%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/freetdm.conf %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/wanpipe.conf %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/zt.conf -%{prefix}/lib/libopenzap.so* -%{prefix}/mod/mod_openzap.so* -%{prefix}/mod/ozmod_*.so* +%{prefix}/lib/libfreetdm.so* +%{prefix}/mod/mod_freetdm.so* +%{prefix}/mod/ftm*.so* ###################################################################################################################### # @@ -929,6 +949,13 @@ fi # ###################################################################################################################### %changelog +* Sat Oct 09 2010 - michal.bielicki@seventhsignal.de +- added mod_silk +- added mod_codec2 +- moved from openzap to freetdm to make way for inclusion of libsng_isdn and wanpipe +- added mod_freetdm +- added mod_cidlookup +- added more runtime dependencies * Thu Sep 30 2010 - michal.bielicki@seventhsignal.de - added mod_nibblebill to standard modules * Sun Sep 26 2010 - michal.bielicki@seventhsignal.de commit 55960b558c1264ca10080162c39a33919a7eea42 Author: Michal Bielicki <michal.bielicki@seventhsignal.de> Date: Sat Oct 9 05:10:52 2010 +0200 first go at new codecs and fretdm diff --git a/freeswitch.spec b/freeswitch.spec index c4bfa84..69daa1d 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -65,7 +65,7 @@ Source8: http://files.freeswitch.org/downloads/libs/soundtouch-1.3.1.tar.gz Source9: http://files.freeswitch.org/downloads/libs/sphinxbase-0.4.99-20091212.tar.gz Source10: http://files.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.t... Source11: http://files.freeswitch.org/downloads/libs/libmemcached-0.32.tar.gz -Prefix: %{prefix} +Prefix: %{prefix} ###################################################################################################################### @@ -115,6 +115,8 @@ Requires: openldap Requires: db4 Requires: gdbm Requires: zlib +Requires: libtiff +Requires: python %if %{?suse_version:1}0 %if 0%{?suse_version} > 910 @@ -342,7 +344,8 @@ ASR_TTS_MODULES="asr_tts/mod_pocketsphinx asr_tts/mod_flite asr_tts/mod_unimrcp" # Codecs # ###################################################################################################################### -CODECS_MODULES="codecs/mod_ilbc codecs/mod_h26x codecs/mod_speex codecs/mod_celt codecs/mod_siren codecs/mod_bv" +CODECS_MODULES="codecs/mod_bv codecs/mod_h26x codecs/mod_speex codecs/mod_celt codecs/mod_codec2 codecs/mod_ilbc codecs/mod_mp4 \ + codec/mod_silk codecs/mod_siren codecs/mod_theora" ###################################################################################################################### # # Dialplan Modules commit 4be25000bf2246f57f1dbc2189930e5f19bf192a Author: Jeff Lenk <jeff@jefflenk.com> Date: Fri Oct 8 21:48:14 2010 -0500 swig vs2010 diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx index 882f062..5a2a757 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx @@ -1011,6 +1011,16 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABL } +SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE_get() { + char * jresult ; + char *result = 0 ; + + result = (char *)("passthru_ptime_mismatch"); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE_get() { char * jresult ; char *result = 0 ; @@ -1685,6 +1695,28 @@ SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_dtmf_t_duration_get(void * ja } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_dtmf_t_flags_set(void * jarg1, int jarg2) { + switch_dtmf_t *arg1 = (switch_dtmf_t *) 0 ; + int32_t arg2 ; + + arg1 = (switch_dtmf_t *)jarg1; + arg2 = (int32_t)jarg2; + if (arg1) (arg1)->flags = arg2; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_dtmf_t_flags_get(void * jarg1) { + int jresult ; + switch_dtmf_t *arg1 = (switch_dtmf_t *) 0 ; + int32_t result; + + arg1 = (switch_dtmf_t *)jarg1; + result = (int32_t) ((arg1)->flags); + jresult = result; + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_dtmf_t() { void * jresult ; switch_dtmf_t *result = 0 ; @@ -3860,6 +3892,151 @@ SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_console_callback_match(void * j } +SWIGEXPORT int SWIGSTDCALL CSharp_DMACHINE_MAX_DIGIT_LEN_get() { + int jresult ; + int result; + + result = (int)(512); + jresult = result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_match_dmachine_set(void * jarg1, void * jarg2) { + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + switch_ivr_dmachine_t *arg2 = (switch_ivr_dmachine_t *) 0 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + arg2 = (switch_ivr_dmachine_t *)jarg2; + if (arg1) (arg1)->dmachine = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_ivr_dmachine_match_dmachine_get(void * jarg1) { + void * jresult ; + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + switch_ivr_dmachine_t *result = 0 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + result = (switch_ivr_dmachine_t *) ((arg1)->dmachine); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_match_match_digits_set(void * jarg1, char * jarg2) { + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + char *arg2 = (char *) 0 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + arg2 = (char *)jarg2; + { + if (arg2) { + arg1->match_digits = (char const *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->match_digits, (const char *)arg2); + } else { + arg1->match_digits = 0; + } + } +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_ivr_dmachine_match_match_digits_get(void * jarg1) { + char * jresult ; + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + char *result = 0 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + result = (char *) ((arg1)->match_digits); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_match_match_key_set(void * jarg1, int jarg2) { + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + int32_t arg2 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + arg2 = (int32_t)jarg2; + if (arg1) (arg1)->match_key = arg2; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_match_match_key_get(void * jarg1) { + int jresult ; + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + int32_t result; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + result = (int32_t) ((arg1)->match_key); + jresult = result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_match_type_set(void * jarg1, int jarg2) { + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + dm_match_type_t arg2 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + arg2 = (dm_match_type_t)jarg2; + if (arg1) (arg1)->type = arg2; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_match_type_get(void * jarg1) { + int jresult ; + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + dm_match_type_t result; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + result = (dm_match_type_t) ((arg1)->type); + jresult = result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_match_user_data_set(void * jarg1, void * jarg2) { + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + void *arg2 = (void *) 0 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + arg2 = (void *)jarg2; + if (arg1) (arg1)->user_data = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_ivr_dmachine_match_user_data_get(void * jarg1) { + void * jresult ; + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + void *result = 0 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + result = (void *) ((arg1)->user_data); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_ivr_dmachine_match() { + void * jresult ; + switch_ivr_dmachine_match *result = 0 ; + + result = (switch_ivr_dmachine_match *)new switch_ivr_dmachine_match(); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_ivr_dmachine_match(void * jarg1) { + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + delete arg1; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_input_args_t_input_callback_set(void * jarg1, void * jarg2) { switch_input_args_t *arg1 = (switch_input_args_t *) 0 ; switch_input_callback_function_t arg2 = (switch_input_callback_function_t) 0 ; @@ -3970,6 +4147,28 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_input_args_t_user_data_get(void * ja } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_input_args_t_dmachine_set(void * jarg1, void * jarg2) { + switch_input_args_t *arg1 = (switch_input_args_t *) 0 ; + switch_ivr_dmachine_t *arg2 = (switch_ivr_dmachine_t *) 0 ; + + arg1 = (switch_input_args_t *)jarg1; + arg2 = (switch_ivr_dmachine_t *)jarg2; + if (arg1) (arg1)->dmachine = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_input_args_t_dmachine_get(void * jarg1) { + void * jresult ; + switch_input_args_t *arg1 = (switch_input_args_t *) 0 ; + switch_ivr_dmachine_t *result = 0 ; + + arg1 = (switch_input_args_t *)jarg1; + result = (switch_ivr_dmachine_t *) ((arg1)->dmachine); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_input_args_t() { void * jresult ; switch_input_args_t *result = 0 ; @@ -6841,6 +7040,28 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_soft_unlock(void * jarg1) } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_set_dmachine(void * jarg1, void * jarg2) { + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_ivr_dmachine_t *arg2 = (switch_ivr_dmachine_t *) 0 ; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (switch_ivr_dmachine_t *)jarg2; + switch_core_session_set_dmachine(arg1,arg2); +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_dmachine(void * jarg1) { + void * jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + switch_ivr_dmachine_t *result = 0 ; + + arg1 = (switch_core_session_t *)jarg1; + result = (switch_ivr_dmachine_t *)switch_core_session_get_dmachine(arg1); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_get_uuid() { char * jresult ; char *result = 0 ; @@ -10211,6 +10432,20 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_in_thread(void * jarg1) { } +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_default_ptime(char * jarg1, unsigned long jarg2) { + unsigned long jresult ; + char *arg1 = (char *) 0 ; + uint32_t arg2 ; + uint32_t result; + + arg1 = (char *)jarg1; + arg2 = (uint32_t)jarg2; + result = (uint32_t)switch_default_ptime((char const *)arg1,arg2); + jresult = (unsigned long)result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_module_name_set(void * jarg1, char * jarg2) { switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; char *arg2 = (char *) 0 ; @@ -11833,20 +12068,6 @@ SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_char_to_rfc2833(char jarg1) { } -SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_default_ptime(char * jarg1, unsigned long jarg2) { - unsigned long jresult ; - char *arg1 = (char *) 0 ; - uint32_t arg2 ; - uint32_t result; - - arg1 = (char *)jarg1; - arg2 = (uint32_t)jarg2; - result = (uint32_t)switch_default_ptime((char const *)arg1,arg2); - jresult = (unsigned long)result; - return jresult; -} - - SWIGEXPORT char * SWIGSTDCALL CSharp_switch_sanitize_number(char * jarg1) { char * jresult ; char *arg1 = (char *) 0 ; @@ -26366,6 +26587,18 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_broadcast(char * jarg1, char * jarg } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_broadcast_in_thread(void * jarg1, char * jarg2, int jarg3) { + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + int arg3 ; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (int)jarg3; + switch_ivr_broadcast_in_thread(arg1,(char const *)arg2,arg3); +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_transfer_variable(void * jarg1, void * jarg2, char * jarg3) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; @@ -27026,6 +27259,176 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_uuid_exists(char * jarg1) { } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_create(void * jarg1, char * jarg2, void * jarg3, unsigned long jarg4, unsigned long jarg5, void * jarg6, void * jarg7, void * jarg8) { + int jresult ; + switch_ivr_dmachine_t **arg1 = (switch_ivr_dmachine_t **) 0 ; + char *arg2 = (char *) 0 ; + switch_memory_pool_t *arg3 = (switch_memory_pool_t *) 0 ; + uint32_t arg4 ; + uint32_t arg5 ; + switch_ivr_dmachine_callback_t arg6 = (switch_ivr_dmachine_callback_t) 0 ; + switch_ivr_dmachine_callback_t arg7 = (switch_ivr_dmachine_callback_t) 0 ; + void *arg8 = (void *) 0 ; + switch_status_t result; + + arg1 = (switch_ivr_dmachine_t **)jarg1; + arg2 = (char *)jarg2; + arg3 = (switch_memory_pool_t *)jarg3; + arg4 = (uint32_t)jarg4; + arg5 = (uint32_t)jarg5; + arg6 = (switch_ivr_dmachine_callback_t)jarg6; + arg7 = (switch_ivr_dmachine_callback_t)jarg7; + arg8 = (void *)jarg8; + result = (switch_status_t)switch_ivr_dmachine_create(arg1,(char const *)arg2,arg3,arg4,arg5,arg6,arg7,arg8); + jresult = result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_destroy(void * jarg1) { + switch_ivr_dmachine_t **arg1 = (switch_ivr_dmachine_t **) 0 ; + + arg1 = (switch_ivr_dmachine_t **)jarg1; + switch_ivr_dmachine_destroy(arg1); +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_bind(void * jarg1, char * jarg2, char * jarg3, int jarg4, void * jarg5, void * jarg6) { + int jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + int32_t arg4 ; + switch_ivr_dmachine_callback_t arg5 = (switch_ivr_dmachine_callback_t) 0 ; + void *arg6 = (void *) 0 ; + switch_status_t result; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (char *)jarg3; + arg4 = (int32_t)jarg4; + arg5 = (switch_ivr_dmachine_callback_t)jarg5; + arg6 = (void *)jarg6; + result = (switch_status_t)switch_ivr_dmachine_bind(arg1,(char const *)arg2,(char const *)arg3,arg4,arg5,arg6); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_feed(void * jarg1, char * jarg2, void * jarg3) { + int jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_ivr_dmachine_match_t **arg3 = (switch_ivr_dmachine_match_t **) 0 ; + switch_status_t result; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (switch_ivr_dmachine_match_t **)jarg3; + result = (switch_status_t)switch_ivr_dmachine_feed(arg1,(char const *)arg2,arg3); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_clear(void * jarg1) { + int jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + switch_status_t result; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + result = (switch_status_t)switch_ivr_dmachine_clear(arg1); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_ping(void * jarg1, void * jarg2) { + int jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + switch_ivr_dmachine_match_t **arg2 = (switch_ivr_dmachine_match_t **) 0 ; + switch_status_t result; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (switch_ivr_dmachine_match_t **)jarg2; + result = (switch_status_t)switch_ivr_dmachine_ping(arg1,arg2); + jresult = result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_ivr_dmachine_get_match(void * jarg1) { + void * jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + switch_ivr_dmachine_match_t *result = 0 ; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + result = (switch_ivr_dmachine_match_t *)switch_ivr_dmachine_get_match(arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_ivr_dmachine_get_failed_digits(void * jarg1) { + char * jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + char *result = 0 ; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + result = (char *)switch_ivr_dmachine_get_failed_digits(arg1); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_set_digit_timeout_ms(void * jarg1, unsigned long jarg2) { + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + uint32_t arg2 ; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (uint32_t)jarg2; + switch_ivr_dmachine_set_digit_timeout_ms(arg1,arg2); +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_set_input_timeout_ms(void * jarg1, unsigned long jarg2) { + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + uint32_t arg2 ; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (uint32_t)jarg2; + switch_ivr_dmachine_set_input_timeout_ms(arg1,arg2); +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_clear_realm(void * jarg1, char * jarg2) { + int jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (char *)jarg2; + result = (switch_status_t)switch_ivr_dmachine_clear_realm(arg1,(char const *)arg2); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_set_realm(void * jarg1, char * jarg2) { + int jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (char *)jarg2; + result = (switch_status_t)switch_ivr_dmachine_set_realm(arg1,(char const *)arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RTP_MAX_BUF_LEN_get() { int jresult ; int result; diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs index 1d89787..682b3bd 100644 --- a/src/mod/languages/mod_managed/managed/swig.2010.cs +++ b/src/mod/languages/mod_managed/managed/swig.2010.cs @@ -440,6 +440,22 @@ public class CoreSession : IDisposable { namespace FreeSWITCH.Native { +public enum dm_match_type_t { + DM_MATCH_POSITIVE, + DM_MATCH_NEGATIVE +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.0 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + using System; using System.Runtime.InteropServices; @@ -509,6 +525,21 @@ public class DTMF : IDisposable { namespace FreeSWITCH.Native { +public enum dtmf_flag_t { + DTMF_FLAG_SKIP_PROCESS = (1 << 0) +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.0 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + using System; using System.Runtime.InteropServices; @@ -1301,6 +1332,16 @@ public class freeswitch { freeswitchPINVOKE.switch_core_session_soft_unlock(SWIGTYPE_p_switch_core_session.getCPtr(session)); } + public static void switch_core_session_set_dmachine(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_switch_ivr_dmachine dmachine) { + freeswitchPINVOKE.switch_core_session_set_dmachine(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine)); + } + + public static SWIGTYPE_p_switch_ivr_dmachine switch_core_session_get_dmachine(SWIGTYPE_p_switch_core_session session) { + IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_dmachine(SWIGTYPE_p_switch_core_session.getCPtr(session)); + SWIGTYPE_p_switch_ivr_dmachine ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_ivr_dmachine(cPtr, false); + return ret; + } + public static string switch_core_get_uuid() { string ret = freeswitchPINVOKE.switch_core_get_uuid(); return ret; @@ -2314,6 +2355,11 @@ public class freeswitch { return ret; } + public static uint switch_default_ptime(string name, uint number) { + uint ret = freeswitchPINVOKE.switch_default_ptime(name, number); + return ret; + } + public static switch_status_t switch_loadable_module_init(switch_bool_t autoload) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_init((int)autoload); return ret; @@ -2735,11 +2781,6 @@ public class freeswitch { return ret; } - public static uint switch_default_ptime(string name, uint number) { - uint ret = freeswitchPINVOKE.switch_default_ptime(name, number); - return ret; - } - public static string switch_sanitize_number(string number) { string ret = freeswitchPINVOKE.switch_sanitize_number(number); return ret; @@ -4144,6 +4185,10 @@ public class freeswitch { return ret; } + public static void switch_ivr_broadcast_in_thread(SWIGTYPE_p_switch_core_session session, string app, int flags) { + freeswitchPINVOKE.switch_ivr_broadcast_in_thread(SWIGTYPE_p_switch_core_session.getCPtr(session), app, flags); + } + public static switch_status_t switch_ivr_transfer_variable(SWIGTYPE_p_switch_core_session sessa, SWIGTYPE_p_switch_core_session sessb, string var) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_transfer_variable(SWIGTYPE_p_switch_core_session.getCPtr(sessa), SWIGTYPE_p_switch_core_session.getCPtr(sessb), var); return ret; @@ -4348,6 +4393,64 @@ public class freeswitch { return ret; } + public static switch_status_t switch_ivr_dmachine_create(SWIGTYPE_p_p_switch_ivr_dmachine dmachine_p, string name, SWIGTYPE_p_apr_pool_t pool, uint digit_timeout, uint input_timeout, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t match_callback, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t nonmatch_callback, SWIGTYPE_p_void user_data) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_create(SWIGTYPE_p_p_switch_ivr_dmachine.getCPtr(dmachine_p), name, SWIGTYPE_p_apr_pool_t.getCPtr(pool), digit_timeout, input_timeout, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(match_callback), SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(nonmatch_callback), SWIGTYPE_p_void.getCPtr(user_data)); + return ret; + } + + public static void switch_ivr_dmachine_destroy(SWIGTYPE_p_p_switch_ivr_dmachine dmachine) { + freeswitchPINVOKE.switch_ivr_dmachine_destroy(SWIGTYPE_p_p_switch_ivr_dmachine.getCPtr(dmachine)); + } + + public static switch_status_t switch_ivr_dmachine_bind(SWIGTYPE_p_switch_ivr_dmachine dmachine, string realm, string digits, int key, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t callback, SWIGTYPE_p_void user_data) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_bind(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), realm, digits, key, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(callback), SWIGTYPE_p_void.getCPtr(user_data)); + return ret; + } + + public static switch_status_t switch_ivr_dmachine_feed(SWIGTYPE_p_switch_ivr_dmachine dmachine, string digits, SWIGTYPE_p_p_switch_ivr_dmachine_match match) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_feed(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), digits, SWIGTYPE_p_p_switch_ivr_dmachine_match.getCPtr(match)); + return ret; + } + + public static switch_status_t switch_ivr_dmachine_clear(SWIGTYPE_p_switch_ivr_dmachine dmachine) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_clear(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine)); + return ret; + } + + public static switch_status_t switch_ivr_dmachine_ping(SWIGTYPE_p_switch_ivr_dmachine dmachine, SWIGTYPE_p_p_switch_ivr_dmachine_match match_p) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_ping(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), SWIGTYPE_p_p_switch_ivr_dmachine_match.getCPtr(match_p)); + return ret; + } + + public static switch_ivr_dmachine_match switch_ivr_dmachine_get_match(SWIGTYPE_p_switch_ivr_dmachine dmachine) { + IntPtr cPtr = freeswitchPINVOKE.switch_ivr_dmachine_get_match(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine)); + switch_ivr_dmachine_match ret = (cPtr == IntPtr.Zero) ? null : new switch_ivr_dmachine_match(cPtr, false); + return ret; + } + + public static string switch_ivr_dmachine_get_failed_digits(SWIGTYPE_p_switch_ivr_dmachine dmachine) { + string ret = freeswitchPINVOKE.switch_ivr_dmachine_get_failed_digits(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine)); + return ret; + } + + public static void switch_ivr_dmachine_set_digit_timeout_ms(SWIGTYPE_p_switch_ivr_dmachine dmachine, uint digit_timeout_ms) { + freeswitchPINVOKE.switch_ivr_dmachine_set_digit_timeout_ms(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), digit_timeout_ms); + } + + public static void switch_ivr_dmachine_set_input_timeout_ms(SWIGTYPE_p_switch_ivr_dmachine dmachine, uint input_timeout_ms) { + freeswitchPINVOKE.switch_ivr_dmachine_set_input_timeout_ms(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), input_timeout_ms); + } + + public static switch_status_t switch_ivr_dmachine_clear_realm(SWIGTYPE_p_switch_ivr_dmachine dmachine, string realm) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_clear_realm(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), realm); + return ret; + } + + public static switch_status_t switch_ivr_dmachine_set_realm(SWIGTYPE_p_switch_ivr_dmachine dmachine, string realm) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_set_realm(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), realm); + return ret; + } + public static switch_status_t switch_rtp_add_crypto_key(SWIGTYPE_p_switch_rtp rtp_session, switch_rtp_crypto_direction_t direction, uint index, switch_rtp_crypto_key_type_t type, SWIGTYPE_p_unsigned_char key, SWIGTYPE_p_switch_size_t keylen) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_add_crypto_key(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), (int)direction, index, (int)type, SWIGTYPE_p_unsigned_char.getCPtr(key), SWIGTYPE_p_switch_size_t.getCPtr(keylen)); if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); @@ -5188,6 +5291,7 @@ public class freeswitch { public static readonly string SWITCH_CURRENT_APPLICATION_VARIABLE = freeswitchPINVOKE.SWITCH_CURRENT_APPLICATION_VARIABLE_get(); public static readonly string SWITCH_CURRENT_APPLICATION_DATA_VARIABLE = freeswitchPINVOKE.SWITCH_CURRENT_APPLICATION_DATA_VARIABLE_get(); public static readonly string SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE = freeswitchPINVOKE.SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE_get(); + public static readonly string SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE = freeswitchPINVOKE.SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE_get(); public static readonly string SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE = freeswitchPINVOKE.SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE_get(); public static readonly string SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE = freeswitchPINVOKE.SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE_get(); public static readonly string SWITCH_READ_RESULT_VARIABLE = freeswitchPINVOKE.SWITCH_READ_RESULT_VARIABLE_get(); @@ -5264,6 +5368,7 @@ public class freeswitch { public static readonly int SWITCH_CORE_QUEUE_LEN = freeswitchPINVOKE.SWITCH_CORE_QUEUE_LEN_get(); public static readonly int SWITCH_MAX_MANAGEMENT_BUFFER_LEN = freeswitchPINVOKE.SWITCH_MAX_MANAGEMENT_BUFFER_LEN_get(); public static readonly int SWITCH_RTP_CNG_PAYLOAD = freeswitchPINVOKE.SWITCH_RTP_CNG_PAYLOAD_get(); + public static readonly int DMACHINE_MAX_DIGIT_LEN = freeswitchPINVOKE.DMACHINE_MAX_DIGIT_LEN_get(); public static readonly int SWITCH_API_VERSION = freeswitchPINVOKE.SWITCH_API_VERSION_get(); public static readonly int SWITCH_CORE_DB_OK = freeswitchPINVOKE.SWITCH_CORE_DB_OK_get(); public static readonly int SWITCH_CORE_DB_ERROR = freeswitchPINVOKE.SWITCH_CORE_DB_ERROR_get(); @@ -5714,6 +5819,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE_get")] public static extern string SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE_get")] + public static extern string SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE_get")] public static extern string SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE_get(); @@ -5915,6 +6023,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_dtmf_t_duration_get")] public static extern uint switch_dtmf_t_duration_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_dtmf_t_flags_set")] + public static extern void switch_dtmf_t_flags_set(HandleRef jarg1, int jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_dtmf_t_flags_get")] + public static extern int switch_dtmf_t_flags_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_dtmf_t")] public static extern IntPtr new_switch_dtmf_t(); @@ -6470,6 +6584,45 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_console_callback_match")] public static extern void delete_switch_console_callback_match(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_DMACHINE_MAX_DIGIT_LEN_get")] + public static extern int DMACHINE_MAX_DIGIT_LEN_get(); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_dmachine_set")] + public static extern void switch_ivr_dmachine_match_dmachine_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_dmachine_get")] + public static extern IntPtr switch_ivr_dmachine_match_dmachine_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_match_digits_set")] + public static extern void switch_ivr_dmachine_match_match_digits_set(HandleRef jarg1, string jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_match_digits_get")] + public static extern string switch_ivr_dmachine_match_match_digits_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_match_key_set")] + public static extern void switch_ivr_dmachine_match_match_key_set(HandleRef jarg1, int jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_match_key_get")] + public static extern int switch_ivr_dmachine_match_match_key_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_type_set")] + public static extern void switch_ivr_dmachine_match_type_set(HandleRef jarg1, int jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_type_get")] + public static extern int switch_ivr_dmachine_match_type_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_user_data_set")] + public static extern void switch_ivr_dmachine_match_user_data_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_user_data_get")] + public static extern IntPtr switch_ivr_dmachine_match_user_data_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_ivr_dmachine_match")] + public static extern IntPtr new_switch_ivr_dmachine_match(); + + [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_ivr_dmachine_match")] + public static extern void delete_switch_ivr_dmachine_match(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_input_callback_set")] public static extern void switch_input_args_t_input_callback_set(HandleRef jarg1, HandleRef jarg2); @@ -6500,6 +6653,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_user_data_get")] public static extern IntPtr switch_input_args_t_user_data_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_dmachine_set")] + public static extern void switch_input_args_t_dmachine_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_dmachine_get")] + public static extern IntPtr switch_input_args_t_dmachine_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_input_args_t")] public static extern IntPtr new_switch_input_args_t(); @@ -7202,6 +7361,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_soft_unlock")] public static extern void switch_core_session_soft_unlock(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_dmachine")] + public static extern void switch_core_session_set_dmachine(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_dmachine")] + public static extern IntPtr switch_core_session_get_dmachine(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_get_uuid")] public static extern string switch_core_get_uuid(); @@ -7970,6 +8135,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_in_thread")] public static extern int switch_core_session_in_thread(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_default_ptime")] + public static extern uint switch_default_ptime(string jarg1, uint jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_module_name_set")] public static extern void switch_loadable_module_interface_module_name_set(HandleRef jarg1, string jarg2); @@ -8336,9 +8504,6 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_char_to_rfc2833")] public static extern byte switch_char_to_rfc2833(char jarg1); - [DllImport("mod_managed", EntryPoint="CSharp_switch_default_ptime")] - public static extern uint switch_default_ptime(string jarg1, uint jarg2); - [DllImport("mod_managed", EntryPoint="CSharp_switch_sanitize_number")] public static extern string switch_sanitize_number(string jarg1); @@ -11849,6 +12014,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_broadcast")] public static extern int switch_ivr_broadcast(string jarg1, string jarg2, uint jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_broadcast_in_thread")] + public static extern void switch_ivr_broadcast_in_thread(HandleRef jarg1, string jarg2, int jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_transfer_variable")] public static extern int switch_ivr_transfer_variable(HandleRef jarg1, HandleRef jarg2, string jarg3); @@ -11972,6 +12140,42 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_uuid_exists")] public static extern int switch_ivr_uuid_exists(string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_create")] + public static extern int switch_ivr_dmachine_create(HandleRef jarg1, string jarg2, HandleRef jarg3, uint jarg4, uint jarg5, HandleRef jarg6, HandleRef jarg7, HandleRef jarg8); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_destroy")] + public static extern void switch_ivr_dmachine_destroy(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_bind")] + public static extern int switch_ivr_dmachine_bind(HandleRef jarg1, string jarg2, string jarg3, int jarg4, HandleRef jarg5, HandleRef jarg6); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_feed")] + public static extern int switch_ivr_dmachine_feed(HandleRef jarg1, string jarg2, HandleRef jarg3); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_clear")] + public static extern int switch_ivr_dmachine_clear(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_ping")] + public static extern int switch_ivr_dmachine_ping(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_get_match")] + public static extern IntPtr switch_ivr_dmachine_get_match(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_get_failed_digits")] + public static extern string switch_ivr_dmachine_get_failed_digits(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_set_digit_timeout_ms")] + public static extern void switch_ivr_dmachine_set_digit_timeout_ms(HandleRef jarg1, uint jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_set_input_timeout_ms")] + public static extern void switch_ivr_dmachine_set_input_timeout_ms(HandleRef jarg1, uint jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_clear_realm")] + public static extern int switch_ivr_dmachine_clear_realm(HandleRef jarg1, string jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_set_realm")] + public static extern int switch_ivr_dmachine_set_realm(HandleRef jarg1, string jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RTP_MAX_BUF_LEN_get")] public static extern int SWITCH_RTP_MAX_BUF_LEN_get(); @@ -15466,6 +15670,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.0 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_f_p_switch_ivr_menu_p_char_p_char_size_t_p_void__switch_ivr_action_t { private HandleRef swigCPtr; @@ -16846,6 +17080,66 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_p_switch_ivr_dmachine { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_ivr_dmachine(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_ivr_dmachine() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_dmachine obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.0 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + +public class SWIGTYPE_p_p_switch_ivr_dmachine_match { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_ivr_dmachine_match(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_ivr_dmachine_match() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_dmachine_match obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.0 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_p_switch_ivr_menu { private HandleRef swigCPtr; @@ -17686,6 +17980,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_switch_ivr_dmachine { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_ivr_dmachine(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_ivr_dmachine() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_switch_ivr_dmachine obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.0 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_switch_ivr_menu { private HandleRef swigCPtr; @@ -20927,6 +21251,8 @@ public enum switch_channel_flag_t { CF_EARLY_HANGUP, CF_MEDIA_SET, CF_CONSUME_ON_ORIGINATE, + CF_PASSTHRU_PTIME_MISMATCH, + CF_BRIDGE_NOWRITE, CF_FLAG_MAX } @@ -23499,6 +23825,16 @@ public class switch_dtmf_t : IDisposable { } } + public int flags { + set { + freeswitchPINVOKE.switch_dtmf_t_flags_set(swigCPtr, value); + } + get { + int ret = freeswitchPINVOKE.switch_dtmf_t_flags_get(swigCPtr); + return ret; + } + } + public switch_dtmf_t() : this(freeswitchPINVOKE.new_switch_dtmf_t(), true) { } @@ -25078,6 +25414,17 @@ public class switch_input_args_t : IDisposable { } } + public SWIGTYPE_p_switch_ivr_dmachine dmachine { + set { + freeswitchPINVOKE.switch_input_args_t_dmachine_set(swigCPtr, SWIGTYPE_p_switch_ivr_dmachine.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_input_args_t_dmachine_get(swigCPtr); + SWIGTYPE_p_switch_ivr_dmachine ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_ivr_dmachine(cPtr, false); + return ret; + } + } + public switch_input_args_t() : this(freeswitchPINVOKE.new_switch_input_args_t(), true) { } @@ -26387,6 +26734,107 @@ public enum switch_ivr_action_t { namespace FreeSWITCH.Native { +using System; +using System.Runtime.InteropServices; + +public class switch_ivr_dmachine_match : IDisposable { + private HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal switch_ivr_dmachine_match(IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new HandleRef(this, cPtr); + } + + internal static HandleRef getCPtr(switch_ivr_dmachine_match obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } + + ~switch_ivr_dmachine_match() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if (swigCPtr.Handle != IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_switch_ivr_dmachine_match(swigCPtr); + } + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + GC.SuppressFinalize(this); + } + } + + public SWIGTYPE_p_switch_ivr_dmachine dmachine { + set { + freeswitchPINVOKE.switch_ivr_dmachine_match_dmachine_set(swigCPtr, SWIGTYPE_p_switch_ivr_dmachine.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_ivr_dmachine_match_dmachine_get(swigCPtr); + SWIGTYPE_p_switch_ivr_dmachine ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_ivr_dmachine(cPtr, false); + return ret; + } + } + + public string match_digits { + set { + freeswitchPINVOKE.switch_ivr_dmachine_match_match_digits_set(swigCPtr, value); + } + get { + string ret = freeswitchPINVOKE.switch_ivr_dmachine_match_match_digits_get(swigCPtr); + return ret; + } + } + + public int match_key { + set { + freeswitchPINVOKE.switch_ivr_dmachine_match_match_key_set(swigCPtr, value); + } + get { + int ret = freeswitchPINVOKE.switch_ivr_dmachine_match_match_key_get(swigCPtr); + return ret; + } + } + + public dm_match_type_t type { + set { + freeswitchPINVOKE.switch_ivr_dmachine_match_type_set(swigCPtr, (int)value); + } + get { + dm_match_type_t ret = (dm_match_type_t)freeswitchPINVOKE.switch_ivr_dmachine_match_type_get(swigCPtr); + return ret; + } + } + + public SWIGTYPE_p_void user_data { + set { + freeswitchPINVOKE.switch_ivr_dmachine_match_user_data_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_ivr_dmachine_match_user_data_get(swigCPtr); + SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false); + return ret; + } + } + + public switch_ivr_dmachine_match() : this(freeswitchPINVOKE.new_switch_ivr_dmachine_match(), true) { + } + +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.0 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + public enum switch_ivr_menu_flags { SWITCH_IVR_MENU_FLAG_FALLTOMAIN = (1 << 0), SWITCH_IVR_MENU_FLAG_FREEPOOL = (1 << 1), @@ -29377,6 +29825,7 @@ public enum switch_status_t { SWITCH_STATUS_NOUNLOAD, SWITCH_STATUS_IGNORE, SWITCH_STATUS_TOO_SMALL, + SWITCH_STATUS_FOUND, SWITCH_STATUS_NOT_INITALIZED } commit 37298f56bd85e16922b774cf6fc2a48c88b880d7 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Oct 8 17:45:40 2010 -0500 add event data diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index f444f63..06f5459 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -108,10 +108,22 @@ static switch_status_t digit_nomatch_action_callback(switch_ivr_dmachine_match_t switch_core_session_t *session = (switch_core_session_t *) match->user_data; switch_channel_t *channel = switch_core_session_get_channel(session); char str[DMACHINE_MAX_DIGIT_LEN + 2]; + switch_event_t *event; + switch_status_t status; switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Digit NOT match binding [%s]\n", switch_channel_get_name(channel), match->match_digits); + if (switch_event_create_plain(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "digits", match->match_digits); + + if ((status = switch_core_session_queue_event(session, &event)) != SWITCH_STATUS_SUCCESS) { + switch_event_destroy(&event); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s event queue faiure.\n", + switch_core_session_get_name(session)); + } + } + /* send it back around flagged to skip the dmachine */ switch_snprintf(str, sizeof(str), "!%s", match->match_digits); @@ -139,6 +151,7 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match) } switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, string, act->value); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "digits", match->match_digits); if (exec) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute", exec == 2 ? "non-blocking" : "blocking"); commit 4a3c726affd569ebeec6013ee146eaf637a14095 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Oct 8 17:05:09 2010 -0500 whitespace diff --git a/src/switch_core.c b/src/switch_core.c index 567fcfd..1275b90 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1425,8 +1425,6 @@ static void switch_load_core_config(const char *file) switch_core_hash_insert(runtime.ptimes, "ilbc", &d_30); switch_core_hash_insert(runtime.ptimes, "G723", &d_30); - - if ((xml = switch_xml_open_cfg(file, &cfg, NULL))) { switch_xml_t settings, param; commit e3c427ad288e41485c32a96c56e682b1566837be Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Oct 8 17:04:22 2010 -0500 fix default ptime for iLBC and make new configurable global map in switch.conf.xml diff --git a/conf/autoload_configs/switch.conf.xml b/conf/autoload_configs/switch.conf.xml index 7a68a7f..e861b1b 100644 --- a/conf/autoload_configs/switch.conf.xml +++ b/conf/autoload_configs/switch.conf.xml @@ -15,6 +15,11 @@ <key name="12" value="version"/> </cli-keybindings> + <default-ptimes> + <!-- set this to overide the 20ms assumption of various codecs in the sdp with no ptime defined --> + <!--<codec name="G729" ptime="40"/>--> + </default-ptimes> + <settings> <!--Colorize the Console --> <param name="colorize-console" value="true"/> diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index 6a9bdc3..ea02f22 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -199,6 +199,7 @@ struct switch_runtime { int64_t offset; switch_event_t *global_vars; switch_hash_t *mime_types; + switch_hash_t *ptimes; switch_memory_pool_t *memory_pool; const switch_state_handler_table_t *state_handlers[SWITCH_MAX_STATE_HANDLERS]; int state_handler_index; diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 04991ed..3f636d0 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -2168,6 +2168,7 @@ SWITCH_DECLARE(uint32_t) switch_core_debug_level(void); SWITCH_DECLARE(void) switch_cache_db_flush_handles(void); SWITCH_DECLARE(const char *) switch_core_banner(void); SWITCH_DECLARE(switch_bool_t) switch_core_session_in_thread(switch_core_session_t *session); +SWITCH_DECLARE(uint32_t) switch_default_ptime(const char *name, uint32_t number); SWITCH_END_EXTERN_C #endif diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index e5d70c4..945583e 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -376,15 +376,6 @@ switch_mutex_unlock(obj->flag_mutex); #define switch_set_string(_dst, _src) switch_copy_string(_dst, _src, sizeof(_dst)) -static inline uint32_t switch_default_ptime(const char *name, uint32_t number) -{ - if (!strcasecmp(name, "G723")) { - return 30; - } - - return 20; -} - static inline char *switch_sanitize_number(char *number) { char *p = number, *q; diff --git a/src/switch_core.c b/src/switch_core.c index 2c33b34..567fcfd 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1275,6 +1275,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc switch_core_session_init(runtime.memory_pool); switch_event_create_plain(&runtime.global_vars, SWITCH_EVENT_CHANNEL_DATA); switch_core_hash_init(&runtime.mime_types, runtime.memory_pool); + switch_core_hash_init_case(&runtime.ptimes, runtime.memory_pool, SWITCH_FALSE); load_mime_types(); runtime.flags |= flags; runtime.sps_total = 30; @@ -1405,13 +1406,58 @@ static void handle_SIGHUP(int sig) } +SWITCH_DECLARE(uint32_t) switch_default_ptime(const char *name, uint32_t number) +{ + uint32_t *p; + + if ((p = switch_core_hash_find(runtime.ptimes, name))) { + return *p; + } + + return 20; +} + +static uint32_t d_30 = 30; + static void switch_load_core_config(const char *file) { switch_xml_t xml = NULL, cfg = NULL; + switch_core_hash_insert(runtime.ptimes, "ilbc", &d_30); + switch_core_hash_insert(runtime.ptimes, "G723", &d_30); + + + if ((xml = switch_xml_open_cfg(file, &cfg, NULL))) { switch_xml_t settings, param; + if ((settings = switch_xml_child(cfg, "default-ptimes"))) { + for (param = switch_xml_child(settings, "codec"); param; param = param->next) { + const char *var = switch_xml_attr_soft(param, "name"); + const char *val = switch_xml_attr_soft(param, "ptime"); + + if (!zstr(var) && !zstr(val)) { + uint32_t *p; + uint32_t v = (unsigned long) atol(val); + + if (!strcasecmp(var, "G723") || !strcasecmp(var, "iLBC")) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error adding %s, defaults cannot be changed\n", var); + continue; + } + + if (v < 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error adding %s, invalid ptime\n", var); + continue; + } + + p = switch_core_alloc(runtime.memory_pool, sizeof(*p)); + *p = v; + switch_core_hash_insert(runtime.ptimes, var, p); + } + + } + } + if ((settings = switch_xml_child(cfg, "settings"))) { for (param = switch_xml_child(settings, "param"); param; param = param->next) { const char *var = switch_xml_attr_soft(param, "name"); @@ -1973,6 +2019,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_destroy(void) switch_safe_free(SWITCH_GLOBAL_dirs.temp_dir); switch_event_destroy(&runtime.global_vars); + switch_core_hash_destroy(&runtime.ptimes); switch_core_hash_destroy(&runtime.mime_types); if (IP_LIST.hash) { commit fdba0e07faafafe90be5336626b1ca8ec8d98bf0 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Oct 8 15:59:22 2010 -0500 make parens optional on functions as vars ${foo(bar)} is now the same as ${foo bar} diff --git a/src/switch_channel.c b/src/switch_channel.c index 213f385..9e76b46 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2907,14 +2907,15 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables(switch_channel_t *channel } p = e > endof_indup ? endof_indup : e; - if ((vval = strchr(vname, '('))) { + if ((vval = strchr(vname, '(')) || (vval = strchr(vname, ' '))) { + if (*vval == '(') br = 1; e = vval - 1; *vval++ = '\0'; while (*e == ' ') { *e-- = '\0'; } e = vval; - br = 1; + while (e && *e) { if (*e == '(') { br++; diff --git a/src/switch_event.c b/src/switch_event.c index 4b1e28a..f782c15 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -1644,14 +1644,15 @@ SWITCH_DECLARE(char *) switch_event_expand_headers(switch_event_t *event, const } p = e > endof_indup ? endof_indup : e; - if ((vval = strchr(vname, '('))) { + if ((vval = strchr(vname, '(')) || (vval = strchr(vname, ' '))) { + if (*vval == '(') br = 1; e = vval - 1; *vval++ = '\0'; while (*e == ' ') { *e-- = '\0'; } e = vval; - br = 1; + while (e && *e) { if (*e == '(') { br++; commit f13fa0c1a59a0b343c848abc23bdc4a3d8acaf3e Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Oct 8 15:38:01 2010 -0500 FS-2763 diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 323702e..36954d2 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3531,10 +3531,6 @@ SWITCH_STANDARD_API(sofia_function) "watchdog <on|off>\n" "--------------------------------------------------------------------------------\n"; - if (session) { - return SWITCH_STATUS_FALSE; - } - if (zstr(cmd)) { stream->write_function(stream, "%s", usage_string); goto done; commit 1d921b1cfae8567a6467e2dd25515efefd1453d7 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Oct 8 13:50:15 2010 -0500 improve dmachine stuff some more diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index 1fed73c..fb02384 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -846,24 +846,31 @@ SWITCH_DECLARE(switch_bool_t) switch_ivr_uuid_exists(const char *uuid); SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_create(switch_ivr_dmachine_t **dmachine_p, - switch_memory_pool_t *pool, - uint32_t digit_timeout, uint32_t input_timeout); + const char *name, + switch_memory_pool_t *pool, + uint32_t digit_timeout, uint32_t input_timeout, + switch_ivr_dmachine_callback_t match_callback, + switch_ivr_dmachine_callback_t nonmatch_callback, + void *user_data); SWITCH_DECLARE(void) switch_ivr_dmachine_destroy(switch_ivr_dmachine_t **dmachine); SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_bind(switch_ivr_dmachine_t *dmachine, - const char *digits, - int32_t key, - switch_ivr_dmachine_callback_t callback, - void *user_data); + const char *realm, + const char *digits, + int32_t key, + switch_ivr_dmachine_callback_t callback, + void *user_data); SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_feed(switch_ivr_dmachine_t *dmachine, const char *digits, switch_ivr_dmachine_match_t **match); SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_clear(switch_ivr_dmachine_t *dmachine); SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t *dmachine, switch_ivr_dmachine_match_t **match_p); SWITCH_DECLARE(switch_ivr_dmachine_match_t *) switch_ivr_dmachine_get_match(switch_ivr_dmachine_t *dmachine); +SWITCH_DECLARE(const char *) switch_ivr_dmachine_get_failed_digits(switch_ivr_dmachine_t *dmachine); SWITCH_DECLARE(void) switch_ivr_dmachine_set_digit_timeout_ms(switch_ivr_dmachine_t *dmachine, uint32_t digit_timeout_ms); SWITCH_DECLARE(void) switch_ivr_dmachine_set_input_timeout_ms(switch_ivr_dmachine_t *dmachine, uint32_t input_timeout_ms); - +SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_clear_realm(switch_ivr_dmachine_t *dmachine, const char *realm); +SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_set_realm(switch_ivr_dmachine_t *dmachine, const char *realm); /** @} */ diff --git a/src/include/switch_types.h b/src/include/switch_types.h index d67d972..b1fc627 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -190,9 +190,14 @@ SWITCH_BEGIN_EXTERN_C #define SWITCH_DTMF_LOG_LEN 1000 typedef uint8_t switch_byte_t; +typedef enum { + DTMF_FLAG_SKIP_PROCESS = (1 << 0) +} dtmf_flag_t; + typedef struct { char digit; uint32_t duration; + int32_t flags; } switch_dtmf_t; typedef enum { @@ -1689,6 +1694,13 @@ typedef switch_status_t (*switch_input_callback_function_t) (switch_core_session typedef switch_status_t (*switch_read_frame_callback_function_t) (switch_core_session_t *session, switch_frame_t *frame, void *user_data); typedef struct switch_say_interface switch_say_interface_t; +#define DMACHINE_MAX_DIGIT_LEN 512 + +typedef enum { + DM_MATCH_POSITIVE, + DM_MATCH_NEGATIVE +} dm_match_type_t; + struct switch_ivr_dmachine; typedef struct switch_ivr_dmachine switch_ivr_dmachine_t; @@ -1696,6 +1708,7 @@ struct switch_ivr_dmachine_match { switch_ivr_dmachine_t *dmachine; const char *match_digits; int32_t match_key; + dm_match_type_t type; void *user_data; }; diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 675cde4..f444f63 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -96,12 +96,30 @@ SWITCH_STANDARD_DIALPLAN(inline_dialplan_hunt) } struct action_binding { + char *realm; char *input; char *string; char *value; switch_core_session_t *session; }; +static switch_status_t digit_nomatch_action_callback(switch_ivr_dmachine_match_t *match) +{ + switch_core_session_t *session = (switch_core_session_t *) match->user_data; + switch_channel_t *channel = switch_core_session_get_channel(session); + char str[DMACHINE_MAX_DIGIT_LEN + 2]; + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Digit NOT match binding [%s]\n", + switch_channel_get_name(channel), match->match_digits); + + /* send it back around flagged to skip the dmachine */ + switch_snprintf(str, sizeof(str), "!%s", match->match_digits); + + switch_channel_queue_dtmf_string(channel, str); + + return SWITCH_STATUS_SUCCESS; +} + static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match) { struct action_binding *act = (struct action_binding *) match->user_data; @@ -141,32 +159,64 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match) return SWITCH_STATUS_SUCCESS; } -#define CLEAR_DIGIT_ACTION_USAGE "" +#define CLEAR_DIGIT_ACTION_USAGE "<realm>|all" SWITCH_STANDARD_APP(clear_digit_action_function) { //switch_channel_t *channel = switch_core_session_get_channel(session); switch_ivr_dmachine_t *dmachine; + char *realm = (char *) data; + + if ((dmachine = switch_core_session_get_dmachine(session))) { + if (zstr(realm) || !strcasecmp(realm, "all")) { + switch_core_session_set_dmachine(session, NULL); + switch_ivr_dmachine_destroy(&dmachine); + } else { + switch_ivr_dmachine_clear_realm(dmachine, realm); + } + } +} + +#define DIGIT_ACTION_SET_REALM_USAGE "<realm>" +SWITCH_STANDARD_APP(digit_action_set_realm_function) +{ + switch_ivr_dmachine_t *dmachine; + char *realm = (char *) data; + + if (zstr(data)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Syntax Error, USAGE %s\n", DIGIT_ACTION_SET_REALM_USAGE); + return; + } if ((dmachine = switch_core_session_get_dmachine(session))) { - switch_core_session_set_dmachine(session, NULL); - switch_ivr_dmachine_destroy(&dmachine); + switch_ivr_dmachine_set_realm(dmachine, realm); } + } -#define BIND_DIGIT_ACTION_USAGE "<digits|~regex>,<string>,<value>" +#define BIND_DIGIT_ACTION_USAGE "<realm>,<digits|~regex>,<string>,<value>" SWITCH_STANDARD_APP(bind_digit_action_function) { switch_channel_t *channel = switch_core_session_get_channel(session); switch_ivr_dmachine_t *dmachine; char *mydata; int argc = 0; - char *argv[3] = { 0 }; + char *argv[4] = { 0 }; struct action_binding *act; if (zstr(data)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Syntax Error, USAGE %s\n", BIND_DIGIT_ACTION_USAGE); return; } + + mydata = switch_core_session_strdup(session, data); + + argc = switch_separate_string(mydata, ',', argv, (sizeof(argv) / sizeof(argv[0]))); + + if (argc < 4 || zstr(argv[0]) || zstr(argv[1]) || zstr(argv[2]) || zstr(argv[3])) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Syntax Error, USAGE %s\n", BIND_DIGIT_ACTION_USAGE); + return; + } + if (!(dmachine = switch_core_session_get_dmachine(session))) { uint32_t digit_timeout = 1500; @@ -186,26 +236,19 @@ SWITCH_STANDARD_APP(bind_digit_action_function) input_timeout = tmp; } - switch_ivr_dmachine_create(&dmachine, NULL, digit_timeout, input_timeout); + switch_ivr_dmachine_create(&dmachine, "DPTOOLS", NULL, digit_timeout, input_timeout, NULL, digit_nomatch_action_callback, session); switch_core_session_set_dmachine(session, dmachine); } - mydata = switch_core_session_strdup(session, data); - - argc = switch_separate_string(mydata, ',', argv, (sizeof(argv) / sizeof(argv[0]))); - if (argc < 3 || zstr(argv[0]) || zstr(argv[1]) || zstr(argv[2])) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Syntax Error, USAGE %s\n", BIND_DIGIT_ACTION_USAGE); - return; - } - act = switch_core_session_alloc(session, sizeof(*act)); - act->input = argv[0]; - act->string = argv[1]; - act->value = argv[2]; + act->realm = argv[0]; + act->input = argv[1]; + act->string = argv[2]; + act->value = argv[3]; act->session = session; - switch_ivr_dmachine_bind(dmachine, act->input, 0, digit_action_callback, act); + switch_ivr_dmachine_bind(dmachine, act->realm, act->input, 0, digit_action_callback, act); } @@ -3398,6 +3441,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) SWITCH_ADD_APP(app_interface, "clear_digit_action", "clear all digit bindings", "", clear_digit_action_function, CLEAR_DIGIT_ACTION_USAGE, SAF_SUPPORT_NOMEDIA); + SWITCH_ADD_APP(app_interface, "digit_action_set_realm", "change binding realm", "", + digit_action_set_realm_function, DIGIT_ACTION_SET_REALM_USAGE, SAF_SUPPORT_NOMEDIA); + SWITCH_ADD_APP(app_interface, "privacy", "Set privacy on calls", "Set caller privacy on calls.", privacy_function, "off|on|name|full|number", SAF_SUPPORT_NOMEDIA); diff --git a/src/switch_channel.c b/src/switch_channel.c index df5fd96..213f385 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -400,7 +400,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf(switch_channel_t *chan SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf_string(switch_channel_t *channel, const char *dtmf_string) { char *p; - switch_dtmf_t dtmf = { 0, switch_core_default_dtmf_duration(0) }; + switch_dtmf_t dtmf = { 0, switch_core_default_dtmf_duration(0), 0}; int sent = 0, dur; char *string; int i, argc; @@ -410,6 +410,11 @@ SWITCH_DECLARE(switch_status_t) switch_channel_queue_dtmf_string(switch_channel_ return SWITCH_STATUS_FALSE; } + if (*dtmf_string == '!') { + dtmf_string++; + dtmf.flags = DTMF_FLAG_SKIP_PROCESS; + } + string = switch_core_session_strdup(channel->session, dtmf_string); argc = switch_separate_string(string, '+', argv, (sizeof(argv) / sizeof(argv[0]))); diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 15b8f41..4e6d2fc 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -1176,15 +1176,17 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_recv_dtmf(switch_core_sessio new_dtmf.duration = switch_core_default_dtmf_duration(0); } - if (session->dmachine && !switch_channel_test_flag(session->channel, CF_BROADCAST)) { - char str[2] = { dtmf->digit, '\0' }; - switch_ivr_dmachine_feed(session->dmachine, str, NULL); - fed = 1; - } + if (!switch_test_flag(dtmf, DTMF_FLAG_SKIP_PROCESS)) { + if (session->dmachine && !switch_channel_test_flag(session->channel, CF_BROADCAST)) { + char str[2] = { dtmf->digit, '\0' }; + switch_ivr_dmachine_feed(session->dmachine, str, NULL); + fed = 1; + } - for (ptr = session->event_hooks.recv_dtmf; ptr; ptr = ptr->next) { - if ((status = ptr->recv_dtmf(session, &new_dtmf, SWITCH_DTMF_RECV)) != SWITCH_STATUS_SUCCESS) { - return status; + for (ptr = session->event_hooks.recv_dtmf; ptr; ptr = ptr->next) { + if ((status = ptr->recv_dtmf(session, &new_dtmf, SWITCH_DTMF_RECV)) != SWITCH_STATUS_SUCCESS) { + return status; + } } } diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 57b4569..9bfa27e 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -45,28 +45,41 @@ struct switch_ivr_dmachine_binding { }; typedef struct switch_ivr_dmachine_binding switch_ivr_dmachine_binding_t; -#define DM_MAX_DIGIT_LEN 512 +typedef struct { + switch_ivr_dmachine_binding_t *binding_list; + switch_ivr_dmachine_binding_t *tail; +} dm_binding_head_t; struct switch_ivr_dmachine { switch_memory_pool_t *pool; switch_byte_t my_pool; + char *name; uint32_t digit_timeout_ms; uint32_t input_timeout_ms; - switch_ivr_dmachine_binding_t *binding_list; - switch_ivr_dmachine_binding_t *tail; - switch_ivr_dmachine_binding_t *last_matching_binding; + switch_hash_t *binding_hash; switch_ivr_dmachine_match_t match; - char digits[DM_MAX_DIGIT_LEN]; - char last_matching_digits[DM_MAX_DIGIT_LEN]; + char digits[DMACHINE_MAX_DIGIT_LEN]; + char last_matching_digits[DMACHINE_MAX_DIGIT_LEN]; + char last_failed_digits[DMACHINE_MAX_DIGIT_LEN]; uint32_t cur_digit_len; uint32_t max_digit_len; switch_time_t last_digit_time; switch_byte_t is_match; + switch_ivr_dmachine_callback_t match_callback; + switch_ivr_dmachine_callback_t nonmatch_callback; + dm_binding_head_t *realm; + switch_ivr_dmachine_binding_t *last_matching_binding; + void *user_data; }; SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_create(switch_ivr_dmachine_t **dmachine_p, - switch_memory_pool_t *pool, - uint32_t digit_timeout_ms, uint32_t input_timeout_ms) + const char *name, + switch_memory_pool_t *pool, + uint32_t digit_timeout_ms, + uint32_t input_timeout_ms, + switch_ivr_dmachine_callback_t match_callback, + switch_ivr_dmachine_callback_t nonmatch_callback, + void *user_data) { switch_byte_t my_pool = !!pool; switch_ivr_dmachine_t *dmachine; @@ -81,8 +94,22 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_create(switch_ivr_dmachine_t dmachine->digit_timeout_ms = digit_timeout_ms; dmachine->input_timeout_ms = input_timeout_ms; dmachine->match.dmachine = dmachine; - *dmachine_p = dmachine; + dmachine->name = switch_core_strdup(dmachine->pool, name); + + switch_core_hash_init(&dmachine->binding_hash, dmachine->pool); + + if (match_callback) { + dmachine->match_callback = match_callback; + } + if (nonmatch_callback) { + dmachine->nonmatch_callback = nonmatch_callback; + } + + dmachine->user_data = user_data; + + *dmachine_p = dmachine; + return SWITCH_STATUS_SUCCESS; } @@ -105,12 +132,42 @@ SWITCH_DECLARE(void) switch_ivr_dmachine_destroy(switch_ivr_dmachine_t **dmachin pool = (*dmachine)->pool; + switch_core_hash_destroy(&(*dmachine)->binding_hash); + if ((*dmachine)->my_pool) { switch_core_destroy_memory_pool(&pool); } } +SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_set_realm(switch_ivr_dmachine_t *dmachine, const char *realm) +{ + dm_binding_head_t *headp = switch_core_hash_find(dmachine->binding_hash, realm); + + if (headp) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Digit parser %s: Setting realm to %s\n", dmachine->name, realm); + dmachine->realm = headp; + return SWITCH_STATUS_SUCCESS; + } + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Digit parser %s: Error Setting realm to %s\n", dmachine->name, realm); + + return SWITCH_STATUS_FALSE; +} + +SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_clear_realm(switch_ivr_dmachine_t *dmachine, const char *realm) +{ + if (zstr(realm)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Digit parser %s: Error unknown realm: %s\n", dmachine->name, realm); + return SWITCH_STATUS_FALSE; + } + + /* pool alloc'd just ditch it and it will give back the memory when we destroy ourselves */ + switch_core_hash_delete(dmachine->binding_hash, realm); + return SWITCH_STATUS_SUCCESS; +} + SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_bind(switch_ivr_dmachine_t *dmachine, + const char *realm, const char *digits, int32_t key, switch_ivr_dmachine_callback_t callback, @@ -118,43 +175,59 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_bind(switch_ivr_dmachine_t * { switch_ivr_dmachine_binding_t *binding; switch_size_t len; + dm_binding_head_t *headp; - if (strlen(digits) > DM_MAX_DIGIT_LEN -1) { + if (strlen(digits) > DMACHINE_MAX_DIGIT_LEN -1) { return SWITCH_STATUS_FALSE; } + if (zstr(realm)) { + realm = "default"; + } + + if (!(headp = switch_core_hash_find(dmachine->binding_hash, realm))) { + headp = switch_core_alloc(dmachine->pool, sizeof(*headp)); + switch_core_hash_insert(dmachine->binding_hash, realm, headp); + } + binding = switch_core_alloc(dmachine->pool, sizeof(*binding)); + if (*digits == '~') { binding->is_regex = 1; digits++; } + binding->key = key; binding->digits = switch_core_strdup(dmachine->pool, digits); binding->callback = callback; binding->user_data = user_data; - if (dmachine->tail) { - dmachine->tail->next = binding; + if (headp->tail) { + headp->tail->next = binding; } else { - dmachine->binding_list = binding; + headp->binding_list = binding; } - dmachine->tail = binding; + headp->tail = binding; len = strlen(digits); - if (binding->is_regex && dmachine->max_digit_len != DM_MAX_DIGIT_LEN -1) { - dmachine->max_digit_len = DM_MAX_DIGIT_LEN -1; + if (dmachine->realm != headp) { + switch_ivr_dmachine_set_realm(dmachine, realm); + } + + if (binding->is_regex && dmachine->max_digit_len != DMACHINE_MAX_DIGIT_LEN -1) { + dmachine->max_digit_len = DMACHINE_MAX_DIGIT_LEN -1; } else if (len > dmachine->max_digit_len) { dmachine->max_digit_len = (uint32_t) len; } if (binding->is_regex) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "binding regex: %s key: %.4d callback: %p data: %p\n", - digits, key, (void *)(intptr_t) callback, user_data); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Digit parser %s: binding realm: %s regex: %s key: %.4d callback: %p data: %p\n", + dmachine->name, realm, digits, key, (void *)(intptr_t) callback, user_data); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "binding digits: %4s key: %.4d callback: %p data: %p\n", - digits, key, (void *)(intptr_t) callback, user_data); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Digit parser %s: binding realm %s digits: %4s key: %.4d callback: %p data: %p\n", + dmachine->name, realm, digits, key, (void *)(intptr_t) callback, user_data); } return SWITCH_STATUS_SUCCESS; @@ -175,9 +248,9 @@ static dm_match_t switch_ivr_dmachine_check_match(switch_ivr_dmachine_t *dmachin int exact_count = 0, partial_count = 0, both_count = 0; - if (!dmachine->cur_digit_len) goto end; + if (!dmachine->cur_digit_len || !dmachine->realm) goto end; - for(bp = dmachine->binding_list; bp; bp = bp->next) { + for(bp = dmachine->realm->binding_list; bp; bp = bp->next) { if (bp->is_regex) { switch_status_t r_status = switch_regex_match(dmachine->digits, bp->digits); @@ -259,12 +332,17 @@ SWITCH_DECLARE(switch_ivr_dmachine_match_t *) switch_ivr_dmachine_get_match(swit return NULL; } +SWITCH_DECLARE(const char *) switch_ivr_dmachine_get_failed_digits(switch_ivr_dmachine_t *dmachine) +{ + + return dmachine->last_failed_digits; +} + SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t *dmachine, switch_ivr_dmachine_match_t **match_p) { switch_bool_t is_timeout = switch_ivr_dmachine_check_timeout(dmachine); dm_match_t is_match = switch_ivr_dmachine_check_match(dmachine, is_timeout); switch_status_t r; - int exec = 0; if (zstr(dmachine->digits) && !is_timeout) { r = SWITCH_STATUS_SUCCESS; @@ -282,7 +360,18 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t * } dmachine->is_match = 1; - exec = 1; + + dmachine->match.type = DM_MATCH_POSITIVE; + + if (dmachine->last_matching_binding->callback) { + dmachine->last_matching_binding->callback(&dmachine->match); + } + + if (dmachine->match_callback) { + dmachine->match.user_data = dmachine->user_data; + dmachine->match_callback(&dmachine->match); + } + } else if (is_timeout) { r = SWITCH_STATUS_TIMEOUT; } else if (dmachine->cur_digit_len == dmachine->max_digit_len) { @@ -291,14 +380,22 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t * r = SWITCH_STATUS_SUCCESS; } + if (r != SWITCH_STATUS_FOUND && r != SWITCH_STATUS_SUCCESS) { + switch_set_string(dmachine->last_failed_digits, dmachine->digits); + dmachine->match.match_digits = dmachine->last_failed_digits; + + dmachine->match.type = DM_MATCH_NEGATIVE; + + if (dmachine->nonmatch_callback) { + dmachine->match.user_data = dmachine->user_data; + dmachine->nonmatch_callback(&dmachine->match); + } + } + if (r != SWITCH_STATUS_SUCCESS) { switch_ivr_dmachine_clear(dmachine); } - if (exec && dmachine->last_matching_binding->callback) { - dmachine->last_matching_binding->callback(&dmachine->match); - } - return r; } commit 8a7f8cd22ee4b9d367cd1c18d80f9a351f3ecc93 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Oct 8 11:05:29 2010 -0500 fix carbon copy delete after emailing paradox diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index e55cd8a..fea8b83 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -2317,7 +2317,7 @@ static switch_status_t deliver_vm(vm_profile_t *profile, const char *caller_id_name, const char *caller_id_number, const char *forwarded_by, - switch_bool_t copy, const char *use_uuid) + switch_bool_t copy, const char *use_uuid, switch_core_session_t *session) { char *file_path = NULL, *dir_path = NULL; const char *myid = switch_xml_attr(x_user, "id"); @@ -2342,6 +2342,8 @@ static switch_status_t deliver_vm(vm_profile_t *profile, switch_status_t ret = SWITCH_STATUS_SUCCESS; char *convert_cmd = profile->convert_cmd; char *convert_ext = profile->convert_ext; + int del_file = 0; + char *id = switch_core_session_strdup(session, switch_xml_attr(x_user, "id")); if (!params) { switch_event_create(&local_event, SWITCH_EVENT_REQUEST_PARAMS); @@ -2634,14 +2636,35 @@ static switch_status_t deliver_vm(vm_profile_t *profile, } if (!insert_db) { - if (unlink(file_path) != 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to delete file [%s]\n", file_path); + del_file = 1; + } + } + + if (session) { + switch_channel_t *channel = switch_core_session_get_channel(session); + const char *vm_cc; + + if ((vm_cc = switch_channel_get_variable(channel, "vm_cc"))) { + char *cmd = switch_core_session_sprintf(session, "%s %s %s '%s' %s@%s %s", + vm_cc, file_path, caller_id_number, caller_id_name, id, domain_name, read_flags); + + if (voicemail_inject(cmd, session) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Sent Carbon Copy to %s\n", vm_cc); + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to Carbon Copy to %s\n", vm_cc); } } } + failed: + if (del_file && file_path) { + if (unlink(file_path) != 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to delete file [%s]\n", file_path); + } + } + switch_event_destroy(&local_event); switch_safe_free(dir_path); @@ -2785,7 +2808,7 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t switch_event_create(&my_params, SWITCH_EVENT_REQUEST_PARAMS); status = deliver_vm(profile, ux, domain, path, 0, read_flags, my_params, pool, cid_name, cid_num, forwarded_by, - SWITCH_TRUE, session ? switch_core_session_get_uuid(session) : NULL); + SWITCH_TRUE, session ? switch_core_session_get_uuid(session) : NULL, NULL); switch_event_destroy(&my_params); } continue; @@ -2794,7 +2817,7 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t switch_event_create(&my_params, SWITCH_EVENT_REQUEST_PARAMS); status = deliver_vm(profile, ut, domain, path, 0, read_flags, my_params, pool, cid_name, cid_num, forwarded_by, SWITCH_TRUE, - session ? switch_core_session_get_uuid(session) : NULL); + session ? switch_core_session_get_uuid(session) : NULL, NULL); switch_event_destroy(&my_params); } } @@ -2817,7 +2840,7 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t switch_event_create(&my_params, SWITCH_EVENT_REQUEST_PARAMS); status = deliver_vm(profile, ut, domain, path, 0, read_flags, my_params, pool, cid_name, cid_num, forwarded_by, SWITCH_TRUE, - session ? switch_core_session_get_uuid(session) : NULL); + session ? switch_core_session_get_uuid(session) : NULL, NULL); switch_event_destroy(&my_params); } } @@ -2831,7 +2854,7 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t switch_event_create(&my_params, SWITCH_EVENT_REQUEST_PARAMS); status = deliver_vm(profile, ut, domain, path, 0, read_flags, my_params, pool, cid_name, cid_num, forwarded_by, SWITCH_TRUE, - session ? switch_core_session_get_uuid(session) : NULL); + session ? switch_core_session_get_uuid(session) : NULL, NULL); switch_event_destroy(&my_params); } else { status = SWITCH_STATUS_FALSE; @@ -2889,7 +2912,7 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p const char *caller_id_number = NULL; switch_xml_t x_user = NULL, x_params = NULL, x_param = NULL; switch_event_t *vars = NULL; - const char *vm_cc = NULL, *vtmp, *vm_ext = NULL; + const char *vtmp, *vm_ext = NULL; int disk_quota = 0; switch_bool_t skip_greeting = switch_true(switch_channel_get_variable(channel, "skip_greeting")); switch_bool_t skip_instructions = switch_true(switch_channel_get_variable(channel, "skip_instructions")); @@ -3175,20 +3198,9 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p switch_channel_get_variables(channel, &vars); status = deliver_vm(profile, x_user, domain_name, file_path, message_len, read_flags, vars, switch_core_session_get_pool(session), caller_id_name, caller_id_number, NULL, SWITCH_FALSE, - session ? switch_core_session_get_uuid(session) : NULL); + session ? switch_core_session_get_uuid(session) : NULL, session); switch_event_destroy(&vars); - if (status == SWITCH_STATUS_SUCCESS) { - if ((vm_cc = switch_channel_get_variable(channel, "vm_cc"))) { - char *cmd = switch_core_session_sprintf(session, "%s %s %s '%s' %s@%s %s", - vm_cc, file_path, caller_id_number, caller_id_name, id, domain_name, read_flags); - - if (voicemail_inject(cmd, session) == SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Sent Carbon Copy to %s\n", vm_cc); - } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to Carbon Copy to %s\n", vm_cc); - } - } - } else { + if (status != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to deliver message\n"); TRY_CODE(switch_ivr_phrase_macro(session, VM_ACK_MACRO, "deleted", NULL, NULL)); } commit 413dcc4cd29be42c421a81453d0e36d783f17d72 Author: Brian West <brian@freeswitch.org> Date: Fri Oct 8 09:03:43 2010 -0500 ESL-50: Call close on connection handle if the connection fails diff --git a/libs/esl/src/esl.c b/libs/esl/src/esl.c index 75a52d6..4a02a8f 100644 --- a/libs/esl/src/esl.c +++ b/libs/esl/src/esl.c @@ -765,6 +765,7 @@ ESL_DECLARE(esl_status_t) esl_connect_timeout(esl_handle_t *handle, const char * fail: handle->connected = 0; + esl_disconnect(handle); return ESL_FAIL; } commit 9537197b4df5011fdf5c31638b8eba041f903b77 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Oct 7 18:30:07 2010 -0500 add some goodies diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index e77d5f7..6a9bdc3 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -167,6 +167,7 @@ struct switch_core_session { uint32_t track_id; switch_log_level_t loglevel; uint32_t soft_lock; + switch_ivr_dmachine_t *dmachine; }; struct switch_media_bug { diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 466dc51..04991ed 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -704,7 +704,8 @@ SWITCH_DECLARE(switch_log_level_t) switch_core_session_get_loglevel(switch_core_ SWITCH_DECLARE(void) switch_core_session_soft_lock(switch_core_session_t *session, uint32_t sec); SWITCH_DECLARE(void) switch_core_session_soft_unlock(switch_core_session_t *session); - +SWITCH_DECLARE(void) switch_core_session_set_dmachine(switch_core_session_t *session, switch_ivr_dmachine_t *dmachine); +SWITCH_DECLARE(switch_ivr_dmachine_t *) switch_core_session_get_dmachine(switch_core_session_t *session); /*! \brief Retrieve the unique identifier from the core diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index ac9d8f9..1fed73c 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -557,6 +557,7 @@ SWITCH_DECLARE(uint32_t) switch_ivr_schedule_broadcast(time_t runtime, const cha \return SWITCH_STATUS_SUCCESS if all is well */ SWITCH_DECLARE(switch_status_t) switch_ivr_broadcast(const char *uuid, const char *path, switch_media_flag_t flags); +SWITCH_DECLARE(void) switch_ivr_broadcast_in_thread(switch_core_session_t *session, const char *app, int flags); /*! \brief Transfer variables from one session to another diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 5aecca7..d67d972 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1057,6 +1057,7 @@ typedef enum { CF_MEDIA_SET, CF_CONSUME_ON_ORIGINATE, CF_PASSTHRU_PTIME_MISMATCH, + CF_BRIDGE_NOWRITE, /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ CF_FLAG_MAX } switch_channel_flag_t; diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 9fb6b1b..675cde4 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -95,6 +95,120 @@ SWITCH_STANDARD_DIALPLAN(inline_dialplan_hunt) return extension; } +struct action_binding { + char *input; + char *string; + char *value; + switch_core_session_t *session; +}; + +static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match) +{ + struct action_binding *act = (struct action_binding *) match->user_data; + switch_event_t *event; + switch_status_t status; + int exec = 0; + char *string = act->string; + switch_channel_t *channel = switch_core_session_get_channel(act->session); + + if (switch_event_create_plain(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(act->session), SWITCH_LOG_DEBUG, "%s Digit match binding [%s][%s]\n", + switch_channel_get_name(channel), act->string, act->value); + + if (!strncasecmp(string, "exec:", 5)) { + string += 5; + exec = 1; + } + + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, string, act->value); + + if (exec) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute", exec == 2 ? "non-blocking" : "blocking"); + } + + if ((status = switch_core_session_queue_event(act->session, &event)) != SWITCH_STATUS_SUCCESS) { + switch_event_destroy(&event); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(act->session), SWITCH_LOG_WARNING, "%s event queue faiure.\n", + switch_core_session_get_name(act->session)); + } + } + + if (exec) { + char *cmd = switch_core_session_sprintf(act->session, "%s::%s", string, act->value); + switch_ivr_broadcast_in_thread(act->session, cmd, SMF_ECHO_ALEG|SMF_HOLD_BLEG); + } + + return SWITCH_STATUS_SUCCESS; +} + +#define CLEAR_DIGIT_ACTION_USAGE "" +SWITCH_STANDARD_APP(clear_digit_action_function) +{ + //switch_channel_t *channel = switch_core_session_get_channel(session); + switch_ivr_dmachine_t *dmachine; + + if ((dmachine = switch_core_session_get_dmachine(session))) { + switch_core_session_set_dmachine(session, NULL); + switch_ivr_dmachine_destroy(&dmachine); + } +} + +#define BIND_DIGIT_ACTION_USAGE "<digits|~regex>,<string>,<value>" +SWITCH_STANDARD_APP(bind_digit_action_function) +{ + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_ivr_dmachine_t *dmachine; + char *mydata; + int argc = 0; + char *argv[3] = { 0 }; + struct action_binding *act; + + if (zstr(data)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Syntax Error, USAGE %s\n", BIND_DIGIT_ACTION_USAGE); + return; + } + + if (!(dmachine = switch_core_session_get_dmachine(session))) { + uint32_t digit_timeout = 1500; + uint32_t input_timeout = 0; + const char *var; + uint32_t tmp; + + if ((var = switch_channel_get_variable(channel, "bind_digit_digit_timeout"))) { + tmp = (uint32_t) atol(var); + if (tmp < 0) tmp = 0; + digit_timeout = tmp; + } + + if ((var = switch_channel_get_variable(channel, "bind_digit_input_timeout"))) { + tmp = (uint32_t) atol(var); + if (tmp < 0) tmp = 0; + input_timeout = tmp; + } + + switch_ivr_dmachine_create(&dmachine, NULL, digit_timeout, input_timeout); + switch_core_session_set_dmachine(session, dmachine); + } + + mydata = switch_core_session_strdup(session, data); + + argc = switch_separate_string(mydata, ',', argv, (sizeof(argv) / sizeof(argv[0]))); + + if (argc < 3 || zstr(argv[0]) || zstr(argv[1]) || zstr(argv[2])) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Syntax Error, USAGE %s\n", BIND_DIGIT_ACTION_USAGE); + return; + } + + act = switch_core_session_alloc(session, sizeof(*act)); + act->input = argv[0]; + act->string = argv[1]; + act->value = argv[2]; + act->session = session; + + switch_ivr_dmachine_bind(dmachine, act->input, 0, digit_action_callback, act); +} + + #define DETECT_SPEECH_SYNTAX "<mod_name> <gram_name> <gram_path> [<addr>] OR grammar <gram_name> [<path>] OR pause OR resume" SWITCH_STANDARD_APP(detect_speech_function) { @@ -3277,6 +3391,14 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) SWITCH_ADD_API(api_interface, "chat", "chat", chat_api_function, "<proto>|<from>|<to>|<message>|[<content-type>]"); SWITCH_ADD_API(api_interface, "strftime", "strftime", strftime_api_function, "<format_string>"); SWITCH_ADD_API(api_interface, "presence", "presence", presence_api_function, PRESENCE_USAGE); + + SWITCH_ADD_APP(app_interface, "bind_digit_action", "bind a key sequence or regex to an action", + "bind a key sequence or regex to an action", bind_digit_action_function, BIND_DIGIT_ACTION_USAGE, SAF_SUPPORT_NOMEDIA); + + SWITCH_ADD_APP(app_interface, "clear_digit_action", "clear all digit bindings", "", + clear_digit_action_function, CLEAR_DIGIT_ACTION_USAGE, SAF_SUPPORT_NOMEDIA); + + SWITCH_ADD_APP(app_interface, "privacy", "Set privacy on calls", "Set caller privacy on calls.", privacy_function, "off|on|name|full|number", SAF_SUPPORT_NOMEDIA); diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 4007187..0d69bdb 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -5077,7 +5077,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, } if (channel) { - if (sofia_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) { + if (sofia_test_flag(tech_pvt, TFLAG_EARLY_MEDIA) && !sofia_test_flag(tech_pvt, TFLAG_ANS)) { sofia_set_flag_locked(tech_pvt, TFLAG_ANS); sofia_set_flag(tech_pvt, TFLAG_SDP); switch_channel_mark_answered(channel); diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 4ca8b2d..15b8f41 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -126,7 +126,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi switch_mutex_lock(session->read_codec->mutex); top: - + + if (session->dmachine && !switch_channel_test_flag(session->channel, CF_BROADCAST)) { + switch_ivr_dmachine_ping(session->dmachine, NULL); + } + if (switch_channel_down(session->channel) || !switch_core_codec_ready(session->read_codec)) { *frame = NULL; status = SWITCH_STATUS_FALSE; @@ -1150,6 +1154,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_recv_dtmf(switch_core_sessio switch_io_event_hook_recv_dtmf_t *ptr; switch_status_t status; switch_dtmf_t new_dtmf; + int fed = 0; if (switch_channel_down(session->channel)) { return SWITCH_STATUS_FALSE; @@ -1171,12 +1176,19 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_recv_dtmf(switch_core_sessio new_dtmf.duration = switch_core_default_dtmf_duration(0); } + if (session->dmachine && !switch_channel_test_flag(session->channel, CF_BROADCAST)) { + char str[2] = { dtmf->digit, '\0' }; + switch_ivr_dmachine_feed(session->dmachine, str, NULL); + fed = 1; + } + for (ptr = session->event_hooks.recv_dtmf; ptr; ptr = ptr->next) { if ((status = ptr->recv_dtmf(session, &new_dtmf, SWITCH_DTMF_RECV)) != SWITCH_STATUS_SUCCESS) { return status; } } - return SWITCH_STATUS_SUCCESS; + + return fed ? SWITCH_STATUS_FALSE : SWITCH_STATUS_SUCCESS; } SWITCH_DECLARE(switch_status_t) switch_core_session_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf) diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 9e942fe..c8aca7d 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -38,6 +38,16 @@ struct switch_session_manager session_manager; +SWITCH_DECLARE(void) switch_core_session_set_dmachine(switch_core_session_t *session, switch_ivr_dmachine_t *dmachine) +{ + session->dmachine = dmachine; +} + +SWITCH_DECLARE(switch_ivr_dmachine_t *) switch_core_session_get_dmachine(switch_core_session_t *session) +{ + return session->dmachine; +} + SWITCH_DECLARE(void) switch_core_session_soft_lock(switch_core_session_t *session, uint32_t sec) { session->soft_lock = sec; @@ -1094,6 +1104,10 @@ SWITCH_DECLARE(void) switch_core_session_perform_destroy(switch_core_session_t * switch_ivr_clear_speech_cache(*session); switch_channel_uninit((*session)->channel); + if ((*session)->dmachine) { + switch_ivr_dmachine_destroy(&(*session)->dmachine); + } + pool = (*session)->pool; //#ifndef NDEBUG //memset(*session, 0, sizeof(switch_core_session_t)); diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 04972b3..57b4569 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -150,10 +150,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_bind(switch_ivr_dmachine_t * } if (binding->is_regex) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "binding regex: %s key: %.4d callback: %p data: %p\n", + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "binding regex: %s key: %.4d callback: %p data: %p\n", digits, key, (void *)(intptr_t) callback, user_data); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "binding digits: %4s key: %.4d callback: %p data: %p\n", + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "binding digits: %4s key: %.4d callback: %p data: %p\n", digits, key, (void *)(intptr_t) callback, user_data); } @@ -264,27 +264,25 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t * switch_bool_t is_timeout = switch_ivr_dmachine_check_timeout(dmachine); dm_match_t is_match = switch_ivr_dmachine_check_match(dmachine, is_timeout); switch_status_t r; - + int exec = 0; + if (zstr(dmachine->digits) && !is_timeout) { r = SWITCH_STATUS_SUCCESS; } else if (dmachine->cur_digit_len > dmachine->max_digit_len) { r = SWITCH_STATUS_FALSE; } else if (is_match == DM_MATCH_EXACT || (is_match == DM_MATCH_BOTH && is_timeout)) { r = SWITCH_STATUS_FOUND; - + dmachine->match.match_digits = dmachine->last_matching_digits; dmachine->match.match_key = dmachine->last_matching_binding->key; dmachine->match.user_data = dmachine->last_matching_binding->user_data; - - if (dmachine->last_matching_binding->callback) { - dmachine->last_matching_binding->callback(&dmachine->match); - } - + if (match_p) { *match_p = &dmachine->match; } dmachine->is_match = 1; + exec = 1; } else if (is_timeout) { r = SWITCH_STATUS_TIMEOUT; } else if (dmachine->cur_digit_len == dmachine->max_digit_len) { @@ -297,6 +295,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t * switch_ivr_dmachine_clear(dmachine); } + if (exec && dmachine->last_matching_binding->callback) { + dmachine->last_matching_binding->callback(&dmachine->match); + } + return r; } @@ -2501,7 +2503,7 @@ static void *SWITCH_THREAD_FUNC bcast_thread(switch_thread_t *thread, void *obj) return NULL; } -static void broadcast_in_thread(switch_core_session_t *session, const char *app, int flags) +SWITCH_DECLARE(void) switch_ivr_broadcast_in_thread(switch_core_session_t *session, const char *app, int flags) { switch_thread_t *thread; switch_threadattr_t *thd_attr = NULL; @@ -2606,7 +2608,7 @@ static switch_status_t meta_on_dtmf(switch_core_session_t *session, const switch switch_channel_get_name(channel), dtmf->digit, md->sr[direction].map[dval].app); if (switch_channel_test_flag(channel, CF_PROXY_MODE)) { - broadcast_in_thread(session, md->sr[direction].map[dval].app, flags | SMF_REBRIDGE); + switch_ivr_broadcast_in_thread(session, md->sr[direction].map[dval].app, flags | SMF_REBRIDGE); } else { switch_ivr_broadcast(switch_core_session_get_uuid(session), md->sr[direction].map[dval].app, flags); } diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index f92e254..165df88 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -468,6 +468,10 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) continue; } + if (switch_channel_test_flag(chan_a, CF_BRIDGE_NOWRITE)) { + continue; + } + if (status != SWITCH_STATUS_BREAK && !switch_channel_test_flag(chan_a, CF_HOLD)) { if (switch_core_session_write_frame(session_b, read_frame, SWITCH_IO_FLAG_NONE, stream_id) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, @@ -839,13 +843,26 @@ static switch_status_t hanguphook(switch_core_session_t *session) { switch_core_session_message_t msg = { 0 }; switch_channel_t *channel = NULL; + switch_event_t *event; + switch_channel_state_t state; channel = switch_core_session_get_channel(session); + state = switch_channel_get_state(channel); msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE; msg.from = __FILE__; msg.string_arg = switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE); + if (state == CS_ROUTING) { + if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) { + switch_channel_clear_flag_recursive(channel, CF_BRIDGE_ORIGINATOR); + if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == SWITCH_STATUS_SUCCESS) { + switch_channel_event_set_data(channel, event); + switch_event_fire(&event); + } + } + } + switch_core_session_receive_message(session, &msg); switch_core_event_hook_remove_state_change(session, hanguphook); @@ -859,6 +876,7 @@ static switch_status_t signal_bridge_on_hibernate(switch_core_session_t *session const char *key; switch_core_session_message_t msg = { 0 }; switch_event_t *event = NULL; + switch_ivr_dmachine_t *dmachine; channel = switch_core_session_get_channel(session); switch_assert(channel != NULL); @@ -886,6 +904,19 @@ static switch_status_t signal_bridge_on_hibernate(switch_core_session_t *session } } + if ((dmachine = switch_core_session_get_dmachine(session))) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, + "%s not hibernating due to active digit parser, semi-hibernation engaged.\n", switch_channel_get_name(channel)); + + while(switch_channel_ready(channel) && switch_channel_get_state(channel) == CS_HIBERNATE) { + if (!switch_channel_test_flag(channel, CF_BROADCAST)) { + switch_ivr_dmachine_ping(dmachine, NULL); + } + switch_yield(20000); + } + } + + return SWITCH_STATUS_SUCCESS; } commit 82f268cce628c205573ae6a77a477c9d961d7844 Author: Michal Bielicki <michal.bielicki@seventhsignal.de> Date: Thu Oct 7 23:35:00 2010 +0200 celt is now 0.7.1 so bumped it up in spec file diff --git a/freeswitch.spec b/freeswitch.spec index 52e6226..c4bfa84 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -54,7 +54,7 @@ Vendor: http://www.freeswitch.org/ # ###################################################################################################################### Source0: http://files.freeswitch.org/%{name}-%{version}.tar.bz2 -Source1: http://files.freeswitch.org/downloads/libs/celt-0.7.0.tar.gz +Source1: http://files.freeswitch.org/downloads/libs/celt-0.7.1.tar.gz Source2: http://files.freeswitch.org/downloads/libs/flite-1.3.99-latest.tar.gz Source3: http://files.freeswitch.org/downloads/libs/lame-3.97.tar.gz Source4: http://files.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz commit 3cead32f1305660731127091dfcba692cf87637f Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Oct 7 15:51:56 2010 -0500 presence again diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index b47fbd8..55b0c5c 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -571,22 +571,22 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) switch_safe_free(sql); - sql = switch_mprintf("select sip_registrations.sip_user, sip_registrations.orig_hostname, sip_registrations.status, " + sql = switch_mprintf("select sip_registrations.sip_user, sip_registrations.sip_host, sip_registrations.status, " "sip_registrations.rpid,'', sip_dialogs.uuid, sip_dialogs.state, sip_dialogs.direction, " "sip_dialogs.sip_to_user, sip_dialogs.sip_to_host, sip_presence.status,sip_presence.rpid,sip_presence.open_closed," "'%q','%q' " "from sip_registrations left join sip_dialogs on " "(sip_dialogs.sip_from_user = sip_registrations.sip_user " - "and (sip_dialogs.sip_from_host = sip_registrations.orig_hostname or " + "and (sip_dialogs.sip_from_host = sip_registrations.orig_server_host or " "sip_dialogs.sip_from_host = sip_registrations.sip_host) ) " "left join sip_presence on " - "(sip_registrations.sip_user=sip_presence.sip_user and sip_registrations.orig_hostname=sip_presence.sip_host and " + "(sip_registrations.sip_user=sip_presence.sip_user and sip_registrations.orig_server_host=sip_presence.sip_host and " "sip_registrations.profile_name=sip_presence.profile_name) " "where sip_registrations.sip_user='%q' and " - "(sip_registrations.orig_hostname='%q' or sip_registrations.sip_host='%q' " + "(sip_registrations.orig_server_host='%q' or sip_registrations.sip_host='%q' " "or sip_registrations.presence_hosts like '%%%q%%')", dh.status, dh.rpid, probe_euser, probe_host, probe_host, probe_host); switch_assert(sql); commit 53be013a5d2539918829938770486d76b48e8443 Author: Mathieu Parent <math.parent@gmail.com> Date: Thu Oct 7 21:24:37 2010 +0200 Skinny: Correct OffHook softkeys diff --git a/conf/skinny_profiles/internal.xml b/conf/skinny_profiles/internal.xml index 5feac1f..52da897 100644 --- a/conf/skinny_profiles/internal.xml +++ b/conf/skinny_profiles/internal.xml @@ -16,7 +16,7 @@ <soft-key-set-sets> <soft-key-set-set name="default"> <soft-key-set name="KeySetOnHook" value="SoftkeyNewcall,SoftkeyRedial"/> - <soft-key-set name="KeySetOffHook" value=",SoftkeyNewcall,SoftkeyEndcall"/> + <soft-key-set name="KeySetOffHook" value=",SoftkeyRedial,SoftkeyEndcall"/> <soft-key-set name="KeySetDigitsAfterDialingFirstDigit" value="SoftkeyBackspace,,SoftkeyEndcall"/> <soft-key-set name="KeySetConnected" value="SoftkeyEndcall,SoftkeyHold,SoftkeyNewcall,SoftkeyTransfer"/> <soft-key-set name="KeySetRingIn" value="SoftkeyAnswer,SoftkeyEndcall,SoftkeyNewcall"/> commit 4455d5812f4d5bb5ec90e47dc2e4a8e56ce59034 Author: Konrad Hammel <konrad@sangoma.com> Date: Thu Oct 7 14:47:45 2010 -0400 freetdm: ss7 - added support to control mtp2, mtp3, and isup timers via freetdm.conf.xml diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c index 8427820..359055f 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c @@ -47,6 +47,23 @@ typedef struct sng_timeslot int hole; }sng_timeslot_t; +typedef struct sng_isupCkt +{ + ftdm_span_t *span; + uint32_t cicbase; + uint32_t typeCntrl; + char ch_map[MAX_CIC_MAP_LENGTH]; + uint32_t isupInf; + uint32_t t3; + uint32_t t12; + uint32_t t13; + uint32_t t14; + uint32_t t15; + uint32_t t16; + uint32_t t17; + uint32_t tval; +} sng_isupCkt_t; + int cmbLinkSetId; /******************************************************************************/ @@ -77,7 +94,7 @@ static int ftmod_ss7_fill_in_isap(sng_isap_t *sng_isap); static int ftmod_ss7_fill_in_self_route(int spc, int linkType, int switchType, int ssf); -static int ftmod_ss7_fill_in_circuits(char *ch_map, int cicbase, int typeCntrl, int isup_id, ftdm_span_t *span); +static int ftmod_ss7_fill_in_circuits(sng_isupCkt_t *isupCkt); static int ftmod_ss7_next_timeslot(char *ch_map, sng_timeslot_t *timeslot); /******************************************************************************/ @@ -91,9 +108,10 @@ int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *spa const char *val = NULL; ftdm_conf_node_t *ptr = NULL; sng_route_t self_route; - char ch_map[MAX_CIC_MAP_LENGTH]; - int typeCntrl = 0; - int cicbase = 0; + sng_isupCkt_t isupCkt; + + /* clean out the isup ckt */ + memset(&isupCkt, 0x0, sizeof(sng_isupCkt_t)); /* clean out the self route */ memset(&self_route, 0x0, sizeof(sng_route_t)); @@ -124,24 +142,24 @@ int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *spa if (!strcasecmp(var, "ch_map")) { /**********************************************************************/ - strcpy(ch_map, val); - SS7_DEBUG("\tFound channel map \"%s\"\n", ch_map); + strcpy(isupCkt.ch_map, val); + SS7_DEBUG("\tFound channel map \"%s\"\n", isupCkt.ch_map); /**********************************************************************/ } else if (!strcasecmp(var, "typeCntrl")) { if (!strcasecmp(val, "bothway")) { - typeCntrl = BOTHWAY; + isupCkt.typeCntrl = BOTHWAY; SS7_DEBUG("\tFound control type \"bothway\"\n"); } else if (!strcasecmp(val, "incoming")) { - typeCntrl = INCOMING; + isupCkt.typeCntrl = INCOMING; SS7_DEBUG("\tFound control type \"incoming\"\n"); } else if (!strcasecmp(val, "outgoing")) { - typeCntrl = OUTGOING; + isupCkt.typeCntrl = OUTGOING; SS7_DEBUG("\tFound control type \"outgoing\"\n"); } else if (!strcasecmp(val, "controlled")) { - typeCntrl = CONTROLLED; + isupCkt.typeCntrl = CONTROLLED; SS7_DEBUG("\tFound control type \"controlled\"\n"); } else if (!strcasecmp(val, "controlling")) { - typeCntrl = CONTROLLING; + isupCkt.typeCntrl = CONTROLLING; SS7_DEBUG("\tFound control type \"controlling\"\n"); } else { SS7_ERROR("Found invalid circuit control type \"%s\"!", val); @@ -149,8 +167,8 @@ int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *spa } /**********************************************************************/ } else if (!strcasecmp(var, "cicbase")) { - cicbase = atoi(val); - SS7_DEBUG("\tFound cicbase = %d\n", cicbase); + isupCkt.cicbase = atoi(val); + SS7_DEBUG("\tFound cicbase = %d\n", isupCkt.cicbase); /**********************************************************************/ } else if (!strcasecmp(var, "dialplan")) { /* do i give a shit about this??? */ @@ -169,7 +187,41 @@ int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *spa /* move on to the next one */ x++; } - SS7_DEBUG("\tFound isup_interface = %s\n",g_ftdm_sngss7_data.cfg.isupIntf[x].name ); + + isupCkt.isupInf = x; + SS7_DEBUG("\tFound isup_interface = %s\n",g_ftdm_sngss7_data.cfg.isupIntf[x].name); + /**********************************************************************/ + } else if (!strcasecmp(var, "isup.t3")) { + isupCkt.t3 = atoi(val); + SS7_DEBUG("\tFound isup t3 = \"%d\"\n", isupCkt.t3); + /**********************************************************************/ + } else if (!strcasecmp(var, "isup.t12")) { + isupCkt.t12 = atoi(val); + SS7_DEBUG("\tFound isup t12 = \"%d\"\n", isupCkt.t12); + /**********************************************************************/ + } else if (!strcasecmp(var, "isup.t13")) { + isupCkt.t13 = atoi(val); + SS7_DEBUG("\tFound isup t13 = \"%d\"\n", isupCkt.t13); + /**********************************************************************/ + } else if (!strcasecmp(var, "isup.t14")) { + isupCkt.t14 = atoi(val); + SS7_DEBUG("\tFound isup t14 = \"%d\"\n", isupCkt.t14); + /**********************************************************************/ + } else if (!strcasecmp(var, "isup.t15")) { + isupCkt.t15 = atoi(val); + SS7_DEBUG("\tFound isup t15 = \"%d\"\n", isupCkt.t15); + /**********************************************************************/ + } else if (!strcasecmp(var, "isup.t16")) { + isupCkt.t16 = atoi(val); + SS7_DEBUG("\tFound isup t16 = \"%d\"\n", isupCkt.t16); + /**********************************************************************/ + } else if (!strcasecmp(var, "isup.t17")) { + isupCkt.t17 = atoi(val); + SS7_DEBUG("\tFound isup t17 = \"%d\"\n", isupCkt.t17); + /**********************************************************************/ + } else if (!strcasecmp(var, "isup.tval")) { + isupCkt.tval = atoi(val); + SS7_DEBUG("\tFound isup tval = \"%d\"\n", isupCkt.tval); /**********************************************************************/ } else { SS7_ERROR("Unknown parameter found =\"%s\"...ignoring it!\n", var); @@ -192,10 +244,11 @@ int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *spa } + /* fill the pointer to span into isupCkt */ + isupCkt.span = span; /* setup the circuits structure */ - if(ftmod_ss7_fill_in_circuits(ch_map, cicbase, typeCntrl, - g_ftdm_sngss7_data.cfg.isupIntf[x].id, span)) { + if(ftmod_ss7_fill_in_circuits(&isupCkt)) { SS7_ERROR("Failed to fill in circuits structure!\n"); goto ftmod_ss7_parse_xml_error; } @@ -582,6 +635,130 @@ static int ftmod_ss7_parse_mtp_link(ftdm_conf_node_t *mtp_link, sng_mtp_link_t * mtpLink->mtp3.slc = atoi(parm->val); SS7_DEBUG("\tFound mtpLink->slc = \"%d\"\n",mtpLink->mtp3.slc); /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp2.t1")) { + mtpLink->mtp2.t1 = atoi(parm->val); + SS7_DEBUG("\tFound mtp2 t1 = \"%d\"\n",mtpLink->mtp2.t1); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp2.t2")) { + mtpLink->mtp2.t2 = atoi(parm->val); + SS7_DEBUG("\tFound mtp2 t2 = \"%d\"\n",mtpLink->mtp2.t2); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp2.t3")) { + mtpLink->mtp2.t3 = atoi(parm->val); + SS7_DEBUG("\tFound mtp2 t3 = \"%d\"\n",mtpLink->mtp2.t3); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp2.t4n")) { + mtpLink->mtp2.t4n = atoi(parm->val); + SS7_DEBUG("\tFound mtp2 t4n = \"%d\"\n",mtpLink->mtp2.t4n); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp2.t4e")) { + mtpLink->mtp2.t4e = atoi(parm->val); + SS7_DEBUG("\tFound mtp2 t4e = \"%d\"\n",mtpLink->mtp2.t4e); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp2.t5")) { + mtpLink->mtp2.t5 = atoi(parm->val); + SS7_DEBUG("\tFound mtp2 t5 = \"%d\"\n",mtpLink->mtp2.t5); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp2.t6")) { + mtpLink->mtp2.t6 = atoi(parm->val); + SS7_DEBUG("\tFound mtp2 t6 = \"%d\"\n",mtpLink->mtp2.t6); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp2.t7")) { + mtpLink->mtp2.t7 = atoi(parm->val); + SS7_DEBUG("\tFound mtp2 t7 = \"%d\"\n",mtpLink->mtp2.t7); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t1")) { + mtpLink->mtp3.t1 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t1 = \"%d\"\n",mtpLink->mtp3.t1); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t2")) { + mtpLink->mtp3.t2 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t2 = \"%d\"\n",mtpLink->mtp3.t2); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t3")) { + mtpLink->mtp3.t3 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t3 = \"%d\"\n",mtpLink->mtp3.t3); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t4")) { + mtpLink->mtp3.t4 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t4 = \"%d\"\n",mtpLink->mtp3.t4); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t5")) { + mtpLink->mtp3.t5 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t5 = \"%d\"\n",mtpLink->mtp3.t5); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t7")) { + mtpLink->mtp3.t7 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t7 = \"%d\"\n",mtpLink->mtp3.t7); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t12")) { + mtpLink->mtp3.t12 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t12 = \"%d\"\n",mtpLink->mtp3.t12); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t13")) { + mtpLink->mtp3.t13 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t13 = \"%d\"\n",mtpLink->mtp3.t13); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t14")) { + mtpLink->mtp3.t14 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t14 = \"%d\"\n",mtpLink->mtp3.t14); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t17")) { + mtpLink->mtp3.t17 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t17 = \"%d\"\n",mtpLink->mtp3.t17); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t22")) { + mtpLink->mtp3.t22 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t22 = \"%d\"\n",mtpLink->mtp3.t22); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t23")) { + mtpLink->mtp3.t23 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t23 = \"%d\"\n",mtpLink->mtp3.t23); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t24")) { + mtpLink->mtp3.t24 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t24 = \"%d\"\n",mtpLink->mtp3.t24); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t31")) { + mtpLink->mtp3.t31 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t31 = \"%d\"\n",mtpLink->mtp3.t31); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t32")) { + mtpLink->mtp3.t32 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t32 = \"%d\"\n",mtpLink->mtp3.t32); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t33")) { + mtpLink->mtp3.t33 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t33 = \"%d\"\n",mtpLink->mtp3.t33); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t34")) { + mtpLink->mtp3.t34 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t34 = \"%d\"\n",mtpLink->mtp3.t34); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t35")) { + mtpLink->mtp3.t35 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t35 = \"%d\"\n",mtpLink->mtp3.t35); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t36")) { + mtpLink->mtp3.t36 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t36 = \"%d\"\n",mtpLink->mtp3.t36); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t37")) { + mtpLink->mtp3.t37 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t37 = \"%d\"\n",mtpLink->mtp3.t37); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.tcraft")) { + mtpLink->mtp3.tcraft = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 tcraft = \"%d\"\n",mtpLink->mtp3.tcraft); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.tflc")) { + mtpLink->mtp3.tflc = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 tflc = \"%d\"\n",mtpLink->mtp3.tflc); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.tbnd")) { + mtpLink->mtp3.tbnd = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 tbnd = \"%d\"\n",mtpLink->mtp3.tbnd); + /**********************************************************************/ } else { SS7_ERROR("\tFound an invalid parameter \"%s\"!\n", parm->val); return FTDM_FAIL; @@ -697,6 +874,50 @@ static int ftmod_ss7_parse_mtp_route(ftdm_conf_node_t *mtp_route) return FTDM_FAIL; } /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t6")) { + mtpRoute.t6 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t6 = \"%d\"\n",mtpRoute.t6); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t8")) { + mtpRoute.t8 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t8 = \"%d\"\n",mtpRoute.t8); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t10")) { + mtpRoute.t10 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t10 = \"%d\"\n",mtpRoute.t10); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t11")) { + mtpRoute.t11 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t11 = \"%d\"\n",mtpRoute.t11); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t15")) { + mtpRoute.t15 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t15 = \"%d\"\n",mtpRoute.t15); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t16")) { + mtpRoute.t16 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t16 = \"%d\"\n",mtpRoute.t16); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t18")) { + mtpRoute.t18 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t18 = \"%d\"\n",mtpRoute.t18); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t19")) { + mtpRoute.t19 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t19 = \"%d\"\n",mtpRoute.t19); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t21")) { + mtpRoute.t21 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t21 = \"%d\"\n",mtpRoute.t21); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t25")) { + mtpRoute.t25 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t25 = \"%d\"\n",mtpRoute.t25); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp3.t26")) { + mtpRoute.t26 = atoi(parm->val); + SS7_DEBUG("\tFound mtp3 t26 = \"%d\"\n",mtpRoute.t26); + /**********************************************************************/ } else { SS7_ERROR("\tFound an invalid parameter \"%s\"!\n", parm->val); return FTDM_FAIL; @@ -842,6 +1063,178 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface) SS7_DEBUG("\tFound license file = %s\n", g_ftdm_sngss7_data.cfg.license); SS7_DEBUG("\tFound signature file = %s\n", g_ftdm_sngss7_data.cfg.signature); /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t1")) { + sng_isap.t1 = atoi(parm->val); + SS7_DEBUG("\tFound isup t1 = \"%d\"\n",sng_isap.t1); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t2")) { + sng_isap.t2 = atoi(parm->val); + SS7_DEBUG("\tFound isup t2 = \"%d\"\n",sng_isap.t2); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t4")) { + sng_isup.t4 = atoi(parm->val); + SS7_DEBUG("\tFound isup t4 = \"%d\"\n",sng_isup.t4); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t5")) { + sng_isap.t5 = atoi(parm->val); + SS7_DEBUG("\tFound isup t5 = \"%d\"\n",sng_isap.t5); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t6")) { + sng_isap.t6 = atoi(parm->val); + SS7_DEBUG("\tFound isup t6 = \"%d\"\n",sng_isap.t6); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t7")) { + sng_isap.t7 = atoi(parm->val); + SS7_DEBUG("\tFound isup t7 = \"%d\"\n",sng_isap.t7); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t8")) { + sng_isap.t8 = atoi(parm->val); + SS7_DEBUG("\tFound isup t8 = \"%d\"\n",sng_isap.t8); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t9")) { + sng_isap.t9 = atoi(parm->val); + SS7_DEBUG("\tFound isup t9 = \"%d\"\n",sng_isap.t9); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t10")) { + sng_isup.t10 = atoi(parm->val); + SS7_DEBUG("\tFound isup t10 = \"%d\"\n",sng_isup.t10); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t11")) { + sng_isup.t11 = atoi(parm->val); + SS7_DEBUG("\tFound isup t11 = \"%d\"\n",sng_isup.t11); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t18")) { + sng_isup.t18 = atoi(parm->val); + SS7_DEBUG("\tFound isup t18 = \"%d\"\n",sng_isup.t18); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t19")) { + sng_isup.t19 = atoi(parm->val); + SS7_DEBUG("\tFound isup t19 = \"%d\"\n",sng_isup.t19); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t20")) { + sng_isup.t20 = atoi(parm->val); + SS7_DEBUG("\tFound isup t20 = \"%d\"\n",sng_isup.t20); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t21")) { + sng_isup.t21 = atoi(parm->val); + SS7_DEBUG("\tFound isup t21 = \"%d\"\n",sng_isup.t21); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t22")) { + sng_isup.t22 = atoi(parm->val); + SS7_DEBUG("\tFound isup t22 = \"%d\"\n",sng_isup.t22); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t23")) { + sng_isup.t23 = atoi(parm->val); + SS7_DEBUG("\tFound isup t23 = \"%d\"\n",sng_isup.t23); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t24")) { + sng_isup.t24 = atoi(parm->val); + SS7_DEBUG("\tFound isup t24 = \"%d\"\n",sng_isup.t24); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t25")) { + sng_isup.t25 = atoi(parm->val); + SS7_DEBUG("\tFound isup t25 = \"%d\"\n",sng_isup.t25); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t26")) { + sng_isup.t26 = atoi(parm->val); + SS7_DEBUG("\tFound isup t26 = \"%d\"\n",sng_isup.t26); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t28")) { + sng_isup.t28 = atoi(parm->val); + SS7_DEBUG("\tFound isup t28 = \"%d\"\n",sng_isup.t28); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t29")) { + sng_isup.t29 = atoi(parm->val); + SS7_DEBUG("\tFound isup t29 = \"%d\"\n",sng_isup.t29); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t30")) { + sng_isup.t30 = atoi(parm->val); + SS7_DEBUG("\tFound isup t30 = \"%d\"\n",sng_isup.t30); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t31")) { + sng_isap.t31 = atoi(parm->val); + SS7_DEBUG("\tFound isup t31 = \"%d\"\n",sng_isap.t31); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t32")) { + sng_isup.t32 = atoi(parm->val); + SS7_DEBUG("\tFound isup t32 = \"%d\"\n",sng_isup.t32); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t33")) { + sng_isap.t33 = atoi(parm->val); + SS7_DEBUG("\tFound isup t33 = \"%d\"\n",sng_isap.t33); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t34")) { + sng_isap.t34 = atoi(parm->val); + SS7_DEBUG("\tFound isup t34 = \"%d\"\n",sng_isap.t34); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t35")) { + sng_isup.t35 = atoi(parm->val); + SS7_DEBUG("\tFound isup t35 = \"%d\"\n",sng_isup.t35); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t36")) { + sng_isap.t36 = atoi(parm->val); + SS7_DEBUG("\tFound isup t36 = \"%d\"\n",sng_isap.t36); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t37")) { + sng_isup.t37 = atoi(parm->val); + SS7_DEBUG("\tFound isup t37 = \"%d\"\n",sng_isup.t37); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t38")) { + sng_isup.t38 = atoi(parm->val); + SS7_DEBUG("\tFound isup t38 = \"%d\"\n",sng_isup.t38); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.t39")) { + sng_isup.t39 = atoi(parm->val); + SS7_DEBUG("\tFound isup t39 = \"%d\"\n",sng_isup.t39); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.tccr")) { + sng_isap.tccr = atoi(parm->val); + SS7_DEBUG("\tFound isup tccr = \"%d\"\n",sng_isap.tccr); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.tccrt")) { + sng_isap.tccrt = atoi(parm->val); + SS7_DEBUG("\tFound isup tccrt = \"%d\"\n",sng_isap.tccrt); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.tex")) { + sng_isap.tex = atoi(parm->val); + SS7_DEBUG("\tFound isup tex = \"%d\"\n",sng_isap.tex); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.tect")) { + sng_isap.tect = atoi(parm->val); + SS7_DEBUG("\tFound isup tect = \"%d\"\n",sng_isap.tect); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.tcrm")) { + sng_isap.tcrm = atoi(parm->val); + SS7_DEBUG("\tFound isup tcrm = \"%d\"\n",sng_isap.tcrm); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.tcra")) { + sng_isap.tcra = atoi(parm->val); + SS7_DEBUG("\tFound isup tcra = \"%d\"\n",sng_isap.tcra); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.tfgr")) { + sng_isup.tfgr = atoi(parm->val); + SS7_DEBUG("\tFound isup tfgr = \"%d\"\n",sng_isup.tfgr); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.trelrsp")) { + sng_isap.trelrsp = atoi(parm->val); + SS7_DEBUG("\tFound isup trelrsp = \"%d\"\n",sng_isap.trelrsp); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.tfnlrelrsp")) { + sng_isap.tfnlrelrsp = atoi(parm->val); + SS7_DEBUG("\tFound isup tfnlrelrsp = \"%d\"\n",sng_isap.tfnlrelrsp); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.tfnlrelrsp")) { + sng_isap.tfnlrelrsp = atoi(parm->val); + SS7_DEBUG("\tFound isup tfnlrelrsp = \"%d\"\n",sng_isap.tfnlrelrsp); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.tpause")) { + sng_isup.tpause = atoi(parm->val); + SS7_DEBUG("\tFound isup tpause = \"%d\"\n",sng_isup.tpause); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isup.tstaenq")) { + sng_isup.tstaenq = atoi(parm->val); + SS7_DEBUG("\tFound isup tstaenq = \"%d\"\n",sng_isup.tstaenq); + /**********************************************************************/ } else if (!strcasecmp(parm->var, "clg_nadi")) { /**********************************************************************/ /* throw the flag so that we know we got this optional parameter */ @@ -1573,7 +1966,7 @@ static int ftmod_ss7_fill_in_self_route(int spc, int linkType, int switchType, i } /******************************************************************************/ -static int ftmod_ss7_fill_in_circuits(char *ch_map, int cicbase, int typeCntrl, int isup_id, ftdm_span_t *span) +static int ftmod_ss7_fill_in_circuits(sng_isupCkt_t *isupCkt) { sngss7_chan_data_t *ss7_info = NULL; ftdm_channel_t *ftdmchan = NULL; @@ -1584,10 +1977,10 @@ static int ftmod_ss7_fill_in_circuits(char *ch_map, int cicbase, int typeCntrl, count = 1; - while (ch_map[0] != '\0') { + while (isupCkt->ch_map[0] != '\0') { /* pull out the next timeslot */ - if (ftmod_ss7_next_timeslot(ch_map, ×lot)) { + if (ftmod_ss7_next_timeslot(isupCkt->ch_map, ×lot)) { SS7_ERROR("Failed to parse the channel map!\n"); return FTDM_FAIL; } @@ -1597,10 +1990,10 @@ static int ftmod_ss7_fill_in_circuits(char *ch_map, int cicbase, int typeCntrl, x = 1; while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { if ((g_ftdm_sngss7_data.cfg.isupCkt[x].chan == count) && - (g_ftdm_sngss7_data.cfg.isupCkt[x].span == span->channels[1]->physical_span_id)) { + (g_ftdm_sngss7_data.cfg.isupCkt[x].span == isupCkt->span->channels[1]->physical_span_id)) { SS7_DEVEL_DEBUG("Circuit for span=%d, chan=%d is already exists...id=%d\n", - span->channels[1]->physical_span_id, + isupCkt->span->channels[1]->physical_span_id, count, x); @@ -1614,7 +2007,7 @@ static int ftmod_ss7_fill_in_circuits(char *ch_map, int cicbase, int typeCntrl, /* check why we exited the while loop */ if (g_ftdm_sngss7_data.cfg.isupCkt[x].id == 0) { SS7_DEVEL_DEBUG("Circuit for span=%d, chan=%d is new...id=%d\n", - span->channels[1]->physical_span_id, + isupCkt->span->channels[1]->physical_span_id, count, x); @@ -1625,7 +2018,7 @@ static int ftmod_ss7_fill_in_circuits(char *ch_map, int cicbase, int typeCntrl, /* circuit is new so fill in the needed information */ g_ftdm_sngss7_data.cfg.isupCkt[x].id = x; - g_ftdm_sngss7_data.cfg.isupCkt[x].span = span->channels[1]->physical_span_id; + g_ftdm_sngss7_data.cfg.isupCkt[x].span = isupCkt->span->channels[1]->physical_span_id; g_ftdm_sngss7_data.cfg.isupCkt[x].chan = count; if (timeslot.siglink) { g_ftdm_sngss7_data.cfg.isupCkt[x].type = SIG; @@ -1634,22 +2027,14 @@ static int ftmod_ss7_fill_in_circuits(char *ch_map, int cicbase, int typeCntrl, } if (timeslot.channel) { - g_ftdm_sngss7_data.cfg.isupCkt[x].cic = cicbase; - cicbase++; + g_ftdm_sngss7_data.cfg.isupCkt[x].cic = isupCkt->cicbase; + isupCkt->cicbase++; } else { g_ftdm_sngss7_data.cfg.isupCkt[x].cic = 0; } - g_ftdm_sngss7_data.cfg.isupCkt[x].infId = isup_id; - g_ftdm_sngss7_data.cfg.isupCkt[x].typeCntrl = typeCntrl; - g_ftdm_sngss7_data.cfg.isupCkt[x].t3 = 1200; - g_ftdm_sngss7_data.cfg.isupCkt[x].t12 = 300; - g_ftdm_sngss7_data.cfg.isupCkt[x].t13 = 3000; - g_ftdm_sngss7_data.cfg.isupCkt[x].t14 = 300; - g_ftdm_sngss7_data.cfg.isupCkt[x].t15 = 3000; - g_ftdm_sngss7_data.cfg.isupCkt[x].t16 = 300; - g_ftdm_sngss7_data.cfg.isupCkt[x].t17 = 3000; - g_ftdm_sngss7_data.cfg.isupCkt[x].tval = 10; - g_ftdm_sngss7_data.cfg.isupCkt[x].ssf = g_ftdm_sngss7_data.cfg.isupIntf[isup_id].ssf; + g_ftdm_sngss7_data.cfg.isupCkt[x].infId = isupCkt->isupInf; + g_ftdm_sngss7_data.cfg.isupCkt[x].typeCntrl = isupCkt->typeCntrl; + g_ftdm_sngss7_data.cfg.isupCkt[x].ssf = g_ftdm_sngss7_data.cfg.isupIntf[isupCkt->isupInf].ssf; g_ftdm_sngss7_data.cfg.isupCkt[x].obj = ss7_info; } /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].id == 0) */ @@ -1660,26 +2045,26 @@ static int ftmod_ss7_fill_in_circuits(char *ch_map, int cicbase, int typeCntrl, } else { /* if ((timeslot.siglink) || (timeslot.gap)) */ /* find the ftdm the channel structure for this channel*/ i = 1; - while (span->channels[i] != NULL) { - if (span->channels[i]->physical_chan_id == timeslot.channel) { + while (isupCkt->span->channels[i] != NULL) { + if (isupCkt->span->channels[i]->physical_chan_id == timeslot.channel) { break; } i++; } /* while (span->channels[i] != NULL) */ - if (span->channels[i] == NULL) { + if (isupCkt->span->channels[i] == NULL) { /* we weren't able to find the channel in the ftdm channels */ SS7_ERROR("Unable to find the requested channel %d in the FreeTDM channels!\n", timeslot.channel); return FTDM_FAIL; } else { - ftdmchan = span->channels[i]; + ftdmchan = isupCkt->span->channels[i]; } /* try to find a match for the physical span and chan */ x = 1; while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { - if ((g_ftdm_sngss7_data.cfg.isupCkt[x].chan == ftdmchan->physical_chan_id) - && (g_ftdm_sngss7_data.cfg.isupCkt[x].span == ftdmchan->physical_span_id)) { + if ((g_ftdm_sngss7_data.cfg.isupCkt[x].chan == ftdmchan->physical_chan_id) && + (g_ftdm_sngss7_data.cfg.isupCkt[x].span == ftdmchan->physical_span_id)) { /* we have a match so this circuit already exists in the structure */ break; @@ -1702,33 +2087,65 @@ static int ftmod_ss7_fill_in_circuits(char *ch_map, int cicbase, int typeCntrl, ftdmchan->call_data = ss7_info; /* prepare the timer structures */ - ss7_info->t35.sched = ((sngss7_span_data_t *)span->mod_data)->sched; + ss7_info->t35.sched = ((sngss7_span_data_t *)isupCkt->span->mod_data)->sched; ss7_info->t35.counter = 1; - ss7_info->t35.beat = g_ftdm_sngss7_data.cfg.isupIntf[isup_id].t35*100; /* beat is in ms, t35 is in 100ms */ + ss7_info->t35.beat = g_ftdm_sngss7_data.cfg.isupIntf[isupCkt->isupInf].t35*100; /* beat is in ms, t35 is in 100ms */ ss7_info->t35.callback = handle_isup_t35; ss7_info->t35.sngss7_info = ss7_info; /* circuit is new so fill in the needed information */ - g_ftdm_sngss7_data.cfg.isupCkt[x].id = x; + g_ftdm_sngss7_data.cfg.isupCkt[x].id = x; g_ftdm_sngss7_data.cfg.isupCkt[x].span = ftdmchan->physical_span_id; g_ftdm_sngss7_data.cfg.isupCkt[x].chan = ftdmchan->physical_chan_id; g_ftdm_sngss7_data.cfg.isupCkt[x].type = VOICE; - g_ftdm_sngss7_data.cfg.isupCkt[x].cic = cicbase; - g_ftdm_sngss7_data.cfg.isupCkt[x].infId = isup_id; - g_ftdm_sngss7_data.cfg.isupCkt[x].typeCntrl = typeCntrl; - g_ftdm_sngss7_data.cfg.isupCkt[x].t3 = 1200; - g_ftdm_sngss7_data.cfg.isupCkt[x].t12 = 300; - g_ftdm_sngss7_data.cfg.isupCkt[x].t13 = 3000; - g_ftdm_sngss7_data.cfg.isupCkt[x].t14 = 300; - g_ftdm_sngss7_data.cfg.isupCkt[x].t15 = 3000; - g_ftdm_sngss7_data.cfg.isupCkt[x].t16 = 300; - g_ftdm_sngss7_data.cfg.isupCkt[x].t17 = 3000; - g_ftdm_sngss7_data.cfg.isupCkt[x].tval = 10; + g_ftdm_sngss7_data.cfg.isupCkt[x].cic = isupCkt->cicbase; + g_ftdm_sngss7_data.cfg.isupCkt[x].infId = isupCkt->isupInf; + g_ftdm_sngss7_data.cfg.isupCkt[x].typeCntrl = isupCkt->typeCntrl; + if (isupCkt->t3 == 0) { + g_ftdm_sngss7_data.cfg.isupCkt[x].t3 = 1200; + } else { + g_ftdm_sngss7_data.cfg.isupCkt[x].t3 = isupCkt->t3; + } + if (isupCkt->t12 == 0) { + g_ftdm_sngss7_data.cfg.isupCkt[x].t12 = 300; + } else { + g_ftdm_sngss7_data.cfg.isupCkt[x].t12 = isupCkt->t12; + } + if (isupCkt->t13 == 0) { + g_ftdm_sngss7_data.cfg.isupCkt[x].t13 = 3000; + } else { + g_ftdm_sngss7_data.cfg.isupCkt[x].t13 = isupCkt->t13; + } + if (isupCkt->t14 == 0) { + g_ftdm_sngss7_data.cfg.isupCkt[x].t14 = 300; + } else { + g_ftdm_sngss7_data.cfg.isupCkt[x].t14 = isupCkt->t14; + } + if (isupCkt->t15 == 0) { + g_ftdm_sngss7_data.cfg.isupCkt[x].t15 = 3000; + } else { + g_ftdm_sngss7_data.cfg.isupCkt[x].t15 = isupCkt->t15; + } + if (isupCkt->t16 == 0) { + g_ftdm_sngss7_data.cfg.isupCkt[x].t16 = 300; + } else { + g_ftdm_sngss7_data.cfg.isupCkt[x].t16 = isupCkt->t16; + } + if (isupCkt->t17 == 0) { + g_ftdm_sngss7_data.cfg.isupCkt[x].t17 = 3000; + } else { + g_ftdm_sngss7_data.cfg.isupCkt[x].t17 = isupCkt->t17; + } + if (isupCkt->tval == 0) { + g_ftdm_sngss7_data.cfg.isupCkt[x].tval = 10; + } else { + g_ftdm_sngss7_data.cfg.isupCkt[x].tval = isupCkt->tval; + } g_ftdm_sngss7_data.cfg.isupCkt[x].obj = ss7_info; - g_ftdm_sngss7_data.cfg.isupCkt[x].ssf = g_ftdm_sngss7_data.cfg.isupIntf[isup_id].ssf; + g_ftdm_sngss7_data.cfg.isupCkt[x].ssf = g_ftdm_sngss7_data.cfg.isupIntf[isupCkt->isupInf].ssf; /* increment the cicbase */ - cicbase++; + isupCkt->cicbase++; } else { /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].id == 0) */ SS7_DEBUG("Circuit for span=%d, chan=%d is new...id=%d\n", ftdmchan->physical_span_id, @@ -1774,12 +2191,12 @@ static int ftmod_ss7_fill_in_circuits(char *ch_map, int cicbase, int typeCntrl, /******************************************************************************/ static int ftmod_ss7_next_timeslot(char *ch_map, sng_timeslot_t *timeslot) { - int i; - int x; - int lower; - int upper; - char tmp[5]; /*KONRAD FIX ME*/ - char new_ch_map[MAX_CIC_LENGTH]; + int i; + int x; + int lower; + int upper; + char tmp[5]; /*KONRAD FIX ME*/ + char new_ch_map[MAX_CIC_LENGTH]; memset(&tmp[0], '\0', sizeof(tmp)); memset(&new_ch_map[0], '\0', sizeof(new_ch_map)); commit f499c0cdd7af66b9166eaa16cb190122f19d57b2 Author: Brian West <brian@freeswitch.org> Date: Thu Oct 7 10:27:25 2010 -0500 send em on over now. diff --git a/src/tone2wav.c b/src/tone2wav.c index 4415860..8d4978a 100644 --- a/src/tone2wav.c +++ b/src/tone2wav.c @@ -171,7 +171,7 @@ int main(int argc, char *argv[]) teletone_destroy_session(&ts); switch_core_file_close(&fh); - printf("File: %s generated.....\n\nPlease support:\nFreeSWITCH http://www.freeswitch.org\nClueCon http://www.cluecon.com\n", file); + printf("File: %s generated...\n\nPlease support:\nFreeSWITCH http://www.freeswitch.org\nClueCon http://www.cluecon.com\n", file); end: commit 761cec8fb1e40ff816bcfb8acd044d0018c70ef6 Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Oct 7 08:25:41 2010 -0500 FS-2766 spandsp t38 fax receiving error in win XP - regression from f029f7ef diff --git a/libs/spandsp/src/spandsp/t38_core.h b/libs/spandsp/src/spandsp/t38_core.h index 1476969..3d8e864 100644 --- a/libs/spandsp/src/spandsp/t38_core.h +++ b/libs/spandsp/src/spandsp/t38_core.h @@ -286,7 +286,7 @@ SPAN_DECLARE(int) t38_core_send_data_multi_field(t38_core_state_t *s, int data_t \param len The length of the packet contents. \param seq_no The packet sequence number. \return 0 for OK, else -1. */ -SPAN_DECLARE(int) t38_core_rx_ifp_packet(t38_core_state_t *s, const uint8_t *buf, int len, uint16_t seq_no); +SPAN_DECLARE_NONSTD(int) t38_core_rx_ifp_packet(t38_core_state_t *s, const uint8_t *buf, int len, uint16_t seq_no); /*! Set the method to be used for data rate management, as per the T.38 spec. \param s The T.38 context. diff --git a/libs/spandsp/src/t38_core.c b/libs/spandsp/src/t38_core.c index 551d6c0..e7ee967 100644 --- a/libs/spandsp/src/t38_core.c +++ b/libs/spandsp/src/t38_core.c @@ -325,7 +325,7 @@ static __inline__ int classify_seq_no_offset(int expected, int actual) } /*- End of function --------------------------------------------------------*/ -SPAN_DECLARE(int) t38_core_rx_ifp_packet(t38_core_state_t *s, const uint8_t *buf, int len, uint16_t seq_no) +SPAN_DECLARE_NONSTD(int) t38_core_rx_ifp_packet(t38_core_state_t *s, const uint8_t *buf, int len, uint16_t seq_no) { int i; int t30_indicator; commit 3bd09b34c512ee2338dfbd277123a60cc9e16ec1 Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Thu Oct 7 01:07:12 2010 -0400 mod_voicemail: Simple correction to the app description of voicemail diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 860f897..e55cd8a 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -3213,7 +3213,7 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p #define VM_DESC "voicemail" -#define VM_USAGE "[check|auth] <profile_name> <domain_name> [<id>]" +#define VM_USAGE "[check] [auth] <profile_name> <domain_name> [<id>]" SWITCH_STANDARD_APP(voicemail_function) { commit 430fb980507cf47cc9f1f97a00f1a7c284801dba Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Oct 6 16:05:00 2010 -0500 update watchdog code diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 0598624..4007187 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1310,33 +1310,40 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread } if (++loops >= 1000) { - uint32_t diff = 0, fail = 0; + - if (profile->step_timeout) { - diff = (uint32_t) ((switch_time_now() - profile->last_root_step) / 1000); - if (diff > profile->step_timeout) { - fail = 1; + + if (profile->watchdog_enabled) { + uint32_t event_diff = 0, step_diff = 0, event_fail = 0, step_fail = 0; + + if (profile->step_timeout) { + step_diff = (uint32_t) ((switch_time_now() - profile->last_root_step) / 1000); + + if (step_diff > profile->step_timeout) { + step_fail = 1; + } } - } - if (profile->event_timeout) { - diff = (uint32_t) ((switch_time_now() - profile->last_sip_event) / 1000); - if (diff > profile->event_timeout) { - fail = 1; + if (profile->event_timeout) { + event_diff = (uint32_t) ((switch_time_now() - profile->last_sip_event) / 1000); + + if (event_diff > profile->event_timeout) { + event_fail = 1; + } } - } - if (profile->watchdog_enabled && fail) { - int arg = 1; - switch_session_ctl_t command = SCSC_SHUTDOWN_NOW; + if (step_fail && profile->event_timeout && !event_fail) { + step_fail = 0; + } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Profile %s: SIP STACK FAILURE DETECTED!\n" - "GOODBYE CRUEL WORLD, I'M LEAVING YOU TODAY....GOODBYE, GOODBYE, GOOD BYE\n", profile->name); - switch_yield(2000); - switch_core_session_ctl(command, &arg); + if (event_fail || step_fail) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Profile %s: SIP STACK FAILURE DETECTED!\n" + "GOODBYE CRUEL WORLD, I'M LEAVING YOU TODAY....GOODBYE, GOODBYE, GOOD BYE\n", profile->name); + switch_yield(2000); + abort(); + } } - if (++ireg_loops >= IREG_SECONDS) { time_t now = switch_epoch_time_now(NULL); sofia_reg_check_expire(profile, now, 0); commit 6c4cb07bac6dd8ecb18759bf71fd911752bc1e08 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Oct 6 16:04:42 2010 -0500 fix memory leak caused by regression from FS-2747 diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 3a01e1e..b47fbd8 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -742,8 +742,8 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) } sofia_glue_execute_sql_callback(profile, NULL, sql, sofia_presence_sub_callback, &helper); - - + switch_safe_free(sql); + sql = switch_mprintf("update sip_subscriptions set version=version+1 where event='dialog' and sub_to_user='%q' " "and (sub_to_host='%q' or presence_hosts like '%%%q%%') " "and (profile_name = '%q' or presence_hosts != sub_to_host)", @@ -757,8 +757,6 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) event->event_id == SWITCH_EVENT_PRESENCE_IN ? "IN" : "OUT", profile->name); } - switch_safe_free(sql); - if (!zstr((char *) helper.stream.data)) { char *this_sql = (char *) helper.stream.data; char *next = NULL; commit fc55997b9e4c903ceb0ac1eb080a0defef70a26a Author: Arnaldo M Pereira <arnaldo@sangoma.com> Date: Wed Oct 6 17:51:29 2010 -0300 created cmake files for freetdm diff --git a/libs/freetdm/CMakeLists.txt b/libs/freetdm/CMakeLists.txt new file mode 100644 index 0000000..24cbf7c --- /dev/null +++ b/libs/freetdm/CMakeLists.txt @@ -0,0 +1,244 @@ +# +# cmake file that generate build files for freetdm. +# this automatically includes the tests and also +# mod_freetdm +# +# Arnaldo M Pereira <arnaldo@sangoma.com> +# +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(freetdm) + +ADD_SUBDIRECTORY(sample) +ADD_SUBDIRECTORY(mod_freetdm) + +# includes +SET(freetdm_INCLUDES + ${PROJECT_SOURCE_DIR}/src/include + ${PROJECT_SOURCE_DIR}/src/isdn/include + ${PROJECT_SOURCE_DIR}/src/include/private + ${PROJECT_SOURCE_DIR}/src/ftmod/ftmod_sangoma_boost +) +INCLUDE_DIRECTORIES(${freetdm_INCLUDES}) +LINK_DIRECTORIES(${freetdm_BINARY_DIR}) + +# optional includes +IF(DEFINED SNGSS7) + SET(freetdm_INCLUDES ${freetdm_INCLUDES} /usr/include/sng_ss7) +ENDIF(DEFINED SNGSS7) + +IF(DEFINED SNGISDN) + SET(freetdm_INCLUDES ${freetdm_INCLUDES} /usr/include/sng_isdn) +ENDIF(DEFINED SNGISDN) + +# definitions / CFLAGS +ADD_DEFINITIONS(-DFTDM_CONFIG_DIR="/FIXME" -DFTDM_MOD_DIR="/FIXME") +IF(DEFINED WIN32) + ADD_DEFINITIONS(-DFREETDM_EXPORTS -DTELETONE_EXPORTS -DMOD_EXPORTS -DDLL_EXPORTS) +ENDIF(DEFINED WIN32) +IF(DEFINED SNGISDN) + SET(freetdm_INCLUDES ${freetdm_INCLUDES} /usr/include/sng_isdn) +ENDIF(DEFINED SNGISDN) + +# lib sources +SET(freetdm_SOURCES + ${PROJECT_SOURCE_DIR}/src/hashtable.c + ${PROJECT_SOURCE_DIR}/src/hashtable_itr.c + ${PROJECT_SOURCE_DIR}/src/ftdm_io.c + ${PROJECT_SOURCE_DIR}/src/ftdm_queue.c + ${PROJECT_SOURCE_DIR}/src/ftdm_sched.c + ${PROJECT_SOURCE_DIR}/src/ftdm_call_utils.c + ${PROJECT_SOURCE_DIR}/src/ftdm_config.c + ${PROJECT_SOURCE_DIR}/src/ftdm_callerid.c + ${PROJECT_SOURCE_DIR}/src/fsk.c + ${PROJECT_SOURCE_DIR}/src/uart.c + ${PROJECT_SOURCE_DIR}/src/g711.c + ${PROJECT_SOURCE_DIR}/src/libteletone_detect.c + ${PROJECT_SOURCE_DIR}/src/libteletone_generate.c + ${PROJECT_SOURCE_DIR}/src/ftdm_buffer.c + ${PROJECT_SOURCE_DIR}/src/ftdm_threadmutex.c + ${PROJECT_SOURCE_DIR}/src/ftdm_dso.c + ${PROJECT_SOURCE_DIR}/src/ftdm_cpu_monitor.c +) + +# libfreetdm.so +ADD_LIBRARY(${PROJECT_NAME} SHARED ${freetdm_SOURCES}) + +IF(NOT DEFINED WIN32) + TARGET_LINK_LIBRARIES(${PROJECT_NAME} m pthread dl) +ENDIF(NOT DEFINED WIN32) + +REMOVE_DEFINITIONS(-DLL_EXPORTS) + +# tools & tests +IF(NOT DEFINED WIN32) + FOREACH(TOOL testtones testpri testr2 testapp testcid) + ADD_EXECUTABLE(${TOOL} ${PROJECT_SOURCE_DIR}/src/${TOOL}.c) + TARGET_LINK_LIBRARIES(${TOOL} -l${PROJECT_NAME}) + ADD_DEPENDENCIES(${TOOL} ${PROJECT_NAME}) + ENDFOREACH(TOOL) + + ADD_EXECUTABLE(detect_dtmf + ${PROJECT_SOURCE_DIR}/src/detect_dtmf.c + ${PROJECT_SOURCE_DIR}/src/libteletone_detect.c + ) + TARGET_LINK_LIBRARIES(detect_dtmf ${PROJECT_NAME}) + ADD_DEPENDENCIES(detect_dtmf ${PROJECT_NAME}) + + ADD_EXECUTABLE(detect_tones + ${PROJECT_SOURCE_DIR}/src/detect_tones.c + ${PROJECT_SOURCE_DIR}/src/libteletone_detect.c + ) + TARGET_LINK_LIBRARIES(detect_tones ${PROJECT_NAME}) + ADD_DEPENDENCIES(detect_tones ${PROJECT_NAME}) + + ADD_EXECUTABLE(testanalog + ${PROJECT_SOURCE_DIR}/src/testanalog.c + ) + TARGET_LINK_LIBRARIES(testanalog -l${PROJECT_NAME}) + ADD_DEPENDENCIES(testanalog ${PROJECT_NAME}) + + # optional tests/tools + IF(HAVE_SCTP) + ADD_EXECUTABLE(testboost src/testboost.c) + TARGET_LINK_LIBRARIES(testboost ${PROJECT_NAME}) + ENDIF(HAVE_SCTP) +ELSE(NOT DEFINED WIN32) + MESSAGE(WARNING "Not building tools/tests on WIN32 yet.") +ENDIF(NOT DEFINED WIN32) + +# +# ftmod modules +# +SET(ftmod_DIR ${PROJECT_SOURCE_DIR}/src/ftmod) + +IF(DEFINED WIN32) + SET(ftmod_ADDITIONAL_SOURCES + ${PROJECT_SOURCE_DIR}/src/ftdm_io.c + ${PROJECT_SOURCE_DIR}/src/ftdm_config.c + ${PROJECT_SOURCE_DIR}/src/ftdm_queue.c + ${PROJECT_SOURCE_DIR}/src/g711.c + ) + SET(module_list skel analog analog_em) +ELSE(DEFINED WIN32) + SET(module_list skel analog analog_em zt) +ENDIF(DEFINED WIN32) + +# build default modules +FOREACH(module ${module_list}) + ADD_LIBRARY(ftmod_${module} MODULE ${ftmod_DIR}/ftmod_${module}/ftmod_${module}.c ${ftmod_ADDITIONAL_SOURCES}) + TARGET_LINK_LIBRARIES(ftmod_${module} ${PROJECT_NAME}) +ENDFOREACH(module) + +# build isdn ftmod +IF(DEFINED BUILD_FTMOD_ISDN) + SET(ftmod_isdn_SOURCES + ${PROJECT_SOURCE_DIR}/src/isdn/EuroISDNStateNT.c + ${PROJECT_SOURCE_DIR}/src/isdn/EuroISDNStateTE.c + ${PROJECT_SOURCE_DIR}/src/isdn/mfifo.c + ${PROJECT_SOURCE_DIR}/src/isdn/Q921.c + ${PROJECT_SOURCE_DIR}/src/isdn/Q931api.c + ${PROJECT_SOURCE_DIR}/src/isdn/Q931.c + ${PROJECT_SOURCE_DIR}/src/isdn/Q931ie.c + ${PROJECT_SOURCE_DIR}/src/isdn/Q931mes.c + ${PROJECT_SOURCE_DIR}/src/isdn/Q931StateNT.c + ${PROJECT_SOURCE_DIR}/src/isdn/Q931StateTE.c + ${PROJECT_SOURCE_DIR}/src/isdn/nationalmes.c + ${PROJECT_SOURCE_DIR}/src/isdn/nationalStateNT.c + ${PROJECT_SOURCE_DIR}/src/isdn/nationalStateTE.c + ${PROJECT_SOURCE_DIR}/src/isdn/DMSmes.c + ${PROJECT_SOURCE_DIR}/src/isdn/DMSStateNT.c + ${PROJECT_SOURCE_DIR}/src/isdn/DMSStateTE.c + ${PROJECT_SOURCE_DIR}/src/isdn/5ESSmes.c + ${PROJECT_SOURCE_DIR}/src/isdn/5ESSStateNT.c + ${PROJECT_SOURCE_DIR}/src/isdn/5ESSStateTE.c + ${PROJECT_SOURCE_DIR}/src/isdn/Q932mes.c + ${ftmod_DIR}/ftmod_isdn/ftmod_isdn.c + ) + IF(NOT DEFINED WIN32) + ADD_DEFINITIONS(-D_GNU_SOURCE) + ENDIF(NOT DEFINED WIN32) + ADD_LIBRARY(ftmod_isdn MODULE ${ftmod_isdn_SOURCES}) + TARGET_LINK_LIBRARIES(ftmod_isdn ${PROJECT_NAME}) +ENDIF(DEFINED BUILD_FTMOD_ISDN) + +# from now on, optionals +IF(DEFINED LIBSANGOMA) + ADD_LIBRARY(ftmod_wanpipe MODULE ${ftmod_DIR}/ftmod_wanpipe/ftmod_wanpipe.c) + IF(DEFINED WIN32) + MESSAGE(WARNING "FIXME: look for wanpipe headers on win32") + ELSE(DEFINED WIN32) + ADD_DEFINITIONS(-D__LINUX__) + INCLUDE_DIRECTORIES(/usr/include/wanpipe) + ENDIF(DEFINED WIN32) + TARGET_LINK_LIBRARIES(ftmod_wanpipe sangoma ${PROJECT_NAME}) +ENDIF(DEFINED LIBSANGOMA) + +IF(DEFINED HAVE_SCTP) + ADD_LIBRARY(ftmod_sangoma_boost MODULE + ${ftmod_DIR}/ftmod_sangoma_boost/sangoma_boost_client.c + ${ftmod_DIR}/ftmod_sangoma_boost/ftmod_sangoma_boost.c + ) + TARGET_LINK_LIBRARIES(ftmod_sangoma_boost ${PROJECT_NAME}) +ENDIF(DEFINED HAVE_SCTP) + +IF(DEFINED LIBPRI) + ADD_LIBRARY(ftmod_libpri MODULE + ${ftmod_DIR}/ftmod_libpri/libpri_client.c + ${ftmod_DIR}/ftmod_libpri/ftmod_libpri.c + ) + TARGET_LINK_LIBRARIES(ftmod_libpri ${PROJECT_NAME}) +ENDIF(DEFINED LIBPRI) + +IF(DEFINED PRITAP) + ADD_LIBRARY(ftmod_pritap MODULE + ${ftmod_DIR}/ftmod_pritap/pritap_client.c + ${ftmod_DIR}/ftmod_pritap/ftmod_pritap.c + ) + TARGET_LINK_LIBRARIES(ftmod_pritap ${PROJECT_NAME} pri) +ENDIF(DEFINED PRITAP) + +IF(DEFINED SNGSS7) + ADD_LIBRARY(ftmod_sangoma_ss7 MODULE + ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c + ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c + ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c + ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c + ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c + ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c + ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c + ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c + ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c + ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c + ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c + ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sts.c + ${ftmod_DIR}/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c + ) + IF(NOT DEFINED WIN32) + ADD_DEFINITIONS(-D_GNU_SOURCE) + ENDIF(NOT DEFINED WIN32) + TARGET_LINK_LIBRARIES(ftmod_sangoma_ss7 ${PROJECT_NAME} sng_ss7) +ENDIF(DEFINED SNGSS7) + +IF(DEFINED SNGISDN) + ADD_LIBRARY(ftmod_sangoma_isdn MODULE + ${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c + ${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c + ${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cntrl.c + ${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c + ${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c + ${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c + ${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c + ${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c + ${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c + ${ftmod_DIR}/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c + ) + IF(NOT DEFINED WIN32) + ADD_DEFINITIONS(-D_GNU_SOURCE) + ENDIF(NOT DEFINED WIN32) + TARGET_LINK_LIBRARIES(ftmod_sangoma_isdn ${PROJECT_NAME} sng_isdn) +ENDIF(DEFINED SNGISDN) + +IF(DEFINED OPENR2) + ADD_LIBRARY(ftmod_r2 MODULE ${ftmod_DIR}/ftmod_r2/ftmod_r2.c) + TARGET_LINK_LIBRARIES(ftmod_r2 ${PROJECT_NAME} openr2) +ENDIF(DEFINED OPENR2) diff --git a/libs/freetdm/mod_freetdm/CMakeLists.txt b/libs/freetdm/mod_freetdm/CMakeLists.txt new file mode 100644 index 0000000..25847e7 --- /dev/null +++ b/libs/freetdm/mod_freetdm/CMakeLists.txt @@ -0,0 +1,32 @@ +# +# Arnaldo M Pereira <arnaldo@sangoma.com> +# +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(mod_freetdm) + +IF(NOT DEFINED WIN32) + ADD_DEFINITIONS(-g -O2 -ffast-math -Wall -Werror -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -O0 -g -ggdb -DPACKAGE_NAME=\"freetdm\" -DPACKAGE_TARNAME=\"freetdm\" -DPACKAGE_VERSION=\"pre-alpha\" -DPACKAGE_STRING=\"freetdm\ pre-alpha\" -DPACKAGE_BUGREPORT=\"bugs@freeswitch.org\" -DPACKAGE_URL=\"\" -DPACKAGE=\"libfreetdm\" -DVERSION=\"0.1\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DHAVE_LIBDL=1 -DHAVE_LIBPTHREAD=1 -DHAVE_LIBM=1 -DSIZEOF_LONG=8 -DHAVE_NETINET_SCTP_H=1 -DHAVE_NETDB_H=1 -DHAVE_SYS_SELECT_H=1 -DHAVE_GETHOSTBYNAME_R=1) # -DDEBUG=/\*\*/) +ENDIF(NOT DEFINED WIN32) + +# includes +SET(mod_freetdm_INCLUDES + ${PROJECT_SOURCE_DIR}/../src/include + ${PROJECT_SOURCE_DIR}/../src/isdn/include + ${PROJECT_SOURCE_DIR}/../../libteletone/src + ${PROJECT_SOURCE_DIR}/../../../src/include +) +INCLUDE_DIRECTORIES(${mod_freetdm_INCLUDES}) + +LINK_DIRECTORIES(${PROJECT_SOURCE_DIR}/..) +ADD_LIBRARY(${PROJECT_NAME} SHARED mod_freetdm.c) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} freetdm -fPIC -Werror -fvisibility=hidden) + +IF(DEFINED WIN32) + SET(EXT lib) +ELSE(DEFINED WIN32) + SET(EXT so) +ENDIF(DEFINED WIN32) + +ADD_CUSTOM_COMMAND(TARGET ${PROJECT_NAME} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E rename lib${PROJECT_NAME}.${EXT} ${PROJECT_NAME}.${EXT} +) diff --git a/libs/freetdm/sample/CMakeLists.txt b/libs/freetdm/sample/CMakeLists.txt new file mode 100644 index 0000000..330d590 --- /dev/null +++ b/libs/freetdm/sample/CMakeLists.txt @@ -0,0 +1,8 @@ +# +# Arnaldo M Pereira <arnaldo@sangoma.com> +# +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(sample) + +ADD_SUBDIRECTORY(boost) +#ADD_SUBDIRECTORY(sched) FIXME: this code doesnt compile diff --git a/libs/freetdm/sample/boost/CMakeLists.txt b/libs/freetdm/sample/boost/CMakeLists.txt new file mode 100644 index 0000000..6f36f10 --- /dev/null +++ b/libs/freetdm/sample/boost/CMakeLists.txt @@ -0,0 +1,12 @@ +# +# Arnaldo M Pereira <arnaldo@sangoma.com> +# +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(boost) + +IF(NOT DEFINED WIN32) + INCLUDE_DIRECTORIES(/usr/local/freeswitch/include) + ADD_DEFINITIONS(-Wall) + ADD_EXECUTABLE(ftdmstart ftdmstart.c) + TARGET_LINK_LIBRARIES(ftdmstart freetdm) +ENDIF(NOT DEFINED WIN32) diff --git a/libs/freetdm/sample/dso/CMakeLists.txt b/libs/freetdm/sample/dso/CMakeLists.txt new file mode 100644 index 0000000..defcc5c --- /dev/null +++ b/libs/freetdm/sample/dso/CMakeLists.txt @@ -0,0 +1,12 @@ +# +# Arnaldo M Pereira <arnaldo@sangoma.com> +# +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(dso) + +IF(NOT DEFINED WIN32) + INCLUDE_DIRECTORIES(/usr/local/freeswitch/include) + ADD_DEFINITIONS(-Wall) + ADD_EXECUTABLE(ftdmload ftdmload.c) + TARGET_LINK_LIBRARIES(ftdmload freetdm) +ENDIF(NOT DEFINED WIN32) diff --git a/libs/freetdm/sample/sched/CMakeLists.txt b/libs/freetdm/sample/sched/CMakeLists.txt new file mode 100644 index 0000000..d769925 --- /dev/null +++ b/libs/freetdm/sample/sched/CMakeLists.txt @@ -0,0 +1,12 @@ +# +# Arnaldo M Pereira <arnaldo@sangoma.com> +# +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(sched) + +IF(NOT DEFINED WIN32) + INCLUDE_DIRECTORIES(/usr/local/freeswitch/include) + ADD_DEFINITIONS(-Wall) + ADD_EXECUTABLE(ftdmsched ftdmsched.c) + TARGET_LINK_LIBRARIES(ftdmsched freetdm) +ENDIF(NOT DEFINED WIN32) commit 16b971f9688126aeb1620fb19f27bd1167c786c6 Author: Arnaldo M Pereira <arnaldo@sangoma.com> Date: Wed Oct 6 16:51:20 2010 -0300 made ftdm_sched.c also work on win32 diff --git a/libs/freetdm/src/ftdm_sched.c b/libs/freetdm/src/ftdm_sched.c index a7736ce..73facb3 100644 --- a/libs/freetdm/src/ftdm_sched.c +++ b/libs/freetdm/src/ftdm_sched.c @@ -34,6 +34,45 @@ #include "private/ftdm_core.h" +#ifdef __WINDOWS__ +#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) +#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 +#else /* */ +#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL +#endif /* */ +struct ftdm_timezone { + int tz_minuteswest; /* minutes W of Greenwich */ + int tz_dsttime; /* type of dst correction */ +}; +int gettimeofday(struct timeval *tv, struct ftdm_timezone *tz) +{ + FILETIME ft; + unsigned __int64 tmpres = 0; + static int tzflag; + if (NULL != tv) { + GetSystemTimeAsFileTime(&ft); + tmpres |= ft.dwHighDateTime; + tmpres <<= 32; + tmpres |= ft.dwLowDateTime; + + /*converting file time to unix epoch */ + tmpres /= 10; /*convert into microseconds */ + tmpres -= DELTA_EPOCH_IN_MICROSECS; + tv->tv_sec = (long) (tmpres / 1000000UL); + tv->tv_usec = (long) (tmpres % 1000000UL); + } + if (NULL != tz) { + if (!tzflag) { + _tzset(); + tzflag++; + } + tz->tz_minuteswest = _timezone / 60; + tz->tz_dsttime = _daylight; + } + return 0; +} +#endif /* __WINDOWS__ */ + typedef struct ftdm_timer ftdm_timer_t; static struct { @@ -55,9 +94,7 @@ struct ftdm_sched { struct ftdm_timer { char name[80]; ftdm_timer_id_t id; -#ifdef __linux__ struct timeval time; -#endif void *usrdata; ftdm_sched_callback_t callback; ftdm_timer_t *next; @@ -234,7 +271,6 @@ failed: FT_DECLARE(ftdm_status_t) ftdm_sched_run(ftdm_sched_t *sched) { ftdm_status_t status = FTDM_FAIL; -#ifdef __linux__ ftdm_timer_t *runtimer; ftdm_timer_t *timer; ftdm_sched_callback_t callback; @@ -300,10 +336,6 @@ tryagain: done: ftdm_mutex_unlock(sched->mutex); -#else - ftdm_log(FTDM_LOG_CRIT, "Not implemented in this platform\n"); - status = FTDM_NOTIMPL; -#endif #ifdef __WINDOWS__ UNREFERENCED_PARAMETER(sched); #endif @@ -315,7 +347,6 @@ FT_DECLARE(ftdm_status_t) ftdm_sched_timer(ftdm_sched_t *sched, const char *name int ms, ftdm_sched_callback_t callback, void *data, ftdm_timer_id_t *timerid) { ftdm_status_t status = FTDM_FAIL; -#ifdef __linux__ struct timeval now; int rc = 0; ftdm_timer_t *newtimer; @@ -378,10 +409,6 @@ FT_DECLARE(ftdm_status_t) ftdm_sched_timer(ftdm_sched_t *sched, const char *name done: ftdm_mutex_unlock(sched->mutex); -#else - ftdm_log(FTDM_LOG_CRIT, "Not implemented in this platform\n"); - status = FTDM_NOTIMPL; -#endif #ifdef __WINDOWS__ UNREFERENCED_PARAMETER(sched); UNREFERENCED_PARAMETER(name); @@ -396,7 +423,6 @@ done: FT_DECLARE(ftdm_status_t) ftdm_sched_get_time_to_next_timer(const ftdm_sched_t *sched, int32_t *timeto) { ftdm_status_t status = FTDM_FAIL; -#ifdef __linux__ int res = -1; int ms = 0; struct timeval currtime; @@ -445,10 +471,6 @@ FT_DECLARE(ftdm_status_t) ftdm_sched_get_time_to_next_timer(const ftdm_sched_t * done: ftdm_mutex_unlock(sched->mutex); -#else - ftdm_log(FTDM_LOG_ERROR, "Implement me!\n"); - status = FTDM_NOTIMPL; -#endif #ifdef __WINDOWS__ UNREFERENCED_PARAMETER(timeto); UNREFERENCED_PARAMETER(sched); diff --git a/libs/freetdm/src/include/ftdm_declare.h b/libs/freetdm/src/include/ftdm_declare.h index 03071a6..a3fc119 100644 --- a/libs/freetdm/src/include/ftdm_declare.h +++ b/libs/freetdm/src/include/ftdm_declare.h @@ -156,7 +156,12 @@ typedef __int64 int64_t; typedef __int32 int32_t; typedef __int16 int16_t; typedef __int8 int8_t; +#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) +#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 #else +#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL +#endif /* _MSC_VER */ +#else /* __WINDOWS__ */ #define FTDM_INVALID_SOCKET -1 typedef int ftdm_socket_t; #include <stdio.h> commit dc4d19e9f6507cbcc39c1a517b54ed1fae9cfa3e Author: Moises Silva <moy@sangoma.com> Date: Wed Oct 6 12:36:40 2010 -0400 mod_sangoma_codec: do not return 0 len frames and return silence instead when there is no transcoding output update stats only when we really receive a frame diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index 4e3339b..c84dac4 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -447,25 +447,31 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec *encoded_data_len = encoded_frame.datalen; } - /* update encoding stats */ - sess->encoder.rx++; - - now_time = switch_micro_time_now(); - if (!sess->encoder.last_rx_time) { - sess->encoder.last_rx_time = now_time; - } else { - difftime = now_time - sess->encoder.last_rx_time; - sess->encoder.avgrxus = sess->encoder.avgrxus ? ((sess->encoder.avgrxus + difftime)/2) : difftime; - sess->encoder.last_rx_time = now_time; - } + /* update encoding stats if we received a frame */ + if (*encoded_data_len) { + if (*encoded_data_len != codec->implementation->encoded_bytes_per_packet) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Returning odd encoded frame of %d bytes intead of %d bytes\n", *encoded_data_len, codec->implementation->encoded_bytes_per_packet); + } + sess->encoder.rx++; + now_time = switch_micro_time_now(); + if (!sess->encoder.last_rx_time) { + sess->encoder.last_rx_time = now_time; + } else { + difftime = now_time - sess->encoder.last_rx_time; + sess->encoder.avgrxus = sess->encoder.avgrxus ? ((sess->encoder.avgrxus + difftime)/2) : difftime; + sess->encoder.last_rx_time = now_time; + } - /* check sequence and bump lost rx packets count if needed */ - if (sess->encoder.lastrxseqno >= 0) { - if (encoded_frame.seq > (sess->encoder.lastrxseqno + 2) ) { - sess->encoder.rxlost += encoded_frame.seq - sess->encoder.lastrxseqno - 1; + /* check sequence and bump lost rx packets count if needed */ + if (sess->encoder.lastrxseqno >= 0) { + if (encoded_frame.seq > (sess->encoder.lastrxseqno + 2) ) { + sess->encoder.rxlost += encoded_frame.seq - sess->encoder.lastrxseqno - 1; + } } + sess->encoder.lastrxseqno = encoded_frame.seq; + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No output from sangoma encoder\n"); } - sess->encoder.lastrxseqno = encoded_frame.seq; return SWITCH_STATUS_SUCCESS; } @@ -570,25 +576,34 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses *decoded_data_len = i * 2; } - /* update decoding stats */ - sess->decoder.rx++; + if (*decoded_data_len) { + if (*decoded_data_len != codec->implementation->decoded_bytes_per_packet) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Returning odd decoded frame of %d bytes intead of %d bytes\n", *decoded_data_len, codec->implementation->decoded_bytes_per_packet); + } + /* update decoding stats */ + sess->decoder.rx++; - now_time = switch_micro_time_now(); - if (!sess->decoder.last_rx_time) { - sess->decoder.last_rx_time = now_time; - } else { - difftime = now_time - sess->decoder.last_rx_time; - sess->decoder.avgrxus = sess->decoder.avgrxus ? ((sess->decoder.avgrxus + difftime)/2) : difftime; - sess->decoder.last_rx_time = now_time; - } + now_time = switch_micro_time_now(); + if (!sess->decoder.last_rx_time) { + sess->decoder.last_rx_time = now_time; + } else { + difftime = now_time - sess->decoder.last_rx_time; + sess->decoder.avgrxus = sess->decoder.avgrxus ? ((sess->decoder.avgrxus + difftime)/2) : difftime; + sess->decoder.last_rx_time = now_time; + } - /* check sequence and bump lost rx packets count if needed */ - if (sess->decoder.lastrxseqno >= 0) { - if (ulaw_frame.seq > (sess->decoder.lastrxseqno + 2) ) { - sess->decoder.rxlost += ulaw_frame.seq - sess->decoder.lastrxseqno - 1; + /* check sequence and bump lost rx packets count if needed */ + if (sess->decoder.lastrxseqno >= 0) { + if (ulaw_frame.seq > (sess->decoder.lastrxseqno + 2) ) { + sess->decoder.rxlost += ulaw_frame.seq - sess->decoder.lastrxseqno - 1; + } } + sess->decoder.lastrxseqno = ulaw_frame.seq; + } else { + *decoded_data_len = codec->implementation->decoded_bytes_per_packet; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No output from sangoma decoder, returning silent frame of %d bytes\n", *decoded_data_len); + memset(dbuf_linear, 0, *decoded_data_len); } - sess->decoder.lastrxseqno = ulaw_frame.seq; return SWITCH_STATUS_SUCCESS; } commit 8f13eb89666585cc05eae62c788629c33db9f251 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Oct 6 15:17:48 2010 -0500 FS-2762 diff --git a/conf/sip_profiles/internal.xml b/conf/sip_profiles/internal.xml index 50833bf..93558a3 100644 --- a/conf/sip_profiles/internal.xml +++ b/conf/sip_profiles/internal.xml @@ -42,6 +42,26 @@ <!-- If you want FreeSWITCH to shutdown if this profile fails to load, uncomment the next line. --> <!-- <param name="shutdown-on-fail" value="true"/> --> <param name="sip-trace" value="no"/> + + <!-- + Sometimes, in extremely rare edge cases, the Sofia SIP stack may stop + responding. These options allow you to enable and control a watchdog + on the Sofia SIP stack so that if it stops responding for the + specified number of milliseconds, it will cause FreeSWITCH to shut + down immediately. This is useful if you run in an HA environment and + need to ensure automated recovery from such a condition. Note that if + your server is idle a lot, the watchdog may fire due to not receiving + any SIP messages. Thus, if you expect your system to be idle, you + should leave the watchdog disabled. It can be toggled on and off + through the FreeSWITCH CLI either on an individual profile basis or + globally for all profiles. So, if you run in an HA environment with a + master and slave, you should use the CLI to make sure the watchdog is + only enabled on the master. + --> + <param name="watchdog-enabled" value="no"/> + <param name="watchdog-step-timeout" value="30000"/> + <param name="watchdog-event-timeout" value="30000"/> + <param name="log-auth-failures" value="true"/> <param name="forward-unsolicited-mwi-notify" value="false"/> diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 5bc1b4e..323702e 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3174,6 +3174,17 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t goto done; } + if (!strcasecmp(argv[1], "watchdog")) { + if (argc > 2) { + int value = switch_true(argv[2]); + profile->watchdog_enabled = value; + stream->write_function(stream, "%s sip debugging on %s", value ? "Enabled" : "Disabled", profile->name); + } else { + stream->write_function(stream, "Usage: sofia profile <name> watchdog <on/off>\n"); + } + goto done; + } + if (!strcasecmp(argv[1], "gwlist")) { int up = 1; @@ -3510,12 +3521,14 @@ SWITCH_STANDARD_API(sofia_function) "[register|unregister] [<gateway name>|all]|" "killgw <gateway name>|" "[stun-auto-disable|stun-enabled] [true|false]]|" - "siptrace [on|off]\n" + "siptrace <on|off>|" + "watchdog <on|off>\n" "sofia status|xmlstatus profile <name> [ reg <contact str> ] | [ pres <pres str> ] | [ user <user@domain> ]\n" "sofia status|xmlstatus gateway <name>\n" "sofia loglevel <all|default|tport|iptsec|nea|nta|nth_client|nth_server|nua|soa|sresolv|stun> [0-9]\n" "sofia tracelevel <console|alert|crit|err|warning|notice|info|debug>\n" - "sofa global siptrace [on|off]\n" + "sofia global siptrace <on|off>|" + "watchdog <on|off>\n" "--------------------------------------------------------------------------------\n"; if (session) { @@ -3572,21 +3585,30 @@ SWITCH_STANDARD_API(sofia_function) stream->write_function(stream, "%s", usage_string); goto done; } else if (!strcasecmp(argv[0], "global")) { - int on = -1; + int ston = -1; + int wdon = -1; if (argc > 1) { if (!strcasecmp(argv[1], "siptrace")) { if (argc > 2) { - on = switch_true(argv[2]); + ston = switch_true(argv[2]); + } + } + if (!strcasecmp(argv[1], "watchdog")) { + if (argc > 2) { + wdon = switch_true(argv[2]); } } } - if (on != -1) { - sofia_glue_global_siptrace(on); - stream->write_function(stream, "+OK Global siptrace %s", on ? "on" : "off"); + if (ston != -1) { + sofia_glue_global_siptrace(ston); + stream->write_function(stream, "+OK Global siptrace %s", ston ? "on" : "off"); + } else if (wdon != -1) { + sofia_glue_global_watchdog(wdon); + stream->write_function(stream, "+OK Global watchdog %s", wdon ? "on" : "off"); } else { - stream->write_function(stream, "-ERR Usage: siptrace on|off"); + stream->write_function(stream, "-ERR Usage: siptrace <on|off>|watchdog <on|off>"); } goto done; @@ -4668,6 +4690,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) switch_console_set_complete("add sofia tracelevel ::[console:alert:crit:err:warning:notice:info:debug"); switch_console_set_complete("add sofia global siptrace ::[on:off"); + switch_console_set_complete("add sofia global watchdog ::[on:off"); switch_console_set_complete("add sofia profile"); switch_console_set_complete("add sofia profile restart all"); @@ -4683,6 +4706,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) switch_console_set_complete("add sofia profile ::sofia::list_profiles killgw ::sofia::list_profile_gateway"); switch_console_set_complete("add sofia profile ::sofia::list_profiles siptrace on"); switch_console_set_complete("add sofia profile ::sofia::list_profiles siptrace off"); + switch_console_set_complete("add sofia profile ::sofia::list_profiles watchdog on"); + switch_console_set_complete("add sofia profile ::sofia::list_profiles watchdog off"); switch_console_set_complete("add sofia profile ::sofia::list_profiles gwlist up"); switch_console_set_complete("add sofia profile ::sofia::list_profiles gwlist down"); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index ea62398..cf4b9a3 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -566,6 +566,7 @@ struct sofia_profile { switch_time_t last_root_step; uint32_t step_timeout; uint32_t event_timeout; + int watchdog_enabled; }; struct private_object { @@ -1020,6 +1021,7 @@ void sofia_glue_tech_simplify(private_object_t *tech_pvt); switch_console_callback_match_t *sofia_reg_find_reg_url_multi(sofia_profile_t *profile, const char *user, const char *host); switch_bool_t sofia_glue_profile_exists(const char *key); void sofia_glue_global_siptrace(switch_bool_t on); +void sofia_glue_global_watchdog(switch_bool_t on); void sofia_glue_proxy_codec(switch_core_session_t *session, const char *r_sdp); switch_status_t sofia_glue_sdp_map(const char *r_sdp, switch_event_t **fmtp, switch_event_t **pt); void sofia_glue_build_vid_refresh_message(switch_core_session_t *session, const char *pl); diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index aa4c517..0598624 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1326,7 +1326,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread } } - if (fail) { + if (profile->watchdog_enabled && fail) { int arg = 1; switch_session_ctl_t command = SCSC_SHUTDOWN_NOW; @@ -2327,9 +2327,11 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) } else { sofia_clear_pflag(profile, PFLAG_DEL_SUBS_ON_REG); } - } else if (!strcasecmp(var, "watchdog_step_timeout")) { + } else if (!strcasecmp(var, "watchdog-enabled")) { + profile->watchdog_enabled = switch_true(val); + } else if (!strcasecmp(var, "watchdog-step-timeout")) { profile->step_timeout = (unsigned long) atol(val); - } else if (!strcasecmp(var, "watchdog_event_timeout")) { + } else if (!strcasecmp(var, "watchdog-event-timeout")) { profile->event_timeout = (unsigned long) atol(val); } else if (!strcasecmp(var, "in-dialog-chat")) { if (switch_true(val)) { @@ -3011,9 +3013,11 @@ switch_status_t config_sofia(int reload, char *profile_name) } else { sofia_clear_pflag(profile, PFLAG_LOG_AUTH_FAIL); } - } else if (!strcasecmp(var, "watchdog_step_timeout")) { + } else if (!strcasecmp(var, "watchdog-enabled")) { + profile->watchdog_enabled = switch_true(val); + } else if (!strcasecmp(var, "watchdog-step-timeout")) { profile->step_timeout = atoi(val); - } else if (!strcasecmp(var, "watchdog_event_timeout")) { + } else if (!strcasecmp(var, "watchdog-event-timeout")) { profile->event_timeout = atoi(val); } else if (!strcasecmp(var, "in-dialog-chat")) { diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 9d6cff7..7464a42 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -4752,6 +4752,26 @@ void sofia_glue_global_siptrace(switch_bool_t on) } +void sofia_glue_global_watchdog(switch_bool_t on) +{ + switch_hash_index_t *hi; + const void *var; + void *val; + sofia_profile_t *pptr; + + switch_mutex_lock(mod_sofia_globals.hash_mutex); + if (mod_sofia_globals.profile_hash) { + for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) { + switch_hash_this(hi, &var, NULL, &val); + if ((pptr = (sofia_profile_t *) val)) { + pptr->watchdog_enabled = (on ? 1 : 0); + } + } + } + switch_mutex_unlock(mod_sofia_globals.hash_mutex); + +} + void sofia_glue_del_profile(sofia_profile_t *profile) { sofia_gateway_t *gp; commit 3bb90ac41c5a6d0cf446cb43afc6b78a077ee036 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Oct 6 15:16:09 2010 -0500 fix some edge cases diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index e1570a7..ed62da1 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -2580,7 +2580,10 @@ static void conference_loop_output(conference_member_t *member) if (member->fnode) { member_add_file_data(member, write_frame.data, write_frame.datalen); } - switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0); + if (switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + break; + } } } @@ -2590,7 +2593,10 @@ static void conference_loop_output(conference_member_t *member) write_frame.samples = samples; memset(write_frame.data, 255, write_frame.datalen); member_add_file_data(member, write_frame.data, write_frame.datalen); - switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0); + if (switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + break; + } } else if (!switch_test_flag(member->conference, CFLAG_WASTE_BANDWIDTH)) { if (switch_test_flag(member, MFLAG_WASTE_BANDWIDTH)) { if (member->conference->comfort_noise_level) { @@ -2603,7 +2609,10 @@ static void conference_loop_output(conference_member_t *member) write_frame.samples = samples; write_frame.timestamp = timer.samplecount; - switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0); + if (switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + break; + } } } diff --git a/src/switch_core_codec.c b/src/switch_core_codec.c index d45d73e..9b607ea 100644 --- a/src/switch_core_codec.c +++ b/src/switch_core_codec.c @@ -137,9 +137,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(switch_core_s memset(&session->read_impl, 0, sizeof(session->read_impl)); } old->next = NULL; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Restore previous codec %s:%d.\n", switch_channel_get_name(session->channel), - session->read_codec->implementation->iananame, session->read_codec->implementation->ianacode); + session->read_impl.iananame ? session->read_impl.iananame : "N/A", session->read_impl.ianacode); + } else if (session->real_read_codec) { session->read_codec = session->real_read_codec; commit fadcbd9268ed00ab444a3e2583d14ed193397dea Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Oct 6 13:41:59 2010 -0500 watchdog_step_timeout watchdog_event_timeout (milliseconds) to detect a problem in sofia and shutdown instantly diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index f0ebb55..ea62398 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -562,6 +562,10 @@ struct sofia_profile { char *contact_user; char *local_network; uint32_t trans_timeout; + switch_time_t last_sip_event; + switch_time_t last_root_step; + uint32_t step_timeout; + uint32_t event_timeout; }; struct private_object { diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 38e62de..aa4c517 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -731,6 +731,7 @@ void sofia_event_callback(nua_event_t event, int locked = 0; int check_destroy = 1; + profile->last_sip_event = switch_time_now(); /* sofia_private will be == &mod_sofia_globals.keep_private whenever a request is done with a new handle that has to be freed whenever the request is done */ @@ -1309,6 +1310,33 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread } if (++loops >= 1000) { + uint32_t diff = 0, fail = 0; + + if (profile->step_timeout) { + diff = (uint32_t) ((switch_time_now() - profile->last_root_step) / 1000); + if (diff > profile->step_timeout) { + fail = 1; + } + } + + if (profile->event_timeout) { + diff = (uint32_t) ((switch_time_now() - profile->last_sip_event) / 1000); + if (diff > profile->event_timeout) { + fail = 1; + } + } + + if (fail) { + int arg = 1; + switch_session_ctl_t command = SCSC_SHUTDOWN_NOW; + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Profile %s: SIP STACK FAILURE DETECTED!\n" + "GOODBYE CRUEL WORLD, I'M LEAVING YOU TODAY....GOODBYE, GOODBYE, GOOD BYE\n", profile->name); + switch_yield(2000); + switch_core_session_ctl(command, &arg); + } + + if (++ireg_loops >= IREG_SECONDS) { time_t now = switch_epoch_time_now(NULL); sofia_reg_check_expire(profile, now, 0); @@ -1548,6 +1576,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void while (mod_sofia_globals.running == 1 && sofia_test_pflag(profile, PFLAG_RUNNING) && sofia_test_pflag(profile, PFLAG_WORKER_RUNNING)) { su_root_step(profile->s_root, 1000); + profile->last_root_step = switch_time_now(); } sofia_clear_pflag_locked(profile, PFLAG_RUNNING); @@ -2298,6 +2327,10 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) } else { sofia_clear_pflag(profile, PFLAG_DEL_SUBS_ON_REG); } + } else if (!strcasecmp(var, "watchdog_step_timeout")) { + profile->step_timeout = (unsigned long) atol(val); + } else if (!strcasecmp(var, "watchdog_event_timeout")) { + profile->event_timeout = (unsigned long) atol(val); } else if (!strcasecmp(var, "in-dialog-chat")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_IN_DIALOG_CHAT); @@ -2978,6 +3011,11 @@ switch_status_t config_sofia(int reload, char *profile_name) } else { sofia_clear_pflag(profile, PFLAG_LOG_AUTH_FAIL); } + } else if (!strcasecmp(var, "watchdog_step_timeout")) { + profile->step_timeout = atoi(val); + } else if (!strcasecmp(var, "watchdog_event_timeout")) { + profile->event_timeout = atoi(val); + } else if (!strcasecmp(var, "in-dialog-chat")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_IN_DIALOG_CHAT); commit 51cc00a5f9e943b759eb2f85358ddaa75a7256b0 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Oct 6 11:07:41 2010 -0500 doh diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 4cb5970..5bc1b4e 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -249,13 +249,10 @@ char *generate_pai_str(private_object_t *tech_pvt) const char *var, *header, *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent"); char *pai = NULL; - printf("WTF %s %d\n", tech_pvt->profile->name, sofia_test_pflag(tech_pvt->profile, PFLAG_PASS_CALLEE_ID)); - if (!sofia_test_pflag(tech_pvt->profile, PFLAG_PASS_CALLEE_ID) || !sofia_test_pflag(tech_pvt->profile, PFLAG_CID_IN_1XX) || ((var = switch_channel_get_variable(tech_pvt->channel, "sip_cid_in_1xx")) && switch_false(var))) { return NULL; } - printf("BOOL FUCKEDUP\n"); if (zstr((callee_name = switch_channel_get_variable(tech_pvt->channel, "effective_callee_id_name"))) && zstr((callee_name = switch_channel_get_variable(tech_pvt->channel, "sip_callee_id_name")))) { commit fea856b67c3bd29c840faad2c28cc76fa7c99a18 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Oct 6 08:48:33 2010 -0500 swigall diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index f2cc05d..4cb5970 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -249,12 +249,13 @@ char *generate_pai_str(private_object_t *tech_pvt) const char *var, *header, *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent"); char *pai = NULL; + printf("WTF %s %d\n", tech_pvt->profile->name, sofia_test_pflag(tech_pvt->profile, PFLAG_PASS_CALLEE_ID)); if (!sofia_test_pflag(tech_pvt->profile, PFLAG_PASS_CALLEE_ID) || !sofia_test_pflag(tech_pvt->profile, PFLAG_CID_IN_1XX) || ((var = switch_channel_get_variable(tech_pvt->channel, "sip_cid_in_1xx")) && switch_false(var))) { return NULL; } - + printf("BOOL FUCKEDUP\n"); if (zstr((callee_name = switch_channel_get_variable(tech_pvt->channel, "effective_callee_id_name"))) && zstr((callee_name = switch_channel_get_variable(tech_pvt->channel, "sip_callee_id_name")))) { diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index b369689..ad4d63d 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -1070,6 +1070,17 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABL } +SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE_get() { + char * jresult ; + char *result = 0 ; + + result = (char *) "passthru_ptime_mismatch"; + + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE_get() { char * jresult ; char *result = 0 ; @@ -1422,6 +1433,17 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_EXPORT_VARS_VARIABLE_get() { } +SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_BRIDGE_EXPORT_VARS_VARIABLE_get() { + char * jresult ; + char *result = 0 ; + + result = (char *) "bridge_export_vars"; + + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_R_SDP_VARIABLE_get() { char * jresult ; char *result = 0 ; @@ -4053,6 +4075,123 @@ SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_console_callback_match(void * j } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_match_dmachine_set(void * jarg1, void * jarg2) { + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + switch_ivr_dmachine_t *arg2 = (switch_ivr_dmachine_t *) 0 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + arg2 = (switch_ivr_dmachine_t *)jarg2; + if (arg1) (arg1)->dmachine = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_ivr_dmachine_match_dmachine_get(void * jarg1) { + void * jresult ; + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + switch_ivr_dmachine_t *result = 0 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + result = (switch_ivr_dmachine_t *) ((arg1)->dmachine); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_match_match_digits_set(void * jarg1, char * jarg2) { + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + char *arg2 = (char *) 0 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + arg2 = (char *)jarg2; + { + if (arg2) { + arg1->match_digits = (char const *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->match_digits, (const char *)arg2); + } else { + arg1->match_digits = 0; + } + } +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_ivr_dmachine_match_match_digits_get(void * jarg1) { + char * jresult ; + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + char *result = 0 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + result = (char *) ((arg1)->match_digits); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_match_match_key_set(void * jarg1, int jarg2) { + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + int32_t arg2 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + arg2 = (int32_t)jarg2; + if (arg1) (arg1)->match_key = arg2; + +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_match_match_key_get(void * jarg1) { + int jresult ; + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + int32_t result; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + result = (int32_t) ((arg1)->match_key); + jresult = result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_match_user_data_set(void * jarg1, void * jarg2) { + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + void *arg2 = (void *) 0 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + arg2 = (void *)jarg2; + if (arg1) (arg1)->user_data = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_ivr_dmachine_match_user_data_get(void * jarg1) { + void * jresult ; + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + void *result = 0 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + result = (void *) ((arg1)->user_data); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_ivr_dmachine_match() { + void * jresult ; + switch_ivr_dmachine_match *result = 0 ; + + result = (switch_ivr_dmachine_match *)new switch_ivr_dmachine_match(); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_ivr_dmachine_match(void * jarg1) { + switch_ivr_dmachine_match *arg1 = (switch_ivr_dmachine_match *) 0 ; + + arg1 = (switch_ivr_dmachine_match *)jarg1; + delete arg1; + +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_input_args_t_input_callback_set(void * jarg1, void * jarg2) { switch_input_args_t *arg1 = (switch_input_args_t *) 0 ; switch_input_callback_function_t arg2 = (switch_input_callback_function_t) 0 ; @@ -4168,6 +4307,29 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_input_args_t_user_data_get(void * ja } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_input_args_t_dmachine_set(void * jarg1, void * jarg2) { + switch_input_args_t *arg1 = (switch_input_args_t *) 0 ; + switch_ivr_dmachine_t *arg2 = (switch_ivr_dmachine_t *) 0 ; + + arg1 = (switch_input_args_t *)jarg1; + arg2 = (switch_ivr_dmachine_t *)jarg2; + if (arg1) (arg1)->dmachine = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_input_args_t_dmachine_get(void * jarg1) { + void * jresult ; + switch_input_args_t *arg1 = (switch_input_args_t *) 0 ; + switch_ivr_dmachine_t *result = 0 ; + + arg1 = (switch_input_args_t *)jarg1; + result = (switch_ivr_dmachine_t *) ((arg1)->dmachine); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_input_args_t() { void * jresult ; switch_input_args_t *result = 0 ; @@ -4279,7 +4441,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_API_VERSION_get() { int jresult ; int result; - result = (int) 4; + result = (int) 5; jresult = result; return jresult; @@ -8198,6 +8360,24 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_codec_copy(void * jarg1, void * ja } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_codec_parse_fmtp(char * jarg1, char * jarg2, unsigned long jarg3, void * jarg4) { + int jresult ; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + uint32_t arg3 ; + switch_codec_fmtp_t *arg4 = (switch_codec_fmtp_t *) 0 ; + switch_status_t result; + + arg1 = (char *)jarg1; + arg2 = (char *)jarg2; + arg3 = (uint32_t)jarg3; + arg4 = (switch_codec_fmtp_t *)jarg4; + result = (switch_status_t)switch_core_codec_parse_fmtp((char const *)arg1,(char const *)arg2,arg3,arg4); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_codec_reset(void * jarg1) { int jresult ; switch_codec_t *arg1 = (switch_codec_t *) 0 ; @@ -11836,6 +12016,18 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_digit_string(char * jarg1) { } +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_known_bitrate(unsigned char jarg1) { + unsigned long jresult ; + switch_payload_t arg1 ; + uint32_t result; + + arg1 = (switch_payload_t)jarg1; + result = (uint32_t)switch_known_bitrate(arg1); + jresult = (unsigned long)result; + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_switch_fd_read_line(int jarg1, char * jarg2, void * jarg3) { void * jresult ; int arg1 ; @@ -22988,36 +23180,54 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_get_variable_partner(void * } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_export_variable_var_check(void * jarg1, char * jarg2, char * jarg3, int jarg4) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_export_variable_var_check(void * jarg1, char * jarg2, char * jarg3, char * jarg4, int jarg5) { int jresult ; switch_channel_t *arg1 = (switch_channel_t *) 0 ; char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; - switch_bool_t arg4 ; + char *arg4 = (char *) 0 ; + switch_bool_t arg5 ; switch_status_t result; arg1 = (switch_channel_t *)jarg1; arg2 = (char *)jarg2; arg3 = (char *)jarg3; - arg4 = (switch_bool_t)jarg4; - result = (switch_status_t)switch_channel_export_variable_var_check(arg1,(char const *)arg2,(char const *)arg3,arg4); + arg4 = (char *)jarg4; + arg5 = (switch_bool_t)jarg5; + result = (switch_status_t)switch_channel_export_variable_var_check(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5); jresult = result; return jresult; } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_export_variable_printf(void * jarg1, char * jarg2, char * jarg3) { +SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_process_export(void * jarg1, void * jarg2, void * jarg3, char * jarg4) { + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + switch_channel_t *arg2 = (switch_channel_t *) 0 ; + switch_event_t *arg3 = (switch_event_t *) 0 ; + char *arg4 = (char *) 0 ; + + arg1 = (switch_channel_t *)jarg1; + arg2 = (switch_channel_t *)jarg2; + arg3 = (switch_event_t *)jarg3; + arg4 = (char *)jarg4; + switch_channel_process_export(arg1,arg2,arg3,(char const *)arg4); +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_export_variable_printf(void * jarg1, char * jarg2, char * jarg3, char * jarg4) { int jresult ; switch_channel_t *arg1 = (switch_channel_t *) 0 ; char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; - void *arg4 = 0 ; + char *arg4 = (char *) 0 ; + void *arg5 = 0 ; switch_status_t result; arg1 = (switch_channel_t *)jarg1; arg2 = (char *)jarg2; arg3 = (char *)jarg3; - result = (switch_status_t)switch_channel_export_variable_printf(arg1,(char const *)arg2,(char const *)arg3,arg4); + arg4 = (char *)jarg4; + result = (switch_status_t)switch_channel_export_variable_printf(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5); jresult = result; return jresult; } @@ -27646,6 +27856,126 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_uuid_exists(char * jarg1) { } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_create(void * jarg1, void * jarg2, unsigned long jarg3, unsigned long jarg4) { + int jresult ; + switch_ivr_dmachine_t **arg1 = (switch_ivr_dmachine_t **) 0 ; + switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ; + uint32_t arg3 ; + uint32_t arg4 ; + switch_status_t result; + + arg1 = (switch_ivr_dmachine_t **)jarg1; + arg2 = (switch_memory_pool_t *)jarg2; + arg3 = (uint32_t)jarg3; + arg4 = (uint32_t)jarg4; + result = (switch_status_t)switch_ivr_dmachine_create(arg1,arg2,arg3,arg4); + jresult = result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_destroy(void * jarg1) { + switch_ivr_dmachine_t **arg1 = (switch_ivr_dmachine_t **) 0 ; + + arg1 = (switch_ivr_dmachine_t **)jarg1; + switch_ivr_dmachine_destroy(arg1); +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_bind(void * jarg1, char * jarg2, int jarg3, void * jarg4, void * jarg5) { + int jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + char *arg2 = (char *) 0 ; + int32_t arg3 ; + switch_ivr_dmachine_callback_t arg4 = (switch_ivr_dmachine_callback_t) 0 ; + void *arg5 = (void *) 0 ; + switch_status_t result; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (int32_t)jarg3; + arg4 = (switch_ivr_dmachine_callback_t)jarg4; + arg5 = (void *)jarg5; + result = (switch_status_t)switch_ivr_dmachine_bind(arg1,(char const *)arg2,arg3,arg4,arg5); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_feed(void * jarg1, char * jarg2, void * jarg3) { + int jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_ivr_dmachine_match_t **arg3 = (switch_ivr_dmachine_match_t **) 0 ; + switch_status_t result; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (switch_ivr_dmachine_match_t **)jarg3; + result = (switch_status_t)switch_ivr_dmachine_feed(arg1,(char const *)arg2,arg3); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_clear(void * jarg1) { + int jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + switch_status_t result; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + result = (switch_status_t)switch_ivr_dmachine_clear(arg1); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_dmachine_ping(void * jarg1, void * jarg2) { + int jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + switch_ivr_dmachine_match_t **arg2 = (switch_ivr_dmachine_match_t **) 0 ; + switch_status_t result; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (switch_ivr_dmachine_match_t **)jarg2; + result = (switch_status_t)switch_ivr_dmachine_ping(arg1,arg2); + jresult = result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_ivr_dmachine_get_match(void * jarg1) { + void * jresult ; + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + switch_ivr_dmachine_match_t *result = 0 ; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + result = (switch_ivr_dmachine_match_t *)switch_ivr_dmachine_get_match(arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_set_digit_timeout_ms(void * jarg1, unsigned long jarg2) { + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + uint32_t arg2 ; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (uint32_t)jarg2; + switch_ivr_dmachine_set_digit_timeout_ms(arg1,arg2); +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_dmachine_set_input_timeout_ms(void * jarg1, unsigned long jarg2) { + switch_ivr_dmachine_t *arg1 = (switch_ivr_dmachine_t *) 0 ; + uint32_t arg2 ; + + arg1 = (switch_ivr_dmachine_t *)jarg1; + arg2 = (uint32_t)jarg2; + switch_ivr_dmachine_set_input_timeout_ms(arg1,arg2); +} + + SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RTP_MAX_BUF_LEN_get() { int jresult ; int result; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index f30750a..a1b556b 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -1673,6 +1673,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_core_codec_parse_fmtp(string codec_name, string fmtp, uint rate, switch_codec_fmtp codec_fmtp) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_codec_parse_fmtp(codec_name, fmtp, rate, switch_codec_fmtp.getCPtr(codec_fmtp)); + return ret; + } + public static switch_status_t switch_core_codec_reset(switch_codec codec) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_codec_reset(switch_codec.getCPtr(codec)); return ret; @@ -2635,6 +2640,11 @@ public class freeswitch { return ret; } + public static uint switch_known_bitrate(byte payload) { + uint ret = freeswitchPINVOKE.switch_known_bitrate(payload); + return ret; + } + public static SWIGTYPE_p_switch_size_t switch_fd_read_line(int fd, string buf, SWIGTYPE_p_switch_size_t len) { SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_fd_read_line(fd, buf, SWIGTYPE_p_switch_size_t.getCPtr(len)), true); if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); @@ -3178,13 +3188,17 @@ public class freeswitch { return ret; } - public static switch_status_t switch_channel_export_variable_var_check(SWIGTYPE_p_switch_channel channel, string varname, string value, switch_bool_t var_check) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_export_variable_var_check(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, value, (int)var_check); + public static switch_status_t switch_channel_export_variable_var_check(SWIGTYPE_p_switch_channel channel, string varname, string val, string export_varname, switch_bool_t var_check) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_export_variable_var_check(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, val, export_varname, (int)var_check); return ret; } - public static switch_status_t switch_channel_export_variable_printf(SWIGTYPE_p_switch_channel channel, string varname, string fmt) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_export_variable_printf(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, fmt); + public static void switch_channel_process_export(SWIGTYPE_p_switch_channel channel, SWIGTYPE_p_switch_channel peer_channel, switch_event var_event, string export_varname) { + freeswitchPINVOKE.switch_channel_process_export(SWIGTYPE_p_switch_channel.getCPtr(channel), SWIGTYPE_p_switch_channel.getCPtr(peer_channel), switch_event.getCPtr(var_event), export_varname); + } + + public static switch_status_t switch_channel_export_variable_printf(SWIGTYPE_p_switch_channel channel, string varname, string export_varname, string fmt) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_export_variable_printf(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, export_varname, fmt); return ret; } @@ -4324,6 +4338,49 @@ public class freeswitch { return ret; } + public static switch_status_t switch_ivr_dmachine_create(SWIGTYPE_p_p_switch_ivr_dmachine dmachine_p, SWIGTYPE_p_apr_pool_t pool, uint digit_timeout, uint input_timeout) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_create(SWIGTYPE_p_p_switch_ivr_dmachine.getCPtr(dmachine_p), SWIGTYPE_p_apr_pool_t.getCPtr(pool), digit_timeout, input_timeout); + return ret; + } + + public static void switch_ivr_dmachine_destroy(SWIGTYPE_p_p_switch_ivr_dmachine dmachine) { + freeswitchPINVOKE.switch_ivr_dmachine_destroy(SWIGTYPE_p_p_switch_ivr_dmachine.getCPtr(dmachine)); + } + + public static switch_status_t switch_ivr_dmachine_bind(SWIGTYPE_p_switch_ivr_dmachine dmachine, string digits, int key, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t callback, SWIGTYPE_p_void user_data) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_bind(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), digits, key, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(callback), SWIGTYPE_p_void.getCPtr(user_data)); + return ret; + } + + public static switch_status_t switch_ivr_dmachine_feed(SWIGTYPE_p_switch_ivr_dmachine dmachine, string digits, SWIGTYPE_p_p_switch_ivr_dmachine_match match) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_feed(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), digits, SWIGTYPE_p_p_switch_ivr_dmachine_match.getCPtr(match)); + return ret; + } + + public static switch_status_t switch_ivr_dmachine_clear(SWIGTYPE_p_switch_ivr_dmachine dmachine) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_clear(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine)); + return ret; + } + + public static switch_status_t switch_ivr_dmachine_ping(SWIGTYPE_p_switch_ivr_dmachine dmachine, SWIGTYPE_p_p_switch_ivr_dmachine_match match_p) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_ping(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), SWIGTYPE_p_p_switch_ivr_dmachine_match.getCPtr(match_p)); + return ret; + } + + public static switch_ivr_dmachine_match switch_ivr_dmachine_get_match(SWIGTYPE_p_switch_ivr_dmachine dmachine) { + IntPtr cPtr = freeswitchPINVOKE.switch_ivr_dmachine_get_match(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine)); + switch_ivr_dmachine_match ret = (cPtr == IntPtr.Zero) ? null : new switch_ivr_dmachine_match(cPtr, false); + return ret; + } + + public static void switch_ivr_dmachine_set_digit_timeout_ms(SWIGTYPE_p_switch_ivr_dmachine dmachine, uint digit_timeout_ms) { + freeswitchPINVOKE.switch_ivr_dmachine_set_digit_timeout_ms(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), digit_timeout_ms); + } + + public static void switch_ivr_dmachine_set_input_timeout_ms(SWIGTYPE_p_switch_ivr_dmachine dmachine, uint input_timeout_ms) { + freeswitchPINVOKE.switch_ivr_dmachine_set_input_timeout_ms(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), input_timeout_ms); + } + public static switch_status_t switch_rtp_add_crypto_key(SWIGTYPE_p_switch_rtp rtp_session, switch_rtp_crypto_direction_t direction, uint index, switch_rtp_crypto_key_type_t type, SWIGTYPE_p_unsigned_char key, SWIGTYPE_p_switch_size_t keylen) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_add_crypto_key(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), (int)direction, index, (int)type, SWIGTYPE_p_unsigned_char.getCPtr(key), SWIGTYPE_p_switch_size_t.getCPtr(keylen)); if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); @@ -5164,6 +5221,7 @@ public class freeswitch { public static readonly string SWITCH_CURRENT_APPLICATION_VARIABLE = freeswitchPINVOKE.SWITCH_CURRENT_APPLICATION_VARIABLE_get(); public static readonly string SWITCH_CURRENT_APPLICATION_DATA_VARIABLE = freeswitchPINVOKE.SWITCH_CURRENT_APPLICATION_DATA_VARIABLE_get(); public static readonly string SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE = freeswitchPINVOKE.SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE_get(); + public static readonly string SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE = freeswitchPINVOKE.SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE_get(); public static readonly string SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE = freeswitchPINVOKE.SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE_get(); public static readonly string SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE = freeswitchPINVOKE.SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE_get(); public static readonly string SWITCH_READ_RESULT_VARIABLE = freeswitchPINVOKE.SWITCH_READ_RESULT_VARIABLE_get(); @@ -5196,6 +5254,7 @@ public class freeswitch { public static readonly string SWITCH_ENDPOINT_DISPOSITION_VARIABLE = freeswitchPINVOKE.SWITCH_ENDPOINT_DISPOSITION_VARIABLE_get(); public static readonly string SWITCH_HOLD_MUSIC_VARIABLE = freeswitchPINVOKE.SWITCH_HOLD_MUSIC_VARIABLE_get(); public static readonly string SWITCH_EXPORT_VARS_VARIABLE = freeswitchPINVOKE.SWITCH_EXPORT_VARS_VARIABLE_get(); + public static readonly string SWITCH_BRIDGE_EXPORT_VARS_VARIABLE = freeswitchPINVOKE.SWITCH_BRIDGE_EXPORT_VARS_VARIABLE_get(); public static readonly string SWITCH_R_SDP_VARIABLE = freeswitchPINVOKE.SWITCH_R_SDP_VARIABLE_get(); public static readonly string SWITCH_L_SDP_VARIABLE = freeswitchPINVOKE.SWITCH_L_SDP_VARIABLE_get(); public static readonly string SWITCH_B_SDP_VARIABLE = freeswitchPINVOKE.SWITCH_B_SDP_VARIABLE_get(); @@ -5685,6 +5744,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE_get")] public static extern string SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE_get")] + public static extern string SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE_get")] public static extern string SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE_get(); @@ -5781,6 +5843,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_EXPORT_VARS_VARIABLE_get")] public static extern string SWITCH_EXPORT_VARS_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_BRIDGE_EXPORT_VARS_VARIABLE_get")] + public static extern string SWITCH_BRIDGE_EXPORT_VARS_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_R_SDP_VARIABLE_get")] public static extern string SWITCH_R_SDP_VARIABLE_get(); @@ -6438,6 +6503,36 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_console_callback_match")] public static extern void delete_switch_console_callback_match(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_dmachine_set")] + public static extern void switch_ivr_dmachine_match_dmachine_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_dmachine_get")] + public static extern IntPtr switch_ivr_dmachine_match_dmachine_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_match_digits_set")] + public static extern void switch_ivr_dmachine_match_match_digits_set(HandleRef jarg1, string jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_match_digits_get")] + public static extern string switch_ivr_dmachine_match_match_digits_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_match_key_set")] + public static extern void switch_ivr_dmachine_match_match_key_set(HandleRef jarg1, int jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_match_key_get")] + public static extern int switch_ivr_dmachine_match_match_key_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_user_data_set")] + public static extern void switch_ivr_dmachine_match_user_data_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_match_user_data_get")] + public static extern IntPtr switch_ivr_dmachine_match_user_data_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_ivr_dmachine_match")] + public static extern IntPtr new_switch_ivr_dmachine_match(); + + [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_ivr_dmachine_match")] + public static extern void delete_switch_ivr_dmachine_match(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_input_callback_set")] public static extern void switch_input_args_t_input_callback_set(HandleRef jarg1, HandleRef jarg2); @@ -6468,6 +6563,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_user_data_get")] public static extern IntPtr switch_input_args_t_user_data_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_dmachine_set")] + public static extern void switch_input_args_t_dmachine_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_dmachine_get")] + public static extern IntPtr switch_input_args_t_dmachine_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_input_args_t")] public static extern IntPtr new_switch_input_args_t(); @@ -7401,6 +7502,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_copy")] public static extern int switch_core_codec_copy(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_parse_fmtp")] + public static extern int switch_core_codec_parse_fmtp(string jarg1, string jarg2, uint jarg3, HandleRef jarg4); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_reset")] public static extern int switch_core_codec_reset(HandleRef jarg1); @@ -8253,6 +8357,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_is_digit_string")] public static extern int switch_is_digit_string(string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_known_bitrate")] + public static extern uint switch_known_bitrate(byte jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_fd_read_line")] public static extern IntPtr switch_fd_read_line(int jarg1, string jarg2, HandleRef jarg3); @@ -10966,10 +11073,13 @@ class freeswitchPINVOKE { public static extern string switch_channel_get_variable_partner(HandleRef jarg1, string jarg2); [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_export_variable_var_check")] - public static extern int switch_channel_export_variable_var_check(HandleRef jarg1, string jarg2, string jarg3, int jarg4); + public static extern int switch_channel_export_variable_var_check(HandleRef jarg1, string jarg2, string jarg3, string jarg4, int jarg5); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_process_export")] + public static extern void switch_channel_process_export(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, string jarg4); [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_export_variable_printf")] - public static extern int switch_channel_export_variable_printf(HandleRef jarg1, string jarg2, string jarg3); + public static extern int switch_channel_export_variable_printf(HandleRef jarg1, string jarg2, string jarg3, string jarg4); [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_variable_dup")] public static extern string switch_channel_get_variable_dup(HandleRef jarg1, string jarg2, int jarg3); @@ -11931,6 +12041,33 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_uuid_exists")] public static extern int switch_ivr_uuid_exists(string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_create")] + public static extern int switch_ivr_dmachine_create(HandleRef jarg1, HandleRef jarg2, uint jarg3, uint jarg4); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_destroy")] + public static extern void switch_ivr_dmachine_destroy(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_bind")] + public static extern int switch_ivr_dmachine_bind(HandleRef jarg1, string jarg2, int jarg3, HandleRef jarg4, HandleRef jarg5); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_feed")] + public static extern int switch_ivr_dmachine_feed(HandleRef jarg1, string jarg2, HandleRef jarg3); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_clear")] + public static extern int switch_ivr_dmachine_clear(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_ping")] + public static extern int switch_ivr_dmachine_ping(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_get_match")] + public static extern IntPtr switch_ivr_dmachine_get_match(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_set_digit_timeout_ms")] + public static extern void switch_ivr_dmachine_set_digit_timeout_ms(HandleRef jarg1, uint jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_dmachine_set_input_timeout_ms")] + public static extern void switch_ivr_dmachine_set_input_timeout_ms(HandleRef jarg1, uint jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RTP_MAX_BUF_LEN_get")] public static extern int SWITCH_RTP_MAX_BUF_LEN_get(); @@ -15417,6 +15554,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t { private HandleRef swigCPtr; @@ -16767,6 +16934,66 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_p_switch_ivr_dmachine { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_ivr_dmachine(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_ivr_dmachine() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_dmachine obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + +public class SWIGTYPE_p_p_switch_ivr_dmachine_match { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_ivr_dmachine_match(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_ivr_dmachine_match() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_dmachine_match obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_p_switch_ivr_menu { private HandleRef swigCPtr; @@ -17607,6 +17834,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_switch_ivr_dmachine { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_ivr_dmachine(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_ivr_dmachine() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_switch_ivr_dmachine obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_switch_ivr_menu_action_function_t { private HandleRef swigCPtr; @@ -20848,6 +21105,7 @@ public enum switch_channel_flag_t { CF_EARLY_HANGUP, CF_MEDIA_SET, CF_CONSUME_ON_ORIGINATE, + CF_PASSTHRU_PTIME_MISMATCH, CF_FLAG_MAX } @@ -24949,6 +25207,17 @@ public class switch_input_args_t : IDisposable { } } + public SWIGTYPE_p_switch_ivr_dmachine dmachine { + set { + freeswitchPINVOKE.switch_input_args_t_dmachine_set(swigCPtr, SWIGTYPE_p_switch_ivr_dmachine.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_input_args_t_dmachine_get(swigCPtr); + SWIGTYPE_p_switch_ivr_dmachine ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_ivr_dmachine(cPtr, false); + return ret; + } + } + public switch_input_args_t() : this(freeswitchPINVOKE.new_switch_input_args_t(), true) { } @@ -26230,6 +26499,95 @@ public enum switch_ivr_action_t { namespace FreeSWITCH.Native { +using System; +using System.Runtime.InteropServices; + +public class switch_ivr_dmachine_match : IDisposable { + private HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal switch_ivr_dmachine_match(IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new HandleRef(this, cPtr); + } + + internal static HandleRef getCPtr(switch_ivr_dmachine_match obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } + + ~switch_ivr_dmachine_match() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_switch_ivr_dmachine_match(swigCPtr); + } + swigCPtr = new HandleRef(null, IntPtr.Zero); + GC.SuppressFinalize(this); + } + } + + public SWIGTYPE_p_switch_ivr_dmachine dmachine { + set { + freeswitchPINVOKE.switch_ivr_dmachine_match_dmachine_set(swigCPtr, SWIGTYPE_p_switch_ivr_dmachine.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_ivr_dmachine_match_dmachine_get(swigCPtr); + SWIGTYPE_p_switch_ivr_dmachine ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_ivr_dmachine(cPtr, false); + return ret; + } + } + + public string match_digits { + set { + freeswitchPINVOKE.switch_ivr_dmachine_match_match_digits_set(swigCPtr, value); + } + get { + string ret = freeswitchPINVOKE.switch_ivr_dmachine_match_match_digits_get(swigCPtr); + return ret; + } + } + + public int match_key { + set { + freeswitchPINVOKE.switch_ivr_dmachine_match_match_key_set(swigCPtr, value); + } + get { + int ret = freeswitchPINVOKE.switch_ivr_dmachine_match_match_key_get(swigCPtr); + return ret; + } + } + + public SWIGTYPE_p_void user_data { + set { + freeswitchPINVOKE.switch_ivr_dmachine_match_user_data_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_ivr_dmachine_match_user_data_get(swigCPtr); + SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false); + return ret; + } + } + + public switch_ivr_dmachine_match() : this(freeswitchPINVOKE.new_switch_ivr_dmachine_match(), true) { + } + +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + public enum switch_ivr_menu_flags { SWITCH_IVR_MENU_FLAG_FALLTOMAIN = (1 << 0), SWITCH_IVR_MENU_FLAG_FREEPOOL = (1 << 1), @@ -29186,6 +29544,7 @@ public enum switch_status_t { SWITCH_STATUS_NOUNLOAD, SWITCH_STATUS_IGNORE, SWITCH_STATUS_TOO_SMALL, + SWITCH_STATUS_FOUND, SWITCH_STATUS_NOT_INITALIZED } diff --git a/src/mod/languages/mod_perl/mod_perl_wrap.cpp b/src/mod/languages/mod_perl/mod_perl_wrap.cpp index 370c88b..2efbdf1 100644 --- a/src/mod/languages/mod_perl/mod_perl_wrap.cpp +++ b/src/mod/languages/mod_perl/mod_perl_wrap.cpp @@ -9732,17 +9732,17 @@ XS(SWIG_init) { SWIG_TypeClientData(SWIGTYPE_p_IVRMenu, (void*) "freeswitch::IVRMenu"); SWIG_TypeClientData(SWIGTYPE_p_API, (void*) "freeswitch::API"); SWIG_TypeClientData(SWIGTYPE_p_input_callback_state, (void*) "freeswitch::input_callback_state_t"); - /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_HUP", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_HUP))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; - /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_FREE", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_FREE))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; - /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_RDLOCK", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_RDLOCK))); SvREADONLY_on(sv); commit 3bae1e7ab2805042c35570c268e7b8e49d6fccac Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Oct 6 08:38:32 2010 -0500 refactor diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 13d304d..f2cc05d 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -242,14 +242,15 @@ static switch_status_t sofia_on_execute(switch_core_session_t *session) return SWITCH_STATUS_SUCCESS; } -char *generate_pai_str(switch_core_session_t *session) +char *generate_pai_str(private_object_t *tech_pvt) { - private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session); + switch_core_session_t *session = tech_pvt->session; const char *callee_name = NULL, *callee_number = NULL; const char *var, *header, *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent"); char *pai = NULL; - if (!sofia_test_pflag(tech_pvt->profile, PFLAG_CID_IN_1XX) || + + if (!sofia_test_pflag(tech_pvt->profile, PFLAG_PASS_CALLEE_ID) || !sofia_test_pflag(tech_pvt->profile, PFLAG_CID_IN_1XX) || ((var = switch_channel_get_variable(tech_pvt->channel, "sip_cid_in_1xx")) && switch_false(var))) { return NULL; } @@ -521,7 +522,7 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session) switch_channel_set_variable(channel, "sip_hangup_disposition", "send_refuse"); } if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) { - char *cid = generate_pai_str(session); + char *cid = generate_pai_str(tech_pvt); nua_respond(tech_pvt->nh, sip_cause, sip_status_phrase(sip_cause), TAG_IF(!zstr(reason), SIPTAG_REASON_STR(reason)), @@ -703,9 +704,9 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session) char *extra_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_RESPONSE_HEADER_PREFIX); char *cid = NULL; - if (sofia_test_pflag(tech_pvt->profile, PFLAG_PASS_CALLEE_ID)) { - cid = generate_pai_str(session); - } + + cid = generate_pai_str(tech_pvt); + if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) && tech_pvt->early_sdp && strcmp(tech_pvt->early_sdp, tech_pvt->local_sdp_str)) { /* The SIP RFC for SOA forbids sending a 183 with one sdp then a 200 with another but it won't do us much good unless @@ -1968,7 +1969,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi } else if (code == 484 && msg->numeric_arg) { const char *to = switch_channel_get_variable(channel, "sip_to_uri"); const char *max_forwards = switch_channel_get_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE); - char *cid = generate_pai_str(session); + char *cid = generate_pai_str(tech_pvt); char *to_uri = NULL; if (to) { @@ -2066,7 +2067,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi !switch_channel_test_flag(channel, CF_EARLY_MEDIA) && !switch_channel_test_flag(channel, CF_ANSWERED)) { char *extra_header = sofia_glue_get_extra_headers(channel, SOFIA_SIP_PROGRESS_HEADER_PREFIX); const char *call_info = switch_channel_get_variable(channel, "presence_call_info_full"); - char *cid = generate_pai_str(session); + char *cid = generate_pai_str(tech_pvt); switch (ring_ready_val) { @@ -2187,9 +2188,8 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi char *extra_header = sofia_glue_get_extra_headers(channel, SOFIA_SIP_PROGRESS_HEADER_PREFIX); char *cid = NULL; - if (sofia_test_pflag(tech_pvt->profile, PFLAG_PASS_CALLEE_ID)) { - cid = generate_pai_str(session); - } + cid = generate_pai_str(tech_pvt); + if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) && tech_pvt->early_sdp && strcmp(tech_pvt->early_sdp, tech_pvt->local_sdp_str)) { commit e9c190de6280eec4b81c53d0d24bf3dfe6239857 Merge: 02ccd11 3716cf6 Author: Michael S Collins <msc@freeswitch.org> Date: Tue Oct 5 15:04:20 2010 -0700 Merge branch 'master' of git://git.freeswitch.org/freeswitch commit 02ccd111fa2e5c1d5e72bf03bbe9f08bef4388cf Author: Michael S Collins <msc@freeswitch.org> Date: Tue Oct 5 15:04:02 2010 -0700 Add sounds, update ChangeLog through 2010-10-05 diff --git a/docs/ChangeLog b/docs/ChangeLog index 412ab9f..d6fddd6 100644 --- a/docs/ChangeLog +++ b/docs/ChangeLog @@ -16,6 +16,9 @@ freeswitch (1.0.7) build: VS 2010 - Change to V4 framework, add SWIG v2.0 files to fix release build exceptions(temp fix till we upgrade all SWIG files) (r:812f4309) build: Windows VS2010 build - remove strange characters (r:ba1546e0/FSBUILD-297) build: Make bootstrap.sh Bourne shell compatible (r:8dbd62ff/FSBUILD-301) + build: add mod_osp Makefile to configure generated Makefiles (r:dc06a039/FS-122) + build: Remove mod_spidermonkey from windows 2008 x64 builds - does not work (r:280e894d) + build: fix warnings on windows x64 builds src and mods projects - only libsofia included on the libs side (r:45ecbc2f) codec2: working prototype, still for testing only (r:04ca0751) config: move limit.conf to db.conf config: Update VM phrase macros to voice option then action on main, config menus @@ -26,6 +29,7 @@ freeswitch (1.0.7) config: move enum to the bottom of default. (r:4d448c97) config: Add att_xfer example to default dialplan (r:20ec962a) config: default example to resolve some issues with SCA in cases where host and ip are mixed causing the phone to be confused. (r:0279261b) + config: Fix phrase files, still missing a sound file (r:6741f350/FS-2742) core: Add RTCP support (FSRTP-14) core: handle some errors on missing db handle conditions core: add ... and shutdown as a fail-safe when no modules are loaded @@ -95,7 +99,19 @@ freeswitch (1.0.7) core: avoid segfault when sofia tries to update the callee id at the same time as the outbound call is transferred (r:df63657e) core: make code more automagic to shut up the dude on the list (r:d093a4a4) core: Fix memory leak if we fail to enqueue new event to EVENT_QUEUE in switch_event.c (r:ef773e07/FS-2148) + core: fix endless loop on startup when specifying -nosql (r:b6a533ee) + core: Buffer for url encode in switch_ivr_set_xml_chan_vars() too small by 1 (r:0cc28f37/FS-2167) + core: fix switch_ivr_collect_digits_callback to allow an args pointer with null callback to work like other apis (r:89d99a91) + core: ERROR_PARTIAL and BAD_PARTIAL are regarded as PARTIAL in switch_regex_match_partial (r:b4548a60/FS-2238) + core: sprinkle digit_timeout into switch_ivr_read and switch_ivr_play_and_get_digits and the higher level variants (r:cfa30468) + core: Fix parse of variable absolute_codec_string when inside [] (r:54bf6575/FS-2126) + core: Fix SWITCH_IO_FLAG_NOBLOCK needed for mod_sangoma_codec (r:bc304153/FS-2017) + core: fix coredump in rtcp socket handling (r:6c1070ea/FS-2009) + core: add bitrate patch from moc with some extra stuff for late neg mode (r:633f193d) + core: refactor fmtp parser as a core func (r:56f8c11f) + core: add switch_ivr_dmachine async digit parser to core (r:7f3319dc) lang: Improve French phrase files (FSCONFIG-23) + libapr: Fix issue where after a bridge with a member, uuid of Agent is set to single quote character ' (r:3fee704d/FS-2738) libdingaling: fix race on shutdown causing crash (FSMOD-47) libdingaling: Fix crash in new GV interface when exceeding 24 calls (r:be00609a/FS-2171) libesl: Fix potential race condition (ESL-36) @@ -113,9 +129,11 @@ freeswitch (1.0.7) libfreetdm: implemented freetdm config nodes and ss7 initial configuration libfreetdm: fix codec for CAS signaling (r:b76e7f18) libfreetdm: freetdm: ss7- added support for incoming group blocks, started adding support for ansi (r:c219a73c) + libgnutls: link to libgcrypt as well, please report any platforms this breaks, but it should be portable (r:c569fb0f/FS-1248) libopenzap: Add CLI tracing libs: Merged OpenZAP and FreeTDM into the FreeSWITCH tree. libs: Add support for TLS on Windows using openssl (r:1abe3b93/MODSOFIA-92) + libs: fix bsd shell incompatibility (r:e2b85e94/FS-287) libsofiasip: Fix random crashes (r:c15ee980/SFSIP-219) libsofiasip: Fix T.38 bug in sofia_glue (r:2843f1ad/MODSOFIA-94) libsofiasip: VS2010 sofia posix problem (r:46dd24c2/SFSIP-220) @@ -139,6 +157,8 @@ freeswitch (1.0.7) mod_callcenter: Add more channel variable and event and fix a mem leak (r:2d3d8c8d) mod_callcenter: Make more sence to bridge the caller to the agent. Before, in the xml_cdr you saw it it like the agent initiated the call to the member (r:0be95658) mod_callcenter: Added max-wait-time and max-wait-time-with-no-agent param to a queue. (r:3482f95e) + mod_callcenter: Make sure we fail to load if config is not present (r:e1fb79a1) + mod_callcenter: Fix invalid update of agent field (r:426a448f/FS-2738) mod_cidlookup: null xml is bad (r:095815f8) mod_cid_lookup: honor skipcitystate when using whitepages (r:a66654de/FSMOD-53) mod_commands: make break uuid_break and add cascade flag @@ -152,6 +172,7 @@ freeswitch (1.0.7) mod_commands: Fix user_data returning the first value found instead of the last. Also add support to get variable from the group. (r:402f2391) mod_commands: Allow cond API to return empty false value (r:c8a897b9) mod_commands: ***BEHAVIOUR CHANGE*** reloadacl, load <module>, reload <module> will now explicitly call reloadxml (r:42c9df72) + mod_commands: add nat_map usage (r:7577b8aa) mod_conference: Fix reporting of volume up/down (MODAPP-419) mod_conference: add last talking time per member to conference xml list mod_conference: add terminate-on-silence conference param @@ -170,6 +191,7 @@ freeswitch (1.0.7) mod_dptools: add eavesdrop_enable_dtmf chan var (r:596c0012) mod_dptools: Make park app not send 183 session progress (r:76932995/FSCORE-567) mod_dptools: add block_dtmf and unblock_dtmf apps (r:d9eb0197) + mod_dptools: refactor export code and add new bridge_export app which is like export but exports across when one channel bridges another (r:4aa9a838) mod_erlang_event: Make XML fetch reply ACKs distinguishable, update freeswitch.erl (r:9d44ed04) mod_erlang_event: Add 3 new commands; session_event, session_noevents, session_nixevent (r:698fa045) mod_erlang_event: generate long node names the same as erlang does (r:9ad509c2) @@ -181,6 +203,7 @@ freeswitch (1.0.7) mod_fifo: add taking_calls param to fifo member add and config file (r:821488bf) mod_fifo: add nomedia flag (r:2d30a8c2) mod_fifo: Fix inconsistency between the fifo queue and the channels (num callers in queue can become "-1") (r:07487114/FS-1659) + mod_fifo: fix issue leaving stale records in fifo_bridge table (r:b36d015f) mod_freetdm: Fix for TON and NPI not passed through to channel variables on incoming calls mod_freetdm: add pvt data to freetdm channels fix fxs features (r:9d456900) mod_freetdm: export and import boost custom data (r:edb2d582) @@ -244,6 +267,7 @@ freeswitch (1.0.7) mod_lcr: don't count twice (r:eaeabc7b/FS-1810) mod_loopback: add loopback_bowout_on_execute var to make 1 legged loopback calls bow out of the picture mod_loopback: only execute app once in app mode (r:64f58f2d) + mod_loopback: fix bug in mod_loopback where bowout=false (r:e9ab5368) mod_lua: Add switch_core_sqldb functionality from inside Lua script (r:26f2e095/FS-1384) mod_lua: Made 2nd arg to freeswitch.Dbh:query (cb func) optional (r:87db11af) mod_lua: Added SAF_ROUTING_EXEC flag to lua app, so it can be run inline (r:7d5ca1c0) @@ -268,6 +292,7 @@ freeswitch (1.0.7) mod_sangoma_codec: rename load/noload to register/noregister mod_sangoma_codec: silence suppression (r:73d9d56f) mod_say_es: fix grammar when saying dates and time (r:6bed19b2/MODAPP-429) + mod_say_ja: initial commit, still needs sound files (r:b2423158/FS-2755) mod_say_ru: Fix saying time with +1 hour of current time (r:68d74c31/MODAPP-444) mod_say_zh: Number reading should now be OK for the whole range of integers for Cantonese and Mandarin mod_silk: Fix mod_silk compliance and performance issues (r:2ddbc457/MODCODEC-20) @@ -350,6 +375,22 @@ freeswitch (1.0.7) mod_sofia: add inline lists for tab complete db using ::[a:b syntax (r:445731ee) mod_sofia: add sofia profile <profile> gwlist up|down to list up or downed profiles for feeding into mod distributor to exclude dead gateways (r:0477cb67) mod_sofia: add 'sofia global siptrace on' so we don't have to always teach people to enable sip trace on each profile (r:09fa6678) + mod_sofia: fix seg on subscribe with no contact host (r:c236541e) + mod_sofia: fix typo and printf specifier resulting in incorrect output of call counts on profiles and gateways (r:29ea6e29) + mod_sofia: fix t38 passthru when port changes on re-invite (r:72baaf6d) + mod_sofia: let ~ signify that multipart content will contain headers (r:3548168d) + mod_sofia: Fix rash with rxfax when no remote host (r:a9446ac1/FS-677) + mod_sofia: Handle incorrectly formatted T.38 booleans (r:8f731f42/FS-957) + mod_sofia: fix crash in sofia_reg_find_gateway_by_realm__ (r:721c8019/FS-488) + mod_sofia: Handle 301 moved permanently. (r:ba59c51d/FS-2739) + mod_sofia: don't passthru when its proxy media, bypass media or there is no rtp session, fixes seg (r:45e2b99d) + mod_sofia: improve video support for new polycom phones (r:84a383fe) + mod_sofia: Forward unsolicited MWI nofity (r:e946da9a/FS-861) + mod_sofia: Support display updates for Cisco SIP endpoints (tested on SPA series) (r:6937ca39/FS-884) + mod_sofia: BLF compliance with RFC-4235: dialog-info 'version=' field is reset to 0 on every new call instead of being incremented (r:589502d3/FS-2747) + mod_sofia: fix parsing of sofia tracelevel param, moved param from profile params to global_settings as its global, and it only worked on reparse before anyways. Please correct any documentation on this issue on the wiki (r:82c4c4cc/FS-523) + mod_sofia: fix nat acl count check to check against the number of nat acls (r:e11550e7/FS-502) + mod_sofia: add sofia_glue_find_parameter_value function to get a specific value from a url params string (r:c701d41c) mod_spandsp: initial checkin of mod_fax/mod_voipcodecs merge into mod_spandsp (r:fa9a59a8) mod_spandsp: rework of new mod_spandsp to have functions broken up into different c files (r:65400642) mod_spandsp: improve duplicate digit detection and add 'min_dup_digit_spacing_ms' channel variable for use with the dtmf detector (r:eab4f246/FSMOD-45) @@ -358,6 +399,9 @@ freeswitch (1.0.7) mod_spandsp: Moved spandsp to a more recent version. A huge number of little changes occur here, as recently spandsp lost all the $Id$ entries the source files had for the dark old days of CVS (r:f029f7ef) mod_spandsp: move app flag into 'T38' namespace for the sake of housekeeping (r:0d0b4b43) mod_spandsp: make t38 terminal mode more reliable (r:83da7bd3) + mod_spandsp: deadlock in mod_spandsp (mod_spandsp_fax.c) (r:b02c69bb/FS-1690) + mod_spandsp: T.38 reINVITE glare condition causes FAX processing to stop. (r:04aa7ef9/FS-1682) + mod_spandsp: improve nat handling when using stun or host as ext-rtp-ip (r:03e74c51/FS-526) mod_spidermonkey: allow vars to be set containing vars from languages (r:5cd072a3) mod_spidermonkey: fix seg in js hangup (r:7d554c11) mod_spidermonkey: Fix mod_spidermonkey build on FreeBSD, (Undefined symbol PR_LocalTimeParameters). (r:3edb8419) @@ -366,6 +410,7 @@ freeswitch (1.0.7) mod_unimrcp: fix fortify findings for mod_unimrcp (r:336f0b4e/FSMOD-67) mod_valet_parking: add event data to valet parking hold event mod_valet_parking: add event for Valet Parking action exit + mod_valet_parking: pass hold class on transfer (r:76a065ec) mod_voicemail: Fix vm_prefs profile lock (MODAPP-417) mod_voicemail: add 'vm-enabled' param (default true) mod_voicemail: fix vm msg being deleted when pressing key to forward to email (MODAPP-403) @@ -374,11 +419,13 @@ freeswitch (1.0.7) mod_voicemail: Allow to forward a message or send it via email key during the playback of the recording, not just when the menu is playing. (r:83aeda79) mod_voicemail: fix vm_inject to a group and change syntax for sending to a whole domain to domain= for clarity sake (r:f30a1cc6) mod_voicemail: add quotes to vm_cc command generated internally to escape spaces in the caller id name (r:5f012813) + mod_voicemail: Play caller id of callee prior to playing a vmail (r:e7b97907/FS-2719) mod_xml_cdr: add force_process_cdr var to process b leg cdr on a case by case basis when b leg cdr is disabled (XML-17) mod_xml_cdr: add leg param to query string (XML-24) mod_xml_cdr: fix locked sessions (XML-26) mod_xml_cdr: fix minor memory leaks and config bug (r:19253d83/MODEVENT-62) mod_xml_rpc: Fix crash if unauthorized XML RPC is attempted (r:9835395c/FS-184) + scripts: added honeypot.pl and blacklist.pl which add extra SIP security options (r:b6a81ba7) sofia-sip: fix null derefernce segfault in soa (r:f356c5e6) sofia-sip: extend timeout for session expires on short timeouts to be 90% of timeout instead of 1/3 to handle devices that do not refresh in time such as polycom (r:a7f48928/SFSIP-212) diff --git a/docs/phrase/phrase_en.xml b/docs/phrase/phrase_en.xml index 6d582e7..318aba1 100644 --- a/docs/phrase/phrase_en.xml +++ b/docs/phrase/phrase_en.xml @@ -419,6 +419,9 @@ <prompt phrase="Dude, you suck!" filename="ivr-dude_you_suck.wav"/> <prompt phrase="Your call is very important to us, but your sanity is not, so we will be happy to keep you on hold, forever torturing you with our annoying hold music." filename="ivr-on_hold_indefinitely.wav"/> <prompt phrase="...has left the building." filename="ivr-has_left_the_building.wav"/> + <prompt phrase="This phone is unassigned and may not be used to make external calls." filename="ivr-phone_is_unassigned.wav"/> + <prompt phrase="This phone is not configured properly." filename="ivr-phone_not_configured.wav"/> + <prompt phrase="Please contact the system administrator for assistance." filename="ivr-contact_system_administrator.wav"/> <prompt phrase="Barracuda Networks" filename="ivr-barracuda_networks.wav"/> <prompt phrase="CudaTel Communication Server" filename="ivr-cudatel_communication_server.wav"/> <prompt phrase="Brian West" filename="misc-Brian_West.wav"/> commit 3716cf6f791b59ac8f9a566c724e493ab2f4d315 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Oct 5 16:23:41 2010 -0500 add more proto diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index 5fee7ba..ac9d8f9 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -860,8 +860,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_feed(switch_ivr_dmachine_t * SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_clear(switch_ivr_dmachine_t *dmachine); SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t *dmachine, switch_ivr_dmachine_match_t **match_p); SWITCH_DECLARE(switch_ivr_dmachine_match_t *) switch_ivr_dmachine_get_match(switch_ivr_dmachine_t *dmachine); - - +SWITCH_DECLARE(void) switch_ivr_dmachine_set_digit_timeout_ms(switch_ivr_dmachine_t *dmachine, uint32_t digit_timeout_ms); +SWITCH_DECLARE(void) switch_ivr_dmachine_set_input_timeout_ms(switch_ivr_dmachine_t *dmachine, uint32_t input_timeout_ms); /** @} */ diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index cfb6a60..04972b3 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -87,6 +87,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_create(switch_ivr_dmachine_t } +SWITCH_DECLARE(void) switch_ivr_dmachine_set_digit_timeout_ms(switch_ivr_dmachine_t *dmachine, uint32_t digit_timeout_ms) +{ + dmachine->digit_timeout_ms = digit_timeout_ms; +} + +SWITCH_DECLARE(void) switch_ivr_dmachine_set_input_timeout_ms(switch_ivr_dmachine_t *dmachine, uint32_t input_timeout_ms) +{ + dmachine->input_timeout_ms = input_timeout_ms; +} + SWITCH_DECLARE(void) switch_ivr_dmachine_destroy(switch_ivr_dmachine_t **dmachine) { switch_memory_pool_t *pool; commit 7d3c3c843729fa1c6e3766bd5664acdbf4fa16ac Merge: ad714c5 a85254c Author: Moises Silva <moy@sangoma.com> Date: Tue Oct 5 13:29:15 2010 -0400 Merge branch 'master' of homer:smg_freeswitch commit ad714c5adad5e640863ec13cc206f5dba4a4d7b6 Author: Moises Silva <moy@sangoma.com> Date: Tue Oct 5 13:29:02 2010 -0400 added devel bootstrap script diff --git a/devel-bootstrap.sh b/devel-bootstrap.sh new file mode 100644 index 0000000..a8c4f7d --- /dev/null +++ b/devel-bootstrap.sh @@ -0,0 +1,6 @@ +#!/bin/bash +export CFLAGS="-ggdb3 -O0" +export CXXFLAGS="-ggdb3 -O0" +./bootstrap.sh -j +./configure $@ + commit a85254c4d75914b920a91a8858aa71963362b31d Author: Konrad Hammel <konrad@sangoma.com> Date: Tue Oct 5 12:37:19 2010 -0400 freetdm: ss7 - bug fix diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c index 2591766..8427820 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c @@ -869,7 +869,7 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface) /* check if the user filled in a nadi value by looking at flag */ if (!flag_cld_nadi) { /* default the nadi value to national */ - sng_isup.clg_nadi = 0x03; + sng_isup.cld_nadi = 0x03; } if (!flag_clg_nadi) { commit 156f1b41c7a5fdc1740b05eef89dc84e5f0ccaac Author: Konrad Hammel <konrad@sangoma.com> Date: Mon Oct 4 09:40:47 2010 -0400 freetdm: ss7 - added CLG_NADI and CLD_NADI X header variables, added clg_nadi and cld_nadi to configuration options diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index fc5f170..ac58abd 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -209,7 +209,10 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ /* add any special variables for the dialplan */ sprintf(nadi, "%d", siConEvnt->cgPtyNum.natAddrInd.val); - ftdm_channel_add_var(ftdmchan, "ss7_nadi", nadi); + ftdm_channel_add_var(ftdmchan, "ss7_clg_nadi", nadi); + + sprintf(nadi, "%d", siConEvnt->cdPtyNum.natAddrInd.val); + ftdm_channel_add_var(ftdmchan, "ss7_cld_nadi", nadi); /* set the state of the channel to collecting...the rest is done by the chan monitor */ ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index 1b74c88..a358236 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -206,6 +206,8 @@ typedef struct sng_isup_intf { uint32_t mtpRouteId; uint32_t ssf; uint32_t isap; + uint32_t clg_nadi; + uint32_t cld_nadi; uint16_t t4; uint32_t t10; uint32_t t11; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index 8b3f9d8..973fbf4 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -74,7 +74,8 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) SS7_FUNC_TRACE_ENTER (__FUNCTION__); sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;; - const char *nadi = NULL; + const char *clg_nadi = NULL; + const char *cld_nadi = NULL; SiConEvnt iam; sngss7_info->suInstId = get_unique_id (); @@ -183,13 +184,23 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) copy_cgPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cgPtyNum); /* check if the user would like a custom NADI value for the calling Pty Num */ - nadi = ftdm_channel_get_var(ftdmchan, "ss7_nadi"); - if ((nadi != NULL) && (*nadi)) { - SS7_DEBUG_CHAN(ftdmchan,"Found user supplied NADI value \"%s\"\n", nadi); - iam.cgPtyNum.natAddrInd.val = atoi(nadi); + clg_nadi = ftdm_channel_get_var(ftdmchan, "ss7_clg_nadi"); + if ((clg_nadi != NULL) && (*clg_nadi)) { + SS7_DEBUG_CHAN(ftdmchan,"Found user supplied NADI value \"%s\"\n", clg_nadi); + iam.cgPtyNum.natAddrInd.val = atoi(clg_nadi); } else { - SS7_DEBUG_CHAN(ftdmchan,"No user supplied NADI value found, using \"3\" %s\n", " "); - iam.cgPtyNum.natAddrInd.val = 0x03; + iam.cgPtyNum.natAddrInd.val = g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId].clg_nadi; + SS7_DEBUG_CHAN(ftdmchan,"No user supplied NADI value found for CLG, using \"%d\"\n", iam.cgPtyNum.natAddrInd.val); + } + + cld_nadi = ftdm_channel_get_var(ftdmchan, "ss7_cld_nadi"); + if ((cld_nadi != NULL) && (*cld_nadi)) { + SS7_DEBUG_CHAN(ftdmchan,"Found user supplied NADI value \"%s\"\n", cld_nadi); + iam.cdPtyNum.natAddrInd.val = atoi(cld_nadi); + } else { + iam.cdPtyNum.natAddrInd.val = g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId].cld_nadi; + SS7_DEBUG_CHAN(ftdmchan,"No user supplied NADI value found for CLD, using \"%d\"\n", iam.cdPtyNum.natAddrInd.val); + } sng_cc_con_request (sngss7_info->spId, @@ -199,10 +210,12 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) &iam, 0); - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx IAM clg = \"%s\", cld = \"%s\"\n", + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx IAM clg = \"%s\" (NADI=%d), cld = \"%s\" (NADI=%d)\n", sngss7_info->circuit->cic, ftdmchan->caller_data.cid_num.digits, - ftdmchan->caller_data.dnis.digits); + iam.cgPtyNum.natAddrInd.val, + ftdmchan->caller_data.dnis.digits, + iam.cdPtyNum.natAddrInd.val); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c index bd1be4b..2591766 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c @@ -755,6 +755,8 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface) int num_parms = isup_interface->n_parameters; int i; int linkSetId; + int flag_cld_nadi = 0; + int flag_clg_nadi = 0; memset(&sng_isup, 0x0, sizeof(sng_isup)); memset(&sng_isap, 0x0, sizeof(sng_isap)); @@ -840,6 +842,20 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface) SS7_DEBUG("\tFound license file = %s\n", g_ftdm_sngss7_data.cfg.license); SS7_DEBUG("\tFound signature file = %s\n", g_ftdm_sngss7_data.cfg.signature); /**********************************************************************/ + } else if (!strcasecmp(parm->var, "clg_nadi")) { + /**********************************************************************/ + /* throw the flag so that we know we got this optional parameter */ + flag_clg_nadi = 1; + sng_isup.clg_nadi = atoi(parm->val); + SS7_DEBUG("\tFound default CLG_NADI value = %d\n", sng_isup.clg_nadi); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "cld_nadi")) { + /**********************************************************************/ + /* throw the flag so that we know we got this optional parameter */ + flag_cld_nadi = 1; + sng_isup.cld_nadi = atoi(parm->val); + SS7_DEBUG("\tFound default CLD_NADI value = %d\n", sng_isup.cld_nadi); + /**********************************************************************/ } else { SS7_ERROR("\tFound an invalid parameter \"%s\"!\n", parm->val); return FTDM_FAIL; @@ -850,6 +866,17 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface) parm = parm + 1; } + /* check if the user filled in a nadi value by looking at flag */ + if (!flag_cld_nadi) { + /* default the nadi value to national */ + sng_isup.clg_nadi = 0x03; + } + + if (!flag_clg_nadi) { + /* default the nadi value to national */ + sng_isup.clg_nadi = 0x03; + } + /* trickle down the SPC to all sub entities */ linkSetId = g_ftdm_sngss7_data.cfg.mtpRoute[sng_isup.mtpRouteId].linkSetId; @@ -1249,6 +1276,8 @@ static int ftmod_ss7_fill_in_isup_interface(sng_isup_inf_t *sng_isup) g_ftdm_sngss7_data.cfg.isupIntf[i].switchType = sng_isup->switchType; g_ftdm_sngss7_data.cfg.isupIntf[i].ssf = sng_isup->ssf; g_ftdm_sngss7_data.cfg.isupIntf[i].isap = sng_isup->isap; + g_ftdm_sngss7_data.cfg.isupIntf[i].cld_nadi = sng_isup->cld_nadi; + g_ftdm_sngss7_data.cfg.isupIntf[i].clg_nadi = sng_isup->clg_nadi; if (sng_isup->t4 != 0) { g_ftdm_sngss7_data.cfg.isupIntf[i].t4 = sng_isup->t4; commit e3587c36a22a7847940c9c66b420ba02e11d31ea Author: Moises Silva <moy@sangoma.com> Date: Tue Oct 5 10:58:26 2010 -0400 mod_sangoma_codec: print rtp address in stats diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index d5ce08b..4e3339b 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -737,10 +737,14 @@ SWITCH_STANDARD_API(sangoma_function) stream->write_function(stream, "Failed to find session %lu\n", sessid); goto done; } - stream->write_function(stream, "Session: %lu\n", sessid); + stream->write_function(stream, "Stats for transcoding session: %lu\n", sessid); if (sess->encoder.rxrtp) { stats = switch_rtp_get_stats(sess->encoder.rxrtp, NULL); + stream->write_function(stream, "=== Encoder ===\n"); + + stream->write_function(stream, "Remote address: %s:%d\n\n", switch_rtp_get_remote_host(sess->encoder.rxrtp), switch_rtp_get_remote_port(sess->encoder.rxrtp)); + stream->write_function(stream, "-- Encoder Inbound Stats --\n"); stream->write_function(stream, "Rx Discarded: %lu\n", sess->encoder.rxdiscarded); sangoma_print_stats(stream, &stats->inbound); @@ -749,10 +753,16 @@ SWITCH_STANDARD_API(sangoma_function) stats = switch_rtp_get_stats(sess->encoder.txrtp, NULL); stream->write_function(stream, "-- Encoder Outbound Stats --\n"); sangoma_print_stats(stream, &stats->outbound); + } else { + stream->write_function(stream, "\n=== No Encoder ===\n\n"); } if (sess->decoder.rxrtp) { stats = switch_rtp_get_stats(sess->decoder.rxrtp, NULL); + + stream->write_function(stream, "=== Decoder ===\n"); + stream->write_function(stream, "Remote address: %s:%d\n\n", switch_rtp_get_remote_host(sess->decoder.rxrtp), switch_rtp_get_remote_port(sess->decoder.rxrtp)); + stream->write_function(stream, "-- Decoder Inbound Stats --\n"); stream->write_function(stream, "Rx Discarded: %lu\n", sess->decoder.rxdiscarded); sangoma_print_stats(stream, &stats->inbound); @@ -760,6 +770,8 @@ SWITCH_STANDARD_API(sangoma_function) stats = switch_rtp_get_stats(sess->decoder.txrtp, NULL); stream->write_function(stream, "-- Decoder Outbound Stats --\n"); sangoma_print_stats(stream, &stats->outbound); + } else { + stream->write_function(stream, "\n=== No Decoder ===\n\n"); } } else { stream->write_function(stream, "Unknown Command [%s]\n", argv[0]); commit d427b3df774b19c895ee0a21f0259d9a7a143d6a Author: Moises Silva <moy@sangoma.com> Date: Tue Oct 5 13:59:31 2010 -0400 freetdm: allow libpri transition from terminating to hangup diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index cc25c70..444b907 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -374,7 +374,7 @@ static ftdm_state_map_t isdn_state_map = { ZSD_OUTBOUND, ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_END}, - {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_DOWN, FTDM_END} + {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_DOWN, FTDM_END} }, { ZSD_OUTBOUND, @@ -424,7 +424,7 @@ static ftdm_state_map_t isdn_state_map = { ZSD_INBOUND, ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_END}, - {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_DOWN, FTDM_END}, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_CHANNEL_STATE_DOWN, FTDM_END}, }, { ZSD_INBOUND, commit 7be271cfec0eedad1839d579871a08bcbcfdbf59 Author: Moises Silva <moy@sangoma.com> Date: Tue Oct 5 13:44:55 2010 -0400 mod_sangoma_codec: remove global pool reference diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index ae7468e..d5ce08b 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -65,9 +65,6 @@ unsigned long long g_next_session_id = 0; /* hash of sessions (I think a linked list suits better here, but FS does not have the data type) */ static switch_hash_t *g_sessions_hash = NULL; -/* global memory pool provided by FS */ -static switch_memory_pool_t *g_pool = NULL; - typedef struct vocallo_codec_s { int codec_id; /* vocallo codec ID */ int iana; /* IANA code to register in FS */ @@ -894,8 +891,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) return SWITCH_STATUS_FALSE; } - g_pool = pool; - g_init_cfg.log = sangoma_logger; g_init_cfg.create_rtp = sangoma_create_rtp; g_init_cfg.create_rtp_port = sangoma_create_rtp_port; commit c9ab6f3355a41373dfabe854a90fa20cfb1d40f8 Author: Moises Silva <moy@sangoma.com> Date: Tue Oct 5 13:12:43 2010 -0400 freetdm: libpri update diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index bb62f07..cc25c70 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -605,10 +605,9 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) if (call) { pri_hangup(isdn_data->spri.pri, call, ftdmchan->caller_data.hangup_cause); pri_destroycall(isdn_data->spri.pri, call); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } else { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - } + ftdmchan->call_data = NULL; + } + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); } break; case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: @@ -617,8 +616,7 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan) { sig.event_id = FTDM_SIGEVENT_STOP; status = ftdm_span_send_signal(ftdmchan->span, &sig); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - + /* user moves us to HANGUP and from there we go to DOWN */ } default: break; @@ -641,10 +639,12 @@ static __inline__ void check_state(ftdm_span_t *span) for(j = 1; j <= span->chan_count; j++) { if (ftdm_test_flag((span->channels[j]), FTDM_CHANNEL_STATE_CHANGE)) { ftdm_mutex_lock(span->channels[j]->mutex); + ftdm_channel_lock(span->channels[j]); ftdm_clear_flag((span->channels[j]), FTDM_CHANNEL_STATE_CHANGE); state_advance(span->channels[j]); ftdm_channel_complete_state(span->channels[j]); ftdm_mutex_unlock(span->channels[j]->mutex); + ftdm_channel_unlock(span->channels[j]); } } } @@ -682,18 +682,35 @@ static int on_hangup(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_even q931_call *call = NULL; ftdmchan = span->channels[pevent->hangup.channel]; - if (ftdmchan) { - call = (q931_call *) ftdmchan->call_data; - ftdm_log(FTDM_LOG_DEBUG, "-- Hangup on channel %d:%d\n", spri->span->span_id, pevent->hangup.channel); - ftdmchan->caller_data.hangup_cause = pevent->hangup.cause; - pri_release(spri->pri, call, 0); - pri_destroycall(spri->pri, call); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - } else { - ftdm_log(FTDM_LOG_DEBUG, "-- Hangup on channel %d:%d %s but it's not in use?\n", spri->span->span_id, - pevent->hangup.channel, ftdmchan->chan_id); + if (!ftdmchan) { + ftdm_log(FTDM_LOG_CRIT, "-- Hangup on channel %d:%d %s but it's not in use?\n", spri->span->span_id, pevent->hangup.channel); + return 0; } + ftdm_channel_lock(ftdmchan); + + if (ftdmchan->state >= FTDM_CHANNEL_STATE_TERMINATING) { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Ignoring remote hangup in state %s\n", ftdm_channel_state2str(ftdmchan->state)); + goto done; + } + + if (!ftdmchan->call_data) { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Ignoring remote hangup in state %s with no call data\n", ftdm_channel_state2str(ftdmchan->state)); + goto done; + } + + call = (q931_call *) ftdmchan->call_data; + ftdm_log(FTDM_LOG_DEBUG, "-- Hangup on channel %d:%d\n", spri->span->span_id, pevent->hangup.channel); + ftdmchan->caller_data.hangup_cause = pevent->hangup.cause; + pri_release(spri->pri, call, 0); + pri_destroycall(spri->pri, call); + ftdmchan->call_data = NULL; + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + +done: + + ftdm_channel_unlock(ftdmchan); + return 0; } commit 80883ebeb81c73a3dc5c4ee65050d57e2c6ccf00 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Oct 5 11:11:21 2010 -0500 don't force wake thread diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 7e427b5..c467a23 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -871,7 +871,7 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_db_thread(switch_thread_t *threa while (sql_manager.db_thread_running == 1) { if (++sec == SQL_CACHE_TIMEOUT) { sql_close(switch_epoch_time_now(NULL)); - wake_thread(1); + wake_thread(0); sec = 0; } switch_yield(1000); @@ -1425,7 +1425,7 @@ static void core_event_handler(switch_event_t *event) switch_queue_push(sql_manager.sql_queue[0], sql[i]); } sql[i] = NULL; - wake_thread(1); + wake_thread(0); } } } @@ -1705,7 +1705,7 @@ void switch_core_sqldb_stop(void) switch_queue_push(sql_manager.sql_queue[0], NULL); switch_queue_push(sql_manager.sql_queue[1], NULL); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Waiting for unfinished SQL transactions\n"); - wake_thread(1); + wake_thread(0); } sql_manager.thread_running = -1; commit 748b82f640fdd674f6d5eaf7f7b63c500a7a33f4 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Oct 5 10:50:07 2010 -0500 minor tweaks diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 1fee5f9..cfb6a60 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -71,8 +71,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_create(switch_ivr_dmachine_t switch_byte_t my_pool = !!pool; switch_ivr_dmachine_t *dmachine; - if (digit_timeout_ms < 1 || input_timeout_ms < 1) return SWITCH_STATUS_FALSE; - if (!pool) { switch_core_new_memory_pool(&pool); } @@ -229,9 +227,13 @@ static switch_bool_t switch_ivr_dmachine_check_timeout(switch_ivr_dmachine_t *dm { switch_time_t now = switch_time_now(); uint32_t timeout = dmachine->cur_digit_len ? dmachine->digit_timeout_ms : dmachine->input_timeout_ms; - - if ((uint32_t)((now - dmachine->last_digit_time) / 1000) > timeout) { - return SWITCH_TRUE; + + if (!dmachine->last_digit_time) dmachine->last_digit_time = now; + + if (timeout) { + if ((uint32_t)((now - dmachine->last_digit_time) / 1000) > timeout) { + return SWITCH_TRUE; + } } return SWITCH_FALSE; @@ -253,7 +255,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t * dm_match_t is_match = switch_ivr_dmachine_check_match(dmachine, is_timeout); switch_status_t r; - if (!dmachine->last_digit_time) { + if (zstr(dmachine->digits) && !is_timeout) { r = SWITCH_STATUS_SUCCESS; } else if (dmachine->cur_digit_len > dmachine->max_digit_len) { r = SWITCH_STATUS_FALSE; commit b24231587c8035bf080e3c15b50ed443b2fe1afd Author: Brian West <brian@freeswitch.org> Date: Tue Oct 5 10:12:28 2010 -0500 FS-2755 diff --git a/src/mod/say/mod_say_ja/mod_say_ja.c b/src/mod/say/mod_say_ja/mod_say_ja.c new file mode 100644 index 0000000..407d2d4 --- /dev/null +++ b/src/mod/say/mod_say_ja/mod_say_ja.c @@ -0,0 +1,502 @@ +/* + * Copyright (c) 2007, Anthony Minessale II + * 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 original author; nor the names of any 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 OWNER + * 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. + * + * The Initial Developer of the Original Code is + * Anthony Minessale II <anthm@freeswitch.org> + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Anthony Minessale II <anthm@freeswitch.org> + * Braga Bruno <bruno.braga@gmail.com> + * + * + * mod_say_ja.c -- Say for Japanese. + * + */ + +#include <switch.h> +#include <math.h> +#include <ctype.h> +#include <string.h> + +SWITCH_MODULE_LOAD_FUNCTION(mod_say_ja_load); +SWITCH_MODULE_DEFINITION(mod_say_ja, mod_say_ja_load, NULL, NULL); + +#define say_num(num, meth) { \ + char tmp[80]; \ + switch_status_t tstatus; \ + switch_say_method_t smeth = say_args->method; \ + switch_say_type_t stype = say_args->type; \ + say_args->type = SST_ITEMS; say_args->method = meth; \ + switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \ + if ((tstatus = \ + ja_say_general_count(session, tmp, say_args, args)) \ + != SWITCH_STATUS_SUCCESS) { \ + return tstatus; \ + } \ + say_args->method = smeth; say_args->type = stype; \ + } \ + +#define say_file(...) { \ + char tmp[80]; \ + switch_status_t tstatus; \ + switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__); \ + if ((tstatus = \ + switch_ivr_play_file(session, NULL, tmp, args)) \ + != SWITCH_STATUS_SUCCESS){ \ + return tstatus; \ + } \ + if (!switch_channel_ready(switch_core_session_get_channel(session))) { \ + return SWITCH_STATUS_FALSE; \ + }} \ + +static switch_status_t ja_say_general_count(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +{ + int in; + char sbuf[13] = ""; + char digits[11]; + int i; + + if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); + return SWITCH_STATUS_GENERR; + } + + in = atoi(tosay); + + if (in != 0) { + snprintf(digits, sizeof(digits), "%10.10d", in); + switch (say_args->method) { + case SSM_COUNTED: + say_file("digits/ordinal.wav"); + /* Fall through */ + case SSM_PRONOUNCED: + for (i = 0; i <= 9; i++) { + switch (i) { + case 0: + /* Billions column */ + if (digits[i] != '0') { + if (digits[i] != '1') + say_file("digits/%c.wav", digits[i]); + say_file("digits/10.wav"); + if (memcmp(digits + 1, "0", 1) == 0) + say_file("digits/100000000.wav", digits[i]); + } + break; + case 1: + /* Hundred millions columns */ + if (digits[i] != '0') { + say_file("digits/%c.wav", digits[i]); + say_file("digits/100000000.wav", digits[i]); + } + break; + case 2: + /* Ten millions column */ + if (digits[i] != '0') { + say_file("digits/%c.wav", digits[i]); + say_file("digits/1000.wav"); + if (memcmp(digits + 3, "000", 3) == 0) + say_file("digits/10000.wav", digits[i]); + } + break; + case 3: + /* Millions column */ + if (digits[i] != '0') { + say_file("digits/%c.wav", digits[i]); + say_file("digits/100.wav"); + if (memcmp(digits + 4, "00", 2) == 0) + say_file("digits/10000.wav", digits[i]); + } + break; + case 4: + /* Hundred thousands column */ + if (digits[i] != '0') { + if (digits[i] != '1') + say_file("digits/%c.wav", digits[i]); + say_file("digits/10.wav"); + if (memcmp(digits + 5, "0", 1) == 0) + say_file("digits/10000.wav", digits[i]); + } + break; + + case 5: + /* Ten thousands column */ + if (digits[i] != '0') { + say_file("digits/%c.wav", digits[i]); + say_file("digits/10000.wav"); + } + break; + case 6: + /* thousands column */ + if (digits[i] != '0') { + + switch (digits[i]) { + case '1': + if (memcmp(digits, "000000", 6) != 0) { + say_file("digits/1000s.wav"); + } else { + say_file("digits/1000.wav"); + } + break; + case '3': + say_file("digits/3000.wav"); + break; + default: + say_file("digits/%c.wav", digits[i]); + say_file("digits/1000.wav"); + break; + } + } + break; + case 7: + /* hundreds column */ + if (digits[i] != '0') { + switch (digits[i]) { + case '1': + say_file("digits/100.wav"); + break; + case '3': + say_file("digits/300.wav"); + break; + case '6': + say_file("digits/600.wav"); + break; + case '8': + say_file("digits/800.wav"); + break; + default: + say_file("digits/%c.wav", digits[i]); + say_file("digits/100.wav"); + break; + } + } + break; + case 8: + /* Tens column */ + if (digits[i] != '0') { + if (digits[i] != '1') + say_file("digits/%c.wav", digits[i]); + say_file("digits/10.wav"); + } + break; + case 9: + /* Units column */ + if (digits[i] != '0') + say_file("digits/%c.wav", digits[i]); + break; + } + } + break; + case SSM_ITERATED: + { + char *p; + for (p = tosay; p && *p; p++) + say_file("digits/%c.wav", *p); + } + break; + default: + break; + } + } else { + say_file("digits/0.wav"); + } + + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t ja_say_time(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +{ + int32_t t; + switch_time_t target = 0; + switch_time_exp_t tm; + uint8_t say_date = 0; + uint8_t say_time = 0; + + int mod_min; + char buffer[3]; + + + if (say_args->type == SST_TIME_MEASUREMENT) { + int64_t hours = 0; + int64_t minutes = 0; + int64_t seconds = 0; + int64_t r = 0; + if (strchr(tosay, ':')) { + char *tme = switch_core_session_strdup(session, tosay); + char *p; + + if ((p = strrchr(tme, ':'))) { + *p++ = '\0'; + seconds = atoi(p); + if ((p = strchr(tme, ':'))) { + *p++ = '\0'; + minutes = atoi(p); + if (tme) { + hours = atoi(tme); + } + } else { + minutes = atoi(tme); + } + } + } else { + if ((seconds = atoi(tosay)) <= 0) { + seconds = (int64_t) switch_epoch_time_now(NULL); + } + + if (seconds >= 60) { + minutes = seconds / 60; + r = seconds % 60; + seconds = r; + } + + if (minutes >= 60) { + hours = minutes / 60; + r = minutes % 60; + minutes = r; + } + } + + if (hours) { + say_num(hours, SSM_PRONOUNCED); + say_file("time/hours.wav"); + } + if (minutes) { + say_num(minutes, SSM_PRONOUNCED); + say_file("time/minute.wav"); + } else { + if (hours) { + say_file("digits/0.wav"); + say_file("time/minute.wav"); + } + } + + if (seconds) { + say_num(hours, SSM_PRONOUNCED); + say_file("time/seconds.wav"); + } else { + if (hours || minutes) { + say_file("digits/0.wav"); + say_file("time/second.wav"); + } + } + + return SWITCH_STATUS_SUCCESS; + } + + if ((t = atoi(tosay)) > 0) + target = switch_time_make(t, 0); + else + target = switch_micro_time_now(); + switch_time_exp_lt(&tm, target); + + switch (say_args->type) { + case SST_CURRENT_DATE_TIME: + say_date = say_time = 1; + break; + case SST_CURRENT_DATE: + say_date = 1; + break; + case SST_CURRENT_TIME: + say_time = 1; + break; + default: + break; + } + + if (say_date) { + say_num(tm.tm_year + 1900, SSM_PRONOUNCED); + say_file("time/year.wav"); + say_file("time/month-%d.wav", tm.tm_mon); + say_file("time/day-%d.wav", tm.tm_mday); + } + + if (say_time) { + int32_t hour = tm.tm_hour; + + if (hour < 12) { + say_file("time/am.wav"); + } else { + say_file("time/pm.wav"); + } + say_file("time/hour-%d.wav", tm.tm_hour); + if (tm.tm_min > 10) { + int temp; + char tch[1+1]; + mod_min = tm.tm_min % 10; + memset(buffer,0,sizeof(buffer)); + memset(tch,0,sizeof(tch)); + sprintf(buffer, "%d", tm.tm_min); + memcpy(tch,buffer,1); + temp = atoi(tch); + if (temp > 1){ + say_num(temp,SSM_PRONOUNCED); + } + if (mod_min != 0){ + say_file("digits/10.wav"); + } + else{ + mod_min = 10; + } + } else { + mod_min = tm.tm_min; + } + switch(mod_min) { + case 0: + say_file("time/oclock.wav", mod_min); + break; + case 1: + case 3: + case 4: + case 6: + case 8: + case 10: + say_file("time/min-%d.wav", mod_min); + break; + default: + say_num(mod_min, SSM_PRONOUNCED); + say_file("time/minute.wav"); + break; + } + } + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t ja_say_money(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +{ + char sbuf[16] = ""; /* enough for 999,999,999,999.99 (w/o the commas or leading $) */ + char *dollars = NULL; + char *cents = NULL; + + if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); + return SWITCH_STATUS_GENERR; + } + + dollars = sbuf; + + if ((cents = strchr(sbuf, '.'))) { + *cents++ = '\0'; + if (strlen(cents) > 2) { + cents[2] = '\0'; + } + } + + /* If positive sign - skip over" */ + if (sbuf[0] == '+') { + dollars++; + } + + /* If negative say "negative" */ + if (sbuf[0] == '-') { + say_file("currency/negative.wav"); + dollars++; + } + + /* Say dollar amount */ + ja_say_general_count(session, dollars, say_args, args); + say_file("currency/dollar.wav"); + + /* Say cents */ + if (cents) { + ja_say_general_count(session, cents, say_args, args); + } else { + say_file("digits/0.wav"); + } + say_file("currency/cent.wav"); + + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t ja_say(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +{ + switch_say_callback_t say_cb = NULL; + + switch (say_args->type) { + case SST_NUMBER: + case SST_ITEMS: + case SST_PERSONS: + case SST_MESSAGES: + say_cb = ja_say_general_count; + break; + case SST_TIME_MEASUREMENT: + case SST_CURRENT_DATE: + case SST_CURRENT_TIME: + case SST_CURRENT_DATE_TIME: + say_cb = ja_say_time; + break; + case SST_IP_ADDRESS: + return switch_ivr_say_ip(session, tosay, ja_say_general_count, say_args, args); + break; + case SST_NAME_SPELLED: + case SST_NAME_PHONETIC: + return switch_ivr_say_spell(session, tosay, say_args, args); + break; + case SST_CURRENCY: + say_cb = ja_say_money; + break; + default: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", say_args->type); + break; + } + + if (say_cb) { + return say_cb(session, tosay, say_args, args); + } + + return SWITCH_STATUS_FALSE; +} + +SWITCH_MODULE_LOAD_FUNCTION(mod_say_ja_load) +{ + switch_say_interface_t *say_interface; + /* connect my internal structure to the blank pointer passed to me */ + *module_interface = switch_loadable_module_create_module_interface(pool, modname); + say_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_SAY_INTERFACE); + say_interface->interface_name = "ja"; + say_interface->say_function = ja_say; + + /* indicate that the module should continue to be loaded */ + return SWITCH_STATUS_SUCCESS; +} + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4: + */ commit e7cafae29d0720f06280255a55cc94548e7e12a4 Author: Brian West <brian@freeswitch.org> Date: Tue Oct 5 09:59:13 2010 -0500 tweak diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 32fb141..5aecca7 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -123,6 +123,7 @@ SWITCH_BEGIN_EXTERN_C #define SWITCH_CURRENT_APPLICATION_VARIABLE "current_application" #define SWITCH_CURRENT_APPLICATION_DATA_VARIABLE "current_application_data" #define SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE "current_application_response" +#define SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE "passthru_ptime_mismatch" #define SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE "enable_heartbeat_events" #define SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE "bypass_media_after_bridge" #define SWITCH_READ_RESULT_VARIABLE "read_result" @@ -1055,6 +1056,7 @@ typedef enum { CF_EARLY_HANGUP, CF_MEDIA_SET, CF_CONSUME_ON_ORIGINATE, + CF_PASSTHRU_PTIME_MISMATCH, /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ CF_FLAG_MAX } switch_channel_flag_t; diff --git a/src/switch_channel.c b/src/switch_channel.c index 81baa2f..df5fd96 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2559,6 +2559,10 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_ switch_core_session_execute_application(channel->session, app, arg); } + if ((var = switch_channel_get_variable(channel, SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE))) { + switch_channel_set_flag(channel, CF_PASSTHRU_PTIME_MISMATCH); + } + /* if we're the child of another channel and the other channel is in a blocking read they will never realize we have answered so send a SWITCH_SIG_BREAK to interrupt any blocking reads on that channel */ @@ -2686,6 +2690,10 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan switch_core_session_rwunlock(other_session); } + if ((var = switch_channel_get_variable(channel, SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE))) { + switch_channel_set_flag(channel, CF_PASSTHRU_PTIME_MISMATCH); + } + if ((var = switch_channel_get_variable(channel, SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE))) { uint32_t seconds = 60; int tmp; diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 1eb224b..4ca8b2d 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -653,7 +653,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess if (session->write_impl.codec_id == frame->codec->implementation->codec_id || session->write_impl.microseconds_per_packet != frame->codec->implementation->microseconds_per_packet) { ptime_mismatch = TRUE; - if (switch_test_flag(frame->codec, SWITCH_CODEC_FLAG_PASSTHROUGH) || switch_test_flag(session->read_codec, SWITCH_CODEC_FLAG_PASSTHROUGH)) { + if ((switch_test_flag(frame->codec, SWITCH_CODEC_FLAG_PASSTHROUGH) || switch_test_flag(session->read_codec, SWITCH_CODEC_FLAG_PASSTHROUGH)) || + switch_channel_test_flag(session->channel, CF_PASSTHRU_PTIME_MISMATCH)) { status = perform_write(session, frame, flags, stream_id); goto error; } commit f6d4714b7f22d467fb6500fc77adf2d968f14c5c Merge: c91d81a 4f41476 Author: Moises Silva <moy@sangoma.com> Date: Mon Oct 4 22:07:03 2010 -0400 Merge remote branch 'fsorig/master' commit c91d81a483232d0592502b94afa3468c26e79123 Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Sep 30 11:41:47 2010 -0400 Fix for not handling a call state Fix for MSN on BRI diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 08f340d..0ed5902 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -726,7 +726,7 @@ static FIO_SPAN_SET_SIG_STATUS_FUNCTION(ftdm_sangoma_isdn_set_span_sig_status) } static ftdm_status_t ftdm_sangoma_isdn_start(ftdm_span_t *span) -{ +{ ftdm_log(FTDM_LOG_INFO,"Starting span %s:%u.\n",span->name,span->span_id); if (sng_isdn_stack_start(span) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_CRIT, "Failed to start span %s\n", span->name); @@ -747,9 +747,11 @@ static ftdm_status_t ftdm_sangoma_isdn_start(ftdm_span_t *span) } static ftdm_status_t ftdm_sangoma_isdn_stop(ftdm_span_t *span) -{ +{ ftdm_iterator_t *chaniter = NULL; ftdm_iterator_t *curr = NULL; + unsigned i; + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data; ftdm_log(FTDM_LOG_INFO, "Stopping span %s\n", span->name); /* throw the STOP_THREAD flag to signal monitor thread stop */ @@ -772,8 +774,13 @@ static ftdm_status_t ftdm_sangoma_isdn_stop(ftdm_span_t *span) } ftdm_iterator_free(chaniter); - ftdm_sched_destroy(&((sngisdn_span_data_t*)span->signal_data)->sched); - ftdm_queue_destroy(&((sngisdn_span_data_t*)span->signal_data)->event_queue); + ftdm_sched_destroy(&signal_data->sched); + ftdm_queue_destroy(&signal_data->event_queue); + for (i = 0 ; i < signal_data->num_local_numbers ; i++) { + if (signal_data->local_numbers[i] != NULL) { + ftdm_safe_free(signal_data->local_numbers[i]); + } + } ftdm_safe_free(span->signal_data); ftdm_log(FTDM_LOG_DEBUG, "Finished stopping span %s\n", span->name); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index ae6c0d9..bc92835 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -55,6 +55,7 @@ #define NUM_BRI_CHANNELS_PER_SPAN 2 #define SNGISDN_EVENT_QUEUE_SIZE 100 #define SNGISDN_EVENT_POLL_RATE 100 +#define SNGISDN_NUM_LOCAL_NUMBERS 8 /* TODO: rename all *_cc_* to *_an_* */ @@ -161,7 +162,7 @@ typedef struct sngisdn_chan_data { /* Span specific data */ typedef struct sngisdn_span_data { - ftdm_span_t *ftdm_span; + ftdm_span_t *ftdm_span; uint8_t link_id; uint8_t switchtype; uint8_t signalling; /* SNGISDN_SIGNALING_CPE or SNGISDN_SIGNALING_NET */ @@ -175,7 +176,9 @@ typedef struct sngisdn_span_data { uint8_t setup_arb; uint8_t facility; int8_t facility_timeout; - ftdm_sched_t *sched; + uint8_t num_local_numbers; + char* local_numbers[SNGISDN_NUM_LOCAL_NUMBERS]; + ftdm_sched_t *sched; ftdm_queue_t *event_queue; } sngisdn_span_data_t; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c index 361b389..64d7a24 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c @@ -36,9 +36,23 @@ ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span); ftdm_status_t parse_signalling(const char* signalling, ftdm_span_t *span); +ftdm_status_t add_local_number(const char* val, ftdm_span_t *span); extern ftdm_sngisdn_data_t g_sngisdn_data; +ftdm_status_t add_local_number(const char* val, ftdm_span_t *span) +{ + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data; + + if (signal_data->num_local_numbers >= SNGISDN_NUM_LOCAL_NUMBERS) { + ftdm_log(FTDM_LOG_ERROR, "%s: Maximum number of local-numbers exceeded (max:%d)\n", span->name, SNGISDN_NUM_LOCAL_NUMBERS); + return FTDM_FAIL; + } + + signal_data->local_numbers[signal_data->num_local_numbers++] = ftdm_strdup(val); + return FTDM_SUCCESS; +} + ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span) { unsigned i; @@ -253,6 +267,10 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ ftdm_span_set_bearer_capability(val, &span->default_caller_data.bearer_capability); } else if (!strcasecmp(var, "outbound-bearer_layer1")) { ftdm_span_set_bearer_layer1(val, &span->default_caller_data.bearer_layer1); + } else if (!strcasecmp(var, "local-number")) { + if (add_local_number(val, span) != FTDM_SUCCESS) { + return FTDM_FAIL; + } } else if (!strcasecmp(var, "facility-timeout")) { signal_data->facility_timeout = atoi(val); if (signal_data->facility_timeout < 0) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index b7af8e9..827647f 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -43,7 +43,7 @@ extern ftdm_status_t cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Displ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) { ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - + unsigned i; int16_t suId = sngisdn_event->suId; uint32_t suInstId = sngisdn_event->suInstId; uint32_t spInstId = sngisdn_event->spInstId; @@ -57,7 +57,7 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n"); ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_DEBUG, "Processing SETUP (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); - + switch (ftdmchan->state) { case FTDM_CHANNEL_STATE_DOWN: /* Proper state to receive a SETUP */ if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE) || @@ -80,11 +80,35 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) sngisdn_info->suInstId = get_unique_suInstId(suId); sngisdn_info->spInstId = spInstId; + if (conEvnt->cdPtyNmb.eh.pres && signal_data->num_local_numbers) { + uint8_t local_number_matched = 0; + for (i = 0 ; i < signal_data->num_local_numbers ; i++) { + if (!strcmp(signal_data->local_numbers[i], (char*)conEvnt->cdPtyNmb.nmbDigits.val)) { + local_number_matched++; + break; + } + } + if (!local_number_matched) { + ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received SETUP, but local-number %s does not match - ignoring\n", conEvnt->cdPtyNmb.nmbDigits.val); + /* Special case to tell the stack to clear all internal resources about this call. We will no receive any event for this call after sending disconnect request */ + ftdmchan->caller_data.hangup_cause = IN_CCNORTTODEST; + ftdm_sched_timer(signal_data->sched, "delayed_disconnect", 1, sngisdn_delayed_disconnect, (void*) sngisdn_info, NULL); + return; + } + } + /* If this is a glared call that was previously saved, we moved all the info to the current call, so clear the glared saved data */ if (sngisdn_info->glare.spInstId == spInstId) { clear_call_glare_data(sngisdn_info); - } + } + + + if (ftdmchan->span->trunk_type == FTDM_TRUNK_BRI_PTMP) { + if (signal_data->signalling == SNGISDN_SIGNALING_NET) { + sngisdn_info->ces = ces; + } + } ftdm_mutex_lock(g_sngisdn_data.ccs[suId].mutex); g_sngisdn_data.ccs[suId].active_suInstIds[sngisdn_info->suInstId] = sngisdn_info; @@ -92,11 +116,6 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND); - if (ftdmchan->span->trunk_type == FTDM_TRUNK_BRI_PTMP && - signal_data->signalling == SNGISDN_SIGNALING_NET) { - sngisdn_info->ces = ces; - } - /* try to open the channel */ if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Failed to open channel"); @@ -122,14 +141,13 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) ftdmchan->caller_data.bearer_layer1 = sngisdn_get_infoTranCap_from_stack(conEvnt->bearCap[0].usrInfoLyr1Prot.val); ftdmchan->caller_data.bearer_capability = sngisdn_get_infoTranCap_from_stack(conEvnt->bearCap[0].infoTranCap.val); } - + if (signal_data->switchtype == SNGISDN_SWITCH_NI2) { if (conEvnt->shift11.eh.pres && conEvnt->ni2OctStr.eh.pres) { if (conEvnt->ni2OctStr.str.len == 4 && conEvnt->ni2OctStr.str.val[0] == 0x37) { snprintf(ftdmchan->caller_data.aniII, 5, "%.2d", conEvnt->ni2OctStr.str.val[3]); } } - if (signal_data->facility == SNGISDN_OPT_TRUE && conEvnt->facilityStr.eh.pres) { /* Verify whether the Caller Name will come in a subsequent FACILITY message */ @@ -260,6 +278,10 @@ void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event) case FTDM_CHANNEL_STATE_DIALING: ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_UP); break; + case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: + case FTDM_CHANNEL_STATE_HANGUP: + /* Race condition, we just hung up the call - ignore this message */ + break; default: ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Processing CONNECT/CONNECT ACK in an invalid state (%s)\n", ftdm_channel_state2str(ftdmchan->state)); @@ -274,7 +296,7 @@ void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event) /* do nothing */ break; case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - /* We just hung up an incoming call right after we sent a CONNECT so ignore this message */ + /* Race condition, We just hung up an incoming call right after we sent a CONNECT - ignore this message */ break; default: ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Processing CONNECT/CONNECT ACK in an invalid state (%s)\n", ftdm_channel_state2str(ftdmchan->state)); @@ -923,6 +945,16 @@ void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event) break; } break; + case 12: /* We received a disconnect indication */ + switch (ftdmchan->state) { + case FTDM_CHANNEL_STATE_TERMINATING: + /* We are already waiting for user app to handle the disconnect, do nothing */ + break; + default: + ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state)); + break; + } + break; case 22: switch (ftdmchan->state) { case FTDM_CHANNEL_STATE_UP: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c index 791c6b7..9bf6053 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c @@ -706,7 +706,7 @@ void sngisdn_rcv_q931_ind(InMngmt *status) ftdm_span_t *ftdmspan; sngisdn_span_data_t *signal_data = g_sngisdn_data.spans[status->t.usta.suId]; if (!signal_data) { - ftdm_log(FTDM_LOG_INFO, "Received q921 status on unconfigured span (lnkNmb:%d)\n", status->t.usta.suId); + ftdm_log(FTDM_LOG_INFO, "Received q931 status on unconfigured span (lnkNmb:%d)\n", status->t.usta.suId); return; } ftdmspan = signal_data->ftdm_span; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index db22fe5..691e310 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -424,11 +424,15 @@ void sngisdn_delayed_disconnect(void* p_sngisdn_info) sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; ftdm_mutex_lock(ftdmchan->mutex); - if (ftdmchan->state != FTDM_CHANNEL_STATE_DOWN) { + if (ftdmchan->caller_data.hangup_cause == IN_CCNORTTODEST || ftdmchan->state != FTDM_CHANNEL_STATE_DOWN) { ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending delayed DISCONNECT (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->glare.spInstId, sngisdn_info->glare.suInstId); sngisdn_snd_disconnect(ftdmchan); + if (ftdmchan->caller_data.hangup_cause == IN_CCNORTTODEST) { + ftdm_channel_t *close_chan = ftdmchan; + ftdm_channel_close(&close_chan); + } } ftdm_mutex_unlock(ftdmchan->mutex); commit 4f414765ee55a59ecd408a774aadf04fdaa83f28 Author: Moises Silva <moy@sangoma.com> Date: Mon Oct 4 17:31:33 2010 -0400 mod_sangoma_codec: fix memory leak by using a memory pool per transcoding session diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index d2e1e1c..ae7468e 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -199,6 +199,8 @@ static int sangoma_create_rtp_port(void *usr_priv, uint32_t host_ip, uint32_t *p static int sangoma_create_rtp(void *usr_priv, sngtc_codec_request_leg_t *codec_req_leg, sngtc_codec_reply_leg_t* codec_reply_leg, void **rtp_fd) { + switch_status_t status; + switch_memory_pool_t *sesspool = NULL; switch_rtp_t *rtp_session = NULL; char codec_ip[255]; switch_rtp_flag_t flags = 0; @@ -208,6 +210,18 @@ static int sangoma_create_rtp(void *usr_priv, sngtc_codec_request_leg_t *codec_r char local_ip[255]; switch_port_t rtp_port; struct sangoma_transcoding_session *sess = usr_priv; + + /* + * We *MUST* use a new pool + * Do not use the session pool since the session may go away while the RTP socket should linger around + * until sangoma_transcode decides to kill it (possibly because the same RTP session is used for a different call) + * also do not use the module pool otherwise memory would keep growing because switch_rtp_destroy does not + * free the memory used (is assumed it'll be freed when the pool is destroyed) + */ + status = switch_core_new_memory_pool(&sesspool); + if (status != SWITCH_STATUS_SUCCESS) { + return -1; + } rtp_port = (switch_port_t)(long)*rtp_fd; @@ -222,20 +236,20 @@ static int sangoma_create_rtp(void *usr_priv, sngtc_codec_request_leg_t *codec_r local_ip, rtp_port, codec_ip, codec_reply_leg->codec_udp_port, iana, codec_req_leg->ms*1000, sess->sessid); - /* create the RTP socket, dont use the session pool since the session may go away while the RTP socket should linger around - * until sangoma_transcode decides to kill it (possibly because the same RTP session is used for a different call) */ + /* create the RTP socket */ rtp_session = switch_rtp_new(local_ip, rtp_port, codec_ip, codec_reply_leg->codec_udp_port, iana, sess->impl->samples_per_packet, codec_req_leg->ms * 1000, /* microseconds per packet */ - flags, NULL, &err, g_pool); + flags, NULL, &err, sesspool); if (!rtp_session) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed to create switch rtp session: %s\n", err); + switch_core_destroy_memory_pool(&sesspool); return -1; } - + switch_rtp_set_private(rtp_session, sesspool); *rtp_fd = rtp_session; return 0; @@ -243,8 +257,11 @@ static int sangoma_create_rtp(void *usr_priv, sngtc_codec_request_leg_t *codec_r static int sangoma_destroy_rtp(void *usr_priv, void *fd) { + switch_memory_pool_t *sesspool; switch_rtp_t *rtp = fd; + sesspool = switch_rtp_get_private(rtp); switch_rtp_destroy(&rtp); + switch_core_destroy_memory_pool(&sesspool); return 0; } @@ -406,6 +423,7 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec sess->encoder.tx++; /* do the reading */ + memset(&encoded_frame, 0, sizeof(encoded_frame)); for ( ; ; ) { sres = switch_rtp_zerocopy_read_frame(sess->encoder.rxrtp, &encoded_frame, SWITCH_IO_FLAG_NOBLOCK); if (sres == SWITCH_STATUS_GENERR) { @@ -525,6 +543,7 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses sess->decoder.tx++; /* do the reading */ + memset(&ulaw_frame, 0, sizeof(ulaw_frame)); for ( ; ; ) { sres = switch_rtp_zerocopy_read_frame(sess->decoder.rxrtp, &ulaw_frame, SWITCH_IO_FLAG_NOBLOCK); if (sres == SWITCH_STATUS_GENERR) { commit be3d61dead30742a3d941ae6351568f800148e03 Author: Michael S Collins <msc@freeswitch.org> Date: Mon Oct 4 18:05:30 2010 -0700 Update ChangeLog through Sept 21 (more coming) diff --git a/docs/ChangeLog b/docs/ChangeLog index a2ed493..412ab9f 100644 --- a/docs/ChangeLog +++ b/docs/ChangeLog @@ -16,12 +16,16 @@ freeswitch (1.0.7) build: VS 2010 - Change to V4 framework, add SWIG v2.0 files to fix release build exceptions(temp fix till we upgrade all SWIG files) (r:812f4309) build: Windows VS2010 build - remove strange characters (r:ba1546e0/FSBUILD-297) build: Make bootstrap.sh Bourne shell compatible (r:8dbd62ff/FSBUILD-301) + codec2: working prototype, still for testing only (r:04ca0751) config: move limit.conf to db.conf config: Update VM phrase macros to voice option then action on main, config menus config: Remove 99xx extension numbers to avoid dp conflicts (r:0c9bb174/DP-17) config: update config example for caller-id-type (r:8f03a7cd) config: default to 48k since most sound cards can do that (r:170404a4) config: Create RFC2822_DATE for use in emails. Some clients fail to sort emails properly without a Date: line. (r:a1f19d91) + config: move enum to the bottom of default. (r:4d448c97) + config: Add att_xfer example to default dialplan (r:20ec962a) + config: default example to resolve some issues with SCA in cases where host and ip are mixed causing the phone to be confused. (r:0279261b) core: Add RTCP support (FSRTP-14) core: handle some errors on missing db handle conditions core: add ... and shutdown as a fail-safe when no modules are loaded @@ -78,8 +82,22 @@ freeswitch (1.0.7) core: Implemented 'Block Fork' and removed possibility for "-nc -nf" potential issue. (r:f26a6972/FSCORE-652) core: Add console callback for listing loaded/available modules for load/unload/reload commands (r:d68a1218/FSCORE-662) core: strip trailing and leading whitespace in api execute args and commands (r:ca481842) + core: Fix SQLLEN to prevent queue buffer overrun (r:68d1c32a/FS-2149) + core: add origination_caller_profile to log all attempted calls for a paticular leg (r:977a8ad7) + core: Add attribute "path" to autoload_configs/modules.conf.xml <load> entry. (r:1a75821d) + core: add tone2wav (r:6f2c455f) + core: add speed boost to sql thread (r:ef79535c) + core: reverse the linked list in ivr menus to support accidental feature of multiple entries for the same keys (r:d4a01324) + core: Add time of day string compare function switch_tod_cmp. It usable in XML dialplan with time-of-day. String format is hh:mm:ss you can define a range like this : 09:00-17:00 (Second are not optional) (r:4ab8fa13) + core: Add date time range string compare function switch_fulldate_cmp. It usable in XML dialplan with date-time. String format example : 2009-10-10 14:33:22~2009-11-10 17:32:31. (r:c9fcce08) + core: Add day of week 3 letter initial usage in "wday" field in the dialplan. Example : mon-fri. Using number as before is still supported. Several public switch function are available. (r:59ec8ced) + core: set conditionals to only fire when the mutex can be obtained (r:07ec7867) + core: avoid segfault when sofia tries to update the callee id at the same time as the outbound call is transferred (r:df63657e) + core: make code more automagic to shut up the dude on the list (r:d093a4a4) + core: Fix memory leak if we fail to enqueue new event to EVENT_QUEUE in switch_event.c (r:ef773e07/FS-2148) lang: Improve French phrase files (FSCONFIG-23) libdingaling: fix race on shutdown causing crash (FSMOD-47) + libdingaling: Fix crash in new GV interface when exceeding 24 calls (r:be00609a/FS-2171) libesl: Fix potential race condition (ESL-36) libesl: Add /uuid command to fs_cli to filter logs by uuid libesl: Increase buffer in fs_cli for Win (r:d1d6be88/FSCORE-611) @@ -93,6 +111,8 @@ freeswitch (1.0.7) libesl: Fix SEGV when using serialize function without any arguments (r:910729b5/ESL-44) libesl: fix leak-on-error in esl_connect_timeout() (r:4263d60e) libfreetdm: implemented freetdm config nodes and ss7 initial configuration + libfreetdm: fix codec for CAS signaling (r:b76e7f18) + libfreetdm: freetdm: ss7- added support for incoming group blocks, started adding support for ansi (r:c219a73c) libopenzap: Add CLI tracing libs: Merged OpenZAP and FreeTDM into the FreeSWITCH tree. libs: Add support for TLS on Windows using openssl (r:1abe3b93/MODSOFIA-92) @@ -103,6 +123,7 @@ freeswitch (1.0.7) libspandsp: removed a saturate16 from spandsp that was causing problems fixed a typo in the MSVC inttypes.h file for spandsp libspandsp: Changes to the signaling tone detector to detect concurrent 2400Hz + 2600Hz tones. This passes voice immunity and other key tests, but it bounces a bit when transitions like 2400 -> 2400+2600 -> 2600 occur. Transitions between tone off and tone on are clean. (r:bc13e944) libspandsp: Fix Windows build after libspandsp update (r:d70cc852/FSBUILD-293) + libspandsp: Fix for T.30 processing of operator interrupts, to improve compatibility with some machines, which seem to send them when no operator is around. (r:84ee0ae6) mod_avmd: Initial check in - Advanced Voicemail Detect (r:10c6a30a) (by Eric Des Courtis) mod_avmd: Add to windows build (r:df4bd935) mod_callcenter: Initial commit of the mod_callcenter application. This module is in it early state of developpement. You can see documentation on the wiki at : <a href="http://wiki.freeswitch.org/wiki/Mod_callcenter">http://wiki.freeswitch.org/wiki/Mod_callcenter</a> For support/comments, please use <a href="http://jira.freeswitch.org/">http://jira.freeswitch.org/</a> and select the MOD CALLCENTER module. (r:ba09b96d) @@ -116,7 +137,8 @@ freeswitch (1.0.7) mod_callcenter: You can now allow caller that have hangup before agent answer to call back and resume their previous position. (r:ab2529d4) mod_callcenter: correct multiple little things following the recent tiers and join back features (r:9b33bd1c) mod_callcenter: Add more channel variable and event and fix a mem leak (r:2d3d8c8d) - od_callcenter: Make more sence to bridge the caller to the agent. Before, in the xml_cdr you saw it it like the agent initiated the call to the member (r:0be95658) + mod_callcenter: Make more sence to bridge the caller to the agent. Before, in the xml_cdr you saw it it like the agent initiated the call to the member (r:0be95658) + mod_callcenter: Added max-wait-time and max-wait-time-with-no-agent param to a queue. (r:3482f95e) mod_cidlookup: null xml is bad (r:095815f8) mod_cid_lookup: honor skipcitystate when using whitepages (r:a66654de/FSMOD-53) mod_commands: make break uuid_break and add cascade flag @@ -127,6 +149,9 @@ freeswitch (1.0.7) mod_commands: Fix a segfault if no arguments is provided to limit_hash_usage (r:8ceb2a9b) mod_commands: fsctl max_session should display int, not float (r:f7e2410e/FSCORE-634) mod_commands: limit - reset rate and release resource apis Thanks Moy (r:a7c31e6f/FSCORE-637) + mod_commands: Fix user_data returning the first value found instead of the last. Also add support to get variable from the group. (r:402f2391) + mod_commands: Allow cond API to return empty false value (r:c8a897b9) + mod_commands: ***BEHAVIOUR CHANGE*** reloadacl, load <module>, reload <module> will now explicitly call reloadxml (r:42c9df72) mod_conference: Fix reporting of volume up/down (MODAPP-419) mod_conference: add last talking time per member to conference xml list mod_conference: add terminate-on-silence conference param @@ -139,6 +164,8 @@ freeswitch (1.0.7) mod_dingaling: make mod_dingaling compat with google's new free phonecalls thing (r:ba0a2a32) mod_dingaling: make dingaling work with google voice inbound too (r:4ee68141) mod_dingaling: Fix crash when testing the new gv-dingaling with around 24 concurrent calls (r:73e1ec5e/FSCORE-667) + mod_dingaling: Fix NULL pointer (r:e3eff816/FS-1103) + mod_directory: Add variable directory_search_order to allow to search by first name by default is set to "first_name" (r:163ca31f) mod_db: fix stack corruption (MODAPP-407) mod_dptools: add eavesdrop_enable_dtmf chan var (r:596c0012) mod_dptools: Make park app not send 183 session progress (r:76932995/FSCORE-567) @@ -153,6 +180,7 @@ freeswitch (1.0.7) mod_fifo: cancel outbound call if customer hangs up (r:cadb4d94) mod_fifo: add taking_calls param to fifo member add and config file (r:821488bf) mod_fifo: add nomedia flag (r:2d30a8c2) + mod_fifo: Fix inconsistency between the fifo queue and the channels (num callers in queue can become "-1") (r:07487114/FS-1659) mod_freetdm: Fix for TON and NPI not passed through to channel variables on incoming calls mod_freetdm: add pvt data to freetdm channels fix fxs features (r:9d456900) mod_freetdm: export and import boost custom data (r:edb2d582) @@ -213,9 +241,14 @@ freeswitch (1.0.7) mod_lcr: fix dialplan issues with default profile and logging when no caller_profile set (r:00170558) mod_lcr: assign default profile even if testing is skipped (r:6420099c) mod_lcr: fix compiler warning on newer gcc (r:bfa414cb) + mod_lcr: don't count twice (r:eaeabc7b/FS-1810) mod_loopback: add loopback_bowout_on_execute var to make 1 legged loopback calls bow out of the picture mod_loopback: only execute app once in app mode (r:64f58f2d) + mod_lua: Add switch_core_sqldb functionality from inside Lua script (r:26f2e095/FS-1384) + mod_lua: Made 2nd arg to freeswitch.Dbh:query (cb func) optional (r:87db11af) + mod_lua: Added SAF_ROUTING_EXEC flag to lua app, so it can be run inline (r:7d5ca1c0) mod_managed: Added wrapper for switch_event_bind for .net (r:a5f07a80/MODLANG-165) + mod_managed: add additional support (r:5be58aac) mod_mp4v: MP4V-ES passthru for washibechi on IRC mod_nibblebill: free allocated mem at shutdown; free properly if using custom_sql mod_nibblebill: Add SAF_SUPPORT_NOMEDIA to nibblebill @@ -303,12 +336,28 @@ freeswitch (1.0.7) mod_sofia: Fix memleak and mwi event not generated on first register (r:04b9b3e2) mod_sofia: when getting presence with no payload consider it an extension to the expires time in the dialog (r:70331e88) mod_sofia: don't put blank 'version' attr in dialog-info packets (r:749dc864) + mod_sofia: speed up db action in sofia recover (r:8114b3f1) + mod_sofia: Support display updates for Cisco SIP endpoints (tested on SPA series) (r:ac205288/FS-884) + mod_sofia: dont put an rpid in 183 or 200 if pass-callee-id is false (r:86de47ff) + mod_sofia: improve sofia recover in some nat cases (r:4526ba30) + mod_sofia: edge cases for sofia recover (r:646a5609) + mod_sofia: Correct the order what param and variables are overriding them self in user/group/domain (r:5a6f0f5c) + mod_sofia: include accumulated stats from rtcp into vars (r:d5ff3e04) + mod_sofia: make sure hold-related code is skipped 100% with disable-hold set (r:403bf6af) + mod_sofia: make force-subscription-expires only work on nonzero expire deltas, 0 means unscubscribe (r:b7751868) + mod_sofia: presence tweaks and addition of all-reg-options-ping which is like nat-options-ping only for every registered host (r:04b52156) + mod_sofia: If sip_invite_domain is used lets use it for rpid_domain no matter what because I know best if I set it (r:8726104a) + mod_sofia: add inline lists for tab complete db using ::[a:b syntax (r:445731ee) + mod_sofia: add sofia profile <profile> gwlist up|down to list up or downed profiles for feeding into mod distributor to exclude dead gateways (r:0477cb67) + mod_sofia: add 'sofia global siptrace on' so we don't have to always teach people to enable sip trace on each profile (r:09fa6678) mod_spandsp: initial checkin of mod_fax/mod_voipcodecs merge into mod_spandsp (r:fa9a59a8) mod_spandsp: rework of new mod_spandsp to have functions broken up into different c files (r:65400642) mod_spandsp: improve duplicate digit detection and add 'min_dup_digit_spacing_ms' channel variable for use with the dtmf detector (r:eab4f246/FSMOD-45) mod_spandsp: add start_tone_detect/stop_tone_detect app and api commands for tone and cadence detection (r:a6e65147/MODAPP-378) mod_spandsp: Fix mod_spandsp receive t38 fax error in windows7 (r:fca93f29/MODAPP-443) mod_spandsp: Moved spandsp to a more recent version. A huge number of little changes occur here, as recently spandsp lost all the $Id$ entries the source files had for the dark old days of CVS (r:f029f7ef) + mod_spandsp: move app flag into 'T38' namespace for the sake of housekeeping (r:0d0b4b43) + mod_spandsp: make t38 terminal mode more reliable (r:83da7bd3) mod_spidermonkey: allow vars to be set containing vars from languages (r:5cd072a3) mod_spidermonkey: fix seg in js hangup (r:7d554c11) mod_spidermonkey: Fix mod_spidermonkey build on FreeBSD, (Undefined symbol PR_LocalTimeParameters). (r:3edb8419) @@ -322,10 +371,14 @@ freeswitch (1.0.7) mod_voicemail: fix vm msg being deleted when pressing key to forward to email (MODAPP-403) mod_voicemail: make voicemails use the uuid of the channel who recorded it when applicable (r:98a5a30a) mod_voicemail: user unable to play or delete voicemail via web API (r:b5205c0b/MODAPP-447) + mod_voicemail: Allow to forward a message or send it via email key during the playback of the recording, not just when the menu is playing. (r:83aeda79) + mod_voicemail: fix vm_inject to a group and change syntax for sending to a whole domain to domain= for clarity sake (r:f30a1cc6) + mod_voicemail: add quotes to vm_cc command generated internally to escape spaces in the caller id name (r:5f012813) mod_xml_cdr: add force_process_cdr var to process b leg cdr on a case by case basis when b leg cdr is disabled (XML-17) mod_xml_cdr: add leg param to query string (XML-24) mod_xml_cdr: fix locked sessions (XML-26) mod_xml_cdr: fix minor memory leaks and config bug (r:19253d83/MODEVENT-62) + mod_xml_rpc: Fix crash if unauthorized XML RPC is attempted (r:9835395c/FS-184) sofia-sip: fix null derefernce segfault in soa (r:f356c5e6) sofia-sip: extend timeout for session expires on short timeouts to be 90% of timeout instead of 1/3 to handle devices that do not refresh in time such as polycom (r:a7f48928/SFSIP-212) commit 7f3319dc1160c6533081a853a682480dc8fed02d Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Oct 4 18:23:43 2010 -0500 add switch_ivr_dmachine async digit parser to core diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index 4c562a5..5fee7ba 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -842,6 +842,28 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sound_test(switch_core_session_t *ses SWITCH_DECLARE(void) switch_process_import(switch_core_session_t *session, switch_channel_t *peer_channel, const char *varname); SWITCH_DECLARE(switch_bool_t) switch_ivr_uuid_exists(const char *uuid); + + +SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_create(switch_ivr_dmachine_t **dmachine_p, + switch_memory_pool_t *pool, + uint32_t digit_timeout, uint32_t input_timeout); + +SWITCH_DECLARE(void) switch_ivr_dmachine_destroy(switch_ivr_dmachine_t **dmachine); + +SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_bind(switch_ivr_dmachine_t *dmachine, + const char *digits, + int32_t key, + switch_ivr_dmachine_callback_t callback, + void *user_data); + +SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_feed(switch_ivr_dmachine_t *dmachine, const char *digits, switch_ivr_dmachine_match_t **match); +SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_clear(switch_ivr_dmachine_t *dmachine); +SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t *dmachine, switch_ivr_dmachine_match_t **match_p); +SWITCH_DECLARE(switch_ivr_dmachine_match_t *) switch_ivr_dmachine_get_match(switch_ivr_dmachine_t *dmachine); + + + + /** @} */ SWITCH_END_EXTERN_C diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 668fdc8..32fb141 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -833,6 +833,7 @@ typedef enum { SWITCH_STATUS_NOUNLOAD, SWITCH_STATUS_IGNORE, SWITCH_STATUS_TOO_SMALL, + SWITCH_STATUS_FOUND, SWITCH_STATUS_NOT_INITALIZED } switch_status_t; @@ -1684,12 +1685,27 @@ typedef switch_status_t (*switch_input_callback_function_t) (switch_core_session switch_input_type_t input_type, void *buf, unsigned int buflen); typedef switch_status_t (*switch_read_frame_callback_function_t) (switch_core_session_t *session, switch_frame_t *frame, void *user_data); typedef struct switch_say_interface switch_say_interface_t; + +struct switch_ivr_dmachine; +typedef struct switch_ivr_dmachine switch_ivr_dmachine_t; + +struct switch_ivr_dmachine_match { + switch_ivr_dmachine_t *dmachine; + const char *match_digits; + int32_t match_key; + void *user_data; +}; + +typedef struct switch_ivr_dmachine_match switch_ivr_dmachine_match_t; +typedef switch_status_t (*switch_ivr_dmachine_callback_t) (switch_ivr_dmachine_match_t *match); + typedef struct { switch_input_callback_function_t input_callback; void *buf; uint32_t buflen; switch_read_frame_callback_function_t read_frame_callback; void *user_data; + switch_ivr_dmachine_t *dmachine; } switch_input_args_t; typedef struct { diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 563706c..560b1cd 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -507,19 +507,19 @@ static switch_status_t caller_read_frame_callback(switch_core_session_t *session args.buflen = sizeof(buf); if (switch_ivr_play_file(session, NULL, cd->list[cd->index], &args) != SWITCH_STATUS_SUCCESS) { - return SWITCH_STATUS_FALSE; + return SWITCH_STATUS_BREAK; } if (match_key(caller_exit_key, *buf)) { cd->abort = 1; - return SWITCH_STATUS_FALSE; + return SWITCH_STATUS_BREAK; } cd->next = switch_epoch_time_now(NULL) + cd->freq; cd->index++; } } else if (cd->orbit_timeout && switch_epoch_time_now(NULL) >= cd->orbit_timeout) { cd->do_orbit = 1; - return SWITCH_STATUS_FALSE; + return SWITCH_STATUS_BREAK; } return SWITCH_STATUS_SUCCESS; @@ -540,7 +540,7 @@ static switch_status_t consumer_read_frame_callback(switch_core_session_t *sessi } if (total) { - return SWITCH_STATUS_FALSE; + return SWITCH_STATUS_BREAK; } return SWITCH_STATUS_SUCCESS; diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 7e7e8cd..ef360d3 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -224,7 +224,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session, switch_ivr_parse_all_events(session); - if (args && (args->input_callback || args->buf || args->buflen)) { + if (args && (args->input_callback || args->buf || args->buflen || args->dmachine)) { switch_dtmf_t dtmf; /* @@ -237,7 +237,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session, break; } switch_channel_dequeue_dtmf(channel, &dtmf); - if (args->input_callback) { + + if (args->dmachine) { + char ds[2] = {dtmf.digit, '\0'}; + if ((status = switch_ivr_dmachine_feed(args->dmachine, ds, NULL)) != SWITCH_STATUS_SUCCESS) { + break; + } + } else if (args->input_callback) { status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen); } else { switch_copy_string((char *) args->buf, (void *) &dtmf, args->buflen); @@ -947,8 +953,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_s break; } + if (args && args->dmachine) { + if ((status = switch_ivr_dmachine_ping(args->dmachine, NULL)) != SWITCH_STATUS_SUCCESS) { + break; + } + } + if (read_frame && args && (args->read_frame_callback)) { - if (args->read_frame_callback(session, read_frame, args->user_data) != SWITCH_STATUS_SUCCESS) { + if ((status = args->read_frame_callback(session, read_frame, args->user_data)) != SWITCH_STATUS_SUCCESS) { break; } } diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 4fe5732..1fee5f9 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -35,6 +35,281 @@ #include <speex/speex_preprocess.h> #include <speex/speex_echo.h> +struct switch_ivr_dmachine_binding { + char *digits; + int32_t key; + switch_ivr_dmachine_callback_t callback; + switch_byte_t is_regex; + void *user_data; + struct switch_ivr_dmachine_binding *next; +}; +typedef struct switch_ivr_dmachine_binding switch_ivr_dmachine_binding_t; + +#define DM_MAX_DIGIT_LEN 512 + +struct switch_ivr_dmachine { + switch_memory_pool_t *pool; + switch_byte_t my_pool; + uint32_t digit_timeout_ms; + uint32_t input_timeout_ms; + switch_ivr_dmachine_binding_t *binding_list; + switch_ivr_dmachine_binding_t *tail; + switch_ivr_dmachine_binding_t *last_matching_binding; + switch_ivr_dmachine_match_t match; + char digits[DM_MAX_DIGIT_LEN]; + char last_matching_digits[DM_MAX_DIGIT_LEN]; + uint32_t cur_digit_len; + uint32_t max_digit_len; + switch_time_t last_digit_time; + switch_byte_t is_match; +}; + +SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_create(switch_ivr_dmachine_t **dmachine_p, + switch_memory_pool_t *pool, + uint32_t digit_timeout_ms, uint32_t input_timeout_ms) +{ + switch_byte_t my_pool = !!pool; + switch_ivr_dmachine_t *dmachine; + + if (digit_timeout_ms < 1 || input_timeout_ms < 1) return SWITCH_STATUS_FALSE; + + if (!pool) { + switch_core_new_memory_pool(&pool); + } + + dmachine = switch_core_alloc(pool, sizeof(*dmachine)); + dmachine->pool = pool; + dmachine->my_pool = my_pool; + dmachine->digit_timeout_ms = digit_timeout_ms; + dmachine->input_timeout_ms = input_timeout_ms; + dmachine->match.dmachine = dmachine; + *dmachine_p = dmachine; + + return SWITCH_STATUS_SUCCESS; +} + + +SWITCH_DECLARE(void) switch_ivr_dmachine_destroy(switch_ivr_dmachine_t **dmachine) +{ + switch_memory_pool_t *pool; + + if (!(dmachine && *dmachine)) return; + + pool = (*dmachine)->pool; + + if ((*dmachine)->my_pool) { + switch_core_destroy_memory_pool(&pool); + } +} + +SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_bind(switch_ivr_dmachine_t *dmachine, + const char *digits, + int32_t key, + switch_ivr_dmachine_callback_t callback, + void *user_data) +{ + switch_ivr_dmachine_binding_t *binding; + switch_size_t len; + + if (strlen(digits) > DM_MAX_DIGIT_LEN -1) { + return SWITCH_STATUS_FALSE; + } + + binding = switch_core_alloc(dmachine->pool, sizeof(*binding)); + if (*digits == '~') { + binding->is_regex = 1; + digits++; + } + binding->key = key; + binding->digits = switch_core_strdup(dmachine->pool, digits); + binding->callback = callback; + binding->user_data = user_data; + + if (dmachine->tail) { + dmachine->tail->next = binding; + } else { + dmachine->binding_list = binding; + } + + dmachine->tail = binding; + + len = strlen(digits); + + if (binding->is_regex && dmachine->max_digit_len != DM_MAX_DIGIT_LEN -1) { + dmachine->max_digit_len = DM_MAX_DIGIT_LEN -1; + } else if (len > dmachine->max_digit_len) { + dmachine->max_digit_len = (uint32_t) len; + } + + if (binding->is_regex) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "binding regex: %s key: %.4d callback: %p data: %p\n", + digits, key, (void *)(intptr_t) callback, user_data); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "binding digits: %4s key: %.4d callback: %p data: %p\n", + digits, key, (void *)(intptr_t) callback, user_data); + } + + return SWITCH_STATUS_SUCCESS; +} + +typedef enum { + DM_MATCH_NONE, + DM_MATCH_EXACT, + DM_MATCH_PARTIAL, + DM_MATCH_BOTH +} dm_match_t; + + +static dm_match_t switch_ivr_dmachine_check_match(switch_ivr_dmachine_t *dmachine, switch_bool_t is_timeout) +{ + dm_match_t best = DM_MATCH_NONE; + switch_ivr_dmachine_binding_t *bp, *exact_bp = NULL; + int exact_count = 0, partial_count = 0, both_count = 0; + + + if (!dmachine->cur_digit_len) goto end; + + for(bp = dmachine->binding_list; bp; bp = bp->next) { + + if (bp->is_regex) { + switch_status_t r_status = switch_regex_match(dmachine->digits, bp->digits); + + if (r_status == SWITCH_STATUS_SUCCESS) { + if (is_timeout) { + best = DM_MATCH_EXACT; + exact_count++; + exact_bp = bp; + break; + } + + best = DM_MATCH_PARTIAL; + partial_count++; + continue; + } + } else { + if (!exact_bp && !strcmp(bp->digits, dmachine->digits)) { + exact_bp = bp; + best = DM_MATCH_EXACT; + exact_count++; + continue; + } + + if (!strncmp(dmachine->digits, bp->digits, strlen(dmachine->digits))) { + if (best == DM_MATCH_EXACT) { + if (is_timeout) { + best = DM_MATCH_EXACT; + exact_count++; + exact_bp = bp; + } else { + best = DM_MATCH_BOTH; + both_count++; + } + } else { + best = DM_MATCH_PARTIAL; + partial_count++; + } + break; + } + } + } + + end: + + if (!both_count && exact_bp) { + dmachine->last_matching_binding = exact_bp; + switch_set_string(dmachine->last_matching_digits, dmachine->digits); + best = DM_MATCH_EXACT; + } + + return best; + +} + +static switch_bool_t switch_ivr_dmachine_check_timeout(switch_ivr_dmachine_t *dmachine) +{ + switch_time_t now = switch_time_now(); + uint32_t timeout = dmachine->cur_digit_len ? dmachine->digit_timeout_ms : dmachine->input_timeout_ms; + + if ((uint32_t)((now - dmachine->last_digit_time) / 1000) > timeout) { + return SWITCH_TRUE; + } + + return SWITCH_FALSE; +} + +SWITCH_DECLARE(switch_ivr_dmachine_match_t *) switch_ivr_dmachine_get_match(switch_ivr_dmachine_t *dmachine) +{ + if (dmachine->is_match) { + dmachine->is_match = 0; + return &dmachine->match; + } + + return NULL; +} + +SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t *dmachine, switch_ivr_dmachine_match_t **match_p) +{ + switch_bool_t is_timeout = switch_ivr_dmachine_check_timeout(dmachine); + dm_match_t is_match = switch_ivr_dmachine_check_match(dmachine, is_timeout); + switch_status_t r; + + if (!dmachine->last_digit_time) { + r = SWITCH_STATUS_SUCCESS; + } else if (dmachine->cur_digit_len > dmachine->max_digit_len) { + r = SWITCH_STATUS_FALSE; + } else if (is_match == DM_MATCH_EXACT || (is_match == DM_MATCH_BOTH && is_timeout)) { + r = SWITCH_STATUS_FOUND; + + dmachine->match.match_digits = dmachine->last_matching_digits; + dmachine->match.match_key = dmachine->last_matching_binding->key; + dmachine->match.user_data = dmachine->last_matching_binding->user_data; + + if (dmachine->last_matching_binding->callback) { + dmachine->last_matching_binding->callback(&dmachine->match); + } + + if (match_p) { + *match_p = &dmachine->match; + } + + dmachine->is_match = 1; + } else if (is_timeout) { + r = SWITCH_STATUS_TIMEOUT; + } else if (dmachine->cur_digit_len == dmachine->max_digit_len) { + r = SWITCH_STATUS_NOTFOUND; + } else { + r = SWITCH_STATUS_SUCCESS; + } + + if (r != SWITCH_STATUS_SUCCESS) { + switch_ivr_dmachine_clear(dmachine); + } + + return r; +} + +SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_feed(switch_ivr_dmachine_t *dmachine, const char *digits, switch_ivr_dmachine_match_t **match) +{ + if (strlen(digits) + strlen(dmachine->digits) > dmachine->max_digit_len) { + return SWITCH_STATUS_FALSE; + } + + strncat(dmachine->digits, digits, dmachine->max_digit_len); + dmachine->cur_digit_len = strlen(dmachine->digits); + dmachine->last_digit_time = switch_time_now(); + + return switch_ivr_dmachine_ping(dmachine, match); +} + +SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_clear(switch_ivr_dmachine_t *dmachine) +{ + memset(dmachine->digits, 0, sizeof(dmachine->digits)); + dmachine->cur_digit_len = 0; + dmachine->last_digit_time = 0; + return SWITCH_STATUS_SUCCESS; +} + + #ifdef SWITCH_VIDEO_IN_THREADS struct echo_helper { switch_core_session_t *session; @@ -2528,7 +2803,7 @@ static void *SWITCH_THREAD_FUNC speech_thread(switch_thread_t *thread, void *obj if (status == SWITCH_STATUS_SUCCESS && switch_true(switch_channel_get_variable(channel, "asr_intercept_dtmf"))) { const char *p; - + if ((p = switch_stristr("<input>", xmlstr))) { p += 7; } diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index d75af10..c5b7a61 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -493,7 +493,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se fh->pre_buffer_datalen = SWITCH_DEFAULT_FILE_BUFFER_LEN; } - if ((p = switch_channel_get_variable(channel, "RECORD_APPEND")) && switch_true(p)) { + if (switch_test_flag(fh, SWITCH_FILE_WRITE_APPEND) || ((p = switch_channel_get_variable(channel, "RECORD_APPEND")) && switch_true(p))) { file_flags |= SWITCH_FILE_WRITE_APPEND; } @@ -613,18 +613,24 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se break; } - if (args && (args->input_callback || args->buf || args->buflen)) { + if (args && (args->input_callback || args->buf || args->buflen || args->dmachine)) { /* dtmf handler function you can hook up to be executed when a digit is dialed during playback if you return anything but SWITCH_STATUS_SUCCESS the playback will stop. */ if (switch_channel_has_dtmf(channel)) { - if (!args->input_callback && !args->buf) { + if (!args->input_callback && !args->buf && !args->dmachine) { status = SWITCH_STATUS_BREAK; break; } switch_channel_dequeue_dtmf(channel, &dtmf); - if (args->input_callback) { + + if (args->dmachine) { + char ds[2] = {dtmf.digit, '\0'}; + if ((status = switch_ivr_dmachine_feed(args->dmachine, ds, NULL)) != SWITCH_STATUS_SUCCESS) { + break; + } + } else if (args->input_callback) { status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen); } else { *((char *) args->buf) = dtmf.digit; @@ -651,8 +657,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se break; } + if (args && args->dmachine) { + if ((status = switch_ivr_dmachine_ping(args->dmachine, NULL)) != SWITCH_STATUS_SUCCESS) { + break; + } + } + if (args && (args->read_frame_callback)) { - if (args->read_frame_callback(session, read_frame, args->user_data) != SWITCH_STATUS_SUCCESS) { + if ((status = args->read_frame_callback(session, read_frame, args->user_data)) != SWITCH_STATUS_SUCCESS) { break; } } @@ -810,16 +822,21 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *sessi break; } + if (args && args->dmachine) { + if ((status = switch_ivr_dmachine_ping(args->dmachine, NULL)) != SWITCH_STATUS_SUCCESS) { + break; + } + } if (args && (args->read_frame_callback)) { - if (args->read_frame_callback(session, read_frame, args->user_data) != SWITCH_STATUS_SUCCESS) { + if ((status = args->read_frame_callback(session, read_frame, args->user_data)) != SWITCH_STATUS_SUCCESS) { break; } } switch_ivr_parse_all_events(session); - if (args && (args->input_callback || args->buf || args->buflen)) { + if (args && (args->input_callback || args->buf || args->buflen || args->dmachine)) { /* dtmf handler function you can hook up to be executed when a digit is dialed during gentones if you return anything but SWITCH_STATUS_SUCCESS the playback will stop. @@ -831,7 +848,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *sessi break; } switch_channel_dequeue_dtmf(channel, &dtmf); - if (args->input_callback) { + + if (args->dmachine) { + char ds[2] = {dtmf.digit, '\0'}; + if ((status = switch_ivr_dmachine_feed(args->dmachine, ds, NULL)) != SWITCH_STATUS_SUCCESS) { + break; + } + } else if (args->input_callback) { status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen); } else { *((char *) args->buf) = dtmf.digit; @@ -841,7 +864,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *sessi if (args->input_callback) { switch_event_t *event; - + if (switch_core_session_dequeue_event(session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { status = args->input_callback(session, event, SWITCH_INPUT_TYPE_EVENT, args->buf, args->buflen); switch_event_destroy(&event); @@ -1224,7 +1247,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess switch_ivr_parse_all_events(session); - if (args && (args->input_callback || args->buf || args->buflen)) { + if (args && (args->input_callback || args->buf || args->buflen || args->dmachine)) { /* dtmf handler function you can hook up to be executed when a digit is dialed during playback if you return anything but SWITCH_STATUS_SUCCESS the playback will stop. @@ -1236,7 +1259,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess break; } switch_channel_dequeue_dtmf(channel, &dtmf); - if (args->input_callback) { + + if (args->dmachine) { + char ds[2] = {dtmf.digit, '\0'}; + if ((status = switch_ivr_dmachine_feed(args->dmachine, ds, NULL)) != SWITCH_STATUS_SUCCESS) { + break; + } + } else if (args->input_callback) { status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen); } else { *((char *) args->buf) = dtmf.digit; @@ -1405,10 +1434,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess break; } + if (args && args->dmachine) { + if ((status = switch_ivr_dmachine_ping(args->dmachine, NULL)) != SWITCH_STATUS_SUCCESS) { + break; + } + } + if (args && (args->read_frame_callback)) { int ok = 1; switch_set_flag(fh, SWITCH_FILE_CALLBACK); - if (args->read_frame_callback(session, read_frame, args->user_data) != SWITCH_STATUS_SUCCESS) { + if ((status = args->read_frame_callback(session, read_frame, args->user_data)) != SWITCH_STATUS_SUCCESS) { ok = 0; } switch_clear_flag(fh, SWITCH_FILE_CALLBACK); @@ -1919,7 +1954,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session switch_event_destroy(&event); } - if (args && (args->input_callback || args->buf || args->buflen)) { + if (args && (args->input_callback || args->buf || args->buflen || args->dmachine)) { /* dtmf handler function you can hook up to be executed when a digit is dialed during playback * if you return anything but SWITCH_STATUS_SUCCESS the playback will stop. */ @@ -1933,7 +1968,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session status = SWITCH_STATUS_BREAK; } else { switch_channel_dequeue_dtmf(channel, &dtmf); - if (args->input_callback) { + + if (args->dmachine) { + char ds[2] = {dtmf.digit, '\0'}; + if ((status = switch_ivr_dmachine_feed(args->dmachine, ds, NULL)) != SWITCH_STATUS_SUCCESS) { + break; + } + } else if (args->input_callback) { status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen); } else { *((char *) args->buf) = dtmf.digit; @@ -1972,9 +2013,15 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session break; } + if (args && args->dmachine) { + if ((status = switch_ivr_dmachine_ping(args->dmachine, NULL)) != SWITCH_STATUS_SUCCESS) { + goto done; + } + } + if (args && (args->read_frame_callback)) { - if (args->read_frame_callback(session, read_frame, args->user_data) != SWITCH_STATUS_SUCCESS) { - break; + if ((status = args->read_frame_callback(session, read_frame, args->user_data)) != SWITCH_STATUS_SUCCESS) { + goto done; } } } @@ -2038,15 +2085,23 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session break; } + if (args && args->dmachine) { + if ((status = switch_ivr_dmachine_ping(args->dmachine, NULL)) != SWITCH_STATUS_SUCCESS) { + goto done; + } + } + if (args && (args->read_frame_callback)) { - if (args->read_frame_callback(session, read_frame, args->user_data) != SWITCH_STATUS_SUCCESS) { - break; + if ((status = args->read_frame_callback(session, read_frame, args->user_data)) != SWITCH_STATUS_SUCCESS) { + goto done; } } } } + done: + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "done speaking text\n"); flags = 0; switch_core_speech_flush_tts(sh); commit 094d8f9599c2b5fa365dc175b360288c2b588bae Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Oct 4 17:55:04 2010 -0500 fix dialog-info presence issue diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index d9b3de0..3a01e1e 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -571,22 +571,22 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) switch_safe_free(sql); - sql = switch_mprintf("select sip_registrations.sip_user, sip_registrations.orig_server_host, sip_registrations.status, " + sql = switch_mprintf("select sip_registrations.sip_user, sip_registrations.orig_hostname, sip_registrations.status, " "sip_registrations.rpid,'', sip_dialogs.uuid, sip_dialogs.state, sip_dialogs.direction, " "sip_dialogs.sip_to_user, sip_dialogs.sip_to_host, sip_presence.status,sip_presence.rpid,sip_presence.open_closed," "'%q','%q' " "from sip_registrations left join sip_dialogs on " "(sip_dialogs.sip_from_user = sip_registrations.sip_user " - "and (sip_dialogs.sip_from_host = sip_registrations.orig_server_host or " + "and (sip_dialogs.sip_from_host = sip_registrations.orig_hostname or " "sip_dialogs.sip_from_host = sip_registrations.sip_host) ) " "left join sip_presence on " - "(sip_registrations.sip_user=sip_presence.sip_user and sip_registrations.orig_server_host=sip_presence.sip_host and " + "(sip_registrations.sip_user=sip_presence.sip_user and sip_registrations.orig_hostname=sip_presence.sip_host and " "sip_registrations.profile_name=sip_presence.profile_name) " "where sip_registrations.sip_user='%q' and " - "(sip_registrations.orig_server_host='%q' or sip_registrations.sip_host='%q' " + "(sip_registrations.orig_hostname='%q' or sip_registrations.sip_host='%q' " "or sip_registrations.presence_hosts like '%%%q%%')", dh.status, dh.rpid, probe_euser, probe_host, probe_host, probe_host); switch_assert(sql); commit 0ca8d88ed49aaa03d32997ba7a2c5cfdac934b55 Author: Michael Jerris <mike@jerris.com> Date: Mon Oct 4 17:43:10 2010 -0500 declinatio mortuus obfirmo diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index b9364ff..e1570a7 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -1914,6 +1914,8 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, v uint32_t hangover = 40, hangunder = 15, hangover_hits = 0, hangunder_hits = 0, energy_level = 0, diff_level = 400; switch_codec_implementation_t read_impl = { 0 }; switch_core_session_t *session = member->session; + int check_floor_change; + switch_assert(member != NULL); switch_clear_flag_locked(member, MFLAG_TALKING); @@ -1926,6 +1928,7 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, v and mux it with any audio from other channels. */ while (switch_test_flag(member, MFLAG_RUNNING) && switch_channel_ready(channel)) { + check_floor_change = 0; if (switch_channel_ready(channel) && switch_channel_test_app_flag(channel, CF_APP_TAGGED)) { switch_yield(100000); @@ -2083,25 +2086,7 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, v } if (diff >= diff_level || ++hangunder_hits >= hangunder) { - - switch_mutex_lock(member->conference->member_mutex); - if ((!member->conference->floor_holder || - !switch_test_flag(member->conference->floor_holder, MFLAG_TALKING) || - ((member->score_iir > SCORE_IIR_SPEAKING_MAX) && (member->conference->floor_holder->score_iir < SCORE_IIR_SPEAKING_MIN))) && - (!switch_test_flag(member->conference, CFLAG_VID_FLOOR) || switch_channel_test_flag(channel, CF_VIDEO))) { - - if (test_eflag(member->conference, EFLAG_FLOOR_CHANGE) && - switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) { - conference_add_event_member_data(member, event); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "floor-change"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Old-ID", "%d", - member->conference->floor_holder ? member->conference->floor_holder->id : 0); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-ID", "%d", member->conference->floor_holder ? member->id : 0); - switch_event_fire(&event); - } - member->conference->floor_holder = member; - } - switch_mutex_unlock(member->conference->member_mutex); + check_floor_change = 1; hangover_hits = hangunder_hits = 0; member->last_talking = switch_epoch_time_now(NULL); @@ -2191,6 +2176,28 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, v do_continue: switch_mutex_unlock(member->read_mutex); + + if (check_floor_change) { + switch_mutex_lock(member->conference->member_mutex); + if ((!member->conference->floor_holder || + !switch_test_flag(member->conference->floor_holder, MFLAG_TALKING) || + ((member->score_iir > SCORE_IIR_SPEAKING_MAX) && (member->conference->floor_holder->score_iir < SCORE_IIR_SPEAKING_MIN))) && + (!switch_test_flag(member->conference, CFLAG_VID_FLOOR) || switch_channel_test_flag(channel, CF_VIDEO))) { + + if (test_eflag(member->conference, EFLAG_FLOOR_CHANGE) && + switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) { + conference_add_event_member_data(member, event); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "floor-change"); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Old-ID", "%d", + member->conference->floor_holder ? member->conference->floor_holder->id : 0); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-ID", "%d", member->conference->floor_holder ? member->id : 0); + switch_event_fire(&event); + } + member->conference->floor_holder = member; + } + switch_mutex_unlock(member->conference->member_mutex); + } + } commit dc0f761b1492a0911f66b664a2a7ede5ad548638 Author: Michael S Collins <msc@freeswitch.org> Date: Mon Oct 4 14:01:36 2010 -0700 Phrase file updates (en) diff --git a/docs/phrase/phrase_en.xml b/docs/phrase/phrase_en.xml index d519350..6d582e7 100644 --- a/docs/phrase/phrase_en.xml +++ b/docs/phrase/phrase_en.xml @@ -364,6 +364,21 @@ <prompt phrase="...files..." filename="ivr-files-.wav"/> <!-- The following phrases still need to be recorded --> + <prompt phrase="For a wakeup call..." filename="ivr-for_a_wakeup_call.wav"/> + <prompt phrase="This is your wakeup call." filename="ivr-this_is_your_wakeup_call.wav"/> + <prompt phrase="To request a wakeup call..." filename="ivr-request_wakeup_call.wav"/> + <prompt phrase="To confirm a wakeup call..." filename="ivr-confirm_wakeup_call.wav"/> + <prompt phrase="To cancel a wakeup call..." filename="ivr-cancel_wakeup_call.wav"/> + <prompt phrase="You have requested a wakeup call for..." filename="ivr-requested_wakeup_call_for.wav"/> + <prompt phrase="You have not requested a wakeup call." filename="ivr-not_requested_wakeup_call.wav"/> + <prompt phrase="Your wakeup call has been cancelled." filename="ivr-wakeup_call_cancelled.wav"/> + <prompt phrase="For a daily wakeup call..." filename="ivr-for_daily_wakeup_call.wav"/> + <prompt phrase="Daily wakeup call..." filename="ivr-daily_wakeup_call.wav"/> + <prompt phrase="For daily wakeup calls..." filename="ivr-for_daily_wakeup_calls.wav"/> + <prompt phrase="For a one-time wakeup call..." filename="ivr-for_one_time_wakeup_call.wav"/> + <prompt phrase="One-time wakeup call..." filename="ivr-one_time_wakeup_call.wav"/> + <prompt phrase="...wakeup call..." filename="ivr-wakeup_call.wav"/> + <prompt phrase="Wakey wakey sunshine!" filename="ivr-wakey_wakey_sunshine.wav"/> <prompt phrase="Welcome." filename="ivr-welcome.wav"/> <prompt phrase="Welcome to..." filename="ivr-welcome_to.wav"/> <prompt phrase="Good morning." filename="ivr-good_morning.wav"/> @@ -387,17 +402,37 @@ <prompt phrase="Thank you for calling. If you know your party's extension, please enter it now, or dial nine for a directory." filename="ivr-generic_greeting.wav"/> <prompt phrase="If this is correct, press 1. If not, press 2." filename="ivr-if_correct_one_if_not_two.wav"/> <prompt phrase="To repeat this information..." filename="ivr-repeat_this_information.wav"/> - <prompt phrase="No no no!" filename="ivr-nonono.wav"/> + <prompt phrase="No no no!" filename="ivr-no_no_no.wav"/> <prompt phrase="Do you mean to press that key?" filename="ivr-did_you_mean_to_press_key.wav"/> <prompt phrase="Seriously. Did you REALLY mean to press that key?" filename="ivr-seriously_mean_to_press_key.wav"/> - <prompt phrase="Oh whatever." filename="ivr-oh_whatever.wav"/> + <prompt phrase="Oh what-EVER." filename="ivr-oh_whatever.wav"/> <prompt phrase="That's it! One more mistake and I WILL hang up on your ass." filename="ivr-one_more_mistake.wav"/> <prompt phrase="Congratulations, you pressed star. This does not mean you ARE a star. It simply means that you can press buttons and probably have fingers." filename="ivr-congratulations_you_pressed_star.wav"/> <prompt phrase="All of our engineers are busy assisting other sales guys with demonstrating how cool the CudaTel is. Please stay on the line and your call will be answered in the order it was received." filename="ivr-engineers_busy_assisting_other_sales.wav"/> - <prompt phrase="" filename="ivr-.wav"/> + <prompt phrase="The person you are trying to reach is not available and does not have voicemail." filename="vm-not_available_no_voicemail.wav"/> + <prompt phrase="This message will self-destruct in 5, 4, 3, 2, 1..." filename="ivr-message_self_destruct.wav"/> <prompt phrase="You are already muted." filename="conf-you_are_already_muted.wav"/> <prompt phrase="You are now bi-directionally muted." filename="conf-you_are_now_bidirectionally_muted.wav"/> - + <prompt phrase="All your call are belong to us." filename="ivr-all_your_call_are_belong_to_us.wav"/> + <prompt phrase="I just love the way you press those touch tones!" filename="ivr-love_those_touch_tones.wav"/> + <prompt phrase="Yes we have no bananas." filename="ivr-yes_we_have_no_bananas.wav"/> + <prompt phrase="Dude, you suck!" filename="ivr-dude_you_suck.wav"/> + <prompt phrase="Your call is very important to us, but your sanity is not, so we will be happy to keep you on hold, forever torturing you with our annoying hold music." filename="ivr-on_hold_indefinitely.wav"/> + <prompt phrase="...has left the building." filename="ivr-has_left_the_building.wav"/> + <prompt phrase="Barracuda Networks" filename="ivr-barracuda_networks.wav"/> + <prompt phrase="CudaTel Communication Server" filename="ivr-cudatel_communication_server.wav"/> + <prompt phrase="Brian West" filename="misc-Brian_West.wav"/> + <prompt phrase="Anthony Minessale" filename="misc-Anthony_Minessale.wav"/> + <prompt phrase="Michael Jerris" filename="misc-Michael_Jerris.wav"/> + <prompt phrase="Raymond Chandler" filename="misc-Raymond_Chandler.wav"/> + <prompt phrase="Michael Collins" filename="misc-Michael_Collins.wav"/> + <prompt phrase="Mark Mann" filename="misc-Mark_Mann.wav"/> + <prompt phrase="William King" filename="misc-William_King.wav"/> + <prompt phrase="Rudy Fleminger" filename="misc-Rudy_Fleminger.wav"/> + <prompt phrase="Andrew Thompson" filename="misc-Andrew_Thompson.wav"/> + <prompt phrase="Graham Saathoff" filename="misc-Graham_Saathoff.wav"/> + <prompt phrase="Nicholaus Belluni" filename="misc-Nicholaus_Belluni.wav"/> + <prompt phrase="Sean Heiney" filename="misc-Sean_Heiney.wav"> </ivr> <misc> <prompt phrase="This call has been secured" filename="call_secured.wav"/> commit 757e9e20bdac33e6e368254c125d6fd12a9cbc75 Author: Michael Jerris <mike@jerris.com> Date: Mon Oct 4 16:58:29 2010 -0400 fix conference deadlock on probobly inpossible buffer failure diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 7018294..b9364ff 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -1330,6 +1330,7 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, v switch_mutex_unlock(omember->audio_out_mutex); if (!ok) { + switch_mutex_unlock(conference->mutex); goto end; } } commit 6e14d6f5b2e8e8ebf26eb61d5b06d8593dc3785b Merge: dac27bb 4013fb5 Author: Moises Silva <moy@sangoma.com> Date: Mon Oct 4 11:04:45 2010 -0400 Merge remote branch 'smgorig/master' commit dac27bbaa699ba548fbd442ee4b88a6d73a6734d Author: Jeff Lenk <jeff@jefflenk.com> Date: Mon Oct 4 09:15:48 2010 -0500 reswig vs2010 diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx index ade6bf8..882f062 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx @@ -1331,6 +1331,16 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_EXPORT_VARS_VARIABLE_get() { } +SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_BRIDGE_EXPORT_VARS_VARIABLE_get() { + char * jresult ; + char *result = 0 ; + + result = (char *)("bridge_export_vars"); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_R_SDP_VARIABLE_get() { char * jresult ; char *result = 0 ; @@ -4066,7 +4076,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_API_VERSION_get() { int jresult ; int result; - result = (int)(4); + result = (int)(5); jresult = result; return jresult; } @@ -7918,6 +7928,24 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_codec_copy(void * jarg1, void * ja } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_codec_parse_fmtp(char * jarg1, char * jarg2, unsigned long jarg3, void * jarg4) { + int jresult ; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + uint32_t arg3 ; + switch_codec_fmtp_t *arg4 = (switch_codec_fmtp_t *) 0 ; + switch_status_t result; + + arg1 = (char *)jarg1; + arg2 = (char *)jarg2; + arg3 = (uint32_t)jarg3; + arg4 = (switch_codec_fmtp_t *)jarg4; + result = (switch_status_t)switch_core_codec_parse_fmtp((char const *)arg1,(char const *)arg2,arg3,arg4); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_codec_reset(void * jarg1) { int jresult ; switch_codec_t *arg1 = (switch_codec_t *) 0 ; @@ -11529,6 +11557,18 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_digit_string(char * jarg1) { } +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_known_bitrate(unsigned char jarg1) { + unsigned long jresult ; + switch_payload_t arg1 ; + uint32_t result; + + arg1 = (switch_payload_t)jarg1; + result = (uint32_t)switch_known_bitrate(arg1); + jresult = (unsigned long)result; + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_switch_fd_read_line(int jarg1, char * jarg2, void * jarg3) { void * jresult ; int arg1 ; @@ -22347,36 +22387,54 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_get_variable_partner(void * } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_export_variable_var_check(void * jarg1, char * jarg2, char * jarg3, int jarg4) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_export_variable_var_check(void * jarg1, char * jarg2, char * jarg3, char * jarg4, int jarg5) { int jresult ; switch_channel_t *arg1 = (switch_channel_t *) 0 ; char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; - switch_bool_t arg4 ; + char *arg4 = (char *) 0 ; + switch_bool_t arg5 ; switch_status_t result; arg1 = (switch_channel_t *)jarg1; arg2 = (char *)jarg2; arg3 = (char *)jarg3; - arg4 = (switch_bool_t)jarg4; - result = (switch_status_t)switch_channel_export_variable_var_check(arg1,(char const *)arg2,(char const *)arg3,arg4); + arg4 = (char *)jarg4; + arg5 = (switch_bool_t)jarg5; + result = (switch_status_t)switch_channel_export_variable_var_check(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5); jresult = result; return jresult; } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_export_variable_printf(void * jarg1, char * jarg2, char * jarg3) { +SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_process_export(void * jarg1, void * jarg2, void * jarg3, char * jarg4) { + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + switch_channel_t *arg2 = (switch_channel_t *) 0 ; + switch_event_t *arg3 = (switch_event_t *) 0 ; + char *arg4 = (char *) 0 ; + + arg1 = (switch_channel_t *)jarg1; + arg2 = (switch_channel_t *)jarg2; + arg3 = (switch_event_t *)jarg3; + arg4 = (char *)jarg4; + switch_channel_process_export(arg1,arg2,arg3,(char const *)arg4); +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_export_variable_printf(void * jarg1, char * jarg2, char * jarg3, char * jarg4) { int jresult ; switch_channel_t *arg1 = (switch_channel_t *) 0 ; char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; - void *arg4 = 0 ; + char *arg4 = (char *) 0 ; + void *arg5 = 0 ; switch_status_t result; arg1 = (switch_channel_t *)jarg1; arg2 = (char *)jarg2; arg3 = (char *)jarg3; - result = (switch_status_t)switch_channel_export_variable_printf(arg1,(char const *)arg2,(char const *)arg3,arg4); + arg4 = (char *)jarg4; + result = (switch_status_t)switch_channel_export_variable_printf(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5); jresult = result; return jresult; } diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs index 01cc84e..1d89787 100644 --- a/src/mod/languages/mod_managed/managed/swig.2010.cs +++ b/src/mod/languages/mod_managed/managed/swig.2010.cs @@ -1683,6 +1683,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_core_codec_parse_fmtp(string codec_name, string fmtp, uint rate, switch_codec_fmtp codec_fmtp) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_codec_parse_fmtp(codec_name, fmtp, rate, switch_codec_fmtp.getCPtr(codec_fmtp)); + return ret; + } + public static switch_status_t switch_core_codec_reset(switch_codec codec) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_codec_reset(switch_codec.getCPtr(codec)); return ret; @@ -2645,6 +2650,11 @@ public class freeswitch { return ret; } + public static uint switch_known_bitrate(byte payload) { + uint ret = freeswitchPINVOKE.switch_known_bitrate(payload); + return ret; + } + public static SWIGTYPE_p_switch_size_t switch_fd_read_line(int fd, string buf, SWIGTYPE_p_switch_size_t len) { SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_fd_read_line(fd, buf, SWIGTYPE_p_switch_size_t.getCPtr(len)), true); if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); @@ -3188,13 +3198,17 @@ public class freeswitch { return ret; } - public static switch_status_t switch_channel_export_variable_var_check(SWIGTYPE_p_switch_channel channel, string varname, string value, switch_bool_t var_check) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_export_variable_var_check(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, value, (int)var_check); + public static switch_status_t switch_channel_export_variable_var_check(SWIGTYPE_p_switch_channel channel, string varname, string val, string export_varname, switch_bool_t var_check) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_export_variable_var_check(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, val, export_varname, (int)var_check); return ret; } - public static switch_status_t switch_channel_export_variable_printf(SWIGTYPE_p_switch_channel channel, string varname, string fmt) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_export_variable_printf(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, fmt); + public static void switch_channel_process_export(SWIGTYPE_p_switch_channel channel, SWIGTYPE_p_switch_channel peer_channel, switch_event var_event, string export_varname) { + freeswitchPINVOKE.switch_channel_process_export(SWIGTYPE_p_switch_channel.getCPtr(channel), SWIGTYPE_p_switch_channel.getCPtr(peer_channel), switch_event.getCPtr(var_event), export_varname); + } + + public static switch_status_t switch_channel_export_variable_printf(SWIGTYPE_p_switch_channel channel, string varname, string export_varname, string fmt) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_export_variable_printf(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, export_varname, fmt); return ret; } @@ -5206,6 +5220,7 @@ public class freeswitch { public static readonly string SWITCH_ENDPOINT_DISPOSITION_VARIABLE = freeswitchPINVOKE.SWITCH_ENDPOINT_DISPOSITION_VARIABLE_get(); public static readonly string SWITCH_HOLD_MUSIC_VARIABLE = freeswitchPINVOKE.SWITCH_HOLD_MUSIC_VARIABLE_get(); public static readonly string SWITCH_EXPORT_VARS_VARIABLE = freeswitchPINVOKE.SWITCH_EXPORT_VARS_VARIABLE_get(); + public static readonly string SWITCH_BRIDGE_EXPORT_VARS_VARIABLE = freeswitchPINVOKE.SWITCH_BRIDGE_EXPORT_VARS_VARIABLE_get(); public static readonly string SWITCH_R_SDP_VARIABLE = freeswitchPINVOKE.SWITCH_R_SDP_VARIABLE_get(); public static readonly string SWITCH_L_SDP_VARIABLE = freeswitchPINVOKE.SWITCH_L_SDP_VARIABLE_get(); public static readonly string SWITCH_B_SDP_VARIABLE = freeswitchPINVOKE.SWITCH_B_SDP_VARIABLE_get(); @@ -5795,6 +5810,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_EXPORT_VARS_VARIABLE_get")] public static extern string SWITCH_EXPORT_VARS_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_BRIDGE_EXPORT_VARS_VARIABLE_get")] + public static extern string SWITCH_BRIDGE_EXPORT_VARS_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_R_SDP_VARIABLE_get")] public static extern string SWITCH_R_SDP_VARIABLE_get(); @@ -7415,6 +7433,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_copy")] public static extern int switch_core_codec_copy(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_parse_fmtp")] + public static extern int switch_core_codec_parse_fmtp(string jarg1, string jarg2, uint jarg3, HandleRef jarg4); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_reset")] public static extern int switch_core_codec_reset(HandleRef jarg1); @@ -8267,6 +8288,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_is_digit_string")] public static extern int switch_is_digit_string(string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_known_bitrate")] + public static extern uint switch_known_bitrate(byte jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_fd_read_line")] public static extern IntPtr switch_fd_read_line(int jarg1, string jarg2, HandleRef jarg3); @@ -10980,10 +11004,13 @@ class freeswitchPINVOKE { public static extern string switch_channel_get_variable_partner(HandleRef jarg1, string jarg2); [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_export_variable_var_check")] - public static extern int switch_channel_export_variable_var_check(HandleRef jarg1, string jarg2, string jarg3, int jarg4); + public static extern int switch_channel_export_variable_var_check(HandleRef jarg1, string jarg2, string jarg3, string jarg4, int jarg5); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_process_export")] + public static extern void switch_channel_process_export(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, string jarg4); [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_export_variable_printf")] - public static extern int switch_channel_export_variable_printf(HandleRef jarg1, string jarg2, string jarg3); + public static extern int switch_channel_export_variable_printf(HandleRef jarg1, string jarg2, string jarg3, string jarg4); [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_variable_dup")] public static extern string switch_channel_get_variable_dup(HandleRef jarg1, string jarg2, int jarg3); commit a46902c4cc33eb0ae4ae7ac8d0a6447c4f14fdaa Author: Jeff Lenk <jeff@jefflenk.com> Date: Mon Oct 4 09:11:49 2010 -0500 fix error with prev commit diff --git a/libs/win32/Sound_Files/16khz.2010.vcxproj b/libs/win32/Sound_Files/16khz.2010.vcxproj index b34ab64..90d4abd 100644 --- a/libs/win32/Sound_Files/16khz.2010.vcxproj +++ b/libs/win32/Sound_Files/16khz.2010.vcxproj @@ -68,65 +68,65 @@ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PostBuildEvent> <Command> - xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\16000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\16000\*.*" "$(OutDir)sounds\en\us\callie\ivr\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\16000\*.*" "$(OutDir)sounds\en\us\callie\conference\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\16000\*.*" "$(OutDir)sounds\en\us\callie\time\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\16000\*.*" "$(OutDir)sounds\en\us\callie\digits\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\ascii\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\16000\*.*" "$(OutDir)sounds\en\us\callie\misc\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\16000\*.*" "$(OutDir)sounds\en\us\callie\currency\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\16000\*.*" "$(OutDir)sounds\en\us\callie\directory\16000" /C /D /Y /S /I - </Command> +xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\16000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\16000\*.*" "$(OutDir)sounds\en\us\callie\ivr\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\16000\*.*" "$(OutDir)sounds\en\us\callie\conference\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\16000\*.*" "$(OutDir)sounds\en\us\callie\time\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\16000\*.*" "$(OutDir)sounds\en\us\callie\digits\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\ascii\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\16000\*.*" "$(OutDir)sounds\en\us\callie\misc\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\16000\*.*" "$(OutDir)sounds\en\us\callie\currency\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\16000\*.*" "$(OutDir)sounds\en\us\callie\directory\16000" /C /D /Y /S /I +</Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PostBuildEvent> <Command> - xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\16000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\16000\*.*" "$(OutDir)sounds\en\us\callie\ivr\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\16000\*.*" "$(OutDir)sounds\en\us\callie\conference\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\16000\*.*" "$(OutDir)sounds\en\us\callie\time\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\16000\*.*" "$(OutDir)sounds\en\us\callie\digits\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\ascii\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\16000\*.*" "$(OutDir)sounds\en\us\callie\misc\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\16000\*.*" "$(OutDir)sounds\en\us\callie\currency\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\16000\*.*" "$(OutDir)sounds\en\us\callie\directory\16000" /C /D /Y /S /I - </Command> +xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\16000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\16000\*.*" "$(OutDir)sounds\en\us\callie\ivr\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\16000\*.*" "$(OutDir)sounds\en\us\callie\conference\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\16000\*.*" "$(OutDir)sounds\en\us\callie\time\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\16000\*.*" "$(OutDir)sounds\en\us\callie\digits\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\ascii\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\16000\*.*" "$(OutDir)sounds\en\us\callie\misc\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\16000\*.*" "$(OutDir)sounds\en\us\callie\currency\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\16000\*.*" "$(OutDir)sounds\en\us\callie\directory\16000" /C /D /Y /S /I +</Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PostBuildEvent> <Command> - xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\16000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\16000\*.*" "$(OutDir)sounds\en\us\callie\ivr\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\16000\*.*" "$(OutDir)sounds\en\us\callie\conference\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\16000\*.*" "$(OutDir)sounds\en\us\callie\time\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\16000\*.*" "$(OutDir)sounds\en\us\callie\digits\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\ascii\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\16000\*.*" "$(OutDir)sounds\en\us\callie\misc\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\16000\*.*" "$(OutDir)sounds\en\us\callie\currency\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\16000\*.*" "$(OutDir)sounds\en\us\callie\directory\16000" /C /D /Y /S /I - </Command> +xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\16000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\16000\*.*" "$(OutDir)sounds\en\us\callie\ivr\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\16000\*.*" "$(OutDir)sounds\en\us\callie\conference\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\16000\*.*" "$(OutDir)sounds\en\us\callie\time\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\16000\*.*" "$(OutDir)sounds\en\us\callie\digits\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\ascii\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\16000\*.*" "$(OutDir)sounds\en\us\callie\misc\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\16000\*.*" "$(OutDir)sounds\en\us\callie\currency\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\16000\*.*" "$(OutDir)sounds\en\us\callie\directory\16000" /C /D /Y /S /I +</Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PostBuildEvent> <Command> - xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\16000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\16000\*.*" "$(OutDir)sounds\en\us\callie\ivr\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\16000\*.*" "$(OutDir)sounds\en\us\callie\conference\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\16000\*.*" "$(OutDir)sounds\en\us\callie\time\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\16000\*.*" "$(OutDir)sounds\en\us\callie\digits\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\ascii\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\16000\*.*" "$(OutDir)sounds\en\us\callie\misc\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\16000\*.*" "$(OutDir)sounds\en\us\callie\currency\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\16000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\16000\*.*" "$(OutDir)sounds\en\us\callie\directory\16000" /C /D /Y /S /I - </Command> +xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\16000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\16000\*.*" "$(OutDir)sounds\en\us\callie\ivr\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\16000\*.*" "$(OutDir)sounds\en\us\callie\conference\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\16000\*.*" "$(OutDir)sounds\en\us\callie\time\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\16000\*.*" "$(OutDir)sounds\en\us\callie\digits\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\ascii\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\16000\*.*" "$(OutDir)sounds\en\us\callie\misc\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\16000\*.*" "$(OutDir)sounds\en\us\callie\currency\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\16000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\16000\*.*" "$(OutDir)sounds\en\us\callie\directory\16000" /C /D /Y /S /I +</Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemGroup> diff --git a/libs/win32/Sound_Files/32khz.2010.vcxproj b/libs/win32/Sound_Files/32khz.2010.vcxproj index 35e947d..1435d0c 100644 --- a/libs/win32/Sound_Files/32khz.2010.vcxproj +++ b/libs/win32/Sound_Files/32khz.2010.vcxproj @@ -68,65 +68,65 @@ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PostBuildEvent> <Command> - xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\32000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\32000\*.*" "$(OutDir)sounds\en\us\callie\ivr\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\32000\*.*" "$(OutDir)sounds\en\us\callie\conference\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\32000\*.*" "$(OutDir)sounds\en\us\callie\time\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\32000\*.*" "$(OutDir)sounds\en\us\callie\digits\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\ascii\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\32000\*.*" "$(OutDir)sounds\en\us\callie\misc\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\32000\*.*" "$(OutDir)sounds\en\us\callie\currency\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\32000\*.*" "$(OutDir)sounds\en\us\callie\directory\32000" /C /D /Y /S /I - </Command> +xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\32000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\32000\*.*" "$(OutDir)sounds\en\us\callie\ivr\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\32000\*.*" "$(OutDir)sounds\en\us\callie\conference\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\32000\*.*" "$(OutDir)sounds\en\us\callie\time\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\32000\*.*" "$(OutDir)sounds\en\us\callie\digits\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\ascii\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\32000\*.*" "$(OutDir)sounds\en\us\callie\misc\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\32000\*.*" "$(OutDir)sounds\en\us\callie\currency\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\32000\*.*" "$(OutDir)sounds\en\us\callie\directory\32000" /C /D /Y /S /I +</Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PostBuildEvent> <Command> - xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\32000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\32000\*.*" "$(OutDir)sounds\en\us\callie\ivr\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\32000\*.*" "$(OutDir)sounds\en\us\callie\conference\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\32000\*.*" "$(OutDir)sounds\en\us\callie\time\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\32000\*.*" "$(OutDir)sounds\en\us\callie\digits\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\ascii\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\32000\*.*" "$(OutDir)sounds\en\us\callie\misc\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\32000\*.*" "$(OutDir)sounds\en\us\callie\currency\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\32000\*.*" "$(OutDir)sounds\en\us\callie\directory\32000" /C /D /Y /S /I - </Command> +xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\32000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\32000\*.*" "$(OutDir)sounds\en\us\callie\ivr\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\32000\*.*" "$(OutDir)sounds\en\us\callie\conference\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\32000\*.*" "$(OutDir)sounds\en\us\callie\time\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\32000\*.*" "$(OutDir)sounds\en\us\callie\digits\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\ascii\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\32000\*.*" "$(OutDir)sounds\en\us\callie\misc\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\32000\*.*" "$(OutDir)sounds\en\us\callie\currency\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\32000\*.*" "$(OutDir)sounds\en\us\callie\directory\32000" /C /D /Y /S /I +</Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PostBuildEvent> <Command> - xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\32000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\32000\*.*" "$(OutDir)sounds\en\us\callie\ivr\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\32000\*.*" "$(OutDir)sounds\en\us\callie\conference\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\32000\*.*" "$(OutDir)sounds\en\us\callie\time\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\32000\*.*" "$(OutDir)sounds\en\us\callie\digits\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\ascii\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\32000\*.*" "$(OutDir)sounds\en\us\callie\misc\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\32000\*.*" "$(OutDir)sounds\en\us\callie\currency\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\32000\*.*" "$(OutDir)sounds\en\us\callie\directory\32000" /C /D /Y /S /I - </Command> +xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\32000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\32000\*.*" "$(OutDir)sounds\en\us\callie\ivr\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\32000\*.*" "$(OutDir)sounds\en\us\callie\conference\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\32000\*.*" "$(OutDir)sounds\en\us\callie\time\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\32000\*.*" "$(OutDir)sounds\en\us\callie\digits\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\ascii\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\32000\*.*" "$(OutDir)sounds\en\us\callie\misc\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\32000\*.*" "$(OutDir)sounds\en\us\callie\currency\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\32000\*.*" "$(OutDir)sounds\en\us\callie\directory\32000" /C /D /Y /S /I +</Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PostBuildEvent> <Command> - xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\32000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\32000\*.*" "$(OutDir)sounds\en\us\callie\ivr\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\32000\*.*" "$(OutDir)sounds\en\us\callie\conference\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\32000\*.*" "$(OutDir)sounds\en\us\callie\time\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\32000\*.*" "$(OutDir)sounds\en\us\callie\digits\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\ascii\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\32000\*.*" "$(OutDir)sounds\en\us\callie\misc\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\32000\*.*" "$(OutDir)sounds\en\us\callie\currency\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\32000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\32000\*.*" "$(OutDir)sounds\en\us\callie\directory\32000" /C /D /Y /S /I - </Command> +xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\32000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\32000\*.*" "$(OutDir)sounds\en\us\callie\ivr\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\32000\*.*" "$(OutDir)sounds\en\us\callie\conference\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\32000\*.*" "$(OutDir)sounds\en\us\callie\time\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\32000\*.*" "$(OutDir)sounds\en\us\callie\digits\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\ascii\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\32000\*.*" "$(OutDir)sounds\en\us\callie\misc\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\32000\*.*" "$(OutDir)sounds\en\us\callie\currency\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\32000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\32000\*.*" "$(OutDir)sounds\en\us\callie\directory\32000" /C /D /Y /S /I +</Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemGroup> diff --git a/libs/win32/Sound_Files/8khz.2010.vcxproj b/libs/win32/Sound_Files/8khz.2010.vcxproj index 5fad0bd..664e975 100644 --- a/libs/win32/Sound_Files/8khz.2010.vcxproj +++ b/libs/win32/Sound_Files/8khz.2010.vcxproj @@ -68,65 +68,65 @@ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PostBuildEvent> <Command> - xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\8000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\8000\*.*" "$(OutDir)sounds\en\us\callie\ivr\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\8000\*.*" "$(OutDir)sounds\en\us\callie\conference\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\8000\*.*" "$(OutDir)sounds\en\us\callie\time\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\8000\*.*" "$(OutDir)sounds\en\us\callie\digits\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\ascii\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\8000\*.*" "$(OutDir)sounds\en\us\callie\misc\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\8000\*.*" "$(OutDir)sounds\en\us\callie\currency\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\8000\*.*" "$(OutDir)sounds\en\us\callie\directory\8000" /C /D /Y /S /I - </Command> +xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\8000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\8000\*.*" "$(OutDir)sounds\en\us\callie\ivr\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\8000\*.*" "$(OutDir)sounds\en\us\callie\conference\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\8000\*.*" "$(OutDir)sounds\en\us\callie\time\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\8000\*.*" "$(OutDir)sounds\en\us\callie\digits\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\ascii\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\8000\*.*" "$(OutDir)sounds\en\us\callie\misc\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\8000\*.*" "$(OutDir)sounds\en\us\callie\currency\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\8000\*.*" "$(OutDir)sounds\en\us\callie\directory\8000" /C /D /Y /S /I +</Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PostBuildEvent> <Command> - xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\8000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\8000\*.*" "$(OutDir)sounds\en\us\callie\ivr\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\8000\*.*" "$(OutDir)sounds\en\us\callie\conference\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\8000\*.*" "$(OutDir)sounds\en\us\callie\time\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\8000\*.*" "$(OutDir)sounds\en\us\callie\digits\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\ascii\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\8000\*.*" "$(OutDir)sounds\en\us\callie\misc\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\8000\*.*" "$(OutDir)sounds\en\us\callie\currency\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\8000\*.*" "$(OutDir)sounds\en\us\callie\directory\8000" /C /D /Y /S /I - </Command> +xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\8000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\8000\*.*" "$(OutDir)sounds\en\us\callie\ivr\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\8000\*.*" "$(OutDir)sounds\en\us\callie\conference\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\8000\*.*" "$(OutDir)sounds\en\us\callie\time\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\8000\*.*" "$(OutDir)sounds\en\us\callie\digits\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\ascii\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\8000\*.*" "$(OutDir)sounds\en\us\callie\misc\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\8000\*.*" "$(OutDir)sounds\en\us\callie\currency\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\8000\*.*" "$(OutDir)sounds\en\us\callie\directory\8000" /C /D /Y /S /I +</Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PostBuildEvent> <Command> - xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\8000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\8000\*.*" "$(OutDir)sounds\en\us\callie\ivr\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\8000\*.*" "$(OutDir)sounds\en\us\callie\conference\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\8000\*.*" "$(OutDir)sounds\en\us\callie\time\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\8000\*.*" "$(OutDir)sounds\en\us\callie\digits\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\ascii\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\8000\*.*" "$(OutDir)sounds\en\us\callie\misc\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\8000\*.*" "$(OutDir)sounds\en\us\callie\currency\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\8000\*.*" "$(OutDir)sounds\en\us\callie\directory\8000" /C /D /Y /S /I - </Command> +xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\8000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\8000\*.*" "$(OutDir)sounds\en\us\callie\ivr\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\8000\*.*" "$(OutDir)sounds\en\us\callie\conference\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\8000\*.*" "$(OutDir)sounds\en\us\callie\time\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\8000\*.*" "$(OutDir)sounds\en\us\callie\digits\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\ascii\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\8000\*.*" "$(OutDir)sounds\en\us\callie\misc\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\8000\*.*" "$(OutDir)sounds\en\us\callie\currency\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\8000\*.*" "$(OutDir)sounds\en\us\callie\directory\8000" /C /D /Y /S /I +</Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PostBuildEvent> <Command> - xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\8000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\8000\*.*" "$(OutDir)sounds\en\us\callie\ivr\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\8000\*.*" "$(OutDir)sounds\en\us\callie\conference\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\8000\*.*" "$(OutDir)sounds\en\us\callie\time\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\8000\*.*" "$(OutDir)sounds\en\us\callie\digits\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\ascii\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\8000\*.*" "$(OutDir)sounds\en\us\callie\misc\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\8000\*.*" "$(OutDir)sounds\en\us\callie\currency\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\8000" /C /D /Y /S /I - xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\8000\*.*" "$(OutDir)sounds\en\us\callie\directory\8000" /C /D /Y /S /I - </Command> +xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\8000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\8000\*.*" "$(OutDir)sounds\en\us\callie\ivr\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\8000\*.*" "$(OutDir)sounds\en\us\callie\conference\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\8000\*.*" "$(OutDir)sounds\en\us\callie\time\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\8000\*.*" "$(OutDir)sounds\en\us\callie\digits\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\ascii\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\8000\*.*" "$(OutDir)sounds\en\us\callie\misc\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\8000\*.*" "$(OutDir)sounds\en\us\callie\currency\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\8000" /C /D /Y /S /I +xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\8000\*.*" "$(OutDir)sounds\en\us\callie\directory\8000" /C /D /Y /S /I +</Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemGroup> commit c701d41c3cbb28bd3eef3aca0184c49add37659b Author: Michael Jerris <mike@jerris.com> Date: Sun Oct 3 20:00:32 2010 -0400 add sofia_glue_find_parameter_value function to get a specific value from a url params string diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 5674046..f0ebb55 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -928,6 +928,7 @@ sofia_transport_t sofia_glue_str2transport(const char *str); const char *sofia_glue_transport2str(const sofia_transport_t tp); char *sofia_glue_find_parameter(const char *str, const char *param); +char *sofia_glue_find_parameter_value(switch_core_session_t *session, const char *str, const char *param); char *sofia_glue_create_via(switch_core_session_t *session, const char *ip, switch_port_t port, sofia_transport_t transport); char *sofia_glue_create_external_via(switch_core_session_t *session, sofia_profile_t *profile, sofia_transport_t transport); char *sofia_glue_strip_uri(const char *str); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 5e633e0..9d6cff7 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -990,6 +990,34 @@ sofia_transport_t sofia_glue_str2transport(const char *str) return SOFIA_TRANSPORT_UNKNOWN; } +char *sofia_glue_find_parameter_value(switch_core_session_t *session, const char *str, const char *param) +{ + const char *param_ptr; + char *param_value; + char *tmp; + switch_size_t param_len; + + if (zstr(str) || zstr(param) || !session) return NULL; + + if (end_of(param) != '=') { + param = switch_core_session_sprintf(session, "%s=", param); + if (zstr(param)) return NULL; + } + + param_len = strlen(param); + param_ptr = sofia_glue_find_parameter(str, param); + + if (zstr(param_ptr)) return NULL; + + param_value = switch_core_session_strdup(session, param_ptr + param_len); + + if (zstr(param_value)) return NULL; + + if ((tmp = strchr(param_value, ';'))) *tmp = '\0'; + + return param_value; +} + char *sofia_glue_find_parameter(const char *str, const char *param) { char *ptr = NULL; commit e11550e7614b0a048e5668c715c0ca9b3f7d7ce1 Author: Michael Jerris <mike@jerris.com> Date: Sun Oct 3 19:06:56 2010 -0400 FS-502: fix nat acl count check to check against the number of nat acls diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index c2fabd2..38e62de 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2471,7 +2471,7 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) sofia_clear_pflag(profile, PFLAG_STUN_AUTO_DISABLE); } } else if (!strcasecmp(var, "apply-nat-acl")) { - if (profile->acl_count < SOFIA_MAX_ACL) { + if (profile->nat_acl_count < SOFIA_MAX_ACL) { if (!profile->extsipip && switch_check_network_list_ip(profile->sipip, val)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Not adding acl %s because it's the local network\n", val); } else { @@ -3472,7 +3472,7 @@ switch_status_t config_sofia(int reload, char *profile_name) } else if (!strcasecmp(var, "context")) { profile->context = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "apply-nat-acl")) { - if (profile->acl_count < SOFIA_MAX_ACL) { + if (profile->nat_acl_count < SOFIA_MAX_ACL) { if (!profile->extsipip && profile->sipip && switch_check_network_list_ip(profile->sipip, val)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Not adding acl %s because it's the local network\n", val); } else { commit 82c4c4cc67adbfebbd4a2a83dfcfb3f98764d3cb Author: Michael Jerris <mike@jerris.com> Date: Sun Oct 3 05:56:43 2010 -0400 FS-523: fix parsing of sofia tracelevel param, moved param from profile params to global_settings as its global, and it only worked on reparse before anyways. Please correct any documentation on this issue on the wiki diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index aa208c2..c2fabd2 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2223,6 +2223,35 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) goto done; } + if ((settings = switch_xml_child(cfg, "global_settings"))) { + for (param = switch_xml_child(settings, "param"); param; param = param->next) { + char *var = (char *) switch_xml_attr_soft(param, "name"); + char *val = (char *) switch_xml_attr_soft(param, "value"); + if (!strcasecmp(var, "log-level")) { + su_log_set_level(NULL, atoi(val)); + } else if (!strcasecmp(var, "tracelevel")) { + mod_sofia_globals.tracelevel = switch_log_str2level(val); + } else if (!strcasecmp(var, "debug-presence")) { + mod_sofia_globals.debug_presence = atoi(val); + } else if (!strcasecmp(var, "debug-sla")) { + mod_sofia_globals.debug_sla = atoi(val); + } else if (!strcasecmp(var, "auto-restart")) { + mod_sofia_globals.auto_restart = switch_true(val); + } else if (!strcasecmp(var, "rewrite-multicasted-fs-path")) { + if( (!strcasecmp(val, "to_host")) || (!strcasecmp(val, "1")) ) { + /* old behaviour */ + mod_sofia_globals.rewrite_multicasted_fs_path = 1; + } else if (!strcasecmp(val, "original_server_host")) { + mod_sofia_globals.rewrite_multicasted_fs_path = 2; + } else if (!strcasecmp(val, "original_hostname")) { + mod_sofia_globals.rewrite_multicasted_fs_path = 3; + } else { + mod_sofia_globals.rewrite_multicasted_fs_path = SWITCH_FALSE; + } + } + } + } + if ((profiles = switch_xml_child(cfg, "profiles"))) { for (xprofile = switch_xml_child(profiles, "profile"); xprofile; xprofile = xprofile->next) { char *xprofilename = (char *) switch_xml_attr_soft(xprofile, "name"); @@ -2257,8 +2286,6 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) profile->debug = atoi(val); } else if (!strcasecmp(var, "shutdown-on-fail")) { profile->shutdown_type = switch_core_strdup(profile->pool, val); - } else if (!strcasecmp(var, "tracelevel")) { - mod_sofia_globals.tracelevel = switch_log_str2level(val); } else if (!strcasecmp(var, "pass-callee-id")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_PASS_CALLEE_ID); @@ -2817,6 +2844,8 @@ switch_status_t config_sofia(int reload, char *profile_name) char *val = (char *) switch_xml_attr_soft(param, "value"); if (!strcasecmp(var, "log-level")) { su_log_set_level(NULL, atoi(val)); + } else if (!strcasecmp(var, "tracelevel")) { + mod_sofia_globals.tracelevel = switch_log_str2level(val); } else if (!strcasecmp(var, "debug-presence")) { mod_sofia_globals.debug_presence = atoi(val); } else if (!strcasecmp(var, "debug-sla")) { commit 9b14bd5dbd43efe2f42a35d4095807817c8867d1 Author: Michael Jerris <mike@jerris.com> Date: Sun Oct 3 05:53:07 2010 -0400 fix file modes in sofia diff --git a/libs/sofia-sip/libsofia-sip-ua/nta/run_check_nta b/libs/sofia-sip/libsofia-sip-ua/nta/run_check_nta old mode 100644 new mode 100755 diff --git a/libs/sofia-sip/libsofia-sip-ua/nta/run_test_nta b/libs/sofia-sip/libsofia-sip-ua/nta/run_test_nta old mode 100644 new mode 100755 diff --git a/libs/sofia-sip/libsofia-sip-ua/nta/run_test_nta_api b/libs/sofia-sip/libsofia-sip-ua/nta/run_test_nta_api old mode 100644 new mode 100755 diff --git a/libs/sofia-sip/libsofia-sip-ua/sdp/run_test_sdp b/libs/sofia-sip/libsofia-sip-ua/sdp/run_test_sdp old mode 100644 new mode 100755 diff --git a/libs/sofia-sip/libsofia-sip-ua/sip/run-tests b/libs/sofia-sip/libsofia-sip-ua/sip/run-tests old mode 100644 new mode 100755 diff --git a/libs/sofia-sip/libsofia-sip-ua/sip/run_test_date b/libs/sofia-sip/libsofia-sip-ua/sip/run_test_date old mode 100644 new mode 100755 diff --git a/libs/sofia-sip/libsofia-sip-ua/sresolv/run_test_sresolv b/libs/sofia-sip/libsofia-sip-ua/sresolv/run_test_sresolv old mode 100644 new mode 100755 diff --git a/libs/sofia-sip/libsofia-sip-ua/su/run_addrinfo b/libs/sofia-sip/libsofia-sip-ua/su/run_addrinfo old mode 100644 new mode 100755 diff --git a/libs/sofia-sip/libsofia-sip-ua/su/run_localinfo b/libs/sofia-sip/libsofia-sip-ua/su/run_localinfo old mode 100644 new mode 100755 diff --git a/libs/sofia-sip/libsofia-sip-ua/su/run_test_su b/libs/sofia-sip/libsofia-sip-ua/su/run_test_su old mode 100644 new mode 100755 diff --git a/libs/sofia-sip/libsofia-sip-ua/su/run_test_su_osx b/libs/sofia-sip/libsofia-sip-ua/su/run_test_su_osx old mode 100644 new mode 100755 diff --git a/libs/sofia-sip/scripts/coverage b/libs/sofia-sip/scripts/coverage old mode 100644 new mode 100755 diff --git a/libs/sofia-sip/scripts/fix-include-sofia-sip b/libs/sofia-sip/scripts/fix-include-sofia-sip old mode 100644 new mode 100755 diff --git a/libs/sofia-sip/scripts/lcov-report b/libs/sofia-sip/scripts/lcov-report old mode 100644 new mode 100755 diff --git a/libs/sofia-sip/scripts/rpmbuild-snaphot b/libs/sofia-sip/scripts/rpmbuild-snaphot old mode 100644 new mode 100755 diff --git a/libs/sofia-sip/scripts/uncovered b/libs/sofia-sip/scripts/uncovered old mode 100644 new mode 100755 commit e2b85e946aade5c4debe952439bbe9b835bf5b0e Author: Michael Jerris <mike@jerris.com> Date: Sun Oct 3 05:02:58 2010 -0400 FS-287: fix bsd shell incompatibility diff --git a/Makefile.am b/Makefile.am index ad04fde..b11e3ff 100644 --- a/Makefile.am +++ b/Makefile.am @@ -367,14 +367,14 @@ src/include/switch_version.h: src/include/switch_version.h.in .version $(libfree else \ if [ -d .git ] ; then \ version=`git log --format="%h %ci" -1 HEAD | head -1 | sed -e 's|:|-|g' || echo hacked` ; \ - if [ "x$$version" == "xhacked" ] ; then \ + if [ "x$$version" = "xhacked" ] ; then \ version="hacked-`date -u +%Y%m%dT%H%M%SZ`" ; \ else \ version="git-$$version" ; \ fi ;\ else \ version=`svnversion . -n || echo hacked` ; \ - if [ "x$$version" == "xhacked" ] ; then \ + if [ "x$$version" = "xhacked" ] ; then \ version="hacked-`date -u +%Y%m%dT%H%M%SZ`" ; \ else \ version="svn-$$version" ; \ diff --git a/libs/broadvoice/configure.ac b/libs/broadvoice/configure.ac index d42ee82..ceb92a5 100644 --- a/libs/broadvoice/configure.ac +++ b/libs/broadvoice/configure.ac @@ -207,7 +207,7 @@ AC_CHECK_HEADERS([sndfile.h]) AC_LANG([C]) -if test "${build}" == "${host}" +if test "${build}" = "${host}" then case "${host}" in x86_64-*) diff --git a/libs/ilbc/configure.ac b/libs/ilbc/configure.ac index b3fda17..3dbfb24 100644 --- a/libs/ilbc/configure.ac +++ b/libs/ilbc/configure.ac @@ -175,14 +175,14 @@ AC_CHECK_HEADERS([sys/select.h]) AC_CHECK_HEADERS([sys/ioctl.h]) AC_CHECK_HEADERS([sys/fcntl.h]) AC_CHECK_HEADERS([audiofile.h]) -if test "${build}" == "${host}" +if test "${build}" = "${host}" then AC_CHECK_HEADERS([X11/X.h]) fi AC_LANG([C++]) -if test "${build}" == "${host}" +if test "${build}" = "${host}" then case "${host}" in x86_64-*) @@ -193,7 +193,7 @@ fi AC_LANG([C]) -if test "${build}" == "${host}" +if test "${build}" = "${host}" then case "${host}" in x86_64-*) diff --git a/libs/libg722_1/configure.ac b/libs/libg722_1/configure.ac index a60a69b..64e276b 100644 --- a/libs/libg722_1/configure.ac +++ b/libs/libg722_1/configure.ac @@ -190,7 +190,7 @@ AC_CHECK_HEADERS([audiofile.h]) AC_LANG([C]) -if test "${build}" == "${host}" +if test "${build}" = "${host}" then case "${host}" in x86_64-*) diff --git a/libs/spandsp/configure.ac b/libs/spandsp/configure.ac index 3aeb44f..7914885 100644 --- a/libs/spandsp/configure.ac +++ b/libs/spandsp/configure.ac @@ -207,7 +207,7 @@ AC_CHECK_HEADERS([fenv.h]) AC_CHECK_HEADERS([fftw3.h], , [AC_CHECK_HEADERS([fftw.h])]) AC_CHECK_HEADERS([pcap.h]) AC_CHECK_HEADERS([pthread.h]) -if test "${build}" == "${host}" +if test "${build}" = "${host}" then AC_CHECK_HEADERS([X11/X.h]) fi @@ -253,7 +253,7 @@ AC_CHECK_HEADERS([FL/Fl_Audio_Meter.H], [], [], [],[[#include <FL/Fl.H> AC_LANG([C]) -if test "${build}" == "${host}" +if test "${build}" = "${host}" then case "${host}" in x86_64-*) diff --git a/libs/spandsp/unpack_gsm0610_data.sh b/libs/spandsp/unpack_gsm0610_data.sh index d1f8b92..482334c 100755 --- a/libs/spandsp/unpack_gsm0610_data.sh +++ b/libs/spandsp/unpack_gsm0610_data.sh @@ -53,7 +53,7 @@ else cd gsm0610 fi -if [ $1x == --no-exe-runx ] +if [ $1x = --no-exe-runx ] then # Run the .exe files, which should be here ./FR_A.EXE @@ -77,7 +77,7 @@ rm -rf READ_FRA.TXT rm -rf ACTION rm -rf unpacked -if [ $1x == --no-exex ] +if [ $1x = --no-exex ] then # We need to prepare the .exe files to be run separately rm -rf *.INP diff --git a/libs/sqlite/configure.ac b/libs/sqlite/configure.ac index fc21161..75d6f51 100644 --- a/libs/sqlite/configure.ac +++ b/libs/sqlite/configure.ac @@ -447,7 +447,7 @@ if test "$TARGET_EXEEXT" = ".exe"; then OS_WIN=0 OS_OS2=1 TARGET_CFLAGS="$TARGET_CFLAGS -DOS_OS2=1" - if test "$ac_compiler_gnu" == "yes" ; then + if test "$ac_compiler_gnu" = "yes" ; then TARGET_CFLAGS="$TARGET_CFLAGS -Zomf -Zexe -Zmap" BUILD_CFLAGS="$BUILD_CFLAGS -Zomf -Zexe" fi commit ad0298f7f912caa5692e2ddc6503260f1a4900f8 Author: Michael Jerris <mike@jerris.com> Date: Sun Oct 3 04:59:25 2010 -0400 FS-234: add missing AM_PROG_CC_C_O to sofia configure diff --git a/libs/sofia-sip/configure.ac b/libs/sofia-sip/configure.ac index 0eb2418..196d815 100644 --- a/libs/sofia-sip/configure.ac +++ b/libs/sofia-sip/configure.ac @@ -53,6 +53,7 @@ AC_CHECK_PROG(ETAGS, etags, etags, echo) AC_CHECK_TOOL(AR, ar, ar) AC_CHECK_TOOL(LD, ld, ld) AC_PROG_LIBTOOL +AM_PROG_CC_C_O SAC_ENABLE_NDEBUG SAC_ENABLE_EXPENSIVE_CHECKS commit c569fb0f2942a3d33f1b4cf8f150f515d84b05cb Author: Michael Jerris <mike@jerris.com> Date: Sun Oct 3 04:56:35 2010 -0400 FS-1248: link to libgcrypt as well, please report any platforms this breaks, but it should be portable diff --git a/libs/iksemel/build/libgnutls.m4 b/libs/iksemel/build/libgnutls.m4 index 479d5a2..cf3fe46 100644 --- a/libs/iksemel/build/libgnutls.m4 +++ b/libs/iksemel/build/libgnutls.m4 @@ -28,11 +28,11 @@ AC_ARG_WITH(libgnutls-prefix, no_libgnutls="" if test "$LIBGNUTLS_CONFIG" != "no"; then LIBGNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --cflags` - LIBGNUTLS_LIBS="`$LIBGNUTLS_CONFIG $libgnutls_config_args --libs` -lpthread" + LIBGNUTLS_LIBS="`$LIBGNUTLS_CONFIG $libgnutls_config_args --libs` -lpthread -lgcrypt" libgnutls_config_version=`$LIBGNUTLS_CONFIG $libgnutls_config_args --version` elif test "$PKG_CONFIG" != "no"; then LIBGNUTLS_CFLAGS=`$PKG_CONFIG --cflags gnutls` - LIBGNUTLS_LIBS="`$PKG_CONFIG --libs gnutls` -lpthread" + LIBGNUTLS_LIBS="`$PKG_CONFIG --libs gnutls` -lpthread -lgcrypt" libgnutls_config_version=`$PKG_CONFIG --modversion gnutls` else no_libgnutls=yes commit f288e3c38dc26ab8c36a73ed8eaa128e0be056ea Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Fri Oct 1 23:35:51 2010 -0400 mod_callcenter: Fix a potential segv following previous commit diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index e068122..ddd2cd5 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1275,6 +1275,9 @@ static switch_status_t load_config(void) } } } + if (!globals.dbname) { + globals.dbname = strdup(CC_SQLITE_DB_NAME); + } /* Loading queue into memory struct */ if ((x_queues = switch_xml_child(cfg, "queues"))) { @@ -2683,8 +2686,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_callcenter_load) memset(&globals, 0, sizeof(globals)); globals.pool = pool; - globals.dbname = CC_SQLITE_DB_NAME; - switch_core_hash_init(&globals.queue_hash, globals.pool); switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool); commit 8bd35134615a32d27d28537190d75b0b55fd353c Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Fri Oct 1 23:01:03 2010 -0400 mod_callcenter: Add param to change the location or name of the sqlite database like to put it into a ramdisk diff --git a/conf/autoload_configs/callcenter.conf.xml b/conf/autoload_configs/callcenter.conf.xml index 1178391..9140193 100644 --- a/conf/autoload_configs/callcenter.conf.xml +++ b/conf/autoload_configs/callcenter.conf.xml @@ -1,6 +1,7 @@ <configuration name="callcenter.conf" description="CallCenter"> <settings> <!--<param name="odbc-dsn" value="dsn:user:pass"/>--> + <!--<param name="dbname" value="/dev/shm/callcenter.db"/>--> </settings> <queues> diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index b58e647..e068122 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -402,6 +402,7 @@ static struct { char *odbc_dsn; char *odbc_user; char *odbc_pass; + char *dbname; int32_t threads; int32_t running; switch_mutex_t *mutex; @@ -506,7 +507,7 @@ switch_cache_db_handle_t *cc_get_db_handle(void) dbh = NULL; return dbh; } else { - options.core_db_options.db_path = CC_SQLITE_DB_NAME; + options.core_db_options.db_path = globals.dbname; if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_CORE_DB, &options) != SWITCH_STATUS_SUCCESS) dbh = NULL; return dbh; @@ -1258,6 +1259,8 @@ static switch_status_t load_config(void) if (!strcasecmp(var, "debug")) { globals.debug = atoi(val); + } else if (!strcasecmp(var, "dbname")) { + globals.dbname = strdup(val); } else if (!strcasecmp(var, "odbc-dsn")) { globals.odbc_dsn = strdup(val); @@ -2680,6 +2683,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_callcenter_load) memset(&globals, 0, sizeof(globals)); globals.pool = pool; + globals.dbname = CC_SQLITE_DB_NAME; + switch_core_hash_init(&globals.queue_hash, globals.pool); switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool); @@ -2773,6 +2778,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_callcenter_shutdown) } switch_safe_free(globals.odbc_dsn); + switch_safe_free(globals.dbname); switch_mutex_unlock(globals.mutex); return SWITCH_STATUS_SUCCESS; commit 4aa9a83898cf6b78e564164a7411b59410afc8f7 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Oct 1 17:26:03 2010 -0500 refactor export code and add new bridge_export app which is like export but exports across when one channel bridges another diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index 3f92534..a1f13ed 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -261,10 +261,17 @@ SWITCH_DECLARE(const char *) switch_channel_get_variable_partner(switch_channel_ #define switch_channel_set_variable_partner(_channel, _var, _val) switch_channel_set_variable_partner_var_check(_channel, _var, _val, SWITCH_TRUE) -SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_var_check(switch_channel_t *channel, const char *varname, const char *value, switch_bool_t var_check); +SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_var_check(switch_channel_t *channel, + const char *varname, const char *val, + const char *export_varname, + switch_bool_t var_check); -#define switch_channel_export_variable(_channel, _varname, _value) switch_channel_export_variable_var_check(_channel, _varname, _value, SWITCH_TRUE) -SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_printf(switch_channel_t *channel, const char *varname, const char *fmt, ...); +SWITCH_DECLARE(void) switch_channel_process_export(switch_channel_t *channel, switch_channel_t *peer_channel, + switch_event_t *var_event, const char *export_varname); + +#define switch_channel_export_variable(_channel, _varname, _value, _ev) switch_channel_export_variable_var_check(_channel, _varname, _value, _ev, SWITCH_TRUE) +SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_printf(switch_channel_t *channel, const char *varname, + const char *export_varname, const char *fmt, ...); /*! diff --git a/src/include/switch_types.h b/src/include/switch_types.h index c7d7b0a..668fdc8 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -156,6 +156,7 @@ SWITCH_BEGIN_EXTERN_C #define SWITCH_ENDPOINT_DISPOSITION_VARIABLE "endpoint_disposition" #define SWITCH_HOLD_MUSIC_VARIABLE "hold_music" #define SWITCH_EXPORT_VARS_VARIABLE "export_vars" +#define SWITCH_BRIDGE_EXPORT_VARS_VARIABLE "bridge_export_vars" #define SWITCH_R_SDP_VARIABLE "switch_r_sdp" #define SWITCH_L_SDP_VARIABLE "switch_l_sdp" #define SWITCH_B_SDP_VARIABLE "switch_m_sdp" diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index dd63f8a..9fb6b1b 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -909,48 +909,42 @@ SWITCH_STANDARD_APP(set_profile_var_function) SWITCH_STANDARD_APP(export_function) { switch_channel_t *channel = switch_core_session_get_channel(session); - const char *exports; - char *new_exports = NULL, *new_exports_d = NULL, *var, *val = NULL, *var_name = NULL; - int local = 1; + char *var, *val = NULL; if (zstr(data)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No variable name specified.\n"); } else { - exports = switch_channel_get_variable(channel, SWITCH_EXPORT_VARS_VARIABLE); var = switch_core_session_strdup(session, data); - if (var) { - val = strchr(var, '='); - if (!strncasecmp(var, "nolocal:", 8)) { - var_name = var + 8; - local = 0; - } else { - var_name = var; - } - } - if (val) { + if ((val = strchr(var, '='))) { *val++ = '\0'; if (zstr(val)) { val = NULL; } } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "EXPORT %s[%s]=[%s]\n", local ? "" : "(REMOTE ONLY) ", - var_name ? var_name : "", val ? val : "UNDEF"); - switch_channel_set_variable(channel, var, val); + switch_channel_export_variable(channel, var, val, SWITCH_EXPORT_VARS_VARIABLE); + } +} - if (var && val) { - if (exports) { - new_exports_d = switch_mprintf("%s,%s", exports, var); - new_exports = new_exports_d; - } else { - new_exports = var; - } +SWITCH_STANDARD_APP(bridge_export_function) +{ + switch_channel_t *channel = switch_core_session_get_channel(session); + char *var, *val = NULL; - switch_channel_set_variable(channel, SWITCH_EXPORT_VARS_VARIABLE, new_exports); + if (zstr(data)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No variable name specified.\n"); + } else { + var = switch_core_session_strdup(session, data); - switch_safe_free(new_exports_d); + if ((val = strchr(var, '='))) { + *val++ = '\0'; + if (zstr(val)) { + val = NULL; + } } + + switch_channel_export_variable(channel, var, val, SWITCH_BRIDGE_EXPORT_VARS_VARIABLE); } } @@ -3317,6 +3311,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) SWITCH_ADD_APP(app_interface, "sound_test", "Analyze Audio", "Analyze Audio", sound_test_function, "", SAF_NONE); SWITCH_ADD_APP(app_interface, "export", "Export a channel variable across a bridge", EXPORT_LONG_DESC, export_function, "<varname>=<value>", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC); + SWITCH_ADD_APP(app_interface, "bridge_export", "Export a channel variable across a bridge", EXPORT_LONG_DESC, bridge_export_function, "<varname>=<value>", + SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC); SWITCH_ADD_APP(app_interface, "set", "Set a channel variable", SET_LONG_DESC, set_function, "<varname>=<value>", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC); SWITCH_ADD_APP(app_interface, "set_global", "Set a global variable", SET_GLOBAL_LONG_DESC, set_global_function, "<varname>=<value>", diff --git a/src/switch_channel.c b/src/switch_channel.c index ece3fa2..81baa2f 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -847,29 +847,109 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_profile_var(switch_channel_t return status; } -SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_var_check(switch_channel_t *channel, const char *varname, const char *value, switch_bool_t var_check) + +SWITCH_DECLARE(void) switch_channel_process_export(switch_channel_t *channel, switch_channel_t *peer_channel, + switch_event_t *var_event, const char *export_varname) { - const char *exports; - switch_status_t status = SWITCH_STATUS_FALSE; - exports = switch_channel_get_variable(channel, SWITCH_EXPORT_VARS_VARIABLE); + const char *export_vars = switch_channel_get_variable(channel, export_varname); + char *cptmp = switch_core_session_strdup(channel->session, export_vars); + int argc; + char *argv[256]; + + if (zstr(export_vars)) return; + + + if (var_event) { + switch_event_del_header(var_event, export_varname); + switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, export_varname, export_vars); + } + + if (peer_channel) { + switch_channel_set_variable(peer_channel, export_varname, export_vars); + } + + if ((argc = switch_separate_string(cptmp, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) { + int x; - if ((status = switch_channel_set_variable_var_check(channel, varname, value, var_check)) != SWITCH_STATUS_SUCCESS) { - return status; + for (x = 0; x < argc; x++) { + const char *vval; + if ((vval = switch_channel_get_variable(channel, argv[x]))) { + char *vvar = argv[x]; + if (!strncasecmp(vvar, "nolocal:", 8)) { + vvar += 8; + } + if (var_event) { + switch_event_del_header(var_event, vvar); + switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, vvar, vval); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(channel->session), SWITCH_LOG_DEBUG, + "%s EXPORTING[%s] [%s]=[%s] to event\n", + switch_channel_get_name(channel), + export_varname, + vvar, vval); + } + if (peer_channel) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(channel->session), SWITCH_LOG_DEBUG, + "%s EXPORTING[%s] [%s]=[%s] to %s\n", + switch_channel_get_name(channel), + export_varname, + vvar, vval, switch_channel_get_name(peer_channel)); + switch_channel_set_variable(peer_channel, vvar, vval); + } + } + } } - if (varname && value) { + +} + +SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_var_check(switch_channel_t *channel, + const char *varname, const char *val, + const char *export_varname, switch_bool_t var_check) +{ + char *var_name = NULL; + const char *exports; + char *var, *new_exports, *new_exports_d = NULL; + int local = 1; + + exports = switch_channel_get_variable(channel, export_varname); + + var = switch_core_session_strdup(channel->session, varname); + + if (var) { + if (!strncasecmp(var, "nolocal:", 8)) { + var_name = var + 8; + local = 0; + } else { + var_name = var; + } + } + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(channel->session), SWITCH_LOG_DEBUG, "EXPORT (%s) %s[%s]=[%s]\n", + export_varname, local ? "" : "(REMOTE ONLY) ", + var_name ? var_name : "", val ? val : "UNDEF"); + + + switch_channel_set_variable_var_check(channel, var, val, var_check); + + if (var && val) { if (exports) { - switch_channel_set_variable_printf(channel, SWITCH_EXPORT_VARS_VARIABLE, "%s,%s", exports, varname); + new_exports_d = switch_mprintf("%s,%s", exports, var); + new_exports = new_exports_d; } else { - switch_channel_set_variable(channel, SWITCH_EXPORT_VARS_VARIABLE, varname); + new_exports = var; } + + switch_channel_set_variable(channel, export_varname, new_exports); + + switch_safe_free(new_exports_d); } - return status; + return SWITCH_STATUS_SUCCESS; } -SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_printf(switch_channel_t *channel, const char *varname, const char *fmt, ...) +SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_printf(switch_channel_t *channel, const char *varname, + const char *export_varname, const char *fmt, ...) { switch_status_t status = SWITCH_STATUS_FALSE; char *data = NULL; @@ -886,7 +966,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_export_variable_printf(switch_cha return SWITCH_STATUS_FALSE; } - status = switch_channel_export_variable(channel, varname, data); + status = switch_channel_export_variable(channel, varname, export_varname, data); free(data); @@ -902,6 +982,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_var_check(switch_cha switch_mutex_lock(channel->profile_mutex); if (channel->variables && !zstr(varname)) { + switch_event_del_header(channel->variables, varname); if (!zstr(value)) { int ok = 1; @@ -3016,7 +3097,7 @@ SWITCH_DECLARE(char *) switch_channel_build_param_string(switch_channel_t *chann new_len = (strlen(prof[x]) * 3) + 1; if (encode_len < new_len) { char *tmp; - + encode_len = new_len; if (!(tmp = realloc(encode_buf, encode_len))) { diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index b317cef..f92e254 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -963,6 +963,12 @@ static const switch_state_handler_table_t signal_bridge_state_handlers = { /*.on_hibernate */ signal_bridge_on_hibernate }; +static void check_bridge_export(switch_channel_t *channel, switch_channel_t *peer_channel) +{ + switch_channel_process_export(peer_channel, channel, NULL, SWITCH_BRIDGE_EXPORT_VARS_VARIABLE); + switch_channel_process_export(channel, peer_channel, NULL, SWITCH_BRIDGE_EXPORT_VARS_VARIABLE); +} + SWITCH_DECLARE(switch_status_t) switch_ivr_signal_bridge(switch_core_session_t *session, switch_core_session_t *peer_session) { switch_channel_t *caller_channel = switch_core_session_get_channel(session); @@ -979,6 +985,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_signal_bridge(switch_core_session_t * return SWITCH_STATUS_FALSE; } + check_bridge_export(caller_channel, peer_channel); + switch_channel_set_flag_recursive(caller_channel, CF_SIGNAL_BRIDGE_TTL); switch_channel_set_flag_recursive(peer_channel, CF_SIGNAL_BRIDGE_TTL); @@ -1054,7 +1062,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses return switch_ivr_signal_bridge(session, peer_session); } - + check_bridge_export(caller_channel, peer_channel); + switch_channel_set_flag_recursive(caller_channel, CF_MEDIA_BRIDGE_TTL); switch_channel_set_flag_recursive(peer_channel, CF_MEDIA_BRIDGE_TTL); diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 1cbd2b9..0b5ab77 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -1328,7 +1328,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess int var_block_count = 0; char *e = NULL; switch_event_t *var_event = NULL; - const char *export_vars = NULL; switch_core_new_memory_pool(&pool); @@ -1395,33 +1394,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess } switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "ent_originate_aleg_uuid", switch_core_session_get_uuid(session)); - - /* A comma (,) separated list of variable names that should ne propagated from originator to originatee */ - if (channel && (export_vars = switch_channel_get_variable(channel, SWITCH_EXPORT_VARS_VARIABLE))) { - char *cptmp = switch_core_session_strdup(session, export_vars); - int argc; - char *argv[256]; - - switch_event_del_header(var_event, SWITCH_EXPORT_VARS_VARIABLE); - switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, SWITCH_EXPORT_VARS_VARIABLE, export_vars); - if ((argc = switch_separate_string(cptmp, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) { - int x; - - for (x = 0; x < argc; x++) { - const char *vval; - if ((vval = switch_channel_get_variable(channel, argv[x]))) { - char *vvar = argv[x]; - if (!strncasecmp(vvar, "nolocal:", 8)) { - vvar += 8; - } - switch_event_del_header(var_event, vvar); - switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, vvar, vval); - } - } - } + if (channel) { + switch_channel_process_export(channel, NULL, var_event, SWITCH_EXPORT_VARS_VARIABLE); } - + if (vars) { /* Parse parameters specified from the dialstring */ char *var_array[1024] = { 0 }; int var_count = 0; @@ -1756,7 +1733,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess const char *cancel_key = NULL; const char *holding = NULL; const char *soft_holding = NULL; - const char *export_vars = NULL; early_state_t early_state = { 0 }; int read_packet = 0; @@ -1945,27 +1921,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } } - /* A comma (,) separated list of variable names that should ne propagated from originator to originatee */ - if (caller_channel && (export_vars = switch_channel_get_variable(caller_channel, SWITCH_EXPORT_VARS_VARIABLE))) { - char *cptmp = switch_core_session_strdup(session, export_vars); - int argc; - char *argv[256]; - - if ((argc = switch_separate_string(cptmp, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) { - int x; - - for (x = 0; x < argc; x++) { - const char *vval; - if ((vval = switch_channel_get_variable(caller_channel, argv[x]))) { - char *vvar = argv[x]; - if (!strncasecmp(vvar, "nolocal:", 8)) { - vvar += 8; - } - switch_event_del_header(var_event, vvar); - switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, vvar, vval); - } - } - } + if (caller_channel) { + switch_channel_process_export(caller_channel, NULL, var_event, SWITCH_EXPORT_VARS_VARIABLE); } if (vars) { /* Parse parameters specified from the dialstring */ commit ecf4e9abcc221dac4a9c6307c63819dbcdb1a22f Author: Jeff Lenk <jeff@jefflenk.com> Date: Fri Oct 1 15:20:40 2010 -0500 Part of FS-2742 diff --git a/conf/lang/en/dir/sounds.xml b/conf/lang/en/dir/sounds.xml index a1bbf91..2bdc149 100644 --- a/conf/lang/en/dir/sounds.xml +++ b/conf/lang/en/dir/sounds.xml @@ -43,7 +43,7 @@ <macro name="directory_result_count"> <input pattern="^0$" break_on_match="true"> <match> - <action function="play-file" data="directory/dir-no_match_entry.wav"/> + <action function="play-file" data="directory/dir-no_matching_results.wav"/> </match> </input> <input pattern="^(.*)$"> commit 6741f3502837d8a5fd1204afea7bb74e3e757774 Author: Jeff Lenk <jeff@jefflenk.com> Date: Fri Oct 1 14:36:42 2010 -0500 Part of FS-2742 lang/en/dir/sounds.xml & sound file mismatch Still need missing files diff --git a/conf/lang/en/dir/sounds.xml b/conf/lang/en/dir/sounds.xml index 02d6b36..a1bbf91 100644 --- a/conf/lang/en/dir/sounds.xml +++ b/conf/lang/en/dir/sounds.xml @@ -2,13 +2,13 @@ <macro name="directory_intro"> <input pattern="^(last_name)" break_on_match="false"> <match> - <action function="play-file" data="directory/dir-enter-person.wav"/> + <action function="play-file" data="directory/dir-enter_person.wav"/> <action function="play-file" data="directory/dir-last_name.wav"/> </match> </input> <input pattern="^(first_name)" break_on_match="false"> <match> - <action function="play-file" data="directory/dir-enter-person.wav"/> + <action function="play-file" data="directory/dir-enter_person.wav"/> <action function="play-file" data="directory/dir-first_name.wav"/> </match> </input> @@ -33,7 +33,7 @@ <macro name="directory_min_search_digits"> <input pattern="^(.*)$"> <match> - <action function="play-file" data="directory/dir-specify_mininum_first.wav"/> + <action function="play-file" data="directory/dir-specify_mininum.wav"/> <action function="say" data="$1" method="pronounced" type="items"/> <action function="play-file" data="directory/dir-letters_of_person_name.wav"/> </match> @@ -57,7 +57,7 @@ <macro name="directory_result_count_too_large"> <input pattern="^(.*)$"> <match> - <action function="play-file" data="directory/dir-to_many_result.wav"/> + <action function="play-file" data="directory/dir-too_many_result.wav"/> </match> </input> @@ -66,7 +66,7 @@ <macro name="directory_result_last"> <input pattern="^(.*)$"> <match> - <action function="play-file" data="directory/dir-no_more_result.wav"/> + <action function="play-file" data="directory/dir-no_more_results.wav"/> </match> </input> @@ -102,7 +102,7 @@ <action function="play-file" data="directory/dir-for_prev.wav"/> <action function="play-file" data="directory/dir-press.wav"/> <action function="say" data="$3" method="pronounced" type="name_spelled"/> - <action function="play-file" data="directory/dir-to_make_new_search.wav"/> + <action function="play-file" data="directory/dir-start_new_search.wav"/> <action function="play-file" data="directory/dir-press.wav"/> <action function="say" data="$4" method="pronounced" type="name_spelled"/> diff --git a/libs/win32/Sound_Files/16khz.2008.vcproj b/libs/win32/Sound_Files/16khz.2008.vcproj index 994b21e..d8f80bb 100644 --- a/libs/win32/Sound_Files/16khz.2008.vcproj +++ b/libs/win32/Sound_Files/16khz.2008.vcproj @@ -33,7 +33,7 @@ /> <Tool Name="VCPostBuildEventTool" - CommandLine="xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\16000\*.*" "$(OutDir)\sounds\en\us\callie\voicemail\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\16000\*.*" "$(OutDir)\sounds\en\us\callie\ivr\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\16000\*.*" "$(OutDir)\sounds\en\us\callie\conference\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\16000\*.*" "$(OutDir)\sounds\en\us\callie\time\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\16000\*.*" "$(OutDir)\sounds\en\us\callie\digits\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\16000\*.*" "$(OutDir)\sounds\en\us\callie\ascii\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\16000\*.*" "$(OutDir)\sounds\en\us\callie\misc\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\16000\*.*" "$(OutDir)\sounds\en\us\callie\currency\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\16000\*.*" "$(OutDir)\sounds\en\us\callie\phonetic-ascii\16000" /C /D /Y /S /I " + CommandLine="xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\16000\*.*" "$(OutDir)\sounds\en\us\callie\voicemail\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\16000\*.*" "$(OutDir)\sounds\en\us\callie\ivr\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\16000\*.*" "$(OutDir)\sounds\en\us\callie\conference\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\16000\*.*" "$(OutDir)\sounds\en\us\callie\time\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\16000\*.*" "$(OutDir)\sounds\en\us\callie\digits\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\16000\*.*" "$(OutDir)\sounds\en\us\callie\ascii\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\16000\*.*" "$(OutDir)\sounds\en\us\callie\misc\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\16000\*.*" "$(OutDir)\sounds\en\us\callie\currency\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\16000\*.*" "$(OutDir)\sounds\en\us\callie\phonetic-ascii\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\16000\*.*" "$(OutDir)\sounds\en\us\callie\directory\16000" /C /D /Y /S /I" /> </Configuration> <Configuration @@ -55,7 +55,7 @@ /> <Tool Name="VCPostBuildEventTool" - CommandLine="xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\16000\*.*" "$(OutDir)\sounds\en\us\callie\voicemail\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\16000\*.*" "$(OutDir)\sounds\en\us\callie\ivr\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\16000\*.*" "$(OutDir)\sounds\en\us\callie\conference\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\16000\*.*" "$(OutDir)\sounds\en\us\callie\time\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\16000\*.*" "$(OutDir)\sounds\en\us\callie\digits\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\16000\*.*" "$(OutDir)\sounds\en\us\callie\ascii\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\16000\*.*" "$(OutDir)\sounds\en\us\callie\misc\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\16000\*.*" "$(OutDir)\sounds\en\us\callie\currency\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\16000\*.*" "$(OutDir)\sounds\en\us\callie\phonetic-ascii\16000" /C /D /Y /S /I " + CommandLine="xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\16000\*.*" "$(OutDir)\sounds\en\us\callie\voicemail\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\16000\*.*" "$(OutDir)\sounds\en\us\callie\ivr\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\16000\*.*" "$(OutDir)\sounds\en\us\callie\conference\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\16000\*.*" "$(OutDir)\sounds\en\us\callie\time\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\16000\*.*" "$(OutDir)\sounds\en\us\callie\digits\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\16000\*.*" "$(OutDir)\sounds\en\us\callie\ascii\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\16000\*.*" "$(OutDir)\sounds\en\us\callie\misc\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\16000\*.*" "$(OutDir)\sounds\en\us\callie\currency\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\16000\*.*" "$(OutDir)\sounds\en\us\callie\phonetic-ascii\16000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\16000\*.*" "$(OutDir)\sounds\en\us\callie\directory\16000" /C /D /Y /S /I" /> </Configuration> </Configurations> diff --git a/libs/win32/Sound_Files/16khz.2010.vcxproj b/libs/win32/Sound_Files/16khz.2010.vcxproj index 2d11a52..b34ab64 100644 --- a/libs/win32/Sound_Files/16khz.2010.vcxproj +++ b/libs/win32/Sound_Files/16khz.2010.vcxproj @@ -67,58 +67,66 @@ </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PostBuildEvent> - <Command>xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\16000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\16000\*.*" "$(OutDir)sounds\en\us\callie\ivr\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\16000\*.*" "$(OutDir)sounds\en\us\callie\conference\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\16000\*.*" "$(OutDir)sounds\en\us\callie\time\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\16000\*.*" "$(OutDir)sounds\en\us\callie\digits\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\ascii\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\16000\*.*" "$(OutDir)sounds\en\us\callie\misc\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\16000\*.*" "$(OutDir)sounds\en\us\callie\currency\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\16000" /C /D /Y /S /I -</Command> + <Command> + xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\16000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\16000\*.*" "$(OutDir)sounds\en\us\callie\ivr\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\16000\*.*" "$(OutDir)sounds\en\us\callie\conference\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\16000\*.*" "$(OutDir)sounds\en\us\callie\time\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\16000\*.*" "$(OutDir)sounds\en\us\callie\digits\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\ascii\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\16000\*.*" "$(OutDir)sounds\en\us\callie\misc\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\16000\*.*" "$(OutDir)sounds\en\us\callie\currency\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\16000\*.*" "$(OutDir)sounds\en\us\callie\directory\16000" /C /D /Y /S /I + </Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PostBuildEvent> - <Command>xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\16000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\16000\*.*" "$(OutDir)sounds\en\us\callie\ivr\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\16000\*.*" "$(OutDir)sounds\en\us\callie\conference\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\16000\*.*" "$(OutDir)sounds\en\us\callie\time\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\16000\*.*" "$(OutDir)sounds\en\us\callie\digits\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\ascii\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\16000\*.*" "$(OutDir)sounds\en\us\callie\misc\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\16000\*.*" "$(OutDir)sounds\en\us\callie\currency\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\16000" /C /D /Y /S /I -</Command> + <Command> + xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\16000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\16000\*.*" "$(OutDir)sounds\en\us\callie\ivr\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\16000\*.*" "$(OutDir)sounds\en\us\callie\conference\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\16000\*.*" "$(OutDir)sounds\en\us\callie\time\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\16000\*.*" "$(OutDir)sounds\en\us\callie\digits\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\ascii\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\16000\*.*" "$(OutDir)sounds\en\us\callie\misc\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\16000\*.*" "$(OutDir)sounds\en\us\callie\currency\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\16000\*.*" "$(OutDir)sounds\en\us\callie\directory\16000" /C /D /Y /S /I + </Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PostBuildEvent> - <Command>xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\16000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\16000\*.*" "$(OutDir)sounds\en\us\callie\ivr\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\16000\*.*" "$(OutDir)sounds\en\us\callie\conference\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\16000\*.*" "$(OutDir)sounds\en\us\callie\time\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\16000\*.*" "$(OutDir)sounds\en\us\callie\digits\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\ascii\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\16000\*.*" "$(OutDir)sounds\en\us\callie\misc\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\16000\*.*" "$(OutDir)sounds\en\us\callie\currency\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\16000" /C /D /Y /S /I -</Command> + <Command> + xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\16000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\16000\*.*" "$(OutDir)sounds\en\us\callie\ivr\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\16000\*.*" "$(OutDir)sounds\en\us\callie\conference\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\16000\*.*" "$(OutDir)sounds\en\us\callie\time\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\16000\*.*" "$(OutDir)sounds\en\us\callie\digits\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\ascii\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\16000\*.*" "$(OutDir)sounds\en\us\callie\misc\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\16000\*.*" "$(OutDir)sounds\en\us\callie\currency\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\16000\*.*" "$(OutDir)sounds\en\us\callie\directory\16000" /C /D /Y /S /I + </Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PostBuildEvent> - <Command>xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\16000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\16000\*.*" "$(OutDir)sounds\en\us\callie\ivr\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\16000\*.*" "$(OutDir)sounds\en\us\callie\conference\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\16000\*.*" "$(OutDir)sounds\en\us\callie\time\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\16000\*.*" "$(OutDir)sounds\en\us\callie\digits\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\ascii\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\16000\*.*" "$(OutDir)sounds\en\us\callie\misc\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\16000\*.*" "$(OutDir)sounds\en\us\callie\currency\16000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\16000" /C /D /Y /S /I -</Command> + <Command> + xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\16000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\16000\*.*" "$(OutDir)sounds\en\us\callie\ivr\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\16000\*.*" "$(OutDir)sounds\en\us\callie\conference\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\16000\*.*" "$(OutDir)sounds\en\us\callie\time\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\16000\*.*" "$(OutDir)sounds\en\us\callie\digits\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\ascii\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\16000\*.*" "$(OutDir)sounds\en\us\callie\misc\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\16000\*.*" "$(OutDir)sounds\en\us\callie\currency\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\16000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\16000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\16000\*.*" "$(OutDir)sounds\en\us\callie\directory\16000" /C /D /Y /S /I + </Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemGroup> diff --git a/libs/win32/Sound_Files/32khz.2008.vcproj b/libs/win32/Sound_Files/32khz.2008.vcproj index e735a0c..d2ac0af 100644 --- a/libs/win32/Sound_Files/32khz.2008.vcproj +++ b/libs/win32/Sound_Files/32khz.2008.vcproj @@ -33,7 +33,7 @@ /> <Tool Name="VCPostBuildEventTool" - CommandLine="xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\32000\*.*" "$(OutDir)\sounds\en\us\callie\voicemail\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\32000\*.*" "$(OutDir)\sounds\en\us\callie\ivr\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\32000\*.*" "$(OutDir)\sounds\en\us\callie\conference\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\32000\*.*" "$(OutDir)\sounds\en\us\callie\time\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\32000\*.*" "$(OutDir)\sounds\en\us\callie\digits\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\32000\*.*" "$(OutDir)\sounds\en\us\callie\ascii\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\32000\*.*" "$(OutDir)\sounds\en\us\callie\misc\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\32000\*.*" "$(OutDir)\sounds\en\us\callie\currency\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\32000\*.*" "$(OutDir)\sounds\en\us\callie\phonetic-ascii\32000" /C /D /Y /S /I " + CommandLine="xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\32000\*.*" "$(OutDir)\sounds\en\us\callie\voicemail\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\32000\*.*" "$(OutDir)\sounds\en\us\callie\ivr\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\32000\*.*" "$(OutDir)\sounds\en\us\callie\conference\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\32000\*.*" "$(OutDir)\sounds\en\us\callie\time\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\32000\*.*" "$(OutDir)\sounds\en\us\callie\digits\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\32000\*.*" "$(OutDir)\sounds\en\us\callie\ascii\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\32000\*.*" "$(OutDir)\sounds\en\us\callie\misc\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\32000\*.*" "$(OutDir)\sounds\en\us\callie\currency\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\32000\*.*" "$(OutDir)\sounds\en\us\callie\phonetic-ascii\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\32000\*.*" "$(OutDir)\sounds\en\us\callie\directory\32000" /C /D /Y /S /I" /> </Configuration> <Configuration @@ -55,7 +55,7 @@ /> <Tool Name="VCPostBuildEventTool" - CommandLine="xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\32000\*.*" "$(OutDir)\sounds\en\us\callie\voicemail\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\32000\*.*" "$(OutDir)\sounds\en\us\callie\ivr\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\32000\*.*" "$(OutDir)\sounds\en\us\callie\conference\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\32000\*.*" "$(OutDir)\sounds\en\us\callie\time\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\32000\*.*" "$(OutDir)\sounds\en\us\callie\digits\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\32000\*.*" "$(OutDir)\sounds\en\us\callie\ascii\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\32000\*.*" "$(OutDir)\sounds\en\us\callie\misc\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\32000\*.*" "$(OutDir)\sounds\en\us\callie\currency\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\32000\*.*" "$(OutDir)\sounds\en\us\callie\phonetic-ascii\32000" /C /D /Y /S /I " + CommandLine="xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\32000\*.*" "$(OutDir)\sounds\en\us\callie\voicemail\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\32000\*.*" "$(OutDir)\sounds\en\us\callie\ivr\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\32000\*.*" "$(OutDir)\sounds\en\us\callie\conference\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\32000\*.*" "$(OutDir)\sounds\en\us\callie\time\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\32000\*.*" "$(OutDir)\sounds\en\us\callie\digits\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\32000\*.*" "$(OutDir)\sounds\en\us\callie\ascii\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\32000\*.*" "$(OutDir)\sounds\en\us\callie\misc\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\32000\*.*" "$(OutDir)\sounds\en\us\callie\currency\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\32000\*.*" "$(OutDir)\sounds\en\us\callie\phonetic-ascii\32000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\32000\*.*" "$(OutDir)\sounds\en\us\callie\directory\32000" /C /D /Y /S /I" /> </Configuration> </Configurations> diff --git a/libs/win32/Sound_Files/32khz.2010.vcxproj b/libs/win32/Sound_Files/32khz.2010.vcxproj index 32651e4..35e947d 100644 --- a/libs/win32/Sound_Files/32khz.2010.vcxproj +++ b/libs/win32/Sound_Files/32khz.2010.vcxproj @@ -67,58 +67,66 @@ </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PostBuildEvent> - <Command>xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\32000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\32000\*.*" "$(OutDir)sounds\en\us\callie\ivr\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\32000\*.*" "$(OutDir)sounds\en\us\callie\conference\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\32000\*.*" "$(OutDir)sounds\en\us\callie\time\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\32000\*.*" "$(OutDir)sounds\en\us\callie\digits\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\ascii\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\32000\*.*" "$(OutDir)sounds\en\us\callie\misc\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\32000\*.*" "$(OutDir)sounds\en\us\callie\currency\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\32000" /C /D /Y /S /I -</Command> + <Command> + xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\32000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\32000\*.*" "$(OutDir)sounds\en\us\callie\ivr\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\32000\*.*" "$(OutDir)sounds\en\us\callie\conference\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\32000\*.*" "$(OutDir)sounds\en\us\callie\time\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\32000\*.*" "$(OutDir)sounds\en\us\callie\digits\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\ascii\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\32000\*.*" "$(OutDir)sounds\en\us\callie\misc\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\32000\*.*" "$(OutDir)sounds\en\us\callie\currency\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\32000\*.*" "$(OutDir)sounds\en\us\callie\directory\32000" /C /D /Y /S /I + </Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PostBuildEvent> - <Command>xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\32000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\32000\*.*" "$(OutDir)sounds\en\us\callie\ivr\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\32000\*.*" "$(OutDir)sounds\en\us\callie\conference\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\32000\*.*" "$(OutDir)sounds\en\us\callie\time\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\32000\*.*" "$(OutDir)sounds\en\us\callie\digits\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\ascii\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\32000\*.*" "$(OutDir)sounds\en\us\callie\misc\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\32000\*.*" "$(OutDir)sounds\en\us\callie\currency\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\32000" /C /D /Y /S /I -</Command> + <Command> + xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\32000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\32000\*.*" "$(OutDir)sounds\en\us\callie\ivr\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\32000\*.*" "$(OutDir)sounds\en\us\callie\conference\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\32000\*.*" "$(OutDir)sounds\en\us\callie\time\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\32000\*.*" "$(OutDir)sounds\en\us\callie\digits\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\ascii\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\32000\*.*" "$(OutDir)sounds\en\us\callie\misc\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\32000\*.*" "$(OutDir)sounds\en\us\callie\currency\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\32000\*.*" "$(OutDir)sounds\en\us\callie\directory\32000" /C /D /Y /S /I + </Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PostBuildEvent> - <Command>xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\32000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\32000\*.*" "$(OutDir)sounds\en\us\callie\ivr\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\32000\*.*" "$(OutDir)sounds\en\us\callie\conference\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\32000\*.*" "$(OutDir)sounds\en\us\callie\time\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\32000\*.*" "$(OutDir)sounds\en\us\callie\digits\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\ascii\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\32000\*.*" "$(OutDir)sounds\en\us\callie\misc\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\32000\*.*" "$(OutDir)sounds\en\us\callie\currency\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\32000" /C /D /Y /S /I -</Command> + <Command> + xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\32000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\32000\*.*" "$(OutDir)sounds\en\us\callie\ivr\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\32000\*.*" "$(OutDir)sounds\en\us\callie\conference\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\32000\*.*" "$(OutDir)sounds\en\us\callie\time\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\32000\*.*" "$(OutDir)sounds\en\us\callie\digits\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\ascii\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\32000\*.*" "$(OutDir)sounds\en\us\callie\misc\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\32000\*.*" "$(OutDir)sounds\en\us\callie\currency\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\32000\*.*" "$(OutDir)sounds\en\us\callie\directory\32000" /C /D /Y /S /I + </Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PostBuildEvent> - <Command>xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\32000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\32000\*.*" "$(OutDir)sounds\en\us\callie\ivr\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\32000\*.*" "$(OutDir)sounds\en\us\callie\conference\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\32000\*.*" "$(OutDir)sounds\en\us\callie\time\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\32000\*.*" "$(OutDir)sounds\en\us\callie\digits\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\ascii\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\32000\*.*" "$(OutDir)sounds\en\us\callie\misc\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\32000\*.*" "$(OutDir)sounds\en\us\callie\currency\32000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\32000" /C /D /Y /S /I -</Command> + <Command> + xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\32000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\32000\*.*" "$(OutDir)sounds\en\us\callie\ivr\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\32000\*.*" "$(OutDir)sounds\en\us\callie\conference\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\32000\*.*" "$(OutDir)sounds\en\us\callie\time\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\32000\*.*" "$(OutDir)sounds\en\us\callie\digits\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\ascii\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\32000\*.*" "$(OutDir)sounds\en\us\callie\misc\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\32000\*.*" "$(OutDir)sounds\en\us\callie\currency\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\32000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\32000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\32000\*.*" "$(OutDir)sounds\en\us\callie\directory\32000" /C /D /Y /S /I + </Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemGroup> diff --git a/libs/win32/Sound_Files/8khz.2008.vcproj b/libs/win32/Sound_Files/8khz.2008.vcproj index aed0a1f..413c47d 100644 --- a/libs/win32/Sound_Files/8khz.2008.vcproj +++ b/libs/win32/Sound_Files/8khz.2008.vcproj @@ -33,7 +33,7 @@ /> <Tool Name="VCPostBuildEventTool" - CommandLine="xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\8000\*.*" "$(OutDir)\sounds\en\us\callie\voicemail\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\8000\*.*" "$(OutDir)\sounds\en\us\callie\ivr\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\8000\*.*" "$(OutDir)\sounds\en\us\callie\conference\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\8000\*.*" "$(OutDir)\sounds\en\us\callie\time\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\8000\*.*" "$(OutDir)\sounds\en\us\callie\digits\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\8000\*.*" "$(OutDir)\sounds\en\us\callie\ascii\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\8000\*.*" "$(OutDir)\sounds\en\us\callie\misc\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\8000\*.*" "$(OutDir)\sounds\en\us\callie\currency\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\8000\*.*" "$(OutDir)\sounds\en\us\callie\phonetic-ascii\8000" /C /D /Y /S /I " + CommandLine="xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\8000\*.*" "$(OutDir)\sounds\en\us\callie\voicemail\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\8000\*.*" "$(OutDir)\sounds\en\us\callie\ivr\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\8000\*.*" "$(OutDir)\sounds\en\us\callie\conference\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\8000\*.*" "$(OutDir)\sounds\en\us\callie\time\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\8000\*.*" "$(OutDir)\sounds\en\us\callie\digits\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\8000\*.*" "$(OutDir)\sounds\en\us\callie\ascii\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\8000\*.*" "$(OutDir)\sounds\en\us\callie\misc\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\8000\*.*" "$(OutDir)\sounds\en\us\callie\currency\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\8000\*.*" "$(OutDir)\sounds\en\us\callie\phonetic-ascii\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\8000\*.*" "$(OutDir)\sounds\en\us\callie\directory\8000" /C /D /Y /S /I" /> </Configuration> <Configuration @@ -55,7 +55,7 @@ /> <Tool Name="VCPostBuildEventTool" - CommandLine="xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\8000\*.*" "$(OutDir)\sounds\en\us\callie\voicemail\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\8000\*.*" "$(OutDir)\sounds\en\us\callie\ivr\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\8000\*.*" "$(OutDir)\sounds\en\us\callie\conference\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\8000\*.*" "$(OutDir)\sounds\en\us\callie\time\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\8000\*.*" "$(OutDir)\sounds\en\us\callie\digits\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\8000\*.*" "$(OutDir)\sounds\en\us\callie\ascii\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\8000\*.*" "$(OutDir)\sounds\en\us\callie\misc\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\8000\*.*" "$(OutDir)\sounds\en\us\callie\currency\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\8000\*.*" "$(OutDir)\sounds\en\us\callie\phonetic-ascii\8000" /C /D /Y /S /I " + CommandLine="xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\8000\*.*" "$(OutDir)\sounds\en\us\callie\voicemail\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\8000\*.*" "$(OutDir)\sounds\en\us\callie\ivr\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\8000\*.*" "$(OutDir)\sounds\en\us\callie\conference\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\8000\*.*" "$(OutDir)\sounds\en\us\callie\time\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\8000\*.*" "$(OutDir)\sounds\en\us\callie\digits\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\8000\*.*" "$(OutDir)\sounds\en\us\callie\ascii\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\8000\*.*" "$(OutDir)\sounds\en\us\callie\misc\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\8000\*.*" "$(OutDir)\sounds\en\us\callie\currency\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\8000\*.*" "$(OutDir)\sounds\en\us\callie\phonetic-ascii\8000" /C /D /Y /S /I xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\8000\*.*" "$(OutDir)\sounds\en\us\callie\directory\8000" /C /D /Y /S /I" /> </Configuration> </Configurations> diff --git a/libs/win32/Sound_Files/8khz.2010.vcxproj b/libs/win32/Sound_Files/8khz.2010.vcxproj index 1535b2c..5fad0bd 100644 --- a/libs/win32/Sound_Files/8khz.2010.vcxproj +++ b/libs/win32/Sound_Files/8khz.2010.vcxproj @@ -67,58 +67,66 @@ </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PostBuildEvent> - <Command>xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\8000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\8000\*.*" "$(OutDir)sounds\en\us\callie\ivr\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\8000\*.*" "$(OutDir)sounds\en\us\callie\conference\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\8000\*.*" "$(OutDir)sounds\en\us\callie\time\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\8000\*.*" "$(OutDir)sounds\en\us\callie\digits\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\ascii\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\8000\*.*" "$(OutDir)sounds\en\us\callie\misc\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\8000\*.*" "$(OutDir)sounds\en\us\callie\currency\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\8000" /C /D /Y /S /I -</Command> + <Command> + xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\8000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\8000\*.*" "$(OutDir)sounds\en\us\callie\ivr\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\8000\*.*" "$(OutDir)sounds\en\us\callie\conference\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\8000\*.*" "$(OutDir)sounds\en\us\callie\time\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\8000\*.*" "$(OutDir)sounds\en\us\callie\digits\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\ascii\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\8000\*.*" "$(OutDir)sounds\en\us\callie\misc\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\8000\*.*" "$(OutDir)sounds\en\us\callie\currency\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\8000\*.*" "$(OutDir)sounds\en\us\callie\directory\8000" /C /D /Y /S /I + </Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PostBuildEvent> - <Command>xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\8000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\8000\*.*" "$(OutDir)sounds\en\us\callie\ivr\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\8000\*.*" "$(OutDir)sounds\en\us\callie\conference\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\8000\*.*" "$(OutDir)sounds\en\us\callie\time\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\8000\*.*" "$(OutDir)sounds\en\us\callie\digits\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\ascii\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\8000\*.*" "$(OutDir)sounds\en\us\callie\misc\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\8000\*.*" "$(OutDir)sounds\en\us\callie\currency\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\8000" /C /D /Y /S /I -</Command> + <Command> + xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\8000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\8000\*.*" "$(OutDir)sounds\en\us\callie\ivr\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\8000\*.*" "$(OutDir)sounds\en\us\callie\conference\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\8000\*.*" "$(OutDir)sounds\en\us\callie\time\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\8000\*.*" "$(OutDir)sounds\en\us\callie\digits\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\ascii\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\8000\*.*" "$(OutDir)sounds\en\us\callie\misc\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\8000\*.*" "$(OutDir)sounds\en\us\callie\currency\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\8000\*.*" "$(OutDir)sounds\en\us\callie\directory\8000" /C /D /Y /S /I + </Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PostBuildEvent> - <Command>xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\8000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\8000\*.*" "$(OutDir)sounds\en\us\callie\ivr\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\8000\*.*" "$(OutDir)sounds\en\us\callie\conference\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\8000\*.*" "$(OutDir)sounds\en\us\callie\time\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\8000\*.*" "$(OutDir)sounds\en\us\callie\digits\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\ascii\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\8000\*.*" "$(OutDir)sounds\en\us\callie\misc\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\8000\*.*" "$(OutDir)sounds\en\us\callie\currency\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\8000" /C /D /Y /S /I -</Command> + <Command> + xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\8000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\8000\*.*" "$(OutDir)sounds\en\us\callie\ivr\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\8000\*.*" "$(OutDir)sounds\en\us\callie\conference\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\8000\*.*" "$(OutDir)sounds\en\us\callie\time\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\8000\*.*" "$(OutDir)sounds\en\us\callie\digits\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\ascii\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\8000\*.*" "$(OutDir)sounds\en\us\callie\misc\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\8000\*.*" "$(OutDir)sounds\en\us\callie\currency\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\8000\*.*" "$(OutDir)sounds\en\us\callie\directory\8000" /C /D /Y /S /I + </Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <PostBuildEvent> - <Command>xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\8000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\8000\*.*" "$(OutDir)sounds\en\us\callie\ivr\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\8000\*.*" "$(OutDir)sounds\en\us\callie\conference\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\8000\*.*" "$(OutDir)sounds\en\us\callie\time\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\8000\*.*" "$(OutDir)sounds\en\us\callie\digits\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\ascii\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\8000\*.*" "$(OutDir)sounds\en\us\callie\misc\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\8000\*.*" "$(OutDir)sounds\en\us\callie\currency\8000" /C /D /Y /S /I -xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\8000" /C /D /Y /S /I -</Command> + <Command> + xcopy "$(SolutionDir)libs\sounds\en\us\callie\voicemail\8000\*.*" "$(OutDir)sounds\en\us\callie\voicemail\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\ivr\8000\*.*" "$(OutDir)sounds\en\us\callie\ivr\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\conference\8000\*.*" "$(OutDir)sounds\en\us\callie\conference\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\time\8000\*.*" "$(OutDir)sounds\en\us\callie\time\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\digits\8000\*.*" "$(OutDir)sounds\en\us\callie\digits\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\ascii\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\misc\8000\*.*" "$(OutDir)sounds\en\us\callie\misc\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\currency\8000\*.*" "$(OutDir)sounds\en\us\callie\currency\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\phonetic-ascii\8000\*.*" "$(OutDir)sounds\en\us\callie\phonetic-ascii\8000" /C /D /Y /S /I + xcopy "$(SolutionDir)libs\sounds\en\us\callie\directory\8000\*.*" "$(OutDir)sounds\en\us\callie\directory\8000" /C /D /Y /S /I + </Command> </PostBuildEvent> </ItemDefinitionGroup> <ItemGroup> commit 589502d3d998d18d846f635961e1e28c17ffd893 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Oct 1 14:04:06 2010 -0500 FS-2747 diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 42b8b5e..5e633e0 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -5216,7 +5216,8 @@ int sofia_glue_init_sql(sofia_profile_t *profile) " profile_name VARCHAR(255),\n" " hostname VARCHAR(255),\n" " network_port VARCHAR(6),\n" - " network_ip VARCHAR(255)\n" + " network_ip VARCHAR(255),\n" + " version INTEGER DEFAULT 0 NOT NULL\n" ");\n"; char auth_sql[] = @@ -5336,7 +5337,7 @@ int sofia_glue_init_sql(sofia_profile_t *profile) free(test_sql); - test_sql = switch_mprintf("delete from sip_subscriptions where hostname='%q' and network_ip like '%%' and network_port like '%%'", + test_sql = switch_mprintf("delete from sip_subscriptions where hostname='%q' and version < 0 and network_ip like '%%' and network_port like '%%'", mod_sofia_globals.hostname); switch_cache_db_test_reactive(dbh, test_sql, "DROP TABLE sip_subscriptions", sub_sql); diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 333f31b..d9b3de0 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -700,7 +700,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) "sip_subscriptions.contact,sip_subscriptions.call_id,sip_subscriptions.full_from," "sip_subscriptions.full_via,sip_subscriptions.expires,sip_subscriptions.user_agent," "sip_subscriptions.accept,sip_subscriptions.profile_name" - ",'%q','%q','%q',sip_presence.status,sip_presence.rpid,sip_presence.open_closed,'%q','%q' " + ",'%q','%q','%q',sip_presence.status,sip_presence.rpid,sip_presence.open_closed,'%q','%q',sip_subscriptions.version " "from sip_subscriptions " "left join sip_presence on " "(sip_subscriptions.sub_to_user=sip_presence.sip_user and sip_subscriptions.sub_to_host=sip_presence.sip_host and " @@ -743,6 +743,15 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) sofia_glue_execute_sql_callback(profile, NULL, sql, sofia_presence_sub_callback, &helper); + + sql = switch_mprintf("update sip_subscriptions set version=version+1 where event='dialog' and sub_to_user='%q' " + "and (sub_to_host='%q' or presence_hosts like '%%%q%%') " + "and (profile_name = '%q' or presence_hosts != sub_to_host)", + euser, host, host, profile->name); + + sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); + + if (mod_sofia_globals.debug_presence > 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s END_PRESENCE_SQL (%s)\n", event->event_id == SWITCH_EVENT_PRESENCE_IN ? "IN" : "OUT", profile->name); @@ -1193,7 +1202,8 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * int kill_handle = 0; char expires_str[10] = ""; char status_line[256] = ""; - + char *version = "0"; + //int i; //for(i = 0; i < argc; i++) { @@ -1213,6 +1223,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * if (argc > 20) { dialog_status = argv[20]; dialog_rpid = argv[21]; + version = argv[22]; } in = helper->event && helper->event->event_id == SWITCH_EVENT_PRESENCE_IN; @@ -1317,8 +1328,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * } if (is_dialog) { - char *version = switch_event_get_header(helper->event, "event_count"); - if (!version) { + if (zstr(version)) { version = "0"; } commit 56f8c11f0b476b0a9e2a26b2cac941e47b3f2a5d Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Oct 1 12:22:06 2010 -0500 refactor fmtp parser as a core func diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 8b08db7..466dc51 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -1351,6 +1351,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_init_with_bitrate(switch_codec uint32_t flags, const switch_codec_settings_t *codec_settings, switch_memory_pool_t *pool); SWITCH_DECLARE(switch_status_t) switch_core_codec_copy(switch_codec_t *codec, switch_codec_t *new_codec, switch_memory_pool_t *pool); +SWITCH_DECLARE(switch_status_t) switch_core_codec_parse_fmtp(const char *codec_name, const char *fmtp, uint32_t rate, switch_codec_fmtp_t *codec_fmtp); SWITCH_DECLARE(switch_status_t) switch_core_codec_reset(switch_codec_t *codec); /*! diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index e4933c6..42b8b5e 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -4152,6 +4152,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s const char *rm_encoding; uint32_t map_bit_rate = 0; int codec_ms = 0; + switch_codec_fmtp_t codec_fmtp = { 0 }; if (x++ < skip) { continue; @@ -4197,9 +4198,18 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s map_bit_rate = switch_known_bitrate(map->rm_pt); - if (!codec_ms) { - codec_ms = ptime; + if (!zstr(map->rm_fmtp)) { + if ((switch_core_codec_parse_fmtp(map->rm_encoding, map->rm_fmtp, map->rm_rate, &codec_fmtp)) == SWITCH_STATUS_SUCCESS) { + if (codec_fmtp.bits_per_second) { + map_bit_rate = codec_fmtp.bits_per_second; + } + if (codec_fmtp.microseconds_per_packet) { + ptime = (codec_fmtp.microseconds_per_packet / 1000); + } + } } + + codec_ms = ptime; for (i = first; i < last && i < tech_pvt->num_codecs; i++) { const switch_codec_implementation_t *imp = tech_pvt->codecs[i]; diff --git a/src/switch_core_codec.c b/src/switch_core_codec.c index edaf8b8..d45d73e 100644 --- a/src/switch_core_codec.c +++ b/src/switch_core_codec.c @@ -450,6 +450,28 @@ SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_video_write_codec(switc } +SWITCH_DECLARE(switch_status_t) switch_core_codec_parse_fmtp(const char *codec_name, const char *fmtp, uint32_t rate, switch_codec_fmtp_t *codec_fmtp) +{ + switch_codec_interface_t *codec_interface; + switch_status_t status = SWITCH_STATUS_FALSE; + + if (zstr(codec_name) || zstr(fmtp) || !codec_fmtp) { + return SWITCH_STATUS_FALSE; + } + + memset(codec_fmtp, 0, sizeof(*codec_fmtp)); + + if ((codec_interface = switch_loadable_module_get_codec_interface(codec_name))) { + if (codec_interface->parse_fmtp) { + codec_fmtp->actual_samples_per_second = rate; + status = codec_interface->parse_fmtp(fmtp, codec_fmtp); + } + + UNPROTECT_INTERFACE(codec_interface); + } + + return status; +} SWITCH_DECLARE(switch_status_t) switch_core_codec_reset(switch_codec_t *codec) { commit 76a065ec8b7492d3303b37455d132f7092092645 Author: Michael Jerris <mike@jerris.com> Date: Fri Oct 1 14:49:25 2010 -0400 mod_valet_parking: pass hold class on transfer diff --git a/src/mod/applications/mod_valet_parking/mod_valet_parking.c b/src/mod/applications/mod_valet_parking/mod_valet_parking.c index b752021..b6f13a9 100644 --- a/src/mod/applications/mod_valet_parking/mod_valet_parking.c +++ b/src/mod/applications/mod_valet_parking/mod_valet_parking.c @@ -233,7 +233,17 @@ SWITCH_STANDARD_APP(valet_parking_function) } } - dest = switch_core_session_sprintf(session, "sleep:1000,valet_park:%s %s", lot_name, ext); + if (!(tmp = switch_channel_get_variable(channel, "valet_hold_music"))) { + tmp = switch_channel_get_variable(channel, "hold_music"); + } + if (tmp) + music = tmp; + + if (!strcasecmp(music, "silence")) { + music = "silence_stream://-1"; + } + + dest = switch_core_session_sprintf(session, "set:valet_hold_music=%s,sleep:1000,valet_park:%s %s", music, lot_name, ext); switch_channel_set_variable(channel, "inline_destination", dest); if (is_auto) { @@ -266,12 +276,6 @@ SWITCH_STANDARD_APP(valet_parking_function) } - if (!(tmp = switch_channel_get_variable(channel, "valet_hold_music"))) { - tmp = switch_channel_get_variable(channel, "hold_music"); - } - if (tmp) - music = tmp; - switch_core_hash_insert(lot->hash, ext, switch_core_session_get_uuid(session)); args.input_callback = valet_on_dtmf; @@ -280,9 +284,6 @@ SWITCH_STANDARD_APP(valet_parking_function) switch_mutex_unlock(lot->mutex); - if (!strcasecmp(music, "silence")) { - music = "silence_stream://-1"; - } while(switch_channel_ready(channel)) { switch_status_t pstatus = switch_ivr_play_file(session, NULL, music, &args); commit 8cedafc80bb6e43be6f8d235e1c44f59c4149faa Author: Michael Jerris <mike@jerris.com> Date: Fri Oct 1 12:43:43 2010 -0400 we modified abi, so lets be explicit diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 57c5661..c7d7b0a 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1716,7 +1716,7 @@ struct switch_network_list; typedef struct switch_network_list switch_network_list_t; -#define SWITCH_API_VERSION 4 +#define SWITCH_API_VERSION 5 #define SWITCH_MODULE_LOAD_ARGS (switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool) #define SWITCH_MODULE_RUNTIME_ARGS (void) #define SWITCH_MODULE_SHUTDOWN_ARGS (void) commit 6937ca39da7f0f03589a7ccd820503f6aabfe063 Author: Brian West <brian@freeswitch.org> Date: Fri Oct 1 10:33:00 2010 -0500 FS-884 diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 7e92dec..13d304d 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1775,7 +1775,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi nua_update(tech_pvt->nh, TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)), TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), TAG_END()); - } else if (0 && (ua && (switch_stristr("cisco", ua)))) { + } else if ((ua && (switch_stristr("cisco/spa50", ua) || switch_stristr("cisco/spa525", ua)))) { snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <sip:%s@%s>", name, number, tech_pvt->profile->sipip); sofia_set_flag_locked(tech_pvt, TFLAG_UPDATING_DISPLAY); commit 588eea410f19745b584c9a000bba832af9736232 Merge: 2bcca24 5655fbd Author: Moises Silva <moy@sangoma.com> Date: Fri Oct 1 07:07:12 2010 -0400 Merge branch 'master' of git.freeswitch.org:freeswitch commit 5655fbd58b0f6cd0f70afc8ba381668225e88bf8 Author: Jeff Lenk <jeff@jefflenk.com> Date: Fri Oct 1 10:17:45 2010 -0500 fix windows build diff --git a/src/switch_core_codec.c b/src/switch_core_codec.c index f21b7cb..edaf8b8 100644 --- a/src/switch_core_codec.c +++ b/src/switch_core_codec.c @@ -521,7 +521,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_init_with_bitrate(switch_codec /* If no specific codec interval is requested opt for 20ms above all else because lots of stuff assumes it */ if (!ms) { for (iptr = codec_interface->implementations; iptr; iptr = iptr->next) { - if ((!rate || rate == iptr->samples_per_second) && (!bitrate || bitrate == iptr->bits_per_second) && + if ((!rate || rate == iptr->samples_per_second) && (!bitrate || bitrate == (uint32_t)iptr->bits_per_second) && (20 == (iptr->microseconds_per_packet / 1000)) && (!channels || channels == iptr->number_of_channels)) { implementation = iptr; goto found; @@ -531,7 +531,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_init_with_bitrate(switch_codec /* Either looking for a specific interval or there was no interval specified and there wasn't one @20ms available */ for (iptr = codec_interface->implementations; iptr; iptr = iptr->next) { - if ((!rate || rate == iptr->samples_per_second) && (!bitrate || bitrate == iptr->bits_per_second) && + if ((!rate || rate == iptr->samples_per_second) && (!bitrate || bitrate == (uint32_t)iptr->bits_per_second) && (!ms || ms == (iptr->microseconds_per_packet / 1000)) && (!channels || channels == iptr->number_of_channels)) { implementation = iptr; break; commit 48a9e9a5ac3a48165c91aa9e34cd27057e298927 Author: Brian West <brian@freeswitch.org> Date: Fri Oct 1 09:54:25 2010 -0500 swigall diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java index 2b9353c..e7bcb56 100644 --- a/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/CoreSession.java @@ -213,12 +213,12 @@ public class CoreSession { return freeswitchJNI.CoreSession_transfer(swigCPtr, this, extension, dialplan, context); } - public String read(int min_digits, int max_digits, String prompt_audio_file, int timeout, String valid_terminators) { - return freeswitchJNI.CoreSession_read(swigCPtr, this, min_digits, max_digits, prompt_audio_file, timeout, valid_terminators); + public String read(int min_digits, int max_digits, String prompt_audio_file, int timeout, String valid_terminators, int digit_timeout) { + return freeswitchJNI.CoreSession_read(swigCPtr, this, min_digits, max_digits, prompt_audio_file, timeout, valid_terminators, digit_timeout); } - public String playAndGetDigits(int min_digits, int max_digits, int max_tries, int timeout, String terminators, String audio_files, String bad_input_audio_files, String digits_regex, String var_name) { - return freeswitchJNI.CoreSession_playAndGetDigits(swigCPtr, this, min_digits, max_digits, max_tries, timeout, terminators, audio_files, bad_input_audio_files, digits_regex, var_name); + public String playAndGetDigits(int min_digits, int max_digits, int max_tries, int timeout, String terminators, String audio_files, String bad_input_audio_files, String digits_regex, String var_name, int digit_timeout) { + return freeswitchJNI.CoreSession_playAndGetDigits(swigCPtr, this, min_digits, max_digits, max_tries, timeout, terminators, audio_files, bad_input_audio_files, digits_regex, var_name, digit_timeout); } public int streamFile(String file, int starting_sample_count) { diff --git a/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java b/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java index 5417778..206103c 100644 --- a/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java +++ b/src/mod/languages/mod_java/src/org/freeswitch/swig/freeswitchJNI.java @@ -125,8 +125,8 @@ class freeswitchJNI { public final static native String CoreSession_getDigits__SWIG_0(long jarg1, CoreSession jarg1_, int jarg2, String jarg3, int jarg4); public final static native String CoreSession_getDigits__SWIG_1(long jarg1, CoreSession jarg1_, int jarg2, String jarg3, int jarg4, int jarg5); public final static native int CoreSession_transfer(long jarg1, CoreSession jarg1_, String jarg2, String jarg3, String jarg4); - public final static native String CoreSession_read(long jarg1, CoreSession jarg1_, int jarg2, int jarg3, String jarg4, int jarg5, String jarg6); - public final static native String CoreSession_playAndGetDigits(long jarg1, CoreSession jarg1_, int jarg2, int jarg3, int jarg4, int jarg5, String jarg6, String jarg7, String jarg8, String jarg9, String jarg10); + public final static native String CoreSession_read(long jarg1, CoreSession jarg1_, int jarg2, int jarg3, String jarg4, int jarg5, String jarg6, int jarg7); + public final static native String CoreSession_playAndGetDigits(long jarg1, CoreSession jarg1_, int jarg2, int jarg3, int jarg4, int jarg5, String jarg6, String jarg7, String jarg8, String jarg9, String jarg10, int jarg11); public final static native int CoreSession_streamFile(long jarg1, CoreSession jarg1_, String jarg2, int jarg3); public final static native int CoreSession_sleep(long jarg1, CoreSession jarg1_, int jarg2, int jarg3); public final static native int CoreSession_flushEvents(long jarg1, CoreSession jarg1_); diff --git a/src/mod/languages/mod_java/switch_swig_wrap.cpp b/src/mod/languages/mod_java/switch_swig_wrap.cpp index fc9d6c4..b275b17 100644 --- a/src/mod/languages/mod_java/switch_swig_wrap.cpp +++ b/src/mod/languages/mod_java/switch_swig_wrap.cpp @@ -2405,7 +2405,7 @@ SWIGEXPORT jint JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1tran } -SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1read(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jint jarg3, jstring jarg4, jint jarg5, jstring jarg6) { +SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1read(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jint jarg3, jstring jarg4, jint jarg5, jstring jarg6, jint jarg7) { jstring jresult = 0 ; CoreSession *arg1 = (CoreSession *) 0 ; int arg2 ; @@ -2413,6 +2413,7 @@ SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1r char *arg4 = (char *) 0 ; int arg5 ; char *arg6 = (char *) 0 ; + int arg7 = (int) 0 ; char *result = 0 ; (void)jenv; @@ -2432,7 +2433,8 @@ SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1r arg6 = (char *)jenv->GetStringUTFChars(jarg6, 0); if (!arg6) return 0; } - result = (char *)(arg1)->read(arg2,arg3,(char const *)arg4,arg5,(char const *)arg6); + arg7 = (int)jarg7; + result = (char *)(arg1)->read(arg2,arg3,(char const *)arg4,arg5,(char const *)arg6,arg7); if(result) jresult = jenv->NewStringUTF((const char *)result); if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4); if (arg6) jenv->ReleaseStringUTFChars(jarg6, (const char *)arg6); @@ -2440,7 +2442,7 @@ SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1r } -SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1playAndGetDigits(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jint jarg3, jint jarg4, jint jarg5, jstring jarg6, jstring jarg7, jstring jarg8, jstring jarg9, jstring jarg10) { +SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1playAndGetDigits(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jint jarg2, jint jarg3, jint jarg4, jint jarg5, jstring jarg6, jstring jarg7, jstring jarg8, jstring jarg9, jstring jarg10, jint jarg11) { jstring jresult = 0 ; CoreSession *arg1 = (CoreSession *) 0 ; int arg2 ; @@ -2452,6 +2454,7 @@ SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1p char *arg8 = (char *) 0 ; char *arg9 = (char *) 0 ; char *arg10 = (char *) NULL ; + int arg11 = (int) 0 ; char *result = 0 ; (void)jenv; @@ -2487,7 +2490,8 @@ SWIGEXPORT jstring JNICALL Java_org_freeswitch_swig_freeswitchJNI_CoreSession_1p arg10 = (char *)jenv->GetStringUTFChars(jarg10, 0); if (!arg10) return 0; } - result = (char *)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,(char const *)arg10); + arg11 = (int)jarg11; + result = (char *)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,(char const *)arg10,arg11); if(result) jresult = jenv->NewStringUTF((const char *)result); if (arg6) jenv->ReleaseStringUTFChars(jarg6, (const char *)arg6); if (arg7) jenv->ReleaseStringUTFChars(jarg7, (const char *)arg7); diff --git a/src/mod/languages/mod_lua/mod_lua_wrap.cpp b/src/mod/languages/mod_lua/mod_lua_wrap.cpp index 4bf4b67..5c189cd 100644 --- a/src/mod/languages/mod_lua/mod_lua_wrap.cpp +++ b/src/mod/languages/mod_lua/mod_lua_wrap.cpp @@ -5175,15 +5175,17 @@ static int _wrap_CoreSession_read(lua_State* L) { char *arg4 = (char *) 0 ; int arg5 ; char *arg6 = (char *) 0 ; + int arg7 = (int) 0 ; char *result = 0 ; - SWIG_check_num_args("read",6,6) + SWIG_check_num_args("read",6,7) if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("read",1,"CoreSession *"); if(!lua_isnumber(L,2)) SWIG_fail_arg("read",2,"int"); if(!lua_isnumber(L,3)) SWIG_fail_arg("read",3,"int"); if(!lua_isstring(L,4)) SWIG_fail_arg("read",4,"char const *"); if(!lua_isnumber(L,5)) SWIG_fail_arg("read",5,"int"); if(!lua_isstring(L,6)) SWIG_fail_arg("read",6,"char const *"); + if(lua_gettop(L)>=7 && !lua_isnumber(L,7)) SWIG_fail_arg("read",7,"int"); if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ SWIG_fail_ptr("CoreSession_read",1,SWIGTYPE_p_CoreSession); @@ -5194,7 +5196,10 @@ static int _wrap_CoreSession_read(lua_State* L) { arg4 = (char *)lua_tostring(L, 4); arg5 = (int)lua_tonumber(L, 5); arg6 = (char *)lua_tostring(L, 6); - result = (char *)(arg1)->read(arg2,arg3,(char const *)arg4,arg5,(char const *)arg6); + if(lua_gettop(L)>=7){ + arg7 = (int)lua_tonumber(L, 7); + } + result = (char *)(arg1)->read(arg2,arg3,(char const *)arg4,arg5,(char const *)arg6,arg7); SWIG_arg=0; lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; @@ -5219,9 +5224,10 @@ static int _wrap_CoreSession_playAndGetDigits(lua_State* L) { char *arg8 = (char *) 0 ; char *arg9 = (char *) 0 ; char *arg10 = (char *) NULL ; + int arg11 = (int) 0 ; char *result = 0 ; - SWIG_check_num_args("playAndGetDigits",9,10) + SWIG_check_num_args("playAndGetDigits",9,11) if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("playAndGetDigits",1,"CoreSession *"); if(!lua_isnumber(L,2)) SWIG_fail_arg("playAndGetDigits",2,"int"); if(!lua_isnumber(L,3)) SWIG_fail_arg("playAndGetDigits",3,"int"); @@ -5232,6 +5238,7 @@ static int _wrap_CoreSession_playAndGetDigits(lua_State* L) { if(!lua_isstring(L,8)) SWIG_fail_arg("playAndGetDigits",8,"char *"); if(!lua_isstring(L,9)) SWIG_fail_arg("playAndGetDigits",9,"char *"); if(lua_gettop(L)>=10 && !lua_isstring(L,10)) SWIG_fail_arg("playAndGetDigits",10,"char const *"); + if(lua_gettop(L)>=11 && !lua_isnumber(L,11)) SWIG_fail_arg("playAndGetDigits",11,"int"); if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ SWIG_fail_ptr("CoreSession_playAndGetDigits",1,SWIGTYPE_p_CoreSession); @@ -5248,7 +5255,10 @@ static int _wrap_CoreSession_playAndGetDigits(lua_State* L) { if(lua_gettop(L)>=10){ arg10 = (char *)lua_tostring(L, 10); } - result = (char *)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,(char const *)arg10); + if(lua_gettop(L)>=11){ + arg11 = (int)lua_tonumber(L, 11); + } + result = (char *)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,(char const *)arg10,arg11); SWIG_arg=0; lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index bfb36ab..b369689 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -3776,25 +3776,25 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_t38_options_t_remote_ip_get(void * j } -SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_remote_port_set(void * jarg1, unsigned long jarg2) { +SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_remote_port_set(void * jarg1, unsigned short jarg2) { switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ; - uint32_t arg2 ; + uint16_t arg2 ; arg1 = (switch_t38_options_t *)jarg1; - arg2 = (uint32_t)jarg2; + arg2 = (uint16_t)jarg2; if (arg1) (arg1)->remote_port = arg2; } -SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_t38_options_t_remote_port_get(void * jarg1) { - unsigned long jresult ; +SWIGEXPORT unsigned short SWIGSTDCALL CSharp_switch_t38_options_t_remote_port_get(void * jarg1) { + unsigned short jresult ; switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ; - uint32_t result; + uint16_t result; arg1 = (switch_t38_options_t *)jarg1; - result = (uint32_t) ((arg1)->remote_port); - jresult = (unsigned long)result; + result = (uint16_t) ((arg1)->remote_port); + jresult = result; return jresult; } @@ -3828,25 +3828,25 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_t38_options_t_local_ip_get(void * ja } -SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_local_port_set(void * jarg1, unsigned long jarg2) { +SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_local_port_set(void * jarg1, unsigned short jarg2) { switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ; - uint32_t arg2 ; + uint16_t arg2 ; arg1 = (switch_t38_options_t *)jarg1; - arg2 = (uint32_t)jarg2; + arg2 = (uint16_t)jarg2; if (arg1) (arg1)->local_port = arg2; } -SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_t38_options_t_local_port_get(void * jarg1) { - unsigned long jresult ; +SWIGEXPORT unsigned short SWIGSTDCALL CSharp_switch_t38_options_t_local_port_get(void * jarg1) { + unsigned short jresult ; switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ; - uint32_t result; + uint16_t result; arg1 = (switch_t38_options_t *)jarg1; - result = (uint32_t) ((arg1)->local_port); - jresult = (unsigned long)result; + result = (uint16_t) ((arg1)->local_port); + jresult = result; return jresult; } @@ -8152,7 +8152,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_timer_destroy(void * jarg1) { } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_codec_init(void * jarg1, char * jarg2, char * jarg3, unsigned long jarg4, int jarg5, int jarg6, unsigned long jarg7, void * jarg8, void * jarg9) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_codec_init_with_bitrate(void * jarg1, char * jarg2, char * jarg3, unsigned long jarg4, int jarg5, int jarg6, unsigned long jarg7, unsigned long jarg8, void * jarg9, void * jarg10) { int jresult ; switch_codec_t *arg1 = (switch_codec_t *) 0 ; char *arg2 = (char *) 0 ; @@ -8161,8 +8161,9 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_codec_init(void * jarg1, char * ja int arg5 ; int arg6 ; uint32_t arg7 ; - switch_codec_settings_t *arg8 = (switch_codec_settings_t *) 0 ; - switch_memory_pool_t *arg9 = (switch_memory_pool_t *) 0 ; + uint32_t arg8 ; + switch_codec_settings_t *arg9 = (switch_codec_settings_t *) 0 ; + switch_memory_pool_t *arg10 = (switch_memory_pool_t *) 0 ; switch_status_t result; arg1 = (switch_codec_t *)jarg1; @@ -8172,9 +8173,10 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_codec_init(void * jarg1, char * ja arg5 = (int)jarg5; arg6 = (int)jarg6; arg7 = (uint32_t)jarg7; - arg8 = (switch_codec_settings_t *)jarg8; - arg9 = (switch_memory_pool_t *)jarg9; - result = (switch_status_t)switch_core_codec_init(arg1,(char const *)arg2,(char const *)arg3,arg4,arg5,arg6,arg7,(switch_codec_settings const *)arg8,arg9); + arg8 = (uint32_t)jarg8; + arg9 = (switch_codec_settings_t *)jarg9; + arg10 = (switch_memory_pool_t *)jarg10; + result = (switch_status_t)switch_core_codec_init_with_bitrate(arg1,(char const *)arg2,(char const *)arg3,arg4,arg5,arg6,arg7,arg8,(switch_codec_settings const *)arg9,arg10); jresult = result; return jresult; } @@ -20563,388 +20565,154 @@ SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_directory_handle(void * jarg1) } -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_quality_set(void * jarg1, int jarg2) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int arg2 ; - - arg1 = (switch_codec_settings *)jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->quality = arg2; - -} - - -SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_quality_get(void * jarg1) { - int jresult ; - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int result; - - arg1 = (switch_codec_settings *)jarg1; - result = (int) ((arg1)->quality); - jresult = result; - return jresult; -} - - -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_complexity_set(void * jarg1, int jarg2) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int arg2 ; - - arg1 = (switch_codec_settings *)jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->complexity = arg2; - -} - - -SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_complexity_get(void * jarg1) { - int jresult ; - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int result; - - arg1 = (switch_codec_settings *)jarg1; - result = (int) ((arg1)->complexity); - jresult = result; - return jresult; -} - - -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_enhancement_set(void * jarg1, int jarg2) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int arg2 ; - - arg1 = (switch_codec_settings *)jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->enhancement = arg2; - -} - - -SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_enhancement_get(void * jarg1) { - int jresult ; - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int result; - - arg1 = (switch_codec_settings *)jarg1; - result = (int) ((arg1)->enhancement); - jresult = result; - return jresult; -} - - -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_vad_set(void * jarg1, int jarg2) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int arg2 ; - - arg1 = (switch_codec_settings *)jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->vad = arg2; - -} - - -SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_vad_get(void * jarg1) { - int jresult ; - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int result; - - arg1 = (switch_codec_settings *)jarg1; - result = (int) ((arg1)->vad); - jresult = result; - return jresult; -} - - -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_vbr_set(void * jarg1, int jarg2) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int arg2 ; - - arg1 = (switch_codec_settings *)jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->vbr = arg2; - -} - - -SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_vbr_get(void * jarg1) { - int jresult ; - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int result; - - arg1 = (switch_codec_settings *)jarg1; - result = (int) ((arg1)->vbr); - jresult = result; - return jresult; -} - - -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_vbr_quality_set(void * jarg1, float jarg2) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - float arg2 ; - - arg1 = (switch_codec_settings *)jarg1; - arg2 = (float)jarg2; - if (arg1) (arg1)->vbr_quality = arg2; - -} - - -SWIGEXPORT float SWIGSTDCALL CSharp_switch_codec_settings_vbr_quality_get(void * jarg1) { - float jresult ; - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - float result; - - arg1 = (switch_codec_settings *)jarg1; - result = (float) ((arg1)->vbr_quality); - jresult = result; - return jresult; -} - - -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_abr_set(void * jarg1, int jarg2) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int arg2 ; - - arg1 = (switch_codec_settings *)jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->abr = arg2; - -} - - -SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_abr_get(void * jarg1) { - int jresult ; - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int result; - - arg1 = (switch_codec_settings *)jarg1; - result = (int) ((arg1)->abr); - jresult = result; - return jresult; -} - - -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_dtx_set(void * jarg1, int jarg2) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int arg2 ; - - arg1 = (switch_codec_settings *)jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->dtx = arg2; - -} - - -SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_dtx_get(void * jarg1) { - int jresult ; - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int result; - - arg1 = (switch_codec_settings *)jarg1; - result = (int) ((arg1)->dtx); - jresult = result; - return jresult; -} - - -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_preproc_set(void * jarg1, int jarg2) { +SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_unused_set(void * jarg1, int jarg2) { switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; int arg2 ; arg1 = (switch_codec_settings *)jarg1; arg2 = (int)jarg2; - if (arg1) (arg1)->preproc = arg2; + if (arg1) (arg1)->unused = arg2; } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_preproc_get(void * jarg1) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_unused_get(void * jarg1) { int jresult ; switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; int result; arg1 = (switch_codec_settings *)jarg1; - result = (int) ((arg1)->preproc); + result = (int) ((arg1)->unused); jresult = result; return jresult; } -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_pp_vad_set(void * jarg1, int jarg2) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int arg2 ; - - arg1 = (switch_codec_settings *)jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->pp_vad = arg2; - -} - - -SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_pp_vad_get(void * jarg1) { - int jresult ; - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int result; +SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_codec_settings() { + void * jresult ; + switch_codec_settings *result = 0 ; - arg1 = (switch_codec_settings *)jarg1; - result = (int) ((arg1)->pp_vad); - jresult = result; + result = (switch_codec_settings *)new switch_codec_settings(); + jresult = (void *)result; return jresult; } -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_pp_agc_set(void * jarg1, int jarg2) { +SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_codec_settings(void * jarg1) { switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int arg2 ; arg1 = (switch_codec_settings *)jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->pp_agc = arg2; - -} - - -SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_pp_agc_get(void * jarg1) { - int jresult ; - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int result; + delete arg1; - arg1 = (switch_codec_settings *)jarg1; - result = (int) ((arg1)->pp_agc); - jresult = result; - return jresult; } -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_pp_agc_level_set(void * jarg1, float jarg2) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - float arg2 ; +SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_fmtp_actual_samples_per_second_set(void * jarg1, unsigned long jarg2) { + switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ; + uint32_t arg2 ; - arg1 = (switch_codec_settings *)jarg1; - arg2 = (float)jarg2; - if (arg1) (arg1)->pp_agc_level = arg2; + arg1 = (switch_codec_fmtp *)jarg1; + arg2 = (uint32_t)jarg2; + if (arg1) (arg1)->actual_samples_per_second = arg2; } -SWIGEXPORT float SWIGSTDCALL CSharp_switch_codec_settings_pp_agc_level_get(void * jarg1) { - float jresult ; - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - float result; +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_codec_fmtp_actual_samples_per_second_get(void * jarg1) { + unsigned long jresult ; + switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ; + uint32_t result; - arg1 = (switch_codec_settings *)jarg1; - result = (float) ((arg1)->pp_agc_level); - jresult = result; + arg1 = (switch_codec_fmtp *)jarg1; + result = (uint32_t) ((arg1)->actual_samples_per_second); + jresult = (unsigned long)result; return jresult; } -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_pp_denoise_set(void * jarg1, int jarg2) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; +SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_fmtp_bits_per_second_set(void * jarg1, int jarg2) { + switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ; int arg2 ; - arg1 = (switch_codec_settings *)jarg1; + arg1 = (switch_codec_fmtp *)jarg1; arg2 = (int)jarg2; - if (arg1) (arg1)->pp_denoise = arg2; + if (arg1) (arg1)->bits_per_second = arg2; } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_pp_denoise_get(void * jarg1) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_fmtp_bits_per_second_get(void * jarg1) { int jresult ; - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; + switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ; int result; - arg1 = (switch_codec_settings *)jarg1; - result = (int) ((arg1)->pp_denoise); + arg1 = (switch_codec_fmtp *)jarg1; + result = (int) ((arg1)->bits_per_second); jresult = result; return jresult; } -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_pp_dereverb_set(void * jarg1, int jarg2) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; +SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_fmtp_microseconds_per_packet_set(void * jarg1, int jarg2) { + switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ; int arg2 ; - arg1 = (switch_codec_settings *)jarg1; + arg1 = (switch_codec_fmtp *)jarg1; arg2 = (int)jarg2; - if (arg1) (arg1)->pp_dereverb = arg2; + if (arg1) (arg1)->microseconds_per_packet = arg2; } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_pp_dereverb_get(void * jarg1) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_fmtp_microseconds_per_packet_get(void * jarg1) { int jresult ; - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; + switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ; int result; - arg1 = (switch_codec_settings *)jarg1; - result = (int) ((arg1)->pp_dereverb); - jresult = result; - return jresult; -} - - -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_pp_dereverb_decay_set(void * jarg1, float jarg2) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - float arg2 ; - - arg1 = (switch_codec_settings *)jarg1; - arg2 = (float)jarg2; - if (arg1) (arg1)->pp_dereverb_decay = arg2; - -} - - -SWIGEXPORT float SWIGSTDCALL CSharp_switch_codec_settings_pp_dereverb_decay_get(void * jarg1) { - float jresult ; - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - float result; - - arg1 = (switch_codec_settings *)jarg1; - result = (float) ((arg1)->pp_dereverb_decay); + arg1 = (switch_codec_fmtp *)jarg1; + result = (int) ((arg1)->microseconds_per_packet); jresult = result; return jresult; } -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_pp_dereverb_level_set(void * jarg1, float jarg2) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - float arg2 ; +SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_fmtp_private_info_set(void * jarg1, void * jarg2) { + switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ; + void *arg2 = (void *) 0 ; - arg1 = (switch_codec_settings *)jarg1; - arg2 = (float)jarg2; - if (arg1) (arg1)->pp_dereverb_level = arg2; + arg1 = (switch_codec_fmtp *)jarg1; + arg2 = (void *)jarg2; + if (arg1) (arg1)->private_info = arg2; } -SWIGEXPORT float SWIGSTDCALL CSharp_switch_codec_settings_pp_dereverb_level_get(void * jarg1) { - float jresult ; - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - float result; +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_fmtp_private_info_get(void * jarg1) { + void * jresult ; + switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ; + void *result = 0 ; - arg1 = (switch_codec_settings *)jarg1; - result = (float) ((arg1)->pp_dereverb_level); - jresult = result; + arg1 = (switch_codec_fmtp *)jarg1; + result = (void *) ((arg1)->private_info); + jresult = (void *)result; return jresult; } -SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_codec_settings() { +SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_codec_fmtp() { void * jresult ; - switch_codec_settings *result = 0 ; + switch_codec_fmtp *result = 0 ; - result = (switch_codec_settings *)new switch_codec_settings(); + result = (switch_codec_fmtp *)new switch_codec_fmtp(); jresult = (void *)result; return jresult; } -SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_codec_settings(void * jarg1) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; +SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_codec_fmtp(void * jarg1) { + switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ; - arg1 = (switch_codec_settings *)jarg1; + arg1 = (switch_codec_fmtp *)jarg1; delete arg1; } @@ -21056,29 +20824,6 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_codec_fmtp_out_get(void * jarg1) { } -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_codec_settings_set(void * jarg1, void * jarg2) { - switch_codec *arg1 = (switch_codec *) 0 ; - switch_codec_settings_t *arg2 = (switch_codec_settings_t *) 0 ; - - arg1 = (switch_codec *)jarg1; - arg2 = (switch_codec_settings_t *)jarg2; - if (arg1) (arg1)->codec_settings = *arg2; - -} - - -SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_codec_settings_get(void * jarg1) { - void * jresult ; - switch_codec *arg1 = (switch_codec *) 0 ; - switch_codec_settings_t *result = 0 ; - - arg1 = (switch_codec *)jarg1; - result = (switch_codec_settings_t *)& ((arg1)->codec_settings); - jresult = (void *)result; - return jresult; -} - - SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_flags_set(void * jarg1, unsigned long jarg2) { switch_codec *arg1 = (switch_codec *) 0 ; uint32_t arg2 ; @@ -21781,6 +21526,29 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_interface_implementations_get( } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_interface_parse_fmtp_set(void * jarg1, void * jarg2) { + switch_codec_interface *arg1 = (switch_codec_interface *) 0 ; + switch_core_codec_fmtp_parse_func_t arg2 = (switch_core_codec_fmtp_parse_func_t) 0 ; + + arg1 = (switch_codec_interface *)jarg1; + arg2 = (switch_core_codec_fmtp_parse_func_t)jarg2; + if (arg1) (arg1)->parse_fmtp = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_interface_parse_fmtp_get(void * jarg1) { + void * jresult ; + switch_codec_interface *arg1 = (switch_codec_interface *) 0 ; + switch_core_codec_fmtp_parse_func_t result; + + arg1 = (switch_codec_interface *)jarg1; + result = (switch_core_codec_fmtp_parse_func_t) ((arg1)->parse_fmtp); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_interface_codec_id_set(void * jarg1, unsigned long jarg2) { switch_codec_interface *arg1 = (switch_codec_interface *) 0 ; uint32_t arg2 ; @@ -28868,6 +28636,18 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_get_stats(void * jarg1, void * j } +SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_rtp_check_auto_adj(void * jarg1) { + unsigned char jresult ; + switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; + switch_byte_t result; + + arg1 = (switch_rtp_t *)jarg1; + result = (switch_byte_t)switch_rtp_check_auto_adj(arg1); + jresult = result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_log_node_t_data_set(void * jarg1, char * jarg2) { switch_log_node_t *arg1 = (switch_log_node_t *) 0 ; char *arg2 = (char *) 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index 59d278b..f30750a 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -1663,8 +1663,8 @@ public class freeswitch { return ret; } - public static switch_status_t switch_core_codec_init(switch_codec codec, string codec_name, string fmtp, uint rate, int ms, int channels, uint flags, switch_codec_settings codec_settings, SWIGTYPE_p_apr_pool_t pool) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_codec_init(switch_codec.getCPtr(codec), codec_name, fmtp, rate, ms, channels, flags, switch_codec_settings.getCPtr(codec_settings), SWIGTYPE_p_apr_pool_t.getCPtr(pool)); + public static switch_status_t switch_core_codec_init_with_bitrate(switch_codec codec, string codec_name, string fmtp, uint rate, int ms, int channels, uint bitrate, uint flags, switch_codec_settings codec_settings, SWIGTYPE_p_apr_pool_t pool) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_codec_init_with_bitrate(switch_codec.getCPtr(codec), codec_name, fmtp, rate, ms, channels, bitrate, flags, switch_codec_settings.getCPtr(codec_settings), SWIGTYPE_p_apr_pool_t.getCPtr(pool)); return ret; } @@ -4595,6 +4595,11 @@ public class freeswitch { return ret; } + public static byte switch_rtp_check_auto_adj(SWIGTYPE_p_switch_rtp rtp_session) { + byte ret = freeswitchPINVOKE.switch_rtp_check_auto_adj(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session)); + return ret; + } + public static switch_status_t switch_log_init(SWIGTYPE_p_apr_pool_t pool, switch_bool_t colorize) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_log_init(SWIGTYPE_p_apr_pool_t.getCPtr(pool), (int)colorize); return ret; @@ -6362,10 +6367,10 @@ class freeswitchPINVOKE { public static extern string switch_t38_options_t_remote_ip_get(HandleRef jarg1); [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_remote_port_set")] - public static extern void switch_t38_options_t_remote_port_set(HandleRef jarg1, uint jarg2); + public static extern void switch_t38_options_t_remote_port_set(HandleRef jarg1, ushort jarg2); [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_remote_port_get")] - public static extern uint switch_t38_options_t_remote_port_get(HandleRef jarg1); + public static extern ushort switch_t38_options_t_remote_port_get(HandleRef jarg1); [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_local_ip_set")] public static extern void switch_t38_options_t_local_ip_set(HandleRef jarg1, string jarg2); @@ -6374,10 +6379,10 @@ class freeswitchPINVOKE { public static extern string switch_t38_options_t_local_ip_get(HandleRef jarg1); [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_local_port_set")] - public static extern void switch_t38_options_t_local_port_set(HandleRef jarg1, uint jarg2); + public static extern void switch_t38_options_t_local_port_set(HandleRef jarg1, ushort jarg2); [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_local_port_get")] - public static extern uint switch_t38_options_t_local_port_get(HandleRef jarg1); + public static extern ushort switch_t38_options_t_local_port_get(HandleRef jarg1); [DllImport("mod_managed", EntryPoint="CSharp_new_switch_t38_options_t")] public static extern IntPtr new_switch_t38_options_t(); @@ -7390,8 +7395,8 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_timer_destroy")] public static extern int switch_core_timer_destroy(HandleRef jarg1); - [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_init")] - public static extern int switch_core_codec_init(HandleRef jarg1, string jarg2, string jarg3, uint jarg4, int jarg5, int jarg6, uint jarg7, HandleRef jarg8, HandleRef jarg9); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_init_with_bitrate")] + public static extern int switch_core_codec_init_with_bitrate(HandleRef jarg1, string jarg2, string jarg3, uint jarg4, int jarg5, int jarg6, uint jarg7, uint jarg8, HandleRef jarg9, HandleRef jarg10); [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_copy")] public static extern int switch_core_codec_copy(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3); @@ -10372,107 +10377,47 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_directory_handle")] public static extern void delete_switch_directory_handle(HandleRef jarg1); - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_quality_set")] - public static extern void switch_codec_settings_quality_set(HandleRef jarg1, int jarg2); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_quality_get")] - public static extern int switch_codec_settings_quality_get(HandleRef jarg1); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_complexity_set")] - public static extern void switch_codec_settings_complexity_set(HandleRef jarg1, int jarg2); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_complexity_get")] - public static extern int switch_codec_settings_complexity_get(HandleRef jarg1); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_enhancement_set")] - public static extern void switch_codec_settings_enhancement_set(HandleRef jarg1, int jarg2); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_enhancement_get")] - public static extern int switch_codec_settings_enhancement_get(HandleRef jarg1); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_vad_set")] - public static extern void switch_codec_settings_vad_set(HandleRef jarg1, int jarg2); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_vad_get")] - public static extern int switch_codec_settings_vad_get(HandleRef jarg1); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_vbr_set")] - public static extern void switch_codec_settings_vbr_set(HandleRef jarg1, int jarg2); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_vbr_get")] - public static extern int switch_codec_settings_vbr_get(HandleRef jarg1); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_vbr_quality_set")] - public static extern void switch_codec_settings_vbr_quality_set(HandleRef jarg1, float jarg2); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_vbr_quality_get")] - public static extern float switch_codec_settings_vbr_quality_get(HandleRef jarg1); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_abr_set")] - public static extern void switch_codec_settings_abr_set(HandleRef jarg1, int jarg2); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_abr_get")] - public static extern int switch_codec_settings_abr_get(HandleRef jarg1); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_dtx_set")] - public static extern void switch_codec_settings_dtx_set(HandleRef jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_unused_set")] + public static extern void switch_codec_settings_unused_set(HandleRef jarg1, int jarg2); - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_dtx_get")] - public static extern int switch_codec_settings_dtx_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_unused_get")] + public static extern int switch_codec_settings_unused_get(HandleRef jarg1); - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_preproc_set")] - public static extern void switch_codec_settings_preproc_set(HandleRef jarg1, int jarg2); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_preproc_get")] - public static extern int switch_codec_settings_preproc_get(HandleRef jarg1); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_vad_set")] - public static extern void switch_codec_settings_pp_vad_set(HandleRef jarg1, int jarg2); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_vad_get")] - public static extern int switch_codec_settings_pp_vad_get(HandleRef jarg1); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_agc_set")] - public static extern void switch_codec_settings_pp_agc_set(HandleRef jarg1, int jarg2); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_agc_get")] - public static extern int switch_codec_settings_pp_agc_get(HandleRef jarg1); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_agc_level_set")] - public static extern void switch_codec_settings_pp_agc_level_set(HandleRef jarg1, float jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_codec_settings")] + public static extern IntPtr new_switch_codec_settings(); - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_agc_level_get")] - public static extern float switch_codec_settings_pp_agc_level_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_codec_settings")] + public static extern void delete_switch_codec_settings(HandleRef jarg1); - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_denoise_set")] - public static extern void switch_codec_settings_pp_denoise_set(HandleRef jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_fmtp_actual_samples_per_second_set")] + public static extern void switch_codec_fmtp_actual_samples_per_second_set(HandleRef jarg1, uint jarg2); - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_denoise_get")] - public static extern int switch_codec_settings_pp_denoise_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_fmtp_actual_samples_per_second_get")] + public static extern uint switch_codec_fmtp_actual_samples_per_second_get(HandleRef jarg1); - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_dereverb_set")] - public static extern void switch_codec_settings_pp_dereverb_set(HandleRef jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_fmtp_bits_per_second_set")] + public static extern void switch_codec_fmtp_bits_per_second_set(HandleRef jarg1, int jarg2); - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_dereverb_get")] - public static extern int switch_codec_settings_pp_dereverb_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_fmtp_bits_per_second_get")] + public static extern int switch_codec_fmtp_bits_per_second_get(HandleRef jarg1); - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_dereverb_decay_set")] - public static extern void switch_codec_settings_pp_dereverb_decay_set(HandleRef jarg1, float jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_fmtp_microseconds_per_packet_set")] + public static extern void switch_codec_fmtp_microseconds_per_packet_set(HandleRef jarg1, int jarg2); - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_dereverb_decay_get")] - public static extern float switch_codec_settings_pp_dereverb_decay_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_fmtp_microseconds_per_packet_get")] + public static extern int switch_codec_fmtp_microseconds_per_packet_get(HandleRef jarg1); - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_dereverb_level_set")] - public static extern void switch_codec_settings_pp_dereverb_level_set(HandleRef jarg1, float jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_fmtp_private_info_set")] + public static extern void switch_codec_fmtp_private_info_set(HandleRef jarg1, HandleRef jarg2); - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_dereverb_level_get")] - public static extern float switch_codec_settings_pp_dereverb_level_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_fmtp_private_info_get")] + public static extern IntPtr switch_codec_fmtp_private_info_get(HandleRef jarg1); - [DllImport("mod_managed", EntryPoint="CSharp_new_switch_codec_settings")] - public static extern IntPtr new_switch_codec_settings(); + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_codec_fmtp")] + public static extern IntPtr new_switch_codec_fmtp(); - [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_codec_settings")] - public static extern void delete_switch_codec_settings(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_codec_fmtp")] + public static extern void delete_switch_codec_fmtp(HandleRef jarg1); [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_codec_interface_set")] public static extern void switch_codec_codec_interface_set(HandleRef jarg1, HandleRef jarg2); @@ -10498,12 +10443,6 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_fmtp_out_get")] public static extern string switch_codec_fmtp_out_get(HandleRef jarg1); - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_codec_settings_set")] - public static extern void switch_codec_codec_settings_set(HandleRef jarg1, HandleRef jarg2); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_codec_settings_get")] - public static extern IntPtr switch_codec_codec_settings_get(HandleRef jarg1); - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_flags_set")] public static extern void switch_codec_flags_set(HandleRef jarg1, uint jarg2); @@ -10684,6 +10623,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_implementations_get")] public static extern IntPtr switch_codec_interface_implementations_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_parse_fmtp_set")] + public static extern void switch_codec_interface_parse_fmtp_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_parse_fmtp_get")] + public static extern IntPtr switch_codec_interface_parse_fmtp_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_codec_id_set")] public static extern void switch_codec_interface_codec_id_set(HandleRef jarg1, uint jarg2); @@ -12211,6 +12156,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_get_stats")] public static extern IntPtr switch_rtp_get_stats(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_check_auto_adj")] + public static extern byte switch_rtp_check_auto_adj(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_data_set")] public static extern void switch_log_node_t_data_set(HandleRef jarg1, string jarg2); @@ -14059,6 +14007,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_f_p_q_const__char_p_switch_codec_fmtp__switch_status_t { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__char_p_switch_codec_fmtp__switch_status_t(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__char_p_switch_codec_fmtp__switch_status_t() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__char_p_switch_codec_fmtp__switch_status_t obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t { private HandleRef swigCPtr; @@ -21261,17 +21239,6 @@ public class switch_codec : IDisposable { } } - public switch_codec_settings codec_settings { - set { - freeswitchPINVOKE.switch_codec_codec_settings_set(swigCPtr, switch_codec_settings.getCPtr(value)); - } - get { - IntPtr cPtr = freeswitchPINVOKE.switch_codec_codec_settings_get(swigCPtr); - switch_codec_settings ret = (cPtr == IntPtr.Zero) ? null : new switch_codec_settings(cPtr, false); - return ret; - } - } - public uint flags { set { freeswitchPINVOKE.switch_codec_flags_set(swigCPtr, value); @@ -21378,6 +21345,94 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class switch_codec_fmtp : IDisposable { + private HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal switch_codec_fmtp(IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new HandleRef(this, cPtr); + } + + internal static HandleRef getCPtr(switch_codec_fmtp obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } + + ~switch_codec_fmtp() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_switch_codec_fmtp(swigCPtr); + } + swigCPtr = new HandleRef(null, IntPtr.Zero); + GC.SuppressFinalize(this); + } + } + + public uint actual_samples_per_second { + set { + freeswitchPINVOKE.switch_codec_fmtp_actual_samples_per_second_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.switch_codec_fmtp_actual_samples_per_second_get(swigCPtr); + return ret; + } + } + + public int bits_per_second { + set { + freeswitchPINVOKE.switch_codec_fmtp_bits_per_second_set(swigCPtr, value); + } + get { + int ret = freeswitchPINVOKE.switch_codec_fmtp_bits_per_second_get(swigCPtr); + return ret; + } + } + + public int microseconds_per_packet { + set { + freeswitchPINVOKE.switch_codec_fmtp_microseconds_per_packet_set(swigCPtr, value); + } + get { + int ret = freeswitchPINVOKE.switch_codec_fmtp_microseconds_per_packet_get(swigCPtr); + return ret; + } + } + + public SWIGTYPE_p_void private_info { + set { + freeswitchPINVOKE.switch_codec_fmtp_private_info_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_codec_fmtp_private_info_get(swigCPtr); + SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false); + return ret; + } + } + + public switch_codec_fmtp() : this(freeswitchPINVOKE.new_switch_codec_fmtp(), true) { + } + +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class switch_codec_implementation : IDisposable { private HandleRef swigCPtr; protected bool swigCMemOwn; @@ -21679,6 +21734,17 @@ public class switch_codec_interface : IDisposable { } } + public SWIGTYPE_p_f_p_q_const__char_p_switch_codec_fmtp__switch_status_t parse_fmtp { + set { + freeswitchPINVOKE.switch_codec_interface_parse_fmtp_set(swigCPtr, SWIGTYPE_p_f_p_q_const__char_p_switch_codec_fmtp__switch_status_t.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_codec_interface_parse_fmtp_get(swigCPtr); + SWIGTYPE_p_f_p_q_const__char_p_switch_codec_fmtp__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_q_const__char_p_switch_codec_fmtp__switch_status_t(cPtr, false); + return ret; + } + } + public uint codec_id { set { freeswitchPINVOKE.switch_codec_interface_codec_id_set(swigCPtr, value); @@ -21790,162 +21856,12 @@ public class switch_codec_settings : IDisposable { } } - public int quality { - set { - freeswitchPINVOKE.switch_codec_settings_quality_set(swigCPtr, value); - } - get { - int ret = freeswitchPINVOKE.switch_codec_settings_quality_get(swigCPtr); - return ret; - } - } - - public int complexity { - set { - freeswitchPINVOKE.switch_codec_settings_complexity_set(swigCPtr, value); - } - get { - int ret = freeswitchPINVOKE.switch_codec_settings_complexity_get(swigCPtr); - return ret; - } - } - - public int enhancement { - set { - freeswitchPINVOKE.switch_codec_settings_enhancement_set(swigCPtr, value); - } - get { - int ret = freeswitchPINVOKE.switch_codec_settings_enhancement_get(swigCPtr); - return ret; - } - } - - public int vad { - set { - freeswitchPINVOKE.switch_codec_settings_vad_set(swigCPtr, value); - } - get { - int ret = freeswitchPINVOKE.switch_codec_settings_vad_get(swigCPtr); - return ret; - } - } - - public int vbr { - set { - freeswitchPINVOKE.switch_codec_settings_vbr_set(swigCPtr, value); - } - get { - int ret = freeswitchPINVOKE.switch_codec_settings_vbr_get(swigCPtr); - return ret; - } - } - - public float vbr_quality { - set { - freeswitchPINVOKE.switch_codec_settings_vbr_quality_set(swigCPtr, value); - } - get { - float ret = freeswitchPINVOKE.switch_codec_settings_vbr_quality_get(swigCPtr); - return ret; - } - } - - public int abr { - set { - freeswitchPINVOKE.switch_codec_settings_abr_set(swigCPtr, value); - } - get { - int ret = freeswitchPINVOKE.switch_codec_settings_abr_get(swigCPtr); - return ret; - } - } - - public int dtx { - set { - freeswitchPINVOKE.switch_codec_settings_dtx_set(swigCPtr, value); - } - get { - int ret = freeswitchPINVOKE.switch_codec_settings_dtx_get(swigCPtr); - return ret; - } - } - - public int preproc { - set { - freeswitchPINVOKE.switch_codec_settings_preproc_set(swigCPtr, value); - } - get { - int ret = freeswitchPINVOKE.switch_codec_settings_preproc_get(swigCPtr); - return ret; - } - } - - public int pp_vad { - set { - freeswitchPINVOKE.switch_codec_settings_pp_vad_set(swigCPtr, value); - } - get { - int ret = freeswitchPINVOKE.switch_codec_settings_pp_vad_get(swigCPtr); - return ret; - } - } - - public int pp_agc { - set { - freeswitchPINVOKE.switch_codec_settings_pp_agc_set(swigCPtr, value); - } - get { - int ret = freeswitchPINVOKE.switch_codec_settings_pp_agc_get(swigCPtr); - return ret; - } - } - - public float pp_agc_level { - set { - freeswitchPINVOKE.switch_codec_settings_pp_agc_level_set(swigCPtr, value); - } - get { - float ret = freeswitchPINVOKE.switch_codec_settings_pp_agc_level_get(swigCPtr); - return ret; - } - } - - public int pp_denoise { - set { - freeswitchPINVOKE.switch_codec_settings_pp_denoise_set(swigCPtr, value); - } - get { - int ret = freeswitchPINVOKE.switch_codec_settings_pp_denoise_get(swigCPtr); - return ret; - } - } - - public int pp_dereverb { + public int unused { set { - freeswitchPINVOKE.switch_codec_settings_pp_dereverb_set(swigCPtr, value); + freeswitchPINVOKE.switch_codec_settings_unused_set(swigCPtr, value); } get { - int ret = freeswitchPINVOKE.switch_codec_settings_pp_dereverb_get(swigCPtr); - return ret; - } - } - - public float pp_dereverb_decay { - set { - freeswitchPINVOKE.switch_codec_settings_pp_dereverb_decay_set(swigCPtr, value); - } - get { - float ret = freeswitchPINVOKE.switch_codec_settings_pp_dereverb_decay_get(swigCPtr); - return ret; - } - } - - public float pp_dereverb_level { - set { - freeswitchPINVOKE.switch_codec_settings_pp_dereverb_level_set(swigCPtr, value); - } - get { - float ret = freeswitchPINVOKE.switch_codec_settings_pp_dereverb_level_get(swigCPtr); + int ret = freeswitchPINVOKE.switch_codec_settings_unused_get(swigCPtr); return ret; } } @@ -29575,12 +29491,12 @@ public class switch_t38_options_t : IDisposable { } } - public uint remote_port { + public ushort remote_port { set { freeswitchPINVOKE.switch_t38_options_t_remote_port_set(swigCPtr, value); } get { - uint ret = freeswitchPINVOKE.switch_t38_options_t_remote_port_get(swigCPtr); + ushort ret = freeswitchPINVOKE.switch_t38_options_t_remote_port_get(swigCPtr); return ret; } } @@ -29595,12 +29511,12 @@ public class switch_t38_options_t : IDisposable { } } - public uint local_port { + public ushort local_port { set { freeswitchPINVOKE.switch_t38_options_t_local_port_set(swigCPtr, value); } get { - uint ret = freeswitchPINVOKE.switch_t38_options_t_local_port_get(swigCPtr); + ushort ret = freeswitchPINVOKE.switch_t38_options_t_local_port_get(swigCPtr); return ret; } } diff --git a/src/mod/languages/mod_perl/mod_perl_wrap.cpp b/src/mod/languages/mod_perl/mod_perl_wrap.cpp index b615b9d..370c88b 100644 --- a/src/mod/languages/mod_perl/mod_perl_wrap.cpp +++ b/src/mod/languages/mod_perl/mod_perl_wrap.cpp @@ -6637,6 +6637,7 @@ XS(_wrap_CoreSession_read) { char *arg4 = (char *) 0 ; int arg5 ; char *arg6 = (char *) 0 ; + int arg7 = (int) 0 ; char *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -6652,11 +6653,13 @@ XS(_wrap_CoreSession_read) { int res6 ; char *buf6 = 0 ; int alloc6 = 0 ; + int val7 ; + int ecode7 = 0 ; int argvi = 0; dXSARGS; - if ((items < 6) || (items > 6)) { - SWIG_croak("Usage: CoreSession_read(self,min_digits,max_digits,prompt_audio_file,timeout,valid_terminators);"); + if ((items < 6) || (items > 7)) { + SWIG_croak("Usage: CoreSession_read(self,min_digits,max_digits,prompt_audio_file,timeout,valid_terminators,digit_timeout);"); } res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); if (!SWIG_IsOK(res1)) { @@ -6688,7 +6691,14 @@ XS(_wrap_CoreSession_read) { SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_read" "', argument " "6"" of type '" "char const *""'"); } arg6 = reinterpret_cast< char * >(buf6); - result = (char *)(arg1)->read(arg2,arg3,(char const *)arg4,arg5,(char const *)arg6); + if (items > 6) { + ecode7 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(6), &val7); + if (!SWIG_IsOK(ecode7)) { + SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "CoreSession_read" "', argument " "7"" of type '" "int""'"); + } + arg7 = static_cast< int >(val7); + } + result = (char *)(arg1)->read(arg2,arg3,(char const *)arg4,arg5,(char const *)arg6,arg7); ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ; @@ -6696,6 +6706,7 @@ XS(_wrap_CoreSession_read) { if (alloc4 == SWIG_NEWOBJ) delete[] buf4; if (alloc6 == SWIG_NEWOBJ) delete[] buf6; + XSRETURN(argvi); fail: @@ -6704,6 +6715,7 @@ XS(_wrap_CoreSession_read) { if (alloc4 == SWIG_NEWOBJ) delete[] buf4; if (alloc6 == SWIG_NEWOBJ) delete[] buf6; + SWIG_croak_null(); } } @@ -6721,6 +6733,7 @@ XS(_wrap_CoreSession_playAndGetDigits) { char *arg8 = (char *) 0 ; char *arg9 = (char *) 0 ; char *arg10 = (char *) NULL ; + int arg11 = (int) 0 ; char *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -6747,11 +6760,13 @@ XS(_wrap_CoreSession_playAndGetDigits) { int res10 ; char *buf10 = 0 ; int alloc10 = 0 ; + int val11 ; + int ecode11 = 0 ; int argvi = 0; dXSARGS; - if ((items < 9) || (items > 10)) { - SWIG_croak("Usage: CoreSession_playAndGetDigits(self,min_digits,max_digits,max_tries,timeout,terminators,audio_files,bad_input_audio_files,digits_regex,var_name);"); + if ((items < 9) || (items > 11)) { + SWIG_croak("Usage: CoreSession_playAndGetDigits(self,min_digits,max_digits,max_tries,timeout,terminators,audio_files,bad_input_audio_files,digits_regex,var_name,digit_timeout);"); } res1 = SWIG_ConvertPtr(ST(0), &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); if (!SWIG_IsOK(res1)) { @@ -6805,7 +6820,14 @@ XS(_wrap_CoreSession_playAndGetDigits) { } arg10 = reinterpret_cast< char * >(buf10); } - result = (char *)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,(char const *)arg10); + if (items > 10) { + ecode11 = SWIG_AsVal_int SWIG_PERL_CALL_ARGS_2(ST(10), &val11); + if (!SWIG_IsOK(ecode11)) { + SWIG_exception_fail(SWIG_ArgError(ecode11), "in method '" "CoreSession_playAndGetDigits" "', argument " "11"" of type '" "int""'"); + } + arg11 = static_cast< int >(val11); + } + result = (char *)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,(char const *)arg10,arg11); ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ; @@ -6817,6 +6839,7 @@ XS(_wrap_CoreSession_playAndGetDigits) { if (alloc8 == SWIG_NEWOBJ) delete[] buf8; if (alloc9 == SWIG_NEWOBJ) delete[] buf9; if (alloc10 == SWIG_NEWOBJ) delete[] buf10; + XSRETURN(argvi); fail: @@ -6829,6 +6852,7 @@ XS(_wrap_CoreSession_playAndGetDigits) { if (alloc8 == SWIG_NEWOBJ) delete[] buf8; if (alloc9 == SWIG_NEWOBJ) delete[] buf9; if (alloc10 == SWIG_NEWOBJ) delete[] buf10; + SWIG_croak_null(); } } @@ -9708,17 +9732,17 @@ XS(SWIG_init) { SWIG_TypeClientData(SWIGTYPE_p_IVRMenu, (void*) "freeswitch::IVRMenu"); SWIG_TypeClientData(SWIGTYPE_p_API, (void*) "freeswitch::API"); SWIG_TypeClientData(SWIGTYPE_p_input_callback_state, (void*) "freeswitch::input_callback_state_t"); - /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_HUP", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_HUP))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; - /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_FREE", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_FREE))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; - /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_RDLOCK", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_RDLOCK))); SvREADONLY_on(sv); diff --git a/src/mod/languages/mod_python/mod_python_wrap.cpp b/src/mod/languages/mod_python/mod_python_wrap.cpp index 8dc32a2..0907bec 100644 --- a/src/mod/languages/mod_python/mod_python_wrap.cpp +++ b/src/mod/languages/mod_python/mod_python_wrap.cpp @@ -7025,6 +7025,7 @@ SWIGINTERN PyObject *_wrap_CoreSession_read(PyObject *SWIGUNUSEDPARM(self), PyOb char *arg4 = (char *) 0 ; int arg5 ; char *arg6 = (char *) 0 ; + int arg7 = (int) 0 ; char *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -7040,14 +7041,17 @@ SWIGINTERN PyObject *_wrap_CoreSession_read(PyObject *SWIGUNUSEDPARM(self), PyOb int res6 ; char *buf6 = 0 ; int alloc6 = 0 ; + int val7 ; + int ecode7 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; PyObject * obj3 = 0 ; PyObject * obj4 = 0 ; PyObject * obj5 = 0 ; + PyObject * obj6 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOO:CoreSession_read",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOO|O:CoreSession_read",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_read" "', argument " "1"" of type '" "CoreSession *""'"); @@ -7078,7 +7082,14 @@ SWIGINTERN PyObject *_wrap_CoreSession_read(PyObject *SWIGUNUSEDPARM(self), PyOb SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "CoreSession_read" "', argument " "6"" of type '" "char const *""'"); } arg6 = reinterpret_cast< char * >(buf6); - result = (char *)(arg1)->read(arg2,arg3,(char const *)arg4,arg5,(char const *)arg6); + if (obj6) { + ecode7 = SWIG_AsVal_int(obj6, &val7); + if (!SWIG_IsOK(ecode7)) { + SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "CoreSession_read" "', argument " "7"" of type '" "int""'"); + } + arg7 = static_cast< int >(val7); + } + result = (char *)(arg1)->read(arg2,arg3,(char const *)arg4,arg5,(char const *)arg6,arg7); resultobj = SWIG_FromCharPtr((const char *)result); if (alloc4 == SWIG_NEWOBJ) delete[] buf4; if (alloc6 == SWIG_NEWOBJ) delete[] buf6; @@ -7102,6 +7113,7 @@ SWIGINTERN PyObject *_wrap_CoreSession_playAndGetDigits(PyObject *SWIGUNUSEDPARM char *arg8 = (char *) 0 ; char *arg9 = (char *) 0 ; char *arg10 = (char *) NULL ; + int arg11 = (int) 0 ; char *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; @@ -7128,6 +7140,8 @@ SWIGINTERN PyObject *_wrap_CoreSession_playAndGetDigits(PyObject *SWIGUNUSEDPARM int res10 ; char *buf10 = 0 ; int alloc10 = 0 ; + int val11 ; + int ecode11 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; @@ -7138,8 +7152,9 @@ SWIGINTERN PyObject *_wrap_CoreSession_playAndGetDigits(PyObject *SWIGUNUSEDPARM PyObject * obj7 = 0 ; PyObject * obj8 = 0 ; PyObject * obj9 = 0 ; + PyObject * obj10 = 0 ; - if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO|O:CoreSession_playAndGetDigits",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9)) SWIG_fail; + if (!PyArg_ParseTuple(args,(char *)"OOOOOOOOO|OO:CoreSession_playAndGetDigits",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6,&obj7,&obj8,&obj9,&obj10)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_CoreSession, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "CoreSession_playAndGetDigits" "', argument " "1"" of type '" "CoreSession *""'"); @@ -7192,7 +7207,14 @@ SWIGINTERN PyObject *_wrap_CoreSession_playAndGetDigits(PyObject *SWIGUNUSEDPARM } arg10 = reinterpret_cast< char * >(buf10); } - result = (char *)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,(char const *)arg10); + if (obj10) { + ecode11 = SWIG_AsVal_int(obj10, &val11); + if (!SWIG_IsOK(ecode11)) { + SWIG_exception_fail(SWIG_ArgError(ecode11), "in method '" "CoreSession_playAndGetDigits" "', argument " "11"" of type '" "int""'"); + } + arg11 = static_cast< int >(val11); + } + result = (char *)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,(char const *)arg10,arg11); resultobj = SWIG_FromCharPtr((const char *)result); if (alloc6 == SWIG_NEWOBJ) delete[] buf6; if (alloc7 == SWIG_NEWOBJ) delete[] buf7; commit c87b60278e5cff1d946e1711a06cac6b3b29cc09 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Oct 1 09:30:32 2010 -0500 FS-2748 diff --git a/conf/sip_profiles/internal.xml b/conf/sip_profiles/internal.xml index 1c2ef12..50833bf 100644 --- a/conf/sip_profiles/internal.xml +++ b/conf/sip_profiles/internal.xml @@ -226,6 +226,8 @@ <!--all inbound reg will stored in the db using this domain --> <param name="force-register-db-domain" value="$${domain}"/> + <!--<param name="delete-subs-on-register" value="false"/>--> + <!-- enable rtcp on every channel also can be done per leg basis with rtcp_audio_interval_msec variable set to passthru to pass it across a call--> <!--<param name="rtcp-audio-interval-msec" value="5000"/>--> <!--<param name="rtcp-video-interval-msec" value="5000"/>--> diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 0cd4b27..5674046 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -220,6 +220,7 @@ typedef enum { PFLAG_T38_PASSTHRU, PFLAG_CID_IN_1XX, PFLAG_IN_DIALOG_CHAT, + PFLAG_DEL_SUBS_ON_REG, /* No new flags below this line */ PFLAG_MAX } PFLAGS; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 562a091..aa208c2 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2265,6 +2265,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) } else { sofia_clear_pflag(profile, PFLAG_PASS_CALLEE_ID); } + } else if (!strcasecmp(var, "delete-subs-on-register")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_DEL_SUBS_ON_REG); + } else { + sofia_clear_pflag(profile, PFLAG_DEL_SUBS_ON_REG); + } } else if (!strcasecmp(var, "in-dialog-chat")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_IN_DIALOG_CHAT); @@ -2949,6 +2955,12 @@ switch_status_t config_sofia(int reload, char *profile_name) } else { sofia_clear_pflag(profile, PFLAG_IN_DIALOG_CHAT); } + } else if (!strcasecmp(var, "delete-subs-on-register")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_DEL_SUBS_ON_REG); + } else { + sofia_clear_pflag(profile, PFLAG_DEL_SUBS_ON_REG); + } } else if (!strcasecmp(var, "t38-passthru")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_T38_PASSTHRU); diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 4f35ac0..285dc8a 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -820,9 +820,10 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand switch_event_t *auth_params = NULL; int r = 0; long reg_count = 0; - int delete_subs = 1; + int delete_subs; const char *agent = "unknown"; + delete_subs = sofia_test_pflag(profile, PFLAG_DEL_SUBS_ON_REG); /* all callers must confirm that sip, sip->sip_request and sip->sip_contact are not NULL */ switch_assert(sip != NULL && sip->sip_contact != NULL && sip->sip_request != NULL); @@ -841,10 +842,6 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand if (sip->sip_user_agent) { agent = sip->sip_user_agent->g_string; - - if (switch_stristr("snom", agent)) { - delete_subs = 0; - } } if (from) { commit 2bcca2429f4ad6171d8d2d8f3d1ed27e9f9f0d9e Author: Moises Silva <moy@sangoma.com> Date: Fri Oct 1 07:06:39 2010 -0400 mod_sangoma_codec: non-blocking reads ... again diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index 3eae901..d2e1e1c 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -128,6 +128,9 @@ struct codec_data { long lastrxseqno; unsigned long rxlost; + /* discarded silence packets */ + unsigned long rxdiscarded; + /* avg Rx time */ switch_time_t avgrxus; switch_time_t last_rx_time; @@ -403,26 +406,31 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec sess->encoder.tx++; /* do the reading */ - memset(&encoded_frame, 0, sizeof(encoded_frame)); - sres = switch_rtp_zerocopy_read_frame(sess->encoder.rxrtp, &encoded_frame, SWITCH_IO_FLAG_NOBLOCK); - if (sres == SWITCH_STATUS_GENERR) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to read on Sangoma encoder RTP session: %d\n", sres); - return SWITCH_STATUS_FALSE; - } + for ( ; ; ) { + sres = switch_rtp_zerocopy_read_frame(sess->encoder.rxrtp, &encoded_frame, SWITCH_IO_FLAG_NOBLOCK); + if (sres == SWITCH_STATUS_GENERR) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to read on Sangoma encoder RTP session: %d\n", sres); + return SWITCH_STATUS_FALSE; + } - if (0 == encoded_frame.datalen) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No output on Sangoma encoder RTP session.\n"); - return SWITCH_STATUS_SUCCESS; - } + if (0 == encoded_frame.datalen) { + break; + } - if (encoded_frame.payload != codec->implementation->ianacode - && encoded_frame.payload != IANACODE_CN) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read unexpected payload %d in Sangoma encoder RTP session, expecting %d\n", - encoded_frame.payload, codec->implementation->ianacode); - return SWITCH_STATUS_FALSE; + if (encoded_frame.payload != codec->implementation->ianacode + && encoded_frame.payload != IANACODE_CN) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read unexpected payload %d in Sangoma encoder RTP session, expecting %d\n", + encoded_frame.payload, codec->implementation->ianacode); + break; + } + + if (*encoded_data_len) { + sess->encoder.rxdiscarded++; + } + + memcpy(encoded_data, encoded_frame.data, encoded_frame.datalen); + *encoded_data_len = encoded_frame.datalen; } - memcpy(encoded_data, encoded_frame.data, encoded_frame.datalen); - *encoded_data_len = encoded_frame.datalen; /* update encoding stats */ sess->encoder.rx++; @@ -517,30 +525,34 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses sess->decoder.tx++; /* do the reading */ - memset(&ulaw_frame, 0, sizeof(ulaw_frame)); - sres = switch_rtp_zerocopy_read_frame(sess->decoder.rxrtp, &ulaw_frame, SWITCH_IO_FLAG_NOBLOCK); - if (sres == SWITCH_STATUS_GENERR) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to read on Sangoma decoder RTP session: %d\n", sres); - return SWITCH_STATUS_FALSE; - } + for ( ; ; ) { + sres = switch_rtp_zerocopy_read_frame(sess->decoder.rxrtp, &ulaw_frame, SWITCH_IO_FLAG_NOBLOCK); + if (sres == SWITCH_STATUS_GENERR) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to read on Sangoma decoder RTP session: %d\n", sres); + return SWITCH_STATUS_FALSE; + } - if (0 == ulaw_frame.datalen) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No output on Sangoma decoder RTP session.\n"); - return SWITCH_STATUS_SUCCESS; - } + if (0 == ulaw_frame.datalen) { + break; + } - if (ulaw_frame.payload != IANA_ULAW - && ulaw_frame.payload != IANACODE_CN) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read unexpected payload %d in Sangoma decoder RTP session, expecting %d\n", - ulaw_frame.payload, IANA_ULAW); - return SWITCH_STATUS_FALSE; - } + if (ulaw_frame.payload != IANA_ULAW + && ulaw_frame.payload != IANACODE_CN) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read unexpected payload %d in Sangoma decoder RTP session, expecting %d\n", + ulaw_frame.payload, IANA_ULAW); + break; + } - /* transcode to linear */ - for (i = 0; i < ulaw_frame.datalen; i++) { - dbuf_linear[i] = ulaw_to_linear(((char *)ulaw_frame.data)[i]); + if (*decoded_data_len) { + sess->decoder.rxdiscarded++; + } + + /* transcode to linear */ + for (i = 0; i < ulaw_frame.datalen; i++) { + dbuf_linear[i] = ulaw_to_linear(((char *)ulaw_frame.data)[i]); + } + *decoded_data_len = i * 2; } - *decoded_data_len = i * 2; /* update decoding stats */ sess->decoder.rx++; @@ -714,6 +726,7 @@ SWITCH_STANDARD_API(sangoma_function) if (sess->encoder.rxrtp) { stats = switch_rtp_get_stats(sess->encoder.rxrtp, NULL); stream->write_function(stream, "-- Encoder Inbound Stats --\n"); + stream->write_function(stream, "Rx Discarded: %lu\n", sess->encoder.rxdiscarded); sangoma_print_stats(stream, &stats->inbound); @@ -725,6 +738,7 @@ SWITCH_STANDARD_API(sangoma_function) if (sess->decoder.rxrtp) { stats = switch_rtp_get_stats(sess->decoder.rxrtp, NULL); stream->write_function(stream, "-- Decoder Inbound Stats --\n"); + stream->write_function(stream, "Rx Discarded: %lu\n", sess->decoder.rxdiscarded); sangoma_print_stats(stream, &stats->inbound); stats = switch_rtp_get_stats(sess->decoder.txrtp, NULL); commit 41bb745c2a73964671eaa4bf59307937ca5c19f3 Author: Moises Silva <moy@sangoma.com> Date: Thu Sep 30 17:58:10 2010 -0400 freetdm: add mkrelease.sh script diff --git a/libs/freetdm/README b/libs/freetdm/README index 2c2119f..4ca13d1 100644 --- a/libs/freetdm/README +++ b/libs/freetdm/README @@ -1,3 +1,3 @@ -FREETDM (WORK IN PROGRESS) +FreeTDM +http://wiki.freeswitch.org/wiki/FreeTDM -*shrug* diff --git a/libs/freetdm/mkrelease.sh b/libs/freetdm/mkrelease.sh new file mode 100755 index 0000000..58d1761 --- /dev/null +++ b/libs/freetdm/mkrelease.sh @@ -0,0 +1,64 @@ +#!/bin/bash +INSTALLPREFIX="/usr/local/freetdm" +VERSION="" +NODOCS="NO" + +for i in $* +do + case $i in + --version=*) + VERSION=`echo $i | sed 's/[-a-zA-Z0-9]*=//'` + ;; + --prefix=*) + INSTALLPREFIX=`echo $i | sed 's/[-a-zA-Z0-9]*=//'` + ;; + --nodocs) + NODOCS="YES" + ;; + *) + # unknown option + echo "Unknown option $i" + exit + ;; + esac +done + +if [ "x$VERSION" = "x" ] +then + echo "Provide a version number with --version=<version>" + exit 1 +fi + +if [ ! -d $INSTALLPREFIX ] +then + mkdir -p $INSTALLPREFIX || exit 1 +fi + +make clean +make mod_freetdm-clean +if [ $NODOCS = "NO" ] +then + make dox || exit 1 +fi + +major=$(echo "$VERSION" | cut -d. -f1) +minor=$(echo "$VERSION" | cut -d. -f2) +micro=$(echo "$VERSION" | cut -d. -f3) +release="freetdm-$VERSION" + +echo "Creating $release ($major.$minor.$micro) at $INSTALLPREFIX/$release (directory will be removed if exists already) ... press any key to continue" +read + +mkdir -p $INSTALLPREFIX/$release + +cp -r ./* $INSTALLPREFIX/$release + +find $INSTALLPREFIX/ -name .libs -exec rm -rf {} \; +find $INSTALLPREFIX/ -name .deps -exec rm -rf {} \; +find $INSTALLPREFIX/ -name *.so -exec rm -rf {} \; +find $INSTALLPREFIX/ -name *.lo -exec rm -rf {} \; + + +tar -C $INSTALLPREFIX -czf $INSTALLPREFIX/$release.tar.gz $release/ + + commit 758f3831fdb72ffe6a1fbe4067cb8872be32ff0f Author: Michael S Collins <msc@freeswitch.org> Date: Thu Sep 30 13:30:36 2010 -0700 Add new phrases to be recorded diff --git a/docs/phrase/phrase_en.xml b/docs/phrase/phrase_en.xml index 65c394c..d519350 100644 --- a/docs/phrase/phrase_en.xml +++ b/docs/phrase/phrase_en.xml @@ -395,6 +395,8 @@ <prompt phrase="Congratulations, you pressed star. This does not mean you ARE a star. It simply means that you can press buttons and probably have fingers." filename="ivr-congratulations_you_pressed_star.wav"/> <prompt phrase="All of our engineers are busy assisting other sales guys with demonstrating how cool the CudaTel is. Please stay on the line and your call will be answered in the order it was received." filename="ivr-engineers_busy_assisting_other_sales.wav"/> <prompt phrase="" filename="ivr-.wav"/> + <prompt phrase="You are already muted." filename="conf-you_are_already_muted.wav"/> + <prompt phrase="You are now bi-directionally muted." filename="conf-you_are_now_bidirectionally_muted.wav"/> </ivr> <misc> commit f8c9ef5f9deca6345f3d598c4f511b4a21f237bb Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Sep 30 15:15:33 2010 -0500 fix codec regression from yesterday diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 6cf7212..e5d70c4 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -177,6 +177,23 @@ static inline switch_bool_t switch_is_digit_string(const char *s) return SWITCH_TRUE; } + +static inline uint32_t switch_known_bitrate(switch_payload_t payload) +{ + switch(payload) { + case 0: /* PCMU */ return 64000; + case 3: /* GSM */ return 13200; + case 4: /* G723 */ return 6300; + case 7: /* LPC */ return 2400; + case 8: /* PCMA */ return 64000; + case 9: /* G722 */ return 64000; + case 18: /* G729 */ return 8000; + default: break; + } + + return 0; +} + SWITCH_DECLARE(switch_size_t) switch_fd_read_line(int fd, char *buf, switch_size_t len); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index f1d2dcf..e4933c6 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -4148,8 +4148,6 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s for (map = m->m_rtpmaps; map; map = map->rm_next) { int32_t i; uint32_t near_rate = 0; - uint32_t near_bit_rate = 0; - switch_codec_interface_t *codec_interface; const switch_codec_implementation_t *mimp = NULL, *near_match = NULL; const char *rm_encoding; uint32_t map_bit_rate = 0; @@ -4197,22 +4195,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s ptime = switch_default_ptime(rm_encoding, map->rm_pt); } - /* This will try to use codec specific fmtp parser */ - if (map->rm_fmtp && (codec_interface = switch_loadable_module_get_codec_interface(rm_encoding)) != 0) { - switch_codec_fmtp_t codec_fmtp; - memset(&codec_fmtp, '\0', sizeof(struct switch_codec_fmtp)); - codec_fmtp.actual_samples_per_second = map->rm_rate; - if (codec_interface->parse_fmtp && codec_interface->parse_fmtp(map->rm_fmtp, &codec_fmtp) == SWITCH_STATUS_SUCCESS) { - if (codec_fmtp.bits_per_second) { - map_bit_rate = codec_fmtp.bits_per_second; - } - if (codec_fmtp.microseconds_per_packet) { - ptime = (codec_fmtp.microseconds_per_packet / 1000); - } - } - UNPROTECT_INTERFACE(codec_interface); - } - + map_bit_rate = switch_known_bitrate(map->rm_pt); if (!codec_ms) { codec_ms = ptime; @@ -4235,19 +4218,19 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s match = strcasecmp(rm_encoding, imp->iananame) ? 0 : 1; } + if (match && bit_rate && map_bit_rate && map_bit_rate != bit_rate) { + /* nevermind */ + match = 0; + } + if (match) { if (scrooge) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Bah HUMBUG! Sticking with %s@%uh@%ui\n", imp->iananame, imp->samples_per_second, imp->microseconds_per_packet / 1000); } else { - if ((codec_ms && codec_ms * 1000 != imp->microseconds_per_packet) || map->rm_rate != codec_rate || (map_bit_rate && map_bit_rate != bit_rate) ) { + if ((codec_ms && codec_ms * 1000 != imp->microseconds_per_packet) || map->rm_rate != codec_rate) { near_rate = map->rm_rate; - if (map_bit_rate) { - near_bit_rate = map_bit_rate; - } else { - near_bit_rate = bit_rate; - } near_match = imp; match = 0; continue; @@ -4260,7 +4243,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s } } - if (!match && near_match && !map->rm_next) { + if (!match && near_match) { const switch_codec_implementation_t *search[1]; char *prefs[1]; char tmp[80]; diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 5466c18..7e08f71 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -183,8 +183,9 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable if (load_interface) { for (impl = ptr->implementations; impl; impl = impl->next) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, - "Adding Codec '%s' (%s) %dhz %dms %dbps\n", - impl->iananame, ptr->interface_name, impl->actual_samples_per_second, impl->microseconds_per_packet / 1000, impl->bits_per_second); + "Adding Codec %s %d %s %dhz %dms %dbps\n", + impl->iananame, impl->ianacode, + ptr->interface_name, impl->actual_samples_per_second, impl->microseconds_per_packet / 1000, impl->bits_per_second); if (!switch_core_hash_find(loadable_modules.codec_hash, impl->iananame)) { switch_core_hash_insert(loadable_modules.codec_hash, impl->iananame, (const void *) ptr); } @@ -515,8 +516,9 @@ static switch_status_t switch_loadable_module_unprocess(switch_loadable_module_t if (load_interface) { for (impl = ptr->implementations; impl; impl = impl->next) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, - "Deleting Codec '%s' (%s) %dhz %dms\n", - impl->iananame, ptr->interface_name, impl->actual_samples_per_second, impl->microseconds_per_packet / 1000); + "Deleting Codec %s %d %s %dhz %dms\n", + impl->iananame, impl->ianacode, + ptr->interface_name, impl->actual_samples_per_second, impl->microseconds_per_packet / 1000); switch_core_session_hupall_matching_var("read_codec", impl->iananame, SWITCH_CAUSE_MANAGER_REQUEST); switch_core_session_hupall_matching_var("write_codec", impl->iananame, SWITCH_CAUSE_MANAGER_REQUEST); if (switch_core_hash_find(loadable_modules.codec_hash, impl->iananame)) { commit 400c785d4e4e94738f5b11cd95e4edd56f41f93d Author: Moises Silva <moy@sangoma.com> Date: Thu Sep 30 15:47:01 2010 -0400 add rtpip documentation to sangoma_codec.conf.xml diff --git a/conf/autoload_configs/sangoma_codec.conf.xml b/conf/autoload_configs/sangoma_codec.conf.xml index 14fae63..05d70de 100644 --- a/conf/autoload_configs/sangoma_codec.conf.xml +++ b/conf/autoload_configs/sangoma_codec.conf.xml @@ -23,6 +23,13 @@ to listen for HTTP requests on the same IP/port that you specify here. <param name="soapserver" value="http://192.168.1.100:8080"/> --> + + <!-- + RTP IP to use + By default, this module asks FreeSWITCH for the local ip address. However if you want to use a specific + IP address you can set it here. + <param name="rtpip" value="192.168.1.1"/> + --> </settings> </configuration> commit 03e74c51f9c326258c82e579754d9ec4c99bd4c2 Author: Brian West <brian@freeswitch.org> Date: Thu Sep 30 10:08:20 2010 -0500 FS-526: improve nat handling when using stun or host as ext-rtp-ip diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 9d4b0ae..f1d2dcf 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -872,32 +872,30 @@ switch_status_t sofia_glue_tech_choose_port(private_object_t *tech_pvt, int forc sdp_port = tech_pvt->local_sdp_audio_port; - if (!(use_ip = switch_channel_get_variable(tech_pvt->channel, "rtp_adv_audio_ip")) - && !zstr(tech_pvt->profile->extrtpip)) { - use_ip = tech_pvt->profile->extrtpip; - } + /* Check if NAT is detected */ + if (!zstr(tech_pvt->remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { + /* Yes, map the port through switch_nat */ + switch_nat_add_mapping(tech_pvt->local_sdp_audio_port, SWITCH_NAT_UDP, &sdp_port, SWITCH_FALSE); + switch_nat_add_mapping(tech_pvt->local_sdp_audio_port + 1, SWITCH_NAT_UDP, &rtcp_port, SWITCH_FALSE); - if (use_ip) { - if (sofia_glue_ext_address_lookup(tech_pvt->profile, tech_pvt, &lookup_rtpip, &sdp_port, - use_ip, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { - /* Address lookup was required and fail (external ip was "host:..." or "stun:...") */ - return SWITCH_STATUS_FALSE; - } else { - if (lookup_rtpip == use_ip) { - /* sofia_glue_ext_address_lookup didn't return any error, but the return IP is the same as the original one, - which means no lookup was necessary. Check if NAT is detected */ - if (!zstr(tech_pvt->remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { - /* Yes, map the port through switch_nat */ - switch_nat_add_mapping(tech_pvt->local_sdp_audio_port, SWITCH_NAT_UDP, &sdp_port, SWITCH_FALSE); - switch_nat_add_mapping(tech_pvt->local_sdp_audio_port + 1, SWITCH_NAT_UDP, &rtcp_port, SWITCH_FALSE); - } else { - /* No NAT detected */ - use_ip = tech_pvt->rtpip; - } + /* Find an IP address to use */ + if (!(use_ip = switch_channel_get_variable(tech_pvt->channel, "rtp_adv_audio_ip")) + && !zstr(tech_pvt->profile->extrtpip)) { + use_ip = tech_pvt->profile->extrtpip; + } + + if (use_ip) { + if (sofia_glue_ext_address_lookup(tech_pvt->profile, tech_pvt, &lookup_rtpip, &sdp_port, + use_ip, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { + /* Address lookup was required and fail (external ip was "host:..." or "stun:...") */ + return SWITCH_STATUS_FALSE; } else { /* Address properly resolved, use it as external ip */ use_ip = lookup_rtpip; } + } else { + /* No external ip found, use the profile's rtp ip */ + use_ip = tech_pvt->rtpip; } } else { /* No NAT traversal required, use the profile's rtp ip */ @@ -941,31 +939,29 @@ switch_status_t sofia_glue_tech_choose_video_port(private_object_t *tech_pvt, in sdp_port = tech_pvt->local_sdp_video_port; - if (!(use_ip = switch_channel_get_variable(tech_pvt->channel, "rtp_adv_video_ip")) - && !zstr(tech_pvt->profile->extrtpip)) { - use_ip = tech_pvt->profile->extrtpip; - } + /* Check if NAT is detected */ + if (!zstr(tech_pvt->remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { + /* Yes, map the port through switch_nat */ + switch_nat_add_mapping(tech_pvt->local_sdp_video_port, SWITCH_NAT_UDP, &sdp_port, SWITCH_FALSE); - if (use_ip) { - if (sofia_glue_ext_address_lookup(tech_pvt->profile, tech_pvt, &lookup_rtpip, &sdp_port, - use_ip, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { - /* Address lookup was required and fail (external ip was "host:..." or "stun:...") */ - return SWITCH_STATUS_FALSE; - } else { - if (lookup_rtpip == use_ip) { - /* sofia_glue_ext_address_lookup didn't return any error, but the return IP is the same as the original one, - which means no lookup was necessary. Check if NAT is detected */ - if (!zstr(tech_pvt->remote_ip) && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { - /* Yes, map the port through switch_nat */ - switch_nat_add_mapping(tech_pvt->local_sdp_video_port, SWITCH_NAT_UDP, &sdp_port, SWITCH_FALSE); - } else { - /* No NAT detected */ - use_ip = tech_pvt->rtpip; - } + /* Find an IP address to use */ + if (!(use_ip = switch_channel_get_variable(tech_pvt->channel, "rtp_adv_video_ip")) + && !zstr(tech_pvt->profile->extrtpip)) { + use_ip = tech_pvt->profile->extrtpip; + } + + if (use_ip) { + if (sofia_glue_ext_address_lookup(tech_pvt->profile, tech_pvt, &lookup_rtpip, &sdp_port, + use_ip, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { + /* Address lookup was required and fail (external ip was "host:..." or "stun:...") */ + return SWITCH_STATUS_FALSE; } else { /* Address properly resolved, use it as external ip */ use_ip = lookup_rtpip; } + } else { + /* No external ip found, use the profile's rtp ip */ + use_ip = tech_pvt->rtpip; } } else { /* No NAT traversal required, use the profile's rtp ip */ commit 23f71563fb4aece0ae2b1e27bf09eaf596d8bc61 Author: Brian West <brian@freeswitch.org> Date: Mon Sep 27 21:43:02 2010 -0500 doh backwards diff --git a/scripts/perl/blacklist.pl b/scripts/perl/blacklist.pl index d6c2ea7..f434669 100755 --- a/scripts/perl/blacklist.pl +++ b/scripts/perl/blacklist.pl @@ -15,15 +15,15 @@ use LWP::Simple; my @addresses = split(/\n/, get("http://www.infiltrated.net/voipabuse/addresses.txt")); my @netblocks = split(/\n/, get("http://www.infiltrated.net/voipabuse/netblocks.txt")); -print "<list name=\"voip-abuse-addresses\" default=\"allow\">\n"; +print "<list name=\"voip-abuse-addresses\" default=\"deny\">\n"; foreach $addr (@addresses) { - print " <node type=\"deny\" cidr=\"$addr/32\"/>\n"; + print " <node type=\"allow\" cidr=\"$addr/32\"/>\n"; } print "</list>\n"; -print "<list name=\"voip-abuse-netblocks\" default=\"allow\">\n"; +print "<list name=\"voip-abuse-netblocks\" default=\"deny\">\n"; foreach $netb (@netblocks) { - print " <node type=\"deny\" cidr=\"$netb\"/>\n"; + print " <node type=\"allow\" cidr=\"$netb\"/>\n"; } print "</list>\n"; commit b96f854803bb74ccb0ee9de6a181528934bf6027 Author: Moises Silva <moy@sangoma.com> Date: Thu Sep 30 11:02:53 2010 -0400 freetdm: fix libpri mod diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 6ed1d6e..99c0c86 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -1793,7 +1793,6 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open(uint32_t span_id, uint32_t chan_id, ftdm_channel_t *best_rated = NULL; ftdm_status_t status = FTDM_FAIL; int best_rate = 0; - int may_be_available = 0; *ftdmchan = NULL; @@ -1828,40 +1827,55 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open(uint32_t span_id, uint32_t chan_id, ftdm_mutex_lock(check->mutex); + /* The following if's and gotos replace a big if (this || this || this || this) else { nothing; } */ + + /* if it is not a voice channel, nothing else to check to open it */ + if (!FTDM_IS_VOICE_CHANNEL(check)) { + goto openchan; + } + + /* if it's an FXS device with a call active and has callwaiting enabled, we allow to open it twice */ + if (check->type == FTDM_CHAN_TYPE_FXS + && check->token_count == 1 + && ftdm_channel_test_feature(check, FTDM_CHANNEL_FEATURE_CALLWAITING)) { + goto openchan; + } + + /* if channel is available, time to open it */ + if (chan_is_avail(check)) { + goto openchan; + } + + /* not available, but still might be available ... */ calculate_best_rate(check, &best_rated, &best_rate); if (best_rated) { - may_be_available = 1; + goto openchan; } - /* the channel is only allowed to be open if not in use, or, for FXS devices with a call with call waiting enabled */ - if ( - (check->type == FTDM_CHAN_TYPE_FXS - && check->token_count == 1 - && ftdm_channel_test_feature(check, FTDM_CHANNEL_FEATURE_CALLWAITING)) - || - chan_is_avail(check) - || - (check->type == FTDM_CHAN_TYPE_DQ921 && ftdm_test_flag(check, FTDM_CHANNEL_CONFIGURED) && ftdm_test_flag(check, FTDM_CHANNEL_READY)) - || - may_be_available) { - if (!ftdm_test_flag(check, FTDM_CHANNEL_OPEN)) { - status = check->fio->open(check); - if (status == FTDM_SUCCESS) { - ftdm_set_flag(check, FTDM_CHANNEL_OPEN); - } - } else { - status = FTDM_SUCCESS; + /* channel is unavailable, do not open the channel */ + goto unlockchan; + +openchan: + if (!ftdm_test_flag(check, FTDM_CHANNEL_OPEN)) { + status = check->fio->open(check); + if (status == FTDM_SUCCESS) { + ftdm_set_flag(check, FTDM_CHANNEL_OPEN); } - ftdm_set_flag(check, FTDM_CHANNEL_INUSE); - ftdm_set_flag(check, FTDM_CHANNEL_OUTBOUND); - *ftdmchan = check; + } else { + status = FTDM_SUCCESS; } + ftdm_set_flag(check, FTDM_CHANNEL_INUSE); + ftdm_set_flag(check, FTDM_CHANNEL_OUTBOUND); + *ftdmchan = check; +unlockchan: ftdm_mutex_unlock(check->mutex); done: - ftdm_mutex_unlock(globals.mutex); + if (status != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_ERROR, "Failed to open channel %d:%d\n", span_id, chan_id); + } return status; } diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 77dd3d1..bb62f07 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -1087,10 +1087,17 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) got_d = 1; x++; break; + } else { + ftdm_log(FTDM_LOG_ERROR, "failed to open d-channel #%d %d:%d\n", x, span->channels[i]->span_id, span->channels[i]->chan_id); } } } } + + if (!got_d) { + ftdm_log(FTDM_LOG_ERROR, "Failed to get a D-channel in span %d\n", span->span_id); + break; + } if (lpwrap_init_pri(&isdn_data->spri, @@ -1149,7 +1156,7 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) ftdm_sleep(5000); } - ftdm_log(FTDM_LOG_DEBUG, "PRI thread ended on span %d\n", isdn_data->spri.span->span_id); + ftdm_log(FTDM_LOG_DEBUG, "PRI thread ended on span %d\n", span->span_id); ftdm_clear_flag(span, FTDM_SPAN_IN_THREAD); ftdm_clear_flag(isdn_data, FTMOD_LIBPRI_RUNNING); commit 00207cede371ace29a746864fde5bc13d7159819 Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Thu Sep 30 02:37:57 2010 -0400 freetdm: Initial fix attempt for libpri. It will now load and work. More testing will be required, I got the feeling some event will clean a channel / span of it value when there is timer still active. diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index ba27f0b..6ed1d6e 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -1841,6 +1841,8 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open(uint32_t span_id, uint32_t chan_id, || chan_is_avail(check) || + (check->type == FTDM_CHAN_TYPE_DQ921 && ftdm_test_flag(check, FTDM_CHANNEL_CONFIGURED) && ftdm_test_flag(check, FTDM_CHANNEL_READY)) + || may_be_available) { if (!ftdm_test_flag(check, FTDM_CHANNEL_OPEN)) { status = check->fio->open(check); diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index ba4049a..77dd3d1 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -1133,7 +1133,9 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) } ftdm_log(FTDM_LOG_CRIT, "PRI down on span %d\n", isdn_data->spri.span->span_id); - isdn_data->spri.dchan->state = FTDM_CHANNEL_STATE_DOWN; + if (isdn_data->spri.dchan) { + isdn_data->spri.dchan->state = FTDM_CHANNEL_STATE_DOWN; + } if (!down) { ftdm_set_state_all(span, FTDM_CHANNEL_STATE_RESTART); diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c b/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c index b286ec1..8dfba34 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c @@ -177,7 +177,7 @@ int lpwrap_init_pri(struct lpwrap_pri *spri, ftdm_span_t *span, ftdm_channel_t * spri->dchan = dchan; spri->span = span; - if ((spri->pri = pri_new_cb(spri->dchan->sockfd, node, swtype, __pri_lpwrap_read, __pri_lpwrap_write, spri))){ + if (spri->dchan && (spri->pri = pri_new_cb(spri->dchan->sockfd, node, swtype, __pri_lpwrap_read, __pri_lpwrap_write, spri))){ unsigned char buf[4] = { 0 }; size_t buflen = sizeof(buf), len = 0; pri_set_debug(spri->pri, debug); commit ff8f468d3eeef264f67ec725dc9eb10a26f9b5f1 Author: Michal Bielicki <michal.bielicki@seventhsignal.de> Date: Thu Sep 30 05:54:59 2010 +0200 added mod_nibblebill to standard modules in spec file diff --git a/freeswitch.spec b/freeswitch.spec index 9944f80..52e6226 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -727,7 +727,7 @@ fi %{prefix}/mod/mod_amrwb.so* %{prefix}/mod/mod_avmd.so* %{prefix}/mod/mod_bv.so* -%{prefix}/mod/mod_callcenter* +%{prefix}/mod/mod_callcenter.so* %{prefix}/mod/mod_cdr_csv.so* %{prefix}/mod/mod_celt.so* %{prefix}/mod/mod_cluechoo.so* @@ -762,6 +762,7 @@ fi %{prefix}/mod/mod_loopback.so* %{prefix}/mod/mod_memcache.so* %{prefix}/mod/mod_native_file.so* +%{prefix}/mod/mod_nibblebill.so* %{prefix}/mod/mod_pocketsphinx.so* %{prefix}/mod/mod_portaudio.so* %{prefix}/mod/mod_portaudio_stream.so* @@ -925,6 +926,8 @@ fi # ###################################################################################################################### %changelog +* Thu Sep 30 2010 - michal.bielicki@seventhsignal.de +- added mod_nibblebill to standard modules * Sun Sep 26 2010 - michal.bielicki@seventhsignal.de - added portaudio_stream module - some more formating work commit 3cf08d88b50186984d1eab2ddd2bd75e60413af3 Author: Jeff Lenk <jeff@jefflenk.com> Date: Wed Sep 29 22:47:48 2010 -0500 reswig vs2010 diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx index a922aad..ade6bf8 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx @@ -7872,7 +7872,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_timer_destroy(void * jarg1) { } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_codec_init(void * jarg1, char * jarg2, char * jarg3, unsigned long jarg4, int jarg5, int jarg6, unsigned long jarg7, void * jarg8, void * jarg9) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_codec_init_with_bitrate(void * jarg1, char * jarg2, char * jarg3, unsigned long jarg4, int jarg5, int jarg6, unsigned long jarg7, unsigned long jarg8, void * jarg9, void * jarg10) { int jresult ; switch_codec_t *arg1 = (switch_codec_t *) 0 ; char *arg2 = (char *) 0 ; @@ -7881,8 +7881,9 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_codec_init(void * jarg1, char * ja int arg5 ; int arg6 ; uint32_t arg7 ; - switch_codec_settings_t *arg8 = (switch_codec_settings_t *) 0 ; - switch_memory_pool_t *arg9 = (switch_memory_pool_t *) 0 ; + uint32_t arg8 ; + switch_codec_settings_t *arg9 = (switch_codec_settings_t *) 0 ; + switch_memory_pool_t *arg10 = (switch_memory_pool_t *) 0 ; switch_status_t result; arg1 = (switch_codec_t *)jarg1; @@ -7892,9 +7893,10 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_codec_init(void * jarg1, char * ja arg5 = (int)jarg5; arg6 = (int)jarg6; arg7 = (uint32_t)jarg7; - arg8 = (switch_codec_settings_t *)jarg8; - arg9 = (switch_memory_pool_t *)jarg9; - result = (switch_status_t)switch_core_codec_init(arg1,(char const *)arg2,(char const *)arg3,arg4,arg5,arg6,arg7,(switch_codec_settings const *)arg8,arg9); + arg8 = (uint32_t)jarg8; + arg9 = (switch_codec_settings_t *)jarg9; + arg10 = (switch_memory_pool_t *)jarg10; + result = (switch_status_t)switch_core_codec_init_with_bitrate(arg1,(char const *)arg2,(char const *)arg3,arg4,arg5,arg6,arg7,arg8,(switch_codec_settings const *)arg9,arg10); jresult = result; return jresult; } @@ -19991,372 +19993,148 @@ SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_directory_handle(void * jarg1) } -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_quality_set(void * jarg1, int jarg2) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int arg2 ; - - arg1 = (switch_codec_settings *)jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->quality = arg2; -} - - -SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_quality_get(void * jarg1) { - int jresult ; - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int result; - - arg1 = (switch_codec_settings *)jarg1; - result = (int) ((arg1)->quality); - jresult = result; - return jresult; -} - - -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_complexity_set(void * jarg1, int jarg2) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int arg2 ; - - arg1 = (switch_codec_settings *)jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->complexity = arg2; -} - - -SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_complexity_get(void * jarg1) { - int jresult ; - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int result; - - arg1 = (switch_codec_settings *)jarg1; - result = (int) ((arg1)->complexity); - jresult = result; - return jresult; -} - - -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_enhancement_set(void * jarg1, int jarg2) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int arg2 ; - - arg1 = (switch_codec_settings *)jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->enhancement = arg2; -} - - -SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_enhancement_get(void * jarg1) { - int jresult ; - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int result; - - arg1 = (switch_codec_settings *)jarg1; - result = (int) ((arg1)->enhancement); - jresult = result; - return jresult; -} - - -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_vad_set(void * jarg1, int jarg2) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int arg2 ; - - arg1 = (switch_codec_settings *)jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->vad = arg2; -} - - -SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_vad_get(void * jarg1) { - int jresult ; - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int result; - - arg1 = (switch_codec_settings *)jarg1; - result = (int) ((arg1)->vad); - jresult = result; - return jresult; -} - - -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_vbr_set(void * jarg1, int jarg2) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int arg2 ; - - arg1 = (switch_codec_settings *)jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->vbr = arg2; -} - - -SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_vbr_get(void * jarg1) { - int jresult ; - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int result; - - arg1 = (switch_codec_settings *)jarg1; - result = (int) ((arg1)->vbr); - jresult = result; - return jresult; -} - - -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_vbr_quality_set(void * jarg1, float jarg2) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - float arg2 ; - - arg1 = (switch_codec_settings *)jarg1; - arg2 = (float)jarg2; - if (arg1) (arg1)->vbr_quality = arg2; -} - - -SWIGEXPORT float SWIGSTDCALL CSharp_switch_codec_settings_vbr_quality_get(void * jarg1) { - float jresult ; - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - float result; - - arg1 = (switch_codec_settings *)jarg1; - result = (float) ((arg1)->vbr_quality); - jresult = result; - return jresult; -} - - -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_abr_set(void * jarg1, int jarg2) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int arg2 ; - - arg1 = (switch_codec_settings *)jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->abr = arg2; -} - - -SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_abr_get(void * jarg1) { - int jresult ; - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int result; - - arg1 = (switch_codec_settings *)jarg1; - result = (int) ((arg1)->abr); - jresult = result; - return jresult; -} - - -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_dtx_set(void * jarg1, int jarg2) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int arg2 ; - - arg1 = (switch_codec_settings *)jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->dtx = arg2; -} - - -SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_dtx_get(void * jarg1) { - int jresult ; - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int result; - - arg1 = (switch_codec_settings *)jarg1; - result = (int) ((arg1)->dtx); - jresult = result; - return jresult; -} - - -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_preproc_set(void * jarg1, int jarg2) { +SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_unused_set(void * jarg1, int jarg2) { switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; int arg2 ; arg1 = (switch_codec_settings *)jarg1; arg2 = (int)jarg2; - if (arg1) (arg1)->preproc = arg2; + if (arg1) (arg1)->unused = arg2; } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_preproc_get(void * jarg1) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_unused_get(void * jarg1) { int jresult ; switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; int result; arg1 = (switch_codec_settings *)jarg1; - result = (int) ((arg1)->preproc); + result = (int) ((arg1)->unused); jresult = result; return jresult; } -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_pp_vad_set(void * jarg1, int jarg2) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int arg2 ; - - arg1 = (switch_codec_settings *)jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->pp_vad = arg2; -} - - -SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_pp_vad_get(void * jarg1) { - int jresult ; - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int result; +SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_codec_settings() { + void * jresult ; + switch_codec_settings *result = 0 ; - arg1 = (switch_codec_settings *)jarg1; - result = (int) ((arg1)->pp_vad); - jresult = result; + result = (switch_codec_settings *)new switch_codec_settings(); + jresult = (void *)result; return jresult; } -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_pp_agc_set(void * jarg1, int jarg2) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int arg2 ; - - arg1 = (switch_codec_settings *)jarg1; - arg2 = (int)jarg2; - if (arg1) (arg1)->pp_agc = arg2; -} - - -SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_pp_agc_get(void * jarg1) { - int jresult ; +SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_codec_settings(void * jarg1) { switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - int result; arg1 = (switch_codec_settings *)jarg1; - result = (int) ((arg1)->pp_agc); - jresult = result; - return jresult; + delete arg1; } -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_pp_agc_level_set(void * jarg1, float jarg2) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - float arg2 ; +SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_fmtp_actual_samples_per_second_set(void * jarg1, unsigned long jarg2) { + switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ; + uint32_t arg2 ; - arg1 = (switch_codec_settings *)jarg1; - arg2 = (float)jarg2; - if (arg1) (arg1)->pp_agc_level = arg2; + arg1 = (switch_codec_fmtp *)jarg1; + arg2 = (uint32_t)jarg2; + if (arg1) (arg1)->actual_samples_per_second = arg2; } -SWIGEXPORT float SWIGSTDCALL CSharp_switch_codec_settings_pp_agc_level_get(void * jarg1) { - float jresult ; - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - float result; +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_codec_fmtp_actual_samples_per_second_get(void * jarg1) { + unsigned long jresult ; + switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ; + uint32_t result; - arg1 = (switch_codec_settings *)jarg1; - result = (float) ((arg1)->pp_agc_level); - jresult = result; + arg1 = (switch_codec_fmtp *)jarg1; + result = (uint32_t) ((arg1)->actual_samples_per_second); + jresult = (unsigned long)result; return jresult; } -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_pp_denoise_set(void * jarg1, int jarg2) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; +SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_fmtp_bits_per_second_set(void * jarg1, int jarg2) { + switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ; int arg2 ; - arg1 = (switch_codec_settings *)jarg1; + arg1 = (switch_codec_fmtp *)jarg1; arg2 = (int)jarg2; - if (arg1) (arg1)->pp_denoise = arg2; + if (arg1) (arg1)->bits_per_second = arg2; } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_pp_denoise_get(void * jarg1) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_fmtp_bits_per_second_get(void * jarg1) { int jresult ; - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; + switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ; int result; - arg1 = (switch_codec_settings *)jarg1; - result = (int) ((arg1)->pp_denoise); + arg1 = (switch_codec_fmtp *)jarg1; + result = (int) ((arg1)->bits_per_second); jresult = result; return jresult; } -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_pp_dereverb_set(void * jarg1, int jarg2) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; +SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_fmtp_microseconds_per_packet_set(void * jarg1, int jarg2) { + switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ; int arg2 ; - arg1 = (switch_codec_settings *)jarg1; + arg1 = (switch_codec_fmtp *)jarg1; arg2 = (int)jarg2; - if (arg1) (arg1)->pp_dereverb = arg2; + if (arg1) (arg1)->microseconds_per_packet = arg2; } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_pp_dereverb_get(void * jarg1) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_fmtp_microseconds_per_packet_get(void * jarg1) { int jresult ; - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; + switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ; int result; - arg1 = (switch_codec_settings *)jarg1; - result = (int) ((arg1)->pp_dereverb); - jresult = result; - return jresult; -} - - -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_pp_dereverb_decay_set(void * jarg1, float jarg2) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - float arg2 ; - - arg1 = (switch_codec_settings *)jarg1; - arg2 = (float)jarg2; - if (arg1) (arg1)->pp_dereverb_decay = arg2; -} - - -SWIGEXPORT float SWIGSTDCALL CSharp_switch_codec_settings_pp_dereverb_decay_get(void * jarg1) { - float jresult ; - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - float result; - - arg1 = (switch_codec_settings *)jarg1; - result = (float) ((arg1)->pp_dereverb_decay); + arg1 = (switch_codec_fmtp *)jarg1; + result = (int) ((arg1)->microseconds_per_packet); jresult = result; return jresult; } -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_pp_dereverb_level_set(void * jarg1, float jarg2) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - float arg2 ; +SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_fmtp_private_info_set(void * jarg1, void * jarg2) { + switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ; + void *arg2 = (void *) 0 ; - arg1 = (switch_codec_settings *)jarg1; - arg2 = (float)jarg2; - if (arg1) (arg1)->pp_dereverb_level = arg2; + arg1 = (switch_codec_fmtp *)jarg1; + arg2 = (void *)jarg2; + if (arg1) (arg1)->private_info = arg2; } -SWIGEXPORT float SWIGSTDCALL CSharp_switch_codec_settings_pp_dereverb_level_get(void * jarg1) { - float jresult ; - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; - float result; +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_fmtp_private_info_get(void * jarg1) { + void * jresult ; + switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ; + void *result = 0 ; - arg1 = (switch_codec_settings *)jarg1; - result = (float) ((arg1)->pp_dereverb_level); - jresult = result; + arg1 = (switch_codec_fmtp *)jarg1; + result = (void *) ((arg1)->private_info); + jresult = (void *)result; return jresult; } -SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_codec_settings() { +SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_codec_fmtp() { void * jresult ; - switch_codec_settings *result = 0 ; + switch_codec_fmtp *result = 0 ; - result = (switch_codec_settings *)new switch_codec_settings(); + result = (switch_codec_fmtp *)new switch_codec_fmtp(); jresult = (void *)result; return jresult; } -SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_codec_settings(void * jarg1) { - switch_codec_settings *arg1 = (switch_codec_settings *) 0 ; +SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_codec_fmtp(void * jarg1) { + switch_codec_fmtp *arg1 = (switch_codec_fmtp *) 0 ; - arg1 = (switch_codec_settings *)jarg1; + arg1 = (switch_codec_fmtp *)jarg1; delete arg1; } @@ -20465,28 +20243,6 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_codec_fmtp_out_get(void * jarg1) { } -SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_codec_settings_set(void * jarg1, void * jarg2) { - switch_codec *arg1 = (switch_codec *) 0 ; - switch_codec_settings_t *arg2 = (switch_codec_settings_t *) 0 ; - - arg1 = (switch_codec *)jarg1; - arg2 = (switch_codec_settings_t *)jarg2; - if (arg1) (arg1)->codec_settings = *arg2; -} - - -SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_codec_settings_get(void * jarg1) { - void * jresult ; - switch_codec *arg1 = (switch_codec *) 0 ; - switch_codec_settings_t *result = 0 ; - - arg1 = (switch_codec *)jarg1; - result = (switch_codec_settings_t *)& ((arg1)->codec_settings); - jresult = (void *)result; - return jresult; -} - - SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_flags_set(void * jarg1, unsigned long jarg2) { switch_codec *arg1 = (switch_codec *) 0 ; uint32_t arg2 ; @@ -21162,6 +20918,28 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_interface_implementations_get( } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_interface_parse_fmtp_set(void * jarg1, void * jarg2) { + switch_codec_interface *arg1 = (switch_codec_interface *) 0 ; + switch_core_codec_fmtp_parse_func_t arg2 = (switch_core_codec_fmtp_parse_func_t) 0 ; + + arg1 = (switch_codec_interface *)jarg1; + arg2 = (switch_core_codec_fmtp_parse_func_t)jarg2; + if (arg1) (arg1)->parse_fmtp = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_interface_parse_fmtp_get(void * jarg1) { + void * jresult ; + switch_codec_interface *arg1 = (switch_codec_interface *) 0 ; + switch_core_codec_fmtp_parse_func_t result; + + arg1 = (switch_codec_interface *)jarg1; + result = (switch_core_codec_fmtp_parse_func_t) ((arg1)->parse_fmtp); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_interface_codec_id_set(void * jarg1, unsigned long jarg2) { switch_codec_interface *arg1 = (switch_codec_interface *) 0 ; uint32_t arg2 ; @@ -28169,6 +27947,18 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_get_stats(void * jarg1, void * j } +SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_rtp_check_auto_adj(void * jarg1) { + unsigned char jresult ; + switch_rtp_t *arg1 = (switch_rtp_t *) 0 ; + switch_byte_t result; + + arg1 = (switch_rtp_t *)jarg1; + result = (switch_byte_t)switch_rtp_check_auto_adj(arg1); + jresult = result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_log_node_t_data_set(void * jarg1, char * jarg2) { switch_log_node_t *arg1 = (switch_log_node_t *) 0 ; char *arg2 = (char *) 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs index 8ef4923..01cc84e 100644 --- a/src/mod/languages/mod_managed/managed/swig.2010.cs +++ b/src/mod/languages/mod_managed/managed/swig.2010.cs @@ -1673,8 +1673,8 @@ public class freeswitch { return ret; } - public static switch_status_t switch_core_codec_init(switch_codec codec, string codec_name, string fmtp, uint rate, int ms, int channels, uint flags, switch_codec_settings codec_settings, SWIGTYPE_p_apr_pool_t pool) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_codec_init(switch_codec.getCPtr(codec), codec_name, fmtp, rate, ms, channels, flags, switch_codec_settings.getCPtr(codec_settings), SWIGTYPE_p_apr_pool_t.getCPtr(pool)); + public static switch_status_t switch_core_codec_init_with_bitrate(switch_codec codec, string codec_name, string fmtp, uint rate, int ms, int channels, uint bitrate, uint flags, switch_codec_settings codec_settings, SWIGTYPE_p_apr_pool_t pool) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_codec_init_with_bitrate(switch_codec.getCPtr(codec), codec_name, fmtp, rate, ms, channels, bitrate, flags, switch_codec_settings.getCPtr(codec_settings), SWIGTYPE_p_apr_pool_t.getCPtr(pool)); return ret; } @@ -4605,6 +4605,11 @@ public class freeswitch { return ret; } + public static byte switch_rtp_check_auto_adj(SWIGTYPE_p_switch_rtp rtp_session) { + byte ret = freeswitchPINVOKE.switch_rtp_check_auto_adj(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session)); + return ret; + } + public static switch_status_t switch_log_init(SWIGTYPE_p_apr_pool_t pool, switch_bool_t colorize) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_log_init(SWIGTYPE_p_apr_pool_t.getCPtr(pool), (int)colorize); return ret; @@ -7404,8 +7409,8 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_timer_destroy")] public static extern int switch_core_timer_destroy(HandleRef jarg1); - [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_init")] - public static extern int switch_core_codec_init(HandleRef jarg1, string jarg2, string jarg3, uint jarg4, int jarg5, int jarg6, uint jarg7, HandleRef jarg8, HandleRef jarg9); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_init_with_bitrate")] + public static extern int switch_core_codec_init_with_bitrate(HandleRef jarg1, string jarg2, string jarg3, uint jarg4, int jarg5, int jarg6, uint jarg7, uint jarg8, HandleRef jarg9, HandleRef jarg10); [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_copy")] public static extern int switch_core_codec_copy(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3); @@ -10386,107 +10391,47 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_directory_handle")] public static extern void delete_switch_directory_handle(HandleRef jarg1); - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_quality_set")] - public static extern void switch_codec_settings_quality_set(HandleRef jarg1, int jarg2); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_quality_get")] - public static extern int switch_codec_settings_quality_get(HandleRef jarg1); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_complexity_set")] - public static extern void switch_codec_settings_complexity_set(HandleRef jarg1, int jarg2); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_complexity_get")] - public static extern int switch_codec_settings_complexity_get(HandleRef jarg1); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_enhancement_set")] - public static extern void switch_codec_settings_enhancement_set(HandleRef jarg1, int jarg2); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_enhancement_get")] - public static extern int switch_codec_settings_enhancement_get(HandleRef jarg1); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_vad_set")] - public static extern void switch_codec_settings_vad_set(HandleRef jarg1, int jarg2); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_vad_get")] - public static extern int switch_codec_settings_vad_get(HandleRef jarg1); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_vbr_set")] - public static extern void switch_codec_settings_vbr_set(HandleRef jarg1, int jarg2); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_vbr_get")] - public static extern int switch_codec_settings_vbr_get(HandleRef jarg1); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_vbr_quality_set")] - public static extern void switch_codec_settings_vbr_quality_set(HandleRef jarg1, float jarg2); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_vbr_quality_get")] - public static extern float switch_codec_settings_vbr_quality_get(HandleRef jarg1); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_abr_set")] - public static extern void switch_codec_settings_abr_set(HandleRef jarg1, int jarg2); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_abr_get")] - public static extern int switch_codec_settings_abr_get(HandleRef jarg1); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_dtx_set")] - public static extern void switch_codec_settings_dtx_set(HandleRef jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_unused_set")] + public static extern void switch_codec_settings_unused_set(HandleRef jarg1, int jarg2); - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_dtx_get")] - public static extern int switch_codec_settings_dtx_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_unused_get")] + public static extern int switch_codec_settings_unused_get(HandleRef jarg1); - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_preproc_set")] - public static extern void switch_codec_settings_preproc_set(HandleRef jarg1, int jarg2); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_preproc_get")] - public static extern int switch_codec_settings_preproc_get(HandleRef jarg1); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_vad_set")] - public static extern void switch_codec_settings_pp_vad_set(HandleRef jarg1, int jarg2); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_vad_get")] - public static extern int switch_codec_settings_pp_vad_get(HandleRef jarg1); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_agc_set")] - public static extern void switch_codec_settings_pp_agc_set(HandleRef jarg1, int jarg2); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_agc_get")] - public static extern int switch_codec_settings_pp_agc_get(HandleRef jarg1); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_agc_level_set")] - public static extern void switch_codec_settings_pp_agc_level_set(HandleRef jarg1, float jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_codec_settings")] + public static extern IntPtr new_switch_codec_settings(); - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_agc_level_get")] - public static extern float switch_codec_settings_pp_agc_level_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_codec_settings")] + public static extern void delete_switch_codec_settings(HandleRef jarg1); - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_denoise_set")] - public static extern void switch_codec_settings_pp_denoise_set(HandleRef jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_fmtp_actual_samples_per_second_set")] + public static extern void switch_codec_fmtp_actual_samples_per_second_set(HandleRef jarg1, uint jarg2); - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_denoise_get")] - public static extern int switch_codec_settings_pp_denoise_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_fmtp_actual_samples_per_second_get")] + public static extern uint switch_codec_fmtp_actual_samples_per_second_get(HandleRef jarg1); - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_dereverb_set")] - public static extern void switch_codec_settings_pp_dereverb_set(HandleRef jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_fmtp_bits_per_second_set")] + public static extern void switch_codec_fmtp_bits_per_second_set(HandleRef jarg1, int jarg2); - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_dereverb_get")] - public static extern int switch_codec_settings_pp_dereverb_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_fmtp_bits_per_second_get")] + public static extern int switch_codec_fmtp_bits_per_second_get(HandleRef jarg1); - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_dereverb_decay_set")] - public static extern void switch_codec_settings_pp_dereverb_decay_set(HandleRef jarg1, float jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_fmtp_microseconds_per_packet_set")] + public static extern void switch_codec_fmtp_microseconds_per_packet_set(HandleRef jarg1, int jarg2); - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_dereverb_decay_get")] - public static extern float switch_codec_settings_pp_dereverb_decay_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_fmtp_microseconds_per_packet_get")] + public static extern int switch_codec_fmtp_microseconds_per_packet_get(HandleRef jarg1); - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_dereverb_level_set")] - public static extern void switch_codec_settings_pp_dereverb_level_set(HandleRef jarg1, float jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_fmtp_private_info_set")] + public static extern void switch_codec_fmtp_private_info_set(HandleRef jarg1, HandleRef jarg2); - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_dereverb_level_get")] - public static extern float switch_codec_settings_pp_dereverb_level_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_fmtp_private_info_get")] + public static extern IntPtr switch_codec_fmtp_private_info_get(HandleRef jarg1); - [DllImport("mod_managed", EntryPoint="CSharp_new_switch_codec_settings")] - public static extern IntPtr new_switch_codec_settings(); + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_codec_fmtp")] + public static extern IntPtr new_switch_codec_fmtp(); - [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_codec_settings")] - public static extern void delete_switch_codec_settings(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_codec_fmtp")] + public static extern void delete_switch_codec_fmtp(HandleRef jarg1); [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_codec_interface_set")] public static extern void switch_codec_codec_interface_set(HandleRef jarg1, HandleRef jarg2); @@ -10512,12 +10457,6 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_fmtp_out_get")] public static extern string switch_codec_fmtp_out_get(HandleRef jarg1); - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_codec_settings_set")] - public static extern void switch_codec_codec_settings_set(HandleRef jarg1, HandleRef jarg2); - - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_codec_settings_get")] - public static extern IntPtr switch_codec_codec_settings_get(HandleRef jarg1); - [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_flags_set")] public static extern void switch_codec_flags_set(HandleRef jarg1, uint jarg2); @@ -10698,6 +10637,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_implementations_get")] public static extern IntPtr switch_codec_interface_implementations_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_parse_fmtp_set")] + public static extern void switch_codec_interface_parse_fmtp_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_parse_fmtp_get")] + public static extern IntPtr switch_codec_interface_parse_fmtp_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_codec_id_set")] public static extern void switch_codec_interface_codec_id_set(HandleRef jarg1, uint jarg2); @@ -12225,6 +12170,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_get_stats")] public static extern IntPtr switch_rtp_get_stats(HandleRef jarg1, HandleRef jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_check_auto_adj")] + public static extern byte switch_rtp_check_auto_adj(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_data_set")] public static extern void switch_log_node_t_data_set(HandleRef jarg1, string jarg2); @@ -14081,6 +14029,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_f_p_q_const__char_p_switch_codec_fmtp__switch_status_t { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_q_const__char_p_switch_codec_fmtp__switch_status_t(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_q_const__char_p_switch_codec_fmtp__switch_status_t() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__char_p_switch_codec_fmtp__switch_status_t obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.0 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t { private HandleRef swigCPtr; @@ -21319,17 +21297,6 @@ public class switch_codec : IDisposable { } } - public switch_codec_settings codec_settings { - set { - freeswitchPINVOKE.switch_codec_codec_settings_set(swigCPtr, switch_codec_settings.getCPtr(value)); - } - get { - IntPtr cPtr = freeswitchPINVOKE.switch_codec_codec_settings_get(swigCPtr); - switch_codec_settings ret = (cPtr == IntPtr.Zero) ? null : new switch_codec_settings(cPtr, false); - return ret; - } - } - public uint flags { set { freeswitchPINVOKE.switch_codec_flags_set(swigCPtr, value); @@ -21436,6 +21403,96 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class switch_codec_fmtp : IDisposable { + private HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal switch_codec_fmtp(IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new HandleRef(this, cPtr); + } + + internal static HandleRef getCPtr(switch_codec_fmtp obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } + + ~switch_codec_fmtp() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if (swigCPtr.Handle != IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_switch_codec_fmtp(swigCPtr); + } + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + GC.SuppressFinalize(this); + } + } + + public uint actual_samples_per_second { + set { + freeswitchPINVOKE.switch_codec_fmtp_actual_samples_per_second_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.switch_codec_fmtp_actual_samples_per_second_get(swigCPtr); + return ret; + } + } + + public int bits_per_second { + set { + freeswitchPINVOKE.switch_codec_fmtp_bits_per_second_set(swigCPtr, value); + } + get { + int ret = freeswitchPINVOKE.switch_codec_fmtp_bits_per_second_get(swigCPtr); + return ret; + } + } + + public int microseconds_per_packet { + set { + freeswitchPINVOKE.switch_codec_fmtp_microseconds_per_packet_set(swigCPtr, value); + } + get { + int ret = freeswitchPINVOKE.switch_codec_fmtp_microseconds_per_packet_get(swigCPtr); + return ret; + } + } + + public SWIGTYPE_p_void private_info { + set { + freeswitchPINVOKE.switch_codec_fmtp_private_info_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_codec_fmtp_private_info_get(swigCPtr); + SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false); + return ret; + } + } + + public switch_codec_fmtp() : this(freeswitchPINVOKE.new_switch_codec_fmtp(), true) { + } + +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.0 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class switch_codec_implementation : IDisposable { private HandleRef swigCPtr; protected bool swigCMemOwn; @@ -21741,6 +21798,17 @@ public class switch_codec_interface : IDisposable { } } + public SWIGTYPE_p_f_p_q_const__char_p_switch_codec_fmtp__switch_status_t parse_fmtp { + set { + freeswitchPINVOKE.switch_codec_interface_parse_fmtp_set(swigCPtr, SWIGTYPE_p_f_p_q_const__char_p_switch_codec_fmtp__switch_status_t.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_codec_interface_parse_fmtp_get(swigCPtr); + SWIGTYPE_p_f_p_q_const__char_p_switch_codec_fmtp__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_q_const__char_p_switch_codec_fmtp__switch_status_t(cPtr, false); + return ret; + } + } + public uint codec_id { set { freeswitchPINVOKE.switch_codec_interface_codec_id_set(swigCPtr, value); @@ -21854,162 +21922,12 @@ public class switch_codec_settings : IDisposable { } } - public int quality { - set { - freeswitchPINVOKE.switch_codec_settings_quality_set(swigCPtr, value); - } - get { - int ret = freeswitchPINVOKE.switch_codec_settings_quality_get(swigCPtr); - return ret; - } - } - - public int complexity { - set { - freeswitchPINVOKE.switch_codec_settings_complexity_set(swigCPtr, value); - } - get { - int ret = freeswitchPINVOKE.switch_codec_settings_complexity_get(swigCPtr); - return ret; - } - } - - public int enhancement { - set { - freeswitchPINVOKE.switch_codec_settings_enhancement_set(swigCPtr, value); - } - get { - int ret = freeswitchPINVOKE.switch_codec_settings_enhancement_get(swigCPtr); - return ret; - } - } - - public int vad { - set { - freeswitchPINVOKE.switch_codec_settings_vad_set(swigCPtr, value); - } - get { - int ret = freeswitchPINVOKE.switch_codec_settings_vad_get(swigCPtr); - return ret; - } - } - - public int vbr { - set { - freeswitchPINVOKE.switch_codec_settings_vbr_set(swigCPtr, value); - } - get { - int ret = freeswitchPINVOKE.switch_codec_settings_vbr_get(swigCPtr); - return ret; - } - } - - public float vbr_quality { - set { - freeswitchPINVOKE.switch_codec_settings_vbr_quality_set(swigCPtr, value); - } - get { - float ret = freeswitchPINVOKE.switch_codec_settings_vbr_quality_get(swigCPtr); - return ret; - } - } - - public int abr { - set { - freeswitchPINVOKE.switch_codec_settings_abr_set(swigCPtr, value); - } - get { - int ret = freeswitchPINVOKE.switch_codec_settings_abr_get(swigCPtr); - return ret; - } - } - - public int dtx { - set { - freeswitchPINVOKE.switch_codec_settings_dtx_set(swigCPtr, value); - } - get { - int ret = freeswitchPINVOKE.switch_codec_settings_dtx_get(swigCPtr); - return ret; - } - } - - public int preproc { - set { - freeswitchPINVOKE.switch_codec_settings_preproc_set(swigCPtr, value); - } - get { - int ret = freeswitchPINVOKE.switch_codec_settings_preproc_get(swigCPtr); - return ret; - } - } - - public int pp_vad { - set { - freeswitchPINVOKE.switch_codec_settings_pp_vad_set(swigCPtr, value); - } - get { - int ret = freeswitchPINVOKE.switch_codec_settings_pp_vad_get(swigCPtr); - return ret; - } - } - - public int pp_agc { - set { - freeswitchPINVOKE.switch_codec_settings_pp_agc_set(swigCPtr, value); - } - get { - int ret = freeswitchPINVOKE.switch_codec_settings_pp_agc_get(swigCPtr); - return ret; - } - } - - public float pp_agc_level { - set { - freeswitchPINVOKE.switch_codec_settings_pp_agc_level_set(swigCPtr, value); - } - get { - float ret = freeswitchPINVOKE.switch_codec_settings_pp_agc_level_get(swigCPtr); - return ret; - } - } - - public int pp_denoise { - set { - freeswitchPINVOKE.switch_codec_settings_pp_denoise_set(swigCPtr, value); - } - get { - int ret = freeswitchPINVOKE.switch_codec_settings_pp_denoise_get(swigCPtr); - return ret; - } - } - - public int pp_dereverb { - set { - freeswitchPINVOKE.switch_codec_settings_pp_dereverb_set(swigCPtr, value); - } - get { - int ret = freeswitchPINVOKE.switch_codec_settings_pp_dereverb_get(swigCPtr); - return ret; - } - } - - public float pp_dereverb_decay { - set { - freeswitchPINVOKE.switch_codec_settings_pp_dereverb_decay_set(swigCPtr, value); - } - get { - float ret = freeswitchPINVOKE.switch_codec_settings_pp_dereverb_decay_get(swigCPtr); - return ret; - } - } - - public float pp_dereverb_level { + public int unused { set { - freeswitchPINVOKE.switch_codec_settings_pp_dereverb_level_set(swigCPtr, value); + freeswitchPINVOKE.switch_codec_settings_unused_set(swigCPtr, value); } get { - float ret = freeswitchPINVOKE.switch_codec_settings_pp_dereverb_level_get(swigCPtr); + int ret = freeswitchPINVOKE.switch_codec_settings_unused_get(swigCPtr); return ret; } } commit 4013fb510f6ab573b402ebc33e9cf5e157686d4d Author: Konrad Hammel <konrad@sangoma.com> Date: Mon Sep 27 14:30:19 2010 -0400 freetdm: ss7 - enabled GRS instead of RSC, numerous bug fixes diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c index 21feb4f..87d80f1 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c @@ -1020,8 +1020,8 @@ int ftmod_ss7_mtp3_route_config(int id) cfg.t.cfg.s.snRout.slsRange = LSN_ANSI_5BIT_SLS_RANGE; /* max value of SLS for this DPC */ } cfg.t.cfg.s.snRout.lsetSel = 0x1; /* linkset selection bit in SLS for STP */ - cfg.t.cfg.s.snRout.multiMsgPrior = FALSE; /* TRUE if multiple cong priorities of messages */ - cfg.t.cfg.s.snRout.rctReq = TRUE; /* route set congestion test required or not */ + cfg.t.cfg.s.snRout.multiMsgPrior = TRUE; /* TRUE if multiple cong priorities of messages */ + cfg.t.cfg.s.snRout.rctReq = TRUE; /* route set congestion test required or not */ cfg.t.cfg.s.snRout.slsLnk = FALSE; #ifdef LSNV2 # if (SS7_NTT || defined(TDS_ROLL_UPGRADE_SUPPORT)) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c index 6ccc693..92284ed 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c @@ -240,9 +240,7 @@ ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const cha /**********************************************************************/ } else if (!strcasecmp(argv[c], "mem")) { /**********************************************************************/ - /*uint32_t availMem;*/ - - /*sng_sta_mem(&availMem);*/ + sng_isup_reg_info_show(); /**********************************************************************/ } else if (!strcasecmp(argv[c], "stats")) { /**********************************************************************/ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index ac7a616..fc5f170 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -73,6 +73,7 @@ ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint32_t ci ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); ftdm_status_t handle_cgb_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); ftdm_status_t handle_cgu_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_olm_msg(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); /******************************************************************************/ /* FUNCTIONS ******************************************************************/ @@ -928,7 +929,7 @@ ftdm_status_t handle_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ /**************************************************************************/ case SIT_STA_OVERLOAD: /* Overload */ SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Overload\n", sngss7_info->circuit->cic); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + handle_olm_msg(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_LMCGBREQ: /* when LM requests ckt grp blocking */ @@ -1685,8 +1686,10 @@ ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit { SS7_FUNC_TRACE_ENTER(__FUNCTION__); - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; + sngss7_chan_data_t *sngss7_info = NULL; + sngss7_span_data_t *sngss7_span = NULL; + ftdm_channel_t *ftdmchan = NULL; + /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { @@ -1695,6 +1698,15 @@ ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit return FTDM_FAIL; } + /* check if we just sent a GRS request...*/ + sngss7_span = ftdmchan->span->mod_data; + if (sngss7_span->tx_grs.circuit > 0) { + /* we need to put all circuits on this UCIC */ + sngss7_span->ucic.circuit = sngss7_span->tx_grs.circuit; + sngss7_span->ucic.range = sngss7_span->tx_grs.range; + goto done; + } + /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); @@ -1706,7 +1718,7 @@ ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit /* unlock the channel again before we exit */ ftdm_mutex_unlock(ftdmchan->mutex); - +done: SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_SUCCESS; } @@ -1984,6 +1996,30 @@ ftdm_status_t handle_cgu_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ } /******************************************************************************/ +ftdm_status_t handle_olm_msg(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +{ + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + /* handle overload */ + SS7_ERROR_CHAN(ftdmchan,"[CIC:%d]Rx Overload\n", sngss7_info->circuit->cic); + + sng_isup_reg_info_show(); + + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_SUCCESS; +} + +/******************************************************************************/ /* For Emacs: * Local Variables: * mode:c diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index fc14d04..30cb316 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -356,6 +356,12 @@ static void *ftdm_sangoma_ss7_run(ftdm_thread_t * me, void *obj) check_if_rx_grs_processed(ftdmspan); } /* if (sngss7_span->rx_grs.range > 0) */ + /* check if there is a UCIC to be processed on the span */ + if (sngss7_span->ucic.range > 0) { + /* process the span wide UCIC */ + process_span_ucic(ftdmspan); + } /* if (sngss7_span->ucic.range > 0) */ + /* check each channel on the span to see if there is an un-procressed SUS/RES flag */ check_for_res_sus_flag(ftdmspan); } /* master while loop */ @@ -592,6 +598,8 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) } else { /* inbound call so we need to send out ACM */ ft_to_sngss7_acm (ftdmchan); + + ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); } break; @@ -763,9 +771,7 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) ft_to_sngss7_gra(ftdmchan); /* clean out the spans GRS structure */ - sngss7_span_data_t *span = ftdmchan->span->mod_data; - span->rx_grs.circuit = 0; - span->rx_grs.range = 0; + clear_rx_grs_data(sngss7_info); } /* clear the grp reset flag */ @@ -783,9 +789,7 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) clear_tx_grs_flags(sngss7_info); /* clean out the spans GRA structure */ - sngss7_span_data_t *span = ftdmchan->span->mod_data; - span->rx_gra.circuit = 0; - span->rx_gra.range = 0; + clear_rx_gra_data(sngss7_info); } /* if (sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP)) */ /* check if we came from reset (aka we just processed a reset) */ @@ -877,6 +881,11 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /* set the unblk flag */ sngss7_set_flag(sngss7_info, FLAG_CKT_UCIC_UNBLK); + + /* clear the block flag */ + sngss7_clear_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK); + + /* process the flag */ ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); /* break out of the processing for now */ @@ -1112,7 +1121,9 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /* remove any reset flags */ clear_rx_grs_flags(sngss7_info); + clear_rx_grs_data(sngss7_info); clear_tx_grs_flags(sngss7_info); + clear_tx_grs_data(sngss7_info); clear_rx_rsc_flags(sngss7_info); clear_tx_rsc_flags(sngss7_info); @@ -1321,7 +1332,7 @@ static ftdm_status_t ftdm_sangoma_ss7_start(ftdm_span_t * span) sngss7_clear_flag(sngss7_info, FLAG_INFID_PAUSED); sngss7_set_flag(sngss7_info, FLAG_INFID_RESUME); } -#if 0 +#if 1 /* throw the grp reset flag */ sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX); if (x == 1) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index d44815d..1b74c88 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -361,6 +361,7 @@ typedef struct sngss7_span_data { sngss7_group_data_t tx_cgb; sngss7_group_data_t rx_cgu; sngss7_group_data_t tx_cgu; + sngss7_group_data_t ucic; ftdm_queue_t *event_queue; }sngss7_span_data_t; @@ -566,10 +567,15 @@ ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan); ftdm_status_t check_if_rx_gra_started(ftdm_span_t *ftdmspan); ftdm_status_t check_for_res_sus_flag(ftdm_span_t *ftdmspan); +ftdm_status_t process_span_ucic(ftdm_span_t *ftdmspan); + ftdm_status_t clear_rx_grs_flags(sngss7_chan_data_t *sngss7_info); ftdm_status_t clear_tx_grs_flags(sngss7_chan_data_t *sngss7_info); ftdm_status_t clear_rx_rsc_flags(sngss7_chan_data_t *sngss7_info); ftdm_status_t clear_tx_rsc_flags(sngss7_chan_data_t *sngss7_info); +ftdm_status_t clear_rx_grs_data(sngss7_chan_data_t *sngss7_info); +ftdm_status_t clear_rx_gra_data(sngss7_chan_data_t *sngss7_info); +ftdm_status_t clear_tx_grs_data(sngss7_chan_data_t *sngss7_info); /* in ftmod_sangoma_ss7_timers.c */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index dfa174e..41db1fe 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -62,10 +62,15 @@ ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan); ftdm_status_t check_if_rx_gra_started(ftdm_span_t *ftdmspan); ftdm_status_t check_for_res_sus_flag(ftdm_span_t *ftdmspan); +ftdm_status_t process_span_ucic(ftdm_span_t *ftdmspan); + ftdm_status_t clear_rx_grs_flags(sngss7_chan_data_t *sngss7_info); ftdm_status_t clear_tx_grs_flags(sngss7_chan_data_t *sngss7_info); ftdm_status_t clear_rx_rsc_flags(sngss7_chan_data_t *sngss7_info); ftdm_status_t clear_tx_rsc_flags(sngss7_chan_data_t *sngss7_info); +ftdm_status_t clear_rx_grs_data(sngss7_chan_data_t *sngss7_info); +ftdm_status_t clear_rx_gra_data(sngss7_chan_data_t *sngss7_info); +ftdm_status_t clear_tx_grs_data(sngss7_chan_data_t *sngss7_info); /******************************************************************************/ /* FUNCTIONS ******************************************************************/ @@ -159,8 +164,8 @@ uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum) } else { /* keep the odd flag down */ odd = 0; - /* throw the flag */ - flag = 1; + /* break right away since we don't need to write the digits */ + break; } /* push the digits into the trillium structure */ @@ -261,14 +266,14 @@ uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum) upper = (atoi(&tmp[0])) << 4; } else { /* there is no upper ... fill in ST */ - upper = 0xF; - /* throw the odd flag */ - odd = 1; + upper = 0xF0; + /* keep the odd flag down */ + odd = 0; /* throw the end flag */ flag = 1; } /* if (tmp != '\0') */ } else { - /* keep the odd flag down */ + /* throw the odd flag */ odd = 1; /* need to add the ST */ lower = 0xF; @@ -525,7 +530,7 @@ ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan) int bit = 0; - ftdm_log(FTDM_LOG_DEBUG, "Found Rx GRS on span %d...checking circuits\n", ftdmspan->span_id); + ftdm_log(FTDM_LOG_DEBUG, "Found Rx GRS on span %s...checking circuits\n", ftdmspan->name); /* check all the circuits in the range to see if they are done resetting */ for ( i = sngss7_span->rx_grs.circuit; i < (sngss7_span->rx_grs.circuit + sngss7_span->rx_grs.range + 1); i++) { @@ -614,7 +619,7 @@ ftdm_status_t check_if_rx_gra_started(ftdm_span_t *ftdmspan) sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->mod_data; int i; - for ( i = sngss7_span->rx_gra.circuit; i < (sngss7_span->rx_gra.circuit + sngss7_span->rx_gra.range + 1); i++) { + for (i = sngss7_span->rx_gra.circuit; i < (sngss7_span->rx_gra.circuit + sngss7_span->rx_gra.range + 1); i++) { /* extract the channel in question */ if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { @@ -757,6 +762,48 @@ ftdm_status_t check_for_res_sus_flag(ftdm_span_t *ftdmspan) } /******************************************************************************/ +ftdm_status_t process_span_ucic(ftdm_span_t *ftdmspan) +{ + ftdm_channel_t *ftdmchan = NULL; + sngss7_chan_data_t *sngss7_info = NULL; + sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->mod_data; + int i; + + for (i = sngss7_span->ucic.circuit; i < (sngss7_span->ucic.circuit + sngss7_span->ucic.range + 1); i++) { + + /* extract the channel in question */ + if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", i); + continue; + } + + /* lock the channel */ + ftdm_mutex_lock(ftdmchan->mutex); + + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx UCIC\n", sngss7_info->circuit->cic); + + /* clear up any pending state changes */ + while (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { + ftdm_sangoma_ss7_process_state_change (ftdmchan); + } + + /* throw the ckt block flag */ + sngss7_set_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK); + + /* set the channel to suspended state */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); + + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); + } + + /* clear out the ucic data since we're done with it */ + memset(&sngss7_span->ucic, 0x0, sizeof(sngss7_group_data_t)); + + return FTDM_SUCCESS; +} + +/******************************************************************************/ ftdm_status_t clear_rx_grs_flags(sngss7_chan_data_t *sngss7_info) { /* clear all the flags related to an incoming GRS */ @@ -768,6 +815,29 @@ ftdm_status_t clear_rx_grs_flags(sngss7_chan_data_t *sngss7_info) } /******************************************************************************/ +ftdm_status_t clear_rx_grs_data(sngss7_chan_data_t *sngss7_info) +{ + ftdm_channel_t *ftdmchan = sngss7_info->ftdmchan; + sngss7_span_data_t *sngss7_span = ftdmchan->span->mod_data; + + /* clear the rx_grs data fields */ + memset(&sngss7_span->rx_grs, 0x0, sizeof(sngss7_group_data_t)); + + return FTDM_SUCCESS; +} + +/******************************************************************************/ +ftdm_status_t clear_rx_gra_data(sngss7_chan_data_t *sngss7_info) +{ + ftdm_channel_t *ftdmchan = sngss7_info->ftdmchan; + sngss7_span_data_t *sngss7_span = ftdmchan->span->mod_data; + + /* clear the rx_grs data fields */ + memset(&sngss7_span->rx_gra, 0x0, sizeof(sngss7_group_data_t)); + + return FTDM_SUCCESS; +} +/******************************************************************************/ ftdm_status_t clear_tx_grs_flags(sngss7_chan_data_t *sngss7_info) { /* clear all the flags related to an outgoing GRS */ @@ -780,6 +850,20 @@ ftdm_status_t clear_tx_grs_flags(sngss7_chan_data_t *sngss7_info) } /******************************************************************************/ +ftdm_status_t clear_tx_grs_data(sngss7_chan_data_t *sngss7_info) +{ + ftdm_channel_t *ftdmchan = sngss7_info->ftdmchan; + sngss7_span_data_t *sngss7_span = ftdmchan->span->mod_data; + + /* clear the rx_grs data fields */ + memset(&sngss7_span->tx_grs, 0x0, sizeof(sngss7_group_data_t)); + + return FTDM_SUCCESS; +} + +/******************************************************************************/ + +/******************************************************************************/ ftdm_status_t clear_rx_rsc_flags(sngss7_chan_data_t *sngss7_info) { /* clear all the flags related to an incoming RSC */ commit 68dab14e98f4b3484585c5cc1d81c173243e2970 Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Wed Sep 29 19:51:31 2010 -0400 mod_codec2: Remove Makefile.in that are automaticly generated by the automake process diff --git a/libs/libcodec2/Makefile.in b/libs/libcodec2/Makefile.in deleted file mode 100644 index d06623c..0000000 --- a/libs/libcodec2/Makefile.in +++ /dev/null @@ -1,690 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = . -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \ - ChangeLog INSTALL NEWS compile config.guess config.sub depcomp \ - install-sh ltmain.sh missing -subdir = . -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ - configure.lineno configure.status.lineno -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = -SOURCES = -DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ - html-recursive info-recursive install-data-recursive \ - install-exec-recursive install-info-recursive \ - install-recursive installcheck-recursive installdirs-recursive \ - pdf-recursive ps-recursive uninstall-info-recursive \ - uninstall-recursive -ETAGS = etags -CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) -am__remove_distdir = \ - { test ! -d $(distdir) \ - || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -fr $(distdir); }; } -DIST_ARCHIVES = $(distdir).tar.gz -GZIP_ENV = --best -distuninstallcheck_listfiles = find . -type f -print -distcleancheck_listfiles = find . -type f -print -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -GREP = @GREP@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -AM_CFLAGS = -Isrc -Wall -lm -AUTOMAKE_OPTS = gnu -NAME = libcodec2 -AM_CPPFLAGS = $(AM_CFLAGS) -EXTRA_DIST = pitch/hts1a.p \ -pitch/hts2a.p \ -octave/glottal.m \ -octave/lsp_pdf.m \ -octave/phase.m \ -octave/pl2.m \ -octave/plinterp.m \ -octave/plnlp.m \ -octave/plpitch.m \ -octave/postfilter.m \ -octave/load_raw.m \ -octave/phase2.m \ -octave/pitch_test.m \ -octave/plamp.m \ -octave/pl.m \ -octave/plphase.m \ -octave/png.m \ -octave/pulse.m \ -raw/b0067.raw \ -raw/forig_speex_8k.raw \ -raw/hts1.raw \ -raw/hts2.raw \ -raw/mmt1.raw \ -raw/morig_speex_8k.raw \ -raw/f2400.raw \ -raw/hts1a_g729a.raw \ -raw/hts2a_g729a.raw \ -raw/hts.raw \ -raw/mmt1_speex_8k.raw \ -raw/forig_g729a.raw \ -raw/hts1a_gsm13k.raw \ -raw/hts2a_gsm13k.raw \ -raw/m2400.raw \ -raw/morig_g729a.raw \ -raw/forig_gsm13k.raw \ -raw/hts1a.raw \ -raw/hts2a.raw \ -raw/mmt1_g729a.raw \ -raw/morig_gsm13k.raw \ -raw/forig.raw \ -raw/hts1a_speex_8k.raw \ -raw/hts2a_speex_8k.raw \ -raw/mmt1_gsm13k.raw \ -raw/morig.raw \ -script/menu.sh \ -script/playraw.sh \ -script/raw2wav.sh \ -script/wav2raw.sh \ -wav/f2400.wav \ -wav/hts1a_c2_v0.1.wav \ -wav/hts1a.wav \ -wav/hts2a_speex_8k.wav \ -wav/mmt1_speex_8k.wav \ -wav/morig.wav \ -wav/forig_speex_8k.wav \ -wav/hts1a_g729a.wav \ -wav/hts2a_c2_v0.1.wav \ -wav/hts2a.wav \ -wav/mmt1.wav \ -wav/forig.wav \ -wav/hts1a_speex_8k.wav \ -wav/hts2a_g729a.wav \ -wav/m2400.wav \ -wav/morig_speex_8k.wav \ -src/globals.c \ -doc/A_m.gif \ -doc/omega_0.gif \ -doc/phi_m.gif \ -doc/s_n.gif \ -doc/s_n.txt \ -unittest/lsp2.txt \ -unittest/lsp7.txt \ -unittest/lspd78.txt \ -unittest/lsp3.txt \ -unittest/lsp8.txt \ -unittest/lspd910.txt \ -unittest/lsp4.txt \ -unittest/lsp9.txt \ -unittest/lsp10.txt \ -unittest/lsp5.txt \ -unittest/lspd123.txt \ -unittest/lsp1.txt \ -unittest/lsp6.txt \ -unittest/lspd456.txt \ -src/codeall.sh \ -src/fq20.sh \ -src/listen1.sh \ -src/listen.sh \ -src/listensim.sh \ -src/sim.sh - -SUBDIRS = src unittest -all: all-recursive - -.SUFFIXES: -am--refresh: - @: -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ - cd $(srcdir) && $(AUTOMAKE) --gnu \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - echo ' $(SHELL) ./config.status'; \ - $(SHELL) ./config.status;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - $(SHELL) ./config.status --recheck - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -# This directory's subdirectories are mostly independent; you can cd -# into them and run `make' without going through this Makefile. -# To change the values of `make' variables: instead of editing Makefiles, -# (1) if the variable is set in `config.status', edit `config.status' -# (which will cause the Makefiles to be regenerated when you run `make'); -# (2) otherwise, pass the desired values on the `make' command line. -$(RECURSIVE_TARGETS): - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -mostlyclean-recursive clean-recursive distclean-recursive \ -maintainer-clean-recursive: - @failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ - dot_seen=no; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - rev=''; for subdir in $$list; do \ - if test "$$subdir" = "."; then :; else \ - rev="$$subdir $$rev"; \ - fi; \ - done; \ - rev="$$rev ."; \ - target=`echo $@ | sed s/-recursive//`; \ - for subdir in $$rev; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done && test -z "$$fail" -tags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ - done -ctags-recursive: - list='$(SUBDIRS)'; for subdir in $$list; do \ - test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - $(am__remove_distdir) - mkdir $(distdir) - $(mkdir_p) $(distdir)/doc $(distdir)/octave $(distdir)/pitch $(distdir)/raw $(distdir)/script $(distdir)/src $(distdir)/unittest $(distdir)/wav - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(mkdir_p) "$(distdir)/$$subdir" \ - || exit 1; \ - distdir=`$(am__cd) $(distdir) && pwd`; \ - top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$top_distdir" \ - distdir="$$distdir/$$subdir" \ - distdir) \ - || exit 1; \ - fi; \ - done - -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ - ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r $(distdir) -dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) - -dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 - $(am__remove_distdir) - -dist-tarZ: distdir - tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__remove_distdir) - -dist-shar: distdir - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__remove_distdir) - -dist-zip: distdir - -rm -f $(distdir).zip - zip -rq $(distdir).zip $(distdir) - $(am__remove_distdir) - -dist dist-all: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - case '$(DIST_ARCHIVES)' in \ - *.tar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ - *.tar.bz2*) \ - bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.Z*) \ - uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ - *.shar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ - *.zip*) \ - unzip $(distdir).zip ;;\ - esac - chmod -R a-w $(distdir); chmod a+w $(distdir) - mkdir $(distdir)/_build - mkdir $(distdir)/_inst - chmod a-w $(distdir) - dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ - && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ - && cd $(distdir)/_build \ - && ../configure --srcdir=.. --prefix="$$dc_install_base" \ - $(DISTCHECK_CONFIGURE_FLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ - distuninstallcheck \ - && chmod -R a-w "$$dc_install_base" \ - && ({ \ - (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ - distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ - } || { rm -rf "$$dc_destdir"; exit 1; }) \ - && rm -rf "$$dc_destdir" \ - && $(MAKE) $(AM_MAKEFLAGS) dist \ - && rm -rf $(DIST_ARCHIVES) \ - && $(MAKE) $(AM_MAKEFLAGS) distcleancheck - $(am__remove_distdir) - @(echo "$(distdir) archives ready for distribution: "; \ - list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ - sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' -distuninstallcheck: - @cd $(distuninstallcheck_dir) \ - && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ - || { echo "ERROR: files left after uninstall:" ; \ - if test -n "$(DESTDIR)"; then \ - echo " (check DESTDIR support)"; \ - fi ; \ - $(distuninstallcheck_listfiles) ; \ - exit 1; } >&2 -distcleancheck: distclean - @if test '$(srcdir)' = . ; then \ - echo "ERROR: distcleancheck can only run from a VPATH build" ; \ - exit 1 ; \ - fi - @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left in build directory after distclean:" ; \ - $(distcleancheck_listfiles) ; \ - exit 1; } >&2 -check-am: all-am -check: check-recursive -all-am: Makefile -installdirs: installdirs-recursive -installdirs-am: -install: install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-recursive - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -f Makefile -distclean-am: clean-am distclean-generic distclean-libtool \ - distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -info: info-recursive - -info-am: - -install-data-am: - -install-exec-am: - -install-info: install-info-recursive - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf $(top_srcdir)/autom4te.cache - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-info-am - -uninstall-info: uninstall-info-recursive - -.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ - check-am clean clean-generic clean-libtool clean-recursive \ - ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ - dist-shar dist-tarZ dist-zip distcheck distclean \ - distclean-generic distclean-libtool distclean-recursive \ - distclean-tags distcleancheck distdir distuninstallcheck dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-exec install-exec-am \ - install-info install-info-am install-man install-strip \ - installcheck installcheck-am installdirs installdirs-am \ - maintainer-clean maintainer-clean-generic \ - maintainer-clean-recursive mostlyclean mostlyclean-generic \ - mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \ - tags tags-recursive uninstall uninstall-am uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/libs/libcodec2/src/Makefile.in b/libs/libcodec2/src/Makefile.in deleted file mode 100644 index 9596c90..0000000 --- a/libs/libcodec2/src/Makefile.in +++ /dev/null @@ -1,690 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - - - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -bin_PROGRAMS = c2dec$(EXEEXT) c2enc$(EXEEXT) c2sim$(EXEEXT) -subdir = src -DIST_COMMON = $(library_include_HEADERS) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; -am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ - "$(DESTDIR)$(library_includedir)" -libLTLIBRARIES_INSTALL = $(INSTALL) -LTLIBRARIES = $(lib_LTLIBRARIES) -libcodec2_la_LIBADD = -am_libcodec2_la_OBJECTS = libcodec2_la-dump.lo libcodec2_la-lpc.lo \ - libcodec2_la-nlp.lo libcodec2_la-postfilter.lo \ - libcodec2_la-sine.lo libcodec2_la-codec2.lo \ - libcodec2_la-four1.lo libcodec2_la-interp.lo \ - libcodec2_la-lsp.lo libcodec2_la-phase.lo \ - libcodec2_la-quantise.lo libcodec2_la-pack.lo \ - libcodec2_la-codebook.lo -libcodec2_la_OBJECTS = $(am_libcodec2_la_OBJECTS) -binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) -PROGRAMS = $(bin_PROGRAMS) -am_c2dec_OBJECTS = c2dec.$(OBJEXT) -c2dec_OBJECTS = $(am_c2dec_OBJECTS) -am__DEPENDENCIES_1 = libcodec2.la -c2dec_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_c2enc_OBJECTS = c2enc.$(OBJEXT) -c2enc_OBJECTS = $(am_c2enc_OBJECTS) -c2enc_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_c2sim_OBJECTS = c2sim.$(OBJEXT) -c2sim_OBJECTS = $(am_c2sim_OBJECTS) -c2sim_DEPENDENCIES = $(am__DEPENDENCIES_1) -DEFAULT_INCLUDES = -I. -I$(srcdir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(libcodec2_la_SOURCES) $(c2dec_SOURCES) $(c2enc_SOURCES) \ - $(c2sim_SOURCES) -DIST_SOURCES = $(libcodec2_la_SOURCES) $(c2dec_SOURCES) \ - $(c2enc_SOURCES) $(c2sim_SOURCES) -library_includeHEADERS_INSTALL = $(INSTALL_HEADER) -HEADERS = $(library_include_HEADERS) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -GREP = @GREP@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -AM_CFLAGS = -I../src -Wall -DFLOATING_POINT -DVAR_ARRAYS -AUTOMAKE_OPTS = gnu -NAME = libcodec2 -AM_CPPFLAGS = $(AM_CFLAGS) -lib_LTLIBRARIES = libcodec2.la -libcodec2_la_SOURCES = dump.c \ -lpc.c \ -nlp.c \ -postfilter.c \ -sine.c \ -codec2.c \ -four1.c \ -interp.c \ -lsp.c \ -phase.c \ -quantise.c \ -pack.c \ -codebook.c - -libcodec2_la_CFLAGS = $(AM_CFLAGS) -libcodec2_la_LDFLAGS = $(LIBS) -library_includedir = $(prefix) -library_include_HEADERS = codec2.h \ -defines.h \ -four1.h \ -interp.h \ -lsp.h \ -phase.h \ -quantise.h \ -comp.h \ -dump.h \ -globals.h \ -lpc.h \ -nlp.h \ -postfilter.h \ -sine.h \ -codebook.h - -c2dec_SOURCES = c2dec.c -c2dec_LDADD = $(lib_LTLIBRARIES) -c2dec_LDFLAGS = $(LIBS) -c2enc_SOURCES = c2enc.c -c2enc_LDADD = $(lib_LTLIBRARIES) -c2enc_LDFLAGS = $(LIBS) -c2sim_SOURCES = c2sim.c -c2sim_LDADD = $(lib_LTLIBRARIES) -c2sim_LDFLAGS = $(LIBS) -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu src/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -install-libLTLIBRARIES: $(lib_LTLIBRARIES) - @$(NORMAL_INSTALL) - test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - if test -f $$p; then \ - f=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ - $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ - else :; fi; \ - done - -uninstall-libLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - p=$(am__strip_dir) \ - echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ - $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ - done - -clean-libLTLIBRARIES: - -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done -libcodec2.la: $(libcodec2_la_OBJECTS) $(libcodec2_la_DEPENDENCIES) - $(LINK) -rpath $(libdir) $(libcodec2_la_LDFLAGS) $(libcodec2_la_OBJECTS) $(libcodec2_la_LIBADD) $(LIBS) -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - if test -f $$p \ - || test -f $$p1 \ - ; then \ - f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ - else :; fi; \ - done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ - rm -f "$(DESTDIR)$(bindir)/$$f"; \ - done - -clean-binPROGRAMS: - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done -c2dec$(EXEEXT): $(c2dec_OBJECTS) $(c2dec_DEPENDENCIES) - @rm -f c2dec$(EXEEXT) - $(LINK) $(c2dec_LDFLAGS) $(c2dec_OBJECTS) $(c2dec_LDADD) $(LIBS) -c2enc$(EXEEXT): $(c2enc_OBJECTS) $(c2enc_DEPENDENCIES) - @rm -f c2enc$(EXEEXT) - $(LINK) $(c2enc_LDFLAGS) $(c2enc_OBJECTS) $(c2enc_LDADD) $(LIBS) -c2sim$(EXEEXT): $(c2sim_OBJECTS) $(c2sim_DEPENDENCIES) - @rm -f c2sim$(EXEEXT) - $(LINK) $(c2sim_LDFLAGS) $(c2sim_OBJECTS) $(c2sim_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c2dec.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c2enc.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c2sim.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-codebook.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-codec2.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-dump.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-four1.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-interp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-lpc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-lsp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-nlp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-pack.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-phase.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-postfilter.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-quantise.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-sine.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -libcodec2_la-dump.lo: dump.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-dump.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-dump.Tpo" -c -o libcodec2_la-dump.lo `test -f 'dump.c' || echo '$(srcdir)/'`dump.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-dump.Tpo" "$(DEPDIR)/libcodec2_la-dump.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-dump.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dump.c' object='libcodec2_la-dump.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-dump.lo `test -f 'dump.c' || echo '$(srcdir)/'`dump.c - -libcodec2_la-lpc.lo: lpc.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-lpc.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-lpc.Tpo" -c -o libcodec2_la-lpc.lo `test -f 'lpc.c' || echo '$(srcdir)/'`lpc.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-lpc.Tpo" "$(DEPDIR)/libcodec2_la-lpc.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-lpc.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lpc.c' object='libcodec2_la-lpc.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-lpc.lo `test -f 'lpc.c' || echo '$(srcdir)/'`lpc.c - -libcodec2_la-nlp.lo: nlp.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-nlp.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-nlp.Tpo" -c -o libcodec2_la-nlp.lo `test -f 'nlp.c' || echo '$(srcdir)/'`nlp.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-nlp.Tpo" "$(DEPDIR)/libcodec2_la-nlp.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-nlp.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nlp.c' object='libcodec2_la-nlp.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-nlp.lo `test -f 'nlp.c' || echo '$(srcdir)/'`nlp.c - -libcodec2_la-postfilter.lo: postfilter.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-postfilter.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-postfilter.Tpo" -c -o libcodec2_la-postfilter.lo `test -f 'postfilter.c' || echo '$(srcdir)/'`postfilter.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-postfilter.Tpo" "$(DEPDIR)/libcodec2_la-postfilter.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-postfilter.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='postfilter.c' object='libcodec2_la-postfilter.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-postfilter.lo `test -f 'postfilter.c' || echo '$(srcdir)/'`postfilter.c - -libcodec2_la-sine.lo: sine.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-sine.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-sine.Tpo" -c -o libcodec2_la-sine.lo `test -f 'sine.c' || echo '$(srcdir)/'`sine.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-sine.Tpo" "$(DEPDIR)/libcodec2_la-sine.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-sine.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sine.c' object='libcodec2_la-sine.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-sine.lo `test -f 'sine.c' || echo '$(srcdir)/'`sine.c - -libcodec2_la-codec2.lo: codec2.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-codec2.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-codec2.Tpo" -c -o libcodec2_la-codec2.lo `test -f 'codec2.c' || echo '$(srcdir)/'`codec2.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-codec2.Tpo" "$(DEPDIR)/libcodec2_la-codec2.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-codec2.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='codec2.c' object='libcodec2_la-codec2.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-codec2.lo `test -f 'codec2.c' || echo '$(srcdir)/'`codec2.c - -libcodec2_la-four1.lo: four1.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-four1.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-four1.Tpo" -c -o libcodec2_la-four1.lo `test -f 'four1.c' || echo '$(srcdir)/'`four1.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-four1.Tpo" "$(DEPDIR)/libcodec2_la-four1.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-four1.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='four1.c' object='libcodec2_la-four1.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-four1.lo `test -f 'four1.c' || echo '$(srcdir)/'`four1.c - -libcodec2_la-interp.lo: interp.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-interp.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-interp.Tpo" -c -o libcodec2_la-interp.lo `test -f 'interp.c' || echo '$(srcdir)/'`interp.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-interp.Tpo" "$(DEPDIR)/libcodec2_la-interp.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-interp.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='interp.c' object='libcodec2_la-interp.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-interp.lo `test -f 'interp.c' || echo '$(srcdir)/'`interp.c - -libcodec2_la-lsp.lo: lsp.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-lsp.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-lsp.Tpo" -c -o libcodec2_la-lsp.lo `test -f 'lsp.c' || echo '$(srcdir)/'`lsp.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-lsp.Tpo" "$(DEPDIR)/libcodec2_la-lsp.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-lsp.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lsp.c' object='libcodec2_la-lsp.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-lsp.lo `test -f 'lsp.c' || echo '$(srcdir)/'`lsp.c - -libcodec2_la-phase.lo: phase.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-phase.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-phase.Tpo" -c -o libcodec2_la-phase.lo `test -f 'phase.c' || echo '$(srcdir)/'`phase.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-phase.Tpo" "$(DEPDIR)/libcodec2_la-phase.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-phase.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='phase.c' object='libcodec2_la-phase.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-phase.lo `test -f 'phase.c' || echo '$(srcdir)/'`phase.c - -libcodec2_la-quantise.lo: quantise.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-quantise.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-quantise.Tpo" -c -o libcodec2_la-quantise.lo `test -f 'quantise.c' || echo '$(srcdir)/'`quantise.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-quantise.Tpo" "$(DEPDIR)/libcodec2_la-quantise.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-quantise.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='quantise.c' object='libcodec2_la-quantise.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-quantise.lo `test -f 'quantise.c' || echo '$(srcdir)/'`quantise.c - -libcodec2_la-pack.lo: pack.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-pack.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-pack.Tpo" -c -o libcodec2_la-pack.lo `test -f 'pack.c' || echo '$(srcdir)/'`pack.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-pack.Tpo" "$(DEPDIR)/libcodec2_la-pack.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-pack.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pack.c' object='libcodec2_la-pack.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-pack.lo `test -f 'pack.c' || echo '$(srcdir)/'`pack.c - -libcodec2_la-codebook.lo: codebook.c -@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-codebook.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-codebook.Tpo" -c -o libcodec2_la-codebook.lo `test -f 'codebook.c' || echo '$(srcdir)/'`codebook.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-codebook.Tpo" "$(DEPDIR)/libcodec2_la-codebook.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-codebook.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='codebook.c' object='libcodec2_la-codebook.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-codebook.lo `test -f 'codebook.c' || echo '$(srcdir)/'`codebook.c - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: -install-library_includeHEADERS: $(library_include_HEADERS) - @$(NORMAL_INSTALL) - test -z "$(library_includedir)" || $(mkdir_p) "$(DESTDIR)$(library_includedir)" - @list='$(library_include_HEADERS)'; for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - f=$(am__strip_dir) \ - echo " $(library_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(library_includedir)/$$f'"; \ - $(library_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(library_includedir)/$$f"; \ - done - -uninstall-library_includeHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(library_include_HEADERS)'; for p in $$list; do \ - f=$(am__strip_dir) \ - echo " rm -f '$(DESTDIR)$(library_includedir)/$$f'"; \ - rm -f "$(DESTDIR)$(library_includedir)/$$f"; \ - done - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS) -install-binPROGRAMS: install-libLTLIBRARIES - -installdirs: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(library_includedir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ - clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: install-library_includeHEADERS - -install-exec-am: install-binPROGRAMS install-libLTLIBRARIES - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-binPROGRAMS uninstall-info-am \ - uninstall-libLTLIBRARIES uninstall-library_includeHEADERS - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-generic clean-libLTLIBRARIES clean-libtool ctags \ - distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-binPROGRAMS \ - install-data install-data-am install-exec install-exec-am \ - install-info install-info-am install-libLTLIBRARIES \ - install-library_includeHEADERS install-man install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-binPROGRAMS \ - uninstall-info-am uninstall-libLTLIBRARIES \ - uninstall-library_includeHEADERS - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/libs/libcodec2/unittest/Makefile.in b/libs/libcodec2/unittest/Makefile.in deleted file mode 100644 index 26ca1c9..0000000 --- a/libs/libcodec2/unittest/Makefile.in +++ /dev/null @@ -1,735 +0,0 @@ -# Makefile.in generated by automake 1.9.6 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -top_builddir = .. -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -INSTALL = @INSTALL@ -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -bin_PROGRAMS = genres$(EXEEXT) genlsp$(EXEEXT) extract$(EXEEXT) \ - vqtrain$(EXEEXT) tnlp$(EXEEXT) tinterp$(EXEEXT) \ - tquant$(EXEEXT) tcodec2$(EXEEXT) -subdir = unittest -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d -CONFIG_CLEAN_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" -binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) -PROGRAMS = $(bin_PROGRAMS) -am_extract_OBJECTS = extract.$(OBJEXT) codebook.$(OBJEXT) -extract_OBJECTS = $(am_extract_OBJECTS) -extract_DEPENDENCIES = -am_genlsp_OBJECTS = genlsp.$(OBJEXT) lpc.$(OBJEXT) lsp.$(OBJEXT) \ - codebook.$(OBJEXT) -genlsp_OBJECTS = $(am_genlsp_OBJECTS) -genlsp_DEPENDENCIES = -am_genres_OBJECTS = genres.$(OBJEXT) lpc.$(OBJEXT) codebook.$(OBJEXT) -genres_OBJECTS = $(am_genres_OBJECTS) -genres_DEPENDENCIES = -am_tcodec2_OBJECTS = tcodec2.$(OBJEXT) quantise.$(OBJEXT) \ - lpc.$(OBJEXT) lsp.$(OBJEXT) dump.$(OBJEXT) four1.$(OBJEXT) \ - codec2.$(OBJEXT) sine.$(OBJEXT) nlp.$(OBJEXT) \ - postfilter.$(OBJEXT) phase.$(OBJEXT) interp.$(OBJEXT) \ - pack.$(OBJEXT) codebook.$(OBJEXT) -tcodec2_OBJECTS = $(am_tcodec2_OBJECTS) -tcodec2_DEPENDENCIES = -am_tinterp_OBJECTS = tinterp.$(OBJEXT) sine.$(OBJEXT) four1.$(OBJEXT) \ - interp.$(OBJEXT) codebook.$(OBJEXT) -tinterp_OBJECTS = $(am_tinterp_OBJECTS) -tinterp_DEPENDENCIES = -am_tnlp_OBJECTS = tnlp.$(OBJEXT) sine.$(OBJEXT) nlp.$(OBJEXT) \ - four1.$(OBJEXT) dump.$(OBJEXT) codebook.$(OBJEXT) -tnlp_OBJECTS = $(am_tnlp_OBJECTS) -tnlp_DEPENDENCIES = -am_tquant_OBJECTS = tquant.$(OBJEXT) quantise.$(OBJEXT) lpc.$(OBJEXT) \ - lsp.$(OBJEXT) dump.$(OBJEXT) four1.$(OBJEXT) \ - codebook.$(OBJEXT) -tquant_OBJECTS = $(am_tquant_OBJECTS) -tquant_DEPENDENCIES = -am_vqtrain_OBJECTS = vqtrain.$(OBJEXT) codebook.$(OBJEXT) -vqtrain_OBJECTS = $(am_vqtrain_OBJECTS) -vqtrain_DEPENDENCIES = -DEFAULT_INCLUDES = -I. -I$(srcdir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(extract_SOURCES) $(genlsp_SOURCES) $(genres_SOURCES) \ - $(tcodec2_SOURCES) $(tinterp_SOURCES) $(tnlp_SOURCES) \ - $(tquant_SOURCES) $(vqtrain_SOURCES) -DIST_SOURCES = $(extract_SOURCES) $(genlsp_SOURCES) $(genres_SOURCES) \ - $(tcodec2_SOURCES) $(tinterp_SOURCES) $(tnlp_SOURCES) \ - $(tquant_SOURCES) $(vqtrain_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ -AMTAR = @AMTAR@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -F77 = @F77@ -FFLAGS = @FFLAGS@ -GREP = @GREP@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ -MAKEINFO = @MAKEINFO@ -OBJEXT = @OBJEXT@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -RANLIB = @RANLIB@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -VERSION = @VERSION@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -AM_CFLAGS = -I../src -g -DFLOATING_POINT -DVAR_ARRAYS -AUTOMAKE_OPTS = gnu -NAME = libcodec2 -AM_CPPFLAGS = $(AM_CFLAGS) -genres_SOURCES = genres.c ../src/lpc.c ../src/codebook.c -genres_LDADD = $(lib_LTLIBRARIES) -genres_LDFLAGS = $(LIBS) -genlsp_SOURCES = genlsp.c ../src/lpc.c ../src/lsp.c ../src/codebook.c -genlsp_LDADD = $(lib_LTLIBRARIES) -genlsp_LDFLAGS = $(LIBS) -extract_SOURCES = extract.c ../src/codebook.c -extract_LDADD = $(lib_LTLIBRARIES) -extract_LDFLAGS = $(LIBS) -vqtrain_SOURCES = vqtrain.c ../src/codebook.c -vqtrain_LDADD = $(lib_LTLIBRARIES) -vqtrain_LDFLAGS = $(LIBS) -tnlp_SOURCES = tnlp.c ../src/sine.c ../src/nlp.c ../src/four1.c ../src/dump.c ../src/codebook.c -tnlp_LDADD = $(lib_LTLIBRARIES) -tnlp_LDFLAGS = $(LIBS) -tinterp_SOURCES = tinterp.c ../src/sine.c ../src/four1.c ../src/interp.c ../src/codebook.c -tinterp_LDADD = $(lib_LTLIBRARIES) -tinterp_LDFLAGS = $(LIBS) -tquant_SOURCES = tquant.c ../src/quantise.c ../src/lpc.c ../src/lsp.c ../src/dump.c ../src/four1.c ../src/codebook.c -tquant_LDADD = $(lib_LTLIBRARIES) -tquant_LDFLAGS = $(LIBS) -tcodec2_SOURCES = tcodec2.c ../src/quantise.c ../src/lpc.c ../src/lsp.c ../src/dump.c ../src/four1.c \ -../src/codec2.c ../src/sine.c ../src/nlp.c ../src/postfilter.c ../src/phase.c ../src/interp.c ../src/pack.c ../src/codebook.c - -tcodec2_LDADD = $(lib_LTLIBRARIES) -tcodec2_LDFLAGS = $(LIBS) -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu unittest/Makefile'; \ - cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu unittest/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - if test -f $$p \ - || test -f $$p1 \ - ; then \ - f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ - else :; fi; \ - done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ - rm -f "$(DESTDIR)$(bindir)/$$f"; \ - done - -clean-binPROGRAMS: - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done -extract$(EXEEXT): $(extract_OBJECTS) $(extract_DEPENDENCIES) - @rm -f extract$(EXEEXT) - $(LINK) $(extract_LDFLAGS) $(extract_OBJECTS) $(extract_LDADD) $(LIBS) -genlsp$(EXEEXT): $(genlsp_OBJECTS) $(genlsp_DEPENDENCIES) - @rm -f genlsp$(EXEEXT) - $(LINK) $(genlsp_LDFLAGS) $(genlsp_OBJECTS) $(genlsp_LDADD) $(LIBS) -genres$(EXEEXT): $(genres_OBJECTS) $(genres_DEPENDENCIES) - @rm -f genres$(EXEEXT) - $(LINK) $(genres_LDFLAGS) $(genres_OBJECTS) $(genres_LDADD) $(LIBS) -tcodec2$(EXEEXT): $(tcodec2_OBJECTS) $(tcodec2_DEPENDENCIES) - @rm -f tcodec2$(EXEEXT) - $(LINK) $(tcodec2_LDFLAGS) $(tcodec2_OBJECTS) $(tcodec2_LDADD) $(LIBS) -tinterp$(EXEEXT): $(tinterp_OBJECTS) $(tinterp_DEPENDENCIES) - @rm -f tinterp$(EXEEXT) - $(LINK) $(tinterp_LDFLAGS) $(tinterp_OBJECTS) $(tinterp_LDADD) $(LIBS) -tnlp$(EXEEXT): $(tnlp_OBJECTS) $(tnlp_DEPENDENCIES) - @rm -f tnlp$(EXEEXT) - $(LINK) $(tnlp_LDFLAGS) $(tnlp_OBJECTS) $(tnlp_LDADD) $(LIBS) -tquant$(EXEEXT): $(tquant_OBJECTS) $(tquant_DEPENDENCIES) - @rm -f tquant$(EXEEXT) - $(LINK) $(tquant_LDFLAGS) $(tquant_OBJECTS) $(tquant_LDADD) $(LIBS) -vqtrain$(EXEEXT): $(vqtrain_OBJECTS) $(vqtrain_DEPENDENCIES) - @rm -f vqtrain$(EXEEXT) - $(LINK) $(vqtrain_LDFLAGS) $(vqtrain_OBJECTS) $(vqtrain_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/codebook.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/codec2.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dump.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extract.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/four1.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/genlsp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/genres.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lpc.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nlp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pack.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/phase.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/postfilter.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quantise.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sine.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcodec2.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tinterp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tnlp.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tquant.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vqtrain.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< - -.c.obj: -@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< - -codebook.o: ../src/codebook.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT codebook.o -MD -MP -MF "$(DEPDIR)/codebook.Tpo" -c -o codebook.o `test -f '../src/codebook.c' || echo '$(srcdir)/'`../src/codebook.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/codebook.Tpo" "$(DEPDIR)/codebook.Po"; else rm -f "$(DEPDIR)/codebook.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/codebook.c' object='codebook.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o codebook.o `test -f '../src/codebook.c' || echo '$(srcdir)/'`../src/codebook.c - -codebook.obj: ../src/codebook.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT codebook.obj -MD -MP -MF "$(DEPDIR)/codebook.Tpo" -c -o codebook.obj `if test -f '../src/codebook.c'; then $(CYGPATH_W) '../src/codebook.c'; else $(CYGPATH_W) '$(srcdir)/../src/codebook.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/codebook.Tpo" "$(DEPDIR)/codebook.Po"; else rm -f "$(DEPDIR)/codebook.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/codebook.c' object='codebook.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o codebook.obj `if test -f '../src/codebook.c'; then $(CYGPATH_W) '../src/codebook.c'; else $(CYGPATH_W) '$(srcdir)/../src/codebook.c'; fi` - -lpc.o: ../src/lpc.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lpc.o -MD -MP -MF "$(DEPDIR)/lpc.Tpo" -c -o lpc.o `test -f '../src/lpc.c' || echo '$(srcdir)/'`../src/lpc.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lpc.Tpo" "$(DEPDIR)/lpc.Po"; else rm -f "$(DEPDIR)/lpc.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/lpc.c' object='lpc.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lpc.o `test -f '../src/lpc.c' || echo '$(srcdir)/'`../src/lpc.c - -lpc.obj: ../src/lpc.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lpc.obj -MD -MP -MF "$(DEPDIR)/lpc.Tpo" -c -o lpc.obj `if test -f '../src/lpc.c'; then $(CYGPATH_W) '../src/lpc.c'; else $(CYGPATH_W) '$(srcdir)/../src/lpc.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lpc.Tpo" "$(DEPDIR)/lpc.Po"; else rm -f "$(DEPDIR)/lpc.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/lpc.c' object='lpc.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lpc.obj `if test -f '../src/lpc.c'; then $(CYGPATH_W) '../src/lpc.c'; else $(CYGPATH_W) '$(srcdir)/../src/lpc.c'; fi` - -lsp.o: ../src/lsp.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lsp.o -MD -MP -MF "$(DEPDIR)/lsp.Tpo" -c -o lsp.o `test -f '../src/lsp.c' || echo '$(srcdir)/'`../src/lsp.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lsp.Tpo" "$(DEPDIR)/lsp.Po"; else rm -f "$(DEPDIR)/lsp.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/lsp.c' object='lsp.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lsp.o `test -f '../src/lsp.c' || echo '$(srcdir)/'`../src/lsp.c - -lsp.obj: ../src/lsp.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lsp.obj -MD -MP -MF "$(DEPDIR)/lsp.Tpo" -c -o lsp.obj `if test -f '../src/lsp.c'; then $(CYGPATH_W) '../src/lsp.c'; else $(CYGPATH_W) '$(srcdir)/../src/lsp.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lsp.Tpo" "$(DEPDIR)/lsp.Po"; else rm -f "$(DEPDIR)/lsp.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/lsp.c' object='lsp.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lsp.obj `if test -f '../src/lsp.c'; then $(CYGPATH_W) '../src/lsp.c'; else $(CYGPATH_W) '$(srcdir)/../src/lsp.c'; fi` - -quantise.o: ../src/quantise.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT quantise.o -MD -MP -MF "$(DEPDIR)/quantise.Tpo" -c -o quantise.o `test -f '../src/quantise.c' || echo '$(srcdir)/'`../src/quantise.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/quantise.Tpo" "$(DEPDIR)/quantise.Po"; else rm -f "$(DEPDIR)/quantise.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/quantise.c' object='quantise.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o quantise.o `test -f '../src/quantise.c' || echo '$(srcdir)/'`../src/quantise.c - -quantise.obj: ../src/quantise.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT quantise.obj -MD -MP -MF "$(DEPDIR)/quantise.Tpo" -c -o quantise.obj `if test -f '../src/quantise.c'; then $(CYGPATH_W) '../src/quantise.c'; else $(CYGPATH_W) '$(srcdir)/../src/quantise.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/quantise.Tpo" "$(DEPDIR)/quantise.Po"; else rm -f "$(DEPDIR)/quantise.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/quantise.c' object='quantise.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o quantise.obj `if test -f '../src/quantise.c'; then $(CYGPATH_W) '../src/quantise.c'; else $(CYGPATH_W) '$(srcdir)/../src/quantise.c'; fi` - -dump.o: ../src/dump.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dump.o -MD -MP -MF "$(DEPDIR)/dump.Tpo" -c -o dump.o `test -f '../src/dump.c' || echo '$(srcdir)/'`../src/dump.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/dump.Tpo" "$(DEPDIR)/dump.Po"; else rm -f "$(DEPDIR)/dump.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/dump.c' object='dump.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dump.o `test -f '../src/dump.c' || echo '$(srcdir)/'`../src/dump.c - -dump.obj: ../src/dump.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dump.obj -MD -MP -MF "$(DEPDIR)/dump.Tpo" -c -o dump.obj `if test -f '../src/dump.c'; then $(CYGPATH_W) '../src/dump.c'; else $(CYGPATH_W) '$(srcdir)/../src/dump.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/dump.Tpo" "$(DEPDIR)/dump.Po"; else rm -f "$(DEPDIR)/dump.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/dump.c' object='dump.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dump.obj `if test -f '../src/dump.c'; then $(CYGPATH_W) '../src/dump.c'; else $(CYGPATH_W) '$(srcdir)/../src/dump.c'; fi` - -four1.o: ../src/four1.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT four1.o -MD -MP -MF "$(DEPDIR)/four1.Tpo" -c -o four1.o `test -f '../src/four1.c' || echo '$(srcdir)/'`../src/four1.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/four1.Tpo" "$(DEPDIR)/four1.Po"; else rm -f "$(DEPDIR)/four1.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/four1.c' object='four1.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o four1.o `test -f '../src/four1.c' || echo '$(srcdir)/'`../src/four1.c - -four1.obj: ../src/four1.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT four1.obj -MD -MP -MF "$(DEPDIR)/four1.Tpo" -c -o four1.obj `if test -f '../src/four1.c'; then $(CYGPATH_W) '../src/four1.c'; else $(CYGPATH_W) '$(srcdir)/../src/four1.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/four1.Tpo" "$(DEPDIR)/four1.Po"; else rm -f "$(DEPDIR)/four1.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/four1.c' object='four1.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o four1.obj `if test -f '../src/four1.c'; then $(CYGPATH_W) '../src/four1.c'; else $(CYGPATH_W) '$(srcdir)/../src/four1.c'; fi` - -codec2.o: ../src/codec2.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT codec2.o -MD -MP -MF "$(DEPDIR)/codec2.Tpo" -c -o codec2.o `test -f '../src/codec2.c' || echo '$(srcdir)/'`../src/codec2.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/codec2.Tpo" "$(DEPDIR)/codec2.Po"; else rm -f "$(DEPDIR)/codec2.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/codec2.c' object='codec2.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o codec2.o `test -f '../src/codec2.c' || echo '$(srcdir)/'`../src/codec2.c - -codec2.obj: ../src/codec2.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT codec2.obj -MD -MP -MF "$(DEPDIR)/codec2.Tpo" -c -o codec2.obj `if test -f '../src/codec2.c'; then $(CYGPATH_W) '../src/codec2.c'; else $(CYGPATH_W) '$(srcdir)/../src/codec2.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/codec2.Tpo" "$(DEPDIR)/codec2.Po"; else rm -f "$(DEPDIR)/codec2.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/codec2.c' object='codec2.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o codec2.obj `if test -f '../src/codec2.c'; then $(CYGPATH_W) '../src/codec2.c'; else $(CYGPATH_W) '$(srcdir)/../src/codec2.c'; fi` - -sine.o: ../src/sine.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sine.o -MD -MP -MF "$(DEPDIR)/sine.Tpo" -c -o sine.o `test -f '../src/sine.c' || echo '$(srcdir)/'`../src/sine.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/sine.Tpo" "$(DEPDIR)/sine.Po"; else rm -f "$(DEPDIR)/sine.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/sine.c' object='sine.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sine.o `test -f '../src/sine.c' || echo '$(srcdir)/'`../src/sine.c - -sine.obj: ../src/sine.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sine.obj -MD -MP -MF "$(DEPDIR)/sine.Tpo" -c -o sine.obj `if test -f '../src/sine.c'; then $(CYGPATH_W) '../src/sine.c'; else $(CYGPATH_W) '$(srcdir)/../src/sine.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/sine.Tpo" "$(DEPDIR)/sine.Po"; else rm -f "$(DEPDIR)/sine.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/sine.c' object='sine.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sine.obj `if test -f '../src/sine.c'; then $(CYGPATH_W) '../src/sine.c'; else $(CYGPATH_W) '$(srcdir)/../src/sine.c'; fi` - -nlp.o: ../src/nlp.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nlp.o -MD -MP -MF "$(DEPDIR)/nlp.Tpo" -c -o nlp.o `test -f '../src/nlp.c' || echo '$(srcdir)/'`../src/nlp.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/nlp.Tpo" "$(DEPDIR)/nlp.Po"; else rm -f "$(DEPDIR)/nlp.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/nlp.c' object='nlp.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nlp.o `test -f '../src/nlp.c' || echo '$(srcdir)/'`../src/nlp.c - -nlp.obj: ../src/nlp.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nlp.obj -MD -MP -MF "$(DEPDIR)/nlp.Tpo" -c -o nlp.obj `if test -f '../src/nlp.c'; then $(CYGPATH_W) '../src/nlp.c'; else $(CYGPATH_W) '$(srcdir)/../src/nlp.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/nlp.Tpo" "$(DEPDIR)/nlp.Po"; else rm -f "$(DEPDIR)/nlp.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/nlp.c' object='nlp.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nlp.obj `if test -f '../src/nlp.c'; then $(CYGPATH_W) '../src/nlp.c'; else $(CYGPATH_W) '$(srcdir)/../src/nlp.c'; fi` - -postfilter.o: ../src/postfilter.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT postfilter.o -MD -MP -MF "$(DEPDIR)/postfilter.Tpo" -c -o postfilter.o `test -f '../src/postfilter.c' || echo '$(srcdir)/'`../src/postfilter.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/postfilter.Tpo" "$(DEPDIR)/postfilter.Po"; else rm -f "$(DEPDIR)/postfilter.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/postfilter.c' object='postfilter.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o postfilter.o `test -f '../src/postfilter.c' || echo '$(srcdir)/'`../src/postfilter.c - -postfilter.obj: ../src/postfilter.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT postfilter.obj -MD -MP -MF "$(DEPDIR)/postfilter.Tpo" -c -o postfilter.obj `if test -f '../src/postfilter.c'; then $(CYGPATH_W) '../src/postfilter.c'; else $(CYGPATH_W) '$(srcdir)/../src/postfilter.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/postfilter.Tpo" "$(DEPDIR)/postfilter.Po"; else rm -f "$(DEPDIR)/postfilter.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/postfilter.c' object='postfilter.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o postfilter.obj `if test -f '../src/postfilter.c'; then $(CYGPATH_W) '../src/postfilter.c'; else $(CYGPATH_W) '$(srcdir)/../src/postfilter.c'; fi` - -phase.o: ../src/phase.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT phase.o -MD -MP -MF "$(DEPDIR)/phase.Tpo" -c -o phase.o `test -f '../src/phase.c' || echo '$(srcdir)/'`../src/phase.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/phase.Tpo" "$(DEPDIR)/phase.Po"; else rm -f "$(DEPDIR)/phase.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/phase.c' object='phase.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o phase.o `test -f '../src/phase.c' || echo '$(srcdir)/'`../src/phase.c - -phase.obj: ../src/phase.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT phase.obj -MD -MP -MF "$(DEPDIR)/phase.Tpo" -c -o phase.obj `if test -f '../src/phase.c'; then $(CYGPATH_W) '../src/phase.c'; else $(CYGPATH_W) '$(srcdir)/../src/phase.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/phase.Tpo" "$(DEPDIR)/phase.Po"; else rm -f "$(DEPDIR)/phase.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/phase.c' object='phase.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o phase.obj `if test -f '../src/phase.c'; then $(CYGPATH_W) '../src/phase.c'; else $(CYGPATH_W) '$(srcdir)/../src/phase.c'; fi` - -interp.o: ../src/interp.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT interp.o -MD -MP -MF "$(DEPDIR)/interp.Tpo" -c -o interp.o `test -f '../src/interp.c' || echo '$(srcdir)/'`../src/interp.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/interp.Tpo" "$(DEPDIR)/interp.Po"; else rm -f "$(DEPDIR)/interp.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/interp.c' object='interp.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o interp.o `test -f '../src/interp.c' || echo '$(srcdir)/'`../src/interp.c - -interp.obj: ../src/interp.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT interp.obj -MD -MP -MF "$(DEPDIR)/interp.Tpo" -c -o interp.obj `if test -f '../src/interp.c'; then $(CYGPATH_W) '../src/interp.c'; else $(CYGPATH_W) '$(srcdir)/../src/interp.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/interp.Tpo" "$(DEPDIR)/interp.Po"; else rm -f "$(DEPDIR)/interp.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/interp.c' object='interp.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o interp.obj `if test -f '../src/interp.c'; then $(CYGPATH_W) '../src/interp.c'; else $(CYGPATH_W) '$(srcdir)/../src/interp.c'; fi` - -pack.o: ../src/pack.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pack.o -MD -MP -MF "$(DEPDIR)/pack.Tpo" -c -o pack.o `test -f '../src/pack.c' || echo '$(srcdir)/'`../src/pack.c; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pack.Tpo" "$(DEPDIR)/pack.Po"; else rm -f "$(DEPDIR)/pack.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/pack.c' object='pack.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pack.o `test -f '../src/pack.c' || echo '$(srcdir)/'`../src/pack.c - -pack.obj: ../src/pack.c -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pack.obj -MD -MP -MF "$(DEPDIR)/pack.Tpo" -c -o pack.obj `if test -f '../src/pack.c'; then $(CYGPATH_W) '../src/pack.c'; else $(CYGPATH_W) '$(srcdir)/../src/pack.c'; fi`; \ -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pack.Tpo" "$(DEPDIR)/pack.Po"; else rm -f "$(DEPDIR)/pack.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/pack.c' object='pack.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pack.obj `if test -f '../src/pack.c'; then $(CYGPATH_W) '../src/pack.c'; else $(CYGPATH_W) '$(srcdir)/../src/pack.c'; fi` - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -distclean-libtool: - -rm -f libtool -uninstall-info-am: - -ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - mkid -fID $$unique -tags: TAGS - -TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$tags $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && cd $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) $$here - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test "$$dir" != "$$file" && test "$$dir" != "."; then \ - dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ - else \ - dir=''; \ - fi; \ - if test -d $$d/$$file; then \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(PROGRAMS) -installdirs: - for dir in "$(DESTDIR)$(bindir)"; do \ - test -z "$$dir" || $(mkdir_p) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -info: info-am - -info-am: - -install-data-am: - -install-exec-am: install-binPROGRAMS - -install-info: install-info-am - -install-man: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-binPROGRAMS uninstall-info-am - -.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-generic clean-libtool ctags distclean distclean-compile \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-binPROGRAMS install-data install-data-am install-exec \ - install-exec-am install-info install-info-am install-man \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags uninstall uninstall-am \ - uninstall-binPROGRAMS uninstall-info-am - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: commit e946da9a7d85aaf39053c1119b98f52a02d0acf1 Author: Mathieu Rene <mrene@avgs.ca> Date: Wed Sep 29 19:49:18 2010 -0400 FS-861 diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index c3248d1..562a091 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2312,12 +2312,6 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) } else { sofia_clear_pflag(profile, PFLAG_FORWARD_MWI_NOTIFY); } - } else if (!strcasecmp(var, "forward-unsolicited-mwi-notify")) { - if (switch_true(val)) { - sofia_set_pflag(profile, PFLAG_FORWARD_MWI_NOTIFY); - } else { - sofia_clear_pflag(profile, PFLAG_FORWARD_MWI_NOTIFY); - } } else if (!strcasecmp(var, "t38-passthru")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_T38_PASSTHRU); @@ -2933,6 +2927,12 @@ switch_status_t config_sofia(int reload, char *profile_name) } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ODBC IS NOT AVAILABLE!\n"); } + } else if (!strcasecmp(var, "forward-unsolicited-mwi-notify")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_FORWARD_MWI_NOTIFY); + } else { + sofia_clear_pflag(profile, PFLAG_FORWARD_MWI_NOTIFY); + } } else if (!strcasecmp(var, "user-agent-string")) { profile->user_agent = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "auto-restart")) { commit 952c7abb893c8081875a1590ee5ba5e82f02c67c Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Wed Sep 29 19:39:46 2010 -0400 mod_silk: Small typo following new fmtp parser diff --git a/src/mod/codecs/mod_silk/mod_silk.c b/src/mod/codecs/mod_silk/mod_silk.c index ff8c230..934c9eb 100644 --- a/src/mod/codecs/mod_silk/mod_silk.c +++ b/src/mod/codecs/mod_silk/mod_silk.c @@ -102,7 +102,7 @@ static switch_status_t switch_silk_fmtp_parse(const char *fmtp, switch_codec_fmt codec_settings->usedtx = 1; } } - if (!strcasecmp(data, "axaveragebitrate")) { + if (!strcasecmp(data, "maxaveragebitrate")) { codec_settings->maxaveragebitrate = atoi(arg); switch(codec_fmtp->actual_samples_per_second) { case 8000: @@ -220,7 +220,7 @@ static switch_status_t switch_silk_init(switch_codec_t *codec, static switch_status_t switch_silk_destroy(switch_codec_t *codec) { - codec->private_info = NULL; + codec->private_info = NULL; return SWITCH_STATUS_SUCCESS; } commit 633f193daeaf6299620497929f24078219981d38 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Sep 29 16:52:34 2010 -0500 add bitrate patch from moc with some extra stuff for late neg mode diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 7275f26..8b08db7 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -1339,12 +1339,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_timer_destroy(switch_timer_t *timer) \param pool the memory pool to use \return SWITCH_STATUS_SUCCESS if the handle is allocated */ -SWITCH_DECLARE(switch_status_t) switch_core_codec_init(switch_codec_t *codec, +#define switch_core_codec_init(_codec, _codec_name, _fmtp, _rate, _ms, _channels, _flags, _codec_settings, _pool) \ + switch_core_codec_init_with_bitrate(_codec, _codec_name, _fmtp, _rate, _ms, _channels, 0, _flags, _codec_settings, _pool) +SWITCH_DECLARE(switch_status_t) switch_core_codec_init_with_bitrate(switch_codec_t *codec, const char *codec_name, const char *fmtp, uint32_t rate, int ms, int channels, + uint32_t bitrate, uint32_t flags, const switch_codec_settings_t *codec_settings, switch_memory_pool_t *pool); SWITCH_DECLARE(switch_status_t) switch_core_codec_copy(switch_codec_t *codec, switch_codec_t *new_codec, switch_memory_pool_t *pool); diff --git a/src/include/switch_module_interfaces.h b/src/include/switch_module_interfaces.h index 078b83d..a6013a9 100644 --- a/src/include/switch_module_interfaces.h +++ b/src/include/switch_module_interfaces.h @@ -570,42 +570,23 @@ struct switch_directory_handle { void *private_info; }; - /* nobody has more setting than speex so we will let them set the standard */ /*! \brief Various codec settings (currently only relevant to speex) */ struct switch_codec_settings { - /*! desired quality */ - int quality; - /*! desired complexity */ - int complexity; - /*! desired enhancement */ - int enhancement; - /*! desired vad level */ - int vad; - /*! desired vbr level */ - int vbr; - /*! desired vbr quality */ - float vbr_quality; - /*! desired abr level */ - int abr; - /*! desired dtx setting */ - int dtx; - /*! desired preprocessor settings */ - int preproc; - /*! preprocessor vad settings */ - int pp_vad; - /*! preprocessor gain control settings */ - int pp_agc; - /*! preprocessor gain level */ - float pp_agc_level; - /*! preprocessor denoise level */ - int pp_denoise; - /*! preprocessor dereverb settings */ - int pp_dereverb; - /*! preprocessor dereverb decay level */ - float pp_dereverb_decay; - /*! preprocessor dereverb level */ - float pp_dereverb_level; + int unused; +}; + +/*! an abstract handle of a fmtp parsed by codec */ +struct switch_codec_fmtp { + /*! actual samples transferred per second for those who are not moron g722 RFC writers */ + uint32_t actual_samples_per_second; + /*! bits transferred per second */ + int bits_per_second; + /*! number of microseconds of media in one packet (ptime * 1000) */ + int microseconds_per_packet; + /*! private data for the codec module to store handle specific info */ + void *private_info; + }; /*! an abstract handle to a codec module */ @@ -618,8 +599,6 @@ struct switch_codec { char *fmtp_in; /*! fmtp line for local sdp */ char *fmtp_out; - /*! codec settings for this handle */ - switch_codec_settings_t codec_settings; /*! flags to modify behaviour */ uint32_t flags; /*! the handle's memory pool */ @@ -678,6 +657,8 @@ struct switch_codec_interface { const char *interface_name; /*! a list of codec implementations related to the codec */ switch_codec_implementation_t *implementations; + /*! function to decode a codec fmtp parameters */ + switch_core_codec_fmtp_parse_func_t parse_fmtp; uint32_t codec_id; switch_thread_rwlock_t *rwlock; int refs; diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 70eaa4f..57c5661 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1588,6 +1588,7 @@ typedef struct switch_core_thread_session switch_core_thread_session_t; typedef struct switch_codec_implementation switch_codec_implementation_t; typedef struct switch_buffer switch_buffer_t; typedef struct switch_codec_settings switch_codec_settings_t; +typedef struct switch_codec_fmtp switch_codec_fmtp_t; typedef struct switch_odbc_handle switch_odbc_handle_t; typedef struct switch_io_routines switch_io_routines_t; @@ -1646,6 +1647,7 @@ typedef switch_status_t (*switch_core_codec_decode_func_t) (switch_codec_t *code void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate, unsigned int *flag); typedef switch_status_t (*switch_core_codec_init_func_t) (switch_codec_t *, switch_codec_flag_t, const switch_codec_settings_t *codec_settings); +typedef switch_status_t (*switch_core_codec_fmtp_parse_func_t) (const char *fmtp, switch_codec_fmtp_t *codec_fmtp); typedef switch_status_t (*switch_core_codec_destroy_func_t) (switch_codec_t *); diff --git a/src/mod/codecs/mod_amr/mod_amr.c b/src/mod/codecs/mod_amr/mod_amr.c index a864254..e8925c4 100644 --- a/src/mod/codecs/mod_amr/mod_amr.c +++ b/src/mod/codecs/mod_amr/mod_amr.c @@ -98,11 +98,8 @@ typedef enum { AMR_DTX_ENABLED } amr_dtx_t; -struct amr_context { - void *encoder_state; - void *decoder_state; - switch_byte_t enc_modes; - switch_byte_t enc_mode; +/*! \brief Various codec settings */ +struct amr_codec_settings { int dtx_mode; uint32_t change_period; switch_byte_t max_ptime; @@ -110,6 +107,24 @@ struct amr_context { switch_byte_t channels; switch_byte_t flags; }; +typedef struct amr_codec_settings amr_codec_settings_t; + +static amr_codec_settings_t default_codec_settings = { + /*.dtx_mode */ AMR_DTX_ENABLED, + /*.change_period */ 0, + /*.max_ptime */ 0, + /*.ptime */ 0, + /*.channels */ 0, + /*.flags */ 0, +}; + + +struct amr_context { + void *encoder_state; + void *decoder_state; + switch_byte_t enc_modes; + switch_byte_t enc_mode; +}; #define AMR_DEFAULT_BITRATE AMR_BITRATE_1220 @@ -117,6 +132,88 @@ static struct { switch_byte_t default_bitrate; } globals; +static switch_status_t switch_amr_fmtp_parse(const char *fmtp, switch_codec_fmtp_t *codec_fmtp) +{ + if (codec_fmtp) { + amr_codec_settings_t *codec_settings = NULL; + if (codec_fmtp->private_info) { + codec_settings = codec_fmtp->private_info; + memcpy(codec_settings, &default_codec_settings, sizeof(*codec_settings)); + } + + if (fmtp) { + int x, argc; + char *argv[10]; + char *fmtp_dup = strdup(fmtp); + + switch_assert(fmtp_dup); + + argc = switch_separate_string((char *) fmtp_dup, ';', argv, (sizeof(argv) / sizeof(argv[0]))); + for (x = 0; x < argc; x++) { + char *data = argv[x]; + char *arg; + switch_assert(data); + while (*data == ' ') { + data++; + } + if ((arg = strchr(data, '='))) { + *arg++ = '\0'; + /* + if (!strcasecmp(data, "bitrate")) { + bit_rate = atoi(arg); + } + */ + if (codec_settings) { + if (!strcasecmp(data, "octet-align")) { + if (atoi(arg)) { + switch_set_flag(codec_settings, AMR_OPT_OCTET_ALIGN); + } + } else if (!strcasecmp(data, "mode-change-neighbor")) { + if (atoi(arg)) { + switch_set_flag(codec_settings, AMR_OPT_MODE_CHANGE_NEIGHBOR); + } + } else if (!strcasecmp(data, "crc")) { + if (atoi(arg)) { + switch_set_flag(codec_settings, AMR_OPT_CRC); + } + } else if (!strcasecmp(data, "robust-sorting")) { + if (atoi(arg)) { + switch_set_flag(codec_settings, AMR_OPT_ROBUST_SORTING); + } + } else if (!strcasecmp(data, "interveaving")) { + if (atoi(arg)) { + switch_set_flag(codec_settings, AMR_OPT_INTERLEAVING); + } + } else if (!strcasecmp(data, "mode-change-period")) { + codec_settings->change_period = atoi(arg); + } else if (!strcasecmp(data, "ptime")) { + codec_settings->ptime = (switch_byte_t) atoi(arg); + } else if (!strcasecmp(data, "channels")) { + codec_settings->channels = (switch_byte_t) atoi(arg); + } else if (!strcasecmp(data, "maxptime")) { + codec_settings->max_ptime = (switch_byte_t) atoi(arg); + } else if (!strcasecmp(data, "mode-set")) { + int y, m_argc; + char *m_argv[7]; + m_argc = switch_separate_string(arg, ',', m_argv, (sizeof(m_argv) / sizeof(m_argv[0]))); + for (y = 0; y < m_argc; y++) { + codec_settings->enc_modes |= (1 << atoi(m_argv[y])); + } + } else if (!strcasecmp(data, "dtx")) { + codec_settings->dtx_mode = (atoi(arg)) ? AMR_DTX_ENABLED : AMR_DTX_DISABLED; + } + } + + } + } + free(fmtp_dup); + } + //codec_fmtp->bits_per_second = bit_rate; + return SWITCH_STATUS_SUCCESS; + } + return SWITCH_STATUS_FALSE; +} + #endif static switch_status_t switch_amr_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings) @@ -128,7 +225,10 @@ static switch_status_t switch_amr_init(switch_codec_t *codec, switch_codec_flag_ } return SWITCH_STATUS_SUCCESS; #else + struct amr_context *context = NULL; + switch_codec_fmtp_t codec_fmtp; + amr_codec_settings_t amr_codec_settings; int encoding, decoding; int x, i, argc; char *argv[10]; @@ -141,58 +241,9 @@ static switch_status_t switch_amr_init(switch_codec_t *codec, switch_codec_flag_ return SWITCH_STATUS_FALSE; } else { - context->dtx_mode = AMR_DTX_ENABLED; - if (codec->fmtp_in) { - argc = switch_separate_string(codec->fmtp_in, ';', argv, (sizeof(argv) / sizeof(argv[0]))); - for (x = 0; x < argc; x++) { - char *data = argv[x]; - char *arg; - while (*data && *data == ' ') { - data++; - } - if ((arg = strchr(data, '='))) { - *arg++ = '\0'; - if (!strcasecmp(data, "octet-align")) { - if (atoi(arg)) { - switch_set_flag(context, AMR_OPT_OCTET_ALIGN); - } - } else if (!strcasecmp(data, "mode-change-neighbor")) { - if (atoi(arg)) { - switch_set_flag(context, AMR_OPT_MODE_CHANGE_NEIGHBOR); - } - } else if (!strcasecmp(data, "crc")) { - if (atoi(arg)) { - switch_set_flag(context, AMR_OPT_CRC); - } - } else if (!strcasecmp(data, "robust-sorting")) { - if (atoi(arg)) { - switch_set_flag(context, AMR_OPT_ROBUST_SORTING); - } - } else if (!strcasecmp(data, "interveaving")) { - if (atoi(arg)) { - switch_set_flag(context, AMR_OPT_INTERLEAVING); - } - } else if (!strcasecmp(data, "mode-change-period")) { - context->change_period = atoi(arg); - } else if (!strcasecmp(data, "ptime")) { - context->ptime = (switch_byte_t) atoi(arg); - } else if (!strcasecmp(data, "channels")) { - context->channels = (switch_byte_t) atoi(arg); - } else if (!strcasecmp(data, "maxptime")) { - context->max_ptime = (switch_byte_t) atoi(arg); - } else if (!strcasecmp(data, "mode-set")) { - int y, m_argc; - char *m_argv[7]; - m_argc = switch_separate_string(arg, ',', m_argv, (sizeof(m_argv) / sizeof(m_argv[0]))); - for (y = 0; y < m_argc; y++) { - context->enc_modes |= (1 << atoi(m_argv[y])); - } - } else if (!strcasecmp(data, "dtx")) { - context->dtx_mode = (atoi(arg)) ? AMR_DTX_ENABLED : AMR_DTX_DISABLED; - } - } - } - } + memset(&codec_fmtp, '\0', sizeof(struct switch_codec_fmtp)); + codec_fmtp.private_info = &amr_codec_settings; + switch_amr_fmtp_parse(codec->fmtp_in, &codec_fmtp); if (context->enc_modes) { for (i = 7; i > -1; i++) { @@ -321,6 +372,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_amr_load) *module_interface = switch_loadable_module_create_module_interface(pool, modname); SWITCH_ADD_CODEC(codec_interface, "AMR"); +#ifndef AMR_PASSTHROUGH + codec_interface->parse_fmtp = switch_amr_fmtp_parse; +#endif switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ 96, /* the IANA code number */ "AMR", /* the IANA code name */ diff --git a/src/mod/codecs/mod_ilbc/mod_ilbc.c b/src/mod/codecs/mod_ilbc/mod_ilbc.c index b37056c..8529837 100644 --- a/src/mod/codecs/mod_ilbc/mod_ilbc.c +++ b/src/mod/codecs/mod_ilbc/mod_ilbc.c @@ -40,6 +40,27 @@ struct ilbc_context { ilbc_decode_state_t decoder_object; }; +static switch_status_t switch_ilbc_fmtp_parse(const char *fmtp, switch_codec_fmtp_t *codec_fmtp) +{ + if (codec_fmtp) { + char *mode = NULL; + int codec_ms = 0; + + memset(codec_fmtp, '\0', sizeof(struct switch_codec_fmtp)); + + if (fmtp && (mode = strstr(fmtp, "mode=")) && (mode + 5)) { + codec_ms = atoi(mode + 5); + } + if (!codec_ms) { + /* default to 30 when no mode is defined for ilbc ONLY */ + codec_ms = 30; + } + codec_fmtp->microseconds_per_packet = (codec_ms * 1000); + return SWITCH_STATUS_SUCCESS; + } + return SWITCH_STATUS_FALSE; +} + static switch_status_t switch_ilbc_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings) { struct ilbc_context *context; @@ -51,26 +72,6 @@ static switch_status_t switch_ilbc_init(switch_codec_t *codec, switch_codec_flag return SWITCH_STATUS_FALSE; } - if (codec->fmtp_in) { - int x, argc; - char *argv[10]; - argc = switch_separate_string(codec->fmtp_in, ';', argv, (sizeof(argv) / sizeof(argv[0]))); - for (x = 0; x < argc; x++) { - char *data = argv[x]; - char *arg; - switch_assert(data); - while (*data == ' ') { - data++; - } - if ((arg = strchr(data, '='))) { - *arg++ = '\0'; - if (!strcasecmp(data, "mode")) { - mode = atoi(arg); - } - } - } - } - codec->fmtp_out = switch_core_sprintf(codec->memory_pool, "mode=%d", mode); if (encoding) { @@ -136,6 +137,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_ilbc_load) *module_interface = switch_loadable_module_create_module_interface(pool, modname); SWITCH_ADD_CODEC(codec_interface, "iLBC"); + codec_interface->parse_fmtp = switch_ilbc_fmtp_parse; switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ 98, /* the IANA code number */ diff --git a/src/mod/codecs/mod_silk/mod_silk.c b/src/mod/codecs/mod_silk/mod_silk.c index 9d0abcd..ff8c230 100644 --- a/src/mod/codecs/mod_silk/mod_silk.c +++ b/src/mod/codecs/mod_silk/mod_silk.c @@ -41,6 +41,22 @@ SWITCH_MODULE_DEFINITION(mod_silk, mod_silk_load, NULL, NULL); #define MAX_LBRR_DELAY 2 #define MAX_FRAME_LENGTH 480 +/*! \brief Various codec settings */ +struct silk_codec_settings { + SKP_int useinbandfec; + SKP_int usedtx; + SKP_int maxaveragebitrate; + SKP_int plpct; +}; +typedef struct silk_codec_settings silk_codec_settings_t; + +static silk_codec_settings_t default_codec_settings = { + /*.useinbandfec */ 0, + /*.usedtx */ 0, + /*.maxaveragebitrate */ 0, + /*.plpct */ 10, // 10% for now +}; + struct silk_context { SKP_SILK_SDK_EncControlStruct encoder_object; SKP_SILK_SDK_DecControlStruct decoder_object; @@ -48,92 +64,122 @@ struct silk_context { void *dec_state; }; -static switch_status_t switch_silk_init(switch_codec_t *codec, - switch_codec_flag_t freeswitch_flags, - const switch_codec_settings_t *codec_settings) +static switch_status_t switch_silk_fmtp_parse(const char *fmtp, switch_codec_fmtp_t *codec_fmtp) { - struct silk_context *context = NULL; - SKP_int useinbandfec = 0, usedtx = 0, maxaveragebitrate = 0, plpct =0; - SKP_int32 encSizeBytes; - SKP_int32 decSizeBytes; - int encoding = (freeswitch_flags & SWITCH_CODEC_FLAG_ENCODE); - int decoding = (freeswitch_flags & SWITCH_CODEC_FLAG_DECODE); + if (codec_fmtp) { + silk_codec_settings_t *codec_settings = NULL; - if (!(encoding || decoding) || (!(context = switch_core_alloc(codec->memory_pool, sizeof(*context))))) { - return SWITCH_STATUS_FALSE; - } - - if (codec->fmtp_in) { - int x, argc; - char *argv[10]; - argc = switch_separate_string(codec->fmtp_in, ';', argv, (sizeof(argv) / sizeof(argv[0]))); - for (x = 0; x < argc; x++) { - char *data = argv[x]; - char *arg; - switch_assert(data); - while (*data == ' ') { - data++; - } - if ((arg = strchr(data, '='))) { - *arg++ = '\0'; - if (!strcasecmp(data, "useinbandfec")) { - if (switch_true(arg)) { - useinbandfec = 1; - plpct = 10;// 10% for now - } - } - if (!strcasecmp(data, "usedtx")) { - if (switch_true(arg)) { - usedtx = 1; - } + if (codec_fmtp->private_info) { + codec_settings = codec_fmtp->private_info; + memcpy(codec_settings, &default_codec_settings, sizeof(*codec_settings)); + } + + if (fmtp) { + int x, argc; + char *argv[10]; + char *fmtp_dup = strdup(fmtp); + + switch_assert(fmtp_dup); + + argc = switch_separate_string(fmtp_dup, ';', argv, (sizeof(argv) / sizeof(argv[0]))); + for (x = 0; x < argc; x++) { + char *data = argv[x]; + char *arg; + switch_assert(data); + while (*data == ' ') { + data++; } - if (!strcasecmp(data, "maxaveragebitrate")) { - maxaveragebitrate = atoi(arg); - switch(codec->implementation->actual_samples_per_second) { - case 8000: - { - if(maxaveragebitrate < 6000 || maxaveragebitrate > 20000) { - maxaveragebitrate = 20000; + if ((arg = strchr(data, '='))) { + *arg++ = '\0'; + if (codec_settings) { + if (!strcasecmp(data, "useinbandfec")) { + if (switch_true(arg)) { + codec_settings->useinbandfec = 1; } - break; } - case 12000: - { - if(maxaveragebitrate < 7000 || maxaveragebitrate > 25000) { - maxaveragebitrate = 25000; + if (!strcasecmp(data, "usedtx")) { + if (switch_true(arg)) { + codec_settings->usedtx = 1; } - break; } - case 16000: - { - if(maxaveragebitrate < 8000 || maxaveragebitrate > 30000) { - maxaveragebitrate = 30000; - } - break; - } - case 24000: - { - if(maxaveragebitrate < 12000 || maxaveragebitrate > 40000) { - maxaveragebitrate = 40000; + if (!strcasecmp(data, "axaveragebitrate")) { + codec_settings->maxaveragebitrate = atoi(arg); + switch(codec_fmtp->actual_samples_per_second) { + case 8000: + { + if(codec_settings->maxaveragebitrate < 6000 || codec_settings->maxaveragebitrate > 20000) { + codec_settings->maxaveragebitrate = 20000; + } + break; + } + case 12000: + { + if(codec_settings->maxaveragebitrate < 7000 || codec_settings->maxaveragebitrate > 25000) { + codec_settings->maxaveragebitrate = 25000; + } + break; + } + case 16000: + { + if(codec_settings->maxaveragebitrate < 8000 || codec_settings->maxaveragebitrate > 30000) { + codec_settings->maxaveragebitrate = 30000; + } + break; + } + case 24000: + { + if(codec_settings->maxaveragebitrate < 12000 || codec_settings->maxaveragebitrate > 40000) { + codec_settings->maxaveragebitrate = 40000; + } + break; + } + + default: + /* this should never happen but 20000 is common among all rates */ + codec_settings->maxaveragebitrate = 20000; + break; } - break; + } - - default: - /* this should never happen but 20000 is common among all rates */ - maxaveragebitrate = 20000; - break; + } - } } + free(fmtp_dup); } + //codec_fmtp->bits_per_second = bit_rate; + return SWITCH_STATUS_SUCCESS; + } + return SWITCH_STATUS_FALSE; +} + + + + +static switch_status_t switch_silk_init(switch_codec_t *codec, + switch_codec_flag_t freeswitch_flags, + const switch_codec_settings_t *codec_settings) +{ + struct silk_context *context = NULL; + switch_codec_fmtp_t codec_fmtp; + silk_codec_settings_t silk_codec_settings; + SKP_int32 encSizeBytes; + SKP_int32 decSizeBytes; + int encoding = (freeswitch_flags & SWITCH_CODEC_FLAG_ENCODE); + int decoding = (freeswitch_flags & SWITCH_CODEC_FLAG_DECODE); + + if (!(encoding || decoding) || (!(context = switch_core_alloc(codec->memory_pool, sizeof(*context))))) { + return SWITCH_STATUS_FALSE; } + + memset(&codec_fmtp, '\0', sizeof(struct switch_codec_fmtp)); + codec_fmtp.private_info = &silk_codec_settings; + switch_silk_fmtp_parse(codec->fmtp_in, &codec_fmtp); codec->fmtp_out = switch_core_sprintf(codec->memory_pool, "useinbandfec=%s; usedtx=%s; maxaveragebitrate=%d", - useinbandfec ? "1" : "0", - usedtx ? "1" : "0", - maxaveragebitrate ? maxaveragebitrate : codec->implementation->bits_per_second); + silk_codec_settings.useinbandfec ? "1" : "0", + silk_codec_settings.usedtx ? "1" : "0", + silk_codec_settings.maxaveragebitrate ? silk_codec_settings.maxaveragebitrate : codec->implementation->bits_per_second); if (encoding) { if (SKP_Silk_SDK_Get_Encoder_Size(&encSizeBytes)) { @@ -148,11 +194,11 @@ static switch_status_t switch_silk_init(switch_codec_t *codec, context->encoder_object.sampleRate = codec->implementation->actual_samples_per_second; context->encoder_object.packetSize = codec->implementation->samples_per_packet; - context->encoder_object.useInBandFEC = useinbandfec; + context->encoder_object.useInBandFEC = silk_codec_settings.useinbandfec; context->encoder_object.complexity = 0; - context->encoder_object.bitRate = maxaveragebitrate ? maxaveragebitrate : codec->implementation->bits_per_second; - context->encoder_object.useDTX = usedtx; - context->encoder_object.packetLossPercentage = plpct;; + context->encoder_object.bitRate = silk_codec_settings.maxaveragebitrate ? silk_codec_settings.maxaveragebitrate : codec->implementation->bits_per_second; + context->encoder_object.useDTX = silk_codec_settings.usedtx; + context->encoder_object.packetLossPercentage = silk_codec_settings.plpct; } if (decoding) { @@ -299,6 +345,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_silk_load) *module_interface = switch_loadable_module_create_module_interface(pool, modname); SWITCH_ADD_CODEC(codec_interface, "SILK"); + codec_interface->parse_fmtp = switch_silk_fmtp_parse; switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ 117, /* the IANA code number */ diff --git a/src/mod/codecs/mod_siren/mod_siren.c b/src/mod/codecs/mod_siren/mod_siren.c index 1ccd36e..4646ffc 100644 --- a/src/mod/codecs/mod_siren/mod_siren.c +++ b/src/mod/codecs/mod_siren/mod_siren.c @@ -47,6 +47,40 @@ struct siren_context { g722_1_encode_state_t encoder_object; }; +static switch_status_t switch_siren_fmtp_parse(const char *fmtp, switch_codec_fmtp_t *codec_fmtp) +{ + if (codec_fmtp) { + int bit_rate = 0; + memset(codec_fmtp, '\0', sizeof(struct switch_codec_fmtp)); + if (fmtp) { + int x, argc; + char *argv[10]; + char *fmtp_dup = strdup(fmtp); + + switch_assert(fmtp_dup); + argc = switch_separate_string(fmtp_dup, ';', argv, (sizeof(argv) / sizeof(argv[0]))); + for (x = 0; x < argc; x++) { + char *data = argv[x]; + char *arg; + switch_assert(data); + while (*data == ' ') { + data++; + } + if ((arg = strchr(data, '='))) { + *arg++ = '\0'; + if (!strcasecmp(data, "bitrate")) { + bit_rate = atoi(arg); + } + } + } + free(fmtp_dup); + } + codec_fmtp->bits_per_second = bit_rate; + return SWITCH_STATUS_SUCCESS; + } + return SWITCH_STATUS_FALSE; +} + static switch_status_t switch_siren_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings) { struct siren_context *context = NULL; @@ -58,26 +92,6 @@ static switch_status_t switch_siren_init(switch_codec_t *codec, switch_codec_fla return SWITCH_STATUS_FALSE; } - if (codec->fmtp_in) { - int x, argc; - char *argv[10]; - argc = switch_separate_string(codec->fmtp_in, ';', argv, (sizeof(argv) / sizeof(argv[0]))); - for (x = 0; x < argc; x++) { - char *data = argv[x]; - char *arg; - switch_assert(data); - while (*data == ' ') { - data++; - } - if ((arg = strchr(data, '='))) { - *arg++ = '\0'; - if (!strcasecmp(data, "bitrate")) { - bit_rate = atoi(arg); - } - } - } - } - codec->fmtp_out = switch_core_sprintf(codec->memory_pool, "bitrate=%d", bit_rate); if (encoding) { @@ -145,6 +159,28 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_siren_load) *module_interface = switch_loadable_module_create_module_interface(pool, modname); SWITCH_ADD_CODEC(codec_interface, "Polycom(R) G722.1/G722.1C"); + codec_interface->parse_fmtp = switch_siren_fmtp_parse; + + spf = 320, bpf = 640; + for (count = 3; count > 0; count--) { + switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ + 107, /* the IANA code number */ + "G7221", /* the IANA code name */ + "bitrate=24000", /* default fmtp to send (can be overridden by the init function) */ + 16000, /* samples transferred per second */ + 16000, /* actual samples transferred per second */ + 24000, /* bits transferred per second */ + mpf * count, /* number of microseconds per frame */ + spf * count, /* number of samples per frame */ + bpf * count, /* number of bytes per frame decompressed */ + 0, /* number of bytes per frame compressed */ + 1, /* number of channels represented */ + 1, /* number of frames per network packet */ + switch_siren_init, /* function to initialize a codec handle using this implementation */ + switch_siren_encode, /* function to encode raw data into encoded data */ + switch_siren_decode, /* function to decode encoded data into raw data */ + switch_siren_destroy); /* deinitalize a codec handle using this implementation */ + } spf = 320, bpf = 640; for (count = 3; count > 0; count--) { diff --git a/src/mod/codecs/mod_speex/mod_speex.c b/src/mod/codecs/mod_speex/mod_speex.c index 1d4a040..a951b12 100644 --- a/src/mod/codecs/mod_speex/mod_speex.c +++ b/src/mod/codecs/mod_speex/mod_speex.c @@ -37,7 +37,46 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_speex_load); SWITCH_MODULE_DEFINITION(mod_speex, mod_speex_load, NULL, NULL); -static switch_codec_settings_t default_codec_settings = { +/* nobody has more setting than speex so we will let them set the standard */ +/*! \brief Various codec settings (currently only relevant to speex) */ +struct speex_codec_settings { + /*! desired quality */ + int quality; + /*! desired complexity */ + int complexity; + /*! desired enhancement */ + int enhancement; + /*! desired vad level */ + int vad; + /*! desired vbr level */ + int vbr; + /*! desired vbr quality */ + float vbr_quality; + /*! desired abr level */ + int abr; + /*! desired dtx setting */ + int dtx; + /*! desired preprocessor settings */ + int preproc; + /*! preprocessor vad settings */ + int pp_vad; + /*! preprocessor gain control settings */ + int pp_agc; + /*! preprocessor gain level */ + float pp_agc_level; + /*! preprocessor denoise level */ + int pp_denoise; + /*! preprocessor dereverb settings */ + int pp_dereverb; + /*! preprocessor dereverb decay level */ + float pp_dereverb_decay; + /*! preprocessor dereverb level */ + float pp_dereverb_level; +}; + +typedef struct speex_codec_settings speex_codec_settings_t; + +static speex_codec_settings_t default_codec_settings = { /*.quality */ 5, /*.complexity */ 5, /*.enhancement */ 1, @@ -58,6 +97,7 @@ static switch_codec_settings_t default_codec_settings = { struct speex_context { switch_codec_t *codec; + speex_codec_settings_t codec_settings; unsigned int flags; /* Encoder */ @@ -74,6 +114,56 @@ struct speex_context { int decoder_mode; }; +static switch_status_t switch_speex_fmtp_parse(const char *fmtp, switch_codec_fmtp_t *codec_fmtp) +{ + if (codec_fmtp) { + speex_codec_settings_t *codec_settings = NULL; + if (codec_fmtp->private_info) { + codec_settings = codec_fmtp->private_info; + memcpy(codec_settings, &default_codec_settings, sizeof(*codec_settings)); + } + + if (fmtp) { + int x, argc; + char *argv[10]; + char *fmtp_dup = strdup(fmtp); + + switch_assert(fmtp_dup); + + argc = switch_separate_string(fmtp_dup, ';', argv, (sizeof(argv) / sizeof(argv[0]))); + + for (x = 0; x < argc; x++) { + char *data = argv[x]; + char *arg; + switch_assert(data); + while (*data == ' ') { + data++; + } + if ((arg = strchr(data, '='))) { + *arg++ = '\0'; + /* + if (!strcasecmp(data, "bitrate")) { + bit_rate = atoi(arg); + } + */ + /* + if (codec_settings) { + if (!strcasecmp(data, "vad")) { + bit_rate = atoi(arg); + } + } + */ + } + } + free(fmtp_dup); + } + /*codec_fmtp->bits_per_second = bit_rate;*/ + return SWITCH_STATUS_SUCCESS; + } + return SWITCH_STATUS_FALSE; +} + + static switch_status_t switch_speex_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings) { struct speex_context *context = NULL; @@ -82,16 +172,18 @@ static switch_status_t switch_speex_init(switch_codec_t *codec, switch_codec_fla encoding = (flags & SWITCH_CODEC_FLAG_ENCODE); decoding = (flags & SWITCH_CODEC_FLAG_DECODE); - if (!codec_settings) { - codec_settings = &default_codec_settings; - } - - memcpy(&codec->codec_settings, codec_settings, sizeof(codec->codec_settings)); - if (!(encoding || decoding) || ((context = switch_core_alloc(codec->memory_pool, sizeof(*context))) == 0)) { return SWITCH_STATUS_FALSE; } else { const SpeexMode *mode = NULL; + switch_codec_fmtp_t codec_fmtp; + speex_codec_settings_t codec_settings; + + memset(&codec_fmtp, '\0', sizeof(struct switch_codec_fmtp)); + codec_fmtp.private_info = &codec_settings; + switch_speex_fmtp_parse(codec->fmtp_in, &codec_fmtp); + + memcpy(&context->codec_settings, &codec_settings, sizeof(context->codec_settings)); context->codec = codec; if (codec->implementation->actual_samples_per_second == 8000) { @@ -110,41 +202,41 @@ static switch_status_t switch_speex_init(switch_codec_t *codec, switch_codec_fla speex_bits_init(&context->encoder_bits); context->encoder_state = speex_encoder_init(mode); speex_encoder_ctl(context->encoder_state, SPEEX_GET_FRAME_SIZE, &context->encoder_frame_size); - speex_encoder_ctl(context->encoder_state, SPEEX_SET_COMPLEXITY, &codec->codec_settings.complexity); - if (codec->codec_settings.preproc) { + speex_encoder_ctl(context->encoder_state, SPEEX_SET_COMPLEXITY, &context->codec_settings.complexity); + if (context->codec_settings.preproc) { context->pp = speex_preprocess_state_init(context->encoder_frame_size, codec->implementation->actual_samples_per_second); - speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_VAD, &codec->codec_settings.pp_vad); - speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_AGC, &codec->codec_settings.pp_agc); - speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_AGC_LEVEL, &codec->codec_settings.pp_agc_level); - speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_DENOISE, &codec->codec_settings.pp_denoise); - speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_DEREVERB, &codec->codec_settings.pp_dereverb); - speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_DEREVERB_DECAY, &codec->codec_settings.pp_dereverb_decay); - speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_DEREVERB_LEVEL, &codec->codec_settings.pp_dereverb_level); + speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_VAD, &context->codec_settings.pp_vad); + speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_AGC, &context->codec_settings.pp_agc); + speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_AGC_LEVEL, &context->codec_settings.pp_agc_level); + speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_DENOISE, &context->codec_settings.pp_denoise); + speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_DEREVERB, &context->codec_settings.pp_dereverb); + speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_DEREVERB_DECAY, &context->codec_settings.pp_dereverb_decay); + speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_DEREVERB_LEVEL, &context->codec_settings.pp_dereverb_level); } - if (!codec->codec_settings.abr && !codec->codec_settings.vbr) { - speex_encoder_ctl(context->encoder_state, SPEEX_SET_QUALITY, &codec->codec_settings.quality); - if (codec->codec_settings.vad) { - speex_encoder_ctl(context->encoder_state, SPEEX_SET_VAD, &codec->codec_settings.vad); + if (!context->codec_settings.abr && !context->codec_settings.vbr) { + speex_encoder_ctl(context->encoder_state, SPEEX_SET_QUALITY, &context->codec_settings.quality); + if (context->codec_settings.vad) { + speex_encoder_ctl(context->encoder_state, SPEEX_SET_VAD, &context->codec_settings.vad); } } - if (codec->codec_settings.vbr) { - speex_encoder_ctl(context->encoder_state, SPEEX_SET_VBR, &codec->codec_settings.vbr); - speex_encoder_ctl(context->encoder_state, SPEEX_SET_VBR_QUALITY, &codec->codec_settings.vbr_quality); + if (context->codec_settings.vbr) { + speex_encoder_ctl(context->encoder_state, SPEEX_SET_VBR, &context->codec_settings.vbr); + speex_encoder_ctl(context->encoder_state, SPEEX_SET_VBR_QUALITY, &context->codec_settings.vbr_quality); } - if (codec->codec_settings.abr) { - speex_encoder_ctl(context->encoder_state, SPEEX_SET_ABR, &codec->codec_settings.abr); + if (context->codec_settings.abr) { + speex_encoder_ctl(context->encoder_state, SPEEX_SET_ABR, &context->codec_settings.abr); } - if (codec->codec_settings.dtx) { - speex_encoder_ctl(context->encoder_state, SPEEX_SET_DTX, &codec->codec_settings.dtx); + if (context->codec_settings.dtx) { + speex_encoder_ctl(context->encoder_state, SPEEX_SET_DTX, &context->codec_settings.dtx); } } if (decoding) { speex_bits_init(&context->decoder_bits); context->decoder_state = speex_decoder_init(mode); - if (codec->codec_settings.enhancement) { - speex_decoder_ctl(context->decoder_state, SPEEX_SET_ENH, &codec->codec_settings.enhancement); + if (context->codec_settings.enhancement) { + speex_decoder_ctl(context->decoder_state, SPEEX_SET_ENH, &context->codec_settings.enhancement); } } @@ -178,7 +270,7 @@ static switch_status_t switch_speex_encode(switch_codec_t *codec, if (is_speech) { is_speech = speex_encode_int(context->encoder_state, buf, &context->encoder_bits) - || !context->codec->codec_settings.dtx; + || !context->codec_settings.dtx; } else { speex_bits_pack(&context->encoder_bits, 0, 5); } @@ -270,6 +362,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_speex_load) /* connect my internal structure to the blank pointer passed to me */ *module_interface = switch_loadable_module_create_module_interface(pool, modname); SWITCH_ADD_CODEC(codec_interface, "Speex"); + codec_interface->parse_fmtp = switch_speex_fmtp_parse; for (counta = 1; counta <= 3; counta++) { for (countb = 1; countb > 0; countb--) { switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 58eef29..0cd4b27 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -577,6 +577,7 @@ struct private_object { switch_codec_t read_codec; switch_codec_t write_codec; uint32_t codec_ms; + uint32_t bitrate; switch_caller_profile_t *caller_profile; uint32_t timestamp_send; switch_rtp_t *rtp_session; diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 3dc90b9..9d4b0ae 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -205,7 +205,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32 switch_event_t *map = NULL, *ptmap = NULL; const char *b_sdp = NULL; - if ((b_sdp = switch_channel_get_variable(tech_pvt->channel, SWITCH_B_SDP_VARIABLE))) { + if (!tech_pvt->rm_encoding && (b_sdp = switch_channel_get_variable(tech_pvt->channel, SWITCH_B_SDP_VARIABLE))) { sofia_glue_sdp_map(b_sdp, &map, &ptmap); } @@ -354,12 +354,18 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32 rate = imp->samples_per_second; if (map) { - fmtp = switch_event_get_header(map, imp->iananame); - } - + char key[128] = ""; + char *check = NULL; + switch_snprintf(key, sizeof(key), "%s:%u", imp->iananame, imp->bits_per_second); + if ((check = switch_event_get_header(map, key)) || (check = switch_event_get_header(map, imp->iananame))) { + fmtp = check; + } + } + switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", imp->ianacode, imp->iananame, rate); - if (imp->fmtp) { + + if (fmtp) { switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", imp->ianacode, fmtp); } } @@ -2535,24 +2541,26 @@ switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force) } } - if (switch_core_codec_init(&tech_pvt->read_codec, + if (switch_core_codec_init_with_bitrate(&tech_pvt->read_codec, tech_pvt->iananame, tech_pvt->rm_fmtp, tech_pvt->rm_rate, tech_pvt->codec_ms, 1, + tech_pvt->bitrate, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE | tech_pvt->profile->codec_flags, NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Can't load codec?\n"); switch_goto_status(SWITCH_STATUS_FALSE, end); } - if (switch_core_codec_init(&tech_pvt->write_codec, + if (switch_core_codec_init_with_bitrate(&tech_pvt->write_codec, tech_pvt->iananame, tech_pvt->rm_fmtp, tech_pvt->rm_rate, tech_pvt->codec_ms, 1, + tech_pvt->bitrate, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE | tech_pvt->profile->codec_flags, NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Can't load codec?\n"); @@ -2593,9 +2601,9 @@ switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force) switch_goto_status(SWITCH_STATUS_FALSE, end); } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Set Codec %s %s/%ld %d ms %d samples\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Set Codec %s %s/%ld %d ms %d samples %d bits\n", switch_channel_get_name(tech_pvt->channel), tech_pvt->iananame, tech_pvt->rm_rate, tech_pvt->codec_ms, - tech_pvt->read_impl.samples_per_packet); + tech_pvt->read_impl.samples_per_packet, tech_pvt->read_impl.bits_per_second); tech_pvt->read_frame.codec = &tech_pvt->read_codec; tech_pvt->write_codec.agreed_pt = tech_pvt->agreed_pt; @@ -3685,11 +3693,27 @@ switch_status_t sofia_glue_sdp_map(const char *r_sdp, switch_event_t **fmtp, swi for (map = m->m_rtpmaps; map; map = map->rm_next) { if (map->rm_encoding) { char buf[25] = ""; + char key[128] = ""; + char *br = NULL; + + if (map->rm_fmtp) { + if ((br = strstr(map->rm_fmtp, "bitrate="))) { + br += 8; + } + } + switch_snprintf(buf, sizeof(buf), "%d", map->rm_pt); - switch_event_add_header_string(*pt, SWITCH_STACK_BOTTOM, map->rm_encoding, buf); + + if (br) { + switch_snprintf(key, sizeof(key), "%s:%s", map->rm_encoding, br); + } else { + switch_snprintf(key, sizeof(key), "%s", map->rm_encoding); + } + switch_event_add_header_string(*pt, SWITCH_STACK_BOTTOM, key, buf); + if (map->rm_fmtp) { - switch_event_add_header_string(*fmtp, SWITCH_STACK_BOTTOM, map->rm_encoding, map->rm_fmtp); + switch_event_add_header_string(*fmtp, SWITCH_STACK_BOTTOM, key, map->rm_fmtp); } } } @@ -3809,7 +3833,6 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s sdp_attribute_t *attr; int first = 0, last = 0; int ptime = 0, dptime = 0, maxptime = 0, dmaxptime = 0; - int codec_ms = 0; int sendonly = 0; int greedy = 0, x = 0, skip = 0, mine = 0; switch_channel_t *channel = switch_core_session_get_channel(session); @@ -4129,8 +4152,12 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s for (map = m->m_rtpmaps; map; map = map->rm_next) { int32_t i; uint32_t near_rate = 0; + uint32_t near_bit_rate = 0; + switch_codec_interface_t *codec_interface; const switch_codec_implementation_t *mimp = NULL, *near_match = NULL; const char *rm_encoding; + uint32_t map_bit_rate = 0; + int codec_ms = 0; if (x++ < skip) { continue; @@ -4174,31 +4201,38 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s ptime = switch_default_ptime(rm_encoding, map->rm_pt); } - if (!strcasecmp((char *) rm_encoding, "ilbc")) { - char *mode = NULL; - if (map->rm_fmtp && (mode = strstr(map->rm_fmtp, "mode=")) && (mode + 5)) { - codec_ms = atoi(mode + 5); - } - if (!codec_ms) { - /* default to 30 when no mode is defined for ilbc ONLY */ - codec_ms = 30; + /* This will try to use codec specific fmtp parser */ + if (map->rm_fmtp && (codec_interface = switch_loadable_module_get_codec_interface(rm_encoding)) != 0) { + switch_codec_fmtp_t codec_fmtp; + memset(&codec_fmtp, '\0', sizeof(struct switch_codec_fmtp)); + codec_fmtp.actual_samples_per_second = map->rm_rate; + if (codec_interface->parse_fmtp && codec_interface->parse_fmtp(map->rm_fmtp, &codec_fmtp) == SWITCH_STATUS_SUCCESS) { + if (codec_fmtp.bits_per_second) { + map_bit_rate = codec_fmtp.bits_per_second; + } + if (codec_fmtp.microseconds_per_packet) { + ptime = (codec_fmtp.microseconds_per_packet / 1000); + } } - } else { - codec_ms = ptime; + UNPROTECT_INTERFACE(codec_interface); } + if (!codec_ms) { + codec_ms = ptime; + } for (i = first; i < last && i < tech_pvt->num_codecs; i++) { const switch_codec_implementation_t *imp = tech_pvt->codecs[i]; + uint32_t bit_rate = imp->bits_per_second; uint32_t codec_rate = imp->samples_per_second; if (imp->codec_type != SWITCH_CODEC_TYPE_AUDIO) { continue; } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Audio Codec Compare [%s:%d:%u:%d]/[%s:%d:%u:%d]\n", - rm_encoding, map->rm_pt, (int) map->rm_rate, codec_ms, - imp->iananame, imp->ianacode, codec_rate, imp->microseconds_per_packet / 1000); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Audio Codec Compare [%s:%d:%u:%d:%u]/[%s:%d:%u:%d:%u]\n", + rm_encoding, map->rm_pt, (int) map->rm_rate, codec_ms, map_bit_rate, + imp->iananame, imp->ianacode, codec_rate, imp->microseconds_per_packet / 1000, bit_rate); if ((zstr(map->rm_encoding) || (tech_pvt->profile->ndlb & PFLAG_NDLB_ALLOW_BAD_IANANAME)) && map->rm_pt < 96) { match = (map->rm_pt == imp->ianacode) ? 1 : 0; } else { @@ -4211,8 +4245,13 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s "Bah HUMBUG! Sticking with %s@%uh@%ui\n", imp->iananame, imp->samples_per_second, imp->microseconds_per_packet / 1000); } else { - if ((codec_ms && codec_ms * 1000 != imp->microseconds_per_packet) || map->rm_rate != codec_rate) { + if ((codec_ms && codec_ms * 1000 != imp->microseconds_per_packet) || map->rm_rate != codec_rate || (map_bit_rate && map_bit_rate != bit_rate) ) { near_rate = map->rm_rate; + if (map_bit_rate) { + near_bit_rate = map_bit_rate; + } else { + near_bit_rate = bit_rate; + } near_match = imp; match = 0; continue; @@ -4225,7 +4264,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s } } - if (!match && near_match) { + if (!match && near_match && !map->rm_next) { const switch_codec_implementation_t *search[1]; char *prefs[1]; char tmp[80]; @@ -4266,6 +4305,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s tech_pvt->pt = (switch_payload_t) map->rm_pt; tech_pvt->rm_rate = map->rm_rate; tech_pvt->codec_ms = mimp->microseconds_per_packet / 1000; + tech_pvt->bitrate = mimp->bits_per_second; tech_pvt->remote_sdp_audio_ip = switch_core_session_strdup(session, (char *) connection->c_address); tech_pvt->rm_fmtp = switch_core_session_strdup(session, (char *) map->rm_fmtp); tech_pvt->remote_sdp_audio_port = (switch_port_t) m->m_port; diff --git a/src/switch_channel.c b/src/switch_channel.c index ba55601..ece3fa2 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -1834,6 +1834,7 @@ SWITCH_DECLARE(void) switch_channel_event_set_basic_data(switch_channel_t *chann if (impl.iananame) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Read-Codec-Name", impl.iananame); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Read-Codec-Rate", "%u", impl.actual_samples_per_second); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Read-Codec-Bit-Rate", "%d", impl.bits_per_second); } switch_core_session_get_write_impl(channel->session, &impl); @@ -1841,6 +1842,7 @@ SWITCH_DECLARE(void) switch_channel_event_set_basic_data(switch_channel_t *chann if (impl.iananame) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Name", impl.iananame); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Rate", "%u", impl.actual_samples_per_second); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Bit-Rate", "%d", impl.bits_per_second); } /* Index Caller's Profile */ diff --git a/src/switch_core_codec.c b/src/switch_core_codec.c index ba84b03..f21b7cb 100644 --- a/src/switch_core_codec.c +++ b/src/switch_core_codec.c @@ -165,6 +165,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(switch_core_s switch_channel_event_set_data(session->channel, event); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-read-codec-name", session->read_impl.iananame); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-read-codec-rate", "%d", session->read_impl.actual_samples_per_second); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-read-codec-bit-rate", "%d", session->read_impl.bits_per_second); if (session->read_impl.actual_samples_per_second != session->read_impl.samples_per_second) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-reported-read-codec-rate", "%d", session->read_impl.samples_per_second); } @@ -317,6 +318,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_write_codec(switch_core_ switch_channel_event_set_data(session->channel, event); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Name", session->write_impl.iananame); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Rate", "%d", session->write_impl.actual_samples_per_second); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Write-codec-bit-rate", "%d", session->write_impl.bits_per_second); if (session->write_impl.actual_samples_per_second != session->write_impl.samples_per_second) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Reported-Write-Codec-Rate", "%d", session->write_impl.actual_samples_per_second); @@ -494,8 +496,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_copy(switch_codec_t *codec, sw return SWITCH_STATUS_SUCCESS; } -SWITCH_DECLARE(switch_status_t) switch_core_codec_init(switch_codec_t *codec, const char *codec_name, const char *fmtp, - uint32_t rate, int ms, int channels, uint32_t flags, +SWITCH_DECLARE(switch_status_t) switch_core_codec_init_with_bitrate(switch_codec_t *codec, const char *codec_name, const char *fmtp, + uint32_t rate, int ms, int channels, uint32_t bitrate, uint32_t flags, const switch_codec_settings_t *codec_settings, switch_memory_pool_t *pool) { switch_codec_interface_t *codec_interface; @@ -519,7 +521,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_init(switch_codec_t *codec, co /* If no specific codec interval is requested opt for 20ms above all else because lots of stuff assumes it */ if (!ms) { for (iptr = codec_interface->implementations; iptr; iptr = iptr->next) { - if ((!rate || rate == iptr->samples_per_second) && + if ((!rate || rate == iptr->samples_per_second) && (!bitrate || bitrate == iptr->bits_per_second) && (20 == (iptr->microseconds_per_packet / 1000)) && (!channels || channels == iptr->number_of_channels)) { implementation = iptr; goto found; @@ -529,7 +531,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_init(switch_codec_t *codec, co /* Either looking for a specific interval or there was no interval specified and there wasn't one @20ms available */ for (iptr = codec_interface->implementations; iptr; iptr = iptr->next) { - if ((!rate || rate == iptr->samples_per_second) && + if ((!rate || rate == iptr->samples_per_second) && (!bitrate || bitrate == iptr->bits_per_second) && (!ms || ms == (iptr->microseconds_per_packet / 1000)) && (!channels || channels == iptr->number_of_channels)) { implementation = iptr; break; diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 0cc4da3..7e427b5 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -1142,11 +1142,13 @@ static void core_event_handler(switch_event_t *event) case SWITCH_EVENT_CODEC: new_sql() = switch_mprintf - ("update channels set read_codec='%q',read_rate='%q',write_codec='%q',write_rate='%q' where uuid='%q' and hostname='%q'", + ("update channels set read_codec='%q',read_rate='%q',read_bit_rate='%q',write_codec='%q',write_rate='%q',write_bit_rate='%q' where uuid='%q' and hostname='%q'", switch_event_get_header_nil(event, "channel-read-codec-name"), switch_event_get_header_nil(event, "channel-read-codec-rate"), + switch_event_get_header_nil(event, "channel-read-codec-bit-rate"), switch_event_get_header_nil(event, "channel-write-codec-name"), switch_event_get_header_nil(event, "channel-write-codec-rate"), + switch_event_get_header_nil(event, "channel-write-codec-bit-rate"), switch_event_get_header_nil(event, "unique-id"), switch_core_get_variable("hostname")); break; case SWITCH_EVENT_CHANNEL_HOLD: @@ -1471,8 +1473,10 @@ static char create_channels_sql[] = " context VARCHAR(128),\n" " read_codec VARCHAR(128),\n" " read_rate VARCHAR(32),\n" + " read_bit_rate VARCHAR(32),\n" " write_codec VARCHAR(128),\n" " write_rate VARCHAR(32),\n" + " write_bit_rate VARCHAR(32),\n" " secure VARCHAR(32),\n" " hostname VARCHAR(256),\n" " presence_id VARCHAR(4096),\n" @@ -1613,7 +1617,7 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_ case SCDB_TYPE_ODBC: { char *err; - switch_cache_db_test_reactive(dbh, "select call_uuid from channels", "DROP TABLE channels", create_channels_sql); + switch_cache_db_test_reactive(dbh, "select call_uuid, read_bit_rate from channels", "DROP TABLE channels", create_channels_sql); switch_cache_db_test_reactive(dbh, "select call_uuid from calls", "DROP TABLE calls", create_calls_sql); switch_cache_db_test_reactive(dbh, "select ikey from interfaces", "DROP TABLE interfaces", create_interfaces_sql); switch_cache_db_test_reactive(dbh, "select hostname from tasks", "DROP TABLE tasks", create_tasks_sql); diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index fc0db74..5466c18 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -183,8 +183,8 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable if (load_interface) { for (impl = ptr->implementations; impl; impl = impl->next) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, - "Adding Codec '%s' (%s) %dhz %dms\n", - impl->iananame, ptr->interface_name, impl->actual_samples_per_second, impl->microseconds_per_packet / 1000); + "Adding Codec '%s' (%s) %dhz %dms %dbps\n", + impl->iananame, ptr->interface_name, impl->actual_samples_per_second, impl->microseconds_per_packet / 1000, impl->bits_per_second); if (!switch_core_hash_find(loadable_modules.codec_hash, impl->iananame)) { switch_core_hash_insert(loadable_modules.codec_hash, impl->iananame, (const void *) ptr); } @@ -1600,7 +1600,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_ for (x = 0; x < preflen; x++) { char *cur, *last = NULL, *next = NULL, *name, *p, buf[256]; - uint32_t interval = 0, rate = 0; + uint32_t interval = 0, rate = 0, bit = 0; switch_copy_string(buf, prefs[x], sizeof(buf)); last = name = next = cur = buf; @@ -1620,6 +1620,8 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_ interval = atoi(cur); } else if ((strchr(cur, 'k') || strchr(cur, 'h'))) { rate = atoi(cur); + } else if (strchr(cur, 'b')) { + bit = atoi(cur); } } cur = next; @@ -1643,6 +1645,11 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_ if (((!rate && (uint32_t) imp->samples_per_second != 8000) || (rate && (uint32_t) imp->samples_per_second != rate))) { continue; } + + if (bit && (uint32_t) imp->bits_per_second != bit) { + continue; + } + } @@ -1666,6 +1673,11 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_ if (rate && (uint32_t) imp->samples_per_second != rate) { continue; } + + if (bit && (uint32_t) imp->bits_per_second != bit) { + continue; + } + } array[i++] = imp; commit f126b92e2e8c123868217929b3bca0280438195b Merge: bcd31ec 5a42adf Author: Moises Silva <moy@sangoma.com> Date: Wed Sep 29 17:11:24 2010 -0400 Merge remote branch 'smgorig/master' commit bcd31ecaf3146a9a2c87a7d8c1c1d882e6a98148 Author: Jeff Lenk <jeff@jefflenk.com> Date: Wed Sep 29 16:00:09 2010 -0500 correction to last patch diff --git a/libs/sofia-sip/libsofia-sip-ua/msg/msg_tag.c b/libs/sofia-sip/libsofia-sip-ua/msg/msg_tag.c index 8d1b1d5..061cd5e 100644 --- a/libs/sofia-sip/libsofia-sip-ua/msg/msg_tag.c +++ b/libs/sofia-sip/libsofia-sip-ua/msg/msg_tag.c @@ -53,7 +53,7 @@ #ifndef _MSC_VER #define NONE ((void*)-1) #else -#define NONE ((void*)(UINT_PTR)-1) +#define NONE ((void*)(INT_PTR)-1) #endif int msghdrtag_snprintf(tagi_t const *t, char b[], size_t size) diff --git a/libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_header.h b/libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_header.h index f930b17..c633aa3 100644 --- a/libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_header.h +++ b/libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_header.h @@ -303,7 +303,7 @@ enum { #ifndef _MSC_VER #define MSG_HEADER_NONE ((msg_header_t *)-1) #else -#define MSG_HEADER_NONE ((msg_header_t *)(UINT_PTR)-1) +#define MSG_HEADER_NONE ((msg_header_t *)(INT_PTR)-1) #endif SOFIA_END_DECLS diff --git a/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c b/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c index 2e5c482..a6c7d49 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c +++ b/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c @@ -44,7 +44,7 @@ #ifndef _MSC_VER #define NONE ((void *)- 1) #else -#define NONE ((void *)(UINT_PTR)- 1) +#define NONE ((void *)(INT_PTR)- 1) #endif #define SU_ROOT_MAGIC_T struct nea_server_s diff --git a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c index d360041..40ee1f8 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c +++ b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c @@ -107,7 +107,7 @@ static char const __func__[] = "nta"; #ifndef _MSC_VER #define NONE ((void *)-1) #else -#define NONE ((void *)(UINT_PTR)-1) +#define NONE ((void *)(INT_PTR)-1) #endif /* ------------------------------------------------------------------------- */ diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c index cc4bcb2..b96b1f3 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c @@ -57,7 +57,7 @@ #ifndef _MSC_VER #define NONE ((void *)-1) #else -#define NONE ((void *)(UINT_PTR)-1) +#define NONE ((void *)(INT_PTR)-1) #endif #endif diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.h b/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.h index f39f9d4..97c8858 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.h +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.h @@ -86,7 +86,7 @@ typedef struct nua_ee_data { #ifndef _MSC_VER #define NONE ((void *)-1) #else -#define NONE ((void *)(UINT_PTR)-1) +#define NONE ((void *)(INT_PTR)-1) #endif typedef struct register_usage nua_registration_t; diff --git a/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip.h b/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip.h index 3c38f3b..37ae836 100644 --- a/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip.h +++ b/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip.h @@ -84,7 +84,7 @@ typedef enum { #ifndef _MSC_VER #define SIP_NONE ((void const *)-1L) #else -#define SIP_NONE ((void const *)(UINT_PTR)-1L) +#define SIP_NONE ((void const *)(INT_PTR)-1L) #endif /** SIP protocol identifier @HIDE */ diff --git a/libs/sofia-sip/libsofia-sip-ua/soa/soa.c b/libs/sofia-sip/libsofia-sip-ua/soa/soa.c index d1b7477..7f272a8 100644 --- a/libs/sofia-sip/libsofia-sip-ua/soa/soa.c +++ b/libs/sofia-sip/libsofia-sip-ua/soa/soa.c @@ -59,7 +59,7 @@ #ifndef _MSC_VER #define NONE ((void *)-1) #else -#define NONE ((void *)(UINT_PTR)-1) +#define NONE ((void *)(INT_PTR)-1) #endif #define XXX assert(!"implemented") diff --git a/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c b/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c index 2c870b2..f104274 100644 --- a/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c +++ b/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c @@ -399,7 +399,7 @@ sdp_rtpmap_t *soa_sdp_media_matching_rtpmap(sdp_rtpmap_t const *from, #ifndef _MSC_VER #define SDP_MEDIA_NONE ((sdp_media_t *)-1) #else -#define SDP_MEDIA_NONE ((sdp_media_t *)(UINT_PTR)-1) +#define SDP_MEDIA_NONE ((sdp_media_t *)(INT_PTR)-1) #endif /** Find first matching media in table @a mm. diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/tport_internal.h b/libs/sofia-sip/libsofia-sip-ua/tport/tport_internal.h index a26d38a..683b79a 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/tport_internal.h +++ b/libs/sofia-sip/libsofia-sip-ua/tport/tport_internal.h @@ -82,7 +82,7 @@ #ifndef _MSC_VER #define NONE ((void *)-1) #else -#define NONE ((void *)(UINT_PTR)-1) +#define NONE ((void *)(INT_PTR)-1) #endif #endif commit 5a42adf40dec8dd084273d1d75f4ceb9f6317b2e Author: Moises Silva <moy@sangoma.com> Date: Wed Sep 29 16:51:00 2010 -0400 freetdm: add some comments to sample configurations diff --git a/libs/freetdm/conf/freetdm.conf b/libs/freetdm/conf/freetdm.conf index 1ea1a9f..bbaf1e3 100644 --- a/libs/freetdm/conf/freetdm.conf +++ b/libs/freetdm/conf/freetdm.conf @@ -1,19 +1,47 @@ -[span wanpipe] -name => FreeTDM -number => 1 +; !! THIS IS A SAMPLE CONFIGURATION ONLY !! + +; refer to http://wiki.freeswitch.org/wiki/FreeTDM for further documentation + +[general] +; whether to launch a thread for CPU usage monitoring +cpu_monitor => no + +; How often (in milliseconds) monitor CPU usage +cpu_monitoring_interval => 1000 + +; At what CPU percentage raise a CPU alarm +cpu_set_alarm_threshold => 80 + +; At what CPU percentage stop the CPU alarm +cpu_reset_alarm_threshold => 70 + +; Which action to take when the CPU alarm is raised +; it can be warn and/or reject calls +; cpu_alarm_action => warn,reject +cpu_alarm_action => warn + +; spans are defined with [span <span type> <span name>] +; the span type can either be zt, wanpipe or pika +; the span name can be any unique string +[span wanpipe myWanpipe] + +; valid trunk types are: FXO, FXS, EM, E1, T1, J1, BRI, BRI_PTMP +trunk_type => FXS + +; add FXS channels from 3 to 4 at wanpipe span 1 to this freetdm span fxs-channel => 1:3-4 -[span wanpipe] +[span wanpipe myWanpipe2] +trunk_type => FXO +; This number will be used as DNIS for FXO devices fxo-channel => 1:1-2 -[span zt] -name => FreeTDM -number => 2 +[span zt myZaptelSpan] +number => 9999 fxs-channel => 1 -[span zt] -name => FreeTDM +[span zt mySecondZaptelSpan] +; This number will be used as DNIS for FXO devices number => 2 fxo-channel => 3 - diff --git a/libs/freetdm/conf/freetdm.conf.xml b/libs/freetdm/conf/freetdm.conf.xml index 69bf99a..986074d 100644 --- a/libs/freetdm/conf/freetdm.conf.xml +++ b/libs/freetdm/conf/freetdm.conf.xml @@ -1,3 +1,5 @@ +<!-- Please refer to http://wiki.freeswitch.org/wiki/FreeTDM for further documentation --> + <configuration name="freetdm.conf" description="FreeTDM Configuration"> <settings> <param name="debug" value="0"/> @@ -5,6 +7,8 @@ <!--<param name="enable-analog-option" value="call-swap"/>--> <!--<param name="enable-analog-option" value="3-way"/>--> </settings> + + <!-- use the <pri_spans> tag for native ISDN support (most likely broken at this point, check sangoma_pri_spans or libpri_spans for alternatives) --> <pri_spans> <span name="PRI_1"> <!-- Log Levels: none, alert, crit, err, warning, notice, info, debug --> @@ -24,9 +28,11 @@ <param name="context" value="default"/> </span> </pri_spans> - <!-- one entry here per openzap span --> + + + <!-- Analog spans go here --> <analog_spans> - <span id="1"> + <span name="myAnalog"> <!--<param name="hold-music" value="$${moh_uri}"/>--> <!--<param name="enable-analog-option" value="call-swap"/>--> <!--<param name="enable-analog-option" value="3-way"/>--> @@ -42,4 +48,5 @@ <!--<param name="fail-dial-regex" value="^5"/>--> </span> </analog_spans> + </configuration> diff --git a/libs/freetdm/conf/pika.conf b/libs/freetdm/conf/pika.conf index 8cc8d9c..78e0952 100644 --- a/libs/freetdm/conf/pika.conf +++ b/libs/freetdm/conf/pika.conf @@ -1,3 +1,5 @@ +; you dont need this file unless you use PIKA boards + ; each category is a config profile ; to apply the profile append it to a channel def in ; openzap.conf with @<profile_name> diff --git a/libs/freetdm/conf/tones.conf b/libs/freetdm/conf/tones.conf index 36db1d4..155b5fe 100644 --- a/libs/freetdm/conf/tones.conf +++ b/libs/freetdm/conf/tones.conf @@ -1,3 +1,5 @@ +; This file is used to generate telephony tones by FreeTDM + [us] generate-dial => v=-7;%(1000,0,350,440) detect-dial => 350,440 commit 45ecbc2f6144872ed2335fb724639145f2852815 Author: Jeff Lenk <jeff@jefflenk.com> Date: Wed Sep 29 15:47:58 2010 -0500 fix warnings on windows x64 builds src and mods projects - only libsofia included on the libs side diff --git a/libs/sofia-sip/libsofia-sip-ua/http/sofia-sip/http.h b/libs/sofia-sip/libsofia-sip-ua/http/sofia-sip/http.h index d5bb617..bd42743 100644 --- a/libs/sofia-sip/libsofia-sip-ua/http/sofia-sip/http.h +++ b/libs/sofia-sip/libsofia-sip-ua/http/sofia-sip/http.h @@ -58,7 +58,11 @@ SOFIA_BEGIN_DECLS #define HTTP_DEFAULT_SERV "80" /** HTTP protocol identifier */ +#ifndef _MSC_VER #define HTTP_PROTOCOL_TAG ((void *)0x48545450) /* 'HTTP' */ +#else +#define HTTP_PROTOCOL_TAG ((void *)(UINT_PTR)0x48545450) /* 'HTTP' */ +#endif /** HTTP parser flags */ enum { diff --git a/libs/sofia-sip/libsofia-sip-ua/msg/msg_tag.c b/libs/sofia-sip/libsofia-sip-ua/msg/msg_tag.c index 2be30b0..8d1b1d5 100644 --- a/libs/sofia-sip/libsofia-sip-ua/msg/msg_tag.c +++ b/libs/sofia-sip/libsofia-sip-ua/msg/msg_tag.c @@ -50,7 +50,11 @@ #include <sofia-sip/su_tagarg.h> #include "sofia-sip/msg_tag_class.h" +#ifndef _MSC_VER #define NONE ((void*)-1) +#else +#define NONE ((void*)(UINT_PTR)-1) +#endif int msghdrtag_snprintf(tagi_t const *t, char b[], size_t size) { diff --git a/libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_header.h b/libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_header.h index 91fd723..f930b17 100644 --- a/libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_header.h +++ b/libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_header.h @@ -299,7 +299,12 @@ enum { (h)) /** No header. */ + +#ifndef _MSC_VER #define MSG_HEADER_NONE ((msg_header_t *)-1) +#else +#define MSG_HEADER_NONE ((msg_header_t *)(UINT_PTR)-1) +#endif SOFIA_END_DECLS diff --git a/libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_mime.h b/libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_mime.h index 4a9f234..033c551 100644 --- a/libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_mime.h +++ b/libs/sofia-sip/libsofia-sip-ua/msg/sofia-sip/msg_mime.h @@ -235,7 +235,11 @@ msg_content_length_t *msg_content_length_create(su_home_t *home, uint32_t n); SOFIAPUBVAR char const msg_mime_version_1_0[]; /** MIME multipart parser table identifier. @HIDE */ +#ifndef _MSC_VER #define MSG_MULTIPART_PROTOCOL_TAG ((void *)0x4d494d45) /* 'MIME' */ +#else +#define MSG_MULTIPART_PROTOCOL_TAG ((void *)(UINT_PTR)0x4d494d45) /* 'MIME' */ +#endif SOFIA_END_DECLS diff --git a/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c b/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c index 4287ae4..2e5c482 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c +++ b/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c @@ -41,7 +41,11 @@ #include "nea_debug.h" +#ifndef _MSC_VER #define NONE ((void *)- 1) +#else +#define NONE ((void *)(UINT_PTR)- 1) +#endif #define SU_ROOT_MAGIC_T struct nea_server_s #define SU_MSG_ARG_T tagi_t diff --git a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c index 656aecc..d360041 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c +++ b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c @@ -104,8 +104,11 @@ char const nta_version[] = PACKAGE_VERSION; static char const __func__[] = "nta"; #endif +#ifndef _MSC_VER #define NONE ((void *)-1) - +#else +#define NONE ((void *)(UINT_PTR)-1) +#endif /* ------------------------------------------------------------------------- */ /** Resolving order */ diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c index bf35263..cc4bcb2 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c @@ -53,7 +53,12 @@ #include <sofia-sip/su_debug.h> #ifndef NONE + +#ifndef _MSC_VER #define NONE ((void *)-1) +#else +#define NONE ((void *)(UINT_PTR)-1) +#endif #endif /* ======================================================================== */ diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.h b/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.h index 318ccdd..f39f9d4 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.h +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.h @@ -83,7 +83,11 @@ typedef struct nua_ee_data { nua_event_data_t ee_data[1]; } nua_ee_data_t; +#ifndef _MSC_VER #define NONE ((void *)-1) +#else +#define NONE ((void *)(UINT_PTR)-1) +#endif typedef struct register_usage nua_registration_t; diff --git a/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip.h b/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip.h index 1a235ca..3c38f3b 100644 --- a/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip.h +++ b/libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip.h @@ -81,10 +81,18 @@ typedef enum { #define SIP_METHOD_PUBLISH sip_method_publish, "PUBLISH" /** Magic pointer value - never valid for SIP headers. @HI */ +#ifndef _MSC_VER #define SIP_NONE ((void const *)-1L) +#else +#define SIP_NONE ((void const *)(UINT_PTR)-1L) +#endif /** SIP protocol identifier @HIDE */ +#ifndef _MSC_VER #define SIP_PROTOCOL_TAG ((void *)0x53495020) /* 'SIP'20 */ +#else +#define SIP_PROTOCOL_TAG ((void *)(UINT_PTR)0x53495020) /* 'SIP'20 */ +#endif enum { /** Default port for SIP as integer */ diff --git a/libs/sofia-sip/libsofia-sip-ua/soa/soa.c b/libs/sofia-sip/libsofia-sip-ua/soa/soa.c index de79e0f..d1b7477 100644 --- a/libs/sofia-sip/libsofia-sip-ua/soa/soa.c +++ b/libs/sofia-sip/libsofia-sip-ua/soa/soa.c @@ -56,7 +56,11 @@ #include <sofia-sip/su_string.h> #include <sofia-sip/su_errno.h> +#ifndef _MSC_VER #define NONE ((void *)-1) +#else +#define NONE ((void *)(UINT_PTR)-1) +#endif #define XXX assert(!"implemented") typedef unsigned longlong ull; diff --git a/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c b/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c index f94f9b2..2c870b2 100644 --- a/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c +++ b/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c @@ -396,7 +396,11 @@ sdp_rtpmap_t *soa_sdp_media_matching_rtpmap(sdp_rtpmap_t const *from, return NULL; } +#ifndef _MSC_VER #define SDP_MEDIA_NONE ((sdp_media_t *)-1) +#else +#define SDP_MEDIA_NONE ((sdp_media_t *)(UINT_PTR)-1) +#endif /** Find first matching media in table @a mm. * diff --git a/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c b/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c index f660b2c..e494571 100644 --- a/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c +++ b/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c @@ -125,7 +125,7 @@ su_inline ssize_t sres_recvfrom(sres_socket_t s, void *buffer, size_t length, int flags, struct sockaddr *from, socklen_t *fromlen) { - int retval, ilen; + int retval, ilen = 0; if (fromlen) ilen = *fromlen; diff --git a/libs/sofia-sip/libsofia-sip-ua/su/su.c b/libs/sofia-sip/libsofia-sip-ua/su/su.c index 250b5d6..8067fde 100644 --- a/libs/sofia-sip/libsofia-sip-ua/su/su.c +++ b/libs/sofia-sip/libsofia-sip-ua/su/su.c @@ -434,7 +434,7 @@ ssize_t su_recv(su_socket_t s, void *buffer, size_t length, int flags) ssize_t su_recvfrom(su_socket_t s, void *buffer, size_t length, int flags, su_sockaddr_t *from, socklen_t *fromlen) { - int retval, ilen; + int retval, ilen = 0; if (fromlen) ilen = *fromlen; diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/tport_internal.h b/libs/sofia-sip/libsofia-sip-ua/tport/tport_internal.h index b56dd2d..a26d38a 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/tport_internal.h +++ b/libs/sofia-sip/libsofia-sip-ua/tport/tport_internal.h @@ -79,7 +79,11 @@ #endif #ifndef NONE +#ifndef _MSC_VER #define NONE ((void *)-1) +#else +#define NONE ((void *)(UINT_PTR)-1) +#endif #endif SOFIA_BEGIN_DECLS diff --git a/src/include/switch_types.h b/src/include/switch_types.h index b0395ba..70eaa4f 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -770,9 +770,9 @@ typedef struct { const char *T38FaxUdpEC; const char *T38VendorInfo; const char *remote_ip; - uint32_t remote_port; + uint16_t remote_port; const char *local_ip; - uint32_t local_port; + uint16_t local_port; } switch_t38_options_t; /*! diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 6a16a9c..1fb1c95 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -1065,7 +1065,7 @@ SWITCH_STANDARD_API(url_encode_function) int len = 0; if (!zstr(cmd)) { - len = (strlen(cmd) * 3) + 1; + len = (int)(strlen(cmd) * 3) + 1; switch_zmalloc(data, len); switch_url_encode(cmd, data, len); reply = data; @@ -4218,7 +4218,7 @@ SWITCH_STANDARD_API(escape_function) return SWITCH_STATUS_SUCCESS; } - len = strlen(cmd) * 2; + len = (int)strlen(cmd) * 2; mycmd = malloc(len); stream->write_function(stream, "%s", switch_escape_string(cmd, mycmd, len)); diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 1bc2201..7018294 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -1012,7 +1012,7 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, v uint8_t *file_frame; uint8_t *async_file_frame; int16_t *bptr; - int x = 0; + uint32_t x = 0; int32_t z = 0; int member_score_sum = 0; int divisor = 0; diff --git a/src/mod/applications/mod_directory/mod_directory.c b/src/mod/applications/mod_directory/mod_directory.c index 8464b1c..d929747 100644 --- a/src/mod/applications/mod_directory/mod_directory.c +++ b/src/mod/applications/mod_directory/mod_directory.c @@ -393,7 +393,7 @@ static dir_profile_t *load_profile(const char *profile_name) profile_set_config(profile); /* Add the params to the event structure */ - count = switch_event_import_xml(switch_xml_child(x_profile, "param"), "name", "value", &event); + count = (int)switch_event_import_xml(switch_xml_child(x_profile, "param"), "name", "value", &event); if (switch_xml_config_parse_event(event, count, SWITCH_FALSE, profile->config) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to process configuration\n"); @@ -611,7 +611,7 @@ static switch_status_t on_dtmf(switch_core_session_t *session, void *input, swit } if (strlen(cbr->digits) < sizeof(cbr->digits) - 2) { - int at = strlen(cbr->digits); + int at = (int)strlen(cbr->digits); cbr->digits[at++] = dtmf->digit; cbr->digits[at] = '\0'; } else { diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 585e4bf..563706c 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -513,7 +513,6 @@ static switch_status_t caller_read_frame_callback(switch_core_session_t *session if (match_key(caller_exit_key, *buf)) { cd->abort = 1; return SWITCH_STATUS_FALSE; - switch_channel_set_variable(channel, "fifo_caller_exit_key", (char *)buf); } cd->next = switch_epoch_time_now(NULL) + cd->freq; cd->index++; diff --git a/src/mod/applications/mod_hash/mod_hash.c b/src/mod/applications/mod_hash/mod_hash.c index 3a65528..29a0561 100644 --- a/src/mod/applications/mod_hash/mod_hash.c +++ b/src/mod/applications/mod_hash/mod_hash.c @@ -852,7 +852,8 @@ static void do_config(switch_bool_t reload) const char *username = switch_xml_attr(x_list, "username"); const char *password = switch_xml_attr(x_list, "password"); const char *szinterval = switch_xml_attr(x_list, "interval"); - int port = 0, interval = 0; + uint16_t port = 0; + int interval = 0; limit_remote_t *remote; switch_threadattr_t *thd_attr = NULL; @@ -866,7 +867,7 @@ static void do_config(switch_bool_t reload) } if (!zstr(szport)) { - port = atoi(szport); + port = (uint16_t)atoi(szport); } if (!zstr(szinterval)) { @@ -949,7 +950,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_hash_shutdown) /* Kill remote connections, destroy needs a wrlock so we unlock after finding a pointer */ while(remote_clean) { void *val; - const void *key; + const void *key = NULL; switch_ssize_t keylen; limit_remote_t *item = NULL; diff --git a/src/mod/applications/mod_lcr/mod_lcr.c b/src/mod/applications/mod_lcr/mod_lcr.c index 105576c..cc93707 100644 --- a/src/mod/applications/mod_lcr/mod_lcr.c +++ b/src/mod/applications/mod_lcr/mod_lcr.c @@ -167,7 +167,7 @@ static const char *do_cid(switch_memory_pool_t *pool, const char *cid, const cha switch_channel_t *channel = NULL; if (!zstr(cid)) { - len = strlen(cid); + len = (uint32_t)strlen(cid); } else { goto done; } @@ -506,7 +506,7 @@ static char *expand_digits(switch_memory_pool_t *pool, char *digits, switch_bool int digit_len; SWITCH_STANDARD_STREAM(dig_stream); - digit_len = strlen(digits); + digit_len = (int)strlen(digits); digits_copy = switch_core_strdup(pool, digits); for (n = digit_len; n > 0; n--) { diff --git a/src/mod/applications/mod_nibblebill/mod_nibblebill.c b/src/mod/applications/mod_nibblebill/mod_nibblebill.c index 06bc7d0..42369f5 100755 --- a/src/mod/applications/mod_nibblebill/mod_nibblebill.c +++ b/src/mod/applications/mod_nibblebill/mod_nibblebill.c @@ -419,10 +419,10 @@ static switch_status_t do_billing(switch_core_session_t *session) billaccount = switch_channel_get_variable(channel, "nibble_account"); if (!zstr(switch_channel_get_variable(channel, "nobal_amt"))) { - nobal_amt = atof(switch_channel_get_variable(channel, "nobal_amt")); + nobal_amt = (float)atof(switch_channel_get_variable(channel, "nobal_amt")); } if (!zstr(switch_channel_get_variable(channel, "lowbal_amt"))) { - lowbal_amt = atof(switch_channel_get_variable(channel, "lowbal_amt")); + lowbal_amt = (float)atof(switch_channel_get_variable(channel, "lowbal_amt")); } /* Return if there's no billing information on this session */ diff --git a/src/mod/applications/mod_spandsp/udptl.c b/src/mod/applications/mod_spandsp/udptl.c index a265151..f5b3be2 100644 --- a/src/mod/applications/mod_spandsp/udptl.c +++ b/src/mod/applications/mod_spandsp/udptl.c @@ -93,7 +93,7 @@ static int encode_length(uint8_t *buf, int *len, int value) if (value < 0x80) { /* 1 octet */ - buf[(*len)++] = value; + buf[(*len)++] = (uint8_t)value; return value; } if (value < 0x4000) { @@ -106,7 +106,7 @@ static int encode_length(uint8_t *buf, int *len, int value) /* Fragmentation */ multiplier = (value < 0x10000) ? (value >> 14) : 4; /* Set the first 2 bits of the octet */ - buf[(*len)++] = 0xC0 | multiplier; + buf[(*len)++] = (uint8_t) (0xC0 | multiplier); return multiplier << 14; } @@ -419,10 +419,10 @@ int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int /* Span is defined as an inconstrained integer, which it dumb. It will only ever be a small value. Treat it as such. */ buf[len++] = 1; - buf[len++] = span; + buf[len++] = (uint8_t)span; /* The number of entries is defined as a length, but will only ever be a small value. Treat it as such. */ - buf[len++] = entries; + buf[len++] = (uint8_t)entries; for (m = 0; m < entries; m++) { /* Make an XOR'ed entry the maximum length */ limit = (entry + m) & UDPTL_BUF_MASK; diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index c2fece8..7e92dec 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -2331,7 +2331,7 @@ static int show_reg_callback(void *pArg, int argc, char **argv, char **columnNam switch_time_t etime = atoi(argv[6]); switch_size_t retsize; - exp_secs = etime - now; + exp_secs = (int)(etime - now); switch_time_exp_lt(&tm, switch_time_from_sec(etime)); switch_strftime_nocheck(exp_buf, &retsize, sizeof(exp_buf), "%Y-%m-%d %T", &tm); } @@ -2371,7 +2371,7 @@ static int show_reg_callback_xml(void *pArg, int argc, char **argv, char **colum switch_time_t etime = atoi(argv[6]); switch_size_t retsize; - exp_secs = etime - now; + exp_secs = (int)(etime - now); switch_time_exp_lt(&tm, switch_time_from_sec(etime)); switch_strftime_nocheck(exp_buf, &retsize, sizeof(exp_buf), "%Y-%m-%d %T", &tm); } @@ -2499,7 +2499,7 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t } else if (!strcasecmp(argv[0], "profile")) { struct cb_helper cb; char *sql = NULL; - int x = 0; + uint32_t x = 0; cb.row_process = 0; @@ -2779,7 +2779,7 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl } else if (!strcasecmp(argv[0], "profile")) { struct cb_helper cb; char *sql = NULL; - int x = 0; + uint32_t x = 0; cb.row_process = 0; @@ -4394,7 +4394,8 @@ static void general_event_handler(switch_event_t *event) switch_mutex_lock(mod_sofia_globals.hash_mutex); if (mod_sofia_globals.profile_hash) { for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) { - int rb = 0, x = 0; + int rb = 0; + uint32_t x = 0; switch_hash_this(hi, &var, NULL, &val); if ((profile = (sofia_profile_t *) val) && profile->auto_restart) { if (!strcmp(profile->sipip, old_ip4)) { diff --git a/src/mod/endpoints/mod_sofia/sip-dig.c b/src/mod/endpoints/mod_sofia/sip-dig.c index f4714bc..d0c9aa6 100644 --- a/src/mod/endpoints/mod_sofia/sip-dig.c +++ b/src/mod/endpoints/mod_sofia/sip-dig.c @@ -785,7 +785,7 @@ int dig_addr(struct dig *dig, char const *tport2 = NULL; sres_record_t **answers1 = NULL, **answers2 = NULL; unsigned count1 = 0, count2 = 0, tcount = 0; - int type1 = 0, type2 = 0, family1 = 0, family2 = 0; + uint16_t type1 = 0, type2 = 0, family1 = 0, family2 = 0; if (dig->ip6 > dig->ip4) { type1 = sres_type_aaaa, family1 = AF_INET6; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index a3554ec..c3248d1 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1268,7 +1268,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread iterations++; if (len + newlen + 10 > sql_len) { - int new_mlen = len + newlen + 10 + 10240; + switch_size_t new_mlen = len + newlen + 10 + 10240; if (new_mlen < SQLLEN) { sql_len = new_mlen; diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 9301348..3dc90b9 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1280,7 +1280,7 @@ switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt) switch_port_t remote_rtcp_port = 0; if ((rport = switch_channel_get_variable(tech_pvt->channel, "sip_remote_video_rtcp_port"))) { - remote_rtcp_port = atoi(rport); + remote_rtcp_port = (switch_port_t)atoi(rport); } @@ -1316,7 +1316,7 @@ switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt) } if ((rport = switch_channel_get_variable(tech_pvt->channel, "sip_remote_audio_rtcp_port"))) { - remote_rtcp_port = atoi(rport); + remote_rtcp_port = (switch_port_t)atoi(rport); } @@ -2856,7 +2856,7 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f sofia_clear_flag_locked(tech_pvt, TFLAG_REINVITE); if ((rport = switch_channel_get_variable(tech_pvt->channel, "sip_remote_audio_rtcp_port"))) { - remote_rtcp_port = atoi(rport); + remote_rtcp_port = (switch_port_t)atoi(rport); } if (switch_rtp_set_remote_address(tech_pvt->rtp_session, tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port, @@ -2991,7 +2991,7 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f const char *rport = switch_channel_get_variable(tech_pvt->channel, "sip_remote_audio_rtcp_port"); switch_port_t remote_port = 0; if (rport) { - remote_port = atoi(rport); + remote_port = (switch_port_t)atoi(rport); } if (!strcasecmp(val, "passthru")) { switch_rtp_activate_rtcp(tech_pvt->rtp_session, -1, remote_port); @@ -3131,7 +3131,7 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f sofia_clear_flag_locked(tech_pvt, TFLAG_REINVITE); if ((rport = switch_channel_get_variable(tech_pvt->channel, "sip_remote_video_rtcp_port"))) { - remote_rtcp_port = atoi(rport); + remote_rtcp_port = (switch_port_t)atoi(rport); } if (switch_rtp_set_remote_address @@ -3248,7 +3248,7 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f const char *rport = switch_channel_get_variable(tech_pvt->channel, "sip_remote_video_rtcp_port"); switch_port_t remote_port = 0; if (rport) { - remote_port = atoi(rport); + remote_port = (switch_port_t)atoi(rport); } if (!strcasecmp(val, "passthru")) { switch_rtp_activate_rtcp(tech_pvt->rtp_session, -1, remote_port); @@ -3590,7 +3590,7 @@ static switch_t38_options_t *tech_process_udptl(private_object_t *tech_pvt, sdp_ t38_options = switch_core_session_alloc(tech_pvt->session, sizeof(switch_t38_options_t)); } - t38_options->remote_port = m->m_port; + t38_options->remote_port = (switch_port_t)m->m_port; if (m->m_connections && m->m_connections->c_address) { t38_options->remote_ip = switch_core_session_strdup(tech_pvt->session, m->m_connections->c_address); @@ -4848,13 +4848,13 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName } if ((tmp = switch_channel_get_variable(channel, "sip_use_pt"))) { - tech_pvt->pt = tech_pvt->agreed_pt = atoi(tmp); + tech_pvt->pt = tech_pvt->agreed_pt = (switch_payload_t)atoi(tmp); } sofia_glue_tech_set_codec(tech_pvt, 1); tech_pvt->adv_sdp_audio_ip = tech_pvt->extrtpip = (char *) ip; - tech_pvt->adv_sdp_audio_port = tech_pvt->local_sdp_audio_port = atoi(port); + tech_pvt->adv_sdp_audio_port = tech_pvt->local_sdp_audio_port = (switch_port_t)atoi(port); if ((tmp = switch_channel_get_variable(channel, "local_media_ip"))) { tech_pvt->local_sdp_audio_ip = switch_core_session_strdup(session, tmp); @@ -4863,12 +4863,12 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName if (r_ip && r_port) { tech_pvt->remote_sdp_audio_ip = (char *) r_ip; - tech_pvt->remote_sdp_audio_port = atoi(r_port); + tech_pvt->remote_sdp_audio_port = (switch_port_t)atoi(r_port); } if (switch_channel_test_flag(channel, CF_VIDEO)) { if ((tmp = switch_channel_get_variable(channel, "sip_use_video_pt"))) { - tech_pvt->video_pt = tech_pvt->video_agreed_pt = atoi(tmp); + tech_pvt->video_pt = tech_pvt->video_agreed_pt = (switch_payload_t)atoi(tmp); } @@ -4890,11 +4890,11 @@ static int recover_callback(void *pArg, int argc, char **argv, char **columnName tech_pvt->video_codec_ms = atoi(tmp); } - tech_pvt->adv_sdp_video_port = tech_pvt->local_sdp_video_port = atoi(port); + tech_pvt->adv_sdp_video_port = tech_pvt->local_sdp_video_port = (switch_port_t)atoi(port); if (r_ip && r_port) { tech_pvt->remote_sdp_video_ip = (char *) r_ip; - tech_pvt->remote_sdp_video_port = atoi(r_port); + tech_pvt->remote_sdp_video_port = (switch_port_t)atoi(r_port); } //sofia_glue_tech_set_video_codec(tech_pvt, 1); } diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 64176ee..4f35ac0 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -934,7 +934,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand if (sip->sip_path) { path_val = sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_path); - path_encoded_len = (strlen(path_val) * 3) + 1; + path_encoded_len = (int)(strlen(path_val) * 3) + 1; switch_zmalloc(path_encoded, path_encoded_len); switch_copy_string(path_encoded, ";fs_path=", 10); switch_url_encode(path_val, path_encoded + 9, path_encoded_len - 9); @@ -947,7 +947,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand switch_snprintf(my_contact_str, sizeof(my_contact_str), "sip:%s@%s:%d", contact->m_url->url_user, url_ip, network_port); } - path_encoded_len = (strlen(my_contact_str) * 3) + 1; + path_encoded_len = (int)(strlen(my_contact_str) * 3) + 1; switch_zmalloc(path_encoded, path_encoded_len); switch_copy_string(path_encoded, ";fs_path=", 10); @@ -2126,7 +2126,8 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, if (auth_acl) { if (!switch_check_network_list_ip(ip, auth_acl)) { - int network_ip_is_proxy = 0, x = 0; + int network_ip_is_proxy = 0; + uint32_t x = 0; char *last_acl = NULL; if (profile->proxy_acl_count == 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by user acl [%s] and no proxy acl present\n", ip, auth_acl); @@ -2223,7 +2224,7 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, if (max_registrations_perext > 0 && (sip && sip->sip_contact && (sip->sip_contact->m_expires == NULL || atol(sip->sip_contact->m_expires) > 0))) { /* if expires is null still process */ /* expires == 0 means the phone is going to unregiser, so don't count against max */ - int count = 0; + uint32_t count = 0; call_id = sip->sip_call_id->i_id; switch_assert(call_id); diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx index b1a19f5..a922aad 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx @@ -3583,24 +3583,24 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_t38_options_t_remote_ip_get(void * j } -SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_remote_port_set(void * jarg1, unsigned long jarg2) { +SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_remote_port_set(void * jarg1, unsigned short jarg2) { switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ; - uint32_t arg2 ; + uint16_t arg2 ; arg1 = (switch_t38_options_t *)jarg1; - arg2 = (uint32_t)jarg2; + arg2 = (uint16_t)jarg2; if (arg1) (arg1)->remote_port = arg2; } -SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_t38_options_t_remote_port_get(void * jarg1) { - unsigned long jresult ; +SWIGEXPORT unsigned short SWIGSTDCALL CSharp_switch_t38_options_t_remote_port_get(void * jarg1) { + unsigned short jresult ; switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ; - uint32_t result; + uint16_t result; arg1 = (switch_t38_options_t *)jarg1; - result = (uint32_t) ((arg1)->remote_port); - jresult = (unsigned long)result; + result = (uint16_t) ((arg1)->remote_port); + jresult = result; return jresult; } @@ -3634,24 +3634,24 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_t38_options_t_local_ip_get(void * ja } -SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_local_port_set(void * jarg1, unsigned long jarg2) { +SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_local_port_set(void * jarg1, unsigned short jarg2) { switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ; - uint32_t arg2 ; + uint16_t arg2 ; arg1 = (switch_t38_options_t *)jarg1; - arg2 = (uint32_t)jarg2; + arg2 = (uint16_t)jarg2; if (arg1) (arg1)->local_port = arg2; } -SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_t38_options_t_local_port_get(void * jarg1) { - unsigned long jresult ; +SWIGEXPORT unsigned short SWIGSTDCALL CSharp_switch_t38_options_t_local_port_get(void * jarg1) { + unsigned short jresult ; switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ; - uint32_t result; + uint16_t result; arg1 = (switch_t38_options_t *)jarg1; - result = (uint32_t) ((arg1)->local_port); - jresult = (unsigned long)result; + result = (uint16_t) ((arg1)->local_port); + jresult = result; return jresult; } diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs index 29fa0d9..8ef4923 100644 --- a/src/mod/languages/mod_managed/managed/swig.2010.cs +++ b/src/mod/languages/mod_managed/managed/swig.2010.cs @@ -6376,10 +6376,10 @@ class freeswitchPINVOKE { public static extern string switch_t38_options_t_remote_ip_get(HandleRef jarg1); [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_remote_port_set")] - public static extern void switch_t38_options_t_remote_port_set(HandleRef jarg1, uint jarg2); + public static extern void switch_t38_options_t_remote_port_set(HandleRef jarg1, ushort jarg2); [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_remote_port_get")] - public static extern uint switch_t38_options_t_remote_port_get(HandleRef jarg1); + public static extern ushort switch_t38_options_t_remote_port_get(HandleRef jarg1); [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_local_ip_set")] public static extern void switch_t38_options_t_local_ip_set(HandleRef jarg1, string jarg2); @@ -6388,10 +6388,10 @@ class freeswitchPINVOKE { public static extern string switch_t38_options_t_local_ip_get(HandleRef jarg1); [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_local_port_set")] - public static extern void switch_t38_options_t_local_port_set(HandleRef jarg1, uint jarg2); + public static extern void switch_t38_options_t_local_port_set(HandleRef jarg1, ushort jarg2); [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_local_port_get")] - public static extern uint switch_t38_options_t_local_port_get(HandleRef jarg1); + public static extern ushort switch_t38_options_t_local_port_get(HandleRef jarg1); [DllImport("mod_managed", EntryPoint="CSharp_new_switch_t38_options_t")] public static extern IntPtr new_switch_t38_options_t(); @@ -29741,12 +29741,12 @@ public class switch_t38_options_t : IDisposable { } } - public uint remote_port { + public ushort remote_port { set { freeswitchPINVOKE.switch_t38_options_t_remote_port_set(swigCPtr, value); } get { - uint ret = freeswitchPINVOKE.switch_t38_options_t_remote_port_get(swigCPtr); + ushort ret = freeswitchPINVOKE.switch_t38_options_t_remote_port_get(swigCPtr); return ret; } } @@ -29761,12 +29761,12 @@ public class switch_t38_options_t : IDisposable { } } - public uint local_port { + public ushort local_port { set { freeswitchPINVOKE.switch_t38_options_t_local_port_set(swigCPtr, value); } get { - uint ret = freeswitchPINVOKE.switch_t38_options_t_local_port_get(swigCPtr); + ushort ret = freeswitchPINVOKE.switch_t38_options_t_local_port_get(swigCPtr); return ret; } } commit 38e0bfb5a86e91f7bde8920c8b4ab17aadf304af Author: Michal Bielicki <michal.bielicki@seventhsignal.de> Date: Wed Sep 29 22:32:31 2010 +0200 added portaudio_stream module to default specfile diff --git a/freeswitch.spec b/freeswitch.spec index 76f9df4..9944f80 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -1,5 +1,5 @@ -############################################################################################################################### -############################################################################################################################### +###################################################################################################################### +###################################################################################################################### # # spec file for package freeswitch # @@ -26,8 +26,8 @@ # # Maintainer(s): Michal Bielicki <michal.bielicki (at) ++nospam_please++ seventhsignal.de # -############################################################################################################################### -############################################################################################################################### +###################################################################################################################### +###################################################################################################################### # # disable rpath checking %define __arch_install_post /usr/lib/rpm/check-buildroot @@ -48,11 +48,11 @@ URL: http://www.freeswitch.org/ Packager: Michal Bielicki Vendor: http://www.freeswitch.org/ -############################################################################################################################### +###################################################################################################################### # -# Source files and where to get them +# Source files and where to get them # -############################################################################################################################### +###################################################################################################################### Source0: http://files.freeswitch.org/%{name}-%{version}.tar.bz2 Source1: http://files.freeswitch.org/downloads/libs/celt-0.7.0.tar.gz Source2: http://files.freeswitch.org/downloads/libs/flite-1.3.99-latest.tar.gz @@ -68,11 +68,11 @@ Source11: http://files.freeswitch.org/downloads/libs/libmemcached-0.32.tar.gz Prefix: %{prefix} -############################################################################################################################### +###################################################################################################################### # # Build Dependencies # -############################################################################################################################### +###################################################################################################################### %if 0%{?suse_version} > 100 #BuildRequires: openldap2-devel @@ -128,11 +128,11 @@ PreReq: %insserv_prereq %fillup_prereq %endif -############################################################################################################################### +###################################################################################################################### # -# Where the packages are going to be built +# Where the packages are going to be built # -############################################################################################################################### +###################################################################################################################### BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %description @@ -155,12 +155,12 @@ Our developers are heavily involved in open source and have donated code and oth other telephony projects including sipXecs, OpenSER, Asterisk, CodeWeaver and OpenPBX. -############################################################################################################################### +###################################################################################################################### # -# Sub Package definitions. Description and Runtime Requirements go here -# What goes into which package is in the files section after the whole build enchilada +# Sub Package definitions. Description and Runtime Requirements go here +# What goes into which package is in the files section after the whole build enchilada # -############################################################################################################################### +###################################################################################################################### %package devel @@ -277,11 +277,11 @@ Requires: %{name} = %{version}-%{release} %description openzap OpenZAP -############################################################################################################################### +###################################################################################################################### # -# Unpack and prepare Source archives, copy stuff around etc .. +# Unpack and prepare Source archives, copy stuff around etc .. # -############################################################################################################################### +###################################################################################################################### %prep %setup -b0 -q @@ -297,11 +297,11 @@ cp %{SOURCE9} libs/ cp %{SOURCE10} libs/ cp %{SOURCE11} libs/ -############################################################################################################################### +###################################################################################################################### # -# Start the Build process +# Start the Build process # -############################################################################################################################### +###################################################################################################################### %build %ifos linux %if 0%{?suse_version} > 1000 && 0%{?suse_version} < 1030 @@ -312,115 +312,115 @@ export QA_RPATHS=$[ 0x0001|0x0002 ] %endif %endif -############################################################################################################################### +###################################################################################################################### # -# Here the modules that will be build get defined +# Here the modules that will be build get defined # -############################################################################################################################### -############################################################################################################################### +###################################################################################################################### +###################################################################################################################### # -# Application Modules +# Application Modules # -############################################################################################################################### -APPLICATION_MODULES_AE="applications/mod_avmd applications/mod_commands applications/mod_conference applications/mod_db applications/mod_directory applications/mod_distributor applications/mod_dptools applications/mod_easyroute applications/mod_enum applications/mod_esf applications/mod_expr applications/mod_callcenter" +###################################################################################################################### +APPLICATION_MODULES_AE="applications/mod_avmd applications/mod_callcenter applications/mod_cluechoo applications/mod_commands applications/mod_conference applications/mod_db applications/mod_directory applications/mod_distributor applications/mod_dptools applications/mod_easyroute applications/mod_enum applications/mod_esf applications/mod_expr" APPLICATION_MODULES_FM="applications/mod_fifo applications/mod_fsv applications/mod_hash applications/mod_lcr applications/mod_limit applications/mod_memcache" -APPLICATION_MODULES_NY=" applications/mod_redis applications/mod_rss applications/mod_soundtouch applications/mod_spandsp applications/mod_stress applications/mod_spy " +APPLICATION_MODULES_NY="applications/mod_nibblebill applications/mod_redis applications/mod_rss applications/mod_soundtouch applications/mod_spandsp applications/mod_stress applications/mod_spy " APPLICATION_MODULES_VZ="applications/mod_valet_parking applications/mod_vmd applications/mod_voicemail" APPLICATIONS_MODULES="$APPLICATION_MODULES_AE $APPLICATION_MODULES_FM $APPLICATION_MODULES_NY $APPLICATION_MODULES_VZ" -############################################################################################################################### +###################################################################################################################### # -# Automatic Speech Recognition and Text To Speech Modules +# Automatic Speech Recognition and Text To Speech Modules # -############################################################################################################################### +###################################################################################################################### ASR_TTS_MODULES="asr_tts/mod_pocketsphinx asr_tts/mod_flite asr_tts/mod_unimrcp" -############################################################################################################################### +###################################################################################################################### # -# Codecs +# Codecs # -############################################################################################################################### +###################################################################################################################### CODECS_MODULES="codecs/mod_ilbc codecs/mod_h26x codecs/mod_speex codecs/mod_celt codecs/mod_siren codecs/mod_bv" -############################################################################################################################### +###################################################################################################################### # -# Dialplan Modules +# Dialplan Modules # -############################################################################################################################### +###################################################################################################################### DIALPLANS_MODULES="dialplans/mod_dialplan_asterisk dialplans/mod_dialplan_directory dialplans/mod_dialplan_xml" -############################################################################################################################### +###################################################################################################################### # -# Directory Modules +# Directory Modules # -############################################################################################################################### +###################################################################################################################### DIRECTORIES_MODULES="" -############################################################################################################################### +###################################################################################################################### # -# Endpoints +# Endpoints # -############################################################################################################################### +###################################################################################################################### ENDPOINTS_MODULES="endpoints/mod_dingaling endpoints/mod_portaudio endpoints/mod_sofia ../../libs/openzap/mod_openzap endpoints/mod_loopback" -############################################################################################################################### +###################################################################################################################### # -# Event Handlers +# Event Handlers # -############################################################################################################################### +###################################################################################################################### EVENT_HANDLERS_MODULES="event_handlers/mod_event_multicast event_handlers/mod_event_socket event_handlers/mod_cdr_csv" -############################################################################################################################### +###################################################################################################################### # -# File and Audio Format Handlers +# File and Audio Format Handlers # -############################################################################################################################### -FORMATS_MODULES="formats/mod_local_stream formats/mod_native_file formats/mod_sndfile formats/mod_tone_stream formats/mod_shout formats/mod_file_string" -############################################################################################################################### +###################################################################################################################### +FORMATS_MODULES="formats/mod_local_stream formats/mod_native_file formats/mod_sndfile formats/mod_portaudio_stream formats/mod_tone_stream formats/mod_shout formats/mod_file_string" +###################################################################################################################### # -# Embedded Languages +# Embedded Languages # -############################################################################################################################### +###################################################################################################################### LANGUAGES_MODULES="languages/mod_lua languages/mod_perl languages/mod_python languages/mod_spidermonkey" -############################################################################################################################### +###################################################################################################################### # -# Logging Modules +# Logging Modules # -############################################################################################################################### +###################################################################################################################### LOGGERS_MODULES="loggers/mod_console loggers/mod_logfile loggers/mod_syslog" -############################################################################################################################### +###################################################################################################################### # -# Passthru Codecs +# Passthru Codecs # -############################################################################################################################### +###################################################################################################################### PASSTHRU_CODEC_MODULES="codecs/mod_amr codecs/mod_amrwb codecs/mod_g723_1 codecs/mod_g729" -############################################################################################################################### +###################################################################################################################### # -# Phrase engine language modules +# Phrase engine language modules # -############################################################################################################################### +###################################################################################################################### SAY_MODULES="say/mod_say_de say/mod_say_en say/mod_say_fr say/mod_say_ru" -############################################################################################################################### +###################################################################################################################### # -# Timers +# Timers # -############################################################################################################################### +###################################################################################################################### TIMERS_MODULES= -############################################################################################################################### +###################################################################################################################### # -# XML Modules +# XML Modules # -############################################################################################################################### +###################################################################################################################### XML_INT_MODULES="xml_int/mod_xml_cdr xml_int/mod_xml_curl xml_int/mod_xml_rpc" -############################################################################################################################### +###################################################################################################################### # -# Create one environment variable out of all the module defs +# Create one environment variable out of all the module defs # -############################################################################################################################### +###################################################################################################################### MYMODULES="$PASSTHRU_CODEC_MODULES $APPLICATIONS_MODULES $CODECS_MODULES $DIALPLANS_MODULES $DIRECTORIES_MODULES $ENDPOINTS_MODULES $ASR_TTS_MODULES $EVENT_HANDLERS_MODULES $FORMATS_MODULES $LANGUAGES_MODULES $LOGGERS_MODULES $SAY_MODULES $TIMERS_MODULES $XML_INT_MODULES" -############################################################################################################################### +###################################################################################################################### # -# Create Modules build list and set variables +# Create Modules build list and set variables # -############################################################################################################################### +###################################################################################################################### export MODULES=$MYMODULES test ! -f modules.conf || rm -f modules.conf @@ -431,11 +431,11 @@ export DESTDIR=%{buildroot}/ export PKG_CONFIG_PATH=/usr/bin/pkg-config:$PKG_CONFIG_PATH export ACLOCAL_FLAGS="-I /usr/share/aclocal" -############################################################################################################################### +###################################################################################################################### # -# Bootstrap, Configure and Build the whole enchilada +# Bootstrap, Configure and Build the whole enchilada # -############################################################################################################################### +###################################################################################################################### if test ! -f Makefile.in then @@ -467,11 +467,11 @@ touch .noversion %{__make} -############################################################################################################################### +###################################################################################################################### # -# Install it and create some required dirs and links +# Install it and create some required dirs and links # -############################################################################################################################### +###################################################################################################################### %install %{__make} DESTDIR=%{buildroot} install @@ -502,11 +502,11 @@ touch .noversion %endif -############################################################################################################################### +###################################################################################################################### # -# Add a freeswitch user with group daemon that will own the whole enchilada +# Add a freeswitch user with group daemon that will own the whole enchilada # -############################################################################################################################### +###################################################################################################################### %pre %ifos linux if ! /usr/bin/id freeswitch &>/dev/null; then @@ -526,11 +526,11 @@ chkconfig --add freeswitch %postun -############################################################################################################################### +###################################################################################################################### # -# On uninstallation get rid of the freeswitch user +# On uninstallation get rid of the freeswitch user # -############################################################################################################################### +###################################################################################################################### %{?run_ldconfig:%run_ldconfig} if [ $1 -eq 0 ]; then userdel freeswitch || %logmsg "User \"freeswitch\" could not be deleted." @@ -540,19 +540,19 @@ fi %{__rm} -rf %{buildroot} %files -############################################################################################################################### +###################################################################################################################### # -# What to install where ... first set default permissions +# What to install where ... first set default permissions # -############################################################################################################################### +###################################################################################################################### %defattr(-,freeswitch,daemon) -############################################################################################################################### +###################################################################################################################### # -# Directories +# Directories # -############################################################################################################################### +###################################################################################################################### # -#################################### Basic Directory Structure ################################################################ +#################################### Basic Directory Structure ####################################################### # %dir %attr(0750, freeswitch, daemon) %{prefix}/conf %dir %attr(0750, freeswitch, daemon) %{prefix}/db @@ -562,7 +562,7 @@ fi %dir %attr(0750, freeswitch, daemon) %{runtimedir} %dir %attr(0750, freeswitch, daemon) %{prefix}/scripts # -#################################### Config Directory Structure ################################################################ +#################################### Config Directory Structure ####################################################### # %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/autoload_configs %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/dialplan @@ -579,7 +579,7 @@ fi %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/sip_profiles/internal %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/skinny_profiles # -#################################### Grammar Directory Structure ################################################################ +#################################### Grammar Directory Structure ##################################################### # %dir %attr(0750, freeswitch, daemon) %{prefix}/grammar/model %dir %attr(0750, freeswitch, daemon) %{prefix}/grammar/model/communicator @@ -587,11 +587,11 @@ fi %ifos linux %config(noreplace) %attr(0644, freeswitch, daemon) /etc/monit.d/freeswitch.monitrc %endif -############################################################################################################################### +###################################################################################################################### # -# Config Files +# Config Files # -############################################################################################################################### +###################################################################################################################### %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/*.tpl %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/*.ttml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/*.xml @@ -650,60 +650,59 @@ fi %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/xml_curl.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/xml_rpc.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/zeroconf.conf.xml -############################################################################################################################### +###################################################################################################################### # -# Dialplans +# Dialplans # -############################################################################################################################### +###################################################################################################################### %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/dialplan/*.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/dialplan/default/*.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/dialplan/public/*.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/dialplan/skinny-patterns/*.xml -############################################################################################################################### +###################################################################################################################### # -# User Directories +# User Directories # -############################################################################################################################### +###################################################################################################################### %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/directory/*.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/directory/default/* -############################################################################################################################### +###################################################################################################################### # -# IVR Menues +# IVR Menues # -############################################################################################################################### +###################################################################################################################### %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/ivr_menus/*.xml -############################################################################################################################### +###################################################################################################################### # -# Sip Profiles +# Sip Profiles # -############################################################################################################################### +###################################################################################################################### %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/sip_profiles/*.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/sip_profiles/internal/*.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/sip_profiles/external/*.xml -############################################################################################################################### +###################################################################################################################### # -# Other Protocol Profiles (skinny, jingle, mrcp) +# Other Protocol Profiles (skinny, jingle, mrcp) # -############################################################################################################################### +###################################################################################################################### %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/skinny_profiles/*.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/jingle_profiles/*.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/mrcp_profiles/*.xml -############################################################################################################################### +###################################################################################################################### # -# Grammar Files +# Grammar Files # -############################################################################################################################### +###################################################################################################################### %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/grammar/default.dic %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/grammar/model/communicator/* %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/grammar/model/wsj1/* -############################################################################################################################### +###################################################################################################################### # -# Other FÃles +# Other FÃles # -############################################################################################################################### +###################################################################################################################### %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/htdocs/* %ifos linux -#/etc/ld.so.conf.d/* /etc/rc.d/init.d/freeswitch /etc/sysconfig/freeswitch %if 0%{?suse_version} > 100 @@ -713,23 +712,25 @@ fi %ifos linux %dir %attr(0750, root, root) /etc/monit.d %endif -############################################################################################################################### +###################################################################################################################### # -# Binaries +# Binaries # -############################################################################################################################### +###################################################################################################################### %attr(0755, freeswitch, daemon) %{prefix}/bin/* %{prefix}/lib/libfreeswitch*.so* -############################################################################################################################### +###################################################################################################################### # -# Modules in Alphabetical Order, please keep them that way.. +# Modules in Alphabetical Order, please keep them that way.. # -############################################################################################################################### +###################################################################################################################### %{prefix}/mod/mod_amrwb.so* %{prefix}/mod/mod_avmd.so* %{prefix}/mod/mod_bv.so* +%{prefix}/mod/mod_callcenter* %{prefix}/mod/mod_cdr_csv.so* %{prefix}/mod/mod_celt.so* +%{prefix}/mod/mod_cluechoo.so* %{prefix}/mod/mod_console.so* %{prefix}/mod/mod_commands.so* %{prefix}/mod/mod_conference.so* @@ -747,7 +748,6 @@ fi %{prefix}/mod/mod_event_multicast.so* %{prefix}/mod/mod_event_socket.so* %{prefix}/mod/mod_expr.so* -%{prefix}/mod/mod_callcenter.so* %{prefix}/mod/mod_fifo.so* %{prefix}/mod/mod_file_string.so* %{prefix}/mod/mod_flite.so* @@ -764,6 +764,7 @@ fi %{prefix}/mod/mod_native_file.so* %{prefix}/mod/mod_pocketsphinx.so* %{prefix}/mod/mod_portaudio.so* +%{prefix}/mod/mod_portaudio_stream.so* %{prefix}/mod/mod_redis.so* %{prefix}/mod/mod_rss.so* %{prefix}/mod/mod_shout.so* @@ -784,13 +785,11 @@ fi %{prefix}/mod/mod_xml_cdr.so* %{prefix}/mod/mod_xml_curl.so* %{prefix}/mod/mod_xml_rpc.so* - - -############################################################################################################################### +###################################################################################################################### # -# Package for the developer +# Package for the developer # -############################################################################################################################### +###################################################################################################################### %files devel %defattr(-, freeswitch, daemon) %{prefix}/lib/*.a @@ -799,12 +798,11 @@ fi %{prefix}/mod/*.a %{prefix}/mod/*.la %{prefix}/include/*.h - -############################################################################################################################### +###################################################################################################################### # -# OpenZAP Module for TDM Interaction +# OpenZAP Module for TDM Interaction # -############################################################################################################################### +###################################################################################################################### %files openzap %defattr(-, freeswitch, daemon) %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/tones.conf @@ -817,11 +815,11 @@ fi %{prefix}/mod/mod_openzap.so* %{prefix}/mod/ozmod_*.so* -############################################################################################################################### +###################################################################################################################### # -# Passthru Codec Modules +# Passthru Codec Modules # -############################################################################################################################### +###################################################################################################################### %files codec-passthru-amrwb %defattr(-,freeswitch,daemon) %{prefix}/mod/mod_amrwb.so* @@ -838,12 +836,11 @@ fi %defattr(-,freeswitch,daemon) %{prefix}/mod/mod_g729.so* - -############################################################################################################################### +###################################################################################################################### # -# Embedded Language Modules +# Embedded Language Modules # -############################################################################################################################### +###################################################################################################################### %files spidermonkey %defattr(-,freeswitch,daemon) %{prefix}/mod/mod_spidermonkey*.so* @@ -874,11 +871,11 @@ fi %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/autoload_configs %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/python.conf.xml -############################################################################################################################### +###################################################################################################################### # -# Language Modules +# Language Modules # -############################################################################################################################### +###################################################################################################################### %files lang-en %defattr(-, freeswitch, daemon) %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/en @@ -922,12 +919,15 @@ fi %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/ru/dir/*.xml %{prefix}/mod/mod_say_ru.so* -############################################################################################################################### +###################################################################################################################### # -# Changelog +# Changelog # -############################################################################################################################### +###################################################################################################################### %changelog +* Sun Sep 26 2010 - michal.bielicki@seventhsignal.de +- added portaudio_stream module +- some more formating work * Mon Jul 19 2010 - michal.bielicki@seventhsignal.de - new hash module config file added to freeswitch.spec * Mon Jul 19 2010 - michal.bielicki@seventhsignal.de commit 1af641feac4cff3ccb372da90e997f371540061d Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Sep 29 15:05:49 2010 -0400 d-channel FD now passed as a configuration parameter diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c index 3a4a001..7f3c4c3 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c @@ -193,10 +193,12 @@ ftdm_status_t sng_isdn_stack_cfg_phy_gen(void) ftdm_status_t sng_isdn_stack_cfg_phy_psap(ftdm_span_t *span) { - /*local variables*/ - L1Mngmt cfg; /*configuration structure*/ - Pst pst; /*post structure*/ + ftdm_iterator_t *chaniter; + ftdm_iterator_t *curr; + L1Mngmt cfg; + Pst pst; + S32 d_channel_fd = -1; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; /* initalize the post structure */ @@ -219,20 +221,35 @@ ftdm_status_t sng_isdn_stack_cfg_phy_psap(ftdm_span_t *span) cfg.hdr.elmId.elmntInst1 = signal_data->link_id; - cfg.t.cfg.s.l1PSAP.span = span->channels[1]->physical_span_id; + + /* Find the d-channel */ + chaniter = ftdm_span_get_chan_iterator(span, NULL); + for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { + ftdm_channel_t *ftdmchan = (ftdm_channel_t*)ftdm_iterator_current(curr); + if (ftdmchan->type == FTDM_CHAN_TYPE_DQ921) { + d_channel_fd = ftdmchan->sockfd; + break; + } + } + ftdm_iterator_free(chaniter); + + if(d_channel_fd < 0) { + ftdm_log(FTDM_LOG_ERROR, "%s:No d-channels specified\n", span->name); + return FTDM_FAIL; + } + + cfg.t.cfg.s.l1PSAP.sockfd = d_channel_fd; + switch(span->trunk_type) { case FTDM_TRUNK_E1: - cfg.t.cfg.s.l1PSAP.chan = 16; cfg.t.cfg.s.l1PSAP.type = SNG_L1_TYPE_PRI; break; case FTDM_TRUNK_T1: case FTDM_TRUNK_J1: - cfg.t.cfg.s.l1PSAP.chan = 24; cfg.t.cfg.s.l1PSAP.type = SNG_L1_TYPE_PRI; break; case FTDM_TRUNK_BRI: case FTDM_TRUNK_BRI_PTMP: - cfg.t.cfg.s.l1PSAP.chan = 3; cfg.t.cfg.s.l1PSAP.type = SNG_L1_TYPE_BRI; break; default: commit 84a383fe0fcc0ff93b70c21380c4b0702c55e6f9 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Sep 29 14:14:41 2010 -0500 improve video support for new polycom phones diff --git a/src/include/switch_rtp.h b/src/include/switch_rtp.h index 7e6028a..7269a2b 100644 --- a/src/include/switch_rtp.h +++ b/src/include/switch_rtp.h @@ -449,6 +449,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_stun_ping(switch_rtp_t *rtp_ SWITCH_DECLARE(void) switch_rtp_intentional_bugs(switch_rtp_t *rtp_session, switch_rtp_bug_flag_t bugs); SWITCH_DECLARE(switch_rtp_stats_t *) switch_rtp_get_stats(switch_rtp_t *rtp_session, switch_memory_pool_t *pool); +SWITCH_DECLARE(switch_byte_t) switch_rtp_check_auto_adj(switch_rtp_t *rtp_session); /*! \} diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index e4c4a51..c2fece8 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1482,12 +1482,11 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi switch (msg->message_id) { case SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ: { - const char *pl = - "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n" - " <media_control>\r\n" - " <vc_primitive>\r\n" - " <to_encoder>\r\n" - " <picture_fast_update>\r\n" " </picture_fast_update>\r\n" " </to_encoder>\r\n" " </vc_primitive>\r\n" " </media_control>\r\n"; + const char *pl = "<media_control><vc_primitive><to_encoder><picture_fast_update/></to_encoder></vc_primitive></media_control>"; + + if (!zstr(msg->string_arg)) { + pl = msg->string_arg; + } nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("application/media_control+xml"), SIPTAG_PAYLOAD_STR(pl), TAG_END()); @@ -2104,6 +2103,9 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi break; case SWITCH_MESSAGE_INDICATE_ANSWER: status = sofia_answer_channel(session); + if (switch_channel_test_flag(tech_pvt->channel, CF_VIDEO)) { + sofia_glue_build_vid_refresh_message(session, NULL); + } break; case SWITCH_MESSAGE_INDICATE_PROGRESS: { diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 4e0c4fd..58eef29 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -1013,3 +1013,6 @@ void sofia_glue_tech_simplify(private_object_t *tech_pvt); switch_console_callback_match_t *sofia_reg_find_reg_url_multi(sofia_profile_t *profile, const char *user, const char *host); switch_bool_t sofia_glue_profile_exists(const char *key); void sofia_glue_global_siptrace(switch_bool_t on); +void sofia_glue_proxy_codec(switch_core_session_t *session, const char *r_sdp); +switch_status_t sofia_glue_sdp_map(const char *r_sdp, switch_event_t **fmtp, switch_event_t **pt); +void sofia_glue_build_vid_refresh_message(switch_core_session_t *session, const char *pl); diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 470a865..a3554ec 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -3933,6 +3933,23 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status } } +#if 0 + if (status == 200 && switch_channel_test_flag(channel, CF_PROXY_MEDIA) && + sip->sip_payload && sip->sip_payload->pl_data && !strcasecmp(tech_pvt->iananame, "PROXY")) { + switch_core_session_t *other_session; + + sofia_glue_proxy_codec(session, sip->sip_payload->pl_data); + + if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) { + if (switch_core_session_compare(session, other_session)) { + sofia_glue_proxy_codec(other_session, sip->sip_payload->pl_data); + } + switch_core_session_rwunlock(other_session); + } + } +#endif + + if ((status == 180 || status == 183 || status == 200)) { const char *x_freeswitch_support; @@ -4494,6 +4511,8 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, } } + + state_process: switch ((enum nua_callstate) ss_state) { @@ -4972,6 +4991,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, sofia_set_flag_locked(tech_pvt, TFLAG_ANS); sofia_set_flag(tech_pvt, TFLAG_SDP); switch_channel_mark_answered(channel); + if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) { if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) { @@ -4992,6 +5012,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, sofia_set_flag_locked(tech_pvt, TFLAG_ANS); sofia_set_flag_locked(tech_pvt, TFLAG_SDP); switch_channel_mark_answered(channel); + if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) { if (sofia_glue_activate_rtp(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) { goto done; @@ -5097,6 +5118,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, } done: + if ((enum nua_callstate) ss_state == nua_callstate_ready && channel && session && tech_pvt) { sofia_glue_tech_simplify(tech_pvt); @@ -5248,7 +5270,6 @@ nua_handle_t *sofia_global_nua_handle_by_replaces(sip_replaces_t *replaces) } - void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[]) { /* Incoming refer */ @@ -5821,7 +5842,17 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t if (sip && sip->sip_content_type && sip->sip_content_type->c_type && sip->sip_content_type->c_subtype && sip->sip_payload && sip->sip_payload->pl_data) { - if (!strncasecmp(sip->sip_content_type->c_type, "application", 11) && !strcasecmp(sip->sip_content_type->c_subtype, "dtmf-relay")) { + if (!strncasecmp(sip->sip_content_type->c_type, "application", 11) && !strcasecmp(sip->sip_content_type->c_subtype, "media_control+xml")) { + switch_core_session_t *other_session; + + if (switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) { + sofia_glue_build_vid_refresh_message(other_session, sip->sip_payload->pl_data); + switch_core_session_rwunlock(other_session); + } else { + sofia_glue_build_vid_refresh_message(session, sip->sip_payload->pl_data); + } + + } else if (!strncasecmp(sip->sip_content_type->c_type, "application", 11) && !strcasecmp(sip->sip_content_type->c_subtype, "dtmf-relay")) { /* Try and find signal information in the payload */ if ((signal_ptr = switch_stristr("Signal=", sip->sip_payload->pl_data))) { int tmp; diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 508fa54..9301348 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -202,6 +202,13 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32 const char *username = tech_pvt->profile->username; const char *fmtp_out = tech_pvt->fmtp_out; const char *fmtp_out_var = switch_channel_get_variable(tech_pvt->channel, "sip_force_audio_fmtp"); + switch_event_t *map = NULL, *ptmap = NULL; + const char *b_sdp = NULL; + + if ((b_sdp = switch_channel_get_variable(tech_pvt->channel, SWITCH_B_SDP_VARIABLE))) { + sofia_glue_sdp_map(b_sdp, &map, &ptmap); + } + if (fmtp_out_var) { fmtp_out = fmtp_out_var; @@ -330,7 +337,8 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32 int already_did[128] = { 0 }; for (i = 0; i < tech_pvt->num_codecs; i++) { const switch_codec_implementation_t *imp = tech_pvt->codecs[i]; - + char *fmtp = imp->fmtp; + if (imp->codec_type != SWITCH_CODEC_TYPE_AUDIO) { continue; } @@ -345,9 +353,14 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32 rate = imp->samples_per_second; + if (map) { + fmtp = switch_event_get_header(map, imp->iananame); + } + + switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", imp->ianacode, imp->iananame, rate); if (imp->fmtp) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", imp->ianacode, imp->fmtp); + switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", imp->ianacode, fmtp); } } } @@ -479,38 +492,87 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32 int i; int already_did[128] = { 0 }; +#if 0 + switch_event_t *event; + char *buf; + int level = SWITCH_LOG_INFO; + + if (switch_event_create_plain(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) { + switch_channel_event_set_data(switch_core_session_get_channel(tech_pvt->session), event); + switch_event_serialize(event, &buf, SWITCH_FALSE); + switch_assert(buf); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), level, "CHANNEL_DATA:\n%s\n", buf); + switch_event_destroy(&event); + free(buf); + } +#endif + for (i = 0; i < tech_pvt->num_codecs; i++) { const switch_codec_implementation_t *imp = tech_pvt->codecs[i]; + char *fmtp = NULL; + uint32_t ianacode = imp->ianacode; +#if 0 + const char *str; + + + if ((str = switch_event_get_header(ptmap, imp->iananame))) { + int tmp = atoi(str); + if (tmp > 0) { + ianacode = tmp; + } + } +#endif if (imp->codec_type != SWITCH_CODEC_TYPE_VIDEO) { continue; } - if (imp->ianacode < 128) { - if (already_did[imp->ianacode]) { + if (ianacode < 128) { + if (already_did[ianacode]) { continue; } - already_did[imp->ianacode] = 1; + already_did[ianacode] = 1; } if (!rate) { rate = imp->samples_per_second; } - - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", imp->ianacode, imp->iananame, + + + switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%d\n", ianacode, imp->iananame, imp->samples_per_second); - if (imp->fmtp) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", imp->ianacode, imp->fmtp); + + if (!zstr(ov_fmtp)) { + fmtp = (char *) ov_fmtp; } else { - if (pass_fmtp) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", imp->ianacode, pass_fmtp); + + if (map) { + fmtp = switch_event_get_header(map, imp->iananame); } + + if (zstr(fmtp)) fmtp = imp->fmtp; + + if (zstr(fmtp)) fmtp = (char *) pass_fmtp; + } + + if (!zstr(fmtp) && strcasecmp(fmtp, "_blank_")) { + switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", imp->ianacode, fmtp); } } + } } } + + if (map) { + switch_event_destroy(&map); + } + + if (ptmap) { + switch_event_destroy(&ptmap); + } + sofia_glue_tech_set_local_sdp(tech_pvt, buf, SWITCH_TRUE); } @@ -2514,9 +2576,10 @@ switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force) if (switch_rtp_ready(tech_pvt->rtp_session)) { switch_assert(tech_pvt->read_codec.implementation); - + if (switch_rtp_change_interval(tech_pvt->rtp_session, - tech_pvt->read_impl.microseconds_per_packet, tech_pvt->read_impl.samples_per_packet) != SWITCH_STATUS_SUCCESS) { + tech_pvt->read_impl.microseconds_per_packet, + tech_pvt->read_impl.samples_per_packet) != SWITCH_STATUS_SUCCESS) { switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); switch_goto_status(SWITCH_STATUS_FALSE, end); } @@ -2776,6 +2839,10 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f tech_pvt->local_sdp_audio_port, tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port, tech_pvt->agreed_pt, tech_pvt->read_impl.microseconds_per_packet / 1000); + + if (switch_rtp_ready(tech_pvt->rtp_session)) { + switch_rtp_set_default_payload(tech_pvt->rtp_session, tech_pvt->agreed_pt); + } } switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->local_sdp_audio_port); @@ -2828,6 +2895,10 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port, tech_pvt->agreed_pt, tech_pvt->read_impl.microseconds_per_packet / 1000); + if (switch_rtp_ready(tech_pvt->rtp_session)) { + switch_rtp_set_default_payload(tech_pvt->rtp_session, tech_pvt->agreed_pt); + } + } else { timer_name = tech_pvt->profile->timer_name; @@ -3018,13 +3089,14 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f sofia_glue_check_video_codecs(tech_pvt); if (sofia_test_flag(tech_pvt, TFLAG_VIDEO) && tech_pvt->video_rm_encoding && tech_pvt->remote_sdp_video_port) { - + /******************************************************************************************/ if (tech_pvt->video_rtp_session && sofia_test_flag(tech_pvt, TFLAG_REINVITE)) { //const char *ip = switch_channel_get_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE); //const char *port = switch_channel_get_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE); char *remote_host = switch_rtp_get_remote_host(tech_pvt->video_rtp_session); switch_port_t remote_port = switch_rtp_get_remote_port(tech_pvt->video_rtp_session); + if (remote_host && remote_port && !strcmp(remote_host, tech_pvt->remote_sdp_video_ip) && remote_port == tech_pvt->remote_sdp_video_port) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Video params are unchanged for %s.\n", @@ -3042,8 +3114,12 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f "VIDEO RTP [%s] %s port %d -> %s port %d codec: %u ms: %d\n", switch_channel_get_name(tech_pvt->channel), tech_pvt->local_sdp_audio_ip, tech_pvt->local_sdp_video_port, tech_pvt->remote_sdp_video_ip, tech_pvt->remote_sdp_video_port, tech_pvt->video_agreed_pt, tech_pvt->read_impl.microseconds_per_packet / 1000); - } + if (switch_rtp_ready(tech_pvt->video_rtp_session)) { + switch_rtp_set_default_payload(tech_pvt->video_rtp_session, tech_pvt->video_agreed_pt); + } + } + switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->local_sdp_video_port); switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_VIDEO_IP_VARIABLE, tech_pvt->adv_sdp_audio_ip); switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_VIDEO_PORT_VARIABLE, tmp); @@ -3070,6 +3146,7 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f /* Reactivate the NAT buster flag. */ switch_rtp_set_flag(tech_pvt->video_rtp_session, SWITCH_RTP_FLAG_AUTOADJ); } + } goto video_up; } @@ -3095,6 +3172,9 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f tech_pvt->remote_sdp_video_ip, tech_pvt->remote_sdp_video_port, tech_pvt->video_agreed_pt, tech_pvt->read_impl.microseconds_per_packet / 1000); + if (switch_rtp_ready(tech_pvt->video_rtp_session)) { + switch_rtp_set_default_payload(tech_pvt->video_rtp_session, tech_pvt->video_agreed_pt); + } } else { timer_name = tech_pvt->profile->timer_name; @@ -3145,6 +3225,11 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f tech_pvt->remote_sdp_video_port, tech_pvt->video_agreed_pt, 0, switch_rtp_ready(tech_pvt->video_rtp_session) ? "SUCCESS" : err); + + if (switch_rtp_ready(tech_pvt->video_rtp_session)) { + switch_rtp_set_default_payload(tech_pvt->video_rtp_session, tech_pvt->video_agreed_pt); + } + if (switch_rtp_ready(tech_pvt->video_rtp_session)) { const char *ssrc; switch_channel_set_flag(tech_pvt->channel, CF_VIDEO); @@ -3574,6 +3659,115 @@ static switch_t38_options_t *tech_process_udptl(private_object_t *tech_pvt, sdp_ return t38_options; } + +switch_status_t sofia_glue_sdp_map(const char *r_sdp, switch_event_t **fmtp, switch_event_t **pt) +{ + sdp_media_t *m; + sdp_parser_t *parser = NULL; + sdp_session_t *sdp; + + if (!(parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0))) { + return SWITCH_STATUS_FALSE; + } + + if (!(sdp = sdp_session(parser))) { + sdp_parser_free(parser); + return SWITCH_STATUS_FALSE; + } + + switch_event_create(&(*fmtp), SWITCH_EVENT_REQUEST_PARAMS); + switch_event_create(&(*pt), SWITCH_EVENT_REQUEST_PARAMS); + + for (m = sdp->sdp_media; m; m = m->m_next) { + if (m->m_proto == sdp_proto_rtp) { + sdp_rtpmap_t *map; + + for (map = m->m_rtpmaps; map; map = map->rm_next) { + if (map->rm_encoding) { + char buf[25] = ""; + switch_snprintf(buf, sizeof(buf), "%d", map->rm_pt); + switch_event_add_header_string(*pt, SWITCH_STACK_BOTTOM, map->rm_encoding, buf); + + if (map->rm_fmtp) { + switch_event_add_header_string(*fmtp, SWITCH_STACK_BOTTOM, map->rm_encoding, map->rm_fmtp); + } + } + } + } + } + + sdp_parser_free(parser); + + return SWITCH_STATUS_SUCCESS; + +} + + +void sofia_glue_proxy_codec(switch_core_session_t *session, const char *r_sdp) +{ + sdp_media_t *m; + sdp_parser_t *parser = NULL; + sdp_session_t *sdp; + private_object_t *tech_pvt = switch_core_session_get_private(session); + sdp_attribute_t *attr; + int ptime = 0, dptime = 0, dmaxptime = 0, maxptime = 0; + + if (!(parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0))) { + return; + } + + if (!(sdp = sdp_session(parser))) { + sdp_parser_free(parser); + return; + } + + switch_assert(tech_pvt != NULL); + + + for (attr = sdp->sdp_attributes; attr; attr = attr->a_next) { + if (zstr(attr->a_name)) { + continue; + } + + if (!strcasecmp(attr->a_name, "ptime")) { + dptime = atoi(attr->a_value); + } else if (!strcasecmp(attr->a_name, "maxptime")) { + dmaxptime = atoi(attr->a_value); + } + } + + + for (m = sdp->sdp_media; m; m = m->m_next) { + + ptime = dptime; + maxptime = dmaxptime; + + if (m->m_proto == sdp_proto_rtp) { + sdp_rtpmap_t *map; + for (attr = m->m_attributes; attr; attr = attr->a_next) { + if (!strcasecmp(attr->a_name, "ptime") && attr->a_value) { + ptime = atoi(attr->a_value); + } else if (!strcasecmp(attr->a_name, "maxptime") && attr->a_value) { + maxptime = atoi(attr->a_value); + } + } + + for (map = m->m_rtpmaps; map; map = map->rm_next) { + tech_pvt->iananame = switch_core_session_strdup(tech_pvt->session, map->rm_encoding); + tech_pvt->rm_rate = map->rm_rate; + tech_pvt->codec_ms = ptime; + sofia_glue_tech_set_codec(tech_pvt, 0); + break; + } + + break; + } + } + + sdp_parser_free(parser); + +} + switch_t38_options_t *sofia_glue_extract_t38_options(switch_core_session_t *session, const char *r_sdp) { sdp_media_t *m; @@ -5585,6 +5779,23 @@ void sofia_glue_tech_simplify(private_object_t *tech_pvt) } +void sofia_glue_build_vid_refresh_message(switch_core_session_t *session, const char *pl) +{ + switch_core_session_message_t *msg; + msg = switch_core_session_alloc(session, sizeof(*msg)); + MESSAGE_STAMP_FFL(msg); + msg->message_id = SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ; + if (pl) { + msg->string_arg = switch_core_session_strdup(session, pl); + } + msg->from = __FILE__; + + switch_core_session_queue_message(session, msg); +} + + + + /* For Emacs: * Local Variables: diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 4e734c3..66fc4cc 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -239,6 +239,7 @@ struct switch_rtp { #endif switch_time_t send_time; + switch_byte_t auto_adj_used; }; struct switch_rtcp_senderinfo { @@ -1623,6 +1624,10 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_jitter_buffer(switch_rtp_t * SWITCH_DECLARE(switch_status_t) switch_rtp_activate_rtcp(switch_rtp_t *rtp_session, int send_rate, switch_port_t remote_port) { const char *err = NULL; + + if (!rtp_session->ms_per_packet) { + return SWITCH_STATUS_FALSE; + } switch_set_flag(rtp_session, SWITCH_RTP_FLAG_ENABLE_RTCP); @@ -2531,13 +2536,14 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ switch_channel_set_variable(channel, "remote_media_port", adj_port); switch_channel_set_variable(channel, "rtp_auto_adjust", "true"); } - + rtp_session->auto_adj_used = 1; switch_rtp_set_remote_address(rtp_session, tx_host, switch_sockaddr_get_port(rtp_session->from_addr), 0, SWITCH_FALSE, &err); switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_AUTOADJ); } } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Correct ip/port confirmed.\n"); switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_AUTOADJ); + rtp_session->auto_adj_used = 0; } } @@ -2877,6 +2883,12 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ return ret; } + +SWITCH_DECLARE(switch_byte_t) switch_rtp_check_auto_adj(switch_rtp_t *rtp_session) +{ + return rtp_session->auto_adj_used; +} + SWITCH_DECLARE(switch_size_t) switch_rtp_has_dtmf(switch_rtp_t *rtp_session) { switch_size_t has = 0; commit e9ab5368f1d1b7701812e47aa12468d95548cb33 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Sep 29 10:21:14 2010 -0500 fix bug in mod_loopback where bowout=false diff --git a/src/mod/endpoints/mod_loopback/mod_loopback.c b/src/mod/endpoints/mod_loopback/mod_loopback.c index 8275893..ab4db6a 100644 --- a/src/mod/endpoints/mod_loopback/mod_loopback.c +++ b/src/mod/endpoints/mod_loopback/mod_loopback.c @@ -52,7 +52,8 @@ typedef enum { TFLAG_BRIDGE = (1 << 4), TFLAG_BOWOUT = (1 << 5), TFLAG_BLEG = (1 << 6), - TFLAG_APP = (1 << 7) + TFLAG_APP = (1 << 7), + TFLAG_BOWOUT_USED = (1 << 8) } TFLAGS; struct private_object { @@ -635,7 +636,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc tech_pvt = switch_core_session_get_private(session); switch_assert(tech_pvt != NULL); - if (switch_test_flag(frame, SFF_CNG) || switch_test_flag(tech_pvt, TFLAG_CNG) || switch_test_flag(tech_pvt, TFLAG_BOWOUT)) { + if (switch_test_flag(frame, SFF_CNG) || switch_test_flag(tech_pvt, TFLAG_CNG) || (switch_test_flag(tech_pvt, TFLAG_BOWOUT) && switch_test_flag(tech_pvt, TFLAG_BOWOUT_USED))) { return SWITCH_STATUS_SUCCESS; } @@ -662,6 +663,9 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc switch_clear_flag_locked(tech_pvt, TFLAG_WRITE); switch_clear_flag_locked(tech_pvt->other_tech_pvt, TFLAG_WRITE); + switch_set_flag_locked(tech_pvt, TFLAG_BOWOUT_USED); + switch_set_flag_locked(tech_pvt->other_tech_pvt, TFLAG_BOWOUT_USED); + if (a_uuid && b_uuid) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s detected bridge on both ends, attempting direct connection.\n", switch_channel_get_name(channel)); commit 27096d4512ef6bf21403aa0f466908d940db0078 Author: David Yat Sin <dyatsin@sangoma.com> Date: Tue Sep 28 13:55:46 2010 -0400 Support for enabling/disabling HWEC based on call bearer_cap diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 79d55c4..df139c5 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -244,6 +244,39 @@ static __inline__ void ftdm_std_free(void *pool, void *ptr) free(ptr); } +static void ftdm_set_echocancel_call_begin(ftdm_channel_t *chan) +{ + ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); + if (ftdm_channel_test_feature(chan, FTDM_CHANNEL_FEATURE_HWEC)) { + if (ftdm_channel_test_feature(chan, FTDM_CHANNEL_FEATURE_HWEC_DISABLED_ON_IDLE)) { + if (caller_data->bearer_capability != FTDM_BEARER_CAP_64K_UNRESTRICTED) { + ftdm_channel_command(chan, FTDM_COMMAND_ENABLE_ECHOCANCEL, NULL); + } + } else { + if (caller_data->bearer_capability == FTDM_BEARER_CAP_64K_UNRESTRICTED) { + ftdm_channel_command(chan, FTDM_COMMAND_DISABLE_ECHOCANCEL, NULL); + } + } + } +} + +static void ftdm_set_echocancel_call_end(ftdm_channel_t *chan) +{ + ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); + if (ftdm_channel_test_feature(chan, FTDM_CHANNEL_FEATURE_HWEC)) { + if (ftdm_channel_test_feature(chan, FTDM_CHANNEL_FEATURE_HWEC_DISABLED_ON_IDLE)) { + if (caller_data->bearer_capability != FTDM_BEARER_CAP_64K_UNRESTRICTED) { + ftdm_channel_command(chan, FTDM_COMMAND_DISABLE_ECHOCANCEL, NULL); + } + } else { + if (caller_data->bearer_capability == FTDM_BEARER_CAP_64K_UNRESTRICTED) { + ftdm_channel_command(chan, FTDM_COMMAND_ENABLE_ECHOCANCEL, NULL); + } + } + } +} + + FT_DECLARE_DATA ftdm_memory_handler_t g_ftdm_mem_handler = { /*.pool =*/ NULL, @@ -2008,6 +2041,9 @@ done: static ftdm_status_t call_hangup(ftdm_channel_t *chan, const char *file, const char *func, int line) { ftdm_set_flag(chan, FTDM_CHANNEL_USER_HANGUP); + + ftdm_set_echocancel_call_end(chan); + if (chan->state != FTDM_CHANNEL_STATE_DOWN) { if (chan->state == FTDM_CHANNEL_STATE_HANGUP) { /* make user's life easier, and just ignore double hangup requests */ @@ -2173,10 +2209,12 @@ done: FT_DECLARE(ftdm_status_t) _ftdm_channel_call_place(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan) { ftdm_status_t status = FTDM_FAIL; - + ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "null channel"); ftdm_assert_return(ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND), FTDM_FAIL, "Call place, but outbound flag not set\n"); + ftdm_set_echocancel_call_begin(ftdmchan); + ftdm_channel_lock(ftdmchan); if (ftdmchan->span->outgoing_call) { @@ -4740,11 +4778,15 @@ FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t break; case FTDM_SIGEVENT_START: - /* when cleaning up the public API I added this because mod_freetdm.c on_fxs_signal was - * doing it during SIGEVENT_START, but now that flags are private they can't, wonder if - * is needed at all? - * */ - ftdm_clear_flag(sigmsg->channel, FTDM_CHANNEL_HOLD); + { + ftdm_set_echocancel_call_begin(sigmsg->channel); + + /* when cleaning up the public API I added this because mod_freetdm.c on_fxs_signal was + * doing it during SIGEVENT_START, but now that flags are private they can't, wonder if + * is needed at all? + * */ + ftdm_clear_flag(sigmsg->channel, FTDM_CHANNEL_HOLD); + } break; case FTDM_SIGEVENT_STOP: diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index be99f94..23463e9 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -280,6 +280,25 @@ static unsigned wp_open_range(ftdm_span_t *span, unsigned spanno, unsigned start ftdm_channel_set_feature(chan, FTDM_CHANNEL_FEATURE_DTMF_DETECT); dtmf = "hardware"; } + + err = sangoma_tdm_get_hw_ec(chan->sockfd, &tdm_api); + if (err > 0) { + ftdm_channel_set_feature(chan, FTDM_CHANNEL_FEATURE_HWEC); + } + +#ifdef WP_API_FEATURE_HWEC_PERSIST + err = sangoma_tdm_get_hwec_persist_status(chan->sockfd, &tdm_api); + if (err == 0) { + ftdm_channel_set_feature(chan, FTDM_CHANNEL_FEATURE_HWEC_DISABLED_ON_IDLE); + } +#else + if (span->trunk_type == FTDM_TRUNK_BRI || span->trunk_type == FTDM_TRUNK_BRI_PTMP) { + ftdm_log(FTDM_LOG_WARNING, "WP_API_FEATURE_HWEC_PERSIST feature is not supported \ + with your version of libsangoma, you should update your Wanpipe drivers\n"); + + } +#endif + } #ifdef LIBSANGOMA_VERSION @@ -598,18 +617,33 @@ static FIO_COMMAND_FUNCTION(wanpipe_command) break; case FTDM_COMMAND_ENABLE_ECHOCANCEL: { +#ifdef WP_API_FEATURE_EC_CHAN_STAT + err=sangoma_tdm_get_hwec_chan_status(ftdmchan->sockfd, &tdm_api); + if (err > 0) { + /* Hardware echo canceller already enabled */ + err = 0; + break; + } +#endif err=sangoma_tdm_enable_hwec(ftdmchan->sockfd, &tdm_api); if (err) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "HWEC Enable Failed"); + snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "HWEC Enable Failed"); return FTDM_FAIL; } } break; case FTDM_COMMAND_DISABLE_ECHOCANCEL: { +#ifdef WP_API_FEATURE_EC_CHAN_STAT + err=sangoma_tdm_get_hwec_chan_status(ftdmchan->sockfd, &tdm_api); + if (!err) { + /* Hardware echo canceller already disabled */ + break; + } +#endif err=sangoma_tdm_disable_hwec(ftdmchan->sockfd, &tdm_api); if (err) { - snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "HWEC Disable Failed"); + snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "HWEC Disable Failed"); return FTDM_FAIL; } } diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index d0d19e5..016fd31 100644 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -191,6 +191,8 @@ typedef enum { FTDM_CHANNEL_FEATURE_CALLERID = (1 << 4), /*!< Channel can detect caller id (read-only) */ FTDM_CHANNEL_FEATURE_PROGRESS = (1 << 5), /*!< Channel can detect inband progress (read-only) */ FTDM_CHANNEL_FEATURE_CALLWAITING = (1 << 6), /*!< Channel will allow call waiting (ie: FXS devices) (read/write) */ + FTDM_CHANNEL_FEATURE_HWEC = (1<<7), /*!< Channel has a hardware echo canceller */ + FTDM_CHANNEL_FEATURE_HWEC_DISABLED_ON_IDLE = (1<<8), /*!< hardware echo canceller is disabled when there are no calls on this channel */ } ftdm_channel_feature_t; typedef enum { commit ba5a250cc80ada70049cf2c292786de226f85380 Author: Moises Silva <moy@sangoma.com> Date: Tue Sep 28 11:05:54 2010 -0400 freetdm: stop scheduler but do not destroy it until the very end (dup) diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 299106f..79d55c4 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -4932,16 +4932,19 @@ FT_DECLARE(uint32_t) ftdm_running(void) FT_DECLARE(ftdm_status_t) ftdm_global_destroy(void) { ftdm_span_t *sp; - uint32_t sanity = 100; time_end(); + /* many freetdm event loops rely on this variable to decide when to stop, do this first */ globals.running = 0; - ftdm_sched_destroy(&globals.timingsched); + /* stop the scheduling thread */ + ftdm_free_sched_stop(); + /* stop the cpu monitor thread */ ftdm_cpu_monitor_stop(); + /* now destroy channels and spans */ globals.span_index = 0; ftdm_span_close_all(); @@ -4966,18 +4969,12 @@ FT_DECLARE(ftdm_status_t) ftdm_global_destroy(void) globals.spans = NULL; ftdm_mutex_unlock(globals.span_mutex); + /* destroy signaling and io modules */ ftdm_unload_modules(); - while (ftdm_free_sched_running() && --sanity) { - ftdm_log(FTDM_LOG_DEBUG, "Waiting for schedule thread to finish\n"); - ftdm_sleep(100); - } - - if (!sanity) { - ftdm_log(FTDM_LOG_CRIT, "schedule thread did not stop running, we may crash on shutdown\n"); - } - + /* finally destroy the globals */ ftdm_mutex_lock(globals.mutex); + ftdm_sched_destroy(&globals.timingsched); hashtable_destroy(globals.interface_hash); hashtable_destroy(globals.module_hash); hashtable_destroy(globals.span_hash); diff --git a/libs/freetdm/src/ftdm_sched.c b/libs/freetdm/src/ftdm_sched.c index be21696..47df7d9 100644 --- a/libs/freetdm/src/ftdm_sched.c +++ b/libs/freetdm/src/ftdm_sched.c @@ -176,6 +176,24 @@ FT_DECLARE(ftdm_bool_t) ftdm_free_sched_running(void) return sched_globals.running; } +FT_DECLARE(ftdm_bool_t) ftdm_free_sched_stop(void) +{ + /* currently we really dont stop the thread here, we rely on freetdm being shutdown and ftdm_running() to be false + * so the scheduling thread dies and we just wait for it here */ + uint32_t sanity = 100; + while (ftdm_free_sched_running() && --sanity) { + ftdm_log(FTDM_LOG_DEBUG, "Waiting for main schedule thread to finish\n"); + ftdm_sleep(100); + } + + if (!sanity) { + ftdm_log(FTDM_LOG_CRIT, "schedule thread did not stop running, we may crash on shutdown\n"); + return FTDM_FALSE; + } + + return FTDM_TRUE; +} + FT_DECLARE(ftdm_status_t) ftdm_sched_create(ftdm_sched_t **sched, const char *name) { ftdm_sched_t *newsched = NULL; diff --git a/libs/freetdm/src/include/private/ftdm_sched.h b/libs/freetdm/src/include/private/ftdm_sched.h index 9a22289..c1818d8 100644 --- a/libs/freetdm/src/include/private/ftdm_sched.h +++ b/libs/freetdm/src/include/private/ftdm_sched.h @@ -95,6 +95,9 @@ FT_DECLARE(ftdm_status_t) ftdm_sched_global_init(void); /*! \brief Checks if the main scheduling thread is running */ FT_DECLARE(ftdm_bool_t) ftdm_free_sched_running(void); +/*! \brief Stop the main scheduling thread (if running) */ +FT_DECLARE(ftdm_bool_t) ftdm_free_sched_stop(void); + #ifdef __cplusplus } #endif commit 7577b8aae8d19e61bb2f4412ac2f2ff5eef0da26 Author: Raymond Chandler <intralanman@freeswitch.org> Date: Tue Sep 28 11:02:35 2010 -0400 add nat_map usage diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 9b5455b..6a16a9c 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -135,7 +135,7 @@ SWITCH_STANDARD_API(nat_map_function) switch_bool_t sticky = SWITCH_FALSE; if (!cmd) { - goto error; + goto usage; } if (!switch_nat_is_initialized()) { @@ -147,9 +147,8 @@ SWITCH_STANDARD_API(nat_map_function) switch_assert(mydata); argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); - if (argc < 1) { - goto error; + goto usage; } if (argv[0] && switch_stristr("status", argv[0])) { tmp = switch_nat_status(); @@ -197,6 +196,10 @@ SWITCH_STANDARD_API(nat_map_function) error: stream->write_function(stream, "false"); + goto ok; + + usage: + stream->write_function(stream, "USAGE: nat_map [status|reinit|republish] | [add|del] <port> [tcp|udp] [sticky]"); ok: commit b6a81ba7fdb0875f04fddb74b33415c6e8afc507 Author: Brian West <brian@freeswitch.org> Date: Mon Sep 27 21:36:02 2010 -0500 http://www.infiltrated.net/voipabuse/ diff --git a/scripts/perl/blacklist.pl b/scripts/perl/blacklist.pl new file mode 100755 index 0000000..d6c2ea7 --- /dev/null +++ b/scripts/perl/blacklist.pl @@ -0,0 +1,29 @@ +#!/usr/bin/perl +# +# Add this to acl.conf.xml +# +# <X-PRE-PROCESS cmd="exec" data="$${base_dir}/bin/blacklist.pl"/> +# + +use Data::Dumper; +use LWP::Simple; + +# http://www.infiltrated.net/voipabuse/addresses.txt +# http://www.infiltrated.net/voipabuse/netblocks.txt + + +my @addresses = split(/\n/, get("http://www.infiltrated.net/voipabuse/addresses.txt")); +my @netblocks = split(/\n/, get("http://www.infiltrated.net/voipabuse/netblocks.txt")); + +print "<list name=\"voip-abuse-addresses\" default=\"allow\">\n"; +foreach $addr (@addresses) { + print " <node type=\"deny\" cidr=\"$addr/32\"/>\n"; +} +print "</list>\n"; + + +print "<list name=\"voip-abuse-netblocks\" default=\"allow\">\n"; +foreach $netb (@netblocks) { + print " <node type=\"deny\" cidr=\"$netb\"/>\n"; +} +print "</list>\n"; diff --git a/scripts/perl/honeypot.pl b/scripts/perl/honeypot.pl new file mode 100755 index 0000000..ef52142 --- /dev/null +++ b/scripts/perl/honeypot.pl @@ -0,0 +1,26 @@ +#!/usr/bin/perl +# +# Add this to conf/dialplan/public but only if you wish to setup a honeypot. +# +# <X-PRE-PROCESS cmd="exec" data="$${base_dir}/bin/honeypot.pl"/> +# + +use Data::Dumper; +use LWP::Simple; + +# http://www.infiltrated.net/voipabuse/numberscalled.txt + +my @numberscalled = split(/\n/, get("http://www.infiltrated.net/voipabuse/numberscalled.txt")); + +foreach $number (@numberscalled) { + my ($num,$ts) = split(/\t/, $number); + + print "<extension name=\"$num\">\n"; + print " <condition field=\"destination_number\" expression=\"^$num\$\">\n"; + print " <action application=\"answer\"/>\n"; + print " <action application=\"sleep\" data=\"30000\"/>\n"; + print " </condition>\n"; + print "</extension>\n"; +} + + commit fa711796a81ba5d502e2d8711b5047fca41f75f6 Author: Moises Silva <moy@sangoma.com> Date: Mon Sep 27 21:56:03 2010 -0400 freetdm/openzap: OPENZAP-110 - John Wehle rocks! diff --git a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c index d9000a6..ae93984 100644 --- a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c +++ b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c @@ -974,7 +974,7 @@ FIO_SPAN_POLL_EVENT_FUNCTION(zt_poll_event) */ FIO_SPAN_NEXT_EVENT_FUNCTION(zt_next_event) { - uint32_t i, event_id = 0; + uint32_t i, event_id = FTDM_OOB_INVALID; zt_event_t zt_event_id = 0; for(i = 1; i <= span->chan_count; i++) { @@ -1022,6 +1022,8 @@ FIO_SPAN_NEXT_EVENT_FUNCTION(zt_next_event) event_id = FTDM_OOB_OFFHOOK; } else if (span->channels[i]->type == FTDM_CHAN_TYPE_FXO) { event_id = FTDM_OOB_RING_START; + } else { + event_id = FTDM_OOB_NOOP; } } break; diff --git a/libs/openzap/src/ozmod/ozmod_zt/ozmod_zt.c b/libs/openzap/src/ozmod/ozmod_zt/ozmod_zt.c index 0eaf955..ca42c2c 100644 --- a/libs/openzap/src/ozmod/ozmod_zt/ozmod_zt.c +++ b/libs/openzap/src/ozmod/ozmod_zt/ozmod_zt.c @@ -977,7 +977,7 @@ ZIO_SPAN_POLL_EVENT_FUNCTION(zt_poll_event) */ ZIO_SPAN_NEXT_EVENT_FUNCTION(zt_next_event) { - uint32_t i, event_id = 0; + uint32_t i, event_id = ZAP_OOB_INVALID; zt_event_t zt_event_id = 0; for(i = 1; i <= span->chan_count; i++) { @@ -1025,6 +1025,8 @@ ZIO_SPAN_NEXT_EVENT_FUNCTION(zt_next_event) event_id = ZAP_OOB_OFFHOOK; } else if (span->channels[i]->type == ZAP_CHAN_TYPE_FXO) { event_id = ZAP_OOB_RING_START; + } else { + event_id = ZAP_OOB_NOOP; } } break; commit a9600a45e0666a432e5be02d30c214fba6088c88 Author: Moises Silva <moy@sangoma.com> Date: Mon Sep 27 21:45:24 2010 -0400 openzap: OPENZAP-106 - patched by John Wehle diff --git a/libs/openzap/src/zap_io.c b/libs/openzap/src/zap_io.c index 7d37a49..283a9fe 100644 --- a/libs/openzap/src/zap_io.c +++ b/libs/openzap/src/zap_io.c @@ -1017,6 +1017,7 @@ OZ_DECLARE(zap_status_t) zap_channel_set_state(zap_channel_t *zchan, zap_channel case ZAP_CHANNEL_STATE_RING: case ZAP_CHANNEL_STATE_PROGRESS_MEDIA: case ZAP_CHANNEL_STATE_PROGRESS: + case ZAP_CHANNEL_STATE_IDLE: case ZAP_CHANNEL_STATE_GET_CALLERID: case ZAP_CHANNEL_STATE_GENRING: ok = 1; commit caec99adace3ca24f2bec287a0295328c8775e23 Author: Moises Silva <moy@sangoma.com> Date: Mon Sep 27 21:42:46 2010 -0400 freetdm: OPENZAP-108 - patched by John Wehle diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 299106f..7289f0b 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -1251,6 +1251,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_set_state(const char *file, const char *f case FTDM_CHANNEL_STATE_RING: case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: case FTDM_CHANNEL_STATE_PROGRESS: + case FTDM_CHANNEL_STATE_IDLE: case FTDM_CHANNEL_STATE_GET_CALLERID: case FTDM_CHANNEL_STATE_GENRING: ok = 1; commit c2cba3634e5240cdfc0cf9312ecb136645f975f7 Author: Moises Silva <moy@sangoma.com> Date: Mon Sep 27 21:38:42 2010 -0400 freetdm: fix old zaptel support diff --git a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c index c4ba3ae..d9000a6 100644 --- a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c +++ b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c @@ -170,8 +170,8 @@ static const char *chanpath = NULL; static const char dahdi_ctlpath[] = "/dev/dahdi/ctl"; static const char dahdi_chanpath[] = "/dev/dahdi/channel"; -static const char zt_ctlpath[] = "/dev/ftdm/ctl"; -static const char zt_chanpath[] = "/dev/ftdm/channel"; +static const char zt_ctlpath[] = "/dev/zap/ctl"; +static const char zt_chanpath[] = "/dev/zap/channel"; static ftdm_socket_t CONTROL_FD = ZT_INVALID_SOCKET; commit 3551cc639f4a5613f04e8ae01737b92e56cf5144 Author: Moises Silva <moy@sangoma.com> Date: Mon Sep 27 21:22:52 2010 -0400 freetdm: fix doxygen target diff --git a/libs/freetdm/Makefile.am b/libs/freetdm/Makefile.am index 33a8b96..d14013a 100644 --- a/libs/freetdm/Makefile.am +++ b/libs/freetdm/Makefile.am @@ -312,7 +312,7 @@ ftmod_r2_la_LIBADD = $(MYLIB) endif dox doxygen: - cd docs && doxygen $(FT_SRCDIR)/docs/Doxygen.conf + doxygen $(FT_SRCDIR)/docs/Doxygen.conf mod_freetdm/mod_freetdm.$(DYNAMIC_LIB_EXTEN): $(MYLIB) mod_freetdm/mod_freetdm.c cd mod_freetdm && make commit fe82c1c1433d0518ddc6a58d38d621cc58a998ec Author: Moises Silva <moy@sangoma.com> Date: Mon Sep 27 21:04:43 2010 -0400 freetdm: move ftdm_channel_clear_detected_tones to the private header diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index a418152..1efe459 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -667,9 +667,6 @@ FT_DECLARE(ftdm_status_t) ftdm_span_set_sig_status(ftdm_span_t *span, ftdm_signa /*! \brief Get span signaling status (ie: whether protocol layer is up or down) */ FT_DECLARE(ftdm_status_t) ftdm_span_get_sig_status(ftdm_span_t *span, ftdm_signaling_status_t *status); -/*! \brief Get span signaling status (ie: whether protocol layer is up or down) */ -FT_DECLARE(void) ftdm_channel_clear_detected_tones(ftdm_channel_t *ftdmchan); - /*! * \brief Set user private data in the channel * @@ -1268,7 +1265,7 @@ FT_DECLARE(const char *) ftdm_channel_get_state_str(const ftdm_channel_t *channe FT_DECLARE(const char *) ftdm_channel_get_last_state_str(const ftdm_channel_t *channel); /*! \brief For display debugging purposes you can display this string which describes the history of the channel - * \param The channel + * \param channel The channel to get the history from * \return History string for the channel. You must free the string with ftdm_free */ FT_DECLARE(char *) ftdm_channel_get_history_str(const ftdm_channel_t *channel); diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index beee868..8bdbdd6 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -595,6 +595,10 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_queue_dtmf(ftdm_channel_t *ftdmchan, cons /* dequeue pending signals and notify the user via the span signal callback */ FT_DECLARE(ftdm_status_t) ftdm_span_trigger_signals(const ftdm_span_t *span); +/*! \brief clear the tone detector state */ +FT_DECLARE(void) ftdm_channel_clear_detected_tones(ftdm_channel_t *ftdmchan); + + /*! \brief Assert condition */ commit 04aa7ef90c582bdb0cb9956fedf059f241a5bd7e Author: Brian West <brian@freeswitch.org> Date: Mon Sep 27 18:52:30 2010 -0500 FS-1682 diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index dbcc9f6..2787824 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -1119,7 +1119,7 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat if (pvt->app_mode == FUNCTION_TX) { req_counter = 100; } else { - req_counter = 1; + req_counter = 50; } while (switch_channel_ready(channel)) { commit 2cb2d3bde4564d0cdfd8795548608376f5fd9f22 Author: Brian West <brian@freeswitch.org> Date: Mon Sep 27 18:52:30 2010 -0500 FS-1682 diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index ec9c2ed..dbcc9f6 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -852,6 +852,12 @@ static t38_mode_t request_t38(pvt_t *pvt) insist = globals.enable_t38_insist; } + if ((t38_options = switch_channel_get_private(channel, "t38_options"))) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, + "%s already has T.38 data\n", switch_channel_get_name(channel)); + enabled = 0; + } + if (enabled) { t38_options = switch_core_session_alloc(session, sizeof(*t38_options)); @@ -994,6 +1000,7 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat switch_frame_t write_frame = { 0 }; switch_codec_implementation_t read_impl = { 0 }; int16_t *buf = NULL; + uint32_t req_counter = 0; switch_core_session_get_read_impl(session, &read_impl); @@ -1109,10 +1116,11 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat switch_ivr_sleep(session, 250, SWITCH_TRUE, NULL); - - /* If you have the means, I highly recommend picking one up. ...*/ - request_t38(pvt); - + if (pvt->app_mode == FUNCTION_TX) { + req_counter = 100; + } else { + req_counter = 1; + } while (switch_channel_ready(channel)) { int tx = 0; @@ -1156,6 +1164,13 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat break; case T38_MODE_UNKNOWN: { + if (req_counter) { + if (!--req_counter) { + /* If you have the means, I highly recommend picking one up. ...*/ + request_t38(pvt); + } + } + if (switch_channel_test_app_flag_key("T38", channel, CF_APP_T38)) { if (negotiate_t38(pvt) == T38_MODE_NEGOTIATED) { /* is is safe to call this again, it was already called above in AUDIO_MODE */ commit 3fee704d668e7d09fb764b4578020f684bd9901f Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Sep 27 13:26:09 2010 -0500 FS-2738 diff --git a/libs/apr/.update b/libs/apr/.update index 097f707..d5bc43d 100644 --- a/libs/apr/.update +++ b/libs/apr/.update @@ -1 +1 @@ -Thu Nov 19 09:24:37 EST 2009 +Mon Sep 27 13:15:54 CDT 2010 diff --git a/libs/apr/strings/apr_snprintf.c b/libs/apr/strings/apr_snprintf.c index fe8b382..4f59f92 100644 --- a/libs/apr/strings/apr_snprintf.c +++ b/libs/apr/strings/apr_snprintf.c @@ -824,7 +824,13 @@ APR_DECLARE(int) apr_vformatter(int (*flush_func)(apr_vformatter_buff_t *), * Modifier check. Note that if APR_INT64_T_FMT is "d", * the first if condition is never true. */ - if ((sizeof(APR_INT64_T_FMT) == 4 && + + /* HACK BY FREESWITCH TEAM TO FIX COMPATIBILITY 2010-09-27 */ + if (*fmt == 'l' && *(fmt + 1) == 'l') { + var_type = IS_QUAD; + fmt += 2; + } + else if ((sizeof(APR_INT64_T_FMT) == 4 && fmt[0] == APR_INT64_T_FMT[0] && fmt[1] == APR_INT64_T_FMT[1]) || (sizeof(APR_INT64_T_FMT) == 3 && @@ -843,6 +849,11 @@ APR_DECLARE(int) apr_vformatter(int (*flush_func)(apr_vformatter_buff_t *), else if (*fmt == 'l') { var_type = IS_LONG; fmt++; + /* HACK BY FREESWITCH TEAM TO FIX COMPATIBILITY 2010-09-27 */ + if (*fmt == 'l') { + var_type = IS_QUAD; + fmt++; + } } else if (*fmt == 'h') { var_type = IS_SHORT; commit fb71965fd2fa1ce653994c91440b5e3c7843e946 Author: Konrad Hammel <konrad@sangoma.com> Date: Mon Sep 27 14:24:51 2010 -0400 freetdm: ss7 - bug fix diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index 4125c84..fc14d04 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -746,8 +746,8 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) ft_to_sngss7_rsca (ftdmchan); /* clear the reset flag */ - sngss7_clear_flag (sngss7_info, FLAG_RESET_RX); - } + clear_rx_rsc_flags(sngss7_info); + } /* if (sngss7_test_flag (sngss7_info, FLAG_RESET_RX)) */ /* check if there was a GRS that needs a GRA */ if ((sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_RX)) && @@ -769,32 +769,24 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) } /* clear the grp reset flag */ - sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_RX); - sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_RX_DN); - sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_RX_CMPLT); - + clear_rx_grs_flags(sngss7_info); }/* if ( sngss7_test_flag ( sngss7_info, FLAG_GRP_RESET_RX ) ) */ /* check if we got the reset response */ if (sngss7_test_flag(sngss7_info, FLAG_RESET_TX_RSP)) { /* clear the reset flag */ - sngss7_clear_flag(sngss7_info, FLAG_RESET_TX_RSP); - sngss7_clear_flag(sngss7_info, FLAG_RESET_SENT); - sngss7_clear_flag(sngss7_info, FLAG_RESET_TX); - } + clear_tx_rsc_flags(sngss7_info); + } /* if (sngss7_test_flag(sngss7_info, FLAG_RESET_TX_RSP)) */ if (sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP)) { /* clear the reset flag */ - sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP); - sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_TX); - sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_BASE); - sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_SENT); + clear_tx_grs_flags(sngss7_info); /* clean out the spans GRA structure */ sngss7_span_data_t *span = ftdmchan->span->mod_data; span->rx_gra.circuit = 0; span->rx_gra.range = 0; - } + } /* if (sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP)) */ /* check if we came from reset (aka we just processed a reset) */ if ((ftdmchan->last_state == FTDM_CHANNEL_STATE_RESTART) || @@ -825,7 +817,6 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) } /* if (!ftdm_test_flag (ftdmchan, FTDM_CHANNEL_SIG_UP)) */ } /* if !blocked */ } else { - SS7_DEBUG_CHAN(ftdmchan,"Reset flags present (0x%X)\n", sngss7_info->flags); /* there is still another reset pending so go back to reset*/ @@ -1120,14 +1111,10 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) ftdm_span_send_signal (ftdmchan->span, &sigev); /* remove any reset flags */ - sngss7_clear_flag (sngss7_info, FLAG_GRP_RESET_TX_RSP); - sngss7_clear_flag (sngss7_info, FLAG_GRP_RESET_TX); - sngss7_clear_flag (sngss7_info, FLAG_RESET_TX_RSP); - sngss7_clear_flag (sngss7_info, FLAG_RESET_TX); - sngss7_clear_flag (sngss7_info, FLAG_RESET_SENT); - sngss7_clear_flag (sngss7_info, FLAG_GRP_RESET_RX); - sngss7_clear_flag (sngss7_info, FLAG_RESET_RX); - sngss7_clear_flag (sngss7_info, FLAG_GRP_RESET_BASE); + clear_rx_grs_flags(sngss7_info); + clear_tx_grs_flags(sngss7_info); + clear_rx_rsc_flags(sngss7_info); + clear_tx_rsc_flags(sngss7_info); /* bring the channel down */ goto suspend_goto_last; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index ae24123..d44815d 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -430,8 +430,10 @@ extern int cmbLinkSetId; /******************************************************************************/ /* PROTOTYPES *****************************************************************/ +/* in ftmod_sangoma_ss7_main.c */ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t *ftdmchan); +/* in ftmod_sangoma_ss7_logger.c */ void handle_sng_log(uint8_t level, char *fmt,...); void handle_sng_mtp1_alarm(Pst *pst, L1Mngmt *sta); void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta); @@ -439,6 +441,7 @@ void handle_sng_mtp3_alarm(Pst *pst, SnMngmt *sta); void handle_sng_isup_alarm(Pst *pst, SiMngmt *sta); void handle_sng_cc_alarm(Pst *pst, CcMngmt *sta); +/* in ftmod_sangoma_ss7_cfg.c */ int ft_to_sngss7_cfg_all(void); int ftmod_ss7_mtp1_gen_config(void); int ftmod_ss7_mtp2_gen_config(void); @@ -457,6 +460,9 @@ int ftmod_ss7_isup_ckt_config(int id); int ftmod_ss7_isup_isap_config(int id); int ftmod_ss7_cc_isap_config(int id); +/* in ftmod_sangoma_ss7_cntrl.c */ +int ft_to_sngss7_activate_all(void); + int ftmod_ss7_inhibit_mtplink(uint32_t id); int ftmod_ss7_uninhibit_mtplink(uint32_t id); int ftmod_ss7_activate_mtplink(uint32_t id); @@ -468,11 +474,12 @@ int ftmod_ss7_deactivate2_mtplinkSet(uint32_t id); int ftmod_ss7_lpo_mtplink(uint32_t id); int ftmod_ss7_lpr_mtplink(uint32_t id); +/* in ftmod_sangoma_ss7_sta.c */ int ftmod_ss7_mtplink_sta(uint32_t id, SnMngmt *cfm); int ftmod_ss7_mtplinkSet_sta(uint32_t id, SnMngmt *cfm); -int ft_to_sngss7_activate_all(void); +/* in ftmod_sangoma_ss7_out.c */ void ft_to_sngss7_iam(ftdm_channel_t *ftdmchan); void ft_to_sngss7_acm(ftdm_channel_t *ftdmchan); void ft_to_sngss7_anm(ftdm_channel_t *ftdmchan); @@ -492,6 +499,7 @@ void ft_to_sngss7_cgua(ftdm_channel_t * ftdmchan); void ft_to_sngss7_cgb(ftdm_channel_t * ftdmchan); void ft_to_sngss7_cgu(ftdm_channel_t * ftdmchan); +/* in ftmod_sangoma_ss7_in.c */ void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); void sngss7_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); void sngss7_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); @@ -504,6 +512,7 @@ void sngss7_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); void sngss7_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit); +/* in ftmod_sangoma_ss7_handle.c */ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCnStEvnt *siCnStEvnt, uint8_t evntType); ftdm_status_t handle_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); @@ -534,6 +543,13 @@ ftdm_status_t handle_local_blk(uint32_t suInstId, uint32_t spInstId, uint32_t ci ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +/* in ftmod_sangoma_ss7_xml.c */ +int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *span); + +/* in ftmod_sangoma_ss7_cli.c */ +ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const char *data); + +/* in ftmod_sangoma_ss7_support.c */ uint8_t copy_cgPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum); uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum); uint8_t copy_cdPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum); @@ -545,16 +561,19 @@ int check_for_reset(sngss7_chan_data_t *sngss7_info); ftdm_status_t extract_chan_data(uint32_t circuit, sngss7_chan_data_t **sngss7_info, ftdm_channel_t **ftdmchan); unsigned long get_unique_id(void); -int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *span); - -void handle_isup_t35(void *userdata); - -ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const char *data); - ftdm_status_t check_if_rx_grs_started(ftdm_span_t *ftdmspan); ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan); ftdm_status_t check_if_rx_gra_started(ftdm_span_t *ftdmspan); ftdm_status_t check_for_res_sus_flag(ftdm_span_t *ftdmspan); + +ftdm_status_t clear_rx_grs_flags(sngss7_chan_data_t *sngss7_info); +ftdm_status_t clear_tx_grs_flags(sngss7_chan_data_t *sngss7_info); +ftdm_status_t clear_rx_rsc_flags(sngss7_chan_data_t *sngss7_info); +ftdm_status_t clear_tx_rsc_flags(sngss7_chan_data_t *sngss7_info); + + +/* in ftmod_sangoma_ss7_timers.c */ +void handle_isup_t35(void *userdata); /******************************************************************************/ /* MACROS *********************************************************************/ commit 45e2b99dab4796f63ae49ee5c875fe12aa98a708 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Sep 27 13:09:03 2010 -0500 don't passthru when its proxy media, bypass media or there is no rtp session, fixes seg diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 5892ef5..508fa54 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -3737,6 +3737,11 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s pass = 0; } + if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) || + switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA) || !switch_rtp_ready(tech_pvt->rtp_session)) { + pass = 0; + } + if (pass && switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) { private_object_t *other_tech_pvt = switch_core_session_get_private(other_session); switch_core_session_message_t *msg; commit 7310c2c5530b3cdf671effc260cbf70733066213 Author: Brian West <brian@freeswitch.org> Date: Mon Sep 27 12:44:36 2010 -0500 FS-1681 diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index d2bf096..e4c4a51 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -2016,6 +2016,9 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi switch_t38_options_t *t38_options = switch_channel_get_private(tech_pvt->channel, "t38_options"); if (t38_options) { sofia_glue_set_image_sdp(tech_pvt, t38_options, 0); + if (switch_rtp_ready(tech_pvt->rtp_session)) { + switch_rtp_udptl_mode(tech_pvt->rtp_session); + } } } else { sofia_glue_tech_set_local_sdp(tech_pvt, sdp, SWITCH_TRUE); diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 80f72d4..470a865 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -4197,14 +4197,11 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status if (status == 200 && sofia_test_flag(tech_pvt, TFLAG_T38_PASSTHRU) && has_t38) { if (switch_rtp_ready(tech_pvt->rtp_session) && switch_rtp_ready(other_tech_pvt->rtp_session)) { switch_rtp_udptl_mode(tech_pvt->rtp_session); - switch_rtp_udptl_mode(other_tech_pvt->rtp_session); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Activating T38 Passthru\n"); } - switch_core_session_receive_message(other_session, msg); - } else { - switch_core_session_queue_message(other_session, msg); } + switch_core_session_queue_message(other_session, msg); switch_core_session_rwunlock(other_session); } commit bdcad14a4630b312ed32740d60b8bbe99a599e87 Author: Konrad Hammel <konrad@sangoma.com> Date: Mon Sep 27 13:37:21 2010 -0400 freetdm: ss7 - added functions to clear flags for reset diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index ce9423c..4125c84 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -1136,8 +1136,14 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) if (sngss7_test_flag (sngss7_info, FLAG_CKT_UCIC_UNBLK)) { SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_UCIC_UNBLK flag %s\n", "");; - /* throw the channel into reset from our side since it is already in reset from the remote side */ - sngss7_set_flag (sngss7_info, FLAG_RESET_TX); + /* remove the UCIC block flag */ + sngss7_clear_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK); + + /* remove the UCIC unblock flag */ + sngss7_clear_flag(sngss7_info, FLAG_CKT_UCIC_UNBLK); + + /* throw the channel into reset to sync states */ + sngss7_set_flag(sngss7_info, FLAG_RESET_TX); /* bring the channel into restart again */ goto suspend_goto_restart; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 8e7c649..dfa174e 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -61,6 +61,11 @@ ftdm_status_t check_if_rx_grs_started(ftdm_span_t *ftdmspan); ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan); ftdm_status_t check_if_rx_gra_started(ftdm_span_t *ftdmspan); ftdm_status_t check_for_res_sus_flag(ftdm_span_t *ftdmspan); + +ftdm_status_t clear_rx_grs_flags(sngss7_chan_data_t *sngss7_info); +ftdm_status_t clear_tx_grs_flags(sngss7_chan_data_t *sngss7_info); +ftdm_status_t clear_rx_rsc_flags(sngss7_chan_data_t *sngss7_info); +ftdm_status_t clear_tx_rsc_flags(sngss7_chan_data_t *sngss7_info); /******************************************************************************/ /* FUNCTIONS ******************************************************************/ @@ -752,7 +757,49 @@ ftdm_status_t check_for_res_sus_flag(ftdm_span_t *ftdmspan) } /******************************************************************************/ +ftdm_status_t clear_rx_grs_flags(sngss7_chan_data_t *sngss7_info) +{ + /* clear all the flags related to an incoming GRS */ + sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_RX); + sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_RX_DN); + sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_RX_CMPLT); + + return FTDM_SUCCESS; +} + +/******************************************************************************/ +ftdm_status_t clear_tx_grs_flags(sngss7_chan_data_t *sngss7_info) +{ + /* clear all the flags related to an outgoing GRS */ + sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_BASE); + sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_TX); + sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_SENT); + sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP); + + return FTDM_SUCCESS; +} + +/******************************************************************************/ +ftdm_status_t clear_rx_rsc_flags(sngss7_chan_data_t *sngss7_info) +{ + /* clear all the flags related to an incoming RSC */ + sngss7_clear_flag(sngss7_info, FLAG_RESET_RX); + + return FTDM_SUCCESS; +} + +/******************************************************************************/ +ftdm_status_t clear_tx_rsc_flags(sngss7_chan_data_t *sngss7_info) +{ + /* clear all the flags related to an outgoing RSC */ + sngss7_clear_flag(sngss7_info, FLAG_RESET_TX); + sngss7_clear_flag(sngss7_info, FLAG_RESET_SENT); + sngss7_clear_flag(sngss7_info, FLAG_RESET_TX_RSP); + + return FTDM_SUCCESS; +} +/******************************************************************************/ /******************************************************************************/ /* For Emacs: commit 85b0e1b9c985b0969fc9debe43bdf0705f5048a0 Author: Mathieu Parent <math.parent@gmail.com> Date: Mon Sep 27 18:49:11 2010 +0200 Skinny: Adds unimplemented send_data(), correct formats - send_data() (only defined in .h-file - never implemented) - Adds correct formats when adding message body. Thanks to Peter Olsson for spotting this in FS-2737 diff --git a/src/mod/endpoints/mod_skinny/skinny_api.c b/src/mod/endpoints/mod_skinny/skinny_api.c index 9f527f5..7bbb27a 100644 --- a/src/mod/endpoints/mod_skinny/skinny_api.c +++ b/src/mod/endpoints/mod_skinny/skinny_api.c @@ -408,7 +408,7 @@ static switch_status_t skinny_api_cmd_profile_device_send_data(const char *profi */ } } - switch_event_add_body(event, body); + switch_event_add_body(event, "%s", body); switch_event_fire(&event); stream->write_function(stream, "+OK\n"); } else { diff --git a/src/mod/endpoints/mod_skinny/skinny_protocol.c b/src/mod/endpoints/mod_skinny/skinny_protocol.c index 5486f08..743514d 100644 --- a/src/mod/endpoints/mod_skinny/skinny_protocol.c +++ b/src/mod/endpoints/mod_skinny/skinny_protocol.c @@ -902,6 +902,32 @@ switch_status_t send_reset(listener_t *listener, uint32_t reset_type) return skinny_send_reply(listener, message); } +switch_status_t send_data(listener_t *listener, uint32_t message_type, + uint32_t application_id, + uint32_t line_instance, + uint32_t call_id, + uint32_t transaction_id, + uint32_t data_length, + const char *data) +{ + skinny_message_t *message; + switch_assert(data_length == strlen(data)); + /* data_length should be a multiple of 4 */ + if ((data_length % 4) != 0) { + data_length = (data_length / 4 + 1) * 4; + } + message = switch_core_alloc(listener->pool, 12+sizeof(message->data.data)+data_length-1); + message->type = message_type; + message->length = 4 + sizeof(message->data.data)+data_length-1; + message->data.data.application_id = application_id; + message->data.data.line_instance = line_instance; + message->data.data.call_id = call_id; + message->data.data.transaction_id = transaction_id; + message->data.data.data_length = data_length; + strncpy(message->data.data.data, data, data_length); + return skinny_send_reply(listener, message); +} + switch_status_t send_extended_data(listener_t *listener, uint32_t message_type, uint32_t application_id, uint32_t line_instance, diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index bd2d679..cfafea6 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -1884,7 +1884,7 @@ switch_status_t skinny_handle_data_message(listener_t *listener, skinny_message_ tmp = malloc(request->data.data.data_length + 1); memcpy(tmp, request->data.data.data, request->data.data.data_length); tmp[request->data.data.data_length] = '\0'; - switch_event_add_body(event, tmp); + switch_event_add_body(event, "%s", tmp); switch_safe_free(tmp); switch_event_fire(&event); @@ -1956,7 +1956,7 @@ switch_status_t skinny_handle_extended_data_message(listener_t *listener, skinny tmp = malloc(request->data.data.data_length + 1); memcpy(tmp, request->data.data.data, request->data.data.data_length); tmp[request->data.data.data_length] = '\0'; - switch_event_add_body(event, tmp); + switch_event_add_body(event, "%s", tmp); switch_safe_free(tmp); switch_event_fire(&event); commit 280e894d172ea442be8113fe3bc2fdcb1d959485 Author: Jeff Lenk <jeff@jefflenk.com> Date: Mon Sep 27 10:25:40 2010 -0500 Remove mod_spidermonkey from windows 2008 x64 builds - does not work diff --git a/Freeswitch.2008.sln b/Freeswitch.2008.sln index d87a7ec..27c94a2 100644 --- a/Freeswitch.2008.sln +++ b/Freeswitch.2008.sln @@ -1277,11 +1277,9 @@ Global {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|Win32.ActiveCfg = Debug|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|Win32.Build.0 = Debug|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|x64.ActiveCfg = Debug|x64 - {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Debug|x64.Build.0 = Debug|x64 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|Win32.ActiveCfg = Release|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|Win32.Build.0 = Release|Win32 {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|x64.ActiveCfg = Release|x64 - {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}.Release|x64.Build.0 = Release|x64 {692F6330-4D87-4C82-81DF-40DB5892636E}.All|Win32.ActiveCfg = Release|x64 {692F6330-4D87-4C82-81DF-40DB5892636E}.All|x64.ActiveCfg = Release|x64 {692F6330-4D87-4C82-81DF-40DB5892636E}.All|x64.Build.0 = Release|x64 @@ -1593,22 +1591,18 @@ Global {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|Win32.ActiveCfg = Debug|Win32 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|Win32.Build.0 = Debug|Win32 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|x64.ActiveCfg = Debug|x64 - {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Debug|x64.Build.0 = Debug|x64 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|Win32.ActiveCfg = Release|Win32 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|Win32.Build.0 = Release|Win32 {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|x64.ActiveCfg = Release|x64 - {ACFFF684-4D19-4D48-AF12-88EA1D778BDF}.Release|x64.Build.0 = Release|x64 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.All|Win32.ActiveCfg = Release|x64 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.All|x64.ActiveCfg = Release|x64 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.All|x64.Build.0 = Release|x64 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|Win32.ActiveCfg = Debug|Win32 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|Win32.Build.0 = Debug|Win32 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|x64.ActiveCfg = Debug|x64 - {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Debug|x64.Build.0 = Debug|x64 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|Win32.ActiveCfg = Release|Win32 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|Win32.Build.0 = Release|Win32 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|x64.ActiveCfg = Release|x64 - {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|x64.Build.0 = Release|x64 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|Win32.ActiveCfg = Release|x64 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|x64.ActiveCfg = Release|x64 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|x64.Build.0 = Release|x64 @@ -1637,11 +1631,9 @@ Global {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|Win32.ActiveCfg = Debug|Win32 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|Win32.Build.0 = Debug|Win32 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|x64.ActiveCfg = Debug|x64 - {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Debug|x64.Build.0 = Debug|x64 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|Win32.ActiveCfg = Release|Win32 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|Win32.Build.0 = Release|Win32 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|x64.ActiveCfg = Release|x64 - {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.Release|x64.Build.0 = Release|x64 {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.All|Win32.ActiveCfg = Release|x64 {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.All|x64.ActiveCfg = Release|x64 {AB91A099-7690-4ECF-8994-E458F4EA1ED4}.All|x64.Build.0 = Release|x64 @@ -1736,11 +1728,9 @@ Global {028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|Win32.ActiveCfg = Debug|Win32 {028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|Win32.Build.0 = Debug|Win32 {028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|x64.ActiveCfg = Debug|x64 - {028C7278-05D7-4E18-82FE-BE231B844F41}.Debug|x64.Build.0 = Debug|x64 {028C7278-05D7-4E18-82FE-BE231B844F41}.Release|Win32.ActiveCfg = Release|Win32 {028C7278-05D7-4E18-82FE-BE231B844F41}.Release|Win32.Build.0 = Release|Win32 {028C7278-05D7-4E18-82FE-BE231B844F41}.Release|x64.ActiveCfg = Release|x64 - {028C7278-05D7-4E18-82FE-BE231B844F41}.Release|x64.Build.0 = Release|x64 {D7F1E3F2-A3F4-474C-8555-15122571AF52}.All|Win32.ActiveCfg = Release|x64 {D7F1E3F2-A3F4-474C-8555-15122571AF52}.All|x64.ActiveCfg = Release|x64 {D7F1E3F2-A3F4-474C-8555-15122571AF52}.All|x64.Build.0 = Release|x64 @@ -1901,11 +1891,9 @@ Global {36E854E3-CE12-4348-A125-CCF3F9D74813}.Debug|Win32.ActiveCfg = Debug|Win32 {36E854E3-CE12-4348-A125-CCF3F9D74813}.Debug|Win32.Build.0 = Debug|Win32 {36E854E3-CE12-4348-A125-CCF3F9D74813}.Debug|x64.ActiveCfg = Debug|x64 - {36E854E3-CE12-4348-A125-CCF3F9D74813}.Debug|x64.Build.0 = Debug|x64 {36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|Win32.ActiveCfg = Release|Win32 {36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|Win32.Build.0 = Release|Win32 {36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|x64.ActiveCfg = Release|x64 - {36E854E3-CE12-4348-A125-CCF3F9D74813}.Release|x64.Build.0 = Release|x64 {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.All|Win32.ActiveCfg = Release|x64 {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.All|x64.ActiveCfg = Release|x64 {7B077E7F-1BE7-4291-AB86-55E527B25CAC}.All|x64.Build.0 = Release|x64 commit ba59c51d607b16c18a4f8a04344af6638f1355d3 Author: Brian West <brian@freeswitch.org> Date: Mon Sep 27 10:09:47 2010 -0500 FS-2739: Handle 301 moved permanently. diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index c851779..80f72d4 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -3959,7 +3959,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status } - if (channel && sip && (status == 300 || status == 302 || status == 305) && switch_channel_test_flag(channel, CF_OUTBOUND)) { + if (channel && sip && (status == 300 || status == 301 || status == 302 || status == 305) && switch_channel_test_flag(channel, CF_OUTBOUND)) { sip_contact_t *p_contact = sip->sip_contact; int i = 0; char var_name[80]; @@ -4424,7 +4424,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, if (ss_state == nua_callstate_terminated) { - if ((status == 300 || status == 302 || status == 305) && session) { + if ((status == 300 || status == 301 || status == 302 || status == 305) && session) { channel = switch_core_session_get_channel(session); tech_pvt = switch_core_session_get_private(session); commit 426a448f503200dc11a0873163fc9643b9886317 Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Mon Sep 27 10:12:10 2010 -0400 mod_callcenter: Fix invalid update of agent field FS-2738 diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 5da8c1f..b58e647 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1498,7 +1498,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa /* Update Agents Items */ /* Do not remove uuid of the agent if we are a standby agent */ - sql = switch_mprintf("UPDATE agents SET %q last_bridge_end = %ld, talk_time = talk_time + (%ld-last_bridge_start) WHERE name = '%q' AND system = '%q';" + sql = switch_mprintf("UPDATE agents SET %s last_bridge_end = %ld, talk_time = talk_time + (%ld-last_bridge_start) WHERE name = '%q' AND system = '%q';" , (strcasecmp(h->agent_type, CC_AGENT_TYPE_UUID_STANDBY)?"uuid = '',":""), (long) switch_epoch_time_now(NULL), (long) switch_epoch_time_now(NULL), h->agent_name, h->agent_system); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); commit 6c1070ea505530c488708291a6dc334e4ea83b80 Author: Michael Jerris <mike@jerris.com> Date: Mon Sep 27 04:35:17 2010 -0400 FS-2009: fix coredump in rtcp socket handling diff --git a/src/switch_rtp.c b/src/switch_rtp.c index b5c98fc..4e734c3 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -2360,6 +2360,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ if ((other_session = switch_core_session_locate(uuid))) { switch_channel_t *other_channel = switch_core_session_get_channel(other_session); if ((other_rtp_session = switch_channel_get_private(other_channel, "__rtcp_audio_rtp_session")) && + other_rtp_session->rtcp_sock_output && switch_test_flag(other_rtp_session, SWITCH_RTP_FLAG_ENABLE_RTCP)) { *other_rtp_session->rtcp_send_msg.body = *rtp_session->rtcp_recv_msg.body; @@ -3440,7 +3441,8 @@ static int rtp_common_write(switch_rtp_t *rtp_session, rtp_session->last_write_ts = this_ts; - if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_ENABLE_RTCP) && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_RTCP_PASSTHRU) && + if (rtp_session->rtcp_sock_output && + switch_test_flag(rtp_session, SWITCH_RTP_FLAG_ENABLE_RTCP) && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_RTCP_PASSTHRU) && rtp_session->rtcp_interval && (rtp_session->stats.outbound.packet_count % rtp_session->rtcp_interval) == 0) { struct switch_rtcp_senderinfo* sr = (struct switch_rtcp_senderinfo*)rtp_session->rtcp_send_msg.body; commit 721c80198c61664e621c767ebfe05cbee4ac097f Author: Michael Jerris <mike@jerris.com> Date: Mon Sep 27 04:21:05 2010 -0400 FS-488: fix crash in sofia_reg_find_gateway_by_realm__ diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 3ffbc26..64176ee 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -2498,7 +2498,7 @@ sofia_gateway_t *sofia_reg_find_gateway_by_realm__(const char *file, const char switch_mutex_lock(mod_sofia_globals.hash_mutex); for (hi = switch_hash_first(NULL, mod_sofia_globals.gateway_hash); hi; hi = switch_hash_next(hi)) { switch_hash_this(hi, &var, NULL, &val); - if ((gateway = (sofia_gateway_t *) val) && gateway->register_realm && !strcasecmp(gateway->register_realm, key)) { + if (key && (gateway = (sofia_gateway_t *) val) && gateway->register_realm && !strcasecmp(gateway->register_realm, key)) { break; } else { gateway = NULL; commit dc06a03995e8ba20debc7f4e909062d0b06313c2 Author: Michael Jerris <mike@jerris.com> Date: Mon Sep 27 03:39:38 2010 -0400 FS-122: add mod_osp Makefile to configure generated Makefiles diff --git a/configure.in b/configure.in index f2aa0ba..de72612 100644 --- a/configure.in +++ b/configure.in @@ -904,6 +904,7 @@ AC_CONFIG_FILES([Makefile src/mod/applications/mod_expr/Makefile src/mod/applications/mod_fax/Makefile src/mod/applications/mod_spandsp/Makefile + src/mod/applications/mod_osp/Makefile src/mod/applications/mod_stress/Makefile src/mod/applications/mod_hash/Makefile src/mod/endpoints/mod_portaudio/Makefile commit 828960adf80c6e7b6ffff7361e505c09b69dbdc3 Author: Jeff Lenk <jeff@jefflenk.com> Date: Sat Sep 25 12:51:42 2010 -0500 tweak vs2010 openssl build diff --git a/libs/win32/openssl/libeay32.2010.vcxproj b/libs/win32/openssl/libeay32.2010.vcxproj index 1157e5c..4d0d9a4 100644 --- a/libs/win32/openssl/libeay32.2010.vcxproj +++ b/libs/win32/openssl/libeay32.2010.vcxproj @@ -74,6 +74,10 @@ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</LinkIncremental> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</LinkIncremental> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\libeay32\$(Configuration)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\libeay32\$(Configuration)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\libeay32\$(Configuration)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\libeay32\$(Configuration)\</IntDir> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PreBuildEvent> diff --git a/libs/win32/openssl/ssleay32.2010.vcxproj b/libs/win32/openssl/ssleay32.2010.vcxproj index 8d6c22d..1a444bb 100644 --- a/libs/win32/openssl/ssleay32.2010.vcxproj +++ b/libs/win32/openssl/ssleay32.2010.vcxproj @@ -73,6 +73,10 @@ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</LinkIncremental> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</LinkIncremental> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(PlatformName)\ssleay32\$(Configuration)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(PlatformName)\ssleay32\$(Configuration)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(PlatformName)\ssleay32\$(Configuration)\</IntDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(PlatformName)\ssleay32\$(Configuration)\</IntDir> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <PreBuildEvent> commit bc30415380cbcc2f7229ea0d35e6ccde830ee383 Author: Michael Jerris <mike@jerris.com> Date: Sat Sep 25 10:19:52 2010 -0400 FSRTP-19: Fix SWITCH_IO_FLAG_NOBLOCK needed for mod_sangoma_codec diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 969309e..b5c98fc 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -2308,6 +2308,10 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ pt = 20000; } + if ((io_flags & SWITCH_IO_FLAG_NOBLOCK)) { + pt = 0; + } + poll_status = switch_poll(rtp_session->read_pollfd, 1, &fdr, pt); if (rtp_session->dtmf_data.out_digit_dur > 0) { do_2833(rtp_session); @@ -2333,7 +2337,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ } } - if (rtp_session->dtmf_data.out_digit_dur == 0 || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO)) { + if ((!(io_flags & SWITCH_IO_FLAG_NOBLOCK)) && (rtp_session->dtmf_data.out_digit_dur == 0 || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO))) { return_cng_frame(); } } commit d018fa489aab152d797eb7e41a8038b2520d64e6 Author: Mathieu Parent <math.parent@gmail.com> Date: Fri Sep 24 19:41:52 2010 +0200 Skinny: send proper USER_TO_DEVICE_DATA_MESSAGE diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index fc7d872..2df8937 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -1939,9 +1939,13 @@ static void skinny_user_to_device_event_handler(switch_event_t *event) } switch(message_type) { case USER_TO_DEVICE_DATA_MESSAGE: + data_length = strlen(data); /* we ignore data_length sent */ + send_data(listener, message_type, + application_id, line_instance, call_id, transaction_id, data_length, + data); case USER_TO_DEVICE_DATA_VERSION1_MESSAGE: data_length = strlen(data); /* we ignore data_length sent */ - send_extended_data(listener, message_type, + send_extended_data(listener, message_type, application_id, line_instance, call_id, transaction_id, data_length, sequence_flag, display_priority, conference_id, app_instance_id, routing_id, data); diff --git a/src/mod/endpoints/mod_skinny/skinny_protocol.h b/src/mod/endpoints/mod_skinny/skinny_protocol.h index b741fa9..d85a190 100644 --- a/src/mod/endpoints/mod_skinny/skinny_protocol.h +++ b/src/mod/endpoints/mod_skinny/skinny_protocol.h @@ -839,6 +839,14 @@ switch_status_t send_display_pri_notify(listener_t *listener, switch_status_t send_reset(listener_t *listener, uint32_t reset_type); +switch_status_t send_data(listener_t *listener, uint32_t message_type, + uint32_t application_id, + uint32_t line_instance, + uint32_t call_id, + uint32_t transaction_id, + uint32_t data_length, + const char *data); + switch_status_t send_extended_data(listener_t *listener, uint32_t message_type, uint32_t application_id, uint32_t line_instance, commit b2fd42ef09901d84fffe9d7cba3af64b4a825605 Author: Mathieu Parent <math.parent@gmail.com> Date: Fri Sep 24 19:24:39 2010 +0200 Skinny: Windows build fix MS compiler doesn't have strncpy, we need another method to ensure that the body is null-terminated diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index 9456116..bd2d679 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -1880,7 +1880,10 @@ switch_status_t skinny_handle_data_message(listener_t *listener, skinny_message_ switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Call-Id", "%d", request->data.data.call_id); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Transaction-Id", "%d", request->data.data.transaction_id); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Data-Length", "%d", request->data.data.data_length); - tmp = strndup(request->data.data.data, request->data.data.data_length); + /* Ensure that the body is null-terminated */ + tmp = malloc(request->data.data.data_length + 1); + memcpy(tmp, request->data.data.data, request->data.data.data_length); + tmp[request->data.data.data_length] = '\0'; switch_event_add_body(event, tmp); switch_safe_free(tmp); switch_event_fire(&event); @@ -1949,7 +1952,10 @@ switch_status_t skinny_handle_extended_data_message(listener_t *listener, skinny switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Conference-Id", "%d", request->data.extended_data.conference_id); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-App-Instance-Id", "%d", request->data.extended_data.app_instance_id); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Routing-Id", "%d", request->data.extended_data.routing_id); - tmp = strndup(request->data.extended_data.data, request->data.extended_data.data_length); + /* Ensure that the body is null-terminated */ + tmp = malloc(request->data.data.data_length + 1); + memcpy(tmp, request->data.data.data, request->data.data.data_length); + tmp[request->data.data.data_length] = '\0'; switch_event_add_body(event, tmp); switch_safe_free(tmp); switch_event_fire(&event); commit 90861ea075e1467f084f77fcb7a696c14e459030 Author: Jeff Lenk <jeff@jefflenk.com> Date: Fri Sep 24 22:29:53 2010 -0500 reswig vs2010 diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx index 04a2f3f..b1a19f5 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx @@ -11791,6 +11791,20 @@ SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_char_to_rfc2833(char jarg1) { } +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_default_ptime(char * jarg1, unsigned long jarg2) { + unsigned long jresult ; + char *arg1 = (char *) 0 ; + uint32_t arg2 ; + uint32_t result; + + arg1 = (char *)jarg1; + arg2 = (uint32_t)jarg2; + result = (uint32_t)switch_default_ptime((char const *)arg1,arg2); + jresult = (unsigned long)result; + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_switch_sanitize_number(char * jarg1) { char * jresult ; char *arg1 = (char *) 0 ; @@ -12397,6 +12411,44 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_network_list_validate_ip_token(void * j } +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_dow_int2str(int jarg1) { + char * jresult ; + int arg1 ; + char *result = 0 ; + + arg1 = (int)jarg1; + result = (char *)switch_dow_int2str(arg1); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_dow_str2int(char * jarg1) { + int jresult ; + char *arg1 = (char *) 0 ; + int result; + + arg1 = (char *)jarg1; + result = (int)switch_dow_str2int((char const *)arg1); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_dow_cmp(char * jarg1, int jarg2) { + int jresult ; + char *arg1 = (char *) 0 ; + int arg2 ; + int result; + + arg1 = (char *)jarg1; + arg2 = (int)jarg2; + result = (int)switch_dow_cmp((char const *)arg1,arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_number_cmp(char * jarg1, int jarg2) { int jresult ; char *arg1 = (char *) 0 ; @@ -12411,6 +12463,62 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_number_cmp(char * jarg1, int jarg2) { } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_tod_cmp(char * jarg1, int jarg2) { + int jresult ; + char *arg1 = (char *) 0 ; + int arg2 ; + int result; + + arg1 = (char *)jarg1; + arg2 = (int)jarg2; + result = (int)switch_tod_cmp((char const *)arg1,arg2); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_fulldate_cmp(char * jarg1, void * jarg2) { + int jresult ; + char *arg1 = (char *) 0 ; + switch_time_t *arg2 = (switch_time_t *) 0 ; + int result; + + arg1 = (char *)jarg1; + arg2 = (switch_time_t *)jarg2; + result = (int)switch_fulldate_cmp((char const *)arg1,arg2); + jresult = result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_split_date(char * jarg1, void * jarg2, void * jarg3, void * jarg4) { + char *arg1 = (char *) 0 ; + int *arg2 = (int *) 0 ; + int *arg3 = (int *) 0 ; + int *arg4 = (int *) 0 ; + + arg1 = (char *)jarg1; + arg2 = (int *)jarg2; + arg3 = (int *)jarg3; + arg4 = (int *)jarg4; + switch_split_date((char const *)arg1,arg2,arg3,arg4); +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_split_time(char * jarg1, void * jarg2, void * jarg3, void * jarg4) { + char *arg1 = (char *) 0 ; + int *arg2 = (int *) 0 ; + int *arg3 = (int *) 0 ; + int *arg4 = (int *) 0 ; + + arg1 = (char *)jarg1; + arg2 = (int *)jarg2; + arg3 = (int *)jarg3; + arg4 = (int *)jarg4; + switch_split_time((char const *)arg1,arg2,arg3,arg4); +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_split_user_domain(char * jarg1, void * jarg2, void * jarg3) { int jresult ; char *arg1 = (char *) 0 ; @@ -26020,7 +26128,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_record_file(void * jarg1, void * ja } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_play_and_get_digits(void * jarg1, unsigned long jarg2, unsigned long jarg3, unsigned long jarg4, unsigned long jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10, unsigned long jarg11, char * jarg12) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_play_and_get_digits(void * jarg1, unsigned long jarg2, unsigned long jarg3, unsigned long jarg4, unsigned long jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10, unsigned long jarg11, char * jarg12, unsigned long jarg13) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; uint32_t arg2 ; @@ -26034,6 +26142,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_play_and_get_digits(void * jarg1, unsig char *arg10 = (char *) 0 ; uint32_t arg11 ; char *arg12 = (char *) 0 ; + uint32_t arg13 ; switch_status_t result; arg1 = (switch_core_session_t *)jarg1; @@ -26048,7 +26157,8 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_play_and_get_digits(void * jarg1, unsig arg10 = (char *)jarg10; arg11 = (uint32_t)jarg11; arg12 = (char *)jarg12; - result = (switch_status_t)switch_play_and_get_digits(arg1,arg2,arg3,arg4,arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,arg10,arg11,(char const *)arg12); + arg13 = (uint32_t)jarg13; + result = (switch_status_t)switch_play_and_get_digits(arg1,arg2,arg3,arg4,arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,arg10,arg11,(char const *)arg12,arg13); jresult = result; return jresult; } @@ -26822,7 +26932,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_wait_for_answer(void * jarg1, void } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_read(void * jarg1, unsigned long jarg2, unsigned long jarg3, char * jarg4, char * jarg5, char * jarg6, void * jarg7, unsigned long jarg8, char * jarg9) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_read(void * jarg1, unsigned long jarg2, unsigned long jarg3, char * jarg4, char * jarg5, char * jarg6, void * jarg7, unsigned long jarg8, char * jarg9, unsigned long jarg10) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; uint32_t arg2 ; @@ -26833,6 +26943,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_read(void * jarg1, unsigned long ja switch_size_t arg7 ; uint32_t arg8 ; char *arg9 = (char *) 0 ; + uint32_t arg10 ; switch_size_t *argp7 ; switch_status_t result; @@ -26850,7 +26961,8 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_read(void * jarg1, unsigned long ja arg7 = *argp7; arg8 = (uint32_t)jarg8; arg9 = (char *)jarg9; - result = (switch_status_t)switch_ivr_read(arg1,arg2,arg3,(char const *)arg4,(char const *)arg5,arg6,arg7,arg8,(char const *)arg9); + arg10 = (uint32_t)jarg10; + result = (switch_status_t)switch_ivr_read(arg1,arg2,arg3,(char const *)arg4,(char const *)arg5,arg6,arg7,arg8,(char const *)arg9,arg10); jresult = result; return jresult; } @@ -29133,6 +29245,18 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_init(void * jarg1, void * jarg2) { } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_reload(void * jarg1) { + int jresult ; + char **arg1 = (char **) 0 ; + switch_status_t result; + + arg1 = (char **)jarg1; + result = (switch_status_t)switch_xml_reload((char const **)arg1); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_destroy() { int jresult ; switch_status_t result; @@ -32717,7 +32841,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_Transfer(void * jarg1, char * jarg } -SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_read(void * jarg1, int jarg2, int jarg3, char * jarg4, int jarg5, char * jarg6) { +SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_read(void * jarg1, int jarg2, int jarg3, char * jarg4, int jarg5, char * jarg6, int jarg7) { char * jresult ; CoreSession *arg1 = (CoreSession *) 0 ; int arg2 ; @@ -32725,6 +32849,7 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_read(void * jarg1, int jarg2, i char *arg4 = (char *) 0 ; int arg5 ; char *arg6 = (char *) 0 ; + int arg7 = (int) 0 ; char *result = 0 ; arg1 = (CoreSession *)jarg1; @@ -32733,13 +32858,14 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_read(void * jarg1, int jarg2, i arg4 = (char *)jarg4; arg5 = (int)jarg5; arg6 = (char *)jarg6; - result = (char *)(arg1)->read(arg2,arg3,(char const *)arg4,arg5,(char const *)arg6); + arg7 = (int)jarg7; + result = (char *)(arg1)->read(arg2,arg3,(char const *)arg4,arg5,(char const *)arg6,arg7); jresult = SWIG_csharp_string_callback((const char *)result); return jresult; } -SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_PlayAndGetDigits(void * jarg1, int jarg2, int jarg3, int jarg4, int jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10) { +SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_PlayAndGetDigits(void * jarg1, int jarg2, int jarg3, int jarg4, int jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10, int jarg11) { char * jresult ; CoreSession *arg1 = (CoreSession *) 0 ; int arg2 ; @@ -32751,6 +32877,7 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_PlayAndGetDigits(void * jarg1, char *arg8 = (char *) 0 ; char *arg9 = (char *) 0 ; char *arg10 = (char *) NULL ; + int arg11 = (int) 0 ; char *result = 0 ; arg1 = (CoreSession *)jarg1; @@ -32763,7 +32890,8 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_PlayAndGetDigits(void * jarg1, arg8 = (char *)jarg8; arg9 = (char *)jarg9; arg10 = (char *)jarg10; - result = (char *)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,(char const *)arg10); + arg11 = (int)jarg11; + result = (char *)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,(char const *)arg10,arg11); jresult = SWIG_csharp_string_callback((const char *)result); return jresult; } diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs index 8bf2c6c..29fa0d9 100644 --- a/src/mod/languages/mod_managed/managed/swig.2010.cs +++ b/src/mod/languages/mod_managed/managed/swig.2010.cs @@ -327,13 +327,13 @@ public class CoreSession : IDisposable { return ret; } - public string read(int min_digits, int max_digits, string prompt_audio_file, int timeout, string valid_terminators) { - string ret = freeswitchPINVOKE.CoreSession_read(swigCPtr, min_digits, max_digits, prompt_audio_file, timeout, valid_terminators); + public string read(int min_digits, int max_digits, string prompt_audio_file, int timeout, string valid_terminators, int digit_timeout) { + string ret = freeswitchPINVOKE.CoreSession_read(swigCPtr, min_digits, max_digits, prompt_audio_file, timeout, valid_terminators, digit_timeout); return ret; } - public string PlayAndGetDigits(int min_digits, int max_digits, int max_tries, int timeout, string terminators, string audio_files, string bad_input_audio_files, string digits_regex, string var_name) { - string ret = freeswitchPINVOKE.CoreSession_PlayAndGetDigits(swigCPtr, min_digits, max_digits, max_tries, timeout, terminators, audio_files, bad_input_audio_files, digits_regex, var_name); + public string PlayAndGetDigits(int min_digits, int max_digits, int max_tries, int timeout, string terminators, string audio_files, string bad_input_audio_files, string digits_regex, string var_name, int digit_timeout) { + string ret = freeswitchPINVOKE.CoreSession_PlayAndGetDigits(swigCPtr, min_digits, max_digits, max_tries, timeout, terminators, audio_files, bad_input_audio_files, digits_regex, var_name, digit_timeout); return ret; } @@ -2725,6 +2725,11 @@ public class freeswitch { return ret; } + public static uint switch_default_ptime(string name, uint number) { + uint ret = freeswitchPINVOKE.switch_default_ptime(name, number); + return ret; + } + public static string switch_sanitize_number(string number) { string ret = freeswitchPINVOKE.switch_sanitize_number(number); return ret; @@ -2928,11 +2933,44 @@ public class freeswitch { return ret; } + public static string switch_dow_int2str(int val) { + string ret = freeswitchPINVOKE.switch_dow_int2str(val); + return ret; + } + + public static int switch_dow_str2int(string exp) { + int ret = freeswitchPINVOKE.switch_dow_str2int(exp); + return ret; + } + + public static int switch_dow_cmp(string exp, int val) { + int ret = freeswitchPINVOKE.switch_dow_cmp(exp, val); + return ret; + } + public static int switch_number_cmp(string exp, int val) { int ret = freeswitchPINVOKE.switch_number_cmp(exp, val); return ret; } + public static int switch_tod_cmp(string exp, int val) { + int ret = freeswitchPINVOKE.switch_tod_cmp(exp, val); + return ret; + } + + public static int switch_fulldate_cmp(string exp, SWIGTYPE_p_switch_time_t ts) { + int ret = freeswitchPINVOKE.switch_fulldate_cmp(exp, SWIGTYPE_p_switch_time_t.getCPtr(ts)); + return ret; + } + + public static void switch_split_date(string exp, SWIGTYPE_p_int year, SWIGTYPE_p_int month, SWIGTYPE_p_int day) { + freeswitchPINVOKE.switch_split_date(exp, SWIGTYPE_p_int.getCPtr(year), SWIGTYPE_p_int.getCPtr(month), SWIGTYPE_p_int.getCPtr(day)); + } + + public static void switch_split_time(string exp, SWIGTYPE_p_int hour, SWIGTYPE_p_int min, SWIGTYPE_p_int sec) { + freeswitchPINVOKE.switch_split_time(exp, SWIGTYPE_p_int.getCPtr(hour), SWIGTYPE_p_int.getCPtr(min), SWIGTYPE_p_int.getCPtr(sec)); + } + public static int switch_split_user_domain(string arg0, ref string user, ref string domain) { int ret = freeswitchPINVOKE.switch_split_user_domain(arg0, ref user, ref domain); return ret; @@ -3986,8 +4024,8 @@ public class freeswitch { return ret; } - public static switch_status_t switch_play_and_get_digits(SWIGTYPE_p_switch_core_session session, uint min_digits, uint max_digits, uint max_tries, uint timeout, string valid_terminators, string audio_file, string bad_input_audio_file, string var_name, string digit_buffer, uint digit_buffer_length, string digits_regex) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_play_and_get_digits(SWIGTYPE_p_switch_core_session.getCPtr(session), min_digits, max_digits, max_tries, timeout, valid_terminators, audio_file, bad_input_audio_file, var_name, digit_buffer, digit_buffer_length, digits_regex); + public static switch_status_t switch_play_and_get_digits(SWIGTYPE_p_switch_core_session session, uint min_digits, uint max_digits, uint max_tries, uint timeout, string valid_terminators, string audio_file, string bad_input_audio_file, string var_name, string digit_buffer, uint digit_buffer_length, string digits_regex, uint digit_timeout) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_play_and_get_digits(SWIGTYPE_p_switch_core_session.getCPtr(session), min_digits, max_digits, max_tries, timeout, valid_terminators, audio_file, bad_input_audio_file, var_name, digit_buffer, digit_buffer_length, digits_regex, digit_timeout); return ret; } @@ -4216,8 +4254,8 @@ public class freeswitch { return ret; } - public static switch_status_t switch_ivr_read(SWIGTYPE_p_switch_core_session session, uint min_digits, uint max_digits, string prompt_audio_file, string var_name, string digit_buffer, SWIGTYPE_p_switch_size_t digit_buffer_length, uint timeout, string valid_terminators) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_read(SWIGTYPE_p_switch_core_session.getCPtr(session), min_digits, max_digits, prompt_audio_file, var_name, digit_buffer, SWIGTYPE_p_switch_size_t.getCPtr(digit_buffer_length), timeout, valid_terminators); + public static switch_status_t switch_ivr_read(SWIGTYPE_p_switch_core_session session, uint min_digits, uint max_digits, string prompt_audio_file, string var_name, string digit_buffer, SWIGTYPE_p_switch_size_t digit_buffer_length, uint timeout, string valid_terminators, uint digit_timeout) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_read(SWIGTYPE_p_switch_core_session.getCPtr(session), min_digits, max_digits, prompt_audio_file, var_name, digit_buffer, SWIGTYPE_p_switch_size_t.getCPtr(digit_buffer_length), timeout, valid_terminators, digit_timeout); if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -4762,6 +4800,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_xml_reload(ref string err) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_reload(ref err); + return ret; + } + public static switch_status_t switch_xml_destroy() { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_destroy(); return ret; @@ -8264,6 +8307,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_char_to_rfc2833")] public static extern byte switch_char_to_rfc2833(char jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_default_ptime")] + public static extern uint switch_default_ptime(string jarg1, uint jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_sanitize_number")] public static extern string switch_sanitize_number(string jarg1); @@ -8384,9 +8430,30 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_network_list_validate_ip_token")] public static extern int switch_network_list_validate_ip_token(HandleRef jarg1, uint jarg2, ref string jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_dow_int2str")] + public static extern string switch_dow_int2str(int jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_dow_str2int")] + public static extern int switch_dow_str2int(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_dow_cmp")] + public static extern int switch_dow_cmp(string jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_number_cmp")] public static extern int switch_number_cmp(string jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_tod_cmp")] + public static extern int switch_tod_cmp(string jarg1, int jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_fulldate_cmp")] + public static extern int switch_fulldate_cmp(string jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_split_date")] + public static extern void switch_split_date(string jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_split_time")] + public static extern void switch_split_time(string jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4); + [DllImport("mod_managed", EntryPoint="CSharp_switch_split_user_domain")] public static extern int switch_split_user_domain(string jarg1, ref string jarg2, ref string jarg3); @@ -11748,7 +11815,7 @@ class freeswitchPINVOKE { public static extern int switch_ivr_record_file(HandleRef jarg1, HandleRef jarg2, string jarg3, HandleRef jarg4, uint jarg5); [DllImport("mod_managed", EntryPoint="CSharp_switch_play_and_get_digits")] - public static extern int switch_play_and_get_digits(HandleRef jarg1, uint jarg2, uint jarg3, uint jarg4, uint jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, uint jarg11, string jarg12); + public static extern int switch_play_and_get_digits(HandleRef jarg1, uint jarg2, uint jarg3, uint jarg4, uint jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, uint jarg11, string jarg12, uint jarg13); [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_speak_text_handle")] public static extern int switch_ivr_speak_text_handle(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, string jarg5, HandleRef jarg6); @@ -11886,7 +11953,7 @@ class freeswitchPINVOKE { public static extern int switch_ivr_wait_for_answer(HandleRef jarg1, HandleRef jarg2); [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_read")] - public static extern int switch_ivr_read(HandleRef jarg1, uint jarg2, uint jarg3, string jarg4, string jarg5, string jarg6, HandleRef jarg7, uint jarg8, string jarg9); + public static extern int switch_ivr_read(HandleRef jarg1, uint jarg2, uint jarg3, string jarg4, string jarg5, string jarg6, HandleRef jarg7, uint jarg8, string jarg9, uint jarg10); [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_block_dtmf_session")] public static extern int switch_ivr_block_dtmf_session(HandleRef jarg1); @@ -12404,6 +12471,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_init")] public static extern int switch_xml_init(HandleRef jarg1, ref string jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_reload")] + public static extern int switch_xml_reload(ref string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_destroy")] public static extern int switch_xml_destroy(); @@ -13290,10 +13360,10 @@ class freeswitchPINVOKE { public static extern int CoreSession_Transfer(HandleRef jarg1, string jarg2, string jarg3, string jarg4); [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_read")] - public static extern string CoreSession_read(HandleRef jarg1, int jarg2, int jarg3, string jarg4, int jarg5, string jarg6); + public static extern string CoreSession_read(HandleRef jarg1, int jarg2, int jarg3, string jarg4, int jarg5, string jarg6, int jarg7); [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_PlayAndGetDigits")] - public static extern string CoreSession_PlayAndGetDigits(HandleRef jarg1, int jarg2, int jarg3, int jarg4, int jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10); + public static extern string CoreSession_PlayAndGetDigits(HandleRef jarg1, int jarg2, int jarg3, int jarg4, int jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, int jarg11); [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_StreamFile")] public static extern int CoreSession_StreamFile(HandleRef jarg1, string jarg2, int jarg3); commit c928a99e07497a80af9ec295cfb2d0ca9852b354 Author: Moises Silva <moy@sangoma.com> Date: Fri Sep 24 18:29:22 2010 -0400 freetdm: fix windows compilation diff --git a/libs/freetdm/src/ftdm_sched.c b/libs/freetdm/src/ftdm_sched.c index be21696..e7aa1d2 100644 --- a/libs/freetdm/src/ftdm_sched.c +++ b/libs/freetdm/src/ftdm_sched.c @@ -370,7 +370,7 @@ done: UNREFERENCED_PARAMETER(ms); UNREFERENCED_PARAMETER(callback); UNREFERENCED_PARAMETER(data); - UNREFERENCED_PARAMETER(timer); + UNREFERENCED_PARAMETER(timerid); #endif return status; } commit f1ecda66b6c61451a53ceb935852b80231168697 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Sep 24 16:40:21 2010 -0500 revert diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index d36de4a..c851779 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -4195,12 +4195,12 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status } if (status == 200 && sofia_test_flag(tech_pvt, TFLAG_T38_PASSTHRU) && has_t38) { - switch_core_session_receive_message(other_session, msg); if (switch_rtp_ready(tech_pvt->rtp_session) && switch_rtp_ready(other_tech_pvt->rtp_session)) { switch_rtp_udptl_mode(tech_pvt->rtp_session); switch_rtp_udptl_mode(other_tech_pvt->rtp_session); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Activating T38 Passthru\n"); } + switch_core_session_receive_message(other_session, msg); } else { switch_core_session_queue_message(other_session, msg); } commit dd529b0e3abcd72cea921068377f2abfd7b28d5e Author: Moises Silva <moy@sangoma.com> Date: Fri Sep 24 17:34:40 2010 -0400 freetdm: remove ftdm_cpu_monitor_disable API (dup) diff --git a/libs/freetdm/sample/boost/ftdmstart.c b/libs/freetdm/sample/boost/ftdmstart.c index 972ed43..bff0664 100644 --- a/libs/freetdm/sample/boost/ftdmstart.c +++ b/libs/freetdm/sample/boost/ftdmstart.c @@ -313,13 +313,6 @@ int main(int argc, char *argv[]) /* set the logging level to use */ ftdm_global_set_default_logger(FTDM_LOG_LEVEL_DEBUG); - /* this is optional. - * cpu monitor is a default feature in freetdm that launches 1 thread - * to monitor system-wide CPU usage. If it goes above a predefined threshold - * it will stop accepting calls to try to protect the quality of current calls */ - ftdm_cpu_monitor_disable(); - - /* Initialize the FTDM library */ if (ftdm_global_init() != FTDM_SUCCESS) { fprintf(stderr, "Error loading FreeTDM\n"); diff --git a/libs/freetdm/sample/dso/ftdmload.c b/libs/freetdm/sample/dso/ftdmload.c index 5b150d6..80bcc02 100644 --- a/libs/freetdm/sample/dso/ftdmload.c +++ b/libs/freetdm/sample/dso/ftdmload.c @@ -134,8 +134,6 @@ int main(int argc, char *argv[]) ftdm_global_set_default_logger(FTDM_LOG_LEVEL_DEBUG); - ftdm_cpu_monitor_disable(); - if (ftdm_global_init() != FTDM_SUCCESS) { fprintf(stderr, "Error loading FreeTDM\n"); exit(-1); diff --git a/libs/freetdm/sample/sched/ftdmsched.c b/libs/freetdm/sample/sched/ftdmsched.c index 5cd7d63..e6e391e 100644 --- a/libs/freetdm/sample/sched/ftdmsched.c +++ b/libs/freetdm/sample/sched/ftdmsched.c @@ -73,8 +73,6 @@ int main(int argc, char *argv[]) ftdm_global_set_default_logger(FTDM_LOG_LEVEL_DEBUG); - ftdm_cpu_monitor_disable(); - if (ftdm_global_init() != FTDM_SUCCESS) { fprintf(stderr, "Error loading FreeTDM\n"); exit(-1); diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 078875b..a418152 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -1177,16 +1177,6 @@ FT_DECLARE(ftdm_iterator_t *) ftdm_span_get_chan_iterator(const ftdm_span_t *spa FT_DECLARE(char *) ftdm_api_execute(const char *cmd); /*! - * \brief Disables CPU monitoring - * - * \note CPU monitoring is enabled by default. This means a thread will be launched at startup (ftdm_global_init) - * with the sole purpose of monitoring system-wide CPU usage. If the CPU usage raises above a defined - * threshold, no new calls will be accepted (neither incoming or outgoing) - * - */ -FT_DECLARE(void) ftdm_cpu_monitor_disable(void); - -/*! * \brief Create a configuration node * * \param name The name of the configuration node commit 75e22758d49460ce35863ca716e9dc1b43eaae93 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Sep 24 16:03:22 2010 -0500 MODAPP-461 diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index c851779..d36de4a 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -4195,12 +4195,12 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status } if (status == 200 && sofia_test_flag(tech_pvt, TFLAG_T38_PASSTHRU) && has_t38) { + switch_core_session_receive_message(other_session, msg); if (switch_rtp_ready(tech_pvt->rtp_session) && switch_rtp_ready(other_tech_pvt->rtp_session)) { switch_rtp_udptl_mode(tech_pvt->rtp_session); switch_rtp_udptl_mode(other_tech_pvt->rtp_session); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Activating T38 Passthru\n"); } - switch_core_session_receive_message(other_session, msg); } else { switch_core_session_queue_message(other_session, msg); } commit e7b9790733aeed1324e029eff73df99dac46eb89 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Sep 24 16:01:05 2010 -0500 BOUNTY-23 diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 0b1d698..860f897 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -1422,6 +1422,7 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t char cid_buf[1024] = ""; if (switch_channel_ready(channel)) { + const char *vm_announce_cid = NULL; switch_snprintf(cid_buf, sizeof(cid_buf), "%s|%s", cbt->cid_number, cbt->cid_name); @@ -1429,7 +1430,13 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t msg.string_arg = cid_buf; msg.message_id = SWITCH_MESSAGE_INDICATE_DISPLAY; switch_core_session_receive_message(session, &msg); - + + if (!zstr(cbt->cid_number) && (vm_announce_cid = switch_channel_get_variable(channel, "vm_announce_cid"))) { + switch_ivr_play_file(session, NULL, vm_announce_cid, NULL); + switch_ivr_sleep(session, 500, SWITCH_TRUE, NULL); + switch_ivr_say(session, cbt->cid_number, NULL, "name_spelled", "pronounced", NULL, NULL); + } + args.input_callback = cancel_on_dtmf; switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s:%s:%s%s%s", profile->listen_file_key, profile->save_file_key, diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 246b18e..7e7e8cd 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -2261,6 +2261,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, goto done; } + if (!module_name) { + module_name = chan_lang; + } + if (!(sound_path = (char *) switch_xml_attr(language, "sound-path"))) { sound_path = (char *) switch_xml_attr(language, "sound_path"); } commit ed708bff3ebd1fd22906f447cc50ab225523376f Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Sep 24 15:14:49 2010 -0500 update diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 86aa54d..5892ef5 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1928,10 +1928,22 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) switch_channel_set_variable(channel, "sip_req_uri", s); } - tech_pvt->nh = nua_handle(tech_pvt->profile->nua, NULL, - NUTAG_URL(url_str), - TAG_IF(call_id, SIPTAG_CALL_ID_STR(call_id)), - SIPTAG_TO_STR(to_str), SIPTAG_FROM_STR(from_str), SIPTAG_CONTACT_STR(invite_contact), TAG_END()); + if (!(tech_pvt->nh = nua_handle(tech_pvt->profile->nua, NULL, + NUTAG_URL(url_str), + TAG_IF(call_id, SIPTAG_CALL_ID_STR(call_id)), + SIPTAG_TO_STR(to_str), SIPTAG_FROM_STR(from_str), SIPTAG_CONTACT_STR(invite_contact), TAG_END()))) { + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, + "Error creating HANDLE!\nurl_str=[%s]\ncall_id=[%s]\nto_str=[%s]\nfrom_str=[%s]\ninvite_contact=[%s]\n", + url_str, + call_id ? call_id : "N/A", + to_str, + from_str, + invite_contact); + + switch_safe_free(d_url); + return SWITCH_STATUS_FALSE; + } if (tech_pvt->dest && (strstr(tech_pvt->dest, ";fs_nat") || strstr(tech_pvt->dest, ";received") || ((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val)))) { commit 5db55ae49081ba63054416149c925500c560f89e Author: Moises Silva <moy@sangoma.com> Date: Fri Sep 24 15:20:28 2010 -0400 freetdm: remove ftdm_cpu_monitor_disable API diff --git a/libs/freetdm/sample/boost/ftdmstart.c b/libs/freetdm/sample/boost/ftdmstart.c index 972ed43..bff0664 100644 --- a/libs/freetdm/sample/boost/ftdmstart.c +++ b/libs/freetdm/sample/boost/ftdmstart.c @@ -313,13 +313,6 @@ int main(int argc, char *argv[]) /* set the logging level to use */ ftdm_global_set_default_logger(FTDM_LOG_LEVEL_DEBUG); - /* this is optional. - * cpu monitor is a default feature in freetdm that launches 1 thread - * to monitor system-wide CPU usage. If it goes above a predefined threshold - * it will stop accepting calls to try to protect the quality of current calls */ - ftdm_cpu_monitor_disable(); - - /* Initialize the FTDM library */ if (ftdm_global_init() != FTDM_SUCCESS) { fprintf(stderr, "Error loading FreeTDM\n"); diff --git a/libs/freetdm/sample/dso/ftdmload.c b/libs/freetdm/sample/dso/ftdmload.c index 5b150d6..80bcc02 100644 --- a/libs/freetdm/sample/dso/ftdmload.c +++ b/libs/freetdm/sample/dso/ftdmload.c @@ -134,8 +134,6 @@ int main(int argc, char *argv[]) ftdm_global_set_default_logger(FTDM_LOG_LEVEL_DEBUG); - ftdm_cpu_monitor_disable(); - if (ftdm_global_init() != FTDM_SUCCESS) { fprintf(stderr, "Error loading FreeTDM\n"); exit(-1); diff --git a/libs/freetdm/sample/sched/ftdmsched.c b/libs/freetdm/sample/sched/ftdmsched.c index 5cd7d63..e6e391e 100644 --- a/libs/freetdm/sample/sched/ftdmsched.c +++ b/libs/freetdm/sample/sched/ftdmsched.c @@ -73,8 +73,6 @@ int main(int argc, char *argv[]) ftdm_global_set_default_logger(FTDM_LOG_LEVEL_DEBUG); - ftdm_cpu_monitor_disable(); - if (ftdm_global_init() != FTDM_SUCCESS) { fprintf(stderr, "Error loading FreeTDM\n"); exit(-1); diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 078875b..a418152 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -1177,16 +1177,6 @@ FT_DECLARE(ftdm_iterator_t *) ftdm_span_get_chan_iterator(const ftdm_span_t *spa FT_DECLARE(char *) ftdm_api_execute(const char *cmd); /*! - * \brief Disables CPU monitoring - * - * \note CPU monitoring is enabled by default. This means a thread will be launched at startup (ftdm_global_init) - * with the sole purpose of monitoring system-wide CPU usage. If the CPU usage raises above a defined - * threshold, no new calls will be accepted (neither incoming or outgoing) - * - */ -FT_DECLARE(void) ftdm_cpu_monitor_disable(void); - -/*! * \brief Create a configuration node * * \param name The name of the configuration node commit abb8f08bbbf7d22a96f876a3ca7029fa1c63a93a Author: Konrad Hammel <konrad@sangoma.com> Date: Thu Sep 23 11:04:10 2010 -0400 freetdm: ss7 - bug fixes diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c index 21ab1d3..21feb4f 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c @@ -85,35 +85,35 @@ int ft_to_sngss7_cfg_all(void) if (ftmod_ss7_mtp1_gen_config()) { SS7_CRITICAL("MTP1 General configuration FAILED!\n"); - SS7_ASSERT + return 1; } else { SS7_INFO("MTP1 General configuration DONE\n"); } if (ftmod_ss7_mtp2_gen_config()) { SS7_CRITICAL("MTP2 General configuration FAILED!\n"); - SS7_ASSERT + return 1; } else { SS7_INFO("MTP2 General configuration DONE\n"); } if (ftmod_ss7_mtp3_gen_config()) { SS7_CRITICAL("MTP3 General configuration FAILED!\n"); - SS7_ASSERT + return 1; } else { SS7_INFO("MTP3 General configuration DONE\n"); } if (ftmod_ss7_isup_gen_config()) { SS7_CRITICAL("ISUP General configuration FAILED!\n"); - SS7_ASSERT + return 1; } else { SS7_INFO("ISUP General configuration DONE\n"); } if (ftmod_ss7_cc_gen_config()) { SS7_CRITICAL("CC General configuration FAILED!\n"); - SS7_ASSERT + return 1; } else { SS7_INFO("CC General configuration DONE\n"); } @@ -131,7 +131,7 @@ int ft_to_sngss7_cfg_all(void) /* configure mtp1 */ if (ftmod_ss7_mtp1_psap_config(x)) { SS7_CRITICAL("MTP1 PSAP %d configuration FAILED!\n", x); - SS7_ASSERT; + return 1;; } else { SS7_INFO("MTP1 PSAP %d configuration DONE!\n", x); } @@ -139,7 +139,7 @@ int ft_to_sngss7_cfg_all(void) /* configure mtp2 */ if (ftmod_ss7_mtp2_dlsap_config(x)) { SS7_CRITICAL("MTP2 DLSAP %d configuration FAILED!\n",x); - SS7_ASSERT; + return 1;; } else { SS7_INFO("MTP2 DLSAP %d configuration DONE!\n", x); } @@ -147,7 +147,7 @@ int ft_to_sngss7_cfg_all(void) /* configure mtp3 */ if (ftmod_ss7_mtp3_dlsap_config(x)) { SS7_CRITICAL("MTP3 DLSAP %d configuration FAILED!\n", x); - SS7_ASSERT; + return 1;; } else { SS7_INFO("MTP3 DLSAP %d configuration DONE!\n", x); } @@ -166,14 +166,14 @@ int ft_to_sngss7_cfg_all(void) if (ftmod_ss7_mtp3_nsap_config(x)) { SS7_CRITICAL("MTP3 NSAP %d configuration FAILED!\n", x); - SS7_ASSERT + return 1; } else { SS7_INFO("MTP3 NSAP %d configuration DONE!\n", x); } if (ftmod_ss7_isup_nsap_config(x)) { SS7_CRITICAL("ISUP NSAP %d configuration FAILED!\n", x); - SS7_ASSERT + return 1; } else { SS7_INFO("ISUP NSAP %d configuration DONE!\n", x); } @@ -192,7 +192,7 @@ int ft_to_sngss7_cfg_all(void) if (ftmod_ss7_mtp3_linkset_config(x)) { SS7_CRITICAL("MTP3 LINKSET %d configuration FAILED!\n", x); - SS7_ASSERT + return 1; } else { SS7_INFO("MTP3 LINKSET %d configuration DONE!\n", x); } @@ -211,7 +211,7 @@ int ft_to_sngss7_cfg_all(void) if (ftmod_ss7_mtp3_route_config(x)) { SS7_CRITICAL("MTP3 ROUTE %d configuration FAILED!\n", x); - SS7_ASSERT + return 1; } else { SS7_INFO("MTP3 ROUTE %d configuration DONE!\n",x); } @@ -227,7 +227,7 @@ int ft_to_sngss7_cfg_all(void) if (ftmod_ss7_mtp3_route_config(0)) { SS7_CRITICAL("MTP3 ROUTE 0 configuration FAILED!\n"); - SS7_ASSERT + return 1; } else { SS7_INFO("MTP3 ROUTE 0 configuration DONE!\n"); } @@ -244,14 +244,14 @@ int ft_to_sngss7_cfg_all(void) if (ftmod_ss7_isup_isap_config(x)) { SS7_CRITICAL("ISUP ISAP %d configuration FAILED!\n", x); - SS7_ASSERT + return 1; } else { SS7_INFO("ISUP ISAP %d configuration DONE!\n", x); } if (ftmod_ss7_cc_isap_config(x)) { SS7_CRITICAL("CC ISAP %d configuration FAILED!\n", x); - SS7_ASSERT + return 1; } else { SS7_INFO("CC ISAP %d configuration DONE!\n", x); } @@ -270,9 +270,11 @@ int ft_to_sngss7_cfg_all(void) if (ftmod_ss7_isup_intf_config(x)) { SS7_CRITICAL("ISUP INTF %d configuration FAILED!\n", x); - SS7_ASSERT + return 1; } else { SS7_INFO("ISUP INTF %d configuration DONE!\n", x); + /* set the interface to paused */ + sngss7_set_flag(&g_ftdm_sngss7_data.cfg.isupIntf[x], SNGSS7_PAUSED); } /* set the CONFIGURED flag */ @@ -289,7 +291,7 @@ int ft_to_sngss7_cfg_all(void) if ( g_ftdm_sngss7_data.cfg.isupCkt[x].type == 0) { if (ftmod_ss7_isup_ckt_config(x)) { SS7_CRITICAL("ISUP CKT %d configuration FAILED!\n", x); - SS7_ASSERT + return 1; } else { SS7_INFO("ISUP CKT %d configuration DONE!\n", x); } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c index cf56f51..6ccc693 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c @@ -1156,7 +1156,12 @@ static ftdm_status_t handle_tx_blo(ftdm_stream_handle_t *stream, int span, int c /* check if there is a pending state change|give it a bit to clear */ if (check_for_state_change(ftdmchan)) { SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", ss7_info->circuit->cic); + /* check if we need to die */ SS7_ASSERT; + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); + /* move to the next channel */ + continue; } else { /* throw the ckt block flag */ sngss7_set_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX); @@ -1217,7 +1222,12 @@ static ftdm_status_t handle_tx_ubl(ftdm_stream_handle_t *stream, int span, int c /* check if there is a pending state change|give it a bit to clear */ if (check_for_state_change(ftdmchan)) { SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", ss7_info->circuit->cic); + /* check if we need to die */ SS7_ASSERT; + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); + /* move to the next channel */ + continue; } else { /* throw the ckt block flag */ sngss7_set_flag(ss7_info, FLAG_CKT_MN_UNBLK_TX); @@ -1466,7 +1476,12 @@ static ftdm_status_t handle_tx_grs(ftdm_stream_handle_t *stream, int span, int c /* check if there is a pending state change|give it a bit to clear */ if (check_for_state_change(ftdmchan)) { SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + /* check if we need to die */ SS7_ASSERT; + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); + /* move to the next channel */ + continue; } else { /* throw the grp reset flag */ sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c index 0d76329..87733dd 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c @@ -75,7 +75,7 @@ int ft_to_sngss7_activate_all(void) if (ftmod_ss7_enable_isap(x)) { SS7_CRITICAL("ISAP %d Enable: NOT OK\n", x); - SS7_ASSERT; + return 1; } else { SS7_INFO("ISAP %d Enable: OK\n", x); } @@ -94,7 +94,7 @@ int ft_to_sngss7_activate_all(void) if (ftmod_ss7_enable_nsap(x)) { SS7_CRITICAL("NSAP %d Enable: NOT OK\n", x); - SS7_ASSERT; + return 1; } else { SS7_INFO("NSAP %d Enable: OK\n", x); } @@ -113,7 +113,7 @@ int ft_to_sngss7_activate_all(void) if (ftmod_ss7_enable_mtpLinkSet(x)) { SS7_CRITICAL("LinkSet \"%s\" Enable: NOT OK\n", g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name); - SS7_ASSERT; + return 1; } else { SS7_INFO("LinkSet \"%s\" Enable: OK\n", g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name); } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index 5e6a246..ac7a616 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -1029,6 +1029,9 @@ ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t circui /* extract the affected infId from the circuit structure */ infId = g_ftdm_sngss7_data.cfg.isupCkt[circuit].infId; + + /* set the interface to paused */ + sngss7_set_flag(&g_ftdm_sngss7_data.cfg.isupIntf[infId], SNGSS7_PAUSED); /* go through all the circuits now and find any other circuits on this infId */ i = 1; @@ -1050,6 +1053,7 @@ ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t circui /* check if the circuit is fully started */ if (ftdm_test_flag(ftdmchan->span, FTDM_SPAN_IN_THREAD)) { + SS7_DEBUG_CHAN(ftdmchan, "Rx PAUSE%s\n", ""); /* set the pause flag on the channel */ sngss7_set_flag(sngss7_info, FLAG_INFID_PAUSED); } @@ -1081,6 +1085,9 @@ ftdm_status_t handle_resume(uint32_t suInstId, uint32_t spInstId, uint32_t circu /* extract the affect infId from the circuit structure */ infId = g_ftdm_sngss7_data.cfg.isupCkt[circuit].infId; + /* set the interface to resumed */ + sngss7_clear_flag(&g_ftdm_sngss7_data.cfg.isupIntf[infId], SNGSS7_PAUSED); + /* go through all the circuits now and find any other circuits on this infId */ i = 1; while (g_ftdm_sngss7_data.cfg.isupCkt[i].id != 0) { @@ -1101,6 +1108,8 @@ ftdm_status_t handle_resume(uint32_t suInstId, uint32_t spInstId, uint32_t circu /* only resume if we are paused */ if (sngss7_test_flag(sngss7_info, FLAG_INFID_PAUSED)) { + SS7_DEBUG_CHAN(ftdmchan, "Rx RESUME%s\n", ""); + /* set the resume flag on the channel */ sngss7_set_flag(sngss7_info, FLAG_INFID_RESUME); @@ -1527,7 +1536,7 @@ ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ ftdm_channel_t *ftdmchan = NULL; sngss7_span_data_t *sngss7_span = NULL; int range; - int x; + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); @@ -1544,51 +1553,12 @@ ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ return FTDM_FAIL; } - /* loop over the cics starting from circuit until range+1 */ - for (x = circuit; x < (circuit + range + 1); x++) { - if (g_ftdm_sngss7_data.cfg.isupCkt[x].type != VOICE) continue; - /* grab the circuit in question */ - if (extract_chan_data(x, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", x); - break; - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* fill in the span structure for this circuit */ - sngss7_span = ftdmchan->span->mod_data; - sngss7_span->rx_grs.circuit = circuit; - sngss7_span->rx_grs.range = range; - - SS7_INFO_CHAN(ftdmchan, "Rx GRS (%d:%d)\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - (g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic + range)); - - /* flag the channel as having received a reset */ - sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_RX); - - switch (ftdmchan->state) { - /**************************************************************************/ - case FTDM_CHANNEL_STATE_RESTART: - - /* go to idle so that we can redo the restart state*/ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE); - - break; - /**************************************************************************/ - default: - - /* set the state of the channel to restart...the rest is done by the chan monitor */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - break; - /**************************************************************************/ - } - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* fill in the span structure for this circuit */ + sngss7_span = ftdmchan->span->mod_data; + sngss7_span->rx_grs.circuit = circuit; + sngss7_span->rx_grs.range = range; - } + /* the reset will be started in the main thread by "check_if_rx_grs_started" */ SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_SUCCESS; @@ -1599,10 +1569,16 @@ ftdm_status_t handle_grs_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ { SS7_FUNC_TRACE_ENTER(__FUNCTION__); - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + sngss7_span_data_t *sngss7_span = NULL; int range; - int x; + + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } /* extract the range value from the event structure */ if ((siStaEvnt->rangStat.eh.pres == PRSNT_NODEF) && (siStaEvnt->rangStat.range.pres == PRSNT_NODEF)) { @@ -1613,70 +1589,20 @@ ftdm_status_t handle_grs_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ return FTDM_FAIL; } - /* go through all the circuits in the range */ - for ( x = circuit; x < (circuit + range + 1); x++) { - - /* grab the circuit in question */ - if (extract_chan_data(x, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - break; - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - SS7_INFO_CHAN(ftdmchan, "Rx GRA (%d:%d)\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - (g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic + range)); - - switch (ftdmchan->state) { - /**********************************************************************/ - case FTDM_CHANNEL_STATE_RESTART: - - /* throw the FLAG_RESET_TX_RSP to indicate we have acknowledgement from the remote side */ - sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP); - - /* go to DOWN */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - - break; - /**********************************************************************/ - case FTDM_CHANNEL_STATE_DOWN: - - /* do nothing, just drop the message */ - SS7_DEBUG("Receveived GRA in down state, dropping\n"); - - break; - /**********************************************************************/ - case FTDM_CHANNEL_STATE_TERMINATING: - case FTDM_CHANNEL_STATE_HANGUP: - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - - /* throw the FLAG_RESET_TX_RSP to indicate we have acknowledgement from the remote side */ - sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP); - - break; - /**********************************************************************/ - default: - /* ITU Q764-2.9.5.1.c -> release the circuit */ - if ((siStaEvnt != NULL) && - (siStaEvnt->causeDgn.eh.pres ==PRSNT_NODEF) && - (siStaEvnt->causeDgn.causeVal.pres == PRSNT_NODEF)) { - ftdmchan->caller_data.hangup_cause = siStaEvnt->causeDgn.causeVal.val; - } else { - ftdmchan->caller_data.hangup_cause = 98; /* Message not compatiable with call state */ - } + /* fill in the span structure for this circuit */ + sngss7_span = ftdmchan->span->mod_data; + sngss7_span->rx_gra.circuit = circuit; + sngss7_span->rx_gra.range = range; - /* go to terminating to hang up the call */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - break; - /**********************************************************************/ - } + /* check if there is a cause value in the GRA */ + if ((siStaEvnt != NULL) && + (siStaEvnt->causeDgn.eh.pres == PRSNT_NODEF) && + (siStaEvnt->causeDgn.causeVal.pres == PRSNT_NODEF)) { - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); + sngss7_span->rx_gra.cause = siStaEvnt->causeDgn.causeVal.val; + } - } /* for (( x = 0; x < (circuit + range); x++) */ + /* the reset will be started in the main thread by "check_if_rx_gra_started" */ SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_SUCCESS; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index 3ef8db5..ce9423c 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -46,7 +46,7 @@ ftdm_sngss7_data_t g_ftdm_sngss7_data; /* PROTOTYPES *****************************************************************/ static void *ftdm_sangoma_ss7_run (ftdm_thread_t * me, void *obj); -static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t *ftdmchan); +void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t *ftdmchan); static void ftdm_sangoma_ss7_process_stack_event (sngss7_event_data_t *sngss7_event); static ftdm_status_t ftdm_sangoma_ss7_stop (ftdm_span_t * span); @@ -342,8 +342,16 @@ static void *ftdm_sangoma_ss7_run(ftdm_thread_t * me, void *obj) /**********************************************************************/ } /* switch ((ftdm_interrupt_wait(ftdm_sangoma_ss7_int, 100))) */ + /* check if there is a GRA to proccess on the span */ + if (sngss7_span->rx_gra.range > 0) { + check_if_rx_gra_started(ftdmspan); + } /* if (sngss7->span->rx_gra.range > 0) */ + /* check if there is a GRS being processed on the span */ if (sngss7_span->rx_grs.range > 0) { + /* check if the rx_grs has started */ + check_if_rx_grs_started(ftdmspan); + /* check if the rx_grs has cleared */ check_if_rx_grs_processed(ftdmspan); } /* if (sngss7_span->rx_grs.range > 0) */ @@ -452,7 +460,7 @@ static void ftdm_sangoma_ss7_process_stack_event (sngss7_event_data_t *sngss7_ev } /******************************************************************************/ -static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) +void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) { sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; int i = 0; @@ -727,6 +735,11 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /**************************************************************************/ case FTDM_CHANNEL_STATE_DOWN: /*the call is finished and removed */ + if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { + SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); + break; + } + /* check if there is a reset response that needs to be sent */ if (sngss7_test_flag (sngss7_info, FLAG_RESET_RX)) { /* send a RSC-RLC */ @@ -776,6 +789,11 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_TX); sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_BASE); sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_SENT); + + /* clean out the spans GRA structure */ + sngss7_span_data_t *span = ftdmchan->span->mod_data; + span->rx_gra.circuit = 0; + span->rx_gra.range = 0; } /* check if we came from reset (aka we just processed a reset) */ @@ -965,6 +983,7 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /**********************************************************************/ if (sngss7_test_flag(sngss7_info, FLAG_INFID_RESUME)) { + SS7_DEBUG_CHAN(ftdmchan, "Processing RESUME%s\n", ""); /* clear the RESUME flag */ sngss7_clear_flag(sngss7_info, FLAG_INFID_RESUME); @@ -990,6 +1009,7 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) } /* if (sngss7_test_flag(sngss7_info, FLAG_INFID_RESUME)) */ if (sngss7_test_flag(sngss7_info, FLAG_INFID_PAUSED)) { + SS7_DEBUG_CHAN(ftdmchan, "Processing PAUSE%s\n", ""); /* bring the sig status down */ sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; @@ -1165,9 +1185,10 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(ftdm_sangoma_ss7_outgoing_call) /* check if there is a pending state change, give it a bit to clear */ if (check_for_state_change(ftdmchan)) { SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); + /* check if we need to die */ SS7_ASSERT; + /* end the request */ + goto outgoing_fail; }; /* check if the channel sig state is UP */ @@ -1278,6 +1299,7 @@ static ftdm_status_t ftdm_sangoma_ss7_start(ftdm_span_t * span) ftdm_channel_t *ftdmchan = NULL; sngss7_chan_data_t *sngss7_info = NULL; sngss7_span_data_t *sngss7_span = NULL; + sng_isup_inf_t *sngss7_intf = NULL; int x; @@ -1290,12 +1312,22 @@ static ftdm_status_t ftdm_sangoma_ss7_start(ftdm_span_t * span) if (ftdmchan->call_data == NULL) continue; sngss7_info = ftdmchan->call_data; sngss7_span = ftdmchan->span->mod_data; + sngss7_intf = &g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId]; + /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - /* throw the pause flag */ - sngss7_set_flag(sngss7_info, FLAG_INFID_PAUSED); + /* check if the interface is paused or resumed */ + if (sngss7_test_flag(sngss7_intf, SNGSS7_PAUSED)) { + /* throw the pause flag */ + sngss7_clear_flag(sngss7_info, FLAG_INFID_RESUME); + sngss7_set_flag(sngss7_info, FLAG_INFID_PAUSED); + } else { + /* throw the pause flag */ + sngss7_clear_flag(sngss7_info, FLAG_INFID_PAUSED); + sngss7_set_flag(sngss7_info, FLAG_INFID_RESUME); + } #if 0 /* throw the grp reset flag */ sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index 850bbf0..ae24123 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -79,7 +79,8 @@ typedef enum { typedef enum { CONFIGURED = (1 << 0), - ACTIVE = (1 << 1) + ACTIVE = (1 << 1), + SNGSS7_PAUSED = (1 << 7) } sng_flag_t; typedef struct sng_mtp_link { @@ -335,6 +336,7 @@ typedef struct sngss7_group_data { uint32_t range; uint8_t status[255]; uint8_t type; + uint8_t cause; }sngss7_group_data_t; typedef struct sngss7_chan_data { @@ -353,6 +355,7 @@ typedef struct sngss7_chan_data { typedef struct sngss7_span_data { ftdm_sched_t *sched; sngss7_group_data_t rx_grs; + sngss7_group_data_t rx_gra; sngss7_group_data_t tx_grs; sngss7_group_data_t rx_cgb; sngss7_group_data_t tx_cgb; @@ -427,6 +430,8 @@ extern int cmbLinkSetId; /******************************************************************************/ /* PROTOTYPES *****************************************************************/ +void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t *ftdmchan); + void handle_sng_log(uint8_t level, char *fmt,...); void handle_sng_mtp1_alarm(Pst *pst, L1Mngmt *sta); void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta); @@ -546,7 +551,9 @@ void handle_isup_t35(void *userdata); ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const char *data); +ftdm_status_t check_if_rx_grs_started(ftdm_span_t *ftdmspan); ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan); +ftdm_status_t check_if_rx_gra_started(ftdm_span_t *ftdmspan); ftdm_status_t check_for_res_sus_flag(ftdm_span_t *ftdmspan); /******************************************************************************/ @@ -678,7 +685,14 @@ ftdm_status_t check_for_res_sus_flag(ftdm_span_t *ftdmspan); #define sngss7_clear_flag(obj, flag) ((obj)->flags &= ~(flag)) #define sngss7_set_flag(obj, flag) ((obj)->flags |= (flag)) -# define SS7_ASSERT *(int*)0=0; +#ifdef SS7_PRODUCTION +# define SS7_ASSERT \ + SS7_INFO_CHAN(ftdmchan,"Production Mode, continuing%s\n", ""); +#else +# define SS7_ASSERT \ + SS7_ERROR_CHAN(ftdmchan, "Debugging Mode, ending%s\n", ""); \ + *(int*)0=0; +#endif /******************************************************************************/ /******************************************************************************/ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index aaffeb0..8e7c649 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -57,7 +57,9 @@ unsigned long get_unique_id(void); ftdm_status_t extract_chan_data(uint32_t circuit, sngss7_chan_data_t **sngss7_info, ftdm_channel_t **ftdmchan); +ftdm_status_t check_if_rx_grs_started(ftdm_span_t *ftdmspan); ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan); +ftdm_status_t check_if_rx_gra_started(ftdm_span_t *ftdmspan); ftdm_status_t check_for_res_sus_flag(ftdm_span_t *ftdmspan); /******************************************************************************/ @@ -446,6 +448,68 @@ unsigned long get_unique_id(void) } /******************************************************************************/ +ftdm_status_t check_if_rx_grs_started(ftdm_span_t *ftdmspan) +{ + ftdm_channel_t *ftdmchan = NULL; + sngss7_chan_data_t *sngss7_info = NULL; + sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->mod_data; + int i; + + for ( i = sngss7_span->rx_grs.circuit; i < (sngss7_span->rx_grs.circuit + sngss7_span->rx_grs.range + 1); i++) { + + /* extract the channel in question */ + if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", i); + continue; + } + + /* check if the GRP_RESET_RX flag is already up */ + if (sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_RX)) { + /* we have already processed this channel...move along */ + continue; + } + + /* lock the channel */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* clear up any pending state changes */ + while (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { + ftdm_sangoma_ss7_process_state_change (ftdmchan); + } + + SS7_INFO_CHAN(ftdmchan, "Rx GRS (%d:%d)\n", + g_ftdm_sngss7_data.cfg.isupCkt[sngss7_span->rx_grs.circuit].cic, + (g_ftdm_sngss7_data.cfg.isupCkt[sngss7_span->rx_grs.circuit].cic + sngss7_span->rx_grs.range)); + + /* flag the channel as having received a reset */ + sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_RX); + + switch (ftdmchan->state) { + /**************************************************************************/ + case FTDM_CHANNEL_STATE_RESTART: + + /* go to idle so that we can redo the restart state*/ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE); + + break; + /**************************************************************************/ + default: + + /* set the state of the channel to restart...the rest is done by the chan monitor */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + break; + /**************************************************************************/ + } /* switch (ftdmchan->state) */ + + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); + + } /* for (chans in GRS */ + + return FTDM_SUCCESS; +} + +/******************************************************************************/ ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan) { ftdm_channel_t *ftdmchan = NULL; @@ -493,7 +557,10 @@ ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan) /* extract the channel in question */ if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n",i); + /* check if we need to die */ SS7_ASSERT; + /* move along */ + continue; } /* throw the GRP reset flag complete flag */ @@ -535,6 +602,91 @@ GRS_UNLOCK_ALL: } /******************************************************************************/ +ftdm_status_t check_if_rx_gra_started(ftdm_span_t *ftdmspan) +{ + ftdm_channel_t *ftdmchan = NULL; + sngss7_chan_data_t *sngss7_info = NULL; + sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->mod_data; + int i; + + for ( i = sngss7_span->rx_gra.circuit; i < (sngss7_span->rx_gra.circuit + sngss7_span->rx_gra.range + 1); i++) { + + /* extract the channel in question */ + if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", i); + continue; + } + + /* check if the channel is already procoessing the GRA */ + if (sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP)) { + /* move along */ + continue; + } + + /* lock the channel */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* clear up any pending state changes */ + while (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { + ftdm_sangoma_ss7_process_state_change (ftdmchan); + } + + SS7_INFO_CHAN(ftdmchan, "Rx GRA (%d:%d)\n", + g_ftdm_sngss7_data.cfg.isupCkt[sngss7_span->rx_gra.circuit].cic, + (g_ftdm_sngss7_data.cfg.isupCkt[sngss7_span->rx_gra.circuit].cic + sngss7_span->rx_gra.range)); + + switch (ftdmchan->state) { + /**********************************************************************/ + case FTDM_CHANNEL_STATE_RESTART: + + /* throw the FLAG_RESET_TX_RSP to indicate we have acknowledgement from the remote side */ + sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP); + + /* go to DOWN */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + + break; + /**********************************************************************/ + case FTDM_CHANNEL_STATE_DOWN: + + /* do nothing, just drop the message */ + SS7_DEBUG("Receveived GRA in down state, dropping\n"); + + break; + /**********************************************************************/ + case FTDM_CHANNEL_STATE_TERMINATING: + case FTDM_CHANNEL_STATE_HANGUP: + case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: + + /* throw the FLAG_RESET_TX_RSP to indicate we have acknowledgement from the remote side */ + sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP); + + break; + /**********************************************************************/ + default: + /* ITU Q764-2.9.5.1.c -> release the circuit */ + if (sngss7_span->rx_gra.cause != 0) { + ftdmchan->caller_data.hangup_cause = sngss7_span->rx_gra.cause; + } else { + ftdmchan->caller_data.hangup_cause = 98; /* Message not compatiable with call state */ + } + + /* go to terminating to hang up the call */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + break; + /**********************************************************************/ + } + + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); + + } /* for ( circuits in request */ + + + return FTDM_SUCCESS; +} + +/******************************************************************************/ ftdm_status_t check_for_res_sus_flag(ftdm_span_t *ftdmspan) { ftdm_channel_t *ftdmchan = NULL; @@ -564,6 +716,11 @@ ftdm_status_t check_for_res_sus_flag(ftdm_span_t *ftdmspan) /* if we have the PAUSED flag and the sig status is still UP */ if ((sngss7_test_flag(sngss7_info, FLAG_INFID_PAUSED)) && (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP))) { + + /* clear up any pending state changes */ + while (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { + ftdm_sangoma_ss7_process_state_change (ftdmchan); + } /* throw the channel into SUSPENDED to process the flag */ /* after doing this once the sig status will be down */ @@ -573,6 +730,13 @@ ftdm_status_t check_for_res_sus_flag(ftdm_span_t *ftdmspan) /* if the RESUME flag is up go to SUSPENDED to process the flag */ /* after doing this the flag will be cleared */ if (sngss7_test_flag(sngss7_info, FLAG_INFID_RESUME)) { + + /* clear up any pending state changes */ + while (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { + ftdm_sangoma_ss7_process_state_change (ftdmchan); + } + + /* got SUSPENDED state to clear the flag */ ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); } commit 55757c4f776068edcbd3c81e740d561bc3a2413f Merge: 54bf657 4865e38 Author: Moises Silva <moy@sangoma.com> Date: Fri Sep 24 14:15:32 2010 -0400 Merge remote branch 'smgorig/master' commit 54bf6575027c558e2ad668b3727eea20e9e0e3fb Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Sep 24 12:29:23 2010 -0500 FSCORE-631 diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index b9c4102..1cbd2b9 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -2595,6 +2595,22 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess if ((inner_var_count = switch_separate_string(var_array[x], '=', inner_var_array, (sizeof(inner_var_array) / sizeof(inner_var_array[0])))) == 2) { + + /* this is stupid but necessary: if the value begins with ^^ take the very next char as a delim, + increment the string to start the next char after that and replace every instance of the delim with a , */ + + if (*inner_var_array[1] == '^' && *(inner_var_array[1] + 1) == '^') { + char *iv; + char d = 0; + inner_var_array[1] += 2; + d = *inner_var_array[1]++; + + if (d) { + for(iv = inner_var_array[1]; iv && *iv; iv++) { + if (*iv == d) *iv = ','; + } + } + } switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "local variable string %d = [%s=%s]\n", x, inner_var_array[0], inner_var_array[1]); commit 73e6e03d371a7ef3d0cb8d798554df6338f29cbb Author: Brian West <brian@freeswitch.org> Date: Fri Sep 24 11:29:06 2010 -0500 MODSOFIA-105 can't take defaults that were there before away diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index daff5d0..86aa54d 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -98,7 +98,7 @@ void sofia_glue_set_image_sdp(private_object_t *tech_pvt, switch_t38_options_t * if (switch_true(switch_channel_get_variable(tech_pvt->channel, "broken_T38FaxFillBitRemoval"))) { switch_snprintf(FILLBIT, sizeof(FILLBIT), "a=T38FaxFillBitRemoval:1\n"); } else { - switch_set_string(FILLBIT, ""); + switch_set_string(FILLBIT, "a=T38FaxFillBitRemoval\n"); } } else { if (switch_true(switch_channel_get_variable(tech_pvt->channel, "broken_T38FaxFillBitRemoval"))) { @@ -108,11 +108,11 @@ void sofia_glue_set_image_sdp(private_object_t *tech_pvt, switch_t38_options_t * } } - if( t38_options->T38FaxTranscodingMMR ) { + if( t38_options->T38FaxTranscodingMMR) { if (switch_true(switch_channel_get_variable(tech_pvt->channel, "broken_T38FaxTranscodingMMR"))) { switch_snprintf(MMR, sizeof(MMR), "a=T38FaxTranscodingMMR:1\n"); } else { - switch_set_string(MMR, ""); + switch_set_string(MMR, "a=T38FaxTranscodingMMR\n"); } } else { if (switch_true(switch_channel_get_variable(tech_pvt->channel, "broken_T38FaxTranscodingMMR"))) { @@ -122,11 +122,11 @@ void sofia_glue_set_image_sdp(private_object_t *tech_pvt, switch_t38_options_t * } } - if( t38_options->T38FaxTranscodingJBIG ) { + if( t38_options->T38FaxTranscodingJBIG) { if (switch_true(switch_channel_get_variable(tech_pvt->channel, "broken_T38FaxTranscodingJBIG"))) { switch_snprintf(JBIG, sizeof(JBIG), "a=T38FaxTranscodingJBIG:1\n"); } else { - switch_set_string(JBIG, ""); + switch_set_string(JBIG, "a=T38FaxTranscodingJBIG\n"); } } else { if (switch_true(switch_channel_get_variable(tech_pvt->channel, "broken_T38FaxTranscodingJBIG"))) { commit 8f731f42e291871aaa7b48bc7a3b3399ff121ae9 Author: Brian West <brian@freeswitch.org> Date: Fri Sep 24 10:31:11 2010 -0500 MODSOFIA-105 diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 6a33b3e..daff5d0 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -48,6 +48,9 @@ void sofia_glue_set_image_sdp(private_object_t *tech_pvt, switch_t38_options_t * uint32_t port = t38_options->local_port; const char *family = "IP4"; const char *username = tech_pvt->profile->username; + char MMR[32] = ""; + char JBIG[32] = ""; + char FILLBIT[32] = ""; //sofia_clear_flag(tech_pvt, TFLAG_ENABLE_SOA); @@ -91,6 +94,48 @@ void sofia_glue_set_image_sdp(private_object_t *tech_pvt, switch_t38_options_t * "o=%s %010u %010u IN %s %s\n" "s=%s\n" "c=IN %s %s\n" "t=0 0\n", username, tech_pvt->owner_id, tech_pvt->session_id, family, ip, username, family, ip); + if(t38_options->T38FaxFillBitRemoval) { + if (switch_true(switch_channel_get_variable(tech_pvt->channel, "broken_T38FaxFillBitRemoval"))) { + switch_snprintf(FILLBIT, sizeof(FILLBIT), "a=T38FaxFillBitRemoval:1\n"); + } else { + switch_set_string(FILLBIT, ""); + } + } else { + if (switch_true(switch_channel_get_variable(tech_pvt->channel, "broken_T38FaxFillBitRemoval"))) { + switch_snprintf(FILLBIT, sizeof(FILLBIT), "a=T38FaxFillBitRemoval:0\n"); + } else { + switch_set_string(FILLBIT, ""); + } + } + + if( t38_options->T38FaxTranscodingMMR ) { + if (switch_true(switch_channel_get_variable(tech_pvt->channel, "broken_T38FaxTranscodingMMR"))) { + switch_snprintf(MMR, sizeof(MMR), "a=T38FaxTranscodingMMR:1\n"); + } else { + switch_set_string(MMR, ""); + } + } else { + if (switch_true(switch_channel_get_variable(tech_pvt->channel, "broken_T38FaxTranscodingMMR"))) { + switch_snprintf(MMR, sizeof(MMR), "a=T38FaxTranscodingMMR:0\n"); + } else { + switch_set_string(MMR, ""); + } + } + + if( t38_options->T38FaxTranscodingJBIG ) { + if (switch_true(switch_channel_get_variable(tech_pvt->channel, "broken_T38FaxTranscodingJBIG"))) { + switch_snprintf(JBIG, sizeof(JBIG), "a=T38FaxTranscodingJBIG:1\n"); + } else { + switch_set_string(JBIG, ""); + } + } else { + if (switch_true(switch_channel_get_variable(tech_pvt->channel, "broken_T38FaxTranscodingJBIG"))) { + switch_snprintf(JBIG, sizeof(JBIG), "a=T38FaxTranscodingJBIG:0\n"); + } else { + switch_set_string(JBIG, ""); + } + } + if (t38_options->T38FaxMaxBuffer) { switch_snprintf(max_buf, sizeof(max_buf), "a=T38FaxMaxBuffer:%d\n", t38_options->T38FaxMaxBuffer); }; @@ -115,9 +160,9 @@ void sofia_glue_set_image_sdp(private_object_t *tech_pvt, switch_t38_options_t * port, t38_options->T38FaxVersion, t38_options->T38MaxBitRate, - t38_options->T38FaxFillBitRemoval ? "a=T38FaxFillBitRemoval\n" : "", - t38_options->T38FaxTranscodingMMR ? "a=T38FaxTranscodingMMR\n" : "", - t38_options->T38FaxTranscodingJBIG ? "a=T38FaxTranscodingJBIG\n" : "", + FILLBIT, + MMR, + JBIG, t38_options->T38FaxRateManagement, max_buf, max_data, @@ -3462,11 +3507,41 @@ static switch_t38_options_t *tech_process_udptl(private_object_t *tech_pvt, sdp_ } else if (!strcasecmp(attr->a_name, "T38MaxBitRate") && attr->a_value) { t38_options->T38MaxBitRate = (uint32_t) atoi(attr->a_value); } else if (!strcasecmp(attr->a_name, "T38FaxFillBitRemoval")) { - t38_options->T38FaxFillBitRemoval = SWITCH_TRUE; + if (switch_stristr("T38FaxFillBitRemoval:", tech_pvt->remote_sdp_str)) { + switch_channel_set_variable(tech_pvt->channel, "broken_T38FaxFillBitRemoval", "true"); + if (atoi(attr->a_value) == 0) { + t38_options->T38FaxFillBitRemoval = SWITCH_FALSE; + } else { + t38_options->T38FaxFillBitRemoval = SWITCH_TRUE; + } + } else { + switch_channel_set_variable(tech_pvt->channel, "broken_T38FaxFillBitRemoval", "false"); + t38_options->T38FaxFillBitRemoval = SWITCH_TRUE; + } } else if (!strcasecmp(attr->a_name, "T38FaxTranscodingMMR")) { - t38_options->T38FaxTranscodingMMR = SWITCH_TRUE; + if (switch_stristr("T38FaxTranscodingMMR:", tech_pvt->remote_sdp_str)) { + switch_channel_set_variable(tech_pvt->channel, "broken_T38FaxTranscodingMMR", "true"); + if (atoi(attr->a_value) == 0) { + t38_options->T38FaxTranscodingMMR = SWITCH_FALSE; + } else { + t38_options->T38FaxTranscodingMMR = SWITCH_TRUE; + } + } else { + switch_channel_set_variable(tech_pvt->channel, "broken_T38FaxTranscodingMMR", "false"); + t38_options->T38FaxTranscodingMMR = SWITCH_TRUE; + } } else if (!strcasecmp(attr->a_name, "T38FaxTranscodingJBIG")) { - t38_options->T38FaxTranscodingJBIG = SWITCH_TRUE; + if (switch_stristr("T38FaxTranscodingJBIG:", tech_pvt->remote_sdp_str)) { + switch_channel_set_variable(tech_pvt->channel, "broken_T38FaxTranscodingJBIG", "true"); + if (atoi(attr->a_value) == 0) { + t38_options->T38FaxTranscodingJBIG = SWITCH_FALSE; + } else { + t38_options->T38FaxTranscodingJBIG = SWITCH_TRUE; + } + } else { + switch_channel_set_variable(tech_pvt->channel, "broken_T38FaxTranscodingJBIG", "false"); + t38_options->T38FaxTranscodingJBIG = SWITCH_TRUE; + } } else if (!strcasecmp(attr->a_name, "T38FaxRateManagement") && attr->a_value) { t38_options->T38FaxRateManagement = switch_core_session_strdup(tech_pvt->session, attr->a_value); } else if (!strcasecmp(attr->a_name, "T38FaxMaxBuffer") && attr->a_value) { commit 4865e38d319212b1d22f626082cf3e0b8ef91c45 Merge: 1c9fe26 562ac0e Author: Moises Silva <moises.silva@gmail.com> Date: Fri Sep 24 08:37:31 2010 -0400 Merge branch 'moy.printstate' commit 562ac0efe3ef5bf955edb0399913a1c1cdf3db18 Author: Moises Silva <moises.silva@gmail.com> Date: Fri Sep 24 08:35:20 2010 -0400 freetdm: use ftdm stream instead of funky string concatenation with snprintf add ftdm core state filtering for debugging diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 0cb2170..48dbe26 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -3689,6 +3689,102 @@ static struct { ftdm_io_interface_t *pika_interface; } interfaces; +static void print_channels_by_state(ftdm_stream_handle_t *stream, ftdm_channel_state_t state, int not, int *count) +{ + ftdm_hash_iterator_t *i = NULL; + ftdm_span_t *span; + ftdm_channel_t *fchan = NULL; + ftdm_iterator_t *citer = NULL; + ftdm_iterator_t *curr = NULL; + const void *key = NULL; + void *val = NULL; + + *count = 0; + + ftdm_mutex_lock(globals.mutex); + + for (i = hashtable_first(globals.span_hash); i; i = hashtable_next(i)) { + hashtable_this(i, &key, NULL, &val); + if (!key || !val) { + break; + } + span = val; + citer = ftdm_span_get_chan_iterator(span, NULL); + if (!citer) { + continue; + } + for (curr = citer ; curr; curr = ftdm_iterator_next(curr)) { + fchan = ftdm_iterator_current(curr); + if (not && (fchan->state != state)) { + stream->write_function(stream, "[s%dc%d][%d:%d] in state %s\n", + fchan->span_id, fchan->chan_id, + fchan->physical_span_id, fchan->physical_chan_id, ftdm_channel_state2str(fchan->state)); + (*count)++; + } else if (!not && (fchan->state == state)) { + stream->write_function(stream, "[s%dc%d][%d:%d] in state %s\n", + fchan->span_id, fchan->chan_id, + fchan->physical_span_id, fchan->physical_chan_id, ftdm_channel_state2str(fchan->state)); + (*count)++; + } + } + ftdm_iterator_free(citer); + } + + ftdm_mutex_unlock(globals.mutex); +} + +static char *handle_core_command(const char *cmd) +{ + char *mycmd = NULL; + int argc = 0; + int count = 0; + int not = 0; + char *argv[10] = { 0 }; + char *state = NULL; + ftdm_channel_state_t i = FTDM_CHANNEL_STATE_INVALID; + ftdm_stream_handle_t stream = { 0 }; + + FTDM_STANDARD_STREAM(stream); + + if (cmd) { + mycmd = ftdm_strdup(cmd); + argc = ftdm_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + } else { + stream.write_function(&stream, "invalid core command\n"); + goto done; + } + + if (!strcasecmp(argv[0], "state")) { + if (argc < 2) { + stream.write_function(&stream, "core state command requires an argument\n"); + goto done; + } + state = argv[1]; + if (argv[1][0] == '!') { + not = 1; + state++; + } + for (i = FTDM_CHANNEL_STATE_DOWN; i < FTDM_CHANNEL_STATE_INVALID; i++) { + if (!strcasecmp(state, ftdm_channel_state2str(i))) { + break; + } + } + if (i == FTDM_CHANNEL_STATE_INVALID) { + stream.write_function(&stream, "invalid state %s\n", state); + goto done; + } + print_channels_by_state(&stream, i, not, &count); + stream.write_function(&stream, "\nTotal channels %s %s: %d\n", not ? "not in state" : "in state", ftdm_channel_state2str(i), count); + } else { + stream.write_function(&stream, "invalid core command %s\n", argv[0]); + } + +done: + ftdm_safe_free(mycmd); + + return stream.data; +} + FT_DECLARE(char *) ftdm_api_execute(const char *cmd) { ftdm_io_interface_t *fio = NULL; @@ -3703,6 +3799,10 @@ FT_DECLARE(char *) ftdm_api_execute(const char *cmd) } type = dup; + + if (!strcasecmp(type, "core")) { + return handle_core_command(cmd); + } ftdm_mutex_lock(globals.mutex); if (!(fio = (ftdm_io_interface_t *) hashtable_search(globals.interface_hash, (void *)type))) { @@ -5202,38 +5302,21 @@ FT_DECLARE(char *) ftdm_strndup(const char *str, ftdm_size_t inlen) return new; } -#define FTDM_DEBUG_LINE_LEN 255 -#define handle_snprintf_result(buff, written, len, debugstr) \ - if (written >= len) { \ - ftdm_free(debugstr); \ - return NULL; \ - } \ - len -= written; \ - buff += written; - FT_DECLARE(char *) ftdm_channel_get_history_str(const ftdm_channel_t *fchan) { char func[255]; char line[255]; char states[255]; - int written = 0; - char *buff = NULL; uint8_t i = 0; - int dbglen = ftdm_array_len(fchan->history) * FTDM_DEBUG_LINE_LEN; - int len = dbglen; + ftdm_stream_handle_t stream = { 0 }; + FTDM_STANDARD_STREAM(stream); if (!fchan->history[0].file) { - return ftdm_strdup("-- No state history --\n"); - } - - char *debugstr = ftdm_calloc(1, dbglen); - if (!debugstr) { - return NULL; + stream.write_function(&stream, "-- No state history --\n"); + return stream.data; } - buff = debugstr; - written = snprintf(buff, len, "%-30.30s %-30.30s %s", "-- States --", "-- Function --", "-- Location --\n"); - handle_snprintf_result(buff, written, len, debugstr); + stream.write_function(&stream, "%-30.30s %-30.30s %s", "-- States --", "-- Function --", "-- Location --\n"); for (i = fchan->hindex; i < ftdm_array_len(fchan->history); i++) { if (!fchan->history[i].file) { @@ -5242,21 +5325,17 @@ FT_DECLARE(char *) ftdm_channel_get_history_str(const ftdm_channel_t *fchan) snprintf(states, sizeof(states), "%-5.15s => %-5.15s", ftdm_channel_state2str(fchan->history[i].last_state), ftdm_channel_state2str(fchan->history[i].state)); snprintf(func, sizeof(func), "[%s]", fchan->history[i].func); snprintf(line, sizeof(func), "[%s:%d]", fchan->history[i].file, fchan->history[i].line); - written = snprintf(buff, len, "%-30.30s %-30.30s %s\n", states, func, line); - handle_snprintf_result(buff, written, len, debugstr); + stream.write_function(&stream, "%-30.30s %-30.30s %s\n", states, func, line); } for (i = 0; i < fchan->hindex; i++) { snprintf(states, sizeof(states), "%-5.15s => %-5.15s", ftdm_channel_state2str(fchan->history[i].last_state), ftdm_channel_state2str(fchan->history[i].state)); snprintf(func, sizeof(func), "[%s]", fchan->history[i].func); snprintf(line, sizeof(func), "[%s:%d]", fchan->history[i].file, fchan->history[i].line); - written = snprintf(buff, len, "%-30.30s %-30.30s %s\n", states, func, line); - handle_snprintf_result(buff, written, len, debugstr); + stream.write_function(&stream, "%-30.30s %-30.30s %s\n", states, func, line); } - debugstr[dbglen-1] = 0; - - return debugstr; + return stream.data; } commit 25ddef504d4db096160527e8209bc25e7d1a3a5f Author: Mathieu Parent <math.parent@gmail.com> Date: Fri Sep 24 01:55:20 2010 +0200 Skinny: add support to DeviceToUser and UserToDevice messages diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index c67c20f..fc7d872 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -1911,6 +1911,55 @@ static switch_status_t load_skinny_config(void) return SWITCH_STATUS_SUCCESS; } +static void skinny_user_to_device_event_handler(switch_event_t *event) +{ + char *profile_name = switch_event_get_header_nil(event, "Skinny-Profile-Name"); + skinny_profile_t *profile; + + if ((profile = skinny_find_profile(profile_name))) { + char *device_name = switch_event_get_header_nil(event, "Skinny-Device-Name"); + uint32_t device_instance = atoi(switch_event_get_header_nil(event, "Skinny-Station-Instance")); + listener_t *listener = NULL; + skinny_profile_find_listener_by_device_name_and_instance(profile, device_name, device_instance, &listener); + if(listener) { + uint32_t message_type = atoi(switch_event_get_header_nil(event, "Skinny-UserToDevice-Message-Id")); + uint32_t application_id = atoi(switch_event_get_header_nil(event, "Skinny-UserToDevice-Application-Id")); + uint32_t line_instance = atoi(switch_event_get_header_nil(event, "Skinny-UserToDevice-Line-Instance")); + uint32_t call_id = atoi(switch_event_get_header_nil(event, "Skinny-UserToDevice-Call-Id")); + uint32_t transaction_id = atoi(switch_event_get_header_nil(event, "Skinny-UserToDevice-Transaction-Id")); + uint32_t data_length = atoi(switch_event_get_header_nil(event, "Skinny-UserToDevice-Data-Length")); + uint32_t sequence_flag = atoi(switch_event_get_header_nil(event, "Skinny-UserToDevice-Sequence-Flag")); + uint32_t display_priority = atoi(switch_event_get_header_nil(event, "Skinny-UserToDevice-Display-Priority")); + uint32_t conference_id = atoi(switch_event_get_header_nil(event, "Skinny-UserToDevice-Conference-Id")); + uint32_t app_instance_id = atoi(switch_event_get_header_nil(event, "Skinny-UserToDevice-App-Instance-Id")); + uint32_t routing_id = atoi(switch_event_get_header_nil(event, "Skinny-UserToDevice-Routing-Id")); + char *data = switch_event_get_body(event); + if (message_type == 0) { + message_type = skinny_str2message_type(switch_event_get_header_nil(event, "Skinny-UserToDevice-Message-Id-String")); + } + switch(message_type) { + case USER_TO_DEVICE_DATA_MESSAGE: + case USER_TO_DEVICE_DATA_VERSION1_MESSAGE: + data_length = strlen(data); /* we ignore data_length sent */ + send_extended_data(listener, message_type, + application_id, line_instance, call_id, transaction_id, data_length, + sequence_flag, display_priority, conference_id, app_instance_id, routing_id, + data); + break; + default: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, + "Incorrect message type %s (%d).\n", skinny_message_type2str(message_type), message_type); + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, + "Device %s:%d in profile '%s' not found.\n", device_name, device_instance, profile_name); + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, + "Profile '%s' not found.\n", profile_name); + } +} + static void skinny_call_state_event_handler(switch_event_t *event) { char *subclass; @@ -2130,6 +2179,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skinny_load) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Couldn't bind our trap handler!\n"); /* Not such severe to prevent loading */ } + if ((switch_event_bind_removable(modname, SWITCH_EVENT_CUSTOM, SKINNY_EVENT_USER_TO_DEVICE, skinny_user_to_device_event_handler, NULL, &globals.user_to_device_node) != SWITCH_STATUS_SUCCESS)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind our user_to_device handler!\n"); + /* Not such severe to prevent loading */ + } /* reserve events */ if (switch_event_reserve_subclass(SKINNY_EVENT_REGISTER) != SWITCH_STATUS_SUCCESS) { @@ -2152,6 +2205,14 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skinny_load) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", SKINNY_EVENT_CALL_STATE); return SWITCH_STATUS_TERM; } + if (switch_event_reserve_subclass(SKINNY_EVENT_USER_TO_DEVICE) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", SKINNY_EVENT_USER_TO_DEVICE); + return SWITCH_STATUS_TERM; + } + if (switch_event_reserve_subclass(SKINNY_EVENT_DEVICE_TO_USER) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", SKINNY_EVENT_DEVICE_TO_USER); + return SWITCH_STATUS_TERM; + } /* connect my internal structure to the blank pointer passed to me */ *module_interface = switch_loadable_module_create_module_interface(globals.pool, modname); @@ -2190,6 +2251,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skinny_shutdown) skinny_api_unregister(); /* release events */ + switch_event_unbind(&globals.user_to_device_node); switch_event_unbind(&globals.call_state_node); switch_event_unbind(&globals.message_waiting_node); switch_event_unbind(&globals.trap_node); @@ -2198,6 +2260,8 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skinny_shutdown) switch_event_free_subclass(SKINNY_EVENT_EXPIRE); switch_event_free_subclass(SKINNY_EVENT_ALARM); switch_event_free_subclass(SKINNY_EVENT_CALL_STATE); + switch_event_free_subclass(SKINNY_EVENT_USER_TO_DEVICE); + switch_event_free_subclass(SKINNY_EVENT_DEVICE_TO_USER); switch_mutex_lock(mutex); diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.h b/src/mod/endpoints/mod_skinny/mod_skinny.h index 7a4df6f..b5cc96b 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.h +++ b/src/mod/endpoints/mod_skinny/mod_skinny.h @@ -43,12 +43,15 @@ #define SKINNY_EVENT_EXPIRE "skinny::expire" #define SKINNY_EVENT_ALARM "skinny::alarm" #define SKINNY_EVENT_CALL_STATE "skinny::call_state" +#define SKINNY_EVENT_USER_TO_DEVICE "skinny::user_to_device" +#define SKINNY_EVENT_DEVICE_TO_USER "skinny::device_to_user" struct skinny_globals { int running; switch_memory_pool_t *pool; switch_mutex_t *mutex; switch_hash_t *profile_hash; + switch_event_node_t *user_to_device_node; switch_event_node_t *call_state_node; switch_event_node_t *message_waiting_node; switch_event_node_t *trap_node; diff --git a/src/mod/endpoints/mod_skinny/skinny_api.c b/src/mod/endpoints/mod_skinny/skinny_api.c index 90699d1..9f527f5 100644 --- a/src/mod/endpoints/mod_skinny/skinny_api.c +++ b/src/mod/endpoints/mod_skinny/skinny_api.c @@ -366,6 +366,62 @@ static switch_status_t skinny_api_cmd_profile_device_send_reset_message(const ch return SWITCH_STATUS_SUCCESS; } +static switch_status_t skinny_api_cmd_profile_device_send_data(const char *profile_name, const char *device_name, const char *message_type, char *params, const char *body, switch_stream_handle_t *stream) +{ + skinny_profile_t *profile; + + if ((profile = skinny_find_profile(profile_name))) { + listener_t *listener = NULL; + skinny_profile_find_listener_by_device_name(profile, device_name, &listener); + if(listener) { + switch_event_t *event = NULL; + char *argv[64] = { 0 }; + int argc = 0; + int x = 0; + /* skinny::user_to_device event */ + skinny_device_event(listener, &event, SWITCH_EVENT_CUSTOM, SKINNY_EVENT_USER_TO_DEVICE); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Message-Id-String", "%s", message_type); + argc = switch_separate_string(params, ';', argv, (sizeof(argv) / sizeof(argv[0]))); + for (x = 0; x < argc; x++) { + char *var_name, *var_value = NULL; + var_name = argv[x]; + if (var_name && (var_value = strchr(var_name, '='))) { + *var_value++ = '\0'; + } + if (zstr(var_name)) { + stream->write_function(stream, "-ERR No variable specified\n"); + } else { + char *tmp = switch_mprintf("Skinny-UserToDevice-%s", var_name); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, tmp, "%s", var_value); + switch_safe_free(tmp); + /* + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Application-Id", "%d", request->data.extended_data.application_id); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Line-Instance", "%d", request->data.extended_data.line_instance); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Call-Id", "%d", request->data.extended_data.call_id); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Transaction-Id", "%d", request->data.extended_data.transaction_id); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Data-Length", "%d", request->data.extended_data.data_length); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Sequence-Flag", "%d", request->data.extended_data.sequence_flag); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Display-Priority", "%d", request->data.extended_data.display_priority); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Conference-Id", "%d", request->data.extended_data.conference_id); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-App-Instance-Id", "%d", request->data.extended_data.app_instance_id); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-UserToDevice-Routing-Id", "%d", request->data.extended_data.routing_id); + */ + } + } + switch_event_add_body(event, body); + switch_event_fire(&event); + stream->write_function(stream, "+OK\n"); + } else { + stream->write_function(stream, "Listener not found!\n"); + } + } else { + stream->write_function(stream, "Profile not found!\n"); + } + + return SWITCH_STATUS_SUCCESS; +} + + static switch_status_t skinny_api_cmd_profile_set(const char *profile_name, const char *name, const char *value, switch_stream_handle_t *stream) { skinny_profile_t *profile; @@ -403,6 +459,7 @@ SWITCH_STANDARD_API(skinny_function) "skinny profile <profile_name> device <device_name> send SetLampMessage <stimulus> <instance> <lamp_mode>\n" "skinny profile <profile_name> device <device_name> send SetSpeakerModeMessage <speaker_mode>\n" "skinny profile <profile_name> device <device_name> send CallStateMessage <call_state> <line_instance> <call_id>\n" + "skinny profile <profile_name> device <device_name> send <UserToDeviceDataMessage|UserToDeviceDataVersion1Message> [ <param>=<value>;... ] <data>\n" "skinny profile <profile_name> set <name> <value>\n" "--------------------------------------------------------------------------------\n"; if (session) { @@ -465,6 +522,16 @@ SWITCH_STANDARD_API(skinny_function) status = skinny_api_cmd_profile_device_send_reset_message(argv[1], argv[3], argv[6], stream); } break; + case USER_TO_DEVICE_DATA_MESSAGE: + case USER_TO_DEVICE_DATA_VERSION1_MESSAGE: + if(argc == 8) { + /* <UserToDeviceDataMessage|UserToDeviceDataVersion1Message> [ <param>=<value>;... ] <data> */ + status = skinny_api_cmd_profile_device_send_data(argv[1], argv[3], argv[5], argv[6], argv[7], stream); + } else if(argc == 7) { + /* <UserToDeviceDataMessage|UserToDeviceDataVersion1Message> <data> */ + status = skinny_api_cmd_profile_device_send_data(argv[1], argv[3], argv[5], "", argv[6], stream); + } + break; default: stream->write_function(stream, "Unhandled message %s\n", argv[5]); } @@ -495,6 +562,8 @@ switch_status_t skinny_api_register(switch_loadable_module_interface_t **module_ switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send SetLampMessage ::skinny::list_stimuli ::skinny::list_stimulus_instances ::skinny::list_stimulus_modes"); switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send SetSpeakerModeMessage ::skinny::list_speaker_modes"); switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send CallStateMessage ::skinny::list_call_states ::skinny::list_line_instances ::skinny::list_call_ids"); + switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send UserToDeviceDataMessage"); + switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send UserToDeviceDataVersion1Message"); switch_console_set_complete("add skinny profile ::skinny::list_profiles set ::skinny::list_settings"); switch_console_add_complete_func("::skinny::list_profiles", skinny_api_list_profiles); diff --git a/src/mod/endpoints/mod_skinny/skinny_protocol.c b/src/mod/endpoints/mod_skinny/skinny_protocol.c index 465e41b..5486f08 100644 --- a/src/mod/endpoints/mod_skinny/skinny_protocol.c +++ b/src/mod/endpoints/mod_skinny/skinny_protocol.c @@ -902,6 +902,42 @@ switch_status_t send_reset(listener_t *listener, uint32_t reset_type) return skinny_send_reply(listener, message); } +switch_status_t send_extended_data(listener_t *listener, uint32_t message_type, + uint32_t application_id, + uint32_t line_instance, + uint32_t call_id, + uint32_t transaction_id, + uint32_t data_length, + uint32_t sequence_flag, + uint32_t display_priority, + uint32_t conference_id, + uint32_t app_instance_id, + uint32_t routing_id, + const char *data) +{ + skinny_message_t *message; + switch_assert(data_length == strlen(data)); + /* data_length should be a multiple of 4 */ + if ((data_length % 4) != 0) { + data_length = (data_length / 4 + 1) * 4; + } + message = switch_core_alloc(listener->pool, 12+sizeof(message->data.extended_data)+data_length-1); + message->type = message_type; + message->length = 4 + sizeof(message->data.extended_data)+data_length-1; + message->data.extended_data.application_id = application_id; + message->data.extended_data.line_instance = line_instance; + message->data.extended_data.call_id = call_id; + message->data.extended_data.transaction_id = transaction_id; + message->data.extended_data.data_length = data_length; + message->data.extended_data.sequence_flag = sequence_flag; + message->data.extended_data.display_priority = display_priority; + message->data.extended_data.conference_id = conference_id; + message->data.extended_data.app_instance_id = app_instance_id; + message->data.extended_data.routing_id = routing_id; + strncpy(message->data.extended_data.data, data, data_length); + return skinny_send_reply(listener, message); +} + switch_status_t skinny_perform_send_reply(listener_t *listener, const char *file, const char *func, int line, skinny_message_t *reply) { char *ptr; diff --git a/src/mod/endpoints/mod_skinny/skinny_protocol.h b/src/mod/endpoints/mod_skinny/skinny_protocol.h index 567c1b1..b741fa9 100644 --- a/src/mod/endpoints/mod_skinny/skinny_protocol.h +++ b/src/mod/endpoints/mod_skinny/skinny_protocol.h @@ -176,7 +176,7 @@ struct PACKED register_available_lines_message { /* DeviceToUserDataMessage */ #define DEVICE_TO_USER_DATA_MESSAGE 0x002E -struct PACKED device_to_user_data_message { +struct PACKED data_message { uint32_t application_id; uint32_t line_instance; uint32_t call_id; @@ -187,14 +187,7 @@ struct PACKED device_to_user_data_message { /* DeviceToUserDataResponseMessage */ #define DEVICE_TO_USER_DATA_RESPONSE_MESSAGE 0x002F -struct PACKED device_to_user_data_response_message { - uint32_t application_id; - uint32_t line_instance; - uint32_t call_id; - uint32_t transaction_id; - uint32_t data_length; - char data[1]; -}; +/* See struct PACKED data_message */ /* ServiceUrlStatReqMessage */ #define SERVICE_URL_STAT_REQ_MESSAGE 0x0033 @@ -210,7 +203,7 @@ struct PACKED feature_stat_req_message { /* DeviceToUserDataVersion1Message */ #define DEVICE_TO_USER_DATA_VERSION1_MESSAGE 0x0041 -struct PACKED device_to_user_data_version1_message { +struct PACKED extended_data_message { uint32_t application_id; uint32_t line_instance; uint32_t call_id; @@ -226,19 +219,7 @@ struct PACKED device_to_user_data_version1_message { /* DeviceToUserDataResponseVersion1Message */ #define DEVICE_TO_USER_DATA_RESPONSE_VERSION1_MESSAGE 0x0042 -struct PACKED device_to_user_data_response_version1_message { - uint32_t application_id; - uint32_t line_instance; - uint32_t call_id; - uint32_t transaction_id; - uint32_t data_length; - uint32_t sequence_flag; - uint32_t display_priority; - uint32_t conference_id; - uint32_t app_instance_id; - uint32_t routing_id; - char data[1]; -}; +/* See struct PACKED extended_data_message */ /* RegisterAckMessage */ #define REGISTER_ACK_MESSAGE 0x0081 @@ -535,14 +516,7 @@ struct PACKED dialed_number_message { /* UserToDeviceDataMessage */ #define USER_TO_DEVICE_DATA_MESSAGE 0x011E -struct PACKED user_to_device_data_message { - uint32_t application_id; - uint32_t line_instance; - uint32_t call_id; - uint32_t transaction_id; - uint32_t data_length; - char data[1]; -}; +/* See struct PACKED data_message */ /* FeatureStatMessage */ #define FEATURE_STAT_RES_MESSAGE 0x011F @@ -571,19 +545,7 @@ struct PACKED service_url_stat_res_message { /* UserToDeviceDataVersion1Message */ #define USER_TO_DEVICE_DATA_VERSION1_MESSAGE 0x013F -struct PACKED user_to_device_data_version1_message { - uint32_t application_id; - uint32_t line_instance; - uint32_t call_id; - uint32_t transaction_id; - uint32_t data_length; - uint32_t sequence_flag; - uint32_t display_priority; - uint32_t conference_id; - uint32_t app_instance_id; - uint32_t routing_id; - char data[1]; -}; +/* See struct PACKED extended_data_message */ /*****************************************************************************/ /* SKINNY MESSAGE */ @@ -615,12 +577,12 @@ union skinny_data { /* no data for SOFT_KEY_TEMPLATE_REQ_MESSAGE */ struct headset_status_message headset_status; struct register_available_lines_message reg_lines; - struct device_to_user_data_message d2u_data; - struct device_to_user_data_response_message d2u_data_response; + /* see field "data" for DEVICE_TO_USER_DATA_MESSAGE */ + /* see field "data" for DEVICE_TO_USER_DATA_RESPONSE_MESSAGE */ struct service_url_stat_req_message service_url_req; struct feature_stat_req_message feature_req; - struct device_to_user_data_version1_message d2u_data_v1; - struct device_to_user_data_response_version1_message d2u_data_response_v1; + /* see field "extended_data" for DEVICE_TO_USER_DATA_VERSION1_MESSAGE */ + /* see field "extended_data" for DEVICE_TO_USER_DATA_RESPONSE_VERSION1_MESSAGE */ struct register_ack_message reg_ack; struct start_tone_message start_tone; struct stop_tone_message stop_tone; @@ -652,11 +614,15 @@ union skinny_data { struct unregister_ack_message unregister_ack; struct back_space_req_message back_space_req; struct dialed_number_message dialed_number; - struct user_to_device_data_message u2d_data; + /* see field "data" for USER_TO_DEVICE_DATA_MESSAGE */ struct feature_stat_res_message feature_res; struct display_pri_notify_message display_pri_notify; struct service_url_stat_res_message service_url_res; - struct user_to_device_data_version1_message u2d_data_v1; + /* see field "extended_data" for USER_TO_DEVICE_DATA_VERSION1_MESSAGE */ + + struct data_message data; + struct extended_data_message extended_data; + uint16_t as_uint16; char as_char; void *raw; @@ -873,6 +839,19 @@ switch_status_t send_display_pri_notify(listener_t *listener, switch_status_t send_reset(listener_t *listener, uint32_t reset_type); +switch_status_t send_extended_data(listener_t *listener, uint32_t message_type, + uint32_t application_id, + uint32_t line_instance, + uint32_t call_id, + uint32_t transaction_id, + uint32_t data_length, + uint32_t sequence_flag, + uint32_t display_priority, + uint32_t conference_id, + uint32_t app_instance_id, + uint32_t routing_id, + const char *data); + #endif /* _SKINNY_PROTOCOL_H */ /* For Emacs: diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index 3fa4aab..9456116 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -1864,6 +1864,30 @@ switch_status_t skinny_handle_register_available_lines_message(listener_t *liste return SWITCH_STATUS_SUCCESS; } +switch_status_t skinny_handle_data_message(listener_t *listener, skinny_message_t *request) +{ + switch_event_t *event = NULL; + char *tmp = NULL; + skinny_check_data_length(request, sizeof(request->data.data)); + skinny_check_data_length(request, sizeof(request->data.data) + request->data.data.data_length - 1); + + /* skinny::device_to_user event */ + skinny_device_event(listener, &event, SWITCH_EVENT_CUSTOM, SKINNY_EVENT_DEVICE_TO_USER); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Message-Id", "%d", request->type); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Message-Id-String", "%s", skinny_message_type2str(request->type)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Application-Id", "%d", request->data.data.application_id); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Line-Instance", "%d", request->data.data.line_instance); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Call-Id", "%d", request->data.data.call_id); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Transaction-Id", "%d", request->data.data.transaction_id); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Data-Length", "%d", request->data.data.data_length); + tmp = strndup(request->data.data.data, request->data.data.data_length); + switch_event_add_body(event, tmp); + switch_safe_free(tmp); + switch_event_fire(&event); + + return SWITCH_STATUS_SUCCESS; +} + switch_status_t skinny_handle_service_url_stat_request(listener_t *listener, skinny_message_t *request) { skinny_message_t *message; @@ -1904,6 +1928,35 @@ switch_status_t skinny_handle_feature_stat_request(listener_t *listener, skinny_ return SWITCH_STATUS_SUCCESS; } +switch_status_t skinny_handle_extended_data_message(listener_t *listener, skinny_message_t *request) +{ + switch_event_t *event = NULL; + char *tmp = NULL; + skinny_check_data_length(request, sizeof(request->data.extended_data)); + skinny_check_data_length(request, sizeof(request->data.extended_data)+request->data.extended_data.data_length-1); + + /* skinny::device_to_user event */ + skinny_device_event(listener, &event, SWITCH_EVENT_CUSTOM, SKINNY_EVENT_DEVICE_TO_USER); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Message-Id", "%d", request->type); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Message-Id-String", "%s", skinny_message_type2str(request->type)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Application-Id", "%d", request->data.extended_data.application_id); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Line-Instance", "%d", request->data.extended_data.line_instance); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Call-Id", "%d", request->data.extended_data.call_id); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Transaction-Id", "%d", request->data.extended_data.transaction_id); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Data-Length", "%d", request->data.extended_data.data_length); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Sequence-Flag", "%d", request->data.extended_data.sequence_flag); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Display-Priority", "%d", request->data.extended_data.display_priority); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Conference-Id", "%d", request->data.extended_data.conference_id); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-App-Instance-Id", "%d", request->data.extended_data.app_instance_id); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-DeviceToUser-Routing-Id", "%d", request->data.extended_data.routing_id); + tmp = strndup(request->data.extended_data.data, request->data.extended_data.data_length); + switch_event_add_body(event, tmp); + switch_safe_free(tmp); + switch_event_fire(&event); + + return SWITCH_STATUS_SUCCESS; +} + switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *request) { if (listener->profile->debug >= 10 || request->type != KEEP_ALIVE_MESSAGE) { @@ -1961,10 +2014,18 @@ switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *re return skinny_headset_status_message(listener, request); case REGISTER_AVAILABLE_LINES_MESSAGE: return skinny_handle_register_available_lines_message(listener, request); + case DEVICE_TO_USER_DATA_MESSAGE: + return skinny_handle_data_message(listener, request); + case DEVICE_TO_USER_DATA_RESPONSE_MESSAGE: + return skinny_handle_data_message(listener, request); case SERVICE_URL_STAT_REQ_MESSAGE: return skinny_handle_service_url_stat_request(listener, request); case FEATURE_STAT_REQ_MESSAGE: return skinny_handle_feature_stat_request(listener, request); + case DEVICE_TO_USER_DATA_VERSION1_MESSAGE: + return skinny_handle_extended_data_message(listener, request); + case DEVICE_TO_USER_DATA_RESPONSE_VERSION1_MESSAGE: + return skinny_handle_extended_data_message(listener, request); default: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unhandled request %s (type=%x,length=%d).\n", skinny_message_type2str(request->type), request->type, request->length); commit f5e7284d396a21d0740820230dbfaea324efa087 Author: Mathieu Parent <math.parent@gmail.com> Date: Thu Sep 23 21:30:00 2010 +0200 Skinny: struct for 6 more messages DeviceToUserDataMessage DeviceToUserDataResponseMessage DeviceToUserDataVersion1Message DeviceToUserDataResponseVersion1Message UserToDeviceDataMessage UserToDeviceDataVersion1Message diff --git a/src/mod/endpoints/mod_skinny/skinny_protocol.h b/src/mod/endpoints/mod_skinny/skinny_protocol.h index 236c667..567c1b1 100644 --- a/src/mod/endpoints/mod_skinny/skinny_protocol.h +++ b/src/mod/endpoints/mod_skinny/skinny_protocol.h @@ -174,6 +174,28 @@ struct PACKED register_available_lines_message { uint32_t count; }; +/* DeviceToUserDataMessage */ +#define DEVICE_TO_USER_DATA_MESSAGE 0x002E +struct PACKED device_to_user_data_message { + uint32_t application_id; + uint32_t line_instance; + uint32_t call_id; + uint32_t transaction_id; + uint32_t data_length; + char data[1]; +}; + +/* DeviceToUserDataResponseMessage */ +#define DEVICE_TO_USER_DATA_RESPONSE_MESSAGE 0x002F +struct PACKED device_to_user_data_response_message { + uint32_t application_id; + uint32_t line_instance; + uint32_t call_id; + uint32_t transaction_id; + uint32_t data_length; + char data[1]; +}; + /* ServiceUrlStatReqMessage */ #define SERVICE_URL_STAT_REQ_MESSAGE 0x0033 struct PACKED service_url_stat_req_message { @@ -186,6 +208,38 @@ struct PACKED feature_stat_req_message { uint32_t feature_index; }; +/* DeviceToUserDataVersion1Message */ +#define DEVICE_TO_USER_DATA_VERSION1_MESSAGE 0x0041 +struct PACKED device_to_user_data_version1_message { + uint32_t application_id; + uint32_t line_instance; + uint32_t call_id; + uint32_t transaction_id; + uint32_t data_length; + uint32_t sequence_flag; + uint32_t display_priority; + uint32_t conference_id; + uint32_t app_instance_id; + uint32_t routing_id; + char data[1]; +}; + +/* DeviceToUserDataResponseVersion1Message */ +#define DEVICE_TO_USER_DATA_RESPONSE_VERSION1_MESSAGE 0x0042 +struct PACKED device_to_user_data_response_version1_message { + uint32_t application_id; + uint32_t line_instance; + uint32_t call_id; + uint32_t transaction_id; + uint32_t data_length; + uint32_t sequence_flag; + uint32_t display_priority; + uint32_t conference_id; + uint32_t app_instance_id; + uint32_t routing_id; + char data[1]; +}; + /* RegisterAckMessage */ #define REGISTER_ACK_MESSAGE 0x0081 struct PACKED register_ack_message { @@ -479,6 +533,17 @@ struct PACKED dialed_number_message { uint32_t call_id; }; +/* UserToDeviceDataMessage */ +#define USER_TO_DEVICE_DATA_MESSAGE 0x011E +struct PACKED user_to_device_data_message { + uint32_t application_id; + uint32_t line_instance; + uint32_t call_id; + uint32_t transaction_id; + uint32_t data_length; + char data[1]; +}; + /* FeatureStatMessage */ #define FEATURE_STAT_RES_MESSAGE 0x011F struct PACKED feature_stat_res_message { @@ -504,6 +569,22 @@ struct PACKED service_url_stat_res_message { char display_name[40]; }; +/* UserToDeviceDataVersion1Message */ +#define USER_TO_DEVICE_DATA_VERSION1_MESSAGE 0x013F +struct PACKED user_to_device_data_version1_message { + uint32_t application_id; + uint32_t line_instance; + uint32_t call_id; + uint32_t transaction_id; + uint32_t data_length; + uint32_t sequence_flag; + uint32_t display_priority; + uint32_t conference_id; + uint32_t app_instance_id; + uint32_t routing_id; + char data[1]; +}; + /*****************************************************************************/ /* SKINNY MESSAGE */ /*****************************************************************************/ @@ -512,6 +593,7 @@ struct PACKED service_url_stat_res_message { #define SKINNY_MESSAGE_MAXSIZE 1000 union skinny_data { + /* no data for KEEP_ALIVE_MESSAGE */ struct register_message reg; struct port_message port; struct keypad_button_message keypad_button; @@ -520,14 +602,25 @@ union skinny_data { struct on_hook_message on_hook; struct speed_dial_stat_req_message speed_dial_req; struct line_stat_req_message line_req; + /* no data for CONFIG_STAT_REQ_MESSAGE */ + /* no data for TIME_DATE_REQ_MESSAGE */ + /* no data for BUTTON_TEMPLATE_REQ_MESSAGE */ + /* no data for VERSION_REQ_MESSAGE */ struct capabilities_res_message cap_res; struct alarm_message alarm; struct open_receive_channel_ack_message open_receive_channel_ack; + /* no data for SOFT_KEY_SET_REQ_MESSAGE */ struct soft_key_event_message soft_key_event; - struct service_url_stat_req_message service_url_req; - struct feature_stat_req_message feature_req; + /* no data for UNREGISTER_MESSAGE */ + /* no data for SOFT_KEY_TEMPLATE_REQ_MESSAGE */ struct headset_status_message headset_status; struct register_available_lines_message reg_lines; + struct device_to_user_data_message d2u_data; + struct device_to_user_data_response_message d2u_data_response; + struct service_url_stat_req_message service_url_req; + struct feature_stat_req_message feature_req; + struct device_to_user_data_version1_message d2u_data_v1; + struct device_to_user_data_response_version1_message d2u_data_response_v1; struct register_ack_message reg_ack; struct start_tone_message start_tone; struct stop_tone_message stop_tone; @@ -543,8 +636,10 @@ union skinny_data { struct define_time_date_message define_time_date; struct button_template_message button_template; struct version_message version; + /* no data for CAPABILITIES_REQ_MESSAGE */ struct register_reject_message reg_rej; struct reset_message reset; + /* no data for KEEP_ALIVE_ACK_MESSAGE */ struct open_receive_channel_message open_receive_channel; struct close_receive_channel_message close_receive_channel; struct soft_key_template_res_message soft_key_template; @@ -557,10 +652,11 @@ union skinny_data { struct unregister_ack_message unregister_ack; struct back_space_req_message back_space_req; struct dialed_number_message dialed_number; + struct user_to_device_data_message u2d_data; struct feature_stat_res_message feature_res; struct display_pri_notify_message display_pri_notify; struct service_url_stat_res_message service_url_res; - + struct user_to_device_data_version1_message u2d_data_v1; uint16_t as_uint16; char as_char; void *raw; diff --git a/src/mod/endpoints/mod_skinny/skinny_tables.c b/src/mod/endpoints/mod_skinny/skinny_tables.c index 43b2290..0a27ad7 100644 --- a/src/mod/endpoints/mod_skinny/skinny_tables.c +++ b/src/mod/endpoints/mod_skinny/skinny_tables.c @@ -55,10 +55,14 @@ struct skinny_table SKINNY_MESSAGE_TYPES[] = { {"SoftKeyEventMessage", SOFT_KEY_EVENT_MESSAGE}, {"UnregisterMessage", UNREGISTER_MESSAGE}, {"SoftKeyTemplateReqMessage", SOFT_KEY_TEMPLATE_REQ_MESSAGE}, - {"ServiceUrlStatReqMessage", SERVICE_URL_STAT_REQ_MESSAGE}, - {"FeatureStatReqMessage", FEATURE_STAT_REQ_MESSAGE}, {"HeadsetStatusMessage", HEADSET_STATUS_MESSAGE}, {"RegisterAvailableLinesMessage", REGISTER_AVAILABLE_LINES_MESSAGE}, + {"DeviceToUserDataMessage", DEVICE_TO_USER_DATA_MESSAGE}, + {"DeviceToUserDataResponseMessage", DEVICE_TO_USER_DATA_RESPONSE_MESSAGE}, + {"ServiceUrlStatReqMessage", SERVICE_URL_STAT_REQ_MESSAGE}, + {"FeatureStatReqMessage", FEATURE_STAT_REQ_MESSAGE}, + {"DeviceToUserDataVersion1Message", DEVICE_TO_USER_DATA_VERSION1_MESSAGE}, + {"DeviceToUserDataResponseVersion1Message", DEVICE_TO_USER_DATA_RESPONSE_VERSION1_MESSAGE}, {"RegisterAckMessage", REGISTER_ACK_MESSAGE}, {"StartToneMessage", START_TONE_MESSAGE}, {"StopToneMessage", STOP_TONE_MESSAGE}, @@ -90,9 +94,11 @@ struct skinny_table SKINNY_MESSAGE_TYPES[] = { {"UnregisterAckMessage", UNREGISTER_ACK_MESSAGE}, {"BackSpaceReqMessage", BACK_SPACE_REQ_MESSAGE}, {"DialedNumberMessage", DIALED_NUMBER_MESSAGE}, + {"UserToDeviceDataMessage", USER_TO_DEVICE_DATA_MESSAGE}, {"FeatureResMessage", FEATURE_STAT_RES_MESSAGE}, {"DisplayPriNotifyMessage", DISPLAY_PRI_NOTIFY_MESSAGE}, {"ServiceUrlStatMessage", SERVICE_URL_STAT_RES_MESSAGE}, + {"UserToDeviceDataVersion1Message", USER_TO_DEVICE_DATA_VERSION1_MESSAGE}, {NULL, 0} }; SKINNY_DECLARE_ID2STR(skinny_message_type2str, SKINNY_MESSAGE_TYPES, "UnknownMessage") diff --git a/src/mod/endpoints/mod_skinny/skinny_tables.h b/src/mod/endpoints/mod_skinny/skinny_tables.h index 1747360..14962b8 100644 --- a/src/mod/endpoints/mod_skinny/skinny_tables.h +++ b/src/mod/endpoints/mod_skinny/skinny_tables.h @@ -87,7 +87,7 @@ uint32_t func(const char *str)\ } -extern struct skinny_table SKINNY_MESSAGE_TYPES[59]; +extern struct skinny_table SKINNY_MESSAGE_TYPES[65]; const char *skinny_message_type2str(uint32_t id); uint32_t skinny_str2message_type(const char *str); #define SKINNY_PUSH_MESSAGE_TYPES SKINNY_DECLARE_PUSH_MATCH(SKINNY_MESSAGE_TYPES) commit cfa30468e89788d220ad9fbc07ab1ae3406cf3fa Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Sep 23 18:37:45 2010 -0500 sprinkle digit_timeout into switch_ivr_read and switch_ivr_play_and_get_digits and the higher level variants diff --git a/src/include/switch_cpp.h b/src/include/switch_cpp.h index ed14f10..0ede8e6 100644 --- a/src/include/switch_cpp.h +++ b/src/include/switch_cpp.h @@ -292,7 +292,8 @@ SWITCH_DECLARE(void) consoleCleanLog(char *msg); SWITCH_DECLARE(int) transfer(char *extension, char *dialplan = NULL, char *context = NULL); - SWITCH_DECLARE(char *) read(int min_digits, int max_digits, const char *prompt_audio_file, int timeout, const char *valid_terminators); + SWITCH_DECLARE(char *) read(int min_digits, int max_digits, + const char *prompt_audio_file, int timeout, const char *valid_terminators, int digit_timeout = 0); /** \brief Play a file into channel and collect dtmfs * @@ -306,7 +307,7 @@ SWITCH_DECLARE(void) consoleCleanLog(char *msg); int max_digits, int max_tries, int timeout, char *terminators, char *audio_files, char *bad_input_audio_files, - char *digits_regex, const char *var_name = NULL); + char *digits_regex, const char *var_name = NULL, int digit_timeout = 0); /** \brief Play a file that resides on disk into the channel * diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index 40ba1dc..4c562a5 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -369,7 +369,8 @@ SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t const char *audio_file, const char *bad_input_audio_file, const char *var_name, char *digit_buffer, uint32_t digit_buffer_length, - const char *digits_regex); + const char *digits_regex, + uint32_t digit_timeout); SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session_t *session, switch_speech_handle_t *sh, @@ -804,7 +805,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_read(switch_core_session_t *session, uint32_t max_digits, const char *prompt_audio_file, const char *var_name, - char *digit_buffer, switch_size_t digit_buffer_length, uint32_t timeout, const char *valid_terminators); + char *digit_buffer, + switch_size_t digit_buffer_length, + uint32_t timeout, + const char *valid_terminators, + uint32_t digit_timeout); + SWITCH_DECLARE(switch_status_t) switch_ivr_block_dtmf_session(switch_core_session_t *session); SWITCH_DECLARE(switch_status_t) switch_ivr_unblock_dtmf_session(switch_core_session_t *session); diff --git a/src/mod/applications/mod_directory/mod_directory.c b/src/mod/applications/mod_directory/mod_directory.c index bfad1a6..8464b1c 100644 --- a/src/mod/applications/mod_directory/mod_directory.c +++ b/src/mod/applications/mod_directory/mod_directory.c @@ -649,25 +649,25 @@ static switch_status_t listen_entry(switch_core_session_t *session, dir_profile_ if (zstr_buf(buf)) { switch_snprintf(macro, sizeof(macro), "phrase:%s:%d", DIR_RESULT_ITEM, cbt->want + 1); - switch_ivr_read(session, 0, 1, macro, NULL, buf, sizeof(buf), 1, profile->terminator_key); + switch_ivr_read(session, 0, 1, macro, NULL, buf, sizeof(buf), 1, profile->terminator_key, 0); } if (!zstr_buf(recorded_name) && zstr_buf(buf)) { - switch_ivr_read(session, 0, 1, recorded_name, NULL, buf, sizeof(buf), 1, profile->terminator_key); + switch_ivr_read(session, 0, 1, recorded_name, NULL, buf, sizeof(buf), 1, profile->terminator_key, 0); } if (zstr_buf(recorded_name) && zstr_buf(buf)) { switch_snprintf(macro, sizeof(macro), "phrase:%s:%s", DIR_RESULT_SAY_NAME, cbt->fullname); - switch_ivr_read(session, 0, 1, macro, NULL, buf, sizeof(buf), 1, profile->terminator_key); + switch_ivr_read(session, 0, 1, macro, NULL, buf, sizeof(buf), 1, profile->terminator_key, 0); } if (cbt->exten_visible && zstr_buf(buf)) { switch_snprintf(macro, sizeof(macro), "phrase:%s:%s", DIR_RESULT_AT, cbt->extension); - switch_ivr_read(session, 0, 1, macro, NULL, buf, sizeof(buf), 1, profile->terminator_key); + switch_ivr_read(session, 0, 1, macro, NULL, buf, sizeof(buf), 1, profile->terminator_key, 0); } if (zstr_buf(buf)) { switch_snprintf(macro, sizeof(macro), "phrase:%s:%c,%c,%c,%c", DIR_RESULT_MENU, *profile->select_name_key, *profile->next_key, *profile->prev_key, *profile->new_search_key); - switch_ivr_read(session, 0, 1, macro, NULL, buf, sizeof(buf), profile->digit_timeout, profile->terminator_key); + switch_ivr_read(session, 0, 1, macro, NULL, buf, sizeof(buf), profile->digit_timeout, profile->terminator_key, 0); } if (!zstr_buf(buf)) { diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 5542927..dd63f8a 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -1712,10 +1712,11 @@ SWITCH_STANDARD_APP(att_xfer_function) SWITCH_STANDARD_APP(read_function) { char *mydata; - char *argv[6] = { 0 }; + char *argv[7] = { 0 }; int argc; int32_t min_digits = 0; int32_t max_digits = 0; + uint32_t digit_timeout = 0; int timeout = 1000; char digit_buffer[128] = ""; const char *prompt_audio_file = NULL; @@ -1751,6 +1752,13 @@ SWITCH_STANDARD_APP(read_function) valid_terminators = argv[5]; } + if (argc > 6) { + digit_timeout = atoi(argv[6]); + if (digit_timeout < 0) { + digit_timeout = 0; + } + } + if (min_digits <= 1) { min_digits = 1; } @@ -1767,17 +1775,19 @@ SWITCH_STANDARD_APP(read_function) valid_terminators = "#"; } - switch_ivr_read(session, min_digits, max_digits, prompt_audio_file, var_name, digit_buffer, sizeof(digit_buffer), timeout, valid_terminators); + switch_ivr_read(session, min_digits, max_digits, prompt_audio_file, var_name, digit_buffer, sizeof(digit_buffer), timeout, valid_terminators, + digit_timeout); } SWITCH_STANDARD_APP(play_and_get_digits_function) { char *mydata; - char *argv[9] = { 0 }; + char *argv[10] = { 0 }; int argc; int32_t min_digits = 0; int32_t max_digits = 0; int32_t max_tries = 0; + uint32_t digit_timeout = 0; int timeout = 1000; char digit_buffer[128] = ""; const char *prompt_audio_file = NULL; @@ -1827,6 +1837,14 @@ SWITCH_STANDARD_APP(play_and_get_digits_function) digits_regex = argv[8]; } + if (argc > 9) { + digit_timeout = atoi(argv[9]); + if (digit_timeout < 0) { + digit_timeout = 0; + } + } + + if (min_digits <= 1) { min_digits = 1; } @@ -1844,7 +1862,7 @@ SWITCH_STANDARD_APP(play_and_get_digits_function) } switch_play_and_get_digits(session, min_digits, max_digits, max_tries, timeout, valid_terminators, - prompt_audio_file, bad_input_audio_file, var_name, digit_buffer, sizeof(digit_buffer), digits_regex); + prompt_audio_file, bad_input_audio_file, var_name, digit_buffer, sizeof(digit_buffer), digits_regex, digit_timeout); } #define SAY_SYNTAX "<module_name> <say_type> <say_method> [<say_gender>] <text>" @@ -3367,9 +3385,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) SWITCH_ADD_APP(app_interface, "endless_playback", "Playback File Endlessly", "Endlessly Playback a file to the channel", endless_playback_function, "<path>", SAF_NONE); SWITCH_ADD_APP(app_interface, "att_xfer", "Attended Transfer", "Attended Transfer", att_xfer_function, "<channel_url>", SAF_NONE); - SWITCH_ADD_APP(app_interface, "read", "Read Digits", "Read Digits", read_function, "<min> <max> <file> <var_name> <timeout> <terminators>", SAF_NONE); + SWITCH_ADD_APP(app_interface, "read", "Read Digits", "Read Digits", read_function, + "<min> <max> <file> <var_name> <timeout> <terminators> <digit_timeout>", SAF_NONE); SWITCH_ADD_APP(app_interface, "play_and_get_digits", "Play and get Digits", "Play and get Digits", - play_and_get_digits_function, "<min> <max> <tries> <timeout> <terminators> <file> <invalid_file> <var_name> <regexp>", SAF_NONE); + play_and_get_digits_function, + "<min> <max> <tries> <timeout> <terminators> <file> <invalid_file> <var_name> <regexp> [<digit_timeout>]", SAF_NONE); SWITCH_ADD_APP(app_interface, "stop_record_session", "Stop Record Session", STOP_SESS_REC_DESC, stop_record_session_function, "<path>", SAF_NONE); SWITCH_ADD_APP(app_interface, "record_session", "Record Session", SESS_REC_DESC, record_session_function, "<path> [+<timeout>]", SAF_MEDIA_TAP); SWITCH_ADD_APP(app_interface, "record", "Record File", "Record a file from the channels input", record_function, diff --git a/src/mod/applications/mod_valet_parking/mod_valet_parking.c b/src/mod/applications/mod_valet_parking/mod_valet_parking.c index aee49c7..b752021 100644 --- a/src/mod/applications/mod_valet_parking/mod_valet_parking.c +++ b/src/mod/applications/mod_valet_parking/mod_valet_parking.c @@ -203,7 +203,7 @@ SWITCH_STANDARD_APP(valet_parking_function) } do { - status = switch_ivr_read(session, min, max, prompt, NULL, dtmf_buf, sizeof(dtmf_buf), to, "#"); + status = switch_ivr_read(session, min, max, prompt, NULL, dtmf_buf, sizeof(dtmf_buf), to, "#", 0); } while (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_FALSE); if (status == SWITCH_STATUS_SUCCESS) { diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 84e3ec4..0b1d698 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -1524,7 +1524,7 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t vm_cc[0] = '\0'; TRY_CODE(switch_ivr_read - (session, 0, sizeof(vm_cc), macro_buf, NULL, vm_cc, sizeof(vm_cc), profile->digit_timeout, profile->terminator_key)); + (session, 0, sizeof(vm_cc), macro_buf, NULL, vm_cc, sizeof(vm_cc), profile->digit_timeout, profile->terminator_key, 0)); cmd = switch_core_session_sprintf(session, "%s@%s %s %s '%s'", vm_cc, cbt->domain, new_file_path, cbt->cid_number, cbt->cid_name); @@ -1988,7 +1988,7 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p switch_xml_t xx_user, xx_domain, xx_domain_root; switch_snprintf(macro, sizeof(macro), "phrase:%s:%s", VM_ENTER_PASS_MACRO, profile->terminator_key); - TRY_CODE(switch_ivr_read(session, 0, 255, macro, NULL, buf, sizeof(buf), 10000, profile->terminator_key)); + TRY_CODE(switch_ivr_read(session, 0, 255, macro, NULL, buf, sizeof(buf), 10000, profile->terminator_key, 0)); sql = switch_mprintf("update voicemail_prefs set password='%s' where username='%s' and domain='%s'", buf, myid, domain_name); vm_execute_sql(profile, sql, profile->mutex); switch_safe_free(file_path); diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index b4c7ddd..bfb36ab 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -12098,6 +12098,20 @@ SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_char_to_rfc2833(char jarg1) { } +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_default_ptime(char * jarg1, unsigned long jarg2) { + unsigned long jresult ; + char *arg1 = (char *) 0 ; + uint32_t arg2 ; + uint32_t result; + + arg1 = (char *)jarg1; + arg2 = (uint32_t)jarg2; + result = (uint32_t)switch_default_ptime((char const *)arg1,arg2); + jresult = (unsigned long)result; + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_switch_sanitize_number(char * jarg1) { char * jresult ; char *arg1 = (char *) 0 ; @@ -26802,7 +26816,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_record_file(void * jarg1, void * ja } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_play_and_get_digits(void * jarg1, unsigned long jarg2, unsigned long jarg3, unsigned long jarg4, unsigned long jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10, unsigned long jarg11, char * jarg12) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_play_and_get_digits(void * jarg1, unsigned long jarg2, unsigned long jarg3, unsigned long jarg4, unsigned long jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10, unsigned long jarg11, char * jarg12, unsigned long jarg13) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; uint32_t arg2 ; @@ -26816,6 +26830,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_play_and_get_digits(void * jarg1, unsig char *arg10 = (char *) 0 ; uint32_t arg11 ; char *arg12 = (char *) 0 ; + uint32_t arg13 ; switch_status_t result; arg1 = (switch_core_session_t *)jarg1; @@ -26830,7 +26845,8 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_play_and_get_digits(void * jarg1, unsig arg10 = (char *)jarg10; arg11 = (uint32_t)jarg11; arg12 = (char *)jarg12; - result = (switch_status_t)switch_play_and_get_digits(arg1,arg2,arg3,arg4,arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,arg10,arg11,(char const *)arg12); + arg13 = (uint32_t)jarg13; + result = (switch_status_t)switch_play_and_get_digits(arg1,arg2,arg3,arg4,arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,arg10,arg11,(char const *)arg12,arg13); jresult = result; return jresult; } @@ -27604,7 +27620,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_wait_for_answer(void * jarg1, void } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_read(void * jarg1, unsigned long jarg2, unsigned long jarg3, char * jarg4, char * jarg5, char * jarg6, void * jarg7, unsigned long jarg8, char * jarg9) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_read(void * jarg1, unsigned long jarg2, unsigned long jarg3, char * jarg4, char * jarg5, char * jarg6, void * jarg7, unsigned long jarg8, char * jarg9, unsigned long jarg10) { int jresult ; switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; uint32_t arg2 ; @@ -27615,6 +27631,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_read(void * jarg1, unsigned long ja switch_size_t arg7 ; uint32_t arg8 ; char *arg9 = (char *) 0 ; + uint32_t arg10 ; switch_status_t result; switch_size_t *argp7 ; @@ -27632,7 +27649,8 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_read(void * jarg1, unsigned long ja arg7 = *argp7; arg8 = (uint32_t)jarg8; arg9 = (char *)jarg9; - result = (switch_status_t)switch_ivr_read(arg1,arg2,arg3,(char const *)arg4,(char const *)arg5,arg6,arg7,arg8,(char const *)arg9); + arg10 = (uint32_t)jarg10; + result = (switch_status_t)switch_ivr_read(arg1,arg2,arg3,(char const *)arg4,(char const *)arg5,arg6,arg7,arg8,(char const *)arg9,arg10); jresult = result; return jresult; } @@ -33600,7 +33618,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_Transfer(void * jarg1, char * jarg } -SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_read(void * jarg1, int jarg2, int jarg3, char * jarg4, int jarg5, char * jarg6) { +SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_read(void * jarg1, int jarg2, int jarg3, char * jarg4, int jarg5, char * jarg6, int jarg7) { char * jresult ; CoreSession *arg1 = (CoreSession *) 0 ; int arg2 ; @@ -33608,6 +33626,7 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_read(void * jarg1, int jarg2, i char *arg4 = (char *) 0 ; int arg5 ; char *arg6 = (char *) 0 ; + int arg7 = (int) 0 ; char *result = 0 ; arg1 = (CoreSession *)jarg1; @@ -33616,13 +33635,14 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_read(void * jarg1, int jarg2, i arg4 = (char *)jarg4; arg5 = (int)jarg5; arg6 = (char *)jarg6; - result = (char *)(arg1)->read(arg2,arg3,(char const *)arg4,arg5,(char const *)arg6); + arg7 = (int)jarg7; + result = (char *)(arg1)->read(arg2,arg3,(char const *)arg4,arg5,(char const *)arg6,arg7); jresult = SWIG_csharp_string_callback((const char *)result); return jresult; } -SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_PlayAndGetDigits(void * jarg1, int jarg2, int jarg3, int jarg4, int jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10) { +SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_PlayAndGetDigits(void * jarg1, int jarg2, int jarg3, int jarg4, int jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10, int jarg11) { char * jresult ; CoreSession *arg1 = (CoreSession *) 0 ; int arg2 ; @@ -33634,6 +33654,7 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_PlayAndGetDigits(void * jarg1, char *arg8 = (char *) 0 ; char *arg9 = (char *) 0 ; char *arg10 = (char *) NULL ; + int arg11 = (int) 0 ; char *result = 0 ; arg1 = (CoreSession *)jarg1; @@ -33646,7 +33667,8 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_PlayAndGetDigits(void * jarg1, arg8 = (char *)jarg8; arg9 = (char *)jarg9; arg10 = (char *)jarg10; - result = (char *)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,(char const *)arg10); + arg11 = (int)jarg11; + result = (char *)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,(char const *)arg10,arg11); jresult = SWIG_csharp_string_callback((const char *)result); return jresult; } diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index 5f412f4..59d278b 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -323,13 +323,13 @@ public class CoreSession : IDisposable { return ret; } - public string read(int min_digits, int max_digits, string prompt_audio_file, int timeout, string valid_terminators) { - string ret = freeswitchPINVOKE.CoreSession_read(swigCPtr, min_digits, max_digits, prompt_audio_file, timeout, valid_terminators); + public string read(int min_digits, int max_digits, string prompt_audio_file, int timeout, string valid_terminators, int digit_timeout) { + string ret = freeswitchPINVOKE.CoreSession_read(swigCPtr, min_digits, max_digits, prompt_audio_file, timeout, valid_terminators, digit_timeout); return ret; } - public string PlayAndGetDigits(int min_digits, int max_digits, int max_tries, int timeout, string terminators, string audio_files, string bad_input_audio_files, string digits_regex, string var_name) { - string ret = freeswitchPINVOKE.CoreSession_PlayAndGetDigits(swigCPtr, min_digits, max_digits, max_tries, timeout, terminators, audio_files, bad_input_audio_files, digits_regex, var_name); + public string PlayAndGetDigits(int min_digits, int max_digits, int max_tries, int timeout, string terminators, string audio_files, string bad_input_audio_files, string digits_regex, string var_name, int digit_timeout) { + string ret = freeswitchPINVOKE.CoreSession_PlayAndGetDigits(swigCPtr, min_digits, max_digits, max_tries, timeout, terminators, audio_files, bad_input_audio_files, digits_regex, var_name, digit_timeout); return ret; } @@ -2715,6 +2715,11 @@ public class freeswitch { return ret; } + public static uint switch_default_ptime(string name, uint number) { + uint ret = freeswitchPINVOKE.switch_default_ptime(name, number); + return ret; + } + public static string switch_sanitize_number(string number) { string ret = freeswitchPINVOKE.switch_sanitize_number(number); return ret; @@ -4009,8 +4014,8 @@ public class freeswitch { return ret; } - public static switch_status_t switch_play_and_get_digits(SWIGTYPE_p_switch_core_session session, uint min_digits, uint max_digits, uint max_tries, uint timeout, string valid_terminators, string audio_file, string bad_input_audio_file, string var_name, string digit_buffer, uint digit_buffer_length, string digits_regex) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_play_and_get_digits(SWIGTYPE_p_switch_core_session.getCPtr(session), min_digits, max_digits, max_tries, timeout, valid_terminators, audio_file, bad_input_audio_file, var_name, digit_buffer, digit_buffer_length, digits_regex); + public static switch_status_t switch_play_and_get_digits(SWIGTYPE_p_switch_core_session session, uint min_digits, uint max_digits, uint max_tries, uint timeout, string valid_terminators, string audio_file, string bad_input_audio_file, string var_name, string digit_buffer, uint digit_buffer_length, string digits_regex, uint digit_timeout) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_play_and_get_digits(SWIGTYPE_p_switch_core_session.getCPtr(session), min_digits, max_digits, max_tries, timeout, valid_terminators, audio_file, bad_input_audio_file, var_name, digit_buffer, digit_buffer_length, digits_regex, digit_timeout); return ret; } @@ -4239,8 +4244,8 @@ public class freeswitch { return ret; } - public static switch_status_t switch_ivr_read(SWIGTYPE_p_switch_core_session session, uint min_digits, uint max_digits, string prompt_audio_file, string var_name, string digit_buffer, SWIGTYPE_p_switch_size_t digit_buffer_length, uint timeout, string valid_terminators) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_read(SWIGTYPE_p_switch_core_session.getCPtr(session), min_digits, max_digits, prompt_audio_file, var_name, digit_buffer, SWIGTYPE_p_switch_size_t.getCPtr(digit_buffer_length), timeout, valid_terminators); + public static switch_status_t switch_ivr_read(SWIGTYPE_p_switch_core_session session, uint min_digits, uint max_digits, string prompt_audio_file, string var_name, string digit_buffer, SWIGTYPE_p_switch_size_t digit_buffer_length, uint timeout, string valid_terminators, uint digit_timeout) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_read(SWIGTYPE_p_switch_core_session.getCPtr(session), min_digits, max_digits, prompt_audio_file, var_name, digit_buffer, SWIGTYPE_p_switch_size_t.getCPtr(digit_buffer_length), timeout, valid_terminators, digit_timeout); if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); return ret; } @@ -8288,6 +8293,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_char_to_rfc2833")] public static extern byte switch_char_to_rfc2833(char jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_default_ptime")] + public static extern uint switch_default_ptime(string jarg1, uint jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_sanitize_number")] public static extern string switch_sanitize_number(string jarg1); @@ -11793,7 +11801,7 @@ class freeswitchPINVOKE { public static extern int switch_ivr_record_file(HandleRef jarg1, HandleRef jarg2, string jarg3, HandleRef jarg4, uint jarg5); [DllImport("mod_managed", EntryPoint="CSharp_switch_play_and_get_digits")] - public static extern int switch_play_and_get_digits(HandleRef jarg1, uint jarg2, uint jarg3, uint jarg4, uint jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, uint jarg11, string jarg12); + public static extern int switch_play_and_get_digits(HandleRef jarg1, uint jarg2, uint jarg3, uint jarg4, uint jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, uint jarg11, string jarg12, uint jarg13); [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_speak_text_handle")] public static extern int switch_ivr_speak_text_handle(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, string jarg5, HandleRef jarg6); @@ -11931,7 +11939,7 @@ class freeswitchPINVOKE { public static extern int switch_ivr_wait_for_answer(HandleRef jarg1, HandleRef jarg2); [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_read")] - public static extern int switch_ivr_read(HandleRef jarg1, uint jarg2, uint jarg3, string jarg4, string jarg5, string jarg6, HandleRef jarg7, uint jarg8, string jarg9); + public static extern int switch_ivr_read(HandleRef jarg1, uint jarg2, uint jarg3, string jarg4, string jarg5, string jarg6, HandleRef jarg7, uint jarg8, string jarg9, uint jarg10); [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_block_dtmf_session")] public static extern int switch_ivr_block_dtmf_session(HandleRef jarg1); @@ -13338,10 +13346,10 @@ class freeswitchPINVOKE { public static extern int CoreSession_Transfer(HandleRef jarg1, string jarg2, string jarg3, string jarg4); [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_read")] - public static extern string CoreSession_read(HandleRef jarg1, int jarg2, int jarg3, string jarg4, int jarg5, string jarg6); + public static extern string CoreSession_read(HandleRef jarg1, int jarg2, int jarg3, string jarg4, int jarg5, string jarg6, int jarg7); [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_PlayAndGetDigits")] - public static extern string CoreSession_PlayAndGetDigits(HandleRef jarg1, int jarg2, int jarg3, int jarg4, int jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10); + public static extern string CoreSession_PlayAndGetDigits(HandleRef jarg1, int jarg2, int jarg3, int jarg4, int jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, int jarg11); [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_StreamFile")] public static extern int CoreSession_StreamFile(HandleRef jarg1, string jarg2, int jarg3); diff --git a/src/mod/languages/mod_perl/mod_perl_wrap.cpp b/src/mod/languages/mod_perl/mod_perl_wrap.cpp index 5ba899f..b615b9d 100644 --- a/src/mod/languages/mod_perl/mod_perl_wrap.cpp +++ b/src/mod/languages/mod_perl/mod_perl_wrap.cpp @@ -9708,17 +9708,17 @@ XS(SWIG_init) { SWIG_TypeClientData(SWIGTYPE_p_IVRMenu, (void*) "freeswitch::IVRMenu"); SWIG_TypeClientData(SWIGTYPE_p_API, (void*) "freeswitch::API"); SWIG_TypeClientData(SWIGTYPE_p_input_callback_state, (void*) "freeswitch::input_callback_state_t"); - /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_HUP", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_HUP))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; - /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_FREE", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_FREE))); SvREADONLY_on(sv); } while(0) /*@SWIG@*/; - /*@SWIG:/usr/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { + /*@SWIG:/usr/local/share/swig/1.3.35/perl5/perltypemaps.swg,64,%set_constant@*/ do { SV *sv = get_sv((char*) SWIG_prefix "S_RDLOCK", TRUE | 0x2 | GV_ADDMULTI); sv_setsv(sv, SWIG_From_int SWIG_PERL_CALL_ARGS_1(static_cast< int >(S_RDLOCK))); SvREADONLY_on(sv); diff --git a/src/switch_cpp.cpp b/src/switch_cpp.cpp index 5368cdd..469ae18 100644 --- a/src/switch_cpp.cpp +++ b/src/switch_cpp.cpp @@ -775,7 +775,8 @@ SWITCH_DECLARE(char *) CoreSession::read(int min_digits, int max_digits, const char *prompt_audio_file, int timeout, - const char *valid_terminators) + const char *valid_terminators, + int digit_timeout) { this_check((char *)""); sanity_check((char *)""); @@ -792,7 +793,8 @@ SWITCH_DECLARE(char *) CoreSession::read(int min_digits, } begin_allow_threads(); - switch_ivr_read(session, min_digits, max_digits, prompt_audio_file, NULL, dtmf_buf, sizeof(dtmf_buf), timeout, valid_terminators); + switch_ivr_read(session, min_digits, max_digits, prompt_audio_file, NULL, dtmf_buf, + sizeof(dtmf_buf), timeout, valid_terminators, (uint32_t)digit_timeout); end_allow_threads(); return dtmf_buf; @@ -806,7 +808,8 @@ SWITCH_DECLARE(char *) CoreSession::playAndGetDigits(int min_digits, char *audio_files, char *bad_input_audio_files, char *digits_regex, - const char *var_name) + const char *var_name, + int digit_timeout) { switch_status_t status; sanity_check((char *)""); @@ -824,7 +827,8 @@ SWITCH_DECLARE(char *) CoreSession::playAndGetDigits(int min_digits, var_name, dtmf_buf, sizeof(dtmf_buf), - digits_regex); + digits_regex, + (uint32_t) digit_timeout); end_allow_threads(); return dtmf_buf; diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 22b26eb..b9c4102 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -212,7 +212,7 @@ static void *SWITCH_THREAD_FUNC collect_thread_run(switch_thread_t *thread, void status = switch_ivr_read(collect->session, len, len, - collect->file, NULL, buf, sizeof(buf), collect->confirm_timeout, NULL); + collect->file, NULL, buf, sizeof(buf), collect->confirm_timeout, NULL, 0); if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK && status != SWITCH_STATUS_TOO_SMALL) { diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 75ed2d6..d75af10 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -1645,7 +1645,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_read(switch_core_session_t *session, uint32_t max_digits, const char *prompt_audio_file, const char *var_name, - char *digit_buffer, switch_size_t digit_buffer_length, uint32_t timeout, const char *valid_terminators) + char *digit_buffer, + switch_size_t digit_buffer_length, + uint32_t timeout, + const char *valid_terminators, + uint32_t digit_timeout) + { switch_channel_t *channel; switch_input_args_t args = { 0 }; @@ -1696,7 +1701,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_read(switch_core_session_t *session, if ((min_digits && len < min_digits) || len < max_digits) { args.buf = digit_buffer + len; args.buflen = (uint32_t) (digit_buffer_length - len); - status = switch_ivr_collect_digits_count(session, digit_buffer, digit_buffer_length, max_digits, valid_terminators, &tb[0], timeout, 0, 0); + status = switch_ivr_collect_digits_count(session, digit_buffer, digit_buffer_length, max_digits, valid_terminators, &tb[0], + len ? digit_timeout : timeout, digit_timeout, 0); } @@ -1745,7 +1751,10 @@ SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t const char *prompt_audio_file, const char *bad_input_audio_file, const char *var_name, - char *digit_buffer, uint32_t digit_buffer_length, const char *digits_regex) + char *digit_buffer, + uint32_t digit_buffer_length, + const char *digits_regex, + uint32_t digit_timeout) { switch_channel_t *channel = switch_core_session_get_channel(session); @@ -1755,7 +1764,7 @@ SWITCH_DECLARE(switch_status_t) switch_play_and_get_digits(switch_core_session_t memset(digit_buffer, 0, digit_buffer_length); switch_channel_flush_dtmf(channel); status = switch_ivr_read(session, min_digits, max_digits, prompt_audio_file, var_name, - digit_buffer, digit_buffer_length, timeout, valid_terminators); + digit_buffer, digit_buffer_length, timeout, valid_terminators, digit_timeout); if (status == SWITCH_STATUS_TIMEOUT && strlen(digit_buffer) >= min_digits) { status = SWITCH_STATUS_SUCCESS; } commit f825d1b0adae20e4ccb351b9655ab3da260643a7 Author: Arnaldo Pereira <arnaldo@sangoma.com> Date: Thu Sep 23 17:51:45 2010 -0300 merged threaded ftmod_r2.c with non-threaded version from moy and added support for receiving the events to wait for, on ftdm_span_poll_event(), which keeps its default behavior: POLLPRI if NULL is passed diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 18ae87c..2ffa268 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -895,12 +895,12 @@ FT_DECLARE(ftdm_status_t) ftdm_span_find(uint32_t id, ftdm_span_t **span) } -FT_DECLARE(ftdm_status_t) ftdm_span_poll_event(ftdm_span_t *span, uint32_t ms) +FT_DECLARE(ftdm_status_t) ftdm_span_poll_event(ftdm_span_t *span, uint32_t ms, short *poll_events) { assert(span->fio != NULL); if (span->fio->poll_event) { - return span->fio->poll_event(span, ms); + return span->fio->poll_event(span, ms, poll_events); } else { ftdm_log(FTDM_LOG_ERROR, "poll_event method not implemented in module %s!", span->fio->name); } diff --git a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c index 4dce190..dacda7e 100644 --- a/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c +++ b/libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c @@ -966,7 +966,7 @@ static void *ftdm_analog_run(ftdm_thread_t *me, void *obj) int waitms = 1000; ftdm_status_t status; - if ((status = ftdm_span_poll_event(span, waitms)) != FTDM_FAIL) { + if ((status = ftdm_span_poll_event(span, waitms, NULL)) != FTDM_FAIL) { errs = 0; } diff --git a/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c b/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c index 081665b..199bba4 100644 --- a/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c +++ b/libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.c @@ -657,7 +657,7 @@ static void *ftdm_analog_em_run(ftdm_thread_t *me, void *obj) int waitms = 10; ftdm_status_t status; - status = ftdm_span_poll_event(span, waitms); + status = ftdm_span_poll_event(span, waitms, NULL); switch(status) { case FTDM_SUCCESS: diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c index 3715e98..65c9dfc 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@ -1558,7 +1558,7 @@ static __inline__ void check_events(ftdm_span_t *span) { ftdm_status_t status; - status = ftdm_span_poll_event(span, 5); + status = ftdm_span_poll_event(span, 5, NULL); switch(status) { case FTDM_SUCCESS: diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index ba4049a..2dc223e 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -890,7 +890,7 @@ static __inline__ void check_events(ftdm_span_t *span) { ftdm_status_t status; - status = ftdm_span_poll_event(span, 5); + status = ftdm_span_poll_event(span, 5, NULL); switch(status) { case FTDM_SUCCESS: diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 564a812..53d00d1 100644 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -32,23 +32,36 @@ */ #include <stdio.h> +#ifdef __linux__ +#include <syscall.h> +#include <poll.h> +#endif #include <openr2.h> +#include "freetdm.h" #include "private/ftdm_core.h" /* debug thread count for r2 legs */ static ftdm_mutex_t* g_thread_count_mutex; static int32_t g_thread_count = 0; +typedef int openr2_call_status_t; + /* when the users kills a span we clear this flag to kill the signaling thread */ /* FIXME: what about the calls that are already up-and-running? */ typedef enum { FTDM_R2_RUNNING = (1 << 0), } ftdm_r2_flag_t; +typedef enum { + FTDM_R2_PROCESSING = (1 << 0), + FTDM_R2_WAITING_ACK = (1 << 1), +} ftdm_r2_call_flag_t; + /* private call information stored in ftdmchan->call_data void* ptr */ #define R2CALL(ftdmchan) ((ftdm_r2_call_t*)((ftdmchan)->call_data)) typedef struct ftdm_r2_call_t { - openr2_chan_t *r2chan; + openr2_chan_t *r2chan; + ftdm_r2_call_flag_t flags; int accepted:1; int answer_pending:1; int state_ack_pending:1; @@ -58,6 +71,7 @@ typedef struct ftdm_r2_call_t { ftdm_size_t dnis_index; ftdm_size_t ani_index; char name[10]; + unsigned long txdrops; } ftdm_r2_call_t; /* this is just used as place holder in the stack when configuring the span to avoid using bunch of locals */ @@ -82,6 +96,7 @@ typedef struct ft_r2_conf_s { int skip_category; int get_ani_first; int call_files; + int mf_files; int double_answer; int charge_calls; int forced_release; @@ -104,6 +119,12 @@ typedef struct ftdm_r2_data_s { int forced_release:1; /* whether accept the call when offered, or wait until the user decides to accept */ int accept_on_offer:1; + /* max time spent in ms doing real work in a single loop */ + int jobmax; + /* total working loops */ + unsigned long loops; + /* LWP */ + unsigned long monitor_thread_id; } ftdm_r2_data_t; /* one element per span will be stored in g_mod_data_hash global var to keep track of them @@ -116,9 +137,6 @@ typedef struct ftdm_r2_span_pvt_s { /* span monitor thread */ static void *ftdm_r2_run(ftdm_thread_t *me, void *obj); -/* channel monitor thread */ -static void *ftdm_r2_channel_run(ftdm_thread_t *me, void *obj); - /* hash of all the private span allocations we need to keep track of them to destroy them when unloading the module since freetdm does not notify signaling modules when destroying a span @@ -128,6 +146,82 @@ static ftdm_hash_t *g_mod_data_hash; /* IO interface for the command API */ static ftdm_io_interface_t g_ftdm_r2_interface; +static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan); + +static ftdm_call_cause_t ftdm_r2_cause_to_ftdm_cause(ftdm_channel_t *fchan, openr2_call_disconnect_cause_t cause) +{ + switch (cause) { + + case OR2_CAUSE_NORMAL_CLEARING: + return FTDM_CAUSE_NORMAL_CLEARING; + + case OR2_CAUSE_BUSY_NUMBER: + return FTDM_CAUSE_USER_BUSY; + + case OR2_CAUSE_NETWORK_CONGESTION: + return FTDM_CAUSE_SWITCH_CONGESTION; + + case OR2_CAUSE_UNALLOCATED_NUMBER: + return FTDM_CAUSE_NO_ROUTE_DESTINATION; + + case OR2_CAUSE_NUMBER_CHANGED: + return FTDM_CAUSE_NUMBER_CHANGED; + + case OR2_CAUSE_OUT_OF_ORDER: + return FTDM_CAUSE_NETWORK_OUT_OF_ORDER; + + case OR2_CAUSE_NO_ANSWER: + return FTDM_CAUSE_NO_ANSWER; + + case OR2_CAUSE_UNSPECIFIED: + return FTDM_CAUSE_NORMAL_UNSPECIFIED; + + case OR2_CAUSE_COLLECT_CALL_REJECTED: + return FTDM_CAUSE_CALL_REJECTED; + + case OR2_CAUSE_FORCED_RELEASE: + return FTDM_CAUSE_NORMAL_CLEARING; + } + ftdm_log_chan(fchan, FTDM_LOG_WARNING, "Mapping openr2 cause %d to unspecified\n", cause); + return FTDM_CAUSE_NORMAL_UNSPECIFIED; +} + +static openr2_call_disconnect_cause_t ftdm_r2_ftdm_cause_to_openr2_cause(ftdm_channel_t *fchan) +{ + switch (fchan->caller_data.hangup_cause) { + + case FTDM_CAUSE_NORMAL_CLEARING: + return OR2_CAUSE_NORMAL_CLEARING; + + case FTDM_CAUSE_USER_BUSY: + return OR2_CAUSE_BUSY_NUMBER; + + case FTDM_CAUSE_SWITCH_CONGESTION: + return OR2_CAUSE_NETWORK_CONGESTION; + + case FTDM_CAUSE_NO_ROUTE_DESTINATION: + return OR2_CAUSE_UNALLOCATED_NUMBER; + + case FTDM_CAUSE_NUMBER_CHANGED: + return OR2_CAUSE_NUMBER_CHANGED; + + case FTDM_CAUSE_NETWORK_OUT_OF_ORDER: + case FTDM_CAUSE_SERVICE_UNAVAILABLE: + return OR2_CAUSE_OUT_OF_ORDER; + + case FTDM_CAUSE_NO_ANSWER: + case FTDM_CAUSE_NO_USER_RESPONSE: + return OR2_CAUSE_NO_ANSWER; + + case FTDM_CAUSE_NORMAL_UNSPECIFIED: + return OR2_CAUSE_UNSPECIFIED; + + } + ftdm_log_chan(fchan, FTDM_LOG_WARNING, "freetdm hangup cause %d mapped to openr2 cause %s\n", + fchan->caller_data.hangup_cause, openr2_proto_get_disconnect_string(OR2_CAUSE_UNSPECIFIED)); + return OR2_CAUSE_UNSPECIFIED; +} + static void ft_r2_clean_call(ftdm_r2_call_t *call) { openr2_chan_t *r2chan = call->r2chan; @@ -143,7 +237,6 @@ static void ft_r2_accept_call(ftdm_channel_t *ftdmchan) // hanging up the call with protocol error as the reason, this openr2 API will fail only when there something // wrong at the I/O layer or the library itself openr2_chan_accept_call(r2chan, OR2_CALL_NO_CHARGE); - R2CALL(ftdmchan)->accepted = 1; } static void ft_r2_answer_call(ftdm_channel_t *ftdmchan) @@ -157,37 +250,66 @@ static void ft_r2_answer_call(ftdm_channel_t *ftdmchan) R2CALL(ftdmchan)->answer_pending = 0; } +/* this function must be called with the chan mutex held! */ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(r2_outgoing_call) { - ftdm_status_t status; - ftdm_mutex_lock(ftdmchan->mutex); + openr2_call_status_t callstatus; + ftdm_r2_data_t *r2data; + int safety = 100; - /* the channel may be down but the thread not quite done */ - ftdm_wait_for_flag_cleared(ftdmchan, FTDM_CHANNEL_INTHREAD, 200); + r2data = ftdmchan->span->signal_data; - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INTHREAD)) { - ftdm_log(FTDM_LOG_ERROR, "%d:%d Yay! R2 outgoing call in channel that is already in thread.\n", - ftdmchan->span_id, ftdmchan->chan_id); - ftdm_mutex_unlock(ftdmchan->mutex); + if (ftdmchan->state != FTDM_CHANNEL_STATE_DOWN) { + /* collision, an incoming seized the channel between our take and use timing */ + ftdm_log_chan(ftdmchan, + FTDM_LOG_CRIT, "R2 cannot dial out in channel in state %s, try another channel!.\n", ftdm_channel_state2str(ftdmchan->state)); return FTDM_FAIL; } ft_r2_clean_call(ftdmchan->call_data); - R2CALL(ftdmchan)->chanstate = FTDM_CHANNEL_STATE_DOWN; - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DIALING); - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND); R2CALL(ftdmchan)->ftdm_started = 1; - ftdm_mutex_unlock(ftdmchan->mutex); + R2CALL(ftdmchan)->chanstate = FTDM_CHANNEL_STATE_DOWN; + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DIALING); + + callstatus = openr2_chan_make_call(R2CALL(ftdmchan)->r2chan, + ftdmchan->caller_data.cid_num.digits, + ftdmchan->caller_data.dnis.digits, + OR2_CALLING_PARTY_CATEGORY_NATIONAL_SUBSCRIBER); + + if (callstatus) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Failed to make call in R2 channel, openr2_chan_make_call failed\n"); + return FTDM_FAIL; + } + + /* this waiting for flag cleared function releases the ftdmchan lock to give a chance to the monitor thread + * to process openr2 events and dial out, or see if an incoming call is arriving just now, then openr2 will + * call in the monitor thread the on_call_collision or on_call_acknowledged callbacks where this flag + * will be cleared, the lock will be re-acquired here and we continue within this function to inform the user + * whether the call is being placed or collision occurred and another channel must be hunted */ + ftdm_set_flag(R2CALL(ftdmchan), FTDM_R2_WAITING_ACK); + while (safety-- && ftdm_test_flag(R2CALL(ftdmchan), FTDM_R2_WAITING_ACK)) { + ftdm_mutex_unlock(ftdmchan->mutex); + ftdm_sleep(10); + ftdm_mutex_lock(ftdmchan->mutex); + } - status = ftdm_thread_create_detached(ftdm_r2_channel_run, ftdmchan); - if (status == FTDM_FAIL) { - ftdm_log(FTDM_LOG_ERROR, "%d:%d Cannot handle request to start call in channel, failed to create thread!\n", - ftdmchan->span_id, ftdmchan->chan_id); - ftdm_channel_done(ftdmchan); + if (ftdm_test_flag(R2CALL(ftdmchan), FTDM_R2_WAITING_ACK)) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Waiting ack flag was never cleared!\n"); + ftdm_clear_flag(R2CALL(ftdmchan), FTDM_R2_WAITING_ACK); return FTDM_FAIL; } + + if (ftdmchan->state != FTDM_CHANNEL_STATE_DIALING) { + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Collision after call attempt, try another channel, new state = %s\n", + ftdm_channel_state2str(ftdmchan->state)); + ftdm_clear_flag(R2CALL(ftdmchan), FTDM_R2_WAITING_ACK); + return FTDM_BREAK; + } - return FTDM_SUCCESS; + + /* non-threaded implementation, we're done here */ + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "R2 call placed in non-threaded mode\n"); + return FTDM_SUCCESS; } static ftdm_status_t ftdm_r2_start(ftdm_span_t *span) @@ -197,91 +319,137 @@ static ftdm_status_t ftdm_r2_start(ftdm_span_t *span) return ftdm_thread_create_detached(ftdm_r2_run, span); } +static ftdm_status_t ftdm_r2_stop(ftdm_span_t *span) +{ + ftdm_r2_data_t *r2_data = span->signal_data; + while (ftdm_test_flag(r2_data, FTDM_R2_RUNNING)) { + ftdm_log(FTDM_LOG_DEBUG, "Waiting for R2 span %s\n", span->name); + ftdm_sleep(100); + } + return FTDM_SUCCESS; +} + +#if 0 +static ftdm_status_t ftdm_r2_sig_write(ftdm_channel_t *ftdmchan, void *data, ftdm_size_t size) +{ + ftdm_r2_call_t *r2call = R2CALL(ftdmchan); + openr2_chan_t *r2chan = r2call->r2chan; + if (openr2_chan_get_read_enabled(r2chan) && !ftdm_test_flag(r2call, FTDM_R2_PROCESSING)) { + if (r2call->txdrops < 10) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "dropping user write because there is R2 processing\n"); + } else if (r2call->txdrops == 10) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "too may drops, not logging any more\n"); + } + r2call->txdrops++; + return FTDM_BREAK; + } + if (!openr2_chan_get_read_enabled(r2chan)) { + ftdm_mutex_lock(ftdmchan->mutex); + //openr2_chan_process_output(r2chan, data, size); + ftdm_mutex_unlock(ftdmchan->mutex); + } + return FTDM_SUCCESS; +} +#endif + +static ftdm_status_t ftdm_r2_sig_read(ftdm_channel_t *ftdmchan, void *data, ftdm_size_t size) +{ + openr2_chan_t *r2chan = R2CALL(ftdmchan)->r2chan; + if (!openr2_chan_get_read_enabled(r2chan)) { + ftdm_mutex_lock(ftdmchan->mutex); + //openr2_chan_process_input(r2chan, data, size); + ftdm_mutex_unlock(ftdmchan->mutex); + } + return FTDM_SUCCESS; +} + /* always called from the monitor thread */ static void ftdm_r2_on_call_init(openr2_chan_t *r2chan) { + //ftdm_status_t status; + ftdm_r2_call_t *r2call; ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - ftdm_status_t status; - ftdm_log(FTDM_LOG_NOTICE, "Received request to start call on chan %d\n", openr2_chan_get_number(r2chan)); + //ftdm_r2_data_t *r2data = ftdmchan->span->signal_data; + + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "Received request to start call\n"); ftdm_mutex_lock(ftdmchan->mutex); + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)) { + ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Cannot start call when channel is in use (state = %s)\n", ftdm_channel_state2str(ftdmchan->state)); + ftdm_mutex_unlock(ftdmchan->mutex); + } + if (ftdmchan->state != FTDM_CHANNEL_STATE_DOWN) { - ftdm_log(FTDM_LOG_ERROR, "Cannot handle request to start call in channel %d, invalid state (%d)\n", - openr2_chan_get_number(r2chan), ftdmchan->state); + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Cannot handle request to start call in state %s\n", ftdm_channel_state2str(ftdmchan->state)); ftdm_mutex_unlock(ftdmchan->mutex); return; } - /* the channel may be down but the thread not quite done */ - ftdm_wait_for_flag_cleared(ftdmchan, FTDM_CHANNEL_INTHREAD, 200); - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INTHREAD)) { - ftdm_log(FTDM_LOG_ERROR, "Cannot handle request to start call in channel %d, already in thread!\n", - openr2_chan_get_number(r2chan)); + if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Failed to open channel during incoming call! [%s]\n", ftdmchan->last_error); ftdm_mutex_unlock(ftdmchan->mutex); return; } + + /* mark the channel in use (so no outgoing calls can be placed here) */ + ftdm_channel_use(ftdmchan); + + memset(ftdmchan->caller_data.dnis.digits, 0, sizeof(ftdmchan->caller_data.collected)); + memset(ftdmchan->caller_data.ani.digits, 0, sizeof(ftdmchan->caller_data.collected)); + + /* clean the call data structure but keep the R2 processing flag on! */ ft_r2_clean_call(ftdmchan->call_data); - R2CALL(ftdmchan)->chanstate = FTDM_CHANNEL_STATE_DOWN; + r2call = R2CALL(ftdmchan); + ftdm_set_flag(r2call, FTDM_R2_PROCESSING); + + if (ftdmchan->state == FTDM_CHANNEL_STATE_DOWN) { + R2CALL(ftdmchan)->chanstate = FTDM_CHANNEL_STATE_DOWN; + } else { + R2CALL(ftdmchan)->chanstate = FTDM_CHANNEL_STATE_DIALING; + } + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); ftdm_mutex_unlock(ftdmchan->mutex); - status = ftdm_thread_create_detached(ftdm_r2_channel_run, ftdmchan); - if (status == FTDM_FAIL) { - ftdm_log(FTDM_LOG_ERROR, "Cannot handle request to start call in channel %d, failed to create thread!\n", - openr2_chan_get_number(r2chan)); - } + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Span is not threaded, not launching thread for this call\n"); + return; } /* only called for incoming calls when the ANI, DNIS etc is complete and the user has to decide either to accept or reject the call */ static void ftdm_r2_on_call_offered(openr2_chan_t *r2chan, const char *ani, const char *dnis, openr2_calling_party_category_t category) { - ftdm_sigmsg_t sigev; ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - ftdm_log(FTDM_LOG_NOTICE, "Call offered on chan %d, ANI = %s, DNIS = %s, Category = %s\n", openr2_chan_get_number(r2chan), - ani, dnis, openr2_proto_get_category_string(category)); + ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Call offered with ANI = %s, DNIS = %s, Priority = (%d)\n", ani, dnis, category); + //ftdmchan->caller_data.priority = category; + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RING); - /* notify the user about the new call */ - memset(&sigev, 0, sizeof(sigev)); - sigev.chan_id = ftdmchan->chan_id; - sigev.span_id = ftdmchan->span_id; - sigev.channel = ftdmchan; - sigev.event_id = FTDM_SIGEVENT_START; - - if (ftdm_span_send_signal(ftdmchan->span, &sigev) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_NOTICE, "Failed to handle call offered on chan %d\n", openr2_chan_get_number(r2chan)); - openr2_chan_disconnect_call(r2chan, OR2_CAUSE_OUT_OF_ORDER); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); - return; - } - ftdm_channel_use(ftdmchan); - R2CALL(ftdmchan)->ftdm_started = 1; } static void ftdm_r2_on_call_accepted(openr2_chan_t *r2chan, openr2_call_mode_t mode) { ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - ftdm_log(FTDM_LOG_NOTICE, "Call accepted on chan %d\n", openr2_chan_get_number(r2chan)); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "Call accepted\n"); /* at this point the MF signaling has ended and there is no point on keep reading */ openr2_chan_disable_read(r2chan); + R2CALL(ftdmchan)->accepted = 1; if (OR2_DIR_BACKWARD == openr2_chan_get_direction(r2chan)) { R2CALL(ftdmchan)->state_ack_pending = 1; if (R2CALL(ftdmchan)->answer_pending) { - ftdm_log(FTDM_LOG_DEBUG, "Answer was pending on chan %d, answering now.\n", openr2_chan_get_number(r2chan)); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Answer was pending, answering now.\n"); ft_r2_answer_call(ftdmchan); return; } } else { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); } } static void ftdm_r2_on_call_answered(openr2_chan_t *r2chan) { ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - ftdm_log(FTDM_LOG_NOTICE, "Call answered on chan %d\n", openr2_chan_get_number(r2chan)); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "Call answered\n"); /* notify the upper layer of progress in the outbound call */ if (OR2_DIR_FORWARD == openr2_chan_get_direction(r2chan)) { ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); @@ -294,14 +462,19 @@ static void ftdm_r2_on_call_disconnect(openr2_chan_t *r2chan, openr2_call_discon ftdm_sigmsg_t sigev; ftdm_r2_data_t *r2data; ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - ftdm_log(FTDM_LOG_NOTICE, "Call disconnected on chan %d\n", openr2_chan_get_number(r2chan)); - ftdm_log(FTDM_LOG_DEBUG, "Got openr2 disconnection, clearing call on channel %d\n", ftdmchan->physical_chan_id); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "Call disconnected\n"); + + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Got openr2 disconnection, clearing call\n"); R2CALL(ftdmchan)->disconnect_rcvd = 1; - /* acknowledge the hangup, cause will be ignored. From here to -> HANGUP once the freetdm side hangs up as well */ - openr2_chan_disconnect_call(r2chan, OR2_CAUSE_NORMAL_CLEARING); + if (ftdmchan->state == FTDM_CHANNEL_STATE_HANGUP) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Call had been disconnected already by the user\n"); + /* just ack the hangup to go down */ + openr2_chan_disconnect_call(r2chan, OR2_CAUSE_NORMAL_CLEARING); + return; + } /* if the call has not been started yet we must go to HANGUP right here */ if (!R2CALL(ftdmchan)->ftdm_started) { @@ -309,8 +482,7 @@ static void ftdm_r2_on_call_disconnect(openr2_chan_t *r2chan, openr2_call_discon return; } - /* FIXME: use the cause received from openr2 and map it to ftdm cause */ - ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_CLEARING; + ftdmchan->caller_data.hangup_cause = ftdm_r2_cause_to_ftdm_cause(ftdmchan, cause); /* notify the user of the call terminating */ memset(&sigev, 0, sizeof(sigev)); @@ -326,27 +498,32 @@ static void ftdm_r2_on_call_disconnect(openr2_chan_t *r2chan, openr2_call_discon static void ftdm_r2_on_call_end(openr2_chan_t *r2chan) { ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - ftdm_log(FTDM_LOG_NOTICE, "Call finished on chan %d\n", openr2_chan_get_number(r2chan)); - /* this means the freetdm side disconnected the call, therefore we must move to DOWN here */ - if (!R2CALL(ftdmchan)->disconnect_rcvd) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - return; - } + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "Call finished\n"); + + /* the call is done as far as the stack is concerned, lets move to down here */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + + /* in some circumstances openr2 can call on_call_init right after this, so let's advance the state right here */ + ftdm_r2_state_advance(ftdmchan); } static void ftdm_r2_on_call_read(openr2_chan_t *r2chan, const unsigned char *buf, int buflen) { +#if 0 ftdm_log(FTDM_LOG_NOTICE, "Call read data on chan %d\n", openr2_chan_get_number(r2chan)); +#endif } static void ftdm_r2_on_hardware_alarm(openr2_chan_t *r2chan, int alarm) { - ftdm_log(FTDM_LOG_NOTICE, "Alarm on chan %d (%d)\n", openr2_chan_get_number(r2chan), alarm); + ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Alarm notification: %d\n", alarm); } static void ftdm_r2_on_os_error(openr2_chan_t *r2chan, int errorcode) { - ftdm_log(FTDM_LOG_ERROR, "OS error on chan %d: %s\n", openr2_chan_get_number(r2chan), strerror(errorcode)); + ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "OS error: %s\n", strerror(errorcode)); } static void ftdm_r2_on_protocol_error(openr2_chan_t *r2chan, openr2_protocol_error_t reason) @@ -355,18 +532,26 @@ static void ftdm_r2_on_protocol_error(openr2_chan_t *r2chan, openr2_protocol_err ftdm_r2_data_t *r2data; ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); - ftdm_log(FTDM_LOG_ERROR, "Protocol error on chan %d\n", openr2_chan_get_number(r2chan)); + ftdm_mutex_lock(ftdmchan->mutex); + + if (ftdmchan->state == FTDM_CHANNEL_STATE_DOWN) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Got protocol error when we're already down!\n"); + ftdm_mutex_unlock(ftdmchan->mutex); + } + + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "Protocol error\n"); R2CALL(ftdmchan)->disconnect_rcvd = 1; if (!R2CALL(ftdmchan)->ftdm_started) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); + ftdm_mutex_unlock(ftdmchan->mutex); return; } ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_PROTOCOL_ERROR; - /* notify the user of the call terminating */ + /* FIXME: go to terminating and notify the user from the terminating handler instead of notifying here */ memset(&sigev, 0, sizeof(sigev)); sigev.chan_id = ftdmchan->chan_id; sigev.span_id = ftdmchan->span_id; @@ -375,63 +560,76 @@ static void ftdm_r2_on_protocol_error(openr2_chan_t *r2chan, openr2_protocol_err r2data = ftdmchan->span->signal_data; ftdm_span_send_signal(ftdmchan->span, &sigev); + + ftdm_mutex_unlock(ftdmchan->mutex); } static void ftdm_r2_on_line_blocked(openr2_chan_t *r2chan) { - ftdm_log(FTDM_LOG_NOTICE, "Far end blocked on chan %d\n", openr2_chan_get_number(r2chan)); + ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); + ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Far end blocked in state %s\n", ftdm_channel_state2str(ftdmchan->state)); + ftdm_set_flag(ftdmchan, FTDM_CHANNEL_SUSPENDED); } static void ftdm_r2_on_line_idle(openr2_chan_t *r2chan) { - ftdm_log(FTDM_LOG_NOTICE, "Far end unblocked on chan %d\n", openr2_chan_get_number(r2chan)); + ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); + ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Far end unblocked in state %s\n", ftdm_channel_state2str(ftdmchan->state)); + ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_SUSPENDED); + + /* XXX when should we set/unset this flag? XXX */ + ftdm_set_flag(ftdmchan, FTDM_CHANNEL_SIG_UP); } -static void ftdm_r2_write_log(openr2_log_level_t level, const char *message) +static void ftdm_r2_write_log(openr2_log_level_t level, const char *file, const char *function, int line, const char *message) { switch (level) { case OR2_LOG_NOTICE: - ftdm_log(FTDM_LOG_NOTICE, "%s", message); + ftdm_log(file, function, line, FTDM_LOG_LEVEL_NOTICE, "%s", message); break; case OR2_LOG_WARNING: - ftdm_log(FTDM_LOG_WARNING, "%s", message); + ftdm_log(file, function, line, FTDM_LOG_LEVEL_WARNING, "%s", message); break; case OR2_LOG_ERROR: - ftdm_log(FTDM_LOG_ERROR, "%s", message); + ftdm_log(file, function, line, FTDM_LOG_LEVEL_ERROR, "%s", message); break; case OR2_LOG_STACK_TRACE: case OR2_LOG_MF_TRACE: case OR2_LOG_CAS_TRACE: case OR2_LOG_DEBUG: case OR2_LOG_EX_DEBUG: - ftdm_log(FTDM_LOG_DEBUG, "%s", message); + ftdm_log(file, function, line, FTDM_LOG_LEVEL_DEBUG, "%s", message); break; default: ftdm_log(FTDM_LOG_WARNING, "We should handle logging level %d here.\n", level); - ftdm_log(FTDM_LOG_DEBUG, "%s", message); + ftdm_log(file, function, line, FTDM_LOG_LEVEL_DEBUG, "%s", message); break; } } -static void ftdm_r2_on_context_log(openr2_context_t *r2context, openr2_log_level_t level, const char *fmt, va_list ap) +static void ftdm_r2_on_context_log(openr2_context_t *r2context, const char *file, const char *function, unsigned int line, + openr2_log_level_t level, const char *fmt, va_list ap) { #define CONTEXT_TAG "Context -" char logmsg[256]; char completemsg[sizeof(logmsg) + sizeof(CONTEXT_TAG) - 1]; vsnprintf(logmsg, sizeof(logmsg), fmt, ap); snprintf(completemsg, sizeof(completemsg), CONTEXT_TAG "%s", logmsg); - ftdm_r2_write_log(level, completemsg); + ftdm_r2_write_log(level, file, function, line, completemsg); #undef CONTEXT_TAG } -static void ftdm_r2_on_chan_log(openr2_chan_t *r2chan, openr2_log_level_t level, const char *fmt, va_list ap) +static void ftdm_r2_on_chan_log(openr2_chan_t *r2chan, const char *file, const char *function, unsigned int line, + openr2_log_level_t level, const char *fmt, va_list ap) { + ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); #define CHAN_TAG "Chan " - char logmsg[256]; + char logmsg[512]; char completemsg[sizeof(logmsg) + sizeof(CHAN_TAG) - 1]; vsnprintf(logmsg, sizeof(logmsg), fmt, ap); - snprintf(completemsg, sizeof(completemsg), CHAN_TAG "%d: %s", openr2_chan_get_number(r2chan), logmsg); - ftdm_r2_write_log(level, completemsg); + snprintf(completemsg, sizeof(completemsg), CHAN_TAG "%d:%d [%s] %s", + ftdmchan->span_id, ftdmchan->chan_id, ftdm_channel_state2str(ftdmchan->state), logmsg); + ftdm_r2_write_log(level, file, function, line, completemsg); #undef CHAN_TAG } @@ -442,7 +640,7 @@ static int ftdm_r2_on_dnis_digit_received(openr2_chan_t *r2chan, char digit) ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); ftdm_size_t collected_len = R2CALL(ftdmchan)->dnis_index; - ftdm_log(FTDM_LOG_DEBUG, "DNIS digit %d received chan %d\n", digit, openr2_chan_get_number(r2chan)); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "DNIS digit %c received\n", digit); /* save the digit we just received */ ftdmchan->caller_data.dnis.digits[collected_len] = digit; @@ -458,13 +656,13 @@ static int ftdm_r2_on_dnis_digit_received(openr2_chan_t *r2chan, char digit) sigev.event_id = FTDM_SIGEVENT_COLLECTED_DIGIT; r2data = ftdmchan->span->signal_data; if (ftdm_span_send_signal(ftdmchan->span, &sigev) == FTDM_BREAK) { - ftdm_log(FTDM_LOG_NOTICE, "Requested to stop getting DNIS. Current DNIS = %s on chan %d\n", ftdmchan->caller_data.dnis.digits, openr2_chan_get_number(r2chan)); + ftdm_log_chan(ftdmchan, FTDM_LOG_NOTICE, "Requested to stop getting DNIS. Current DNIS = %s\n", ftdmchan->caller_data.dnis.digits); return OR2_STOP_DNIS_REQUEST; } /* the only other reason to stop requesting DNIS is that there is no more room to save it */ if (collected_len == (sizeof(ftdmchan->caller_data.dnis.digits) - 1)) { - ftdm_log(FTDM_LOG_NOTICE, "No more room for DNIS. Current DNIS = %s on chan %d\n", ftdmchan->caller_data.dnis.digits, openr2_chan_get_number(r2chan)); + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "No more room for DNIS. Current DNIS = %s\n", ftdmchan->caller_data.dnis.digits); return OR2_STOP_DNIS_REQUEST; } @@ -478,15 +676,35 @@ static void ftdm_r2_on_ani_digit_received(openr2_chan_t *r2chan, char digit) /* check if we should drop ANI */ if (collected_len == (sizeof(ftdmchan->caller_data.ani.digits) - 1)) { - ftdm_log(FTDM_LOG_NOTICE, "No more room for ANI %c on chan %d, digit dropped.\n", digit, openr2_chan_get_number(r2chan)); + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "No more room for ANI, digit dropped: %c\n", digit); return; } - ftdm_log(FTDM_LOG_DEBUG, "ANI digit %c received chan %d\n", digit, openr2_chan_get_number(r2chan)); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "ANI digit %c received\n", digit); /* save the digit we just received */ - ftdmchan->caller_data.ani.digits[collected_len++] = digit; + ftdmchan->caller_data.ani.digits[collected_len] = digit; + collected_len++; ftdmchan->caller_data.ani.digits[collected_len] = '\0'; + R2CALL(ftdmchan)->ani_index = collected_len; +} + +/* XXX missing on openr2 XXX */ +#if 0 +static void ftdm_r2_on_call_collision(openr2_chan_t *r2chan) +{ + ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Call collision detected, outgoing call attempt failed, state = %s\n", ftdm_channel_state2str(ftdmchan->state)); + ftdm_clear_flag(R2CALL(ftdmchan), FTDM_R2_WAITING_ACK); + ftdm_channel_close(&ftdmchan); +} + +static void ftdm_r2_on_call_acknowledged(openr2_chan_t *r2chan) +{ + ftdm_channel_t *ftdmchan = openr2_chan_get_client_data(r2chan); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Outgoing call proceeding\n"); + ftdm_clear_flag(R2CALL(ftdmchan), FTDM_R2_WAITING_ACK); } +#endif static openr2_event_interface_t ftdm_r2_event_iface = { .on_call_init = ftdm_r2_on_call_init, @@ -506,7 +724,13 @@ static openr2_event_interface_t ftdm_r2_event_iface = { .on_dnis_digit_received = ftdm_r2_on_dnis_digit_received, .on_ani_digit_received = ftdm_r2_on_ani_digit_received, /* so far we do nothing with billing pulses */ - .on_billing_pulse_received = NULL + .on_billing_pulse_received = NULL, + + /* XXX these two events are missing on openr2 XXX */ +#if 0 + .on_call_collision = ftdm_r2_on_call_collision, + .on_call_acknowledged = ftdm_r2_on_call_acknowledged, +#endif }; static int ftdm_r2_io_set_cas(openr2_chan_t *r2chan, int cas) @@ -564,10 +788,11 @@ static int ftdm_r2_io_read(openr2_chan_t *r2chan, const void *buf, int size) static int ftdm_r2_io_wait(openr2_chan_t *r2chan, int *flags, int block) { ftdm_status_t status; + int32_t timeout; ftdm_wait_flag_t ftdmflags = 0; ftdm_channel_t *ftdm_chan = openr2_chan_get_fd(r2chan); - int32_t timeout = block ? -1 : 0; + timeout = block ? -1 : 0; if (*flags & OR2_IO_READ) { ftdmflags |= FTDM_READ; @@ -578,10 +803,10 @@ static int ftdm_r2_io_wait(openr2_chan_t *r2chan, int *flags, int block) if (*flags & OR2_IO_OOB_EVENT) { ftdmflags |= FTDM_EVENTS; } - + status = ftdm_channel_wait(ftdm_chan, &ftdmflags, timeout); - if (FTDM_SUCCESS != status) { + if (FTDM_SUCCESS != status && FTDM_TIMEOUT != status) { return -1; } @@ -610,23 +835,40 @@ static openr2_io_fd_t ftdm_r2_io_open(openr2_context_t *r2context, int channo) /* since freetdm takes care of closing the file descriptor and uses openr2_chan_new_from_fd, openr2 should never call this hook */ static int ftdm_r2_io_close(openr2_chan_t *r2chan) { - ftdm_log(FTDM_LOG_ERROR, "I should not be called (I/O close)!!\n"); + ftdm_channel_t *fchan = openr2_chan_get_client_data(r2chan); + ftdm_log_chan_msg(fchan, FTDM_LOG_ERROR, "I should not be called (I/O close)!!\n"); return 0; } /* since freetdm takes care of opening the file descriptor and using openr2_chan_new_from_fd, openr2 should never call this hook */ static int ftdm_r2_io_setup(openr2_chan_t *r2chan) { - ftdm_log(FTDM_LOG_ERROR, "I should not be called (I/O Setup)!!\n"); + ftdm_channel_t *fchan = openr2_chan_get_client_data(r2chan); + ftdm_log_chan_msg(fchan, FTDM_LOG_ERROR, "I should not be called (I/O Setup)!!\n"); return 0; } -/* since the signaling thread calls openr2_chan_process_cas_signaling directly, openr2 should never call this hook */ static int ftdm_r2_io_get_oob_event(openr2_chan_t *r2chan, openr2_oob_event_t *event) { *event = 0; ftdm_log(FTDM_LOG_ERROR, "I should not be called (I/O get oob event)!!\n"); return 0; + +#if 0 + ftdm_status_t status; + ftdm_event_t *fevent = NULL; + ftdm_channel_t *ftdmchan = openr2_chan_get_fd(r2chan); + *event = OR2_OOB_EVENT_NONE; + status = ftdm_channel_read_event(ftdmchan, &fevent); + if (status != FTDM_SUCCESS) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "failed to retrieve freetdm event!\n"); + return -1; + } + if (fevent->e_type == FTDM_EVENT_OOB && fevent->enum_id == FTDM_OOB_CAS_BITS_CHANGE) { + *event = OR2_OOB_EVENT_CAS_CHANGE; + } + return 0; +#endif } static openr2_io_interface_t ftdm_r2_io_iface = { @@ -671,9 +913,10 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_r2_configure_span) .forced_release = -1, .charge_calls = -1, .get_ani_first = -1, - .call_files = -1, + .call_files = 0, + .mf_files = 0, .logdir = NULL, - .advanced_protocol_file = NULL + .advanced_protocol_file = NULL }; @@ -784,6 +1027,9 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_r2_configure_span) } else if (!strcasecmp(var, "call_files")) { r2conf.call_files = va_arg(ap, int); ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with call files = %d\n", span->span_id, r2conf.call_files); + } else if (!strcasecmp(var, "mf_files")) { + r2conf.mf_files = va_arg(ap, int); + ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with mf files = %d\n", span->span_id, r2conf.mf_files); } else if (!strcasecmp(var, "mfback_timeout")) { r2conf.mfback_timeout = va_arg(ap, int); ftdm_log(FTDM_LOG_DEBUG, "Configuring R2 span %d with MF backward timeout = %dms\n", span->span_id, r2conf.mfback_timeout); @@ -834,7 +1080,9 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_r2_configure_span) openr2_context_set_metering_pulse_timeout(r2data->r2context, r2conf.metering_pulse_timeout); openr2_context_set_double_answer(r2data->r2context, r2conf.double_answer); openr2_context_set_immediate_accept(r2data->r2context, r2conf.immediate_accept); - if (r2conf.logdir) { + + if (r2conf.logdir && r2conf.logdir[0]) { + ftdm_log(FTDM_LOG_DEBUG, "Setting openr2 for span %s logdir to %s\n", span->name, r2conf.logdir); openr2_context_set_log_directory(r2data->r2context, r2conf.logdir); } if (r2conf.advanced_protocol_file) { @@ -853,9 +1101,14 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_r2_configure_span) snprintf(span->last_error, sizeof(span->last_error), "Cannot create all openr2 channels for span."); goto fail; } + openr2_chan_set_log_level(r2chan, r2conf.loglevel); if (r2conf.call_files) { openr2_chan_enable_call_files(r2chan); - openr2_chan_set_log_level(r2chan, r2conf.loglevel); +#if 0 + if (r2conf.mf_files) { + openr2_chan_enable_mf_files(r2chan); + } +#endif } r2call = ftdm_malloc(sizeof(*r2call)); @@ -874,13 +1127,16 @@ static FIO_SIG_CONFIGURE_FUNCTION(ftdm_r2_configure_span) hashtable_insert(spanpvt->r2calls, (void *)r2call->name, r2call, HASHTABLE_FLAG_FREE_VALUE); } + r2data->flags = 0; spanpvt->r2context = r2data->r2context; /* just the value must be freed by the hash */ hashtable_insert(g_mod_data_hash, (void *)span->name, spanpvt, HASHTABLE_FLAG_FREE_VALUE); span->start = ftdm_r2_start; - r2data->flags = 0; + span->stop = ftdm_r2_stop; + span->sig_read = ftdm_r2_sig_read; + span->signal_cb = sig_cb; span->signal_type = FTDM_SIGTYPE_R2; span->signal_data = r2data; @@ -902,301 +1158,391 @@ fail: } -static void *ftdm_r2_channel_run(ftdm_thread_t *me, void *obj) +/* the channel must be locked when calling this function */ +static int ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) { - ftdm_channel_t *closed_chan; - uint32_t interval = 0; ftdm_sigmsg_t sigev; - ftdm_channel_t *ftdmchan = (ftdm_channel_t *)obj; + int ret; openr2_chan_t *r2chan = R2CALL(ftdmchan)->r2chan; - ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_INTHREAD); - - ftdm_mutex_lock(g_thread_count_mutex); - g_thread_count++; - ftdm_mutex_unlock(g_thread_count_mutex); + memset(&sigev, 0, sizeof(sigev)); + sigev.chan_id = ftdmchan->chan_id; + sigev.span_id = ftdmchan->span_id; + sigev.channel = ftdmchan; - ftdm_log(FTDM_LOG_DEBUG, "R2 CHANNEL thread starting on %d in state %s.\n", - ftdmchan->physical_chan_id, - ftdm_channel_state2str(ftdmchan->state)); + ret = 0; - if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "OPEN ERROR [%s]\n", ftdmchan->last_error); - goto endthread; + if (R2CALL(ftdmchan)->state_ack_pending) { + ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE); + ftdm_channel_complete_state(ftdmchan); + R2CALL(ftdmchan)->state_ack_pending = 0; } - ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_INTERVAL, &interval); + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE) && (R2CALL(ftdmchan)->chanstate != ftdmchan->state)) { + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Executing state handler for %s\n", ftdm_channel_state2str(ftdmchan->state)); + R2CALL(ftdmchan)->chanstate = ftdmchan->state; + + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) && !R2CALL(ftdmchan)->accepted && + (ftdmchan->state == FTDM_CHANNEL_STATE_PROGRESS || + ftdmchan->state == FTDM_CHANNEL_STATE_PROGRESS_MEDIA || + ftdmchan->state == FTDM_CHANNEL_STATE_UP) ) { + /* if an accept ack will be required we should not acknowledge the state change just yet, + it will be done below after processing the MF signals, otherwise we have a race condition between freetdm calling + openr2_chan_answer_call and openr2 accepting the call first, if freetdm calls openr2_chan_answer_call before the accept cycle + completes, openr2 will fail to answer the call */ + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "State ack for state %s will have to wait a bit\n", ftdm_channel_state2str(ftdmchan->state)); + } else if (ftdmchan->state != FTDM_CHANNEL_STATE_DOWN){ + ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE); + ftdm_channel_complete_state(ftdmchan); + } - assert(interval != 0); - ftdm_log(FTDM_LOG_DEBUG, "Got %d interval for chan %d\n", interval, ftdmchan->physical_chan_id); + switch (ftdmchan->state) { - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - /* FIXME: is this needed? */ - memset(ftdmchan->caller_data.dnis.digits, 0, sizeof(ftdmchan->caller_data.collected)); - memset(ftdmchan->caller_data.ani.digits, 0, sizeof(ftdmchan->caller_data.collected)); - } + /* starting an incoming call */ + case FTDM_CHANNEL_STATE_COLLECT: + { + uint32_t interval = 0; + ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_INTERVAL, &interval); + ftdm_assert(interval != 0, "Invalid interval!"); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Starting processing of incoming call with interval %d\n", interval); + } + break; - memset(&sigev, 0, sizeof(sigev)); - sigev.chan_id = ftdmchan->chan_id; - sigev.span_id = ftdmchan->span_id; - sigev.channel = ftdmchan; + /* starting an outgoing call */ + case FTDM_CHANNEL_STATE_DIALING: + { + uint32_t interval = 0; + ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_INTERVAL, &interval); + ftdm_assert(interval != 0, "Invalid interval!"); + ftdm_log_chan(ftdmchan, + FTDM_LOG_DEBUG, "Starting processing of outgoing call in channel with interval %d\n", interval); + } + break; - while (ftdm_running()) { - int32_t read_enabled = openr2_chan_get_read_enabled(r2chan); - ftdm_wait_flag_t flags = read_enabled ? ( FTDM_READ | FTDM_WRITE ) : 0; - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE) && (R2CALL(ftdmchan)->chanstate != ftdmchan->state)) { - - ftdm_log(FTDM_LOG_DEBUG, "Executing state handler on %d:%d for %s\n", ftdmchan->span_id, ftdmchan->chan_id, ftdm_channel_state2str(ftdmchan->state)); - R2CALL(ftdmchan)->chanstate = ftdmchan->state; - - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND) && !R2CALL(ftdmchan)->accepted && - (ftdmchan->state == FTDM_CHANNEL_STATE_PROGRESS || - ftdmchan->state == FTDM_CHANNEL_STATE_PROGRESS_MEDIA || - ftdmchan->state == FTDM_CHANNEL_STATE_UP) ) { - /* if an accept ack will be required we should not acknowledge the state change just yet, - it will be done below after processing the MF signals, otherwise we have a race condition between freetdm calling - openr2_chan_answer_call and openr2 accepting the call first, if freetdm calls openr2_chan_answer_call before the accept cycle - completes, openr2 will fail to answer the call */ - ftdm_log(FTDM_LOG_DEBUG, "State ack in chan %d:%d for state %s will have to wait a bit\n", ftdmchan->span_id, ftdmchan->chan_id, ftdm_channel_state2str(ftdmchan->state)); - } else if (ftdmchan->state != FTDM_CHANNEL_STATE_DOWN){ - /* the down state will be completed in ftdm_channel_done below */ - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_STATE_CHANGE); - ftdm_channel_complete_state(ftdmchan); - } + /* incoming call was offered */ + case FTDM_CHANNEL_STATE_RING: - switch (ftdmchan->state) { + /* notify the user about the new call */ + sigev.event_id = FTDM_SIGEVENT_START; - /* starting an incoming call */ - case FTDM_CHANNEL_STATE_COLLECT: - { - ftdm_log(FTDM_LOG_DEBUG, "COLLECT: Starting processing of incoming call in channel %d with interval %d\n", ftdmchan->physical_chan_id, interval); - } - break; - - /* starting an outgoing call */ - case FTDM_CHANNEL_STATE_DIALING: - { - // FIXME: use user defined calling party - ftdm_channel_use(ftdmchan); - ftdm_log(FTDM_LOG_DEBUG, "DIALING: Starting processing of outgoing call in channel %d with interval %d\n", ftdmchan->physical_chan_id, interval); - if (openr2_chan_make_call(r2chan, ftdmchan->caller_data.cid_num.digits, ftdmchan->caller_data.dnis.digits, OR2_CALLING_PARTY_CATEGORY_NATIONAL_SUBSCRIBER)) { - ftdm_log(FTDM_LOG_ERROR, "%d:%d Failed to make call in R2 channel, openr2_chan_make_call failed\n", ftdmchan->span_id, ftdmchan->chan_id); - ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_DESTINATION_OUT_OF_ORDER; - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); - } - } - break; - - /* the call is ringing */ - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - { - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - if (!R2CALL(ftdmchan)->accepted) { - ftdm_log(FTDM_LOG_DEBUG, "PROGRESS: Accepting call on channel %d\n", ftdmchan->physical_chan_id); - ft_r2_accept_call(ftdmchan); - } - } else { - ftdm_log(FTDM_LOG_DEBUG, "PROGRESS: Notifying progress in channel %d\n", ftdmchan->physical_chan_id); - sigev.event_id = FTDM_SIGEVENT_PROGRESS; - if (ftdm_span_send_signal(ftdmchan->span, &sigev) != FTDM_SUCCESS) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); - } + if (ftdm_span_send_signal(ftdmchan->span, &sigev) != FTDM_SUCCESS) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_NOTICE, "Failed to handle call offered\n"); + openr2_chan_disconnect_call(r2chan, OR2_CAUSE_OUT_OF_ORDER); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); + break; + } + R2CALL(ftdmchan)->ftdm_started = 1; + + break; + + /* the call is making progress */ + case FTDM_CHANNEL_STATE_PROGRESS: + case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: + { + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + if (!R2CALL(ftdmchan)->accepted) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Accepting call\n"); + ft_r2_accept_call(ftdmchan); + } + } else { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Notifying progress\n"); + sigev.event_id = FTDM_SIGEVENT_PROGRESS_MEDIA; + if (ftdm_span_send_signal(ftdmchan->span, &sigev) != FTDM_SUCCESS) { + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); } } - break; - - /* the call was answered */ - case FTDM_CHANNEL_STATE_UP: - { - ftdm_log(FTDM_LOG_DEBUG, "UP: Call was answered on channel %d\n", ftdmchan->physical_chan_id); - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - if (!R2CALL(ftdmchan)->accepted) { - ftdm_log(FTDM_LOG_DEBUG, "UP: Call has not been accepted, need to accept first\n"); - // the answering will be done in the on_call_accepted handler - ft_r2_accept_call(ftdmchan); - R2CALL(ftdmchan)->answer_pending = 1; - } else { - ft_r2_answer_call(ftdmchan); - } + } + break; + + /* the call was answered */ + case FTDM_CHANNEL_STATE_UP: + { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Call was answered\n"); + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + if (!R2CALL(ftdmchan)->accepted) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Call has not been accepted, need to accept first\n"); + // the answering will be done in the on_call_accepted handler + ft_r2_accept_call(ftdmchan); + R2CALL(ftdmchan)->answer_pending = 1; } else { - ftdm_log(FTDM_LOG_DEBUG, "UP: Notifying of call answered in channel %d\n", ftdmchan->physical_chan_id); - sigev.event_id = FTDM_SIGEVENT_UP; - if (ftdm_span_send_signal(ftdmchan->span, &sigev) != FTDM_SUCCESS) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); - } + ft_r2_answer_call(ftdmchan); } - } - break; - - /* just got hangup */ - case FTDM_CHANNEL_STATE_HANGUP: - { - /* FIXME: the cause should be retrieved from ftdmchan->caller_data.hangup_cause and translated from Q931 to R2 cause */ - ftdm_log(FTDM_LOG_DEBUG, "HANGUP: Clearing call on channel %d\n", ftdmchan->physical_chan_id); - if (!R2CALL(ftdmchan)->disconnect_rcvd) { - /* this will disconnect the call, but need to wait for the call end before moving to DOWN */ - openr2_chan_disconnect_call(r2chan, OR2_CAUSE_NORMAL_CLEARING); - } else { - /* at this point on_call_end possibly was already called, - * but we needed to wait for the freetdm confirmation before moving to DOWN */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + } else { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Notifying of call answered\n"); + sigev.event_id = FTDM_SIGEVENT_UP; + if (ftdm_span_send_signal(ftdmchan->span, &sigev) != FTDM_SUCCESS) { + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); } } - break; + } + break; - /* just got hangup from the freetdm side due to abnormal failure */ - case FTDM_CHANNEL_STATE_CANCEL: - { - ftdm_log(FTDM_LOG_DEBUG, "CANCEL: Unable to receive call on channel %d\n", ftdmchan->physical_chan_id); - openr2_chan_disconnect_call(r2chan, OR2_CAUSE_OUT_OF_ORDER); - } - break; - - /* finished call for good */ - case FTDM_CHANNEL_STATE_DOWN: - { - ftdm_log(FTDM_LOG_DEBUG, "DOWN: Placing channel %d back to the pool of available channels\n", ftdmchan->physical_chan_id); - ftdm_channel_done(ftdmchan); - goto endthread; + /* just got hangup */ + case FTDM_CHANNEL_STATE_HANGUP: + { + openr2_call_disconnect_cause_t disconnect_cause = ftdm_r2_ftdm_cause_to_openr2_cause(ftdmchan); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Clearing call, cause = %s\n", openr2_proto_get_disconnect_string(disconnect_cause)); + openr2_chan_enable_read(r2chan); + if (!R2CALL(ftdmchan)->disconnect_rcvd) { + /* this will disconnect the call, but need to wait for the call end before moving to DOWN */ + openr2_chan_disconnect_call(r2chan, disconnect_cause); + } else { + /* just ack the hangup, on_call_end will be called by openr2 right after */ + openr2_chan_disconnect_call(r2chan, disconnect_cause); } - break; + } + break; - default: - { - ftdm_log(FTDM_LOG_ERROR, "%s: Unhandled channel state change in channel %d\n", ftdm_channel_state2str(ftdmchan->state), ftdmchan->physical_chan_id); - } - break; + /* just got hangup from the freetdm side due to abnormal failure */ + case FTDM_CHANNEL_STATE_CANCEL: + { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Unable to receive call\n"); + openr2_chan_enable_read(r2chan); + openr2_chan_disconnect_call(r2chan, OR2_CAUSE_OUT_OF_ORDER); + } + break; - } - } + /* finished call for good */ + case FTDM_CHANNEL_STATE_DOWN: + { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Call is down\n"); + if (R2CALL(ftdmchan)->txdrops) { + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "dropped %d tx packets\n", R2CALL(ftdmchan)->txdrops); + } + ret = 1; + } + break; - if (flags) { - if (ftdm_channel_wait(ftdmchan, &flags, interval * 2) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_DEBUG, "ftdm_channel_wait did not return FTDM_SUCCESS\n"); - continue; - } + default: + { + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Unhandled channel state change: %s\n", ftdm_channel_state2str(ftdmchan->state)); + } + break; - /* handle timeout events first if any */ - openr2_chan_run_schedule(r2chan); - - /* openr2 will now try to detect MF tones, make sense out of them, reply if necessary with another tone and trigger - * telephony events via the call event interface we provided when creating the R2 context. - * openr2 will also call our I/O callbacks to retrieve audio from the channel and call our wait poll I/O registered callback - * and will not return from this function until the I/O poll callback returns no pending events - * */ - openr2_chan_process_mf_signaling(r2chan); - if (R2CALL(ftdmchan)->state_ack_pending) { - ftdm_clear_flag_locked(ftdmchan, FTDM_CHANNEL_STATE_CHANGE); - ftdm_channel_complete_state(ftdmchan); - R2CALL(ftdmchan)->state_ack_pending = 0; - } - } else { - /* once the MF signaling has end we just loop here waiting for state changes */ - ftdm_sleep(interval); } - } -endthread: - - closed_chan = ftdmchan; - ftdm_channel_close(&closed_chan); - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_INTHREAD); - ftdm_log(FTDM_LOG_DEBUG, "R2 channel %d thread ended.\n", ftdmchan->physical_chan_id); - - ftdm_mutex_lock(g_thread_count_mutex); - g_thread_count--; - ftdm_mutex_unlock(g_thread_count_mutex); - - return NULL; + if (ret) { + ftdm_channel_t *closed_chan; + closed_chan = ftdmchan; + ftdm_channel_close(&closed_chan); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "State processing ended.\n"); + } + return ret; } static void *ftdm_r2_run(ftdm_thread_t *me, void *obj) { openr2_chan_t *r2chan; + ftdm_r2_call_t *r2call = NULL; + ftdm_channel_t *ftdmchan = NULL; ftdm_status_t status; ftdm_span_t *span = (ftdm_span_t *) obj; ftdm_r2_data_t *r2data = span->signal_data; - int waitms = 1000; - int i; - - ftdm_log(FTDM_LOG_DEBUG, "OpenR2 monitor thread started.\n"); - r2chan = NULL; + int waitms = 20; + int i, res; + int ms; + struct timeval start, end; + short *poll_events = ftdm_malloc(sizeof(short)*span->chan_count); + +#ifdef __linux__ + r2data->monitor_thread_id = syscall(SYS_gettid); +#endif + + ftdm_log(FTDM_LOG_DEBUG, "OpenR2 monitor thread %lu started.\n", r2data->monitor_thread_id); + r2chan = NULL; for (i = 1; i <= span->chan_count; i++) { r2chan = R2CALL(span->channels[i])->r2chan; openr2_chan_set_idle(r2chan); openr2_chan_process_cas_signaling(r2chan); } + memset(&start, 0, sizeof(start)); + memset(&end, 0, sizeof(end)); while (ftdm_running() && ftdm_test_flag(r2data, FTDM_R2_RUNNING)) { - status = ftdm_span_poll_event(span, waitms); + r2data->loops++; + res = gettimeofday(&end, NULL); + if (start.tv_sec) { + ms = ((end.tv_sec - start.tv_sec) * 1000) + + ((( 1000000 + end.tv_usec - start.tv_usec) / 1000) - 1000); + if (ms > r2data->jobmax) { + r2data->jobmax = ms; + } + } + + /* figure out what event to poll each channel for. POLLIN|POLLOUT for channels that has a call being + * setup, POLLPRI otherwise */ + memset(poll_events, 0, sizeof(short)*span->chan_count); + for (i = 0; i < span->chan_count; i++) { + r2chan = R2CALL(span->channels[(i+1)])->r2chan; + ftdmchan = openr2_chan_get_client_data(r2chan); + + poll_events[i] = ftdmchan->state == FTDM_CHANNEL_STATE_DOWN ? POLLPRI : (POLLPRI | POLLIN | POLLOUT); + } + + status = ftdm_span_poll_event(span, waitms, poll_events); + + res = gettimeofday(&start, NULL); + if (res) { + ftdm_log(FTDM_LOG_CRIT, "Failure gettimeofday [%s]\n", strerror(errno)); + } + if (FTDM_FAIL == status) { - ftdm_log(FTDM_LOG_ERROR, "Failure Polling event! [%s]\n", span->last_error); + ftdm_log(FTDM_LOG_CRIT, "Failure waiting I/O! [%s]\n", span->channels[1]->last_error); continue; } - if (FTDM_SUCCESS == status) { + + if (FTDM_SUCCESS == status) { ftdm_event_t *event; while (ftdm_span_next_event(span, &event) == FTDM_SUCCESS) { if (event->enum_id == FTDM_OOB_CAS_BITS_CHANGE) { - r2chan = R2CALL(event->channel)->r2chan; + r2call = R2CALL(event->channel); + r2chan = r2call->r2chan; + ftdm_log(FTDM_LOG_DEBUG, "Handling CAS on channel %d.\n", openr2_chan_get_number(r2chan)); // we only expect CAS and other OOB events on this thread/loop, once a call is started // the MF events (in-band signaling) are handled in the call thread openr2_chan_process_cas_signaling(r2chan); + } else { ftdm_log(FTDM_LOG_DEBUG, "Ignoring event %d on channel %d.\n", event->enum_id, openr2_chan_get_number(r2chan)); // XXX TODO: handle alarms here XXX } } + + /* XXX when ftdm_span_poll_event() returns FTDM_SUCCESS, means there are events pending on the span, + * is it possible to know on what channel there were events, without traversing the span? XXX + */ + for (i = 1; i <= span->chan_count; i++) { + r2chan = R2CALL(span->channels[i])->r2chan; + ftdmchan = openr2_chan_get_client_data(r2chan); + r2call = R2CALL(ftdmchan); + + ftdm_mutex_lock(ftdmchan->mutex); + ftdm_set_flag(r2call, FTDM_R2_PROCESSING); + + if (ftdm_r2_state_advance(ftdmchan)) { + ftdm_clear_flag(r2call, FTDM_R2_PROCESSING); + ftdm_mutex_unlock(ftdmchan->mutex); + continue; + } + + /* handle timeout events first if any */ + openr2_chan_run_schedule(r2chan); + + /* process mf tones, if any */ + if (openr2_chan_get_read_enabled(r2chan)) + openr2_chan_process_mf_signaling(r2chan); + + if (ftdm_r2_state_advance(ftdmchan)) { + ftdm_clear_flag(r2call, FTDM_R2_PROCESSING); + ftdm_mutex_unlock(ftdmchan->mutex); + continue; + } + + ftdm_clear_flag(r2call, FTDM_R2_PROCESSING); + ftdm_mutex_unlock(ftdmchan->mutex); + } } else if (status != FTDM_TIMEOUT) { ftdm_log(FTDM_LOG_ERROR, "ftdm_span_poll_event returned %d.\n", status); - } else { - //ftdm_log(FTDM_LOG_DEBUG, "timed out waiting for event on span %d\n", span->span_id); - } + } else { + } + } - /* - FIXME: we should set BLOCKED but at this point I/O routines of freetdm caused segfault for (i = 1; i <= span->chan_count; i++) { r2chan = R2CALL(span->channels[i])->r2chan; openr2_chan_set_blocked(r2chan); } - */ ftdm_clear_flag(r2data, FTDM_R2_RUNNING); ftdm_log(FTDM_LOG_DEBUG, "R2 thread ending.\n"); return NULL; +} +static void __inline__ block_channel(ftdm_channel_t *fchan, ftdm_stream_handle_t *stream) +{ + openr2_chan_t *r2chan = R2CALL(fchan)->r2chan; + ftdm_mutex_lock(fchan->mutex); + if (fchan->state != FTDM_CHANNEL_STATE_DOWN) { + stream->write_function(stream, "cannot block channel %d:%d because has a call in progress\n", + fchan->span_id, fchan->chan_id); + } else if (ftdm_test_flag(fchan, FTDM_CHANNEL_SUSPENDED)) { + stream->write_function(stream, "cannot block channel %d:%d because is already blocked\n", + fchan->span_id, fchan->chan_id); + } else { + if (!openr2_chan_set_blocked(r2chan)) { + ftdm_set_flag(fchan, FTDM_CHANNEL_SUSPENDED); + stream->write_function(stream, "blocked channel %d:%d\n", + fchan->span_id, fchan->chan_id); + } else { + stream->write_function(stream, "failed to block channel %d:%d\n", + fchan->span_id, fchan->chan_id); + } + } + ftdm_mutex_unlock(fchan->mutex); +} + +static void __inline__ unblock_channel(ftdm_channel_t *fchan, ftdm_stream_handle_t *stream) +{ + openr2_chan_t *r2chan = R2CALL(fchan)->r2chan; + ftdm_mutex_lock(fchan->mutex); + if (ftdm_test_flag(fchan, FTDM_CHANNEL_SUSPENDED)) { + if (!openr2_chan_set_idle(r2chan)) { + ftdm_clear_flag(fchan, FTDM_CHANNEL_SUSPENDED); + stream->write_function(stream, "unblocked channel %d:%d\n", + fchan->span_id, fchan->chan_id); + } else { + stream->write_function(stream, "failed to unblock channel %d:%d\n", + fchan->span_id, fchan->chan_id); + } + } else { + stream->write_function(stream, "cannot unblock channel %d:%d because is not blocked\n", + fchan->span_id, fchan->chan_id); + } + ftdm_mutex_unlock(fchan->mutex); } static FIO_API_FUNCTION(ftdm_r2_api) { + ftdm_span_t *span = NULL; char *mycmd = NULL, *argv[10] = { 0 }; int argc = 0; + int span_id = 0; + int chan_id = 0; + int i = 0; if (data) { mycmd = ftdm_strdup(data); argc = ftdm_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); } - if (argc == 2) { - if (!strcasecmp(argv[0], "kill")) { + if (argc >= 2) { + if (!strcasecmp(argv[0], "block")) { int span_id = atoi(argv[1]); - ftdm_span_t *span = NULL; if (ftdm_span_find_by_name(argv[1], &span) == FTDM_SUCCESS || ftdm_span_find(span_id, &span) == FTDM_SUCCESS) { - ftdm_r2_data_t *r2data = span->signal_data; if (span->start != ftdm_r2_start) { stream->write_function(stream, "-ERR invalid span.\n"); goto done; } - ftdm_clear_flag(r2data, FTDM_R2_RUNNING); - stream->write_function(stream, "+OK killed.\n"); + if (argc > 2) { + chan_id = atoi(argv[2]); + if (chan_id && chan_id <= span->chan_count) { + block_channel(span->channels[chan_id], stream); + } else { + stream->write_function(stream, "-ERR invalid chan %d.\n", chan_id); + } + } else { + for (i = 1; i <= span->chan_count; i++) { + block_channel(span->channels[i], stream); + } + } + stream->write_function(stream, "+OK blocked.\n"); goto done; } else { stream->write_function(stream, "-ERR invalid span.\n"); @@ -1204,13 +1550,43 @@ static FIO_API_FUNCTION(ftdm_r2_api) } } + if (!strcasecmp(argv[0], "unblock")) { + span_id = atoi(argv[1]); + if (ftdm_span_find_by_name(argv[1], &span) == FTDM_SUCCESS || ftdm_span_find(span_id, &span) == FTDM_SUCCESS) { + + if (span->start != ftdm_r2_start) { + stream->write_function(stream, "-ERR invalid span.\n"); + goto done; + } + + if (argc > 2) { + chan_id = atoi(argv[2]); + if (chan_id && chan_id <= span->chan_count) { + unblock_channel(span->channels[chan_id], stream); + } else { + stream->write_function(stream, "-ERR invalid chan %d.\n", chan_id); + } + } else { + for (i = 1; i <= span->chan_count; i++) { + unblock_channel(span->channels[i], stream); + } + } + + stream->write_function(stream, "+OK.\n"); + goto done; + } else { + stream->write_function(stream, "-ERR invalid span.\n"); + goto done; + } + + } + if (!strcasecmp(argv[0], "status")) { - int span_id = atoi(argv[1]); + //openr2_chan_stats_t stats; + span_id = atoi(argv[1]); ftdm_r2_data_t *r2data = NULL; - ftdm_span_t *span = NULL; openr2_chan_t *r2chan = NULL; openr2_context_t *r2context = NULL; - int i = 0; if (ftdm_span_find_by_name(argv[1], &span) == FTDM_SUCCESS || ftdm_span_find(span_id, &span) == FTDM_SUCCESS) { if (span->start != ftdm_r2_start) { @@ -1228,21 +1604,44 @@ static FIO_API_FUNCTION(ftdm_r2_api) "Max ANI: %d\n" "Max DNIS: %d\n" "ANI First: %s\n" - "Immediate Accept: %s\n", + "Immediate Accept: %s\n" + "Side: %s\n" + "Job Max ms: %d\n" + "Job Loops: %lu\n" + "Monitor Thread: %lu\n", openr2_proto_get_variant_string(r2variant), openr2_context_get_max_ani(r2context), openr2_context_get_max_dnis(r2context), openr2_context_get_ani_first(r2context) ? "Yes" : "No", - openr2_context_get_immediate_accept(r2context) ? "Yes" : "No"); + openr2_context_get_immediate_accept(r2context) ? "Yes" : "No", + "no side", + r2data->jobmax, + r2data->loops, + r2data->monitor_thread_id); stream->write_function(stream, "\n"); - stream->write_function(stream, "%4s %-12.12s %-12.12s\n", "Channel", "Tx CAS", "Rx CAS"); + stream->write_function(stream, "%4s %-12.12s %-12.12s %6s %6s %6s %6s\n", "Channel", "Tx CAS", "Rx CAS", + "Rx Avg", "Tx Avg", "Rx", "Tx"); for (i = 1; i <= span->chan_count; i++) { - if (i == 16) continue; + char rx_str[25]; + char tx_str[25]; + char rxavg_str[25]; + char txavg_str[25]; r2chan = R2CALL(span->channels[i])->r2chan; - stream->write_function(stream, "%4d %-12.12s %-12.12s\n", - span->channels[i]->physical_chan_id, +#if 0 + openr2_chan_get_stats(r2chan, &stats); + snprintf(rx_str, sizeof(rx_str), "%lu", stats.rxcount); + snprintf(tx_str, sizeof(tx_str), "%lu", stats.txcount); + snprintf(rxavg_str, sizeof(rxavg_str), "%u", stats.rxavg); + snprintf(txavg_str, sizeof(txavg_str), "%u", stats.txavg); +#endif + stream->write_function(stream, "%4d %-12.12s %-12.12s %6s %6s %6s %6s\n", + span->channels[i]->chan_id, openr2_chan_get_tx_cas_string(r2chan), - openr2_chan_get_rx_cas_string(r2chan)); + openr2_chan_get_rx_cas_string(r2chan), + rxavg_str, + txavg_str, + rx_str, + tx_str); } stream->write_function(stream, "\n"); stream->write_function(stream, "+OK.\n"); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c index 7234e67..a975204 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c @@ -1725,7 +1725,7 @@ static __inline__ ftdm_status_t check_events(ftdm_span_t *span, int ms_timeout) ftdm_status_t status; ftdm_sangoma_boost_data_t *sangoma_boost_data = span->signal_data; - status = ftdm_span_poll_event(span, ms_timeout); + status = ftdm_span_poll_event(span, ms_timeout, NULL); switch(status) { case FTDM_SUCCESS: diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index be99f94..5a472e5 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -865,11 +865,11 @@ FIO_SPAN_POLL_EVENT_FUNCTION(wanpipe_poll_event) continue; /* should never happen but happens when shutting down */ } pfds[j] = ftdmchan->mod_data; - inflags[j] = POLLPRI; + inflags[j] = poll_events ? poll_events[j] : POLLPRI; #else memset(&pfds[j], 0, sizeof(pfds[j])); pfds[j].fd = span->channels[i]->sockfd; - pfds[j].events = POLLPRI; + pfds[j].events = poll_events ? poll_events[j] : POLLPRI; #endif /* The driver probably should be able to do this wink/flash/ringing by itself this is sort of a hack to make it work! */ diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 078875b..b1188e3 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -459,7 +459,7 @@ struct ftdm_memory_handler { #define FIO_CHANNEL_GET_SIG_STATUS_ARGS (ftdm_channel_t *ftdmchan, ftdm_signaling_status_t *status) #define FIO_SPAN_SET_SIG_STATUS_ARGS (ftdm_span_t *span, ftdm_signaling_status_t status) #define FIO_SPAN_GET_SIG_STATUS_ARGS (ftdm_span_t *span, ftdm_signaling_status_t *status) -#define FIO_SPAN_POLL_EVENT_ARGS (ftdm_span_t *span, uint32_t ms) +#define FIO_SPAN_POLL_EVENT_ARGS (ftdm_span_t *span, uint32_t ms, short *poll_events) #define FIO_SPAN_NEXT_EVENT_ARGS (ftdm_span_t *span, ftdm_event_t **event) #define FIO_SIGNAL_CB_ARGS (ftdm_sigmsg_t *sigmsg) #define FIO_EVENT_CB_ARGS (ftdm_channel_t *ftdmchan, ftdm_event_t *event) @@ -820,12 +820,13 @@ FT_DECLARE(void) ftdm_channel_flush_dtmf(ftdm_channel_t *ftdmchan); * * \param span The span to wait events for * \param ms Milliseconds timeout + * \param poll_events Array of events to poll for, for each channel on the span * * \retval FTDM_SUCCESS success (at least one event available) * \retval FTDM_TIMEOUT Timed out waiting for events * \retval FTDM_FAIL failure */ -FT_DECLARE(ftdm_status_t) ftdm_span_poll_event(ftdm_span_t *span, uint32_t ms); +FT_DECLARE(ftdm_status_t) ftdm_span_poll_event(ftdm_span_t *span, uint32_t ms, short *poll_events); /*! * \brief Find a span by its id commit b4548a606ee98c29df8cdffb6fe0966843dcbbcb Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Sep 23 13:33:33 2010 -0500 FSCORE-677 diff --git a/src/switch_regex.c b/src/switch_regex.c index 88152f9..38c527c 100644 --- a/src/switch_regex.c +++ b/src/switch_regex.c @@ -215,7 +215,7 @@ SWITCH_DECLARE(switch_status_t) switch_regex_match_partial(const char *target, c if (match_count > 0) { *partial = 0; return SWITCH_STATUS_SUCCESS; - } else if (match_count == PCRE_ERROR_PARTIAL) { + } else if (match_count == PCRE_ERROR_PARTIAL || match_count == PCRE_ERROR_BADPARTIAL) { /* yes it is already set, but the code is clearer this way */ *partial = 1; return SWITCH_STATUS_SUCCESS; commit 89d99a919608d52cc3811da82ac22379eb8ebbc7 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Sep 23 13:31:53 2010 -0500 fix switch_ivr_collect_digits_callback to allow an args pointer with null callback to work like other apis diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 3d2a79c..246b18e 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -876,7 +876,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_s switch_time_t abs_started = 0, digit_started = 0; uint32_t abs_elapsed = 0, digit_elapsed = 0; - if (!args || !args->input_callback) { + if (!args) { return SWITCH_STATUS_GENERR; } @@ -917,6 +917,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_s if (switch_channel_has_dtmf(channel)) { + if (!args->input_callback && !args->buf) { + status = SWITCH_STATUS_BREAK; + break; + } switch_channel_dequeue_dtmf(channel, &dtmf); status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen); if (digit_timeout) { commit 1c9fe263d67c0828615857e4dfd8c40dad61f295 Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Sep 23 13:58:20 2010 -0400 Changed ftdm_cpu_monitor behaviour diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 086cc4a..3ad4393 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -4099,8 +4099,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_freetdm_load) ftdm_global_set_config_directory(SWITCH_GLOBAL_dirs.conf_dir); - ftdm_cpu_monitor_disable(); - if (ftdm_global_init() != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_ERROR, "Error loading FreeTDM\n"); return SWITCH_STATUS_TERM; diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 0cb2170..18ae87c 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -86,6 +86,7 @@ FT_DECLARE(ftdm_time_t) ftdm_current_time_in_ms(void) } typedef struct { + uint8_t enabled; uint8_t running; uint8_t alarm; uint32_t interval; @@ -112,8 +113,6 @@ static struct { cpu_monitor_t cpu_monitor; } globals; -static uint8_t ftdm_cpu_monitor_disabled = 0; - enum ftdm_enum_cpu_alarm_action_flags { FTDM_CPU_ALARM_ACTION_WARN = (1 << 0), @@ -4004,7 +4003,14 @@ static ftdm_status_t load_config(void) ftdm_log(FTDM_LOG_ERROR, "unknown span variable '%s'\n", var); } } else if (!strncasecmp(cfg.category, "general", 7)) { - if (!strncasecmp(var, "cpu_monitoring_interval", sizeof("cpu_monitoring_interval")-1)) { + if (!strncasecmp(var, "cpu_monitor", sizeof("cpu_monitor")-1)) { + if (!strncasecmp(val, "yes", 3)) { + globals.cpu_monitor.enabled = 1; + if (!globals.cpu_monitor.alarm_action_flags) { + globals.cpu_monitor.alarm_action_flags |= FTDM_CPU_ALARM_ACTION_WARN; + } + } + } else if (!strncasecmp(var, "cpu_monitoring_interval", sizeof("cpu_monitoring_interval")-1)) { if (atoi(val) > 0) { globals.cpu_monitor.interval = atoi(val); } else { @@ -4749,12 +4755,6 @@ static void ftdm_cpu_monitor_stop(void) ftdm_interrupt_destroy(&globals.cpu_monitor.interrupt); } -FT_DECLARE(void) ftdm_cpu_monitor_disable(void) -{ - ftdm_cpu_monitor_disabled = 1; -} - - FT_DECLARE(ftdm_status_t) ftdm_global_init(void) { memset(&globals, 0, sizeof(globals)); @@ -4796,8 +4796,9 @@ FT_DECLARE(ftdm_status_t) ftdm_global_configuration(void) ftdm_log(FTDM_LOG_NOTICE, "Modules configured: %d \n", modcount); + globals.cpu_monitor.enabled = 0; globals.cpu_monitor.interval = 1000; - globals.cpu_monitor.alarm_action_flags = FTDM_CPU_ALARM_ACTION_WARN | FTDM_CPU_ALARM_ACTION_REJECT; + globals.cpu_monitor.alarm_action_flags = 0; globals.cpu_monitor.set_alarm_threshold = 80; globals.cpu_monitor.reset_alarm_threshold = 70; @@ -4807,7 +4808,12 @@ FT_DECLARE(ftdm_status_t) ftdm_global_configuration(void) return FTDM_FAIL; } - if (!ftdm_cpu_monitor_disabled) { + if (globals.cpu_monitor.enabled) { + ftdm_log(FTDM_LOG_INFO, "CPU Monitor is running interval:%d lo-thres:%d hi-thres:%d\n", + globals.cpu_monitor.interval, + globals.cpu_monitor.set_alarm_threshold, + globals.cpu_monitor.reset_alarm_threshold); + if (ftdm_cpu_monitor_start() != FTDM_SUCCESS) { return FTDM_FAIL; } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c index 942c2e4..3a4a001 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c @@ -608,9 +608,10 @@ ftdm_status_t sng_isdn_stack_cfg_q931_dlsap(ftdm_span_t *span) cfg.hdr.entId.ent = ENTIN; cfg.hdr.entId.inst = S_INST; cfg.hdr.elmId.elmnt = STDLSAP; - + cfg.hdr.response.selector=0; + cfg.t.cfg.s.inDLSAP.sapId = signal_data->link_id; cfg.t.cfg.s.inDLSAP.spId = signal_data->link_id; cfg.t.cfg.s.inDLSAP.swtch = sng_isdn_stack_switchtype(signal_data->switchtype); commit 9fc6b2087a08b9deb560d36ac30c0ca25e2692e2 Author: Mathieu Parent <math.parent@gmail.com> Date: Thu Sep 23 19:48:25 2010 +0200 Skinny: no need for heartbeat event to handle keepalive timeout diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index 1658150..c67c20f 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -1343,19 +1343,6 @@ static switch_status_t kill_listener(listener_t *listener, void *pvt) return SWITCH_STATUS_SUCCESS; } -static switch_status_t kill_expired_listener(listener_t *listener, void *pvt) -{ - switch_event_t *event = NULL; - - if(listener->expire_time < switch_epoch_time_now(NULL)) { - /* skinny::expire event */ - skinny_device_event(listener, &event, SWITCH_EVENT_CUSTOM, SKINNY_EVENT_EXPIRE); - switch_event_fire(&event); - return kill_listener(listener, pvt); - } - return SWITCH_STATUS_SUCCESS; -} - switch_status_t keepalive_listener(listener_t *listener, void *pvt) { skinny_profile_t *profile; @@ -1414,6 +1401,13 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) case SWITCH_STATUS_TIMEOUT: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Communication Time Out with %s:%d.\n", listener->remote_ip, listener->remote_port); + + if(listener->expire_time < switch_epoch_time_now(NULL)) { + switch_event_t *event = NULL; + /* skinny::expire event */ + skinny_device_event(listener, &event, SWITCH_EVENT_CUSTOM, SKINNY_EVENT_EXPIRE); + switch_event_fire(&event); + } break; default: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Communication Error with %s:%d.\n", @@ -1917,11 +1911,6 @@ static switch_status_t load_skinny_config(void) return SWITCH_STATUS_SUCCESS; } -static void skinny_heartbeat_event_handler(switch_event_t *event) -{ - walk_listeners(kill_expired_listener, NULL); -} - static void skinny_call_state_event_handler(switch_event_t *event) { char *subclass; @@ -2129,10 +2118,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skinny_load) return SWITCH_STATUS_TERM; } /* bind to events */ - if ((switch_event_bind_removable(modname, SWITCH_EVENT_HEARTBEAT, NULL, skinny_heartbeat_event_handler, NULL, &globals.heartbeat_node) != SWITCH_STATUS_SUCCESS)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Couldn't bind our heartbeat handler!\n"); - /* Not such severe to prevent loading */ - } if ((switch_event_bind_removable(modname, SWITCH_EVENT_CUSTOM, SKINNY_EVENT_CALL_STATE, skinny_call_state_event_handler, NULL, &globals.call_state_node) != SWITCH_STATUS_SUCCESS)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind our call_state handler!\n"); return SWITCH_STATUS_TERM; @@ -2205,7 +2190,6 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skinny_shutdown) skinny_api_unregister(); /* release events */ - switch_event_unbind(&globals.heartbeat_node); switch_event_unbind(&globals.call_state_node); switch_event_unbind(&globals.message_waiting_node); switch_event_unbind(&globals.trap_node); diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.h b/src/mod/endpoints/mod_skinny/mod_skinny.h index bbd318b..7a4df6f 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.h +++ b/src/mod/endpoints/mod_skinny/mod_skinny.h @@ -49,7 +49,6 @@ struct skinny_globals { switch_memory_pool_t *pool; switch_mutex_t *mutex; switch_hash_t *profile_hash; - switch_event_node_t *heartbeat_node; switch_event_node_t *call_state_node; switch_event_node_t *message_waiting_node; switch_event_node_t *trap_node; diff --git a/src/mod/endpoints/mod_skinny/skinny_protocol.c b/src/mod/endpoints/mod_skinny/skinny_protocol.c index 1aea812..465e41b 100644 --- a/src/mod/endpoints/mod_skinny/skinny_protocol.c +++ b/src/mod/endpoints/mod_skinny/skinny_protocol.c @@ -135,6 +135,10 @@ switch_status_t skinny_read_packet(listener_t *listener, skinny_message_t **req) status = switch_socket_recv(listener->sock, ptr, &mlen); + if (listener->expire_time && listener->expire_time < switch_epoch_time_now(NULL)) { + return SWITCH_STATUS_TIMEOUT; + } + if (!listener_is_ready(listener)) { break; } commit 4f46bb91fc142b4115509790b6669b8e559d6208 Author: Mathieu Parent <math.parent@gmail.com> Date: Thu Sep 23 15:34:44 2010 +0200 debian: * Updated Uploaders list * Updated Standards-Version to 3.9.1 diff --git a/debian/changelog b/debian/changelog index d49637c..7f4e8d7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,14 @@ freeswitch (1.0.6-1ubuntu1) maverick; urgency=low + [ Gabriel Gunderson ] * upgrade: Added mod_callcenter and pulled out Python into its own package. - -- Gabriel Gunderson <gabe@gundy.org> Thu, 16 Nov 2010 18:28:30 -0800 + [ Mathieu Parent ] + * Updated Uploaders list + * Updated Standards-Version to 3.9.1 + + -- Mathieu Parent <sathieu@debian.org> Thu, 23 Sep 2010 15:34:00 +0200 freeswitch (1.0.4-1ubuntu2) karmic; urgency=low diff --git a/debian/control b/debian/control index 145f28d..92b4e6a 100644 --- a/debian/control +++ b/debian/control @@ -1,10 +1,11 @@ Source: freeswitch Section: comm Priority: extra -Maintainer: Michal Bielicki <michal.bielicki@voiceworks.pl> +Maintainer: FreeSWITCH developers <freeswitch-dev@lists.freeswitch.org> +Uploaders: Michal Bielicki <michal.bielicki@voiceworks.pl>, Gabriel Gunderson <gabe@gundy.org>, William King <quentusrex@gmail.com>, Mathieu Parent <sathieu@debian.org> Build-Depends: debhelper (>= 5), fakeroot, wget, automake (>=1.9), autoconf, libtool, unixodbc-dev, libasound2-dev, libcurl3-openssl-dev|libcurl4-openssl-dev, libssl-dev, ncurses-dev, libogg-dev, libvorbis-dev, libperl-dev, libgdbm-dev, libdb-dev, libgnutls-dev, libtiff4-dev, python-dev, libx11-dev, uuid-dev Homepage: http://freeswitch.org/ -Standards-Version: 3.8.4 +Standards-Version: 3.9.1 Vcs-Svn: http://svn.freeswitch.org/svn/freeswitch/trunk/ Vcs-Browser: http://fisheye.freeswitch.org/browse/FreeSWITCH commit a9446ac12e9fc0a30c3b1638b9567824d1083824 Author: Brian West <brian@freeswitch.org> Date: Thu Sep 23 11:16:47 2010 -0500 SFSIP-227 diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 259a81f..d2bf096 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1238,7 +1238,12 @@ static void start_udptl(private_object_t *tech_pvt, switch_t38_options_t *t38_op switch_rtp_udptl_mode(tech_pvt->rtp_session); - if (remote_host && remote_port && !strcmp(remote_host, t38_options->remote_ip) && remote_port == t38_options->remote_port) { + if (!t38_options || !t38_options->remote_ip) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "No remote address\n"); + return; + } + + if (remote_host && remote_port && remote_port == t38_options->remote_port && !strcmp(remote_host, t38_options->remote_ip)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Remote address:port [%s:%d] has not changed.\n", t38_options->remote_ip, t38_options->remote_port); return; diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 519cb3d..6a33b3e 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -3450,9 +3450,9 @@ static switch_t38_options_t *tech_process_udptl(private_object_t *tech_pvt, sdp_ t38_options->remote_port = m->m_port; - if (m->m_connections) { + if (m->m_connections && m->m_connections->c_address) { t38_options->remote_ip = switch_core_session_strdup(tech_pvt->session, m->m_connections->c_address); - } else if (sdp && sdp->sdp_connection) { + } else if (sdp && sdp->sdp_connection && sdp->sdp_connection->c_address) { t38_options->remote_ip = switch_core_session_strdup(tech_pvt->session, sdp->sdp_connection->c_address); } commit f37729152d625e24c4a6303be2bad8a8245765c2 Author: Moises Silva <moises.silva@gmail.com> Date: Thu Sep 23 09:30:08 2010 -0400 freetdm: dump uuid of the channel associated session if any diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 8ec44ef..086cc4a 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -3451,7 +3451,10 @@ void dump_chan(ftdm_span_t *span, uint32_t chan_id, switch_stream_handle_t *stre const char *chan_type; const char *state; const char *last_state; + const char *uuid = NULL; + char sessionid[255]; float txgain, rxgain; + switch_core_session_t *session = NULL; ftdm_alarm_flag_t alarmflag; ftdm_caller_data_t *caller_data; ftdm_channel_t *ftdmchan; @@ -3461,6 +3464,7 @@ void dump_chan(ftdm_span_t *span, uint32_t chan_id, switch_stream_handle_t *stre return; } + strcpy(sessionid, "(none)"); ftdmchan = ftdm_span_get_channel(span, chan_id); span_id = ftdm_span_get_id(span); @@ -3475,6 +3479,16 @@ void dump_chan(ftdm_span_t *span, uint32_t chan_id, switch_stream_handle_t *stre ftdm_channel_get_sig_status(ftdmchan, &sigstatus); ftdm_channel_get_alarms(ftdmchan, &alarmflag); + uuid = ftdm_channel_get_uuid(ftdmchan, 0); + if (!zstr(uuid)) { + if (!(session = switch_core_session_locate(uuid))) { + snprintf(sessionid, sizeof(sessionid), "%s (dead)", uuid); + } else { + snprintf(sessionid, sizeof(sessionid), "%s", uuid); + switch_core_session_rwunlock(session); + } + } + stream->write_function(stream, "span_id: %u\n" "chan_id: %u\n" @@ -3494,7 +3508,8 @@ void dump_chan(ftdm_span_t *span, uint32_t chan_id, switch_stream_handle_t *stre "aniII: %s\n" "dnis: %s\n" "rdnis: %s\n" - "cause: %s\n\n", + "cause: %s\n" + "session: %s\n\n", span_id, chan_id, phspan_id, @@ -3513,7 +3528,8 @@ void dump_chan(ftdm_span_t *span, uint32_t chan_id, switch_stream_handle_t *stre caller_data->aniII, caller_data->dnis.digits, caller_data->rdnis.digits, - switch_channel_cause2str(caller_data->hangup_cause)); + switch_channel_cause2str(caller_data->hangup_cause), + sessionid); } void dump_chan_xml(ftdm_span_t *span, uint32_t chan_id, switch_stream_handle_t *stream) commit 0cc28f37fb7c37e743d3263a9cac55f74578d430 Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Sep 23 08:15:55 2010 -0500 FSCORE-676 Buffer too small diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 68cc58d..9b5455b 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -3045,7 +3045,7 @@ SWITCH_STANDARD_API(xml_wrap_api_function) if (mystream.data) { if (encoded) { - elen = (int) strlen(mystream.data) * 3; + elen = (int) strlen(mystream.data) * 3 + 1; edata = malloc(elen); switch_assert(edata != NULL); memset(edata, 0, elen); diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index dc1995f..1bc2201 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -3733,7 +3733,7 @@ static switch_status_t conf_api_sub_list(conference_obj_t *conference, switch_st static switch_xml_t add_x_tag(switch_xml_t x_member, const char *name, const char *value, int off) { - switch_size_t dlen = strlen(value) * 3; + switch_size_t dlen = strlen(value) * 3 + 1; char *data; switch_xml_t x_tag; diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 069cfd8..84e3ec4 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -3678,7 +3678,7 @@ static int web_callback(void *pArg, int argc, char **argv, char **columnNames) const char *fmt = "%a, %e %b %Y %T %z"; char heard[80]; char title_b4[128] = ""; - char title_aft[128 * 3] = ""; + char title_aft[128 * 3 + 1] = ""; if (argc > 0) { l_created = switch_time_make(atol(argv[0]), 0); diff --git a/src/mod/formats/mod_shout/mod_shout.c b/src/mod/formats/mod_shout/mod_shout.c index d3fa2e8..97f20b8 100644 --- a/src/mod/formats/mod_shout/mod_shout.c +++ b/src/mod/formats/mod_shout/mod_shout.c @@ -1100,7 +1100,7 @@ static int web_callback(void *pArg, int argc, char **argv, char **columnNames) { struct holder *holder = (struct holder *) pArg; char title_b4[128] = ""; - char title_aft[128 * 3] = ""; + char title_aft[128 * 3 + 1] = ""; char *mp3, *m3u; /* diff --git a/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c b/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c index 83f9f72..84643dc 100644 --- a/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c +++ b/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c @@ -264,7 +264,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) if (globals.encode == ENCODING_TEXTXML) { headers = curl_slist_append(headers, "Content-Type: text/xml"); } else if (globals.encode) { - switch_size_t need_bytes = strlen(xml_text) * 3; + switch_size_t need_bytes = strlen(xml_text) * 3 + 1; xml_text_escaped = malloc(need_bytes); switch_assert(xml_text_escaped); diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 6358eb4..3d2a79c 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -1841,7 +1841,7 @@ SWITCH_DECLARE(int) switch_ivr_set_xml_chan_vars(switch_xml_t xml, switch_channe for (; hi; hi = hi->next) { if (!zstr(hi->name) && !zstr(hi->value) && ((variable = switch_xml_add_child_d(xml, hi->name, off++)))) { char *data; - switch_size_t dlen = strlen(hi->value) * 3; + switch_size_t dlen = strlen(hi->value) * 3 + 1; if ((data = malloc(dlen))) { memset(data, 0, dlen); commit 2293f09da43d054658439b02496e82aea370e050 Merge: d9fece6 640b81a Author: Moises Silva <moises.silva@gmail.com> Date: Thu Sep 23 07:40:49 2010 -0400 Merge branch 'moy.statedebug' commit d9fece6c0e325ee0a5394807395f2b2e2bf68f20 Author: Konrad Hammel <konrad@sangoma.com> Date: Thu Sep 23 10:09:38 2010 -0400 freetdm: ss7 - update to timers to match changes in core timers diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index 19f042b..3ef8db5 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -493,7 +493,7 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /*now go to the RING state */ ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_RING); - } else if (i > g_ftdm_sngss7_data.min_digits) { + } else if (i >= g_ftdm_sngss7_data.min_digits) { SS7_DEBUG_CHAN(ftdmchan, "Received %d digits (min digits = %d)\n", i, g_ftdm_sngss7_data.min_digits); /*now go to the RING state */ @@ -511,7 +511,7 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) sngss7_info->t35.beat, sngss7_info->t35.callback, &sngss7_info->t35, - &sngss7_info->t35.heartbeat_timer)) { + &sngss7_info->t35.hb_timer_id)) { SS7_ERROR ("Unable to schedule timer, hanging up call!\n"); @@ -536,8 +536,8 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) } /* kill t35 if active */ - if (sngss7_info->t35.heartbeat_timer) { - ftdm_sched_cancel_timer (sngss7_info->t35.sched,&sngss7_info->t35.heartbeat_timer); + if (sngss7_info->t35.hb_timer_id) { + ftdm_sched_cancel_timer (sngss7_info->t35.sched, sngss7_info->t35.hb_timer_id); } SS7_DEBUG_CHAN(ftdmchan, "Sending incoming call from %s to %s to FTDM core\n", @@ -816,8 +816,8 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) } /* if ((ftdmchan->last_state == FTDM_CHANNEL_STATE_RESTART) */ /* check if t35 is active */ - if (sngss7_info->t35.heartbeat_timer) { - ftdm_sched_cancel_timer (sngss7_info->t35.sched, &sngss7_info->t35.heartbeat_timer); + if (sngss7_info->t35.hb_timer_id) { + ftdm_sched_cancel_timer (sngss7_info->t35.sched, sngss7_info->t35.hb_timer_id); } /* clear all of the call specific data store in the channel structure */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index 415a897..850bbf0 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -316,7 +316,7 @@ typedef struct ftdm_sngss7_data { }ftdm_sngss7_data_t; typedef struct sngss7_timer_data { - ftdm_timer_t *heartbeat_timer; + ftdm_timer_id_t hb_timer_id; int beat; int counter; ftdm_sched_callback_t callback; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c index 5185ffc..75b32d6 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c @@ -64,7 +64,7 @@ void handle_isup_t35(void *userdata) sngss7_set_flag(sngss7_info, FLAG_LOCAL_REL); /* hang up on timer expiry */ - ftdmchan->caller_data.hangup_cause = 102; + ftdmchan->caller_data.hangup_cause = 28; /* end the call */ ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); commit 640b81a27c6cffa927e9fd36bb3c0a9c3b0c4bfe Author: Moises Silva <moises.silva@gmail.com> Date: Thu Sep 23 07:38:58 2010 -0400 freetdm: improve state debug dumping diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 8299718..393f641 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -5224,49 +5224,55 @@ FT_DECLARE(char *) ftdm_strndup(const char *str, ftdm_size_t inlen) } #define FTDM_DEBUG_LINE_LEN 255 +#define handle_snprintf_result(buff, written, len, debugstr) \ + if (written >= len) { \ + ftdm_free(debugstr); \ + return NULL; \ + } \ + len -= written; \ + buff += written; + FT_DECLARE(char *) ftdm_channel_get_history_str(const ftdm_channel_t *fchan) { - uint8_t j = 0; + char func[255]; + char line[255]; + char states[255]; int written = 0; char *buff = NULL; - uint8_t i = fchan->hindex; - + uint8_t i = 0; int dbglen = ftdm_array_len(fchan->history) * FTDM_DEBUG_LINE_LEN; int len = dbglen; + if (!fchan->history[0].file) { + return ftdm_strdup("-- No state history --\n"); + } + char *debugstr = ftdm_calloc(1, dbglen); if (!debugstr) { return NULL; } buff = debugstr; + written = snprintf(buff, len, "%-30.30s %-30.30s %s", "-- States --", "-- Function --", "-- Location --\n"); + handle_snprintf_result(buff, written, len, debugstr); + for (i = fchan->hindex; i < ftdm_array_len(fchan->history); i++) { if (!fchan->history[i].file) { break; } - written = snprintf(buff, len, "%s -> %s at %s %s:%d\n", - ftdm_channel_state2str(fchan->history[i].last_state), ftdm_channel_state2str(fchan->history[i].state), fchan->history[i].func, - fchan->history[i].file, fchan->history[i].line); - if (written >= len) { - ftdm_free(debugstr); - ftdm_log(FTDM_LOG_ERROR, "Not enough memory to build debug history string\n"); - return NULL; - } - len -= written; - buff += written; + snprintf(states, sizeof(states), "%-5.15s => %-5.15s", ftdm_channel_state2str(fchan->history[i].last_state), ftdm_channel_state2str(fchan->history[i].state)); + snprintf(func, sizeof(func), "[%s]", fchan->history[i].func); + snprintf(line, sizeof(func), "[%s:%d]", fchan->history[i].file, fchan->history[i].line); + written = snprintf(buff, len, "%-30.30s %-30.30s %s\n", states, func, line); + handle_snprintf_result(buff, written, len, debugstr); } - for (j = 0; j < fchan->hindex; j++) { - written = snprintf(buff, len, "%s -> %s at %s %s:%d\n", - ftdm_channel_state2str(fchan->history[i].last_state), ftdm_channel_state2str(fchan->history[i].state), fchan->history[i].func, - fchan->history[i].file, fchan->history[i].line); - if (written >= len) { - ftdm_free(debugstr); - ftdm_log(FTDM_LOG_ERROR, "Not enough memory to build debug history string\n"); - return NULL; - } - len -= written; - buff += written; + for (i = 0; i < fchan->hindex; i++) { + snprintf(states, sizeof(states), "%-5.15s => %-5.15s", ftdm_channel_state2str(fchan->history[i].last_state), ftdm_channel_state2str(fchan->history[i].state)); + snprintf(func, sizeof(func), "[%s]", fchan->history[i].func); + snprintf(line, sizeof(func), "[%s:%d]", fchan->history[i].file, fchan->history[i].line); + written = snprintf(buff, len, "%-30.30s %-30.30s %s\n", states, func, line); + handle_snprintf_result(buff, written, len, debugstr); } debugstr[dbglen-1] = 0; commit b02c69bba9f46cad37225a0986cae068f24dcd81 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Sep 22 18:14:24 2010 -0500 MODAPP-459 diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 9b8b051..ec9c2ed 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -203,9 +203,9 @@ static void *SWITCH_THREAD_FUNC timer_thread_run(switch_thread_t *thread, void * goto end; } - while(t38_state_list.thread_running) { + switch_mutex_lock(globals.cond_mutex); - switch_mutex_lock(globals.cond_mutex); + while(t38_state_list.thread_running) { switch_mutex_lock(t38_state_list.mutex); @@ -226,6 +226,8 @@ static void *SWITCH_THREAD_FUNC timer_thread_run(switch_thread_t *thread, void * switch_core_timer_next(&timer); } + + switch_mutex_unlock(globals.cond_mutex); end: diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 6bde9e5..0cc4da3 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -911,10 +911,9 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, sql_manager.thread_running = 1; - while (sql_manager.thread_running == 1) { - - switch_mutex_lock(sql_manager.cond_mutex); + switch_mutex_lock(sql_manager.cond_mutex); + while (sql_manager.thread_running == 1) { if (sql || switch_queue_trypop(sql_manager.sql_queue[0], &pop) == SWITCH_STATUS_SUCCESS || switch_queue_trypop(sql_manager.sql_queue[1], &pop) == SWITCH_STATUS_SUCCESS) { @@ -993,6 +992,8 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, } } + switch_mutex_unlock(sql_manager.cond_mutex); + while (switch_queue_trypop(sql_manager.sql_queue[0], &pop) == SWITCH_STATUS_SUCCESS) { free(pop); } commit cc42515e9f9428dbcef11d081f3396e3c6b46fd8 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Sep 22 16:38:45 2010 -0500 DOH left a line behind, regression from 0748711 MODAPP-453 diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 1cb1898..585e4bf 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -2956,7 +2956,6 @@ SWITCH_STANDARD_APP(fifo_function) switch_channel_set_variable(other_channel, "fifo_status", "DONE"); switch_channel_set_variable(other_channel, "fifo_timestamp", date); - switch_thread_rwlock_unlock(node->rwlock); send_presence(node); check_cancel(node); switch_core_session_rwunlock(other_session); commit 3548168d8ff14630914b79645f22433c2a5243ca Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Sep 22 16:05:44 2010 -0500 let ~ signify that multipart content will contain headers diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index e945c0d..519cb3d 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1527,7 +1527,11 @@ char *sofia_glue_get_multipart(switch_core_session_t *session, const char *prefi if (!strncasecmp(name, prefix, strlen(prefix))) { const char *hname = name + strlen(prefix); - stream.write_function(&stream, "--%s\nContent-Type: %s\nContent-Length: %d\n\n%s\n", boundary, hname, strlen(value) + 1, value); + if (*value == '~') { + stream.write_function(&stream, "--%s\nContent-Type: %s\nContent-Length: %d\n%s\n", boundary, hname, strlen(value), value + 1); + } else { + stream.write_function(&stream, "--%s\nContent-Type: %s\nContent-Length: %d\n\n%s\n", boundary, hname, strlen(value) + 1, value); + } x++; } } commit ed01944c15d93885aed94bd9e4f9cee86d8b4c86 Author: Moises Silva <moy@sangoma.com> Date: Wed Sep 22 14:59:06 2010 -0400 freetdm: add initial changes for FreeTDM channel history feature diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index b4a40f0..f875457 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -3660,7 +3660,12 @@ SWITCH_STANDARD_API(ft_function) if(chan_id > ftdm_span_get_chan_count(span)) { stream->write_function(stream, "-ERR invalid channel\n"); } else { + char *dbgstr = NULL; + ftdm_channel_t *fchan = ftdm_span_get_channel(span, chan_id); dump_chan(span, chan_id, stream); + dbgstr = ftdm_channel_get_history_str(fchan); + stream->write_function(stream, "%s\n", dbgstr); + ftdm_free(dbgstr); } } else { stream->write_function(stream, "+OK\n"); @@ -3989,7 +3994,7 @@ SWITCH_STANDARD_API(ft_function) if (rply) { stream->write_function(stream, "%s", rply); - free(rply); + ftdm_free(rply); } else { stream->write_function(stream, "-ERR Usage: %s\n", FT_SYNTAX); } diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 97aa01b..8299718 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -1293,6 +1293,16 @@ end: ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_DEBUG, "Changed state from %s to %s\n", ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state)); ftdmchan->last_state = ftdmchan->state; ftdmchan->state = state; + ftdmchan->history[ftdmchan->hindex].file = file; + ftdmchan->history[ftdmchan->hindex].func = func; + ftdmchan->history[ftdmchan->hindex].line = line; + ftdmchan->history[ftdmchan->hindex].state = ftdmchan->state; + ftdmchan->history[ftdmchan->hindex].last_state = ftdmchan->last_state; + ftdmchan->history[ftdmchan->hindex].time = ftdm_current_time_in_ms(); + ftdmchan->hindex++; + if (ftdmchan->hindex == ftdm_array_len(ftdmchan->history)) { + ftdmchan->hindex = 0; + } ftdm_set_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE); ftdm_mutex_lock(ftdmchan->span->mutex); @@ -5213,6 +5223,57 @@ FT_DECLARE(char *) ftdm_strndup(const char *str, ftdm_size_t inlen) return new; } +#define FTDM_DEBUG_LINE_LEN 255 +FT_DECLARE(char *) ftdm_channel_get_history_str(const ftdm_channel_t *fchan) +{ + uint8_t j = 0; + int written = 0; + char *buff = NULL; + uint8_t i = fchan->hindex; + + int dbglen = ftdm_array_len(fchan->history) * FTDM_DEBUG_LINE_LEN; + int len = dbglen; + + char *debugstr = ftdm_calloc(1, dbglen); + if (!debugstr) { + return NULL; + } + buff = debugstr; + + for (i = fchan->hindex; i < ftdm_array_len(fchan->history); i++) { + if (!fchan->history[i].file) { + break; + } + written = snprintf(buff, len, "%s -> %s at %s %s:%d\n", + ftdm_channel_state2str(fchan->history[i].last_state), ftdm_channel_state2str(fchan->history[i].state), fchan->history[i].func, + fchan->history[i].file, fchan->history[i].line); + if (written >= len) { + ftdm_free(debugstr); + ftdm_log(FTDM_LOG_ERROR, "Not enough memory to build debug history string\n"); + return NULL; + } + len -= written; + buff += written; + } + + for (j = 0; j < fchan->hindex; j++) { + written = snprintf(buff, len, "%s -> %s at %s %s:%d\n", + ftdm_channel_state2str(fchan->history[i].last_state), ftdm_channel_state2str(fchan->history[i].state), fchan->history[i].func, + fchan->history[i].file, fchan->history[i].line); + if (written >= len) { + ftdm_free(debugstr); + ftdm_log(FTDM_LOG_ERROR, "Not enough memory to build debug history string\n"); + return NULL; + } + len -= written; + buff += written; + } + + debugstr[dbglen-1] = 0; + + return debugstr; +} + /* For Emacs: * Local Variables: diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 1f50a2c..f4a515b 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -1277,7 +1277,13 @@ FT_DECLARE(const char *) ftdm_channel_get_state_str(const ftdm_channel_t *channe /*! \brief For display debugging purposes you can display this string which describes the last channel internal state */ FT_DECLARE(const char *) ftdm_channel_get_last_state_str(const ftdm_channel_t *channel); -/*! \brief For display debugging purposes you can display this string which describes the last channel internal state */ +/*! \brief For display debugging purposes you can display this string which describes the history of the channel + * \param The channel + * \return History string for the channel. You must free the string with ftdm_free + */ +FT_DECLARE(char *) ftdm_channel_get_history_str(const ftdm_channel_t *channel); + +/*! \brief Initialize channel state for an outgoing call */ FT_DECLARE(ftdm_status_t) ftdm_channel_init(ftdm_channel_t *ftdmchan); /*! \brief Initialize the library */ diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index a701c13..beee868 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -356,6 +356,15 @@ typedef struct { } ftdm_dtmf_debug_t; #endif +typedef struct { + const char *file; + const char *func; + int line; + ftdm_channel_state_t state; + ftdm_channel_state_t last_state; + ftdm_time_t time; +} ftdm_channel_history_entry_t; + /* 2^8 table size, one for each byte (sample) value */ #define FTDM_GAINS_TABLE_SIZE 256 struct ftdm_channel { @@ -381,6 +390,8 @@ struct ftdm_channel { ftdm_channel_state_t state; ftdm_channel_state_t last_state; ftdm_channel_state_t init_state; + ftdm_channel_history_entry_t history[10]; + uint8_t hindex; ftdm_mutex_t *mutex; teletone_dtmf_detect_state_t dtmf_detect; uint32_t buffer_delay; commit b36d015f0960107a43bc0683b46cf42e5df4df7f Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Sep 22 10:54:00 2010 -0500 fix issue leaving stale records in fifo_bridge table diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 940ac61..1cb1898 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -875,7 +875,7 @@ static void do_unbridge(switch_core_session_t *consumer_session, switch_core_ses char *sql; switch_event_t *event; - switch_channel_clear_app_flag(consumer_channel, FIFO_APP_BRIDGE_TAG); + switch_channel_clear_app_flag_key(__FILE__, consumer_channel, FIFO_APP_BRIDGE_TAG); switch_channel_set_variable(consumer_channel, "fifo_bridged", NULL); ts = switch_micro_time_now(); @@ -989,7 +989,7 @@ static switch_status_t messagehook (switch_core_session_t *session, switch_core_ goto end; } - switch_channel_set_app_flag(consumer_channel, FIFO_APP_BRIDGE_TAG); + switch_channel_set_app_flag_key(__FILE__, consumer_channel, FIFO_APP_BRIDGE_TAG); switch_channel_set_variable(consumer_channel, "fifo_bridged", "true"); switch_channel_set_variable(consumer_channel, "fifo_manual_bridge", "true"); @@ -1990,6 +1990,11 @@ static void dec_use_count(switch_core_session_t *session, switch_bool_t send_eve if ((outbound_id = switch_channel_get_variable(channel, "fifo_outbound_uuid"))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s untracking call on uuid %s!\n", switch_channel_get_name(channel), outbound_id); + + sql = switch_mprintf("delete from fifo_bridge where consumer_uuid='%q'", switch_core_session_get_uuid(session)); + fifo_execute_sql(sql, globals.sql_mutex); + switch_safe_free(sql); + del_bridge_call(outbound_id); sql = switch_mprintf("update fifo_outbound set use_count=use_count-1, stop_time=%ld, next_avail=%ld + lag + 1 where use_count > 0 and uuid='%q'", now, now, outbound_id); @@ -2043,7 +2048,7 @@ SWITCH_STANDARD_APP(fifo_track_call_function) add_bridge_call(data); - switch_channel_set_app_flag(channel, FIFO_APP_TRACKING); + switch_channel_set_app_flag_key(__FILE__, channel, FIFO_APP_TRACKING); switch_channel_set_variable(channel, "fifo_outbound_uuid", data); switch_channel_set_variable(channel, "fifo_track_call", "true"); @@ -2342,7 +2347,7 @@ SWITCH_STANDARD_APP(fifo_function) switch_channel_set_variable(channel, "fifo_timestamp", date); switch_channel_set_variable(channel, "fifo_serviced_uuid", NULL); - switch_channel_set_app_flag(channel, FIFO_APP_BRIDGE_TAG); + switch_channel_set_app_flag_key(__FILE__, channel, FIFO_APP_BRIDGE_TAG); if (chime_list) { char *list_dup = switch_core_session_strdup(session, chime_list); @@ -2415,10 +2420,10 @@ SWITCH_STANDARD_APP(fifo_function) } } - switch_channel_clear_app_flag(channel, FIFO_APP_BRIDGE_TAG); + abort: + + switch_channel_clear_app_flag_key(__FILE__, channel, FIFO_APP_BRIDGE_TAG); - abort: - fifo_caller_del(switch_core_session_get_uuid(session)); if (!aborted && switch_channel_ready(channel)) { @@ -2773,7 +2778,8 @@ SWITCH_STANDARD_APP(fifo_function) switch_channel_set_flag(other_channel, CF_BREAK); - while (switch_channel_ready(channel) && switch_channel_ready(other_channel) && switch_channel_test_app_flag(other_channel, FIFO_APP_BRIDGE_TAG)) { + while (switch_channel_ready(channel) && switch_channel_ready(other_channel) && + switch_channel_test_app_flag(other_channel, FIFO_APP_BRIDGE_TAG)) { status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); if (!SWITCH_READ_ACCEPTABLE(status)) { break; @@ -3078,7 +3084,7 @@ SWITCH_STANDARD_APP(fifo_function) switch_mutex_unlock(globals.mutex); - switch_channel_clear_app_flag(channel, FIFO_APP_BRIDGE_TAG); + switch_channel_clear_app_flag_key(__FILE__, channel, FIFO_APP_BRIDGE_TAG); switch_core_media_bug_resume(session); commit b6a533ee9a6676e708325762661dc3560198c230 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Sep 22 08:28:14 2010 -0500 fix endless loop on startup when specifying -nosql diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index c6b7f8d..6bde9e5 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -1539,6 +1539,7 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_ { switch_threadattr_t *thd_attr; switch_cache_db_handle_t *dbh; + uint32_t sanity = 400; sql_manager.memory_pool = pool; sql_manager.manage = manage; @@ -1678,7 +1679,7 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_ } switch_thread_create(&sql_manager.db_thread, thd_attr, switch_core_sql_db_thread, NULL, sql_manager.memory_pool); - while (!sql_manager.thread_running) { + while (sql_manager.manage && !sql_manager.thread_running && --sanity) { switch_yield(10000); } commit 72baaf6d231c69bbfbb015b2908c17a9005001e6 Author: Brian West <brian@freeswitch.org> Date: Tue Sep 21 19:22:20 2010 -0500 fix t38 passthru when port changes on re-invite diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index f07910d..259a81f 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1771,7 +1771,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi nua_update(tech_pvt->nh, TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)), TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), TAG_END()); - } else if ((ua && (switch_stristr("cisco", ua)))) { + } else if (0 && (ua && (switch_stristr("cisco", ua)))) { snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <sip:%s@%s>", name, number, tech_pvt->profile->sipip); sofia_set_flag_locked(tech_pvt, TFLAG_UPDATING_DISPLAY); diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index e8bbb6f..c851779 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -4138,6 +4138,36 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status if (status == 200 && sofia_test_flag(tech_pvt, TFLAG_T38_PASSTHRU) && has_t38) { if (sip->sip_payload && sip->sip_payload->pl_data) { switch_t38_options_t *t38_options = sofia_glue_extract_t38_options(session, sip->sip_payload->pl_data); + char *remote_host = switch_rtp_get_remote_host(tech_pvt->rtp_session); + switch_port_t remote_port = switch_rtp_get_remote_port(tech_pvt->rtp_session); + char tmp[32] = ""; + + tech_pvt->remote_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, t38_options->remote_ip); + tech_pvt->remote_sdp_audio_port = t38_options->remote_port; + + if (remote_host && remote_port && !strcmp(remote_host, tech_pvt->remote_sdp_audio_ip) && + remote_port == tech_pvt->remote_sdp_audio_port) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, + "Audio params are unchanged for %s.\n", + switch_channel_get_name(tech_pvt->channel)); + } else { + const char *err = NULL; + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, + "Audio params changed for %s from %s:%d to %s:%d\n", + switch_channel_get_name(tech_pvt->channel), + remote_host, remote_port, tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port); + + switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_sdp_audio_port); + switch_channel_set_variable(tech_pvt->channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE, tech_pvt->remote_sdp_audio_ip); + switch_channel_set_variable(tech_pvt->channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE, tmp); + if (switch_rtp_set_remote_address(tech_pvt->rtp_session, tech_pvt->remote_sdp_audio_ip, + tech_pvt->remote_sdp_audio_port, 0, SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "AUDIO RTP REPORTS ERROR: [%s]\n", err); + switch_channel_hangup(channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION); + } + } + if (t38_options) { sofia_glue_copy_t38_options(t38_options, other_session); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index b94ed88..e945c0d 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -41,7 +41,9 @@ switch_cache_db_handle_t *sofia_glue_get_db_handle(sofia_profile_t *profile); void sofia_glue_set_image_sdp(private_object_t *tech_pvt, switch_t38_options_t *t38_options, int insist) { - char buf[2048]; + char buf[2048] = ""; + char max_buf[128] = ""; + char max_data[128] = ""; const char *ip = t38_options->local_ip; uint32_t port = t38_options->local_port; const char *family = "IP4"; @@ -89,6 +91,14 @@ void sofia_glue_set_image_sdp(private_object_t *tech_pvt, switch_t38_options_t * "o=%s %010u %010u IN %s %s\n" "s=%s\n" "c=IN %s %s\n" "t=0 0\n", username, tech_pvt->owner_id, tech_pvt->session_id, family, ip, username, family, ip); + if (t38_options->T38FaxMaxBuffer) { + switch_snprintf(max_buf, sizeof(max_buf), "a=T38FaxMaxBuffer:%d\n", t38_options->T38FaxMaxBuffer); + }; + + if (t38_options->T38FaxMaxDatagram) { + switch_snprintf(max_data, sizeof(max_data), "a=T38FaxMaxDatagram:%d\n", t38_options->T38FaxMaxDatagram); + }; + switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "m=image %d udptl t38\n" @@ -98,8 +108,8 @@ void sofia_glue_set_image_sdp(private_object_t *tech_pvt, switch_t38_options_t * "%s" "%s" "a=T38FaxRateManagement:%s\n" - "a=T38FaxMaxBuffer:%d\n" - "a=T38FaxMaxDatagram:%d\n" + "%s" + "%s" "a=T38FaxUdpEC:%s\n", //"a=T38VendorInfo:%s\n", port, @@ -109,8 +119,9 @@ void sofia_glue_set_image_sdp(private_object_t *tech_pvt, switch_t38_options_t * t38_options->T38FaxTranscodingMMR ? "a=T38FaxTranscodingMMR\n" : "", t38_options->T38FaxTranscodingJBIG ? "a=T38FaxTranscodingJBIG\n" : "", t38_options->T38FaxRateManagement, - t38_options->T38FaxMaxBuffer, - t38_options->T38FaxMaxDatagram, t38_options->T38FaxUdpEC + max_buf, + max_data, + t38_options->T38FaxUdpEC //t38_options->T38VendorInfo ? t38_options->T38VendorInfo : "0 0 0" ); @@ -3619,7 +3630,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s if (got_udptl && m->m_type == sdp_media_image && m->m_port) { switch_t38_options_t *t38_options = tech_process_udptl(tech_pvt, sdp, m); - + if (switch_true(switch_channel_get_variable(channel, "refuse_t38"))) { match = 0; goto done; @@ -3634,10 +3645,41 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s if (sofia_test_flag(tech_pvt, TFLAG_T38_PASSTHRU)) { pass = 0; } - + if (pass && switch_core_session_get_partner(session, &other_session) == SWITCH_STATUS_SUCCESS) { private_object_t *other_tech_pvt = switch_core_session_get_private(other_session); switch_core_session_message_t *msg; + char *remote_host = switch_rtp_get_remote_host(tech_pvt->rtp_session); + switch_port_t remote_port = switch_rtp_get_remote_port(tech_pvt->rtp_session); + char tmp[32] = ""; + + tech_pvt->remote_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, t38_options->remote_ip); + tech_pvt->remote_sdp_audio_port = t38_options->remote_port; + + if (remote_host && remote_port && !strcmp(remote_host, tech_pvt->remote_sdp_audio_ip) && remote_port == tech_pvt->remote_sdp_audio_port) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Audio params are unchanged for %s.\n", + switch_channel_get_name(tech_pvt->channel)); + } else { + const char *err = NULL; + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Audio params changed for %s from %s:%d to %s:%d\n", + switch_channel_get_name(tech_pvt->channel), + remote_host, remote_port, tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port); + + switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_sdp_audio_port); + switch_channel_set_variable(tech_pvt->channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE, tech_pvt->remote_sdp_audio_ip); + switch_channel_set_variable(tech_pvt->channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE, tmp); + + if (switch_rtp_set_remote_address(tech_pvt->rtp_session, tech_pvt->remote_sdp_audio_ip, + tech_pvt->remote_sdp_audio_port, 0, SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "AUDIO RTP REPORTS ERROR: [%s]\n", err); + switch_channel_hangup(channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION); + } + + } + + + sofia_glue_copy_t38_options(t38_options, other_session); sofia_set_flag(tech_pvt, TFLAG_T38_PASSTHRU); commit 30b2c6fe905b8ee2b477bb0a99bd67112d572bcf Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Tue Sep 21 20:02:37 2010 -0400 mod_callcenter: Few default config comment spelling check, thanks Diego diff --git a/conf/autoload_configs/callcenter.conf.xml b/conf/autoload_configs/callcenter.conf.xml index e764d17..1178391 100644 --- a/conf/autoload_configs/callcenter.conf.xml +++ b/conf/autoload_configs/callcenter.conf.xml @@ -22,15 +22,15 @@ </queues> -<!-- WARNING : Configuring XML Agents will updated into the DB upon restart --> -<!-- WARNING : Configuring XML Tiers will reset the provided level and position if provided.--> -<!-- WARNING : Agents and Tiers XML config shouldn't be used in a multi FS shared DB setup(Not currently supported anyway) --> +<!-- WARNING: Configuration of XML Agents will be updated into the DB upon restart. --> +<!-- WARNING: Configuration of XML Tiers will reset the level and position if those were supplied. --> +<!-- WARNING: Agents and Tiers XML config shouldn't be used in a multi FS shared DB setup (Not currently supported anyway) --> <agents> <!--<agent name="1000@default" type="callback" contact="[call_timeout=10]user/1000@default" status="Available" max-no-answer="3" wrap-up-time="10" reject-delay-time="10" busy-delay-time="60" />--> </agents> <tiers> - <!-- if no level or position is provided, they will default to 0. You should do this to keep db value on restart --> - <!-- <tier agent="1000@default" queue="support@default" level="0" position="1"/> --> + <!-- If no level or position is provided, they will default to 1. You should do this to keep db value on restart. --> + <!-- <tier agent="1000@default" queue="support@default" level="1" position="1"/> --> </tiers> </configuration> commit 29ea6e296f0991e81b358c7941eb0f940a9eda0b Author: Michael Jerris <mike@jerris.com> Date: Tue Sep 21 15:08:26 2010 -0500 fix typo and printf specifier resulting in incorrect output of call counts on profiles and gateways diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index c5de286..f07910d 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -2428,7 +2428,7 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t ob_failed += gp->ob_failed_calls; ob += gp->ob_calls; - stream->write_function(stream, "%25s\t%32s\t%s\t%ld/%ld\t%ld/%ld", + stream->write_function(stream, "%25s\t%32s\t%s\t%u/%u\t%u/%u", pkey, gp->register_to, sofia_state_names[gp->state], gp->ib_failed_calls, gp->ib_calls, gp->ob_failed_calls, gp->ob_calls); @@ -2447,8 +2447,8 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t } switch_mutex_unlock(mod_sofia_globals.hash_mutex); stream->write_function(stream, "%s\n", line); - stream->write_function(stream, "%d gateway%s: Inound(Failed/Total): %ld/%ld," - "Outbound(Failed/Total):%ld/%ld\n", c, c == 1 ? "" : "s", ib_failed, ib, ob_failed, ob); + stream->write_function(stream, "%d gateway%s: Inbound(Failed/Total): %u/%u," + "Outbound(Failed/Total):%u/%u\n", c, c == 1 ? "" : "s", ib_failed, ib, ob_failed, ob); return SWITCH_STATUS_SUCCESS; } @@ -2477,10 +2477,10 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t stream->write_function(stream, "PingState\t%d/%d/%d\n", gp->ping_min, gp->ping_count, gp->ping_max); stream->write_function(stream, "State \t%s\n", sofia_state_names[gp->state]); stream->write_function(stream, "Status \t%s%s\n", status_names[gp->status], gp->pinging ? " (ping)" : ""); - stream->write_function(stream, "CallsIN \t%d\n", gp->ib_calls); - stream->write_function(stream, "CallsOUT\t%d\n", gp->ob_calls); - stream->write_function(stream, "FailedCallsIN\t%d\n", gp->ib_failed_calls); - stream->write_function(stream, "FailedCallsOUT\t%d\n", gp->ob_failed_calls); + stream->write_function(stream, "CallsIN \t%u\n", gp->ib_calls); + stream->write_function(stream, "CallsOUT\t%u\n", gp->ob_calls); + stream->write_function(stream, "FailedCallsIN\t%u\n", gp->ib_failed_calls); + stream->write_function(stream, "FailedCallsOUT\t%u\n", gp->ob_failed_calls); stream->write_function(stream, "%s\n", line); sofia_reg_release_gateway(gp); } else { @@ -2554,10 +2554,10 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t if (profile->max_registrations_perext > 0) { stream->write_function(stream, "MAX-REG-PEREXT \t%d\n", profile->max_registrations_perext); } - stream->write_function(stream, "CALLS-IN \t%d\n", profile->ib_calls); - stream->write_function(stream, "FAILED-CALLS-IN \t%d\n", profile->ib_failed_calls); - stream->write_function(stream, "CALLS-OUT \t%d\n", profile->ob_calls); - stream->write_function(stream, "FAILED-CALLS-OUT \t%d\n", profile->ob_failed_calls); + stream->write_function(stream, "CALLS-IN \t%u\n", profile->ib_calls); + stream->write_function(stream, "FAILED-CALLS-IN \t%u\n", profile->ib_failed_calls); + stream->write_function(stream, "CALLS-OUT \t%u\n", profile->ob_calls); + stream->write_function(stream, "FAILED-CALLS-OUT \t%u\n", profile->ob_failed_calls); } stream->write_function(stream, "\nRegistrations:\n%s\n", line); @@ -2703,10 +2703,10 @@ static void xml_gateway_status(sofia_gateway_t *gp, switch_stream_handle_t *stre stream->write_function(stream, " <pingfreq>%d</pingfreq>\n", gp->ping_freq); stream->write_function(stream, " <state>%s</state>\n", sofia_state_names[gp->state]); stream->write_function(stream, " <status>%s%s</status>\n", status_names[gp->status], gp->pinging ? " (ping)" : ""); - stream->write_function(stream, " <calls-in>%d</calls-in>\n", gp->ib_calls); - stream->write_function(stream, " <calls-out>%d</calls-out>\n", gp->ob_calls); - stream->write_function(stream, " <failed-calls-in>%d</failed-calls-in>\n", gp->ib_failed_calls); - stream->write_function(stream, " <failed-calls-out>%d</failed-calls-out>\n", gp->ob_failed_calls); + stream->write_function(stream, " <calls-in>%u</calls-in>\n", gp->ib_calls); + stream->write_function(stream, " <calls-out>%u</calls-out>\n", gp->ob_calls); + stream->write_function(stream, " <failed-calls-in>%u</failed-calls-in>\n", gp->ib_failed_calls); + stream->write_function(stream, " <failed-calls-out>%u</failed-calls-out>\n", gp->ob_failed_calls); if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_TRYING) { time_t now = switch_epoch_time_now(NULL); @@ -2825,10 +2825,10 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl stream->write_function(stream, " <user-agent-filter>%s</user-agent-filter>\n", switch_str_nil(profile->user_agent_filter)); stream->write_function(stream, " <max-registrations-per-extension>%d</max-registrations-per-extension>\n", profile->max_registrations_perext); - stream->write_function(stream, " <calls-in>%d</calls-in>\n", profile->ib_calls); - stream->write_function(stream, " <calls-out>%d</calls-out>\n", profile->ob_calls); - stream->write_function(stream, " <failed-calls-in>%d</failed-calls-in>\n", profile->ib_failed_calls); - stream->write_function(stream, " <failed-calls-out>%d</failed-calls-out>\n", profile->ob_failed_calls); + stream->write_function(stream, " <calls-in>%u</calls-in>\n", profile->ib_calls); + stream->write_function(stream, " <calls-out>%u</calls-out>\n", profile->ob_calls); + stream->write_function(stream, " <failed-calls-in>%u</failed-calls-in>\n", profile->ib_failed_calls); + stream->write_function(stream, " <failed-calls-out>%u</failed-calls-out>\n", profile->ob_failed_calls); stream->write_function(stream, " </profile-info>\n"); } stream->write_function(stream, " <registrations>\n"); commit c236541e29b022d4fef66958ce796165ab15ea44 Author: Michael Jerris <mike@jerris.com> Date: Tue Sep 21 14:31:36 2010 -0500 fix seg on subscribe with no contact host diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 5eb71b3..333f31b 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1983,12 +1983,20 @@ void sofia_presence_handle_sip_i_subscribe(int status, is_nat = NULL; } + if (zstr(contact_host)) { + is_nat = "No contact host"; + } + if (is_nat) { contact_host = network_ip; switch_snprintf(new_port, sizeof(new_port), ":%d", network_port); port = NULL; } + if (zstr(contact_host)) { + nua_respond(nh, 481, "INVALID SUBSCRIPTION", TAG_END()); + return; + } if (port) { switch_snprintf(new_port, sizeof(new_port), ":%s", port); commit 4999723687be066188ffe02311e6ca7e7f944e21 Author: Moises Silva <moy@sangoma.com> Date: Tue Sep 21 14:26:32 2010 -0400 freetdm: fix timer scheduling compilation in isdn stack diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 33024d7..b7af8e9 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -150,7 +150,7 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) /* Launch timer in case we never get a FACILITY msg */ if (signal_data->facility_timeout) { ftdm_sched_timer(signal_data->sched, "facility_timeout", signal_data->facility_timeout, - sngisdn_facility_timeout, (void*) sngisdn_info, sngisdn_info->timers[SNGISDN_TIMER_FACILITY]); + sngisdn_facility_timeout, (void*) sngisdn_info, &sngisdn_info->timers[SNGISDN_TIMER_FACILITY]); } break; } else if (ret_val == 0) { commit 132795af795399e7d716a9606b284dd4172f8377 Merge: a329bf1 baead3d Author: Moises Silva <moy@sangoma.com> Date: Tue Sep 21 14:24:38 2010 -0400 Merge branch 'moy.forcehangup' Conflicts: libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c diff --cc libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index e8ba387,d63ee4c..33024d7 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@@ -149,7 -151,7 +149,8 @@@ void sngisdn_process_con_ind (sngisdn_e ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_GET_CALLERID); /* Launch timer in case we never get a FACILITY msg */ if (signal_data->facility_timeout) { -- ftdm_sched_timer(signal_data->sched, "facility_timeout", signal_data->facility_timeout, sngisdn_facility_timeout, (void*) sngisdn_info, &sngisdn_info->timers[SNGISDN_TIMER_FACILITY]); ++ ftdm_sched_timer(signal_data->sched, "facility_timeout", signal_data->facility_timeout, ++ sngisdn_facility_timeout, (void*) sngisdn_info, sngisdn_info->timers[SNGISDN_TIMER_FACILITY]); } break; } else if (ret_val == 0) { @@@ -700,23 -702,14 +701,23 @@@ void sngisdn_process_fac_ind (sngisdn_e case FTDM_CHANNEL_STATE_GET_CALLERID: /* Update the caller ID Name */ if (facEvnt->facElmt.facStr.pres) { - uint8_t facility_str[255]; - memcpy(facility_str, (uint8_t*)&facEvnt->facElmt.facStr.val, facEvnt->facElmt.facStr.len); char retrieved_str[255]; - if (sng_isdn_retrieve_facility_caller_name(facility_str, facEvnt->facElmt.facStr.len, retrieved_str) != FTDM_SUCCESS) { + + /* return values for "sng_isdn_retrieve_facility_information_following": + If there will be no information following, or fails to decode IE, returns -1 + If there will be no information following, but current FACILITY IE contains a caller name, returns 0 + If there will be information following, returns 1 + */ + + if (sng_isdn_retrieve_facility_caller_name(&facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len, retrieved_str) == 0) { + strcpy(ftdmchan->caller_data.cid_name, retrieved_str); + } else { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Failed to retrieve Caller Name from Facility IE\n"); } - /* Cancel facility timeout */ - ftdm_sched_cancel_timer(signal_data->sched, sngisdn_info->timers[SNGISDN_TIMER_FACILITY]); + if (signal_data->facility_timeout) { + /* Cancel facility timeout */ - ftdm_sched_cancel_timer(signal_data->sched, &sngisdn_info->timers[SNGISDN_TIMER_FACILITY]); ++ ftdm_sched_cancel_timer(signal_data->sched, sngisdn_info->timers[SNGISDN_TIMER_FACILITY]); + } } ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); commit 50e377dc94f8bd3f266040cad61d76b7973474b5 Author: Brian West <brian@freeswitch.org> Date: Tue Sep 21 13:00:30 2010 -0500 add mod to modules.conf.in diff --git a/build/modules.conf.in b/build/modules.conf.in index 7730cf2..67e1fe6 100644 --- a/build/modules.conf.in +++ b/build/modules.conf.in @@ -39,6 +39,7 @@ codecs/mod_g723_1 codecs/mod_amr #codecs/mod_amrwb #codecs/mod_silk +#codecs/mod_codec2 codecs/mod_g729 codecs/mod_h26x codecs/mod_bv commit 5e60c62e08d055f11adb7a4bc73e08af668ba7f9 Author: Moises Silva <moy@sangoma.com> Date: Tue Sep 21 13:56:11 2010 -0400 freetdm: set conf and mod directory in runtime diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index b4a40f0..e531146 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -4074,6 +4074,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_freetdm_load) ftdm_global_set_logger(ftdm_logger); + ftdm_global_set_mod_directory(SWITCH_GLOBAL_dirs.mod_dir); + + ftdm_global_set_config_directory(SWITCH_GLOBAL_dirs.conf_dir); + ftdm_cpu_monitor_disable(); if (ftdm_global_init() != FTDM_SUCCESS) { diff --git a/libs/freetdm/src/ftdm_config.c b/libs/freetdm/src/ftdm_config.c index 291ca33..1b023e9 100644 --- a/libs/freetdm/src/ftdm_config.c +++ b/libs/freetdm/src/ftdm_config.c @@ -41,8 +41,22 @@ #define FTDM_MOD_DIR "." #endif -static char g_ftdm_config_dir[] = FTDM_CONFIG_DIR; -static char g_ftdm_mod_dir[] = FTDM_MOD_DIR; +#define FTDM_MAX_CONF_DIR 512 + +static char g_ftdm_config_dir[FTDM_MAX_CONF_DIR] = FTDM_CONFIG_DIR; +static char g_ftdm_mod_dir[FTDM_MAX_CONF_DIR] = FTDM_MOD_DIR; + +FT_DECLARE(void) ftdm_global_set_mod_directory(const char *path) +{ + snprintf(g_ftdm_mod_dir, sizeof(g_ftdm_mod_dir), "%s", path); + ftdm_log(FTDM_LOG_DEBUG, "New mod directory: %s\n", g_ftdm_mod_dir); +} + +FT_DECLARE(void) ftdm_global_set_config_directory(const char *path) +{ + snprintf(g_ftdm_config_dir, sizeof(g_ftdm_config_dir), "%s", path); + ftdm_log(FTDM_LOG_DEBUG, "New config directory: %s\n", g_ftdm_config_dir); +} int ftdm_config_open_file(ftdm_config_t *cfg, const char *file_path) { diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 1f50a2c..3b847f8 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -1301,6 +1301,12 @@ FT_DECLARE(void) ftdm_global_set_logger(ftdm_logger_t logger); /*! \brief Set the default logger level */ FT_DECLARE(void) ftdm_global_set_default_logger(int level); +/*! \brief Set the directory to look for modules */ +FT_DECLARE(void) ftdm_global_set_mod_directory(const char *path); + +/*! \brief Set the directory to look for configs */ +FT_DECLARE(void) ftdm_global_set_config_directory(const char *path); + /*! \brief Check if the FTDM library is initialized and running */ FT_DECLARE(ftdm_bool_t) ftdm_running(void); commit c296179535d66a28fe18b6bae2969447ab447348 Author: Moises Silva <moy@sangoma.com> Date: Tue Sep 21 17:08:44 2010 -0400 freetdm: make config and module directory to be a variable and not a macro diff --git a/libs/freetdm/src/ftdm_config.c b/libs/freetdm/src/ftdm_config.c index f6d9c1a..291ca33 100644 --- a/libs/freetdm/src/ftdm_config.c +++ b/libs/freetdm/src/ftdm_config.c @@ -37,6 +37,13 @@ #include "private/ftdm_core.h" +#ifndef FTDM_MOD_DIR +#define FTDM_MOD_DIR "." +#endif + +static char g_ftdm_config_dir[] = FTDM_CONFIG_DIR; +static char g_ftdm_mod_dir[] = FTDM_MOD_DIR; + int ftdm_config_open_file(ftdm_config_t *cfg, const char *file_path) { FILE *f; @@ -46,7 +53,7 @@ int ftdm_config_open_file(ftdm_config_t *cfg, const char *file_path) if (file_path[0] == '/') { path = file_path; } else { - snprintf(path_buf, sizeof(path_buf), "%s%s%s", FTDM_CONFIG_DIR, FTDM_PATH_SEPARATOR, file_path); + snprintf(path_buf, sizeof(path_buf), "%s%s%s", g_ftdm_config_dir, FTDM_PATH_SEPARATOR, file_path); path = path_buf; } @@ -64,7 +71,7 @@ int ftdm_config_open_file(ftdm_config_t *cfg, const char *file_path) int last = -1; char *var, *val; - snprintf(path_buf, sizeof(path_buf), "%s%sfreetdm.conf", FTDM_CONFIG_DIR, FTDM_PATH_SEPARATOR); + snprintf(path_buf, sizeof(path_buf), "%s%sfreetdm.conf", g_ftdm_config_dir, FTDM_PATH_SEPARATOR); path = path_buf; if ((f = fopen(path, "r")) == 0) { @@ -329,6 +336,26 @@ FT_DECLARE(ftdm_status_t) ftdm_conf_node_destroy(ftdm_conf_node_t *node) return FTDM_SUCCESS; } +FT_DECLARE(char *) ftdm_build_dso_path(const char *name, char *path, ftdm_size_t len) +{ +#ifdef WIN32 + const char *ext = ".dll"; + //const char *EXT = ".DLL"; +#elif defined (MACOSX) || defined (DARWIN) + const char *ext = ".dylib"; + //const char *EXT = ".DYLIB"; +#else + const char *ext = ".so"; + //const char *EXT = ".SO"; +#endif + if (*name == *FTDM_PATH_SEPARATOR) { + snprintf(path, len, "%s%s", name, ext); + } else { + snprintf(path, len, "%s%s%s%s", g_ftdm_mod_dir, FTDM_PATH_SEPARATOR, name, ext); + } + return path; +} + /* For Emacs: * Local Variables: * mode:c diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 97aa01b..bb46e79 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -4073,27 +4073,6 @@ static ftdm_status_t process_module_config(ftdm_io_interface_t *fio) return FTDM_SUCCESS; } -FT_DECLARE(char *) ftdm_build_dso_path(const char *name, char *path, ftdm_size_t len) -{ -#ifdef WIN32 - const char *ext = ".dll"; - //const char *EXT = ".DLL"; -#define FTDM_MOD_DIR "." //todo -#elif defined (MACOSX) || defined (DARWIN) - const char *ext = ".dylib"; - //const char *EXT = ".DYLIB"; -#else - const char *ext = ".so"; - //const char *EXT = ".SO"; -#endif - if (*name == *FTDM_PATH_SEPARATOR) { - snprintf(path, len, "%s%s", name, ext); - } else { - snprintf(path, len, "%s%s%s%s", FTDM_MOD_DIR, FTDM_PATH_SEPARATOR, name, ext); - } - return path; -} - FT_DECLARE(ftdm_status_t) ftdm_global_add_io_interface(ftdm_io_interface_t *interface1) { ftdm_status_t ret = FTDM_SUCCESS; commit 62b55523c279d8d38e65eadd46a8909e45361007 Author: Brian West <brian@freeswitch.org> Date: Tue Sep 21 12:35:41 2010 -0500 Working codec2 support diff --git a/bootstrap.sh b/bootstrap.sh index 0ea5cd4..4e65c5c 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -16,7 +16,7 @@ done BASEDIR=`pwd`; LIBDIR=${BASEDIR}/libs; SUBDIRS="ilbc curl iksemel js js/nsprpub libdingaling libedit libsndfile pcre sofia-sip \ - speex sqlite srtp openzap freetdm spandsp libg722_1 portaudio unimrcp tiff-3.8.2 broadvoice silk"; + speex sqlite srtp openzap freetdm spandsp libg722_1 portaudio unimrcp tiff-3.8.2 broadvoice silk libcodec2"; if [ ! -f modules.conf ]; then cp build/modules.conf.in modules.conf diff --git a/configure.in b/configure.in index e8b462f..f2aa0ba 100644 --- a/configure.in +++ b/configure.in @@ -998,6 +998,7 @@ AC_CONFIG_SUBDIRS([libs/spandsp]) AC_CONFIG_SUBDIRS([libs/broadvoice]) AC_CONFIG_SUBDIRS([libs/libg722_1]) AC_CONFIG_SUBDIRS([libs/silk]) +AC_CONFIG_SUBDIRS([libs/libcodec2]) case $host in *-openbsd*) diff --git a/libs/libcodec2/.update b/libs/libcodec2/.update new file mode 100644 index 0000000..e69de29 diff --git a/libs/libcodec2/AUTHORS b/libs/libcodec2/AUTHORS new file mode 100644 index 0000000..e69de29 diff --git a/libs/libcodec2/COPYING b/libs/libcodec2/COPYING new file mode 100644 index 0000000..4362b49 --- /dev/null +++ b/libs/libcodec2/COPYING @@ -0,0 +1,502 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + <one line to give the library's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + <signature of Ty Coon>, 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/libs/libcodec2/ChangeLog b/libs/libcodec2/ChangeLog new file mode 100644 index 0000000..e69de29 diff --git a/libs/libcodec2/INSTALL b/libs/libcodec2/INSTALL new file mode 100644 index 0000000..23e5f25 --- /dev/null +++ b/libs/libcodec2/INSTALL @@ -0,0 +1,236 @@ +Installation Instructions +************************* + +Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free +Software Foundation, Inc. + +This file is free documentation; the Free Software Foundation gives +unlimited permission to copy, distribute and modify it. + +Basic Installation +================== + +These are generic installation instructions. + + The `configure' shell script attempts to guess correct values for +various system-dependent variables used during compilation. It uses +those values to create a `Makefile' in each directory of the package. +It may also create one or more `.h' files containing system-dependent +definitions. Finally, it creates a shell script `config.status' that +you can run in the future to recreate the current configuration, and a +file `config.log' containing compiler output (useful mainly for +debugging `configure'). + + It can also use an optional file (typically called `config.cache' +and enabled with `--cache-file=config.cache' or simply `-C') that saves +the results of its tests to speed up reconfiguring. (Caching is +disabled by default to prevent problems with accidental use of stale +cache files.) + + If you need to do unusual things to compile the package, please try +to figure out how `configure' could check whether to do them, and mail +diffs or instructions to the address given in the `README' so they can +be considered for the next release. If you are using the cache, and at +some point `config.cache' contains results you don't want to keep, you +may remove or edit it. + + The file `configure.ac' (or `configure.in') is used to create +`configure' by a program called `autoconf'. You only need +`configure.ac' if you want to change it or regenerate `configure' using +a newer version of `autoconf'. + +The simplest way to compile this package is: + + 1. `cd' to the directory containing the package's source code and type + `./configure' to configure the package for your system. If you're + using `csh' on an old version of System V, you might need to type + `sh ./configure' instead to prevent `csh' from trying to execute + `configure' itself. + + Running `configure' takes awhile. While running, it prints some + messages telling which features it is checking for. + + 2. Type `make' to compile the package. + + 3. Optionally, type `make check' to run any self-tests that come with + the package. + + 4. Type `make install' to install the programs and any data files and + documentation. + + 5. You can remove the program binaries and object files from the + source code directory by typing `make clean'. To also remove the + files that `configure' created (so you can compile the package for + a different kind of computer), type `make distclean'. There is + also a `make maintainer-clean' target, but that is intended mainly + for the package's developers. If you use it, you may have to get + all sorts of other programs in order to regenerate files that came + with the distribution. + +Compilers and Options +===================== + +Some systems require unusual options for compilation or linking that the +`configure' script does not know about. Run `./configure --help' for +details on some of the pertinent environment variables. + + You can give `configure' initial values for configuration parameters +by setting variables in the command line or in the environment. Here +is an example: + + ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix + + *Note Defining Variables::, for more details. + +Compiling For Multiple Architectures +==================================== + +You can compile the package for more than one kind of computer at the +same time, by placing the object files for each architecture in their +own directory. To do this, you must use a version of `make' that +supports the `VPATH' variable, such as GNU `make'. `cd' to the +directory where you want the object files and executables to go and run +the `configure' script. `configure' automatically checks for the +source code in the directory that `configure' is in and in `..'. + + If you have to use a `make' that does not support the `VPATH' +variable, you have to compile the package for one architecture at a +time in the source code directory. After you have installed the +package for one architecture, use `make distclean' before reconfiguring +for another architecture. + +Installation Names +================== + +By default, `make install' installs the package's commands under +`/usr/local/bin', include files under `/usr/local/include', etc. You +can specify an installation prefix other than `/usr/local' by giving +`configure' the option `--prefix=PREFIX'. + + You can specify separate installation prefixes for +architecture-specific files and architecture-independent files. If you +pass the option `--exec-prefix=PREFIX' to `configure', the package uses +PREFIX as the prefix for installing programs and libraries. +Documentation and other data files still use the regular prefix. + + In addition, if you use an unusual directory layout you can give +options like `--bindir=DIR' to specify different values for particular +kinds of files. Run `configure --help' for a list of the directories +you can set and what kinds of files go in them. + + If the package supports it, you can cause programs to be installed +with an extra prefix or suffix on their names by giving `configure' the +option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. + +Optional Features +================= + +Some packages pay attention to `--enable-FEATURE' options to +`configure', where FEATURE indicates an optional part of the package. +They may also pay attention to `--with-PACKAGE' options, where PACKAGE +is something like `gnu-as' or `x' (for the X Window System). The +`README' should mention any `--enable-' and `--with-' options that the +package recognizes. + + For packages that use the X Window System, `configure' can usually +find the X include and library files automatically, but if it doesn't, +you can use the `configure' options `--x-includes=DIR' and +`--x-libraries=DIR' to specify their locations. + +Specifying the System Type +========================== + +There may be some features `configure' cannot figure out automatically, +but needs to determine by the type of machine the package will run on. +Usually, assuming the package is built to be run on the _same_ +architectures, `configure' can figure that out, but if it prints a +message saying it cannot guess the machine type, give it the +`--build=TYPE' option. TYPE can either be a short name for the system +type, such as `sun4', or a canonical name which has the form: + + CPU-COMPANY-SYSTEM + +where SYSTEM can have one of these forms: + + OS KERNEL-OS + + See the file `config.sub' for the possible values of each field. If +`config.sub' isn't included in this package, then this package doesn't +need to know the machine type. + + If you are _building_ compiler tools for cross-compiling, you should +use the option `--target=TYPE' to select the type of system they will +produce code for. + + If you want to _use_ a cross compiler, that generates code for a +platform different from the build platform, you should specify the +"host" platform (i.e., that on which the generated programs will +eventually be run) with `--host=TYPE'. + +Sharing Defaults +================ + +If you want to set default values for `configure' scripts to share, you +can create a site shell script called `config.site' that gives default +values for variables like `CC', `cache_file', and `prefix'. +`configure' looks for `PREFIX/share/config.site' if it exists, then +`PREFIX/etc/config.site' if it exists. Or, you can set the +`CONFIG_SITE' environment variable to the location of the site script. +A warning: not all `configure' scripts look for a site script. + +Defining Variables +================== + +Variables not defined in a site shell script can be set in the +environment passed to `configure'. However, some packages may run +configure again during the build, and the customized values of these +variables may be lost. In order to avoid this problem, you should set +them in the `configure' command line, using `VAR=value'. For example: + + ./configure CC=/usr/local2/bin/gcc + +causes the specified `gcc' to be used as the C compiler (unless it is +overridden in the site shell script). Here is a another example: + + /bin/bash ./configure CONFIG_SHELL=/bin/bash + +Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent +configuration-related scripts to be executed by `/bin/bash'. + +`configure' Invocation +====================== + +`configure' recognizes the following options to control how it operates. + +`--help' +`-h' + Print a summary of the options to `configure', and exit. + +`--version' +`-V' + Print the version of Autoconf used to generate the `configure' + script, and exit. + +`--cache-file=FILE' + Enable the cache: use and save the results of the tests in FILE, + traditionally `config.cache'. FILE defaults to `/dev/null' to + disable caching. + +`--config-cache' +`-C' + Alias for `--cache-file=config.cache'. + +`--quiet' +`--silent' +`-q' + Do not print messages saying which checks are being made. To + suppress all normal output, redirect it to `/dev/null' (any error + messages will still be shown). + +`--srcdir=DIR' + Look for the package's source code in directory DIR. Usually + `configure' can determine that directory automatically. + +`configure' also accepts some other, not widely useful, options. Run +`configure --help' for more details. + diff --git a/libs/libcodec2/Makefile.am b/libs/libcodec2/Makefile.am new file mode 100644 index 0000000..a1820f9 --- /dev/null +++ b/libs/libcodec2/Makefile.am @@ -0,0 +1,98 @@ +AM_CFLAGS = -Isrc -Wall -lm +AUTOMAKE_OPTS = gnu +NAME = libcodec2 +AM_CPPFLAGS = $(AM_CFLAGS) + +EXTRA_DIST = pitch/hts1a.p \ +pitch/hts2a.p \ +octave/glottal.m \ +octave/lsp_pdf.m \ +octave/phase.m \ +octave/pl2.m \ +octave/plinterp.m \ +octave/plnlp.m \ +octave/plpitch.m \ +octave/postfilter.m \ +octave/load_raw.m \ +octave/phase2.m \ +octave/pitch_test.m \ +octave/plamp.m \ +octave/pl.m \ +octave/plphase.m \ +octave/png.m \ +octave/pulse.m \ +raw/b0067.raw \ +raw/forig_speex_8k.raw \ +raw/hts1.raw \ +raw/hts2.raw \ +raw/mmt1.raw \ +raw/morig_speex_8k.raw \ +raw/f2400.raw \ +raw/hts1a_g729a.raw \ +raw/hts2a_g729a.raw \ +raw/hts.raw \ +raw/mmt1_speex_8k.raw \ +raw/forig_g729a.raw \ +raw/hts1a_gsm13k.raw \ +raw/hts2a_gsm13k.raw \ +raw/m2400.raw \ +raw/morig_g729a.raw \ +raw/forig_gsm13k.raw \ +raw/hts1a.raw \ +raw/hts2a.raw \ +raw/mmt1_g729a.raw \ +raw/morig_gsm13k.raw \ +raw/forig.raw \ +raw/hts1a_speex_8k.raw \ +raw/hts2a_speex_8k.raw \ +raw/mmt1_gsm13k.raw \ +raw/morig.raw \ +script/menu.sh \ +script/playraw.sh \ +script/raw2wav.sh \ +script/wav2raw.sh \ +wav/f2400.wav \ +wav/hts1a_c2_v0.1.wav \ +wav/hts1a.wav \ +wav/hts2a_speex_8k.wav \ +wav/mmt1_speex_8k.wav \ +wav/morig.wav \ +wav/forig_speex_8k.wav \ +wav/hts1a_g729a.wav \ +wav/hts2a_c2_v0.1.wav \ +wav/hts2a.wav \ +wav/mmt1.wav \ +wav/forig.wav \ +wav/hts1a_speex_8k.wav \ +wav/hts2a_g729a.wav \ +wav/m2400.wav \ +wav/morig_speex_8k.wav \ +src/globals.c \ +doc/A_m.gif \ +doc/omega_0.gif \ +doc/phi_m.gif \ +doc/s_n.gif \ +doc/s_n.txt \ +unittest/lsp2.txt \ +unittest/lsp7.txt \ +unittest/lspd78.txt \ +unittest/lsp3.txt \ +unittest/lsp8.txt \ +unittest/lspd910.txt \ +unittest/lsp4.txt \ +unittest/lsp9.txt \ +unittest/lsp10.txt \ +unittest/lsp5.txt \ +unittest/lspd123.txt \ +unittest/lsp1.txt \ +unittest/lsp6.txt \ +unittest/lspd456.txt \ +src/codeall.sh \ +src/fq20.sh \ +src/listen1.sh \ +src/listen.sh \ +src/listensim.sh \ +src/sim.sh + + +SUBDIRS = src unittest diff --git a/libs/libcodec2/Makefile.in b/libs/libcodec2/Makefile.in new file mode 100644 index 0000000..d06623c --- /dev/null +++ b/libs/libcodec2/Makefile.in @@ -0,0 +1,690 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = . +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \ + ChangeLog INSTALL NEWS compile config.guess config.sub depcomp \ + install-sh ltmain.sh missing +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno configure.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GREP = @GREP@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +AM_CFLAGS = -Isrc -Wall -lm +AUTOMAKE_OPTS = gnu +NAME = libcodec2 +AM_CPPFLAGS = $(AM_CFLAGS) +EXTRA_DIST = pitch/hts1a.p \ +pitch/hts2a.p \ +octave/glottal.m \ +octave/lsp_pdf.m \ +octave/phase.m \ +octave/pl2.m \ +octave/plinterp.m \ +octave/plnlp.m \ +octave/plpitch.m \ +octave/postfilter.m \ +octave/load_raw.m \ +octave/phase2.m \ +octave/pitch_test.m \ +octave/plamp.m \ +octave/pl.m \ +octave/plphase.m \ +octave/png.m \ +octave/pulse.m \ +raw/b0067.raw \ +raw/forig_speex_8k.raw \ +raw/hts1.raw \ +raw/hts2.raw \ +raw/mmt1.raw \ +raw/morig_speex_8k.raw \ +raw/f2400.raw \ +raw/hts1a_g729a.raw \ +raw/hts2a_g729a.raw \ +raw/hts.raw \ +raw/mmt1_speex_8k.raw \ +raw/forig_g729a.raw \ +raw/hts1a_gsm13k.raw \ +raw/hts2a_gsm13k.raw \ +raw/m2400.raw \ +raw/morig_g729a.raw \ +raw/forig_gsm13k.raw \ +raw/hts1a.raw \ +raw/hts2a.raw \ +raw/mmt1_g729a.raw \ +raw/morig_gsm13k.raw \ +raw/forig.raw \ +raw/hts1a_speex_8k.raw \ +raw/hts2a_speex_8k.raw \ +raw/mmt1_gsm13k.raw \ +raw/morig.raw \ +script/menu.sh \ +script/playraw.sh \ +script/raw2wav.sh \ +script/wav2raw.sh \ +wav/f2400.wav \ +wav/hts1a_c2_v0.1.wav \ +wav/hts1a.wav \ +wav/hts2a_speex_8k.wav \ +wav/mmt1_speex_8k.wav \ +wav/morig.wav \ +wav/forig_speex_8k.wav \ +wav/hts1a_g729a.wav \ +wav/hts2a_c2_v0.1.wav \ +wav/hts2a.wav \ +wav/mmt1.wav \ +wav/forig.wav \ +wav/hts1a_speex_8k.wav \ +wav/hts2a_g729a.wav \ +wav/m2400.wav \ +wav/morig_speex_8k.wav \ +src/globals.c \ +doc/A_m.gif \ +doc/omega_0.gif \ +doc/phi_m.gif \ +doc/s_n.gif \ +doc/s_n.txt \ +unittest/lsp2.txt \ +unittest/lsp7.txt \ +unittest/lspd78.txt \ +unittest/lsp3.txt \ +unittest/lsp8.txt \ +unittest/lspd910.txt \ +unittest/lsp4.txt \ +unittest/lsp9.txt \ +unittest/lsp10.txt \ +unittest/lsp5.txt \ +unittest/lspd123.txt \ +unittest/lsp1.txt \ +unittest/lsp6.txt \ +unittest/lspd456.txt \ +src/codeall.sh \ +src/fq20.sh \ +src/listen1.sh \ +src/listen.sh \ +src/listensim.sh \ +src/sim.sh + +SUBDIRS = src unittest +all: all-recursive + +.SUFFIXES: +am--refresh: + @: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ + cd $(srcdir) && $(AUTOMAKE) --gnu \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(am__remove_distdir) + mkdir $(distdir) + $(mkdir_p) $(distdir)/doc $(distdir)/octave $(distdir)/pitch $(distdir)/raw $(distdir)/script $(distdir)/src $(distdir)/unittest $(distdir)/wav + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ + check-am clean clean-generic clean-libtool clean-recursive \ + ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ + dist-shar dist-tarZ dist-zip distcheck distclean \ + distclean-generic distclean-libtool distclean-recursive \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-man install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-generic \ + mostlyclean-libtool mostlyclean-recursive pdf pdf-am ps ps-am \ + tags tags-recursive uninstall uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libs/libcodec2/NEWS b/libs/libcodec2/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/libs/libcodec2/README b/libs/libcodec2/README new file mode 100644 index 0000000..e69de29 diff --git a/libs/libcodec2/configure.gnu b/libs/libcodec2/configure.gnu new file mode 100644 index 0000000..c78238d --- /dev/null +++ b/libs/libcodec2/configure.gnu @@ -0,0 +1,4 @@ +#! /bin/sh +srcpath=$(dirname $0 2>/dev/null ) || srcpath="." +$srcpath/configure "$@" --disable-shared --with-pic + diff --git a/libs/libcodec2/configure.in b/libs/libcodec2/configure.in new file mode 100644 index 0000000..378ef5f --- /dev/null +++ b/libs/libcodec2/configure.in @@ -0,0 +1,26 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ([2.59]) +AC_INIT(libcodec2, 1.0, david@rowetel.com) +AM_INIT_AUTOMAKE(libcodec2,1.0) + +# Checks for programs. +AC_PROG_CC +AC_PROG_LIBTOOL + +# Checks for libraries. +# FIXME: Replace `main' with a function in `-lm': +AC_CHECK_LIB([m], [main]) + +# Checks for header files. +AC_CHECK_HEADERS([stdlib.h string.h]) + +# Checks for typedefs, structures, and compiler characteristics. + +# Checks for library functions. +AC_FUNC_MALLOC +AC_CHECK_FUNCS([floor pow sqrt]) + +AC_CONFIG_FILES([Makefile src/Makefile unittest/Makefile]) +AC_OUTPUT diff --git a/libs/libcodec2/doc/A_m.gif b/libs/libcodec2/doc/A_m.gif new file mode 100644 index 0000000..47b89bd Binary files /dev/null and b/libs/libcodec2/doc/A_m.gif differ diff --git a/libs/libcodec2/doc/omega_0.gif b/libs/libcodec2/doc/omega_0.gif new file mode 100644 index 0000000..02877e0 Binary files /dev/null and b/libs/libcodec2/doc/omega_0.gif differ diff --git a/libs/libcodec2/doc/phi_m.gif b/libs/libcodec2/doc/phi_m.gif new file mode 100644 index 0000000..3f2fd57 Binary files /dev/null and b/libs/libcodec2/doc/phi_m.gif differ diff --git a/libs/libcodec2/doc/s_n.gif b/libs/libcodec2/doc/s_n.gif new file mode 100644 index 0000000..c739ab4 Binary files /dev/null and b/libs/libcodec2/doc/s_n.gif differ diff --git a/libs/libcodec2/doc/s_n.txt b/libs/libcodec2/doc/s_n.txt new file mode 100644 index 0000000..fec16b3 --- /dev/null +++ b/libs/libcodec2/doc/s_n.txt @@ -0,0 +1 @@ +s(n)=A_1cos(\omega_0+\phi_1)+A_2cos(2\omega_0+\phi_2)+...+A_Lcos(L\omega_0+\phi_L) diff --git a/libs/libcodec2/octave/glottal.m b/libs/libcodec2/octave/glottal.m new file mode 100644 index 0000000..2b823c3 --- /dev/null +++ b/libs/libcodec2/octave/glottal.m @@ -0,0 +1,25 @@ +% glottal.m +% David Rowe 12 Sep 2009 +% Matlab script to generate the phase spectra of a glottal pulse + +% lpc10 pulse from spandsp. When the file glottal.c was used as a part of the +% excitation phase component in phase.c, phase_synth_zero_order(), no difference +% in speech quality was apparent. So left out of code for now. + +sh=12 +kexc = [ 8, -16, 26, -48, 86, -162, 294, -502, 718, -728, 184 672, -610, -672, 184, 728, 718, 502, 294, 162, 86, 48, 26, 16, 8]; +kexc = shift(kexc,sh); +kexc = [kexc(1:sh) zeros(1,512-25) kexc(sh+1:25)]; +figure(1) +plot(kexc) +figure(2) +G = fft(kexc); +plot((1:256)*(4000/256),unwrap(angle(G(1:256)))) + +f=fopen("glottal.c","wt"); +fprintf(f,"float glottal[]={\n"); +for m=1:255 + fprintf(f," %f,\n",angle(G(m))); +endfor +fprintf(f," %f};\n",angle(G(256))); +fclose(f); diff --git a/libs/libcodec2/octave/load_raw.m b/libs/libcodec2/octave/load_raw.m new file mode 100644 index 0000000..1f7868d --- /dev/null +++ b/libs/libcodec2/octave/load_raw.m @@ -0,0 +1,8 @@ +% load_raw.m +% David Rowe 7 Oct 2009 + +function s = load_raw(fn) + fs=fopen(fn,"rb"); + s = fread(fs,Inf,"short"); + plot(s) +endfunction diff --git a/libs/libcodec2/octave/lsp_pdf.m b/libs/libcodec2/octave/lsp_pdf.m new file mode 100644 index 0000000..6617066 --- /dev/null +++ b/libs/libcodec2/octave/lsp_pdf.m @@ -0,0 +1,50 @@ +% lsp_pdf.m +% David Rowe 2 Oct 2009 +% Plots histograms (PDF estimates) of LSP training data + +function lsp_pdf(lsp) + [r,c] = size(lsp); + + % LSPs + + figure(3); + clf; + [x,y] = hist(lsp(:,1),100); + plot(y*4000/pi,x,";1;"); + hold on; + for i=2:c + [x,y] = hist(lsp(:,i),100); + legend = sprintf(";%d;",i); + plot(y*4000/pi,x,legend); + endfor + hold off; + grid; + + % LSP differences + + figure(4); + clf; + subplot(211) + [x,y] = hist(lsp(:,1),100); + plot(y,x,";1;"); + hold on; + for i=2:5 + [x,y] = hist(lsp(:,i) - lsp(:,i-1),100); + legend = sprintf(";%d;",i); + plot(y,x,legend); + endfor + hold off; + grid; + + subplot(212) + [x,y] = hist(lsp(:,6)-lsp(:,5),100); + plot(y,x,";6;"); + hold on; + for i=7:c + [x,y] = hist(lsp(:,i) - lsp(:,i-1),100); + legend = sprintf(";%d;",i); + plot(y,x,legend); + endfor + hold off; + grid; +endfunction diff --git a/libs/libcodec2/octave/phase.m b/libs/libcodec2/octave/phase.m new file mode 100644 index 0000000..f973590 --- /dev/null +++ b/libs/libcodec2/octave/phase.m @@ -0,0 +1,56 @@ +% phase.m +% David Rowe August 2009 +% experiments with phase for sinusoidal codecs + +function phase(samname, F0, png) + Wo=2*pi*F0/8000; + P=2*pi/Wo; + L = floor(pi/Wo); + Nsam = 16000; + N = 80; + F = Nsam/N; + A = 10000/L; + phi = zeros(1,L); + s = zeros(1,Nsam); + + for m=floor(L/2):L + phi_off(m) = -m*Wo*8; + end + + for f=1:F + phi(1) = phi(1) + Wo*N; + phi(1) = mod(phi(1),2*pi); + + for m=1:L + phi(m) = m*phi(1); + end + + x = zeros(1,N); + for m=1:L + x = x + A*cos(m*Wo*(0:(N-1)) + phi(m)); + endfor + s((f-1)*N+1:f*N) = x; + endfor + + figure(1); + clf; + plot(s(1:250)); + + fs=fopen(samname,"wb"); + fwrite(fs,s,"short"); + fclose(fs); + + if (nargin == 3) + % small image to fit blog + + __gnuplot_set__ terminal png size 450,300 + ss = sprintf("__gnuplot_set__ output \"%s.png\"", samname); + eval(ss) + replot; + + % for some reason I need this to stop large plot getting wiped + __gnuplot_set__ output "/dev/null" + endif + +endfunction + diff --git a/libs/libcodec2/octave/phase2.m b/libs/libcodec2/octave/phase2.m new file mode 100644 index 0000000..ea58dcb --- /dev/null +++ b/libs/libcodec2/octave/phase2.m @@ -0,0 +1,50 @@ +% phase2.m +% David Rowe Sep 2009 +% experiments with phase for sinusoidal codecs, looking at phase +% of excitation with real Am samples from hts1 + +function phase2(samname, png) + N = 16000; + + f=45; + model = load("../src/hts1a_model.txt"); + phase = load("../src/hts1a_phase_phase.txt"); + Wo = model(f,1); + P=2*pi/Wo; + L = model(f,2); + A = model(f,3:(L+2)); + phi = phase(f,1:L); + phi = zeros(1,L); + for m=L/2:L + phi(m) = 2*pi*rand(1,1); + end + + s = zeros(1,N); + + for m=1:L + s_m = A(m)*cos(m*Wo*(0:(N-1)) + phi(m)); + s = s + s_m; + endfor + + figure(1); + clf; + plot(s(1:250)); + + fs=fopen(samname,"wb"); + fwrite(fs,s,"short"); + fclose(fs); + + if (nargin == 2) + % small image to fit blog + + __gnuplot_set__ terminal png size 450,300 + ss = sprintf("__gnuplot_set__ output \"%s.png\"", samname); + eval(ss) + replot; + + % for some reason I need this to stop large plot getting wiped + __gnuplot_set__ output "/dev/null" + endif + +endfunction + diff --git a/libs/libcodec2/octave/pitch_test.m b/libs/libcodec2/octave/pitch_test.m new file mode 100644 index 0000000..3fe0d1a --- /dev/null +++ b/libs/libcodec2/octave/pitch_test.m @@ -0,0 +1,39 @@ +% pitch_test.m +% David Rowe Sep 2009 +% Constructs a sequence to test the pitch estimator + +function pitch_test(samname) + M=320; + F=200; + + fs=fopen(samname,"wb"); + + f0 = 100; + for f=1:200 + Wo=2*pi*f0/8000; + P=2*pi/Wo; + L = floor(pi/Wo); + A = 10000/L; + phi = zeros(1,L); + s = zeros(1,M); + + for m=1:L + s = s + A*cos(m*Wo*(0:(M-1)) + phi(m)); + endfor + + figure(1); + clf; + plot(s); + + fwrite(fs,s,"short"); + + f0 = f0 + 5; + if (f0 > 400) + f0 = 100; + endif + endfor + + fclose(fs); + +endfunction + diff --git a/libs/libcodec2/octave/pl.m b/libs/libcodec2/octave/pl.m new file mode 100644 index 0000000..4996896 --- /dev/null +++ b/libs/libcodec2/octave/pl.m @@ -0,0 +1,42 @@ +% Copyright David Rowe 2009 +% This program is distributed under the terms of the GNU General Public License +% Version 2 + +function pl(samname1, start_sam, end_sam, pngname) + + fs=fopen(samname1,"rb"); + s=fread(fs,Inf,"short"); + + st = 1; + en = length(s); + if (nargin >= 2) + st = start_sam; + endif + if (nargin >= 3) + en = end_sam; + endif + + figure(1); + clf; + plot(s(st:en)); + axis([1 en-st min(s) max(s)]); + + if (nargin == 4) + + % small image + + __gnuplot_set__ terminal png size 420,300 + ss = sprintf("__gnuplot_set__ output \"%s.png\"", pngname); + eval(ss) + replot; + + % larger image + + __gnuplot_set__ terminal png size 800,600 + ss = sprintf("__gnuplot_set__ output \"%s_large.png\"", pngname); + eval(ss) + replot; + + endif + +endfunction diff --git a/libs/libcodec2/octave/pl2.m b/libs/libcodec2/octave/pl2.m new file mode 100644 index 0000000..6e6d37a --- /dev/null +++ b/libs/libcodec2/octave/pl2.m @@ -0,0 +1,50 @@ +% Copyright David Rowe 2009 +% This program is distributed under the terms of the GNU General Public License +% Version 2 + +function pl2(samname1, samname2, start_sam, end_sam, pngname) + + fs1=fopen(samname1,"rb"); + s1=fread(fs1,Inf,"short"); + fs2=fopen(samname2,"rb"); + s2=fread(fs2,Inf,"short"); + + st = 1; + en = length(s1); + if (nargin >= 3) + st = start_sam; + endif + if (nargin >= 4) + en = end_sam; + endif + + figure(1); + clf; + subplot(211); + l1 = strcat("r;",samname1,";"); + plot(s1(st:en), l1); + axis([1 en-st min(s1(st:en)) max(s1(st:en))]); + subplot(212); + l2 = strcat("r;",samname2,";"); + plot(s2(st:en),l2); + axis([1 en-st min(s1(st:en)) max(s1(st:en))]); + + if (nargin == 5) + + % small image + + __gnuplot_set__ terminal png size 420,300 + s = sprintf("__gnuplot_set__ output \"%s.png\"", pngname); + eval(s) + replot; + + % larger image + + __gnuplot_set__ terminal png size 800,600 + s = sprintf("__gnuplot_set__ output \"%s_large.png\"", pngname); + eval(s) + replot; + + endif + +endfunction diff --git a/libs/libcodec2/octave/plamp.m b/libs/libcodec2/octave/plamp.m new file mode 100644 index 0000000..892830f --- /dev/null +++ b/libs/libcodec2/octave/plamp.m @@ -0,0 +1,166 @@ +% Copyright David Rowe 2009 +% This program is distributed under the terms of the GNU General Public License +% Version 2 +% +% Plot ampltiude modelling information from dump files. + +function plamp(samname, f) + + sn_name = strcat(samname,"_sn.txt"); + Sn = load(sn_name); + + sw_name = strcat(samname,"_sw.txt"); + Sw = load(sw_name); + + sw__name = strcat(samname,"_sw_.txt"); + if (file_in_path(".",sw__name)) + Sw_ = load(sw__name); + endif + + model_name = strcat(samname,"_model.txt"); + model = load(model_name); + + modelq_name = strcat(samname,"_qmodel.txt"); + if (file_in_path(".",modelq_name)) + modelq = load(modelq_name); + endif + + pw_name = strcat(samname,"_pw.txt"); + if (file_in_path(".",pw_name)) + Pw = load(pw_name); + endif + + lsp_name = strcat(samname,"_lsp.txt"); + if (file_in_path(".",lsp_name)) + lsp = load(lsp_name); + endif + + phase_name = strcat(samname,"_phase.txt"); + if (file_in_path(".",phase_name)) + phase = load(phase_name); + endif + + phase_name_ = strcat(samname,"_phase_.txt"); + if (file_in_path(".",phase_name_)) + phase_ = load(phase_name_); + endif + + snr_name = strcat(samname,"_snr.txt"); + if (file_in_path(".",snr_name)) + snr = load(snr_name); + endif + + k = ' '; + do + figure(1); + clf; +% s = [ Sn(2*(f-2)-1,:) Sn(2*(f-2),:) ]; + s = [ Sn(2*f-1,:) Sn(2*f,:) ]; + plot(s); + axis([1 length(s) -20000 20000]); + + figure(2); + Wo = model(f,1); + L = model(f,2); + Am = model(f,3:(L+2)); + plot((1:L)*Wo*4000/pi, 20*log10(Am),";Am;r"); + axis([1 4000 -10 80]); + hold on; +% plot((0:255)*4000/256, Sw(f-2,:),";Sw;"); + plot((0:255)*4000/256, Sw(f,:),";Sw;"); + + if (file_in_path(".",modelq_name)) + Amq = modelq(f,3:(L+2)); + plot((1:L)*Wo*4000/pi, 20*log10(Amq),";Amq;g" ); + if (file_in_path(".",pw_name)) + plot((0:255)*4000/256, 10*log10(Pw(f,:)),";Pw;c"); + endif + signal = Am * Am'; + noise = (Am-Amq) * (Am-Amq)'; + snr1 = 10*log10(signal/noise); + Am_err_label = sprintf(";Am error SNR %4.2f dB;m",snr1); + plot((1:L)*Wo*4000/pi, 20*log10(Amq) - 20*log10(Am), Am_err_label); + endif + + if (file_in_path(".",snr_name)) + snr_label = sprintf(";phase SNR %4.2f dB;",snr(f)); + plot(1,1,snr_label); + endif + + % phase model - determine SNR and error spectrum for phase model 1 + + if (file_in_path(".",phase_name_)) + orig = Am.*exp(j*phase(f,1:L)); + synth = Am.*exp(j*phase_(f,1:L)); + signal = orig * orig'; + noise = (orig-synth) * (orig-synth)'; + snr_phase = 10*log10(signal/noise); + + phase_err_label = sprintf(";phase_err SNR %4.2f dB;",snr_phase); + plot((1:L)*Wo*4000/pi, 20*log10(orig-synth), phase_err_label); + endif + + if (file_in_path(".",lsp_name)) + for l=1:10 + plot([lsp(f,l)*4000/pi lsp(f,l)*4000/pi], [60 80], 'r'); + endfor + endif + + hold off; + + if (file_in_path(".",phase_name)) + figure(3); + plot((1:L)*Wo*4000/pi, phase(f,1:L), ";phase;"); + axis; + if (file_in_path(".",phase_name_)) + hold on; + plot((1:L)*Wo*4000/pi, phase_(f,1:L), ";phase_;"); + hold off; + endif + figure(2); + endif + + % autocorrelation function to research voicing est + + %M = length(s); + %sw = s .* hanning(M)'; + %for k=0:159 + % R(k+1) = sw(1:320-k) * sw(1+k:320)'; + %endfor + %figure(4); + %R_label = sprintf(";R(k) %3.2f;",max(R(20:159))/R(1)); + %plot(R/R(1),R_label); + %grid + + % interactive menu + + printf("\rframe: %d menu: n-next b-back p-png q-quit ", f); + fflush(stdout); + k = kbhit(); + if (k == 'n') + f = f + 1; + endif + if (k == 'b') + f = f - 1; + endif + + % optional print to PNG + + if (k == 'p') + figure(1); + pngname = sprintf("%s_%d_sn.png",samname,f); + print(pngname, '-dpng', "-S500,500") + pngname = sprintf("%s_%d_sn_large.png",samname,f); + print(pngname, '-dpng', "-S800,600") + + figure(2); + pngname = sprintf("%s_%d_sw.png",samname,f); + print(pngname, '-dpng', "-S500,500") + pngname = sprintf("%s_%d_sw_large.png",samname,f); + print(pngname, '-dpng', "-S800,600") + endif + + until (k == 'q') + printf("\n"); + +endfunction diff --git a/libs/libcodec2/octave/plinterp.m b/libs/libcodec2/octave/plinterp.m new file mode 100644 index 0000000..794a085 --- /dev/null +++ b/libs/libcodec2/octave/plinterp.m @@ -0,0 +1,11 @@ +load ../unittest/tinterp_prev.txt; +load ../unittest/tinterp_interp.txt; +load ../unittest/tinterp_next.txt; + +clf; +plot(tinterp_prev(:,1), 20.0*log10(tinterp_prev(:,2)),";prev;") +hold on; +plot(tinterp_interp(:,1), 20.0*log10(tinterp_interp(:,2)),'g+-;interp;') +plot(tinterp_next(:,1), 20.0*log10(tinterp_next(:,2)),'ro-;next;') +hold off; +axis([0 pi 0 80]) diff --git a/libs/libcodec2/octave/plnlp.m b/libs/libcodec2/octave/plnlp.m new file mode 100644 index 0000000..01b4931 --- /dev/null +++ b/libs/libcodec2/octave/plnlp.m @@ -0,0 +1,134 @@ +% Copyright David Rowe 2009 +% This program is distributed under the terms of the GNU General Public License +% Version 2 +% +% Plot NLP states from dump files. + +function plnlp(samname, f) + + sn_name = strcat(samname,"_sn.txt"); + Sn = load(sn_name); + + sw_name = strcat(samname,"_sw.txt"); + Sw = load(sw_name); + + fw_name = strcat(samname,"_fw.txt"); + if (file_in_path(".",fw_name)) + fw = load(fw_name); + endif + + e_name = strcat(samname,"_e.txt"); + if (file_in_path(".",e_name)) + e = load(e_name); + endif + + p_name = strcat(samname,".p"); + if (file_in_path(".",p_name)) + p = load(p_name); + endif + + sq_name = strcat(samname,"_sq.txt"); + if (file_in_path(".",sq_name)) + sq = load(sq_name); + endif + + dec_name = strcat(samname,"_dec.txt"); + if (file_in_path(".",dec_name)) + dec = load(dec_name); + endif + + do + figure(1); + clf; + s = [ Sn(2*f-1,:) Sn(2*f,:) ]; + plot(s, ";Sn;"); + grid + axis([1 length(s) -20000 20000]); + + figure(2); + plot((0:255)*4000/256, Sw(f,:),";Sw;"); + grid + axis([1 4000 -10 80]); + hold on; + + f0 = 8000/p(f); + Wo = 2*pi/p(f); + L = floor(pi/Wo); + f0_label = sprintf("b;P=%3.1f F0=%3.0f;",p(f),f0); + for m=1:L-1 + plot([ m*Wo*4000/pi m*Wo*4000/pi], [10 60], 'b'); + endfor + plot([ L*Wo*4000/pi L*Wo*4000/pi], [10 60], f0_label); + + hold off; + + if (file_in_path(".",fw_name)) + figure(3); + if (file_in_path(".",e_name)) + subplot(211); + endif + plot((0:255)*800/256, fw(f,:)/max(fw(f,:)), ";Fw;"); + axis([1 400 0 1]); + if (file_in_path(".",e_name)) + subplot(212); + e_concat = [ e(2*f-1,:) e(2*f,:) ]; + plot(e_concat(1:400)/max(e_concat(1:400)), "+;MBE E(f);"); + axis([1 400 0 1]); + endif + endif + + if (file_in_path(".",sq_name)) + figure(4); + sq_concat = [ sq(2*f-1,:) sq(2*f,:) ]; + axis + plot(sq_concat, ";sq;"); + endif + + if (file_in_path(".",dec_name)) + figure(5); + plot(dec(f,:), ";dec;"); + endif + + figure(2); + + % interactive menu + + printf("\rframe: %d menu: n-next b-back p-png q-quit ", f); + fflush(stdout); + k = kbhit(); + if (k == 'n') + f = f + 1; + endif + if (k == 'b') + f = f - 1; + endif + + % optional print to PNG + + if (k == 'p') + + pngname = sprintf("%s_%d",samname,f); + + % small image + + __gnuplot_set__ terminal png size 420,300 + ss = sprintf("__gnuplot_set__ output \"%s.png\"", pngname); + eval(ss) + replot; + + % larger image + + __gnuplot_set__ terminal png size 800,600 + ss = sprintf("__gnuplot_set__ output \"%s_large.png\"", pngname); + eval(ss) + replot; + + % for some reason I need this to stop large plot getting wiped + __gnuplot_set__ output "/dev/null" + + endif + + until (k == 'q') + printf("\n"); + +endfunction diff --git a/libs/libcodec2/octave/plphase.m b/libs/libcodec2/octave/plphase.m new file mode 100644 index 0000000..9e61185 --- /dev/null +++ b/libs/libcodec2/octave/plphase.m @@ -0,0 +1,198 @@ +% Copyright David Rowe 2009 +% This program is distributed under the terms of the GNU General Public License +% Version 2 +% +% Plot phase modelling information from dump files. + +function plphase(samname, f) + + sn_name = strcat(samname,"_sn.txt"); + Sn = load(sn_name); + + sw_name = strcat(samname,"_sw.txt"); + Sw = load(sw_name); + + model_name = strcat(samname,"_model.txt"); + model = load(model_name); + + sw__name = strcat(samname,"_sw_.txt"); + if (file_in_path(".",sw__name)) + Sw_ = load(sw__name); + endif + + pw_name = strcat(samname,"_pw.txt"); + if (file_in_path(".",pw_name)) + Pw = load(pw_name); + endif + + ak_name = strcat(samname,"_ak.txt"); + if (file_in_path(".",ak_name)) + ak = load(ak_name); + endif + + phase_name = strcat(samname,"_phase.txt"); + if (file_in_path(".",phase_name)) + phase = load(phase_name); + endif + + phase_name_ = strcat(samname,"_phase_.txt"); + if (file_in_path(".",phase_name_)) + phase_ = load(phase_name_); + endif + + snr_name = strcat(samname,"_snr.txt"); + if (file_in_path(".",snr_name)) + snr = load(snr_name); + endif + + sn_name_ = strcat(samname,".raw"); + if (file_in_path(".",sn_name_)) + fs_ = fopen(sn_name_,"rb"); + sn_ = fread(fs_,Inf,"short"); + endif + + k = ' '; + do + figure(1); + clf; + s = [ Sn(2*f-1,:) Sn(2*f,:) ]; + plot(s); + grid; + axis([1 length(s) -20000 20000]); + if (k == 'p') + pngname = sprintf("%s_%d_sn",samname,f); + png(pngname); + endif + + figure(2); + Wo = model(f,1); + L = model(f,2); + Am = model(f,3:(L+2)); + plot((1:L)*Wo*4000/pi, 20*log10(Am),"r;Am;"); + axis([1 4000 -10 80]); + hold on; + plot((0:255)*4000/256, Sw(f,:),";Sw;"); + grid; + + if (file_in_path(".",sw__name)) + plot((0:255)*4000/256, Sw_(f,:),"g;Sw_;"); + endif + + if (file_in_path(".",pw_name)) + plot((0:255)*4000/256, 10*log10(Pw(f,:)),";Pw;"); + endif + + if (file_in_path(".",snr_name)) + snr_label = sprintf(";phase SNR %4.2f dB;",snr(f)); + plot(1,1,snr_label); + endif + + % phase model - determine SNR and error spectrum for phase model 1 + + if (file_in_path(".",phase_name_)) + orig = Am.*exp(j*phase(f,1:L)); + synth = Am.*exp(j*phase_(f,1:L)); + signal = orig * orig'; + noise = (orig-synth) * (orig-synth)'; + snr_phase = 10*log10(signal/noise); + + phase_err_label = sprintf("g;phase_err SNR %4.2f dB;",snr_phase); + plot((1:L)*Wo*4000/pi, 20*log10(orig-synth), phase_err_label); + endif + + hold off; + if (k == 'p') + pngname = sprintf("%s_%d_sw",samname,f); + png(pngname); + endif + + if (file_in_path(".",phase_name)) + figure(3); + plot((1:L)*Wo*4000/pi, phase(f,1:L)*180/pi, "-o;phase;"); + axis; + if (file_in_path(".", phase_name_)) + hold on; + plot((1:L)*Wo*4000/pi, phase_(f,1:L)*180/pi, "g;phase_;"); + grid + hold off; + endif + if (k == 'p') + pngname = sprintf("%s_%d_phase",samname,f); + png(pngname); + endif + endif + + % synthesised speech + + if (file_in_path(".",sn_name_)) + figure(4); + s_ = sn_((f-3)*80+1:(f+1)*80); + plot(s_); + axis([1 length(s_) -20000 20000]); + if (k == 'p') + pngname = sprintf("%s_%d_sn_",samname,f) + png(pngname); + endif + endif + + if (file_in_path(".",ak_name)) + figure(5); + axis; + akw = ak(f,:); + weight = 1.0 .^ (0:length(akw)-1); + akw = akw .* weight; + H = 1./fft(akw,8000); + subplot(211); + plot(20*log10(abs(H(1:4000))),";LPC mag spec;"); + grid; + subplot(212); + plot(angle(H(1:4000))*180/pi,";LPC phase spec;"); + grid; + if (k == 'p') + % stops multimode errors from gnuplot, I know not why... + figure(2); + figure(5); + + pngname = sprintf("%s_%d_lpc",samname,f); + png(pngname); + endif + endif + + + % autocorrelation function to research voicing est + + %M = length(s); + %sw = s .* hanning(M)'; + %for k=0:159 + % R(k+1) = sw(1:320-k) * sw(1+k:320)'; + %endfor + %figure(4); + %R_label = sprintf(";R(k) %3.2f;",max(R(20:159))/R(1)); + %plot(R/R(1),R_label); + %grid + + figure(2); + + % interactive menu + + printf("\rframe: %d menu: n-next b-back p-png q-quit ", f); + fflush(stdout); + k = kbhit(); + if (k == 'n') + f = f + 1; + endif + if (k == 'b') + f = f - 1; + endif + + % optional print to PNG + + if (k == 'p') + pngname = sprintf("%s_%d",samname,f); + png(pngname); + endif + + until (k == 'q') + printf("\n"); + +endfunction diff --git a/libs/libcodec2/octave/plpitch.m b/libs/libcodec2/octave/plpitch.m new file mode 100644 index 0000000..69ad533 --- /dev/null +++ b/libs/libcodec2/octave/plpitch.m @@ -0,0 +1,36 @@ +% Copyright David Rowe 2009 +% This program is distributed under the terms of the GNU General Public License +% Version 2 +% +% plpitch.m +% Plots two pitch tracks on top of each other, used for comparing pitch +% estimators + +function plpitch(pitch1_name, pitch2_name, start_fr, end_fr) + + pitch1 = load(pitch1_name); + pitch2 = load(pitch2_name); + + st = 1; + en = length(pitch1); + if (nargin >= 3) + st = start_fr; + endif + if (nargin >= 4) + en = end_fr; + endif + + figure(1); + clf; + l1 = strcat("r;",pitch1_name,";") + l1 + st + en + plot(pitch1(st:en), l1); + axis([1 en-st 20 160]); + l2 = strcat("g;",pitch2_name,";"); + hold on; + plot(pitch2(st:en),l2); + hold off; +endfunction + diff --git a/libs/libcodec2/octave/png.m b/libs/libcodec2/octave/png.m new file mode 100644 index 0000000..09a7996 --- /dev/null +++ b/libs/libcodec2/octave/png.m @@ -0,0 +1,25 @@ +% Copyright David Rowe 2009 +% This program is distributed under the terms of the GNU General Public License +% Version 2 +% +% Replot current plot as a png, generates small and large versions + +function png(pngname) + % small image + + __gnuplot_set__ terminal png size 420,300 + ss = sprintf("__gnuplot_set__ output \"%s.png\"", pngname); + eval(ss) + replot; + + % larger image + + __gnuplot_set__ terminal png size 800,600 + ss = sprintf("__gnuplot_set__ output \"%s_large.png\"", pngname); + eval(ss) + replot; + + % for some reason I need this to stop large plot getting wiped + __gnuplot_set__ output "/dev/null" + +endfunction diff --git a/libs/libcodec2/octave/postfilter.m b/libs/libcodec2/octave/postfilter.m new file mode 100644 index 0000000..84f7dfc --- /dev/null +++ b/libs/libcodec2/octave/postfilter.m @@ -0,0 +1,24 @@ +% Copyright David Rowe 2009 +% This program is distributed under the terms of the GNU General Public License +% Version 2 +% +% Plot postfilter doing its thing + +function postfilter(samname) + p = load(samname); + figure(1); + plot(p(:,1),";energy;"); + hold on; + plot(p(:,2),";bg_est;"); + hold off; + grid; + pngname=sprintf("%s_postfilter_1", samname); + png(pngname); + + figure(2); + plot(p(:,3),";% unvoiced;"); + grid; + pngname=sprintf("%s_postfilter_2", samname); + png(pngname); +endfunction + diff --git a/libs/libcodec2/octave/pulse.m b/libs/libcodec2/octave/pulse.m new file mode 100644 index 0000000..223389e --- /dev/null +++ b/libs/libcodec2/octave/pulse.m @@ -0,0 +1,37 @@ +% pulse.m +% David Rowe August 2009 +% +% Experiments with human pulse perception for sinusoidal codecs + +function pulse(samname) + + A = 1000; + K = 16000; + N = 80; + frames = K/N; + s = zeros(1,K); + + for f=1:frames + % lets try placing np random pulses in every frame + + P = 20 + (160-20)*rand(1,1); + Wo = 2*pi/P; + L = floor(pi/Wo); + sf = zeros(1,N); + for m=1:L/2:L + pos = floor(rand(1,1)*N)+1; + %pos = 50; + for l=m:m+L/2-1 + sf = sf + A*cos(l*Wo*((f-1)*N+1:f*N) - pos*l*Wo); + endfor + endfor + s((f-1)*N+1:f*N) = sf; + endfor + + plot(s(1:250)); + + fs=fopen(samname,"wb"); + fwrite(fs,s,"short"); + fclose(fs); +endfunction + diff --git a/libs/libcodec2/pitch/hts1a.p b/libs/libcodec2/pitch/hts1a.p new file mode 100644 index 0000000..c11b8e9 --- /dev/null +++ b/libs/libcodec2/pitch/hts1a.p @@ -0,0 +1,298 @@ +111.627907 +97.959183 +97.959183 +97.959183 +87.272736 +78.048775 +112.280701 +120.000008 +61.538464 +68.817207 +84.210526 +90.140846 +90.140846 +90.140846 +101.587303 +80.000000 +72.727272 +95.522392 +90.140846 +90.140846 +101.587303 +90.140846 +85.333336 +86.486488 +91.428574 +91.428574 +91.428574 +91.428574 +91.428574 +90.140846 +86.486488 +86.486488 +85.333336 +85.333336 +85.333336 +81.012657 +74.418610 +71.111115 +71.111115 +71.111115 +71.111115 +68.085106 +68.085106 +67.368423 +67.368423 +70.329674 +70.329674 +70.329674 +71.111115 +74.418610 +74.418610 +75.294121 +79.012352 +85.333336 +96.969704 +111.627907 +111.627907 +120.000008 +111.627907 +104.347832 +104.347832 +97.959183 +104.347832 +104.347832 +104.347832 +104.347832 +104.347832 +104.347832 +104.347832 +104.347832 +97.959183 +97.959183 +112.280701 +112.280701 +96.969704 +96.969704 +96.969704 +110.344841 +104.347832 +97.959183 +97.959183 +104.347832 +97.959183 +104.347832 +120.000008 +104.347832 +120.000008 +120.000008 +97.959183 +83.116882 +75.294121 +71.910118 +71.910110 +71.910110 +71.910110 +75.294121 +76.190483 +80.000008 +80.000008 +84.210526 +85.333336 +90.140846 +101.587303 +108.474571 +104.347832 +120.000008 +120.000008 +104.347832 +104.347832 +71.111115 +88.888893 +75.294121 +111.627907 +120.000008 +120.000008 +97.959183 +111.627907 +111.627907 +111.627907 +97.959183 +92.307693 +92.307693 +92.307693 +92.307693 +120.000008 +111.627907 +111.627907 +86.486488 +85.333336 +85.333336 +90.140846 +95.522392 +101.587311 +101.587311 +104.918037 +104.347832 +104.347832 +111.627907 +120.000008 +97.959183 +104.347832 +111.627907 +88.888893 +80.000000 +81.012657 +85.333336 +85.333336 +86.486488 +91.428574 +90.140846 +91.428574 +96.969704 +96.969704 +95.522392 +95.522392 +95.522392 +96.969704 +96.969704 +98.461533 +104.918022 +97.959183 +97.959183 +97.959183 +104.347832 +120.000008 +120.000008 +92.307693 +92.307693 +77.108429 +79.012344 +75.294121 +75.294121 +76.190483 +76.190483 +80.000008 +81.012657 +85.333336 +85.333336 +85.333336 +85.333336 +85.333336 +90.140846 +90.140846 +91.428574 +96.969704 +98.461533 +120.000008 +120.000008 +104.347832 +97.959183 +97.959183 +104.918037 +120.000008 +120.000008 +120.000008 +104.347832 +92.307693 +72.727272 +72.727272 +76.190483 +84.210533 +88.888901 +120.000008 +104.347832 +120.000008 +120.000008 +111.627907 +92.307693 +97.959183 +97.959183 +111.627907 +120.000008 +120.000008 +97.959183 +97.959183 +104.347832 +104.347832 +104.347832 +111.627907 +120.000008 +97.959183 +104.347832 +97.959183 +97.959183 +84.210526 +94.117653 +96.969704 +110.344841 +120.000008 +97.959183 +97.959183 +104.347832 +97.959183 +104.347832 +97.959183 +97.959183 +111.627907 +120.000008 +92.307693 +92.307693 +98.461533 +98.461533 +104.918022 +111.627907 +111.627907 +92.307693 +97.959183 +92.307693 +92.307693 +92.307693 +92.307693 +92.307693 +57.657658 +90.140846 +90.140846 +95.522392 +101.587311 +101.587311 +108.474586 +111.627907 +97.959183 +111.627907 +120.000008 +92.307693 +74.418610 +74.418610 +74.418610 +74.418610 +76.190483 +72.727280 +76.190483 +76.190483 +69.565224 +66.666672 +54.700855 +56.637169 +56.637169 +71.910110 +90.140846 +90.140846 +72.727272 +72.727272 +72.727272 +72.727272 +55.172413 +57.142857 +55.172413 +90.140846 +95.522392 +101.587311 +101.587311 +71.910110 +74.418610 +46.376812 +40.000000 +95.522392 +0 +0 diff --git a/libs/libcodec2/pitch/hts2a.p b/libs/libcodec2/pitch/hts2a.p new file mode 100644 index 0000000..20e2680 --- /dev/null +++ b/libs/libcodec2/pitch/hts2a.p @@ -0,0 +1,300 @@ + 0.0000000e+000 + 9.2753623e+001 + 5.4237288e+001 + 8.5906040e+001 + 7.0329670e+001 + 5.5652174e+001 + 5.4237288e+001 + 5.4935622e+001 + 5.4700855e+001 + 7.5739645e+001 + 7.3563218e+001 + 1.2307692e+002 + 1.1428571e+002 + 7.3563218e+001 + 7.7108434e+001 + 1.8550725e+002 + 1.2673267e+002 + 1.0847458e+002 + 7.8527607e+001 + 8.8888889e+001 + 8.3116883e+001 + 8.1012658e+001 + 1.0756303e+002 + 1.3061224e+002 + 4.8301887e+001 + 4.7940075e+001 + 4.8120301e+001 + 4.9230769e+001 + 4.9420849e+001 + 4.6886447e+001 + 4.2953020e+001 + 3.9263804e+001 + 3.7869822e+001 + 3.5457064e+001 + 3.4224599e+001 + 3.3333333e+001 + 3.2820513e+001 + 3.2000000e+001 + 3.1295844e+001 + 2.9906542e+001 + 2.9493088e+001 + 2.9090909e+001 + 2.8699552e+001 + 2.8131868e+001 + 2.7826087e+001 + 2.7826087e+001 + 2.7826087e+001 + 2.8193833e+001 + 2.7467811e+001 + 2.6890756e+001 + 5.4468085e+001 + 5.4237288e+001 + 6.4974619e+001 + 1.0756303e+002 + 8.8888889e+001 + 1.0406504e+002 + 4.4599303e+001 + 5.4468085e+001 + 3.6260623e+001 + 3.6260623e+001 + 8.1012658e+001 + 7.0329670e+001 + 1.2929293e+002 + 9.9224806e+001 + 4.3097643e+001 + 4.4137931e+001 + 4.5714286e+001 + 4.7407407e+001 + 4.8301887e+001 + 4.9230769e+001 + 4.9420849e+001 + 5.0996016e+001 + 5.1405622e+001 + 5.1405622e+001 + 5.2244898e+001 + 5.2459016e+001 + 5.2459016e+001 + 5.2244898e+001 + 5.3333333e+001 + 5.2459016e+001 + 5.2244898e+001 + 5.1405622e+001 + 5.1405622e+001 + 5.1200000e+001 + 5.0996016e+001 + 5.0196078e+001 + 4.9230769e+001 + 4.9230769e+001 + 4.9230769e+001 + 4.9420849e+001 + 4.9230769e+001 + 4.9042146e+001 + 9.8461538e+001 + 1.0158730e+002 + 5.1821862e+001 + 9.0140845e+001 + 1.0491803e+002 + 1.4382022e+002 + 5.2459016e+001 + 5.2459016e+001 + 1.2929293e+002 + 1.6410256e+002 + 8.0000000e+001 + 7.3563218e+001 + 1.0158730e+002 + 9.9224806e+001 + 4.9042146e+001 + 4.9042146e+001 + 4.9042146e+001 + 5.9259259e+001 + 1.4382022e+002 + 7.2316384e+001 + 1.0847458e+002 + 1.1228070e+002 + 1.6202532e+002 + 8.1528662e+001 + 7.2727273e+001 + 1.8550725e+002 + 6.0093897e+001 + 1.0847458e+002 + 8.9510490e+001 + 7.1508380e+001 + 4.0125392e+001 + 4.0634921e+001 + 4.0634921e+001 + 4.0251572e+001 + 4.0506329e+001 + 4.3986254e+001 + 4.0506329e+001 + 9.8461538e+001 + 5.6140351e+001 + 6.5641026e+001 + 5.4237288e+001 + 1.1636364e+002 + 3.4316354e+001 + 3.4972678e+001 + 3.7758112e+001 + 4.0634921e+001 + 4.0506329e+001 + 4.1290323e+001 + 4.2524917e+001 + 4.3389831e+001 + 4.4599303e+001 + 4.4912281e+001 + 4.6545455e+001 + 4.7232472e+001 + 4.8301887e+001 + 4.9230769e+001 + 4.9420849e+001 + 5.0393701e+001 + 5.1405622e+001 + 5.3333333e+001 + 5.3112033e+001 + 1.1034483e+002 + 9.7709924e+001 + 1.4382022e+002 + 5.0996016e+001 + 5.1821862e+001 + 5.0996016e+001 + 5.2032520e+001 + 5.3112033e+001 + 5.3556485e+001 + 5.4468085e+001 + 5.5652174e+001 + 5.4700855e+001 + 5.4700855e+001 + 5.4935622e+001 + 5.4700855e+001 + 5.4700855e+001 + 5.4468085e+001 + 5.4468085e+001 + 5.4468085e+001 + 5.4468085e+001 + 5.3333333e+001 + 5.1405622e+001 + 5.0996016e+001 + 5.0000000e+001 + 4.8120301e+001 + 4.8669202e+001 + 4.7058824e+001 + 4.6376812e+001 + 4.5070423e+001 + 4.4912281e+001 + 4.4137931e+001 + 4.2809365e+001 + 4.2666667e+001 + 4.2105263e+001 + 4.1423948e+001 + 4.1290323e+001 + 4.1290323e+001 + 4.1290323e+001 + 4.0634921e+001 + 4.0634921e+001 + 4.0634921e+001 + 4.0634921e+001 + 4.0764331e+001 + 4.1423948e+001 + 4.2953020e+001 + 4.5551601e+001 + 1.7534247e+002 + 4.7232472e+001 + 1.3763441e+002 + 1.3061224e+002 + 4.5551601e+001 + 4.3686007e+001 + 4.8669202e+001 + 9.4117647e+001 + 8.1012658e+001 + 1.1228070e+002 + 1.3617021e+002 + 4.3097643e+001 + 4.3835616e+001 + 4.6376812e+001 + 4.6545455e+001 + 4.6043165e+001 + 4.8301887e+001 + 4.9042146e+001 + 4.9420849e+001 + 5.1200000e+001 + 5.1405622e+001 + 5.2244898e+001 + 1.2929293e+002 + 1.2929293e+002 + 1.5238095e+002 + 1.5238095e+002 + 1.3913043e+002 + 9.0140845e+001 + 1.0940171e+002 + 9.0140845e+001 + 1.2307692e+002 + 8.9510490e+001 + 6.9565217e+001 + 7.3142857e+001 + 1.1034483e+002 + 7.8048780e+001 + 7.2727273e+001 + 1.0078740e+002 + 1.0940171e+002 + 1.1743119e+002 + 8.7074830e+001 + 1.8550725e+002 + 6.5306122e+001 + 1.3617021e+002 + 5.2674897e+001 + 1.0940171e+002 + 1.5238095e+002 + 1.4065934e+002 + 1.0756303e+002 + 1.0406504e+002 + 5.0793651e+001 + 4.9420849e+001 + 4.4444444e+001 + 7.0329670e+001 + 7.2727273e+001 + 7.4418605e+001 + 1.1636364e+002 + 1.0406504e+002 + 1.2307692e+002 + 1.2549020e+002 + 1.7297297e+002 + 4.5878136e+001 + 4.9805447e+001 + 6.2745098e+001 + 9.2086331e+001 + 9.1428571e+001 + 5.7142857e+001 + 4.8484848e+001 + 4.1157556e+001 + 2.2857143e+001 + 3.0046948e+001 + 9.4814815e+001 + 5.7918552e+001 + 9.0140845e+001 + 7.4418605e+001 + 7.4418605e+001 + 5.4700855e+001 + 9.5522388e+001 + 7.4853801e+001 + 9.4117647e+001 + 9.5522388e+001 + 9.9224806e+001 + 8.1012658e+001 + 1.1851852e+002 + 6.8817204e+001 + 8.5906040e+001 + 6.7015707e+001 + 4.3537415e+001 + 6.5306122e+001 + 3.1295844e+001 + 7.5739645e+001 + 6.2135922e+001 + 9.9224806e+001 + 5.7657658e+001 + 5.2244898e+001 + 5.8447489e+001 + 0.0000000e+000 + 0.0000000e+000 + 0.0000000e+000 + 0.0000000e+000 + 0.0000000e+000 diff --git a/libs/libcodec2/raw/b0067.raw b/libs/libcodec2/raw/b0067.raw new file mode 100644 index 0000000..3aea9cd Binary files /dev/null and b/libs/libcodec2/raw/b0067.raw differ diff --git a/libs/libcodec2/raw/f2400.raw b/libs/libcodec2/raw/f2400.raw new file mode 100644 index 0000000..5f4427f Binary files /dev/null and b/libs/libcodec2/raw/f2400.raw differ diff --git a/libs/libcodec2/raw/forig.raw b/libs/libcodec2/raw/forig.raw new file mode 100644 index 0000000..4ba294d Binary files /dev/null and b/libs/libcodec2/raw/forig.raw differ diff --git a/libs/libcodec2/raw/forig_g729a.raw b/libs/libcodec2/raw/forig_g729a.raw new file mode 100644 index 0000000..fbca567 Binary files /dev/null and b/libs/libcodec2/raw/forig_g729a.raw differ diff --git a/libs/libcodec2/raw/forig_gsm13k.raw b/libs/libcodec2/raw/forig_gsm13k.raw new file mode 100644 index 0000000..71cbe6f Binary files /dev/null and b/libs/libcodec2/raw/forig_gsm13k.raw differ diff --git a/libs/libcodec2/raw/forig_speex_8k.raw b/libs/libcodec2/raw/forig_speex_8k.raw new file mode 100644 index 0000000..e95302e Binary files /dev/null and b/libs/libcodec2/raw/forig_speex_8k.raw differ diff --git a/libs/libcodec2/raw/hts.raw b/libs/libcodec2/raw/hts.raw new file mode 100644 index 0000000..79f869a Binary files /dev/null and b/libs/libcodec2/raw/hts.raw differ diff --git a/libs/libcodec2/raw/hts1.raw b/libs/libcodec2/raw/hts1.raw new file mode 100644 index 0000000..3369387 Binary files /dev/null and b/libs/libcodec2/raw/hts1.raw differ diff --git a/libs/libcodec2/raw/hts1a.raw b/libs/libcodec2/raw/hts1a.raw new file mode 100644 index 0000000..7332f93 Binary files /dev/null and b/libs/libcodec2/raw/hts1a.raw differ diff --git a/libs/libcodec2/raw/hts1a_g729a.raw b/libs/libcodec2/raw/hts1a_g729a.raw new file mode 100644 index 0000000..130f1dd Binary files /dev/null and b/libs/libcodec2/raw/hts1a_g729a.raw differ diff --git a/libs/libcodec2/raw/hts1a_gsm13k.raw b/libs/libcodec2/raw/hts1a_gsm13k.raw new file mode 100644 index 0000000..dd102f5 Binary files /dev/null and b/libs/libcodec2/raw/hts1a_gsm13k.raw differ diff --git a/libs/libcodec2/raw/hts1a_speex_8k.raw b/libs/libcodec2/raw/hts1a_speex_8k.raw new file mode 100644 index 0000000..9289e1c Binary files /dev/null and b/libs/libcodec2/raw/hts1a_speex_8k.raw differ diff --git a/libs/libcodec2/raw/hts2.raw b/libs/libcodec2/raw/hts2.raw new file mode 100644 index 0000000..0bb9df1 Binary files /dev/null and b/libs/libcodec2/raw/hts2.raw differ diff --git a/libs/libcodec2/raw/hts2a.raw b/libs/libcodec2/raw/hts2a.raw new file mode 100644 index 0000000..6d9cf17 Binary files /dev/null and b/libs/libcodec2/raw/hts2a.raw differ diff --git a/libs/libcodec2/raw/hts2a_g729a.raw b/libs/libcodec2/raw/hts2a_g729a.raw new file mode 100644 index 0000000..9199b0a Binary files /dev/null and b/libs/libcodec2/raw/hts2a_g729a.raw differ diff --git a/libs/libcodec2/raw/hts2a_gsm13k.raw b/libs/libcodec2/raw/hts2a_gsm13k.raw new file mode 100644 index 0000000..f0a5850 Binary files /dev/null and b/libs/libcodec2/raw/hts2a_gsm13k.raw differ diff --git a/libs/libcodec2/raw/hts2a_speex_8k.raw b/libs/libcodec2/raw/hts2a_speex_8k.raw new file mode 100644 index 0000000..c421bb4 Binary files /dev/null and b/libs/libcodec2/raw/hts2a_speex_8k.raw differ diff --git a/libs/libcodec2/raw/m2400.raw b/libs/libcodec2/raw/m2400.raw new file mode 100644 index 0000000..1c0956d Binary files /dev/null and b/libs/libcodec2/raw/m2400.raw differ diff --git a/libs/libcodec2/raw/mmt1.raw b/libs/libcodec2/raw/mmt1.raw new file mode 100644 index 0000000..40638a5 Binary files /dev/null and b/libs/libcodec2/raw/mmt1.raw differ diff --git a/libs/libcodec2/raw/mmt1_g729a.raw b/libs/libcodec2/raw/mmt1_g729a.raw new file mode 100644 index 0000000..196716e Binary files /dev/null and b/libs/libcodec2/raw/mmt1_g729a.raw differ diff --git a/libs/libcodec2/raw/mmt1_gsm13k.raw b/libs/libcodec2/raw/mmt1_gsm13k.raw new file mode 100644 index 0000000..a9965af Binary files /dev/null and b/libs/libcodec2/raw/mmt1_gsm13k.raw differ diff --git a/libs/libcodec2/raw/mmt1_speex_8k.raw b/libs/libcodec2/raw/mmt1_speex_8k.raw new file mode 100644 index 0000000..769a49c Binary files /dev/null and b/libs/libcodec2/raw/mmt1_speex_8k.raw differ diff --git a/libs/libcodec2/raw/morig.raw b/libs/libcodec2/raw/morig.raw new file mode 100644 index 0000000..4af0e8f Binary files /dev/null and b/libs/libcodec2/raw/morig.raw differ diff --git a/libs/libcodec2/raw/morig_g729a.raw b/libs/libcodec2/raw/morig_g729a.raw new file mode 100644 index 0000000..636ecfd Binary files /dev/null and b/libs/libcodec2/raw/morig_g729a.raw differ diff --git a/libs/libcodec2/raw/morig_gsm13k.raw b/libs/libcodec2/raw/morig_gsm13k.raw new file mode 100644 index 0000000..660368f Binary files /dev/null and b/libs/libcodec2/raw/morig_gsm13k.raw differ diff --git a/libs/libcodec2/raw/morig_speex_8k.raw b/libs/libcodec2/raw/morig_speex_8k.raw new file mode 100644 index 0000000..ab667a1 Binary files /dev/null and b/libs/libcodec2/raw/morig_speex_8k.raw differ diff --git a/libs/libcodec2/script/menu.sh b/libs/libcodec2/script/menu.sh new file mode 100755 index 0000000..11297df --- /dev/null +++ b/libs/libcodec2/script/menu.sh @@ -0,0 +1,70 @@ +#!/bin/bash +# ./menu.sh +# +# David Rowe +# Created August 2009 +# +# Presents a menu of sound files, press 1 to play file1, 2 to play file2 etc +# +# The aim is to make comparing files with different processing easier than +# using up-arrow on the command line. Based on cdialog. +# +# usage: +# menu.sh file1.raw file2.raw ........ [-d playbackdevice] +# +# for example: +# +# ../script/menu.sh hts1a.raw hts1a_uq.raw +# +# or: +# +# ../script/menu.sh hts1a.raw hts1a_uq.raw -d /dev/dsp1 +# + +# Copyright (C) 2007 David Rowe +# +# All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2, as +# published by the Free Software Foundation. +# +# 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., 675 Mass Ave, Cambridge, MA 02139, USA. + +files=0 +items="Q-Quit\n" +while [ ! -z "$1" ] +do + case "$1" in + -d) dsp="${1} ${2}"; shift;; + *) files=`expr 1 + $files`; + new_file=$1; + file[$files]=$new_file; + items="${items} ${files}-${new_file}\n";; + esac + shift +done + +readchar=1 +echo -n -e "\r" $items"- " +while [ $readchar -ne 0 ] +do + echo -n -e "\r -" + stty cbreak # or stty raw + readchar=`dd if=/dev/tty bs=1 count=1 2>/dev/null` + stty -cbreak + if [ $readchar == 'q' ] ; then + readchar=0 + fi + if [ $readchar -ne 0 ] ; then + play -r 8000 -s -2 ${file[$readchar]} $dsp 2> /dev/null + fi +done +echo diff --git a/libs/libcodec2/script/playraw.sh b/libs/libcodec2/script/playraw.sh new file mode 100755 index 0000000..683cbaa --- /dev/null +++ b/libs/libcodec2/script/playraw.sh @@ -0,0 +1,6 @@ +#!/bin/sh +# Plays a raw file +# usage: +# playraw file.raw +# playraw file.raw -d /dev/dsp1 (e.g. for USB headphones) +play -r 8000 -s -2 $1 $2 $3 diff --git a/libs/libcodec2/script/raw2wav.sh b/libs/libcodec2/script/raw2wav.sh new file mode 100755 index 0000000..a05efb7 --- /dev/null +++ b/libs/libcodec2/script/raw2wav.sh @@ -0,0 +1,3 @@ +#!/bin/sh +# Converts 16 bit signed short 8 kHz raw (headerless) files to wave +sox -r 8000 -s -2 $1 $2 diff --git a/libs/libcodec2/script/wav2raw.sh b/libs/libcodec2/script/wav2raw.sh new file mode 100755 index 0000000..39c0f1a --- /dev/null +++ b/libs/libcodec2/script/wav2raw.sh @@ -0,0 +1,3 @@ +#!/bin/sh +# Converts wave files to raw (headerless) files +sox $1 -t raw $2 diff --git a/libs/libcodec2/src/Makefile.am b/libs/libcodec2/src/Makefile.am new file mode 100644 index 0000000..ce24078 --- /dev/null +++ b/libs/libcodec2/src/Makefile.am @@ -0,0 +1,53 @@ +AM_CFLAGS = -I../src -Wall -DFLOATING_POINT -DVAR_ARRAYS +AUTOMAKE_OPTS = gnu +NAME = libcodec2 +AM_CPPFLAGS = $(AM_CFLAGS) + +lib_LTLIBRARIES = libcodec2.la +libcodec2_la_SOURCES = dump.c \ +lpc.c \ +nlp.c \ +postfilter.c \ +sine.c \ +codec2.c \ +four1.c \ +interp.c \ +lsp.c \ +phase.c \ +quantise.c \ +pack.c \ +codebook.c + +libcodec2_la_CFLAGS = $(AM_CFLAGS) +libcodec2_la_LDFLAGS = $(LIBS) + +library_includedir = $(prefix) +library_include_HEADERS = codec2.h \ +defines.h \ +four1.h \ +interp.h \ +lsp.h \ +phase.h \ +quantise.h \ +comp.h \ +dump.h \ +globals.h \ +lpc.h \ +nlp.h \ +postfilter.h \ +sine.h \ +codebook.h + +bin_PROGRAMS = c2dec c2enc c2sim + +c2dec_SOURCES = c2dec.c +c2dec_LDADD = $(lib_LTLIBRARIES) +c2dec_LDFLAGS = $(LIBS) + +c2enc_SOURCES = c2enc.c +c2enc_LDADD = $(lib_LTLIBRARIES) +c2enc_LDFLAGS = $(LIBS) + +c2sim_SOURCES = c2sim.c +c2sim_LDADD = $(lib_LTLIBRARIES) +c2sim_LDFLAGS = $(LIBS) diff --git a/libs/libcodec2/src/Makefile.in b/libs/libcodec2/src/Makefile.in new file mode 100644 index 0000000..9596c90 --- /dev/null +++ b/libs/libcodec2/src/Makefile.in @@ -0,0 +1,690 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = c2dec$(EXEEXT) c2enc$(EXEEXT) c2sim$(EXEEXT) +subdir = src +DIST_COMMON = $(library_include_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_CLEAN_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ + "$(DESTDIR)$(library_includedir)" +libLTLIBRARIES_INSTALL = $(INSTALL) +LTLIBRARIES = $(lib_LTLIBRARIES) +libcodec2_la_LIBADD = +am_libcodec2_la_OBJECTS = libcodec2_la-dump.lo libcodec2_la-lpc.lo \ + libcodec2_la-nlp.lo libcodec2_la-postfilter.lo \ + libcodec2_la-sine.lo libcodec2_la-codec2.lo \ + libcodec2_la-four1.lo libcodec2_la-interp.lo \ + libcodec2_la-lsp.lo libcodec2_la-phase.lo \ + libcodec2_la-quantise.lo libcodec2_la-pack.lo \ + libcodec2_la-codebook.lo +libcodec2_la_OBJECTS = $(am_libcodec2_la_OBJECTS) +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am_c2dec_OBJECTS = c2dec.$(OBJEXT) +c2dec_OBJECTS = $(am_c2dec_OBJECTS) +am__DEPENDENCIES_1 = libcodec2.la +c2dec_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_c2enc_OBJECTS = c2enc.$(OBJEXT) +c2enc_OBJECTS = $(am_c2enc_OBJECTS) +c2enc_DEPENDENCIES = $(am__DEPENDENCIES_1) +am_c2sim_OBJECTS = c2sim.$(OBJEXT) +c2sim_OBJECTS = $(am_c2sim_OBJECTS) +c2sim_DEPENDENCIES = $(am__DEPENDENCIES_1) +DEFAULT_INCLUDES = -I. -I$(srcdir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libcodec2_la_SOURCES) $(c2dec_SOURCES) $(c2enc_SOURCES) \ + $(c2sim_SOURCES) +DIST_SOURCES = $(libcodec2_la_SOURCES) $(c2dec_SOURCES) \ + $(c2enc_SOURCES) $(c2sim_SOURCES) +library_includeHEADERS_INSTALL = $(INSTALL_HEADER) +HEADERS = $(library_include_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GREP = @GREP@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +AM_CFLAGS = -I../src -Wall -DFLOATING_POINT -DVAR_ARRAYS +AUTOMAKE_OPTS = gnu +NAME = libcodec2 +AM_CPPFLAGS = $(AM_CFLAGS) +lib_LTLIBRARIES = libcodec2.la +libcodec2_la_SOURCES = dump.c \ +lpc.c \ +nlp.c \ +postfilter.c \ +sine.c \ +codec2.c \ +four1.c \ +interp.c \ +lsp.c \ +phase.c \ +quantise.c \ +pack.c \ +codebook.c + +libcodec2_la_CFLAGS = $(AM_CFLAGS) +libcodec2_la_LDFLAGS = $(LIBS) +library_includedir = $(prefix) +library_include_HEADERS = codec2.h \ +defines.h \ +four1.h \ +interp.h \ +lsp.h \ +phase.h \ +quantise.h \ +comp.h \ +dump.h \ +globals.h \ +lpc.h \ +nlp.h \ +postfilter.h \ +sine.h \ +codebook.h + +c2dec_SOURCES = c2dec.c +c2dec_LDADD = $(lib_LTLIBRARIES) +c2dec_LDFLAGS = $(LIBS) +c2enc_SOURCES = c2enc.c +c2enc_LDADD = $(lib_LTLIBRARIES) +c2enc_LDFLAGS = $(LIBS) +c2sim_SOURCES = c2sim.c +c2sim_LDADD = $(lib_LTLIBRARIES) +c2sim_LDFLAGS = $(LIBS) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + f=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \ + else :; fi; \ + done + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @set -x; list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + p=$(am__strip_dir) \ + echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \ + $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libcodec2.la: $(libcodec2_la_OBJECTS) $(libcodec2_la_DEPENDENCIES) + $(LINK) -rpath $(libdir) $(libcodec2_la_LDFLAGS) $(libcodec2_la_OBJECTS) $(libcodec2_la_LIBADD) $(LIBS) +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +c2dec$(EXEEXT): $(c2dec_OBJECTS) $(c2dec_DEPENDENCIES) + @rm -f c2dec$(EXEEXT) + $(LINK) $(c2dec_LDFLAGS) $(c2dec_OBJECTS) $(c2dec_LDADD) $(LIBS) +c2enc$(EXEEXT): $(c2enc_OBJECTS) $(c2enc_DEPENDENCIES) + @rm -f c2enc$(EXEEXT) + $(LINK) $(c2enc_LDFLAGS) $(c2enc_OBJECTS) $(c2enc_LDADD) $(LIBS) +c2sim$(EXEEXT): $(c2sim_OBJECTS) $(c2sim_DEPENDENCIES) + @rm -f c2sim$(EXEEXT) + $(LINK) $(c2sim_LDFLAGS) $(c2sim_OBJECTS) $(c2sim_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c2dec.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c2enc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c2sim.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-codebook.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-codec2.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-dump.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-four1.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-interp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-lpc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-lsp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-nlp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-pack.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-phase.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-postfilter.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-quantise.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libcodec2_la-sine.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +libcodec2_la-dump.lo: dump.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-dump.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-dump.Tpo" -c -o libcodec2_la-dump.lo `test -f 'dump.c' || echo '$(srcdir)/'`dump.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-dump.Tpo" "$(DEPDIR)/libcodec2_la-dump.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-dump.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dump.c' object='libcodec2_la-dump.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-dump.lo `test -f 'dump.c' || echo '$(srcdir)/'`dump.c + +libcodec2_la-lpc.lo: lpc.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-lpc.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-lpc.Tpo" -c -o libcodec2_la-lpc.lo `test -f 'lpc.c' || echo '$(srcdir)/'`lpc.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-lpc.Tpo" "$(DEPDIR)/libcodec2_la-lpc.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-lpc.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lpc.c' object='libcodec2_la-lpc.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-lpc.lo `test -f 'lpc.c' || echo '$(srcdir)/'`lpc.c + +libcodec2_la-nlp.lo: nlp.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-nlp.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-nlp.Tpo" -c -o libcodec2_la-nlp.lo `test -f 'nlp.c' || echo '$(srcdir)/'`nlp.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-nlp.Tpo" "$(DEPDIR)/libcodec2_la-nlp.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-nlp.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nlp.c' object='libcodec2_la-nlp.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-nlp.lo `test -f 'nlp.c' || echo '$(srcdir)/'`nlp.c + +libcodec2_la-postfilter.lo: postfilter.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-postfilter.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-postfilter.Tpo" -c -o libcodec2_la-postfilter.lo `test -f 'postfilter.c' || echo '$(srcdir)/'`postfilter.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-postfilter.Tpo" "$(DEPDIR)/libcodec2_la-postfilter.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-postfilter.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='postfilter.c' object='libcodec2_la-postfilter.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-postfilter.lo `test -f 'postfilter.c' || echo '$(srcdir)/'`postfilter.c + +libcodec2_la-sine.lo: sine.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-sine.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-sine.Tpo" -c -o libcodec2_la-sine.lo `test -f 'sine.c' || echo '$(srcdir)/'`sine.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-sine.Tpo" "$(DEPDIR)/libcodec2_la-sine.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-sine.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sine.c' object='libcodec2_la-sine.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-sine.lo `test -f 'sine.c' || echo '$(srcdir)/'`sine.c + +libcodec2_la-codec2.lo: codec2.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-codec2.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-codec2.Tpo" -c -o libcodec2_la-codec2.lo `test -f 'codec2.c' || echo '$(srcdir)/'`codec2.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-codec2.Tpo" "$(DEPDIR)/libcodec2_la-codec2.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-codec2.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='codec2.c' object='libcodec2_la-codec2.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-codec2.lo `test -f 'codec2.c' || echo '$(srcdir)/'`codec2.c + +libcodec2_la-four1.lo: four1.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-four1.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-four1.Tpo" -c -o libcodec2_la-four1.lo `test -f 'four1.c' || echo '$(srcdir)/'`four1.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-four1.Tpo" "$(DEPDIR)/libcodec2_la-four1.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-four1.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='four1.c' object='libcodec2_la-four1.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-four1.lo `test -f 'four1.c' || echo '$(srcdir)/'`four1.c + +libcodec2_la-interp.lo: interp.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-interp.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-interp.Tpo" -c -o libcodec2_la-interp.lo `test -f 'interp.c' || echo '$(srcdir)/'`interp.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-interp.Tpo" "$(DEPDIR)/libcodec2_la-interp.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-interp.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='interp.c' object='libcodec2_la-interp.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-interp.lo `test -f 'interp.c' || echo '$(srcdir)/'`interp.c + +libcodec2_la-lsp.lo: lsp.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-lsp.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-lsp.Tpo" -c -o libcodec2_la-lsp.lo `test -f 'lsp.c' || echo '$(srcdir)/'`lsp.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-lsp.Tpo" "$(DEPDIR)/libcodec2_la-lsp.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-lsp.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lsp.c' object='libcodec2_la-lsp.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-lsp.lo `test -f 'lsp.c' || echo '$(srcdir)/'`lsp.c + +libcodec2_la-phase.lo: phase.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-phase.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-phase.Tpo" -c -o libcodec2_la-phase.lo `test -f 'phase.c' || echo '$(srcdir)/'`phase.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-phase.Tpo" "$(DEPDIR)/libcodec2_la-phase.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-phase.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='phase.c' object='libcodec2_la-phase.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-phase.lo `test -f 'phase.c' || echo '$(srcdir)/'`phase.c + +libcodec2_la-quantise.lo: quantise.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-quantise.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-quantise.Tpo" -c -o libcodec2_la-quantise.lo `test -f 'quantise.c' || echo '$(srcdir)/'`quantise.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-quantise.Tpo" "$(DEPDIR)/libcodec2_la-quantise.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-quantise.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='quantise.c' object='libcodec2_la-quantise.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-quantise.lo `test -f 'quantise.c' || echo '$(srcdir)/'`quantise.c + +libcodec2_la-pack.lo: pack.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-pack.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-pack.Tpo" -c -o libcodec2_la-pack.lo `test -f 'pack.c' || echo '$(srcdir)/'`pack.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-pack.Tpo" "$(DEPDIR)/libcodec2_la-pack.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-pack.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='pack.c' object='libcodec2_la-pack.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-pack.lo `test -f 'pack.c' || echo '$(srcdir)/'`pack.c + +libcodec2_la-codebook.lo: codebook.c +@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -MT libcodec2_la-codebook.lo -MD -MP -MF "$(DEPDIR)/libcodec2_la-codebook.Tpo" -c -o libcodec2_la-codebook.lo `test -f 'codebook.c' || echo '$(srcdir)/'`codebook.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/libcodec2_la-codebook.Tpo" "$(DEPDIR)/libcodec2_la-codebook.Plo"; else rm -f "$(DEPDIR)/libcodec2_la-codebook.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='codebook.c' object='libcodec2_la-codebook.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libcodec2_la_CFLAGS) $(CFLAGS) -c -o libcodec2_la-codebook.lo `test -f 'codebook.c' || echo '$(srcdir)/'`codebook.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: +install-library_includeHEADERS: $(library_include_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(library_includedir)" || $(mkdir_p) "$(DESTDIR)$(library_includedir)" + @list='$(library_include_HEADERS)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(library_includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(library_includedir)/$$f'"; \ + $(library_includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(library_includedir)/$$f"; \ + done + +uninstall-library_includeHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(library_include_HEADERS)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(library_includedir)/$$f'"; \ + rm -f "$(DESTDIR)$(library_includedir)/$$f"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS) +install-binPROGRAMS: install-libLTLIBRARIES + +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(library_includedir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ + clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-library_includeHEADERS + +install-exec-am: install-binPROGRAMS install-libLTLIBRARIES + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-info-am \ + uninstall-libLTLIBRARIES uninstall-library_includeHEADERS + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libLTLIBRARIES clean-libtool ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-libLTLIBRARIES \ + install-library_includeHEADERS install-man install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-info-am uninstall-libLTLIBRARIES \ + uninstall-library_includeHEADERS + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libs/libcodec2/src/c2dec.c b/libs/libcodec2/src/c2dec.c new file mode 100644 index 0000000..3b876bc --- /dev/null +++ b/libs/libcodec2/src/c2dec.c @@ -0,0 +1,80 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: c2dec.c + AUTHOR......: David Rowe + DATE CREATED: 23/8/2010 + + Decodes a file of bits to a file of raw speech samples using codec2. Demo + program for codec2. + + NOTE: the bit file is not packed, 51 bits/frame actually consumes 51 + bytes/frame on disk. If you are using this for a real world + application you may want to pack the 51 bytes into 7 bytes. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2010 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2.1, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "codec2.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> + +int main(int argc, char *argv[]) +{ + static const int bitsSize = ((CODEC2_BITS_PER_FRAME + 7) / 8); + void *codec2; + FILE *fin; + FILE *fout; + short buf[CODEC2_SAMPLES_PER_FRAME]; + unsigned char bits[bitsSize]; + + if (argc != 3) { + printf("usage: %s InputBitFile OutputRawSpeechFile\n", argv[0]); + exit(1); + } + + if ( (fin = fopen(argv[1],"rb")) == NULL ) { + fprintf(stderr, "Error opening input bit file: %s: %s.\n", + argv[1], strerror(errno)); + exit(1); + } + + if ( (fout = fopen(argv[2],"wb")) == NULL ) { + fprintf(stderr, "Error opening output speech file: %s: %s.\n", + argv[2], strerror(errno)); + exit(1); + } + + codec2 = codec2_create(); + + while(fread(bits, sizeof(char), bitsSize, fin) == bitsSize) { + codec2_decode(codec2, buf, bits); + fwrite(buf, sizeof(short), CODEC2_SAMPLES_PER_FRAME, fout); + } + + codec2_destroy(codec2); + + fclose(fin); + fclose(fout); + + return 0; +} diff --git a/libs/libcodec2/src/c2enc.c b/libs/libcodec2/src/c2enc.c new file mode 100644 index 0000000..8fd7c77 --- /dev/null +++ b/libs/libcodec2/src/c2enc.c @@ -0,0 +1,82 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: c2enc.c + AUTHOR......: David Rowe + DATE CREATED: 23/8/2010 + + Encodes a file of raw speech samples using codec2 and ouputs a file + of bits (each bit is stored in the LSB or each output byte). Demo + program for codec2. + + NOTE: the bit file is not packed, 51 bits/frame actually consumes 51 + bytes/frame on disk. If you are using this for a real world + application you may want to pack the 51 bytes into 7 bytes. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2010 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2.1, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "codec2.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> + +int main(int argc, char *argv[]) +{ + static const int bitsSize = ((CODEC2_BITS_PER_FRAME + 7) / 8); + void *codec2; + FILE *fin; + FILE *fout; + short buf[CODEC2_SAMPLES_PER_FRAME]; + unsigned char bits[bitsSize]; + + if (argc != 3) { + printf("usage: %s InputRawspeechFile OutputBitFile\n", argv[0]); + exit(1); + } + + if ( (fin = fopen(argv[1],"rb")) == NULL ) { + fprintf(stderr, "Error opening input bit file: %s: %s.\n", + argv[1], strerror(errno)); + exit(1); + } + + if ( (fout = fopen(argv[2],"wb")) == NULL ) { + fprintf(stderr, "Error opening output speech file: %s: %s.\n", + argv[2], strerror(errno)); + exit(1); + } + + codec2 = codec2_create(); + + while(fread(buf, sizeof(short), CODEC2_SAMPLES_PER_FRAME, fin) == + CODEC2_SAMPLES_PER_FRAME) { + codec2_encode(codec2, bits, buf); + fwrite(bits, sizeof(char), bitsSize, fout); + } + + codec2_destroy(codec2); + + fclose(fin); + fclose(fout); + + return 0; +} diff --git a/libs/libcodec2/src/c2sim.c b/libs/libcodec2/src/c2sim.c new file mode 100644 index 0000000..b9e5f0f --- /dev/null +++ b/libs/libcodec2/src/c2sim.c @@ -0,0 +1,408 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: c2sim.c + AUTHOR......: David Rowe + DATE CREATED: 20/8/2010 + + Codec2 simulation. Combines encoder and decoder and allows switching in + out various algorithms and quantisation steps. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2009 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2.1, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <assert.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <math.h> + +#include "defines.h" +#include "sine.h" +#include "nlp.h" +#include "dump.h" +#include "lpc.h" +#include "lsp.h" +#include "quantise.h" +#include "phase.h" +#include "postfilter.h" +#include "interp.h" + +/*---------------------------------------------------------------------------*\ + + switch_present() + + Searches the command line arguments for a "switch". If the switch is + found, returns the command line argument where it ws found, else returns + NULL. + +\*---------------------------------------------------------------------------*/ + +int switch_present(sw,argc,argv) +register char sw[]; /* switch in string form */ +register int argc; /* number of command line arguments */ +register char *argv[]; /* array of command line arguments in string form */ +{ + register int i; /* loop variable */ + + for(i=1; i<argc; i++) + if (!strcmp(sw,argv[i])) + return(i); + + return 0; +} + +void synth_one_frame(short buf[], MODEL *model, float Sn_[], float Pn[]); + +/*---------------------------------------------------------------------------*\ + + MAIN + +\*---------------------------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + FILE *fout; /* output speech file */ + FILE *fin; /* input speech file */ + short buf[N]; /* input/output buffer */ + float Sn[M]; /* float input speech samples */ + COMP Sw[FFT_ENC]; /* DFT of Sn[] */ + float w[M]; /* time domain hamming window */ + COMP W[FFT_ENC]; /* DFT of w[] */ + MODEL model; + float Pn[2*N]; /* trapezoidal synthesis window */ + float Sn_[2*N]; /* synthesised speech */ + int i; /* loop variable */ + int frames; + float prev_Wo; + float pitch; + int voiced1; + + char out_file[MAX_STR]; + int arg; + float snr; + float sum_snr; + + int lpc_model, order; + int lsp, lsp_quantiser; + float ak[LPC_MAX]; + COMP Sw_[FFT_ENC]; + + int dump; + + int phase0; + float ex_phase[MAX_AMP+1]; + + int postfilt; + float bg_est; + + int hand_voicing; + FILE *fvoicing; + + MODEL prev_model, interp_model; + int decimate; + + void *nlp_states; + + for(i=0; i<M; i++) + Sn[i] = 1.0; + for(i=0; i<2*N; i++) + Sn_[i] = 0; + + prev_Wo = TWO_PI/P_MAX; + + prev_model.Wo = TWO_PI/P_MIN; + prev_model.L = floor(PI/prev_model.Wo); + for(i=1; i<=prev_model.L; i++) { + prev_model.A[i] = 0.0; + prev_model.phi[i] = 0.0; + } + for(i=1; i<=MAX_AMP; i++) { + ex_phase[i] = 0.0; + } + + nlp_states = nlp_create(); + + if (argc < 2) { + fprintf(stderr, "\nCodec2 - 2400 bit/s speech codec - Simulation Program\n" + "\thttp://rowetel.com/codec2.html\n\n" + "usage: %s InputFile [-o OutputFile]\n" + "\t[-o lpc Order]\n" + "\t[--lsp]\n" + "\t[--phase0]\n" + "\t[--postfilter]\n" + "\t[--hand_voicing]\n" + "\t[--dec]\n" + "\t[--dump DumpFilePrefix]\n", argv[0]); + exit(1); + } + + /* Interpret command line arguments -------------------------------------*/ + + /* Input file */ + + if ((fin = fopen(argv[1],"rb")) == NULL) { + fprintf(stderr, "Error opening input bit file: %s: %s.\n", + argv[1], strerror(errno)); + exit(1); + } + + /* Output file */ + + if ((arg = switch_present("-o",argc,argv))) { + if ((fout = fopen(argv[arg+1],"wb")) == NULL) { + fprintf(stderr, "Error opening output speech file: %s: %s.\n", + argv[arg+1], strerror(errno)); + exit(1); + } + strcpy(out_file,argv[arg+1]); + } + else + fout = NULL; + + lpc_model = 0; + if ((arg = switch_present("--lpc",argc,argv))) { + lpc_model = 1; + order = atoi(argv[arg+1]); + if ((order < 4) || (order > 20)) { + fprintf(stderr, "Error in lpc order: %d\n", order); + exit(1); + } + } + + dump = switch_present("--dump",argc,argv); + if (dump) + dump_on(argv[dump+1]); + + lsp = switch_present("--lsp",argc,argv); + lsp_quantiser = 0; + + phase0 = switch_present("--phase0",argc,argv); + if (phase0) { + ex_phase[0] = 0; + } + + hand_voicing = switch_present("--hand_voicing",argc,argv); + if (hand_voicing) { + fvoicing = fopen(argv[hand_voicing+1],"rt"); + assert(fvoicing != NULL); + } + + bg_est = 0.0; + postfilt = switch_present("--postfilter",argc,argv); + + decimate = switch_present("--dec",argc,argv); + + /* Initialise ------------------------------------------------------------*/ + + make_analysis_window(w,W); + make_synthesis_window(Pn); + quantise_init(); + + /* Main loop ------------------------------------------------------------*/ + + frames = 0; + sum_snr = 0; + while(fread(buf,sizeof(short),N,fin)) { + frames++; + + /* Read input speech */ + + for(i=0; i<M-N; i++) + Sn[i] = Sn[i+N]; + for(i=0; i<N; i++) + Sn[i+M-N] = buf[i]; + + /* Estimate pitch */ + + nlp(nlp_states,Sn,N,M,P_MIN,P_MAX,&pitch,Sw,&prev_Wo); + prev_Wo = TWO_PI/pitch; + model.Wo = TWO_PI/pitch; + + /* estimate model parameters */ + + dft_speech(Sw, Sn, w); + two_stage_pitch_refinement(&model, Sw); + estimate_amplitudes(&model, Sw, W); + dump_Sn(Sn); dump_Sw(Sw); dump_model(&model); + + /* optional zero-phase modelling */ + + if (phase0) { + float Wn[M]; /* windowed speech samples */ + float Rk[LPC_ORD+1]; /* autocorrelation coeffs */ + + dump_phase(&model.phi[0], model.L); + + /* find aks here, these are overwritten if LPC modelling is enabled */ + + for(i=0; i<M; i++) + Wn[i] = Sn[i]*w[i]; + autocorrelate(Wn,Rk,M,LPC_ORD); + levinson_durbin(Rk,ak,LPC_ORD); + + if (lpc_model) + assert(order == LPC_ORD); + + dump_ak(ak, LPC_ORD); + + /* determine voicing */ + + snr = est_voicing_mbe(&model, Sw, W, (FS/TWO_PI)*model.Wo, Sw_); + dump_Sw_(Sw_); + dump_snr(snr); + + /* just to make sure we are not cheating - kill all phases */ + + for(i=0; i<MAX_AMP; i++) + model.phi[i] = 0; + + if (hand_voicing) { + fscanf(fvoicing,"%d\n",&model.voiced); + } + } + + /* optional LPC model amplitudes */ + + if (lpc_model) { + int lpc_correction; + float e; + float lsps[LPC_ORD]; + int lsp_indexes[LPC_ORD]; + + e = speech_to_uq_lsps(lsps, ak, Sn, w, order); + lpc_correction = need_lpc_correction(&model, ak, e); + + if (lsp) { + encode_lsps(lsp_indexes, lsps, LPC_ORD); + /* + for(i=0; i<LPC_ORD; i++) + printf("lsps[%d] = %f lsp_indexes[%d] = %d\n", + i, lsps[i], i, lsp_indexes[i]); + printf("\n"); + */ + decode_lsps(lsps, lsp_indexes, LPC_ORD); + bw_expand_lsps(lsps, LPC_ORD); + lsp_to_lpc(lsps, ak, LPC_ORD); + } + + e = decode_energy(encode_energy(e)); + model.Wo = decode_Wo(encode_Wo(model.Wo)); + + aks_to_M2(ak, order, &model, e, &snr, 1); + apply_lpc_correction(&model, lpc_correction); + sum_snr += snr; + dump_quantised_model(&model); + } + + /* option decimation to 20ms rate, which enables interpolation + routine to synthesise in between frame */ + + if (decimate) { + if (!phase0) { + printf("needs --phase0 to resample phase for interpolated Wo\n"); + exit(0); + } + + /* odd frame - interpolate */ + + if (frames%2) { + + #ifdef TEST + model.voiced = 1; + prev_model.voiced = 1; + if (fabs(prev_model.Wo - model.Wo) < 0.1*model.Wo) { + interp_model.voiced = 1; + interpolate(&interp_model, &prev_model, &model); + for(i=0; i<=interp_model.L; i++) { + interp_model.phi[i] = phi1[i]; + } + printf("interp\n"); + } + else + interp_model = tmp_model; + #endif + + interp_model.voiced = voiced1; + interpolate(&interp_model, &prev_model, &model); + + if (phase0) + phase_synth_zero_order(&interp_model, ak, ex_phase); + if (postfilt) + postfilter(&interp_model, &bg_est); + synth_one_frame(buf, &interp_model, Sn_, Pn); + if (fout != NULL) fwrite(buf,sizeof(short),N,fout); + + if (phase0) + phase_synth_zero_order(&model, ak, ex_phase); + if (postfilt) + postfilter(&model, &bg_est); + synth_one_frame(buf, &model, Sn_, Pn); + if (fout != NULL) fwrite(buf,sizeof(short),N,fout); + + prev_model = model; + } + else { + voiced1 = model.voiced; + } + } + else { + if (phase0) + phase_synth_zero_order(&model, ak, ex_phase); + if (postfilt) + postfilter(&model, &bg_est); + synth_one_frame(buf, &model, Sn_, Pn); + if (fout != NULL) fwrite(buf,sizeof(short),N,fout); + } + } + + if (fout != NULL) + fclose(fout); + + if (lpc_model) + printf("SNR av = %5.2f dB\n", sum_snr/frames); + + if (dump) + dump_off(); + + if (hand_voicing) + fclose(fvoicing); + + nlp_destroy(nlp_states); + + return 0; +} + +void synth_one_frame(short buf[], MODEL *model, float Sn_[], float Pn[]) +{ + int i; + + synthesise(Sn_, model, Pn, 1); + + for(i=0; i<N; i++) { + if (Sn_[i] > 32767.0) + buf[i] = 32767; + else if (Sn_[i] < -32767.0) + buf[i] = -32767; + else + buf[i] = Sn_[i]; + } + +} diff --git a/libs/libcodec2/src/codeall.sh b/libs/libcodec2/src/codeall.sh new file mode 100755 index 0000000..6bdf825 --- /dev/null +++ b/libs/libcodec2/src/codeall.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# codeall.sh +# David Rowe 24 sep 2009 +# Code all samples using various processing steps +./code.sh hts1a +./code.sh hts2a +./code.sh mmt1 +./code.sh morig +./code.sh forig diff --git a/libs/libcodec2/src/codebook.c b/libs/libcodec2/src/codebook.c new file mode 100644 index 0000000..74ed9ad --- /dev/null +++ b/libs/libcodec2/src/codebook.c @@ -0,0 +1,162 @@ +float codebook_lsp1[] = { + 225, + 250, + 275, + 300, + 325, + 350, + 375, + 400, + 425, + 450, + 475, + 500, + 525, + 550, + 575, + 600,0,0,0,0,0,0,0,0,0,0 +}; + +float codebook_lsp2[] = { + 325, + 350, + 375, + 400, + 425, + 450, + 475, + 500, + 525, + 550, + 575, + 600, + 625, + 650, + 675, + 700,0,0,0,0,0,0,0,0,0,0 +}; + +float codebook_lsp3[] = { + 500, + 550, + 600, + 650, + 700, + 750, + 800, + 850, + 900, + 950, + 1000, + 1050, + 1100, + 1150, + 1200, + 1250,0,0,0,0,0,0,0,0,0,0 +}; + +float codebook_lsp4[] = { + 700, + 800, + 900, + 1000, + 1100, + 1200, + 1300, + 1400, + 1500, + 1600, + 1700, + 1800, + 1900, + 2000, + 2100, + 2200,0,0,0,0,0,0,0,0,0,0 +}; + +float codebook_lsp5[] = { + 950, + 1050, + 1150, + 1250, + 1350, + 1450, + 1550, + 1650, + 1750, + 1850, + 1950, + 2050, + 2150, + 2250, + 2350, + 2450,0,0,0,0,0,0,0,0,0,0 +}; + +float codebook_lsp6[] = { + 1100, + 1200, + 1300, + 1400, + 1500, + 1600, + 1700, + 1800, + 1900, + 2000, + 2100, + 2200, + 2300, + 2400, + 2500, + 2600,0,0,0,0,0,0,0,0,0,0 +}; + +float codebook_lsp7[] = { + 1500, + 1600, + 1700, + 1800, + 1900, + 2000, + 2100, + 2200, + 2300, + 2400, + 2500, + 2600, + 2700, + 2800, + 2900, + 3000,0,0,0,0,0,0,0,0,0,0 +}; + +float codebook_lsp8[] = { + 2300, + 2400, + 2500, + 2600, + 2700, + 2800, + 2900, + 3000,0,0,0,0,0,0,0,0,0,0 +}; + +float codebook_lsp9[] = { + 2500, + 2600, + 2700, + 2800, + 2900, + 3000, + 3100, + 3200,0,0,0,0,0,0,0,0,0,0 +}; + +float codebook_lsp10[] = { + 2900, + 3100, + 3300, + 3500,0,0,0,0,0,0,0,0,0,0 +}; + diff --git a/libs/libcodec2/src/codebook.h b/libs/libcodec2/src/codebook.h new file mode 100644 index 0000000..d2e77a5 --- /dev/null +++ b/libs/libcodec2/src/codebook.h @@ -0,0 +1,15 @@ +#ifndef CODEBOOK_H +#define CODEBOOK_H + +extern float codebook_lsp1[]; +extern float codebook_lsp2[]; +extern float codebook_lsp3[]; +extern float codebook_lsp4[]; +extern float codebook_lsp5[]; +extern float codebook_lsp6[]; +extern float codebook_lsp7[]; +extern float codebook_lsp8[]; +extern float codebook_lsp9[]; +extern float codebook_lsp10[]; + +#endif diff --git a/libs/libcodec2/src/codec2.c b/libs/libcodec2/src/codec2.c new file mode 100644 index 0000000..30142fe --- /dev/null +++ b/libs/libcodec2/src/codec2.c @@ -0,0 +1,337 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: codec2.c + AUTHOR......: David Rowe + DATE CREATED: 21/8/2010 + + Codec2 fully quantised encoder and decoder functions. If you want use + codec2, the codec2_xxx functions are for you. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2010 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2.1, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <assert.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <math.h> + +#include "defines.h" +#include "sine.h" +#include "nlp.h" +#include "dump.h" +#include "lpc.h" +#include "quantise.h" +#include "phase.h" +#include "interp.h" +#include "postfilter.h" +#include "codec2.h" + +typedef struct { + float Sn[M]; /* input speech */ + float w[M]; /* time domain hamming window */ + COMP W[FFT_ENC]; /* DFT of w[] */ + float Pn[2*N]; /* trapezoidal synthesis window */ + float Sn_[2*N]; /* synthesised speech */ + float prev_Wo; /* previous frame's pitch estimate */ + float ex_phase; /* excitation model phase track */ + float bg_est; /* background noise estimate for post filter */ + MODEL prev_model; /* model parameters from 20ms ago */ + void *nlp; /* pitch predictor states */ +} CODEC2; + +/*---------------------------------------------------------------------------*\ + + FUNCTION HEADERS + +\*---------------------------------------------------------------------------*/ + +void analyse_one_frame(CODEC2 *c2, MODEL *model, short speech[]); +void synthesise_one_frame(CODEC2 *c2, short speech[], MODEL *model,float ak[]); + +/*---------------------------------------------------------------------------*\ + + FUNCTIONS + +\*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: codec2_create + AUTHOR......: David Rowe + DATE CREATED: 21/8/2010 + + Create and initialise an instance of the codec. Returns a pointer + to the codec states or NULL on failure. One set of states is + sufficient for a full duuplex codec (i.e. an encoder and decoder). + You don't need separate states for encoders and decoders. See + c2enc.c and c2dec.c for examples. + +\*---------------------------------------------------------------------------*/ + +void *codec2_create() +{ + CODEC2 *c2; + int i,l; + + c2 = (CODEC2*)malloc(sizeof(CODEC2)); + if (c2 == NULL) + return NULL; + + for(i=0; i<M; i++) + c2->Sn[i] = 1.0; + for(i=0; i<2*N; i++) + c2->Sn_[i] = 0; + make_analysis_window(c2->w,c2->W); + make_synthesis_window(c2->Pn); + quantise_init(); + c2->prev_Wo = 0.0; + c2->bg_est = 0.0; + c2->ex_phase = 0.0; + + for(l=1; l<=MAX_AMP; l++) + c2->prev_model.A[l] = 0.0; + c2->prev_model.Wo = TWO_PI/P_MAX; + + c2->nlp = nlp_create(); + if (c2->nlp == NULL) { + free (c2); + return NULL; + } + + return (void*)c2; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: codec2_create + AUTHOR......: David Rowe + DATE CREATED: 21/8/2010 + + Destroy an instance of the codec. + +\*---------------------------------------------------------------------------*/ + +void codec2_destroy(void *codec2_state) +{ + CODEC2 *c2; + + assert(codec2_state != NULL); + c2 = (CODEC2*)codec2_state; + nlp_destroy(c2->nlp); + free(codec2_state); +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: codec2_encode + AUTHOR......: David Rowe + DATE CREATED: 21/8/2010 + + Encodes 160 speech samples (20ms of speech) into 51 bits. + + The codec2 algorithm actually operates internally on 10ms (80 + sample) frames, so we run the encoding algorithm twice. On the + first frame we just send the voicing bit. One the second frame we + send all model parameters. + + The bit allocation is: + + Parameter bits/frame + -------------------------------------- + Harmonic magnitudes (LSPs) 36 + Low frequency LPC correction 1 + Energy 5 + Wo (fundamental frequnecy) 7 + Voicing (10ms update) 2 + TOTAL 51 + +\*---------------------------------------------------------------------------*/ + +void codec2_encode(void *codec2_state, unsigned char * bits, short speech[]) +{ + CODEC2 *c2; + MODEL model; + int voiced1, voiced2; + int lsp_indexes[LPC_ORD]; + int lpc_correction; + int energy_index; + int Wo_index; + int i; + unsigned int nbit = 0; + + assert(codec2_state != NULL); + c2 = (CODEC2*)codec2_state; + + /* first 10ms analysis frame - we just want voicing */ + + analyse_one_frame(c2, &model, speech); + voiced1 = model.voiced; + + /* second 10ms analysis frame */ + + analyse_one_frame(c2, &model, &speech[N]); + voiced2 = model.voiced; + + Wo_index = encode_Wo(model.Wo); + encode_amplitudes(lsp_indexes, + &lpc_correction, + &energy_index, + &model, + c2->Sn, + c2->w); + memset(bits, '\0', ((CODEC2_BITS_PER_FRAME + 7) / 8)); + pack(bits, &nbit, Wo_index, WO_BITS); + for(i=0; i<LPC_ORD; i++) { + pack(bits, &nbit, lsp_indexes[i], lsp_bits(i)); + } + pack(bits, &nbit, lpc_correction, 1); + pack(bits, &nbit, energy_index, E_BITS); + pack(bits, &nbit, voiced1, 1); + pack(bits, &nbit, voiced2, 1); + + assert(nbit == CODEC2_BITS_PER_FRAME); +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: codec2_decode + AUTHOR......: David Rowe + DATE CREATED: 21/8/2010 + + Decodes frames of 51 bits into 160 samples (20ms) of speech. + +\*---------------------------------------------------------------------------*/ + +void codec2_decode(void *codec2_state, short speech[], + const unsigned char * bits) +{ + CODEC2 *c2; + MODEL model; + int voiced1, voiced2; + int lsp_indexes[LPC_ORD]; + int lpc_correction; + int energy_index; + int Wo_index; + float ak[LPC_ORD+1]; + int i; + unsigned int nbit = 0; + MODEL model_interp; + + assert(codec2_state != NULL); + c2 = (CODEC2*)codec2_state; + + Wo_index = unpack(bits, &nbit, WO_BITS); + for(i=0; i<LPC_ORD; i++) { + lsp_indexes[i] = unpack(bits, &nbit, lsp_bits(i)); + } + lpc_correction = unpack(bits, &nbit, 1); + energy_index = unpack(bits, &nbit, E_BITS); + voiced1 = unpack(bits, &nbit, 1); + voiced2 = unpack(bits, &nbit, 1); + assert(nbit == CODEC2_BITS_PER_FRAME); + + model.Wo = decode_Wo(Wo_index); + model.L = PI/model.Wo; + decode_amplitudes(&model, + ak, + lsp_indexes, + lpc_correction, + energy_index); + + model.voiced = voiced2; + model_interp.voiced = voiced1; + interpolate(&model_interp, &c2->prev_model, &model); + + synthesise_one_frame(c2, speech, &model_interp, ak); + synthesise_one_frame(c2, &speech[N], &model, ak); + + memcpy(&c2->prev_model, &model, sizeof(MODEL)); +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: synthesise_one_frame() + AUTHOR......: David Rowe + DATE CREATED: 23/8/2010 + + Synthesise 80 speech samples (10ms) from model parameters. + +\*---------------------------------------------------------------------------*/ + +void synthesise_one_frame(CODEC2 *c2, short speech[], MODEL *model, float ak[]) +{ + int i; + + phase_synth_zero_order(model, ak, &c2->ex_phase); + postfilter(model, &c2->bg_est); + synthesise(c2->Sn_, model, c2->Pn, 1); + + for(i=0; i<N; i++) { + if (c2->Sn_[i] > 32767.0) + speech[i] = 32767; + else if (c2->Sn_[i] < -32767.0) + speech[i] = -32767; + else + speech[i] = c2->Sn_[i]; + } + +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: analyse_one_frame() + AUTHOR......: David Rowe + DATE CREATED: 23/8/2010 + + Extract sinusoidal model parameters from 80 speech samples (10ms of + speech). + +\*---------------------------------------------------------------------------*/ + +void analyse_one_frame(CODEC2 *c2, MODEL *model, short speech[]) +{ + COMP Sw[FFT_ENC]; + COMP Sw_[FFT_ENC]; + float pitch; + int i; + + /* Read input speech */ + + for(i=0; i<M-N; i++) + c2->Sn[i] = c2->Sn[i+N]; + for(i=0; i<N; i++) + c2->Sn[i+M-N] = speech[i]; + dft_speech(Sw, c2->Sn, c2->w); + + /* Estimate pitch */ + + nlp(c2->nlp,c2->Sn,N,M,P_MIN,P_MAX,&pitch,Sw,&c2->prev_Wo); + c2->prev_Wo = TWO_PI/pitch; + model->Wo = TWO_PI/pitch; + model->L = PI/model->Wo; + + /* estimate model parameters */ + + dft_speech(Sw, c2->Sn, c2->w); + two_stage_pitch_refinement(model, Sw); + estimate_amplitudes(model, Sw, c2->W); + est_voicing_mbe(model, Sw, c2->W, (FS/TWO_PI)*model->Wo, Sw_); +} diff --git a/libs/libcodec2/src/codec2.h b/libs/libcodec2/src/codec2.h new file mode 100644 index 0000000..7a1d145 --- /dev/null +++ b/libs/libcodec2/src/codec2.h @@ -0,0 +1,43 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: codec2.h + AUTHOR......: David Rowe + DATE CREATED: 21/8/2010 + + Codec2 fully quantised encoder and decoder functions. If you want use + codec2, these are the functions you need to call. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2010 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2.1, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef __CODEC2__ +#define __CODEC2__ +#include "codebook.h" + +#define CODEC2_SAMPLES_PER_FRAME 160 +#define CODEC2_BITS_PER_FRAME 51 + +void *codec2_create(); +void codec2_destroy(void *codec2_state); +void codec2_encode(void *codec2_state, unsigned char * bits, short speech_in[]); +void codec2_decode(void *codec2_state, short speech_out[], + const unsigned char * bits); + +#endif diff --git a/libs/libcodec2/src/comp.h b/libs/libcodec2/src/comp.h new file mode 100644 index 0000000..bca01b5 --- /dev/null +++ b/libs/libcodec2/src/comp.h @@ -0,0 +1,39 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: comp.h + AUTHOR......: David Rowe + DATE CREATED: 24/08/09 + + Complex number definition. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2009 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2.1, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef __COMP__ +#define __COMP__ + +/* Complex number */ + +typedef struct { + float real; + float imag; +} COMP; + +#endif diff --git a/libs/libcodec2/src/defines.h b/libs/libcodec2/src/defines.h new file mode 100644 index 0000000..ef4899f --- /dev/null +++ b/libs/libcodec2/src/defines.h @@ -0,0 +1,84 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: defines.h + AUTHOR......: David Rowe + DATE CREATED: 23/4/93 + + Defines and structures used throughout the codec. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2009 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2.1, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef __DEFINES__ +#define __DEFINES__ + +/*---------------------------------------------------------------------------*\ + + DEFINES + +\*---------------------------------------------------------------------------*/ + +/* General defines */ + +#define N 80 /* number of samples per frame */ +#define MAX_AMP 80 /* maximum number of harmonics */ +#define PI 3.141592654 /* mathematical constant */ +#define TWO_PI 6.283185307 /* mathematical constant */ +#define FS 8000 /* sample rate in Hz */ +#define MAX_STR 256 /* maximum string size */ + +#define NW 279 /* analysis window size */ +#define FFT_ENC 512 /* size of FFT used for encoder */ +#define FFT_DEC 512 /* size of FFT used in decoder */ +#define TW 40 /* Trapezoidal synthesis window overlap */ +#define V_THRESH 4.0 /* voicing threshold in dB */ +#define LPC_MAX 20 /* maximum LPC order */ +#define LPC_ORD 10 /* phase modelling LPC order */ + +/* Pitch estimation defines */ + +#define M 320 /* pitch analysis frame size */ +#define P_MIN 20 /* minimum pitch */ +#define P_MAX 160 /* maximum pitch */ + +/*---------------------------------------------------------------------------*\ + + TYPEDEFS + +\*---------------------------------------------------------------------------*/ + +/* Complex number */ + +typedef struct { + float real; + float imag; +} COMP; + +/* Structure to hold model parameters for one frame */ + +typedef struct { + float Wo; /* fundamental frequency estimate in radians */ + int L; /* number of harmonics */ + float A[MAX_AMP]; /* amplitiude of each harmonic */ + float phi[MAX_AMP]; /* phase of each harmonic */ + int voiced; /* non-zero if this frame is voiced */ +} MODEL; + +#endif diff --git a/libs/libcodec2/src/dump.c b/libs/libcodec2/src/dump.c new file mode 100644 index 0000000..2d18744 --- /dev/null +++ b/libs/libcodec2/src/dump.c @@ -0,0 +1,402 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: dump.c + AUTHOR......: David Rowe + DATE CREATED: 25/8/09 + + Routines to dump data to text files for Octave analysis. + +\*---------------------------------------------------------------------------*/ + +/* + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2.1, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "defines.h" +#include "dump.h" +#include <assert.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <math.h> + +static int dumpon = 0; + +static FILE *fsn = NULL; +static FILE *fsw = NULL; +static FILE *fsw_ = NULL; +static FILE *fmodel = NULL; +static FILE *fqmodel = NULL; +static FILE *fpw = NULL; +static FILE *flsp = NULL; +static FILE *fphase = NULL; +static FILE *fphase_ = NULL; +static FILE *ffw = NULL; +static FILE *fe = NULL; +static FILE *fsq = NULL; +static FILE *fdec = NULL; +static FILE *fsnr = NULL; +static FILE *fak = NULL; +static FILE *fbg = NULL; +static FILE *fE = NULL; + +static char prefix[MAX_STR]; + +void dump_on(char p[]) { + dumpon = 1; + strcpy(prefix, p); +} + +void dump_off(){ + if (fsn != NULL) + fclose(fsn); + if (fsw != NULL) + fclose(fsw); + if (fsw_ != NULL) + fclose(fsw_); + if (fmodel != NULL) + fclose(fmodel); + if (fqmodel != NULL) + fclose(fqmodel); + if (fpw != NULL) + fclose(fpw); + if (flsp != NULL) + fclose(flsp); + if (fphase != NULL) + fclose(fphase); + if (fphase_ != NULL) + fclose(fphase_); + if (ffw != NULL) + fclose(ffw); + if (fe != NULL) + fclose(fe); + if (fsq != NULL) + fclose(fsq); + if (fdec != NULL) + fclose(fdec); + if (fsnr != NULL) + fclose(fsnr); + if (fak != NULL) + fclose(fak); + if (fbg != NULL) + fclose(fbg); + if (fE != NULL) + fclose(fE); +} + +void dump_Sn(float Sn[]) { + int i; + char s[MAX_STR]; + + if (!dumpon) return; + + if (fsn == NULL) { + sprintf(s,"%s_sn.txt", prefix); + fsn = fopen(s, "wt"); + assert(fsn != NULL); + } + + /* split across two lines to avoid max line length problems */ + /* reconstruct in Octave */ + + for(i=0; i<M/2; i++) + fprintf(fsn,"%f\t",Sn[i]); + fprintf(fsn,"\n"); + for(i=M/2; i<M; i++) + fprintf(fsn,"%f\t",Sn[i]); + fprintf(fsn,"\n"); +} + +void dump_Sw(COMP Sw[]) { + int i; + char s[MAX_STR]; + + if (!dumpon) return; + + if (fsw == NULL) { + sprintf(s,"%s_sw.txt", prefix); + fsw = fopen(s, "wt"); + assert(fsw != NULL); + } + + for(i=0; i<FFT_ENC/2; i++) + fprintf(fsw,"%f\t", + 10.0*log10(Sw[i].real*Sw[i].real + Sw[i].imag*Sw[i].imag)); + fprintf(fsw,"\n"); +} + +void dump_Sw_(COMP Sw_[]) { + int i; + char s[MAX_STR]; + + if (!dumpon) return; + + if (fsw_ == NULL) { + sprintf(s,"%s_sw_.txt", prefix); + fsw_ = fopen(s, "wt"); + assert(fsw_ != NULL); + } + + for(i=0; i<FFT_ENC/2; i++) + fprintf(fsw_,"%f\t", + 10.0*log10(Sw_[i].real*Sw_[i].real + Sw_[i].imag*Sw_[i].imag)); + fprintf(fsw_,"\n"); +} + +void dump_model(MODEL *model) { + int l; + char s[MAX_STR]; + + if (!dumpon) return; + + if (fmodel == NULL) { + sprintf(s,"%s_model.txt", prefix); + fmodel = fopen(s, "wt"); + assert(fmodel != NULL); + } + + fprintf(fmodel,"%f\t%d\t", model->Wo, model->L); + for(l=1; l<=model->L; l++) + fprintf(fmodel,"%f\t",model->A[l]); + for(l=model->L+1; l<MAX_AMP; l++) + fprintf(fmodel,"0.0\t"); + fprintf(fmodel,"%d\t",model->voiced); + fprintf(fmodel,"\n"); +} + +void dump_quantised_model(MODEL *model) { + int l; + char s[MAX_STR]; + + if (!dumpon) return; + + if (fqmodel == NULL) { + sprintf(s,"%s_qmodel.txt", prefix); + fqmodel = fopen(s, "wt"); + assert(fqmodel != NULL); + } + + fprintf(fqmodel,"%f\t%d\t", model->Wo, model->L); + for(l=1; l<=model->L; l++) + fprintf(fqmodel,"%f\t",model->A[l]); + for(l=model->L+1; l<MAX_AMP; l++) + fprintf(fqmodel,"0.0\t"); + fprintf(fqmodel,"\n"); +} + +void dump_phase(float phase[], int L) { + int l; + char s[MAX_STR]; + + if (!dumpon) return; + + if (fphase == NULL) { + sprintf(s,"%s_phase.txt", prefix); + fphase = fopen(s, "wt"); + assert(fphase != NULL); + } + + for(l=1; l<=L; l++) + fprintf(fphase,"%f\t",phase[l]); + for(l=L+1; l<MAX_AMP; l++) + fprintf(fphase,"%f\t",0.0); + fprintf(fphase,"\n"); +} + +void dump_phase_(float phase_[], int L) { + int l; + char s[MAX_STR]; + + if (!dumpon) return; + + if (fphase_ == NULL) { + sprintf(s,"%s_phase_.txt", prefix); + fphase_ = fopen(s, "wt"); + assert(fphase_ != NULL); + } + + for(l=1; l<=L; l++) + fprintf(fphase_,"%f\t",phase_[l]); + for(l=L+1; l<MAX_AMP; l++) + fprintf(fphase_,"%f\t",0.0); + fprintf(fphase_,"\n"); +} + +void dump_snr(float snr) { + char s[MAX_STR]; + + if (!dumpon) return; + + if (fsnr == NULL) { + sprintf(s,"%s_snr.txt", prefix); + fsnr = fopen(s, "wt"); + assert(fsnr != NULL); + } + + fprintf(fsnr,"%f\n",snr); +} + +void dump_Pw(COMP Pw[]) { + int i; + char s[MAX_STR]; + + if (!dumpon) return; + + if (fpw == NULL) { + sprintf(s,"%s_pw.txt", prefix); + fpw = fopen(s, "wt"); + assert(fpw != NULL); + } + + for(i=0; i<FFT_DEC/2; i++) + fprintf(fpw,"%f\t",Pw[i].real); + fprintf(fpw,"\n"); +} + +void dump_lsp(float lsp[]) { + int i; + char s[MAX_STR]; + + if (!dumpon) return; + + if (flsp == NULL) { + sprintf(s,"%s_lsp.txt", prefix); + flsp = fopen(s, "wt"); + assert(flsp != NULL); + } + + for(i=0; i<10; i++) + fprintf(flsp,"%f\t",lsp[i]); + fprintf(flsp,"\n"); +} + +void dump_ak(float ak[], int order) { + int i; + char s[MAX_STR]; + + if (!dumpon) return; + + if (fak == NULL) { + sprintf(s,"%s_ak.txt", prefix); + fak = fopen(s, "wt"); + assert(fak != NULL); + } + + for(i=0; i<=order; i++) + fprintf(fak,"%f\t",ak[i]); + fprintf(fak,"\n"); +} + +void dump_Fw(COMP Fw[]) { + int i; + char s[MAX_STR]; + + if (!dumpon) return; + + if (ffw == NULL) { + sprintf(s,"%s_fw.txt", prefix); + ffw = fopen(s, "wt"); + assert(ffw != NULL); + } + + for(i=0; i<256; i++) + fprintf(ffw,"%f\t",Fw[i].real); + fprintf(ffw,"\n"); +} + +void dump_e(float e_hz[]) { + int i; + char s[MAX_STR]; + + if (!dumpon) return; + + if (fe == NULL) { + sprintf(s,"%s_e.txt", prefix); + fe = fopen(s, "wt"); + assert(fe != NULL); + } + + for(i=0; i<500/2; i++) + fprintf(fe,"%f\t",e_hz[i]); + fprintf(fe,"\n"); + for(i=500/2; i<500; i++) + fprintf(fe,"%f\t",e_hz[i]); + fprintf(fe,"\n"); +} + +void dump_sq(float sq[]) { + int i; + char s[MAX_STR]; + + if (!dumpon) return; + + if (fsq == NULL) { + sprintf(s,"%s_sq.txt", prefix); + fsq = fopen(s, "wt"); + assert(fsq != NULL); + } + + for(i=0; i<M/2; i++) + fprintf(fsq,"%f\t",sq[i]); + fprintf(fsq,"\n"); + for(i=M/2; i<M; i++) + fprintf(fsq,"%f\t",sq[i]); + fprintf(fsq,"\n"); +} + +void dump_dec(COMP Fw[]) { + int i; + char s[MAX_STR]; + + if (!dumpon) return; + + if (fdec == NULL) { + sprintf(s,"%s_dec.txt", prefix); + fdec = fopen(s, "wt"); + assert(fdec != NULL); + } + + for(i=0; i<320/5; i++) + fprintf(fdec,"%f\t",Fw[i].real); + fprintf(fdec,"\n"); +} + +void dump_bg(float e, float bg_est, float percent_uv) { + char s[MAX_STR]; + + if (!dumpon) return; + + if (fbg == NULL) { + sprintf(s,"%s_bg.txt", prefix); + fbg = fopen(s, "wt"); + assert(fbg != NULL); + } + + fprintf(fbg,"%f\t%f\t%f\n", e, bg_est, percent_uv); +} + +void dump_E(float E) { + char s[MAX_STR]; + + if (!dumpon) return; + + if (fE == NULL) { + sprintf(s,"%s_E.txt", prefix); + fE = fopen(s, "wt"); + assert(fE != NULL); + } + + fprintf(fE,"%f\n", 10.0*log10(E)); +} diff --git a/libs/libcodec2/src/dump.h b/libs/libcodec2/src/dump.h new file mode 100644 index 0000000..8f40225 --- /dev/null +++ b/libs/libcodec2/src/dump.h @@ -0,0 +1,63 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: dump.h + AUTHOR......: David Rowe + DATE CREATED: 25/8/09 + + Routines to dump data to text files for Octave analysis. + +\*---------------------------------------------------------------------------*/ + +/* + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2.1, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef __DUMP__ +#define __DUMP__ + +void dump_on(char filename_prefix[]); +void dump_off(); + +void dump_Sn(float Sn[]); +void dump_Sw(COMP Sw[]); +void dump_Sw_(COMP Sw_[]); + +/* amplitude modelling */ + +void dump_model(MODEL *m); +void dump_quantised_model(MODEL *m); +void dump_Pw(COMP Pw[]); +void dump_lsp(float lsp[]); +void dump_ak(float ak[], int order); +void dump_E(float E); + +/* phase modelling */ + +void dump_snr(float snr); +void dump_phase(float phase[], int L); +void dump_phase_(float phase[], int L); + +/* NLP states */ + +void dump_sq(float sq[]); +void dump_dec(COMP Fw[]); +void dump_Fw(COMP Fw[]); +void dump_e(float e_hz[]); + +/* post filter */ + +void dump_bg(float e, float bg_est, float percent_uv); + +#endif diff --git a/libs/libcodec2/src/four1.c b/libs/libcodec2/src/four1.c new file mode 100644 index 0000000..1c1ede5 --- /dev/null +++ b/libs/libcodec2/src/four1.c @@ -0,0 +1,64 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: four1.c + AUTHOR......: David Rowe + DATE CREATED: 20/2/95 + + Numerical Recipies in C FFT function. I have a nasty licence so please + replace me. + +\*---------------------------------------------------------------------------*/ + +#include <math.h> + +#define SWAP(a,b) tempr=(a);(a)=(b);(b)=tempr + +void four1(data,nn,isign) +float data[]; +int nn,isign; +{ + int n,mmax,m,j,istep,i; + double wtemp,wr,wpr,wpi,wi,theta; + float tempr,tempi; + + n=nn << 1; + j=1; + for (i=1;i<n;i+=2) { + if (j > i) { + SWAP(data[j],data[i]); + SWAP(data[j+1],data[i+1]); + } + m=n >> 1; + while (m >= 2 && j > m) { + j -= m; + m >>= 1; + } + j += m; + } + mmax=2; + while (n > mmax) { + istep=2*mmax; + theta=6.28318530717959/(isign*mmax); + wtemp=sin(0.5*theta); + wpr = -2.0*wtemp*wtemp; + wpi=sin(theta); + wr=1.0; + wi=0.0; + for (m=1;m<mmax;m+=2) { + for (i=m;i<=n;i+=istep) { + j=i+mmax; + tempr=wr*data[j]-wi*data[j+1]; + tempi=wr*data[j+1]+wi*data[j]; + data[j]=data[i]-tempr; + data[j+1]=data[i+1]-tempi; + data[i] += tempr; + data[i+1] += tempi; + } + wr=(wtemp=wr)*wpr-wi*wpi+wr; + wi=wi*wpr+wtemp*wpi+wi; + } + mmax=istep; + } +} + +#undef SWAP diff --git a/libs/libcodec2/src/four1.h b/libs/libcodec2/src/four1.h new file mode 100644 index 0000000..51d1e7f --- /dev/null +++ b/libs/libcodec2/src/four1.h @@ -0,0 +1,18 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: four1.h + AUTHOR......: David Rowe + DATE CREATED: 20/2/95 + + Numerical Recipies in C FFT function. I have a nasty licence so please + replace me. + +\*---------------------------------------------------------------------------*/ + +#ifndef __FOUR1__ +#define __FOUR1__ + +void four1(float x[], int n, int isign); + +#endif /* __FOUR1__ */ + diff --git a/libs/libcodec2/src/fq20.sh b/libs/libcodec2/src/fq20.sh new file mode 100755 index 0000000..b83784b --- /dev/null +++ b/libs/libcodec2/src/fq20.sh @@ -0,0 +1,8 @@ +#!/bin/sh +# fq20.shsh +# David Rowe 27 July 2010 +# +# Decode a file with fully quantised codec at 20ms frame rate + +../src/sinedec ../raw/$1.raw $1.mdl -o $1_phase0_lsp_20_EWo2.raw --phase 0 --lpc 10 --lsp --postfilter --dec + diff --git a/libs/libcodec2/src/globals.c b/libs/libcodec2/src/globals.c new file mode 100644 index 0000000..2e04f68 --- /dev/null +++ b/libs/libcodec2/src/globals.c @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: globals.c + AUTHOR......: David Rowe + DATE CREATED: 11/5/94 + + Globals for sinusoidal speech coder. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2009 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2.1, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "sine.h" /* global defines for coder */ + +/* Globals used in encoder and decoder */ + +int frames; /* number of frames processed so far */ +float Sn[M]; /* float input speech samples */ +MODEL model; /* model parameters for the current frame */ +int Nw; /* number of samples in analysis window */ +float sig; /* energy of current frame */ + +/* Globals used in encoder */ + +float w[M]; /* time domain hamming window */ +COMP W[FFT_ENC]; /* DFT of w[] */ +COMP Sw[FFT_ENC]; /* DFT of current frame */ + +/* Globals used in decoder */ + +COMP Sw_[FFT_ENC]; /* DFT of all voiced synthesised signal */ +float Sn_[AW_DEC]; /* synthesised speech */ +float Pn[AW_DEC]; /* time domain Parzen (trapezoidal) window */ + diff --git a/libs/libcodec2/src/globals.h b/libs/libcodec2/src/globals.h new file mode 100644 index 0000000..44aab8b --- /dev/null +++ b/libs/libcodec2/src/globals.h @@ -0,0 +1,48 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: globals.h + AUTHOR......: David Rowe + DATE CREATED: 1/11/94 + + Globals for sinusoidal speech coder. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2009 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2.1, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/* Globals used in encoder and decoder */ + +extern int frames; /* number of frames processed so far */ +extern float Sn[]; /* float input speech samples */ +extern MODEL model; /* model parameters for the current frame */ +extern int Nw; /* number of samples in analysis window */ +extern float sig; /* energy of current frame */ + +/* Globals used in encoder */ + +extern float w[]; /* time domain hamming window */ +extern COMP W[]; /* frequency domain hamming window */ +extern COMP Sw[]; /* DFT of current frame */ +extern COMP Sw_[]; /* DFT of all voiced synthesised signal */ + +/* Globals used in decoder */ + +extern float Sn_[]; /* output synthesised speech samples */ +extern float Pn[]; /* time domain Parzen (trapezoidal) window */ + diff --git a/libs/libcodec2/src/interp.c b/libs/libcodec2/src/interp.c new file mode 100644 index 0000000..ff7faac --- /dev/null +++ b/libs/libcodec2/src/interp.c @@ -0,0 +1,122 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: interp.c + AUTHOR......: David Rowe + DATE CREATED: 9/10/09 + + Interpolation of 20ms frames to 10ms frames. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2009 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2.1, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <assert.h> +#include <math.h> +#include <string.h> + +#include "defines.h" +#include "interp.h" + +float sample_log_amp(MODEL *model, float w); + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: interp() + AUTHOR......: David Rowe + DATE CREATED: 22/8/10 + + Given two frames decribed by model parameters 20ms apart, determines + the model parameters of the 10ms frame between them. Assumes + voicing is available for middle (interpolated) frame. Outputs are + amplitudes and Wo for the interpolated frame. + + This version can interpolate the amplitudes between two frames of + different Wo and L. + +\*---------------------------------------------------------------------------*/ + +void interpolate( + MODEL *interp, /* interpolated model params */ + MODEL *prev, /* previous frames model params */ + MODEL *next /* next frames model params */ +) +{ + int l; + float w,log_amp; + + /* Wo depends on voicing of this and adjacent frames */ + + if (interp->voiced) { + if (prev->voiced && next->voiced) + interp->Wo = (prev->Wo + next->Wo)/2.0; + if (!prev->voiced && next->voiced) + interp->Wo = next->Wo; + if (prev->voiced && !next->voiced) + interp->Wo = prev->Wo; + } + else { + interp->Wo = TWO_PI/P_MAX; + } + interp->L = PI/interp->Wo; + + /* Interpolate amplitudes using linear interpolation in log domain */ + + for(l=1; l<=interp->L; l++) { + w = l*interp->Wo; + log_amp = (sample_log_amp(prev, w) + sample_log_amp(next, w))/2.0; + interp->A[l] = pow(10.0, log_amp); + } +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: sample_log_amp() + AUTHOR......: David Rowe + DATE CREATED: 22/8/10 + + Samples the amplitude envelope at an arbitrary frequency w. Uses + linear interpolation in the log domain to sample between harmonic + amplitudes. + +\*---------------------------------------------------------------------------*/ + +float sample_log_amp(MODEL *model, float w) +{ + int m; + float f, log_amp; + + assert(w > 0.0); assert (w <= PI); + + m = floor(w/model->Wo + 0.5); + f = (w - m*model->Wo)/w; + assert(f <= 1.0); + + if (m < 1) { + log_amp = f*log10(model->A[1]); + } + else if ((m+1) > model->L) { + log_amp = (1.0-f)*log10(model->A[model->L]); + } + else { + log_amp = (1.0-f)*log10(model->A[m]) + f*log10(model->A[m+1]); + } + + return log_amp; +} + diff --git a/libs/libcodec2/src/interp.h b/libs/libcodec2/src/interp.h new file mode 100644 index 0000000..0684b5b --- /dev/null +++ b/libs/libcodec2/src/interp.h @@ -0,0 +1,34 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: interp.h + AUTHOR......: David Rowe + DATE CREATED: 9/10/09 + + Interpolation of 20ms frames to 10ms frames. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2009 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2.1, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef __INTERP__ +#define __INTERP__ + +void interpolate(MODEL *interp, MODEL *prev, MODEL *next); + +#endif diff --git a/libs/libcodec2/src/listen.sh b/libs/libcodec2/src/listen.sh new file mode 100644 index 0000000..bebd106 --- /dev/null +++ b/libs/libcodec2/src/listen.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# listensim.sh +# David Rowe 10 Sep 2009 +# +# Listen to files processed with sim.sh + +../script/menu.sh ../raw/$1.raw $1_uq.raw $1_phase0.raw $1_lpc10.raw $1_lsp.raw $1_phase0_lpc10.raw $1_phase0_lsp.raw $1_phase0_lsp.raw $2 $3 + + diff --git a/libs/libcodec2/src/listen1.sh b/libs/libcodec2/src/listen1.sh new file mode 100755 index 0000000..a3b7267 --- /dev/null +++ b/libs/libcodec2/src/listen1.sh @@ -0,0 +1,15 @@ +#!/bin/sh +# listen1.sh +# David Rowe 10 Sep 2009 +# +# Run menu with common sample file options, headphone version + +#../script/menu.sh ../raw/$1.raw $1_uq.raw $1_phase0.raw $1_lpc10.raw $1_lsp.raw $1_phase0_lpc10.raw $1_phase0_lsp.raw ../raw/$1_g729a.raw $2 $3 -d /dev/dsp1 + +# compare to other codecs + +#../script/menu.sh ../raw/$1.raw $1_phase0_lsp.raw $1_phase0_lsp_20.raw ../raw/$1_g729a.raw ../raw/$1_gsm13k.raw ../raw/$1_speex_8k.raw $2 $3 -d /dev/dsp1 + +../script/menu.sh ../raw/$1.raw $1_uq.raw $1_phase0.raw $1_test.raw ../raw/$1_g729a.raw $2 $3 -d /dev/dsp1 + + diff --git a/libs/libcodec2/src/listensim.sh b/libs/libcodec2/src/listensim.sh new file mode 100755 index 0000000..64f7455 --- /dev/null +++ b/libs/libcodec2/src/listensim.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# listensim.sh +# David Rowe 10 Sep 2009 +# +# Listen to files processed with sim.sh + +../script/menu.sh ../raw/$1.raw $1_uq.raw $1_phase0.raw $1_lpc10.raw $1_lsp.raw $1_phase0_lpc10.raw $1_phase0_lsp.raw $1_phase0_lsp_dec.raw $2 $3 + + diff --git a/libs/libcodec2/src/lpc.c b/libs/libcodec2/src/lpc.c new file mode 100644 index 0000000..1f9ff2b --- /dev/null +++ b/libs/libcodec2/src/lpc.c @@ -0,0 +1,253 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: lpc.c + AUTHOR......: David Rowe + DATE CREATED: 30/9/90 + + Linear Prediction functions written in C. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2009 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2.1, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#define LPC_MAX_N 512 /* maximum no. of samples in frame */ +#define PI 3.141592654 /* mathematical constant */ + +#include <assert.h> +#include <math.h> +#include "defines.h" +#include "lpc.h" + +/*---------------------------------------------------------------------------*\ + + hanning_window() + + Hanning windows a frame of speech samples. + +\*---------------------------------------------------------------------------*/ + +void hanning_window( + float Sn[], /* input frame of speech samples */ + float Wn[], /* output frame of windowed samples */ + int Nsam /* number of samples */ +) +{ + int i; /* loop variable */ + + for(i=0; i<Nsam; i++) + Wn[i] = Sn[i]*(0.5 - 0.5*cos(2*PI*(float)i/(Nsam-1))); +} + +/*---------------------------------------------------------------------------*\ + + autocorrelate() + + Finds the first P autocorrelation values of an array of windowed speech + samples Sn[]. + +\*---------------------------------------------------------------------------*/ + +void autocorrelate( + float Sn[], /* frame of Nsam windowed speech samples */ + float Rn[], /* array of P+1 autocorrelation coefficients */ + int Nsam, /* number of windowed samples to use */ + int order /* order of LPC analysis */ +) +{ + int i,j; /* loop variables */ + + for(j=0; j<order+1; j++) { + Rn[j] = 0.0; + for(i=0; i<Nsam-j; i++) + Rn[j] += Sn[i]*Sn[i+j]; + } +} + +/*---------------------------------------------------------------------------*\ + + levinson_durbin() + + Given P+1 autocorrelation coefficients, finds P Linear Prediction Coeff. + (LPCs) where P is the order of the LPC all-pole model. The Levinson-Durbin + algorithm is used, and is described in: + + J. Makhoul + "Linear prediction, a tutorial review" + Proceedings of the IEEE + Vol-63, No. 4, April 1975 + +\*---------------------------------------------------------------------------*/ + +void levinson_durbin( + float R[], /* order+1 autocorrelation coeff */ + float lpcs[], /* order+1 LPC's */ + int order /* order of the LPC analysis */ +) +{ + float E[LPC_MAX+1]; + float k[LPC_MAX+1]; + float a[LPC_MAX+1][LPC_MAX+1]; + float sum; + int i,j; /* loop variables */ + + E[0] = R[0]; /* Equation 38a, Makhoul */ + + for(i=1; i<=order; i++) { + sum = 0.0; + for(j=1; j<=i-1; j++) + sum += a[i-1][j]*R[i-j]; + k[i] = -1.0*(R[i] + sum)/E[i-1]; /* Equation 38b, Makhoul */ + if (fabs(k[i]) > 1.0) + k[i] = 0.0; + + a[i][i] = k[i]; + + for(j=1; j<=i-1; j++) + a[i][j] = a[i-1][j] + k[i]*a[i-1][i-j]; /* Equation 38c, Makhoul */ + + E[i] = (1-k[i]*k[i])*E[i-1]; /* Equation 38d, Makhoul */ + } + + for(i=1; i<=order; i++) + lpcs[i] = a[order][i]; + lpcs[0] = 1.0; +} + +/*---------------------------------------------------------------------------*\ + + inverse_filter() + + Inverse Filter, A(z). Produces an array of residual samples from an array + of input samples and linear prediction coefficients. + + The filter memory is stored in the first order samples of the input array. + +\*---------------------------------------------------------------------------*/ + +void inverse_filter( + float Sn[], /* Nsam input samples */ + float a[], /* LPCs for this frame of samples */ + int Nsam, /* number of samples */ + float res[], /* Nsam residual samples */ + int order /* order of LPC */ +) +{ + int i,j; /* loop variables */ + + for(i=0; i<Nsam; i++) { + res[i] = 0.0; + for(j=0; j<=order; j++) + res[i] += Sn[i-j]*a[j]; + } +} + +/*---------------------------------------------------------------------------*\ + + synthesis_filter() + + C version of the Speech Synthesis Filter, 1/A(z). Given an array of + residual or excitation samples, and the the LP filter coefficients, this + function will produce an array of speech samples. This filter structure is + IIR. + + The synthesis filter has memory as well, this is treated in the same way + as the memory for the inverse filter (see inverse_filter() notes above). + The difference is that the memory for the synthesis filter is stored in + the output array, wheras the memory of the inverse filter is stored in the + input array. + + Note: the calling function must update the filter memory. + +\*---------------------------------------------------------------------------*/ + +void synthesis_filter( + float res[], /* Nsam input residual (excitation) samples */ + float a[], /* LPCs for this frame of speech samples */ + int Nsam, /* number of speech samples */ + int order, /* LPC order */ + float Sn_[] /* Nsam output synthesised speech samples */ +) +{ + int i,j; /* loop variables */ + + /* Filter Nsam samples */ + + for(i=0; i<Nsam; i++) { + Sn_[i] = res[i]*a[0]; + for(j=1; j<=order; j++) + Sn_[i] -= Sn_[i-j]*a[j]; + } +} + +/*---------------------------------------------------------------------------*\ + + find_aks() + + This function takes a frame of samples, and determines the linear + prediction coefficients for that frame of samples. + +\*---------------------------------------------------------------------------*/ + +void find_aks( + float Sn[], /* Nsam samples with order sample memory */ + float a[], /* order+1 LPCs with first coeff 1.0 */ + int Nsam, /* number of input speech samples */ + int order, /* order of the LPC analysis */ + float *E /* residual energy */ +) +{ + float Wn[LPC_MAX_N]; /* windowed frame of Nsam speech samples */ + float R[LPC_MAX+1]; /* order+1 autocorrelation values of Sn[] */ + int i; + + assert(order < LPC_MAX); + assert(Nsam < LPC_MAX_N); + + hanning_window(Sn,Wn,Nsam); + autocorrelate(Wn,R,Nsam,order); + levinson_durbin(R,a,order); + + *E = 0.0; + for(i=0; i<=order; i++) + *E += a[i]*R[i]; + if (*E < 0.0) + *E = 1E-12; +} + +/*---------------------------------------------------------------------------*\ + + weight() + + Weights a vector of LPCs. + +\*---------------------------------------------------------------------------*/ + +void weight( + float ak[], /* vector of order+1 LPCs */ + float gamma, /* weighting factor */ + int order, /* num LPCs (excluding leading 1.0) */ + float akw[] /* weighted vector of order+1 LPCs */ +) +{ + int i; + + for(i=1; i<=order; i++) + akw[i] = ak[i]*pow(gamma,(float)i); +} + diff --git a/libs/libcodec2/src/lpc.h b/libs/libcodec2/src/lpc.h new file mode 100644 index 0000000..e9b42ae --- /dev/null +++ b/libs/libcodec2/src/lpc.h @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: lpc.h + AUTHOR......: David Rowe + DATE CREATED: 24/8/09 + + Linear Prediction functions written in C. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2009 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2.1, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef __LPC__ +#define __LPC__ + +#define LPC_MAX_ORDER 20 + +void hanning_window(float Sn[], float Wn[], int Nsam); +void autocorrelate(float Sn[], float Rn[], int Nsam, int order); +void levinson_durbin(float R[], float lpcs[], int order); +void inverse_filter(float Sn[], float a[], int Nsam, float res[], int order); +void synthesis_filter(float res[], float a[], int Nsam, int order, float Sn_[]); +void find_aks(float Sn[], float a[], int Nsam, int order, float *E); +void weight(float ak[], float gamma, int order, float akw[]); + +#endif diff --git a/libs/libcodec2/src/lsp.c b/libs/libcodec2/src/lsp.c new file mode 100644 index 0000000..feab421 --- /dev/null +++ b/libs/libcodec2/src/lsp.c @@ -0,0 +1,323 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: lsp.c + AUTHOR......: David Rowe + DATE CREATED: 24/2/93 + + + This file contains functions for LPC to LSP conversion and LSP to + LPC conversion. Note that the LSP coefficients are not in radians + format but in the x domain of the unit circle. + +\*---------------------------------------------------------------------------*/ + +#include "defines.h" +#include "lsp.h" +#include <math.h> +#include <stdio.h> +#include <stdlib.h> + +/*---------------------------------------------------------------------------*\ + + Introduction to Line Spectrum Pairs (LSPs) + ------------------------------------------ + + LSPs are used to encode the LPC filter coefficients {ak} for + transmission over the channel. LSPs have several properties (like + less sensitivity to quantisation noise) that make them superior to + direct quantisation of {ak}. + + A(z) is a polynomial of order lpcrdr with {ak} as the coefficients. + + A(z) is transformed to P(z) and Q(z) (using a substitution and some + algebra), to obtain something like: + + A(z) = 0.5[P(z)(z+z^-1) + Q(z)(z-z^-1)] (1) + + As you can imagine A(z) has complex zeros all over the z-plane. P(z) + and Q(z) have the very neat property of only having zeros _on_ the + unit circle. So to find them we take a test point z=exp(jw) and + evaluate P (exp(jw)) and Q(exp(jw)) using a grid of points between 0 + and pi. + + The zeros (roots) of P(z) also happen to alternate, which is why we + swap coefficients as we find roots. So the process of finding the + LSP frequencies is basically finding the roots of 5th order + polynomials. + + The root so P(z) and Q(z) occur in symmetrical pairs at +/-w, hence + the name Line Spectrum Pairs (LSPs). + + To convert back to ak we just evaluate (1), "clocking" an impulse + thru it lpcrdr times gives us the impulse response of A(z) which is + {ak}. + +\*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: cheb_poly_eva() + AUTHOR......: David Rowe + DATE CREATED: 24/2/93 + + This function evalutes a series of chebyshev polynomials + + FIXME: performing memory allocation at run time is very inefficient, + replace with stack variables of MAX_P size. + +\*---------------------------------------------------------------------------*/ + + +float cheb_poly_eva(float *coef,float x,int m) +/* float coef[] coefficients of the polynomial to be evaluated */ +/* float x the point where polynomial is to be evaluated */ +/* int m order of the polynomial */ +{ + int i; + float *T,*t,*u,*v,sum; + + /* Allocate memory for chebyshev series formulation */ + + if((T = (float *)malloc((m/2+1)*sizeof(float))) == NULL){ + fprintf(stderr, "not enough memory to allocate buffer\n"); + exit(1); + } + + /* Initialise pointers */ + + t = T; /* T[i-2] */ + *t++ = 1.0; + u = t--; /* T[i-1] */ + *u++ = x; + v = u--; /* T[i] */ + + /* Evaluate chebyshev series formulation using iterative approach */ + + for(i=2;i<=m/2;i++) + *v++ = (2*x)*(*u++) - *t++; /* T[i] = 2*x*T[i-1] - T[i-2] */ + + sum=0.0; /* initialise sum to zero */ + t = T; /* reset pointer */ + + /* Evaluate polynomial and return value also free memory space */ + + for(i=0;i<=m/2;i++) + sum+=coef[(m/2)-i]**t++; + + free(T); + return sum; +} + + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: lpc_to_lsp() + AUTHOR......: David Rowe + DATE CREATED: 24/2/93 + + This function converts LPC coefficients to LSP coefficients. + +\*---------------------------------------------------------------------------*/ + +int lpc_to_lsp (float *a, int lpcrdr, float *freq, int nb, float delta) +/* float *a lpc coefficients */ +/* int lpcrdr order of LPC coefficients (10) */ +/* float *freq LSP frequencies in radians */ +/* int nb number of sub-intervals (4) */ +/* float delta grid spacing interval (0.02) */ +{ + float psuml,psumr,psumm,temp_xr,xl,xr,xm; + float temp_psumr; + int i,j,m,flag,k; + float *Q; /* ptrs for memory allocation */ + float *P; + float *px; /* ptrs of respective P'(z) & Q'(z) */ + float *qx; + float *p; + float *q; + float *pt; /* ptr used for cheb_poly_eval() + whether P' or Q' */ + int roots=0; /* number of roots found */ + flag = 1; + m = lpcrdr/2; /* order of P'(z) & Q'(z) polynimials */ + + /* Allocate memory space for polynomials */ + + Q = (float *) malloc((m+1)*sizeof(float)); + P = (float *) malloc((m+1)*sizeof(float)); + if( (P == NULL) || (Q == NULL) ) { + fprintf(stderr,"not enough memory to allocate buffer\n"); + exit(1); + } + + /* determine P'(z)'s and Q'(z)'s coefficients where + P'(z) = P(z)/(1 + z^(-1)) and Q'(z) = Q(z)/(1-z^(-1)) */ + + px = P; /* initilaise ptrs */ + qx = Q; + p = px; + q = qx; + *px++ = 1.0; + *qx++ = 1.0; + for(i=1;i<=m;i++){ + *px++ = a[i]+a[lpcrdr+1-i]-*p++; + *qx++ = a[i]-a[lpcrdr+1-i]+*q++; + } + px = P; + qx = Q; + for(i=0;i<m;i++){ + *px = 2**px; + *qx = 2**qx; + px++; + qx++; + } + px = P; /* re-initialise ptrs */ + qx = Q; + + /* Search for a zero in P'(z) polynomial first and then alternate to Q'(z). + Keep alternating between the two polynomials as each zero is found */ + + xr = 0; /* initialise xr to zero */ + xl = 1.0; /* start at point xl = 1 */ + + + for(j=0;j<lpcrdr;j++){ + if(j%2) /* determines whether P' or Q' is eval. */ + pt = qx; + else + pt = px; + + psuml = cheb_poly_eva(pt,xl,lpcrdr); /* evals poly. at xl */ + flag = 1; + while(flag && (xr >= -1.0)){ + xr = xl - delta ; /* interval spacing */ + psumr = cheb_poly_eva(pt,xr,lpcrdr);/* poly(xl-delta_x) */ + temp_psumr = psumr; + temp_xr = xr; + + /* if no sign change increment xr and re-evaluate + poly(xr). Repeat til sign change. if a sign change has + occurred the interval is bisected and then checked again + for a sign change which determines in which interval the + zero lies in. If there is no sign change between poly(xm) + and poly(xl) set interval between xm and xr else set + interval between xl and xr and repeat till root is located + within the specified limits */ + + if((psumr*psuml)<0.0){ + roots++; + + psumm=psuml; + for(k=0;k<=nb;k++){ + xm = (xl+xr)/2; /* bisect the interval */ + psumm=cheb_poly_eva(pt,xm,lpcrdr); + if(psumm*psuml>0.){ + psuml=psumm; + xl=xm; + } + else{ + psumr=psumm; + xr=xm; + } + } + + /* once zero is found, reset initial interval to xr */ + freq[j] = (xm); + xl = xm; + flag = 0; /* reset flag for next search */ + } + else{ + psuml=temp_psumr; + xl=temp_xr; + } + } + } + free(P); /* free memory space */ + free(Q); + + /* convert from x domain to radians */ + + for(i=0; i<lpcrdr; i++) { + freq[i] = acos(freq[i]); + } + + return(roots); +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: lsp_to_lpc() + AUTHOR......: David Rowe + DATE CREATED: 24/2/93 + + This function converts LSP coefficients to LPC coefficients. In the + Speex code we worked out a wayto simplify this significantly. + +\*---------------------------------------------------------------------------*/ + +void lsp_to_lpc(float *freq, float *ak, int lpcrdr) +/* float *freq array of LSP frequencies in radians */ +/* float *ak array of LPC coefficients */ +/* int lpcrdr order of LPC coefficients */ + + +{ + int i,j; + float xout1,xout2,xin1,xin2; + float *Wp; + float *pw,*n1,*n2,*n3,*n4; + int m = lpcrdr/2; + + /* convert from radians to the x=cos(w) domain */ + + for(i=0; i<lpcrdr; i++) + freq[i] = cos(freq[i]); + + if((Wp = (float *) malloc((4*m+2)*sizeof(float))) == NULL){ + printf("not enough memory to allocate buffer\n"); + exit(1); + } + pw = Wp; + + /* initialise contents of array */ + + for(i=0;i<=4*m+1;i++){ /* set contents of buffer to 0 */ + *pw++ = 0.0; + } + + /* Set pointers up */ + + pw = Wp; + xin1 = 1.0; + xin2 = 1.0; + + /* reconstruct P(z) and Q(z) by cascading second order polynomials + in form 1 - 2xz(-1) +z(-2), where x is the LSP coefficient */ + + for(j=0;j<=lpcrdr;j++){ + for(i=0;i<m;i++){ + n1 = pw+(i*4); + n2 = n1 + 1; + n3 = n2 + 1; + n4 = n3 + 1; + xout1 = xin1 - 2*(freq[2*i]) * *n1 + *n2; + xout2 = xin2 - 2*(freq[2*i+1]) * *n3 + *n4; + *n2 = *n1; + *n4 = *n3; + *n1 = xin1; + *n3 = xin2; + xin1 = xout1; + xin2 = xout2; + } + xout1 = xin1 + *(n4+1); + xout2 = xin2 - *(n4+2); + ak[j] = (xout1 + xout2)*0.5; + *(n4+1) = xin1; + *(n4+2) = xin2; + + xin1 = 0.0; + xin2 = 0.0; + } + free(Wp); +} + diff --git a/libs/libcodec2/src/lsp.h b/libs/libcodec2/src/lsp.h new file mode 100644 index 0000000..88eae7e --- /dev/null +++ b/libs/libcodec2/src/lsp.h @@ -0,0 +1,20 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: lsp.c + AUTHOR......: David Rowe + DATE CREATED: 24/2/93 + + + This file contains functions for LPC to LSP conversion and LSP to + LPC conversion. Note that the LSP coefficients are not in radians + format but in the x domain of the unit circle. + +\*---------------------------------------------------------------------------*/ + +#ifndef __LSP__ +#define __LSP__ + +int lpc_to_lsp (float *a, int lpcrdr, float *freq, int nb, float delta); +void lsp_to_lpc(float *freq, float *ak, int lpcrdr); + +#endif diff --git a/libs/libcodec2/src/nlp.c b/libs/libcodec2/src/nlp.c new file mode 100644 index 0000000..193ca92 --- /dev/null +++ b/libs/libcodec2/src/nlp.c @@ -0,0 +1,361 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: nlp.c + AUTHOR......: David Rowe + DATE CREATED: 23/3/93 + + Non Linear Pitch (NLP) estimation functions. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2009 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2.1, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "defines.h" +#include "nlp.h" +#include "dump.h" +#include "four1.h" + +#include <assert.h> +#include <math.h> +#include <stdlib.h> + +/*---------------------------------------------------------------------------*\ + + DEFINES + +\*---------------------------------------------------------------------------*/ + +#define PMAX_M 600 /* maximum NLP analysis window size */ +#define COEFF 0.95 /* notch filter parameter */ +#define PE_FFT_SIZE 512 /* DFT size for pitch estimation */ +#define DEC 5 /* decimation factor */ +#define SAMPLE_RATE 8000 +#define PI 3.141592654 /* mathematical constant */ +#define T 0.1 /* threshold for local minima candidate */ +#define F0_MAX 500 +#define CNLP 0.3 /* post processor constant */ +#define NLP_NTAP 48 /* Decimation LPF order */ + +/*---------------------------------------------------------------------------*\ + + GLOBALS + +\*---------------------------------------------------------------------------*/ + +/* 48 tap 600Hz low pass FIR filter coefficients */ + +float nlp_fir[] = { + -1.0818124e-03, + -1.1008344e-03, + -9.2768838e-04, + -4.2289438e-04, + 5.5034190e-04, + 2.0029849e-03, + 3.7058509e-03, + 5.1449415e-03, + 5.5924666e-03, + 4.3036754e-03, + 8.0284511e-04, + -4.8204610e-03, + -1.1705810e-02, + -1.8199275e-02, + -2.2065282e-02, + -2.0920610e-02, + -1.2808831e-02, + 3.2204775e-03, + 2.6683811e-02, + 5.5520624e-02, + 8.6305944e-02, + 1.1480192e-01, + 1.3674206e-01, + 1.4867556e-01, + 1.4867556e-01, + 1.3674206e-01, + 1.1480192e-01, + 8.6305944e-02, + 5.5520624e-02, + 2.6683811e-02, + 3.2204775e-03, + -1.2808831e-02, + -2.0920610e-02, + -2.2065282e-02, + -1.8199275e-02, + -1.1705810e-02, + -4.8204610e-03, + 8.0284511e-04, + 4.3036754e-03, + 5.5924666e-03, + 5.1449415e-03, + 3.7058509e-03, + 2.0029849e-03, + 5.5034190e-04, + -4.2289438e-04, + -9.2768838e-04, + -1.1008344e-03, + -1.0818124e-03 +}; + +typedef struct { + float sq[PMAX_M]; /* squared speech samples */ + float mem_x,mem_y; /* memory for notch filter */ + float mem_fir[NLP_NTAP]; /* decimation FIR filter memory */ +} NLP; + +float post_process_mbe(COMP Fw[], int pmin, int pmax, float gmax); +float post_process_sub_multiples(COMP Fw[], + int pmin, int pmax, float gmax, int gmax_bin, + float *prev_Wo); + +/*---------------------------------------------------------------------------*\ + + nlp_create() + + Initialisation function for NLP pitch estimator. + +\*---------------------------------------------------------------------------*/ + +void *nlp_create() +{ + NLP *nlp; + int i; + + nlp = (NLP*)malloc(sizeof(NLP)); + if (nlp == NULL) + return NULL; + + for(i=0; i<PMAX_M; i++) + nlp->sq[i] = 0.0; + nlp->mem_x = 0.0; + nlp->mem_y = 0.0; + for(i=0; i<NLP_NTAP; i++) + nlp->mem_fir[i] = 0.0; + + return (void*)nlp; +} + +/*---------------------------------------------------------------------------*\ + + nlp_destory() + + Initialisation function for NLP pitch estimator. + +\*---------------------------------------------------------------------------*/ + +void nlp_destroy(void *nlp_state) +{ + assert(nlp_state != NULL); + free(nlp_state); +} + +/*---------------------------------------------------------------------------*\ + + nlp() + + Determines the pitch in samples using the Non Linear Pitch (NLP) + algorithm [1]. Returns the fundamental in Hz. Note that the actual + pitch estimate is for the centre of the M sample Sn[] vector, not + the current N sample input vector. This is (I think) a delay of 2.5 + frames with N=80 samples. You should align further analysis using + this pitch estimate to be centred on the middle of Sn[]. + + Two post processors have been tried, the MBE version (as discussed + in [1]), and a post processor that checks sub-multiples. Both + suffer occasional gross pitch errors (i.e. neither are perfect). In + the presence of background noise the sub-multiple algorithm tends + towards low F0 which leads to better sounding background noise than + the MBE post processor. + + A good way to test and develop the NLP pitch estimator is using the + tnlp (codec2/unittest) and the codec2/octave/plnlp.m Octave script. + + A pitch tracker searching a few frames forward and backward in time + would be a useful addition. + + References: + + [1] http://www.itr.unisa.edu.au/~steven/thesis/dgr.pdf Chapter 4 + +\*---------------------------------------------------------------------------*/ + +float nlp( + void *nlp_state, + float Sn[], /* input speech vector */ + int n, /* frames shift (no. new samples in Sn[]) */ + int m, /* analysis window size */ + int pmin, /* minimum pitch value */ + int pmax, /* maximum pitch value */ + float *pitch, /* estimated pitch period in samples */ + COMP Sw[], /* Freq domain version of Sn[] */ + float *prev_Wo +) +{ + NLP *nlp; + float notch; /* current notch filter output */ + COMP Fw[PE_FFT_SIZE]; /* DFT of squared signal */ + float gmax; + int gmax_bin; + int i,j; + float best_f0; + + assert(nlp_state != NULL); + nlp = (NLP*)nlp_state; + + /* Square, notch filter at DC, and LP filter vector */ + + for(i=m-n; i<M; i++) /* square latest speech samples */ + nlp->sq[i] = Sn[i]*Sn[i]; + + for(i=m-n; i<m; i++) { /* notch filter at DC */ + notch = nlp->sq[i] - nlp->mem_x; + notch += COEFF*nlp->mem_y; + nlp->mem_x = nlp->sq[i]; + nlp->mem_y = notch; + nlp->sq[i] = notch; + } + + for(i=m-n; i<m; i++) { /* FIR filter vector */ + + for(j=0; j<NLP_NTAP-1; j++) + nlp->mem_fir[j] = nlp->mem_fir[j+1]; + nlp->mem_fir[NLP_NTAP-1] = nlp->sq[i]; + + nlp->sq[i] = 0.0; + for(j=0; j<NLP_NTAP; j++) + nlp->sq[i] += nlp->mem_fir[j]*nlp_fir[j]; + } + + /* Decimate and DFT */ + + for(i=0; i<PE_FFT_SIZE; i++) { + Fw[i].real = 0.0; + Fw[i].imag = 0.0; + } + for(i=0; i<m/DEC; i++) { + Fw[i].real = nlp->sq[i*DEC]*(0.5 - 0.5*cos(2*PI*i/(m/DEC-1))); + } + dump_dec(Fw); + four1(&Fw[-1].imag,PE_FFT_SIZE,1); + for(i=0; i<PE_FFT_SIZE; i++) + Fw[i].real = Fw[i].real*Fw[i].real + Fw[i].imag*Fw[i].imag; + + dump_sq(nlp->sq); + dump_Fw(Fw); + + /* find global peak */ + + gmax = 0.0; + gmax_bin = PE_FFT_SIZE*DEC/pmax; + for(i=PE_FFT_SIZE*DEC/pmax; i<=PE_FFT_SIZE*DEC/pmin; i++) { + if (Fw[i].real > gmax) { + gmax = Fw[i].real; + gmax_bin = i; + } + } + + best_f0 = post_process_sub_multiples(Fw, pmin, pmax, gmax, gmax_bin, + prev_Wo); + + /* Shift samples in buffer to make room for new samples */ + + for(i=0; i<m-n; i++) + nlp->sq[i] = nlp->sq[i+n]; + + /* return pitch and F0 estimate */ + + *pitch = (float)SAMPLE_RATE/best_f0; + return(best_f0); +} + +/*---------------------------------------------------------------------------*\ + + post_process_sub_multiples() + + Given the global maximma of Fw[] we search interger submultiples for + local maxima. If local maxima exist and they are above an + experimentally derived threshold (OK a magic number I pulled out of + the air) we choose the submultiple as the F0 estimate. + + The rational for this is that the lowest frequency peak of Fw[] + should be F0, as Fw[] can be considered the autocorrelation function + of Sw[] (the speech spectrum). However sometimes due to phase + effects the lowest frequency maxima may not be the global maxima. + + This works OK in practice and favours low F0 values in the presence + of background noise which means the sinusoidal codec does an OK job + of synthesising the background noise. High F0 in background noise + tends to sound more periodic introducing annoying artifacts. + +\*---------------------------------------------------------------------------*/ + +float post_process_sub_multiples(COMP Fw[], + int pmin, int pmax, float gmax, int gmax_bin, + float *prev_Wo) +{ + int min_bin, cmax_bin; + int mult; + float thresh, best_f0; + int b, bmin, bmax, lmax_bin; + float lmax, cmax; + int prev_f0_bin; + + /* post process estimate by searching submultiples */ + + mult = 2; + min_bin = PE_FFT_SIZE*DEC/pmax; + cmax_bin = gmax_bin; + prev_f0_bin = *prev_Wo*(4000.0/PI)*(PE_FFT_SIZE*DEC)/SAMPLE_RATE; + + while(gmax_bin/mult >= min_bin) { + + b = gmax_bin/mult; /* determine search interval */ + bmin = 0.8*b; + bmax = 1.2*b; + if (bmin < min_bin) + bmin = min_bin; + + /* lower threshold to favour previous frames pitch estimate, + this is a form of pitch tracking */ + + if ((prev_f0_bin > bmin) && (prev_f0_bin < bmax)) + thresh = CNLP*0.5*gmax; + else + thresh = CNLP*gmax; + + lmax = 0; + lmax_bin = bmin; + for (b=bmin; b<=bmax; b++) /* look for maximum in interval */ + if (Fw[b].real > lmax) { + lmax = Fw[b].real; + lmax_bin = b; + } + + if (lmax > thresh) + if ((lmax > Fw[lmax_bin-1].real) && (lmax > Fw[lmax_bin+1].real)) { + cmax = lmax; + cmax_bin = lmax_bin; + } + + mult++; + } + + best_f0 = (float)cmax_bin*SAMPLE_RATE/(PE_FFT_SIZE*DEC); + + return best_f0; +} + diff --git a/libs/libcodec2/src/nlp.h b/libs/libcodec2/src/nlp.h new file mode 100644 index 0000000..eaaae97 --- /dev/null +++ b/libs/libcodec2/src/nlp.h @@ -0,0 +1,38 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: nlp.c + AUTHOR......: David Rowe + DATE CREATED: 23/3/93 + + Non Linear Pitch (NLP) estimation functions. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2009 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2.1, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef __NLP__ +#define __NLP__ + +void *nlp_create(); +void nlp_destroy(void *nlp_state); +float nlp(void *nlp_state, float Sn[], int n, int m, int pmin, int pmax, + float *pitch, COMP Sw[], float *prev_Wo); +float test_candidate_mbe(COMP Sw[], float f0, COMP Sw_[]); + +#endif diff --git a/libs/libcodec2/src/pack.c b/libs/libcodec2/src/pack.c new file mode 100644 index 0000000..2cbff44 --- /dev/null +++ b/libs/libcodec2/src/pack.c @@ -0,0 +1,104 @@ +/* + Copyright (C) 2010 Perens LLC <bruce@perens.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 3 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, see <http://www.gnu.org/licenses/>. + + */ +#include "defines.h" +#include "quantise.h" +#include <stdio.h> + +/* Compile-time constants */ +/* Size of unsigned char in bits. Assumes 8 bits-per-char. */ +static const unsigned int WordSize = 8; + +/* Mask to pick the bit component out of bitIndex. */ +static const unsigned int IndexMask = 0x7; + +/* Used to pick the word component out of bitIndex. */ +static const unsigned int ShiftRight = 3; + +/** Pack a bit field into a bit string, encoding the field in Gray code. + * + * The output is an array of unsigned char data. The fields are efficiently + * packed into the bit string. The Gray coding is a naive attempt to reduce + * the effect of single-bit errors, we expect to do a better job as the + * codec develops. + * + * This code would be simpler if it just set one bit at a time in the string, + * but would hit the same cache line more often. I'm not sure the complexity + * gains us anything here. + * + * Although field is currently of int type rather than unsigned for + * compatibility with the rest of the code, indices are always expected to + * be >= 0. + */ +void +pack( + unsigned char * bitArray, /* The output bit string. */ + unsigned int * bitIndex, /* Index into the string in BITS, not bytes.*/ + int field, /* The bit field to be packed. */ + unsigned int fieldWidth/* Width of the field in BITS, not bytes. */ + ) +{ + /* Convert the field to Gray code */ + field = (field >> 1) ^ field; + + do { + unsigned int bI = *bitIndex; + unsigned int bitsLeft = WordSize - (bI & IndexMask); + unsigned int sliceWidth = + bitsLeft < fieldWidth ? bitsLeft : fieldWidth; + unsigned int wordIndex = bI >> ShiftRight; + + bitArray[wordIndex] |= + ((unsigned char)((field >> (fieldWidth - sliceWidth)) + << (bitsLeft - sliceWidth))); + + *bitIndex = bI + sliceWidth; + fieldWidth -= sliceWidth; + } while ( fieldWidth != 0 ); +} + +/** Unpack a field from a bit string, converting from Gray code to binary. + * + */ +int +unpack( + const unsigned char * bitArray, /* The input bit string. */ + unsigned int * bitIndex, /* Index into the string in BITS, not bytes.*/ + unsigned int fieldWidth/* Width of the field in BITS, not bytes. */ + ) +{ + unsigned int field = 0; + + do { + unsigned int bI = *bitIndex; + unsigned int bitsLeft = WordSize - (bI & IndexMask); + unsigned int sliceWidth = + bitsLeft < fieldWidth ? bitsLeft : fieldWidth; + + field |= (((bitArray[bI >> ShiftRight] >> (bitsLeft - sliceWidth)) & ((1 << sliceWidth) - 1)) << (fieldWidth - sliceWidth)); + + *bitIndex = bI + sliceWidth; + fieldWidth -= sliceWidth; + } while ( fieldWidth != 0 ); + + /* Convert from Gray code to binary. Works for maximum 8-bit fields. */ + unsigned int t = field ^ (field >> 8); + t ^= (t >> 4); + t ^= (t >> 2); + t ^= (t >> 1); + return t; +} diff --git a/libs/libcodec2/src/phase.c b/libs/libcodec2/src/phase.c new file mode 100644 index 0000000..83fd680 --- /dev/null +++ b/libs/libcodec2/src/phase.c @@ -0,0 +1,254 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: phase.c + AUTHOR......: David Rowe + DATE CREATED: 1/2/09 + + Functions for modelling and synthesising phase. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2009 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2.1, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "defines.h" +#include "phase.h" +#include "four1.h" + +#include <assert.h> +#include <math.h> +#include <string.h> +#include <stdlib.h> + +#define VTHRESH 4.0 + +/*---------------------------------------------------------------------------*\ + + aks_to_H() + + Samples the complex LPC synthesis filter spectrum at the harmonic + frequencies. + +\*---------------------------------------------------------------------------*/ + +void aks_to_H( + MODEL *model, /* model parameters */ + float aks[], /* LPC's */ + float G, /* energy term */ + COMP H[], /* complex LPC spectral samples */ + int order +) +{ + COMP Pw[FFT_DEC]; /* power spectrum */ + int i,m; /* loop variables */ + int am,bm; /* limits of current band */ + float r; /* no. rads/bin */ + float Em; /* energy in band */ + float Am; /* spectral amplitude sample */ + int b; /* centre bin of harmonic */ + float phi_; /* phase of LPC spectra */ + + r = TWO_PI/(FFT_DEC); + + /* Determine DFT of A(exp(jw)) ------------------------------------------*/ + + for(i=0; i<FFT_DEC; i++) { + Pw[i].real = 0.0; + Pw[i].imag = 0.0; + } + + for(i=0; i<=order; i++) + Pw[i].real = aks[i]; + + four1(&Pw[-1].imag,FFT_DEC,-1); + + /* Sample magnitude and phase at harmonics */ + + for(m=1; m<=model->L; m++) { + am = floor((m - 0.5)*model->Wo/r + 0.5); + bm = floor((m + 0.5)*model->Wo/r + 0.5); + b = floor(m*model->Wo/r + 0.5); + + Em = 0.0; + for(i=am; i<bm; i++) + Em += G/(Pw[i].real*Pw[i].real + Pw[i].imag*Pw[i].imag); + Am = sqrt(fabs(Em/(bm-am))); + + phi_ = -atan2(Pw[b].imag,Pw[b].real); + H[m].real = Am*cos(phi_); + H[m].imag = Am*sin(phi_); + } +} + + +/*---------------------------------------------------------------------------*\ + + phase_synth_zero_order() + + Synthesises phases based on SNR and a rule based approach. No phase + parameters are required apart from the SNR (which can be reduced to a + 1 bit V/UV decision per frame). + + The phase of each harmonic is modelled as the phase of a LPC + synthesis filter excited by an impulse. Unlike the first order + model the position of the impulse is not transmitted, so we create + an excitation pulse train using a rule based approach. + + Consider a pulse train with a pulse starting time n=0, with pulses + repeated at a rate of Wo, the fundamental frequency. A pulse train + in the time domain is equivalent to harmonics in the frequency + domain. We can make an excitation pulse train using a sum of + sinsusoids: + + for(m=1; m<=L; m++) + ex[n] = cos(m*Wo*n) + + Note: the Octave script ../octave/phase.m is an example of this if + you would like to try making a pulse train. + + The phase of each excitation harmonic is: + + arg(E[m]) = mWo + + where E[m] are the complex excitation (freq domain) samples, + arg(x), just returns the phase of a complex sample x. + + As we don't transmit the pulse position for this model, we need to + synthesise it. Now the excitation pulses occur at a rate of Wo. + This means the phase of the first harmonic advances by N samples + over a synthesis frame of N samples. For example if Wo is pi/20 + (200 Hz), then over a 10ms frame (N=80 samples), the phase of the + first harmonic would advance (pi/20)*80 = 4*pi or two complete + cycles. + + We generate the excitation phase of the fundamental (first + harmonic): + + arg[E[1]] = Wo*N; + + We then relate the phase of the m-th excitation harmonic to the + phase of the fundamental as: + + arg(E[m]) = m*arg(E[1]) + + This E[m] then gets passed through the LPC synthesis filter to + determine the final harmonic phase. + + For a while there were prolems with low pitched males like hts1 + sounding "clicky". The synthesied time domain waveform also looked + clicky. Many methods were tried to improve the sounds quality of + low pitched males. Finally adding a small amount of jitter to each + harmonic worked. + + The current result sounds very close to the original phases, with + only 1 voicing bit per frame. For example hts1a using original + amplitudes and this phase model produces speech hard to distinguish + from speech synthesise with the orginal phases. The sound quality + of this patrtiallyuantised codec (nb original amplitudes) is higher + than g729, even though all the phase information has been + discarded. + + NOTES: + + 1/ This synthesis model is effectvely the same as simple LPC-10 + vocoders, and yet sounds much better. Why? + + 2/ I am pretty sure the Lincoln Lab sinusoidal coding guys (like xMBE + also from MIT) first described this zero phase model, I need to look + up the paper. + + 3/ Note that this approach could cause some discontinuities in + the phase at the edge of synthesis frames, as no attempt is made + to make sure that the phase tracks are continuous (the excitation + phases are continuous, but not the final phases after filtering + by the LPC spectra). Technically this is a bad thing. However + this may actually be a good thing, disturbing the phase tracks a + bit. More research needed, e.g. test a synthesis model that adds + a small delta-W to make phase tracks line up for voiced + harmonics. + + 4/ Why does this sound so great with 1 V/UV decision? Conventional + wisdom says mixed voicing is required for high qaulity speech. + +\*---------------------------------------------------------------------------*/ + +void phase_synth_zero_order( + MODEL *model, + float aks[], + float *ex_phase /* excitation phase of fundamental */ +) +{ + int m; + float new_phi; + COMP Ex[MAX_AMP]; /* excitation samples */ + COMP A_[MAX_AMP]; /* synthesised harmonic samples */ + COMP H[MAX_AMP]; /* LPC freq domain samples */ + float G; + float jitter; + + G = 1.0; + aks_to_H(model,aks,G,H,LPC_ORD); + + /* + Update excitation fundamental phase track, this sets the position + of each pitch pulse during voiced speech. After much experiment + I found that using just this frame Wo improved quality for UV + sounds compared to interpolating two frames Wo like this: + + ex_phase[0] += (*prev_Wo+mode->Wo)*N/2; + */ + + ex_phase[0] += (model->Wo)*N; + ex_phase[0] -= TWO_PI*floor(ex_phase[0]/TWO_PI + 0.5); + + for(m=1; m<=model->L; m++) { + + /* generate excitation */ + + if (model->voiced) { + /* This method of adding jitter really helped remove the clicky + sound in low pitched makes like hts1a. This moves the onset + of each harmonic over at +/- 0.25 of a sample. + */ + jitter = 0.25*(1.0 - 2.0*rand()/RAND_MAX); + Ex[m].real = cos(ex_phase[0]*m - jitter*model->Wo*m); + Ex[m].imag = sin(ex_phase[0]*m - jitter*model->Wo*m); + } + else { + + /* When a few samples were tested I found that LPC filter + phase is not needed in the unvoiced case, but no harm in + keeping it. + */ + float phi = TWO_PI*(float)rand()/RAND_MAX; + Ex[m].real = cos(phi); + Ex[m].imag = sin(phi); + } + + /* filter using LPC filter */ + + A_[m].real = H[m].real*Ex[m].real - H[m].imag*Ex[m].imag; + A_[m].imag = H[m].imag*Ex[m].real + H[m].real*Ex[m].imag; + + /* modify sinusoidal phase */ + + new_phi = atan2(A_[m].imag, A_[m].real+1E-12); + model->phi[m] = new_phi; + } + +} diff --git a/libs/libcodec2/src/phase.h b/libs/libcodec2/src/phase.h new file mode 100644 index 0000000..6dbf3fa --- /dev/null +++ b/libs/libcodec2/src/phase.h @@ -0,0 +1,34 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: phase.h + AUTHOR......: David Rowe + DATE CREATED: 1/2/09 + + Functions for modelling phase. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2009 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2.1, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef __PHASE__ +#define __PHASE__ + +void phase_synth_zero_order(MODEL *model, float aks[], float *ex_phase); + +#endif diff --git a/libs/libcodec2/src/postfilter.c b/libs/libcodec2/src/postfilter.c new file mode 100644 index 0000000..6dad76b --- /dev/null +++ b/libs/libcodec2/src/postfilter.c @@ -0,0 +1,131 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: postfilter.c + AUTHOR......: David Rowe + DATE CREATED: 13/09/09 + + Postfilter to improve sound quality for speech with high levels of + background noise. Unlike mixed-excitation models requires no bits + to be transmitted to handle background noise. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2009 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2.1, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <stdlib.h> +#include <stdio.h> +#include <math.h> + +#include "defines.h" +#include "dump.h" +#include "postfilter.h" + +/*---------------------------------------------------------------------------*\ + + DEFINES + +\*---------------------------------------------------------------------------*/ + +#define BG_THRESH 40.0 /* only consider low levels signals for bg_est */ +#define BG_BETA 0.1 /* averaging filter constant */ + +/*---------------------------------------------------------------------------*\ + + postfilter() + + The post filter is designed to help with speech corrupted by + background noise. The zero phase model tends to make speech with + background noise sound "clicky". With high levels of background + noise the low level inter-formant parts of the spectrum will contain + noise rather than speech harmonics, so modelling them as voiced + (i.e. a continuous, non-random phase track) is inaccurate. + + Some codecs (like MBE) have a mixed voicing model that breaks the + spectrum into voiced and unvoiced regions. Several bits/frame + (5-12) are required to transmit the frequency selective voicing + information. Mixed excitation also requires accurate voicing + estimation (parameter estimators always break occasionally under + exceptional condition). + + In our case we use a post filter approach which requires no + additional bits to be transmitted. The decoder measures the average + level of the background noise during unvoiced frames. If a harmonic + is less than this level it is made unvoiced by randomising it's + phases. + + This idea is rather experimental. Some potential problems that may + happen: + + 1/ If someone says "aaaaaaaahhhhhhhhh" will background estimator track + up to speech level? This would be a bad thing. + + 2/ If background noise suddenly dissapears from the source speech does + estimate drop quickly? What is noise suddenly re-appears? + + 3/ Background noise with a non-flat sepctrum. Current algorithm just + comsiders scpetrum as a whole, but this could be broken up into + bands, each with their own estimator. + + 4/ Males and females with the same level of background noise. Check + performance the same. Changing Wo affects width of each band, may + affect bg energy estimates. + + 5/ Not sure what happens during long periods of voiced speech + e.g. "sshhhhhhh" + +\*---------------------------------------------------------------------------*/ + +void postfilter( + MODEL *model, + float *bg_est +) +{ + int m, uv; + float e; + + /* determine average energy across spectrum */ + + e = 0.0; + for(m=1; m<=model->L; m++) + e += model->A[m]*model->A[m]; + + e = 10.0*log10(e/model->L); + + /* If beneath threhold, update bg estimate. The idea + of the threshold is to prevent updating during high level + speech. */ + + if ((e < BG_THRESH) && !model->voiced) + *bg_est = *bg_est*(1.0 - BG_BETA) + e*BG_BETA; + + /* now mess with phases during voiced frames to make any harmonics + less then our background estimate unvoiced. + */ + + uv = 0; + if (model->voiced) + for(m=1; m<=model->L; m++) + if (20.0*log10(model->A[m]) < *bg_est) { + model->phi[m] = TWO_PI*(float)rand()/RAND_MAX; + uv++; + } + + dump_bg(e, *bg_est, 100.0*uv/model->L); + +} diff --git a/libs/libcodec2/src/postfilter.h b/libs/libcodec2/src/postfilter.h new file mode 100644 index 0000000..d4dd4ae --- /dev/null +++ b/libs/libcodec2/src/postfilter.h @@ -0,0 +1,34 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: postfilter.h + AUTHOR......: David Rowe + DATE CREATED: 13/09/09 + + Postfilter header file. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2009 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2.1, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef __POSTFILTER__ +#define __POSTFILTER__ + +void postfilter(MODEL *model, float *bg_est); + +#endif diff --git a/libs/libcodec2/src/quantise.c b/libs/libcodec2/src/quantise.c new file mode 100644 index 0000000..a1cd728 --- /dev/null +++ b/libs/libcodec2/src/quantise.c @@ -0,0 +1,868 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: quantise.c + AUTHOR......: David Rowe + DATE CREATED: 31/5/92 + + Quantisation functions for the sinusoidal coder. + +\*---------------------------------------------------------------------------*/ + +/* + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2.1, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <assert.h> +#include <ctype.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <math.h> + +#include "defines.h" +#include "dump.h" +#include "quantise.h" +#include "lpc.h" +#include "lsp.h" +#include "four1.h" +#include "codebook.h" + +#define LSP_DELTA1 0.01 /* grid spacing for LSP root searches */ +#define MAX_CB 20 /* max number of codebooks */ + +/* describes each codebook */ + +typedef struct { + int k; /* dimension of vector */ + int log2m; /* number of bits in m */ + int m; /* elements in codebook */ + float *fn; /* file name of text file storing the VQ */ +} LSP_CB; + +/* lsp_q describes entire quantiser made up of several codebooks */ + +#ifdef OLDER +/* 10+10+6+6 = 32 bit LSP difference split VQ */ + +LSP_CB lsp_q[] = { + {3, 1024, "/usr/src/freeswitch/libs/libcodec2-1.0/unittest/lspd123.txt"}, + {3, 1024, "/usr/src/freeswitch/libs/libcodec2-1.0/unittest/lspd456.txt"}, + {2, 64, "/usr/src/freeswitch/libs/libcodec2-1.0/unittest/lspd78.txt"}, + {2, 64, "/usr/src/freeswitch/libs/libcodec2-1.0/unittest/lspd910.txt"}, + {0, 0, ""} +}; +#endif + +LSP_CB lsp_q[] = { + {1,4,16, codebook_lsp1 }, + {1,4,16, codebook_lsp2 }, + {1,4,16, codebook_lsp3 }, + {1,4,16, codebook_lsp4 }, + {1,4,16, codebook_lsp5 }, + {1,4,16, codebook_lsp6 }, + {1,4,16, codebook_lsp7 }, + {1,3,8, codebook_lsp8 }, + {1,3,8, codebook_lsp9 }, + {1,2,4, codebook_lsp10 }, + {0,0,0, NULL }, +}; + +/* ptr to each codebook */ + +static float *plsp_cb[MAX_CB]; + +/*---------------------------------------------------------------------------*\ + + FUNCTION HEADERS + +\*---------------------------------------------------------------------------*/ + +float speech_to_uq_lsps(float lsp[], float ak[], float Sn[], float w[], + int order); + +/*---------------------------------------------------------------------------*\ + + FUNCTIONS + +\*---------------------------------------------------------------------------*/ + +int lsp_bits(int i) { + return lsp_q[i].log2m; +} + +/*---------------------------------------------------------------------------*\ + + quantise_uniform + + Simulates uniform quantising of a float. + +\*---------------------------------------------------------------------------*/ + +void quantise_uniform(float *val, float min, float max, int bits) +{ + int levels = 1 << (bits-1); + float norm; + int index; + + /* hard limit to quantiser range */ + + printf("min: %f max: %f val: %f ", min, max, val[0]); + if (val[0] < min) val[0] = min; + if (val[0] > max) val[0] = max; + + norm = (*val - min)/(max-min); + printf("%f norm: %f ", val[0], norm); + index = fabs(levels*norm + 0.5); + + *val = min + index*(max-min)/levels; + + printf("index %d val_: %f\n", index, val[0]); +} + +/*---------------------------------------------------------------------------*\ + + lspd_quantise + + Simulates differential lsp quantiser + +\*---------------------------------------------------------------------------*/ + +void lsp_quantise( + float lsp[], + float lsp_[], + int order +) +{ + int i; + float dlsp[LPC_MAX]; + float dlsp_[LPC_MAX]; + + dlsp[0] = lsp[0]; + for(i=1; i<order; i++) + dlsp[i] = lsp[i] - lsp[i-1]; + + for(i=0; i<order; i++) + dlsp_[i] = dlsp[i]; + + quantise_uniform(&dlsp_[0], 0.1, 0.5, 5); + + lsp_[0] = dlsp_[0]; + for(i=1; i<order; i++) + lsp_[i] = lsp_[i-1] + dlsp_[i]; +} + +/*---------------------------------------------------------------------------*\ + + scan_line() + + This function reads a vector of floats from a line in a text file. + +\*---------------------------------------------------------------------------*/ + +void scan_line(FILE *fp, float f[], int n) +/* FILE *fp; file ptr to text file */ +/* float f[]; array of floats to return */ +/* int n; number of floats in line */ +{ + char s[MAX_STR]; + char *ps,*pe; + int i; + + fgets(s,MAX_STR,fp); + ps = pe = s; + for(i=0; i<n; i++) { + while( isspace(*pe)) pe++; + while( !isspace(*pe)) pe++; + sscanf(ps,"%f",&f[i]); + ps = pe; + } +} + +/*---------------------------------------------------------------------------*\ + + load_cb + + Loads a single codebook (LSP vector quantiser) into memory. + +\*---------------------------------------------------------------------------*/ + +void load_cb(float *source, float *cb, int k, int m) +{ + int lines; + int i; + + lines = 0; + for(i=0; i<m; i++) { + cb[k*lines++] = source[i]; + } +} + +/*---------------------------------------------------------------------------*\ + + quantise_init + + Loads the entire LSP quantiser comprised of several vector quantisers + (codebooks). + +\*---------------------------------------------------------------------------*/ + +void quantise_init() +{ + int i,k,m; + + i = 0; + while(lsp_q[i].k) { + k = lsp_q[i].k; + m = lsp_q[i].m; + plsp_cb[i] = (float*)malloc(sizeof(float)*k*m); + assert(plsp_cb[i] != NULL); + load_cb(lsp_q[i].fn, plsp_cb[i], k, m); + i++; + assert(i < MAX_CB); + } +} + +/*---------------------------------------------------------------------------*\ + + quantise + + Quantises vec by choosing the nearest vector in codebook cb, and + returns the vector index. The squared error of the quantised vector + is added to se. + +\*---------------------------------------------------------------------------*/ + +long quantise(float cb[], float vec[], float w[], int k, int m, float *se) +/* float cb[][K]; current VQ codebook */ +/* float vec[]; vector to quantise */ +/* float w[]; weighting vector */ +/* int k; dimension of vectors */ +/* int m; size of codebook */ +/* float *se; accumulated squared error */ +{ + float e; /* current error */ + long besti; /* best index so far */ + float beste; /* best error so far */ + long j; + int i; + + besti = 0; + beste = 1E32; + for(j=0; j<m; j++) { + e = 0.0; + for(i=0; i<k; i++) + e += pow((cb[j*k+i]-vec[i])*w[i],2.0); + if (e < beste) { + beste = e; + besti = j; + } + } + + *se += beste; + + return(besti); +} + +static float gmin=PI; + +float get_gmin(void) { return gmin; } + +void min_lsp_dist(float lsp[], int order) +{ + int i; + + for(i=1; i<order; i++) + if ((lsp[i]-lsp[i-1]) < gmin) + gmin = lsp[i]-lsp[i-1]; +} + +void check_lsp_order(float lsp[], int lpc_order) +{ + int i; + float tmp; + + for(i=1; i<lpc_order; i++) + if (lsp[i] < lsp[i-1]) { + printf("swap %d\n",i); + tmp = lsp[i-1]; + lsp[i-1] = lsp[i]-0.05; + lsp[i] = tmp+0.05; + } +} + +void force_min_lsp_dist(float lsp[], int lpc_order) +{ + int i; + + for(i=1; i<lpc_order; i++) + if ((lsp[i]-lsp[i-1]) < 0.01) { + lsp[i] += 0.01; + } +} + +/*---------------------------------------------------------------------------*\ + + lpc_model_amplitudes + + Derive a LPC model for amplitude samples then estimate amplitude samples + from this model with optional LSP quantisation. + + Returns the spectral distortion for this frame. + +\*---------------------------------------------------------------------------*/ + +float lpc_model_amplitudes( + float Sn[], /* Input frame of speech samples */ + float w[], + MODEL *model, /* sinusoidal model parameters */ + int order, /* LPC model order */ + int lsp_quant, /* optional LSP quantisation if non-zero */ + float ak[] /* output aks */ +) +{ + float Wn[M]; + float R[LPC_MAX+1]; + float E; + int i,j; + float snr; + float lsp[LPC_MAX]; + float lsp_hz[LPC_MAX]; + float lsp_[LPC_MAX]; + int roots; /* number of LSP roots found */ + int index; + float se; + int k,m; + float *cb; + float wt[LPC_MAX]; + + for(i=0; i<M; i++) + Wn[i] = Sn[i]*w[i]; + autocorrelate(Wn,R,M,order); + levinson_durbin(R,ak,order); + + E = 0.0; + for(i=0; i<=order; i++) + E += ak[i]*R[i]; + + for(i=0; i<order; i++) + wt[i] = 1.0; + + if (lsp_quant) { + roots = lpc_to_lsp(ak, order, lsp, 5, LSP_DELTA1); + if (roots != order) + printf("LSP roots not found\n"); + + /* convert from radians to Hz to make quantisers more + human readable */ + + for(i=0; i<order; i++) + lsp_hz[i] = (4000.0/PI)*lsp[i]; + + /* simple uniform scalar quantisers */ + + for(i=0; i<10; i++) { + k = lsp_q[i].k; + m = lsp_q[i].m; + cb = plsp_cb[i]; + index = quantise(cb, &lsp_hz[i], wt, k, m, &se); + lsp_hz[i] = cb[index*k]; + } + + /* experiment: simulating uniform quantisation error + for(i=0; i<order; i++) + lsp[i] += PI*(12.5/4000.0)*(1.0 - 2.0*(float)rand()/RAND_MAX); + */ + + for(i=0; i<order; i++) + lsp[i] = (PI/4000.0)*lsp_hz[i]; + + /* Bandwidth Expansion (BW). Prevents any two LSPs getting too + close together after quantisation. We know from experiment + that LSP quantisation errors < 12.5Hz (25Hz setp size) are + inaudible so we use that as the minimum LSP separation. + */ + + for(i=1; i<5; i++) { + if (lsp[i] - lsp[i-1] < PI*(12.5/4000.0)) + lsp[i] = lsp[i-1] + PI*(12.5/4000.0); + } + + /* as quantiser gaps increased, larger BW expansion was required + to prevent twinkly noises */ + + for(i=5; i<8; i++) { + if (lsp[i] - lsp[i-1] < PI*(25.0/4000.0)) + lsp[i] = lsp[i-1] + PI*(25.0/4000.0); + } + for(i=8; i<order; i++) { + if (lsp[i] - lsp[i-1] < PI*(75.0/4000.0)) + lsp[i] = lsp[i-1] + PI*(75.0/4000.0); + } + + for(j=0; j<order; j++) + lsp_[j] = lsp[j]; + + lsp_to_lpc(lsp_, ak, order); + dump_lsp(lsp); + } + + dump_E(E); + #ifdef SIM_QUANT + /* simulated LPC energy quantisation */ + { + float e = 10.0*log10(E); + e += 2.0*(1.0 - 2.0*(float)rand()/RAND_MAX); + E = pow(10.0,e/10.0); + } + #endif + + aks_to_M2(ak,order,model,E,&snr, 1); /* {ak} -> {Am} LPC decode */ + + return snr; +} + +/*---------------------------------------------------------------------------*\ + + aks_to_M2() + + Transforms the linear prediction coefficients to spectral amplitude + samples. This function determines A(m) from the average energy per + band using an FFT. + +\*---------------------------------------------------------------------------*/ + +void aks_to_M2( + float ak[], /* LPC's */ + int order, + MODEL *model, /* sinusoidal model parameters for this frame */ + float E, /* energy term */ + float *snr, /* signal to noise ratio for this frame in dB */ + int dump /* true to dump sample to dump file */ +) +{ + COMP Pw[FFT_DEC]; /* power spectrum */ + int i,m; /* loop variables */ + int am,bm; /* limits of current band */ + float r; /* no. rads/bin */ + float Em; /* energy in band */ + float Am; /* spectral amplitude sample */ + float signal, noise; + + r = TWO_PI/(FFT_DEC); + + /* Determine DFT of A(exp(jw)) --------------------------------------------*/ + + for(i=0; i<FFT_DEC; i++) { + Pw[i].real = 0.0; + Pw[i].imag = 0.0; + } + + for(i=0; i<=order; i++) + Pw[i].real = ak[i]; + four1(&Pw[-1].imag,FFT_DEC,1); + + /* Determine power spectrum P(w) = E/(A(exp(jw))^2 ------------------------*/ + + for(i=0; i<FFT_DEC/2; i++) + Pw[i].real = E/(Pw[i].real*Pw[i].real + Pw[i].imag*Pw[i].imag); + if (dump) + dump_Pw(Pw); + + /* Determine magnitudes by linear interpolation of P(w) -------------------*/ + + signal = noise = 0.0; + for(m=1; m<=model->L; m++) { + am = floor((m - 0.5)*model->Wo/r + 0.5); + bm = floor((m + 0.5)*model->Wo/r + 0.5); + Em = 0.0; + + for(i=am; i<bm; i++) + Em += Pw[i].real; + Am = sqrt(Em); + + signal += pow(model->A[m],2.0); + noise += pow(model->A[m] - Am,2.0); + model->A[m] = Am; + } + *snr = 10.0*log10(signal/noise); +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: encode_Wo() + AUTHOR......: David Rowe + DATE CREATED: 22/8/2010 + + Encodes Wo using a WO_LEVELS quantiser. + +\*---------------------------------------------------------------------------*/ + +int encode_Wo(float Wo) +{ + int index; + float Wo_min = TWO_PI/P_MAX; + float Wo_max = TWO_PI/P_MIN; + float norm; + + norm = (Wo - Wo_min)/(Wo_max - Wo_min); + index = floor(WO_LEVELS * norm + 0.5); + if (index < 0 ) index = 0; + if (index > (WO_LEVELS-1)) index = WO_LEVELS-1; + + return index; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: decode_Wo() + AUTHOR......: David Rowe + DATE CREATED: 22/8/2010 + + Decodes Wo using a WO_LEVELS quantiser. + +\*---------------------------------------------------------------------------*/ + +float decode_Wo(int index) +{ + float Wo_min = TWO_PI/P_MAX; + float Wo_max = TWO_PI/P_MIN; + float step; + float Wo; + + step = (Wo_max - Wo_min)/WO_LEVELS; + Wo = Wo_min + step*(index); + + return Wo; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: speech_to_uq_lsps() + AUTHOR......: David Rowe + DATE CREATED: 22/8/2010 + + Analyse a windowed frame of time domain speech to determine LPCs + which are the converted to LSPs for quantisation and transmission + over the channel. + +\*---------------------------------------------------------------------------*/ + +float speech_to_uq_lsps(float lsp[], + float ak[], + float Sn[], + float w[], + int order +) +{ + int i, roots; + float Wn[M]; + float R[LPC_MAX+1]; + float E; + + for(i=0; i<M; i++) + Wn[i] = Sn[i]*w[i]; + autocorrelate(Wn, R, M, order); + levinson_durbin(R, ak, order); + + E = 0.0; + for(i=0; i<=order; i++) + E += ak[i]*R[i]; + + roots = lpc_to_lsp(ak, order, lsp, 5, LSP_DELTA1); + // assert(roots == order); + + return E; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: encode_lsps() + AUTHOR......: David Rowe + DATE CREATED: 22/8/2010 + + From a vector of unquantised (floating point) LSPs finds the quantised + LSP indexes. + +\*---------------------------------------------------------------------------*/ + +void encode_lsps(int indexes[], float lsp[], int order) +{ + int i,k,m; + float wt[1]; + float lsp_hz[LPC_MAX]; + float *cb, se; + + /* convert from radians to Hz so we can use human readable + frequencies */ + + for(i=0; i<order; i++) + lsp_hz[i] = (4000.0/PI)*lsp[i]; + + /* simple uniform scalar quantisers */ + + wt[0] = 1.0; + for(i=0; i<order; i++) { + k = lsp_q[i].k; + m = lsp_q[i].m; + cb = plsp_cb[i]; + indexes[i] = quantise(cb, &lsp_hz[i], wt, k, m, &se); + } +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: decode_lsps() + AUTHOR......: David Rowe + DATE CREATED: 22/8/2010 + + From a vector of quantised LSP indexes, returns the quantised + (floating point) LSPs. + +\*---------------------------------------------------------------------------*/ + +void decode_lsps(float lsp[], int indexes[], int order) +{ + int i,k; + float lsp_hz[LPC_MAX]; + float *cb; + + for(i=0; i<order; i++) { + k = lsp_q[i].k; + cb = plsp_cb[i]; + lsp_hz[i] = cb[indexes[i]*k]; + } + + /* convert back to radians */ + + for(i=0; i<order; i++) + lsp[i] = (PI/4000.0)*lsp_hz[i]; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: bw_expand_lsps() + AUTHOR......: David Rowe + DATE CREATED: 22/8/2010 + + Applies Bandwidth Expansion (BW) to a vector of LSPs. Prevents any + two LSPs getting too close together after quantisation. We know + from experiment that LSP quantisation errors < 12.5Hz (25Hz setp + size) are inaudible so we use that as the minimum LSP separation. + +\*---------------------------------------------------------------------------*/ + +void bw_expand_lsps(float lsp[], + int order +) +{ + int i; + + for(i=1; i<5; i++) { + if (lsp[i] - lsp[i-1] < PI*(12.5/4000.0)) + lsp[i] = lsp[i-1] + PI*(12.5/4000.0); + } + + /* As quantiser gaps increased, larger BW expansion was required + to prevent twinkly noises. This may need more experiment for + different quanstisers. + */ + + for(i=5; i<8; i++) { + if (lsp[i] - lsp[i-1] < PI*(25.0/4000.0)) + lsp[i] = lsp[i-1] + PI*(25.0/4000.0); + } + for(i=8; i<order; i++) { + if (lsp[i] - lsp[i-1] < PI*(75.0/4000.0)) + lsp[i] = lsp[i-1] + PI*(75.0/4000.0); + } +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: need_lpc_correction() + AUTHOR......: David Rowe + DATE CREATED: 22/8/2010 + + Determine if we need LPC correction of first harmonic. + +\*---------------------------------------------------------------------------*/ + +int need_lpc_correction(MODEL *model, float ak[], float E) +{ + MODEL tmp; + float snr,E1; + + /* Find amplitudes so we can check if we need LPC correction. + TODO: replace call to aks_to_M2() by a single DFT calculation + of E/A(exp(jWo)) to make much more efficient. We only need + A[1]. + */ + + memcpy(&tmp, model, sizeof(MODEL)); + aks_to_M2(ak, LPC_ORD, &tmp, E, &snr, 0); + + /* + Attenuate fundamental by 30dB if F0 < 150 Hz and LPC modelling + error for A[1] is larger than 6dB. + + LPC modelling often makes big errors on 1st harmonic, for example + when the fundamental has been removed by analog high pass + filtering before sampling. However on unfiltered speech from + high quality sources we would like to keep the fundamental to + maintain the speech quality. So we check the error in A[1] and + attenuate it if the error is large to avoid annoying low + frequency energy after LPC modelling. + + This requires a single bit to quantise, on top of the other + spectral magnitude bits (i.e. LSP bits + 1 total). + */ + + E1 = fabs(20.0*log10(model->A[1]) - 20.0*log10(tmp.A[1])); + if (E1 > 6.0) + return 1; + else + return 0; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: apply_lpc_correction() + AUTHOR......: David Rowe + DATE CREATED: 22/8/2010 + + Apply first harmonic LPC correction at decoder. + +\*---------------------------------------------------------------------------*/ + +void apply_lpc_correction(MODEL *model, int lpc_correction) +{ + if (lpc_correction) { + if (model->Wo < (PI*150.0/4000)) { + model->A[1] *= 0.032; + } + } +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: encode_energy() + AUTHOR......: David Rowe + DATE CREATED: 22/8/2010 + + Encodes LPC energy using an E_LEVELS quantiser. + +\*---------------------------------------------------------------------------*/ + +int encode_energy(float e) +{ + int index; + float e_min = E_MIN_DB; + float e_max = E_MAX_DB; + float norm; + + e = 10.0*log10(e); + norm = (e - e_min)/(e_max - e_min); + index = floor(E_LEVELS * norm + 0.5); + if (index < 0 ) index = 0; + if (index > (E_LEVELS-1)) index = E_LEVELS-1; + + return index; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: decode_energy() + AUTHOR......: David Rowe + DATE CREATED: 22/8/2010 + + Decodes energy using a WO_BITS quantiser. + +\*---------------------------------------------------------------------------*/ + +float decode_energy(int index) +{ + float e_min = E_MIN_DB; + float e_max = E_MAX_DB; + float step; + float e; + + step = (e_max - e_min)/E_LEVELS; + e = e_min + step*(index); + e = pow(10.0,e/10.0); + + return e; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: encode_amplitudes() + AUTHOR......: David Rowe + DATE CREATED: 22/8/2010 + + Time domain LPC is used model the amplitudes which are then + converted to LSPs and quantised. So we don't actually encode the + amplitudes directly, rather we derive an equivalent representation + from the time domain speech. + +\*---------------------------------------------------------------------------*/ + +void encode_amplitudes(int lsp_indexes[], + int *lpc_correction, + int *energy_index, + MODEL *model, + float Sn[], + float w[]) +{ + float lsps[LPC_ORD]; + float ak[LPC_ORD+1]; + float e; + + e = speech_to_uq_lsps(lsps, ak, Sn, w, LPC_ORD); + encode_lsps(lsp_indexes, lsps, LPC_ORD); + *lpc_correction = need_lpc_correction(model, ak, e); + *energy_index = encode_energy(e); +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: decode_amplitudes() + AUTHOR......: David Rowe + DATE CREATED: 22/8/2010 + + Given the amplitude quantiser indexes recovers the harmonic + amplitudes. + +\*---------------------------------------------------------------------------*/ + +float decode_amplitudes(MODEL *model, + float ak[], + int lsp_indexes[], + int lpc_correction, + int energy_index +) +{ + float lsps[LPC_ORD]; + float e; + float snr; + + decode_lsps(lsps, lsp_indexes, LPC_ORD); + bw_expand_lsps(lsps, LPC_ORD); + lsp_to_lpc(lsps, ak, LPC_ORD); + e = decode_energy(energy_index); + aks_to_M2(ak, LPC_ORD, model, e, &snr, 1); + apply_lpc_correction(model, lpc_correction); + + return snr; +} diff --git a/libs/libcodec2/src/quantise.h b/libs/libcodec2/src/quantise.h new file mode 100644 index 0000000..ded7645 --- /dev/null +++ b/libs/libcodec2/src/quantise.h @@ -0,0 +1,84 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: quantise.h + AUTHOR......: David Rowe + DATE CREATED: 31/5/92 + + Quantisation functions for the sinusoidal coder. + +\*---------------------------------------------------------------------------*/ + +/* + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2.1, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef __QUANTISE__ +#define __QUANTISE__ + +#define WO_BITS 7 +#define WO_LEVELS (1<<WO_BITS) +#define E_BITS 5 +#define E_LEVELS (1<<E_BITS) +#define E_MIN_DB -10.0 +#define E_MAX_DB 40.0 + +void quantise_init(); +float lpc_model_amplitudes(float Sn[], float w[], MODEL *model, int order, + int lsp,float ak[]); +void aks_to_M2(float ak[], int order, MODEL *model, float E, float *snr, + int dump); +float get_gmin(void); + +int encode_Wo(float Wo); +float decode_Wo(int index); + +void encode_lsps(int indexes[], float lsp[], int order); +void decode_lsps(float lsp[], int indexes[], int order); + +int encode_energy(float e); +float decode_energy(int index); + +void encode_amplitudes(int lsp_indexes[], + int *lpc_correction, + int *energy_index, + MODEL *model, + float Sn[], + float w[]); + +float decode_amplitudes(MODEL *model, + float ak[], + int lsp_indexes[], + int lpc_correction, + int energy_index); + +void pack(unsigned char * bits, unsigned int *nbit, int index, unsigned int index_bits); +int unpack(const unsigned char * bits, unsigned int *nbit, unsigned int index_bits); + +int lsp_bits(int i); + +int need_lpc_correction(MODEL *model, float ak[], float E); +void apply_lpc_correction(MODEL *model, int lpc_correction); +float speech_to_uq_lsps(float lsp[], + float ak[], + float Sn[], + float w[], + int order + ); +void bw_expand_lsps(float lsp[], + int order + ); +void decode_lsps(float lsp[], int indexes[], int order); + +#endif diff --git a/libs/libcodec2/src/sim.sh b/libs/libcodec2/src/sim.sh new file mode 100755 index 0000000..ed298e3 --- /dev/null +++ b/libs/libcodec2/src/sim.sh @@ -0,0 +1,18 @@ +#!/bin/sh +# sim.sh +# David Rowe 10 Sep 2009 + +# Process a source file using the codec 2 simulation. An output +# speech file is generated for each major processing step, from the +# unquantised siusoidal model to fully quantised. This way we can +# listen to the effect of each processing step. Use listensim.sh to +# test the output files. + +../src/c2sim ../raw/$1.raw -o $1_uq.raw +../src/c2sim ../raw/$1.raw --phase0 -o $1_phase0.raw --postfilter +../src/c2sim ../raw/$1.raw --lpc 10 -o $1_lpc10.raw +../src/c2sim ../raw/$1.raw --lpc 10 --lsp -o $1_lsp.raw +../src/c2sim ../raw/$1.raw --phase0 --lpc 10 -o $1_phase0_lpc10.raw --postfilter +../src/c2sim ../raw/$1.raw --phase0 --lpc 10 --lsp -o $1_phase0_lsp.raw --postfilter +../src/c2sim ../raw/$1.raw --phase0 --lpc 10 --lsp -o $1_phase0_lsp_dec.raw --postfilter --dec + diff --git a/libs/libcodec2/src/sine.c b/libs/libcodec2/src/sine.c new file mode 100644 index 0000000..9263151 --- /dev/null +++ b/libs/libcodec2/src/sine.c @@ -0,0 +1,530 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: sine.c + AUTHOR......: David Rowe + DATE CREATED: 19/8/2010 + + Sinusoidal analysis and synthesis functions. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 1990-2010 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2.1, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/*---------------------------------------------------------------------------*\ + + INCLUDES + +\*---------------------------------------------------------------------------*/ + +#include <stdlib.h> +#include <stdio.h> +#include <math.h> + +#include "defines.h" +#include "sine.h" +#include "four1.h" + +/*---------------------------------------------------------------------------*\ + + HEADERS + +\*---------------------------------------------------------------------------*/ + +void hs_pitch_refinement(MODEL *model, COMP Sw[], float pmin, float pmax, + float pstep); + +/*---------------------------------------------------------------------------*\ + + FUNCTIONS + +\*---------------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: make_analysis_window + AUTHOR......: David Rowe + DATE CREATED: 11/5/94 + + Init function that generates the time domain analysis window and it's DFT. + +\*---------------------------------------------------------------------------*/ + +void make_analysis_window(float w[],COMP W[]) +{ + float m; + COMP temp; + int i,j; + + /* + Generate Hamming window centered on M-sample pitch analysis window + + 0 M/2 M-1 + |-------------|-------------| + |-------|-------| + NW samples + + All our analysis/synthsis is centred on the M/2 sample. + */ + + m = 0.0; + for(i=0; i<M/2-NW/2; i++) + w[i] = 0.0; + for(i=M/2-NW/2,j=0; i<M/2+NW/2; i++,j++) { + w[i] = 0.5 - 0.5*cos(TWO_PI*j/(NW-1)); + m += w[i]*w[i]; + } + for(i=M/2+NW/2; i<M; i++) + w[i] = 0.0; + + /* Normalise - makes freq domain amplitude estimation straight + forward */ + + m = 1.0/sqrt(m*FFT_ENC); + for(i=0; i<M; i++) { + w[i] *= m; + } + + /* + Generate DFT of analysis window, used for later processing. Note + we modulo FFT_ENC shift the time domain window w[], this makes the + imaginary part of the DFT W[] equal to zero as the shifted w[] is + even about the n=0 time axis if NW is odd. Having the imag part + of the DFT W[] makes computation easier. + + 0 FFT_ENC-1 + |-------------------------| + + ----\ /---- + \ / + \ / <- shifted version of window w[n] + \ / + \ / + ------- + + |---------| |---------| + NW/2 NW/2 + */ + + for(i=0; i<FFT_ENC; i++) { + W[i].real = 0.0; + W[i].imag = 0.0; + } + for(i=0; i<NW/2; i++) + W[i].real = w[i+M/2]; + for(i=FFT_ENC-NW/2,j=M/2-NW/2; i<FFT_ENC; i++,j++) + W[i].real = w[j]; + + four1(&W[-1].imag,FFT_ENC,-1); /* "Numerical Recipes in C" FFT */ + + /* + Re-arrange W[] to be symmetrical about FFT_ENC/2. Makes later + analysis convenient. + + Before: + + + 0 FFT_ENC-1 + |----------|---------| + __ _ + \ / + \_______________/ + + After: + + 0 FFT_ENC-1 + |----------|---------| + ___ + / \ + ________/ \_______ + + */ + + + for(i=0; i<FFT_ENC/2; i++) { + temp.real = W[i].real; + temp.imag = W[i].imag; + W[i].real = W[i+FFT_ENC/2].real; + W[i].imag = W[i+FFT_ENC/2].imag; + W[i+FFT_ENC/2].real = temp.real; + W[i+FFT_ENC/2].imag = temp.imag; + } + +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: dft_speech + AUTHOR......: David Rowe + DATE CREATED: 27/5/94 + + Finds the DFT of the current speech input speech frame. + +\*---------------------------------------------------------------------------*/ + +void dft_speech(COMP Sw[], float Sn[], float w[]) +{ + int i; + + for(i=0; i<FFT_ENC; i++) { + Sw[i].real = 0.0; + Sw[i].imag = 0.0; + } + + /* Centre analysis window on time axis, we need to arrange input + to FFT this way to make FFT phases correct */ + + /* move 2nd half to start of FFT input vector */ + + for(i=0; i<NW/2; i++) + Sw[i].real = Sn[i+M/2]*w[i+M/2]; + + /* move 1st half to end of FFT input vector */ + + for(i=0; i<NW/2; i++) + Sw[FFT_ENC-NW/2+i].real = Sn[i+M/2-NW/2]*w[i+M/2-NW/2]; + + four1(&Sw[-1].imag,FFT_ENC,-1); +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: two_stage_pitch_refinement + AUTHOR......: David Rowe + DATE CREATED: 27/5/94 + + Refines the current pitch estimate using the harmonic sum pitch + estimation technique. + +\*---------------------------------------------------------------------------*/ + +void two_stage_pitch_refinement(MODEL *model, COMP Sw[]) +{ + float pmin,pmax,pstep; /* pitch refinment minimum, maximum and step */ + + /* Coarse refinement */ + + pmax = TWO_PI/model->Wo + 5; + pmin = TWO_PI/model->Wo - 5; + pstep = 1.0; + hs_pitch_refinement(model,Sw,pmin,pmax,pstep); + + /* Fine refinement */ + + pmax = TWO_PI/model->Wo + 1; + pmin = TWO_PI/model->Wo - 1; + pstep = 0.25; + hs_pitch_refinement(model,Sw,pmin,pmax,pstep); + + /* Limit range */ + + if (model->Wo < TWO_PI/P_MAX) + model->Wo = TWO_PI/P_MAX; + if (model->Wo > TWO_PI/P_MIN) + model->Wo = TWO_PI/P_MIN; + + model->L = floor(PI/model->Wo); +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: hs_pitch_refinement + AUTHOR......: David Rowe + DATE CREATED: 27/5/94 + + Harmonic sum pitch refinement function. + + pmin pitch search range minimum + pmax pitch search range maximum + step pitch search step size + model current pitch estimate in model.Wo + + model refined pitch estimate in model.Wo + +\*---------------------------------------------------------------------------*/ + +void hs_pitch_refinement(MODEL *model, COMP Sw[], float pmin, float pmax, float pstep) +{ + int m; /* loop variable */ + int b; /* bin for current harmonic centre */ + float E; /* energy for current pitch*/ + float Wo; /* current "test" fundamental freq. */ + float Wom; /* Wo that maximises E */ + float Em; /* mamimum energy */ + float r; /* number of rads/bin */ + float p; /* current pitch */ + + /* Initialisation */ + + model->L = PI/model->Wo; /* use initial pitch est. for L */ + Wom = model->Wo; + Em = 0.0; + r = TWO_PI/FFT_ENC; + + /* Determine harmonic sum for a range of Wo values */ + + for(p=pmin; p<=pmax; p+=pstep) { + E = 0.0; + Wo = TWO_PI/p; + + /* Sum harmonic magnitudes */ + + for(m=1; m<=model->L; m++) { + b = floor(m*Wo/r + 0.5); + E += Sw[b].real*Sw[b].real + Sw[b].imag*Sw[b].imag; + } + + /* Compare to see if this is a maximum */ + + if (E > Em) { + Em = E; + Wom = Wo; + } + } + + model->Wo = Wom; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: estimate_amplitudes + AUTHOR......: David Rowe + DATE CREATED: 27/5/94 + + Estimates the complex amplitudes of the harmonics. + +\*---------------------------------------------------------------------------*/ + +void estimate_amplitudes(MODEL *model, COMP Sw[], COMP W[]) +{ + int i,m; /* loop variables */ + int am,bm; /* bounds of current harmonic */ + int b; /* DFT bin of centre of current harmonic */ + float den; /* denominator of amplitude expression */ + float r; /* number of rads/bin */ + int offset; + COMP Am; + + r = TWO_PI/FFT_ENC; + + for(m=1; m<=model->L; m++) { + den = 0.0; + am = floor((m - 0.5)*model->Wo/r + 0.5); + bm = floor((m + 0.5)*model->Wo/r + 0.5); + b = floor(m*model->Wo/r + 0.5); + + /* Estimate ampltude of harmonic */ + + den = 0.0; + Am.real = Am.imag = 0.0; + for(i=am; i<bm; i++) { + den += Sw[i].real*Sw[i].real + Sw[i].imag*Sw[i].imag; + offset = i + FFT_ENC/2 - floor(m*model->Wo/r + 0.5); + Am.real += Sw[i].real*W[offset].real; + Am.imag += Sw[i].imag*W[offset].real; + } + + model->A[m] = sqrt(den); + + /* Estimate phase of harmonic */ + + model->phi[m] = atan2(Sw[b].imag,Sw[b].real); + } +} + +/*---------------------------------------------------------------------------*\ + + est_voicing_mbe() + + Returns the error of the MBE cost function for a fiven F0. + + Note: I think a lot of the operations below can be simplified as + W[].imag = 0 and has been normalised such that den always equals 1. + +\*---------------------------------------------------------------------------*/ + +float est_voicing_mbe( + MODEL *model, + COMP Sw[], + COMP W[], + float f0, + COMP Sw_[] /* DFT of all voiced synthesised signal for f0 */ + /* useful for debugging/dump file */ +) +{ + int i,l,al,bl,m; /* loop variables */ + COMP Am; /* amplitude sample for this band */ + int offset; /* centers Hw[] about current harmonic */ + float den; /* denominator of Am expression */ + float error; /* accumulated error between originl and synthesised */ + float Wo; /* current "test" fundamental freq. */ + int L; + float sig, snr; + + sig = 0.0; + for(l=1; l<=model->L/4; l++) { + sig += model->A[l]*model->A[l]; + } + + for(i=0; i<FFT_ENC; i++) { + Sw_[i].real = 0.0; + Sw_[i].imag = 0.0; + } + + L = floor((FS/2.0)/f0); + Wo = f0*(TWO_PI/FS); + + error = 0.0; + + /* Just test across the harmonics in the first 1000 Hz (L/4) */ + + for(l=1; l<=L/4; l++) { + Am.real = 0.0; + Am.imag = 0.0; + den = 0.0; + al = ceil((l - 0.5)*Wo*FFT_ENC/TWO_PI); + bl = ceil((l + 0.5)*Wo*FFT_ENC/TWO_PI); + + /* Estimate amplitude of harmonic assuming harmonic is totally voiced */ + + for(m=al; m<bl; m++) { + offset = FFT_ENC/2 + m - l*Wo*FFT_ENC/TWO_PI + 0.5; + Am.real += Sw[m].real*W[offset].real + Sw[m].imag*W[offset].imag; + Am.imag += Sw[m].imag*W[offset].real - Sw[m].real*W[offset].imag; + den += W[offset].real*W[offset].real + W[offset].imag*W[offset].imag; + } + + Am.real = Am.real/den; + Am.imag = Am.imag/den; + + /* Determine error between estimated harmonic and original */ + + for(m=al; m<bl; m++) { + offset = FFT_ENC/2 + m - l*Wo*FFT_ENC/TWO_PI + 0.5; + Sw_[m].real = Am.real*W[offset].real - Am.imag*W[offset].imag; + Sw_[m].imag = Am.real*W[offset].imag + Am.imag*W[offset].real; + error += (Sw[m].real - Sw_[m].real)*(Sw[m].real - Sw_[m].real); + error += (Sw[m].imag - Sw_[m].imag)*(Sw[m].imag - Sw_[m].imag); + } + } + + snr = 10.0*log10(sig/error); + if (snr > V_THRESH) + model->voiced = 1; + else + model->voiced = 0; + + return snr; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: make_synthesis_window + AUTHOR......: David Rowe + DATE CREATED: 11/5/94 + + Init function that generates the trapezoidal (Parzen) sythesis window. + +\*---------------------------------------------------------------------------*/ + +void make_synthesis_window(float Pn[]) +{ + int i; + float win; + + /* Generate Parzen window in time domain */ + + win = 0.0; + for(i=0; i<N/2-TW; i++) + Pn[i] = 0.0; + win = 0.0; + for(i=N/2-TW; i<N/2+TW; win+=1.0/(2*TW), i++ ) + Pn[i] = win; + for(i=N/2+TW; i<3*N/2-TW; i++) + Pn[i] = 1.0; + win = 1.0; + for(i=3*N/2-TW; i<3*N/2+TW; win-=1.0/(2*TW), i++) + Pn[i] = win; + for(i=3*N/2+TW; i<2*N; i++) + Pn[i] = 0.0; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: synthesise + AUTHOR......: David Rowe + DATE CREATED: 20/2/95 + + Synthesise a speech signal in the frequency domain from the + sinusodal model parameters. Uses overlap-add a triangular window to + smoothly interpolate betwen frames. + +\*---------------------------------------------------------------------------*/ + +void synthesise( + float Sn_[], /* time domain synthesised signal */ + MODEL *model, /* ptr to model parameters for this frame */ + float Pn[], /* time domain Parzen window */ + int shift /* used to handle transition frames */ +) +{ + int i,l,j,b; /* loop variables */ + COMP Sw_[FFT_DEC]; /* DFT of synthesised signal */ + + if (shift) { + /* Update memories */ + + for(i=0; i<N-1; i++) { + Sn_[i] = Sn_[i+N]; + } + Sn_[N-1] = 0.0; + } + + for(i=0; i<FFT_DEC; i++) { + Sw_[i].real = 0.0; + Sw_[i].imag = 0.0; + } + + /* Now set up frequency domain synthesised speech */ + + for(l=1; l<=model->L; l++) { + b = floor(l*model->Wo*FFT_DEC/TWO_PI + 0.5); + Sw_[b].real = model->A[l]*cos(model->phi[l]); + Sw_[b].imag = model->A[l]*sin(model->phi[l]); + Sw_[FFT_DEC-b].real = Sw_[b].real; + Sw_[FFT_DEC-b].imag = -Sw_[b].imag; + } + + /* Perform inverse DFT */ + + four1(&Sw_[-1].imag,FFT_DEC,1); + + /* Overlap add to previous samples */ + + for(i=0; i<N-1; i++) { + Sn_[i] += Sw_[FFT_DEC-N+1+i].real*Pn[i]; + } + + if (shift) + for(i=N-1,j=0; i<2*N; i++,j++) + Sn_[i] = Sw_[j].real*Pn[i]; + else + for(i=N-1,j=0; i<2*N; i++,j++) + Sn_[i] += Sw_[j].real*Pn[i]; +} + diff --git a/libs/libcodec2/src/sine.h b/libs/libcodec2/src/sine.h new file mode 100644 index 0000000..9cdfbcf --- /dev/null +++ b/libs/libcodec2/src/sine.h @@ -0,0 +1,40 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: sine.h + AUTHOR......: David Rowe + DATE CREATED: 1/11/94 + + Header file for sinusoidal analysis and synthesis functions. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2009 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2.1, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef __SINE__ +#define __SINE__ + +void make_analysis_window(float w[], COMP W[]); +void dft_speech(COMP Sw[], float Sn[], float w[]); +void two_stage_pitch_refinement(MODEL *model, COMP Sw[]); +void estimate_amplitudes(MODEL *model, COMP Sw[], COMP W[]); +float est_voicing_mbe(MODEL *model, COMP Sw[], COMP W[], float f0, COMP Sw_[]); +void make_synthesis_window(float Pn[]); +void synthesise(float Sn_[], MODEL *model, float Pn[], int shift); + +#endif diff --git a/libs/libcodec2/unittest/Makefile.am b/libs/libcodec2/unittest/Makefile.am new file mode 100644 index 0000000..81d5463 --- /dev/null +++ b/libs/libcodec2/unittest/Makefile.am @@ -0,0 +1,41 @@ +AM_CFLAGS = -I../src -g -DFLOATING_POINT -DVAR_ARRAYS +AUTOMAKE_OPTS = gnu +NAME = libcodec2 +AM_CPPFLAGS = $(AM_CFLAGS) + +bin_PROGRAMS = genres genlsp extract vqtrain tnlp tinterp tquant tcodec2 + + +genres_SOURCES = genres.c ../src/lpc.c ../src/codebook.c +genres_LDADD = $(lib_LTLIBRARIES) +genres_LDFLAGS = $(LIBS) + +genlsp_SOURCES = genlsp.c ../src/lpc.c ../src/lsp.c ../src/codebook.c +genlsp_LDADD = $(lib_LTLIBRARIES) +genlsp_LDFLAGS = $(LIBS) + +extract_SOURCES = extract.c ../src/codebook.c +extract_LDADD = $(lib_LTLIBRARIES) +extract_LDFLAGS = $(LIBS) + +vqtrain_SOURCES = vqtrain.c ../src/codebook.c +vqtrain_LDADD = $(lib_LTLIBRARIES) +vqtrain_LDFLAGS = $(LIBS) + +tnlp_SOURCES = tnlp.c ../src/sine.c ../src/nlp.c ../src/four1.c ../src/dump.c ../src/codebook.c +tnlp_LDADD = $(lib_LTLIBRARIES) +tnlp_LDFLAGS = $(LIBS) + +tinterp_SOURCES = tinterp.c ../src/sine.c ../src/four1.c ../src/interp.c ../src/codebook.c +tinterp_LDADD = $(lib_LTLIBRARIES) +tinterp_LDFLAGS = $(LIBS) + +tquant_SOURCES = tquant.c ../src/quantise.c ../src/lpc.c ../src/lsp.c ../src/dump.c ../src/four1.c ../src/codebook.c +tquant_LDADD = $(lib_LTLIBRARIES) +tquant_LDFLAGS = $(LIBS) + +tcodec2_SOURCES = tcodec2.c ../src/quantise.c ../src/lpc.c ../src/lsp.c ../src/dump.c ../src/four1.c \ +../src/codec2.c ../src/sine.c ../src/nlp.c ../src/postfilter.c ../src/phase.c ../src/interp.c ../src/pack.c ../src/codebook.c +tcodec2_LDADD = $(lib_LTLIBRARIES) +tcodec2_LDFLAGS = $(LIBS) + diff --git a/libs/libcodec2/unittest/Makefile.in b/libs/libcodec2/unittest/Makefile.in new file mode 100644 index 0000000..26ca1c9 --- /dev/null +++ b/libs/libcodec2/unittest/Makefile.in @@ -0,0 +1,735 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = genres$(EXEEXT) genlsp$(EXEEXT) extract$(EXEEXT) \ + vqtrain$(EXEEXT) tnlp$(EXEEXT) tinterp$(EXEEXT) \ + tquant$(EXEEXT) tcodec2$(EXEEXT) +subdir = unittest +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am_extract_OBJECTS = extract.$(OBJEXT) codebook.$(OBJEXT) +extract_OBJECTS = $(am_extract_OBJECTS) +extract_DEPENDENCIES = +am_genlsp_OBJECTS = genlsp.$(OBJEXT) lpc.$(OBJEXT) lsp.$(OBJEXT) \ + codebook.$(OBJEXT) +genlsp_OBJECTS = $(am_genlsp_OBJECTS) +genlsp_DEPENDENCIES = +am_genres_OBJECTS = genres.$(OBJEXT) lpc.$(OBJEXT) codebook.$(OBJEXT) +genres_OBJECTS = $(am_genres_OBJECTS) +genres_DEPENDENCIES = +am_tcodec2_OBJECTS = tcodec2.$(OBJEXT) quantise.$(OBJEXT) \ + lpc.$(OBJEXT) lsp.$(OBJEXT) dump.$(OBJEXT) four1.$(OBJEXT) \ + codec2.$(OBJEXT) sine.$(OBJEXT) nlp.$(OBJEXT) \ + postfilter.$(OBJEXT) phase.$(OBJEXT) interp.$(OBJEXT) \ + pack.$(OBJEXT) codebook.$(OBJEXT) +tcodec2_OBJECTS = $(am_tcodec2_OBJECTS) +tcodec2_DEPENDENCIES = +am_tinterp_OBJECTS = tinterp.$(OBJEXT) sine.$(OBJEXT) four1.$(OBJEXT) \ + interp.$(OBJEXT) codebook.$(OBJEXT) +tinterp_OBJECTS = $(am_tinterp_OBJECTS) +tinterp_DEPENDENCIES = +am_tnlp_OBJECTS = tnlp.$(OBJEXT) sine.$(OBJEXT) nlp.$(OBJEXT) \ + four1.$(OBJEXT) dump.$(OBJEXT) codebook.$(OBJEXT) +tnlp_OBJECTS = $(am_tnlp_OBJECTS) +tnlp_DEPENDENCIES = +am_tquant_OBJECTS = tquant.$(OBJEXT) quantise.$(OBJEXT) lpc.$(OBJEXT) \ + lsp.$(OBJEXT) dump.$(OBJEXT) four1.$(OBJEXT) \ + codebook.$(OBJEXT) +tquant_OBJECTS = $(am_tquant_OBJECTS) +tquant_DEPENDENCIES = +am_vqtrain_OBJECTS = vqtrain.$(OBJEXT) codebook.$(OBJEXT) +vqtrain_OBJECTS = $(am_vqtrain_OBJECTS) +vqtrain_DEPENDENCIES = +DEFAULT_INCLUDES = -I. -I$(srcdir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(extract_SOURCES) $(genlsp_SOURCES) $(genres_SOURCES) \ + $(tcodec2_SOURCES) $(tinterp_SOURCES) $(tnlp_SOURCES) \ + $(tquant_SOURCES) $(vqtrain_SOURCES) +DIST_SOURCES = $(extract_SOURCES) $(genlsp_SOURCES) $(genres_SOURCES) \ + $(tcodec2_SOURCES) $(tinterp_SOURCES) $(tnlp_SOURCES) \ + $(tquant_SOURCES) $(vqtrain_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GREP = @GREP@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +AM_CFLAGS = -I../src -g -DFLOATING_POINT -DVAR_ARRAYS +AUTOMAKE_OPTS = gnu +NAME = libcodec2 +AM_CPPFLAGS = $(AM_CFLAGS) +genres_SOURCES = genres.c ../src/lpc.c ../src/codebook.c +genres_LDADD = $(lib_LTLIBRARIES) +genres_LDFLAGS = $(LIBS) +genlsp_SOURCES = genlsp.c ../src/lpc.c ../src/lsp.c ../src/codebook.c +genlsp_LDADD = $(lib_LTLIBRARIES) +genlsp_LDFLAGS = $(LIBS) +extract_SOURCES = extract.c ../src/codebook.c +extract_LDADD = $(lib_LTLIBRARIES) +extract_LDFLAGS = $(LIBS) +vqtrain_SOURCES = vqtrain.c ../src/codebook.c +vqtrain_LDADD = $(lib_LTLIBRARIES) +vqtrain_LDFLAGS = $(LIBS) +tnlp_SOURCES = tnlp.c ../src/sine.c ../src/nlp.c ../src/four1.c ../src/dump.c ../src/codebook.c +tnlp_LDADD = $(lib_LTLIBRARIES) +tnlp_LDFLAGS = $(LIBS) +tinterp_SOURCES = tinterp.c ../src/sine.c ../src/four1.c ../src/interp.c ../src/codebook.c +tinterp_LDADD = $(lib_LTLIBRARIES) +tinterp_LDFLAGS = $(LIBS) +tquant_SOURCES = tquant.c ../src/quantise.c ../src/lpc.c ../src/lsp.c ../src/dump.c ../src/four1.c ../src/codebook.c +tquant_LDADD = $(lib_LTLIBRARIES) +tquant_LDFLAGS = $(LIBS) +tcodec2_SOURCES = tcodec2.c ../src/quantise.c ../src/lpc.c ../src/lsp.c ../src/dump.c ../src/four1.c \ +../src/codec2.c ../src/sine.c ../src/nlp.c ../src/postfilter.c ../src/phase.c ../src/interp.c ../src/pack.c ../src/codebook.c + +tcodec2_LDADD = $(lib_LTLIBRARIES) +tcodec2_LDFLAGS = $(LIBS) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu unittest/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu unittest/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +extract$(EXEEXT): $(extract_OBJECTS) $(extract_DEPENDENCIES) + @rm -f extract$(EXEEXT) + $(LINK) $(extract_LDFLAGS) $(extract_OBJECTS) $(extract_LDADD) $(LIBS) +genlsp$(EXEEXT): $(genlsp_OBJECTS) $(genlsp_DEPENDENCIES) + @rm -f genlsp$(EXEEXT) + $(LINK) $(genlsp_LDFLAGS) $(genlsp_OBJECTS) $(genlsp_LDADD) $(LIBS) +genres$(EXEEXT): $(genres_OBJECTS) $(genres_DEPENDENCIES) + @rm -f genres$(EXEEXT) + $(LINK) $(genres_LDFLAGS) $(genres_OBJECTS) $(genres_LDADD) $(LIBS) +tcodec2$(EXEEXT): $(tcodec2_OBJECTS) $(tcodec2_DEPENDENCIES) + @rm -f tcodec2$(EXEEXT) + $(LINK) $(tcodec2_LDFLAGS) $(tcodec2_OBJECTS) $(tcodec2_LDADD) $(LIBS) +tinterp$(EXEEXT): $(tinterp_OBJECTS) $(tinterp_DEPENDENCIES) + @rm -f tinterp$(EXEEXT) + $(LINK) $(tinterp_LDFLAGS) $(tinterp_OBJECTS) $(tinterp_LDADD) $(LIBS) +tnlp$(EXEEXT): $(tnlp_OBJECTS) $(tnlp_DEPENDENCIES) + @rm -f tnlp$(EXEEXT) + $(LINK) $(tnlp_LDFLAGS) $(tnlp_OBJECTS) $(tnlp_LDADD) $(LIBS) +tquant$(EXEEXT): $(tquant_OBJECTS) $(tquant_DEPENDENCIES) + @rm -f tquant$(EXEEXT) + $(LINK) $(tquant_LDFLAGS) $(tquant_OBJECTS) $(tquant_LDADD) $(LIBS) +vqtrain$(EXEEXT): $(vqtrain_OBJECTS) $(vqtrain_DEPENDENCIES) + @rm -f vqtrain$(EXEEXT) + $(LINK) $(vqtrain_LDFLAGS) $(vqtrain_OBJECTS) $(vqtrain_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/codebook.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/codec2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dump.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extract.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/four1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/genlsp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/genres.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lpc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nlp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pack.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/phase.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/postfilter.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quantise.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sine.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcodec2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tinterp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tnlp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tquant.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vqtrain.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +codebook.o: ../src/codebook.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT codebook.o -MD -MP -MF "$(DEPDIR)/codebook.Tpo" -c -o codebook.o `test -f '../src/codebook.c' || echo '$(srcdir)/'`../src/codebook.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/codebook.Tpo" "$(DEPDIR)/codebook.Po"; else rm -f "$(DEPDIR)/codebook.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/codebook.c' object='codebook.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o codebook.o `test -f '../src/codebook.c' || echo '$(srcdir)/'`../src/codebook.c + +codebook.obj: ../src/codebook.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT codebook.obj -MD -MP -MF "$(DEPDIR)/codebook.Tpo" -c -o codebook.obj `if test -f '../src/codebook.c'; then $(CYGPATH_W) '../src/codebook.c'; else $(CYGPATH_W) '$(srcdir)/../src/codebook.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/codebook.Tpo" "$(DEPDIR)/codebook.Po"; else rm -f "$(DEPDIR)/codebook.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/codebook.c' object='codebook.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o codebook.obj `if test -f '../src/codebook.c'; then $(CYGPATH_W) '../src/codebook.c'; else $(CYGPATH_W) '$(srcdir)/../src/codebook.c'; fi` + +lpc.o: ../src/lpc.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lpc.o -MD -MP -MF "$(DEPDIR)/lpc.Tpo" -c -o lpc.o `test -f '../src/lpc.c' || echo '$(srcdir)/'`../src/lpc.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lpc.Tpo" "$(DEPDIR)/lpc.Po"; else rm -f "$(DEPDIR)/lpc.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/lpc.c' object='lpc.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lpc.o `test -f '../src/lpc.c' || echo '$(srcdir)/'`../src/lpc.c + +lpc.obj: ../src/lpc.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lpc.obj -MD -MP -MF "$(DEPDIR)/lpc.Tpo" -c -o lpc.obj `if test -f '../src/lpc.c'; then $(CYGPATH_W) '../src/lpc.c'; else $(CYGPATH_W) '$(srcdir)/../src/lpc.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lpc.Tpo" "$(DEPDIR)/lpc.Po"; else rm -f "$(DEPDIR)/lpc.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/lpc.c' object='lpc.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lpc.obj `if test -f '../src/lpc.c'; then $(CYGPATH_W) '../src/lpc.c'; else $(CYGPATH_W) '$(srcdir)/../src/lpc.c'; fi` + +lsp.o: ../src/lsp.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lsp.o -MD -MP -MF "$(DEPDIR)/lsp.Tpo" -c -o lsp.o `test -f '../src/lsp.c' || echo '$(srcdir)/'`../src/lsp.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lsp.Tpo" "$(DEPDIR)/lsp.Po"; else rm -f "$(DEPDIR)/lsp.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/lsp.c' object='lsp.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lsp.o `test -f '../src/lsp.c' || echo '$(srcdir)/'`../src/lsp.c + +lsp.obj: ../src/lsp.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lsp.obj -MD -MP -MF "$(DEPDIR)/lsp.Tpo" -c -o lsp.obj `if test -f '../src/lsp.c'; then $(CYGPATH_W) '../src/lsp.c'; else $(CYGPATH_W) '$(srcdir)/../src/lsp.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lsp.Tpo" "$(DEPDIR)/lsp.Po"; else rm -f "$(DEPDIR)/lsp.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/lsp.c' object='lsp.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lsp.obj `if test -f '../src/lsp.c'; then $(CYGPATH_W) '../src/lsp.c'; else $(CYGPATH_W) '$(srcdir)/../src/lsp.c'; fi` + +quantise.o: ../src/quantise.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT quantise.o -MD -MP -MF "$(DEPDIR)/quantise.Tpo" -c -o quantise.o `test -f '../src/quantise.c' || echo '$(srcdir)/'`../src/quantise.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/quantise.Tpo" "$(DEPDIR)/quantise.Po"; else rm -f "$(DEPDIR)/quantise.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/quantise.c' object='quantise.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o quantise.o `test -f '../src/quantise.c' || echo '$(srcdir)/'`../src/quantise.c + +quantise.obj: ../src/quantise.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT quantise.obj -MD -MP -MF "$(DEPDIR)/quantise.Tpo" -c -o quantise.obj `if test -f '../src/quantise.c'; then $(CYGPATH_W) '../src/quantise.c'; else $(CYGPATH_W) '$(srcdir)/../src/quantise.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/quantise.Tpo" "$(DEPDIR)/quantise.Po"; else rm -f "$(DEPDIR)/quantise.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/quantise.c' object='quantise.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o quantise.obj `if test -f '../src/quantise.c'; then $(CYGPATH_W) '../src/quantise.c'; else $(CYGPATH_W) '$(srcdir)/../src/quantise.c'; fi` + +dump.o: ../src/dump.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dump.o -MD -MP -MF "$(DEPDIR)/dump.Tpo" -c -o dump.o `test -f '../src/dump.c' || echo '$(srcdir)/'`../src/dump.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/dump.Tpo" "$(DEPDIR)/dump.Po"; else rm -f "$(DEPDIR)/dump.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/dump.c' object='dump.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dump.o `test -f '../src/dump.c' || echo '$(srcdir)/'`../src/dump.c + +dump.obj: ../src/dump.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dump.obj -MD -MP -MF "$(DEPDIR)/dump.Tpo" -c -o dump.obj `if test -f '../src/dump.c'; then $(CYGPATH_W) '../src/dump.c'; else $(CYGPATH_W) '$(srcdir)/../src/dump.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/dump.Tpo" "$(DEPDIR)/dump.Po"; else rm -f "$(DEPDIR)/dump.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/dump.c' object='dump.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dump.obj `if test -f '../src/dump.c'; then $(CYGPATH_W) '../src/dump.c'; else $(CYGPATH_W) '$(srcdir)/../src/dump.c'; fi` + +four1.o: ../src/four1.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT four1.o -MD -MP -MF "$(DEPDIR)/four1.Tpo" -c -o four1.o `test -f '../src/four1.c' || echo '$(srcdir)/'`../src/four1.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/four1.Tpo" "$(DEPDIR)/four1.Po"; else rm -f "$(DEPDIR)/four1.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/four1.c' object='four1.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o four1.o `test -f '../src/four1.c' || echo '$(srcdir)/'`../src/four1.c + +four1.obj: ../src/four1.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT four1.obj -MD -MP -MF "$(DEPDIR)/four1.Tpo" -c -o four1.obj `if test -f '../src/four1.c'; then $(CYGPATH_W) '../src/four1.c'; else $(CYGPATH_W) '$(srcdir)/../src/four1.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/four1.Tpo" "$(DEPDIR)/four1.Po"; else rm -f "$(DEPDIR)/four1.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/four1.c' object='four1.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o four1.obj `if test -f '../src/four1.c'; then $(CYGPATH_W) '../src/four1.c'; else $(CYGPATH_W) '$(srcdir)/../src/four1.c'; fi` + +codec2.o: ../src/codec2.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT codec2.o -MD -MP -MF "$(DEPDIR)/codec2.Tpo" -c -o codec2.o `test -f '../src/codec2.c' || echo '$(srcdir)/'`../src/codec2.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/codec2.Tpo" "$(DEPDIR)/codec2.Po"; else rm -f "$(DEPDIR)/codec2.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/codec2.c' object='codec2.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o codec2.o `test -f '../src/codec2.c' || echo '$(srcdir)/'`../src/codec2.c + +codec2.obj: ../src/codec2.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT codec2.obj -MD -MP -MF "$(DEPDIR)/codec2.Tpo" -c -o codec2.obj `if test -f '../src/codec2.c'; then $(CYGPATH_W) '../src/codec2.c'; else $(CYGPATH_W) '$(srcdir)/../src/codec2.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/codec2.Tpo" "$(DEPDIR)/codec2.Po"; else rm -f "$(DEPDIR)/codec2.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/codec2.c' object='codec2.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o codec2.obj `if test -f '../src/codec2.c'; then $(CYGPATH_W) '../src/codec2.c'; else $(CYGPATH_W) '$(srcdir)/../src/codec2.c'; fi` + +sine.o: ../src/sine.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sine.o -MD -MP -MF "$(DEPDIR)/sine.Tpo" -c -o sine.o `test -f '../src/sine.c' || echo '$(srcdir)/'`../src/sine.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/sine.Tpo" "$(DEPDIR)/sine.Po"; else rm -f "$(DEPDIR)/sine.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/sine.c' object='sine.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sine.o `test -f '../src/sine.c' || echo '$(srcdir)/'`../src/sine.c + +sine.obj: ../src/sine.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT sine.obj -MD -MP -MF "$(DEPDIR)/sine.Tpo" -c -o sine.obj `if test -f '../src/sine.c'; then $(CYGPATH_W) '../src/sine.c'; else $(CYGPATH_W) '$(srcdir)/../src/sine.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/sine.Tpo" "$(DEPDIR)/sine.Po"; else rm -f "$(DEPDIR)/sine.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/sine.c' object='sine.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sine.obj `if test -f '../src/sine.c'; then $(CYGPATH_W) '../src/sine.c'; else $(CYGPATH_W) '$(srcdir)/../src/sine.c'; fi` + +nlp.o: ../src/nlp.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nlp.o -MD -MP -MF "$(DEPDIR)/nlp.Tpo" -c -o nlp.o `test -f '../src/nlp.c' || echo '$(srcdir)/'`../src/nlp.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/nlp.Tpo" "$(DEPDIR)/nlp.Po"; else rm -f "$(DEPDIR)/nlp.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/nlp.c' object='nlp.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nlp.o `test -f '../src/nlp.c' || echo '$(srcdir)/'`../src/nlp.c + +nlp.obj: ../src/nlp.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nlp.obj -MD -MP -MF "$(DEPDIR)/nlp.Tpo" -c -o nlp.obj `if test -f '../src/nlp.c'; then $(CYGPATH_W) '../src/nlp.c'; else $(CYGPATH_W) '$(srcdir)/../src/nlp.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/nlp.Tpo" "$(DEPDIR)/nlp.Po"; else rm -f "$(DEPDIR)/nlp.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/nlp.c' object='nlp.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nlp.obj `if test -f '../src/nlp.c'; then $(CYGPATH_W) '../src/nlp.c'; else $(CYGPATH_W) '$(srcdir)/../src/nlp.c'; fi` + +postfilter.o: ../src/postfilter.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT postfilter.o -MD -MP -MF "$(DEPDIR)/postfilter.Tpo" -c -o postfilter.o `test -f '../src/postfilter.c' || echo '$(srcdir)/'`../src/postfilter.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/postfilter.Tpo" "$(DEPDIR)/postfilter.Po"; else rm -f "$(DEPDIR)/postfilter.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/postfilter.c' object='postfilter.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o postfilter.o `test -f '../src/postfilter.c' || echo '$(srcdir)/'`../src/postfilter.c + +postfilter.obj: ../src/postfilter.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT postfilter.obj -MD -MP -MF "$(DEPDIR)/postfilter.Tpo" -c -o postfilter.obj `if test -f '../src/postfilter.c'; then $(CYGPATH_W) '../src/postfilter.c'; else $(CYGPATH_W) '$(srcdir)/../src/postfilter.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/postfilter.Tpo" "$(DEPDIR)/postfilter.Po"; else rm -f "$(DEPDIR)/postfilter.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/postfilter.c' object='postfilter.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o postfilter.obj `if test -f '../src/postfilter.c'; then $(CYGPATH_W) '../src/postfilter.c'; else $(CYGPATH_W) '$(srcdir)/../src/postfilter.c'; fi` + +phase.o: ../src/phase.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT phase.o -MD -MP -MF "$(DEPDIR)/phase.Tpo" -c -o phase.o `test -f '../src/phase.c' || echo '$(srcdir)/'`../src/phase.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/phase.Tpo" "$(DEPDIR)/phase.Po"; else rm -f "$(DEPDIR)/phase.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/phase.c' object='phase.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o phase.o `test -f '../src/phase.c' || echo '$(srcdir)/'`../src/phase.c + +phase.obj: ../src/phase.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT phase.obj -MD -MP -MF "$(DEPDIR)/phase.Tpo" -c -o phase.obj `if test -f '../src/phase.c'; then $(CYGPATH_W) '../src/phase.c'; else $(CYGPATH_W) '$(srcdir)/../src/phase.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/phase.Tpo" "$(DEPDIR)/phase.Po"; else rm -f "$(DEPDIR)/phase.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/phase.c' object='phase.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o phase.obj `if test -f '../src/phase.c'; then $(CYGPATH_W) '../src/phase.c'; else $(CYGPATH_W) '$(srcdir)/../src/phase.c'; fi` + +interp.o: ../src/interp.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT interp.o -MD -MP -MF "$(DEPDIR)/interp.Tpo" -c -o interp.o `test -f '../src/interp.c' || echo '$(srcdir)/'`../src/interp.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/interp.Tpo" "$(DEPDIR)/interp.Po"; else rm -f "$(DEPDIR)/interp.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/interp.c' object='interp.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o interp.o `test -f '../src/interp.c' || echo '$(srcdir)/'`../src/interp.c + +interp.obj: ../src/interp.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT interp.obj -MD -MP -MF "$(DEPDIR)/interp.Tpo" -c -o interp.obj `if test -f '../src/interp.c'; then $(CYGPATH_W) '../src/interp.c'; else $(CYGPATH_W) '$(srcdir)/../src/interp.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/interp.Tpo" "$(DEPDIR)/interp.Po"; else rm -f "$(DEPDIR)/interp.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/interp.c' object='interp.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o interp.obj `if test -f '../src/interp.c'; then $(CYGPATH_W) '../src/interp.c'; else $(CYGPATH_W) '$(srcdir)/../src/interp.c'; fi` + +pack.o: ../src/pack.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pack.o -MD -MP -MF "$(DEPDIR)/pack.Tpo" -c -o pack.o `test -f '../src/pack.c' || echo '$(srcdir)/'`../src/pack.c; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pack.Tpo" "$(DEPDIR)/pack.Po"; else rm -f "$(DEPDIR)/pack.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/pack.c' object='pack.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pack.o `test -f '../src/pack.c' || echo '$(srcdir)/'`../src/pack.c + +pack.obj: ../src/pack.c +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT pack.obj -MD -MP -MF "$(DEPDIR)/pack.Tpo" -c -o pack.obj `if test -f '../src/pack.c'; then $(CYGPATH_W) '../src/pack.c'; else $(CYGPATH_W) '$(srcdir)/../src/pack.c'; fi`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/pack.Tpo" "$(DEPDIR)/pack.Po"; else rm -f "$(DEPDIR)/pack.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/pack.c' object='pack.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o pack.obj `if test -f '../src/pack.c'; then $(CYGPATH_W) '../src/pack.c'; else $(CYGPATH_W) '$(srcdir)/../src/pack.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-binPROGRAMS + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool ctags distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-binPROGRAMS install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libs/libcodec2/unittest/extract.c b/libs/libcodec2/unittest/extract.c new file mode 100644 index 0000000..b7544ed --- /dev/null +++ b/libs/libcodec2/unittest/extract.c @@ -0,0 +1,121 @@ +/*--------------------------------------------------------------------------*\ + + FILE........: extract.c + AUTHOR......: David Rowe + DATE CREATED: 23/2/95 + + This program extracts a float file of vectors from a text file + of vectors. The float files are easier to process quickly + during VQ training. A subset of the text file VQ may be + extracted to faciltate split VQ of scaler VQ design. + +\*--------------------------------------------------------------------------*/ + +/* + Copyright (C) 2009 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#define MAX_STR 256 /* maximum string length */ + +#include <stdio.h> +#include <stdlib.h> +#include <ctype.h> + +void scan_line(FILE *fp, float f[], int n); + +int main(int argc, char *argv[]) { + FILE *ftext; /* text file of vectors */ + FILE *ffloat; /* float file of vectors */ + int st,en; /* start and end values of vector to copy */ + float *buf; /* ptr to vector read from ftext */ + long lines; /* lines read so far */ + + if (argc != 5) { + printf("usage: extract TextFile FloatFile start end\n"); + exit(0); + } + + /* read command line arguments and open files */ + + ftext = fopen(argv[1],"rt"); + if (ftext == NULL) { + printf("Error opening text file: %s\n",argv[1]); + exit(1); + } + + ffloat = fopen(argv[2],"wb"); + if (ffloat == NULL) { + printf("Error opening float file: %s\n",argv[2]); + exit(1); + } + + st = atoi(argv[3]); + en = atoi(argv[4]); + + buf = (float*)malloc(en*sizeof(float)); + if (buf == NULL) { + printf("Error in malloc()\n"); + exit(1); + } + + lines = 0; + while(!feof(ftext)) { + scan_line(ftext, buf, en); + fwrite(&buf[st-1], sizeof(float), en-st+1, ffloat); + printf("\r%ld lines",lines++); + } + printf("\n"); + + /* clean up and exit */ + + free(buf); + fclose(ftext); + fclose(ffloat); + + return 0; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: scan_line() + + AUTHOR......: David Rowe + DATE CREATED: 20/2/95 + + This function reads a vector of floats from a line in a text file. + +\*---------------------------------------------------------------------------*/ + +void scan_line(FILE *fp, float f[], int n) +/* FILE *fp; file ptr to text file */ +/* float f[]; array of floats to return */ +/* int n; number of floats in line */ +{ + char s[MAX_STR]; + char *ps,*pe; + int i; + + fgets(s,MAX_STR,fp); + ps = pe = s; + for(i=0; i<n; i++) { + while( isspace(*pe)) pe++; + while( !isspace(*pe)) pe++; + sscanf(ps,"%f",&f[i]); + ps = pe; + } +} + diff --git a/libs/libcodec2/unittest/genlsp.c b/libs/libcodec2/unittest/genlsp.c new file mode 100644 index 0000000..8340e2f --- /dev/null +++ b/libs/libcodec2/unittest/genlsp.c @@ -0,0 +1,149 @@ +/*--------------------------------------------------------------------------*\ + + FILE........: genlsp.c + AUTHOR......: David Rowe + DATE CREATED: 23/2/95 + + This program genrates a text file of LSP vectors from an input + speech file. + +\*--------------------------------------------------------------------------*/ + +/* + Copyright (C) 2009 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#define P 10 /* LP order */ +#define LSP_DELTA1 0.05 /* grid spacing for LSP root searches */ +#define NW 279 /* frame size in samples */ +#define N 80 /* frame to frame shift */ +#define THRESH 40.0 /* threshold energy/sample for frame inclusion */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <math.h> +#include "lpc.h" /* LPC analysis functions */ +#include "lsp.h" /* LSP encode/decode functions */ + +int switch_present(sw,argc,argv) + char sw[]; /* switch in string form */ + int argc; /* number of command line arguments */ + char *argv[]; /* array of command line arguments in string form */ +{ + int i; /* loop variable */ + + for(i=1; i<argc; i++) + if (!strcmp(sw,argv[i])) + return(i); + + return 0; +} + +int main(int argc, char *argv[]) { + FILE *fspc; /* input file ptr for test database */ + FILE *flsp; /* output text file of LSPs */ + short buf[N]; /* input frame of speech samples */ + float Sn[NW]; /* float input speech samples */ + float ak[P+1]; /* LPCs for current frame */ + float lsp[P]; /* LSPs for current frame */ + float E; /* frame energy */ + long af; /* number frames with "active" speech */ + float Eres; /* LPC residual energy */ + int i; + int roots; + int unstables; + int lspd; + + /* Initialise ------------------------------------------------------*/ + + if (argc < 3) { + printf("usage: gentest RawFile LSPTextFile [--lspd]\n"); + exit(0); + } + + /* Open files */ + + fspc = fopen(argv[1],"rb"); + if (fspc == NULL) { + printf("Error opening input SPC file: %s",argv[1]); + exit(1); + } + + flsp = fopen(argv[2],"wt"); + if (flsp == NULL) { + printf("Error opening output LSP file: %s",argv[2]); + exit(1); + } + + lspd = switch_present("--lspd", argc, argv); + + for(i=0; i<NW; i++) + Sn[i] = 0.0; + + /* Read SPC file, and determine aks[] for each frame ------------------*/ + + af = 0; + unstables = 0; + while(fread(buf,sizeof(short),N,fspc) == N) { + + for(i=0; i<NW-N; i++) + Sn[i] = Sn[i+N]; + E = 0.0; + for(i=0; i<N; i++) { + Sn[i+NW-N] = buf[i]; + E += Sn[i]*Sn[i]; + } + + E = 0.0; + for(i=0; i<NW; i++) { + E += Sn[i]*Sn[i]; + } + E = 10.0*log10(E/NW); + + /* If energy high enough, include this frame */ + + if (E > THRESH) { + af++; + printf("Active Frame: %ld unstables: %d\n",af, unstables); + + find_aks(Sn, ak, NW, P, &Eres); + roots = lpc_to_lsp(&ak[1], P , lsp, 5, LSP_DELTA1); + if (roots == P) { + if (lspd) { + fprintf(flsp,"%f ",lsp[0]); + for(i=1; i<P; i++) + fprintf(flsp,"%f ",lsp[i]-lsp[i-1]); + fprintf(flsp,"\n"); + } + else { + for(i=0; i<P; i++) + fprintf(flsp,"%f ",lsp[i]); + fprintf(flsp,"\n"); + } + } + else + unstables++; + } + } + + fclose(fspc); + fclose(flsp); + + return 0; +} + diff --git a/libs/libcodec2/unittest/genres.c b/libs/libcodec2/unittest/genres.c new file mode 100644 index 0000000..8e5a266 --- /dev/null +++ b/libs/libcodec2/unittest/genres.c @@ -0,0 +1,92 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: genres.c + AUTHOR......: David Rowe + DATE CREATED: 24/8/09 + + Generates a file of LPC residual samples from original speech. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2009 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <stdio.h> +#include <stdlib.h> +#include <lpc.h> + +#define N 160 +#define P 10 + +int main(int argc, char *argv[]) +{ + FILE *fin,*fres; /* input and output files */ + short buf[N]; /* buffer of 16 bit speech samples */ + float Sn[P+N]; /* input speech samples */ + float res[N]; /* residual after LPC filtering */ + float E; + float ak[P+1]; /* LP coeffs */ + + int frames; /* frames processed so far */ + int i; /* loop variables */ + + if (argc < 3) { + printf("usage: %s InputFile ResidualFile\n", argv[0]); + exit(0); + } + + /* Open files */ + + if ((fin = fopen(argv[1],"rb")) == NULL) { + printf("Error opening input file: %s\n",argv[1]); + exit(0); + } + + if ((fres = fopen(argv[2],"wb")) == NULL) { + printf("Error opening output residual file: %s\n",argv[2]); + exit(0); + } + + /* Initialise */ + + frames = 0; + for(i=0; i<P; i++) { + Sn[i] = 0.0; + } + + /* Main loop */ + + while( (fread(buf,sizeof(short),N,fin)) == N) { + frames++; + for(i=0; i<N; i++) + Sn[P+i] = (float)buf[i]; + + /* Determine {ak} and filter to find residual */ + + find_aks(&Sn[P], ak, N, P, &E); + inverse_filter(&Sn[P], ak, N, res, P); + for(i=0; i<N; i++) + buf[i] = (short)res[i]; + fwrite(buf,sizeof(short),N,fres); + } + + fclose(fin); + fclose(fres); + + return 0; +} diff --git a/libs/libcodec2/unittest/lsp1.txt b/libs/libcodec2/unittest/lsp1.txt new file mode 100644 index 0000000..88995de --- /dev/null +++ b/libs/libcodec2/unittest/lsp1.txt @@ -0,0 +1,16 @@ +225 +250 +275 +300 +325 +350 +375 +400 +425 +450 +475 +500 +525 +550 +575 +600 diff --git a/libs/libcodec2/unittest/lsp10.txt b/libs/libcodec2/unittest/lsp10.txt new file mode 100644 index 0000000..1f1129b --- /dev/null +++ b/libs/libcodec2/unittest/lsp10.txt @@ -0,0 +1,5 @@ +2900 +3100 +3300 +3500 + diff --git a/libs/libcodec2/unittest/lsp2.txt b/libs/libcodec2/unittest/lsp2.txt new file mode 100644 index 0000000..a5d9860 --- /dev/null +++ b/libs/libcodec2/unittest/lsp2.txt @@ -0,0 +1,16 @@ +325 +350 +375 +400 +425 +450 +475 +500 +525 +550 +575 +600 +625 +650 +675 +700 diff --git a/libs/libcodec2/unittest/lsp3.txt b/libs/libcodec2/unittest/lsp3.txt new file mode 100644 index 0000000..6fde10c --- /dev/null +++ b/libs/libcodec2/unittest/lsp3.txt @@ -0,0 +1,16 @@ +500 +550 +600 +650 +700 +750 +800 +850 +900 +950 +1000 +1050 +1100 +1150 +1200 +1250 diff --git a/libs/libcodec2/unittest/lsp4.txt b/libs/libcodec2/unittest/lsp4.txt new file mode 100644 index 0000000..7eae7f8 --- /dev/null +++ b/libs/libcodec2/unittest/lsp4.txt @@ -0,0 +1,16 @@ +700 +800 +900 +1000 +1100 +1200 +1300 +1400 +1500 +1600 +1700 +1800 +1900 +2000 +2100 +2200 diff --git a/libs/libcodec2/unittest/lsp5.txt b/libs/libcodec2/unittest/lsp5.txt new file mode 100644 index 0000000..05d7221 --- /dev/null +++ b/libs/libcodec2/unittest/lsp5.txt @@ -0,0 +1,18 @@ + 950 +1050 +1150 +1250 +1350 +1450 +1550 +1650 +1750 +1850 +1950 +2050 +2150 +2250 +2350 +2450 + + diff --git a/libs/libcodec2/unittest/lsp6.txt b/libs/libcodec2/unittest/lsp6.txt new file mode 100644 index 0000000..d1207ff --- /dev/null +++ b/libs/libcodec2/unittest/lsp6.txt @@ -0,0 +1,18 @@ +1100 +1200 +1300 +1400 +1500 +1600 +1700 +1800 +1900 +2000 +2100 +2200 +2300 +2400 +2500 +2600 + + diff --git a/libs/libcodec2/unittest/lsp7.txt b/libs/libcodec2/unittest/lsp7.txt new file mode 100644 index 0000000..1f6eaa6 --- /dev/null +++ b/libs/libcodec2/unittest/lsp7.txt @@ -0,0 +1,18 @@ +1500 +1600 +1700 +1800 +1900 +2000 +2100 +2200 +2300 +2400 +2500 +2600 +2700 +2800 +2900 +3000 + + diff --git a/libs/libcodec2/unittest/lsp8.txt b/libs/libcodec2/unittest/lsp8.txt new file mode 100644 index 0000000..89607c8 --- /dev/null +++ b/libs/libcodec2/unittest/lsp8.txt @@ -0,0 +1,10 @@ +2300 +2400 +2500 +2600 +2700 +2800 +2900 +3000 + + diff --git a/libs/libcodec2/unittest/lsp9.txt b/libs/libcodec2/unittest/lsp9.txt new file mode 100644 index 0000000..82be58c --- /dev/null +++ b/libs/libcodec2/unittest/lsp9.txt @@ -0,0 +1,10 @@ +2500 +2600 +2700 +2800 +2900 +3000 +3100 +3200 + + diff --git a/libs/libcodec2/unittest/lspd123.txt b/libs/libcodec2/unittest/lspd123.txt new file mode 100644 index 0000000..423871c --- /dev/null +++ b/libs/libcodec2/unittest/lspd123.txt @@ -0,0 +1,1024 @@ +0.263308 0.108769 0.321376 +0.258448 0.055984 0.230859 +0.266067 0.060719 0.217388 +0.280055 0.057994 0.244228 +0.266912 0.064695 0.265145 +0.271651 0.079610 0.259575 +0.226822 0.156621 0.158998 +0.156949 0.052659 0.212653 +0.166041 0.209329 0.265886 +0.308633 0.053423 0.276948 +0.332112 0.035457 0.286972 +0.339533 0.040123 0.272290 +0.330792 0.023602 0.274813 +0.316456 0.037932 0.249650 +0.287286 0.046071 0.242200 +0.261514 0.049979 0.284344 +0.214376 0.103675 0.338804 +0.188651 0.116868 0.328440 +0.177177 0.072134 0.154176 +0.199766 0.183234 0.706565 +0.350628 0.229826 0.529061 +0.297560 0.045946 0.288017 +0.314602 0.041640 0.200681 +0.348282 0.038714 0.240448 +0.381632 0.043026 0.229469 +0.401854 0.029415 0.202430 +0.408573 0.044563 0.177371 +0.424312 0.067150 0.184192 +0.428423 0.056620 0.165082 +0.443482 0.038789 0.168832 +0.432034 0.046019 0.195869 +0.472514 0.052971 0.175566 +0.445147 0.060539 0.186875 +0.447305 0.043459 0.217896 +0.418837 0.064057 0.224309 +0.394427 0.072473 0.216686 +0.372086 0.031878 0.245392 +0.335537 0.047914 0.232315 +0.307720 0.076985 0.263440 +0.212588 0.199799 0.241274 +0.177978 0.061936 0.419219 +0.184726 0.071514 0.295235 +0.179928 0.120561 0.197113 +0.194093 0.091120 0.307566 +0.238704 0.088264 0.256089 +0.256704 0.056376 0.272029 +0.245826 0.056285 0.221666 +0.252157 0.069875 0.209436 +0.293844 0.058822 0.205688 +0.333145 0.032022 0.198412 +0.374122 0.058501 0.198354 +0.388622 0.055018 0.174356 +0.402915 0.069231 0.171417 +0.409007 0.055048 0.195699 +0.393180 0.068521 0.192734 +0.378148 0.042573 0.211319 +0.364531 0.032711 0.200555 +0.346684 0.053755 0.199507 +0.303076 0.088318 0.231307 +0.308105 0.120302 0.271168 +0.275060 0.183236 0.280609 +0.191607 0.254478 0.333707 +0.415869 0.157513 0.330550 +0.466958 0.126641 0.345873 +0.393315 0.137590 0.278630 +0.367297 0.215695 0.295962 +0.209423 0.343791 0.353190 +0.239247 0.069127 0.351070 +0.219601 0.067725 0.316134 +0.183085 0.108910 0.288046 +0.141405 0.106410 0.374917 +0.340773 0.180383 0.280306 +0.324313 0.206337 0.392025 +0.377497 0.310052 0.251511 +0.369942 0.206976 0.403513 +0.391822 0.165248 0.458238 +0.402392 0.132235 0.391573 +0.363609 0.109018 0.385179 +0.393092 0.150649 0.690282 +0.248424 0.072260 0.403322 +0.258842 0.062838 0.331583 +0.277543 0.023397 0.334487 +0.259767 0.019332 0.283729 +0.277333 0.022787 0.286736 +0.278562 0.034487 0.253401 +0.294439 0.029548 0.223983 +0.306420 0.021466 0.246669 +0.311799 0.029621 0.232167 +0.314573 0.026307 0.211228 +0.322046 0.036979 0.185969 +0.340920 0.051908 0.181885 +0.378651 0.100615 0.150541 +0.362534 0.107177 0.127000 +0.366188 0.118540 0.096115 +0.335906 0.123585 0.100436 +0.289660 0.136844 0.121618 +0.234449 0.115458 0.142944 +0.234687 0.112186 0.213379 +0.218786 0.097113 0.246862 +0.230751 0.090415 0.225856 +0.249914 0.071568 0.228974 +0.239316 0.089091 0.205158 +0.235823 0.092666 0.179934 +0.260464 0.077785 0.193877 +0.245534 0.073180 0.169632 +0.285464 0.081401 0.206102 +0.272122 0.072806 0.177335 +0.256928 0.066768 0.151148 +0.259615 0.074334 0.119038 +0.285004 0.089415 0.117455 +0.326626 0.085390 0.097219 +0.322959 0.072295 0.114366 +0.342931 0.060610 0.112868 +0.349890 0.057216 0.138586 +0.347363 0.058881 0.164623 +0.358032 0.064472 0.175272 +0.357807 0.072462 0.156002 +0.336895 0.066119 0.134206 +0.337276 0.073707 0.151129 +0.326144 0.057722 0.152109 +0.287242 0.055461 0.172280 +0.233531 0.070892 0.220511 +0.247128 0.049358 0.274502 +0.224586 0.046013 0.357086 +0.229675 0.045704 0.405370 +0.272311 0.072851 0.349441 +0.262378 0.048277 0.301490 +0.272410 0.052304 0.234698 +0.296903 0.047644 0.225221 +0.308756 0.052127 0.222936 +0.336122 0.044504 0.193011 +0.365030 0.064659 0.137103 +0.372444 0.036236 0.135129 +0.379957 0.052989 0.104509 +0.395033 0.063805 0.099117 +0.395331 0.016167 0.079401 +0.361374 0.077860 0.067214 +0.366584 0.051942 0.030922 +0.417962 0.076156 0.084209 +0.376593 0.111196 0.068356 +0.321411 0.091882 0.063007 +0.335365 0.070341 0.082301 +0.348707 0.075437 0.099469 +0.292758 0.061200 0.121062 +0.277998 0.061337 0.145208 +0.272000 0.072048 0.230783 +0.206511 0.121757 0.280188 +0.162259 0.031322 0.393199 +0.200906 0.088613 0.124277 +0.184134 0.084894 0.197393 +0.290246 0.077754 0.223919 +0.263962 0.059362 0.091101 +0.317773 0.055238 0.129435 +0.356413 0.042508 0.107483 +0.365057 0.023078 0.085620 +0.411914 0.048078 0.093016 +0.419049 0.030016 0.101357 +0.436160 0.024666 0.066348 +0.436704 0.046967 0.092223 +0.494088 0.068777 0.102742 +0.470076 0.075909 0.074128 +0.451110 0.088014 0.089431 +0.487849 0.092611 0.051933 +0.533716 0.041322 0.035398 +0.457297 0.061196 0.094392 +0.434718 0.062690 0.099115 +0.432830 0.099336 0.064658 +0.445522 0.032508 0.029007 +0.435059 0.064532 0.071763 +0.400424 0.095239 0.052280 +0.394880 0.061922 0.073728 +0.341705 0.050045 0.060238 +0.382169 0.078170 0.085591 +0.375733 0.095367 0.086298 +0.367753 0.093088 0.107387 +0.355679 0.126981 0.119866 +0.183195 0.178369 0.154227 +0.215939 0.281661 0.137611 +0.255382 0.232429 0.090575 +0.294261 0.198828 0.092855 +0.358379 0.158423 0.138468 +0.380219 0.176473 0.110948 +0.305047 0.161007 0.139954 +0.262435 0.236041 0.144567 +0.354204 0.222414 0.107065 +0.345190 0.184018 0.124352 +0.338177 0.204525 0.067254 +0.305092 0.238787 0.094788 +0.351980 0.224928 0.156944 +0.345016 0.185595 0.192659 +0.337844 0.184025 0.160326 +0.359544 0.217341 0.327157 +0.357648 0.230240 0.366907 +0.395642 0.165926 0.261342 +0.343546 0.156618 0.223511 +0.361635 0.096729 0.184236 +0.415440 0.076743 0.154942 +0.431066 0.076513 0.121105 +0.451174 0.082936 0.112437 +0.495682 0.125322 0.083250 +0.457920 0.105206 0.069372 +0.428288 0.096431 0.099719 +0.402112 0.089533 0.102279 +0.374406 0.069315 0.151993 +0.341303 0.072495 0.181235 +0.288181 0.130601 0.149994 +0.437823 0.194847 0.236998 +0.517891 0.162410 0.219232 +0.458004 0.239400 0.097958 +0.500390 0.177654 0.095729 +0.362675 0.278449 0.190598 +0.273868 0.085220 0.143261 +0.337997 0.064583 0.239703 +0.368143 0.045688 0.271347 +0.379949 0.029454 0.196794 +0.353352 0.028491 0.129485 +0.352112 0.017867 0.185794 +0.346936 0.025652 0.201147 +0.313751 0.022409 0.193629 +0.310985 0.028334 0.172877 +0.224772 0.055169 0.272269 +0.241855 0.030040 0.280276 +0.228564 0.021920 0.257200 +0.227718 0.054195 0.234162 +0.238926 0.054818 0.264076 +0.237314 0.075502 0.320709 +0.270880 0.085558 0.331728 +0.256455 0.080580 0.308559 +0.287309 0.097558 0.267753 +0.290763 0.080224 0.284406 +0.283022 0.068509 0.295506 +0.275270 0.069930 0.316990 +0.303843 0.092797 0.344720 +0.295250 0.075062 0.317300 +0.304161 0.067487 0.286738 +0.324174 0.057767 0.264031 +0.327890 0.076403 0.220917 +0.357965 0.072263 0.193322 +0.369869 0.059126 0.176957 +0.380683 0.051077 0.189741 +0.377526 0.045779 0.169338 +0.362044 0.051634 0.203021 +0.349094 0.041532 0.208466 +0.350344 0.021300 0.239499 +0.325966 0.026791 0.230178 +0.322013 0.042984 0.214929 +0.290199 0.049255 0.255248 +0.268860 0.057260 0.292111 +0.254110 0.065897 0.262323 +0.240555 0.081414 0.242131 +0.214107 0.099448 0.291511 +0.227603 0.116971 0.293158 +0.242687 0.099576 0.273347 +0.212057 0.080928 0.206493 +0.216818 0.054102 0.208481 +0.244560 0.059543 0.241185 +0.244893 0.055478 0.253047 +0.252424 0.044367 0.250846 +0.232805 0.046411 0.221492 +0.259503 0.030997 0.257981 +0.258163 0.036285 0.290086 +0.255400 0.060582 0.318764 +0.231850 0.078839 0.288307 +0.236986 0.070470 0.304299 +0.213303 0.073593 0.296093 +0.205272 0.040867 0.334217 +0.186676 0.036373 0.251392 +0.217783 0.043270 0.241924 +0.214511 0.052788 0.255946 +0.208572 0.053861 0.286926 +0.242888 0.106360 0.347276 +0.288960 0.124946 0.201239 +0.342775 0.093960 0.144984 +0.377197 0.085376 0.129922 +0.412166 0.088434 0.132108 +0.390249 0.076679 0.114031 +0.383989 0.062449 0.122055 +0.387523 0.079554 0.156435 +0.379580 0.077513 0.179594 +0.314430 0.087760 0.175421 +0.294579 0.101436 0.212711 +0.307017 0.089327 0.197301 +0.305232 0.075488 0.208874 +0.313937 0.065084 0.223413 +0.318828 0.066585 0.241867 +0.319064 0.044985 0.234334 +0.327293 0.054936 0.224270 +0.313956 0.059037 0.208250 +0.320067 0.067497 0.178744 +0.325844 0.051785 0.249839 +0.291419 0.140846 0.176356 +0.304736 0.257499 0.321206 +0.412538 0.193653 0.527310 +0.464326 0.177155 0.484639 +0.388370 0.247578 0.270502 +0.309708 0.243245 0.219685 +0.267637 0.120670 0.182524 +0.333329 0.064619 0.195862 +0.337853 0.035063 0.182235 +0.363054 0.041039 0.161560 +0.346506 0.045356 0.166242 +0.343175 0.032640 0.168740 +0.329834 0.040738 0.160952 +0.327688 0.025263 0.170543 +0.337286 0.032068 0.148672 +0.352876 0.027518 0.154928 +0.355731 0.040489 0.143599 +0.360021 0.052552 0.125346 +0.379432 0.019637 0.116855 +0.389556 0.033257 0.172091 +0.388615 0.005982 0.167184 +0.380871 0.031560 0.161735 +0.370428 0.034266 0.174805 +0.364127 0.028565 0.187409 +0.354946 0.032953 0.173018 +0.355197 0.019611 0.169606 +0.317361 0.028988 0.147085 +0.272330 0.043511 0.120042 +0.266965 0.057786 0.178702 +0.218195 0.094896 0.158774 +0.210802 0.102337 0.189513 +0.233979 0.076536 0.270353 +0.202083 0.169732 0.380558 +0.239441 0.172991 0.265931 +0.276190 0.226470 0.297090 +0.261790 0.365551 0.166357 +0.291971 0.099794 0.304947 +0.299131 0.063916 0.222310 +0.286582 0.041561 0.230600 +0.291056 0.054960 0.304060 +0.275948 0.057784 0.330696 +0.309766 0.028970 0.340314 +0.294102 0.043690 0.317927 +0.309171 0.030830 0.307374 +0.307411 0.020232 0.279361 +0.330913 0.034844 0.243337 +0.332192 0.027616 0.212354 +0.350338 0.039211 0.192995 +0.354502 0.055994 0.189121 +0.341296 0.073283 0.165587 +0.313181 0.094281 0.118029 +0.258194 0.134394 0.161487 +0.211766 0.110672 0.388399 +0.180619 0.089602 0.393854 +0.207652 0.057423 0.402186 +0.248737 0.121119 0.265945 +0.257647 0.145656 0.128647 +0.273116 0.146530 0.091939 +0.258193 0.186626 0.065391 +0.306617 0.177781 0.064168 +0.347651 0.163069 0.074409 +0.357362 0.133103 0.066344 +0.284876 0.117297 0.059904 +0.329676 0.124514 0.067178 +0.347508 0.100037 0.082550 +0.223342 0.163723 0.106806 +0.242615 0.106352 0.107873 +0.278081 0.104596 0.093439 +0.308805 0.106582 0.092192 +0.299730 0.076828 0.096766 +0.240110 0.112476 0.067117 +0.231410 0.073181 0.088404 +0.187246 0.100727 0.078664 +0.193716 0.126844 0.159078 +0.094366 0.454024 0.291647 +0.440203 0.228612 0.310365 +0.456753 0.186484 0.299839 +0.308520 0.205526 0.313406 +0.228109 0.069024 0.190235 +0.251018 0.045216 0.163280 +0.273421 0.051226 0.164458 +0.293630 0.030524 0.175355 +0.298281 0.027483 0.155763 +0.301235 0.032609 0.127618 +0.295114 0.036459 0.089043 +0.321284 0.052688 0.103598 +0.323611 0.031672 0.118877 +0.338816 0.045778 0.089024 +0.310812 0.060414 0.075229 +0.277050 0.068429 0.061631 +0.331845 0.057911 0.166403 +0.357599 0.078369 0.229133 +0.267510 0.109542 0.134427 +0.288685 0.206571 0.249532 +0.359999 0.229179 0.199289 +0.400078 0.178102 0.233727 +0.416741 0.100494 0.304150 +0.427570 0.154323 0.369992 +0.256414 0.275755 0.244236 +0.175186 0.345607 0.170933 +0.324895 0.207437 0.260709 +0.314928 0.217055 0.179225 +0.375454 0.184067 0.158251 +0.461676 0.155360 0.119282 +0.421915 0.134009 0.232978 +0.373661 0.177682 0.207681 +0.135194 0.242891 0.321398 +0.321335 0.077009 0.197895 +0.338990 0.031707 0.225496 +0.324230 0.087363 0.236806 +0.270364 0.162874 0.154703 +0.241859 0.198105 0.177328 +0.257345 0.254782 0.195962 +0.199872 0.236295 0.186694 +0.245869 0.190731 0.141457 +0.335308 0.137010 0.136606 +0.408226 0.106606 0.149159 +0.428609 0.091994 0.166467 +0.472127 0.089046 0.165746 +0.498132 0.086762 0.208918 +0.481551 0.029402 0.264176 +0.482803 0.039294 0.214899 +0.446093 0.026027 0.128251 +0.407029 0.046922 0.066767 +0.365305 0.060238 0.090360 +0.383768 0.048819 0.140115 +0.370504 0.054257 0.143952 +0.358656 0.050846 0.152415 +0.343721 0.051667 0.150554 +0.352689 0.037849 0.181895 +0.387896 0.023860 0.226017 +0.385152 0.026671 0.273998 +0.389716 0.042722 0.253226 +0.390426 0.060857 0.236081 +0.391309 0.070621 0.271022 +0.365299 0.052628 0.227580 +0.349302 0.056899 0.217929 +0.334019 0.044267 0.204909 +0.322675 0.052532 0.195847 +0.331578 0.059559 0.211188 +0.337346 0.044211 0.217457 +0.349988 0.042267 0.223684 +0.349544 0.052704 0.234279 +0.362448 0.055041 0.249180 +0.361727 0.044749 0.216369 +0.348153 0.069352 0.209682 +0.337217 0.045887 0.252731 +0.331050 0.046309 0.303014 +0.315984 0.081682 0.302052 +0.284402 0.070739 0.237853 +0.160928 0.095527 0.301120 +0.243864 0.253123 0.323982 +0.277572 0.092148 0.227598 +0.287300 0.089141 0.248731 +0.266347 0.080300 0.293693 +0.251289 0.087932 0.356317 +0.229821 0.046012 0.383514 +0.211823 0.052236 0.376683 +0.227721 0.066729 0.381682 +0.211191 0.099568 0.361644 +0.250163 0.058192 0.302916 +0.238782 0.062404 0.276585 +0.226470 0.067801 0.245403 +0.201436 0.085254 0.282160 +0.219802 0.088189 0.275429 +0.195729 0.096373 0.259539 +0.239596 0.069924 0.258877 +0.252931 0.058961 0.285795 +0.198265 0.083733 0.337224 +0.154613 0.036968 0.351381 +0.177337 0.021450 0.364380 +0.179088 0.025299 0.334012 +0.159295 0.027232 0.308317 +0.188645 0.046948 0.354951 +0.239592 0.093448 0.325226 +0.260247 0.055024 0.254124 +0.271796 0.061114 0.279167 +0.277210 0.043283 0.292067 +0.285919 0.056460 0.283294 +0.294039 0.048722 0.271710 +0.284689 0.041537 0.264456 +0.295141 0.036382 0.263883 +0.297060 0.034184 0.245546 +0.293229 0.029850 0.279750 +0.281186 0.022593 0.265907 +0.277293 0.025365 0.243586 +0.258324 0.031845 0.190247 +0.259675 0.040360 0.270911 +0.247039 0.037888 0.299431 +0.208028 0.109870 0.417382 +0.143955 0.352665 0.276035 +0.219494 0.404511 0.278305 +0.352442 0.182051 0.309356 +0.405915 0.135088 0.307030 +0.369146 0.162615 0.410960 +0.433703 0.099514 0.369783 +0.285682 0.219583 0.351837 +0.205221 0.076512 0.429524 +0.209111 0.064178 0.357358 +0.213614 0.027846 0.368032 +0.211762 0.020177 0.348034 +0.239715 0.025079 0.308549 +0.181970 0.021514 0.274842 +0.207709 0.021261 0.265212 +0.224222 0.023951 0.292046 +0.205208 0.035452 0.292259 +0.228577 0.040117 0.304294 +0.185628 0.027511 0.302807 +0.208356 0.024577 0.316996 +0.164632 0.053682 0.299398 +0.154684 0.059791 0.276709 +0.163141 0.113219 0.252962 +0.145021 0.179019 0.408733 +0.214761 0.213412 0.297524 +0.308714 0.266575 0.390462 +0.419920 0.278106 0.288387 +0.436034 0.199545 0.357313 +0.451619 0.349524 0.419884 +0.351454 0.399809 0.460027 +0.360729 0.263047 0.612763 +0.418659 0.158631 0.284739 +0.456406 0.261108 0.373714 +0.424203 0.185874 0.316636 +0.400414 0.220266 0.453220 +0.368427 0.288074 0.412510 +0.343373 0.311195 0.490064 +0.395724 0.120734 0.436366 +0.344054 0.121619 0.347531 +0.272067 0.060489 0.198795 +0.301511 0.071935 0.185958 +0.309917 0.058524 0.190423 +0.300737 0.068082 0.171283 +0.295951 0.070752 0.150988 +0.296628 0.093980 0.139509 +0.302790 0.088637 0.162273 +0.289209 0.107492 0.167687 +0.257493 0.099688 0.159880 +0.265074 0.094624 0.181755 +0.266152 0.102270 0.207499 +0.269178 0.081363 0.277388 +0.234937 0.089620 0.382405 +0.183980 0.071956 0.466773 +0.219287 0.038089 0.431341 +0.202243 0.025685 0.466386 +0.158633 0.040859 0.449110 +0.165286 0.038598 0.497265 +0.170922 0.081097 0.523174 +0.255371 0.073482 0.249855 +0.294450 0.061848 0.264223 +0.304183 0.048479 0.179739 +0.310850 0.055590 0.165979 +0.311457 0.049670 0.147335 +0.330971 0.043725 0.142906 +0.338014 0.047764 0.127744 +0.367458 0.069305 0.112055 +0.365012 0.080855 0.169084 +0.360471 0.123986 0.145022 +0.219106 0.213898 0.129019 +0.206939 0.158987 0.242265 +0.246130 0.209339 0.215908 +0.281650 0.212707 0.204391 +0.368421 0.137607 0.310718 +0.416555 0.186663 0.125862 +0.490086 0.115875 0.145587 +0.582071 0.084161 0.206439 +0.516409 0.100131 0.260412 +0.209178 0.109586 0.221433 +0.269122 0.077905 0.211916 +0.300134 0.057524 0.238951 +0.303992 0.045603 0.260036 +0.322399 0.041910 0.267995 +0.316911 0.039992 0.287154 +0.327515 0.024597 0.301819 +0.326525 0.038109 0.322430 +0.341705 0.034554 0.344489 +0.315359 0.057607 0.326479 +0.311192 0.052833 0.302654 +0.297687 0.053640 0.333832 +0.310295 0.070962 0.376051 +0.287143 0.033181 0.414809 +0.248935 0.044304 0.319914 +0.246203 0.096450 0.292594 +0.203226 0.299903 0.287677 +0.450787 0.226937 0.192194 +0.429364 0.129302 0.269024 +0.457446 0.111038 0.290750 +0.498339 0.083336 0.319890 +0.424246 0.121867 0.333939 +0.180169 0.212830 0.368602 +0.241118 0.059711 0.365439 +0.224747 0.101688 0.488165 +0.246281 0.034903 0.465119 +0.214101 0.041638 0.545771 +0.172272 0.040285 0.598901 +0.204244 0.073643 0.382078 +0.146978 0.063294 0.389213 +0.382561 0.211691 0.242082 +0.362189 0.175671 0.247243 +0.318033 0.195181 0.218764 +0.318069 0.292363 0.228042 +0.255232 0.340570 0.247263 +0.224048 0.079338 0.358775 +0.236448 0.054617 0.310908 +0.239437 0.046635 0.344813 +0.243703 0.031212 0.389996 +0.226767 0.019507 0.406603 +0.238177 0.018267 0.376086 +0.218586 0.029858 0.389601 +0.197366 0.025585 0.402150 +0.181994 0.030716 0.427478 +0.190316 0.080557 0.359194 +0.190657 0.107271 0.458600 +0.155050 0.289997 0.417618 +0.187166 0.466579 0.426216 +0.327820 0.426769 0.326883 +0.298164 0.333603 0.351558 +0.222925 0.307747 0.580913 +0.198007 0.195365 0.578080 +0.210838 0.132715 0.542845 +0.231681 0.145101 0.436671 +0.232264 0.139358 0.387084 +0.255424 0.134975 0.350235 +0.269033 0.107837 0.261451 +0.321432 0.091599 0.275752 +0.380638 0.048055 0.299763 +0.405177 0.039883 0.236148 +0.423159 0.034218 0.181764 +0.453693 0.035502 0.198420 +0.464601 0.056361 0.119659 +0.481653 0.094843 0.109332 +0.543887 0.077760 0.119617 +0.510174 0.067882 0.146075 +0.506307 0.045510 0.174226 +0.488336 0.037550 0.110817 +0.414503 0.071944 0.106334 +0.383441 0.044148 0.118702 +0.368264 0.023699 0.150335 +0.307715 0.072824 0.135304 +0.294683 0.031017 0.196791 +0.275515 0.032364 0.181864 +0.235271 0.050178 0.178346 +0.215182 0.042335 0.185990 +0.209160 0.034271 0.223795 +0.228156 0.042936 0.260040 +0.223438 0.035509 0.277441 +0.180634 0.048455 0.281545 +0.197426 0.043630 0.273470 +0.205039 0.042828 0.313134 +0.223919 0.042287 0.320436 +0.223789 0.049071 0.285841 +0.214087 0.074972 0.257980 +0.221706 0.055601 0.498696 +0.248886 0.066833 0.445954 +0.213931 0.250226 0.256738 +0.405740 0.215131 0.170840 +0.328009 0.225653 0.293796 +0.402298 0.209079 0.214184 +0.399981 0.190690 0.264499 +0.363176 0.143635 0.492934 +0.411671 0.175359 0.406973 +0.483187 0.170802 0.394002 +0.431046 0.230553 0.250015 +0.389736 0.164181 0.297007 +0.397937 0.264402 0.341441 +0.395597 0.192289 0.302742 +0.343285 0.064916 0.354126 +0.350910 0.048799 0.290592 +0.347107 0.053302 0.266173 +0.361248 0.035141 0.231596 +0.353263 0.036751 0.257156 +0.332918 0.021247 0.255062 +0.360739 0.026445 0.281881 +0.367061 0.033022 0.325980 +0.350245 0.030285 0.303678 +0.327460 0.062073 0.283904 +0.264953 0.154809 0.315348 +0.324552 0.162784 0.438341 +0.429845 0.118138 0.486718 +0.437485 0.201399 0.415841 +0.427985 0.188146 0.278007 +0.298482 0.166884 0.350707 +0.267071 0.100408 0.291668 +0.274139 0.048797 0.268746 +0.281772 0.064356 0.267733 +0.214424 0.106076 0.312509 +0.331917 0.145161 0.280800 +0.354727 0.078392 0.279286 +0.371871 0.063102 0.214163 +0.396773 0.045559 0.209831 +0.421855 0.036944 0.214993 +0.420483 0.038557 0.160983 +0.436158 0.046191 0.146786 +0.453173 0.052302 0.137395 +0.481122 0.055096 0.145895 +0.465610 0.080732 0.136565 +0.449280 0.063650 0.159070 +0.438899 0.073552 0.140745 +0.432289 0.052628 0.119653 +0.420075 0.055923 0.142166 +0.415632 0.042002 0.128100 +0.412222 0.024997 0.139031 +0.391770 0.036632 0.146635 +0.393909 0.035907 0.188207 +0.368782 0.042784 0.188583 +0.363114 0.026468 0.218028 +0.375379 0.033356 0.364183 +0.345201 0.072563 0.316474 +0.306150 0.169779 0.294978 +0.484261 0.214170 0.267057 +0.406809 0.237896 0.384323 +0.392655 0.344627 0.332547 +0.326695 0.369933 0.207731 +0.407366 0.219126 0.278777 +0.398951 0.222770 0.323388 +0.464580 0.171047 0.338723 +0.397575 0.158165 0.591424 +0.420764 0.281705 0.506598 +0.473997 0.277563 0.218714 +0.336638 0.220260 0.461195 +0.342381 0.160051 0.377158 +0.246975 0.040158 0.263418 +0.239553 0.054919 0.205493 +0.252654 0.036861 0.224388 +0.253305 0.022395 0.239997 +0.271057 0.036266 0.237408 +0.273993 0.028386 0.214558 +0.242393 0.034220 0.204126 +0.236256 0.038163 0.247591 +0.209356 0.079325 0.234462 +0.194870 0.063640 0.214830 +0.244111 0.043255 0.236907 +0.264016 0.045660 0.223915 +0.260253 0.048634 0.207679 +0.251574 0.057245 0.189983 +0.263437 0.063508 0.241134 +0.271436 0.069219 0.251311 +0.261483 0.087406 0.246475 +0.250589 0.076269 0.277050 +0.244799 0.069765 0.292298 +0.232217 0.055247 0.331780 +0.216197 0.056278 0.342299 +0.176402 0.053897 0.380149 +0.224991 0.078406 0.337659 +0.231780 0.062395 0.422354 +0.189766 0.154959 0.437237 +0.204459 0.136309 0.307237 +0.260264 0.045977 0.240046 +0.269789 0.046212 0.252599 +0.274164 0.035012 0.302447 +0.230060 0.090744 0.305382 +0.166096 0.140832 0.294885 +0.154169 0.268532 0.226818 +0.349563 0.262265 0.343630 +0.354489 0.268911 0.296625 +0.375822 0.171148 0.332545 +0.476794 0.136744 0.259507 +0.399929 0.118339 0.259498 +0.271716 0.130588 0.469224 +0.305172 0.032898 0.454218 +0.308690 0.042473 0.417566 +0.288698 0.024952 0.300569 +0.290810 0.015293 0.221283 +0.268986 0.033267 0.147285 +0.237334 0.048825 0.120734 +0.228777 0.055634 0.150103 +0.204334 0.073034 0.174915 +0.208027 0.057339 0.236310 +0.198897 0.066784 0.271433 +0.202506 0.057603 0.300680 +0.222788 0.058041 0.300819 +0.233042 0.055613 0.290225 +0.246512 0.042508 0.284706 +0.260946 0.032017 0.314281 +0.280743 0.031362 0.358053 +0.305375 0.031854 0.387510 +0.269256 0.025479 0.381275 +0.245952 0.040037 0.364854 +0.268189 0.040204 0.323075 +0.275163 0.050477 0.311422 +0.265688 0.064899 0.301225 +0.239306 0.268505 0.378907 +0.312398 0.266259 0.164624 +0.480542 0.174554 0.171654 +0.552172 0.158933 0.144993 +0.458784 0.141655 0.212248 +0.428648 0.163482 0.164911 +0.350278 0.208056 0.235462 +0.359219 0.250780 0.234338 +0.336572 0.248935 0.259563 +0.293959 0.257267 0.267935 +0.238555 0.202335 0.370163 +0.245646 0.069245 0.336645 +0.261452 0.055228 0.352020 +0.268939 0.054326 0.369767 +0.286819 0.048101 0.382083 +0.271280 0.052949 0.401336 +0.248193 0.051118 0.385676 +0.239973 0.026597 0.429200 +0.214644 0.060995 0.454583 +0.220676 0.083808 0.406302 +0.250805 0.126260 0.297366 +0.334644 0.192200 0.346535 +0.381125 0.159560 0.367527 +0.340438 0.157087 0.328361 +0.277244 0.160062 0.390717 +0.292870 0.052195 0.355769 +0.345623 0.035855 0.396258 +0.374273 0.031225 0.447159 +0.276809 0.033552 0.581647 +0.224359 0.099923 0.647568 +0.333303 0.049949 0.516785 +0.312970 0.123739 0.396509 +0.238621 0.146067 0.231297 +0.165305 0.049204 0.329040 +0.278324 0.199829 0.426235 +0.253210 0.337113 0.436856 +0.206203 0.578084 0.277516 +0.309249 0.169748 0.538897 +0.332333 0.091215 0.435451 +0.279107 0.030067 0.502383 +0.259234 0.086196 0.546189 +0.267603 0.068953 0.484586 +0.265845 0.064849 0.423640 +0.281793 0.086538 0.401598 +0.264889 0.079521 0.377251 +0.266400 0.115068 0.375961 +0.205215 0.130153 0.360079 +0.229061 0.160330 0.306438 +0.189984 0.185082 0.324728 +0.229945 0.128947 0.326026 +0.253837 0.089731 0.266618 +0.255704 0.088487 0.224765 +0.286792 0.092177 0.188518 +0.320841 0.097300 0.214002 +0.333689 0.106637 0.185748 +0.333838 0.086680 0.174199 +0.319590 0.093878 0.148540 +0.340092 0.115413 0.159425 +0.351543 0.092448 0.163319 +0.342527 0.091358 0.203951 +0.331816 0.119469 0.305761 +0.280244 0.128802 0.290044 +0.304101 0.105074 0.248131 +0.338603 0.080077 0.255476 +0.309197 0.057247 0.254671 +0.300156 0.070286 0.244369 +0.286353 0.065888 0.254045 +0.258600 0.108479 0.234651 +0.224997 0.109225 0.266261 +0.195413 0.126245 0.250545 +0.281750 0.062811 0.213758 +0.303917 0.051829 0.203332 +0.317902 0.072075 0.155470 +0.327787 0.081576 0.130690 +0.355867 0.073091 0.127604 +0.358901 0.085628 0.142860 +0.347105 0.087525 0.122878 +0.333158 0.110155 0.130534 +0.305063 0.115625 0.125246 +0.311381 0.117013 0.156404 +0.308163 0.112438 0.188106 +0.269326 0.130721 0.245640 +0.216982 0.085835 0.320106 +0.212607 0.057787 0.321804 +0.198387 0.073638 0.315780 +0.186044 0.054189 0.321956 +0.163325 0.054977 0.246522 +0.182868 0.034089 0.225316 +0.180488 0.047224 0.190814 +0.157011 0.029435 0.267719 +0.233375 0.081439 0.132706 +0.274801 0.044742 0.195953 +0.306673 0.028692 0.261583 +0.305705 0.037574 0.221126 +0.303135 0.045524 0.239984 +0.282405 0.040832 0.282276 +0.283758 0.040311 0.339897 +0.234144 0.030246 0.331245 +0.216669 0.066311 0.278480 +0.190170 0.097245 0.230782 +0.168054 0.072931 0.353984 +0.179260 0.077851 0.328143 +0.174966 0.076302 0.231521 +0.175667 0.078095 0.272008 +0.189384 0.067503 0.247983 +0.214139 0.046101 0.272932 +0.233914 0.045467 0.277783 +0.244588 0.049198 0.296792 +0.256730 0.043153 0.334920 +0.257759 0.032742 0.347498 +0.285465 0.026853 0.316266 +0.271270 0.033933 0.272250 +0.276680 0.045231 0.220594 +0.288564 0.042172 0.209508 +0.292675 0.047892 0.190494 +0.308407 0.037952 0.274706 +0.318522 0.038643 0.364714 +0.247803 0.111933 0.190722 +0.233404 0.144416 0.275805 +0.249166 0.193532 0.320038 +0.310797 0.319086 0.285728 +0.360867 0.217696 0.267229 +0.373286 0.186187 0.279616 +0.387949 0.127631 0.343667 +0.415183 0.073517 0.405553 +0.454532 0.127629 0.417735 +0.448768 0.149562 0.299421 +0.512886 0.163940 0.302645 +0.392881 0.193813 0.357648 +0.261675 0.259539 0.466201 +0.234490 0.096500 0.443213 +0.258238 0.062531 0.385246 +0.260465 0.035885 0.401811 +0.261667 0.036601 0.432964 +0.281564 0.058277 0.447718 +0.247830 0.105619 0.413321 +0.195343 0.165737 0.277588 +0.216014 0.219408 0.421047 +0.169087 0.221263 0.482537 +0.227429 0.183042 0.484872 +0.260935 0.291958 0.298961 +0.224112 0.158830 0.343758 +0.284726 0.056334 0.226615 +0.294599 0.051973 0.149180 +0.325047 0.051628 0.179937 +0.356402 0.049165 0.175911 +0.376165 0.058355 0.163522 +0.397813 0.057225 0.144147 +0.393141 0.044994 0.129534 +0.402884 0.044005 0.110816 +0.407746 0.063560 0.121868 +0.403282 0.071499 0.138498 +0.406901 0.052769 0.156323 +0.400491 0.038429 0.161151 +0.391847 0.058654 0.157748 +0.385015 0.067309 0.137188 +0.377336 0.045050 0.152108 +0.362722 0.055345 0.162513 +0.315826 0.042890 0.168139 +0.283083 0.080878 0.165981 +0.285489 0.067464 0.191727 +0.145248 0.070726 0.324069 +0.399799 0.255914 0.214022 +0.429920 0.159068 0.250011 +0.439445 0.183575 0.202417 +0.398499 0.258210 0.143533 +0.465245 0.169443 0.256422 +0.422318 0.358987 0.185421 +0.253220 0.222325 0.265472 +0.210594 0.307630 0.214541 +0.175040 0.446152 0.193737 +0.226217 0.379009 0.100408 +0.340833 0.306077 0.113355 +0.265242 0.294847 0.105075 +0.276714 0.304171 0.186038 +0.390551 0.100132 0.539154 +0.297133 0.125853 0.333330 +0.196927 0.178243 0.197378 +0.257580 0.128441 0.214041 +0.229792 0.130115 0.182553 +0.170106 0.162513 0.231148 +0.164595 0.106934 0.342563 +0.175852 0.127587 0.392165 +0.157779 0.134743 0.489792 +0.152201 0.097943 0.432539 +0.162413 0.153705 0.347737 +0.277299 0.150900 0.266126 +0.266806 0.172668 0.234574 +0.318579 0.167283 0.249262 +0.347916 0.107363 0.231007 +0.372857 0.090140 0.210306 +0.384342 0.113638 0.196678 +0.404131 0.095394 0.183804 +0.384612 0.121810 0.167672 +0.322944 0.132564 0.210257 +0.290364 0.146204 0.223432 +0.264192 0.157656 0.193948 +0.233485 0.163743 0.200412 +0.207187 0.138320 0.212342 +0.225556 0.124901 0.244775 +0.239106 0.105732 0.239571 +0.287733 0.114294 0.228538 +0.340176 0.100254 0.107080 +0.389066 0.103998 0.122846 +0.444975 0.102241 0.133970 +0.415860 0.114565 0.114926 +0.453877 0.120214 0.107920 +0.403927 0.096306 0.080457 +0.421740 0.122693 0.079588 +0.450640 0.144936 0.071884 +0.393762 0.136866 0.060204 +0.381369 0.180962 0.064094 +0.417859 0.160286 0.072990 +0.381221 0.146156 0.087738 +0.393977 0.119086 0.094996 +0.414356 0.146006 0.109031 +0.435031 0.134052 0.138616 +0.396483 0.123711 0.134754 +0.382302 0.141141 0.123735 +0.353663 0.145826 0.104587 +0.332036 0.171052 0.104051 +0.311513 0.199338 0.131723 +0.285181 0.190876 0.163180 +0.274455 0.184371 0.123920 +0.301600 0.169794 0.109397 +0.311406 0.141832 0.086234 +0.321738 0.140580 0.119486 +0.327427 0.145551 0.158359 +0.310737 0.168048 0.174012 +0.297873 0.175289 0.197738 +0.319909 0.123865 0.237833 +0.344952 0.122697 0.263042 +0.371611 0.111286 0.281178 +0.378247 0.099648 0.307710 +0.394570 0.079100 0.338162 +0.416351 0.038242 0.333196 +0.417830 0.042111 0.293185 +0.430829 0.039852 0.251519 +0.427375 0.079094 0.261696 +0.452757 0.101221 0.232921 +0.431060 0.088368 0.204739 +0.384616 0.086474 0.244279 +0.416919 0.124304 0.189584 +0.448928 0.116694 0.166079 +0.402548 0.157029 0.204021 +0.405248 0.099612 0.223420 +0.394667 0.126257 0.226234 +0.393587 0.155514 0.157489 +0.388278 0.150483 0.241885 +0.363290 0.151279 0.275569 +0.369461 0.131040 0.246673 +0.365592 0.135952 0.213237 +0.355959 0.141295 0.179707 +0.320616 0.134892 0.181918 diff --git a/libs/libcodec2/unittest/lspd456.txt b/libs/libcodec2/unittest/lspd456.txt new file mode 100644 index 0000000..4cc5ab8 --- /dev/null +++ b/libs/libcodec2/unittest/lspd456.txt @@ -0,0 +1,1024 @@ +0.347624 0.090959 0.454834 +0.446215 0.124000 0.370817 +0.409839 0.143155 0.295004 +0.440759 0.090281 0.296885 +0.465214 0.048451 0.542712 +0.471598 0.086037 0.483358 +0.372213 0.179217 0.438123 +0.592442 0.166741 0.433982 +0.399563 0.151320 0.400160 +0.479513 0.108517 0.258405 +0.485953 0.066923 0.193914 +0.548002 0.077271 0.152336 +0.565599 0.143205 0.140294 +0.558550 0.201462 0.109620 +0.607051 0.211633 0.152670 +0.670273 0.190261 0.139432 +0.430187 0.478301 0.135903 +0.148336 0.680821 0.114594 +0.185120 0.925628 0.147625 +0.249453 0.196637 0.241588 +0.179636 0.162617 0.313756 +0.586115 0.159387 0.307418 +0.472213 0.142351 0.245426 +0.384650 0.125831 0.240183 +0.332192 0.095235 0.255403 +0.300937 0.083633 0.239104 +0.282901 0.084036 0.324663 +0.264823 0.053630 0.355336 +0.262817 0.057144 0.308867 +0.235162 0.063366 0.290788 +0.225952 0.074491 0.259080 +0.250763 0.056393 0.263298 +0.261983 0.035121 0.221390 +0.232025 0.071049 0.211475 +0.251247 0.084420 0.177652 +0.317549 0.092361 0.194930 +0.376276 0.108869 0.213490 +0.407707 0.134249 0.200956 +0.324354 0.161579 0.180522 +0.155666 0.212650 0.191861 +0.276764 0.149348 0.164832 +0.232067 0.140034 0.296200 +0.202557 0.227413 0.232181 +0.213631 0.254317 0.286816 +0.230290 0.348972 0.223799 +0.073922 0.234044 0.444311 +0.165732 0.157286 0.377940 +0.143741 0.116266 0.367517 +0.170743 0.108278 0.335489 +0.204941 0.105478 0.323687 +0.232372 0.096166 0.294273 +0.249692 0.106680 0.233431 +0.247681 0.098716 0.205549 +0.285627 0.093674 0.181026 +0.273729 0.071657 0.199517 +0.324046 0.078751 0.174477 +0.320316 0.099534 0.141530 +0.305721 0.138944 0.194222 +0.307697 0.112445 0.306832 +0.263996 0.168409 0.279904 +0.209440 0.206560 0.352981 +0.207167 0.322235 0.237881 +0.248742 0.300747 0.244987 +0.244240 0.372015 0.250098 +0.311161 0.424673 0.225040 +0.297068 0.321411 0.313296 +0.379598 0.254957 0.371188 +0.432562 0.150907 0.250569 +0.490914 0.159011 0.203063 +0.459581 0.210629 0.184517 +0.365981 0.161992 0.242609 +0.273934 0.337911 0.234642 +0.303721 0.505646 0.388642 +0.245707 0.638533 0.280329 +0.225268 0.652879 0.192438 +0.258619 0.514447 0.279012 +0.316225 0.442602 0.335354 +0.376736 0.486777 0.308274 +0.327223 0.324066 0.242576 +0.485431 0.280997 0.355045 +0.572007 0.122510 0.240640 +0.616966 0.130938 0.227853 +0.513791 0.196874 0.180058 +0.466626 0.182542 0.223111 +0.402779 0.115602 0.343902 +0.375184 0.115227 0.402459 +0.273038 0.096940 0.441549 +0.286064 0.098337 0.549602 +0.246440 0.074548 0.556880 +0.236129 0.064941 0.588188 +0.209837 0.057975 0.532197 +0.259255 0.105430 0.407552 +0.302610 0.088086 0.382011 +0.330261 0.083490 0.318869 +0.339807 0.116430 0.207260 +0.296092 0.172928 0.144366 +0.253885 0.186664 0.166529 +0.277668 0.172442 0.196902 +0.314677 0.169787 0.285051 +0.278732 0.261731 0.151343 +0.192094 0.380939 0.072290 +0.164268 0.445241 0.088517 +0.213885 0.495691 0.078607 +0.244315 0.538432 0.099402 +0.213845 0.607105 0.091577 +0.286835 0.597563 0.087259 +0.318522 0.532846 0.080556 +0.284601 0.472920 0.105552 +0.326441 0.404994 0.109082 +0.361786 0.342944 0.134275 +0.405219 0.182087 0.266692 +0.339703 0.133107 0.349810 +0.318105 0.105264 0.418487 +0.268618 0.127749 0.519300 +0.210097 0.094867 0.551063 +0.184708 0.182810 0.698480 +0.158544 0.111449 0.634672 +0.170413 0.071464 0.657281 +0.171397 0.082903 0.699070 +0.201223 0.064064 0.627255 +0.180269 0.136502 0.501476 +0.221574 0.070933 0.434092 +0.211382 0.073149 0.481703 +0.114169 0.100113 0.915283 +0.146052 0.246456 0.633652 +0.275922 0.245082 0.498471 +0.266161 0.247382 0.434042 +0.302721 0.126115 0.373389 +0.300980 0.138225 0.249755 +0.290909 0.136927 0.286352 +0.350897 0.109421 0.304023 +0.386165 0.088656 0.245381 +0.382333 0.105625 0.151256 +0.421477 0.091637 0.128128 +0.404884 0.121558 0.102941 +0.322205 0.220312 0.077762 +0.283695 0.260465 0.065194 +0.383440 0.199544 0.094240 +0.480839 0.209932 0.141564 +0.441391 0.230279 0.141240 +0.362251 0.290803 0.099062 +0.301174 0.368993 0.092277 +0.377409 0.363282 0.091280 +0.337772 0.461506 0.076775 +0.373032 0.519469 0.124106 +0.314757 0.552002 0.139769 +0.250607 0.492442 0.145557 +0.335493 0.328724 0.166487 +0.534645 0.644574 0.182718 +0.488781 0.353657 0.328925 +0.554548 0.233808 0.376737 +0.492450 0.553839 0.367700 +0.394815 0.210972 0.142784 +0.238589 0.303384 0.080013 +0.224147 0.255123 0.068313 +0.256497 0.235171 0.099373 +0.297511 0.154648 0.113728 +0.305673 0.117198 0.107972 +0.290657 0.090218 0.126335 +0.258861 0.096775 0.145361 +0.259983 0.099517 0.110715 +0.118646 0.148765 0.076387 +0.145023 0.105727 0.109695 +0.181102 0.134847 0.077805 +0.211445 0.088585 0.101849 +0.198248 0.105956 0.172142 +0.180296 0.129252 0.141319 +0.221042 0.083049 0.144665 +0.212791 0.063744 0.179816 +0.167506 0.115897 0.208529 +0.205822 0.062715 0.241237 +0.172651 0.083940 0.183620 +0.124447 0.084470 0.196419 +0.186739 0.063095 0.269351 +0.160093 0.104677 0.295459 +0.143447 0.142741 0.276552 +0.123263 0.196627 0.476282 +0.108325 0.605694 0.334137 +0.285290 0.315781 0.362135 +0.353244 0.270895 0.333924 +0.263653 0.300345 0.291813 +0.208575 0.465618 0.269759 +0.220467 0.418879 0.223504 +0.146022 0.320151 0.302772 +0.183727 0.325046 0.366600 +0.171236 0.313334 0.429997 +0.247905 0.276696 0.319839 +0.127071 0.396634 0.387451 +0.073374 0.373431 0.434696 +0.210963 0.363358 0.326782 +0.268129 0.366304 0.302607 +0.276157 0.386117 0.406186 +0.340781 0.360413 0.321075 +0.431904 0.276036 0.404829 +0.495040 0.225348 0.450453 +0.262250 0.219954 0.192843 +0.261002 0.142204 0.241314 +0.278943 0.115884 0.204352 +0.260726 0.138775 0.101751 +0.183464 0.210049 0.109076 +0.162266 0.261270 0.088046 +0.236604 0.196725 0.126686 +0.316678 0.196107 0.179685 +0.243299 0.306025 0.151947 +0.400615 0.162590 0.232750 +0.372639 0.216589 0.209970 +0.140820 0.222509 0.129726 +0.097670 0.184209 0.193834 +0.193869 0.127067 0.282177 +0.208523 0.142275 0.352114 +0.126584 0.151378 0.342813 +0.235628 0.172984 0.215508 +0.249437 0.175207 0.390557 +0.255433 0.127918 0.372391 +0.359147 0.151917 0.290168 +0.351722 0.205430 0.115799 +0.267453 0.279897 0.108704 +0.350766 0.239207 0.087893 +0.318117 0.273230 0.085462 +0.381113 0.237724 0.065900 +0.219080 0.256349 0.369571 +0.196609 0.194954 0.411062 +0.213051 0.139071 0.398959 +0.244873 0.146332 0.435157 +0.235630 0.181860 0.511397 +0.292860 0.209424 0.147620 +0.331811 0.148006 0.093985 +0.293049 0.144326 0.069176 +0.281985 0.195922 0.077879 +0.228381 0.205538 0.080972 +0.235938 0.163446 0.071037 +0.168487 0.195102 0.072566 +0.199465 0.163509 0.108306 +0.255681 0.174779 0.108553 +0.302851 0.083047 0.155297 +0.321466 0.113845 0.176969 +0.338191 0.096339 0.224480 +0.360544 0.065938 0.241459 +0.378601 0.057338 0.276674 +0.368373 0.076055 0.310651 +0.344437 0.070848 0.286673 +0.376329 0.104163 0.278687 +0.355476 0.110470 0.243634 +0.362002 0.085143 0.260003 +0.411330 0.051881 0.247678 +0.414240 0.068326 0.276653 +0.410484 0.082208 0.354845 +0.418149 0.061438 0.388696 +0.433860 0.142628 0.438577 +0.495950 0.091923 0.413338 +0.434164 0.131070 0.325030 +0.347126 0.153569 0.402577 +0.458076 0.093458 0.443701 +0.495375 0.120909 0.562539 +0.589514 0.080183 0.512524 +0.531194 0.063220 0.328711 +0.499017 0.059249 0.243179 +0.530991 0.079568 0.259341 +0.585658 0.077791 0.416801 +0.536002 0.122366 0.473100 +0.511945 0.062231 0.459896 +0.486451 0.116847 0.370233 +0.481843 0.144265 0.420622 +0.407554 0.241229 0.282167 +0.320925 0.282038 0.252246 +0.225131 0.374849 0.479590 +0.228011 0.237458 0.622277 +0.261961 0.179596 0.806264 +0.076218 0.139692 1.043456 +0.151340 0.328626 0.887716 +0.337210 0.198192 0.379580 +0.460842 0.167548 0.160717 +0.477628 0.229247 0.072684 +0.451350 0.203095 0.091994 +0.420022 0.110903 0.058632 +0.449733 0.161924 0.093239 +0.411145 0.163560 0.078750 +0.435222 0.142044 0.126205 +0.420083 0.099757 0.203874 +0.370276 0.131184 0.131964 +0.354905 0.098162 0.185357 +0.354880 0.098109 0.151202 +0.355875 0.081150 0.202714 +0.329850 0.070604 0.206228 +0.326647 0.063899 0.235204 +0.330171 0.045901 0.207938 +0.329941 0.047031 0.176438 +0.337293 0.074879 0.140863 +0.368014 0.066698 0.168744 +0.300423 0.104975 0.266224 +0.156403 0.547850 0.093121 +0.288125 0.304080 0.176781 +0.210923 0.180445 0.267334 +0.236880 0.217374 0.275212 +0.213759 0.376162 0.184946 +0.372297 0.209676 0.309731 +0.445389 0.226789 0.291673 +0.519740 0.112223 0.265429 +0.472434 0.174961 0.115646 +0.417682 0.274453 0.070003 +0.458596 0.258372 0.047548 +0.455272 0.274496 0.086373 +0.444215 0.318398 0.074804 +0.427749 0.360899 0.081827 +0.369149 0.335197 0.063361 +0.408385 0.324949 0.072860 +0.384052 0.298347 0.060899 +0.373725 0.264760 0.080748 +0.352145 0.176148 0.080707 +0.310910 0.188712 0.108730 +0.250319 0.151051 0.140139 +0.238071 0.144852 0.173219 +0.228573 0.106294 0.172491 +0.217371 0.097639 0.248280 +0.253003 0.069144 0.233568 +0.256968 0.055968 0.160406 +0.235219 0.115044 0.075964 +0.336525 0.077151 0.097771 +0.295976 0.059336 0.123351 +0.324309 0.059429 0.397350 +0.348266 0.106120 0.501358 +0.340380 0.127511 0.440305 +0.275937 0.136374 0.468843 +0.266087 0.282816 0.379226 +0.228482 0.306643 0.416738 +0.246227 0.200955 0.450023 +0.318533 0.209335 0.569205 +0.413909 0.089360 0.618461 +0.382377 0.110800 0.185218 +0.298919 0.076922 0.206253 +0.295486 0.062198 0.170334 +0.220572 0.123944 0.132661 +0.199126 0.138104 0.199012 +0.150799 0.164435 0.128584 +0.141718 0.112651 0.157620 +0.218667 0.109546 0.215544 +0.255989 0.086240 0.259903 +0.300656 0.046011 0.269817 +0.291157 0.059173 0.236624 +0.310810 0.077525 0.293206 +0.314641 0.049528 0.310313 +0.279240 0.086840 0.353600 +0.165264 0.103047 0.417338 +0.208135 0.117070 0.429435 +0.232791 0.103415 0.462895 +0.271864 0.129281 0.319815 +0.366981 0.141852 0.212178 +0.373262 0.242359 0.117112 +0.422067 0.278600 0.123501 +0.338944 0.345572 0.098531 +0.308216 0.428668 0.066433 +0.271454 0.398601 0.070491 +0.278913 0.492798 0.060932 +0.247776 0.441372 0.071561 +0.343570 0.386117 0.081017 +0.461654 0.239819 0.108222 +0.430485 0.272031 0.176591 +0.408685 0.297320 0.097183 +0.485213 0.284632 0.069179 +0.461397 0.373449 0.100410 +0.671420 0.378029 0.088090 +0.808405 0.276010 0.102934 +0.704869 0.430068 0.070162 +0.554941 0.507594 0.125272 +0.359919 0.301913 0.230542 +0.251847 0.314817 0.199777 +0.293156 0.307596 0.224547 +0.356977 0.402190 0.240191 +0.290117 0.743767 0.395678 +0.392248 0.703453 0.280630 +0.476220 0.520924 0.129796 +0.527212 0.411812 0.063633 +0.542919 0.358453 0.095274 +0.556482 0.315834 0.117993 +0.482078 0.326051 0.096336 +0.420379 0.426709 0.088736 +0.369052 0.415845 0.093306 +0.437630 0.334794 0.118496 +0.466644 0.293770 0.233791 +0.508918 0.228596 0.222776 +0.484639 0.121415 0.212331 +0.443499 0.096268 0.231387 +0.511197 0.174015 0.270205 +0.352556 0.283611 0.272015 +0.293392 0.425947 0.162990 +0.332821 0.275494 0.174376 +0.298858 0.241340 0.192968 +0.305188 0.294785 0.139588 +0.375530 0.449251 0.144064 +0.292345 0.781183 0.254538 +0.358461 0.243978 0.182222 +0.415777 0.244409 0.238222 +0.467064 0.146980 0.298146 +0.416339 0.232371 0.189786 +0.191873 0.319957 0.083328 +0.203436 0.360141 0.135797 +0.374532 0.135837 0.364913 +0.268287 0.102231 0.714801 +0.254501 0.146265 0.649860 +0.218848 0.270739 0.467287 +0.188426 0.170744 0.462937 +0.245247 0.107864 0.332378 +0.122418 0.152546 0.533111 +0.079016 0.314882 0.596442 +0.126964 0.240808 0.550476 +0.075791 0.140645 0.502026 +0.093230 0.113111 0.626546 +0.172159 0.080636 0.831021 +0.068199 0.206815 0.906033 +0.062132 0.233971 0.778223 +0.074593 0.142563 0.751383 +0.109526 0.088462 0.775006 +0.124547 0.075148 0.714916 +0.219269 0.045432 0.388959 +0.127591 0.145316 0.230824 +0.075140 0.099358 0.462657 +0.064338 0.123266 0.563272 +0.078238 0.117014 0.688975 +0.084643 0.135331 0.834358 +0.139739 0.180181 0.788226 +0.146212 0.130036 0.742469 +0.142021 0.071166 0.618520 +0.264581 0.062830 0.446908 +0.320084 0.063118 0.350973 +0.396868 0.104191 0.308665 +0.464396 0.100744 0.190844 +0.474587 0.135638 0.122223 +0.505265 0.164031 0.083774 +0.508671 0.149050 0.116783 +0.494586 0.165303 0.148019 +0.472521 0.133399 0.178996 +0.472105 0.087004 0.224228 +0.446638 0.121806 0.273503 +0.367261 0.095789 0.337281 +0.359383 0.069161 0.376118 +0.283834 0.061745 0.401507 +0.233699 0.158991 0.567659 +0.131424 0.169028 0.614621 +0.073539 0.165230 0.608024 +0.084229 0.293229 0.506663 +0.148758 0.720830 0.237339 +0.256384 0.243042 0.348749 +0.395262 0.183863 0.343968 +0.381026 0.153580 0.322679 +0.344857 0.169307 0.357051 +0.180931 0.274934 0.267210 +0.133417 0.315317 0.364657 +0.184162 0.267604 0.330168 +0.220026 0.283042 0.231767 +0.259555 0.237606 0.232106 +0.276933 0.249820 0.287878 +0.349980 0.282625 0.421991 +0.481016 0.212218 0.325727 +0.458797 0.184528 0.274070 +0.484482 0.148105 0.341873 +0.526047 0.155385 0.400111 +0.526136 0.175193 0.328794 +0.556038 0.116326 0.373700 +0.437912 0.183108 0.320129 +0.154855 0.684819 0.527786 +0.142128 0.492151 0.711010 +0.062256 0.311531 0.691655 +0.180612 0.307234 0.730728 +0.152739 0.786052 0.357275 +0.421748 0.155971 0.355152 +0.513427 0.140653 0.180397 +0.503293 0.090152 0.226204 +0.470923 0.079454 0.290961 +0.458356 0.094363 0.377705 +0.447899 0.062986 0.355100 +0.490749 0.048144 0.340535 +0.490854 0.079767 0.368968 +0.568302 0.078153 0.271815 +0.574387 0.098205 0.200963 +0.644881 0.089413 0.208920 +0.636596 0.088651 0.058559 +0.553118 0.323894 0.063352 +0.583298 0.295978 0.091612 +0.606749 0.318066 0.058865 +0.487005 0.454915 0.177572 +0.329222 0.315592 0.285150 +0.299399 0.277718 0.282728 +0.302006 0.358174 0.148859 +0.334243 0.327319 0.350426 +0.291480 0.333984 0.274831 +0.383078 0.333489 0.255643 +0.406396 0.413215 0.258302 +0.479588 0.360631 0.169112 +0.594135 0.255844 0.137076 +0.847445 0.093619 0.248967 +0.810961 0.161433 0.181118 +0.732094 0.308294 0.140083 +0.623878 0.379968 0.070210 +0.567617 0.374818 0.060450 +0.664229 0.294886 0.104059 +0.645906 0.246204 0.135086 +0.673058 0.227775 0.100138 +0.659455 0.250925 0.067423 +0.627904 0.283712 0.067938 +0.581249 0.267066 0.063458 +0.617716 0.219403 0.068390 +0.599018 0.303403 0.166919 +0.450459 0.568624 0.270030 +0.497221 0.226918 0.270466 +0.411324 0.232483 0.331049 +0.320406 0.443850 0.269652 +0.187291 0.561422 0.165638 +0.294572 0.343681 0.200707 +0.326397 0.258546 0.286441 +0.279400 0.306226 0.260735 +0.193123 0.385992 0.258247 +0.342327 0.381838 0.147491 +0.433089 0.378484 0.207774 +0.362956 0.347448 0.222551 +0.361638 0.480201 0.226996 +0.384522 0.377667 0.186341 +0.427881 0.296866 0.282612 +0.563327 0.229524 0.304696 +0.567170 0.247155 0.202733 +0.585411 0.220038 0.115594 +0.519250 0.229429 0.071582 +0.466406 0.348495 0.062605 +0.474052 0.430997 0.059085 +0.456952 0.434321 0.092489 +0.443242 0.479322 0.066114 +0.424170 0.532398 0.074007 +0.394911 0.475416 0.086889 +0.452632 0.411710 0.140813 +0.403571 0.307690 0.141199 +0.330609 0.309675 0.202639 +0.162152 0.333000 0.246273 +0.104212 0.372786 0.256919 +0.136824 0.521324 0.228461 +0.104865 0.608493 0.187863 +0.112234 0.499159 0.140580 +0.103176 0.394350 0.106114 +0.097342 0.431118 0.194462 +0.199846 0.166342 0.150206 +0.257308 0.138618 0.204462 +0.377777 0.076428 0.214777 +0.396461 0.078672 0.186686 +0.412491 0.083042 0.157354 +0.409492 0.113963 0.166822 +0.402656 0.132414 0.136860 +0.384318 0.169269 0.141277 +0.379760 0.142363 0.169790 +0.434051 0.125795 0.180081 +0.291493 0.229394 0.111634 +0.413319 0.193400 0.112837 +0.413655 0.226896 0.114264 +0.433596 0.176677 0.130118 +0.324845 0.251559 0.120351 +0.359504 0.214180 0.154811 +0.415838 0.197748 0.221624 +0.330767 0.232694 0.237892 +0.283703 0.199163 0.276558 +0.402389 0.264705 0.562024 +0.405915 0.068161 0.722076 +0.408789 0.081683 0.224705 +0.412949 0.070850 0.318290 +0.383543 0.088037 0.376585 +0.413842 0.087764 0.457480 +0.394697 0.085379 0.526908 +0.326022 0.124012 0.545103 +0.360363 0.103599 0.573651 +0.374875 0.071392 0.577138 +0.426542 0.064067 0.485994 +0.414344 0.062295 0.436129 +0.357597 0.053368 0.442984 +0.352690 0.061527 0.481466 +0.435965 0.091560 0.330005 +0.452104 0.173696 0.389629 +0.240811 0.227686 0.399164 +0.387054 0.212876 0.250823 +0.348481 0.199112 0.239045 +0.406692 0.124037 0.262865 +0.364589 0.130457 0.265840 +0.418494 0.152965 0.158070 +0.525395 0.176045 0.224438 +0.649496 0.162294 0.265624 +0.577476 0.087708 0.311571 +0.635120 0.080693 0.336377 +0.695460 0.066421 0.421660 +0.621358 0.149936 0.353147 +0.567838 0.187842 0.239684 +0.610053 0.188465 0.189601 +0.290729 0.370305 0.245506 +0.474752 0.256582 0.192554 +0.523264 0.281951 0.174076 +0.487445 0.266791 0.140722 +0.418187 0.308871 0.224831 +0.542461 0.339261 0.179909 +0.660046 0.325237 0.064232 +0.699190 0.263381 0.081222 +0.771760 0.141829 0.114068 +0.849307 0.167518 0.110492 +0.768620 0.215479 0.101016 +0.943168 0.112917 0.126022 +0.700213 0.207371 0.114043 +0.520214 0.355040 0.056977 +0.501121 0.416740 0.097933 +0.413408 0.446710 0.207348 +0.316233 0.501402 0.172782 +0.422015 0.299620 0.334807 +0.467201 0.278473 0.294606 +0.449356 0.314132 0.169959 +0.383191 0.318048 0.185054 +0.263466 0.409830 0.258522 +0.344203 0.180472 0.319223 +0.362266 0.169616 0.180383 +0.341699 0.182702 0.146822 +0.335987 0.174976 0.210809 +0.395083 0.165288 0.194206 +0.465646 0.099187 0.323536 +0.462006 0.053739 0.310921 +0.455068 0.081078 0.262737 +0.418012 0.119395 0.233351 +0.345448 0.135789 0.188425 +0.351492 0.162596 0.117706 +0.344759 0.149410 0.147248 +0.314307 0.134967 0.151339 +0.286415 0.116093 0.164754 +0.277756 0.126139 0.130984 +0.361188 0.110945 0.070191 +0.361209 0.201107 0.056536 +0.284536 0.314088 0.069545 +0.432086 0.300442 0.045010 +0.395858 0.449191 0.053920 +0.358265 0.503243 0.063399 +0.373607 0.577103 0.071048 +0.277978 0.673759 0.088057 +0.361589 0.613722 0.123032 +0.384724 0.684712 0.091070 +0.459571 0.724691 0.081391 +0.440636 0.611416 0.071085 +0.491405 0.544525 0.066202 +0.495390 0.482599 0.069217 +0.585200 0.253363 0.096585 +0.538917 0.276943 0.073936 +0.500464 0.315306 0.054544 +0.664338 0.150817 0.196704 +0.500195 0.080074 0.282262 +0.530558 0.067443 0.375424 +0.440087 0.352641 0.277248 +0.390681 0.267263 0.209143 +0.359333 0.241690 0.261267 +0.370447 0.247920 0.308405 +0.336215 0.226039 0.305830 +0.195785 0.339497 0.283349 +0.151348 0.445352 0.258280 +0.266713 0.219848 0.307969 +0.218114 0.294964 0.285277 +0.174107 0.381064 0.212437 +0.155914 0.377087 0.116389 +0.134386 0.253742 0.304443 +0.151029 0.213087 0.353221 +0.217483 0.140058 0.241820 +0.242753 0.116518 0.270671 +0.285332 0.068762 0.270927 +0.317498 0.078582 0.264060 +0.277862 0.110739 0.250417 +0.308456 0.109889 0.221582 +0.276315 0.089684 0.226545 +0.333980 0.135929 0.231792 +0.334591 0.166897 0.259283 +0.397876 0.537888 0.188209 +0.290878 0.394567 0.198465 +0.163752 0.435990 0.173066 +0.191115 0.481622 0.133956 +0.260636 0.377095 0.197277 +0.338080 0.235880 0.426527 +0.378463 0.127767 0.454089 +0.385046 0.056905 0.498118 +0.374068 0.049953 0.405294 +0.271022 0.098818 0.289459 +0.182680 0.217988 0.292618 +0.225435 0.235809 0.318205 +0.177229 0.103515 0.463042 +0.175834 0.055640 0.486987 +0.183210 0.062875 0.440837 +0.226003 0.097193 0.366732 +0.251396 0.070201 0.393377 +0.234201 0.074576 0.326442 +0.223004 0.066314 0.353857 +0.186211 0.106789 0.245913 +0.151535 0.094840 0.253435 +0.195080 0.089425 0.287492 +0.162720 0.067083 0.227111 +0.196415 0.076298 0.212223 +0.180505 0.083889 0.141164 +0.246234 0.066099 0.131760 +0.282666 0.087223 0.081269 +0.340580 0.122366 0.117784 +0.376555 0.091363 0.111974 +0.393102 0.087543 0.417517 +0.297217 0.163487 0.549749 +0.362450 0.174227 0.634258 +0.323933 0.627863 0.231764 +0.327261 0.458545 0.128228 +0.345717 0.429564 0.187171 +0.260069 0.337062 0.335170 +0.306881 0.385334 0.293359 +0.271898 0.457259 0.215823 +0.259289 0.441347 0.303200 +0.363305 0.398019 0.291679 +0.291795 0.279053 0.324220 +0.294547 0.262771 0.399943 +0.371243 0.306137 0.366069 +0.382008 0.339743 0.307443 +0.438316 0.228950 0.367986 +0.537463 0.298231 0.257224 +0.645494 0.307091 0.289935 +0.669328 0.320508 0.177252 +0.616771 0.434999 0.131058 +0.565925 0.511230 0.217275 +0.568203 0.409220 0.089091 +0.577548 0.394258 0.217345 +0.648943 0.237348 0.200174 +0.599721 0.237036 0.256373 +0.754878 0.197561 0.266084 +0.714487 0.175657 0.200087 +0.710745 0.237411 0.165014 +0.720827 0.339743 0.072832 +0.545081 0.459358 0.071144 +0.346804 0.807739 0.104644 +0.216743 0.762837 0.120249 +0.197697 0.658146 0.387627 +0.165912 0.499878 0.549502 +0.241754 0.317091 0.529186 +0.169200 0.553212 0.416930 +0.320751 0.621112 0.366138 +0.337485 0.556049 0.269330 +0.250664 0.574848 0.514561 +0.140209 0.430307 0.459246 +0.162363 0.246323 0.477493 +0.381402 0.092797 0.469234 +0.459381 0.155970 0.481903 +0.442539 0.088546 0.414977 +0.408686 0.121373 0.498045 +0.329248 0.153610 0.482630 +0.331997 0.142511 0.315883 +0.221799 0.396419 0.292101 +0.176966 0.273274 0.211951 +0.203478 0.286430 0.129390 +0.216827 0.258314 0.184043 +0.234488 0.175930 0.313819 +0.311501 0.270429 0.211948 +0.294432 0.162487 0.229611 +0.329328 0.117112 0.277223 +0.416641 0.099298 0.274074 +0.554873 0.155235 0.201501 +0.569426 0.189358 0.155950 +0.539367 0.241198 0.105444 +0.501517 0.357700 0.084370 +0.545573 0.281564 0.125541 +0.514425 0.301811 0.096910 +0.460345 0.293995 0.114532 +0.487409 0.345311 0.229900 +0.412521 0.355808 0.145545 +0.509374 0.347915 0.128813 +0.629454 0.215821 0.104369 +0.658561 0.176420 0.084630 +0.700668 0.136656 0.112851 +0.667071 0.122890 0.157514 +0.612182 0.148628 0.155034 +0.539605 0.176739 0.090625 +0.590039 0.124542 0.106912 +0.629817 0.100757 0.139713 +0.604716 0.105384 0.173581 +0.720555 0.111138 0.330763 +0.245112 0.336634 0.265337 +0.226689 0.424271 0.348303 +0.329654 0.359100 0.261678 +0.379459 0.286999 0.299860 +0.342863 0.299943 0.318446 +0.330710 0.371149 0.198420 +0.285053 0.275836 0.238793 +0.361749 0.196487 0.281140 +0.406042 0.191956 0.297341 +0.445690 0.223770 0.237164 +0.393133 0.274606 0.262027 +0.544286 0.142320 0.276324 +0.619365 0.107015 0.281186 +0.607150 0.081004 0.243243 +0.678787 0.091345 0.263915 +0.734877 0.105834 0.242728 +0.694254 0.100473 0.181406 +0.758976 0.109087 0.167450 +0.565683 0.217978 0.071529 +0.445274 0.395501 0.058069 +0.484692 0.379794 0.062350 +0.214619 0.245836 0.117895 +0.246969 0.229441 0.150311 +0.385481 0.258270 0.151377 +0.353085 0.290950 0.141139 +0.535642 0.170306 0.146284 +0.446113 0.090546 0.161019 +0.348613 0.118759 0.163942 +0.256859 0.116937 0.175945 +0.095533 0.124223 0.128081 +0.104333 0.215306 0.075249 +0.100294 0.187881 0.135738 +0.148622 0.275139 0.167339 +0.078452 0.360587 0.329967 +0.127610 0.289917 0.238589 +0.148272 0.316966 0.121487 +0.085461 0.330668 0.163259 +0.142401 0.216090 0.250904 +0.175731 0.166076 0.233510 +0.152278 0.156198 0.181459 +0.193328 0.210638 0.148227 +0.207811 0.191064 0.188672 +0.296438 0.161485 0.325233 +0.306068 0.199688 0.322695 +0.342566 0.219355 0.346721 +0.291750 0.188465 0.494566 +0.352065 0.234211 0.491138 +0.383860 0.596099 0.458394 +0.386344 0.202868 0.380113 +0.399359 0.282461 0.474285 +0.322622 0.279134 0.358938 +0.347701 0.262331 0.223429 +0.424998 0.191838 0.164353 +0.451151 0.131623 0.217203 +0.456273 0.120859 0.149404 +0.490554 0.108928 0.157243 +0.517816 0.130242 0.142810 +0.500090 0.217505 0.103504 +0.514504 0.191274 0.118656 +0.554806 0.122508 0.163126 +0.442524 0.162708 0.199911 +0.388949 0.157852 0.109288 +0.504477 0.095186 0.125173 +0.477591 0.066576 0.138585 +0.452216 0.100773 0.107700 +0.485286 0.127587 0.074852 +0.488827 0.194629 0.066040 +0.426576 0.237428 0.067677 +0.340727 0.291206 0.061076 +0.243435 0.361855 0.071906 +0.382323 0.324483 0.098684 +0.414425 0.354228 0.048282 +0.401390 0.400107 0.040249 +0.403756 0.393196 0.073045 +0.357685 0.422727 0.054290 +0.376221 0.373641 0.056815 +0.334172 0.375680 0.054225 +0.296174 0.361326 0.050408 +0.326273 0.330339 0.064557 +0.420692 0.255904 0.094806 +0.421944 0.199537 0.068849 +0.326830 0.232006 0.153704 +0.301454 0.201485 0.233060 +0.258842 0.191789 0.343414 +0.294282 0.195861 0.362979 +0.286399 0.234317 0.360778 +0.319442 0.214047 0.274131 +0.333404 0.220264 0.204146 +0.386995 0.195077 0.182131 +0.404880 0.215968 0.423836 +0.477146 0.435211 0.260239 +0.532189 0.227684 0.146512 +0.568278 0.159946 0.110703 +0.605267 0.174809 0.088477 +0.624009 0.142924 0.112772 +0.652905 0.148818 0.139204 +0.714256 0.157313 0.148093 +0.720760 0.199261 0.080657 +0.741518 0.278514 0.083257 +0.566298 0.527298 0.062699 +0.445052 0.597589 0.130277 +0.526449 0.626948 0.074424 +0.801938 0.367141 0.075543 +0.916524 0.255963 0.112835 +0.645568 0.521635 0.064144 +0.608913 0.448818 0.064142 +0.629099 0.328544 0.099333 +0.620582 0.182449 0.132128 +0.590707 0.148356 0.186809 +0.543143 0.102875 0.300062 +0.527847 0.116107 0.336959 +0.499887 0.117763 0.297680 +0.508919 0.134512 0.236929 +0.531706 0.109558 0.239043 +0.541620 0.120673 0.208110 +0.517661 0.098274 0.183512 +0.449983 0.054085 0.247178 +0.575793 0.062186 0.355346 +0.489231 0.203337 0.380285 +0.340551 0.340643 0.414281 +0.210167 0.526078 0.337705 +0.284920 0.525512 0.222620 +0.208797 0.499630 0.207868 +0.267127 0.583546 0.176083 +0.228186 0.428672 0.171167 +0.258450 0.355455 0.160617 +0.273653 0.409657 0.120028 +0.264098 0.344696 0.111979 +0.222486 0.415597 0.112772 +0.199350 0.325482 0.185961 +0.294632 0.157878 0.367064 +0.346967 0.102272 0.381014 +0.324707 0.101328 0.346674 +0.300669 0.154767 0.427674 +0.297977 0.190730 0.402531 +0.322781 0.242743 0.378056 +0.419505 0.654624 0.200084 +0.318601 0.692538 0.162850 +0.178499 0.579044 0.270280 +0.195204 0.388057 0.398083 +0.241827 0.349617 0.379452 +0.315199 0.303795 0.489292 +0.380392 0.178450 0.504430 +0.414296 0.143625 0.555054 +0.339645 0.110851 0.633101 +0.315159 0.082478 0.583218 +0.337965 0.059219 0.531018 +0.321096 0.080831 0.498225 +0.307444 0.107476 0.461283 +0.278693 0.093535 0.490594 +0.252057 0.083619 0.514079 +0.224412 0.111350 0.505414 +0.169223 0.083911 0.512845 +0.208880 0.083504 0.402948 +0.187837 0.073111 0.335010 +0.206755 0.055269 0.311264 +0.156291 0.062835 0.298062 +0.156028 0.064082 0.415247 +0.129754 0.074279 0.474540 +0.183725 0.101044 0.375452 +0.181248 0.060180 0.378248 +0.178353 0.183494 0.547763 +0.303398 0.241676 0.322364 +0.263082 0.269825 0.205102 +0.295290 0.241493 0.251070 +0.310143 0.206645 0.446008 +0.249752 0.262630 0.261739 +0.225039 0.305225 0.344815 +0.153658 0.404495 0.314509 +0.142025 0.474338 0.358307 +0.228656 0.455858 0.431304 +0.360261 0.434834 0.461602 +0.432447 0.356868 0.399441 +0.405888 0.423867 0.341787 +0.307752 0.379122 0.354664 +0.495951 0.255588 0.098194 +0.590320 0.364141 0.130834 +0.523157 0.411325 0.142398 +0.622815 0.267082 0.098576 +0.586226 0.337718 0.086861 +0.396476 0.396958 0.127666 +0.278385 0.309875 0.439028 +0.210412 0.240403 0.530267 +0.142154 0.341782 0.515974 +0.236712 0.330636 0.302147 +0.313995 0.313085 0.102247 +0.536878 0.123790 0.095432 +0.546579 0.066696 0.222251 +0.528723 0.046496 0.288028 +0.490438 0.079978 0.328045 +0.416715 0.108530 0.389254 +0.350888 0.083964 0.417653 +0.307331 0.062124 0.473629 +0.274119 0.115537 0.597408 +0.226906 0.099518 0.609696 +0.147094 0.067376 0.550921 +0.178994 0.061997 0.585308 +0.132607 0.110425 0.587137 +0.110327 0.099682 0.549983 +0.068912 0.202205 0.534312 +0.065072 0.231313 0.620174 +0.080325 0.190639 0.689245 +0.127351 0.125355 0.674554 +0.110891 0.072596 0.663783 +0.097157 0.070549 0.589126 +0.106411 0.082418 0.509171 +0.125632 0.088198 0.439270 +0.126006 0.083980 0.396385 +0.144132 0.069483 0.352444 +0.105337 0.088013 0.358993 +0.119785 0.099438 0.312550 +0.070842 0.142954 0.331889 +0.071861 0.089577 0.402256 +0.108923 0.084005 0.258422 +0.092866 0.123378 0.193507 +0.088292 0.071041 0.315009 +0.063561 0.165270 0.420738 +0.074840 0.133173 0.262739 +0.089400 0.194231 0.262021 +0.079851 0.205849 0.344821 +0.157143 0.146865 0.421765 +0.125245 0.208011 0.414350 +0.174337 0.251983 0.396703 +0.084886 0.272191 0.354568 +0.110693 0.292372 0.436834 +0.211165 0.375835 0.619400 +0.062966 0.412899 0.552075 +0.081388 0.529721 0.443287 +0.081245 0.483334 0.304728 +0.138084 0.348639 0.182624 +0.103443 0.309738 0.080859 +0.104109 0.260851 0.123996 +0.091414 0.251910 0.196193 +0.076304 0.263206 0.278157 +0.134332 0.188036 0.301992 +0.107220 0.138757 0.409882 +0.128381 0.129478 0.471249 +0.160195 0.115412 0.544945 +0.191115 0.149126 0.609196 +0.184568 0.103795 0.587575 +0.248953 0.058854 0.636286 +0.192984 0.081624 0.751367 +0.220001 0.099182 0.668267 +0.223085 0.059316 0.689244 +0.276099 0.046871 0.774911 +0.314266 0.073942 0.676716 +0.296234 0.076044 0.626027 +0.279541 0.049108 0.565247 +0.285398 0.057887 0.519502 +0.243492 0.048975 0.483027 +0.309314 0.059143 0.435497 +0.387586 0.051625 0.354348 +0.397104 0.047268 0.326093 +0.434850 0.059475 0.193227 diff --git a/libs/libcodec2/unittest/lspd78.txt b/libs/libcodec2/unittest/lspd78.txt new file mode 100644 index 0000000..13ee29c --- /dev/null +++ b/libs/libcodec2/unittest/lspd78.txt @@ -0,0 +1,64 @@ +0.281245 0.072824 +0.339645 0.060014 +0.409277 0.064576 +0.523095 0.061305 +0.230096 0.211887 +0.207683 0.332701 +0.284308 0.308783 +0.140378 0.711570 +0.174527 0.127827 +0.352952 0.235323 +0.370502 0.190103 +0.402932 0.159641 +0.347927 0.146360 +0.296583 0.131013 +0.223266 0.153607 +0.197020 0.420964 +0.116898 0.516163 +0.119488 0.109699 +0.111778 0.278792 +0.578302 0.202919 +0.414620 0.214613 +0.305886 0.397131 +0.332819 0.101995 +0.378387 0.086890 +0.382898 0.121331 +0.453255 0.063910 +0.426851 0.114357 +0.460512 0.099039 +0.479185 0.134529 +0.496434 0.084061 +0.573538 0.071989 +0.531672 0.120071 +0.591529 0.134458 +0.511033 0.180023 +0.448004 0.171478 +0.322286 0.187786 +0.297869 0.238597 +0.242424 0.263223 +0.175075 0.260064 +0.201034 0.074025 +0.268571 0.522305 +0.344104 0.296771 +0.409613 0.271732 +0.173676 0.190087 +0.115603 0.193700 +0.115269 0.373202 +0.407643 0.637929 +0.439428 0.478964 +0.567749 0.389060 +0.551502 0.271892 +0.639284 0.075639 +0.665511 0.286926 +0.720983 0.084070 +0.795786 0.214436 +0.832583 0.095102 +0.671796 0.164706 +0.983554 0.136778 +0.812831 0.368808 +0.644281 0.515306 +0.480389 0.316998 +0.403689 0.360441 +0.476736 0.232898 +0.248084 0.111421 +0.273953 0.180184 diff --git a/libs/libcodec2/unittest/lspd910.txt b/libs/libcodec2/unittest/lspd910.txt new file mode 100644 index 0000000..99c4b8d --- /dev/null +++ b/libs/libcodec2/unittest/lspd910.txt @@ -0,0 +1,64 @@ +0.678062 0.043120 +0.472775 0.257353 +0.522878 0.127961 +0.628034 0.038788 +0.480545 0.057725 +0.437201 0.064479 +0.327854 0.073645 +0.308168 0.135691 +0.390919 0.172150 +0.362940 0.121889 +0.384688 0.065511 +0.419078 0.117947 +0.468913 0.116759 +0.507838 0.089601 +0.555567 0.052196 +0.521040 0.052787 +0.589645 0.043616 +0.985285 0.088227 +0.724020 0.177911 +0.129928 0.130564 +0.120671 0.249971 +0.266520 0.077658 +0.685157 0.083387 +0.673088 0.130951 +0.726463 0.107217 +0.779587 0.130439 +0.652097 0.060232 +0.616365 0.062903 +0.614893 0.095188 +0.671203 0.264629 +0.657805 0.188243 +0.647995 0.095077 +0.581225 0.110398 +0.573894 0.254912 +0.531176 0.201073 +0.544230 0.353796 +0.621094 0.138556 +0.717028 0.053894 +0.890269 0.071236 +1.100420 0.115118 +0.492946 0.167302 +0.387836 0.249419 +0.929411 0.210459 +0.389735 0.351413 +0.273341 0.443161 +0.453321 0.457227 +0.303206 0.300360 +0.563261 0.148813 +0.789479 0.244432 +0.817080 0.062843 +0.852058 0.150352 +0.760492 0.059787 +0.711233 0.355546 +0.598869 0.189758 +0.583624 0.073653 +0.548949 0.089569 +0.445394 0.183962 +0.333115 0.197087 +0.246232 0.142290 +0.263973 0.216087 +0.185969 0.192135 +0.205425 0.302232 +0.195923 0.088343 +0.148277 0.406699 diff --git a/libs/libcodec2/unittest/lsptest.c b/libs/libcodec2/unittest/lsptest.c new file mode 100644 index 0000000..8a610a1 --- /dev/null +++ b/libs/libcodec2/unittest/lsptest.c @@ -0,0 +1,177 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: lsptest.c + AUTHOR......: David Rowe + DATE CREATED: 24/8/09 + + Test Speech LPC to LSP conversion and quantisation. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2009 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <assert.h> +#include <stdio.h> +#include <stdlib.h> +#include <lpc.h> +#include <lsp.h> +#include <sd.h> + +#define N 160 +#define P 10 + +#define LPC_FLOOR 0.0002 /* autocorrelation floor */ +#define LSP_DELTA1 0.2 /* grid spacing for LSP root searches */ +#define NDFT 256 /* DFT size for SD calculation */ + +/* Speex lag window */ + +const float lag_window[11] = { + 1.00000, 0.99716, 0.98869, 0.97474, 0.95554, 0.93140, 0.90273, 0.86998, + 0.83367, 0.79434, 0.75258 +}; + +/*---------------------------------------------------------------------------*\ + + find_aks_for_lsp() + + This function takes a frame of samples, and determines the linear + prediction coefficients for that frame of samples. Modified version of + find_aks from lpc.c to include autocorrelation noise floor and lag window + to match Speex processing steps prior to LSP conversion. + +\*---------------------------------------------------------------------------*/ + +void find_aks_for_lsp( + float Sn[], /* Nsam samples with order sample memory */ + float a[], /* order+1 LPCs with first coeff 1.0 */ + int Nsam, /* number of input speech samples */ + int order, /* order of the LPC analysis */ + float *E /* residual energy */ +) +{ + float Wn[N]; /* windowed frame of Nsam speech samples */ + float R[P+1]; /* order+1 autocorrelation values of Sn[] */ + int i; + + hanning_window(Sn,Wn,Nsam); + + autocorrelate(Wn,R,Nsam,order); + R[0] += LPC_FLOOR; + assert(order == 10); /* lag window only defined for order == 10 */ + for(i=0; i<=order; i++) + R[i] *= lag_window[i]; + levinson_durbin(R,a,order); + + *E = 0.0; + for(i=0; i<=order; i++) + *E += a[i]*R[i]; + if (*E < 0.0) + *E = 1E-12; +} + +/*---------------------------------------------------------------------------*\ + + MAIN + +\*---------------------------------------------------------------------------*/ + +int main(int argc, char *argv[]) +{ + FILE *fin; /* input speech files */ + short buf[N]; /* buffer of 16 bit speech samples */ + float Sn[P+N]; /* input speech samples */ + float E; + float ak[P+1]; /* LP coeffs */ + float ak_[P+1]; /* quantised LP coeffs */ + float lsp[P]; + float lsp_[P]; /* quantised LSPs */ + int roots; /* number of LSP roots found */ + int frames; /* frames processed so far */ + int i; /* loop variables */ + + SpeexBits bits; + + float sd; /* SD for this frame */ + float totsd; /* accumulated SD so far */ + int gt2,gt4; /* number of frames > 2 and 4 dB SD */ + int unstables; /* number of unstable LSP frames */ + + if (argc < 2) { + printf("usage: %s InputFile\n", argv[0]); + exit(0); + } + + /* Open files */ + + if ((fin = fopen(argv[1],"rb")) == NULL) { + printf("Error opening input file: %s\n",argv[1]); + exit(0); + } + + /* Initialise */ + + frames = 0; + for(i=0; i<P; i++) { + Sn[i] = 0.0; + } + ak_[0] = 1.0; + + speex_bits_init(&bits); + + totsd = 0.0; + unstables = 0; + gt2 = 0; gt4 = 0; + + /* Main loop */ + + while( (fread(buf,sizeof(short),N,fin)) == N) { + frames++; + for(i=0; i<N; i++) + Sn[P+i] = (float)buf[i]; + + /* convert to LSP domain and back */ + + find_aks(&Sn[P], ak, N, P, &E); + roots = lpc_to_lsp(&ak[1], P , lsp, 10, LSP_DELTA1, NULL); + if (roots == P) { + + speex_bits_reset(&bits); + lsp_quant_lbr(lsp, lsp_, P, &bits); + lsp_to_lpc(lsp_, &ak_[1], P, NULL); + + /* measure spectral distortion */ + sd = spectral_dist(ak, ak_, P, NDFT); + if (sd > 2.0) gt2++; + if (sd > 4.0) gt4++; + totsd += sd; + } + else + unstables++; + } + + fclose(fin); + + printf("frames = %d Av sd = %3.2f dB", frames, totsd/frames); + printf(" >2 dB %3.2f%% >4 dB %3.2f%% unstables: %d\n",gt2*100.0/frames, + gt4*100.0/frames, unstables); + + return 0; +} + diff --git a/libs/libcodec2/unittest/sd.c b/libs/libcodec2/unittest/sd.c new file mode 100644 index 0000000..f77b509 --- /dev/null +++ b/libs/libcodec2/unittest/sd.c @@ -0,0 +1,84 @@ +/*--------------------------------------------------------------------------*\ + + FILE........: sd.c + AUTHOR......: David Rowe + DATE CREATED: 20/7/93 + + Function to determine spectral distortion between two sets of LPCs. + +\*--------------------------------------------------------------------------*/ + +/* + Copyright (C) 2009 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#define MAX_N 2048 /* maximum DFT size */ + +#include <math.h> +#include "four1.h" +#include "comp.h" +#include "sd.h" + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: spectral_dist() + + AUTHOR......: David Rowe + DATE CREATED: 20/7/93 + + This function returns the soectral distoertion between two + sets of LPCs. + +\*---------------------------------------------------------------------------*/ + +float spectral_dist(float ak1[], float ak2[], int p, int n) +/* float ak1[]; unquantised set of p+1 LPCs */ +/* float ak2[]; quantised set of p+1 LPCs */ +/* int p; LP order */ +/* int n; DFT size to use for SD calculations (power of 2) */ +{ + COMP A1[MAX_N]; /* DFT of ak1[] */ + COMP A2[MAX_N]; /* DFT of ak2[] */ + float P1,P2; /* power of current bin */ + float sd; + int i; + + for(i=0; i<n; i++) { + A1[i].real = 0.0; + A1[i].imag = 0.0; + A2[i].real = 0.0; + A2[i].imag = 0.0; + } + + for(i=0; i<p+1; i++) { + A1[i].real = ak1[i]; + A2[i].real = ak2[i]; + } + + four1(&A1[-1].imag,n,-1); + four1(&A2[-1].imag,n,-1); + + sd = 0.0; + for(i=0; i<n; i++) { + P1 = A1[i].real*A1[i].real + A1[i].imag*A1[i].imag; + P2 = A2[i].real*A2[i].real + A2[i].imag*A2[i].imag; + sd += pow(log10(P2/P1),2.0); + } + sd = 10.0*sqrt(sd/n); /* sd in dB */ + + return(sd); +} diff --git a/libs/libcodec2/unittest/tcodec2.c b/libs/libcodec2/unittest/tcodec2.c new file mode 100644 index 0000000..33806fc --- /dev/null +++ b/libs/libcodec2/unittest/tcodec2.c @@ -0,0 +1,215 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: tcodec2.c + AUTHOR......: David Rowe + DATE CREATED: 24/8/10 + + Test program for codec2.c functions. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2010 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <assert.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <math.h> +#include "defines.h" +#include "codec2.h" +#include "quantise.h" +#include "interp.h" + +/* CODEC2 struct copies from codec2.c to help with testing */ + +typedef struct { + float Sn[M]; /* input speech */ + float w[M]; /* time domain hamming window */ + COMP W[FFT_ENC]; /* DFT of w[] */ + float Pn[2*N]; /* trapezoidal synthesis window */ + float Sn_[2*N]; /* synthesised speech */ + float prev_Wo; /* previous frame's pitch estimate */ + float ex_phase; /* excitation model phase track */ + float bg_est; /* background noise estimate for post filter */ + MODEL prev_model; /* model parameters from 20ms ago */ +} CODEC2; + +void analyse_one_frame(CODEC2 *c2, MODEL *model, short speech[]); +void synthesise_one_frame(CODEC2 *c2, short speech[], MODEL *model, float ak[]); + +int test1() +{ + FILE *fin, *fout; + short buf[N]; + void *c2; + CODEC2 *c3; + MODEL model; + float ak[LPC_ORD+1]; + float lsps[LPC_ORD]; + + c2 = codec2_create(); + c3 = (CODEC2*)c2; + + fin = fopen("../raw/hts1a.raw", "rb"); + assert(fin != NULL); + fout = fopen("hts1a_test.raw", "wb"); + assert(fout != NULL); + + while(fread(buf, sizeof(short), N, fin) == N) { + analyse_one_frame(c3, &model, buf); + speech_to_uq_lsps(lsps, ak, c3->Sn, c3->w, LPC_ORD); + synthesise_one_frame(c3, buf, &model, ak); + fwrite(buf, sizeof(short), N, fout); + } + + codec2_destroy(c2); + + fclose(fin); + fclose(fout); + + return 0; +} + +int test2() +{ + FILE *fin, *fout; + short buf[2*N]; + void *c2; + CODEC2 *c3; + MODEL model, model_interp; + float ak[LPC_ORD+1]; + int voiced1, voiced2; + int lsp_indexes[LPC_ORD]; + int lpc_correction; + int energy_index; + int Wo_index; + char bits[CODEC2_BITS_PER_FRAME]; + int nbit; + int i; + + c2 = codec2_create(); + c3 = (CODEC2*)c2; + + fin = fopen("../raw/hts1a.raw", "rb"); + assert(fin != NULL); + fout = fopen("hts1a_test.raw", "wb"); + assert(fout != NULL); + + while(fread(buf, sizeof(short), 2*N, fin) == 2*N) { + /* first 10ms analysis frame - we just want voicing */ + + analyse_one_frame(c3, &model, buf); + voiced1 = model.voiced; + + /* second 10ms analysis frame */ + + analyse_one_frame(c3, &model, &buf[N]); + voiced2 = model.voiced; + + Wo_index = encode_Wo(model.Wo); + encode_amplitudes(lsp_indexes, + &lpc_correction, + &energy_index, + &model, + c3->Sn, + c3->w); + nbit = 0; + pack(bits, &nbit, Wo_index, WO_BITS); + for(i=0; i<LPC_ORD; i++) { + pack(bits, &nbit, lsp_indexes[i], lsp_bits(i)); + } + pack(bits, &nbit, lpc_correction, 1); + pack(bits, &nbit, energy_index, E_BITS); + pack(bits, &nbit, voiced1, 1); + pack(bits, &nbit, voiced2, 1); + + nbit = 0; + Wo_index = unpack(bits, &nbit, WO_BITS); + for(i=0; i<LPC_ORD; i++) { + lsp_indexes[i] = unpack(bits, &nbit, lsp_bits(i)); + } + lpc_correction = unpack(bits, &nbit, 1); + energy_index = unpack(bits, &nbit, E_BITS); + voiced1 = unpack(bits, &nbit, 1); + voiced2 = unpack(bits, &nbit, 1); + + model.Wo = decode_Wo(Wo_index); + model.L = PI/model.Wo; + decode_amplitudes(&model, + ak, + lsp_indexes, + lpc_correction, + energy_index); + + model.voiced = voiced2; + model_interp.voiced = voiced1; + interpolate(&model_interp, &c3->prev_model, &model); + + synthesise_one_frame(c3, buf, &model_interp, ak); + synthesise_one_frame(c3, &buf[N], &model, ak); + + memcpy(&c3->prev_model, &model, sizeof(MODEL)); + fwrite(buf, sizeof(short), 2*N, fout); + } + + codec2_destroy(c2); + + fclose(fin); + fclose(fout); + + return 0; +} + +int test3() +{ + FILE *fin, *fout, *fbits; + short buf1[2*N]; + short buf2[2*N]; + char bits[CODEC2_BITS_PER_FRAME]; + void *c2; + + c2 = codec2_create(); + + fin = fopen("../raw/hts1a.raw", "rb"); + assert(fin != NULL); + fout = fopen("hts1a_test.raw", "wb"); + assert(fout != NULL); + fbits = fopen("hts1a_test3.bit", "wb"); + assert(fout != NULL); + + while(fread(buf1, sizeof(short), 2*N, fin) == 2*N) { + codec2_encode(c2, bits, buf1); + fwrite(bits, sizeof(char), CODEC2_BITS_PER_FRAME, fbits); + codec2_decode(c2, buf2, bits); + fwrite(buf2, sizeof(short), CODEC2_SAMPLES_PER_FRAME, fout); + } + + codec2_destroy(c2); + + fclose(fin); + fclose(fout); + fclose(fbits); + + return 0; +} + +int main() { + test3(); + return 0; +} diff --git a/libs/libcodec2/unittest/tcontphase.c b/libs/libcodec2/unittest/tcontphase.c new file mode 100644 index 0000000..ee2f662 --- /dev/null +++ b/libs/libcodec2/unittest/tcontphase.c @@ -0,0 +1,187 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: tcontphase.c + AUTHOR......: David Rowe + DATE CREATED: 11/9/09 + + Test program for developing continuous phase track synthesis algorithm. + However while developing this it was discovered that synthesis_mixed() + worked just as well. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2009 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#define N 80 /* frame size */ +#define F 160 /* frames to synthesis */ +#define P 10 /* LPC order */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <math.h> +#include "sine.h" +#include "dump.h" +#include "synth.h" +#include "phase.h" + +int frames; + +float ak[] = { + 1.000000, +-1.455836, + 1.361841, +-0.879267, + 0.915985, +-1.002202, + 0.944103, +-0.743094, + 1.053356, +-0.817491, + 0.431222 +}; + + +/*---------------------------------------------------------------------------*\ + + switch_present() + + Searches the command line arguments for a "switch". If the switch is + found, returns the command line argument where it ws found, else returns + NULL. + +\*---------------------------------------------------------------------------*/ + +int switch_present(sw,argc,argv) + char sw[]; /* switch in string form */ + int argc; /* number of command line arguments */ + char *argv[]; /* array of command line arguments in string form */ +{ + int i; /* loop variable */ + + for(i=1; i<argc; i++) + if (!strcmp(sw,argv[i])) + return(i); + + return 0; +} + +/*---------------------------------------------------------------------------*\ + + MAIN + +\*---------------------------------------------------------------------------*/ + +int main(argc,argv) +int argc; +char *argv[]; +{ + FILE *fout; + short buf[N]; + int i,j; + int dump; + float phi_prev[MAX_AMP]; + float Wo_prev, ex_phase, G; + //float ak[P+1]; + COMP H[MAX_AMP]; + float f0; + + if (argc < 3) { + printf("\nusage: tcontphase OutputRawSpeechFile F0\n"); + exit(0); + } + + /* Output file */ + + if ((fout = fopen(argv[1],"wb")) == NULL) { + printf("Error opening output speech file: %s\n",argv[1]); + exit(1); + } + + f0 = atof(argv[2]); + + dump = switch_present("--dump",argc,argv); + if (dump) + dump_on(argv[dump+1]); + + init_decoder(); + + for(i=0; i<MAX_AMP; i++) + phi_prev[i] = 0.0; + Wo_prev = 0.0; + + model.Wo = PI*(f0/4000.0); + G = 1000.0; + model.L = floor(PI/model.Wo); + + //aks_to_H(&model, ak, G , H, P); + //for(i=1; i<=model.L; i++) + model.A[i] = sqrt(H[i].real*H[i].real + H[i].imag*H[i].imag); + //printf("L = %d\n", model.L); + //model.L = 10; + for(i=1; i<=model.L; i++) { + model.A[i] = 1000/model.L; + model.phi[i] = 0; + H[i].real = 1.0; H[i].imag = 0.0; + } + + //ak[0] = 1.0; + //for(i=1; i<=P; i++) + // ak[i] = 0.0; + + frames = 0; + for(j=0; j<F; j++) { + frames++; + + #ifdef SWAP + /* lets make phases bounce around from frame to frame. This + could happen if H[m] is varying, for example due to frame + to frame Wo variations, or non-stationary speech. + Continous model generally results in smooth phase track + under these circumstances. */ + if (j%2){ + H[1].real = 1.0; H[1].imag = 0.0; + model.phi[1] = 0.0; + } + else { + H[1].real = 0.0; H[1].imag = 1.0; + model.phi[1] = PI/2; + } + #endif + + //#define CONT + #ifdef CONT + synthesise_continuous_phase(Pn, &model, Sn_, 1, &Wo_prev, phi_prev); + #else + phase_synth_zero_order(5.0, H, &Wo_prev, &ex_phase); + synthesise_mixed(Pn,&model,Sn_,1); + #endif + + for(i=0; i<N; i++) + buf[i] = Sn_[i]; + fwrite(buf,sizeof(short),N,fout); + } + + fclose(fout); + if (dump) dump_off(); + + return 0; +} + + diff --git a/libs/libcodec2/unittest/tinterp.c b/libs/libcodec2/unittest/tinterp.c new file mode 100644 index 0000000..7bb37c5 --- /dev/null +++ b/libs/libcodec2/unittest/tinterp.c @@ -0,0 +1,128 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: tinterp.c + AUTHOR......: David Rowe + DATE CREATED: 22/8/10 + + Tests interpolation functions. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2010 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <assert.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <math.h> +#include <ctype.h> + +#include "defines.h" +#include "sine.h" +#include "interp.h" + +void make_amp(MODEL *model, float f0, float cdB, float mdBHz) +{ + int i; + float mdBrad = mdBHz*FS/TWO_PI; + + model->Wo = f0*TWO_PI/FS; + model->L = PI/model->Wo; + for(i=0; i<=model->L; i++) + model->A[i] = pow(10.0,(cdB + (float)i*model->Wo*mdBrad)/20.0); + model->voiced = 1; +} + +void write_amp(char file[], MODEL *model) +{ + FILE *f; + int i; + + f = fopen(file,"wt"); + for(i=1; i<=model->L; i++) + fprintf(f, "%f\t%f\n", model->Wo*i, model->A[i]); + fclose(f); +} + +char *get_next_float(char *s, float *num) +{ + char *p = s; + char tmp[MAX_STR]; + + while(*p && !isspace(*p)) + p++; + memcpy(tmp, s, p-s); + tmp[p-s] = 0; + *num = atof(tmp); + + return p+1; +} + +char *get_next_int(char *s, int *num) +{ + char *p = s; + char tmp[MAX_STR]; + + while(*p && !isspace(*p)) + p++; + memcpy(tmp, s, p-s); + tmp[p-s] = 0; + *num = atoi(tmp); + + return p+1; +} + +void load_amp(MODEL *model, char file[], int frame) +{ + FILE *f; + int i; + char s[1024]; + char *ps; + + f = fopen(file,"rt"); + + for(i=0; i<frame; i++) + fgets(s, 1023, f); + + ps = s; + ps = get_next_float(ps, &model->Wo); + ps = get_next_int(ps, &model->L); + for(i=1; i<=model->L; i++) + ps = get_next_float(ps, &model->A[i]); + + fclose(f); +} + +int main() { + MODEL prev, next, interp; + + //make_amp(&prev, 50.0, 60.0, 6E-3); + //make_amp(&next, 50.0, 40.0, 6E-3); + load_amp(&prev, "../src/hts1a_model.txt", 32); + load_amp(&next, "../src/hts1a_model.txt", 34); + + interp.voiced = 1; + interpolate(&interp, &prev, &next); + + write_amp("tinterp_prev.txt", &prev); + write_amp("tinterp_interp.txt", &interp); + write_amp("tinterp_next.txt", &next); + + return 0; +} diff --git a/libs/libcodec2/unittest/tnlp.c b/libs/libcodec2/unittest/tnlp.c new file mode 100644 index 0000000..4abf69c --- /dev/null +++ b/libs/libcodec2/unittest/tnlp.c @@ -0,0 +1,148 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: tnlp.c + AUTHOR......: David Rowe + DATE CREATED: 23/3/93 + + Test program for non linear pitch estimation functions. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2009 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#define N 80 /* frame size */ +#define M 320 /* pitch analysis window size */ +#define PITCH_MIN 20 +#define PITCH_MAX 160 +#define TNLP + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <math.h> + +#include "defines.h" +#include "dump.h" +#include "sine.h" +#include "nlp.h" + +int frames; + +/*---------------------------------------------------------------------------*\ + + switch_present() + + Searches the command line arguments for a "switch". If the switch is + found, returns the command line argument where it ws found, else returns + NULL. + +\*---------------------------------------------------------------------------*/ + +int switch_present(sw,argc,argv) + char sw[]; /* switch in string form */ + int argc; /* number of command line arguments */ + char *argv[]; /* array of command line arguments in string form */ +{ + int i; /* loop variable */ + + for(i=1; i<argc; i++) + if (!strcmp(sw,argv[i])) + return(i); + + return 0; +} + +/*---------------------------------------------------------------------------*\ + + MAIN + +\*---------------------------------------------------------------------------*/ + +int main(argc,argv) +int argc; +char *argv[]; +{ + FILE *fin,*fout; + short buf[N]; + float Sn[M]; /* float input speech samples */ + COMP Sw[FFT_ENC]; /* DFT of Sn[] */ + float w[M]; /* time domain hamming window */ + COMP W[FFT_ENC]; /* DFT of w[] */ + float pitch; + int i; + int dump; + float prev_Wo; + void *nlp_states; + + if (argc < 3) { + printf("\nusage: tnlp InputRawSpeechFile OutputPitchTextFile " + "[--dump DumpFile]\n"); + exit(0); + } + + /* Input file */ + + if ((fin = fopen(argv[1],"rb")) == NULL) { + printf("Error opening input speech file: %s\n",argv[1]); + exit(1); + } + + /* Output file */ + + if ((fout = fopen(argv[2],"wt")) == NULL) { + printf("Error opening output text file: %s\n",argv[2]); + exit(1); + } + + dump = switch_present("--dump",argc,argv); + if (dump) + dump_on(argv[dump+1]); + + nlp_states = nlp_create(); + make_analysis_window(w,W); + + frames = 0; + prev_Wo = 0; + while(fread(buf,sizeof(short),N,fin)) { + printf("%d\n", frames++); + + /* Update input speech buffers */ + + for(i=0; i<M-N; i++) + Sn[i] = Sn[i+N]; + for(i=0; i<N; i++) + Sn[i+M-N] = buf[i]; + dft_speech(Sw, Sn, w); + dump_Sn(Sn); dump_Sw(Sw); + + nlp(nlp_states,Sn,N,M,PITCH_MIN,PITCH_MAX,&pitch,Sw,&prev_Wo); + prev_Wo = TWO_PI/pitch; + + fprintf(fout,"%f\n",pitch); + } + + fclose(fin); + fclose(fout); + if (dump) dump_off(); + nlp_destroy(nlp_states); + + return 0; +} + + diff --git a/libs/libcodec2/unittest/tquant.c b/libs/libcodec2/unittest/tquant.c new file mode 100644 index 0000000..1ff7564 --- /dev/null +++ b/libs/libcodec2/unittest/tquant.c @@ -0,0 +1,215 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: tquant.c + AUTHOR......: David Rowe + DATE CREATED: 22/8/10 + + Generates quantisation curves for plotting on Octave. + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2010 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include <assert.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <math.h> + +#include "defines.h" +#include "dump.h" +#include "quantise.h" + +int test_Wo_quant(); +int test_lsp_quant(); +int test_lsp(int lsp_number, int levels, float max_error_hz); +int test_energy_quant(int levels, float max_error_dB); + +int main() { + quantise_init(); + test_Wo_quant(); + test_lsp_quant(); + test_energy_quant(E_LEVELS, 0.5*(E_MAX_DB - E_MIN_DB)/E_LEVELS); + + return 0; +} + +int test_lsp_quant() { + test_lsp( 1, 16, 12.5); + test_lsp( 2, 16, 12.5); + test_lsp( 3, 16, 25); + test_lsp( 4, 16, 50); + test_lsp( 5, 16, 50); + test_lsp( 6, 16, 50); + test_lsp( 7, 16, 50); + test_lsp( 8, 8, 50); + test_lsp( 9, 8, 50); + test_lsp(10, 4, 100); + + return 0; +} + +int test_energy_quant(int levels, float max_error_dB) { + FILE *fe; + float e,e_dec, error, low_e, high_e; + int index, index_in, index_out, i; + + /* check 1:1 match between input and output levels */ + + for(i=0; i<levels; i++) { + index_in = i; + e = decode_energy(index_in); + index_out = encode_energy(e); + if (index_in != index_out) { + printf("edB: %f index_in: %d index_out: %d\n", + 10.0*log10(e), index_in, index_out); + exit(0); + } + } + + /* check error over range of quantiser */ + + low_e = decode_energy(0); + high_e = decode_energy(levels-1); + fe = fopen("energy_err.txt", "wt"); + + for(e=low_e; e<high_e; e +=(high_e-low_e)/1000.0) { + index = encode_energy(e); + e_dec = decode_energy(index); + error = 10.0*log10(e) - 10.0*log10(e_dec); + fprintf(fe, "%f\n", error); + if (fabs(error) > max_error_dB) { + printf("error: %f %f\n", error, max_error_dB); + exit(0); + } + } + + fclose(fe); + return 0; +} + +int test_lsp(int lsp_number, int levels, float max_error_hz) { + float lsp[LPC_ORD]; + int indexes_in[LPC_ORD]; + int indexes_out[LPC_ORD]; + int indexes[LPC_ORD]; + int i; + float lowf, highf, f, error; + char s[MAX_STR]; + FILE *flsp; + float max_error_rads; + + lsp_number--; + max_error_rads = max_error_hz*TWO_PI/FS; + + for(i=0; i<LPC_ORD; i++) + indexes_in[i] = 0; + + for(i=0; i<levels; i++) { + indexes_in[lsp_number] = i; + decode_lsps(lsp, indexes_in, LPC_ORD); + encode_lsps(indexes_out, lsp,LPC_ORD); + if (indexes_in[lsp_number] != indexes_out[lsp_number]) { + printf("freq: %f index_in: %d index_out: %d\n", + lsp[lsp_number]+1, indexes_in[lsp_number], + indexes_out[lsp_number]); + exit(0); + } + } + + for(i=0; i<LPC_ORD; i++) + indexes[i] = 0; + indexes[lsp_number] = 0; + decode_lsps(lsp, indexes, LPC_ORD); + lowf = lsp[lsp_number]; + indexes[lsp_number] = levels - 1; + decode_lsps(lsp, indexes, LPC_ORD); + highf = lsp[lsp_number]; + sprintf(s,"lsp%d_err.txt", lsp_number+1); + flsp = fopen(s, "wt"); + + for(f=lowf; f<highf; f +=(highf-lowf)/1000.0) { + lsp[lsp_number] = f; + encode_lsps(indexes, lsp, LPC_ORD); + decode_lsps(lsp, indexes, LPC_ORD); + error = f - lsp[lsp_number]; + fprintf(flsp, "%f\n", error); + if (fabs(error) > max_error_rads) { + printf("%d error: %f %f\n", lsp_number+1, error, max_error_rads); + exit(0); + } + } + + fclose(flsp); + + printf("OK\n"); + + return 0; +} + +int test_Wo_quant() { + int c; + FILE *f; + float Wo,Wo_dec, error, step_size; + int index, index_in, index_out; + + /* output Wo quant curve for plotting */ + + f = fopen("quant_pitch.txt","wt"); + + for(Wo=0.9*(TWO_PI/P_MAX); Wo<=1.1*(TWO_PI/P_MIN); Wo += 0.001) { + index = encode_Wo(Wo); + fprintf(f, "%f %d\n", Wo, index); + } + + fclose(f); + + /* check for all Wo codes we get 1:1 match between encoder + and decoder Wo levels */ + + for(c=0; c<WO_LEVELS; c++) { + index_in = c; + Wo = decode_Wo(index_in); + index_out = encode_Wo(Wo); + if (index_in != index_out) + printf(" Wo %f index_in %d index_out %d\n", Wo, + index_in, index_out); + } + + /* measure quantisation error stats and compare to expected. Also + plot histogram of error file to check. */ + + f = fopen("quant_pitch_err.txt","wt"); + step_size = ((TWO_PI/P_MIN) - (TWO_PI/P_MAX))/WO_LEVELS; + + for(Wo=TWO_PI/P_MAX; Wo<0.99*TWO_PI/P_MIN; Wo += 0.0001) { + index = encode_Wo(Wo); + Wo_dec = decode_Wo(index); + error = Wo - Wo_dec; + if (fabs(error) > (step_size/2.0)) { + printf("error: %f step_size/2: %f\n", error, step_size/2.0); + exit(0); + } + fprintf(f,"%f\n",error); + } + printf("OK\n"); + + fclose(f); + return 0; +} diff --git a/libs/libcodec2/unittest/vqtrain.c b/libs/libcodec2/unittest/vqtrain.c new file mode 100644 index 0000000..b46d4fc --- /dev/null +++ b/libs/libcodec2/unittest/vqtrain.c @@ -0,0 +1,297 @@ +/*--------------------------------------------------------------------------*\ + + FILE........: VQTRAIN.C + AUTHOR......: David Rowe + DATE CREATED: 23/2/95 + + This program trains vector quantisers using K dimensional Lloyd-Max + method. + +\*--------------------------------------------------------------------------*/ + +/* + Copyright (C) 2009 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +/*-----------------------------------------------------------------------*\ + + INCLUDES + +\*-----------------------------------------------------------------------*/ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <math.h> +#include <ctype.h> + +/*-----------------------------------------------------------------------*\ + + DEFINES + +\*-----------------------------------------------------------------------*/ + +#define DELTAQ 0.01 /* quiting distortion */ +#define MAX_STR 80 /* maximum string length */ + +/*-----------------------------------------------------------------------*\ + + FUNCTION PROTOTYPES + +\*-----------------------------------------------------------------------*/ + +void zero(float v[], int k); +void acc(float v1[], float v2[], int k); +void norm(float v[], int k, long n); +long quantise(float cb[], float vec[], int k, int m, float *se); + +/*-----------------------------------------------------------------------*\ + + MAIN + +\*-----------------------------------------------------------------------*/ + +int main(int argc, char *argv[]) { + long k,m; /* dimension and codebook size */ + float *vec; /* current vector */ + float *cb; /* vector codebook */ + float *cent; /* centroids for each codebook entry */ + long *n; /* number of vectors in this interval */ + long J; /* number of vectors in training set */ + long i,j; + long ind; /* index of current vector */ + float se; /* squared error for this iteration */ + float Dn,Dn_1; /* current and previous iterations distortion */ + float delta; /* improvement in distortion */ + FILE *ftrain; /* file containing training set */ + FILE *fvq; /* file containing vector quantiser */ + + /* Interpret command line arguments */ + + if (argc != 5) { + printf("usage: vqtrain TrainFile K M VQFile\n"); + exit(0); + } + + /* Open training file */ + + ftrain = fopen(argv[1],"rb"); + if (ftrain == NULL) { + printf("Error opening training database file: %s\n",argv[1]); + exit(1); + } + + /* determine k and m, and allocate arrays */ + + k = atol(argv[2]); + m = atol(argv[3]); + printf("dimension K=%ld number of entries M=%ld\n", k,m); + vec = (float*)malloc(sizeof(float)*k); + cb = (float*)malloc(sizeof(float)*k*m); + cent = (float*)malloc(sizeof(float)*k*m); + n = (long*)malloc(sizeof(long)*m); + if (cb == NULL || cb == NULL || cent == NULL || vec == NULL) { + printf("Error in malloc.\n"); + exit(1); + } + + /* determine size of training set */ + + J = 0; + while(fread(vec, sizeof(float), k, ftrain) == k) + J++; + printf("J=%ld entries in training set\n", J); + + /* set up initial codebook state from samples of training set */ + + rewind(ftrain); + fread(cb, sizeof(float), k*m, ftrain); + + /* main loop */ + + Dn = 1E32; + j = 1; + do { + Dn_1 = Dn; + + /* zero centroids */ + + for(i=0; i<m; i++) { + zero(¢[i*k], k); + n[i] = 0; + } + + /* quantise training set */ + + se = 0.0; + rewind(ftrain); + for(i=0; i<J; i++) { + fread(vec, sizeof(float), k, ftrain); + ind = quantise(cb, vec, k, m, &se); + n[ind]++; + acc(¢[ind*k], vec, k); + } + Dn = se/J; + delta = (Dn_1-Dn)/Dn; + + printf("\r Iteration %ld, Dn = %f, Delta = %e\n", j, Dn, delta); + j++; + + /* determine new codebook from centriods */ + + if (delta > DELTAQ) + for(i=0; i<m; i++) { + if (n[i] != 0) { + norm(¢[i*k], k, n[i]); + memcpy(&cb[i*k], ¢[i*k], k*sizeof(float)); + } + } + + } while (delta > DELTAQ); + + /* save codebook to disk */ + + fvq = fopen(argv[4],"wt"); + if (fvq == NULL) { + printf("Error opening VQ file: %s\n",argv[4]); + exit(1); + } + + for(j=0; j<m; j++) { + for(i=0; i<k; i++) + fprintf(fvq,"%f ",cb[j*k+i]); + fprintf(fvq,"\n"); + } + fclose(fvq); + + return 0; +} + +/*-----------------------------------------------------------------------*\ + + FUNCTIONS + +\*-----------------------------------------------------------------------*/ + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: zero() + + AUTHOR......: David Rowe + DATE CREATED: 23/2/95 + + Zeros a vector of length k. + +\*---------------------------------------------------------------------------*/ + +void zero(float v[], int k) +/* float v[]; ptr to start of vector */ +/* int k; lngth of vector */ +{ + int i; + + for(i=0; i<k; i++) + v[i] = 0.0; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: acc() + + AUTHOR......: David Rowe + DATE CREATED: 23/2/95 + + Adds k dimensional vectors v1 to v2 and stores the result back in v1. + +\*---------------------------------------------------------------------------*/ + +void acc(float v1[], float v2[], int k) +/* float v1[]; ptr to start of vector to accumulate */ +/* float v2[]; ptr to start of vector to add */ +/* int k; dimension of vectors */ +{ + int i; + + for(i=0; i<k; i++) + v1[i] += v2[i]; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: norm() + + AUTHOR......: David Rowe + DATE CREATED: 23/2/95 + + Divides each element in k dimensional vector v by n. + +\*---------------------------------------------------------------------------*/ + +void norm(float v[], int k, long n) +/* float v[]; ptr to start of vector */ +/* int k; dimension of vectors */ +/* int n; normalising factor */ +{ + int i; + + for(i=0; i<k; i++) + v[i] /= n; +} + +/*---------------------------------------------------------------------------*\ + + FUNCTION....: quantise() + + AUTHOR......: David Rowe + DATE CREATED: 23/2/95 + + Quantises vec by choosing the nearest vector in codebook cb, and + returns the vector index. The squared error of the quantised vector + is added to se. + +\*---------------------------------------------------------------------------*/ + +long quantise(float cb[], float vec[], int k, int m, float *se) +/* float cb[][K]; current VQ codebook */ +/* float vec[]; vector to quantise */ +/* int k; dimension of vectors */ +/* int m; size of codebook */ +/* float *se; accumulated squared error */ +{ + float e; /* current error */ + long besti; /* best index so far */ + float beste; /* best error so far */ + long j; + int i; + + besti = 0; + beste = 1E32; + for(j=0; j<m; j++) { + e = 0.0; + for(i=0; i<k; i++) + e += pow(cb[j*k+i]-vec[i],2.0); + if (e < beste) { + beste = e; + besti = j; + } + } + + *se += beste; + + return(besti); +} + diff --git a/libs/libcodec2/wav/f2400.wav b/libs/libcodec2/wav/f2400.wav new file mode 100644 index 0000000..35c41d9 Binary files /dev/null and b/libs/libcodec2/wav/f2400.wav differ diff --git a/libs/libcodec2/wav/forig.wav b/libs/libcodec2/wav/forig.wav new file mode 100644 index 0000000..81f3f9f Binary files /dev/null and b/libs/libcodec2/wav/forig.wav differ diff --git a/libs/libcodec2/wav/forig_speex_8k.wav b/libs/libcodec2/wav/forig_speex_8k.wav new file mode 100644 index 0000000..ac816f9 Binary files /dev/null and b/libs/libcodec2/wav/forig_speex_8k.wav differ diff --git a/libs/libcodec2/wav/hts1a.wav b/libs/libcodec2/wav/hts1a.wav new file mode 100644 index 0000000..f605089 Binary files /dev/null and b/libs/libcodec2/wav/hts1a.wav differ diff --git a/libs/libcodec2/wav/hts1a_c2_v0.1.wav b/libs/libcodec2/wav/hts1a_c2_v0.1.wav new file mode 100644 index 0000000..f41c70c Binary files /dev/null and b/libs/libcodec2/wav/hts1a_c2_v0.1.wav differ diff --git a/libs/libcodec2/wav/hts1a_g729a.wav b/libs/libcodec2/wav/hts1a_g729a.wav new file mode 100644 index 0000000..f475775 Binary files /dev/null and b/libs/libcodec2/wav/hts1a_g729a.wav differ diff --git a/libs/libcodec2/wav/hts1a_speex_8k.wav b/libs/libcodec2/wav/hts1a_speex_8k.wav new file mode 100644 index 0000000..c192ee0 Binary files /dev/null and b/libs/libcodec2/wav/hts1a_speex_8k.wav differ diff --git a/libs/libcodec2/wav/hts2a.wav b/libs/libcodec2/wav/hts2a.wav new file mode 100644 index 0000000..644b536 Binary files /dev/null and b/libs/libcodec2/wav/hts2a.wav differ diff --git a/libs/libcodec2/wav/hts2a_c2_v0.1.wav b/libs/libcodec2/wav/hts2a_c2_v0.1.wav new file mode 100644 index 0000000..7f0e0f1 Binary files /dev/null and b/libs/libcodec2/wav/hts2a_c2_v0.1.wav differ diff --git a/libs/libcodec2/wav/hts2a_g729a.wav b/libs/libcodec2/wav/hts2a_g729a.wav new file mode 100644 index 0000000..7709a1c Binary files /dev/null and b/libs/libcodec2/wav/hts2a_g729a.wav differ diff --git a/libs/libcodec2/wav/hts2a_speex_8k.wav b/libs/libcodec2/wav/hts2a_speex_8k.wav new file mode 100644 index 0000000..98293b6 Binary files /dev/null and b/libs/libcodec2/wav/hts2a_speex_8k.wav differ diff --git a/libs/libcodec2/wav/m2400.wav b/libs/libcodec2/wav/m2400.wav new file mode 100644 index 0000000..a1fe1a5 Binary files /dev/null and b/libs/libcodec2/wav/m2400.wav differ diff --git a/libs/libcodec2/wav/mmt1.wav b/libs/libcodec2/wav/mmt1.wav new file mode 100644 index 0000000..b0526cb Binary files /dev/null and b/libs/libcodec2/wav/mmt1.wav differ diff --git a/libs/libcodec2/wav/mmt1_speex_8k.wav b/libs/libcodec2/wav/mmt1_speex_8k.wav new file mode 100644 index 0000000..f0191a2 Binary files /dev/null and b/libs/libcodec2/wav/mmt1_speex_8k.wav differ diff --git a/libs/libcodec2/wav/morig.wav b/libs/libcodec2/wav/morig.wav new file mode 100644 index 0000000..eaf52d1 Binary files /dev/null and b/libs/libcodec2/wav/morig.wav differ diff --git a/libs/libcodec2/wav/morig_speex_8k.wav b/libs/libcodec2/wav/morig_speex_8k.wav new file mode 100644 index 0000000..d62d19b Binary files /dev/null and b/libs/libcodec2/wav/morig_speex_8k.wav differ diff --git a/src/mod/codecs/mod_codec2/Makefile b/src/mod/codecs/mod_codec2/Makefile index 87cb1af..568df9c 100644 --- a/src/mod/codecs/mod_codec2/Makefile +++ b/src/mod/codecs/mod_codec2/Makefile @@ -1,7 +1,7 @@ BASE=../../../.. -CODEC2_DIR=$(switch_srcdir)/libs/libcodec2-1.0 -CODEC2_BUILDDIR=$(switch_builddir)/libs/libcodec2-1.0 +CODEC2_DIR=$(switch_srcdir)/libs/libcodec2 +CODEC2_BUILDDIR=$(switch_builddir)/libs/libcodec2 CODEC2LA=$(CODEC2_BUILDDIR)/src/libcodec2.la LOCAL_CFLAGS=-I$(CODEC2_DIR)/include -I$(CODEC2_BUILDDIR)/src commit 549b2356d6c08ac9eb63eee0432805df5d5411f1 Author: Brian West <brian@freeswitch.org> Date: Tue Sep 21 11:45:45 2010 -0500 update to working with latest libcodec2 which will be up on files.freeswitch.org once fixed diff --git a/src/mod/codecs/mod_codec2/mod_codec2.c b/src/mod/codecs/mod_codec2/mod_codec2.c index 7c09b10..e7aa645 100644 --- a/src/mod/codecs/mod_codec2/mod_codec2.c +++ b/src/mod/codecs/mod_codec2/mod_codec2.c @@ -63,33 +63,6 @@ struct codec2_context { static int c2_count = 0; #endif -static void my_pack(uint8_t *dst, unsigned char* bits, int n) -{ - int i; - - for (i = 0; i < n; i++) { - int index = i / 8; - int bit = i % 8; - - if (bits[i]) { - dst[index] |= (1 << bit); - } else { - dst[index] &= ~(1 << bit); - } - } -} - -static void my_unpack(uint8_t *src, unsigned char* bits, int n) -{ - int i; - for (i = 0; i < n; i++) { - int index = i / 8; - int bit = i % 8; - - bits[i] = !!(src[index] & (1 << bit)); - } -} - static switch_status_t switch_codec2_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings) { uint32_t encoding, decoding; @@ -160,7 +133,6 @@ static switch_status_t switch_codec2_encode(switch_codec_t *codec, switch_codec_ unsigned int *flag) { struct codec2_context *context = codec->private_info; - unsigned char encode_buf[CODEC2_BITS_PER_FRAME]; codec2_assert(decoded_data_len == CODEC2_SAMPLES_PER_FRAME * 2); @@ -169,29 +141,7 @@ static switch_status_t switch_codec2_encode(switch_codec_t *codec, switch_codec_ fflush(context->encoder_in); #endif - { - /* Workaround for assertion failure until it makes it into codec2 svn */ - uint8_t *p = (uint8_t*)decoded_data; - int i; - for (i = 0; i < 10; i++) { - if (*p != 0) { - break; - } - } - if (i == 10) { - memset(encoded_data, 0, 8); - *encoded_data_len = 8; - if (flag) { - *flag |= SFF_CNG; - } - return SWITCH_STATUS_SUCCESS; - } - } - - codec2_encode(context->encoder, encode_buf, decoded_data); - - memset(encoded_data, 0, 8); - my_pack(encoded_data, encode_buf, sizeof(encode_buf)); + codec2_encode(context->encoder, encoded_data, decoded_data); #ifdef LOG_DATA fwrite(encode_buf, sizeof(encode_buf), 1, context->encoder_out_unpacked); @@ -216,12 +166,9 @@ static switch_status_t switch_codec2_decode(switch_codec_t *codec, unsigned int *flag) { struct codec2_context *context = codec->private_info; - unsigned char bits[CODEC2_BITS_PER_FRAME]; codec2_assert(encoded_data_len == 8 /* aligned to 8 */); - my_unpack(encoded_data, bits, sizeof(bits)); - #ifdef LOG_DATA fwrite(encoded_data, encoded_data_len, 1, context->decoder_in); fflush(context->decoder_in); @@ -229,7 +176,7 @@ static switch_status_t switch_codec2_decode(switch_codec_t *codec, fflush(context->decoder_in_unpacked); #endif - codec2_decode(context->decoder, decoded_data, bits); + codec2_decode(context->decoder, decoded_data, encoded_data); #ifdef LOG_DATA fwrite(decoded_data, CODEC2_SAMPLES_PER_FRAME, 2, context->decoder_out); commit e1fb79a17956f2f82ee26fd9bf2d81a7b02ca0b5 Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Tue Sep 21 12:43:48 2010 -0400 mod_callcenter: Make sure we fail to load if config is not present diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 874c615..5da8c1f 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -2675,9 +2675,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_callcenter_load) { switch_application_interface_t *app_interface; switch_api_interface_t *api_interface; - - /* connect my internal structure to the blank pointer passed to me */ - *module_interface = switch_loadable_module_create_module_interface(pool, modname); + switch_status_t status; memset(&globals, 0, sizeof(globals)); globals.pool = pool; @@ -2685,11 +2683,16 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_callcenter_load) switch_core_hash_init(&globals.queue_hash, globals.pool); switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool); + if ((status = load_config()) != SWITCH_STATUS_SUCCESS) { + return status; + } + switch_mutex_lock(globals.mutex); globals.running = 1; switch_mutex_unlock(globals.mutex); - load_config(); + /* connect my internal structure to the blank pointer passed to me */ + *module_interface = switch_loadable_module_create_module_interface(pool, modname); if (!AGENT_DISPATCH_THREAD_STARTED) { cc_agent_dispatch_thread_start(); commit 4ea1595481b5bba91352c5f94d4c08f65cb31b96 Author: Jeff Lenk <jeff@jefflenk.com> Date: Tue Sep 21 11:22:16 2010 -0500 tweak build warning diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 8804902..fc0db74 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -1566,7 +1566,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs(const switch_codec_impleme continue; } - if (imp->microseconds_per_packet / 1000 == default_ptime) { + if (imp->microseconds_per_packet / 1000 == (int)default_ptime) { array[i++] = imp; goto found; } commit a329bf12b70e5c06c496c60f2f71e1d3d42bb7c8 Author: David Yat Sin <dyatsin@sangoma.com> Date: Fri Sep 17 15:08:15 2010 -0400 Added handler for case where remote switch misses our CONNECT message Fix for sending wrong address for sng_isdn_retrieve_facility_caller_name Minor fixes diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index e2e67ee..e8ba387 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -131,14 +131,12 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) } - if (conEvnt->facilityStr.eh.pres) { + if (signal_data->facility == SNGISDN_OPT_TRUE && conEvnt->facilityStr.eh.pres) { /* Verify whether the Caller Name will come in a subsequent FACILITY message */ uint16_t ret_val; - uint8_t facility_str[255]; char retrieved_str[255]; - memcpy(facility_str, (uint8_t*)&conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len); - - ret_val = sng_isdn_retrieve_facility_caller_name(facility_str, conEvnt->facilityStr.facilityStr.len, retrieved_str); + + ret_val = sng_isdn_retrieve_facility_caller_name(conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len, retrieved_str); /* return values for "sng_isdn_retrieve_facility_information_following": If there will be no information following, or fails to decode IE, returns -1 @@ -702,14 +700,23 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event) case FTDM_CHANNEL_STATE_GET_CALLERID: /* Update the caller ID Name */ if (facEvnt->facElmt.facStr.pres) { - uint8_t facility_str[255]; - memcpy(facility_str, (uint8_t*)&facEvnt->facElmt.facStr.val, facEvnt->facElmt.facStr.len); char retrieved_str[255]; - if (sng_isdn_retrieve_facility_caller_name(facility_str, facEvnt->facElmt.facStr.len, retrieved_str) != FTDM_SUCCESS) { + + /* return values for "sng_isdn_retrieve_facility_information_following": + If there will be no information following, or fails to decode IE, returns -1 + If there will be no information following, but current FACILITY IE contains a caller name, returns 0 + If there will be information following, returns 1 + */ + + if (sng_isdn_retrieve_facility_caller_name(&facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len, retrieved_str) == 0) { + strcpy(ftdmchan->caller_data.cid_name, retrieved_str); + } else { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Failed to retrieve Caller Name from Facility IE\n"); } - /* Cancel facility timeout */ - ftdm_sched_cancel_timer(signal_data->sched, &sngisdn_info->timers[SNGISDN_TIMER_FACILITY]); + if (signal_data->facility_timeout) { + /* Cancel facility timeout */ + ftdm_sched_cancel_timer(signal_data->sched, &sngisdn_info->timers[SNGISDN_TIMER_FACILITY]); + } } ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); @@ -884,27 +891,32 @@ void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event) break; } break; - case 10: /* Remote switch is in active state */ + case 9: /* Remote switch is in "Incoming call proceeding" state */ switch (ftdmchan->state) { - case FTDM_CHANNEL_STATE_UP: - /* This is ok, they are in active state and we are in active state */ + case FTDM_CHANNEL_STATE_PROGRESS: + case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: + case FTDM_CHANNEL_STATE_GET_CALLERID: /* Do nothing */ break; - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - /* We sent a disconnect message, but remote side missed it ? */ - ftdm_sched_timer(((sngisdn_span_data_t*)ftdmchan->span->signal_data)->sched, "delayed_disconnect", 1, sngisdn_delayed_disconnect, (void*) sngisdn_info, NULL); + case FTDM_CHANNEL_STATE_UP: + /* Remote switch missed our CONNECT message, re-send */ + ftdm_sched_timer(((sngisdn_span_data_t*)ftdmchan->span->signal_data)->sched, "delayed_connect", 1, sngisdn_delayed_connect, (void*) sngisdn_info, NULL); break; default: ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state)); break; } break; - case 9: + case 10: /* Remote switch is in active state */ switch (ftdmchan->state) { - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: + case FTDM_CHANNEL_STATE_UP: + /* This is ok, they are in active state and we are in active state */ /* Do nothing */ break; + case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: + /* We sent a disconnect message, but remote side missed it ? */ + ftdm_sched_timer(((sngisdn_span_data_t*)ftdmchan->span->signal_data)->sched, "delayed_disconnect", 1, sngisdn_delayed_disconnect, (void*) sngisdn_info, NULL); + break; default: ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state)); break; commit a6e502bedf08cb94e06c48ae34d20bba24492bef Author: Mathieu Rene <mrene@avgs.ca> Date: Tue Sep 21 11:41:18 2010 -0400 codec2: update code to new lib diff --git a/src/mod/codecs/mod_codec2/mod_codec2.c b/src/mod/codecs/mod_codec2/mod_codec2.c index e0a7ff6..7c09b10 100644 --- a/src/mod/codecs/mod_codec2/mod_codec2.c +++ b/src/mod/codecs/mod_codec2/mod_codec2.c @@ -63,7 +63,7 @@ struct codec2_context { static int c2_count = 0; #endif -static void pack(uint8_t *dst, char* bits, int n) +static void my_pack(uint8_t *dst, unsigned char* bits, int n) { int i; @@ -79,7 +79,7 @@ static void pack(uint8_t *dst, char* bits, int n) } } -static void unpack(uint8_t *src, char* bits, int n) +static void my_unpack(uint8_t *src, unsigned char* bits, int n) { int i; for (i = 0; i < n; i++) { @@ -160,7 +160,7 @@ static switch_status_t switch_codec2_encode(switch_codec_t *codec, switch_codec_ unsigned int *flag) { struct codec2_context *context = codec->private_info; - char encode_buf[CODEC2_BITS_PER_FRAME]; + unsigned char encode_buf[CODEC2_BITS_PER_FRAME]; codec2_assert(decoded_data_len == CODEC2_SAMPLES_PER_FRAME * 2); @@ -191,7 +191,7 @@ static switch_status_t switch_codec2_encode(switch_codec_t *codec, switch_codec_ codec2_encode(context->encoder, encode_buf, decoded_data); memset(encoded_data, 0, 8); - pack(encoded_data, encode_buf, sizeof(encode_buf)); + my_pack(encoded_data, encode_buf, sizeof(encode_buf)); #ifdef LOG_DATA fwrite(encode_buf, sizeof(encode_buf), 1, context->encoder_out_unpacked); @@ -216,11 +216,11 @@ static switch_status_t switch_codec2_decode(switch_codec_t *codec, unsigned int *flag) { struct codec2_context *context = codec->private_info; - char bits[CODEC2_BITS_PER_FRAME]; + unsigned char bits[CODEC2_BITS_PER_FRAME]; codec2_assert(encoded_data_len == 8 /* aligned to 8 */); - unpack(encoded_data, bits, sizeof(bits)); + my_unpack(encoded_data, bits, sizeof(bits)); #ifdef LOG_DATA fwrite(encoded_data, encoded_data_len, 1, context->decoder_in); commit 5aa13f13e79697a5947a9181139ec12b8bdf0332 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Sep 21 10:37:04 2010 -0500 revert broken patch FSCORE-652 diff --git a/src/switch.c b/src/switch.c index b59097a..a28baba 100644 --- a/src/switch.c +++ b/src/switch.c @@ -271,13 +271,12 @@ int main(int argc, char *argv[]) switch_size_t pid_len, old_pid_len; const char *err = NULL; /* error value for return from freeswitch initialization */ #ifndef WIN32 - int bf = 0; + int nf = 0; /* TRUE if we are running in nofork mode */ char *runas_user = NULL; char *runas_group = NULL; #else int win32_service = 0; #endif - int nf = 0; /* TRUE if we are running in nofork mode */ int nc = 0; /* TRUE if we are running in noconsole mode */ pid_t pid = 0; int i, x; @@ -329,7 +328,6 @@ int main(int argc, char *argv[]) "\t-monotonic-clock -- use monotonic clock as timer source\n" #else "\t-nf -- no forking\n" - "\t-bf -- block until fully started, then fork\n" "\t-u [user] -- specify user to switch to\n" "\t-g [group] -- specify group to switch to\n" #endif "\t-help -- this message\n" "\t-version -- print the version and exit\n" @@ -463,11 +461,6 @@ int main(int argc, char *argv[]) known_opt++; } - if (local_argv[x] && !strcmp(local_argv[x], "-bf")) { - bf++; - known_opt++; - } - if (local_argv[x] && !strcmp(local_argv[x], "-version")) { fprintf(stdout, "FreeSWITCH version: %s\n", SWITCH_VERSION_FULL); return 0; @@ -530,14 +523,8 @@ int main(int argc, char *argv[]) } if (local_argv[x] && !strcmp(local_argv[x], "-nc")) { - if (!nf) { - nc++; - known_opt++; - } else { - /* The flags -nc and -nf are mutually exclusive. Ignoring -nc. */ - nc = 0; - known_opt++; - } + nc++; + known_opt++; } if (local_argv[x] && !strcmp(local_argv[x], "-c")) { @@ -698,7 +685,7 @@ int main(int argc, char *argv[]) #ifdef WIN32 FreeConsole(); #else - if (!nf && !bf) { + if (!nf) { daemonize(); } #endif @@ -813,12 +800,6 @@ int main(int argc, char *argv[]) return 255; } -#ifndef WIN32 - if(bf) { - daemonize(); - } -#endif - switch_core_runtime_loop(nc); destroy_status = switch_core_destroy(); commit ef773e0762ed7f511b4abf3d0225624a597fca6d Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Sep 21 10:17:18 2010 -0500 FSCORE-675 diff --git a/src/switch_event.c b/src/switch_event.c index cfd6a7a..4b1e28a 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -274,7 +274,7 @@ static void *SWITCH_THREAD_FUNC switch_event_dispatch_thread(switch_thread_t *th switch_mutex_lock(EVENT_QUEUE_MUTEX); - EVENT_DISPATCH_QUEUE_RUNNING[my_id] = 1; + EVENT_DISPATCH_QUEUE_RUNNING[my_id] = 0; THREAD_COUNT--; switch_mutex_unlock(EVENT_QUEUE_MUTEX); commit d093a4a4c641f60b06d23b14109a29b7f95f56f9 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Sep 21 10:09:45 2010 -0500 make code more automagic to shut up the dude on the list diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 45703ab..6cf7212 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -359,7 +359,16 @@ switch_mutex_unlock(obj->flag_mutex); #define switch_set_string(_dst, _src) switch_copy_string(_dst, _src, sizeof(_dst)) - static inline char *switch_sanitize_number(char *number) +static inline uint32_t switch_default_ptime(const char *name, uint32_t number) +{ + if (!strcasecmp(name, "G723")) { + return 30; + } + + return 20; +} + +static inline char *switch_sanitize_number(char *number) { char *p = number, *q; char warp[] = "/:"; diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 0d3d9d2..b94ed88 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -3839,7 +3839,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s } if (!ptime) { - ptime = 20; + ptime = switch_default_ptime(rm_encoding, map->rm_pt); } if (!strcasecmp((char *) rm_encoding, "ilbc")) { diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index d23b422..8804902 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -1557,13 +1557,16 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs(const switch_codec_impleme for (hi = switch_hash_first(NULL, loadable_modules.codec_hash); hi; hi = switch_hash_next(hi)) { switch_hash_this(hi, NULL, NULL, &val); codec_interface = (switch_codec_interface_t *) val; - /* Look for a 20ms implementation because it's the safest choice */ + + /* Look for the default ptime of the codec because it's the safest choice */ for (imp = codec_interface->implementations; imp; imp = imp->next) { + uint32_t default_ptime = switch_default_ptime(imp->iananame, imp->ianacode); + if (lock && imp->microseconds_per_packet != lock) { continue; } - if (imp->microseconds_per_packet / 1000 == 20) { + if (imp->microseconds_per_packet / 1000 == default_ptime) { array[i++] = imp; goto found; } @@ -1623,15 +1626,16 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_ } if ((codec_interface = switch_loadable_module_get_codec_interface(name)) != 0) { - /* If no specific codec interval is requested opt for 20ms above all else because lots of stuff assumes it */ + /* If no specific codec interval is requested opt for the default above all else because lots of stuff assumes it */ for (imp = codec_interface->implementations; imp; imp = imp->next) { - + uint32_t default_ptime = switch_default_ptime(imp->iananame, imp->ianacode); + if (imp->codec_type != SWITCH_CODEC_TYPE_VIDEO) { if (lock && imp->microseconds_per_packet != lock) { continue; } - - if ((!interval && (uint32_t) (imp->microseconds_per_packet / 1000) != 20) || + + if ((!interval && (uint32_t) (imp->microseconds_per_packet / 1000) != default_ptime) || (interval && (uint32_t) (imp->microseconds_per_packet / 1000) != interval)) { continue; } @@ -1647,7 +1651,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_ } - /* Either looking for a specific interval or there was no interval specified and there wasn't one @20ms available */ + /* Either looking for a specific interval or there was no interval specified and there wasn't one at the default ptime available */ for (imp = codec_interface->implementations; imp; imp = imp->next) { if (imp->codec_type != SWITCH_CODEC_TYPE_VIDEO) { commit 04ca07512d76c57d166daa91fd68110939d0605f Author: Mathieu Rene <mrene@avgs.ca> Date: Tue Sep 21 10:57:34 2010 -0400 codec2: working prototype, still for testing only diff --git a/src/mod/codecs/mod_codec2/mod_codec2.c b/src/mod/codecs/mod_codec2/mod_codec2.c index 65780e8..e0a7ff6 100644 --- a/src/mod/codecs/mod_codec2/mod_codec2.c +++ b/src/mod/codecs/mod_codec2/mod_codec2.c @@ -22,6 +22,7 @@ * the Initial Developer. All Rights Reserved. * * Contributor(s): + * Mathieu Rene <mrene@avgs.ca> * * mod_codec2 -- FreeSWITCH CODEC2 Module * @@ -30,6 +31,17 @@ #include <switch.h> #include <codec2.h> +/* Uncomment to log input/output data for debugging +#define LOG_DATA +#define CODEC2_DEBUG +*/ + +#ifdef CODEC2_DEBUG +#define codec2_assert(_x) switch_assert(_x) +#else +#define codec2_assert(_x) +#endif + SWITCH_MODULE_LOAD_FUNCTION(mod_codec2_load); SWITCH_MODULE_DEFINITION(mod_codec2, mod_codec2_load, NULL, NULL); @@ -37,8 +49,47 @@ SWITCH_MODULE_DEFINITION(mod_codec2, mod_codec2_load, NULL, NULL); struct codec2_context { void *encoder; void *decoder; +#ifdef LOG_DATA + FILE *encoder_in; + FILE *encoder_out; + FILE *encoder_out_unpacked; + FILE *decoder_in; + FILE *decoder_in_unpacked; + FILE *decoder_out; +#endif }; +#ifdef LOG_DATA +static int c2_count = 0; +#endif + +static void pack(uint8_t *dst, char* bits, int n) +{ + int i; + + for (i = 0; i < n; i++) { + int index = i / 8; + int bit = i % 8; + + if (bits[i]) { + dst[index] |= (1 << bit); + } else { + dst[index] &= ~(1 << bit); + } + } +} + +static void unpack(uint8_t *src, char* bits, int n) +{ + int i; + for (i = 0; i < n; i++) { + int index = i / 8; + int bit = i % 8; + + bits[i] = !!(src[index] & (1 << bit)); + } +} + static switch_status_t switch_codec2_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings) { uint32_t encoding, decoding; @@ -54,10 +105,47 @@ static switch_status_t switch_codec2_init(switch_codec_t *codec, switch_codec_fl if (!(context = switch_core_alloc(codec->memory_pool, sizeof(*context)))) { return SWITCH_STATUS_FALSE; } - context->encoder = codec2_create(); - context->decoder = codec2_create(); + + if (encoding) { + context->encoder = codec2_create(); + } + + if (decoding) { + context->decoder = codec2_create(); + } codec->private_info = context; + +#ifdef LOG_DATA + { + + int c = c2_count++; + char buf[1024]; + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Logging as /tmp/c2-%d-*\n", c); + + if (encoding) { + snprintf(buf, sizeof(buf), "/tmp/c2-%d-enc-in", c); + context->encoder_in = fopen(buf, "w"); + + snprintf(buf, sizeof(buf), "/tmp/c2-%d-enc-out", c); + context->encoder_out = fopen(buf, "w"); + + snprintf(buf, sizeof(buf), "/tmp/c2-%d-enc-out-unpacked", c); + context->encoder_out_unpacked = fopen(buf, "w"); + } + if (decoding) { + snprintf(buf, sizeof(buf), "/tmp/c2-%d-dec-in", c); + context->decoder_in = fopen(buf, "w"); + + snprintf(buf, sizeof(buf), "/tmp/c2-%d-dec-out", c); + context->decoder_out = fopen(buf, "w"); + + snprintf(buf, sizeof(buf), "/tmp/c2-%d-dec-out-unpacked", c); + context->decoder_in_unpacked = fopen(buf, "w"); + } + } +#endif return SWITCH_STATUS_SUCCESS; } @@ -72,13 +160,47 @@ static switch_status_t switch_codec2_encode(switch_codec_t *codec, switch_codec_ unsigned int *flag) { struct codec2_context *context = codec->private_info; + char encode_buf[CODEC2_BITS_PER_FRAME]; - switch_assert(decoded_data_len == 160 * 2); + codec2_assert(decoded_data_len == CODEC2_SAMPLES_PER_FRAME * 2); - codec2_encode(context->encoder, encoded_data, decoded_data); +#ifdef LOG_DATA + fwrite(decoded_data, decoded_data_len, 1, context->encoder_in); + fflush(context->encoder_in); +#endif + + { + /* Workaround for assertion failure until it makes it into codec2 svn */ + uint8_t *p = (uint8_t*)decoded_data; + int i; + for (i = 0; i < 10; i++) { + if (*p != 0) { + break; + } + } + if (i == 10) { + memset(encoded_data, 0, 8); + *encoded_data_len = 8; + if (flag) { + *flag |= SFF_CNG; + } + return SWITCH_STATUS_SUCCESS; + } + } + + codec2_encode(context->encoder, encode_buf, decoded_data); + + memset(encoded_data, 0, 8); + pack(encoded_data, encode_buf, sizeof(encode_buf)); - *encoded_data_len = 7; /* 51 bits */ - *encoded_rate = 8000; +#ifdef LOG_DATA + fwrite(encode_buf, sizeof(encode_buf), 1, context->encoder_out_unpacked); + fflush(context->encoder_out_unpacked); + fwrite(encoded_data, 8, 1, context->encoder_out); + fflush(context->encoder_out); +#endif + + *encoded_data_len = 8; return SWITCH_STATUS_SUCCESS; } @@ -94,13 +216,27 @@ static switch_status_t switch_codec2_decode(switch_codec_t *codec, unsigned int *flag) { struct codec2_context *context = codec->private_info; + char bits[CODEC2_BITS_PER_FRAME]; + + codec2_assert(encoded_data_len == 8 /* aligned to 8 */); + + unpack(encoded_data, bits, sizeof(bits)); - switch_assert(encoded_data_len == 7); +#ifdef LOG_DATA + fwrite(encoded_data, encoded_data_len, 1, context->decoder_in); + fflush(context->decoder_in); + fwrite(bits, sizeof(bits), 1, context->decoder_in_unpacked); + fflush(context->decoder_in_unpacked); +#endif + + codec2_decode(context->decoder, decoded_data, bits); - codec2_encode(context->decoder, decoded_data, encoded_data); +#ifdef LOG_DATA + fwrite(decoded_data, CODEC2_SAMPLES_PER_FRAME, 2, context->decoder_out); + fflush(context->decoder_out); +#endif - *decoded_data_len = 160 * 2; /* 160 samples */ - *decoded_rate = 8000; + *decoded_data_len = CODEC2_SAMPLES_PER_FRAME * 2; /* 160 samples */ return SWITCH_STATUS_SUCCESS; } @@ -111,11 +247,31 @@ static switch_status_t switch_codec2_destroy(switch_codec_t *codec) codec2_destroy(context->encoder); codec2_destroy(context->decoder); - - + context->encoder = NULL; context->decoder = NULL; - + +#ifdef LOG_DATA + if (context->encoder_in) { + fclose(context->encoder_in); + } + if (context->encoder_out) { + fclose(context->encoder_out); + } + if (context->encoder_out_unpacked) { + fclose(context->encoder_out_unpacked); + } + if (context->decoder_in) { + fclose(context->decoder_in); + } + if (context->decoder_in_unpacked) { + fclose(context->decoder_in_unpacked); + } + if (context->decoder_out) { + fclose(context->decoder_out); + } +#endif + return SWITCH_STATUS_SUCCESS; } @@ -128,23 +284,23 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_codec2_load) SWITCH_ADD_CODEC(codec_interface, "CODEC2 2550bps"); switch_core_codec_add_implementation(pool, codec_interface, - SWITCH_CODEC_TYPE_AUDIO, - 0, - "CODEC2", - NULL, - 8000, /* samples/sec */ - 8000, /* samples/sec */ - 2550, /* bps */ - 20000, /* ptime */ - 160, /* samples decoded */ - 320, /* bytes decoded */ - 7, /* bytes encoded */ - 1, /* channels */ - 1, /* frames/packet */ - switch_codec2_init, - switch_codec2_encode, - switch_codec2_decode, - switch_codec2_destroy); + SWITCH_CODEC_TYPE_AUDIO, + 111, + "CODEC2", + NULL, + 8000, /* samples/sec */ + 8000, /* samples/sec */ + 2550, /* bps */ + 20000, /* ptime */ + CODEC2_SAMPLES_PER_FRAME, /* samples decoded */ + CODEC2_SAMPLES_PER_FRAME*2, /* bytes decoded */ + 0, /* bytes encoded */ + 1, /* channels */ + 1, /* frames/packet */ + switch_codec2_init, + switch_codec2_encode, + switch_codec2_decode, + switch_codec2_destroy); return SWITCH_STATUS_SUCCESS; } commit f7d16ecd3b387491db04bb0df82a1c2ff9dab9a0 Author: Brian West <brian@freeswitch.org> Date: Tue Sep 21 08:56:55 2010 -0500 work in progress not fully functional yet diff --git a/src/mod/codecs/mod_codec2/Makefile b/src/mod/codecs/mod_codec2/Makefile new file mode 100644 index 0000000..87cb1af --- /dev/null +++ b/src/mod/codecs/mod_codec2/Makefile @@ -0,0 +1,14 @@ +BASE=../../../.. + +CODEC2_DIR=$(switch_srcdir)/libs/libcodec2-1.0 +CODEC2_BUILDDIR=$(switch_builddir)/libs/libcodec2-1.0 +CODEC2LA=$(CODEC2_BUILDDIR)/src/libcodec2.la + +LOCAL_CFLAGS=-I$(CODEC2_DIR)/include -I$(CODEC2_BUILDDIR)/src +LOCAL_LIBADD=$(CODEC2LA) +include $(BASE)/build/modmake.rules + +$(CODEC2LA): $(CODEC2_DIR) $(CODEC2_DIR)/.update + cd $(CODEC2_BUILDDIR) && $(MAKE) + $(TOUCH_TARGET) + diff --git a/src/mod/codecs/mod_codec2/mod_codec2.c b/src/mod/codecs/mod_codec2/mod_codec2.c new file mode 100644 index 0000000..65780e8 --- /dev/null +++ b/src/mod/codecs/mod_codec2/mod_codec2.c @@ -0,0 +1,161 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (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.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is FreeSWITCH Modular Media Switching Software Library + * + * The Initial Developer of the Original Code is + * Brian West <brian@freeswitch.org> + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * mod_codec2 -- FreeSWITCH CODEC2 Module + * + */ + +#include <switch.h> +#include <codec2.h> + +SWITCH_MODULE_LOAD_FUNCTION(mod_codec2_load); + +SWITCH_MODULE_DEFINITION(mod_codec2, mod_codec2_load, NULL, NULL); + +struct codec2_context { + void *encoder; + void *decoder; +}; + +static switch_status_t switch_codec2_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings) +{ + uint32_t encoding, decoding; + struct codec2_context *context = NULL; + + encoding = (flags & SWITCH_CODEC_FLAG_ENCODE); + decoding = (flags & SWITCH_CODEC_FLAG_DECODE); + + if (!(encoding || decoding)) { + return SWITCH_STATUS_FALSE; + } + + if (!(context = switch_core_alloc(codec->memory_pool, sizeof(*context)))) { + return SWITCH_STATUS_FALSE; + } + context->encoder = codec2_create(); + context->decoder = codec2_create(); + + codec->private_info = context; + + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t switch_codec2_encode(switch_codec_t *codec, switch_codec_t *other_codec, + void *decoded_data, + uint32_t decoded_data_len, + uint32_t decoded_rate, + void *encoded_data, + uint32_t *encoded_data_len, + uint32_t *encoded_rate, + unsigned int *flag) +{ + struct codec2_context *context = codec->private_info; + + switch_assert(decoded_data_len == 160 * 2); + + codec2_encode(context->encoder, encoded_data, decoded_data); + + *encoded_data_len = 7; /* 51 bits */ + *encoded_rate = 8000; + + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t switch_codec2_decode(switch_codec_t *codec, + switch_codec_t *other_codec, + void *encoded_data, + uint32_t encoded_data_len, + uint32_t encoded_rate, + void *decoded_data, + uint32_t *decoded_data_len, + uint32_t *decoded_rate, + unsigned int *flag) +{ + struct codec2_context *context = codec->private_info; + + switch_assert(encoded_data_len == 7); + + codec2_encode(context->decoder, decoded_data, encoded_data); + + *decoded_data_len = 160 * 2; /* 160 samples */ + *decoded_rate = 8000; + + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t switch_codec2_destroy(switch_codec_t *codec) +{ + struct codec2_context *context = codec->private_info; + + codec2_destroy(context->encoder); + codec2_destroy(context->decoder); + + + context->encoder = NULL; + context->decoder = NULL; + + return SWITCH_STATUS_SUCCESS; +} + +SWITCH_MODULE_LOAD_FUNCTION(mod_codec2_load) +{ + switch_codec_interface_t *codec_interface; + + *module_interface = switch_loadable_module_create_module_interface(pool, modname); + + SWITCH_ADD_CODEC(codec_interface, "CODEC2 2550bps"); + + switch_core_codec_add_implementation(pool, codec_interface, + SWITCH_CODEC_TYPE_AUDIO, + 0, + "CODEC2", + NULL, + 8000, /* samples/sec */ + 8000, /* samples/sec */ + 2550, /* bps */ + 20000, /* ptime */ + 160, /* samples decoded */ + 320, /* bytes decoded */ + 7, /* bytes encoded */ + 1, /* channels */ + 1, /* frames/packet */ + switch_codec2_init, + switch_codec2_encode, + switch_codec2_decode, + switch_codec2_destroy); + + return SWITCH_STATUS_SUCCESS; +} + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4: + */ commit baead3ddf0abc03c7986ebfd33ecfbfd304781d7 Author: Moises Silva <moises.silva@gmail.com> Date: Tue Sep 21 09:46:33 2010 -0400 freetdm: handle timer id wrap-around diff --git a/libs/freetdm/src/ftdm_sched.c b/libs/freetdm/src/ftdm_sched.c index 340f442..be21696 100644 --- a/libs/freetdm/src/ftdm_sched.c +++ b/libs/freetdm/src/ftdm_sched.c @@ -325,6 +325,13 @@ FT_DECLARE(ftdm_status_t) ftdm_sched_timer(ftdm_sched_t *sched, const char *name } newtimer->id = sched->currid; sched->currid++; + if (!sched->currid) { + ftdm_log(FTDM_LOG_NOTICE, "Timer id wrap around for sched %s\n", sched->name); + /* we do not want currid to be zero since is an invalid id + * TODO: check that currid does not exists already in the context, it'd be insane + * though, having a timer to live all that time */ + sched->currid++; + } ftdm_set_string(newtimer->name, name); newtimer->callback = callback; commit b3f9bfcba56c42480e61d9b9a02a0996a02cf87d Author: Moises Silva <moises.silva@gmail.com> Date: Tue Sep 21 09:34:04 2010 -0400 freetdm: define safety hangup timer and use internal hangup function diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 84ce1ac..97aa01b 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -50,6 +50,7 @@ #endif #include "ftdm_cpu_monitor.h" +#define FORCE_HANGUP_TIMER 3000 #define SPAN_PENDING_CHANS_QUEUE_SIZE 1000 #define SPAN_PENDING_SIGNALS_QUEUE_SIZE 1000 #define FTDM_READ_TRACE_INDEX 0 @@ -4615,8 +4616,8 @@ static void execute_safety_hangup(void *data) ftdm_channel_lock(fchan); fchan->hangup_timer = 0; if (fchan->state == FTDM_CHANNEL_STATE_TERMINATING) { - ftdm_log_chan_msg(fchan, FTDM_LOG_CRIT, "Forcing hangup\n"); - ftdm_channel_call_hangup(fchan); + ftdm_log_chan(fchan, FTDM_LOG_CRIT, "Forcing hangup since the user did not confirmed our hangup after %dms\n", FORCE_HANGUP_TIMER); + call_hangup(fchan, __FILE__, __FUNCTION__, __LINE__); } else { ftdm_log_chan(fchan, FTDM_LOG_CRIT, "Not performing safety hangup, channel state is %s\n", ftdm_channel_state2str(fchan->state)); } @@ -4659,7 +4660,7 @@ FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t if (sigmsg->channel->state == FTDM_CHANNEL_STATE_TERMINATING) { ftdm_log_chan_msg(sigmsg->channel, FTDM_LOG_DEBUG, "Scheduling safety hangup timer\n"); /* if the user does not move us to hangup in 2 seconds, we will do it ourselves */ - ftdm_sched_timer(globals.timingsched, "safety-hangup", 2000, execute_safety_hangup, sigmsg->channel, &sigmsg->channel->hangup_timer); + ftdm_sched_timer(globals.timingsched, "safety-hangup", FORCE_HANGUP_TIMER, execute_safety_hangup, sigmsg->channel, &sigmsg->channel->hangup_timer); } break; commit 696becc093a8faf05ac398d8e1a2d433abbbf6f7 Author: Moises Silva <moy@sangoma.com> Date: Tue Sep 21 07:19:56 2010 -0400 freetdm: add force hangup timer and refactor scheduling code diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 6991e9a..84ce1ac 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -102,6 +102,7 @@ static struct { ftdm_mutex_t *mutex; ftdm_mutex_t *span_mutex; ftdm_mutex_t *group_mutex; + ftdm_sched_t *timingsched; uint32_t span_index; uint32_t group_index; uint32_t running; @@ -2002,6 +2003,9 @@ static ftdm_status_t call_hangup(ftdm_channel_t *chan, const char *file, const c /* make user's life easier, and just ignore double hangup requests */ return FTDM_SUCCESS; } + if (chan->hangup_timer) { + ftdm_sched_cancel_timer(globals.timingsched, chan->hangup_timer); + } ftdm_channel_set_state(file, func, line, chan, FTDM_CHANNEL_STATE_HANGUP, 1); } else { /* the signaling stack did not touch the state, @@ -2283,6 +2287,9 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_done(ftdm_channel_t *ftdmchan) close_dtmf_debug(ftdmchan); #endif ftdm_channel_clear_vars(ftdmchan); + if (ftdmchan->hangup_timer) { + ftdm_sched_cancel_timer(globals.timingsched, ftdmchan->hangup_timer); + } ftdmchan->init_state = FTDM_CHANNEL_STATE_DOWN; ftdmchan->state = FTDM_CHANNEL_STATE_DOWN; @@ -4601,6 +4608,21 @@ FT_DECLARE(ftdm_status_t) ftdm_span_trigger_signals(const ftdm_span_t *span) return FTDM_SUCCESS; } + +static void execute_safety_hangup(void *data) +{ + ftdm_channel_t *fchan = data; + ftdm_channel_lock(fchan); + fchan->hangup_timer = 0; + if (fchan->state == FTDM_CHANNEL_STATE_TERMINATING) { + ftdm_log_chan_msg(fchan, FTDM_LOG_CRIT, "Forcing hangup\n"); + ftdm_channel_call_hangup(fchan); + } else { + ftdm_log_chan(fchan, FTDM_LOG_CRIT, "Not performing safety hangup, channel state is %s\n", ftdm_channel_state2str(fchan->state)); + } + ftdm_channel_unlock(fchan); +} + FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t *sigmsg) { if (sigmsg->channel) { @@ -4634,6 +4656,11 @@ FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t ftdm_log_chan_msg(sigmsg->channel, FTDM_LOG_DEBUG, "Ignoring SIGEVENT_STOP since user already requested hangup\n"); goto done; } + if (sigmsg->channel->state == FTDM_CHANNEL_STATE_TERMINATING) { + ftdm_log_chan_msg(sigmsg->channel, FTDM_LOG_DEBUG, "Scheduling safety hangup timer\n"); + /* if the user does not move us to hangup in 2 seconds, we will do it ourselves */ + ftdm_sched_timer(globals.timingsched, "safety-hangup", 2000, execute_safety_hangup, sigmsg->channel, &sigmsg->channel->hangup_timer); + } break; default: @@ -4755,6 +4782,14 @@ FT_DECLARE(ftdm_status_t) ftdm_global_init(void) ftdm_mutex_create(&globals.span_mutex); ftdm_mutex_create(&globals.group_mutex); ftdm_sched_global_init(); + if (ftdm_sched_create(&globals.timingsched, "freetdm-master") != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_CRIT, "Failed to create master timing schedule context\n"); + return FTDM_FAIL; + } + if (ftdm_sched_free_run(globals.timingsched) != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_CRIT, "Failed to run master timing schedule context\n"); + return FTDM_FAIL; + } globals.running = 1; return FTDM_SUCCESS; } @@ -4807,6 +4842,8 @@ FT_DECLARE(ftdm_status_t) ftdm_global_destroy(void) globals.running = 0; + ftdm_sched_destroy(&globals.timingsched); + ftdm_cpu_monitor_stop(); globals.span_index = 0; diff --git a/libs/freetdm/src/ftdm_sched.c b/libs/freetdm/src/ftdm_sched.c index 5aacc20..340f442 100644 --- a/libs/freetdm/src/ftdm_sched.c +++ b/libs/freetdm/src/ftdm_sched.c @@ -34,6 +34,8 @@ #include "private/ftdm_core.h" +typedef struct ftdm_timer ftdm_timer_t; + static struct { ftdm_sched_t *freeruns; ftdm_mutex_t *mutex; @@ -42,6 +44,7 @@ static struct { struct ftdm_sched { char name[80]; + ftdm_timer_id_t currid; ftdm_mutex_t *mutex; ftdm_timer_t *timers; int freerun; @@ -51,6 +54,7 @@ struct ftdm_sched { struct ftdm_timer { char name[80]; + ftdm_timer_id_t id; #ifdef __linux__ struct timeval time; #endif @@ -191,6 +195,7 @@ FT_DECLARE(ftdm_status_t) ftdm_sched_create(ftdm_sched_t **sched, const char *na } ftdm_set_string(newsched->name, name); + newsched->currid = 1; *sched = newsched; ftdm_log(FTDM_LOG_DEBUG, "Created schedule %s\n", name); @@ -219,12 +224,13 @@ FT_DECLARE(ftdm_status_t) ftdm_sched_run(ftdm_sched_t *sched) int rc = -1; void *data; struct timeval now; - ftdm_assert_return(sched != NULL, FTDM_EINVAL, "sched is null!\n"); - ftdm_mutex_lock(sched->mutex); + ftdm_assert_return(sched != NULL, FTDM_EINVAL, "sched is null!\n"); tryagain: + ftdm_mutex_lock(sched->mutex); + rc = gettimeofday(&now, NULL); if (rc == -1) { ftdm_log(FTDM_LOG_ERROR, "Failed to retrieve time of day\n"); @@ -257,11 +263,16 @@ tryagain: runtimer->prev->next = runtimer->next; } + runtimer->id = 0; ftdm_safe_free(runtimer); + /* avoid deadlocks by releasing the sched lock before triggering callbacks */ + ftdm_mutex_unlock(sched->mutex); + callback(data); /* after calling a callback we must start the scanning again since the - * callback may have added or cancelled timers to the linked list */ + * callback or some other thread may have added or cancelled timers to + * the linked list */ goto tryagain; } } @@ -283,7 +294,7 @@ done: } FT_DECLARE(ftdm_status_t) ftdm_sched_timer(ftdm_sched_t *sched, const char *name, - int ms, ftdm_sched_callback_t callback, void *data, ftdm_timer_t **timer) + int ms, ftdm_sched_callback_t callback, void *data, ftdm_timer_id_t *timerid) { ftdm_status_t status = FTDM_FAIL; #ifdef __linux__ @@ -296,8 +307,8 @@ FT_DECLARE(ftdm_status_t) ftdm_sched_timer(ftdm_sched_t *sched, const char *name ftdm_assert_return(callback != NULL, FTDM_EINVAL, "sched callback is null!\n"); ftdm_assert_return(ms > 0, FTDM_EINVAL, "milliseconds must be bigger than 0!\n"); - if (timer) { - *timer = NULL; + if (timerid) { + *timerid = 0; } rc = gettimeofday(&now, NULL); @@ -312,6 +323,8 @@ FT_DECLARE(ftdm_status_t) ftdm_sched_timer(ftdm_sched_t *sched, const char *name if (!newtimer) { goto done; } + newtimer->id = sched->currid; + sched->currid++; ftdm_set_string(newtimer->name, name); newtimer->callback = callback; @@ -332,9 +345,10 @@ FT_DECLARE(ftdm_status_t) ftdm_sched_timer(ftdm_sched_t *sched, const char *name sched->timers = newtimer; } - if (timer) { - *timer = newtimer; + if (timerid) { + *timerid = newtimer->id; } + status = FTDM_SUCCESS; done: @@ -418,53 +432,37 @@ done: return status; } -FT_DECLARE(ftdm_status_t) ftdm_sched_cancel_timer(ftdm_sched_t *sched, ftdm_timer_t **intimer) +FT_DECLARE(ftdm_status_t) ftdm_sched_cancel_timer(ftdm_sched_t *sched, ftdm_timer_id_t timerid) { ftdm_status_t status = FTDM_FAIL; ftdm_timer_t *timer; ftdm_assert_return(sched != NULL, FTDM_EINVAL, "sched is null!\n"); - ftdm_assert_return(intimer != NULL, FTDM_EINVAL, "timer is null!\n"); - ftdm_assert_return(*intimer != NULL, FTDM_EINVAL, "timer is null!\n"); - - ftdm_mutex_lock(sched->mutex); - /* special case where the cancelled timer is the head */ - if (*intimer == sched->timers) { - timer = *intimer; - /* the timer next is the new head (even if that means the new head will be NULL)*/ - sched->timers = timer->next; - /* if there is a new head, clean its prev member */ - if (sched->timers) { - sched->timers->prev = NULL; - } - /* free the old head */ - ftdm_safe_free(timer); - status = FTDM_SUCCESS; - *intimer = NULL; - goto done; + if (!timerid) { + return FTDM_SUCCESS; } - /* look for the timer and destroy it (we know now that is not head, se we start at the next member after head) */ - for (timer = sched->timers->next; timer; timer = timer->next) { - if (timer == *intimer) { + ftdm_mutex_lock(sched->mutex); + + /* look for the timer and destroy it */ + for (timer = sched->timers; timer; timer = timer->next) { + if (timer->id == timerid) { + if (timer == sched->timers) { + /* it's the head timer, put a new head */ + sched->timers = timer->next; + } if (timer->prev) { timer->prev->next = timer->next; } if (timer->next) { timer->next->prev = timer->prev; } - ftdm_log(FTDM_LOG_DEBUG, "cancelled timer %s\n", timer->name); ftdm_safe_free(timer); status = FTDM_SUCCESS; - *intimer = NULL; break; } } -done: - if (status == FTDM_FAIL) { - ftdm_log(FTDM_LOG_ERROR, "Could not find timer %s to cancel it\n", (*intimer)->name); - } ftdm_mutex_unlock(sched->mutex); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index cd96a18..ae6c0d9 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -156,7 +156,7 @@ typedef struct sngisdn_chan_data { uint8_t globalFlg; sngisdn_glare_data_t glare; - ftdm_timer_t *timers[SNGISDN_NUM_TIMERS]; + ftdm_timer_id_t timers[SNGISDN_NUM_TIMERS]; } sngisdn_chan_data_t; /* Span specific data */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index e2e67ee..d63ee4c 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -709,7 +709,7 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event) ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Failed to retrieve Caller Name from Facility IE\n"); } /* Cancel facility timeout */ - ftdm_sched_cancel_timer(signal_data->sched, &sngisdn_info->timers[SNGISDN_TIMER_FACILITY]); + ftdm_sched_cancel_timer(signal_data->sched, sngisdn_info->timers[SNGISDN_TIMER_FACILITY]); } ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index d8947f6..a701c13 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -425,6 +425,7 @@ struct ftdm_channel { float txgain; int availability_rate; void *user_private; + ftdm_timer_id_t hangup_timer; #ifdef FTDM_DEBUG_DTMF ftdm_dtmf_debug_t dtmfdbg; #endif diff --git a/libs/freetdm/src/include/private/ftdm_sched.h b/libs/freetdm/src/include/private/ftdm_sched.h index 0951d05..9a22289 100644 --- a/libs/freetdm/src/include/private/ftdm_sched.h +++ b/libs/freetdm/src/include/private/ftdm_sched.h @@ -44,8 +44,8 @@ extern "C" { #define FTDM_MICROSECONDS_PER_SECOND 1000000 typedef struct ftdm_sched ftdm_sched_t; -typedef struct ftdm_timer ftdm_timer_t; typedef void (*ftdm_sched_callback_t)(void *data); +typedef uint64_t ftdm_timer_id_t; /*! \brief Create a new scheduling context */ FT_DECLARE(ftdm_status_t) ftdm_sched_create(ftdm_sched_t **sched, const char *name); @@ -62,18 +62,22 @@ FT_DECLARE(ftdm_status_t) ftdm_sched_free_run(ftdm_sched_t *sched); * \param name Timer name, typically unique but is not required to be unique, any null terminated string is fine (required) * \param callback The callback to call upon timer expiration (required) * \param data Optional data to pass to the callback - * \param timer The timer that was created, it can be NULL if you dont care, - * but you need this if you want to be able to cancel the timer with ftdm_sched_cancel_timer + * \param timer Timer id pointer to store the id of the newly created timer. It can be null + * if you do not need to know the id, but you need this if you want to be able + * to cancel the timer with ftdm_sched_cancel_timer */ FT_DECLARE(ftdm_status_t) ftdm_sched_timer(ftdm_sched_t *sched, const char *name, - int ms, ftdm_sched_callback_t callback, void *data, ftdm_timer_t **timer); + int ms, ftdm_sched_callback_t callback, void *data, ftdm_timer_id_t *timer); /*! * \brief Cancel the timer + * Note that there is a race between cancelling and triggering a timer. + * By the time you call this function the timer may be about to be triggered. + * This is specially true with timers in free run schedule. * \param sched The scheduling context (required) * \param timer The timer to cancel (required) */ -FT_DECLARE(ftdm_status_t) ftdm_sched_cancel_timer(ftdm_sched_t *sched, ftdm_timer_t **timer); +FT_DECLARE(ftdm_status_t) ftdm_sched_cancel_timer(ftdm_sched_t *sched, ftdm_timer_id_t timer); /*! \brief Destroy the context and all of the scheduled timers in it */ FT_DECLARE(ftdm_status_t) ftdm_sched_destroy(ftdm_sched_t **sched); commit df63657e619a8863398981416ef001ae9eed392a Author: Mathieu Rene <mrene@avgs.ca> Date: Mon Sep 20 19:39:45 2010 -0400 avoid segfault when sofia tries to update the callee id at the same time as the outbound call is transferred diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 543e472..6358eb4 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -1417,13 +1417,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_ if (profile->callee_id_name) { switch_channel_set_variable(channel, "pre_transfer_caller_id_name", new_profile->caller_id_name); new_profile->caller_id_name = switch_core_strdup(new_profile->pool, profile->callee_id_name); - profile->callee_id_name = NULL; + profile->callee_id_name = SWITCH_BLANK_STRING; } if (profile->callee_id_number) { switch_channel_set_variable(channel, "pre_transfer_caller_id_number", new_profile->caller_id_number); new_profile->caller_id_number = switch_core_strdup(new_profile->pool, profile->callee_id_number); - profile->callee_id_number = NULL; + profile->callee_id_number = SWITCH_BLANK_STRING; } } commit 56c717d7f65b110ccee04610892afdf65c7e477a Merge: 5e3377c 09fa667 Author: Moises Silva <moy@sangoma.com> Date: Mon Sep 20 18:20:02 2010 -0400 Merge branch 'master' of git.freeswitch.org:freeswitch commit 5e3377c7a46fb479e1501ac884e29658e40a2ee2 Author: Moises Silva <moy@sangoma.com> Date: Mon Sep 20 18:19:33 2010 -0400 freetdm: fix win compilation diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index ba69563..8439388 100644 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -376,7 +376,7 @@ struct ftdm_iterator { unsigned int allocated:1; union { struct { - int32_t index; + uint32_t index; const ftdm_span_t *span; } chaniter; ftdm_hash_iterator_t *hashiter; commit 09fa66787ec26d523b286e4e4d7e3846effc6394 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Sep 20 16:55:09 2010 -0500 add 'sofia global siptrace on' so we don't have to always teach people to enable sip trace on each profile diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 1e8876e..c5de286 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3507,6 +3507,7 @@ SWITCH_STANDARD_API(sofia_function) "sofia status|xmlstatus gateway <name>\n" "sofia loglevel <all|default|tport|iptsec|nea|nta|nth_client|nth_server|nua|soa|sresolv|stun> [0-9]\n" "sofia tracelevel <console|alert|crit|err|warning|notice|info|debug>\n" + "sofa global siptrace [on|off]\n" "--------------------------------------------------------------------------------\n"; if (session) { @@ -3562,6 +3563,26 @@ SWITCH_STANDARD_API(sofia_function) } else if (!strcasecmp(argv[0], "help")) { stream->write_function(stream, "%s", usage_string); goto done; + } else if (!strcasecmp(argv[0], "global")) { + int on = -1; + + if (argc > 1) { + if (!strcasecmp(argv[1], "siptrace")) { + if (argc > 2) { + on = switch_true(argv[2]); + } + } + } + + if (on != -1) { + sofia_glue_global_siptrace(on); + stream->write_function(stream, "+OK Global siptrace %s", on ? "on" : "off"); + } else { + stream->write_function(stream, "-ERR Usage: siptrace on|off"); + } + + goto done; + } else if (!strcasecmp(argv[0], "recover")) { if (argv[1] && !strcasecmp(argv[1], "flush")) { sofia_glue_recover(SWITCH_TRUE); @@ -4637,6 +4658,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) switch_console_set_complete("add sofia loglevel ::[all:default:tport:iptsec:nea:nta:nth_client:nth_server:nua:soa:sresolv:stun ::[0:1:2:3:4:5:6:7:8:9"); switch_console_set_complete("add sofia tracelevel ::[console:alert:crit:err:warning:notice:info:debug"); + switch_console_set_complete("add sofia global siptrace ::[on:off"); + switch_console_set_complete("add sofia profile"); switch_console_set_complete("add sofia profile restart all"); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 5a69958..4e0c4fd 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -1012,3 +1012,4 @@ char *sofia_glue_get_multipart(switch_core_session_t *session, const char *prefi void sofia_glue_tech_simplify(private_object_t *tech_pvt); switch_console_callback_match_t *sofia_reg_find_reg_url_multi(sofia_profile_t *profile, const char *user, const char *host); switch_bool_t sofia_glue_profile_exists(const char *key); +void sofia_glue_global_siptrace(switch_bool_t on); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 4018407..0d3d9d2 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -4342,6 +4342,27 @@ void sofia_glue_restart_all_profiles(void) } + +void sofia_glue_global_siptrace(switch_bool_t on) +{ + switch_hash_index_t *hi; + const void *var; + void *val; + sofia_profile_t *pptr; + + switch_mutex_lock(mod_sofia_globals.hash_mutex); + if (mod_sofia_globals.profile_hash) { + for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) { + switch_hash_this(hi, &var, NULL, &val); + if ((pptr = (sofia_profile_t *) val)) { + nua_set_params(pptr->nua, TPTAG_LOG(on), TAG_END()); + } + } + } + switch_mutex_unlock(mod_sofia_globals.hash_mutex); + +} + void sofia_glue_del_profile(sofia_profile_t *profile) { sofia_gateway_t *gp; commit 3b04608c2e09f858ba1f0a5b0b4ffe4ea0669719 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Sep 20 15:32:48 2010 -0500 MODAPP-457 diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 2ea3eb0..9b8b051 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -789,9 +789,9 @@ static t38_mode_t negotiate_t38(pvt_t *pvt) t38_options->T38FaxRateManagement = "transferredTCF"; t38_options->T38FaxMaxBuffer = 2000; t38_options->T38FaxMaxDatagram = LOCAL_FAX_MAX_DATAGRAM; - if (strcasecmp(t38_options->T38FaxUdpEC, "t38UDPRedundancy") == 0 - || - strcasecmp(t38_options->T38FaxUdpEC, "t38UDPFEC") == 0) { + if (!zstr(t38_options->T38FaxUdpEC) && + (strcasecmp(t38_options->T38FaxUdpEC, "t38UDPRedundancy") == 0 || + strcasecmp(t38_options->T38FaxUdpEC, "t38UDPFEC") == 0)) { t38_options->T38FaxUdpEC = "t38UDPRedundancy"; } else { t38_options->T38FaxUdpEC = NULL; commit 6b77b4ec0771e034b3919d6bd29abe5c7b66e473 Merge: 95cf220 108ae5c Author: Moises Silva <moy@sangoma.com> Date: Mon Sep 20 13:07:58 2010 -0400 Merge branch 'master' of git@homer:smg_freeswitch commit 108ae5c48a0f74f0f5c2725aa95145867426a7c8 Author: Konrad Hammel <konrad@sangoma.com> Date: Mon Sep 20 16:48:36 2010 -0400 freetdm: ss7 - numerous updates diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c index 20e1f27..cf56f51 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c @@ -1506,6 +1506,10 @@ static ftdm_status_t handle_tx_cgb(ftdm_stream_handle_t *stream, int span, int c sngss7_span_data_t *sngss7_span; int byte = 0; int bit = 0; + ftdm_sigmsg_t sigev; + + memset (&sigev, 0, sizeof (sigev)); + if (range > 31) { stream->write_function(stream, "Invalid range value %d", range); @@ -1531,6 +1535,14 @@ static ftdm_status_t handle_tx_cgb(ftdm_stream_handle_t *stream, int span, int c /* throw the grp maint. block flag */ sngss7_set_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX); + /* bring the sig status down */ + sigev.chan_id = ftdmchan->chan_id; + sigev.span_id = ftdmchan->span_id; + sigev.channel = ftdmchan; + sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; + sigev.sigstatus = FTDM_SIG_STATE_DOWN; + ftdm_span_send_signal(ftdmchan->span, &sigev); + /* if this is the first channel in the range */ if (ftdmchan->physical_chan_id == chan) { /* attach the cgb information */ @@ -1575,6 +1587,10 @@ static ftdm_status_t handle_tx_cgu(ftdm_stream_handle_t *stream, int span, int c sngss7_span_data_t *sngss7_span; int byte = 0; int bit = 0; + ftdm_sigmsg_t sigev; + + memset (&sigev, 0, sizeof (sigev)); + if (range > 31) { stream->write_function(stream, "Invalid range value %d", range); @@ -1600,6 +1616,14 @@ static ftdm_status_t handle_tx_cgu(ftdm_stream_handle_t *stream, int span, int c /* throw the grp maint. block flag */ sngss7_clear_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX); + /* bring the sig status up */ + sigev.chan_id = ftdmchan->chan_id; + sigev.span_id = ftdmchan->span_id; + sigev.channel = ftdmchan; + sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; + sigev.sigstatus = FTDM_SIG_STATE_UP; + ftdm_span_send_signal(ftdmchan->span, &sigev); + /* if this is the first channel in the range */ if (ftdmchan->physical_chan_id == chan) { /* attach the cgb information */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index 263b599..5e6a246 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -93,21 +93,13 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ return FTDM_FAIL; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ + /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - if (sngss7_test_flag(sngss7_info, FLAG_GLARE)) { - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx IAM (glare detected on circuit)\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx IAM (glare)\n", sngss7_info->circuit->cic); } else { - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx IAM\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx IAM\n", sngss7_info->circuit->cic); } /* check if the circuit has a remote block */ @@ -287,21 +279,13 @@ ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circ return FTDM_FAIL; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ + /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - } - switch (evntType) { /**************************************************************************/ case (ADDRCMPLT): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx ACM\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx ACM\n", sngss7_info->circuit->cic); switch (ftdmchan->state) { /**********************************************************************/ case FTDM_CHANNEL_STATE_DIALING: @@ -322,115 +306,115 @@ ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circ } /* switch (ftdmchan->state) */ /**************************************************************************/ case (MODIFY): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx MODIFY\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx MODIFY\n", sngss7_info->circuit->cic); break; /**************************************************************************/ case (MODCMPLT): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx MODIFY-COMPLETE\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx MODIFY-COMPLETE\n", sngss7_info->circuit->cic); break; /**************************************************************************/ case (MODREJ): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx MODIFY-REJECT\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx MODIFY-REJECT\n", sngss7_info->circuit->cic); break; /**************************************************************************/ case (PROGRESS): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CPG\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CPG\n", sngss7_info->circuit->cic); break; /**************************************************************************/ case (FRWDTRSFR): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx FOT\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx FOT\n", sngss7_info->circuit->cic); break; /**************************************************************************/ case (INFORMATION): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx INF\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx INF\n", sngss7_info->circuit->cic); break; /**************************************************************************/ case (INFORMATREQ): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx INR\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx INR\n", sngss7_info->circuit->cic); break; /**************************************************************************/ case (SUBSADDR): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx SAM\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx SAM\n", sngss7_info->circuit->cic); break; /**************************************************************************/ case (EXIT): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx EXIT\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx EXIT\n", sngss7_info->circuit->cic); break; /**************************************************************************/ case (NETRESMGT): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx NRM\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx NRM\n", sngss7_info->circuit->cic); break; /**************************************************************************/ case (IDENTREQ): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx IDR\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx IDR\n", sngss7_info->circuit->cic); break; /**************************************************************************/ case (IDENTRSP): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx IRS\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx IRS\n", sngss7_info->circuit->cic); break; /**************************************************************************/ case (MALCLLPRNT): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx MALICIOUS CALL\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx MALICIOUS CALL\n", sngss7_info->circuit->cic); break; /**************************************************************************/ case (CHARGE): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CRG\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CRG\n", sngss7_info->circuit->cic); break; /**************************************************************************/ case (TRFFCHGE): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CRG-TARIFF\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CRG-TARIFF\n", sngss7_info->circuit->cic); break; /**************************************************************************/ case (CHARGEACK): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CRG-ACK\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CRG-ACK\n", sngss7_info->circuit->cic); break; /**************************************************************************/ case (CALLOFFMSG): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CALL-OFFER\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CALL-OFFER\n", sngss7_info->circuit->cic); break; /**************************************************************************/ case (LOOPPRVNT): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx LOP\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx LOP\n", sngss7_info->circuit->cic); break; /**************************************************************************/ case (TECT_TIMEOUT): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx ECT-Timeout\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx ECT-Timeout\n", sngss7_info->circuit->cic); break; /**************************************************************************/ case (RINGSEND): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx RINGING-SEND\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx RINGING-SEND\n", sngss7_info->circuit->cic); break; /**************************************************************************/ case (CALLCLEAR): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CALL-LINE Clear\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CALL-LINE Clear\n", sngss7_info->circuit->cic); break; /**************************************************************************/ case (PRERELEASE): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx PRI\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx PRI\n", sngss7_info->circuit->cic); break; /**************************************************************************/ case (APPTRANSPORT): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx APM\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx APM\n", sngss7_info->circuit->cic); break; /**************************************************************************/ case (OPERATOR): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx OPERATOR\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx OPERATOR\n", sngss7_info->circuit->cic); break; /**************************************************************************/ case (METPULSE): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx METERING-PULSE\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx METERING-PULSE\n", sngss7_info->circuit->cic); break; /**************************************************************************/ case (CLGPTCLR): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CALLING_PARTY_CLEAR\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CALLING_PARTY_CLEAR\n", sngss7_info->circuit->cic); break; /**************************************************************************/ case (SUBDIRNUM): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx SUB-DIR\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx SUB-DIR\n", sngss7_info->circuit->cic); break; /**************************************************************************/ default: - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Unknown Msg\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Unknown Msg\n", sngss7_info->circuit->cic); break; /**************************************************************************/ } @@ -457,25 +441,16 @@ ftdm_status_t handle_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circ return FTDM_FAIL; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ + /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - /* check whether the ftdm channel is in a state to accept a call */ switch (ftdmchan->state) { /**************************************************************************/ case FTDM_CHANNEL_STATE_PROGRESS: case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx ANM\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx ANM\n", sngss7_info->circuit->cic); /* go to UP */ ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); @@ -484,7 +459,7 @@ ftdm_status_t handle_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circ /**************************************************************************/ case FTDM_CHANNEL_STATE_DIALING: - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CON\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CON\n", sngss7_info->circuit->cic); /* go to UP */ ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); @@ -493,7 +468,7 @@ ftdm_status_t handle_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circ /**************************************************************************/ default: /* incorrect state...reset the CIC */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx ANM/CON\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx ANM/CON\n", sngss7_info->circuit->cic); /* throw the TX reset flag */ sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX); @@ -527,18 +502,12 @@ ftdm_status_t handle_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ return FTDM_FAIL; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ + /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx REL\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx REL cause=%d\n", + sngss7_info->circuit->cic, + siRelEvnt->causeDgn.causeVal.val); /* check whether the ftdm channel is in a state to release a call */ switch (ftdmchan->state) { @@ -616,18 +585,10 @@ ftdm_status_t handle_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circ return FTDM_FAIL; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ + /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx RLC\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx RLC\n", sngss7_info->circuit->cic); /* check whether the ftdm channel is in a state to accept a call */ switch (ftdmchan->state) { @@ -675,18 +636,10 @@ ftdm_status_t handle_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ return FTDM_FAIL; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ + /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx DATA IND\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx DATA IND\n", sngss7_info->circuit->cic); /* unlock the channel */ ftdm_mutex_unlock(ftdmchan->mutex); @@ -710,18 +663,10 @@ ftdm_status_t handle_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ return FTDM_FAIL; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ + /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx FAC\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx FAC\n", sngss7_info->circuit->cic); /* unlock the channel */ ftdm_mutex_unlock(ftdmchan->mutex); @@ -745,18 +690,10 @@ ftdm_status_t handle_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circ return FTDM_FAIL; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ + /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx FAC-CON\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx FAC-CON\n", sngss7_info->circuit->cic); /* unlock the channel */ ftdm_mutex_unlock(ftdmchan->mutex); @@ -780,18 +717,10 @@ ftdm_status_t handle_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t cir return FTDM_FAIL; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ + /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx USER-USER msg\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx USER-USER msg\n", sngss7_info->circuit->cic); /* unlock the channel */ ftdm_mutex_unlock(ftdmchan->mutex); @@ -818,217 +747,217 @@ ftdm_status_t handle_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ switch (evntType) { /**************************************************************************/ case SIT_STA_REATTEMPT: /* reattempt indication */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Reattempt indication\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Reattempt indication\n", sngss7_info->circuit->cic); handle_reattempt(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_ERRORIND: /* error indication */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Error indication\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Error indication\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_CONTCHK: /* continuity check */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx COT start\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx COT start\n", sngss7_info->circuit->cic); handle_cot_start(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_CONTREP: /* continuity report */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx COT report\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx COT report\n", sngss7_info->circuit->cic); handle_cot(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_STPCONTIN: /* stop continuity */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx COT stop\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx COT stop\n", sngss7_info->circuit->cic); handle_cot_stop(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_CGQRYRSP: /* circuit grp query response from far end forwarded to upper layer by ISUP */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CQM\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CQM\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_CONFUSION: /* confusion */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CFN\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CFN\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_LOOPBACKACK: /* loop-back acknowledge */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx LPA\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx LPA\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_CIRRSRVREQ: /* circuit reservation request */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Ckt Resveration req\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Ckt Resveration req\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_CIRRSRVACK: /* circuit reservation acknowledgement */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Ckt Res ack\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Ckt Res ack\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_CIRBLOREQ: /* circuit blocking request */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx BLO\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx BLO\n", sngss7_info->circuit->cic); handle_blo_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_CIRBLORSP: /* circuit blocking response */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx BLA\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx BLA\n", sngss7_info->circuit->cic); handle_blo_rsp(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_CIRUBLREQ: /* circuit unblocking request */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx UBL\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx UBL\n", sngss7_info->circuit->cic); handle_ubl_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_CIRUBLRSP: /* circuit unblocking response */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx UBA\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx UBA\n", sngss7_info->circuit->cic); handle_ubl_rsp(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_CIRRESREQ: /* circuit reset request - RSC */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx RSC\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx RSC\n", sngss7_info->circuit->cic); handle_rsc_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_CIRLOCRES: /* reset initiated locally by the software */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Local RSC\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Local RSC\n", sngss7_info->circuit->cic); handle_local_rsc_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_CIRRESRSP: /* circuit reset response */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx RSC-RLC\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx RSC-RLC\n", sngss7_info->circuit->cic); handle_rsc_rsp(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_CGBREQ: /* CGB request */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CGB\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CGB\n", sngss7_info->circuit->cic); handle_cgb_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_CGUREQ: /* CGU request */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CGU\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CGU\n", sngss7_info->circuit->cic); handle_cgu_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_CGQRYREQ: /* circuit group query request */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CQM\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CQM\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_CGBRSP: /* mntc. oriented CGB response */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx mntc CGB\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx mntc CGB\n", sngss7_info->circuit->cic); /*handle_cgb_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt);*/ break; /**************************************************************************/ case SIT_STA_CGURSP: /* mntc. oriented CGU response */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx mntc CGU\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx mntc CGU\n", sngss7_info->circuit->cic); /*SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType));*/ break; /**************************************************************************/ case SIT_STA_GRSREQ: /* circuit group reset request */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx GRS\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx GRS\n", sngss7_info->circuit->cic); handle_grs_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_CIRUNEQPD: /* circuit unequipped indication */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx UCIC\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx UCIC\n", sngss7_info->circuit->cic); handle_ucic(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_GRSRSP: /* circuit group reset response */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx GRA\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx GRA\n", sngss7_info->circuit->cic); handle_grs_rsp(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_PAUSEIND: /* pause indication */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx SUS\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx SUS\n", sngss7_info->circuit->cic); handle_pause(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_RESUMEIND: /* resume indication */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx RES\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx RES\n", sngss7_info->circuit->cic); handle_resume(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_USRPARTA: /* user part available */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx UPA\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx UPA\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_RMTUSRUNAV: /* remote user not available */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Remote User not Available\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Remote User not Available\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_MTPCONG0: /* congestion indication level 0 */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Congestion L0\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Congestion L0\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_MTPCONG1: /* congestion indication level 1 */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Congestion L1\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Congestion L1\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_MTPCONG2: /* congestion indication level 2 */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Congestion L2\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Congestion L2\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_MTPCONG3: /* congestion indication level 3 */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Congestion L3\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Congestion L3\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_MTPSTPCONG: /* stop congestion indication level 0 */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Stop Congestion\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Stop Congestion\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_CIRLOCALBLOIND: /* Mngmt local blocking */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Local BLO\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Local BLO\n", sngss7_info->circuit->cic); handle_local_blk(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_CIRLOCALUBLIND: /* Mngmt local unblocking */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Local UBL\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Local UBL\n", sngss7_info->circuit->cic); handle_local_ubl(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_OVERLOAD: /* Overload */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Overload\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Overload\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_LMCGBREQ: /* when LM requests ckt grp blocking */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx LM CGB\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx LM CGB\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_LMCGUREQ: /* when LM requests ckt grp unblocking */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx LM CGU\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx LM CGU\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_LMGRSREQ: /* when LM requests ckt grp reset */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx LM RSC\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx LM RSC\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_CGBINFOIND: /* circuit grp blking ind , no resp req */ - /*SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CGB no resp req\n");*/ + /*SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CGB no resp req\n", sngss7_info->circuit->cic);*/ /* handle_cgb_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt);*/ break; /**************************************************************************/ case SIT_STA_LMCQMINFOREQ: /* when LM requests ckt grp query */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx LM CQM\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx LM CQM\n", sngss7_info->circuit->cic); // SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_CIRLOCGRS: /* group reset initiated locally by the software */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Local GRS\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Local GRS\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ @@ -1057,17 +986,9 @@ ftdm_status_t handle_reattempt(uint32_t suInstId, uint32_t spInstId, uint32_t ci return FTDM_FAIL; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ + /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - if (sngss7_test_flag(sngss7_info, FLAG_GLARE)) { /* the glare flag is already up so it was caught ... do nothing */ SS7_DEBUG_CHAN(ftdmchan, "Glare flag is already up...nothing to do!%s\n", " "); @@ -1106,7 +1027,7 @@ ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t circui int infId; int i; - /* extract the affect infId from the circuit structure */ + /* extract the affected infId from the circuit structure */ infId = g_ftdm_sngss7_data.cfg.isupCkt[circuit].infId; /* go through all the circuits now and find any other circuits on this infId */ @@ -1216,17 +1137,9 @@ ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint32_t ci return FTDM_FAIL; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ + /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - /* open the channel if it is not open */ if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) { if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { @@ -1274,17 +1187,9 @@ ftdm_status_t handle_cot_stop(uint32_t suInstId, uint32_t spInstId, uint32_t cir return FTDM_FAIL; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ + /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - /* tell the core to stop looping the channel */ ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL); @@ -1335,17 +1240,9 @@ ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ return FTDM_FAIL; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ + /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - /* check if the circuit is already blocked or not */ if (sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) { SS7_WARN("Received BLO on circuit that is already blocked!\n"); @@ -1379,17 +1276,9 @@ ftdm_status_t handle_blo_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ return FTDM_FAIL; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ + /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - /* KONRAD FIX ME */ /* unlock the channel again before we exit */ @@ -1414,17 +1303,9 @@ ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ return FTDM_FAIL; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ + /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - /* check if the channel is blocked */ if (!(sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX))) { SS7_WARN("Received UBL on circuit that is not blocked!\n"); @@ -1461,17 +1342,9 @@ ftdm_status_t handle_ubl_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ return FTDM_FAIL; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ + /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - /* KONRAD FIX ME */ /* unlock the channel again before we exit */ @@ -1496,17 +1369,9 @@ ftdm_status_t handle_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ return FTDM_FAIL; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ + /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - /* throw the reset flag */ sngss7_set_flag(sngss7_info, FLAG_RESET_RX); @@ -1549,17 +1414,9 @@ ftdm_status_t handle_local_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_ return FTDM_FAIL; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ + /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - /* throw the reset flag */ sngss7_set_flag(sngss7_info, FLAG_RESET_RX); @@ -1602,17 +1459,9 @@ ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ return FTDM_FAIL; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ + /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - switch (ftdmchan->state) { /**********************************************************************/ case FTDM_CHANNEL_STATE_RESTART: @@ -1704,15 +1553,8 @@ ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ break; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ + /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_ASSERT; - }; /* fill in the span structure for this circuit */ sngss7_span = ftdmchan->span->mod_data; @@ -1780,15 +1622,8 @@ ftdm_status_t handle_grs_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ break; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ + /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_ASSERT; - }; SS7_INFO_CHAN(ftdmchan, "Rx GRA (%d:%d)\n", g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, @@ -1862,17 +1697,9 @@ ftdm_status_t handle_local_blk(uint32_t suInstId, uint32_t spInstId, uint32_t ci return FTDM_FAIL; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ + /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - /* check if the circuit is already blocked or not */ if (sngss7_test_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX)) { SS7_WARN("Received local BLO on circuit that is already blocked!\n"); @@ -1906,17 +1733,9 @@ ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint32_t ci return FTDM_FAIL; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ + /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - /* check if the circuit is already blocked or not */ if (sngss7_test_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX)) { SS7_WARN("Received local UBL on circuit that is already unblocked!\n"); @@ -1950,17 +1769,9 @@ ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit return FTDM_FAIL; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ + /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - /* throw the ckt block flag */ sngss7_set_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK); @@ -1988,7 +1799,9 @@ ftdm_status_t handle_cgb_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ int byte = 0; int bit = 0; int x; + ftdm_sigmsg_t sigev; + memset(&sigev, 0, sizeof (sigev)); memset(&status[0], '\0', sizeof(status)); /* get the ftdmchan and ss7_chan_data from the circuit */ @@ -2040,22 +1853,17 @@ ftdm_status_t handle_cgb_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ /* loop over the cics starting from circuit until range+1 */ for (x = circuit; x < (circuit + range + 1); x++) { + /* confirm this is a voice channel */ if (g_ftdm_sngss7_data.cfg.isupCkt[x].type != VOICE) continue; + /* grab the circuit in question */ if (extract_chan_data(x, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", x); break; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ + /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_ASSERT; - }; #if 0 SS7_ERROR("KONRAD -> circuit=%d, byte=%d, bit=%d, status[byte]=%d, math=%d\n", @@ -2085,6 +1893,15 @@ ftdm_status_t handle_cgb_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ } /* switch (blockType) */ } + sigev.chan_id = ftdmchan->chan_id; + sigev.span_id = ftdmchan->span_id; + sigev.channel = ftdmchan; + + /* bring the sig status down */ + sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; + sigev.sigstatus = FTDM_SIG_STATE_DOWN; + ftdm_span_send_signal(ftdmchan->span, &sigev); + /* unlock the channel again before we exit */ ftdm_mutex_unlock(ftdmchan->mutex); @@ -2123,7 +1940,9 @@ ftdm_status_t handle_cgu_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ int byte = 0; int bit = 0; int x; + ftdm_sigmsg_t sigev; + memset(&sigev, 0, sizeof (sigev)); memset(&status[0], '\0', sizeof(status)); /* get the ftdmchan and ss7_chan_data from the circuit */ @@ -2140,7 +1959,7 @@ ftdm_status_t handle_cgu_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ if ((siStaEvnt->cgsmti.eh.pres == PRSNT_NODEF) && (siStaEvnt->cgsmti.typeInd.pres == PRSNT_NODEF)) { blockType = siStaEvnt->cgsmti.typeInd.val; } else { - SS7_ERROR("Received CGB with no circuit group supervision value on CIC = %d\n", sngss7_info->circuit->cic); + SS7_ERROR("Received CGU with no circuit group supervision value on CIC = %d\n", sngss7_info->circuit->cic); SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_FAIL; } @@ -2149,7 +1968,7 @@ ftdm_status_t handle_cgu_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ if ((siStaEvnt->rangStat.eh.pres == PRSNT_NODEF) && (siStaEvnt->rangStat.range.pres == PRSNT_NODEF)) { range = siStaEvnt->rangStat.range.val; } else { - SS7_ERROR("Received CGB with no range value on CIC = %d\n", sngss7_info->circuit->cic); + SS7_ERROR("Received CGU with no range value on CIC = %d\n", sngss7_info->circuit->cic); SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_FAIL; } @@ -2160,7 +1979,7 @@ ftdm_status_t handle_cgu_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ status[x] = siStaEvnt->rangStat.status.val[x]; } } else { - SS7_ERROR("Received CGB with no status value on CIC = %d\n", sngss7_info->circuit->cic); + SS7_ERROR("Received CGU with no status value on CIC = %d\n", sngss7_info->circuit->cic); SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_FAIL; } @@ -2182,15 +2001,8 @@ ftdm_status_t handle_cgu_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ break; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ + /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_ASSERT; - }; if (status[byte] & (1 << bit)) { switch (blockType) { @@ -2210,7 +2022,16 @@ ftdm_status_t handle_cgu_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ break; /**********************************************************************/ } /* switch (blockType) */ - } /* */ + } /* if (status[byte] & (1 << bit)) */ + + sigev.chan_id = ftdmchan->chan_id; + sigev.span_id = ftdmchan->span_id; + sigev.channel = ftdmchan; + + /* bring the sig status down */ + sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; + sigev.sigstatus = FTDM_SIG_STATE_UP; + ftdm_span_send_signal(ftdmchan->span, &sigev); /* unlock the channel again before we exit */ ftdm_mutex_unlock(ftdmchan->mutex); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c index 03f0beb..3f507d6 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c @@ -496,6 +496,12 @@ void handle_sng_isup_alarm(Pst *pst, SiMngmt *sta) /* initalize the msg variable to NULLs */ memset(&msg[0], '\0', sizeof(&msg)); + /* if the event is REMOTE/LOCAL we don't need to print these */ + if ((sta->t.usta.alarm.event == LSI_EVENT_REMOTE) || + (sta->t.usta.alarm.event == LSI_EVENT_LOCAL)) { + return; + } + /* point p to the first spot in msg */ p = &msg[0]; @@ -728,6 +734,8 @@ void handle_sng_isup_alarm(Pst *pst, SiMngmt *sta) DECODE_LSI_EVENT(sta->t.usta.alarm.event), DECODE_LSI_CAUSE(sta->t.usta.alarm.cause)); + return; + } /* handle_isup_alarm */ /******************************************************************************/ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index a4fee0f..19f042b 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -454,9 +454,9 @@ static void ftdm_sangoma_ss7_process_stack_event (sngss7_event_data_t *sngss7_ev /******************************************************************************/ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) { - ftdm_sigmsg_t sigev; sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; int i = 0; + ftdm_sigmsg_t sigev; memset (&sigev, 0, sizeof (sigev)); @@ -788,14 +788,24 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) !(sngss7_test_flag (sngss7_info, FLAG_GRP_RESET_TX)) && !(sngss7_test_flag (sngss7_info, FLAG_GRP_RESET_RX))) { - /* check if the sig status is down, and bring it up if it isn't */ - if (!ftdm_test_flag (ftdmchan, FTDM_CHANNEL_SIG_UP)) { - SS7_DEBUG_CHAN(ftdmchan,"All reset flags cleared %s\n", ""); - /* all flags are down so we can bring up the sig status */ - sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.sigstatus = FTDM_SIG_STATE_UP; - ftdm_span_send_signal (ftdmchan->span, &sigev); - } + /* now check if there is an active block */ + if (!(sngss7_test_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX)) && + !(sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) && + !(sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) && + !(sngss7_test_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX)) && + !(sngss7_test_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX)) && + !(sngss7_test_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX)) && + !(sngss7_test_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX))) { + + /* check if the sig status is down, and bring it up if it isn't */ + if (!ftdm_test_flag (ftdmchan, FTDM_CHANNEL_SIG_UP)) { + SS7_DEBUG_CHAN(ftdmchan,"All reset flags cleared %s\n", ""); + /* all flags are down so we can bring up the sig status */ + sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; + sigev.sigstatus = FTDM_SIG_STATE_UP; + ftdm_span_send_signal (ftdmchan->span, &sigev); + } /* if (!ftdm_test_flag (ftdmchan, FTDM_CHANNEL_SIG_UP)) */ + } /* if !blocked */ } else { SS7_DEBUG_CHAN(ftdmchan,"Reset flags present (0x%X)\n", sngss7_info->flags); @@ -993,6 +1003,11 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) if (sngss7_test_flag (sngss7_info, FLAG_CKT_MN_BLOCK_RX)) { SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_BLOCK_RX flag %s\n", ""); + /* bring the sig status down */ + sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; + sigev.sigstatus = FTDM_SIG_STATE_DOWN; + ftdm_span_send_signal(ftdmchan->span, &sigev); + /* send a BLA */ ft_to_sngss7_bla (ftdmchan); @@ -1006,6 +1021,11 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /* clear the unblock flag */ sngss7_clear_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX); + /* bring the sig status up */ + sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; + sigev.sigstatus = FTDM_SIG_STATE_UP; + ftdm_span_send_signal(ftdmchan->span, &sigev); + /* send a uba */ ft_to_sngss7_uba (ftdmchan); @@ -1017,6 +1037,11 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) if (sngss7_test_flag (sngss7_info, FLAG_CKT_MN_BLOCK_TX)) { SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_BLOCK_TX flag %s\n", ""); + /* bring the sig status down */ + sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; + sigev.sigstatus = FTDM_SIG_STATE_DOWN; + ftdm_span_send_signal(ftdmchan->span, &sigev); + /* send a blo */ ft_to_sngss7_blo (ftdmchan); @@ -1030,6 +1055,11 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /* clear the unblock flag */ sngss7_clear_flag (sngss7_info, FLAG_CKT_MN_UNBLK_TX); + /* bring the sig status up */ + sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; + sigev.sigstatus = FTDM_SIG_STATE_UP; + ftdm_span_send_signal(ftdmchan->span, &sigev); + /* send a ubl */ ft_to_sngss7_ubl (ftdmchan); @@ -1403,6 +1433,9 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_ss7_span_config) static FIO_SIG_LOAD_FUNCTION(ftdm_sangoma_ss7_init) { /*this function is called by the FT-core to load the signaling module */ + uint32_t major = 0; + uint32_t minor = 0; + uint32_t build = 0; ftdm_log (FTDM_LOG_INFO, "Loading ftmod_sangoma_ss7...\n"); @@ -1452,6 +1485,10 @@ static FIO_SIG_LOAD_FUNCTION(ftdm_sangoma_ss7_init) /* initalize sng_ss7 library */ sng_isup_init (&sng_event); + /* print the version of the library being used */ + sng_isup_version(&major, &minor, &build); + SS7_INFO("Loaded LibSng-SS7 %d.%d.%d\n", major, minor, build); + /* crash on assert fail */ ftdm_global_set_crash_policy (FTDM_CRASH_ON_ASSERT); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index 34abd26..8b3f9d8 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -199,7 +199,8 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) &iam, 0); - SS7_INFO_CHAN(ftdmchan,"Tx IAM clg = \"%s\", cld = \"%s\"\n", + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx IAM clg = \"%s\", cld = \"%s\"\n", + sngss7_info->circuit->cic, ftdmchan->caller_data.cid_num.digits, ftdmchan->caller_data.dnis.digits); @@ -250,7 +251,7 @@ void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan) &acm, ADDRCMPLT); - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx ACM\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx ACM\n", sngss7_info->circuit->cic); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; @@ -274,7 +275,7 @@ void ft_to_sngss7_anm (ftdm_channel_t * ftdmchan) &anm, 5); - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx ANM\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx ANM\n", sngss7_info->circuit->cic); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; @@ -307,7 +308,9 @@ void ft_to_sngss7_rel (ftdm_channel_t * ftdmchan) sngss7_info->circuit->id, &rel); - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx REL\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx REL cause=%d \n", + sngss7_info->circuit->cic, + ftdmchan->caller_data.hangup_cause ); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; @@ -330,7 +333,7 @@ void ft_to_sngss7_rlc (ftdm_channel_t * ftdmchan) sngss7_info->circuit->id, &rlc); - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx RLC\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx RLC\n", sngss7_info->circuit->cic); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; @@ -351,7 +354,7 @@ void ft_to_sngss7_rsc (ftdm_channel_t * ftdmchan) SIT_STA_CIRRESREQ, NULL); - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx RSC\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx RSC\n", sngss7_info->circuit->cic); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; @@ -372,7 +375,7 @@ void ft_to_sngss7_rsca (ftdm_channel_t * ftdmchan) SIT_STA_CIRRESRSP, NULL); - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx RSC-RLC\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx RSC-RLC\n", sngss7_info->circuit->cic); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; @@ -393,7 +396,7 @@ void ft_to_sngss7_blo (ftdm_channel_t * ftdmchan) SIT_STA_CIRBLOREQ, NULL); - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx BLO\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx BLO\n", sngss7_info->circuit->cic); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; @@ -414,7 +417,7 @@ void ft_to_sngss7_bla (ftdm_channel_t * ftdmchan) SIT_STA_CIRBLORSP, NULL); - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx BLA\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx BLA\n", sngss7_info->circuit->cic); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; @@ -436,7 +439,7 @@ ft_to_sngss7_ubl (ftdm_channel_t * ftdmchan) SIT_STA_CIRUBLREQ, NULL); - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx UBL\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx UBL\n", sngss7_info->circuit->cic); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; @@ -457,7 +460,7 @@ void ft_to_sngss7_uba (ftdm_channel_t * ftdmchan) SIT_STA_CIRUBLRSP, NULL); - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx UBA\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx UBA\n", sngss7_info->circuit->cic); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; @@ -478,7 +481,7 @@ void ft_to_sngss7_lpa (ftdm_channel_t * ftdmchan) SIT_STA_LOOPBACKACK, NULL); - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx LPA\n"); + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx LPA\n", sngss7_info->circuit->cic); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; @@ -519,7 +522,8 @@ void ft_to_sngss7_gra (ftdm_channel_t * ftdmchan) SIT_STA_GRSRSP, &gra); - SS7_INFO_CHAN(ftdmchan, "Tx GRA (%d:%d)\n", + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx GRA (%d:%d)\n", + sngss7_info->circuit->cic, sngss7_info->circuit->cic, (sngss7_info->circuit->cic + sngss7_span->rx_grs.range)); @@ -551,7 +555,8 @@ void ft_to_sngss7_grs (ftdm_channel_t * ftdmchan) SIT_STA_GRSREQ, &grs); - SS7_INFO_CHAN(ftdmchan, "Tx GRS (%d:%d)\n", + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx GRS (%d:%d)\n", + sngss7_info->circuit->cic, sngss7_info->circuit->cic, (sngss7_info->circuit->cic + sngss7_span->tx_grs.range)); @@ -596,7 +601,8 @@ void ft_to_sngss7_cgba(ftdm_channel_t * ftdmchan) SIT_STA_CGBRSP, &cgba); - SS7_INFO_CHAN(ftdmchan, "Tx CGBA (%d:%d)\n", + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx CGBA (%d:%d)\n", + sngss7_info->circuit->cic, sngss7_info->circuit->cic, (sngss7_info->circuit->cic + sngss7_span->rx_cgb.range)); @@ -644,7 +650,8 @@ void ft_to_sngss7_cgua(ftdm_channel_t * ftdmchan) SIT_STA_CGURSP, &cgua); - SS7_INFO_CHAN(ftdmchan, "Tx CGUA (%d:%d)\n", + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx CGUA (%d:%d)\n", + sngss7_info->circuit->cic, sngss7_info->circuit->cic, (sngss7_info->circuit->cic + sngss7_span->rx_cgu.range)); @@ -693,7 +700,8 @@ void ft_to_sngss7_cgb(ftdm_channel_t * ftdmchan) SIT_STA_CGBREQ, &cgb); - SS7_INFO_CHAN(ftdmchan, "Tx CGB (%d:%d)\n", + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx CGB (%d:%d)\n", + sngss7_info->circuit->cic, sngss7_info->circuit->cic, (sngss7_info->circuit->cic + sngss7_span->tx_cgb.range)); @@ -742,7 +750,8 @@ void ft_to_sngss7_cgu(ftdm_channel_t * ftdmchan) SIT_STA_CGUREQ, &cgu); - SS7_INFO_CHAN(ftdmchan, "Tx CGU (%d:%d)\n", + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx CGU (%d:%d)\n", + sngss7_info->circuit->cic, sngss7_info->circuit->cic, (sngss7_info->circuit->cic + sngss7_span->tx_cgu.range)); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 694e9a4..aaffeb0 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -464,7 +464,7 @@ ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan) /* extract the channel in question */ if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", i); - SS7_ASSERT; + continue; } /* lock the channel */ @@ -476,61 +476,61 @@ ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan) if (!sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_RX_DN)) { /* this channel is still resetting...do nothing */ goto GRS_UNLOCK_ALL; - } /* if (!sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_RX_DN)) */ - } else { - /* state change pending */ - goto GRS_UNLOCK_ALL; - } - } /* for ( i = circuit; i < (circuit + range + 1); i++) */ + } /* if (!sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_RX_DN)) */ + } else { + /* state change pending */ + goto GRS_UNLOCK_ALL; + } + } /* for ( i = circuit; i < (circuit + range + 1); i++) */ - SS7_DEBUG("All circuits out of reset for GRS: circuit=%d, range=%d\n", - sngss7_span->rx_grs.circuit, - sngss7_span->rx_grs.range); + SS7_DEBUG("All circuits out of reset for GRS: circuit=%d, range=%d\n", + sngss7_span->rx_grs.circuit, + sngss7_span->rx_grs.range); - /* check all the circuits in the range to see if they are done resetting */ - for ( i = sngss7_span->rx_grs.circuit; i < (sngss7_span->rx_grs.circuit + sngss7_span->rx_grs.range + 1); i++) { + /* check all the circuits in the range to see if they are done resetting */ + for ( i = sngss7_span->rx_grs.circuit; i < (sngss7_span->rx_grs.circuit + sngss7_span->rx_grs.range + 1); i++) { - /* extract the channel in question */ - if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n",i); - SS7_ASSERT; - } + /* extract the channel in question */ + if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n",i); + SS7_ASSERT; + } - /* throw the GRP reset flag complete flag */ - sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_RX_CMPLT); + /* throw the GRP reset flag complete flag */ + sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_RX_CMPLT); - /* move the channel to the down state */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + /* move the channel to the down state */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - /* update the status map if the ckt is in blocked state */ - if ((sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) || - (sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) || - (sngss7_test_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX)) || - (sngss7_test_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX))) { - - sngss7_span->rx_grs.status[byte] = (sngss7_span->rx_grs.status[byte] | (1 << bit)); - } /* if blocked */ - - /* update the bit and byte counter*/ - bit ++; - if (bit == 8) { - byte++; - bit = 0; - } - } /* for ( i = circuit; i < (circuit + range + 1); i++) */ + /* update the status map if the ckt is in blocked state */ + if ((sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) || + (sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) || + (sngss7_test_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX)) || + (sngss7_test_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX))) { + + sngss7_span->rx_grs.status[byte] = (sngss7_span->rx_grs.status[byte] | (1 << bit)); + } /* if blocked */ + + /* update the bit and byte counter*/ + bit ++; + if (bit == 8) { + byte++; + bit = 0; + } + } /* for ( i = circuit; i < (circuit + range + 1); i++) */ GRS_UNLOCK_ALL: - for ( i = sngss7_span->rx_grs.circuit; i < (sngss7_span->rx_grs.circuit + sngss7_span->rx_grs.range + 1); i++) { - /* extract the channel in question */ - if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", i); - SS7_ASSERT; - } - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); + for ( i = sngss7_span->rx_grs.circuit; i < (sngss7_span->rx_grs.circuit + sngss7_span->rx_grs.range + 1); i++) { + /* extract the channel in question */ + if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", i); + continue; } + /* unlock the channel */ + ftdm_mutex_unlock(ftdmchan->mutex); + } + return FTDM_SUCCESS; } commit 184f395553c12ace7c613e9b302879cd12ee063e Author: Jeff Lenk <jeff@jefflenk.com> Date: Mon Sep 20 09:25:14 2010 -0500 fix several code analysis problems and mask several that are required diff --git a/libs/esl/src/esl.c b/libs/esl/src/esl.c index 160fe2d..75a52d6 100644 --- a/libs/esl/src/esl.c +++ b/libs/esl/src/esl.c @@ -36,7 +36,10 @@ #define closesocket(x) close(x) #include <fcntl.h> #else +#pragma warning (disable:6386) +/* These warnings need to be ignored warning in sdk header */ #include <Ws2tcpip.h> +#pragma warning (default:6386) #endif diff --git a/libs/esl/src/esl_config.c b/libs/esl/src/esl_config.c index 4616356..2e24007 100644 --- a/libs/esl/src/esl_config.c +++ b/libs/esl/src/esl_config.c @@ -110,7 +110,7 @@ ESL_DECLARE(int) esl_config_next_pair(esl_config_t *cfg, char **var, char **val) *var = *val = NULL; - if (!cfg->path) { + if (!cfg || !cfg->file) { return 0; } diff --git a/libs/esl/src/esl_event.c b/libs/esl/src/esl_event.c index 2e1d8a3..db7c581 100644 --- a/libs/esl/src/esl_event.c +++ b/libs/esl/src/esl_event.c @@ -513,6 +513,9 @@ ESL_DECLARE(esl_status_t) esl_event_serialize(esl_event_t *event, char **str, es char *encode_buf = NULL; /* used for url encoding of variables to make sure unsafe things stay out of the serialized copy */ int clen = 0; + if (!event || !event->headers) + return ESL_FAIL; + *str = NULL; dlen = blocksize * 2; diff --git a/libs/libteletone/src/libteletone_generate.c b/libs/libteletone/src/libteletone_generate.c index 8098e36..3977ca5 100644 --- a/libs/libteletone/src/libteletone_generate.c +++ b/libs/libteletone/src/libteletone_generate.c @@ -413,6 +413,9 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm *e++ = '\0'; } do { + if (!p) { + break; + } if ((next = strchr(p, ',')) != 0) { *next++ = '\0'; } diff --git a/src/include/switch.h b/src/include/switch.h index 7143c61..81684c5 100644 --- a/src/include/switch.h +++ b/src/include/switch.h @@ -91,7 +91,10 @@ #include <Ws2tcpip.h> #pragma warning(pop) #else +/* work around for warnings in vs 2010 */ +#pragma warning (disable:6386) #include <Ws2tcpip.h> +#pragma warning (default:6386) #endif #else #include <strings.h> diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 4dc7ed7..45703ab 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -139,6 +139,9 @@ static inline char *switch_strchr_strict(const char *in, char find, const char * #define switch_is_valid_rate(_tmp) (_tmp == 8000 || _tmp == 12000 || _tmp == 16000 || _tmp == 24000 || _tmp == 32000 || _tmp == 11025 || _tmp == 22050 || _tmp == 44100 || _tmp == 48000) +#ifdef _MSC_VER +#pragma warning(disable:6011) +#endif static inline int switch_string_has_escaped_data(const char *in) { const char *i = strchr(in, '\\'); @@ -153,6 +156,9 @@ static inline int switch_string_has_escaped_data(const char *in) return 0; } +#ifdef _MSC_VER +#pragma warning(default:6011) +#endif SWITCH_DECLARE(switch_status_t) switch_b64_encode(unsigned char *in, switch_size_t ilen, unsigned char *out, switch_size_t olen); SWITCH_DECLARE(switch_size_t) switch_b64_decode(char *in, char *out, switch_size_t olen); @@ -455,6 +461,9 @@ static inline char *switch_safe_strdup(const char *it) } +#ifdef _MSC_VER +#pragma warning(disable:6011) +#endif static inline char *switch_lc_strdup(const char *it) { char *dup; @@ -487,6 +496,9 @@ static inline char *switch_uc_strdup(const char *it) return NULL; } +#ifdef _MSC_VER +#pragma warning(default:6011) +#endif /*! diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c index 096d967..aa7d05c 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_dsp.c @@ -549,8 +549,8 @@ static switch_status_t do_config(void) if (id == -1) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unable to add tone_descriptor: %s, tone: %s. (too many tones)\n", name, tone_name); return SWITCH_STATUS_FALSE; - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Adding tone_descriptor: %s, tone: %s(%d)\n", name, tone_name, id);} + } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Adding tone_descriptor: %s, tone: %s(%d)\n", name, tone_name, id); /* add elements to tone */ for (element = switch_xml_child(tone, "element"); element; element = switch_xml_next(element)) { const char *freq1_attr = switch_xml_attr(element, "freq1"); diff --git a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c index 139fe21..4b36e14 100644 --- a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c +++ b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c @@ -2724,7 +2724,7 @@ static switch_status_t recog_asr_open(switch_asr_handle_t *ah, const char *codec name++; name = switch_core_sprintf(ah->memory_pool, "%s ASR-%d", name, speech_channel_number); } else { - name = switch_core_sprintf(ah->memory_pool, "ASR-%d", name, speech_channel_number); + name = switch_core_sprintf(ah->memory_pool, "ASR-%d", speech_channel_number); } /* Allocate the channel */ diff --git a/src/switch_console.c b/src/switch_console.c index 06a7e0d..9f13823 100644 --- a/src/switch_console.c +++ b/src/switch_console.c @@ -493,7 +493,7 @@ static int comp_callback(void *pArg, int argc, char **argv, char **columnNames) argc = switch_separate_string(list, ':', argv, (sizeof(argv) / sizeof(argv[0]))); - for (i = 0; i < argc; i++) { + for (i = 0; (int)i < argc; i++) { if (!cur || !strncmp(argv[i], cur, strlen(cur))) { r_argv[0] = argv[i]; comp_callback(h, 1, r_argv, r_cols); commit 95cf2209fe50c127e88d0021ac93b36c73a407c5 Author: Moises Silva <moy@sangoma.com> Date: Mon Sep 20 10:18:23 2010 -0400 freetdm: make conf nodes to be stored in FIFO order diff --git a/libs/freetdm/src/ftdm_config.c b/libs/freetdm/src/ftdm_config.c index 4ba2e19..f6d9c1a 100644 --- a/libs/freetdm/src/ftdm_config.c +++ b/libs/freetdm/src/ftdm_config.c @@ -268,13 +268,24 @@ FT_DECLARE(ftdm_status_t) ftdm_conf_node_create(const char *name, ftdm_conf_node if (parent) { /* store who my parent is */ newnode->parent = parent; - /* save any siblings */ - sibling = parent->child; - /* as a newborn I am first */ - parent->child = newnode; - if (sibling) { - /* store a pointer to my next sibling */ - newnode->next = sibling; + + /* arrange them in FIFO order (newnode should be last) */ + if (!parent->child) { + /* we're the first node being added */ + parent->child = newnode; + } else { + if (!parent->last) { + /* we're the second node being added */ + parent->last = newnode; + parent->child->next = newnode; + newnode->prev = parent->child; + } else { + /* we're the third or Nth node to be added */ + sibling = parent->last; + sibling->next = newnode; + parent->last = newnode; + newnode->prev = sibling; + } } } diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index ba69563..d0d19e5 100644 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -322,9 +322,15 @@ struct ftdm_conf_node { /* first node child */ struct ftdm_conf_node *child; + /* last node child */ + struct ftdm_conf_node *last; + /* next node sibling */ struct ftdm_conf_node *next; + /* prev node sibling */ + struct ftdm_conf_node *prev; + /* my parent if any */ struct ftdm_conf_node *parent; }; commit 0748711434e937aa903536bcec46d9d997f92af1 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Sep 20 08:39:38 2010 -0500 MODAPP-453 diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index aa49689..940ac61 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -439,7 +439,7 @@ static switch_status_t moh_on_dtmf(switch_core_session_t *session, void *input, #define check_string(s) if (!zstr(s) && !strcasecmp(s, "undef")) { s = NULL; } -static int node_consumer_wait_count(fifo_node_t *node) +static int node_caller_count(fifo_node_t *node) { int i, len = 0; @@ -458,7 +458,7 @@ static void node_remove_uuid(fifo_node_t *node, const char *uuid) fifo_queue_popfly(node->fifo_list[i], uuid); } - if (!node_consumer_wait_count(node)) { + if (!node_caller_count(node)) { node->start_waiting = 0; } @@ -1683,7 +1683,7 @@ static void find_consumers(fifo_node_t *node) switch(node->outbound_strategy) { case NODE_STRATEGY_ENTERPRISE: { - int need = node_consumer_wait_count(node); + int need = node_caller_count(node); if (node->outbound_per_cycle && node->outbound_per_cycle < need) { need = node->outbound_per_cycle; @@ -1753,7 +1753,7 @@ static void *SWITCH_THREAD_FUNC node_thread_run(switch_thread_t *thread, void *o if ((node = (fifo_node_t *) val)) { if (node->outbound_priority == 0) node->outbound_priority = 5; if (node->has_outbound && node->ready && !node->busy && node->outbound_priority == cur_priority) { - ppl_waiting = node_consumer_wait_count(node); + ppl_waiting = node_caller_count(node); consumer_total = node->consumer_count; idle_consumers = node_idle_consumers(node); @@ -1831,7 +1831,7 @@ static void check_cancel(fifo_node_t *node) return; } - ppl_waiting = node_consumer_wait_count(node); + ppl_waiting = node_caller_count(node); if (node->ring_consumer_count > 0 && ppl_waiting < 1) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Outbound call count (%d) exceeds required value for queue %s (%d), " @@ -1855,7 +1855,7 @@ static void send_presence(fifo_node_t *node) switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", "park"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", node->name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", node->name); - if ((wait_count = node_consumer_wait_count(node)) > 0) { + if ((wait_count = node_caller_count(node)) > 0) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "status", "Active (%d waiting)", wait_count); } else { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", "Idle"); @@ -2296,7 +2296,6 @@ SWITCH_STANDARD_APP(fifo_function) switch_channel_answer(channel); switch_thread_rwlock_wrlock(node->rwlock); - node->caller_count++; if ((pri = switch_channel_get_variable(channel, "fifo_priority"))) { p = atoi(pri); @@ -2306,7 +2305,7 @@ SWITCH_STANDARD_APP(fifo_function) p = MAX_PRI - 1; } - if (!node_consumer_wait_count(node)) { + if (!node_caller_count(node)) { node->start_waiting = switch_micro_time_now(); } @@ -2442,7 +2441,6 @@ SWITCH_STANDARD_APP(fifo_function) switch_mutex_lock(globals.mutex); switch_thread_rwlock_wrlock(node->rwlock); node_remove_uuid(node, uuid); - node->caller_count--; switch_thread_rwlock_unlock(node->rwlock); send_presence(node); check_cancel(node); @@ -2583,7 +2581,7 @@ SWITCH_STANDARD_APP(fifo_function) continue; } - if ((waiting = node_consumer_wait_count(node))) { + if ((waiting = node_caller_count(node))) { if (!importance || node->importance > importance) { if (strat == STRAT_WAITING_LONGER) { @@ -2671,7 +2669,7 @@ SWITCH_STANDARD_APP(fifo_function) } } - if (pop && !node_consumer_wait_count(node)) { + if (pop && !node_caller_count(node)) { switch_thread_rwlock_wrlock(node->rwlock); node->start_waiting = 0; switch_thread_rwlock_unlock(node->rwlock); @@ -2787,9 +2785,6 @@ SWITCH_STANDARD_APP(fifo_function) const char *arg = switch_channel_get_variable(other_channel, "current_application_data"); switch_caller_extension_t *extension = NULL; - switch_thread_rwlock_wrlock(node->rwlock); - node->caller_count--; - switch_thread_rwlock_unlock(node->rwlock); send_presence(node); check_cancel(node); @@ -2955,8 +2950,6 @@ SWITCH_STANDARD_APP(fifo_function) switch_channel_set_variable(other_channel, "fifo_status", "DONE"); switch_channel_set_variable(other_channel, "fifo_timestamp", date); - switch_thread_rwlock_wrlock(node->rwlock); - node->caller_count--; switch_thread_rwlock_unlock(node->rwlock); send_presence(node); check_cancel(node); @@ -3070,7 +3063,7 @@ SWITCH_STANDARD_APP(fifo_function) done: switch_mutex_lock(globals.mutex); - if (node && node->ready == FIFO_DELAY_DESTROY && node->consumer_count == 0 && node->caller_count == 0) { + if (node && node->ready == FIFO_DELAY_DESTROY && node->consumer_count == 0 && node_caller_count(node) == 0) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "%s removed.\n", node->name); switch_core_hash_delete(globals.fifo_hash, node->name); switch_thread_rwlock_wrlock(node->rwlock); @@ -3505,9 +3498,9 @@ static void list_node(fifo_node_t *node, switch_xml_t x_report, int *off, int ve switch_xml_set_attr_d(x_fifo, "name", node->name); switch_snprintf(tmp, sizeof(buffer), "%d", node->consumer_count); switch_xml_set_attr_d(x_fifo, "consumer_count", tmp); - switch_snprintf(tmp, sizeof(buffer), "%d", node->caller_count); + switch_snprintf(tmp, sizeof(buffer), "%d", node_caller_count(node)); switch_xml_set_attr_d(x_fifo, "caller_count", tmp); - switch_snprintf(tmp, sizeof(buffer), "%d", node_consumer_wait_count(node)); + switch_snprintf(tmp, sizeof(buffer), "%d", node_caller_count(node)); switch_xml_set_attr_d(x_fifo, "waiting_count", tmp); switch_snprintf(tmp, sizeof(buffer), "%u", node->importance); switch_xml_set_attr_d(x_fifo, "importance", tmp); @@ -3569,7 +3562,7 @@ void node_dump(switch_stream_handle_t *stream) node->outbound_priority, node->busy, node->ready, - node_consumer_wait_count(node) + node_caller_count(node) ); } @@ -3687,9 +3680,9 @@ SWITCH_STANDARD_API(fifo_api_function) for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) { switch_hash_this(hi, &var, NULL, &val); node = (fifo_node_t *) val; - len = node_consumer_wait_count(node); + len = node_caller_count(node); switch_thread_rwlock_wrlock(node->rwlock); - stream->write_function(stream, "%s:%d:%d:%d\n", (char *) var, node->consumer_count, node->caller_count, len); + stream->write_function(stream, "%s:%d:%d:%d\n", (char *) var, node->consumer_count, node_caller_count(node), len); switch_thread_rwlock_unlock(node->rwlock); x++; } @@ -3698,9 +3691,9 @@ SWITCH_STANDARD_API(fifo_api_function) stream->write_function(stream, "none\n"); } } else if ((node = switch_core_hash_find(globals.fifo_hash, argv[1]))) { - len = node_consumer_wait_count(node); + len = node_caller_count(node); switch_thread_rwlock_wrlock(node->rwlock); - stream->write_function(stream, "%s:%d:%d:%d\n", argv[1], node->consumer_count, node->caller_count, len); + stream->write_function(stream, "%s:%d:%d:%d\n", argv[1], node->consumer_count, node_caller_count(node), len); switch_thread_rwlock_unlock(node->rwlock); } else { stream->write_function(stream, "none\n"); @@ -3710,7 +3703,7 @@ SWITCH_STANDARD_API(fifo_api_function) for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) { switch_hash_this(hi, &var, NULL, &val); node = (fifo_node_t *) val; - len = node_consumer_wait_count(node); + len = node_caller_count(node); switch_thread_rwlock_wrlock(node->rwlock); stream->write_function(stream, "%s:%d\n", (char *) var, node->has_outbound); switch_thread_rwlock_unlock(node->rwlock); @@ -3721,7 +3714,7 @@ SWITCH_STANDARD_API(fifo_api_function) stream->write_function(stream, "none\n"); } } else if ((node = switch_core_hash_find(globals.fifo_hash, argv[1]))) { - len = node_consumer_wait_count(node); + len = node_caller_count(node); switch_thread_rwlock_wrlock(node->rwlock); stream->write_function(stream, "%s:%d\n", argv[1], node->has_outbound); switch_thread_rwlock_unlock(node->rwlock); @@ -4072,7 +4065,7 @@ static switch_status_t load_config(int reload, int del_all) continue; } - if (node_consumer_wait_count(node) || node->consumer_count || node_idle_consumers(node)) { + if (node_caller_count(node) || node->consumer_count || node_idle_consumers(node)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s removal delayed, still in use.\n", node->name); node->ready = FIFO_DELAY_DESTROY; } else { commit b834a0e5d06ddd8f88bd5d33f6f957a4614a059d Author: Brian West <brian@freeswitch.org> Date: Sun Sep 19 16:59:58 2010 -0500 small typo in an EXAMPLE nothing critical diff --git a/conf/dialplan/default.xml b/conf/dialplan/default.xml index b143280..8bdcfa0 100644 --- a/conf/dialplan/default.xml +++ b/conf/dialplan/default.xml @@ -240,7 +240,7 @@ <!-- dial the extension (1000-1019) for 30 seconds and go to voicemail if the call fails (continue_on_fail=true), otherwise hang up after a successful - bridge (hangup_after-bridge=true) + bridge (hangup_after_bridge=true) --> <extension name="Local_Extension"> <condition field="destination_number" expression="^(10[01][0-9])$"> commit 7d84351de9cba0f95f76396f08104441cc22739b Merge: d5239be 1c76ca4 Author: Moises Silva <moy@sangoma.com> Date: Sat Sep 18 22:35:17 2010 -0400 Merge remote branch 'smgorig/master' commit d5239be7515143866ee5573f4ad378caf33ef2ca Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Sep 17 18:10:26 2010 -0500 fix package build diff --git a/debian/changelog b/debian/changelog index 2aa9e75..d49637c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +freeswitch (1.0.6-1ubuntu1) maverick; urgency=low + + * upgrade: Added mod_callcenter and pulled out Python into its own + package. + + -- Gabriel Gunderson <gabe@gundy.org> Thu, 16 Nov 2010 18:28:30 -0800 + freeswitch (1.0.4-1ubuntu2) karmic; urgency=low * upgrade: Add more verbosity when building to make it easier to find build diff --git a/debian/control b/debian/control index 8e52e3d..145f28d 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: freeswitch Section: comm Priority: extra Maintainer: Michal Bielicki <michal.bielicki@voiceworks.pl> -Build-Depends: debhelper (>= 5), fakeroot, wget, automake (>=1.9), autoconf, libtool, unixodbc-dev, libasound2-dev, libcurl3-openssl-dev|libcurl4-openssl-dev, libssl-dev, ncurses-dev, libogg-dev, libvorbis-dev, libperl-dev, libgdbm-dev, libdb-dev, libgnutls-dev, libtiff4-dev, python, libx11-dev, uuid-dev +Build-Depends: debhelper (>= 5), fakeroot, wget, automake (>=1.9), autoconf, libtool, unixodbc-dev, libasound2-dev, libcurl3-openssl-dev|libcurl4-openssl-dev, libssl-dev, ncurses-dev, libogg-dev, libvorbis-dev, libperl-dev, libgdbm-dev, libdb-dev, libgnutls-dev, libtiff4-dev, python-dev, libx11-dev, uuid-dev Homepage: http://freeswitch.org/ Standards-Version: 3.8.4 Vcs-Svn: http://svn.freeswitch.org/svn/freeswitch/trunk/ @@ -86,6 +86,18 @@ Description: Lua engine for FreeSWITCH . This package contains the mod_lua language module. +Package: freeswitch-python +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch +Description: Python engine for FreeSWITCH + FreeSWITCH is an open source telephony platform designed to facilitate the + creation of voice and chat driven products scaling from a soft-phone up to a + soft-switch. It can be used as a simple switching engine, a PBX, a media + gateway or a media server to host IVR applications using simple scripts or XML + to control the callflow. + . + This package contains the mod_python language module. + Package: freeswitch-codec-passthru-g7231 Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch diff --git a/debian/freeswitch.conffiles b/debian/freeswitch.conffiles index 342ec5f..a6f9ce3 100644 --- a/debian/freeswitch.conffiles +++ b/debian/freeswitch.conffiles @@ -1,5 +1,6 @@ /opt/freeswitch/conf/autoload_configs/acl.conf.xml /opt/freeswitch/conf/autoload_configs/alsa.conf.xml +/opt/freeswitch/conf/autoload_configs/callcenter.conf.xml /opt/freeswitch/conf/autoload_configs/cdr_csv.conf.xml /opt/freeswitch/conf/autoload_configs/cidlookup.conf.xml /opt/freeswitch/conf/autoload_configs/conference.conf.xml @@ -26,7 +27,6 @@ /opt/freeswitch/conf/autoload_configs/pocketsphinx.conf.xml /opt/freeswitch/conf/autoload_configs/portaudio.conf.xml /opt/freeswitch/conf/autoload_configs/post_load_modules.conf.xml -/opt/freeswitch/conf/autoload_configs/python.conf.xml /opt/freeswitch/conf/autoload_configs/rss.conf.xml /opt/freeswitch/conf/autoload_configs/shout.conf.xml /opt/freeswitch/conf/autoload_configs/skinny.conf.xml @@ -43,7 +43,6 @@ /opt/freeswitch/conf/autoload_configs/zeroconf.conf.xml /opt/freeswitch/conf/dialplan/default/00_pizza_demo.xml /opt/freeswitch/conf/dialplan/default/01_example.com.xml -/opt/freeswitch/conf/dialplan/default/99999_enum.xml /opt/freeswitch/conf/dialplan/default.xml /opt/freeswitch/conf/dialplan/features.xml /opt/freeswitch/conf/dialplan/public/00_inbound_did.xml diff --git a/debian/freeswitch.install b/debian/freeswitch.install index 0bf0c15..087d167 100644 --- a/debian/freeswitch.install +++ b/debian/freeswitch.install @@ -6,6 +6,7 @@ opt/freeswitch/bin/gentls_cert opt/freeswitch/bin/scripts/* opt/freeswitch/conf/autoload_configs/acl.conf.xml opt/freeswitch/conf/autoload_configs/alsa.conf.xml +opt/freeswitch/conf/autoload_configs/callcenter.conf.xml opt/freeswitch/conf/autoload_configs/cdr_csv.conf.xml opt/freeswitch/conf/autoload_configs/cidlookup.conf.xml opt/freeswitch/conf/autoload_configs/conference.conf.xml @@ -34,7 +35,6 @@ opt/freeswitch/conf/autoload_configs/openzap.conf.xml opt/freeswitch/conf/autoload_configs/pocketsphinx.conf.xml opt/freeswitch/conf/autoload_configs/portaudio.conf.xml opt/freeswitch/conf/autoload_configs/post_load_modules.conf.xml -opt/freeswitch/conf/autoload_configs/python.conf.xml opt/freeswitch/conf/autoload_configs/rss.conf.xml opt/freeswitch/conf/autoload_configs/shout.conf.xml opt/freeswitch/conf/autoload_configs/skinny.conf.xml @@ -51,7 +51,6 @@ opt/freeswitch/conf/autoload_configs/xml_rpc.conf.xml opt/freeswitch/conf/autoload_configs/zeroconf.conf.xml opt/freeswitch/conf/dialplan/default/00_pizza_demo.xml opt/freeswitch/conf/dialplan/default/01_example.com.xml -opt/freeswitch/conf/dialplan/default/99999_enum.xml opt/freeswitch/conf/dialplan/default.xml opt/freeswitch/conf/dialplan/features.xml opt/freeswitch/conf/dialplan/public/00_inbound_did.xml @@ -113,6 +112,7 @@ opt/freeswitch/conf/zt.conf opt/freeswitch/htdocs/* opt/freeswitch/lib/libfreeswitch*.so* opt/freeswitch/lib/libopenzap*.so* +opt/freeswitch/mod/mod_callcenter.so* opt/freeswitch/mod/mod_cdr_csv.so* opt/freeswitch/mod/mod_celt.so* opt/freeswitch/mod/mod_cidlookup.so* diff --git a/debian/rules b/debian/rules index 05ab4c1..114ad64 100755 --- a/debian/rules +++ b/debian/rules @@ -13,7 +13,7 @@ export APPLICATIONS_MODULES=applications/mod_cluechoo applications/mod_commands applications/mod_hash applications/mod_db applications/mod_valet_parking applications/mod_voicemail applications/mod_rss \ applications/mod_spandsp applications/mod_cidlookup applications/mod_curl applications/mod_easyroute \ applications/mod_lcr applications/mod_nibblebill applications/mod_snom \ - applications/mod_spy applications/mod_vmd applications/mod_directory + applications/mod_spy applications/mod_vmd applications/mod_directory applications/mod_callcenter export ASR_TTS_MODULES=asr_tts/mod_tts_commandline export CODECS_MODULES=codecs/mod_ilbc codecs/mod_h26x codecs/mod_speex codecs/mod_siren codecs/mod_celt export DIALPLANS_MODULES=dialplans/mod_dialplan_asterisk dialplans/mod_dialplan_directory dialplans/mod_dialplan_xml @@ -24,11 +24,11 @@ export ENDPOINTS_MODULES=endpoints/mod_dingaling endpoints/mod_portaudio endpoin endpoints/mod_skinny export EVENT_HANDLERS_MODULES=event_handlers/mod_event_multicast event_handlers/mod_event_socket event_handlers/mod_cdr_csv export FORMATS_MODULES=formats/mod_local_stream formats/mod_native_file formats/mod_sndfile formats/mod_tone_stream formats/mod_shout -export LANGUAGES_MODULES=languages/mod_spidermonkey languages/mod_perl languages/mod_lua +export LANGUAGES_MODULES=languages/mod_spidermonkey languages/mod_perl languages/mod_lua languages/mod_python export LOGGERS_MODULES=loggers/mod_console loggers/mod_logfile loggers/mod_syslog export SAY_MODULES=say/mod_say_en say/mod_say_it say/mod_say_de say/mod_say_fr say/mod_say_es say/mod_say_nl say/mod_say_ru export TIMERS_MODULES= -export DISABLED_MODULES=applications/mod_memcache applications/mod_soundtouch directories/mod_ldap languages/mod_java languages/mod_python \ +export DISABLED_MODULES=applications/mod_memcache applications/mod_soundtouch directories/mod_ldap languages/mod_java \ asr_tts/mod_cepstral asr_tts/mod_lumenvox endpoints/mod_wanpipe \ event_handlers/mod_event_test event_handlers/mod_radius_cdr event_handlers/mod_zeroconf export XML_INT_MODULES=xml_int/mod_xml_rpc xml_int/mod_xml_curl xml_int/mod_xml_cdr commit be2b5777ae47046f2346e77e05e3ade5648839ea Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Sep 17 17:06:59 2010 -0500 check gateway status instead of state in new function diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 4982307..4018407 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -4274,7 +4274,7 @@ void sofia_glue_gateway_list(sofia_profile_t *profile, switch_stream_handle_t *s switch_mutex_lock(mod_sofia_globals.hash_mutex); for (gp = profile->gateways; gp; gp = gp->next) { - int reged = (gp->state == REG_STATE_REGED); + int reged = (gp->status == SOFIA_GATEWAY_UP); if (up ? reged : !reged) { stream->write_function(stream, "%s ", gp->name); commit bd24aa6d795e74fa6398122c5a1e7a20055bb8d8 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Sep 17 17:02:19 2010 -0500 fix doc diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index febb7f6..68cc58d 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -4063,7 +4063,7 @@ SWITCH_STANDARD_API(uuid_dump_function) return SWITCH_STATUS_SUCCESS; } -#define GLOBAL_SETVAR_SYNTAX "<var> <value> [<value2>]" +#define GLOBAL_SETVAR_SYNTAX "<var>=<value> [=<value2>]" SWITCH_STANDARD_API(global_setvar_function) { char *mycmd = NULL, *argv[3] = { 0 }; commit ce01c76c56cbb8b28307f37e0bb502a8e777e7d2 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Sep 17 16:33:47 2010 -0500 frick diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index a532275..c6b7f8d 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -34,6 +34,7 @@ #include <switch.h> #include "private/switch_core_pvt.h" +//*#define DEBUG_SQL 1 static struct { switch_cache_db_handle_t *event_db; @@ -41,7 +42,9 @@ static struct { switch_memory_pool_t *memory_pool; switch_event_node_t *event_node; switch_thread_t *thread; + switch_thread_t *db_thread; int thread_running; + int db_thread_running; switch_bool_t manage; switch_mutex_t *io_mutex; switch_mutex_t *dbh_mutex; @@ -859,7 +862,24 @@ SWITCH_DECLARE(switch_bool_t) switch_cache_db_test_reactive(switch_cache_db_hand } +static void *SWITCH_THREAD_FUNC switch_core_sql_db_thread(switch_thread_t *thread, void *obj) +{ + int sec = 0; + sql_manager.db_thread_running = 1; + + while (sql_manager.db_thread_running == 1) { + if (++sec == SQL_CACHE_TIMEOUT) { + sql_close(switch_epoch_time_now(NULL)); + wake_thread(1); + sec = 0; + } + switch_yield(1000); + } + + + return NULL; +} static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, void *obj) { @@ -872,16 +892,10 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, char *sql = NULL; switch_size_t newlen; int lc = 0; - uint32_t loops = 0, sec = 0; - uint32_t l1 = 1000; uint32_t sanity = 120; switch_assert(sqlbuf); - if (!sql_manager.manage) { - l1 = 10; - } - while (!sql_manager.event_db) { if (switch_core_db_handle(&sql_manager.event_db) == SWITCH_STATUS_SUCCESS && sql_manager.event_db) break; @@ -895,26 +909,12 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, return NULL; } - sql_manager.thread_running = 1; while (sql_manager.thread_running == 1) { switch_mutex_lock(sql_manager.cond_mutex); - if (++loops == l1) { - if (++sec == SQL_CACHE_TIMEOUT) { - sql_close(switch_epoch_time_now(NULL)); - sec = 0; - } - loops = 0; - } - - if (!sql_manager.manage) { - switch_yield(100000); - continue; - } - if (sql || switch_queue_trypop(sql_manager.sql_queue[0], &pop) == SWITCH_STATUS_SUCCESS || switch_queue_trypop(sql_manager.sql_queue[1], &pop) == SWITCH_STATUS_SUCCESS) { @@ -932,9 +932,11 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, if (new_mlen < runtime.max_sql_buffer_len) { sql_len = new_mlen; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, +#ifdef DEBUG_SQL + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "REALLOC %ld %d %d\n", (long int)sql_len, switch_queue_size(sql_manager.sql_queue[0]), switch_queue_size(sql_manager.sql_queue[1])); +#endif if (!(tmp = realloc(sqlbuf, sql_len))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL thread ending on mem err\n"); abort(); @@ -942,8 +944,10 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, } sqlbuf = tmp; } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, +#ifdef DEBUG_SQL + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SAVE %d %d\n", switch_queue_size(sql_manager.sql_queue[0]), switch_queue_size(sql_manager.sql_queue[1])); +#endif goto skip; } } @@ -964,12 +968,16 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, lc = sql ? 1 : 0 + switch_queue_size(sql_manager.sql_queue[0]) + switch_queue_size(sql_manager.sql_queue[1]); if (trans && iterations && (iterations > target || !lc)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, +#ifdef DEBUG_SQL + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "RUN %d %d %d\n", switch_queue_size(sql_manager.sql_queue[0]), switch_queue_size(sql_manager.sql_queue[1]), iterations); +#endif if (switch_cache_db_persistant_execute_trans(sql_manager.event_db, sqlbuf, 1) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL thread unable to commit transaction, records lost!\n"); } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "DONE\n"); +#ifdef DEBUG_SQL + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "DONE\n"); +#endif iterations = 0; trans = 0; len = 0; @@ -978,6 +986,8 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, switch_yield(400000); } + lc = sql ? 1 : 0 + switch_queue_size(sql_manager.sql_queue[0]) + switch_queue_size(sql_manager.sql_queue[1]); + if (!lc) { switch_thread_cond_wait(sql_manager.cond, sql_manager.cond_mutex); } @@ -1412,7 +1422,7 @@ static void core_event_handler(switch_event_t *event) switch_queue_push(sql_manager.sql_queue[0], sql[i]); } sql[i] = NULL; - wake_thread(0); + wake_thread(1); } } } @@ -1663,7 +1673,10 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_ switch_threadattr_create(&thd_attr, sql_manager.memory_pool); switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); - switch_thread_create(&sql_manager.thread, thd_attr, switch_core_sql_thread, NULL, sql_manager.memory_pool); + if (sql_manager.manage) { + switch_thread_create(&sql_manager.thread, thd_attr, switch_core_sql_thread, NULL, sql_manager.memory_pool); + } + switch_thread_create(&sql_manager.db_thread, thd_attr, switch_core_sql_db_thread, NULL, sql_manager.memory_pool); while (!sql_manager.thread_running) { switch_yield(10000); @@ -1693,6 +1706,12 @@ void switch_core_sqldb_stop(void) switch_thread_join(&st, sql_manager.thread); } + + if (sql_manager.thread && sql_manager.db_thread_running) { + sql_manager.db_thread_running = -1; + switch_thread_join(&st, sql_manager.db_thread); + } + switch_cache_db_flush_handles(); sql_close(0); commit 62d275dd9d0cd7cd20fe4b3e346e7b158ef41b0b Author: Brian West <brian@freeswitch.org> Date: Fri Sep 17 15:15:29 2010 -0500 Fix T.38 passthru diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index e76a56a..e8bbb6f 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -4109,7 +4109,8 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status } } - if (tech_pvt && tech_pvt->remote_sdp_str && switch_stristr("m=image", tech_pvt->remote_sdp_str)) { + + if (sip->sip_payload && sip->sip_payload->pl_data && switch_stristr("m=image", sip->sip_payload->pl_data)) { has_t38 = 1; } @@ -4164,12 +4165,12 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status } if (status == 200 && sofia_test_flag(tech_pvt, TFLAG_T38_PASSTHRU) && has_t38) { - switch_core_session_receive_message(other_session, msg); if (switch_rtp_ready(tech_pvt->rtp_session) && switch_rtp_ready(other_tech_pvt->rtp_session)) { switch_rtp_udptl_mode(tech_pvt->rtp_session); switch_rtp_udptl_mode(other_tech_pvt->rtp_session); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Activating T38 Passthru\n"); } + switch_core_session_receive_message(other_session, msg); } else { switch_core_session_queue_message(other_session, msg); } commit 4e41e4c584a1208c96ca69b250e4df002952376a Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Sep 17 14:49:43 2010 -0500 slight fix on last commit diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 51e8437..2ea3eb0 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -122,8 +122,13 @@ static struct { -static void wake_thread(void) +static void wake_thread(int force) { + if (force) { + switch_thread_cond_signal(globals.cond); + return; + } + if (switch_mutex_trylock(globals.cond_mutex) == SWITCH_STATUS_SUCCESS) { switch_thread_cond_signal(globals.cond); switch_mutex_unlock(globals.cond_mutex); @@ -140,7 +145,7 @@ static int add_pvt(pvt_t *pvt) t38_state_list.head = pvt; switch_mutex_unlock(t38_state_list.mutex); r = 1; - wake_thread(); + wake_thread(0); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error launching thread\n"); } @@ -175,7 +180,7 @@ static int del_pvt(pvt_t *del_pvt) switch_mutex_unlock(t38_state_list.mutex); - wake_thread(); + wake_thread(0); return r; } @@ -1345,7 +1350,7 @@ void mod_spandsp_fax_shutdown(void) switch_status_t tstatus = SWITCH_STATUS_SUCCESS; t38_state_list.thread_running = 0; - wake_thread(); + wake_thread(1); switch_thread_join(&tstatus, t38_state_list.thread); memset(&globals, 0, sizeof(globals)); } diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 4c742f3..a532275 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -464,8 +464,13 @@ static switch_status_t switch_cache_db_execute_sql_real(switch_cache_db_handle_t return status; } -static void wake_thread(void) +static void wake_thread(int force) { + if (force) { + switch_thread_cond_signal(sql_manager.cond); + return; + } + if (switch_mutex_trylock(sql_manager.cond_mutex) == SWITCH_STATUS_SUCCESS) { switch_thread_cond_signal(sql_manager.cond); switch_mutex_unlock(sql_manager.cond_mutex); @@ -1407,7 +1412,7 @@ static void core_event_handler(switch_event_t *event) switch_queue_push(sql_manager.sql_queue[0], sql[i]); } sql[i] = NULL; - wake_thread(); + wake_thread(0); } } } @@ -1681,7 +1686,7 @@ void switch_core_sqldb_stop(void) switch_queue_push(sql_manager.sql_queue[0], NULL); switch_queue_push(sql_manager.sql_queue[1], NULL); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Waiting for unfinished SQL transactions\n"); - wake_thread(); + wake_thread(1); } sql_manager.thread_running = -1; commit 0477cb67f5a454367f4b5208bdee6d849d64495c Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Sep 17 14:11:57 2010 -0500 add sofia profile <profile> gwlist up|down to list up or downed profiles for feeding into mod distributor to exclude dead gateways diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 5039fef..1e8876e 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3166,6 +3166,21 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t goto done; } + + if (!strcasecmp(argv[1], "gwlist")) { + int up = 1; + + if (argc > 2) { + if (!strcasecmp(argv[2], "down")) { + up = 0; + } + } + + sofia_glue_gateway_list(profile, stream, up); + goto done; + } + + stream->write_function(stream, "-ERR Unknown command!\n"); done: @@ -4637,6 +4652,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) switch_console_set_complete("add sofia profile ::sofia::list_profiles siptrace on"); switch_console_set_complete("add sofia profile ::sofia::list_profiles siptrace off"); + switch_console_set_complete("add sofia profile ::sofia::list_profiles gwlist up"); + switch_console_set_complete("add sofia profile ::sofia::list_profiles gwlist down"); + switch_console_set_complete("add sofia status profile ::sofia::list_profiles"); switch_console_set_complete("add sofia status profile ::sofia::list_profiles reg"); switch_console_set_complete("add sofia status gateway ::sofia::list_gateways"); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 96acbcd..5a69958 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -942,6 +942,7 @@ switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int const char *sofia_glue_strip_proto(const char *uri); switch_status_t reconfig_sofia(sofia_profile_t *profile); void sofia_glue_del_gateway(sofia_gateway_t *gp); +void sofia_glue_gateway_list(sofia_profile_t *profile, switch_stream_handle_t *stream, int up); void sofia_glue_del_every_gateway(sofia_profile_t *profile); void sofia_reg_send_reboot(sofia_profile_t *profile, const char *user, const char *host, const char *contact, const char *user_agent, const char *network_ip); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index d17981c..4982307 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -4267,6 +4267,28 @@ void sofia_glue_del_every_gateway(sofia_profile_t *profile) } +void sofia_glue_gateway_list(sofia_profile_t *profile, switch_stream_handle_t *stream, int up) +{ + sofia_gateway_t *gp = NULL; + char *r = (char *) stream->data; + + switch_mutex_lock(mod_sofia_globals.hash_mutex); + for (gp = profile->gateways; gp; gp = gp->next) { + int reged = (gp->state == REG_STATE_REGED); + + if (up ? reged : !reged) { + stream->write_function(stream, "%s ", gp->name); + } + } + + if (r) { + end_of(r) = '\0'; + } + + switch_mutex_unlock(mod_sofia_globals.hash_mutex); +} + + void sofia_glue_del_gateway(sofia_gateway_t *gp) { if (!gp->deleted) { commit 445731eea186ffd2fa7ac2b268180a5ebd6438b5 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Sep 17 14:10:30 2010 -0500 add inline lists for tab complete db using ::[a:b syntax diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 68c99f1..5039fef 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -4618,8 +4618,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) switch_console_set_complete("add sofia help"); switch_console_set_complete("add sofia status"); switch_console_set_complete("add sofia xmlstatus"); - switch_console_set_complete("add sofia loglevel"); - switch_console_set_complete("add sofia tracelevel"); + + switch_console_set_complete("add sofia loglevel ::[all:default:tport:iptsec:nea:nta:nth_client:nth_server:nua:soa:sresolv:stun ::[0:1:2:3:4:5:6:7:8:9"); + switch_console_set_complete("add sofia tracelevel ::[console:alert:crit:err:warning:notice:info:debug"); + switch_console_set_complete("add sofia profile"); switch_console_set_complete("add sofia profile restart all"); diff --git a/src/switch_console.c b/src/switch_console.c index 30d1d97..06a7e0d 100644 --- a/src/switch_console.c +++ b/src/switch_console.c @@ -483,9 +483,29 @@ static int comp_callback(void *pArg, int argc, char **argv, char **columnNames) return -1; } + if (!zstr(target) && *target == ':' && *(target + 1) == ':' && *(target + 2) == '[') { + char *p = target + 3, *list = NULL; + + if (p) { + char *argv[100] = { 0 }; + char *r_argv[1] = { 0 }, *r_cols[1] = {0}; + list = strdup(p); + + argc = switch_separate_string(list, ':', argv, (sizeof(argv) / sizeof(argv[0]))); + + for (i = 0; i < argc; i++) { + if (!cur || !strncmp(argv[i], cur, strlen(cur))) { + r_argv[0] = argv[i]; + comp_callback(h, 1, r_argv, r_cols); + } + } + switch_safe_free(list); + } + return 0; + } + if (!zstr(target) && *target == ':' && *(target + 1) == ':') { - char *r_argv[1] = { 0 }, *r_cols[1] = { - 0}; + char *r_argv[1] = { 0 }, *r_cols[1] = {0}; switch_console_callback_match_t *matches; if (switch_console_run_complete_func(target, str, cur, &matches) == SWITCH_STATUS_SUCCESS) { switch_console_callback_match_node_t *m; @@ -797,6 +817,7 @@ SWITCH_DECLARE(unsigned char) switch_console_complete(const char *line, const ch } stream.write_function(&stream, " and hostname='%s' order by a%d", switch_core_get_variable("hostname"), h.words + 1); + switch_cache_db_execute_sql_callback(db, stream.data, comp_callback, &h, &errmsg); if (errmsg) { commit 07ec7867db580faef8eb120ed5e1b991c06a5b2d Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Sep 17 14:05:48 2010 -0500 set conditionals to only fire when the mutex can be obtained diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 1c825ec..51e8437 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -120,6 +120,16 @@ static struct { int thread_running; } t38_state_list; + + +static void wake_thread(void) +{ + if (switch_mutex_trylock(globals.cond_mutex) == SWITCH_STATUS_SUCCESS) { + switch_thread_cond_signal(globals.cond); + switch_mutex_unlock(globals.cond_mutex); + } +} + static int add_pvt(pvt_t *pvt) { int r = 0; @@ -130,7 +140,7 @@ static int add_pvt(pvt_t *pvt) t38_state_list.head = pvt; switch_mutex_unlock(t38_state_list.mutex); r = 1; - switch_thread_cond_broadcast(globals.cond); + wake_thread(); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error launching thread\n"); } @@ -165,7 +175,7 @@ static int del_pvt(pvt_t *del_pvt) switch_mutex_unlock(t38_state_list.mutex); - switch_thread_cond_broadcast(globals.cond); + wake_thread(); return r; } @@ -1335,7 +1345,7 @@ void mod_spandsp_fax_shutdown(void) switch_status_t tstatus = SWITCH_STATUS_SUCCESS; t38_state_list.thread_running = 0; - switch_thread_cond_broadcast(globals.cond); + wake_thread(); switch_thread_join(&tstatus, t38_state_list.thread); memset(&globals, 0, sizeof(globals)); } diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 4a53c8d..4c742f3 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -464,6 +464,14 @@ static switch_status_t switch_cache_db_execute_sql_real(switch_cache_db_handle_t return status; } +static void wake_thread(void) +{ + if (switch_mutex_trylock(sql_manager.cond_mutex) == SWITCH_STATUS_SUCCESS) { + switch_thread_cond_signal(sql_manager.cond); + switch_mutex_unlock(sql_manager.cond_mutex); + } +} + /** OMFG you cruel bastards. Who chooses 64k as a max buffer len for a sql statement, have you ever heard of transactions? **/ @@ -1399,7 +1407,7 @@ static void core_event_handler(switch_event_t *event) switch_queue_push(sql_manager.sql_queue[0], sql[i]); } sql[i] = NULL; - switch_thread_cond_broadcast(sql_manager.cond); + wake_thread(); } } } @@ -1673,7 +1681,7 @@ void switch_core_sqldb_stop(void) switch_queue_push(sql_manager.sql_queue[0], NULL); switch_queue_push(sql_manager.sql_queue[1], NULL); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Waiting for unfinished SQL transactions\n"); - switch_thread_cond_broadcast(sql_manager.cond); + wake_thread(); } sql_manager.thread_running = -1; commit 1c76ca4d72df8faf698edcea32b17f33f5009533 Author: Konrad Hammel <konrad@sangoma.com> Date: Fri Sep 17 13:37:20 2010 -0400 freetdm: ss7 - bug fix in pause/resume handling diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index 0d52dfa..a4fee0f 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -954,6 +954,42 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) SS7_DEBUG_CHAN(ftdmchan,"Current flags: 0x%X\n", sngss7_info->flags); /**********************************************************************/ + if (sngss7_test_flag(sngss7_info, FLAG_INFID_RESUME)) { + + /* clear the RESUME flag */ + sngss7_clear_flag(sngss7_info, FLAG_INFID_RESUME); + + /* if there are any resets present */ + if ((sngss7_test_flag (sngss7_info, FLAG_RESET_TX)) || + (sngss7_test_flag (sngss7_info, FLAG_RESET_RX)) || + (sngss7_test_flag (sngss7_info, FLAG_GRP_RESET_TX)) || + (sngss7_test_flag (sngss7_info, FLAG_GRP_RESET_RX))) { + + /* go back to the reset state */ + goto suspend_goto_restart; + } else { + + /* bring the sig status back up */ + sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; + sigev.sigstatus = FTDM_SIG_STATE_UP; + ftdm_span_send_signal(ftdmchan->span, &sigev); + } + + /* go back to the last state */ + goto suspend_goto_last; + } /* if (sngss7_test_flag(sngss7_info, FLAG_INFID_RESUME)) */ + + if (sngss7_test_flag(sngss7_info, FLAG_INFID_PAUSED)) { + + /* bring the sig status down */ + sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; + sigev.sigstatus = FTDM_SIG_STATE_DOWN; + ftdm_span_send_signal(ftdmchan->span, &sigev); + + /* go back to the last state */ + goto suspend_goto_last; + } /* if (sngss7_test_flag(sngss7_info, FLAG_INFID_PAUSED)) { */ + /**********************************************************************/ if (sngss7_test_flag (sngss7_info, FLAG_CKT_MN_BLOCK_RX)) { SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_BLOCK_RX flag %s\n", ""); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 5086d11..694e9a4 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -561,24 +561,19 @@ ftdm_status_t check_for_res_sus_flag(ftdm_span_t *ftdmspan) sigev.span_id = ftdmchan->span_id; sigev.channel = ftdmchan; + /* if we have the PAUSED flag and the sig status is still UP */ if ((sngss7_test_flag(sngss7_info, FLAG_INFID_PAUSED)) && (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP))) { - /* bring the sig status down */ - sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.sigstatus = FTDM_SIG_STATE_DOWN; - ftdm_span_send_signal(ftdmchan->span, &sigev); + /* throw the channel into SUSPENDED to process the flag */ + /* after doing this once the sig status will be down */ + ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); } - if ((sngss7_test_flag(sngss7_info, FLAG_INFID_RESUME)) && - !(ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP))) { - - /* bring the sig status back up */ - sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.sigstatus = FTDM_SIG_STATE_UP; - ftdm_span_send_signal(ftdmchan->span, &sigev); - - sngss7_clear_flag(sngss7_info, FLAG_INFID_RESUME); + /* if the RESUME flag is up go to SUSPENDED to process the flag */ + /* after doing this the flag will be cleared */ + if (sngss7_test_flag(sngss7_info, FLAG_INFID_RESUME)) { + ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); } /* unlock the channel */ commit 6235f7435531bf253e2af845859da5f10b633d91 Merge: a045519 d7c5cb2 Author: David Yat Sin <dyatsin@sangoma.com> Date: Fri Sep 17 11:09:34 2010 -0400 Merge branch 'master' of git://git.freeswitch.org/freeswitch commit d7c5cb2e33bce05ba5e96df12c73813ef020a88b Author: Brian West <brian@freeswitch.org> Date: Fri Sep 17 09:55:12 2010 -0500 swigall diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index 55d78c3..b4c7ddd 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -2975,6 +2975,71 @@ SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_rtp_numbers_t(void * jarg1) { } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtcp_numbers_t_packet_count_set(void * jarg1, unsigned long jarg2) { + switch_rtcp_numbers_t *arg1 = (switch_rtcp_numbers_t *) 0 ; + uint32_t arg2 ; + + arg1 = (switch_rtcp_numbers_t *)jarg1; + arg2 = (uint32_t)jarg2; + if (arg1) (arg1)->packet_count = arg2; + +} + + +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_rtcp_numbers_t_packet_count_get(void * jarg1) { + unsigned long jresult ; + switch_rtcp_numbers_t *arg1 = (switch_rtcp_numbers_t *) 0 ; + uint32_t result; + + arg1 = (switch_rtcp_numbers_t *)jarg1; + result = (uint32_t) ((arg1)->packet_count); + jresult = (unsigned long)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtcp_numbers_t_octet_count_set(void * jarg1, unsigned long jarg2) { + switch_rtcp_numbers_t *arg1 = (switch_rtcp_numbers_t *) 0 ; + uint32_t arg2 ; + + arg1 = (switch_rtcp_numbers_t *)jarg1; + arg2 = (uint32_t)jarg2; + if (arg1) (arg1)->octet_count = arg2; + +} + + +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_rtcp_numbers_t_octet_count_get(void * jarg1) { + unsigned long jresult ; + switch_rtcp_numbers_t *arg1 = (switch_rtcp_numbers_t *) 0 ; + uint32_t result; + + arg1 = (switch_rtcp_numbers_t *)jarg1; + result = (uint32_t) ((arg1)->octet_count); + jresult = (unsigned long)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_rtcp_numbers_t() { + void * jresult ; + switch_rtcp_numbers_t *result = 0 ; + + result = (switch_rtcp_numbers_t *)new switch_rtcp_numbers_t(); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_rtcp_numbers_t(void * jarg1) { + switch_rtcp_numbers_t *arg1 = (switch_rtcp_numbers_t *) 0 ; + + arg1 = (switch_rtcp_numbers_t *)jarg1; + delete arg1; + +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_stats_t_inbound_set(void * jarg1, void * jarg2) { switch_rtp_stats_t *arg1 = (switch_rtp_stats_t *) 0 ; switch_rtp_numbers_t *arg2 = (switch_rtp_numbers_t *) 0 ; @@ -3021,6 +3086,29 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_stats_t_outbound_get(void * jarg } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_stats_t_rtcp_set(void * jarg1, void * jarg2) { + switch_rtp_stats_t *arg1 = (switch_rtp_stats_t *) 0 ; + switch_rtcp_numbers_t *arg2 = (switch_rtcp_numbers_t *) 0 ; + + arg1 = (switch_rtp_stats_t *)jarg1; + arg2 = (switch_rtcp_numbers_t *)jarg2; + if (arg1) (arg1)->rtcp = *arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_stats_t_rtcp_get(void * jarg1) { + void * jresult ; + switch_rtp_stats_t *arg1 = (switch_rtp_stats_t *) 0 ; + switch_rtcp_numbers_t *result = 0 ; + + arg1 = (switch_rtp_stats_t *)jarg1; + result = (switch_rtcp_numbers_t *)& ((arg1)->rtcp); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_rtp_stats_t() { void * jresult ; switch_rtp_stats_t *result = 0 ; @@ -10379,6 +10467,858 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_in_thread(void * jarg1) { } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_module_name_set(void * jarg1, char * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + char *arg2 = (char *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (char *)jarg2; + { + if (arg2) { + arg1->module_name = (char const *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->module_name, (const char *)arg2); + } else { + arg1->module_name = 0; + } + } +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_loadable_module_interface_module_name_get(void * jarg1) { + char * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + char *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (char *) ((arg1)->module_name); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_endpoint_interface_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_endpoint_interface_t *arg2 = (switch_endpoint_interface_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_endpoint_interface_t *)jarg2; + if (arg1) (arg1)->endpoint_interface = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_endpoint_interface_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_endpoint_interface_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_endpoint_interface_t *) ((arg1)->endpoint_interface); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_timer_interface_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_timer_interface_t *arg2 = (switch_timer_interface_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_timer_interface_t *)jarg2; + if (arg1) (arg1)->timer_interface = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_timer_interface_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_timer_interface_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_timer_interface_t *) ((arg1)->timer_interface); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_dialplan_interface_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_dialplan_interface_t *arg2 = (switch_dialplan_interface_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_dialplan_interface_t *)jarg2; + if (arg1) (arg1)->dialplan_interface = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_dialplan_interface_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_dialplan_interface_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_dialplan_interface_t *) ((arg1)->dialplan_interface); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_codec_interface_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_codec_interface_t *arg2 = (switch_codec_interface_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_codec_interface_t *)jarg2; + if (arg1) (arg1)->codec_interface = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_codec_interface_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_codec_interface_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_codec_interface_t *) ((arg1)->codec_interface); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_application_interface_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_application_interface_t *arg2 = (switch_application_interface_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_application_interface_t *)jarg2; + if (arg1) (arg1)->application_interface = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_application_interface_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_application_interface_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_application_interface_t *) ((arg1)->application_interface); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_api_interface_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_api_interface_t *arg2 = (switch_api_interface_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_api_interface_t *)jarg2; + if (arg1) (arg1)->api_interface = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_api_interface_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_api_interface_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_api_interface_t *) ((arg1)->api_interface); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_file_interface_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_file_interface_t *arg2 = (switch_file_interface_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_file_interface_t *)jarg2; + if (arg1) (arg1)->file_interface = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_file_interface_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_file_interface_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_file_interface_t *) ((arg1)->file_interface); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_speech_interface_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_speech_interface_t *arg2 = (switch_speech_interface_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_speech_interface_t *)jarg2; + if (arg1) (arg1)->speech_interface = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_speech_interface_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_speech_interface_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_speech_interface_t *) ((arg1)->speech_interface); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_directory_interface_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_directory_interface_t *arg2 = (switch_directory_interface_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_directory_interface_t *)jarg2; + if (arg1) (arg1)->directory_interface = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_directory_interface_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_directory_interface_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_directory_interface_t *) ((arg1)->directory_interface); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_chat_interface_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_chat_interface_t *arg2 = (switch_chat_interface_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_chat_interface_t *)jarg2; + if (arg1) (arg1)->chat_interface = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_chat_interface_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_chat_interface_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_chat_interface_t *) ((arg1)->chat_interface); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_say_interface_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_say_interface_t *arg2 = (switch_say_interface_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_say_interface_t *)jarg2; + if (arg1) (arg1)->say_interface = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_say_interface_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_say_interface_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_say_interface_t *) ((arg1)->say_interface); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_asr_interface_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_asr_interface_t *arg2 = (switch_asr_interface_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_asr_interface_t *)jarg2; + if (arg1) (arg1)->asr_interface = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_asr_interface_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_asr_interface_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_asr_interface_t *) ((arg1)->asr_interface); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_management_interface_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_management_interface_t *arg2 = (switch_management_interface_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_management_interface_t *)jarg2; + if (arg1) (arg1)->management_interface = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_management_interface_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_management_interface_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_management_interface_t *) ((arg1)->management_interface); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_limit_interface_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_limit_interface_t *arg2 = (switch_limit_interface_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_limit_interface_t *)jarg2; + if (arg1) (arg1)->limit_interface = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_limit_interface_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_limit_interface_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_limit_interface_t *) ((arg1)->limit_interface); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_rwlock_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_thread_rwlock_t *)jarg2; + if (arg1) (arg1)->rwlock = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_rwlock_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_thread_rwlock_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_thread_rwlock_t *) ((arg1)->rwlock); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_refs_set(void * jarg1, int jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + int arg2 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (int)jarg2; + if (arg1) (arg1)->refs = arg2; + +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_loadable_module_interface_refs_get(void * jarg1) { + int jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + int result; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (int) ((arg1)->refs); + jresult = result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_pool_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_memory_pool_t *)jarg2; + if (arg1) (arg1)->pool = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_pool_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_memory_pool_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_memory_pool_t *) ((arg1)->pool); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_loadable_module_interface() { + void * jresult ; + switch_loadable_module_interface *result = 0 ; + + result = (switch_loadable_module_interface *)new switch_loadable_module_interface(); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_loadable_module_interface(void * jarg1) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + delete arg1; + +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_loadable_module_init(int jarg1) { + int jresult ; + switch_bool_t arg1 ; + switch_status_t result; + + arg1 = (switch_bool_t)jarg1; + result = (switch_status_t)switch_loadable_module_init(arg1); + jresult = result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_shutdown() { + switch_loadable_module_shutdown(); +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_endpoint_interface(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_endpoint_interface_t *result = 0 ; + + arg1 = (char *)jarg1; + result = (switch_endpoint_interface_t *)switch_loadable_module_get_endpoint_interface((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_codec_interface(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_codec_interface_t *result = 0 ; + + arg1 = (char *)jarg1; + result = (switch_codec_interface_t *)switch_loadable_module_get_codec_interface((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_dialplan_interface(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_dialplan_interface_t *result = 0 ; + + arg1 = (char *)jarg1; + result = (switch_dialplan_interface_t *)switch_loadable_module_get_dialplan_interface((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_loadable_module_enumerate_available(char * jarg1, void * jarg2, void * jarg3) { + int jresult ; + char *arg1 = (char *) 0 ; + switch_modulename_callback_func_t arg2 = (switch_modulename_callback_func_t) 0 ; + void *arg3 = (void *) 0 ; + switch_status_t result; + + arg1 = (char *)jarg1; + arg2 = (switch_modulename_callback_func_t)jarg2; + arg3 = (void *)jarg3; + result = (switch_status_t)switch_loadable_module_enumerate_available((char const *)arg1,arg2,arg3); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_loadable_module_enumerate_loaded(void * jarg1, void * jarg2) { + int jresult ; + switch_modulename_callback_func_t arg1 = (switch_modulename_callback_func_t) 0 ; + void *arg2 = (void *) 0 ; + switch_status_t result; + + arg1 = (switch_modulename_callback_func_t)jarg1; + arg2 = (void *)jarg2; + result = (switch_status_t)switch_loadable_module_enumerate_loaded(arg1,arg2); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_loadable_module_build_dynamic(char * jarg1, void * jarg2, void * jarg3, void * jarg4, int jarg5) { + int jresult ; + char *arg1 = (char *) 0 ; + switch_module_load_t arg2 = (switch_module_load_t) 0 ; + switch_module_runtime_t arg3 = (switch_module_runtime_t) 0 ; + switch_module_shutdown_t arg4 = (switch_module_shutdown_t) 0 ; + switch_bool_t arg5 ; + switch_status_t result; + + arg1 = (char *)jarg1; + arg2 = (switch_module_load_t)jarg2; + arg3 = (switch_module_runtime_t)jarg3; + arg4 = (switch_module_shutdown_t)jarg4; + arg5 = (switch_bool_t)jarg5; + result = (switch_status_t)switch_loadable_module_build_dynamic(arg1,arg2,arg3,arg4,arg5); + jresult = result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_timer_interface(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_timer_interface_t *result = 0 ; + + arg1 = (char *)jarg1; + result = (switch_timer_interface_t *)switch_loadable_module_get_timer_interface((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_application_interface(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_application_interface_t *result = 0 ; + + arg1 = (char *)jarg1; + result = (switch_application_interface_t *)switch_loadable_module_get_application_interface((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_api_interface(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_api_interface_t *result = 0 ; + + arg1 = (char *)jarg1; + result = (switch_api_interface_t *)switch_loadable_module_get_api_interface((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_file_interface(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_file_interface_t *result = 0 ; + + arg1 = (char *)jarg1; + result = (switch_file_interface_t *)switch_loadable_module_get_file_interface((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_speech_interface(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_speech_interface_t *result = 0 ; + + arg1 = (char *)jarg1; + result = (switch_speech_interface_t *)switch_loadable_module_get_speech_interface((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_asr_interface(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_asr_interface_t *result = 0 ; + + arg1 = (char *)jarg1; + result = (switch_asr_interface_t *)switch_loadable_module_get_asr_interface((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_directory_interface(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_directory_interface_t *result = 0 ; + + arg1 = (char *)jarg1; + result = (switch_directory_interface_t *)switch_loadable_module_get_directory_interface((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_chat_interface(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_chat_interface_t *result = 0 ; + + arg1 = (char *)jarg1; + result = (switch_chat_interface_t *)switch_loadable_module_get_chat_interface((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_say_interface(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_say_interface_t *result = 0 ; + + arg1 = (char *)jarg1; + result = (switch_say_interface_t *)switch_loadable_module_get_say_interface((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_management_interface(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_management_interface_t *result = 0 ; + + arg1 = (char *)jarg1; + result = (switch_management_interface_t *)switch_loadable_module_get_management_interface((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_limit_interface(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_limit_interface_t *result = 0 ; + + arg1 = (char *)jarg1; + result = (switch_limit_interface_t *)switch_loadable_module_get_limit_interface((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_loadable_module_get_codecs(void * jarg1, int jarg2) { + int jresult ; + switch_codec_implementation_t **arg1 = (switch_codec_implementation_t **) 0 ; + int arg2 ; + int result; + + arg1 = (switch_codec_implementation_t **)jarg1; + arg2 = (int)jarg2; + result = (int)switch_loadable_module_get_codecs((switch_codec_implementation const **)arg1,arg2); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_loadable_module_get_codecs_sorted(void * jarg1, int jarg2, void * jarg3, int jarg4) { + int jresult ; + switch_codec_implementation_t **arg1 = (switch_codec_implementation_t **) 0 ; + int arg2 ; + char **arg3 = (char **) 0 ; + int arg4 ; + int result; + + arg1 = (switch_codec_implementation_t **)jarg1; + arg2 = (int)jarg2; + arg3 = (char **)jarg3; + arg4 = (int)jarg4; + result = (int)switch_loadable_module_get_codecs_sorted((switch_codec_implementation const **)arg1,arg2,arg3,arg4); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_api_execute(char * jarg1, char * jarg2, void * jarg3, void * jarg4) { + int jresult ; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + switch_core_session_t *arg3 = (switch_core_session_t *) 0 ; + switch_stream_handle_t *arg4 = (switch_stream_handle_t *) 0 ; + switch_status_t result; + + arg1 = (char *)jarg1; + arg2 = (char *)jarg2; + arg3 = (switch_core_session_t *)jarg3; + arg4 = (switch_stream_handle_t *)jarg4; + result = (switch_status_t)switch_api_execute((char const *)arg1,(char const *)arg2,arg3,arg4); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_loadable_module_load_module(char * jarg1, char * jarg2, int jarg3, void * jarg4) { + int jresult ; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + switch_bool_t arg3 ; + char **arg4 = (char **) 0 ; + switch_status_t result; + + arg1 = (char *)jarg1; + arg2 = (char *)jarg2; + arg3 = (switch_bool_t)jarg3; + arg4 = (char **)jarg4; + result = (switch_status_t)switch_loadable_module_load_module(arg1,arg2,arg3,(char const **)arg4); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_loadable_module_exists(char * jarg1) { + int jresult ; + char *arg1 = (char *) 0 ; + switch_status_t result; + + arg1 = (char *)jarg1; + result = (switch_status_t)switch_loadable_module_exists((char const *)arg1); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_loadable_module_unload_module(char * jarg1, char * jarg2, int jarg3, void * jarg4) { + int jresult ; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + switch_bool_t arg3 ; + char **arg4 = (char **) 0 ; + switch_status_t result; + + arg1 = (char *)jarg1; + arg2 = (char *)jarg2; + arg3 = (switch_bool_t)jarg3; + arg4 = (char **)jarg4; + result = (switch_status_t)switch_loadable_module_unload_module(arg1,arg2,arg3,(char const **)arg4); + jresult = result; + return jresult; +} + + +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_codec_next_id() { + unsigned long jresult ; + uint32_t result; + + result = (uint32_t)switch_core_codec_next_id(); + jresult = (unsigned long)result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_check_interval(unsigned long jarg1, unsigned long jarg2) { + int jresult ; + uint32_t arg1 ; + uint32_t arg2 ; + int result; + + arg1 = (uint32_t)jarg1; + arg2 = (uint32_t)jarg2; + result = (int)switch_check_interval(arg1,arg2); + jresult = result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_codec_add_implementation(void * jarg1, void * jarg2, int jarg3, unsigned char jarg4, char * jarg5, char * jarg6, unsigned long jarg7, unsigned long jarg8, int jarg9, int jarg10, unsigned long jarg11, unsigned long jarg12, unsigned long jarg13, unsigned char jarg14, int jarg15, void * jarg16, void * jarg17, void * jarg18, void * jarg19) { + switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ; + switch_codec_interface_t *arg2 = (switch_codec_interface_t *) 0 ; + switch_codec_type_t arg3 ; + switch_payload_t arg4 ; + char *arg5 = (char *) 0 ; + char *arg6 = (char *) 0 ; + uint32_t arg7 ; + uint32_t arg8 ; + int arg9 ; + int arg10 ; + uint32_t arg11 ; + uint32_t arg12 ; + uint32_t arg13 ; + uint8_t arg14 ; + int arg15 ; + switch_core_codec_init_func_t arg16 = (switch_core_codec_init_func_t) 0 ; + switch_core_codec_encode_func_t arg17 = (switch_core_codec_encode_func_t) 0 ; + switch_core_codec_decode_func_t arg18 = (switch_core_codec_decode_func_t) 0 ; + switch_core_codec_destroy_func_t arg19 = (switch_core_codec_destroy_func_t) 0 ; + + arg1 = (switch_memory_pool_t *)jarg1; + arg2 = (switch_codec_interface_t *)jarg2; + arg3 = (switch_codec_type_t)jarg3; + arg4 = (switch_payload_t)jarg4; + arg5 = (char *)jarg5; + arg6 = (char *)jarg6; + arg7 = (uint32_t)jarg7; + arg8 = (uint32_t)jarg8; + arg9 = (int)jarg9; + arg10 = (int)jarg10; + arg11 = (uint32_t)jarg11; + arg12 = (uint32_t)jarg12; + arg13 = (uint32_t)jarg13; + arg14 = (uint8_t)jarg14; + arg15 = (int)jarg15; + arg16 = (switch_core_codec_init_func_t)jarg16; + arg17 = (switch_core_codec_encode_func_t)jarg17; + arg18 = (switch_core_codec_decode_func_t)jarg18; + arg19 = (switch_core_codec_destroy_func_t)jarg19; + switch_core_codec_add_implementation(arg1,arg2,arg3,arg4,(char const *)arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15,arg16,arg17,arg18,arg19); +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_codec_ready(void * jarg1) { + int jresult ; + switch_codec_t *arg1 = (switch_codec_t *) 0 ; + switch_bool_t result; + + arg1 = (switch_codec_t *)jarg1; + result = (switch_bool_t)switch_core_codec_ready(arg1); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CMD_CHUNK_LEN_get() { int jresult ; int result; @@ -11764,6 +12704,44 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_network_list_validate_ip_token(void * j } +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_dow_int2str(int jarg1) { + char * jresult ; + int arg1 ; + char *result = 0 ; + + arg1 = (int)jarg1; + result = (char *)switch_dow_int2str(arg1); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_dow_str2int(char * jarg1) { + int jresult ; + char *arg1 = (char *) 0 ; + int result; + + arg1 = (char *)jarg1; + result = (int)switch_dow_str2int((char const *)arg1); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_dow_cmp(char * jarg1, int jarg2) { + int jresult ; + char *arg1 = (char *) 0 ; + int arg2 ; + int result; + + arg1 = (char *)jarg1; + arg2 = (int)jarg2; + result = (int)switch_dow_cmp((char const *)arg1,arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_number_cmp(char * jarg1, int jarg2) { int jresult ; char *arg1 = (char *) 0 ; @@ -11778,6 +12756,62 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_number_cmp(char * jarg1, int jarg2) { } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_tod_cmp(char * jarg1, int jarg2) { + int jresult ; + char *arg1 = (char *) 0 ; + int arg2 ; + int result; + + arg1 = (char *)jarg1; + arg2 = (int)jarg2; + result = (int)switch_tod_cmp((char const *)arg1,arg2); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_fulldate_cmp(char * jarg1, void * jarg2) { + int jresult ; + char *arg1 = (char *) 0 ; + switch_time_t *arg2 = (switch_time_t *) 0 ; + int result; + + arg1 = (char *)jarg1; + arg2 = (switch_time_t *)jarg2; + result = (int)switch_fulldate_cmp((char const *)arg1,arg2); + jresult = result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_split_date(char * jarg1, void * jarg2, void * jarg3, void * jarg4) { + char *arg1 = (char *) 0 ; + int *arg2 = (int *) 0 ; + int *arg3 = (int *) 0 ; + int *arg4 = (int *) 0 ; + + arg1 = (char *)jarg1; + arg2 = (int *)jarg2; + arg3 = (int *)jarg3; + arg4 = (int *)jarg4; + switch_split_date((char const *)arg1,arg2,arg3,arg4); +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_split_time(char * jarg1, void * jarg2, void * jarg3, void * jarg4) { + char *arg1 = (char *) 0 ; + int *arg2 = (int *) 0 ; + int *arg3 = (int *) 0 ; + int *arg4 = (int *) 0 ; + + arg1 = (char *)jarg1; + arg2 = (int *)jarg2; + arg3 = (int *)jarg3; + arg4 = (int *)jarg4; + switch_split_time((char const *)arg1,arg2,arg3,arg4); +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_split_user_domain(char * jarg1, void * jarg2, void * jarg3) { int jresult ; char *arg1 = (char *) 0 ; @@ -28900,6 +29934,18 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_init(void * jarg1, void * jarg2) { } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_reload(void * jarg1) { + int jresult ; + char **arg1 = (char **) 0 ; + switch_status_t result; + + arg1 = (char **)jarg1; + result = (switch_status_t)switch_xml_reload((char const **)arg1); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_destroy() { int jresult ; switch_status_t result; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index 1794978..5f412f4 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -2068,14 +2068,14 @@ public class freeswitch { return ret; } - public static SWIGTYPE_p_switch_loadable_module_interface switch_loadable_module_create_module_interface(SWIGTYPE_p_apr_pool_t pool, string name) { + public static switch_loadable_module_interface switch_loadable_module_create_module_interface(SWIGTYPE_p_apr_pool_t pool, string name) { IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_create_module_interface(SWIGTYPE_p_apr_pool_t.getCPtr(pool), name); - SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); return ret; } - public static SWIGTYPE_p_void switch_loadable_module_create_interface(SWIGTYPE_p_switch_loadable_module_interface mod, switch_module_interface_name_t iname) { - IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_create_interface(SWIGTYPE_p_switch_loadable_module_interface.getCPtr(mod), (int)iname); + public static SWIGTYPE_p_void switch_loadable_module_create_interface(switch_loadable_module_interface mod, switch_module_interface_name_t iname) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_create_interface(switch_loadable_module_interface.getCPtr(mod), (int)iname); SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false); return ret; } @@ -2299,6 +2299,163 @@ public class freeswitch { return ret; } + public static switch_status_t switch_loadable_module_init(switch_bool_t autoload) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_init((int)autoload); + return ret; + } + + public static void switch_loadable_module_shutdown() { + freeswitchPINVOKE.switch_loadable_module_shutdown(); + } + + public static switch_endpoint_interface switch_loadable_module_get_endpoint_interface(string name) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_endpoint_interface(name); + switch_endpoint_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_endpoint_interface(cPtr, false); + return ret; + } + + public static switch_codec_interface switch_loadable_module_get_codec_interface(string name) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_codec_interface(name); + switch_codec_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_codec_interface(cPtr, false); + return ret; + } + + public static switch_dialplan_interface switch_loadable_module_get_dialplan_interface(string name) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_dialplan_interface(name); + switch_dialplan_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_dialplan_interface(cPtr, false); + return ret; + } + + public static switch_status_t switch_loadable_module_enumerate_available(string dir_path, SWIGTYPE_p_f_p_void_p_q_const__char__int callback, SWIGTYPE_p_void user_data) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_enumerate_available(dir_path, SWIGTYPE_p_f_p_void_p_q_const__char__int.getCPtr(callback), SWIGTYPE_p_void.getCPtr(user_data)); + return ret; + } + + public static switch_status_t switch_loadable_module_enumerate_loaded(SWIGTYPE_p_f_p_void_p_q_const__char__int callback, SWIGTYPE_p_void user_data) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_enumerate_loaded(SWIGTYPE_p_f_p_void_p_q_const__char__int.getCPtr(callback), SWIGTYPE_p_void.getCPtr(user_data)); + return ret; + } + + public static switch_status_t switch_loadable_module_build_dynamic(string filename, SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t switch_module_load, SWIGTYPE_p_f_void__switch_status_t switch_module_runtime, SWIGTYPE_p_f_void__switch_status_t switch_module_shutdown, switch_bool_t runtime) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_build_dynamic(filename, SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t.getCPtr(switch_module_load), SWIGTYPE_p_f_void__switch_status_t.getCPtr(switch_module_runtime), SWIGTYPE_p_f_void__switch_status_t.getCPtr(switch_module_shutdown), (int)runtime); + return ret; + } + + public static switch_timer_interface switch_loadable_module_get_timer_interface(string name) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_timer_interface(name); + switch_timer_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_timer_interface(cPtr, false); + return ret; + } + + public static switch_application_interface switch_loadable_module_get_application_interface(string name) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_application_interface(name); + switch_application_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_application_interface(cPtr, false); + return ret; + } + + public static switch_api_interface switch_loadable_module_get_api_interface(string name) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_api_interface(name); + switch_api_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_api_interface(cPtr, false); + return ret; + } + + public static switch_file_interface switch_loadable_module_get_file_interface(string name) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_file_interface(name); + switch_file_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_file_interface(cPtr, false); + return ret; + } + + public static switch_speech_interface switch_loadable_module_get_speech_interface(string name) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_speech_interface(name); + switch_speech_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_speech_interface(cPtr, false); + return ret; + } + + public static switch_asr_interface switch_loadable_module_get_asr_interface(string name) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_asr_interface(name); + switch_asr_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_asr_interface(cPtr, false); + return ret; + } + + public static switch_directory_interface switch_loadable_module_get_directory_interface(string name) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_directory_interface(name); + switch_directory_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_directory_interface(cPtr, false); + return ret; + } + + public static switch_chat_interface switch_loadable_module_get_chat_interface(string name) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_chat_interface(name); + switch_chat_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_chat_interface(cPtr, false); + return ret; + } + + public static switch_say_interface switch_loadable_module_get_say_interface(string name) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_say_interface(name); + switch_say_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_say_interface(cPtr, false); + return ret; + } + + public static switch_management_interface switch_loadable_module_get_management_interface(string relative_oid) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_management_interface(relative_oid); + switch_management_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_management_interface(cPtr, false); + return ret; + } + + public static switch_limit_interface switch_loadable_module_get_limit_interface(string name) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_limit_interface(name); + switch_limit_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_limit_interface(cPtr, false); + return ret; + } + + public static int switch_loadable_module_get_codecs(SWIGTYPE_p_p_switch_codec_implementation array, int arraylen) { + int ret = freeswitchPINVOKE.switch_loadable_module_get_codecs(SWIGTYPE_p_p_switch_codec_implementation.getCPtr(array), arraylen); + return ret; + } + + public static int switch_loadable_module_get_codecs_sorted(SWIGTYPE_p_p_switch_codec_implementation array, int arraylen, ref string prefs, int preflen) { + int ret = freeswitchPINVOKE.switch_loadable_module_get_codecs_sorted(SWIGTYPE_p_p_switch_codec_implementation.getCPtr(array), arraylen, ref prefs, preflen); + return ret; + } + + public static switch_status_t switch_api_execute(string cmd, string arg, SWIGTYPE_p_switch_core_session session, switch_stream_handle stream) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_api_execute(cmd, arg, SWIGTYPE_p_switch_core_session.getCPtr(session), switch_stream_handle.getCPtr(stream)); + return ret; + } + + public static switch_status_t switch_loadable_module_load_module(string dir, string fname, switch_bool_t runtime, ref string err) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_load_module(dir, fname, (int)runtime, ref err); + return ret; + } + + public static switch_status_t switch_loadable_module_exists(string mod) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_exists(mod); + return ret; + } + + public static switch_status_t switch_loadable_module_unload_module(string dir, string fname, switch_bool_t force, ref string err) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_unload_module(dir, fname, (int)force, ref err); + return ret; + } + + public static uint switch_core_codec_next_id() { + uint ret = freeswitchPINVOKE.switch_core_codec_next_id(); + return ret; + } + + public static int switch_check_interval(uint rate, uint ptime) { + int ret = freeswitchPINVOKE.switch_check_interval(rate, ptime); + return ret; + } + + public static void switch_core_codec_add_implementation(SWIGTYPE_p_apr_pool_t pool, switch_codec_interface codec_interface, switch_codec_type_t codec_type, byte ianacode, string iananame, string fmtp, uint samples_per_second, uint actual_samples_per_second, int bits_per_second, int microseconds_per_packet, uint samples_per_packet, uint decoded_bytes_per_packet, uint encoded_bytes_per_packet, byte number_of_channels, int codec_frames_per_packet, SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t init, SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t encode, SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t decode, SWIGTYPE_p_f_p_switch_codec__switch_status_t destroy) { + freeswitchPINVOKE.switch_core_codec_add_implementation(SWIGTYPE_p_apr_pool_t.getCPtr(pool), switch_codec_interface.getCPtr(codec_interface), (int)codec_type, ianacode, iananame, fmtp, samples_per_second, actual_samples_per_second, bits_per_second, microseconds_per_packet, samples_per_packet, decoded_bytes_per_packet, encoded_bytes_per_packet, number_of_channels, codec_frames_per_packet, SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t.getCPtr(init), SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t.getCPtr(encode), SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t.getCPtr(decode), SWIGTYPE_p_f_p_switch_codec__switch_status_t.getCPtr(destroy)); + } + + public static switch_bool_t switch_core_codec_ready(switch_codec codec) { + switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_core_codec_ready(switch_codec.getCPtr(codec)); + return ret; + } + public static void switch_console_loop() { freeswitchPINVOKE.switch_console_loop(); } @@ -2761,11 +2918,44 @@ public class freeswitch { return ret; } + public static string switch_dow_int2str(int val) { + string ret = freeswitchPINVOKE.switch_dow_int2str(val); + return ret; + } + + public static int switch_dow_str2int(string exp) { + int ret = freeswitchPINVOKE.switch_dow_str2int(exp); + return ret; + } + + public static int switch_dow_cmp(string exp, int val) { + int ret = freeswitchPINVOKE.switch_dow_cmp(exp, val); + return ret; + } + public static int switch_number_cmp(string exp, int val) { int ret = freeswitchPINVOKE.switch_number_cmp(exp, val); return ret; } + public static int switch_tod_cmp(string exp, int val) { + int ret = freeswitchPINVOKE.switch_tod_cmp(exp, val); + return ret; + } + + public static int switch_fulldate_cmp(string exp, SWIGTYPE_p_switch_time_t ts) { + int ret = freeswitchPINVOKE.switch_fulldate_cmp(exp, SWIGTYPE_p_switch_time_t.getCPtr(ts)); + return ret; + } + + public static void switch_split_date(string exp, SWIGTYPE_p_int year, SWIGTYPE_p_int month, SWIGTYPE_p_int day) { + freeswitchPINVOKE.switch_split_date(exp, SWIGTYPE_p_int.getCPtr(year), SWIGTYPE_p_int.getCPtr(month), SWIGTYPE_p_int.getCPtr(day)); + } + + public static void switch_split_time(string exp, SWIGTYPE_p_int hour, SWIGTYPE_p_int min, SWIGTYPE_p_int sec) { + freeswitchPINVOKE.switch_split_time(exp, SWIGTYPE_p_int.getCPtr(hour), SWIGTYPE_p_int.getCPtr(min), SWIGTYPE_p_int.getCPtr(sec)); + } + public static int switch_split_user_domain(string arg0, ref string user, ref string domain) { int ret = freeswitchPINVOKE.switch_split_user_domain(arg0, ref user, ref domain); return ret; @@ -4595,6 +4785,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_xml_reload(ref string err) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_reload(ref err); + return ret; + } + public static switch_status_t switch_xml_destroy() { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_destroy(); return ret; @@ -5954,6 +6149,24 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_rtp_numbers_t")] public static extern void delete_switch_rtp_numbers_t(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtcp_numbers_t_packet_count_set")] + public static extern void switch_rtcp_numbers_t_packet_count_set(HandleRef jarg1, uint jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtcp_numbers_t_packet_count_get")] + public static extern uint switch_rtcp_numbers_t_packet_count_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtcp_numbers_t_octet_count_set")] + public static extern void switch_rtcp_numbers_t_octet_count_set(HandleRef jarg1, uint jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtcp_numbers_t_octet_count_get")] + public static extern uint switch_rtcp_numbers_t_octet_count_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_rtcp_numbers_t")] + public static extern IntPtr new_switch_rtcp_numbers_t(); + + [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_rtcp_numbers_t")] + public static extern void delete_switch_rtcp_numbers_t(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_inbound_set")] public static extern void switch_rtp_stats_t_inbound_set(HandleRef jarg1, HandleRef jarg2); @@ -5966,6 +6179,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_outbound_get")] public static extern IntPtr switch_rtp_stats_t_outbound_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_rtcp_set")] + public static extern void switch_rtp_stats_t_rtcp_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_rtcp_get")] + public static extern IntPtr switch_rtp_stats_t_rtcp_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_rtp_stats_t")] public static extern IntPtr new_switch_rtp_stats_t(); @@ -7706,6 +7925,207 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_in_thread")] public static extern int switch_core_session_in_thread(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_module_name_set")] + public static extern void switch_loadable_module_interface_module_name_set(HandleRef jarg1, string jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_module_name_get")] + public static extern string switch_loadable_module_interface_module_name_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_endpoint_interface_set")] + public static extern void switch_loadable_module_interface_endpoint_interface_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_endpoint_interface_get")] + public static extern IntPtr switch_loadable_module_interface_endpoint_interface_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_timer_interface_set")] + public static extern void switch_loadable_module_interface_timer_interface_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_timer_interface_get")] + public static extern IntPtr switch_loadable_module_interface_timer_interface_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_dialplan_interface_set")] + public static extern void switch_loadable_module_interface_dialplan_interface_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_dialplan_interface_get")] + public static extern IntPtr switch_loadable_module_interface_dialplan_interface_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_codec_interface_set")] + public static extern void switch_loadable_module_interface_codec_interface_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_codec_interface_get")] + public static extern IntPtr switch_loadable_module_interface_codec_interface_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_application_interface_set")] + public static extern void switch_loadable_module_interface_application_interface_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_application_interface_get")] + public static extern IntPtr switch_loadable_module_interface_application_interface_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_api_interface_set")] + public static extern void switch_loadable_module_interface_api_interface_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_api_interface_get")] + public static extern IntPtr switch_loadable_module_interface_api_interface_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_file_interface_set")] + public static extern void switch_loadable_module_interface_file_interface_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_file_interface_get")] + public static extern IntPtr switch_loadable_module_interface_file_interface_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_speech_interface_set")] + public static extern void switch_loadable_module_interface_speech_interface_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_speech_interface_get")] + public static extern IntPtr switch_loadable_module_interface_speech_interface_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_directory_interface_set")] + public static extern void switch_loadable_module_interface_directory_interface_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_directory_interface_get")] + public static extern IntPtr switch_loadable_module_interface_directory_interface_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_chat_interface_set")] + public static extern void switch_loadable_module_interface_chat_interface_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_chat_interface_get")] + public static extern IntPtr switch_loadable_module_interface_chat_interface_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_say_interface_set")] + public static extern void switch_loadable_module_interface_say_interface_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_say_interface_get")] + public static extern IntPtr switch_loadable_module_interface_say_interface_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_asr_interface_set")] + public static extern void switch_loadable_module_interface_asr_interface_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_asr_interface_get")] + public static extern IntPtr switch_loadable_module_interface_asr_interface_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_management_interface_set")] + public static extern void switch_loadable_module_interface_management_interface_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_management_interface_get")] + public static extern IntPtr switch_loadable_module_interface_management_interface_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_limit_interface_set")] + public static extern void switch_loadable_module_interface_limit_interface_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_limit_interface_get")] + public static extern IntPtr switch_loadable_module_interface_limit_interface_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_rwlock_set")] + public static extern void switch_loadable_module_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_rwlock_get")] + public static extern IntPtr switch_loadable_module_interface_rwlock_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_refs_set")] + public static extern void switch_loadable_module_interface_refs_set(HandleRef jarg1, int jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_refs_get")] + public static extern int switch_loadable_module_interface_refs_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_pool_set")] + public static extern void switch_loadable_module_interface_pool_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_pool_get")] + public static extern IntPtr switch_loadable_module_interface_pool_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_loadable_module_interface")] + public static extern IntPtr new_switch_loadable_module_interface(); + + [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_loadable_module_interface")] + public static extern void delete_switch_loadable_module_interface(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_init")] + public static extern int switch_loadable_module_init(int jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_shutdown")] + public static extern void switch_loadable_module_shutdown(); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_endpoint_interface")] + public static extern IntPtr switch_loadable_module_get_endpoint_interface(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_codec_interface")] + public static extern IntPtr switch_loadable_module_get_codec_interface(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_dialplan_interface")] + public static extern IntPtr switch_loadable_module_get_dialplan_interface(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_enumerate_available")] + public static extern int switch_loadable_module_enumerate_available(string jarg1, HandleRef jarg2, HandleRef jarg3); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_enumerate_loaded")] + public static extern int switch_loadable_module_enumerate_loaded(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_build_dynamic")] + public static extern int switch_loadable_module_build_dynamic(string jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, int jarg5); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_timer_interface")] + public static extern IntPtr switch_loadable_module_get_timer_interface(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_application_interface")] + public static extern IntPtr switch_loadable_module_get_application_interface(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_api_interface")] + public static extern IntPtr switch_loadable_module_get_api_interface(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_file_interface")] + public static extern IntPtr switch_loadable_module_get_file_interface(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_speech_interface")] + public static extern IntPtr switch_loadable_module_get_speech_interface(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_asr_interface")] + public static extern IntPtr switch_loadable_module_get_asr_interface(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_directory_interface")] + public static extern IntPtr switch_loadable_module_get_directory_interface(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_chat_interface")] + public static extern IntPtr switch_loadable_module_get_chat_interface(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_say_interface")] + public static extern IntPtr switch_loadable_module_get_say_interface(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_management_interface")] + public static extern IntPtr switch_loadable_module_get_management_interface(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_limit_interface")] + public static extern IntPtr switch_loadable_module_get_limit_interface(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_codecs")] + public static extern int switch_loadable_module_get_codecs(HandleRef jarg1, int jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_codecs_sorted")] + public static extern int switch_loadable_module_get_codecs_sorted(HandleRef jarg1, int jarg2, ref string jarg3, int jarg4); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_api_execute")] + public static extern int switch_api_execute(string jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_load_module")] + public static extern int switch_loadable_module_load_module(string jarg1, string jarg2, int jarg3, ref string jarg4); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_exists")] + public static extern int switch_loadable_module_exists(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_unload_module")] + public static extern int switch_loadable_module_unload_module(string jarg1, string jarg2, int jarg3, ref string jarg4); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_next_id")] + public static extern uint switch_core_codec_next_id(); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_check_interval")] + public static extern int switch_check_interval(uint jarg1, uint jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_add_implementation")] + public static extern void switch_core_codec_add_implementation(HandleRef jarg1, HandleRef jarg2, int jarg3, byte jarg4, string jarg5, string jarg6, uint jarg7, uint jarg8, int jarg9, int jarg10, uint jarg11, uint jarg12, uint jarg13, byte jarg14, int jarg15, HandleRef jarg16, HandleRef jarg17, HandleRef jarg18, HandleRef jarg19); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_ready")] + public static extern int switch_core_codec_ready(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CMD_CHUNK_LEN_get")] public static extern int SWITCH_CMD_CHUNK_LEN_get(); @@ -7988,9 +8408,30 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_network_list_validate_ip_token")] public static extern int switch_network_list_validate_ip_token(HandleRef jarg1, uint jarg2, ref string jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_dow_int2str")] + public static extern string switch_dow_int2str(int jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_dow_str2int")] + public static extern int switch_dow_str2int(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_dow_cmp")] + public static extern int switch_dow_cmp(string jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_number_cmp")] public static extern int switch_number_cmp(string jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_tod_cmp")] + public static extern int switch_tod_cmp(string jarg1, int jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_fulldate_cmp")] + public static extern int switch_fulldate_cmp(string jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_split_date")] + public static extern void switch_split_date(string jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_split_time")] + public static extern void switch_split_time(string jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4); + [DllImport("mod_managed", EntryPoint="CSharp_switch_split_user_domain")] public static extern int switch_split_user_domain(string jarg1, ref string jarg2, ref string jarg3); @@ -12008,6 +12449,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_init")] public static extern int switch_xml_init(HandleRef jarg1, ref string jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_reload")] + public static extern int switch_xml_reload(ref string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_destroy")] public static extern int switch_xml_destroy(); @@ -15497,6 +15941,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_f_p_void_p_q_const__char__int { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_void_p_q_const__char__int(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_void_p_q_const__char__int() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_f_p_void_p_q_const__char__int obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_f_p_void__void { private HandleRef swigCPtr; @@ -15977,6 +16451,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_p_switch_codec_implementation { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_codec_implementation(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_codec_implementation() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_codec_implementation obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_p_switch_console_callback_match { private HandleRef swigCPtr; @@ -17207,36 +17711,6 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; -public class SWIGTYPE_p_switch_loadable_module_interface { - private HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_loadable_module_interface(IntPtr cPtr, bool futureUse) { - swigCPtr = new HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_loadable_module_interface() { - swigCPtr = new HandleRef(null, IntPtr.Zero); - } - - internal static HandleRef getCPtr(SWIGTYPE_p_switch_loadable_module_interface obj) { - return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; - } -} - -} -/* ---------------------------------------------------------------------------- - * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.35 - * - * Do not make changes to this file unless you know what you are doing--modify - * the SWIG interface file instead. - * ----------------------------------------------------------------------------- */ - -namespace FreeSWITCH.Native { - -using System; -using System.Runtime.InteropServices; - public class SWIGTYPE_p_switch_media_bug { private HandleRef swigCPtr; @@ -18019,13 +18493,13 @@ public class switch_api_interface : IDisposable { } } - public SWIGTYPE_p_switch_loadable_module_interface parent { + public switch_loadable_module_interface parent { set { - freeswitchPINVOKE.switch_api_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value)); + freeswitchPINVOKE.switch_api_interface_parent_set(swigCPtr, switch_loadable_module_interface.getCPtr(value)); } get { IntPtr cPtr = freeswitchPINVOKE.switch_api_interface_parent_get(swigCPtr); - SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); return ret; } } @@ -18199,13 +18673,13 @@ public class switch_application_interface : IDisposable { } } - public SWIGTYPE_p_switch_loadable_module_interface parent { + public switch_loadable_module_interface parent { set { - freeswitchPINVOKE.switch_application_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value)); + freeswitchPINVOKE.switch_application_interface_parent_set(swigCPtr, switch_loadable_module_interface.getCPtr(value)); } get { IntPtr cPtr = freeswitchPINVOKE.switch_application_interface_parent_get(swigCPtr); - SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); return ret; } } @@ -18691,13 +19165,13 @@ public class switch_asr_interface : IDisposable { } } - public SWIGTYPE_p_switch_loadable_module_interface parent { + public switch_loadable_module_interface parent { set { - freeswitchPINVOKE.switch_asr_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value)); + freeswitchPINVOKE.switch_asr_interface_parent_set(swigCPtr, switch_loadable_module_interface.getCPtr(value)); } get { IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_parent_get(swigCPtr); - SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); return ret; } } @@ -20668,13 +21142,13 @@ public class switch_chat_interface : IDisposable { } } - public SWIGTYPE_p_switch_loadable_module_interface parent { + public switch_loadable_module_interface parent { set { - freeswitchPINVOKE.switch_chat_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value)); + freeswitchPINVOKE.switch_chat_interface_parent_set(swigCPtr, switch_loadable_module_interface.getCPtr(value)); } get { IntPtr cPtr = freeswitchPINVOKE.switch_chat_interface_parent_get(swigCPtr); - SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); return ret; } } @@ -21239,13 +21713,13 @@ public class switch_codec_interface : IDisposable { } } - public SWIGTYPE_p_switch_loadable_module_interface parent { + public switch_loadable_module_interface parent { set { - freeswitchPINVOKE.switch_codec_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value)); + freeswitchPINVOKE.switch_codec_interface_parent_set(swigCPtr, switch_loadable_module_interface.getCPtr(value)); } get { IntPtr cPtr = freeswitchPINVOKE.switch_codec_interface_parent_get(swigCPtr); - SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); return ret; } } @@ -21812,7 +22286,8 @@ namespace FreeSWITCH.Native { SCF_USE_CLOCK_RT = (1 << 10), SCF_VERBOSE_EVENTS = (1 << 11), SCF_USE_WIN32_MONOTONIC = (1 << 12), - SCF_AUTO_SCHEMAS = (1 << 13) + SCF_AUTO_SCHEMAS = (1 << 13), + SCF_MINIMAL = (1 << 14) } } @@ -22432,13 +22907,13 @@ public class switch_dialplan_interface : IDisposable { } } - public SWIGTYPE_p_switch_loadable_module_interface parent { + public switch_loadable_module_interface parent { set { - freeswitchPINVOKE.switch_dialplan_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value)); + freeswitchPINVOKE.switch_dialplan_interface_parent_set(swigCPtr, switch_loadable_module_interface.getCPtr(value)); } get { IntPtr cPtr = freeswitchPINVOKE.switch_dialplan_interface_parent_get(swigCPtr); - SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); return ret; } } @@ -22880,13 +23355,13 @@ public class switch_directory_interface : IDisposable { } } - public SWIGTYPE_p_switch_loadable_module_interface parent { + public switch_loadable_module_interface parent { set { - freeswitchPINVOKE.switch_directory_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value)); + freeswitchPINVOKE.switch_directory_interface_parent_set(swigCPtr, switch_loadable_module_interface.getCPtr(value)); } get { IntPtr cPtr = freeswitchPINVOKE.switch_directory_interface_parent_get(swigCPtr); - SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); return ret; } } @@ -23125,13 +23600,13 @@ public class switch_endpoint_interface : IDisposable { } } - public SWIGTYPE_p_switch_loadable_module_interface parent { + public switch_loadable_module_interface parent { set { - freeswitchPINVOKE.switch_endpoint_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value)); + freeswitchPINVOKE.switch_endpoint_interface_parent_set(swigCPtr, switch_loadable_module_interface.getCPtr(value)); } get { IntPtr cPtr = freeswitchPINVOKE.switch_endpoint_interface_parent_get(swigCPtr); - SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); return ret; } } @@ -24190,13 +24665,13 @@ public class switch_file_interface : IDisposable { } } - public SWIGTYPE_p_switch_loadable_module_interface parent { + public switch_loadable_module_interface parent { set { - freeswitchPINVOKE.switch_file_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value)); + freeswitchPINVOKE.switch_file_interface_parent_set(swigCPtr, switch_loadable_module_interface.getCPtr(value)); } get { IntPtr cPtr = freeswitchPINVOKE.switch_file_interface_parent_get(swigCPtr); - SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); return ret; } } @@ -26004,13 +26479,13 @@ public class switch_limit_interface : IDisposable { } } - public SWIGTYPE_p_switch_loadable_module_interface parent { + public switch_loadable_module_interface parent { set { - freeswitchPINVOKE.switch_limit_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value)); + freeswitchPINVOKE.switch_limit_interface_parent_set(swigCPtr, switch_loadable_module_interface.getCPtr(value)); } get { IntPtr cPtr = freeswitchPINVOKE.switch_limit_interface_parent_get(swigCPtr); - SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); return ret; } } @@ -26142,6 +26617,249 @@ public class switch_loadable_module_function_table_t : IDisposable { namespace FreeSWITCH.Native { +using System; +using System.Runtime.InteropServices; + +public class switch_loadable_module_interface : IDisposable { + private HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal switch_loadable_module_interface(IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new HandleRef(this, cPtr); + } + + internal static HandleRef getCPtr(switch_loadable_module_interface obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } + + ~switch_loadable_module_interface() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_switch_loadable_module_interface(swigCPtr); + } + swigCPtr = new HandleRef(null, IntPtr.Zero); + GC.SuppressFinalize(this); + } + } + + public string module_name { + set { + freeswitchPINVOKE.switch_loadable_module_interface_module_name_set(swigCPtr, value); + } + get { + string ret = freeswitchPINVOKE.switch_loadable_module_interface_module_name_get(swigCPtr); + return ret; + } + } + + public switch_endpoint_interface endpoint_interface { + set { + freeswitchPINVOKE.switch_loadable_module_interface_endpoint_interface_set(swigCPtr, switch_endpoint_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_endpoint_interface_get(swigCPtr); + switch_endpoint_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_endpoint_interface(cPtr, false); + return ret; + } + } + + public switch_timer_interface timer_interface { + set { + freeswitchPINVOKE.switch_loadable_module_interface_timer_interface_set(swigCPtr, switch_timer_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_timer_interface_get(swigCPtr); + switch_timer_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_timer_interface(cPtr, false); + return ret; + } + } + + public switch_dialplan_interface dialplan_interface { + set { + freeswitchPINVOKE.switch_loadable_module_interface_dialplan_interface_set(swigCPtr, switch_dialplan_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_dialplan_interface_get(swigCPtr); + switch_dialplan_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_dialplan_interface(cPtr, false); + return ret; + } + } + + public switch_codec_interface codec_interface { + set { + freeswitchPINVOKE.switch_loadable_module_interface_codec_interface_set(swigCPtr, switch_codec_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_codec_interface_get(swigCPtr); + switch_codec_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_codec_interface(cPtr, false); + return ret; + } + } + + public switch_application_interface application_interface { + set { + freeswitchPINVOKE.switch_loadable_module_interface_application_interface_set(swigCPtr, switch_application_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_application_interface_get(swigCPtr); + switch_application_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_application_interface(cPtr, false); + return ret; + } + } + + public switch_api_interface api_interface { + set { + freeswitchPINVOKE.switch_loadable_module_interface_api_interface_set(swigCPtr, switch_api_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_api_interface_get(swigCPtr); + switch_api_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_api_interface(cPtr, false); + return ret; + } + } + + public switch_file_interface file_interface { + set { + freeswitchPINVOKE.switch_loadable_module_interface_file_interface_set(swigCPtr, switch_file_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_file_interface_get(swigCPtr); + switch_file_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_file_interface(cPtr, false); + return ret; + } + } + + public switch_speech_interface speech_interface { + set { + freeswitchPINVOKE.switch_loadable_module_interface_speech_interface_set(swigCPtr, switch_speech_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_speech_interface_get(swigCPtr); + switch_speech_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_speech_interface(cPtr, false); + return ret; + } + } + + public switch_directory_interface directory_interface { + set { + freeswitchPINVOKE.switch_loadable_module_interface_directory_interface_set(swigCPtr, switch_directory_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_directory_interface_get(swigCPtr); + switch_directory_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_directory_interface(cPtr, false); + return ret; + } + } + + public switch_chat_interface chat_interface { + set { + freeswitchPINVOKE.switch_loadable_module_interface_chat_interface_set(swigCPtr, switch_chat_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_chat_interface_get(swigCPtr); + switch_chat_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_chat_interface(cPtr, false); + return ret; + } + } + + public switch_say_interface say_interface { + set { + freeswitchPINVOKE.switch_loadable_module_interface_say_interface_set(swigCPtr, switch_say_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_say_interface_get(swigCPtr); + switch_say_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_say_interface(cPtr, false); + return ret; + } + } + + public switch_asr_interface asr_interface { + set { + freeswitchPINVOKE.switch_loadable_module_interface_asr_interface_set(swigCPtr, switch_asr_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_asr_interface_get(swigCPtr); + switch_asr_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_asr_interface(cPtr, false); + return ret; + } + } + + public switch_management_interface management_interface { + set { + freeswitchPINVOKE.switch_loadable_module_interface_management_interface_set(swigCPtr, switch_management_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_management_interface_get(swigCPtr); + switch_management_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_management_interface(cPtr, false); + return ret; + } + } + + public switch_limit_interface limit_interface { + set { + freeswitchPINVOKE.switch_loadable_module_interface_limit_interface_set(swigCPtr, switch_limit_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_limit_interface_get(swigCPtr); + switch_limit_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_limit_interface(cPtr, false); + return ret; + } + } + + public SWIGTYPE_p_switch_thread_rwlock_t rwlock { + set { + freeswitchPINVOKE.switch_loadable_module_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_rwlock_get(swigCPtr); + SWIGTYPE_p_switch_thread_rwlock_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_thread_rwlock_t(cPtr, false); + return ret; + } + } + + public int refs { + set { + freeswitchPINVOKE.switch_loadable_module_interface_refs_set(swigCPtr, value); + } + get { + int ret = freeswitchPINVOKE.switch_loadable_module_interface_refs_get(swigCPtr); + return ret; + } + } + + public SWIGTYPE_p_apr_pool_t pool { + set { + freeswitchPINVOKE.switch_loadable_module_interface_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_pool_get(swigCPtr); + SWIGTYPE_p_apr_pool_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false); + return ret; + } + } + + public switch_loadable_module_interface() : this(freeswitchPINVOKE.new_switch_loadable_module_interface(), true) { + } + +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + public enum switch_log_level_t { SWITCH_LOG_DEBUG10 = 110, SWITCH_LOG_DEBUG9 = 109, @@ -26415,13 +27133,13 @@ public class switch_management_interface : IDisposable { } } - public SWIGTYPE_p_switch_loadable_module_interface parent { + public switch_loadable_module_interface parent { set { - freeswitchPINVOKE.switch_management_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value)); + freeswitchPINVOKE.switch_management_interface_parent_set(swigCPtr, switch_loadable_module_interface.getCPtr(value)); } get { IntPtr cPtr = freeswitchPINVOKE.switch_management_interface_parent_get(swigCPtr); - SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); return ret; } } @@ -26713,6 +27431,73 @@ public class switch_rtcp_hdr_t : IDisposable { namespace FreeSWITCH.Native { +using System; +using System.Runtime.InteropServices; + +public class switch_rtcp_numbers_t : IDisposable { + private HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal switch_rtcp_numbers_t(IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new HandleRef(this, cPtr); + } + + internal static HandleRef getCPtr(switch_rtcp_numbers_t obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } + + ~switch_rtcp_numbers_t() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_switch_rtcp_numbers_t(swigCPtr); + } + swigCPtr = new HandleRef(null, IntPtr.Zero); + GC.SuppressFinalize(this); + } + } + + public uint packet_count { + set { + freeswitchPINVOKE.switch_rtcp_numbers_t_packet_count_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.switch_rtcp_numbers_t_packet_count_get(swigCPtr); + return ret; + } + } + + public uint octet_count { + set { + freeswitchPINVOKE.switch_rtcp_numbers_t_octet_count_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.switch_rtcp_numbers_t_octet_count_get(swigCPtr); + return ret; + } + } + + public switch_rtcp_numbers_t() : this(freeswitchPINVOKE.new_switch_rtcp_numbers_t(), true) { + } + +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + public enum switch_rtp_bug_flag_t { RTP_BUG_NONE = 0, RTP_BUG_CISCO_SKIP_MARK_BIT_2833 = (1 << 0), @@ -27275,6 +28060,17 @@ public class switch_rtp_stats_t : IDisposable { } } + public switch_rtcp_numbers_t rtcp { + set { + freeswitchPINVOKE.switch_rtp_stats_t_rtcp_set(swigCPtr, switch_rtcp_numbers_t.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_rtp_stats_t_rtcp_get(swigCPtr); + switch_rtcp_numbers_t ret = (cPtr == IntPtr.Zero) ? null : new switch_rtcp_numbers_t(cPtr, false); + return ret; + } + } + public switch_rtp_stats_t() : this(freeswitchPINVOKE.new_switch_rtp_stats_t(), true) { } @@ -27469,13 +28265,13 @@ public class switch_say_interface : IDisposable { } } - public SWIGTYPE_p_switch_loadable_module_interface parent { + public switch_loadable_module_interface parent { set { - freeswitchPINVOKE.switch_say_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value)); + freeswitchPINVOKE.switch_say_interface_parent_set(swigCPtr, switch_loadable_module_interface.getCPtr(value)); } get { IntPtr cPtr = freeswitchPINVOKE.switch_say_interface_parent_get(swigCPtr); - SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); return ret; } } @@ -28150,13 +28946,13 @@ public class switch_speech_interface : IDisposable { } } - public SWIGTYPE_p_switch_loadable_module_interface parent { + public switch_loadable_module_interface parent { set { - freeswitchPINVOKE.switch_speech_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value)); + freeswitchPINVOKE.switch_speech_interface_parent_set(swigCPtr, switch_loadable_module_interface.getCPtr(value)); } get { IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_parent_get(swigCPtr); - SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); return ret; } } @@ -29153,13 +29949,13 @@ public class switch_timer_interface : IDisposable { } } - public SWIGTYPE_p_switch_loadable_module_interface parent { + public switch_loadable_module_interface parent { set { - freeswitchPINVOKE.switch_timer_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value)); + freeswitchPINVOKE.switch_timer_interface_parent_set(swigCPtr, switch_loadable_module_interface.getCPtr(value)); } get { IntPtr cPtr = freeswitchPINVOKE.switch_timer_interface_parent_get(swigCPtr); - SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); return ret; } } commit ff37e9de9ae625597041ca13dd36935976a5cf4c Author: Brian West <brian@freeswitch.org> Date: Fri Sep 17 08:58:39 2010 -0500 MODAPP-456 diff --git a/src/include/switch_config.h b/src/include/switch_config.h index 2281a9b..4115564 100644 --- a/src/include/switch_config.h +++ b/src/include/switch_config.h @@ -38,7 +38,7 @@ /** * @defgroup config Config File Parser * @ingroup core1 - * This module implements a basic interface and file format parser it may be depricated in favor of database entries + * This module implements a basic interface and file format parser it may be deprecated in favor of database entries * or expanded to tie to external handlers in the future as necessary. * <pre> * diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index d87e820..febb7f6 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -1181,7 +1181,7 @@ SWITCH_STANDARD_API(reload_acl_function) const char *err; if (cmd && !strcasecmp(cmd, "reloadxml")) { - stream->write_function(stream, "This option is depricated, we now always reloadxml.\n"); + stream->write_function(stream, "This option is deprecated, we now always reloadxml.\n"); } if (switch_xml_reload(&err) == SWITCH_STATUS_SUCCESS) { commit 59ec8ced59266a852c3b7bd5a6dce071294c5fb1 Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Fri Sep 17 00:26:27 2010 -0400 switch_utils: Add day of week 3 letter initial usage in "wday" field in the dialplan. Example : mon-fri. Using number as before is still supported. Several public switch function are available. diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index a52676d..4dc7ed7 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -680,6 +680,9 @@ SWITCH_DECLARE(switch_bool_t) switch_network_list_validate_ip_token(switch_netwo SWITCH_DECLARE(int) switch_inet_pton(int af, const char *src, void *dst); +SWITCH_DECLARE(const char *) switch_dow_int2str(int val); +SWITCH_DECLARE(int) switch_dow_str2int(const char *exp); +SWITCH_DECLARE(int) switch_dow_cmp(const char *exp, int val); SWITCH_DECLARE(int) switch_number_cmp(const char *exp, int val); SWITCH_DECLARE(int) switch_tod_cmp(const char *exp, int val); diff --git a/src/switch_utils.c b/src/switch_utils.c index 6df5159..b887904 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -2466,6 +2466,82 @@ SWITCH_DECLARE(int) switch_isxdigit(int c) return (c < 0 ? 0 : c > 255 ? 0 : ((_switch_ctype_ + 1)[(unsigned char) c] & (_N | _X))); } +static const char *DOW[] = { + "sat", + "sun", + "mon", + "tue", + "wed", + "thu", + "fri", + "sat", + "sun", + NULL +}; + +SWITCH_DECLARE(const char *) switch_dow_int2str(int val) { + if (val >= sizeof(DOW) / sizeof (const char*)) { + return NULL; + } + return DOW[val]; +} + +SWITCH_DECLARE(int) switch_dow_str2int(const char *exp) { + int ret = -1; + int x = -1; + for (x = 0;; x++) { + if (!DOW[x]) { + break; + } + + if (!strcasecmp(DOW[x], exp)) { + ret = x; + break; + } + } + return ret; +} + +SWITCH_DECLARE(int) switch_dow_cmp(const char *exp, int val) +{ + char *dup = strdup(exp); + char *p_start; + char *p_end; + int ret = 0; + int start, end; + + switch_assert(dup); + + p_start = dup; + + if ((p_end=strchr(dup, '-'))) { + *p_end++ = '\0'; + } else { + p_end = p_start; + } + if (strlen(p_start) == 3) { + start = switch_dow_str2int(p_start); + } else { + start = atol(p_start); + } + if (strlen(p_end) == 3) { + end = switch_dow_str2int(p_end); + } else { + end = atol(p_end); + } + /* Following used for this example : mon-sat = 2-0, so we need to make 0(sat) + 7 */ + if (end < start) { + end += 7; + } + if (start != -1 && end != -1 && val >= start && val <= end) { + ret = 1; + } + + switch_safe_free(dup); + + return ret; +} + SWITCH_DECLARE(int) switch_number_cmp(const char *exp, int val) { char *p; diff --git a/src/switch_xml.c b/src/switch_xml.c index 3e46fc0..95b82cb 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -2733,9 +2733,9 @@ SWITCH_DECLARE(int) switch_xml_std_datetime_check(switch_xml_t xcond) { if (time_match && xwday) { int test = tm.tm_wday + 1; - time_match = switch_number_cmp(xwday, test); + time_match = switch_dow_cmp(xwday, test); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, - "XML DateTime Check: day of week[%d] =~ %s (%s)\n", test, xwday, time_match ? "PASS" : "FAIL"); + "XML DateTime Check: day of week[%s] =~ %s (%s)\n", switch_dow_int2str(test), xwday, time_match ? "PASS" : "FAIL"); } if (time_match && xhour) { int test = tm.tm_hour; commit c9fcce0869c37b4248ecf56944aefed4fa3ee3e5 Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Fri Sep 17 00:21:19 2010 -0400 switch_utils: Add date time range string compare function switch_fulldate_cmp. It usable in XML dialplan with date-time. String format example : 2009-10-10 14:33:22~2009-11-10 17:32:31. diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 4eac906..a52676d 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -683,6 +683,10 @@ SWITCH_DECLARE(int) switch_inet_pton(int af, const char *src, void *dst); SWITCH_DECLARE(int) switch_number_cmp(const char *exp, int val); SWITCH_DECLARE(int) switch_tod_cmp(const char *exp, int val); +SWITCH_DECLARE(int) switch_fulldate_cmp(const char *exp, switch_time_t *ts); +SWITCH_DECLARE(void) switch_split_date(const char *exp, int *year, int *month, int *day); +SWITCH_DECLARE(void) switch_split_time(const char *exp, int *hour, int *min, int *sec); + /*! \brief Split a user@domain string as user and domain \param in the input string diff --git a/src/switch_utils.c b/src/switch_utils.c index cb4679d..6df5159 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -2090,6 +2090,137 @@ SWITCH_DECLARE(char *) switch_url_decode(char *s) return s; } +SWITCH_DECLARE(void) switch_split_time(const char *exp, int *hour, int *min, int *sec) +{ + char *dup = strdup(exp); + char *shour = NULL; + char *smin = NULL; + char *ssec = NULL; + + switch_assert(dup); + + shour = dup; + if ((smin=strchr(dup, ':'))) { + *smin++ = '\0'; + if ((ssec=strchr(smin, ':'))) { + *ssec++ = '\0'; + } else { + ssec = "00"; + } + if (hour && shour) { + *hour = atol(shour); + } + if (min && smin) { + *min = atol(smin); + } + if (sec && ssec) { + *sec = atol(ssec); + } + + } + switch_safe_free(dup); + return; + +} + +SWITCH_DECLARE(void) switch_split_date(const char *exp, int *year, int *month, int *day) +{ + char *dup = strdup(exp); + char *syear = NULL; + char *smonth = NULL; + char *sday = NULL; + + switch_assert(dup); + + syear = dup; + if ((smonth=strchr(dup, '-'))) { + *smonth++ = '\0'; + if ((sday=strchr(smonth, '-'))) { + *sday++ = '\0'; + if (year && syear) { + *year = atol(syear); + } + if (month && smonth) { + *month = atol(smonth); + } + if (day && sday) { + *day = atol(sday); + } + } + } + switch_safe_free(dup); + return; + +} + +/* Ex exp value "2009-10-10 14:33:22~2009-11-10 17:32:31" */ +SWITCH_DECLARE(int) switch_fulldate_cmp(const char *exp, switch_time_t *ts) +{ + char *dup = strdup(exp); + char *sStart; + char *sEnd; + char *sDate; + char *sTime; + switch_time_t tsStart; + switch_time_t tsEnd; + + switch_assert(dup); + + sStart = dup; + if ((sEnd=strchr(dup, '~'))) { + *sEnd++ = '\0'; + sDate = sStart; + if ((sTime=strchr(sStart, ' '))) { + struct tm tmTmp; + int year, month, day; + int hour, min, sec; + + *sTime++ = '\0'; + + switch_split_date(sDate, &year, &month, &day); + switch_split_time(sTime, &hour, &min, &sec); + tmTmp.tm_year = year; + tmTmp.tm_mon = month; + tmTmp.tm_mday = day; + + tmTmp.tm_hour = hour; + tmTmp.tm_min = min; + tmTmp.tm_sec = sec; + tmTmp.tm_isdst = 0; + tsStart = mktime(&tmTmp); + + sDate = sEnd; + if ((sTime=strchr(sEnd, ' '))) { + struct tm tmTmp; + int year, month, day; + int hour, min, sec; + + *sTime++ = '\0'; + + switch_split_date(sDate, &year, &month, &day); + switch_split_time(sTime, &hour, &min, &sec); + tmTmp.tm_year = year; + tmTmp.tm_mon = month; + tmTmp.tm_mday = day; + + tmTmp.tm_hour = hour; + tmTmp.tm_min = min; + tmTmp.tm_sec = sec; + tmTmp.tm_isdst = 0; + tsEnd = mktime(&tmTmp); + + if (tsStart <= *ts && tsEnd > *ts) { + switch_safe_free(dup); + return 1; + } + } + } + } + switch_safe_free(dup); + return 0; + +} + /* Written by Marc Espie, public domain */ #define SWITCH_CTYPE_NUM_CHARS 256 diff --git a/src/switch_xml.c b/src/switch_xml.c index 77c3a5e..3e46fc0 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -2652,6 +2652,7 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_cut(switch_xml_t xml) SWITCH_DECLARE(int) switch_xml_std_datetime_check(switch_xml_t xcond) { + const char *xdt = switch_xml_attr(xcond, "date-time"); const char *xyear = switch_xml_attr(xcond, "year"); const char *xyday = switch_xml_attr(xcond, "yday"); const char *xmon = switch_xml_attr(xcond, "mon"); @@ -2670,6 +2671,15 @@ SWITCH_DECLARE(int) switch_xml_std_datetime_check(switch_xml_t xcond) { switch_time_exp_lt(&tm, ts); + if (time_match && xdt) { + char tmpdate[80]; + switch_size_t retsize; + switch_strftime(tmpdate, &retsize, sizeof(tmpdate), "%Y-%m-%d %H:%M:%S", &tm); + time_match = switch_fulldate_cmp(xdt, &ts); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, + "XML DateTime Check: date time[%s] =~ %s (%s)\n", tmpdate, xdt, time_match ? "PASS" : "FAIL"); + } + if (time_match && xyear) { int test = tm.tm_year + 1900; time_match = switch_number_cmp(xyear, test); commit 4ab8fa13e126ef3beeba88fffd4a5a0e81f069a8 Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Fri Sep 17 00:07:30 2010 -0400 switch_utils: Add time of day string compare function switch_tod_cmp. It usable in XML dialplan with time-of-day. String format is hh:mm:ss you can define a range like this : 09:00-17:00 (Second are not optional) diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index f24cee5..4eac906 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -681,6 +681,7 @@ SWITCH_DECLARE(switch_bool_t) switch_network_list_validate_ip_token(switch_netwo SWITCH_DECLARE(int) switch_inet_pton(int af, const char *src, void *dst); SWITCH_DECLARE(int) switch_number_cmp(const char *exp, int val); +SWITCH_DECLARE(int) switch_tod_cmp(const char *exp, int val); /*! \brief Split a user@domain string as user and domain diff --git a/src/switch_utils.c b/src/switch_utils.c index 91b78f7..cb4679d 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -2375,6 +2375,49 @@ SWITCH_DECLARE(int) switch_number_cmp(const char *exp, int val) } +SWITCH_DECLARE(int) switch_tod_cmp(const char *exp, int val) +{ + char *dup = strdup(exp); + char *minh; + char *minm; + char *mins; + char *maxh; + char *maxm; + char *maxs; + + switch_assert(dup); + + minh = dup; + if ((minm=strchr(dup, ':'))) { + *minm++ = '\0'; + if ((maxh=strchr(minm, '-'))) { + if ((maxm=strchr(maxh, ':'))) { + *maxh++ = '\0'; + *maxm++ = '\0'; + /* Check if min/max seconds are present */ + if ((mins=strchr(minm, ':'))) { + *mins++ = '\0'; + } else { + mins = "00"; + } + if ((maxs=strchr(maxm, ':'))) { + *maxs++ = '\0'; + } else { + maxs = "00"; + } + + if (val >= (atol(minh) * 60 * 60) + (atol(minm) * 60) + atol(mins) && val < (atol(maxh) * 60 * 60) + (atol(maxm) * 60) + atol(maxs)) { + switch_safe_free(dup); + return 1; + } + } + } + } + switch_safe_free(dup); + return 0; + +} + SWITCH_DECLARE(int) switch_split_user_domain(char *in, char **user, char **domain) { char *p = NULL, *h = NULL, *u = in; diff --git a/src/switch_xml.c b/src/switch_xml.c index 6889789..77c3a5e 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -2662,6 +2662,7 @@ SWITCH_DECLARE(int) switch_xml_std_datetime_check(switch_xml_t xcond) { const char *xhour = switch_xml_attr(xcond, "hour"); const char *xminute = switch_xml_attr(xcond, "minute"); const char *xminday = switch_xml_attr(xcond, "minute-of-day"); + const char *xtod = switch_xml_attr(xcond, "time-of-day"); switch_time_t ts = switch_micro_time_now(); int time_match = -1; @@ -2747,6 +2748,15 @@ SWITCH_DECLARE(int) switch_xml_std_datetime_check(switch_xml_t xcond) { "XML DateTime Check: minute of day[%d] =~ %s (%s)\n", test, xminday, time_match ? "PASS" : "FAIL"); } + if (time_match && xtod) { + int test = (tm.tm_hour * 60 * 60) + (tm.tm_min * 60) + tm.tm_sec; + char tmpdate[10]; + switch_snprintf(tmpdate, 6, "%d:%d:%d", tm.tm_hour, tm.tm_min, tm.tm_sec); + time_match = switch_tod_cmp(xtod, test); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG9, + "XML DateTime Check: time of day[%s] =~ %s (%s)\n", tmpdate, xtod, time_match ? "PASS" : "FAIL"); + } + return time_match; } commit 7112c94e295833779060c86375ba4bd3daee394a Merge: 765cd2b 6068167 Author: Michael S Collins <msc@freeswitch.org> Date: Thu Sep 16 16:26:46 2010 -0700 Merge branch 'master' of git://git.freeswitch.org/freeswitch commit 765cd2b7e21588bb0c95ced9fcd1445b4f4bcf0b Author: Michael S Collins <msc@freeswitch.org> Date: Thu Sep 16 16:25:16 2010 -0700 Fix typos diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 5128e3b..dc1995f 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -99,7 +99,7 @@ typedef enum { CALLER_CONTROL_DEAF_MUTE, CALLER_CONTROL_ENERGY_UP, CALLER_CONTROL_ENERGY_EQU_CONF, - CALLER_CONTROL_ENERGEY_DN, + CALLER_CONTROL_ENERGY_DN, CALLER_CONTROL_VOL_TALK_UP, CALLER_CONTROL_VOL_TALK_ZERO, CALLER_CONTROL_VOL_TALK_DN, @@ -121,7 +121,7 @@ typedef struct conference_member conference_member_t; struct call_list { char *string; - int itteration; + int iteration; struct call_list *next; }; typedef struct call_list call_list_t; @@ -717,7 +717,7 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe if (call_list) { char saymsg[1024]; - switch_snprintf(saymsg, sizeof(saymsg), "Auto Calling %d parties", call_list->itteration); + switch_snprintf(saymsg, sizeof(saymsg), "Auto Calling %d parties", call_list->iteration); conference_member_say(member, saymsg, 0); } else { if (zstr(conference->special_announce)) { @@ -2298,7 +2298,7 @@ static caller_control_fn_table_t ccfntbl[] = { {"deaf mute", "*", CALLER_CONTROL_DEAF_MUTE, conference_loop_fn_deafmute_toggle}, {"energy up", "9", CALLER_CONTROL_ENERGY_UP, conference_loop_fn_energy_up}, {"energy equ", "8", CALLER_CONTROL_ENERGY_EQU_CONF, conference_loop_fn_energy_equ_conf}, - {"energy dn", "7", CALLER_CONTROL_ENERGEY_DN, conference_loop_fn_energy_dn}, + {"energy dn", "7", CALLER_CONTROL_ENERGY_DN, conference_loop_fn_energy_dn}, {"vol talk up", "3", CALLER_CONTROL_VOL_TALK_UP, conference_loop_fn_volume_talk_up}, {"vol talk zero", "2", CALLER_CONTROL_VOL_TALK_ZERO, conference_loop_fn_volume_talk_zero}, {"vol talk dn", "1", CALLER_CONTROL_VOL_TALK_DN, conference_loop_fn_volume_talk_dn}, @@ -5199,9 +5199,9 @@ SWITCH_STANDARD_APP(conference_auto_function) np->string = switch_core_session_strdup(session, data); if (call_list) { np->next = call_list; - np->itteration = call_list->itteration + 1; + np->iteration = call_list->iteration + 1; } else { - np->itteration = 1; + np->iteration = 1; } call_list = np; } commit 6068167208d99a6e0bd54332758b9f4c7a77661b Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Sep 16 18:17:52 2010 -0500 explicit reloadxml in sofia as well diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 3d330da..68c99f1 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -2957,7 +2957,6 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t sofia_profile_t *profile = NULL; char *profile_name = argv[0]; const char *err; - switch_xml_t xml_root; if (argc < 2) { stream->write_function(stream, "Invalid Args!\n"); @@ -2965,12 +2964,10 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t } if (!strcasecmp(argv[1], "start")) { - if (argc > 2 && !strcasecmp(argv[2], "reloadxml")) { - if ((xml_root = switch_xml_open_root(1, &err))) { - switch_xml_free(xml_root); - } - stream->write_function(stream, "Reload XML [%s]\n", err); - } + + switch_xml_reload(&err); + stream->write_function(stream, "Reload XML [%s]\n", err); + if (config_sofia(1, argv[0]) == SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "%s started successfully\n", argv[0]); } else { @@ -3045,12 +3042,8 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t if (!strcasecmp(argv[1], "rescan")) { - if (argc > 2 && !strcasecmp(argv[2], "reloadxml")) { - if ((xml_root = switch_xml_open_root(1, &err))) { - switch_xml_free(xml_root); - } - stream->write_function(stream, "Reload XML [%s]\n", err); - } + switch_xml_reload(&err); + stream->write_function(stream, "Reload XML [%s]\n", err); if (reconfig_sofia(profile) == SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "+OK scan complete\n"); @@ -3147,12 +3140,8 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t profile->name, rsec, remain, remain == 1 ? "" : "s"); } else { - if (argc > 2 && !strcasecmp(argv[2], "reloadxml")) { - if ((xml_root = switch_xml_open_root(1, &err))) { - switch_xml_free(xml_root); - } - stream->write_function(stream, "Reload XML [%s]\n", err); - } + switch_xml_reload(&err); + stream->write_function(stream, "Reload XML [%s]\n", err); if (!strcasecmp(argv[1], "stop")) { sofia_clear_pflag_locked(profile, PFLAG_RUNNING); @@ -3493,7 +3482,7 @@ SWITCH_STANDARD_API(sofia_function) const char *usage_string = "USAGE:\n" "--------------------------------------------------------------------------------\n" "sofia help\n" - "sofia profile <profile_name> [[start|stop|restart|rescan] [reloadxml]|" + "sofia profile <profile_name> [[start|stop|restart|rescan]|" "flush_inbound_reg [<call_id>] [reboot]|" "[register|unregister] [<gateway name>|all]|" "killgw <gateway name>|" @@ -4634,10 +4623,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) switch_console_set_complete("add sofia profile"); switch_console_set_complete("add sofia profile restart all"); - switch_console_set_complete("add sofia profile ::sofia::list_profiles start reloadxml"); - switch_console_set_complete("add sofia profile ::sofia::list_profiles stop reloadxml"); - switch_console_set_complete("add sofia profile ::sofia::list_profiles rescan reloadxml"); - switch_console_set_complete("add sofia profile ::sofia::list_profiles restart reloadxml"); + switch_console_set_complete("add sofia profile ::sofia::list_profiles start"); + switch_console_set_complete("add sofia profile ::sofia::list_profiles stop"); + switch_console_set_complete("add sofia profile ::sofia::list_profiles rescan"); + switch_console_set_complete("add sofia profile ::sofia::list_profiles restart"); switch_console_set_complete("add sofia profile ::sofia::list_profiles flush_inbound_reg"); switch_console_set_complete("add sofia profile ::sofia::list_profiles register ::sofia::list_profile_gateway"); commit d4a0132415ea461501255906b7455279ac6b71f4 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Sep 16 18:11:55 2010 -0500 reverse the linked list in ivr menus to support accidental feature of multiple entries for the same keys diff --git a/src/switch_ivr_menu.c b/src/switch_ivr_menu.c index 4883326..255ab61 100644 --- a/src/switch_ivr_menu.c +++ b/src/switch_ivr_menu.c @@ -214,12 +214,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t ** new_me SWITCH_DECLARE(switch_status_t) switch_ivr_menu_bind_action(switch_ivr_menu_t *menu, switch_ivr_action_t ivr_action, const char *arg, const char *bind) { - switch_ivr_menu_action_t *action; + switch_ivr_menu_action_t *action, *ap; uint32_t len; if ((action = switch_core_alloc(menu->pool, sizeof(*action)))) { action->bind = switch_core_strdup(menu->pool, bind); - action->next = menu->actions; action->arg = switch_core_strdup(menu->pool, arg); if (*action->bind == '/') { action->re = 1; @@ -230,7 +229,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_bind_action(switch_ivr_menu_t *m } } action->ivr_action = ivr_action; + + if (menu->actions) { + for(ap = menu->actions; ap && ap->next; ap = ap->next); + ap->next = action; + } else { menu->actions = action; + } + return SWITCH_STATUS_SUCCESS; } @@ -240,13 +246,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_bind_action(switch_ivr_menu_t *m SWITCH_DECLARE(switch_status_t) switch_ivr_menu_bind_function(switch_ivr_menu_t *menu, switch_ivr_menu_action_function_t *function, const char *arg, const char *bind) { - switch_ivr_menu_action_t *action; + switch_ivr_menu_action_t *action, *ap; uint32_t len; if ((action = switch_core_alloc(menu->pool, sizeof(*action)))) { action->bind = switch_core_strdup(menu->pool, bind); - action->next = menu->actions; action->arg = switch_core_strdup(menu->pool, arg); + if (*action->bind == '/') { action->re = 1; } else { @@ -255,8 +261,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_bind_function(switch_ivr_menu_t menu->inlen = len; } } + action->function = function; + + if (menu->actions) { + for(ap = menu->actions; ap && ap->next; ap = ap->next); + ap->next = action; + } else { menu->actions = action; + } + return SWITCH_STATUS_SUCCESS; } commit 42c9df72ce2c1653b4c7def98336d848dacfb2c5 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Sep 16 17:38:06 2010 -0500 ***BEHAVIOUR CHANGE*** reloadacl, load <module>, reload <module> will now explicitly call reloadxml diff --git a/src/include/switch_xml.h b/src/include/switch_xml.h index 220e65d..9b0fbb4 100644 --- a/src/include/switch_xml.h +++ b/src/include/switch_xml.h @@ -331,6 +331,7 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_open_root(_In_ uint8_t reload, _Out_ con ///\return SWITCH_STATUS_SUCCESS if successful SWITCH_DECLARE(switch_status_t) switch_xml_init(_In_ switch_memory_pool_t *pool, _Out_ const char **err); +SWITCH_DECLARE(switch_status_t) switch_xml_reload(const char **err); SWITCH_DECLARE(switch_status_t) switch_xml_destroy(void); diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 0865b2b..d87e820 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -1179,17 +1179,18 @@ SWITCH_STANDARD_API(xml_locate_function) SWITCH_STANDARD_API(reload_acl_function) { const char *err; - switch_xml_t xml_root; - if (cmd && !strcmp(cmd, "reloadxml")) { - if ((xml_root = switch_xml_open_root(1, &err))) { - switch_xml_free(xml_root); - } + if (cmd && !strcasecmp(cmd, "reloadxml")) { + stream->write_function(stream, "This option is depricated, we now always reloadxml.\n"); + } + + if (switch_xml_reload(&err) == SWITCH_STATUS_SUCCESS) { + switch_load_network_lists(SWITCH_TRUE); + stream->write_function(stream, "+OK acl reloaded\n"); + } else { + stream->write_function(stream, "-Error [%s]\n", err); } - switch_load_network_lists(SWITCH_TRUE); - - stream->write_function(stream, "+OK acl reloaded\n"); return SWITCH_STATUS_SUCCESS; } @@ -1738,6 +1739,10 @@ SWITCH_STANDARD_API(load_function) return SWITCH_STATUS_SUCCESS; } + if (switch_xml_reload(&err) == SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "+OK Reloading XML\n"); + } + if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) cmd, SWITCH_TRUE, &err) == SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "+OK\n"); } else { @@ -1832,6 +1837,10 @@ SWITCH_STANDARD_API(reload_function) stream->write_function(stream, "-ERR unloading module [%s]\n", err); } + if (switch_xml_reload(&err) == SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "+OK Reloading XML\n"); + } + if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) cmd, SWITCH_TRUE, &err) == SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "+OK module loaded\n"); } else { @@ -1843,13 +1852,9 @@ SWITCH_STANDARD_API(reload_function) SWITCH_STANDARD_API(reload_xml_function) { - const char *err; - switch_xml_t xml_root; - - if ((xml_root = switch_xml_open_root(1, &err))) { - switch_xml_free(xml_root); - } + const char *err = ""; + switch_xml_reload(&err); stream->write_function(stream, "+OK [%s]\n", err); return SWITCH_STATUS_SUCCESS; @@ -4569,7 +4574,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) SWITCH_ADD_API(commands_api_interface, "originate", "Originate a Call", originate_function, ORIGINATE_SYNTAX); SWITCH_ADD_API(commands_api_interface, "pause", "Pause", pause_function, PAUSE_SYNTAX); SWITCH_ADD_API(commands_api_interface, "regex", "Eval a regex", regex_function, "<data>|<pattern>[|<subst string>]"); - SWITCH_ADD_API(commands_api_interface, "reloadacl", "Reload ACL", reload_acl_function, "[reloadxml]"); + SWITCH_ADD_API(commands_api_interface, "reloadacl", "Reload ACL", reload_acl_function, ""); SWITCH_ADD_API(commands_api_interface, "reload", "Reload Module", reload_function, UNLOAD_SYNTAX); SWITCH_ADD_API(commands_api_interface, "reloadxml", "Reload XML", reload_xml_function, ""); SWITCH_ADD_API(commands_api_interface, "replace", "replace a string", replace_function, "<data>|<string1>|<string2>"); diff --git a/src/switch_xml.c b/src/switch_xml.c index efaede8..6889789 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -2039,6 +2039,18 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_open_root(uint8_t reload, const char **e return r; } +SWITCH_DECLARE(switch_status_t) switch_xml_reload(const char **err) +{ + switch_xml_t xml_root; + + if ((xml_root = switch_xml_open_root(1, err))) { + switch_xml_free(xml_root); + return SWITCH_STATUS_SUCCESS; + } + + return SWITCH_STATUS_GENERR; +} + SWITCH_DECLARE(switch_status_t) switch_xml_init(switch_memory_pool_t *pool, const char **err) { switch_xml_t xml; commit 83da7bd3188ddcb92b10ddc4e07792c40aa4885f Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Sep 16 17:01:53 2010 -0500 make t38 terminal mode more reliable diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 52ba941..1c825ec 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -74,6 +74,8 @@ static struct { char header[50]; char *prepend_string; char *spool; + switch_thread_cond_t *cond; + switch_mutex_t *cond_mutex; } globals; struct pvt_s { @@ -121,24 +123,16 @@ static struct { static int add_pvt(pvt_t *pvt) { int r = 0; - uint32_t sanity = 50; - - switch_mutex_lock(t38_state_list.mutex); - if (!t38_state_list.thread_running) { - - launch_timer_thread(); - - while(--sanity && !t38_state_list.thread_running) { - switch_yield(10000); - } - } - switch_mutex_unlock(t38_state_list.mutex); if (t38_state_list.thread_running) { switch_mutex_lock(t38_state_list.mutex); pvt->next = t38_state_list.head; t38_state_list.head = pvt; switch_mutex_unlock(t38_state_list.mutex); + r = 1; + switch_thread_cond_broadcast(globals.cond); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error launching thread\n"); } return r; @@ -151,9 +145,9 @@ static int del_pvt(pvt_t *del_pvt) pvt_t *p, *l = NULL; int r = 0; - if (!t38_state_list.thread_running) goto end; - + switch_mutex_lock(t38_state_list.mutex); + for (p = t38_state_list.head; p; p = p->next) { if (p == del_pvt) { if (l) { @@ -163,42 +157,48 @@ static int del_pvt(pvt_t *del_pvt) } p->next = NULL; r = 1; - goto end; + break; } l = p; } - end: - switch_mutex_unlock(t38_state_list.mutex); - return r; + switch_thread_cond_broadcast(globals.cond); + return r; } static void *SWITCH_THREAD_FUNC timer_thread_run(switch_thread_t *thread, void *obj) { switch_timer_t timer = { 0 }; pvt_t *pvt; - int samples = 240; - int ms = 30; + int samples = 160; + int ms = 20; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "timer thread started.\n"); + switch_mutex_lock(t38_state_list.mutex); + t38_state_list.thread_running = 1; + switch_mutex_unlock(t38_state_list.mutex); + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FAX timer thread started.\n"); if (switch_core_timer_init(&timer, "soft", ms, samples, NULL) != SWITCH_STATUS_SUCCESS) { - return NULL; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "timer init failed.\n"); + goto end; } - t38_state_list.thread_running = 1; - while(t38_state_list.thread_running) { + switch_mutex_lock(globals.cond_mutex); + switch_mutex_lock(t38_state_list.mutex); if (!t38_state_list.head) { switch_mutex_unlock(t38_state_list.mutex); - goto end; + switch_thread_cond_wait(globals.cond, globals.cond_mutex); + switch_core_timer_sync(&timer); + continue; } for (pvt = t38_state_list.head; pvt; pvt = pvt->next) { @@ -214,10 +214,15 @@ static void *SWITCH_THREAD_FUNC timer_thread_run(switch_thread_t *thread, void * end: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "timer thread ended.\n"); - + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FAX timer thread ended.\n"); + + switch_mutex_lock(t38_state_list.mutex); t38_state_list.thread_running = 0; - switch_core_timer_destroy(&timer); + switch_mutex_unlock(t38_state_list.mutex); + + if (timer.timer_interface) { + switch_core_timer_destroy(&timer); + } return NULL; } @@ -468,49 +473,61 @@ static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) } break; case T38_MODE: - if (pvt->t38_state == NULL) { - pvt->t38_state = (t38_terminal_state_t *) switch_core_session_alloc(pvt->session, sizeof(t38_terminal_state_t)); - } - if (pvt->t38_state == NULL) { - return SWITCH_STATUS_FALSE; - } - if (pvt->udptl_state == NULL) { - pvt->udptl_state = (udptl_state_t *) switch_core_session_alloc(pvt->session, sizeof(udptl_state_t)); - } - if (pvt->udptl_state == NULL) { - t38_terminal_free(pvt->t38_state); - pvt->t38_state = NULL; - return SWITCH_STATUS_FALSE; - } + { + switch_core_session_message_t msg = { 0 }; - /* add to timer thread processing */ - add_pvt(pvt); - - t38 = pvt->t38_state; - t30 = t38_terminal_get_t30_state(t38); + if (pvt->t38_state == NULL) { + pvt->t38_state = (t38_terminal_state_t *) switch_core_session_alloc(pvt->session, sizeof(t38_terminal_state_t)); + } + if (pvt->t38_state == NULL) { + return SWITCH_STATUS_FALSE; + } + if (pvt->udptl_state == NULL) { + pvt->udptl_state = (udptl_state_t *) switch_core_session_alloc(pvt->session, sizeof(udptl_state_t)); + } + if (pvt->udptl_state == NULL) { + t38_terminal_free(pvt->t38_state); + pvt->t38_state = NULL; + return SWITCH_STATUS_FALSE; + } - memset(t38, 0, sizeof(t38_terminal_state_t)); + t38 = pvt->t38_state; + t30 = t38_terminal_get_t30_state(t38); - if (t38_terminal_init(t38, pvt->caller, t38_tx_packet_handler, pvt) == NULL) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my T.38 structs\n"); - return SWITCH_STATUS_FALSE; - } + memset(t38, 0, sizeof(t38_terminal_state_t)); - pvt->t38_core = t38_terminal_get_t38_core_state(pvt->t38_state); + if (t38_terminal_init(t38, pvt->caller, t38_tx_packet_handler, pvt) == NULL) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my T.38 structs\n"); + return SWITCH_STATUS_FALSE; + } - if (udptl_init(pvt->udptl_state, UDPTL_ERROR_CORRECTION_REDUNDANCY, 3, 3, - (udptl_rx_packet_handler_t *) t38_core_rx_ifp_packet, (void *) pvt->t38_core) == NULL) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my UDPTL structs\n"); - return SWITCH_STATUS_FALSE; - } + pvt->t38_core = t38_terminal_get_t38_core_state(pvt->t38_state); - span_log_set_message_handler(&t38->logging, spanfax_log_message); - span_log_set_message_handler(&t30->logging, spanfax_log_message); + if (udptl_init(pvt->udptl_state, UDPTL_ERROR_CORRECTION_REDUNDANCY, 3, 3, + (udptl_rx_packet_handler_t *) t38_core_rx_ifp_packet, (void *) pvt->t38_core) == NULL) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize my UDPTL structs\n"); + return SWITCH_STATUS_FALSE; + } - if (pvt->verbose) { - span_log_set_level(&t38->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - span_log_set_level(&t30->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); - } + msg.from = __FILE__; + msg.message_id = SWITCH_MESSAGE_INDICATE_UDPTL_MODE; + switch_core_session_receive_message(pvt->session, &msg); + + /* add to timer thread processing */ + if (!add_pvt(pvt)) { + if (channel) { + switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); + } + } + + span_log_set_message_handler(&t38->logging, spanfax_log_message); + span_log_set_message_handler(&t30->logging, spanfax_log_message); + + if (pvt->verbose) { + span_log_set_level(&t38->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); + span_log_set_level(&t30->logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_FLOW); + } + } break; case T38_GATEWAY_MODE: if (pvt->t38_gateway_state == NULL) { @@ -1145,8 +1162,6 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat //switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "READ %d udptl bytes\n", read_frame->packetlen); udptl_rx_packet(pvt->udptl_state, read_frame->packet, read_frame->packetlen); - - } } continue; @@ -1282,6 +1297,8 @@ void mod_spandsp_fax_event_handler(switch_event_t *event) void mod_spandsp_fax_load(switch_memory_pool_t *pool) { + uint32_t sanity = 200; + memset(&globals, 0, sizeof(globals)); memset(&t38_state_list, 0, sizeof(t38_state_list)); @@ -1289,6 +1306,9 @@ void mod_spandsp_fax_load(switch_memory_pool_t *pool) switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool); switch_mutex_init(&t38_state_list.mutex, SWITCH_MUTEX_NESTED, globals.pool); + + switch_mutex_init(&globals.cond_mutex, SWITCH_MUTEX_NESTED, globals.pool); + switch_thread_cond_create(&globals.cond, globals.pool); globals.enable_t38 = 1; globals.total_sessions = 0; @@ -1301,10 +1321,22 @@ void mod_spandsp_fax_load(switch_memory_pool_t *pool) strncpy(globals.header, "SpanDSP Fax Header", sizeof(globals.header) - 1); load_configuration(0); + + + launch_timer_thread(); + + while(--sanity && !t38_state_list.thread_running) { + switch_yield(20000); + } } void mod_spandsp_fax_shutdown(void) { + switch_status_t tstatus = SWITCH_STATUS_SUCCESS; + + t38_state_list.thread_running = 0; + switch_thread_cond_broadcast(globals.cond); + switch_thread_join(&tstatus, t38_state_list.thread); memset(&globals, 0, sizeof(globals)); } commit a045519f6b07186b9d4c524d2bdad827b189f02c Author: Konrad Hammel <konrad@sangoma.com> Date: Thu Sep 16 16:50:36 2010 -0400 freetdm: ss7 - fixed bug in dnis if ST character present diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index 6fba4e9..0d52dfa 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -483,14 +483,17 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) i++; } - /* check if the end of pulsing character has arrived or the right number of digits */ - if (ftdmchan->caller_data.dnis.digits[i] == 0xF) { + /* check if the end of pulsing (ST) character has arrived or the right number of digits */ + if (ftdmchan->caller_data.dnis.digits[i-1] == 'F') { SS7_DEBUG_CHAN(ftdmchan, "Received the end of pulsing character %s\n", ""); + /* remove the ST */ + ftdmchan->caller_data.dnis.digits[i-1] = '\0'; + /*now go to the RING state */ ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_RING); - } else if (i >= g_ftdm_sngss7_data.min_digits) { + } else if (i > g_ftdm_sngss7_data.min_digits) { SS7_DEBUG_CHAN(ftdmchan, "Received %d digits (min digits = %d)\n", i, g_ftdm_sngss7_data.min_digits); /*now go to the RING state */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 1e8e54a..5086d11 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -306,9 +306,9 @@ uint8_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven) j = 0; for (i = 0; i < str.len; i++) { - sprintf(&ftdm[j], "%d", (str.val[i] & 0x0F)); + sprintf(&ftdm[j], "%X", (str.val[i] & 0x0F)); j++; - sprintf(&ftdm[j], "%d", ((str.val[i] & 0xF0) >> 4)); + sprintf(&ftdm[j], "%X", ((str.val[i] & 0xF0) >> 4)); j++; } @@ -318,6 +318,8 @@ uint8_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven) } else { ftdm[j] = '\0'; } + + } else { SS7_ERROR("Asked to copy tknStr that is not present!\n"); return 1; commit 19dc1ab0f207d20a0934cd0c15b1e7757070be25 Author: root <root@proxy-2.(none)> Date: Thu Sep 16 20:08:30 2010 +0400 fix crashes on FSH323Connection calls in on_hangup routine in different threads. diff --git a/src/mod/endpoints/mod_h323/changes.txt b/src/mod/endpoints/mod_h323/changes.txt index ff47780..19aca46 100644 --- a/src/mod/endpoints/mod_h323/changes.txt +++ b/src/mod/endpoints/mod_h323/changes.txt @@ -1,3 +1,4 @@ +fix crashes on FSH323Connection calls in on_hangup routine in different threads. move PTrace level set to FSH323EndPoint::Initialise partially apply patch from from Peter Olsson, Remove UnLock() when TryLock() failed and DEBUG_RTP_PACKETS directive. apply changes from mod_h323-patch.diff by Peter Olsson. diff --git a/src/mod/endpoints/mod_h323/mod_h323.cpp b/src/mod/endpoints/mod_h323/mod_h323.cpp index aeee422..142506d 100644 --- a/src/mod/endpoints/mod_h323/mod_h323.cpp +++ b/src/mod/endpoints/mod_h323/mod_h323.cpp @@ -24,7 +24,7 @@ * * mod_h323.cpp -- H323 endpoint * - * Version 0.0.55 + * Version 0.0.56 */ //#define DEBUG_RTP_PACKETS @@ -747,6 +747,17 @@ FSH323Connection::~FSH323Connection() // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->h323_mutex_unlock\n"); } +void FSH323Connection::AttachSignalChannel(const PString & token, + H323Transport * channel, + PBoolean answeringCall) +{ + h323_private_t *tech_pvt = (h323_private_t *) switch_core_session_get_private(m_fsSession); + tech_pvt->token = strdup((const char *)token); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"---------->token = %s [%p]\n",(const char *)token,this); + H323Connection::AttachSignalChannel(token,channel,answeringCall); +} + + void FSH323Connection::OnSetLocalCapabilities() { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"======>FSH323Connection::OnSetLocalCapabilities() [%p]\n",this); @@ -2321,8 +2332,9 @@ static switch_status_t on_hangup(switch_core_session_t *session) switch_channel_t *channel = switch_core_session_get_channel(session); h323_private_t *tech_pvt = (h323_private_t *) switch_core_session_get_private(session); FSH323Connection *me = tech_pvt->me; + FSH323EndPoint & ep = h323_process->GetH323EndPoint(); tech_pvt->me = NULL; - + if (me) { if (me->m_rtp_resetting == 1) { switch_core_session_unlock_codec_read(session); @@ -2340,12 +2352,12 @@ static switch_status_t on_hangup(switch_core_session_t *session) me->CloseAllLogicalChannels(false); me->Unlock(); } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"----->%s\n",(const char *)(me->GetCallToken())); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"----->%s\n",(const char *)(tech_pvt->token)); Q931::CauseValues cause = (Q931::CauseValues)switch_channel_get_cause_q850(channel); int trylock = me->TryLock(); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"-----> () = %d\n",trylock); if (trylock == 1) { - const PString currentToken(me->GetCallToken()); + const PString currentToken(tech_pvt->token); FSH323Connection *connection = (FSH323Connection *)me->GetEndPoint()->FindConnectionWithLock(currentToken); if (connection) { connection->Unlock(); @@ -2356,8 +2368,10 @@ static switch_status_t on_hangup(switch_core_session_t *session) } else if (trylock == -1) { /* Failed to lock - just go on */ } + const PString currentToken(tech_pvt->token); me->SetQ931Cause(cause); - me->ClearCallSynchronous(NULL, H323TranslateToCallEndReason(cause, UINT_MAX)); +// me->ClearCallSynchronous(NULL, H323TranslateToCallEndReason(cause, UINT_MAX)); + ep.ClearCall(currentToken, H323TranslateToCallEndReason(cause, UINT_MAX)); // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->h323_mutex_lock\n"); // switch_mutex_lock(tech_pvt->h323_mutex); } diff --git a/src/mod/endpoints/mod_h323/mod_h323.h b/src/mod/endpoints/mod_h323/mod_h323.h index 087540c..8127206 100644 --- a/src/mod/endpoints/mod_h323/mod_h323.h +++ b/src/mod/endpoints/mod_h323/mod_h323.h @@ -184,6 +184,7 @@ typedef struct { switch_mutex_t *h323_io_mutex; FSH323Connection *me; + char *token; } h323_private_t; #define DECLARE_CALLBACK0(name) \ @@ -306,7 +307,11 @@ class FSH323Connection:public H323Connection { unsigned callReference, switch_caller_profile_t *outbound_profile, switch_core_session_t *fsSession, switch_channel_t *fsChannel); ~FSH323Connection(); - + virtual void AttachSignalChannel( + const PString & token, + H323Transport * channel, + PBoolean answeringCall + ); virtual H323Channel *CreateRealTimeLogicalChannel(const H323Capability & capability, H323Channel::Directions dir, unsigned sessionID, const H245_H2250LogicalChannelParameters * param, RTP_QOS * rtpqos = NULL); commit 401b23549ef108acc18e1d417ea74ad6d1665d05 Author: Konrad Hammel <konrad@sangoma.com> Date: Thu Sep 16 11:55:26 2010 -0400 freetdm: ss7 - updated outgoing IAM diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index 72da36f..34abd26 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -103,11 +103,11 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) iam.fwdCallInd.end2EndInfoInd.pres = PRSNT_NODEF; iam.fwdCallInd.end2EndInfoInd.val = E2EINF_NOINFO; iam.fwdCallInd.isdnUsrPrtInd.pres = PRSNT_NODEF; - iam.fwdCallInd.isdnUsrPrtInd.val = ISUP_NOTUSED; + iam.fwdCallInd.isdnUsrPrtInd.val = ISUP_USED; iam.fwdCallInd.isdnUsrPrtPrfInd.pres = PRSNT_NODEF; iam.fwdCallInd.isdnUsrPrtPrfInd.val = PREF_PREFAW; iam.fwdCallInd.isdnAccInd.pres = PRSNT_NODEF; - iam.fwdCallInd.isdnAccInd.val = ISDNACC_NONISDN; + iam.fwdCallInd.isdnAccInd.val = ISDNACC_ISDN; iam.fwdCallInd.sccpMethInd.pres = PRSNT_NODEF; iam.fwdCallInd.sccpMethInd.val = SCCPMTH_NOIND; commit 94cf078a4d41b8a97c1f1d3d630a93f02387837c Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Sep 15 20:28:38 2010 -0500 fix build issue from tone2wav diff --git a/Makefile.am b/Makefile.am index 077dfec..ad04fde 100644 --- a/Makefile.am +++ b/Makefile.am @@ -286,7 +286,7 @@ endif ## tone2wav_SOURCES = src/tone2wav.c tone2wav_CFLAGS = $(AM_CFLAGS) -tone2wav_LDFLAGS = $(AM_LDFLAGS) -lm +tone2wav_LDFLAGS = $(AM_LDFLAGS) $(CORE_LIBS) tone2wav_LDADD = libfreeswitch.la ## commit c8a897b90c5d64a08a758dfca3c2b2f56f163465 Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Thu Sep 16 11:03:59 2010 -0400 mod_commands: Allow cond API to allow returning empty false value diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index e308a00..0865b2b 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -1387,7 +1387,7 @@ SWITCH_STANDARD_API(cond_function) argc = switch_separate_string(mydata, ':', argv, (sizeof(argv) / sizeof(argv[0]))); - if (argc != 3) { + if (! (argc >= 2 && argc <= 3)) { goto error; } @@ -1464,7 +1464,12 @@ SWITCH_STANDARD_API(cond_function) } switch_safe_free(s_a); switch_safe_free(s_b); - stream->write_function(stream, "%s", is_true ? argv[1] : argv[2]); + + if ((argc == 2 && !is_true)) { + stream->write_function(stream, ""); + } else { + stream->write_function(stream, "%s", is_true ? argv[1] : argv[2]); + } goto ok; } commit 7d5ca1c08601694be0effa41965d9f2d8299a8ec Author: Leon de Rooij <leon@toyos.nl> Date: Thu Sep 16 14:02:12 2010 +0200 Added SAF_ROUTING_EXEC flag to lua app, so it can be run inline diff --git a/src/mod/languages/mod_lua/mod_lua.cpp b/src/mod/languages/mod_lua/mod_lua.cpp index 3ccbef5..cf9b373 100644 --- a/src/mod/languages/mod_lua/mod_lua.cpp +++ b/src/mod/languages/mod_lua/mod_lua.cpp @@ -588,7 +588,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_lua_load) SWITCH_ADD_API(api_interface, "luarun", "run a script", luarun_api_function, "<script>"); SWITCH_ADD_API(api_interface, "lua", "run a script as an api function", lua_api_function, "<script>"); - SWITCH_ADD_APP(app_interface, "lua", "Launch LUA ivr", "Run a lua ivr on a channel", lua_function, "<script>", SAF_SUPPORT_NOMEDIA); + SWITCH_ADD_APP(app_interface, "lua", "Launch LUA ivr", "Run a lua ivr on a channel", lua_function, "<script>", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC); SWITCH_ADD_DIALPLAN(dp_interface, "LUA", lua_dialplan_hunt); commit 8726104aa3ffa9f542d0b64b4fb43e6acdcaff77 Author: Brian West <brian@freeswitch.org> Date: Wed Sep 15 19:46:15 2010 -0500 If sip_invite_domain is used lets use it for rpid_domain no matter what because I know best if I set it diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 3dd8309..d17981c 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1658,7 +1658,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) sofia_private_t *sofia_private; char *invite_contact = NULL, *to_str, *use_from_str, *from_str; const char *t_var; - char *rpid_domain = "cluecon.com", *p; + char *rpid_domain = NULL, *p; const char *priv = "off"; const char *screen = "no"; const char *invite_params = switch_channel_get_variable(tech_pvt->channel, "sip_invite_params"); @@ -1670,6 +1670,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) const char *from_var = switch_channel_get_variable(tech_pvt->channel, "sip_from_uri"); const char *from_display = switch_channel_get_variable(tech_pvt->channel, "sip_from_display"); const char *invite_req_uri = switch_channel_get_variable(tech_pvt->channel, "sip_invite_req_uri"); + const char *invite_domain = switch_channel_get_variable(tech_pvt->channel, "sip_invite_domain"); const char *use_name, *use_number; if (zstr(tech_pvt->dest)) { @@ -1688,7 +1689,6 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) if (!tech_pvt->from_str) { const char *sipip; const char *format; - const char *alt = NULL; sipip = tech_pvt->profile->sipip; @@ -1698,8 +1698,8 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) format = strchr(sipip, ':') ? "\"%s\" <sip:%s%s[%s]>" : "\"%s\" <sip:%s%s%s>"; - if ((alt = switch_channel_get_variable(channel, "sip_invite_domain"))) { - sipip = alt; + if (!zstr(invite_domain)) { + sipip = invite_domain; } tech_pvt->from_str = switch_core_session_sprintf(tech_pvt->session, format, cid_name, cid_num, !zstr(cid_num) ? "@" : "", sipip); @@ -1739,6 +1739,10 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) } } + if (!zstr(invite_domain)) { + rpid_domain = (char *)invite_domain; + } + if (zstr(rpid_domain)) { rpid_domain = "cluecon.com"; } commit 0d0b4b4383fcd24a3339f8d5c647cc1aee46e8f7 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Sep 15 19:11:47 2010 -0500 move app flag into 'T38' namespace for the sake of housekeeping diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 7ff106a..52ba941 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -1659,8 +1659,8 @@ static switch_status_t t38_gateway_on_reset(switch_core_session_t *session) switch_channel_clear_flag(channel, CF_REDIRECT); - if (switch_channel_test_app_flag(channel, CF_APP_TAGGED)) { - switch_channel_clear_app_flag(channel, CF_APP_TAGGED); + if (switch_channel_test_app_flag_key("T38", channel, CF_APP_TAGGED)) { + switch_channel_clear_app_flag_key("T38", channel, CF_APP_TAGGED); switch_channel_set_state(channel, CS_CONSUME_MEDIA); } else { switch_channel_set_state(channel, CS_SOFT_EXECUTE); @@ -1697,6 +1697,9 @@ switch_bool_t t38_gateway_start(switch_core_session_t *session, const char *app, switch_channel_set_variable(channel, "t38_peer", switch_core_session_get_uuid(other_session)); switch_channel_set_variable(other_channel, "t38_peer", switch_core_session_get_uuid(session)); + switch_channel_set_variable(peer ? other_channel : channel, "t38_gateway_format", "audio"); + switch_channel_set_variable(peer ? channel : other_channel, "t38_gateway_format", "udptl"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s starting gateway mode to %s\n", switch_channel_get_name(peer ? channel : other_channel), @@ -1709,8 +1712,8 @@ switch_bool_t t38_gateway_start(switch_core_session_t *session, const char *app, switch_channel_add_state_handler(channel, &t38_gateway_state_handlers); switch_channel_add_state_handler(other_channel, &t38_gateway_state_handlers); - switch_channel_set_app_flag(peer ? channel : other_channel, CF_APP_TAGGED); - switch_channel_clear_app_flag(peer ? other_channel : channel, CF_APP_TAGGED); + switch_channel_set_app_flag_key("T38", peer ? channel : other_channel, CF_APP_TAGGED); + switch_channel_clear_app_flag_key("T38", peer ? other_channel : channel, CF_APP_TAGGED); switch_channel_set_flag(channel, CF_REDIRECT); switch_channel_set_state(channel, CS_RESET); commit 4e567a28a209a2037d88af51c04b75cdec1214cc Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Sep 15 18:57:54 2010 -0500 fix logic in app flags diff --git a/src/switch_channel.c b/src/switch_channel.c index e3d77d7..ba55601 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -1291,19 +1291,24 @@ SWITCH_DECLARE(int) switch_channel_test_private_flag(switch_channel_t *channel, SWITCH_DECLARE(void) switch_channel_set_app_flag_key(const char *key, switch_channel_t *channel, uint32_t flags) { uint32_t *flagp = NULL; - + switch_byte_t new = 0; + switch_assert(channel != NULL); switch_mutex_lock(channel->flag_mutex); - - if (channel->app_flag_hash) { - flagp = switch_core_hash_find(channel->app_flag_hash, key); - } else { + + if (!channel->app_flag_hash) { switch_core_hash_init(&channel->app_flag_hash, switch_core_session_get_pool(channel->session)); + new++; + } + + if (new || !(flagp = switch_core_hash_find(channel->app_flag_hash, key))) { flagp = switch_core_session_alloc(channel->session, sizeof(uint32_t)); switch_core_hash_insert(channel->app_flag_hash, key, flagp); } - if (flagp) *flagp |= flags; + switch_assert(flagp); + *flagp |= flags; + switch_mutex_unlock(channel->flag_mutex); } commit 3eb35a57bf702f9289dca66d913b285888c1aabe Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Sep 15 17:04:43 2010 -0500 forgot a spot to call conditional broadcast on shutdown diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index d5a06f8..4a53c8d 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -1673,6 +1673,7 @@ void switch_core_sqldb_stop(void) switch_queue_push(sql_manager.sql_queue[0], NULL); switch_queue_push(sql_manager.sql_queue[1], NULL); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Waiting for unfinished SQL transactions\n"); + switch_thread_cond_broadcast(sql_manager.cond); } sql_manager.thread_running = -1; commit 6a0f7f4ae8d0005cb9fdc3286537b9b60b50a592 Author: Jeff Lenk <jeff@jefflenk.com> Date: Wed Sep 15 16:21:10 2010 -0500 build tweak + vs2010 swig diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 9fa52fa..e76a56a 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1233,7 +1233,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread uint32_t gateway_loops = 0; int loops = 0; uint32_t qsize; - void *pop; + void *pop = NULL; int loop_count = 0; switch_size_t sql_len = 1024 * 32; char *tmp, *sqlbuf = NULL; @@ -1254,7 +1254,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread while ((mod_sofia_globals.running == 1 && sofia_test_pflag(profile, PFLAG_RUNNING)) || qsize) { if (sofia_test_pflag(profile, PFLAG_SQL_IN_TRANS)) { - if (qsize > 0 && (qsize >= 1024 || ++loop_count >= profile->trans_timeout)) { + if (qsize > 0 && (qsize >= 1024 || ++loop_count >= (int)profile->trans_timeout)) { switch_size_t newlen; uint32_t iterations = 0; switch_size_t len = 0; diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx index 4b0a1df..04a2f3f 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx @@ -2813,6 +2813,68 @@ SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_rtp_numbers_t(void * jarg1) { } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtcp_numbers_t_packet_count_set(void * jarg1, unsigned long jarg2) { + switch_rtcp_numbers_t *arg1 = (switch_rtcp_numbers_t *) 0 ; + uint32_t arg2 ; + + arg1 = (switch_rtcp_numbers_t *)jarg1; + arg2 = (uint32_t)jarg2; + if (arg1) (arg1)->packet_count = arg2; +} + + +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_rtcp_numbers_t_packet_count_get(void * jarg1) { + unsigned long jresult ; + switch_rtcp_numbers_t *arg1 = (switch_rtcp_numbers_t *) 0 ; + uint32_t result; + + arg1 = (switch_rtcp_numbers_t *)jarg1; + result = (uint32_t) ((arg1)->packet_count); + jresult = (unsigned long)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtcp_numbers_t_octet_count_set(void * jarg1, unsigned long jarg2) { + switch_rtcp_numbers_t *arg1 = (switch_rtcp_numbers_t *) 0 ; + uint32_t arg2 ; + + arg1 = (switch_rtcp_numbers_t *)jarg1; + arg2 = (uint32_t)jarg2; + if (arg1) (arg1)->octet_count = arg2; +} + + +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_rtcp_numbers_t_octet_count_get(void * jarg1) { + unsigned long jresult ; + switch_rtcp_numbers_t *arg1 = (switch_rtcp_numbers_t *) 0 ; + uint32_t result; + + arg1 = (switch_rtcp_numbers_t *)jarg1; + result = (uint32_t) ((arg1)->octet_count); + jresult = (unsigned long)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_rtcp_numbers_t() { + void * jresult ; + switch_rtcp_numbers_t *result = 0 ; + + result = (switch_rtcp_numbers_t *)new switch_rtcp_numbers_t(); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_rtcp_numbers_t(void * jarg1) { + switch_rtcp_numbers_t *arg1 = (switch_rtcp_numbers_t *) 0 ; + + arg1 = (switch_rtcp_numbers_t *)jarg1; + delete arg1; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_stats_t_inbound_set(void * jarg1, void * jarg2) { switch_rtp_stats_t *arg1 = (switch_rtp_stats_t *) 0 ; switch_rtp_numbers_t *arg2 = (switch_rtp_numbers_t *) 0 ; @@ -2857,6 +2919,28 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_stats_t_outbound_get(void * jarg } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_stats_t_rtcp_set(void * jarg1, void * jarg2) { + switch_rtp_stats_t *arg1 = (switch_rtp_stats_t *) 0 ; + switch_rtcp_numbers_t *arg2 = (switch_rtcp_numbers_t *) 0 ; + + arg1 = (switch_rtp_stats_t *)jarg1; + arg2 = (switch_rtcp_numbers_t *)jarg2; + if (arg1) (arg1)->rtcp = *arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_stats_t_rtcp_get(void * jarg1) { + void * jresult ; + switch_rtp_stats_t *arg1 = (switch_rtp_stats_t *) 0 ; + switch_rtcp_numbers_t *result = 0 ; + + arg1 = (switch_rtp_stats_t *)jarg1; + result = (switch_rtcp_numbers_t *)& ((arg1)->rtcp); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_rtp_stats_t() { void * jresult ; switch_rtp_stats_t *result = 0 ; @@ -10518,11 +10602,13 @@ SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_loadable_module_interface(void } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_loadable_module_init() { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_loadable_module_init(int jarg1) { int jresult ; + switch_bool_t arg1 ; switch_status_t result; - result = (switch_status_t)switch_loadable_module_init(); + arg1 = (switch_bool_t)jarg1; + result = (switch_status_t)switch_loadable_module_init(arg1); jresult = result; return jresult; } @@ -13050,6 +13136,28 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_profile_originatee_caller_pro } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_origination_caller_profile_set(void * jarg1, void * jarg2) { + switch_caller_profile *arg1 = (switch_caller_profile *) 0 ; + switch_caller_profile *arg2 = (switch_caller_profile *) 0 ; + + arg1 = (switch_caller_profile *)jarg1; + arg2 = (switch_caller_profile *)jarg2; + if (arg1) (arg1)->origination_caller_profile = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_profile_origination_caller_profile_get(void * jarg1) { + void * jresult ; + switch_caller_profile *arg1 = (switch_caller_profile *) 0 ; + switch_caller_profile *result = 0 ; + + arg1 = (switch_caller_profile *)jarg1; + result = (switch_caller_profile *) ((arg1)->origination_caller_profile); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_hunt_caller_profile_set(void * jarg1, void * jarg2) { switch_caller_profile *arg1 = (switch_caller_profile *) 0 ; switch_caller_profile *arg2 = (switch_caller_profile *) 0 ; @@ -22219,6 +22327,28 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_get_originatee_caller_profil } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_origination_caller_profile(void * jarg1, void * jarg2) { + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + switch_caller_profile_t *arg2 = (switch_caller_profile_t *) 0 ; + + arg1 = (switch_channel_t *)jarg1; + arg2 = (switch_caller_profile_t *)jarg2; + switch_channel_set_origination_caller_profile(arg1,arg2); +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_get_origination_caller_profile(void * jarg1) { + void * jresult ; + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + switch_caller_profile_t *result = 0 ; + + arg1 = (switch_channel_t *)jarg1; + result = (switch_caller_profile_t *)switch_channel_get_origination_caller_profile(arg1); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_get_uuid(void * jarg1) { char * jresult ; switch_channel_t *arg1 = (switch_channel_t *) 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs index a76e35c..8bf2c6c 100644 --- a/src/mod/languages/mod_managed/managed/swig.2010.cs +++ b/src/mod/languages/mod_managed/managed/swig.2010.cs @@ -2309,8 +2309,8 @@ public class freeswitch { return ret; } - public static switch_status_t switch_loadable_module_init() { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_init(); + public static switch_status_t switch_loadable_module_init(switch_bool_t autoload) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_init((int)autoload); return ret; } @@ -3105,6 +3105,16 @@ public class freeswitch { return ret; } + public static void switch_channel_set_origination_caller_profile(SWIGTYPE_p_switch_channel channel, switch_caller_profile caller_profile) { + freeswitchPINVOKE.switch_channel_set_origination_caller_profile(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_caller_profile.getCPtr(caller_profile)); + } + + public static switch_caller_profile switch_channel_get_origination_caller_profile(SWIGTYPE_p_switch_channel channel) { + IntPtr cPtr = freeswitchPINVOKE.switch_channel_get_origination_caller_profile(SWIGTYPE_p_switch_channel.getCPtr(channel)); + switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false); + return ret; + } + public static string switch_channel_get_uuid(SWIGTYPE_p_switch_channel channel) { string ret = freeswitchPINVOKE.switch_channel_get_uuid(SWIGTYPE_p_switch_channel.getCPtr(channel)); return ret; @@ -6115,6 +6125,24 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_rtp_numbers_t")] public static extern void delete_switch_rtp_numbers_t(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtcp_numbers_t_packet_count_set")] + public static extern void switch_rtcp_numbers_t_packet_count_set(HandleRef jarg1, uint jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtcp_numbers_t_packet_count_get")] + public static extern uint switch_rtcp_numbers_t_packet_count_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtcp_numbers_t_octet_count_set")] + public static extern void switch_rtcp_numbers_t_octet_count_set(HandleRef jarg1, uint jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtcp_numbers_t_octet_count_get")] + public static extern uint switch_rtcp_numbers_t_octet_count_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_rtcp_numbers_t")] + public static extern IntPtr new_switch_rtcp_numbers_t(); + + [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_rtcp_numbers_t")] + public static extern void delete_switch_rtcp_numbers_t(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_inbound_set")] public static extern void switch_rtp_stats_t_inbound_set(HandleRef jarg1, HandleRef jarg2); @@ -6127,6 +6155,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_outbound_get")] public static extern IntPtr switch_rtp_stats_t_outbound_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_rtcp_set")] + public static extern void switch_rtp_stats_t_rtcp_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_rtcp_get")] + public static extern IntPtr switch_rtp_stats_t_rtcp_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_rtp_stats_t")] public static extern IntPtr new_switch_rtp_stats_t(); @@ -7982,7 +8016,7 @@ class freeswitchPINVOKE { public static extern void delete_switch_loadable_module_interface(HandleRef jarg1); [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_init")] - public static extern int switch_loadable_module_init(); + public static extern int switch_loadable_module_init(int jarg1); [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_shutdown")] public static extern void switch_loadable_module_shutdown(); @@ -8518,6 +8552,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_originatee_caller_profile_get")] public static extern IntPtr switch_caller_profile_originatee_caller_profile_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_origination_caller_profile_set")] + public static extern void switch_caller_profile_origination_caller_profile_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_origination_caller_profile_get")] + public static extern IntPtr switch_caller_profile_origination_caller_profile_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_hunt_caller_profile_set")] public static extern void switch_caller_profile_hunt_caller_profile_set(HandleRef jarg1, HandleRef jarg2); @@ -10900,6 +10940,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_originatee_caller_profile")] public static extern IntPtr switch_channel_get_originatee_caller_profile(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_origination_caller_profile")] + public static extern void switch_channel_set_origination_caller_profile(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_origination_caller_profile")] + public static extern IntPtr switch_channel_get_origination_caller_profile(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_uuid")] public static extern string switch_channel_get_uuid(HandleRef jarg1); @@ -20494,6 +20540,17 @@ public class switch_caller_profile : IDisposable { } } + public switch_caller_profile origination_caller_profile { + set { + freeswitchPINVOKE.switch_caller_profile_origination_caller_profile_set(swigCPtr, switch_caller_profile.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_caller_profile_origination_caller_profile_get(swigCPtr); + switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false); + return ret; + } + } + public switch_caller_profile hunt_caller_profile { set { freeswitchPINVOKE.switch_caller_profile_hunt_caller_profile_set(swigCPtr, switch_caller_profile.getCPtr(value)); @@ -22237,7 +22294,8 @@ namespace FreeSWITCH.Native { SCF_USE_CLOCK_RT = (1 << 10), SCF_VERBOSE_EVENTS = (1 << 11), SCF_USE_WIN32_MONOTONIC = (1 << 12), - SCF_AUTO_SCHEMAS = (1 << 13) + SCF_AUTO_SCHEMAS = (1 << 13), + SCF_MINIMAL = (1 << 14) } } @@ -27451,6 +27509,75 @@ public class switch_rtcp_hdr_t : IDisposable { namespace FreeSWITCH.Native { +using System; +using System.Runtime.InteropServices; + +public class switch_rtcp_numbers_t : IDisposable { + private HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal switch_rtcp_numbers_t(IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new HandleRef(this, cPtr); + } + + internal static HandleRef getCPtr(switch_rtcp_numbers_t obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } + + ~switch_rtcp_numbers_t() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if (swigCPtr.Handle != IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_switch_rtcp_numbers_t(swigCPtr); + } + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + GC.SuppressFinalize(this); + } + } + + public uint packet_count { + set { + freeswitchPINVOKE.switch_rtcp_numbers_t_packet_count_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.switch_rtcp_numbers_t_packet_count_get(swigCPtr); + return ret; + } + } + + public uint octet_count { + set { + freeswitchPINVOKE.switch_rtcp_numbers_t_octet_count_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.switch_rtcp_numbers_t_octet_count_get(swigCPtr); + return ret; + } + } + + public switch_rtcp_numbers_t() : this(freeswitchPINVOKE.new_switch_rtcp_numbers_t(), true) { + } + +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.0 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + public enum switch_rtp_bug_flag_t { RTP_BUG_NONE = 0, RTP_BUG_CISCO_SKIP_MARK_BIT_2833 = (1 << 0), @@ -28021,6 +28148,17 @@ public class switch_rtp_stats_t : IDisposable { } } + public switch_rtcp_numbers_t rtcp { + set { + freeswitchPINVOKE.switch_rtp_stats_t_rtcp_set(swigCPtr, switch_rtcp_numbers_t.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_rtp_stats_t_rtcp_get(swigCPtr); + switch_rtcp_numbers_t ret = (cPtr == IntPtr.Zero) ? null : new switch_rtcp_numbers_t(cPtr, false); + return ret; + } + } + public switch_rtp_stats_t() : this(freeswitchPINVOKE.new_switch_rtp_stats_t(), true) { } diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index b5b2ef2..d5a06f8 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -850,7 +850,7 @@ SWITCH_DECLARE(switch_bool_t) switch_cache_db_test_reactive(switch_cache_db_hand static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, void *obj) { - void *pop; + void *pop = NULL; uint32_t iterations = 0; uint8_t trans = 0; uint32_t target = 20000; commit 04b52156465f4b0199adcee6181a613303749073 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Sep 15 15:38:25 2010 -0500 presence tweaks and addition of all-reg-options-ping which is like nat-options-ping only for every registered host diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 4d51e4b..96acbcd 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -200,6 +200,7 @@ typedef enum { PFLAG_DISABLE_NAPTR, PFLAG_AUTOFLUSH, PFLAG_NAT_OPTIONS_PING, + PFLAG_ALL_REG_OPTIONS_PING, PFLAG_AUTOFIX_TIMING, PFLAG_MESSAGE_QUERY_ON_REGISTER, PFLAG_MESSAGE_QUERY_ON_FIRST_REGISTER, diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index dd37698..9fa52fa 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2556,6 +2556,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) } else { sofia_clear_pflag(profile, PFLAG_NAT_OPTIONS_PING); } + } else if (!strcasecmp(var, "all-reg-options-ping")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_ALL_REG_OPTIONS_PING); + } else { + sofia_clear_pflag(profile, PFLAG_ALL_REG_OPTIONS_PING); + } } else if (!strcasecmp(var, "inbound-codec-negotiation")) { if (!strcasecmp(val, "greedy")) { sofia_set_pflag(profile, PFLAG_GREEDY); @@ -3310,6 +3316,12 @@ switch_status_t config_sofia(int reload, char *profile_name) } else { sofia_clear_pflag(profile, PFLAG_NAT_OPTIONS_PING); } + } else if (!strcasecmp(var, "all-options-ping")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_ALL_REG_OPTIONS_PING); + } else { + sofia_clear_pflag(profile, PFLAG_ALL_REG_OPTIONS_PING); + } } else if (!strcasecmp(var, "inbound-codec-negotiation")) { if (!strcasecmp(val, "greedy")) { sofia_set_pflag(profile, PFLAG_GREEDY); diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 67b63a1..3ffbc26 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -438,11 +438,14 @@ int sofia_reg_nat_callback(void *pArg, int argc, char **argv, char **columnNames switch_snprintf(to, sizeof(to), "sip:%s@%s", argv[1], argv[2]); dst = sofia_glue_get_destination(argv[3]); switch_assert(dst); - + nh = nua_handle(profile->nua, NULL, SIPTAG_FROM_STR(profile->url), SIPTAG_TO_STR(to), NUTAG_URL(dst->contact), SIPTAG_CONTACT_STR(profile->url), TAG_END()); nua_handle_bind(nh, &mod_sofia_globals.destroy_private); - nua_options(nh, TAG_IF(dst->route_uri, NUTAG_PROXY(dst->route_uri)), TAG_IF(dst->route, SIPTAG_ROUTE_STR(dst->route)), TAG_END()); + nua_options(nh, + NTATAG_SIP_T2(5000), + NTATAG_SIP_T4(10000), + TAG_IF(dst->route_uri, NUTAG_PROXY(dst->route_uri)), TAG_IF(dst->route, SIPTAG_ROUTE_STR(dst->route)), TAG_END()); sofia_glue_free_destination(dst); @@ -514,7 +517,7 @@ int sofia_reg_del_callback(void *pArg, int argc, char **argv, char **columnNames switch_event_fire(&s_event); } - if (switch_event_create(&s_event, SWITCH_EVENT_PRESENCE_OUT) == SWITCH_STATUS_SUCCESS) { + if (switch_event_create(&s_event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "rpid", "away"); switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "login", profile->url); @@ -637,15 +640,14 @@ void sofia_reg_check_expire(sofia_profile_t *profile, time_t now, int reboot) } sofia_glue_actually_execute_sql(profile, sql, NULL); - - - + if (now) { switch_snprintf(sql, sizeof(sql), "select call_id from sip_subscriptions where (expires = -1 or (expires > 0 and expires <= %ld)) and hostname='%s'", (long) now, mod_sofia_globals.hostname); } else { - switch_snprintf(sql, sizeof(sql), "select call_id from sip_subscriptions where expires >= -1 and hostname='%s'", mod_sofia_globals.hostname); + switch_snprintf(sql, sizeof(sql), "select sub_to_user,sub_to_host,call_id from sip_subscriptions where expires >= -1 and hostname='%s'", + mod_sofia_globals.hostname); } sofia_glue_execute_sql_callback(profile, NULL, sql, sofia_sub_del_callback, profile); @@ -670,13 +672,21 @@ void sofia_reg_check_expire(sofia_profile_t *profile, time_t now, int reboot) sofia_glue_actually_execute_sql(profile, sql, NULL); - if (now && sofia_test_pflag(profile, PFLAG_NAT_OPTIONS_PING)) { - switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid," - "expires,user_agent,server_user,server_host,profile_name" - " from sip_registrations where (status like '%%NAT%%' " - "or contact like '%%fs_nat=yes%%') and hostname='%s'", mod_sofia_globals.hostname); - - sofia_glue_execute_sql_callback(profile, NULL, sql, sofia_reg_nat_callback, profile); + if (now) { + if (sofia_test_pflag(profile, PFLAG_ALL_REG_OPTIONS_PING)) { + switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid," + "expires,user_agent,server_user,server_host,profile_name" + " from sip_registrations where hostname='%s'", mod_sofia_globals.hostname); + + sofia_glue_execute_sql_callback(profile, NULL, sql, sofia_reg_nat_callback, profile); + } else if (sofia_test_pflag(profile, PFLAG_NAT_OPTIONS_PING)) { + switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid," + "expires,user_agent,server_user,server_host,profile_name" + " from sip_registrations where (status like '%%NAT%%' " + "or contact like '%%fs_nat=yes%%') and hostname='%s'", mod_sofia_globals.hostname); + + sofia_glue_execute_sql_callback(profile, NULL, sql, sofia_reg_nat_callback, profile); + } } switch_mutex_unlock(profile->ireg_mutex); @@ -810,6 +820,9 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand switch_event_t *auth_params = NULL; int r = 0; long reg_count = 0; + int delete_subs = 1; + const char *agent = "unknown"; + /* all callers must confirm that sip, sip->sip_request and sip->sip_contact are not NULL */ switch_assert(sip != NULL && sip->sip_contact != NULL && sip->sip_request != NULL); @@ -826,6 +839,14 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand to = sip->sip_to; from = sip->sip_from; + if (sip->sip_user_agent) { + agent = sip->sip_user_agent->g_string; + + if (switch_stristr("snom", agent)) { + delete_subs = 0; + } + } + if (from) { from_user = from->a_url->url_user; from_host = from->a_url->url_host; @@ -1135,7 +1156,6 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand } if (exptime) { - const char *agent = "unknown"; char guess_ip4[256]; const char *username = "unknown"; const char *realm = reg_host; @@ -1145,19 +1165,15 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand realm = switch_event_get_header(auth_params, "sip_auth_realm"); } - if (sip->sip_user_agent) { - agent = sip->sip_user_agent->g_string; - } - if (multi_reg) { -#ifdef DEL_SUBS - if (reg_count == 1) { - sql = switch_mprintf("delete from sip_subscriptions where sip_user='%q' and sip_host='%q' and contact='%q'", - to_user, sub_host, contact_str); - sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); + if (delete_subs) { + if (reg_count == 1) { + sql = switch_mprintf("delete from sip_subscriptions where sip_user='%q' and sip_host='%q' and contact='%q'", + to_user, sub_host, contact_str); + sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); + } } -#endif if (multi_reg_contact) { @@ -1167,10 +1183,10 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand sql = switch_mprintf("delete from sip_registrations where call_id='%q'", call_id); } } else { -#ifdef DEL_SUBS - sql = switch_mprintf("delete from sip_subscriptions where sip_user='%q' and sip_host='%q'", to_user, sub_host); - sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); -#endif + if (delete_subs) { + sql = switch_mprintf("delete from sip_subscriptions where sip_user='%q' and sip_host='%q'", to_user, sub_host); + sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); + } sql = switch_mprintf("delete from sip_registrations where sip_user='%q' and sip_host='%q'", to_user, reg_host); } switch_mutex_lock(profile->ireg_mutex); @@ -1185,7 +1201,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand "mwi_user,mwi_host, orig_server_host, orig_hostname) " "values ('%q','%q', '%q','%q','%q','%q', '%q', %ld, '%q', '%q', '%q', '%q', '%q', '%q', '%q','%q','%q','%q','%q','%q','%q')", call_id, to_user, reg_host, profile->presence_hosts ? profile->presence_hosts : reg_host, - contact_str, reg_desc, rpid, (long) switch_epoch_time_now(NULL) + (long) exptime * 2, + contact_str, reg_desc, rpid, (long) switch_epoch_time_now(NULL) + (long) exptime + 60, agent, from_user, guess_ip4, profile->name, mod_sofia_globals.hostname, network_ip, network_port_c, username, realm, mwi_user, mwi_host, guess_ip4, mod_sofia_globals.hostname); @@ -1290,16 +1306,16 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand if ((p = strchr(icontact + 4, ':'))) { *p = '\0'; } -#ifdef DEL_SUBS - if (multi_reg_contact) { - sql = - switch_mprintf("delete from sip_subscriptions where sip_user='%q' and sip_host='%q' and contact='%q'", to_user, sub_host, contact_str); - } else { - sql = switch_mprintf("delete from sip_subscriptions where call_id='%q'", call_id); - } + if (delete_subs) { + if (multi_reg_contact) { + sql = + switch_mprintf("delete from sip_subscriptions where sip_user='%q' and sip_host='%q' and contact='%q'", to_user, sub_host, contact_str); + } else { + sql = switch_mprintf("delete from sip_subscriptions where call_id='%q'", call_id); + } - sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); -#endif + sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); + } if (multi_reg_contact) { sql = @@ -1312,11 +1328,11 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand switch_safe_free(icontact); } else { -#ifdef DEL_SUBS - if ((sql = switch_mprintf("delete from sip_subscriptions where sip_user='%q' and sip_host='%q'", to_user, sub_host))) { - sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); + if (delete_subs) { + if ((sql = switch_mprintf("delete from sip_subscriptions where sip_user='%q' and sip_host='%q'", to_user, sub_host))) { + sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); + } } -#endif if ((sql = switch_mprintf("delete from sip_registrations where sip_user='%q' and sip_host='%q'", to_user, reg_host))) { sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); } commit 486dcc631aeaac7b8f36acc4269531ab21be5ace Author: Brian West <brian@freeswitch.org> Date: Wed Sep 15 15:39:52 2010 -0500 improve defaults to cover more strange scenarios diff --git a/conf/sip_profiles/internal.xml b/conf/sip_profiles/internal.xml index e4af5cc..1c2ef12 100644 --- a/conf/sip_profiles/internal.xml +++ b/conf/sip_profiles/internal.xml @@ -116,7 +116,7 @@ <!-- used to share presence info across sofia profiles --> <!-- Name of the db to use for this profile --> <!--<param name="dbname" value="share_presence"/>--> - <!--<param name="presence-hosts" value="$${domain}"/>--> + <param name="presence-hosts" value="$${domain},$${local_ip_v4}"/> <!-- ************************************************* --> <!-- This setting is for AAL2 bitpacking on G726 --> commit 134b78c1038c8968f10a0e7bed97e73f7fd85699 Author: Konrad Hammel <konrad@sangoma.com> Date: Wed Sep 15 15:06:51 2010 -0400 freetdm: ss7 - updates to outgoing IAM and ACM diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index 311d87c..72da36f 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -103,11 +103,11 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) iam.fwdCallInd.end2EndInfoInd.pres = PRSNT_NODEF; iam.fwdCallInd.end2EndInfoInd.val = E2EINF_NOINFO; iam.fwdCallInd.isdnUsrPrtInd.pres = PRSNT_NODEF; - iam.fwdCallInd.isdnUsrPrtInd.val = ISUP_USED; + iam.fwdCallInd.isdnUsrPrtInd.val = ISUP_NOTUSED; iam.fwdCallInd.isdnUsrPrtPrfInd.pres = PRSNT_NODEF; - iam.fwdCallInd.isdnUsrPrtPrfInd.val = PREF_REQAW; + iam.fwdCallInd.isdnUsrPrtPrfInd.val = PREF_PREFAW; iam.fwdCallInd.isdnAccInd.pres = PRSNT_NODEF; - iam.fwdCallInd.isdnAccInd.val = ISDNACC_ISDN; + iam.fwdCallInd.isdnAccInd.val = ISDNACC_NONISDN; iam.fwdCallInd.sccpMethInd.pres = PRSNT_NODEF; iam.fwdCallInd.sccpMethInd.val = SCCPMTH_NOIND; @@ -179,11 +179,12 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) copy_cdPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cdPtyNum); /* copy down the calling number information */ + copy_cgPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cgPtyNum); /* check if the user would like a custom NADI value for the calling Pty Num */ nadi = ftdm_channel_get_var(ftdmchan, "ss7_nadi"); - if ((nadi != NULL) && (nadi != "")) { + if ((nadi != NULL) && (*nadi)) { SS7_DEBUG_CHAN(ftdmchan,"Found user supplied NADI value \"%s\"\n", nadi); iam.cgPtyNum.natAddrInd.val = atoi(nadi); } else { @@ -198,7 +199,9 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) &iam, 0); - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx IAM\n"); + SS7_INFO_CHAN(ftdmchan,"Tx IAM clg = \"%s\", cld = \"%s\"\n", + ftdmchan->caller_data.cid_num.digits, + ftdmchan->caller_data.dnis.digits); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; @@ -217,27 +220,27 @@ void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan) /* fill in the needed information for the ACM */ acm.bckCallInd.eh.pres = PRSNT_NODEF; acm.bckCallInd.chrgInd.pres = PRSNT_NODEF; - acm.bckCallInd.chrgInd.val = 0x00; + acm.bckCallInd.chrgInd.val = CHRG_CHRG; acm.bckCallInd.cadPtyStatInd.pres = PRSNT_NODEF; acm.bckCallInd.cadPtyStatInd.val = 0x01; acm.bckCallInd.cadPtyCatInd.pres = PRSNT_NODEF; - acm.bckCallInd.cadPtyCatInd.val = 0x00; + acm.bckCallInd.cadPtyCatInd.val = CADCAT_ORDSUBS; acm.bckCallInd.end2EndMethInd.pres = PRSNT_NODEF; - acm.bckCallInd.end2EndMethInd.val = 0x00; + acm.bckCallInd.end2EndMethInd.val = E2EMTH_NOMETH; acm.bckCallInd.intInd.pres = PRSNT_NODEF; - acm.bckCallInd.intInd.val = 0x00; + acm.bckCallInd.intInd.val = INTIND_NOINTW; acm.bckCallInd.end2EndInfoInd.pres = PRSNT_NODEF; - acm.bckCallInd.end2EndInfoInd.val = 0x00; + acm.bckCallInd.end2EndInfoInd.val = E2EINF_NOINFO; acm.bckCallInd.isdnUsrPrtInd.pres = PRSNT_NODEF; - acm.bckCallInd.isdnUsrPrtInd.val = 0x0; + acm.bckCallInd.isdnUsrPrtInd.val = ISUP_USED; acm.bckCallInd.holdInd.pres = PRSNT_NODEF; - acm.bckCallInd.holdInd.val = 0x00; + acm.bckCallInd.holdInd.val = HOLD_NOTREQD; acm.bckCallInd.isdnAccInd.pres = PRSNT_NODEF; - acm.bckCallInd.isdnAccInd.val = 0x0; + acm.bckCallInd.isdnAccInd.val = ISDNACC_NONISDN; acm.bckCallInd.echoCtrlDevInd.pres = PRSNT_NODEF; acm.bckCallInd.echoCtrlDevInd.val = 0x1; /* ec device present */ acm.bckCallInd.sccpMethInd.pres = PRSNT_NODEF; - acm.bckCallInd.sccpMethInd.val = 0x00; + acm.bckCallInd.sccpMethInd.val = SCCPMTH_NOIND; /* send the ACM request to LibSngSS7 */ sng_cc_con_status (1, diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 181b769..1e8e54a 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -74,9 +74,10 @@ uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum) int k; int j; int flag; + int odd; char tmp[2]; - unsigned char lower; - unsigned char upper; + uint8_t lower; + uint8_t upper; /**************************************************************************/ cgPtyNum->eh.pres = PRSNT_NODEF; @@ -106,81 +107,73 @@ uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum) k = 0; j = 0; flag = 0; + odd = 0; + upper = 0x0; + lower = 0x0; while (1) { + /* grab a digit from the ftdm digits */ tmp[0] = ftdm->cid_num.digits[k]; + /* check if the digit is a number and that is not null */ + while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) { + /* move on to the next value */ + k++; + tmp[0] = ftdm->cid_num.digits[k]; + } /* while(!(isdigit(tmp))) */ + + /* check if tmp is null or a digit */ if (tmp[0] != '\0') { - if (isdigit(tmp[0])) { - lower = atoi(&tmp[0]); + /* push it into the lower nibble */ + lower = atoi(&tmp[0]); + /* move to the next digit */ + k++; + /* grab a digit from the ftdm digits */ + tmp[0] = ftdm->cid_num.digits[k]; + + /* check if the digit is a number and that is not null */ + while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) { k++; tmp[0] = ftdm->cid_num.digits[k]; - } else { - while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) { - k++; - tmp[0] = ftdm->cid_num.digits[k]; - } /* while(!(isdigit(tmp))) */ - - if (tmp[0] != '\0') { - lower = atoi(&tmp[0]); - k++; - tmp[0] = ftdm->cid_num.digits[k]; - } else { - flag = 1; - lower = 0xf; - } /* if (tmp != '\0') */ - } /* (isdigit(tmp)) */ - } else { - flag = 1; - lower = 0xf; - } /* if (tmp != '\0') */ - - tmp[0] = ftdm->cid_num.digits[k]; + } /* while(!(isdigit(tmp))) */ - if (tmp[0] != '\0') { - if (isdigit(tmp[0])) { + /* check if tmp is null or a digit */ + if (tmp[0] != '\0') { + /* push the digit into the upper nibble */ upper = (atoi(&tmp[0])) << 4; } else { - while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) { - k++; - tmp[0] = ftdm->cid_num.digits[k]; - } /* while(!(isdigit(tmp))) */ - - if (tmp[0] != '\0') { - upper = (atoi(&tmp[0])) << 4; - k++; - } else { - flag = 1; - upper = 0xf; - } /* if (tmp != '\0') */ - } /* if (isdigit(tmp)) */ - } else { - if (flag == 1) { + /* there is no upper ... fill in 0 */ upper = 0x0; - } else { + /* throw the odd flag */ + odd = 1; + /* throw the end flag */ flag = 1; - upper = 0xf; - } /* if (flag == 1) */ - } /* if (tmp != '\0') */ + } /* if (tmp != '\0') */ + } else { + /* keep the odd flag down */ + odd = 0; + /* throw the flag */ + flag = 1; + } + /* push the digits into the trillium structure */ cgPtyNum->addrSig.val[j] = upper | lower; + /* increment the trillium pointer */ j++; - if (flag) { - break; - } else { - k++; - } + /* if the flag is up we're through all the digits */ + if (flag) break; + + /* move to the next digit */ + k++; } /* while(1) */ cgPtyNum->addrSig.len = j; /**************************************************************************/ cgPtyNum->oddEven.pres = PRSNT_NODEF; - - cgPtyNum->oddEven.val = ((cgPtyNum->addrSig.val[j] >> 4) == 0x0 ) ? 0x01 : 0x00; - + cgPtyNum->oddEven.val = odd; /**************************************************************************/ return 0; } @@ -198,9 +191,10 @@ uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum) int k; int j; int flag; + int odd; char tmp[2]; - unsigned char lower; - unsigned char upper; + uint8_t lower; + uint8_t upper; /**************************************************************************/ cdPtyNum->eh.pres = PRSNT_NODEF; @@ -219,77 +213,74 @@ uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum) /* atoi will search through memory starting from the pointer it is given until * it finds the \0...since tmp is on the stack it will start going through the * possibly causing corruption. Hard code a \0 to prevent this - */ + */ /* dnis */ tmp[1] = '\0'; k = 0; j = 0; flag = 0; + odd = 0; + upper = 0x0; + lower = 0x0; while (1) { + /* grab a digit from the ftdm digits */ tmp[0] = ftdm->dnis.digits[k]; + /* check if the digit is a number and that is not null */ + while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) { + /* move on to the next value */ + k++; + tmp[0] = ftdm->dnis.digits[k]; + } /* while(!(isdigit(tmp))) */ + + /* check if tmp is null or a digit */ if (tmp[0] != '\0') { - if (isdigit(tmp[0])) { - lower = atoi(&tmp[0]); + /* push it into the lower nibble */ + lower = atoi(&tmp[0]); + /* move to the next digit */ + k++; + /* grab a digit from the ftdm digits */ + tmp[0] = ftdm->dnis.digits[k]; + + /* check if the digit is a number and that is not null */ + while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) { k++; tmp[0] = ftdm->dnis.digits[k]; - } else { - while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) { - k++; - tmp[0] = ftdm->dnis.digits[k]; - } /* while(!(isdigit(tmp))) */ - - if (tmp[0] != '\0') { - lower = atoi(&tmp[0]); - k++; - tmp[0] = ftdm->dnis.digits[k]; - } else { - flag = 1; - lower = 0xf; - } /* if (tmp != '\0') */ - } /* (isdigit(tmp)) */ - } else { - flag = 1; - lower = 0xf; - } /* if (tmp != '\0') */ + } /* while(!(isdigit(tmp))) */ - tmp[0] = ftdm->dnis.digits[k]; - - if (tmp[0] != '\0') { - if (isdigit(tmp[0])) { + /* check if tmp is null or a digit */ + if (tmp[0] != '\0') { + /* push the digit into the upper nibble */ upper = (atoi(&tmp[0])) << 4; } else { - while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) { - k++; - tmp[0] = ftdm->dnis.digits[k]; - } /* while(!(isdigit(tmp))) */ - - if (tmp[0] != '\0') { - upper = (atoi(&tmp[0])) << 4; - k++; - } else { - flag = 1; - upper = 0xf; - } /* if (tmp != '\0') */ - } /* if (isdigit(tmp)) */ - } else { - if (flag == 1) { - upper = 0x0; - } else { + /* there is no upper ... fill in ST */ + upper = 0xF; + /* throw the odd flag */ + odd = 1; + /* throw the end flag */ flag = 1; - upper = 0xf; - } /* if (flag == 1) */ - } /* if (tmp != '\0') */ + } /* if (tmp != '\0') */ + } else { + /* keep the odd flag down */ + odd = 1; + /* need to add the ST */ + lower = 0xF; + upper = 0x0; + /* throw the flag */ + flag = 1; + } + /* push the digits into the trillium structure */ cdPtyNum->addrSig.val[j] = upper | lower; + /* increment the trillium pointer */ j++; - if (flag) { - break; - } else { - k++; - } + /* if the flag is up we're through all the digits */ + if (flag) break; + + /* move to the next digit */ + k++; } /* while(1) */ cdPtyNum->addrSig.len = j; @@ -297,7 +288,7 @@ uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum) /**************************************************************************/ cdPtyNum->oddEven.pres = PRSNT_NODEF; - cdPtyNum->oddEven.val = ((cdPtyNum->addrSig.val[j] >> 4) == 0x0 ) ? 0x01 : 0x00; + cdPtyNum->oddEven.val = odd; /**************************************************************************/ return 0; commit 9c22b0d0f44cfc62c64fdbd60d1d0c1672ceab22 Author: Brian West <brian@freeswitch.org> Date: Wed Sep 15 11:02:12 2010 -0500 MODENDP-327 diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 32d380d..67b63a1 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1135,7 +1135,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand } if (exptime) { - const char *agent = "dunno"; + const char *agent = "unknown"; char guess_ip4[256]; const char *username = "unknown"; const char *realm = reg_host; commit 9835395c73ed58957ffe3170bfed85d8a6aa2382 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Sep 15 10:58:12 2010 -0500 MDXMLINT-57 diff --git a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c index 34873f7..2e9a1a3 100644 --- a/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c +++ b/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c @@ -275,7 +275,6 @@ static abyss_bool is_authorized(const TSession * r, const char *command) err = 686; - status = "EXECUTION OF SPECIFIED API COMMAND NOT PERMITTED IN USER ACCOUNT"; if (!user_attributes(user, domain_name, NULL, NULL, NULL, &allowed_commands)) { goto end; @@ -305,11 +304,6 @@ static abyss_bool is_authorized(const TSession * r, const char *command) if (!ok) { ResponseStatus(r, err); - if (status) { - ResponseError2(r, status); - } else { - ResponseError(r); - } } commit 283b7a85b825febf2bda0d650505d400816ab178 Author: Michael Jerris <mike@jerris.com> Date: Wed Sep 15 02:57:31 2010 -0400 FSBUILD-304: Fix compile error due to incorrect format specifier diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 5772e9f..b5b2ef2 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -920,7 +920,7 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, if (new_mlen < runtime.max_sql_buffer_len) { sql_len = new_mlen; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, - "REALLOC %ld %d %d\n", sql_len, switch_queue_size(sql_manager.sql_queue[0]), + "REALLOC %ld %d %d\n", (long int)sql_len, switch_queue_size(sql_manager.sql_queue[0]), switch_queue_size(sql_manager.sql_queue[1])); if (!(tmp = realloc(sqlbuf, sql_len))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL thread ending on mem err\n"); commit 4d29df1fe49fbcd8226b0b492831b1e6b22ee16c Author: Michael S Collins <msc@freeswitch.org> Date: Tue Sep 14 17:14:53 2010 -0700 Update .gitignore diff --git a/libs/.gitignore b/libs/.gitignore index 24e32c1..cc42ba4 100644 --- a/libs/.gitignore +++ b/libs/.gitignore @@ -355,6 +355,7 @@ /libsndfile/Cfg/missing /libsndfile/M4/Makefile /libsndfile/M4/Makefile.in +/libsndfile/M4/lt~obsolete.m4 /libsndfile/Makefile /libsndfile/Makefile.in /libsndfile/Octave/Makefile commit 54ba998f6c6564c9ea9efb8832c0bcbd61e834e4 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Sep 14 16:23:31 2010 -0500 formating diff --git a/src/tone2wav.c b/src/tone2wav.c index bf51e3a..4415860 100644 --- a/src/tone2wav.c +++ b/src/tone2wav.c @@ -171,7 +171,7 @@ int main(int argc, char *argv[]) teletone_destroy_session(&ts); switch_core_file_close(&fh); - printf("File: %s generated.....\nPlease support:\n\nFreeSWITCH http://www.freeswitch.org\nClueCon http://www.cluecon.com\n", file); + printf("File: %s generated.....\n\nPlease support:\nFreeSWITCH http://www.freeswitch.org\nClueCon http://www.cluecon.com\n", file); end: commit 6e23f3bef611c974433ed98348affde23f732b2b Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Sep 14 16:22:21 2010 -0500 fix spelling err diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 2ae5048..dd37698 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1256,7 +1256,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread if (sofia_test_pflag(profile, PFLAG_SQL_IN_TRANS)) { if (qsize > 0 && (qsize >= 1024 || ++loop_count >= profile->trans_timeout)) { switch_size_t newlen; - uint32_t itterations = 0; + uint32_t iterations = 0; switch_size_t len = 0; switch_mutex_lock(profile->ireg_mutex); @@ -1265,7 +1265,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread if (!sql) sql = (char *) pop; newlen = strlen(sql) + 2; - itterations++; + iterations++; if (len + newlen + 10 > sql_len) { int new_mlen = len + newlen + 10 + 10240; diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index dfb4134..5772e9f 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -851,7 +851,7 @@ SWITCH_DECLARE(switch_bool_t) switch_cache_db_test_reactive(switch_cache_db_hand static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, void *obj) { void *pop; - uint32_t itterations = 0; + uint32_t iterations = 0; uint8_t trans = 0; uint32_t target = 20000; switch_size_t len = 0, sql_len = runtime.sql_buffer_len; @@ -910,7 +910,7 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, if (sql) { newlen = strlen(sql) + 2; - if (itterations == 0) { + if (iterations == 0) { trans = 1; } @@ -935,7 +935,7 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, } } - itterations++; + iterations++; sprintf(sqlbuf + len, "%s;\n", sql); len += newlen; free(sql); @@ -950,14 +950,14 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, lc = sql ? 1 : 0 + switch_queue_size(sql_manager.sql_queue[0]) + switch_queue_size(sql_manager.sql_queue[1]); - if (trans && itterations && (itterations > target || !lc)) { + if (trans && iterations && (iterations > target || !lc)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, - "RUN %d %d %d\n", switch_queue_size(sql_manager.sql_queue[0]), switch_queue_size(sql_manager.sql_queue[1]), itterations); + "RUN %d %d %d\n", switch_queue_size(sql_manager.sql_queue[0]), switch_queue_size(sql_manager.sql_queue[1]), iterations); if (switch_cache_db_persistant_execute_trans(sql_manager.event_db, sqlbuf, 1) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL thread unable to commit transaction, records lost!\n"); } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "DONE\n"); - itterations = 0; + iterations = 0; trans = 0; len = 0; *sqlbuf = '\0'; commit ef79535c45fde4a01e6df7e7ca28633649949c7b Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Sep 14 16:19:03 2010 -0500 add nitrus boost to sql thread diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index 50dde95..e77d5f7 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -233,6 +233,8 @@ struct switch_runtime { switch_profile_timer_t *profile_timer; double profile_time; double min_idle_time; + int sql_buffer_len; + int max_sql_buffer_len; }; extern struct switch_runtime runtime; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 4d9ce9e..2ae5048 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1225,7 +1225,7 @@ static void sofia_perform_profile_start_failure(sofia_profile_t *profile, char * #define sofia_profile_start_failure(p, xp) sofia_perform_profile_start_failure(p, xp, __FILE__, __LINE__) -#define SQLLEN 1024 * 32 +#define SQLLEN 1024 * 1024 void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread, void *obj) { sofia_profile_t *profile = (sofia_profile_t *) obj; @@ -1235,10 +1235,10 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread uint32_t qsize; void *pop; int loop_count = 0; - switch_size_t sql_len = SQLLEN; - char *sqlbuf = NULL; + switch_size_t sql_len = 1024 * 32; + char *tmp, *sqlbuf = NULL; char *sql = NULL; - + if (sofia_test_pflag(profile, PFLAG_SQL_IN_TRANS)) { sqlbuf = (char *) malloc(sql_len); } @@ -1254,33 +1254,43 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread while ((mod_sofia_globals.running == 1 && sofia_test_pflag(profile, PFLAG_RUNNING)) || qsize) { if (sofia_test_pflag(profile, PFLAG_SQL_IN_TRANS)) { - if ((qsize > 0 && (qsize >= 1024 || ++loop_count >= profile->trans_timeout)) || sql) { + if (qsize > 0 && (qsize >= 1024 || ++loop_count >= profile->trans_timeout)) { switch_size_t newlen; uint32_t itterations = 0; switch_size_t len = 0; switch_mutex_lock(profile->ireg_mutex); - //sofia_glue_actually_execute_sql(profile, "begin;\n", NULL); - while (sql || (switch_queue_trypop(profile->sql_queue, &pop) == SWITCH_STATUS_SUCCESS && pop)) { - - if (!sql) { - sql = (char *) pop; - } - + if (!sql) sql = (char *) pop; + newlen = strlen(sql) + 2; itterations++; - - if (len + newlen + 10 < sql_len) { - sprintf(sqlbuf + len, "%s;\n", sql); - len += newlen; - switch_safe_free(sql); - } else { - break; + + if (len + newlen + 10 > sql_len) { + int new_mlen = len + newlen + 10 + 10240; + + if (new_mlen < SQLLEN) { + sql_len = new_mlen; + + if (!(tmp = realloc(sqlbuf, sql_len))) { + abort(); + break; + } + sqlbuf = tmp; + } else { + goto skip; + } } + + sprintf(sqlbuf + len, "%s;\n", sql); + len += newlen; + free(sql); + sql = NULL; } - + + skip: + //printf("TRANS:\n%s\n", sqlbuf); sofia_glue_actually_execute_sql_trans(profile, sqlbuf, NULL); //sofia_glue_actually_execute_sql(profile, "commit;\n", NULL); diff --git a/src/switch_core.c b/src/switch_core.c index 0a45723..2c33b34 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1222,7 +1222,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc } runtime.runlevel++; - + runtime.sql_buffer_len = 1024 * 32; + runtime.max_sql_buffer_len = 1024 * 1024; runtime.dummy_cng_frame.data = runtime.dummy_data; runtime.dummy_cng_frame.datalen = sizeof(runtime.dummy_data); runtime.dummy_cng_frame.buflen = sizeof(runtime.dummy_data); @@ -1440,6 +1441,37 @@ static void switch_load_core_config(const char *file) if (tmp > -1 && tmp < 11) { switch_core_session_ctl(SCSC_DEBUG_LEVEL, &tmp); } + } else if (!strcasecmp(var, "sql-buffer-len")) { + int tmp = atoi(val); + + if (end_of(val) == 'k') { + tmp *= 1024; + } else if (end_of(val) == 'm') { + tmp *= (1024 * 1024); + } + + if (tmp >= 32000 && tmp < 10500000) { + runtime.sql_buffer_len = tmp; + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "sql-buffer-len: Value is not within rage 32k to 10m\n"); + } + } else if (!strcasecmp(var, "max-sql-buffer-len")) { + int tmp = atoi(val); + + if (end_of(val) == 'k') { + tmp *= 1024; + } else if (end_of(val) == 'm') { + tmp *= (1024 * 1024); + } + + if (tmp < runtime.sql_buffer_len) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Value is not larger than sql-buffer-len\n"); + } else if (tmp >= 32000 && tmp < 10500000) { + runtime.sql_buffer_len = tmp; + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "max-sql-buffer-len: Value is not within rage 32k to 10m\n"); + } + } else if (!strcasecmp(var, "auto-create-schemas")) { if (switch_true(val)) { switch_set_flag((&runtime), SCF_AUTO_SCHEMAS); diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index b1815b0..dfb4134 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -35,8 +35,6 @@ #include <switch.h> #include "private/switch_core_pvt.h" -#define SQLLEN 32768 - static struct { switch_cache_db_handle_t *event_db; switch_queue_t *sql_queue[2]; @@ -48,6 +46,8 @@ static struct { switch_mutex_t *io_mutex; switch_mutex_t *dbh_mutex; switch_hash_t *dbh_hash; + switch_thread_cond_t *cond; + switch_mutex_t *cond_mutex; } sql_manager; @@ -539,7 +539,7 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql(switch_cache_db_hand switch (dbh->type) { default: { - status = switch_cache_db_execute_sql_chunked(dbh, (char *) sql, SQLLEN, err); + status = switch_cache_db_execute_sql_chunked(dbh, (char *) sql, 32768, err); } break; } @@ -850,19 +850,18 @@ SWITCH_DECLARE(switch_bool_t) switch_cache_db_test_reactive(switch_cache_db_hand static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, void *obj) { - void *pop = NULL; + void *pop; uint32_t itterations = 0; - uint8_t trans = 0, nothing_in_queue = 0; - uint32_t target = 100000; - switch_size_t len = 0, sql_len = SQLLEN; - char *sqlbuf = (char *) malloc(sql_len); + uint8_t trans = 0; + uint32_t target = 20000; + switch_size_t len = 0, sql_len = runtime.sql_buffer_len; + char *tmp, *sqlbuf = (char *) malloc(sql_len); char *sql = NULL; switch_size_t newlen; int lc = 0; uint32_t loops = 0, sec = 0; uint32_t l1 = 1000; uint32_t sanity = 120; - int item_remained = 0; switch_assert(sqlbuf); @@ -887,6 +886,9 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, sql_manager.thread_running = 1; while (sql_manager.thread_running == 1) { + + switch_mutex_lock(sql_manager.cond_mutex); + if (++loops == l1) { if (++sec == SQL_CACHE_TIMEOUT) { sql_close(switch_epoch_time_now(NULL)); @@ -900,17 +902,11 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, continue; } - //printf("SIZE %d %d\n", switch_queue_size(sql_manager.sql_queue[0]), switch_queue_size(sql_manager.sql_queue[1])); - - if (item_remained || switch_queue_trypop(sql_manager.sql_queue[0], &pop) == SWITCH_STATUS_SUCCESS || + if (sql || switch_queue_trypop(sql_manager.sql_queue[0], &pop) == SWITCH_STATUS_SUCCESS || switch_queue_trypop(sql_manager.sql_queue[1], &pop) == SWITCH_STATUS_SUCCESS) { - if (item_remained) { - item_remained = 0; - } else { - sql = (char *) pop; - } - + if (!sql) sql = (char *) pop; + if (sql) { newlen = strlen(sql) + 2; @@ -918,45 +914,59 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, trans = 1; } - /* ignore abnormally large strings sql strings as potential buffer overflow */ - if (newlen < SQLLEN) { - itterations++; + if (len + newlen > sql_len) { + int new_mlen = len + newlen + 10240; - if (len + newlen < sql_len) { - sprintf(sqlbuf + len, "%s;\n", sql); - len += newlen; + if (new_mlen < runtime.max_sql_buffer_len) { + sql_len = new_mlen; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, + "REALLOC %ld %d %d\n", sql_len, switch_queue_size(sql_manager.sql_queue[0]), + switch_queue_size(sql_manager.sql_queue[1])); + if (!(tmp = realloc(sqlbuf, sql_len))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL thread ending on mem err\n"); + abort(); + break; + } + sqlbuf = tmp; } else { - item_remained = 1; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, + "SAVE %d %d\n", switch_queue_size(sql_manager.sql_queue[0]), switch_queue_size(sql_manager.sql_queue[1])); + goto skip; } } - - if (!item_remained) { - free(sql); - } + + itterations++; + sprintf(sqlbuf + len, "%s;\n", sql); + len += newlen; + free(sql); + sql = NULL; } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "SQL thread ending\n"); break; } - } else { - nothing_in_queue = 1; } - - if ((item_remained || (trans && ((itterations == target) || (nothing_in_queue && ++lc >= 500)))) && - (sql_manager.event_db->native_handle.core_db_dbh)) { + skip: + + lc = sql ? 1 : 0 + switch_queue_size(sql_manager.sql_queue[0]) + switch_queue_size(sql_manager.sql_queue[1]); + + if (trans && itterations && (itterations > target || !lc)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, + "RUN %d %d %d\n", switch_queue_size(sql_manager.sql_queue[0]), switch_queue_size(sql_manager.sql_queue[1]), itterations); if (switch_cache_db_persistant_execute_trans(sql_manager.event_db, sqlbuf, 1) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL thread unable to commit transaction, records lost!\n"); } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "DONE\n"); itterations = 0; trans = 0; - nothing_in_queue = 0; len = 0; *sqlbuf = '\0'; lc = 0; + switch_yield(400000); } - if (nothing_in_queue) { - switch_cond_next(); + if (!lc) { + switch_thread_cond_wait(sql_manager.cond, sql_manager.cond_mutex); } } @@ -1389,6 +1399,7 @@ static void core_event_handler(switch_event_t *event) switch_queue_push(sql_manager.sql_queue[0], sql[i]); } sql[i] = NULL; + switch_thread_cond_broadcast(sql_manager.cond); } } } @@ -1511,6 +1522,9 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_ switch_mutex_init(&sql_manager.dbh_mutex, SWITCH_MUTEX_NESTED, sql_manager.memory_pool); switch_mutex_init(&sql_manager.io_mutex, SWITCH_MUTEX_NESTED, sql_manager.memory_pool); + switch_mutex_init(&sql_manager.cond_mutex, SWITCH_MUTEX_NESTED, sql_manager.memory_pool); + + switch_thread_cond_create(&sql_manager.cond, sql_manager.memory_pool); switch_core_hash_init(&sql_manager.dbh_hash, sql_manager.memory_pool); commit 8ea90fb17aa89af353e7ddf16b908436780f2322 Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Tue Sep 14 15:30:36 2010 -0400 switch_core_sqldb: Simple spelling correction of log output diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 51e7661..b1815b0 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -346,7 +346,7 @@ SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle(switch_cache_db_h { if (!switch_odbc_available()) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failure! OBDC NOT AVAILABLE!\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failure! ODBC NOT AVAILABLE!\n"); goto end; } commit 51df54ece3c49584315a45e5ebe2e9b7cd0ebaba Merge: d47d32e d31c24d Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Tue Sep 14 15:29:51 2010 -0400 Merge branch 'master' of ssh://git.freeswitch.org/freeswitch commit 0ee84ea57b9dc9609d20d72e2b92972bd56ee331 Author: Konrad Hammel <konrad@sangoma.com> Date: Tue Sep 14 11:14:15 2010 -0400 freetdm: ss7 - added support for NADI value in sip x-headers diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index 5064d48..263b599 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -82,6 +82,9 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ sngss7_chan_data_t *sngss7_info = NULL; ftdm_channel_t *ftdmchan = NULL; + char nadi[2]; + + memset(nadi, '\0', sizeof(nadi)); /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { @@ -212,7 +215,8 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ } /* add any special variables for the dialplan */ - /*ftdm_channel_add_var(ftdmchan, "ss7_stuff", "s");*/ + sprintf(nadi, "%d", siConEvnt->cgPtyNum.natAddrInd.val); + ftdm_channel_add_var(ftdmchan, "ss7_nadi", nadi); /* set the state of the channel to collecting...the rest is done by the chan monitor */ ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index 879fcd2..311d87c 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -73,8 +73,9 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) { SS7_FUNC_TRACE_ENTER (__FUNCTION__); - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;; - SiConEvnt iam; + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;; + const char *nadi = NULL; + SiConEvnt iam; sngss7_info->suInstId = get_unique_id (); sngss7_info->spInstId = 0; @@ -179,7 +180,17 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) /* copy down the calling number information */ copy_cgPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cgPtyNum); - + + /* check if the user would like a custom NADI value for the calling Pty Num */ + nadi = ftdm_channel_get_var(ftdmchan, "ss7_nadi"); + if ((nadi != NULL) && (nadi != "")) { + SS7_DEBUG_CHAN(ftdmchan,"Found user supplied NADI value \"%s\"\n", nadi); + iam.cgPtyNum.natAddrInd.val = atoi(nadi); + } else { + SS7_DEBUG_CHAN(ftdmchan,"No user supplied NADI value found, using \"3\" %s\n", " "); + iam.cgPtyNum.natAddrInd.val = 0x03; + } + sng_cc_con_request (sngss7_info->spId, sngss7_info->suInstId, sngss7_info->spInstId, commit 5812c5fd53322940c5627703d57dd3d1d22ed6e5 Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Sep 8 19:41:34 2010 -0400 freetdm: Used channel iterator. Removed assert when we cannot find a call on RelInd, it seems like Trillium as a bug where they sometimes send release twice Fixes to some memory leaks Fix for bug in q921 trace disable command Fix for not recognizing etsi switchtype Fix for sending RESTART when we are not supposed to in EUROISDN NETWORK mode Support for l1 stats Fix for deadlocks/segfaults on shutdown Added index per link_id, support for show_spans Added progress-ind when sending CONNECT message Fix for sending CONNECT ACK when configured as TE diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index c70e0f9..b4a40f0 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -2182,9 +2182,8 @@ static void ftdm_logger(const char *file, const char *func, int line, int level, if (switch_vasprintf(&data, fmt, ap) != -1) { switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, (char *)func, line, NULL, level, "%s", data); - free(data); } - + if (data) free(data); va_end(ap); } diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 49b61ee..6991e9a 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -463,6 +463,7 @@ static ftdm_status_t ftdm_span_destroy(ftdm_span_t *span) status = FTDM_FAIL; } ftdm_safe_free(span->type); + ftdm_safe_free(span->name); ftdm_safe_free(span->dtmf_hangup); } @@ -536,7 +537,7 @@ static void ftdm_span_add(ftdm_span_t *span) } else { globals.spans = span; } - hashtable_insert(globals.span_hash, (void *)span->name, span, HASHTABLE_FLAG_NONE); + hashtable_insert(globals.span_hash, (void *)span->name, span, HASHTABLE_FLAG_FREE_VALUE); ftdm_mutex_unlock(globals.span_mutex); } @@ -3550,12 +3551,20 @@ static ftdm_iterator_t *get_iterator(ftdm_iterator_type_t type, ftdm_iterator_t FT_DECLARE(ftdm_iterator_t *) ftdm_channel_get_var_iterator(const ftdm_channel_t *ftdmchan, ftdm_iterator_t *iter) { + ftdm_hash_iterator_t *hashiter = NULL; + ftdm_channel_lock(ftdmchan); + hashiter = ftdmchan->variable_hash == NULL ? NULL : hashtable_first(ftdmchan->variable_hash); + ftdm_channel_unlock(ftdmchan); + + + if (hashiter == NULL) { + return NULL; + } + if (!(iter = get_iterator(FTDM_ITERATOR_VARS, iter))) { return NULL; } - ftdm_channel_lock(ftdmchan); - iter->pvt.hashiter = ftdmchan->variable_hash == NULL ? NULL : hashtable_first(ftdmchan->variable_hash); - ftdm_channel_unlock(ftdmchan); + iter->pvt.hashiter = hashiter; return iter; } @@ -4837,11 +4846,13 @@ FT_DECLARE(ftdm_status_t) ftdm_global_destroy(void) ftdm_mutex_lock(globals.mutex); hashtable_destroy(globals.interface_hash); - hashtable_destroy(globals.module_hash); + hashtable_destroy(globals.module_hash); hashtable_destroy(globals.span_hash); + hashtable_destroy(globals.group_hash); ftdm_mutex_unlock(globals.mutex); ftdm_mutex_destroy(&globals.mutex); ftdm_mutex_destroy(&globals.span_mutex); + ftdm_mutex_destroy(&globals.group_mutex); memset(&globals, 0, sizeof(globals)); return FTDM_SUCCESS; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index e962ece..08f340d 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -472,10 +472,7 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) case FTDM_CHANNEL_STATE_RING: /* incoming call request */ { ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending incoming call from %s to %s to FTDM core\n", ftdmchan->caller_data.ani.digits, ftdmchan->caller_data.dnis.digits); - ftdm_channel_add_var(ftdmchan, "isdn_specific_var", "1"); - ftdm_channel_add_var(ftdmchan, "isdn_crap", "morecrap"); - ftdm_channel_add_var(ftdmchan, "isdn_stuff", "s"); - ftdm_channel_add_var(ftdmchan, "isdn_d", "asdsadasdasdsad"); + /* we have enough information to inform FTDM of the call*/ sigev.event_id = FTDM_SIGEVENT_START; ftdm_span_send_signal(ftdmchan->span, &sigev); @@ -694,7 +691,7 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(ftdm_sangoma_isdn_outgoing_call) return status; } -static FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(ftdm_sangoma_isdn_get_sig_status) +static FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(ftdm_sangoma_isdn_get_chan_sig_status) { if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) { *status = FTDM_SIG_STATE_UP; @@ -705,17 +702,34 @@ static FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(ftdm_sangoma_isdn_get_sig_status) return FTDM_SUCCESS; } -static FIO_CHANNEL_SET_SIG_STATUS_FUNCTION(ftdm_sangoma_isdn_set_sig_status) +static FIO_CHANNEL_SET_SIG_STATUS_FUNCTION(ftdm_sangoma_isdn_set_chan_sig_status) { ftdm_log(FTDM_LOG_ERROR,"Cannot set channel status in this module\n"); return FTDM_NOTIMPL; } +static FIO_SPAN_GET_SIG_STATUS_FUNCTION(ftdm_sangoma_isdn_get_span_sig_status) +{ + if (ftdm_test_flag(span->channels[1], FTDM_CHANNEL_SIG_UP)) { + *status = FTDM_SIG_STATE_UP; + } else { + *status = FTDM_SIG_STATE_DOWN; + } + + return FTDM_SUCCESS; +} + +static FIO_SPAN_SET_SIG_STATUS_FUNCTION(ftdm_sangoma_isdn_set_span_sig_status) +{ + ftdm_log(FTDM_LOG_ERROR,"Cannot set span status in this module\n"); + return FTDM_NOTIMPL; +} + static ftdm_status_t ftdm_sangoma_isdn_start(ftdm_span_t *span) { ftdm_log(FTDM_LOG_INFO,"Starting span %s:%u.\n",span->name,span->span_id); - if (sng_isdn_stack_activate(span) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "Failed to activate span %s\n", span->name); + if (sng_isdn_stack_start(span) != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_CRIT, "Failed to start span %s\n", span->name); return FTDM_FAIL; } /* clear the monitor thread stop flag */ @@ -734,7 +748,8 @@ static ftdm_status_t ftdm_sangoma_isdn_start(ftdm_span_t *span) static ftdm_status_t ftdm_sangoma_isdn_stop(ftdm_span_t *span) { - unsigned i; + ftdm_iterator_t *chaniter = NULL; + ftdm_iterator_t *curr = NULL; ftdm_log(FTDM_LOG_INFO, "Stopping span %s\n", span->name); /* throw the STOP_THREAD flag to signal monitor thread stop */ @@ -746,11 +761,19 @@ static ftdm_status_t ftdm_sangoma_isdn_stop(ftdm_span_t *span) ftdm_sleep(10); } - /* FIXME: deconfigure any links, attached to this span */ - /* TODO: Use Moy's channel Iterator when its implemented */ - for (i=1;i<=span->chan_count;i++) { - ftdm_safe_free(span->channels[i]->call_data); + if (sng_isdn_stack_stop(span) != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_CRIT, "Failed to stop span %s\n", span->name); + } + + chaniter = ftdm_span_get_chan_iterator(span, NULL); + for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { + ftdm_safe_free(((ftdm_channel_t*)ftdm_iterator_current(curr))->call_data); + ((ftdm_channel_t*)ftdm_iterator_current(curr))->call_data = NULL; } + ftdm_iterator_free(chaniter); + + ftdm_sched_destroy(&((sngisdn_span_data_t*)span->signal_data)->sched); + ftdm_queue_destroy(&((sngisdn_span_data_t*)span->signal_data)->event_queue); ftdm_safe_free(span->signal_data); ftdm_log(FTDM_LOG_DEBUG, "Finished stopping span %s\n", span->name); @@ -760,6 +783,9 @@ static ftdm_status_t ftdm_sangoma_isdn_stop(ftdm_span_t *span) static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_isdn_span_config) { + ftdm_iterator_t *chaniter = NULL; + ftdm_iterator_t *curr = NULL; + sngisdn_span_data_t *span_data; ftdm_log(FTDM_LOG_INFO, "Configuring ftmod_sangoma_isdn span = %s\n", span->name); @@ -767,13 +793,15 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_isdn_span_config) span_data = ftdm_calloc(1, sizeof(sngisdn_span_data_t)); span_data->ftdm_span = span; span->signal_data = span_data; - - unsigned i; - for (i=1;i <= span->chan_count; i++) { + + chaniter = ftdm_span_get_chan_iterator(span, NULL); + for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { sngisdn_chan_data_t *chan_data = ftdm_calloc(1, sizeof(sngisdn_chan_data_t)); - chan_data->ftdmchan = span->channels[i]; - span->channels[i]->call_data = chan_data; + chan_data->ftdmchan = ((ftdm_channel_t*)ftdm_iterator_current(curr)); + ((ftdm_channel_t*)ftdm_iterator_current(curr))->call_data = chan_data; + } + ftdm_iterator_free(chaniter); if (ftmod_isdn_parse_cfg(ftdm_parameters, span) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_ERROR, "Failed to parse configuration\n"); @@ -792,8 +820,10 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_isdn_span_config) span->outgoing_call = ftdm_sangoma_isdn_outgoing_call; span->channel_request = NULL; span->signal_cb = sig_cb; - span->get_channel_sig_status = ftdm_sangoma_isdn_get_sig_status; - span->set_channel_sig_status = ftdm_sangoma_isdn_set_sig_status; + span->get_channel_sig_status = ftdm_sangoma_isdn_get_chan_sig_status; + span->set_channel_sig_status = ftdm_sangoma_isdn_set_chan_sig_status; + span->get_span_sig_status = ftdm_sangoma_isdn_get_span_sig_status; + span->set_span_sig_status = ftdm_sangoma_isdn_set_span_sig_status; span->state_map = &sangoma_isdn_state_map; ftdm_set_flag(span, FTDM_SPAN_USE_CHAN_QUEUE); ftdm_set_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE); @@ -855,7 +885,7 @@ static FIO_SIG_LOAD_FUNCTION(ftdm_sangoma_isdn_init) for(i=1;i<=MAX_VARIANTS;i++) { ftdm_mutex_create(&g_sngisdn_data.ccs[i].mutex); } - + /* initalize sng_isdn library */ sng_isdn_init(&g_sngisdn_event_interface); return FTDM_SUCCESS; @@ -923,16 +953,35 @@ static FIO_API_FUNCTION(ftdm_sangoma_isdn_api) if (!strcasecmp(argv[0], "l1_stats")) { ftdm_span_t *span; if (argc < 2) { - ftdm_log(FTDM_LOG_ERROR, "Usage: ftdm sangoma_isdn l1_stats <span name>\n"); + stream->write_function(stream, "Usage: ftdm sangoma_isdn l1_stats <span name>\n"); status = FTDM_FAIL; goto done; } status = ftdm_span_find_by_name(argv[1], &span); if (FTDM_SUCCESS != status) { - stream->write_function(stream, "-ERR failed to find span by name %s\n", argv[2]); + stream->write_function(stream, "-ERR failed to find span with name %s\n", argv[1]); + /* Return SUCCESS because we do not want to print the general FTDM usage list */ + status = FTDM_SUCCESS; + goto done; + } + sngisdn_print_phy_stats(stream, span); + } + + if (!strcasecmp(argv[0], "show_spans")) { + ftdm_span_t *span = NULL; + if (argc == 2) { + status = ftdm_span_find_by_name(argv[1], &span); + if (FTDM_SUCCESS != status) { + stream->write_function(stream, "-ERR failed to find span with name %s\n", argv[1]); + /* Return SUCCESS because we do not want to print the general FTDM usage list */ + status = FTDM_SUCCESS; + goto done; + } + sngisdn_print_span(stream, span); + status = FTDM_SUCCESS; goto done; } - /* TODO: implement PHY stats */ + sngisdn_print_spans(stream); } if (!strcasecmp(argv[0], "check_ids")) { sngisdn_check_free_ids(); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 5f26828..cd96a18 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -243,7 +243,8 @@ typedef struct ftdm_sngisdn_data { uint8_t num_cc; /* 1 ent per switchtype */ struct sngisdn_cc ccs[MAX_VARIANTS+1]; uint8_t num_dchan; - sngisdn_dchan_data_t dchans[MAX_L1_LINKS+1]; + sngisdn_dchan_data_t dchans[MAX_L1_LINKS+1]; + sngisdn_span_data_t *spans[MAX_L1_LINKS+1]; /* spans are indexed by link_id */ }ftdm_sngisdn_data_t; @@ -363,9 +364,12 @@ void sngisdn_facility_timeout(void* p_sngisdn_info); /* Stack management functions */ ftdm_status_t sng_isdn_stack_cfg(ftdm_span_t *span); -ftdm_status_t sng_isdn_stack_activate(ftdm_span_t *span); - +ftdm_status_t sng_isdn_stack_start(ftdm_span_t *span); +ftdm_status_t sng_isdn_stack_stop(ftdm_span_t *span); +void sngisdn_print_phy_stats(ftdm_stream_handle_t *stream, ftdm_span_t *span); +void sngisdn_print_spans(ftdm_stream_handle_t *stream); +void sngisdn_print_span(ftdm_stream_handle_t *stream, ftdm_span_t *span); #endif /* __FTMOD_SNG_ISDN_H__ */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c index 96eaf05..361b389 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c @@ -62,7 +62,8 @@ ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span) } break; case FTDM_TRUNK_E1: - if (!strcasecmp(switch_name, "euroisdn") || strcasecmp(switch_name, "etsi")) { + if (!strcasecmp(switch_name, "euroisdn") || + !strcasecmp(switch_name, "etsi")) { signal_data->switchtype = SNGISDN_SWITCH_EUROISDN; } else if (!strcasecmp(switch_name, "qsig")) { signal_data->switchtype = SNGISDN_SWITCH_QSIG; @@ -116,6 +117,8 @@ ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span) signal_data->span_id = dchan_data->num_spans; dchan_data->spans[signal_data->span_id] = signal_data; + + g_sngisdn_data.spans[signal_data->link_id] = signal_data; ftdm_log(FTDM_LOG_DEBUG, "%s: cc_id:%d dchan_id:%d span_id:%d\n", span->name, signal_data->cc_id, signal_data->dchan_id, signal_data->span_id); @@ -163,6 +166,7 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ signal_data->overlap_dial = SNGISDN_OPT_DEFAULT; signal_data->setup_arb = SNGISDN_OPT_DEFAULT; + signal_data->link_id = span->span_id; span->default_caller_data.bearer_capability = IN_ITC_SPEECH; /* Cannot set default bearer_layer1 yet, as we do not know the switchtype */ @@ -258,7 +262,7 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ ftdm_log(FTDM_LOG_WARNING, "Ignoring unknown parameter %s\n", ftdm_parameters[paramindex].var); } } - signal_data->link_id = span->span_id; + if (signal_data->switchtype == SNGISDN_SWITCH_INVALID) { ftdm_log(FTDM_LOG_ERROR, "%s: switchtype not specified", span->name); return FTDM_FAIL; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cntrl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cntrl.c index 7aba6a6..5060cb6 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cntrl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cntrl.c @@ -35,7 +35,6 @@ #include "ftmod_sangoma_isdn.h" - void sngisdn_set_chan_sig_status(ftdm_channel_t *ftdmchan, ftdm_signaling_status_t status); void sngisdn_set_chan_sig_status(ftdm_channel_t *ftdmchan, ftdm_signaling_status_t status) @@ -53,23 +52,21 @@ void sngisdn_set_chan_sig_status(ftdm_channel_t *ftdmchan, ftdm_signaling_status return; } +void sngisdn_set_span_sig_status(ftdm_span_t *span, ftdm_signaling_status_t status) +{ + ftdm_iterator_t *chaniter = NULL; + ftdm_iterator_t *curr = NULL; -void sngisdn_set_span_sig_status(ftdm_span_t *ftdmspan, ftdm_signaling_status_t status) -{ - unsigned i; - /* TODO: use channel iterator once it is implemented */ - - for (i=1;i<=ftdmspan->chan_count;i++) { - sngisdn_set_chan_sig_status(ftdmspan->channels[i], status); + chaniter = ftdm_span_get_chan_iterator(span, NULL); + for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { + sngisdn_set_chan_sig_status(((ftdm_channel_t*)ftdm_iterator_current(curr)), status); } + ftdm_iterator_free(chaniter); return; } - - - /* For Emacs: * Local Variables: * mode:c diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c index f84e018..942c2e4 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c @@ -656,8 +656,7 @@ ftdm_status_t sng_isdn_stack_cfg_q931_dlsap(ftdm_span_t *span) cfg.t.cfg.s.inDLSAP.ctldInt[1] = 1; } - cfg.t.cfg.s.inDLSAP.numRstInd = 255; - cfg.t.cfg.s.inDLSAP.ackOpt = TRUE; + cfg.t.cfg.s.inDLSAP.numRstInd = 255; cfg.t.cfg.s.inDLSAP.relOpt = TRUE; #ifdef ISDN_SRV cfg.t.cfg.s.inDLSAP.bcas = FALSE; @@ -666,16 +665,19 @@ ftdm_status_t sng_isdn_stack_cfg_q931_dlsap(ftdm_span_t *span) #endif /* ISDN_SRV */ if (signal_data->signalling == SNGISDN_SIGNALING_NET) { + cfg.t.cfg.s.inDLSAP.ackOpt = TRUE; cfg.t.cfg.s.inDLSAP.intType = NETWORK; cfg.t.cfg.s.inDLSAP.clrGlr = FALSE; /* in case of glare, do not clear local call */ cfg.t.cfg.s.inDLSAP.statEnqOpt = TRUE; - if (span->trunk_type == FTDM_TRUNK_BRI || - span->trunk_type == FTDM_TRUNK_BRI_PTMP) { + + if (signal_data->switchtype == SNGISDN_SWITCH_EUROISDN || + signal_data->switchtype == SNGISDN_SWITCH_INSNET) { cfg.t.cfg.s.inDLSAP.rstOpt = FALSE; } else { cfg.t.cfg.s.inDLSAP.rstOpt = TRUE; } } else { + cfg.t.cfg.s.inDLSAP.ackOpt = FALSE; cfg.t.cfg.s.inDLSAP.intType = USER; cfg.t.cfg.s.inDLSAP.clrGlr = TRUE; /* in case of glare, clear local call */ cfg.t.cfg.s.inDLSAP.statEnqOpt = FALSE; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c index f92eced..cea8ac0 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c @@ -38,8 +38,8 @@ void stack_resp_hdr_init(Header *hdr); ftdm_status_t sng_isdn_activate_phy(ftdm_span_t *span); -ftdm_status_t sng_isdn_activate_q921(ftdm_span_t *span); -ftdm_status_t sng_isdn_activate_q931(ftdm_span_t *span); +ftdm_status_t sng_isdn_deactivate_phy(ftdm_span_t *span); + ftdm_status_t sng_isdn_activate_cc(ftdm_span_t *span); ftdm_status_t sng_isdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t trace_opt); @@ -52,14 +52,23 @@ extern ftdm_sngisdn_data_t g_sngisdn_data; ftdm_status_t sng_isdn_stack_stop(ftdm_span_t *span); -ftdm_status_t sng_isdn_stack_activate(ftdm_span_t *span) +ftdm_status_t sng_isdn_stack_start(ftdm_span_t *span) { sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; - if (sng_isdn_activate_q921(span) != FTDM_SUCCESS) { + + if (sng_isdn_cntrl_q921(span, ABND_ENA, NOTUSED) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_CRIT, "%s:Failed to activate stack q921\n", span->name); return FTDM_FAIL; } + + /* Try to find an alternative for this */ + /* LAPD will call LdUiDatBndCfm before it received a LdLiMacBndCfm from L1, + so we need to give some time before activating q931, as q931 will send a + LdUiDatConReq when activated, and this requires the Mac SAP to be already + bound first */ + ftdm_sleep(500); + ftdm_log(FTDM_LOG_DEBUG, "%s:Stack q921 activated\n", span->name); if (!g_sngisdn_data.ccs[signal_data->cc_id].activation_done) { g_sngisdn_data.ccs[signal_data->cc_id].activation_done = 1; @@ -70,7 +79,8 @@ ftdm_status_t sng_isdn_stack_activate(ftdm_span_t *span) ftdm_log(FTDM_LOG_DEBUG, "%s:Stack CC activated\n", span->name); } - if (sng_isdn_activate_q931(span) != FTDM_SUCCESS) { + + if (sng_isdn_cntrl_q931(span, ABND_ENA, SAELMNT) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_CRIT, "%s:Failed to activate stack q931\n", span->name); return FTDM_FAIL; } @@ -80,50 +90,72 @@ ftdm_status_t sng_isdn_stack_activate(ftdm_span_t *span) return FTDM_SUCCESS; } -ftdm_status_t sng_isdn_stack_stop(ftdm_span_t *span) +ftdm_status_t sng_isdn_stack_stop(ftdm_span_t *span) { + /* Stop L1 first, so we do not receive any more frames */ + if (sng_isdn_deactivate_phy(span) != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_CRIT, "%s:Failed to deactivate stack phy\n", span->name); + return FTDM_FAIL; + } + if (sng_isdn_cntrl_q931(span, AUBND_DIS, SAELMNT) != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_CRIT, "%s:Failed to deactivate stack q931\n", span->name); + return FTDM_FAIL; + } + + if (sng_isdn_cntrl_q921(span, AUBND_DIS, SAELMNT) != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_CRIT, "%s:Failed to deactivate stack q921\n", span->name); + return FTDM_FAIL; + } + + ftdm_log(FTDM_LOG_INFO, "%s:Signalling stopped\n", span->name); return FTDM_SUCCESS; } ftdm_status_t sng_isdn_activate_phy(ftdm_span_t *span) { - L1Mngmt cntrl; - Pst pst; - - ftdm_log(FTDM_LOG_ERROR, "%s:PHY control not implemented\n", span->name); - return FTDM_SUCCESS; - /* TODO: phy cntrl not implemented yet */ - sng_isdn_phy_cntrl(&pst, &cntrl); + /* There is no need to start phy, as it will Q921 will send a activate request to phy when it starts */ + return FTDM_SUCCESS; } - -ftdm_status_t sng_isdn_activate_q921(ftdm_span_t *span) +ftdm_status_t sng_isdn_deactivate_phy(ftdm_span_t *span) { - ftdm_status_t status; - status = sng_isdn_cntrl_q921(span, ABND_ENA, NOTUSED); + L1Mngmt cntrl; + Pst pst; - /* Try to find an alternative for this */ - /* LAPD will call LdUiDatBndCfm before it received a LdLiMacBndCfm from L1, - so we need to give some time before activating q931, as q931 will send a - LdUiDatConReq when activated, and this requires the Mac SAP to be already - bound first */ - - if (status == FTDM_SUCCESS) { - ftdm_sleep(500); - } - return status; -} + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; -ftdm_status_t sng_isdn_activate_q931(ftdm_span_t *span) -{ - /* TODO: remove this function later, just call sng_isdn_cntrl_q931 directly */ - return sng_isdn_cntrl_q931(span, ABND_ENA, SAELMNT); + /* initalize the post structure */ + stack_pst_init(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTL1; + + /* initalize the control structure */ + memset(&cntrl, 0, sizeof(cntrl)); + + /* initalize the control header */ + stack_hdr_init(&cntrl.hdr); + + cntrl.hdr.msgType = TCNTRL; /* configuration */ + cntrl.hdr.entId.ent = ENTL1; /* entity */ + cntrl.hdr.entId.inst = S_INST; /* instance */ + cntrl.hdr.elmId.elmnt = STTSAP; /* SAP Specific cntrl */ + + cntrl.t.cntrl.action = AUBND_DIS; + cntrl.t.cntrl.subAction = SAELMNT; + cntrl.t.cntrl.sapId = signal_data->link_id; + + if (sng_isdn_phy_cntrl(&pst, &cntrl)) { + return FTDM_FAIL; + } + return FTDM_SUCCESS; } + ftdm_status_t sng_isdn_activate_cc(ftdm_span_t *span) { CcMngmt cntrl;; @@ -167,7 +199,7 @@ ftdm_status_t sng_isdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t tra ftdm_log(FTDM_LOG_INFO, "s%d Disabling q921 trace\n", signal_data->link_id); sngisdn_clear_trace_flag(signal_data, SNGISDN_TRACE_Q921); - if (sng_isdn_cntrl_q921(span, ADISIMM, SAELMNT) != FTDM_SUCCESS) { + if (sng_isdn_cntrl_q921(span, ADISIMM, SATRC) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_ERROR, "s%d Failed to disable q921 trace\n"); } } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index ff9a53b..e2e67ee 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -106,6 +106,13 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) break; } +#if 0 + /* Export ftdmchan variables here if we need to */ + ftdm_channel_add_var(ftdmchan, "isdn_specific_var", "1"); + ftdm_channel_add_var(ftdmchan, "isdn_crap", "morecrap"); + ftdm_channel_add_var(ftdmchan, "isdn_stuff", "s"); + ftdm_channel_add_var(ftdmchan, "isdn_d", "asdsadasdasdsad"); +#endif /* Fill in call information */ cpy_calling_num_from_stack(&ftdmchan->caller_data, &conEvnt->cgPtyNmb); cpy_called_num_from_stack(&ftdmchan->caller_data, &conEvnt->cdPtyNmb); @@ -267,6 +274,9 @@ void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event) /* This is the only valid state we should get a CONNECT ACK on */ /* do nothing */ break; + case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: + /* We just hung up an incoming call right after we sent a CONNECT so ignore this message */ + break; default: ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Processing CONNECT/CONNECT ACK in an invalid state (%s)\n", ftdm_channel_state2str(ftdmchan->state)); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 6e8e0e8..80a85ce 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -409,7 +409,7 @@ void sngisdn_snd_connect(ftdm_channel_t *ftdmchan) sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { + if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending CONNECT, but no call data, aborting (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); @@ -450,6 +450,14 @@ void sngisdn_snd_connect(ftdm_channel_t *ftdmchan) cnStEvnt.chanId.chanNmbSlotMap.len = 1; cnStEvnt.chanId.chanNmbSlotMap.val[0] = ftdmchan->physical_chan_id; } + + cnStEvnt.progInd.eh.pres = PRSNT_NODEF; + cnStEvnt.progInd.location.pres = PRSNT_NODEF; + cnStEvnt.progInd.location.val = IN_LOC_USER; + cnStEvnt.progInd.codeStand0.pres = PRSNT_NODEF; + cnStEvnt.progInd.codeStand0.val = IN_CSTD_CCITT; + cnStEvnt.progInd.progDesc.pres = PRSNT_NODEF; + cnStEvnt.progInd.progDesc.val = IN_PD_NOTETEISDN; /* Not end-to-end ISDN */ ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending CONNECT (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); if (sng_isdn_con_response(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &cnStEvnt, signal_data->dchan_id, sngisdn_info->ces)) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c index f921b1b..791c6b7 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c @@ -239,7 +239,8 @@ void sngisdn_rcv_rel_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, Re !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); - ftdm_assert(0, "Inconsistent call states\n"); + /* It seems that Trillium has a bug where they sometimes send release twice on a call, so do not crash on these for now */ + /* ftdm_assert(0, "Inconsistent call states\n"); */ return; } @@ -591,6 +592,7 @@ void sngisdn_rcv_rst_ind (int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces /* Enqueue the event to each span within the dChan */ for(i=1; i<=g_sngisdn_data.dchans[dChan].num_spans; i++) { signal_data = g_sngisdn_data.dchans[dChan].spans[i]; + sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); ftdm_assert(sngisdn_event != NULL, "Failed to allocate memory\n"); memset(sngisdn_event, 0, sizeof(*sngisdn_event)); @@ -640,30 +642,24 @@ void sngisdn_rcv_rst_cfm (int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces void sngisdn_rcv_phy_ind(SuId suId, Reason reason) { - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); if (reason != LL1_REASON_CON_REQ_FAIL) { ftdm_log(FTDM_LOG_INFO, "[SNGISDN PHY] D-chan %d : %s\n", suId, DECODE_LL1_REASON(reason)); } - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); return; } void sngisdn_rcv_q921_ind(BdMngmt *status) -{ - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - - unsigned j,k; - ftdm_span_t *ftdmspan = NULL; - - for(j=1;j<=g_sngisdn_data.num_dchan;j++) { - for(k=1;k<=g_sngisdn_data.dchans[j].num_spans;k++) { - if (g_sngisdn_data.dchans[j].spans[k]->link_id == status->t.usta.lnkNmb) { - ftdmspan = (ftdm_span_t*)g_sngisdn_data.dchans[j].spans[k]->ftdm_span; - } - } +{ + ftdm_span_t *ftdmspan; + sngisdn_span_data_t *signal_data = g_sngisdn_data.spans[status->t.usta.lnkNmb]; + if (!signal_data) { + ftdm_log(FTDM_LOG_INFO, "Received q921 status on unconfigured span (lnkNmb:%d)\n", status->t.usta.lnkNmb); + return; } - if (ftdmspan == NULL) { - ftdm_log(FTDM_LOG_WARNING, "Received q921 status on unconfigured span (lnkNmb:%d)\n", status->t.usta.lnkNmb); + ftdmspan = signal_data->ftdm_span; + + if (!ftdmspan) { + ftdm_log(FTDM_LOG_INFO, "Received q921 status on unconfigured span (lnkNmb:%d)\n", status->t.usta.lnkNmb); return; } @@ -694,69 +690,56 @@ void sngisdn_rcv_q921_ind(BdMngmt *status) } break; } - - ISDN_FUNC_TRACE_EXIT(__FUNCTION__) return; } void sngisdn_rcv_q931_ind(InMngmt *status) -{ - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - ftdm_span_t *ftdmspan = NULL; - +{ if (status->t.usta.alarm.cause == 287) { get_memory_info(); return; } - switch (status->t.usta.alarm.category) { - case (LCM_CATEGORY_INTERFACE): - ftdm_log(FTDM_LOG_WARNING, "[SNGISDN Q931] s%d: %s: %s(%d): %s(%d)\n", - status->t.usta.suId, - DECODE_LCM_CATEGORY(status->t.usta.alarm.category), - DECODE_LCM_EVENT(status->t.usta.alarm.event), status->t.usta.alarm.event, - DECODE_LCM_CAUSE(status->t.usta.alarm.cause), status->t.usta.alarm.cause); - - /* clean this up later */ - - switch (status->t.usta.alarm.event) { - case LCM_EVENT_UP: - case LCM_EVENT_DOWN: - { - unsigned j,k; - for(j=1;j<=g_sngisdn_data.num_dchan;j++) { - for(k=1;k<=g_sngisdn_data.dchans[j].num_spans;k++) { - if (g_sngisdn_data.dchans[j].spans[k]->link_id == status->t.usta.suId) { - ftdmspan = (ftdm_span_t*)g_sngisdn_data.dchans[j].spans[k]->ftdm_span; - } - } - } - - if (ftdmspan == NULL) { - ftdm_log(FTDM_LOG_CRIT, "Received q931 LCM EVENT on unconfigured span (suId:%u)\n", status->t.usta.suId); - return; - } - - if (status->t.usta.alarm.event == LCM_EVENT_UP) { - sngisdn_set_span_sig_status(ftdmspan, FTDM_SIG_STATE_UP); - sng_isdn_set_avail_rate(ftdmspan, SNGISDN_AVAIL_UP); - } else { - sngisdn_set_span_sig_status(ftdmspan, FTDM_SIG_STATE_DOWN); - sng_isdn_set_avail_rate(ftdmspan, SNGISDN_AVAIL_PWR_SAVING); - } - } - break; + switch (status->t.usta.alarm.event) { + case LCM_EVENT_UP: + case LCM_EVENT_DOWN: + { + ftdm_span_t *ftdmspan; + sngisdn_span_data_t *signal_data = g_sngisdn_data.spans[status->t.usta.suId]; + if (!signal_data) { + ftdm_log(FTDM_LOG_INFO, "Received q921 status on unconfigured span (lnkNmb:%d)\n", status->t.usta.suId); + return; } - break; + ftdmspan = signal_data->ftdm_span; + + if (status->t.usta.alarm.event == LCM_EVENT_UP) { + ftdm_log(FTDM_LOG_INFO, "[SNGISDN Q931] s%d: %s: %s(%d): %s(%d)\n", + status->t.usta.suId, + DECODE_LCM_CATEGORY(status->t.usta.alarm.category), + DECODE_LCM_EVENT(status->t.usta.alarm.event), status->t.usta.alarm.event, + DECODE_LCM_CAUSE(status->t.usta.alarm.cause), status->t.usta.alarm.cause); + + sngisdn_set_span_sig_status(ftdmspan, FTDM_SIG_STATE_UP); + sng_isdn_set_avail_rate(ftdmspan, SNGISDN_AVAIL_UP); + } else { + ftdm_log(FTDM_LOG_WARNING, "[SNGISDN Q931] s%d: %s: %s(%d): %s(%d)\n", + status->t.usta.suId, + DECODE_LCM_CATEGORY(status->t.usta.alarm.category), + DECODE_LCM_EVENT(status->t.usta.alarm.event), status->t.usta.alarm.event, + DECODE_LCM_CAUSE(status->t.usta.alarm.cause), status->t.usta.alarm.cause); + + sngisdn_set_span_sig_status(ftdmspan, FTDM_SIG_STATE_DOWN); + sng_isdn_set_avail_rate(ftdmspan, SNGISDN_AVAIL_PWR_SAVING); + } + } + break; default: - ftdm_log(FTDM_LOG_DEBUG, "[SNGISDN Q931] s%d: %s: %s(%d): %s(%d)\n", - status->t.usta.suId, - DECODE_LCM_CATEGORY(status->t.usta.alarm.category), - DECODE_LCM_EVENT(status->t.usta.alarm.event), status->t.usta.alarm.event, - DECODE_LCM_CAUSE(status->t.usta.alarm.cause), status->t.usta.alarm.cause); - break; + ftdm_log(FTDM_LOG_WARNING, "[SNGISDN Q931] s%d: %s: %s(%d): %s(%d)\n", + status->t.usta.suId, + DECODE_LCM_CATEGORY(status->t.usta.alarm.category), + DECODE_LCM_EVENT(status->t.usta.alarm.event), status->t.usta.alarm.event, + DECODE_LCM_CAUSE(status->t.usta.alarm.cause), status->t.usta.alarm.cause); } - - + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); return; } @@ -902,12 +885,13 @@ void sngisdn_rcv_sng_log(uint8_t level, char *fmt,...) break; case SNG_LOGLEVEL_CRIT: ftdm_log(FTDM_LOG_CRIT, "sng_isdn->%s", data); - /*ftdm_assert(0, "Got an error from stack");*/ + /* ftdm_assert(0, "Got an error from stack"); */ break; default: ftdm_log(FTDM_LOG_INFO, "sng_isdn->%s", data); break; } + ftdm_safe_free(data); return; } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 5e37e0c..db22fe5 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -134,16 +134,22 @@ ftdm_status_t __inline__ get_ftdmchan_by_spInstId(uint8_t cc_id, uint32_t spInst return FTDM_SUCCESS; } -ftdm_status_t sng_isdn_set_avail_rate(ftdm_span_t *ftdmspan, sngisdn_avail_t avail) +ftdm_status_t sng_isdn_set_avail_rate(ftdm_span_t *span, sngisdn_avail_t avail) { - unsigned i; - if (ftdmspan->trunk_type == FTDM_TRUNK_BRI || - ftdmspan->trunk_type == FTDM_TRUNK_BRI_PTMP) { + + if (span->trunk_type == FTDM_TRUNK_BRI || + span->trunk_type == FTDM_TRUNK_BRI_PTMP) { + + ftdm_iterator_t *chaniter = NULL; + ftdm_iterator_t *curr = NULL; - for(i=1; i<=ftdmspan->chan_count; i++) { - ftdm_log_chan(ftdmspan->channels[i], FTDM_LOG_DEBUG, "Setting availability rate to:%d\n", avail); - ftdmspan->channels[i]->availability_rate = avail; + + chaniter = ftdm_span_get_chan_iterator(span, NULL); + for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { + ftdm_log_chan(((ftdm_channel_t*)ftdm_iterator_current(curr)), FTDM_LOG_DEBUG, "Setting availability rate to:%d\n", avail); + ((ftdm_channel_t*)ftdm_iterator_current(curr))->availability_rate = avail; } + ftdm_iterator_free(chaniter); } return FTDM_SUCCESS; } @@ -554,6 +560,77 @@ ftdm_user_layer1_prot_t sngisdn_get_usrInfoLyr1Prot_from_user(uint8_t layer1_pro return FTDM_USER_LAYER1_PROT_ULAW; } +void sngisdn_print_phy_stats(ftdm_stream_handle_t *stream, ftdm_span_t *span) +{ + L1Mngmt sts; + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; + + memset(&sts, 0, sizeof(sts)); + sng_isdn_phy_stats(signal_data->link_id , &sts); + + stream->write_function(stream, "\n---------------------------------------------------------------------\n"); + stream->write_function(stream, " Span:%s", span->name); + stream->write_function(stream, "\n---------------------------------------------------------------------\n"); + stream->write_function(stream, " Performance Counters"); + stream->write_function(stream, "\n---------------------------------------------------------------------\n"); + stream->write_function(stream, "RX Packets:\t%u\tTX Packets:\t%u\tEvents:%u\n", sts.t.sts.rx_packets, sts.t.sts.tx_packets, sts.t.sts.rx_events); + stream->write_function(stream, "RX Bytes:\t%u\tTX Bytes:\t%u\n\n", sts.t.sts.rx_bytes, sts.t.sts.tx_bytes); + stream->write_function(stream, "TX Queue:\t%u/%u\tRX Queue:\t%u/%u\tEvents Queue:\t%u/%u\n", + sts.t.sts.num_frames_in_tx_queue,sts.t.sts.tx_queue_len, + sts.t.sts.num_frames_in_rx_queue, sts.t.sts.rx_queue_len, + sts.t.sts.rx_events_in_queue, sts.t.sts.event_queue_len); + + stream->write_function(stream, "\n---------------------------------------------------------------------\n"); + stream->write_function(stream, " Errors"); + stream->write_function(stream, "\n---------------------------------------------------------------------\n"); + stream->write_function(stream, "RX Errors:\t%u\tTX Errors:\t%u\n", sts.t.sts.rx_errors, sts.t.sts.tx_errors); + stream->write_function(stream, "RX Dropped:\t%u\tTX Dropped:\t%u\tEvents Dropped:\t%u\n", sts.t.sts.rx_dropped, sts.t.sts.tx_dropped,sts.t.sts.rx_events_dropped); + + + stream->write_function(stream, "\n---------------------------------------------------------------------\n"); + stream->write_function(stream, " RX Errors Details"); + stream->write_function(stream, "\n---------------------------------------------------------------------\n"); + stream->write_function(stream, "CRC:\t\t%u\tFrame:\t\t%u\tOverruns:\t%u\n", sts.t.sts.rx_crc_errors, sts.t.sts.rx_frame_errors, sts.t.sts.rx_over_errors); + stream->write_function(stream, "Fifo:\t\t%u\tAborts:\t\t%u\tMissed:\t\t%u\n", sts.t.sts.rx_fifo_errors, sts.t.sts.rx_hdlc_abort_counter, sts.t.sts.rx_missed_errors); + stream->write_function(stream, "Length:\t\t%u\n", sts.t.sts.rx_length_errors); + + stream->write_function(stream, "\n---------------------------------------------------------------------\n"); + stream->write_function(stream, " TX Errors Details"); + stream->write_function(stream, "\n---------------------------------------------------------------------\n"); + stream->write_function(stream, "Aborted:\t%u\tFifo:\t\t%u\tCarrier:\t%u\n", sts.t.sts.tx_aborted_errors, sts.t.sts.tx_fifo_errors, sts.t.sts.tx_carrier_errors); + return; +} + + +void sngisdn_print_span(ftdm_stream_handle_t *stream, ftdm_span_t *span) +{ + ftdm_signaling_status_t sigstatus; + ftdm_alarm_flag_t alarmbits; + ftdm_channel_t *fchan; + alarmbits = FTDM_ALARM_NONE; + fchan = ftdm_span_get_channel(span, 1); + if (fchan) { + ftdm_channel_get_alarms(fchan, &alarmbits); + } + + ftdm_span_get_sig_status(span, &sigstatus); + stream->write_function(stream, "span:%s physical:%s signalling:%s\n", + span->name, alarmbits ? "ALARMED" : "OK", + ftdm_signaling_status2str(sigstatus)); + return; +} + +void sngisdn_print_spans(ftdm_stream_handle_t *stream) +{ + int i; + for(i=1;i<=MAX_L1_LINKS;i++) { + if (g_sngisdn_data.spans[i]) { + sngisdn_print_span(stream, g_sngisdn_data.spans[i]->ftdm_span); + } + } + return; +} + /* For Emacs: * Local Variables: * mode:c commit d31c24dcb3f4ebbdcaaa2744657f61680fa8d02d Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Sep 14 12:16:14 2010 -0500 thats better diff --git a/libs/freetdm/src/libteletone_generate.c b/libs/freetdm/src/libteletone_generate.c index 089268b..7f37b7a 100644 --- a/libs/freetdm/src/libteletone_generate.c +++ b/libs/freetdm/src/libteletone_generate.c @@ -267,7 +267,7 @@ TELETONE_API(int) teletone_mux_tones(teletone_generation_session_t *ts, teletone ts->samples * 2); } } - return ts->samples; + return ts->samples / ts->channels; } TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cmd) diff --git a/libs/libteletone/src/libteletone_generate.c b/libs/libteletone/src/libteletone_generate.c index 911e3c2..8098e36 100644 --- a/libs/libteletone/src/libteletone_generate.c +++ b/libs/libteletone/src/libteletone_generate.c @@ -302,7 +302,7 @@ TELETONE_API(int) teletone_mux_tones(teletone_generation_session_t *ts, teletone ts->samples * 2); } } - return ts->samples; + return ts->samples / ts->channels; } /* don't ask */ commit 74430cb3c6e298d07b43ad152ffaeee56a722312 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Sep 14 12:00:46 2010 -0500 doh diff --git a/libs/freetdm/src/libteletone_generate.c b/libs/freetdm/src/libteletone_generate.c index 3abbebb..089268b 100644 --- a/libs/freetdm/src/libteletone_generate.c +++ b/libs/freetdm/src/libteletone_generate.c @@ -244,7 +244,7 @@ TELETONE_API(int) teletone_mux_tones(teletone_generation_session_t *ts, teletone if (ts->debug && ts->debug_stream) { if (map->freqs[0] <= 0) { - fprintf(ts->debug_stream, "wait %d (%dms)\n", wait, wait / (ts->rate / 1000 / ts->channels ? ts->channels : 1)); + fprintf(ts->debug_stream, "wait %d (%dms)\n", wait, wait / (ts->rate / 1000)); } else { fprintf(ts->debug_stream, "Generate: ("); @@ -256,14 +256,14 @@ TELETONE_API(int) teletone_mux_tones(teletone_generation_session_t *ts, teletone ") [volume %0.2fdB; samples %d(%dms) x %d channel%s; wait %d(%dms); decay_factor %0.2fdB; decay_step %d(%dms); wrote %d bytes]\n", ts->volume, duration, - duration / (ts->rate / 1000 / ts->channels ? ts->channels : 1), + duration / (ts->rate / 1000), ts->channels, ts->channels == 1 ? "" : "s", wait, - wait / (ts->rate / 1000 / ts->channels ? ts->channels : 1), + wait / (ts->rate / 1000), ts->decay_factor, ts->decay_step, - ts->decay_step / (ts->rate / 1000 / ts->channels ? ts->channels : 1), + ts->decay_step / (ts->rate / 1000), ts->samples * 2); } } @@ -307,7 +307,7 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm ts->rate = atoi(cur + 2); break; case 'd': - ts->duration = atoi(cur + 2) * (ts->rate / 1000 / ts->channels ? ts->channels : 1); + ts->duration = atoi(cur + 2) * (ts->rate / 1000); break; case 'v': { @@ -318,18 +318,18 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm } break; case '>': - ts->decay_step = atoi(cur + 2) * (ts->rate / 1000 / ts->channels ? ts->channels : 1); + ts->decay_step = atoi(cur + 2) * (ts->rate / 1000); ts->decay_direction = -1; break; case '<': - ts->decay_step = atoi(cur + 2) * (ts->rate / 1000 / ts->channels ? ts->channels : 1); + ts->decay_step = atoi(cur + 2) * (ts->rate / 1000); ts->decay_direction = 1; break; case '+': ts->decay_factor = (float)atof(cur + 2); break; case 'w': - ts->wait = atoi(cur + 2) * (ts->rate / 1000 / ts->channels ? ts->channels : 1); + ts->wait = atoi(cur + 2) * (ts->rate / 1000); break; case 'l': ts->loops = atoi(cur + 2); @@ -369,10 +369,10 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm *next++ = '\0'; } if (i == 0) { - ts->tmp_duration = atoi(p) * (ts->rate / 1000 / ts->channels ? ts->channels : 1); + ts->tmp_duration = atoi(p) * (ts->rate / 1000); i++; } else if (i == 1) { - ts->tmp_wait = atoi(p) * (ts->rate / 1000 / ts->channels ? ts->channels : 1); + ts->tmp_wait = atoi(p) * (ts->rate / 1000); i++; } else { mymap.freqs[i++ - 2] = atof(p); diff --git a/libs/libteletone/src/libteletone_generate.c b/libs/libteletone/src/libteletone_generate.c index 1608f47..911e3c2 100644 --- a/libs/libteletone/src/libteletone_generate.c +++ b/libs/libteletone/src/libteletone_generate.c @@ -355,7 +355,7 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm ts->rate = atoi(cur + 2); break; case 'd': - ts->duration = atoi(cur + 2) * (ts->rate / 1000 / ts->channels ? ts->channels : 1); + ts->duration = atoi(cur + 2) * (ts->rate / 1000); break; case 'v': { @@ -366,18 +366,18 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm } break; case '>': - ts->decay_step = atoi(cur + 2) * (ts->rate / 1000 / ts->channels ? ts->channels : 1); + ts->decay_step = atoi(cur + 2) * (ts->rate / 1000); ts->decay_direction = -1; break; case '<': - ts->decay_step = atoi(cur + 2) * (ts->rate / 1000 / ts->channels ? ts->channels : 1); + ts->decay_step = atoi(cur + 2) * (ts->rate / 1000); ts->decay_direction = 1; break; case '+': ts->decay_factor = (float)atof(cur + 2); break; case 'w': - ts->wait = atoi(cur + 2) * (ts->rate / 1000 / ts->channels ? ts->channels : 1); + ts->wait = atoi(cur + 2) * (ts->rate / 1000); break; case 'l': ts->loops = atoi(cur + 2); @@ -417,10 +417,10 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm *next++ = '\0'; } if (i == 0) { - ts->tmp_duration = atoi(p) * (ts->rate / 1000 / ts->channels ? ts->channels : 1); + ts->tmp_duration = atoi(p) * (ts->rate / 1000); i++; } else if (i == 1) { - ts->tmp_wait = atoi(p) * (ts->rate / 1000 / ts->channels ? ts->channels : 1); + ts->tmp_wait = atoi(p) * (ts->rate / 1000); i++; } else { mymap.freqs[i++ - 2] = atof(p); commit 6f2c455f929946c1eb5310e8f0df3b8cffd911ac Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Sep 14 11:48:43 2010 -0500 add tone2wav diff --git a/Makefile.am b/Makefile.am index a263462..077dfec 100644 --- a/Makefile.am +++ b/Makefile.am @@ -267,7 +267,7 @@ src/include/switch_swigable_cpp.h: $(switch_srcdir)/src/include/switch_cpp.h ## ## Applications ## -bin_PROGRAMS = freeswitch fs_cli fs_ivrd +bin_PROGRAMS = freeswitch fs_cli fs_ivrd tone2wav ## ## fs_cli () @@ -282,6 +282,14 @@ fs_cli_LDADD = libs/libedit/src/.libs/libedit.a endif ## +## tone2wav () +## +tone2wav_SOURCES = src/tone2wav.c +tone2wav_CFLAGS = $(AM_CFLAGS) +tone2wav_LDFLAGS = $(AM_LDFLAGS) -lm +tone2wav_LDADD = libfreeswitch.la + +## ## fs_ivrd () ## fs_ivrd_SOURCES = libs/esl/src/esl.c libs/esl/src/esl_config.c libs/esl/src/esl_event.c libs/esl/src/esl_threadmutex.c libs/esl/ivrd.c libs/esl/src/esl_json.c diff --git a/libs/freetdm/src/libteletone_generate.c b/libs/freetdm/src/libteletone_generate.c index 089268b..3abbebb 100644 --- a/libs/freetdm/src/libteletone_generate.c +++ b/libs/freetdm/src/libteletone_generate.c @@ -244,7 +244,7 @@ TELETONE_API(int) teletone_mux_tones(teletone_generation_session_t *ts, teletone if (ts->debug && ts->debug_stream) { if (map->freqs[0] <= 0) { - fprintf(ts->debug_stream, "wait %d (%dms)\n", wait, wait / (ts->rate / 1000)); + fprintf(ts->debug_stream, "wait %d (%dms)\n", wait, wait / (ts->rate / 1000 / ts->channels ? ts->channels : 1)); } else { fprintf(ts->debug_stream, "Generate: ("); @@ -256,14 +256,14 @@ TELETONE_API(int) teletone_mux_tones(teletone_generation_session_t *ts, teletone ") [volume %0.2fdB; samples %d(%dms) x %d channel%s; wait %d(%dms); decay_factor %0.2fdB; decay_step %d(%dms); wrote %d bytes]\n", ts->volume, duration, - duration / (ts->rate / 1000), + duration / (ts->rate / 1000 / ts->channels ? ts->channels : 1), ts->channels, ts->channels == 1 ? "" : "s", wait, - wait / (ts->rate / 1000), + wait / (ts->rate / 1000 / ts->channels ? ts->channels : 1), ts->decay_factor, ts->decay_step, - ts->decay_step / (ts->rate / 1000), + ts->decay_step / (ts->rate / 1000 / ts->channels ? ts->channels : 1), ts->samples * 2); } } @@ -307,7 +307,7 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm ts->rate = atoi(cur + 2); break; case 'd': - ts->duration = atoi(cur + 2) * (ts->rate / 1000); + ts->duration = atoi(cur + 2) * (ts->rate / 1000 / ts->channels ? ts->channels : 1); break; case 'v': { @@ -318,18 +318,18 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm } break; case '>': - ts->decay_step = atoi(cur + 2) * (ts->rate / 1000); + ts->decay_step = atoi(cur + 2) * (ts->rate / 1000 / ts->channels ? ts->channels : 1); ts->decay_direction = -1; break; case '<': - ts->decay_step = atoi(cur + 2) * (ts->rate / 1000); + ts->decay_step = atoi(cur + 2) * (ts->rate / 1000 / ts->channels ? ts->channels : 1); ts->decay_direction = 1; break; case '+': ts->decay_factor = (float)atof(cur + 2); break; case 'w': - ts->wait = atoi(cur + 2) * (ts->rate / 1000); + ts->wait = atoi(cur + 2) * (ts->rate / 1000 / ts->channels ? ts->channels : 1); break; case 'l': ts->loops = atoi(cur + 2); @@ -369,10 +369,10 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm *next++ = '\0'; } if (i == 0) { - ts->tmp_duration = atoi(p) * (ts->rate / 1000); + ts->tmp_duration = atoi(p) * (ts->rate / 1000 / ts->channels ? ts->channels : 1); i++; } else if (i == 1) { - ts->tmp_wait = atoi(p) * (ts->rate / 1000); + ts->tmp_wait = atoi(p) * (ts->rate / 1000 / ts->channels ? ts->channels : 1); i++; } else { mymap.freqs[i++ - 2] = atof(p); diff --git a/libs/libteletone/src/libteletone_generate.c b/libs/libteletone/src/libteletone_generate.c index 911e3c2..1608f47 100644 --- a/libs/libteletone/src/libteletone_generate.c +++ b/libs/libteletone/src/libteletone_generate.c @@ -355,7 +355,7 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm ts->rate = atoi(cur + 2); break; case 'd': - ts->duration = atoi(cur + 2) * (ts->rate / 1000); + ts->duration = atoi(cur + 2) * (ts->rate / 1000 / ts->channels ? ts->channels : 1); break; case 'v': { @@ -366,18 +366,18 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm } break; case '>': - ts->decay_step = atoi(cur + 2) * (ts->rate / 1000); + ts->decay_step = atoi(cur + 2) * (ts->rate / 1000 / ts->channels ? ts->channels : 1); ts->decay_direction = -1; break; case '<': - ts->decay_step = atoi(cur + 2) * (ts->rate / 1000); + ts->decay_step = atoi(cur + 2) * (ts->rate / 1000 / ts->channels ? ts->channels : 1); ts->decay_direction = 1; break; case '+': ts->decay_factor = (float)atof(cur + 2); break; case 'w': - ts->wait = atoi(cur + 2) * (ts->rate / 1000); + ts->wait = atoi(cur + 2) * (ts->rate / 1000 / ts->channels ? ts->channels : 1); break; case 'l': ts->loops = atoi(cur + 2); @@ -417,10 +417,10 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm *next++ = '\0'; } if (i == 0) { - ts->tmp_duration = atoi(p) * (ts->rate / 1000); + ts->tmp_duration = atoi(p) * (ts->rate / 1000 / ts->channels ? ts->channels : 1); i++; } else if (i == 1) { - ts->tmp_wait = atoi(p) * (ts->rate / 1000); + ts->tmp_wait = atoi(p) * (ts->rate / 1000 / ts->channels ? ts->channels : 1); i++; } else { mymap.freqs[i++ - 2] = atof(p); diff --git a/src/include/switch_loadable_module.h b/src/include/switch_loadable_module.h index 6871906..37c752b 100644 --- a/src/include/switch_loadable_module.h +++ b/src/include/switch_loadable_module.h @@ -92,7 +92,7 @@ SWITCH_BEGIN_EXTERN_C \brief Initilize the module backend and load all the modules \return SWITCH_STATUS_SUCCESS when complete */ -SWITCH_DECLARE(switch_status_t) switch_loadable_module_init(void); +SWITCH_DECLARE(switch_status_t) switch_loadable_module_init(switch_bool_t autoload); /*! \brief Shutdown the module backend and call the shutdown routine in all loaded modules diff --git a/src/include/switch_types.h b/src/include/switch_types.h index c3b649c..b0395ba 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -255,7 +255,8 @@ typedef enum { SCF_USE_CLOCK_RT = (1 << 10), SCF_VERBOSE_EVENTS = (1 << 11), SCF_USE_WIN32_MONOTONIC = (1 << 12), - SCF_AUTO_SCHEMAS = (1 << 13) + SCF_AUTO_SCHEMAS = (1 << 13), + SCF_MINIMAL = (1 << 14) } switch_core_flag_enum_t; typedef uint32_t switch_core_flag_t; diff --git a/src/switch_core.c b/src/switch_core.c index 4bfc02e..0a45723 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1315,6 +1315,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc switch_log_init(runtime.memory_pool, runtime.colorize_console); + if (flags & SCF_MINIMAL) return SWITCH_STATUS_SUCCESS; + runtime.tipping_point = 5000; runtime.timer_affinity = -1; @@ -1594,7 +1596,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(switch_core_flag_t switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Bringing up environment.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Loading Modules.\n"); - if (switch_loadable_module_init() != SWITCH_STATUS_SUCCESS) { + if (switch_loadable_module_init(SWITCH_TRUE) != SWITCH_STATUS_SUCCESS) { *err = "Cannot load modules"; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Error: %s\n", *err); return SWITCH_STATUS_GENERR; @@ -1902,6 +1904,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_destroy(void) switch_scheduler_task_thread_stop(); switch_rtp_shutdown(); + if (switch_test_flag((&runtime), SCF_USE_AUTO_NAT)) { switch_nat_shutdown(); } diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index bf636dd..d23b422 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -1218,7 +1218,7 @@ static void switch_loadable_module_path_init() } #endif -SWITCH_DECLARE(switch_status_t) switch_loadable_module_init() +SWITCH_DECLARE(switch_status_t) switch_loadable_module_init(switch_bool_t autoload) { apr_finfo_t finfo = { 0 }; @@ -1268,6 +1268,8 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init() switch_core_hash_init_nocase(&loadable_modules.dialplan_hash, loadable_modules.pool); switch_mutex_init(&loadable_modules.mutex, SWITCH_MUTEX_NESTED, loadable_modules.pool); + if (!autoload) return SWITCH_STATUS_SUCCESS; + switch_loadable_module_load_module("", "CORE_SOFTTIMER_MODULE", SWITCH_FALSE, &err); switch_loadable_module_load_module("", "CORE_PCM_MODULE", SWITCH_FALSE, &err); diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 710415a..969309e 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -662,6 +662,10 @@ SWITCH_DECLARE(void) switch_rtp_shutdown(void) const void *var; void *val; + if (!global_init) { + return; + } + switch_mutex_lock(port_lock); for (hi = switch_hash_first(NULL, alloc_hash); hi; hi = switch_hash_next(hi)) { diff --git a/src/tone2wav.c b/src/tone2wav.c new file mode 100644 index 0000000..bf51e3a --- /dev/null +++ b/src/tone2wav.c @@ -0,0 +1,193 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org> + * + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (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.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * + * The Initial Developer of the Original Code is + * Anthony Minessale II <anthm@freeswitch.org> + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Anthony Minessale II <anthm@freeswitch.org> + * Michael Jerris <mike@jerris.com> + * Pawel Pierscionek <pawel@voiceworks.pl> + * Bret McDanel <trixter AT 0xdecafbad.com> + * + * + * tone2wav.c -- Generate a .wav from teletone spec + * + */ + +#ifndef _XOPEN_SOURCE +#define _XOPEN_SOURCE 600 +#endif + +#ifndef WIN32 +#ifdef HAVE_SETRLIMIT +#include <sys/resource.h> +#endif +#endif + +#include <switch.h> +#include <switch_version.h> + + + +/* Picky compiler */ +#ifdef __ICC +#pragma warning (disable:167) +#endif + + +static int teletone_handler(teletone_generation_session_t *ts, teletone_tone_map_t *map) +{ + switch_file_handle_t *fh = (switch_file_handle_t *) ts->user_data; + int wrote; + switch_size_t len; + + wrote = teletone_mux_tones(ts, map); + + len = wrote; + if (switch_core_file_write(fh, ts->buffer, &len) != SWITCH_STATUS_SUCCESS) { + return -1; + } + + return 0; +} + +#define fail() r = 255; goto end + +/* the main application entry point */ +int main(int argc, char *argv[]) +{ + teletone_generation_session_t ts; + int file_flags = SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT; + int r = 0; + int rate = 8000; + char *file = NULL, *script = NULL; + switch_file_handle_t fh = { 0 }; + const char *err = NULL; + switch_bool_t verbose = SWITCH_FALSE; + int i = 0, c = 1, help = 0; + + for(i = 1; i < argc; i++) { + if (!strstr(argv[i], "-")) break; + + if (!strcmp(argv[i], "-v")) { + verbose = SWITCH_TRUE; + } + + if (!strcmp(argv[i], "-s")) { + c = 2; + } + + if (!strcmp(argv[i], "-h")) { + help = 1; + } + + if (!strncmp(argv[i], "-R", 2)) { + char *p = argv[i] + 2; + + if (p) { + int tmp = atoi(p); + if (tmp > 0) { + rate = tmp; + } + } + } + } + + if (argc - i != 2 || help) { + char *app = NULL; + + if (!help) printf("Invalid input!\n"); + + if ((app = strrchr(argv[0], '/'))) { + app++; + } else { + app = argv[0]; + } + + + printf("USAGE: %s [options] <file> <tones>\n", app); + printf("================================================================================\n"); + printf("Options:\n" + "-s\t\tStereo\n" + "-h\t\tHelp\n" + "-R<rate>\tSet Rate (8000,16000,32000,48000) etc.\n" + "-v\t\tVerbose Logging\n" + "<file>\t\tAny file supported by libsndfile\n" + "<tones>\t\tA valid teletone script http://wiki.freeswitch.org/wiki/TGML" + "\n\n\n" + ); + return 255; + } + + file = argv[i]; + script = argv[i+1]; + + if (switch_core_init(SCF_MINIMAL, verbose, &err) != SWITCH_STATUS_SUCCESS) { + printf("Cannot init core [%s]\n", err); + fail(); + } + + switch_loadable_module_init(SWITCH_FALSE); + + if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) "mod_sndfile", SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) { + printf("Cannot init mod_sndfile [%s]\n", err); + fail(); + } + + if (switch_core_file_open(&fh, file, c, rate, file_flags, NULL) != SWITCH_STATUS_SUCCESS) { + printf("Cannot open file %s\n", file); + fail(); + } + + teletone_init_session(&ts, 0, teletone_handler, &fh); + ts.rate = rate; + ts.channels = c; + ts.duration = 250 * (rate / 1000 / c); + ts.wait = 50 * (rate / 1000 / c); + if (verbose) { + ts.debug = 10; + ts.debug_stream = stdout; + } + teletone_run(&ts, script); + teletone_destroy_session(&ts); + switch_core_file_close(&fh); + + printf("File: %s generated.....\nPlease support:\n\nFreeSWITCH http://www.freeswitch.org\nClueCon http://www.cluecon.com\n", file); + + end: + + switch_core_destroy(); + + return r; + +} + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4: + */ commit 5219ab8c6330a4e00eb4c1262906b39044d89496 Author: Konrad Hammel <konrad@sangoma.com> Date: Mon Sep 13 20:38:00 2010 -0400 freetdm: ss7 - fixed bug in cic status, added activate/deactivate functions for mtp2/3 diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c index c0ce84b..20e1f27 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c @@ -67,6 +67,14 @@ static ftdm_status_t handle_tx_ubl(ftdm_stream_handle_t *stream, int span, int c static ftdm_status_t handle_tx_cgb(ftdm_stream_handle_t *stream, int span, int chan, int range, int verbose); static ftdm_status_t handle_tx_cgu(ftdm_stream_handle_t *stream, int span, int chan, int range, int verbose); +static ftdm_status_t handle_activate_link(ftdm_stream_handle_t *stream, char *name); +static ftdm_status_t handle_deactivate_link(ftdm_stream_handle_t *stream, char *name); + +static ftdm_status_t handle_activate_linkset(ftdm_stream_handle_t *stream, char *name); +static ftdm_status_t handle_deactivate_linkset(ftdm_stream_handle_t *stream, char *name); + +static ftdm_status_t handle_tx_lpo(ftdm_stream_handle_t *stream, char *name); +static ftdm_status_t handle_tx_lpr(ftdm_stream_handle_t *stream, char *name); static ftdm_status_t handle_status_link(ftdm_stream_handle_t *stream, char *name); static ftdm_status_t handle_status_linkset(ftdm_stream_handle_t *stream, char *name); @@ -488,7 +496,97 @@ ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const cha stream->write_function(stream, "Unknown \"grs\" command\n"); goto handle_cli_error; /**********************************************************************/ - } + } + /**************************************************************************/ + } else if (!strcasecmp(argv[c], "lpo")) { + /**************************************************************************/ + if (check_arg_count(argc, 2)) goto handle_cli_error_argc; + c++; + + if (!strcasecmp(argv[c], "link")) { + /**********************************************************************/ + if (check_arg_count(argc, 3)) goto handle_cli_error_argc; + c++; + + handle_tx_lpo(stream, argv[c]); + /**********************************************************************/ + } else { + /**********************************************************************/ + stream->write_function(stream, "Unknown \"lpo\" command\n"); + goto handle_cli_error; + /**********************************************************************/ + } + /**************************************************************************/ + } else if (!strcasecmp(argv[c], "lpr")) { + /**************************************************************************/ + if (check_arg_count(argc, 2)) goto handle_cli_error_argc; + c++; + + if (!strcasecmp(argv[c], "link")) { + /**********************************************************************/ + if (check_arg_count(argc, 3)) goto handle_cli_error_argc; + c++; + + handle_tx_lpr(stream, argv[c]); + /**********************************************************************/ + } else { + /**********************************************************************/ + stream->write_function(stream, "Unknown \"lpr\" command\n"); + goto handle_cli_error; + /**********************************************************************/ + } + /**************************************************************************/ + } else if (!strcasecmp(argv[c], "activate")) { + /**************************************************************************/ + if (check_arg_count(argc, 2)) goto handle_cli_error_argc; + c++; + + if (!strcasecmp(argv[c], "link")) { + /**********************************************************************/ + if (check_arg_count(argc, 3)) goto handle_cli_error_argc; + c++; + + handle_activate_link(stream, argv[c]); + /**********************************************************************/ + }else if (!strcasecmp(argv[c], "linkset")) { + /**********************************************************************/ + if (check_arg_count(argc, 3)) goto handle_cli_error_argc; + c++; + + handle_activate_linkset(stream, argv[c]); + /**********************************************************************/ + } else { + /**********************************************************************/ + stream->write_function(stream, "Unknown \"activate\" command\n"); + goto handle_cli_error; + /**********************************************************************/ + } + /**************************************************************************/ + } else if (!strcasecmp(argv[c], "deactivate")) { + /**************************************************************************/ + if (check_arg_count(argc, 2)) goto handle_cli_error_argc; + c++; + + if (!strcasecmp(argv[c], "link")) { + /**********************************************************************/ + if (check_arg_count(argc, 3)) goto handle_cli_error_argc; + c++; + + handle_deactivate_link(stream, argv[c]); + /**********************************************************************/ + }else if (!strcasecmp(argv[c], "linkset")) { + /**********************************************************************/ + if (check_arg_count(argc, 3)) goto handle_cli_error_argc; + c++; + + handle_deactivate_linkset(stream, argv[c]); + /**********************************************************************/ + } else { + /**********************************************************************/ + stream->write_function(stream, "Unknown \"deactivate\" command\n"); + goto handle_cli_error; + /**********************************************************************/ + } /**************************************************************************/ } else { /**************************************************************************/ @@ -536,11 +634,18 @@ static ftdm_status_t handle_print_usuage(ftdm_stream_handle_t *stream) stream->write_function(stream, "ftdm ss7 ubl span X chan Y\n"); stream->write_function(stream, "ftdm ss7 rsc span X chan Y\n"); stream->write_function(stream, "ftdm ss7 grs span X chan Y range Z\n"); + stream->write_function(stream, "ftdm ss7 cgb span X chan Y range Z\n"); + stream->write_function(stream, "ftdm ss7 cgu span X chan Y range Z\n"); stream->write_function(stream, "\n"); stream->write_function(stream, "Ftmod_sangoma_ss7 link control:\n"); stream->write_function(stream, "ftdm ss7 inhibit link X\n"); stream->write_function(stream, "ftdm ss7 uninhibit link X\n"); - + stream->write_function(stream, "ftdm ss7 activate link X\n"); + stream->write_function(stream, "ftdm ss7 deactivate link X\n"); + stream->write_function(stream, "ftdm ss7 activate linkset X\n"); + stream->write_function(stream, "ftdm ss7 deactivate linkset X\n"); + stream->write_function(stream, "ftdm ss7 lpo link X\n"); + stream->write_function(stream, "ftdm ss7 lpr link X\n"); stream->write_function(stream, "\n"); return FTDM_SUCCESS; @@ -915,87 +1020,100 @@ static ftdm_status_t handle_show_blocks(ftdm_stream_handle_t *stream, int span, /******************************************************************************/ static ftdm_status_t handle_show_status(ftdm_stream_handle_t *stream, int span, int chan, int verbose) { - int x; - sngss7_chan_data_t *ss7_info; - ftdm_channel_t *ftdmchan; - int lspan; - int lchan; - ftdm_signaling_status_t sigstatus = FTDM_SIG_STATE_DOWN; + int x; + sngss7_chan_data_t *ss7_info; + ftdm_channel_t *ftdmchan; + int lspan; + int lchan; + ftdm_signaling_status_t sigstatus = FTDM_SIG_STATE_DOWN; + sng_isup_ckt_t *ckt; x=1; while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { - if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) { - ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; - ftdmchan = ss7_info->ftdmchan; + /* extract the circuit to make it easier to work with */ + ckt = &g_ftdm_sngss7_data.cfg.isupCkt[x]; /* if span == 0 then all spans should be printed */ if (span == 0) { - lspan = ftdmchan->physical_span_id; + lspan = ckt->span; } else { lspan = span; } /* if chan == 0 then all chans should be printed */ if (chan == 0) { - lchan = ftdmchan->physical_chan_id; + lchan = ckt->chan; } else { lchan = chan; } - if ((ftdmchan->physical_span_id == lspan) && (ftdmchan->physical_chan_id == lchan)) { - /* grab the signaling_status */ - ftdm_channel_get_sig_status(ftdmchan, &sigstatus); - - stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|sig_status=%s|state=%s|", - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id, - ss7_info->circuit->cic, - ftdm_signaling_status2str(sigstatus), - ftdm_channel_state2str(ftdmchan->state)); - - if((sngss7_test_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX)) || (sngss7_test_flag(ss7_info, FLAG_GRP_MN_BLOCK_TX))) { - stream->write_function(stream, "l_mn=Y|"); - }else { - stream->write_function(stream, "l_mn=N|"); - } - - if((sngss7_test_flag(ss7_info, FLAG_CKT_MN_BLOCK_RX)) || (sngss7_test_flag(ss7_info, FLAG_GRP_MN_BLOCK_RX))) { - stream->write_function(stream, "r_mn=Y|"); - }else { - stream->write_function(stream, "r_mn=N|"); - } - - if(sngss7_test_flag(ss7_info, FLAG_GRP_HW_BLOCK_TX)) { - stream->write_function(stream, "l_hw=Y|"); - }else { - stream->write_function(stream, "l_hw=N|"); - } - - if(sngss7_test_flag(ss7_info, FLAG_GRP_HW_BLOCK_RX)) { - stream->write_function(stream, "r_hw=Y|"); - }else { - stream->write_function(stream, "r_hw=N|"); - } - - if(sngss7_test_flag(ss7_info, FLAG_CKT_LC_BLOCK_RX)) { - stream->write_function(stream, "l_mngmt=Y|"); - }else { - stream->write_function(stream, "l_mngmt=N|"); - } - - if(sngss7_test_flag(ss7_info, FLAG_CKT_UCIC_BLOCK)) { - stream->write_function(stream, "l_ucic=Y|"); - }else { - stream->write_function(stream, "l_ucic=N|"); - } - - stream->write_function(stream, "flags=0x%X",ss7_info->flags); + /* check if this circuit is one of the circuits we're interested in */ + if ((ckt->span == lspan) && (ckt->chan == lchan)) { + if (ckt->type == HOLE) { + stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|NOT USED\n", + ckt->span, + ckt->chan, + ckt->cic); + } else if (ckt->type == SIG) { + stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|SIGNALING LINK\n", + ckt->span, + ckt->chan, + ckt->cic); + } else { + ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; + ftdmchan = ss7_info->ftdmchan; - stream->write_function(stream, "\n"); + /* grab the signaling_status */ + ftdm_channel_get_sig_status(ftdmchan, &sigstatus); + + stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|sig_status=%s|state=%s|", + ckt->span, + ckt->chan, + ckt->cic, + ftdm_signaling_status2str(sigstatus), + ftdm_channel_state2str(ftdmchan->state)); + + if((sngss7_test_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX)) || (sngss7_test_flag(ss7_info, FLAG_GRP_MN_BLOCK_TX))) { + stream->write_function(stream, "l_mn=Y|"); + }else { + stream->write_function(stream, "l_mn=N|"); + } + + if((sngss7_test_flag(ss7_info, FLAG_CKT_MN_BLOCK_RX)) || (sngss7_test_flag(ss7_info, FLAG_GRP_MN_BLOCK_RX))) { + stream->write_function(stream, "r_mn=Y|"); + }else { + stream->write_function(stream, "r_mn=N|"); + } + + if(sngss7_test_flag(ss7_info, FLAG_GRP_HW_BLOCK_TX)) { + stream->write_function(stream, "l_hw=Y|"); + }else { + stream->write_function(stream, "l_hw=N|"); + } + + if(sngss7_test_flag(ss7_info, FLAG_GRP_HW_BLOCK_RX)) { + stream->write_function(stream, "r_hw=Y|"); + }else { + stream->write_function(stream, "r_hw=N|"); + } + + if(sngss7_test_flag(ss7_info, FLAG_CKT_LC_BLOCK_RX)) { + stream->write_function(stream, "l_mngmt=Y|"); + }else { + stream->write_function(stream, "l_mngmt=N|"); + } + + if(sngss7_test_flag(ss7_info, FLAG_CKT_UCIC_BLOCK)) { + stream->write_function(stream, "l_ucic=Y|"); + }else { + stream->write_function(stream, "l_ucic=N|"); + } + + stream->write_function(stream, "flags=0x%X",ss7_info->flags); + + stream->write_function(stream, "\n"); + } /* if ( hole, sig, voice) */ } /* if ( span and chan) */ - - } /* if ( cic != 0) */ - /* go the next circuit */ x++; } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ @@ -1517,6 +1635,193 @@ static ftdm_status_t handle_tx_cgu(ftdm_stream_handle_t *stream, int span, int c } /******************************************************************************/ +static ftdm_status_t handle_activate_link(ftdm_stream_handle_t *stream, char *name) +{ + int x = 0; + + /* find the link request by it's name */ + x = 1; + while(g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) { + if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtpLink[x].name, name)) { + + /* send the uninhibit request */ + if (ftmod_ss7_activate_mtplink(x)) { + stream->write_function(stream, "Failed to activate link=%s\n", name); + return FTDM_FAIL; + } + + /* print the new status of the link */ + handle_status_link(stream, &name[0]); + goto success; + } + + /* move to the next link */ + x++; + } /* while (id != 0) */ + + stream->write_function(stream, "Could not find link=%s\n", name); + +success: + return FTDM_SUCCESS; +} + +/******************************************************************************/ +static ftdm_status_t handle_deactivate_link(ftdm_stream_handle_t *stream, char *name) +{ + int x = 0; + + /* find the link request by it's name */ + x = 1; + while(g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) { + if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtpLink[x].name, name)) { + + /* send the deactivate request */ + if (ftmod_ss7_deactivate2_mtplink(x)) { + stream->write_function(stream, "Failed to deactivate link=%s\n", name); + return FTDM_FAIL; + } + + /* print the new status of the link */ + handle_status_link(stream, &name[0]); + goto success; + } + + /* move to the next link */ + x++; + } /* while (id != 0) */ + + stream->write_function(stream, "Could not find link=%s\n", name); + +success: + return FTDM_SUCCESS; +} + +/******************************************************************************/ +static ftdm_status_t handle_activate_linkset(ftdm_stream_handle_t *stream, char *name) +{ + int x = 0; + + /* find the linkset request by it's name */ + x = 1; + while(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) { + if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name, name)) { + + /* send the activate request */ + if (ftmod_ss7_activate_mtplinkSet(x)) { + stream->write_function(stream, "Failed to activate linkset=%s\n", name); + return FTDM_FAIL; + } + + /* print the new status of the linkset */ + handle_status_linkset(stream, &name[0]); + goto success; + } + + /* move to the next linkset */ + x++; + } /* while (id != 0) */ + + stream->write_function(stream, "Could not find linkset=%s\n", name); + +success: + return FTDM_SUCCESS; +} + +/******************************************************************************/ +static ftdm_status_t handle_deactivate_linkset(ftdm_stream_handle_t *stream, char *name) +{ + int x = 0; + + /* find the linkset request by it's name */ + x = 1; + while(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) { + if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name, name)) { + + /* send the deactivate request */ + if (ftmod_ss7_deactivate2_mtplinkSet(x)) { + stream->write_function(stream, "Failed to deactivate linkset=%s\n", name); + return FTDM_FAIL; + } + + /* print the new status of the linkset */ + handle_status_linkset(stream, &name[0]); + goto success; + } + + /* move to the next linkset */ + x++; + } /* while (id != 0) */ + + stream->write_function(stream, "Could not find linkset=%s\n", name); + +success: + return FTDM_SUCCESS; +} + +/******************************************************************************/ + +static ftdm_status_t handle_tx_lpo(ftdm_stream_handle_t *stream, char *name) +{ + int x = 0; + + /* find the link request by it's name */ + x = 1; + while(g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) { + if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtpLink[x].name, name)) { + + /* send the uninhibit request */ + if (ftmod_ss7_lpo_mtplink(x)) { + stream->write_function(stream, "Failed set LPO link=%s\n", name); + return FTDM_FAIL; + } + + /* print the new status of the link */ + handle_status_link(stream, &name[0]); + goto success; + } + + /* move to the next link */ + x++; + } /* while (id != 0) */ + + stream->write_function(stream, "Could not find link=%s\n", name); + +success: + return FTDM_SUCCESS; +} + +/******************************************************************************/ +static ftdm_status_t handle_tx_lpr(ftdm_stream_handle_t *stream, char *name) +{ + int x = 0; + + /* find the link request by it's name */ + x = 1; + while(g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) { + if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtpLink[x].name, name)) { + + /* send the uninhibit request */ + if (ftmod_ss7_lpr_mtplink(x)) { + stream->write_function(stream, "Failed set LPR link=%s\n", name); + return FTDM_FAIL; + } + + /* print the new status of the link */ + handle_status_link(stream, &name[0]); + goto success; + } + + /* move to the next link */ + x++; + } /* while (id != 0) */ + + stream->write_function(stream, "Could not find link=%s\n", name); + +success: + return FTDM_SUCCESS; +} + +/******************************************************************************/ static ftdm_status_t extract_span_chan(char *argv[10], int pos, int *span, int *chan) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c index 52b3860..0d76329 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c @@ -50,6 +50,17 @@ static int ftmod_ss7_enable_mtpLinkSet(int lnkSetId); int ftmod_ss7_inhibit_mtplink(uint32_t id); int ftmod_ss7_uninhibit_mtplink(uint32_t id); + +int ftmod_ss7_activate_mtplink(uint32_t id); +int ftmod_ss7_deactivate_mtplink(uint32_t id); +int ftmod_ss7_deactivate2_mtplink(uint32_t id); + +int ftmod_ss7_activate_mtplinkSet(uint32_t id); +int ftmod_ss7_deactivate_mtplinkSet(uint32_t id); +int ftmod_ss7_deactivate2_mtplinkSet(uint32_t id); + +int ftmod_ss7_lpo_mtplink(uint32_t id); +int ftmod_ss7_lpr_mtplink(uint32_t id); /******************************************************************************/ /* FUNCTIONS ******************************************************************/ @@ -272,6 +283,248 @@ int ftmod_ss7_uninhibit_mtplink(uint32_t id) } /******************************************************************************/ +int ftmod_ss7_activate_mtplink(uint32_t id) +{ + SnMngmt cntrl; + Pst pst; + + /* initalize the post structure */ + smPstInit(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTSN; + + /* initalize the control structure */ + memset(&cntrl, 0x0, sizeof(SnMngmt)); + + /* initalize the control header */ + smHdrInit(&cntrl.hdr); + + cntrl.hdr.msgType = TCNTRL; /* this is a control request */ + cntrl.hdr.entId.ent = ENTSN; + cntrl.hdr.entId.inst = S_INST; + cntrl.hdr.elmId.elmnt = STDLSAP; + cntrl.hdr.elmId.elmntInst1 = g_ftdm_sngss7_data.cfg.mtpLink[id].id; + + cntrl.t.cntrl.action = AENA; /* Activate */ + cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ + + return (sng_cntrl_mtp3(&pst, &cntrl)); +} + +/******************************************************************************/ +int ftmod_ss7_deactivate_mtplink(uint32_t id) +{ + SnMngmt cntrl; + Pst pst; + + /* initalize the post structure */ + smPstInit(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTSN; + + /* initalize the control structure */ + memset(&cntrl, 0x0, sizeof(SnMngmt)); + + /* initalize the control header */ + smHdrInit(&cntrl.hdr); + + cntrl.hdr.msgType = TCNTRL; /* this is a control request */ + cntrl.hdr.entId.ent = ENTSN; + cntrl.hdr.entId.inst = S_INST; + cntrl.hdr.elmId.elmnt = STDLSAP; + cntrl.hdr.elmId.elmntInst1 = g_ftdm_sngss7_data.cfg.mtpLink[id].id; + + cntrl.t.cntrl.action = ADISIMM; /* Deactivate */ + cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ + + return (sng_cntrl_mtp3(&pst, &cntrl)); +} + +/******************************************************************************/ +int ftmod_ss7_deactivate2_mtplink(uint32_t id) +{ + SnMngmt cntrl; + Pst pst; + + /* initalize the post structure */ + smPstInit(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTSN; + + /* initalize the control structure */ + memset(&cntrl, 0x0, sizeof(SnMngmt)); + + /* initalize the control header */ + smHdrInit(&cntrl.hdr); + + cntrl.hdr.msgType = TCNTRL; /* this is a control request */ + cntrl.hdr.entId.ent = ENTSN; + cntrl.hdr.entId.inst = S_INST; + cntrl.hdr.elmId.elmnt = STDLSAP; + cntrl.hdr.elmId.elmntInst1 = g_ftdm_sngss7_data.cfg.mtpLink[id].id; + + cntrl.t.cntrl.action = ADISIMM_L2; /* Deactivate...layer 2 only */ + cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ + + return (sng_cntrl_mtp3(&pst, &cntrl)); +} + +/******************************************************************************/ +int ftmod_ss7_activate_mtplinkSet(uint32_t id) +{ + SnMngmt cntrl; + Pst pst; + + /* initalize the post structure */ + smPstInit(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTSN; + + /* initalize the control structure */ + memset(&cntrl, 0x0, sizeof(SnMngmt)); + + /* initalize the control header */ + smHdrInit(&cntrl.hdr); + + cntrl.hdr.msgType = TCNTRL; /* this is a control request */ + cntrl.hdr.entId.ent = ENTSN; + cntrl.hdr.entId.inst = S_INST; + cntrl.hdr.elmId.elmnt = STLNKSET; + cntrl.hdr.elmId.elmntInst1 = g_ftdm_sngss7_data.cfg.mtpLinkSet[id].id; + + cntrl.t.cntrl.action = AACTLNKSET; /* Activate */ + cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ + + return (sng_cntrl_mtp3(&pst, &cntrl)); +} + +/******************************************************************************/ +int ftmod_ss7_deactivate_mtplinkSet(uint32_t id) +{ + SnMngmt cntrl; + Pst pst; + + /* initalize the post structure */ + smPstInit(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTSN; + + /* initalize the control structure */ + memset(&cntrl, 0x0, sizeof(SnMngmt)); + + /* initalize the control header */ + smHdrInit(&cntrl.hdr); + + cntrl.hdr.msgType = TCNTRL; /* this is a control request */ + cntrl.hdr.entId.ent = ENTSN; + cntrl.hdr.entId.inst = S_INST; + cntrl.hdr.elmId.elmnt = STLNKSET; + cntrl.hdr.elmId.elmntInst1 = g_ftdm_sngss7_data.cfg.mtpLinkSet[id].id; + + cntrl.t.cntrl.action = ADEACTLNKSET; /* Activate */ + cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ + + return (sng_cntrl_mtp3(&pst, &cntrl)); +} + +/******************************************************************************/ +int ftmod_ss7_deactivate2_mtplinkSet(uint32_t id) +{ + SnMngmt cntrl; + Pst pst; + + /* initalize the post structure */ + smPstInit(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTSN; + + /* initalize the control structure */ + memset(&cntrl, 0x0, sizeof(SnMngmt)); + + /* initalize the control header */ + smHdrInit(&cntrl.hdr); + + cntrl.hdr.msgType = TCNTRL; /* this is a control request */ + cntrl.hdr.entId.ent = ENTSN; + cntrl.hdr.entId.inst = S_INST; + cntrl.hdr.elmId.elmnt = STLNKSET; + cntrl.hdr.elmId.elmntInst1 = g_ftdm_sngss7_data.cfg.mtpLinkSet[id].id; + + cntrl.t.cntrl.action = ADEACTLNKSET_L2; /* Activate */ + cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ + + return (sng_cntrl_mtp3(&pst, &cntrl)); +} + +/******************************************************************************/ +int ftmod_ss7_lpo_mtplink(uint32_t id) +{ + SnMngmt cntrl; + Pst pst; + + /* initalize the post structure */ + smPstInit(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTSN; + + /* initalize the control structure */ + memset(&cntrl, 0x0, sizeof(SnMngmt)); + + /* initalize the control header */ + smHdrInit(&cntrl.hdr); + + cntrl.hdr.msgType = TCNTRL; /* this is a control request */ + cntrl.hdr.entId.ent = ENTSN; + cntrl.hdr.entId.inst = S_INST; + cntrl.hdr.elmId.elmnt = STDLSAP; + cntrl.hdr.elmId.elmntInst1 = g_ftdm_sngss7_data.cfg.mtpLink[id].id; + + cntrl.t.cntrl.action = ACTION_LPO; /* Activate */ + cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ + + return (sng_cntrl_mtp3(&pst, &cntrl)); +} + +/******************************************************************************/ +int ftmod_ss7_lpr_mtplink(uint32_t id) +{ + SnMngmt cntrl; + Pst pst; + + /* initalize the post structure */ + smPstInit(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTSN; + + /* initalize the control structure */ + memset(&cntrl, 0x0, sizeof(SnMngmt)); + + /* initalize the control header */ + smHdrInit(&cntrl.hdr); + + cntrl.hdr.msgType = TCNTRL; /* this is a control request */ + cntrl.hdr.entId.ent = ENTSN; + cntrl.hdr.entId.inst = S_INST; + cntrl.hdr.elmId.elmnt = STDLSAP; + cntrl.hdr.elmId.elmntInst1 = g_ftdm_sngss7_data.cfg.mtpLink[id].id; + + cntrl.t.cntrl.action = ACTION_LPR; /* Activate */ + cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ + + return (sng_cntrl_mtp3(&pst, &cntrl)); +} + +/******************************************************************************/ + +/******************************************************************************/ /* For Emacs: * Local Variables: * mode:c diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index a76b82a..5064d48 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -1123,21 +1123,10 @@ ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t circui /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - i++; - SS7_ASSERT; - }; - /* check if the circuit is fully started */ if (ftdm_test_flag(ftdmchan->span, FTDM_SPAN_IN_THREAD)) { /* set the pause flag on the channel */ sngss7_set_flag(sngss7_info, FLAG_INFID_PAUSED); - - /* set the statet o SUSPENDED to bring the sig status down */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); } /* unlock the channel again before we exit */ @@ -1185,14 +1174,6 @@ ftdm_status_t handle_resume(uint32_t suInstId, uint32_t spInstId, uint32_t circu /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - i++; - SS7_ASSERT; - }; - /* only resume if we are paused */ if (sngss7_test_flag(sngss7_info, FLAG_INFID_PAUSED)) { /* set the resume flag on the channel */ @@ -1200,9 +1181,6 @@ ftdm_status_t handle_resume(uint32_t suInstId, uint32_t spInstId, uint32_t circu /* clear the paused flag */ sngss7_clear_flag(sngss7_info, FLAG_INFID_PAUSED); - - /* set the statet to SUSPENDED to bring the sig status up */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); } /* unlock the channel again before we exit */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index 70a1a05..6fba4e9 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -347,6 +347,9 @@ static void *ftdm_sangoma_ss7_run(ftdm_thread_t * me, void *obj) /* check if the rx_grs has cleared */ check_if_rx_grs_processed(ftdmspan); } /* if (sngss7_span->rx_grs.range > 0) */ + + /* check each channel on the span to see if there is an un-procressed SUS/RES flag */ + check_for_res_sus_flag(ftdmspan); } /* master while loop */ /* clear the IN_THREAD flag so that we know the thread is done */ @@ -948,31 +951,6 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) SS7_DEBUG_CHAN(ftdmchan,"Current flags: 0x%X\n", sngss7_info->flags); /**********************************************************************/ - if (sngss7_test_flag (sngss7_info, FLAG_INFID_PAUSED)) { - SS7_DEBUG_CHAN(ftdmchan, "Processing PAUSE flag %s\n", ""); - - /* bring the channel signaling status to down */ - sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.sigstatus = FTDM_SIG_STATE_DOWN; - ftdm_span_send_signal (ftdmchan->span, &sigev); - - /* check the last state and return to it to allow the call to finish */ - goto suspend_goto_last; - } - - if (sngss7_test_flag (sngss7_info, FLAG_INFID_RESUME)) { - SS7_DEBUG_CHAN(ftdmchan, "Processing RESUME flag %s\n", ""); - - /* the reset flag is set for the first channel in the span at handle_resume */ - - /* clear the resume flag */ - sngss7_clear_flag(sngss7_info, FLAG_INFID_RESUME); - - /* go to restart state */ - goto suspend_goto_last; - } - - /**********************************************************************/ if (sngss7_test_flag (sngss7_info, FLAG_CKT_MN_BLOCK_RX)) { SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_BLOCK_RX flag %s\n", ""); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index 555c0d9..415a897 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -454,6 +454,14 @@ int ftmod_ss7_cc_isap_config(int id); int ftmod_ss7_inhibit_mtplink(uint32_t id); int ftmod_ss7_uninhibit_mtplink(uint32_t id); +int ftmod_ss7_activate_mtplink(uint32_t id); +int ftmod_ss7_deactivate_mtplink(uint32_t id); +int ftmod_ss7_deactivate2_mtplink(uint32_t id); +int ftmod_ss7_activate_mtplinkSet(uint32_t id); +int ftmod_ss7_deactivate_mtplinkSet(uint32_t id); +int ftmod_ss7_deactivate2_mtplinkSet(uint32_t id); +int ftmod_ss7_lpo_mtplink(uint32_t id); +int ftmod_ss7_lpr_mtplink(uint32_t id); int ftmod_ss7_mtplink_sta(uint32_t id, SnMngmt *cfm); int ftmod_ss7_mtplinkSet_sta(uint32_t id, SnMngmt *cfm); @@ -539,6 +547,7 @@ void handle_isup_t35(void *userdata); ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const char *data); ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan); +ftdm_status_t check_for_res_sus_flag(ftdm_span_t *ftdmspan); /******************************************************************************/ /* MACROS *********************************************************************/ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index 46bd39f..879fcd2 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -204,29 +204,29 @@ void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan) memset (&acm, 0x0, sizeof (acm)); /* fill in the needed information for the ACM */ - acm.bckCallInd.eh.pres = PRSNT_NODEF; - acm.bckCallInd.chrgInd.pres = PRSNT_NODEF; - acm.bckCallInd.chrgInd.val = 0x00; - acm.bckCallInd.cadPtyStatInd.pres = PRSNT_NODEF; - acm.bckCallInd.cadPtyStatInd.val = 0x01; - acm.bckCallInd.cadPtyCatInd.pres = PRSNT_NODEF; - acm.bckCallInd.cadPtyCatInd.val = 0x00; - acm.bckCallInd.end2EndMethInd.pres = PRSNT_NODEF; - acm.bckCallInd.end2EndMethInd.val = 0x00; - acm.bckCallInd.intInd.pres = PRSNT_NODEF; - acm.bckCallInd.intInd.val = 0x00; - acm.bckCallInd.end2EndInfoInd.pres = PRSNT_NODEF; - acm.bckCallInd.end2EndInfoInd.val = 0x00; - acm.bckCallInd.isdnUsrPrtInd.pres = PRSNT_NODEF; - acm.bckCallInd.isdnUsrPrtInd.val = 0x0; - acm.bckCallInd.holdInd.pres = PRSNT_NODEF; - acm.bckCallInd.holdInd.val = 0x00; - acm.bckCallInd.isdnAccInd.pres = PRSNT_NODEF; - acm.bckCallInd.isdnAccInd.val = 0x0; - acm.bckCallInd.echoCtrlDevInd.pres = PRSNT_NODEF; - acm.bckCallInd.echoCtrlDevInd.val = 0x0; - acm.bckCallInd.sccpMethInd.pres = PRSNT_NODEF; - acm.bckCallInd.sccpMethInd.val = 0x00; + acm.bckCallInd.eh.pres = PRSNT_NODEF; + acm.bckCallInd.chrgInd.pres = PRSNT_NODEF; + acm.bckCallInd.chrgInd.val = 0x00; + acm.bckCallInd.cadPtyStatInd.pres = PRSNT_NODEF; + acm.bckCallInd.cadPtyStatInd.val = 0x01; + acm.bckCallInd.cadPtyCatInd.pres = PRSNT_NODEF; + acm.bckCallInd.cadPtyCatInd.val = 0x00; + acm.bckCallInd.end2EndMethInd.pres = PRSNT_NODEF; + acm.bckCallInd.end2EndMethInd.val = 0x00; + acm.bckCallInd.intInd.pres = PRSNT_NODEF; + acm.bckCallInd.intInd.val = 0x00; + acm.bckCallInd.end2EndInfoInd.pres = PRSNT_NODEF; + acm.bckCallInd.end2EndInfoInd.val = 0x00; + acm.bckCallInd.isdnUsrPrtInd.pres = PRSNT_NODEF; + acm.bckCallInd.isdnUsrPrtInd.val = 0x0; + acm.bckCallInd.holdInd.pres = PRSNT_NODEF; + acm.bckCallInd.holdInd.val = 0x00; + acm.bckCallInd.isdnAccInd.pres = PRSNT_NODEF; + acm.bckCallInd.isdnAccInd.val = 0x0; + acm.bckCallInd.echoCtrlDevInd.pres = PRSNT_NODEF; + acm.bckCallInd.echoCtrlDevInd.val = 0x1; /* ec device present */ + acm.bckCallInd.sccpMethInd.pres = PRSNT_NODEF; + acm.bckCallInd.sccpMethInd.val = 0x00; /* send the ACM request to LibSngSS7 */ sng_cc_con_status (1, diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c index 305e1a5..d238462 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c @@ -68,7 +68,7 @@ int ftmod_ss7_mtplinkSet_sta(uint32_t id, SnMngmt *cfm) sta.hdr.elmId.elmnt = STLNKSET; sta.hdr.elmId.elmntInst1 = g_ftdm_sngss7_data.cfg.mtpLinkSet[id].id; - sta.hdr.elmId.elmntInst2 = 1; + sta.hdr.elmId.elmntInst2 = g_ftdm_sngss7_data.cfg.mtpLinkSet[id].links[0]; return(sng_sta_mtp3(&sta, cfm)); } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 161a70d..181b769 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -58,6 +58,7 @@ unsigned long get_unique_id(void); ftdm_status_t extract_chan_data(uint32_t circuit, sngss7_chan_data_t **sngss7_info, ftdm_channel_t **ftdmchan); ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan); +ftdm_status_t check_for_res_sus_flag(ftdm_span_t *ftdmspan); /******************************************************************************/ /* FUNCTIONS ******************************************************************/ @@ -541,6 +542,64 @@ GRS_UNLOCK_ALL: } /******************************************************************************/ +ftdm_status_t check_for_res_sus_flag(ftdm_span_t *ftdmspan) +{ + ftdm_channel_t *ftdmchan = NULL; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_sigmsg_t sigev; + int x; + + for (x = 1; x < (ftdmspan->chan_count + 1); x++) { + + /* extract the channel structure and sngss7 channel data */ + ftdmchan = ftdmspan->channels[x]; + + /* if the call data is NULL move on */ + if (ftdmchan->call_data == NULL) continue; + + sngss7_info = ftdmchan->call_data; + + /* lock the channel */ + ftdm_mutex_lock(ftdmchan->mutex); + + memset (&sigev, 0, sizeof (sigev)); + + sigev.chan_id = ftdmchan->chan_id; + sigev.span_id = ftdmchan->span_id; + sigev.channel = ftdmchan; + + if ((sngss7_test_flag(sngss7_info, FLAG_INFID_PAUSED)) && + (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP))) { + + /* bring the sig status down */ + sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; + sigev.sigstatus = FTDM_SIG_STATE_DOWN; + ftdm_span_send_signal(ftdmchan->span, &sigev); + } + + if ((sngss7_test_flag(sngss7_info, FLAG_INFID_RESUME)) && + !(ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP))) { + + /* bring the sig status back up */ + sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; + sigev.sigstatus = FTDM_SIG_STATE_UP; + ftdm_span_send_signal(ftdmchan->span, &sigev); + + sngss7_clear_flag(sngss7_info, FLAG_INFID_RESUME); + } + + /* unlock the channel */ + ftdm_mutex_unlock(ftdmchan->mutex); + + } /* for (x = 1; x < (span->chan_count + 1); x++) */ + + /* signal the core that sig events are queued for processing */ + ftdm_span_trigger_signals(ftdmspan); + + return FTDM_SUCCESS; +} + +/******************************************************************************/ /******************************************************************************/ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c index cf0bf7c..bd1be4b 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c @@ -1600,11 +1600,10 @@ static int ftmod_ss7_fill_in_circuits(char *ch_map, int cicbase, int typeCntrl, g_ftdm_sngss7_data.cfg.isupCkt[x].chan = count; if (timeslot.siglink) { g_ftdm_sngss7_data.cfg.isupCkt[x].type = SIG; - } else if (timeslot.hole) { - g_ftdm_sngss7_data.cfg.isupCkt[x].type = HOLE; } else { - g_ftdm_sngss7_data.cfg.isupCkt[x].type = VOICE; + g_ftdm_sngss7_data.cfg.isupCkt[x].type = HOLE; } + if (timeslot.channel) { g_ftdm_sngss7_data.cfg.isupCkt[x].cic = cicbase; cicbase++; @@ -1625,6 +1624,10 @@ static int ftmod_ss7_fill_in_circuits(char *ch_map, int cicbase, int typeCntrl, g_ftdm_sngss7_data.cfg.isupCkt[x].obj = ss7_info; } /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].id == 0) */ + + /* increment the span channel count */ + count++; + } else { /* if ((timeslot.siglink) || (timeslot.gap)) */ /* find the ftdm the channel structure for this channel*/ i = 1; commit b77518685cffcf59a4a26ae3bcde9b0d7a5cb75b Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Sep 13 15:27:10 2010 -0500 make fore-subscription-expires only work on nonzero expire deltas, 0 means unscubscribe diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index f889202..5eb71b3 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -2043,7 +2043,11 @@ void sofia_presence_handle_sip_i_subscribe(int status, from_host = "n/a"; } - exp_delta = profile->force_subscription_expires ? profile->force_subscription_expires : (sip->sip_expires ? sip->sip_expires->ex_delta : 3600); + if ((exp_delta = sip->sip_expires ? sip->sip_expires->ex_delta : 3600)) { + if (profile->force_subscription_expires) { + exp_delta = profile->force_subscription_expires; + } + } if (exp_delta) { exp_abs = (long) switch_epoch_time_now(NULL) + exp_delta; commit 0279261b0bf468f6d36bec6fa5bb359d2c3f17c2 Author: Brian West <brian@freeswitch.org> Date: Mon Sep 13 13:04:46 2010 -0500 default example to resolve some issues with SCA in cases where host and ip are mixed causing the phone to be confused. diff --git a/conf/dialplan/default.xml b/conf/dialplan/default.xml index dec163e..b143280 100644 --- a/conf/dialplan/default.xml +++ b/conf/dialplan/default.xml @@ -263,7 +263,7 @@ <action application="set" data="called_party_callgroup=${user_data(${dialed_extension}@${domain_name} var callgroup)}"/> <!--<action application="export" data="nolocal:sip_secure_media=${user_data(${dialed_extension}@${domain_name} var sip_secure_media)}"/>--> <action application="hash" data="insert/${domain_name}-last_dial/${called_party_callgroup}/${uuid}"/> - <action application="bridge" data="user/${dialed_extension}@${domain_name}"/> + <action application="bridge" data="{sip_invite_domain=$${domain}}user/${dialed_extension}@${domain_name}"/> <action application="answer"/> <action application="sleep" data="1000"/> <action application="bridge" data="loopback/app=voicemail:default ${domain_name} ${dialed_extension}"/> commit 66cec884baae60692f041aab6f73806b4a906a3d Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Sep 13 12:51:30 2010 -0500 fix small presence status bug diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 73d9303..f889202 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1442,7 +1442,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * op = switch_event_get_header(helper->event, "Caller-Callee-ID-Number"); } - if (!op) { + if (zstr(op)) { op = switch_event_get_header(helper->event, "Caller-Destination-Number"); } @@ -1452,7 +1452,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * if (!strcmp(astate, "early")) { if (zstr(op)) { - switch_snprintf(status_line, sizeof(status_line), "%s %s", what, status); + switch_snprintf(status_line, sizeof(status_line), "%sing", what); } else { switch_snprintf(status_line, sizeof(status_line), "%s %s", what, op); } commit a53933eddb2ef33af0b7e4b972744b862eaaeaf4 Author: Rupa Schomaker <rupa@rupa.com> Date: Mon Sep 13 12:12:04 2010 -0500 NAT refresh in own thread diff --git a/src/switch_nat.c b/src/switch_nat.c index 66d75e8..536baee 100644 --- a/src/switch_nat.c +++ b/src/switch_nat.c @@ -690,7 +690,7 @@ SWITCH_DECLARE(void) switch_nat_late_init(void) { if (nat_globals_perm.running == 1) { switch_scheduler_add_task(switch_epoch_time_now(NULL) + NAT_REFRESH_INTERVAL, switch_nat_republish_sched, "nat_republish", "core", 0, NULL, - SSHF_NONE); + SSHF_OWN_THREAD); } } commit 403bf6af1c4f0a86424a2f433592f920e3b1c033 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Sep 13 10:57:52 2010 -0500 make sure hold-related code is skipped 100% with disable-hold set diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 8054c8d..3dd8309 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -3590,11 +3590,12 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s if (sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_HOLD) || ((val = switch_channel_get_variable(tech_pvt->channel, "sip_disable_hold")) && switch_true(val))) { sendonly = 0; - } + } else { - if (!tech_pvt->hold_laps) { - tech_pvt->hold_laps++; - sofia_glue_toggle_hold(tech_pvt, sendonly); + if (!tech_pvt->hold_laps) { + tech_pvt->hold_laps++; + sofia_glue_toggle_hold(tech_pvt, sendonly); + } } for (m = sdp->sdp_media; m; m = m->m_next) { commit 5f012813efd18fe7e46a359fe80d2c5287a6c6da Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Sep 13 10:41:27 2010 -0500 add quotes to vm_cc command generated internally to escape spaces in the caller id name diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 732059a..069cfd8 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -3172,7 +3172,7 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p switch_event_destroy(&vars); if (status == SWITCH_STATUS_SUCCESS) { if ((vm_cc = switch_channel_get_variable(channel, "vm_cc"))) { - char *cmd = switch_core_session_sprintf(session, "%s %s %s %s %s@%s %s", + char *cmd = switch_core_session_sprintf(session, "%s %s %s '%s' %s@%s %s", vm_cc, file_path, caller_id_number, caller_id_name, id, domain_name, read_flags); if (voicemail_inject(cmd, session) == SWITCH_STATUS_SUCCESS) { commit 5be58aac1b545e191b4e27e4b0cec7b7ea5c0585 Author: Jeff Lenk <jeff@jefflenk.com> Date: Mon Sep 13 09:40:03 2010 -0500 mod_managed - add some additional support diff --git a/src/mod/languages/mod_managed/freeswitch.i b/src/mod/languages/mod_managed/freeswitch.i index 9698397..ffbdf9b 100644 --- a/src/mod/languages/mod_managed/freeswitch.i +++ b/src/mod/languages/mod_managed/freeswitch.i @@ -193,7 +193,10 @@ char * SWIG_csharp_string_callback(const char * str) { %include switch_core_db.h %include switch_regex.h %include switch_core.h -//%include switch_loadable_module.h // todo: Sort out some linking issues +%ignore switch_module_runtime; +%ignore switch_module_load; +%ignore switch_module_shutdown; +%include switch_loadable_module.h // note: Above three ignore lines sort out some linking issues %include switch_console.h // Has unsupported varargs functions %include switch_utils.h %include switch_caller.h diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx index 908a851..4b0a1df 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx @@ -10097,6 +10097,838 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_in_thread(void * jarg1) { } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_module_name_set(void * jarg1, char * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + char *arg2 = (char *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (char *)jarg2; + { + if (arg2) { + arg1->module_name = (char const *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->module_name, (const char *)arg2); + } else { + arg1->module_name = 0; + } + } +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_loadable_module_interface_module_name_get(void * jarg1) { + char * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + char *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (char *) ((arg1)->module_name); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_endpoint_interface_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_endpoint_interface_t *arg2 = (switch_endpoint_interface_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_endpoint_interface_t *)jarg2; + if (arg1) (arg1)->endpoint_interface = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_endpoint_interface_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_endpoint_interface_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_endpoint_interface_t *) ((arg1)->endpoint_interface); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_timer_interface_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_timer_interface_t *arg2 = (switch_timer_interface_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_timer_interface_t *)jarg2; + if (arg1) (arg1)->timer_interface = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_timer_interface_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_timer_interface_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_timer_interface_t *) ((arg1)->timer_interface); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_dialplan_interface_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_dialplan_interface_t *arg2 = (switch_dialplan_interface_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_dialplan_interface_t *)jarg2; + if (arg1) (arg1)->dialplan_interface = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_dialplan_interface_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_dialplan_interface_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_dialplan_interface_t *) ((arg1)->dialplan_interface); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_codec_interface_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_codec_interface_t *arg2 = (switch_codec_interface_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_codec_interface_t *)jarg2; + if (arg1) (arg1)->codec_interface = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_codec_interface_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_codec_interface_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_codec_interface_t *) ((arg1)->codec_interface); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_application_interface_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_application_interface_t *arg2 = (switch_application_interface_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_application_interface_t *)jarg2; + if (arg1) (arg1)->application_interface = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_application_interface_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_application_interface_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_application_interface_t *) ((arg1)->application_interface); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_api_interface_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_api_interface_t *arg2 = (switch_api_interface_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_api_interface_t *)jarg2; + if (arg1) (arg1)->api_interface = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_api_interface_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_api_interface_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_api_interface_t *) ((arg1)->api_interface); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_file_interface_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_file_interface_t *arg2 = (switch_file_interface_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_file_interface_t *)jarg2; + if (arg1) (arg1)->file_interface = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_file_interface_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_file_interface_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_file_interface_t *) ((arg1)->file_interface); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_speech_interface_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_speech_interface_t *arg2 = (switch_speech_interface_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_speech_interface_t *)jarg2; + if (arg1) (arg1)->speech_interface = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_speech_interface_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_speech_interface_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_speech_interface_t *) ((arg1)->speech_interface); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_directory_interface_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_directory_interface_t *arg2 = (switch_directory_interface_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_directory_interface_t *)jarg2; + if (arg1) (arg1)->directory_interface = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_directory_interface_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_directory_interface_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_directory_interface_t *) ((arg1)->directory_interface); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_chat_interface_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_chat_interface_t *arg2 = (switch_chat_interface_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_chat_interface_t *)jarg2; + if (arg1) (arg1)->chat_interface = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_chat_interface_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_chat_interface_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_chat_interface_t *) ((arg1)->chat_interface); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_say_interface_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_say_interface_t *arg2 = (switch_say_interface_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_say_interface_t *)jarg2; + if (arg1) (arg1)->say_interface = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_say_interface_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_say_interface_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_say_interface_t *) ((arg1)->say_interface); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_asr_interface_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_asr_interface_t *arg2 = (switch_asr_interface_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_asr_interface_t *)jarg2; + if (arg1) (arg1)->asr_interface = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_asr_interface_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_asr_interface_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_asr_interface_t *) ((arg1)->asr_interface); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_management_interface_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_management_interface_t *arg2 = (switch_management_interface_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_management_interface_t *)jarg2; + if (arg1) (arg1)->management_interface = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_management_interface_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_management_interface_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_management_interface_t *) ((arg1)->management_interface); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_limit_interface_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_limit_interface_t *arg2 = (switch_limit_interface_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_limit_interface_t *)jarg2; + if (arg1) (arg1)->limit_interface = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_limit_interface_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_limit_interface_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_limit_interface_t *) ((arg1)->limit_interface); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_rwlock_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_thread_rwlock_t *)jarg2; + if (arg1) (arg1)->rwlock = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_rwlock_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_thread_rwlock_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_thread_rwlock_t *) ((arg1)->rwlock); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_refs_set(void * jarg1, int jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + int arg2 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (int)jarg2; + if (arg1) (arg1)->refs = arg2; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_loadable_module_interface_refs_get(void * jarg1) { + int jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + int result; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (int) ((arg1)->refs); + jresult = result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_pool_set(void * jarg1, void * jarg2) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + arg2 = (switch_memory_pool_t *)jarg2; + if (arg1) (arg1)->pool = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_interface_pool_get(void * jarg1) { + void * jresult ; + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + switch_memory_pool_t *result = 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + result = (switch_memory_pool_t *) ((arg1)->pool); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_loadable_module_interface() { + void * jresult ; + switch_loadable_module_interface *result = 0 ; + + result = (switch_loadable_module_interface *)new switch_loadable_module_interface(); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_loadable_module_interface(void * jarg1) { + switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; + + arg1 = (switch_loadable_module_interface *)jarg1; + delete arg1; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_loadable_module_init() { + int jresult ; + switch_status_t result; + + result = (switch_status_t)switch_loadable_module_init(); + jresult = result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_shutdown() { + switch_loadable_module_shutdown(); +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_endpoint_interface(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_endpoint_interface_t *result = 0 ; + + arg1 = (char *)jarg1; + result = (switch_endpoint_interface_t *)switch_loadable_module_get_endpoint_interface((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_codec_interface(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_codec_interface_t *result = 0 ; + + arg1 = (char *)jarg1; + result = (switch_codec_interface_t *)switch_loadable_module_get_codec_interface((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_dialplan_interface(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_dialplan_interface_t *result = 0 ; + + arg1 = (char *)jarg1; + result = (switch_dialplan_interface_t *)switch_loadable_module_get_dialplan_interface((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_loadable_module_enumerate_available(char * jarg1, void * jarg2, void * jarg3) { + int jresult ; + char *arg1 = (char *) 0 ; + switch_modulename_callback_func_t arg2 = (switch_modulename_callback_func_t) 0 ; + void *arg3 = (void *) 0 ; + switch_status_t result; + + arg1 = (char *)jarg1; + arg2 = (switch_modulename_callback_func_t)jarg2; + arg3 = (void *)jarg3; + result = (switch_status_t)switch_loadable_module_enumerate_available((char const *)arg1,arg2,arg3); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_loadable_module_enumerate_loaded(void * jarg1, void * jarg2) { + int jresult ; + switch_modulename_callback_func_t arg1 = (switch_modulename_callback_func_t) 0 ; + void *arg2 = (void *) 0 ; + switch_status_t result; + + arg1 = (switch_modulename_callback_func_t)jarg1; + arg2 = (void *)jarg2; + result = (switch_status_t)switch_loadable_module_enumerate_loaded(arg1,arg2); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_loadable_module_build_dynamic(char * jarg1, void * jarg2, void * jarg3, void * jarg4, int jarg5) { + int jresult ; + char *arg1 = (char *) 0 ; + switch_module_load_t arg2 = (switch_module_load_t) 0 ; + switch_module_runtime_t arg3 = (switch_module_runtime_t) 0 ; + switch_module_shutdown_t arg4 = (switch_module_shutdown_t) 0 ; + switch_bool_t arg5 ; + switch_status_t result; + + arg1 = (char *)jarg1; + arg2 = (switch_module_load_t)jarg2; + arg3 = (switch_module_runtime_t)jarg3; + arg4 = (switch_module_shutdown_t)jarg4; + arg5 = (switch_bool_t)jarg5; + result = (switch_status_t)switch_loadable_module_build_dynamic(arg1,arg2,arg3,arg4,arg5); + jresult = result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_timer_interface(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_timer_interface_t *result = 0 ; + + arg1 = (char *)jarg1; + result = (switch_timer_interface_t *)switch_loadable_module_get_timer_interface((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_application_interface(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_application_interface_t *result = 0 ; + + arg1 = (char *)jarg1; + result = (switch_application_interface_t *)switch_loadable_module_get_application_interface((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_api_interface(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_api_interface_t *result = 0 ; + + arg1 = (char *)jarg1; + result = (switch_api_interface_t *)switch_loadable_module_get_api_interface((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_file_interface(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_file_interface_t *result = 0 ; + + arg1 = (char *)jarg1; + result = (switch_file_interface_t *)switch_loadable_module_get_file_interface((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_speech_interface(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_speech_interface_t *result = 0 ; + + arg1 = (char *)jarg1; + result = (switch_speech_interface_t *)switch_loadable_module_get_speech_interface((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_asr_interface(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_asr_interface_t *result = 0 ; + + arg1 = (char *)jarg1; + result = (switch_asr_interface_t *)switch_loadable_module_get_asr_interface((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_directory_interface(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_directory_interface_t *result = 0 ; + + arg1 = (char *)jarg1; + result = (switch_directory_interface_t *)switch_loadable_module_get_directory_interface((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_chat_interface(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_chat_interface_t *result = 0 ; + + arg1 = (char *)jarg1; + result = (switch_chat_interface_t *)switch_loadable_module_get_chat_interface((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_say_interface(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_say_interface_t *result = 0 ; + + arg1 = (char *)jarg1; + result = (switch_say_interface_t *)switch_loadable_module_get_say_interface((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_management_interface(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_management_interface_t *result = 0 ; + + arg1 = (char *)jarg1; + result = (switch_management_interface_t *)switch_loadable_module_get_management_interface((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_get_limit_interface(char * jarg1) { + void * jresult ; + char *arg1 = (char *) 0 ; + switch_limit_interface_t *result = 0 ; + + arg1 = (char *)jarg1; + result = (switch_limit_interface_t *)switch_loadable_module_get_limit_interface((char const *)arg1); + jresult = (void *)result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_loadable_module_get_codecs(void * jarg1, int jarg2) { + int jresult ; + switch_codec_implementation_t **arg1 = (switch_codec_implementation_t **) 0 ; + int arg2 ; + int result; + + arg1 = (switch_codec_implementation_t **)jarg1; + arg2 = (int)jarg2; + result = (int)switch_loadable_module_get_codecs((switch_codec_implementation const **)arg1,arg2); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_loadable_module_get_codecs_sorted(void * jarg1, int jarg2, void * jarg3, int jarg4) { + int jresult ; + switch_codec_implementation_t **arg1 = (switch_codec_implementation_t **) 0 ; + int arg2 ; + char **arg3 = (char **) 0 ; + int arg4 ; + int result; + + arg1 = (switch_codec_implementation_t **)jarg1; + arg2 = (int)jarg2; + arg3 = (char **)jarg3; + arg4 = (int)jarg4; + result = (int)switch_loadable_module_get_codecs_sorted((switch_codec_implementation const **)arg1,arg2,arg3,arg4); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_api_execute(char * jarg1, char * jarg2, void * jarg3, void * jarg4) { + int jresult ; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + switch_core_session_t *arg3 = (switch_core_session_t *) 0 ; + switch_stream_handle_t *arg4 = (switch_stream_handle_t *) 0 ; + switch_status_t result; + + arg1 = (char *)jarg1; + arg2 = (char *)jarg2; + arg3 = (switch_core_session_t *)jarg3; + arg4 = (switch_stream_handle_t *)jarg4; + result = (switch_status_t)switch_api_execute((char const *)arg1,(char const *)arg2,arg3,arg4); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_loadable_module_load_module(char * jarg1, char * jarg2, int jarg3, void * jarg4) { + int jresult ; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + switch_bool_t arg3 ; + char **arg4 = (char **) 0 ; + switch_status_t result; + + arg1 = (char *)jarg1; + arg2 = (char *)jarg2; + arg3 = (switch_bool_t)jarg3; + arg4 = (char **)jarg4; + result = (switch_status_t)switch_loadable_module_load_module(arg1,arg2,arg3,(char const **)arg4); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_loadable_module_exists(char * jarg1) { + int jresult ; + char *arg1 = (char *) 0 ; + switch_status_t result; + + arg1 = (char *)jarg1; + result = (switch_status_t)switch_loadable_module_exists((char const *)arg1); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_loadable_module_unload_module(char * jarg1, char * jarg2, int jarg3, void * jarg4) { + int jresult ; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + switch_bool_t arg3 ; + char **arg4 = (char **) 0 ; + switch_status_t result; + + arg1 = (char *)jarg1; + arg2 = (char *)jarg2; + arg3 = (switch_bool_t)jarg3; + arg4 = (char **)jarg4; + result = (switch_status_t)switch_loadable_module_unload_module(arg1,arg2,arg3,(char const **)arg4); + jresult = result; + return jresult; +} + + +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_codec_next_id() { + unsigned long jresult ; + uint32_t result; + + result = (uint32_t)switch_core_codec_next_id(); + jresult = (unsigned long)result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_check_interval(unsigned long jarg1, unsigned long jarg2) { + int jresult ; + uint32_t arg1 ; + uint32_t arg2 ; + int result; + + arg1 = (uint32_t)jarg1; + arg2 = (uint32_t)jarg2; + result = (int)switch_check_interval(arg1,arg2); + jresult = result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_codec_add_implementation(void * jarg1, void * jarg2, int jarg3, unsigned char jarg4, char * jarg5, char * jarg6, unsigned long jarg7, unsigned long jarg8, int jarg9, int jarg10, unsigned long jarg11, unsigned long jarg12, unsigned long jarg13, unsigned char jarg14, int jarg15, void * jarg16, void * jarg17, void * jarg18, void * jarg19) { + switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ; + switch_codec_interface_t *arg2 = (switch_codec_interface_t *) 0 ; + switch_codec_type_t arg3 ; + switch_payload_t arg4 ; + char *arg5 = (char *) 0 ; + char *arg6 = (char *) 0 ; + uint32_t arg7 ; + uint32_t arg8 ; + int arg9 ; + int arg10 ; + uint32_t arg11 ; + uint32_t arg12 ; + uint32_t arg13 ; + uint8_t arg14 ; + int arg15 ; + switch_core_codec_init_func_t arg16 = (switch_core_codec_init_func_t) 0 ; + switch_core_codec_encode_func_t arg17 = (switch_core_codec_encode_func_t) 0 ; + switch_core_codec_decode_func_t arg18 = (switch_core_codec_decode_func_t) 0 ; + switch_core_codec_destroy_func_t arg19 = (switch_core_codec_destroy_func_t) 0 ; + + arg1 = (switch_memory_pool_t *)jarg1; + arg2 = (switch_codec_interface_t *)jarg2; + arg3 = (switch_codec_type_t)jarg3; + arg4 = (switch_payload_t)jarg4; + arg5 = (char *)jarg5; + arg6 = (char *)jarg6; + arg7 = (uint32_t)jarg7; + arg8 = (uint32_t)jarg8; + arg9 = (int)jarg9; + arg10 = (int)jarg10; + arg11 = (uint32_t)jarg11; + arg12 = (uint32_t)jarg12; + arg13 = (uint32_t)jarg13; + arg14 = (uint8_t)jarg14; + arg15 = (int)jarg15; + arg16 = (switch_core_codec_init_func_t)jarg16; + arg17 = (switch_core_codec_encode_func_t)jarg17; + arg18 = (switch_core_codec_decode_func_t)jarg18; + arg19 = (switch_core_codec_destroy_func_t)jarg19; + switch_core_codec_add_implementation(arg1,arg2,arg3,arg4,(char const *)arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12,arg13,arg14,arg15,arg16,arg17,arg18,arg19); +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_codec_ready(void * jarg1) { + int jresult ; + switch_codec_t *arg1 = (switch_codec_t *) 0 ; + switch_bool_t result; + + arg1 = (switch_codec_t *)jarg1; + result = (switch_bool_t)switch_core_codec_ready(arg1); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CMD_CHUNK_LEN_get() { int jresult ; int result; diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs index 2681875..a76e35c 100644 --- a/src/mod/languages/mod_managed/managed/swig.2010.cs +++ b/src/mod/languages/mod_managed/managed/swig.2010.cs @@ -2078,14 +2078,14 @@ public class freeswitch { return ret; } - public static SWIGTYPE_p_switch_loadable_module_interface switch_loadable_module_create_module_interface(SWIGTYPE_p_apr_pool_t pool, string name) { + public static switch_loadable_module_interface switch_loadable_module_create_module_interface(SWIGTYPE_p_apr_pool_t pool, string name) { IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_create_module_interface(SWIGTYPE_p_apr_pool_t.getCPtr(pool), name); - SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); return ret; } - public static SWIGTYPE_p_void switch_loadable_module_create_interface(SWIGTYPE_p_switch_loadable_module_interface mod, switch_module_interface_name_t iname) { - IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_create_interface(SWIGTYPE_p_switch_loadable_module_interface.getCPtr(mod), (int)iname); + public static SWIGTYPE_p_void switch_loadable_module_create_interface(switch_loadable_module_interface mod, switch_module_interface_name_t iname) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_create_interface(switch_loadable_module_interface.getCPtr(mod), (int)iname); SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false); return ret; } @@ -2309,6 +2309,163 @@ public class freeswitch { return ret; } + public static switch_status_t switch_loadable_module_init() { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_init(); + return ret; + } + + public static void switch_loadable_module_shutdown() { + freeswitchPINVOKE.switch_loadable_module_shutdown(); + } + + public static switch_endpoint_interface switch_loadable_module_get_endpoint_interface(string name) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_endpoint_interface(name); + switch_endpoint_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_endpoint_interface(cPtr, false); + return ret; + } + + public static switch_codec_interface switch_loadable_module_get_codec_interface(string name) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_codec_interface(name); + switch_codec_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_codec_interface(cPtr, false); + return ret; + } + + public static switch_dialplan_interface switch_loadable_module_get_dialplan_interface(string name) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_dialplan_interface(name); + switch_dialplan_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_dialplan_interface(cPtr, false); + return ret; + } + + public static switch_status_t switch_loadable_module_enumerate_available(string dir_path, SWIGTYPE_p_f_p_void_p_q_const__char__int callback, SWIGTYPE_p_void user_data) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_enumerate_available(dir_path, SWIGTYPE_p_f_p_void_p_q_const__char__int.getCPtr(callback), SWIGTYPE_p_void.getCPtr(user_data)); + return ret; + } + + public static switch_status_t switch_loadable_module_enumerate_loaded(SWIGTYPE_p_f_p_void_p_q_const__char__int callback, SWIGTYPE_p_void user_data) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_enumerate_loaded(SWIGTYPE_p_f_p_void_p_q_const__char__int.getCPtr(callback), SWIGTYPE_p_void.getCPtr(user_data)); + return ret; + } + + public static switch_status_t switch_loadable_module_build_dynamic(string filename, SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t switch_module_load, SWIGTYPE_p_f_void__switch_status_t switch_module_runtime, SWIGTYPE_p_f_void__switch_status_t switch_module_shutdown, switch_bool_t runtime) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_build_dynamic(filename, SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t.getCPtr(switch_module_load), SWIGTYPE_p_f_void__switch_status_t.getCPtr(switch_module_runtime), SWIGTYPE_p_f_void__switch_status_t.getCPtr(switch_module_shutdown), (int)runtime); + return ret; + } + + public static switch_timer_interface switch_loadable_module_get_timer_interface(string name) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_timer_interface(name); + switch_timer_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_timer_interface(cPtr, false); + return ret; + } + + public static switch_application_interface switch_loadable_module_get_application_interface(string name) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_application_interface(name); + switch_application_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_application_interface(cPtr, false); + return ret; + } + + public static switch_api_interface switch_loadable_module_get_api_interface(string name) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_api_interface(name); + switch_api_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_api_interface(cPtr, false); + return ret; + } + + public static switch_file_interface switch_loadable_module_get_file_interface(string name) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_file_interface(name); + switch_file_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_file_interface(cPtr, false); + return ret; + } + + public static switch_speech_interface switch_loadable_module_get_speech_interface(string name) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_speech_interface(name); + switch_speech_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_speech_interface(cPtr, false); + return ret; + } + + public static switch_asr_interface switch_loadable_module_get_asr_interface(string name) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_asr_interface(name); + switch_asr_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_asr_interface(cPtr, false); + return ret; + } + + public static switch_directory_interface switch_loadable_module_get_directory_interface(string name) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_directory_interface(name); + switch_directory_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_directory_interface(cPtr, false); + return ret; + } + + public static switch_chat_interface switch_loadable_module_get_chat_interface(string name) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_chat_interface(name); + switch_chat_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_chat_interface(cPtr, false); + return ret; + } + + public static switch_say_interface switch_loadable_module_get_say_interface(string name) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_say_interface(name); + switch_say_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_say_interface(cPtr, false); + return ret; + } + + public static switch_management_interface switch_loadable_module_get_management_interface(string relative_oid) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_management_interface(relative_oid); + switch_management_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_management_interface(cPtr, false); + return ret; + } + + public static switch_limit_interface switch_loadable_module_get_limit_interface(string name) { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_get_limit_interface(name); + switch_limit_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_limit_interface(cPtr, false); + return ret; + } + + public static int switch_loadable_module_get_codecs(SWIGTYPE_p_p_switch_codec_implementation array, int arraylen) { + int ret = freeswitchPINVOKE.switch_loadable_module_get_codecs(SWIGTYPE_p_p_switch_codec_implementation.getCPtr(array), arraylen); + return ret; + } + + public static int switch_loadable_module_get_codecs_sorted(SWIGTYPE_p_p_switch_codec_implementation array, int arraylen, ref string prefs, int preflen) { + int ret = freeswitchPINVOKE.switch_loadable_module_get_codecs_sorted(SWIGTYPE_p_p_switch_codec_implementation.getCPtr(array), arraylen, ref prefs, preflen); + return ret; + } + + public static switch_status_t switch_api_execute(string cmd, string arg, SWIGTYPE_p_switch_core_session session, switch_stream_handle stream) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_api_execute(cmd, arg, SWIGTYPE_p_switch_core_session.getCPtr(session), switch_stream_handle.getCPtr(stream)); + return ret; + } + + public static switch_status_t switch_loadable_module_load_module(string dir, string fname, switch_bool_t runtime, ref string err) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_load_module(dir, fname, (int)runtime, ref err); + return ret; + } + + public static switch_status_t switch_loadable_module_exists(string mod) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_exists(mod); + return ret; + } + + public static switch_status_t switch_loadable_module_unload_module(string dir, string fname, switch_bool_t force, ref string err) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_unload_module(dir, fname, (int)force, ref err); + return ret; + } + + public static uint switch_core_codec_next_id() { + uint ret = freeswitchPINVOKE.switch_core_codec_next_id(); + return ret; + } + + public static int switch_check_interval(uint rate, uint ptime) { + int ret = freeswitchPINVOKE.switch_check_interval(rate, ptime); + return ret; + } + + public static void switch_core_codec_add_implementation(SWIGTYPE_p_apr_pool_t pool, switch_codec_interface codec_interface, switch_codec_type_t codec_type, byte ianacode, string iananame, string fmtp, uint samples_per_second, uint actual_samples_per_second, int bits_per_second, int microseconds_per_packet, uint samples_per_packet, uint decoded_bytes_per_packet, uint encoded_bytes_per_packet, byte number_of_channels, int codec_frames_per_packet, SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t init, SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t encode, SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t decode, SWIGTYPE_p_f_p_switch_codec__switch_status_t destroy) { + freeswitchPINVOKE.switch_core_codec_add_implementation(SWIGTYPE_p_apr_pool_t.getCPtr(pool), switch_codec_interface.getCPtr(codec_interface), (int)codec_type, ianacode, iananame, fmtp, samples_per_second, actual_samples_per_second, bits_per_second, microseconds_per_packet, samples_per_packet, decoded_bytes_per_packet, encoded_bytes_per_packet, number_of_channels, codec_frames_per_packet, SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t.getCPtr(init), SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t.getCPtr(encode), SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t.getCPtr(decode), SWIGTYPE_p_f_p_switch_codec__switch_status_t.getCPtr(destroy)); + } + + public static switch_bool_t switch_core_codec_ready(switch_codec codec) { + switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_core_codec_ready(switch_codec.getCPtr(codec)); + return ret; + } + public static void switch_console_loop() { freeswitchPINVOKE.switch_console_loop(); } @@ -7710,6 +7867,207 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_in_thread")] public static extern int switch_core_session_in_thread(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_module_name_set")] + public static extern void switch_loadable_module_interface_module_name_set(HandleRef jarg1, string jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_module_name_get")] + public static extern string switch_loadable_module_interface_module_name_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_endpoint_interface_set")] + public static extern void switch_loadable_module_interface_endpoint_interface_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_endpoint_interface_get")] + public static extern IntPtr switch_loadable_module_interface_endpoint_interface_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_timer_interface_set")] + public static extern void switch_loadable_module_interface_timer_interface_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_timer_interface_get")] + public static extern IntPtr switch_loadable_module_interface_timer_interface_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_dialplan_interface_set")] + public static extern void switch_loadable_module_interface_dialplan_interface_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_dialplan_interface_get")] + public static extern IntPtr switch_loadable_module_interface_dialplan_interface_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_codec_interface_set")] + public static extern void switch_loadable_module_interface_codec_interface_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_codec_interface_get")] + public static extern IntPtr switch_loadable_module_interface_codec_interface_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_application_interface_set")] + public static extern void switch_loadable_module_interface_application_interface_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_application_interface_get")] + public static extern IntPtr switch_loadable_module_interface_application_interface_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_api_interface_set")] + public static extern void switch_loadable_module_interface_api_interface_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_api_interface_get")] + public static extern IntPtr switch_loadable_module_interface_api_interface_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_file_interface_set")] + public static extern void switch_loadable_module_interface_file_interface_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_file_interface_get")] + public static extern IntPtr switch_loadable_module_interface_file_interface_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_speech_interface_set")] + public static extern void switch_loadable_module_interface_speech_interface_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_speech_interface_get")] + public static extern IntPtr switch_loadable_module_interface_speech_interface_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_directory_interface_set")] + public static extern void switch_loadable_module_interface_directory_interface_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_directory_interface_get")] + public static extern IntPtr switch_loadable_module_interface_directory_interface_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_chat_interface_set")] + public static extern void switch_loadable_module_interface_chat_interface_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_chat_interface_get")] + public static extern IntPtr switch_loadable_module_interface_chat_interface_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_say_interface_set")] + public static extern void switch_loadable_module_interface_say_interface_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_say_interface_get")] + public static extern IntPtr switch_loadable_module_interface_say_interface_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_asr_interface_set")] + public static extern void switch_loadable_module_interface_asr_interface_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_asr_interface_get")] + public static extern IntPtr switch_loadable_module_interface_asr_interface_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_management_interface_set")] + public static extern void switch_loadable_module_interface_management_interface_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_management_interface_get")] + public static extern IntPtr switch_loadable_module_interface_management_interface_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_limit_interface_set")] + public static extern void switch_loadable_module_interface_limit_interface_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_limit_interface_get")] + public static extern IntPtr switch_loadable_module_interface_limit_interface_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_rwlock_set")] + public static extern void switch_loadable_module_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_rwlock_get")] + public static extern IntPtr switch_loadable_module_interface_rwlock_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_refs_set")] + public static extern void switch_loadable_module_interface_refs_set(HandleRef jarg1, int jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_refs_get")] + public static extern int switch_loadable_module_interface_refs_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_pool_set")] + public static extern void switch_loadable_module_interface_pool_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_pool_get")] + public static extern IntPtr switch_loadable_module_interface_pool_get(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_loadable_module_interface")] + public static extern IntPtr new_switch_loadable_module_interface(); + + [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_loadable_module_interface")] + public static extern void delete_switch_loadable_module_interface(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_init")] + public static extern int switch_loadable_module_init(); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_shutdown")] + public static extern void switch_loadable_module_shutdown(); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_endpoint_interface")] + public static extern IntPtr switch_loadable_module_get_endpoint_interface(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_codec_interface")] + public static extern IntPtr switch_loadable_module_get_codec_interface(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_dialplan_interface")] + public static extern IntPtr switch_loadable_module_get_dialplan_interface(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_enumerate_available")] + public static extern int switch_loadable_module_enumerate_available(string jarg1, HandleRef jarg2, HandleRef jarg3); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_enumerate_loaded")] + public static extern int switch_loadable_module_enumerate_loaded(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_build_dynamic")] + public static extern int switch_loadable_module_build_dynamic(string jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, int jarg5); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_timer_interface")] + public static extern IntPtr switch_loadable_module_get_timer_interface(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_application_interface")] + public static extern IntPtr switch_loadable_module_get_application_interface(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_api_interface")] + public static extern IntPtr switch_loadable_module_get_api_interface(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_file_interface")] + public static extern IntPtr switch_loadable_module_get_file_interface(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_speech_interface")] + public static extern IntPtr switch_loadable_module_get_speech_interface(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_asr_interface")] + public static extern IntPtr switch_loadable_module_get_asr_interface(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_directory_interface")] + public static extern IntPtr switch_loadable_module_get_directory_interface(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_chat_interface")] + public static extern IntPtr switch_loadable_module_get_chat_interface(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_say_interface")] + public static extern IntPtr switch_loadable_module_get_say_interface(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_management_interface")] + public static extern IntPtr switch_loadable_module_get_management_interface(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_limit_interface")] + public static extern IntPtr switch_loadable_module_get_limit_interface(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_codecs")] + public static extern int switch_loadable_module_get_codecs(HandleRef jarg1, int jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_get_codecs_sorted")] + public static extern int switch_loadable_module_get_codecs_sorted(HandleRef jarg1, int jarg2, ref string jarg3, int jarg4); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_api_execute")] + public static extern int switch_api_execute(string jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_load_module")] + public static extern int switch_loadable_module_load_module(string jarg1, string jarg2, int jarg3, ref string jarg4); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_exists")] + public static extern int switch_loadable_module_exists(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_unload_module")] + public static extern int switch_loadable_module_unload_module(string jarg1, string jarg2, int jarg3, ref string jarg4); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_next_id")] + public static extern uint switch_core_codec_next_id(); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_check_interval")] + public static extern int switch_check_interval(uint jarg1, uint jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_add_implementation")] + public static extern void switch_core_codec_add_implementation(HandleRef jarg1, HandleRef jarg2, int jarg3, byte jarg4, string jarg5, string jarg6, uint jarg7, uint jarg8, int jarg9, int jarg10, uint jarg11, uint jarg12, uint jarg13, byte jarg14, int jarg15, HandleRef jarg16, HandleRef jarg17, HandleRef jarg18, HandleRef jarg19); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_ready")] + public static extern int switch_core_codec_ready(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CMD_CHUNK_LEN_get")] public static extern int SWITCH_CMD_CHUNK_LEN_get(); @@ -15527,6 +15885,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_f_p_void_p_q_const__char__int { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_void_p_q_const__char__int(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_void_p_q_const__char__int() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_f_p_void_p_q_const__char__int obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.0 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_f_p_void__void { private HandleRef swigCPtr; @@ -16007,6 +16395,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_p_switch_codec_implementation { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_codec_implementation(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_codec_implementation() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_codec_implementation obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.0 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_p_switch_console_callback_match { private HandleRef swigCPtr; @@ -17207,36 +17625,6 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; -public class SWIGTYPE_p_switch_loadable_module_interface { - private HandleRef swigCPtr; - - internal SWIGTYPE_p_switch_loadable_module_interface(IntPtr cPtr, bool futureUse) { - swigCPtr = new HandleRef(this, cPtr); - } - - protected SWIGTYPE_p_switch_loadable_module_interface() { - swigCPtr = new HandleRef(null, IntPtr.Zero); - } - - internal static HandleRef getCPtr(SWIGTYPE_p_switch_loadable_module_interface obj) { - return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; - } -} - -} -/* ---------------------------------------------------------------------------- - * This file was automatically generated by SWIG (http://www.swig.org). - * Version 2.0.0 - * - * Do not make changes to this file unless you know what you are doing--modify - * the SWIG interface file instead. - * ----------------------------------------------------------------------------- */ - -namespace FreeSWITCH.Native { - -using System; -using System.Runtime.InteropServices; - public class SWIGTYPE_p_switch_media_bug { private HandleRef swigCPtr; @@ -18021,13 +18409,13 @@ public class switch_api_interface : IDisposable { } } - public SWIGTYPE_p_switch_loadable_module_interface parent { + public switch_loadable_module_interface parent { set { - freeswitchPINVOKE.switch_api_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value)); + freeswitchPINVOKE.switch_api_interface_parent_set(swigCPtr, switch_loadable_module_interface.getCPtr(value)); } get { IntPtr cPtr = freeswitchPINVOKE.switch_api_interface_parent_get(swigCPtr); - SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); return ret; } } @@ -18203,13 +18591,13 @@ public class switch_application_interface : IDisposable { } } - public SWIGTYPE_p_switch_loadable_module_interface parent { + public switch_loadable_module_interface parent { set { - freeswitchPINVOKE.switch_application_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value)); + freeswitchPINVOKE.switch_application_interface_parent_set(swigCPtr, switch_loadable_module_interface.getCPtr(value)); } get { IntPtr cPtr = freeswitchPINVOKE.switch_application_interface_parent_get(swigCPtr); - SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); return ret; } } @@ -18701,13 +19089,13 @@ public class switch_asr_interface : IDisposable { } } - public SWIGTYPE_p_switch_loadable_module_interface parent { + public switch_loadable_module_interface parent { set { - freeswitchPINVOKE.switch_asr_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value)); + freeswitchPINVOKE.switch_asr_interface_parent_set(swigCPtr, switch_loadable_module_interface.getCPtr(value)); } get { IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_parent_get(swigCPtr); - SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); return ret; } } @@ -20691,13 +21079,13 @@ public class switch_chat_interface : IDisposable { } } - public SWIGTYPE_p_switch_loadable_module_interface parent { + public switch_loadable_module_interface parent { set { - freeswitchPINVOKE.switch_chat_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value)); + freeswitchPINVOKE.switch_chat_interface_parent_set(swigCPtr, switch_loadable_module_interface.getCPtr(value)); } get { IntPtr cPtr = freeswitchPINVOKE.switch_chat_interface_parent_get(swigCPtr); - SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); return ret; } } @@ -21268,13 +21656,13 @@ public class switch_codec_interface : IDisposable { } } - public SWIGTYPE_p_switch_loadable_module_interface parent { + public switch_loadable_module_interface parent { set { - freeswitchPINVOKE.switch_codec_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value)); + freeswitchPINVOKE.switch_codec_interface_parent_set(swigCPtr, switch_loadable_module_interface.getCPtr(value)); } get { IntPtr cPtr = freeswitchPINVOKE.switch_codec_interface_parent_get(swigCPtr); - SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); return ret; } } @@ -22477,13 +22865,13 @@ public class switch_dialplan_interface : IDisposable { } } - public SWIGTYPE_p_switch_loadable_module_interface parent { + public switch_loadable_module_interface parent { set { - freeswitchPINVOKE.switch_dialplan_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value)); + freeswitchPINVOKE.switch_dialplan_interface_parent_set(swigCPtr, switch_loadable_module_interface.getCPtr(value)); } get { IntPtr cPtr = freeswitchPINVOKE.switch_dialplan_interface_parent_get(swigCPtr); - SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); return ret; } } @@ -22931,13 +23319,13 @@ public class switch_directory_interface : IDisposable { } } - public SWIGTYPE_p_switch_loadable_module_interface parent { + public switch_loadable_module_interface parent { set { - freeswitchPINVOKE.switch_directory_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value)); + freeswitchPINVOKE.switch_directory_interface_parent_set(swigCPtr, switch_loadable_module_interface.getCPtr(value)); } get { IntPtr cPtr = freeswitchPINVOKE.switch_directory_interface_parent_get(swigCPtr); - SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); return ret; } } @@ -23180,13 +23568,13 @@ public class switch_endpoint_interface : IDisposable { } } - public SWIGTYPE_p_switch_loadable_module_interface parent { + public switch_loadable_module_interface parent { set { - freeswitchPINVOKE.switch_endpoint_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value)); + freeswitchPINVOKE.switch_endpoint_interface_parent_set(swigCPtr, switch_loadable_module_interface.getCPtr(value)); } get { IntPtr cPtr = freeswitchPINVOKE.switch_endpoint_interface_parent_get(swigCPtr); - SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); return ret; } } @@ -24253,13 +24641,13 @@ public class switch_file_interface : IDisposable { } } - public SWIGTYPE_p_switch_loadable_module_interface parent { + public switch_loadable_module_interface parent { set { - freeswitchPINVOKE.switch_file_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value)); + freeswitchPINVOKE.switch_file_interface_parent_set(swigCPtr, switch_loadable_module_interface.getCPtr(value)); } get { IntPtr cPtr = freeswitchPINVOKE.switch_file_interface_parent_get(swigCPtr); - SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); return ret; } } @@ -26101,13 +26489,13 @@ public class switch_limit_interface : IDisposable { } } - public SWIGTYPE_p_switch_loadable_module_interface parent { + public switch_loadable_module_interface parent { set { - freeswitchPINVOKE.switch_limit_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value)); + freeswitchPINVOKE.switch_limit_interface_parent_set(swigCPtr, switch_loadable_module_interface.getCPtr(value)); } get { IntPtr cPtr = freeswitchPINVOKE.switch_limit_interface_parent_get(swigCPtr); - SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); return ret; } } @@ -26241,6 +26629,251 @@ public class switch_loadable_module_function_table_t : IDisposable { namespace FreeSWITCH.Native { +using System; +using System.Runtime.InteropServices; + +public class switch_loadable_module_interface : IDisposable { + private HandleRef swigCPtr; + protected bool swigCMemOwn; + + internal switch_loadable_module_interface(IntPtr cPtr, bool cMemoryOwn) { + swigCMemOwn = cMemoryOwn; + swigCPtr = new HandleRef(this, cPtr); + } + + internal static HandleRef getCPtr(switch_loadable_module_interface obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } + + ~switch_loadable_module_interface() { + Dispose(); + } + + public virtual void Dispose() { + lock(this) { + if (swigCPtr.Handle != IntPtr.Zero) { + if (swigCMemOwn) { + swigCMemOwn = false; + freeswitchPINVOKE.delete_switch_loadable_module_interface(swigCPtr); + } + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + GC.SuppressFinalize(this); + } + } + + public string module_name { + set { + freeswitchPINVOKE.switch_loadable_module_interface_module_name_set(swigCPtr, value); + } + get { + string ret = freeswitchPINVOKE.switch_loadable_module_interface_module_name_get(swigCPtr); + return ret; + } + } + + public switch_endpoint_interface endpoint_interface { + set { + freeswitchPINVOKE.switch_loadable_module_interface_endpoint_interface_set(swigCPtr, switch_endpoint_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_endpoint_interface_get(swigCPtr); + switch_endpoint_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_endpoint_interface(cPtr, false); + return ret; + } + } + + public switch_timer_interface timer_interface { + set { + freeswitchPINVOKE.switch_loadable_module_interface_timer_interface_set(swigCPtr, switch_timer_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_timer_interface_get(swigCPtr); + switch_timer_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_timer_interface(cPtr, false); + return ret; + } + } + + public switch_dialplan_interface dialplan_interface { + set { + freeswitchPINVOKE.switch_loadable_module_interface_dialplan_interface_set(swigCPtr, switch_dialplan_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_dialplan_interface_get(swigCPtr); + switch_dialplan_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_dialplan_interface(cPtr, false); + return ret; + } + } + + public switch_codec_interface codec_interface { + set { + freeswitchPINVOKE.switch_loadable_module_interface_codec_interface_set(swigCPtr, switch_codec_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_codec_interface_get(swigCPtr); + switch_codec_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_codec_interface(cPtr, false); + return ret; + } + } + + public switch_application_interface application_interface { + set { + freeswitchPINVOKE.switch_loadable_module_interface_application_interface_set(swigCPtr, switch_application_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_application_interface_get(swigCPtr); + switch_application_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_application_interface(cPtr, false); + return ret; + } + } + + public switch_api_interface api_interface { + set { + freeswitchPINVOKE.switch_loadable_module_interface_api_interface_set(swigCPtr, switch_api_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_api_interface_get(swigCPtr); + switch_api_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_api_interface(cPtr, false); + return ret; + } + } + + public switch_file_interface file_interface { + set { + freeswitchPINVOKE.switch_loadable_module_interface_file_interface_set(swigCPtr, switch_file_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_file_interface_get(swigCPtr); + switch_file_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_file_interface(cPtr, false); + return ret; + } + } + + public switch_speech_interface speech_interface { + set { + freeswitchPINVOKE.switch_loadable_module_interface_speech_interface_set(swigCPtr, switch_speech_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_speech_interface_get(swigCPtr); + switch_speech_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_speech_interface(cPtr, false); + return ret; + } + } + + public switch_directory_interface directory_interface { + set { + freeswitchPINVOKE.switch_loadable_module_interface_directory_interface_set(swigCPtr, switch_directory_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_directory_interface_get(swigCPtr); + switch_directory_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_directory_interface(cPtr, false); + return ret; + } + } + + public switch_chat_interface chat_interface { + set { + freeswitchPINVOKE.switch_loadable_module_interface_chat_interface_set(swigCPtr, switch_chat_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_chat_interface_get(swigCPtr); + switch_chat_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_chat_interface(cPtr, false); + return ret; + } + } + + public switch_say_interface say_interface { + set { + freeswitchPINVOKE.switch_loadable_module_interface_say_interface_set(swigCPtr, switch_say_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_say_interface_get(swigCPtr); + switch_say_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_say_interface(cPtr, false); + return ret; + } + } + + public switch_asr_interface asr_interface { + set { + freeswitchPINVOKE.switch_loadable_module_interface_asr_interface_set(swigCPtr, switch_asr_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_asr_interface_get(swigCPtr); + switch_asr_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_asr_interface(cPtr, false); + return ret; + } + } + + public switch_management_interface management_interface { + set { + freeswitchPINVOKE.switch_loadable_module_interface_management_interface_set(swigCPtr, switch_management_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_management_interface_get(swigCPtr); + switch_management_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_management_interface(cPtr, false); + return ret; + } + } + + public switch_limit_interface limit_interface { + set { + freeswitchPINVOKE.switch_loadable_module_interface_limit_interface_set(swigCPtr, switch_limit_interface.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_limit_interface_get(swigCPtr); + switch_limit_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_limit_interface(cPtr, false); + return ret; + } + } + + public SWIGTYPE_p_switch_thread_rwlock_t rwlock { + set { + freeswitchPINVOKE.switch_loadable_module_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_rwlock_get(swigCPtr); + SWIGTYPE_p_switch_thread_rwlock_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_thread_rwlock_t(cPtr, false); + return ret; + } + } + + public int refs { + set { + freeswitchPINVOKE.switch_loadable_module_interface_refs_set(swigCPtr, value); + } + get { + int ret = freeswitchPINVOKE.switch_loadable_module_interface_refs_get(swigCPtr); + return ret; + } + } + + public SWIGTYPE_p_apr_pool_t pool { + set { + freeswitchPINVOKE.switch_loadable_module_interface_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_pool_get(swigCPtr); + SWIGTYPE_p_apr_pool_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false); + return ret; + } + } + + public switch_loadable_module_interface() : this(freeswitchPINVOKE.new_switch_loadable_module_interface(), true) { + } + +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.0 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + public enum switch_log_level_t { SWITCH_LOG_DEBUG10 = 110, SWITCH_LOG_DEBUG9 = 109, @@ -26518,13 +27151,13 @@ public class switch_management_interface : IDisposable { } } - public SWIGTYPE_p_switch_loadable_module_interface parent { + public switch_loadable_module_interface parent { set { - freeswitchPINVOKE.switch_management_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value)); + freeswitchPINVOKE.switch_management_interface_parent_set(swigCPtr, switch_loadable_module_interface.getCPtr(value)); } get { IntPtr cPtr = freeswitchPINVOKE.switch_management_interface_parent_get(swigCPtr); - SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); return ret; } } @@ -27586,13 +28219,13 @@ public class switch_say_interface : IDisposable { } } - public SWIGTYPE_p_switch_loadable_module_interface parent { + public switch_loadable_module_interface parent { set { - freeswitchPINVOKE.switch_say_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value)); + freeswitchPINVOKE.switch_say_interface_parent_set(swigCPtr, switch_loadable_module_interface.getCPtr(value)); } get { IntPtr cPtr = freeswitchPINVOKE.switch_say_interface_parent_get(swigCPtr); - SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); return ret; } } @@ -28273,13 +28906,13 @@ public class switch_speech_interface : IDisposable { } } - public SWIGTYPE_p_switch_loadable_module_interface parent { + public switch_loadable_module_interface parent { set { - freeswitchPINVOKE.switch_speech_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value)); + freeswitchPINVOKE.switch_speech_interface_parent_set(swigCPtr, switch_loadable_module_interface.getCPtr(value)); } get { IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_parent_get(swigCPtr); - SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); return ret; } } @@ -29286,13 +29919,13 @@ public class switch_timer_interface : IDisposable { } } - public SWIGTYPE_p_switch_loadable_module_interface parent { + public switch_loadable_module_interface parent { set { - freeswitchPINVOKE.switch_timer_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value)); + freeswitchPINVOKE.switch_timer_interface_parent_set(swigCPtr, switch_loadable_module_interface.getCPtr(value)); } get { IntPtr cPtr = freeswitchPINVOKE.switch_timer_interface_parent_get(swigCPtr); - SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false); + switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false); return ret; } } commit a2e5f07c4d6d8fa947bda216c7f1940acb7fa12b Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Sun Sep 12 20:06:20 2010 -0400 mod_callcenter: Fix initial ODBC Support (SEGV) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index e08757b..874c615 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1259,7 +1259,7 @@ static switch_status_t load_config(void) if (!strcasecmp(var, "debug")) { globals.debug = atoi(val); } else if (!strcasecmp(var, "odbc-dsn")) { - globals.odbc_dsn = strdup(switch_xml_attr(param, "odbc-dsn")); + globals.odbc_dsn = strdup(val); if (!zstr(globals.odbc_dsn)) { if ((globals.odbc_user = strchr(globals.odbc_dsn, ':'))) { commit d47d32e035bc9036c32d3497c96cfe2e4f098584 Author: Marc Olivier Chouinard <mochouinard@mochouinard-laptop.(none)> Date: Sun Sep 12 20:01:43 2010 -0400 mod_callcenter: Fix Initial ODBC support diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index e08757b..874c615 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1259,7 +1259,7 @@ static switch_status_t load_config(void) if (!strcasecmp(var, "debug")) { globals.debug = atoi(val); } else if (!strcasecmp(var, "odbc-dsn")) { - globals.odbc_dsn = strdup(switch_xml_attr(param, "odbc-dsn")); + globals.odbc_dsn = strdup(val); if (!zstr(globals.odbc_dsn)) { if ((globals.odbc_user = strchr(globals.odbc_dsn, ':'))) { commit bddec41f438352063e33c70f13899b978584d627 Author: Jeff Lenk <jeff@jefflenk.com> Date: Sun Sep 12 15:38:58 2010 -0500 FSCORE-670 diff --git a/src/switch_ivr.c b/src/switch_ivr.c index c1dc336..543e472 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -2175,6 +2175,7 @@ SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint3 if ((jb_frame = stfu_n_read_a_frame(jb))) { write_frame.data = jb_frame->data; write_frame.datalen = (uint32_t) jb_frame->dlen; + write_frame.buflen = (uint32_t) jb_frame->dlen; status = switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0); if (!SWITCH_READ_ACCEPTABLE(status)) { break; commit a1eb601b197fc0fb3eb724768c22f920ee7b471c Author: Konrad Hammel <konrad@sangoma.com> Date: Fri Sep 10 19:17:06 2010 -0400 freetdm: ss7 - update to logging diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c index 17e32c7..03f0beb 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c @@ -423,13 +423,53 @@ void handle_sng_mtp3_alarm(Pst *pst, SnMngmt *sta) break; /**************************************************************************/ case (STROUT): - ftdm_log(FTDM_LOG_ERROR,"[MTP3][DPC:0x%d%d%d%d] %s : %s\n", - sta->t.usta.evntParm[0], - sta->t.usta.evntParm[1], - sta->t.usta.evntParm[2], - sta->t.usta.evntParm[3], - DECODE_LSN_EVENT(sta->t.usta.alarm.event), - DECODE_LSN_CAUSE(sta->t.usta.alarm.cause)); + switch (sta->t.usta.alarm.event) { + /**********************************************************************/ + case (LSN_EVENT_RX_TRANSFER_MSG): + switch (sta->t.usta.evntParm[5]) { + /******************************************************************/ + case (0x23): + ftdm_log(FTDM_LOG_INFO,"[MTP3] Rx SNM TFC\n"); + break; + /******************************************************************/ + case (0x34): + ftdm_log(FTDM_LOG_INFO,"[MTP3] Rx SNM TFR\n"); + break; + /******************************************************************/ + case (0x54): + ftdm_log(FTDM_LOG_INFO,"[MTP3] Rx SNM TFA\n"); + break; + /******************************************************************/ + case (0x14): + ftdm_log(FTDM_LOG_INFO,"[MTP3] Rx SNM TFP\n"); + break; + /******************************************************************/ + case (0x24): + ftdm_log(FTDM_LOG_INFO,"[MTP3] Rx SNM TFP (cluster)\n"); + break; + /******************************************************************/ + case (0x64): + ftdm_log(FTDM_LOG_INFO,"[MTP3] Rx SNM TFA (cluster)\n"); + break; + /******************************************************************/ + case (0x44): + ftdm_log(FTDM_LOG_INFO,"[MTP3] Rx SNM TFR (cluster)\n"); + break; + /******************************************************************/ + } /* switch (sta->t.usta.evntParm[5]) */ + break; + /**********************************************************************/ + default: + ftdm_log(FTDM_LOG_ERROR,"[MTP3][DPC:0x%d%d%d%d] %s : %s\n", + sta->t.usta.evntParm[0], + sta->t.usta.evntParm[1], + sta->t.usta.evntParm[2], + sta->t.usta.evntParm[3], + DECODE_LSN_EVENT(sta->t.usta.alarm.event), + DECODE_LSN_CAUSE(sta->t.usta.alarm.cause)); + break; + /**********************************************************************/ + } /* switch (sta->t.usta.alarm.event) */ break; /**************************************************************************/ default: commit 7cb6b4b3e141772d1c3196560d7c268cabd2a24c Author: Moises Silva <moy@sangoma.com> Date: Fri Sep 10 18:12:12 2010 -0400 freetdm: fix assertion diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 47d6936..49b61ee 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -3577,7 +3577,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_get_current_var(ftdm_iterator_t *iter, co *var_name = NULL; *var_val = NULL; - ftdm_assert_return(iter && (iter->type == FTDM_ITERATOR_CHANS) && iter->pvt.hashiter, FTDM_FAIL, "Cannot get variable from invalid iterator!\n"); + ftdm_assert_return(iter && (iter->type == FTDM_ITERATOR_VARS) && iter->pvt.hashiter, FTDM_FAIL, "Cannot get variable from invalid iterator!\n"); hashtable_this(iter->pvt.hashiter, &key, NULL, &val); commit c9e780b9b68c298687748c23818002511381ee3c Author: Moises Silva <moy@sangoma.com> Date: Fri Sep 10 17:52:08 2010 -0400 freetdm: remove iterator free log diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index c774e61..47d6936 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -3603,7 +3603,9 @@ FT_DECLARE(ftdm_iterator_t *) ftdm_iterator_next(ftdm_iterator_t *iter) return iter; case FTDM_ITERATOR_CHANS: ftdm_assert_return(iter->pvt.chaniter.index, NULL, "channel iterator index cannot be zero!\n"); - ftdm_assert_return(iter->pvt.chaniter.index <= iter->pvt.chaniter.span->chan_count, NULL, "channel iterator index bigger than span chan count!\n"); + if (iter->pvt.chaniter.index == iter->pvt.chaniter.span->chan_count) { + return NULL; + } iter->pvt.chaniter.index++; return iter; default: @@ -3651,7 +3653,6 @@ FT_DECLARE(ftdm_status_t) ftdm_iterator_free(ftdm_iterator_t *iter) } ftdm_assert_return(iter->type, FTDM_FAIL, "Cannot free invalid iterator\n"); - ftdm_log(FTDM_LOG_DEBUG, "Freeing iterator %p\n", iter); ftdm_safe_free(iter); return FTDM_SUCCESS; commit 9fbe363a86217b1b8a99553dbf8933414ebf26ac Author: Konrad Hammel <konrad@sangoma.com> Date: Fri Sep 10 15:34:13 2010 -0400 freetdm: ss7 - switching back to sending RSC rather then GRS at start diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index b5fe619..70a1a05 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -1249,7 +1249,7 @@ static ftdm_status_t ftdm_sangoma_ss7_start(ftdm_span_t * span) /* throw the pause flag */ sngss7_set_flag(sngss7_info, FLAG_INFID_PAUSED); - +#if 0 /* throw the grp reset flag */ sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX); if (x == 1) { @@ -1257,7 +1257,10 @@ static ftdm_status_t ftdm_sangoma_ss7_start(ftdm_span_t * span) sngss7_span->tx_grs.circuit = sngss7_info->circuit->id; sngss7_span->tx_grs.range = span->chan_count -1; } - +#else + /* throw the channel into reset */ + sngss7_set_flag(sngss7_info, FLAG_RESET_TX); +#endif /* throw the channel to suspend */ ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); commit 8370f0c23319dc41410507754ac8571b1cac42c4 Author: Moises Silva <moy@sangoma.com> Date: Fri Sep 10 14:46:51 2010 -0400 freetdm: more iterator fixes diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 9d6188f..c70e0f9 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -3597,6 +3597,8 @@ SWITCH_STANDARD_API(ft_function) { char *mycmd = NULL, *argv[10] = { 0 }; int argc = 0; + ftdm_iterator_t *chaniter = NULL; + ftdm_iterator_t *curr = NULL; if (!zstr(cmd) && (mycmd = strdup(cmd))) { argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); @@ -3642,11 +3644,11 @@ SWITCH_STANDARD_API(ft_function) dump_chan_xml(span, chan_id, stream); } } else { - uint32_t j; - uint32_t ccount = ftdm_span_get_chan_count(span); - for (j = 1; j <= ccount; j++) { - dump_chan_xml(span, j, stream); + chaniter = ftdm_span_get_chan_iterator(span, NULL); + for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { + dump_chan_xml(span, ftdm_channel_get_id(ftdm_iterator_current(curr)), stream); } + ftdm_iterator_free(chaniter); } } @@ -3662,12 +3664,12 @@ SWITCH_STANDARD_API(ft_function) dump_chan(span, chan_id, stream); } } else { - uint32_t j; - uint32_t ccount = ftdm_span_get_chan_count(span); stream->write_function(stream, "+OK\n"); - for (j = 1; j <= ccount; j++) { - dump_chan(span, j, stream); + chaniter = ftdm_span_get_chan_iterator(span, NULL); + for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { + dump_chan(span, ftdm_channel_get_id(ftdm_iterator_current(curr)), stream); } + ftdm_iterator_free(chaniter); } } diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index b83f1b7..c774e61 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -3602,9 +3602,8 @@ FT_DECLARE(ftdm_iterator_t *) ftdm_iterator_next(ftdm_iterator_t *iter) } return iter; case FTDM_ITERATOR_CHANS: - if (iter->pvt.chaniter.index == iter->pvt.chaniter.span->chan_count) { - return NULL; - } + ftdm_assert_return(iter->pvt.chaniter.index, NULL, "channel iterator index cannot be zero!\n"); + ftdm_assert_return(iter->pvt.chaniter.index <= iter->pvt.chaniter.span->chan_count, NULL, "channel iterator index bigger than span chan count!\n"); iter->pvt.chaniter.index++; return iter; default: @@ -3629,7 +3628,7 @@ FT_DECLARE(void *) ftdm_iterator_current(ftdm_iterator_t *iter) return (void *)key; case FTDM_ITERATOR_CHANS: ftdm_assert_return(iter->pvt.chaniter.index, NULL, "channel iterator index cannot be zero!\n"); - ftdm_assert_return(iter->pvt.chaniter.index > iter->pvt.chaniter.span->chan_count, NULL, "channel iterator index bigger than span chan count!\n"); + ftdm_assert_return(iter->pvt.chaniter.index <= iter->pvt.chaniter.span->chan_count, NULL, "channel iterator index bigger than span chan count!\n"); return iter->pvt.chaniter.span->channels[iter->pvt.chaniter.index]; default: break; @@ -3652,6 +3651,7 @@ FT_DECLARE(ftdm_status_t) ftdm_iterator_free(ftdm_iterator_t *iter) } ftdm_assert_return(iter->type, FTDM_FAIL, "Cannot free invalid iterator\n"); + ftdm_log(FTDM_LOG_DEBUG, "Freeing iterator %p\n", iter); ftdm_safe_free(iter); return FTDM_SUCCESS; commit 507b73070b65e0d28c4ce4714bb6d64d4cbff7f4 Author: Moises Silva <moy@sangoma.com> Date: Fri Sep 10 14:09:06 2010 -0400 freetdm: fix iterator usage diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 6b4fec6..9d6188f 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1516,7 +1516,7 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session switch_channel_set_variable_printf(channel, "freetdm_custom_call_data", "%s", channel_caller_data->raw_data); } /* Add any channel variable to the dial plan */ - iter = ftdm_channel_get_var_iterator(sigmsg->channel); + iter = ftdm_channel_get_var_iterator(sigmsg->channel, NULL); for (curr = iter ; curr; curr = ftdm_iterator_next(curr)) { ftdm_channel_get_current_var(curr, &var_name, &var_value); snprintf(name, sizeof(name), FREETDM_VAR_PREFIX "%s", var_name); @@ -2783,9 +2783,9 @@ static switch_status_t load_config(void) switch_set_string(SPAN_CONFIG[span_id].dialplan, dialplan); SPAN_CONFIG[span_id].analog_options = analog_options | globals.analog_options; - chaniter = ftdm_span_get_chan_iterator(span); - curr = chaniter - for (curr = chaniter ; curr; curr = ftdm_iterator_next(curr)) { + chaniter = ftdm_span_get_chan_iterator(span, NULL); + curr = chaniter; + for (curr = chaniter; curr; curr = ftdm_iterator_next(curr)) { fchan = ftdm_iterator_current(curr); ftdm_channel_set_private(fchan, &SPAN_CONFIG[span_id].pvts[i]); } commit bc2638334bca11e79b24ad1e44df9af09acbd0f7 Author: Moises Silva <moy@sangoma.com> Date: Fri Sep 10 14:01:52 2010 -0400 freetdm: iterators refactoring add channel iterator diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index b911155..6b4fec6 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1404,6 +1404,7 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session private_t *tech_pvt = NULL; switch_channel_t *channel = NULL; ftdm_iterator_t *iter = NULL; + ftdm_iterator_t *curr = NULL; const char *var_name = NULL; const char *var_value = NULL; uint32_t spanid, chanid; @@ -1516,12 +1517,13 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session } /* Add any channel variable to the dial plan */ iter = ftdm_channel_get_var_iterator(sigmsg->channel); - for ( ; iter; iter = ftdm_iterator_next(iter)) { - ftdm_channel_get_current_var(iter, &var_name, &var_value); + for (curr = iter ; curr; curr = ftdm_iterator_next(curr)) { + ftdm_channel_get_current_var(curr, &var_name, &var_value); snprintf(name, sizeof(name), FREETDM_VAR_PREFIX "%s", var_name); switch_channel_set_variable_printf(channel, name, "%s", var_value); } - + ftdm_iterator_free(iter); + switch_channel_set_state(channel, CS_INIT); if (switch_core_session_thread_launch(session) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error spawning thread\n"); @@ -2496,7 +2498,8 @@ static switch_status_t load_config(void) unsigned boosti = 0; unsigned int i = 0; ftdm_channel_t *fchan = NULL; - unsigned int chancount = 0; + ftdm_iterator_t *chaniter = NULL; + ftdm_iterator_t *curr = NULL; memset(boost_spans, 0, sizeof(boost_spans)); memset(&globals, 0, sizeof(globals)); @@ -2780,11 +2783,13 @@ static switch_status_t load_config(void) switch_set_string(SPAN_CONFIG[span_id].dialplan, dialplan); SPAN_CONFIG[span_id].analog_options = analog_options | globals.analog_options; - chancount = ftdm_span_get_chan_count(span); - for (i = 1; i <= chancount; i++) { - fchan = ftdm_span_get_channel(span, i); + chaniter = ftdm_span_get_chan_iterator(span); + curr = chaniter + for (curr = chaniter ; curr; curr = ftdm_iterator_next(curr)) { + fchan = ftdm_iterator_current(curr); ftdm_channel_set_private(fchan, &SPAN_CONFIG[span_id].pvts[i]); } + ftdm_iterator_free(chaniter); if (dial_regex) { switch_set_string(SPAN_CONFIG[span_id].dial_regex, dial_regex); diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index b275403..b83f1b7 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -3524,16 +3524,48 @@ done: return var; } -FT_DECLARE(ftdm_iterator_t *) ftdm_channel_get_var_iterator(const ftdm_channel_t *ftdmchan) +static ftdm_iterator_t *get_iterator(ftdm_iterator_type_t type, ftdm_iterator_t *iter) { - ftdm_hash_iterator_t *iter = NULL; - - ftdm_channel_lock(ftdmchan); + int allocated = 0; + if (iter) { + if (iter->type != type) { + ftdm_log(FTDM_LOG_ERROR, "Cannot switch iterator types\n"); + return NULL; + } + allocated = iter->allocated; + memset(iter, 0, sizeof(*iter)); + iter->type = type; + iter->allocated = allocated; + return iter; + } - iter = ftdmchan->variable_hash == NULL ? NULL : hashtable_first(ftdmchan->variable_hash); + iter = ftdm_calloc(1, sizeof(*iter)); + if (!iter) { + return NULL; + } + iter->type = type; + iter->allocated = 1; + return iter; +} +FT_DECLARE(ftdm_iterator_t *) ftdm_channel_get_var_iterator(const ftdm_channel_t *ftdmchan, ftdm_iterator_t *iter) +{ + if (!(iter = get_iterator(FTDM_ITERATOR_VARS, iter))) { + return NULL; + } + ftdm_channel_lock(ftdmchan); + iter->pvt.hashiter = ftdmchan->variable_hash == NULL ? NULL : hashtable_first(ftdmchan->variable_hash); ftdm_channel_unlock(ftdmchan); + return iter; +} +FT_DECLARE(ftdm_iterator_t *) ftdm_span_get_chan_iterator(const ftdm_span_t *span, ftdm_iterator_t *iter) +{ + if (!(iter = get_iterator(FTDM_ITERATOR_CHANS, iter))) { + return NULL; + } + iter->pvt.chaniter.index = 1; + iter->pvt.chaniter.span = span; return iter; } @@ -3545,11 +3577,9 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_get_current_var(ftdm_iterator_t *iter, co *var_name = NULL; *var_val = NULL; - if (!iter) { - return FTDM_FAIL; - } + ftdm_assert_return(iter && (iter->type == FTDM_ITERATOR_CHANS) && iter->pvt.hashiter, FTDM_FAIL, "Cannot get variable from invalid iterator!\n"); - hashtable_this(iter, &key, NULL, &val); + hashtable_this(iter->pvt.hashiter, &key, NULL, &val); *var_name = key; *var_val = val; @@ -3559,10 +3589,72 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_get_current_var(ftdm_iterator_t *iter, co FT_DECLARE(ftdm_iterator_t *) ftdm_iterator_next(ftdm_iterator_t *iter) { + ftdm_assert_return(iter && iter->type, NULL, "Invalid iterator\n"); + + switch (iter->type) { + case FTDM_ITERATOR_VARS: + if (!iter->pvt.hashiter) { + return NULL; + } + iter->pvt.hashiter = hashtable_next(iter->pvt.hashiter); + if (!iter->pvt.hashiter) { + return NULL; + } + return iter; + case FTDM_ITERATOR_CHANS: + if (iter->pvt.chaniter.index == iter->pvt.chaniter.span->chan_count) { + return NULL; + } + iter->pvt.chaniter.index++; + return iter; + default: + break; + } + + ftdm_assert_return(0, NULL, "Unknown iterator type\n"); + return NULL; +} + +FT_DECLARE(void *) ftdm_iterator_current(ftdm_iterator_t *iter) +{ + const void *key = NULL; + void *val = NULL; + + ftdm_assert_return(iter && iter->type, NULL, "Invalid iterator\n"); + + switch (iter->type) { + case FTDM_ITERATOR_VARS: + hashtable_this(iter->pvt.hashiter, &key, NULL, &val); + /* I decided to return the key instead of the value since the value can be retrieved using the key */ + return (void *)key; + case FTDM_ITERATOR_CHANS: + ftdm_assert_return(iter->pvt.chaniter.index, NULL, "channel iterator index cannot be zero!\n"); + ftdm_assert_return(iter->pvt.chaniter.index > iter->pvt.chaniter.span->chan_count, NULL, "channel iterator index bigger than span chan count!\n"); + return iter->pvt.chaniter.span->channels[iter->pvt.chaniter.index]; + default: + break; + } + + ftdm_assert_return(0, NULL, "Unknown iterator type\n"); + return NULL; +} + +FT_DECLARE(ftdm_status_t) ftdm_iterator_free(ftdm_iterator_t *iter) +{ + /* it's valid to pass a NULL iterator, do not return failure */ if (!iter) { - return NULL; + return FTDM_SUCCESS; } - return hashtable_next(iter); + + if (!iter->allocated) { + memset(iter, 0, sizeof(*iter)); + return FTDM_SUCCESS; + } + + ftdm_assert_return(iter->type, FTDM_FAIL, "Cannot free invalid iterator\n"); + ftdm_safe_free(iter); + + return FTDM_SUCCESS; } static struct { diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 0437e02..1f50a2c 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -386,7 +386,7 @@ typedef struct ftdm_conf_parameter { } ftdm_conf_parameter_t; /*! \brief Opaque general purpose iterator */ -typedef void ftdm_iterator_t; +typedef struct ftdm_iterator ftdm_iterator_t; /*! \brief Channel commands that can be executed through ftdm_channel_command() */ typedef enum { @@ -1032,8 +1032,19 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_add_var(ftdm_channel_t *ftdmchan, const c FT_DECLARE(const char *) ftdm_channel_get_var(ftdm_channel_t *ftdmchan, const char *var_name); /*! \brief Get an iterator to iterate over the channel variables - * \note The iterator pointer returned is only valid while the channel is open and it'll be destroyed when the channel is closed. */ -FT_DECLARE(ftdm_iterator_t *) ftdm_channel_get_var_iterator(const ftdm_channel_t *ftdmchan); + * \param ftdmchan The channel structure containing the variables + * \param iter Optional iterator. You can reuse an old iterator (not previously freed) to avoid the extra allocation of a new iterator. + * \note The iterator pointer returned is only valid while the channel is open and it'll be destroyed when the channel is closed. + * This iterator is completely non-thread safe, if you are adding variables or removing variables while iterating + * results are unpredictable + */ +FT_DECLARE(ftdm_iterator_t *) ftdm_channel_get_var_iterator(const ftdm_channel_t *ftdmchan, ftdm_iterator_t *iter); + +/*! \brief Get iterator current value (depends on the iterator type) + * \note Channel iterators return a pointer to ftdm_channel_t + * Variable iterators return a pointer to the variable name (not the variable value) + */ +FT_DECLARE(void *) ftdm_iterator_current(ftdm_iterator_t *iter); /*! \brief Get variable name and value for the current iterator position */ FT_DECLARE(ftdm_status_t) ftdm_channel_get_current_var(ftdm_iterator_t *iter, const char **var_name, const char **var_val); @@ -1041,6 +1052,11 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_get_current_var(ftdm_iterator_t *iter, co /*! \brief Advance iterator */ FT_DECLARE(ftdm_iterator_t *) ftdm_iterator_next(ftdm_iterator_t *iter); +/*! \brief Free iterator + * \note You must free an iterator after using it unless you plan to reuse it + */ +FT_DECLARE(ftdm_status_t) ftdm_iterator_free(ftdm_iterator_t *iter); + /*! \brief Get the span pointer associated to the channel */ FT_DECLARE(ftdm_span_t *) ftdm_channel_get_span(const ftdm_channel_t *ftdmchan); @@ -1144,6 +1160,12 @@ FT_DECLARE(uint32_t) ftdm_span_get_id(const ftdm_span_t *span); /*! \brief Get the span name */ FT_DECLARE(const char *) ftdm_span_get_name(const ftdm_span_t *span); +/*! \brief Get iterator for the span channels + * \param span The span containing the channels + * \param iter Optional iterator. You can reuse an old iterator (not previously freed) to avoid the extra allocation of a new iterator. + */ +FT_DECLARE(ftdm_iterator_t *) ftdm_span_get_chan_iterator(const ftdm_span_t *span, ftdm_iterator_t *iter); + /*! * \brief Execute a text command. The text command output will be returned and must be free'd * diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index 74bea81..d8947f6 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -619,6 +619,9 @@ FT_DECLARE(ftdm_status_t) ftdm_span_trigger_signals(const ftdm_span_t *span); #define ftdm_log_chan(fchan, level, format, ...) ftdm_log(level, "[s%dc%d][%d:%d] " format, fchan->span_id, fchan->chan_id, fchan->physical_span_id, fchan->physical_chan_id, __VA_ARGS__) #define ftdm_log_chan_msg(fchan, level, msg) ftdm_log(level, "[s%dc%d][%d:%d] " msg, fchan->span_id, fchan->chan_id, fchan->physical_span_id, fchan->physical_chan_id) +#define ftdm_span_lock(span) ftdm_mutex_lock(span->mutex) +#define ftdm_span_unlock(span) ftdm_mutex_unlock(span->mutex) + FT_DECLARE_DATA extern const char *FTDM_LEVEL_NAMES[9]; static __inline__ void ftdm_abort(void) diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index d8e8b5c..ba69563 100644 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -366,6 +366,23 @@ typedef ftdm_status_t (*ftdm_span_start_t)(ftdm_span_t *span); typedef ftdm_status_t (*ftdm_span_stop_t)(ftdm_span_t *span); typedef ftdm_status_t (*ftdm_channel_sig_read_t)(ftdm_channel_t *ftdmchan, void *data, ftdm_size_t size); +typedef enum { + FTDM_ITERATOR_VARS = 1, + FTDM_ITERATOR_CHANS, +} ftdm_iterator_type_t; + +struct ftdm_iterator { + ftdm_iterator_type_t type; + unsigned int allocated:1; + union { + struct { + int32_t index; + const ftdm_span_t *span; + } chaniter; + ftdm_hash_iterator_t *hashiter; + } pvt; +}; + #ifdef __cplusplus } #endif commit f30a1cc6882e9e9d1c83c69f0866ec728e406e3b Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Sep 10 12:55:50 2010 -0500 fix vm_inject to a group and change syntax for sending to a whole domain to domain= for clarity sake diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index e89bda4..732059a 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -2687,23 +2687,29 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t if ((domain = strchr(user, '@'))) { *domain++ = '\0'; - } else { - domain = user; - } - if ((profile_name = strchr(domain, '@'))) { - *profile_name++ = '\0'; - } else { - profile_name = domain; + if ((profile_name = strchr(domain, '@'))) { + *profile_name++ = '\0'; + } else { + profile_name = domain; + } } if (switch_stristr("group=", user)) { user += 6; isgroup++; - } else if (user == domain) { + } else if (switch_stristr("domain=", user)) { + user += 7; + domain = user; + profile_name = domain; isall++; } + if (zstr(domain)) { + domain = switch_core_get_variable("domain"); + profile_name = domain; + } + if (!(user && domain)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid syntax [%s][%s]\n", switch_str_nil(user), switch_str_nil(domain)); status = SWITCH_STATUS_FALSE; @@ -2747,6 +2753,7 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot locate domain %s\n", domain); status = SWITCH_STATUS_FALSE; switch_event_destroy(&my_params); + profile_rwunlock(profile); goto end; } @@ -3962,7 +3969,7 @@ static void do_web(vm_profile_t *profile, const char *user_in, const char *domai } } -#define VM_INJECT_USAGE "[group=]<box> <sound_file> [<cid_num>] [<cid_name>]" +#define VM_INJECT_USAGE "[group=<group>[@domain]|domain=<domain>|<box>[@<domain>]] <sound_file> [<cid_num>] [<cid_name>]" SWITCH_STANDARD_API(voicemail_inject_api_function) { if (voicemail_inject(cmd, session) == SWITCH_STATUS_SUCCESS) { commit fb48d5ca9d2a1266a1ddd1714285d4c0b61db77e Author: Brian West <brian@freeswitch.org> Date: Fri Sep 10 12:35:40 2010 -0500 swigall diff --git a/src/mod/languages/mod_lua/mod_lua_wrap.cpp b/src/mod/languages/mod_lua/mod_lua_wrap.cpp index 962ebe3..4bf4b67 100644 --- a/src/mod/languages/mod_lua/mod_lua_wrap.cpp +++ b/src/mod/languages/mod_lua/mod_lua_wrap.cpp @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.29 + * Version 1.3.35 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make @@ -10,7 +10,7 @@ #ifdef __cplusplus -template<class T> class SwigValueWrapper { +template<typename T> class SwigValueWrapper { T *tt; public: SwigValueWrapper() : tt(0) { } @@ -23,6 +23,10 @@ public: private: SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs); }; + +template <typename T> T SwigValueInit() { + return T(); +} #endif /* ----------------------------------------------------------------------------- @@ -32,14 +36,14 @@ private: /* template workaround for compilers that cannot correctly implement the C++ standard */ #ifndef SWIGTEMPLATEDISAMBIGUATOR -# if defined(__SUNPRO_CC) -# if (__SUNPRO_CC <= 0x560) -# define SWIGTEMPLATEDISAMBIGUATOR template -# else -# define SWIGTEMPLATEDISAMBIGUATOR -# endif +# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# elif defined(__HP_aCC) +/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ +/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ +# define SWIGTEMPLATEDISAMBIGUATOR template # else -# define SWIGTEMPLATEDISAMBIGUATOR +# define SWIGTEMPLATEDISAMBIGUATOR # endif #endif @@ -118,10 +122,16 @@ private: #endif /* Deal with Microsoft's attempt at deprecating C standard runtime functions */ -#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) # define _CRT_SECURE_NO_DEPRECATE #endif +/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ +#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) +# define _SCL_SECURE_NO_DEPRECATE +#endif + + /* ----------------------------------------------------------------------------- * swigrun.swg * @@ -131,7 +141,7 @@ private: /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "2" +#define SWIG_RUNTIME_VERSION "4" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE @@ -166,6 +176,7 @@ private: /* Flags for pointer conversions */ #define SWIG_POINTER_DISOWN 0x1 +#define SWIG_CAST_NEW_MEMORY 0x2 /* Flags for new pointer objects */ #define SWIG_POINTER_OWN 0x1 @@ -306,10 +317,10 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) { extern "C" { #endif -typedef void *(*swig_converter_func)(void *); +typedef void *(*swig_converter_func)(void *, int *); typedef struct swig_type_info *(*swig_dycast_func)(void **); -/* Structure to store inforomation on one type */ +/* Structure to store information on one type */ typedef struct swig_type_info { const char *name; /* mangled name of this type */ const char *str; /* human readable name of this type */ @@ -354,7 +365,7 @@ SWIG_TypeNameComp(const char *f1, const char *l1, while ((*f2 == ' ') && (f2 != l2)) ++f2; if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; } - return (l1 - f1) - (l2 - f2); + return (int)((l1 - f1) - (l2 - f2)); } /* @@ -436,8 +447,8 @@ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) { Cast a pointer up an inheritance hierarchy */ SWIGRUNTIMEINLINE void * -SWIG_TypeCast(swig_cast_info *ty, void *ptr) { - return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr); +SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { + return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); } /* @@ -708,7 +719,8 @@ extern "C" { #include "lua.h" #include "lauxlib.h" -#include <assert.h> /* for a few sanity tests */ +#include <stdlib.h> /* for malloc */ +#include <assert.h> /* for a few sanity tests */ /* ----------------------------------------------------------------------------- * global swig types @@ -719,12 +731,7 @@ extern "C" { #define SWIG_LUA_STRING 3 #define SWIG_LUA_POINTER 4 #define SWIG_LUA_BINARY 5 - -/* Structure for command table (replaced by luaLib's luaL_reg) */ -/*typedef struct { - const char *name; - lua_CFunction wrapper; -} swig_lua_command_info;*/ +#define SWIG_LUA_CHAR 6 /* Structure for variable linking table */ typedef struct { @@ -755,29 +762,42 @@ typedef struct { } swig_lua_attribute; typedef struct swig_lua_class { - const char *name; + const char *name; swig_type_info **type; - lua_CFunction constructor; - void (*destructor)(void *); - swig_lua_method *methods; + lua_CFunction constructor; + void (*destructor)(void *); + swig_lua_method *methods; swig_lua_attribute *attributes; struct swig_lua_class **bases; + const char **base_names; } swig_lua_class; +/* this is the struct for wrappering all pointers in SwigLua +*/ typedef struct { - void *ptr; swig_type_info *type; - int own; /* 1 if owned & must be destroyed */ + int own; /* 1 if owned & must be destroyed */ + void *ptr; } swig_lua_userdata; +/* this is the struct for wrapping arbitary packed binary data +(currently it is only used for member function pointers) +the data ordering is similar to swig_lua_userdata, but it is currently not possible +to tell the two structures apart within Swig, other than by looking at the type +*/ +typedef struct { + swig_type_info *type; + int own; /* 1 if owned & must be destroyed */ + char data[1]; /* arbitary amount of data */ +} swig_lua_rawdata; /* Common SWIG API */ -#define SWIG_NewPointerObj(L, ptr, type, owner) \ - SWIG_Lua_NewPointerObj(L, (void *)ptr, type, owner) -#define SWIG_ConvertPtr(L,idx, ptr, type, flags) \ - SWIG_Lua_ConvertPtr(L,idx,ptr,type,flags) -#define SWIG_MustGetPtr(L,idx, type,flags, argnum,fnname) \ - SWIG_Lua_MustGetPtr(L,idx, type,flags, argnum,fnname) +#define SWIG_NewPointerObj(L, ptr, type, owner) SWIG_Lua_NewPointerObj(L, (void *)ptr, type, owner) +#define SWIG_ConvertPtr(L,idx, ptr, type, flags) SWIG_Lua_ConvertPtr(L,idx,ptr,type,flags) +#define SWIG_MustGetPtr(L,idx, type,flags, argnum,fnname) SWIG_Lua_MustGetPtr(L,idx, type,flags, argnum,fnname) +/* for C++ member pointers, ie, member methods */ +#define SWIG_ConvertMember(L, idx, ptr, sz, ty) SWIG_Lua_ConvertPacked(L, idx, ptr, sz, ty) +#define SWIG_NewMemberObj(L, ptr, sz, type) SWIG_Lua_NewPackedObj(L, ptr, sz, type) /* Runtime API */ #define SWIG_GetModule(clientdata) SWIG_Lua_GetModule((lua_State*)(clientdata)) @@ -788,141 +808,193 @@ typedef struct { #define SWIG_contract_assert(expr, msg) \ if (!(expr)) { lua_pushstring(L, (char *) msg); goto fail; } else - - /* helper #defines */ #define SWIG_fail {goto fail;} -#define SWIG_fail_arg(I) {lua_pushfstring(L,"argument %d incorrect/missing",I);goto fail;} +#define SWIG_fail_arg(func_name,argnum,type) \ + {lua_pushfstring(L,"Error in %s (arg %d), expected '%s' got '%s'",\ + func_name,argnum,type,SWIG_Lua_typename(L,argnum));\ + goto fail;} +#define SWIG_fail_ptr(func_name,argnum,type) \ + SWIG_fail_arg(func_name,argnum,(type && type->str)?type->str:"void*") +#define SWIG_check_num_args(func_name,a,b) \ + if (lua_gettop(L)<a || lua_gettop(L)>b) \ + {lua_pushfstring(L,"Error in %s expected %d..%d args, got %d",func_name,a,b,lua_gettop(L));\ + goto fail;} + #define SWIG_Lua_get_table(L,n) \ - (lua_pushstring(L, n), lua_rawget(L,-2)) + (lua_pushstring(L, n), lua_rawget(L,-2)) #define SWIG_Lua_add_function(L,n,f) \ - (lua_pushstring(L, n), \ - lua_pushcfunction(L, f), \ - lua_rawset(L,-3)) + (lua_pushstring(L, n), \ + lua_pushcfunction(L, f), \ + lua_rawset(L,-3)) + +/* special helper for allowing 'nil' for usertypes */ +#define SWIG_isptrtype(L,I) (lua_isuserdata(L,I) || lua_isnil(L,I)) + +#ifdef __cplusplus +/* Special helper for member function pointers +it gets the address, casts it, then dereferences it */ +//#define SWIG_mem_fn_as_voidptr(a) (*((char**)&(a))) +#endif + +/* storing/access of swig_module_info */ +SWIGRUNTIME swig_module_info * +SWIG_Lua_GetModule(lua_State* L) { + swig_module_info *ret = 0; + lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME); + lua_rawget(L,LUA_REGISTRYINDEX); + if (lua_islightuserdata(L,-1)) + ret=(swig_module_info*)lua_touserdata(L,-1); + lua_pop(L,1); /* tidy */ + return ret; +} + +SWIGRUNTIME void +SWIG_Lua_SetModule(lua_State* L, swig_module_info *module) { + /* add this all into the Lua registry: */ + lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME); + lua_pushlightuserdata(L,(void*)module); + lua_rawset(L,LUA_REGISTRYINDEX); +} /* ----------------------------------------------------------------------------- * global variable support code: modules * ----------------------------------------------------------------------------- */ +/* this function is called when trying to set an immutable. +default value is to print an error. +This can removed with a compile flag SWIGLUA_IGNORE_SET_IMMUTABLE */ +SWIGINTERN int SWIG_Lua_set_immutable(lua_State* L) +{ +/* there should be 1 param passed in: the new value */ +#ifndef SWIGLUA_IGNORE_SET_IMMUTABLE + lua_pop(L,1); /* remove it */ + lua_pushstring(L,"This variable is immutable"); + lua_error(L); +#endif + return 0; /* should not return anything */ +} + /* the module.get method used for getting linked data */ SWIGINTERN int SWIG_Lua_module_get(lua_State* L) { -/* there should be 2 params passed in - (1) table (not the meta table) - (2) string name of the attribute - printf("SWIG_Lua_module_get %p(%s) '%s'\n", - lua_topointer(L,1),lua_typename(L,lua_type(L,1)), - lua_tostring(L,2)); +/* there should be 2 params passed in + (1) table (not the meta table) + (2) string name of the attribute + printf("SWIG_Lua_module_get %p(%s) '%s'\n", + lua_topointer(L,1),lua_typename(L,lua_type(L,1)), + lua_tostring(L,2)); */ - /* get the metatable */ - assert(lua_istable(L,1)); /* just in case */ - lua_getmetatable(L,1); /* get the metatable */ - assert(lua_istable(L,-1)); /* just in case */ - SWIG_Lua_get_table(L,".get"); /* get the .get table */ - lua_remove(L,3); /* remove metatable */ - if (lua_istable(L,-1)) - { - /* look for the key in the .get table */ - lua_pushvalue(L,2); /* key */ - lua_rawget(L,-2); - lua_remove(L,3); /* remove .get */ - if (lua_iscfunction(L,-1)) - { /* found it so call the fn & return its value */ - lua_call(L,0,1); - return 1; - } - lua_pop(L,1); /* remove the top */ - } - lua_pop(L,1); /* remove the .get */ - lua_pushnil(L); /* return a nil */ + /* get the metatable */ + assert(lua_istable(L,1)); /* just in case */ + lua_getmetatable(L,1); /* get the metatable */ + assert(lua_istable(L,-1)); /* just in case */ + SWIG_Lua_get_table(L,".get"); /* get the .get table */ + lua_remove(L,3); /* remove metatable */ + if (lua_istable(L,-1)) + { + /* look for the key in the .get table */ + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); + lua_remove(L,3); /* remove .get */ + if (lua_iscfunction(L,-1)) + { /* found it so call the fn & return its value */ + lua_call(L,0,1); + return 1; + } + lua_pop(L,1); /* remove the top */ + } + lua_pop(L,1); /* remove the .get */ + lua_pushnil(L); /* return a nil */ return 1; } /* the module.set method used for setting linked data */ SWIGINTERN int SWIG_Lua_module_set(lua_State* L) { -/* there should be 3 params passed in - (1) table (not the meta table) - (2) string name of the attribute - (3) any for the new value +/* there should be 3 params passed in + (1) table (not the meta table) + (2) string name of the attribute + (3) any for the new value */ - /* get the metatable */ - assert(lua_istable(L,1)); /* just in case */ - lua_getmetatable(L,1); /* get the metatable */ - assert(lua_istable(L,-1)); /* just in case */ - SWIG_Lua_get_table(L,".set"); /* get the .set table */ - lua_remove(L,4); /* remove metatable */ - if (lua_istable(L,-1)) - { - /* look for the key in the .set table */ - lua_pushvalue(L,2); /* key */ - lua_rawget(L,-2); - lua_remove(L,4); /* remove .set */ - if (lua_iscfunction(L,-1)) - { /* found it so call the fn & return its value */ - lua_pushvalue(L,3); /* value */ - lua_call(L,1,0); - return 0; - } - lua_pop(L,1); /* remove the top */ - } - lua_pop(L,1); /* remove the .set */ - return 0; + /* get the metatable */ + assert(lua_istable(L,1)); /* just in case */ + lua_getmetatable(L,1); /* get the metatable */ + assert(lua_istable(L,-1)); /* just in case */ + SWIG_Lua_get_table(L,".set"); /* get the .set table */ + lua_remove(L,4); /* remove metatable */ + if (lua_istable(L,-1)) + { + /* look for the key in the .set table */ + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); + lua_remove(L,4); /* remove .set */ + if (lua_iscfunction(L,-1)) + { /* found it so call the fn & return its value */ + lua_pushvalue(L,3); /* value */ + lua_call(L,1,0); + return 0; + } + } + lua_settop(L,3); /* reset back to start */ + /* we now have the table, key & new value, so just set directly */ + lua_rawset(L,1); /* add direct */ + return 0; } /* registering a module in lua */ SWIGINTERN void SWIG_Lua_module_begin(lua_State* L,const char* name) { - assert(lua_istable(L,-1)); /* just in case */ - lua_pushstring(L,name); - lua_newtable(L); /* the table */ - /* add meta table */ - lua_newtable(L); /* the meta table */ - SWIG_Lua_add_function(L,"__index",SWIG_Lua_module_get); - SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_module_set); - lua_pushstring(L,".get"); - lua_newtable(L); /* the .get table */ - lua_rawset(L,-3); /* add .get into metatable */ - lua_pushstring(L,".set"); - lua_newtable(L); /* the .set table */ - lua_rawset(L,-3); /* add .set into metatable */ - lua_setmetatable(L,-2); /* sets meta table in module */ - lua_rawset(L,-3); /* add module into parent */ - SWIG_Lua_get_table(L,name); /* get the table back out */ + assert(lua_istable(L,-1)); /* just in case */ + lua_pushstring(L,name); + lua_newtable(L); /* the table */ + /* add meta table */ + lua_newtable(L); /* the meta table */ + SWIG_Lua_add_function(L,"__index",SWIG_Lua_module_get); + SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_module_set); + lua_pushstring(L,".get"); + lua_newtable(L); /* the .get table */ + lua_rawset(L,-3); /* add .get into metatable */ + lua_pushstring(L,".set"); + lua_newtable(L); /* the .set table */ + lua_rawset(L,-3); /* add .set into metatable */ + lua_setmetatable(L,-2); /* sets meta table in module */ + lua_rawset(L,-3); /* add module into parent */ + SWIG_Lua_get_table(L,name); /* get the table back out */ } /* ending the register */ SWIGINTERN void SWIG_Lua_module_end(lua_State* L) { - lua_pop(L,1); /* tidy stack (remove module) */ + lua_pop(L,1); /* tidy stack (remove module) */ } /* adding a linked variable to the module */ SWIGINTERN void SWIG_Lua_module_add_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn) { - assert(lua_istable(L,-1)); /* just in case */ - lua_getmetatable(L,-1); /* get the metatable */ - assert(lua_istable(L,-1)); /* just in case */ - SWIG_Lua_get_table(L,".get"); /* find the .get table */ - assert(lua_istable(L,-1)); /* should be a table: */ - SWIG_Lua_add_function(L,name,getFn); - lua_pop(L,1); /* tidy stack (remove table) */ - if (setFn) /* if there is a set fn */ - { - SWIG_Lua_get_table(L,".set"); /* find the .set table */ - assert(lua_istable(L,-1)); /* should be a table: */ - SWIG_Lua_add_function(L,name,setFn); - lua_pop(L,1); /* tidy stack (remove table) */ - } - lua_pop(L,1); /* tidy stack (remove meta) */ + assert(lua_istable(L,-1)); /* just in case */ + lua_getmetatable(L,-1); /* get the metatable */ + assert(lua_istable(L,-1)); /* just in case */ + SWIG_Lua_get_table(L,".get"); /* find the .get table */ + assert(lua_istable(L,-1)); /* should be a table: */ + SWIG_Lua_add_function(L,name,getFn); + lua_pop(L,1); /* tidy stack (remove table) */ + if (setFn) /* if there is a set fn */ + { + SWIG_Lua_get_table(L,".set"); /* find the .set table */ + assert(lua_istable(L,-1)); /* should be a table: */ + SWIG_Lua_add_function(L,name,setFn); + lua_pop(L,1); /* tidy stack (remove table) */ + } + lua_pop(L,1); /* tidy stack (remove meta) */ } /* adding a function module */ SWIGINTERN void SWIG_Lua_module_add_function(lua_State* L,const char* name,lua_CFunction fn) { - SWIG_Lua_add_function(L,name,fn); + SWIG_Lua_add_function(L,name,fn); } /* ----------------------------------------------------------------------------- @@ -932,307 +1004,383 @@ SWIGINTERN void SWIG_Lua_module_add_function(lua_State* L,const char* name,lua_ /* the class.get method, performs the lookup of class attributes */ SWIGINTERN int SWIG_Lua_class_get(lua_State* L) { -/* there should be 2 params passed in - (1) userdata (not the meta table) - (2) string name of the attribute +/* there should be 2 params passed in + (1) userdata (not the meta table) + (2) string name of the attribute */ - assert(lua_isuserdata(L,-2)); /* just in case */ - lua_getmetatable(L,-2); /* get the meta table */ - assert(lua_istable(L,-1)); /* just in case */ - SWIG_Lua_get_table(L,".get"); /* find the .get table */ - assert(lua_istable(L,-1)); /* just in case */ - /* look for the key in the .get table */ - lua_pushvalue(L,2); /* key */ - lua_rawget(L,-2); - lua_remove(L,-2); /* stack tidy, remove .get table */ - if (lua_iscfunction(L,-1)) - { /* found it so call the fn & return its value */ - lua_pushvalue(L,1); /* the userdata */ - lua_call(L,1,1); /* 1 value in (userdata),1 out (result) */ - lua_remove(L,-2); /* stack tidy, remove metatable */ - return 1; - } - lua_pop(L,1); /* remove whatever was there */ - /* ok, so try the .fn table */ - SWIG_Lua_get_table(L,".fn"); /* find the .get table */ - assert(lua_istable(L,-1)); /* just in case */ - lua_pushvalue(L,2); /* key */ - lua_rawget(L,-2); /* look for the fn */ - lua_remove(L,-2); /* stack tidy, remove .fn table */ - if (lua_iscfunction(L,-1)) - { /* found it so return the fn & let lua call it */ - lua_remove(L,-2); /* stack tidy, remove metatable */ - return 1; - } - lua_pop(L,1); /* remove whatever was there */ - /* NEW: looks for the __getitem() fn - this is a user provided get fn */ - SWIG_Lua_get_table(L,"__getitem"); /* find the __getitem fn */ - if (lua_iscfunction(L,-1)) /* if its there */ - { /* found it so call the fn & return its value */ - lua_pushvalue(L,1); /* the userdata */ - lua_pushvalue(L,2); /* the parameter */ - lua_call(L,2,1); /* 2 value in (userdata),1 out (result) */ - lua_remove(L,-2); /* stack tidy, remove metatable */ - return 1; - } - return 0; /* sorry not known */ + assert(lua_isuserdata(L,-2)); /* just in case */ + lua_getmetatable(L,-2); /* get the meta table */ + assert(lua_istable(L,-1)); /* just in case */ + SWIG_Lua_get_table(L,".get"); /* find the .get table */ + assert(lua_istable(L,-1)); /* just in case */ + /* look for the key in the .get table */ + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); + lua_remove(L,-2); /* stack tidy, remove .get table */ + if (lua_iscfunction(L,-1)) + { /* found it so call the fn & return its value */ + lua_pushvalue(L,1); /* the userdata */ + lua_call(L,1,1); /* 1 value in (userdata),1 out (result) */ + lua_remove(L,-2); /* stack tidy, remove metatable */ + return 1; + } + lua_pop(L,1); /* remove whatever was there */ + /* ok, so try the .fn table */ + SWIG_Lua_get_table(L,".fn"); /* find the .get table */ + assert(lua_istable(L,-1)); /* just in case */ + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); /* look for the fn */ + lua_remove(L,-2); /* stack tidy, remove .fn table */ + if (lua_isfunction(L,-1)) /* note: if its a C function or lua function */ + { /* found it so return the fn & let lua call it */ + lua_remove(L,-2); /* stack tidy, remove metatable */ + return 1; + } + lua_pop(L,1); /* remove whatever was there */ + /* NEW: looks for the __getitem() fn + this is a user provided get fn */ + SWIG_Lua_get_table(L,"__getitem"); /* find the __getitem fn */ + if (lua_iscfunction(L,-1)) /* if its there */ + { /* found it so call the fn & return its value */ + lua_pushvalue(L,1); /* the userdata */ + lua_pushvalue(L,2); /* the parameter */ + lua_call(L,2,1); /* 2 value in (userdata),1 out (result) */ + lua_remove(L,-2); /* stack tidy, remove metatable */ + return 1; + } + return 0; /* sorry not known */ } /* the class.set method, performs the lookup of class attributes */ SWIGINTERN int SWIG_Lua_class_set(lua_State* L) { -/* there should be 3 params passed in - (1) table (not the meta table) - (2) string name of the attribute - (3) any for the new value +/* there should be 3 params passed in + (1) table (not the meta table) + (2) string name of the attribute + (3) any for the new value printf("SWIG_Lua_class_set %p(%s) '%s' %p(%s)\n", - lua_topointer(L,1),lua_typename(L,lua_type(L,1)), - lua_tostring(L,2), - lua_topointer(L,3),lua_typename(L,lua_type(L,3)));*/ - - assert(lua_isuserdata(L,1)); /* just in case */ - lua_getmetatable(L,1); /* get the meta table */ - assert(lua_istable(L,-1)); /* just in case */ - - SWIG_Lua_get_table(L,".set"); /* find the .set table */ - if (lua_istable(L,-1)) - { - /* look for the key in the .set table */ - lua_pushvalue(L,2); /* key */ - lua_rawget(L,-2); - if (lua_iscfunction(L,-1)) - { /* found it so call the fn & return its value */ - lua_pushvalue(L,1); /* userdata */ - lua_pushvalue(L,3); /* value */ - lua_call(L,2,0); - return 0; - } - lua_pop(L,1); /* remove the value */ - } - lua_pop(L,1); /* remove the value .set table */ - /* NEW: looks for the __setitem() fn - this is a user provided set fn */ - SWIG_Lua_get_table(L,"__setitem"); /* find the fn */ - if (lua_iscfunction(L,-1)) /* if its there */ - { /* found it so call the fn & return its value */ - lua_pushvalue(L,1); /* the userdata */ - lua_pushvalue(L,2); /* the parameter */ - lua_pushvalue(L,3); /* the value */ - lua_call(L,3,0); /* 3 values in ,0 out */ - lua_remove(L,-2); /* stack tidy, remove metatable */ - return 1; - } - return 0; + lua_topointer(L,1),lua_typename(L,lua_type(L,1)), + lua_tostring(L,2), + lua_topointer(L,3),lua_typename(L,lua_type(L,3)));*/ + + assert(lua_isuserdata(L,1)); /* just in case */ + lua_getmetatable(L,1); /* get the meta table */ + assert(lua_istable(L,-1)); /* just in case */ + + SWIG_Lua_get_table(L,".set"); /* find the .set table */ + if (lua_istable(L,-1)) + { + /* look for the key in the .set table */ + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); + if (lua_iscfunction(L,-1)) + { /* found it so call the fn & return its value */ + lua_pushvalue(L,1); /* userdata */ + lua_pushvalue(L,3); /* value */ + lua_call(L,2,0); + return 0; + } + lua_pop(L,1); /* remove the value */ + } + lua_pop(L,1); /* remove the value .set table */ + /* NEW: looks for the __setitem() fn + this is a user provided set fn */ + SWIG_Lua_get_table(L,"__setitem"); /* find the fn */ + if (lua_iscfunction(L,-1)) /* if its there */ + { /* found it so call the fn & return its value */ + lua_pushvalue(L,1); /* the userdata */ + lua_pushvalue(L,2); /* the parameter */ + lua_pushvalue(L,3); /* the value */ + lua_call(L,3,0); /* 3 values in ,0 out */ + lua_remove(L,-2); /* stack tidy, remove metatable */ + return 1; + } + return 0; } /* the class.destruct method called by the interpreter */ SWIGINTERN int SWIG_Lua_class_destruct(lua_State* L) { -/* there should be 1 params passed in - (1) userdata (not the meta table) */ - swig_lua_userdata* usr; - swig_lua_class* clss; - assert(lua_isuserdata(L,-1)); /* just in case */ - usr=(swig_lua_userdata*)lua_touserdata(L,-1); /* get it */ - /* if must be destroyed & has a destructor */ - if (usr->own) /* if must be destroyed */ - { - clss=(swig_lua_class*)usr->type->clientdata; /* get the class */ - if (clss && clss->destructor) /* there is a destroy fn */ - { - clss->destructor(usr->ptr); /* bye bye */ - } - } - return 0; +/* there should be 1 params passed in + (1) userdata (not the meta table) */ + swig_lua_userdata* usr; + swig_lua_class* clss; + assert(lua_isuserdata(L,-1)); /* just in case */ + usr=(swig_lua_userdata*)lua_touserdata(L,-1); /* get it */ + /* if must be destroyed & has a destructor */ + if (usr->own) /* if must be destroyed */ + { + clss=(swig_lua_class*)usr->type->clientdata; /* get the class */ + if (clss && clss->destructor) /* there is a destroy fn */ + { + clss->destructor(usr->ptr); /* bye bye */ + } + } + return 0; } /* gets the swig class registry (or creates it) */ SWIGINTERN void SWIG_Lua_get_class_registry(lua_State* L) { - /* add this all into the swig registry: */ - lua_pushstring(L,"SWIG"); - lua_rawget(L,LUA_REGISTRYINDEX); /* get the registry */ - if (!lua_istable(L,-1)) /* not there */ - { /* must be first time, so add it */ - lua_pop(L,1); /* remove the result */ - lua_pushstring(L,"SWIG"); - lua_newtable(L); - lua_rawset(L,LUA_REGISTRYINDEX); - /* then get it */ - lua_pushstring(L,"SWIG"); - lua_rawget(L,LUA_REGISTRYINDEX); - } + /* add this all into the swig registry: */ + lua_pushstring(L,"SWIG"); + lua_rawget(L,LUA_REGISTRYINDEX); /* get the registry */ + if (!lua_istable(L,-1)) /* not there */ + { /* must be first time, so add it */ + lua_pop(L,1); /* remove the result */ + lua_pushstring(L,"SWIG"); + lua_newtable(L); + lua_rawset(L,LUA_REGISTRYINDEX); + /* then get it */ + lua_pushstring(L,"SWIG"); + lua_rawget(L,LUA_REGISTRYINDEX); + } } /* helper fn to get the classes metatable from the register */ SWIGINTERN void SWIG_Lua_get_class_metatable(lua_State* L,const char* cname) { - SWIG_Lua_get_class_registry(L); /* get the registry */ - lua_pushstring(L,cname); /* get the name */ - lua_rawget(L,-2); /* get it */ - lua_remove(L,-2); /* tidy up (remove registry) */ + SWIG_Lua_get_class_registry(L); /* get the registry */ + lua_pushstring(L,cname); /* get the name */ + lua_rawget(L,-2); /* get it */ + lua_remove(L,-2); /* tidy up (remove registry) */ } /* helper add a variable to a registered class */ SWIGINTERN void SWIG_Lua_add_class_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn) { - assert(lua_istable(L,-1)); /* just in case */ - SWIG_Lua_get_table(L,".get"); /* find the .get table */ - assert(lua_istable(L,-1)); /* just in case */ - SWIG_Lua_add_function(L,name,getFn); - lua_pop(L,1); /* tidy stack (remove table) */ - if (setFn) - { - SWIG_Lua_get_table(L,".set"); /* find the .set table */ - assert(lua_istable(L,-1)); /* just in case */ - SWIG_Lua_add_function(L,name,setFn); - lua_pop(L,1); /* tidy stack (remove table) */ - } + assert(lua_istable(L,-1)); /* just in case */ + SWIG_Lua_get_table(L,".get"); /* find the .get table */ + assert(lua_istable(L,-1)); /* just in case */ + SWIG_Lua_add_function(L,name,getFn); + lua_pop(L,1); /* tidy stack (remove table) */ + if (setFn) + { + SWIG_Lua_get_table(L,".set"); /* find the .set table */ + assert(lua_istable(L,-1)); /* just in case */ + SWIG_Lua_add_function(L,name,setFn); + lua_pop(L,1); /* tidy stack (remove table) */ + } } /* helper to recursively add class details (attributes & operations) */ SWIGINTERN void SWIG_Lua_add_class_details(lua_State* L,swig_lua_class* clss) { - int i; - /* call all the base classes first: we can then override these later: */ - for(i=0;clss->bases[i];i++) - { - SWIG_Lua_add_class_details(L,clss->bases[i]); - } - /* add fns */ - for(i=0;clss->attributes[i].name;i++){ - SWIG_Lua_add_class_variable(L,clss->attributes[i].name,clss->attributes[i].getmethod,clss->attributes[i].setmethod); - } - /* add methods to the metatable */ - SWIG_Lua_get_table(L,".fn"); /* find the .fn table */ - assert(lua_istable(L,-1)); /* just in case */ - for(i=0;clss->methods[i].name;i++){ - SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].method); - } - lua_pop(L,1); /* tidy stack (remove table) */ - /* add operator overloads - these look ANY method which start with "__" and assume they - are operator overloads & add them to the metatable - (this might mess up is someone defines a method __gc (the destructor)*/ - for(i=0;clss->methods[i].name;i++){ - if (clss->methods[i].name[0]=='_' && clss->methods[i].name[1]=='_'){ - SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].method); - } - } + int i; + /* call all the base classes first: we can then override these later: */ + for(i=0;clss->bases[i];i++) + { + SWIG_Lua_add_class_details(L,clss->bases[i]); + } + /* add fns */ + for(i=0;clss->attributes[i].name;i++){ + SWIG_Lua_add_class_variable(L,clss->attributes[i].name,clss->attributes[i].getmethod,clss->attributes[i].setmethod); + } + /* add methods to the metatable */ + SWIG_Lua_get_table(L,".fn"); /* find the .fn table */ + assert(lua_istable(L,-1)); /* just in case */ + for(i=0;clss->methods[i].name;i++){ + SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].method); + } + lua_pop(L,1); /* tidy stack (remove table) */ + /* add operator overloads + these look ANY method which start with "__" and assume they + are operator overloads & add them to the metatable + (this might mess up is someone defines a method __gc (the destructor)*/ + for(i=0;clss->methods[i].name;i++){ + if (clss->methods[i].name[0]=='_' && clss->methods[i].name[1]=='_'){ + SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].method); + } + } +} + +/* set up the base classes pointers. +Each class structure has a list of pointers to the base class structures. +This function fills them. +It cannot be done at compile time, as this will not work with hireachies +spread over more than one swig file. +Therefore it must be done at runtime, querying the SWIG type system. +*/ +SWIGINTERN void SWIG_Lua_init_base_class(lua_State* L,swig_lua_class* clss) +{ + int i=0; + swig_module_info* module=SWIG_GetModule(L); + for(i=0;clss->base_names[i];i++) + { + if (clss->bases[i]==0) /* not found yet */ + { + /* lookup and cache the base class */ + swig_type_info *info = SWIG_TypeQueryModule(module,module,clss->base_names[i]); + if (info) clss->bases[i] = (swig_lua_class *) info->clientdata; + } + } } /* performs the entire class registration process */ SWIGINTERN void SWIG_Lua_class_register(lua_State* L,swig_lua_class* clss) { -/* add its constructor to module with the name of the class - so you can do MyClass(...) as well as new_MyClass(...) - BUT only if a constructor is defined - (this overcomes the problem of pure virtual classes without constructors)*/ - if (clss->constructor) - SWIG_Lua_add_function(L,clss->name,clss->constructor); - - SWIG_Lua_get_class_registry(L); /* get the registry */ - lua_pushstring(L,clss->name); /* get the name */ - lua_newtable(L); /* create the metatable */ - /* add string of class name called ".type" */ - lua_pushstring(L,".type"); - lua_pushstring(L,clss->name); - lua_rawset(L,-3); - /* add a table called ".get" */ - lua_pushstring(L,".get"); - lua_newtable(L); - lua_rawset(L,-3); - /* add a table called ".set" */ - lua_pushstring(L,".set"); - lua_newtable(L); - lua_rawset(L,-3); - /* add a table called ".fn" */ - lua_pushstring(L,".fn"); - lua_newtable(L); - lua_rawset(L,-3); - /* add accessor fns for using the .get,.set&.fn */ - SWIG_Lua_add_function(L,"__index",SWIG_Lua_class_get); - SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_class_set); - SWIG_Lua_add_function(L,"__gc",SWIG_Lua_class_destruct); - /* add it */ - lua_rawset(L,-3); /* metatable into registry */ - lua_pop(L,1); /* tidy stack (remove registry) */ - - SWIG_Lua_get_class_metatable(L,clss->name); - SWIG_Lua_add_class_details(L,clss); /* recursive adding of details (atts & ops) */ - lua_pop(L,1); /* tidy stack (remove class metatable) */ + /* add its constructor to module with the name of the class + so you can do MyClass(...) as well as new_MyClass(...) + BUT only if a constructor is defined + (this overcomes the problem of pure virtual classes without constructors)*/ + if (clss->constructor) + SWIG_Lua_add_function(L,clss->name,clss->constructor); + + SWIG_Lua_get_class_registry(L); /* get the registry */ + lua_pushstring(L,clss->name); /* get the name */ + lua_newtable(L); /* create the metatable */ + /* add string of class name called ".type" */ + lua_pushstring(L,".type"); + lua_pushstring(L,clss->name); + lua_rawset(L,-3); + /* add a table called ".get" */ + lua_pushstring(L,".get"); + lua_newtable(L); + lua_rawset(L,-3); + /* add a table called ".set" */ + lua_pushstring(L,".set"); + lua_newtable(L); + lua_rawset(L,-3); + /* add a table called ".fn" */ + lua_pushstring(L,".fn"); + lua_newtable(L); + lua_rawset(L,-3); + /* add accessor fns for using the .get,.set&.fn */ + SWIG_Lua_add_function(L,"__index",SWIG_Lua_class_get); + SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_class_set); + SWIG_Lua_add_function(L,"__gc",SWIG_Lua_class_destruct); + /* add it */ + lua_rawset(L,-3); /* metatable into registry */ + lua_pop(L,1); /* tidy stack (remove registry) */ + + SWIG_Lua_get_class_metatable(L,clss->name); + SWIG_Lua_add_class_details(L,clss); /* recursive adding of details (atts & ops) */ + lua_pop(L,1); /* tidy stack (remove class metatable) */ } /* ----------------------------------------------------------------------------- * Class/structure conversion fns * ----------------------------------------------------------------------------- */ +/* helper to add metatable to new lua object */ +SWIGINTERN void _SWIG_Lua_AddMetatable(lua_State* L,swig_type_info *type) +{ + if (type->clientdata) /* there is clientdata: so add the metatable */ + { + SWIG_Lua_get_class_metatable(L,((swig_lua_class*)(type->clientdata))->name); + if (lua_istable(L,-1)) + { + lua_setmetatable(L,-2); + } + else + { + lua_pop(L,1); + } + } +} + /* pushes a new object into the lua stack */ SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State* L,void* ptr,swig_type_info *type, int own) { - swig_lua_userdata* usr; - if (!ptr){ - lua_pushnil(L); - return; - } - usr=(swig_lua_userdata*)lua_newuserdata(L,sizeof(swig_lua_userdata)); /* get data */ - usr->ptr=ptr; /* set the ptr */ - usr->type=type; - usr->own=own; - if (type->clientdata) /* there is clientdata: so add the metatable */ - { - SWIG_Lua_get_class_metatable(L,((swig_lua_class*)(type->clientdata))->name); - if (lua_istable(L,-1)) - { - lua_setmetatable(L,-2); - } - else - { - lua_pop(L,1); - } - } + swig_lua_userdata* usr; + if (!ptr){ + lua_pushnil(L); + return; + } + usr=(swig_lua_userdata*)lua_newuserdata(L,sizeof(swig_lua_userdata)); /* get data */ + usr->ptr=ptr; /* set the ptr */ + usr->type=type; + usr->own=own; + _SWIG_Lua_AddMetatable(L,type); /* add metatable */ } /* takes a object from the lua stack & converts it into an object of the correct type (if possible) */ SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State* L,int index,void** ptr,swig_type_info *type,int flags) { - swig_lua_userdata* usr; - swig_cast_info *cast; - usr=(swig_lua_userdata*)lua_touserdata(L,index); /* get data */ - if (usr) - { - cast=SWIG_TypeCheckStruct(usr->type,type); - if (cast) - { - *ptr=SWIG_TypeCast(cast,usr->ptr); - return 0; /* ok */ - } - } - return 1; /* error */ + swig_lua_userdata* usr; + swig_cast_info *cast; + if (lua_isnil(L,index)){*ptr=0; return SWIG_OK;} /* special case: lua nil => NULL pointer */ + usr=(swig_lua_userdata*)lua_touserdata(L,index); /* get data */ + if (usr) + { + if (flags & SWIG_POINTER_DISOWN) /* must disown the object */ + { + usr->own=0; + } + if (!type) /* special cast void*, no casting fn */ + { + *ptr=usr->ptr; + return SWIG_OK; /* ok */ + } + cast=SWIG_TypeCheckStruct(usr->type,type); /* performs normal type checking */ + if (cast) + { + int newmemory = 0; + *ptr=SWIG_TypeCast(cast,usr->ptr,&newmemory); + assert(!newmemory); /* newmemory handling not yet implemented */ + return SWIG_OK; /* ok */ + } + } + return SWIG_ERROR; /* error */ } SWIGRUNTIME void* SWIG_Lua_MustGetPtr(lua_State* L,int index,swig_type_info *type,int flags, - int argnum,const char* func_name){ - void* result; - if (SWIG_ConvertPtr(L,index,&result,type,flags)){ - lua_pushfstring(L,"Error in %s, expected a %s at argument number %d\n", - func_name,(type && type->str)?type->str:"void*",argnum); - lua_error(L); - } - return result; + int argnum,const char* func_name){ + void* result; + if (!SWIG_IsOK(SWIG_ConvertPtr(L,index,&result,type,flags))){ + lua_pushfstring(L,"Error in %s, expected a %s at argument number %d\n", + func_name,(type && type->str)?type->str:"void*",argnum); + lua_error(L); + } + return result; +} + +/* pushes a packed userdata. user for member fn pointers only */ +SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State* L,void* ptr,size_t size,swig_type_info *type) +{ + swig_lua_rawdata* raw; + assert(ptr); /* not acceptable to pass in a NULL value */ + raw=(swig_lua_rawdata*)lua_newuserdata(L,sizeof(swig_lua_rawdata)-1+size); /* alloc data */ + raw->type=type; + raw->own=0; + memcpy(raw->data,ptr,size); /* copy the data */ + _SWIG_Lua_AddMetatable(L,type); /* add metatable */ +} + +/* converts a packed userdata. user for member fn pointers only */ +SWIGRUNTIME int SWIG_Lua_ConvertPacked(lua_State* L,int index,void* ptr,size_t size,swig_type_info *type) +{ + swig_lua_rawdata* raw; + raw=(swig_lua_rawdata*)lua_touserdata(L,index); /* get data */ + if (!raw) return SWIG_ERROR; /* error */ + if (type==0 || type==raw->type) /* void* or identical type */ + { + memcpy(ptr,raw->data,size); /* copy it */ + return SWIG_OK; /* ok */ + } + return SWIG_ERROR; /* error */ +} + +/* a function to get the typestring of a piece of data */ +SWIGRUNTIME const char *SWIG_Lua_typename(lua_State *L, int tp) +{ + swig_lua_userdata* usr; + if (lua_isuserdata(L,tp)) + { + usr=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */ + if (usr && usr->type && usr->type->str) + return usr->type->str; + return "userdata (unknown type)"; + } + return lua_typename(L,lua_type(L,tp)); } /* lua callable function to get the userdata's type */ SWIGRUNTIME int SWIG_Lua_type(lua_State* L) { - swig_lua_userdata* usr; - if (!lua_isuserdata(L,1)) /* just in case */ - return 0; /* nil reply */ - usr=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */ - lua_pushstring(L,usr->type->name); - return 1; + lua_pushstring(L,SWIG_Lua_typename(L,1)); + return 1; } /* lua callable function to compare userdata's value @@ -1240,18 +1388,18 @@ the issue is that two userdata may point to the same thing but to lua, they are different objects */ SWIGRUNTIME int SWIG_Lua_equal(lua_State* L) { - int result; - swig_lua_userdata *usr1,*usr2; - if (!lua_isuserdata(L,1) || !lua_isuserdata(L,2)) /* just in case */ - return 0; /* nil reply */ - usr1=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */ - usr2=(swig_lua_userdata*)lua_touserdata(L,2); /* get data */ - result=(usr1->ptr==usr2->ptr && usr1->type==usr2->type); - lua_pushboolean(L,result); - return 1; + int result; + swig_lua_userdata *usr1,*usr2; + if (!lua_isuserdata(L,1) || !lua_isuserdata(L,2)) /* just in case */ + return 0; /* nil reply */ + usr1=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */ + usr2=(swig_lua_userdata*)lua_touserdata(L,2); /* get data */ + /*result=(usr1->ptr==usr2->ptr && usr1->type==usr2->type); only works if type is the same*/ + result=(usr1->ptr==usr2->ptr); + lua_pushboolean(L,result); + return 1; } - /* ----------------------------------------------------------------------------- * global variable support code: class/struct typemap functions * ----------------------------------------------------------------------------- */ @@ -1264,12 +1412,17 @@ SWIG_Lua_InstallConstants(lua_State* L, swig_lua_const_info constants[]) { switch(constants[i].type) { case SWIG_LUA_INT: lua_pushstring(L,constants[i].name); - lua_pushnumber(L,(double)constants[i].lvalue); + lua_pushnumber(L,(lua_Number)constants[i].lvalue); lua_rawset(L,-3); break; case SWIG_LUA_FLOAT: lua_pushstring(L,constants[i].name); - lua_pushnumber(L,(double)constants[i].dvalue); + lua_pushnumber(L,(lua_Number)constants[i].dvalue); + lua_rawset(L,-3); + break; + case SWIG_LUA_CHAR: + lua_pushstring(L,constants[i].name); + lua_pushfstring(L,"%c",(char)constants[i].lvalue); lua_rawset(L,-3); break; case SWIG_LUA_STRING: @@ -1283,8 +1436,9 @@ SWIG_Lua_InstallConstants(lua_State* L, swig_lua_const_info constants[]) { lua_rawset(L,-3); break; case SWIG_LUA_BINARY: - /* TODO?? */ -/* obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); */ + lua_pushstring(L,constants[i].name); + SWIG_NewMemberObj(L,constants[i].pvalue,constants[i].lvalue,*(constants[i]).ptype); + lua_rawset(L,-3); break; default: break; @@ -1292,25 +1446,34 @@ SWIG_Lua_InstallConstants(lua_State* L, swig_lua_const_info constants[]) { } } -/* storing/access of swig_module_info */ -SWIGRUNTIME swig_module_info * -SWIG_Lua_GetModule(lua_State* L) { - swig_module_info *ret = 0; - lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME); - lua_rawget(L,LUA_REGISTRYINDEX); - if (lua_islightuserdata(L,-1)) - ret=(swig_module_info*)lua_touserdata(L,-1); - lua_pop(L,1); /* tidy */ - return ret; -} +/* ----------------------------------------------------------------------------- + * executing lua code from within the wrapper + * ----------------------------------------------------------------------------- */ -SWIGRUNTIME void -SWIG_Lua_SetModule(lua_State* L, swig_module_info *module) { - /* add this all into the Lua registry: */ - lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME); - lua_pushlightuserdata(L,(void*)module); - lua_rawset(L,LUA_REGISTRYINDEX); -} +#ifndef SWIG_DOSTRING_FAIL /* Allows redefining of error function */ +#define SWIG_DOSTRING_FAIL(S) fprintf(stderr,"%s\n",S) +#endif +/* Executes a C string in Lua a really simple way of calling lua from C +Unfortunately lua keeps changing its API's, so we need a conditional compile +In lua 5.0.X its lua_dostring() +In lua 5.1.X its luaL_dostring() +*/ +SWIGINTERN int +SWIG_Lua_dostring(lua_State *L, const char* str) { + int ok,top; + if (str==0 || str[0]==0) return 0; /* nothing to do */ + top=lua_gettop(L); /* save stack */ +#if (defined(LUA_VERSION_NUM) && (LUA_VERSION_NUM>=501)) + ok=luaL_dostring(L,str); /* looks like this is lua 5.1.X or later, good */ +#else + ok=lua_dostring(L,str); /* might be lua 5.0.x, using lua_dostring */ +#endif + if (ok!=0) { + SWIG_DOSTRING_FAIL(lua_tostring(L,-1)); + } + lua_settop(L,top); /* restore the stack */ + return ok; +} #ifdef __cplusplus } @@ -1321,15 +1484,15 @@ SWIG_Lua_SetModule(lua_State* L, swig_module_info *module) { /* -------- TYPES TABLE (BEGIN) -------- */ -#define SWIGTYPE_SWIGLUA_FN swig_types[0] -#define SWIGTYPE_p_API swig_types[1] -#define SWIGTYPE_p_CoreSession swig_types[2] -#define SWIGTYPE_p_DTMF swig_types[3] -#define SWIGTYPE_p_Event swig_types[4] -#define SWIGTYPE_p_EventConsumer swig_types[5] -#define SWIGTYPE_p_IVRMenu swig_types[6] -#define SWIGTYPE_p_LUA__Dbh swig_types[7] -#define SWIGTYPE_p_LUA__Session swig_types[8] +#define SWIGTYPE_p_API swig_types[0] +#define SWIGTYPE_p_CoreSession swig_types[1] +#define SWIGTYPE_p_DTMF swig_types[2] +#define SWIGTYPE_p_Event swig_types[3] +#define SWIGTYPE_p_EventConsumer swig_types[4] +#define SWIGTYPE_p_IVRMenu swig_types[5] +#define SWIGTYPE_p_LUA__Dbh swig_types[6] +#define SWIGTYPE_p_LUA__Session swig_types[7] +#define SWIGTYPE_p_SWIGLUA_FN swig_types[8] #define SWIGTYPE_p_Stream swig_types[9] #define SWIGTYPE_p_input_callback_state swig_types[10] #define SWIGTYPE_p_lua_State swig_types[11] @@ -1350,22 +1513,23 @@ SWIG_Lua_SetModule(lua_State* L, swig_module_info *module) { #define SWIGTYPE_p_switch_stream_handle_t swig_types[26] #define SWIGTYPE_p_uint32_t swig_types[27] #define SWIGTYPE_p_void swig_types[28] -#define SWIGTYPE_switch_call_cause_t swig_types[29] -#define SWIGTYPE_switch_channel_state_t swig_types[30] -#define SWIGTYPE_switch_event_types_t swig_types[31] -#define SWIGTYPE_switch_input_type_t swig_types[32] -#define SWIGTYPE_switch_priority_t swig_types[33] -#define SWIGTYPE_uint32_t swig_types[34] -static swig_type_info *swig_types[36]; -static swig_module_info swig_module = {swig_types, 35, 0, 0, 0, 0}; +static swig_type_info *swig_types[30]; +static swig_module_info swig_module = {swig_types, 29, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) /* -------- TYPES TABLE (END) -------- */ -#define SWIG_init Freeswitch_Init -#define SWIG_name "freeswitch" -#define SWIG_import luaopen_freeswitch +#define SWIG_name "freeswitch" +#define SWIG_init luaopen_freeswitch +#define SWIG_init_user luaopen_freeswitch_user + +#define SWIG_LUACODE luaopen_freeswitch_luacode + + +namespace swig { +typedef struct{} LANGUAGE_OBJ; +} #include "switch.h" @@ -1380,15 +1544,18 @@ static int _wrap_consoleLog(lua_State* L) { char *arg1 = (char *) 0 ; char *arg2 = (char *) 0 ; - if(!lua_isstring(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - arg1 = (char*)lua_tostring(L, 1); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("consoleLog",2,2) + if(!lua_isstring(L,1)) SWIG_fail_arg("consoleLog",1,"char *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("consoleLog",2,"char *"); + arg1 = (char *)lua_tostring(L, 1); + arg2 = (char *)lua_tostring(L, 2); consoleLog(arg1,arg2); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -1399,13 +1566,16 @@ static int _wrap_consoleCleanLog(lua_State* L) { int SWIG_arg = -1; char *arg1 = (char *) 0 ; - if(!lua_isstring(L,1)) SWIG_fail_arg(1); - arg1 = (char*)lua_tostring(L, 1); + SWIG_check_num_args("consoleCleanLog",1,1) + if(!lua_isstring(L,1)) SWIG_fail_arg("consoleCleanLog",1,"char *"); + arg1 = (char *)lua_tostring(L, 1); consoleCleanLog(arg1); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -1432,32 +1602,37 @@ static int _wrap_new_IVRMenu(lua_State* L) { int arg16 ; IVRMenu *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - if(!lua_isstring(L,3)) SWIG_fail_arg(3); - if(!lua_isstring(L,4)) SWIG_fail_arg(4); - if(!lua_isstring(L,5)) SWIG_fail_arg(5); - if(!lua_isstring(L,6)) SWIG_fail_arg(6); - if(!lua_isstring(L,7)) SWIG_fail_arg(7); - if(!lua_isstring(L,8)) SWIG_fail_arg(8); - if(!lua_isstring(L,9)) SWIG_fail_arg(9); - if(!lua_isstring(L,10)) SWIG_fail_arg(10); - if(!lua_isnumber(L,11)) SWIG_fail_arg(11); - if(!lua_isnumber(L,12)) SWIG_fail_arg(12); - if(!lua_isnumber(L,13)) SWIG_fail_arg(13); - if(!lua_isnumber(L,14)) SWIG_fail_arg(14); - if(!lua_isnumber(L,15)) SWIG_fail_arg(15); - if(!lua_isnumber(L,16)) SWIG_fail_arg(16); - arg1=(IVRMenu *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_IVRMenu,0,1,"new_IVRMenu"); - arg2 = (char*)lua_tostring(L, 2); - arg3 = (char*)lua_tostring(L, 3); - arg4 = (char*)lua_tostring(L, 4); - arg5 = (char*)lua_tostring(L, 5); - arg6 = (char*)lua_tostring(L, 6); - arg7 = (char*)lua_tostring(L, 7); - arg8 = (char*)lua_tostring(L, 8); - arg9 = (char*)lua_tostring(L, 9); - arg10 = (char*)lua_tostring(L, 10); + SWIG_check_num_args("IVRMenu",16,16) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("IVRMenu",1,"IVRMenu *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("IVRMenu",2,"char const *"); + if(!lua_isstring(L,3)) SWIG_fail_arg("IVRMenu",3,"char const *"); + if(!lua_isstring(L,4)) SWIG_fail_arg("IVRMenu",4,"char const *"); + if(!lua_isstring(L,5)) SWIG_fail_arg("IVRMenu",5,"char const *"); + if(!lua_isstring(L,6)) SWIG_fail_arg("IVRMenu",6,"char const *"); + if(!lua_isstring(L,7)) SWIG_fail_arg("IVRMenu",7,"char const *"); + if(!lua_isstring(L,8)) SWIG_fail_arg("IVRMenu",8,"char const *"); + if(!lua_isstring(L,9)) SWIG_fail_arg("IVRMenu",9,"char const *"); + if(!lua_isstring(L,10)) SWIG_fail_arg("IVRMenu",10,"char const *"); + if(!lua_isnumber(L,11)) SWIG_fail_arg("IVRMenu",11,"int"); + if(!lua_isnumber(L,12)) SWIG_fail_arg("IVRMenu",12,"int"); + if(!lua_isnumber(L,13)) SWIG_fail_arg("IVRMenu",13,"int"); + if(!lua_isnumber(L,14)) SWIG_fail_arg("IVRMenu",14,"int"); + if(!lua_isnumber(L,15)) SWIG_fail_arg("IVRMenu",15,"int"); + if(!lua_isnumber(L,16)) SWIG_fail_arg("IVRMenu",16,"int"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,0))){ + SWIG_fail_ptr("new_IVRMenu",1,SWIGTYPE_p_IVRMenu); + } + + arg2 = (char *)lua_tostring(L, 2); + arg3 = (char *)lua_tostring(L, 3); + arg4 = (char *)lua_tostring(L, 4); + arg5 = (char *)lua_tostring(L, 5); + arg6 = (char *)lua_tostring(L, 6); + arg7 = (char *)lua_tostring(L, 7); + arg8 = (char *)lua_tostring(L, 8); + arg9 = (char *)lua_tostring(L, 9); + arg10 = (char *)lua_tostring(L, 10); arg11 = (int)lua_tonumber(L, 11); arg12 = (int)lua_tonumber(L, 12); arg13 = (int)lua_tonumber(L, 13); @@ -1469,6 +1644,8 @@ static int _wrap_new_IVRMenu(lua_State* L) { SWIG_NewPointerObj(L,result,SWIGTYPE_p_IVRMenu,1); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -1479,14 +1656,21 @@ static int _wrap_delete_IVRMenu(lua_State* L) { int SWIG_arg = -1; IVRMenu *arg1 = (IVRMenu *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(IVRMenu *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_IVRMenu,0,1,"delete_IVRMenu"); + SWIG_check_num_args("IVRMenu",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("IVRMenu",1,"IVRMenu *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,SWIG_POINTER_DISOWN))){ + SWIG_fail_ptr("delete_IVRMenu",1,SWIGTYPE_p_IVRMenu); + } + delete arg1; SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -1500,19 +1684,26 @@ static int _wrap_IVRMenu_bindAction(lua_State* L) { char *arg3 = (char *) 0 ; char *arg4 = (char *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - if(!lua_isstring(L,3)) SWIG_fail_arg(3); - if(!lua_isstring(L,4)) SWIG_fail_arg(4); - arg1=(IVRMenu *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_IVRMenu,0,1,"IVRMenu_bindAction"); - arg2 = (char*)lua_tostring(L, 2); - arg3 = (char*)lua_tostring(L, 3); - arg4 = (char*)lua_tostring(L, 4); + SWIG_check_num_args("bindAction",4,4) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("bindAction",1,"IVRMenu *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("bindAction",2,"char *"); + if(!lua_isstring(L,3)) SWIG_fail_arg("bindAction",3,"char const *"); + if(!lua_isstring(L,4)) SWIG_fail_arg("bindAction",4,"char const *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,0))){ + SWIG_fail_ptr("IVRMenu_bindAction",1,SWIGTYPE_p_IVRMenu); + } + + arg2 = (char *)lua_tostring(L, 2); + arg3 = (char *)lua_tostring(L, 3); + arg4 = (char *)lua_tostring(L, 4); (arg1)->bindAction(arg2,(char const *)arg3,(char const *)arg4); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -1525,17 +1716,28 @@ static int _wrap_IVRMenu_execute(lua_State* L) { CoreSession *arg2 = (CoreSession *) 0 ; char *arg3 = (char *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); - if(!lua_isstring(L,3)) SWIG_fail_arg(3); - arg1=(IVRMenu *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_IVRMenu,0,1,"IVRMenu_execute"); - arg2=(CoreSession *)SWIG_MustGetPtr(L,2,SWIGTYPE_p_CoreSession,0,2,"IVRMenu_execute"); - arg3 = (char*)lua_tostring(L, 3); + SWIG_check_num_args("execute",3,3) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("execute",1,"IVRMenu *"); + if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("execute",2,"CoreSession *"); + if(!lua_isstring(L,3)) SWIG_fail_arg("execute",3,"char const *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,0))){ + SWIG_fail_ptr("IVRMenu_execute",1,SWIGTYPE_p_IVRMenu); + } + + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("IVRMenu_execute",2,SWIGTYPE_p_CoreSession); + } + + arg3 = (char *)lua_tostring(L, 3); (arg1)->execute(arg2,(char const *)arg3); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -1555,17 +1757,21 @@ static swig_lua_attribute swig_IVRMenu_attributes[] = { {0,0,0} }; static swig_lua_class *swig_IVRMenu_bases[] = {0}; -swig_lua_class _wrap_class_IVRMenu = { "IVRMenu", &SWIGTYPE_p_IVRMenu,_wrap_new_IVRMenu, swig_delete_IVRMenu, swig_IVRMenu_methods, swig_IVRMenu_attributes, swig_IVRMenu_bases }; +static const char *swig_IVRMenu_base_names[] = {0}; +static swig_lua_class _wrap_class_IVRMenu = { "IVRMenu", &SWIGTYPE_p_IVRMenu,_wrap_new_IVRMenu, swig_delete_IVRMenu, swig_IVRMenu_methods, swig_IVRMenu_attributes, swig_IVRMenu_bases, swig_IVRMenu_base_names }; static int _wrap_new_API(lua_State* L) { int SWIG_arg = -1; API *result = 0 ; + SWIG_check_num_args("API",0,0) result = (API *)new API(); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_API,1); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -1576,14 +1782,21 @@ static int _wrap_delete_API(lua_State* L) { int SWIG_arg = -1; API *arg1 = (API *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(API *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_API,0,1,"delete_API"); + SWIG_check_num_args("API",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("API",1,"API *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_API,SWIG_POINTER_DISOWN))){ + SWIG_fail_ptr("delete_API",1,SWIGTYPE_p_API); + } + delete arg1; SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -1597,19 +1810,26 @@ static int _wrap_API_execute(lua_State* L) { char *arg3 = (char *) NULL ; char *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - if(lua_gettop(L)>=3 && !lua_isstring(L,3)) SWIG_fail_arg(3); - arg1=(API *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_API,0,1,"API_execute"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("execute",2,3) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("execute",1,"API *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("execute",2,"char const *"); + if(lua_gettop(L)>=3 && !lua_isstring(L,3)) SWIG_fail_arg("execute",3,"char const *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_API,0))){ + SWIG_fail_ptr("API_execute",1,SWIGTYPE_p_API); + } + + arg2 = (char *)lua_tostring(L, 2); if(lua_gettop(L)>=3){ - arg3 = (char*)lua_tostring(L, 3); + arg3 = (char *)lua_tostring(L, 3); } result = (char *)(arg1)->execute((char const *)arg2,(char const *)arg3); SWIG_arg=0; - lua_pushstring(L,result); SWIG_arg++; + lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -1622,15 +1842,22 @@ static int _wrap_API_executeString(lua_State* L) { char *arg2 = (char *) 0 ; char *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - arg1=(API *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_API,0,1,"API_executeString"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("executeString",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("executeString",1,"API *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("executeString",2,"char const *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_API,0))){ + SWIG_fail_ptr("API_executeString",1,SWIGTYPE_p_API); + } + + arg2 = (char *)lua_tostring(L, 2); result = (char *)(arg1)->executeString((char const *)arg2); SWIG_arg=0; - lua_pushstring(L,result); SWIG_arg++; + lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -1642,13 +1869,20 @@ static int _wrap_API_getTime(lua_State* L) { API *arg1 = (API *) 0 ; char *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(API *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_API,0,1,"API_getTime"); + SWIG_check_num_args("getTime",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getTime",1,"API *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_API,0))){ + SWIG_fail_ptr("API_getTime",1,SWIGTYPE_p_API); + } + result = (char *)(arg1)->getTime(); SWIG_arg=0; - lua_pushstring(L,result); SWIG_arg++; + lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -1669,23 +1903,31 @@ static swig_lua_attribute swig_API_attributes[] = { {0,0,0} }; static swig_lua_class *swig_API_bases[] = {0}; -swig_lua_class _wrap_class_API = { "API", &SWIGTYPE_p_API,_wrap_new_API, swig_delete_API, swig_API_methods, swig_API_attributes, swig_API_bases }; +static const char *swig_API_base_names[] = {0}; +static swig_lua_class _wrap_class_API = { "API", &SWIGTYPE_p_API,_wrap_new_API, swig_delete_API, swig_API_methods, swig_API_attributes, swig_API_bases, swig_API_base_names }; static int _wrap_input_callback_state_t_function_set(lua_State* L) { int SWIG_arg = -1; input_callback_state_t *arg1 = (input_callback_state_t *) 0 ; void *arg2 = (void *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); - arg1=(input_callback_state_t *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_input_callback_state,0,1,"input_callback_state_t_function_set"); - arg2=((swig_lua_userdata*)(lua_touserdata(L,2)))->ptr; + SWIG_check_num_args("function",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("function",1,"input_callback_state_t *"); + if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("function",2,"void *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){ + SWIG_fail_ptr("input_callback_state_t_function_set",1,SWIGTYPE_p_input_callback_state); + } + + arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"input_callback_state_t_function_set"); if (arg1) (arg1)->function = arg2; SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -1697,13 +1939,20 @@ static int _wrap_input_callback_state_t_function_get(lua_State* L) { input_callback_state_t *arg1 = (input_callback_state_t *) 0 ; void *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(input_callback_state_t *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_input_callback_state,0,1,"input_callback_state_t_function_get"); + SWIG_check_num_args("function",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("function",1,"input_callback_state_t *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){ + SWIG_fail_ptr("input_callback_state_t_function_get",1,SWIGTYPE_p_input_callback_state); + } + result = (void *) ((arg1)->function); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_void,0); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -1715,16 +1964,23 @@ static int _wrap_input_callback_state_t_threadState_set(lua_State* L) { input_callback_state_t *arg1 = (input_callback_state_t *) 0 ; void *arg2 = (void *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); - arg1=(input_callback_state_t *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_input_callback_state,0,1,"input_callback_state_t_threadState_set"); - arg2=((swig_lua_userdata*)(lua_touserdata(L,2)))->ptr; + SWIG_check_num_args("threadState",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("threadState",1,"input_callback_state_t *"); + if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("threadState",2,"void *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){ + SWIG_fail_ptr("input_callback_state_t_threadState_set",1,SWIGTYPE_p_input_callback_state); + } + + arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"input_callback_state_t_threadState_set"); if (arg1) (arg1)->threadState = arg2; SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -1736,13 +1992,20 @@ static int _wrap_input_callback_state_t_threadState_get(lua_State* L) { input_callback_state_t *arg1 = (input_callback_state_t *) 0 ; void *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(input_callback_state_t *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_input_callback_state,0,1,"input_callback_state_t_threadState_get"); + SWIG_check_num_args("threadState",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("threadState",1,"input_callback_state_t *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){ + SWIG_fail_ptr("input_callback_state_t_threadState_get",1,SWIGTYPE_p_input_callback_state); + } + result = (void *) ((arg1)->threadState); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_void,0); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -1754,16 +2017,23 @@ static int _wrap_input_callback_state_t_extra_set(lua_State* L) { input_callback_state_t *arg1 = (input_callback_state_t *) 0 ; void *arg2 = (void *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); - arg1=(input_callback_state_t *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_input_callback_state,0,1,"input_callback_state_t_extra_set"); - arg2=((swig_lua_userdata*)(lua_touserdata(L,2)))->ptr; + SWIG_check_num_args("extra",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("extra",1,"input_callback_state_t *"); + if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("extra",2,"void *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){ + SWIG_fail_ptr("input_callback_state_t_extra_set",1,SWIGTYPE_p_input_callback_state); + } + + arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"input_callback_state_t_extra_set"); if (arg1) (arg1)->extra = arg2; SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -1775,13 +2045,20 @@ static int _wrap_input_callback_state_t_extra_get(lua_State* L) { input_callback_state_t *arg1 = (input_callback_state_t *) 0 ; void *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(input_callback_state_t *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_input_callback_state,0,1,"input_callback_state_t_extra_get"); + SWIG_check_num_args("extra",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("extra",1,"input_callback_state_t *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){ + SWIG_fail_ptr("input_callback_state_t_extra_get",1,SWIGTYPE_p_input_callback_state); + } + result = (void *) ((arg1)->extra); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_void,0); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -1793,15 +2070,20 @@ static int _wrap_input_callback_state_t_funcargs_set(lua_State* L) { input_callback_state_t *arg1 = (input_callback_state_t *) 0 ; char *arg2 = (char *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - arg1=(input_callback_state_t *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_input_callback_state,0,1,"input_callback_state_t_funcargs_set"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("funcargs",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("funcargs",1,"input_callback_state_t *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("funcargs",2,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){ + SWIG_fail_ptr("input_callback_state_t_funcargs_set",1,SWIGTYPE_p_input_callback_state); + } + + arg2 = (char *)lua_tostring(L, 2); { if (arg1->funcargs) delete [] arg1->funcargs; if (arg2) { - arg1->funcargs = (char *) (new char[strlen(arg2)+1]); - strcpy((char *) arg1->funcargs,arg2); + arg1->funcargs = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->funcargs, (const char *)arg2); } else { arg1->funcargs = 0; } @@ -1810,6 +2092,8 @@ static int _wrap_input_callback_state_t_funcargs_set(lua_State* L) { return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -1821,13 +2105,20 @@ static int _wrap_input_callback_state_t_funcargs_get(lua_State* L) { input_callback_state_t *arg1 = (input_callback_state_t *) 0 ; char *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(input_callback_state_t *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_input_callback_state,0,1,"input_callback_state_t_funcargs_get"); + SWIG_check_num_args("funcargs",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("funcargs",1,"input_callback_state_t *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){ + SWIG_fail_ptr("input_callback_state_t_funcargs_get",1,SWIGTYPE_p_input_callback_state); + } + result = (char *) ((arg1)->funcargs); SWIG_arg=0; - lua_pushstring(L,result); SWIG_arg++; + lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -1838,11 +2129,14 @@ static int _wrap_new_input_callback_state_t(lua_State* L) { int SWIG_arg = -1; input_callback_state_t *result = 0 ; + SWIG_check_num_args("input_callback_state_t::input_callback_state_t",0,0) result = (input_callback_state_t *)new input_callback_state_t(); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_input_callback_state,1); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -1853,14 +2147,21 @@ static int _wrap_delete_input_callback_state_t(lua_State* L) { int SWIG_arg = -1; input_callback_state_t *arg1 = (input_callback_state_t *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(input_callback_state_t *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_input_callback_state,0,1,"delete_input_callback_state_t"); + SWIG_check_num_args("input_callback_state_t::~input_callback_state_t",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("input_callback_state_t::~input_callback_state_t",1,"input_callback_state_t *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,SWIG_POINTER_DISOWN))){ + SWIG_fail_ptr("delete_input_callback_state_t",1,SWIGTYPE_p_input_callback_state); + } + delete arg1; SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -1875,30 +2176,38 @@ static swig_lua_method swig_input_callback_state_t_methods[] = { {0,0} }; static swig_lua_attribute swig_input_callback_state_t_attributes[] = { - { "function",_wrap_input_callback_state_t_function_get, _wrap_input_callback_state_t_function_set}, - { "threadState",_wrap_input_callback_state_t_threadState_get, _wrap_input_callback_state_t_threadState_set}, - { "extra",_wrap_input_callback_state_t_extra_get, _wrap_input_callback_state_t_extra_set}, - { "funcargs",_wrap_input_callback_state_t_funcargs_get, _wrap_input_callback_state_t_funcargs_set}, + { "function", _wrap_input_callback_state_t_function_get, _wrap_input_callback_state_t_function_set}, + { "threadState", _wrap_input_callback_state_t_threadState_get, _wrap_input_callback_state_t_threadState_set}, + { "extra", _wrap_input_callback_state_t_extra_get, _wrap_input_callback_state_t_extra_set}, + { "funcargs", _wrap_input_callback_state_t_funcargs_get, _wrap_input_callback_state_t_funcargs_set}, {0,0,0} }; static swig_lua_class *swig_input_callback_state_t_bases[] = {0}; -swig_lua_class _wrap_class_input_callback_state_t = { "input_callback_state_t", &SWIGTYPE_p_input_callback_state,_wrap_new_input_callback_state_t, swig_delete_input_callback_state_t, swig_input_callback_state_t_methods, swig_input_callback_state_t_attributes, swig_input_callback_state_t_bases }; +static const char *swig_input_callback_state_t_base_names[] = {0}; +static swig_lua_class _wrap_class_input_callback_state_t = { "input_callback_state_t", &SWIGTYPE_p_input_callback_state,_wrap_new_input_callback_state_t, swig_delete_input_callback_state_t, swig_input_callback_state_t_methods, swig_input_callback_state_t_attributes, swig_input_callback_state_t_bases, swig_input_callback_state_t_base_names }; static int _wrap_DTMF_digit_set(lua_State* L) { int SWIG_arg = -1; DTMF *arg1 = (DTMF *) 0 ; char arg2 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - arg1=(DTMF *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_DTMF,0,1,"DTMF_digit_set"); - arg2 = ((char*)lua_tostring(L, 2))[0]; + SWIG_check_num_args("digit",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("digit",1,"DTMF *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("digit",2,"char"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_DTMF,0))){ + SWIG_fail_ptr("DTMF_digit_set",1,SWIGTYPE_p_DTMF); + } + + arg2 = (lua_tostring(L, 2))[0]; if (arg1) (arg1)->digit = arg2; SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -1910,13 +2219,20 @@ static int _wrap_DTMF_digit_get(lua_State* L) { DTMF *arg1 = (DTMF *) 0 ; char result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(DTMF *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_DTMF,0,1,"DTMF_digit_get"); + SWIG_check_num_args("digit",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("digit",1,"DTMF *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_DTMF,0))){ + SWIG_fail_ptr("DTMF_digit_get",1,SWIGTYPE_p_DTMF); + } + result = (char) ((arg1)->digit); SWIG_arg=0; lua_pushfstring(L,"%c",result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -1927,21 +2243,30 @@ static int _wrap_DTMF_duration_set(lua_State* L) { int SWIG_arg = -1; DTMF *arg1 = (DTMF *) 0 ; uint32_t arg2 ; + uint32_t *argp2 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); - arg1=(DTMF *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_DTMF,0,1,"DTMF_duration_set"); - { - uint32_t * argp; - if(SWIG_ConvertPtr(L,2,(void**)(&argp),SWIGTYPE_p_uint32_t,0)) SWIG_fail; - arg2 = *argp; + SWIG_check_num_args("duration",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("duration",1,"DTMF *"); + if(!lua_isuserdata(L,2)) SWIG_fail_arg("duration",2,"uint32_t"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_DTMF,0))){ + SWIG_fail_ptr("DTMF_duration_set",1,SWIGTYPE_p_DTMF); + } + + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_uint32_t,0))){ + SWIG_fail_ptr("DTMF_duration_set",2,SWIGTYPE_p_uint32_t); } + arg2 = *argp2; + if (arg1) (arg1)->duration = arg2; SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -1953,17 +2278,23 @@ static int _wrap_DTMF_duration_get(lua_State* L) { DTMF *arg1 = (DTMF *) 0 ; uint32_t result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(DTMF *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_DTMF,0,1,"DTMF_duration_get"); + SWIG_check_num_args("duration",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("duration",1,"DTMF *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_DTMF,0))){ + SWIG_fail_ptr("DTMF_duration_get",1,SWIGTYPE_p_DTMF); + } + result = ((arg1)->duration); SWIG_arg=0; { - uint32_t * resultptr; - resultptr = new uint32_t((uint32_t &) result); + uint32_t * resultptr = new uint32_t((uint32_t &) result); SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_uint32_t,1); SWIG_arg++; } return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -1975,22 +2306,25 @@ static int _wrap_new_DTMF(lua_State* L) { char arg1 ; uint32_t arg2 = (uint32_t) SWITCH_DEFAULT_DTMF_DURATION ; DTMF *result = 0 ; + uint32_t *argp2 ; - if(!lua_isstring(L,1)) SWIG_fail_arg(1); - if(lua_gettop(L)>=2 && !lua_isuserdata(L,2)) SWIG_fail_arg(2); - arg1 = ((char*)lua_tostring(L, 1))[0]; + SWIG_check_num_args("DTMF",1,2) + if(!lua_isstring(L,1)) SWIG_fail_arg("DTMF",1,"char"); + if(lua_gettop(L)>=2 && !lua_isuserdata(L,2)) SWIG_fail_arg("DTMF",2,"uint32_t"); + arg1 = (lua_tostring(L, 1))[0]; if(lua_gettop(L)>=2){ - { - uint32_t * argp; - if(SWIG_ConvertPtr(L,2,(void**)(&argp),SWIGTYPE_p_uint32_t,0)) SWIG_fail; - arg2 = *argp; + if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_uint32_t,0))){ + SWIG_fail_ptr("new_DTMF",2,SWIGTYPE_p_uint32_t); } + arg2 = *argp2; } result = (DTMF *)new DTMF(arg1,arg2); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_DTMF,1); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2001,14 +2335,21 @@ static int _wrap_delete_DTMF(lua_State* L) { int SWIG_arg = -1; DTMF *arg1 = (DTMF *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(DTMF *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_DTMF,0,1,"delete_DTMF"); + SWIG_check_num_args("DTMF",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("DTMF",1,"DTMF *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_DTMF,SWIG_POINTER_DISOWN))){ + SWIG_fail_ptr("delete_DTMF",1,SWIGTYPE_p_DTMF); + } + delete arg1; SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2023,22 +2364,26 @@ static swig_lua_method swig_DTMF_methods[] = { {0,0} }; static swig_lua_attribute swig_DTMF_attributes[] = { - { "digit",_wrap_DTMF_digit_get, _wrap_DTMF_digit_set}, - { "duration",_wrap_DTMF_duration_get, _wrap_DTMF_duration_set}, + { "digit", _wrap_DTMF_digit_get, _wrap_DTMF_digit_set}, + { "duration", _wrap_DTMF_duration_get, _wrap_DTMF_duration_set}, {0,0,0} }; static swig_lua_class *swig_DTMF_bases[] = {0}; -swig_lua_class _wrap_class_DTMF = { "DTMF", &SWIGTYPE_p_DTMF,_wrap_new_DTMF, swig_delete_DTMF, swig_DTMF_methods, swig_DTMF_attributes, swig_DTMF_bases }; +static const char *swig_DTMF_base_names[] = {0}; +static swig_lua_class _wrap_class_DTMF = { "DTMF", &SWIGTYPE_p_DTMF,_wrap_new_DTMF, swig_delete_DTMF, swig_DTMF_methods, swig_DTMF_attributes, swig_DTMF_bases, swig_DTMF_base_names }; static int _wrap_new_Stream__SWIG_0(lua_State* L) { int SWIG_arg = -1; Stream *result = 0 ; + SWIG_check_num_args("Stream",0,0) result = (Stream *)new Stream(); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_Stream,1); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2050,13 +2395,20 @@ static int _wrap_new_Stream__SWIG_1(lua_State* L) { switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0 ; Stream *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(switch_stream_handle_t *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_switch_stream_handle_t,0,1,"new_Stream"); + SWIG_check_num_args("Stream",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Stream",1,"switch_stream_handle_t *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_switch_stream_handle_t,0))){ + SWIG_fail_ptr("new_Stream",1,SWIGTYPE_p_switch_stream_handle_t); + } + result = (Stream *)new Stream(arg1); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_Stream,1); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2077,7 +2429,7 @@ static int _wrap_new_Stream(lua_State* L) { int _v; { void *ptr; - if (lua_isuserdata(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_switch_stream_handle_t, 0)) { + if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_switch_stream_handle_t, 0)) { _v = 0; } else { _v = 1; @@ -2097,14 +2449,21 @@ static int _wrap_delete_Stream(lua_State* L) { int SWIG_arg = -1; Stream *arg1 = (Stream *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(Stream *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Stream,0,1,"delete_Stream"); + SWIG_check_num_args("Stream",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Stream",1,"Stream *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Stream,SWIG_POINTER_DISOWN))){ + SWIG_fail_ptr("delete_Stream",1,SWIGTYPE_p_Stream); + } + delete arg1; SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2116,15 +2475,22 @@ static int _wrap_Stream_write(lua_State* L) { Stream *arg1 = (Stream *) 0 ; char *arg2 = (char *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - arg1=(Stream *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Stream,0,1,"Stream_write"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("write",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("write",1,"Stream *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("write",2,"char const *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Stream,0))){ + SWIG_fail_ptr("Stream_write",1,SWIGTYPE_p_Stream); + } + + arg2 = (char *)lua_tostring(L, 2); (arg1)->write((char const *)arg2); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2136,13 +2502,20 @@ static int _wrap_Stream_get_data(lua_State* L) { Stream *arg1 = (Stream *) 0 ; char *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(Stream *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Stream,0,1,"Stream_get_data"); + SWIG_check_num_args("get_data",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("get_data",1,"Stream *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Stream,0))){ + SWIG_fail_ptr("Stream_get_data",1,SWIGTYPE_p_Stream); + } + result = (char *)(arg1)->get_data(); SWIG_arg=0; - lua_pushstring(L,result); SWIG_arg++; + lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2162,23 +2535,35 @@ static swig_lua_attribute swig_Stream_attributes[] = { {0,0,0} }; static swig_lua_class *swig_Stream_bases[] = {0}; -swig_lua_class _wrap_class_Stream = { "Stream", &SWIGTYPE_p_Stream,_wrap_new_Stream, swig_delete_Stream, swig_Stream_methods, swig_Stream_attributes, swig_Stream_bases }; +static const char *swig_Stream_base_names[] = {0}; +static swig_lua_class _wrap_class_Stream = { "Stream", &SWIGTYPE_p_Stream,_wrap_new_Stream, swig_delete_Stream, swig_Stream_methods, swig_Stream_attributes, swig_Stream_bases, swig_Stream_base_names }; static int _wrap_Event_event_set(lua_State* L) { int SWIG_arg = -1; Event *arg1 = (Event *) 0 ; switch_event_t *arg2 = (switch_event_t *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); - arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"Event_event_set"); - arg2=(switch_event_t *)SWIG_MustGetPtr(L,2,SWIGTYPE_p_switch_event_t,0,2,"Event_event_set"); + SWIG_check_num_args("event",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("event",1,"Event *"); + if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("event",2,"switch_event_t *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ + SWIG_fail_ptr("Event_event_set",1,SWIGTYPE_p_Event); + } + + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_switch_event_t,SWIG_POINTER_DISOWN))){ + SWIG_fail_ptr("Event_event_set",2,SWIGTYPE_p_switch_event_t); + } + if (arg1) (arg1)->event = arg2; SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2190,13 +2575,20 @@ static int _wrap_Event_event_get(lua_State* L) { Event *arg1 = (Event *) 0 ; switch_event_t *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"Event_event_get"); + SWIG_check_num_args("event",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("event",1,"Event *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ + SWIG_fail_ptr("Event_event_get",1,SWIGTYPE_p_Event); + } + result = (switch_event_t *) ((arg1)->event); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_switch_event_t,0); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2208,15 +2600,20 @@ static int _wrap_Event_serialized_string_set(lua_State* L) { Event *arg1 = (Event *) 0 ; char *arg2 = (char *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"Event_serialized_string_set"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("serialized_string",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("serialized_string",1,"Event *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("serialized_string",2,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ + SWIG_fail_ptr("Event_serialized_string_set",1,SWIGTYPE_p_Event); + } + + arg2 = (char *)lua_tostring(L, 2); { if (arg1->serialized_string) delete [] arg1->serialized_string; if (arg2) { - arg1->serialized_string = (char *) (new char[strlen(arg2)+1]); - strcpy((char *) arg1->serialized_string,arg2); + arg1->serialized_string = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->serialized_string, (const char *)arg2); } else { arg1->serialized_string = 0; } @@ -2225,6 +2622,8 @@ static int _wrap_Event_serialized_string_set(lua_State* L) { return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2236,13 +2635,20 @@ static int _wrap_Event_serialized_string_get(lua_State* L) { Event *arg1 = (Event *) 0 ; char *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"Event_serialized_string_get"); + SWIG_check_num_args("serialized_string",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("serialized_string",1,"Event *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ + SWIG_fail_ptr("Event_serialized_string_get",1,SWIGTYPE_p_Event); + } + result = (char *) ((arg1)->serialized_string); SWIG_arg=0; - lua_pushstring(L,result); SWIG_arg++; + lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2254,9 +2660,14 @@ static int _wrap_Event_mine_set(lua_State* L) { Event *arg1 = (Event *) 0 ; int arg2 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isnumber(L,2)) SWIG_fail_arg(2); - arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"Event_mine_set"); + SWIG_check_num_args("mine",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("mine",1,"Event *"); + if(!lua_isnumber(L,2)) SWIG_fail_arg("mine",2,"int"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ + SWIG_fail_ptr("Event_mine_set",1,SWIGTYPE_p_Event); + } + arg2 = (int)lua_tonumber(L, 2); if (arg1) (arg1)->mine = arg2; @@ -2264,6 +2675,8 @@ static int _wrap_Event_mine_set(lua_State* L) { return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2275,13 +2688,20 @@ static int _wrap_Event_mine_get(lua_State* L) { Event *arg1 = (Event *) 0 ; int result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"Event_mine_get"); + SWIG_check_num_args("mine",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("mine",1,"Event *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ + SWIG_fail_ptr("Event_mine_get",1,SWIGTYPE_p_Event); + } + result = (int) ((arg1)->mine); SWIG_arg=0; lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2294,17 +2714,20 @@ static int _wrap_new_Event__SWIG_0(lua_State* L) { char *arg2 = (char *) NULL ; Event *result = 0 ; - if(!lua_isstring(L,1)) SWIG_fail_arg(1); - if(lua_gettop(L)>=2 && !lua_isstring(L,2)) SWIG_fail_arg(2); - arg1 = (char*)lua_tostring(L, 1); + SWIG_check_num_args("Event",1,2) + if(!lua_isstring(L,1)) SWIG_fail_arg("Event",1,"char const *"); + if(lua_gettop(L)>=2 && !lua_isstring(L,2)) SWIG_fail_arg("Event",2,"char const *"); + arg1 = (char *)lua_tostring(L, 1); if(lua_gettop(L)>=2){ - arg2 = (char*)lua_tostring(L, 2); + arg2 = (char *)lua_tostring(L, 2); } result = (Event *)new Event((char const *)arg1,(char const *)arg2); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_Event,1); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2317,9 +2740,14 @@ static int _wrap_new_Event__SWIG_1(lua_State* L) { int arg2 = (int) 0 ; Event *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(lua_gettop(L)>=2 && !lua_isnumber(L,2)) SWIG_fail_arg(2); - arg1=(switch_event_t *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_switch_event_t,0,1,"new_Event"); + SWIG_check_num_args("Event",1,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Event",1,"switch_event_t *"); + if(lua_gettop(L)>=2 && !lua_isnumber(L,2)) SWIG_fail_arg("Event",2,"int"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_switch_event_t,0))){ + SWIG_fail_ptr("new_Event",1,SWIGTYPE_p_switch_event_t); + } + if(lua_gettop(L)>=2){ arg2 = (int)lua_tonumber(L, 2); } @@ -2328,6 +2756,8 @@ static int _wrap_new_Event__SWIG_1(lua_State* L) { SWIG_NewPointerObj(L,result,SWIGTYPE_p_Event,1); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2345,7 +2775,7 @@ static int _wrap_new_Event(lua_State* L) { int _v; { void *ptr; - if (lua_isuserdata(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_switch_event_t, 0)) { + if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_switch_event_t, 0)) { _v = 0; } else { _v = 1; @@ -2390,14 +2820,21 @@ static int _wrap_delete_Event(lua_State* L) { int SWIG_arg = -1; Event *arg1 = (Event *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"delete_Event"); + SWIG_check_num_args("Event",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Event",1,"Event *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,SWIG_POINTER_DISOWN))){ + SWIG_fail_ptr("delete_Event",1,SWIGTYPE_p_Event); + } + delete arg1; SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2410,17 +2847,24 @@ static int _wrap_Event_serialize(lua_State* L) { char *arg2 = (char *) NULL ; char *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(lua_gettop(L)>=2 && !lua_isstring(L,2)) SWIG_fail_arg(2); - arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"Event_serialize"); + SWIG_check_num_args("serialize",1,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("serialize",1,"Event *"); + if(lua_gettop(L)>=2 && !lua_isstring(L,2)) SWIG_fail_arg("serialize",2,"char const *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ + SWIG_fail_ptr("Event_serialize",1,SWIGTYPE_p_Event); + } + if(lua_gettop(L)>=2){ - arg2 = (char*)lua_tostring(L, 2); + arg2 = (char *)lua_tostring(L, 2); } result = (char *)(arg1)->serialize((char const *)arg2); SWIG_arg=0; - lua_pushstring(L,result); SWIG_arg++; + lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2432,22 +2876,29 @@ static int _wrap_Event_setPriority(lua_State* L) { Event *arg1 = (Event *) 0 ; switch_priority_t arg2 = (switch_priority_t) SWITCH_PRIORITY_NORMAL ; bool result; + switch_priority_t *argp2 ; + + SWIG_check_num_args("setPriority",1,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setPriority",1,"Event *"); + if(lua_gettop(L)>=2 && !lua_isuserdata(L,2)) SWIG_fail_arg("setPriority",2,"switch_priority_t"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ + SWIG_fail_ptr("Event_setPriority",1,SWIGTYPE_p_Event); + } - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(lua_gettop(L)>=2 && !lua_isuserdata(L,2)) SWIG_fail_arg(2); - arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"Event_setPriority"); if(lua_gettop(L)>=2){ - { - switch_priority_t * argp; - if(SWIG_ConvertPtr(L,2,(void**)(&argp),SWIGTYPE_p_switch_priority_t,0)) SWIG_fail; - arg2 = *argp; + if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_switch_priority_t,0))){ + SWIG_fail_ptr("Event_setPriority",2,SWIGTYPE_p_switch_priority_t); } + arg2 = *argp2; } result = (bool)(arg1)->setPriority(arg2); SWIG_arg=0; - lua_pushboolean(L,(int)result); SWIG_arg++; + lua_pushboolean(L,(int)(result==true)); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2460,15 +2911,22 @@ static int _wrap_Event_getHeader(lua_State* L) { char *arg2 = (char *) 0 ; char *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"Event_getHeader"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("getHeader",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getHeader",1,"Event *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("getHeader",2,"char const *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ + SWIG_fail_ptr("Event_getHeader",1,SWIGTYPE_p_Event); + } + + arg2 = (char *)lua_tostring(L, 2); result = (char *)(arg1)->getHeader((char const *)arg2); SWIG_arg=0; - lua_pushstring(L,result); SWIG_arg++; + lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2480,13 +2938,20 @@ static int _wrap_Event_getBody(lua_State* L) { Event *arg1 = (Event *) 0 ; char *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"Event_getBody"); + SWIG_check_num_args("getBody",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getBody",1,"Event *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ + SWIG_fail_ptr("Event_getBody",1,SWIGTYPE_p_Event); + } + result = (char *)(arg1)->getBody(); SWIG_arg=0; - lua_pushstring(L,result); SWIG_arg++; + lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2498,13 +2963,20 @@ static int _wrap_Event_getType(lua_State* L) { Event *arg1 = (Event *) 0 ; char *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"Event_getType"); + SWIG_check_num_args("getType",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getType",1,"Event *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ + SWIG_fail_ptr("Event_getType",1,SWIGTYPE_p_Event); + } + result = (char *)(arg1)->getType(); SWIG_arg=0; - lua_pushstring(L,result); SWIG_arg++; + lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2517,15 +2989,22 @@ static int _wrap_Event_addBody(lua_State* L) { char *arg2 = (char *) 0 ; bool result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"Event_addBody"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("addBody",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("addBody",1,"Event *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("addBody",2,"char const *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ + SWIG_fail_ptr("Event_addBody",1,SWIGTYPE_p_Event); + } + + arg2 = (char *)lua_tostring(L, 2); result = (bool)(arg1)->addBody((char const *)arg2); SWIG_arg=0; - lua_pushboolean(L,(int)result); SWIG_arg++; + lua_pushboolean(L,(int)(result==true)); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2539,17 +3018,24 @@ static int _wrap_Event_addHeader(lua_State* L) { char *arg3 = (char *) 0 ; bool result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - if(!lua_isstring(L,3)) SWIG_fail_arg(3); - arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"Event_addHeader"); - arg2 = (char*)lua_tostring(L, 2); - arg3 = (char*)lua_tostring(L, 3); + SWIG_check_num_args("addHeader",3,3) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("addHeader",1,"Event *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("addHeader",2,"char const *"); + if(!lua_isstring(L,3)) SWIG_fail_arg("addHeader",3,"char const *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ + SWIG_fail_ptr("Event_addHeader",1,SWIGTYPE_p_Event); + } + + arg2 = (char *)lua_tostring(L, 2); + arg3 = (char *)lua_tostring(L, 3); result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3); SWIG_arg=0; - lua_pushboolean(L,(int)result); SWIG_arg++; + lua_pushboolean(L,(int)(result==true)); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2562,15 +3048,22 @@ static int _wrap_Event_delHeader(lua_State* L) { char *arg2 = (char *) 0 ; bool result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"Event_delHeader"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("delHeader",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("delHeader",1,"Event *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("delHeader",2,"char const *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ + SWIG_fail_ptr("Event_delHeader",1,SWIGTYPE_p_Event); + } + + arg2 = (char *)lua_tostring(L, 2); result = (bool)(arg1)->delHeader((char const *)arg2); SWIG_arg=0; - lua_pushboolean(L,(int)result); SWIG_arg++; + lua_pushboolean(L,(int)(result==true)); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2582,13 +3075,20 @@ static int _wrap_Event_fire(lua_State* L) { Event *arg1 = (Event *) 0 ; bool result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"Event_fire"); + SWIG_check_num_args("fire",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("fire",1,"Event *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ + SWIG_fail_ptr("Event_fire",1,SWIGTYPE_p_Event); + } + result = (bool)(arg1)->fire(); SWIG_arg=0; - lua_pushboolean(L,(int)result); SWIG_arg++; + lua_pushboolean(L,(int)(result==true)); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2612,29 +3112,41 @@ static swig_lua_method swig_Event_methods[] = { {0,0} }; static swig_lua_attribute swig_Event_attributes[] = { - { "event",_wrap_Event_event_get, _wrap_Event_event_set}, - { "serialized_string",_wrap_Event_serialized_string_get, _wrap_Event_serialized_string_set}, - { "mine",_wrap_Event_mine_get, _wrap_Event_mine_set}, + { "event", _wrap_Event_event_get, _wrap_Event_event_set}, + { "serialized_string", _wrap_Event_serialized_string_get, _wrap_Event_serialized_string_set}, + { "mine", _wrap_Event_mine_get, _wrap_Event_mine_set}, {0,0,0} }; static swig_lua_class *swig_Event_bases[] = {0}; -swig_lua_class _wrap_class_Event = { "Event", &SWIGTYPE_p_Event,_wrap_new_Event, swig_delete_Event, swig_Event_methods, swig_Event_attributes, swig_Event_bases }; +static const char *swig_Event_base_names[] = {0}; +static swig_lua_class _wrap_class_Event = { "Event", &SWIGTYPE_p_Event,_wrap_new_Event, swig_delete_Event, swig_Event_methods, swig_Event_attributes, swig_Event_bases, swig_Event_base_names }; static int _wrap_EventConsumer_events_set(lua_State* L) { int SWIG_arg = -1; EventConsumer *arg1 = (EventConsumer *) 0 ; switch_queue_t *arg2 = (switch_queue_t *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); - arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_events_set"); - arg2=(switch_queue_t *)SWIG_MustGetPtr(L,2,SWIGTYPE_p_switch_queue_t,0,2,"EventConsumer_events_set"); + SWIG_check_num_args("events",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("events",1,"EventConsumer *"); + if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("events",2,"switch_queue_t *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ + SWIG_fail_ptr("EventConsumer_events_set",1,SWIGTYPE_p_EventConsumer); + } + + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_switch_queue_t,SWIG_POINTER_DISOWN))){ + SWIG_fail_ptr("EventConsumer_events_set",2,SWIGTYPE_p_switch_queue_t); + } + if (arg1) (arg1)->events = arg2; SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2646,13 +3158,20 @@ static int _wrap_EventConsumer_events_get(lua_State* L) { EventConsumer *arg1 = (EventConsumer *) 0 ; switch_queue_t *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_events_get"); + SWIG_check_num_args("events",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("events",1,"EventConsumer *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ + SWIG_fail_ptr("EventConsumer_events_get",1,SWIGTYPE_p_EventConsumer); + } + result = (switch_queue_t *) ((arg1)->events); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_switch_queue_t,0); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2663,21 +3182,30 @@ static int _wrap_EventConsumer_e_event_id_set(lua_State* L) { int SWIG_arg = -1; EventConsumer *arg1 = (EventConsumer *) 0 ; switch_event_types_t arg2 ; + switch_event_types_t *argp2 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); - arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_e_event_id_set"); - { - switch_event_types_t * argp; - if(SWIG_ConvertPtr(L,2,(void**)(&argp),SWIGTYPE_p_switch_event_types_t,0)) SWIG_fail; - arg2 = *argp; + SWIG_check_num_args("e_event_id",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_event_id",1,"EventConsumer *"); + if(!lua_isuserdata(L,2)) SWIG_fail_arg("e_event_id",2,"switch_event_types_t"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ + SWIG_fail_ptr("EventConsumer_e_event_id_set",1,SWIGTYPE_p_EventConsumer); } + + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_switch_event_types_t,0))){ + SWIG_fail_ptr("EventConsumer_e_event_id_set",2,SWIGTYPE_p_switch_event_types_t); + } + arg2 = *argp2; + if (arg1) (arg1)->e_event_id = arg2; SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2689,17 +3217,23 @@ static int _wrap_EventConsumer_e_event_id_get(lua_State* L) { EventConsumer *arg1 = (EventConsumer *) 0 ; switch_event_types_t result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_e_event_id_get"); + SWIG_check_num_args("e_event_id",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_event_id",1,"EventConsumer *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ + SWIG_fail_ptr("EventConsumer_e_event_id_get",1,SWIGTYPE_p_EventConsumer); + } + result = ((arg1)->e_event_id); SWIG_arg=0; { - switch_event_types_t * resultptr; - resultptr = new switch_event_types_t((switch_event_types_t &) result); + switch_event_types_t * resultptr = new switch_event_types_t((switch_event_types_t &) result); SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_event_types_t,1); SWIG_arg++; } return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2711,15 +3245,20 @@ static int _wrap_EventConsumer_e_callback_set(lua_State* L) { EventConsumer *arg1 = (EventConsumer *) 0 ; char *arg2 = (char *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_e_callback_set"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("e_callback",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_callback",1,"EventConsumer *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("e_callback",2,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ + SWIG_fail_ptr("EventConsumer_e_callback_set",1,SWIGTYPE_p_EventConsumer); + } + + arg2 = (char *)lua_tostring(L, 2); { if (arg1->e_callback) delete [] arg1->e_callback; if (arg2) { - arg1->e_callback = (char *) (new char[strlen(arg2)+1]); - strcpy((char *) arg1->e_callback,arg2); + arg1->e_callback = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->e_callback, (const char *)arg2); } else { arg1->e_callback = 0; } @@ -2728,6 +3267,8 @@ static int _wrap_EventConsumer_e_callback_set(lua_State* L) { return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2739,13 +3280,20 @@ static int _wrap_EventConsumer_e_callback_get(lua_State* L) { EventConsumer *arg1 = (EventConsumer *) 0 ; char *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_e_callback_get"); + SWIG_check_num_args("e_callback",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_callback",1,"EventConsumer *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ + SWIG_fail_ptr("EventConsumer_e_callback_get",1,SWIGTYPE_p_EventConsumer); + } + result = (char *) ((arg1)->e_callback); SWIG_arg=0; - lua_pushstring(L,result); SWIG_arg++; + lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2757,15 +3305,20 @@ static int _wrap_EventConsumer_e_subclass_name_set(lua_State* L) { EventConsumer *arg1 = (EventConsumer *) 0 ; char *arg2 = (char *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_e_subclass_name_set"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("e_subclass_name",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_subclass_name",1,"EventConsumer *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("e_subclass_name",2,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ + SWIG_fail_ptr("EventConsumer_e_subclass_name_set",1,SWIGTYPE_p_EventConsumer); + } + + arg2 = (char *)lua_tostring(L, 2); { if (arg1->e_subclass_name) delete [] arg1->e_subclass_name; if (arg2) { - arg1->e_subclass_name = (char *) (new char[strlen(arg2)+1]); - strcpy((char *) arg1->e_subclass_name,arg2); + arg1->e_subclass_name = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->e_subclass_name, (const char *)arg2); } else { arg1->e_subclass_name = 0; } @@ -2774,6 +3327,8 @@ static int _wrap_EventConsumer_e_subclass_name_set(lua_State* L) { return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2785,13 +3340,20 @@ static int _wrap_EventConsumer_e_subclass_name_get(lua_State* L) { EventConsumer *arg1 = (EventConsumer *) 0 ; char *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_e_subclass_name_get"); + SWIG_check_num_args("e_subclass_name",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_subclass_name",1,"EventConsumer *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ + SWIG_fail_ptr("EventConsumer_e_subclass_name_get",1,SWIGTYPE_p_EventConsumer); + } + result = (char *) ((arg1)->e_subclass_name); SWIG_arg=0; - lua_pushstring(L,result); SWIG_arg++; + lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2803,15 +3365,20 @@ static int _wrap_EventConsumer_e_cb_arg_set(lua_State* L) { EventConsumer *arg1 = (EventConsumer *) 0 ; char *arg2 = (char *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_e_cb_arg_set"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("e_cb_arg",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_cb_arg",1,"EventConsumer *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("e_cb_arg",2,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ + SWIG_fail_ptr("EventConsumer_e_cb_arg_set",1,SWIGTYPE_p_EventConsumer); + } + + arg2 = (char *)lua_tostring(L, 2); { if (arg1->e_cb_arg) delete [] arg1->e_cb_arg; if (arg2) { - arg1->e_cb_arg = (char *) (new char[strlen(arg2)+1]); - strcpy((char *) arg1->e_cb_arg,arg2); + arg1->e_cb_arg = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->e_cb_arg, (const char *)arg2); } else { arg1->e_cb_arg = 0; } @@ -2820,6 +3387,8 @@ static int _wrap_EventConsumer_e_cb_arg_set(lua_State* L) { return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2831,13 +3400,20 @@ static int _wrap_EventConsumer_e_cb_arg_get(lua_State* L) { EventConsumer *arg1 = (EventConsumer *) 0 ; char *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_e_cb_arg_get"); + SWIG_check_num_args("e_cb_arg",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_cb_arg",1,"EventConsumer *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ + SWIG_fail_ptr("EventConsumer_e_cb_arg_get",1,SWIGTYPE_p_EventConsumer); + } + result = (char *) ((arg1)->e_cb_arg); SWIG_arg=0; - lua_pushstring(L,result); SWIG_arg++; + lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2849,10 +3425,19 @@ static int _wrap_EventConsumer_enodes_set(lua_State* L) { EventConsumer *arg1 = (EventConsumer *) 0 ; switch_event_node_t **arg2 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); - arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_enodes_set"); - arg2=(switch_event_node_t **)SWIG_MustGetPtr(L,2,SWIGTYPE_p_p_switch_event_node_t,0,2,"EventConsumer_enodes_set"); + SWIG_check_num_args("enodes",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("enodes",1,"EventConsumer *"); + if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("enodes",2,"switch_event_node_t *[SWITCH_EVENT_ALL+1]"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ + SWIG_fail_ptr("EventConsumer_enodes_set",1,SWIGTYPE_p_EventConsumer); + } + + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_p_switch_event_node_t,0))){ + SWIG_fail_ptr("EventConsumer_enodes_set",2,SWIGTYPE_p_p_switch_event_node_t); + } + { size_t ii; switch_event_node_t * *b = (switch_event_node_t * *) arg1->enodes; @@ -2862,6 +3447,8 @@ static int _wrap_EventConsumer_enodes_set(lua_State* L) { return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2873,13 +3460,20 @@ static int _wrap_EventConsumer_enodes_get(lua_State* L) { EventConsumer *arg1 = (EventConsumer *) 0 ; switch_event_node_t **result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_enodes_get"); + SWIG_check_num_args("enodes",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("enodes",1,"EventConsumer *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ + SWIG_fail_ptr("EventConsumer_enodes_get",1,SWIGTYPE_p_EventConsumer); + } + result = (switch_event_node_t **)(switch_event_node_t **) ((arg1)->enodes); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_p_switch_event_node_t,0); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2890,21 +3484,30 @@ static int _wrap_EventConsumer_node_index_set(lua_State* L) { int SWIG_arg = -1; EventConsumer *arg1 = (EventConsumer *) 0 ; uint32_t arg2 ; + uint32_t *argp2 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); - arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_node_index_set"); - { - uint32_t * argp; - if(SWIG_ConvertPtr(L,2,(void**)(&argp),SWIGTYPE_p_uint32_t,0)) SWIG_fail; - arg2 = *argp; + SWIG_check_num_args("node_index",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("node_index",1,"EventConsumer *"); + if(!lua_isuserdata(L,2)) SWIG_fail_arg("node_index",2,"uint32_t"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ + SWIG_fail_ptr("EventConsumer_node_index_set",1,SWIGTYPE_p_EventConsumer); + } + + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_uint32_t,0))){ + SWIG_fail_ptr("EventConsumer_node_index_set",2,SWIGTYPE_p_uint32_t); } + arg2 = *argp2; + if (arg1) (arg1)->node_index = arg2; SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2916,17 +3519,23 @@ static int _wrap_EventConsumer_node_index_get(lua_State* L) { EventConsumer *arg1 = (EventConsumer *) 0 ; uint32_t result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_node_index_get"); + SWIG_check_num_args("node_index",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("node_index",1,"EventConsumer *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ + SWIG_fail_ptr("EventConsumer_node_index_get",1,SWIGTYPE_p_EventConsumer); + } + result = ((arg1)->node_index); SWIG_arg=0; { - uint32_t * resultptr; - resultptr = new uint32_t((uint32_t &) result); + uint32_t * resultptr = new uint32_t((uint32_t &) result); SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_uint32_t,1); SWIG_arg++; } return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2939,19 +3548,22 @@ static int _wrap_new_EventConsumer(lua_State* L) { char *arg2 = (char *) "" ; EventConsumer *result = 0 ; - if(lua_gettop(L)>=1 && !lua_isstring(L,1)) SWIG_fail_arg(1); - if(lua_gettop(L)>=2 && !lua_isstring(L,2)) SWIG_fail_arg(2); + SWIG_check_num_args("EventConsumer",0,2) + if(lua_gettop(L)>=1 && !lua_isstring(L,1)) SWIG_fail_arg("EventConsumer",1,"char const *"); + if(lua_gettop(L)>=2 && !lua_isstring(L,2)) SWIG_fail_arg("EventConsumer",2,"char const *"); if(lua_gettop(L)>=1){ - arg1 = (char*)lua_tostring(L, 1); + arg1 = (char *)lua_tostring(L, 1); } if(lua_gettop(L)>=2){ - arg2 = (char*)lua_tostring(L, 2); + arg2 = (char *)lua_tostring(L, 2); } result = (EventConsumer *)new EventConsumer((char const *)arg1,(char const *)arg2); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_EventConsumer,1); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2962,14 +3574,21 @@ static int _wrap_delete_EventConsumer(lua_State* L) { int SWIG_arg = -1; EventConsumer *arg1 = (EventConsumer *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"delete_EventConsumer"); + SWIG_check_num_args("EventConsumer",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("EventConsumer",1,"EventConsumer *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,SWIG_POINTER_DISOWN))){ + SWIG_fail_ptr("delete_EventConsumer",1,SWIGTYPE_p_EventConsumer); + } + delete arg1; SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -2983,19 +3602,26 @@ static int _wrap_EventConsumer_bind(lua_State* L) { char *arg3 = (char *) "" ; int result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - if(lua_gettop(L)>=3 && !lua_isstring(L,3)) SWIG_fail_arg(3); - arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_bind"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("bind",2,3) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("bind",1,"EventConsumer *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("bind",2,"char const *"); + if(lua_gettop(L)>=3 && !lua_isstring(L,3)) SWIG_fail_arg("bind",3,"char const *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ + SWIG_fail_ptr("EventConsumer_bind",1,SWIGTYPE_p_EventConsumer); + } + + arg2 = (char *)lua_tostring(L, 2); if(lua_gettop(L)>=3){ - arg3 = (char*)lua_tostring(L, 3); + arg3 = (char *)lua_tostring(L, 3); } result = (int)(arg1)->bind((char const *)arg2,(char const *)arg3); SWIG_arg=0; lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3008,9 +3634,14 @@ static int _wrap_EventConsumer_pop(lua_State* L) { int arg2 = (int) 0 ; Event *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(lua_gettop(L)>=2 && !lua_isnumber(L,2)) SWIG_fail_arg(2); - arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_pop"); + SWIG_check_num_args("pop",1,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("pop",1,"EventConsumer *"); + if(lua_gettop(L)>=2 && !lua_isnumber(L,2)) SWIG_fail_arg("pop",2,"int"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ + SWIG_fail_ptr("EventConsumer_pop",1,SWIGTYPE_p_EventConsumer); + } + if(lua_gettop(L)>=2){ arg2 = (int)lua_tonumber(L, 2); } @@ -3019,6 +3650,8 @@ static int _wrap_EventConsumer_pop(lua_State* L) { SWIG_NewPointerObj(L,result,SWIGTYPE_p_Event,1); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3035,30 +3668,38 @@ static swig_lua_method swig_EventConsumer_methods[] = { {0,0} }; static swig_lua_attribute swig_EventConsumer_attributes[] = { - { "events",_wrap_EventConsumer_events_get, _wrap_EventConsumer_events_set}, - { "e_event_id",_wrap_EventConsumer_e_event_id_get, _wrap_EventConsumer_e_event_id_set}, - { "e_callback",_wrap_EventConsumer_e_callback_get, _wrap_EventConsumer_e_callback_set}, - { "e_subclass_name",_wrap_EventConsumer_e_subclass_name_get, _wrap_EventConsumer_e_subclass_name_set}, - { "e_cb_arg",_wrap_EventConsumer_e_cb_arg_get, _wrap_EventConsumer_e_cb_arg_set}, - { "enodes",_wrap_EventConsumer_enodes_get, _wrap_EventConsumer_enodes_set}, - { "node_index",_wrap_EventConsumer_node_index_get, _wrap_EventConsumer_node_index_set}, + { "events", _wrap_EventConsumer_events_get, _wrap_EventConsumer_events_set}, + { "e_event_id", _wrap_EventConsumer_e_event_id_get, _wrap_EventConsumer_e_event_id_set}, + { "e_callback", _wrap_EventConsumer_e_callback_get, _wrap_EventConsumer_e_callback_set}, + { "e_subclass_name", _wrap_EventConsumer_e_subclass_name_get, _wrap_EventConsumer_e_subclass_name_set}, + { "e_cb_arg", _wrap_EventConsumer_e_cb_arg_get, _wrap_EventConsumer_e_cb_arg_set}, + { "enodes", _wrap_EventConsumer_enodes_get, _wrap_EventConsumer_enodes_set}, + { "node_index", _wrap_EventConsumer_node_index_get, _wrap_EventConsumer_node_index_set}, {0,0,0} }; static swig_lua_class *swig_EventConsumer_bases[] = {0}; -swig_lua_class _wrap_class_EventConsumer = { "EventConsumer", &SWIGTYPE_p_EventConsumer,_wrap_new_EventConsumer, swig_delete_EventConsumer, swig_EventConsumer_methods, swig_EventConsumer_attributes, swig_EventConsumer_bases }; +static const char *swig_EventConsumer_base_names[] = {0}; +static swig_lua_class _wrap_class_EventConsumer = { "EventConsumer", &SWIGTYPE_p_EventConsumer,_wrap_new_EventConsumer, swig_delete_EventConsumer, swig_EventConsumer_methods, swig_EventConsumer_attributes, swig_EventConsumer_bases, swig_EventConsumer_base_names }; static int _wrap_delete_CoreSession(lua_State* L) { int SWIG_arg = -1; CoreSession *arg1 = (CoreSession *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"delete_CoreSession"); + SWIG_check_num_args("CoreSession",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("CoreSession",1,"CoreSession *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,SWIG_POINTER_DISOWN))){ + SWIG_fail_ptr("delete_CoreSession",1,SWIGTYPE_p_CoreSession); + } + delete arg1; SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3070,16 +3711,27 @@ static int _wrap_CoreSession_session_set(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; switch_core_session_t *arg2 = (switch_core_session_t *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_session_set"); - arg2=(switch_core_session_t *)SWIG_MustGetPtr(L,2,SWIGTYPE_p_switch_core_session_t,0,2,"CoreSession_session_set"); + SWIG_check_num_args("session",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("session",1,"CoreSession *"); + if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("session",2,"switch_core_session_t *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_session_set",1,SWIGTYPE_p_CoreSession); + } + + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_switch_core_session_t,SWIG_POINTER_DISOWN))){ + SWIG_fail_ptr("CoreSession_session_set",2,SWIGTYPE_p_switch_core_session_t); + } + if (arg1) (arg1)->session = arg2; SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3091,13 +3743,20 @@ static int _wrap_CoreSession_session_get(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; switch_core_session_t *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_session_get"); + SWIG_check_num_args("session",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("session",1,"CoreSession *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_session_get",1,SWIGTYPE_p_CoreSession); + } + result = (switch_core_session_t *) ((arg1)->session); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_switch_core_session_t,0); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3109,16 +3768,27 @@ static int _wrap_CoreSession_channel_set(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; switch_channel_t *arg2 = (switch_channel_t *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_channel_set"); - arg2=(switch_channel_t *)SWIG_MustGetPtr(L,2,SWIGTYPE_p_switch_channel_t,0,2,"CoreSession_channel_set"); + SWIG_check_num_args("channel",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("channel",1,"CoreSession *"); + if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("channel",2,"switch_channel_t *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_channel_set",1,SWIGTYPE_p_CoreSession); + } + + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_switch_channel_t,SWIG_POINTER_DISOWN))){ + SWIG_fail_ptr("CoreSession_channel_set",2,SWIGTYPE_p_switch_channel_t); + } + if (arg1) (arg1)->channel = arg2; SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3130,13 +3800,20 @@ static int _wrap_CoreSession_channel_get(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; switch_channel_t *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_channel_get"); + SWIG_check_num_args("channel",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("channel",1,"CoreSession *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_channel_get",1,SWIGTYPE_p_CoreSession); + } + result = (switch_channel_t *) ((arg1)->channel); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_switch_channel_t,0); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3148,9 +3825,14 @@ static int _wrap_CoreSession_flags_set(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; unsigned int arg2 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isnumber(L,2)) SWIG_fail_arg(2); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_flags_set"); + SWIG_check_num_args("flags",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("flags",1,"CoreSession *"); + if(!lua_isnumber(L,2)) SWIG_fail_arg("flags",2,"unsigned int"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_flags_set",1,SWIGTYPE_p_CoreSession); + } + arg2 = (unsigned int)lua_tonumber(L, 2); if (arg1) (arg1)->flags = arg2; @@ -3158,6 +3840,8 @@ static int _wrap_CoreSession_flags_set(lua_State* L) { return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3169,13 +3853,20 @@ static int _wrap_CoreSession_flags_get(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; unsigned int result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_flags_get"); + SWIG_check_num_args("flags",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("flags",1,"CoreSession *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_flags_get",1,SWIGTYPE_p_CoreSession); + } + result = (unsigned int) ((arg1)->flags); SWIG_arg=0; lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3187,9 +3878,14 @@ static int _wrap_CoreSession_allocated_set(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; int arg2 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isnumber(L,2)) SWIG_fail_arg(2); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_allocated_set"); + SWIG_check_num_args("allocated",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("allocated",1,"CoreSession *"); + if(!lua_isnumber(L,2)) SWIG_fail_arg("allocated",2,"int"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_allocated_set",1,SWIGTYPE_p_CoreSession); + } + arg2 = (int)lua_tonumber(L, 2); if (arg1) (arg1)->allocated = arg2; @@ -3197,6 +3893,8 @@ static int _wrap_CoreSession_allocated_set(lua_State* L) { return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3208,13 +3906,20 @@ static int _wrap_CoreSession_allocated_get(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; int result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_allocated_get"); + SWIG_check_num_args("allocated",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("allocated",1,"CoreSession *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_allocated_get",1,SWIGTYPE_p_CoreSession); + } + result = (int) ((arg1)->allocated); SWIG_arg=0; lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3226,16 +3931,27 @@ static int _wrap_CoreSession_cb_state_set(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; input_callback_state *arg2 = (input_callback_state *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_cb_state_set"); - arg2=(input_callback_state *)SWIG_MustGetPtr(L,2,SWIGTYPE_p_input_callback_state,0,2,"CoreSession_cb_state_set"); + SWIG_check_num_args("cb_state",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cb_state",1,"CoreSession *"); + if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("cb_state",2,"input_callback_state *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_cb_state_set",1,SWIGTYPE_p_CoreSession); + } + + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_input_callback_state,0))){ + SWIG_fail_ptr("CoreSession_cb_state_set",2,SWIGTYPE_p_input_callback_state); + } + if (arg1) (arg1)->cb_state = *arg2; SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3247,13 +3963,20 @@ static int _wrap_CoreSession_cb_state_get(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; input_callback_state *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_cb_state_get"); + SWIG_check_num_args("cb_state",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cb_state",1,"CoreSession *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_cb_state_get",1,SWIGTYPE_p_CoreSession); + } + result = (input_callback_state *)& ((arg1)->cb_state); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_input_callback_state,0); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3264,21 +3987,30 @@ static int _wrap_CoreSession_hook_state_set(lua_State* L) { int SWIG_arg = -1; CoreSession *arg1 = (CoreSession *) 0 ; switch_channel_state_t arg2 ; + switch_channel_state_t *argp2 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_hook_state_set"); - { - switch_channel_state_t * argp; - if(SWIG_ConvertPtr(L,2,(void**)(&argp),SWIGTYPE_p_switch_channel_state_t,0)) SWIG_fail; - arg2 = *argp; + SWIG_check_num_args("hook_state",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hook_state",1,"CoreSession *"); + if(!lua_isuserdata(L,2)) SWIG_fail_arg("hook_state",2,"switch_channel_state_t"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_hook_state_set",1,SWIGTYPE_p_CoreSession); + } + + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_switch_channel_state_t,0))){ + SWIG_fail_ptr("CoreSession_hook_state_set",2,SWIGTYPE_p_switch_channel_state_t); } + arg2 = *argp2; + if (arg1) (arg1)->hook_state = arg2; SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3290,17 +4022,23 @@ static int _wrap_CoreSession_hook_state_get(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; switch_channel_state_t result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_hook_state_get"); + SWIG_check_num_args("hook_state",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hook_state",1,"CoreSession *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_hook_state_get",1,SWIGTYPE_p_CoreSession); + } + result = ((arg1)->hook_state); SWIG_arg=0; { - switch_channel_state_t * resultptr; - resultptr = new switch_channel_state_t((switch_channel_state_t &) result); + switch_channel_state_t * resultptr = new switch_channel_state_t((switch_channel_state_t &) result); SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_channel_state_t,1); SWIG_arg++; } return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3311,21 +4049,30 @@ static int _wrap_CoreSession_cause_set(lua_State* L) { int SWIG_arg = -1; CoreSession *arg1 = (CoreSession *) 0 ; switch_call_cause_t arg2 ; + switch_call_cause_t *argp2 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_cause_set"); - { - switch_call_cause_t * argp; - if(SWIG_ConvertPtr(L,2,(void**)(&argp),SWIGTYPE_p_switch_call_cause_t,0)) SWIG_fail; - arg2 = *argp; + SWIG_check_num_args("cause",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cause",1,"CoreSession *"); + if(!lua_isuserdata(L,2)) SWIG_fail_arg("cause",2,"switch_call_cause_t"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_cause_set",1,SWIGTYPE_p_CoreSession); + } + + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_switch_call_cause_t,0))){ + SWIG_fail_ptr("CoreSession_cause_set",2,SWIGTYPE_p_switch_call_cause_t); } + arg2 = *argp2; + if (arg1) (arg1)->cause = arg2; SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3337,17 +4084,23 @@ static int _wrap_CoreSession_cause_get(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; switch_call_cause_t result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_cause_get"); + SWIG_check_num_args("cause",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cause",1,"CoreSession *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_cause_get",1,SWIGTYPE_p_CoreSession); + } + result = ((arg1)->cause); SWIG_arg=0; { - switch_call_cause_t * resultptr; - resultptr = new switch_call_cause_t((switch_call_cause_t &) result); + switch_call_cause_t * resultptr = new switch_call_cause_t((switch_call_cause_t &) result); SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_call_cause_t,1); SWIG_arg++; } return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3359,15 +4112,20 @@ static int _wrap_CoreSession_uuid_set(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; char *arg2 = (char *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_uuid_set"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("uuid",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("uuid",1,"CoreSession *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("uuid",2,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_uuid_set",1,SWIGTYPE_p_CoreSession); + } + + arg2 = (char *)lua_tostring(L, 2); { if (arg1->uuid) delete [] arg1->uuid; if (arg2) { - arg1->uuid = (char *) (new char[strlen(arg2)+1]); - strcpy((char *) arg1->uuid,arg2); + arg1->uuid = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->uuid, (const char *)arg2); } else { arg1->uuid = 0; } @@ -3376,6 +4134,8 @@ static int _wrap_CoreSession_uuid_set(lua_State* L) { return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3387,13 +4147,20 @@ static int _wrap_CoreSession_uuid_get(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; char *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_uuid_get"); + SWIG_check_num_args("uuid",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("uuid",1,"CoreSession *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_uuid_get",1,SWIGTYPE_p_CoreSession); + } + result = (char *) ((arg1)->uuid); SWIG_arg=0; - lua_pushstring(L,result); SWIG_arg++; + lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3405,15 +4172,20 @@ static int _wrap_CoreSession_tts_name_set(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; char *arg2 = (char *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_tts_name_set"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("tts_name",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("tts_name",1,"CoreSession *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("tts_name",2,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_tts_name_set",1,SWIGTYPE_p_CoreSession); + } + + arg2 = (char *)lua_tostring(L, 2); { if (arg1->tts_name) delete [] arg1->tts_name; if (arg2) { - arg1->tts_name = (char *) (new char[strlen(arg2)+1]); - strcpy((char *) arg1->tts_name,arg2); + arg1->tts_name = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->tts_name, (const char *)arg2); } else { arg1->tts_name = 0; } @@ -3422,6 +4194,8 @@ static int _wrap_CoreSession_tts_name_set(lua_State* L) { return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3433,13 +4207,20 @@ static int _wrap_CoreSession_tts_name_get(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; char *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_tts_name_get"); + SWIG_check_num_args("tts_name",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("tts_name",1,"CoreSession *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_tts_name_get",1,SWIGTYPE_p_CoreSession); + } + result = (char *) ((arg1)->tts_name); SWIG_arg=0; - lua_pushstring(L,result); SWIG_arg++; + lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3451,15 +4232,20 @@ static int _wrap_CoreSession_voice_name_set(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; char *arg2 = (char *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_voice_name_set"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("voice_name",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("voice_name",1,"CoreSession *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("voice_name",2,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_voice_name_set",1,SWIGTYPE_p_CoreSession); + } + + arg2 = (char *)lua_tostring(L, 2); { if (arg1->voice_name) delete [] arg1->voice_name; if (arg2) { - arg1->voice_name = (char *) (new char[strlen(arg2)+1]); - strcpy((char *) arg1->voice_name,arg2); + arg1->voice_name = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->voice_name, (const char *)arg2); } else { arg1->voice_name = 0; } @@ -3468,6 +4254,8 @@ static int _wrap_CoreSession_voice_name_set(lua_State* L) { return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3479,13 +4267,20 @@ static int _wrap_CoreSession_voice_name_get(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; char *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_voice_name_get"); + SWIG_check_num_args("voice_name",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("voice_name",1,"CoreSession *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_voice_name_get",1,SWIGTYPE_p_CoreSession); + } + result = (char *) ((arg1)->voice_name); SWIG_arg=0; - lua_pushstring(L,result); SWIG_arg++; + lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3497,13 +4292,20 @@ static int _wrap_CoreSession_answer(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; int result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_answer"); + SWIG_check_num_args("answer",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("answer",1,"CoreSession *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_answer",1,SWIGTYPE_p_CoreSession); + } + result = (int)(arg1)->answer(); SWIG_arg=0; lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3515,13 +4317,20 @@ static int _wrap_CoreSession_preAnswer(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; int result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_preAnswer"); + SWIG_check_num_args("preAnswer",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("preAnswer",1,"CoreSession *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_preAnswer",1,SWIGTYPE_p_CoreSession); + } + result = (int)(arg1)->preAnswer(); SWIG_arg=0; lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3533,17 +4342,24 @@ static int _wrap_CoreSession_hangup(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; char *arg2 = (char *) "normal_clearing" ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(lua_gettop(L)>=2 && !lua_isstring(L,2)) SWIG_fail_arg(2); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_hangup"); + SWIG_check_num_args("hangup",1,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangup",1,"CoreSession *"); + if(lua_gettop(L)>=2 && !lua_isstring(L,2)) SWIG_fail_arg("hangup",2,"char const *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_hangup",1,SWIGTYPE_p_CoreSession); + } + if(lua_gettop(L)>=2){ - arg2 = (char*)lua_tostring(L, 2); + arg2 = (char *)lua_tostring(L, 2); } (arg1)->hangup((char const *)arg2); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3554,13 +4370,20 @@ static int _wrap_CoreSession_hangupState(lua_State* L) { int SWIG_arg = -1; CoreSession *arg1 = (CoreSession *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_hangupState"); + SWIG_check_num_args("hangupState",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangupState",1,"CoreSession *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_hangupState",1,SWIGTYPE_p_CoreSession); + } + (arg1)->hangupState(); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3573,17 +4396,24 @@ static int _wrap_CoreSession_setVariable(lua_State* L) { char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - if(!lua_isstring(L,3)) SWIG_fail_arg(3); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_setVariable"); - arg2 = (char*)lua_tostring(L, 2); - arg3 = (char*)lua_tostring(L, 3); + SWIG_check_num_args("setVariable",3,3) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setVariable",1,"CoreSession *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("setVariable",2,"char *"); + if(!lua_isstring(L,3)) SWIG_fail_arg("setVariable",3,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_setVariable",1,SWIGTYPE_p_CoreSession); + } + + arg2 = (char *)lua_tostring(L, 2); + arg3 = (char *)lua_tostring(L, 3); (arg1)->setVariable(arg2,arg3); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3596,17 +4426,24 @@ static int _wrap_CoreSession_setPrivate(lua_State* L) { char *arg2 = (char *) 0 ; void *arg3 = (void *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - if(!lua_isuserdata(L,3)) SWIG_fail_arg(3); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_setPrivate"); - arg2 = (char*)lua_tostring(L, 2); - arg3=((swig_lua_userdata*)(lua_touserdata(L,3)))->ptr; + SWIG_check_num_args("setPrivate",3,3) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setPrivate",1,"CoreSession *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("setPrivate",2,"char *"); + if(!SWIG_isptrtype(L,3)) SWIG_fail_arg("setPrivate",3,"void *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_setPrivate",1,SWIGTYPE_p_CoreSession); + } + + arg2 = (char *)lua_tostring(L, 2); + arg3=(void *)SWIG_MustGetPtr(L,3,0,0,3,"CoreSession_setPrivate"); (arg1)->setPrivate(arg2,arg3); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3619,15 +4456,22 @@ static int _wrap_CoreSession_getPrivate(lua_State* L) { char *arg2 = (char *) 0 ; void *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_getPrivate"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("getPrivate",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getPrivate",1,"CoreSession *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("getPrivate",2,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_getPrivate",1,SWIGTYPE_p_CoreSession); + } + + arg2 = (char *)lua_tostring(L, 2); result = (void *)(arg1)->getPrivate(arg2); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_void,0); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3640,15 +4484,22 @@ static int _wrap_CoreSession_getVariable(lua_State* L) { char *arg2 = (char *) 0 ; char *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_getVariable"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("getVariable",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getVariable",1,"CoreSession *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("getVariable",2,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_getVariable",1,SWIGTYPE_p_CoreSession); + } + + arg2 = (char *)lua_tostring(L, 2); result = (char *)(arg1)->getVariable(arg2); SWIG_arg=0; - lua_pushstring(L,result); SWIG_arg++; + lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3661,19 +4512,25 @@ static int _wrap_CoreSession_process_callback_result(lua_State* L) { char *arg2 = (char *) 0 ; switch_status_t result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_process_callback_result"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("process_callback_result",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("process_callback_result",1,"CoreSession *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("process_callback_result",2,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_process_callback_result",1,SWIGTYPE_p_CoreSession); + } + + arg2 = (char *)lua_tostring(L, 2); result = (arg1)->process_callback_result(arg2); SWIG_arg=0; { - switch_status_t * resultptr; - resultptr = new switch_status_t((switch_status_t &) result); + switch_status_t * resultptr = new switch_status_t((switch_status_t &) result); SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_status_t,1); SWIG_arg++; } return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3689,25 +4546,32 @@ static int _wrap_CoreSession_say(lua_State* L) { char *arg5 = (char *) 0 ; char *arg6 = (char *) NULL ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - if(!lua_isstring(L,3)) SWIG_fail_arg(3); - if(!lua_isstring(L,4)) SWIG_fail_arg(4); - if(!lua_isstring(L,5)) SWIG_fail_arg(5); - if(lua_gettop(L)>=6 && !lua_isstring(L,6)) SWIG_fail_arg(6); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_say"); - arg2 = (char*)lua_tostring(L, 2); - arg3 = (char*)lua_tostring(L, 3); - arg4 = (char*)lua_tostring(L, 4); - arg5 = (char*)lua_tostring(L, 5); + SWIG_check_num_args("say",5,6) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("say",1,"CoreSession *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("say",2,"char const *"); + if(!lua_isstring(L,3)) SWIG_fail_arg("say",3,"char const *"); + if(!lua_isstring(L,4)) SWIG_fail_arg("say",4,"char const *"); + if(!lua_isstring(L,5)) SWIG_fail_arg("say",5,"char const *"); + if(lua_gettop(L)>=6 && !lua_isstring(L,6)) SWIG_fail_arg("say",6,"char const *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_say",1,SWIGTYPE_p_CoreSession); + } + + arg2 = (char *)lua_tostring(L, 2); + arg3 = (char *)lua_tostring(L, 3); + arg4 = (char *)lua_tostring(L, 4); + arg5 = (char *)lua_tostring(L, 5); if(lua_gettop(L)>=6){ - arg6 = (char*)lua_tostring(L, 6); + arg6 = (char *)lua_tostring(L, 6); } (arg1)->say((char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3721,23 +4585,30 @@ static int _wrap_CoreSession_sayPhrase(lua_State* L) { char *arg3 = (char *) "" ; char *arg4 = (char *) NULL ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - if(lua_gettop(L)>=3 && !lua_isstring(L,3)) SWIG_fail_arg(3); - if(lua_gettop(L)>=4 && !lua_isstring(L,4)) SWIG_fail_arg(4); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_sayPhrase"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("sayPhrase",2,4) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("sayPhrase",1,"CoreSession *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("sayPhrase",2,"char const *"); + if(lua_gettop(L)>=3 && !lua_isstring(L,3)) SWIG_fail_arg("sayPhrase",3,"char const *"); + if(lua_gettop(L)>=4 && !lua_isstring(L,4)) SWIG_fail_arg("sayPhrase",4,"char const *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_sayPhrase",1,SWIGTYPE_p_CoreSession); + } + + arg2 = (char *)lua_tostring(L, 2); if(lua_gettop(L)>=3){ - arg3 = (char*)lua_tostring(L, 3); + arg3 = (char *)lua_tostring(L, 3); } if(lua_gettop(L)>=4){ - arg4 = (char*)lua_tostring(L, 4); + arg4 = (char *)lua_tostring(L, 4); } (arg1)->sayPhrase((char const *)arg2,(char const *)arg3,(char const *)arg4); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3749,13 +4620,20 @@ static int _wrap_CoreSession_hangupCause(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; char *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_hangupCause"); + SWIG_check_num_args("hangupCause",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangupCause",1,"CoreSession *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_hangupCause",1,SWIGTYPE_p_CoreSession); + } + result = (char *)(arg1)->hangupCause(); SWIG_arg=0; - lua_pushstring(L,result); SWIG_arg++; + lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3767,13 +4645,20 @@ static int _wrap_CoreSession_getState(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; char *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_getState"); + SWIG_check_num_args("getState",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getState",1,"CoreSession *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_getState",1,SWIGTYPE_p_CoreSession); + } + result = (char *)(arg1)->getState(); SWIG_arg=0; - lua_pushstring(L,result); SWIG_arg++; + lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3789,13 +4674,18 @@ static int _wrap_CoreSession_recordFile(lua_State* L) { int arg5 = (int) 0 ; int result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - if(lua_gettop(L)>=3 && !lua_isnumber(L,3)) SWIG_fail_arg(3); - if(lua_gettop(L)>=4 && !lua_isnumber(L,4)) SWIG_fail_arg(4); - if(lua_gettop(L)>=5 && !lua_isnumber(L,5)) SWIG_fail_arg(5); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_recordFile"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("recordFile",2,5) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("recordFile",1,"CoreSession *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("recordFile",2,"char *"); + if(lua_gettop(L)>=3 && !lua_isnumber(L,3)) SWIG_fail_arg("recordFile",3,"int"); + if(lua_gettop(L)>=4 && !lua_isnumber(L,4)) SWIG_fail_arg("recordFile",4,"int"); + if(lua_gettop(L)>=5 && !lua_isnumber(L,5)) SWIG_fail_arg("recordFile",5,"int"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_recordFile",1,SWIGTYPE_p_CoreSession); + } + + arg2 = (char *)lua_tostring(L, 2); if(lua_gettop(L)>=3){ arg3 = (int)lua_tonumber(L, 3); } @@ -3810,6 +4700,8 @@ static int _wrap_CoreSession_recordFile(lua_State* L) { lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3825,25 +4717,38 @@ static int _wrap_CoreSession_originate(lua_State* L) { switch_state_handler_table_t *arg5 = (switch_state_handler_table_t *) NULL ; int result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); - if(!lua_isstring(L,3)) SWIG_fail_arg(3); - if(lua_gettop(L)>=4 && !lua_isnumber(L,4)) SWIG_fail_arg(4); - if(lua_gettop(L)>=5 && !lua_isuserdata(L,5)) SWIG_fail_arg(5); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_originate"); - arg2=(CoreSession *)SWIG_MustGetPtr(L,2,SWIGTYPE_p_CoreSession,0,2,"CoreSession_originate"); - arg3 = (char*)lua_tostring(L, 3); + SWIG_check_num_args("originate",3,5) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("originate",1,"CoreSession *"); + if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("originate",2,"CoreSession *"); + if(!lua_isstring(L,3)) SWIG_fail_arg("originate",3,"char *"); + if(lua_gettop(L)>=4 && !lua_isnumber(L,4)) SWIG_fail_arg("originate",4,"int"); + if(lua_gettop(L)>=5 && !SWIG_isptrtype(L,5)) SWIG_fail_arg("originate",5,"switch_state_handler_table_t *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_originate",1,SWIGTYPE_p_CoreSession); + } + + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_originate",2,SWIGTYPE_p_CoreSession); + } + + arg3 = (char *)lua_tostring(L, 3); if(lua_gettop(L)>=4){ arg4 = (int)lua_tonumber(L, 4); } if(lua_gettop(L)>=5){ - arg5=(switch_state_handler_table_t *)SWIG_MustGetPtr(L,5,SWIGTYPE_p_switch_state_handler_table_t,0,5,"CoreSession_originate"); + if (!SWIG_IsOK(SWIG_ConvertPtr(L,5,(void**)&arg5,SWIGTYPE_p_switch_state_handler_table_t,0))){ + SWIG_fail_ptr("CoreSession_originate",5,SWIGTYPE_p_switch_state_handler_table_t); + } } result = (int)(arg1)->originate(arg2,arg3,arg4,arg5); SWIG_arg=0; lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3854,13 +4759,20 @@ static int _wrap_CoreSession_destroy(lua_State* L) { int SWIG_arg = -1; CoreSession *arg1 = (CoreSession *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_destroy"); + SWIG_check_num_args("destroy",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("destroy",1,"CoreSession *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_destroy",1,SWIGTYPE_p_CoreSession); + } + (arg1)->destroy(); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3873,17 +4785,24 @@ static int _wrap_CoreSession_setDTMFCallback(lua_State* L) { void *arg2 = (void *) 0 ; char *arg3 = (char *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); - if(!lua_isstring(L,3)) SWIG_fail_arg(3); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_setDTMFCallback"); - arg2=((swig_lua_userdata*)(lua_touserdata(L,2)))->ptr; - arg3 = (char*)lua_tostring(L, 3); + SWIG_check_num_args("setDTMFCallback",3,3) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setDTMFCallback",1,"CoreSession *"); + if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("setDTMFCallback",2,"void *"); + if(!lua_isstring(L,3)) SWIG_fail_arg("setDTMFCallback",3,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_setDTMFCallback",1,SWIGTYPE_p_CoreSession); + } + + arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"CoreSession_setDTMFCallback"); + arg3 = (char *)lua_tostring(L, 3); (arg1)->setDTMFCallback(arg2,arg3); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3896,15 +4815,22 @@ static int _wrap_CoreSession_speak(lua_State* L) { char *arg2 = (char *) 0 ; int result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_speak"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("speak",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("speak",1,"CoreSession *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("speak",2,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_speak",1,SWIGTYPE_p_CoreSession); + } + + arg2 = (char *)lua_tostring(L, 2); result = (int)(arg1)->speak(arg2); SWIG_arg=0; lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3917,17 +4843,24 @@ static int _wrap_CoreSession_set_tts_parms(lua_State* L) { char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - if(!lua_isstring(L,3)) SWIG_fail_arg(3); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_set_tts_parms"); - arg2 = (char*)lua_tostring(L, 2); - arg3 = (char*)lua_tostring(L, 3); + SWIG_check_num_args("set_tts_parms",3,3) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("set_tts_parms",1,"CoreSession *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("set_tts_parms",2,"char *"); + if(!lua_isstring(L,3)) SWIG_fail_arg("set_tts_parms",3,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_set_tts_parms",1,SWIGTYPE_p_CoreSession); + } + + arg2 = (char *)lua_tostring(L, 2); + arg3 = (char *)lua_tostring(L, 3); (arg1)->set_tts_parms(arg2,arg3); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3940,15 +4873,22 @@ static int _wrap_CoreSession_collectDigits__SWIG_0(lua_State* L) { int arg2 ; int result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isnumber(L,2)) SWIG_fail_arg(2); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_collectDigits"); + SWIG_check_num_args("collectDigits",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("collectDigits",1,"CoreSession *"); + if(!lua_isnumber(L,2)) SWIG_fail_arg("collectDigits",2,"int"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_collectDigits",1,SWIGTYPE_p_CoreSession); + } + arg2 = (int)lua_tonumber(L, 2); result = (int)(arg1)->collectDigits(arg2); SWIG_arg=0; lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3962,10 +4902,15 @@ static int _wrap_CoreSession_collectDigits__SWIG_1(lua_State* L) { int arg3 ; int result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isnumber(L,2)) SWIG_fail_arg(2); - if(!lua_isnumber(L,3)) SWIG_fail_arg(3); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_collectDigits"); + SWIG_check_num_args("collectDigits",3,3) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("collectDigits",1,"CoreSession *"); + if(!lua_isnumber(L,2)) SWIG_fail_arg("collectDigits",2,"int"); + if(!lua_isnumber(L,3)) SWIG_fail_arg("collectDigits",3,"int"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_collectDigits",1,SWIGTYPE_p_CoreSession); + } + arg2 = (int)lua_tonumber(L, 2); arg3 = (int)lua_tonumber(L, 3); result = (int)(arg1)->collectDigits(arg2,arg3); @@ -3973,6 +4918,8 @@ static int _wrap_CoreSession_collectDigits__SWIG_1(lua_State* L) { lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -3990,7 +4937,7 @@ static int _wrap_CoreSession_collectDigits(lua_State* L) { int _v; { void *ptr; - if (lua_isuserdata(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) { + if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) { _v = 0; } else { _v = 1; @@ -4009,7 +4956,7 @@ static int _wrap_CoreSession_collectDigits(lua_State* L) { int _v; { void *ptr; - if (lua_isuserdata(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) { + if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) { _v = 0; } else { _v = 1; @@ -4043,19 +4990,26 @@ static int _wrap_CoreSession_getDigits__SWIG_0(lua_State* L) { int arg4 ; char *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isnumber(L,2)) SWIG_fail_arg(2); - if(!lua_isstring(L,3)) SWIG_fail_arg(3); - if(!lua_isnumber(L,4)) SWIG_fail_arg(4); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_getDigits"); + SWIG_check_num_args("getDigits",4,4) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getDigits",1,"CoreSession *"); + if(!lua_isnumber(L,2)) SWIG_fail_arg("getDigits",2,"int"); + if(!lua_isstring(L,3)) SWIG_fail_arg("getDigits",3,"char *"); + if(!lua_isnumber(L,4)) SWIG_fail_arg("getDigits",4,"int"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_getDigits",1,SWIGTYPE_p_CoreSession); + } + arg2 = (int)lua_tonumber(L, 2); - arg3 = (char*)lua_tostring(L, 3); + arg3 = (char *)lua_tostring(L, 3); arg4 = (int)lua_tonumber(L, 4); result = (char *)(arg1)->getDigits(arg2,arg3,arg4); SWIG_arg=0; - lua_pushstring(L,result); SWIG_arg++; + lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4071,21 +5025,28 @@ static int _wrap_CoreSession_getDigits__SWIG_1(lua_State* L) { int arg5 ; char *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isnumber(L,2)) SWIG_fail_arg(2); - if(!lua_isstring(L,3)) SWIG_fail_arg(3); - if(!lua_isnumber(L,4)) SWIG_fail_arg(4); - if(!lua_isnumber(L,5)) SWIG_fail_arg(5); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_getDigits"); + SWIG_check_num_args("getDigits",5,5) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getDigits",1,"CoreSession *"); + if(!lua_isnumber(L,2)) SWIG_fail_arg("getDigits",2,"int"); + if(!lua_isstring(L,3)) SWIG_fail_arg("getDigits",3,"char *"); + if(!lua_isnumber(L,4)) SWIG_fail_arg("getDigits",4,"int"); + if(!lua_isnumber(L,5)) SWIG_fail_arg("getDigits",5,"int"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_getDigits",1,SWIGTYPE_p_CoreSession); + } + arg2 = (int)lua_tonumber(L, 2); - arg3 = (char*)lua_tostring(L, 3); + arg3 = (char *)lua_tostring(L, 3); arg4 = (int)lua_tonumber(L, 4); arg5 = (int)lua_tonumber(L, 5); result = (char *)(arg1)->getDigits(arg2,arg3,arg4,arg5); SWIG_arg=0; - lua_pushstring(L,result); SWIG_arg++; + lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4103,7 +5064,7 @@ static int _wrap_CoreSession_getDigits(lua_State* L) { int _v; { void *ptr; - if (lua_isuserdata(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) { + if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) { _v = 0; } else { _v = 1; @@ -4132,7 +5093,7 @@ static int _wrap_CoreSession_getDigits(lua_State* L) { int _v; { void *ptr; - if (lua_isuserdata(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) { + if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) { _v = 0; } else { _v = 1; @@ -4176,23 +5137,30 @@ static int _wrap_CoreSession_transfer(lua_State* L) { char *arg4 = (char *) NULL ; int result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - if(lua_gettop(L)>=3 && !lua_isstring(L,3)) SWIG_fail_arg(3); - if(lua_gettop(L)>=4 && !lua_isstring(L,4)) SWIG_fail_arg(4); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_transfer"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("transfer",2,4) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("transfer",1,"CoreSession *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("transfer",2,"char *"); + if(lua_gettop(L)>=3 && !lua_isstring(L,3)) SWIG_fail_arg("transfer",3,"char *"); + if(lua_gettop(L)>=4 && !lua_isstring(L,4)) SWIG_fail_arg("transfer",4,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_transfer",1,SWIGTYPE_p_CoreSession); + } + + arg2 = (char *)lua_tostring(L, 2); if(lua_gettop(L)>=3){ - arg3 = (char*)lua_tostring(L, 3); + arg3 = (char *)lua_tostring(L, 3); } if(lua_gettop(L)>=4){ - arg4 = (char*)lua_tostring(L, 4); + arg4 = (char *)lua_tostring(L, 4); } result = (int)(arg1)->transfer(arg2,arg3,arg4); SWIG_arg=0; lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4209,23 +5177,30 @@ static int _wrap_CoreSession_read(lua_State* L) { char *arg6 = (char *) 0 ; char *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isnumber(L,2)) SWIG_fail_arg(2); - if(!lua_isnumber(L,3)) SWIG_fail_arg(3); - if(!lua_isstring(L,4)) SWIG_fail_arg(4); - if(!lua_isnumber(L,5)) SWIG_fail_arg(5); - if(!lua_isstring(L,6)) SWIG_fail_arg(6); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_read"); + SWIG_check_num_args("read",6,6) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("read",1,"CoreSession *"); + if(!lua_isnumber(L,2)) SWIG_fail_arg("read",2,"int"); + if(!lua_isnumber(L,3)) SWIG_fail_arg("read",3,"int"); + if(!lua_isstring(L,4)) SWIG_fail_arg("read",4,"char const *"); + if(!lua_isnumber(L,5)) SWIG_fail_arg("read",5,"int"); + if(!lua_isstring(L,6)) SWIG_fail_arg("read",6,"char const *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_read",1,SWIGTYPE_p_CoreSession); + } + arg2 = (int)lua_tonumber(L, 2); arg3 = (int)lua_tonumber(L, 3); - arg4 = (char*)lua_tostring(L, 4); + arg4 = (char *)lua_tostring(L, 4); arg5 = (int)lua_tonumber(L, 5); - arg6 = (char*)lua_tostring(L, 6); + arg6 = (char *)lua_tostring(L, 6); result = (char *)(arg1)->read(arg2,arg3,(char const *)arg4,arg5,(char const *)arg6); SWIG_arg=0; - lua_pushstring(L,result); SWIG_arg++; + lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4246,33 +5221,40 @@ static int _wrap_CoreSession_playAndGetDigits(lua_State* L) { char *arg10 = (char *) NULL ; char *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isnumber(L,2)) SWIG_fail_arg(2); - if(!lua_isnumber(L,3)) SWIG_fail_arg(3); - if(!lua_isnumber(L,4)) SWIG_fail_arg(4); - if(!lua_isnumber(L,5)) SWIG_fail_arg(5); - if(!lua_isstring(L,6)) SWIG_fail_arg(6); - if(!lua_isstring(L,7)) SWIG_fail_arg(7); - if(!lua_isstring(L,8)) SWIG_fail_arg(8); - if(!lua_isstring(L,9)) SWIG_fail_arg(9); - if(lua_gettop(L)>=10 && !lua_isstring(L,10)) SWIG_fail_arg(10); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_playAndGetDigits"); + SWIG_check_num_args("playAndGetDigits",9,10) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("playAndGetDigits",1,"CoreSession *"); + if(!lua_isnumber(L,2)) SWIG_fail_arg("playAndGetDigits",2,"int"); + if(!lua_isnumber(L,3)) SWIG_fail_arg("playAndGetDigits",3,"int"); + if(!lua_isnumber(L,4)) SWIG_fail_arg("playAndGetDigits",4,"int"); + if(!lua_isnumber(L,5)) SWIG_fail_arg("playAndGetDigits",5,"int"); + if(!lua_isstring(L,6)) SWIG_fail_arg("playAndGetDigits",6,"char *"); + if(!lua_isstring(L,7)) SWIG_fail_arg("playAndGetDigits",7,"char *"); + if(!lua_isstring(L,8)) SWIG_fail_arg("playAndGetDigits",8,"char *"); + if(!lua_isstring(L,9)) SWIG_fail_arg("playAndGetDigits",9,"char *"); + if(lua_gettop(L)>=10 && !lua_isstring(L,10)) SWIG_fail_arg("playAndGetDigits",10,"char const *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_playAndGetDigits",1,SWIGTYPE_p_CoreSession); + } + arg2 = (int)lua_tonumber(L, 2); arg3 = (int)lua_tonumber(L, 3); arg4 = (int)lua_tonumber(L, 4); arg5 = (int)lua_tonumber(L, 5); - arg6 = (char*)lua_tostring(L, 6); - arg7 = (char*)lua_tostring(L, 7); - arg8 = (char*)lua_tostring(L, 8); - arg9 = (char*)lua_tostring(L, 9); + arg6 = (char *)lua_tostring(L, 6); + arg7 = (char *)lua_tostring(L, 7); + arg8 = (char *)lua_tostring(L, 8); + arg9 = (char *)lua_tostring(L, 9); if(lua_gettop(L)>=10){ - arg10 = (char*)lua_tostring(L, 10); + arg10 = (char *)lua_tostring(L, 10); } result = (char *)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,(char const *)arg10); SWIG_arg=0; - lua_pushstring(L,result); SWIG_arg++; + lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4286,11 +5268,16 @@ static int _wrap_CoreSession_streamFile(lua_State* L) { int arg3 = (int) 0 ; int result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - if(lua_gettop(L)>=3 && !lua_isnumber(L,3)) SWIG_fail_arg(3); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_streamFile"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("streamFile",2,3) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("streamFile",1,"CoreSession *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("streamFile",2,"char *"); + if(lua_gettop(L)>=3 && !lua_isnumber(L,3)) SWIG_fail_arg("streamFile",3,"int"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_streamFile",1,SWIGTYPE_p_CoreSession); + } + + arg2 = (char *)lua_tostring(L, 2); if(lua_gettop(L)>=3){ arg3 = (int)lua_tonumber(L, 3); } @@ -4299,6 +5286,8 @@ static int _wrap_CoreSession_streamFile(lua_State* L) { lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4312,10 +5301,15 @@ static int _wrap_CoreSession_sleep(lua_State* L) { int arg3 = (int) 0 ; int result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isnumber(L,2)) SWIG_fail_arg(2); - if(lua_gettop(L)>=3 && !lua_isnumber(L,3)) SWIG_fail_arg(3); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_sleep"); + SWIG_check_num_args("sleep",2,3) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("sleep",1,"CoreSession *"); + if(!lua_isnumber(L,2)) SWIG_fail_arg("sleep",2,"int"); + if(lua_gettop(L)>=3 && !lua_isnumber(L,3)) SWIG_fail_arg("sleep",3,"int"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_sleep",1,SWIGTYPE_p_CoreSession); + } + arg2 = (int)lua_tonumber(L, 2); if(lua_gettop(L)>=3){ arg3 = (int)lua_tonumber(L, 3); @@ -4325,6 +5319,8 @@ static int _wrap_CoreSession_sleep(lua_State* L) { lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4336,13 +5332,20 @@ static int _wrap_CoreSession_flushEvents(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; int result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_flushEvents"); + SWIG_check_num_args("flushEvents",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("flushEvents",1,"CoreSession *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_flushEvents",1,SWIGTYPE_p_CoreSession); + } + result = (int)(arg1)->flushEvents(); SWIG_arg=0; lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4354,13 +5357,20 @@ static int _wrap_CoreSession_flushDigits(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; int result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_flushDigits"); + SWIG_check_num_args("flushDigits",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("flushDigits",1,"CoreSession *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_flushDigits",1,SWIGTYPE_p_CoreSession); + } + result = (int)(arg1)->flushDigits(); SWIG_arg=0; lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4373,15 +5383,22 @@ static int _wrap_CoreSession_setAutoHangup(lua_State* L) { bool arg2 ; int result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isboolean(L,2)) SWIG_fail_arg(2); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_setAutoHangup"); - arg2 = (bool)lua_toboolean(L, 2); + SWIG_check_num_args("setAutoHangup",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setAutoHangup",1,"CoreSession *"); + if(!lua_isboolean(L,2)) SWIG_fail_arg("setAutoHangup",2,"bool"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_setAutoHangup",1,SWIGTYPE_p_CoreSession); + } + + arg2 = (lua_toboolean(L, 2)!=0); result = (int)(arg1)->setAutoHangup(arg2); SWIG_arg=0; lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4393,15 +5410,22 @@ static int _wrap_CoreSession_setHangupHook(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; void *arg2 = (void *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_setHangupHook"); - arg2=((swig_lua_userdata*)(lua_touserdata(L,2)))->ptr; + SWIG_check_num_args("setHangupHook",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setHangupHook",1,"CoreSession *"); + if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("setHangupHook",2,"void *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_setHangupHook",1,SWIGTYPE_p_CoreSession); + } + + arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"CoreSession_setHangupHook"); (arg1)->setHangupHook(arg2); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4413,13 +5437,20 @@ static int _wrap_CoreSession_ready(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; bool result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_ready"); + SWIG_check_num_args("ready",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ready",1,"CoreSession *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_ready",1,SWIGTYPE_p_CoreSession); + } + result = (bool)(arg1)->ready(); SWIG_arg=0; - lua_pushboolean(L,(int)result); SWIG_arg++; + lua_pushboolean(L,(int)(result==true)); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4431,13 +5462,20 @@ static int _wrap_CoreSession_bridged(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; bool result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_bridged"); + SWIG_check_num_args("bridged",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("bridged",1,"CoreSession *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_bridged",1,SWIGTYPE_p_CoreSession); + } + result = (bool)(arg1)->bridged(); SWIG_arg=0; - lua_pushboolean(L,(int)result); SWIG_arg++; + lua_pushboolean(L,(int)(result==true)); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4449,13 +5487,20 @@ static int _wrap_CoreSession_answered(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; bool result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_answered"); + SWIG_check_num_args("answered",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("answered",1,"CoreSession *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_answered",1,SWIGTYPE_p_CoreSession); + } + result = (bool)(arg1)->answered(); SWIG_arg=0; - lua_pushboolean(L,(int)result); SWIG_arg++; + lua_pushboolean(L,(int)(result==true)); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4467,13 +5512,20 @@ static int _wrap_CoreSession_mediaReady(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; bool result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_mediaReady"); + SWIG_check_num_args("mediaReady",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("mediaReady",1,"CoreSession *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_mediaReady",1,SWIGTYPE_p_CoreSession); + } + result = (bool)(arg1)->mediaReady(); SWIG_arg=0; - lua_pushboolean(L,(int)result); SWIG_arg++; + lua_pushboolean(L,(int)(result==true)); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4485,15 +5537,26 @@ static int _wrap_CoreSession_waitForAnswer(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; CoreSession *arg2 = (CoreSession *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_waitForAnswer"); - arg2=(CoreSession *)SWIG_MustGetPtr(L,2,SWIGTYPE_p_CoreSession,0,2,"CoreSession_waitForAnswer"); + SWIG_check_num_args("waitForAnswer",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("waitForAnswer",1,"CoreSession *"); + if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("waitForAnswer",2,"CoreSession *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_waitForAnswer",1,SWIGTYPE_p_CoreSession); + } + + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_waitForAnswer",2,SWIGTYPE_p_CoreSession); + } + (arg1)->waitForAnswer(arg2); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4506,19 +5569,26 @@ static int _wrap_CoreSession_execute(lua_State* L) { char *arg2 = (char *) 0 ; char *arg3 = (char *) NULL ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - if(lua_gettop(L)>=3 && !lua_isstring(L,3)) SWIG_fail_arg(3); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_execute"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("execute",2,3) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("execute",1,"CoreSession *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("execute",2,"char const *"); + if(lua_gettop(L)>=3 && !lua_isstring(L,3)) SWIG_fail_arg("execute",3,"char const *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_execute",1,SWIGTYPE_p_CoreSession); + } + + arg2 = (char *)lua_tostring(L, 2); if(lua_gettop(L)>=3){ - arg3 = (char*)lua_tostring(L, 3); + arg3 = (char *)lua_tostring(L, 3); } (arg1)->execute((char const *)arg2,(char const *)arg3); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4530,15 +5600,26 @@ static int _wrap_CoreSession_sendEvent(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; Event *arg2 = (Event *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_sendEvent"); - arg2=(Event *)SWIG_MustGetPtr(L,2,SWIGTYPE_p_Event,0,2,"CoreSession_sendEvent"); + SWIG_check_num_args("sendEvent",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("sendEvent",1,"CoreSession *"); + if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("sendEvent",2,"Event *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_sendEvent",1,SWIGTYPE_p_CoreSession); + } + + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_Event,0))){ + SWIG_fail_ptr("CoreSession_sendEvent",2,SWIGTYPE_p_Event); + } + (arg1)->sendEvent(arg2); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4550,15 +5631,26 @@ static int _wrap_CoreSession_setEventData(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; Event *arg2 = (Event *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_setEventData"); - arg2=(Event *)SWIG_MustGetPtr(L,2,SWIGTYPE_p_Event,0,2,"CoreSession_setEventData"); + SWIG_check_num_args("setEventData",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setEventData",1,"CoreSession *"); + if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("setEventData",2,"Event *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_setEventData",1,SWIGTYPE_p_CoreSession); + } + + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_Event,0))){ + SWIG_fail_ptr("CoreSession_setEventData",2,SWIGTYPE_p_Event); + } + (arg1)->setEventData(arg2); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4570,13 +5662,20 @@ static int _wrap_CoreSession_getXMLCDR(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; char *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_getXMLCDR"); + SWIG_check_num_args("getXMLCDR",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getXMLCDR",1,"CoreSession *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_getXMLCDR",1,SWIGTYPE_p_CoreSession); + } + result = (char *)(arg1)->getXMLCDR(); SWIG_arg=0; - lua_pushstring(L,result); SWIG_arg++; + lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4588,13 +5687,20 @@ static int _wrap_CoreSession_begin_allow_threads(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; bool result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_begin_allow_threads"); + SWIG_check_num_args("begin_allow_threads",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("begin_allow_threads",1,"CoreSession *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_begin_allow_threads",1,SWIGTYPE_p_CoreSession); + } + result = (bool)(arg1)->begin_allow_threads(); SWIG_arg=0; - lua_pushboolean(L,(int)result); SWIG_arg++; + lua_pushboolean(L,(int)(result==true)); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4606,13 +5712,20 @@ static int _wrap_CoreSession_end_allow_threads(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; bool result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_end_allow_threads"); + SWIG_check_num_args("end_allow_threads",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("end_allow_threads",1,"CoreSession *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_end_allow_threads",1,SWIGTYPE_p_CoreSession); + } + result = (bool)(arg1)->end_allow_threads(); SWIG_arg=0; - lua_pushboolean(L,(int)result); SWIG_arg++; + lua_pushboolean(L,(int)(result==true)); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4624,13 +5737,20 @@ static int _wrap_CoreSession_get_uuid(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; char *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_get_uuid"); + SWIG_check_num_args("get_uuid",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("get_uuid",1,"CoreSession const *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_get_uuid",1,SWIGTYPE_p_CoreSession); + } + result = (char *)((CoreSession const *)arg1)->get_uuid(); SWIG_arg=0; - lua_pushstring(L,result); SWIG_arg++; + lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4642,8 +5762,13 @@ static int _wrap_CoreSession_get_cb_args(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; switch_input_args_t *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_get_cb_args"); + SWIG_check_num_args("get_cb_args",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("get_cb_args",1,"CoreSession const *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_get_cb_args",1,SWIGTYPE_p_CoreSession); + } + { switch_input_args_t const &_result_ref = ((CoreSession const *)arg1)->get_cb_args(); result = (switch_input_args_t *) &_result_ref; @@ -4652,6 +5777,8 @@ static int _wrap_CoreSession_get_cb_args(lua_State* L) { SWIG_NewPointerObj(L,result,SWIGTYPE_p_switch_input_args_t,0); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4662,13 +5789,20 @@ static int _wrap_CoreSession_check_hangup_hook(lua_State* L) { int SWIG_arg = -1; CoreSession *arg1 = (CoreSession *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_check_hangup_hook"); + SWIG_check_num_args("check_hangup_hook",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("check_hangup_hook",1,"CoreSession *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_check_hangup_hook",1,SWIGTYPE_p_CoreSession); + } + (arg1)->check_hangup_hook(); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4681,26 +5815,34 @@ static int _wrap_CoreSession_run_dtmf_callback(lua_State* L) { void *arg2 = (void *) 0 ; switch_input_type_t arg3 ; switch_status_t result; + switch_input_type_t *argp3 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); - if(!lua_isuserdata(L,3)) SWIG_fail_arg(3); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_run_dtmf_callback"); - arg2=((swig_lua_userdata*)(lua_touserdata(L,2)))->ptr; - { - switch_input_type_t * argp; - if(SWIG_ConvertPtr(L,3,(void**)(&argp),SWIGTYPE_p_switch_input_type_t,0)) SWIG_fail; - arg3 = *argp; + SWIG_check_num_args("run_dtmf_callback",3,3) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("run_dtmf_callback",1,"CoreSession *"); + if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("run_dtmf_callback",2,"void *"); + if(!lua_isuserdata(L,3)) SWIG_fail_arg("run_dtmf_callback",3,"switch_input_type_t"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("CoreSession_run_dtmf_callback",1,SWIGTYPE_p_CoreSession); + } + + arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"CoreSession_run_dtmf_callback"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,3,(void**)&argp3,SWIGTYPE_p_switch_input_type_t,0))){ + SWIG_fail_ptr("CoreSession_run_dtmf_callback",3,SWIGTYPE_p_switch_input_type_t); } + arg3 = *argp3; + result = (arg1)->run_dtmf_callback(arg2,arg3); SWIG_arg=0; { - switch_status_t * resultptr; - resultptr = new switch_status_t((switch_status_t &) result); + switch_status_t * resultptr = new switch_status_t((switch_status_t &) result); SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_status_t,1); SWIG_arg++; } return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4760,35 +5902,39 @@ static swig_lua_method swig_CoreSession_methods[] = { {0,0} }; static swig_lua_attribute swig_CoreSession_attributes[] = { - { "session",_wrap_CoreSession_session_get, _wrap_CoreSession_session_set}, - { "channel",_wrap_CoreSession_channel_get, _wrap_CoreSession_channel_set}, - { "flags",_wrap_CoreSession_flags_get, _wrap_CoreSession_flags_set}, - { "allocated",_wrap_CoreSession_allocated_get, _wrap_CoreSession_allocated_set}, - { "cb_state",_wrap_CoreSession_cb_state_get, _wrap_CoreSession_cb_state_set}, - { "hook_state",_wrap_CoreSession_hook_state_get, _wrap_CoreSession_hook_state_set}, - { "cause",_wrap_CoreSession_cause_get, _wrap_CoreSession_cause_set}, - { "uuid",_wrap_CoreSession_uuid_get, _wrap_CoreSession_uuid_set}, - { "tts_name",_wrap_CoreSession_tts_name_get, _wrap_CoreSession_tts_name_set}, - { "voice_name",_wrap_CoreSession_voice_name_get, _wrap_CoreSession_voice_name_set}, + { "session", _wrap_CoreSession_session_get, _wrap_CoreSession_session_set}, + { "channel", _wrap_CoreSession_channel_get, _wrap_CoreSession_channel_set}, + { "flags", _wrap_CoreSession_flags_get, _wrap_CoreSession_flags_set}, + { "allocated", _wrap_CoreSession_allocated_get, _wrap_CoreSession_allocated_set}, + { "cb_state", _wrap_CoreSession_cb_state_get, _wrap_CoreSession_cb_state_set}, + { "hook_state", _wrap_CoreSession_hook_state_get, _wrap_CoreSession_hook_state_set}, + { "cause", _wrap_CoreSession_cause_get, _wrap_CoreSession_cause_set}, + { "uuid", _wrap_CoreSession_uuid_get, _wrap_CoreSession_uuid_set}, + { "tts_name", _wrap_CoreSession_tts_name_get, _wrap_CoreSession_tts_name_set}, + { "voice_name", _wrap_CoreSession_voice_name_get, _wrap_CoreSession_voice_name_set}, {0,0,0} }; static swig_lua_class *swig_CoreSession_bases[] = {0}; -swig_lua_class _wrap_class_CoreSession = { "CoreSession", &SWIGTYPE_p_CoreSession,0, swig_delete_CoreSession, swig_CoreSession_methods, swig_CoreSession_attributes, swig_CoreSession_bases }; +static const char *swig_CoreSession_base_names[] = {0}; +static swig_lua_class _wrap_class_CoreSession = { "CoreSession", &SWIGTYPE_p_CoreSession,0, swig_delete_CoreSession, swig_CoreSession_methods, swig_CoreSession_attributes, swig_CoreSession_bases, swig_CoreSession_base_names }; static int _wrap_console_log(lua_State* L) { int SWIG_arg = -1; char *arg1 = (char *) 0 ; char *arg2 = (char *) 0 ; - if(!lua_isstring(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - arg1 = (char*)lua_tostring(L, 1); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("console_log",2,2) + if(!lua_isstring(L,1)) SWIG_fail_arg("console_log",1,"char *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("console_log",2,"char *"); + arg1 = (char *)lua_tostring(L, 1); + arg2 = (char *)lua_tostring(L, 2); console_log(arg1,arg2); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4799,13 +5945,16 @@ static int _wrap_console_clean_log(lua_State* L) { int SWIG_arg = -1; char *arg1 = (char *) 0 ; - if(!lua_isstring(L,1)) SWIG_fail_arg(1); - arg1 = (char*)lua_tostring(L, 1); + SWIG_check_num_args("console_clean_log",1,1) + if(!lua_isstring(L,1)) SWIG_fail_arg("console_clean_log",1,"char *"); + arg1 = (char *)lua_tostring(L, 1); console_clean_log(arg1); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4816,13 +5965,16 @@ static int _wrap_msleep(lua_State* L) { int SWIG_arg = -1; unsigned int arg1 ; - if(!lua_isnumber(L,1)) SWIG_fail_arg(1); + SWIG_check_num_args("msleep",1,1) + if(!lua_isnumber(L,1)) SWIG_fail_arg("msleep",1,"unsigned int"); arg1 = (unsigned int)lua_tonumber(L, 1); msleep(arg1); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4834,15 +5986,26 @@ static int _wrap_bridge(lua_State* L) { CoreSession *arg1 = 0 ; CoreSession *arg2 = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); - arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"bridge"); - arg2=(CoreSession *)SWIG_MustGetPtr(L,2,SWIGTYPE_p_CoreSession,0,2,"bridge"); + SWIG_check_num_args("bridge",2,2) + if(!lua_isuserdata(L,1)) SWIG_fail_arg("bridge",1,"CoreSession &"); + if(!lua_isuserdata(L,2)) SWIG_fail_arg("bridge",2,"CoreSession &"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("bridge",1,SWIGTYPE_p_CoreSession); + } + + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("bridge",2,SWIGTYPE_p_CoreSession); + } + bridge(*arg1,*arg2); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4854,17 +6017,23 @@ static int _wrap_hanguphook(lua_State* L) { switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; switch_status_t result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(switch_core_session_t *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_switch_core_session_t,0,1,"hanguphook"); + SWIG_check_num_args("hanguphook",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hanguphook",1,"switch_core_session_t *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_switch_core_session_t,0))){ + SWIG_fail_ptr("hanguphook",1,SWIGTYPE_p_switch_core_session_t); + } + result = hanguphook(arg1); SWIG_arg=0; { - switch_status_t * resultptr; - resultptr = new switch_status_t((switch_status_t &) result); + switch_status_t * resultptr = new switch_status_t((switch_status_t &) result); SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_status_t,1); SWIG_arg++; } return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4879,30 +6048,38 @@ static int _wrap_dtmf_callback(lua_State* L) { void *arg4 = (void *) 0 ; unsigned int arg5 ; switch_status_t result; + switch_input_type_t *argp3 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); - if(!lua_isuserdata(L,3)) SWIG_fail_arg(3); - if(!lua_isuserdata(L,4)) SWIG_fail_arg(4); - if(!lua_isnumber(L,5)) SWIG_fail_arg(5); - arg1=(switch_core_session_t *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_switch_core_session_t,0,1,"dtmf_callback"); - arg2=((swig_lua_userdata*)(lua_touserdata(L,2)))->ptr; - { - switch_input_type_t * argp; - if(SWIG_ConvertPtr(L,3,(void**)(&argp),SWIGTYPE_p_switch_input_type_t,0)) SWIG_fail; - arg3 = *argp; + SWIG_check_num_args("dtmf_callback",5,5) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("dtmf_callback",1,"switch_core_session_t *"); + if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("dtmf_callback",2,"void *"); + if(!lua_isuserdata(L,3)) SWIG_fail_arg("dtmf_callback",3,"switch_input_type_t"); + if(!SWIG_isptrtype(L,4)) SWIG_fail_arg("dtmf_callback",4,"void *"); + if(!lua_isnumber(L,5)) SWIG_fail_arg("dtmf_callback",5,"unsigned int"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_switch_core_session_t,0))){ + SWIG_fail_ptr("dtmf_callback",1,SWIGTYPE_p_switch_core_session_t); + } + + arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"dtmf_callback"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,3,(void**)&argp3,SWIGTYPE_p_switch_input_type_t,0))){ + SWIG_fail_ptr("dtmf_callback",3,SWIGTYPE_p_switch_input_type_t); } - arg4=((swig_lua_userdata*)(lua_touserdata(L,4)))->ptr; + arg3 = *argp3; + + arg4=(void *)SWIG_MustGetPtr(L,4,0,0,4,"dtmf_callback"); arg5 = (unsigned int)lua_tonumber(L, 5); result = dtmf_callback(arg1,arg2,arg3,arg4,arg5); SWIG_arg=0; { - switch_status_t * resultptr; - resultptr = new switch_status_t((switch_status_t &) result); + switch_status_t * resultptr = new switch_status_t((switch_status_t &) result); SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_status_t,1); SWIG_arg++; } return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4913,11 +6090,14 @@ static int _wrap_new_Session__SWIG_0(lua_State* L) { int SWIG_arg = -1; LUA::Session *result = 0 ; + SWIG_check_num_args("LUA::Session",0,0) result = (LUA::Session *)new LUA::Session(); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; result->setLUA(L); return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4930,15 +6110,22 @@ static int _wrap_new_Session__SWIG_1(lua_State* L) { CoreSession *arg2 = (CoreSession *) 0 ; LUA::Session *result = 0 ; - if(!lua_isstring(L,1)) SWIG_fail_arg(1); - if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); - arg1 = (char*)lua_tostring(L, 1); - arg2=(CoreSession *)SWIG_MustGetPtr(L,2,SWIGTYPE_p_CoreSession,0,2,"new_Session"); + SWIG_check_num_args("LUA::Session",2,2) + if(!lua_isstring(L,1)) SWIG_fail_arg("LUA::Session",1,"char *"); + if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("LUA::Session",2,"CoreSession *"); + arg1 = (char *)lua_tostring(L, 1); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("new_Session",2,SWIGTYPE_p_CoreSession); + } + result = (LUA::Session *)new LUA::Session(arg1,arg2); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; result->setLUA(L); return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4950,13 +6137,16 @@ static int _wrap_new_Session__SWIG_2(lua_State* L) { char *arg1 = (char *) 0 ; LUA::Session *result = 0 ; - if(!lua_isstring(L,1)) SWIG_fail_arg(1); - arg1 = (char*)lua_tostring(L, 1); + SWIG_check_num_args("LUA::Session",1,1) + if(!lua_isstring(L,1)) SWIG_fail_arg("LUA::Session",1,"char *"); + arg1 = (char *)lua_tostring(L, 1); result = (LUA::Session *)new LUA::Session(arg1); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; result->setLUA(L); return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4968,13 +6158,20 @@ static int _wrap_new_Session__SWIG_3(lua_State* L) { switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; LUA::Session *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(switch_core_session_t *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_switch_core_session_t,0,1,"new_Session"); + SWIG_check_num_args("LUA::Session",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("LUA::Session",1,"switch_core_session_t *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_switch_core_session_t,0))){ + SWIG_fail_ptr("new_Session",1,SWIGTYPE_p_switch_core_session_t); + } + result = (LUA::Session *)new LUA::Session(arg1); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; result->setLUA(L); return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -4995,7 +6192,7 @@ static int _wrap_new_Session(lua_State* L) { int _v; { void *ptr; - if (lua_isuserdata(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_switch_core_session_t, 0)) { + if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_switch_core_session_t, 0)) { _v = 0; } else { _v = 1; @@ -5022,7 +6219,7 @@ static int _wrap_new_Session(lua_State* L) { if (_v) { { void *ptr; - if (lua_isuserdata(L,argv[1])==0 || SWIG_ConvertPtr(L,argv[1], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) { + if (SWIG_isptrtype(L,argv[1])==0 || SWIG_ConvertPtr(L,argv[1], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) { _v = 0; } else { _v = 1; @@ -5043,14 +6240,21 @@ static int _wrap_delete_Session(lua_State* L) { int SWIG_arg = -1; LUA::Session *arg1 = (LUA::Session *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"delete_Session"); + SWIG_check_num_args("LUA::~Session",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("LUA::~Session",1,"LUA::Session *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,SWIG_POINTER_DISOWN))){ + SWIG_fail_ptr("delete_Session",1,SWIGTYPE_p_LUA__Session); + } + delete arg1; SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -5061,13 +6265,20 @@ static int _wrap_Session_destroy(lua_State* L) { int SWIG_arg = -1; LUA::Session *arg1 = (LUA::Session *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_destroy"); + SWIG_check_num_args("destroy",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("destroy",1,"LUA::Session *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ + SWIG_fail_ptr("Session_destroy",1,SWIGTYPE_p_LUA__Session); + } + (arg1)->destroy(); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -5079,13 +6290,20 @@ static int _wrap_Session_begin_allow_threads(lua_State* L) { LUA::Session *arg1 = (LUA::Session *) 0 ; bool result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_begin_allow_threads"); + SWIG_check_num_args("begin_allow_threads",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("begin_allow_threads",1,"LUA::Session *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ + SWIG_fail_ptr("Session_begin_allow_threads",1,SWIGTYPE_p_LUA__Session); + } + result = (bool)(arg1)->begin_allow_threads(); SWIG_arg=0; - lua_pushboolean(L,(int)result); SWIG_arg++; + lua_pushboolean(L,(int)(result==true)); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -5097,13 +6315,20 @@ static int _wrap_Session_end_allow_threads(lua_State* L) { LUA::Session *arg1 = (LUA::Session *) 0 ; bool result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_end_allow_threads"); + SWIG_check_num_args("end_allow_threads",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("end_allow_threads",1,"LUA::Session *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ + SWIG_fail_ptr("Session_end_allow_threads",1,SWIGTYPE_p_LUA__Session); + } + result = (bool)(arg1)->end_allow_threads(); SWIG_arg=0; - lua_pushboolean(L,(int)result); SWIG_arg++; + lua_pushboolean(L,(int)(result==true)); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -5114,13 +6339,20 @@ static int _wrap_Session_check_hangup_hook(lua_State* L) { int SWIG_arg = -1; LUA::Session *arg1 = (LUA::Session *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_check_hangup_hook"); + SWIG_check_num_args("check_hangup_hook",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("check_hangup_hook",1,"LUA::Session *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ + SWIG_fail_ptr("Session_check_hangup_hook",1,SWIGTYPE_p_LUA__Session); + } + (arg1)->check_hangup_hook(); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -5133,26 +6365,34 @@ static int _wrap_Session_run_dtmf_callback(lua_State* L) { void *arg2 = (void *) 0 ; switch_input_type_t arg3 ; switch_status_t result; + switch_input_type_t *argp3 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); - if(!lua_isuserdata(L,3)) SWIG_fail_arg(3); - arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_run_dtmf_callback"); - arg2=((swig_lua_userdata*)(lua_touserdata(L,2)))->ptr; - { - switch_input_type_t * argp; - if(SWIG_ConvertPtr(L,3,(void**)(&argp),SWIGTYPE_p_switch_input_type_t,0)) SWIG_fail; - arg3 = *argp; + SWIG_check_num_args("run_dtmf_callback",3,3) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("run_dtmf_callback",1,"LUA::Session *"); + if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("run_dtmf_callback",2,"void *"); + if(!lua_isuserdata(L,3)) SWIG_fail_arg("run_dtmf_callback",3,"switch_input_type_t"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ + SWIG_fail_ptr("Session_run_dtmf_callback",1,SWIGTYPE_p_LUA__Session); + } + + arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"Session_run_dtmf_callback"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,3,(void**)&argp3,SWIGTYPE_p_switch_input_type_t,0))){ + SWIG_fail_ptr("Session_run_dtmf_callback",3,SWIGTYPE_p_switch_input_type_t); } + arg3 = *argp3; + result = (arg1)->run_dtmf_callback(arg2,arg3); SWIG_arg=0; { - switch_status_t * resultptr; - resultptr = new switch_status_t((switch_status_t &) result); + switch_status_t * resultptr = new switch_status_t((switch_status_t &) result); SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_status_t,1); SWIG_arg++; } return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -5163,13 +6403,20 @@ static int _wrap_Session_unsetInputCallback(lua_State* L) { int SWIG_arg = -1; LUA::Session *arg1 = (LUA::Session *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_unsetInputCallback"); + SWIG_check_num_args("unsetInputCallback",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("unsetInputCallback",1,"LUA::Session *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ + SWIG_fail_ptr("Session_unsetInputCallback",1,SWIGTYPE_p_LUA__Session); + } + (arg1)->unsetInputCallback(); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -5182,17 +6429,24 @@ static int _wrap_Session_setInputCallback__SWIG_0(lua_State* L) { char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - if(!lua_isstring(L,3)) SWIG_fail_arg(3); - arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_setInputCallback"); - arg2 = (char*)lua_tostring(L, 2); - arg3 = (char*)lua_tostring(L, 3); + SWIG_check_num_args("setInputCallback",3,3) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setInputCallback",1,"LUA::Session *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("setInputCallback",2,"char *"); + if(!lua_isstring(L,3)) SWIG_fail_arg("setInputCallback",3,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ + SWIG_fail_ptr("Session_setInputCallback",1,SWIGTYPE_p_LUA__Session); + } + + arg2 = (char *)lua_tostring(L, 2); + arg3 = (char *)lua_tostring(L, 3); (arg1)->setInputCallback(arg2,arg3); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -5204,15 +6458,22 @@ static int _wrap_Session_setInputCallback__SWIG_1(lua_State* L) { LUA::Session *arg1 = (LUA::Session *) 0 ; char *arg2 = (char *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_setInputCallback"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("setInputCallback",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setInputCallback",1,"LUA::Session *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("setInputCallback",2,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ + SWIG_fail_ptr("Session_setInputCallback",1,SWIGTYPE_p_LUA__Session); + } + + arg2 = (char *)lua_tostring(L, 2); (arg1)->setInputCallback(arg2); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -5230,7 +6491,7 @@ static int _wrap_Session_setInputCallback(lua_State* L) { int _v; { void *ptr; - if (lua_isuserdata(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) { + if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) { _v = 0; } else { _v = 1; @@ -5249,7 +6510,7 @@ static int _wrap_Session_setInputCallback(lua_State* L) { int _v; { void *ptr; - if (lua_isuserdata(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) { + if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) { _v = 0; } else { _v = 1; @@ -5281,17 +6542,24 @@ static int _wrap_Session_setHangupHook__SWIG_0(lua_State* L) { char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - if(!lua_isstring(L,3)) SWIG_fail_arg(3); - arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_setHangupHook"); - arg2 = (char*)lua_tostring(L, 2); - arg3 = (char*)lua_tostring(L, 3); + SWIG_check_num_args("setHangupHook",3,3) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setHangupHook",1,"LUA::Session *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("setHangupHook",2,"char *"); + if(!lua_isstring(L,3)) SWIG_fail_arg("setHangupHook",3,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ + SWIG_fail_ptr("Session_setHangupHook",1,SWIGTYPE_p_LUA__Session); + } + + arg2 = (char *)lua_tostring(L, 2); + arg3 = (char *)lua_tostring(L, 3); (arg1)->setHangupHook(arg2,arg3); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -5303,15 +6571,22 @@ static int _wrap_Session_setHangupHook__SWIG_1(lua_State* L) { LUA::Session *arg1 = (LUA::Session *) 0 ; char *arg2 = (char *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_setHangupHook"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("setHangupHook",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setHangupHook",1,"LUA::Session *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("setHangupHook",2,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ + SWIG_fail_ptr("Session_setHangupHook",1,SWIGTYPE_p_LUA__Session); + } + + arg2 = (char *)lua_tostring(L, 2); (arg1)->setHangupHook(arg2); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -5329,7 +6604,7 @@ static int _wrap_Session_setHangupHook(lua_State* L) { int _v; { void *ptr; - if (lua_isuserdata(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) { + if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) { _v = 0; } else { _v = 1; @@ -5348,7 +6623,7 @@ static int _wrap_Session_setHangupHook(lua_State* L) { int _v; { void *ptr; - if (lua_isuserdata(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) { + if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) { _v = 0; } else { _v = 1; @@ -5379,13 +6654,20 @@ static int _wrap_Session_ready(lua_State* L) { LUA::Session *arg1 = (LUA::Session *) 0 ; bool result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_ready"); + SWIG_check_num_args("ready",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ready",1,"LUA::Session *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ + SWIG_fail_ptr("Session_ready",1,SWIGTYPE_p_LUA__Session); + } + result = (bool)(arg1)->ready(); SWIG_arg=0; - lua_pushboolean(L,(int)result); SWIG_arg++; + lua_pushboolean(L,(int)(result==true)); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -5400,19 +6682,30 @@ static int _wrap_Session_originate(lua_State* L) { int arg4 ; int result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); - if(!lua_isstring(L,3)) SWIG_fail_arg(3); - if(!lua_isnumber(L,4)) SWIG_fail_arg(4); - arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_originate"); - arg2=(CoreSession *)SWIG_MustGetPtr(L,2,SWIGTYPE_p_CoreSession,0,2,"Session_originate"); - arg3 = (char*)lua_tostring(L, 3); + SWIG_check_num_args("originate",4,4) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("originate",1,"LUA::Session *"); + if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("originate",2,"CoreSession *"); + if(!lua_isstring(L,3)) SWIG_fail_arg("originate",3,"char *"); + if(!lua_isnumber(L,4)) SWIG_fail_arg("originate",4,"int"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ + SWIG_fail_ptr("Session_originate",1,SWIGTYPE_p_LUA__Session); + } + + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_CoreSession,0))){ + SWIG_fail_ptr("Session_originate",2,SWIGTYPE_p_CoreSession); + } + + arg3 = (char *)lua_tostring(L, 3); arg4 = (int)lua_tonumber(L, 4); result = (int)(arg1)->originate(arg2,arg3,arg4); SWIG_arg=0; lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -5424,15 +6717,20 @@ static int _wrap_Session_cb_function_set(lua_State* L) { LUA::Session *arg1 = (LUA::Session *) 0 ; char *arg2 = (char *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_cb_function_set"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("cb_function",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cb_function",1,"LUA::Session *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("cb_function",2,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ + SWIG_fail_ptr("Session_cb_function_set",1,SWIGTYPE_p_LUA__Session); + } + + arg2 = (char *)lua_tostring(L, 2); { if (arg1->cb_function) delete [] arg1->cb_function; if (arg2) { - arg1->cb_function = (char *) (new char[strlen(arg2)+1]); - strcpy((char *) arg1->cb_function,arg2); + arg1->cb_function = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->cb_function, (const char *)arg2); } else { arg1->cb_function = 0; } @@ -5441,6 +6739,8 @@ static int _wrap_Session_cb_function_set(lua_State* L) { return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -5452,13 +6752,20 @@ static int _wrap_Session_cb_function_get(lua_State* L) { LUA::Session *arg1 = (LUA::Session *) 0 ; char *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_cb_function_get"); + SWIG_check_num_args("cb_function",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cb_function",1,"LUA::Session *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ + SWIG_fail_ptr("Session_cb_function_get",1,SWIGTYPE_p_LUA__Session); + } + result = (char *) ((arg1)->cb_function); SWIG_arg=0; - lua_pushstring(L,result); SWIG_arg++; + lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -5470,15 +6777,20 @@ static int _wrap_Session_cb_arg_set(lua_State* L) { LUA::Session *arg1 = (LUA::Session *) 0 ; char *arg2 = (char *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_cb_arg_set"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("cb_arg",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cb_arg",1,"LUA::Session *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("cb_arg",2,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ + SWIG_fail_ptr("Session_cb_arg_set",1,SWIGTYPE_p_LUA__Session); + } + + arg2 = (char *)lua_tostring(L, 2); { if (arg1->cb_arg) delete [] arg1->cb_arg; if (arg2) { - arg1->cb_arg = (char *) (new char[strlen(arg2)+1]); - strcpy((char *) arg1->cb_arg,arg2); + arg1->cb_arg = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->cb_arg, (const char *)arg2); } else { arg1->cb_arg = 0; } @@ -5487,6 +6799,8 @@ static int _wrap_Session_cb_arg_set(lua_State* L) { return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -5498,13 +6812,20 @@ static int _wrap_Session_cb_arg_get(lua_State* L) { LUA::Session *arg1 = (LUA::Session *) 0 ; char *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_cb_arg_get"); + SWIG_check_num_args("cb_arg",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cb_arg",1,"LUA::Session *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ + SWIG_fail_ptr("Session_cb_arg_get",1,SWIGTYPE_p_LUA__Session); + } + result = (char *) ((arg1)->cb_arg); SWIG_arg=0; - lua_pushstring(L,result); SWIG_arg++; + lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -5516,15 +6837,20 @@ static int _wrap_Session_hangup_func_str_set(lua_State* L) { LUA::Session *arg1 = (LUA::Session *) 0 ; char *arg2 = (char *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_hangup_func_str_set"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("hangup_func_str",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangup_func_str",1,"LUA::Session *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("hangup_func_str",2,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ + SWIG_fail_ptr("Session_hangup_func_str_set",1,SWIGTYPE_p_LUA__Session); + } + + arg2 = (char *)lua_tostring(L, 2); { if (arg1->hangup_func_str) delete [] arg1->hangup_func_str; if (arg2) { - arg1->hangup_func_str = (char *) (new char[strlen(arg2)+1]); - strcpy((char *) arg1->hangup_func_str,arg2); + arg1->hangup_func_str = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->hangup_func_str, (const char *)arg2); } else { arg1->hangup_func_str = 0; } @@ -5533,6 +6859,8 @@ static int _wrap_Session_hangup_func_str_set(lua_State* L) { return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -5544,13 +6872,20 @@ static int _wrap_Session_hangup_func_str_get(lua_State* L) { LUA::Session *arg1 = (LUA::Session *) 0 ; char *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_hangup_func_str_get"); + SWIG_check_num_args("hangup_func_str",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangup_func_str",1,"LUA::Session *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ + SWIG_fail_ptr("Session_hangup_func_str_get",1,SWIGTYPE_p_LUA__Session); + } + result = (char *) ((arg1)->hangup_func_str); SWIG_arg=0; - lua_pushstring(L,result); SWIG_arg++; + lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -5562,15 +6897,20 @@ static int _wrap_Session_hangup_func_arg_set(lua_State* L) { LUA::Session *arg1 = (LUA::Session *) 0 ; char *arg2 = (char *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_hangup_func_arg_set"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("hangup_func_arg",2,2) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangup_func_arg",1,"LUA::Session *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("hangup_func_arg",2,"char *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ + SWIG_fail_ptr("Session_hangup_func_arg_set",1,SWIGTYPE_p_LUA__Session); + } + + arg2 = (char *)lua_tostring(L, 2); { if (arg1->hangup_func_arg) delete [] arg1->hangup_func_arg; if (arg2) { - arg1->hangup_func_arg = (char *) (new char[strlen(arg2)+1]); - strcpy((char *) arg1->hangup_func_arg,arg2); + arg1->hangup_func_arg = (char *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->hangup_func_arg, (const char *)arg2); } else { arg1->hangup_func_arg = 0; } @@ -5579,6 +6919,8 @@ static int _wrap_Session_hangup_func_arg_set(lua_State* L) { return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -5590,13 +6932,20 @@ static int _wrap_Session_hangup_func_arg_get(lua_State* L) { LUA::Session *arg1 = (LUA::Session *) 0 ; char *result = 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_hangup_func_arg_get"); + SWIG_check_num_args("hangup_func_arg",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangup_func_arg",1,"LUA::Session *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ + SWIG_fail_ptr("Session_hangup_func_arg_get",1,SWIGTYPE_p_LUA__Session); + } + result = (char *) ((arg1)->hangup_func_arg); SWIG_arg=0; - lua_pushstring(L,result); SWIG_arg++; + lua_pushstring(L,(const char*)result); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -5608,15 +6957,21 @@ static int _wrap_Session_setLUA(lua_State* L) { LUA::Session *arg1 = (LUA::Session *) 0 ; lua_State *arg2 = (lua_State *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); - arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_setLUA"); - arg2=(lua_State *)SWIG_MustGetPtr(L,2,SWIGTYPE_p_lua_State,0,2,"Session_setLUA"); + arg2 = L; + SWIG_check_num_args("setLUA",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setLUA",1,"LUA::Session *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ + SWIG_fail_ptr("Session_setLUA",1,SWIGTYPE_p_LUA__Session); + } + (arg1)->setLUA(arg2); SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -5642,14 +6997,15 @@ static swig_lua_method swig_LUA_Session_methods[] = { {0,0} }; static swig_lua_attribute swig_LUA_Session_attributes[] = { - { "cb_function",_wrap_Session_cb_function_get, _wrap_Session_cb_function_set}, - { "cb_arg",_wrap_Session_cb_arg_get, _wrap_Session_cb_arg_set}, - { "hangup_func_str",_wrap_Session_hangup_func_str_get, _wrap_Session_hangup_func_str_set}, - { "hangup_func_arg",_wrap_Session_hangup_func_arg_get, _wrap_Session_hangup_func_arg_set}, + { "cb_function", _wrap_Session_cb_function_get, _wrap_Session_cb_function_set}, + { "cb_arg", _wrap_Session_cb_arg_get, _wrap_Session_cb_arg_set}, + { "hangup_func_str", _wrap_Session_hangup_func_str_get, _wrap_Session_hangup_func_str_set}, + { "hangup_func_arg", _wrap_Session_hangup_func_arg_get, _wrap_Session_hangup_func_arg_set}, {0,0,0} }; -static swig_lua_class *swig_LUA_Session_bases[] = {&_wrap_class_CoreSession,0}; -swig_lua_class _wrap_class_LUA_Session = { "Session", &SWIGTYPE_p_LUA__Session,_wrap_new_Session, swig_delete_Session, swig_LUA_Session_methods, swig_LUA_Session_attributes, swig_LUA_Session_bases }; +static swig_lua_class *swig_LUA_Session_bases[] = {0,0}; +static const char *swig_LUA_Session_base_names[] = {"CoreSession *",0}; +static swig_lua_class _wrap_class_LUA_Session = { "Session", &SWIGTYPE_p_LUA__Session,_wrap_new_Session, swig_delete_Session, swig_LUA_Session_methods, swig_LUA_Session_attributes, swig_LUA_Session_bases, swig_LUA_Session_base_names }; static int _wrap_new_Dbh__SWIG_0(lua_State* L) { int SWIG_arg = -1; @@ -5658,17 +7014,20 @@ static int _wrap_new_Dbh__SWIG_0(lua_State* L) { char *arg3 = (char *) 0 ; LUA::Dbh *result = 0 ; - if(!lua_isstring(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - if(!lua_isstring(L,3)) SWIG_fail_arg(3); - arg1 = (char*)lua_tostring(L, 1); - arg2 = (char*)lua_tostring(L, 2); - arg3 = (char*)lua_tostring(L, 3); + SWIG_check_num_args("LUA::Dbh",3,3) + if(!lua_isstring(L,1)) SWIG_fail_arg("LUA::Dbh",1,"char *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("LUA::Dbh",2,"char *"); + if(!lua_isstring(L,3)) SWIG_fail_arg("LUA::Dbh",3,"char *"); + arg1 = (char *)lua_tostring(L, 1); + arg2 = (char *)lua_tostring(L, 2); + arg3 = (char *)lua_tostring(L, 3); result = (LUA::Dbh *)new LUA::Dbh(arg1,arg2,arg3); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Dbh,1); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -5681,15 +7040,18 @@ static int _wrap_new_Dbh__SWIG_1(lua_State* L) { char *arg2 = (char *) 0 ; LUA::Dbh *result = 0 ; - if(!lua_isstring(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - arg1 = (char*)lua_tostring(L, 1); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("LUA::Dbh",2,2) + if(!lua_isstring(L,1)) SWIG_fail_arg("LUA::Dbh",1,"char *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("LUA::Dbh",2,"char *"); + arg1 = (char *)lua_tostring(L, 1); + arg2 = (char *)lua_tostring(L, 2); result = (LUA::Dbh *)new LUA::Dbh(arg1,arg2); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Dbh,1); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -5701,13 +7063,16 @@ static int _wrap_new_Dbh__SWIG_2(lua_State* L) { char *arg1 = (char *) 0 ; LUA::Dbh *result = 0 ; - if(!lua_isstring(L,1)) SWIG_fail_arg(1); - arg1 = (char*)lua_tostring(L, 1); + SWIG_check_num_args("LUA::Dbh",1,1) + if(!lua_isstring(L,1)) SWIG_fail_arg("LUA::Dbh",1,"char *"); + arg1 = (char *)lua_tostring(L, 1); result = (LUA::Dbh *)new LUA::Dbh(arg1); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Dbh,1); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -5773,14 +7138,21 @@ static int _wrap_delete_Dbh(lua_State* L) { int SWIG_arg = -1; LUA::Dbh *arg1 = (LUA::Dbh *) 0 ; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(LUA::Dbh *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Dbh,0,1,"delete_Dbh"); + SWIG_check_num_args("LUA::~Dbh",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("LUA::~Dbh",1,"LUA::Dbh *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Dbh,SWIG_POINTER_DISOWN))){ + SWIG_fail_ptr("delete_Dbh",1,SWIGTYPE_p_LUA__Dbh); + } + delete arg1; SWIG_arg=0; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -5792,13 +7164,20 @@ static int _wrap_Dbh_release(lua_State* L) { LUA::Dbh *arg1 = (LUA::Dbh *) 0 ; bool result; - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - arg1=(LUA::Dbh *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Dbh,0,1,"Dbh_release"); + SWIG_check_num_args("release",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("release",1,"LUA::Dbh *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Dbh,0))){ + SWIG_fail_ptr("Dbh_release",1,SWIGTYPE_p_LUA__Dbh); + } + result = (bool)(arg1)->release(); SWIG_arg=0; - lua_pushboolean(L,(int)result); SWIG_arg++; + lua_pushboolean(L,(int)(result==true)); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -5818,11 +7197,16 @@ static int _wrap_Dbh_query(lua_State* L) { }; arg3 = default_swiglua_fn; } - if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); - if(!lua_isstring(L,2)) SWIG_fail_arg(2); - if(lua_gettop(L)>=3 && !lua_isfunction(L,3)) SWIG_fail_arg(3); - arg1=(LUA::Dbh *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Dbh,0,1,"Dbh_query"); - arg2 = (char*)lua_tostring(L, 2); + SWIG_check_num_args("query",2,3) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("query",1,"LUA::Dbh *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("query",2,"char *"); + if(lua_gettop(L)>=3 && !lua_isfunction(L,3)) SWIG_fail_arg("query",3,"SWIGLUA_FN"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Dbh,0))){ + SWIG_fail_ptr("Dbh_query",1,SWIGTYPE_p_LUA__Dbh); + } + + arg2 = (char *)lua_tostring(L, 2); if(lua_gettop(L)>=3){ { (&arg3)->L = L; @@ -5831,9 +7215,11 @@ static int _wrap_Dbh_query(lua_State* L) { } result = (bool)(arg1)->query(arg2,arg3); SWIG_arg=0; - lua_pushboolean(L,(int)result); SWIG_arg++; + lua_pushboolean(L,(int)(result==true)); SWIG_arg++; return SWIG_arg; + if(0) SWIG_fail; + fail: lua_error(L); return SWIG_arg; @@ -5853,7 +7239,8 @@ static swig_lua_attribute swig_LUA_Dbh_attributes[] = { {0,0,0} }; static swig_lua_class *swig_LUA_Dbh_bases[] = {0}; -swig_lua_class _wrap_class_LUA_Dbh = { "Dbh", &SWIGTYPE_p_LUA__Dbh,_wrap_new_Dbh, swig_delete_Dbh, swig_LUA_Dbh_methods, swig_LUA_Dbh_attributes, swig_LUA_Dbh_bases }; +static const char *swig_LUA_Dbh_base_names[] = {0}; +static swig_lua_class _wrap_class_LUA_Dbh = { "Dbh", &SWIGTYPE_p_LUA__Dbh,_wrap_new_Dbh, swig_delete_Dbh, swig_LUA_Dbh_methods, swig_LUA_Dbh_attributes, swig_LUA_Dbh_bases, swig_LUA_Dbh_base_names }; #ifdef __cplusplus } @@ -5862,167 +7249,12 @@ swig_lua_class _wrap_class_LUA_Dbh = { "Dbh", &SWIGTYPE_p_LUA__Dbh,_wrap_new_Dbh static const struct luaL_reg swig_commands[] = { { "consoleLog", _wrap_consoleLog}, { "consoleCleanLog", _wrap_consoleCleanLog}, - { "new_IVRMenu", _wrap_new_IVRMenu}, - { "delete_IVRMenu", _wrap_delete_IVRMenu}, - { "IVRMenu_bindAction", _wrap_IVRMenu_bindAction}, - { "IVRMenu_execute", _wrap_IVRMenu_execute}, - { "new_API", _wrap_new_API}, - { "delete_API", _wrap_delete_API}, - { "API_execute", _wrap_API_execute}, - { "API_executeString", _wrap_API_executeString}, - { "API_getTime", _wrap_API_getTime}, - { "input_callback_state_t_function_set", _wrap_input_callback_state_t_function_set}, - { "input_callback_state_t_function_get", _wrap_input_callback_state_t_function_get}, - { "input_callback_state_t_threadState_set", _wrap_input_callback_state_t_threadState_set}, - { "input_callback_state_t_threadState_get", _wrap_input_callback_state_t_threadState_get}, - { "input_callback_state_t_extra_set", _wrap_input_callback_state_t_extra_set}, - { "input_callback_state_t_extra_get", _wrap_input_callback_state_t_extra_get}, - { "input_callback_state_t_funcargs_set", _wrap_input_callback_state_t_funcargs_set}, - { "input_callback_state_t_funcargs_get", _wrap_input_callback_state_t_funcargs_get}, - { "new_input_callback_state_t", _wrap_new_input_callback_state_t}, - { "delete_input_callback_state_t", _wrap_delete_input_callback_state_t}, - { "DTMF_digit_set", _wrap_DTMF_digit_set}, - { "DTMF_digit_get", _wrap_DTMF_digit_get}, - { "DTMF_duration_set", _wrap_DTMF_duration_set}, - { "DTMF_duration_get", _wrap_DTMF_duration_get}, - { "new_DTMF", _wrap_new_DTMF}, - { "delete_DTMF", _wrap_delete_DTMF}, - { "new_Stream",_wrap_new_Stream}, - { "delete_Stream", _wrap_delete_Stream}, - { "Stream_write", _wrap_Stream_write}, - { "Stream_get_data", _wrap_Stream_get_data}, - { "Event_event_set", _wrap_Event_event_set}, - { "Event_event_get", _wrap_Event_event_get}, - { "Event_serialized_string_set", _wrap_Event_serialized_string_set}, - { "Event_serialized_string_get", _wrap_Event_serialized_string_get}, - { "Event_mine_set", _wrap_Event_mine_set}, - { "Event_mine_get", _wrap_Event_mine_get}, - { "new_Event",_wrap_new_Event}, - { "delete_Event", _wrap_delete_Event}, - { "Event_serialize", _wrap_Event_serialize}, - { "Event_setPriority", _wrap_Event_setPriority}, - { "Event_getHeader", _wrap_Event_getHeader}, - { "Event_getBody", _wrap_Event_getBody}, - { "Event_getType", _wrap_Event_getType}, - { "Event_addBody", _wrap_Event_addBody}, - { "Event_addHeader", _wrap_Event_addHeader}, - { "Event_delHeader", _wrap_Event_delHeader}, - { "Event_fire", _wrap_Event_fire}, - { "EventConsumer_events_set", _wrap_EventConsumer_events_set}, - { "EventConsumer_events_get", _wrap_EventConsumer_events_get}, - { "EventConsumer_e_event_id_set", _wrap_EventConsumer_e_event_id_set}, - { "EventConsumer_e_event_id_get", _wrap_EventConsumer_e_event_id_get}, - { "EventConsumer_e_callback_set", _wrap_EventConsumer_e_callback_set}, - { "EventConsumer_e_callback_get", _wrap_EventConsumer_e_callback_get}, - { "EventConsumer_e_subclass_name_set", _wrap_EventConsumer_e_subclass_name_set}, - { "EventConsumer_e_subclass_name_get", _wrap_EventConsumer_e_subclass_name_get}, - { "EventConsumer_e_cb_arg_set", _wrap_EventConsumer_e_cb_arg_set}, - { "EventConsumer_e_cb_arg_get", _wrap_EventConsumer_e_cb_arg_get}, - { "EventConsumer_enodes_set", _wrap_EventConsumer_enodes_set}, - { "EventConsumer_enodes_get", _wrap_EventConsumer_enodes_get}, - { "EventConsumer_node_index_set", _wrap_EventConsumer_node_index_set}, - { "EventConsumer_node_index_get", _wrap_EventConsumer_node_index_get}, - { "new_EventConsumer", _wrap_new_EventConsumer}, - { "delete_EventConsumer", _wrap_delete_EventConsumer}, - { "EventConsumer_bind", _wrap_EventConsumer_bind}, - { "EventConsumer_pop", _wrap_EventConsumer_pop}, - { "delete_CoreSession", _wrap_delete_CoreSession}, - { "CoreSession_session_set", _wrap_CoreSession_session_set}, - { "CoreSession_session_get", _wrap_CoreSession_session_get}, - { "CoreSession_channel_set", _wrap_CoreSession_channel_set}, - { "CoreSession_channel_get", _wrap_CoreSession_channel_get}, - { "CoreSession_flags_set", _wrap_CoreSession_flags_set}, - { "CoreSession_flags_get", _wrap_CoreSession_flags_get}, - { "CoreSession_allocated_set", _wrap_CoreSession_allocated_set}, - { "CoreSession_allocated_get", _wrap_CoreSession_allocated_get}, - { "CoreSession_cb_state_set", _wrap_CoreSession_cb_state_set}, - { "CoreSession_cb_state_get", _wrap_CoreSession_cb_state_get}, - { "CoreSession_hook_state_set", _wrap_CoreSession_hook_state_set}, - { "CoreSession_hook_state_get", _wrap_CoreSession_hook_state_get}, - { "CoreSession_cause_set", _wrap_CoreSession_cause_set}, - { "CoreSession_cause_get", _wrap_CoreSession_cause_get}, - { "CoreSession_uuid_set", _wrap_CoreSession_uuid_set}, - { "CoreSession_uuid_get", _wrap_CoreSession_uuid_get}, - { "CoreSession_tts_name_set", _wrap_CoreSession_tts_name_set}, - { "CoreSession_tts_name_get", _wrap_CoreSession_tts_name_get}, - { "CoreSession_voice_name_set", _wrap_CoreSession_voice_name_set}, - { "CoreSession_voice_name_get", _wrap_CoreSession_voice_name_get}, - { "CoreSession_answer", _wrap_CoreSession_answer}, - { "CoreSession_preAnswer", _wrap_CoreSession_preAnswer}, - { "CoreSession_hangup", _wrap_CoreSession_hangup}, - { "CoreSession_hangupState", _wrap_CoreSession_hangupState}, - { "CoreSession_setVariable", _wrap_CoreSession_setVariable}, - { "CoreSession_setPrivate", _wrap_CoreSession_setPrivate}, - { "CoreSession_getPrivate", _wrap_CoreSession_getPrivate}, - { "CoreSession_getVariable", _wrap_CoreSession_getVariable}, - { "CoreSession_process_callback_result", _wrap_CoreSession_process_callback_result}, - { "CoreSession_say", _wrap_CoreSession_say}, - { "CoreSession_sayPhrase", _wrap_CoreSession_sayPhrase}, - { "CoreSession_hangupCause", _wrap_CoreSession_hangupCause}, - { "CoreSession_getState", _wrap_CoreSession_getState}, - { "CoreSession_recordFile", _wrap_CoreSession_recordFile}, - { "CoreSession_originate", _wrap_CoreSession_originate}, - { "CoreSession_destroy", _wrap_CoreSession_destroy}, - { "CoreSession_setDTMFCallback", _wrap_CoreSession_setDTMFCallback}, - { "CoreSession_speak", _wrap_CoreSession_speak}, - { "CoreSession_set_tts_parms", _wrap_CoreSession_set_tts_parms}, - { "CoreSession_collectDigits",_wrap_CoreSession_collectDigits}, - { "CoreSession_getDigits",_wrap_CoreSession_getDigits}, - { "CoreSession_transfer", _wrap_CoreSession_transfer}, - { "CoreSession_read", _wrap_CoreSession_read}, - { "CoreSession_playAndGetDigits", _wrap_CoreSession_playAndGetDigits}, - { "CoreSession_streamFile", _wrap_CoreSession_streamFile}, - { "CoreSession_sleep", _wrap_CoreSession_sleep}, - { "CoreSession_flushEvents", _wrap_CoreSession_flushEvents}, - { "CoreSession_flushDigits", _wrap_CoreSession_flushDigits}, - { "CoreSession_setAutoHangup", _wrap_CoreSession_setAutoHangup}, - { "CoreSession_setHangupHook", _wrap_CoreSession_setHangupHook}, - { "CoreSession_ready", _wrap_CoreSession_ready}, - { "CoreSession_bridged", _wrap_CoreSession_bridged}, - { "CoreSession_answered", _wrap_CoreSession_answered}, - { "CoreSession_mediaReady", _wrap_CoreSession_mediaReady}, - { "CoreSession_waitForAnswer", _wrap_CoreSession_waitForAnswer}, - { "CoreSession_execute", _wrap_CoreSession_execute}, - { "CoreSession_sendEvent", _wrap_CoreSession_sendEvent}, - { "CoreSession_setEventData", _wrap_CoreSession_setEventData}, - { "CoreSession_getXMLCDR", _wrap_CoreSession_getXMLCDR}, - { "CoreSession_begin_allow_threads", _wrap_CoreSession_begin_allow_threads}, - { "CoreSession_end_allow_threads", _wrap_CoreSession_end_allow_threads}, - { "CoreSession_get_uuid", _wrap_CoreSession_get_uuid}, - { "CoreSession_get_cb_args", _wrap_CoreSession_get_cb_args}, - { "CoreSession_check_hangup_hook", _wrap_CoreSession_check_hangup_hook}, - { "CoreSession_run_dtmf_callback", _wrap_CoreSession_run_dtmf_callback}, { "console_log", _wrap_console_log}, { "console_clean_log", _wrap_console_clean_log}, { "msleep", _wrap_msleep}, { "bridge", _wrap_bridge}, { "hanguphook", _wrap_hanguphook}, { "dtmf_callback", _wrap_dtmf_callback}, - { "new_Session",_wrap_new_Session}, - { "delete_Session", _wrap_delete_Session}, - { "Session_destroy", _wrap_Session_destroy}, - { "Session_begin_allow_threads", _wrap_Session_begin_allow_threads}, - { "Session_end_allow_threads", _wrap_Session_end_allow_threads}, - { "Session_check_hangup_hook", _wrap_Session_check_hangup_hook}, - { "Session_run_dtmf_callback", _wrap_Session_run_dtmf_callback}, - { "Session_unsetInputCallback", _wrap_Session_unsetInputCallback}, - { "Session_setInputCallback",_wrap_Session_setInputCallback}, - { "Session_setHangupHook",_wrap_Session_setHangupHook}, - { "Session_ready", _wrap_Session_ready}, - { "Session_originate", _wrap_Session_originate}, - { "Session_cb_function_set", _wrap_Session_cb_function_set}, - { "Session_cb_function_get", _wrap_Session_cb_function_get}, - { "Session_cb_arg_set", _wrap_Session_cb_arg_set}, - { "Session_cb_arg_get", _wrap_Session_cb_arg_get}, - { "Session_hangup_func_str_set", _wrap_Session_hangup_func_str_set}, - { "Session_hangup_func_str_get", _wrap_Session_hangup_func_str_get}, - { "Session_hangup_func_arg_set", _wrap_Session_hangup_func_arg_set}, - { "Session_hangup_func_arg_get", _wrap_Session_hangup_func_arg_get}, - { "Session_setLUA", _wrap_Session_setLUA}, - { "new_Dbh",_wrap_new_Dbh}, - { "delete_Dbh", _wrap_delete_Dbh}, - { "Dbh_release", _wrap_Dbh_release}, - { "Dbh_query", _wrap_Dbh_query}, {0,0} }; @@ -6039,10 +7271,9 @@ static swig_lua_const_info swig_constants[] = { /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ -static void *_p_LUA__SessionTo_p_CoreSession(void *x) { +static void *_p_LUA__SessionTo_p_CoreSession(void *x, int *newmemory) { return (void *)((CoreSession *) ((LUA::Session *) x)); } -static swig_type_info _swigt__SWIGLUA_FN = {"_SWIGLUA_FN", "SWIGLUA_FN", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_API = {"_p_API", "API *", 0, 0, (void*)&_wrap_class_API, 0}; static swig_type_info _swigt__p_CoreSession = {"_p_CoreSession", "CoreSession *", 0, 0, (void*)&_wrap_class_CoreSession, 0}; static swig_type_info _swigt__p_DTMF = {"_p_DTMF", "DTMF *", 0, 0, (void*)&_wrap_class_DTMF, 0}; @@ -6051,8 +7282,9 @@ static swig_type_info _swigt__p_EventConsumer = {"_p_EventConsumer", "EventConsu static swig_type_info _swigt__p_IVRMenu = {"_p_IVRMenu", "IVRMenu *", 0, 0, (void*)&_wrap_class_IVRMenu, 0}; static swig_type_info _swigt__p_LUA__Dbh = {"_p_LUA__Dbh", "LUA::Dbh *", 0, 0, (void*)&_wrap_class_LUA_Dbh, 0}; static swig_type_info _swigt__p_LUA__Session = {"_p_LUA__Session", "LUA::Session *", 0, 0, (void*)&_wrap_class_LUA_Session, 0}; +static swig_type_info _swigt__p_SWIGLUA_FN = {"_p_SWIGLUA_FN", "SWIGLUA_FN *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_Stream = {"_p_Stream", "Stream *", 0, 0, (void*)&_wrap_class_Stream, 0}; -static swig_type_info _swigt__p_input_callback_state = {"_p_input_callback_state", "input_callback_state *", 0, 0, (void*)&_wrap_class_input_callback_state_t, 0}; +static swig_type_info _swigt__p_input_callback_state = {"_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void*)&_wrap_class_input_callback_state_t, 0}; static swig_type_info _swigt__p_lua_State = {"_p_lua_State", "lua_State *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_p_switch_event_node_t = {"_p_p_switch_event_node_t", "switch_event_node_t **", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_session_flag_t = {"_p_session_flag_t", "enum session_flag_t *|session_flag_t *", 0, 0, (void*)0, 0}; @@ -6071,15 +7303,8 @@ static swig_type_info _swigt__p_switch_status_t = {"_p_switch_status_t", "switch static swig_type_info _swigt__p_switch_stream_handle_t = {"_p_switch_stream_handle_t", "switch_stream_handle_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_uint32_t = {"_p_uint32_t", "uint32_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__switch_call_cause_t = {"_switch_call_cause_t", "switch_call_cause_t", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__switch_channel_state_t = {"_switch_channel_state_t", "switch_channel_state_t", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__switch_event_types_t = {"_switch_event_types_t", "switch_event_types_t", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__switch_input_type_t = {"_switch_input_type_t", "switch_input_type_t", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__switch_priority_t = {"_switch_priority_t", "switch_priority_t", 0, 0, (void*)0, 0}; -static swig_type_info _swigt__uint32_t = {"_uint32_t", "uint32_t", 0, 0, (void*)0, 0}; static swig_type_info *swig_type_initial[] = { - &_swigt__SWIGLUA_FN, &_swigt__p_API, &_swigt__p_CoreSession, &_swigt__p_DTMF, @@ -6088,6 +7313,7 @@ static swig_type_info *swig_type_initial[] = { &_swigt__p_IVRMenu, &_swigt__p_LUA__Dbh, &_swigt__p_LUA__Session, + &_swigt__p_SWIGLUA_FN, &_swigt__p_Stream, &_swigt__p_input_callback_state, &_swigt__p_lua_State, @@ -6108,15 +7334,8 @@ static swig_type_info *swig_type_initial[] = { &_swigt__p_switch_stream_handle_t, &_swigt__p_uint32_t, &_swigt__p_void, - &_swigt__switch_call_cause_t, - &_swigt__switch_channel_state_t, - &_swigt__switch_event_types_t, - &_swigt__switch_input_type_t, - &_swigt__switch_priority_t, - &_swigt__uint32_t, }; -static swig_cast_info _swigc__SWIGLUA_FN[] = { {&_swigt__SWIGLUA_FN, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_API[] = { {&_swigt__p_API, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_CoreSession[] = { {&_swigt__p_CoreSession, 0, 0, 0}, {&_swigt__p_LUA__Session, _p_LUA__SessionTo_p_CoreSession, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_DTMF[] = { {&_swigt__p_DTMF, 0, 0, 0},{0, 0, 0, 0}}; @@ -6125,6 +7344,7 @@ static swig_cast_info _swigc__p_EventConsumer[] = { {&_swigt__p_EventConsumer, static swig_cast_info _swigc__p_IVRMenu[] = { {&_swigt__p_IVRMenu, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_LUA__Dbh[] = { {&_swigt__p_LUA__Dbh, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_LUA__Session[] = { {&_swigt__p_LUA__Session, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_SWIGLUA_FN[] = { {&_swigt__p_SWIGLUA_FN, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_Stream[] = { {&_swigt__p_Stream, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_input_callback_state[] = { {&_swigt__p_input_callback_state, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_lua_State[] = { {&_swigt__p_lua_State, 0, 0, 0},{0, 0, 0, 0}}; @@ -6145,15 +7365,8 @@ static swig_cast_info _swigc__p_switch_status_t[] = { {&_swigt__p_switch_status static swig_cast_info _swigc__p_switch_stream_handle_t[] = { {&_swigt__p_switch_stream_handle_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_uint32_t[] = { {&_swigt__p_uint32_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__switch_call_cause_t[] = { {&_swigt__switch_call_cause_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__switch_channel_state_t[] = { {&_swigt__switch_channel_state_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__switch_event_types_t[] = { {&_swigt__switch_event_types_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__switch_input_type_t[] = { {&_swigt__switch_input_type_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__switch_priority_t[] = { {&_swigt__switch_priority_t, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__uint32_t[] = { {&_swigt__uint32_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info *swig_cast_initial[] = { - _swigc__SWIGLUA_FN, _swigc__p_API, _swigc__p_CoreSession, _swigc__p_DTMF, @@ -6162,6 +7375,7 @@ static swig_cast_info *swig_cast_initial[] = { _swigc__p_IVRMenu, _swigc__p_LUA__Dbh, _swigc__p_LUA__Session, + _swigc__p_SWIGLUA_FN, _swigc__p_Stream, _swigc__p_input_callback_state, _swigc__p_lua_State, @@ -6182,12 +7396,6 @@ static swig_cast_info *swig_cast_initial[] = { _swigc__p_switch_stream_handle_t, _swigc__p_uint32_t, _swigc__p_void, - _swigc__switch_call_cause_t, - _swigc__switch_channel_state_t, - _swigc__switch_event_types_t, - _swigc__switch_input_type_t, - _swigc__switch_priority_t, - _swigc__uint32_t, }; @@ -6207,7 +7415,7 @@ static swig_cast_info *swig_cast_initial[] = { * structures together. * * The generated swig_type_info structures are assigned staticly to an initial - * array. We just loop though that array, and handle each type individually. + * array. We just loop through that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the * cast linked list. The cast data is initially stored in something like a @@ -6245,32 +7453,58 @@ extern "C" { #define SWIGRUNTIME_DEBUG #endif + SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { size_t i; - swig_module_info *module_head; - static int init_run = 0; + swig_module_info *module_head, *iter; + int found, init; clientdata = clientdata; - if (init_run) return; - init_run = 1; - - /* Initialize the swig_module */ - swig_module.type_initial = swig_type_initial; - swig_module.cast_initial = swig_cast_initial; + /* check to see if the circular list has been setup, if not, set it up */ + if (swig_module.next==0) { + /* Initialize the swig_module */ + swig_module.type_initial = swig_type_initial; + swig_module.cast_initial = swig_cast_initial; + swig_module.next = &swig_module; + init = 1; + } else { + init = 0; + } /* Try and load any already created modules */ module_head = SWIG_GetModule(clientdata); - if (module_head) { + if (!module_head) { + /* This is the first module loaded for this interpreter */ + /* so set the swig module into the interpreter */ + SWIG_SetModule(clientdata, &swig_module); + module_head = &swig_module; + } else { + /* the interpreter has loaded a SWIG module, but has it loaded this one? */ + found=0; + iter=module_head; + do { + if (iter==&swig_module) { + found=1; + break; + } + iter=iter->next; + } while (iter!= module_head); + + /* if the is found in the list, then all is done and we may leave */ + if (found) return; + /* otherwise we must add out module into the list */ swig_module.next = module_head->next; module_head->next = &swig_module; - } else { - /* This is the first module loaded */ - swig_module.next = &swig_module; - SWIG_SetModule(clientdata, &swig_module); } - + + /* When multiple interpeters are used, a module could have already been initialized in + a different interpreter, but not yet have a pointer in this interpreter. + In this case, we do not want to continue adding types... everything should be + set up already */ + if (init == 0) return; + /* Now work on filling in swig_module.types */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: size %d\n", swig_module.size); @@ -6407,73 +7641,56 @@ SWIG_PropagateClientData(void) { /* Forward declaration of where the user's %init{} gets inserted */ +void SWIG_init_user(lua_State* L ); + #ifdef __cplusplus extern "C" { #endif -void SWIG_init_user(lua_State* L ); - /* this is the initialization function - added at the very end of the code - the function is always called SWIG_init, but an eariler #define will rename it + added at the very end of the code + the function is always called SWIG_init, but an eariler #define will rename it */ SWIGEXPORT int SWIG_init(lua_State* L) { - int i; - - /* start with global table */ - lua_pushvalue(L,LUA_GLOBALSINDEX); - - SWIG_InitializeModule((void*)L); - SWIG_PropagateClientData(); - - /* invoke user-specific initialization */ - SWIG_init_user(L); - - /* add a global fn */ - SWIG_Lua_add_function(L,"swig_type",SWIG_Lua_type); - SWIG_Lua_add_function(L,"swig_equals",SWIG_Lua_equal); - - /* begin the module (its a table with the same name as the module) */ - SWIG_Lua_module_begin(L,SWIG_name); - /* add commands/functions */ - for (i = 0; swig_commands[i].name; i++){ - SWIG_Lua_module_add_function(L,swig_commands[i].name,swig_commands[i].func); - } - /*luaL_openlib(L,NULL,swig_commands,0);*/ - /* all in one */ - /*luaL_openlib(L,SWIG_name,swig_commands,0);*/ - /* add variables */ - for (i = 0; swig_variables[i].name; i++){ - SWIG_Lua_module_add_variable(L,swig_variables[i].name,swig_variables[i].get,swig_variables[i].set); - } - - /* additional registration structs & classes in lua: */ - for (i = 0; swig_types[i]; i++){ - if (swig_types[i]->clientdata){ - SWIG_Lua_class_register(L,(swig_lua_class*)(swig_types[i]->clientdata)); - } - } - - /* constants */ - SWIG_Lua_InstallConstants(L,swig_constants); - - /* end module */ - /*SWIG_Lua_module_end(L);*/ - lua_pop(L,1); /* tidy stack (remove module table)*/ - lua_pop(L,1); /* tidy stack (remove global table)*/ - - return 1; -} - -/* Lua 5.1 has a different name for importing libraries -luaopen_XXX, where XXX is the name of the module (not capitalised) -this function will allow Lua 5.1 to import correctly. -There is a #define in the wrapper to rename 'SWIG_import' to the correct name -*/ - -SWIGEXPORT int SWIG_import(lua_State* L) -{ - return SWIG_init(L); + int i; + /* start with global table */ + lua_pushvalue(L,LUA_GLOBALSINDEX); + /* SWIG's internal initalisation */ + SWIG_InitializeModule((void*)L); + SWIG_PropagateClientData(); + /* add a global fn */ + SWIG_Lua_add_function(L,"swig_type",SWIG_Lua_type); + SWIG_Lua_add_function(L,"swig_equals",SWIG_Lua_equal); + /* begin the module (its a table with the same name as the module) */ + SWIG_Lua_module_begin(L,SWIG_name); + /* add commands/functions */ + for (i = 0; swig_commands[i].name; i++){ + SWIG_Lua_module_add_function(L,swig_commands[i].name,swig_commands[i].func); + } + /* add variables */ + for (i = 0; swig_variables[i].name; i++){ + SWIG_Lua_module_add_variable(L,swig_variables[i].name,swig_variables[i].get,swig_variables[i].set); + } + /* set up base class pointers (the hierachy) */ + for (i = 0; swig_types[i]; i++){ + if (swig_types[i]->clientdata){ + SWIG_Lua_init_base_class(L,(swig_lua_class*)(swig_types[i]->clientdata)); + } + } + /* additional registration structs & classes in lua */ + for (i = 0; swig_types[i]; i++){ + if (swig_types[i]->clientdata){ + SWIG_Lua_class_register(L,(swig_lua_class*)(swig_types[i]->clientdata)); + } + } + /* constants */ + SWIG_Lua_InstallConstants(L,swig_constants); + /* invoke user-specific initialization */ + SWIG_init_user(L); + /* end module */ + lua_pop(L,1); /* tidy stack (remove module table)*/ + lua_pop(L,1); /* tidy stack (remove global table)*/ + return 1; } #ifdef __cplusplus @@ -6481,12 +7698,13 @@ SWIGEXPORT int SWIG_import(lua_State* L) #endif -#ifdef __cplusplus -extern "C" -#endif +const char* SWIG_LUACODE= + ""; + void SWIG_init_user(lua_State* L) { - + /* exec Lua code if applicable */ + SWIG_Lua_dostring(L,SWIG_LUACODE); } #include "mod_lua_extra.c" commit d5ff3e04ab34475a66b75363db921b6100b6c257 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Sep 10 11:59:47 2010 -0500 include accumulated stats from rtcp into vars diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 5a88cd5..c3b649c 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -479,9 +479,16 @@ typedef struct { switch_size_t flush_packet_count; } switch_rtp_numbers_t; + +typedef struct { + uint32_t packet_count; + uint32_t octet_count; +} switch_rtcp_numbers_t; + typedef struct { switch_rtp_numbers_t inbound; switch_rtp_numbers_t outbound; + switch_rtcp_numbers_t rtcp; } switch_rtp_stats_t; typedef enum { diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 473dfb9..8054c8d 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -2238,6 +2238,9 @@ static void set_stats(switch_rtp_t *rtp_session, private_object_t *tech_pvt, con add_stat(stats->outbound.dtmf_packet_count, "out_dtmf_packet_count"); add_stat(stats->outbound.cng_packet_count, "out_cng_packet_count"); + add_stat(stats->rtcp.packet_count, "rtcp_packet_count"); + add_stat(stats->rtcp.octet_count, "rtcp_octet_count"); + } } diff --git a/src/switch_rtp.c b/src/switch_rtp.c index c9f9bfa..710415a 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -2191,6 +2191,9 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t rtp_session->rtcp_fresh_frame = 1; + rtp_session->stats.rtcp.packet_count += sr->pc; + rtp_session->stats.rtcp.octet_count += sr->oc; + /* sender report */ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10,"Received a SR with %d report blocks, " \ "length in words = %d, " \ commit 5bb007889c0713eb42cc93050995b50fa8bd7c6f Author: Moises Silva <moy@sangoma.com> Date: Fri Sep 10 12:15:34 2010 -0400 update sangoma codec XML sample configuration file diff --git a/conf/autoload_configs/sangoma_codec.conf.xml b/conf/autoload_configs/sangoma_codec.conf.xml index da4b8ed..14fae63 100644 --- a/conf/autoload_configs/sangoma_codec.conf.xml +++ b/conf/autoload_configs/sangoma_codec.conf.xml @@ -8,25 +8,22 @@ <param name="register" value="all"/> --> - <!-- List of codecs to not register with FreeSWITCH, by default this is empty, + <!-- + List of codecs to not register with FreeSWITCH, by default this is empty, but you may want to not load PCMU and PCMA or may be others to not use your vocallo resources in codecs that are done well and fast in software. <param name="noregister" value="PCMU,PCMA"/> --> - </settings> - - <vocallos> - - <!-- The name of the vocallo is the ethernet device name as displayed by ifconfig --> - <vocallo name="eth5"> - <!-- Starting UDP port for the vocallo --> - <param name="baseudp" value="5000"/> - <!-- Starting IP address to use for the vocallo modules --> - <param name="vocalloaddr" value="10.1.1.100"/> - </vocallo> - - </vocallos> + <!-- + Transcoding SOAP server URL. If you are installing the soap server (sngtc_server) + in the same box where FreeSWITCH, do not use this value, the default URL + that is hard-coded will work out of the box for local installations. + If you modify this value, you must configure your SOAP server (/etc/sngtc/sngtc_server.conf.xml) + to listen for HTTP requests on the same IP/port that you specify here. + <param name="soapserver" value="http://192.168.1.100:8080"/> + --> + </settings> </configuration> commit e6d6045ba611785e0e2126fdcfb2daf9c641e260 Author: Konrad Hammel <konrad@sangoma.com> Date: Fri Sep 10 11:43:06 2010 -0400 freetdm: ss7 - updated mtp3 alarms to print link name instead of sapid diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c index 1179ed9..17e32c7 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c @@ -351,15 +351,35 @@ void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta) /******************************************************************************/ void handle_sng_mtp3_alarm(Pst *pst, SnMngmt *sta) { + char buf[50]; + int x = 1; + + memset(buf, '\0', sizeof(buf)); switch (sta->hdr.elmId.elmnt) { /**************************************************************************/ case (STDLSAP): + + /* find the name for the sap in question */ + x = 1; + while (g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) { + if (g_ftdm_sngss7_data.cfg.mtpLink[x].id == sta->hdr.elmId.elmntInst1) { + break; + } + x++; + } + + if (g_ftdm_sngss7_data.cfg.mtpLink[x].id == 0) { + sprintf(buf, "[SAPID:%d]", sta->hdr.elmId.elmntInst1); + } else { + sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtpLink[x].name); + } + switch (sta->t.usta.alarm.event) { /**********************************************************************/ case (LSN_EVENT_INV_OPC_OTHER_END): - ftdm_log(FTDM_LOG_ERROR,"[MTP3][SAPID:%d] %s : %s : OPC(0x%X%X%X%X)\n", - sta->hdr.elmId.elmntInst1, + ftdm_log(FTDM_LOG_ERROR,"[MTP3]%s %s : %s : OPC(0x%X%X%X%X)\n", + buf, DECODE_LSN_EVENT(sta->t.usta.alarm.event), DECODE_LSN_CAUSE(sta->t.usta.alarm.cause), sta->t.usta.evntParm[3], @@ -369,16 +389,16 @@ void handle_sng_mtp3_alarm(Pst *pst, SnMngmt *sta) break; /**********************************************************************/ case (LSN_EVENT_INV_SLC_OTHER_END): - ftdm_log(FTDM_LOG_ERROR,"[MTP3][SAPID:%d] %s : %s : SLC(%d)\n", - sta->hdr.elmId.elmntInst1, + ftdm_log(FTDM_LOG_ERROR,"[MTP3]%s %s : %s : SLC(%d)\n", + buf, DECODE_LSN_EVENT(sta->t.usta.alarm.event), DECODE_LSN_CAUSE(sta->t.usta.alarm.cause), sta->t.usta.evntParm[0]); break; /**********************************************************************/ default: - ftdm_log(FTDM_LOG_ERROR,"[MTP3][SAPID:%d] %s(%d) : %s(%d)\n", - sta->hdr.elmId.elmntInst1, + ftdm_log(FTDM_LOG_ERROR,"[MTP3]%s %s(%d) : %s(%d)\n", + buf, DECODE_LSN_EVENT(sta->t.usta.alarm.event), sta->t.usta.alarm.event, DECODE_LSN_CAUSE(sta->t.usta.alarm.cause), commit 5680d93a2243cf06a41e2f79f257cb65d53fcfd6 Author: Konrad Hammel <konrad@sangoma.com> Date: Fri Sep 10 11:35:43 2010 -0400 freetdm: ss7 - increase mtp2 T7 default value, printing link name now for mtp2 Alarms diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c index b666f72..1179ed9 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c @@ -109,6 +109,10 @@ void handle_sng_mtp1_alarm(Pst *pst, L1Mngmt *sta) /******************************************************************************/ void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta) { + char buf[50]; + int x = 1; + + memset(buf, '\0', sizeof(buf)); switch (sta->t.usta.alarm.category) { /**************************************************************************/ @@ -126,23 +130,39 @@ void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta) case (LSD_EVENT_REMOTE_CONG_END): case (LSD_EVENT_RX_REMOTE_SIPO): + /* find the name for the sap in question */ + x = 1; + while (g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) { + if (g_ftdm_sngss7_data.cfg.mtpLink[x].id == sta->t.usta.evntParm[0]) { + break; + } + x++; + } + + if (g_ftdm_sngss7_data.cfg.mtpLink[x].id == 0) { + sprintf(buf, "[SAPID:%d]", sta->t.usta.evntParm[0]); + } else { + sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtpLink[x].name); + } + + switch (sta->t.usta.alarm.cause) { /******************************************************************/ case (LCM_CAUSE_UNKNOWN): - ftdm_log(FTDM_LOG_ERROR,"[MTP2][SAPID:%d] %s\n", - sta->t.usta.evntParm[0], + ftdm_log(FTDM_LOG_ERROR,"[MTP2]%s %s\n", + buf, DECODE_LSD_EVENT(sta->t.usta.alarm.event)); break; /******************************************************************/ case (LCM_CAUSE_MGMT_INITIATED): - ftdm_log(FTDM_LOG_ERROR,"[MTP2][SAPID:%d][MGMT] %s\n", - sta->t.usta.evntParm[0], + ftdm_log(FTDM_LOG_ERROR,"[MTP2]%s[MGMT] %s\n", + buf, DECODE_LSD_EVENT(sta->t.usta.alarm.event)); break; /******************************************************************/ default: - ftdm_log(FTDM_LOG_ERROR,"[MTP2][SAPID:%d] %s (***unknown cause***)\n", - sta->t.usta.evntParm[0], + ftdm_log(FTDM_LOG_ERROR,"[MTP2]%s %s (***unknown cause***)\n", + buf, DECODE_LSD_EVENT(sta->t.usta.alarm.event)); break; /******************************************************************/ @@ -150,23 +170,71 @@ void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta) break; /**********************************************************************/ case (LSD_EVENT_PROT_ERR): - ftdm_log(FTDM_LOG_ERROR,"[MTP2][SAPID:%d] %s : %s\n", - sta->t.usta.evntParm[0], + + /* find the name for the sap in question */ + x = 1; + while (g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) { + if (g_ftdm_sngss7_data.cfg.mtpLink[x].id == sta->t.usta.evntParm[0]) { + break; + } + x++; + } + + if (g_ftdm_sngss7_data.cfg.mtpLink[x].id == 0) { + sprintf(buf, "[SAPID:%d]", sta->t.usta.evntParm[0]); + } else { + sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtpLink[x].name); + } + + ftdm_log(FTDM_LOG_ERROR,"[MTP2]%s %s : %s\n", + buf, DECODE_LSD_EVENT(sta->t.usta.alarm.event), DECODE_LSD_CAUSE(sta->t.usta.alarm.cause)); break; /**********************************************************************/ case (LSD_EVENT_ALIGN_LOST): - ftdm_log(FTDM_LOG_ERROR,"[MTP2][SAPID:%d] %s : %s\n", - sta->t.usta.evntParm[0], + + /* find the name for the sap in question */ + x = 1; + while (g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) { + if (g_ftdm_sngss7_data.cfg.mtpLink[x].id == sta->t.usta.evntParm[0]) { + break; + } + x++; + } + + if (g_ftdm_sngss7_data.cfg.mtpLink[x].id == 0) { + sprintf(buf, "[SAPID:%d]", sta->t.usta.evntParm[0]); + } else { + sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtpLink[x].name); + } + + ftdm_log(FTDM_LOG_ERROR,"[MTP2]%s %s : %s\n", + buf, DECODE_LSD_EVENT(sta->t.usta.alarm.event), DECODE_DISC_REASON(sta->t.usta.evntParm[1])); break; /**********************************************************************/ case (LSD_EVENT_RTB_FULL): case (LSD_EVENT_RTB_FULL_OVER): - ftdm_log(FTDM_LOG_ERROR,"[MTP2][SAPID:%d] %s : RTB Queue Len(%d)|Oldest BSN(%d)|Tx Queue Len(%d)|Outstanding Frames(%d)\n", - sta->t.usta.evntParm[0], + + /* find the name for the sap in question */ + x = 1; + while (g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) { + if (g_ftdm_sngss7_data.cfg.mtpLink[x].id == sta->t.usta.evntParm[0]) { + break; + } + x++; + } + + if (g_ftdm_sngss7_data.cfg.mtpLink[x].id == 0) { + sprintf(buf, "[SAPID:%d]", sta->t.usta.evntParm[0]); + } else { + sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtpLink[x].name); + } + + ftdm_log(FTDM_LOG_ERROR,"[MTP2]%s %s : RTB Queue Len(%d)|Oldest BSN(%d)|Tx Queue Len(%d)|Outstanding Frames(%d)\n", + buf, DECODE_LSD_EVENT(sta->t.usta.alarm.event), sta->t.usta.evntParm[1], sta->t.usta.evntParm[2], @@ -175,15 +243,47 @@ void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta) break; /**********************************************************************/ case (LSD_EVENT_NEG_ACK): - ftdm_log(FTDM_LOG_ERROR,"[MTP2][SAPID:%d] %s : RTB Queue Len(%d)\n", - sta->t.usta.evntParm[0], + + /* find the name for the sap in question */ + x = 1; + while (g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) { + if (g_ftdm_sngss7_data.cfg.mtpLink[x].id == sta->t.usta.evntParm[0]) { + break; + } + x++; + } + + if (g_ftdm_sngss7_data.cfg.mtpLink[x].id == 0) { + sprintf(buf, "[SAPID:%d]", sta->t.usta.evntParm[0]); + } else { + sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtpLink[x].name); + } + + ftdm_log(FTDM_LOG_ERROR,"[MTP2]%s %s : RTB Queue Len(%d)\n", + buf, DECODE_LSD_EVENT(sta->t.usta.alarm.event), sta->t.usta.evntParm[1]); break; /**********************************************************************/ case (LSD_EVENT_DAT_CFM_SDT): - ftdm_log(FTDM_LOG_ERROR,"[MTP2][SAPID:%d] %s : %d\n", - sta->t.usta.evntParm[0], + + /* find the name for the sap in question */ + x = 1; + while (g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) { + if (g_ftdm_sngss7_data.cfg.mtpLink[x].id == sta->t.usta.evntParm[0]) { + break; + } + x++; + } + + if (g_ftdm_sngss7_data.cfg.mtpLink[x].id == 0) { + sprintf(buf, "[SAPID:%d]", sta->t.usta.evntParm[0]); + } else { + sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtpLink[x].name); + } + + ftdm_log(FTDM_LOG_ERROR,"[MTP2]%s %s : %d\n", + buf, DECODE_LSD_EVENT(sta->t.usta.alarm.event), DECODE_DISC_REASON(sta->t.usta.evntParm[1])); break; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c index 4c1832d..cf0bf7c 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c @@ -965,7 +965,7 @@ static int ftmod_ss7_fill_in_mtpLink(sng_mtp_link_t *mtpLink) if ( mtpLink->mtp2.t7 != 0 ) { g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t7 = mtpLink->mtp2.t7; }else { - g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t7 = 20; + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t7 = 40; } if (mtpLink->mtp3.t1 != 0) { commit 83aeda7956943bff4556202dc182d59b8e96a83a Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Thu Sep 9 23:40:14 2010 -0400 mod_voicemail: Allow to forward a message or send it via email key during the playback of the recording, not just when the menu is playing. diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index c683712..e89bda4 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -824,7 +824,8 @@ static switch_status_t control_playback(switch_core_session_t *session, void *in if (!cc->noexit && (dtmf->digit == *cc->profile->delete_file_key || dtmf->digit == *cc->profile->save_file_key || dtmf->digit == *cc->profile->prev_msg_key || dtmf->digit == *cc->profile->next_msg_key - || dtmf->digit == *cc->profile->terminator_key || dtmf->digit == *cc->profile->skip_info_key)) { + || dtmf->digit == *cc->profile->terminator_key || dtmf->digit == *cc->profile->skip_info_key + || dtmf->digit == *cc->profile->email_key || dtmf->digit == *cc->profile->forward_key)) { *cc->buf = dtmf->digit; return SWITCH_STATUS_BREAK; } commit 1a75821df8477cb3a7d959034f3d550076ffcbca Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Thu Sep 9 23:25:35 2010 -0400 switch_loadable_module: Add attribute "path" to autoload_configs/modules.conf.xml <load> entry. Useful for module made outside of fs source tree like mod_com_g729. When you delete your lib bin mod folder after a clean install, you don't have to remember to recopy mod_com_g729 if located in mod_com folder. diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 6732564..bf636dd 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -1277,6 +1277,7 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init() for (ld = switch_xml_child(mods, "load"); ld; ld = ld->next) { switch_bool_t global = SWITCH_FALSE; const char *val = switch_xml_attr_soft(ld, "module"); + const char *path = switch_xml_attr_soft(ld, "path"); const char *critical = switch_xml_attr_soft(ld, "critical"); const char *sglobal = switch_xml_attr_soft(ld, "global"); if (zstr(val) || (strchr(val, '.') && !strstr(val, ext) && !strstr(val, EXT))) { @@ -1285,7 +1286,10 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init() } global = switch_true(sglobal); - if (switch_loadable_module_load_module_ex((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) val, SWITCH_FALSE, global, &err) == SWITCH_STATUS_FALSE) { + if (path && zstr(path)) { + path = SWITCH_GLOBAL_dirs.mod_dir; + } + if (switch_loadable_module_load_module_ex((char *) path, (char *) val, SWITCH_FALSE, global, &err) == SWITCH_STATUS_FALSE) { if (critical && switch_true(critical)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to load critical module '%s', abort()\n", val); abort(); @@ -1307,13 +1311,18 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init() for (ld = switch_xml_child(mods, "load"); ld; ld = ld->next) { switch_bool_t global = SWITCH_FALSE; const char *val = switch_xml_attr_soft(ld, "module"); + const char *path = switch_xml_attr_soft(ld, "path"); const char *sglobal = switch_xml_attr_soft(ld, "global"); if (zstr(val) || (strchr(val, '.') && !strstr(val, ext) && !strstr(val, EXT))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Invalid extension for %s\n", val); continue; } global = switch_true(sglobal); - switch_loadable_module_load_module_ex((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) val, SWITCH_FALSE, global, &err); + + if (path && zstr(path)) { + path = SWITCH_GLOBAL_dirs.mod_dir; + } + switch_loadable_module_load_module_ex((char *) path, (char *) val, SWITCH_FALSE, global, &err); count++; } } commit 163ca31f2c0e7bb4f3e71806fac8147f3c426fc4 Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Thu Sep 9 22:43:27 2010 -0400 mod_directory: Add variable directory_search_order to allow to search by first name by default is set to "first_name" diff --git a/src/mod/applications/mod_directory/mod_directory.c b/src/mod/applications/mod_directory/mod_directory.c index d3389ab..bfad1a6 100644 --- a/src/mod/applications/mod_directory/mod_directory.c +++ b/src/mod/applications/mod_directory/mod_directory.c @@ -884,6 +884,18 @@ SWITCH_STANDARD_APP(directory_function) if (strcasecmp(profile->search_order, "last_name")) { s_param.search_by_last_name = 0; } + + { + const char *var_search_order = switch_channel_get_variable(channel, "directory_search_order"); + if (var_search_order) { + if (!strcasecmp(var_search_order, "first_name")) { + s_param.search_by_last_name = 0; + } else { + s_param.search_by_last_name = 1; + } + } + } + attempts = profile->max_menu_attempt; s_param.try_again = 1; while (switch_channel_ready(channel) && (s_param.try_again && attempts-- > 0)) { commit 29843a6e4ad565c03bfc525c13eafdf4d0aa2c36 Author: Konrad Hammel <konrad@sangoma.com> Date: Thu Sep 9 21:45:51 2010 -0400 freetdm: ss7 -bug fix diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index a47656f..b5fe619 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -1240,6 +1240,7 @@ static ftdm_status_t ftdm_sangoma_ss7_start(ftdm_span_t * span) for (x = 1; x < (span->chan_count + 1); x++) { /* extract the channel structure and sngss7 channel data */ ftdmchan = span->channels[x]; + if (ftdmchan->call_data == NULL) continue; sngss7_info = ftdmchan->call_data; sngss7_span = ftdmchan->span->mod_data; commit 71f142744714968acf672da37a3308dc3d6ce284 Author: Konrad Hammel <konrad@sangoma.com> Date: Thu Sep 9 21:22:18 2010 -0400 freetdm: ss7 - bug fix in configuration diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c index 9c9947d..21ab1d3 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c @@ -644,7 +644,7 @@ int ftmod_ss7_mtp2_dlsap_config(int id) cfg.t.cfg.s.sdDLSAP.memMac.region = S_REG; /* memory region and pool id for MAC */ cfg.t.cfg.s.sdDLSAP.memMac.pool = S_POOL; cfg.t.cfg.s.sdDLSAP.maxOutsFrms = MAX_SD_OUTSTANDING; /* maximum outstanding frames */ - cfg.t.cfg.s.sdDLSAP.errType = SD_ERR_NRM; + cfg.t.cfg.s.sdDLSAP.errType = k->mtp2.errorType; cfg.t.cfg.s.sdDLSAP.t1.enb = TRUE; /* timer 1 - Alignment Ready Timer */ cfg.t.cfg.s.sdDLSAP.t1.val = k->mtp2.t1; cfg.t.cfg.s.sdDLSAP.t2.enb = TRUE; /* timer 2 - Not Aligned Timer */ commit f9d44d3bfd6d6026cb1e3216e965a7e233e69a0f Merge: 7eae2b6 402f239 Author: Leon de Rooij <leon@toyos.nl> Date: Fri Sep 10 03:00:43 2010 +0200 Merge branch 'master' of ssh://git.freeswitch.org/freeswitch commit 7eae2b629e43a6ddf48657286895588689057494 Author: Leon de Rooij <leon@toyos.nl> Date: Fri Sep 10 02:58:37 2010 +0200 mod_lua: cannot assume idx != 0 if cb_fun is provided diff --git a/src/mod/languages/mod_lua/freeswitch_lua.cpp b/src/mod/languages/mod_lua/freeswitch_lua.cpp index 8321f87..d60ae73 100644 --- a/src/mod/languages/mod_lua/freeswitch_lua.cpp +++ b/src/mod/languages/mod_lua/freeswitch_lua.cpp @@ -367,7 +367,7 @@ int Dbh::query_callback(void *pArg, int argc, char **argv, char **cargv) bool Dbh::query(char *sql, SWIGLUA_FN lua_fun) { if (connected) { - if (lua_fun.L && lua_fun.idx != 0) { + if (lua_fun.L) { if (switch_cache_db_execute_sql_callback(dbh, sql, query_callback, &lua_fun, NULL) == SWITCH_STATUS_SUCCESS) { return true; } commit 05eb47abf1e1f31d118bf7d3b87cd1d8248b44ac Author: Konrad Hammel <konrad@sangoma.com> Date: Thu Sep 9 20:55:38 2010 -0400 freetdm: ss7 - update to configuration diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c index 93bd315..9c9947d 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c @@ -925,6 +925,7 @@ int ftmod_ss7_mtp3_linkset_config(int id) { Pst pst; SnMngmt cfg; + int c; sng_link_set_t *k = &g_ftdm_sngss7_data.cfg.mtpLinkSet[id]; /* initalize the post structure */ @@ -951,9 +952,11 @@ int ftmod_ss7_mtp3_linkset_config(int id) cfg.t.cfg.s.snLnkSet.lnkSetType = k->linkType; /* link type */ cfg.t.cfg.s.snLnkSet.adjDpc = k->apc; /* adjacent DPC */ cfg.t.cfg.s.snLnkSet.nmbActLnkReqd = k->minActive; /* minimum number of active links */ - cfg.t.cfg.s.snLnkSet.nmbCmbLnkSet = 1; /* number of combined link sets */ - cfg.t.cfg.s.snLnkSet.cmbLnkSet[0].cmbLnkSetId = k->cmbLinkSetId; - cfg.t.cfg.s.snLnkSet.cmbLnkSet[0].lnkSetPrior = 0; + cfg.t.cfg.s.snLnkSet.nmbCmbLnkSet = k->numLinks; /* number of combined link sets */ + for(c = 0; c < k->numLinks;c++) { + cfg.t.cfg.s.snLnkSet.cmbLnkSet[c].cmbLnkSetId = k->links[c]; + cfg.t.cfg.s.snLnkSet.cmbLnkSet[c].lnkSetPrior = 0; + } return(sng_cfg_mtp3(&pst, &cfg)); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index 9986b29..a47656f 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -1390,6 +1390,8 @@ static FIO_SIG_LOAD_FUNCTION(ftdm_sangoma_ss7_init) sngss7_id = 0; + cmbLinkSetId = 1; + /* initalize the global gen_config flag */ g_ftdm_sngss7_data.gen_config = 0; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index f76a560..555c0d9 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -162,7 +162,8 @@ typedef struct sng_link_set { uint32_t flags; uint32_t apc; uint32_t linkType; - uint32_t cmbLinkSetId; + uint32_t switchType; + uint32_t ssf; uint32_t minActive; uint32_t numLinks; uint32_t links[16]; @@ -174,6 +175,7 @@ typedef struct sng_route { uint32_t flags; uint32_t dpc; uint32_t cmbLinkSetId; + uint32_t linkSetId; uint32_t linkType; uint32_t switchType; uint32_t ssf; @@ -421,6 +423,7 @@ typedef enum { extern ftdm_sngss7_data_t g_ftdm_sngss7_data; extern uint32_t sngss7_id; extern ftdm_sched_t *sngss7_sched; +extern int cmbLinkSetId; /******************************************************************************/ /* PROTOTYPES *****************************************************************/ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c index 66907e7..4c1832d 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c @@ -46,6 +46,8 @@ typedef struct sng_timeslot int gap; int hole; }sng_timeslot_t; + +int cmbLinkSetId; /******************************************************************************/ /* PROTOTYPES *****************************************************************/ @@ -385,8 +387,6 @@ static int ftmod_ss7_parse_mtp_linkset(ftdm_conf_node_t *mtp_linkset) if (count < 1 || count > 15 ) { SS7_ERROR("Invalid number of mtp_links found (%d)\n", count); return FTDM_FAIL; - } else { - mtpLinkSet.numLinks = count; } /* now we need to see if this linkset exists already or not and grab an Id */ @@ -418,8 +418,7 @@ static int ftmod_ss7_parse_mtp_linkset(ftdm_conf_node_t *mtp_linkset) mtpLink[i].mtp3.apc = mtpLinkSet.apc; mtpLink[i].mtp3.linkSetId = mtpLinkSet.id; - /* fill in the mtplink structure */ - mtpLinkSet.links[count] = ftmod_ss7_fill_in_mtpLink(&mtpLink[i]); + ftmod_ss7_fill_in_mtpLink(&mtpLink[i]); /* increment the links counter */ count++; @@ -428,6 +427,10 @@ static int ftmod_ss7_parse_mtp_linkset(ftdm_conf_node_t *mtp_linkset) i++; } + mtpLinkSet.linkType = mtpLink[0].mtp3.linkType; + mtpLinkSet.switchType = mtpLink[0].mtp3.switchType; + mtpLinkSet.ssf = mtpLink[0].mtp3.ssf; + ftmod_ss7_fill_in_mtpLinkSet(&mtpLinkSet); return FTDM_SUCCESS; @@ -658,14 +661,17 @@ static int ftmod_ss7_parse_mtp_route(ftdm_conf_node_t *mtp_route) /* check if the name matches */ if (!strcasecmp((char *)g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name, parm->val)) { - /* grab the mtpLink id value first*/ - int id = g_ftdm_sngss7_data.cfg.mtpLinkSet[x].links[0]; - /* now, harvest the required infomormation from the global structure */ - mtpRoute.linkType = g_ftdm_sngss7_data.cfg.mtpLink[id].mtp3.linkType; - mtpRoute.switchType = g_ftdm_sngss7_data.cfg.mtpLink[id].mtp3.switchType; - mtpRoute.ssf = g_ftdm_sngss7_data.cfg.mtpLink[id].mtp3.ssf; - mtpRoute.cmbLinkSetId = g_ftdm_sngss7_data.cfg.mtpLinkSet[x].cmbLinkSetId; + mtpRoute.linkType = g_ftdm_sngss7_data.cfg.mtpLinkSet[x].linkType; + mtpRoute.switchType = g_ftdm_sngss7_data.cfg.mtpLinkSet[x].switchType; + mtpRoute.ssf = g_ftdm_sngss7_data.cfg.mtpLinkSet[x].ssf; + mtpRoute.linkSetId = g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id; + cmbLinkSetId++; + mtpRoute.cmbLinkSetId = cmbLinkSetId; + + /* update the linkset with the new cmbLinkSet value */ + g_ftdm_sngss7_data.cfg.mtpLinkSet[x].numLinks++; + g_ftdm_sngss7_data.cfg.mtpLinkSet[x].links[g_ftdm_sngss7_data.cfg.mtpLinkSet[x].numLinks-1] = mtpRoute.cmbLinkSetId; break; } x++; @@ -701,9 +707,11 @@ static int ftmod_ss7_parse_mtp_route(ftdm_conf_node_t *mtp_route) parm = parm + 1; } + ftmod_ss7_fill_in_nsap(&mtpRoute); + ftmod_ss7_fill_in_mtp3_route(&mtpRoute); - ftmod_ss7_fill_in_nsap(&mtpRoute); + return FTDM_SUCCESS; } @@ -747,7 +755,6 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface) int num_parms = isup_interface->n_parameters; int i; int linkSetId; - int linkId; memset(&sng_isup, 0x0, sizeof(sng_isup)); memset(&sng_isap, 0x0, sizeof(sng_isap)); @@ -844,10 +851,15 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface) } /* trickle down the SPC to all sub entities */ - linkSetId = g_ftdm_sngss7_data.cfg.mtpRoute[sng_isup.mtpRouteId].cmbLinkSetId; - for (i = 0; i < g_ftdm_sngss7_data.cfg.mtpLinkSet[linkSetId].numLinks; i ++) { - linkId = g_ftdm_sngss7_data.cfg.mtpLinkSet[linkSetId].links[i]; - g_ftdm_sngss7_data.cfg.mtpLink[linkId].mtp3.spc = g_ftdm_sngss7_data.cfg.spc; + linkSetId = g_ftdm_sngss7_data.cfg.mtpRoute[sng_isup.mtpRouteId].linkSetId; + + i = 1; + while (g_ftdm_sngss7_data.cfg.mtpLink[i].id != 0) { + if (g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.linkSetId == linkSetId) { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.spc = g_ftdm_sngss7_data.cfg.spc; + } + + i++; } ftmod_ss7_fill_in_isap(&sng_isap); @@ -1053,22 +1065,19 @@ static int ftmod_ss7_fill_in_mtpLink(sng_mtp_link_t *mtpLink) /******************************************************************************/ static int ftmod_ss7_fill_in_mtpLinkSet(sng_link_set_t *mtpLinkSet) { - int count; int i = mtpLinkSet->id; strcpy((char *)g_ftdm_sngss7_data.cfg.mtpLinkSet[i].name, (char *)mtpLinkSet->name); g_ftdm_sngss7_data.cfg.mtpLinkSet[i].id = mtpLinkSet->id; g_ftdm_sngss7_data.cfg.mtpLinkSet[i].apc = mtpLinkSet->apc; - g_ftdm_sngss7_data.cfg.mtpLinkSet[i].linkType = g_ftdm_sngss7_data.cfg.mtpLink[1].mtp3.linkType; /* KONRAD FIX ME */ - g_ftdm_sngss7_data.cfg.mtpLinkSet[i].cmbLinkSetId = mtpLinkSet->id; - g_ftdm_sngss7_data.cfg.mtpLinkSet[i].minActive = mtpLinkSet->minActive; - g_ftdm_sngss7_data.cfg.mtpLinkSet[i].numLinks = mtpLinkSet->numLinks; - - for (count = 0; count < mtpLinkSet->numLinks; count++) { - g_ftdm_sngss7_data.cfg.mtpLinkSet[i].links[count] = mtpLinkSet->links[count]; - } + g_ftdm_sngss7_data.cfg.mtpLinkSet[i].linkType = mtpLinkSet->linkType; + g_ftdm_sngss7_data.cfg.mtpLinkSet[i].switchType = mtpLinkSet->switchType; + g_ftdm_sngss7_data.cfg.mtpLinkSet[i].ssf = mtpLinkSet->ssf; + /* these values are filled in as we find routes and start allocating cmbLinkSetIds */ + g_ftdm_sngss7_data.cfg.mtpLinkSet[i].minActive = mtpLinkSet->minActive; + g_ftdm_sngss7_data.cfg.mtpLinkSet[i].numLinks = 0; return 0; } @@ -1104,6 +1113,8 @@ static int ftmod_ss7_fill_in_mtp3_route(sng_route_t *mtp3_route) g_ftdm_sngss7_data.cfg.mtpRoute[i].switchType = mtp3_route->switchType; g_ftdm_sngss7_data.cfg.mtpRoute[i].cmbLinkSetId = mtp3_route->cmbLinkSetId; g_ftdm_sngss7_data.cfg.mtpRoute[i].isSTP = mtp3_route->isSTP; + g_ftdm_sngss7_data.cfg.mtpRoute[i].nwId = mtp3_route->nwId; + g_ftdm_sngss7_data.cfg.mtpRoute[i].linkSetId = mtp3_route->linkSetId; g_ftdm_sngss7_data.cfg.mtpRoute[i].ssf = mtp3_route->ssf; if (mtp3_route->t6 != 0) { g_ftdm_sngss7_data.cfg.mtpRoute[i].t6 = mtp3_route->t6; @@ -1185,15 +1196,17 @@ static int ftmod_ss7_fill_in_nsap(sng_route_t *mtp3_route) if (g_ftdm_sngss7_data.cfg.nsap[i].id == 0) { g_ftdm_sngss7_data.cfg.nsap[i].id = i; + mtp3_route->nwId = i; SS7_DEBUG("found new mtp3_isup interface, id is = %d\n", g_ftdm_sngss7_data.cfg.nsap[i].id); } else { g_ftdm_sngss7_data.cfg.nsap[i].id = i; + mtp3_route->nwId = i; SS7_DEBUG("found existing mtp3_isup interface, id is = %d\n", g_ftdm_sngss7_data.cfg.nsap[i].id); } g_ftdm_sngss7_data.cfg.nsap[i].spId = g_ftdm_sngss7_data.cfg.nsap[i].id; g_ftdm_sngss7_data.cfg.nsap[i].suId = g_ftdm_sngss7_data.cfg.nsap[i].id; - g_ftdm_sngss7_data.cfg.nsap[i].nwId = g_ftdm_sngss7_data.cfg.nsap[i].id; + g_ftdm_sngss7_data.cfg.nsap[i].nwId = mtp3_route->nwId; g_ftdm_sngss7_data.cfg.nsap[i].linkType = mtp3_route->linkType; g_ftdm_sngss7_data.cfg.nsap[i].switchType = mtp3_route->switchType; g_ftdm_sngss7_data.cfg.nsap[i].ssf = mtp3_route->ssf; commit 402f2391dc15152f96619c9bfb21809b13ccc46d Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Thu Sep 9 20:03:36 2010 -0400 mod_commands: Fix user_data returning the first value found instead of the last. Also add support to get variable from the group. diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index e1eb2a6..e308a00 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -605,11 +605,12 @@ SWITCH_STANDARD_API(in_group_function) SWITCH_STANDARD_API(user_data_function) { - switch_xml_t x_domain, xml = NULL, x_user = NULL, x_param, x_params; + switch_xml_t x_domain, xml = NULL, x_user = NULL, x_group = NULL, x_param, x_params; int argc; char *mydata = NULL, *argv[3], *key = NULL, *type = NULL, *user, *domain; char delim = ' '; const char *container = "params", *elem = "param"; + const char *result = NULL; switch_event_t *params = NULL; if (zstr(cmd) || !(mydata = strdup(cmd))) { @@ -637,10 +638,10 @@ SWITCH_STANDARD_API(user_data_function) switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "domain", domain); switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "type", type); - if (key && type && switch_xml_locate_user("id", user, domain, NULL, &xml, &x_domain, &x_user, NULL, params) == SWITCH_STATUS_SUCCESS) { + if (key && type && switch_xml_locate_user("id", user, domain, NULL, &xml, &x_domain, &x_user, &x_group, params) == SWITCH_STATUS_SUCCESS) { if (!strcmp(type, "attr")) { const char *attr = switch_xml_attr_soft(x_user, key); - stream->write_function(stream, "%s", attr); + result = attr; goto end; } @@ -649,33 +650,45 @@ SWITCH_STANDARD_API(user_data_function) elem = "variable"; } - if ((x_params = switch_xml_child(x_user, container))) { + if ((x_params = switch_xml_child(x_domain, container))) { for (x_param = switch_xml_child(x_params, elem); x_param; x_param = x_param->next) { const char *var = switch_xml_attr(x_param, "name"); const char *val = switch_xml_attr(x_param, "value"); if (var && val && !strcasecmp(var, key)) { - stream->write_function(stream, "%s", val); - goto end; + result = val; } } } - if ((x_params = switch_xml_child(x_domain, container))) { + if (x_group && (x_params = switch_xml_child(x_group, container))) { + for (x_param = switch_xml_child(x_params, elem); x_param; x_param = x_param->next) { + const char *var = switch_xml_attr(x_param, "name"); + const char *val = switch_xml_attr(x_param, "value"); + + if (var && val && !strcasecmp(var, key)) { + result = val; + } + } + } + + if ((x_params = switch_xml_child(x_user, container))) { for (x_param = switch_xml_child(x_params, elem); x_param; x_param = x_param->next) { const char *var = switch_xml_attr(x_param, "name"); const char *val = switch_xml_attr(x_param, "value"); if (var && val && !strcasecmp(var, key)) { - stream->write_function(stream, "%s", val); - goto end; + result = val; } } } } end: + if (result) { + stream->write_function(stream, "%s", result); + } switch_xml_free(xml); switch_safe_free(mydata); switch_event_destroy(¶ms); commit 87db11afe02ebaaa898f3b4b76258ca8ff6f60f3 Author: Leon de Rooij <leon@toyos.nl> Date: Fri Sep 10 01:36:27 2010 +0200 Made 2nd arg to freeswitch.Dbh:query (cb func) optional diff --git a/src/mod/languages/mod_lua/freeswitch.i b/src/mod/languages/mod_lua/freeswitch.i index 3835801..54bdb7b 100644 --- a/src/mod/languages/mod_lua/freeswitch.i +++ b/src/mod/languages/mod_lua/freeswitch.i @@ -19,8 +19,15 @@ /* Lua function typemap */ -%typemap(in,checkfn="lua_isfunction") SWIGLUA_FN -%{ $1.L=L; $1.idx=$input; %} +%typemap(in, checkfn = "lua_isfunction") SWIGLUA_FN { + $1.L = L; + $1.idx = $input; +} + +%typemap(default) SWIGLUA_FN { + SWIGLUA_FN default_swiglua_fn = { 0 }; + $1 = default_swiglua_fn; +} %ignore SwitchToMempool; diff --git a/src/mod/languages/mod_lua/freeswitch_lua.cpp b/src/mod/languages/mod_lua/freeswitch_lua.cpp index 17d12bc..8321f87 100644 --- a/src/mod/languages/mod_lua/freeswitch_lua.cpp +++ b/src/mod/languages/mod_lua/freeswitch_lua.cpp @@ -367,10 +367,15 @@ int Dbh::query_callback(void *pArg, int argc, char **argv, char **cargv) bool Dbh::query(char *sql, SWIGLUA_FN lua_fun) { if (connected) { - if (switch_cache_db_execute_sql_callback(dbh, sql, query_callback, &lua_fun, NULL) == SWITCH_STATUS_SUCCESS) { - return true; + if (lua_fun.L && lua_fun.idx != 0) { + if (switch_cache_db_execute_sql_callback(dbh, sql, query_callback, &lua_fun, NULL) == SWITCH_STATUS_SUCCESS) { + return true; + } + } else { /* if no lua_fun arg is passed from Lua, an empty initialized struct will be sent - see freeswitch.i */ + if (switch_cache_db_execute_sql(dbh, sql, NULL) == SWITCH_STATUS_SUCCESS) { + return true; + } } } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "no workie workie :(\n"); return false; } diff --git a/src/mod/languages/mod_lua/mod_lua_wrap.cpp b/src/mod/languages/mod_lua/mod_lua_wrap.cpp index 991b667..962ebe3 100644 --- a/src/mod/languages/mod_lua/mod_lua_wrap.cpp +++ b/src/mod/languages/mod_lua/mod_lua_wrap.cpp @@ -1,6 +1,6 @@ /* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.35 + * Version 1.3.29 * * This file is not intended to be easily readable and contains a number of * coding conventions designed to improve portability and efficiency. Do not make @@ -10,7 +10,7 @@ #ifdef __cplusplus -template<typename T> class SwigValueWrapper { +template<class T> class SwigValueWrapper { T *tt; public: SwigValueWrapper() : tt(0) { } @@ -23,10 +23,6 @@ public: private: SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs); }; - -template <typename T> T SwigValueInit() { - return T(); -} #endif /* ----------------------------------------------------------------------------- @@ -36,14 +32,14 @@ template <typename T> T SwigValueInit() { /* template workaround for compilers that cannot correctly implement the C++ standard */ #ifndef SWIGTEMPLATEDISAMBIGUATOR -# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560) -# define SWIGTEMPLATEDISAMBIGUATOR template -# elif defined(__HP_aCC) -/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */ -/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */ -# define SWIGTEMPLATEDISAMBIGUATOR template +# if defined(__SUNPRO_CC) +# if (__SUNPRO_CC <= 0x560) +# define SWIGTEMPLATEDISAMBIGUATOR template +# else +# define SWIGTEMPLATEDISAMBIGUATOR +# endif # else -# define SWIGTEMPLATEDISAMBIGUATOR +# define SWIGTEMPLATEDISAMBIGUATOR # endif #endif @@ -122,16 +118,10 @@ template <typename T> T SwigValueInit() { #endif /* Deal with Microsoft's attempt at deprecating C standard runtime functions */ -#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE) +#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) # define _CRT_SECURE_NO_DEPRECATE #endif -/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */ -#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE) -# define _SCL_SECURE_NO_DEPRECATE -#endif - - /* ----------------------------------------------------------------------------- * swigrun.swg * @@ -141,7 +131,7 @@ template <typename T> T SwigValueInit() { /* This should only be incremented when either the layout of swig_type_info changes, or for whatever reason, the runtime changes incompatibly */ -#define SWIG_RUNTIME_VERSION "4" +#define SWIG_RUNTIME_VERSION "2" /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */ #ifdef SWIG_TYPE_TABLE @@ -176,7 +166,6 @@ template <typename T> T SwigValueInit() { /* Flags for pointer conversions */ #define SWIG_POINTER_DISOWN 0x1 -#define SWIG_CAST_NEW_MEMORY 0x2 /* Flags for new pointer objects */ #define SWIG_POINTER_OWN 0x1 @@ -317,10 +306,10 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) { extern "C" { #endif -typedef void *(*swig_converter_func)(void *, int *); +typedef void *(*swig_converter_func)(void *); typedef struct swig_type_info *(*swig_dycast_func)(void **); -/* Structure to store information on one type */ +/* Structure to store inforomation on one type */ typedef struct swig_type_info { const char *name; /* mangled name of this type */ const char *str; /* human readable name of this type */ @@ -365,7 +354,7 @@ SWIG_TypeNameComp(const char *f1, const char *l1, while ((*f2 == ' ') && (f2 != l2)) ++f2; if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1; } - return (int)((l1 - f1) - (l2 - f2)); + return (l1 - f1) - (l2 - f2); } /* @@ -447,8 +436,8 @@ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) { Cast a pointer up an inheritance hierarchy */ SWIGRUNTIMEINLINE void * -SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) { - return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory); +SWIG_TypeCast(swig_cast_info *ty, void *ptr) { + return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr); } /* @@ -719,8 +708,7 @@ extern "C" { #include "lua.h" #include "lauxlib.h" -#include <stdlib.h> /* for malloc */ -#include <assert.h> /* for a few sanity tests */ +#include <assert.h> /* for a few sanity tests */ /* ----------------------------------------------------------------------------- * global swig types @@ -731,7 +719,12 @@ extern "C" { #define SWIG_LUA_STRING 3 #define SWIG_LUA_POINTER 4 #define SWIG_LUA_BINARY 5 -#define SWIG_LUA_CHAR 6 + +/* Structure for command table (replaced by luaLib's luaL_reg) */ +/*typedef struct { + const char *name; + lua_CFunction wrapper; +} swig_lua_command_info;*/ /* Structure for variable linking table */ typedef struct { @@ -762,42 +755,29 @@ typedef struct { } swig_lua_attribute; typedef struct swig_lua_class { - const char *name; + const char *name; swig_type_info **type; - lua_CFunction constructor; - void (*destructor)(void *); - swig_lua_method *methods; + lua_CFunction constructor; + void (*destructor)(void *); + swig_lua_method *methods; swig_lua_attribute *attributes; struct swig_lua_class **bases; - const char **base_names; } swig_lua_class; -/* this is the struct for wrappering all pointers in SwigLua -*/ typedef struct { + void *ptr; swig_type_info *type; - int own; /* 1 if owned & must be destroyed */ - void *ptr; + int own; /* 1 if owned & must be destroyed */ } swig_lua_userdata; -/* this is the struct for wrapping arbitary packed binary data -(currently it is only used for member function pointers) -the data ordering is similar to swig_lua_userdata, but it is currently not possible -to tell the two structures apart within Swig, other than by looking at the type -*/ -typedef struct { - swig_type_info *type; - int own; /* 1 if owned & must be destroyed */ - char data[1]; /* arbitary amount of data */ -} swig_lua_rawdata; /* Common SWIG API */ -#define SWIG_NewPointerObj(L, ptr, type, owner) SWIG_Lua_NewPointerObj(L, (void *)ptr, type, owner) -#define SWIG_ConvertPtr(L,idx, ptr, type, flags) SWIG_Lua_ConvertPtr(L,idx,ptr,type,flags) -#define SWIG_MustGetPtr(L,idx, type,flags, argnum,fnname) SWIG_Lua_MustGetPtr(L,idx, type,flags, argnum,fnname) -/* for C++ member pointers, ie, member methods */ -#define SWIG_ConvertMember(L, idx, ptr, sz, ty) SWIG_Lua_ConvertPacked(L, idx, ptr, sz, ty) -#define SWIG_NewMemberObj(L, ptr, sz, type) SWIG_Lua_NewPackedObj(L, ptr, sz, type) +#define SWIG_NewPointerObj(L, ptr, type, owner) \ + SWIG_Lua_NewPointerObj(L, (void *)ptr, type, owner) +#define SWIG_ConvertPtr(L,idx, ptr, type, flags) \ + SWIG_Lua_ConvertPtr(L,idx,ptr,type,flags) +#define SWIG_MustGetPtr(L,idx, type,flags, argnum,fnname) \ + SWIG_Lua_MustGetPtr(L,idx, type,flags, argnum,fnname) /* Runtime API */ #define SWIG_GetModule(clientdata) SWIG_Lua_GetModule((lua_State*)(clientdata)) @@ -808,193 +788,141 @@ typedef struct { #define SWIG_contract_assert(expr, msg) \ if (!(expr)) { lua_pushstring(L, (char *) msg); goto fail; } else + + /* helper #defines */ #define SWIG_fail {goto fail;} -#define SWIG_fail_arg(func_name,argnum,type) \ - {lua_pushfstring(L,"Error in %s (arg %d), expected '%s' got '%s'",\ - func_name,argnum,type,SWIG_Lua_typename(L,argnum));\ - goto fail;} -#define SWIG_fail_ptr(func_name,argnum,type) \ - SWIG_fail_arg(func_name,argnum,(type && type->str)?type->str:"void*") -#define SWIG_check_num_args(func_name,a,b) \ - if (lua_gettop(L)<a || lua_gettop(L)>b) \ - {lua_pushfstring(L,"Error in %s expected %d..%d args, got %d",func_name,a,b,lua_gettop(L));\ - goto fail;} - +#define SWIG_fail_arg(I) {lua_pushfstring(L,"argument %d incorrect/missing",I);goto fail;} #define SWIG_Lua_get_table(L,n) \ - (lua_pushstring(L, n), lua_rawget(L,-2)) + (lua_pushstring(L, n), lua_rawget(L,-2)) #define SWIG_Lua_add_function(L,n,f) \ - (lua_pushstring(L, n), \ - lua_pushcfunction(L, f), \ - lua_rawset(L,-3)) - -/* special helper for allowing 'nil' for usertypes */ -#define SWIG_isptrtype(L,I) (lua_isuserdata(L,I) || lua_isnil(L,I)) - -#ifdef __cplusplus -/* Special helper for member function pointers -it gets the address, casts it, then dereferences it */ -//#define SWIG_mem_fn_as_voidptr(a) (*((char**)&(a))) -#endif - -/* storing/access of swig_module_info */ -SWIGRUNTIME swig_module_info * -SWIG_Lua_GetModule(lua_State* L) { - swig_module_info *ret = 0; - lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME); - lua_rawget(L,LUA_REGISTRYINDEX); - if (lua_islightuserdata(L,-1)) - ret=(swig_module_info*)lua_touserdata(L,-1); - lua_pop(L,1); /* tidy */ - return ret; -} - -SWIGRUNTIME void -SWIG_Lua_SetModule(lua_State* L, swig_module_info *module) { - /* add this all into the Lua registry: */ - lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME); - lua_pushlightuserdata(L,(void*)module); - lua_rawset(L,LUA_REGISTRYINDEX); -} + (lua_pushstring(L, n), \ + lua_pushcfunction(L, f), \ + lua_rawset(L,-3)) /* ----------------------------------------------------------------------------- * global variable support code: modules * ----------------------------------------------------------------------------- */ -/* this function is called when trying to set an immutable. -default value is to print an error. -This can removed with a compile flag SWIGLUA_IGNORE_SET_IMMUTABLE */ -SWIGINTERN int SWIG_Lua_set_immutable(lua_State* L) -{ -/* there should be 1 param passed in: the new value */ -#ifndef SWIGLUA_IGNORE_SET_IMMUTABLE - lua_pop(L,1); /* remove it */ - lua_pushstring(L,"This variable is immutable"); - lua_error(L); -#endif - return 0; /* should not return anything */ -} - /* the module.get method used for getting linked data */ SWIGINTERN int SWIG_Lua_module_get(lua_State* L) { -/* there should be 2 params passed in - (1) table (not the meta table) - (2) string name of the attribute - printf("SWIG_Lua_module_get %p(%s) '%s'\n", - lua_topointer(L,1),lua_typename(L,lua_type(L,1)), - lua_tostring(L,2)); +/* there should be 2 params passed in + (1) table (not the meta table) + (2) string name of the attribute + printf("SWIG_Lua_module_get %p(%s) '%s'\n", + lua_topointer(L,1),lua_typename(L,lua_type(L,1)), + lua_tostring(L,2)); */ - /* get the metatable */ - assert(lua_istable(L,1)); /* just in case */ - lua_getmetatable(L,1); /* get the metatable */ - assert(lua_istable(L,-1)); /* just in case */ - SWIG_Lua_get_table(L,".get"); /* get the .get table */ - lua_remove(L,3); /* remove metatable */ - if (lua_istable(L,-1)) - { - /* look for the key in the .get table */ - lua_pushvalue(L,2); /* key */ - lua_rawget(L,-2); - lua_remove(L,3); /* remove .get */ - if (lua_iscfunction(L,-1)) - { /* found it so call the fn & return its value */ - lua_call(L,0,1); - return 1; - } - lua_pop(L,1); /* remove the top */ - } - lua_pop(L,1); /* remove the .get */ - lua_pushnil(L); /* return a nil */ + /* get the metatable */ + assert(lua_istable(L,1)); /* just in case */ + lua_getmetatable(L,1); /* get the metatable */ + assert(lua_istable(L,-1)); /* just in case */ + SWIG_Lua_get_table(L,".get"); /* get the .get table */ + lua_remove(L,3); /* remove metatable */ + if (lua_istable(L,-1)) + { + /* look for the key in the .get table */ + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); + lua_remove(L,3); /* remove .get */ + if (lua_iscfunction(L,-1)) + { /* found it so call the fn & return its value */ + lua_call(L,0,1); + return 1; + } + lua_pop(L,1); /* remove the top */ + } + lua_pop(L,1); /* remove the .get */ + lua_pushnil(L); /* return a nil */ return 1; } /* the module.set method used for setting linked data */ SWIGINTERN int SWIG_Lua_module_set(lua_State* L) { -/* there should be 3 params passed in - (1) table (not the meta table) - (2) string name of the attribute - (3) any for the new value +/* there should be 3 params passed in + (1) table (not the meta table) + (2) string name of the attribute + (3) any for the new value */ - /* get the metatable */ - assert(lua_istable(L,1)); /* just in case */ - lua_getmetatable(L,1); /* get the metatable */ - assert(lua_istable(L,-1)); /* just in case */ - SWIG_Lua_get_table(L,".set"); /* get the .set table */ - lua_remove(L,4); /* remove metatable */ - if (lua_istable(L,-1)) - { - /* look for the key in the .set table */ - lua_pushvalue(L,2); /* key */ - lua_rawget(L,-2); - lua_remove(L,4); /* remove .set */ - if (lua_iscfunction(L,-1)) - { /* found it so call the fn & return its value */ - lua_pushvalue(L,3); /* value */ - lua_call(L,1,0); - return 0; - } - } - lua_settop(L,3); /* reset back to start */ - /* we now have the table, key & new value, so just set directly */ - lua_rawset(L,1); /* add direct */ - return 0; + /* get the metatable */ + assert(lua_istable(L,1)); /* just in case */ + lua_getmetatable(L,1); /* get the metatable */ + assert(lua_istable(L,-1)); /* just in case */ + SWIG_Lua_get_table(L,".set"); /* get the .set table */ + lua_remove(L,4); /* remove metatable */ + if (lua_istable(L,-1)) + { + /* look for the key in the .set table */ + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); + lua_remove(L,4); /* remove .set */ + if (lua_iscfunction(L,-1)) + { /* found it so call the fn & return its value */ + lua_pushvalue(L,3); /* value */ + lua_call(L,1,0); + return 0; + } + lua_pop(L,1); /* remove the top */ + } + lua_pop(L,1); /* remove the .set */ + return 0; } /* registering a module in lua */ SWIGINTERN void SWIG_Lua_module_begin(lua_State* L,const char* name) { - assert(lua_istable(L,-1)); /* just in case */ - lua_pushstring(L,name); - lua_newtable(L); /* the table */ - /* add meta table */ - lua_newtable(L); /* the meta table */ - SWIG_Lua_add_function(L,"__index",SWIG_Lua_module_get); - SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_module_set); - lua_pushstring(L,".get"); - lua_newtable(L); /* the .get table */ - lua_rawset(L,-3); /* add .get into metatable */ - lua_pushstring(L,".set"); - lua_newtable(L); /* the .set table */ - lua_rawset(L,-3); /* add .set into metatable */ - lua_setmetatable(L,-2); /* sets meta table in module */ - lua_rawset(L,-3); /* add module into parent */ - SWIG_Lua_get_table(L,name); /* get the table back out */ + assert(lua_istable(L,-1)); /* just in case */ + lua_pushstring(L,name); + lua_newtable(L); /* the table */ + /* add meta table */ + lua_newtable(L); /* the meta table */ + SWIG_Lua_add_function(L,"__index",SWIG_Lua_module_get); + SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_module_set); + lua_pushstring(L,".get"); + lua_newtable(L); /* the .get table */ + lua_rawset(L,-3); /* add .get into metatable */ + lua_pushstring(L,".set"); + lua_newtable(L); /* the .set table */ + lua_rawset(L,-3); /* add .set into metatable */ + lua_setmetatable(L,-2); /* sets meta table in module */ + lua_rawset(L,-3); /* add module into parent */ + SWIG_Lua_get_table(L,name); /* get the table back out */ } /* ending the register */ SWIGINTERN void SWIG_Lua_module_end(lua_State* L) { - lua_pop(L,1); /* tidy stack (remove module) */ + lua_pop(L,1); /* tidy stack (remove module) */ } /* adding a linked variable to the module */ SWIGINTERN void SWIG_Lua_module_add_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn) { - assert(lua_istable(L,-1)); /* just in case */ - lua_getmetatable(L,-1); /* get the metatable */ - assert(lua_istable(L,-1)); /* just in case */ - SWIG_Lua_get_table(L,".get"); /* find the .get table */ - assert(lua_istable(L,-1)); /* should be a table: */ - SWIG_Lua_add_function(L,name,getFn); - lua_pop(L,1); /* tidy stack (remove table) */ - if (setFn) /* if there is a set fn */ - { - SWIG_Lua_get_table(L,".set"); /* find the .set table */ - assert(lua_istable(L,-1)); /* should be a table: */ - SWIG_Lua_add_function(L,name,setFn); - lua_pop(L,1); /* tidy stack (remove table) */ - } - lua_pop(L,1); /* tidy stack (remove meta) */ + assert(lua_istable(L,-1)); /* just in case */ + lua_getmetatable(L,-1); /* get the metatable */ + assert(lua_istable(L,-1)); /* just in case */ + SWIG_Lua_get_table(L,".get"); /* find the .get table */ + assert(lua_istable(L,-1)); /* should be a table: */ + SWIG_Lua_add_function(L,name,getFn); + lua_pop(L,1); /* tidy stack (remove table) */ + if (setFn) /* if there is a set fn */ + { + SWIG_Lua_get_table(L,".set"); /* find the .set table */ + assert(lua_istable(L,-1)); /* should be a table: */ + SWIG_Lua_add_function(L,name,setFn); + lua_pop(L,1); /* tidy stack (remove table) */ + } + lua_pop(L,1); /* tidy stack (remove meta) */ } /* adding a function module */ SWIGINTERN void SWIG_Lua_module_add_function(lua_State* L,const char* name,lua_CFunction fn) { - SWIG_Lua_add_function(L,name,fn); + SWIG_Lua_add_function(L,name,fn); } /* ----------------------------------------------------------------------------- @@ -1004,383 +932,307 @@ SWIGINTERN void SWIG_Lua_module_add_function(lua_State* L,const char* name,lua_ /* the class.get method, performs the lookup of class attributes */ SWIGINTERN int SWIG_Lua_class_get(lua_State* L) { -/* there should be 2 params passed in - (1) userdata (not the meta table) - (2) string name of the attribute +/* there should be 2 params passed in + (1) userdata (not the meta table) + (2) string name of the attribute */ - assert(lua_isuserdata(L,-2)); /* just in case */ - lua_getmetatable(L,-2); /* get the meta table */ - assert(lua_istable(L,-1)); /* just in case */ - SWIG_Lua_get_table(L,".get"); /* find the .get table */ - assert(lua_istable(L,-1)); /* just in case */ - /* look for the key in the .get table */ - lua_pushvalue(L,2); /* key */ - lua_rawget(L,-2); - lua_remove(L,-2); /* stack tidy, remove .get table */ - if (lua_iscfunction(L,-1)) - { /* found it so call the fn & return its value */ - lua_pushvalue(L,1); /* the userdata */ - lua_call(L,1,1); /* 1 value in (userdata),1 out (result) */ - lua_remove(L,-2); /* stack tidy, remove metatable */ - return 1; - } - lua_pop(L,1); /* remove whatever was there */ - /* ok, so try the .fn table */ - SWIG_Lua_get_table(L,".fn"); /* find the .get table */ - assert(lua_istable(L,-1)); /* just in case */ - lua_pushvalue(L,2); /* key */ - lua_rawget(L,-2); /* look for the fn */ - lua_remove(L,-2); /* stack tidy, remove .fn table */ - if (lua_isfunction(L,-1)) /* note: if its a C function or lua function */ - { /* found it so return the fn & let lua call it */ - lua_remove(L,-2); /* stack tidy, remove metatable */ - return 1; - } - lua_pop(L,1); /* remove whatever was there */ - /* NEW: looks for the __getitem() fn - this is a user provided get fn */ - SWIG_Lua_get_table(L,"__getitem"); /* find the __getitem fn */ - if (lua_iscfunction(L,-1)) /* if its there */ - { /* found it so call the fn & return its value */ - lua_pushvalue(L,1); /* the userdata */ - lua_pushvalue(L,2); /* the parameter */ - lua_call(L,2,1); /* 2 value in (userdata),1 out (result) */ - lua_remove(L,-2); /* stack tidy, remove metatable */ - return 1; - } - return 0; /* sorry not known */ + assert(lua_isuserdata(L,-2)); /* just in case */ + lua_getmetatable(L,-2); /* get the meta table */ + assert(lua_istable(L,-1)); /* just in case */ + SWIG_Lua_get_table(L,".get"); /* find the .get table */ + assert(lua_istable(L,-1)); /* just in case */ + /* look for the key in the .get table */ + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); + lua_remove(L,-2); /* stack tidy, remove .get table */ + if (lua_iscfunction(L,-1)) + { /* found it so call the fn & return its value */ + lua_pushvalue(L,1); /* the userdata */ + lua_call(L,1,1); /* 1 value in (userdata),1 out (result) */ + lua_remove(L,-2); /* stack tidy, remove metatable */ + return 1; + } + lua_pop(L,1); /* remove whatever was there */ + /* ok, so try the .fn table */ + SWIG_Lua_get_table(L,".fn"); /* find the .get table */ + assert(lua_istable(L,-1)); /* just in case */ + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); /* look for the fn */ + lua_remove(L,-2); /* stack tidy, remove .fn table */ + if (lua_iscfunction(L,-1)) + { /* found it so return the fn & let lua call it */ + lua_remove(L,-2); /* stack tidy, remove metatable */ + return 1; + } + lua_pop(L,1); /* remove whatever was there */ + /* NEW: looks for the __getitem() fn + this is a user provided get fn */ + SWIG_Lua_get_table(L,"__getitem"); /* find the __getitem fn */ + if (lua_iscfunction(L,-1)) /* if its there */ + { /* found it so call the fn & return its value */ + lua_pushvalue(L,1); /* the userdata */ + lua_pushvalue(L,2); /* the parameter */ + lua_call(L,2,1); /* 2 value in (userdata),1 out (result) */ + lua_remove(L,-2); /* stack tidy, remove metatable */ + return 1; + } + return 0; /* sorry not known */ } /* the class.set method, performs the lookup of class attributes */ SWIGINTERN int SWIG_Lua_class_set(lua_State* L) { -/* there should be 3 params passed in - (1) table (not the meta table) - (2) string name of the attribute - (3) any for the new value +/* there should be 3 params passed in + (1) table (not the meta table) + (2) string name of the attribute + (3) any for the new value printf("SWIG_Lua_class_set %p(%s) '%s' %p(%s)\n", - lua_topointer(L,1),lua_typename(L,lua_type(L,1)), - lua_tostring(L,2), - lua_topointer(L,3),lua_typename(L,lua_type(L,3)));*/ - - assert(lua_isuserdata(L,1)); /* just in case */ - lua_getmetatable(L,1); /* get the meta table */ - assert(lua_istable(L,-1)); /* just in case */ - - SWIG_Lua_get_table(L,".set"); /* find the .set table */ - if (lua_istable(L,-1)) - { - /* look for the key in the .set table */ - lua_pushvalue(L,2); /* key */ - lua_rawget(L,-2); - if (lua_iscfunction(L,-1)) - { /* found it so call the fn & return its value */ - lua_pushvalue(L,1); /* userdata */ - lua_pushvalue(L,3); /* value */ - lua_call(L,2,0); - return 0; - } - lua_pop(L,1); /* remove the value */ - } - lua_pop(L,1); /* remove the value .set table */ - /* NEW: looks for the __setitem() fn - this is a user provided set fn */ - SWIG_Lua_get_table(L,"__setitem"); /* find the fn */ - if (lua_iscfunction(L,-1)) /* if its there */ - { /* found it so call the fn & return its value */ - lua_pushvalue(L,1); /* the userdata */ - lua_pushvalue(L,2); /* the parameter */ - lua_pushvalue(L,3); /* the value */ - lua_call(L,3,0); /* 3 values in ,0 out */ - lua_remove(L,-2); /* stack tidy, remove metatable */ - return 1; - } - return 0; + lua_topointer(L,1),lua_typename(L,lua_type(L,1)), + lua_tostring(L,2), + lua_topointer(L,3),lua_typename(L,lua_type(L,3)));*/ + + assert(lua_isuserdata(L,1)); /* just in case */ + lua_getmetatable(L,1); /* get the meta table */ + assert(lua_istable(L,-1)); /* just in case */ + + SWIG_Lua_get_table(L,".set"); /* find the .set table */ + if (lua_istable(L,-1)) + { + /* look for the key in the .set table */ + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); + if (lua_iscfunction(L,-1)) + { /* found it so call the fn & return its value */ + lua_pushvalue(L,1); /* userdata */ + lua_pushvalue(L,3); /* value */ + lua_call(L,2,0); + return 0; + } + lua_pop(L,1); /* remove the value */ + } + lua_pop(L,1); /* remove the value .set table */ + /* NEW: looks for the __setitem() fn + this is a user provided set fn */ + SWIG_Lua_get_table(L,"__setitem"); /* find the fn */ + if (lua_iscfunction(L,-1)) /* if its there */ + { /* found it so call the fn & return its value */ + lua_pushvalue(L,1); /* the userdata */ + lua_pushvalue(L,2); /* the parameter */ + lua_pushvalue(L,3); /* the value */ + lua_call(L,3,0); /* 3 values in ,0 out */ + lua_remove(L,-2); /* stack tidy, remove metatable */ + return 1; + } + return 0; } /* the class.destruct method called by the interpreter */ SWIGINTERN int SWIG_Lua_class_destruct(lua_State* L) { -/* there should be 1 params passed in - (1) userdata (not the meta table) */ - swig_lua_userdata* usr; - swig_lua_class* clss; - assert(lua_isuserdata(L,-1)); /* just in case */ - usr=(swig_lua_userdata*)lua_touserdata(L,-1); /* get it */ - /* if must be destroyed & has a destructor */ - if (usr->own) /* if must be destroyed */ - { - clss=(swig_lua_class*)usr->type->clientdata; /* get the class */ - if (clss && clss->destructor) /* there is a destroy fn */ - { - clss->destructor(usr->ptr); /* bye bye */ - } - } - return 0; +/* there should be 1 params passed in + (1) userdata (not the meta table) */ + swig_lua_userdata* usr; + swig_lua_class* clss; + assert(lua_isuserdata(L,-1)); /* just in case */ + usr=(swig_lua_userdata*)lua_touserdata(L,-1); /* get it */ + /* if must be destroyed & has a destructor */ + if (usr->own) /* if must be destroyed */ + { + clss=(swig_lua_class*)usr->type->clientdata; /* get the class */ + if (clss && clss->destructor) /* there is a destroy fn */ + { + clss->destructor(usr->ptr); /* bye bye */ + } + } + return 0; } /* gets the swig class registry (or creates it) */ SWIGINTERN void SWIG_Lua_get_class_registry(lua_State* L) { - /* add this all into the swig registry: */ - lua_pushstring(L,"SWIG"); - lua_rawget(L,LUA_REGISTRYINDEX); /* get the registry */ - if (!lua_istable(L,-1)) /* not there */ - { /* must be first time, so add it */ - lua_pop(L,1); /* remove the result */ - lua_pushstring(L,"SWIG"); - lua_newtable(L); - lua_rawset(L,LUA_REGISTRYINDEX); - /* then get it */ - lua_pushstring(L,"SWIG"); - lua_rawget(L,LUA_REGISTRYINDEX); - } + /* add this all into the swig registry: */ + lua_pushstring(L,"SWIG"); + lua_rawget(L,LUA_REGISTRYINDEX); /* get the registry */ + if (!lua_istable(L,-1)) /* not there */ + { /* must be first time, so add it */ + lua_pop(L,1); /* remove the result */ + lua_pushstring(L,"SWIG"); + lua_newtable(L); + lua_rawset(L,LUA_REGISTRYINDEX); + /* then get it */ + lua_pushstring(L,"SWIG"); + lua_rawget(L,LUA_REGISTRYINDEX); + } } /* helper fn to get the classes metatable from the register */ SWIGINTERN void SWIG_Lua_get_class_metatable(lua_State* L,const char* cname) { - SWIG_Lua_get_class_registry(L); /* get the registry */ - lua_pushstring(L,cname); /* get the name */ - lua_rawget(L,-2); /* get it */ - lua_remove(L,-2); /* tidy up (remove registry) */ + SWIG_Lua_get_class_registry(L); /* get the registry */ + lua_pushstring(L,cname); /* get the name */ + lua_rawget(L,-2); /* get it */ + lua_remove(L,-2); /* tidy up (remove registry) */ } /* helper add a variable to a registered class */ SWIGINTERN void SWIG_Lua_add_class_variable(lua_State* L,const char* name,lua_CFunction getFn,lua_CFunction setFn) { - assert(lua_istable(L,-1)); /* just in case */ - SWIG_Lua_get_table(L,".get"); /* find the .get table */ - assert(lua_istable(L,-1)); /* just in case */ - SWIG_Lua_add_function(L,name,getFn); - lua_pop(L,1); /* tidy stack (remove table) */ - if (setFn) - { - SWIG_Lua_get_table(L,".set"); /* find the .set table */ - assert(lua_istable(L,-1)); /* just in case */ - SWIG_Lua_add_function(L,name,setFn); - lua_pop(L,1); /* tidy stack (remove table) */ - } + assert(lua_istable(L,-1)); /* just in case */ + SWIG_Lua_get_table(L,".get"); /* find the .get table */ + assert(lua_istable(L,-1)); /* just in case */ + SWIG_Lua_add_function(L,name,getFn); + lua_pop(L,1); /* tidy stack (remove table) */ + if (setFn) + { + SWIG_Lua_get_table(L,".set"); /* find the .set table */ + assert(lua_istable(L,-1)); /* just in case */ + SWIG_Lua_add_function(L,name,setFn); + lua_pop(L,1); /* tidy stack (remove table) */ + } } /* helper to recursively add class details (attributes & operations) */ SWIGINTERN void SWIG_Lua_add_class_details(lua_State* L,swig_lua_class* clss) { - int i; - /* call all the base classes first: we can then override these later: */ - for(i=0;clss->bases[i];i++) - { - SWIG_Lua_add_class_details(L,clss->bases[i]); - } - /* add fns */ - for(i=0;clss->attributes[i].name;i++){ - SWIG_Lua_add_class_variable(L,clss->attributes[i].name,clss->attributes[i].getmethod,clss->attributes[i].setmethod); - } - /* add methods to the metatable */ - SWIG_Lua_get_table(L,".fn"); /* find the .fn table */ - assert(lua_istable(L,-1)); /* just in case */ - for(i=0;clss->methods[i].name;i++){ - SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].method); - } - lua_pop(L,1); /* tidy stack (remove table) */ - /* add operator overloads - these look ANY method which start with "__" and assume they - are operator overloads & add them to the metatable - (this might mess up is someone defines a method __gc (the destructor)*/ - for(i=0;clss->methods[i].name;i++){ - if (clss->methods[i].name[0]=='_' && clss->methods[i].name[1]=='_'){ - SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].method); - } - } -} - -/* set up the base classes pointers. -Each class structure has a list of pointers to the base class structures. -This function fills them. -It cannot be done at compile time, as this will not work with hireachies -spread over more than one swig file. -Therefore it must be done at runtime, querying the SWIG type system. -*/ -SWIGINTERN void SWIG_Lua_init_base_class(lua_State* L,swig_lua_class* clss) -{ - int i=0; - swig_module_info* module=SWIG_GetModule(L); - for(i=0;clss->base_names[i];i++) - { - if (clss->bases[i]==0) /* not found yet */ - { - /* lookup and cache the base class */ - swig_type_info *info = SWIG_TypeQueryModule(module,module,clss->base_names[i]); - if (info) clss->bases[i] = (swig_lua_class *) info->clientdata; - } - } + int i; + /* call all the base classes first: we can then override these later: */ + for(i=0;clss->bases[i];i++) + { + SWIG_Lua_add_class_details(L,clss->bases[i]); + } + /* add fns */ + for(i=0;clss->attributes[i].name;i++){ + SWIG_Lua_add_class_variable(L,clss->attributes[i].name,clss->attributes[i].getmethod,clss->attributes[i].setmethod); + } + /* add methods to the metatable */ + SWIG_Lua_get_table(L,".fn"); /* find the .fn table */ + assert(lua_istable(L,-1)); /* just in case */ + for(i=0;clss->methods[i].name;i++){ + SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].method); + } + lua_pop(L,1); /* tidy stack (remove table) */ + /* add operator overloads + these look ANY method which start with "__" and assume they + are operator overloads & add them to the metatable + (this might mess up is someone defines a method __gc (the destructor)*/ + for(i=0;clss->methods[i].name;i++){ + if (clss->methods[i].name[0]=='_' && clss->methods[i].name[1]=='_'){ + SWIG_Lua_add_function(L,clss->methods[i].name,clss->methods[i].method); + } + } } /* performs the entire class registration process */ SWIGINTERN void SWIG_Lua_class_register(lua_State* L,swig_lua_class* clss) { - /* add its constructor to module with the name of the class - so you can do MyClass(...) as well as new_MyClass(...) - BUT only if a constructor is defined - (this overcomes the problem of pure virtual classes without constructors)*/ - if (clss->constructor) - SWIG_Lua_add_function(L,clss->name,clss->constructor); - - SWIG_Lua_get_class_registry(L); /* get the registry */ - lua_pushstring(L,clss->name); /* get the name */ - lua_newtable(L); /* create the metatable */ - /* add string of class name called ".type" */ - lua_pushstring(L,".type"); - lua_pushstring(L,clss->name); - lua_rawset(L,-3); - /* add a table called ".get" */ - lua_pushstring(L,".get"); - lua_newtable(L); - lua_rawset(L,-3); - /* add a table called ".set" */ - lua_pushstring(L,".set"); - lua_newtable(L); - lua_rawset(L,-3); - /* add a table called ".fn" */ - lua_pushstring(L,".fn"); - lua_newtable(L); - lua_rawset(L,-3); - /* add accessor fns for using the .get,.set&.fn */ - SWIG_Lua_add_function(L,"__index",SWIG_Lua_class_get); - SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_class_set); - SWIG_Lua_add_function(L,"__gc",SWIG_Lua_class_destruct); - /* add it */ - lua_rawset(L,-3); /* metatable into registry */ - lua_pop(L,1); /* tidy stack (remove registry) */ - - SWIG_Lua_get_class_metatable(L,clss->name); - SWIG_Lua_add_class_details(L,clss); /* recursive adding of details (atts & ops) */ - lua_pop(L,1); /* tidy stack (remove class metatable) */ +/* add its constructor to module with the name of the class + so you can do MyClass(...) as well as new_MyClass(...) + BUT only if a constructor is defined + (this overcomes the problem of pure virtual classes without constructors)*/ + if (clss->constructor) + SWIG_Lua_add_function(L,clss->name,clss->constructor); + + SWIG_Lua_get_class_registry(L); /* get the registry */ + lua_pushstring(L,clss->name); /* get the name */ + lua_newtable(L); /* create the metatable */ + /* add string of class name called ".type" */ + lua_pushstring(L,".type"); + lua_pushstring(L,clss->name); + lua_rawset(L,-3); + /* add a table called ".get" */ + lua_pushstring(L,".get"); + lua_newtable(L); + lua_rawset(L,-3); + /* add a table called ".set" */ + lua_pushstring(L,".set"); + lua_newtable(L); + lua_rawset(L,-3); + /* add a table called ".fn" */ + lua_pushstring(L,".fn"); + lua_newtable(L); + lua_rawset(L,-3); + /* add accessor fns for using the .get,.set&.fn */ + SWIG_Lua_add_function(L,"__index",SWIG_Lua_class_get); + SWIG_Lua_add_function(L,"__newindex",SWIG_Lua_class_set); + SWIG_Lua_add_function(L,"__gc",SWIG_Lua_class_destruct); + /* add it */ + lua_rawset(L,-3); /* metatable into registry */ + lua_pop(L,1); /* tidy stack (remove registry) */ + + SWIG_Lua_get_class_metatable(L,clss->name); + SWIG_Lua_add_class_details(L,clss); /* recursive adding of details (atts & ops) */ + lua_pop(L,1); /* tidy stack (remove class metatable) */ } /* ----------------------------------------------------------------------------- * Class/structure conversion fns * ----------------------------------------------------------------------------- */ -/* helper to add metatable to new lua object */ -SWIGINTERN void _SWIG_Lua_AddMetatable(lua_State* L,swig_type_info *type) -{ - if (type->clientdata) /* there is clientdata: so add the metatable */ - { - SWIG_Lua_get_class_metatable(L,((swig_lua_class*)(type->clientdata))->name); - if (lua_istable(L,-1)) - { - lua_setmetatable(L,-2); - } - else - { - lua_pop(L,1); - } - } -} - /* pushes a new object into the lua stack */ SWIGRUNTIME void SWIG_Lua_NewPointerObj(lua_State* L,void* ptr,swig_type_info *type, int own) { - swig_lua_userdata* usr; - if (!ptr){ - lua_pushnil(L); - return; - } - usr=(swig_lua_userdata*)lua_newuserdata(L,sizeof(swig_lua_userdata)); /* get data */ - usr->ptr=ptr; /* set the ptr */ - usr->type=type; - usr->own=own; - _SWIG_Lua_AddMetatable(L,type); /* add metatable */ + swig_lua_userdata* usr; + if (!ptr){ + lua_pushnil(L); + return; + } + usr=(swig_lua_userdata*)lua_newuserdata(L,sizeof(swig_lua_userdata)); /* get data */ + usr->ptr=ptr; /* set the ptr */ + usr->type=type; + usr->own=own; + if (type->clientdata) /* there is clientdata: so add the metatable */ + { + SWIG_Lua_get_class_metatable(L,((swig_lua_class*)(type->clientdata))->name); + if (lua_istable(L,-1)) + { + lua_setmetatable(L,-2); + } + else + { + lua_pop(L,1); + } + } } /* takes a object from the lua stack & converts it into an object of the correct type (if possible) */ SWIGRUNTIME int SWIG_Lua_ConvertPtr(lua_State* L,int index,void** ptr,swig_type_info *type,int flags) { - swig_lua_userdata* usr; - swig_cast_info *cast; - if (lua_isnil(L,index)){*ptr=0; return SWIG_OK;} /* special case: lua nil => NULL pointer */ - usr=(swig_lua_userdata*)lua_touserdata(L,index); /* get data */ - if (usr) - { - if (flags & SWIG_POINTER_DISOWN) /* must disown the object */ - { - usr->own=0; - } - if (!type) /* special cast void*, no casting fn */ - { - *ptr=usr->ptr; - return SWIG_OK; /* ok */ - } - cast=SWIG_TypeCheckStruct(usr->type,type); /* performs normal type checking */ - if (cast) - { - int newmemory = 0; - *ptr=SWIG_TypeCast(cast,usr->ptr,&newmemory); - assert(!newmemory); /* newmemory handling not yet implemented */ - return SWIG_OK; /* ok */ - } - } - return SWIG_ERROR; /* error */ + swig_lua_userdata* usr; + swig_cast_info *cast; + usr=(swig_lua_userdata*)lua_touserdata(L,index); /* get data */ + if (usr) + { + cast=SWIG_TypeCheckStruct(usr->type,type); + if (cast) + { + *ptr=SWIG_TypeCast(cast,usr->ptr); + return 0; /* ok */ + } + } + return 1; /* error */ } SWIGRUNTIME void* SWIG_Lua_MustGetPtr(lua_State* L,int index,swig_type_info *type,int flags, - int argnum,const char* func_name){ - void* result; - if (!SWIG_IsOK(SWIG_ConvertPtr(L,index,&result,type,flags))){ - lua_pushfstring(L,"Error in %s, expected a %s at argument number %d\n", - func_name,(type && type->str)?type->str:"void*",argnum); - lua_error(L); - } - return result; -} - -/* pushes a packed userdata. user for member fn pointers only */ -SWIGRUNTIME void SWIG_Lua_NewPackedObj(lua_State* L,void* ptr,size_t size,swig_type_info *type) -{ - swig_lua_rawdata* raw; - assert(ptr); /* not acceptable to pass in a NULL value */ - raw=(swig_lua_rawdata*)lua_newuserdata(L,sizeof(swig_lua_rawdata)-1+size); /* alloc data */ - raw->type=type; - raw->own=0; - memcpy(raw->data,ptr,size); /* copy the data */ - _SWIG_Lua_AddMetatable(L,type); /* add metatable */ -} - -/* converts a packed userdata. user for member fn pointers only */ -SWIGRUNTIME int SWIG_Lua_ConvertPacked(lua_State* L,int index,void* ptr,size_t size,swig_type_info *type) -{ - swig_lua_rawdata* raw; - raw=(swig_lua_rawdata*)lua_touserdata(L,index); /* get data */ - if (!raw) return SWIG_ERROR; /* error */ - if (type==0 || type==raw->type) /* void* or identical type */ - { - memcpy(ptr,raw->data,size); /* copy it */ - return SWIG_OK; /* ok */ - } - return SWIG_ERROR; /* error */ -} - -/* a function to get the typestring of a piece of data */ -SWIGRUNTIME const char *SWIG_Lua_typename(lua_State *L, int tp) -{ - swig_lua_userdata* usr; - if (lua_isuserdata(L,tp)) - { - usr=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */ - if (usr && usr->type && usr->type->str) - return usr->type->str; - return "userdata (unknown type)"; - } - return lua_typename(L,lua_type(L,tp)); + int argnum,const char* func_name){ + void* result; + if (SWIG_ConvertPtr(L,index,&result,type,flags)){ + lua_pushfstring(L,"Error in %s, expected a %s at argument number %d\n", + func_name,(type && type->str)?type->str:"void*",argnum); + lua_error(L); + } + return result; } /* lua callable function to get the userdata's type */ SWIGRUNTIME int SWIG_Lua_type(lua_State* L) { - lua_pushstring(L,SWIG_Lua_typename(L,1)); - return 1; + swig_lua_userdata* usr; + if (!lua_isuserdata(L,1)) /* just in case */ + return 0; /* nil reply */ + usr=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */ + lua_pushstring(L,usr->type->name); + return 1; } /* lua callable function to compare userdata's value @@ -1388,18 +1240,18 @@ the issue is that two userdata may point to the same thing but to lua, they are different objects */ SWIGRUNTIME int SWIG_Lua_equal(lua_State* L) { - int result; - swig_lua_userdata *usr1,*usr2; - if (!lua_isuserdata(L,1) || !lua_isuserdata(L,2)) /* just in case */ - return 0; /* nil reply */ - usr1=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */ - usr2=(swig_lua_userdata*)lua_touserdata(L,2); /* get data */ - /*result=(usr1->ptr==usr2->ptr && usr1->type==usr2->type); only works if type is the same*/ - result=(usr1->ptr==usr2->ptr); - lua_pushboolean(L,result); - return 1; + int result; + swig_lua_userdata *usr1,*usr2; + if (!lua_isuserdata(L,1) || !lua_isuserdata(L,2)) /* just in case */ + return 0; /* nil reply */ + usr1=(swig_lua_userdata*)lua_touserdata(L,1); /* get data */ + usr2=(swig_lua_userdata*)lua_touserdata(L,2); /* get data */ + result=(usr1->ptr==usr2->ptr && usr1->type==usr2->type); + lua_pushboolean(L,result); + return 1; } + /* ----------------------------------------------------------------------------- * global variable support code: class/struct typemap functions * ----------------------------------------------------------------------------- */ @@ -1412,17 +1264,12 @@ SWIG_Lua_InstallConstants(lua_State* L, swig_lua_const_info constants[]) { switch(constants[i].type) { case SWIG_LUA_INT: lua_pushstring(L,constants[i].name); - lua_pushnumber(L,(lua_Number)constants[i].lvalue); + lua_pushnumber(L,(double)constants[i].lvalue); lua_rawset(L,-3); break; case SWIG_LUA_FLOAT: lua_pushstring(L,constants[i].name); - lua_pushnumber(L,(lua_Number)constants[i].dvalue); - lua_rawset(L,-3); - break; - case SWIG_LUA_CHAR: - lua_pushstring(L,constants[i].name); - lua_pushfstring(L,"%c",(char)constants[i].lvalue); + lua_pushnumber(L,(double)constants[i].dvalue); lua_rawset(L,-3); break; case SWIG_LUA_STRING: @@ -1436,9 +1283,8 @@ SWIG_Lua_InstallConstants(lua_State* L, swig_lua_const_info constants[]) { lua_rawset(L,-3); break; case SWIG_LUA_BINARY: - lua_pushstring(L,constants[i].name); - SWIG_NewMemberObj(L,constants[i].pvalue,constants[i].lvalue,*(constants[i]).ptype); - lua_rawset(L,-3); + /* TODO?? */ +/* obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype)); */ break; default: break; @@ -1446,34 +1292,25 @@ SWIG_Lua_InstallConstants(lua_State* L, swig_lua_const_info constants[]) { } } -/* ----------------------------------------------------------------------------- - * executing lua code from within the wrapper - * ----------------------------------------------------------------------------- */ +/* storing/access of swig_module_info */ +SWIGRUNTIME swig_module_info * +SWIG_Lua_GetModule(lua_State* L) { + swig_module_info *ret = 0; + lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME); + lua_rawget(L,LUA_REGISTRYINDEX); + if (lua_islightuserdata(L,-1)) + ret=(swig_module_info*)lua_touserdata(L,-1); + lua_pop(L,1); /* tidy */ + return ret; +} -#ifndef SWIG_DOSTRING_FAIL /* Allows redefining of error function */ -#define SWIG_DOSTRING_FAIL(S) fprintf(stderr,"%s\n",S) -#endif -/* Executes a C string in Lua a really simple way of calling lua from C -Unfortunately lua keeps changing its API's, so we need a conditional compile -In lua 5.0.X its lua_dostring() -In lua 5.1.X its luaL_dostring() -*/ -SWIGINTERN int -SWIG_Lua_dostring(lua_State *L, const char* str) { - int ok,top; - if (str==0 || str[0]==0) return 0; /* nothing to do */ - top=lua_gettop(L); /* save stack */ -#if (defined(LUA_VERSION_NUM) && (LUA_VERSION_NUM>=501)) - ok=luaL_dostring(L,str); /* looks like this is lua 5.1.X or later, good */ -#else - ok=lua_dostring(L,str); /* might be lua 5.0.x, using lua_dostring */ -#endif - if (ok!=0) { - SWIG_DOSTRING_FAIL(lua_tostring(L,-1)); - } - lua_settop(L,top); /* restore the stack */ - return ok; -} +SWIGRUNTIME void +SWIG_Lua_SetModule(lua_State* L, swig_module_info *module) { + /* add this all into the Lua registry: */ + lua_pushstring(L,"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME); + lua_pushlightuserdata(L,(void*)module); + lua_rawset(L,LUA_REGISTRYINDEX); +} #ifdef __cplusplus } @@ -1484,15 +1321,15 @@ SWIG_Lua_dostring(lua_State *L, const char* str) { /* -------- TYPES TABLE (BEGIN) -------- */ -#define SWIGTYPE_p_API swig_types[0] -#define SWIGTYPE_p_CoreSession swig_types[1] -#define SWIGTYPE_p_DTMF swig_types[2] -#define SWIGTYPE_p_Event swig_types[3] -#define SWIGTYPE_p_EventConsumer swig_types[4] -#define SWIGTYPE_p_IVRMenu swig_types[5] -#define SWIGTYPE_p_LUA__Dbh swig_types[6] -#define SWIGTYPE_p_LUA__Session swig_types[7] -#define SWIGTYPE_p_SWIGLUA_FN swig_types[8] +#define SWIGTYPE_SWIGLUA_FN swig_types[0] +#define SWIGTYPE_p_API swig_types[1] +#define SWIGTYPE_p_CoreSession swig_types[2] +#define SWIGTYPE_p_DTMF swig_types[3] +#define SWIGTYPE_p_Event swig_types[4] +#define SWIGTYPE_p_EventConsumer swig_types[5] +#define SWIGTYPE_p_IVRMenu swig_types[6] +#define SWIGTYPE_p_LUA__Dbh swig_types[7] +#define SWIGTYPE_p_LUA__Session swig_types[8] #define SWIGTYPE_p_Stream swig_types[9] #define SWIGTYPE_p_input_callback_state swig_types[10] #define SWIGTYPE_p_lua_State swig_types[11] @@ -1513,23 +1350,22 @@ SWIG_Lua_dostring(lua_State *L, const char* str) { #define SWIGTYPE_p_switch_stream_handle_t swig_types[26] #define SWIGTYPE_p_uint32_t swig_types[27] #define SWIGTYPE_p_void swig_types[28] -static swig_type_info *swig_types[30]; -static swig_module_info swig_module = {swig_types, 29, 0, 0, 0, 0}; +#define SWIGTYPE_switch_call_cause_t swig_types[29] +#define SWIGTYPE_switch_channel_state_t swig_types[30] +#define SWIGTYPE_switch_event_types_t swig_types[31] +#define SWIGTYPE_switch_input_type_t swig_types[32] +#define SWIGTYPE_switch_priority_t swig_types[33] +#define SWIGTYPE_uint32_t swig_types[34] +static swig_type_info *swig_types[36]; +static swig_module_info swig_module = {swig_types, 35, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) /* -------- TYPES TABLE (END) -------- */ -#define SWIG_name "freeswitch" -#define SWIG_init luaopen_freeswitch -#define SWIG_init_user luaopen_freeswitch_user - -#define SWIG_LUACODE luaopen_freeswitch_luacode - - -namespace swig { -typedef struct{} LANGUAGE_OBJ; -} +#define SWIG_init Freeswitch_Init +#define SWIG_name "freeswitch" +#define SWIG_import luaopen_freeswitch #include "switch.h" @@ -1544,18 +1380,15 @@ static int _wrap_consoleLog(lua_State* L) { char *arg1 = (char *) 0 ; char *arg2 = (char *) 0 ; - SWIG_check_num_args("consoleLog",2,2) - if(!lua_isstring(L,1)) SWIG_fail_arg("consoleLog",1,"char *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("consoleLog",2,"char *"); - arg1 = (char *)lua_tostring(L, 1); - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isstring(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + arg1 = (char*)lua_tostring(L, 1); + arg2 = (char*)lua_tostring(L, 2); consoleLog(arg1,arg2); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -1566,16 +1399,13 @@ static int _wrap_consoleCleanLog(lua_State* L) { int SWIG_arg = -1; char *arg1 = (char *) 0 ; - SWIG_check_num_args("consoleCleanLog",1,1) - if(!lua_isstring(L,1)) SWIG_fail_arg("consoleCleanLog",1,"char *"); - arg1 = (char *)lua_tostring(L, 1); + if(!lua_isstring(L,1)) SWIG_fail_arg(1); + arg1 = (char*)lua_tostring(L, 1); consoleCleanLog(arg1); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -1602,37 +1432,32 @@ static int _wrap_new_IVRMenu(lua_State* L) { int arg16 ; IVRMenu *result = 0 ; - SWIG_check_num_args("IVRMenu",16,16) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("IVRMenu",1,"IVRMenu *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("IVRMenu",2,"char const *"); - if(!lua_isstring(L,3)) SWIG_fail_arg("IVRMenu",3,"char const *"); - if(!lua_isstring(L,4)) SWIG_fail_arg("IVRMenu",4,"char const *"); - if(!lua_isstring(L,5)) SWIG_fail_arg("IVRMenu",5,"char const *"); - if(!lua_isstring(L,6)) SWIG_fail_arg("IVRMenu",6,"char const *"); - if(!lua_isstring(L,7)) SWIG_fail_arg("IVRMenu",7,"char const *"); - if(!lua_isstring(L,8)) SWIG_fail_arg("IVRMenu",8,"char const *"); - if(!lua_isstring(L,9)) SWIG_fail_arg("IVRMenu",9,"char const *"); - if(!lua_isstring(L,10)) SWIG_fail_arg("IVRMenu",10,"char const *"); - if(!lua_isnumber(L,11)) SWIG_fail_arg("IVRMenu",11,"int"); - if(!lua_isnumber(L,12)) SWIG_fail_arg("IVRMenu",12,"int"); - if(!lua_isnumber(L,13)) SWIG_fail_arg("IVRMenu",13,"int"); - if(!lua_isnumber(L,14)) SWIG_fail_arg("IVRMenu",14,"int"); - if(!lua_isnumber(L,15)) SWIG_fail_arg("IVRMenu",15,"int"); - if(!lua_isnumber(L,16)) SWIG_fail_arg("IVRMenu",16,"int"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,0))){ - SWIG_fail_ptr("new_IVRMenu",1,SWIGTYPE_p_IVRMenu); - } - - arg2 = (char *)lua_tostring(L, 2); - arg3 = (char *)lua_tostring(L, 3); - arg4 = (char *)lua_tostring(L, 4); - arg5 = (char *)lua_tostring(L, 5); - arg6 = (char *)lua_tostring(L, 6); - arg7 = (char *)lua_tostring(L, 7); - arg8 = (char *)lua_tostring(L, 8); - arg9 = (char *)lua_tostring(L, 9); - arg10 = (char *)lua_tostring(L, 10); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + if(!lua_isstring(L,3)) SWIG_fail_arg(3); + if(!lua_isstring(L,4)) SWIG_fail_arg(4); + if(!lua_isstring(L,5)) SWIG_fail_arg(5); + if(!lua_isstring(L,6)) SWIG_fail_arg(6); + if(!lua_isstring(L,7)) SWIG_fail_arg(7); + if(!lua_isstring(L,8)) SWIG_fail_arg(8); + if(!lua_isstring(L,9)) SWIG_fail_arg(9); + if(!lua_isstring(L,10)) SWIG_fail_arg(10); + if(!lua_isnumber(L,11)) SWIG_fail_arg(11); + if(!lua_isnumber(L,12)) SWIG_fail_arg(12); + if(!lua_isnumber(L,13)) SWIG_fail_arg(13); + if(!lua_isnumber(L,14)) SWIG_fail_arg(14); + if(!lua_isnumber(L,15)) SWIG_fail_arg(15); + if(!lua_isnumber(L,16)) SWIG_fail_arg(16); + arg1=(IVRMenu *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_IVRMenu,0,1,"new_IVRMenu"); + arg2 = (char*)lua_tostring(L, 2); + arg3 = (char*)lua_tostring(L, 3); + arg4 = (char*)lua_tostring(L, 4); + arg5 = (char*)lua_tostring(L, 5); + arg6 = (char*)lua_tostring(L, 6); + arg7 = (char*)lua_tostring(L, 7); + arg8 = (char*)lua_tostring(L, 8); + arg9 = (char*)lua_tostring(L, 9); + arg10 = (char*)lua_tostring(L, 10); arg11 = (int)lua_tonumber(L, 11); arg12 = (int)lua_tonumber(L, 12); arg13 = (int)lua_tonumber(L, 13); @@ -1644,8 +1469,6 @@ static int _wrap_new_IVRMenu(lua_State* L) { SWIG_NewPointerObj(L,result,SWIGTYPE_p_IVRMenu,1); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -1656,21 +1479,14 @@ static int _wrap_delete_IVRMenu(lua_State* L) { int SWIG_arg = -1; IVRMenu *arg1 = (IVRMenu *) 0 ; - SWIG_check_num_args("IVRMenu",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("IVRMenu",1,"IVRMenu *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,SWIG_POINTER_DISOWN))){ - SWIG_fail_ptr("delete_IVRMenu",1,SWIGTYPE_p_IVRMenu); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(IVRMenu *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_IVRMenu,0,1,"delete_IVRMenu"); delete arg1; SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -1684,26 +1500,19 @@ static int _wrap_IVRMenu_bindAction(lua_State* L) { char *arg3 = (char *) 0 ; char *arg4 = (char *) 0 ; - SWIG_check_num_args("bindAction",4,4) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("bindAction",1,"IVRMenu *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("bindAction",2,"char *"); - if(!lua_isstring(L,3)) SWIG_fail_arg("bindAction",3,"char const *"); - if(!lua_isstring(L,4)) SWIG_fail_arg("bindAction",4,"char const *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,0))){ - SWIG_fail_ptr("IVRMenu_bindAction",1,SWIGTYPE_p_IVRMenu); - } - - arg2 = (char *)lua_tostring(L, 2); - arg3 = (char *)lua_tostring(L, 3); - arg4 = (char *)lua_tostring(L, 4); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + if(!lua_isstring(L,3)) SWIG_fail_arg(3); + if(!lua_isstring(L,4)) SWIG_fail_arg(4); + arg1=(IVRMenu *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_IVRMenu,0,1,"IVRMenu_bindAction"); + arg2 = (char*)lua_tostring(L, 2); + arg3 = (char*)lua_tostring(L, 3); + arg4 = (char*)lua_tostring(L, 4); (arg1)->bindAction(arg2,(char const *)arg3,(char const *)arg4); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -1716,28 +1525,17 @@ static int _wrap_IVRMenu_execute(lua_State* L) { CoreSession *arg2 = (CoreSession *) 0 ; char *arg3 = (char *) 0 ; - SWIG_check_num_args("execute",3,3) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("execute",1,"IVRMenu *"); - if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("execute",2,"CoreSession *"); - if(!lua_isstring(L,3)) SWIG_fail_arg("execute",3,"char const *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_IVRMenu,0))){ - SWIG_fail_ptr("IVRMenu_execute",1,SWIGTYPE_p_IVRMenu); - } - - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("IVRMenu_execute",2,SWIGTYPE_p_CoreSession); - } - - arg3 = (char *)lua_tostring(L, 3); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); + if(!lua_isstring(L,3)) SWIG_fail_arg(3); + arg1=(IVRMenu *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_IVRMenu,0,1,"IVRMenu_execute"); + arg2=(CoreSession *)SWIG_MustGetPtr(L,2,SWIGTYPE_p_CoreSession,0,2,"IVRMenu_execute"); + arg3 = (char*)lua_tostring(L, 3); (arg1)->execute(arg2,(char const *)arg3); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -1757,21 +1555,17 @@ static swig_lua_attribute swig_IVRMenu_attributes[] = { {0,0,0} }; static swig_lua_class *swig_IVRMenu_bases[] = {0}; -static const char *swig_IVRMenu_base_names[] = {0}; -static swig_lua_class _wrap_class_IVRMenu = { "IVRMenu", &SWIGTYPE_p_IVRMenu,_wrap_new_IVRMenu, swig_delete_IVRMenu, swig_IVRMenu_methods, swig_IVRMenu_attributes, swig_IVRMenu_bases, swig_IVRMenu_base_names }; +swig_lua_class _wrap_class_IVRMenu = { "IVRMenu", &SWIGTYPE_p_IVRMenu,_wrap_new_IVRMenu, swig_delete_IVRMenu, swig_IVRMenu_methods, swig_IVRMenu_attributes, swig_IVRMenu_bases }; static int _wrap_new_API(lua_State* L) { int SWIG_arg = -1; API *result = 0 ; - SWIG_check_num_args("API",0,0) result = (API *)new API(); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_API,1); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -1782,21 +1576,14 @@ static int _wrap_delete_API(lua_State* L) { int SWIG_arg = -1; API *arg1 = (API *) 0 ; - SWIG_check_num_args("API",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("API",1,"API *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_API,SWIG_POINTER_DISOWN))){ - SWIG_fail_ptr("delete_API",1,SWIGTYPE_p_API); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(API *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_API,0,1,"delete_API"); delete arg1; SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -1810,26 +1597,19 @@ static int _wrap_API_execute(lua_State* L) { char *arg3 = (char *) NULL ; char *result = 0 ; - SWIG_check_num_args("execute",2,3) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("execute",1,"API *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("execute",2,"char const *"); - if(lua_gettop(L)>=3 && !lua_isstring(L,3)) SWIG_fail_arg("execute",3,"char const *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_API,0))){ - SWIG_fail_ptr("API_execute",1,SWIGTYPE_p_API); - } - - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + if(lua_gettop(L)>=3 && !lua_isstring(L,3)) SWIG_fail_arg(3); + arg1=(API *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_API,0,1,"API_execute"); + arg2 = (char*)lua_tostring(L, 2); if(lua_gettop(L)>=3){ - arg3 = (char *)lua_tostring(L, 3); + arg3 = (char*)lua_tostring(L, 3); } result = (char *)(arg1)->execute((char const *)arg2,(char const *)arg3); SWIG_arg=0; - lua_pushstring(L,(const char*)result); SWIG_arg++; + lua_pushstring(L,result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -1842,22 +1622,15 @@ static int _wrap_API_executeString(lua_State* L) { char *arg2 = (char *) 0 ; char *result = 0 ; - SWIG_check_num_args("executeString",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("executeString",1,"API *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("executeString",2,"char const *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_API,0))){ - SWIG_fail_ptr("API_executeString",1,SWIGTYPE_p_API); - } - - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + arg1=(API *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_API,0,1,"API_executeString"); + arg2 = (char*)lua_tostring(L, 2); result = (char *)(arg1)->executeString((char const *)arg2); SWIG_arg=0; - lua_pushstring(L,(const char*)result); SWIG_arg++; + lua_pushstring(L,result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -1869,20 +1642,13 @@ static int _wrap_API_getTime(lua_State* L) { API *arg1 = (API *) 0 ; char *result = 0 ; - SWIG_check_num_args("getTime",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getTime",1,"API *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_API,0))){ - SWIG_fail_ptr("API_getTime",1,SWIGTYPE_p_API); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(API *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_API,0,1,"API_getTime"); result = (char *)(arg1)->getTime(); SWIG_arg=0; - lua_pushstring(L,(const char*)result); SWIG_arg++; + lua_pushstring(L,result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -1903,31 +1669,23 @@ static swig_lua_attribute swig_API_attributes[] = { {0,0,0} }; static swig_lua_class *swig_API_bases[] = {0}; -static const char *swig_API_base_names[] = {0}; -static swig_lua_class _wrap_class_API = { "API", &SWIGTYPE_p_API,_wrap_new_API, swig_delete_API, swig_API_methods, swig_API_attributes, swig_API_bases, swig_API_base_names }; +swig_lua_class _wrap_class_API = { "API", &SWIGTYPE_p_API,_wrap_new_API, swig_delete_API, swig_API_methods, swig_API_attributes, swig_API_bases }; static int _wrap_input_callback_state_t_function_set(lua_State* L) { int SWIG_arg = -1; input_callback_state_t *arg1 = (input_callback_state_t *) 0 ; void *arg2 = (void *) 0 ; - SWIG_check_num_args("function",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("function",1,"input_callback_state_t *"); - if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("function",2,"void *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){ - SWIG_fail_ptr("input_callback_state_t_function_set",1,SWIGTYPE_p_input_callback_state); - } - - arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"input_callback_state_t_function_set"); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); + arg1=(input_callback_state_t *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_input_callback_state,0,1,"input_callback_state_t_function_set"); + arg2=((swig_lua_userdata*)(lua_touserdata(L,2)))->ptr; if (arg1) (arg1)->function = arg2; SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -1939,20 +1697,13 @@ static int _wrap_input_callback_state_t_function_get(lua_State* L) { input_callback_state_t *arg1 = (input_callback_state_t *) 0 ; void *result = 0 ; - SWIG_check_num_args("function",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("function",1,"input_callback_state_t *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){ - SWIG_fail_ptr("input_callback_state_t_function_get",1,SWIGTYPE_p_input_callback_state); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(input_callback_state_t *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_input_callback_state,0,1,"input_callback_state_t_function_get"); result = (void *) ((arg1)->function); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_void,0); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -1964,23 +1715,16 @@ static int _wrap_input_callback_state_t_threadState_set(lua_State* L) { input_callback_state_t *arg1 = (input_callback_state_t *) 0 ; void *arg2 = (void *) 0 ; - SWIG_check_num_args("threadState",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("threadState",1,"input_callback_state_t *"); - if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("threadState",2,"void *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){ - SWIG_fail_ptr("input_callback_state_t_threadState_set",1,SWIGTYPE_p_input_callback_state); - } - - arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"input_callback_state_t_threadState_set"); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); + arg1=(input_callback_state_t *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_input_callback_state,0,1,"input_callback_state_t_threadState_set"); + arg2=((swig_lua_userdata*)(lua_touserdata(L,2)))->ptr; if (arg1) (arg1)->threadState = arg2; SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -1992,20 +1736,13 @@ static int _wrap_input_callback_state_t_threadState_get(lua_State* L) { input_callback_state_t *arg1 = (input_callback_state_t *) 0 ; void *result = 0 ; - SWIG_check_num_args("threadState",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("threadState",1,"input_callback_state_t *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){ - SWIG_fail_ptr("input_callback_state_t_threadState_get",1,SWIGTYPE_p_input_callback_state); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(input_callback_state_t *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_input_callback_state,0,1,"input_callback_state_t_threadState_get"); result = (void *) ((arg1)->threadState); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_void,0); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2017,23 +1754,16 @@ static int _wrap_input_callback_state_t_extra_set(lua_State* L) { input_callback_state_t *arg1 = (input_callback_state_t *) 0 ; void *arg2 = (void *) 0 ; - SWIG_check_num_args("extra",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("extra",1,"input_callback_state_t *"); - if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("extra",2,"void *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){ - SWIG_fail_ptr("input_callback_state_t_extra_set",1,SWIGTYPE_p_input_callback_state); - } - - arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"input_callback_state_t_extra_set"); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); + arg1=(input_callback_state_t *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_input_callback_state,0,1,"input_callback_state_t_extra_set"); + arg2=((swig_lua_userdata*)(lua_touserdata(L,2)))->ptr; if (arg1) (arg1)->extra = arg2; SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2045,20 +1775,13 @@ static int _wrap_input_callback_state_t_extra_get(lua_State* L) { input_callback_state_t *arg1 = (input_callback_state_t *) 0 ; void *result = 0 ; - SWIG_check_num_args("extra",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("extra",1,"input_callback_state_t *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){ - SWIG_fail_ptr("input_callback_state_t_extra_get",1,SWIGTYPE_p_input_callback_state); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(input_callback_state_t *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_input_callback_state,0,1,"input_callback_state_t_extra_get"); result = (void *) ((arg1)->extra); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_void,0); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2070,20 +1793,15 @@ static int _wrap_input_callback_state_t_funcargs_set(lua_State* L) { input_callback_state_t *arg1 = (input_callback_state_t *) 0 ; char *arg2 = (char *) 0 ; - SWIG_check_num_args("funcargs",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("funcargs",1,"input_callback_state_t *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("funcargs",2,"char *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){ - SWIG_fail_ptr("input_callback_state_t_funcargs_set",1,SWIGTYPE_p_input_callback_state); - } - - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + arg1=(input_callback_state_t *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_input_callback_state,0,1,"input_callback_state_t_funcargs_set"); + arg2 = (char*)lua_tostring(L, 2); { if (arg1->funcargs) delete [] arg1->funcargs; if (arg2) { - arg1->funcargs = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->funcargs, (const char *)arg2); + arg1->funcargs = (char *) (new char[strlen(arg2)+1]); + strcpy((char *) arg1->funcargs,arg2); } else { arg1->funcargs = 0; } @@ -2092,8 +1810,6 @@ static int _wrap_input_callback_state_t_funcargs_set(lua_State* L) { return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2105,20 +1821,13 @@ static int _wrap_input_callback_state_t_funcargs_get(lua_State* L) { input_callback_state_t *arg1 = (input_callback_state_t *) 0 ; char *result = 0 ; - SWIG_check_num_args("funcargs",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("funcargs",1,"input_callback_state_t *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,0))){ - SWIG_fail_ptr("input_callback_state_t_funcargs_get",1,SWIGTYPE_p_input_callback_state); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(input_callback_state_t *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_input_callback_state,0,1,"input_callback_state_t_funcargs_get"); result = (char *) ((arg1)->funcargs); SWIG_arg=0; - lua_pushstring(L,(const char*)result); SWIG_arg++; + lua_pushstring(L,result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2129,14 +1838,11 @@ static int _wrap_new_input_callback_state_t(lua_State* L) { int SWIG_arg = -1; input_callback_state_t *result = 0 ; - SWIG_check_num_args("input_callback_state_t::input_callback_state_t",0,0) result = (input_callback_state_t *)new input_callback_state_t(); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_input_callback_state,1); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2147,21 +1853,14 @@ static int _wrap_delete_input_callback_state_t(lua_State* L) { int SWIG_arg = -1; input_callback_state_t *arg1 = (input_callback_state_t *) 0 ; - SWIG_check_num_args("input_callback_state_t::~input_callback_state_t",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("input_callback_state_t::~input_callback_state_t",1,"input_callback_state_t *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_input_callback_state,SWIG_POINTER_DISOWN))){ - SWIG_fail_ptr("delete_input_callback_state_t",1,SWIGTYPE_p_input_callback_state); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(input_callback_state_t *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_input_callback_state,0,1,"delete_input_callback_state_t"); delete arg1; SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2176,38 +1875,30 @@ static swig_lua_method swig_input_callback_state_t_methods[] = { {0,0} }; static swig_lua_attribute swig_input_callback_state_t_attributes[] = { - { "function", _wrap_input_callback_state_t_function_get, _wrap_input_callback_state_t_function_set}, - { "threadState", _wrap_input_callback_state_t_threadState_get, _wrap_input_callback_state_t_threadState_set}, - { "extra", _wrap_input_callback_state_t_extra_get, _wrap_input_callback_state_t_extra_set}, - { "funcargs", _wrap_input_callback_state_t_funcargs_get, _wrap_input_callback_state_t_funcargs_set}, + { "function",_wrap_input_callback_state_t_function_get, _wrap_input_callback_state_t_function_set}, + { "threadState",_wrap_input_callback_state_t_threadState_get, _wrap_input_callback_state_t_threadState_set}, + { "extra",_wrap_input_callback_state_t_extra_get, _wrap_input_callback_state_t_extra_set}, + { "funcargs",_wrap_input_callback_state_t_funcargs_get, _wrap_input_callback_state_t_funcargs_set}, {0,0,0} }; static swig_lua_class *swig_input_callback_state_t_bases[] = {0}; -static const char *swig_input_callback_state_t_base_names[] = {0}; -static swig_lua_class _wrap_class_input_callback_state_t = { "input_callback_state_t", &SWIGTYPE_p_input_callback_state,_wrap_new_input_callback_state_t, swig_delete_input_callback_state_t, swig_input_callback_state_t_methods, swig_input_callback_state_t_attributes, swig_input_callback_state_t_bases, swig_input_callback_state_t_base_names }; +swig_lua_class _wrap_class_input_callback_state_t = { "input_callback_state_t", &SWIGTYPE_p_input_callback_state,_wrap_new_input_callback_state_t, swig_delete_input_callback_state_t, swig_input_callback_state_t_methods, swig_input_callback_state_t_attributes, swig_input_callback_state_t_bases }; static int _wrap_DTMF_digit_set(lua_State* L) { int SWIG_arg = -1; DTMF *arg1 = (DTMF *) 0 ; char arg2 ; - SWIG_check_num_args("digit",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("digit",1,"DTMF *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("digit",2,"char"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_DTMF,0))){ - SWIG_fail_ptr("DTMF_digit_set",1,SWIGTYPE_p_DTMF); - } - - arg2 = (lua_tostring(L, 2))[0]; + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + arg1=(DTMF *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_DTMF,0,1,"DTMF_digit_set"); + arg2 = ((char*)lua_tostring(L, 2))[0]; if (arg1) (arg1)->digit = arg2; SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2219,20 +1910,13 @@ static int _wrap_DTMF_digit_get(lua_State* L) { DTMF *arg1 = (DTMF *) 0 ; char result; - SWIG_check_num_args("digit",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("digit",1,"DTMF *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_DTMF,0))){ - SWIG_fail_ptr("DTMF_digit_get",1,SWIGTYPE_p_DTMF); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(DTMF *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_DTMF,0,1,"DTMF_digit_get"); result = (char) ((arg1)->digit); SWIG_arg=0; lua_pushfstring(L,"%c",result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2243,30 +1927,21 @@ static int _wrap_DTMF_duration_set(lua_State* L) { int SWIG_arg = -1; DTMF *arg1 = (DTMF *) 0 ; uint32_t arg2 ; - uint32_t *argp2 ; - - SWIG_check_num_args("duration",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("duration",1,"DTMF *"); - if(!lua_isuserdata(L,2)) SWIG_fail_arg("duration",2,"uint32_t"); - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_DTMF,0))){ - SWIG_fail_ptr("DTMF_duration_set",1,SWIGTYPE_p_DTMF); - } - - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_uint32_t,0))){ - SWIG_fail_ptr("DTMF_duration_set",2,SWIGTYPE_p_uint32_t); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); + arg1=(DTMF *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_DTMF,0,1,"DTMF_duration_set"); + { + uint32_t * argp; + if(SWIG_ConvertPtr(L,2,(void**)(&argp),SWIGTYPE_p_uint32_t,0)) SWIG_fail; + arg2 = *argp; } - arg2 = *argp2; - if (arg1) (arg1)->duration = arg2; SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2278,23 +1953,17 @@ static int _wrap_DTMF_duration_get(lua_State* L) { DTMF *arg1 = (DTMF *) 0 ; uint32_t result; - SWIG_check_num_args("duration",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("duration",1,"DTMF *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_DTMF,0))){ - SWIG_fail_ptr("DTMF_duration_get",1,SWIGTYPE_p_DTMF); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(DTMF *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_DTMF,0,1,"DTMF_duration_get"); result = ((arg1)->duration); SWIG_arg=0; { - uint32_t * resultptr = new uint32_t((uint32_t &) result); + uint32_t * resultptr; + resultptr = new uint32_t((uint32_t &) result); SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_uint32_t,1); SWIG_arg++; } return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2306,25 +1975,22 @@ static int _wrap_new_DTMF(lua_State* L) { char arg1 ; uint32_t arg2 = (uint32_t) SWITCH_DEFAULT_DTMF_DURATION ; DTMF *result = 0 ; - uint32_t *argp2 ; - SWIG_check_num_args("DTMF",1,2) - if(!lua_isstring(L,1)) SWIG_fail_arg("DTMF",1,"char"); - if(lua_gettop(L)>=2 && !lua_isuserdata(L,2)) SWIG_fail_arg("DTMF",2,"uint32_t"); - arg1 = (lua_tostring(L, 1))[0]; + if(!lua_isstring(L,1)) SWIG_fail_arg(1); + if(lua_gettop(L)>=2 && !lua_isuserdata(L,2)) SWIG_fail_arg(2); + arg1 = ((char*)lua_tostring(L, 1))[0]; if(lua_gettop(L)>=2){ - if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_uint32_t,0))){ - SWIG_fail_ptr("new_DTMF",2,SWIGTYPE_p_uint32_t); + { + uint32_t * argp; + if(SWIG_ConvertPtr(L,2,(void**)(&argp),SWIGTYPE_p_uint32_t,0)) SWIG_fail; + arg2 = *argp; } - arg2 = *argp2; } result = (DTMF *)new DTMF(arg1,arg2); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_DTMF,1); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2335,21 +2001,14 @@ static int _wrap_delete_DTMF(lua_State* L) { int SWIG_arg = -1; DTMF *arg1 = (DTMF *) 0 ; - SWIG_check_num_args("DTMF",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("DTMF",1,"DTMF *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_DTMF,SWIG_POINTER_DISOWN))){ - SWIG_fail_ptr("delete_DTMF",1,SWIGTYPE_p_DTMF); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(DTMF *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_DTMF,0,1,"delete_DTMF"); delete arg1; SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2364,26 +2023,22 @@ static swig_lua_method swig_DTMF_methods[] = { {0,0} }; static swig_lua_attribute swig_DTMF_attributes[] = { - { "digit", _wrap_DTMF_digit_get, _wrap_DTMF_digit_set}, - { "duration", _wrap_DTMF_duration_get, _wrap_DTMF_duration_set}, + { "digit",_wrap_DTMF_digit_get, _wrap_DTMF_digit_set}, + { "duration",_wrap_DTMF_duration_get, _wrap_DTMF_duration_set}, {0,0,0} }; static swig_lua_class *swig_DTMF_bases[] = {0}; -static const char *swig_DTMF_base_names[] = {0}; -static swig_lua_class _wrap_class_DTMF = { "DTMF", &SWIGTYPE_p_DTMF,_wrap_new_DTMF, swig_delete_DTMF, swig_DTMF_methods, swig_DTMF_attributes, swig_DTMF_bases, swig_DTMF_base_names }; +swig_lua_class _wrap_class_DTMF = { "DTMF", &SWIGTYPE_p_DTMF,_wrap_new_DTMF, swig_delete_DTMF, swig_DTMF_methods, swig_DTMF_attributes, swig_DTMF_bases }; static int _wrap_new_Stream__SWIG_0(lua_State* L) { int SWIG_arg = -1; Stream *result = 0 ; - SWIG_check_num_args("Stream",0,0) result = (Stream *)new Stream(); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_Stream,1); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2395,20 +2050,13 @@ static int _wrap_new_Stream__SWIG_1(lua_State* L) { switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0 ; Stream *result = 0 ; - SWIG_check_num_args("Stream",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Stream",1,"switch_stream_handle_t *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_switch_stream_handle_t,0))){ - SWIG_fail_ptr("new_Stream",1,SWIGTYPE_p_switch_stream_handle_t); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(switch_stream_handle_t *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_switch_stream_handle_t,0,1,"new_Stream"); result = (Stream *)new Stream(arg1); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_Stream,1); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2429,7 +2077,7 @@ static int _wrap_new_Stream(lua_State* L) { int _v; { void *ptr; - if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_switch_stream_handle_t, 0)) { + if (lua_isuserdata(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_switch_stream_handle_t, 0)) { _v = 0; } else { _v = 1; @@ -2449,21 +2097,14 @@ static int _wrap_delete_Stream(lua_State* L) { int SWIG_arg = -1; Stream *arg1 = (Stream *) 0 ; - SWIG_check_num_args("Stream",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Stream",1,"Stream *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Stream,SWIG_POINTER_DISOWN))){ - SWIG_fail_ptr("delete_Stream",1,SWIGTYPE_p_Stream); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(Stream *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Stream,0,1,"delete_Stream"); delete arg1; SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2475,22 +2116,15 @@ static int _wrap_Stream_write(lua_State* L) { Stream *arg1 = (Stream *) 0 ; char *arg2 = (char *) 0 ; - SWIG_check_num_args("write",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("write",1,"Stream *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("write",2,"char const *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Stream,0))){ - SWIG_fail_ptr("Stream_write",1,SWIGTYPE_p_Stream); - } - - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + arg1=(Stream *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Stream,0,1,"Stream_write"); + arg2 = (char*)lua_tostring(L, 2); (arg1)->write((char const *)arg2); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2502,20 +2136,13 @@ static int _wrap_Stream_get_data(lua_State* L) { Stream *arg1 = (Stream *) 0 ; char *result = 0 ; - SWIG_check_num_args("get_data",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("get_data",1,"Stream *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Stream,0))){ - SWIG_fail_ptr("Stream_get_data",1,SWIGTYPE_p_Stream); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(Stream *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Stream,0,1,"Stream_get_data"); result = (char *)(arg1)->get_data(); SWIG_arg=0; - lua_pushstring(L,(const char*)result); SWIG_arg++; + lua_pushstring(L,result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2535,35 +2162,23 @@ static swig_lua_attribute swig_Stream_attributes[] = { {0,0,0} }; static swig_lua_class *swig_Stream_bases[] = {0}; -static const char *swig_Stream_base_names[] = {0}; -static swig_lua_class _wrap_class_Stream = { "Stream", &SWIGTYPE_p_Stream,_wrap_new_Stream, swig_delete_Stream, swig_Stream_methods, swig_Stream_attributes, swig_Stream_bases, swig_Stream_base_names }; +swig_lua_class _wrap_class_Stream = { "Stream", &SWIGTYPE_p_Stream,_wrap_new_Stream, swig_delete_Stream, swig_Stream_methods, swig_Stream_attributes, swig_Stream_bases }; static int _wrap_Event_event_set(lua_State* L) { int SWIG_arg = -1; Event *arg1 = (Event *) 0 ; switch_event_t *arg2 = (switch_event_t *) 0 ; - SWIG_check_num_args("event",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("event",1,"Event *"); - if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("event",2,"switch_event_t *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ - SWIG_fail_ptr("Event_event_set",1,SWIGTYPE_p_Event); - } - - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_switch_event_t,SWIG_POINTER_DISOWN))){ - SWIG_fail_ptr("Event_event_set",2,SWIGTYPE_p_switch_event_t); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); + arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"Event_event_set"); + arg2=(switch_event_t *)SWIG_MustGetPtr(L,2,SWIGTYPE_p_switch_event_t,0,2,"Event_event_set"); if (arg1) (arg1)->event = arg2; SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2575,20 +2190,13 @@ static int _wrap_Event_event_get(lua_State* L) { Event *arg1 = (Event *) 0 ; switch_event_t *result = 0 ; - SWIG_check_num_args("event",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("event",1,"Event *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ - SWIG_fail_ptr("Event_event_get",1,SWIGTYPE_p_Event); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"Event_event_get"); result = (switch_event_t *) ((arg1)->event); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_switch_event_t,0); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2600,20 +2208,15 @@ static int _wrap_Event_serialized_string_set(lua_State* L) { Event *arg1 = (Event *) 0 ; char *arg2 = (char *) 0 ; - SWIG_check_num_args("serialized_string",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("serialized_string",1,"Event *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("serialized_string",2,"char *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ - SWIG_fail_ptr("Event_serialized_string_set",1,SWIGTYPE_p_Event); - } - - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"Event_serialized_string_set"); + arg2 = (char*)lua_tostring(L, 2); { if (arg1->serialized_string) delete [] arg1->serialized_string; if (arg2) { - arg1->serialized_string = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->serialized_string, (const char *)arg2); + arg1->serialized_string = (char *) (new char[strlen(arg2)+1]); + strcpy((char *) arg1->serialized_string,arg2); } else { arg1->serialized_string = 0; } @@ -2622,8 +2225,6 @@ static int _wrap_Event_serialized_string_set(lua_State* L) { return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2635,20 +2236,13 @@ static int _wrap_Event_serialized_string_get(lua_State* L) { Event *arg1 = (Event *) 0 ; char *result = 0 ; - SWIG_check_num_args("serialized_string",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("serialized_string",1,"Event *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ - SWIG_fail_ptr("Event_serialized_string_get",1,SWIGTYPE_p_Event); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"Event_serialized_string_get"); result = (char *) ((arg1)->serialized_string); SWIG_arg=0; - lua_pushstring(L,(const char*)result); SWIG_arg++; + lua_pushstring(L,result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2660,14 +2254,9 @@ static int _wrap_Event_mine_set(lua_State* L) { Event *arg1 = (Event *) 0 ; int arg2 ; - SWIG_check_num_args("mine",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("mine",1,"Event *"); - if(!lua_isnumber(L,2)) SWIG_fail_arg("mine",2,"int"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ - SWIG_fail_ptr("Event_mine_set",1,SWIGTYPE_p_Event); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isnumber(L,2)) SWIG_fail_arg(2); + arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"Event_mine_set"); arg2 = (int)lua_tonumber(L, 2); if (arg1) (arg1)->mine = arg2; @@ -2675,8 +2264,6 @@ static int _wrap_Event_mine_set(lua_State* L) { return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2688,20 +2275,13 @@ static int _wrap_Event_mine_get(lua_State* L) { Event *arg1 = (Event *) 0 ; int result; - SWIG_check_num_args("mine",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("mine",1,"Event *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ - SWIG_fail_ptr("Event_mine_get",1,SWIGTYPE_p_Event); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"Event_mine_get"); result = (int) ((arg1)->mine); SWIG_arg=0; lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2714,20 +2294,17 @@ static int _wrap_new_Event__SWIG_0(lua_State* L) { char *arg2 = (char *) NULL ; Event *result = 0 ; - SWIG_check_num_args("Event",1,2) - if(!lua_isstring(L,1)) SWIG_fail_arg("Event",1,"char const *"); - if(lua_gettop(L)>=2 && !lua_isstring(L,2)) SWIG_fail_arg("Event",2,"char const *"); - arg1 = (char *)lua_tostring(L, 1); + if(!lua_isstring(L,1)) SWIG_fail_arg(1); + if(lua_gettop(L)>=2 && !lua_isstring(L,2)) SWIG_fail_arg(2); + arg1 = (char*)lua_tostring(L, 1); if(lua_gettop(L)>=2){ - arg2 = (char *)lua_tostring(L, 2); + arg2 = (char*)lua_tostring(L, 2); } result = (Event *)new Event((char const *)arg1,(char const *)arg2); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_Event,1); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2740,14 +2317,9 @@ static int _wrap_new_Event__SWIG_1(lua_State* L) { int arg2 = (int) 0 ; Event *result = 0 ; - SWIG_check_num_args("Event",1,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Event",1,"switch_event_t *"); - if(lua_gettop(L)>=2 && !lua_isnumber(L,2)) SWIG_fail_arg("Event",2,"int"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_switch_event_t,0))){ - SWIG_fail_ptr("new_Event",1,SWIGTYPE_p_switch_event_t); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(lua_gettop(L)>=2 && !lua_isnumber(L,2)) SWIG_fail_arg(2); + arg1=(switch_event_t *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_switch_event_t,0,1,"new_Event"); if(lua_gettop(L)>=2){ arg2 = (int)lua_tonumber(L, 2); } @@ -2756,8 +2328,6 @@ static int _wrap_new_Event__SWIG_1(lua_State* L) { SWIG_NewPointerObj(L,result,SWIGTYPE_p_Event,1); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2775,7 +2345,7 @@ static int _wrap_new_Event(lua_State* L) { int _v; { void *ptr; - if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_switch_event_t, 0)) { + if (lua_isuserdata(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_switch_event_t, 0)) { _v = 0; } else { _v = 1; @@ -2820,21 +2390,14 @@ static int _wrap_delete_Event(lua_State* L) { int SWIG_arg = -1; Event *arg1 = (Event *) 0 ; - SWIG_check_num_args("Event",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("Event",1,"Event *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,SWIG_POINTER_DISOWN))){ - SWIG_fail_ptr("delete_Event",1,SWIGTYPE_p_Event); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"delete_Event"); delete arg1; SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2847,24 +2410,17 @@ static int _wrap_Event_serialize(lua_State* L) { char *arg2 = (char *) NULL ; char *result = 0 ; - SWIG_check_num_args("serialize",1,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("serialize",1,"Event *"); - if(lua_gettop(L)>=2 && !lua_isstring(L,2)) SWIG_fail_arg("serialize",2,"char const *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ - SWIG_fail_ptr("Event_serialize",1,SWIGTYPE_p_Event); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(lua_gettop(L)>=2 && !lua_isstring(L,2)) SWIG_fail_arg(2); + arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"Event_serialize"); if(lua_gettop(L)>=2){ - arg2 = (char *)lua_tostring(L, 2); + arg2 = (char*)lua_tostring(L, 2); } result = (char *)(arg1)->serialize((char const *)arg2); SWIG_arg=0; - lua_pushstring(L,(const char*)result); SWIG_arg++; + lua_pushstring(L,result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2876,29 +2432,22 @@ static int _wrap_Event_setPriority(lua_State* L) { Event *arg1 = (Event *) 0 ; switch_priority_t arg2 = (switch_priority_t) SWITCH_PRIORITY_NORMAL ; bool result; - switch_priority_t *argp2 ; - - SWIG_check_num_args("setPriority",1,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setPriority",1,"Event *"); - if(lua_gettop(L)>=2 && !lua_isuserdata(L,2)) SWIG_fail_arg("setPriority",2,"switch_priority_t"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ - SWIG_fail_ptr("Event_setPriority",1,SWIGTYPE_p_Event); - } + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(lua_gettop(L)>=2 && !lua_isuserdata(L,2)) SWIG_fail_arg(2); + arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"Event_setPriority"); if(lua_gettop(L)>=2){ - if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_switch_priority_t,0))){ - SWIG_fail_ptr("Event_setPriority",2,SWIGTYPE_p_switch_priority_t); + { + switch_priority_t * argp; + if(SWIG_ConvertPtr(L,2,(void**)(&argp),SWIGTYPE_p_switch_priority_t,0)) SWIG_fail; + arg2 = *argp; } - arg2 = *argp2; } result = (bool)(arg1)->setPriority(arg2); SWIG_arg=0; - lua_pushboolean(L,(int)(result==true)); SWIG_arg++; + lua_pushboolean(L,(int)result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2911,22 +2460,15 @@ static int _wrap_Event_getHeader(lua_State* L) { char *arg2 = (char *) 0 ; char *result = 0 ; - SWIG_check_num_args("getHeader",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getHeader",1,"Event *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("getHeader",2,"char const *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ - SWIG_fail_ptr("Event_getHeader",1,SWIGTYPE_p_Event); - } - - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"Event_getHeader"); + arg2 = (char*)lua_tostring(L, 2); result = (char *)(arg1)->getHeader((char const *)arg2); SWIG_arg=0; - lua_pushstring(L,(const char*)result); SWIG_arg++; + lua_pushstring(L,result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2938,20 +2480,13 @@ static int _wrap_Event_getBody(lua_State* L) { Event *arg1 = (Event *) 0 ; char *result = 0 ; - SWIG_check_num_args("getBody",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getBody",1,"Event *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ - SWIG_fail_ptr("Event_getBody",1,SWIGTYPE_p_Event); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"Event_getBody"); result = (char *)(arg1)->getBody(); SWIG_arg=0; - lua_pushstring(L,(const char*)result); SWIG_arg++; + lua_pushstring(L,result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2963,20 +2498,13 @@ static int _wrap_Event_getType(lua_State* L) { Event *arg1 = (Event *) 0 ; char *result = 0 ; - SWIG_check_num_args("getType",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getType",1,"Event *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ - SWIG_fail_ptr("Event_getType",1,SWIGTYPE_p_Event); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"Event_getType"); result = (char *)(arg1)->getType(); SWIG_arg=0; - lua_pushstring(L,(const char*)result); SWIG_arg++; + lua_pushstring(L,result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -2989,22 +2517,15 @@ static int _wrap_Event_addBody(lua_State* L) { char *arg2 = (char *) 0 ; bool result; - SWIG_check_num_args("addBody",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("addBody",1,"Event *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("addBody",2,"char const *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ - SWIG_fail_ptr("Event_addBody",1,SWIGTYPE_p_Event); - } - - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"Event_addBody"); + arg2 = (char*)lua_tostring(L, 2); result = (bool)(arg1)->addBody((char const *)arg2); SWIG_arg=0; - lua_pushboolean(L,(int)(result==true)); SWIG_arg++; + lua_pushboolean(L,(int)result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3018,24 +2539,17 @@ static int _wrap_Event_addHeader(lua_State* L) { char *arg3 = (char *) 0 ; bool result; - SWIG_check_num_args("addHeader",3,3) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("addHeader",1,"Event *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("addHeader",2,"char const *"); - if(!lua_isstring(L,3)) SWIG_fail_arg("addHeader",3,"char const *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ - SWIG_fail_ptr("Event_addHeader",1,SWIGTYPE_p_Event); - } - - arg2 = (char *)lua_tostring(L, 2); - arg3 = (char *)lua_tostring(L, 3); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + if(!lua_isstring(L,3)) SWIG_fail_arg(3); + arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"Event_addHeader"); + arg2 = (char*)lua_tostring(L, 2); + arg3 = (char*)lua_tostring(L, 3); result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3); SWIG_arg=0; - lua_pushboolean(L,(int)(result==true)); SWIG_arg++; + lua_pushboolean(L,(int)result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3048,22 +2562,15 @@ static int _wrap_Event_delHeader(lua_State* L) { char *arg2 = (char *) 0 ; bool result; - SWIG_check_num_args("delHeader",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("delHeader",1,"Event *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("delHeader",2,"char const *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ - SWIG_fail_ptr("Event_delHeader",1,SWIGTYPE_p_Event); - } - - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"Event_delHeader"); + arg2 = (char*)lua_tostring(L, 2); result = (bool)(arg1)->delHeader((char const *)arg2); SWIG_arg=0; - lua_pushboolean(L,(int)(result==true)); SWIG_arg++; + lua_pushboolean(L,(int)result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3075,20 +2582,13 @@ static int _wrap_Event_fire(lua_State* L) { Event *arg1 = (Event *) 0 ; bool result; - SWIG_check_num_args("fire",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("fire",1,"Event *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){ - SWIG_fail_ptr("Event_fire",1,SWIGTYPE_p_Event); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(Event *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_Event,0,1,"Event_fire"); result = (bool)(arg1)->fire(); SWIG_arg=0; - lua_pushboolean(L,(int)(result==true)); SWIG_arg++; + lua_pushboolean(L,(int)result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3112,41 +2612,29 @@ static swig_lua_method swig_Event_methods[] = { {0,0} }; static swig_lua_attribute swig_Event_attributes[] = { - { "event", _wrap_Event_event_get, _wrap_Event_event_set}, - { "serialized_string", _wrap_Event_serialized_string_get, _wrap_Event_serialized_string_set}, - { "mine", _wrap_Event_mine_get, _wrap_Event_mine_set}, + { "event",_wrap_Event_event_get, _wrap_Event_event_set}, + { "serialized_string",_wrap_Event_serialized_string_get, _wrap_Event_serialized_string_set}, + { "mine",_wrap_Event_mine_get, _wrap_Event_mine_set}, {0,0,0} }; static swig_lua_class *swig_Event_bases[] = {0}; -static const char *swig_Event_base_names[] = {0}; -static swig_lua_class _wrap_class_Event = { "Event", &SWIGTYPE_p_Event,_wrap_new_Event, swig_delete_Event, swig_Event_methods, swig_Event_attributes, swig_Event_bases, swig_Event_base_names }; +swig_lua_class _wrap_class_Event = { "Event", &SWIGTYPE_p_Event,_wrap_new_Event, swig_delete_Event, swig_Event_methods, swig_Event_attributes, swig_Event_bases }; static int _wrap_EventConsumer_events_set(lua_State* L) { int SWIG_arg = -1; EventConsumer *arg1 = (EventConsumer *) 0 ; switch_queue_t *arg2 = (switch_queue_t *) 0 ; - SWIG_check_num_args("events",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("events",1,"EventConsumer *"); - if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("events",2,"switch_queue_t *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ - SWIG_fail_ptr("EventConsumer_events_set",1,SWIGTYPE_p_EventConsumer); - } - - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_switch_queue_t,SWIG_POINTER_DISOWN))){ - SWIG_fail_ptr("EventConsumer_events_set",2,SWIGTYPE_p_switch_queue_t); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); + arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_events_set"); + arg2=(switch_queue_t *)SWIG_MustGetPtr(L,2,SWIGTYPE_p_switch_queue_t,0,2,"EventConsumer_events_set"); if (arg1) (arg1)->events = arg2; SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3158,20 +2646,13 @@ static int _wrap_EventConsumer_events_get(lua_State* L) { EventConsumer *arg1 = (EventConsumer *) 0 ; switch_queue_t *result = 0 ; - SWIG_check_num_args("events",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("events",1,"EventConsumer *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ - SWIG_fail_ptr("EventConsumer_events_get",1,SWIGTYPE_p_EventConsumer); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_events_get"); result = (switch_queue_t *) ((arg1)->events); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_switch_queue_t,0); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3182,30 +2663,21 @@ static int _wrap_EventConsumer_e_event_id_set(lua_State* L) { int SWIG_arg = -1; EventConsumer *arg1 = (EventConsumer *) 0 ; switch_event_types_t arg2 ; - switch_event_types_t *argp2 ; - - SWIG_check_num_args("e_event_id",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_event_id",1,"EventConsumer *"); - if(!lua_isuserdata(L,2)) SWIG_fail_arg("e_event_id",2,"switch_event_types_t"); - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ - SWIG_fail_ptr("EventConsumer_e_event_id_set",1,SWIGTYPE_p_EventConsumer); - } - - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_switch_event_types_t,0))){ - SWIG_fail_ptr("EventConsumer_e_event_id_set",2,SWIGTYPE_p_switch_event_types_t); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); + arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_e_event_id_set"); + { + switch_event_types_t * argp; + if(SWIG_ConvertPtr(L,2,(void**)(&argp),SWIGTYPE_p_switch_event_types_t,0)) SWIG_fail; + arg2 = *argp; } - arg2 = *argp2; - if (arg1) (arg1)->e_event_id = arg2; SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3217,23 +2689,17 @@ static int _wrap_EventConsumer_e_event_id_get(lua_State* L) { EventConsumer *arg1 = (EventConsumer *) 0 ; switch_event_types_t result; - SWIG_check_num_args("e_event_id",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_event_id",1,"EventConsumer *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ - SWIG_fail_ptr("EventConsumer_e_event_id_get",1,SWIGTYPE_p_EventConsumer); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_e_event_id_get"); result = ((arg1)->e_event_id); SWIG_arg=0; { - switch_event_types_t * resultptr = new switch_event_types_t((switch_event_types_t &) result); + switch_event_types_t * resultptr; + resultptr = new switch_event_types_t((switch_event_types_t &) result); SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_event_types_t,1); SWIG_arg++; } return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3245,20 +2711,15 @@ static int _wrap_EventConsumer_e_callback_set(lua_State* L) { EventConsumer *arg1 = (EventConsumer *) 0 ; char *arg2 = (char *) 0 ; - SWIG_check_num_args("e_callback",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_callback",1,"EventConsumer *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("e_callback",2,"char *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ - SWIG_fail_ptr("EventConsumer_e_callback_set",1,SWIGTYPE_p_EventConsumer); - } - - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_e_callback_set"); + arg2 = (char*)lua_tostring(L, 2); { if (arg1->e_callback) delete [] arg1->e_callback; if (arg2) { - arg1->e_callback = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->e_callback, (const char *)arg2); + arg1->e_callback = (char *) (new char[strlen(arg2)+1]); + strcpy((char *) arg1->e_callback,arg2); } else { arg1->e_callback = 0; } @@ -3267,8 +2728,6 @@ static int _wrap_EventConsumer_e_callback_set(lua_State* L) { return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3280,20 +2739,13 @@ static int _wrap_EventConsumer_e_callback_get(lua_State* L) { EventConsumer *arg1 = (EventConsumer *) 0 ; char *result = 0 ; - SWIG_check_num_args("e_callback",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_callback",1,"EventConsumer *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ - SWIG_fail_ptr("EventConsumer_e_callback_get",1,SWIGTYPE_p_EventConsumer); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_e_callback_get"); result = (char *) ((arg1)->e_callback); SWIG_arg=0; - lua_pushstring(L,(const char*)result); SWIG_arg++; + lua_pushstring(L,result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3305,20 +2757,15 @@ static int _wrap_EventConsumer_e_subclass_name_set(lua_State* L) { EventConsumer *arg1 = (EventConsumer *) 0 ; char *arg2 = (char *) 0 ; - SWIG_check_num_args("e_subclass_name",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_subclass_name",1,"EventConsumer *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("e_subclass_name",2,"char *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ - SWIG_fail_ptr("EventConsumer_e_subclass_name_set",1,SWIGTYPE_p_EventConsumer); - } - - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_e_subclass_name_set"); + arg2 = (char*)lua_tostring(L, 2); { if (arg1->e_subclass_name) delete [] arg1->e_subclass_name; if (arg2) { - arg1->e_subclass_name = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->e_subclass_name, (const char *)arg2); + arg1->e_subclass_name = (char *) (new char[strlen(arg2)+1]); + strcpy((char *) arg1->e_subclass_name,arg2); } else { arg1->e_subclass_name = 0; } @@ -3327,8 +2774,6 @@ static int _wrap_EventConsumer_e_subclass_name_set(lua_State* L) { return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3340,20 +2785,13 @@ static int _wrap_EventConsumer_e_subclass_name_get(lua_State* L) { EventConsumer *arg1 = (EventConsumer *) 0 ; char *result = 0 ; - SWIG_check_num_args("e_subclass_name",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_subclass_name",1,"EventConsumer *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ - SWIG_fail_ptr("EventConsumer_e_subclass_name_get",1,SWIGTYPE_p_EventConsumer); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_e_subclass_name_get"); result = (char *) ((arg1)->e_subclass_name); SWIG_arg=0; - lua_pushstring(L,(const char*)result); SWIG_arg++; + lua_pushstring(L,result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3365,20 +2803,15 @@ static int _wrap_EventConsumer_e_cb_arg_set(lua_State* L) { EventConsumer *arg1 = (EventConsumer *) 0 ; char *arg2 = (char *) 0 ; - SWIG_check_num_args("e_cb_arg",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_cb_arg",1,"EventConsumer *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("e_cb_arg",2,"char *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ - SWIG_fail_ptr("EventConsumer_e_cb_arg_set",1,SWIGTYPE_p_EventConsumer); - } - - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_e_cb_arg_set"); + arg2 = (char*)lua_tostring(L, 2); { if (arg1->e_cb_arg) delete [] arg1->e_cb_arg; if (arg2) { - arg1->e_cb_arg = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->e_cb_arg, (const char *)arg2); + arg1->e_cb_arg = (char *) (new char[strlen(arg2)+1]); + strcpy((char *) arg1->e_cb_arg,arg2); } else { arg1->e_cb_arg = 0; } @@ -3387,8 +2820,6 @@ static int _wrap_EventConsumer_e_cb_arg_set(lua_State* L) { return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3400,20 +2831,13 @@ static int _wrap_EventConsumer_e_cb_arg_get(lua_State* L) { EventConsumer *arg1 = (EventConsumer *) 0 ; char *result = 0 ; - SWIG_check_num_args("e_cb_arg",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("e_cb_arg",1,"EventConsumer *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ - SWIG_fail_ptr("EventConsumer_e_cb_arg_get",1,SWIGTYPE_p_EventConsumer); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_e_cb_arg_get"); result = (char *) ((arg1)->e_cb_arg); SWIG_arg=0; - lua_pushstring(L,(const char*)result); SWIG_arg++; + lua_pushstring(L,result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3425,19 +2849,10 @@ static int _wrap_EventConsumer_enodes_set(lua_State* L) { EventConsumer *arg1 = (EventConsumer *) 0 ; switch_event_node_t **arg2 ; - SWIG_check_num_args("enodes",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("enodes",1,"EventConsumer *"); - if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("enodes",2,"switch_event_node_t *[SWITCH_EVENT_ALL+1]"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ - SWIG_fail_ptr("EventConsumer_enodes_set",1,SWIGTYPE_p_EventConsumer); - } - - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_p_switch_event_node_t,0))){ - SWIG_fail_ptr("EventConsumer_enodes_set",2,SWIGTYPE_p_p_switch_event_node_t); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); + arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_enodes_set"); + arg2=(switch_event_node_t **)SWIG_MustGetPtr(L,2,SWIGTYPE_p_p_switch_event_node_t,0,2,"EventConsumer_enodes_set"); { size_t ii; switch_event_node_t * *b = (switch_event_node_t * *) arg1->enodes; @@ -3447,8 +2862,6 @@ static int _wrap_EventConsumer_enodes_set(lua_State* L) { return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3460,20 +2873,13 @@ static int _wrap_EventConsumer_enodes_get(lua_State* L) { EventConsumer *arg1 = (EventConsumer *) 0 ; switch_event_node_t **result = 0 ; - SWIG_check_num_args("enodes",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("enodes",1,"EventConsumer *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ - SWIG_fail_ptr("EventConsumer_enodes_get",1,SWIGTYPE_p_EventConsumer); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_enodes_get"); result = (switch_event_node_t **)(switch_event_node_t **) ((arg1)->enodes); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_p_switch_event_node_t,0); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3484,30 +2890,21 @@ static int _wrap_EventConsumer_node_index_set(lua_State* L) { int SWIG_arg = -1; EventConsumer *arg1 = (EventConsumer *) 0 ; uint32_t arg2 ; - uint32_t *argp2 ; - - SWIG_check_num_args("node_index",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("node_index",1,"EventConsumer *"); - if(!lua_isuserdata(L,2)) SWIG_fail_arg("node_index",2,"uint32_t"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ - SWIG_fail_ptr("EventConsumer_node_index_set",1,SWIGTYPE_p_EventConsumer); - } - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_uint32_t,0))){ - SWIG_fail_ptr("EventConsumer_node_index_set",2,SWIGTYPE_p_uint32_t); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); + arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_node_index_set"); + { + uint32_t * argp; + if(SWIG_ConvertPtr(L,2,(void**)(&argp),SWIGTYPE_p_uint32_t,0)) SWIG_fail; + arg2 = *argp; } - arg2 = *argp2; - if (arg1) (arg1)->node_index = arg2; SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3519,23 +2916,17 @@ static int _wrap_EventConsumer_node_index_get(lua_State* L) { EventConsumer *arg1 = (EventConsumer *) 0 ; uint32_t result; - SWIG_check_num_args("node_index",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("node_index",1,"EventConsumer *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ - SWIG_fail_ptr("EventConsumer_node_index_get",1,SWIGTYPE_p_EventConsumer); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_node_index_get"); result = ((arg1)->node_index); SWIG_arg=0; { - uint32_t * resultptr = new uint32_t((uint32_t &) result); + uint32_t * resultptr; + resultptr = new uint32_t((uint32_t &) result); SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_uint32_t,1); SWIG_arg++; } return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3548,22 +2939,19 @@ static int _wrap_new_EventConsumer(lua_State* L) { char *arg2 = (char *) "" ; EventConsumer *result = 0 ; - SWIG_check_num_args("EventConsumer",0,2) - if(lua_gettop(L)>=1 && !lua_isstring(L,1)) SWIG_fail_arg("EventConsumer",1,"char const *"); - if(lua_gettop(L)>=2 && !lua_isstring(L,2)) SWIG_fail_arg("EventConsumer",2,"char const *"); + if(lua_gettop(L)>=1 && !lua_isstring(L,1)) SWIG_fail_arg(1); + if(lua_gettop(L)>=2 && !lua_isstring(L,2)) SWIG_fail_arg(2); if(lua_gettop(L)>=1){ - arg1 = (char *)lua_tostring(L, 1); + arg1 = (char*)lua_tostring(L, 1); } if(lua_gettop(L)>=2){ - arg2 = (char *)lua_tostring(L, 2); + arg2 = (char*)lua_tostring(L, 2); } result = (EventConsumer *)new EventConsumer((char const *)arg1,(char const *)arg2); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_EventConsumer,1); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3574,21 +2962,14 @@ static int _wrap_delete_EventConsumer(lua_State* L) { int SWIG_arg = -1; EventConsumer *arg1 = (EventConsumer *) 0 ; - SWIG_check_num_args("EventConsumer",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("EventConsumer",1,"EventConsumer *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,SWIG_POINTER_DISOWN))){ - SWIG_fail_ptr("delete_EventConsumer",1,SWIGTYPE_p_EventConsumer); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"delete_EventConsumer"); delete arg1; SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3602,26 +2983,19 @@ static int _wrap_EventConsumer_bind(lua_State* L) { char *arg3 = (char *) "" ; int result; - SWIG_check_num_args("bind",2,3) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("bind",1,"EventConsumer *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("bind",2,"char const *"); - if(lua_gettop(L)>=3 && !lua_isstring(L,3)) SWIG_fail_arg("bind",3,"char const *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ - SWIG_fail_ptr("EventConsumer_bind",1,SWIGTYPE_p_EventConsumer); - } - - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + if(lua_gettop(L)>=3 && !lua_isstring(L,3)) SWIG_fail_arg(3); + arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_bind"); + arg2 = (char*)lua_tostring(L, 2); if(lua_gettop(L)>=3){ - arg3 = (char *)lua_tostring(L, 3); + arg3 = (char*)lua_tostring(L, 3); } result = (int)(arg1)->bind((char const *)arg2,(char const *)arg3); SWIG_arg=0; lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3634,14 +3008,9 @@ static int _wrap_EventConsumer_pop(lua_State* L) { int arg2 = (int) 0 ; Event *result = 0 ; - SWIG_check_num_args("pop",1,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("pop",1,"EventConsumer *"); - if(lua_gettop(L)>=2 && !lua_isnumber(L,2)) SWIG_fail_arg("pop",2,"int"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_EventConsumer,0))){ - SWIG_fail_ptr("EventConsumer_pop",1,SWIGTYPE_p_EventConsumer); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(lua_gettop(L)>=2 && !lua_isnumber(L,2)) SWIG_fail_arg(2); + arg1=(EventConsumer *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_EventConsumer,0,1,"EventConsumer_pop"); if(lua_gettop(L)>=2){ arg2 = (int)lua_tonumber(L, 2); } @@ -3650,8 +3019,6 @@ static int _wrap_EventConsumer_pop(lua_State* L) { SWIG_NewPointerObj(L,result,SWIGTYPE_p_Event,1); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3668,38 +3035,30 @@ static swig_lua_method swig_EventConsumer_methods[] = { {0,0} }; static swig_lua_attribute swig_EventConsumer_attributes[] = { - { "events", _wrap_EventConsumer_events_get, _wrap_EventConsumer_events_set}, - { "e_event_id", _wrap_EventConsumer_e_event_id_get, _wrap_EventConsumer_e_event_id_set}, - { "e_callback", _wrap_EventConsumer_e_callback_get, _wrap_EventConsumer_e_callback_set}, - { "e_subclass_name", _wrap_EventConsumer_e_subclass_name_get, _wrap_EventConsumer_e_subclass_name_set}, - { "e_cb_arg", _wrap_EventConsumer_e_cb_arg_get, _wrap_EventConsumer_e_cb_arg_set}, - { "enodes", _wrap_EventConsumer_enodes_get, _wrap_EventConsumer_enodes_set}, - { "node_index", _wrap_EventConsumer_node_index_get, _wrap_EventConsumer_node_index_set}, + { "events",_wrap_EventConsumer_events_get, _wrap_EventConsumer_events_set}, + { "e_event_id",_wrap_EventConsumer_e_event_id_get, _wrap_EventConsumer_e_event_id_set}, + { "e_callback",_wrap_EventConsumer_e_callback_get, _wrap_EventConsumer_e_callback_set}, + { "e_subclass_name",_wrap_EventConsumer_e_subclass_name_get, _wrap_EventConsumer_e_subclass_name_set}, + { "e_cb_arg",_wrap_EventConsumer_e_cb_arg_get, _wrap_EventConsumer_e_cb_arg_set}, + { "enodes",_wrap_EventConsumer_enodes_get, _wrap_EventConsumer_enodes_set}, + { "node_index",_wrap_EventConsumer_node_index_get, _wrap_EventConsumer_node_index_set}, {0,0,0} }; static swig_lua_class *swig_EventConsumer_bases[] = {0}; -static const char *swig_EventConsumer_base_names[] = {0}; -static swig_lua_class _wrap_class_EventConsumer = { "EventConsumer", &SWIGTYPE_p_EventConsumer,_wrap_new_EventConsumer, swig_delete_EventConsumer, swig_EventConsumer_methods, swig_EventConsumer_attributes, swig_EventConsumer_bases, swig_EventConsumer_base_names }; +swig_lua_class _wrap_class_EventConsumer = { "EventConsumer", &SWIGTYPE_p_EventConsumer,_wrap_new_EventConsumer, swig_delete_EventConsumer, swig_EventConsumer_methods, swig_EventConsumer_attributes, swig_EventConsumer_bases }; static int _wrap_delete_CoreSession(lua_State* L) { int SWIG_arg = -1; CoreSession *arg1 = (CoreSession *) 0 ; - SWIG_check_num_args("CoreSession",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("CoreSession",1,"CoreSession *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,SWIG_POINTER_DISOWN))){ - SWIG_fail_ptr("delete_CoreSession",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"delete_CoreSession"); delete arg1; SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3711,27 +3070,16 @@ static int _wrap_CoreSession_session_set(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; switch_core_session_t *arg2 = (switch_core_session_t *) 0 ; - SWIG_check_num_args("session",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("session",1,"CoreSession *"); - if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("session",2,"switch_core_session_t *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_session_set",1,SWIGTYPE_p_CoreSession); - } - - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_switch_core_session_t,SWIG_POINTER_DISOWN))){ - SWIG_fail_ptr("CoreSession_session_set",2,SWIGTYPE_p_switch_core_session_t); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_session_set"); + arg2=(switch_core_session_t *)SWIG_MustGetPtr(L,2,SWIGTYPE_p_switch_core_session_t,0,2,"CoreSession_session_set"); if (arg1) (arg1)->session = arg2; SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3743,20 +3091,13 @@ static int _wrap_CoreSession_session_get(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; switch_core_session_t *result = 0 ; - SWIG_check_num_args("session",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("session",1,"CoreSession *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_session_get",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_session_get"); result = (switch_core_session_t *) ((arg1)->session); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_switch_core_session_t,0); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3768,27 +3109,16 @@ static int _wrap_CoreSession_channel_set(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; switch_channel_t *arg2 = (switch_channel_t *) 0 ; - SWIG_check_num_args("channel",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("channel",1,"CoreSession *"); - if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("channel",2,"switch_channel_t *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_channel_set",1,SWIGTYPE_p_CoreSession); - } - - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_switch_channel_t,SWIG_POINTER_DISOWN))){ - SWIG_fail_ptr("CoreSession_channel_set",2,SWIGTYPE_p_switch_channel_t); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_channel_set"); + arg2=(switch_channel_t *)SWIG_MustGetPtr(L,2,SWIGTYPE_p_switch_channel_t,0,2,"CoreSession_channel_set"); if (arg1) (arg1)->channel = arg2; SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3800,20 +3130,13 @@ static int _wrap_CoreSession_channel_get(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; switch_channel_t *result = 0 ; - SWIG_check_num_args("channel",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("channel",1,"CoreSession *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_channel_get",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_channel_get"); result = (switch_channel_t *) ((arg1)->channel); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_switch_channel_t,0); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3825,14 +3148,9 @@ static int _wrap_CoreSession_flags_set(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; unsigned int arg2 ; - SWIG_check_num_args("flags",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("flags",1,"CoreSession *"); - if(!lua_isnumber(L,2)) SWIG_fail_arg("flags",2,"unsigned int"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_flags_set",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isnumber(L,2)) SWIG_fail_arg(2); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_flags_set"); arg2 = (unsigned int)lua_tonumber(L, 2); if (arg1) (arg1)->flags = arg2; @@ -3840,8 +3158,6 @@ static int _wrap_CoreSession_flags_set(lua_State* L) { return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3853,20 +3169,13 @@ static int _wrap_CoreSession_flags_get(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; unsigned int result; - SWIG_check_num_args("flags",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("flags",1,"CoreSession *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_flags_get",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_flags_get"); result = (unsigned int) ((arg1)->flags); SWIG_arg=0; lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3878,14 +3187,9 @@ static int _wrap_CoreSession_allocated_set(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; int arg2 ; - SWIG_check_num_args("allocated",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("allocated",1,"CoreSession *"); - if(!lua_isnumber(L,2)) SWIG_fail_arg("allocated",2,"int"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_allocated_set",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isnumber(L,2)) SWIG_fail_arg(2); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_allocated_set"); arg2 = (int)lua_tonumber(L, 2); if (arg1) (arg1)->allocated = arg2; @@ -3893,8 +3197,6 @@ static int _wrap_CoreSession_allocated_set(lua_State* L) { return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3906,20 +3208,13 @@ static int _wrap_CoreSession_allocated_get(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; int result; - SWIG_check_num_args("allocated",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("allocated",1,"CoreSession *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_allocated_get",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_allocated_get"); result = (int) ((arg1)->allocated); SWIG_arg=0; lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3931,27 +3226,16 @@ static int _wrap_CoreSession_cb_state_set(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; input_callback_state *arg2 = (input_callback_state *) 0 ; - SWIG_check_num_args("cb_state",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cb_state",1,"CoreSession *"); - if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("cb_state",2,"input_callback_state *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_cb_state_set",1,SWIGTYPE_p_CoreSession); - } - - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_input_callback_state,0))){ - SWIG_fail_ptr("CoreSession_cb_state_set",2,SWIGTYPE_p_input_callback_state); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_cb_state_set"); + arg2=(input_callback_state *)SWIG_MustGetPtr(L,2,SWIGTYPE_p_input_callback_state,0,2,"CoreSession_cb_state_set"); if (arg1) (arg1)->cb_state = *arg2; SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3963,20 +3247,13 @@ static int _wrap_CoreSession_cb_state_get(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; input_callback_state *result = 0 ; - SWIG_check_num_args("cb_state",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cb_state",1,"CoreSession *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_cb_state_get",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_cb_state_get"); result = (input_callback_state *)& ((arg1)->cb_state); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_input_callback_state,0); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -3987,30 +3264,21 @@ static int _wrap_CoreSession_hook_state_set(lua_State* L) { int SWIG_arg = -1; CoreSession *arg1 = (CoreSession *) 0 ; switch_channel_state_t arg2 ; - switch_channel_state_t *argp2 ; - - SWIG_check_num_args("hook_state",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hook_state",1,"CoreSession *"); - if(!lua_isuserdata(L,2)) SWIG_fail_arg("hook_state",2,"switch_channel_state_t"); - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_hook_state_set",1,SWIGTYPE_p_CoreSession); - } - - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_switch_channel_state_t,0))){ - SWIG_fail_ptr("CoreSession_hook_state_set",2,SWIGTYPE_p_switch_channel_state_t); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_hook_state_set"); + { + switch_channel_state_t * argp; + if(SWIG_ConvertPtr(L,2,(void**)(&argp),SWIGTYPE_p_switch_channel_state_t,0)) SWIG_fail; + arg2 = *argp; } - arg2 = *argp2; - if (arg1) (arg1)->hook_state = arg2; SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4022,23 +3290,17 @@ static int _wrap_CoreSession_hook_state_get(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; switch_channel_state_t result; - SWIG_check_num_args("hook_state",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hook_state",1,"CoreSession *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_hook_state_get",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_hook_state_get"); result = ((arg1)->hook_state); SWIG_arg=0; { - switch_channel_state_t * resultptr = new switch_channel_state_t((switch_channel_state_t &) result); + switch_channel_state_t * resultptr; + resultptr = new switch_channel_state_t((switch_channel_state_t &) result); SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_channel_state_t,1); SWIG_arg++; } return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4049,30 +3311,21 @@ static int _wrap_CoreSession_cause_set(lua_State* L) { int SWIG_arg = -1; CoreSession *arg1 = (CoreSession *) 0 ; switch_call_cause_t arg2 ; - switch_call_cause_t *argp2 ; - - SWIG_check_num_args("cause",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cause",1,"CoreSession *"); - if(!lua_isuserdata(L,2)) SWIG_fail_arg("cause",2,"switch_call_cause_t"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_cause_set",1,SWIGTYPE_p_CoreSession); - } - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&argp2,SWIGTYPE_p_switch_call_cause_t,0))){ - SWIG_fail_ptr("CoreSession_cause_set",2,SWIGTYPE_p_switch_call_cause_t); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_cause_set"); + { + switch_call_cause_t * argp; + if(SWIG_ConvertPtr(L,2,(void**)(&argp),SWIGTYPE_p_switch_call_cause_t,0)) SWIG_fail; + arg2 = *argp; } - arg2 = *argp2; - if (arg1) (arg1)->cause = arg2; SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4084,23 +3337,17 @@ static int _wrap_CoreSession_cause_get(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; switch_call_cause_t result; - SWIG_check_num_args("cause",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cause",1,"CoreSession *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_cause_get",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_cause_get"); result = ((arg1)->cause); SWIG_arg=0; { - switch_call_cause_t * resultptr = new switch_call_cause_t((switch_call_cause_t &) result); + switch_call_cause_t * resultptr; + resultptr = new switch_call_cause_t((switch_call_cause_t &) result); SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_call_cause_t,1); SWIG_arg++; } return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4112,20 +3359,15 @@ static int _wrap_CoreSession_uuid_set(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; char *arg2 = (char *) 0 ; - SWIG_check_num_args("uuid",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("uuid",1,"CoreSession *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("uuid",2,"char *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_uuid_set",1,SWIGTYPE_p_CoreSession); - } - - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_uuid_set"); + arg2 = (char*)lua_tostring(L, 2); { if (arg1->uuid) delete [] arg1->uuid; if (arg2) { - arg1->uuid = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->uuid, (const char *)arg2); + arg1->uuid = (char *) (new char[strlen(arg2)+1]); + strcpy((char *) arg1->uuid,arg2); } else { arg1->uuid = 0; } @@ -4134,8 +3376,6 @@ static int _wrap_CoreSession_uuid_set(lua_State* L) { return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4147,20 +3387,13 @@ static int _wrap_CoreSession_uuid_get(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; char *result = 0 ; - SWIG_check_num_args("uuid",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("uuid",1,"CoreSession *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_uuid_get",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_uuid_get"); result = (char *) ((arg1)->uuid); SWIG_arg=0; - lua_pushstring(L,(const char*)result); SWIG_arg++; + lua_pushstring(L,result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4172,20 +3405,15 @@ static int _wrap_CoreSession_tts_name_set(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; char *arg2 = (char *) 0 ; - SWIG_check_num_args("tts_name",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("tts_name",1,"CoreSession *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("tts_name",2,"char *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_tts_name_set",1,SWIGTYPE_p_CoreSession); - } - - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_tts_name_set"); + arg2 = (char*)lua_tostring(L, 2); { if (arg1->tts_name) delete [] arg1->tts_name; if (arg2) { - arg1->tts_name = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->tts_name, (const char *)arg2); + arg1->tts_name = (char *) (new char[strlen(arg2)+1]); + strcpy((char *) arg1->tts_name,arg2); } else { arg1->tts_name = 0; } @@ -4194,8 +3422,6 @@ static int _wrap_CoreSession_tts_name_set(lua_State* L) { return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4207,20 +3433,13 @@ static int _wrap_CoreSession_tts_name_get(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; char *result = 0 ; - SWIG_check_num_args("tts_name",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("tts_name",1,"CoreSession *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_tts_name_get",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_tts_name_get"); result = (char *) ((arg1)->tts_name); SWIG_arg=0; - lua_pushstring(L,(const char*)result); SWIG_arg++; + lua_pushstring(L,result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4232,20 +3451,15 @@ static int _wrap_CoreSession_voice_name_set(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; char *arg2 = (char *) 0 ; - SWIG_check_num_args("voice_name",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("voice_name",1,"CoreSession *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("voice_name",2,"char *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_voice_name_set",1,SWIGTYPE_p_CoreSession); - } - - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_voice_name_set"); + arg2 = (char*)lua_tostring(L, 2); { if (arg1->voice_name) delete [] arg1->voice_name; if (arg2) { - arg1->voice_name = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->voice_name, (const char *)arg2); + arg1->voice_name = (char *) (new char[strlen(arg2)+1]); + strcpy((char *) arg1->voice_name,arg2); } else { arg1->voice_name = 0; } @@ -4254,8 +3468,6 @@ static int _wrap_CoreSession_voice_name_set(lua_State* L) { return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4267,20 +3479,13 @@ static int _wrap_CoreSession_voice_name_get(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; char *result = 0 ; - SWIG_check_num_args("voice_name",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("voice_name",1,"CoreSession *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_voice_name_get",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_voice_name_get"); result = (char *) ((arg1)->voice_name); SWIG_arg=0; - lua_pushstring(L,(const char*)result); SWIG_arg++; + lua_pushstring(L,result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4292,20 +3497,13 @@ static int _wrap_CoreSession_answer(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; int result; - SWIG_check_num_args("answer",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("answer",1,"CoreSession *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_answer",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_answer"); result = (int)(arg1)->answer(); SWIG_arg=0; lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4317,20 +3515,13 @@ static int _wrap_CoreSession_preAnswer(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; int result; - SWIG_check_num_args("preAnswer",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("preAnswer",1,"CoreSession *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_preAnswer",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_preAnswer"); result = (int)(arg1)->preAnswer(); SWIG_arg=0; lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4342,24 +3533,17 @@ static int _wrap_CoreSession_hangup(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; char *arg2 = (char *) "normal_clearing" ; - SWIG_check_num_args("hangup",1,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangup",1,"CoreSession *"); - if(lua_gettop(L)>=2 && !lua_isstring(L,2)) SWIG_fail_arg("hangup",2,"char const *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_hangup",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(lua_gettop(L)>=2 && !lua_isstring(L,2)) SWIG_fail_arg(2); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_hangup"); if(lua_gettop(L)>=2){ - arg2 = (char *)lua_tostring(L, 2); + arg2 = (char*)lua_tostring(L, 2); } (arg1)->hangup((char const *)arg2); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4370,20 +3554,13 @@ static int _wrap_CoreSession_hangupState(lua_State* L) { int SWIG_arg = -1; CoreSession *arg1 = (CoreSession *) 0 ; - SWIG_check_num_args("hangupState",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangupState",1,"CoreSession *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_hangupState",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_hangupState"); (arg1)->hangupState(); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4396,24 +3573,17 @@ static int _wrap_CoreSession_setVariable(lua_State* L) { char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; - SWIG_check_num_args("setVariable",3,3) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setVariable",1,"CoreSession *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("setVariable",2,"char *"); - if(!lua_isstring(L,3)) SWIG_fail_arg("setVariable",3,"char *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_setVariable",1,SWIGTYPE_p_CoreSession); - } - - arg2 = (char *)lua_tostring(L, 2); - arg3 = (char *)lua_tostring(L, 3); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + if(!lua_isstring(L,3)) SWIG_fail_arg(3); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_setVariable"); + arg2 = (char*)lua_tostring(L, 2); + arg3 = (char*)lua_tostring(L, 3); (arg1)->setVariable(arg2,arg3); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4426,24 +3596,17 @@ static int _wrap_CoreSession_setPrivate(lua_State* L) { char *arg2 = (char *) 0 ; void *arg3 = (void *) 0 ; - SWIG_check_num_args("setPrivate",3,3) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setPrivate",1,"CoreSession *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("setPrivate",2,"char *"); - if(!SWIG_isptrtype(L,3)) SWIG_fail_arg("setPrivate",3,"void *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_setPrivate",1,SWIGTYPE_p_CoreSession); - } - - arg2 = (char *)lua_tostring(L, 2); - arg3=(void *)SWIG_MustGetPtr(L,3,0,0,3,"CoreSession_setPrivate"); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + if(!lua_isuserdata(L,3)) SWIG_fail_arg(3); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_setPrivate"); + arg2 = (char*)lua_tostring(L, 2); + arg3=((swig_lua_userdata*)(lua_touserdata(L,3)))->ptr; (arg1)->setPrivate(arg2,arg3); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4456,22 +3619,15 @@ static int _wrap_CoreSession_getPrivate(lua_State* L) { char *arg2 = (char *) 0 ; void *result = 0 ; - SWIG_check_num_args("getPrivate",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getPrivate",1,"CoreSession *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("getPrivate",2,"char *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_getPrivate",1,SWIGTYPE_p_CoreSession); - } - - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_getPrivate"); + arg2 = (char*)lua_tostring(L, 2); result = (void *)(arg1)->getPrivate(arg2); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_void,0); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4484,22 +3640,15 @@ static int _wrap_CoreSession_getVariable(lua_State* L) { char *arg2 = (char *) 0 ; char *result = 0 ; - SWIG_check_num_args("getVariable",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getVariable",1,"CoreSession *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("getVariable",2,"char *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_getVariable",1,SWIGTYPE_p_CoreSession); - } - - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_getVariable"); + arg2 = (char*)lua_tostring(L, 2); result = (char *)(arg1)->getVariable(arg2); SWIG_arg=0; - lua_pushstring(L,(const char*)result); SWIG_arg++; + lua_pushstring(L,result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4512,25 +3661,19 @@ static int _wrap_CoreSession_process_callback_result(lua_State* L) { char *arg2 = (char *) 0 ; switch_status_t result; - SWIG_check_num_args("process_callback_result",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("process_callback_result",1,"CoreSession *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("process_callback_result",2,"char *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_process_callback_result",1,SWIGTYPE_p_CoreSession); - } - - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_process_callback_result"); + arg2 = (char*)lua_tostring(L, 2); result = (arg1)->process_callback_result(arg2); SWIG_arg=0; { - switch_status_t * resultptr = new switch_status_t((switch_status_t &) result); + switch_status_t * resultptr; + resultptr = new switch_status_t((switch_status_t &) result); SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_status_t,1); SWIG_arg++; } return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4546,32 +3689,25 @@ static int _wrap_CoreSession_say(lua_State* L) { char *arg5 = (char *) 0 ; char *arg6 = (char *) NULL ; - SWIG_check_num_args("say",5,6) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("say",1,"CoreSession *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("say",2,"char const *"); - if(!lua_isstring(L,3)) SWIG_fail_arg("say",3,"char const *"); - if(!lua_isstring(L,4)) SWIG_fail_arg("say",4,"char const *"); - if(!lua_isstring(L,5)) SWIG_fail_arg("say",5,"char const *"); - if(lua_gettop(L)>=6 && !lua_isstring(L,6)) SWIG_fail_arg("say",6,"char const *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_say",1,SWIGTYPE_p_CoreSession); - } - - arg2 = (char *)lua_tostring(L, 2); - arg3 = (char *)lua_tostring(L, 3); - arg4 = (char *)lua_tostring(L, 4); - arg5 = (char *)lua_tostring(L, 5); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + if(!lua_isstring(L,3)) SWIG_fail_arg(3); + if(!lua_isstring(L,4)) SWIG_fail_arg(4); + if(!lua_isstring(L,5)) SWIG_fail_arg(5); + if(lua_gettop(L)>=6 && !lua_isstring(L,6)) SWIG_fail_arg(6); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_say"); + arg2 = (char*)lua_tostring(L, 2); + arg3 = (char*)lua_tostring(L, 3); + arg4 = (char*)lua_tostring(L, 4); + arg5 = (char*)lua_tostring(L, 5); if(lua_gettop(L)>=6){ - arg6 = (char *)lua_tostring(L, 6); + arg6 = (char*)lua_tostring(L, 6); } (arg1)->say((char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4585,30 +3721,23 @@ static int _wrap_CoreSession_sayPhrase(lua_State* L) { char *arg3 = (char *) "" ; char *arg4 = (char *) NULL ; - SWIG_check_num_args("sayPhrase",2,4) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("sayPhrase",1,"CoreSession *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("sayPhrase",2,"char const *"); - if(lua_gettop(L)>=3 && !lua_isstring(L,3)) SWIG_fail_arg("sayPhrase",3,"char const *"); - if(lua_gettop(L)>=4 && !lua_isstring(L,4)) SWIG_fail_arg("sayPhrase",4,"char const *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_sayPhrase",1,SWIGTYPE_p_CoreSession); - } - - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + if(lua_gettop(L)>=3 && !lua_isstring(L,3)) SWIG_fail_arg(3); + if(lua_gettop(L)>=4 && !lua_isstring(L,4)) SWIG_fail_arg(4); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_sayPhrase"); + arg2 = (char*)lua_tostring(L, 2); if(lua_gettop(L)>=3){ - arg3 = (char *)lua_tostring(L, 3); + arg3 = (char*)lua_tostring(L, 3); } if(lua_gettop(L)>=4){ - arg4 = (char *)lua_tostring(L, 4); + arg4 = (char*)lua_tostring(L, 4); } (arg1)->sayPhrase((char const *)arg2,(char const *)arg3,(char const *)arg4); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4620,20 +3749,13 @@ static int _wrap_CoreSession_hangupCause(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; char *result = 0 ; - SWIG_check_num_args("hangupCause",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangupCause",1,"CoreSession *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_hangupCause",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_hangupCause"); result = (char *)(arg1)->hangupCause(); SWIG_arg=0; - lua_pushstring(L,(const char*)result); SWIG_arg++; + lua_pushstring(L,result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4645,20 +3767,13 @@ static int _wrap_CoreSession_getState(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; char *result = 0 ; - SWIG_check_num_args("getState",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getState",1,"CoreSession *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_getState",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_getState"); result = (char *)(arg1)->getState(); SWIG_arg=0; - lua_pushstring(L,(const char*)result); SWIG_arg++; + lua_pushstring(L,result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4674,18 +3789,13 @@ static int _wrap_CoreSession_recordFile(lua_State* L) { int arg5 = (int) 0 ; int result; - SWIG_check_num_args("recordFile",2,5) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("recordFile",1,"CoreSession *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("recordFile",2,"char *"); - if(lua_gettop(L)>=3 && !lua_isnumber(L,3)) SWIG_fail_arg("recordFile",3,"int"); - if(lua_gettop(L)>=4 && !lua_isnumber(L,4)) SWIG_fail_arg("recordFile",4,"int"); - if(lua_gettop(L)>=5 && !lua_isnumber(L,5)) SWIG_fail_arg("recordFile",5,"int"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_recordFile",1,SWIGTYPE_p_CoreSession); - } - - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + if(lua_gettop(L)>=3 && !lua_isnumber(L,3)) SWIG_fail_arg(3); + if(lua_gettop(L)>=4 && !lua_isnumber(L,4)) SWIG_fail_arg(4); + if(lua_gettop(L)>=5 && !lua_isnumber(L,5)) SWIG_fail_arg(5); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_recordFile"); + arg2 = (char*)lua_tostring(L, 2); if(lua_gettop(L)>=3){ arg3 = (int)lua_tonumber(L, 3); } @@ -4700,8 +3810,6 @@ static int _wrap_CoreSession_recordFile(lua_State* L) { lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4717,38 +3825,25 @@ static int _wrap_CoreSession_originate(lua_State* L) { switch_state_handler_table_t *arg5 = (switch_state_handler_table_t *) NULL ; int result; - SWIG_check_num_args("originate",3,5) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("originate",1,"CoreSession *"); - if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("originate",2,"CoreSession *"); - if(!lua_isstring(L,3)) SWIG_fail_arg("originate",3,"char *"); - if(lua_gettop(L)>=4 && !lua_isnumber(L,4)) SWIG_fail_arg("originate",4,"int"); - if(lua_gettop(L)>=5 && !SWIG_isptrtype(L,5)) SWIG_fail_arg("originate",5,"switch_state_handler_table_t *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_originate",1,SWIGTYPE_p_CoreSession); - } - - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_originate",2,SWIGTYPE_p_CoreSession); - } - - arg3 = (char *)lua_tostring(L, 3); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); + if(!lua_isstring(L,3)) SWIG_fail_arg(3); + if(lua_gettop(L)>=4 && !lua_isnumber(L,4)) SWIG_fail_arg(4); + if(lua_gettop(L)>=5 && !lua_isuserdata(L,5)) SWIG_fail_arg(5); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_originate"); + arg2=(CoreSession *)SWIG_MustGetPtr(L,2,SWIGTYPE_p_CoreSession,0,2,"CoreSession_originate"); + arg3 = (char*)lua_tostring(L, 3); if(lua_gettop(L)>=4){ arg4 = (int)lua_tonumber(L, 4); } if(lua_gettop(L)>=5){ - if (!SWIG_IsOK(SWIG_ConvertPtr(L,5,(void**)&arg5,SWIGTYPE_p_switch_state_handler_table_t,0))){ - SWIG_fail_ptr("CoreSession_originate",5,SWIGTYPE_p_switch_state_handler_table_t); - } + arg5=(switch_state_handler_table_t *)SWIG_MustGetPtr(L,5,SWIGTYPE_p_switch_state_handler_table_t,0,5,"CoreSession_originate"); } result = (int)(arg1)->originate(arg2,arg3,arg4,arg5); SWIG_arg=0; lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4759,20 +3854,13 @@ static int _wrap_CoreSession_destroy(lua_State* L) { int SWIG_arg = -1; CoreSession *arg1 = (CoreSession *) 0 ; - SWIG_check_num_args("destroy",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("destroy",1,"CoreSession *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_destroy",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_destroy"); (arg1)->destroy(); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4785,24 +3873,17 @@ static int _wrap_CoreSession_setDTMFCallback(lua_State* L) { void *arg2 = (void *) 0 ; char *arg3 = (char *) 0 ; - SWIG_check_num_args("setDTMFCallback",3,3) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setDTMFCallback",1,"CoreSession *"); - if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("setDTMFCallback",2,"void *"); - if(!lua_isstring(L,3)) SWIG_fail_arg("setDTMFCallback",3,"char *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_setDTMFCallback",1,SWIGTYPE_p_CoreSession); - } - - arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"CoreSession_setDTMFCallback"); - arg3 = (char *)lua_tostring(L, 3); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); + if(!lua_isstring(L,3)) SWIG_fail_arg(3); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_setDTMFCallback"); + arg2=((swig_lua_userdata*)(lua_touserdata(L,2)))->ptr; + arg3 = (char*)lua_tostring(L, 3); (arg1)->setDTMFCallback(arg2,arg3); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4815,22 +3896,15 @@ static int _wrap_CoreSession_speak(lua_State* L) { char *arg2 = (char *) 0 ; int result; - SWIG_check_num_args("speak",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("speak",1,"CoreSession *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("speak",2,"char *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_speak",1,SWIGTYPE_p_CoreSession); - } - - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_speak"); + arg2 = (char*)lua_tostring(L, 2); result = (int)(arg1)->speak(arg2); SWIG_arg=0; lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4843,24 +3917,17 @@ static int _wrap_CoreSession_set_tts_parms(lua_State* L) { char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; - SWIG_check_num_args("set_tts_parms",3,3) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("set_tts_parms",1,"CoreSession *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("set_tts_parms",2,"char *"); - if(!lua_isstring(L,3)) SWIG_fail_arg("set_tts_parms",3,"char *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_set_tts_parms",1,SWIGTYPE_p_CoreSession); - } - - arg2 = (char *)lua_tostring(L, 2); - arg3 = (char *)lua_tostring(L, 3); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + if(!lua_isstring(L,3)) SWIG_fail_arg(3); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_set_tts_parms"); + arg2 = (char*)lua_tostring(L, 2); + arg3 = (char*)lua_tostring(L, 3); (arg1)->set_tts_parms(arg2,arg3); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4873,22 +3940,15 @@ static int _wrap_CoreSession_collectDigits__SWIG_0(lua_State* L) { int arg2 ; int result; - SWIG_check_num_args("collectDigits",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("collectDigits",1,"CoreSession *"); - if(!lua_isnumber(L,2)) SWIG_fail_arg("collectDigits",2,"int"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_collectDigits",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isnumber(L,2)) SWIG_fail_arg(2); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_collectDigits"); arg2 = (int)lua_tonumber(L, 2); result = (int)(arg1)->collectDigits(arg2); SWIG_arg=0; lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4902,15 +3962,10 @@ static int _wrap_CoreSession_collectDigits__SWIG_1(lua_State* L) { int arg3 ; int result; - SWIG_check_num_args("collectDigits",3,3) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("collectDigits",1,"CoreSession *"); - if(!lua_isnumber(L,2)) SWIG_fail_arg("collectDigits",2,"int"); - if(!lua_isnumber(L,3)) SWIG_fail_arg("collectDigits",3,"int"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_collectDigits",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isnumber(L,2)) SWIG_fail_arg(2); + if(!lua_isnumber(L,3)) SWIG_fail_arg(3); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_collectDigits"); arg2 = (int)lua_tonumber(L, 2); arg3 = (int)lua_tonumber(L, 3); result = (int)(arg1)->collectDigits(arg2,arg3); @@ -4918,8 +3973,6 @@ static int _wrap_CoreSession_collectDigits__SWIG_1(lua_State* L) { lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -4937,7 +3990,7 @@ static int _wrap_CoreSession_collectDigits(lua_State* L) { int _v; { void *ptr; - if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) { + if (lua_isuserdata(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) { _v = 0; } else { _v = 1; @@ -4956,7 +4009,7 @@ static int _wrap_CoreSession_collectDigits(lua_State* L) { int _v; { void *ptr; - if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) { + if (lua_isuserdata(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) { _v = 0; } else { _v = 1; @@ -4990,26 +4043,19 @@ static int _wrap_CoreSession_getDigits__SWIG_0(lua_State* L) { int arg4 ; char *result = 0 ; - SWIG_check_num_args("getDigits",4,4) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getDigits",1,"CoreSession *"); - if(!lua_isnumber(L,2)) SWIG_fail_arg("getDigits",2,"int"); - if(!lua_isstring(L,3)) SWIG_fail_arg("getDigits",3,"char *"); - if(!lua_isnumber(L,4)) SWIG_fail_arg("getDigits",4,"int"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_getDigits",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isnumber(L,2)) SWIG_fail_arg(2); + if(!lua_isstring(L,3)) SWIG_fail_arg(3); + if(!lua_isnumber(L,4)) SWIG_fail_arg(4); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_getDigits"); arg2 = (int)lua_tonumber(L, 2); - arg3 = (char *)lua_tostring(L, 3); + arg3 = (char*)lua_tostring(L, 3); arg4 = (int)lua_tonumber(L, 4); result = (char *)(arg1)->getDigits(arg2,arg3,arg4); SWIG_arg=0; - lua_pushstring(L,(const char*)result); SWIG_arg++; + lua_pushstring(L,result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -5025,28 +4071,21 @@ static int _wrap_CoreSession_getDigits__SWIG_1(lua_State* L) { int arg5 ; char *result = 0 ; - SWIG_check_num_args("getDigits",5,5) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getDigits",1,"CoreSession *"); - if(!lua_isnumber(L,2)) SWIG_fail_arg("getDigits",2,"int"); - if(!lua_isstring(L,3)) SWIG_fail_arg("getDigits",3,"char *"); - if(!lua_isnumber(L,4)) SWIG_fail_arg("getDigits",4,"int"); - if(!lua_isnumber(L,5)) SWIG_fail_arg("getDigits",5,"int"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_getDigits",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isnumber(L,2)) SWIG_fail_arg(2); + if(!lua_isstring(L,3)) SWIG_fail_arg(3); + if(!lua_isnumber(L,4)) SWIG_fail_arg(4); + if(!lua_isnumber(L,5)) SWIG_fail_arg(5); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_getDigits"); arg2 = (int)lua_tonumber(L, 2); - arg3 = (char *)lua_tostring(L, 3); + arg3 = (char*)lua_tostring(L, 3); arg4 = (int)lua_tonumber(L, 4); arg5 = (int)lua_tonumber(L, 5); result = (char *)(arg1)->getDigits(arg2,arg3,arg4,arg5); SWIG_arg=0; - lua_pushstring(L,(const char*)result); SWIG_arg++; + lua_pushstring(L,result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -5064,7 +4103,7 @@ static int _wrap_CoreSession_getDigits(lua_State* L) { int _v; { void *ptr; - if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) { + if (lua_isuserdata(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) { _v = 0; } else { _v = 1; @@ -5093,7 +4132,7 @@ static int _wrap_CoreSession_getDigits(lua_State* L) { int _v; { void *ptr; - if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) { + if (lua_isuserdata(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) { _v = 0; } else { _v = 1; @@ -5137,30 +4176,23 @@ static int _wrap_CoreSession_transfer(lua_State* L) { char *arg4 = (char *) NULL ; int result; - SWIG_check_num_args("transfer",2,4) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("transfer",1,"CoreSession *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("transfer",2,"char *"); - if(lua_gettop(L)>=3 && !lua_isstring(L,3)) SWIG_fail_arg("transfer",3,"char *"); - if(lua_gettop(L)>=4 && !lua_isstring(L,4)) SWIG_fail_arg("transfer",4,"char *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_transfer",1,SWIGTYPE_p_CoreSession); - } - - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + if(lua_gettop(L)>=3 && !lua_isstring(L,3)) SWIG_fail_arg(3); + if(lua_gettop(L)>=4 && !lua_isstring(L,4)) SWIG_fail_arg(4); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_transfer"); + arg2 = (char*)lua_tostring(L, 2); if(lua_gettop(L)>=3){ - arg3 = (char *)lua_tostring(L, 3); + arg3 = (char*)lua_tostring(L, 3); } if(lua_gettop(L)>=4){ - arg4 = (char *)lua_tostring(L, 4); + arg4 = (char*)lua_tostring(L, 4); } result = (int)(arg1)->transfer(arg2,arg3,arg4); SWIG_arg=0; lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -5177,30 +4209,23 @@ static int _wrap_CoreSession_read(lua_State* L) { char *arg6 = (char *) 0 ; char *result = 0 ; - SWIG_check_num_args("read",6,6) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("read",1,"CoreSession *"); - if(!lua_isnumber(L,2)) SWIG_fail_arg("read",2,"int"); - if(!lua_isnumber(L,3)) SWIG_fail_arg("read",3,"int"); - if(!lua_isstring(L,4)) SWIG_fail_arg("read",4,"char const *"); - if(!lua_isnumber(L,5)) SWIG_fail_arg("read",5,"int"); - if(!lua_isstring(L,6)) SWIG_fail_arg("read",6,"char const *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_read",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isnumber(L,2)) SWIG_fail_arg(2); + if(!lua_isnumber(L,3)) SWIG_fail_arg(3); + if(!lua_isstring(L,4)) SWIG_fail_arg(4); + if(!lua_isnumber(L,5)) SWIG_fail_arg(5); + if(!lua_isstring(L,6)) SWIG_fail_arg(6); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_read"); arg2 = (int)lua_tonumber(L, 2); arg3 = (int)lua_tonumber(L, 3); - arg4 = (char *)lua_tostring(L, 4); + arg4 = (char*)lua_tostring(L, 4); arg5 = (int)lua_tonumber(L, 5); - arg6 = (char *)lua_tostring(L, 6); + arg6 = (char*)lua_tostring(L, 6); result = (char *)(arg1)->read(arg2,arg3,(char const *)arg4,arg5,(char const *)arg6); SWIG_arg=0; - lua_pushstring(L,(const char*)result); SWIG_arg++; + lua_pushstring(L,result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -5221,40 +4246,33 @@ static int _wrap_CoreSession_playAndGetDigits(lua_State* L) { char *arg10 = (char *) NULL ; char *result = 0 ; - SWIG_check_num_args("playAndGetDigits",9,10) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("playAndGetDigits",1,"CoreSession *"); - if(!lua_isnumber(L,2)) SWIG_fail_arg("playAndGetDigits",2,"int"); - if(!lua_isnumber(L,3)) SWIG_fail_arg("playAndGetDigits",3,"int"); - if(!lua_isnumber(L,4)) SWIG_fail_arg("playAndGetDigits",4,"int"); - if(!lua_isnumber(L,5)) SWIG_fail_arg("playAndGetDigits",5,"int"); - if(!lua_isstring(L,6)) SWIG_fail_arg("playAndGetDigits",6,"char *"); - if(!lua_isstring(L,7)) SWIG_fail_arg("playAndGetDigits",7,"char *"); - if(!lua_isstring(L,8)) SWIG_fail_arg("playAndGetDigits",8,"char *"); - if(!lua_isstring(L,9)) SWIG_fail_arg("playAndGetDigits",9,"char *"); - if(lua_gettop(L)>=10 && !lua_isstring(L,10)) SWIG_fail_arg("playAndGetDigits",10,"char const *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_playAndGetDigits",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isnumber(L,2)) SWIG_fail_arg(2); + if(!lua_isnumber(L,3)) SWIG_fail_arg(3); + if(!lua_isnumber(L,4)) SWIG_fail_arg(4); + if(!lua_isnumber(L,5)) SWIG_fail_arg(5); + if(!lua_isstring(L,6)) SWIG_fail_arg(6); + if(!lua_isstring(L,7)) SWIG_fail_arg(7); + if(!lua_isstring(L,8)) SWIG_fail_arg(8); + if(!lua_isstring(L,9)) SWIG_fail_arg(9); + if(lua_gettop(L)>=10 && !lua_isstring(L,10)) SWIG_fail_arg(10); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_playAndGetDigits"); arg2 = (int)lua_tonumber(L, 2); arg3 = (int)lua_tonumber(L, 3); arg4 = (int)lua_tonumber(L, 4); arg5 = (int)lua_tonumber(L, 5); - arg6 = (char *)lua_tostring(L, 6); - arg7 = (char *)lua_tostring(L, 7); - arg8 = (char *)lua_tostring(L, 8); - arg9 = (char *)lua_tostring(L, 9); + arg6 = (char*)lua_tostring(L, 6); + arg7 = (char*)lua_tostring(L, 7); + arg8 = (char*)lua_tostring(L, 8); + arg9 = (char*)lua_tostring(L, 9); if(lua_gettop(L)>=10){ - arg10 = (char *)lua_tostring(L, 10); + arg10 = (char*)lua_tostring(L, 10); } result = (char *)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,(char const *)arg10); SWIG_arg=0; - lua_pushstring(L,(const char*)result); SWIG_arg++; + lua_pushstring(L,result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -5268,16 +4286,11 @@ static int _wrap_CoreSession_streamFile(lua_State* L) { int arg3 = (int) 0 ; int result; - SWIG_check_num_args("streamFile",2,3) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("streamFile",1,"CoreSession *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("streamFile",2,"char *"); - if(lua_gettop(L)>=3 && !lua_isnumber(L,3)) SWIG_fail_arg("streamFile",3,"int"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_streamFile",1,SWIGTYPE_p_CoreSession); - } - - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + if(lua_gettop(L)>=3 && !lua_isnumber(L,3)) SWIG_fail_arg(3); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_streamFile"); + arg2 = (char*)lua_tostring(L, 2); if(lua_gettop(L)>=3){ arg3 = (int)lua_tonumber(L, 3); } @@ -5286,8 +4299,6 @@ static int _wrap_CoreSession_streamFile(lua_State* L) { lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -5301,15 +4312,10 @@ static int _wrap_CoreSession_sleep(lua_State* L) { int arg3 = (int) 0 ; int result; - SWIG_check_num_args("sleep",2,3) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("sleep",1,"CoreSession *"); - if(!lua_isnumber(L,2)) SWIG_fail_arg("sleep",2,"int"); - if(lua_gettop(L)>=3 && !lua_isnumber(L,3)) SWIG_fail_arg("sleep",3,"int"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_sleep",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isnumber(L,2)) SWIG_fail_arg(2); + if(lua_gettop(L)>=3 && !lua_isnumber(L,3)) SWIG_fail_arg(3); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_sleep"); arg2 = (int)lua_tonumber(L, 2); if(lua_gettop(L)>=3){ arg3 = (int)lua_tonumber(L, 3); @@ -5319,8 +4325,6 @@ static int _wrap_CoreSession_sleep(lua_State* L) { lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -5332,20 +4336,13 @@ static int _wrap_CoreSession_flushEvents(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; int result; - SWIG_check_num_args("flushEvents",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("flushEvents",1,"CoreSession *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_flushEvents",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_flushEvents"); result = (int)(arg1)->flushEvents(); SWIG_arg=0; lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -5357,20 +4354,13 @@ static int _wrap_CoreSession_flushDigits(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; int result; - SWIG_check_num_args("flushDigits",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("flushDigits",1,"CoreSession *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_flushDigits",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_flushDigits"); result = (int)(arg1)->flushDigits(); SWIG_arg=0; lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -5383,22 +4373,15 @@ static int _wrap_CoreSession_setAutoHangup(lua_State* L) { bool arg2 ; int result; - SWIG_check_num_args("setAutoHangup",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setAutoHangup",1,"CoreSession *"); - if(!lua_isboolean(L,2)) SWIG_fail_arg("setAutoHangup",2,"bool"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_setAutoHangup",1,SWIGTYPE_p_CoreSession); - } - - arg2 = (lua_toboolean(L, 2)!=0); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isboolean(L,2)) SWIG_fail_arg(2); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_setAutoHangup"); + arg2 = (bool)lua_toboolean(L, 2); result = (int)(arg1)->setAutoHangup(arg2); SWIG_arg=0; lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -5410,22 +4393,15 @@ static int _wrap_CoreSession_setHangupHook(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; void *arg2 = (void *) 0 ; - SWIG_check_num_args("setHangupHook",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setHangupHook",1,"CoreSession *"); - if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("setHangupHook",2,"void *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_setHangupHook",1,SWIGTYPE_p_CoreSession); - } - - arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"CoreSession_setHangupHook"); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_setHangupHook"); + arg2=((swig_lua_userdata*)(lua_touserdata(L,2)))->ptr; (arg1)->setHangupHook(arg2); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -5437,20 +4413,13 @@ static int _wrap_CoreSession_ready(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; bool result; - SWIG_check_num_args("ready",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ready",1,"CoreSession *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_ready",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_ready"); result = (bool)(arg1)->ready(); SWIG_arg=0; - lua_pushboolean(L,(int)(result==true)); SWIG_arg++; + lua_pushboolean(L,(int)result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -5462,20 +4431,13 @@ static int _wrap_CoreSession_bridged(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; bool result; - SWIG_check_num_args("bridged",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("bridged",1,"CoreSession *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_bridged",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_bridged"); result = (bool)(arg1)->bridged(); SWIG_arg=0; - lua_pushboolean(L,(int)(result==true)); SWIG_arg++; + lua_pushboolean(L,(int)result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -5487,20 +4449,13 @@ static int _wrap_CoreSession_answered(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; bool result; - SWIG_check_num_args("answered",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("answered",1,"CoreSession *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_answered",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_answered"); result = (bool)(arg1)->answered(); SWIG_arg=0; - lua_pushboolean(L,(int)(result==true)); SWIG_arg++; + lua_pushboolean(L,(int)result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -5512,20 +4467,13 @@ static int _wrap_CoreSession_mediaReady(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; bool result; - SWIG_check_num_args("mediaReady",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("mediaReady",1,"CoreSession *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_mediaReady",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_mediaReady"); result = (bool)(arg1)->mediaReady(); SWIG_arg=0; - lua_pushboolean(L,(int)(result==true)); SWIG_arg++; + lua_pushboolean(L,(int)result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -5537,26 +4485,15 @@ static int _wrap_CoreSession_waitForAnswer(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; CoreSession *arg2 = (CoreSession *) 0 ; - SWIG_check_num_args("waitForAnswer",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("waitForAnswer",1,"CoreSession *"); - if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("waitForAnswer",2,"CoreSession *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_waitForAnswer",1,SWIGTYPE_p_CoreSession); - } - - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_waitForAnswer",2,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_waitForAnswer"); + arg2=(CoreSession *)SWIG_MustGetPtr(L,2,SWIGTYPE_p_CoreSession,0,2,"CoreSession_waitForAnswer"); (arg1)->waitForAnswer(arg2); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -5569,26 +4506,19 @@ static int _wrap_CoreSession_execute(lua_State* L) { char *arg2 = (char *) 0 ; char *arg3 = (char *) NULL ; - SWIG_check_num_args("execute",2,3) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("execute",1,"CoreSession *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("execute",2,"char const *"); - if(lua_gettop(L)>=3 && !lua_isstring(L,3)) SWIG_fail_arg("execute",3,"char const *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_execute",1,SWIGTYPE_p_CoreSession); - } - - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + if(lua_gettop(L)>=3 && !lua_isstring(L,3)) SWIG_fail_arg(3); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_execute"); + arg2 = (char*)lua_tostring(L, 2); if(lua_gettop(L)>=3){ - arg3 = (char *)lua_tostring(L, 3); + arg3 = (char*)lua_tostring(L, 3); } (arg1)->execute((char const *)arg2,(char const *)arg3); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -5600,26 +4530,15 @@ static int _wrap_CoreSession_sendEvent(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; Event *arg2 = (Event *) 0 ; - SWIG_check_num_args("sendEvent",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("sendEvent",1,"CoreSession *"); - if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("sendEvent",2,"Event *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_sendEvent",1,SWIGTYPE_p_CoreSession); - } - - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_Event,0))){ - SWIG_fail_ptr("CoreSession_sendEvent",2,SWIGTYPE_p_Event); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_sendEvent"); + arg2=(Event *)SWIG_MustGetPtr(L,2,SWIGTYPE_p_Event,0,2,"CoreSession_sendEvent"); (arg1)->sendEvent(arg2); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -5631,26 +4550,15 @@ static int _wrap_CoreSession_setEventData(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; Event *arg2 = (Event *) 0 ; - SWIG_check_num_args("setEventData",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setEventData",1,"CoreSession *"); - if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("setEventData",2,"Event *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_setEventData",1,SWIGTYPE_p_CoreSession); - } - - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_Event,0))){ - SWIG_fail_ptr("CoreSession_setEventData",2,SWIGTYPE_p_Event); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_setEventData"); + arg2=(Event *)SWIG_MustGetPtr(L,2,SWIGTYPE_p_Event,0,2,"CoreSession_setEventData"); (arg1)->setEventData(arg2); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -5662,20 +4570,13 @@ static int _wrap_CoreSession_getXMLCDR(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; char *result = 0 ; - SWIG_check_num_args("getXMLCDR",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getXMLCDR",1,"CoreSession *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_getXMLCDR",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_getXMLCDR"); result = (char *)(arg1)->getXMLCDR(); SWIG_arg=0; - lua_pushstring(L,(const char*)result); SWIG_arg++; + lua_pushstring(L,result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -5687,20 +4588,13 @@ static int _wrap_CoreSession_begin_allow_threads(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; bool result; - SWIG_check_num_args("begin_allow_threads",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("begin_allow_threads",1,"CoreSession *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_begin_allow_threads",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_begin_allow_threads"); result = (bool)(arg1)->begin_allow_threads(); SWIG_arg=0; - lua_pushboolean(L,(int)(result==true)); SWIG_arg++; + lua_pushboolean(L,(int)result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -5712,20 +4606,13 @@ static int _wrap_CoreSession_end_allow_threads(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; bool result; - SWIG_check_num_args("end_allow_threads",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("end_allow_threads",1,"CoreSession *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_end_allow_threads",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_end_allow_threads"); result = (bool)(arg1)->end_allow_threads(); SWIG_arg=0; - lua_pushboolean(L,(int)(result==true)); SWIG_arg++; + lua_pushboolean(L,(int)result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -5737,20 +4624,13 @@ static int _wrap_CoreSession_get_uuid(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; char *result = 0 ; - SWIG_check_num_args("get_uuid",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("get_uuid",1,"CoreSession const *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_get_uuid",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_get_uuid"); result = (char *)((CoreSession const *)arg1)->get_uuid(); SWIG_arg=0; - lua_pushstring(L,(const char*)result); SWIG_arg++; + lua_pushstring(L,result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -5762,13 +4642,8 @@ static int _wrap_CoreSession_get_cb_args(lua_State* L) { CoreSession *arg1 = (CoreSession *) 0 ; switch_input_args_t *result = 0 ; - SWIG_check_num_args("get_cb_args",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("get_cb_args",1,"CoreSession const *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_get_cb_args",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_get_cb_args"); { switch_input_args_t const &_result_ref = ((CoreSession const *)arg1)->get_cb_args(); result = (switch_input_args_t *) &_result_ref; @@ -5777,8 +4652,6 @@ static int _wrap_CoreSession_get_cb_args(lua_State* L) { SWIG_NewPointerObj(L,result,SWIGTYPE_p_switch_input_args_t,0); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -5789,20 +4662,13 @@ static int _wrap_CoreSession_check_hangup_hook(lua_State* L) { int SWIG_arg = -1; CoreSession *arg1 = (CoreSession *) 0 ; - SWIG_check_num_args("check_hangup_hook",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("check_hangup_hook",1,"CoreSession *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_check_hangup_hook",1,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_check_hangup_hook"); (arg1)->check_hangup_hook(); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -5815,34 +4681,26 @@ static int _wrap_CoreSession_run_dtmf_callback(lua_State* L) { void *arg2 = (void *) 0 ; switch_input_type_t arg3 ; switch_status_t result; - switch_input_type_t *argp3 ; - - SWIG_check_num_args("run_dtmf_callback",3,3) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("run_dtmf_callback",1,"CoreSession *"); - if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("run_dtmf_callback",2,"void *"); - if(!lua_isuserdata(L,3)) SWIG_fail_arg("run_dtmf_callback",3,"switch_input_type_t"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("CoreSession_run_dtmf_callback",1,SWIGTYPE_p_CoreSession); - } - arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"CoreSession_run_dtmf_callback"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,3,(void**)&argp3,SWIGTYPE_p_switch_input_type_t,0))){ - SWIG_fail_ptr("CoreSession_run_dtmf_callback",3,SWIGTYPE_p_switch_input_type_t); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); + if(!lua_isuserdata(L,3)) SWIG_fail_arg(3); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"CoreSession_run_dtmf_callback"); + arg2=((swig_lua_userdata*)(lua_touserdata(L,2)))->ptr; + { + switch_input_type_t * argp; + if(SWIG_ConvertPtr(L,3,(void**)(&argp),SWIGTYPE_p_switch_input_type_t,0)) SWIG_fail; + arg3 = *argp; } - arg3 = *argp3; - result = (arg1)->run_dtmf_callback(arg2,arg3); SWIG_arg=0; { - switch_status_t * resultptr = new switch_status_t((switch_status_t &) result); + switch_status_t * resultptr; + resultptr = new switch_status_t((switch_status_t &) result); SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_status_t,1); SWIG_arg++; } return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -5902,39 +4760,35 @@ static swig_lua_method swig_CoreSession_methods[] = { {0,0} }; static swig_lua_attribute swig_CoreSession_attributes[] = { - { "session", _wrap_CoreSession_session_get, _wrap_CoreSession_session_set}, - { "channel", _wrap_CoreSession_channel_get, _wrap_CoreSession_channel_set}, - { "flags", _wrap_CoreSession_flags_get, _wrap_CoreSession_flags_set}, - { "allocated", _wrap_CoreSession_allocated_get, _wrap_CoreSession_allocated_set}, - { "cb_state", _wrap_CoreSession_cb_state_get, _wrap_CoreSession_cb_state_set}, - { "hook_state", _wrap_CoreSession_hook_state_get, _wrap_CoreSession_hook_state_set}, - { "cause", _wrap_CoreSession_cause_get, _wrap_CoreSession_cause_set}, - { "uuid", _wrap_CoreSession_uuid_get, _wrap_CoreSession_uuid_set}, - { "tts_name", _wrap_CoreSession_tts_name_get, _wrap_CoreSession_tts_name_set}, - { "voice_name", _wrap_CoreSession_voice_name_get, _wrap_CoreSession_voice_name_set}, + { "session",_wrap_CoreSession_session_get, _wrap_CoreSession_session_set}, + { "channel",_wrap_CoreSession_channel_get, _wrap_CoreSession_channel_set}, + { "flags",_wrap_CoreSession_flags_get, _wrap_CoreSession_flags_set}, + { "allocated",_wrap_CoreSession_allocated_get, _wrap_CoreSession_allocated_set}, + { "cb_state",_wrap_CoreSession_cb_state_get, _wrap_CoreSession_cb_state_set}, + { "hook_state",_wrap_CoreSession_hook_state_get, _wrap_CoreSession_hook_state_set}, + { "cause",_wrap_CoreSession_cause_get, _wrap_CoreSession_cause_set}, + { "uuid",_wrap_CoreSession_uuid_get, _wrap_CoreSession_uuid_set}, + { "tts_name",_wrap_CoreSession_tts_name_get, _wrap_CoreSession_tts_name_set}, + { "voice_name",_wrap_CoreSession_voice_name_get, _wrap_CoreSession_voice_name_set}, {0,0,0} }; static swig_lua_class *swig_CoreSession_bases[] = {0}; -static const char *swig_CoreSession_base_names[] = {0}; -static swig_lua_class _wrap_class_CoreSession = { "CoreSession", &SWIGTYPE_p_CoreSession,0, swig_delete_CoreSession, swig_CoreSession_methods, swig_CoreSession_attributes, swig_CoreSession_bases, swig_CoreSession_base_names }; +swig_lua_class _wrap_class_CoreSession = { "CoreSession", &SWIGTYPE_p_CoreSession,0, swig_delete_CoreSession, swig_CoreSession_methods, swig_CoreSession_attributes, swig_CoreSession_bases }; static int _wrap_console_log(lua_State* L) { int SWIG_arg = -1; char *arg1 = (char *) 0 ; char *arg2 = (char *) 0 ; - SWIG_check_num_args("console_log",2,2) - if(!lua_isstring(L,1)) SWIG_fail_arg("console_log",1,"char *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("console_log",2,"char *"); - arg1 = (char *)lua_tostring(L, 1); - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isstring(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + arg1 = (char*)lua_tostring(L, 1); + arg2 = (char*)lua_tostring(L, 2); console_log(arg1,arg2); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -5945,16 +4799,13 @@ static int _wrap_console_clean_log(lua_State* L) { int SWIG_arg = -1; char *arg1 = (char *) 0 ; - SWIG_check_num_args("console_clean_log",1,1) - if(!lua_isstring(L,1)) SWIG_fail_arg("console_clean_log",1,"char *"); - arg1 = (char *)lua_tostring(L, 1); + if(!lua_isstring(L,1)) SWIG_fail_arg(1); + arg1 = (char*)lua_tostring(L, 1); console_clean_log(arg1); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -5965,16 +4816,13 @@ static int _wrap_msleep(lua_State* L) { int SWIG_arg = -1; unsigned int arg1 ; - SWIG_check_num_args("msleep",1,1) - if(!lua_isnumber(L,1)) SWIG_fail_arg("msleep",1,"unsigned int"); + if(!lua_isnumber(L,1)) SWIG_fail_arg(1); arg1 = (unsigned int)lua_tonumber(L, 1); msleep(arg1); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -5986,26 +4834,15 @@ static int _wrap_bridge(lua_State* L) { CoreSession *arg1 = 0 ; CoreSession *arg2 = 0 ; - SWIG_check_num_args("bridge",2,2) - if(!lua_isuserdata(L,1)) SWIG_fail_arg("bridge",1,"CoreSession &"); - if(!lua_isuserdata(L,2)) SWIG_fail_arg("bridge",2,"CoreSession &"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("bridge",1,SWIGTYPE_p_CoreSession); - } - - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("bridge",2,SWIGTYPE_p_CoreSession); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); + arg1=(CoreSession *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_CoreSession,0,1,"bridge"); + arg2=(CoreSession *)SWIG_MustGetPtr(L,2,SWIGTYPE_p_CoreSession,0,2,"bridge"); bridge(*arg1,*arg2); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -6017,23 +4854,17 @@ static int _wrap_hanguphook(lua_State* L) { switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; switch_status_t result; - SWIG_check_num_args("hanguphook",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hanguphook",1,"switch_core_session_t *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_switch_core_session_t,0))){ - SWIG_fail_ptr("hanguphook",1,SWIGTYPE_p_switch_core_session_t); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(switch_core_session_t *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_switch_core_session_t,0,1,"hanguphook"); result = hanguphook(arg1); SWIG_arg=0; { - switch_status_t * resultptr = new switch_status_t((switch_status_t &) result); + switch_status_t * resultptr; + resultptr = new switch_status_t((switch_status_t &) result); SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_status_t,1); SWIG_arg++; } return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -6048,38 +4879,30 @@ static int _wrap_dtmf_callback(lua_State* L) { void *arg4 = (void *) 0 ; unsigned int arg5 ; switch_status_t result; - switch_input_type_t *argp3 ; - - SWIG_check_num_args("dtmf_callback",5,5) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("dtmf_callback",1,"switch_core_session_t *"); - if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("dtmf_callback",2,"void *"); - if(!lua_isuserdata(L,3)) SWIG_fail_arg("dtmf_callback",3,"switch_input_type_t"); - if(!SWIG_isptrtype(L,4)) SWIG_fail_arg("dtmf_callback",4,"void *"); - if(!lua_isnumber(L,5)) SWIG_fail_arg("dtmf_callback",5,"unsigned int"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_switch_core_session_t,0))){ - SWIG_fail_ptr("dtmf_callback",1,SWIGTYPE_p_switch_core_session_t); - } - arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"dtmf_callback"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,3,(void**)&argp3,SWIGTYPE_p_switch_input_type_t,0))){ - SWIG_fail_ptr("dtmf_callback",3,SWIGTYPE_p_switch_input_type_t); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); + if(!lua_isuserdata(L,3)) SWIG_fail_arg(3); + if(!lua_isuserdata(L,4)) SWIG_fail_arg(4); + if(!lua_isnumber(L,5)) SWIG_fail_arg(5); + arg1=(switch_core_session_t *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_switch_core_session_t,0,1,"dtmf_callback"); + arg2=((swig_lua_userdata*)(lua_touserdata(L,2)))->ptr; + { + switch_input_type_t * argp; + if(SWIG_ConvertPtr(L,3,(void**)(&argp),SWIGTYPE_p_switch_input_type_t,0)) SWIG_fail; + arg3 = *argp; } - arg3 = *argp3; - - arg4=(void *)SWIG_MustGetPtr(L,4,0,0,4,"dtmf_callback"); + arg4=((swig_lua_userdata*)(lua_touserdata(L,4)))->ptr; arg5 = (unsigned int)lua_tonumber(L, 5); result = dtmf_callback(arg1,arg2,arg3,arg4,arg5); SWIG_arg=0; { - switch_status_t * resultptr = new switch_status_t((switch_status_t &) result); + switch_status_t * resultptr; + resultptr = new switch_status_t((switch_status_t &) result); SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_status_t,1); SWIG_arg++; } return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -6090,14 +4913,11 @@ static int _wrap_new_Session__SWIG_0(lua_State* L) { int SWIG_arg = -1; LUA::Session *result = 0 ; - SWIG_check_num_args("LUA::Session",0,0) result = (LUA::Session *)new LUA::Session(); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; result->setLUA(L); return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -6110,22 +4930,15 @@ static int _wrap_new_Session__SWIG_1(lua_State* L) { CoreSession *arg2 = (CoreSession *) 0 ; LUA::Session *result = 0 ; - SWIG_check_num_args("LUA::Session",2,2) - if(!lua_isstring(L,1)) SWIG_fail_arg("LUA::Session",1,"char *"); - if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("LUA::Session",2,"CoreSession *"); - arg1 = (char *)lua_tostring(L, 1); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("new_Session",2,SWIGTYPE_p_CoreSession); - } - + if(!lua_isstring(L,1)) SWIG_fail_arg(1); + if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); + arg1 = (char*)lua_tostring(L, 1); + arg2=(CoreSession *)SWIG_MustGetPtr(L,2,SWIGTYPE_p_CoreSession,0,2,"new_Session"); result = (LUA::Session *)new LUA::Session(arg1,arg2); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; result->setLUA(L); return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -6137,16 +4950,13 @@ static int _wrap_new_Session__SWIG_2(lua_State* L) { char *arg1 = (char *) 0 ; LUA::Session *result = 0 ; - SWIG_check_num_args("LUA::Session",1,1) - if(!lua_isstring(L,1)) SWIG_fail_arg("LUA::Session",1,"char *"); - arg1 = (char *)lua_tostring(L, 1); + if(!lua_isstring(L,1)) SWIG_fail_arg(1); + arg1 = (char*)lua_tostring(L, 1); result = (LUA::Session *)new LUA::Session(arg1); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; result->setLUA(L); return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -6158,20 +4968,13 @@ static int _wrap_new_Session__SWIG_3(lua_State* L) { switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; LUA::Session *result = 0 ; - SWIG_check_num_args("LUA::Session",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("LUA::Session",1,"switch_core_session_t *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_switch_core_session_t,0))){ - SWIG_fail_ptr("new_Session",1,SWIGTYPE_p_switch_core_session_t); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(switch_core_session_t *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_switch_core_session_t,0,1,"new_Session"); result = (LUA::Session *)new LUA::Session(arg1); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; result->setLUA(L); return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -6192,7 +4995,7 @@ static int _wrap_new_Session(lua_State* L) { int _v; { void *ptr; - if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_switch_core_session_t, 0)) { + if (lua_isuserdata(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_switch_core_session_t, 0)) { _v = 0; } else { _v = 1; @@ -6219,7 +5022,7 @@ static int _wrap_new_Session(lua_State* L) { if (_v) { { void *ptr; - if (SWIG_isptrtype(L,argv[1])==0 || SWIG_ConvertPtr(L,argv[1], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) { + if (lua_isuserdata(L,argv[1])==0 || SWIG_ConvertPtr(L,argv[1], (void **) &ptr, SWIGTYPE_p_CoreSession, 0)) { _v = 0; } else { _v = 1; @@ -6240,21 +5043,14 @@ static int _wrap_delete_Session(lua_State* L) { int SWIG_arg = -1; LUA::Session *arg1 = (LUA::Session *) 0 ; - SWIG_check_num_args("LUA::~Session",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("LUA::~Session",1,"LUA::Session *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,SWIG_POINTER_DISOWN))){ - SWIG_fail_ptr("delete_Session",1,SWIGTYPE_p_LUA__Session); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"delete_Session"); delete arg1; SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -6265,20 +5061,13 @@ static int _wrap_Session_destroy(lua_State* L) { int SWIG_arg = -1; LUA::Session *arg1 = (LUA::Session *) 0 ; - SWIG_check_num_args("destroy",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("destroy",1,"LUA::Session *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ - SWIG_fail_ptr("Session_destroy",1,SWIGTYPE_p_LUA__Session); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_destroy"); (arg1)->destroy(); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -6290,20 +5079,13 @@ static int _wrap_Session_begin_allow_threads(lua_State* L) { LUA::Session *arg1 = (LUA::Session *) 0 ; bool result; - SWIG_check_num_args("begin_allow_threads",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("begin_allow_threads",1,"LUA::Session *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ - SWIG_fail_ptr("Session_begin_allow_threads",1,SWIGTYPE_p_LUA__Session); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_begin_allow_threads"); result = (bool)(arg1)->begin_allow_threads(); SWIG_arg=0; - lua_pushboolean(L,(int)(result==true)); SWIG_arg++; + lua_pushboolean(L,(int)result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -6315,20 +5097,13 @@ static int _wrap_Session_end_allow_threads(lua_State* L) { LUA::Session *arg1 = (LUA::Session *) 0 ; bool result; - SWIG_check_num_args("end_allow_threads",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("end_allow_threads",1,"LUA::Session *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ - SWIG_fail_ptr("Session_end_allow_threads",1,SWIGTYPE_p_LUA__Session); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_end_allow_threads"); result = (bool)(arg1)->end_allow_threads(); SWIG_arg=0; - lua_pushboolean(L,(int)(result==true)); SWIG_arg++; + lua_pushboolean(L,(int)result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -6339,20 +5114,13 @@ static int _wrap_Session_check_hangup_hook(lua_State* L) { int SWIG_arg = -1; LUA::Session *arg1 = (LUA::Session *) 0 ; - SWIG_check_num_args("check_hangup_hook",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("check_hangup_hook",1,"LUA::Session *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ - SWIG_fail_ptr("Session_check_hangup_hook",1,SWIGTYPE_p_LUA__Session); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_check_hangup_hook"); (arg1)->check_hangup_hook(); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -6365,34 +5133,26 @@ static int _wrap_Session_run_dtmf_callback(lua_State* L) { void *arg2 = (void *) 0 ; switch_input_type_t arg3 ; switch_status_t result; - switch_input_type_t *argp3 ; - - SWIG_check_num_args("run_dtmf_callback",3,3) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("run_dtmf_callback",1,"LUA::Session *"); - if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("run_dtmf_callback",2,"void *"); - if(!lua_isuserdata(L,3)) SWIG_fail_arg("run_dtmf_callback",3,"switch_input_type_t"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ - SWIG_fail_ptr("Session_run_dtmf_callback",1,SWIGTYPE_p_LUA__Session); - } - - arg2=(void *)SWIG_MustGetPtr(L,2,0,0,2,"Session_run_dtmf_callback"); - if (!SWIG_IsOK(SWIG_ConvertPtr(L,3,(void**)&argp3,SWIGTYPE_p_switch_input_type_t,0))){ - SWIG_fail_ptr("Session_run_dtmf_callback",3,SWIGTYPE_p_switch_input_type_t); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); + if(!lua_isuserdata(L,3)) SWIG_fail_arg(3); + arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_run_dtmf_callback"); + arg2=((swig_lua_userdata*)(lua_touserdata(L,2)))->ptr; + { + switch_input_type_t * argp; + if(SWIG_ConvertPtr(L,3,(void**)(&argp),SWIGTYPE_p_switch_input_type_t,0)) SWIG_fail; + arg3 = *argp; } - arg3 = *argp3; - result = (arg1)->run_dtmf_callback(arg2,arg3); SWIG_arg=0; { - switch_status_t * resultptr = new switch_status_t((switch_status_t &) result); + switch_status_t * resultptr; + resultptr = new switch_status_t((switch_status_t &) result); SWIG_NewPointerObj(L,(void *) resultptr,SWIGTYPE_p_switch_status_t,1); SWIG_arg++; } return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -6403,20 +5163,13 @@ static int _wrap_Session_unsetInputCallback(lua_State* L) { int SWIG_arg = -1; LUA::Session *arg1 = (LUA::Session *) 0 ; - SWIG_check_num_args("unsetInputCallback",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("unsetInputCallback",1,"LUA::Session *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ - SWIG_fail_ptr("Session_unsetInputCallback",1,SWIGTYPE_p_LUA__Session); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_unsetInputCallback"); (arg1)->unsetInputCallback(); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -6429,24 +5182,17 @@ static int _wrap_Session_setInputCallback__SWIG_0(lua_State* L) { char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; - SWIG_check_num_args("setInputCallback",3,3) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setInputCallback",1,"LUA::Session *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("setInputCallback",2,"char *"); - if(!lua_isstring(L,3)) SWIG_fail_arg("setInputCallback",3,"char *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ - SWIG_fail_ptr("Session_setInputCallback",1,SWIGTYPE_p_LUA__Session); - } - - arg2 = (char *)lua_tostring(L, 2); - arg3 = (char *)lua_tostring(L, 3); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + if(!lua_isstring(L,3)) SWIG_fail_arg(3); + arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_setInputCallback"); + arg2 = (char*)lua_tostring(L, 2); + arg3 = (char*)lua_tostring(L, 3); (arg1)->setInputCallback(arg2,arg3); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -6458,22 +5204,15 @@ static int _wrap_Session_setInputCallback__SWIG_1(lua_State* L) { LUA::Session *arg1 = (LUA::Session *) 0 ; char *arg2 = (char *) 0 ; - SWIG_check_num_args("setInputCallback",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setInputCallback",1,"LUA::Session *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("setInputCallback",2,"char *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ - SWIG_fail_ptr("Session_setInputCallback",1,SWIGTYPE_p_LUA__Session); - } - - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_setInputCallback"); + arg2 = (char*)lua_tostring(L, 2); (arg1)->setInputCallback(arg2); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -6491,7 +5230,7 @@ static int _wrap_Session_setInputCallback(lua_State* L) { int _v; { void *ptr; - if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) { + if (lua_isuserdata(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) { _v = 0; } else { _v = 1; @@ -6510,7 +5249,7 @@ static int _wrap_Session_setInputCallback(lua_State* L) { int _v; { void *ptr; - if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) { + if (lua_isuserdata(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) { _v = 0; } else { _v = 1; @@ -6542,24 +5281,17 @@ static int _wrap_Session_setHangupHook__SWIG_0(lua_State* L) { char *arg2 = (char *) 0 ; char *arg3 = (char *) 0 ; - SWIG_check_num_args("setHangupHook",3,3) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setHangupHook",1,"LUA::Session *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("setHangupHook",2,"char *"); - if(!lua_isstring(L,3)) SWIG_fail_arg("setHangupHook",3,"char *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ - SWIG_fail_ptr("Session_setHangupHook",1,SWIGTYPE_p_LUA__Session); - } - - arg2 = (char *)lua_tostring(L, 2); - arg3 = (char *)lua_tostring(L, 3); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + if(!lua_isstring(L,3)) SWIG_fail_arg(3); + arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_setHangupHook"); + arg2 = (char*)lua_tostring(L, 2); + arg3 = (char*)lua_tostring(L, 3); (arg1)->setHangupHook(arg2,arg3); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -6571,22 +5303,15 @@ static int _wrap_Session_setHangupHook__SWIG_1(lua_State* L) { LUA::Session *arg1 = (LUA::Session *) 0 ; char *arg2 = (char *) 0 ; - SWIG_check_num_args("setHangupHook",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setHangupHook",1,"LUA::Session *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("setHangupHook",2,"char *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ - SWIG_fail_ptr("Session_setHangupHook",1,SWIGTYPE_p_LUA__Session); - } - - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_setHangupHook"); + arg2 = (char*)lua_tostring(L, 2); (arg1)->setHangupHook(arg2); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -6604,7 +5329,7 @@ static int _wrap_Session_setHangupHook(lua_State* L) { int _v; { void *ptr; - if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) { + if (lua_isuserdata(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) { _v = 0; } else { _v = 1; @@ -6623,7 +5348,7 @@ static int _wrap_Session_setHangupHook(lua_State* L) { int _v; { void *ptr; - if (SWIG_isptrtype(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) { + if (lua_isuserdata(L,argv[0])==0 || SWIG_ConvertPtr(L,argv[0], (void **) &ptr, SWIGTYPE_p_LUA__Session, 0)) { _v = 0; } else { _v = 1; @@ -6654,20 +5379,13 @@ static int _wrap_Session_ready(lua_State* L) { LUA::Session *arg1 = (LUA::Session *) 0 ; bool result; - SWIG_check_num_args("ready",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("ready",1,"LUA::Session *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ - SWIG_fail_ptr("Session_ready",1,SWIGTYPE_p_LUA__Session); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_ready"); result = (bool)(arg1)->ready(); SWIG_arg=0; - lua_pushboolean(L,(int)(result==true)); SWIG_arg++; + lua_pushboolean(L,(int)result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -6682,30 +5400,19 @@ static int _wrap_Session_originate(lua_State* L) { int arg4 ; int result; - SWIG_check_num_args("originate",4,4) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("originate",1,"LUA::Session *"); - if(!SWIG_isptrtype(L,2)) SWIG_fail_arg("originate",2,"CoreSession *"); - if(!lua_isstring(L,3)) SWIG_fail_arg("originate",3,"char *"); - if(!lua_isnumber(L,4)) SWIG_fail_arg("originate",4,"int"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ - SWIG_fail_ptr("Session_originate",1,SWIGTYPE_p_LUA__Session); - } - - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,2,(void**)&arg2,SWIGTYPE_p_CoreSession,0))){ - SWIG_fail_ptr("Session_originate",2,SWIGTYPE_p_CoreSession); - } - - arg3 = (char *)lua_tostring(L, 3); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); + if(!lua_isstring(L,3)) SWIG_fail_arg(3); + if(!lua_isnumber(L,4)) SWIG_fail_arg(4); + arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_originate"); + arg2=(CoreSession *)SWIG_MustGetPtr(L,2,SWIGTYPE_p_CoreSession,0,2,"Session_originate"); + arg3 = (char*)lua_tostring(L, 3); arg4 = (int)lua_tonumber(L, 4); result = (int)(arg1)->originate(arg2,arg3,arg4); SWIG_arg=0; lua_pushnumber(L, (lua_Number) result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -6717,20 +5424,15 @@ static int _wrap_Session_cb_function_set(lua_State* L) { LUA::Session *arg1 = (LUA::Session *) 0 ; char *arg2 = (char *) 0 ; - SWIG_check_num_args("cb_function",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cb_function",1,"LUA::Session *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("cb_function",2,"char *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ - SWIG_fail_ptr("Session_cb_function_set",1,SWIGTYPE_p_LUA__Session); - } - - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_cb_function_set"); + arg2 = (char*)lua_tostring(L, 2); { if (arg1->cb_function) delete [] arg1->cb_function; if (arg2) { - arg1->cb_function = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->cb_function, (const char *)arg2); + arg1->cb_function = (char *) (new char[strlen(arg2)+1]); + strcpy((char *) arg1->cb_function,arg2); } else { arg1->cb_function = 0; } @@ -6739,8 +5441,6 @@ static int _wrap_Session_cb_function_set(lua_State* L) { return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -6752,20 +5452,13 @@ static int _wrap_Session_cb_function_get(lua_State* L) { LUA::Session *arg1 = (LUA::Session *) 0 ; char *result = 0 ; - SWIG_check_num_args("cb_function",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cb_function",1,"LUA::Session *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ - SWIG_fail_ptr("Session_cb_function_get",1,SWIGTYPE_p_LUA__Session); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_cb_function_get"); result = (char *) ((arg1)->cb_function); SWIG_arg=0; - lua_pushstring(L,(const char*)result); SWIG_arg++; + lua_pushstring(L,result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -6777,20 +5470,15 @@ static int _wrap_Session_cb_arg_set(lua_State* L) { LUA::Session *arg1 = (LUA::Session *) 0 ; char *arg2 = (char *) 0 ; - SWIG_check_num_args("cb_arg",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cb_arg",1,"LUA::Session *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("cb_arg",2,"char *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ - SWIG_fail_ptr("Session_cb_arg_set",1,SWIGTYPE_p_LUA__Session); - } - - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_cb_arg_set"); + arg2 = (char*)lua_tostring(L, 2); { if (arg1->cb_arg) delete [] arg1->cb_arg; if (arg2) { - arg1->cb_arg = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->cb_arg, (const char *)arg2); + arg1->cb_arg = (char *) (new char[strlen(arg2)+1]); + strcpy((char *) arg1->cb_arg,arg2); } else { arg1->cb_arg = 0; } @@ -6799,8 +5487,6 @@ static int _wrap_Session_cb_arg_set(lua_State* L) { return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -6812,20 +5498,13 @@ static int _wrap_Session_cb_arg_get(lua_State* L) { LUA::Session *arg1 = (LUA::Session *) 0 ; char *result = 0 ; - SWIG_check_num_args("cb_arg",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("cb_arg",1,"LUA::Session *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ - SWIG_fail_ptr("Session_cb_arg_get",1,SWIGTYPE_p_LUA__Session); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_cb_arg_get"); result = (char *) ((arg1)->cb_arg); SWIG_arg=0; - lua_pushstring(L,(const char*)result); SWIG_arg++; + lua_pushstring(L,result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -6837,20 +5516,15 @@ static int _wrap_Session_hangup_func_str_set(lua_State* L) { LUA::Session *arg1 = (LUA::Session *) 0 ; char *arg2 = (char *) 0 ; - SWIG_check_num_args("hangup_func_str",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangup_func_str",1,"LUA::Session *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("hangup_func_str",2,"char *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ - SWIG_fail_ptr("Session_hangup_func_str_set",1,SWIGTYPE_p_LUA__Session); - } - - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_hangup_func_str_set"); + arg2 = (char*)lua_tostring(L, 2); { if (arg1->hangup_func_str) delete [] arg1->hangup_func_str; if (arg2) { - arg1->hangup_func_str = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->hangup_func_str, (const char *)arg2); + arg1->hangup_func_str = (char *) (new char[strlen(arg2)+1]); + strcpy((char *) arg1->hangup_func_str,arg2); } else { arg1->hangup_func_str = 0; } @@ -6859,8 +5533,6 @@ static int _wrap_Session_hangup_func_str_set(lua_State* L) { return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -6872,20 +5544,13 @@ static int _wrap_Session_hangup_func_str_get(lua_State* L) { LUA::Session *arg1 = (LUA::Session *) 0 ; char *result = 0 ; - SWIG_check_num_args("hangup_func_str",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangup_func_str",1,"LUA::Session *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ - SWIG_fail_ptr("Session_hangup_func_str_get",1,SWIGTYPE_p_LUA__Session); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_hangup_func_str_get"); result = (char *) ((arg1)->hangup_func_str); SWIG_arg=0; - lua_pushstring(L,(const char*)result); SWIG_arg++; + lua_pushstring(L,result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -6897,20 +5562,15 @@ static int _wrap_Session_hangup_func_arg_set(lua_State* L) { LUA::Session *arg1 = (LUA::Session *) 0 ; char *arg2 = (char *) 0 ; - SWIG_check_num_args("hangup_func_arg",2,2) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangup_func_arg",1,"LUA::Session *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("hangup_func_arg",2,"char *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ - SWIG_fail_ptr("Session_hangup_func_arg_set",1,SWIGTYPE_p_LUA__Session); - } - - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_hangup_func_arg_set"); + arg2 = (char*)lua_tostring(L, 2); { if (arg1->hangup_func_arg) delete [] arg1->hangup_func_arg; if (arg2) { - arg1->hangup_func_arg = (char *) (new char[strlen((const char *)arg2)+1]); - strcpy((char *)arg1->hangup_func_arg, (const char *)arg2); + arg1->hangup_func_arg = (char *) (new char[strlen(arg2)+1]); + strcpy((char *) arg1->hangup_func_arg,arg2); } else { arg1->hangup_func_arg = 0; } @@ -6919,8 +5579,6 @@ static int _wrap_Session_hangup_func_arg_set(lua_State* L) { return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -6932,20 +5590,13 @@ static int _wrap_Session_hangup_func_arg_get(lua_State* L) { LUA::Session *arg1 = (LUA::Session *) 0 ; char *result = 0 ; - SWIG_check_num_args("hangup_func_arg",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("hangup_func_arg",1,"LUA::Session *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ - SWIG_fail_ptr("Session_hangup_func_arg_get",1,SWIGTYPE_p_LUA__Session); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_hangup_func_arg_get"); result = (char *) ((arg1)->hangup_func_arg); SWIG_arg=0; - lua_pushstring(L,(const char*)result); SWIG_arg++; + lua_pushstring(L,result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -6957,21 +5608,15 @@ static int _wrap_Session_setLUA(lua_State* L) { LUA::Session *arg1 = (LUA::Session *) 0 ; lua_State *arg2 = (lua_State *) 0 ; - arg2 = L; - SWIG_check_num_args("setLUA",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("setLUA",1,"LUA::Session *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Session,0))){ - SWIG_fail_ptr("Session_setLUA",1,SWIGTYPE_p_LUA__Session); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isuserdata(L,2)) SWIG_fail_arg(2); + arg1=(LUA::Session *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Session,0,1,"Session_setLUA"); + arg2=(lua_State *)SWIG_MustGetPtr(L,2,SWIGTYPE_p_lua_State,0,2,"Session_setLUA"); (arg1)->setLUA(arg2); SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -6997,15 +5642,14 @@ static swig_lua_method swig_LUA_Session_methods[] = { {0,0} }; static swig_lua_attribute swig_LUA_Session_attributes[] = { - { "cb_function", _wrap_Session_cb_function_get, _wrap_Session_cb_function_set}, - { "cb_arg", _wrap_Session_cb_arg_get, _wrap_Session_cb_arg_set}, - { "hangup_func_str", _wrap_Session_hangup_func_str_get, _wrap_Session_hangup_func_str_set}, - { "hangup_func_arg", _wrap_Session_hangup_func_arg_get, _wrap_Session_hangup_func_arg_set}, + { "cb_function",_wrap_Session_cb_function_get, _wrap_Session_cb_function_set}, + { "cb_arg",_wrap_Session_cb_arg_get, _wrap_Session_cb_arg_set}, + { "hangup_func_str",_wrap_Session_hangup_func_str_get, _wrap_Session_hangup_func_str_set}, + { "hangup_func_arg",_wrap_Session_hangup_func_arg_get, _wrap_Session_hangup_func_arg_set}, {0,0,0} }; -static swig_lua_class *swig_LUA_Session_bases[] = {0,0}; -static const char *swig_LUA_Session_base_names[] = {"CoreSession *",0}; -static swig_lua_class _wrap_class_LUA_Session = { "Session", &SWIGTYPE_p_LUA__Session,_wrap_new_Session, swig_delete_Session, swig_LUA_Session_methods, swig_LUA_Session_attributes, swig_LUA_Session_bases, swig_LUA_Session_base_names }; +static swig_lua_class *swig_LUA_Session_bases[] = {&_wrap_class_CoreSession,0}; +swig_lua_class _wrap_class_LUA_Session = { "Session", &SWIGTYPE_p_LUA__Session,_wrap_new_Session, swig_delete_Session, swig_LUA_Session_methods, swig_LUA_Session_attributes, swig_LUA_Session_bases }; static int _wrap_new_Dbh__SWIG_0(lua_State* L) { int SWIG_arg = -1; @@ -7014,20 +5658,17 @@ static int _wrap_new_Dbh__SWIG_0(lua_State* L) { char *arg3 = (char *) 0 ; LUA::Dbh *result = 0 ; - SWIG_check_num_args("LUA::Dbh",3,3) - if(!lua_isstring(L,1)) SWIG_fail_arg("LUA::Dbh",1,"char *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("LUA::Dbh",2,"char *"); - if(!lua_isstring(L,3)) SWIG_fail_arg("LUA::Dbh",3,"char *"); - arg1 = (char *)lua_tostring(L, 1); - arg2 = (char *)lua_tostring(L, 2); - arg3 = (char *)lua_tostring(L, 3); + if(!lua_isstring(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + if(!lua_isstring(L,3)) SWIG_fail_arg(3); + arg1 = (char*)lua_tostring(L, 1); + arg2 = (char*)lua_tostring(L, 2); + arg3 = (char*)lua_tostring(L, 3); result = (LUA::Dbh *)new LUA::Dbh(arg1,arg2,arg3); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Dbh,1); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -7040,18 +5681,15 @@ static int _wrap_new_Dbh__SWIG_1(lua_State* L) { char *arg2 = (char *) 0 ; LUA::Dbh *result = 0 ; - SWIG_check_num_args("LUA::Dbh",2,2) - if(!lua_isstring(L,1)) SWIG_fail_arg("LUA::Dbh",1,"char *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("LUA::Dbh",2,"char *"); - arg1 = (char *)lua_tostring(L, 1); - arg2 = (char *)lua_tostring(L, 2); + if(!lua_isstring(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + arg1 = (char*)lua_tostring(L, 1); + arg2 = (char*)lua_tostring(L, 2); result = (LUA::Dbh *)new LUA::Dbh(arg1,arg2); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Dbh,1); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -7063,16 +5701,13 @@ static int _wrap_new_Dbh__SWIG_2(lua_State* L) { char *arg1 = (char *) 0 ; LUA::Dbh *result = 0 ; - SWIG_check_num_args("LUA::Dbh",1,1) - if(!lua_isstring(L,1)) SWIG_fail_arg("LUA::Dbh",1,"char *"); - arg1 = (char *)lua_tostring(L, 1); + if(!lua_isstring(L,1)) SWIG_fail_arg(1); + arg1 = (char*)lua_tostring(L, 1); result = (LUA::Dbh *)new LUA::Dbh(arg1); SWIG_arg=0; SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Dbh,1); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -7138,21 +5773,14 @@ static int _wrap_delete_Dbh(lua_State* L) { int SWIG_arg = -1; LUA::Dbh *arg1 = (LUA::Dbh *) 0 ; - SWIG_check_num_args("LUA::~Dbh",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("LUA::~Dbh",1,"LUA::Dbh *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Dbh,SWIG_POINTER_DISOWN))){ - SWIG_fail_ptr("delete_Dbh",1,SWIGTYPE_p_LUA__Dbh); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(LUA::Dbh *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Dbh,0,1,"delete_Dbh"); delete arg1; SWIG_arg=0; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -7164,20 +5792,13 @@ static int _wrap_Dbh_release(lua_State* L) { LUA::Dbh *arg1 = (LUA::Dbh *) 0 ; bool result; - SWIG_check_num_args("release",1,1) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("release",1,"LUA::Dbh *"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Dbh,0))){ - SWIG_fail_ptr("Dbh_release",1,SWIGTYPE_p_LUA__Dbh); - } - + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + arg1=(LUA::Dbh *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Dbh,0,1,"Dbh_release"); result = (bool)(arg1)->release(); SWIG_arg=0; - lua_pushboolean(L,(int)(result==true)); SWIG_arg++; + lua_pushboolean(L,(int)result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -7191,24 +5812,28 @@ static int _wrap_Dbh_query(lua_State* L) { SWIGLUA_FN arg3 ; bool result; - SWIG_check_num_args("query",3,3) - if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("query",1,"LUA::Dbh *"); - if(!lua_isstring(L,2)) SWIG_fail_arg("query",2,"char *"); - if(!lua_isfunction(L,3)) SWIG_fail_arg("query",3,"SWIGLUA_FN"); - - if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Dbh,0))){ - SWIG_fail_ptr("Dbh_query",1,SWIGTYPE_p_LUA__Dbh); + { + SWIGLUA_FN default_swiglua_fn = { + 0 + }; + arg3 = default_swiglua_fn; + } + if(!lua_isuserdata(L,1)) SWIG_fail_arg(1); + if(!lua_isstring(L,2)) SWIG_fail_arg(2); + if(lua_gettop(L)>=3 && !lua_isfunction(L,3)) SWIG_fail_arg(3); + arg1=(LUA::Dbh *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_LUA__Dbh,0,1,"Dbh_query"); + arg2 = (char*)lua_tostring(L, 2); + if(lua_gettop(L)>=3){ + { + (&arg3)->L = L; + (&arg3)->idx = 3; + } } - - arg2 = (char *)lua_tostring(L, 2); - (&arg3)->L=L; (&arg3)->idx=3; result = (bool)(arg1)->query(arg2,arg3); SWIG_arg=0; - lua_pushboolean(L,(int)(result==true)); SWIG_arg++; + lua_pushboolean(L,(int)result); SWIG_arg++; return SWIG_arg; - if(0) SWIG_fail; - fail: lua_error(L); return SWIG_arg; @@ -7228,8 +5853,7 @@ static swig_lua_attribute swig_LUA_Dbh_attributes[] = { {0,0,0} }; static swig_lua_class *swig_LUA_Dbh_bases[] = {0}; -static const char *swig_LUA_Dbh_base_names[] = {0}; -static swig_lua_class _wrap_class_LUA_Dbh = { "Dbh", &SWIGTYPE_p_LUA__Dbh,_wrap_new_Dbh, swig_delete_Dbh, swig_LUA_Dbh_methods, swig_LUA_Dbh_attributes, swig_LUA_Dbh_bases, swig_LUA_Dbh_base_names }; +swig_lua_class _wrap_class_LUA_Dbh = { "Dbh", &SWIGTYPE_p_LUA__Dbh,_wrap_new_Dbh, swig_delete_Dbh, swig_LUA_Dbh_methods, swig_LUA_Dbh_attributes, swig_LUA_Dbh_bases }; #ifdef __cplusplus } @@ -7238,12 +5862,167 @@ static swig_lua_class _wrap_class_LUA_Dbh = { "Dbh", &SWIGTYPE_p_LUA__Dbh,_wrap_ static const struct luaL_reg swig_commands[] = { { "consoleLog", _wrap_consoleLog}, { "consoleCleanLog", _wrap_consoleCleanLog}, + { "new_IVRMenu", _wrap_new_IVRMenu}, + { "delete_IVRMenu", _wrap_delete_IVRMenu}, + { "IVRMenu_bindAction", _wrap_IVRMenu_bindAction}, + { "IVRMenu_execute", _wrap_IVRMenu_execute}, + { "new_API", _wrap_new_API}, + { "delete_API", _wrap_delete_API}, + { "API_execute", _wrap_API_execute}, + { "API_executeString", _wrap_API_executeString}, + { "API_getTime", _wrap_API_getTime}, + { "input_callback_state_t_function_set", _wrap_input_callback_state_t_function_set}, + { "input_callback_state_t_function_get", _wrap_input_callback_state_t_function_get}, + { "input_callback_state_t_threadState_set", _wrap_input_callback_state_t_threadState_set}, + { "input_callback_state_t_threadState_get", _wrap_input_callback_state_t_threadState_get}, + { "input_callback_state_t_extra_set", _wrap_input_callback_state_t_extra_set}, + { "input_callback_state_t_extra_get", _wrap_input_callback_state_t_extra_get}, + { "input_callback_state_t_funcargs_set", _wrap_input_callback_state_t_funcargs_set}, + { "input_callback_state_t_funcargs_get", _wrap_input_callback_state_t_funcargs_get}, + { "new_input_callback_state_t", _wrap_new_input_callback_state_t}, + { "delete_input_callback_state_t", _wrap_delete_input_callback_state_t}, + { "DTMF_digit_set", _wrap_DTMF_digit_set}, + { "DTMF_digit_get", _wrap_DTMF_digit_get}, + { "DTMF_duration_set", _wrap_DTMF_duration_set}, + { "DTMF_duration_get", _wrap_DTMF_duration_get}, + { "new_DTMF", _wrap_new_DTMF}, + { "delete_DTMF", _wrap_delete_DTMF}, + { "new_Stream",_wrap_new_Stream}, + { "delete_Stream", _wrap_delete_Stream}, + { "Stream_write", _wrap_Stream_write}, + { "Stream_get_data", _wrap_Stream_get_data}, + { "Event_event_set", _wrap_Event_event_set}, + { "Event_event_get", _wrap_Event_event_get}, + { "Event_serialized_string_set", _wrap_Event_serialized_string_set}, + { "Event_serialized_string_get", _wrap_Event_serialized_string_get}, + { "Event_mine_set", _wrap_Event_mine_set}, + { "Event_mine_get", _wrap_Event_mine_get}, + { "new_Event",_wrap_new_Event}, + { "delete_Event", _wrap_delete_Event}, + { "Event_serialize", _wrap_Event_serialize}, + { "Event_setPriority", _wrap_Event_setPriority}, + { "Event_getHeader", _wrap_Event_getHeader}, + { "Event_getBody", _wrap_Event_getBody}, + { "Event_getType", _wrap_Event_getType}, + { "Event_addBody", _wrap_Event_addBody}, + { "Event_addHeader", _wrap_Event_addHeader}, + { "Event_delHeader", _wrap_Event_delHeader}, + { "Event_fire", _wrap_Event_fire}, + { "EventConsumer_events_set", _wrap_EventConsumer_events_set}, + { "EventConsumer_events_get", _wrap_EventConsumer_events_get}, + { "EventConsumer_e_event_id_set", _wrap_EventConsumer_e_event_id_set}, + { "EventConsumer_e_event_id_get", _wrap_EventConsumer_e_event_id_get}, + { "EventConsumer_e_callback_set", _wrap_EventConsumer_e_callback_set}, + { "EventConsumer_e_callback_get", _wrap_EventConsumer_e_callback_get}, + { "EventConsumer_e_subclass_name_set", _wrap_EventConsumer_e_subclass_name_set}, + { "EventConsumer_e_subclass_name_get", _wrap_EventConsumer_e_subclass_name_get}, + { "EventConsumer_e_cb_arg_set", _wrap_EventConsumer_e_cb_arg_set}, + { "EventConsumer_e_cb_arg_get", _wrap_EventConsumer_e_cb_arg_get}, + { "EventConsumer_enodes_set", _wrap_EventConsumer_enodes_set}, + { "EventConsumer_enodes_get", _wrap_EventConsumer_enodes_get}, + { "EventConsumer_node_index_set", _wrap_EventConsumer_node_index_set}, + { "EventConsumer_node_index_get", _wrap_EventConsumer_node_index_get}, + { "new_EventConsumer", _wrap_new_EventConsumer}, + { "delete_EventConsumer", _wrap_delete_EventConsumer}, + { "EventConsumer_bind", _wrap_EventConsumer_bind}, + { "EventConsumer_pop", _wrap_EventConsumer_pop}, + { "delete_CoreSession", _wrap_delete_CoreSession}, + { "CoreSession_session_set", _wrap_CoreSession_session_set}, + { "CoreSession_session_get", _wrap_CoreSession_session_get}, + { "CoreSession_channel_set", _wrap_CoreSession_channel_set}, + { "CoreSession_channel_get", _wrap_CoreSession_channel_get}, + { "CoreSession_flags_set", _wrap_CoreSession_flags_set}, + { "CoreSession_flags_get", _wrap_CoreSession_flags_get}, + { "CoreSession_allocated_set", _wrap_CoreSession_allocated_set}, + { "CoreSession_allocated_get", _wrap_CoreSession_allocated_get}, + { "CoreSession_cb_state_set", _wrap_CoreSession_cb_state_set}, + { "CoreSession_cb_state_get", _wrap_CoreSession_cb_state_get}, + { "CoreSession_hook_state_set", _wrap_CoreSession_hook_state_set}, + { "CoreSession_hook_state_get", _wrap_CoreSession_hook_state_get}, + { "CoreSession_cause_set", _wrap_CoreSession_cause_set}, + { "CoreSession_cause_get", _wrap_CoreSession_cause_get}, + { "CoreSession_uuid_set", _wrap_CoreSession_uuid_set}, + { "CoreSession_uuid_get", _wrap_CoreSession_uuid_get}, + { "CoreSession_tts_name_set", _wrap_CoreSession_tts_name_set}, + { "CoreSession_tts_name_get", _wrap_CoreSession_tts_name_get}, + { "CoreSession_voice_name_set", _wrap_CoreSession_voice_name_set}, + { "CoreSession_voice_name_get", _wrap_CoreSession_voice_name_get}, + { "CoreSession_answer", _wrap_CoreSession_answer}, + { "CoreSession_preAnswer", _wrap_CoreSession_preAnswer}, + { "CoreSession_hangup", _wrap_CoreSession_hangup}, + { "CoreSession_hangupState", _wrap_CoreSession_hangupState}, + { "CoreSession_setVariable", _wrap_CoreSession_setVariable}, + { "CoreSession_setPrivate", _wrap_CoreSession_setPrivate}, + { "CoreSession_getPrivate", _wrap_CoreSession_getPrivate}, + { "CoreSession_getVariable", _wrap_CoreSession_getVariable}, + { "CoreSession_process_callback_result", _wrap_CoreSession_process_callback_result}, + { "CoreSession_say", _wrap_CoreSession_say}, + { "CoreSession_sayPhrase", _wrap_CoreSession_sayPhrase}, + { "CoreSession_hangupCause", _wrap_CoreSession_hangupCause}, + { "CoreSession_getState", _wrap_CoreSession_getState}, + { "CoreSession_recordFile", _wrap_CoreSession_recordFile}, + { "CoreSession_originate", _wrap_CoreSession_originate}, + { "CoreSession_destroy", _wrap_CoreSession_destroy}, + { "CoreSession_setDTMFCallback", _wrap_CoreSession_setDTMFCallback}, + { "CoreSession_speak", _wrap_CoreSession_speak}, + { "CoreSession_set_tts_parms", _wrap_CoreSession_set_tts_parms}, + { "CoreSession_collectDigits",_wrap_CoreSession_collectDigits}, + { "CoreSession_getDigits",_wrap_CoreSession_getDigits}, + { "CoreSession_transfer", _wrap_CoreSession_transfer}, + { "CoreSession_read", _wrap_CoreSession_read}, + { "CoreSession_playAndGetDigits", _wrap_CoreSession_playAndGetDigits}, + { "CoreSession_streamFile", _wrap_CoreSession_streamFile}, + { "CoreSession_sleep", _wrap_CoreSession_sleep}, + { "CoreSession_flushEvents", _wrap_CoreSession_flushEvents}, + { "CoreSession_flushDigits", _wrap_CoreSession_flushDigits}, + { "CoreSession_setAutoHangup", _wrap_CoreSession_setAutoHangup}, + { "CoreSession_setHangupHook", _wrap_CoreSession_setHangupHook}, + { "CoreSession_ready", _wrap_CoreSession_ready}, + { "CoreSession_bridged", _wrap_CoreSession_bridged}, + { "CoreSession_answered", _wrap_CoreSession_answered}, + { "CoreSession_mediaReady", _wrap_CoreSession_mediaReady}, + { "CoreSession_waitForAnswer", _wrap_CoreSession_waitForAnswer}, + { "CoreSession_execute", _wrap_CoreSession_execute}, + { "CoreSession_sendEvent", _wrap_CoreSession_sendEvent}, + { "CoreSession_setEventData", _wrap_CoreSession_setEventData}, + { "CoreSession_getXMLCDR", _wrap_CoreSession_getXMLCDR}, + { "CoreSession_begin_allow_threads", _wrap_CoreSession_begin_allow_threads}, + { "CoreSession_end_allow_threads", _wrap_CoreSession_end_allow_threads}, + { "CoreSession_get_uuid", _wrap_CoreSession_get_uuid}, + { "CoreSession_get_cb_args", _wrap_CoreSession_get_cb_args}, + { "CoreSession_check_hangup_hook", _wrap_CoreSession_check_hangup_hook}, + { "CoreSession_run_dtmf_callback", _wrap_CoreSession_run_dtmf_callback}, { "console_log", _wrap_console_log}, { "console_clean_log", _wrap_console_clean_log}, { "msleep", _wrap_msleep}, { "bridge", _wrap_bridge}, { "hanguphook", _wrap_hanguphook}, { "dtmf_callback", _wrap_dtmf_callback}, + { "new_Session",_wrap_new_Session}, + { "delete_Session", _wrap_delete_Session}, + { "Session_destroy", _wrap_Session_destroy}, + { "Session_begin_allow_threads", _wrap_Session_begin_allow_threads}, + { "Session_end_allow_threads", _wrap_Session_end_allow_threads}, + { "Session_check_hangup_hook", _wrap_Session_check_hangup_hook}, + { "Session_run_dtmf_callback", _wrap_Session_run_dtmf_callback}, + { "Session_unsetInputCallback", _wrap_Session_unsetInputCallback}, + { "Session_setInputCallback",_wrap_Session_setInputCallback}, + { "Session_setHangupHook",_wrap_Session_setHangupHook}, + { "Session_ready", _wrap_Session_ready}, + { "Session_originate", _wrap_Session_originate}, + { "Session_cb_function_set", _wrap_Session_cb_function_set}, + { "Session_cb_function_get", _wrap_Session_cb_function_get}, + { "Session_cb_arg_set", _wrap_Session_cb_arg_set}, + { "Session_cb_arg_get", _wrap_Session_cb_arg_get}, + { "Session_hangup_func_str_set", _wrap_Session_hangup_func_str_set}, + { "Session_hangup_func_str_get", _wrap_Session_hangup_func_str_get}, + { "Session_hangup_func_arg_set", _wrap_Session_hangup_func_arg_set}, + { "Session_hangup_func_arg_get", _wrap_Session_hangup_func_arg_get}, + { "Session_setLUA", _wrap_Session_setLUA}, + { "new_Dbh",_wrap_new_Dbh}, + { "delete_Dbh", _wrap_delete_Dbh}, + { "Dbh_release", _wrap_Dbh_release}, + { "Dbh_query", _wrap_Dbh_query}, {0,0} }; @@ -7260,9 +6039,10 @@ static swig_lua_const_info swig_constants[] = { /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */ -static void *_p_LUA__SessionTo_p_CoreSession(void *x, int *newmemory) { +static void *_p_LUA__SessionTo_p_CoreSession(void *x) { return (void *)((CoreSession *) ((LUA::Session *) x)); } +static swig_type_info _swigt__SWIGLUA_FN = {"_SWIGLUA_FN", "SWIGLUA_FN", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_API = {"_p_API", "API *", 0, 0, (void*)&_wrap_class_API, 0}; static swig_type_info _swigt__p_CoreSession = {"_p_CoreSession", "CoreSession *", 0, 0, (void*)&_wrap_class_CoreSession, 0}; static swig_type_info _swigt__p_DTMF = {"_p_DTMF", "DTMF *", 0, 0, (void*)&_wrap_class_DTMF, 0}; @@ -7271,9 +6051,8 @@ static swig_type_info _swigt__p_EventConsumer = {"_p_EventConsumer", "EventConsu static swig_type_info _swigt__p_IVRMenu = {"_p_IVRMenu", "IVRMenu *", 0, 0, (void*)&_wrap_class_IVRMenu, 0}; static swig_type_info _swigt__p_LUA__Dbh = {"_p_LUA__Dbh", "LUA::Dbh *", 0, 0, (void*)&_wrap_class_LUA_Dbh, 0}; static swig_type_info _swigt__p_LUA__Session = {"_p_LUA__Session", "LUA::Session *", 0, 0, (void*)&_wrap_class_LUA_Session, 0}; -static swig_type_info _swigt__p_SWIGLUA_FN = {"_p_SWIGLUA_FN", "SWIGLUA_FN *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_Stream = {"_p_Stream", "Stream *", 0, 0, (void*)&_wrap_class_Stream, 0}; -static swig_type_info _swigt__p_input_callback_state = {"_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void*)&_wrap_class_input_callback_state_t, 0}; +static swig_type_info _swigt__p_input_callback_state = {"_p_input_callback_state", "input_callback_state *", 0, 0, (void*)&_wrap_class_input_callback_state_t, 0}; static swig_type_info _swigt__p_lua_State = {"_p_lua_State", "lua_State *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_p_switch_event_node_t = {"_p_p_switch_event_node_t", "switch_event_node_t **", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_session_flag_t = {"_p_session_flag_t", "enum session_flag_t *|session_flag_t *", 0, 0, (void*)0, 0}; @@ -7292,8 +6071,15 @@ static swig_type_info _swigt__p_switch_status_t = {"_p_switch_status_t", "switch static swig_type_info _swigt__p_switch_stream_handle_t = {"_p_switch_stream_handle_t", "switch_stream_handle_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_uint32_t = {"_p_uint32_t", "uint32_t *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__switch_call_cause_t = {"_switch_call_cause_t", "switch_call_cause_t", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__switch_channel_state_t = {"_switch_channel_state_t", "switch_channel_state_t", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__switch_event_types_t = {"_switch_event_types_t", "switch_event_types_t", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__switch_input_type_t = {"_switch_input_type_t", "switch_input_type_t", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__switch_priority_t = {"_switch_priority_t", "switch_priority_t", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__uint32_t = {"_uint32_t", "uint32_t", 0, 0, (void*)0, 0}; static swig_type_info *swig_type_initial[] = { + &_swigt__SWIGLUA_FN, &_swigt__p_API, &_swigt__p_CoreSession, &_swigt__p_DTMF, @@ -7302,7 +6088,6 @@ static swig_type_info *swig_type_initial[] = { &_swigt__p_IVRMenu, &_swigt__p_LUA__Dbh, &_swigt__p_LUA__Session, - &_swigt__p_SWIGLUA_FN, &_swigt__p_Stream, &_swigt__p_input_callback_state, &_swigt__p_lua_State, @@ -7323,8 +6108,15 @@ static swig_type_info *swig_type_initial[] = { &_swigt__p_switch_stream_handle_t, &_swigt__p_uint32_t, &_swigt__p_void, + &_swigt__switch_call_cause_t, + &_swigt__switch_channel_state_t, + &_swigt__switch_event_types_t, + &_swigt__switch_input_type_t, + &_swigt__switch_priority_t, + &_swigt__uint32_t, }; +static swig_cast_info _swigc__SWIGLUA_FN[] = { {&_swigt__SWIGLUA_FN, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_API[] = { {&_swigt__p_API, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_CoreSession[] = { {&_swigt__p_CoreSession, 0, 0, 0}, {&_swigt__p_LUA__Session, _p_LUA__SessionTo_p_CoreSession, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_DTMF[] = { {&_swigt__p_DTMF, 0, 0, 0},{0, 0, 0, 0}}; @@ -7333,7 +6125,6 @@ static swig_cast_info _swigc__p_EventConsumer[] = { {&_swigt__p_EventConsumer, static swig_cast_info _swigc__p_IVRMenu[] = { {&_swigt__p_IVRMenu, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_LUA__Dbh[] = { {&_swigt__p_LUA__Dbh, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_LUA__Session[] = { {&_swigt__p_LUA__Session, 0, 0, 0},{0, 0, 0, 0}}; -static swig_cast_info _swigc__p_SWIGLUA_FN[] = { {&_swigt__p_SWIGLUA_FN, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_Stream[] = { {&_swigt__p_Stream, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_input_callback_state[] = { {&_swigt__p_input_callback_state, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_lua_State[] = { {&_swigt__p_lua_State, 0, 0, 0},{0, 0, 0, 0}}; @@ -7354,8 +6145,15 @@ static swig_cast_info _swigc__p_switch_status_t[] = { {&_swigt__p_switch_status static swig_cast_info _swigc__p_switch_stream_handle_t[] = { {&_swigt__p_switch_stream_handle_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_uint32_t[] = { {&_swigt__p_uint32_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_void[] = { {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__switch_call_cause_t[] = { {&_swigt__switch_call_cause_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__switch_channel_state_t[] = { {&_swigt__switch_channel_state_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__switch_event_types_t[] = { {&_swigt__switch_event_types_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__switch_input_type_t[] = { {&_swigt__switch_input_type_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__switch_priority_t[] = { {&_swigt__switch_priority_t, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__uint32_t[] = { {&_swigt__uint32_t, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info *swig_cast_initial[] = { + _swigc__SWIGLUA_FN, _swigc__p_API, _swigc__p_CoreSession, _swigc__p_DTMF, @@ -7364,7 +6162,6 @@ static swig_cast_info *swig_cast_initial[] = { _swigc__p_IVRMenu, _swigc__p_LUA__Dbh, _swigc__p_LUA__Session, - _swigc__p_SWIGLUA_FN, _swigc__p_Stream, _swigc__p_input_callback_state, _swigc__p_lua_State, @@ -7385,6 +6182,12 @@ static swig_cast_info *swig_cast_initial[] = { _swigc__p_switch_stream_handle_t, _swigc__p_uint32_t, _swigc__p_void, + _swigc__switch_call_cause_t, + _swigc__switch_channel_state_t, + _swigc__switch_event_types_t, + _swigc__switch_input_type_t, + _swigc__switch_priority_t, + _swigc__uint32_t, }; @@ -7404,7 +6207,7 @@ static swig_cast_info *swig_cast_initial[] = { * structures together. * * The generated swig_type_info structures are assigned staticly to an initial - * array. We just loop through that array, and handle each type individually. + * array. We just loop though that array, and handle each type individually. * First we lookup if this type has been already loaded, and if so, use the * loaded structure instead of the generated one. Then we have to fill in the * cast linked list. The cast data is initially stored in something like a @@ -7442,58 +6245,32 @@ extern "C" { #define SWIGRUNTIME_DEBUG #endif - SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { size_t i; - swig_module_info *module_head, *iter; - int found, init; + swig_module_info *module_head; + static int init_run = 0; clientdata = clientdata; - /* check to see if the circular list has been setup, if not, set it up */ - if (swig_module.next==0) { - /* Initialize the swig_module */ - swig_module.type_initial = swig_type_initial; - swig_module.cast_initial = swig_cast_initial; - swig_module.next = &swig_module; - init = 1; - } else { - init = 0; - } + if (init_run) return; + init_run = 1; + + /* Initialize the swig_module */ + swig_module.type_initial = swig_type_initial; + swig_module.cast_initial = swig_cast_initial; /* Try and load any already created modules */ module_head = SWIG_GetModule(clientdata); - if (!module_head) { - /* This is the first module loaded for this interpreter */ - /* so set the swig module into the interpreter */ - SWIG_SetModule(clientdata, &swig_module); - module_head = &swig_module; - } else { - /* the interpreter has loaded a SWIG module, but has it loaded this one? */ - found=0; - iter=module_head; - do { - if (iter==&swig_module) { - found=1; - break; - } - iter=iter->next; - } while (iter!= module_head); - - /* if the is found in the list, then all is done and we may leave */ - if (found) return; - /* otherwise we must add out module into the list */ + if (module_head) { swig_module.next = module_head->next; module_head->next = &swig_module; + } else { + /* This is the first module loaded */ + swig_module.next = &swig_module; + SWIG_SetModule(clientdata, &swig_module); } - - /* When multiple interpeters are used, a module could have already been initialized in - a different interpreter, but not yet have a pointer in this interpreter. - In this case, we do not want to continue adding types... everything should be - set up already */ - if (init == 0) return; - + /* Now work on filling in swig_module.types */ #ifdef SWIGRUNTIME_DEBUG printf("SWIG_InitializeModule: size %d\n", swig_module.size); @@ -7630,56 +6407,73 @@ SWIG_PropagateClientData(void) { /* Forward declaration of where the user's %init{} gets inserted */ -void SWIG_init_user(lua_State* L ); - #ifdef __cplusplus extern "C" { #endif +void SWIG_init_user(lua_State* L ); + /* this is the initialization function - added at the very end of the code - the function is always called SWIG_init, but an eariler #define will rename it + added at the very end of the code + the function is always called SWIG_init, but an eariler #define will rename it */ SWIGEXPORT int SWIG_init(lua_State* L) { - int i; - /* start with global table */ - lua_pushvalue(L,LUA_GLOBALSINDEX); - /* SWIG's internal initalisation */ - SWIG_InitializeModule((void*)L); - SWIG_PropagateClientData(); - /* add a global fn */ - SWIG_Lua_add_function(L,"swig_type",SWIG_Lua_type); - SWIG_Lua_add_function(L,"swig_equals",SWIG_Lua_equal); - /* begin the module (its a table with the same name as the module) */ - SWIG_Lua_module_begin(L,SWIG_name); - /* add commands/functions */ - for (i = 0; swig_commands[i].name; i++){ - SWIG_Lua_module_add_function(L,swig_commands[i].name,swig_commands[i].func); - } - /* add variables */ - for (i = 0; swig_variables[i].name; i++){ - SWIG_Lua_module_add_variable(L,swig_variables[i].name,swig_variables[i].get,swig_variables[i].set); - } - /* set up base class pointers (the hierachy) */ - for (i = 0; swig_types[i]; i++){ - if (swig_types[i]->clientdata){ - SWIG_Lua_init_base_class(L,(swig_lua_class*)(swig_types[i]->clientdata)); - } - } - /* additional registration structs & classes in lua */ - for (i = 0; swig_types[i]; i++){ - if (swig_types[i]->clientdata){ - SWIG_Lua_class_register(L,(swig_lua_class*)(swig_types[i]->clientdata)); - } - } - /* constants */ - SWIG_Lua_InstallConstants(L,swig_constants); - /* invoke user-specific initialization */ - SWIG_init_user(L); - /* end module */ - lua_pop(L,1); /* tidy stack (remove module table)*/ - lua_pop(L,1); /* tidy stack (remove global table)*/ - return 1; + int i; + + /* start with global table */ + lua_pushvalue(L,LUA_GLOBALSINDEX); + + SWIG_InitializeModule((void*)L); + SWIG_PropagateClientData(); + + /* invoke user-specific initialization */ + SWIG_init_user(L); + + /* add a global fn */ + SWIG_Lua_add_function(L,"swig_type",SWIG_Lua_type); + SWIG_Lua_add_function(L,"swig_equals",SWIG_Lua_equal); + + /* begin the module (its a table with the same name as the module) */ + SWIG_Lua_module_begin(L,SWIG_name); + /* add commands/functions */ + for (i = 0; swig_commands[i].name; i++){ + SWIG_Lua_module_add_function(L,swig_commands[i].name,swig_commands[i].func); + } + /*luaL_openlib(L,NULL,swig_commands,0);*/ + /* all in one */ + /*luaL_openlib(L,SWIG_name,swig_commands,0);*/ + /* add variables */ + for (i = 0; swig_variables[i].name; i++){ + SWIG_Lua_module_add_variable(L,swig_variables[i].name,swig_variables[i].get,swig_variables[i].set); + } + + /* additional registration structs & classes in lua: */ + for (i = 0; swig_types[i]; i++){ + if (swig_types[i]->clientdata){ + SWIG_Lua_class_register(L,(swig_lua_class*)(swig_types[i]->clientdata)); + } + } + + /* constants */ + SWIG_Lua_InstallConstants(L,swig_constants); + + /* end module */ + /*SWIG_Lua_module_end(L);*/ + lua_pop(L,1); /* tidy stack (remove module table)*/ + lua_pop(L,1); /* tidy stack (remove global table)*/ + + return 1; +} + +/* Lua 5.1 has a different name for importing libraries +luaopen_XXX, where XXX is the name of the module (not capitalised) +this function will allow Lua 5.1 to import correctly. +There is a #define in the wrapper to rename 'SWIG_import' to the correct name +*/ + +SWIGEXPORT int SWIG_import(lua_State* L) +{ + return SWIG_init(L); } #ifdef __cplusplus @@ -7687,13 +6481,12 @@ SWIGEXPORT int SWIG_init(lua_State* L) #endif -const char* SWIG_LUACODE= - ""; - +#ifdef __cplusplus +extern "C" +#endif void SWIG_init_user(lua_State* L) { - /* exec Lua code if applicable */ - SWIG_Lua_dostring(L,SWIG_LUACODE); + } #include "mod_lua_extra.c" commit 53d00f6947129979b0515e1d3e6850c55a041715 Author: Konrad Hammel <konrad@sangoma.com> Date: Thu Sep 9 18:19:49 2010 -0400 freetdm: ss7 - bug fix diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index 0286563..a76b82a 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -1715,6 +1715,7 @@ ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ /* loop over the cics starting from circuit until range+1 */ for (x = circuit; x < (circuit + range + 1); x++) { + if (g_ftdm_sngss7_data.cfg.isupCkt[x].type != VOICE) continue; /* grab the circuit in question */ if (extract_chan_data(x, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", x); @@ -2057,6 +2058,7 @@ ftdm_status_t handle_cgb_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ /* loop over the cics starting from circuit until range+1 */ for (x = circuit; x < (circuit + range + 1); x++) { + if (g_ftdm_sngss7_data.cfg.isupCkt[x].type != VOICE) continue; /* grab the circuit in question */ if (extract_chan_data(x, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", x); @@ -2191,6 +2193,7 @@ ftdm_status_t handle_cgu_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ /* loop over the cics starting from circuit until range+1 */ for (x = circuit; x < (circuit + range + 1); x++) { + if (g_ftdm_sngss7_data.cfg.isupCkt[x].type != VOICE) continue; /* grab the circuit in question */ if (extract_chan_data(x, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", x); commit c4324d5af4a5ca8fafe34879dbf7af04325f1143 Author: Konrad Hammel <konrad@sangoma.com> Date: Thu Sep 9 17:31:27 2010 -0400 freetdm: ss7 - bug fixes in configuration diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c index 4476429..93bd315 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c @@ -213,7 +213,7 @@ int ft_to_sngss7_cfg_all(void) SS7_CRITICAL("MTP3 ROUTE %d configuration FAILED!\n", x); SS7_ASSERT } else { - SS7_INFO("MTP3 ROUTE %d configuration DONE!\n"); + SS7_INFO("MTP3 ROUTE %d configuration DONE!\n",x); } /* set the CONFIGURED flag */ @@ -229,7 +229,7 @@ int ft_to_sngss7_cfg_all(void) SS7_CRITICAL("MTP3 ROUTE 0 configuration FAILED!\n"); SS7_ASSERT } else { - SS7_INFO("MTP3 ROUTE %d configuration DONE!\n"); + SS7_INFO("MTP3 ROUTE 0 configuration DONE!\n"); } /* set the CONFIGURED flag */ @@ -925,7 +925,6 @@ int ftmod_ss7_mtp3_linkset_config(int id) { Pst pst; SnMngmt cfg; - U16 c; sng_link_set_t *k = &g_ftdm_sngss7_data.cfg.mtpLinkSet[id]; /* initalize the post structure */ @@ -953,10 +952,9 @@ int ftmod_ss7_mtp3_linkset_config(int id) cfg.t.cfg.s.snLnkSet.adjDpc = k->apc; /* adjacent DPC */ cfg.t.cfg.s.snLnkSet.nmbActLnkReqd = k->minActive; /* minimum number of active links */ cfg.t.cfg.s.snLnkSet.nmbCmbLnkSet = 1; /* number of combined link sets */ - for (c = 0; c < LSN_MAXCMBLNK; c++) { - cfg.t.cfg.s.snLnkSet.cmbLnkSet[c].cmbLnkSetId = c+1; - cfg.t.cfg.s.snLnkSet.cmbLnkSet[c].lnkSetPrior = 0; - } + cfg.t.cfg.s.snLnkSet.cmbLnkSet[0].cmbLnkSetId = k->cmbLinkSetId; + cfg.t.cfg.s.snLnkSet.cmbLnkSet[0].lnkSetPrior = 0; + return(sng_cfg_mtp3(&pst, &cfg)); } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index bab1c8b..f76a560 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -162,6 +162,7 @@ typedef struct sng_link_set { uint32_t flags; uint32_t apc; uint32_t linkType; + uint32_t cmbLinkSetId; uint32_t minActive; uint32_t numLinks; uint32_t links[16]; @@ -176,6 +177,7 @@ typedef struct sng_route { uint32_t linkType; uint32_t switchType; uint32_t ssf; + uint32_t nwId; uint32_t isSTP; uint32_t t6; uint32_t t8; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c index f6d04ed..66907e7 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c @@ -343,11 +343,11 @@ static int ftmod_ss7_parse_mtp_linkset(ftdm_conf_node_t *mtp_linkset) /**********************************************************************/ } else if (!strcasecmp(parm->var, "apc")) { mtpLinkSet.apc = atoi(parm->val); - SS7_DEBUG("\tFoundmtpLinkSet->apc = %d\n", mtpLinkSet.apc); + SS7_DEBUG("\tFound mtpLinkSet->apc = %d\n", mtpLinkSet.apc); /**********************************************************************/ } else if (!strcasecmp(parm->var, "minActive")) { mtpLinkSet.minActive = atoi(parm->val); - SS7_DEBUG("\tFoundmtpLinkSet->minActive = %d\n", mtpLinkSet.minActive); + SS7_DEBUG("\tFound mtpLinkSet->minActive = %d\n", mtpLinkSet.minActive); /**********************************************************************/ } else { SS7_ERROR("\tFound an invalid parameter \"%s\"!\n", parm->val); @@ -497,27 +497,27 @@ static int ftmod_ss7_parse_mtp_link(ftdm_conf_node_t *mtp_link, sng_mtp_link_t * if (!strcasecmp(parm->val, "itu92")) { mtpLink->mtp2.linkType = LSD_SW_ITU92; mtpLink->mtp3.linkType = LSN_SW_ITU; - SS7_DEBUG("\tFoundmtpLink->linkType = \"ITU92\"\n"); + SS7_DEBUG("\tFound mtpLink->linkType = \"ITU92\"\n"); } else if (!strcasecmp(parm->val, "itu88")) { mtpLink->mtp2.linkType = LSD_SW_ITU88; mtpLink->mtp3.linkType = LSN_SW_ITU; - SS7_DEBUG("\tFoundmtpLink->linkType = \"ITU88\"\n"); + SS7_DEBUG("\tFound mtpLink->linkType = \"ITU88\"\n"); } else if (!strcasecmp(parm->val, "ansi96")) { mtpLink->mtp2.linkType = LSD_SW_ANSI92; mtpLink->mtp3.linkType = LSN_SW_ANS96; - SS7_DEBUG("\tFoundmtpLink->linkType = \"ANSI96\"\n"); + SS7_DEBUG("\tFound mtpLink->linkType = \"ANSI96\"\n"); } else if (!strcasecmp(parm->val, "ansi92")) { mtpLink->mtp2.linkType = LSD_SW_ANSI92; mtpLink->mtp3.linkType = LSN_SW_ANS; - SS7_DEBUG("\tFoundmtpLink->linkType = \"ANSI92\"\n"); + SS7_DEBUG("\tFound mtpLink->linkType = \"ANSI92\"\n"); } else if (!strcasecmp(parm->val, "ansi88")) { mtpLink->mtp2.linkType = LSD_SW_ANSI88; mtpLink->mtp3.linkType = LSN_SW_ANS; - SS7_DEBUG("\tFoundmtpLink->linkType = \"ANSI88\"\n"); + SS7_DEBUG("\tFound mtpLink->linkType = \"ANSI88\"\n"); } else if (!strcasecmp(parm->val, "etsi")) { mtpLink->mtp2.linkType = LSD_SW_ITU92; mtpLink->mtp3.linkType = LSN_SW_ITU; - SS7_DEBUG("\tFoundmtpLink->linkType = \"ETSI\"\n"); + SS7_DEBUG("\tFound mtpLink->linkType = \"ETSI\"\n"); } else { SS7_ERROR("\tFound an invalid linktype of \"%s\"!\n", parm->val); return FTDM_FAIL; @@ -526,40 +526,40 @@ static int ftmod_ss7_parse_mtp_link(ftdm_conf_node_t *mtp_link, sng_mtp_link_t * } else if (!strcasecmp(parm->var, "switchType")) { if (!strcasecmp(parm->val, "itu97")) { mtpLink->mtp3.switchType = LSI_SW_ITU97; - SS7_DEBUG("\tFoundmtpLink->switchType = \"ITU97\"\n"); + SS7_DEBUG("\tFound mtpLink->switchType = \"ITU97\"\n"); } else if (!strcasecmp(parm->val, "itu88")) { mtpLink->mtp3.switchType = LSI_SW_ITU; - SS7_DEBUG("\tFoundmtpLink->switchType = \"ITU88\"\n"); + SS7_DEBUG("\tFound mtpLink->switchType = \"ITU88\"\n"); } else if (!strcasecmp(parm->val, "itu92")) { mtpLink->mtp3.switchType = LSI_SW_ITU; - SS7_DEBUG("\tFoundmtpLink->switchType = \"ITU92\"\n"); + SS7_DEBUG("\tFound mtpLink->switchType = \"ITU92\"\n"); } else if (!strcasecmp(parm->val, "itu00")) { mtpLink->mtp3.switchType = LSI_SW_ITU2000; - SS7_DEBUG("\tFoundmtpLink->switchType = \"ITU00\"\n"); + SS7_DEBUG("\tFound mtpLink->switchType = \"ITU00\"\n"); } else if (!strcasecmp(parm->val, "ETSIV2")) { mtpLink->mtp3.switchType = LSI_SW_ETSI; - SS7_DEBUG("\tFoundmtpLink->switchType = \"ETSIV2\"\n"); + SS7_DEBUG("\tFound mtpLink->switchType = \"ETSIV2\"\n"); } else if (!strcasecmp(parm->val, "ETSIV3")) { mtpLink->mtp3.switchType = LSI_SW_ETSIV3; - SS7_DEBUG("\tFoundmtpLink->switchType = \"ETSIV3\"\n"); + SS7_DEBUG("\tFound mtpLink->switchType = \"ETSIV3\"\n"); } else if (!strcasecmp(parm->val, "UK")) { mtpLink->mtp3.switchType = LSI_SW_UK; - SS7_DEBUG("\tFoundmtpLink->switchType = \"UK\"\n"); + SS7_DEBUG("\tFound mtpLink->switchType = \"UK\"\n"); } else if (!strcasecmp(parm->val, "RUSSIA")) { mtpLink->mtp3.switchType = LSI_SW_RUSSIA; - SS7_DEBUG("\tFoundmtpLink->switchType = \"RUSSIA\"\n"); + SS7_DEBUG("\tFound mtpLink->switchType = \"RUSSIA\"\n"); } else if (!strcasecmp(parm->val, "INDIA")) { mtpLink->mtp3.switchType = LSI_SW_INDIA; - SS7_DEBUG("\tFoundmtpLink->switchType = \"INDIA\"\n"); + SS7_DEBUG("\tFound mtpLink->switchType = \"INDIA\"\n"); } else if (!strcasecmp(parm->val, "ansi88")) { mtpLink->mtp3.switchType = LSI_SW_ANS88; - SS7_DEBUG("\tFoundmtpLink->switchType = \"ANSI88\"\n"); + SS7_DEBUG("\tFound mtpLink->switchType = \"ANSI88\"\n"); } else if (!strcasecmp(parm->val, "ansi92")) { mtpLink->mtp3.switchType = LSI_SW_ANS92; - SS7_DEBUG("\tFoundmtpLink->switchType = \"ANSI92\"\n"); + SS7_DEBUG("\tFound mtpLink->switchType = \"ANSI92\"\n"); } else if (!strcasecmp(parm->val, "ansi95")) { mtpLink->mtp3.switchType = LSI_SW_ANS95; - SS7_DEBUG("\tFoundmtpLink->switchType = \"ANSI95\"\n"); + SS7_DEBUG("\tFound mtpLink->switchType = \"ANSI95\"\n"); } else { SS7_ERROR("\tFound an invalid linktype of \"%s\"!\n", parm->val); return FTDM_FAIL; @@ -577,7 +577,7 @@ static int ftmod_ss7_parse_mtp_link(ftdm_conf_node_t *mtp_link, sng_mtp_link_t * /**********************************************************************/ } else if (!strcasecmp(parm->var, "slc")) { mtpLink->mtp3.slc = atoi(parm->val); - SS7_DEBUG("\tFoundmtpLink->slc = \"%d\"\n",mtpLink->mtp3.slc); + SS7_DEBUG("\tFound mtpLink->slc = \"%d\"\n",mtpLink->mtp3.slc); /**********************************************************************/ } else { SS7_ERROR("\tFound an invalid parameter \"%s\"!\n", parm->val); @@ -665,7 +665,7 @@ static int ftmod_ss7_parse_mtp_route(ftdm_conf_node_t *mtp_route) mtpRoute.linkType = g_ftdm_sngss7_data.cfg.mtpLink[id].mtp3.linkType; mtpRoute.switchType = g_ftdm_sngss7_data.cfg.mtpLink[id].mtp3.switchType; mtpRoute.ssf = g_ftdm_sngss7_data.cfg.mtpLink[id].mtp3.ssf; - mtpRoute.cmbLinkSetId = g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id; + mtpRoute.cmbLinkSetId = g_ftdm_sngss7_data.cfg.mtpLinkSet[x].cmbLinkSetId; break; } x++; @@ -781,36 +781,25 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface) /* check if the name matches */ if (!strcasecmp((char *)g_ftdm_sngss7_data.cfg.mtpRoute[x].name, parm->val)) { - /* now, harvest the required information from the global structure */ sng_isup.mtpRouteId = g_ftdm_sngss7_data.cfg.mtpRoute[x].id; sng_isup.dpc = g_ftdm_sngss7_data.cfg.mtpRoute[x].dpc; sng_isup.switchType = g_ftdm_sngss7_data.cfg.mtpRoute[x].switchType; sng_isap.switchType = g_ftdm_sngss7_data.cfg.mtpRoute[x].switchType; - /* find the nwID from the nsap */ - int y = 1; - while (g_ftdm_sngss7_data.cfg.nsap[y].id != 0) { - - if ((g_ftdm_sngss7_data.cfg.nsap[y].linkType == g_ftdm_sngss7_data.cfg.mtpRoute[x].linkType) && - (g_ftdm_sngss7_data.cfg.nsap[y].switchType == g_ftdm_sngss7_data.cfg.mtpRoute[x].switchType) && - (g_ftdm_sngss7_data.cfg.nsap[y].ssf == g_ftdm_sngss7_data.cfg.mtpRoute[x].ssf)) { - + /* find the NSAP corresponding to this switchType and SSF */ + int z = 1; + while (g_ftdm_sngss7_data.cfg.nsap[z].id != 0) { + if ((g_ftdm_sngss7_data.cfg.nsap[z].linkType == g_ftdm_sngss7_data.cfg.mtpRoute[x].linkType) && + (g_ftdm_sngss7_data.cfg.nsap[z].switchType == g_ftdm_sngss7_data.cfg.mtpRoute[x].switchType) && + (g_ftdm_sngss7_data.cfg.nsap[z].ssf == g_ftdm_sngss7_data.cfg.mtpRoute[x].ssf)) { + sng_isup.nwId = g_ftdm_sngss7_data.cfg.nsap[z].nwId; /* we have a match so break out of this loop */ break; } /* move on to the next one */ - y++; - } /* while (g_ftdm_sngss7_data.cfg.mtp3_isup[y].id != 0) */ - - /* check how we exited the last while loop */ - if (g_ftdm_sngss7_data.cfg.nsap[y].id == 0) { - SS7_ERROR("\tFailed to find the nwID for = \"%s\"!\n", parm->val); - return FTDM_FAIL; - } else { - sng_isup.nwId = g_ftdm_sngss7_data.cfg.nsap[y].nwId; + z++; } - break; } x++; @@ -867,8 +856,6 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface) ftmod_ss7_fill_in_isup_interface(&sng_isup); - g_ftdm_sngss7_data.cfg.isap[sng_isap.id].spId = sng_isup.id; - return FTDM_SUCCESS; } @@ -1074,6 +1061,7 @@ static int ftmod_ss7_fill_in_mtpLinkSet(sng_link_set_t *mtpLinkSet) g_ftdm_sngss7_data.cfg.mtpLinkSet[i].id = mtpLinkSet->id; g_ftdm_sngss7_data.cfg.mtpLinkSet[i].apc = mtpLinkSet->apc; g_ftdm_sngss7_data.cfg.mtpLinkSet[i].linkType = g_ftdm_sngss7_data.cfg.mtpLink[1].mtp3.linkType; /* KONRAD FIX ME */ + g_ftdm_sngss7_data.cfg.mtpLinkSet[i].cmbLinkSetId = mtpLinkSet->id; g_ftdm_sngss7_data.cfg.mtpLinkSet[i].minActive = mtpLinkSet->minActive; g_ftdm_sngss7_data.cfg.mtpLinkSet[i].numLinks = mtpLinkSet->numLinks; @@ -1092,8 +1080,7 @@ static int ftmod_ss7_fill_in_mtp3_route(sng_route_t *mtp3_route) /* go through all the existing routes and see if we find a match */ i = 1; while (g_ftdm_sngss7_data.cfg.mtpRoute[i].id != 0) { - if (g_ftdm_sngss7_data.cfg.mtpRoute[i].dpc == mtp3_route->dpc) { - + if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtpRoute[i].name, mtp3_route->name)) { /* we have a match so break out of this loop */ break; } @@ -1115,7 +1102,7 @@ static int ftmod_ss7_fill_in_mtp3_route(sng_route_t *mtp3_route) g_ftdm_sngss7_data.cfg.mtpRoute[i].dpc = mtp3_route->dpc; g_ftdm_sngss7_data.cfg.mtpRoute[i].linkType = mtp3_route->linkType; g_ftdm_sngss7_data.cfg.mtpRoute[i].switchType = mtp3_route->switchType; - g_ftdm_sngss7_data.cfg.mtpRoute[i].cmbLinkSetId = 1; /* mtp3_route->cmbLinkSetId;*/ + g_ftdm_sngss7_data.cfg.mtpRoute[i].cmbLinkSetId = mtp3_route->cmbLinkSetId; g_ftdm_sngss7_data.cfg.mtpRoute[i].isSTP = mtp3_route->isSTP; g_ftdm_sngss7_data.cfg.mtpRoute[i].ssf = mtp3_route->ssf; if (mtp3_route->t6 != 0) { @@ -1222,7 +1209,7 @@ static int ftmod_ss7_fill_in_isup_interface(sng_isup_inf_t *sng_isup) /* go through all the existing interfaces and see if we find a match */ i = 1; while (g_ftdm_sngss7_data.cfg.isupIntf[i].id != 0) { - if (g_ftdm_sngss7_data.cfg.isupIntf[i].nwId == sng_isup->nwId) { + if (!strcasecmp(g_ftdm_sngss7_data.cfg.isupIntf[i].name, sng_isup->name)) { /* we have a match so break out of this loop */ break; @@ -1395,7 +1382,8 @@ static int ftmod_ss7_fill_in_isap(sng_isap_t *sng_isap) } g_ftdm_sngss7_data.cfg.isap[i].id = sng_isap->id; - g_ftdm_sngss7_data.cfg.isap[i].suId = 1; /*KONRAD FIX ME */ + g_ftdm_sngss7_data.cfg.isap[i].suId = sng_isap->id; + g_ftdm_sngss7_data.cfg.isap[i].spId = sng_isap->id; g_ftdm_sngss7_data.cfg.isap[i].switchType = sng_isap->switchType; g_ftdm_sngss7_data.cfg.isap[i].ssf = sng_isap->ssf; @@ -1513,7 +1501,9 @@ static int ftmod_ss7_fill_in_self_route(int spc, int linkType, int switchType, i SS7_DEBUG("found existing mtp3 self route\n"); return FTDM_SUCCESS; } else { - SS7_ERROR("found new mtp3 self route but it does not much the route already configured\n"); + SS7_ERROR("found new mtp3 self route but it does not match the route already configured (dpc=%d:spc=%d)\n", + g_ftdm_sngss7_data.cfg.mtpRoute[0].dpc, + spc); return FTDM_FAIL; } commit e7fecd0ff9bf86fe0cbf8bfd7878cf40337d3be5 Author: Moises Silva <moy@sangoma.com> Date: Thu Sep 9 17:22:10 2010 -0400 freetdm: fix config to allow both sangoma pri and bri spans to be configured diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index fb85b35..b911155 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -2371,6 +2371,121 @@ static int add_profile_parameters(switch_xml_t cfg, const char *profname, ftdm_c return paramindex; } +static void parse_bri_pri_spans(switch_xml_t cfg, switch_xml_t spans) +{ + switch_xml_t myspan, param; + + for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) { + ftdm_status_t zstatus = FTDM_FAIL; + const char *context = "default"; + const char *dialplan = "XML"; + ftdm_conf_parameter_t spanparameters[30]; + char *id = (char *) switch_xml_attr(myspan, "id"); + char *name = (char *) switch_xml_attr(myspan, "name"); + char *configname = (char *) switch_xml_attr(myspan, "cfgprofile"); + ftdm_span_t *span = NULL; + uint32_t span_id = 0; + unsigned paramindex = 0; + + if (!name && !id) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "sangoma isdn span missing required attribute 'id' or 'name', skipping ...\n"); + continue; + } + + if (name) { + zstatus = ftdm_span_find_by_name(name, &span); + } else { + if (switch_is_number(id)) { + span_id = atoi(id); + zstatus = ftdm_span_find(span_id, &span); + } + + if (zstatus != FTDM_SUCCESS) { + zstatus = ftdm_span_find_by_name(id, &span); + } + } + + if (zstatus != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_ERROR, "Error finding FreeTDM span id:%s name:%s\n", switch_str_nil(id), switch_str_nil(name)); + continue; + } + + if (!span_id) { + span_id = ftdm_span_get_id(span); + } + + memset(spanparameters, 0, sizeof(spanparameters)); + paramindex = 0; + + if (configname) { + paramindex = add_profile_parameters(cfg, configname, spanparameters, ftdm_array_len(spanparameters)); + if (paramindex) { + ftdm_log(FTDM_LOG_DEBUG, "Added %d parameters from profile %s for span %d\n", paramindex, configname, span_id); + } + } + + /* some defaults first */ + SPAN_CONFIG[span_id].limit_backend = "hash"; + SPAN_CONFIG[span_id].limit_reset_event = FTDM_LIMIT_RESET_ON_TIMEOUT; + + for (param = switch_xml_child(myspan, "param"); param; param = param->next) { + char *var = (char *) switch_xml_attr_soft(param, "name"); + char *val = (char *) switch_xml_attr_soft(param, "value"); + + if (ftdm_array_len(spanparameters) == paramindex) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Too many parameters for ss7 span, ignoring any parameter after %s\n", var); + break; + } + + if (!strcasecmp(var, "context")) { + context = val; + } else if (!strcasecmp(var, "dialplan")) { + dialplan = val; + } else if (!strcasecmp(var, "call_limit_backend")) { + SPAN_CONFIG[span_id].limit_backend = val; + ftdm_log(FTDM_LOG_DEBUG, "Using limit backend %s for span %d\n", SPAN_CONFIG[span_id].limit_backend, span_id); + } else if (!strcasecmp(var, "call_limit_rate")) { + int calls; + int seconds; + if (sscanf(val, "%d/%d", &calls, &seconds) != 2) { + ftdm_log(FTDM_LOG_ERROR, "Invalid %s parameter, format example: 3/1 for 3 calls per second\n", var); + } else { + if (calls < 1 || seconds < 1) { + ftdm_log(FTDM_LOG_ERROR, "Invalid %s parameter value, minimum call limit must be 1 per second\n", var); + } else { + SPAN_CONFIG[span_id].limit_calls = calls; + SPAN_CONFIG[span_id].limit_seconds = seconds; + } + } + } else if (!strcasecmp(var, "call_limit_reset_event")) { + if (!strcasecmp(val, "answer")) { + SPAN_CONFIG[span_id].limit_reset_event = FTDM_LIMIT_RESET_ON_ANSWER; + } else { + ftdm_log(FTDM_LOG_ERROR, "Invalid %s parameter value, only accepted event is 'answer'\n", var); + } + } else { + spanparameters[paramindex].var = var; + spanparameters[paramindex].val = val; + paramindex++; + } + } + + if (ftdm_configure_span_signaling(span, + "sangoma_isdn", + on_clear_channel_signal, + spanparameters) != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_ERROR, "Error configuring Sangoma ISDN FreeTDM span %d\n", span_id); + continue; + } + SPAN_CONFIG[span_id].span = span; + switch_copy_string(SPAN_CONFIG[span_id].context, context, sizeof(SPAN_CONFIG[span_id].context)); + switch_copy_string(SPAN_CONFIG[span_id].dialplan, dialplan, sizeof(SPAN_CONFIG[span_id].dialplan)); + switch_copy_string(SPAN_CONFIG[span_id].type, "Sangoma (ISDN)", sizeof(SPAN_CONFIG[span_id].type)); + ftdm_log(FTDM_LOG_DEBUG, "Configured Sangoma ISDN FreeTDM span %d\n", span_id); + ftdm_span_start(span); + } +} + static switch_status_t load_config(void) { const char *cf = "freetdm.conf"; @@ -2410,116 +2525,12 @@ static switch_status_t load_config(void) } } - if ((spans = switch_xml_child(cfg, "sangoma_pri_spans")) || (spans = switch_xml_child(cfg, "sangoma_bri_spans"))) { - for (myspan = switch_xml_child(spans, "span"); myspan; myspan = myspan->next) { - ftdm_status_t zstatus = FTDM_FAIL; - const char *context = "default"; - const char *dialplan = "XML"; - ftdm_conf_parameter_t spanparameters[30]; - char *id = (char *) switch_xml_attr(myspan, "id"); - char *name = (char *) switch_xml_attr(myspan, "name"); - char *configname = (char *) switch_xml_attr(myspan, "cfgprofile"); - ftdm_span_t *span = NULL; - uint32_t span_id = 0; - unsigned paramindex = 0; - - if (!name && !id) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "sangoma isdn span missing required attribute 'id' or 'name', skipping ...\n"); - continue; - } - - if (name) { - zstatus = ftdm_span_find_by_name(name, &span); - } else { - if (switch_is_number(id)) { - span_id = atoi(id); - zstatus = ftdm_span_find(span_id, &span); - } - - if (zstatus != FTDM_SUCCESS) { - zstatus = ftdm_span_find_by_name(id, &span); - } - } - - if (zstatus != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error finding FreeTDM span id:%s name:%s\n", switch_str_nil(id), switch_str_nil(name)); - continue; - } - - if (!span_id) { - span_id = ftdm_span_get_id(span); - } - - memset(spanparameters, 0, sizeof(spanparameters)); - paramindex = 0; - - if (configname) { - paramindex = add_profile_parameters(cfg, configname, spanparameters, ftdm_array_len(spanparameters)); - if (paramindex) { - ftdm_log(FTDM_LOG_DEBUG, "Added %d parameters from profile %s for span %d\n", paramindex, configname, span_id); - } - } - - /* some defaults first */ - SPAN_CONFIG[span_id].limit_backend = "hash"; - SPAN_CONFIG[span_id].limit_reset_event = FTDM_LIMIT_RESET_ON_TIMEOUT; - - for (param = switch_xml_child(myspan, "param"); param; param = param->next) { - char *var = (char *) switch_xml_attr_soft(param, "name"); - char *val = (char *) switch_xml_attr_soft(param, "value"); - - if (ftdm_array_len(spanparameters) == paramindex) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Too many parameters for ss7 span, ignoring any parameter after %s\n", var); - break; - } - - if (!strcasecmp(var, "context")) { - context = val; - } else if (!strcasecmp(var, "dialplan")) { - dialplan = val; - } else if (!strcasecmp(var, "call_limit_backend")) { - SPAN_CONFIG[span_id].limit_backend = val; - ftdm_log(FTDM_LOG_DEBUG, "Using limit backend %s for span %d\n", SPAN_CONFIG[span_id].limit_backend, span_id); - } else if (!strcasecmp(var, "call_limit_rate")) { - int calls; - int seconds; - if (sscanf(val, "%d/%d", &calls, &seconds) != 2) { - ftdm_log(FTDM_LOG_ERROR, "Invalid %s parameter, format example: 3/1 for 3 calls per second\n", var); - } else { - if (calls < 1 || seconds < 1) { - ftdm_log(FTDM_LOG_ERROR, "Invalid %s parameter value, minimum call limit must be 1 per second\n", var); - } else { - SPAN_CONFIG[span_id].limit_calls = calls; - SPAN_CONFIG[span_id].limit_seconds = seconds; - } - } - } else if (!strcasecmp(var, "call_limit_reset_event")) { - if (!strcasecmp(val, "answer")) { - SPAN_CONFIG[span_id].limit_reset_event = FTDM_LIMIT_RESET_ON_ANSWER; - } else { - ftdm_log(FTDM_LOG_ERROR, "Invalid %s parameter value, only accepted event is 'answer'\n", var); - } - } else { - spanparameters[paramindex].var = var; - spanparameters[paramindex].val = val; - paramindex++; - } - } + if ((spans = switch_xml_child(cfg, "sangoma_pri_spans"))) { + parse_bri_pri_spans(cfg, spans); + } - if (ftdm_configure_span_signaling(span, - "sangoma_isdn", - on_clear_channel_signal, - spanparameters) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_ERROR, "Error configuring Sangoma ISDN FreeTDM span %d\n", span_id); - continue; - } - SPAN_CONFIG[span_id].span = span; - switch_copy_string(SPAN_CONFIG[span_id].context, context, sizeof(SPAN_CONFIG[span_id].context)); - switch_copy_string(SPAN_CONFIG[span_id].dialplan, dialplan, sizeof(SPAN_CONFIG[span_id].dialplan)); - switch_copy_string(SPAN_CONFIG[span_id].type, "Sangoma (ISDN)", sizeof(SPAN_CONFIG[span_id].type)); - ftdm_log(FTDM_LOG_DEBUG, "Configured Sangoma ISDN FreeTDM span %d\n", span_id); - ftdm_span_start(span); - } + if ((spans = switch_xml_child(cfg, "sangoma_bri_spans"))) { + parse_bri_pri_spans(cfg, spans); } switch_core_hash_init(&globals.ss7_configs, module_pool); commit 5a6f0f5c37939b29ae40f6a9c3e454639d4e8dfc Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Thu Sep 9 15:37:41 2010 -0400 mod_sofia: Correct the order what param and variables are overriding them self in user/group/domain diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 452abdf..32d380d 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -2292,9 +2292,9 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, switch_event_add_header_string(*v_event, SWITCH_STACK_BOTTOM, "mwi-account", mwi_account); } - if ((uparams = switch_xml_child(user, "params"))) { + if ((dparams = switch_xml_child(domain, "params"))) { xparams_type[i] = 0; - xparams[i++] = uparams; + xparams[i++] = dparams; } if (group && (gparams = switch_xml_child(group, "params"))) { @@ -2302,14 +2302,14 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, xparams[i++] = gparams; } - if ((dparams = switch_xml_child(domain, "params"))) { + if ((uparams = switch_xml_child(user, "params"))) { xparams_type[i] = 0; - xparams[i++] = dparams; + xparams[i++] = uparams; } - if ((uparams = switch_xml_child(user, "variables"))) { + if ((dparams = switch_xml_child(domain, "variables"))) { xparams_type[i] = 1; - xparams[i++] = uparams; + xparams[i++] = dparams; } if (group && (gparams = switch_xml_child(group, "variables"))) { @@ -2317,87 +2317,83 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, xparams[i++] = gparams; } - if ((dparams = switch_xml_child(domain, "variables"))) { + if ((uparams = switch_xml_child(user, "variables"))) { xparams_type[i] = 1; - xparams[i++] = dparams; + xparams[i++] = uparams; } if (i <= 6) { int j = 0; + const char *gw_val = NULL; for (j = 0; j < i; j++) { for (param = switch_xml_child(xparams[j], (xparams_type[j] ? "variable" : "param")); param; param = param->next) { const char *var = switch_xml_attr_soft(param, "name"); const char *val = switch_xml_attr_soft(param, "value"); - sofia_gateway_t *gateway_ptr = NULL; if (!zstr(var) && !zstr(val) && (xparams_type[j] == 1 || !strncasecmp(var, "sip-", 4) || !strcasecmp(var, "register-gateway"))) { - if (!switch_event_get_header(*v_event, var)) { - if (profile->debug) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "event_add_header -> '%s' = '%s'\n", var, val); - } - switch_event_add_header_string(*v_event, SWITCH_STACK_BOTTOM, var, val); - } else { - continue; + if (profile->debug) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "event_add_header -> '%s' = '%s'\n", var, val); } + switch_event_add_header_string(*v_event, SWITCH_STACK_BOTTOM, var, val); + } + } + } + if ((gw_val = switch_event_get_header(*v_event, "register-gateway"))) { + sofia_gateway_t *gateway_ptr = NULL; + if (!strcasecmp(gw_val, "all")) { + switch_xml_t gateways_tag, gateway_tag; + if ((gateways_tag = switch_xml_child(user, "gateways"))) { + for (gateway_tag = switch_xml_child(gateways_tag, "gateway"); gateway_tag; gateway_tag = gateway_tag->next) { + char *name = (char *) switch_xml_attr_soft(gateway_tag, "name"); + if (zstr(name)) { + name = "anonymous"; + } - if (!strcasecmp(var, "register-gateway")) { - if (!strcasecmp(val, "all")) { - switch_xml_t gateways_tag, gateway_tag; - if ((gateways_tag = switch_xml_child(user, "gateways"))) { - for (gateway_tag = switch_xml_child(gateways_tag, "gateway"); gateway_tag; gateway_tag = gateway_tag->next) { - char *name = (char *) switch_xml_attr_soft(gateway_tag, "name"); - if (zstr(name)) { - name = "anonymous"; - } - - if ((gateway_ptr = sofia_reg_find_gateway(name))) { - reg_state_t ostate = gateway_ptr->state; - gateway_ptr->retry = 0; - if (exptime) { - gateway_ptr->state = REG_STATE_UNREGED; - } else { - gateway_ptr->state = REG_STATE_UNREGISTER; - } - if (ostate != gateway_ptr->state) { - sofia_reg_fire_custom_gateway_state_event(gateway_ptr, 0, NULL); - } - sofia_reg_release_gateway(gateway_ptr); - } - - } + if ((gateway_ptr = sofia_reg_find_gateway(name))) { + reg_state_t ostate = gateway_ptr->state; + gateway_ptr->retry = 0; + if (exptime) { + gateway_ptr->state = REG_STATE_UNREGED; + } else { + gateway_ptr->state = REG_STATE_UNREGISTER; } - } else { - int x, argc; - char *mydata, *argv[50]; - - mydata = strdup(val); - switch_assert(mydata != NULL); - - argc = switch_separate_string(mydata, ',', argv, (sizeof(argv) / sizeof(argv[0]))); - - for (x = 0; x < argc; x++) { - if ((gateway_ptr = sofia_reg_find_gateway((char *) argv[x]))) { - reg_state_t ostate = gateway_ptr->state; - gateway_ptr->retry = 0; - if (exptime) { - gateway_ptr->state = REG_STATE_UNREGED; - } else { - gateway_ptr->state = REG_STATE_UNREGISTER; - } - if (ostate != gateway_ptr->state) { - sofia_reg_fire_custom_gateway_state_event(gateway_ptr, 0, NULL); - } - sofia_reg_release_gateway(gateway_ptr); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Gateway '%s' not found.\n", argv[x]); - } + if (ostate != gateway_ptr->state) { + sofia_reg_fire_custom_gateway_state_event(gateway_ptr, 0, NULL); } + sofia_reg_release_gateway(gateway_ptr); + } - free(mydata); + } + } + } else { + int x, argc; + char *mydata, *argv[50]; + + mydata = strdup(gw_val); + switch_assert(mydata != NULL); + + argc = switch_separate_string(mydata, ',', argv, (sizeof(argv) / sizeof(argv[0]))); + + for (x = 0; x < argc; x++) { + if ((gateway_ptr = sofia_reg_find_gateway((char *) argv[x]))) { + reg_state_t ostate = gateway_ptr->state; + gateway_ptr->retry = 0; + if (exptime) { + gateway_ptr->state = REG_STATE_UNREGED; + } else { + gateway_ptr->state = REG_STATE_UNREGISTER; + } + if (ostate != gateway_ptr->state) { + sofia_reg_fire_custom_gateway_state_event(gateway_ptr, 0, NULL); } + sofia_reg_release_gateway(gateway_ptr); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Gateway '%s' not found.\n", argv[x]); } } + + free(mydata); } } } commit eaeabc7b04b09a38d0df17576b551d94aa6485dd Author: Rupa Schomaker <rupa@rupa.com> Date: Thu Sep 9 11:07:11 2010 -0500 MODAPP-454 - mod_lcr: don't count twice diff --git a/src/mod/applications/mod_lcr/mod_lcr.c b/src/mod/applications/mod_lcr/mod_lcr.c index bbf7bb5..105576c 100644 --- a/src/mod/applications/mod_lcr/mod_lcr.c +++ b/src/mod/applications/mod_lcr/mod_lcr.c @@ -1571,7 +1571,6 @@ SWITCH_STANDARD_APP(lcr_app_function) switch_channel_set_variable(channel, vbuf, cur_route->carrier_name); switch_snprintf(vbuf, sizeof(vbuf), "lcr_codec_%d", cnt); switch_channel_set_variable(channel, vbuf, cur_route->codec); - cnt++; if (cur_route->next) { if (routes.profile->enable_sip_redir) { dig_stream.write_function(&dig_stream, "%s,", cur_route->dialstring); commit 28046a89de50f8cc87159d4824aeb946e64dfaf9 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Sep 9 09:27:17 2010 -0500 downgrade log message to debug and add more details diff --git a/src/switch_core_file.c b/src/switch_core_file.c index c995b22..7d5df88 100644 --- a/src/switch_core_file.c +++ b/src/switch_core_file.c @@ -173,7 +173,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file, } if (fh->samplerate && rate && fh->samplerate != rate) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Sample rate doesn't match\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "File %s sample rate %d doesn't match requested rate %d\n", file_path, fh->samplerate, rate); if ((flags & SWITCH_FILE_FLAG_READ)) { fh->samplerate = rate; } commit 646a5609a19416a4d0203a0e2d8395ed128b8dfc Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Sep 8 22:53:57 2010 -0500 edge cases for sofia recover diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 799cf4f..3d330da 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -721,6 +721,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session) TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)), TAG_IF(cid, SIPTAG_HEADER_STR(cid)), NUTAG_SESSION_TIMER(session_timeout), + TAG_IF(session_timeout, NUTAG_SESSION_REFRESHER(nua_remote_refresher)), SIPTAG_CONTACT_STR(tech_pvt->reply_contact), SIPTAG_CALL_INFO_STR(switch_channel_get_variable(tech_pvt->channel, SOFIA_SIP_HEADER_PREFIX "call_info")), SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), @@ -736,6 +737,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session) TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)), TAG_IF(cid, SIPTAG_HEADER_STR(cid)), NUTAG_SESSION_TIMER(session_timeout), + TAG_IF(session_timeout, NUTAG_SESSION_REFRESHER(nua_remote_refresher)), SIPTAG_CONTACT_STR(tech_pvt->reply_contact), SIPTAG_CALL_INFO_STR(switch_channel_get_variable(tech_pvt->channel, SOFIA_SIP_HEADER_PREFIX "call_info")), SIPTAG_CONTENT_TYPE_STR("application/sdp"), diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 4cdb1a2..4d51e4b 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -106,6 +106,7 @@ typedef struct private_object private_object_t; #define SOFIA_CRYPTO_MANDATORY_VARIABLE "sip_crypto_mandatory" #define FREESWITCH_SUPPORT "update_display" +#include <switch_stun.h> #include <sofia-sip/nua.h> #include <sofia-sip/sip_status.h> #include <sofia-sip/sdp.h> diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 258be0e..4d9ce9e 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -4518,7 +4518,20 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, } break; case nua_callstate_completing: - nua_ack(nh, TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), TAG_END()); + { + if (sofia_test_pflag(profile, PFLAG_TRACK_CALLS)) { + const char *invite_full_via = switch_channel_get_variable(tech_pvt->channel, "sip_invite_full_via"); + const char *invite_route_uri = switch_channel_get_variable(tech_pvt->channel, "sip_invite_route_uri"); + + nua_ack(nh, + TAG_IF(!zstr(invite_full_via), SIPTAG_VIA_STR(invite_full_via)), + TAG_IF(!zstr(invite_route_uri), SIPTAG_ROUTE_STR(invite_route_uri)), + TAG_END()); + + } else { + nua_ack(nh, TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), TAG_END()); + } + } goto done; case nua_callstate_received: if (!sofia_test_flag(tech_pvt, TFLAG_SDP)) { @@ -5898,6 +5911,26 @@ void sofia_handle_sip_i_reinvite(switch_core_session_t *session, { char *call_info = NULL; + if (session && profile && sip && sofia_test_pflag(profile, PFLAG_TRACK_CALLS)) { + switch_channel_t *channel = switch_core_session_get_channel(session); + private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session); + char network_ip[80]; + int network_port = 0; + char via_space[2048]; + char branch[16] = ""; + + sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), &network_port); + switch_stun_random_string(branch, sizeof(branch) - 1, "0123456789abcdef"); + + switch_snprintf(via_space, sizeof(via_space), "SIP/2.0/UDP %s;rport=%d;branch=%s", network_ip, network_port, branch); + switch_channel_set_variable(channel, "sip_full_via", via_space); + switch_channel_set_variable_printf(channel, "sip_network_port", "%d", network_port); + switch_channel_set_variable_printf(channel, "sip_recieved_port", "%d", network_port); + switch_channel_set_variable_printf(channel, "sip_via_rport", "%d", network_port); + + sofia_glue_tech_track(tech_pvt->profile, session); + } + if (sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)) { switch_channel_t *channel = switch_core_session_get_channel(session); if (channel && sip->sip_call_info) { diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 45364cd..473dfb9 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -2055,10 +2055,15 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) sofia_clear_flag(tech_pvt, TFLAG_ENABLE_SOA); } + if (sofia_test_flag(tech_pvt, TFLAG_RECOVERED)) { + session_timeout = 0; + } + if (sofia_use_soa(tech_pvt)) { nua_invite(tech_pvt->nh, NUTAG_AUTOANSWER(0), NUTAG_SESSION_TIMER(session_timeout), + TAG_IF(session_timeout, NUTAG_SESSION_REFRESHER(nua_remote_refresher)), TAG_IF(sofia_test_flag(tech_pvt, TFLAG_RECOVERED), NUTAG_INVITE_TIMER(UINT_MAX)), TAG_IF(invite_full_from, SIPTAG_FROM_STR(invite_full_from)), TAG_IF(invite_full_to, SIPTAG_TO_STR(invite_full_to)), @@ -2088,6 +2093,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) nua_invite(tech_pvt->nh, NUTAG_AUTOANSWER(0), NUTAG_SESSION_TIMER(session_timeout), + TAG_IF(session_timeout, NUTAG_SESSION_REFRESHER(nua_remote_refresher)), TAG_IF(sofia_test_flag(tech_pvt, TFLAG_RECOVERED), NUTAG_INVITE_TIMER(UINT_MAX)), TAG_IF(invite_full_from, SIPTAG_FROM_STR(invite_full_from)), TAG_IF(invite_full_to, SIPTAG_TO_STR(invite_full_to)), commit 2befa393a63df5fa35af1f089eab7c404a4d6490 Author: Jeff Lenk <jeff@jefflenk.com> Date: Wed Sep 8 22:47:28 2010 -0500 FSBUILD-302 Fix Windows build error - uninitialized variable diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 3a5e0bb..51e7661 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -850,7 +850,7 @@ SWITCH_DECLARE(switch_bool_t) switch_cache_db_test_reactive(switch_cache_db_hand static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, void *obj) { - void *pop; + void *pop = NULL; uint32_t itterations = 0; uint8_t trans = 0, nothing_in_queue = 0; uint32_t target = 100000; commit 42c307253bc88621254fc9bd92f6364ca088c5da Author: Konrad Hammel <konrad@sangoma.com> Date: Wed Sep 8 20:34:57 2010 -0400 freetdm: ss7 - beta support for ANSI, added support for tx of cgb, cgu diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c index edb1560..c0ce84b 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c @@ -48,8 +48,6 @@ static ftdm_status_t handle_print_usuage(ftdm_stream_handle_t *stream); static ftdm_status_t handle_set_function_trace(ftdm_stream_handle_t *stream, int on, int level); static ftdm_status_t handle_set_message_trace(ftdm_stream_handle_t *stream, int on, int level); -static ftdm_status_t handle_set_blocks(ftdm_stream_handle_t *stream, int span, int chan, int verbose); -static ftdm_status_t handle_set_unblks(ftdm_stream_handle_t *stream, int span, int chan, int verbose); static ftdm_status_t handle_set_inhibit(ftdm_stream_handle_t *stream, char *name); static ftdm_status_t handle_set_uninhibit(ftdm_stream_handle_t *stream, char *name); @@ -63,6 +61,13 @@ static ftdm_status_t handle_show_status(ftdm_stream_handle_t *stream, int span, static ftdm_status_t handle_tx_rsc(ftdm_stream_handle_t *stream, int span, int chan, int verbose); static ftdm_status_t handle_tx_grs(ftdm_stream_handle_t *stream, int span, int chan, int range, int verbose); +static ftdm_status_t handle_tx_blo(ftdm_stream_handle_t *stream, int span, int chan, int verbose); +static ftdm_status_t handle_tx_ubl(ftdm_stream_handle_t *stream, int span, int chan, int verbose); + +static ftdm_status_t handle_tx_cgb(ftdm_stream_handle_t *stream, int span, int chan, int range, int verbose); +static ftdm_status_t handle_tx_cgu(ftdm_stream_handle_t *stream, int span, int chan, int range, int verbose); + + static ftdm_status_t handle_status_link(ftdm_stream_handle_t *stream, char *name); static ftdm_status_t handle_status_linkset(ftdm_stream_handle_t *stream, char *name); @@ -282,7 +287,45 @@ ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const cha /**********************************************************************/ } /**************************************************************************/ - } else if (!strcasecmp(argv[c], "block")) { + } else if (!strcasecmp(argv[c], "inhibit")) { + /**************************************************************************/ + if (check_arg_count(argc, 2)) goto handle_cli_error_argc; + c++; + + if (!strcasecmp(argv[c], "link")) { + /**********************************************************************/ + if (check_arg_count(argc, 3)) goto handle_cli_error_argc; + c++; + + handle_set_inhibit(stream, argv[c]); + /**********************************************************************/ + } else { + /**********************************************************************/ + stream->write_function(stream, "Unknown \"block\" command\n"); + goto handle_cli_error; + /**********************************************************************/ + } + /**************************************************************************/ + } else if (!strcasecmp(argv[c], "uninhibit")) { + /**************************************************************************/ + if (check_arg_count(argc, 2)) goto handle_cli_error_argc; + c++; + + if (!strcasecmp(argv[c], "link")) { + /**********************************************************************/ + if (check_arg_count(argc, 3)) goto handle_cli_error_argc; + c++; + + handle_set_uninhibit(stream, argv[c]); + /**********************************************************************/ + } else { + /**********************************************************************/ + stream->write_function(stream, "Unknown \"unblock\" command\n"); + goto handle_cli_error; + /**********************************************************************/ + } + /**************************************************************************/ + } else if (!strcasecmp(argv[c], "blo")) { /**************************************************************************/ if (check_arg_count(argc, 2)) goto handle_cli_error_argc; c++; @@ -293,23 +336,36 @@ ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const cha if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; - handle_set_blocks(stream, span, chan, verbose); + handle_tx_blo(stream, span, chan, verbose); /**********************************************************************/ - } else if (!strcasecmp(argv[c], "link")) { + } else { /**********************************************************************/ - if (check_arg_count(argc, 3)) goto handle_cli_error_argc; - c++; - - handle_set_inhibit(stream, argv[c]); + stream->write_function(stream, "Unknown \"block\" command\n"); + goto handle_cli_error; + /**********************************************************************/ + } + /**************************************************************************/ + } else if (!strcasecmp(argv[c], "ubl")) { + /**************************************************************************/ + if (check_arg_count(argc, 2)) goto handle_cli_error_argc; + c++; + + if (!strcasecmp(argv[c], "span")) { + /**********************************************************************/ + if (check_arg_count(argc, 5)) goto handle_cli_error_argc; + + if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; + + handle_tx_ubl(stream, span, chan, verbose); /**********************************************************************/ } else { /**********************************************************************/ - stream->write_function(stream, "Unknown \"block\" command\n"); + stream->write_function(stream, "Unknown \"ubl\" command\n"); goto handle_cli_error; /**********************************************************************/ - } + } /**************************************************************************/ - } else if (!strcasecmp(argv[c], "unblock")) { + } else if (!strcasecmp(argv[c], "cgb")) { /**************************************************************************/ if (check_arg_count(argc, 2)) goto handle_cli_error_argc; c++; @@ -319,19 +375,62 @@ ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const cha if (check_arg_count(argc, 5)) goto handle_cli_error_argc; if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; + c = c + 4; - handle_set_unblks(stream, span, chan, verbose); + if (check_arg_count(argc, 7)) goto handle_cli_error_argc; + + if (!strcasecmp(argv[c], "range")) { + /******************************************************************/ + c++; + range = atoi(argv[c]); + /******************************************************************/ + } else { + /******************************************************************/ + stream->write_function(stream, "Unknown \"cgb range\" command\n"); + goto handle_cli_error; + /******************************************************************/ + } + + handle_tx_cgb(stream, span, chan, range, verbose); /**********************************************************************/ - } else if (!strcasecmp(argv[c], "link")) { + } else { /**********************************************************************/ - if (check_arg_count(argc, 3)) goto handle_cli_error_argc; - c++; - - handle_set_uninhibit(stream, argv[c]); + stream->write_function(stream, "Unknown \"cgb\" command\n"); + goto handle_cli_error; + /**********************************************************************/ + } + /**************************************************************************/ + } else if (!strcasecmp(argv[c], "cgu")) { + /**************************************************************************/ + if (check_arg_count(argc, 2)) goto handle_cli_error_argc; + c++; + + if (!strcasecmp(argv[c], "span")) { + /**********************************************************************/ + if (check_arg_count(argc, 5)) goto handle_cli_error_argc; + + if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; + c = c + 4; + + if (check_arg_count(argc, 7)) goto handle_cli_error_argc; + + if (!strcasecmp(argv[c], "range")) { + /******************************************************************/ + c++; + range = atoi(argv[c]); + /******************************************************************/ + } else { + /******************************************************************/ + stream->write_function(stream, "Unknown \"cgu range\" command\n"); + goto handle_cli_error; + /******************************************************************/ + } + + handle_tx_cgu(stream, span, chan, range, verbose); /**********************************************************************/ } else { /**********************************************************************/ - stream->write_function(stream, "Unknown \"unblock\" command\n"); + stream->write_function(stream, "Unknown \"cgu\" command\n"); goto handle_cli_error; /**********************************************************************/ } @@ -433,11 +532,16 @@ static ftdm_status_t handle_print_usuage(ftdm_stream_handle_t *stream) stream->write_function(stream, "ftdm ss7 show inreset span X chan Y\n"); stream->write_function(stream, "\n"); stream->write_function(stream, "Ftmod_sangoma_ss7 circuit control:\n"); - stream->write_function(stream, "ftdm ss7 block span X chan Y\n"); - stream->write_function(stream, "ftdm ss7 unblk span X chan Y\n"); + stream->write_function(stream, "ftdm ss7 blo span X chan Y\n"); + stream->write_function(stream, "ftdm ss7 ubl span X chan Y\n"); stream->write_function(stream, "ftdm ss7 rsc span X chan Y\n"); stream->write_function(stream, "ftdm ss7 grs span X chan Y range Z\n"); stream->write_function(stream, "\n"); + stream->write_function(stream, "Ftmod_sangoma_ss7 link control:\n"); + stream->write_function(stream, "ftdm ss7 inhibit link X\n"); + stream->write_function(stream, "ftdm ss7 uninhibit link X\n"); + + stream->write_function(stream, "\n"); return FTDM_SUCCESS; } @@ -899,7 +1003,7 @@ static ftdm_status_t handle_show_status(ftdm_stream_handle_t *stream, int span, return FTDM_SUCCESS; } /******************************************************************************/ -static ftdm_status_t handle_set_blocks(ftdm_stream_handle_t *stream, int span, int chan, int verbose) +static ftdm_status_t handle_tx_blo(ftdm_stream_handle_t *stream, int span, int chan, int verbose) { int x; sngss7_chan_data_t *ss7_info; @@ -960,7 +1064,7 @@ static ftdm_status_t handle_set_blocks(ftdm_stream_handle_t *stream, int span, i } /******************************************************************************/ -static ftdm_status_t handle_set_unblks(ftdm_stream_handle_t *stream, int span, int chan, int verbose) +static ftdm_status_t handle_tx_ubl(ftdm_stream_handle_t *stream, int span, int chan, int verbose) { int x; sngss7_chan_data_t *ss7_info; @@ -1154,17 +1258,17 @@ static ftdm_status_t handle_set_uninhibit(ftdm_stream_handle_t *stream, char *na /******************************************************************************/ static ftdm_status_t handle_tx_rsc(ftdm_stream_handle_t *stream, int span, int chan, int verbose) { - int x; - sngss7_chan_data_t *ss7_info; - ftdm_channel_t *ftdmchan; - int lspan; - int lchan; + int x; + sngss7_chan_data_t *sngss7_info; + ftdm_channel_t *ftdmchan; + int lspan; + int lchan; x=1; while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) { - ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; - ftdmchan = ss7_info->ftdmchan; + sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; + ftdmchan = sngss7_info->ftdmchan; /* if span == 0 then all spans should be printed */ if (span == 0) { @@ -1181,27 +1285,31 @@ static ftdm_status_t handle_tx_rsc(ftdm_stream_handle_t *stream, int span, int c } if ((ftdmchan->physical_span_id == lspan) && (ftdmchan->physical_chan_id == lchan)) { - /* now that we have the right channel...put a lock on it so no-one else can use it */ + /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change|give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", ss7_info->circuit->cic); - SS7_ASSERT; - } else { - /* throw the ckt block flag */ - sngss7_set_flag(ss7_info, FLAG_RESET_TX); + /* throw the reset flag */ + sngss7_set_flag(sngss7_info, FLAG_RESET_TX); - /* set the channel to suspended state */ + switch (ftdmchan->state) { + /**************************************************************************/ + case FTDM_CHANNEL_STATE_RESTART: + /* go to idle so that we can redo the restart state*/ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE); + break; + /**************************************************************************/ + default: + /* set the state of the channel to restart...the rest is done by the chan monitor */ ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + break; + /**************************************************************************/ } - + /* unlock the channel again before we exit */ ftdm_mutex_unlock(ftdmchan->mutex); - } /* if ( span and chan) */ - } /* if ( cic != 0) */ + } /* if ( cic == voice) */ /* go the next circuit */ x++; @@ -1271,6 +1379,144 @@ static ftdm_status_t handle_tx_grs(ftdm_stream_handle_t *stream, int span, int c } /******************************************************************************/ +static ftdm_status_t handle_tx_cgb(ftdm_stream_handle_t *stream, int span, int chan, int range, int verbose) +{ + int x; + sngss7_chan_data_t *sngss7_info; + ftdm_channel_t *ftdmchan; + ftdm_channel_t *main_chan = NULL; + sngss7_span_data_t *sngss7_span; + int byte = 0; + int bit = 0; + + if (range > 31) { + stream->write_function(stream, "Invalid range value %d", range); + return FTDM_SUCCESS; + } + + x=1; + while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { + if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) { + + /* extract the channel and span info for this circuit */ + sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; + ftdmchan = sngss7_info->ftdmchan; + sngss7_span = ftdmchan->span->mod_data; + + /* check if this circuit is part of the block */ + if ((ftdmchan->physical_span_id == span) && + ((ftdmchan->physical_chan_id >= chan) && (ftdmchan->physical_chan_id < (chan+range)))) { + + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* throw the grp maint. block flag */ + sngss7_set_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX); + + /* if this is the first channel in the range */ + if (ftdmchan->physical_chan_id == chan) { + /* attach the cgb information */ + main_chan = ftdmchan; + sngss7_span->tx_cgb.circuit = sngss7_info->circuit->id; + sngss7_span->tx_cgb.range = range-1; + sngss7_span->tx_cgb.type = 0; /* maintenace block */ + } /* if (ftdmchan->physical_chan_id == chan) */ + + /* update the status field */ + sngss7_span->tx_cgb.status[byte] = (sngss7_span->tx_cgb.status[byte] | (1 << bit)); + + /* update the bit and byte counter*/ + bit ++; + if (bit == 8) { + byte++; + bit = 0; + } + + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); + } /* if ( span and chan) */ + } /* if ( cic == voice) */ + /* go the next circuit */ + x++; + } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ + + /* send the circuit group block */ + ft_to_sngss7_cgb(main_chan); + + + return FTDM_SUCCESS; +} + +/******************************************************************************/ +static ftdm_status_t handle_tx_cgu(ftdm_stream_handle_t *stream, int span, int chan, int range, int verbose) +{ + int x; + sngss7_chan_data_t *sngss7_info; + ftdm_channel_t *ftdmchan; + ftdm_channel_t *main_chan = NULL; + sngss7_span_data_t *sngss7_span; + int byte = 0; + int bit = 0; + + if (range > 31) { + stream->write_function(stream, "Invalid range value %d", range); + return FTDM_SUCCESS; + } + + x=1; + while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { + if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) { + + /* extract the channel and span info for this circuit */ + sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; + ftdmchan = sngss7_info->ftdmchan; + sngss7_span = ftdmchan->span->mod_data; + + /* check if this circuit is part of the block */ + if ((ftdmchan->physical_span_id == span) && + ((ftdmchan->physical_chan_id >= chan) && (ftdmchan->physical_chan_id < (chan+range)))) { + + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* throw the grp maint. block flag */ + sngss7_clear_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX); + + /* if this is the first channel in the range */ + if (ftdmchan->physical_chan_id == chan) { + /* attach the cgb information */ + main_chan = ftdmchan; + sngss7_span->tx_cgu.circuit = sngss7_info->circuit->id; + sngss7_span->tx_cgu.range = range-1; + sngss7_span->tx_cgu.type = 0; /* maintenace block */ + } /* if (ftdmchan->physical_chan_id == chan) */ + + /* update the status field */ + sngss7_span->tx_cgu.status[byte] = (sngss7_span->tx_cgu.status[byte] | (1 << bit)); + + /* update the bit and byte counter*/ + bit ++; + if (bit == 8) { + byte++; + bit = 0; + } + + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); + } /* if ( span and chan) */ + } /* if ( cic == voice) */ + /* go the next circuit */ + x++; + } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ + + /* send the circuit group block */ + ft_to_sngss7_cgu(main_chan); + + + return FTDM_SUCCESS; +} + +/******************************************************************************/ static ftdm_status_t extract_span_chan(char *argv[10], int pos, int *span, int *chan) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index 0c3dcff..0286563 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -915,12 +915,12 @@ ftdm_status_t handle_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ /**************************************************************************/ case SIT_STA_CGBRSP: /* mntc. oriented CGB response */ SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx mntc CGB\n"); - handle_cgb_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); + /*handle_cgb_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt);*/ break; /**************************************************************************/ case SIT_STA_CGURSP: /* mntc. oriented CGU response */ SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx mntc CGU\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + /*SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType));*/ break; /**************************************************************************/ case SIT_STA_GRSREQ: /* circuit group reset request */ @@ -1020,7 +1020,7 @@ ftdm_status_t handle_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ /**************************************************************************/ case SIT_STA_LMCQMINFOREQ: /* when LM requests ckt grp query */ SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx LM CQM\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); +// SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_CIRLOCGRS: /* group reset initiated locally by the software */ @@ -2073,7 +2073,7 @@ ftdm_status_t handle_cgb_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ SS7_ASSERT; }; -#if 1 +#if 0 SS7_ERROR("KONRAD -> circuit=%d, byte=%d, bit=%d, status[byte]=%d, math=%d\n", x, byte, diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index c9dbfb3..bab1c8b 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -471,6 +471,8 @@ void ft_to_sngss7_gra(ftdm_channel_t *ftdmchan); void ft_to_sngss7_grs(ftdm_channel_t *ftdmchan); void ft_to_sngss7_cgba(ftdm_channel_t * ftdmchan); void ft_to_sngss7_cgua(ftdm_channel_t * ftdmchan); +void ft_to_sngss7_cgb(ftdm_channel_t * ftdmchan); +void ft_to_sngss7_cgu(ftdm_channel_t * ftdmchan); void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); void sngss7_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index 079f5e3..46bd39f 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -61,6 +61,9 @@ void ft_to_sngss7_lpa(ftdm_channel_t * ftdmchan); void ft_to_sngss7_gra(ftdm_channel_t * ftdmchan); void ft_to_sngss7_grs(ftdm_channel_t * ftdmchan); +void ft_to_sngss7_cgb(ftdm_channel_t * ftdmchan); +void ft_to_sngss7_cgu(ftdm_channel_t * ftdmchan); + void ft_to_sngss7_cgba(ftdm_channel_t * ftdmchan); void ft_to_sngss7_cgua(ftdm_channel_t * ftdmchan); /******************************************************************************/ @@ -121,6 +124,10 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) (g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId].switchType == LSI_SW_ANS92) || (g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId].switchType == LSI_SW_ANS95)) { + /* include only if we're running ANSI */ + iam.fwdCallInd.transCallNInd.pres = PRSNT_NODEF; + iam.fwdCallInd.transCallNInd.val = 0x0; + iam.usrServInfoA.eh.pres = PRSNT_NODEF; iam.usrServInfoA.infoTranCap.pres = PRSNT_NODEF; @@ -633,6 +640,106 @@ void ft_to_sngss7_cgua(ftdm_channel_t * ftdmchan) SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } + +/******************************************************************************/ +void ft_to_sngss7_cgb(ftdm_channel_t * ftdmchan) +{ + SS7_FUNC_TRACE_ENTER (__FUNCTION__); + + sngss7_span_data_t *sngss7_span = ftdmchan->span->mod_data; + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + SiStaEvnt cgb; + int x = 0; + + + memset (&cgb, 0x0, sizeof(cgb)); + + /* fill in the circuit group supervisory message */ + cgb.cgsmti.eh.pres = PRSNT_NODEF; + cgb.cgsmti.typeInd.pres = PRSNT_NODEF; + cgb.cgsmti.typeInd.val = sngss7_span->tx_cgb.type; + + /* fill in the range */ + cgb.rangStat.eh.pres = PRSNT_NODEF; + cgb.rangStat.range.pres = PRSNT_NODEF; + cgb.rangStat.range.val = sngss7_span->tx_cgb.range; + + /* fill in the status */ + cgb.rangStat.status.pres = PRSNT_NODEF; + cgb.rangStat.status.len = ((sngss7_span->tx_cgb.range + 1) >> 3) + (((sngss7_span->tx_cgb.range + 1) & 0x07) ? 1 : 0); + for(x = 0; x < cgb.rangStat.status.len; x++){ + cgb.rangStat.status.val[x] = sngss7_span->tx_cgb.status[x]; + } + + sng_cc_sta_request (1, + 0, + 0, + sngss7_span->tx_cgb.circuit, + 0, + SIT_STA_CGBREQ, + &cgb); + + SS7_INFO_CHAN(ftdmchan, "Tx CGB (%d:%d)\n", + sngss7_info->circuit->cic, + (sngss7_info->circuit->cic + sngss7_span->tx_cgb.range)); + + /* clean out the saved data */ + memset(&sngss7_span->tx_cgb, 0x0, sizeof(sngss7_group_data_t)); + + SS7_FUNC_TRACE_EXIT (__FUNCTION__); + return; +} + +/******************************************************************************/ +void ft_to_sngss7_cgu(ftdm_channel_t * ftdmchan) +{ + SS7_FUNC_TRACE_ENTER (__FUNCTION__); + + sngss7_span_data_t *sngss7_span = ftdmchan->span->mod_data; + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + SiStaEvnt cgu; + int x = 0; + + + memset (&cgu, 0x0, sizeof(cgu)); + + /* fill in the circuit group supervisory message */ + cgu.cgsmti.eh.pres = PRSNT_NODEF; + cgu.cgsmti.typeInd.pres = PRSNT_NODEF; + cgu.cgsmti.typeInd.val = sngss7_span->tx_cgu.type; + + /* fill in the range */ + cgu.rangStat.eh.pres = PRSNT_NODEF; + cgu.rangStat.range.pres = PRSNT_NODEF; + cgu.rangStat.range.val = sngss7_span->tx_cgu.range; + + /* fill in the status */ + cgu.rangStat.status.pres = PRSNT_NODEF; + cgu.rangStat.status.len = ((sngss7_span->tx_cgu.range + 1) >> 3) + (((sngss7_span->tx_cgu.range + 1) & 0x07) ? 1 : 0); + for(x = 0; x < cgu.rangStat.status.len; x++){ + cgu.rangStat.status.val[x] = sngss7_span->tx_cgu.status[x]; + } + + sng_cc_sta_request (1, + 0, + 0, + sngss7_span->tx_cgu.circuit, + 0, + SIT_STA_CGUREQ, + &cgu); + + SS7_INFO_CHAN(ftdmchan, "Tx CGU (%d:%d)\n", + sngss7_info->circuit->cic, + (sngss7_info->circuit->cic + sngss7_span->tx_cgu.range)); + + /* clean out the saved data */ + memset(&sngss7_span->tx_cgu, 0x0, sizeof(sngss7_group_data_t)); + + SS7_FUNC_TRACE_EXIT (__FUNCTION__); + return; +} + + /******************************************************************************/ /* For Emacs: * Local Variables: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 4ec57fe..161a70d 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -458,6 +458,9 @@ ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan) sngss7_chan_data_t *sngss7_info = NULL; sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->mod_data; int i; + int byte = 0; + int bit = 0; + ftdm_log(FTDM_LOG_DEBUG, "Found Rx GRS on span %d...checking circuits\n", ftdmspan->span_id); @@ -505,6 +508,21 @@ ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan) /* move the channel to the down state */ ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + /* update the status map if the ckt is in blocked state */ + if ((sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) || + (sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) || + (sngss7_test_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX)) || + (sngss7_test_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX))) { + + sngss7_span->rx_grs.status[byte] = (sngss7_span->rx_grs.status[byte] | (1 << bit)); + } /* if blocked */ + + /* update the bit and byte counter*/ + bit ++; + if (bit == 8) { + byte++; + bit = 0; + } } /* for ( i = circuit; i < (circuit + range + 1); i++) */ GRS_UNLOCK_ALL: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c index 4ebf3b9..f6d04ed 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c @@ -1472,7 +1472,7 @@ static int ftmod_ss7_fill_in_isap(sng_isap_t *sng_isap) if (sng_isap->tex != 0) { g_ftdm_sngss7_data.cfg.isap[i].tex = sng_isap->tex; } else { - g_ftdm_sngss7_data.cfg.isap[i].tex = 10; + g_ftdm_sngss7_data.cfg.isap[i].tex = 1000; } if (sng_isap->tcrm != 0) { g_ftdm_sngss7_data.cfg.isap[i].tcrm = sng_isap->tcrm; commit 77671c049bca64a54c82917bf3bf7b093ff30655 Author: Steve Underwood <steveu@coppice.org> Date: Thu Sep 9 08:25:18 2010 +0800 I messed up the last spandsp update, by missing 2 header files. This should fix things. diff --git a/libs/spandsp/src/spandsp/private/t30.h b/libs/spandsp/src/spandsp/private/t30.h index e56753e..b8a2e8b 100644 --- a/libs/spandsp/src/spandsp/private/t30.h +++ b/libs/spandsp/src/spandsp/private/t30.h @@ -60,10 +60,8 @@ struct t30_state_s int supported_t30_features; /*! \brief TRUE is ECM mode handling is enabled. */ int ecm_allowed; -#if 0 /*! \brief TRUE if we are capable of retransmitting pages */ int retransmit_capable; -#endif /*! \brief The received DCS, formatted as an ASCII string, for inclusion in the TIFF file. */ @@ -71,12 +69,12 @@ struct t30_state_s /*! \brief The text which will be used in FAX page header. No text results in no header line. */ char header_info[T30_MAX_PAGE_HEADER_INFO + 1]; -#if 0 /*! \brief TRUE for FAX page headers to overlay (i.e. replace) the beginning of the page image. FALSE for FAX page headers to add to the overall length of the page. */ int header_overlays_image; -#endif + /*! \brief TRUE if remote T.30 procedural interrupts are allowed. */ + int remote_interrupts_allowed; /*! \brief The information fields received. */ t30_exchanged_info_t rx_info; @@ -207,13 +205,6 @@ struct t30_state_s /*! \brief This is only used in full duplex (e.g. ISDN) modes. */ int timer_t8; - /* These fields are guessed based on compiler error forensics, I added them to fix the build -anthm */ - int remote_interrupts_allowed; - int rtp_events; - int rtn_events; - int retransmit_capable; - /* end guessed fields */ - /*! \brief TRUE once the far end FAX entity has been detected. */ int far_end_detected; @@ -283,12 +274,10 @@ struct t30_state_s /*! \brief The current completion status. */ int current_status; -#if 0 /*! \brief The number of RTP events */ int rtp_events; /*! \brief The number of RTN events */ int rtn_events; -#endif /*! \brief the FCF2 field of the last PPS message we received. */ uint8_t last_pps_fcf2; diff --git a/libs/spandsp/src/spandsp/t30.h b/libs/spandsp/src/spandsp/t30.h index 9df7321..a2fff2d 100644 --- a/libs/spandsp/src/spandsp/t30.h +++ b/libs/spandsp/src/spandsp/t30.h @@ -682,6 +682,10 @@ SPAN_DECLARE(void) t30_get_transfer_statistics(t30_state_t *s, t30_stats_t *t); \param state TRUE to enable interrupt request, else FALSE. */ SPAN_DECLARE(void) t30_local_interrupt_request(t30_state_t *s, int state); +/*! Allow remote interrupts of FAX exchange. + \brief Allow remote interrupts of FAX exchange. + \param s The T.30 context. + \param state TRUE to allow interruptd, else FALSE. */ SPAN_DECLARE(void) t30_remote_interrupts_allowed(t30_state_t *s, int state); #if defined(__cplusplus) commit 6875a9718d701ef9f312c677e85bd4675eb2abfd Author: Brian West <brian@freeswitch.org> Date: Wed Sep 8 16:33:50 2010 -0500 Adding att_xfer example to default dialplan diff --git a/conf/dialplan/features.xml b/conf/dialplan/features.xml index 901b309..b85cadc 100644 --- a/conf/dialplan/features.xml +++ b/conf/dialplan/features.xml @@ -11,6 +11,14 @@ </condition> </extension> + <extension name="att_xfer"> + <condition field="destination_number" expression="^att_xfer$"> + <action application="read" data="3 4 'tone_stream://%(10000,0,350,440)' digits 30000 #"/> + <action application="set" data="origination_cancel_key=#"/> + <action application="att_xfer" data="user/${digits}@$${domain}"/> + </condition> + </extension> + <extension name="is_transfer"> <condition field="destination_number" expression="^is_transfer$"/> <condition field="${digits}" expression="^(\d+)$"> commit 20ec962a066533e6e0169d4ad4254c5d2c1bc8a7 Author: Brian West <brian@freeswitch.org> Date: Wed Sep 8 16:33:45 2010 -0500 Adding att_xfer example to default dialplan diff --git a/conf/dialplan/default.xml b/conf/dialplan/default.xml index 8abb8d8..dec163e 100644 --- a/conf/dialplan/default.xml +++ b/conf/dialplan/default.xml @@ -250,6 +250,7 @@ <action application="bind_meta_app" data="1 b s execute_extension::dx XML features"/> <action application="bind_meta_app" data="2 b s record_session::$${recordings_dir}/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/> <action application="bind_meta_app" data="3 b s execute_extension::cf XML features"/> + <action application="bind_meta_app" data="4 b s execute_extension::att_xfer XML features"/> <action application="set" data="ringback=${us-ring}"/> <action application="set" data="transfer_ringback=$${hold_music}"/> <action application="set" data="call_timeout=30"/> commit f777b36e4f9f0864ce475becea8d2b590184eb42 Author: Brian West <brian@freeswitch.org> Date: Wed Sep 8 15:57:05 2010 -0500 swigall diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index 1b13352..55d78c3 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -12514,6 +12514,29 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_profile_originatee_caller_pro } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_origination_caller_profile_set(void * jarg1, void * jarg2) { + switch_caller_profile *arg1 = (switch_caller_profile *) 0 ; + switch_caller_profile *arg2 = (switch_caller_profile *) 0 ; + + arg1 = (switch_caller_profile *)jarg1; + arg2 = (switch_caller_profile *)jarg2; + if (arg1) (arg1)->origination_caller_profile = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_profile_origination_caller_profile_get(void * jarg1) { + void * jresult ; + switch_caller_profile *arg1 = (switch_caller_profile *) 0 ; + switch_caller_profile *result = 0 ; + + arg1 = (switch_caller_profile *)jarg1; + result = (switch_caller_profile *) ((arg1)->origination_caller_profile); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_hunt_caller_profile_set(void * jarg1, void * jarg2) { switch_caller_profile *arg1 = (switch_caller_profile *) 0 ; switch_caller_profile *arg2 = (switch_caller_profile *) 0 ; @@ -22015,6 +22038,28 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_get_originatee_caller_profil } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_origination_caller_profile(void * jarg1, void * jarg2) { + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + switch_caller_profile_t *arg2 = (switch_caller_profile_t *) 0 ; + + arg1 = (switch_channel_t *)jarg1; + arg2 = (switch_caller_profile_t *)jarg2; + switch_channel_set_origination_caller_profile(arg1,arg2); +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_get_origination_caller_profile(void * jarg1) { + void * jresult ; + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + switch_caller_profile_t *result = 0 ; + + arg1 = (switch_channel_t *)jarg1; + result = (switch_caller_profile_t *)switch_channel_get_origination_caller_profile(arg1); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_get_uuid(void * jarg1) { char * jresult ; switch_channel_t *arg1 = (switch_channel_t *) 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index 3085937..1794978 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -2938,6 +2938,16 @@ public class freeswitch { return ret; } + public static void switch_channel_set_origination_caller_profile(SWIGTYPE_p_switch_channel channel, switch_caller_profile caller_profile) { + freeswitchPINVOKE.switch_channel_set_origination_caller_profile(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_caller_profile.getCPtr(caller_profile)); + } + + public static switch_caller_profile switch_channel_get_origination_caller_profile(SWIGTYPE_p_switch_channel channel) { + IntPtr cPtr = freeswitchPINVOKE.switch_channel_get_origination_caller_profile(SWIGTYPE_p_switch_channel.getCPtr(channel)); + switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false); + return ret; + } + public static string switch_channel_get_uuid(SWIGTYPE_p_switch_channel channel) { string ret = freeswitchPINVOKE.switch_channel_get_uuid(SWIGTYPE_p_switch_channel.getCPtr(channel)); return ret; @@ -8146,6 +8156,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_originatee_caller_profile_get")] public static extern IntPtr switch_caller_profile_originatee_caller_profile_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_origination_caller_profile_set")] + public static extern void switch_caller_profile_origination_caller_profile_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_origination_caller_profile_get")] + public static extern IntPtr switch_caller_profile_origination_caller_profile_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_hunt_caller_profile_set")] public static extern void switch_caller_profile_hunt_caller_profile_set(HandleRef jarg1, HandleRef jarg2); @@ -10528,6 +10544,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_originatee_caller_profile")] public static extern IntPtr switch_channel_get_originatee_caller_profile(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_origination_caller_profile")] + public static extern void switch_channel_set_origination_caller_profile(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_origination_caller_profile")] + public static extern IntPtr switch_channel_get_origination_caller_profile(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_uuid")] public static extern string switch_channel_get_uuid(HandleRef jarg1); @@ -20148,6 +20170,17 @@ public class switch_caller_profile : IDisposable { } } + public switch_caller_profile origination_caller_profile { + set { + freeswitchPINVOKE.switch_caller_profile_origination_caller_profile_set(swigCPtr, switch_caller_profile.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_caller_profile_origination_caller_profile_get(swigCPtr); + switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false); + return ret; + } + } + public switch_caller_profile hunt_caller_profile { set { freeswitchPINVOKE.switch_caller_profile_hunt_caller_profile_set(swigCPtr, switch_caller_profile.getCPtr(value)); commit fcdc147e0489a8524b927d093f5016758b651e07 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Sep 8 15:36:30 2010 -0500 doh diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index c78ed90..452abdf 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -674,7 +674,7 @@ void sofia_reg_check_expire(sofia_profile_t *profile, time_t now, int reboot) switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid," "expires,user_agent,server_user,server_host,profile_name" " from sip_registrations where (status like '%%NAT%%' " - "or contact like '%%fs_nat=true%%') and hostname='%s'", mod_sofia_globals.hostname); + "or contact like '%%fs_nat=yes%%') and hostname='%s'", mod_sofia_globals.hostname); sofia_glue_execute_sql_callback(profile, NULL, sql, sofia_reg_nat_callback, profile); } commit 4526ba30c6ec71e56cefb798c16d3867197f2989 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Sep 8 15:32:34 2010 -0500 improve sofia recover in some nat cases diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 19a44f4..799cf4f 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -85,6 +85,10 @@ static switch_status_t sofia_on_init(switch_core_session_t *session) sofia_glue_tech_absorb_sdp(tech_pvt); } + if (sofia_test_flag(tech_pvt, TFLAG_RECOVERING) || sofia_test_flag(tech_pvt, TFLAG_RECOVERING_BRIDGE)) { + sofia_set_flag(tech_pvt, TFLAG_RECOVERED); + } + if (sofia_test_flag(tech_pvt, TFLAG_OUTBOUND) || sofia_test_flag(tech_pvt, TFLAG_RECOVERING)) { const char *var; diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index aa21495..4cdb1a2 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -275,6 +275,7 @@ typedef enum { TFLAG_RECOVERING, TFLAG_RECOVERING_BRIDGE, TFLAG_T38_PASSTHRU, + TFLAG_RECOVERED, /* No new flags below this line */ TFLAG_MAX } TFLAGS; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 14d05fd..258be0e 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1225,7 +1225,7 @@ static void sofia_perform_profile_start_failure(sofia_profile_t *profile, char * #define sofia_profile_start_failure(p, xp) sofia_perform_profile_start_failure(p, xp, __FILE__, __LINE__) -#define SQLLEN 1024 * 64 +#define SQLLEN 1024 * 32 void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread, void *obj) { sofia_profile_t *profile = (sofia_profile_t *) obj; @@ -1236,7 +1236,8 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread void *pop; int loop_count = 0; switch_size_t sql_len = SQLLEN; - char *tmp, *sqlbuf = NULL; + char *sqlbuf = NULL; + char *sql = NULL; if (sofia_test_pflag(profile, PFLAG_SQL_IN_TRANS)) { sqlbuf = (char *) malloc(sql_len); @@ -1253,7 +1254,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread while ((mod_sofia_globals.running == 1 && sofia_test_pflag(profile, PFLAG_RUNNING)) || qsize) { if (sofia_test_pflag(profile, PFLAG_SQL_IN_TRANS)) { - if (qsize > 0 && (qsize >= 1024 || ++loop_count >= profile->trans_timeout)) { + if ((qsize > 0 && (qsize >= 1024 || ++loop_count >= profile->trans_timeout)) || sql) { switch_size_t newlen; uint32_t itterations = 0; switch_size_t len = 0; @@ -1262,28 +1263,24 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread //sofia_glue_actually_execute_sql(profile, "begin;\n", NULL); - while (switch_queue_trypop(profile->sql_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) { - char *sql = (char *) pop; - + while (sql || (switch_queue_trypop(profile->sql_queue, &pop) == SWITCH_STATUS_SUCCESS && pop)) { + + if (!sql) { + sql = (char *) pop; + } + newlen = strlen(sql) + 2; - - if (newlen + 10 < SQLLEN) { - itterations++; - if (len + newlen + 10 > sql_len) { - sql_len = len + 10 + SQLLEN; - if (!(tmp = realloc(sqlbuf, sql_len))) { - abort(); - break; - } - sqlbuf = tmp; - } + itterations++; + + if (len + newlen + 10 < sql_len) { sprintf(sqlbuf + len, "%s;\n", sql); len += newlen; + switch_safe_free(sql); + } else { + break; } - - free(pop); } - + //printf("TRANS:\n%s\n", sqlbuf); sofia_glue_actually_execute_sql_trans(profile, sqlbuf, NULL); //sofia_glue_actually_execute_sql(profile, "commit;\n", NULL); @@ -2860,7 +2857,7 @@ switch_status_t config_sofia(int reload, char *profile_name) goto done; } - profile->trans_timeout = 500; + profile->trans_timeout = 100; profile->auto_rtp_bugs = RTP_BUG_CISCO_SKIP_MARK_BIT_2833;// | RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833; diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 82b933c..45364cd 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -2059,6 +2059,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) nua_invite(tech_pvt->nh, NUTAG_AUTOANSWER(0), NUTAG_SESSION_TIMER(session_timeout), + TAG_IF(sofia_test_flag(tech_pvt, TFLAG_RECOVERED), NUTAG_INVITE_TIMER(UINT_MAX)), TAG_IF(invite_full_from, SIPTAG_FROM_STR(invite_full_from)), TAG_IF(invite_full_to, SIPTAG_TO_STR(invite_full_to)), TAG_IF(tech_pvt->redirected, NUTAG_URL(tech_pvt->redirected)), @@ -2087,6 +2088,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) nua_invite(tech_pvt->nh, NUTAG_AUTOANSWER(0), NUTAG_SESSION_TIMER(session_timeout), + TAG_IF(sofia_test_flag(tech_pvt, TFLAG_RECOVERED), NUTAG_INVITE_TIMER(UINT_MAX)), TAG_IF(invite_full_from, SIPTAG_FROM_STR(invite_full_from)), TAG_IF(invite_full_to, SIPTAG_TO_STR(invite_full_to)), TAG_IF(tech_pvt->redirected, NUTAG_URL(tech_pvt->redirected)), @@ -4644,7 +4646,7 @@ void sofia_glue_tech_untrack(sofia_profile_t *profile, switch_core_session_t *se } } - sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); + sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE); sofia_clear_flag(tech_pvt, TFLAG_TRACKED); switch_safe_free(sql); commit d18c3a8a60bac15869fcf76cb3a93c238fa7f071 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Sep 8 15:09:09 2010 -0500 fix sql stmt diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index eb9b03d..c78ed90 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -673,8 +673,8 @@ void sofia_reg_check_expire(sofia_profile_t *profile, time_t now, int reboot) if (now && sofia_test_pflag(profile, PFLAG_NAT_OPTIONS_PING)) { switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid," "expires,user_agent,server_user,server_host,profile_name" - " from sip_registrations where (status like '%%AUTO-NAT%%' " - "or status like '%%UDP-NAT%%') and hostname='%s'", mod_sofia_globals.hostname); + " from sip_registrations where (status like '%%NAT%%' " + "or contact like '%%fs_nat=true%%') and hostname='%s'", mod_sofia_globals.hostname); sofia_glue_execute_sql_callback(profile, NULL, sql, sofia_reg_nat_callback, profile); } commit 977a8ad7ce7e72eca118df331ab0c53fda7b3a03 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Sep 8 13:19:56 2010 -0500 add origination_caller_profile to log all attempted calls for a paticular leg diff --git a/src/include/switch_caller.h b/src/include/switch_caller.h index b300208..f77f1b0 100644 --- a/src/include/switch_caller.h +++ b/src/include/switch_caller.h @@ -103,6 +103,7 @@ SWITCH_BEGIN_EXTERN_C switch_caller_profile_flag_t flags; struct switch_caller_profile *originator_caller_profile; struct switch_caller_profile *originatee_caller_profile; + struct switch_caller_profile *origination_caller_profile; struct switch_caller_profile *hunt_caller_profile; struct switch_channel_timetable *times; struct switch_caller_extension *caller_extension; diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index 247beae..3f92534 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -215,6 +215,20 @@ SWITCH_DECLARE(void) switch_channel_set_originatee_caller_profile(switch_channel */ SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_originatee_caller_profile(switch_channel_t *channel); +/*! + \brief Set the given channel's origination caller profile + \param channel channel to assign the profile to + \param caller_profile the profile to assign +*/ +SWITCH_DECLARE(void) switch_channel_set_origination_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile); + +/*! + \brief Retrive the given channel's origination caller profile + \param channel channel to retrive the profile from + \return the requested profile +*/ +SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_origination_caller_profile(switch_channel_t *channel); + /*! \brief Retrive the given channel's unique id diff --git a/src/switch_channel.c b/src/switch_channel.c index d1308a1..e3d77d7 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2035,6 +2035,36 @@ SWITCH_DECLARE(void) switch_channel_set_hunt_caller_profile(switch_channel_t *ch switch_mutex_unlock(channel->profile_mutex); } +SWITCH_DECLARE(void) switch_channel_set_origination_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile) +{ + switch_assert(channel != NULL); + switch_assert(channel->caller_profile != NULL); + + switch_mutex_lock(channel->profile_mutex); + + if (channel->caller_profile) { + caller_profile->next = channel->caller_profile->origination_caller_profile; + channel->caller_profile->origination_caller_profile = caller_profile; + } + switch_assert(channel->caller_profile->origination_caller_profile->next != channel->caller_profile->origination_caller_profile); + switch_mutex_unlock(channel->profile_mutex); +} + +SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_origination_caller_profile(switch_channel_t *channel) +{ + switch_caller_profile_t *profile = NULL; + switch_assert(channel != NULL); + + switch_mutex_lock(channel->profile_mutex); + if (channel->caller_profile) { + profile = channel->caller_profile->origination_caller_profile; + } + switch_mutex_unlock(channel->profile_mutex); + + return profile; +} + + SWITCH_DECLARE(void) switch_channel_set_originatee_caller_profile(switch_channel_t *channel, switch_caller_profile_t *caller_profile) { switch_assert(channel != NULL); diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 7413164..9e942fe 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -524,6 +524,14 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_ switch_channel_set_originator_caller_profile(peer_channel, cloned_profile); } } + + + if ((profile = switch_channel_get_caller_profile(peer_channel))) { + if ((cloned_profile = switch_caller_profile_clone(session, profile)) != 0) { + switch_channel_set_origination_caller_profile(channel, cloned_profile); + } + } + } if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_OUTGOING) == SWITCH_STATUS_SUCCESS) { diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 61deece..c1dc336 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -2012,6 +2012,21 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_generate_xml_cdr(switch_core_session_ cp_off += switch_ivr_set_xml_profile_data(x_main_cp, caller_profile, 0); + if (caller_profile->origination_caller_profile) { + switch_caller_profile_t *cp = NULL; + int off = 0; + if (!(x_o = switch_xml_add_child_d(x_main_cp, "origination", cp_off++))) { + goto error; + } + + for (cp = caller_profile->origination_caller_profile; cp; cp = cp->next) { + if (!(x_caller_profile = switch_xml_add_child_d(x_o, "origination_caller_profile", off++))) { + goto error; + } + switch_ivr_set_xml_profile_data(x_caller_profile, cp, 0); + } + } + if (caller_profile->originator_caller_profile) { switch_caller_profile_t *cp = NULL; int off = 0; commit f3c6512ca08c3d4aac9c266e89929f8ab2a6d8d4 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Sep 8 12:59:31 2010 -0500 fix build by guessing types of missing values -feeling lucky diff --git a/libs/spandsp/src/spandsp/private/t30.h b/libs/spandsp/src/spandsp/private/t30.h index 6e4ee0a..e56753e 100644 --- a/libs/spandsp/src/spandsp/private/t30.h +++ b/libs/spandsp/src/spandsp/private/t30.h @@ -207,6 +207,13 @@ struct t30_state_s /*! \brief This is only used in full duplex (e.g. ISDN) modes. */ int timer_t8; + /* These fields are guessed based on compiler error forensics, I added them to fix the build -anthm */ + int remote_interrupts_allowed; + int rtp_events; + int rtn_events; + int retransmit_capable; + /* end guessed fields */ + /*! \brief TRUE once the far end FAX entity has been detected. */ int far_end_detected; diff --git a/libs/spandsp/src/spandsp/t30.h b/libs/spandsp/src/spandsp/t30.h index 9b01d3b..9df7321 100644 --- a/libs/spandsp/src/spandsp/t30.h +++ b/libs/spandsp/src/spandsp/t30.h @@ -682,6 +682,8 @@ SPAN_DECLARE(void) t30_get_transfer_statistics(t30_state_t *s, t30_stats_t *t); \param state TRUE to enable interrupt request, else FALSE. */ SPAN_DECLARE(void) t30_local_interrupt_request(t30_state_t *s, int state); +SPAN_DECLARE(void) t30_remote_interrupts_allowed(t30_state_t *s, int state); + #if defined(__cplusplus) } #endif commit 4d448c979eadb63578ab7fc07949ac7aff9ec144 Author: Brian West <brian@freeswitch.org> Date: Wed Sep 8 11:57:57 2010 -0500 move enum to the bottom of default. diff --git a/conf/dialplan/default.xml b/conf/dialplan/default.xml index 9862eed..8abb8d8 100644 --- a/conf/dialplan/default.xml +++ b/conf/dialplan/default.xml @@ -716,15 +716,6 @@ <X-PRE-PROCESS cmd="include" data="default/*.xml"/> <!-- - WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING - - Anything you put below this line will usually get ignored due to the file in - default/99999_enum.xml as it will transfer the call to the enum dialplan. - - WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING - --> - - <!-- <extension name="refer"> <condition field="${sip_refer_to}"> <expression><![CDATA[<sip:${destination_number}@${domain_name}>]]></expression> @@ -758,7 +749,12 @@ </extension> --> - <!-- SEE WARNING ABOVE IF YOU ARE TRYING TO ADD EXTENSIONS HERE! --> + <extension name="enum"> + <condition field="${module_exists(mod_enum)}" expression="true"/> + <condition field="destination_number" expression="^(.*)$"> + <action application="transfer" data="$1 enum"/> + </condition> + </extension> </context> </include> diff --git a/conf/dialplan/default/99999_enum.xml b/conf/dialplan/default/99999_enum.xml deleted file mode 100644 index 6fd2151..0000000 --- a/conf/dialplan/default/99999_enum.xml +++ /dev/null @@ -1,8 +0,0 @@ -<include> - <extension name="enum"> - <condition field="${module_exists(mod_enum)}" expression="true"/> - <condition field="destination_number" expression="^(.*)$"> - <action application="transfer" data="$1 enum"/> - </condition> - </extension> -</include> commit 84ee0ae61be9c88267e818685df3d7743a050881 Author: Steve Underwood <steveu@coppice.org> Date: Thu Sep 9 00:16:18 2010 +0800 Fix for T.30 processing of operator interrupts, to improve compatibility with some machines, which seem to send them when no operator is around. Fix for T.38 gateway not kicking off or ending transmission under certain timing conditions. diff --git a/libs/spandsp/src/t30.c b/libs/spandsp/src/t30.c index 97c7ed8..45387b8 100644 --- a/libs/spandsp/src/t30.c +++ b/libs/spandsp/src/t30.c @@ -2377,6 +2377,8 @@ static int send_response_to_pps(t30_state_t *s) } /*- End of function --------------------------------------------------------*/ +#define VET_ALL_FCD_FRAMES + static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len) { int page; @@ -2387,6 +2389,10 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len) int frame_no; int first_bad_frame; int image_ended; +#if defined(VET_ALL_FCD_FRAMES) + int first; + int expected_len; +#endif if (len < 7) { @@ -2469,12 +2475,35 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len) /* Build a bit map of which frames we now have stored OK */ first_bad_frame = 256; +#if defined(VET_ALL_FCD_FRAMES) + first = TRUE; + expected_len = 256; +#endif for (i = 0; i < 32; i++) { s->ecm_frame_map[i + 3] = 0; for (j = 0; j < 8; j++) { frame_no = (i << 3) + j; +#if defined(VET_ALL_FCD_FRAMES) + if (s->ecm_len[frame_no] >= 0) + { + if (frame_no < s->ecm_frames - 1) + { + if (first) + { + if (s->ecm_len[frame_no] == 64) + expected_len = 64; + first = FALSE; + } + if (s->ecm_len[frame_no] != expected_len) + { + span_log(&s->logging, SPAN_LOG_FLOW, "Bad length ECM frame - %d\n", s->ecm_len[frame_no]); + s->ecm_len[frame_no] = -1; + } + } + } +#endif if (s->ecm_len[frame_no] < 0) { s->ecm_frame_map[i + 3] |= (1 << j); @@ -2524,14 +2553,18 @@ static int process_rx_pps(t30_state_t *s, const uint8_t *msg, int len) switch (s->last_pps_fcf2) { - case T30_NULL: - case T30_EOP: + case T30_PRI_MPS: + case T30_PRI_EOM: case T30_PRI_EOP: + if (s->remote_interrupts_allowed) + { + } + /* Fall through */ + case T30_NULL: + case T30_MPS: case T30_EOM: - case T30_PRI_EOM: case T30_EOS: - case T30_MPS: - case T30_PRI_MPS: + case T30_EOP: if (s->receiver_not_ready_count > 0) { s->receiver_not_ready_count--; @@ -2635,7 +2668,13 @@ static void process_rx_fcd(t30_state_t *s, const uint8_t *msg, int len) switch (s->state) { case T30_STATE_F_DOC_ECM: - if (len <= 4 + 256) + if (len > 4 + 256) + { + /* For other frame types we kill the call on an unexpected frame length. For FCD frames it is better to just ignore + the frame, and let retries sort things out. */ + span_log(&s->logging, SPAN_LOG_FLOW, "Unexpected %s frame length - %d\n", t30_frametype(msg[0]), len); + } + else { frame_no = msg[3]; /* Just store the actual image data, and record its length */ @@ -2645,10 +2684,6 @@ static void process_rx_fcd(t30_state_t *s, const uint8_t *msg, int len) /* In case we are just after a CTC/CTR exchange, which kicked us back to long training */ s->short_train = TRUE; } - else - { - unexpected_frame_length(s, msg, len); - } /* We have received something, so any missing carrier status is out of date */ if (s->current_status == T30_ERR_RX_NOCARRIER) s->current_status = T30_ERR_OK; @@ -2677,6 +2712,7 @@ static void process_rx_rcp(t30_state_t *s, const uint8_t *msg, int len) case T30_STATE_F_POST_DOC_ECM: /* Just ignore this. It must be an extra RCP. Several are usually sent, to maximise the chance of receiving a correct one. */ + timer_t2_start(s); break; default: unexpected_non_final_frame(s, msg, len); @@ -3063,6 +3099,11 @@ static void process_state_f_doc_non_ecm(t30_state_t *s, const uint8_t *msg, int case T30_DCS: process_rx_dcs(s, msg, len); break; + case T30_PRI_MPS: + if (s->remote_interrupts_allowed) + { + } + /* Fall through */ case T30_MPS: /* Treat this as a bad quality page. */ if (s->phase_d_handler) @@ -3072,16 +3113,11 @@ static void process_state_f_doc_non_ecm(t30_state_t *s, const uint8_t *msg, int set_state(s, T30_STATE_III_Q_RTN); send_simple_frame(s, T30_RTN); break; - case T30_PRI_MPS: - /* Treat this as a bad quality page. */ - if (s->phase_d_handler) + case T30_PRI_EOM: + if (s->remote_interrupts_allowed) { - s->phase_d_handler(s, s->phase_d_user_data, fcf); - s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); } - s->next_rx_step = msg[2] & 0xFE; - set_state(s, T30_STATE_III_Q_RTN); - break; + /* Fall through */ case T30_EOM: case T30_EOS: /* Treat this as a bad quality page. */ @@ -3093,16 +3129,11 @@ static void process_state_f_doc_non_ecm(t30_state_t *s, const uint8_t *msg, int set_state(s, T30_STATE_III_Q_RTN); send_simple_frame(s, T30_RTN); break; - case T30_PRI_EOM: - /* Treat this as a bad quality page. */ - if (s->phase_d_handler) + case T30_PRI_EOP: + if (s->remote_interrupts_allowed) { - s->phase_d_handler(s, s->phase_d_user_data, fcf); - s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); } - s->next_rx_step = T30_PRI_EOM; - set_state(s, T30_STATE_III_Q_RTN); - break; + /* Fall through */ case T30_EOP: /* Treat this as a bad quality page. */ if (s->phase_d_handler) @@ -3112,16 +3143,6 @@ static void process_state_f_doc_non_ecm(t30_state_t *s, const uint8_t *msg, int set_state(s, T30_STATE_III_Q_RTN); send_simple_frame(s, T30_RTN); break; - case T30_PRI_EOP: - /* Treat this as a bad quality page. */ - if (s->phase_d_handler) - { - s->phase_d_handler(s, s->phase_d_user_data, fcf); - s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); - } - s->next_rx_step = msg[2] & 0xFE; - set_state(s, T30_STATE_III_Q_RTN); - break; case T30_DCN: s->current_status = T30_ERR_RX_DCNDATA; disconnect(s); @@ -3148,6 +3169,11 @@ static void process_state_f_post_doc_non_ecm(t30_state_t *s, const uint8_t *msg, fcf = msg[2] & 0xFE; switch (fcf) { + case T30_PRI_MPS: + if (s->remote_interrupts_allowed) + { + } + /* Fall through */ case T30_MPS: s->next_rx_step = fcf; queue_phase(s, T30_PHASE_D_TX); @@ -3179,41 +3205,11 @@ static void process_state_f_post_doc_non_ecm(t30_state_t *s, const uint8_t *msg, break; } break; - case T30_PRI_MPS: - s->next_rx_step = fcf; - switch (copy_quality(s)) + case T30_PRI_EOM: + if (s->remote_interrupts_allowed) { - case T30_COPY_QUALITY_PERFECT: - case T30_COPY_QUALITY_GOOD: - rx_end_page(s); - if (s->phase_d_handler) - { - s->phase_d_handler(s, s->phase_d_user_data, fcf); - s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); - } - terminate_operation_in_progress(s); - set_state(s, T30_STATE_III_Q_MCF); - break; - case T30_COPY_QUALITY_POOR: - rx_end_page(s); - if (s->phase_d_handler) - { - s->phase_d_handler(s, s->phase_d_user_data, fcf); - s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); - } - terminate_operation_in_progress(s); - set_state(s, T30_STATE_III_Q_RTP); - break; - case T30_COPY_QUALITY_BAD: - if (s->phase_d_handler) - { - s->phase_d_handler(s, s->phase_d_user_data, fcf); - s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); - } - set_state(s, T30_STATE_III_Q_RTN); - break; } - break; + /* Fall through */ case T30_EOM: case T30_EOS: s->next_rx_step = fcf; @@ -3247,41 +3243,11 @@ static void process_state_f_post_doc_non_ecm(t30_state_t *s, const uint8_t *msg, break; } break; - case T30_PRI_EOM: - s->next_rx_step = fcf; - switch (copy_quality(s)) + case T30_PRI_EOP: + if (s->remote_interrupts_allowed) { - case T30_COPY_QUALITY_PERFECT: - case T30_COPY_QUALITY_GOOD: - rx_end_page(s); - if (s->phase_d_handler) - { - s->phase_d_handler(s, s->phase_d_user_data, fcf); - s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); - } - terminate_operation_in_progress(s); - set_state(s, T30_STATE_III_Q_MCF); - break; - case T30_COPY_QUALITY_POOR: - rx_end_page(s); - if (s->phase_d_handler) - { - s->phase_d_handler(s, s->phase_d_user_data, fcf); - s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); - } - terminate_operation_in_progress(s); - set_state(s, T30_STATE_III_Q_RTP); - break; - case T30_COPY_QUALITY_BAD: - if (s->phase_d_handler) - { - s->phase_d_handler(s, s->phase_d_user_data, fcf); - s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); - } - set_state(s, T30_STATE_III_Q_RTN); - break; } - break; + /* Fall through */ case T30_EOP: s->next_rx_step = fcf; queue_phase(s, T30_PHASE_D_TX); @@ -3312,41 +3278,6 @@ static void process_state_f_post_doc_non_ecm(t30_state_t *s, const uint8_t *msg, break; } break; - case T30_PRI_EOP: - s->next_rx_step = fcf; - switch (copy_quality(s)) - { - case T30_COPY_QUALITY_PERFECT: - case T30_COPY_QUALITY_GOOD: - rx_end_page(s); - if (s->phase_d_handler) - { - s->phase_d_handler(s, s->phase_d_user_data, fcf); - s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); - } - terminate_operation_in_progress(s); - set_state(s, T30_STATE_III_Q_MCF); - break; - case T30_COPY_QUALITY_POOR: - rx_end_page(s); - if (s->phase_d_handler) - { - s->phase_d_handler(s, s->phase_d_user_data, fcf); - s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); - } - terminate_operation_in_progress(s); - set_state(s, T30_STATE_III_Q_RTP); - break; - case T30_COPY_QUALITY_BAD: - if (s->phase_d_handler) - { - s->phase_d_handler(s, s->phase_d_user_data, fcf); - s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); - } - set_state(s, T30_STATE_III_Q_RTN); - break; - } - break; case T30_DCN: s->current_status = T30_ERR_RX_DCNFAX; disconnect(s); @@ -3384,21 +3315,7 @@ static void process_state_f_doc_and_post_doc_ecm(t30_state_t *s, const uint8_t * case T4_RCP: /* Return to control for partial page. These might come through with or without the final frame tag. Here we deal with the "final frame tag" case. */ - if (s->state == T30_STATE_F_DOC_ECM) - { - /* Return to control for partial page */ - set_state(s, T30_STATE_F_POST_DOC_ECM); - queue_phase(s, T30_PHASE_D_RX); - timer_t2_start(s); - /* We have received something, so any missing carrier status is out of date */ - if (s->current_status == T30_ERR_RX_NOCARRIER) - s->current_status = T30_ERR_OK; - } - else - { - /* Just ignore this. It must be an extra RCP. Several are usually sent, to maximise the chance - of receiving a correct one. */ - } + process_rx_rcp(s, msg, len); break; case T30_EOR: if (len != 4) @@ -3413,7 +3330,10 @@ static void process_state_f_doc_and_post_doc_ecm(t30_state_t *s, const uint8_t * case T30_PRI_EOP: case T30_PRI_EOM: case T30_PRI_MPS: - /* TODO: Alert operator */ + if (s->remote_interrupts_allowed) + { + /* TODO: Alert operator */ + } /* Fall through */ case T30_NULL: case T30_EOP: @@ -3651,11 +3571,22 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len) fcf = msg[2] & 0xFE; switch (fcf) { + case T30_PIP: + if (s->remote_interrupts_allowed) + { + s->retries = 0; + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } + } + /* Fall through */ case T30_MCF: switch (s->next_tx_step) { - case T30_MPS: case T30_PRI_MPS: + case T30_MPS: tx_end_page(s); if (s->phase_d_handler) s->phase_d_handler(s, s->phase_d_user_data, fcf); @@ -3668,8 +3599,8 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len) set_state(s, T30_STATE_I); queue_phase(s, T30_PHASE_C_NON_ECM_TX); break; - case T30_EOM: case T30_PRI_EOM: + case T30_EOM: case T30_EOS: tx_end_page(s); if (s->phase_d_handler) @@ -3678,8 +3609,8 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len) report_tx_result(s, TRUE); return_to_phase_b(s, FALSE); break; - case T30_EOP: case T30_PRI_EOP: + case T30_EOP: tx_end_page(s); if (s->phase_d_handler) s->phase_d_handler(s, s->phase_d_user_data, fcf); @@ -3690,13 +3621,11 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len) } break; case T30_RTP: -#if 0 s->rtp_events++; -#endif switch (s->next_tx_step) { - case T30_MPS: case T30_PRI_MPS: + case T30_MPS: tx_end_page(s); if (s->phase_d_handler) s->phase_d_handler(s, s->phase_d_user_data, fcf); @@ -3717,8 +3646,8 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len) queue_phase(s, T30_PHASE_B_TX); restart_sending_document(s); break; - case T30_EOM: case T30_PRI_EOM: + case T30_EOM: case T30_EOS: tx_end_page(s); if (s->phase_d_handler) @@ -3727,8 +3656,8 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len) /* TODO: should go back to T, and resend */ return_to_phase_b(s, TRUE); break; - case T30_EOP: case T30_PRI_EOP: + case T30_EOP: tx_end_page(s); if (s->phase_d_handler) s->phase_d_handler(s, s->phase_d_user_data, fcf); @@ -3737,20 +3666,27 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len) break; } break; + case T30_PIN: + if (s->remote_interrupts_allowed) + { + s->retries = 0; + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } + } + /* Fall through */ case T30_RTN: -#if 0 s->rtn_events++; -#endif switch (s->next_tx_step) { - case T30_MPS: case T30_PRI_MPS: + case T30_MPS: s->retries = 0; if (s->phase_d_handler) s->phase_d_handler(s, s->phase_d_user_data, fcf); -#if 0 if (!s->retransmit_capable) -#endif { /* Send the next page, regardless of the problem with the current one. */ if (tx_start_page(s)) @@ -3771,29 +3707,26 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len) queue_phase(s, T30_PHASE_B_TX); restart_sending_document(s); break; - case T30_EOM: case T30_PRI_EOM: + case T30_EOM: case T30_EOS: s->retries = 0; if (s->phase_d_handler) s->phase_d_handler(s, s->phase_d_user_data, fcf); -#if 0 if (s->retransmit_capable) { /* Wait for DIS */ } else -#endif { return_to_phase_b(s, TRUE); } break; - case T30_EOP: case T30_PRI_EOP: + case T30_EOP: s->retries = 0; if (s->phase_d_handler) s->phase_d_handler(s, s->phase_d_user_data, fcf); -#if 0 if (s->retransmit_capable) { /* Send fresh training, and then repeat the last page */ @@ -3809,36 +3742,19 @@ static void process_state_ii_q(t30_state_t *s, const uint8_t *msg, int len) restart_sending_document(s); } else -#endif { send_dcn(s); } break; } break; - case T30_PIP: - s->retries = 0; - if (s->phase_d_handler) - { - s->phase_d_handler(s, s->phase_d_user_data, fcf); - s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); - } - break; - case T30_PIN: - s->retries = 0; - if (s->phase_d_handler) - { - s->phase_d_handler(s, s->phase_d_user_data, fcf); - s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); - } - break; case T30_DCN: switch (s->next_tx_step) { - case T30_MPS: case T30_PRI_MPS: - case T30_EOM: case T30_PRI_EOM: + case T30_MPS: + case T30_EOM: case T30_EOS: /* Unexpected DCN after EOM, EOS or MPS sequence */ s->current_status = T30_ERR_RX_DCNPHD; @@ -4019,8 +3935,8 @@ static void process_state_iv_pps_null(t30_state_t *s, const uint8_t *msg, int le span_log(&s->logging, SPAN_LOG_FLOW, "Moving on to the next page\n"); switch (s->next_tx_step) { - case T30_MPS: case T30_PRI_MPS: + case T30_MPS: tx_end_page(s); if (s->phase_d_handler) s->phase_d_handler(s, s->phase_d_user_data, fcf); @@ -4036,8 +3952,8 @@ static void process_state_iv_pps_null(t30_state_t *s, const uint8_t *msg, int le send_first_ecm_frame(s); } break; - case T30_EOM: case T30_PRI_EOM: + case T30_EOM: case T30_EOS: tx_end_page(s); if (s->phase_d_handler) @@ -4046,8 +3962,8 @@ static void process_state_iv_pps_null(t30_state_t *s, const uint8_t *msg, int le report_tx_result(s, TRUE); return_to_phase_b(s, FALSE); break; - case T30_EOP: case T30_PRI_EOP: + case T30_EOP: tx_end_page(s); if (s->phase_d_handler) s->phase_d_handler(s, s->phase_d_user_data, fcf); @@ -4094,6 +4010,17 @@ static void process_state_iv_pps_q(t30_state_t *s, const uint8_t *msg, int len) fcf = msg[2] & 0xFE; switch (fcf) { + case T30_PIP: + if (s->remote_interrupts_allowed) + { + s->retries = 0; + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } + } + /* Fall through */ case T30_MCF: s->retries = 0; s->timer_t5 = 0; @@ -4112,8 +4039,8 @@ static void process_state_iv_pps_q(t30_state_t *s, const uint8_t *msg, int len) span_log(&s->logging, SPAN_LOG_FLOW, "Moving on to the next page\n"); switch (s->next_tx_step) { - case T30_MPS: case T30_PRI_MPS: + case T30_MPS: tx_end_page(s); if (s->phase_d_handler) s->phase_d_handler(s, s->phase_d_user_data, fcf); @@ -4129,8 +4056,8 @@ static void process_state_iv_pps_q(t30_state_t *s, const uint8_t *msg, int len) send_first_ecm_frame(s); } break; - case T30_EOM: case T30_PRI_EOM: + case T30_EOM: case T30_EOS: tx_end_page(s); if (s->phase_d_handler) @@ -4139,8 +4066,8 @@ static void process_state_iv_pps_q(t30_state_t *s, const uint8_t *msg, int len) report_tx_result(s, TRUE); return_to_phase_b(s, FALSE); break; - case T30_EOP: case T30_PRI_EOP: + case T30_EOP: tx_end_page(s); if (s->phase_d_handler) s->phase_d_handler(s, s->phase_d_user_data, fcf); @@ -4158,22 +4085,6 @@ static void process_state_iv_pps_q(t30_state_t *s, const uint8_t *msg, int len) set_state(s, T30_STATE_IV_PPS_RNR); send_rr(s); break; - case T30_PIP: - s->retries = 0; - if (s->phase_d_handler) - { - s->phase_d_handler(s, s->phase_d_user_data, fcf); - s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); - } - break; - case T30_PIN: - s->retries = 0; - if (s->phase_d_handler) - { - s->phase_d_handler(s, s->phase_d_user_data, fcf); - s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); - } - break; case T30_PPR: process_rx_ppr(s, msg, len); break; @@ -4187,6 +4098,17 @@ static void process_state_iv_pps_q(t30_state_t *s, const uint8_t *msg, int len) case T30_FNV: process_rx_fnv(s, msg, len); break; + case T30_PIN: + if (s->remote_interrupts_allowed) + { + s->retries = 0; + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } + } + /* Fall through */ default: /* We don't know what to do with this. */ unexpected_final_frame(s, msg, len); @@ -4203,6 +4125,17 @@ static void process_state_iv_pps_rnr(t30_state_t *s, const uint8_t *msg, int len fcf = msg[2] & 0xFE; switch (fcf) { + case T30_PIP: + if (s->remote_interrupts_allowed) + { + s->retries = 0; + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } + } + /* Fall through */ case T30_MCF: s->retries = 0; s->timer_t5 = 0; @@ -4221,8 +4154,8 @@ static void process_state_iv_pps_rnr(t30_state_t *s, const uint8_t *msg, int len span_log(&s->logging, SPAN_LOG_FLOW, "Moving on to the next page\n"); switch (s->next_tx_step) { - case T30_MPS: case T30_PRI_MPS: + case T30_MPS: tx_end_page(s); if (s->phase_d_handler) s->phase_d_handler(s, s->phase_d_user_data, fcf); @@ -4238,8 +4171,8 @@ static void process_state_iv_pps_rnr(t30_state_t *s, const uint8_t *msg, int len send_first_ecm_frame(s); } break; - case T30_EOM: case T30_PRI_EOM: + case T30_EOM: case T30_EOS: tx_end_page(s); if (s->phase_d_handler) @@ -4248,8 +4181,8 @@ static void process_state_iv_pps_rnr(t30_state_t *s, const uint8_t *msg, int len report_tx_result(s, TRUE); return_to_phase_b(s, FALSE); break; - case T30_EOP: case T30_PRI_EOP: + case T30_EOP: tx_end_page(s); if (s->phase_d_handler) s->phase_d_handler(s, s->phase_d_user_data, fcf); @@ -4267,22 +4200,6 @@ static void process_state_iv_pps_rnr(t30_state_t *s, const uint8_t *msg, int len set_state(s, T30_STATE_IV_PPS_RNR); send_rr(s); break; - case T30_PIP: - s->retries = 0; - if (s->phase_d_handler) - { - s->phase_d_handler(s, s->phase_d_user_data, fcf); - s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); - } - break; - case T30_PIN: - s->retries = 0; - if (s->phase_d_handler) - { - s->phase_d_handler(s, s->phase_d_user_data, fcf); - s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); - } - break; case T30_DCN: s->current_status = T30_ERR_RX_DCNRRD; disconnect(s); @@ -4293,6 +4210,17 @@ static void process_state_iv_pps_rnr(t30_state_t *s, const uint8_t *msg, int len case T30_FNV: process_rx_fnv(s, msg, len); break; + case T30_PIN: + if (s->remote_interrupts_allowed) + { + s->retries = 0; + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } + } + /* Fall through */ default: /* We don't know what to do with this. */ unexpected_final_frame(s, msg, len); @@ -4345,14 +4273,6 @@ static void process_state_iv_eor(t30_state_t *s, const uint8_t *msg, int len) set_state(s, T30_STATE_IV_EOR_RNR); send_rr(s); break; - case T30_PIN: - s->retries = 0; - if (s->phase_d_handler) - { - s->phase_d_handler(s, s->phase_d_user_data, fcf); - s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); - } - break; case T30_ERR: /* TODO: Continue with the next message if MPS or EOM? */ s->timer_t5 = 0; @@ -4364,6 +4284,17 @@ static void process_state_iv_eor(t30_state_t *s, const uint8_t *msg, int len) case T30_FNV: process_rx_fnv(s, msg, len); break; + case T30_PIN: + if (s->remote_interrupts_allowed) + { + s->retries = 0; + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } + } + /* Fall through */ default: /* We don't know what to do with this. */ unexpected_final_frame(s, msg, len); @@ -4386,14 +4317,6 @@ static void process_state_iv_eor_rnr(t30_state_t *s, const uint8_t *msg, int len set_state(s, T30_STATE_IV_EOR_RNR); send_rr(s); break; - case T30_PIN: - s->retries = 0; - if (s->phase_d_handler) - { - s->phase_d_handler(s, s->phase_d_user_data, fcf); - s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); - } - break; case T30_ERR: /* TODO: Continue with the next message if MPS or EOM? */ s->timer_t5 = 0; @@ -4409,6 +4332,17 @@ static void process_state_iv_eor_rnr(t30_state_t *s, const uint8_t *msg, int len case T30_FNV: process_rx_fnv(s, msg, len); break; + case T30_PIN: + if (s->remote_interrupts_allowed) + { + s->retries = 0; + if (s->phase_d_handler) + { + s->phase_d_handler(s, s->phase_d_user_data, fcf); + s->timer_t3 = ms_to_samples(DEFAULT_TIMER_T3); + } + } + /* Fall through */ default: /* We don't know what to do with this. */ unexpected_final_frame(s, msg, len); @@ -4596,7 +4530,7 @@ static void process_rx_control_msg(t30_state_t *s, const uint8_t *msg, int len) /* The following handles context sensitive message types, which should occur at the end of message sequences. They should, therefore have the final frame flag set. */ - span_log(&s->logging, SPAN_LOG_FLOW, "In state %d\n", s->state); + span_log(&s->logging, SPAN_LOG_FLOW, "Rx final frame in state %d\n", s->state); switch (s->state) { @@ -5082,11 +5016,11 @@ static void timer_t2_expired(t30_state_t *s) case T30_STATE_F_POST_RCP_MCF: switch (s->next_rx_step) { - case T30_EOM: case T30_PRI_EOM: + case T30_EOM: case T30_EOS: /* We didn't receive a response to our T30_MCF after T30_EOM, so we must be OK - to proceed to phase B, and pretty act like its the beginning of a call. */ + to proceed to phase B, and pretty much act like its the beginning of a call. */ span_log(&s->logging, SPAN_LOG_FLOW, "Returning to phase B after %s\n", t30_frametype(s->next_rx_step)); set_phase(s, T30_PHASE_B_TX); timer_t2_start(s); @@ -5109,6 +5043,8 @@ static void timer_t2_expired(t30_state_t *s) case T30_STATE_F_POST_DOC_ECM: case T30_STATE_F_POST_DOC_NON_ECM: /* While waiting for next FAX page */ + /* Figure 5-2b/T.30 and note 7 says we should allow 1 to 3 tries at this point. + The way we work now is effectively hard coding a 1 try limit */ s->current_status = T30_ERR_RX_T2EXPMPS; break; #if 0 @@ -5873,8 +5809,8 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status) { switch (s->next_rx_step) { - case T30_MPS: case T30_PRI_MPS: + case T30_MPS: /* We should now start to get another page */ if (s->error_correcting_mode) { @@ -5888,15 +5824,15 @@ SPAN_DECLARE(void) t30_front_end_status(void *user_data, int status) } timer_t2_start(s); break; - case T30_EOM: case T30_PRI_EOM: + case T30_EOM: case T30_EOS: /* See if we get something back, before moving to phase B. */ timer_t2_start(s); set_phase(s, T30_PHASE_D_RX); break; - case T30_EOP: case T30_PRI_EOP: + case T30_EOP: /* Wait for a DCN. */ set_phase(s, T30_PHASE_D_RX); timer_t4_start(s); @@ -6256,6 +6192,12 @@ SPAN_DECLARE(void) t30_local_interrupt_request(t30_state_t *s, int state) } /*- End of function --------------------------------------------------------*/ +SPAN_DECLARE(void) t30_remote_interrupts_allowed(t30_state_t *s, int state) +{ + s->remote_interrupts_allowed = state; +} +/*- End of function --------------------------------------------------------*/ + SPAN_DECLARE(int) t30_restart(t30_state_t *s) { s->phase = T30_PHASE_IDLE; @@ -6276,10 +6218,9 @@ SPAN_DECLARE(int) t30_restart(t30_state_t *s) /* The page number is only reset at call establishment */ s->rx_page_number = 0; s->tx_page_number = 0; -#if 0 s->rtn_events = 0; s->rtp_events = 0; -#endif + s->local_interrupt_pending = FALSE; s->far_end_detected = FALSE; s->timer_t0_t1 = ms_to_samples(DEFAULT_TIMER_T0); if (s->calling_party) diff --git a/libs/spandsp/src/t31.c b/libs/spandsp/src/t31.c index 5c9c406..22af0fc 100644 --- a/libs/spandsp/src/t31.c +++ b/libs/spandsp/src/t31.c @@ -2602,7 +2602,9 @@ SPAN_DECLARE(t31_state_t *) t31_init(t31_state_t *s, t38_tx_packet_handler_t *tx_t38_packet_handler, void *tx_t38_packet_user_data) { +#if 0 v8_parms_t v8_parms; +#endif int alloced; if (at_tx_handler == NULL || modem_control_handler == NULL) diff --git a/libs/spandsp/src/t38_gateway.c b/libs/spandsp/src/t38_gateway.c index a572b5d..d3539cd 100644 --- a/libs/spandsp/src/t38_gateway.c +++ b/libs/spandsp/src/t38_gateway.c @@ -426,7 +426,6 @@ static int set_next_tx_type(t38_gateway_state_t *s) t38_gateway_hdlc_state_t *u; t = &s->audio.modems; - u = &s->core.hdlc_to_modem; t38_non_ecm_buffer_report_output_status(&s->core.non_ecm_to_modem, &s->logging); if (t->next_tx_handler) { @@ -447,6 +446,7 @@ static int set_next_tx_type(t38_gateway_state_t *s) return TRUE; } /*endif*/ + u = &s->core.hdlc_to_modem; if (u->in == u->out) return FALSE; /*endif*/ @@ -1057,7 +1057,9 @@ static int process_rx_missing(t38_core_state_t *t, void *user_data, int rx_seq_n static int process_rx_indicator(t38_core_state_t *t, void *user_data, int indicator) { t38_gateway_state_t *s; - + t38_gateway_hdlc_state_t *u; + int immediate; + s = (t38_gateway_state_t *) user_data; t38_non_ecm_buffer_report_input_status(&s->core.non_ecm_to_modem, &s->logging); @@ -1067,25 +1069,50 @@ static int process_rx_indicator(t38_core_state_t *t, void *user_data, int indica return 0; } /*endif*/ - if (s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in].contents) + + u = &s->core.hdlc_to_modem; + immediate = (u->in == u->out); + if (u->buf[u->in].contents) { - if (++s->core.hdlc_to_modem.in >= T38_TX_HDLC_BUFS) - s->core.hdlc_to_modem.in = 0; + if (++u->in >= T38_TX_HDLC_BUFS) + u->in = 0; /*endif*/ } /*endif*/ - s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in].contents = (indicator | FLAG_INDICATOR); - if (++s->core.hdlc_to_modem.in >= T38_TX_HDLC_BUFS) - s->core.hdlc_to_modem.in = 0; + u->buf[u->in].contents = (indicator | FLAG_INDICATOR); + if (++u->in >= T38_TX_HDLC_BUFS) + u->in = 0; /*endif*/ - t38_non_ecm_buffer_set_mode(&s->core.non_ecm_to_modem, s->core.image_data_mode, s->core.min_row_bits); - span_log(&s->logging, - SPAN_LOG_FLOW, - "Queued change - (%d) %s -> %s\n", - silence_gen_remainder(&(s->audio.modems.silence_gen)), - t38_indicator_to_str(t->current_rx_indicator), - t38_indicator_to_str(indicator)); + if (immediate) + { + span_log(&s->logging, + SPAN_LOG_FLOW, + "Changing - (%d) %s -> %s\n", + silence_gen_remainder(&(s->audio.modems.silence_gen)), + t38_indicator_to_str(t->current_rx_indicator), + t38_indicator_to_str(indicator)); + switch (s->t38x.current_rx_field_class) + { + case T38_FIELD_CLASS_NONE: + break; + case T38_FIELD_CLASS_HDLC: + span_log(&s->logging, SPAN_LOG_FLOW, "HDLC shutdown\n"); + hdlc_tx_frame(&s->audio.modems.hdlc_tx, NULL, 0); + break; + case T38_FIELD_CLASS_NON_ECM: + break; + } + } + else + { + span_log(&s->logging, + SPAN_LOG_FLOW, + "Queued change - (%d) %s -> %s\n", + silence_gen_remainder(&(s->audio.modems.silence_gen)), + t38_indicator_to_str(t->current_rx_indicator), + t38_indicator_to_str(indicator)); + } s->t38x.current_rx_field_class = T38_FIELD_CLASS_NONE; /* We need to set this here, since we might have been called as a fake indication when the real one was missing */ @@ -1440,6 +1467,8 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, xx->corrupt_current_frame[0] = FALSE; break; case T38_FIELD_T4_NON_ECM_DATA: + if (xx->current_rx_field_class == T38_FIELD_CLASS_NONE) + t38_non_ecm_buffer_set_mode(&s->core.non_ecm_to_modem, s->core.image_data_mode, s->core.min_row_bits); xx->current_rx_field_class = T38_FIELD_CLASS_NON_ECM; hdlc_buf = &s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in]; if (hdlc_buf->contents != (data_type | FLAG_DATA)) @@ -1454,6 +1483,8 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, xx->corrupt_current_frame[0] = FALSE; break; case T38_FIELD_T4_NON_ECM_SIG_END: + if (xx->current_rx_field_class == T38_FIELD_CLASS_NONE) + t38_non_ecm_buffer_set_mode(&s->core.non_ecm_to_modem, s->core.image_data_mode, s->core.min_row_bits); hdlc_buf = &s->core.hdlc_to_modem.buf[s->core.hdlc_to_modem.in]; /* Some T.38 implementations send multiple T38_FIELD_T4_NON_ECM_SIG_END messages, in IFP packets with incrementing sequence numbers, which are actually repeats. They get through to this point because @@ -2432,8 +2463,8 @@ SPAN_DECLARE(t38_gateway_state_t *) t38_gateway_init(t38_gateway_state_t *s, s->core.to_t38.octets_per_data_packet = 1; s->core.ecm_allowed = TRUE; - t38_non_ecm_buffer_init(&s->core.non_ecm_to_modem, FALSE, 0); //s->core.ms_per_tx_chunk = DEFAULT_MS_PER_TX_CHUNK; + t38_non_ecm_buffer_init(&s->core.non_ecm_to_modem, FALSE, 0); restart_rx_modem(s); s->core.timed_mode = TIMED_MODE_STARTUP; s->core.samples_to_timeout = 1; diff --git a/libs/spandsp/src/v18.c b/libs/spandsp/src/v18.c index 18d94b4..bb26644 100644 --- a/libs/spandsp/src/v18.c +++ b/libs/spandsp/src/v18.c @@ -111,7 +111,7 @@ static const struct dtmf_to_ascii_s dtmf_to_ascii[] = {"##8", 'W'}, {"##9", 'Z'}, {"##0", ' '}, -#if defined(WIN32) || ( defined(__SVR4) && defined (__sun)) +#if defined(WIN32) || ( defined(__SVR4) && defined (__sun)) {"#*1", 'X'}, // (Note 1) 111 1011 {"#*2", 'X'}, // (Note 1) 111 1100 {"#*3", 'X'}, // (Note 1) 111 1101 commit aa7c9b898a292a461347cb9191361f918e89e654 Merge: dc51ccb d18c3a8 Author: Moises Silva <moy@sangoma.com> Date: Wed Sep 8 12:12:15 2010 -0400 Merge commit 'fsorig/master' commit dc51ccbec18a223beccfc5f8cbde063e6950e0bd Author: David Yat Sin <dyatsin@sangoma.com> Date: Tue Sep 7 13:28:30 2010 -0400 freetdm:ftmod_sangoma_isdn changes Minor fixes to glare testing, add check for INBAND TONES available in ALERT msgs Fix for handling T310 expiring Minor fixes to glare testing Fixed handling for Progress with cause Support for facility timeout diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 9ffd709..e962ece 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -189,7 +189,8 @@ ftdm_state_map_t sangoma_isdn_state_map = { ZSD_OUTBOUND, ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_DIALING, FTDM_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_DOWN, FTDM_END} + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS, + FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_DOWN, FTDM_END} }, { ZSD_OUTBOUND, @@ -558,6 +559,9 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) /* We are hangup local call because there was a glare, we are waiting for a RELEASE on this call, before we can process the saved call */ ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Waiting for RELEASE on hungup glared call\n"); + } else if (sngisdn_test_flag(sngisdn_info, FLAG_SEND_DISC)) { + /* Remote side sent a PROGRESS message, but cause indicates disconnect or T310 expired*/ + sngisdn_snd_disconnect(ftdmchan); } else { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Hanging up call upon local request!\n"); @@ -568,16 +572,15 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) if (ftdmchan->last_state == FTDM_CHANNEL_STATE_RING || ftdmchan->last_state == FTDM_CHANNEL_STATE_DIALING) { + sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); + sngisdn_snd_release(ftdmchan, 0); + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) { sng_isdn_set_avail_rate(ftdmchan->span, SNGISDN_AVAIL_DOWN); } - - sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); - sngisdn_snd_release(ftdmchan, 0); } else { sngisdn_snd_disconnect(ftdmchan); } - } /* now go to the HANGUP complete state */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 3f63fbc..5f26828 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -68,6 +68,7 @@ typedef enum { FLAG_GLARE = (1 << 6), FLAG_DELAYED_REL = (1 << 7), FLAG_SENT_PROCEED = (1 << 8), + FLAG_SEND_DISC = (1 << 9), } sngisdn_flag_t; @@ -127,6 +128,13 @@ typedef enum { SNGISDN_EVENT_RST_IND, } ftdm_sngisdn_event_id_t; +/* Only timers that can be cancelled are listed here */ +#define SNGISDN_NUM_TIMERS 1 +/* Increase NUM_TIMERS as number of ftdm_sngisdn_timer_t increases */ +typedef enum { + SNGISDN_TIMER_FACILITY = 0, +} ftdm_sngisdn_timer_t; + typedef struct sngisdn_glare_data { int16_t suId; uint32_t suInstId; @@ -148,6 +156,7 @@ typedef struct sngisdn_chan_data { uint8_t globalFlg; sngisdn_glare_data_t glare; + ftdm_timer_t *timers[SNGISDN_NUM_TIMERS]; } sngisdn_chan_data_t; /* Span specific data */ @@ -165,6 +174,7 @@ typedef struct sngisdn_span_data { uint8_t overlap_dial; uint8_t setup_arb; uint8_t facility; + int8_t facility_timeout; ftdm_sched_t *sched; ftdm_queue_t *event_queue; } sngisdn_span_data_t; @@ -223,8 +233,8 @@ typedef struct sngisdn_cc { ftdm_trunk_type_t trunktype; uint32_t last_suInstId; ftdm_mutex_t *mutex; - sngisdn_chan_data_t *active_spInstIds[MAX_INSTID]; - sngisdn_chan_data_t *active_suInstIds[MAX_INSTID]; + sngisdn_chan_data_t *active_spInstIds[MAX_INSTID+1]; + sngisdn_chan_data_t *active_suInstIds[MAX_INSTID+1]; }sngisdn_cc_t; /* Global sngisdn data */ @@ -349,6 +359,7 @@ void sngisdn_set_span_sig_status(ftdm_span_t *ftdmspan, ftdm_signaling_status_t void sngisdn_delayed_release(void* p_sngisdn_info); void sngisdn_delayed_connect(void* p_sngisdn_info); void sngisdn_delayed_disconnect(void* p_sngisdn_info); +void sngisdn_facility_timeout(void* p_sngisdn_info); /* Stack management functions */ ftdm_status_t sng_isdn_stack_cfg(ftdm_span_t *span); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c index ec44142..96eaf05 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c @@ -249,6 +249,11 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ ftdm_span_set_bearer_capability(val, &span->default_caller_data.bearer_capability); } else if (!strcasecmp(var, "outbound-bearer_layer1")) { ftdm_span_set_bearer_layer1(val, &span->default_caller_data.bearer_layer1); + } else if (!strcasecmp(var, "facility-timeout")) { + signal_data->facility_timeout = atoi(val); + if (signal_data->facility_timeout < 0) { + signal_data->facility_timeout = 0; + } } else { ftdm_log(FTDM_LOG_WARNING, "Ignoring unknown parameter %s\n", ftdm_parameters[paramindex].var); } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index c3d97e5..ff9a53b 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -78,14 +78,13 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) } sngisdn_info->suInstId = get_unique_suInstId(suId); - sngisdn_info->spInstId = spInstId; + sngisdn_info->spInstId = spInstId; /* If this is a glared call that was previously saved, we moved all the info to the current call, so clear the glared saved data */ - if (sngisdn_info->glare.spInstId == spInstId) { clear_call_glare_data(sngisdn_info); - } + } ftdm_mutex_lock(g_sngisdn_data.ccs[suId].mutex); g_sngisdn_data.ccs[suId].active_suInstIds[sngisdn_info->suInstId] = sngisdn_info; @@ -105,7 +104,8 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_TEMPORARY_FAILURE; ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); break; - } + } + /* Fill in call information */ cpy_calling_num_from_stack(&ftdmchan->caller_data, &conEvnt->cgPtyNmb); cpy_called_num_from_stack(&ftdmchan->caller_data, &conEvnt->cdPtyNmb); @@ -142,6 +142,10 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) if (ret_val == 1) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Expecting Caller name in FACILITY\n"); ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_GET_CALLERID); + /* Launch timer in case we never get a FACILITY msg */ + if (signal_data->facility_timeout) { + ftdm_sched_timer(signal_data->sched, "facility_timeout", signal_data->facility_timeout, sngisdn_facility_timeout, (void*) sngisdn_info, &sngisdn_info->timers[SNGISDN_TIMER_FACILITY]); + } break; } else if (ret_val == 0) { strcpy(ftdmchan->caller_data.cid_name, retrieved_str); @@ -289,6 +293,8 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + CnStEvnt *cnStEvnt = &sngisdn_event->event.cnStEvnt; ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n"); @@ -302,19 +308,49 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) suId, suInstId, spInstId, ces); switch(evntType) { + case MI_PROGRESS: + if (signal_data->switchtype == SNGISDN_SWITCH_NI2 && + cnStEvnt->causeDgn[0].eh.pres && cnStEvnt->causeDgn[0].causeVal.pres) { + + switch(cnStEvnt->causeDgn[0].causeVal.val) { + case 17: /* User Busy */ + case 18: /* No User responding */ + case 19: /* User alerting, no answer */ + case 21: /* Call rejected, the called party does not with to accept this call */ + case 27: /* Destination out of order */ + case 31: /* Normal, unspecified */ + case 34: /* Circuit/Channel congestion */ + case 41: /* Temporary failure */ + case 42: /* Switching equipment is experiencing a period of high traffic */ + case 47: /* Resource unavailable */ + case 58: /* Bearer Capability not available */ + case 63: /* Service or option not available */ + case 65: /* Bearer Cap not implemented, not supported */ + case 79: /* Service or option not implemented, unspecified */ + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Cause requires disconnect (cause:%d)\n", cnStEvnt->causeDgn[0].causeVal.val); + ftdmchan->caller_data.hangup_cause = cnStEvnt->causeDgn[0].causeVal.val; + + sngisdn_set_flag(sngisdn_info, FLAG_SEND_DISC); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + goto sngisdn_process_cnst_ind_end; + } + } + /* fall-through */ case MI_ALERTING: case MI_CALLPROC: - case MI_PROGRESS: + switch(ftdmchan->state) { - case FTDM_CHANNEL_STATE_DIALING: - if (evntType == MI_PROGRESS) { + case FTDM_CHANNEL_STATE_DIALING: + if (evntType == MI_PROGRESS || + (cnStEvnt->progInd.eh.pres && cnStEvnt->progInd.progDesc.val == IN_PD_IBAVAIL)) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); } else { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); } break; case FTDM_CHANNEL_STATE_PROGRESS: - if (evntType == MI_PROGRESS) { + if (evntType == MI_PROGRESS || + (cnStEvnt->progInd.eh.pres && cnStEvnt->progInd.progDesc.val == IN_PD_IBAVAIL)) { ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); } break; @@ -371,6 +407,7 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) break; } +sngisdn_process_cnst_ind_end: ISDN_FUNC_TRACE_EXIT(__FUNCTION__); return; } @@ -638,12 +675,14 @@ void sngisdn_process_flc_ind (sngisdn_event_data_t *sngisdn_event) void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event) { ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + int16_t suId = sngisdn_event->suId; uint32_t suInstId = sngisdn_event->suInstId; uint32_t spInstId = sngisdn_event->spInstId; sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; FacEvnt *facEvnt = &sngisdn_event->event.facEvnt; @@ -659,10 +698,16 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event) if (sng_isdn_retrieve_facility_caller_name(facility_str, facEvnt->facElmt.facStr.len, retrieved_str) != FTDM_SUCCESS) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Failed to retrieve Caller Name from Facility IE\n"); } + /* Cancel facility timeout */ + ftdm_sched_cancel_timer(signal_data->sched, &sngisdn_info->timers[SNGISDN_TIMER_FACILITY]); } ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); break; + case FTDM_CHANNEL_STATE_RING: + /* We received the caller ID Name in FACILITY, but its too late, facility-timeout already occurred */ + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "FACILITY received, but we already proceeded with call\n"); + break; default: /* We do not support other FACILITY types for now, so do nothing */ break; @@ -794,6 +839,14 @@ void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event) break; case 3: switch (ftdmchan->state) { + case FTDM_CHANNEL_STATE_PROGRESS: + /* T310 timer has expired */ + ftdmchan->caller_data.hangup_cause = staEvnt->causeDgn[0].causeVal.val; + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "T310 Timer expired, hanging up call\n"); + sngisdn_set_flag(sngisdn_info, FLAG_SEND_DISC); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + + break; case FTDM_CHANNEL_STATE_UP: /* Remote side is still waiting for our CONNECT message */ if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c index 29cfb23..f921b1b 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c @@ -45,8 +45,8 @@ void sngisdn_rcv_con_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, Co { ISDN_FUNC_TRACE_ENTER(__FUNCTION__); uint8_t bchan_no = 0; - sngisdn_chan_data_t *sngisdn_info; - sngisdn_event_data_t *sngisdn_event; + sngisdn_chan_data_t *sngisdn_info = NULL; + sngisdn_event_data_t *sngisdn_event = NULL; ftdm_assert(g_sngisdn_data.ccs[suId].activation_done != 0, "Con Ind on unconfigured cc\n"); ftdm_assert(g_sngisdn_data.dchans[dChan].num_spans != 0, "Con Ind on unconfigured dchan\n"); @@ -96,7 +96,7 @@ void sngisdn_rcv_con_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, Co ftdm_mutex_unlock(g_sngisdn_data.ccs[suId].mutex); memcpy(&sngisdn_event->event.conEvnt, conEvnt, sizeof(*conEvnt)); - + ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); ISDN_FUNC_TRACE_EXIT(__FUNCTION__); } @@ -104,8 +104,8 @@ void sngisdn_rcv_con_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, Co void sngisdn_rcv_con_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, CnStEvnt *cnStEvnt, int16_t dChan, uint8_t ces) { ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - sngisdn_chan_data_t *sngisdn_info; - sngisdn_event_data_t *sngisdn_event; + sngisdn_chan_data_t *sngisdn_info = NULL; + sngisdn_event_data_t *sngisdn_event = NULL; ftdm_assert(g_sngisdn_data.ccs[suId].activation_done != 0, "Con Cfm on unconfigured cc\n"); ftdm_assert(g_sngisdn_data.dchans[dChan].num_spans != 0, "Con Cfm on unconfigured dchan\n"); @@ -118,6 +118,7 @@ void sngisdn_rcv_con_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, Cn if (!sngisdn_info->spInstId) { ftdm_mutex_lock(g_sngisdn_data.ccs[suId].mutex); + sngisdn_info->spInstId = spInstId; g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] = sngisdn_info; ftdm_mutex_unlock(g_sngisdn_data.ccs[suId].mutex); @@ -146,8 +147,8 @@ void sngisdn_rcv_con_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, Cn void sngisdn_rcv_cnst_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, CnStEvnt *cnStEvnt, uint8_t evntType, int16_t dChan, uint8_t ces) { ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - sngisdn_chan_data_t *sngisdn_info; - sngisdn_event_data_t *sngisdn_event; + sngisdn_chan_data_t *sngisdn_info = NULL; + sngisdn_event_data_t *sngisdn_event = NULL; ftdm_assert(g_sngisdn_data.ccs[suId].activation_done != 0, "Cnst Ind on unconfigured cc\n"); ftdm_assert(g_sngisdn_data.dchans[dChan].num_spans != 0, "Cnst Ind on unconfigured dchan\n"); @@ -160,6 +161,7 @@ void sngisdn_rcv_cnst_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, C if (!sngisdn_info->spInstId) { ftdm_mutex_lock(g_sngisdn_data.ccs[suId].mutex); + sngisdn_info->spInstId = spInstId; g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] = sngisdn_info; ftdm_mutex_unlock(g_sngisdn_data.ccs[suId].mutex); @@ -188,15 +190,15 @@ void sngisdn_rcv_cnst_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, C memcpy(&sngisdn_event->event.cnStEvnt, cnStEvnt, sizeof(*cnStEvnt)); - ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); + ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); ISDN_FUNC_TRACE_EXIT(__FUNCTION__); } void sngisdn_rcv_disc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, DiscEvnt *discEvnt) { ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - sngisdn_chan_data_t *sngisdn_info; - sngisdn_event_data_t *sngisdn_event; + sngisdn_chan_data_t *sngisdn_info = NULL; + sngisdn_event_data_t *sngisdn_event = NULL; ftdm_assert(spInstId != 0, "Received DISCONNECT with invalid id"); @@ -207,13 +209,6 @@ void sngisdn_rcv_disc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, D ftdm_assert(0, "Inconsistent call states\n"); return; } - - if (!sngisdn_info->spInstId) { - ftdm_mutex_lock(g_sngisdn_data.ccs[suId].mutex); - sngisdn_info->spInstId = spInstId; - g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] = sngisdn_info; - ftdm_mutex_unlock(g_sngisdn_data.ccs[suId].mutex); - } ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received DISCONNECT (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); @@ -229,7 +224,7 @@ void sngisdn_rcv_disc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, D memcpy(&sngisdn_event->event.discEvnt, discEvnt, sizeof(*discEvnt)); - ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); + ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); ISDN_FUNC_TRACE_EXIT(__FUNCTION__); } @@ -237,8 +232,8 @@ void sngisdn_rcv_disc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, D void sngisdn_rcv_rel_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, RelEvnt *relEvnt) { ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - sngisdn_chan_data_t *sngisdn_info; - sngisdn_event_data_t *sngisdn_event; + sngisdn_chan_data_t *sngisdn_info = NULL; + sngisdn_event_data_t *sngisdn_event = NULL; if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { @@ -251,7 +246,7 @@ void sngisdn_rcv_rel_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, Re ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received RELEASE/RELEASE COMPLETE (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); - ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); + ftdm_assert(sngisdn_event != NULL, "Failed to allocate memory\n"); memset(sngisdn_event, 0, sizeof(*sngisdn_event)); sngisdn_event->event_id = SNGISDN_EVENT_REL_IND; @@ -270,7 +265,7 @@ void sngisdn_rcv_dat_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, In { ISDN_FUNC_TRACE_ENTER(__FUNCTION__); sngisdn_chan_data_t *sngisdn_info; - sngisdn_event_data_t *sngisdn_event; + sngisdn_event_data_t *sngisdn_event = NULL; if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { @@ -283,7 +278,7 @@ void sngisdn_rcv_dat_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, In ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received DATA IND suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); - ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); + ftdm_assert(sngisdn_event != NULL, "Failed to allocate memory\n"); memset(sngisdn_event, 0, sizeof(*sngisdn_event)); sngisdn_event->event_id = SNGISDN_EVENT_DAT_IND; @@ -302,7 +297,7 @@ void sngisdn_rcv_sshl_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, S { ISDN_FUNC_TRACE_ENTER(__FUNCTION__); sngisdn_chan_data_t *sngisdn_info; - sngisdn_event_data_t *sngisdn_event; + sngisdn_event_data_t *sngisdn_event = NULL; if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { @@ -315,7 +310,7 @@ void sngisdn_rcv_sshl_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, S ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received SSHL IND (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); - ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); + ftdm_assert(sngisdn_event != NULL, "Failed to allocate memory\n"); memset(sngisdn_event, 0, sizeof(*sngisdn_event)); sngisdn_event->event_id = SNGISDN_EVENT_SSHL_IND; @@ -335,7 +330,7 @@ void sngisdn_rcv_sshl_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, S { ISDN_FUNC_TRACE_ENTER(__FUNCTION__); sngisdn_chan_data_t *sngisdn_info; - sngisdn_event_data_t *sngisdn_event; + sngisdn_event_data_t *sngisdn_event = NULL; if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { @@ -348,7 +343,7 @@ void sngisdn_rcv_sshl_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, S ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received SSHL CFM (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); - ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); + ftdm_assert(sngisdn_event != NULL, "Failed to allocate memory\n"); memset(sngisdn_event, 0, sizeof(*sngisdn_event)); sngisdn_event->event_id = SNGISDN_EVENT_SSHL_CFM; @@ -360,14 +355,14 @@ void sngisdn_rcv_sshl_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, S memcpy(&sngisdn_event->event.ssHlEvnt, ssHlEvnt, sizeof(*ssHlEvnt)); - ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); + ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); ISDN_FUNC_TRACE_EXIT(__FUNCTION__); } void sngisdn_rcv_rmrt_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, RmRtEvnt *rmRtEvnt, uint8_t action) { ISDN_FUNC_TRACE_ENTER(__FUNCTION__); sngisdn_chan_data_t *sngisdn_info; - sngisdn_event_data_t *sngisdn_event; + sngisdn_event_data_t *sngisdn_event = NULL; if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { @@ -380,7 +375,7 @@ void sngisdn_rcv_rmrt_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, R ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received RMRT IND (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); - ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); + ftdm_assert(sngisdn_event != NULL, "Failed to allocate memory\n"); memset(sngisdn_event, 0, sizeof(*sngisdn_event)); sngisdn_event->event_id = SNGISDN_EVENT_RMRT_IND; @@ -392,7 +387,7 @@ void sngisdn_rcv_rmrt_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, R memcpy(&sngisdn_event->event.rmRtEvnt, rmRtEvnt, sizeof(*rmRtEvnt)); - ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); + ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); ISDN_FUNC_TRACE_EXIT(__FUNCTION__); } @@ -400,7 +395,7 @@ void sngisdn_rcv_rmrt_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, R { ISDN_FUNC_TRACE_ENTER(__FUNCTION__); sngisdn_chan_data_t *sngisdn_info; - sngisdn_event_data_t *sngisdn_event; + sngisdn_event_data_t *sngisdn_event = NULL; if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { @@ -413,7 +408,7 @@ void sngisdn_rcv_rmrt_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, R ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received RESUME/RETRIEVE CFM (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); - ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); + ftdm_assert(sngisdn_event != NULL, "Failed to allocate memory\n"); memset(sngisdn_event, 0, sizeof(*sngisdn_event)); sngisdn_event->event_id = SNGISDN_EVENT_RMRT_CFM; @@ -425,7 +420,7 @@ void sngisdn_rcv_rmrt_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, R memcpy(&sngisdn_event->event.rmRtEvnt, rmRtEvnt, sizeof(*rmRtEvnt)); - ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); + ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); ISDN_FUNC_TRACE_EXIT(__FUNCTION__); } @@ -433,7 +428,7 @@ void sngisdn_rcv_flc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, St { ISDN_FUNC_TRACE_ENTER(__FUNCTION__); sngisdn_chan_data_t *sngisdn_info; - sngisdn_event_data_t *sngisdn_event; + sngisdn_event_data_t *sngisdn_event = NULL; if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { @@ -446,7 +441,7 @@ void sngisdn_rcv_flc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, St ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received FLOW CONTROL IND (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); - ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); + ftdm_assert(sngisdn_event != NULL, "Failed to allocate memory\n"); memset(sngisdn_event, 0, sizeof(*sngisdn_event)); sngisdn_event->event_id = SNGISDN_EVENT_FLC_IND; @@ -457,7 +452,7 @@ void sngisdn_rcv_flc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, St memcpy(&sngisdn_event->event.staEvnt, staEvnt, sizeof(*staEvnt)); - ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); + ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); ISDN_FUNC_TRACE_EXIT(__FUNCTION__); } @@ -466,7 +461,7 @@ void sngisdn_rcv_fac_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, Fa { ISDN_FUNC_TRACE_ENTER(__FUNCTION__); sngisdn_chan_data_t *sngisdn_info; - sngisdn_event_data_t *sngisdn_event; + sngisdn_event_data_t *sngisdn_event = NULL; if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { @@ -478,7 +473,7 @@ void sngisdn_rcv_fac_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, Fa ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received FACILITY IND (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); - ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); + ftdm_assert(sngisdn_event != NULL, "Failed to allocate memory\n"); memset(sngisdn_event, 0, sizeof(*sngisdn_event)); sngisdn_event->event_id = SNGISDN_EVENT_FAC_IND; @@ -499,7 +494,7 @@ void sngisdn_rcv_sta_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, St { ISDN_FUNC_TRACE_ENTER(__FUNCTION__); sngisdn_chan_data_t *sngisdn_info; - sngisdn_event_data_t *sngisdn_event; + sngisdn_event_data_t *sngisdn_event = NULL; if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { @@ -512,7 +507,7 @@ void sngisdn_rcv_sta_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, St ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received STATUS CONFIRM (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); - ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); + ftdm_assert(sngisdn_event != NULL, "Failed to allocate memory\n"); memset(sngisdn_event, 0, sizeof(*sngisdn_event)); sngisdn_event->event_id = SNGISDN_EVENT_STA_CFM; @@ -532,7 +527,7 @@ void sngisdn_rcv_srv_ind (int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces ISDN_FUNC_TRACE_ENTER(__FUNCTION__); unsigned i; sngisdn_span_data_t *signal_data; - sngisdn_event_data_t *sngisdn_event; + sngisdn_event_data_t *sngisdn_event = NULL; ftdm_log(FTDM_LOG_INFO, "Received SERVICE IND (dChan:%d ces:%u)\n", dChan, ces); @@ -540,7 +535,7 @@ void sngisdn_rcv_srv_ind (int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces for(i=1; i<=g_sngisdn_data.dchans[dChan].num_spans; i++) { signal_data = g_sngisdn_data.dchans[dChan].spans[i]; sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); - ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); + ftdm_assert(sngisdn_event != NULL, "Failed to allocate memory\n"); memset(sngisdn_event, 0, sizeof(*sngisdn_event)); sngisdn_event->event_id = SNGISDN_EVENT_SRV_IND; @@ -550,7 +545,7 @@ void sngisdn_rcv_srv_ind (int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces sngisdn_event->signal_data = signal_data; memcpy(&sngisdn_event->event.srvEvnt, srvEvnt, sizeof(*srvEvnt)); - ftdm_queue_enqueue((signal_data)->event_queue, sngisdn_event); + ftdm_queue_enqueue((signal_data)->event_queue, sngisdn_event); } ISDN_FUNC_TRACE_EXIT(__FUNCTION__); } @@ -560,8 +555,8 @@ void sngisdn_rcv_srv_cfm (int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces { ISDN_FUNC_TRACE_ENTER(__FUNCTION__); unsigned i; - sngisdn_span_data_t *signal_data; - sngisdn_event_data_t *sngisdn_event; + sngisdn_span_data_t *signal_data = NULL; + sngisdn_event_data_t *sngisdn_event = NULL; ftdm_log(FTDM_LOG_INFO, "Received SERVICE CFM (dChan:%d ces:%u)\n", dChan, ces); @@ -569,7 +564,7 @@ void sngisdn_rcv_srv_cfm (int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces for(i=1; i<=g_sngisdn_data.dchans[dChan].num_spans; i++) { signal_data = g_sngisdn_data.dchans[dChan].spans[i]; sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); - ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); + ftdm_assert(sngisdn_event != NULL, "Failed to allocate memory\n"); memset(sngisdn_event, 0, sizeof(*sngisdn_event)); sngisdn_event->event_id = SNGISDN_EVENT_SRV_CFM; @@ -588,8 +583,8 @@ void sngisdn_rcv_rst_ind (int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces { ISDN_FUNC_TRACE_ENTER(__FUNCTION__); unsigned i; - sngisdn_span_data_t *signal_data; - sngisdn_event_data_t *sngisdn_event; + sngisdn_span_data_t *signal_data = NULL; + sngisdn_event_data_t *sngisdn_event = NULL; ftdm_log(FTDM_LOG_INFO, "Received RESTART IND (dChan:%d ces:%u type:%u)\n", dChan, ces, evntType); @@ -597,7 +592,7 @@ void sngisdn_rcv_rst_ind (int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces for(i=1; i<=g_sngisdn_data.dchans[dChan].num_spans; i++) { signal_data = g_sngisdn_data.dchans[dChan].spans[i]; sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); - ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); + ftdm_assert(sngisdn_event != NULL, "Failed to allocate memory\n"); memset(sngisdn_event, 0, sizeof(*sngisdn_event)); sngisdn_event->event_id = SNGISDN_EVENT_RST_IND; @@ -618,7 +613,7 @@ void sngisdn_rcv_rst_cfm (int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces ISDN_FUNC_TRACE_ENTER(__FUNCTION__); unsigned i; sngisdn_span_data_t *signal_data; - sngisdn_event_data_t *sngisdn_event; + sngisdn_event_data_t *sngisdn_event = NULL; ftdm_log(FTDM_LOG_INFO, "Received RESTART CFM (dChan:%d ces:%u type:%u)\n", dChan, ces, evntType); @@ -626,7 +621,7 @@ void sngisdn_rcv_rst_cfm (int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces for(i=1; i<=g_sngisdn_data.dchans[dChan].num_spans; i++) { signal_data = g_sngisdn_data.dchans[dChan].spans[i]; sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); - ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); + ftdm_assert(sngisdn_event != NULL, "Failed to allocate memory\n"); memset(sngisdn_event, 0, sizeof(*sngisdn_event)); sngisdn_event->event_id = SNGISDN_EVENT_RST_CFM; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 29e7994..5e37e0c 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -73,8 +73,10 @@ void __inline__ clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info) sngisdn_info->glare.suInstId, sngisdn_info->glare.spInstId, sngisdn_info->suInstId, sngisdn_info->spInstId); - ftdm_mutex_lock(g_sngisdn_data.ccs[sngisdn_info->glare.suId].mutex); - g_sngisdn_data.ccs[sngisdn_info->glare.suId].active_spInstIds[sngisdn_info->glare.spInstId]=NULL; + ftdm_mutex_lock(g_sngisdn_data.ccs[sngisdn_info->glare.suId].mutex); + if (sngisdn_info->glare.spInstId != sngisdn_info->spInstId) { + g_sngisdn_data.ccs[sngisdn_info->glare.suId].active_spInstIds[sngisdn_info->glare.spInstId]=NULL; + } g_sngisdn_data.ccs[sngisdn_info->glare.suId].active_suInstIds[sngisdn_info->glare.suInstId]=NULL; ftdm_mutex_unlock(g_sngisdn_data.ccs[sngisdn_info->glare.suId].mutex); @@ -427,6 +429,24 @@ void sngisdn_delayed_disconnect(void* p_sngisdn_info) return; } +void sngisdn_facility_timeout(void* p_sngisdn_info) +{ + sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*)p_sngisdn_info; + ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + + ftdm_mutex_lock(ftdmchan->mutex); + if (ftdmchan->state == FTDM_CHANNEL_STATE_GET_CALLERID) { + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Facility timeout reached proceeding with call (suId:%d suInstId:%u spInstId:%u)\n", + signal_data->cc_id, sngisdn_info->spInstId, sngisdn_info->suInstId); + + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); + } + + ftdm_mutex_unlock(ftdmchan->mutex); + return; +} + ftdm_status_t sngisdn_check_free_ids(void) { unsigned i; commit 86de47ff3140d2d04e72c9977a3b3fc21cff54d0 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Sep 8 10:41:50 2010 -0500 dont put an rpid in 183 or 200 if pass-callee-id is false diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 5954a84..19a44f4 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -697,7 +697,11 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session) if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) { char *extra_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_RESPONSE_HEADER_PREFIX); - char *cid = generate_pai_str(session); + char *cid = NULL; + + if (sofia_test_pflag(tech_pvt->profile, PFLAG_PASS_CALLEE_ID)) { + cid = generate_pai_str(session); + } if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) && tech_pvt->early_sdp && strcmp(tech_pvt->early_sdp, tech_pvt->local_sdp_str)) { /* The SIP RFC for SOA forbids sending a 183 with one sdp then a 200 with another but it won't do us much good unless @@ -2165,7 +2169,11 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) { char *extra_header = sofia_glue_get_extra_headers(channel, SOFIA_SIP_PROGRESS_HEADER_PREFIX); - char *cid = generate_pai_str(session); + char *cid = NULL; + + if (sofia_test_pflag(tech_pvt->profile, PFLAG_PASS_CALLEE_ID)) { + cid = generate_pai_str(session); + } if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) && tech_pvt->early_sdp && strcmp(tech_pvt->early_sdp, tech_pvt->local_sdp_str)) { commit 4d3357e18cee30293a77fdf7f4ba8fcc9df9a2c5 Author: Moises Silva <moy@sangoma.com> Date: Wed Sep 8 07:21:56 2010 -0400 freetdm: set outbound flag in individual channel open too diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index fc32a0f..b275403 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -1805,6 +1805,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open(uint32_t span_id, uint32_t chan_id, status = FTDM_SUCCESS; } ftdm_set_flag(check, FTDM_CHANNEL_INUSE); + ftdm_set_flag(check, FTDM_CHANNEL_OUTBOUND); *ftdmchan = check; } commit 381233ae0becc99ee1a4801883f94b704f1e2bc9 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Sep 8 10:30:39 2010 -0500 fix fs_cli tab complete regression diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 0ef3624..6732564 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -1683,16 +1683,20 @@ SWITCH_DECLARE(switch_status_t) switch_api_execute(const char *cmd, const char * { switch_api_interface_t *api; switch_status_t status; - char *arg_no_spaces; - char *cmd_no_spaces; + char *arg_used; + char *cmd_used; switch_assert(stream != NULL); switch_assert(stream->data != NULL); switch_assert(stream->write_function != NULL); - - cmd_no_spaces = switch_strip_whitespace(cmd); - arg_no_spaces = switch_strip_whitespace(arg); + if (strcasecmp(cmd, "console_complete")) { + cmd_used = switch_strip_whitespace(cmd); + arg_used = switch_strip_whitespace(arg); + } else { + cmd_used = (char *) cmd; + arg_used = (char *) arg; + } if (!stream->param_event) { @@ -1700,17 +1704,17 @@ SWITCH_DECLARE(switch_status_t) switch_api_execute(const char *cmd, const char * } if (stream->param_event) { - if (cmd_no_spaces) { - switch_event_add_header_string(stream->param_event, SWITCH_STACK_BOTTOM, "API-Command", cmd_no_spaces); + if (cmd_used) { + switch_event_add_header_string(stream->param_event, SWITCH_STACK_BOTTOM, "API-Command", cmd_used); } - if (arg_no_spaces) { - switch_event_add_header_string(stream->param_event, SWITCH_STACK_BOTTOM, "API-Command-Argument", arg_no_spaces); + if (arg_used) { + switch_event_add_header_string(stream->param_event, SWITCH_STACK_BOTTOM, "API-Command-Argument", arg_used); } } - if (cmd_no_spaces && (api = switch_loadable_module_get_api_interface(cmd_no_spaces)) != 0) { - if ((status = api->function(arg_no_spaces, session, stream)) != SWITCH_STATUS_SUCCESS) { + if (cmd_used && (api = switch_loadable_module_get_api_interface(cmd_used)) != 0) { + if ((status = api->function(arg_used, session, stream)) != SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "COMMAND RETURNED ERROR!\n"); } UNPROTECT_INTERFACE(api); @@ -1723,8 +1727,13 @@ SWITCH_DECLARE(switch_status_t) switch_api_execute(const char *cmd, const char * switch_event_fire(&stream->param_event); } - switch_safe_free(cmd_no_spaces); - switch_safe_free(arg_no_spaces); + if (cmd_used != cmd) { + switch_safe_free(cmd_used); + } + + if (arg_used != arg) { + switch_safe_free(arg_used); + } return status; } commit ac20528816a74aa2a7619a2425edd5a389161d13 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Sep 8 09:44:40 2010 -0500 MODSOFIA-85 diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 5830822..5954a84 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1761,7 +1761,14 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi nua_update(tech_pvt->nh, TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)), TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), TAG_END()); - } + } else if ((ua && (switch_stristr("cisco", ua)))) { + snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <sip:%s@%s>", name, number, tech_pvt->profile->sipip); + + sofia_set_flag_locked(tech_pvt, TFLAG_UPDATING_DISPLAY); + nua_update(tech_pvt->nh, + TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)), + TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), TAG_END()); + } tech_pvt->last_sent_callee_id_name = switch_core_session_strdup(tech_pvt->session, name); tech_pvt->last_sent_callee_id_number = switch_core_session_strdup(tech_pvt->session, number); commit 3482f95e72934dd96f80188cc04b008308bf73db Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Wed Sep 8 00:07:19 2010 -0400 mod_callcenter: Alot of cleanup. Added max-wait-time and max-wait-time-with-no-agent param to a queue. max-wait-time : allow to make the caller quit the queue after X number of waited second. The second one allow max-wait-time-with-no-agent : This will wait for a range of second with no agent before kicking the member out of the queue. This allow safe shift change with all agents login out and back in I've changed the Event value from CC-Name to either CC-Agent or CC-Queue. So watchout for your current event socket apps. Sorry about this change. Lot to be tested in this commit. Please use Jira to post problems, and new feature request can be added at the bottom of the wiki page. diff --git a/conf/autoload_configs/callcenter.conf.xml b/conf/autoload_configs/callcenter.conf.xml index 156ed37..e764d17 100644 --- a/conf/autoload_configs/callcenter.conf.xml +++ b/conf/autoload_configs/callcenter.conf.xml @@ -10,6 +10,8 @@ <param name="moh-sound" value="$${hold_music}"/> <!--<param name="record-template" value="$${base_dir}/recordings/${strftime(%Y-%m-%d-%H-%M-%S)}.${destination_number}.${caller_id_number}.${uuid}.wav"/>--> <param name="time-base-score" value="system"/> + <param name="max-wait-time" value="0"/> + <param name="max-wait-time-with-no-agent" value="0"/> <param name="tier-rules-apply" value="false"/> <param name="tier-rule-wait-second" value="300"/> <param name="tier-rule-wait-multiply-level" value="true"/> diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index e56309d..e08757b 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -37,6 +37,7 @@ #define CC_AGENT_TYPE_UUID_STANDBY "uuid-standby" #define CC_SQLITE_DB_NAME "callcenter" +#define CC_MAX_TIME_DIFF_CHECK 5 /* TODO drop caller if no agent login dont allow new caller @@ -53,6 +54,16 @@ SWITCH_MODULE_DEFINITION(mod_callcenter, mod_callcenter_load, mod_callcenter_shu static const char *global_cf = "callcenter.conf"; +struct cc_status_table { + const char *name; + int status; +}; + +struct cc_state_table { + const char *name; + int state; +}; + typedef enum { CC_STATUS_SUCCESS, CC_STATUS_FALSE, @@ -77,12 +88,7 @@ typedef enum { CC_TIER_STATE_STANDBY = 5 } cc_tier_state_t; -struct cc_tier_state_table { - const char *name; - cc_tier_state_t state; -}; - -static struct cc_tier_state_table STATE_CHART[] = { +static struct cc_state_table STATE_CHART[] = { {"Unknown", CC_TIER_STATE_UNKNOWN}, {"No Answer", CC_TIER_STATE_NO_ANSWER}, {"Ready", CC_TIER_STATE_READY}, @@ -101,12 +107,7 @@ typedef enum { CC_AGENT_STATUS_ON_BREAK = 4 } cc_agent_status_t; -struct cc_agent_status_table { - const char *name; - cc_agent_status_t status; -}; - -static struct cc_agent_status_table AGENT_STATUS_CHART[] = { +static struct cc_status_table AGENT_STATUS_CHART[] = { {"Unknown", CC_AGENT_STATUS_UNKNOWN}, {"Logged Out", CC_AGENT_STATUS_LOGGED_OUT}, {"Available", CC_AGENT_STATUS_AVAILABLE}, @@ -124,12 +125,7 @@ typedef enum { CC_AGENT_STATE_IDLE = 4 } cc_agent_state_t; -struct cc_agent_state_table { - const char *name; - cc_agent_state_t state; -}; - -static struct cc_agent_state_table AGENT_STATE_CHART[] = { +static struct cc_state_table AGENT_STATE_CHART[] = { {"Unknown", CC_AGENT_STATE_UNKNOWN}, {"Waiting", CC_AGENT_STATE_WAITING}, {"Receiving", CC_AGENT_STATE_RECEIVING}, @@ -147,12 +143,7 @@ typedef enum { CC_MEMBER_STATE_ABANDONED = 4 } cc_member_state_t; -struct cc_member_state_table { - const char *name; - cc_member_state_t state; -}; - -static struct cc_member_state_table MEMBER_STATE_CHART[] = { +static struct cc_state_table MEMBER_STATE_CHART[] = { {"Unknown", CC_MEMBER_STATE_UNKNOWN}, {"Waiting", CC_MEMBER_STATE_WAITING}, {"Trying", CC_MEMBER_STATE_TRYING}, @@ -162,10 +153,24 @@ static struct cc_member_state_table MEMBER_STATE_CHART[] = { }; -/*static char queues_sql[] = - "CREATE TABLE queues (\n" - " name VARCHAR(255)\n" ");\n"; - */ +struct cc_member_cancel_reason_table { + const char *name; + int reason; +}; + +typedef enum { + CC_MEMBER_CANCEL_REASON_NONE, + CC_MEMBER_CANCEL_REASON_TIMEOUT, + CC_MEMBER_CANCEL_REASON_NO_AGENT_TIMEOUT +} cc_member_cancel_reason_t; + +static struct cc_member_cancel_reason_table MEMBER_CANCEL_REASON_CHART[] = { + {"NONE", CC_MEMBER_CANCEL_REASON_NONE}, + {"TIMEOUT", CC_MEMBER_CANCEL_REASON_TIMEOUT}, + {"NO_AGENT_TIMEOUT", CC_MEMBER_CANCEL_REASON_NO_AGENT_TIMEOUT}, + {NULL, 0} +}; + static char members_sql[] = "CREATE TABLE members (\n" " queue VARCHAR(255),\n" @@ -222,7 +227,6 @@ static char agents_sql[] = " ready_time INTEGER NOT NULL DEFAULT 0\n" ");\n"; - static char tiers_sql[] = "CREATE TABLE tiers (\n" " queue VARCHAR(255),\n" @@ -247,7 +251,7 @@ const char * cc_tier_state2str(cc_tier_state_t state) uint8_t x; const char *str = "Unknown"; - for (x = 0; x < (sizeof(STATE_CHART) / sizeof(struct cc_tier_state_table)) - 1; x++) { + for (x = 0; x < (sizeof(STATE_CHART) / sizeof(struct cc_state_table)) - 1; x++) { if (STATE_CHART[x].state == state) { str = STATE_CHART[x].name; break; @@ -262,7 +266,7 @@ cc_tier_state_t cc_tier_str2state(const char *str) uint8_t x; cc_tier_state_t state = CC_TIER_STATE_UNKNOWN; - for (x = 0; x < (sizeof(STATE_CHART) / sizeof(struct cc_tier_state_table)) - 1 && STATE_CHART[x].name; x++) { + for (x = 0; x < (sizeof(STATE_CHART) / sizeof(struct cc_state_table)) - 1 && STATE_CHART[x].name; x++) { if (!strcasecmp(STATE_CHART[x].name, str)) { state = STATE_CHART[x].state; break; @@ -271,12 +275,41 @@ cc_tier_state_t cc_tier_str2state(const char *str) return state; } +const char * cc_member_cancel_reason2str(cc_member_cancel_reason_t reason) +{ + uint8_t x; + const char *str = "NONE"; + + for (x = 0; x < (sizeof(MEMBER_CANCEL_REASON_CHART) / sizeof(struct cc_member_cancel_reason_table)) - 1; x++) { + if (MEMBER_CANCEL_REASON_CHART[x].reason == reason) { + str = MEMBER_CANCEL_REASON_CHART[x].name; + break; + } + } + + return str; +} + +cc_member_cancel_reason_t cc_member_cancel_str2reason(const char *str) +{ + uint8_t x; + cc_member_cancel_reason_t reason = CC_MEMBER_CANCEL_REASON_NONE; + + for (x = 0; x < (sizeof(MEMBER_CANCEL_REASON_CHART) / sizeof(struct cc_member_cancel_reason_table)) - 1 && MEMBER_CANCEL_REASON_CHART[x].name; x++) { + if (!strcasecmp(MEMBER_CANCEL_REASON_CHART[x].name, str)) { + reason = MEMBER_CANCEL_REASON_CHART[x].reason; + break; + } + } + return reason; +} + const char * cc_agent_status2str(cc_agent_status_t status) { uint8_t x; const char *str = "Unknown"; - for (x = 0; x < (sizeof(AGENT_STATUS_CHART) / sizeof(struct cc_agent_status_table)) - 1; x++) { + for (x = 0; x < (sizeof(AGENT_STATUS_CHART) / sizeof(struct cc_status_table)) - 1; x++) { if (AGENT_STATUS_CHART[x].status == status) { str = AGENT_STATUS_CHART[x].name; break; @@ -291,7 +324,7 @@ cc_agent_status_t cc_agent_str2status(const char *str) uint8_t x; cc_agent_status_t status = CC_AGENT_STATUS_UNKNOWN; - for (x = 0; x < (sizeof(AGENT_STATUS_CHART) / sizeof(struct cc_agent_status_table)) - 1 && AGENT_STATUS_CHART[x].name; x++) { + for (x = 0; x < (sizeof(AGENT_STATUS_CHART) / sizeof(struct cc_status_table)) - 1 && AGENT_STATUS_CHART[x].name; x++) { if (!strcasecmp(AGENT_STATUS_CHART[x].name, str)) { status = AGENT_STATUS_CHART[x].status; break; @@ -305,7 +338,7 @@ const char * cc_agent_state2str(cc_agent_state_t state) uint8_t x; const char *str = "Unknown"; - for (x = 0; x < (sizeof(AGENT_STATE_CHART) / sizeof(struct cc_agent_state_table)) - 1; x++) { + for (x = 0; x < (sizeof(AGENT_STATE_CHART) / sizeof(struct cc_state_table)) - 1; x++) { if (AGENT_STATE_CHART[x].state == state) { str = AGENT_STATE_CHART[x].name; break; @@ -320,7 +353,7 @@ cc_agent_state_t cc_agent_str2state(const char *str) uint8_t x; cc_agent_state_t state = CC_AGENT_STATE_UNKNOWN; - for (x = 0; x < (sizeof(AGENT_STATE_CHART) / sizeof(struct cc_agent_state_table)) - 1 && AGENT_STATE_CHART[x].name; x++) { + for (x = 0; x < (sizeof(AGENT_STATE_CHART) / sizeof(struct cc_state_table)) - 1 && AGENT_STATE_CHART[x].name; x++) { if (!strcasecmp(AGENT_STATE_CHART[x].name, str)) { state = AGENT_STATE_CHART[x].state; break; @@ -334,7 +367,7 @@ const char * cc_member_state2str(cc_member_state_t state) uint8_t x; const char *str = "Unknown"; - for (x = 0; x < (sizeof(MEMBER_STATE_CHART) / sizeof(struct cc_member_state_table)) - 1; x++) { + for (x = 0; x < (sizeof(MEMBER_STATE_CHART) / sizeof(struct cc_state_table)) - 1; x++) { if (MEMBER_STATE_CHART[x].state == state) { str = MEMBER_STATE_CHART[x].name; break; @@ -349,7 +382,7 @@ cc_member_state_t cc_member_str2state(const char *str) uint8_t x; cc_member_state_t state = CC_MEMBER_STATE_UNKNOWN; - for (x = 0; x < (sizeof(MEMBER_STATE_CHART) / sizeof(struct cc_member_state_table)) - 1 && MEMBER_STATE_CHART[x].name; x++) { + for (x = 0; x < (sizeof(MEMBER_STATE_CHART) / sizeof(struct cc_state_table)) - 1 && MEMBER_STATE_CHART[x].name; x++) { if (!strcasecmp(MEMBER_STATE_CHART[x].name, str)) { state = MEMBER_STATE_CHART[x].state; break; @@ -384,19 +417,27 @@ struct cc_queue { char *moh; char *record_template; char *time_base_score; + switch_bool_t tier_rules_apply; uint32_t tier_rule_wait_second; switch_bool_t tier_rule_wait_multiply_level; switch_bool_t tier_rule_no_agent_no_wait; + uint32_t discard_abandoned_after; switch_bool_t abandoned_resume_allowed; + uint32_t max_wait_time; + uint32_t max_wait_time_with_no_agent; + switch_mutex_t *mutex; switch_thread_rwlock_t *rwlock; switch_memory_pool_t *pool; uint32_t flags; + switch_time_t last_agent_exist; + switch_time_t last_agent_exist_check; + switch_xml_config_item_t config[CC_QUEUE_CONFIGITEM_COUNT]; switch_xml_config_string_options_t config_str_pool; @@ -488,6 +529,7 @@ cc_queue_t *queue_set_config(cc_queue_t *queue) SWITCH_CONFIG_SET_ITEM(queue->config[i++], "moh-sound", SWITCH_CONFIG_STRING, 0, &queue->moh, NULL, &queue->config_str_pool, NULL, NULL); SWITCH_CONFIG_SET_ITEM(queue->config[i++], "record-template", SWITCH_CONFIG_STRING, 0, &queue->record_template, NULL, &queue->config_str_pool, NULL, NULL); SWITCH_CONFIG_SET_ITEM(queue->config[i++], "time-base-score", SWITCH_CONFIG_STRING, 0, &queue->time_base_score, "queue", &queue->config_str_pool, NULL, NULL); + SWITCH_CONFIG_SET_ITEM(queue->config[i++], "tier-rules-apply", SWITCH_CONFIG_BOOL, 0, &queue->tier_rules_apply, SWITCH_FALSE, NULL, NULL, NULL); SWITCH_CONFIG_SET_ITEM(queue->config[i++], "tier-rule-wait-second", SWITCH_CONFIG_INT, 0, &queue->tier_rule_wait_second, 0, &config_int_0_86400, NULL, NULL); SWITCH_CONFIG_SET_ITEM(queue->config[i++], "tier-rule-wait-multiply-level", SWITCH_CONFIG_BOOL, 0, &queue->tier_rule_wait_multiply_level, SWITCH_FALSE, NULL, NULL, NULL); @@ -495,6 +537,9 @@ cc_queue_t *queue_set_config(cc_queue_t *queue) SWITCH_CONFIG_SET_ITEM(queue->config[i++], "discard-abandoned-after", SWITCH_CONFIG_INT, 0, &queue->discard_abandoned_after, 60, &config_int_0_86400, NULL, NULL); SWITCH_CONFIG_SET_ITEM(queue->config[i++], "abandoned-resume-allowed", SWITCH_CONFIG_BOOL, 0, &queue->abandoned_resume_allowed, SWITCH_FALSE, NULL, NULL, NULL); + SWITCH_CONFIG_SET_ITEM(queue->config[i++], "max-wait-time", SWITCH_CONFIG_INT, 0, &queue->max_wait_time, 0, &config_int_0_86400, NULL, NULL); + SWITCH_CONFIG_SET_ITEM(queue->config[i++], "max-wait-time-with-no-agent", SWITCH_CONFIG_INT, 0, &queue->max_wait_time_with_no_agent, 0, &config_int_0_86400, NULL, NULL); + switch_assert(i < CC_QUEUE_CONFIGITEM_COUNT); return queue; @@ -646,6 +691,9 @@ static cc_queue_t *load_queue(const char *queue_name) switch_thread_rwlock_create(&queue->rwlock, pool); queue->name = switch_core_strdup(pool, queue_name); + queue->last_agent_exist = 0; + queue->last_agent_exist_check = 0; + if (!(dbh = cc_get_db_handle())) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot open DB!\n"); goto end; @@ -702,7 +750,7 @@ static cc_queue_t *get_queue(const char *queue_name) struct call_helper { const char *member_uuid; - const char *queue; + const char *queue_name; const char *queue_strategy; const char *member_joined_epoch; const char *member_caller_name; @@ -744,7 +792,7 @@ int cc_queue_count(const char *queue) count = atoi(res); if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CALLCENTER_EVENT) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Name", queue); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Queue", queue); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Action", "members-count"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Count", res); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Selection", event_name); @@ -827,7 +875,7 @@ cc_agent_status_t cc_agent_get(const char *key, const char *agent, char *ret_res result = CC_STATUS_SUCCESS; if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CALLCENTER_EVENT) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Name", agent); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent", agent); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Action", "agent-status-get"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-Status", res); switch_event_fire(&event); @@ -894,7 +942,7 @@ cc_status_t cc_agent_update(const char *key, const char *value, const char *agen result = CC_STATUS_SUCCESS; if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CALLCENTER_EVENT) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Name", agent); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent", agent); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Action", "agent-status-change"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-Status", value); switch_event_fire(&event); @@ -918,7 +966,7 @@ cc_status_t cc_agent_update(const char *key, const char *value, const char *agen result = CC_STATUS_SUCCESS; if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CALLCENTER_EVENT) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Name", agent); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent", agent); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Action", "agent-state-change"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-State", value); switch_event_fire(&event); @@ -1118,13 +1166,13 @@ done: return result; } -cc_status_t cc_tier_del(const char *queue, const char *agent) +cc_status_t cc_tier_del(const char *queue_name, const char *agent) { cc_status_t result = CC_STATUS_SUCCESS; char *sql; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted tier Agent %s in Queue %s\n", agent, queue); - sql = switch_mprintf("DELETE FROM tiers WHERE queue = '%q' AND agent = '%q';", queue, agent); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted tier Agent %s in Queue %s\n", agent, queue_name); + sql = switch_mprintf("DELETE FROM tiers WHERE queue = '%q' AND agent = '%q';", queue_name, agent); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); @@ -1307,7 +1355,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa } if (!strcasecmp(h->agent_type, CC_AGENT_TYPE_CALLBACK)) { switch_event_create(&ovars, SWITCH_EVENT_REQUEST_PARAMS); - switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "cc_queue", "%s", h->queue); + switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "cc_queue", "%s", h->queue_name); switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "cc_member_uuid", "%s", h->member_uuid); switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "cc_member_pre_answer_uuid", "%s", h->member_uuid); switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "cc_agent", "%s", h->agent_name); @@ -1327,7 +1375,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_t *event; const char *cc_warning_tone = switch_channel_get_variable(agent_channel, "cc_warning_tone"); - switch_channel_set_variable(agent_channel, "cc_queue", h->queue); + switch_channel_set_variable(agent_channel, "cc_queue", h->queue_name); switch_channel_set_variable(agent_channel, "cc_agent", h->agent_name); switch_channel_set_variable(agent_channel, "cc_agent_type", h->agent_type); switch_channel_set_variable(agent_channel, "cc_member_uuid", h->member_uuid); @@ -1384,7 +1432,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CALLCENTER_EVENT) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(agent_channel, event); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Name", h->queue); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Queue", h->queue_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Action", "bridge-agent-start"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent", h->agent_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-System", h->agent_system); @@ -1407,11 +1455,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_safe_free(sql); /* Change the agents Status in the tiers */ - sql = switch_mprintf("UPDATE tiers SET state = '%q' WHERE agent = '%q' AND queue = '%q'", - cc_tier_state2str(CC_TIER_STATE_ACTIVE_INBOUND), h->agent_name, h->queue); - cc_execute_sql(NULL, sql, NULL); - switch_safe_free(sql); - + cc_tier_update("state", cc_tier_state2str(CC_TIER_STATE_ACTIVE_INBOUND), h->queue_name, h->agent_name); cc_agent_update("state", cc_agent_state2str(CC_AGENT_STATE_IN_A_QUEUE_CALL), h->agent_name); /* Record session if record-template is provided */ @@ -1424,10 +1468,13 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa } } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Agent %s answered \"%s\" (%s) from queue %s%s\n", - h->agent_name, h->member_caller_name, h->member_caller_number, h->queue, (h->record_template?" (Recorded)":"")); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Agent %s answered \"%s\" <%s> from queue %s%s\n", + h->agent_name, h->member_caller_name, h->member_caller_number, h->queue_name, (h->record_template?" (Recorded)":"")); switch_ivr_uuid_bridge(h->member_uuid, switch_core_session_get_uuid(agent_session)); + /* This is used for the waiting caller to quit waiting for a agent */ + switch_channel_set_variable(member_channel, "cc_agent_uuid", agent_uuid); + /* Wait until the member hangup or the agent hangup. This will quit also if the agent transfer the call */ while(switch_channel_up(member_channel) && switch_channel_up(agent_channel) && globals.running) { switch_yield(100000); @@ -1436,7 +1483,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CALLCENTER_EVENT) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(agent_channel, event); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Name", h->queue); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Queue", h->queue_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Action", "bridge-agent-end"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent", h->agent_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-System", h->agent_system); @@ -1452,7 +1499,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa /* Update Agents Items */ /* Do not remove uuid of the agent if we are a standby agent */ sql = switch_mprintf("UPDATE agents SET %q last_bridge_end = %ld, talk_time = talk_time + (%ld-last_bridge_start) WHERE name = '%q' AND system = '%q';" - , (strcasecmp(h->agent_type, "uuid-standby")?"uuid = '',":""), (long) switch_epoch_time_now(NULL), (long) switch_epoch_time_now(NULL), h->agent_name, h->agent_system); + , (strcasecmp(h->agent_type, CC_AGENT_TYPE_UUID_STANDBY)?"uuid = '',":""), (long) switch_epoch_time_now(NULL), (long) switch_epoch_time_now(NULL), h->agent_name, h->agent_system); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); @@ -1464,7 +1511,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa /* Caller off event */ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CALLCENTER_EVENT) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(member_channel, event); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Name", h->queue); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Queue", h->queue_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Action", "member-queue-end"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Cause", "Terminated"); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Answer-Time", "%ld", (long) (t_agent_answered - t_agent_called)); @@ -1472,8 +1519,10 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Talk-Time", "%ld", (long) (switch_epoch_time_now(NULL) - t_agent_answered)); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Total-Time", "%ld", (long) (switch_epoch_time_now(NULL) - t_member_called)); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", h->member_uuid); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Name", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name"))); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Number", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number"))); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Name", + switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name"))); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Number", + switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number"))); switch_event_fire(&event); } @@ -1538,8 +1587,8 @@ done: sql = switch_mprintf( "UPDATE tiers SET state = '%q' WHERE agent = '%q' AND queue = '%q' AND (state = '%q' OR state = '%q' OR state = '%q');" "UPDATE tiers SET state = '%q' WHERE agent = '%q' AND NOT queue = '%q' AND state = '%q'" - , cc_tier_state2str(tiers_state), h->agent_name, h->queue, cc_tier_state2str(CC_TIER_STATE_ACTIVE_INBOUND), cc_tier_state2str(CC_TIER_STATE_STANDBY), cc_tier_state2str(CC_TIER_STATE_OFFERING), - cc_tier_state2str(CC_TIER_STATE_READY), h->agent_name, h->queue, cc_tier_state2str(CC_TIER_STATE_STANDBY)); + , cc_tier_state2str(tiers_state), h->agent_name, h->queue_name, cc_tier_state2str(CC_TIER_STATE_ACTIVE_INBOUND), cc_tier_state2str(CC_TIER_STATE_STANDBY), cc_tier_state2str(CC_TIER_STATE_OFFERING), + cc_tier_state2str(CC_TIER_STATE_READY), h->agent_name, h->queue_name, cc_tier_state2str(CC_TIER_STATE_STANDBY)); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); @@ -1567,7 +1616,7 @@ done: } struct agent_callback { - const char *queue; + const char *queue_name; const char *system; const char *uuid; const char *caller_number; @@ -1579,6 +1628,7 @@ struct agent_callback { uint32_t tier_rule_wait_second; switch_bool_t tier_rule_wait_multiply_level; switch_bool_t tier_rule_no_agent_no_wait; + switch_bool_t agent_found; int tier; int tier_agent_available; @@ -1602,6 +1652,8 @@ static int agents_callback(void *pArg, int argc, char **argv, char **columnNames switch_bool_t contact_agent = SWITCH_TRUE; + cbt->agent_found = SWITCH_TRUE; + /* Check if we switch to a different tier, if so, check if we should continue further for that member */ if (cbt->tier_rules_apply == SWITCH_TRUE && atoi(agent_tier_level) > cbt->tier) { @@ -1700,7 +1752,7 @@ static int agents_callback(void *pArg, int argc, char **argv, char **columnNames h->member_joined_epoch = switch_core_strdup(h->pool, cbt->joined_epoch); h->member_caller_name = switch_core_strdup(h->pool, cbt->caller_name); h->member_caller_number = switch_core_strdup(h->pool, cbt->caller_number); - h->queue = switch_core_strdup(h->pool, cbt->queue); + h->queue_name = switch_core_strdup(h->pool, cbt->queue_name); h->record_template = switch_core_strdup(h->pool, cbt->record_template); h->no_answer_count = atoi(argv[4]); h->max_no_answer = atoi(argv[5]); @@ -1713,8 +1765,8 @@ static int agents_callback(void *pArg, int argc, char **argv, char **columnNames sql = switch_mprintf( "UPDATE tiers SET state = '%q' WHERE agent = '%q' AND queue = '%q';" "UPDATE tiers SET state = '%q' WHERE agent = '%q' AND NOT queue = '%q' AND state = '%q';", - cc_tier_state2str(CC_TIER_STATE_OFFERING), h->agent_name, h->queue, - cc_tier_state2str(CC_TIER_STATE_STANDBY), h->agent_name, h->queue, cc_tier_state2str(CC_TIER_STATE_READY)); + cc_tier_state2str(CC_TIER_STATE_OFFERING), h->agent_name, h->queue_name, + cc_tier_state2str(CC_TIER_STATE_STANDBY), h->agent_name, h->queue_name, cc_tier_state2str(CC_TIER_STATE_READY)); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); @@ -1796,9 +1848,10 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName cbt.caller_number = argv[2]; cbt.caller_name = argv[3]; cbt.joined_epoch = argv[4]; - cbt.queue = argv[0]; + cbt.queue_name = argv[0]; cbt.strategy = queue_strategy; cbt.record_template = queue_record_template; + cbt.agent_found = SWITCH_FALSE; if (!strcasecmp(queue->strategy, "longest-idle-agent")) { sql_order_by = switch_mprintf("level, agents.last_offered_call, position"); @@ -1832,6 +1885,18 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName switch_safe_free(sql); switch_safe_free(sql_order_by); + /* We update a field in the queue struct so we can kick caller out if waiting for too long with no agent */ + if (!argv[0] || !(queue = get_queue(argv[0]))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Queue %s not found locally, skip this member\n", argv[0]); + goto end; + } else { + queue->last_agent_exist_check = switch_epoch_time_now(NULL); + if (cbt.agent_found) { + queue->last_agent_exist = queue->last_agent_exist_check; + } + queue_rwunlock(queue); + } + end: switch_safe_free(queue_name); switch_safe_free(queue_strategy); @@ -1911,30 +1976,53 @@ void cc_agent_dispatch_thread_start(void) switch_thread_create(&thread, thd_attr, cc_agent_dispatch_thread_run, NULL, globals.pool); } -struct member_helper { - const char *uuid; +struct member_thread_helper { + const char *member_uuid; + const char *queue_name; + switch_time_t t_member_called; + cc_member_cancel_reason_t member_cancel_reason; + int running; switch_memory_pool_t *pool; }; void *SWITCH_THREAD_FUNC cc_member_thread_run(switch_thread_t *thread, void *obj) { - struct member_helper *m = (struct member_helper *) obj; - switch_core_session_t *member_session = switch_core_session_locate(m->uuid); - switch_channel_t *channel = NULL; + struct member_thread_helper *m = (struct member_thread_helper *) obj; + switch_core_session_t *member_session = switch_core_session_locate(m->member_uuid); + switch_channel_t *member_channel = NULL; switch_mutex_lock(globals.mutex); globals.threads++; switch_mutex_unlock(globals.mutex); if (member_session) { - channel = switch_core_session_get_channel(member_session); + member_channel = switch_core_session_get_channel(member_session); } else { switch_core_destroy_memory_pool(&m->pool); return NULL; } - while(switch_channel_ready(channel) && m->running && globals.running) { + while(switch_channel_ready(member_channel) && m->running && globals.running) { + cc_queue_t *queue = NULL; + + if (!m->queue_name || !(queue = get_queue(m->queue_name))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Queue %s not found\n", m->queue_name); + break; + } + /* Make the Caller Leave if he went over his max wait time */ + if (queue->max_wait_time > 0 && queue->max_wait_time <= switch_epoch_time_now(NULL) - m->t_member_called) { + m->member_cancel_reason = CC_MEMBER_CANCEL_REASON_TIMEOUT; + switch_channel_set_flag_value(member_channel, CF_BREAK, 2); + } + + /* Will drop the caller if no agent was found for more than X secondes */ + if (queue->max_wait_time_with_no_agent > 0 && m->t_member_called < queue->last_agent_exist_check - CC_MAX_TIME_DIFF_CHECK && + queue->last_agent_exist_check - queue->last_agent_exist >= queue->max_wait_time_with_no_agent) { + m->member_cancel_reason = CC_MEMBER_CANCEL_REASON_NO_AGENT_TIMEOUT; + switch_channel_set_flag_value(member_channel, CF_BREAK, 2); + } + /* TODO Go thought the list of phrases */ /* SAMPLE CODE to playback something over the MOH @@ -1949,8 +2037,12 @@ void *SWITCH_THREAD_FUNC cc_member_thread_run(switch_thread_t *thread, void *obj /* If Agent Logoff, we might need to recalculare score based on skill */ /* Play Announcement in order */ - switch_yield(100000); + + queue_rwunlock(queue); + + switch_yield(500000); } + switch_core_session_rwunlock(member_session); switch_core_destroy_memory_pool(&m->pool); @@ -1971,26 +2063,27 @@ SWITCH_STANDARD_APP(callcenter_function) char *mydata = NULL; cc_queue_t *queue = NULL; const char *queue_name = NULL; - switch_channel_t *member_channel = switch_core_session_get_channel(session); + switch_core_session_t *member_session = session; + switch_channel_t *member_channel = switch_core_session_get_channel(member_session); char *sql = NULL; - char *uuid = switch_core_session_get_uuid(session); - switch_input_args_t args = { 0 }; - struct member_helper *h = NULL; + char *member_uuid = switch_core_session_get_uuid(member_session); + struct member_thread_helper *h = NULL; switch_thread_t *thread; switch_threadattr_t *thd_attr = NULL; switch_memory_pool_t *pool; - int cc_base_score_int = 0; switch_channel_timetable_t *times = NULL; - const char *cc_base_score = switch_channel_get_variable(member_channel, "cc_base_score"); const char *cc_moh_override = switch_channel_get_variable(member_channel, "cc_moh_override"); + const char *cc_base_score = switch_channel_get_variable(member_channel, "cc_base_score"); + int cc_base_score_int = 0; const char *cur_moh = NULL; char start_epoch[64]; switch_event_t *event; switch_time_t t_member_called = switch_epoch_time_now(NULL); long abandoned_epoch = 0; + const char *agent_uuid = NULL; if (!zstr(data)) { - mydata = switch_core_session_strdup(session, data); + mydata = switch_core_session_strdup(member_session, data); argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No Queue name provided\n"); @@ -2013,7 +2106,7 @@ SWITCH_STANDARD_APP(callcenter_function) times = switch_channel_get_timetable(member_channel); switch_snprintf(start_epoch, sizeof(start_epoch), "%" SWITCH_TIME_T_FMT, times->answered / 1000000); - /* Check of we have a queued abandoned member we can resume from */ + /* Check if we support and have a queued abandoned member we can resume from */ if (queue->abandoned_resume_allowed == SWITCH_TRUE) { char res[256]; @@ -2037,9 +2130,9 @@ SWITCH_STANDARD_APP(callcenter_function) if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CALLCENTER_EVENT) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(member_channel, event); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Name", queue_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Queue", queue_name); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Action", "member-queue-%s", (abandoned_epoch==0?"start":"resume")); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", uuid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", member_uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Name", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name"))); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Number", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number"))); switch_event_fire(&event); @@ -2054,7 +2147,7 @@ SWITCH_STANDARD_APP(callcenter_function) " (queue,system,uuid,system_epoch,joined_epoch,base_score,skill_score,caller_number,caller_name,serving_agent,serving_system,state)" " VALUES('%q','single_box','%q','%q','%ld','%d','%d','%q','%q','%q','','%q')", queue_name, - uuid, + member_uuid, start_epoch, (long) switch_epoch_time_now(NULL), cc_base_score_int, @@ -2069,12 +2162,12 @@ SWITCH_STANDARD_APP(callcenter_function) char res[256]; /* Update abandoned member */ sql = switch_mprintf("UPDATE members SET uuid = '%q', state = '%q', rejoined_epoch = '%ld' WHERE caller_number = '%q' AND abandoned_epoch = '%ld' AND state = '%q' AND queue = '%q'", - uuid, cc_member_state2str(CC_MEMBER_STATE_WAITING), (long) switch_epoch_time_now(NULL), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), abandoned_epoch, cc_member_state2str(CC_MEMBER_STATE_ABANDONED), queue_name); + member_uuid, cc_member_state2str(CC_MEMBER_STATE_WAITING), (long) switch_epoch_time_now(NULL), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), abandoned_epoch, cc_member_state2str(CC_MEMBER_STATE_ABANDONED), queue_name); cc_execute_sql(queue, sql, NULL); switch_safe_free(sql); /* Confirm we took that member in */ - sql = switch_mprintf("SELECT abandoned_epoch FROM members WHERE uuid = '%q' AND state = '%q' AND queue = '%q'", uuid, cc_member_state2str(CC_MEMBER_STATE_WAITING), queue_name); + sql = switch_mprintf("SELECT abandoned_epoch FROM members WHERE uuid = '%q' AND state = '%q' AND queue = '%q'", member_uuid, cc_member_state2str(CC_MEMBER_STATE_WAITING), queue_name); cc_execute_sql2str(NULL, NULL, sql, res, sizeof(res)); switch_safe_free(sql); @@ -2092,9 +2185,14 @@ SWITCH_STANDARD_APP(callcenter_function) /* Start Thread that will playback different prompt to the channel */ switch_core_new_memory_pool(&pool); h = switch_core_alloc(pool, sizeof(*h)); + h->pool = pool; - h->uuid = switch_core_strdup(h->pool, uuid); + h->member_uuid = switch_core_strdup(h->pool, member_uuid); + h->queue_name = switch_core_strdup(h->pool, queue_name); + h->t_member_called = t_member_called; + h->member_cancel_reason = CC_MEMBER_CANCEL_REASON_NONE; h->running = 1; + switch_threadattr_create(&thd_attr, h->pool); switch_threadattr_detach_set(thd_attr, 1); switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); @@ -2104,16 +2202,37 @@ SWITCH_STANDARD_APP(callcenter_function) /* TODO Add DTMF callback support */ /* TODO add MOH infitite loop */ if (cc_moh_override) { - cur_moh = switch_core_session_strdup(session, cc_moh_override); + cur_moh = switch_core_session_strdup(member_session, cc_moh_override); } else { - cur_moh = switch_core_session_strdup(session, queue->moh); + cur_moh = switch_core_session_strdup(member_session, queue->moh); } queue_rwunlock(queue); - if (cur_moh) { - switch_ivr_play_file(session, NULL, cur_moh, &args); - } else { - switch_ivr_collect_digits_callback(session, &args, 0, 0); + while (switch_channel_ready(member_channel)) { + switch_input_args_t args = { 0 }; + + /* An agent was found, time to exit and let the bridge do it job */ + if ((agent_uuid = switch_channel_get_variable(member_channel, "cc_agent_uuid"))) { + break; + } + /* If the member thread set a different reason, we monitor it so we can quit the wait */ + if (h->member_cancel_reason != CC_MEMBER_CANCEL_REASON_NONE) { + break; + } + + switch_core_session_flush_private_events(member_session); + + if (cur_moh) { + switch_status_t status = switch_ivr_play_file(member_session, NULL, cur_moh, &args); + + if (!SWITCH_READ_ACCEPTABLE(status)) { + break; + } + + } else { + switch_ivr_collect_digits_callback(session, &args, 0, 0); + } + } /* Stop Member Thread */ @@ -2123,33 +2242,42 @@ SWITCH_STANDARD_APP(callcenter_function) /* Hangup any agents been callback */ if (!switch_channel_up(member_channel)) { /* If channel is still up, it mean that the member didn't hangup, so we should leave the agent alone */ - switch_core_session_hupall_matching_var("cc_member_uuid", uuid, SWITCH_CAUSE_ORIGINATOR_CANCEL); + switch_core_session_hupall_matching_var("cc_member_uuid", member_uuid, SWITCH_CAUSE_ORIGINATOR_CANCEL); sql = switch_mprintf("UPDATE members SET state = '%q', uuid = '', abandoned_epoch = '%ld' WHERE system = 'single_box' AND uuid = '%q'", - cc_member_state2str(CC_MEMBER_STATE_ABANDONED), (long) switch_epoch_time_now(NULL), uuid); + cc_member_state2str(CC_MEMBER_STATE_ABANDONED), (long) switch_epoch_time_now(NULL), member_uuid); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); + /* Generate an Event and update some channel variable */ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CALLCENTER_EVENT) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(member_channel, event); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Name", queue_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Queue", queue_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Action", "member-queue-end"); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Wait-Time", "%ld", (long) (switch_epoch_time_now(NULL) - t_member_called)); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Cause", "Abort"); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", uuid); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Member \"%s\" <%s> exit queue %s due to %s\n", + switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), + switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), + queue_name, cc_member_cancel_reason2str(h->member_cancel_reason)); + + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Cause", cc_member_cancel_reason2str(h->member_cancel_reason)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", member_uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Name", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name"))); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Number", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number"))); switch_event_fire(&event); } + /* for xml_cdr needs */ switch_channel_set_variable_printf(member_channel, "cc_queue_canceled_epoch", "%ld", (long) switch_epoch_time_now(NULL)); + switch_channel_set_variable_printf(member_channel, "cc_cause", "%s", cc_member_cancel_reason2str(h->member_cancel_reason)); /* Send Event with queue count */ cc_queue_count(queue_name); } else { + switch_channel_set_variable_printf(member_channel, "cc_cause", "%s", "answered"); sql = switch_mprintf("UPDATE members SET state = '%q', bridge_epoch = '%ld' WHERE system = 'single_box' AND uuid = '%q'", - cc_member_state2str(CC_MEMBER_STATE_ANSWERED), (long) switch_epoch_time_now(NULL), uuid); + cc_member_state2str(CC_MEMBER_STATE_ANSWERED), (long) switch_epoch_time_now(NULL), member_uuid); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); @@ -2525,7 +2653,7 @@ SWITCH_STANDARD_API(cc_config_api_function) stream->write_function(stream, "%d\n", atoi(res)); if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CALLCENTER_EVENT) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Name", queue_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Queue", queue_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Action", "members-count"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Count", res); switch_event_fire(&event); commit 8114b3f18d4a6e8ec396774bd78cb50145b91158 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Sep 7 21:16:00 2010 -0500 speed up db action in sofia recover diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 15efc1a..82b933c 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -4664,22 +4664,22 @@ void sofia_glue_tech_track(sofia_profile_t *profile, switch_core_session_t *sess return; } - if (sofia_test_flag(tech_pvt, TFLAG_TRACKED)) { - sofia_glue_tech_untrack(profile, session, SWITCH_TRUE); - } - if (switch_ivr_generate_xml_cdr(session, &cdr) == SWITCH_STATUS_SUCCESS) { xml_cdr_text = switch_xml_toxml(cdr, SWITCH_FALSE); switch_xml_free(cdr); } if (xml_cdr_text) { - sql = switch_mprintf("insert into sip_recovery (runtime_uuid, profile_name, hostname, uuid, metadata) values ('%q','%q','%q','%q','%q')", - switch_core_get_uuid(), profile->name, mod_sofia_globals.hostname, switch_core_session_get_uuid(session), xml_cdr_text); - + if (sofia_test_flag(tech_pvt, TFLAG_TRACKED)) { + sql = switch_mprintf("update sip_recovery set metadata='%q' where uuid='%q'", xml_cdr_text, switch_core_session_get_uuid(session)); + } else { + + sql = switch_mprintf("insert into sip_recovery (runtime_uuid, profile_name, hostname, uuid, metadata) values ('%q','%q','%q','%q','%q')", + switch_core_get_uuid(), profile->name, mod_sofia_globals.hostname, switch_core_session_get_uuid(session), xml_cdr_text); + } + if (sofia_test_pflag(profile, PFLAG_TRACK_CALLS_EVENTS)) { switch_event_t *event = NULL; - if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_RECOVERY_SEND) == SWITCH_STATUS_SUCCESS) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "profile_name", profile->name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "sql", sql); @@ -4687,8 +4687,8 @@ void sofia_glue_tech_track(sofia_profile_t *profile, switch_core_session_t *sess } } + sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE); - sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); free(xml_cdr_text); sofia_set_flag(tech_pvt, TFLAG_TRACKED); commit f708ee1a0bb2a66b6e87e6fd0e0c496092eb1494 Author: Moises Silva <moy@sangoma.com> Date: Tue Sep 7 21:21:11 2010 -0400 freetdm: fix help message diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 56eebd7..fb85b35 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -3896,7 +3896,7 @@ SWITCH_STANDARD_API(ft_function) ftdm_channel_t *fchan = NULL; ftdm_span_t *span = NULL; if (argc < 2) { - stream->write_function(stream, "-ERR Usage: oz notrace <span_id> [<chan_id>]\n"); + stream->write_function(stream, "-ERR Usage: ftdm notrace <span_id> [<chan_id>]\n"); goto end; } ftdm_span_find_by_name(argv[1], &span); commit 9a8bd09360dff4d80a0f1eae2e127109f8bb4e5f Merge: c219a73 a13cfa4 Author: Moises Silva <moy@sangoma.com> Date: Tue Sep 7 18:47:52 2010 -0400 Merge remote branch 'fsorig/master' commit a13cfa488bb2fd39f0e83e277709c9bee7b3271a Author: Moises Silva <moy@sangoma.com> Date: Tue Sep 7 18:33:40 2010 -0400 freetdm: add new files for vs2008 project diff --git a/libs/freetdm/msvc/freetdm.2008.vcproj b/libs/freetdm/msvc/freetdm.2008.vcproj index 851017e..c72891e 100644 --- a/libs/freetdm/msvc/freetdm.2008.vcproj +++ b/libs/freetdm/msvc/freetdm.2008.vcproj @@ -339,6 +339,10 @@ > </File> <File + RelativePath="..\src\include\private\ftdm_call_utils.h" + > + </File> + <File RelativePath="..\src\include\private\ftdm_config.h" > </File> @@ -417,6 +421,10 @@ > </File> <File + RelativePath="..\src\ftdm_call_utils.c" + > + </File> + <File RelativePath="..\src\ftdm_callerid.c" > </File> commit c219a73c0634a4b93e021e984589da5dc8f3b2b4 Author: Konrad Hammel <konrad@sangoma.com> Date: Tue Sep 7 17:44:43 2010 -0400 freetdm: ss7- added support for incoming group blocks, started adding support for ansi diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c index c8c8bc3..4476429 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c @@ -444,8 +444,8 @@ int ftmod_ss7_mtp3_gen_config(void) cfg.t.cfg.s.snGen.tmr.t21.enb = TRUE; /* t21 - waiting to restart traffic routed through adjacent SP */ cfg.t.cfg.s.snGen.tmr.t21.val = 650; # if (SS7_ANS92 || SS7_ANS88 || SS7_ANS96 || defined(TDS_ROLL_UPGRADE_SUPPORT)) - cfg.t.cfg.s.snGen.t26.enb = TRUE; /* t26 - waiting to repeat traffic restart waiting message for ANSI */ - cfg.t.cfg.s.snGen.t26.val = 600; + cfg.t.cfg.s.snGen.tmr.t26.enb = TRUE; /* t26 - waiting to repeat traffic restart waiting message for ANSI */ + cfg.t.cfg.s.snGen.tmr.t26.val = 600; # endif #endif @@ -744,10 +744,6 @@ int ftmod_ss7_mtp3_dlsap_config(int id) cfg.t.cfg.s.snDLSAP.msgPrior = 0; /* management message priority */ cfg.t.cfg.s.snDLSAP.lnkType = k->mtp3.linkType; /* link type ANSI, ITU, BICI or CHINA */ cfg.t.cfg.s.snDLSAP.upSwtch = k->mtp3.switchType; /* user part switch type */ -# if (SS7_ANS92 || SS7_ANS88 || SS7_ANS96 || SS7_CHINA) - cfg.t.cfg.s.snDLSAP.l2Type = LSN_MTP2_56KBPS; /* layer 2 type - 56kbps MTP2 link, 1.536Mbps MTP2 link or QSAAL link */ - cfg.t.cfg.s.snDLSAP.isCLink = FALSE; /* identifies if the link is a C type link.Required to check if sls has to be rotated.*/ -# endif cfg.t.cfg.s.snDLSAP.maxSLTtry = MAX_SLTM_RETRIES; /* maximun times to retry SLTM */ cfg.t.cfg.s.snDLSAP.p0QLen = 32; /* size of the priority 0 Q */ cfg.t.cfg.s.snDLSAP.p1QLen = 32; /* size of the priority 1 Q */ @@ -775,17 +771,46 @@ int ftmod_ss7_mtp3_dlsap_config(int id) cfg.t.cfg.s.snDLSAP.selector = 0; /* lower layer selector */ cfg.t.cfg.s.snDLSAP.mem.region = S_REG; /* memory region id */ cfg.t.cfg.s.snDLSAP.mem.pool = S_POOL; /* memory pool id */ -#if( SS7_ANS92 || SS7_ANS88 || SS7_ANS96 || SS7_CHINA ) - cfg.t.cfg.s.snDLSAP.dpcLen = DPC24; /* dpc length 24 bits */ -#else - cfg.t.cfg.s.snDLSAP.dpcLen = DPC14; /* dpc length 14 bits */ -#endif cfg.t.cfg.s.snDLSAP.spId = k->mtp3.mtp2Id ;/* service provider id */ -#if (SS7_ITU88 || SS7_CHINA || SS7_TTC || SS7_NTT || SS7_BICI ) - cfg.t.cfg.s.snDLSAP.flushContFlag = FALSE; /* flush continue handling */ -#else - cfg.t.cfg.s.snDLSAP.flushContFlag = TRUE; /* flush continue handling */ -#endif + + switch (k->mtp3.linkType) { + /**************************************************************************/ + case (LSN_SW_ANS): + case (LSN_SW_ANS96): + case (LSN_SW_CHINA): + cfg.t.cfg.s.snDLSAP.dpcLen = DPC24; /* dpc length 24 bits */ + cfg.t.cfg.s.snDLSAP.l2Type = LSN_MTP2_56KBPS; /* layer 2 type - 56kbps MTP2 link, 1.536Mbps MTP2 link or QSAAL link */ + cfg.t.cfg.s.snDLSAP.isCLink = FALSE; /* identifies if the link is a C type link.Required to check if sls has to be rotated.*/ + break; + /**************************************************************************/ + case (LSN_SW_ITU): + cfg.t.cfg.s.snDLSAP.dpcLen = DPC14; /* dpc length 14 bits */ + break; + /**************************************************************************/ + default: + cfg.t.cfg.s.snDLSAP.dpcLen = DPC14; /* dpc length 14 bits */ + break; + /**************************************************************************/ + } /* switch (k->mtp3.linkType) */ + + switch (k->mtp3.linkType) { + /**************************************************************************/ + case (LSN_SW_ANS): + case (LSN_SW_ANS96): + cfg.t.cfg.s.snDLSAP.flushContFlag = TRUE; /* flush continue handling */ + break; + /**************************************************************************/ + case (LSN_SW_ITU): + case (LSN_SW_CHINA): + cfg.t.cfg.s.snDLSAP.flushContFlag = FALSE; /* flush continue handling */ + break; + /**************************************************************************/ + default: + cfg.t.cfg.s.snDLSAP.flushContFlag = FALSE; /* flush continue handling */ + break; + /**************************************************************************/ + } /* switch (k->mtp3.linkType) */ + cfg.t.cfg.s.snDLSAP.tmr.t1.enb = TRUE; /* t1 - delay to avoid missequencing on changeover */ cfg.t.cfg.s.snDLSAP.tmr.t1.val = k->mtp3.t1; cfg.t.cfg.s.snDLSAP.tmr.t2.enb = TRUE; /* t2 - waiting for changeover ack */ @@ -1209,12 +1234,12 @@ int ftmod_ss7_isup_ckt_config(int id) cfg.t.cfg.s.siCir.typeCntrl = k->typeCntrl; /* type of control */ cfg.t.cfg.s.siCir.contReq = FALSE; /* continuity check required */ #if (SI_218_COMP || SS7_ANS88 || SS7_ANS92 || SS7_ANS95 || SS7_BELL) - cfg.t.cfg.s.siCir.firstCic =; /* First cic in the circuit group */ - cfg.t.cfg.s.siCir.numCir =; /* Number of circuits in the circuit group */ + cfg.t.cfg.s.siCir.firstCic = 1; /* First cic in the circuit group */ + cfg.t.cfg.s.siCir.numCir = 24; /* Number of circuits in the circuit group */ cfg.t.cfg.s.siCir.nonSS7Con = TRUE; /* connecting to non SS7 network */ - cfg.t.cfg.s.siCir.outTrkGrpN =; /* outgoing trunk group number (For EXM) */ - cfg.t.cfg.s.siCir.cvrTrkClli =; /* Trunk Group number (For CVR validation) */ - cfg.t.cfg.s.siCir.clli =; /* common language location identifier */ + cfg.t.cfg.s.siCir.outTrkGrpN.length = 0; /* outgoing trunk group number (For EXM) */ + cfg.t.cfg.s.siCir.cvrTrkClli.length = 0; /* Trunk Group number (For CVR validation) */ + cfg.t.cfg.s.siCir.clli.length = 0; /* common language location identifier */ #endif cfg.t.cfg.s.siCir.cirTmr.t3.enb = TRUE; /* t3 timer - overload received */ cfg.t.cfg.s.siCir.cirTmr.t3.val = k->t3; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index f0cfa02..0c3dcff 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -71,6 +71,8 @@ ftdm_status_t handle_ubl_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ ftdm_status_t handle_local_blk(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_cgb_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_cgu_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); /******************************************************************************/ /* FUNCTIONS ******************************************************************/ @@ -898,12 +900,12 @@ ftdm_status_t handle_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ /**************************************************************************/ case SIT_STA_CGBREQ: /* CGB request */ SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CGB\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + handle_cgb_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_CGUREQ: /* CGU request */ SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CGU\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + handle_cgu_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_CGQRYREQ: /* circuit group query request */ @@ -913,7 +915,7 @@ ftdm_status_t handle_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ /**************************************************************************/ case SIT_STA_CGBRSP: /* mntc. oriented CGB response */ SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx mntc CGB\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + handle_cgb_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_CGURSP: /* mntc. oriented CGU response */ @@ -1012,8 +1014,8 @@ ftdm_status_t handle_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ break; /**************************************************************************/ case SIT_STA_CGBINFOIND: /* circuit grp blking ind , no resp req */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CGB no resp req\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + /*SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CGB no resp req\n");*/ +/* handle_cgb_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt);*/ break; /**************************************************************************/ case SIT_STA_LMCQMINFOREQ: /* when LM requests ckt grp query */ @@ -1989,6 +1991,265 @@ ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit return FTDM_SUCCESS; } +/******************************************************************************/ +ftdm_status_t handle_cgb_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +{ + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + + sngss7_chan_data_t *sngss7_info = NULL; + sngss7_span_data_t *sngss7_span = NULL; + ftdm_channel_t *ftdmchan = NULL; + int range; + uint8_t status[255]; + int blockType = 0; + int byte = 0; + int bit = 0; + int x; + + memset(&status[0], '\0', sizeof(status)); + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + /* grab the span info */ + sngss7_span = ftdmchan->span->mod_data; + + /* figure out what type of block needs to be applied */ + if ((siStaEvnt->cgsmti.eh.pres == PRSNT_NODEF) && (siStaEvnt->cgsmti.typeInd.pres == PRSNT_NODEF)) { + blockType = siStaEvnt->cgsmti.typeInd.val; + } else { + SS7_ERROR("Received CGB with no circuit group supervision value on CIC = %d\n", sngss7_info->circuit->cic); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + /* pull out the range value */ + if ((siStaEvnt->rangStat.eh.pres == PRSNT_NODEF) && (siStaEvnt->rangStat.range.pres == PRSNT_NODEF)) { + range = siStaEvnt->rangStat.range.val; + } else { + SS7_ERROR("Received CGB with no range value on CIC = %d\n", sngss7_info->circuit->cic); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + /* pull out the status field */ + if ((siStaEvnt->rangStat.eh.pres == PRSNT_NODEF) && (siStaEvnt->rangStat.status.pres == PRSNT_NODEF)) { + for (x = 0; x < siStaEvnt->rangStat.status.len; x++) { + status[x] = siStaEvnt->rangStat.status.val[x]; + } + } else { + SS7_ERROR("Received CGB with no status value on CIC = %d\n", sngss7_info->circuit->cic); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + /* save the circuit, range and status */ + sngss7_span->rx_cgb.circuit = circuit; + sngss7_span->rx_cgb.range = range; + sngss7_span->rx_cgb.type = blockType; + for (x = 0; x < siStaEvnt->rangStat.status.len; x++) { + sngss7_span->rx_cgb.status[x] = status[x]; + } + + /* loop over the cics starting from circuit until range+1 */ + for (x = circuit; x < (circuit + range + 1); x++) { + /* grab the circuit in question */ + if (extract_chan_data(x, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", x); + break; + } + + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + SS7_ASSERT; + }; + +#if 1 + SS7_ERROR("KONRAD -> circuit=%d, byte=%d, bit=%d, status[byte]=%d, math=%d\n", + x, + byte, + bit, + status[byte], + (status[byte] & (1 << bit))); +#endif + if (status[byte] & (1 << bit)) { + switch (blockType) { + /**********************************************************************/ + case 0: /* maintenance oriented */ + sngss7_set_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX); + break; + /**********************************************************************/ + case 1: /* hardware failure oriented */ + sngss7_set_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX); + break; + /**********************************************************************/ + case 2: /* reserved for national use */ + break; + /**********************************************************************/ + default: + break; + /**********************************************************************/ + } /* switch (blockType) */ + } + + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); + + /* update the bit and byte counter*/ + bit ++; + if (bit == 8) { + byte++; + bit = 0; + } + + } /* for (x = circuit; x < (circuit + range + 1); x++) */ + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + ft_to_sngss7_cgba(ftdmchan); + + return FTDM_SUCCESS; +} + +/******************************************************************************/ +ftdm_status_t handle_cgu_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +{ + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + + sngss7_chan_data_t *sngss7_info = NULL; + sngss7_span_data_t *sngss7_span = NULL; + ftdm_channel_t *ftdmchan = NULL; + int range; + uint8_t status[255]; + int blockType = 0; + int byte = 0; + int bit = 0; + int x; + + memset(&status[0], '\0', sizeof(status)); + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + /* grab the span info */ + sngss7_span = ftdmchan->span->mod_data; + + /* figure out what type of block needs to be applied */ + if ((siStaEvnt->cgsmti.eh.pres == PRSNT_NODEF) && (siStaEvnt->cgsmti.typeInd.pres == PRSNT_NODEF)) { + blockType = siStaEvnt->cgsmti.typeInd.val; + } else { + SS7_ERROR("Received CGB with no circuit group supervision value on CIC = %d\n", sngss7_info->circuit->cic); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + /* pull out the range value */ + if ((siStaEvnt->rangStat.eh.pres == PRSNT_NODEF) && (siStaEvnt->rangStat.range.pres == PRSNT_NODEF)) { + range = siStaEvnt->rangStat.range.val; + } else { + SS7_ERROR("Received CGB with no range value on CIC = %d\n", sngss7_info->circuit->cic); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + /* pull out the status field */ + if ((siStaEvnt->rangStat.eh.pres == PRSNT_NODEF) && (siStaEvnt->rangStat.status.pres == PRSNT_NODEF)) { + for (x = 0; x < siStaEvnt->rangStat.status.len; x++) { + status[x] = siStaEvnt->rangStat.status.val[x]; + } + } else { + SS7_ERROR("Received CGB with no status value on CIC = %d\n", sngss7_info->circuit->cic); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + /* save the circuit, range and status */ + sngss7_span->rx_cgu.circuit = circuit; + sngss7_span->rx_cgu.range = range; + sngss7_span->rx_cgu.type = blockType; + for (x = 0; x < siStaEvnt->rangStat.status.len; x++) { + sngss7_span->rx_cgu.status[x] = status[x]; + } + + /* loop over the cics starting from circuit until range+1 */ + for (x = circuit; x < (circuit + range + 1); x++) { + /* grab the circuit in question */ + if (extract_chan_data(x, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", x); + break; + } + + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + SS7_ASSERT; + }; + + if (status[byte] & (1 << bit)) { + switch (blockType) { + /**********************************************************************/ + case 0: /* maintenance oriented */ + sngss7_clear_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX); + break; + /**********************************************************************/ + case 1: /* hardware failure oriented */ + sngss7_clear_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX); + break; + /**********************************************************************/ + case 2: /* reserved for national use */ + break; + /**********************************************************************/ + default: + break; + /**********************************************************************/ + } /* switch (blockType) */ + } /* */ + + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); + + /* update the bit and byte counter*/ + bit ++; + if (bit == 8) { + byte++; + bit = 0; + } + + } /* for (x = circuit; x < (circuit + range + 1); x++) */ + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + ft_to_sngss7_cgua(ftdmchan); + + return FTDM_SUCCESS; +} /******************************************************************************/ /* For Emacs: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index 66efe1a..9986b29 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -272,10 +272,8 @@ static void *ftdm_sangoma_ss7_run(ftdm_thread_t * me, void *obj) ftdm_interrupt_t *ftdm_sangoma_ss7_int[2]; ftdm_span_t *ftdmspan = (ftdm_span_t *) obj; ftdm_channel_t *ftdmchan = NULL; - sngss7_chan_data_t *sngss7_info = NULL; sngss7_event_data_t *sngss7_event = NULL; sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->mod_data; - int i; ftdm_log (FTDM_LOG_INFO, "ftmod_sangoma_ss7 monitor thread for span=%u started.\n", ftdmspan->span_id); @@ -344,73 +342,11 @@ static void *ftdm_sangoma_ss7_run(ftdm_thread_t * me, void *obj) /**********************************************************************/ } /* switch ((ftdm_interrupt_wait(ftdm_sangoma_ss7_int, 100))) */ - /* extract the span data structure */ - sngss7_span = (sngss7_span_data_t *)ftdmspan->mod_data; - /* check if there is a GRS being processed on the span */ if (sngss7_span->rx_grs.range > 0) { - ftdm_log(FTDM_LOG_DEBUG, "Found Rx GRS on span %d...checking circuits\n", ftdmspan->span_id); - /*SS7_DEBUG("Found Rx GRS on span %d...checking circuits\n", ftdmspan->span_id);*/ - - /* check all the circuits in the range to see if they are done resetting */ - for ( i = sngss7_span->rx_grs.circuit; i < (sngss7_span->rx_grs.circuit + sngss7_span->rx_grs.range + 1); i++) { - - /* extract the channel in question */ - if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", i); - SS7_ASSERT; - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a state change pending on the channel */ - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { - /* check the state to the GRP_RESET_RX_DN flag */ - if (!sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_RX_DN)) { - /* this channel is still resetting...do nothing */ - goto GRS_UNLOCK_ALL; - } /* if (!sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_RX_DN)) */ - } else { - /* state change pending */ - goto GRS_UNLOCK_ALL; - } - } /* for ( i = circuit; i < (circuit + range + 1); i++) */ - - SS7_DEBUG("All circuits out of reset for GRS: circuit=%d, range=%d\n", - sngss7_span->rx_grs.circuit, - sngss7_span->rx_grs.range); - - /* check all the circuits in the range to see if they are done resetting */ - for ( i = sngss7_span->rx_grs.circuit; i < (sngss7_span->rx_grs.circuit + sngss7_span->rx_grs.range + 1); i++) { - - /* extract the channel in question */ - if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n",i); - SS7_ASSERT; - } - - /* throw the GRP reset flag complete flag */ - sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_RX_CMPLT); - - /* move the channel to the down state */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - - } /* for ( i = circuit; i < (circuit + range + 1); i++) */ - -GRS_UNLOCK_ALL: - for ( i = sngss7_span->rx_grs.circuit; i < (sngss7_span->rx_grs.circuit + sngss7_span->rx_grs.range + 1); i++) { - /* extract the channel in question */ - if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", i); - SS7_ASSERT; - } - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - } - - } /* if (ftdmspan->grs.range > 0) */ + /* check if the rx_grs has cleared */ + check_if_rx_grs_processed(ftdmspan); + } /* if (sngss7_span->rx_grs.range > 0) */ } /* master while loop */ /* clear the IN_THREAD flag so that we know the thread is done */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index 050f59e..c9dbfb3 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -139,7 +139,6 @@ typedef struct sng_mtp_link { uint32_t t23; uint32_t t24; uint32_t t25; - uint32_t t26; uint32_t t27; uint32_t t28; uint32_t t29; @@ -188,6 +187,7 @@ typedef struct sng_route { uint32_t t19; uint32_t t21; uint32_t t25; + uint32_t t26; } sng_route_t; typedef struct sng_isup_intf { @@ -329,6 +329,8 @@ typedef struct sngss7_glare_data { typedef struct sngss7_group_data { uint32_t circuit; uint32_t range; + uint8_t status[255]; + uint8_t type; }sngss7_group_data_t; typedef struct sngss7_chan_data { @@ -348,6 +350,10 @@ typedef struct sngss7_span_data { ftdm_sched_t *sched; sngss7_group_data_t rx_grs; sngss7_group_data_t tx_grs; + sngss7_group_data_t rx_cgb; + sngss7_group_data_t tx_cgb; + sngss7_group_data_t rx_cgu; + sngss7_group_data_t tx_cgu; ftdm_queue_t *event_queue; }sngss7_span_data_t; @@ -376,8 +382,8 @@ typedef struct sngss7_event_data typedef enum { - FLAG_RESET_RX = (1 << 0), - FLAG_RESET_TX = (1 << 1), + FLAG_RESET_RX = (1 << 0), + FLAG_RESET_TX = (1 << 1), FLAG_RESET_SENT = (1 << 2), FLAG_RESET_TX_RSP = (1 << 3), FLAG_GRP_RESET_RX = (1 << 4), @@ -387,27 +393,25 @@ typedef enum { FLAG_GRP_RESET_TX = (1 << 8), FLAG_GRP_RESET_SENT = (1 << 9), FLAG_GRP_RESET_TX_RSP = (1 << 10), - FLAG_REMOTE_REL = (1 << 11), - FLAG_LOCAL_REL = (1 << 12), - FLAG_GLARE = (1 << 13), - FLAG_INFID_RESUME = (1 << 14), - FLAG_INFID_PAUSED = (1 << 15), + FLAG_REMOTE_REL = (1 << 11), + FLAG_LOCAL_REL = (1 << 12), + FLAG_GLARE = (1 << 13), + FLAG_INFID_RESUME = (1 << 14), + FLAG_INFID_PAUSED = (1 << 15), FLAG_CKT_UCIC_BLOCK = (1 << 16), FLAG_CKT_UCIC_UNBLK = (1 << 17), FLAG_CKT_LC_BLOCK_RX = (1 << 18), FLAG_CKT_LC_UNBLK_RX = (1 << 19), FLAG_CKT_MN_BLOCK_RX = (1 << 20), - FLAG_CKT_MN_BLOCK_TX = (1 << 21), - FLAG_CKT_MN_UNBLK_RX = (1 << 22), + FLAG_CKT_MN_UNBLK_RX = (1 << 21), + FLAG_CKT_MN_BLOCK_TX = (1 << 22), FLAG_CKT_MN_UNBLK_TX = (1 << 23), FLAG_GRP_HW_BLOCK_RX = (1 << 24), FLAG_GRP_HW_BLOCK_TX = (1 << 25), FLAG_GRP_MN_BLOCK_RX = (1 << 26), FLAG_GRP_MN_BLOCK_TX = (1 << 27), - FLAG_GRP_HW_UNBLK_RX = (1 << 28), - FLAG_GRP_HW_UNBLK_TX = (1 << 29), - FLAG_GRP_MN_UNBLK_RX = (1 << 30), - FLAG_GRP_MN_UNBLK_TX = (1 << 31) + FLAG_GRP_HW_UNBLK_TX = (1 << 28), + FLAG_GRP_MN_UNBLK_TX = (1 << 29) } flag_t; /******************************************************************************/ @@ -465,6 +469,8 @@ void ft_to_sngss7_uba(ftdm_channel_t *ftdmchan); void ft_to_sngss7_lpa(ftdm_channel_t *ftdmchan); void ft_to_sngss7_gra(ftdm_channel_t *ftdmchan); void ft_to_sngss7_grs(ftdm_channel_t *ftdmchan); +void ft_to_sngss7_cgba(ftdm_channel_t * ftdmchan); +void ft_to_sngss7_cgua(ftdm_channel_t * ftdmchan); void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); void sngss7_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); @@ -524,6 +530,8 @@ int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *spa void handle_isup_t35(void *userdata); ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const char *data); + +ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan); /******************************************************************************/ /* MACROS *********************************************************************/ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index 4fac251..079f5e3 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -42,24 +42,27 @@ /******************************************************************************/ /* PROTOTYPES *****************************************************************/ -void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan); -void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan); -void ft_to_sngss7_anm (ftdm_channel_t * ftdmchan); -void ft_to_sngss7_rel (ftdm_channel_t * ftdmchan); -void ft_to_sngss7_rlc (ftdm_channel_t * ftdmchan); +void ft_to_sngss7_iam(ftdm_channel_t * ftdmchan); +void ft_to_sngss7_acm(ftdm_channel_t * ftdmchan); +void ft_to_sngss7_anm(ftdm_channel_t * ftdmchan); +void ft_to_sngss7_rel(ftdm_channel_t * ftdmchan); +void ft_to_sngss7_rlc(ftdm_channel_t * ftdmchan); -void ft_to_sngss7_rsc (ftdm_channel_t * ftdmchan); -void ft_to_sngss7_rsca (ftdm_channel_t * ftdmchan); +void ft_to_sngss7_rsc(ftdm_channel_t * ftdmchan); +void ft_to_sngss7_rsca(ftdm_channel_t * ftdmchan); -void ft_to_sngss7_blo (ftdm_channel_t * ftdmchan); -void ft_to_sngss7_bla (ftdm_channel_t * ftdmchan); -void ft_to_sngss7_ubl (ftdm_channel_t * ftdmchan); -void ft_to_sngss7_uba (ftdm_channel_t * ftdmchan); +void ft_to_sngss7_blo(ftdm_channel_t * ftdmchan); +void ft_to_sngss7_bla(ftdm_channel_t * ftdmchan); +void ft_to_sngss7_ubl(ftdm_channel_t * ftdmchan); +void ft_to_sngss7_uba(ftdm_channel_t * ftdmchan); -void ft_to_sngss7_lpa (ftdm_channel_t * ftdmchan); +void ft_to_sngss7_lpa(ftdm_channel_t * ftdmchan); -void ft_to_sngss7_gra (ftdm_channel_t * ftdmchan); -void ft_to_sngss7_grs (ftdm_channel_t * ftdmchan); +void ft_to_sngss7_gra(ftdm_channel_t * ftdmchan); +void ft_to_sngss7_grs(ftdm_channel_t * ftdmchan); + +void ft_to_sngss7_cgba(ftdm_channel_t * ftdmchan); +void ft_to_sngss7_cgua(ftdm_channel_t * ftdmchan); /******************************************************************************/ /* FUNCTIONS ******************************************************************/ @@ -113,6 +116,56 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) iam.txMedReq.eh.pres = PRSNT_NODEF; iam.txMedReq.trMedReq.pres = PRSNT_NODEF; iam.txMedReq.trMedReq.val = ftdmchan->caller_data.bearer_capability; + + if ((g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId].switchType == LSI_SW_ANS88) || + (g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId].switchType == LSI_SW_ANS92) || + (g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId].switchType == LSI_SW_ANS95)) { + + iam.usrServInfoA.eh.pres = PRSNT_NODEF; + + iam.usrServInfoA.infoTranCap.pres = PRSNT_NODEF; + switch (ftdmchan->caller_data.bearer_capability) { + /**********************************************************************/ + case (FTDM_BEARER_CAP_SPEECH): + iam.usrServInfoA.infoTranCap.val = 0x0; /* speech as per ATIS-1000113.3.2005 */ + break; + /**********************************************************************/ + case (FTDM_BEARER_CAP_64K_UNRESTRICTED): + iam.usrServInfoA.infoTranCap.val = 0x8; /* unrestricted digital as per ATIS-1000113.3.2005 */ + break; + /**********************************************************************/ + case (FTDM_BEARER_CAP_3_1KHZ_AUDIO): + iam.usrServInfoA.infoTranCap.val = 0x10; /* 3.1kHz audio as per ATIS-1000113.3.2005 */ + break; + /**********************************************************************/ + default: + SS7_ERROR_CHAN(ftdmchan, "Unknown Bearer capability falling back to speech%s\n", " "); + iam.usrServInfoA.infoTranCap.val = 0x0; /* speech as per ATIS-1000113.3.2005 */ + break; + /**********************************************************************/ + } /* switch (ftdmchan->caller_data.bearer_capability) */ + + iam.usrServInfoA.cdeStand.pres = PRSNT_NODEF; + iam.usrServInfoA.cdeStand.val = 0x0; /* ITU-T standardized coding */ + iam.usrServInfoA.tranMode.pres = PRSNT_NODEF; + iam.usrServInfoA.tranMode.val = 0x0; /* circuit mode */ + iam.usrServInfoA.infoTranRate0.pres = PRSNT_NODEF; + iam.usrServInfoA.infoTranRate0.val = 0x10; /* 64kbps origination to destination */ + iam.usrServInfoA.infoTranRate1.pres = PRSNT_NODEF; + iam.usrServInfoA.infoTranRate1.val = 0x10; /* 64kbps destination to origination */ + iam.usrServInfoA.chanStruct.pres = PRSNT_NODEF; + iam.usrServInfoA.chanStruct.val = 0x1; /* 8kHz integrity */ + iam.usrServInfoA.config.pres = PRSNT_NODEF; + iam.usrServInfoA.config.val = 0x0; /* point to point configuration */ + iam.usrServInfoA.establish.pres = PRSNT_NODEF; + iam.usrServInfoA.establish.val = 0x0; /* on demand */ + iam.usrServInfoA.symmetry.pres = PRSNT_NODEF; + iam.usrServInfoA.symmetry.val = 0x0; /* bi-directional symmetric */ + iam.usrServInfoA.usrInfLyr1Prot.pres = PRSNT_NODEF; + iam.usrServInfoA.usrInfLyr1Prot.val = 0x2; /* G.711 ulaw */ + iam.usrServInfoA.rateMultiplier.pres = PRSNT_NODEF; + iam.usrServInfoA.rateMultiplier.val = 0x1; /* 1x rate multipler */ + } /* if ANSI */ /* copy down the called number information */ copy_cdPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cdPtyNum); @@ -126,7 +179,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) sngss7_info->circuit->id, &iam, 0); - + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx IAM\n"); SS7_FUNC_TRACE_EXIT (__FUNCTION__); @@ -463,7 +516,7 @@ void ft_to_sngss7_grs (ftdm_channel_t * ftdmchan) SiStaEvnt grs; - memset (&grs, 0x0, sizeof (grs)); + memset (&grs, 0x0, sizeof(grs)); grs.rangStat.eh.pres = PRSNT_NODEF; grs.rangStat.range.pres = PRSNT_NODEF; @@ -486,6 +539,101 @@ return; } /******************************************************************************/ +void ft_to_sngss7_cgba(ftdm_channel_t * ftdmchan) +{ + SS7_FUNC_TRACE_ENTER (__FUNCTION__); + + sngss7_span_data_t *sngss7_span = ftdmchan->span->mod_data; + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + int x = 0; + + SiStaEvnt cgba; + + memset (&cgba, 0x0, sizeof(cgba)); + + /* fill in the circuit group supervisory message */ + cgba.cgsmti.eh.pres = PRSNT_NODEF; + cgba.cgsmti.typeInd.pres = PRSNT_NODEF; + cgba.cgsmti.typeInd.val = sngss7_span->rx_cgb.type; + + cgba.rangStat.eh.pres = PRSNT_NODEF; + /* fill in the range */ + cgba.rangStat.range.pres = PRSNT_NODEF; + cgba.rangStat.range.val = sngss7_span->rx_cgb.range; + /* fill in the status */ + cgba.rangStat.status.pres = PRSNT_NODEF; + cgba.rangStat.status.len = ((sngss7_span->rx_cgb.range + 1) >> 3) + (((sngss7_span->rx_cgb.range + 1) & 0x07) ? 1 : 0); + for(x = 0; x < cgba.rangStat.status.len; x++){ + cgba.rangStat.status.val[x] = sngss7_span->rx_cgb.status[x]; + } + + sng_cc_sta_request (1, + 0, + 0, + sngss7_span->rx_cgb.circuit, + 0, + SIT_STA_CGBRSP, + &cgba); + + SS7_INFO_CHAN(ftdmchan, "Tx CGBA (%d:%d)\n", + sngss7_info->circuit->cic, + (sngss7_info->circuit->cic + sngss7_span->rx_cgb.range)); + + /* clean out the saved data */ + memset(&sngss7_span->rx_cgb, 0x0, sizeof(sngss7_group_data_t)); + + SS7_FUNC_TRACE_EXIT (__FUNCTION__); + return; +} + +/******************************************************************************/ +void ft_to_sngss7_cgua(ftdm_channel_t * ftdmchan) +{ + SS7_FUNC_TRACE_ENTER (__FUNCTION__); + + sngss7_span_data_t *sngss7_span = ftdmchan->span->mod_data; + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + int x = 0; + + SiStaEvnt cgua; + + memset (&cgua, 0x0, sizeof(cgua)); + + /* fill in the circuit group supervisory message */ + cgua.cgsmti.eh.pres = PRSNT_NODEF; + cgua.cgsmti.typeInd.pres = PRSNT_NODEF; + cgua.cgsmti.typeInd.val = sngss7_span->rx_cgu.type; + + cgua.rangStat.eh.pres = PRSNT_NODEF; + /* fill in the range */ + cgua.rangStat.range.pres = PRSNT_NODEF; + cgua.rangStat.range.val = sngss7_span->rx_cgu.range; + /* fill in the status */ + cgua.rangStat.status.pres = PRSNT_NODEF; + cgua.rangStat.status.len = ((sngss7_span->rx_cgu.range + 1) >> 3) + (((sngss7_span->rx_cgu.range + 1) & 0x07) ? 1 : 0); + for(x = 0; x < cgua.rangStat.status.len; x++){ + cgua.rangStat.status.val[x] = sngss7_span->rx_cgu.status[x]; + } + + sng_cc_sta_request (1, + 0, + 0, + sngss7_span->rx_cgu.circuit, + 0, + SIT_STA_CGURSP, + &cgua); + + SS7_INFO_CHAN(ftdmchan, "Tx CGUA (%d:%d)\n", + sngss7_info->circuit->cic, + (sngss7_info->circuit->cic + sngss7_span->rx_cgu.range)); + + /* clean out the saved data */ + memset(&sngss7_span->rx_cgu, 0x0, sizeof(sngss7_group_data_t)); + + SS7_FUNC_TRACE_EXIT (__FUNCTION__); + return; +} +/******************************************************************************/ /* For Emacs: * Local Variables: * mode:c diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 97957f3..4ec57fe 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -57,6 +57,7 @@ unsigned long get_unique_id(void); ftdm_status_t extract_chan_data(uint32_t circuit, sngss7_chan_data_t **sngss7_info, ftdm_channel_t **ftdmchan); +ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan); /******************************************************************************/ /* FUNCTIONS ******************************************************************/ @@ -451,6 +452,78 @@ unsigned long get_unique_id(void) } /******************************************************************************/ +ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan) +{ + ftdm_channel_t *ftdmchan = NULL; + sngss7_chan_data_t *sngss7_info = NULL; + sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->mod_data; + int i; + + ftdm_log(FTDM_LOG_DEBUG, "Found Rx GRS on span %d...checking circuits\n", ftdmspan->span_id); + + /* check all the circuits in the range to see if they are done resetting */ + for ( i = sngss7_span->rx_grs.circuit; i < (sngss7_span->rx_grs.circuit + sngss7_span->rx_grs.range + 1); i++) { + + /* extract the channel in question */ + if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", i); + SS7_ASSERT; + } + + /* lock the channel */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* check if there is a state change pending on the channel */ + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { + /* check the state to the GRP_RESET_RX_DN flag */ + if (!sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_RX_DN)) { + /* this channel is still resetting...do nothing */ + goto GRS_UNLOCK_ALL; + } /* if (!sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_RX_DN)) */ + } else { + /* state change pending */ + goto GRS_UNLOCK_ALL; + } + } /* for ( i = circuit; i < (circuit + range + 1); i++) */ + + SS7_DEBUG("All circuits out of reset for GRS: circuit=%d, range=%d\n", + sngss7_span->rx_grs.circuit, + sngss7_span->rx_grs.range); + + /* check all the circuits in the range to see if they are done resetting */ + for ( i = sngss7_span->rx_grs.circuit; i < (sngss7_span->rx_grs.circuit + sngss7_span->rx_grs.range + 1); i++) { + + /* extract the channel in question */ + if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n",i); + SS7_ASSERT; + } + + /* throw the GRP reset flag complete flag */ + sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_RX_CMPLT); + + /* move the channel to the down state */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + + } /* for ( i = circuit; i < (circuit + range + 1); i++) */ + +GRS_UNLOCK_ALL: + for ( i = sngss7_span->rx_grs.circuit; i < (sngss7_span->rx_grs.circuit + sngss7_span->rx_grs.range + 1); i++) { + /* extract the channel in question */ + if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", i); + SS7_ASSERT; + } + + /* unlock the channel */ + ftdm_mutex_unlock(ftdmchan->mutex); + } + + return FTDM_SUCCESS; +} + +/******************************************************************************/ + /******************************************************************************/ /* For Emacs: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c index aa639d1..4ebf3b9 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c @@ -551,6 +551,15 @@ static int ftmod_ss7_parse_mtp_link(ftdm_conf_node_t *mtp_link, sng_mtp_link_t * } else if (!strcasecmp(parm->val, "INDIA")) { mtpLink->mtp3.switchType = LSI_SW_INDIA; SS7_DEBUG("\tFoundmtpLink->switchType = \"INDIA\"\n"); + } else if (!strcasecmp(parm->val, "ansi88")) { + mtpLink->mtp3.switchType = LSI_SW_ANS88; + SS7_DEBUG("\tFoundmtpLink->switchType = \"ANSI88\"\n"); + } else if (!strcasecmp(parm->val, "ansi92")) { + mtpLink->mtp3.switchType = LSI_SW_ANS92; + SS7_DEBUG("\tFoundmtpLink->switchType = \"ANSI92\"\n"); + } else if (!strcasecmp(parm->val, "ansi95")) { + mtpLink->mtp3.switchType = LSI_SW_ANS95; + SS7_DEBUG("\tFoundmtpLink->switchType = \"ANSI95\"\n"); } else { SS7_ERROR("\tFound an invalid linktype of \"%s\"!\n", parm->val); return FTDM_FAIL; @@ -1159,6 +1168,11 @@ static int ftmod_ss7_fill_in_mtp3_route(sng_route_t *mtp3_route) } else { g_ftdm_sngss7_data.cfg.mtpRoute[i].t25 = 100; } + if (mtp3_route->t26 != 0) { + g_ftdm_sngss7_data.cfg.mtpRoute[i].t26 = mtp3_route->t26; + } else { + g_ftdm_sngss7_data.cfg.mtpRoute[i].t26 = 100; + } return 0; } commit b76e7f1812a59642d579866a8a060243fc396c50 Author: Moises Silva <moy@sangoma.com> Date: Tue Sep 7 16:04:38 2010 -0400 freetdm: fix codec for CAS signaling diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index d8b3c7d..be99f94 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -259,7 +259,10 @@ static unsigned wp_open_range(ftdm_span_t *span, unsigned spanno, unsigned start chan->physical_chan_id = x; chan->rate = 8000; - if (type == FTDM_CHAN_TYPE_FXS || type == FTDM_CHAN_TYPE_FXO || type == FTDM_CHAN_TYPE_B) { + if (type == FTDM_CHAN_TYPE_FXS + || type == FTDM_CHAN_TYPE_FXO + || type == FTDM_CHAN_TYPE_CAS + || type == FTDM_CHAN_TYPE_B) { int err; dtmf = "software"; commit 7fd0f84cce13dd94da7b88a66742eac95e1c60e7 Merge: 2f3187e d7141be Author: Moises Silva <moy@sangoma.com> Date: Tue Sep 7 13:39:18 2010 -0400 Merge remote branch 'smgfs/master' commit 2f3187e47060a45d8e3bf8581582344d9cccbf17 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Sep 7 11:45:56 2010 -0500 reswig diff --git a/src/mod/languages/mod_lua/mod_lua_wrap.cpp b/src/mod/languages/mod_lua/mod_lua_wrap.cpp index bdb5097..991b667 100644 --- a/src/mod/languages/mod_lua/mod_lua_wrap.cpp +++ b/src/mod/languages/mod_lua/mod_lua_wrap.cpp @@ -1490,29 +1490,31 @@ SWIG_Lua_dostring(lua_State *L, const char* str) { #define SWIGTYPE_p_Event swig_types[3] #define SWIGTYPE_p_EventConsumer swig_types[4] #define SWIGTYPE_p_IVRMenu swig_types[5] -#define SWIGTYPE_p_LUA__Session swig_types[6] -#define SWIGTYPE_p_Stream swig_types[7] -#define SWIGTYPE_p_input_callback_state swig_types[8] -#define SWIGTYPE_p_lua_State swig_types[9] -#define SWIGTYPE_p_p_switch_event_node_t swig_types[10] -#define SWIGTYPE_p_session_flag_t swig_types[11] -#define SWIGTYPE_p_switch_call_cause_t swig_types[12] -#define SWIGTYPE_p_switch_channel_state_t swig_types[13] -#define SWIGTYPE_p_switch_channel_t swig_types[14] -#define SWIGTYPE_p_switch_core_session_t swig_types[15] -#define SWIGTYPE_p_switch_event_t swig_types[16] -#define SWIGTYPE_p_switch_event_types_t swig_types[17] -#define SWIGTYPE_p_switch_input_args_t swig_types[18] -#define SWIGTYPE_p_switch_input_type_t swig_types[19] -#define SWIGTYPE_p_switch_priority_t swig_types[20] -#define SWIGTYPE_p_switch_queue_t swig_types[21] -#define SWIGTYPE_p_switch_state_handler_table_t swig_types[22] -#define SWIGTYPE_p_switch_status_t swig_types[23] -#define SWIGTYPE_p_switch_stream_handle_t swig_types[24] -#define SWIGTYPE_p_uint32_t swig_types[25] -#define SWIGTYPE_p_void swig_types[26] -static swig_type_info *swig_types[28]; -static swig_module_info swig_module = {swig_types, 27, 0, 0, 0, 0}; +#define SWIGTYPE_p_LUA__Dbh swig_types[6] +#define SWIGTYPE_p_LUA__Session swig_types[7] +#define SWIGTYPE_p_SWIGLUA_FN swig_types[8] +#define SWIGTYPE_p_Stream swig_types[9] +#define SWIGTYPE_p_input_callback_state swig_types[10] +#define SWIGTYPE_p_lua_State swig_types[11] +#define SWIGTYPE_p_p_switch_event_node_t swig_types[12] +#define SWIGTYPE_p_session_flag_t swig_types[13] +#define SWIGTYPE_p_switch_call_cause_t swig_types[14] +#define SWIGTYPE_p_switch_channel_state_t swig_types[15] +#define SWIGTYPE_p_switch_channel_t swig_types[16] +#define SWIGTYPE_p_switch_core_session_t swig_types[17] +#define SWIGTYPE_p_switch_event_t swig_types[18] +#define SWIGTYPE_p_switch_event_types_t swig_types[19] +#define SWIGTYPE_p_switch_input_args_t swig_types[20] +#define SWIGTYPE_p_switch_input_type_t swig_types[21] +#define SWIGTYPE_p_switch_priority_t swig_types[22] +#define SWIGTYPE_p_switch_queue_t swig_types[23] +#define SWIGTYPE_p_switch_state_handler_table_t swig_types[24] +#define SWIGTYPE_p_switch_status_t swig_types[25] +#define SWIGTYPE_p_switch_stream_handle_t swig_types[26] +#define SWIGTYPE_p_uint32_t swig_types[27] +#define SWIGTYPE_p_void swig_types[28] +static swig_type_info *swig_types[30]; +static swig_module_info swig_module = {swig_types, 29, 0, 0, 0, 0}; #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name) #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name) @@ -7005,6 +7007,230 @@ static swig_lua_class *swig_LUA_Session_bases[] = {0,0}; static const char *swig_LUA_Session_base_names[] = {"CoreSession *",0}; static swig_lua_class _wrap_class_LUA_Session = { "Session", &SWIGTYPE_p_LUA__Session,_wrap_new_Session, swig_delete_Session, swig_LUA_Session_methods, swig_LUA_Session_attributes, swig_LUA_Session_bases, swig_LUA_Session_base_names }; +static int _wrap_new_Dbh__SWIG_0(lua_State* L) { + int SWIG_arg = -1; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + LUA::Dbh *result = 0 ; + + SWIG_check_num_args("LUA::Dbh",3,3) + if(!lua_isstring(L,1)) SWIG_fail_arg("LUA::Dbh",1,"char *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("LUA::Dbh",2,"char *"); + if(!lua_isstring(L,3)) SWIG_fail_arg("LUA::Dbh",3,"char *"); + arg1 = (char *)lua_tostring(L, 1); + arg2 = (char *)lua_tostring(L, 2); + arg3 = (char *)lua_tostring(L, 3); + result = (LUA::Dbh *)new LUA::Dbh(arg1,arg2,arg3); + SWIG_arg=0; + SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Dbh,1); SWIG_arg++; + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_new_Dbh__SWIG_1(lua_State* L) { + int SWIG_arg = -1; + char *arg1 = (char *) 0 ; + char *arg2 = (char *) 0 ; + LUA::Dbh *result = 0 ; + + SWIG_check_num_args("LUA::Dbh",2,2) + if(!lua_isstring(L,1)) SWIG_fail_arg("LUA::Dbh",1,"char *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("LUA::Dbh",2,"char *"); + arg1 = (char *)lua_tostring(L, 1); + arg2 = (char *)lua_tostring(L, 2); + result = (LUA::Dbh *)new LUA::Dbh(arg1,arg2); + SWIG_arg=0; + SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Dbh,1); SWIG_arg++; + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_new_Dbh__SWIG_2(lua_State* L) { + int SWIG_arg = -1; + char *arg1 = (char *) 0 ; + LUA::Dbh *result = 0 ; + + SWIG_check_num_args("LUA::Dbh",1,1) + if(!lua_isstring(L,1)) SWIG_fail_arg("LUA::Dbh",1,"char *"); + arg1 = (char *)lua_tostring(L, 1); + result = (LUA::Dbh *)new LUA::Dbh(arg1); + SWIG_arg=0; + SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Dbh,1); SWIG_arg++; + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_new_Dbh(lua_State* L) { + int argc; + int argv[4]={ + 1,2,3,4 + }; + + argc = lua_gettop(L); + if (argc == 1) { + int _v; + { + _v = lua_isstring(L,argv[0]); + } + if (_v) { + return _wrap_new_Dbh__SWIG_2(L); + } + } + if (argc == 2) { + int _v; + { + _v = lua_isstring(L,argv[0]); + } + if (_v) { + { + _v = lua_isstring(L,argv[1]); + } + if (_v) { + return _wrap_new_Dbh__SWIG_1(L); + } + } + } + if (argc == 3) { + int _v; + { + _v = lua_isstring(L,argv[0]); + } + if (_v) { + { + _v = lua_isstring(L,argv[1]); + } + if (_v) { + { + _v = lua_isstring(L,argv[2]); + } + if (_v) { + return _wrap_new_Dbh__SWIG_0(L); + } + } + } + } + + lua_pushstring(L,"No matching function for overloaded 'new_Dbh'"); + lua_error(L);return 0; +} + + +static int _wrap_delete_Dbh(lua_State* L) { + int SWIG_arg = -1; + LUA::Dbh *arg1 = (LUA::Dbh *) 0 ; + + SWIG_check_num_args("LUA::~Dbh",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("LUA::~Dbh",1,"LUA::Dbh *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Dbh,SWIG_POINTER_DISOWN))){ + SWIG_fail_ptr("delete_Dbh",1,SWIGTYPE_p_LUA__Dbh); + } + + delete arg1; + + SWIG_arg=0; + + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_Dbh_release(lua_State* L) { + int SWIG_arg = -1; + LUA::Dbh *arg1 = (LUA::Dbh *) 0 ; + bool result; + + SWIG_check_num_args("release",1,1) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("release",1,"LUA::Dbh *"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Dbh,0))){ + SWIG_fail_ptr("Dbh_release",1,SWIGTYPE_p_LUA__Dbh); + } + + result = (bool)(arg1)->release(); + SWIG_arg=0; + lua_pushboolean(L,(int)(result==true)); SWIG_arg++; + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static int _wrap_Dbh_query(lua_State* L) { + int SWIG_arg = -1; + LUA::Dbh *arg1 = (LUA::Dbh *) 0 ; + char *arg2 = (char *) 0 ; + SWIGLUA_FN arg3 ; + bool result; + + SWIG_check_num_args("query",3,3) + if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("query",1,"LUA::Dbh *"); + if(!lua_isstring(L,2)) SWIG_fail_arg("query",2,"char *"); + if(!lua_isfunction(L,3)) SWIG_fail_arg("query",3,"SWIGLUA_FN"); + + if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_LUA__Dbh,0))){ + SWIG_fail_ptr("Dbh_query",1,SWIGTYPE_p_LUA__Dbh); + } + + arg2 = (char *)lua_tostring(L, 2); + (&arg3)->L=L; (&arg3)->idx=3; + result = (bool)(arg1)->query(arg2,arg3); + SWIG_arg=0; + lua_pushboolean(L,(int)(result==true)); SWIG_arg++; + return SWIG_arg; + + if(0) SWIG_fail; + +fail: + lua_error(L); + return SWIG_arg; +} + + +static void swig_delete_Dbh(void *obj) { +LUA::Dbh *arg1 = (LUA::Dbh *) obj; +delete arg1; +} +static swig_lua_method swig_LUA_Dbh_methods[] = { + {"release", _wrap_Dbh_release}, + {"query", _wrap_Dbh_query}, + {0,0} +}; +static swig_lua_attribute swig_LUA_Dbh_attributes[] = { + {0,0,0} +}; +static swig_lua_class *swig_LUA_Dbh_bases[] = {0}; +static const char *swig_LUA_Dbh_base_names[] = {0}; +static swig_lua_class _wrap_class_LUA_Dbh = { "Dbh", &SWIGTYPE_p_LUA__Dbh,_wrap_new_Dbh, swig_delete_Dbh, swig_LUA_Dbh_methods, swig_LUA_Dbh_attributes, swig_LUA_Dbh_bases, swig_LUA_Dbh_base_names }; + #ifdef __cplusplus } #endif @@ -7043,7 +7269,9 @@ static swig_type_info _swigt__p_DTMF = {"_p_DTMF", "DTMF *", 0, 0, (void*)&_wrap static swig_type_info _swigt__p_Event = {"_p_Event", "Event *", 0, 0, (void*)&_wrap_class_Event, 0}; static swig_type_info _swigt__p_EventConsumer = {"_p_EventConsumer", "EventConsumer *", 0, 0, (void*)&_wrap_class_EventConsumer, 0}; static swig_type_info _swigt__p_IVRMenu = {"_p_IVRMenu", "IVRMenu *", 0, 0, (void*)&_wrap_class_IVRMenu, 0}; +static swig_type_info _swigt__p_LUA__Dbh = {"_p_LUA__Dbh", "LUA::Dbh *", 0, 0, (void*)&_wrap_class_LUA_Dbh, 0}; static swig_type_info _swigt__p_LUA__Session = {"_p_LUA__Session", "LUA::Session *", 0, 0, (void*)&_wrap_class_LUA_Session, 0}; +static swig_type_info _swigt__p_SWIGLUA_FN = {"_p_SWIGLUA_FN", "SWIGLUA_FN *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_Stream = {"_p_Stream", "Stream *", 0, 0, (void*)&_wrap_class_Stream, 0}; static swig_type_info _swigt__p_input_callback_state = {"_p_input_callback_state", "input_callback_state_t *|input_callback_state *", 0, 0, (void*)&_wrap_class_input_callback_state_t, 0}; static swig_type_info _swigt__p_lua_State = {"_p_lua_State", "lua_State *", 0, 0, (void*)0, 0}; @@ -7072,7 +7300,9 @@ static swig_type_info *swig_type_initial[] = { &_swigt__p_Event, &_swigt__p_EventConsumer, &_swigt__p_IVRMenu, + &_swigt__p_LUA__Dbh, &_swigt__p_LUA__Session, + &_swigt__p_SWIGLUA_FN, &_swigt__p_Stream, &_swigt__p_input_callback_state, &_swigt__p_lua_State, @@ -7101,7 +7331,9 @@ static swig_cast_info _swigc__p_DTMF[] = { {&_swigt__p_DTMF, 0, 0, 0},{0, 0, 0, static swig_cast_info _swigc__p_Event[] = { {&_swigt__p_Event, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_EventConsumer[] = { {&_swigt__p_EventConsumer, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_IVRMenu[] = { {&_swigt__p_IVRMenu, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_LUA__Dbh[] = { {&_swigt__p_LUA__Dbh, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_LUA__Session[] = { {&_swigt__p_LUA__Session, 0, 0, 0},{0, 0, 0, 0}}; +static swig_cast_info _swigc__p_SWIGLUA_FN[] = { {&_swigt__p_SWIGLUA_FN, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_Stream[] = { {&_swigt__p_Stream, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_input_callback_state[] = { {&_swigt__p_input_callback_state, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_lua_State[] = { {&_swigt__p_lua_State, 0, 0, 0},{0, 0, 0, 0}}; @@ -7130,7 +7362,9 @@ static swig_cast_info *swig_cast_initial[] = { _swigc__p_Event, _swigc__p_EventConsumer, _swigc__p_IVRMenu, + _swigc__p_LUA__Dbh, _swigc__p_LUA__Session, + _swigc__p_SWIGLUA_FN, _swigc__p_Stream, _swigc__p_input_callback_state, _swigc__p_lua_State, commit 26f2e095efbc9b5aee04906dd5983858e8c29eb8 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Sep 7 11:21:25 2010 -0500 MODLANG-174 diff --git a/src/mod/languages/mod_lua/freeswitch.i b/src/mod/languages/mod_lua/freeswitch.i index 3631aca..3835801 100644 --- a/src/mod/languages/mod_lua/freeswitch.i +++ b/src/mod/languages/mod_lua/freeswitch.i @@ -18,6 +18,10 @@ %} +/* Lua function typemap */ +%typemap(in,checkfn="lua_isfunction") SWIGLUA_FN +%{ $1.L=L; $1.idx=$input; %} + %ignore SwitchToMempool; %newobject EventConsumer::pop; @@ -25,6 +29,7 @@ %newobject CoreSession; %newobject Event; %newobject Stream; +%newobject Dbh; /** * tell swig to grok everything defined in these header files and @@ -66,9 +71,18 @@ class Session : public CoreSession { void setLUA(lua_State *state); }; -} - - +class Dbh { + private: + switch_cache_db_handle_t *dbh; + bool connected; + static int query_callback(void *pArg, int argc, char **argv, char **cargv); + public: + Dbh(char *dsn, char *user = NULL, char *pass = NULL); + ~Dbh(); + bool release(); + bool query(char *sql, SWIGLUA_FN lua_fun); +}; +} diff --git a/src/mod/languages/mod_lua/freeswitch_lua.cpp b/src/mod/languages/mod_lua/freeswitch_lua.cpp index c73c88c..17d12bc 100644 --- a/src/mod/languages/mod_lua/freeswitch_lua.cpp +++ b/src/mod/languages/mod_lua/freeswitch_lua.cpp @@ -308,3 +308,69 @@ switch_status_t Session::run_dtmf_callback(void *input, switch_input_type_t ityp return SWITCH_STATUS_SUCCESS; } + +Dbh::Dbh(char *dsn, char *user, char *pass) +{ + switch_cache_db_connection_options_t options = { {0} }; + + options.odbc_options.dsn = dsn; + options.odbc_options.user = user; + options.odbc_options.pass = pass; + + if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_ODBC, &options) == SWITCH_STATUS_SUCCESS) { + connected = true; + } else { + connected = false; + } +} + +Dbh::~Dbh() +{ + release(); +} + +bool Dbh::release() +{ + if (connected) { + switch_cache_db_release_db_handle(&dbh); + connected = false; + return true; + } + return false; +} + +int Dbh::query_callback(void *pArg, int argc, char **argv, char **cargv) +{ + SWIGLUA_FN *lua_fun = (SWIGLUA_FN *)pArg; + + lua_pushvalue(lua_fun->L, lua_fun->idx); /* get the lua callback function onto the stack */ + + lua_newtable(lua_fun->L); /* push a row (table) */ + + for (int i = 0; i < argc; i++) { + lua_pushstring(lua_fun->L, switch_str_nil(cargv[i])); + lua_pushstring(lua_fun->L, switch_str_nil(argv[i])); + lua_settable(lua_fun->L, -3); + } + + lua_call(lua_fun->L, 1, 1); /* 1 in, 1 out */ + + if (lua_isnumber(lua_fun->L, -1)) { + if (lua_tonumber(lua_fun->L, -1) != 0) { + return 1; + } + } + + return 0; /* 0 to continue with next row */ +} + +bool Dbh::query(char *sql, SWIGLUA_FN lua_fun) +{ + if (connected) { + if (switch_cache_db_execute_sql_callback(dbh, sql, query_callback, &lua_fun, NULL) == SWITCH_STATUS_SUCCESS) { + return true; + } + } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "no workie workie :(\n"); + return false; +} diff --git a/src/mod/languages/mod_lua/freeswitch_lua.h b/src/mod/languages/mod_lua/freeswitch_lua.h index a1f4a85..a0780b1 100644 --- a/src/mod/languages/mod_lua/freeswitch_lua.h +++ b/src/mod/languages/mod_lua/freeswitch_lua.h @@ -8,6 +8,16 @@ extern "C" { #include "mod_lua_extra.h" } #include <switch_cpp.h> + + +typedef struct{ + lua_State* L; + int idx; +}SWIGLUA_FN; + +#define SWIGLUA_FN_GET(fn) {lua_pushvalue(fn.L,fn.idx);} + + namespace LUA { class Session:public CoreSession { private: @@ -41,5 +51,17 @@ namespace LUA { void setLUA(lua_State * state); }; + + class Dbh { + protected: + switch_cache_db_handle_t *dbh; + bool connected; + static int query_callback(void *pArg, int argc, char **argv, char **cargv); + public: + Dbh(char *dsn, char *user = NULL, char *pass = NULL); + ~Dbh(); + bool release(); + bool query(char *sql, SWIGLUA_FN lua_fun); + }; } #endif diff --git a/src/mod/languages/mod_lua/hack.diff b/src/mod/languages/mod_lua/hack.diff index afd37b0..fc33ddb 100644 --- a/src/mod/languages/mod_lua/hack.diff +++ b/src/mod/languages/mod_lua/hack.diff @@ -1,38 +1,38 @@ ---- mod_lua_wrap.cpp 2008-07-16 16:58:58.000000000 -0400 -+++ old.cpp 2008-07-16 16:58:42.000000000 -0400 -@@ -6731,7 +6731,7 @@ - SWIG_check_num_args("LUA::Session",0,0) +--- mod_lua_wrap.cpp.orig 2010-09-05 16:39:26.000000000 +0200 ++++ mod_lua_wrap.cpp 2010-09-05 16:39:44.000000000 +0200 +@@ -4913,7 +4913,7 @@ + result = (LUA::Session *)new LUA::Session(); SWIG_arg=0; - SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; + SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; result->setLUA(L); return SWIG_arg; - if(0) SWIG_fail; -@@ -6759,7 +6759,7 @@ - + fail: +@@ -4934,7 +4934,7 @@ + arg2=(CoreSession *)SWIG_MustGetPtr(L,2,SWIGTYPE_p_CoreSession,0,2,"new_Session"); result = (LUA::Session *)new LUA::Session(arg1,arg2); SWIG_arg=0; - SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; + SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; result->setLUA(L); return SWIG_arg; - if(0) SWIG_fail; -@@ -6780,7 +6780,7 @@ - arg1 = (char *)lua_tostring(L, 1); + fail: +@@ -4952,7 +4952,7 @@ + arg1 = (char*)lua_tostring(L, 1); result = (LUA::Session *)new LUA::Session(arg1); SWIG_arg=0; - SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; + SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; result->setLUA(L); return SWIG_arg; - if(0) SWIG_fail; -@@ -6805,7 +6805,7 @@ - + fail: +@@ -4970,7 +4970,7 @@ + arg1=(switch_core_session_t *)SWIG_MustGetPtr(L,1,SWIGTYPE_p_switch_core_session_t,0,1,"new_Session"); result = (LUA::Session *)new LUA::Session(arg1); SWIG_arg=0; - SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; + SWIG_NewPointerObj(L,result,SWIGTYPE_p_LUA__Session,1); SWIG_arg++; result->setLUA(L); return SWIG_arg; - if(0) SWIG_fail; + fail: diff --git a/src/mod/languages/mod_lua/my_swigable_cpp.h b/src/mod/languages/mod_lua/my_swigable_cpp.h index d4d3168..ebe5972 100644 --- a/src/mod/languages/mod_lua/my_swigable_cpp.h +++ b/src/mod/languages/mod_lua/my_swigable_cpp.h @@ -49,6 +49,19 @@ class Event { }; +class Dbh { + protected: + switch_cache_db_handle_t *dbh; + bool connected; + static int query_callback(void *pArg, int argc, char **argv, char **cargv); + public: + Dbh(char *dsn, char *user = NULL, char *pass = NULL); + ~Dbh(); + bool release(); + bool query(char *sql, SWIGLUA_FN lua_fun); +}; + + class CoreSession { protected: switch_input_args_t args; commit 68d1c32ad145c712c1d7939e5649a0f187f20170 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Sep 7 10:51:02 2010 -0500 FSCORE-668 diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index feb92b3..3a5e0bb 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -35,6 +35,8 @@ #include <switch.h> #include "private/switch_core_pvt.h" +#define SQLLEN 32768 + static struct { switch_cache_db_handle_t *event_db; switch_queue_t *sql_queue[2]; @@ -537,7 +539,7 @@ SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql(switch_cache_db_hand switch (dbh->type) { default: { - status = switch_cache_db_execute_sql_chunked(dbh, (char *) sql, 32768, err); + status = switch_cache_db_execute_sql_chunked(dbh, (char *) sql, SQLLEN, err); } break; } @@ -845,7 +847,7 @@ SWITCH_DECLARE(switch_bool_t) switch_cache_db_test_reactive(switch_cache_db_hand -#define SQLLEN 1024 * 1024 + static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, void *obj) { void *pop; @@ -853,13 +855,14 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, uint8_t trans = 0, nothing_in_queue = 0; uint32_t target = 100000; switch_size_t len = 0, sql_len = SQLLEN; - char *tmp, *sqlbuf = (char *) malloc(sql_len); - char *sql; + char *sqlbuf = (char *) malloc(sql_len); + char *sql = NULL; switch_size_t newlen; int lc = 0; uint32_t loops = 0, sec = 0; uint32_t l1 = 1000; uint32_t sanity = 120; + int item_remained = 0; switch_assert(sqlbuf); @@ -897,10 +900,17 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, continue; } - if (switch_queue_trypop(sql_manager.sql_queue[0], &pop) == SWITCH_STATUS_SUCCESS || + //printf("SIZE %d %d\n", switch_queue_size(sql_manager.sql_queue[0]), switch_queue_size(sql_manager.sql_queue[1])); + + if (item_remained || switch_queue_trypop(sql_manager.sql_queue[0], &pop) == SWITCH_STATUS_SUCCESS || switch_queue_trypop(sql_manager.sql_queue[1], &pop) == SWITCH_STATUS_SUCCESS) { - sql = (char *) pop; + if (item_remained) { + item_remained = 0; + } else { + sql = (char *) pop; + } + if (sql) { newlen = strlen(sql) + 2; @@ -911,20 +921,18 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, /* ignore abnormally large strings sql strings as potential buffer overflow */ if (newlen < SQLLEN) { itterations++; - if (len + newlen > sql_len) { - sql_len = len + SQLLEN; - if (!(tmp = realloc(sqlbuf, sql_len))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL thread ending on mem err\n"); - abort(); - break; - } - sqlbuf = tmp; + + if (len + newlen < sql_len) { + sprintf(sqlbuf + len, "%s;\n", sql); + len += newlen; + } else { + item_remained = 1; } - sprintf(sqlbuf + len, "%s;\n", sql); - len += newlen; - } - free(sql); + + if (!item_remained) { + free(sql); + } } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "SQL thread ending\n"); break; @@ -934,7 +942,8 @@ static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, } - if (trans && ((itterations == target) || (nothing_in_queue && ++lc >= 500))) { + if ((item_remained || (trans && ((itterations == target) || (nothing_in_queue && ++lc >= 500)))) && + (sql_manager.event_db->native_handle.core_db_dbh)) { if (switch_cache_db_persistant_execute_trans(sql_manager.event_db, sqlbuf, 1) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL thread unable to commit transaction, records lost!\n"); } commit e3eff8165e64804ea0e2819bdd0fce58bfb3a9a5 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Sep 7 09:44:08 2010 -0500 MODENDP-326 diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index faa116f..7558e1b 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -1247,7 +1247,8 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session) tech_pvt->rtp_session = NULL; } - if (globals.auto_nat && tech_pvt->profile->local_network && !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) { + if (globals.auto_nat && tech_pvt->profile->local_network && tech_pvt->remote_ip && tech_pvt->profile->local_network && + !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) { switch_nat_del_mapping((switch_port_t) tech_pvt->local_port, SWITCH_NAT_UDP); } commit be00609aab7a51a15794c2712dee78263105f5dc Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Sep 7 09:40:39 2010 -0500 FSCORE-667 diff --git a/libs/libdingaling/src/libdingaling.c b/libs/libdingaling/src/libdingaling.c index 1af67f6..11a9a8a 100644 --- a/libs/libdingaling/src/libdingaling.c +++ b/libs/libdingaling/src/libdingaling.c @@ -1974,10 +1974,19 @@ unsigned int ldl_session_terminate(ldl_session_t *session) { iks *iq, *sess; unsigned int id; + apr_hash_t *hash = session->handle->sessions; new_session_iq(session, &iq, &sess, &id, "terminate"); schedule_packet(session->handle, id, iq, LDL_RETRY); + if (session->id) { + apr_hash_set(hash, session->id, APR_HASH_KEY_STRING, NULL); + } + + if (session->them) { + apr_hash_set(hash, session->them, APR_HASH_KEY_STRING, NULL); + } + return id; } commit 35fd2bc9e744c39aee91e8d7bd39ac6fcb262f4f Author: Michael S Collins <msc@freeswitch.org> Date: Sat Sep 4 12:09:10 2010 -0700 Update ChangeLog through Sept 4 in preparation for 1.0.7 tagging diff --git a/docs/ChangeLog b/docs/ChangeLog index 0bc629e..a2ed493 100644 --- a/docs/ChangeLog +++ b/docs/ChangeLog @@ -15,6 +15,7 @@ freeswitch (1.0.7) build: Fix build with --with-curl (r:e704f021/FSBUILD-285) build: VS 2010 - Change to V4 framework, add SWIG v2.0 files to fix release build exceptions(temp fix till we upgrade all SWIG files) (r:812f4309) build: Windows VS2010 build - remove strange characters (r:ba1546e0/FSBUILD-297) + build: Make bootstrap.sh Bourne shell compatible (r:8dbd62ff/FSBUILD-301) config: move limit.conf to db.conf config: Update VM phrase macros to voice option then action on main, config menus config: Remove 99xx extension numbers to avoid dp conflicts (r:0c9bb174/DP-17) @@ -30,7 +31,7 @@ freeswitch (1.0.7) core: always export 'export_vars' core: add sanity check to launch threads that catch hangup and are not in a thread to make sure they clean up core: Tweak bridge_early_media to support passthrough codecs - core: cleanup C reserved identifer violation (JANITOR-3) + core: cleanup C reserved identifier violation (JANITOR-3) core: add sound_prefix support in uuid_displace (FSCORE-550) core: add 'critical' param on modules.conf to abort on mod load failure from Moc core: add 'direction' chan var @@ -71,6 +72,12 @@ freeswitch (1.0.7) core: Improve RTP timing on playback of files (r:d6d7773c/FSCORE-639) core: Allows bind_meta_app to use chars other than * (r:fd254766/FSCORE-630) core: Fixed core lib won't build for win32 (r:9327c994/FSCORE-646) + core: add last_bridge_to var to keep uuid of last bridged channel and fix race in show calls on hangup of bypass_media channels (r:77e2dccf) + core: Phrase "speak-text" application returns on first key press in phrase file on Windows (r:6d74d7ab/MODAPP-448) + core: pass originate flags into session_request so we can selectivly skip throttling (r:46c6650a) + core: Implemented 'Block Fork' and removed possibility for "-nc -nf" potential issue. (r:f26a6972/FSCORE-652) + core: Add console callback for listing loaded/available modules for load/unload/reload commands (r:d68a1218/FSCORE-662) + core: strip trailing and leading whitespace in api execute args and commands (r:ca481842) lang: Improve French phrase files (FSCONFIG-23) libdingaling: fix race on shutdown causing crash (FSMOD-47) libesl: Fix potential race condition (ESL-36) @@ -88,8 +95,10 @@ freeswitch (1.0.7) libfreetdm: implemented freetdm config nodes and ss7 initial configuration libopenzap: Add CLI tracing libs: Merged OpenZAP and FreeTDM into the FreeSWITCH tree. + libs: Add support for TLS on Windows using openssl (r:1abe3b93/MODSOFIA-92) libsofiasip: Fix random crashes (r:c15ee980/SFSIP-219) libsofiasip: Fix T.38 bug in sofia_glue (r:2843f1ad/MODSOFIA-94) + libsofiasip: VS2010 sofia posix problem (r:46dd24c2/SFSIP-220) libspandsp: Fixed a typo in spandsp's msvc/inttypes.h Updated sig_tone processing in spandsp to the latest, to allow moy to proceed with his signaling work. libspandsp: removed a saturate16 from spandsp that was causing problems fixed a typo in the MSVC inttypes.h file for spandsp libspandsp: Changes to the signaling tone detector to detect concurrent 2400Hz + 2600Hz tones. This passes voice immunity and other key tests, but it bounces a bit when transitions like 2400 -> 2400+2600 -> 2600 occur. Transitions between tone off and tone on are clean. (r:bc13e944) @@ -101,6 +110,13 @@ freeswitch (1.0.7) mod_callcenter: Try to fix the ring-all, also add cli auto complete done in previous commit (r:1666783c) mod_callcenter: Add missing odbc db support (Not tested, please someone test this) (r:42436e27) mod_callcenter: More ODBC changes. It is not a global settings value. Cannot be changed in runtime. (r:6980305f) + mod_callcenter: Added value busy_delay_time and reject_delay_time so we can wait if those 2 occur (Un registred phone are considered as busy). Add a ready_time epoch time when we can contact an again again, fix ring-all (good this time I hope). (r:8082aa98) + mod_callcenter: Add tiers rules before jumping to a different level. Also added support for dial-in agent. (r:86c9bed7) + mod_callcenter: Default the level to 0 since the new tier system will wait x second at level 1... just level 0 that will ring agent right away (if set to do so) (r:6558276a) + mod_callcenter: You can now allow caller that have hangup before agent answer to call back and resume their previous position. (r:ab2529d4) + mod_callcenter: correct multiple little things following the recent tiers and join back features (r:9b33bd1c) + mod_callcenter: Add more channel variable and event and fix a mem leak (r:2d3d8c8d) + od_callcenter: Make more sence to bridge the caller to the agent. Before, in the xml_cdr you saw it it like the agent initiated the call to the member (r:0be95658) mod_cidlookup: null xml is bad (r:095815f8) mod_cid_lookup: honor skipcitystate when using whitepages (r:a66654de/FSMOD-53) mod_commands: make break uuid_break and add cascade flag @@ -118,7 +134,11 @@ freeswitch (1.0.7) mod_conference: add conference_member_id variable to all sessions with the member id used by their conference participation (For drk__) (r:49c9bfdb) mod_conference: fix relate nohear (r:f029ce07/MODAPP-428) mod_conference: Fix floor change events not always firing (r:8f1767d3/MODAPP-424) + mod_curl: use method=post when post requested (r:c6a4ddd0/FSMOD-69) mod_dialplan_xml: Add in the INFO log the caller id number when processing a request (Currenly only show the caller name) (r:e1df5e13) + mod_dingaling: make mod_dingaling compat with google's new free phonecalls thing (r:ba0a2a32) + mod_dingaling: make dingaling work with google voice inbound too (r:4ee68141) + mod_dingaling: Fix crash when testing the new gv-dingaling with around 24 concurrent calls (r:73e1ec5e/FSCORE-667) mod_db: fix stack corruption (MODAPP-407) mod_dptools: add eavesdrop_enable_dtmf chan var (r:596c0012) mod_dptools: Make park app not send 183 session progress (r:76932995/FSCORE-567) @@ -126,7 +146,9 @@ freeswitch (1.0.7) mod_erlang_event: Make XML fetch reply ACKs distinguishable, update freeswitch.erl (r:9d44ed04) mod_erlang_event: Add 3 new commands; session_event, session_noevents, session_nixevent (r:698fa045) mod_erlang_event: generate long node names the same as erlang does (r:9ad509c2) + mod_erlang_event: Improve some logging to include UUIDs (r:c0d51b83) mod_event_socket: fix up other users of switch_event_xmlize() to use SWITCH_EVENT_NONE (r:d6eb7562) + mod_event_socket: Fix small mem leaks (r:e4f90584/MODEVENT-68) mod_fifo: allow multiple dtmf to exit fifo, set fifo_caller_exit_key to specify which (MODAPP-420) mod_fifo: cancel outbound call if customer hangs up (r:cadb4d94) mod_fifo: add taking_calls param to fifo member add and config file (r:821488bf) @@ -159,6 +181,8 @@ freeswitch (1.0.7) mod_freetdm: fix fxs dialtone - should be stopped on first digit (r:f822180f) mod_freetdm: add bearer capability and layer1 pass-thru for boost (r:07b81760) mod_freetdm: OPENZAP-107 - Patched by Jeff Lenk (r:aa075136/OPENZAP-107) + mod_freetdm: allocate channels in their own memory page when debugging (r:fcd8df0a) + mod_freetdm: lock the channel when placing call (r:705dd237) mod_gsmopen: copy from branch mod_hash: free all hashtables on shutdown (r:e76d7d92) mod_hash: remove unneeded initializer (r:10d468a6) @@ -179,6 +203,7 @@ freeswitch (1.0.7) mod_h323: add missing conf prameter (r:0b353d7a) mod_h323: Add mod_h323 to windows (r:015bcaf6/MODENDP-301) mod_h323: move PTrace level set to FSH323EndPoint::Initialise. partially apply patch from from Peter Olsson, Remove UnLock() when TryLock() failed and DEBUG_RTP_PACKETS directiv e. (r:7b5803f7) + mod_h323: set network_addr of caller profile to signaling ip address. (requested by Steven Ayre) (r:072bf5ad) mod_java: fix eventConsumer issue and add flush() method (r:7fd3aff6) mod_java: Allow user defined java methods to be called at startup and shutdown of JVM (r:1339e218/MODLANG-117) mod_json_cdr: Fix segfault in mod_json_cdr.c (r:f347698a/MODEVENT-66) @@ -210,7 +235,9 @@ freeswitch (1.0.7) mod_sangoma_codec: rename load/noload to register/noregister mod_sangoma_codec: silence suppression (r:73d9d56f) mod_say_es: fix grammar when saying dates and time (r:6bed19b2/MODAPP-429) + mod_say_ru: Fix saying time with +1 hour of current time (r:68d74c31/MODAPP-444) mod_say_zh: Number reading should now be OK for the whole range of integers for Cantonese and Mandarin + mod_silk: Fix mod_silk compliance and performance issues (r:2ddbc457/MODCODEC-20) mod_skinny: Add the missing api files mod_skinny: add example dialplan and directory config (r:1bfcc17e) mod_skinny: rewrite of the skinny state machine (r:8cc89ab0) @@ -225,8 +252,16 @@ freeswitch (1.0.7) mod_skinny: ib_calls stats (r:165140e0) mod_skinny: blind transfer MODSKINNY-10 (r:53f75e9c/MODSKINNY-10) mod_skinny: ring tone on dialing side (r:0a04ecb8) + mod_skinny: stop media on early media hangup (ring-out) (r:ce352bcc) + mod_skinny: add windows x64 build support for mod_skinny (r:3e205683) + mod_skinny: avoid "-ERR no reply" when using API commands from CLI (r:690ae1b3) + mod_skinny: allow configuration of softkeys via xml (r:f5a6831f) + mod_skinny: allow skinny-default-soft-key-set-set per device (r:07c3c94d) + mod_skinny: Rename skinny-default-soft-key-set-set to skinny-soft-key-set-set (r:ba3a6ad6) mod_skypopen: making XEvents to works when EARLYMEDIA, and correctly manage threads death mod_skypopen: now answer a call only when directed to do it (before was trying to answer any incoming call). Lot of changes to a messy part, so maybe some problem will come out... (r:45c6c4d3) + mod_skypopen: ignore early media sent by channels to be bridged before our channel is answered (r:ef14b78a) + mod_sndfile: Add support for .alaw and .ulaw to mod_sndfile (r:facf09b8/MODFORM-41) mod_sofia: Send SIP MESSAGE to unregistered users by prefixing sip: to user@domain mod_sofia: fix callee being updated with callee information mod_sofia: set appearance-index in update statement for SLA @@ -258,6 +293,16 @@ freeswitch (1.0.7) mod_sofia: Fix segfault (r:72be253d/MODSOFIA-83) mod_sofia: Add openssl build support to windows - no external build support needed (step 1 - not hooked up yet) vs2008 pro+ only (r:b0de3585/MODSOFIA-92) mod_sofia: REFER: to-tag and from-tag should be set other way around when other (bridged) channel is incoming. (r:92d324d3/MODSOFIA-91) + mod_sofia: fix 302 to hangup in the two cases where switch_ivr_transfer is used and not in the case when it should carry on and follow the redirect (r:00b51403) + mod_sofia: Remove OPENSSL_USE_APPLINK - not needed (r:437c7805/MODSOFIA-92) + mod_sofia: Send Instant Messages To All Endpoints Registered to Targeted Extension (r:96b790fa/BOUNTY-20) + mod_sofia: increase sps during recovery (r:f1aead31) + mod_sofia: Forward unsolicited MWI nofity (r:5481d9a9/MODSOFIA-86) + mod_sofia: Add a quick fix for basic Polycom presence support. A more sane solution need to be implemented (r:a55b9d07) + mod_sofia: Unify gateway printing between 'sofia xmlstatus gateway' and 'sofia xmlstatus gateway <gatewayname>' (r:37c22467) + mod_sofia: Fix memleak and mwi event not generated on first register (r:04b9b3e2) + mod_sofia: when getting presence with no payload consider it an extension to the expires time in the dialog (r:70331e88) + mod_sofia: don't put blank 'version' attr in dialog-info packets (r:749dc864) mod_spandsp: initial checkin of mod_fax/mod_voipcodecs merge into mod_spandsp (r:fa9a59a8) mod_spandsp: rework of new mod_spandsp to have functions broken up into different c files (r:65400642) mod_spandsp: improve duplicate digit detection and add 'min_dup_digit_spacing_ms' channel variable for use with the dtmf detector (r:eab4f246/FSMOD-45) @@ -276,6 +321,7 @@ freeswitch (1.0.7) mod_voicemail: add 'vm-enabled' param (default true) mod_voicemail: fix vm msg being deleted when pressing key to forward to email (MODAPP-403) mod_voicemail: make voicemails use the uuid of the channel who recorded it when applicable (r:98a5a30a) + mod_voicemail: user unable to play or delete voicemail via web API (r:b5205c0b/MODAPP-447) mod_xml_cdr: add force_process_cdr var to process b leg cdr on a case by case basis when b leg cdr is disabled (XML-17) mod_xml_cdr: add leg param to query string (XML-24) mod_xml_cdr: fix locked sessions (XML-26) commit ba3a6ad6c8b268b064a11ec0f51f5b2c5e32a303 Author: Mathieu Parent <math.parent@gmail.com> Date: Sat Sep 4 10:14:22 2010 +0200 Skinny: Rename skinny-default-soft-key-set-set to skinny-soft-key-set-set diff --git a/conf/directory/default/skinny-example.xml b/conf/directory/default/skinny-example.xml index 8a61ae5..357eb72 100644 --- a/conf/directory/default/skinny-example.xml +++ b/conf/directory/default/skinny-example.xml @@ -3,7 +3,7 @@ <params> <!-- for devices requesting firmware via SCCP, like ATA186 <param name="skinny-firmware-version" value="ATA030101SCCP04" - <param name="skinny-default-soft-key-set-set" value="default" + <param name="skinny-soft-key-set-set" value="default" --> <param name="foo" value="bar"/> </params> diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.h b/src/mod/endpoints/mod_skinny/mod_skinny.h index 3dec3e9..bbd318b 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.h +++ b/src/mod/endpoints/mod_skinny/mod_skinny.h @@ -135,7 +135,7 @@ struct listener { uint32_t device_type; char firmware_version[16]; - char *default_soft_key_set_set; + char *soft_key_set_set; switch_socket_t *sock; switch_memory_pool_t *pool; diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index 7325a6c..3fa4aab 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -999,8 +999,8 @@ switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *r const char *value = switch_xml_attr_soft(xparam, "value"); if (!strcasecmp(name, "skinny-firmware-version")) { strncpy(listener->firmware_version, value, 16); - } else if (!strcasecmp(name, "skinny-default-soft-key-set-set")) { - listener->default_soft_key_set_set = switch_core_strdup(profile->pool, value); + } else if (!strcasecmp(name, "skinny-soft-key-set-set")) { + listener->soft_key_set_set = switch_core_strdup(profile->pool, value); } } } @@ -1697,8 +1697,8 @@ switch_status_t skinny_handle_soft_key_set_request(listener_t *listener, skinny_ { skinny_message_t *message = NULL; - if (listener->default_soft_key_set_set) { - message = switch_core_hash_find(listener->profile->soft_key_set_sets_hash, listener->default_soft_key_set_set); + if (listener->soft_key_set_set) { + message = switch_core_hash_find(listener->profile->soft_key_set_sets_hash, listener->soft_key_set_set); } if (!message) { message = switch_core_hash_find(listener->profile->soft_key_set_sets_hash, "default"); commit 07c3c94d7a9de90c42ce48a97cbcf61682633358 Author: Mathieu Parent <math.parent@gmail.com> Date: Sat Sep 4 10:06:07 2010 +0200 Skinny: allow skinny-default-soft-key-set-set per device diff --git a/conf/directory/default/skinny-example.xml b/conf/directory/default/skinny-example.xml index 2f19710..8a61ae5 100644 --- a/conf/directory/default/skinny-example.xml +++ b/conf/directory/default/skinny-example.xml @@ -3,6 +3,7 @@ <params> <!-- for devices requesting firmware via SCCP, like ATA186 <param name="skinny-firmware-version" value="ATA030101SCCP04" + <param name="skinny-default-soft-key-set-set" value="default" --> <param name="foo" value="bar"/> </params> diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.h b/src/mod/endpoints/mod_skinny/mod_skinny.h index 99b52b6..3dec3e9 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.h +++ b/src/mod/endpoints/mod_skinny/mod_skinny.h @@ -135,6 +135,7 @@ struct listener { uint32_t device_type; char firmware_version[16]; + char *default_soft_key_set_set; switch_socket_t *sock; switch_memory_pool_t *pool; diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index de4fdbd..7325a6c 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -999,6 +999,8 @@ switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *r const char *value = switch_xml_attr_soft(xparam, "value"); if (!strcasecmp(name, "skinny-firmware-version")) { strncpy(listener->firmware_version, value, 16); + } else if (!strcasecmp(name, "skinny-default-soft-key-set-set")) { + listener->default_soft_key_set_set = switch_core_strdup(profile->pool, value); } } } @@ -1693,14 +1695,19 @@ end: switch_status_t skinny_handle_soft_key_set_request(listener_t *listener, skinny_message_t *request) { - skinny_message_t *message; + skinny_message_t *message = NULL; - message = switch_core_hash_find(listener->profile->soft_key_set_sets_hash, "default"); + if (listener->default_soft_key_set_set) { + message = switch_core_hash_find(listener->profile->soft_key_set_sets_hash, listener->default_soft_key_set_set); + } + if (!message) { + message = switch_core_hash_find(listener->profile->soft_key_set_sets_hash, "default"); + } if (message) { skinny_send_reply(listener, message); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Profile %s doesn't have a default <soft-key-set-set>. Profile ignored.\n", listener->profile->name); + "Profile %s doesn't have a default <soft-key-set-set>.\n", listener->profile->name); } /* Init the states */ commit f5a6831ffcd01ce948edea25197b8d920fec1f07 Author: Mathieu Parent <math.parent@gmail.com> Date: Sat Sep 4 09:29:01 2010 +0200 Skinny: allow configuration of softkeys via xml - enhance conf/skinny_profiles/internal.xml - Sanity checks + softKeySet id < 16 + less than 16 buttons per softKeySet + at least the default soft-key-set to load the profile + at least one profile to load mod_skinny - Lower some ERRORs to WARNINGs as they don't prevent module loading - Default skinny_str2soft_key_event to 0 diff --git a/conf/skinny_profiles/internal.xml b/conf/skinny_profiles/internal.xml index e48557b..5feac1f 100644 --- a/conf/skinny_profiles/internal.xml +++ b/conf/skinny_profiles/internal.xml @@ -13,6 +13,17 @@ <param name="debug" value="4"/> <param name="auto-restart" value="true"/> </settings> + <soft-key-set-sets> + <soft-key-set-set name="default"> + <soft-key-set name="KeySetOnHook" value="SoftkeyNewcall,SoftkeyRedial"/> + <soft-key-set name="KeySetOffHook" value=",SoftkeyNewcall,SoftkeyEndcall"/> + <soft-key-set name="KeySetDigitsAfterDialingFirstDigit" value="SoftkeyBackspace,,SoftkeyEndcall"/> + <soft-key-set name="KeySetConnected" value="SoftkeyEndcall,SoftkeyHold,SoftkeyNewcall,SoftkeyTransfer"/> + <soft-key-set name="KeySetRingIn" value="SoftkeyAnswer,SoftkeyEndcall,SoftkeyNewcall"/> + <soft-key-set name="KeySetOnHold" value="SoftkeyNewcall,SoftkeyResume,SoftkeyEndcall"/> + <soft-key-set name="KeySetOffHookWithFeatures" value=",SoftkeyRedial,SoftkeyEndcall"/> + </soft-key-set-set> + </soft-key-set-sets> <device-types> <device-type id="Cisco ATA 186"> <param name="firmware-version" value="ATA030101SCCP04"/> diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index 0f7b370..1658150 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -1714,8 +1714,7 @@ static switch_status_t load_skinny_config(void) if ((xprofiles = switch_xml_child(xcfg, "profiles"))) { for (xprofile = switch_xml_child(xprofiles, "profile"); xprofile; xprofile = xprofile->next) { char *profile_name = (char *) switch_xml_attr_soft(xprofile, "name"); - switch_xml_t xsettings; - switch_xml_t xdevice_types; + switch_xml_t xsettings, xdevice_types, xsoft_key_set_sets; if (zstr(profile_name)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "<profile> is missing name attribute\n"); @@ -1771,6 +1770,96 @@ static switch_status_t load_skinny_config(void) profile->port = 2000; } + /* Soft Key Set Sets */ + switch_core_hash_init(&profile->soft_key_set_sets_hash, profile->pool); + if ((xsoft_key_set_sets = switch_xml_child(xprofile, "soft-key-set-sets"))) { + switch_xml_t xsoft_key_set_set; + for (xsoft_key_set_set = switch_xml_child(xsoft_key_set_sets, "soft-key-set-set"); xsoft_key_set_set; xsoft_key_set_set = xsoft_key_set_set->next) { + char *soft_key_set_set_name = (char *) switch_xml_attr_soft(xsoft_key_set_set, "name"); + if (soft_key_set_set_name) { + switch_xml_t xsoft_key_set; + skinny_message_t *message; + message = switch_core_alloc(profile->pool, 12+sizeof(message->data.soft_key_set)); + message->type = SOFT_KEY_SET_RES_MESSAGE; + message->length = 4 + sizeof(message->data.soft_key_set); + message->data.soft_key_set.soft_key_set_offset = 0; + message->data.soft_key_set.soft_key_set_count = 11; + message->data.soft_key_set.total_soft_key_set_count = 11; + for (xsoft_key_set = switch_xml_child(xsoft_key_set_set, "soft-key-set"); xsoft_key_set; xsoft_key_set = xsoft_key_set->next) { + uint32_t soft_key_set_id; + if ((soft_key_set_id = skinny_str2soft_key_set(switch_xml_attr_soft(xsoft_key_set, "name"))) != -1) { + char *val =switch_core_strdup(profile->pool, switch_xml_attr_soft(xsoft_key_set, "value")); + size_t string_len = strlen(val); + size_t string_pos, start = 0; + int field_no = 0; + if (soft_key_set_id > 15) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, + "soft-key-set name '%s' is greater than 15 in soft-key-set-set '%s' in profile %s.\n", + switch_xml_attr_soft(xsoft_key_set, "name"), soft_key_set_set_name, profile->name); + continue; + } + for (string_pos = 0; string_pos <= string_len; string_pos++) { + if ((val[string_pos] == ',') || (string_pos == string_len)) { + val[string_pos] = '\0'; + if (field_no > 15) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, + "soft-key-set name '%s' is limited to 16 buttons in soft-key-set-set '%s' in profile %s.\n", + switch_xml_attr_soft(xsoft_key_set, "name"), soft_key_set_set_name, profile->name); + break; + } + message->data.soft_key_set.soft_key_set[soft_key_set_id].soft_key_template_index[field_no++] = skinny_str2soft_key_event(&val[start]); + start = string_pos+1; + } + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, + "Unknown soft-key-set name '%s' in soft-key-set-set '%s' in profile %s.\n", + switch_xml_attr_soft(xsoft_key_set, "name"), soft_key_set_set_name, profile->name); + } + } /* soft-key-set */ + switch_core_hash_insert(profile->soft_key_set_sets_hash, soft_key_set_set_name, message); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, + "<soft-key-set-set> is missing a name attribute in profile %s.\n", profile->name); + } + } /* soft-key-set-set */ + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, + "<soft-key-set-sets> is missing in profile %s.\n", profile->name); + } /* soft-key-set-sets */ + if (!switch_core_hash_find(profile->soft_key_set_sets_hash, "default")) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "Profile %s doesn't have a default <soft-key-set-set>. Profile ignored.\n", profile->name); + switch_core_destroy_memory_pool(&profile_pool); + continue; + } + + + /* Device types */ + switch_core_hash_init(&profile->device_type_params_hash, profile->pool); + if ((xdevice_types = switch_xml_child(xprofile, "device-types"))) { + switch_xml_t xdevice_type; + for (xdevice_type = switch_xml_child(xdevice_types, "device-type"); xdevice_type; xdevice_type = xdevice_type->next) { + uint32_t id = skinny_str2device_type(switch_xml_attr_soft(xdevice_type, "id")); + if (id != 0) { + char *id_str = switch_mprintf("%d", id); + skinny_device_type_params_t *params = switch_core_alloc(profile->pool, sizeof(skinny_device_type_params_t)); + for (param = switch_xml_child(xdevice_type, "param"); param; param = param->next) { + char *var = (char *) switch_xml_attr_soft(param, "name"); + char *val = (char *) switch_xml_attr_soft(param, "value"); + + if (!strcasecmp(var, "firmware-version")) { + strncpy(params->firmware_version, val, 16); + } + } /* param */ + switch_core_hash_insert(profile->device_type_params_hash, id_str, params); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, + "Unknow device type %s in profile %s.\n", switch_xml_attr_soft(xdevice_type, "id"), profile->name); + } + } + } + /* Database */ switch_snprintf(dbname, sizeof(dbname), "skinny_%s", profile->name); profile->dbname = switch_core_strdup(profile->pool, dbname); @@ -1809,30 +1898,6 @@ static switch_status_t load_skinny_config(void) skinny_execute_sql_callback(profile, profile->sql_mutex, "DELETE FROM skinny_buttons", NULL, NULL); skinny_execute_sql_callback(profile, profile->sql_mutex, "DELETE FROM skinny_active_lines", NULL, NULL); - /* Device types */ - switch_core_hash_init(&profile->device_type_params_hash, profile->pool); - if ((xdevice_types = switch_xml_child(xprofile, "device-types"))) { - switch_xml_t xdevice_type; - for (xdevice_type = switch_xml_child(xdevice_types, "device-type"); xdevice_type; xdevice_type = xdevice_type->next) { - uint32_t id = skinny_str2device_type(switch_xml_attr_soft(xdevice_type, "id")); - if (id != 0) { - char *id_str = switch_mprintf("%d", id); - skinny_device_type_params_t *params = switch_core_alloc(profile->pool, sizeof(skinny_device_type_params_t)); - for (param = switch_xml_child(xdevice_type, "param"); param; param = param->next) { - char *var = (char *) switch_xml_attr_soft(param, "name"); - char *val = (char *) switch_xml_attr_soft(param, "value"); - - if (!strcasecmp(var, "firmware-version")) { - strncpy(params->firmware_version, val, 16); - } - } /* param */ - switch_core_hash_insert(profile->device_type_params_hash, id_str, params); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, - "Unknow device type %s in profile %s.\n", switch_xml_attr_soft(xdevice_type, "id"), profile->name); - } - } - } skinny_profile_respawn(profile, 0); /* Register profile */ @@ -2058,9 +2123,14 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skinny_load) load_skinny_config(); + /* at least one profile */ + if (!switch_hash_first(NULL, globals.profile_hash)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No profile found!\n"); + return SWITCH_STATUS_TERM; + } /* bind to events */ if ((switch_event_bind_removable(modname, SWITCH_EVENT_HEARTBEAT, NULL, skinny_heartbeat_event_handler, NULL, &globals.heartbeat_node) != SWITCH_STATUS_SUCCESS)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind our heartbeat handler!\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Couldn't bind our heartbeat handler!\n"); /* Not such severe to prevent loading */ } if ((switch_event_bind_removable(modname, SWITCH_EVENT_CUSTOM, SKINNY_EVENT_CALL_STATE, skinny_call_state_event_handler, NULL, &globals.call_state_node) != SWITCH_STATUS_SUCCESS)) { @@ -2068,11 +2138,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skinny_load) return SWITCH_STATUS_TERM; } if ((switch_event_bind_removable(modname, SWITCH_EVENT_MESSAGE_WAITING, NULL, skinny_message_waiting_event_handler, NULL, &globals.message_waiting_node) != SWITCH_STATUS_SUCCESS)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind our message waiting handler!\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Couldn't bind our message waiting handler!\n"); /* Not such severe to prevent loading */ } if ((switch_event_bind_removable(modname, SWITCH_EVENT_TRAP, NULL, skinny_trap_event_handler, NULL, &globals.trap_node) != SWITCH_STATUS_SUCCESS)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind our trap handler!\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Couldn't bind our trap handler!\n"); /* Not such severe to prevent loading */ } diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.h b/src/mod/endpoints/mod_skinny/mod_skinny.h index accb7e6..99b52b6 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.h +++ b/src/mod/endpoints/mod_skinny/mod_skinny.h @@ -79,6 +79,7 @@ struct skinny_profile { char date_format[6]; int debug; int auto_restart; + switch_hash_t *soft_key_set_sets_hash; switch_hash_t *device_type_params_hash; /* db */ char *dbname; diff --git a/src/mod/endpoints/mod_skinny/skinny_protocol.h b/src/mod/endpoints/mod_skinny/skinny_protocol.h index fe001c7..236c667 100644 --- a/src/mod/endpoints/mod_skinny/skinny_protocol.h +++ b/src/mod/endpoints/mod_skinny/skinny_protocol.h @@ -151,7 +151,7 @@ struct PACKED open_receive_channel_ack_message { /* SoftKeyEventMessage */ #define SOFT_KEY_EVENT_MESSAGE 0x0026 struct PACKED soft_key_event_message { - uint32_t event; + uint32_t event; /* See enum skinny_soft_key_event */ uint32_t line_instance; uint32_t call_id; }; diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index 2f640a8..de4fdbd 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -1694,48 +1694,14 @@ end: switch_status_t skinny_handle_soft_key_set_request(listener_t *listener, skinny_message_t *request) { skinny_message_t *message; - skinny_profile_t *profile; - - switch_assert(listener->profile); - switch_assert(listener->device_name); - - profile = listener->profile; - - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.soft_key_set)); - message->type = SOFT_KEY_SET_RES_MESSAGE; - message->length = 4 + sizeof(message->data.soft_key_set); - - message->data.soft_key_set.soft_key_set_offset = 0; - message->data.soft_key_set.soft_key_set_count = 11; - message->data.soft_key_set.total_soft_key_set_count = 11; - - /* TODO fill the set */ - message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_ON_HOOK].soft_key_template_index[0] = SOFTKEY_NEWCALL; - message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_ON_HOOK].soft_key_template_index[1] = SOFTKEY_REDIAL; - - message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_OFF_HOOK].soft_key_template_index[1] = SOFTKEY_REDIAL; - message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_OFF_HOOK].soft_key_template_index[2] = SOFTKEY_ENDCALL; - message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_DIGITS_AFTER_DIALING_FIRST_DIGIT].soft_key_template_index[0] = SOFTKEY_BACKSPACE; - message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_DIGITS_AFTER_DIALING_FIRST_DIGIT].soft_key_template_index[2] = SOFTKEY_ENDCALL; - - message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_CONNECTED].soft_key_template_index[0] = SOFTKEY_ENDCALL; - message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_CONNECTED].soft_key_template_index[1] = SOFTKEY_HOLD; - message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_CONNECTED].soft_key_template_index[2] = SOFTKEY_NEWCALL; - message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_CONNECTED].soft_key_template_index[3] = SOFTKEY_TRANSFER; - - message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_RING_IN].soft_key_template_index[0] = SOFTKEY_ANSWER; - message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_RING_IN].soft_key_template_index[1] = SOFTKEY_ENDCALL; - message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_RING_IN].soft_key_template_index[2] = SOFTKEY_NEWCALL; - - message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_ON_HOLD].soft_key_template_index[0] = SOFTKEY_NEWCALL; - message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_ON_HOLD].soft_key_template_index[1] = SOFTKEY_RESUME; - message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_ON_HOLD].soft_key_template_index[2] = SOFTKEY_ENDCALL; - - message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_OFF_HOOK_WITH_FEATURES].soft_key_template_index[1] = SOFTKEY_REDIAL; - message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_OFF_HOOK_WITH_FEATURES].soft_key_template_index[2] = SOFTKEY_ENDCALL; - - skinny_send_reply(listener, message); + message = switch_core_hash_find(listener->profile->soft_key_set_sets_hash, "default"); + if (message) { + skinny_send_reply(listener, message); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "Profile %s doesn't have a default <soft-key-set-set>. Profile ignored.\n", listener->profile->name); + } /* Init the states */ send_select_soft_keys(listener, 0, 0, SKINNY_KEY_SET_ON_HOOK, 0xffff); diff --git a/src/mod/endpoints/mod_skinny/skinny_tables.c b/src/mod/endpoints/mod_skinny/skinny_tables.c index 07be7c4..43b2290 100644 --- a/src/mod/endpoints/mod_skinny/skinny_tables.c +++ b/src/mod/endpoints/mod_skinny/skinny_tables.c @@ -176,7 +176,7 @@ struct skinny_table SKINNY_SOFT_KEY_EVENTS[] = { {NULL, 0} }; SKINNY_DECLARE_ID2STR(skinny_soft_key_event2str, SKINNY_SOFT_KEY_EVENTS, "SoftkeyUnknown") -SKINNY_DECLARE_STR2ID(skinny_str2soft_key_event, SKINNY_SOFT_KEY_EVENTS, -1) +SKINNY_DECLARE_STR2ID(skinny_str2soft_key_event, SKINNY_SOFT_KEY_EVENTS, 0) struct skinny_table SKINNY_LAMP_MODES[] = { {"Off", SKINNY_LAMP_OFF}, commit 690ae1b313074efe8948faa539b6335c3140ca6b Author: Mathieu Parent <math.parent@gmail.com> Date: Sat Sep 4 08:28:59 2010 +0200 Skinny: avoid "-ERR no reply" when using API commands from CLI diff --git a/src/mod/endpoints/mod_skinny/skinny_api.c b/src/mod/endpoints/mod_skinny/skinny_api.c index 9937353..90699d1 100644 --- a/src/mod/endpoints/mod_skinny/skinny_api.c +++ b/src/mod/endpoints/mod_skinny/skinny_api.c @@ -275,6 +275,7 @@ static switch_status_t skinny_api_cmd_profile_device_send_ringer_message(const c skinny_profile_find_listener_by_device_name(profile, device_name, &listener); if(listener) { send_set_ringer(listener, skinny_str2ring_type(ring_type), skinny_str2ring_mode(ring_mode), 0, 0); + stream->write_function(stream, "+OK\n"); } else { stream->write_function(stream, "Listener not found!\n"); } @@ -294,6 +295,7 @@ static switch_status_t skinny_api_cmd_profile_device_send_lamp_message(const cha skinny_profile_find_listener_by_device_name(profile, device_name, &listener); if(listener) { send_set_lamp(listener, skinny_str2button(stimulus), atoi(instance), skinny_str2lamp_mode(lamp_mode)); + stream->write_function(stream, "+OK\n"); } else { stream->write_function(stream, "Listener not found!\n"); } @@ -313,6 +315,7 @@ static switch_status_t skinny_api_cmd_profile_device_send_speaker_mode_message(c skinny_profile_find_listener_by_device_name(profile, device_name, &listener); if(listener) { send_set_speaker_mode(listener, skinny_str2speaker_mode(speaker_mode)); + stream->write_function(stream, "+OK\n"); } else { stream->write_function(stream, "Listener not found!\n"); } @@ -332,6 +335,7 @@ static switch_status_t skinny_api_cmd_profile_device_send_call_state_message(con skinny_profile_find_listener_by_device_name(profile, device_name, &listener); if(listener) { send_call_state(listener, skinny_str2call_state(call_state), atoi(line_instance), atoi(call_id)); + stream->write_function(stream, "+OK\n"); } else { stream->write_function(stream, "Listener not found!\n"); } @@ -351,6 +355,7 @@ static switch_status_t skinny_api_cmd_profile_device_send_reset_message(const ch skinny_profile_find_listener_by_device_name(profile, device_name, &listener); if(listener) { send_reset(listener, skinny_str2device_reset_type(reset_type)); + stream->write_function(stream, "+OK\n"); } else { stream->write_function(stream, "Listener not found!\n"); } @@ -368,6 +373,7 @@ static switch_status_t skinny_api_cmd_profile_set(const char *profile_name, cons if ((profile = skinny_find_profile(profile_name))) { if (skinny_profile_set(profile, name, value) == SWITCH_STATUS_SUCCESS) { skinny_profile_respawn(profile, 0); + stream->write_function(stream, "+OK\n"); } else { stream->write_function(stream, "Unable to set skinny setting '%s'. Does it exists?\n", name); } commit 8381a4f3cf941aba8d2ba8b031ad9774ad05096f Author: Mathieu Parent <math.parent@gmail.com> Date: Sat Sep 4 00:09:06 2010 +0200 Skinny: adding tables for soft_key_events diff --git a/src/mod/endpoints/mod_skinny/skinny_tables.c b/src/mod/endpoints/mod_skinny/skinny_tables.c index f76e843..07be7c4 100644 --- a/src/mod/endpoints/mod_skinny/skinny_tables.c +++ b/src/mod/endpoints/mod_skinny/skinny_tables.c @@ -152,6 +152,32 @@ struct skinny_table SKINNY_BUTTONS[] = { SKINNY_DECLARE_ID2STR(skinny_button2str, SKINNY_BUTTONS, "Unknown") SKINNY_DECLARE_STR2ID(skinny_str2button, SKINNY_BUTTONS, -1) +struct skinny_table SKINNY_SOFT_KEY_EVENTS[] = { + {"SoftkeyRedial", SOFTKEY_REDIAL}, + {"SoftkeyNewcall", SOFTKEY_NEWCALL}, + {"SoftkeyHold", SOFTKEY_HOLD}, + {"SoftkeyTransfer", SOFTKEY_TRANSFER}, + {"SoftkeyCfwdall", SOFTKEY_CFWDALL}, + {"SoftkeyCfwdbusy", SOFTKEY_CFWDBUSY}, + {"SoftkeyCfwdnoanswer", SOFTKEY_CFWDNOANSWER}, + {"SoftkeyBackspace", SOFTKEY_BACKSPACE}, + {"SoftkeyEndcall", SOFTKEY_ENDCALL}, + {"SoftkeyResume", SOFTKEY_RESUME}, + {"SoftkeyAnswer", SOFTKEY_ANSWER }, + {"SoftkeyInfo", SOFTKEY_INFO}, + {"SoftkeyConfrm", SOFTKEY_CONFRM}, + {"SoftkeyPark", SOFTKEY_PARK}, + {"SoftkeyJoin", SOFTKEY_JOIN}, + {"SoftkeyMeetmeconfrm", SOFTKEY_MEETMECONFRM}, + {"SoftkeyCallpickup", SOFTKEY_CALLPICKUP}, + {"SoftkeyGrpcallpickup", SOFTKEY_GRPCALLPICKUP}, + {"SoftkeyDnd", SOFTKEY_DND}, + {"SoftkeyIdivert", SOFTKEY_IDIVERT}, + {NULL, 0} +}; +SKINNY_DECLARE_ID2STR(skinny_soft_key_event2str, SKINNY_SOFT_KEY_EVENTS, "SoftkeyUnknown") +SKINNY_DECLARE_STR2ID(skinny_str2soft_key_event, SKINNY_SOFT_KEY_EVENTS, -1) + struct skinny_table SKINNY_LAMP_MODES[] = { {"Off", SKINNY_LAMP_OFF}, {"On", SKINNY_LAMP_ON}, diff --git a/src/mod/endpoints/mod_skinny/skinny_tables.h b/src/mod/endpoints/mod_skinny/skinny_tables.h index 6c91825..1747360 100644 --- a/src/mod/endpoints/mod_skinny/skinny_tables.h +++ b/src/mod/endpoints/mod_skinny/skinny_tables.h @@ -194,6 +194,10 @@ enum skinny_soft_key_event { SOFTKEY_DND = 0x13, SOFTKEY_IDIVERT = 0x14, }; +extern struct skinny_table SKINNY_SOFT_KEY_EVENTS[21]; +const char *skinny_soft_key_event2str(uint32_t id); +uint32_t skinny_str2soft_key_event(const char *str); +#define SKINNY_PUSH_SOFT_KEY_EVENTS SKINNY_DECLARE_PUSH_MATCH(SOFT_KEY_EVENTS) enum skinny_key_set { SKINNY_KEY_SET_ON_HOOK = 0, commit 0be95658aff1ee11daf97f8e41a63e4f1c1a1b41 Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Fri Sep 3 22:53:14 2010 -0400 mod_callcenter: Make more sence to bridge the caller to the agent. Before, in the xml_cdr you saw it it like the agent initiated the call to the member diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index bad1c54..e56309d 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1426,7 +1426,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Agent %s answered \"%s\" (%s) from queue %s%s\n", h->agent_name, h->member_caller_name, h->member_caller_number, h->queue, (h->record_template?" (Recorded)":"")); - switch_ivr_uuid_bridge(switch_core_session_get_uuid(agent_session), h->member_uuid); + switch_ivr_uuid_bridge(h->member_uuid, switch_core_session_get_uuid(agent_session)); /* Wait until the member hangup or the agent hangup. This will quit also if the agent transfer the call */ while(switch_channel_up(member_channel) && switch_channel_up(agent_channel) && globals.running) { commit 2d3d8c8ddd2b810a8328cf80c08c10926a2015da Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Fri Sep 3 20:12:45 2010 -0400 mod_callcenter: Add more channel variable and event and fix a mem leak diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 0c4241c..bad1c54 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1307,8 +1307,11 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa } if (!strcasecmp(h->agent_type, CC_AGENT_TYPE_CALLBACK)) { switch_event_create(&ovars, SWITCH_EVENT_REQUEST_PARAMS); + switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "cc_queue", "%s", h->queue); switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "cc_member_uuid", "%s", h->member_uuid); switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "cc_member_pre_answer_uuid", "%s", h->member_uuid); + switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "cc_agent", "%s", h->agent_name); + switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "cc_agent_type", "%s", h->agent_type); switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "ignore_early_media", "true"); t_agent_called = switch_epoch_time_now(NULL); @@ -1323,6 +1326,12 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_channel_t *agent_channel = switch_core_session_get_channel(agent_session); switch_event_t *event; const char *cc_warning_tone = switch_channel_get_variable(agent_channel, "cc_warning_tone"); + + switch_channel_set_variable(agent_channel, "cc_queue", h->queue); + switch_channel_set_variable(agent_channel, "cc_agent", h->agent_name); + switch_channel_set_variable(agent_channel, "cc_agent_type", h->agent_type); + switch_channel_set_variable(agent_channel, "cc_member_uuid", h->member_uuid); + /* Playback this to the agent */ if (cc_warning_tone && switch_event_create(&event, SWITCH_EVENT_COMMAND) == SWITCH_STATUS_SUCCESS) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-command", "execute"); @@ -1772,7 +1781,7 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName switch_safe_free(sql); } /* Skip this member */ - return 0; + goto end; } memset(&cbt, 0, sizeof(cbt)); cbt.tier = 0; commit 73e1ec5e46d7521aceaba30a111cfeaad950a739 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Sep 3 17:29:26 2010 -0500 FSCORE-667 diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index e8704a9..faa116f 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -1259,6 +1259,10 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session) switch_core_codec_destroy(&tech_pvt->write_codec); } + if (tech_pvt->dlsession) { + ldl_session_destroy(&tech_pvt->dlsession); + } + switch_thread_rwlock_unlock(tech_pvt->profile->rwlock); if (tech_pvt->profile->purge) { @@ -1296,13 +1300,12 @@ static switch_status_t channel_on_hangup(switch_core_session_t *session) if ((tech_pvt->profile->user_flags & LDL_FLAG_COMPONENT) && is_special(tech_pvt->them)) { ldl_handle_send_presence(tech_pvt->profile->handle, tech_pvt->them, tech_pvt->us, NULL, NULL, "Click To Call", tech_pvt->profile->avatar); } - if (tech_pvt->dlsession) { - if (!switch_test_flag(tech_pvt, TFLAG_TERM)) { - ldl_session_terminate(tech_pvt->dlsession); - switch_set_flag_locked(tech_pvt, TFLAG_TERM); - } - ldl_session_destroy(&tech_pvt->dlsession); + + if (!switch_test_flag(tech_pvt, TFLAG_TERM) && tech_pvt->dlsession) { + ldl_session_terminate(tech_pvt->dlsession); + switch_set_flag_locked(tech_pvt, TFLAG_TERM); } + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(channel)); @@ -1324,15 +1327,6 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int switch_clear_flag_locked(tech_pvt, TFLAG_VOICE); switch_set_flag_locked(tech_pvt, TFLAG_BYE); - if (tech_pvt->dlsession) { - if (!switch_test_flag(tech_pvt, TFLAG_TERM)) { - ldl_session_terminate(tech_pvt->dlsession); - switch_set_flag_locked(tech_pvt, TFLAG_TERM); - } - ldl_session_destroy(&tech_pvt->dlsession); - - } - if (switch_rtp_ready(tech_pvt->rtp_session)) { switch_rtp_kill_socket(tech_pvt->rtp_session); } commit d7141be3bc08b9b3216048c73952582f6451c7e1 Merge: 2f01722 3e1ae21 Author: David Yat Sin <dyatsin@sangoma.com> Date: Fri Sep 3 17:38:35 2010 -0400 Merge branch 'master' into davidy_test commit 461db7573e63eec8b10309b1d633156719f3354c Author: Mathieu Parent <math.parent@gmail.com> Date: Fri Sep 3 23:28:50 2010 +0200 Skinny: Better IP change handling - Respawn only if ip or port is changed - Properly handle timeout diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index cbeae6c..0f7b370 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -1233,7 +1233,6 @@ static void walk_listeners(skinny_listener_callback_func_t callback, void *pvt) switch_hash_index_t *hi; void *val; skinny_profile_t *profile; - listener_t *l; /* walk listeners */ switch_mutex_lock(globals.mutex); @@ -1241,11 +1240,7 @@ static void walk_listeners(skinny_listener_callback_func_t callback, void *pvt) switch_hash_this(hi, NULL, NULL, &val); profile = (skinny_profile_t *) val; - switch_mutex_lock(profile->listener_mutex); - for (l = profile->listeners; l; l = l->next) { - callback(l, pvt); - } - switch_mutex_unlock(profile->listener_mutex); + profile_walk_listeners(profile, callback, pvt); } switch_mutex_unlock(globals.mutex); } @@ -1509,6 +1504,7 @@ static void *SWITCH_THREAD_FUNC skinny_profile_run(switch_thread_t *thread, void new_socket: while(globals.running) { + switch_clear_flag_locked(profile, PFLAG_RESPAWN); rv = switch_sockaddr_info_get(&sa, profile->ip, SWITCH_INET, profile->port, 0, tmp_pool); if (rv) goto fail; @@ -1546,8 +1542,10 @@ new_socket: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Shutting Down\n"); goto end; } else if (switch_test_flag(profile, PFLAG_RESPAWN)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Creating a new socket\n"); - switch_clear_flag_locked(profile, PFLAG_RESPAWN); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Respawn in progress. Waiting for socket to close.\n"); + while (profile->sock) { + switch_cond_next(); + } goto new_socket; } else { /* I wish we could use strerror_r here but its not defined everywhere =/ */ @@ -1619,6 +1617,18 @@ switch_endpoint_interface_t *skinny_get_endpoint_interface() return skinny_endpoint_interface; } +switch_status_t skinny_profile_respawn(skinny_profile_t *profile, int force) +{ + if (force || switch_test_flag(profile, PFLAG_SHOULD_RESPAWN)) { + switch_clear_flag_locked(profile, PFLAG_SHOULD_RESPAWN); + switch_set_flag_locked(profile, PFLAG_RESPAWN); + switch_clear_flag_locked(profile, PFLAG_LISTENER_READY); + profile_walk_listeners(profile, kill_listener, NULL); + close_socket(&profile->sock, profile); + } + return SWITCH_STATUS_SUCCESS; +} + switch_status_t skinny_profile_set(skinny_profile_t *profile, const char *var, const char *val) { if (!var) @@ -1633,9 +1643,15 @@ switch_status_t skinny_profile_set(skinny_profile_t *profile, const char *var, c if (!strcasecmp(var, "domain")) { profile->domain = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "ip")) { - profile->ip = switch_core_strdup(profile->pool, val); + if (!profile->ip || strcmp(val, profile->ip)) { + profile->ip = switch_core_strdup(profile->pool, val); + switch_set_flag_locked(profile, PFLAG_SHOULD_RESPAWN); + } } else if (!strcasecmp(var, "port")) { - profile->port = atoi(val); + if (atoi(val) != profile->port) { + profile->port = atoi(val); + switch_set_flag_locked(profile, PFLAG_SHOULD_RESPAWN); + } } else if (!strcasecmp(var, "patterns-dialplan")) { profile->patterns_dialplan = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "patterns-context")) { @@ -1669,15 +1685,21 @@ switch_status_t skinny_profile_set(skinny_profile_t *profile, const char *var, c } else { return SWITCH_STATUS_FALSE; } - if (profile->sock && (!strcasecmp(var, "ip") || !strcasecmp(var, "port"))) { - switch_set_flag_locked(profile, PFLAG_RESPAWN); - switch_clear_flag_locked(profile, PFLAG_LISTENER_READY); - close_socket(&profile->sock, profile); - } return SWITCH_STATUS_SUCCESS; } +void profile_walk_listeners(skinny_profile_t *profile, skinny_listener_callback_func_t callback, void *pvt) +{ + listener_t *l; + + switch_mutex_lock(profile->listener_mutex); + for (l = profile->listeners; l; l = l->next) { + callback(l, pvt); + } + switch_mutex_unlock(profile->listener_mutex); +} + static switch_status_t load_skinny_config(void) { char *cf = "skinny.conf"; @@ -1811,6 +1833,7 @@ static switch_status_t load_skinny_config(void) } } } + skinny_profile_respawn(profile, 0); /* Register profile */ switch_mutex_lock(globals.mutex); @@ -2009,6 +2032,7 @@ static void skinny_trap_event_handler(switch_event_t *event) } else if (!strcmp(profile->ip, old_ip6)) { skinny_profile_set(profile, "ip", new_ip6); } + skinny_profile_respawn(profile, 0); } } } diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.h b/src/mod/endpoints/mod_skinny/mod_skinny.h index f52f171..accb7e6 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.h +++ b/src/mod/endpoints/mod_skinny/mod_skinny.h @@ -61,7 +61,8 @@ extern skinny_globals_t globals; typedef enum { PFLAG_LISTENER_READY = (1 << 0), - PFLAG_RESPAWN = (1 << 1), + PFLAG_SHOULD_RESPAWN = (1 << 1), + PFLAG_RESPAWN = (1 << 2), } profile_flag_t; struct skinny_profile { @@ -220,6 +221,9 @@ switch_core_session_t * skinny_profile_perform_find_session(skinny_profile_t *pr switch_core_session_t * skinny_profile_find_session(skinny_profile_t *profile, listener_t *listener, uint32_t *line_instance_p, uint32_t call_id); #endif switch_status_t dump_device(skinny_profile_t *profile, const char *device_name, switch_stream_handle_t *stream); +switch_status_t skinny_profile_respawn(skinny_profile_t *profile, int force); +switch_status_t skinny_profile_set(skinny_profile_t *profile, const char *var, const char *val); +void profile_walk_listeners(skinny_profile_t *profile, skinny_listener_callback_func_t callback, void *pvt); /*****************************************************************************/ /* SQL FUNCTIONS */ @@ -262,7 +266,6 @@ switch_status_t channel_kill_channel(switch_core_session_t *session, int sig); /* MODULE FUNCTIONS */ /*****************************************************************************/ switch_endpoint_interface_t *skinny_get_endpoint_interface(); -switch_status_t skinny_profile_set(skinny_profile_t *profile, const char *var, const char *val); #endif /* _MOD_SKINNY_H */ diff --git a/src/mod/endpoints/mod_skinny/skinny_api.c b/src/mod/endpoints/mod_skinny/skinny_api.c index 86eea74..9937353 100644 --- a/src/mod/endpoints/mod_skinny/skinny_api.c +++ b/src/mod/endpoints/mod_skinny/skinny_api.c @@ -366,7 +366,9 @@ static switch_status_t skinny_api_cmd_profile_set(const char *profile_name, cons skinny_profile_t *profile; if ((profile = skinny_find_profile(profile_name))) { - if (skinny_profile_set(profile, name, value) != SWITCH_STATUS_SUCCESS) { + if (skinny_profile_set(profile, name, value) == SWITCH_STATUS_SUCCESS) { + skinny_profile_respawn(profile, 0); + } else { stream->write_function(stream, "Unable to set skinny setting '%s'. Does it exists?\n", name); } } else { diff --git a/src/mod/endpoints/mod_skinny/skinny_protocol.c b/src/mod/endpoints/mod_skinny/skinny_protocol.c index c519dc4..1aea812 100644 --- a/src/mod/endpoints/mod_skinny/skinny_protocol.c +++ b/src/mod/endpoints/mod_skinny/skinny_protocol.c @@ -122,6 +122,9 @@ switch_status_t skinny_read_packet(listener_t *listener, skinny_message_t **req) while (listener_is_ready(listener)) { uint8_t do_sleep = 1; + if (listener->expire_time && listener->expire_time < switch_epoch_time_now(NULL)) { + return SWITCH_STATUS_TIMEOUT; + } if(bytes < SKINNY_MESSAGE_FIELD_SIZE) { /* We have nothing yet, get length header field */ mlen = SKINNY_MESSAGE_FIELD_SIZE - bytes; @@ -171,9 +174,6 @@ switch_status_t skinny_read_packet(listener_t *listener, skinny_message_t **req) } } } - if (listener->expire_time && listener->expire_time < switch_epoch_time_now(NULL)) { - return SWITCH_STATUS_TIMEOUT; - } if (do_sleep) { switch_cond_next(); } commit 2f01722ebadcb049c1080c545073fed226a3af3e Author: David Yat Sin <dyatsin@sangoma.com> Date: Fri Sep 3 17:09:21 2010 -0400 fixed tabs diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index ef44063..9ffd709 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -281,8 +281,8 @@ static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj) while ((sngisdn_event = ftdm_queue_dequeue(signal_data->event_queue))) { ftdm_sangoma_isdn_process_stack_event(span, sngisdn_event); ftdm_safe_free(sngisdn_event); - } - ftdm_span_trigger_signals(span); + } + ftdm_span_trigger_signals(span); break; case FTDM_TIMEOUT: /* twiddle */ commit 3e1ae21d5d6f51518f99d82205fb1cbc74e075e4 Author: Moises Silva <moy@sangoma.com> Date: Fri Sep 3 15:35:22 2010 -0400 remove stuff that should be only on smg repo diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index df88106..5830822 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3300,7 +3300,6 @@ SWITCH_STANDARD_API(sofia_contact_function) char *p; sofia_profile_t *profile = NULL; const char *exclude_contact = NULL; - const char *user_replacement = NULL; char *reply = "error/facility_not_subscribed"; if (!cmd) { @@ -3311,7 +3310,6 @@ SWITCH_STANDARD_API(sofia_contact_function) if (session) { switch_channel_t *channel = switch_core_session_get_channel(session); exclude_contact = switch_channel_get_variable(channel, "sip_exclude_contact"); - user_replacement = switch_channel_get_variable(channel, "sip_contact_user_replacement"); } @@ -3390,93 +3388,6 @@ SWITCH_STANDARD_API(sofia_contact_function) reply = "error/user_not_registered"; } - if (user_replacement) { - int urlcount = 0; - int copyerr = 0; - char *newreply = NULL; - char *urlstart = NULL; - char *newptr = NULL; - char *bufend = NULL; - char *str = reply; - switch_size_t copysize = 0; - switch_size_t replacesize = strlen(user_replacement); - switch_size_t allocsize = 0; - - /* first pass to count how many URLs we have */ - while ((urlstart = strcasestr(str, "sip:")) || (urlstart = strcasestr(str, "sips:"))) { - urlcount++; - str = urlstart + 4; - } - - if (!urlcount) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "sofia_contact(): no sip URLs found to replace the user\n"); - copyerr++; - goto copydone; - } - - /* this allocates a bit more than needed but better safe than sorry doing more funky math */ - allocsize = strlen(reply) + (urlcount * replacesize); - newreply = switch_core_session_alloc(session, allocsize); - if (!newreply) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "sofia_contact(): no buffer space available for replacement\n"); - copyerr++; - goto copydone; - } - - /* get a working pointer to the new reply */ - newptr = newreply; - - /* pointer to the end of the allocated buffer for safety checks */ - bufend = newreply + allocsize - 1; - *bufend = 0; - - /* go thru all the urls and replace the user part */ - str = reply; - while ((urlstart = strcasestr(str, "sip:")) || (urlstart = strcasestr(str, "sips:"))) { - - /* found an URL, copy up to the start of the url */ - copysize = ( urlstart - str ) + 4; - - /* double check boundaries before copying anything at all (this should not happen) */ - if ((newptr + copysize + replacesize) >= bufend) { - copyerr++; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "sofia_contact(): wow buffer was not big enough!\n"); - break; - } - - /* copy the original contact string except for the user */ - memcpy(newptr, str, copysize); - newptr += copysize; - - /* copy the user replacement */ - memcpy(newptr, user_replacement, replacesize); - newptr += replacesize; - - /* skip the original user part */ - str = strchr(urlstart, '@'); - if (!str) { - copyerr++; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "sofia_contact(): not host part found for contact\n"); - break; - } - /* continue searching for the next sip: URL */ - } - -copydone: - if (!copyerr) { - /* copy the remaining reply string */ - copysize = strlen(str); - if ((newptr + copysize) >= bufend) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "sofia_contact(): wow buffer was not big enough, close, but not enough!\n"); - } else { - strcpy(newptr, str); - reply = newreply; - } - } else { - reply = "error/replacement error"; - } - } - stream->write_function(stream, "%s", reply); reply = NULL; diff --git a/src/switch_core.c b/src/switch_core.c index 7fd000a..4bfc02e 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1539,7 +1539,7 @@ static void switch_load_core_config(const char *file) SWITCH_DECLARE(const char *) switch_core_banner(void) { -#if 0 + return ("\n" " _____ ______ _____ _____ ____ _ _ \n" " | ___| __ ___ ___/ ___\\ \\ / /_ _|_ _/ ___| | | | \n" @@ -1552,20 +1552,6 @@ SWITCH_DECLARE(const char *) switch_core_banner(void) "* FreeSWITCH (http://www.freeswitch.org) *\n" "* Paypal Donations Appreciated: paypal@freeswitch.org *\n" "* Brought to you by ClueCon http://www.cluecon.com/ *\n" "************************************************************\n" "\n"); -#else - return ( -"\n _____ ___ ___ _ _ _____ _ \n" -"/ ___| | \\/ | | (_) | __ \\ | | \n" -"\\ `--. __ _ _ __ __ _ ___ _ __ ___ __ _ | . . | ___ __| |_ __ _ | | \\/ __ _| |_ _____ ____ _ _ _ \n" -" `--. \\/ _` | '_ \\ / _` |/ _ \\| '_ ` _ \\ / _` | | |\\/| |/ _ \\/ _` | |/ _` | | | __ / _` | __|/ _ \\ \\ /\\ / / _` | | | |\n" -"/\\__/ / (_| | | | | (_| | (_) | | | | | | (_| | | | | | __/ (_| | | (_| | | |_\\ \\ (_| | |_| __/\\ V V / (_| | |_| |\n" -"\\____/ \\__,_|_| |_|\\__, |\\___/|_| |_| |_|\\__,_| \\_| |_/\\___|\\__,_|_|\\__,_| \\____/\\__,_|\\__|\\___| \\_/\\_/ \\__,_|\\__, |\n" -" __/ | __/ |\n" -" |___/ |___/ \n" - "************************************************************\n" - "* Powered by: FreeSWITCH (http://www.freeswitch.org) *\n" - "************************************************************\n" "\n"); -#endif } commit 71fd30d40e5d0c87575a4e95cce1890950bdbc3d Author: David Yat Sin <dyatsin@sangoma.com> Date: Fri Sep 3 15:27:42 2010 -0400 spInstId's are now saved before queueing the SETUP event diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index f49d651..c3d97e5 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -78,7 +78,7 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) } sngisdn_info->suInstId = get_unique_suInstId(suId); - sngisdn_info->spInstId = spInstId; + sngisdn_info->spInstId = spInstId; /* If this is a glared call that was previously saved, we moved all the info to the current call, so clear the glared saved data */ @@ -87,10 +87,7 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) clear_call_glare_data(sngisdn_info); } - ftdm_assert(g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] == NULL, "Con Ind on busy spInstId"); - ftdm_mutex_lock(g_sngisdn_data.ccs[suId].mutex); - g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] = sngisdn_info; g_sngisdn_data.ccs[suId].active_suInstIds[sngisdn_info->suInstId] = sngisdn_info; ftdm_mutex_unlock(g_sngisdn_data.ccs[suId].mutex); @@ -118,7 +115,7 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) ftdmchan->caller_data.bearer_layer1 = sngisdn_get_infoTranCap_from_stack(conEvnt->bearCap[0].usrInfoLyr1Prot.val); ftdmchan->caller_data.bearer_capability = sngisdn_get_infoTranCap_from_stack(conEvnt->bearCap[0].infoTranCap.val); } - + if (signal_data->switchtype == SNGISDN_SWITCH_NI2) { if (conEvnt->shift11.eh.pres && conEvnt->ni2OctStr.eh.pres) { if (conEvnt->ni2OctStr.str.len == 4 && conEvnt->ni2OctStr.str.val[0] == 0x37) { @@ -160,7 +157,7 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) break; case FTDM_CHANNEL_STATE_TERMINATING: ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Processing SETUP in TERMINATING state, saving SETUP info for later processing\n"); - ftdm_assert(!sngisdn_test_flag(sngisdn_info, FLAG_GLARE), "Trying to save GLARE info, but we already had a glare"); + ftdm_assert(!sngisdn_test_flag(sngisdn_info, FLAG_GLARE), "Trying to save GLARE info, but we already had a glare\n"); sngisdn_set_flag(sngisdn_info, FLAG_GLARE); @@ -172,11 +169,6 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) sngisdn_info->glare.dChan = dChan; sngisdn_info->glare.ces = ces; - /* We need to register the spInstId in case we get a release for that call while it is still stored in sngisdn_info->glare */ - ftdm_mutex_lock(g_sngisdn_data.ccs[suId].mutex); - g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] = sngisdn_info; - ftdm_mutex_unlock(g_sngisdn_data.ccs[suId].mutex); - break; case FTDM_CHANNEL_STATE_DIALING: /* glare */ if (signal_data->signalling == SNGISDN_SIGNALING_NET) { @@ -188,11 +180,6 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) sngisdn_info->glare.suInstId = get_unique_suInstId(suId); sngisdn_info->glare.spInstId = spInstId; - ftdm_mutex_lock(g_sngisdn_data.ccs[suId].mutex); - g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] = sngisdn_info; - g_sngisdn_data.ccs[suId].active_suInstIds[sngisdn_info->suInstId] = sngisdn_info; - ftdm_mutex_unlock(g_sngisdn_data.ccs[suId].mutex); - sngisdn_info->glare.dChan = dChan; sngisdn_info->glare.ces = ces; ftdmchan->caller_data.hangup_cause = 0x2C; /* Channel requested not available */ @@ -212,10 +199,6 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) sngisdn_info->glare.dChan = dChan; sngisdn_info->glare.ces = ces; - /* We need to register the spInstId in case we get a release for that call while it is still stored in sngisdn_info->glare */ - ftdm_mutex_lock(g_sngisdn_data.ccs[suId].mutex); - g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] = sngisdn_info; - ftdm_mutex_unlock(g_sngisdn_data.ccs[suId].mutex); ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); } break; @@ -245,13 +228,6 @@ void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event) ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n"); ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing CONNECT/CONNECT ACK (suId:%u suInstId:%u spInstId:%u ces:%d)\n", suId, suInstId, spInstId, ces); - - if (!sngisdn_info->spInstId) { - ftdm_mutex_lock(g_sngisdn_data.ccs[suId].mutex); - sngisdn_info->spInstId = spInstId; - g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] = sngisdn_info; - ftdm_mutex_unlock(g_sngisdn_data.ccs[suId].mutex); - } if (ftdmchan->span->trunk_type == FTDM_TRUNK_BRI_PTMP && ((sngisdn_span_data_t*)ftdmchan->span->signal_data)->signalling == SNGISDN_SIGNALING_NET) { @@ -315,13 +291,6 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) CnStEvnt *cnStEvnt = &sngisdn_event->event.cnStEvnt; - if (!sngisdn_info->spInstId) { - ftdm_mutex_lock(g_sngisdn_data.ccs[suId].mutex); - sngisdn_info->spInstId = spInstId; - g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] = sngisdn_info; - ftdm_mutex_unlock(g_sngisdn_data.ccs[suId].mutex); - } - ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n"); ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing %s (suId:%u suInstId:%u spInstId:%u ces:%d)\n", @@ -418,13 +387,6 @@ void sngisdn_process_disc_ind (sngisdn_event_data_t *sngisdn_event) DiscEvnt *discEvnt = &sngisdn_event->event.discEvnt; - if (!sngisdn_info->spInstId) { - ftdm_mutex_lock(g_sngisdn_data.ccs[suId].mutex); - sngisdn_info->spInstId = spInstId; - g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] = sngisdn_info; - ftdm_mutex_unlock(g_sngisdn_data.ccs[suId].mutex); - } - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing DISCONNECT (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n"); @@ -698,6 +660,7 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event) ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Failed to retrieve Caller Name from Facility IE\n"); } } + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); break; default: @@ -876,6 +839,7 @@ void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event) case 9: switch (ftdmchan->state) { case FTDM_CHANNEL_STATE_PROGRESS: + case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: /* Do nothing */ break; default: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 8ae5138..6e8e0e8 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -283,7 +283,7 @@ void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan) sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { + if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending PROGRESS, but no call data, aborting (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c index 75513fb..29cfb23 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c @@ -87,11 +87,14 @@ void sngisdn_rcv_con_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, Co sngisdn_event->event_id = SNGISDN_EVENT_CON_IND; sngisdn_event->sngisdn_info = sngisdn_info; sngisdn_event->suId = suId; - sngisdn_event->suInstId = suInstId; sngisdn_event->spInstId = spInstId; sngisdn_event->dChan = dChan; sngisdn_event->ces = ces; + ftdm_mutex_lock(g_sngisdn_data.ccs[suId].mutex); + g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] = sngisdn_info; + ftdm_mutex_unlock(g_sngisdn_data.ccs[suId].mutex); + memcpy(&sngisdn_event->event.conEvnt, conEvnt, sizeof(*conEvnt)); ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); @@ -113,6 +116,14 @@ void sngisdn_rcv_con_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, Cn return; } + if (!sngisdn_info->spInstId) { + ftdm_mutex_lock(g_sngisdn_data.ccs[suId].mutex); + sngisdn_info->spInstId = spInstId; + g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] = sngisdn_info; + ftdm_mutex_unlock(g_sngisdn_data.ccs[suId].mutex); + } + + ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received CONNECT/CONNECT ACK (suId:%u suInstId:%u spInstId:%u ces:%d)\n", suId, suInstId, spInstId, ces); sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); @@ -126,7 +137,6 @@ void sngisdn_rcv_con_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, Cn sngisdn_event->spInstId = spInstId; sngisdn_event->dChan = dChan; sngisdn_event->ces = ces; - memcpy(&sngisdn_event->event.cnStEvnt, cnStEvnt, sizeof(*cnStEvnt)); ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); @@ -148,6 +158,13 @@ void sngisdn_rcv_cnst_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, C return; } + if (!sngisdn_info->spInstId) { + ftdm_mutex_lock(g_sngisdn_data.ccs[suId].mutex); + sngisdn_info->spInstId = spInstId; + g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] = sngisdn_info; + ftdm_mutex_unlock(g_sngisdn_data.ccs[suId].mutex); + } + ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received %s (suId:%u suInstId:%u spInstId:%u ces:%d)\n", (evntType == MI_ALERTING)?"ALERT": (evntType == MI_CALLPROC)?"PROCEED": @@ -191,6 +208,13 @@ void sngisdn_rcv_disc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, D return; } + if (!sngisdn_info->spInstId) { + ftdm_mutex_lock(g_sngisdn_data.ccs[suId].mutex); + sngisdn_info->spInstId = spInstId; + g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] = sngisdn_info; + ftdm_mutex_unlock(g_sngisdn_data.ccs[suId].mutex); + } + ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received DISCONNECT (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); @@ -643,7 +667,10 @@ void sngisdn_rcv_q921_ind(BdMngmt *status) } } } - ftdm_assert(ftdmspan != NULL, "Received q921 status on unconfigured span\n"); + if (ftdmspan == NULL) { + ftdm_log(FTDM_LOG_WARNING, "Received q921 status on unconfigured span (lnkNmb:%d)\n", status->t.usta.lnkNmb); + return; + } switch (status->t.usta.alarm.category) { case (LCM_CATEGORY_INTERFACE): commit 4ee68141d794dd4a296792e0b81c5a20a95d5d89 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Sep 3 14:11:38 2010 -0500 make dingaling work with google voice inbound too diff --git a/libs/libdingaling/src/libdingaling.c b/libs/libdingaling/src/libdingaling.c index ef6e744..1af67f6 100644 --- a/libs/libdingaling/src/libdingaling.c +++ b/libs/libdingaling/src/libdingaling.c @@ -2471,6 +2471,11 @@ int ldl_handle_running(ldl_handle_t *handle) } +void ldl_session_set_gateway(ldl_session_t *session) +{ + ldl_set_flag(session, LDL_FLAG_GATEWAY); +} + int ldl_session_gateway(ldl_session_t *session) { return ldl_test_flag(session, LDL_FLAG_GATEWAY) ? 1 : 0; diff --git a/libs/libdingaling/src/libdingaling.h b/libs/libdingaling/src/libdingaling.h index d786438..c32b936 100644 --- a/libs/libdingaling/src/libdingaling.h +++ b/libs/libdingaling/src/libdingaling.h @@ -593,6 +593,7 @@ ldl_status ldl_handle_init(ldl_handle_t **handle, void ldl_handle_run(ldl_handle_t *handle); int ldl_session_gateway(ldl_session_t *handle); +void ldl_session_set_gateway(ldl_session_t *session); /*! \brief Stop a libDingaLing handle diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index 69ce125..e8704a9 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -1002,7 +1002,7 @@ static int do_candidates(struct private_object *tech_pvt, int force) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Send Candidate %s:%d [%s]\n", cand[0].address, cand[0].port, cand[0].username); - if (ldl_session_gateway(tech_pvt->dlsession)) { + if (ldl_session_gateway(tech_pvt->dlsession) && switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { tech_pvt->cand_id = ldl_session_transport(tech_pvt->dlsession, cand, 1); } else { tech_pvt->cand_id = ldl_session_candidates(tech_pvt->dlsession, cand, 1); @@ -2980,6 +2980,8 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi tech_pvt->flags |= profile->flags; channel = switch_core_session_get_channel(session); switch_core_session_set_private(session, tech_pvt); + tech_pvt->dlsession = dlsession; + tech_pvt->session = session; tech_pvt->codec_index = -1; tech_pvt->profile = profile; @@ -3025,6 +3027,24 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi cid_num = tech_pvt->recip; } + + if (switch_stristr("voice.google.com", from)) { + char *id = switch_core_session_strdup(session, from); + char *p; + + if ((p = strchr(id, '@'))) { + *p++ = '\0'; + cid_name = "Google Voice"; + cid_num = id; + } + + ldl_session_set_gateway(dlsession); + + do_candidates(tech_pvt, 1); + } + + + /* context of "_auto_" means set it to the domain */ if (profile->context && !strcmp(profile->context, "_auto_")) { context = profile->name; @@ -3047,7 +3067,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi switch_safe_free(tmp); } - + if (!tech_pvt->caller_profile) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Creating an identity for %s %s <%s> %s\n", ldl_session_get_id(dlsession), cid_name, cid_num, exten); @@ -3079,7 +3099,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi } switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Creating a session for %s\n", ldl_session_get_id(dlsession)); ldl_session_set_private(dlsession, session); - tech_pvt->dlsession = dlsession; + switch_channel_set_name(channel, "DingaLing/new"); switch_channel_set_state(channel, CS_INIT); if (switch_core_session_thread_launch(session) != SWITCH_STATUS_SUCCESS) { @@ -3230,6 +3250,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi } } } + } break; @@ -3259,7 +3280,15 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi if (profile->acl_count) { for (x = 0; x < len; x++) { uint32_t y = 0; + + if (strcasecmp(candidates[x].protocol, "udp")) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "candidate %s:%d has an unsupported protocol!\n", + candidates[x].address, candidates[x].port); + continue; + } + for (y = 0; y < profile->acl_count; y++) { + if (switch_check_network_list_ip(candidates[x].address, profile->acl[y])) { choice = x; ok = 1; @@ -3268,7 +3297,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi if (ok) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "candidate %s:%d PASS ACL %s\n", candidates[x].address, candidates[x].port, profile->acl[y]); - break; + goto end_candidates; } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "candidate %s:%d FAIL ACL %s\n", candidates[x].address, candidates[x].port, profile->acl[y]); @@ -3311,6 +3340,8 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi } } + end_candidates: + if (ok) { ldl_payload_t payloads[5]; commit 5ce37cbed81837a13e28c8e4b3a49665bd550b78 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Sep 3 14:11:06 2010 -0500 refactor diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index d22c79a..eb9b03d 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1178,17 +1178,6 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand switch_find_local_ip(guess_ip4, sizeof(guess_ip4), NULL, AF_INET); - if (profile->reg_db_domain) { - if (!sofia_glue_profile_exists(to_host)) { - if (sofia_glue_add_profile(switch_core_strdup(profile->pool, to_host), profile) == SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Auto-Adding Alias [%s] for profile [%s]\n", to_host, profile->name); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Alias [%s] for profile [%s] (already exists)\n", - to_host, profile->name); - } - } - } - sql = switch_mprintf("insert into sip_registrations " "(call_id,sip_user,sip_host,presence_hosts,contact,status,rpid,expires," @@ -1430,6 +1419,17 @@ void sofia_reg_handle_sip_i_register(nua_t *nua, sofia_profile_t *profile, nua_h int network_port = 0; char *is_nat = NULL; + if (sip->sip_to && sip->sip_to->a_url && sip->sip_to->a_url->url_host) { + const char *to_host = sip->sip_to->a_url->url_host; + if (profile->reg_db_domain) { + if (!sofia_glue_profile_exists(to_host)) { + if (sofia_glue_add_profile(switch_core_strdup(profile->pool, to_host), profile) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Auto-Adding Alias [%s] for profile [%s]\n", to_host, profile->name); + } + } + } + } + sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), &network_port); if (!(sip->sip_contact && sip->sip_contact->m_url)) { commit a70192f2c7dd0f0dd1100b157522dd7871b17dc7 Merge: 4fbef45 bb980fd Author: Moises Silva <moy@sangoma.com> Date: Fri Sep 3 15:09:33 2010 -0400 Merge branch 'master' of git://git.freeswitch.org/freeswitch commit bb980fdef54cdbe4de0a42a75f8ff8c181f6e383 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Sep 3 12:46:21 2010 -0500 refactor diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 0168a33..aa21495 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -1007,3 +1007,4 @@ switch_t38_options_t *sofia_glue_extract_t38_options(switch_core_session_t *sess char *sofia_glue_get_multipart(switch_core_session_t *session, const char *prefix, const char *sdp, char **mp_type); void sofia_glue_tech_simplify(private_object_t *tech_pvt); switch_console_callback_match_t *sofia_reg_find_reg_url_multi(sofia_profile_t *profile, const char *user, const char *host); +switch_bool_t sofia_glue_profile_exists(const char *key); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 580b5e7..15efc1a 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -4174,6 +4174,19 @@ switch_status_t sofia_glue_profile_rdlock__(const char *file, const char *func, return status; } +switch_bool_t sofia_glue_profile_exists(const char *key) +{ + switch_bool_t tf = SWITCH_FALSE; + + switch_mutex_lock(mod_sofia_globals.hash_mutex); + if (switch_core_hash_find(mod_sofia_globals.profile_hash, key)) { + tf = SWITCH_TRUE; + } + switch_mutex_unlock(mod_sofia_globals.hash_mutex); + + return tf; +} + sofia_profile_t *sofia_glue_find_profile__(const char *file, const char *func, int line, const char *key) { sofia_profile_t *profile; diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 6b90b77..d22c79a 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1179,20 +1179,13 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand switch_find_local_ip(guess_ip4, sizeof(guess_ip4), NULL, AF_INET); if (profile->reg_db_domain) { - sofia_profile_t *xprofile; - - if ((xprofile = sofia_glue_find_profile(to_host))) { - sofia_glue_release_profile(xprofile); - } else { - + if (!sofia_glue_profile_exists(to_host)) { if (sofia_glue_add_profile(switch_core_strdup(profile->pool, to_host), profile) == SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Auto-Adding Alias [%s] for profile [%s]\n", to_host, profile->name); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Alias [%s] for profile [%s] (already exists)\n", to_host, profile->name); } - - } } commit 4fbef45522f4346f31452ba18eb50212003301e8 Author: Moises Silva <moy@sangoma.com> Date: Fri Sep 3 13:30:51 2010 -0400 freetdm: set default hangup cause to normal clearing diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 37946fc..ca00cdc 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2016,6 +2016,7 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_hangup_with_cause(const char *file, FT_DECLARE(ftdm_status_t) _ftdm_channel_call_hangup(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan) { ftdm_channel_lock(ftdmchan); + ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_CLEARING; call_hangup(ftdmchan, file, func, line); ftdm_channel_unlock(ftdmchan); return FTDM_SUCCESS; commit b762a0aa7f2cfa24889cc308680d97a672591e0d Author: Mathieu Parent <math.parent@gmail.com> Date: Fri Sep 3 19:08:41 2010 +0200 Skinny: block socket to decrease CPU usage non-blocking mode can still be used by setting MOD_SKINNY_NONBLOCK diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index 5da1367..cbeae6c 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -1391,9 +1391,13 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) switch_assert(listener != NULL); +#if MOD_SKINNY_NONBLOCK switch_socket_opt_set(listener->sock, SWITCH_SO_TCP_NODELAY, TRUE); switch_socket_opt_set(listener->sock, SWITCH_SO_NONBLOCK, TRUE); - +#else + switch_socket_opt_set(listener->sock, SWITCH_SO_NONBLOCK, FALSE); + switch_socket_timeout_set(listener->sock, 5000000); +#endif if (listener->profile->debug > 0) { if (zstr(listener->remote_ip)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connection Open\n"); @@ -1402,7 +1406,6 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) } } - switch_socket_opt_set(listener->sock, SWITCH_SO_NONBLOCK, TRUE); switch_set_flag_locked(listener, LFLAG_RUNNING); keepalive_listener(listener, NULL); add_listener(listener); @@ -1413,8 +1416,6 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) if (status != SWITCH_STATUS_SUCCESS) { switch(status) { - case SWITCH_STATUS_BREAK: - break; case SWITCH_STATUS_TIMEOUT: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Communication Time Out with %s:%d.\n", listener->remote_ip, listener->remote_port); diff --git a/src/mod/endpoints/mod_skinny/skinny_protocol.c b/src/mod/endpoints/mod_skinny/skinny_protocol.c index 28699b9..c519dc4 100644 --- a/src/mod/endpoints/mod_skinny/skinny_protocol.c +++ b/src/mod/endpoints/mod_skinny/skinny_protocol.c @@ -118,10 +118,6 @@ switch_status_t skinny_read_packet(listener_t *listener, skinny_message_t **req) return SWITCH_STATUS_MEMERR; } - if (!listener_is_ready(listener)) { - return SWITCH_STATUS_BREAK; - } - ptr = mbuf; while (listener_is_ready(listener)) { @@ -137,10 +133,10 @@ switch_status_t skinny_read_packet(listener_t *listener, skinny_message_t **req) status = switch_socket_recv(listener->sock, ptr, &mlen); if (!listener_is_ready(listener)) { - return SWITCH_STATUS_BREAK; + break; } - if (!SWITCH_STATUS_IS_BREAK(status) && status != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Socket break.\n"); + if ((status != 70007 /* APR_TIMEUP */) && !SWITCH_STATUS_IS_BREAK(status) && (status != SWITCH_STATUS_SUCCESS)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Socket break with status=%d.\n", status); return SWITCH_STATUS_FALSE; } commit 66e166d3e2f295668422cdfa970a9cff2f87b69b Author: Konrad Hammel <konrad@sangoma.com> Date: Fri Sep 3 11:21:40 2010 -0400 freetdm: bug fix, when changing states from RING to PROGRESS/MEDIA to UP, we need to check each time for TERMINATING state since set_state function needs to unlock to allow sig mod to handle the state change diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index dcb74d9..37946fc 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -1942,7 +1942,7 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_answer(const char *file, const char ftdm_channel_lock(ftdmchan); if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call is already terminating\n"); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call is already TERMINATING\n"); goto done; } @@ -1954,14 +1954,27 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_answer(const char *file, const char goto done; } + if (ftdmchan->state < FTDM_CHANNEL_STATE_PROGRESS) { ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS, 1); } + /* set state unlocks the channel so we need to re-confirm that the channel hasn't gone to hell */ + if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call has moved to TERMINATING while we're moving to PROGRESS\n"); + goto done; + } + if (ftdmchan->state < FTDM_CHANNEL_STATE_PROGRESS_MEDIA) { ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, 1); } + /* set state unlocks the channel so we need to re-confirm that the channel hasn't gone to hell */ + if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call has moved to TERMINATING while we're moving to UP\n"); + goto done; + } + ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_UP, 1); done: @@ -2076,8 +2089,13 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_indicate(const char *file, const ch { ftdm_status_t status = FTDM_SUCCESS; ftdm_channel_lock(ftdmchan); - switch (indication) { + if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call has moved to TERMINATING while we're moving to PROGRESS\n"); + goto done; + } + + switch (indication) { /* FIXME: ring and busy cannot be used with all signaling stacks * (particularly isdn stacks I think, we should emulate or just move to hangup with busy cause) */ case FTDM_CHANNEL_INDICATE_RING: @@ -2104,6 +2122,13 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_indicate(const char *file, const ch if (ftdmchan->state < FTDM_CHANNEL_STATE_PROGRESS) { ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS, 1); } + + /* set state unlocks the channel so we need to re-confirm that the channel hasn't gone to hell */ + if (ftdmchan->state == FTDM_CHANNEL_STATE_TERMINATING) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring answer because the call has moved to TERMINATING while we're moving to PROGRESS\n"); + goto done; + } + ftdm_channel_set_state(file, func, line, ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, 1); } break; @@ -2114,6 +2139,7 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_indicate(const char *file, const ch break; } +done: ftdm_channel_unlock(ftdmchan); return FTDM_SUCCESS; commit 772a3f815a66f9d9affd7111bbef4befd00c2d72 Author: Konrad Hammel <konrad@sangoma.com> Date: Fri Sep 3 10:33:13 2010 -0400 freetdm: ss7 - more work on glare handling diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index 7f70cb7..f0cfa02 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -78,8 +78,8 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ { SS7_FUNC_TRACE_ENTER(__FUNCTION__); - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { @@ -121,14 +121,14 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ /* check whether the ftdm channel is in a state to accept a call */ switch (ftdmchan->state) { /**************************************************************************/ - case (FTDM_CHANNEL_STATE_DOWN): /* only state it is fully valid to get IAM */ + case (FTDM_CHANNEL_STATE_DOWN): /* only state it is valid to get IAM (except if there is glare */ - /* fill in the channels SS7 Stack information */ - sngss7_info->suInstId = get_unique_id(); - sngss7_info->spInstId = spInstId; - - /* try to open the ftdm channel */ - if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { + /* check if there is any reason why we can't use this channel */ + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)) { + /* channel is already requested for use by the ftdm core */ + goto handle_glare; + } else if(ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { + /* channel is not inuse but we can't open it...fail the call */ SS7_ERROR("Failed to open span: %d, chan: %d\n", ftdmchan->physical_span_id, ftdmchan->physical_chan_id); @@ -143,6 +143,10 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ } else { + /* fill in the channels SS7 Stack information */ + sngss7_info->suInstId = get_unique_id(); + sngss7_info->spInstId = spInstId; + /* fill in calling party information */ if (siConEvnt->cgPtyNum.eh.pres) { if (siConEvnt->cgPtyNum.addrSig.pres) { @@ -211,7 +215,7 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ /* set the state of the channel to collecting...the rest is done by the chan monitor */ ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); - } /* if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) */ + } /* if (channel is usable */ break; /**************************************************************************/ @@ -219,8 +223,11 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ case (FTDM_CHANNEL_STATE_TERMINATING): case (FTDM_CHANNEL_STATE_HANGUP): case (FTDM_CHANNEL_STATE_HANGUP_COMPLETE): - - SS7_INFO_CHAN(ftdmchan, "Got IAM on channel in %s state...glare!\n", ftdm_channel_state2str (ftdmchan->state)); +handle_glare: + /* the core already has plans for this channel...glare */ + SS7_INFO_CHAN(ftdmchan, "Got IAM on channel that is already inuse (state=%s|inuse=%d)...glare!\n", + ftdm_channel_state2str (ftdmchan->state), + ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)); /* save the info so that we can use it later on */ sngss7_info->glare.spInstId = spInstId; @@ -239,8 +246,7 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ /* move the state of the channel to Terminating to end the call */ ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - } - + } /* if (!(sngss7_test_flag(sngss7_info, FLAG_GLARE))) */ break; /**************************************************************************/ default: /* should not have gotten an IAM while in this state */ commit 09a8f6b19af9b444f84b197b4e4c8fe402b1d556 Merge: cc722c6 ceddc5b Author: David Yat Sin <dyatsin@sangoma.com> Date: Fri Sep 3 12:34:25 2010 -0400 Merge branch 'master' of homer:smg_freeswitch into davidy_test commit a8ad3da74e626177159bb81e0272ea5f767b0dd0 Author: Mathieu Rene <mrene@avgs.ca> Date: Fri Sep 3 00:36:42 2010 -0400 switch_dir_next_file() should also match symlinks diff --git a/src/switch_apr.c b/src/switch_apr.c index ba44ad2..bdff179 100644 --- a/src/switch_apr.c +++ b/src/switch_apr.c @@ -574,7 +574,7 @@ SWITCH_DECLARE(const char *) switch_dir_next_file(switch_dir_t *thedir, char *bu while (apr_dir_read(&(thedir->finfo), finfo_flags, thedir->dir_handle) == SWITCH_STATUS_SUCCESS) { - if (thedir->finfo.filetype != APR_REG) { + if (thedir->finfo.filetype != APR_REG && thedir->finfo.filetype != APR_LNK) { continue; } commit ceddc5b84fd9241df8ec725b07a4c8cf708ff301 Merge: 01d839e a5cd2df Author: Moises Silva <moy@sangoma.com> Date: Thu Sep 2 18:46:22 2010 -0400 Merge branch 'master' of git://git.freeswitch.org/freeswitch commit 01d839eb64410908dcb7d4e2a913664b4b849608 Author: Konrad Hammel <konrad@sangoma.com> Date: Thu Sep 2 18:19:38 2010 -0400 freetdm: ss7 - implmented queuing of sigevents to ftdmcore diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index 99b9fe9..7f70cb7 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -205,6 +205,9 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ SS7_DEBUG_CHAN(ftdmchan,"No TMR/Bearer Cap information in IAM!%s\n", " "); } + /* add any special variables for the dialplan */ + /*ftdm_channel_add_var(ftdmchan, "ss7_stuff", "s");*/ + /* set the state of the channel to collecting...the rest is done by the chan monitor */ ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index 6d31ac5..66efe1a 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -322,6 +322,9 @@ static void *ftdm_sangoma_ss7_run(ftdm_thread_t * me, void *obj) ftdm_safe_free(sngss7_event); }/* while ((sngss7_event = ftdm_queue_dequeue(ftdmspan->signal_data->event_queue))) */ + /* signal the core that sig events are queued for processing */ + ftdm_span_trigger_signals(ftdmspan); + break; /**********************************************************************/ case FTDM_TIMEOUT: @@ -512,10 +515,9 @@ static void ftdm_sangoma_ss7_process_stack_event (sngss7_event_data_t *sngss7_ev /******************************************************************************/ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) { - ftdm_sigmsg_t sigev; - ftdm_signaling_status_t status; - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - int i = 0; + ftdm_sigmsg_t sigev; + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + int i = 0; memset (&sigev, 0, sizeof (sigev)); @@ -848,9 +850,8 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) if (!ftdm_test_flag (ftdmchan, FTDM_CHANNEL_SIG_UP)) { SS7_DEBUG_CHAN(ftdmchan,"All reset flags cleared %s\n", ""); /* all flags are down so we can bring up the sig status */ - status = FTDM_SIG_STATE_UP; sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.raw_data = &status; + sigev.sigstatus = FTDM_SIG_STATE_UP; ftdm_span_send_signal (ftdmchan->span, &sigev); } } else { @@ -952,9 +953,8 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /* if the sig_status is up...bring it down */ if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_SIG_UP)) { - status = FTDM_SIG_STATE_DOWN; sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.raw_data = &status; + sigev.sigstatus = FTDM_SIG_STATE_DOWN; ftdm_span_send_signal (ftdmchan->span, &sigev); } @@ -1016,9 +1016,8 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) SS7_DEBUG_CHAN(ftdmchan, "Processing PAUSE flag %s\n", ""); /* bring the channel signaling status to down */ - status = FTDM_SIG_STATE_DOWN; sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.raw_data = &status; + sigev.sigstatus = FTDM_SIG_STATE_DOWN; ftdm_span_send_signal (ftdmchan->span, &sigev); /* check the last state and return to it to allow the call to finish */ @@ -1113,9 +1112,8 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_UCIC_BLOCK flag %s\n", ""); /* bring the channel signaling status to down */ - status = FTDM_SIG_STATE_DOWN; sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.raw_data = &status; + sigev.sigstatus = FTDM_SIG_STATE_DOWN; ftdm_span_send_signal (ftdmchan->span, &sigev); /* remove any reset flags */ @@ -1420,7 +1418,10 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_ss7_span_config) span->state_map = &sangoma_ss7_state_map; span->mod_data = ss7_span_info; + /* set the flag to indicate that this span uses channel state change queues */ ftdm_set_flag (span, FTDM_SPAN_USE_CHAN_QUEUE); + /* set the flag to indicate that this span uses sig event queues */ + ftdm_set_flag (span, FTDM_SPAN_USE_SIGNALS_QUEUE); /* parse the configuration and apply to the global config structure */ if (ftmod_ss7_parse_xml(ftdm_parameters, span)) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index 28ff6bd..4fac251 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -60,9 +60,10 @@ void ft_to_sngss7_lpa (ftdm_channel_t * ftdmchan); void ft_to_sngss7_gra (ftdm_channel_t * ftdmchan); void ft_to_sngss7_grs (ftdm_channel_t * ftdmchan); +/******************************************************************************/ + /* FUNCTIONS ******************************************************************/ -void -ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) +void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) { SS7_FUNC_TRACE_ENTER (__FUNCTION__); @@ -133,7 +134,6 @@ ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) } /******************************************************************************/ - void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan) { SS7_FUNC_TRACE_ENTER (__FUNCTION__); commit a5cd2df89a99ce4cce16499a272be108c6b094b4 Author: Mathieu Parent <math.parent@gmail.com> Date: Fri Sep 3 00:06:50 2010 +0200 Skinny: Handle network-address-change trap event - add auto-restart param to each profile (if true, ip is automaticaly changed) - some cleaning (unused args in flush_listener, better logs) diff --git a/conf/skinny_profiles/internal.xml b/conf/skinny_profiles/internal.xml index eaa493c..e48557b 100644 --- a/conf/skinny_profiles/internal.xml +++ b/conf/skinny_profiles/internal.xml @@ -11,6 +11,7 @@ <param name="date-format" value="D/M/Y"/> <param name="odbc-dsn" value=""/> <param name="debug" value="4"/> + <param name="auto-restart" value="true"/> </settings> <device-types> <device-type id="Cisco ATA 186"> diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index 9ee9e1e..5da1367 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -121,6 +121,7 @@ switch_status_t skinny_profile_dump(const skinny_profile_t *profile, switch_stre stream->write_function(stream, "Date-Format \t%s\n", profile->date_format); stream->write_function(stream, "DBName \t%s\n", profile->dbname ? profile->dbname : switch_str_nil(profile->odbc_dsn)); stream->write_function(stream, "Debug \t%d\n", profile->debug); + stream->write_function(stream, "Auto-Restart \t%d\n", profile->auto_restart); /* stats */ stream->write_function(stream, "CALLS-IN \t%d\n", profile->ib_calls); stream->write_function(stream, "FAILED-CALLS-IN \t%d\n", profile->ib_failed_calls); @@ -1187,7 +1188,8 @@ uint8_t listener_is_ready(listener_t *listener) && listener && listener->sock && switch_test_flag(listener, LFLAG_RUNNING) - && listener->profile->listener_ready; + && switch_test_flag(listener->profile, PFLAG_LISTENER_READY) + && !switch_test_flag(listener->profile, PFLAG_RESPAWN); } static void add_listener(listener_t *listener) @@ -1248,7 +1250,7 @@ static void walk_listeners(skinny_listener_callback_func_t callback, void *pvt) switch_mutex_unlock(globals.mutex); } -static void flush_listener(listener_t *listener, switch_bool_t flush_log, switch_bool_t flush_events) +static void flush_listener(listener_t *listener) { if(!zstr(listener->device_name)) { @@ -1410,7 +1412,17 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) status = skinny_read_packet(listener, &request); if (status != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Socket Error!\n"); + switch(status) { + case SWITCH_STATUS_BREAK: + break; + case SWITCH_STATUS_TIMEOUT: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Communication Time Out with %s:%d.\n", + listener->remote_ip, listener->remote_port); + break; + default: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Communication Error with %s:%d.\n", + listener->remote_ip, listener->remote_port); + } switch_clear_flag_locked(listener, LFLAG_RUNNING); break; } @@ -1432,11 +1444,12 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) remove_listener(listener); if (listener->profile->debug > 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Session complete, waiting for children\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Communication Complete with %s:%d.\n", + listener->remote_ip, listener->remote_port); } switch_thread_rwlock_wrlock(listener->rwlock); - flush_listener(listener, SWITCH_TRUE, SWITCH_TRUE); + flush_listener(listener); if (listener->sock) { close_socket(&listener->sock, profile); @@ -1445,19 +1458,10 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) switch_thread_rwlock_unlock(listener->rwlock); if (listener->profile->debug > 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connection Closed\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Communication Closed with %s:%d.\n", + listener->remote_ip, listener->remote_port); } - /* TODO - for(int line = 0 ; line < SKINNY_MAX_BUTTON_COUNT ; line++) { - if(listener->session[line]) { - switch_channel_clear_flag(switch_core_session_get_channel(listener->session[line]), CF_CONTROLLED); - //TODO switch_clear_flag_locked(listener, LFLAG_SESSION); - switch_core_session_rwunlock(listener->session[line]); - destroy_pool = 0; - } - } - */ if(destroy_pool == 0) { goto no_destroy_pool; } @@ -1502,6 +1506,7 @@ static void *SWITCH_THREAD_FUNC skinny_profile_run(switch_thread_t *thread, void return NULL; } +new_socket: while(globals.running) { rv = switch_sockaddr_info_get(&sa, profile->ip, SWITCH_INET, profile->port, 0, tmp_pool); if (rv) @@ -1526,7 +1531,7 @@ static void *SWITCH_THREAD_FUNC skinny_profile_run(switch_thread_t *thread, void switch_yield(100000); } - profile->listener_ready = 1; + switch_set_flag_locked(profile, PFLAG_LISTENER_READY); while(globals.running) { @@ -1539,6 +1544,10 @@ static void *SWITCH_THREAD_FUNC skinny_profile_run(switch_thread_t *thread, void if (!globals.running) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Shutting Down\n"); goto end; + } else if (switch_test_flag(profile, PFLAG_RESPAWN)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Creating a new socket\n"); + switch_clear_flag_locked(profile, PFLAG_RESPAWN); + goto new_socket; } else { /* I wish we could use strerror_r here but its not defined everywhere =/ */ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error [%s]\n", strerror(errno)); @@ -1590,6 +1599,17 @@ static void *SWITCH_THREAD_FUNC skinny_profile_run(switch_thread_t *thread, void return NULL; } + +void launch_skinny_profile_thread(skinny_profile_t *profile) { + switch_thread_t *thread; + switch_threadattr_t *thd_attr = NULL; + + switch_threadattr_create(&thd_attr, profile->pool); + switch_threadattr_detach_set(thd_attr, 1); + switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); + switch_thread_create(&thread, thd_attr, skinny_profile_run, profile, profile->pool); +} + /*****************************************************************************/ /* MODULE FUNCTIONS */ /*****************************************************************************/ @@ -1603,9 +1623,9 @@ switch_status_t skinny_profile_set(skinny_profile_t *profile, const char *var, c if (!var) return SWITCH_STATUS_FALSE; - if (profile->sock && (!strcasecmp(var, "ip") || !strcasecmp(var, "port") || !strcasecmp(var, "odbc-dsn"))) { + if (profile->sock && !strcasecmp(var, "odbc-dsn")) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Skinny profile settings 'ip', 'port' and 'odbc-dsn' can't be changed while running\n"); + "Skinny profile setting 'odbc-dsn' can't be changed while running\n"); return SWITCH_STATUS_FALSE; } @@ -1643,9 +1663,17 @@ switch_status_t skinny_profile_set(skinny_profile_t *profile, const char *var, c } } else if (!strcasecmp(var, "debug")) { profile->debug = atoi(val); + } else if (!strcasecmp(var, "auto-restart")) { + profile->auto_restart = switch_true(val); } else { return SWITCH_STATUS_FALSE; } + if (profile->sock && (!strcasecmp(var, "ip") || !strcasecmp(var, "port"))) { + switch_set_flag_locked(profile, PFLAG_RESPAWN); + switch_clear_flag_locked(profile, PFLAG_LISTENER_READY); + close_socket(&profile->sock, profile); + } + return SWITCH_STATUS_SUCCESS; } @@ -1684,9 +1712,11 @@ static switch_status_t load_skinny_config(void) profile = switch_core_alloc(profile_pool, sizeof(skinny_profile_t)); profile->pool = profile_pool; profile->name = switch_core_strdup(profile->pool, profile_name); - switch_mutex_init(&profile->listener_mutex, SWITCH_MUTEX_NESTED, profile->pool); + profile->auto_restart = SWITCH_TRUE; switch_mutex_init(&profile->sql_mutex, SWITCH_MUTEX_NESTED, profile->pool); + switch_mutex_init(&profile->listener_mutex, SWITCH_MUTEX_NESTED, profile->pool); switch_mutex_init(&profile->sock_mutex, SWITCH_MUTEX_NESTED, profile->pool); + switch_mutex_init(&profile->flag_mutex, SWITCH_MUTEX_NESTED, profile->pool); for (param = switch_xml_child(xsettings, "param"); param; param = param->next) { char *var = (char *) switch_xml_attr_soft(param, "name"); @@ -1950,6 +1980,41 @@ static void skinny_message_waiting_event_handler(switch_event_t *event) } +static void skinny_trap_event_handler(switch_event_t *event) +{ + const char *cond = switch_event_get_header(event, "condition"); + + + if (cond && !strcmp(cond, "network-address-change") && globals.auto_restart) { + const char *old_ip4 = switch_event_get_header_nil(event, "network-address-previous-v4"); + const char *new_ip4 = switch_event_get_header_nil(event, "network-address-change-v4"); + const char *old_ip6 = switch_event_get_header_nil(event, "network-address-previous-v6"); + const char *new_ip6 = switch_event_get_header_nil(event, "network-address-change-v6"); + switch_hash_index_t *hi; + const void *var; + void *val; + skinny_profile_t *profile; + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "EVENT_TRAP: IP change detected\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "IP change detected [%s]->[%s] [%s]->[%s]\n", old_ip4, new_ip4, old_ip6, new_ip6); + + switch_mutex_lock(globals.mutex); + if (globals.profile_hash) { + for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) { + switch_hash_this(hi, &var, NULL, &val); + if ((profile = (skinny_profile_t *) val) && profile->auto_restart) { + if (!strcmp(profile->ip, old_ip4)) { + skinny_profile_set(profile, "ip", new_ip4); + } else if (!strcmp(profile->ip, old_ip6)) { + skinny_profile_set(profile, "ip", new_ip6); + } + } + } + } + switch_mutex_unlock(globals.mutex); + } + +} /*****************************************************************************/ SWITCH_MODULE_LOAD_FUNCTION(mod_skinny_load) { @@ -1964,6 +2029,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skinny_load) switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool); switch_core_hash_init(&globals.profile_hash, globals.pool); globals.running = 1; + globals.auto_restart = SWITCH_TRUE; load_skinny_config(); @@ -1980,6 +2046,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skinny_load) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind our message waiting handler!\n"); /* Not such severe to prevent loading */ } + if ((switch_event_bind_removable(modname, SWITCH_EVENT_TRAP, NULL, skinny_trap_event_handler, NULL, &globals.trap_node) != SWITCH_STATUS_SUCCESS)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind our trap handler!\n"); + /* Not such severe to prevent loading */ + } /* reserve events */ if (switch_event_reserve_subclass(SKINNY_EVENT_REGISTER) != SWITCH_STATUS_SUCCESS) { @@ -2017,16 +2087,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_skinny_load) for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) { void *val; skinny_profile_t *profile; - switch_thread_t *thread; - switch_threadattr_t *thd_attr = NULL; switch_hash_this(hi, NULL, NULL, &val); profile = (skinny_profile_t *) val; - - switch_threadattr_create(&thd_attr, profile->pool); - switch_threadattr_detach_set(thd_attr, 1); - switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); - switch_thread_create(&thread, thd_attr, skinny_profile_run, profile, profile->pool); + + launch_skinny_profile_thread(profile); } switch_mutex_unlock(globals.mutex); @@ -2048,6 +2113,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_skinny_shutdown) switch_event_unbind(&globals.heartbeat_node); switch_event_unbind(&globals.call_state_node); switch_event_unbind(&globals.message_waiting_node); + switch_event_unbind(&globals.trap_node); switch_event_free_subclass(SKINNY_EVENT_REGISTER); switch_event_free_subclass(SKINNY_EVENT_UNREGISTER); switch_event_free_subclass(SKINNY_EVENT_EXPIRE); diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.h b/src/mod/endpoints/mod_skinny/mod_skinny.h index 41b9b72..f52f171 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.h +++ b/src/mod/endpoints/mod_skinny/mod_skinny.h @@ -52,11 +52,18 @@ struct skinny_globals { switch_event_node_t *heartbeat_node; switch_event_node_t *call_state_node; switch_event_node_t *message_waiting_node; + switch_event_node_t *trap_node; + int auto_restart; }; typedef struct skinny_globals skinny_globals_t; extern skinny_globals_t globals; +typedef enum { + PFLAG_LISTENER_READY = (1 << 0), + PFLAG_RESPAWN = (1 << 1), +} profile_flag_t; + struct skinny_profile { /* prefs */ char *name; @@ -70,6 +77,7 @@ struct skinny_profile { uint32_t keep_alive; char date_format[6]; int debug; + int auto_restart; switch_hash_t *device_type_params_hash; /* db */ char *dbname; @@ -89,7 +97,8 @@ struct skinny_profile { switch_socket_t *sock; switch_mutex_t *sock_mutex; struct listener *listeners; - uint8_t listener_ready; + int flags; + switch_mutex_t *flag_mutex; /* call id */ uint32_t next_call_id; /* others */ @@ -114,7 +123,7 @@ typedef enum { typedef enum { LFLAG_RUNNING = (1 << 0), -} event_flag_t; +} listener_flag_t; #define SKINNY_MAX_LINES 42 struct listener { diff --git a/src/mod/endpoints/mod_skinny/skinny_api.c b/src/mod/endpoints/mod_skinny/skinny_api.c index 0ef0beb..86eea74 100644 --- a/src/mod/endpoints/mod_skinny/skinny_api.c +++ b/src/mod/endpoints/mod_skinny/skinny_api.c @@ -230,6 +230,7 @@ static switch_status_t skinny_api_list_settings(const char *line, const char *cu switch_console_push_match(&my_matches, "date-format"); switch_console_push_match(&my_matches, "odbc-dsn"); switch_console_push_match(&my_matches, "debug"); + switch_console_push_match(&my_matches, "auto-restart"); if (my_matches) { *matches = my_matches; diff --git a/src/mod/endpoints/mod_skinny/skinny_protocol.c b/src/mod/endpoints/mod_skinny/skinny_protocol.c index ba4cba7..28699b9 100644 --- a/src/mod/endpoints/mod_skinny/skinny_protocol.c +++ b/src/mod/endpoints/mod_skinny/skinny_protocol.c @@ -119,7 +119,7 @@ switch_status_t skinny_read_packet(listener_t *listener, skinny_message_t **req) } if (!listener_is_ready(listener)) { - return SWITCH_STATUS_FALSE; + return SWITCH_STATUS_BREAK; } ptr = mbuf; @@ -136,7 +136,10 @@ switch_status_t skinny_read_packet(listener_t *listener, skinny_message_t **req) status = switch_socket_recv(listener->sock, ptr, &mlen); - if (!listener_is_ready(listener) || (!SWITCH_STATUS_IS_BREAK(status) && status != SWITCH_STATUS_SUCCESS)) { + if (!listener_is_ready(listener)) { + return SWITCH_STATUS_BREAK; + } + if (!SWITCH_STATUS_IS_BREAK(status) && status != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Socket break.\n"); return SWITCH_STATUS_FALSE; } @@ -167,20 +170,13 @@ switch_status_t skinny_read_packet(listener_t *listener, skinny_message_t **req) } if(bytes >= request->length + 2*SKINNY_MESSAGE_FIELD_SIZE) { /* Message body */ -#ifdef SKINNY_MEGA_DEBUG - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, - "Got complete request: length=%d,reserved=%x,type=%x,data=%d\n", - request->length,request->reserved,request->type,request->data.as_char); -#endif *req = request; return SWITCH_STATUS_SUCCESS; } } } if (listener->expire_time && listener->expire_time < switch_epoch_time_now(NULL)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Listener timed out.\n"); - switch_clear_flag_locked(listener, LFLAG_RUNNING); - return SWITCH_STATUS_FALSE; + return SWITCH_STATUS_TIMEOUT; } if (do_sleep) { switch_cond_next(); commit af3285ab61bca7fb5f8db1b53d53ddf3d4944bb0 Author: Konrad Hammel <konrad@sangoma.com> Date: Thu Sep 2 17:33:17 2010 -0400 freetdm: ss7 - added cli support to send GRS and RSC diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c index 7d0488c..edb1560 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c @@ -60,6 +60,9 @@ static ftdm_status_t handle_show_flags(ftdm_stream_handle_t *stream, int span, i static ftdm_status_t handle_show_blocks(ftdm_stream_handle_t *stream, int span, int chan, int verbose); static ftdm_status_t handle_show_status(ftdm_stream_handle_t *stream, int span, int chan, int verbose); +static ftdm_status_t handle_tx_rsc(ftdm_stream_handle_t *stream, int span, int chan, int verbose); +static ftdm_status_t handle_tx_grs(ftdm_stream_handle_t *stream, int span, int chan, int range, int verbose); + static ftdm_status_t handle_status_link(ftdm_stream_handle_t *stream, char *name); static ftdm_status_t handle_status_linkset(ftdm_stream_handle_t *stream, char *name); @@ -72,13 +75,14 @@ ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const cha { char *mycmd = NULL; char *argv[10] = { 0 }; - int argc = 0; - int span = 0; - int chan = 0; - int trace = 0; - int trace_level = 7; - int verbose = 1; - int c = 0; + int argc = 0; + int span = 0; + int chan = 0; + int range = 0; + int trace = 0; + int trace_level = 7; + int verbose = 1; + int c = 0; if (data) { mycmd = ftdm_strdup(data); @@ -332,6 +336,61 @@ ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const cha /**********************************************************************/ } /**************************************************************************/ + } else if (!strcasecmp(argv[c], "rsc")) { + /**************************************************************************/ + if (check_arg_count(argc, 2)) goto handle_cli_error_argc; + c++; + + if (!strcasecmp(argv[c], "span")) { + /**********************************************************************/ + if (check_arg_count(argc, 5)) goto handle_cli_error_argc; + + if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; + + handle_tx_rsc(stream, span, chan, verbose); + /**********************************************************************/ + } else { + /**********************************************************************/ + stream->write_function(stream, "Unknown \"rsc\" command\n"); + goto handle_cli_error; + /**********************************************************************/ + } + /**************************************************************************/ + } else if (!strcasecmp(argv[c], "grs")) { + /**************************************************************************/ + if (check_arg_count(argc, 2)) goto handle_cli_error_argc; + c++; + + if (!strcasecmp(argv[c], "span")) { + /**********************************************************************/ + if (check_arg_count(argc, 5)) goto handle_cli_error_argc; + + if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; + c = c + 4; + + if (check_arg_count(argc, 7)) goto handle_cli_error_argc; + + if (!strcasecmp(argv[c], "range")) { + /******************************************************************/ + c++; + range = atoi(argv[c]); + /******************************************************************/ + } else { + /******************************************************************/ + stream->write_function(stream, "Unknown \"grs range\" command\n"); + goto handle_cli_error; + /******************************************************************/ + } + + handle_tx_grs(stream, span, chan, range, verbose); + /**********************************************************************/ + } else { + /**********************************************************************/ + stream->write_function(stream, "Unknown \"grs\" command\n"); + goto handle_cli_error; + /**********************************************************************/ + } + /**************************************************************************/ } else { /**************************************************************************/ goto handle_cli_error; @@ -376,6 +435,8 @@ static ftdm_status_t handle_print_usuage(ftdm_stream_handle_t *stream) stream->write_function(stream, "Ftmod_sangoma_ss7 circuit control:\n"); stream->write_function(stream, "ftdm ss7 block span X chan Y\n"); stream->write_function(stream, "ftdm ss7 unblk span X chan Y\n"); + stream->write_function(stream, "ftdm ss7 rsc span X chan Y\n"); + stream->write_function(stream, "ftdm ss7 grs span X chan Y range Z\n"); stream->write_function(stream, "\n"); return FTDM_SUCCESS; @@ -1091,6 +1152,125 @@ static ftdm_status_t handle_set_uninhibit(ftdm_stream_handle_t *stream, char *na } /******************************************************************************/ +static ftdm_status_t handle_tx_rsc(ftdm_stream_handle_t *stream, int span, int chan, int verbose) +{ + int x; + sngss7_chan_data_t *ss7_info; + ftdm_channel_t *ftdmchan; + int lspan; + int lchan; + + x=1; + while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { + if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) { + ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; + ftdmchan = ss7_info->ftdmchan; + + /* if span == 0 then all spans should be printed */ + if (span == 0) { + lspan = ftdmchan->physical_span_id; + } else { + lspan = span; + } + + /* if chan == 0 then all chans should be printed */ + if (chan == 0) { + lchan = ftdmchan->physical_chan_id; + } else { + lchan = chan; + } + + if ((ftdmchan->physical_span_id == lspan) && (ftdmchan->physical_chan_id == lchan)) { + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* check if there is a pending state change|give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", ss7_info->circuit->cic); + SS7_ASSERT; + } else { + /* throw the ckt block flag */ + sngss7_set_flag(ss7_info, FLAG_RESET_TX); + + /* set the channel to suspended state */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + } + + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); + + } /* if ( span and chan) */ + + } /* if ( cic != 0) */ + + /* go the next circuit */ + x++; + } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ + + + return FTDM_SUCCESS; +} + +/******************************************************************************/ +static ftdm_status_t handle_tx_grs(ftdm_stream_handle_t *stream, int span, int chan, int range, int verbose) +{ + int x; + sngss7_chan_data_t *sngss7_info; + ftdm_channel_t *ftdmchan; + sngss7_span_data_t *sngss7_span; + + if (range > 31) { + stream->write_function(stream, "Invalid range value %d", range); + return FTDM_SUCCESS; + } + + x=1; + while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { + if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) { + + sngss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; + ftdmchan = sngss7_info->ftdmchan; + sngss7_span = ftdmchan->span->mod_data; + + if ((ftdmchan->physical_span_id == span) && + ((ftdmchan->physical_chan_id >= chan) && (ftdmchan->physical_chan_id < (chan+range)))) { + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* check if there is a pending state change|give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + SS7_ASSERT; + } else { + /* throw the grp reset flag */ + sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX); + if (ftdmchan->physical_chan_id == chan) { + sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_BASE); + sngss7_span->tx_grs.circuit = sngss7_info->circuit->id; + sngss7_span->tx_grs.range = range-1; + } + + /* set the channel to suspended state */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + + } + + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); + + } /* if ( span and chan) */ + + } /* if ( cic != 0) */ + + /* go the next circuit */ + x++; + } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ + + + return FTDM_SUCCESS; +} + +/******************************************************************************/ static ftdm_status_t extract_span_chan(char *argv[10], int pos, int *span, int *chan) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index a9735c9..99b9fe9 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -99,7 +99,7 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ SS7_ASSERT; }; - if (sngss7_info->glare.spInstId > 0) { + if (sngss7_test_flag(sngss7_info, FLAG_GLARE)) { SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx IAM (glare detected on circuit)\n"); } else { SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx IAM\n"); @@ -569,10 +569,6 @@ ftdm_status_t handle_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ /**************************************************************************/ default: - /* fill in the channels SS7 Stack information */ - sngss7_info->suInstId = get_unique_id(); - sngss7_info->spInstId = spInstId; - /* throw the reset flag */ sngss7_set_flag(sngss7_info, FLAG_RESET_RX); @@ -1685,9 +1681,9 @@ ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ { SS7_FUNC_TRACE_ENTER(__FUNCTION__); - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - sngss7_span_data_t *span = NULL; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + sngss7_span_data_t *sngss7_span = NULL; int range; int x; @@ -1725,11 +1721,11 @@ ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ }; /* fill in the span structure for this circuit */ - span = ftdmchan->span->mod_data; - span->grs.circuit = circuit; - span->grs.range = range; + sngss7_span = ftdmchan->span->mod_data; + sngss7_span->rx_grs.circuit = circuit; + sngss7_span->rx_grs.range = range; - SS7_DEBUG_CHAN(ftdmchan, "Rx GRS (%d:%d)\n", + SS7_INFO_CHAN(ftdmchan, "Rx GRS (%d:%d)\n", g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, (g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic + range)); @@ -1800,7 +1796,7 @@ ftdm_status_t handle_grs_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ SS7_ASSERT; }; - SS7_DEBUG_CHAN(ftdmchan, "Rx GRA (%d:%d)\n", + SS7_INFO_CHAN(ftdmchan, "Rx GRA (%d:%d)\n", g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, (g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic + range)); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index da90d34..6d31ac5 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -345,12 +345,12 @@ static void *ftdm_sangoma_ss7_run(ftdm_thread_t * me, void *obj) sngss7_span = (sngss7_span_data_t *)ftdmspan->mod_data; /* check if there is a GRS being processed on the span */ - if (sngss7_span->grs.range > 0) { + if (sngss7_span->rx_grs.range > 0) { ftdm_log(FTDM_LOG_DEBUG, "Found Rx GRS on span %d...checking circuits\n", ftdmspan->span_id); /*SS7_DEBUG("Found Rx GRS on span %d...checking circuits\n", ftdmspan->span_id);*/ /* check all the circuits in the range to see if they are done resetting */ - for ( i = sngss7_span->grs.circuit; i < (sngss7_span->grs.circuit + sngss7_span->grs.range + 1); i++) { + for ( i = sngss7_span->rx_grs.circuit; i < (sngss7_span->rx_grs.circuit + sngss7_span->rx_grs.range + 1); i++) { /* extract the channel in question */ if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { @@ -375,11 +375,11 @@ static void *ftdm_sangoma_ss7_run(ftdm_thread_t * me, void *obj) } /* for ( i = circuit; i < (circuit + range + 1); i++) */ SS7_DEBUG("All circuits out of reset for GRS: circuit=%d, range=%d\n", - sngss7_span->grs.circuit, - sngss7_span->grs.range); + sngss7_span->rx_grs.circuit, + sngss7_span->rx_grs.range); /* check all the circuits in the range to see if they are done resetting */ - for ( i = sngss7_span->grs.circuit; i < (sngss7_span->grs.circuit + sngss7_span->grs.range + 1); i++) { + for ( i = sngss7_span->rx_grs.circuit; i < (sngss7_span->rx_grs.circuit + sngss7_span->rx_grs.range + 1); i++) { /* extract the channel in question */ if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { @@ -396,7 +396,7 @@ static void *ftdm_sangoma_ss7_run(ftdm_thread_t * me, void *obj) } /* for ( i = circuit; i < (circuit + range + 1); i++) */ GRS_UNLOCK_ALL: - for ( i = sngss7_span->grs.circuit; i < (sngss7_span->grs.circuit + sngss7_span->grs.range + 1); i++) { + for ( i = sngss7_span->rx_grs.circuit; i < (sngss7_span->rx_grs.circuit + sngss7_span->rx_grs.range + 1); i++) { /* extract the channel in question */ if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", i); @@ -801,14 +801,14 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) * we insure that this is the last circuit to have the state change queued */ sngss7_span_data_t *span = ftdmchan->span->mod_data; - if (span->grs.circuit == sngss7_info->circuit->id) { + if (span->rx_grs.circuit == sngss7_info->circuit->id) { /* send out the GRA */ ft_to_sngss7_gra(ftdmchan); /* clean out the spans GRS structure */ sngss7_span_data_t *span = ftdmchan->span->mod_data; - span->grs.circuit = 0; - span->grs.range = 0; + span->rx_grs.circuit = 0; + span->rx_grs.range = 0; } /* clear the grp reset flag */ @@ -822,6 +822,7 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) if (sngss7_test_flag(sngss7_info, FLAG_RESET_TX_RSP)) { /* clear the reset flag */ sngss7_clear_flag(sngss7_info, FLAG_RESET_TX_RSP); + sngss7_clear_flag(sngss7_info, FLAG_RESET_SENT); sngss7_clear_flag(sngss7_info, FLAG_RESET_TX); } @@ -1295,6 +1296,7 @@ static ftdm_status_t ftdm_sangoma_ss7_start(ftdm_span_t * span) { ftdm_channel_t *ftdmchan = NULL; sngss7_chan_data_t *sngss7_info = NULL; + sngss7_span_data_t *sngss7_span = NULL; int x; @@ -1305,6 +1307,7 @@ static ftdm_status_t ftdm_sangoma_ss7_start(ftdm_span_t * span) /* extract the channel structure and sngss7 channel data */ ftdmchan = span->channels[x]; sngss7_info = ftdmchan->call_data; + sngss7_span = ftdmchan->span->mod_data; /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); @@ -1316,6 +1319,8 @@ static ftdm_status_t ftdm_sangoma_ss7_start(ftdm_span_t * span) sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX); if (x == 1) { sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_BASE); + sngss7_span->tx_grs.circuit = sngss7_info->circuit->id; + sngss7_span->tx_grs.range = span->chan_count -1; } /* throw the channel to suspend */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index 45cf495..050f59e 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -346,7 +346,8 @@ typedef struct sngss7_chan_data { typedef struct sngss7_span_data { ftdm_sched_t *sched; - sngss7_group_data_t grs; + sngss7_group_data_t rx_grs; + sngss7_group_data_t tx_grs; ftdm_queue_t *event_queue; }sngss7_span_data_t; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index 600a529..28ff6bd 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -415,7 +415,7 @@ void ft_to_sngss7_gra (ftdm_channel_t * ftdmchan) { SS7_FUNC_TRACE_ENTER (__FUNCTION__); - sngss7_span_data_t *span = ftdmchan->span->mod_data; + sngss7_span_data_t *sngss7_span = ftdmchan->span->mod_data; sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; SiStaEvnt gra; @@ -426,11 +426,11 @@ void ft_to_sngss7_gra (ftdm_channel_t * ftdmchan) /* fill in the range */ gra.rangStat.range.pres = PRSNT_NODEF; - gra.rangStat.range.val = span->grs.range; + gra.rangStat.range.val = sngss7_span->rx_grs.range; /* fill in the status */ gra.rangStat.status.pres = PRSNT_NODEF; - gra.rangStat.status.len = ((span->grs.range + 1) >> 3) + (((span->grs.range + 1) & 0x07) ? 1 : 0); + gra.rangStat.status.len = ((sngss7_span->rx_grs.range + 1) >> 3) + (((sngss7_span->rx_grs.range + 1) & 0x07) ? 1 : 0); /* the status field should be 1 if blocked for maintenace reasons * and 0 is not blocked....since we memset the struct nothing to do @@ -440,12 +440,14 @@ void ft_to_sngss7_gra (ftdm_channel_t * ftdmchan) sng_cc_sta_request (1, 0, 0, - span->grs.circuit, + sngss7_span->rx_grs.circuit, 0, SIT_STA_GRSRSP, &gra); - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx GRA\n"); + SS7_INFO_CHAN(ftdmchan, "Tx GRA (%d:%d)\n", + sngss7_info->circuit->cic, + (sngss7_info->circuit->cic + sngss7_span->rx_grs.range)); SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; @@ -454,31 +456,32 @@ void ft_to_sngss7_gra (ftdm_channel_t * ftdmchan) /******************************************************************************/ void ft_to_sngss7_grs (ftdm_channel_t * ftdmchan) { -SS7_FUNC_TRACE_ENTER (__FUNCTION__); - -sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; -ftdm_span_t *span = ftdmchan->span; - -SiStaEvnt grs; - -memset (&grs, 0x0, sizeof (grs)); - -grs.rangStat.eh.pres = PRSNT_NODEF; -grs.rangStat.range.pres = PRSNT_NODEF; -grs.rangStat.range.val = span->chan_count-1; - -sng_cc_sta_request (1, - 0, - 0, - sngss7_info->circuit->id, - 0, - SIT_STA_GRSREQ, - &grs); - - -SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx GRS\n"); - -SS7_FUNC_TRACE_EXIT (__FUNCTION__); + SS7_FUNC_TRACE_ENTER (__FUNCTION__); + + sngss7_span_data_t *sngss7_span = ftdmchan->span->mod_data; + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + + SiStaEvnt grs; + + memset (&grs, 0x0, sizeof (grs)); + + grs.rangStat.eh.pres = PRSNT_NODEF; + grs.rangStat.range.pres = PRSNT_NODEF; + grs.rangStat.range.val = sngss7_span->tx_grs.range; + + sng_cc_sta_request (1, + 0, + 0, + sngss7_span->tx_grs.circuit, + 0, + SIT_STA_GRSREQ, + &grs); + + SS7_INFO_CHAN(ftdmchan, "Tx GRS (%d:%d)\n", + sngss7_info->circuit->cic, + (sngss7_info->circuit->cic + sngss7_span->tx_grs.range)); + + SS7_FUNC_TRACE_EXIT (__FUNCTION__); return; } commit 70b0e4bd512db4ca4f1c80ebe5de38a93f1c2bbd Author: Konrad Hammel <konrad@sangoma.com> Date: Thu Sep 2 10:00:40 2010 -0400 freetdm: update to threadmutex to allow ftdm to run properly under GDB diff --git a/libs/freetdm/src/ftdm_threadmutex.c b/libs/freetdm/src/ftdm_threadmutex.c index 56bd49c..1271d80 100644 --- a/libs/freetdm/src/ftdm_threadmutex.c +++ b/libs/freetdm/src/ftdm_threadmutex.c @@ -373,6 +373,7 @@ FT_DECLARE(ftdm_status_t) ftdm_interrupt_signal(ftdm_interrupt_t *interrupt) if (!SetEvent(interrupt->event)) { ftdm_log(FTDM_LOG_ERROR, "Failed to signal interrupt\n"); return FTDM_FAIL; + } #else int err; @@ -404,6 +405,7 @@ FT_DECLARE(ftdm_status_t) ftdm_interrupt_destroy(ftdm_interrupt_t **ininterrupt) #else close(interrupt->readfd); close(interrupt->writefd); + interrupt->readfd = -1; interrupt->writefd = -1; #endif @@ -416,6 +418,7 @@ FT_DECLARE(ftdm_status_t) ftdm_interrupt_multiple_wait(ftdm_interrupt_t *interru { int numdevices = 0; unsigned i; + #if defined(__WINDOWS__) DWORD res = 0; HANDLE ints[20]; @@ -428,6 +431,7 @@ FT_DECLARE(ftdm_status_t) ftdm_interrupt_multiple_wait(ftdm_interrupt_t *interru for (i = 0; i < size; i++) { ints[i] = interrupts[i]->event; if (interrupts[i]->device != FTDM_INVALID_SOCKET) { + ints[size+numdevices] = interrupts[i]->device; numdevices++; } @@ -454,7 +458,7 @@ FT_DECLARE(ftdm_status_t) ftdm_interrupt_multiple_wait(ftdm_interrupt_t *interru struct pollfd ints[size*2]; memset(&ints, 0, sizeof(ints)); - +pollagain: for (i = 0; i < size; i++) { ints[i].events = POLLIN; ints[i].revents = 0; @@ -463,6 +467,7 @@ FT_DECLARE(ftdm_status_t) ftdm_interrupt_multiple_wait(ftdm_interrupt_t *interru ints[size+numdevices].events = POLLIN; ints[size+numdevices].revents = 0; ints[size+numdevices].fd = interrupts[i]->device; + numdevices++; } } @@ -470,6 +475,9 @@ FT_DECLARE(ftdm_status_t) ftdm_interrupt_multiple_wait(ftdm_interrupt_t *interru res = poll(ints, size + numdevices, ms); if (res == -1) { + if (errno == EINTR) { + goto pollagain; + } ftdm_log(FTDM_LOG_CRIT, "interrupt poll failed (%s)\n", strerror(errno)); return FTDM_FAIL; } commit 16d918d025d7de09d7d564d249bba9604f8e53a6 Author: Konrad Hammel <konrad@sangoma.com> Date: Wed Sep 1 16:52:37 2010 -0400 freetdm: ss7 - work on glare handling diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index a0bf95b..a9735c9 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -99,7 +99,11 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ SS7_ASSERT; }; - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx IAM\n"); + if (sngss7_info->glare.spInstId > 0) { + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx IAM (glare detected on circuit)\n"); + } else { + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx IAM\n"); + } /* check if the circuit has a remote block */ if ((sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) || @@ -208,11 +212,36 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ break; /**************************************************************************/ + case (FTDM_CHANNEL_STATE_DIALING): + case (FTDM_CHANNEL_STATE_TERMINATING): + case (FTDM_CHANNEL_STATE_HANGUP): + case (FTDM_CHANNEL_STATE_HANGUP_COMPLETE): + + SS7_INFO_CHAN(ftdmchan, "Got IAM on channel in %s state...glare!\n", ftdm_channel_state2str (ftdmchan->state)); + + /* save the info so that we can use it later on */ + sngss7_info->glare.spInstId = spInstId; + sngss7_info->glare.circuit = circuit; + memcpy(&sngss7_info->glare.iam, siConEvnt, sizeof(*siConEvnt)); + + if (!(sngss7_test_flag(sngss7_info, FLAG_GLARE))) { + /* glare, throw the flag */ + sngss7_set_flag(sngss7_info, FLAG_GLARE); + + /* setup the hangup cause */ + ftdmchan->caller_data.hangup_cause = 34; /* Circuit Congrestion */ + + /* this is a remote hangup request */ + sngss7_set_flag(sngss7_info, FLAG_REMOTE_REL); + + /* move the state of the channel to Terminating to end the call */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + } + + break; + /**************************************************************************/ default: /* should not have gotten an IAM while in this state */ - SS7_ERROR("Got IAM in an invalid state (%s) on span=%d, chan=%d!\n", - ftdm_channel_state2str(ftdmchan->state), - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id); + SS7_ERROR_CHAN(ftdmchan, "Got IAM on channel in invalid state(%s)...reset!\n", ftdm_channel_state2str (ftdmchan->state)); /* move the state of the channel to RESTART to force a reset */ ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); @@ -1028,10 +1057,26 @@ ftdm_status_t handle_reattempt(uint32_t suInstId, uint32_t spInstId, uint32_t ci SS7_ASSERT; }; - /* glare, throw the flag, go to down state*/ - sngss7_set_flag(sngss7_info, FLAG_GLARE); + if (sngss7_test_flag(sngss7_info, FLAG_GLARE)) { + /* the glare flag is already up so it was caught ... do nothing */ + SS7_DEBUG_CHAN(ftdmchan, "Glare flag is already up...nothing to do!%s\n", " "); + } else { + SS7_DEBUG_CHAN(ftdmchan, "Glare flag is not up yet...indicating glare from reattempt!%s\n", " "); + /* glare, throw the flag */ + sngss7_set_flag(sngss7_info, FLAG_GLARE); + + /* clear any existing glare data from the channel */ + memset(&sngss7_info->glare, 0x0, sizeof(sngss7_glare_data_t)); + + /* setup the hangup cause */ + ftdmchan->caller_data.hangup_cause = 34; /* Circuit Congrestion */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); + /* this is a remote hangup request */ + sngss7_set_flag(sngss7_info, FLAG_REMOTE_REL); + + /* move the state of the channel to Terminating to end the call */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + } /* unlock the channel again before we exit */ ftdm_mutex_unlock(ftdmchan->mutex); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index a9851bd..da90d34 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -303,24 +303,17 @@ static void *ftdm_sangoma_ss7_run(ftdm_thread_t * me, void *obj) /* clean out all pending channel state changes */ while ((ftdmchan = ftdm_queue_dequeue (ftdmspan->pendingchans))) { - /* double check that this channel has a state change pending */ - if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { - /*first lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); + + /*first lock the channel */ + ftdm_mutex_lock(ftdmchan->mutex); + /* process state changes for this channel until they are all done */ + while (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { ftdm_sangoma_ss7_process_state_change (ftdmchan); - - /* unlock the channel */ - ftdm_mutex_unlock (ftdmchan->mutex); - } else { - /* since we handle state changes again after handling the trillium queue - * this can occur since we'll clear the flag for the event but can't pop - * the channel out of pendingchans - */ -/* SS7_ERROR("ftdm_core reported state change, but state change flag not set on ft-span = %d, ft-chan = %d\n", - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id);*/ } + + /* unlock the channel */ + ftdm_mutex_unlock (ftdmchan->mutex); }/* while ((ftdmchan = ftdm_queue_dequeue(ftdmspan->pendingchans))) */ /* clean out all pending stack events */ @@ -451,6 +444,11 @@ static void ftdm_sangoma_ss7_process_stack_event (sngss7_event_data_t *sngss7_ev /* now that we have the right channel...put a lock on it so no-one else can use it */ ftdm_mutex_lock(ftdmchan->mutex); + /* while there's a state change present on this channel process it */ + while (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { + ftdm_sangoma_ss7_process_state_change(ftdmchan); + } + /* figure out the type of event and send it to the right handler */ switch (sngss7_event->event_id) { /**************************************************************************/ @@ -748,7 +746,11 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /* go to RESTART State until RSCa is received */ ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_RESTART); } else { - if (!(sngss7_test_flag (sngss7_info, FLAG_RESET_RX))) { + /* if the hangup is from a rx RSC, rx GRS, or glare don't sent RLC */ + if (!(sngss7_test_flag(sngss7_info, FLAG_RESET_RX)) && + !(sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_RX)) && + !(sngss7_test_flag(sngss7_info, FLAG_GLARE))) { + /* send out the release complete */ ft_to_sngss7_rlc (ftdmchan); } @@ -879,7 +881,26 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) ftdm_channel_t *close_chan = ftdmchan; /* close the channel */ ftdm_channel_close (&close_chan); - } + } /* if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_OPEN)) */ + + /* check if there is a glared call that needs to be processed */ + if (sngss7_test_flag(sngss7_info, FLAG_GLARE)) { + + /* clear the glare flag */ + sngss7_clear_flag (sngss7_info, FLAG_GLARE); + + /* check if we have an IAM stored...if we don't have one just exit */ + if (sngss7_info->glare.circuit != 0) { + /* send the saved call back in to us */ + handle_con_ind (0, + sngss7_info->glare.spInstId, + sngss7_info->glare.circuit, + &sngss7_info->glare.iam); + + /* clear the glare info */ + memset(&sngss7_info->glare, 0x0, sizeof(sngss7_glare_data_t)); + } /* if (sngss7_info->glare.circuit != 0) */ + } /* if (sngss7_test_flag(sngss7_info, FLAG_GLARE)) */ break; /**************************************************************************/ @@ -1167,11 +1188,13 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(ftdm_sangoma_ss7_outgoing_call) SS7_ASSERT; }; + /* check if the channel sig state is UP */ if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) { SS7_ERROR_CHAN(ftdmchan, "Requested channel sig state is down, cancelling call!%s\n", " "); goto outgoing_fail; } + /* check if there is a remote block */ if ((sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) || (sngss7_test_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX)) || (sngss7_test_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX))) { @@ -1181,15 +1204,19 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(ftdm_sangoma_ss7_outgoing_call) goto outgoing_break; } + /* check if there is a local block */ if ((sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) || (sngss7_test_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX)) || (sngss7_test_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX))) { + /* KONRAD FIX ME : we should check if this is a TEST call and allow it */ + /* the channel is blocked...can't send any calls here */ SS7_ERROR_CHAN(ftdmchan, "Requested channel is locally blocked, re-hunt channel!%s\n", " "); goto outgoing_break; } + /* check the state of the channel */ switch (ftdmchan->state){ /**************************************************************************/ case FTDM_CHANNEL_STATE_DOWN: @@ -1208,7 +1235,7 @@ static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(ftdm_sangoma_ss7_outgoing_call) ftdmchan->physical_span_id, ftdmchan->physical_chan_id); - goto outgoing_fail; + goto outgoing_break; break; /**************************************************************************/ } /* switch (ftdmchan->state) (original call) */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index 3bf12ae..45cf495 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -321,8 +321,7 @@ typedef struct sngss7_timer_data { }sngss7_timer_data_t; typedef struct sngss7_glare_data { - uint32_t suInstId; - uint32_t spInstId; + uint32_t spInstId; uint32_t circuit; SiConEvnt iam; }sngss7_glare_data_t; @@ -612,31 +611,40 @@ ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const cha #define SS7_MSG_TRACE(fchan, sngss7info ,msg) if (g_ftdm_sngss7_data.message_trace) { \ switch (g_ftdm_sngss7_data.message_trace_level) { \ case 0: \ - ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "[CIC:%d]%s",sngss7info->circuit->cic, msg); \ + ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "[CIC:%d][SPINSTID:%d][SUINSTID:%d]%s", \ + sngss7info->circuit->cic,sngss7info->spInstId,sngss7info->suInstId, msg); \ break; \ case 1: \ - ftdm_log_chan(fchan, FTDM_LOG_ALERT, "[CIC:%d]%s",sngss7info->circuit->cic, msg); \ + ftdm_log_chan(fchan, FTDM_LOG_ALERT, "[CIC:%d][SPINSTID:%d][SUINSTID:%d]%s", \ + sngss7info->circuit->cic,sngss7info->spInstId,sngss7info->suInstId, msg); \ break; \ case 2: \ - ftdm_log_chan(fchan, FTDM_LOG_CRIT, "[CIC:%d]%s",sngss7info->circuit->cic, msg); \ + ftdm_log_chan(fchan, FTDM_LOG_CRIT, "[CIC:%d][SPINSTID:%d][SUINSTID:%d]%s", \ + sngss7info->circuit->cic,sngss7info->spInstId,sngss7info->suInstId, msg); \ break; \ case 3: \ - ftdm_log_chan(fchan, FTDM_LOG_ERROR, "[CIC:%d]%s",sngss7info->circuit->cic, msg); \ + ftdm_log_chan(fchan, FTDM_LOG_ERROR, "[CIC:%d][SPINSTID:%d][SUINSTID:%d]%s", \ + sngss7info->circuit->cic,sngss7info->spInstId,sngss7info->suInstId, msg); \ break; \ case 4: \ - ftdm_log_chan(fchan, FTDM_LOG_WARNING, "[CIC:%d]%s",sngss7info->circuit->cic, msg); \ + ftdm_log_chan(fchan, FTDM_LOG_WARNING, "[CIC:%d][SPINSTID:%d][SUINSTID:%d]%s", \ + sngss7info->circuit->cic,sngss7info->spInstId,sngss7info->suInstId, msg); \ break; \ case 5: \ - ftdm_log_chan(fchan, FTDM_LOG_NOTICE, "[CIC:%d]%s",sngss7info->circuit->cic, msg); \ + ftdm_log_chan(fchan, FTDM_LOG_NOTICE, "[CIC:%d][SPINSTID:%d][SUINSTID:%d]%s", \ + sngss7info->circuit->cic,sngss7info->spInstId,sngss7info->suInstId, msg); \ break; \ case 6: \ - ftdm_log_chan(fchan, FTDM_LOG_INFO, "[CIC:%d]%s",sngss7info->circuit->cic, msg); \ + ftdm_log_chan(fchan, FTDM_LOG_INFO, "[CIC:%d][SPINSTID:%d][SUINSTID:%d]%s", \ + sngss7info->circuit->cic,sngss7info->spInstId,sngss7info->suInstId, msg); \ break; \ case 7: \ - ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "[CIC:%d]%s",sngss7info->circuit->cic, msg); \ + ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "[CIC:%d][SPINSTID:%d][SUINSTID:%d]%s", \ + sngss7info->circuit->cic,sngss7info->spInstId,sngss7info->suInstId, msg); \ break; \ default: \ - ftdm_log_chan(fchan, FTDM_LOG_INFO, "[CIC:%d]%s",sngss7info->circuit->cic, msg); \ + ftdm_log_chan(fchan, FTDM_LOG_INFO, "[CIC:%d][SPINSTID:%d][SUINSTID:%d]%s", \ + sngss7info->circuit->cic,sngss7info->spInstId,sngss7info->suInstId, msg); \ break; \ } /* switch (g_ftdm_sngss7_data.message_trace_level) */ \ } /* if(g_ftdm_sngss7_data.message_trace) */ commit ca481842569116305d1aad2fcb29ec2ebedbfac2 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Sep 2 16:41:09 2010 -0500 strip trailing and leading whitespace in api execute args and commands diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index ada05e7..0ef3624 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -1683,27 +1683,34 @@ SWITCH_DECLARE(switch_status_t) switch_api_execute(const char *cmd, const char * { switch_api_interface_t *api; switch_status_t status; + char *arg_no_spaces; + char *cmd_no_spaces; switch_assert(stream != NULL); switch_assert(stream->data != NULL); switch_assert(stream->write_function != NULL); + + cmd_no_spaces = switch_strip_whitespace(cmd); + arg_no_spaces = switch_strip_whitespace(arg); + + if (!stream->param_event) { switch_event_create(&stream->param_event, SWITCH_EVENT_API); } if (stream->param_event) { - if (cmd) { - switch_event_add_header_string(stream->param_event, SWITCH_STACK_BOTTOM, "API-Command", cmd); + if (cmd_no_spaces) { + switch_event_add_header_string(stream->param_event, SWITCH_STACK_BOTTOM, "API-Command", cmd_no_spaces); } - if (arg) { - switch_event_add_header_string(stream->param_event, SWITCH_STACK_BOTTOM, "API-Command-Argument", arg); + if (arg_no_spaces) { + switch_event_add_header_string(stream->param_event, SWITCH_STACK_BOTTOM, "API-Command-Argument", arg_no_spaces); } } - if (cmd && (api = switch_loadable_module_get_api_interface(cmd)) != 0) { - if ((status = api->function(arg, session, stream)) != SWITCH_STATUS_SUCCESS) { + if (cmd_no_spaces && (api = switch_loadable_module_get_api_interface(cmd_no_spaces)) != 0) { + if ((status = api->function(arg_no_spaces, session, stream)) != SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "COMMAND RETURNED ERROR!\n"); } UNPROTECT_INTERFACE(api); @@ -1716,6 +1723,8 @@ SWITCH_DECLARE(switch_status_t) switch_api_execute(const char *cmd, const char * switch_event_fire(&stream->param_event); } + switch_safe_free(cmd_no_spaces); + switch_safe_free(arg_no_spaces); return status; } commit 11361f69a45f83b0c60fda9094b76978790d5497 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Sep 2 16:39:10 2010 -0500 hex vs. dec, strip space in switch_strip_whitespace diff --git a/src/switch_utils.c b/src/switch_utils.c index d7c5d6b..91b78f7 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -724,7 +724,7 @@ SWITCH_DECLARE(char *) switch_strip_whitespace(const char *str) if (!sp) return NULL; - while ((*sp == 13 ) || (*sp == 10 ) || (*sp == 9 ) || (*sp == 20) || (*sp == 11) ) { + while ((*sp == 13 ) || (*sp == 10 ) || (*sp == 9 ) || (*sp == 32) || (*sp == 11) ) { sp++; } @@ -735,7 +735,7 @@ SWITCH_DECLARE(char *) switch_strip_whitespace(const char *str) p = s + (strlen(s) - 1); - while ((*p == 13 ) || (*p == 10 ) || (*p == 9 ) || (*p == 20) || (*p == 11) ) { + while ((*p == 13 ) || (*p == 10 ) || (*p == 9 ) || (*p == 32) || (*p == 11) ) { *p-- = '\0'; } commit 2066322891f64b31bdd300e5151ac677c689d7e1 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Sep 2 16:38:14 2010 -0500 fix small leak diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 16b928b..14d05fd 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -436,18 +436,24 @@ void sofia_handle_sip_i_notify(switch_core_session_t *session, int status, mwi_status = switch_stristr("Messages-Waiting: ", sip->sip_payload->pl_data); if ( mwi_status ) { + char *mwi_stat; mwi_status += strlen( "Messages-Waiting: " ); - mwi_status = switch_strip_whitespace( mwi_status ); + mwi_stat = switch_strip_whitespace( mwi_status ); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Forwarding unsolicited MWI ( %s : %s@%s )\n", mwi_status, sip->sip_to->a_url->url_user, sip->sip_to->a_url->url_host ); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, + "Forwarding unsolicited MWI ( %s : %s@%s )\n", + mwi_stat, sip->sip_to->a_url->url_user, sip->sip_to->a_url->url_host ); if (switch_event_create(&s_event, SWITCH_EVENT_MESSAGE_WAITING) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "MWI-Messages-Waiting", mwi_status ); - switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "MWI-Message-Account", "%s@%s", sip->sip_to->a_url->url_user, sip->sip_to->a_url->url_host ); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "MWI-Messages-Waiting", mwi_stat ); + switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, + "MWI-Message-Account", "%s@%s", sip->sip_to->a_url->url_user, sip->sip_to->a_url->url_host ); switch_event_fire(&s_event); } + switch_safe_free(mwi_stat); } } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Dropping unsolicited MWI ( %s@%s ) because of ACL\n", sip->sip_to->a_url->url_user, sip->sip_to->a_url->url_host ); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Dropping unsolicited MWI ( %s@%s ) because of ACL\n", + sip->sip_to->a_url->url_user, sip->sip_to->a_url->url_host ); }; } commit 82db6c4fe3eb7a9671ae0420d0fc3264a310a930 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Sep 2 16:36:47 2010 -0500 revert, moving to core diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 55520b1..e1eb2a6 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -1714,23 +1714,18 @@ SWITCH_STANDARD_API(ctl_function) SWITCH_STANDARD_API(load_function) { const char *err; - char *mod; if (zstr(cmd)) { stream->write_function(stream, "-USAGE: %s\n", LOAD_SYNTAX); return SWITCH_STATUS_SUCCESS; } - mod = switch_strip_whitespace(cmd); - - if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, mod, SWITCH_TRUE, &err) == SWITCH_STATUS_SUCCESS) { + if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) cmd, SWITCH_TRUE, &err) == SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "+OK\n"); } else { stream->write_function(stream, "-ERR [%s]\n", err); } - switch_safe_free(mod); - return SWITCH_STATUS_SUCCESS; } @@ -1740,7 +1735,6 @@ SWITCH_STANDARD_API(unload_function) const char *err; switch_bool_t force = SWITCH_FALSE; const char *p = cmd; - char *mod; if (zstr(cmd)) { stream->write_function(stream, "-USAGE: %s\n", UNLOAD_SYNTAX); @@ -1771,16 +1765,12 @@ SWITCH_STANDARD_API(unload_function) return SWITCH_STATUS_SUCCESS; } - mod = switch_strip_whitespace(cmd); - - if (switch_loadable_module_unload_module((char *) SWITCH_GLOBAL_dirs.mod_dir, mod, force, &err) == SWITCH_STATUS_SUCCESS) { + if (switch_loadable_module_unload_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) cmd, force, &err) == SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "+OK\n"); } else { stream->write_function(stream, "-ERR [%s]\n", err); } - switch_safe_free(mod); - return SWITCH_STATUS_SUCCESS; } @@ -1789,7 +1779,6 @@ SWITCH_STANDARD_API(reload_function) const char *err; switch_bool_t force = SWITCH_FALSE; const char *p = cmd; - char *mod; if (zstr(cmd)) { stream->write_function(stream, "-USAGE: %s\n", UNLOAD_SYNTAX); @@ -1819,24 +1808,18 @@ SWITCH_STANDARD_API(reload_function) return SWITCH_STATUS_SUCCESS; } - mod = switch_strip_whitespace(cmd); - - - printf("WTF XXX [%s] [%s] \n", cmd, mod); - - if (switch_loadable_module_unload_module((char *) SWITCH_GLOBAL_dirs.mod_dir, mod, force, &err) == SWITCH_STATUS_SUCCESS) { + if (switch_loadable_module_unload_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) cmd, force, &err) == SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "+OK module unloaded\n"); } else { stream->write_function(stream, "-ERR unloading module [%s]\n", err); } - if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, mod, SWITCH_TRUE, &err) == SWITCH_STATUS_SUCCESS) { + if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) cmd, SWITCH_TRUE, &err) == SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "+OK module loaded\n"); } else { stream->write_function(stream, "-ERR loading module [%s]\n", err); } - switch_safe_free(mod); return SWITCH_STATUS_SUCCESS; } commit 7c0b748737f138b85df15074d6e72255b742a07b Author: Michael Jerris <mike@jerris.com> Date: Thu Sep 2 17:17:41 2010 -0400 cleanup whitespace in commands diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index e1eb2a6..55520b1 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -1714,18 +1714,23 @@ SWITCH_STANDARD_API(ctl_function) SWITCH_STANDARD_API(load_function) { const char *err; + char *mod; if (zstr(cmd)) { stream->write_function(stream, "-USAGE: %s\n", LOAD_SYNTAX); return SWITCH_STATUS_SUCCESS; } - if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) cmd, SWITCH_TRUE, &err) == SWITCH_STATUS_SUCCESS) { + mod = switch_strip_whitespace(cmd); + + if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, mod, SWITCH_TRUE, &err) == SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "+OK\n"); } else { stream->write_function(stream, "-ERR [%s]\n", err); } + switch_safe_free(mod); + return SWITCH_STATUS_SUCCESS; } @@ -1735,6 +1740,7 @@ SWITCH_STANDARD_API(unload_function) const char *err; switch_bool_t force = SWITCH_FALSE; const char *p = cmd; + char *mod; if (zstr(cmd)) { stream->write_function(stream, "-USAGE: %s\n", UNLOAD_SYNTAX); @@ -1765,12 +1771,16 @@ SWITCH_STANDARD_API(unload_function) return SWITCH_STATUS_SUCCESS; } - if (switch_loadable_module_unload_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) cmd, force, &err) == SWITCH_STATUS_SUCCESS) { + mod = switch_strip_whitespace(cmd); + + if (switch_loadable_module_unload_module((char *) SWITCH_GLOBAL_dirs.mod_dir, mod, force, &err) == SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "+OK\n"); } else { stream->write_function(stream, "-ERR [%s]\n", err); } + switch_safe_free(mod); + return SWITCH_STATUS_SUCCESS; } @@ -1779,6 +1789,7 @@ SWITCH_STANDARD_API(reload_function) const char *err; switch_bool_t force = SWITCH_FALSE; const char *p = cmd; + char *mod; if (zstr(cmd)) { stream->write_function(stream, "-USAGE: %s\n", UNLOAD_SYNTAX); @@ -1808,18 +1819,24 @@ SWITCH_STANDARD_API(reload_function) return SWITCH_STATUS_SUCCESS; } - if (switch_loadable_module_unload_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) cmd, force, &err) == SWITCH_STATUS_SUCCESS) { + mod = switch_strip_whitespace(cmd); + + + printf("WTF XXX [%s] [%s] \n", cmd, mod); + + if (switch_loadable_module_unload_module((char *) SWITCH_GLOBAL_dirs.mod_dir, mod, force, &err) == SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "+OK module unloaded\n"); } else { stream->write_function(stream, "-ERR unloading module [%s]\n", err); } - if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, (char *) cmd, SWITCH_TRUE, &err) == SWITCH_STATUS_SUCCESS) { + if (switch_loadable_module_load_module((char *) SWITCH_GLOBAL_dirs.mod_dir, mod, SWITCH_TRUE, &err) == SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "+OK module loaded\n"); } else { stream->write_function(stream, "-ERR loading module [%s]\n", err); } + switch_safe_free(mod); return SWITCH_STATUS_SUCCESS; } commit 4da5c5cfa2d7410ec53757df69d6f2d2640c1309 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Sep 2 16:01:50 2010 -0500 presence issues for dialog_info diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index d548683..73d9303 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -565,34 +565,32 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) probe_euser = (p + 1); } - - - if (probe_euser && probe_host && (profile = sofia_glue_find_profile(probe_host))) { sql = switch_mprintf("select status,rpid from sip_dialogs where sip_from_user='%q' and sip_from_host='%q'", probe_euser, probe_host); sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_dialog_callback, &dh); switch_safe_free(sql); - sql = switch_mprintf("select sip_registrations.sip_user, '%q', sip_registrations.status, " + sql = switch_mprintf("select sip_registrations.sip_user, sip_registrations.orig_server_host, sip_registrations.status, " "sip_registrations.rpid,'', sip_dialogs.uuid, sip_dialogs.state, sip_dialogs.direction, " "sip_dialogs.sip_to_user, sip_dialogs.sip_to_host, sip_presence.status,sip_presence.rpid,sip_presence.open_closed," "'%q','%q' " "from sip_registrations left join sip_dialogs on " "(sip_dialogs.sip_from_user = sip_registrations.sip_user " - "and sip_dialogs.sip_from_host = sip_registrations.sip_host) " + "and (sip_dialogs.sip_from_host = sip_registrations.orig_server_host or " + "sip_dialogs.sip_from_host = sip_registrations.sip_host) ) " "left join sip_presence on " - "(sip_registrations.sip_user=sip_presence.sip_user and sip_registrations.sip_host=sip_presence.sip_host and " + "(sip_registrations.sip_user=sip_presence.sip_user and sip_registrations.orig_server_host=sip_presence.sip_host and " "sip_registrations.profile_name=sip_presence.profile_name) " "where sip_registrations.sip_user='%q' and " - "(sip_registrations.sip_host='%q' or sip_registrations.presence_hosts like '%%%q%%')", - probe_host, dh.status, dh.rpid, probe_euser, probe_host, probe_host); + "(sip_registrations.orig_server_host='%q' or sip_registrations.sip_host='%q' " + "or sip_registrations.presence_hosts like '%%%q%%')", + dh.status, dh.rpid, probe_euser, probe_host, probe_host, probe_host); switch_assert(sql); - if (mod_sofia_globals.debug_presence > 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s START_PRESENCE_PROBE_SQL\n", profile->name); } @@ -622,6 +620,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) sofia_glue_release_profile(profile); switch_safe_free(sql); } + switch_safe_free(probe_user); } @@ -961,7 +960,7 @@ static int sofia_presence_resub_callback(void *pArg, int argc, char **argv, char switch_event_header_t *hp; if (argc > 5) { - uuid = switch_str_nil(argv[5]); + uuid = argv[5]; state = switch_str_nil(argv[6]); direction = switch_str_nil(argv[7]); if (argc > 8) { @@ -998,12 +997,13 @@ static int sofia_presence_resub_callback(void *pArg, int argc, char **argv, char } if (zstr(state)) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "unique-id", SOFIA_CHAT_PROTO); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-state", "CS_HANGUP"); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "answer-state", "resubscribe"); + //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "answer-state", "resubscribe"); } else { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-state", "CS_ROUTING"); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "unique-id", uuid); + if (uuid) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "unique-id", uuid); + } switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "answer-state", state); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "astate", state); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "presence-call-direction", direction); @@ -1327,10 +1327,11 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * "<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" " "version=\"%s\" state=\"%s\" entity=\"%s\">\n", version, - !strcasecmp(answer_state, "resubscribe") ? "partial" : "full", clean_id); + zstr(uuid) ? "partial" : "full", clean_id); } - if (strcasecmp(event_status, "Registered")) { + //if (strcasecmp(event_status, "Registered")) { + if (!zstr(uuid)) { if (!zstr(answer_state)) { astate = answer_state; } @@ -2237,8 +2238,11 @@ void sofia_presence_handle_sip_i_subscribe(int status, if (switch_event_create(&pevent, SWITCH_EVENT_PRESENCE_PROBE) == SWITCH_STATUS_SUCCESS) { switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "login", profile->url); - switch_event_add_header(pevent, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, to_host); + //switch_event_add_header(pevent, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, to_host); + switch_event_add_header(pevent, SWITCH_STACK_BOTTOM, "from", "%s@%s", from_user, from_host); + switch_event_add_header(pevent, SWITCH_STACK_BOTTOM, "to", "%s@%s", to_user, to_host); switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "event_type", "presence"); + switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog"); switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "event_subtype", "probe"); switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "proto-specific-event-name", event); switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "expires", exp_delta_str); diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 18df1c4..6b90b77 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -787,6 +787,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand const char *from_user = NULL; const char *from_host = NULL; const char *reg_host = profile->reg_db_domain; + const char *sub_host = profile->sub_domain; char contact_str[1024] = ""; int nat_hack = 0; uint8_t multi_reg = 0, multi_reg_contact = 0, avoid_multi_reg = 0; @@ -851,6 +852,9 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand if (!reg_host) { reg_host = to_host; } + if (!sub_host) { + sub_host = to_host; + } if (contact->m_url) { const char *port = contact->m_url->url_port; @@ -1146,11 +1150,14 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand } if (multi_reg) { + +#ifdef DEL_SUBS if (reg_count == 1) { sql = switch_mprintf("delete from sip_subscriptions where sip_user='%q' and sip_host='%q' and contact='%q'", - to_user, reg_host, contact_str); + to_user, sub_host, contact_str); sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); } +#endif if (multi_reg_contact) { @@ -1160,14 +1167,35 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand sql = switch_mprintf("delete from sip_registrations where call_id='%q'", call_id); } } else { - sql = switch_mprintf("delete from sip_subscriptions where sip_user='%q' and sip_host='%q'", to_user, reg_host); +#ifdef DEL_SUBS + sql = switch_mprintf("delete from sip_subscriptions where sip_user='%q' and sip_host='%q'", to_user, sub_host); sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); +#endif sql = switch_mprintf("delete from sip_registrations where sip_user='%q' and sip_host='%q'", to_user, reg_host); } switch_mutex_lock(profile->ireg_mutex); sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); switch_find_local_ip(guess_ip4, sizeof(guess_ip4), NULL, AF_INET); + + if (profile->reg_db_domain) { + sofia_profile_t *xprofile; + + if ((xprofile = sofia_glue_find_profile(to_host))) { + sofia_glue_release_profile(xprofile); + } else { + + if (sofia_glue_add_profile(switch_core_strdup(profile->pool, to_host), profile) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Auto-Adding Alias [%s] for profile [%s]\n", to_host, profile->name); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Alias [%s] for profile [%s] (already exists)\n", + to_host, profile->name); + } + + + } + } + sql = switch_mprintf("insert into sip_registrations " "(call_id,sip_user,sip_host,presence_hosts,contact,status,rpid,expires," @@ -1220,7 +1248,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->url); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "user-agent", (sip && sip->sip_user_agent) ? sip->sip_user_agent->g_string : "unknown"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, reg_host); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, sub_host); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", "Registered"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence"); switch_event_fire(&event); @@ -1234,8 +1262,8 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", "sip"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->url); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", rpid); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, reg_host); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "to", "%s@%s", to_user, reg_host); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, sub_host); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "to", "%s@%s", to_user, sub_host); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", "Registered"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_subtype", "probe"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence"); @@ -1253,7 +1281,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->url); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "user-agent", (sip && sip->sip_user_agent) ? sip->sip_user_agent->g_string : "unknown"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, reg_host); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, sub_host); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", "Unregistered"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence"); switch_event_fire(&event); @@ -1262,7 +1290,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_OUT) == SWITCH_STATUS_SUCCESS) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", "sip"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->url); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s+%s@%s", SOFIA_CHAT_PROTO, to_user, reg_host); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "from", "%s+%s@%s", SOFIA_CHAT_PROTO, to_user, sub_host); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", "unavailable"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", rpid); @@ -1280,15 +1308,16 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand if ((p = strchr(icontact + 4, ':'))) { *p = '\0'; } - +#ifdef DEL_SUBS if (multi_reg_contact) { sql = - switch_mprintf("delete from sip_subscriptions where sip_user='%q' and sip_host='%q' and contact='%q'", to_user, reg_host, contact_str); + switch_mprintf("delete from sip_subscriptions where sip_user='%q' and sip_host='%q' and contact='%q'", to_user, sub_host, contact_str); } else { sql = switch_mprintf("delete from sip_subscriptions where call_id='%q'", call_id); } sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); +#endif if (multi_reg_contact) { sql = @@ -1301,10 +1330,11 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand switch_safe_free(icontact); } else { - if ((sql = switch_mprintf("delete from sip_subscriptions where sip_user='%q' and sip_host='%q'", to_user, reg_host))) { +#ifdef DEL_SUBS + if ((sql = switch_mprintf("delete from sip_subscriptions where sip_user='%q' and sip_host='%q'", to_user, sub_host))) { sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); } - +#endif if ((sql = switch_mprintf("delete from sip_registrations where sip_user='%q' and sip_host='%q'", to_user, reg_host))) { sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); } @@ -1333,15 +1363,26 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand } +#if 0 + if (switch_event_create(&s_event, SWITCH_EVENT_PRESENCE_PROBE) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "login", profile->name); + switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, sub_host); + switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "to", "%s@%s", to_user, sub_host); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "event_type", "presence"); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog"); + switch_event_fire(&s_event); + } +#else if (switch_event_create(&s_event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "login", profile->name); - switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, reg_host); + switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, sub_host); switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "rpid", "unknown"); switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "status", "Registered"); switch_event_fire(&s_event); - } - + } +#endif } else { if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_UNREGISTER) == SWITCH_STATUS_SUCCESS) { switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "profile-name", profile->name); commit cc722c64f324504317b5790d0483d2621e620af9 Merge: abb342f cd0cc2e Author: David Yat Sin <dyatsin@sangoma.com> Date: Thu Sep 2 13:46:00 2010 -0400 minor fixes commit 2002f38b4cb4b36c7c9be94865a67b5a75668fdc Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Sep 2 12:30:26 2010 -0500 fix regression in core event system diff --git a/src/switch_event.c b/src/switch_event.c index 1301d92..cfd6a7a 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -79,6 +79,7 @@ static switch_memory_pool_t *THRUNTIME_POOL = NULL; static switch_thread_t *EVENT_QUEUE_THREADS[NUMBER_OF_QUEUES] = { 0 }; static switch_queue_t *EVENT_QUEUE[NUMBER_OF_QUEUES] = { 0 }; static switch_thread_t *EVENT_DISPATCH_QUEUE_THREADS[MAX_DISPATCH_VAL] = { 0 }; +static uint8_t EVENT_DISPATCH_QUEUE_RUNNING[MAX_DISPATCH_VAL] = { 0 }; static switch_queue_t *EVENT_DISPATCH_QUEUE[MAX_DISPATCH_VAL] = { 0 }; static int POOL_COUNT_MAX = SWITCH_CORE_QUEUE_LEN; static switch_mutex_t *EVENT_QUEUE_MUTEX = NULL; @@ -238,9 +239,9 @@ static void *SWITCH_THREAD_FUNC switch_event_dispatch_thread(switch_thread_t *th { switch_queue_t *queue = (switch_queue_t *) obj; int my_id = 0; + switch_mutex_lock(EVENT_QUEUE_MUTEX); THREAD_COUNT++; - switch_mutex_unlock(EVENT_QUEUE_MUTEX); for (my_id = 0; my_id < NUMBER_OF_QUEUES; my_id++) { if (EVENT_DISPATCH_QUEUE[my_id] == queue) { @@ -248,6 +249,9 @@ static void *SWITCH_THREAD_FUNC switch_event_dispatch_thread(switch_thread_t *th } } + EVENT_DISPATCH_QUEUE_RUNNING[my_id] = 1; + switch_mutex_unlock(EVENT_QUEUE_MUTEX); + for (;;) { void *pop = NULL; switch_event_t *event = NULL; @@ -270,6 +274,7 @@ static void *SWITCH_THREAD_FUNC switch_event_dispatch_thread(switch_thread_t *th switch_mutex_lock(EVENT_QUEUE_MUTEX); + EVENT_DISPATCH_QUEUE_RUNNING[my_id] = 1; THREAD_COUNT--; switch_mutex_unlock(EVENT_QUEUE_MUTEX); @@ -298,6 +303,7 @@ static void *SWITCH_THREAD_FUNC switch_event_thread(switch_thread_t *thread, voi for (;;) { void *pop = NULL; switch_event_t *event = NULL; + int loops = 0; if (switch_queue_pop(queue, &pop) != SWITCH_STATUS_SUCCESS) { break; @@ -314,13 +320,13 @@ static void *SWITCH_THREAD_FUNC switch_event_thread(switch_thread_t *thread, voi event = (switch_event_t *) pop; while (event) { - int max; - switch_mutex_lock(EVENT_QUEUE_MUTEX); - max = SOFT_MAX_DISPATCH; - switch_mutex_unlock(EVENT_QUEUE_MUTEX); + if (++loops > 2) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Event system overloading\n"); + switch_yield(1000000); + } - for (index = 0; (int)index < max; index++) { + for (index = 0; index < SOFT_MAX_DISPATCH; index++) { if (switch_queue_trypush(EVENT_DISPATCH_QUEUE[index], event) == SWITCH_STATUS_SUCCESS) { event = NULL; break; @@ -328,19 +334,15 @@ static void *SWITCH_THREAD_FUNC switch_event_thread(switch_thread_t *thread, voi } if (event) { - switch_mutex_lock(EVENT_QUEUE_MUTEX); if (SOFT_MAX_DISPATCH + 1 < MAX_DISPATCH) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Adding a new event thread #%d\n", SOFT_MAX_DISPATCH + 1); + switch_mutex_lock(EVENT_QUEUE_MUTEX); launch_dispatch_threads(SOFT_MAX_DISPATCH + 1, DISPATCH_QUEUE_LEN, RUNTIME_POOL); + switch_mutex_unlock(EVENT_QUEUE_MUTEX); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Event threads maxed out at %d.\n", SOFT_MAX_DISPATCH); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Out of threads!\n"); switch_yield(1000000); } - switch_mutex_unlock(EVENT_QUEUE_MUTEX); } - - - switch_cond_next(); } } @@ -566,6 +568,8 @@ static void launch_dispatch_threads(uint32_t max, int len, switch_memory_pool_t { switch_threadattr_t *thd_attr; uint32_t index = 0; + int launched = 0; + uint32_t sanity = 200; if (max > MAX_DISPATCH) { return; @@ -584,8 +588,10 @@ static void launch_dispatch_threads(uint32_t max, int len, switch_memory_pool_t switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); switch_threadattr_priority_increase(thd_attr); switch_thread_create(&EVENT_DISPATCH_QUEUE_THREADS[index], thd_attr, switch_event_dispatch_thread, EVENT_DISPATCH_QUEUE[index], pool); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Create event dispatch thread %d\n", index); - switch_yield(100000); + while(--sanity && !EVENT_DISPATCH_QUEUE_RUNNING[index]) switch_yield(10000); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Create event dispatch thread %d\n", index); + launched++; + break; } SOFT_MAX_DISPATCH = index; commit cd0cc2e4a30398b3a2e1eb8f5e10c2df3e041fa0 Author: Moises Silva <moy@sangoma.com> Date: Thu Sep 2 12:38:43 2010 -0400 freetdm: only notify interrupt waiters if there is not a notification already pending diff --git a/libs/freetdm/src/ftdm_threadmutex.c b/libs/freetdm/src/ftdm_threadmutex.c index 79bd28f..56bd49c 100644 --- a/libs/freetdm/src/ftdm_threadmutex.c +++ b/libs/freetdm/src/ftdm_threadmutex.c @@ -376,9 +376,19 @@ FT_DECLARE(ftdm_status_t) ftdm_interrupt_signal(ftdm_interrupt_t *interrupt) } #else int err; - if ((err = write(interrupt->writefd, "w", 1)) != 1) { - ftdm_log(FTDM_LOG_ERROR, "Failed to signal interrupt: %s\n", errno, strerror(errno)); - return FTDM_FAIL; + struct pollfd testpoll; + testpoll.revents = 0; + testpoll.events = POLLIN; + testpoll.fd = interrupt->readfd; + err = poll(&testpoll, 1, 0); + if (err == 0 && !(testpoll.revents & POLLIN)) { + /* we just try to notify if there is nothing on the read fd already, + * otherwise users that never call interrupt wait eventually will + * eventually have the pipe buffer filled */ + if ((err = write(interrupt->writefd, "w", 1)) != 1) { + ftdm_log(FTDM_LOG_ERROR, "Failed to signal interrupt: %s\n", errno, strerror(errno)); + return FTDM_FAIL; + } } #endif return FTDM_SUCCESS; commit e4b5c49fc105c3f13c31db8dd5be0c5cd8a8c655 Author: David Yat Sin <dyatsin@sangoma.com> Date: Tue Aug 31 19:05:37 2010 -0400 freetdm: fix code using raw_data as an integer when is actually null diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 0117fce..55f899e 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -2117,10 +2117,10 @@ static FIO_SIGNAL_CB_FUNCTION(on_clear_channel_signal) } break; case FTDM_SIGEVENT_SIGSTATUS_CHANGED: - { - ftdm_signaling_status_t *sigstatus = (ftdm_signaling_status_t*)(sigmsg->raw_data); + { + ftdm_signaling_status_t sigstatus = sigmsg->raw_data ? *((ftdm_signaling_status_t*)(sigmsg->raw_data)) : sigmsg->sigstatus; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%d:%d signalling changed to :%s\n", - spanid, chanid, ftdm_signaling_status2str(*sigstatus)); + spanid, chanid, ftdm_signaling_status2str(sigstatus)); } break; default: diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 7f27177..dcb74d9 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -4473,10 +4473,13 @@ FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t switch (sigmsg->event_id) { case FTDM_SIGEVENT_SIGSTATUS_CHANGED: - if (*((ftdm_signaling_status_t*)(sigmsg->raw_data)) == FTDM_SIG_STATE_UP) { - ftdm_set_flag(sigmsg->channel, FTDM_CHANNEL_SIG_UP); - } else { - ftdm_clear_flag(sigmsg->channel, FTDM_CHANNEL_SIG_UP); + { + ftdm_signaling_status_t sigstatus = ftdm_test_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE) ? sigmsg->sigstatus : *((ftdm_signaling_status_t*)(sigmsg->raw_data)); + if (sigstatus == FTDM_SIG_STATE_UP) { + ftdm_set_flag(sigmsg->channel, FTDM_CHANNEL_SIG_UP); + } else { + ftdm_clear_flag(sigmsg->channel, FTDM_CHANNEL_SIG_UP); + } } break; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index a98429d..ef44063 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -278,11 +278,11 @@ static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj) ftdm_channel_unlock(ftdmchan); } - /* Check if there are any timers to process */ while ((sngisdn_event = ftdm_queue_dequeue(signal_data->event_queue))) { ftdm_sangoma_isdn_process_stack_event(span, sngisdn_event); ftdm_safe_free(sngisdn_event); - } + } + ftdm_span_trigger_signals(span); break; case FTDM_TIMEOUT: /* twiddle */ @@ -793,6 +793,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_isdn_span_config) span->set_channel_sig_status = ftdm_sangoma_isdn_set_sig_status; span->state_map = &sangoma_isdn_state_map; ftdm_set_flag(span, FTDM_SPAN_USE_CHAN_QUEUE); + ftdm_set_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE); if (span->trunk_type == FTDM_TRUNK_BRI_PTMP || span->trunk_type == FTDM_TRUNK_BRI) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cntrl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cntrl.c index 5299c91..7aba6a6 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cntrl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cntrl.c @@ -48,7 +48,7 @@ void sngisdn_set_chan_sig_status(ftdm_channel_t *ftdmchan, ftdm_signaling_status sig.span_id = ftdmchan->span_id; sig.channel = ftdmchan; sig.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sig.raw_data = &status; + sig.sigstatus = status; ftdm_span_send_signal(ftdmchan->span, &sig); return; } commit 3f3d412b4b4ebdec6a699d19e08d8aede5880bb9 Author: Moises Silva <moy@sangoma.com> Date: Tue Aug 31 18:13:56 2010 -0400 freetdm: add asynchronous signal notification diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index b087881..7f27177 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -51,6 +51,7 @@ #include "ftdm_cpu_monitor.h" #define SPAN_PENDING_CHANS_QUEUE_SIZE 1000 +#define SPAN_PENDING_SIGNALS_QUEUE_SIZE 1000 #define FTDM_READ_TRACE_INDEX 0 #define FTDM_WRITE_TRACE_INDEX 1 @@ -461,6 +462,9 @@ static ftdm_status_t ftdm_span_destroy(ftdm_span_t *span) if (span->pendingchans) { ftdm_queue_destroy(&span->pendingchans); } + if (span->pendingsignals) { + ftdm_queue_destroy(&span->pendingsignals); + } ftdm_mutex_unlock(span->mutex); ftdm_mutex_destroy(&span->mutex); ftdm_safe_free(span->signal_data); @@ -4160,6 +4164,9 @@ static ftdm_status_t post_configure_span_channels(ftdm_span_t *span) if (ftdm_test_flag(span, FTDM_SPAN_USE_CHAN_QUEUE)) { status = ftdm_queue_create(&span->pendingchans, SPAN_PENDING_CHANS_QUEUE_SIZE); } + if (status == FTDM_SUCCESS && ftdm_test_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE)) { + status = ftdm_queue_create(&span->pendingsignals, SPAN_PENDING_SIGNALS_QUEUE_SIZE); + } return status; } @@ -4425,10 +4432,39 @@ FT_DECLARE(ftdm_status_t) ftdm_group_create(ftdm_group_t **group, const char *na return status; } -FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t *sigmsg) +static ftdm_status_t ftdm_span_trigger_signal(const ftdm_span_t *span, ftdm_sigmsg_t *sigmsg) { - ftdm_status_t status = FTDM_FAIL; + return span->signal_cb(sigmsg); +} + +static ftdm_status_t ftdm_span_queue_signal(const ftdm_span_t *span, ftdm_sigmsg_t *sigmsg) +{ + ftdm_sigmsg_t *new_sigmsg = NULL; + + ftdm_assert_return((sigmsg->raw_data == NULL), FTDM_FAIL, "No raw data should be used with asynchronous notification\n"); + + new_sigmsg = ftdm_calloc(1, sizeof(*sigmsg)); + if (!new_sigmsg) { + return FTDM_FAIL; + } + memcpy(new_sigmsg, sigmsg, sizeof(*sigmsg)); + + ftdm_queue_enqueue(span->pendingsignals, new_sigmsg); + return FTDM_SUCCESS; +} +FT_DECLARE(ftdm_status_t) ftdm_span_trigger_signals(const ftdm_span_t *span) +{ + ftdm_sigmsg_t *sigmsg = NULL; + while ((sigmsg = ftdm_queue_dequeue(span->pendingsignals))) { + ftdm_span_trigger_signal(span, sigmsg); + ftdm_safe_free(sigmsg); + } + return FTDM_SUCCESS; +} + +FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t *sigmsg) +{ if (sigmsg->channel) { ftdm_mutex_lock(sigmsg->channel->mutex); } @@ -4463,10 +4499,12 @@ FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t break; } - - /* call the user callback only if set */ - if (span->signal_cb) { - status = span->signal_cb(sigmsg); + + /* if the signaling module uses a queue for signaling notifications, then enqueue it */ + if (ftdm_test_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE)) { + ftdm_span_queue_signal(span, sigmsg); + } else { + ftdm_span_trigger_signal(span, sigmsg); } done: @@ -4474,7 +4512,7 @@ done: ftdm_mutex_unlock(sigmsg->channel->mutex); } - return status; + return FTDM_SUCCESS; } static void *ftdm_cpu_monitor_run(ftdm_thread_t *me, void *obj) diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 61d37c8..7501bb4 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -331,23 +331,6 @@ typedef struct ftdm_channel_config { float txgain; } ftdm_channel_config_t; -/*! \brief Generic signaling message */ -struct ftdm_sigmsg { - ftdm_signal_event_t event_id; /*!< The type of message */ - ftdm_channel_t *channel; /*!< Related channel */ - uint32_t chan_id; /*!< easy access to chan id */ - uint32_t span_id; /*!< easy access to span_id */ - void *raw_data; /*!< Message specific data if any */ - uint32_t raw_data_len; /*!< Data len in case is needed */ -}; - -/*! \brief Crash policy - * Useful for debugging only, default policy is never, if you wish to crash on asserts then use ftdm_global_set_crash_policy */ -typedef enum { - FTDM_CRASH_NEVER = 0, - FTDM_CRASH_ON_ASSERT -} ftdm_crash_policy_t; - /*! \brief Signaling status on a given span or specific channel on protocols that support it */ @@ -366,6 +349,24 @@ typedef enum { /*! \brief Move from string to ftdm_signaling_status_t and viceversa */ FTDM_STR2ENUM_P(ftdm_str2ftdm_signaling_status, ftdm_signaling_status2str, ftdm_signaling_status_t) +/*! \brief Generic signaling message */ +struct ftdm_sigmsg { + ftdm_signal_event_t event_id; /*!< The type of message */ + ftdm_channel_t *channel; /*!< Related channel */ + uint32_t chan_id; /*!< easy access to chan id */ + uint32_t span_id; /*!< easy access to span_id */ + ftdm_signaling_status_t sigstatus; /*!< Signaling status (valid if event_id is FTDM_SIGEVENT_SIGSTATUS_CHANGED) */ + void *raw_data; /*!< Message specific data if any */ + uint32_t raw_data_len; /*!< Data len in case is needed */ +}; + +/*! \brief Crash policy + * Useful for debugging only, default policy is never, if you wish to crash on asserts then use ftdm_global_set_crash_policy */ +typedef enum { + FTDM_CRASH_NEVER = 0, + FTDM_CRASH_ON_ASSERT +} ftdm_crash_policy_t; + /*! \brief I/O waiting flags */ typedef enum { FTDM_NO_FLAGS = 0, diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index eb9a84a..74bea81 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -466,6 +466,7 @@ struct ftdm_span { ftdm_state_map_t *state_map; ftdm_caller_data_t default_caller_data; ftdm_queue_t *pendingchans; + ftdm_queue_t *pendingsignals; struct ftdm_span *next; }; @@ -579,6 +580,9 @@ FT_DECLARE(ftdm_status_t) ftdm_span_next_event(ftdm_span_t *span, ftdm_event_t * */ FT_DECLARE(ftdm_status_t) ftdm_channel_queue_dtmf(ftdm_channel_t *ftdmchan, const char *dtmf); +/* dequeue pending signals and notify the user via the span signal callback */ +FT_DECLARE(ftdm_status_t) ftdm_span_trigger_signals(const ftdm_span_t *span); + /*! \brief Assert condition */ diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index 572e632..d8e8b5c 100644 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -176,6 +176,10 @@ typedef enum { FTDM_SPAN_USE_CHAN_QUEUE = (1 << 6), FTDM_SPAN_SUGGEST_CHAN_ID = (1 << 7), FTDM_SPAN_USE_AV_RATE = (1 << 8), + /* If you use this flag, you MUST call ftdm_span_trigger_signals to deliver the user signals + * after having called ftdm_send_span_signal(), which with this flag it will just enqueue the signal + * for later delivery */ + FTDM_SPAN_USE_SIGNALS_QUEUE = (1 << 9), } ftdm_span_flag_t; /*! \brief Channel supported features */ commit 6eca0263429902853acf3647503424446f52f3a8 Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Sep 2 11:24:40 2010 -0500 fix build for changes in 46c6650a947a4d1733058ecfb2e7f9e098f847aa diff --git a/src/mod/endpoints/mod_h323/mod_h323.cpp b/src/mod/endpoints/mod_h323/mod_h323.cpp index 45a9043..aeee422 100644 --- a/src/mod/endpoints/mod_h323/mod_h323.cpp +++ b/src/mod/endpoints/mod_h323/mod_h323.cpp @@ -614,7 +614,7 @@ H323Connection *FSH323EndPoint::CreateConnection( } switch_core_session_t *fsSession = switch_core_session_request(GetSwitchInterface(), - (switch_caller_profile_t *)userData ? SWITCH_CALL_DIRECTION_OUTBOUND : SWITCH_CALL_DIRECTION_INBOUND, NULL); + (switch_caller_profile_t *)userData ? SWITCH_CALL_DIRECTION_OUTBOUND : SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL); if (fsSession == NULL) return NULL; commit 874aaf1f861f7b586c89b2cc8eaa8a2c9674bbd2 Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Sep 2 11:12:49 2010 -0500 mod_managed build tweak for windows vs2010 diff --git a/src/mod/languages/mod_managed/mod_managed.2010.vcxproj b/src/mod/languages/mod_managed/mod_managed.2010.vcxproj index 76ce260..ee1f7d7 100644 --- a/src/mod/languages/mod_managed/mod_managed.2010.vcxproj +++ b/src/mod/languages/mod_managed/mod_managed.2010.vcxproj @@ -319,11 +319,9 @@ <ItemGroup> <ProjectReference Include="..\..\..\..\w32\Library\FreeSwitchCore.2010.vcxproj"> <Project>{202d7a4e-760d-4d0e-afa1-d7459ced30ff}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> </ProjectReference> - <ProjectReference Include="managed\FreeSWITCH.Managed.csproj"> + <ProjectReference Include="managed\FreeSWITCH.Managed.2010.csproj"> <Project>{834e2b2f-5483-4b80-8fe3-fe48ff76e5c0}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> </ProjectReference> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> commit ecfc4714e352d90e9eafeffd0daa8d734b41ebaf Merge: ce34d86 a278b6b Author: Moises Silva <moy@sangoma.com> Date: Thu Sep 2 12:12:07 2010 -0400 Merge branch 'ftdm-core-sigdata' commit a6e7bd534dc67d06c68206151690f13a4b8168e4 Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Sep 2 11:11:51 2010 -0500 fix build for windows diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 76024b8..ada05e7 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -1072,7 +1072,7 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_enumerate_available(const { switch_dir_t *dir = NULL; switch_status_t status; - char buffer[PATH_MAX]; + char buffer[256]; const char *fname; const char *fname_ext; char *fname_base; commit a278b6b403cc58e65dae32ca7ded444746e0cab3 Author: Moises Silva <moy@sangoma.com> Date: Wed Sep 1 14:42:34 2010 -0400 freetdm: added channel variable iterator for signaling specific data diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 890d9d9..0117fce 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -40,7 +40,7 @@ #define FREETDM_LIMIT_REALM "__freetdm" #define FREETDM_VAR_PREFIX "freetdm_" -#define FREETDM_VAR_PREFIX_LEN 8 +#define FREETDM_VAR_PREFIX_LEN (sizeof(FREETDM_VAR_PREFIX)-1) SWITCH_MODULE_LOAD_FUNCTION(mod_freetdm_load); SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_freetdm_shutdown); @@ -1302,11 +1302,14 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi } } - ftdm_channel_clear_vars(ftdmchan); + span_id = ftdm_channel_get_span_id(ftdmchan); + chan_id = ftdm_channel_get_id(ftdmchan); + for (h = var_event->headers; h; h = h->next) { if (!strncasecmp(h->name, FREETDM_VAR_PREFIX, FREETDM_VAR_PREFIX_LEN)) { char *v = h->name + FREETDM_VAR_PREFIX_LEN; if (!zstr(v)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding outbound freetdm variable %s=%s to channel %d:%d\n", v, h->value, span_id, chan_id); ftdm_channel_add_var(ftdmchan, v, h->value); } } @@ -1317,9 +1320,6 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi switch_caller_profile_t *caller_profile; switch_channel_t *channel = switch_core_session_get_channel(*new_session); - span_id = ftdm_channel_get_span_id(ftdmchan); - chan_id = ftdm_channel_get_id(ftdmchan); - switch_core_session_add_stream(*new_session, NULL); if ((tech_pvt = (private_t *) switch_core_session_alloc(*new_session, sizeof(private_t))) != 0) { tech_init(tech_pvt, *new_session, ftdmchan); @@ -1403,6 +1403,9 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session switch_core_session_t *session = NULL; private_t *tech_pvt = NULL; switch_channel_t *channel = NULL; + ftdm_iterator_t *iter = NULL; + const char *var_name = NULL; + const char *var_value = NULL; uint32_t spanid, chanid; char name[128]; ftdm_caller_data_t *channel_caller_data = ftdm_channel_get_caller_data(sigmsg->channel); @@ -1511,6 +1514,13 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session if (channel_caller_data->raw_data_len) { switch_channel_set_variable_printf(channel, "freetdm_custom_call_data", "%s", channel_caller_data->raw_data); } + /* Add any channel variable to the dial plan */ + iter = ftdm_channel_get_var_iterator(sigmsg->channel); + for ( ; iter; iter = ftdm_iterator_next(iter)) { + ftdm_channel_get_current_var(iter, &var_name, &var_value); + snprintf(name, sizeof(name), FREETDM_VAR_PREFIX "%s", var_name); + switch_channel_set_variable_printf(channel, name, "%s", var_value); + } switch_channel_set_state(channel, CS_INIT); if (switch_core_session_thread_launch(session) != SWITCH_STATUS_SUCCESS) { diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 238a9fc..b087881 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -400,8 +400,6 @@ static ftdm_status_t ftdm_channel_destroy(ftdm_channel_t *ftdmchan) ftdm_buffer_destroy(&ftdmchan->fsk_buffer); ftdmchan->pre_buffer_size = 0; - hashtable_destroy(ftdmchan->variable_hash); - ftdm_safe_free(ftdmchan->dtmf_hangup_buf); if (ftdmchan->tone_session.buffer) { @@ -812,7 +810,6 @@ FT_DECLARE(ftdm_status_t) ftdm_span_add_channel(ftdm_span_t *span, ftdm_socket_t ftdm_buffer_create(&new_chan->digit_buffer, 128, 128, 0); ftdm_buffer_create(&new_chan->gen_dtmf_buffer, 128, 128, 0); - new_chan->variable_hash = create_hashtable(16, ftdm_hash_hashfromstring, ftdm_hash_equalkeys); new_chan->dtmf_hangup_buf = ftdm_calloc (span->dtmf_hangup_len + 1, sizeof (char)); @@ -2213,9 +2210,10 @@ static void close_dtmf_debug(ftdm_channel_t *ftdmchan) } #endif +static ftdm_status_t ftdm_channel_clear_vars(ftdm_channel_t *ftdmchan); FT_DECLARE(ftdm_status_t) ftdm_channel_done(ftdm_channel_t *ftdmchan) { - assert(ftdmchan != NULL); + ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "Null channel can't be done!\n"); ftdm_mutex_lock(ftdmchan->mutex); @@ -2243,6 +2241,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_done(ftdm_channel_t *ftdmchan) #ifdef FTDM_DEBUG_DTMF close_dtmf_debug(ftdmchan); #endif + ftdm_channel_clear_vars(ftdmchan); ftdmchan->init_state = FTDM_CHANNEL_STATE_DOWN; ftdmchan->state = FTDM_CHANNEL_STATE_DOWN; @@ -3368,8 +3367,8 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_write(ftdm_channel_t *ftdmchan, void *dat ftdm_size_t max = datasize; unsigned int i = 0; - assert(ftdmchan != NULL); - assert(ftdmchan->fio != NULL); + ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "null channel on write!\n"); + ftdm_assert_return(ftdmchan->fio != NULL, FTDM_FAIL, "null I/O on write!\n"); if (!ftdmchan->buffer_delay && ((ftdmchan->dtmf_buffer && ftdm_buffer_inuse(ftdmchan->dtmf_buffer)) || @@ -3421,16 +3420,16 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_write(ftdm_channel_t *ftdmchan, void *dat return status; } -FT_DECLARE(ftdm_status_t) ftdm_channel_clear_vars(ftdm_channel_t *ftdmchan) +static ftdm_status_t ftdm_channel_clear_vars(ftdm_channel_t *ftdmchan) { - if(ftdmchan->variable_hash) { + ftdm_channel_lock(ftdmchan); + + if (ftdmchan->variable_hash) { hashtable_destroy(ftdmchan->variable_hash); } - ftdmchan->variable_hash = create_hashtable(16, ftdm_hash_hashfromstring, ftdm_hash_equalkeys); + ftdmchan->variable_hash = NULL; - if(!ftdmchan->variable_hash) - return FTDM_FAIL; - + ftdm_channel_unlock(ftdmchan); return FTDM_SUCCESS; } @@ -3438,34 +3437,98 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_add_var(ftdm_channel_t *ftdmchan, const c { char *t_name = 0, *t_val = 0; - if(!ftdmchan->variable_hash || !var_name || !value) - { + ftdm_status_t status = FTDM_FAIL; + + if (!var_name || !value) { return FTDM_FAIL; } + ftdm_channel_lock(ftdmchan); + + if (!ftdmchan->variable_hash) { + /* initialize on first use */ + ftdmchan->variable_hash = create_hashtable(16, ftdm_hash_hashfromstring, ftdm_hash_equalkeys); + if (!ftdmchan->variable_hash) { + goto done; + } + } + t_name = ftdm_strdup(var_name); t_val = ftdm_strdup(value); - if(hashtable_insert(ftdmchan->variable_hash, t_name, t_val, HASHTABLE_FLAG_FREE_KEY | HASHTABLE_FLAG_FREE_VALUE)) { - return FTDM_SUCCESS; - } - return FTDM_FAIL; + hashtable_insert(ftdmchan->variable_hash, t_name, t_val, HASHTABLE_FLAG_FREE_KEY | HASHTABLE_FLAG_FREE_VALUE); + + status = FTDM_SUCCESS; + +done: + ftdm_channel_unlock(ftdmchan); + + return status; } FT_DECLARE(const char *) ftdm_channel_get_var(ftdm_channel_t *ftdmchan, const char *var_name) { - if(!ftdmchan->variable_hash || !var_name) - { + const char *var = NULL; + + ftdm_channel_lock(ftdmchan); + + if (!ftdmchan->variable_hash || !var_name) { + goto done; + } + + var = (const char *)hashtable_search(ftdmchan->variable_hash, (void *)var_name); + +done: + ftdm_channel_unlock(ftdmchan); + + return var; +} + +FT_DECLARE(ftdm_iterator_t *) ftdm_channel_get_var_iterator(const ftdm_channel_t *ftdmchan) +{ + ftdm_hash_iterator_t *iter = NULL; + + ftdm_channel_lock(ftdmchan); + + iter = ftdmchan->variable_hash == NULL ? NULL : hashtable_first(ftdmchan->variable_hash); + + ftdm_channel_unlock(ftdmchan); + + return iter; +} + +FT_DECLARE(ftdm_status_t) ftdm_channel_get_current_var(ftdm_iterator_t *iter, const char **var_name, const char **var_val) +{ + const void *key = NULL; + void *val = NULL; + + *var_name = NULL; + *var_val = NULL; + + if (!iter) { + return FTDM_FAIL; + } + + hashtable_this(iter, &key, NULL, &val); + + *var_name = key; + *var_val = val; + + return FTDM_SUCCESS; +} + +FT_DECLARE(ftdm_iterator_t *) ftdm_iterator_next(ftdm_iterator_t *iter) +{ + if (!iter) { return NULL; } - return (const char *) hashtable_search(ftdmchan->variable_hash, (void *)var_name); + return hashtable_next(iter); } static struct { ftdm_io_interface_t *pika_interface; } interfaces; - FT_DECLARE(char *) ftdm_api_execute(const char *cmd) { ftdm_io_interface_t *fio = NULL; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index b47660b..a98429d 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -35,7 +35,6 @@ #include "ftmod_sangoma_isdn.h" -#define FTDM_DEBUG_CHAN_MEMORY #ifdef FTDM_DEBUG_CHAN_MEMORY #include <sys/mman.h> @@ -472,7 +471,10 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) case FTDM_CHANNEL_STATE_RING: /* incoming call request */ { ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending incoming call from %s to %s to FTDM core\n", ftdmchan->caller_data.ani.digits, ftdmchan->caller_data.dnis.digits); - + ftdm_channel_add_var(ftdmchan, "isdn_specific_var", "1"); + ftdm_channel_add_var(ftdmchan, "isdn_crap", "morecrap"); + ftdm_channel_add_var(ftdmchan, "isdn_stuff", "s"); + ftdm_channel_add_var(ftdmchan, "isdn_d", "asdsadasdasdsad"); /* we have enough information to inform FTDM of the call*/ sigev.event_id = FTDM_SIGEVENT_START; ftdm_span_send_signal(ftdmchan->span, &sigev); diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 132fd30..61d37c8 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -381,6 +381,9 @@ typedef struct ftdm_conf_parameter { void *ptr; } ftdm_conf_parameter_t; +/*! \brief Opaque general purpose iterator */ +typedef void ftdm_iterator_t; + /*! \brief Channel commands that can be executed through ftdm_channel_command() */ typedef enum { FTDM_COMMAND_NOOP, @@ -1014,14 +1017,25 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_read(ftdm_channel_t *ftdmchan, void *data */ FT_DECLARE(ftdm_status_t) ftdm_channel_write(ftdm_channel_t *ftdmchan, void *data, ftdm_size_t datasize, ftdm_size_t *datalen); -/*! \brief Add a custom variable to the channel */ +/*! \brief Add a custom variable to the channel + * \note This variables may be used by signaling modules to override signaling parameters + * \todo Document which signaling variables are available + * */ FT_DECLARE(ftdm_status_t) ftdm_channel_add_var(ftdm_channel_t *ftdmchan, const char *var_name, const char *value); -/*! \brief Get a custom variable from the channel */ +/*! \brief Get a custom variable from the channel. + * \note The variable pointer returned is only valid while the channel is open and it'll be destroyed when the channel is closed. */ FT_DECLARE(const char *) ftdm_channel_get_var(ftdm_channel_t *ftdmchan, const char *var_name); -/*! \brief Clear custom channel variables from the channel */ -FT_DECLARE(ftdm_status_t) ftdm_channel_clear_vars(ftdm_channel_t *ftdmchan); +/*! \brief Get an iterator to iterate over the channel variables + * \note The iterator pointer returned is only valid while the channel is open and it'll be destroyed when the channel is closed. */ +FT_DECLARE(ftdm_iterator_t *) ftdm_channel_get_var_iterator(const ftdm_channel_t *ftdmchan); + +/*! \brief Get variable name and value for the current iterator position */ +FT_DECLARE(ftdm_status_t) ftdm_channel_get_current_var(ftdm_iterator_t *iter, const char **var_name, const char **var_val); + +/*! \brief Advance iterator */ +FT_DECLARE(ftdm_iterator_t *) ftdm_iterator_next(ftdm_iterator_t *iter); /*! \brief Get the span pointer associated to the channel */ FT_DECLARE(ftdm_span_t *) ftdm_channel_get_span(const ftdm_channel_t *ftdmchan); diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index 95f34b4..eb9a84a 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -579,7 +579,6 @@ FT_DECLARE(ftdm_status_t) ftdm_span_next_event(ftdm_span_t *span, ftdm_event_t * */ FT_DECLARE(ftdm_status_t) ftdm_channel_queue_dtmf(ftdm_channel_t *ftdmchan, const char *dtmf); - /*! \brief Assert condition */ commit d68a12188c2937b2945f592671fa1c21b551b732 Author: Brian West <brian@freeswitch.org> Date: Thu Sep 2 10:39:52 2010 -0500 FSCORE-662 diff --git a/src/include/switch_loadable_module.h b/src/include/switch_loadable_module.h index 158de6c..6871906 100644 --- a/src/include/switch_loadable_module.h +++ b/src/include/switch_loadable_module.h @@ -121,6 +121,25 @@ SWITCH_DECLARE(switch_codec_interface_t *) switch_loadable_module_get_codec_inte SWITCH_DECLARE(switch_dialplan_interface_t *) switch_loadable_module_get_dialplan_interface(const char *name); /*! + \brief Enumerates a list of all modules discovered in a directory + \param the directory to look for modules in + \param memory pool + \param callback function to call for each module found + \param user data argument to pass to the callback function + \return the resulting status + */ +SWITCH_DECLARE(switch_status_t) switch_loadable_module_enumerate_available(const char *dir_path, switch_modulename_callback_func_t callback, void *user_data); + + +/*! + \brief Enumerates a list of all currently loaded modules + \param callback function to call for each module found + \param user data argument to pass to the callback function + \return the resulting status + */ +SWITCH_DECLARE(switch_status_t) switch_loadable_module_enumerate_loaded(switch_modulename_callback_func_t callback, void *user_data); + +/*! \brief build a dynamic module object and register it (for use in double embeded modules) \param filename the name of the modules source file \param switch_module_load the function to call when the module is loaded diff --git a/src/include/switch_types.h b/src/include/switch_types.h index dacf2dd..5a88cd5 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1731,6 +1731,8 @@ typedef struct switch_loadable_module_function_table { switch_module_flag_t flags; } switch_loadable_module_function_table_t; +typedef int (*switch_modulename_callback_func_t) (void *user_data, const char *module_name); + #define SWITCH_MODULE_DEFINITION_EX(name, load, shutdown, runtime, flags) \ static const char modname[] = #name ; \ SWITCH_MOD_DECLARE_DATA switch_loadable_module_function_table_t name##_module_interface = { \ diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index cc864a2..e1eb2a6 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -4651,9 +4651,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) switch_console_set_complete("add fsctl flush_db_handles"); switch_console_set_complete("add fsctl min_idle_cpu"); switch_console_set_complete("add fsctl send_sighup"); + switch_console_set_complete("add load ::console::list_available_modules"); switch_console_set_complete("add nat_map reinit"); switch_console_set_complete("add nat_map republish"); switch_console_set_complete("add nat_map status"); + switch_console_set_complete("add reload ::console::list_loaded_modules"); switch_console_set_complete("add reloadacl reloadxml"); switch_console_set_complete("add show aliases"); switch_console_set_complete("add show api"); @@ -4678,6 +4680,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) switch_console_set_complete("add show timer"); switch_console_set_complete("add shutdown"); switch_console_set_complete("add sql_escape"); + switch_console_set_complete("add unload ::console::list_loaded_modules"); switch_console_set_complete("add uuid_audio ::console::list_uuid start read mute"); switch_console_set_complete("add uuid_audio ::console::list_uuid start read level"); switch_console_set_complete("add uuid_audio ::console::list_uuid start write mute"); diff --git a/src/switch_console.c b/src/switch_console.c index e82290b..30d1d97 100644 --- a/src/switch_console.c +++ b/src/switch_console.c @@ -553,6 +553,46 @@ struct match_helper { switch_console_callback_match_t *my_matches; }; +static int modulename_callback(void *pArg, const char *module_name) +{ + struct match_helper *h = (struct match_helper *) pArg; + + switch_console_push_match(&h->my_matches, module_name); + return 0; +} + +SWITCH_DECLARE_NONSTD(switch_status_t) switch_console_list_available_modules(const char *line, const char *cursor, switch_console_callback_match_t **matches) +{ + struct match_helper h = { 0 }; + + if (switch_loadable_module_enumerate_available(SWITCH_GLOBAL_dirs.mod_dir, modulename_callback, &h) != SWITCH_STATUS_SUCCESS) { + return SWITCH_STATUS_GENERR; + } + + if (h.my_matches) { + *matches = h.my_matches; + return SWITCH_STATUS_SUCCESS; + } + + return SWITCH_STATUS_FALSE; +} + +SWITCH_DECLARE_NONSTD(switch_status_t) switch_console_list_loaded_modules(const char *line, const char *cursor, switch_console_callback_match_t **matches) +{ + struct match_helper h = { 0 }; + + if (switch_loadable_module_enumerate_loaded(modulename_callback, &h) != SWITCH_STATUS_SUCCESS) { + return SWITCH_STATUS_GENERR; + } + + if (h.my_matches) { + *matches = h.my_matches; + return SWITCH_STATUS_SUCCESS; + } + + return SWITCH_STATUS_FALSE; +} + static int uuid_callback(void *pArg, int argc, char **argv, char **columnNames) { struct match_helper *h = (struct match_helper *) pArg; @@ -1542,6 +1582,8 @@ SWITCH_DECLARE(switch_status_t) switch_console_init(switch_memory_pool_t *pool) { switch_mutex_init(&globals.func_mutex, SWITCH_MUTEX_NESTED, pool); switch_core_hash_init(&globals.func_hash, pool); + switch_console_add_complete_func("::console::list_available_modules", (switch_console_complete_callback_t) switch_console_list_available_modules); + switch_console_add_complete_func("::console::list_loaded_modules", (switch_console_complete_callback_t) switch_console_list_loaded_modules); switch_console_add_complete_func("::console::list_uuid", (switch_console_complete_callback_t) switch_console_list_uuid); return SWITCH_STATUS_SUCCESS; } diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 97cb5e8..76024b8 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -1068,6 +1068,62 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_unload_module(char *dir, } +SWITCH_DECLARE(switch_status_t) switch_loadable_module_enumerate_available(const char *dir_path, switch_modulename_callback_func_t callback, void *user_data) +{ + switch_dir_t *dir = NULL; + switch_status_t status; + char buffer[PATH_MAX]; + const char *fname; + const char *fname_ext; + char *fname_base; + +#ifdef WIN32 + const char *ext = ".dll"; +#else + const char *ext = ".so"; +#endif + + if ((status = switch_dir_open(&dir, dir_path, loadable_modules.pool)) != SWITCH_STATUS_SUCCESS) { + return status; + } + + while((fname = switch_dir_next_file(dir, buffer, sizeof(buffer)))) { + if ((fname_ext = strrchr(fname, '.'))) { + if (!strcmp(fname_ext, ext)) { + if (!(fname_base = switch_mprintf("%.*s", (int)(fname_ext-fname), fname))) { + status = SWITCH_STATUS_GENERR; + goto end; + } + callback(user_data, fname_base); + switch_safe_free(fname_base) + } + } + } + + + end: + switch_dir_close(dir); + return status; +} + +SWITCH_DECLARE(switch_status_t) switch_loadable_module_enumerate_loaded(switch_modulename_callback_func_t callback, void *user_data) +{ + switch_hash_index_t *hi; + void *val; + switch_loadable_module_t *module; + + switch_mutex_lock(loadable_modules.mutex); + for (hi = switch_hash_first(NULL, loadable_modules.module_hash); hi; hi = switch_hash_next(hi)) { + switch_hash_this(hi, NULL, NULL, &val); + module = (switch_loadable_module_t *) val; + + callback(user_data, module->module_interface->module_name); + } + switch_mutex_unlock(loadable_modules.mutex); + + return SWITCH_STATUS_SUCCESS; +} + SWITCH_DECLARE(switch_status_t) switch_loadable_module_build_dynamic(char *filename, switch_module_load_t switch_module_load, switch_module_runtime_t switch_module_runtime, commit f8daa1126a11f528e97514f16229b34d9e55f804 Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Sep 2 09:02:15 2010 -0500 Move FreeSWITCH.Managed to correct location diff --git a/Freeswitch.2010.sln b/Freeswitch.2010.sln index 7e0733c..c865b68 100644 --- a/Freeswitch.2010.sln +++ b/Freeswitch.2010.sln @@ -1771,12 +1771,12 @@ Global {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.All|x64.ActiveCfg = Release|Any CPU {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|Win32.ActiveCfg = Debug|Any CPU {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|Win32.Build.0 = Debug|Any CPU - {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x64.ActiveCfg = Debug|Any CPU - {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x64.Build.0 = Debug|Any CPU + {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x64.ActiveCfg = Debug|x64 + {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Debug|x64.Build.0 = Debug|x64 {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|Win32.ActiveCfg = Release|Any CPU {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|Win32.Build.0 = Release|Any CPU - {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x64.ActiveCfg = Release|Any CPU - {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x64.Build.0 = Release|Any CPU + {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x64.ActiveCfg = Release|x64 + {834E2B2F-5483-4B80-8FE3-FE48FF76E5C0}.Release|x64.Build.0 = Release|x64 {E796E337-DE78-4303-8614-9A590862EE95}.All|Win32.ActiveCfg = Release|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.All|Win32.Build.0 = Release|Win32 {E796E337-DE78-4303-8614-9A590862EE95}.All|x64.ActiveCfg = Release|Win32 diff --git a/src/mod/languages/mod_managed/managed/FreeSWITCH.Managed.2010.csproj b/src/mod/languages/mod_managed/managed/FreeSWITCH.Managed.2010.csproj index 740ae04..4c1382b 100644 --- a/src/mod/languages/mod_managed/managed/FreeSWITCH.Managed.2010.csproj +++ b/src/mod/languages/mod_managed/managed/FreeSWITCH.Managed.2010.csproj @@ -24,7 +24,7 @@ <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> - <OutputPath>..\..\..\..\..\managed\debug\</OutputPath> + <OutputPath>..\..\..\..\..\Win32\Debug\mod\</OutputPath> <DefineConstants>TRACE;DEBUG;CLR_VERSION40</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> @@ -32,11 +32,33 @@ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> <Optimize>true</Optimize> - <OutputPath>..\..\..\..\..\managed\release\</OutputPath> + <OutputPath>..\..\..\..\..\Win32\Release\mod\</OutputPath> <DefineConstants>TRACE;CLR_VERSION40</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> + <DebugSymbols>true</DebugSymbols> + <OutputPath>..\..\..\..\..\x64\Debug\mod\</OutputPath> + <DefineConstants>TRACE;DEBUG;CLR_VERSION40</DefineConstants> + <DebugType>full</DebugType> + <PlatformTarget>x64</PlatformTarget> + <ErrorReport>prompt</ErrorReport> + <CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets> + <CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules> + <CodeAnalysisFailOnMissingRules>true</CodeAnalysisFailOnMissingRules> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> + <OutputPath>..\..\..\..\..\x64\Release\mod\</OutputPath> + <DefineConstants>TRACE;CLR_VERSION40</DefineConstants> + <Optimize>true</Optimize> + <DebugType>pdbonly</DebugType> + <PlatformTarget>x64</PlatformTarget> + <ErrorReport>prompt</ErrorReport> + <CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets> + <CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules> + <CodeAnalysisFailOnMissingRules>true</CodeAnalysisFailOnMissingRules> + </PropertyGroup> <ItemGroup> <Reference Include="System" /> <Reference Include="System.Core"> commit 4a7425efd8889d5c12adacf26ce9c1819c450063 Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Sep 2 08:26:57 2010 -0500 fix build for changes in 46c6650a947a4d1733058ecfb2e7f9e098f847aa diff --git a/src/mod/endpoints/mod_opal/mod_opal.cpp b/src/mod/endpoints/mod_opal/mod_opal.cpp index e38e113..8935bbb 100644 --- a/src/mod/endpoints/mod_opal/mod_opal.cpp +++ b/src/mod/endpoints/mod_opal/mod_opal.cpp @@ -513,7 +513,7 @@ OpalLocalConnection *FSEndPoint::CreateConnection(OpalCall & call, void *userDat { FSManager & mgr = (FSManager &) GetManager(); switch_core_session_t *fsSession = switch_core_session_request(mgr.GetSwitchInterface(), - (switch_caller_profile_t *)userData ? SWITCH_CALL_DIRECTION_OUTBOUND : SWITCH_CALL_DIRECTION_INBOUND, NULL); + (switch_caller_profile_t *)userData ? SWITCH_CALL_DIRECTION_OUTBOUND : SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL); if (fsSession == NULL) return NULL; commit f65a85106d61e6d024b2ac6a3a42ecb82001a682 Author: Brian West <brian@freeswitch.org> Date: Thu Sep 2 08:22:22 2010 -0500 doh diff --git a/src/switch_resample.c b/src/switch_resample.c index c3c7610..65ebe3c 100644 --- a/src/switch_resample.c +++ b/src/switch_resample.c @@ -26,7 +26,7 @@ * Anthony Minessale II <anthm@freeswitch.org> * * - * switch_resample.c -- Caller Identification + * switch_resample.c -- Resampler * */ commit 5a0114a16f7493b6d67e23bdb6ff1b69a2fe323d Author: root <root@proxy-2.(none)> Date: Thu Sep 2 17:05:35 2010 +0400 add compiling.txt diff --git a/src/mod/endpoints/mod_h323/changes.txt b/src/mod/endpoints/mod_h323/changes.txt index 9dfda1e..ff47780 100644 --- a/src/mod/endpoints/mod_h323/changes.txt +++ b/src/mod/endpoints/mod_h323/changes.txt @@ -1,4 +1,3 @@ -set network_addr of caller profile to signaling ip address. (requested by Steven Ayre) move PTrace level set to FSH323EndPoint::Initialise partially apply patch from from Peter Olsson, Remove UnLock() when TryLock() failed and DEBUG_RTP_PACKETS directive. apply changes from mod_h323-patch.diff by Peter Olsson. diff --git a/src/mod/endpoints/mod_h323/compiling.txt b/src/mod/endpoints/mod_h323/compiling.txt new file mode 100644 index 0000000..91d547f --- /dev/null +++ b/src/mod/endpoints/mod_h323/compiling.txt @@ -0,0 +1 @@ +To compile this module use latest ptlib/h323plis combinations listed at http://www.gnugk.org/compiling-gnugk.html commit 8dbd62ff178e6dc63ebd532526a843fd19dce4a5 Author: Brian West <brian@freeswitch.org> Date: Wed Sep 1 17:59:22 2010 -0500 FSBUILD-301 diff --git a/bootstrap.sh b/bootstrap.sh index 59a5687..0ea5cd4 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -341,7 +341,7 @@ rm -rf autom4te*.cache echo "Entering directory ${LIBDIR}/apr-util" cd ${LIBDIR}/apr-util -if [ "${BGJOB}" == "false" ] ; then +if [ "${BGJOB}" = "false" ] ; then ./buildconf else ./buildconf & @@ -350,14 +350,14 @@ fi for i in ${SUBDIRS} do - if [ "${BGJOB}" == "false" ] ; then + if [ "${BGJOB}" = "false" ] ; then libbootstrap ${i} else libbootstrap ${i} & fi done -if [ "${BGJOB}" == "true" ] ; then +if [ "${BGJOB}" = "true" ] ; then wait fi cd ${BASEDIR} commit 8a6d0f68105496517a828a700dd97c267ecfb0ac Author: Brian West <brian@freeswitch.org> Date: Wed Sep 1 17:53:04 2010 -0500 Really? diff --git a/src/switch_resample.c b/src/switch_resample.c index 3264b9e..c3c7610 100644 --- a/src/switch_resample.c +++ b/src/switch_resample.c @@ -26,7 +26,7 @@ * Anthony Minessale II <anthm@freeswitch.org> * * - * switch_caller.c -- Caller Identification + * switch_resample.c -- Caller Identification * */ commit abb342f4305fd2eca9f92b046400a513664f7b68 Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Sep 1 16:35:59 2010 -0400 Initialized bearer_cap to FTDM_INVALID_INT_PARM diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 0d986f3..8b4dd68 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1230,14 +1230,10 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi freetdmvar = switch_channel_get_variable(channel, "freetdm_bearer_capability"); if (freetdmvar) { caller_data.bearer_capability = (uint8_t)atoi(freetdmvar); - } else { - caller_data.bearer_capability = FTDM_INVALID_INT_PARM; } freetdmvar = switch_channel_get_variable(channel, "freetdm_bearer_layer1"); if (freetdmvar) { caller_data.bearer_layer1 = (uint8_t)atoi(freetdmvar); - } else { - caller_data.bearer_layer1 = FTDM_INVALID_INT_PARM; } } @@ -3407,9 +3403,9 @@ static switch_status_t load_config(void) boost_span = boost_spans[i]; ftdm_log(FTDM_LOG_DEBUG, "Starting boost span %d\n", ftdm_span_get_id(boost_span)); if (ftdm_span_start(boost_span) == FTDM_FAIL) { - ftdm_log(FTDM_LOG_ERROR, "Error starting boost FreeTDM span %d, error: %s\n", - ftdm_span_get_id(boost_span), ftdm_span_get_last_error(boost_span)); - continue; + ftdm_log(FTDM_LOG_ERROR, "Error starting boost FreeTDM span %d, error: %s\n", + ftdm_span_get_id(boost_span), ftdm_span_get_last_error(boost_span)); + continue; } } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c index 1c49674..75513fb 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c @@ -187,6 +187,7 @@ void sngisdn_rcv_disc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, D !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); + ftdm_assert(0, "Inconsistent call states\n"); return; } @@ -219,6 +220,7 @@ void sngisdn_rcv_rel_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, Re !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); + ftdm_assert(0, "Inconsistent call states\n"); return; } @@ -250,7 +252,7 @@ void sngisdn_rcv_dat_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, In !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); - + ftdm_assert(0, "Inconsistent call states\n"); return; } @@ -282,7 +284,7 @@ void sngisdn_rcv_sshl_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, S !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); - + ftdm_assert(0, "Inconsistent call states\n"); return; } @@ -315,7 +317,7 @@ void sngisdn_rcv_sshl_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, S !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); - + ftdm_assert(0, "Inconsistent call states\n"); return; } @@ -347,7 +349,7 @@ void sngisdn_rcv_rmrt_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, R !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); - + ftdm_assert(0, "Inconsistent call states\n"); return; } @@ -380,7 +382,7 @@ void sngisdn_rcv_rmrt_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, R !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); - + ftdm_assert(0, "Inconsistent call states\n"); return; } @@ -413,7 +415,7 @@ void sngisdn_rcv_flc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, St !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); - + ftdm_assert(0, "Inconsistent call states\n"); return; } @@ -446,7 +448,7 @@ void sngisdn_rcv_fac_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, Fa !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); - + ftdm_assert(0, "Inconsistent call states\n"); return; } @@ -479,7 +481,7 @@ void sngisdn_rcv_sta_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, St !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); - + ftdm_assert(0, "Inconsistent call states\n"); return; } commit 9af30563e29bc250d2ef75d06e593774811e4699 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Sep 1 14:22:29 2010 -0500 make mod_dingaling compat with google's new free phonecalls thing diff --git a/libs/libdingaling/src/libdingaling.c b/libs/libdingaling/src/libdingaling.c index 353dd13..ef6e744 100644 --- a/libs/libdingaling/src/libdingaling.c +++ b/libs/libdingaling/src/libdingaling.c @@ -163,6 +163,7 @@ struct ldl_session { apr_hash_t *variables; apr_time_t created; void *private_data; + ldl_user_flag_t flags; }; static int on_disco_default(void *user_data, ikspak *pak); @@ -346,6 +347,7 @@ ldl_status ldl_session_create(ldl_session_t **session_p, ldl_handle_t *handle, c session->created = apr_time_now(); session->state = LDL_STATE_NEW; session->variables = apr_hash_make(session->pool); + session->flags = flags; *session_p = session; @@ -387,7 +389,24 @@ static ldl_status parse_session_code(ldl_handle_t *handle, char *id, char *from, if (type) { - if (!strcasecmp(type, "initiate") || !strcasecmp(type, "accept")) { + if (!strcasecmp(type, "redirect")) { + apr_hash_t *hash = session->handle->sessions; + char *p = to; + if ((p = strchr(to, ':'))) { + p++; + } else { + p = to; + } + + + apr_hash_set(hash, session->them, APR_HASH_KEY_STRING, NULL); + apr_hash_set(hash, session->id, APR_HASH_KEY_STRING, NULL); + session->them = apr_pstrdup(session->pool, p); + apr_hash_set(handle->sessions, session->them, APR_HASH_KEY_STRING, session); + apr_hash_set(handle->sessions, session->id, APR_HASH_KEY_STRING, session); + + dl_signal = LDL_SIGNAL_REDIRECT; + } else if (!strcasecmp(type, "initiate") || !strcasecmp(type, "accept")) { dl_signal = LDL_SIGNAL_INITIATE; @@ -499,6 +518,12 @@ static ldl_status parse_session_code(ldl_handle_t *handle, char *id, char *from, if ((key = iks_find_attrib(tag, "port"))) { session->candidates[index].port = (uint16_t)atoi(key); } + + if (!session->candidates[index].type) { + session->candidates[index].type = apr_pstrdup(session->pool, "stun"); + } + + if (globals.debug) { globals.logger(DL_LOG_DEBUG, "New Candidate %d\n" @@ -947,6 +972,18 @@ static void cancel_retry(ldl_handle_t *handle, char *id) apr_thread_mutex_unlock(handle->lock); } +static iks* working_find(iks *tag, const char *name) +{ + while(tag) { + if (!strcasecmp(iks_name(tag), name)) { + return tag; + } + tag = iks_next_tag(tag); + } + + return NULL; +} + static int on_commands(void *user_data, ikspak *pak) { ldl_handle_t *handle = user_data; @@ -956,8 +993,22 @@ static int on_commands(void *user_data, ikspak *pak) char *type = iks_find_attrib(pak->x, "type"); uint8_t is_result = strcasecmp(type, "result") ? 0 : 1; uint8_t is_error = strcasecmp(type, "error") ? 0 : 1; + iks *xml, *xsession, *xerror = NULL, *xredir = NULL; + + xml = iks_child (pak->x); + + if (is_error) { + if ((xerror = working_find(xml, "error"))) { + char *code = iks_find_attrib(xerror, "code"); + if (code && !strcmp(code, "302") && + ((xredir = iks_find(xerror, "ses:redirect")) || (xredir = iks_find(xerror, "redirect")))) { + is_result = 0; + is_error = 0; + cancel_retry(handle, iqid); + } + } + } - iks *xml; if (is_result) { iks *tag = iks_child (pak->x); @@ -989,9 +1040,12 @@ static int on_commands(void *user_data, ikspak *pak) } } + + if ((is_result || is_error) && iqid && from) { cancel_retry(handle, iqid); + if (is_result) { if (handle->response_callback) { handle->response_callback(handle, iqid); @@ -999,30 +1053,37 @@ static int on_commands(void *user_data, ikspak *pak) return IKS_FILTER_EAT; } else if (is_error) { return IKS_FILTER_EAT; + } } - xml = iks_child (pak->x); - while (xml) { - char *name = iks_name_nons(xml); - if (!strcasecmp(name, "session")) { - char *id = iks_find_attrib(xml, "id"); - //printf("SESSION type=%s name=%s id=%s\n", type, name, id); - if (parse_session_code(handle, id, from, to, xml, strcasecmp(type, "error") ? NULL : type) == LDL_STATUS_SUCCESS) { - iks *reply; - if ((reply = iks_make_iq(IKS_TYPE_RESULT, NULL))) { - iks_insert_attrib(reply, "to", from); - iks_insert_attrib(reply, "from", to); - iks_insert_attrib(reply, "id", iqid); - apr_queue_push(handle->queue, reply); - reply = NULL; - } + + if ((xsession = working_find(xml, "ses:session")) || (xsession = working_find(xml, "session"))) { + char *id; + + id = iks_find_attrib(xsession, "id"); + + if (xredir) { + to = iks_cdata(iks_child(xredir)); + type = "redirect"; + } + + if (strcasecmp(type, "error") && strcasecmp(type, "redirect")) { + type = NULL; + } + + if (parse_session_code(handle, id, from, to, xsession, type) == LDL_STATUS_SUCCESS) { + iks *reply; + if ((reply = iks_make_iq(IKS_TYPE_RESULT, NULL))) { + iks_insert_attrib(reply, "to", from); + iks_insert_attrib(reply, "from", to); + iks_insert_attrib(reply, "id", iqid); + apr_queue_push(handle->queue, reply); + reply = NULL; } } - xml = iks_next_tag(xml); } - return IKS_FILTER_EAT; } @@ -1922,6 +1983,69 @@ unsigned int ldl_session_terminate(ldl_session_t *session) } + +unsigned int ldl_session_transport(ldl_session_t *session, + ldl_candidate_t *candidates, + unsigned int clen) + +{ + iks *iq, *sess, *tag; + unsigned int x, id = 0; + + + for (x = 0; x < clen; x++) { + char buf[512]; + iq = NULL; + sess = NULL; + id = 0; + + new_session_iq(session, &iq, &sess, &id, "transport-info"); + //tag = iks_insert(sess, "transport"); + //iks_insert_attrib(tag, "xmlns", "http://www.google.com/transport/p2p"); + tag = sess; + + if (0) add_elements(session, tag); + tag = iks_insert(tag, "transport"); + iks_insert_attrib(tag, "xmlns", "http://www.google.com/transport/p2p"); + + tag = iks_insert(tag, "candidate"); + + if (candidates[x].name) { + iks_insert_attrib(tag, "name", candidates[x].name); + } + if (candidates[x].address) { + iks_insert_attrib(tag, "address", candidates[x].address); + } + if (candidates[x].port) { + snprintf(buf, sizeof(buf), "%u", candidates[x].port); + iks_insert_attrib(tag, "port", buf); + } + if (candidates[x].username) { + iks_insert_attrib(tag, "username", candidates[x].username); + } + if (candidates[x].password) { + iks_insert_attrib(tag, "password", candidates[x].password); + } + if (candidates[x].pref) { + snprintf(buf, sizeof(buf), "%0.1f", candidates[x].pref); + iks_insert_attrib(tag, "preference", buf); + } + if (candidates[x].protocol) { + iks_insert_attrib(tag, "protocol", candidates[x].protocol); + } + if (candidates[x].type) { + iks_insert_attrib(tag, "type", candidates[x].type); + } + + iks_insert_attrib(tag, "network", "0"); + iks_insert_attrib(tag, "generation", "0"); + schedule_packet(session->handle, id, iq, LDL_RETRY); + } + + + return id; +} + unsigned int ldl_session_candidates(ldl_session_t *session, ldl_candidate_t *candidates, unsigned int clen) @@ -1981,6 +2105,8 @@ unsigned int ldl_session_candidates(ldl_session_t *session, return id; } + + char *ldl_handle_probe(ldl_handle_t *handle, char *id, char *from, char *buf, unsigned int len) { iks *pres, *msg; @@ -2344,6 +2470,12 @@ int ldl_handle_running(ldl_handle_t *handle) return ldl_test_flag(handle, LDL_FLAG_RUNNING) ? 1 : 0; } + +int ldl_session_gateway(ldl_session_t *session) +{ + return ldl_test_flag(session, LDL_FLAG_GATEWAY) ? 1 : 0; +} + int ldl_handle_connected(ldl_handle_t *handle) { return ldl_test_flag(handle, LDL_FLAG_CONNECTED) ? 1 : 0; diff --git a/libs/libdingaling/src/libdingaling.h b/libs/libdingaling/src/libdingaling.h index 07a71b3..d786438 100644 --- a/libs/libdingaling/src/libdingaling.h +++ b/libs/libdingaling/src/libdingaling.h @@ -131,7 +131,8 @@ typedef enum { LDL_FLAG_SASL_PLAIN = (1 << 11), LDL_FLAG_SASL_MD5 = (1 << 12), LDL_FLAG_COMPONENT = (1 << 13), - LDL_FLAG_OUTBOUND = (1 << 14) + LDL_FLAG_OUTBOUND = (1 << 14), + LDL_FLAG_GATEWAY = (1 << 15) } ldl_user_flag_t; typedef enum { @@ -152,7 +153,8 @@ typedef enum { LDL_SIGNAL_LOGIN_FAILURE, LDL_SIGNAL_CONNECTED, LDL_SIGNAL_TRANSPORT_ACCEPT, - LDL_SIGNAL_REJECT + LDL_SIGNAL_REJECT, + LDL_SIGNAL_REDIRECT } ldl_signal_t; typedef enum { @@ -494,6 +496,10 @@ unsigned int ldl_session_candidates(ldl_session_t *session, ldl_candidate_t *candidates, unsigned int clen); +unsigned int ldl_session_transport(ldl_session_t *session, + ldl_candidate_t *candidates, + unsigned int clen); + /*! \brief Initiate or Accept a new session and provide transport options \param session the session to initiate or accept @@ -586,6 +592,8 @@ ldl_status ldl_handle_init(ldl_handle_t **handle, */ void ldl_handle_run(ldl_handle_t *handle); +int ldl_session_gateway(ldl_session_t *handle); + /*! \brief Stop a libDingaLing handle \param handle the Dingaling handle to stop commit ba0a2a32ba29d19cbb21f17ad31b42a093398d7d Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Sep 1 14:22:22 2010 -0500 make mod_dingaling compat with google's new free phonecalls thing diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index bb88ac5..69ce125 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -1001,7 +1001,13 @@ static int do_candidates(struct private_object *tech_pvt, int force) cand[0].protocol = "udp"; switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Send Candidate %s:%d [%s]\n", cand[0].address, cand[0].port, cand[0].username); - tech_pvt->cand_id = ldl_session_candidates(tech_pvt->dlsession, cand, 1); + + if (ldl_session_gateway(tech_pvt->dlsession)) { + tech_pvt->cand_id = ldl_session_transport(tech_pvt->dlsession, cand, 1); + } else { + tech_pvt->cand_id = ldl_session_candidates(tech_pvt->dlsession, cand, 1); + } + switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT); switch_set_flag_locked(tech_pvt, TFLAG_RTP_READY); } @@ -1112,6 +1118,7 @@ static switch_status_t negotiate_media(switch_core_session_t *session) now = switch_micro_time_now(); elapsed = (unsigned int) ((now - started) / 1000); + if (switch_channel_down(channel) || switch_test_flag(tech_pvt, TFLAG_BYE)) { goto out; } @@ -1643,6 +1650,8 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi char workspace[1024] = ""; char *p, *u, ubuf[512] = "", *user = NULL, *f_cid_msg = NULL; const char *cid_msg = NULL; + ldl_user_flag_t flags = LDL_FLAG_OUTBOUND; + switch_copy_string(workspace, outbound_profile->destination_number, sizeof(workspace)); profile_name = workspace; @@ -1711,7 +1720,10 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi terminate_session(new_session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; } - if (!(full_id = ldl_handle_probe(mdl_profile->handle, callto, user, idbuf, sizeof(idbuf)))) { + if (switch_stristr("voice.google.com", callto)) { + full_id = callto; + flags |= LDL_FLAG_GATEWAY; + } else if (!(full_id = ldl_handle_probe(mdl_profile->handle, callto, user, idbuf, sizeof(idbuf)))) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_DEBUG, "Unknown Recipient!\n"); terminate_session(new_session, __LINE__, SWITCH_CAUSE_NO_USER_RESPONSE); return SWITCH_CAUSE_NO_USER_RESPONSE; @@ -1768,7 +1780,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi switch_stun_random_string(sess_id, 10, "0123456789"); tech_pvt->us = switch_core_session_strdup(*new_session, user); tech_pvt->them = switch_core_session_strdup(*new_session, full_id); - ldl_session_create(&dlsession, mdl_profile->handle, sess_id, full_id, user, LDL_FLAG_OUTBOUND); + ldl_session_create(&dlsession, mdl_profile->handle, sess_id, full_id, user, flags); if (session) { switch_channel_t *calling_channel = switch_core_session_get_channel(session); @@ -1780,6 +1792,10 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi cid_msg = f_cid_msg; } + if ((flags & LDL_FLAG_GATEWAY)) { + cid_msg = NULL; + } + if (cid_msg) { char *them; them = strdup(tech_pvt->them); @@ -3128,6 +3144,11 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi break; case LDL_SIGNAL_TRANSPORT_ACCEPT: switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT_ACCEPT); + + if (ldl_session_gateway(dlsession)) { + do_candidates(tech_pvt, 1); + } + break; case LDL_SIGNAL_INITIATE: if (dl_signal) { @@ -3243,7 +3264,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi choice = x; ok = 1; } - + if (ok) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "candidate %s:%d PASS ACL %s\n", candidates[x].address, candidates[x].port, profile->acl[y]); @@ -3348,6 +3369,10 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi goto done; } break; + case LDL_SIGNAL_REDIRECT: + do_describe(tech_pvt, 1); + break; + case LDL_SIGNAL_ERROR: case LDL_SIGNAL_TERMINATE: if (channel) { commit 432e9cdf5b1606cd81cc1e78d5958ccaf7ed1d7c Author: David Yat Sin <dyatsin@sangoma.com> Date: Wed Sep 1 15:04:09 2010 -0400 Added passthrough for bearer capability diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 50eb7a2..0d986f3 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1230,10 +1230,14 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi freetdmvar = switch_channel_get_variable(channel, "freetdm_bearer_capability"); if (freetdmvar) { caller_data.bearer_capability = (uint8_t)atoi(freetdmvar); + } else { + caller_data.bearer_capability = FTDM_INVALID_INT_PARM; } freetdmvar = switch_channel_get_variable(channel, "freetdm_bearer_layer1"); if (freetdmvar) { caller_data.bearer_layer1 = (uint8_t)atoi(freetdmvar); + } else { + caller_data.bearer_layer1 = FTDM_INVALID_INT_PARM; } } diff --git a/libs/freetdm/src/ftdm_call_utils.c b/libs/freetdm/src/ftdm_call_utils.c index 4d7317a..d91b3bc 100644 --- a/libs/freetdm/src/ftdm_call_utils.c +++ b/libs/freetdm/src/ftdm_call_utils.c @@ -78,6 +78,37 @@ FT_DECLARE(ftdm_status_t) ftdm_span_set_ton(const char *ton_string, uint8_t *tar return FTDM_SUCCESS; } +FT_DECLARE(ftdm_status_t) ftdm_span_set_bearer_capability(const char *bc_string, ftdm_bearer_cap_t *target) +{ + if (!strcasecmp(bc_string, "speech")) { + *target = FTDM_BEARER_CAP_SPEECH; + } else if (!strcasecmp(bc_string, "unrestricted-digital")) { + *target = FTDM_BEARER_CAP_64K_UNRESTRICTED; + } else if (!strcasecmp(bc_string, "3.1Khz")) { + *target = FTDM_BEARER_CAP_3_1KHZ_AUDIO; + } else { + ftdm_log(FTDM_LOG_WARNING, "Unsupported Bearer Capability value (%s)\n", bc_string); + return FTDM_FAIL; + } + return FTDM_SUCCESS; +} + +FT_DECLARE(ftdm_status_t) ftdm_span_set_bearer_layer1(const char *bc_string, ftdm_user_layer1_prot_t *target) +{ + if (!strcasecmp(bc_string, "v110")) { + *target = FTDM_USER_LAYER1_PROT_V110; + } else if (!strcasecmp(bc_string, "ulaw")) { + *target = FTDM_USER_LAYER1_PROT_ULAW; + } else if (!strcasecmp(bc_string, "alaw")) { + *target =FTDM_USER_LAYER1_PROT_ALAW ; + } else { + ftdm_log(FTDM_LOG_WARNING, "Unsupported Bearer Layer1 Prot value (%s)\n", bc_string); + return FTDM_FAIL; + } + return FTDM_SUCCESS; +} + + FT_DECLARE(ftdm_status_t) ftdm_is_number(char *number) { if (!number) { diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 39eba67..bfa9492 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -293,6 +293,14 @@ static ftdm_status_t ftdm_set_caller_data(ftdm_span_t *span, ftdm_caller_data_t caller_data->rdnis.type = span->default_caller_data.rdnis.type; } + if (caller_data->bearer_capability == FTDM_INVALID_INT_PARM) { + caller_data->bearer_capability = span->default_caller_data.bearer_capability; + } + + if (caller_data->bearer_layer1 == FTDM_INVALID_INT_PARM) { + caller_data->bearer_layer1 = span->default_caller_data.bearer_layer1; + } + if (FTDM_FAIL == ftdm_is_number(caller_data->cid_num.digits)) { ftdm_log(FTDM_LOG_DEBUG, "dropping caller id number %s since we only accept digits\n", caller_data->cid_num.digits); caller_data->cid_num.digits[0] = '\0'; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 932db0e..3f63fbc 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -320,6 +320,11 @@ void sngisdn_rcv_cc_ind(CcMngmt *status); void sngisdn_rcv_sng_log(uint8_t level, char *fmt,...); void sngisdn_rcv_sng_assert(char *message); +uint8_t sngisdn_get_infoTranCap_from_stack(ftdm_bearer_cap_t bearer_capability); +uint8_t sngisdn_get_usrInfoLyr1Prot_from_stack(ftdm_user_layer1_prot_t layer1_prot); +ftdm_bearer_cap_t sngisdn_get_infoTranCap_from_user(uint8_t bearer_capability); +ftdm_user_layer1_prot_t sngisdn_get_usrInfoLyr1Prot_from_user(uint8_t layer1_prot); + static __inline__ uint32_t sngisdn_test_flag(sngisdn_chan_data_t *sngisdn_info, sngisdn_flag_t flag) { return (uint32_t) sngisdn_info->flags & flag; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c index 6124070..ec44142 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c @@ -163,6 +163,11 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ signal_data->overlap_dial = SNGISDN_OPT_DEFAULT; signal_data->setup_arb = SNGISDN_OPT_DEFAULT; + span->default_caller_data.bearer_capability = IN_ITC_SPEECH; + + /* Cannot set default bearer_layer1 yet, as we do not know the switchtype */ + span->default_caller_data.bearer_layer1 = FTDM_INVALID_INT_PARM; + if (span->trunk_type == FTDM_TRUNK_BRI || span->trunk_type == FTDM_TRUNK_BRI_PTMP) { @@ -240,6 +245,10 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ ftdm_span_set_ton(val, &span->default_caller_data.rdnis.type); } else if (!strcasecmp(var, "outbound-rdnis-npi")) { ftdm_span_set_npi(val, &span->default_caller_data.rdnis.plan); + } else if (!strcasecmp(var, "outbound-bearer_cap")) { + ftdm_span_set_bearer_capability(val, &span->default_caller_data.bearer_capability); + } else if (!strcasecmp(var, "outbound-bearer_layer1")) { + ftdm_span_set_bearer_layer1(val, &span->default_caller_data.bearer_layer1); } else { ftdm_log(FTDM_LOG_WARNING, "Ignoring unknown parameter %s\n", ftdm_parameters[paramindex].var); } @@ -253,6 +262,14 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ ftdm_log(FTDM_LOG_ERROR, "%s: signalling not specified", span->name); return FTDM_FAIL; } + + if (span->default_caller_data.bearer_layer1 == FTDM_INVALID_INT_PARM) { + if (signal_data->switchtype == SNGISDN_SWITCH_EUROISDN) { + span->default_caller_data.bearer_layer1 = IN_UIL1_G711ULAW; + } else { + span->default_caller_data.bearer_layer1 = IN_UIL1_G711ALAW; + } + } return FTDM_SUCCESS; } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 2520a3d..f49d651 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -34,10 +34,10 @@ #include "ftmod_sangoma_isdn.h" -extern ftdm_status_t cpy_calling_num_from_sngisdn(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb); -extern ftdm_status_t cpy_called_num_from_sngisdn(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb); -extern ftdm_status_t cpy_redir_num_from_sngisdn(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb); -extern ftdm_status_t cpy_calling_name_from_sngisdn(ftdm_caller_data_t *ftdm, Display *display); +extern ftdm_status_t cpy_calling_num_from_stack(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb); +extern ftdm_status_t cpy_called_num_from_stack(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb); +extern ftdm_status_t cpy_redir_num_from_stack(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb); +extern ftdm_status_t cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *display); /* Remote side transmit a SETUP */ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) @@ -110,10 +110,14 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) break; } /* Fill in call information */ - cpy_calling_num_from_sngisdn(&ftdmchan->caller_data, &conEvnt->cgPtyNmb); - cpy_called_num_from_sngisdn(&ftdmchan->caller_data, &conEvnt->cdPtyNmb); - cpy_calling_name_from_sngisdn(&ftdmchan->caller_data, &conEvnt->display); + cpy_calling_num_from_stack(&ftdmchan->caller_data, &conEvnt->cgPtyNmb); + cpy_called_num_from_stack(&ftdmchan->caller_data, &conEvnt->cdPtyNmb); + cpy_calling_name_from_stack(&ftdmchan->caller_data, &conEvnt->display); + if (conEvnt->bearCap[0].eh.pres) { + ftdmchan->caller_data.bearer_layer1 = sngisdn_get_infoTranCap_from_stack(conEvnt->bearCap[0].usrInfoLyr1Prot.val); + ftdmchan->caller_data.bearer_capability = sngisdn_get_infoTranCap_from_stack(conEvnt->bearCap[0].infoTranCap.val); + } if (signal_data->switchtype == SNGISDN_SWITCH_NI2) { if (conEvnt->shift11.eh.pres && conEvnt->ni2OctStr.eh.pres) { @@ -370,7 +374,7 @@ void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) ftdm_size_t min_digits = ((sngisdn_span_data_t*)ftdmchan->span->signal_data)->min_digits; ftdm_size_t num_digits; - cpy_called_num_from_sngisdn(&ftdmchan->caller_data, &cnStEvnt->cdPtyNmb); + cpy_called_num_from_stack(&ftdmchan->caller_data, &cnStEvnt->cdPtyNmb); num_digits = strlen(ftdmchan->caller_data.dnis.digits); if (cnStEvnt->sndCmplt.eh.pres || num_digits >= min_digits) { @@ -686,7 +690,6 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event) switch (ftdmchan->state) { case FTDM_CHANNEL_STATE_GET_CALLERID: /* Update the caller ID Name */ -#if 1 if (facEvnt->facElmt.facStr.pres) { uint8_t facility_str[255]; memcpy(facility_str, (uint8_t*)&facEvnt->facElmt.facStr.val, facEvnt->facElmt.facStr.len); @@ -694,10 +697,7 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event) if (sng_isdn_retrieve_facility_caller_name(facility_str, facEvnt->facElmt.facStr.len, retrieved_str) != FTDM_SUCCESS) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Failed to retrieve Caller Name from Facility IE\n"); } - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "DYDBG Name is:%s\n", retrieved_str); } -#endif - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); break; default: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index 8247735..8ae5138 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -34,9 +34,9 @@ #include "ftmod_sangoma_isdn.h" -extern ftdm_status_t cpy_calling_num_to_sngisdn(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm); -extern ftdm_status_t cpy_called_num_to_sngisdn(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm); -extern ftdm_status_t cpy_calling_name_to_sngisdn(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan); +extern ftdm_status_t cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm); +extern ftdm_status_t cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm); +extern ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan); void sngisdn_snd_setup(ftdm_channel_t *ftdmchan); void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan); @@ -62,11 +62,10 @@ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) ftdm_mutex_unlock(g_sngisdn_data.ccs[signal_data->cc_id].mutex); memset(&conEvnt, 0, sizeof(conEvnt)); - + conEvnt.bearCap[0].eh.pres = PRSNT_NODEF; conEvnt.bearCap[0].infoTranCap.pres = PRSNT_NODEF; - - conEvnt.bearCap[0].infoTranCap.val = IN_ITC_SPEECH; + conEvnt.bearCap[0].infoTranCap.val = sngisdn_get_infoTranCap_from_user(ftdmchan->caller_data.bearer_capability); conEvnt.bearCap[0].codeStand0.pres = PRSNT_NODEF; conEvnt.bearCap[0].codeStand0.val = IN_CSTD_CCITT; @@ -96,14 +95,21 @@ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) conEvnt.chanId.infoChanSel.val = ftdmchan->physical_chan_id; } else { /* PRI only params */ - - if (signal_data->switchtype == SNGISDN_SWITCH_EUROISDN) { - conEvnt.bearCap[0].usrInfoLyr1Prot.pres = PRSNT_NODEF; + conEvnt.bearCap[0].usrInfoLyr1Prot.pres = PRSNT_NODEF; + conEvnt.bearCap[0].usrInfoLyr1Prot.val = sngisdn_get_usrInfoLyr1Prot_from_user(ftdmchan->caller_data.bearer_layer1); + + if (signal_data->switchtype == SNGISDN_SWITCH_EUROISDN && + conEvnt.bearCap[0].usrInfoLyr1Prot.val == IN_UIL1_G711ULAW) { + + /* We are bridging a call from T1 */ conEvnt.bearCap[0].usrInfoLyr1Prot.val = IN_UIL1_G711ALAW; - } else { - conEvnt.bearCap[0].usrInfoLyr1Prot.pres = PRSNT_NODEF; + + } else if (conEvnt.bearCap[0].usrInfoLyr1Prot.val == IN_UIL1_G711ALAW) { + + /* We are bridging a call from E1 */ conEvnt.bearCap[0].usrInfoLyr1Prot.val = IN_UIL1_G711ULAW; } + conEvnt.bearCap[0].lyr1Ident.pres = PRSNT_NODEF; conEvnt.bearCap[0].lyr1Ident.val = IN_L1_IDENT; @@ -138,9 +144,9 @@ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) sngisdn_info->ces = CES_MNGMNT; } - cpy_called_num_to_sngisdn(&conEvnt.cdPtyNmb, &ftdmchan->caller_data); - cpy_calling_num_to_sngisdn(&conEvnt.cgPtyNmb, &ftdmchan->caller_data); - cpy_calling_name_to_sngisdn(&conEvnt, ftdmchan); + cpy_called_num_from_user(&conEvnt.cdPtyNmb, &ftdmchan->caller_data); + cpy_calling_num_from_user(&conEvnt.cgPtyNmb, &ftdmchan->caller_data); + cpy_calling_name_from_user(&conEvnt, ftdmchan); ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending SETUP (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index f910eb3..29e7994 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -34,15 +34,15 @@ #include "ftmod_sangoma_isdn.h" -ftdm_status_t cpy_calling_num_from_sngisdn(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb); -ftdm_status_t cpy_called_num_from_sngisdn(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb); -ftdm_status_t cpy_redir_num_from_sngisdn(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb); -ftdm_status_t cpy_calling_name_from_sngisdn(ftdm_caller_data_t *ftdm, Display *display); +ftdm_status_t cpy_calling_num_from_stack(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb); +ftdm_status_t cpy_called_num_from_stack(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb); +ftdm_status_t cpy_redir_num_from_stack(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb); +ftdm_status_t cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *display); -ftdm_status_t cpy_calling_num_to_sngisdn(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm); -ftdm_status_t cpy_called_num_to_sngisdn(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm); -ftdm_status_t cpy_redir_num_to_sngisdn(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm); -ftdm_status_t cpy_calling_name_to_sngisdn(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan); +ftdm_status_t cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm); +ftdm_status_t cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm); +ftdm_status_t cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm); +ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan); ftdm_status_t sngisdn_check_free_ids(void); @@ -146,7 +146,7 @@ ftdm_status_t sng_isdn_set_avail_rate(ftdm_span_t *ftdmspan, sngisdn_avail_t ava return FTDM_SUCCESS; } -ftdm_status_t cpy_calling_num_from_sngisdn(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb) +ftdm_status_t cpy_calling_num_from_stack(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb) { if (cgPtyNmb->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; @@ -173,7 +173,7 @@ ftdm_status_t cpy_calling_num_from_sngisdn(ftdm_caller_data_t *ftdm, CgPtyNmb *c return FTDM_SUCCESS; } -ftdm_status_t cpy_called_num_from_sngisdn(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb) +ftdm_status_t cpy_called_num_from_stack(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb) { if (cdPtyNmb->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; @@ -195,7 +195,7 @@ ftdm_status_t cpy_called_num_from_sngisdn(ftdm_caller_data_t *ftdm, CdPtyNmb *cd return FTDM_SUCCESS; } -ftdm_status_t cpy_redir_num_from_sngisdn(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb) +ftdm_status_t cpy_redir_num_from_stack(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb) { if (redirNmb->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; @@ -215,7 +215,7 @@ ftdm_status_t cpy_redir_num_from_sngisdn(ftdm_caller_data_t *ftdm, RedirNmb *red return FTDM_SUCCESS; } -ftdm_status_t cpy_calling_name_from_sngisdn(ftdm_caller_data_t *ftdm, Display *display) +ftdm_status_t cpy_calling_name_from_stack(ftdm_caller_data_t *ftdm, Display *display) { if (display->eh.pres != PRSNT_NODEF) { return FTDM_FAIL; @@ -228,7 +228,7 @@ ftdm_status_t cpy_calling_name_from_sngisdn(ftdm_caller_data_t *ftdm, Display *d return FTDM_SUCCESS; } -ftdm_status_t cpy_calling_num_to_sngisdn(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm) +ftdm_status_t cpy_calling_num_from_user(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm) { uint8_t len = strlen(ftdm->cid_num.digits); if (!len) { @@ -256,7 +256,7 @@ ftdm_status_t cpy_calling_num_to_sngisdn(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t return FTDM_SUCCESS; } -ftdm_status_t cpy_called_num_to_sngisdn(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm) +ftdm_status_t cpy_called_num_from_user(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm) { uint8_t len = strlen(ftdm->dnis.digits); if (!len) { @@ -286,7 +286,7 @@ ftdm_status_t cpy_called_num_to_sngisdn(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t * return FTDM_SUCCESS; } -ftdm_status_t cpy_redir_num_to_sngisdn(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm) +ftdm_status_t cpy_redir_num_from_user(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm) { uint8_t len = strlen(ftdm->rdnis.digits); if (!len) { @@ -318,7 +318,7 @@ ftdm_status_t cpy_redir_num_to_sngisdn(RedirNmb *redirNmb, ftdm_caller_data_t *f } -ftdm_status_t cpy_calling_name_to_sngisdn(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan) +ftdm_status_t cpy_calling_name_from_user(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan) { uint8_t len; ftdm_caller_data_t *ftdm = &ftdmchan->caller_data; @@ -385,13 +385,7 @@ void sngisdn_delayed_release(void* p_sngisdn_info) signal_data->cc_id, sngisdn_info->glare.spInstId, sngisdn_info->glare.suInstId); sngisdn_snd_release(ftdmchan, 1); -#if 1 /* TODO: Confirm this */ clear_call_glare_data(sngisdn_info); -#else - g_sngisdn_data.ccs[signal_data->cc_id].active_spInstIds[sngisdn_info->glare.spInstId] = NULL; - g_sngisdn_data.ccs[signal_data->cc_id].active_suInstIds[sngisdn_info->glare.suInstId] = NULL; -#endif - } else { ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Call was already released (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->glare.spInstId, sngisdn_info->glare.suInstId); @@ -473,6 +467,72 @@ void get_memory_info(void) return; } +uint8_t sngisdn_get_infoTranCap_from_stack(ftdm_bearer_cap_t bearer_capability) +{ + switch(bearer_capability) { + case FTDM_BEARER_CAP_SPEECH: + return IN_ITC_SPEECH; + + case FTDM_BEARER_CAP_64K_UNRESTRICTED: + return IN_ITC_UNRDIG; + + case FTDM_BEARER_CAP_3_1KHZ_AUDIO: + return IN_ITC_A31KHZ; + + /* Do not put a default case here, so we can see compile warnings if we have unhandled cases */ + } + return FTDM_BEARER_CAP_SPEECH; +} + +uint8_t sngisdn_get_usrInfoLyr1Prot_from_stack(ftdm_user_layer1_prot_t layer1_prot) +{ + switch(layer1_prot) { + case FTDM_USER_LAYER1_PROT_V110: + return IN_UIL1_CCITTV110; + + case FTDM_USER_LAYER1_PROT_ULAW: + return IN_UIL1_G711ULAW; + + case FTDM_USER_LAYER1_PROT_ALAW: + return IN_UIL1_G711ALAW; + + /* Do not put a default case here, so we can see compile warnings if we have unhandled cases */ + } + return IN_UIL1_G711ULAW; +} + +ftdm_bearer_cap_t sngisdn_get_infoTranCap_from_user(uint8_t bearer_capability) +{ + switch(bearer_capability) { + case IN_ITC_SPEECH: + return FTDM_BEARER_CAP_SPEECH; + + case IN_ITC_UNRDIG: + return FTDM_BEARER_CAP_64K_UNRESTRICTED; + + case IN_ITC_A31KHZ: + return FTDM_BEARER_CAP_3_1KHZ_AUDIO; + + default: + return FTDM_BEARER_CAP_SPEECH; + } + return FTDM_BEARER_CAP_SPEECH; +} + +ftdm_user_layer1_prot_t sngisdn_get_usrInfoLyr1Prot_from_user(uint8_t layer1_prot) +{ + switch(layer1_prot) { + case IN_UIL1_CCITTV110: + return FTDM_USER_LAYER1_PROT_V110; + case IN_UIL1_G711ULAW: + return FTDM_USER_LAYER1_PROT_ULAW; + case IN_UIL1_G711ALAW: + return IN_UIL1_G711ALAW; + default: + return FTDM_USER_LAYER1_PROT_ULAW; + } + return FTDM_USER_LAYER1_PROT_ULAW; +} /* For Emacs: * Local Variables: diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index c1e50ec..205833d 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -60,6 +60,8 @@ /*! \brief Max number of groups */ #define FTDM_MAX_GROUPS_INTERFACE FTDM_MAX_SPANS_INTERFACE +#define FTDM_INVALID_INT_PARM 0xFF + /*! \brief FreeTDM APIs possible return codes */ typedef enum { FTDM_SUCCESS, /*!< Success */ @@ -208,6 +210,7 @@ typedef struct ftdm_queue_handler { ftdm_queue_destroy_func_t destroy; } ftdm_queue_handler_t; + /*! \brief Type Of Number (TON) */ typedef enum { FTDM_TON_UNKNOWN = 0, diff --git a/libs/freetdm/src/include/private/ftdm_call_utils.h b/libs/freetdm/src/include/private/ftdm_call_utils.h index 57f2f4b..782abde 100644 --- a/libs/freetdm/src/include/private/ftdm_call_utils.h +++ b/libs/freetdm/src/include/private/ftdm_call_utils.h @@ -39,6 +39,8 @@ FT_DECLARE(ftdm_status_t) ftdm_span_set_npi(const char *npi_string, uint8_t *target); FT_DECLARE(ftdm_status_t) ftdm_span_set_ton(const char *ton_string, uint8_t *target); +FT_DECLARE(ftdm_status_t) ftdm_span_set_bearer_capability(const char *bc_string, ftdm_bearer_cap_t *target); +FT_DECLARE(ftdm_status_t) ftdm_span_set_bearer_layer1(const char *bc_string, ftdm_user_layer1_prot_t *target); FT_DECLARE(ftdm_status_t) ftdm_is_number(char *number); #endif /* __FTDM_CALL_UTILS_H__ */ commit e15d52bd80b29327617b52c7f382f3f4cb8f7228 Author: Konrad Hammel <konrad@sangoma.com> Date: Wed Sep 1 12:44:28 2010 -0400 freetdm: ss7 - updated to allow TMR/bearer cap pass-through diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index d1f3a8b..a0bf95b 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -42,7 +42,6 @@ /******************************************************************************/ /* PROTOTYPES *****************************************************************/ -/* PROTOTYPES *****************************************************************/ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCnStEvnt *siCnStEvnt, uint8_t evntType); ftdm_status_t handle_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); @@ -140,42 +139,67 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ } else { - /* fill in cid/ani number */ - if (siConEvnt->cgPtyNum.addrSig.pres) { - copy_tknStr_from_sngss7(siConEvnt->cgPtyNum.addrSig, - ftdmchan->caller_data.cid_num.digits, - siConEvnt->cgPtyNum.oddEven); - - /* fill in cid Name */ - ftdm_set_string(ftdmchan->caller_data.cid_name, ftdmchan->caller_data.cid_num.digits); - - ftdm_set_string(ftdmchan->caller_data.ani.digits, ftdmchan->caller_data.cid_num.digits); - + /* fill in calling party information */ + if (siConEvnt->cgPtyNum.eh.pres) { + if (siConEvnt->cgPtyNum.addrSig.pres) { + /* fill in cid_num */ + copy_tknStr_from_sngss7(siConEvnt->cgPtyNum.addrSig, + ftdmchan->caller_data.cid_num.digits, + siConEvnt->cgPtyNum.oddEven); + + /* fill in cid Name */ + ftdm_set_string(ftdmchan->caller_data.cid_name, ftdmchan->caller_data.cid_num.digits); + + /* fill in ANI */ + ftdm_set_string(ftdmchan->caller_data.ani.digits, ftdmchan->caller_data.cid_num.digits); + } + + if (siConEvnt->cgPtyNum.scrnInd.pres) { + /* fill in the screening indication value */ + ftdmchan->caller_data.screen = siConEvnt->cgPtyNum.scrnInd.val; + } + + if (siConEvnt->cgPtyNum.presRest.pres) { + /* fill in the presentation value */ + ftdmchan->caller_data.pres = siConEvnt->cgPtyNum.presRest.val; + } } else { - SS7_INFO("No Calling party (ANI) information in IAM!\n"); + SS7_INFO_CHAN(ftdmchan,"No Calling party (ANI) information in IAM!%s\n", " "); } - /* fill in dnis */ - if (siConEvnt->cdPtyNum.addrSig.pres) { - copy_tknStr_from_sngss7(siConEvnt->cdPtyNum.addrSig, - ftdmchan->caller_data.dnis.digits, - siConEvnt->cdPtyNum.oddEven); - } else { - SS7_INFO("No Called party (DNIS) information in IAM!\n"); + /* fill in called party infomation */ + if (siConEvnt->cdPtyNum.eh.pres) { + if (siConEvnt->cdPtyNum.addrSig.pres) { + /* fill in the called number/dnis */ + copy_tknStr_from_sngss7(siConEvnt->cdPtyNum.addrSig, + ftdmchan->caller_data.dnis.digits, + siConEvnt->cdPtyNum.oddEven); + } + } else { + SS7_INFO_CHAN(ftdmchan,"No Called party (DNIS) information in IAM!%s\n", " "); } - /* fill in rdnis */ - if (siConEvnt->redirgNum.addrSig.pres) { - copy_tknStr_from_sngss7(siConEvnt->redirgNum.addrSig, - ftdmchan->caller_data.rdnis.digits, - siConEvnt->cgPtyNum.oddEven); + /* fill in rdnis information*/ + if (siConEvnt->redirgNum.eh.pres) { + if (siConEvnt->redirgNum.addrSig.pres) { + /* fill in the rdnis digits */ + copy_tknStr_from_sngss7(siConEvnt->redirgNum.addrSig, + ftdmchan->caller_data.rdnis.digits, + siConEvnt->cgPtyNum.oddEven); + } } else { - SS7_INFO("No RDNIS party information in IAM!\n"); + SS7_DEBUG_CHAN(ftdmchan,"No RDNIS party information in IAM!%s\n", " "); } - /* fill in screening/presentation */ - ftdmchan->caller_data.screen = siConEvnt->cgPtyNum.scrnInd.val; - ftdmchan->caller_data.pres = siConEvnt->cgPtyNum.presRest.val; + /* fill in the TMR/bearer capability */ + if (siConEvnt->txMedReq.eh.pres) { + if (siConEvnt->txMedReq.trMedReq.pres) { + /* fill in the bearer type */ + ftdmchan->caller_data.bearer_capability = siConEvnt->txMedReq.trMedReq.val; + } + } else { + SS7_DEBUG_CHAN(ftdmchan,"No TMR/Bearer Cap information in IAM!%s\n", " "); + } /* set the state of the channel to collecting...the rest is done by the chan monitor */ ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index 53d0f9d..600a529 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -64,70 +64,72 @@ void ft_to_sngss7_grs (ftdm_channel_t * ftdmchan); void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) { - SS7_FUNC_TRACE_ENTER (__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;; - SiConEvnt iam; - - sngss7_info->suInstId = get_unique_id (); - sngss7_info->spInstId = 0; - sngss7_info->spId = 1; - - memset (&iam, 0x0, sizeof (iam)); - - /* copy down the nature of connection indicators */ - iam.natConInd.eh.pres = PRSNT_NODEF; - iam.natConInd.satInd.pres = PRSNT_NODEF; - iam.natConInd.satInd.val = 0; - iam.natConInd.contChkInd.pres = PRSNT_NODEF; - iam.natConInd.contChkInd.val = 0x00; - iam.natConInd.echoCntrlDevInd.pres = PRSNT_NODEF; - iam.natConInd.echoCntrlDevInd.val = 0x01; - - /* copy down the forward call indicators */ - iam.fwdCallInd.eh.pres = PRSNT_NODEF; - iam.fwdCallInd.natIntCallInd.pres = PRSNT_NODEF; - iam.fwdCallInd.natIntCallInd.val = 0x00; - iam.fwdCallInd.end2EndMethInd.pres = PRSNT_NODEF; - iam.fwdCallInd.end2EndMethInd.val = 0x00; - iam.fwdCallInd.intInd.pres = PRSNT_NODEF; - iam.fwdCallInd.intInd.val = 0x01; - iam.fwdCallInd.end2EndInfoInd.pres = PRSNT_NODEF; - iam.fwdCallInd.end2EndInfoInd.val = 0x00; - iam.fwdCallInd.isdnUsrPrtInd.pres = PRSNT_NODEF; - iam.fwdCallInd.isdnUsrPrtInd.val = 0x01; - iam.fwdCallInd.isdnUsrPrtPrfInd.pres = PRSNT_NODEF; - iam.fwdCallInd.isdnUsrPrtPrfInd.val = 0x02; - iam.fwdCallInd.isdnAccInd.pres = PRSNT_NODEF; - iam.fwdCallInd.isdnAccInd.val = 0x01; - iam.fwdCallInd.sccpMethInd.pres = PRSNT_NODEF; - iam.fwdCallInd.sccpMethInd.val = 0x00; - - /* copy down the calling number information */ - iam.cgPtyCat.eh.pres = PRSNT_NODEF; - iam.cgPtyCat.cgPtyCat.pres = PRSNT_NODEF; - iam.cgPtyCat.cgPtyCat.val = 0x0a; - - /* copy down the transmission medium requirements */ - iam.txMedReq.eh.pres = PRSNT_NODEF; - iam.txMedReq.trMedReq.pres = PRSNT_NODEF; - iam.txMedReq.trMedReq.val = 0; /* SPEECH = 0, 3.1Khz = 3, 64k unres = 2 */ - - /* copy down the called number information */ - copy_cdPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cdPtyNum); - - /* copy down the calling number information */ - copy_cgPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cgPtyNum); - - sng_cc_con_request (sngss7_info->spId, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id, &iam, 0); - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx IAM\n"); - - SS7_FUNC_TRACE_EXIT (__FUNCTION__); - return; + SS7_FUNC_TRACE_ENTER (__FUNCTION__); + + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;; + SiConEvnt iam; + + sngss7_info->suInstId = get_unique_id (); + sngss7_info->spInstId = 0; + sngss7_info->spId = 1; + + memset (&iam, 0x0, sizeof (iam)); + + /* copy down the nature of connection indicators */ + iam.natConInd.eh.pres = PRSNT_NODEF; + iam.natConInd.satInd.pres = PRSNT_NODEF; + iam.natConInd.satInd.val = 0; /* no satellite circuit */ + iam.natConInd.contChkInd.pres = PRSNT_NODEF; + iam.natConInd.contChkInd.val = CONTCHK_NOTREQ; + iam.natConInd.echoCntrlDevInd.pres = PRSNT_NODEF; + iam.natConInd.echoCntrlDevInd.val = ECHOCDEV_INCL; + + /* copy down the forward call indicators */ + iam.fwdCallInd.eh.pres = PRSNT_NODEF; + iam.fwdCallInd.natIntCallInd.pres = PRSNT_NODEF; + iam.fwdCallInd.natIntCallInd.val = 0x00; + iam.fwdCallInd.end2EndMethInd.pres = PRSNT_NODEF; + iam.fwdCallInd.end2EndMethInd.val = E2EMTH_NOMETH; + iam.fwdCallInd.intInd.pres = PRSNT_NODEF; + iam.fwdCallInd.intInd.val = INTIND_NOINTW; + iam.fwdCallInd.end2EndInfoInd.pres = PRSNT_NODEF; + iam.fwdCallInd.end2EndInfoInd.val = E2EINF_NOINFO; + iam.fwdCallInd.isdnUsrPrtInd.pres = PRSNT_NODEF; + iam.fwdCallInd.isdnUsrPrtInd.val = ISUP_USED; + iam.fwdCallInd.isdnUsrPrtPrfInd.pres = PRSNT_NODEF; + iam.fwdCallInd.isdnUsrPrtPrfInd.val = PREF_REQAW; + iam.fwdCallInd.isdnAccInd.pres = PRSNT_NODEF; + iam.fwdCallInd.isdnAccInd.val = ISDNACC_ISDN; + iam.fwdCallInd.sccpMethInd.pres = PRSNT_NODEF; + iam.fwdCallInd.sccpMethInd.val = SCCPMTH_NOIND; + + /* copy down the calling number information */ + iam.cgPtyCat.eh.pres = PRSNT_NODEF; + iam.cgPtyCat.cgPtyCat.pres = PRSNT_NODEF; + iam.cgPtyCat.cgPtyCat.val = CAT_ORD; /* ordinary suscriber */ + + /* copy down the transmission medium requirements */ + iam.txMedReq.eh.pres = PRSNT_NODEF; + iam.txMedReq.trMedReq.pres = PRSNT_NODEF; + iam.txMedReq.trMedReq.val = ftdmchan->caller_data.bearer_capability; + + /* copy down the called number information */ + copy_cdPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cdPtyNum); + + /* copy down the calling number information */ + copy_cgPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cgPtyNum); + + sng_cc_con_request (sngss7_info->spId, + sngss7_info->suInstId, + sngss7_info->spInstId, + sngss7_info->circuit->id, + &iam, + 0); + + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx IAM\n"); + + SS7_FUNC_TRACE_EXIT (__FUNCTION__); + return; } /******************************************************************************/ commit e3b9db88947df3ae21ca1e20b24d84d230bb059a Author: Konrad Hammel <konrad@sangoma.com> Date: Tue Aug 31 17:33:42 2010 -0400 freetdm: implemented Trillium stack message queueing diff --git a/libs/freetdm/Makefile.am b/libs/freetdm/Makefile.am index 6ccc473..33a8b96 100644 --- a/libs/freetdm/Makefile.am +++ b/libs/freetdm/Makefile.am @@ -268,18 +268,19 @@ ftmod_pritap_la_LIBADD = $(MYLIB) endif if SNGSS7 -ftmod_sangoma_ss7_la_SOURCES = $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sts.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c +ftmod_sangoma_ss7_la_SOURCES = $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sts.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c ftmod_sangoma_ss7_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) -D_GNU_SOURCE ftmod_sangoma_ss7_la_LDFLAGS = -module -avoid-version -lsng_ss7 ftmod_sangoma_ss7_la_LIBADD = $(MYLIB) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c similarity index 87% copy from libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c copy to libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index 98554db..d1f3a8b 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -1,16 +1,16 @@ /* - * Copyright (c) 2009, Konrad Hammel <konrad@sangoma.com> + * Copyright (c) 2009 Konrad Hammel <konrad@sangoma.com> * All rights reserved. * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions + * 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. + * 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 + * 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 original author; nor the names of any contributors @@ -19,16 +19,16 @@ * * * 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 + * "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 OWNER - * 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 + * 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 + * 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. + * SOFTWARE|EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* INCLUDE ********************************************************************/ @@ -42,46 +42,40 @@ /******************************************************************************/ /* PROTOTYPES *****************************************************************/ -void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -void sngss7_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); -void sngss7_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); -void sngss7_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCnStEvnt *siCnStEvnt, uint8_t evntType); -void sngss7_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt); -void sngss7_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt); -void sngss7_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiInfoEvnt *siInfoEvnt); -void sngss7_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt); -void sngss7_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt); -void sngss7_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit); - -static ftdm_status_t handle_reattempt(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_resume(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - -static ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_cot_stop(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_cot(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - -static ftdm_status_t handle_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_local_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - -static ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_grs_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - -static ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_blo_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_ubl_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - -static ftdm_status_t handle_local_blk(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - -static ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - +/* PROTOTYPES *****************************************************************/ +ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); +ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCnStEvnt *siCnStEvnt, uint8_t evntType); +ftdm_status_t handle_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); +ftdm_status_t handle_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt); +ftdm_status_t handle_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt); +ftdm_status_t handle_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiInfoEvnt *siInfoEvnt); +ftdm_status_t handle_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt); +ftdm_status_t handle_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt); +ftdm_status_t handle_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit); +ftdm_status_t handle_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); + +ftdm_status_t handle_reattempt(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_resume(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_cot_stop(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_cot(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_local_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_grs_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_blo_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_ubl_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_local_blk(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); /******************************************************************************/ /* FUNCTIONS ******************************************************************/ -void sngss7_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt) +ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -92,7 +86,7 @@ void sngss7_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCo if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_FAIL; } /* now that we have the right channel...put a lock on it so no-one else can use it */ @@ -207,81 +201,11 @@ void sngss7_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCo ftdm_mutex_unlock(ftdmchan->mutex); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - -/******************************************************************************/ -void sngss7_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - - /* check whether the ftdm channel is in a state to accept a call */ - switch (ftdmchan->state) { - /**************************************************************************/ - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx ANM\n"); - - /* go to UP */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_DIALING: - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CON\n"); - - /* go to UP */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); - - break; - /**************************************************************************/ - default: /* incorrect state...reset the CIC */ - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx ANM/CON\n"); - - /* throw the TX reset flag */ - sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX); - - /* go to RESTART */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - - break; - /**************************************************************************/ - } - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_SUCCESS; } /******************************************************************************/ -void sngss7_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCnStEvnt *siCnStEvnt, uint8_t evntType) +ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCnStEvnt *siCnStEvnt, uint8_t evntType) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -292,7 +216,7 @@ void sngss7_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCn if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_FAIL; } /* now that we have the right channel...put a lock on it so no-one else can use it */ @@ -447,11 +371,81 @@ void sngss7_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCn ftdm_mutex_unlock(ftdmchan->mutex); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_SUCCESS; +} + +/******************************************************************************/ +ftdm_status_t handle_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt) +{ + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + + sngss7_chan_data_t *sngss7_info ; + ftdm_channel_t *ftdmchan; + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + SS7_ASSERT; + }; + + + /* check whether the ftdm channel is in a state to accept a call */ + switch (ftdmchan->state) { + /**************************************************************************/ + case FTDM_CHANNEL_STATE_PROGRESS: + case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: + + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx ANM\n"); + + /* go to UP */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); + + break; + /**************************************************************************/ + case FTDM_CHANNEL_STATE_DIALING: + + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CON\n"); + + /* go to UP */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); + + break; + /**************************************************************************/ + default: /* incorrect state...reset the CIC */ + + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx ANM/CON\n"); + + /* throw the TX reset flag */ + sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX); + + /* go to RESTART */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + + break; + /**************************************************************************/ + } + + /* unlock the channel */ + ftdm_mutex_unlock(ftdmchan->mutex); + + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_SUCCESS; } /******************************************************************************/ -void sngss7_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt) +ftdm_status_t handle_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -462,7 +456,7 @@ void sngss7_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRe if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_FAIL; } /* now that we have the right channel...put a lock on it so no-one else can use it */ @@ -540,12 +534,11 @@ void sngss7_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRe ftdm_mutex_unlock(ftdmchan->mutex); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_SUCCESS; } - /******************************************************************************/ -void sngss7_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt) +ftdm_status_t handle_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -556,7 +549,7 @@ void sngss7_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRe if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_FAIL; } /* now that we have the right channel...put a lock on it so no-one else can use it */ @@ -600,11 +593,11 @@ void sngss7_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRe ftdm_mutex_unlock(ftdmchan->mutex); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_SUCCESS; } /******************************************************************************/ -void sngss7_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiInfoEvnt *siInfoEvnt) +ftdm_status_t handle_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiInfoEvnt *siInfoEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -615,7 +608,7 @@ void sngss7_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiIn if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_FAIL; } /* now that we have the right channel...put a lock on it so no-one else can use it */ @@ -635,11 +628,11 @@ void sngss7_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiIn ftdm_mutex_unlock(ftdmchan->mutex); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_SUCCESS; } /******************************************************************************/ -void sngss7_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt) +ftdm_status_t handle_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -650,7 +643,7 @@ void sngss7_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_FAIL; } /* now that we have the right channel...put a lock on it so no-one else can use it */ @@ -670,11 +663,11 @@ void sngss7_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint ftdm_mutex_unlock(ftdmchan->mutex); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_SUCCESS; } /******************************************************************************/ -void sngss7_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt) +ftdm_status_t handle_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -685,7 +678,7 @@ void sngss7_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_FAIL; } /* now that we have the right channel...put a lock on it so no-one else can use it */ @@ -705,11 +698,11 @@ void sngss7_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint ftdm_mutex_unlock(ftdmchan->mutex); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_SUCCESS; } /******************************************************************************/ -void sngss7_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit) +ftdm_status_t handle_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -720,7 +713,7 @@ void sngss7_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit) if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_FAIL; } /* now that we have the right channel...put a lock on it so no-one else can use it */ @@ -740,11 +733,11 @@ void sngss7_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit) ftdm_mutex_unlock(ftdmchan->mutex); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_SUCCESS; } -/* GENERAL STATUS *************************************************************/ -void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +/******************************************************************************/ +ftdm_status_t handle_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { sngss7_chan_data_t *sngss7_info ; ftdm_channel_t *ftdmchan; @@ -753,7 +746,7 @@ void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_FAIL; } SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -981,11 +974,12 @@ void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint } /* switch (evntType) */ SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_SUCCESS; + } /******************************************************************************/ -static ftdm_status_t handle_reattempt(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_reattempt(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1023,7 +1017,7 @@ static ftdm_status_t handle_reattempt(uint32_t suInstId, uint32_t spInstId, uint } /******************************************************************************/ -static ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1085,7 +1079,7 @@ static ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t } /******************************************************************************/ -static ftdm_status_t handle_resume(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_resume(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1150,7 +1144,7 @@ static ftdm_status_t handle_resume(uint32_t suInstId, uint32_t spInstId, uint32_ } /******************************************************************************/ -static ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1208,7 +1202,7 @@ static ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint } /******************************************************************************/ -static ftdm_status_t handle_cot_stop(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_cot_stop(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1247,7 +1241,7 @@ static ftdm_status_t handle_cot_stop(uint32_t suInstId, uint32_t spInstId, uint3 } /******************************************************************************/ -static ftdm_status_t handle_cot(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_cot(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1269,7 +1263,7 @@ static ftdm_status_t handle_cot(uint32_t suInstId, uint32_t spInstId, uint32_t c /******************************************************************************/ -static ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1313,7 +1307,7 @@ static ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32 } /******************************************************************************/ -static ftdm_status_t handle_blo_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_blo_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1348,7 +1342,7 @@ static ftdm_status_t handle_blo_rsp(uint32_t suInstId, uint32_t spInstId, uint32 } /******************************************************************************/ -static ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1395,7 +1389,7 @@ static ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32 } /******************************************************************************/ -static ftdm_status_t handle_ubl_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_ubl_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1430,7 +1424,7 @@ static ftdm_status_t handle_ubl_rsp(uint32_t suInstId, uint32_t spInstId, uint32 } /******************************************************************************/ -static ftdm_status_t handle_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1483,7 +1477,7 @@ static ftdm_status_t handle_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32 } /******************************************************************************/ -static ftdm_status_t handle_local_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_local_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1536,7 +1530,7 @@ static ftdm_status_t handle_local_rsc_req(uint32_t suInstId, uint32_t spInstId, } /******************************************************************************/ -static ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1618,7 +1612,7 @@ static ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32 return FTDM_SUCCESS; } /******************************************************************************/ -static ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1700,7 +1694,7 @@ static ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32 } /******************************************************************************/ -static ftdm_status_t handle_grs_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_grs_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1795,7 +1789,7 @@ static ftdm_status_t handle_grs_rsp(uint32_t suInstId, uint32_t spInstId, uint32 } /******************************************************************************/ -static ftdm_status_t handle_local_blk(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_local_blk(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1839,7 +1833,7 @@ static ftdm_status_t handle_local_blk(uint32_t suInstId, uint32_t spInstId, uint } /******************************************************************************/ -static ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1883,7 +1877,7 @@ static ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint } /******************************************************************************/ -static ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1923,45 +1917,6 @@ static ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t /******************************************************************************/ -#if 0 -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - }; - - /* fill in here */ - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -#endif -/******************************************************************************/ - -/******************************************************************************/ /* For Emacs: * Local Variables: * mode:c @@ -1973,4 +1928,3 @@ static ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t * vim:set softtabstop=4 shiftwidth=4 tabstop=4: */ /******************************************************************************/ - diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c index 98554db..34893cf 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c @@ -53,31 +53,6 @@ void sngss7_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint void sngss7_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt); void sngss7_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit); -static ftdm_status_t handle_reattempt(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_resume(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - -static ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_cot_stop(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_cot(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - -static ftdm_status_t handle_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_local_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - -static ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_grs_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - -static ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_blo_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_ubl_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - -static ftdm_status_t handle_local_blk(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - -static ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - /******************************************************************************/ /* FUNCTIONS ******************************************************************/ @@ -85,8 +60,9 @@ void sngss7_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCo { SS7_FUNC_TRACE_ENTER(__FUNCTION__); - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + sngss7_event_data_t *sngss7_event = NULL; /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { @@ -95,119 +71,26 @@ void sngss7_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCo return; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); + /* initalize the sngss7_event */ + sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); + if (sngss7_event == NULL) { + SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx IAM\n"); - - /* check if the circuit has a remote block */ - if ((sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) || - (sngss7_test_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX)) || - (sngss7_test_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX))) { - - /* as per Q.764, 2.8.2.3 xiv ... remove the block from this channel */ - sngss7_clear_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX); - sngss7_clear_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX); - sngss7_clear_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX); - - /* KONRAD FIX ME : check in case there is a ckt and grp block */ + return; } + memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - /* check whether the ftdm channel is in a state to accept a call */ - switch (ftdmchan->state) { - /**************************************************************************/ - case (FTDM_CHANNEL_STATE_DOWN): /* only state it is fully valid to get IAM */ - - /* fill in the channels SS7 Stack information */ - sngss7_info->suInstId = get_unique_id(); - sngss7_info->spInstId = spInstId; - - /* try to open the ftdm channel */ - if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { - SS7_ERROR("Failed to open span: %d, chan: %d\n", - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id); - - /* set the flag to indicate this hangup is started from the local side */ - sngss7_set_flag(sngss7_info, FLAG_LOCAL_REL); - - ftdmchan->caller_data.hangup_cause = 41; - - /* move the state to CANCEL */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); - - } else { - - /* fill in cid/ani number */ - if (siConEvnt->cgPtyNum.addrSig.pres) { - copy_tknStr_from_sngss7(siConEvnt->cgPtyNum.addrSig, - ftdmchan->caller_data.cid_num.digits, - siConEvnt->cgPtyNum.oddEven); - - /* fill in cid Name */ - ftdm_set_string(ftdmchan->caller_data.cid_name, ftdmchan->caller_data.cid_num.digits); - - ftdm_set_string(ftdmchan->caller_data.ani.digits, ftdmchan->caller_data.cid_num.digits); - - } else { - SS7_INFO("No Calling party (ANI) information in IAM!\n"); - } - - /* fill in dnis */ - if (siConEvnt->cdPtyNum.addrSig.pres) { - copy_tknStr_from_sngss7(siConEvnt->cdPtyNum.addrSig, - ftdmchan->caller_data.dnis.digits, - siConEvnt->cdPtyNum.oddEven); - } else { - SS7_INFO("No Called party (DNIS) information in IAM!\n"); - } - - /* fill in rdnis */ - if (siConEvnt->redirgNum.addrSig.pres) { - copy_tknStr_from_sngss7(siConEvnt->redirgNum.addrSig, - ftdmchan->caller_data.rdnis.digits, - siConEvnt->cgPtyNum.oddEven); - } else { - SS7_INFO("No RDNIS party information in IAM!\n"); - } - - /* fill in screening/presentation */ - ftdmchan->caller_data.screen = siConEvnt->cgPtyNum.scrnInd.val; - ftdmchan->caller_data.pres = siConEvnt->cgPtyNum.presRest.val; - - /* set the state of the channel to collecting...the rest is done by the chan monitor */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); - - } /* if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) */ + /* fill in the sngss7_event struct */ + sngss7_event->spInstId = spInstId; + sngss7_event->suInstId = suInstId; + sngss7_event->circuit = circuit; + sngss7_event->event_id = SNGSS7_CON_IND_EVENT; + memcpy(&sngss7_event->event.siConEvnt, siConEvnt, sizeof(*siConEvnt)); - break; - /**************************************************************************/ - default: /* should not have gotten an IAM while in this state */ - SS7_ERROR("Got IAM in an invalid state (%s) on span=%d, chan=%d!\n", - ftdm_channel_state2str(ftdmchan->state), - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id); - - /* move the state of the channel to RESTART to force a reset */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - - break; - /**************************************************************************/ - } /* switch (ftdmchan->state) */ - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* enqueue this event */ + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; } /******************************************************************************/ @@ -215,8 +98,9 @@ void sngss7_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCo { SS7_FUNC_TRACE_ENTER(__FUNCTION__); - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + sngss7_event_data_t *sngss7_event = NULL; /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { @@ -225,59 +109,26 @@ void sngss7_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCo return; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); + /* initalize the sngss7_event */ + sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); + if (sngss7_event == NULL) { + SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - - /* check whether the ftdm channel is in a state to accept a call */ - switch (ftdmchan->state) { - /**************************************************************************/ - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx ANM\n"); - - /* go to UP */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_DIALING: - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CON\n"); - - /* go to UP */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); - - break; - /**************************************************************************/ - default: /* incorrect state...reset the CIC */ - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx ANM/CON\n"); - - /* throw the TX reset flag */ - sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX); - - /* go to RESTART */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - - break; - /**************************************************************************/ + return; } + memset(sngss7_event, 0x0, sizeof(*sngss7_event)); + + /* fill in the sngss7_event struct */ + sngss7_event->spInstId = spInstId; + sngss7_event->suInstId = suInstId; + sngss7_event->circuit = circuit; + sngss7_event->event_id = SNGSS7_CON_CFM_EVENT; + memcpy(&sngss7_event->event.siConEvnt, siConEvnt, sizeof(*siConEvnt)); - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* enqueue this event */ + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; } /******************************************************************************/ @@ -285,8 +136,9 @@ void sngss7_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCn { SS7_FUNC_TRACE_ENTER(__FUNCTION__); - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + sngss7_event_data_t *sngss7_event = NULL; /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { @@ -295,159 +147,27 @@ void sngss7_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCn return; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); + /* initalize the sngss7_event */ + sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); + if (sngss7_event == NULL) { + SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; + return; } + memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - switch (evntType) { - /**************************************************************************/ - case (ADDRCMPLT): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx ACM\n"); - switch (ftdmchan->state) { - /**********************************************************************/ - case FTDM_CHANNEL_STATE_DIALING: - /* KONRAD: should we confirm the instance ids ? */ - - /* need to grab the sp instance id */ - sngss7_info->spInstId = spInstId; - - /* go to PROGRESS */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); - break; - /**********************************************************************/ - default: /* incorrect state...reset the CIC */ - /* go to RESTART */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); - break; - /**********************************************************************/ - } /* switch (ftdmchan->state) */ - /**************************************************************************/ - case (MODIFY): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx MODIFY\n"); - break; - /**************************************************************************/ - case (MODCMPLT): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx MODIFY-COMPLETE\n"); - break; - /**************************************************************************/ - case (MODREJ): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx MODIFY-REJECT\n"); - break; - /**************************************************************************/ - case (PROGRESS): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CPG\n"); - break; - /**************************************************************************/ - case (FRWDTRSFR): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx FOT\n"); - break; - /**************************************************************************/ - case (INFORMATION): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx INF\n"); - break; - /**************************************************************************/ - case (INFORMATREQ): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx INR\n"); - break; - /**************************************************************************/ - case (SUBSADDR): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx SAM\n"); - break; - /**************************************************************************/ - case (EXIT): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx EXIT\n"); - break; - /**************************************************************************/ - case (NETRESMGT): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx NRM\n"); - break; - /**************************************************************************/ - case (IDENTREQ): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx IDR\n"); - break; - /**************************************************************************/ - case (IDENTRSP): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx IRS\n"); - break; - /**************************************************************************/ - case (MALCLLPRNT): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx MALICIOUS CALL\n"); - break; - /**************************************************************************/ - case (CHARGE): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CRG\n"); - break; - /**************************************************************************/ - case (TRFFCHGE): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CRG-TARIFF\n"); - break; - /**************************************************************************/ - case (CHARGEACK): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CRG-ACK\n"); - break; - /**************************************************************************/ - case (CALLOFFMSG): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CALL-OFFER\n"); - break; - /**************************************************************************/ - case (LOOPPRVNT): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx LOP\n"); - break; - /**************************************************************************/ - case (TECT_TIMEOUT): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx ECT-Timeout\n"); - break; - /**************************************************************************/ - case (RINGSEND): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx RINGING-SEND\n"); - break; - /**************************************************************************/ - case (CALLCLEAR): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CALL-LINE Clear\n"); - break; - /**************************************************************************/ - case (PRERELEASE): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx PRI\n"); - break; - /**************************************************************************/ - case (APPTRANSPORT): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx APM\n"); - break; - /**************************************************************************/ - case (OPERATOR): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx OPERATOR\n"); - break; - /**************************************************************************/ - case (METPULSE): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx METERING-PULSE\n"); - break; - /**************************************************************************/ - case (CLGPTCLR): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CALLING_PARTY_CLEAR\n"); - break; - /**************************************************************************/ - case (SUBDIRNUM): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx SUB-DIR\n"); - break; - /**************************************************************************/ - default: - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Unknown Msg\n"); - break; - /**************************************************************************/ - } + /* fill in the sngss7_event struct */ + sngss7_event->spInstId = spInstId; + sngss7_event->suInstId = suInstId; + sngss7_event->circuit = circuit; + sngss7_event->evntType = evntType; + sngss7_event->event_id = SNGSS7_CON_STA_EVENT; + memcpy(&sngss7_event->event.siCnStEvnt, siCnStEvnt, sizeof(*siCnStEvnt)); - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* enqueue this event */ + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; } /******************************************************************************/ @@ -455,8 +175,9 @@ void sngss7_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRe { SS7_FUNC_TRACE_ENTER(__FUNCTION__); - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + sngss7_event_data_t *sngss7_event = NULL; /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { @@ -465,186 +186,36 @@ void sngss7_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRe return; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx REL\n"); - - /* check whether the ftdm channel is in a state to release a call */ - switch (ftdmchan->state) { - /**************************************************************************/ - case FTDM_CHANNEL_STATE_DIALING: - - /* pass the release code up to FTDM */ - if (siRelEvnt->causeDgn.causeVal.pres) { - ftdmchan->caller_data.hangup_cause = siRelEvnt->causeDgn.causeVal.val; - } else { - SS7_ERROR("REL does not have a cause code!\n"); - ftdmchan->caller_data.hangup_cause = 0; - } - - /* this is a remote hangup request */ - sngss7_set_flag(sngss7_info, FLAG_REMOTE_REL); - - /* move the state of the channel to CANCEL to end the call */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_RING: - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - case FTDM_CHANNEL_STATE_UP: - - /* pass the release code up to FTDM */ - if (siRelEvnt->causeDgn.causeVal.pres) { - ftdmchan->caller_data.hangup_cause = siRelEvnt->causeDgn.causeVal.val; - } else { - SS7_ERROR("REL does not have a cause code!\n"); - ftdmchan->caller_data.hangup_cause = 0; - } - - /* this is a remote hangup request */ - sngss7_set_flag(sngss7_info, FLAG_REMOTE_REL); - - /* move the state of the channel to TERMINATING to end the call */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - - break; - /**************************************************************************/ - default: - - /* fill in the channels SS7 Stack information */ - sngss7_info->suInstId = get_unique_id(); - sngss7_info->spInstId = spInstId; - - /* throw the reset flag */ - sngss7_set_flag(sngss7_info, FLAG_RESET_RX); - - /* set the state to RESTART */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - break; - /**************************************************************************/ - } /* switch (ftdmchan->state) */ - - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - - -/******************************************************************************/ -void sngss7_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + /* initalize the sngss7_event */ + sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); + if (sngss7_event == NULL) { + SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); SS7_FUNC_TRACE_EXIT(__FUNCTION__); return; } + memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx RLC\n"); - - /* check whether the ftdm channel is in a state to accept a call */ - switch (ftdmchan->state) { - /**************************************************************************/ - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - - /* go to DOWN */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + /* fill in the sngss7_event struct */ + sngss7_event->spInstId = spInstId; + sngss7_event->suInstId = suInstId; + sngss7_event->circuit = circuit; + sngss7_event->event_id = SNGSS7_REL_IND_EVENT; + memcpy(&sngss7_event->event.siRelEvnt, siRelEvnt, sizeof(*siRelEvnt)); - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_DOWN: - /* do nothing, just drop the message */ - break; - /**************************************************************************/ - default: - /* KONRAD: should just stop the call...but a reset is easier for now (since it does hangup the call) */ - - /* go to RESTART */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - - break; - /**************************************************************************/ - } - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* enqueue this event */ + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; } /******************************************************************************/ -void sngss7_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiInfoEvnt *siInfoEvnt) +void sngss7_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx DATA IND\n"); - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - -/******************************************************************************/ -void sngss7_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + sngss7_event_data_t *sngss7_event = NULL; /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { @@ -653,101 +224,36 @@ void sngss7_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint return; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx FAC\n"); - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - -/******************************************************************************/ -void sngss7_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + /* initalize the sngss7_event */ + sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); + if (sngss7_event == NULL) { + SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); SS7_FUNC_TRACE_EXIT(__FUNCTION__); return; } + memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx FAC-CON\n"); + /* fill in the sngss7_event struct */ + sngss7_event->spInstId = spInstId; + sngss7_event->suInstId = suInstId; + sngss7_event->circuit = circuit; + sngss7_event->event_id = SNGSS7_REL_CFM_EVENT; + memcpy(&sngss7_event->event.siRelEvnt, siRelEvnt, sizeof(*siRelEvnt)); - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* enqueue this event */ + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; } /******************************************************************************/ -void sngss7_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit) +void sngss7_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiInfoEvnt *siInfoEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx USER-USER msg\n"); - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - -/* GENERAL STATUS *************************************************************/ -void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + sngss7_event_data_t *sngss7_event = NULL; /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { @@ -756,1210 +262,186 @@ void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint return; } - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - switch (evntType) { - /**************************************************************************/ - case SIT_STA_REATTEMPT: /* reattempt indication */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Reattempt indication\n"); - handle_reattempt(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_ERRORIND: /* error indication */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Error indication\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CONTCHK: /* continuity check */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx COT start\n"); - handle_cot_start(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CONTREP: /* continuity report */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx COT report\n"); - handle_cot(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_STPCONTIN: /* stop continuity */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx COT stop\n"); - handle_cot_stop(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CGQRYRSP: /* circuit grp query response from far end forwarded to upper layer by ISUP */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CQM\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CONFUSION: /* confusion */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CFN\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_LOOPBACKACK: /* loop-back acknowledge */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx LPA\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CIRRSRVREQ: /* circuit reservation request */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Ckt Resveration req\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CIRRSRVACK: /* circuit reservation acknowledgement */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Ckt Res ack\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CIRBLOREQ: /* circuit blocking request */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx BLO\n"); - handle_blo_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRBLORSP: /* circuit blocking response */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx BLA\n"); - handle_blo_rsp(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRUBLREQ: /* circuit unblocking request */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx UBL\n"); - handle_ubl_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRUBLRSP: /* circuit unblocking response */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx UBA\n"); - handle_ubl_rsp(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRRESREQ: /* circuit reset request - RSC */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx RSC\n"); - handle_rsc_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRLOCRES: /* reset initiated locally by the software */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Local RSC\n"); - handle_local_rsc_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRRESRSP: /* circuit reset response */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx RSC-RLC\n"); - handle_rsc_rsp(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CGBREQ: /* CGB request */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CGB\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CGUREQ: /* CGU request */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CGU\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CGQRYREQ: /* circuit group query request */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CQM\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CGBRSP: /* mntc. oriented CGB response */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx mntc CGB\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CGURSP: /* mntc. oriented CGU response */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx mntc CGU\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_GRSREQ: /* circuit group reset request */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx GRS\n"); - handle_grs_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRUNEQPD: /* circuit unequipped indication */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx UCIC\n"); - handle_ucic(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_GRSRSP: /* circuit group reset response */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx GRA\n"); - handle_grs_rsp(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_PAUSEIND: /* pause indication */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx SUS\n"); - handle_pause(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_RESUMEIND: /* resume indication */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx RES\n"); - handle_resume(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_USRPARTA: /* user part available */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx UPA\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_RMTUSRUNAV: /* remote user not available */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Remote User not Available\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_MTPCONG0: /* congestion indication level 0 */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Congestion L0\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_MTPCONG1: /* congestion indication level 1 */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Congestion L1\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_MTPCONG2: /* congestion indication level 2 */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Congestion L2\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_MTPCONG3: /* congestion indication level 3 */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Congestion L3\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_MTPSTPCONG: /* stop congestion indication level 0 */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Stop Congestion\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CIRLOCALBLOIND: /* Mngmt local blocking */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Local BLO\n"); - handle_local_blk(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRLOCALUBLIND: /* Mngmt local unblocking */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Local UBL\n"); - handle_local_ubl(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_OVERLOAD: /* Overload */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Overload\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_LMCGBREQ: /* when LM requests ckt grp blocking */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx LM CGB\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_LMCGUREQ: /* when LM requests ckt grp unblocking */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx LM CGU\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_LMGRSREQ: /* when LM requests ckt grp reset */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx LM RSC\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CGBINFOIND: /* circuit grp blking ind , no resp req */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CGB no resp req\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_LMCQMINFOREQ: /* when LM requests ckt grp query */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx LM CQM\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CIRLOCGRS: /* group reset initiated locally by the software */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Local GRS\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - default: - SS7_INFO("[SNG-CC] Received Unknown indication %d\n", evntType); - break; - } /* switch (evntType) */ - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - -/******************************************************************************/ -static ftdm_status_t handle_reattempt(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - /* glare, throw the flag, go to down state*/ - sngss7_set_flag(sngss7_info, FLAG_GLARE); - - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - int infId; - int i; - - /* extract the affect infId from the circuit structure */ - infId = g_ftdm_sngss7_data.cfg.isupCkt[circuit].infId; - - /* go through all the circuits now and find any other circuits on this infId */ - i = 1; - while (g_ftdm_sngss7_data.cfg.isupCkt[i].id != 0) { - - /* check that the infId matches and that this is not a siglink */ - if ((g_ftdm_sngss7_data.cfg.isupCkt[i].infId == infId) && - (g_ftdm_sngss7_data.cfg.isupCkt[i].type == VOICE)) { - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - i++; - continue; - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - i++; - SS7_ASSERT; - }; - - /* check if the circuit is fully started */ - if (ftdm_test_flag(ftdmchan->span, FTDM_SPAN_IN_THREAD)) { - /* set the pause flag on the channel */ - sngss7_set_flag(sngss7_info, FLAG_INFID_PAUSED); - - /* set the statet o SUSPENDED to bring the sig status down */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - } - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - } /* if (g_ftdm_sngss7_data.cfg.isupCkt[i].infId == infId) */ - - /* move to the next circuit */ - i++; - - } /* while (g_ftdm_sngss7_data.cfg.isupCkt[i].id != 0) */ - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_resume(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - int infId; - int i; - - /* extract the affect infId from the circuit structure */ - infId = g_ftdm_sngss7_data.cfg.isupCkt[circuit].infId; - - /* go through all the circuits now and find any other circuits on this infId */ - i = 1; - while (g_ftdm_sngss7_data.cfg.isupCkt[i].id != 0) { - - /* check that the infId matches and that this is not a siglink */ - if ((g_ftdm_sngss7_data.cfg.isupCkt[i].infId == infId) && - (g_ftdm_sngss7_data.cfg.isupCkt[i].type == VOICE)) { - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - i++; - continue; - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - i++; - SS7_ASSERT; - }; - - /* only resume if we are paused */ - if (sngss7_test_flag(sngss7_info, FLAG_INFID_PAUSED)) { - /* set the resume flag on the channel */ - sngss7_set_flag(sngss7_info, FLAG_INFID_RESUME); - - /* clear the paused flag */ - sngss7_clear_flag(sngss7_info, FLAG_INFID_PAUSED); - - /* set the statet to SUSPENDED to bring the sig status up */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - } - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - } /* if (g_ftdm_sngss7_data.cfg.isupCkt[i].infId == infId) */ - - /* move to the next circuit */ - i++; - - } /* while (g_ftdm_sngss7_data.cfg.isupCkt[i].id != 0) */ - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - /* open the channel if it is not open */ - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) { - if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { - SS7_ERROR("Failed to open CIC %d for COT test!\n", sngss7_info->circuit->cic); - /* KONRAD FIX ME */ - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } - } - - /* tell the core to loop the channel */ - ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_LOOP, NULL); - - /* switch to the IN_LOOP state */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IN_LOOP); - - /* store the sngss7 ids */ - if (suInstId == 0) { - sngss7_info->suInstId = get_unique_id(); - } else { - sngss7_info->suInstId = suInstId; - } - sngss7_info->spInstId = spInstId; - sngss7_info->globalFlg = globalFlg; - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_cot_stop(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - /* tell the core to stop looping the channel */ - ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL); - - /* exit out of the LOOP state to the last state */ - ftdm_set_state_locked(ftdmchan, ftdmchan->last_state); - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_cot(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - if ( (siStaEvnt->contInd.eh.pres > 0) && (siStaEvnt->contInd.contInd.pres > 0)) { - SS7_INFO("Continuity Test result for CIC = %d (span %d, chan %d) is: \"%s\"\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - g_ftdm_sngss7_data.cfg.isupCkt[circuit].span, - g_ftdm_sngss7_data.cfg.isupCkt[circuit].chan, - (siStaEvnt->contInd.contInd.val) ? "PASS" : "FAIL"); - } else { - SS7_ERROR("Recieved Continuity report containing no results!\n"); - } - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ - - -/******************************************************************************/ -static ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - /* check if the circuit is already blocked or not */ - if (sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) { - SS7_WARN("Received BLO on circuit that is already blocked!\n"); - } - - /* throw the ckt block flag */ - sngss7_set_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX); - - /* set the channel to suspended state */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_blo_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + /* initalize the sngss7_event */ + sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); + if (sngss7_event == NULL) { + SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; + return; } + memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - /* KONRAD FIX ME */ + /* fill in the sngss7_event struct */ + sngss7_event->spInstId = spInstId; + sngss7_event->suInstId = suInstId; + sngss7_event->circuit = circuit; + sngss7_event->event_id = SNGSS7_DAT_IND_EVENT; + memcpy(&sngss7_event->event.siInfoEvnt, siInfoEvnt, sizeof(*siInfoEvnt)); - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* enqueue this event */ + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; } /******************************************************************************/ -static ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +void sngss7_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + sngss7_event_data_t *sngss7_event = NULL; /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - /* check if the channel is blocked */ - if (!(sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX))) { - SS7_WARN("Received UBL on circuit that is not blocked!\n"); + return; } - /* throw the unblock flag */ - sngss7_set_flag(sngss7_info, FLAG_CKT_MN_UNBLK_RX); - - /* clear the block flag */ - sngss7_clear_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX); - - /* set the channel to suspended state */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_ubl_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + /* initalize the sngss7_event */ + sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); + if (sngss7_event == NULL) { + SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; + return; } + memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); + /* fill in the sngss7_event struct */ + sngss7_event->spInstId = spInstId; + sngss7_event->suInstId = suInstId; + sngss7_event->circuit = circuit; + sngss7_event->evntType = evntType; + sngss7_event->event_id = SNGSS7_FAC_IND_EVENT; + memcpy(&sngss7_event->event.siFacEvnt, siFacEvnt, sizeof(*siFacEvnt)); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - /* KONRAD FIX ME */ - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* enqueue this event */ + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; } /******************************************************************************/ -static ftdm_status_t handle_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +void sngss7_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + sngss7_event_data_t *sngss7_event = NULL; /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - /* throw the reset flag */ - sngss7_set_flag(sngss7_info, FLAG_RESET_RX); - - switch (ftdmchan->state) { - /**************************************************************************/ - case FTDM_CHANNEL_STATE_RESTART: - - /* go to idle so that we can redo the restart state*/ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE); - - break; - /**************************************************************************/ - default: - - /* set the state of the channel to restart...the rest is done by the chan monitor */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - break; - /**************************************************************************/ + return; } - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_local_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + /* initalize the sngss7_event */ + sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); + if (sngss7_event == NULL) { + SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; + return; } + memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - /* throw the reset flag */ - sngss7_set_flag(sngss7_info, FLAG_RESET_RX); - - switch (ftdmchan->state) { - /**************************************************************************/ - case FTDM_CHANNEL_STATE_RESTART: - - /* go to idle so that we can redo the restart state*/ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE); + /* fill in the sngss7_event struct */ + sngss7_event->spInstId = spInstId; + sngss7_event->suInstId = suInstId; + sngss7_event->circuit = circuit; + sngss7_event->evntType = evntType; + sngss7_event->event_id = SNGSS7_FAC_CFM_EVENT; + memcpy(&sngss7_event->event.siFacEvnt, siFacEvnt, sizeof(*siFacEvnt)); - break; - /**************************************************************************/ - default: - - /* set the state of the channel to restart...the rest is done by the chan monitor */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - break; - /**************************************************************************/ - } - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* enqueue this event */ + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; } /******************************************************************************/ -static ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +void sngss7_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + sngss7_event_data_t *sngss7_event = NULL; /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - switch (ftdmchan->state) { - /**********************************************************************/ - case FTDM_CHANNEL_STATE_RESTART: - - if ( sngss7_test_flag(sngss7_info, FLAG_RESET_TX) ) { - /* throw the FLAG_RESET_TX_RSP to indicate we have acknowledgement from the remote side */ - sngss7_set_flag(sngss7_info, FLAG_RESET_TX_RSP); - - /* go to DOWN */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } else { - SS7_ERROR("Received RSC-RLC but we're not waiting on a RSC-RLC on CIC #, dropping\n", sngss7_info->circuit->cic); - } - - break; - /**********************************************************************/ - case FTDM_CHANNEL_STATE_DOWN: - - /* do nothing, just drop the message */ - SS7_DEBUG("Receveived RSC-RLC in down state, dropping\n"); - - break; - /**********************************************************************/ - case FTDM_CHANNEL_STATE_TERMINATING: - case FTDM_CHANNEL_STATE_HANGUP: - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - - /* throw the FLAG_RESET_TX_RSP to indicate we have acknowledgement from the remote side */ - sngss7_set_flag(sngss7_info, FLAG_RESET_TX_RSP); - - /* go to DOWN */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - - break; - /**********************************************************************/ - default: - /* ITU Q764-2.9.5.1.c -> release the circuit */ - if ((siStaEvnt != NULL) && - (siStaEvnt->causeDgn.eh.pres ==PRSNT_NODEF) && - (siStaEvnt->causeDgn.causeVal.pres == PRSNT_NODEF)) { - ftdmchan->caller_data.hangup_cause = siStaEvnt->causeDgn.causeVal.val; - } else { - ftdmchan->caller_data.hangup_cause = 98; /* Message not compatiable with call state */ - } - - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - break; - /**********************************************************************/ - } - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} -/******************************************************************************/ -static ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - sngss7_span_data_t *span = NULL; - int range; - int x; - - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; + return; } - /* extract the range value from the event structure */ - if ((siStaEvnt->rangStat.eh.pres == PRSNT_NODEF) && (siStaEvnt->rangStat.range.pres == PRSNT_NODEF)) { - range = siStaEvnt->rangStat.range.val; - } else { - SS7_ERROR("Received GRS with no range value on CIC = %d\n", sngss7_info->circuit->cic); + /* initalize the sngss7_event */ + sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); + if (sngss7_event == NULL) { + SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } - - /* loop over the cics starting from circuit until range+1 */ - for (x = circuit; x < (circuit + range + 1); x++) { - /* grab the circuit in question */ - if (extract_chan_data(x, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", x); - break; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_ASSERT; - }; - - /* fill in the span structure for this circuit */ - span = ftdmchan->span->mod_data; - span->grs.circuit = circuit; - span->grs.range = range; - - SS7_DEBUG_CHAN(ftdmchan, "Rx GRS (%d:%d)\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - (g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic + range)); - - /* flag the channel as having received a reset */ - sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_RX); - - switch (ftdmchan->state) { - /**************************************************************************/ - case FTDM_CHANNEL_STATE_RESTART: - - /* go to idle so that we can redo the restart state*/ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE); - - break; - /**************************************************************************/ - default: - - /* set the state of the channel to restart...the rest is done by the chan monitor */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - break; - /**************************************************************************/ - } - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - + return; } + memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_grs_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); + /* fill in the sngss7_event struct */ + sngss7_event->spInstId = spInstId; + sngss7_event->suInstId = suInstId; + sngss7_event->circuit = circuit; + sngss7_event->event_id = SNGSS7_UMSG_IND_EVENT; - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - int range; - int x; - - /* extract the range value from the event structure */ - if ((siStaEvnt->rangStat.eh.pres == PRSNT_NODEF) && (siStaEvnt->rangStat.range.pres == PRSNT_NODEF)) { - range = siStaEvnt->rangStat.range.val; - } else { - SS7_ERROR("Received GRA with no range value on CIC = %d\n", sngss7_info->circuit->cic); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } + /* enqueue this event */ + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); - /* go through all the circuits in the range */ - for ( x = circuit; x < (circuit + range + 1); x++) { - - /* grab the circuit in question */ - if (extract_chan_data(x, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - break; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_ASSERT; - }; - - SS7_DEBUG_CHAN(ftdmchan, "Rx GRA (%d:%d)\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - (g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic + range)); - - switch (ftdmchan->state) { - /**********************************************************************/ - case FTDM_CHANNEL_STATE_RESTART: - - /* throw the FLAG_RESET_TX_RSP to indicate we have acknowledgement from the remote side */ - sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP); - - /* go to DOWN */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - - break; - /**********************************************************************/ - case FTDM_CHANNEL_STATE_DOWN: - - /* do nothing, just drop the message */ - SS7_DEBUG("Receveived GRA in down state, dropping\n"); - - break; - /**********************************************************************/ - case FTDM_CHANNEL_STATE_TERMINATING: - case FTDM_CHANNEL_STATE_HANGUP: - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - - /* throw the FLAG_RESET_TX_RSP to indicate we have acknowledgement from the remote side */ - sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP); - - break; - /**********************************************************************/ - default: - /* ITU Q764-2.9.5.1.c -> release the circuit */ - if ((siStaEvnt != NULL) && - (siStaEvnt->causeDgn.eh.pres ==PRSNT_NODEF) && - (siStaEvnt->causeDgn.causeVal.pres == PRSNT_NODEF)) { - ftdmchan->caller_data.hangup_cause = siStaEvnt->causeDgn.causeVal.val; - } else { - ftdmchan->caller_data.hangup_cause = 98; /* Message not compatiable with call state */ - } - - /* go to terminating to hang up the call */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - break; - /**********************************************************************/ - } - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - } /* for (( x = 0; x < (circuit + range); x++) */ - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_local_blk(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - /* check if the circuit is already blocked or not */ - if (sngss7_test_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX)) { - SS7_WARN("Received local BLO on circuit that is already blocked!\n"); - } - - /* throw the ckt block flag */ - sngss7_set_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX); - /* set the channel to suspended state */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; } - -/******************************************************************************/ -static ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +/* GENERAL STATUS *************************************************************/ +void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + sngss7_event_data_t *sngss7_event = NULL; /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - /* check if the circuit is already blocked or not */ - if (sngss7_test_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX)) { - SS7_WARN("Received local UBL on circuit that is already unblocked!\n"); + return; } - /* throw the ckt block flag */ - sngss7_set_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX); - - /* set the channel to suspended state */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + /* initalize the sngss7_event */ + sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); + if (sngss7_event == NULL) { + SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; + return; } + memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - /* throw the ckt block flag */ - sngss7_set_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK); - - /* set the channel to suspended state */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} - - -/******************************************************************************/ -#if 0 -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; + /* fill in the sngss7_event struct */ + sngss7_event->spInstId = spInstId; + sngss7_event->suInstId = suInstId; + sngss7_event->circuit = circuit; + sngss7_event->globalFlg = globalFlg; + sngss7_event->evntType = evntType; + sngss7_event->event_id = SNGSS7_STA_IND_EVENT; + if (siStaEvnt != NULL) { + memcpy(&sngss7_event->event.siStaEvnt, siStaEvnt, sizeof(*siStaEvnt)); } - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - }; - - /* fill in here */ - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* enqueue this event */ + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; } /******************************************************************************/ -#endif -/******************************************************************************/ /******************************************************************************/ /* For Emacs: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index fc2c1a6..a9851bd 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -46,7 +46,8 @@ ftdm_sngss7_data_t g_ftdm_sngss7_data; /* PROTOTYPES *****************************************************************/ static void *ftdm_sangoma_ss7_run (ftdm_thread_t * me, void *obj); -static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan); +static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t *ftdmchan); +static void ftdm_sangoma_ss7_process_stack_event (sngss7_event_data_t *sngss7_event); static ftdm_status_t ftdm_sangoma_ss7_stop (ftdm_span_t * span); static ftdm_status_t ftdm_sangoma_ss7_start (ftdm_span_t * span); @@ -268,11 +269,12 @@ ftdm_state_map_t sangoma_ss7_state_map = { /* MONITIOR THREADS ***********************************************************/ static void *ftdm_sangoma_ss7_run(ftdm_thread_t * me, void *obj) { - ftdm_interrupt_t *ftdm_sangoma_ss7_int = NULL; + ftdm_interrupt_t *ftdm_sangoma_ss7_int[2]; ftdm_span_t *ftdmspan = (ftdm_span_t *) obj; ftdm_channel_t *ftdmchan = NULL; sngss7_chan_data_t *sngss7_info = NULL; - sngss7_span_data_t *sngss7_span = NULL; + sngss7_event_data_t *sngss7_event = NULL; + sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->mod_data; int i; ftdm_log (FTDM_LOG_INFO, "ftmod_sangoma_ss7 monitor thread for span=%u started.\n", ftdmspan->span_id); @@ -280,31 +282,53 @@ static void *ftdm_sangoma_ss7_run(ftdm_thread_t * me, void *obj) /* set IN_THREAD flag so that we know this thread is running */ ftdm_set_flag (ftdmspan, FTDM_SPAN_IN_THREAD); - /* get an interrupt queue for this span */ - if (ftdm_queue_get_interrupt (ftdmspan->pendingchans, &ftdm_sangoma_ss7_int) != FTDM_SUCCESS) { - SS7_CRITICAL ("Failed to get a ftdm_interrupt for span = %d!\n", ftdmspan->span_id); + /* get an interrupt queue for this span for channel state changes */ + if (ftdm_queue_get_interrupt (ftdmspan->pendingchans, &ftdm_sangoma_ss7_int[0]) != FTDM_SUCCESS) { + SS7_CRITICAL ("Failed to get a ftdm_interrupt for span = %d for channel state changes!\n", ftdmspan->span_id); + goto ftdm_sangoma_ss7_run_exit; + } + + /* get an interrupt queue for this span for Trillium events */ + if (ftdm_queue_get_interrupt (sngss7_span->event_queue, &ftdm_sangoma_ss7_int[1]) != FTDM_SUCCESS) { + SS7_CRITICAL ("Failed to get a ftdm_interrupt for span = %d for Trillium event queue!\n", ftdmspan->span_id); goto ftdm_sangoma_ss7_run_exit; } while (ftdm_running () && !(ftdm_test_flag (ftdmspan, FTDM_SPAN_STOP_THREAD))) { - /* find out why we returned from the interrupt queue */ - switch ((ftdm_interrupt_wait (ftdm_sangoma_ss7_int, 100))) { + /* check the channel state queue for an event*/ + switch ((ftdm_interrupt_multiple_wait(ftdm_sangoma_ss7_int, 2, 100))) { /**********************************************************************/ - case FTDM_SUCCESS: /* there was a state change on the span */ - /* process all pending state changes */ + case FTDM_SUCCESS: /* process all pending state changes */ + /* clean out all pending channel state changes */ while ((ftdmchan = ftdm_queue_dequeue (ftdmspan->pendingchans))) { /* double check that this channel has a state change pending */ if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { + /*first lock the channel */ + ftdm_mutex_lock(ftdmchan->mutex); + ftdm_sangoma_ss7_process_state_change (ftdmchan); + + /* unlock the channel */ + ftdm_mutex_unlock (ftdmchan->mutex); } else { - SS7_ERROR("ftdm_core reported state change, but state change flag not set on ft-span = %d, ft-chan = %d\n", + /* since we handle state changes again after handling the trillium queue + * this can occur since we'll clear the flag for the event but can't pop + * the channel out of pendingchans + */ +/* SS7_ERROR("ftdm_core reported state change, but state change flag not set on ft-span = %d, ft-chan = %d\n", ftdmchan->physical_span_id, - ftdmchan->physical_chan_id); + ftdmchan->physical_chan_id);*/ } }/* while ((ftdmchan = ftdm_queue_dequeue(ftdmspan->pendingchans))) */ + /* clean out all pending stack events */ + while ((sngss7_event = ftdm_queue_dequeue(sngss7_span->event_queue))) { + ftdm_sangoma_ss7_process_stack_event(sngss7_event); + ftdm_safe_free(sngss7_event); + }/* while ((sngss7_event = ftdm_queue_dequeue(ftdmspan->signal_data->event_queue))) */ + break; /**********************************************************************/ case FTDM_TIMEOUT: @@ -413,6 +437,81 @@ ftdm_sangoma_ss7_run_exit: } /******************************************************************************/ +static void ftdm_sangoma_ss7_process_stack_event (sngss7_event_data_t *sngss7_event) +{ + sngss7_chan_data_t *sngss7_info ; + ftdm_channel_t *ftdmchan; + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(sngss7_event->circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", sngss7_event->circuit); + return; + } + + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* figure out the type of event and send it to the right handler */ + switch (sngss7_event->event_id) { + /**************************************************************************/ + case (SNGSS7_CON_IND_EVENT): + handle_con_ind(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, &sngss7_event->event.siConEvnt); + break; + /**************************************************************************/ + case (SNGSS7_CON_CFM_EVENT): + handle_con_cfm(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, &sngss7_event->event.siConEvnt); + break; + /**************************************************************************/ + case (SNGSS7_CON_STA_EVENT): + handle_con_sta(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, &sngss7_event->event.siCnStEvnt, sngss7_event->evntType); + break; + /**************************************************************************/ + case (SNGSS7_REL_IND_EVENT): + handle_rel_ind(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, &sngss7_event->event.siRelEvnt); + break; + /**************************************************************************/ + case (SNGSS7_REL_CFM_EVENT): + handle_rel_cfm(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, &sngss7_event->event.siRelEvnt); + break; + /**************************************************************************/ + case (SNGSS7_DAT_IND_EVENT): + handle_dat_ind(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, &sngss7_event->event.siInfoEvnt); + break; + /**************************************************************************/ + case (SNGSS7_FAC_IND_EVENT): + handle_fac_ind(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, sngss7_event->evntType, &sngss7_event->event.siFacEvnt); + break; + /**************************************************************************/ + case (SNGSS7_FAC_CFM_EVENT): + handle_fac_cfm(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, sngss7_event->evntType, &sngss7_event->event.siFacEvnt); + break; + /**************************************************************************/ + case (SNGSS7_UMSG_IND_EVENT): + handle_umsg_ind(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit); + break; + /**************************************************************************/ + case (SNGSS7_STA_IND_EVENT): + handle_sta_ind(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, sngss7_event->globalFlg, sngss7_event->evntType, &sngss7_event->event.siStaEvnt); + break; + /**************************************************************************/ + default: + SS7_ERROR("Unknown Event Id!\n"); + break; + /**************************************************************************/ + } /* switch (sngss7_event->event_id) */ + + /* while there's a state change present on this channel process it */ + while (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { + ftdm_sangoma_ss7_process_state_change(ftdmchan); + } + + /* unlock the channel */ + ftdm_mutex_unlock(ftdmchan->mutex); + + return; +} + +/******************************************************************************/ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) { ftdm_sigmsg_t sigev; @@ -426,9 +525,6 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) sigev.span_id = ftdmchan->span_id; sigev.channel = ftdmchan; - /*first lock the channel */ - ftdm_mutex_lock (ftdmchan->mutex); - SS7_DEBUG_CHAN(ftdmchan, "ftmod_sangoma_ss7 processing state %s\n", ftdm_channel_state2str (ftdmchan->state)); /* clear the state change flag...since we might be setting a new state */ @@ -1052,9 +1148,6 @@ suspend_goto_restart: /**************************************************************************/ }/*switch (ftdmchan->state) */ - /*unlock */ - ftdm_mutex_unlock (ftdmchan->mutex); - return; } @@ -1254,7 +1347,7 @@ static ftdm_status_t ftdm_sangoma_ss7_stop(ftdm_span_t * span) /* SIG_FUNCTIONS ***************************************************************/ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_ss7_span_config) { - sngss7_span_data_t *ss7_span_info; + sngss7_span_data_t *ss7_span_info; ftdm_log (FTDM_LOG_INFO, "Configuring ftmod_sangoma_ss7 span = %s(%d)...\n", span->name, @@ -1264,29 +1357,20 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_ss7_span_config) ss7_span_info = ftdm_calloc (1, sizeof (sngss7_span_data_t)); /* create a timer schedule */ - if (ftdm_sched_create (&ss7_span_info->sched, "SngSS7_Schedule")) { - SS7_CRITICAL ("Unable to create timer schedule!\n"); + if (ftdm_sched_create(&ss7_span_info->sched, "SngSS7_Schedule")) { + SS7_CRITICAL("Unable to create timer schedule!\n"); return FTDM_FAIL; } /* start the free run thread for the schedule */ - if (ftdm_sched_free_run (ss7_span_info->sched)) { - SS7_CRITICAL ("Unable to schedule free run!\n"); + if (ftdm_sched_free_run(ss7_span_info->sched)) { + SS7_CRITICAL("Unable to schedule free run!\n"); return FTDM_FAIL; } - /* attach the span info to the span */ - span->mod_data = ss7_span_info; - - /* parse the configuration and apply to the global config structure */ - if (ftmod_ss7_parse_xml(ftdm_parameters, span)) { - ftdm_log (FTDM_LOG_CRIT, "Failed to parse configuration!\n"); - return FTDM_FAIL; - } - - /* configure libsngss7 */ - if (ft_to_sngss7_cfg_all()) { - ftdm_log (FTDM_LOG_CRIT, "Failed to configure LibSngSS7!\n"); + /* create an event queue for this span */ + if ((ftdm_queue_create(&(ss7_span_info)->event_queue, SNGSS7_EVENT_QUEUE_SIZE)) != FTDM_SUCCESS) { + SS7_CRITICAL("Unable to create event queue!\n"); return FTDM_FAIL; } @@ -1302,9 +1386,22 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_ss7_span_config) span->get_channel_sig_status = ftdm_sangoma_ss7_get_sig_status; span->set_channel_sig_status = ftdm_sangoma_ss7_set_sig_status; span->state_map = &sangoma_ss7_state_map; + span->mod_data = ss7_span_info; ftdm_set_flag (span, FTDM_SPAN_USE_CHAN_QUEUE); + /* parse the configuration and apply to the global config structure */ + if (ftmod_ss7_parse_xml(ftdm_parameters, span)) { + ftdm_log (FTDM_LOG_CRIT, "Failed to parse configuration!\n"); + return FTDM_FAIL; + } + + /* configure libsngss7 */ + if (ft_to_sngss7_cfg_all()) { + ftdm_log (FTDM_LOG_CRIT, "Failed to configure LibSngSS7!\n"); + return FTDM_FAIL; + } + ftdm_log (FTDM_LOG_INFO, "Finished configuring ftmod_sangoma_ss7 span = %s(%d)...\n", span->name, span->span_id); @@ -1336,7 +1433,7 @@ static FIO_SIG_LOAD_FUNCTION(ftdm_sangoma_ss7_init) /* message (IAM, ACM, ANM, etc) trace initizalation */ g_ftdm_sngss7_data.message_trace = 1; - g_ftdm_sngss7_data.message_trace_level = 7; + g_ftdm_sngss7_data.message_trace_level = 6; /* setup the call backs needed by Sangoma_SS7 library */ sng_event.cc.sng_con_ind = sngss7_con_ind; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index 6bfc38e..3bf12ae 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -50,12 +50,26 @@ /******************************************************************************/ /* DEFINES ********************************************************************/ -#define MAX_NAME_LEN 10 -#define MAX_PATH 255 +#define MAX_NAME_LEN 10 +#define MAX_PATH 255 -#define MAX_CIC_LENGTH 5 -#define MAX_CIC_MAP_LENGTH 1000 +#define MAX_CIC_LENGTH 5 +#define MAX_CIC_MAP_LENGTH 1000 +#define SNGSS7_EVENT_QUEUE_SIZE 100 + +typedef enum { + SNGSS7_CON_IND_EVENT = 0, + SNGSS7_CON_CFM_EVENT, + SNGSS7_CON_STA_EVENT, + SNGSS7_REL_IND_EVENT, + SNGSS7_REL_CFM_EVENT, + SNGSS7_DAT_IND_EVENT, + SNGSS7_FAC_IND_EVENT, + SNGSS7_FAC_CFM_EVENT, + SNGSS7_UMSG_IND_EVENT, + SNGSS7_STA_IND_EVENT +} sng_event_type_t; typedef enum { VOICE = 0, @@ -334,8 +348,31 @@ typedef struct sngss7_chan_data { typedef struct sngss7_span_data { ftdm_sched_t *sched; sngss7_group_data_t grs; + ftdm_queue_t *event_queue; }sngss7_span_data_t; +typedef struct sngss7_event_data +{ + uint32_t event_id; + uint32_t spId; + uint32_t suId; + uint32_t spInstId; + uint32_t suInstId; + uint32_t circuit; + uint8_t globalFlg; + uint8_t evntType; + union + { + SiConEvnt siConEvnt; + SiCnStEvnt siCnStEvnt; + SiRelEvnt siRelEvnt; + SiInfoEvnt siInfoEvnt; + SiFacEvnt siFacEvnt; + SiStaEvnt siStaEvnt; + } event; +} sngss7_event_data_t; + + typedef enum { @@ -441,6 +478,36 @@ void sngss7_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); void sngss7_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit); +ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); +ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCnStEvnt *siCnStEvnt, uint8_t evntType); +ftdm_status_t handle_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); +ftdm_status_t handle_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt); +ftdm_status_t handle_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt); +ftdm_status_t handle_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiInfoEvnt *siInfoEvnt); +ftdm_status_t handle_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt); +ftdm_status_t handle_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt); +ftdm_status_t handle_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit); +ftdm_status_t handle_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); + +ftdm_status_t handle_reattempt(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_resume(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_cot_stop(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_cot(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_local_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_grs_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_blo_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_ubl_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_local_blk(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); + uint8_t copy_cgPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum); uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum); uint8_t copy_cdPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum); commit 65ce3554c8fcc0d75b0472470b3fd8dab58853b1 Author: Moises Silva <moy@sangoma.com> Date: Wed Sep 1 11:21:29 2010 -0400 freetdm: added proper bearer capability and user layer 1 protocol types diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index b72aeb6..c1e50ec 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -239,6 +239,20 @@ typedef struct { uint8_t plan; } ftdm_number_t; +/*! \brief bearer capability */ +typedef enum { + FTDM_BEARER_CAP_SPEECH = 0x00, + FTDM_BEARER_CAP_64K_UNRESTRICTED = 0x02, + FTDM_BEARER_CAP_3_1KHZ_AUDIO = 0x03 +} ftdm_bearer_cap_t; + +/*! \brief user information layer 1 protocol */ +typedef enum { + FTDM_USER_LAYER1_PROT_V110 = 0x01, + FTDM_USER_LAYER1_PROT_ULAW = 0x02, + FTDM_USER_LAYER1_PROT_ALAW = 0x03, +} ftdm_user_layer1_prot_t; + /*! \brief Caller information */ typedef struct ftdm_caller_data { char cid_date[8]; /*!< Caller ID date */ @@ -256,9 +270,9 @@ typedef struct ftdm_caller_data { uint32_t raw_data_len; /* !< Raw data length */ /* these 2 are undocumented right now, only used by boost: */ /* bearer capability */ - uint8_t bearer_capability; + ftdm_bearer_cap_t bearer_capability; /* user information layer 1 protocol */ - uint8_t bearer_layer1; + ftdm_user_layer1_prot_t bearer_layer1; } ftdm_caller_data_t; /*! \brief Tone type */ commit 75145c9db522edcc200129aa44e6858cc15db194 Merge: 7a2c0c3 749dc86 Author: Brian West <brian@freeswitch.org> Date: Wed Sep 1 11:50:07 2010 -0500 Merge branch 'master' of git.freeswitch.org:freeswitch commit 7a2c0c339b9798294a1a9af27fba8bb7f8bf3f52 Author: Brian West <brian@freeswitch.org> Date: Wed Sep 1 11:49:48 2010 -0500 correct this diff --git a/conf/dialplan/default.xml b/conf/dialplan/default.xml index cde80dd..9862eed 100644 --- a/conf/dialplan/default.xml +++ b/conf/dialplan/default.xml @@ -555,7 +555,6 @@ <!-- Demonstration of how to override the ringback in various situations --> <extension name="wait"> <condition field="destination_number" expression="^wait$"> - <action application="set" data="ignore_early_media=true"/> <action application="pre_answer"/> <action application="sleep" data="20000"/> <action application="answer"/> @@ -597,7 +596,7 @@ <extension name="ringback_183_uk_ring"> <condition field="destination_number" expression="^9181$"> <action application="set" data="ringback=$${uk-ring}"/> - <action application="bridge" data="loopback/wait"/> + <action application="bridge" data="{ignore_early_media=true}loopback/wait"/> </condition> </extension> @@ -605,7 +604,7 @@ <extension name="ringback_183_music_ring"> <condition field="destination_number" expression="^9182$"> <action application="set" data="ringback=$${hold_music}"/> - <action application="bridge" data="loopback/wait"/> + <action application="bridge" data="{ignore_early_media=true}loopback/wait"/> </condition> </extension> @@ -614,7 +613,7 @@ <condition field="destination_number" expression="^9183$"> <action application="set" data="transfer_ringback=$${uk-ring}"/> <action application="answer"/> - <action application="bridge" data="loopback/wait"/> + <action application="bridge" data="{ignore_early_media=true}loopback/wait"/> </condition> </extension> @@ -623,7 +622,7 @@ <condition field="destination_number" expression="^9184$"> <action application="set" data="transfer_ringback=$${hold_music}"/> <action application="answer"/> - <action application="bridge" data="loopback/wait"/> + <action application="bridge" data="{ignore_early_media=true}loopback/wait"/> </condition> </extension> commit 749dc86410f738178414e4013cc9737f1ea1d334 Author: Michael Jerris <mike@jerris.com> Date: Wed Sep 1 11:46:32 2010 -0500 don't put blank 'version' attr in dialog-info packets diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 39b495d..d548683 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1317,11 +1317,16 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * } if (is_dialog) { + char *version = switch_event_get_header(helper->event, "event_count"); + if (!version) { + version = "0"; + } + stream.write_function(&stream, "<?xml version=\"1.0\"?>\n" "<dialog-info xmlns=\"urn:ietf:params:xml:ns:dialog-info\" " "version=\"%s\" state=\"%s\" entity=\"%s\">\n", - switch_str_nil(switch_event_get_header(helper->event, "event_count")), + version, !strcasecmp(answer_state, "resubscribe") ? "partial" : "full", clean_id); } commit ce34d86c704e7f4bf95cc2a6a1beebf872c96901 Author: Konrad Hammel <konrad@sangoma.com> Date: Wed Sep 1 12:44:28 2010 -0400 freetdm: ss7 - updated to allow TMR/bearer cap pass-through diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index d1f3a8b..a0bf95b 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -42,7 +42,6 @@ /******************************************************************************/ /* PROTOTYPES *****************************************************************/ -/* PROTOTYPES *****************************************************************/ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCnStEvnt *siCnStEvnt, uint8_t evntType); ftdm_status_t handle_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); @@ -140,42 +139,67 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ } else { - /* fill in cid/ani number */ - if (siConEvnt->cgPtyNum.addrSig.pres) { - copy_tknStr_from_sngss7(siConEvnt->cgPtyNum.addrSig, - ftdmchan->caller_data.cid_num.digits, - siConEvnt->cgPtyNum.oddEven); - - /* fill in cid Name */ - ftdm_set_string(ftdmchan->caller_data.cid_name, ftdmchan->caller_data.cid_num.digits); - - ftdm_set_string(ftdmchan->caller_data.ani.digits, ftdmchan->caller_data.cid_num.digits); - + /* fill in calling party information */ + if (siConEvnt->cgPtyNum.eh.pres) { + if (siConEvnt->cgPtyNum.addrSig.pres) { + /* fill in cid_num */ + copy_tknStr_from_sngss7(siConEvnt->cgPtyNum.addrSig, + ftdmchan->caller_data.cid_num.digits, + siConEvnt->cgPtyNum.oddEven); + + /* fill in cid Name */ + ftdm_set_string(ftdmchan->caller_data.cid_name, ftdmchan->caller_data.cid_num.digits); + + /* fill in ANI */ + ftdm_set_string(ftdmchan->caller_data.ani.digits, ftdmchan->caller_data.cid_num.digits); + } + + if (siConEvnt->cgPtyNum.scrnInd.pres) { + /* fill in the screening indication value */ + ftdmchan->caller_data.screen = siConEvnt->cgPtyNum.scrnInd.val; + } + + if (siConEvnt->cgPtyNum.presRest.pres) { + /* fill in the presentation value */ + ftdmchan->caller_data.pres = siConEvnt->cgPtyNum.presRest.val; + } } else { - SS7_INFO("No Calling party (ANI) information in IAM!\n"); + SS7_INFO_CHAN(ftdmchan,"No Calling party (ANI) information in IAM!%s\n", " "); } - /* fill in dnis */ - if (siConEvnt->cdPtyNum.addrSig.pres) { - copy_tknStr_from_sngss7(siConEvnt->cdPtyNum.addrSig, - ftdmchan->caller_data.dnis.digits, - siConEvnt->cdPtyNum.oddEven); - } else { - SS7_INFO("No Called party (DNIS) information in IAM!\n"); + /* fill in called party infomation */ + if (siConEvnt->cdPtyNum.eh.pres) { + if (siConEvnt->cdPtyNum.addrSig.pres) { + /* fill in the called number/dnis */ + copy_tknStr_from_sngss7(siConEvnt->cdPtyNum.addrSig, + ftdmchan->caller_data.dnis.digits, + siConEvnt->cdPtyNum.oddEven); + } + } else { + SS7_INFO_CHAN(ftdmchan,"No Called party (DNIS) information in IAM!%s\n", " "); } - /* fill in rdnis */ - if (siConEvnt->redirgNum.addrSig.pres) { - copy_tknStr_from_sngss7(siConEvnt->redirgNum.addrSig, - ftdmchan->caller_data.rdnis.digits, - siConEvnt->cgPtyNum.oddEven); + /* fill in rdnis information*/ + if (siConEvnt->redirgNum.eh.pres) { + if (siConEvnt->redirgNum.addrSig.pres) { + /* fill in the rdnis digits */ + copy_tknStr_from_sngss7(siConEvnt->redirgNum.addrSig, + ftdmchan->caller_data.rdnis.digits, + siConEvnt->cgPtyNum.oddEven); + } } else { - SS7_INFO("No RDNIS party information in IAM!\n"); + SS7_DEBUG_CHAN(ftdmchan,"No RDNIS party information in IAM!%s\n", " "); } - /* fill in screening/presentation */ - ftdmchan->caller_data.screen = siConEvnt->cgPtyNum.scrnInd.val; - ftdmchan->caller_data.pres = siConEvnt->cgPtyNum.presRest.val; + /* fill in the TMR/bearer capability */ + if (siConEvnt->txMedReq.eh.pres) { + if (siConEvnt->txMedReq.trMedReq.pres) { + /* fill in the bearer type */ + ftdmchan->caller_data.bearer_capability = siConEvnt->txMedReq.trMedReq.val; + } + } else { + SS7_DEBUG_CHAN(ftdmchan,"No TMR/Bearer Cap information in IAM!%s\n", " "); + } /* set the state of the channel to collecting...the rest is done by the chan monitor */ ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index 53d0f9d..600a529 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -64,70 +64,72 @@ void ft_to_sngss7_grs (ftdm_channel_t * ftdmchan); void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) { - SS7_FUNC_TRACE_ENTER (__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;; - SiConEvnt iam; - - sngss7_info->suInstId = get_unique_id (); - sngss7_info->spInstId = 0; - sngss7_info->spId = 1; - - memset (&iam, 0x0, sizeof (iam)); - - /* copy down the nature of connection indicators */ - iam.natConInd.eh.pres = PRSNT_NODEF; - iam.natConInd.satInd.pres = PRSNT_NODEF; - iam.natConInd.satInd.val = 0; - iam.natConInd.contChkInd.pres = PRSNT_NODEF; - iam.natConInd.contChkInd.val = 0x00; - iam.natConInd.echoCntrlDevInd.pres = PRSNT_NODEF; - iam.natConInd.echoCntrlDevInd.val = 0x01; - - /* copy down the forward call indicators */ - iam.fwdCallInd.eh.pres = PRSNT_NODEF; - iam.fwdCallInd.natIntCallInd.pres = PRSNT_NODEF; - iam.fwdCallInd.natIntCallInd.val = 0x00; - iam.fwdCallInd.end2EndMethInd.pres = PRSNT_NODEF; - iam.fwdCallInd.end2EndMethInd.val = 0x00; - iam.fwdCallInd.intInd.pres = PRSNT_NODEF; - iam.fwdCallInd.intInd.val = 0x01; - iam.fwdCallInd.end2EndInfoInd.pres = PRSNT_NODEF; - iam.fwdCallInd.end2EndInfoInd.val = 0x00; - iam.fwdCallInd.isdnUsrPrtInd.pres = PRSNT_NODEF; - iam.fwdCallInd.isdnUsrPrtInd.val = 0x01; - iam.fwdCallInd.isdnUsrPrtPrfInd.pres = PRSNT_NODEF; - iam.fwdCallInd.isdnUsrPrtPrfInd.val = 0x02; - iam.fwdCallInd.isdnAccInd.pres = PRSNT_NODEF; - iam.fwdCallInd.isdnAccInd.val = 0x01; - iam.fwdCallInd.sccpMethInd.pres = PRSNT_NODEF; - iam.fwdCallInd.sccpMethInd.val = 0x00; - - /* copy down the calling number information */ - iam.cgPtyCat.eh.pres = PRSNT_NODEF; - iam.cgPtyCat.cgPtyCat.pres = PRSNT_NODEF; - iam.cgPtyCat.cgPtyCat.val = 0x0a; - - /* copy down the transmission medium requirements */ - iam.txMedReq.eh.pres = PRSNT_NODEF; - iam.txMedReq.trMedReq.pres = PRSNT_NODEF; - iam.txMedReq.trMedReq.val = 0; /* SPEECH = 0, 3.1Khz = 3, 64k unres = 2 */ - - /* copy down the called number information */ - copy_cdPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cdPtyNum); - - /* copy down the calling number information */ - copy_cgPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cgPtyNum); - - sng_cc_con_request (sngss7_info->spId, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id, &iam, 0); - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx IAM\n"); - - SS7_FUNC_TRACE_EXIT (__FUNCTION__); - return; + SS7_FUNC_TRACE_ENTER (__FUNCTION__); + + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;; + SiConEvnt iam; + + sngss7_info->suInstId = get_unique_id (); + sngss7_info->spInstId = 0; + sngss7_info->spId = 1; + + memset (&iam, 0x0, sizeof (iam)); + + /* copy down the nature of connection indicators */ + iam.natConInd.eh.pres = PRSNT_NODEF; + iam.natConInd.satInd.pres = PRSNT_NODEF; + iam.natConInd.satInd.val = 0; /* no satellite circuit */ + iam.natConInd.contChkInd.pres = PRSNT_NODEF; + iam.natConInd.contChkInd.val = CONTCHK_NOTREQ; + iam.natConInd.echoCntrlDevInd.pres = PRSNT_NODEF; + iam.natConInd.echoCntrlDevInd.val = ECHOCDEV_INCL; + + /* copy down the forward call indicators */ + iam.fwdCallInd.eh.pres = PRSNT_NODEF; + iam.fwdCallInd.natIntCallInd.pres = PRSNT_NODEF; + iam.fwdCallInd.natIntCallInd.val = 0x00; + iam.fwdCallInd.end2EndMethInd.pres = PRSNT_NODEF; + iam.fwdCallInd.end2EndMethInd.val = E2EMTH_NOMETH; + iam.fwdCallInd.intInd.pres = PRSNT_NODEF; + iam.fwdCallInd.intInd.val = INTIND_NOINTW; + iam.fwdCallInd.end2EndInfoInd.pres = PRSNT_NODEF; + iam.fwdCallInd.end2EndInfoInd.val = E2EINF_NOINFO; + iam.fwdCallInd.isdnUsrPrtInd.pres = PRSNT_NODEF; + iam.fwdCallInd.isdnUsrPrtInd.val = ISUP_USED; + iam.fwdCallInd.isdnUsrPrtPrfInd.pres = PRSNT_NODEF; + iam.fwdCallInd.isdnUsrPrtPrfInd.val = PREF_REQAW; + iam.fwdCallInd.isdnAccInd.pres = PRSNT_NODEF; + iam.fwdCallInd.isdnAccInd.val = ISDNACC_ISDN; + iam.fwdCallInd.sccpMethInd.pres = PRSNT_NODEF; + iam.fwdCallInd.sccpMethInd.val = SCCPMTH_NOIND; + + /* copy down the calling number information */ + iam.cgPtyCat.eh.pres = PRSNT_NODEF; + iam.cgPtyCat.cgPtyCat.pres = PRSNT_NODEF; + iam.cgPtyCat.cgPtyCat.val = CAT_ORD; /* ordinary suscriber */ + + /* copy down the transmission medium requirements */ + iam.txMedReq.eh.pres = PRSNT_NODEF; + iam.txMedReq.trMedReq.pres = PRSNT_NODEF; + iam.txMedReq.trMedReq.val = ftdmchan->caller_data.bearer_capability; + + /* copy down the called number information */ + copy_cdPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cdPtyNum); + + /* copy down the calling number information */ + copy_cgPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cgPtyNum); + + sng_cc_con_request (sngss7_info->spId, + sngss7_info->suInstId, + sngss7_info->spInstId, + sngss7_info->circuit->id, + &iam, + 0); + + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx IAM\n"); + + SS7_FUNC_TRACE_EXIT (__FUNCTION__); + return; } /******************************************************************************/ commit f790cbf20c99a36c633ffff8c7f70b0a12ff0db4 Author: Brian West <brian@freeswitch.org> Date: Wed Sep 1 11:05:35 2010 -0500 Ignore Early Media is required here diff --git a/conf/dialplan/default.xml b/conf/dialplan/default.xml index f7a82ea..cde80dd 100644 --- a/conf/dialplan/default.xml +++ b/conf/dialplan/default.xml @@ -555,6 +555,7 @@ <!-- Demonstration of how to override the ringback in various situations --> <extension name="wait"> <condition field="destination_number" expression="^wait$"> + <action application="set" data="ignore_early_media=true"/> <action application="pre_answer"/> <action application="sleep" data="20000"/> <action application="answer"/> commit 4fc415b6e893660cca6354e12417f2924d581dc9 Author: Konrad Hammel <konrad@sangoma.com> Date: Tue Aug 31 17:33:42 2010 -0400 freetdm: implemented Trillium stack message queueing diff --git a/libs/freetdm/Makefile.am b/libs/freetdm/Makefile.am index 6ccc473..33a8b96 100644 --- a/libs/freetdm/Makefile.am +++ b/libs/freetdm/Makefile.am @@ -268,18 +268,19 @@ ftmod_pritap_la_LIBADD = $(MYLIB) endif if SNGSS7 -ftmod_sangoma_ss7_la_SOURCES = $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sts.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c +ftmod_sangoma_ss7_la_SOURCES = $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sts.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c ftmod_sangoma_ss7_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) -D_GNU_SOURCE ftmod_sangoma_ss7_la_LDFLAGS = -module -avoid-version -lsng_ss7 ftmod_sangoma_ss7_la_LIBADD = $(MYLIB) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c similarity index 87% copy from libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c copy to libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index 98554db..d1f3a8b 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -1,16 +1,16 @@ /* - * Copyright (c) 2009, Konrad Hammel <konrad@sangoma.com> + * Copyright (c) 2009 Konrad Hammel <konrad@sangoma.com> * All rights reserved. * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions + * 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. + * 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 + * 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 original author; nor the names of any contributors @@ -19,16 +19,16 @@ * * * 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 + * "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 OWNER - * 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 + * 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 + * 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. + * SOFTWARE|EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* INCLUDE ********************************************************************/ @@ -42,46 +42,40 @@ /******************************************************************************/ /* PROTOTYPES *****************************************************************/ -void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -void sngss7_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); -void sngss7_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); -void sngss7_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCnStEvnt *siCnStEvnt, uint8_t evntType); -void sngss7_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt); -void sngss7_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt); -void sngss7_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiInfoEvnt *siInfoEvnt); -void sngss7_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt); -void sngss7_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt); -void sngss7_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit); - -static ftdm_status_t handle_reattempt(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_resume(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - -static ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_cot_stop(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_cot(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - -static ftdm_status_t handle_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_local_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - -static ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_grs_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - -static ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_blo_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_ubl_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - -static ftdm_status_t handle_local_blk(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - -static ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - +/* PROTOTYPES *****************************************************************/ +ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); +ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCnStEvnt *siCnStEvnt, uint8_t evntType); +ftdm_status_t handle_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); +ftdm_status_t handle_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt); +ftdm_status_t handle_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt); +ftdm_status_t handle_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiInfoEvnt *siInfoEvnt); +ftdm_status_t handle_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt); +ftdm_status_t handle_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt); +ftdm_status_t handle_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit); +ftdm_status_t handle_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); + +ftdm_status_t handle_reattempt(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_resume(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_cot_stop(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_cot(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_local_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_grs_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_blo_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_ubl_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_local_blk(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); /******************************************************************************/ /* FUNCTIONS ******************************************************************/ -void sngss7_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt) +ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -92,7 +86,7 @@ void sngss7_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCo if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_FAIL; } /* now that we have the right channel...put a lock on it so no-one else can use it */ @@ -207,81 +201,11 @@ void sngss7_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCo ftdm_mutex_unlock(ftdmchan->mutex); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - -/******************************************************************************/ -void sngss7_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - - /* check whether the ftdm channel is in a state to accept a call */ - switch (ftdmchan->state) { - /**************************************************************************/ - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx ANM\n"); - - /* go to UP */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_DIALING: - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CON\n"); - - /* go to UP */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); - - break; - /**************************************************************************/ - default: /* incorrect state...reset the CIC */ - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx ANM/CON\n"); - - /* throw the TX reset flag */ - sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX); - - /* go to RESTART */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - - break; - /**************************************************************************/ - } - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_SUCCESS; } /******************************************************************************/ -void sngss7_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCnStEvnt *siCnStEvnt, uint8_t evntType) +ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCnStEvnt *siCnStEvnt, uint8_t evntType) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -292,7 +216,7 @@ void sngss7_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCn if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_FAIL; } /* now that we have the right channel...put a lock on it so no-one else can use it */ @@ -447,11 +371,81 @@ void sngss7_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCn ftdm_mutex_unlock(ftdmchan->mutex); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_SUCCESS; +} + +/******************************************************************************/ +ftdm_status_t handle_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt) +{ + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + + sngss7_chan_data_t *sngss7_info ; + ftdm_channel_t *ftdmchan; + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + SS7_ASSERT; + }; + + + /* check whether the ftdm channel is in a state to accept a call */ + switch (ftdmchan->state) { + /**************************************************************************/ + case FTDM_CHANNEL_STATE_PROGRESS: + case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: + + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx ANM\n"); + + /* go to UP */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); + + break; + /**************************************************************************/ + case FTDM_CHANNEL_STATE_DIALING: + + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CON\n"); + + /* go to UP */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); + + break; + /**************************************************************************/ + default: /* incorrect state...reset the CIC */ + + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx ANM/CON\n"); + + /* throw the TX reset flag */ + sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX); + + /* go to RESTART */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + + break; + /**************************************************************************/ + } + + /* unlock the channel */ + ftdm_mutex_unlock(ftdmchan->mutex); + + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_SUCCESS; } /******************************************************************************/ -void sngss7_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt) +ftdm_status_t handle_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -462,7 +456,7 @@ void sngss7_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRe if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_FAIL; } /* now that we have the right channel...put a lock on it so no-one else can use it */ @@ -540,12 +534,11 @@ void sngss7_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRe ftdm_mutex_unlock(ftdmchan->mutex); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_SUCCESS; } - /******************************************************************************/ -void sngss7_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt) +ftdm_status_t handle_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -556,7 +549,7 @@ void sngss7_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRe if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_FAIL; } /* now that we have the right channel...put a lock on it so no-one else can use it */ @@ -600,11 +593,11 @@ void sngss7_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRe ftdm_mutex_unlock(ftdmchan->mutex); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_SUCCESS; } /******************************************************************************/ -void sngss7_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiInfoEvnt *siInfoEvnt) +ftdm_status_t handle_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiInfoEvnt *siInfoEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -615,7 +608,7 @@ void sngss7_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiIn if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_FAIL; } /* now that we have the right channel...put a lock on it so no-one else can use it */ @@ -635,11 +628,11 @@ void sngss7_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiIn ftdm_mutex_unlock(ftdmchan->mutex); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_SUCCESS; } /******************************************************************************/ -void sngss7_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt) +ftdm_status_t handle_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -650,7 +643,7 @@ void sngss7_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_FAIL; } /* now that we have the right channel...put a lock on it so no-one else can use it */ @@ -670,11 +663,11 @@ void sngss7_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint ftdm_mutex_unlock(ftdmchan->mutex); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_SUCCESS; } /******************************************************************************/ -void sngss7_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt) +ftdm_status_t handle_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -685,7 +678,7 @@ void sngss7_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_FAIL; } /* now that we have the right channel...put a lock on it so no-one else can use it */ @@ -705,11 +698,11 @@ void sngss7_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint ftdm_mutex_unlock(ftdmchan->mutex); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_SUCCESS; } /******************************************************************************/ -void sngss7_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit) +ftdm_status_t handle_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -720,7 +713,7 @@ void sngss7_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit) if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_FAIL; } /* now that we have the right channel...put a lock on it so no-one else can use it */ @@ -740,11 +733,11 @@ void sngss7_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit) ftdm_mutex_unlock(ftdmchan->mutex); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_SUCCESS; } -/* GENERAL STATUS *************************************************************/ -void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +/******************************************************************************/ +ftdm_status_t handle_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { sngss7_chan_data_t *sngss7_info ; ftdm_channel_t *ftdmchan; @@ -753,7 +746,7 @@ void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_FAIL; } SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -981,11 +974,12 @@ void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint } /* switch (evntType) */ SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + return FTDM_SUCCESS; + } /******************************************************************************/ -static ftdm_status_t handle_reattempt(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_reattempt(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1023,7 +1017,7 @@ static ftdm_status_t handle_reattempt(uint32_t suInstId, uint32_t spInstId, uint } /******************************************************************************/ -static ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1085,7 +1079,7 @@ static ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t } /******************************************************************************/ -static ftdm_status_t handle_resume(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_resume(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1150,7 +1144,7 @@ static ftdm_status_t handle_resume(uint32_t suInstId, uint32_t spInstId, uint32_ } /******************************************************************************/ -static ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1208,7 +1202,7 @@ static ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint } /******************************************************************************/ -static ftdm_status_t handle_cot_stop(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_cot_stop(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1247,7 +1241,7 @@ static ftdm_status_t handle_cot_stop(uint32_t suInstId, uint32_t spInstId, uint3 } /******************************************************************************/ -static ftdm_status_t handle_cot(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_cot(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1269,7 +1263,7 @@ static ftdm_status_t handle_cot(uint32_t suInstId, uint32_t spInstId, uint32_t c /******************************************************************************/ -static ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1313,7 +1307,7 @@ static ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32 } /******************************************************************************/ -static ftdm_status_t handle_blo_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_blo_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1348,7 +1342,7 @@ static ftdm_status_t handle_blo_rsp(uint32_t suInstId, uint32_t spInstId, uint32 } /******************************************************************************/ -static ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1395,7 +1389,7 @@ static ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32 } /******************************************************************************/ -static ftdm_status_t handle_ubl_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_ubl_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1430,7 +1424,7 @@ static ftdm_status_t handle_ubl_rsp(uint32_t suInstId, uint32_t spInstId, uint32 } /******************************************************************************/ -static ftdm_status_t handle_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1483,7 +1477,7 @@ static ftdm_status_t handle_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32 } /******************************************************************************/ -static ftdm_status_t handle_local_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_local_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1536,7 +1530,7 @@ static ftdm_status_t handle_local_rsc_req(uint32_t suInstId, uint32_t spInstId, } /******************************************************************************/ -static ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1618,7 +1612,7 @@ static ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32 return FTDM_SUCCESS; } /******************************************************************************/ -static ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1700,7 +1694,7 @@ static ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32 } /******************************************************************************/ -static ftdm_status_t handle_grs_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_grs_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1795,7 +1789,7 @@ static ftdm_status_t handle_grs_rsp(uint32_t suInstId, uint32_t spInstId, uint32 } /******************************************************************************/ -static ftdm_status_t handle_local_blk(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_local_blk(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1839,7 +1833,7 @@ static ftdm_status_t handle_local_blk(uint32_t suInstId, uint32_t spInstId, uint } /******************************************************************************/ -static ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1883,7 +1877,7 @@ static ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint } /******************************************************************************/ -static ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); @@ -1923,45 +1917,6 @@ static ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t /******************************************************************************/ -#if 0 -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - }; - - /* fill in here */ - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -#endif -/******************************************************************************/ - -/******************************************************************************/ /* For Emacs: * Local Variables: * mode:c @@ -1973,4 +1928,3 @@ static ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t * vim:set softtabstop=4 shiftwidth=4 tabstop=4: */ /******************************************************************************/ - diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c index 98554db..34893cf 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c @@ -53,31 +53,6 @@ void sngss7_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint void sngss7_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt); void sngss7_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit); -static ftdm_status_t handle_reattempt(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_resume(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - -static ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_cot_stop(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_cot(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - -static ftdm_status_t handle_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_local_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - -static ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_grs_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - -static ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_blo_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_ubl_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - -static ftdm_status_t handle_local_blk(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - -static ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - /******************************************************************************/ /* FUNCTIONS ******************************************************************/ @@ -85,8 +60,9 @@ void sngss7_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCo { SS7_FUNC_TRACE_ENTER(__FUNCTION__); - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + sngss7_event_data_t *sngss7_event = NULL; /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { @@ -95,119 +71,26 @@ void sngss7_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCo return; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); + /* initalize the sngss7_event */ + sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); + if (sngss7_event == NULL) { + SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx IAM\n"); - - /* check if the circuit has a remote block */ - if ((sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) || - (sngss7_test_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX)) || - (sngss7_test_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX))) { - - /* as per Q.764, 2.8.2.3 xiv ... remove the block from this channel */ - sngss7_clear_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX); - sngss7_clear_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX); - sngss7_clear_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX); - - /* KONRAD FIX ME : check in case there is a ckt and grp block */ + return; } + memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - /* check whether the ftdm channel is in a state to accept a call */ - switch (ftdmchan->state) { - /**************************************************************************/ - case (FTDM_CHANNEL_STATE_DOWN): /* only state it is fully valid to get IAM */ - - /* fill in the channels SS7 Stack information */ - sngss7_info->suInstId = get_unique_id(); - sngss7_info->spInstId = spInstId; - - /* try to open the ftdm channel */ - if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { - SS7_ERROR("Failed to open span: %d, chan: %d\n", - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id); - - /* set the flag to indicate this hangup is started from the local side */ - sngss7_set_flag(sngss7_info, FLAG_LOCAL_REL); - - ftdmchan->caller_data.hangup_cause = 41; - - /* move the state to CANCEL */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); - - } else { - - /* fill in cid/ani number */ - if (siConEvnt->cgPtyNum.addrSig.pres) { - copy_tknStr_from_sngss7(siConEvnt->cgPtyNum.addrSig, - ftdmchan->caller_data.cid_num.digits, - siConEvnt->cgPtyNum.oddEven); - - /* fill in cid Name */ - ftdm_set_string(ftdmchan->caller_data.cid_name, ftdmchan->caller_data.cid_num.digits); - - ftdm_set_string(ftdmchan->caller_data.ani.digits, ftdmchan->caller_data.cid_num.digits); - - } else { - SS7_INFO("No Calling party (ANI) information in IAM!\n"); - } - - /* fill in dnis */ - if (siConEvnt->cdPtyNum.addrSig.pres) { - copy_tknStr_from_sngss7(siConEvnt->cdPtyNum.addrSig, - ftdmchan->caller_data.dnis.digits, - siConEvnt->cdPtyNum.oddEven); - } else { - SS7_INFO("No Called party (DNIS) information in IAM!\n"); - } - - /* fill in rdnis */ - if (siConEvnt->redirgNum.addrSig.pres) { - copy_tknStr_from_sngss7(siConEvnt->redirgNum.addrSig, - ftdmchan->caller_data.rdnis.digits, - siConEvnt->cgPtyNum.oddEven); - } else { - SS7_INFO("No RDNIS party information in IAM!\n"); - } - - /* fill in screening/presentation */ - ftdmchan->caller_data.screen = siConEvnt->cgPtyNum.scrnInd.val; - ftdmchan->caller_data.pres = siConEvnt->cgPtyNum.presRest.val; - - /* set the state of the channel to collecting...the rest is done by the chan monitor */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); - - } /* if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) */ + /* fill in the sngss7_event struct */ + sngss7_event->spInstId = spInstId; + sngss7_event->suInstId = suInstId; + sngss7_event->circuit = circuit; + sngss7_event->event_id = SNGSS7_CON_IND_EVENT; + memcpy(&sngss7_event->event.siConEvnt, siConEvnt, sizeof(*siConEvnt)); - break; - /**************************************************************************/ - default: /* should not have gotten an IAM while in this state */ - SS7_ERROR("Got IAM in an invalid state (%s) on span=%d, chan=%d!\n", - ftdm_channel_state2str(ftdmchan->state), - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id); - - /* move the state of the channel to RESTART to force a reset */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - - break; - /**************************************************************************/ - } /* switch (ftdmchan->state) */ - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* enqueue this event */ + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; } /******************************************************************************/ @@ -215,8 +98,9 @@ void sngss7_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCo { SS7_FUNC_TRACE_ENTER(__FUNCTION__); - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + sngss7_event_data_t *sngss7_event = NULL; /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { @@ -225,59 +109,26 @@ void sngss7_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCo return; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); + /* initalize the sngss7_event */ + sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); + if (sngss7_event == NULL) { + SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - - /* check whether the ftdm channel is in a state to accept a call */ - switch (ftdmchan->state) { - /**************************************************************************/ - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx ANM\n"); - - /* go to UP */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_DIALING: - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CON\n"); - - /* go to UP */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); - - break; - /**************************************************************************/ - default: /* incorrect state...reset the CIC */ - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx ANM/CON\n"); - - /* throw the TX reset flag */ - sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX); - - /* go to RESTART */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - - break; - /**************************************************************************/ + return; } + memset(sngss7_event, 0x0, sizeof(*sngss7_event)); + + /* fill in the sngss7_event struct */ + sngss7_event->spInstId = spInstId; + sngss7_event->suInstId = suInstId; + sngss7_event->circuit = circuit; + sngss7_event->event_id = SNGSS7_CON_CFM_EVENT; + memcpy(&sngss7_event->event.siConEvnt, siConEvnt, sizeof(*siConEvnt)); - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* enqueue this event */ + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; } /******************************************************************************/ @@ -285,8 +136,9 @@ void sngss7_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCn { SS7_FUNC_TRACE_ENTER(__FUNCTION__); - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + sngss7_event_data_t *sngss7_event = NULL; /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { @@ -295,159 +147,27 @@ void sngss7_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCn return; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); + /* initalize the sngss7_event */ + sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); + if (sngss7_event == NULL) { + SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; + return; } + memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - switch (evntType) { - /**************************************************************************/ - case (ADDRCMPLT): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx ACM\n"); - switch (ftdmchan->state) { - /**********************************************************************/ - case FTDM_CHANNEL_STATE_DIALING: - /* KONRAD: should we confirm the instance ids ? */ - - /* need to grab the sp instance id */ - sngss7_info->spInstId = spInstId; - - /* go to PROGRESS */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); - break; - /**********************************************************************/ - default: /* incorrect state...reset the CIC */ - /* go to RESTART */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); - break; - /**********************************************************************/ - } /* switch (ftdmchan->state) */ - /**************************************************************************/ - case (MODIFY): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx MODIFY\n"); - break; - /**************************************************************************/ - case (MODCMPLT): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx MODIFY-COMPLETE\n"); - break; - /**************************************************************************/ - case (MODREJ): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx MODIFY-REJECT\n"); - break; - /**************************************************************************/ - case (PROGRESS): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CPG\n"); - break; - /**************************************************************************/ - case (FRWDTRSFR): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx FOT\n"); - break; - /**************************************************************************/ - case (INFORMATION): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx INF\n"); - break; - /**************************************************************************/ - case (INFORMATREQ): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx INR\n"); - break; - /**************************************************************************/ - case (SUBSADDR): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx SAM\n"); - break; - /**************************************************************************/ - case (EXIT): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx EXIT\n"); - break; - /**************************************************************************/ - case (NETRESMGT): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx NRM\n"); - break; - /**************************************************************************/ - case (IDENTREQ): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx IDR\n"); - break; - /**************************************************************************/ - case (IDENTRSP): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx IRS\n"); - break; - /**************************************************************************/ - case (MALCLLPRNT): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx MALICIOUS CALL\n"); - break; - /**************************************************************************/ - case (CHARGE): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CRG\n"); - break; - /**************************************************************************/ - case (TRFFCHGE): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CRG-TARIFF\n"); - break; - /**************************************************************************/ - case (CHARGEACK): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CRG-ACK\n"); - break; - /**************************************************************************/ - case (CALLOFFMSG): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CALL-OFFER\n"); - break; - /**************************************************************************/ - case (LOOPPRVNT): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx LOP\n"); - break; - /**************************************************************************/ - case (TECT_TIMEOUT): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx ECT-Timeout\n"); - break; - /**************************************************************************/ - case (RINGSEND): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx RINGING-SEND\n"); - break; - /**************************************************************************/ - case (CALLCLEAR): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CALL-LINE Clear\n"); - break; - /**************************************************************************/ - case (PRERELEASE): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx PRI\n"); - break; - /**************************************************************************/ - case (APPTRANSPORT): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx APM\n"); - break; - /**************************************************************************/ - case (OPERATOR): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx OPERATOR\n"); - break; - /**************************************************************************/ - case (METPULSE): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx METERING-PULSE\n"); - break; - /**************************************************************************/ - case (CLGPTCLR): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CALLING_PARTY_CLEAR\n"); - break; - /**************************************************************************/ - case (SUBDIRNUM): - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx SUB-DIR\n"); - break; - /**************************************************************************/ - default: - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Unknown Msg\n"); - break; - /**************************************************************************/ - } + /* fill in the sngss7_event struct */ + sngss7_event->spInstId = spInstId; + sngss7_event->suInstId = suInstId; + sngss7_event->circuit = circuit; + sngss7_event->evntType = evntType; + sngss7_event->event_id = SNGSS7_CON_STA_EVENT; + memcpy(&sngss7_event->event.siCnStEvnt, siCnStEvnt, sizeof(*siCnStEvnt)); - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* enqueue this event */ + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; } /******************************************************************************/ @@ -455,8 +175,9 @@ void sngss7_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRe { SS7_FUNC_TRACE_ENTER(__FUNCTION__); - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + sngss7_event_data_t *sngss7_event = NULL; /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { @@ -465,186 +186,36 @@ void sngss7_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRe return; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx REL\n"); - - /* check whether the ftdm channel is in a state to release a call */ - switch (ftdmchan->state) { - /**************************************************************************/ - case FTDM_CHANNEL_STATE_DIALING: - - /* pass the release code up to FTDM */ - if (siRelEvnt->causeDgn.causeVal.pres) { - ftdmchan->caller_data.hangup_cause = siRelEvnt->causeDgn.causeVal.val; - } else { - SS7_ERROR("REL does not have a cause code!\n"); - ftdmchan->caller_data.hangup_cause = 0; - } - - /* this is a remote hangup request */ - sngss7_set_flag(sngss7_info, FLAG_REMOTE_REL); - - /* move the state of the channel to CANCEL to end the call */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_RING: - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - case FTDM_CHANNEL_STATE_UP: - - /* pass the release code up to FTDM */ - if (siRelEvnt->causeDgn.causeVal.pres) { - ftdmchan->caller_data.hangup_cause = siRelEvnt->causeDgn.causeVal.val; - } else { - SS7_ERROR("REL does not have a cause code!\n"); - ftdmchan->caller_data.hangup_cause = 0; - } - - /* this is a remote hangup request */ - sngss7_set_flag(sngss7_info, FLAG_REMOTE_REL); - - /* move the state of the channel to TERMINATING to end the call */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - - break; - /**************************************************************************/ - default: - - /* fill in the channels SS7 Stack information */ - sngss7_info->suInstId = get_unique_id(); - sngss7_info->spInstId = spInstId; - - /* throw the reset flag */ - sngss7_set_flag(sngss7_info, FLAG_RESET_RX); - - /* set the state to RESTART */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - break; - /**************************************************************************/ - } /* switch (ftdmchan->state) */ - - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - - -/******************************************************************************/ -void sngss7_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + /* initalize the sngss7_event */ + sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); + if (sngss7_event == NULL) { + SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); SS7_FUNC_TRACE_EXIT(__FUNCTION__); return; } + memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx RLC\n"); - - /* check whether the ftdm channel is in a state to accept a call */ - switch (ftdmchan->state) { - /**************************************************************************/ - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - - /* go to DOWN */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + /* fill in the sngss7_event struct */ + sngss7_event->spInstId = spInstId; + sngss7_event->suInstId = suInstId; + sngss7_event->circuit = circuit; + sngss7_event->event_id = SNGSS7_REL_IND_EVENT; + memcpy(&sngss7_event->event.siRelEvnt, siRelEvnt, sizeof(*siRelEvnt)); - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_DOWN: - /* do nothing, just drop the message */ - break; - /**************************************************************************/ - default: - /* KONRAD: should just stop the call...but a reset is easier for now (since it does hangup the call) */ - - /* go to RESTART */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - - break; - /**************************************************************************/ - } - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* enqueue this event */ + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; } /******************************************************************************/ -void sngss7_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiInfoEvnt *siInfoEvnt) +void sngss7_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx DATA IND\n"); - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - -/******************************************************************************/ -void sngss7_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + sngss7_event_data_t *sngss7_event = NULL; /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { @@ -653,101 +224,36 @@ void sngss7_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint return; } - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx FAC\n"); - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - -/******************************************************************************/ -void sngss7_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + /* initalize the sngss7_event */ + sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); + if (sngss7_event == NULL) { + SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); SS7_FUNC_TRACE_EXIT(__FUNCTION__); return; } + memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx FAC-CON\n"); + /* fill in the sngss7_event struct */ + sngss7_event->spInstId = spInstId; + sngss7_event->suInstId = suInstId; + sngss7_event->circuit = circuit; + sngss7_event->event_id = SNGSS7_REL_CFM_EVENT; + memcpy(&sngss7_event->event.siRelEvnt, siRelEvnt, sizeof(*siRelEvnt)); - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* enqueue this event */ + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; } /******************************************************************************/ -void sngss7_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit) +void sngss7_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiInfoEvnt *siInfoEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx USER-USER msg\n"); - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - -/* GENERAL STATUS *************************************************************/ -void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + sngss7_event_data_t *sngss7_event = NULL; /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { @@ -756,1210 +262,186 @@ void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint return; } - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - switch (evntType) { - /**************************************************************************/ - case SIT_STA_REATTEMPT: /* reattempt indication */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Reattempt indication\n"); - handle_reattempt(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_ERRORIND: /* error indication */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Error indication\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CONTCHK: /* continuity check */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx COT start\n"); - handle_cot_start(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CONTREP: /* continuity report */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx COT report\n"); - handle_cot(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_STPCONTIN: /* stop continuity */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx COT stop\n"); - handle_cot_stop(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CGQRYRSP: /* circuit grp query response from far end forwarded to upper layer by ISUP */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CQM\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CONFUSION: /* confusion */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CFN\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_LOOPBACKACK: /* loop-back acknowledge */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx LPA\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CIRRSRVREQ: /* circuit reservation request */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Ckt Resveration req\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CIRRSRVACK: /* circuit reservation acknowledgement */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Ckt Res ack\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CIRBLOREQ: /* circuit blocking request */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx BLO\n"); - handle_blo_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRBLORSP: /* circuit blocking response */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx BLA\n"); - handle_blo_rsp(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRUBLREQ: /* circuit unblocking request */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx UBL\n"); - handle_ubl_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRUBLRSP: /* circuit unblocking response */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx UBA\n"); - handle_ubl_rsp(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRRESREQ: /* circuit reset request - RSC */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx RSC\n"); - handle_rsc_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRLOCRES: /* reset initiated locally by the software */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Local RSC\n"); - handle_local_rsc_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRRESRSP: /* circuit reset response */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx RSC-RLC\n"); - handle_rsc_rsp(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CGBREQ: /* CGB request */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CGB\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CGUREQ: /* CGU request */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CGU\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CGQRYREQ: /* circuit group query request */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CQM\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CGBRSP: /* mntc. oriented CGB response */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx mntc CGB\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CGURSP: /* mntc. oriented CGU response */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx mntc CGU\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_GRSREQ: /* circuit group reset request */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx GRS\n"); - handle_grs_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRUNEQPD: /* circuit unequipped indication */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx UCIC\n"); - handle_ucic(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_GRSRSP: /* circuit group reset response */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx GRA\n"); - handle_grs_rsp(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_PAUSEIND: /* pause indication */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx SUS\n"); - handle_pause(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_RESUMEIND: /* resume indication */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx RES\n"); - handle_resume(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_USRPARTA: /* user part available */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx UPA\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_RMTUSRUNAV: /* remote user not available */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Remote User not Available\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_MTPCONG0: /* congestion indication level 0 */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Congestion L0\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_MTPCONG1: /* congestion indication level 1 */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Congestion L1\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_MTPCONG2: /* congestion indication level 2 */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Congestion L2\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_MTPCONG3: /* congestion indication level 3 */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Congestion L3\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_MTPSTPCONG: /* stop congestion indication level 0 */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Stop Congestion\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CIRLOCALBLOIND: /* Mngmt local blocking */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Local BLO\n"); - handle_local_blk(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRLOCALUBLIND: /* Mngmt local unblocking */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Local UBL\n"); - handle_local_ubl(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_OVERLOAD: /* Overload */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Overload\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_LMCGBREQ: /* when LM requests ckt grp blocking */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx LM CGB\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_LMCGUREQ: /* when LM requests ckt grp unblocking */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx LM CGU\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_LMGRSREQ: /* when LM requests ckt grp reset */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx LM RSC\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CGBINFOIND: /* circuit grp blking ind , no resp req */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CGB no resp req\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_LMCQMINFOREQ: /* when LM requests ckt grp query */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx LM CQM\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CIRLOCGRS: /* group reset initiated locally by the software */ - SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Local GRS\n"); - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - default: - SS7_INFO("[SNG-CC] Received Unknown indication %d\n", evntType); - break; - } /* switch (evntType) */ - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - -/******************************************************************************/ -static ftdm_status_t handle_reattempt(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - /* glare, throw the flag, go to down state*/ - sngss7_set_flag(sngss7_info, FLAG_GLARE); - - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - int infId; - int i; - - /* extract the affect infId from the circuit structure */ - infId = g_ftdm_sngss7_data.cfg.isupCkt[circuit].infId; - - /* go through all the circuits now and find any other circuits on this infId */ - i = 1; - while (g_ftdm_sngss7_data.cfg.isupCkt[i].id != 0) { - - /* check that the infId matches and that this is not a siglink */ - if ((g_ftdm_sngss7_data.cfg.isupCkt[i].infId == infId) && - (g_ftdm_sngss7_data.cfg.isupCkt[i].type == VOICE)) { - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - i++; - continue; - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - i++; - SS7_ASSERT; - }; - - /* check if the circuit is fully started */ - if (ftdm_test_flag(ftdmchan->span, FTDM_SPAN_IN_THREAD)) { - /* set the pause flag on the channel */ - sngss7_set_flag(sngss7_info, FLAG_INFID_PAUSED); - - /* set the statet o SUSPENDED to bring the sig status down */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - } - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - } /* if (g_ftdm_sngss7_data.cfg.isupCkt[i].infId == infId) */ - - /* move to the next circuit */ - i++; - - } /* while (g_ftdm_sngss7_data.cfg.isupCkt[i].id != 0) */ - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_resume(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - int infId; - int i; - - /* extract the affect infId from the circuit structure */ - infId = g_ftdm_sngss7_data.cfg.isupCkt[circuit].infId; - - /* go through all the circuits now and find any other circuits on this infId */ - i = 1; - while (g_ftdm_sngss7_data.cfg.isupCkt[i].id != 0) { - - /* check that the infId matches and that this is not a siglink */ - if ((g_ftdm_sngss7_data.cfg.isupCkt[i].infId == infId) && - (g_ftdm_sngss7_data.cfg.isupCkt[i].type == VOICE)) { - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - i++; - continue; - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - i++; - SS7_ASSERT; - }; - - /* only resume if we are paused */ - if (sngss7_test_flag(sngss7_info, FLAG_INFID_PAUSED)) { - /* set the resume flag on the channel */ - sngss7_set_flag(sngss7_info, FLAG_INFID_RESUME); - - /* clear the paused flag */ - sngss7_clear_flag(sngss7_info, FLAG_INFID_PAUSED); - - /* set the statet to SUSPENDED to bring the sig status up */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - } - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - } /* if (g_ftdm_sngss7_data.cfg.isupCkt[i].infId == infId) */ - - /* move to the next circuit */ - i++; - - } /* while (g_ftdm_sngss7_data.cfg.isupCkt[i].id != 0) */ - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - /* open the channel if it is not open */ - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) { - if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { - SS7_ERROR("Failed to open CIC %d for COT test!\n", sngss7_info->circuit->cic); - /* KONRAD FIX ME */ - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } - } - - /* tell the core to loop the channel */ - ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_LOOP, NULL); - - /* switch to the IN_LOOP state */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IN_LOOP); - - /* store the sngss7 ids */ - if (suInstId == 0) { - sngss7_info->suInstId = get_unique_id(); - } else { - sngss7_info->suInstId = suInstId; - } - sngss7_info->spInstId = spInstId; - sngss7_info->globalFlg = globalFlg; - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_cot_stop(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - /* tell the core to stop looping the channel */ - ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL); - - /* exit out of the LOOP state to the last state */ - ftdm_set_state_locked(ftdmchan, ftdmchan->last_state); - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_cot(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - if ( (siStaEvnt->contInd.eh.pres > 0) && (siStaEvnt->contInd.contInd.pres > 0)) { - SS7_INFO("Continuity Test result for CIC = %d (span %d, chan %d) is: \"%s\"\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - g_ftdm_sngss7_data.cfg.isupCkt[circuit].span, - g_ftdm_sngss7_data.cfg.isupCkt[circuit].chan, - (siStaEvnt->contInd.contInd.val) ? "PASS" : "FAIL"); - } else { - SS7_ERROR("Recieved Continuity report containing no results!\n"); - } - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ - - -/******************************************************************************/ -static ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - /* check if the circuit is already blocked or not */ - if (sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) { - SS7_WARN("Received BLO on circuit that is already blocked!\n"); - } - - /* throw the ckt block flag */ - sngss7_set_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX); - - /* set the channel to suspended state */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_blo_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + /* initalize the sngss7_event */ + sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); + if (sngss7_event == NULL) { + SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; + return; } + memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - /* KONRAD FIX ME */ + /* fill in the sngss7_event struct */ + sngss7_event->spInstId = spInstId; + sngss7_event->suInstId = suInstId; + sngss7_event->circuit = circuit; + sngss7_event->event_id = SNGSS7_DAT_IND_EVENT; + memcpy(&sngss7_event->event.siInfoEvnt, siInfoEvnt, sizeof(*siInfoEvnt)); - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* enqueue this event */ + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; } /******************************************************************************/ -static ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +void sngss7_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + sngss7_event_data_t *sngss7_event = NULL; /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - /* check if the channel is blocked */ - if (!(sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX))) { - SS7_WARN("Received UBL on circuit that is not blocked!\n"); + return; } - /* throw the unblock flag */ - sngss7_set_flag(sngss7_info, FLAG_CKT_MN_UNBLK_RX); - - /* clear the block flag */ - sngss7_clear_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX); - - /* set the channel to suspended state */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_ubl_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + /* initalize the sngss7_event */ + sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); + if (sngss7_event == NULL) { + SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; + return; } + memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); + /* fill in the sngss7_event struct */ + sngss7_event->spInstId = spInstId; + sngss7_event->suInstId = suInstId; + sngss7_event->circuit = circuit; + sngss7_event->evntType = evntType; + sngss7_event->event_id = SNGSS7_FAC_IND_EVENT; + memcpy(&sngss7_event->event.siFacEvnt, siFacEvnt, sizeof(*siFacEvnt)); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - /* KONRAD FIX ME */ - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* enqueue this event */ + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; } /******************************************************************************/ -static ftdm_status_t handle_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +void sngss7_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + sngss7_event_data_t *sngss7_event = NULL; /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - /* throw the reset flag */ - sngss7_set_flag(sngss7_info, FLAG_RESET_RX); - - switch (ftdmchan->state) { - /**************************************************************************/ - case FTDM_CHANNEL_STATE_RESTART: - - /* go to idle so that we can redo the restart state*/ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE); - - break; - /**************************************************************************/ - default: - - /* set the state of the channel to restart...the rest is done by the chan monitor */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - break; - /**************************************************************************/ + return; } - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_local_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + /* initalize the sngss7_event */ + sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); + if (sngss7_event == NULL) { + SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; + return; } + memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - /* throw the reset flag */ - sngss7_set_flag(sngss7_info, FLAG_RESET_RX); - - switch (ftdmchan->state) { - /**************************************************************************/ - case FTDM_CHANNEL_STATE_RESTART: - - /* go to idle so that we can redo the restart state*/ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE); + /* fill in the sngss7_event struct */ + sngss7_event->spInstId = spInstId; + sngss7_event->suInstId = suInstId; + sngss7_event->circuit = circuit; + sngss7_event->evntType = evntType; + sngss7_event->event_id = SNGSS7_FAC_CFM_EVENT; + memcpy(&sngss7_event->event.siFacEvnt, siFacEvnt, sizeof(*siFacEvnt)); - break; - /**************************************************************************/ - default: - - /* set the state of the channel to restart...the rest is done by the chan monitor */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - break; - /**************************************************************************/ - } - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* enqueue this event */ + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; } /******************************************************************************/ -static ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +void sngss7_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + sngss7_event_data_t *sngss7_event = NULL; /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - switch (ftdmchan->state) { - /**********************************************************************/ - case FTDM_CHANNEL_STATE_RESTART: - - if ( sngss7_test_flag(sngss7_info, FLAG_RESET_TX) ) { - /* throw the FLAG_RESET_TX_RSP to indicate we have acknowledgement from the remote side */ - sngss7_set_flag(sngss7_info, FLAG_RESET_TX_RSP); - - /* go to DOWN */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } else { - SS7_ERROR("Received RSC-RLC but we're not waiting on a RSC-RLC on CIC #, dropping\n", sngss7_info->circuit->cic); - } - - break; - /**********************************************************************/ - case FTDM_CHANNEL_STATE_DOWN: - - /* do nothing, just drop the message */ - SS7_DEBUG("Receveived RSC-RLC in down state, dropping\n"); - - break; - /**********************************************************************/ - case FTDM_CHANNEL_STATE_TERMINATING: - case FTDM_CHANNEL_STATE_HANGUP: - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - - /* throw the FLAG_RESET_TX_RSP to indicate we have acknowledgement from the remote side */ - sngss7_set_flag(sngss7_info, FLAG_RESET_TX_RSP); - - /* go to DOWN */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - - break; - /**********************************************************************/ - default: - /* ITU Q764-2.9.5.1.c -> release the circuit */ - if ((siStaEvnt != NULL) && - (siStaEvnt->causeDgn.eh.pres ==PRSNT_NODEF) && - (siStaEvnt->causeDgn.causeVal.pres == PRSNT_NODEF)) { - ftdmchan->caller_data.hangup_cause = siStaEvnt->causeDgn.causeVal.val; - } else { - ftdmchan->caller_data.hangup_cause = 98; /* Message not compatiable with call state */ - } - - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - break; - /**********************************************************************/ - } - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} -/******************************************************************************/ -static ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - sngss7_span_data_t *span = NULL; - int range; - int x; - - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; + return; } - /* extract the range value from the event structure */ - if ((siStaEvnt->rangStat.eh.pres == PRSNT_NODEF) && (siStaEvnt->rangStat.range.pres == PRSNT_NODEF)) { - range = siStaEvnt->rangStat.range.val; - } else { - SS7_ERROR("Received GRS with no range value on CIC = %d\n", sngss7_info->circuit->cic); + /* initalize the sngss7_event */ + sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); + if (sngss7_event == NULL) { + SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } - - /* loop over the cics starting from circuit until range+1 */ - for (x = circuit; x < (circuit + range + 1); x++) { - /* grab the circuit in question */ - if (extract_chan_data(x, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", x); - break; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_ASSERT; - }; - - /* fill in the span structure for this circuit */ - span = ftdmchan->span->mod_data; - span->grs.circuit = circuit; - span->grs.range = range; - - SS7_DEBUG_CHAN(ftdmchan, "Rx GRS (%d:%d)\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - (g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic + range)); - - /* flag the channel as having received a reset */ - sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_RX); - - switch (ftdmchan->state) { - /**************************************************************************/ - case FTDM_CHANNEL_STATE_RESTART: - - /* go to idle so that we can redo the restart state*/ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE); - - break; - /**************************************************************************/ - default: - - /* set the state of the channel to restart...the rest is done by the chan monitor */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - break; - /**************************************************************************/ - } - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - + return; } + memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_grs_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); + /* fill in the sngss7_event struct */ + sngss7_event->spInstId = spInstId; + sngss7_event->suInstId = suInstId; + sngss7_event->circuit = circuit; + sngss7_event->event_id = SNGSS7_UMSG_IND_EVENT; - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - int range; - int x; - - /* extract the range value from the event structure */ - if ((siStaEvnt->rangStat.eh.pres == PRSNT_NODEF) && (siStaEvnt->rangStat.range.pres == PRSNT_NODEF)) { - range = siStaEvnt->rangStat.range.val; - } else { - SS7_ERROR("Received GRA with no range value on CIC = %d\n", sngss7_info->circuit->cic); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } + /* enqueue this event */ + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); - /* go through all the circuits in the range */ - for ( x = circuit; x < (circuit + range + 1); x++) { - - /* grab the circuit in question */ - if (extract_chan_data(x, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - break; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_ASSERT; - }; - - SS7_DEBUG_CHAN(ftdmchan, "Rx GRA (%d:%d)\n", - g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, - (g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic + range)); - - switch (ftdmchan->state) { - /**********************************************************************/ - case FTDM_CHANNEL_STATE_RESTART: - - /* throw the FLAG_RESET_TX_RSP to indicate we have acknowledgement from the remote side */ - sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP); - - /* go to DOWN */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - - break; - /**********************************************************************/ - case FTDM_CHANNEL_STATE_DOWN: - - /* do nothing, just drop the message */ - SS7_DEBUG("Receveived GRA in down state, dropping\n"); - - break; - /**********************************************************************/ - case FTDM_CHANNEL_STATE_TERMINATING: - case FTDM_CHANNEL_STATE_HANGUP: - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - - /* throw the FLAG_RESET_TX_RSP to indicate we have acknowledgement from the remote side */ - sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP); - - break; - /**********************************************************************/ - default: - /* ITU Q764-2.9.5.1.c -> release the circuit */ - if ((siStaEvnt != NULL) && - (siStaEvnt->causeDgn.eh.pres ==PRSNT_NODEF) && - (siStaEvnt->causeDgn.causeVal.pres == PRSNT_NODEF)) { - ftdmchan->caller_data.hangup_cause = siStaEvnt->causeDgn.causeVal.val; - } else { - ftdmchan->caller_data.hangup_cause = 98; /* Message not compatiable with call state */ - } - - /* go to terminating to hang up the call */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - break; - /**********************************************************************/ - } - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - } /* for (( x = 0; x < (circuit + range); x++) */ - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_local_blk(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - /* check if the circuit is already blocked or not */ - if (sngss7_test_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX)) { - SS7_WARN("Received local BLO on circuit that is already blocked!\n"); - } - - /* throw the ckt block flag */ - sngss7_set_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX); - /* set the channel to suspended state */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; } - -/******************************************************************************/ -static ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +/* GENERAL STATUS *************************************************************/ +void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { SS7_FUNC_TRACE_ENTER(__FUNCTION__); - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + sngss7_event_data_t *sngss7_event = NULL; /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - /* check if the circuit is already blocked or not */ - if (sngss7_test_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX)) { - SS7_WARN("Received local UBL on circuit that is already unblocked!\n"); + return; } - /* throw the ckt block flag */ - sngss7_set_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX); - - /* set the channel to suspended state */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} - -/******************************************************************************/ -static ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + /* initalize the sngss7_event */ + sngss7_event = ftdm_malloc(sizeof(*sngss7_event)); + if (sngss7_event == NULL) { + SS7_ERROR("Failed to allocate memory for sngss7_event!\n"); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; + return; } + memset(sngss7_event, 0x0, sizeof(*sngss7_event)); - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - SS7_ASSERT; - }; - - /* throw the ckt block flag */ - sngss7_set_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK); - - /* set the channel to suspended state */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} - - -/******************************************************************************/ -#if 0 -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; + /* fill in the sngss7_event struct */ + sngss7_event->spInstId = spInstId; + sngss7_event->suInstId = suInstId; + sngss7_event->circuit = circuit; + sngss7_event->globalFlg = globalFlg; + sngss7_event->evntType = evntType; + sngss7_event->event_id = SNGSS7_STA_IND_EVENT; + if (siStaEvnt != NULL) { + memcpy(&sngss7_event->event.siStaEvnt, siStaEvnt, sizeof(*siStaEvnt)); } - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - }; - - /* fill in here */ - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* enqueue this event */ + ftdm_queue_enqueue(((sngss7_span_data_t*)sngss7_info->ftdmchan->span->mod_data)->event_queue, sngss7_event); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; } /******************************************************************************/ -#endif -/******************************************************************************/ /******************************************************************************/ /* For Emacs: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index fc2c1a6..a9851bd 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -46,7 +46,8 @@ ftdm_sngss7_data_t g_ftdm_sngss7_data; /* PROTOTYPES *****************************************************************/ static void *ftdm_sangoma_ss7_run (ftdm_thread_t * me, void *obj); -static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan); +static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t *ftdmchan); +static void ftdm_sangoma_ss7_process_stack_event (sngss7_event_data_t *sngss7_event); static ftdm_status_t ftdm_sangoma_ss7_stop (ftdm_span_t * span); static ftdm_status_t ftdm_sangoma_ss7_start (ftdm_span_t * span); @@ -268,11 +269,12 @@ ftdm_state_map_t sangoma_ss7_state_map = { /* MONITIOR THREADS ***********************************************************/ static void *ftdm_sangoma_ss7_run(ftdm_thread_t * me, void *obj) { - ftdm_interrupt_t *ftdm_sangoma_ss7_int = NULL; + ftdm_interrupt_t *ftdm_sangoma_ss7_int[2]; ftdm_span_t *ftdmspan = (ftdm_span_t *) obj; ftdm_channel_t *ftdmchan = NULL; sngss7_chan_data_t *sngss7_info = NULL; - sngss7_span_data_t *sngss7_span = NULL; + sngss7_event_data_t *sngss7_event = NULL; + sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->mod_data; int i; ftdm_log (FTDM_LOG_INFO, "ftmod_sangoma_ss7 monitor thread for span=%u started.\n", ftdmspan->span_id); @@ -280,31 +282,53 @@ static void *ftdm_sangoma_ss7_run(ftdm_thread_t * me, void *obj) /* set IN_THREAD flag so that we know this thread is running */ ftdm_set_flag (ftdmspan, FTDM_SPAN_IN_THREAD); - /* get an interrupt queue for this span */ - if (ftdm_queue_get_interrupt (ftdmspan->pendingchans, &ftdm_sangoma_ss7_int) != FTDM_SUCCESS) { - SS7_CRITICAL ("Failed to get a ftdm_interrupt for span = %d!\n", ftdmspan->span_id); + /* get an interrupt queue for this span for channel state changes */ + if (ftdm_queue_get_interrupt (ftdmspan->pendingchans, &ftdm_sangoma_ss7_int[0]) != FTDM_SUCCESS) { + SS7_CRITICAL ("Failed to get a ftdm_interrupt for span = %d for channel state changes!\n", ftdmspan->span_id); + goto ftdm_sangoma_ss7_run_exit; + } + + /* get an interrupt queue for this span for Trillium events */ + if (ftdm_queue_get_interrupt (sngss7_span->event_queue, &ftdm_sangoma_ss7_int[1]) != FTDM_SUCCESS) { + SS7_CRITICAL ("Failed to get a ftdm_interrupt for span = %d for Trillium event queue!\n", ftdmspan->span_id); goto ftdm_sangoma_ss7_run_exit; } while (ftdm_running () && !(ftdm_test_flag (ftdmspan, FTDM_SPAN_STOP_THREAD))) { - /* find out why we returned from the interrupt queue */ - switch ((ftdm_interrupt_wait (ftdm_sangoma_ss7_int, 100))) { + /* check the channel state queue for an event*/ + switch ((ftdm_interrupt_multiple_wait(ftdm_sangoma_ss7_int, 2, 100))) { /**********************************************************************/ - case FTDM_SUCCESS: /* there was a state change on the span */ - /* process all pending state changes */ + case FTDM_SUCCESS: /* process all pending state changes */ + /* clean out all pending channel state changes */ while ((ftdmchan = ftdm_queue_dequeue (ftdmspan->pendingchans))) { /* double check that this channel has a state change pending */ if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { + /*first lock the channel */ + ftdm_mutex_lock(ftdmchan->mutex); + ftdm_sangoma_ss7_process_state_change (ftdmchan); + + /* unlock the channel */ + ftdm_mutex_unlock (ftdmchan->mutex); } else { - SS7_ERROR("ftdm_core reported state change, but state change flag not set on ft-span = %d, ft-chan = %d\n", + /* since we handle state changes again after handling the trillium queue + * this can occur since we'll clear the flag for the event but can't pop + * the channel out of pendingchans + */ +/* SS7_ERROR("ftdm_core reported state change, but state change flag not set on ft-span = %d, ft-chan = %d\n", ftdmchan->physical_span_id, - ftdmchan->physical_chan_id); + ftdmchan->physical_chan_id);*/ } }/* while ((ftdmchan = ftdm_queue_dequeue(ftdmspan->pendingchans))) */ + /* clean out all pending stack events */ + while ((sngss7_event = ftdm_queue_dequeue(sngss7_span->event_queue))) { + ftdm_sangoma_ss7_process_stack_event(sngss7_event); + ftdm_safe_free(sngss7_event); + }/* while ((sngss7_event = ftdm_queue_dequeue(ftdmspan->signal_data->event_queue))) */ + break; /**********************************************************************/ case FTDM_TIMEOUT: @@ -413,6 +437,81 @@ ftdm_sangoma_ss7_run_exit: } /******************************************************************************/ +static void ftdm_sangoma_ss7_process_stack_event (sngss7_event_data_t *sngss7_event) +{ + sngss7_chan_data_t *sngss7_info ; + ftdm_channel_t *ftdmchan; + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(sngss7_event->circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", sngss7_event->circuit); + return; + } + + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* figure out the type of event and send it to the right handler */ + switch (sngss7_event->event_id) { + /**************************************************************************/ + case (SNGSS7_CON_IND_EVENT): + handle_con_ind(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, &sngss7_event->event.siConEvnt); + break; + /**************************************************************************/ + case (SNGSS7_CON_CFM_EVENT): + handle_con_cfm(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, &sngss7_event->event.siConEvnt); + break; + /**************************************************************************/ + case (SNGSS7_CON_STA_EVENT): + handle_con_sta(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, &sngss7_event->event.siCnStEvnt, sngss7_event->evntType); + break; + /**************************************************************************/ + case (SNGSS7_REL_IND_EVENT): + handle_rel_ind(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, &sngss7_event->event.siRelEvnt); + break; + /**************************************************************************/ + case (SNGSS7_REL_CFM_EVENT): + handle_rel_cfm(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, &sngss7_event->event.siRelEvnt); + break; + /**************************************************************************/ + case (SNGSS7_DAT_IND_EVENT): + handle_dat_ind(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, &sngss7_event->event.siInfoEvnt); + break; + /**************************************************************************/ + case (SNGSS7_FAC_IND_EVENT): + handle_fac_ind(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, sngss7_event->evntType, &sngss7_event->event.siFacEvnt); + break; + /**************************************************************************/ + case (SNGSS7_FAC_CFM_EVENT): + handle_fac_cfm(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, sngss7_event->evntType, &sngss7_event->event.siFacEvnt); + break; + /**************************************************************************/ + case (SNGSS7_UMSG_IND_EVENT): + handle_umsg_ind(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit); + break; + /**************************************************************************/ + case (SNGSS7_STA_IND_EVENT): + handle_sta_ind(sngss7_event->suInstId, sngss7_event->spInstId, sngss7_event->circuit, sngss7_event->globalFlg, sngss7_event->evntType, &sngss7_event->event.siStaEvnt); + break; + /**************************************************************************/ + default: + SS7_ERROR("Unknown Event Id!\n"); + break; + /**************************************************************************/ + } /* switch (sngss7_event->event_id) */ + + /* while there's a state change present on this channel process it */ + while (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { + ftdm_sangoma_ss7_process_state_change(ftdmchan); + } + + /* unlock the channel */ + ftdm_mutex_unlock(ftdmchan->mutex); + + return; +} + +/******************************************************************************/ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) { ftdm_sigmsg_t sigev; @@ -426,9 +525,6 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) sigev.span_id = ftdmchan->span_id; sigev.channel = ftdmchan; - /*first lock the channel */ - ftdm_mutex_lock (ftdmchan->mutex); - SS7_DEBUG_CHAN(ftdmchan, "ftmod_sangoma_ss7 processing state %s\n", ftdm_channel_state2str (ftdmchan->state)); /* clear the state change flag...since we might be setting a new state */ @@ -1052,9 +1148,6 @@ suspend_goto_restart: /**************************************************************************/ }/*switch (ftdmchan->state) */ - /*unlock */ - ftdm_mutex_unlock (ftdmchan->mutex); - return; } @@ -1254,7 +1347,7 @@ static ftdm_status_t ftdm_sangoma_ss7_stop(ftdm_span_t * span) /* SIG_FUNCTIONS ***************************************************************/ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_ss7_span_config) { - sngss7_span_data_t *ss7_span_info; + sngss7_span_data_t *ss7_span_info; ftdm_log (FTDM_LOG_INFO, "Configuring ftmod_sangoma_ss7 span = %s(%d)...\n", span->name, @@ -1264,29 +1357,20 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_ss7_span_config) ss7_span_info = ftdm_calloc (1, sizeof (sngss7_span_data_t)); /* create a timer schedule */ - if (ftdm_sched_create (&ss7_span_info->sched, "SngSS7_Schedule")) { - SS7_CRITICAL ("Unable to create timer schedule!\n"); + if (ftdm_sched_create(&ss7_span_info->sched, "SngSS7_Schedule")) { + SS7_CRITICAL("Unable to create timer schedule!\n"); return FTDM_FAIL; } /* start the free run thread for the schedule */ - if (ftdm_sched_free_run (ss7_span_info->sched)) { - SS7_CRITICAL ("Unable to schedule free run!\n"); + if (ftdm_sched_free_run(ss7_span_info->sched)) { + SS7_CRITICAL("Unable to schedule free run!\n"); return FTDM_FAIL; } - /* attach the span info to the span */ - span->mod_data = ss7_span_info; - - /* parse the configuration and apply to the global config structure */ - if (ftmod_ss7_parse_xml(ftdm_parameters, span)) { - ftdm_log (FTDM_LOG_CRIT, "Failed to parse configuration!\n"); - return FTDM_FAIL; - } - - /* configure libsngss7 */ - if (ft_to_sngss7_cfg_all()) { - ftdm_log (FTDM_LOG_CRIT, "Failed to configure LibSngSS7!\n"); + /* create an event queue for this span */ + if ((ftdm_queue_create(&(ss7_span_info)->event_queue, SNGSS7_EVENT_QUEUE_SIZE)) != FTDM_SUCCESS) { + SS7_CRITICAL("Unable to create event queue!\n"); return FTDM_FAIL; } @@ -1302,9 +1386,22 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_ss7_span_config) span->get_channel_sig_status = ftdm_sangoma_ss7_get_sig_status; span->set_channel_sig_status = ftdm_sangoma_ss7_set_sig_status; span->state_map = &sangoma_ss7_state_map; + span->mod_data = ss7_span_info; ftdm_set_flag (span, FTDM_SPAN_USE_CHAN_QUEUE); + /* parse the configuration and apply to the global config structure */ + if (ftmod_ss7_parse_xml(ftdm_parameters, span)) { + ftdm_log (FTDM_LOG_CRIT, "Failed to parse configuration!\n"); + return FTDM_FAIL; + } + + /* configure libsngss7 */ + if (ft_to_sngss7_cfg_all()) { + ftdm_log (FTDM_LOG_CRIT, "Failed to configure LibSngSS7!\n"); + return FTDM_FAIL; + } + ftdm_log (FTDM_LOG_INFO, "Finished configuring ftmod_sangoma_ss7 span = %s(%d)...\n", span->name, span->span_id); @@ -1336,7 +1433,7 @@ static FIO_SIG_LOAD_FUNCTION(ftdm_sangoma_ss7_init) /* message (IAM, ACM, ANM, etc) trace initizalation */ g_ftdm_sngss7_data.message_trace = 1; - g_ftdm_sngss7_data.message_trace_level = 7; + g_ftdm_sngss7_data.message_trace_level = 6; /* setup the call backs needed by Sangoma_SS7 library */ sng_event.cc.sng_con_ind = sngss7_con_ind; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index 6bfc38e..3bf12ae 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -50,12 +50,26 @@ /******************************************************************************/ /* DEFINES ********************************************************************/ -#define MAX_NAME_LEN 10 -#define MAX_PATH 255 +#define MAX_NAME_LEN 10 +#define MAX_PATH 255 -#define MAX_CIC_LENGTH 5 -#define MAX_CIC_MAP_LENGTH 1000 +#define MAX_CIC_LENGTH 5 +#define MAX_CIC_MAP_LENGTH 1000 +#define SNGSS7_EVENT_QUEUE_SIZE 100 + +typedef enum { + SNGSS7_CON_IND_EVENT = 0, + SNGSS7_CON_CFM_EVENT, + SNGSS7_CON_STA_EVENT, + SNGSS7_REL_IND_EVENT, + SNGSS7_REL_CFM_EVENT, + SNGSS7_DAT_IND_EVENT, + SNGSS7_FAC_IND_EVENT, + SNGSS7_FAC_CFM_EVENT, + SNGSS7_UMSG_IND_EVENT, + SNGSS7_STA_IND_EVENT +} sng_event_type_t; typedef enum { VOICE = 0, @@ -334,8 +348,31 @@ typedef struct sngss7_chan_data { typedef struct sngss7_span_data { ftdm_sched_t *sched; sngss7_group_data_t grs; + ftdm_queue_t *event_queue; }sngss7_span_data_t; +typedef struct sngss7_event_data +{ + uint32_t event_id; + uint32_t spId; + uint32_t suId; + uint32_t spInstId; + uint32_t suInstId; + uint32_t circuit; + uint8_t globalFlg; + uint8_t evntType; + union + { + SiConEvnt siConEvnt; + SiCnStEvnt siCnStEvnt; + SiRelEvnt siRelEvnt; + SiInfoEvnt siInfoEvnt; + SiFacEvnt siFacEvnt; + SiStaEvnt siStaEvnt; + } event; +} sngss7_event_data_t; + + typedef enum { @@ -441,6 +478,36 @@ void sngss7_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); void sngss7_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit); +ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); +ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCnStEvnt *siCnStEvnt, uint8_t evntType); +ftdm_status_t handle_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); +ftdm_status_t handle_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt); +ftdm_status_t handle_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt); +ftdm_status_t handle_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiInfoEvnt *siInfoEvnt); +ftdm_status_t handle_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt); +ftdm_status_t handle_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt); +ftdm_status_t handle_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit); +ftdm_status_t handle_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); + +ftdm_status_t handle_reattempt(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_resume(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_cot_stop(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_cot(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_local_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_grs_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_blo_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_ubl_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_local_blk(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); + uint8_t copy_cgPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum); uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum); uint8_t copy_cdPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum); commit 05ab7e8de634f0a9da26fcc3dc730bce2b1a34a4 Author: Moises Silva <moy@sangoma.com> Date: Wed Sep 1 11:21:29 2010 -0400 freetdm: added proper bearer capability and user layer 1 protocol types diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index af55370..132fd30 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -239,6 +239,20 @@ typedef struct { uint8_t plan; } ftdm_number_t; +/*! \brief bearer capability */ +typedef enum { + FTDM_BEARER_CAP_SPEECH = 0x00, + FTDM_BEARER_CAP_64K_UNRESTRICTED = 0x02, + FTDM_BEARER_CAP_3_1KHZ_AUDIO = 0x03 +} ftdm_bearer_cap_t; + +/*! \brief user information layer 1 protocol */ +typedef enum { + FTDM_USER_LAYER1_PROT_V110 = 0x01, + FTDM_USER_LAYER1_PROT_ULAW = 0x02, + FTDM_USER_LAYER1_PROT_ALAW = 0x03, +} ftdm_user_layer1_prot_t; + /*! \brief Caller information */ typedef struct ftdm_caller_data { char cid_date[8]; /*!< Caller ID date */ @@ -256,9 +270,9 @@ typedef struct ftdm_caller_data { uint32_t raw_data_len; /* !< Raw data length */ /* these 2 are undocumented right now, only used by boost: */ /* bearer capability */ - uint8_t bearer_capability; + ftdm_bearer_cap_t bearer_capability; /* user information layer 1 protocol */ - uint8_t bearer_layer1; + ftdm_user_layer1_prot_t bearer_layer1; } ftdm_caller_data_t; /*! \brief Tone type */ commit c6a4ddd0baa7c699b96d2590fd581dc4cf1374d7 Author: Rupa Schomaker <rupa@rupa.com> Date: Wed Sep 1 07:00:33 2010 -0500 FSMOD-69 - mod_curl - use method=post when post requested diff --git a/src/mod/applications/mod_curl/mod_curl.c b/src/mod/applications/mod_curl/mod_curl.c old mode 100755 new mode 100644 index 9081ca6..4f6aefd --- a/src/mod/applications/mod_curl/mod_curl.c +++ b/src/mod/applications/mod_curl/mod_curl.c @@ -272,6 +272,7 @@ SWITCH_STANDARD_APP(curl_app_function) } else if (!strcasecmp("get", argv[i]) || !strcasecmp("head", argv[i])) { method = switch_core_strdup(pool, argv[i]); } else if (!strcasecmp("post", argv[i])) { + method = "post"; if (++i < argc) { postdata = switch_core_strdup(pool, argv[i]); switch_url_decode(postdata); commit b7c23acd40b6f69a2aca4d564cea9468c5cf2052 Author: David Yat Sin <dyatsin@sangoma.com> Date: Tue Aug 31 19:19:55 2010 -0400 Removed DEBUG_CHAN_MEMORY diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 12a98f9..61400ba 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -35,7 +35,11 @@ #include "ftmod_sangoma_isdn.h" +#if 1 +#undef FTDM_DEBUG_CHAN_MEMORY +#else #define FTDM_DEBUG_CHAN_MEMORY +#endif #ifdef FTDM_DEBUG_CHAN_MEMORY #include <sys/mman.h> commit e90ccb151e336e50a7083bd5e6d35e82128151a9 Author: David Yat Sin <dyatsin@sangoma.com> Date: Tue Aug 31 19:05:37 2010 -0400 fix for segfaults in cases where we were still using raw_data as pointer diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 890d9d9..50eb7a2 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -2107,10 +2107,10 @@ static FIO_SIGNAL_CB_FUNCTION(on_clear_channel_signal) } break; case FTDM_SIGEVENT_SIGSTATUS_CHANGED: - { - ftdm_signaling_status_t *sigstatus = (ftdm_signaling_status_t*)(sigmsg->raw_data); + { + ftdm_signaling_status_t sigstatus = sigmsg->raw_data ? *((ftdm_signaling_status_t*)(sigmsg->raw_data)) : sigmsg->sigstatus; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%d:%d signalling changed to :%s\n", - spanid, chanid, ftdm_signaling_status2str(*sigstatus)); + spanid, chanid, ftdm_signaling_status2str(sigstatus)); } break; default: diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index c53e9aa..39eba67 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -4410,10 +4410,13 @@ FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t switch (sigmsg->event_id) { case FTDM_SIGEVENT_SIGSTATUS_CHANGED: - if (*((ftdm_signaling_status_t*)(sigmsg->raw_data)) == FTDM_SIG_STATE_UP) { - ftdm_set_flag(sigmsg->channel, FTDM_CHANNEL_SIG_UP); - } else { - ftdm_clear_flag(sigmsg->channel, FTDM_CHANNEL_SIG_UP); + { + ftdm_signaling_status_t sigstatus = ftdm_test_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE) ? sigmsg->sigstatus : *((ftdm_signaling_status_t*)(sigmsg->raw_data)); + if (sigstatus == FTDM_SIG_STATE_UP) { + ftdm_set_flag(sigmsg->channel, FTDM_CHANNEL_SIG_UP); + } else { + ftdm_clear_flag(sigmsg->channel, FTDM_CHANNEL_SIG_UP); + } } break; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index b47660b..12a98f9 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -279,11 +279,11 @@ static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj) ftdm_channel_unlock(ftdmchan); } - /* Check if there are any timers to process */ while ((sngisdn_event = ftdm_queue_dequeue(signal_data->event_queue))) { ftdm_sangoma_isdn_process_stack_event(span, sngisdn_event); ftdm_safe_free(sngisdn_event); - } + } + ftdm_span_trigger_signals(span); break; case FTDM_TIMEOUT: /* twiddle */ @@ -791,6 +791,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_isdn_span_config) span->set_channel_sig_status = ftdm_sangoma_isdn_set_sig_status; span->state_map = &sangoma_isdn_state_map; ftdm_set_flag(span, FTDM_SPAN_USE_CHAN_QUEUE); + ftdm_set_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE); if (span->trunk_type == FTDM_TRUNK_BRI_PTMP || span->trunk_type == FTDM_TRUNK_BRI) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cntrl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cntrl.c index 5299c91..7aba6a6 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cntrl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cntrl.c @@ -48,7 +48,7 @@ void sngisdn_set_chan_sig_status(ftdm_channel_t *ftdmchan, ftdm_signaling_status sig.span_id = ftdmchan->span_id; sig.channel = ftdmchan; sig.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sig.raw_data = &status; + sig.sigstatus = status; ftdm_span_send_signal(ftdmchan->span, &sig); return; } commit 3a35139a3212d4d07da3c0f391b00f2e1daa2fa3 Author: Moises Silva <moy@sangoma.com> Date: Tue Aug 31 18:13:56 2010 -0400 freetdm: add asynchronous signal notification diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 238a9fc..c53e9aa 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -51,6 +51,7 @@ #include "ftdm_cpu_monitor.h" #define SPAN_PENDING_CHANS_QUEUE_SIZE 1000 +#define SPAN_PENDING_SIGNALS_QUEUE_SIZE 1000 #define FTDM_READ_TRACE_INDEX 0 #define FTDM_WRITE_TRACE_INDEX 1 @@ -463,6 +464,9 @@ static ftdm_status_t ftdm_span_destroy(ftdm_span_t *span) if (span->pendingchans) { ftdm_queue_destroy(&span->pendingchans); } + if (span->pendingsignals) { + ftdm_queue_destroy(&span->pendingsignals); + } ftdm_mutex_unlock(span->mutex); ftdm_mutex_destroy(&span->mutex); ftdm_safe_free(span->signal_data); @@ -4097,6 +4101,9 @@ static ftdm_status_t post_configure_span_channels(ftdm_span_t *span) if (ftdm_test_flag(span, FTDM_SPAN_USE_CHAN_QUEUE)) { status = ftdm_queue_create(&span->pendingchans, SPAN_PENDING_CHANS_QUEUE_SIZE); } + if (status == FTDM_SUCCESS && ftdm_test_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE)) { + status = ftdm_queue_create(&span->pendingsignals, SPAN_PENDING_SIGNALS_QUEUE_SIZE); + } return status; } @@ -4362,10 +4369,39 @@ FT_DECLARE(ftdm_status_t) ftdm_group_create(ftdm_group_t **group, const char *na return status; } -FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t *sigmsg) +static ftdm_status_t ftdm_span_trigger_signal(const ftdm_span_t *span, ftdm_sigmsg_t *sigmsg) { - ftdm_status_t status = FTDM_FAIL; + return span->signal_cb(sigmsg); +} + +static ftdm_status_t ftdm_span_queue_signal(const ftdm_span_t *span, ftdm_sigmsg_t *sigmsg) +{ + ftdm_sigmsg_t *new_sigmsg = NULL; + + ftdm_assert_return((sigmsg->raw_data == NULL), FTDM_FAIL, "No raw data should be used with asynchronous notification\n"); + + new_sigmsg = ftdm_calloc(1, sizeof(*sigmsg)); + if (!new_sigmsg) { + return FTDM_FAIL; + } + memcpy(new_sigmsg, sigmsg, sizeof(*sigmsg)); + + ftdm_queue_enqueue(span->pendingsignals, new_sigmsg); + return FTDM_SUCCESS; +} +FT_DECLARE(ftdm_status_t) ftdm_span_trigger_signals(const ftdm_span_t *span) +{ + ftdm_sigmsg_t *sigmsg = NULL; + while ((sigmsg = ftdm_queue_dequeue(span->pendingsignals))) { + ftdm_span_trigger_signal(span, sigmsg); + ftdm_safe_free(sigmsg); + } + return FTDM_SUCCESS; +} + +FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t *sigmsg) +{ if (sigmsg->channel) { ftdm_mutex_lock(sigmsg->channel->mutex); } @@ -4400,10 +4436,12 @@ FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t break; } - - /* call the user callback only if set */ - if (span->signal_cb) { - status = span->signal_cb(sigmsg); + + /* if the signaling module uses a queue for signaling notifications, then enqueue it */ + if (ftdm_test_flag(span, FTDM_SPAN_USE_SIGNALS_QUEUE)) { + ftdm_span_queue_signal(span, sigmsg); + } else { + ftdm_span_trigger_signal(span, sigmsg); } done: @@ -4411,7 +4449,7 @@ done: ftdm_mutex_unlock(sigmsg->channel->mutex); } - return status; + return FTDM_SUCCESS; } static void *ftdm_cpu_monitor_run(ftdm_thread_t *me, void *obj) diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index af55370..b72aeb6 100644 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -317,23 +317,6 @@ typedef struct ftdm_channel_config { float txgain; } ftdm_channel_config_t; -/*! \brief Generic signaling message */ -struct ftdm_sigmsg { - ftdm_signal_event_t event_id; /*!< The type of message */ - ftdm_channel_t *channel; /*!< Related channel */ - uint32_t chan_id; /*!< easy access to chan id */ - uint32_t span_id; /*!< easy access to span_id */ - void *raw_data; /*!< Message specific data if any */ - uint32_t raw_data_len; /*!< Data len in case is needed */ -}; - -/*! \brief Crash policy - * Useful for debugging only, default policy is never, if you wish to crash on asserts then use ftdm_global_set_crash_policy */ -typedef enum { - FTDM_CRASH_NEVER = 0, - FTDM_CRASH_ON_ASSERT -} ftdm_crash_policy_t; - /*! \brief Signaling status on a given span or specific channel on protocols that support it */ @@ -352,6 +335,24 @@ typedef enum { /*! \brief Move from string to ftdm_signaling_status_t and viceversa */ FTDM_STR2ENUM_P(ftdm_str2ftdm_signaling_status, ftdm_signaling_status2str, ftdm_signaling_status_t) +/*! \brief Generic signaling message */ +struct ftdm_sigmsg { + ftdm_signal_event_t event_id; /*!< The type of message */ + ftdm_channel_t *channel; /*!< Related channel */ + uint32_t chan_id; /*!< easy access to chan id */ + uint32_t span_id; /*!< easy access to span_id */ + ftdm_signaling_status_t sigstatus; /*!< Signaling status (valid if event_id is FTDM_SIGEVENT_SIGSTATUS_CHANGED) */ + void *raw_data; /*!< Message specific data if any */ + uint32_t raw_data_len; /*!< Data len in case is needed */ +}; + +/*! \brief Crash policy + * Useful for debugging only, default policy is never, if you wish to crash on asserts then use ftdm_global_set_crash_policy */ +typedef enum { + FTDM_CRASH_NEVER = 0, + FTDM_CRASH_ON_ASSERT +} ftdm_crash_policy_t; + /*! \brief I/O waiting flags */ typedef enum { FTDM_NO_FLAGS = 0, diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index 95f34b4..74bea81 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -466,6 +466,7 @@ struct ftdm_span { ftdm_state_map_t *state_map; ftdm_caller_data_t default_caller_data; ftdm_queue_t *pendingchans; + ftdm_queue_t *pendingsignals; struct ftdm_span *next; }; @@ -579,6 +580,8 @@ FT_DECLARE(ftdm_status_t) ftdm_span_next_event(ftdm_span_t *span, ftdm_event_t * */ FT_DECLARE(ftdm_status_t) ftdm_channel_queue_dtmf(ftdm_channel_t *ftdmchan, const char *dtmf); +/* dequeue pending signals and notify the user via the span signal callback */ +FT_DECLARE(ftdm_status_t) ftdm_span_trigger_signals(const ftdm_span_t *span); /*! \brief Assert condition diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index 572e632..d8e8b5c 100644 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -176,6 +176,10 @@ typedef enum { FTDM_SPAN_USE_CHAN_QUEUE = (1 << 6), FTDM_SPAN_SUGGEST_CHAN_ID = (1 << 7), FTDM_SPAN_USE_AV_RATE = (1 << 8), + /* If you use this flag, you MUST call ftdm_span_trigger_signals to deliver the user signals + * after having called ftdm_send_span_signal(), which with this flag it will just enqueue the signal + * for later delivery */ + FTDM_SPAN_USE_SIGNALS_QUEUE = (1 << 9), } ftdm_span_flag_t; /*! \brief Channel supported features */ commit f7669283a69f4fa60f37ff59b0ac63ebee461999 Author: Moises Silva <moy@sangoma.com> Date: Tue Aug 31 15:25:26 2010 -0400 freetdm: remove ftdm_span_set_npi and ftdm_span_set_ton from boost diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c index b35596c..7234e67 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.c @@ -2534,46 +2534,6 @@ static FIO_SPAN_GET_SIG_STATUS_FUNCTION(sangoma_boost_get_span_sig_status) return sangoma_boost_data->sigmod->get_span_sig_status(span, status); } -/* TODO: move these ones to a common private header so other ISDN mods can use them */ -static void ftdm_span_set_npi(const char *npi_string, uint8_t *target) -{ - if (!strcasecmp(npi_string, "isdn") || !strcasecmp(npi_string, "e164")) { - *target = FTDM_NPI_ISDN; - } else if (!strcasecmp(npi_string, "data")) { - *target = FTDM_NPI_DATA; - } else if (!strcasecmp(npi_string, "telex")) { - *target = FTDM_NPI_TELEX; - } else if (!strcasecmp(npi_string, "national")) { - *target = FTDM_NPI_NATIONAL; - } else if (!strcasecmp(npi_string, "private")) { - *target = FTDM_NPI_PRIVATE; - } else if (!strcasecmp(npi_string, "reserved")) { - *target = FTDM_NPI_RESERVED; - } else if (!strcasecmp(npi_string, "unknown")) { - *target = FTDM_NPI_UNKNOWN; - } else { - ftdm_log(FTDM_LOG_WARNING, "Invalid NPI value (%s)\n", npi_string); - *target = FTDM_NPI_UNKNOWN; - } -} - -static void ftdm_span_set_ton(const char *ton_string, uint8_t *target) -{ - if (!strcasecmp(ton_string, "national")) { - *target = FTDM_TON_NATIONAL; - } else if (!strcasecmp(ton_string, "international")) { - *target = FTDM_TON_INTERNATIONAL; - } else if (!strcasecmp(ton_string, "local")) { - *target = FTDM_TON_SUBSCRIBER_NUMBER; - } else if (!strcasecmp(ton_string, "unknown")) { - *target = FTDM_TON_UNKNOWN; - } else { - ftdm_log(FTDM_LOG_WARNING, "Invalid TON value (%s)\n", ton_string); - *target = FTDM_TON_UNKNOWN; - } -} - - /** * \brief Initialises an sangoma boost span from configuration variables * \param span Span to configure commit def3e0b3862896b02514b643fa47d4e84576772b Author: Moises Silva <moy@sangoma.com> Date: Tue Aug 31 14:56:29 2010 -0400 freetdm: include utils header in the core diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index 8f14931..95f34b4 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -117,6 +117,7 @@ #include "ftdm_buffer.h" #include "ftdm_threadmutex.h" #include "ftdm_sched.h" +#include "ftdm_call_utils.h" #ifdef __cplusplus extern "C" { commit a3b2e91ebfdbddcf5281d21597988b76c28b92fc Author: Moises Silva <moy@sangoma.com> Date: Tue Aug 31 14:55:11 2010 -0400 freetdm: try polling again after EINTR diff --git a/libs/freetdm/src/ftdm_threadmutex.c b/libs/freetdm/src/ftdm_threadmutex.c index 61051df..79bd28f 100644 --- a/libs/freetdm/src/ftdm_threadmutex.c +++ b/libs/freetdm/src/ftdm_threadmutex.c @@ -329,6 +329,7 @@ FT_DECLARE(ftdm_status_t) ftdm_interrupt_wait(ftdm_interrupt_t *interrupt, int m return FTDM_SUCCESS; } #else +pollagain: ints[0].fd = interrupt->readfd; ints[0].events = POLLIN; ints[0].revents = 0; @@ -343,6 +344,9 @@ FT_DECLARE(ftdm_status_t) ftdm_interrupt_wait(ftdm_interrupt_t *interrupt, int m res = poll(ints, num, ms); if (res == -1) { + if (errno == EINTR) { + goto pollagain; + } ftdm_log(FTDM_LOG_CRIT, "interrupt poll failed (%s)\n", strerror(errno)); return FTDM_FAIL; } commit 6216d5df07876843127bb0f3e08ae30282fcac74 Author: Moises Silva <moy@sangoma.com> Date: Tue Aug 31 14:42:41 2010 -0400 freetdm: fix asserts diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 56fe77d..238a9fc 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2122,7 +2122,8 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_place(const char *file, const char { ftdm_status_t status = FTDM_FAIL; - ftdm_assert(ftdmchan != NULL, "null channel"); + ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "null channel"); + ftdm_assert_return(ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND), FTDM_FAIL, "Call place, but outbound flag not set\n"); ftdm_channel_lock(ftdmchan); @@ -2268,14 +2269,12 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_close(ftdm_channel_t **ftdmchan) ftdm_channel_t *check; ftdm_status_t status = FTDM_FAIL; - assert(ftdmchan != NULL); + ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "null channel double pointer provided!\n"); + ftdm_assert_return(*ftdmchan != NULL, FTDM_FAIL, "null channel pointer provided!\n"); + check = *ftdmchan; *ftdmchan = NULL; - if (!check) { - return FTDM_FAIL; - } - if (ftdm_test_flag(check, FTDM_CHANNEL_CONFIGURED)) { ftdm_mutex_lock(check->mutex); if (ftdm_test_flag(check, FTDM_CHANNEL_OPEN)) { commit 6c9e6be255c4229931b333af114fb98a96d22ac2 Author: Moises Silva <moy@sangoma.com> Date: Tue Aug 31 14:23:37 2010 -0400 freetdm: remove hack for race condition since the root cause was fixed diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 223eb34..56fe77d 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -1972,24 +1972,12 @@ done: /* lock must be acquired by the caller! */ static ftdm_status_t call_hangup(ftdm_channel_t *chan, const char *file, const char *func, int line) { + ftdm_set_flag(chan, FTDM_CHANNEL_USER_HANGUP); if (chan->state != FTDM_CHANNEL_STATE_DOWN) { if (chan->state == FTDM_CHANNEL_STATE_HANGUP) { /* make user's life easier, and just ignore double hangup requests */ return FTDM_SUCCESS; } - if (chan->state == FTDM_CHANNEL_STATE_TERMINATING && ftdm_test_flag(chan, FTDM_CHANNEL_STATE_CHANGE)) { - /* the signaling stack is already terminating the call but has not yet notified the user about it - * with SIGEVENT_STOP, we must flag this channel as hangup and wait for the SIGEVENT_STOP before - * proceeding, at that point we will move the channel to hangup, but the SIGEVENT_STOP will not - * be sent to the user since they already made clear they want to hangup! - * */ - ftdm_set_flag(chan, FTDM_CHANNEL_USER_HANGUP); - ftdm_wait_for_flag_cleared(chan, FTDM_CHANNEL_STATE_CHANGE, 5000); - if (ftdm_test_flag(chan, FTDM_CHANNEL_STATE_CHANGE)) { - ftdm_log_chan(chan, FTDM_LOG_CRIT, "Failed to hangup, state change for %d/%s is still pending!\n", chan->state, ftdm_channel_state2str(chan->state)); - return FTDM_FAIL; - } - } ftdm_channel_set_state(file, func, line, chan, FTDM_CHANNEL_STATE_HANGUP, 1); } else { /* the signaling stack did not touch the state, commit 7c2cbf407362313dde3dfd0f87f2df41b1692b91 Author: Moises Silva <moy@sangoma.com> Date: Tue Aug 31 14:18:21 2010 -0400 freetdm: put warning instead of error on circuit congestion diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index a4432cc..223eb34 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -1478,7 +1478,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_group(uint32_t group_id, ftdm_dir ftdm_group_channel_use_count(group, &count); if (count >= group->chan_count) { - ftdm_log(FTDM_LOG_ERROR, "All circuits are busy (%d channels used out of %d available).\n", count, group->chan_count); + ftdm_log(FTDM_LOG_WARNING, "All circuits are busy (%d channels used out of %d available).\n", count, group->chan_count); *ftdmchan = NULL; return FTDM_FAIL; } @@ -1575,7 +1575,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_span(uint32_t span_id, ftdm_direc ftdm_span_channel_use_count(span, &count); if (count >= span->chan_count) { - ftdm_log(FTDM_LOG_ERROR, "All circuits are busy: active=%i max=%i.\n", count, span->chan_count); + ftdm_log(FTDM_LOG_WARNING, "All circuits are busy: active=%i max=%i.\n", count, span->chan_count); return FTDM_FAIL; } commit c443641a731eac9a15118b0f2a761c9d759bd6e6 Author: Moises Silva <moy@sangoma.com> Date: Tue Aug 31 14:10:54 2010 -0400 freetdm: remove suspended check on state change diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 60d0cc2..a4432cc 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -1182,14 +1182,6 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_set_state(const char *file, const char *f return FTDM_FAIL; } - if (ftdm_test_flag(ftdmchan->span, FTDM_SPAN_SUSPENDED)) { - if (state != FTDM_CHANNEL_STATE_RESTART && state != FTDM_CHANNEL_STATE_DOWN) { - ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_ERROR, "Ignored state change request from %s to %s, span %s is suspended\n", - ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state), ftdmchan->span->name); - return FTDM_FAIL; - } - } - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_ERROR, "Ignored state change request from %s to %s, the previous state change has not been processed yet\n", ftdm_channel_state2str(ftdmchan->state), ftdm_channel_state2str(state)); commit 32cc2402f4c25369ed8f2b954a00b6049a3c48f7 Author: Moises Silva <moy@sangoma.com> Date: Tue Aug 31 14:03:12 2010 -0400 freetdm: validation fixes diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 871d345..60d0cc2 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -260,6 +260,14 @@ static ftdm_status_t ftdm_set_caller_data(ftdm_span_t *span, ftdm_caller_data_t return FTDM_FAIL; } + if (caller_data->dnis.plan == FTDM_NPI_INVALID) { + caller_data->dnis.plan = span->default_caller_data.dnis.plan; + } + + if (caller_data->dnis.type == FTDM_TON_INVALID) { + caller_data->dnis.type = span->default_caller_data.dnis.type; + } + if (caller_data->cid_num.plan == FTDM_NPI_INVALID) { caller_data->cid_num.plan = span->default_caller_data.cid_num.plan; } @@ -283,6 +291,12 @@ static ftdm_status_t ftdm_set_caller_data(ftdm_span_t *span, ftdm_caller_data_t if (caller_data->rdnis.type == FTDM_NPI_INVALID) { caller_data->rdnis.type = span->default_caller_data.rdnis.type; } + + if (FTDM_FAIL == ftdm_is_number(caller_data->cid_num.digits)) { + ftdm_log(FTDM_LOG_DEBUG, "dropping caller id number %s since we only accept digits\n", caller_data->cid_num.digits); + caller_data->cid_num.digits[0] = '\0'; + } + return FTDM_SUCCESS; } commit 291adb56862ebd36298dde9a460f785fad61ac65 Author: Moises Silva <moy@sangoma.com> Date: Tue Aug 31 13:59:13 2010 -0400 freetdm: add analog limits diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index e2ec6a8..890d9d9 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -2622,6 +2622,32 @@ static switch_status_t load_config(void) uint32_t span_id = 0, to = 0, max = 0; ftdm_span_t *span = NULL; analog_option_t analog_options = ANALOG_OPTION_NONE; + + if (name) { + zstatus = ftdm_span_find_by_name(name, &span); + } else { + if (switch_is_number(id)) { + span_id = atoi(id); + zstatus = ftdm_span_find(span_id, &span); + } + + if (zstatus != FTDM_SUCCESS) { + zstatus = ftdm_span_find_by_name(id, &span); + } + } + + if (zstatus != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_ERROR, "Error finding FreeTDM span id:%s name:%s\n", switch_str_nil(id), switch_str_nil(name)); + continue; + } + + if (!span_id) { + span_id = ftdm_span_get_id(span); + } + + /* some defaults first */ + SPAN_CONFIG[span_id].limit_backend = "hash"; + SPAN_CONFIG[span_id].limit_reset_event = FTDM_LIMIT_RESET_ON_TIMEOUT; for (param = switch_xml_child(myspan, "param"); param; param = param->next) { char *var = (char *) switch_xml_attr_soft(param, "name"); @@ -2636,6 +2662,28 @@ static switch_status_t load_config(void) context = val; } else if (!strcasecmp(var, "dialplan")) { dialplan = val; + } else if (!strcasecmp(var, "call_limit_backend")) { + SPAN_CONFIG[span_id].limit_backend = val; + ftdm_log(FTDM_LOG_DEBUG, "Using limit backend %s for span %d\n", SPAN_CONFIG[span_id].limit_backend, span_id); + } else if (!strcasecmp(var, "call_limit_rate")) { + int calls; + int seconds; + if (sscanf(val, "%d/%d", &calls, &seconds) != 2) { + ftdm_log(FTDM_LOG_ERROR, "Invalid %s parameter, format example: 3/1 for 3 calls per second\n", var); + } else { + if (calls < 1 || seconds < 1) { + ftdm_log(FTDM_LOG_ERROR, "Invalid %s parameter value, minimum call limit must be 1 per second\n", var); + } else { + SPAN_CONFIG[span_id].limit_calls = calls; + SPAN_CONFIG[span_id].limit_seconds = seconds; + } + } + } else if (!strcasecmp(var, "call_limit_reset_event")) { + if (!strcasecmp(val, "answer")) { + SPAN_CONFIG[span_id].limit_reset_event = FTDM_LIMIT_RESET_ON_ANSWER; + } else { + ftdm_log(FTDM_LOG_ERROR, "Invalid %s parameter value, only accepted event is 'answer'\n", var); + } } else if (!strcasecmp(var, "dial-regex")) { dial_regex = val; } else if (!strcasecmp(var, "enable-callerid")) { commit 4552c69a7b687f3a32c983081c90ce08b0b416d1 Author: Moises Silva <moy@sangoma.com> Date: Tue Aug 31 13:49:27 2010 -0400 freetdm: call utils missing header diff --git a/libs/freetdm/src/include/private/ftdm_call_utils.h b/libs/freetdm/src/include/private/ftdm_call_utils.h new file mode 100644 index 0000000..57f2f4b --- /dev/null +++ b/libs/freetdm/src/include/private/ftdm_call_utils.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2010, Sangoma Technologies + * David Yat Sin <dyatsin@sangoma.com> + * 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 original author; nor the names of any 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 OWNER + * 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. + */ + +#ifndef __FTDM_CALL_UTILS_H__ +#define __FTDM_CALL_UTILS_H__ + +#include "freetdm.h" + +FT_DECLARE(ftdm_status_t) ftdm_span_set_npi(const char *npi_string, uint8_t *target); +FT_DECLARE(ftdm_status_t) ftdm_span_set_ton(const char *ton_string, uint8_t *target); +FT_DECLARE(ftdm_status_t) ftdm_is_number(char *number); + +#endif /* __FTDM_CALL_UTILS_H__ */ + commit 9a26e0cc2bbf153610eaf45d9ea72045aa29f2fb Author: Moises Silva <moy@sangoma.com> Date: Tue Aug 31 13:48:48 2010 -0400 freetdm: crash on assert diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index c98117c..e2ec6a8 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -87,6 +87,7 @@ static struct { analog_option_t analog_options; switch_hash_t *ss7_configs; int sip_headers; + uint8_t crash_on_assert; } globals; /* private data attached to each fs session */ @@ -2389,6 +2390,8 @@ static switch_status_t load_config(void) globals.debug = atoi(val); } else if (!strcasecmp(var, "hold-music")) { switch_set_string(globals.hold_music, val); + } else if (!strcasecmp(var, "crash-on-assert")) { + globals.crash_on_assert = switch_true(val); } else if (!strcasecmp(var, "sip-headers")) { globals.sip_headers = switch_true(val); } else if (!strcasecmp(var, "enable-analog-option")) { @@ -3358,6 +3361,10 @@ static switch_status_t load_config(void) } } + if (globals.crash_on_assert) { + ftdm_log(FTDM_LOG_WARNING, "Crash on assert enabled\n"); + ftdm_global_set_crash_policy(FTDM_CRASH_ON_ASSERT); + } switch_xml_free(xml); commit 80363af69716e951a4918a22ee93176676f4cda6 Author: Moises Silva <moy@sangoma.com> Date: Tue Aug 31 13:29:31 2010 -0400 freetdm: merged konrad and david signaling work diff --git a/libs/freetdm/Makefile.am b/libs/freetdm/Makefile.am index ff5e23b..6ccc473 100644 --- a/libs/freetdm/Makefile.am +++ b/libs/freetdm/Makefile.am @@ -41,6 +41,9 @@ INCS += -I$(FT_SRCDIR)/$(SRC)/ftmod/ftmod_sangoma_boost if SNGSS7 INCS += -I/usr/include/sng_ss7/ endif +if SNGISDN +INCS += -I/usr/include/sng_isdn/ +endif MY_CFLAGS = $(INCS) $(FTDM_CFLAGS) -DFTDM_CONFIG_DIR=\"@confdir@\" -DFTDM_MOD_DIR=\"$(moddir)\" @COMP_VENDOR_CFLAGS@ @DEFS@ COMPILE = $(CC) $(MY_CFLAGS) $(INCS) @@ -70,6 +73,7 @@ $(SRC)/hashtable_itr.c \ $(SRC)/ftdm_io.c \ $(SRC)/ftdm_queue.c \ $(SRC)/ftdm_sched.c \ +$(SRC)/ftdm_call_utils.c \ $(SRC)/ftdm_config.c \ $(SRC)/ftdm_callerid.c \ $(SRC)/fsk.c \ @@ -271,7 +275,11 @@ ftmod_sangoma_ss7_la_SOURCES = $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7 $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c \ $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c \ $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c \ - $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sts.c \ + $(SRC)/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c ftmod_sangoma_ss7_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) -D_GNU_SOURCE ftmod_sangoma_ss7_la_LDFLAGS = -module -avoid-version -lsng_ss7 ftmod_sangoma_ss7_la_LIBADD = $(MYLIB) @@ -285,17 +293,16 @@ ftmod_sangoma_isdn_la_SOURCES = $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_is $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c \ $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c \ $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c \ - $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_in.c \ + $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c \ + $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c \ $(SRC)/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c -ftmod_sangoma_isdn_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) +ftmod_sangoma_isdn_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) -D_GNU_SOURCE ftmod_sangoma_isdn_la_LDFLAGS = -module -avoid-version -lsng_isdn ftmod_sangoma_isdn_la_LIBADD = $(MYLIB) endif - - if OPENR2 ftmod_r2_la_SOURCES = $(SRC)/ftmod/ftmod_r2/ftmod_r2.c ftmod_r2_la_CFLAGS = $(AM_CFLAGS) $(MY_CFLAGS) diff --git a/libs/freetdm/configure.ac b/libs/freetdm/configure.ac index 9ad8c4f..a8ed67f 100644 --- a/libs/freetdm/configure.ac +++ b/libs/freetdm/configure.ac @@ -193,6 +193,18 @@ AM_CONDITIONAL([SNGISDN],[test "${have_sng_isdn}" = "yes"]) AC_CHECK_LIB([openr2], [openr2_context_set_io_type], [have_openr2="yes"]) AM_CONDITIONAL([OPENR2],[test "${have_openr2}" = "yes"]) +if test "${have_sng_isdn}" = "yes"; then + if test "${build}" == "${host}" + then + case "${host}" in + x86_64-*) + # X86_64 machines need additional flags when compiling against libsng_isdn + CFLAGS="$CFLAGS -DBIT_64 -DALIGN_64BIT" + ;; + esac + fi +fi + COMP_VENDOR_CFLAGS="$COMP_VENDOR_CFLAGS" AC_SUBST(COMP_VENDOR_CFLAGS) AC_CONFIG_FILES([Makefile diff --git a/libs/freetdm/src/ftdm_call_utils.c b/libs/freetdm/src/ftdm_call_utils.c new file mode 100644 index 0000000..4d7317a --- /dev/null +++ b/libs/freetdm/src/ftdm_call_utils.c @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2010, Sangoma Technologies + * David Yat Sin <dyatsin@sangoma.com> + * 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 original author; nor the names of any 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 OWNER + * 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 "private/ftdm_core.h" +#include <ctype.h> + + +FT_DECLARE(ftdm_status_t) ftdm_span_set_npi(const char *npi_string, uint8_t *target) +{ + if (!strcasecmp(npi_string, "isdn") || !strcasecmp(npi_string, "e164")) { + *target = FTDM_NPI_ISDN; + } else if (!strcasecmp(npi_string, "data")) { + *target = FTDM_NPI_DATA; + } else if (!strcasecmp(npi_string, "telex")) { + *target = FTDM_NPI_TELEX; + } else if (!strcasecmp(npi_string, "national")) { + *target = FTDM_NPI_NATIONAL; + } else if (!strcasecmp(npi_string, "private")) { + *target = FTDM_NPI_PRIVATE; + } else if (!strcasecmp(npi_string, "reserved")) { + *target = FTDM_NPI_RESERVED; + } else if (!strcasecmp(npi_string, "unknown")) { + *target = FTDM_NPI_UNKNOWN; + } else { + ftdm_log(FTDM_LOG_WARNING, "Invalid NPI value (%s)\n", npi_string); + *target = FTDM_NPI_UNKNOWN; + return FTDM_FAIL; + } + return FTDM_SUCCESS; +} + +FT_DECLARE(ftdm_status_t) ftdm_span_set_ton(const char *ton_string, uint8_t *target) +{ + if (!strcasecmp(ton_string, "national")) { + *target = FTDM_TON_NATIONAL; + } else if (!strcasecmp(ton_string, "international")) { + *target = FTDM_TON_INTERNATIONAL; + } else if (!strcasecmp(ton_string, "local")) { + *target = FTDM_TON_SUBSCRIBER_NUMBER; + } else if (!strcasecmp(ton_string, "unknown")) { + *target = FTDM_TON_UNKNOWN; + } else { + ftdm_log(FTDM_LOG_WARNING, "Invalid TON value (%s)\n", ton_string); + *target = FTDM_TON_UNKNOWN; + return FTDM_FAIL; + } + return FTDM_SUCCESS; +} + +FT_DECLARE(ftdm_status_t) ftdm_is_number(char *number) +{ + if (!number) { + return FTDM_FAIL; + } + + for ( ; *number; number++) { + if (!isdigit(*number)) { + return FTDM_FAIL; + } + } + return FTDM_SUCCESS; +} + diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 1872d4a..b47660b 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -33,20 +33,32 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + #include "ftmod_sangoma_isdn.h" +#define FTDM_DEBUG_CHAN_MEMORY + +#ifdef FTDM_DEBUG_CHAN_MEMORY +#include <sys/mman.h> +#endif static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj); -static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan); static ftdm_status_t ftdm_sangoma_isdn_stop(ftdm_span_t *span); static ftdm_status_t ftdm_sangoma_isdn_start(ftdm_span_t *span); +ftdm_channel_t* ftdm_sangoma_isdn_process_event_states(ftdm_span_t *span, sngisdn_event_data_t *sngisdn_event); +static void ftdm_sangoma_isdn_advance_chan_states(ftdm_channel_t *ftdmchan); + +static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan); +static void ftdm_sangoma_isdn_process_stack_event (ftdm_span_t *span, sngisdn_event_data_t *sngisdn_event); + static ftdm_io_interface_t g_sngisdn_io_interface; static sng_isdn_event_interface_t g_sngisdn_event_interface; ftdm_sngisdn_data_t g_sngisdn_data; extern ftdm_status_t sng_isdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t trace_opt); +extern ftdm_status_t sngisdn_check_free_ids(void); ftdm_state_map_t sangoma_isdn_state_map = { { @@ -66,7 +78,7 @@ ftdm_state_map_t sangoma_isdn_state_map = { ZSD_INBOUND, ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_CANCEL, FTDM_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_END} + {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_END} }, { ZSD_INBOUND, @@ -80,7 +92,13 @@ ftdm_state_map_t sangoma_isdn_state_map = { ZSD_INBOUND, ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_DOWN, FTDM_END}, - {FTDM_CHANNEL_STATE_COLLECT, FTDM_CHANNEL_STATE_IN_LOOP, FTDM_END} + {FTDM_CHANNEL_STATE_COLLECT, FTDM_CHANNEL_STATE_RING, FTDM_CHANNEL_STATE_GET_CALLERID, FTDM_CHANNEL_STATE_IN_LOOP, FTDM_END} + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_GET_CALLERID, FTDM_END}, + {FTDM_CHANNEL_STATE_RING, FTDM_CHANNEL_STATE_CANCEL, FTDM_CHANNEL_STATE_IN_LOOP, FTDM_END} }, { ZSD_INBOUND, @@ -135,8 +153,7 @@ ftdm_state_map_t sangoma_isdn_state_map = { ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_END}, {FTDM_CHANNEL_STATE_DOWN, FTDM_END}, - }, - /**************************************************************************/ + }, { ZSD_OUTBOUND, ZSM_UNACCEPTABLE, @@ -167,7 +184,7 @@ ftdm_state_map_t sangoma_isdn_state_map = { ZSD_OUTBOUND, ZSM_UNACCEPTABLE, {FTDM_CHANNEL_STATE_DOWN, FTDM_END}, - {FTDM_CHANNEL_STATE_DIALING, FTDM_END} + {FTDM_CHANNEL_STATE_DIALING, FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_END} }, { ZSD_OUTBOUND, @@ -214,11 +231,22 @@ ftdm_state_map_t sangoma_isdn_state_map = { } }; +static __inline__ void ftdm_sangoma_isdn_advance_chan_states(ftdm_channel_t *ftdmchan) +{ + while (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { + ftdm_sangoma_isdn_process_state_change(ftdmchan); + } +} + static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj) { - ftdm_interrupt_t *ftdm_sangoma_isdn_int = NULL; + ftdm_interrupt_t *ftdm_sangoma_isdn_int[2]; + ftdm_status_t ret_status; ftdm_span_t *span = (ftdm_span_t *) obj; ftdm_channel_t *ftdmchan = NULL; + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; + sngisdn_event_data_t *sngisdn_event = NULL; + int32_t sleep = SNGISDN_EVENT_POLL_RATE; ftdm_log(FTDM_LOG_INFO, "ftmod_sangoma_isdn monitor thread for span=%u started.\n", span->span_id); @@ -226,44 +254,55 @@ static void *ftdm_sangoma_isdn_run(ftdm_thread_t *me, void *obj) ftdm_set_flag(span, FTDM_SPAN_IN_THREAD); /* get an interrupt queue for this span */ - if (ftdm_queue_get_interrupt(span->pendingchans, &ftdm_sangoma_isdn_int) != FTDM_SUCCESS) { + if (ftdm_queue_get_interrupt(span->pendingchans, &ftdm_sangoma_isdn_int[0]) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_CRIT, "%s:Failed to get a ftdm_interrupt for span = %s!\n", span->name); goto ftdm_sangoma_isdn_run_exit; } - while (ftdm_running() && !(ftdm_test_flag(span, FTDM_SPAN_STOP_THREAD))) { + if (ftdm_queue_get_interrupt(signal_data->event_queue, &ftdm_sangoma_isdn_int[1]) != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_CRIT, "%s:Failed to get a event interrupt for span = %s!\n", span->name); + goto ftdm_sangoma_isdn_run_exit; + } + while (ftdm_running() && !(ftdm_test_flag(span, FTDM_SPAN_STOP_THREAD))) { /* find out why we returned from the interrupt queue */ - switch ((ftdm_interrupt_wait(ftdm_sangoma_isdn_int, 100))) { - case FTDM_SUCCESS: /* there was a state change on the span */ - /* process all pending state changes */ - while ((ftdmchan = ftdm_queue_dequeue(span->pendingchans))) { - /* double check that this channel has a state change pending */ - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { - ftdm_sangoma_isdn_process_state_change(ftdmchan); - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "reported state change but state change flag not set\n"); + ret_status = ftdm_interrupt_multiple_wait(ftdm_sangoma_isdn_int, 2, sleep); + /* Check if there are any timers to process */ + ftdm_sched_run(signal_data->sched); + switch (ret_status) { + case FTDM_SUCCESS: /* there was a state change on the span */ + /* process all pending state changes */ + while ((ftdmchan = ftdm_queue_dequeue(span->pendingchans))) { + /* double check that this channel has a state change pending */ + ftdm_channel_lock(ftdmchan); + ftdm_sangoma_isdn_advance_chan_states(ftdmchan); + ftdm_channel_unlock(ftdmchan); } - } - - break; - - case FTDM_TIMEOUT: - /* twiddle */ - break; - - case FTDM_FAIL: - ftdm_log(FTDM_LOG_ERROR,"ftdm_interrupt_wait returned error!\non span = %s\n", span->name); - break; - default: - ftdm_log(FTDM_LOG_ERROR,"ftdm_interrupt_wait returned with unknown code on span = %s\n", span->name); - break; + /* Check if there are any timers to process */ + while ((sngisdn_event = ftdm_queue_dequeue(signal_data->event_queue))) { + ftdm_sangoma_isdn_process_stack_event(span, sngisdn_event); + ftdm_safe_free(sngisdn_event); + } + break; + case FTDM_TIMEOUT: + /* twiddle */ + break; + case FTDM_FAIL: + ftdm_log(FTDM_LOG_ERROR,"ftdm_interrupt_wait returned error!\non span = %s\n", span->name); + break; + default: + ftdm_log(FTDM_LOG_ERROR,"ftdm_interrupt_wait returned with unknown code on span = %s\n", span->name); + break; + } + if (ftdm_sched_get_time_to_next_timer(signal_data->sched, &sleep) == FTDM_SUCCESS) { + if (sleep < 0 || sleep > SNGISDN_EVENT_POLL_RATE) { + sleep = SNGISDN_EVENT_POLL_RATE; + } } - } - + /* clear the IN_THREAD flag so that we know the thread is done */ ftdm_clear_flag(span, FTDM_SPAN_IN_THREAD); @@ -281,11 +320,117 @@ ftdm_sangoma_isdn_run_exit: return NULL; } -/******************************************************************************/ + +/** + * \brief Checks if span has state changes pending and processes + * \param span Span where event was fired + * \param sngisdn_event Event to handle + * \return The locked FTDM channel associated to the event if any, NULL otherwise + */ + +ftdm_channel_t* ftdm_sangoma_isdn_process_event_states(ftdm_span_t *span, sngisdn_event_data_t *sngisdn_event) +{ + ftdm_channel_t *ftdmchan = NULL; + switch (sngisdn_event->event_id) { + /* Events that do not have a channel associated to them */ + case SNGISDN_EVENT_SRV_IND: + case SNGISDN_EVENT_SRV_CFM: + case SNGISDN_EVENT_RST_CFM: + case SNGISDN_EVENT_RST_IND: + return NULL; + break; + case SNGISDN_EVENT_CON_IND: + case SNGISDN_EVENT_CON_CFM: + case SNGISDN_EVENT_CNST_IND: + case SNGISDN_EVENT_DISC_IND: + case SNGISDN_EVENT_REL_IND: + case SNGISDN_EVENT_DAT_IND: + case SNGISDN_EVENT_SSHL_IND: + case SNGISDN_EVENT_SSHL_CFM: + case SNGISDN_EVENT_RMRT_IND: + case SNGISDN_EVENT_RMRT_CFM: + case SNGISDN_EVENT_FLC_IND: + case SNGISDN_EVENT_FAC_IND: + case SNGISDN_EVENT_STA_CFM: + ftdmchan = sngisdn_event->sngisdn_info->ftdmchan; + ftdm_assert_return(ftdmchan, NULL,"Event should have a channel associated\n"); + break; + } + ftdm_channel_lock(ftdmchan); + ftdm_sangoma_isdn_advance_chan_states(ftdmchan); + return ftdmchan; +} + + + +static void ftdm_sangoma_isdn_process_stack_event (ftdm_span_t *span, sngisdn_event_data_t *sngisdn_event) +{ + ftdm_channel_t *ftdmchan = NULL; + + ftdmchan = ftdm_sangoma_isdn_process_event_states(span, sngisdn_event); + switch(sngisdn_event->event_id) { + case SNGISDN_EVENT_CON_IND: + sngisdn_process_con_ind(sngisdn_event); + break; + case SNGISDN_EVENT_CON_CFM: + sngisdn_process_con_cfm(sngisdn_event); + break; + case SNGISDN_EVENT_CNST_IND: + sngisdn_process_cnst_ind(sngisdn_event); + break; + case SNGISDN_EVENT_DISC_IND: + sngisdn_process_disc_ind(sngisdn_event); + break; + case SNGISDN_EVENT_REL_IND: + sngisdn_process_rel_ind(sngisdn_event); + break; + case SNGISDN_EVENT_DAT_IND: + sngisdn_process_dat_ind(sngisdn_event); + break; + case SNGISDN_EVENT_SSHL_IND: + sngisdn_process_sshl_ind(sngisdn_event); + break; + case SNGISDN_EVENT_SSHL_CFM: + sngisdn_process_sshl_cfm(sngisdn_event); + break; + case SNGISDN_EVENT_RMRT_IND: + sngisdn_process_rmrt_ind(sngisdn_event); + break; + case SNGISDN_EVENT_RMRT_CFM: + sngisdn_process_rmrt_cfm(sngisdn_event); + break; + case SNGISDN_EVENT_FLC_IND: + sngisdn_process_flc_ind(sngisdn_event); + break; + case SNGISDN_EVENT_FAC_IND: + sngisdn_process_fac_ind(sngisdn_event); + break; + case SNGISDN_EVENT_STA_CFM: + sngisdn_process_sta_cfm(sngisdn_event); + break; + case SNGISDN_EVENT_SRV_IND: + sngisdn_process_srv_ind(sngisdn_event); + break; + case SNGISDN_EVENT_SRV_CFM: + sngisdn_process_srv_cfm(sngisdn_event); + break; + case SNGISDN_EVENT_RST_CFM: + sngisdn_process_rst_cfm(sngisdn_event); + break; + case SNGISDN_EVENT_RST_IND: + sngisdn_process_rst_ind(sngisdn_event); + break; + } + if(ftdmchan != NULL) { + ftdm_sangoma_isdn_advance_chan_states(ftdmchan); + ftdm_channel_unlock(ftdmchan); + } +} + static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) { ftdm_sigmsg_t sigev; - ftdm_signaling_status_t status; + ftdm_channel_state_t initial_state; sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data; memset(&sigev, 0, sizeof(sigev)); @@ -295,29 +440,33 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) sigev.channel = ftdmchan; /*first lock the channel*/ - ftdm_mutex_lock(ftdmchan->mutex); - + ftdm_channel_lock(ftdmchan); /*clear the state change flag...since we might be setting a new state*/ ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE); +#ifdef FTDM_DEBUG_CHAN_MEMORY + if (ftdmchan->state == FTDM_CHANNEL_STATE_DIALING) { + ftdm_assert(mprotect(ftdmchan, sizeof(*ftdmchan), PROT_READ)==0, "Failed to mprotect"); + } +#endif + + /* Only needed for debugging */ + initial_state = ftdmchan->state; ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "processing state change to %s\n", ftdm_channel_state2str(ftdmchan->state)); switch (ftdmchan->state) { - - case FTDM_CHANNEL_STATE_COLLECT: /* SETUP received but wating on digits */ + case FTDM_CHANNEL_STATE_COLLECT: /* SETUP received but waiting on digits */ { - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "re-entering state from processing block/unblock request - do nothing\n"); - break; - } - - /* TODO: Overlap receive not implemented yet - cannot do it the same way as PRI requires sending complete bit */ - - /* Go straight to ring state for now */ - - /*now go to the RING state*/ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RING); + /* TODO: Re-implement this. There is a way to re-evaluate new incoming digits from dialplan as they come */ + sngisdn_snd_setup_ack(ftdmchan); + /* Just wait in this state until we get enough digits or T302 timeout */ + } + break; + case FTDM_CHANNEL_STATE_GET_CALLERID: + { + sngisdn_set_flag(sngisdn_info, FLAG_SENT_PROCEED); + sngisdn_snd_proceed(ftdmchan); + /* Wait in this state until we get FACILITY msg */ } break; case FTDM_CHANNEL_STATE_RING: /* incoming call request */ @@ -329,34 +478,24 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) ftdm_span_send_signal(ftdmchan->span, &sigev); } break; - case FTDM_CHANNEL_STATE_DIALING: /* outgoing call request */ { - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "re-entering state from processing block/unblock request ... do nothing \n"); - break; - } sngisdn_snd_setup(ftdmchan); } break; case FTDM_CHANNEL_STATE_PROGRESS: { - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "re-entering state from processing block/unblock request ... do nothing \n"); - break; - } - /*check if the channel is inbound or outbound*/ if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { /*OUTBOUND...so we were told by the line of this so noifiy the user*/ sigev.event_id = FTDM_SIGEVENT_PROGRESS; ftdm_span_send_signal(ftdmchan->span, &sigev); - } else { + } else if (!sngisdn_test_flag(sngisdn_info, FLAG_SENT_PROCEED)) { + sngisdn_set_flag(sngisdn_info, FLAG_SENT_PROCEED); sngisdn_snd_proceed(ftdmchan); } } break; - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: { if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { @@ -367,86 +506,72 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) } } break; - case FTDM_CHANNEL_STATE_UP: /* call is answered */ { - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "re-entering state from processing block/unblock request ... do nothing \n"); - break; - } - + /* check if the channel is inbound or outbound */ if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + /* OUTBOUND ... so we were told by the line that the other side answered */ + sigev.event_id = FTDM_SIGEVENT_UP; + ftdm_span_send_signal(ftdmchan->span, &sigev); + if (ftdmchan->span->trunk_type == FTDM_TRUNK_BRI_PTMP && ((sngisdn_span_data_t*)ftdmchan->span->signal_data)->signalling == SNGISDN_SIGNALING_NET) { /* Assign the call to a specific equipment */ sngisdn_snd_con_complete(ftdmchan); } - } - - /* check if the channel is inbound or outbound */ - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - /* OUTBOUND ... so we were told by the line that the other side answered */ - sigev.event_id = FTDM_SIGEVENT_UP; - ftdm_span_send_signal(ftdmchan->span, &sigev); } else { /* INBOUND ... so FS told us it just answered ... tell the stack */ sngisdn_snd_connect(ftdmchan); } } break; - case FTDM_CHANNEL_STATE_CANCEL: { - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "re-entering state from processing block/unblock request ... do nothing \n"); - break; - } - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Hanging up call before informing user!\n"); /* Send a release complete */ - sngisdn_snd_release(ftdmchan); + sngisdn_snd_release(ftdmchan, 0); /*now go to the HANGUP complete state*/ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); } break; - case FTDM_CHANNEL_STATE_TERMINATING: /* call is hung up by the remote end */ { - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "re-entering state from processing block/unblock request ... do nothing \n"); - break; - } - /* this state is set when the line is hanging up */ sigev.event_id = FTDM_SIGEVENT_STOP; ftdm_span_send_signal(ftdmchan->span, &sigev); } break; - case FTDM_CHANNEL_STATE_HANGUP: /* call is hung up locally */ { - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "re-entering state from processing block/unblock request ... do nothing \n"); - break; - } - - if (ftdm_test_flag(sngisdn_info, FLAG_REMOTE_REL)) { + if (sngisdn_test_flag(sngisdn_info, FLAG_REMOTE_ABORT)) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Acknowledging remote abort\n"); + } else if (sngisdn_test_flag(sngisdn_info, FLAG_REMOTE_REL)) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Acknowledging remote hangup\n"); - sngisdn_snd_release(ftdmchan); - } else if (ftdm_test_flag(sngisdn_info, FLAG_REMOTE_ABORT)) { - /* Do not send any messages to remote switch as they aborted */ - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Clearing local states from remote abort\n"); + sngisdn_snd_release(ftdmchan, 0); + } else if (sngisdn_test_flag(sngisdn_info, FLAG_LOCAL_ABORT)) { + /* We aborted this call before sending anything to the stack, so nothing to do anymore */ + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Clearing local states from local abort\n"); + } else if (sngisdn_test_flag(sngisdn_info, FLAG_GLARE)) { + /* We are hangup local call because there was a glare, we are waiting for a + RELEASE on this call, before we can process the saved call */ + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Waiting for RELEASE on hungup glared call\n"); } else { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Hanging up call upon local request!\n"); /* set the flag to indicate this hangup is started from the local side */ - ftdm_set_flag(sngisdn_info, FLAG_LOCAL_REL); + sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_REL); /* If we never sent ack to incoming call, we need to send release instead of disconnect */ - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_RING) { - ftdm_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); - sngisdn_snd_release(ftdmchan); + if (ftdmchan->last_state == FTDM_CHANNEL_STATE_RING || + ftdmchan->last_state == FTDM_CHANNEL_STATE_DIALING) { + + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) { + sng_isdn_set_avail_rate(ftdmchan->span, SNGISDN_AVAIL_DOWN); + } + + sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); + sngisdn_snd_release(ftdmchan, 0); } else { sngisdn_snd_disconnect(ftdmchan); } @@ -454,361 +579,114 @@ static void ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdmchan) } /* now go to the HANGUP complete state */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); } break; - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: { - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "re-entering state from processing block/unblock request ... do nothing \n"); - break; - } - - if (ftdm_test_flag(sngisdn_info, FLAG_REMOTE_REL)) { - if (sngisdn_test_flag(sngisdn_info, FLAG_RESET_TX)) { - /* go to RESTART State until RSCa is received */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - } - /* Do nothing as we will receive a RELEASE COMPLETE from remote switch */ - } else if (ftdm_test_flag(sngisdn_info, FLAG_REMOTE_ABORT) || - ftdm_test_flag(sngisdn_info, FLAG_LOCAL_ABORT)) { + if (sngisdn_test_flag(sngisdn_info, FLAG_REMOTE_ABORT) || + sngisdn_test_flag(sngisdn_info, FLAG_LOCAL_ABORT)) { /* If the remote side aborted, we will not get anymore message for this call */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); } else { - /* twiddle, waiting on remote confirmation before moving to down */ - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Completing locally requested hangup\n"); + /* waiting on remote confirmation before moving to down */ + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Waiting for release from stack\n"); } } break; - case FTDM_CHANNEL_STATE_DOWN: /* the call is finished and removed */ { - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "re-entering state from processing block/unblock request ... do nothing \n"); - break; - } - - /* check if there is a reset response that needs to be sent */ - if (sngisdn_test_flag(sngisdn_info, FLAG_RESET_RX)) { - /* send a RLC */ - sngisdn_snd_release(ftdmchan); - - /* inform Ftdm that the "sig" is up now for this channel */ - status = FTDM_SIG_STATE_UP; - sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.raw_data = &status; - ftdm_span_send_signal(ftdmchan->span, &sigev); - } + uint8_t glare = 0; - /* check if we got the reset response */ - if (sngisdn_test_flag(sngisdn_info, FLAG_RESET_TX)) { - /* inform Ftdm that the "sig" is up now for this channel */ - status = FTDM_SIG_STATE_UP; - sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.raw_data = &status; - ftdm_span_send_signal(ftdmchan->span, &sigev); - } - - /* check if the circuit has the glare flag up */ - if (sngisdn_test_flag(sngisdn_info, FLAG_GLARE)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Glare flag is up....spoofing incoming call\n"); - /* clear all the call specific data */ - clear_call_data(sngisdn_info); + glare = sngisdn_test_flag(sngisdn_info, FLAG_GLARE); + /* clear all of the call specific data store in the channel structure */ + clear_call_data(sngisdn_info); + /* Close the channel even if we had a glare, we will re-open it when processing state COLLECT for the + "glared call" */ + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) { + ftdm_channel_t *close_chan = ftdmchan; /* close the channel */ - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) { - ftdm_channel_t *close_chan = ftdmchan; - /* close the channel */ - ftdm_channel_close(&close_chan); - } - - /* spoof an incoming call */ - sngisdn_rcv_con_ind(sngisdn_info->glare.suId, - sngisdn_info->glare.suInstId, - sngisdn_info->glare.spInstId, - &sngisdn_info->glare.setup, - sngisdn_info->glare.dChan, - sngisdn_info->glare.ces); - - } else { - /* clear all of the call specific data store in the channel structure */ - clear_call_data(sngisdn_info); - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) { - ftdm_channel_t *close_chan = ftdmchan; - /* close the channel */ - ftdm_channel_close(&close_chan); - } + ftdm_channel_close(&close_chan); + } + if (glare) { + + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Glare detected, processing saved call\n"); + /* We are calling sngisdn_rcv_con_ind with ftdmchan->mutex being locked, + so no other threads will be able to touch this channel. The next time we will + process this channel is in this function, and it should be in state COLLECT (set inside + sngisdn_rcv_con_ind)*/ + sngisdn_rcv_con_ind(sngisdn_info->glare.suId, sngisdn_info->glare.suInstId, sngisdn_info->glare.spInstId, &sngisdn_info->glare.setup, sngisdn_info->glare.dChan, sngisdn_info->glare.ces); } } break; case FTDM_CHANNEL_STATE_RESTART: { -#if 0 - /* TODO: Go through channel restart call states. They do not make sense when running ISDN */ - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)) { - /* bring the call down first...then process the rest of the reset */ - switch (ftdmchan->last_state) { - /******************************************************************/ - case(FTDM_CHANNEL_STATE_TERMINATING): - case(FTDM_CHANNEL_STATE_HANGUP): - case(FTDM_CHANNEL_STATE_HANGUP_COMPLETE): - /* go back to the last state after taking care of the rest of the restart state */ - ftdm_set_state_locked(ftdmchan, ftdmchan->last_state); - break; - /******************************************************************/ - default: - /* KONRAD: find out what the cause code should be */ - ftdmchan->caller_data.hangup_cause = 41; - - /* change the state to terminatting, it will throw us back here - * once the call is done - */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - break; - /******************************************************************/ - } - } else { - - /* check if this an incoming RSC */ - if (sngisdn_test_flag(sngisdn_info, FLAG_RESET_RX)) { - /* go to a down state to clear the channel and send RSCa */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } /* if (sngisdn_test_flag(sngisdn_info, FLAG_RESET_RX)) */ - } /* if (inuse) */ - - /* check if this is an outgoing RSC */ - if (sngisdn_test_flag(sngisdn_info, FLAG_RESET_TX)) { - - /* make sure we aren't coming from hanging up a call */ - if (ftdmchan->last_state != FTDM_CHANNEL_STATE_HANGUP_COMPLETE) { - /* send a reset request */ - sngisdn_snd_reset(ftdmchan); - } - - /* don't change to the DOWN state as we need to wait for the RSCa */ - } /* if (sngisdn_test_flag(sngisdn_info, FLAG_RESET_TX)) */ - - /* send a sig event to the core to disable the channel */ - status = FTDM_SIG_STATE_DOWN; - sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.raw_data = &status; - ftdm_span_send_signal(ftdmchan->span, &sigev); -#endif + /* IMPLEMENT ME */ } break; case FTDM_CHANNEL_STATE_SUSPENDED: { - if (sngisdn_test_flag(sngisdn_info, FLAG_INFID_PAUSED)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "processing PAUSE\n"); - /* bring the channel signaling status to down */ - status = FTDM_SIG_STATE_DOWN; - sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.raw_data = &status; - ftdm_span_send_signal(ftdmchan->span, &sigev); - - /* check the last state and return to it to allow the call to finish */ - ftdm_set_state_locked(ftdmchan, ftdmchan->last_state); - } - if (sngisdn_test_flag(sngisdn_info, FLAG_INFID_RESUME)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "processing RESUME\n"); - - /* we just resumed...throw the channel into reset */ - sngisdn_set_flag(sngisdn_info, FLAG_RESET_TX); - - /* clear the resume flag */ - sngisdn_clear_flag(sngisdn_info, FLAG_INFID_RESUME); - - /* go to restart state */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - } - -#if 0 - /* CHECK the equivalent for ISDN */ - if (sngisdn_test_flag(sngisdn_info, FLAG_CKT_MN_BLOCK_RX)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "processing MN_BLOCK_RX\n"); - - /* bring the channel signaling status to down */ - status = FTDM_SIG_STATE_DOWN; - sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.raw_data = &status; - ftdm_span_send_signal(ftdmchan->span, &sigev); - - /* send a BLA */ - - ft_to_sngss7_bla(ftdmchan); - - /* check the last state and return to it to allow the call to finish */ - ftdm_set_state_locked(ftdmchan, ftdmchan->last_state); - } - if (sngisdn_test_flag(sngisdn_info, FLAG_CKT_MN_UNBLK_RX)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "processing MN_UNBLK_RX\n"); - /* bring the channel signaling status to up */ - status = FTDM_SIG_STATE_UP; - sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.raw_data = &status; - ftdm_span_send_signal(ftdmchan->span, &sigev); - - /* clear the unblock flag */ - sngisdn_clear_flag(sngisdn_info, FLAG_CKT_MN_UNBLK_RX); - - /* send a uba */ - ft_to_sngss7_uba(ftdmchan); - - /* check the last state and return to it to allow the call to finish */ - ftdm_set_state_locked(ftdmchan, ftdmchan->last_state); - } - /**********************************************************************/ - if (sngisdn_test_flag(sngisdn_info, FLAG_CKT_MN_BLOCK_TX)) { - ftdm_log_chan_msg(ftdm_chan, FTDM_LOG_DEBUG, "processing MN_BLOCK_TX\n"); - /* bring the channel signaling status to down */ - status = FTDM_SIG_STATE_DOWN; - sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.raw_data = &status; - ftdm_span_send_signal(ftdmchan->span, &sigev); - - /* send a blo */ - ft_to_sngss7_blo(ftdmchan); - - /* check the last state and return to it to allow the call to finish */ - ftdm_set_state_locked(ftdmchan, ftdmchan->last_state); - } - if (sngisdn_test_flag(sngisdn_info, FLAG_CKT_MN_UNBLK_TX)) { - ftdm_log_chan_msg(ftdm_chan, FTDM_LOG_DEBUG, "processing MN_UNBLOCK_TX\n"); - /* bring the channel signaling status to up */ - status = FTDM_SIG_STATE_UP; - sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.raw_data = &status; - ftdm_span_send_signal(ftdmchan->span, &sigev); - - /* clear the unblock flag */ - sngisdn_clear_flag(sngisdn_info, FLAG_CKT_MN_UNBLK_TX); - - /* send a ubl */ - ft_to_sngss7_ubl(ftdmchan); - - /* check the last state and return to it to allow the call to finish */ - ftdm_set_state_locked(ftdmchan, ftdmchan->last_state); - } -#endif + /* IMPLEMENT ME */ } break; default: { - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "unsngisdn_rcvd state %s\n", ftdm_channel_state2str(ftdmchan->state)); + ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "unsupported sngisdn_rcvd state %s\n", ftdm_channel_state2str(ftdmchan->state)); } break; - } - - ftdm_mutex_unlock(ftdmchan->mutex); + + if (ftdmchan->state == initial_state) { + ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "state change flag is still set, but we did not change state\n"); + } +#ifdef FTDM_DEBUG_CHAN_MEMORY + if (ftdmchan->state == FTDM_CHANNEL_STATE_DIALING) { + ftdm_assert(mprotect(ftdmchan, sizeof(*ftdmchan), PROT_READ|PROT_WRITE)==0, "Failed to mprotect"); + } +#endif + ftdm_channel_unlock(ftdmchan); return; } static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(ftdm_sangoma_isdn_outgoing_call) { - sngisdn_chan_data_t *sngisdn_info; - int c; - + sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data; + ftdm_status_t status = FTDM_FAIL; + /* lock the channel while we check whether it is availble */ - ftdm_mutex_lock(ftdmchan->mutex); + ftdm_channel_lock(ftdmchan); switch (ftdmchan->state) { - case FTDM_CHANNEL_STATE_DOWN: - { - ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DIALING); - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - - /* now we have to wait for either the stack to reject the call because of - * glare or for the network to acknowledge the call */ - c = 0; + case FTDM_CHANNEL_STATE_DOWN: + { + if (sngisdn_test_flag(sngisdn_info, FLAG_GLARE)) { + /* A call came in after we called ftdm_channel_open_chan for this call, but before we got here */ + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Glare detected - aborting outgoing call\n"); - while (c < 100) { - - /* lock the channel while we check whether it is availble */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* extract the sngisdn_chan_data structure */ - sngisdn_info = (sngisdn_chan_data_t *)ftdmchan->call_data; - - if (ftdm_test_flag(sngisdn_info, FLAG_GLARE)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Glare detected\n"); - goto outgoing_glare; - } + sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); - switch (ftdmchan->state) { - case FTDM_CHANNEL_STATE_DIALING: - break; - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - case FTDM_CHANNEL_STATE_UP: - { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Outgoing call request successful\n"); - goto outgoing_successful; - } - break; - case FTDM_CHANNEL_STATE_TERMINATING: - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - case FTDM_CHANNEL_STATE_DOWN: - { - /* Remote switch aborted this call */ - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Outgoing call request failed\n"); - goto outgoing_successful; - } - break; - default: - { - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Channel in invalid state (%s)\n", ftdm_channel_state2str(ftdmchan->state)); - goto outgoing_glare; - } - break; + status = FTDM_BREAK; + } else { + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DIALING); + status = FTDM_SUCCESS; } - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - - /* sleep for a bit to let the state change */ - ftdm_sleep(10); - - /* increment the timeout counter */ - c++; } - - /* only way we can get here is if we are still in STATE_DIALING. We did not get a glare, so exit thread and wait for PROCEED/PROGRESS/ALERT/CONNECT or RELEASE from remote switch */ - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Timeout waiting for outgoing call to be accepted by network, returning success anyways\n"); - - /* consider the call good .... for now */ - goto outgoing_successful; - } - break; - - default: + break; + default: { /* the channel is already used...this can't be, end the request */ ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Outgoing call requested channel in already in use\n"); - goto outgoing_glare; + status = FTDM_BREAK; } break; } - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "WE SHOULD NOT BE HERE!!!!\n"); - - ftdm_mutex_unlock(ftdmchan->mutex); - return FTDM_FAIL; - -outgoing_glare: - ftdm_mutex_unlock(ftdmchan->mutex); - return FTDM_BREAK; - -outgoing_successful: - ftdm_mutex_unlock(ftdmchan->mutex); - return FTDM_SUCCESS; + ftdm_channel_unlock(ftdmchan); + return status; } static FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(ftdm_sangoma_isdn_get_sig_status) @@ -863,8 +741,8 @@ static ftdm_status_t ftdm_sangoma_isdn_stop(ftdm_span_t *span) ftdm_sleep(10); } - /* FIXME: deconfigure any circuits, links, attached to this span */ - /* TODO: confirm with Moy whether we should start channels at 1 or 0 */ + /* FIXME: deconfigure any links, attached to this span */ + /* TODO: Use Moy's channel Iterator when its implemented */ for (i=1;i<=span->chan_count;i++) { ftdm_safe_free(span->channels[i]->call_data); } @@ -906,9 +784,6 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_isdn_span_config) span->start = ftdm_sangoma_isdn_start; span->stop = ftdm_sangoma_isdn_stop; span->signal_type = FTDM_SIGTYPE_ISDN; -#if 0 - span->signal_data = NULL; -#endif span->outgoing_call = ftdm_sangoma_isdn_outgoing_call; span->channel_request = NULL; span->signal_cb = sig_cb; @@ -917,6 +792,19 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_isdn_span_config) span->state_map = &sangoma_isdn_state_map; ftdm_set_flag(span, FTDM_SPAN_USE_CHAN_QUEUE); + if (span->trunk_type == FTDM_TRUNK_BRI_PTMP || + span->trunk_type == FTDM_TRUNK_BRI) { + + ftdm_set_flag(span, FTDM_SPAN_USE_AV_RATE); + sng_isdn_set_avail_rate(span, SNGISDN_AVAIL_PWR_SAVING); + } + + /* Initialize scheduling context */ + ftdm_assert(ftdm_sched_create(&((sngisdn_span_data_t*)span->signal_data)->sched, "sngisdn_schedule") == FTDM_SUCCESS, "Failed to create a new schedule!!"); + + /* Initialize the event queue */ + ftdm_assert(ftdm_queue_create(&((sngisdn_span_data_t*)span->signal_data)->event_queue, SNGISDN_EVENT_QUEUE_SIZE) == FTDM_SUCCESS, "Failed to create a new queue!!"); + ftdm_log(FTDM_LOG_INFO, "Finished configuring ftmod_sangoma_isdn span = %s\n", span->name); return FTDM_SUCCESS; } @@ -948,22 +836,22 @@ static FIO_SIG_LOAD_FUNCTION(ftdm_sangoma_isdn_init) g_sngisdn_event_interface.cc.sng_rst_ind = sngisdn_rcv_rst_ind; g_sngisdn_event_interface.cc.sng_rst_cfm = sngisdn_rcv_rst_cfm; - g_sngisdn_event_interface.lg.sng_log = sngisdn_rcv_sng_log; + g_sngisdn_event_interface.lg.sng_log = sngisdn_rcv_sng_log; + g_sngisdn_event_interface.lg.sng_assert = sngisdn_rcv_sng_assert; + g_sngisdn_event_interface.sta.sng_phy_sta_ind = sngisdn_rcv_phy_ind; g_sngisdn_event_interface.sta.sng_q921_sta_ind = sngisdn_rcv_q921_ind; g_sngisdn_event_interface.sta.sng_q921_trc_ind = sngisdn_rcv_q921_trace; g_sngisdn_event_interface.sta.sng_q931_sta_ind = sngisdn_rcv_q931_ind; g_sngisdn_event_interface.sta.sng_q931_trc_ind = sngisdn_rcv_q931_trace; - g_sngisdn_event_interface.sta.sng_cc_sta_ind = sngisdn_rcv_cc_ind; + g_sngisdn_event_interface.sta.sng_cc_sta_ind = sngisdn_rcv_cc_ind; for(i=1;i<=MAX_VARIANTS;i++) { - ftdm_mutex_create(&g_sngisdn_data.ccs[i].request_mutex); + ftdm_mutex_create(&g_sngisdn_data.ccs[i].mutex); } + /* initalize sng_isdn library */ sng_isdn_init(&g_sngisdn_event_interface); - - /* crash on assert fail */ - ftdm_global_set_crash_policy(FTDM_CRASH_ON_ASSERT); return FTDM_SUCCESS; } @@ -975,7 +863,7 @@ static FIO_SIG_UNLOAD_FUNCTION(ftdm_sangoma_isdn_unload) sng_isdn_free(); for(i=1;i<=MAX_VARIANTS;i++) { - ftdm_mutex_destroy(&g_sngisdn_data.ccs[i].request_mutex); + ftdm_mutex_destroy(&g_sngisdn_data.ccs[i].mutex); } ftdm_log(FTDM_LOG_INFO, "Finished ftmod_sangoma_isdn unload!\n"); @@ -1026,6 +914,23 @@ static FIO_API_FUNCTION(ftdm_sangoma_isdn_api) stream->write_function(stream, "-ERR invalid trace option <q921|q931> <span name>\n"); } } + if (!strcasecmp(argv[0], "l1_stats")) { + ftdm_span_t *span; + if (argc < 2) { + ftdm_log(FTDM_LOG_ERROR, "Usage: ftdm sangoma_isdn l1_stats <span name>\n"); + status = FTDM_FAIL; + goto done; + } + status = ftdm_span_find_by_name(argv[1], &span); + if (FTDM_SUCCESS != status) { + stream->write_function(stream, "-ERR failed to find span by name %s\n", argv[2]); + goto done; + } + /* TODO: implement PHY stats */ + } + if (!strcasecmp(argv[0], "check_ids")) { + sngisdn_check_free_ids(); + } done: ftdm_safe_free(mycmd); return status; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index d3877de..932db0e 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -46,22 +46,87 @@ #include <sng_isdn.h> -#define MAX_SPANS_PER_NFAS_LINK 8 /* TODO: Confirm this value */ -#define NUM_E1_CHANNELS_PER_SPAN 32 -#define NUM_T1_CHANNELS_PER_SPAN 24 -#define NUM_BRI_CHANNELS_PER_SPAN 2 - -/* Should never have DEBUG_MODE defined when used in production */ -#if 0 -#undef DEBUG_MODE -#define FORCE_SEFGAULT -#else -#define DEBUG_MODE -#define FORCE_SEGFAULT *(int *) 0 = 0; -#endif +/* Theoretical limit for MAX_SPANS_PER_NFAS_LINK is 31, + but set to 8 for now to save some memor */ + +#define MAX_SPANS_PER_NFAS_LINK 8 +#define NUM_E1_CHANNELS_PER_SPAN 32 +#define NUM_T1_CHANNELS_PER_SPAN 24 +#define NUM_BRI_CHANNELS_PER_SPAN 2 +#define SNGISDN_EVENT_QUEUE_SIZE 100 +#define SNGISDN_EVENT_POLL_RATE 100 /* TODO: rename all *_cc_* to *_an_* */ +typedef enum { + FLAG_RESET_RX = (1 << 0), + FLAG_RESET_TX = (1 << 1), + FLAG_REMOTE_REL = (1 << 2), + FLAG_LOCAL_REL = (1 << 3), + FLAG_REMOTE_ABORT = (1 << 4), + FLAG_LOCAL_ABORT = (1 << 5), + FLAG_GLARE = (1 << 6), + FLAG_DELAYED_REL = (1 << 7), + FLAG_SENT_PROCEED = (1 << 8), +} sngisdn_flag_t; + + +typedef enum { + SNGISDN_SWITCH_INVALID = 0, /* invalid */ + SNGISDN_SWITCH_NI2 , /* national isdn-2 */ + SNGISDN_SWITCH_5ESS, /* att 5ess */ + SNGISDN_SWITCH_4ESS, /* att 4ess */ + SNGISDN_SWITCH_DMS100, /* nt dms100 */ + SNGISDN_SWITCH_EUROISDN,/* etsi */ + SNGISDN_SWITCH_QSIG, /* etsi qsig */ + SNGISDN_SWITCH_INSNET, /* int - net */ +} sngisdn_switchtype_t; + +typedef enum { + SNGISDN_SIGNALING_INVALID = 0, /* invalid */ + SNGISDN_SIGNALING_CPE , /* customer side emulation */ + SNGISDN_SIGNALING_NET, /* network side emulation */ +} sngisdn_signalingtype_t; + +typedef enum { + SNGISDN_TRACE_DISABLE = 0, + SNGISDN_TRACE_Q921 = 1, + SNGISDN_TRACE_Q931 = 2, +} sngisdn_tracetype_t; + +typedef enum { + SNGISDN_OPT_DEFAULT = 0, + SNGISDN_OPT_TRUE = 1, + SNGISDN_OPT_FALSE = 2, +} sngisdn_opt_t; + + +typedef enum { + SNGISDN_AVAIL_DOWN = 1, + SNGISDN_AVAIL_PWR_SAVING = 5, + SNGISDN_AVAIL_UP = 10, +} sngisdn_avail_t; + +typedef enum { + SNGISDN_EVENT_CON_IND = 1, + SNGISDN_EVENT_CON_CFM, + SNGISDN_EVENT_CNST_IND, + SNGISDN_EVENT_DISC_IND, + SNGISDN_EVENT_REL_IND, + SNGISDN_EVENT_DAT_IND, + SNGISDN_EVENT_SSHL_IND, + SNGISDN_EVENT_SSHL_CFM, + SNGISDN_EVENT_RMRT_IND, + SNGISDN_EVENT_RMRT_CFM, + SNGISDN_EVENT_FLC_IND, + SNGISDN_EVENT_FAC_IND, + SNGISDN_EVENT_STA_CFM, + SNGISDN_EVENT_SRV_IND, + SNGISDN_EVENT_SRV_CFM, + SNGISDN_EVENT_RST_CFM, + SNGISDN_EVENT_RST_IND, +} ftdm_sngisdn_event_id_t; + typedef struct sngisdn_glare_data { int16_t suId; uint32_t suInstId; @@ -76,7 +141,7 @@ typedef struct sngisdn_glare_data { typedef struct sngisdn_chan_data { ftdm_channel_t *ftdmchan; uint32_t flags; - uint8_t ces; /* not used for now */ + uint8_t ces; /* used only for BRI, otherwise always 0 */ uint8_t dchan_id; uint32_t suInstId; /* instance ID generated locally */ uint32_t spInstId; /* instance ID generated by stack */ @@ -88,17 +153,54 @@ typedef struct sngisdn_chan_data { /* Span specific data */ typedef struct sngisdn_span_data { ftdm_span_t *ftdm_span; - uint8_t link_id; - uint8_t switchtype; - uint8_t signalling; /* SNGISDN_SIGNALING_CPE or SNGISDN_SIGNALING_NET */ - uint8_t cc_id; - uint8_t dchan_id; - uint8_t span_id; - uint8_t tei; - uint8_t keep_link_up; - uint8_t trace_flags; + uint8_t link_id; + uint8_t switchtype; + uint8_t signalling; /* SNGISDN_SIGNALING_CPE or SNGISDN_SIGNALING_NET */ + uint8_t cc_id; + uint8_t dchan_id; + uint8_t span_id; + uint8_t tei; + uint8_t min_digits; + uint8_t trace_flags; /* TODO: change to flags, so we can use ftdm_test_flag etc.. */ + uint8_t overlap_dial; + uint8_t setup_arb; + uint8_t facility; + ftdm_sched_t *sched; + ftdm_queue_t *event_queue; } sngisdn_span_data_t; +typedef struct sngisdn_event_data { + + int16_t suId; + int16_t dChan; + uint32_t suInstId; + uint32_t spInstId; + uint8_t ces; + uint8_t action; + uint8_t evntType; + + sngisdn_chan_data_t *sngisdn_info; + sngisdn_span_data_t *signal_data; + + ftdm_sngisdn_event_id_t event_id; + + union + { + ConEvnt conEvnt; + CnStEvnt cnStEvnt; + DiscEvnt discEvnt; + RelEvnt relEvnt; + InfoEvnt infoEvnt; + SsHlEvnt ssHlEvnt; + RmRtEvnt rmRtEvnt; + StaEvnt staEvnt; + FacEvnt facEvnt; + Srv srvEvnt; + Rst rstEvnt; + }event; + +} sngisdn_event_data_t; + /* dchan_data can have more than 1 span when running NFAS */ typedef struct sngisdn_dchan_data { uint8_t num_spans; @@ -119,8 +221,8 @@ typedef struct sngisdn_cc { uint8_t activation_done; uint8_t switchtype; ftdm_trunk_type_t trunktype; - uint32_t last_suInstId; - ftdm_mutex_t *request_mutex; + uint32_t last_suInstId; + ftdm_mutex_t *mutex; sngisdn_chan_data_t *active_spInstIds[MAX_INSTID]; sngisdn_chan_data_t *active_suInstIds[MAX_INSTID]; }sngisdn_cc_t; @@ -131,113 +233,83 @@ typedef struct ftdm_sngisdn_data { uint8_t num_cc; /* 1 ent per switchtype */ struct sngisdn_cc ccs[MAX_VARIANTS+1]; uint8_t num_dchan; - sngisdn_dchan_data_t dchans[MAX_L1_LINKS+1]; + sngisdn_dchan_data_t dchans[MAX_L1_LINKS+1]; }ftdm_sngisdn_data_t; -typedef enum { - FLAG_RESET_RX = (1 << 0), - FLAG_RESET_TX = (1 << 1), - FLAG_REMOTE_REL = (1 << 2), - FLAG_LOCAL_REL = (1 << 3), - FLAG_REMOTE_ABORT = (1 << 4), - FLAG_LOCAL_ABORT = (1 << 4), - FLAG_GLARE = (1 << 5), - FLAG_INFID_RESUME = (1 << 17), - FLAG_INFID_PAUSED = (1 << 18), - FLAG_CKT_MN_BLOCK_RX = (1 << 19), - FLAG_CKT_MN_BLOCK_TX = (1 << 20), - FLAG_CKT_MN_UNBLK_RX = (1 << 21), - FLAG_CKT_MN_UNBLK_TX = (1 << 22), - FLAG_GRP_HW_BLOCK_RX = (1 << 23), - FLAG_GRP_HW_BLOCK_TX = (1 << 24), - FLAG_GRP_MN_BLOCK_RX = (1 << 25), - FLAG_GRP_MN_BLOCK_TX = (1 << 28), - FLAG_GRP_HW_UNBLK_RX = (1 << 27), - FLAG_GRP_HW_UNBLK_TX = (1 << 28), - FLAG_GRP_MN_UNBLK_RX = (1 << 29), - FLAG_GRP_MN_UNBLK_TX = (1 << 30) -} sngisdn_flag_t; - - -typedef enum { - SNGISDN_SWITCH_INVALID = 0, /* invalid */ - SNGISDN_SWITCH_NI2 , /* national isdn-2 */ - SNGISDN_SWITCH_5ESS, /* att 5ess */ - SNGISDN_SWITCH_4ESS, /* att 4ess */ - SNGISDN_SWITCH_DMS100, /* nt dms100 */ - SNGISDN_SWITCH_EUROISDN,/* etsi */ - SNGISDN_SWITCH_QSIG, /* etsi qsig */ - SNGISDN_SWITCH_INSNET, /* int - net */ -} sngisdn_switchtype_t; - -typedef enum { - SNGISDN_SIGNALING_INVALID = 0, /* invalid */ - SNGISDN_SIGNALING_CPE , /* customer side emulation */ - SNGISDN_SIGNALING_NET, /* network side emulation */ -} sngisdn_signalingtype_t; - -typedef enum { - SNGISDN_TRACE_DISABLE = 0, - SNGISDN_TRACE_Q921 = 1, - SNGISDN_TRACE_Q931 = 2, -} sngisdn_tracetype_t; - - -#define sngisdn_set_flag(obj, flag) ((obj)->flags |= (flag)) -#define sngisdn_clear_flag(obj, flag) ((obj)->flags &= ~(flag)) -#define sngisdn_test_flag(obj, flag) ((obj)->flags & flag) - -#define sngisdn_set_trace_flag(obj, flag) ((obj)->trace_flags |= (flag)) -#define sngisdn_clear_trace_flag(obj, flag) ((obj)->trace_flags &= ~(flag)) -#define sngisdn_test_trace_flag(obj, flag) ((obj)->trace_flags & flag) /* TODO implement these 2 functions */ #define ISDN_FUNC_TRACE_ENTER(a) #define ISDN_FUNC_TRACE_EXIT(a) +/* Global Structs */ +extern ftdm_sngisdn_data_t g_sngisdn_data; + /* Configuration functions */ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *span); /* Support functions */ uint32_t get_unique_suInstId(uint8_t cc_id); void clear_call_data(sngisdn_chan_data_t *sngisdn_info); +void clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info); + + void stack_hdr_init(Header *hdr); void stack_pst_init(Pst *pst); ftdm_status_t get_ftdmchan_by_spInstId(uint8_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data); ftdm_status_t get_ftdmchan_by_suInstId(uint8_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data); - -ftdm_status_t check_for_state_change(ftdm_channel_t *ftdmchan); +ftdm_status_t sng_isdn_set_avail_rate(ftdm_span_t *ftdmspan, sngisdn_avail_t avail); /* Outbound Call Control functions */ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan); +void sngisdn_snd_setup_ack(ftdm_channel_t *ftdmchan); void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan); void sngisdn_snd_progress(ftdm_channel_t *ftdmchan); void sngisdn_snd_alert(ftdm_channel_t *ftdmchan); void sngisdn_snd_connect(ftdm_channel_t *ftdmchan); void sngisdn_snd_disconnect(ftdm_channel_t *ftdmchan); -void sngisdn_snd_release(ftdm_channel_t *ftdmchan); +void sngisdn_snd_release(ftdm_channel_t *ftdmchan, uint8_t glare); void sngisdn_snd_reset(ftdm_channel_t *ftdmchan); void sngisdn_snd_con_complete(ftdm_channel_t *ftdmchan); +void sngisdn_snd_info_req(ftdm_channel_t *ftdmchan); +void sngisdn_snd_status_enq(ftdm_channel_t *ftdmchan); /* Inbound Call Control functions */ -void sngisdn_rcv_con_ind (signed short suId, uint32_t suInstId, uint32_t spInstId, ConEvnt *conEvnt, signed short dChan, uint8_t ces); -void sngisdn_rcv_con_cfm (signed short suId, uint32_t suInstId, uint32_t spInstId, CnStEvnt *cnStEvnt, signed short dChan, uint8_t ces); -void sngisdn_rcv_cnst_ind (signed short suId, uint32_t suInstId, uint32_t spInstId, CnStEvnt *cnStEvnt, uint8_t evntType, signed short dChan, uint8_t ces); -void sngisdn_rcv_disc_ind (signed short suId, uint32_t suInstId, uint32_t spInstId, DiscEvnt *discEvnt); -void sngisdn_rcv_rel_ind (signed short suId, uint32_t suInstId, uint32_t spInstId, RelEvnt *relEvnt); -void sngisdn_rcv_dat_ind (signed short suId, uint32_t suInstId, uint32_t spInstId, InfoEvnt *infoEvnt); -void sngisdn_rcv_sshl_ind (signed short suId, uint32_t suInstId, uint32_t spInstId, SsHlEvnt *ssHlEvnt, uint8_t action); -void sngisdn_rcv_sshl_cfm (signed short suId, uint32_t suInstId, uint32_t spInstId, SsHlEvnt *ssHlEvnt, uint8_t action); -void sngisdn_rcv_rmrt_ind (signed short suId, uint32_t suInstId, uint32_t spInstId, RmRtEvnt *rmRtEvnt, uint8_t action); -void sngisdn_rcv_rmrt_cfm (signed short suId, uint32_t suInstId, uint32_t spInstId, RmRtEvnt *rmRtEvnt, uint8_t action); -void sngisdn_rcv_flc_ind (signed short suId, uint32_t suInstId, uint32_t spInstId, StaEvnt *staEvnt); -void sngisdn_rcv_fac_ind (signed short suId, uint32_t suInstId, uint32_t spInstId, FacEvnt *facEvnt, uint8_t evntType, signed short dChan, uint8_t ces); -void sngisdn_rcv_sta_cfm ( signed short suId, uint32_t suInstId, uint32_t spInstId, StaEvnt *staEvnt); -void sngisdn_rcv_srv_ind ( signed short suId, Srv *srvEvnt, signed short dChan, uint8_t ces); -void sngisdn_rcv_srv_cfm ( signed short suId, Srv *srvEvnt, signed short dChan, uint8_t ces); -void sngisdn_rcv_rst_cfm ( signed short suId, Rst *rstEvnt, signed short dChan, uint8_t ces, uint8_t evtType); -void sngisdn_rcv_rst_ind ( signed short suId, Rst *rstEvnt, signed short dChan, uint8_t ces, uint8_t evtType); - +void sngisdn_rcv_con_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, ConEvnt *conEvnt, int16_t dChan, uint8_t ces); +void sngisdn_rcv_con_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, CnStEvnt *cnStEvnt, int16_t dChan, uint8_t ces); +void sngisdn_rcv_cnst_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, CnStEvnt *cnStEvnt, uint8_t evntType, int16_t dChan, uint8_t ces); +void sngisdn_rcv_disc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, DiscEvnt *discEvnt); +void sngisdn_rcv_rel_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, RelEvnt *relEvnt); +void sngisdn_rcv_dat_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, InfoEvnt *infoEvnt); +void sngisdn_rcv_sshl_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, SsHlEvnt *ssHlEvnt, uint8_t action); +void sngisdn_rcv_sshl_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, SsHlEvnt *ssHlEvnt, uint8_t action); +void sngisdn_rcv_rmrt_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, RmRtEvnt *rmRtEvnt, uint8_t action); +void sngisdn_rcv_rmrt_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, RmRtEvnt *rmRtEvnt, uint8_t action); +void sngisdn_rcv_flc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, StaEvnt *staEvnt); +void sngisdn_rcv_fac_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, FacEvnt *facEvnt, uint8_t evntType, int16_t dChan, uint8_t ces); +void sngisdn_rcv_sta_cfm ( int16_t suId, uint32_t suInstId, uint32_t spInstId, StaEvnt *staEvnt); +void sngisdn_rcv_srv_ind ( int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces); +void sngisdn_rcv_srv_cfm ( int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces); +void sngisdn_rcv_rst_cfm ( int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces, uint8_t evntType); +void sngisdn_rcv_rst_ind ( int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces, uint8_t evntType); + +void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event); +void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event); +void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event); +void sngisdn_process_disc_ind (sngisdn_event_data_t *sngisdn_event); +void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event); +void sngisdn_process_dat_ind (sngisdn_event_data_t *sngisdn_event); +void sngisdn_process_sshl_ind (sngisdn_event_data_t *sngisdn_event); +void sngisdn_process_sshl_cfm (sngisdn_event_data_t *sngisdn_event); +void sngisdn_process_rmrt_ind (sngisdn_event_data_t *sngisdn_event); +void sngisdn_process_rmrt_cfm (sngisdn_event_data_t *sngisdn_event); +void sngisdn_process_flc_ind (sngisdn_event_data_t *sngisdn_event); +void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event); +void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event); + +void sngisdn_process_srv_ind (sngisdn_event_data_t *sngisdn_event); +void sngisdn_process_srv_cfm (sngisdn_event_data_t *sngisdn_event); +void sngisdn_process_rst_cfm (sngisdn_event_data_t *sngisdn_event); +void sngisdn_process_rst_ind (sngisdn_event_data_t *sngisdn_event); void sngisdn_rcv_phy_ind(SuId suId, Reason reason); void sngisdn_rcv_q921_ind(BdMngmt *status); @@ -246,14 +318,38 @@ void sngisdn_rcv_q931_ind(InMngmt *status); void sngisdn_rcv_q931_trace(InMngmt *trc, Buffer *mBuf); void sngisdn_rcv_cc_ind(CcMngmt *status); void sngisdn_rcv_sng_log(uint8_t level, char *fmt,...); +void sngisdn_rcv_sng_assert(char *message); + +static __inline__ uint32_t sngisdn_test_flag(sngisdn_chan_data_t *sngisdn_info, sngisdn_flag_t flag) +{ + return (uint32_t) sngisdn_info->flags & flag; +} +static __inline__ void sngisdn_clear_flag(sngisdn_chan_data_t *sngisdn_info, sngisdn_flag_t flag) +{ + sngisdn_info->flags &= ~flag; +} + +static __inline__ void sngisdn_set_flag(sngisdn_chan_data_t *sngisdn_info, sngisdn_flag_t flag) +{ + sngisdn_info->flags |= flag; +} + +#define sngisdn_set_trace_flag(obj, flag) ((obj)->trace_flags |= (flag)) +#define sngisdn_clear_trace_flag(obj, flag) ((obj)->trace_flags &= ~(flag)) +#define sngisdn_test_trace_flag(obj, flag) ((obj)->trace_flags & flag) + void handle_sng_log(uint8_t level, char *fmt,...); void sngisdn_set_span_sig_status(ftdm_span_t *ftdmspan, ftdm_signaling_status_t status); +void sngisdn_delayed_release(void* p_sngisdn_info); +void sngisdn_delayed_connect(void* p_sngisdn_info); +void sngisdn_delayed_disconnect(void* p_sngisdn_info); /* Stack management functions */ ftdm_status_t sng_isdn_stack_cfg(ftdm_span_t *span); ftdm_status_t sng_isdn_stack_activate(ftdm_span_t *span); + #endif /* __FTMOD_SNG_ISDN_H__ */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c index d0254fd..6124070 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c @@ -47,7 +47,8 @@ ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span) sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data; switch(span->trunk_type) { case FTDM_TRUNK_T1: - if (!strcasecmp(switch_name, "ni2")) { + if (!strcasecmp(switch_name, "ni2") || + !strcasecmp(switch_name, "national")) { signal_data->switchtype = SNGISDN_SWITCH_NI2; } else if (!strcasecmp(switch_name, "5ess")) { signal_data->switchtype = SNGISDN_SWITCH_5ESS; @@ -127,6 +128,7 @@ ftdm_status_t parse_switchtype(const char* switch_name, ftdm_span_t *span) dchan_data->channels[chan_id] = (sngisdn_chan_data_t*)ftdmchan->call_data; dchan_data->num_chans++; } + return FTDM_SUCCESS; } @@ -144,7 +146,7 @@ ftdm_status_t parse_signalling(const char* signalling, ftdm_span_t *span) signal_data->signalling = SNGISDN_SIGNALING_CPE; } else { - ftdm_log(FTDM_LOG_ERROR, "Unsupported signalling %s\n", signalling); + ftdm_log(FTDM_LOG_ERROR, "Unsupported signalling/interface %s\n", signalling); return FTDM_FAIL; } return FTDM_SUCCESS; @@ -156,10 +158,29 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ const char *var, *val; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) span->signal_data; /* Set defaults here */ - signal_data->keep_link_up = 1; signal_data->tei = 0; - - + signal_data->min_digits = 8; + signal_data->overlap_dial = SNGISDN_OPT_DEFAULT; + signal_data->setup_arb = SNGISDN_OPT_DEFAULT; + + if (span->trunk_type == FTDM_TRUNK_BRI || + span->trunk_type == FTDM_TRUNK_BRI_PTMP) { + + ftdm_span_set_npi("unknown", &span->default_caller_data.dnis.plan); + ftdm_span_set_ton("unknown", &span->default_caller_data.dnis.type); + ftdm_span_set_npi("unknown", &span->default_caller_data.cid_num.plan); + ftdm_span_set_ton("unknown", &span->default_caller_data.cid_num.type); + ftdm_span_set_npi("unknown", &span->default_caller_data.rdnis.plan); + ftdm_span_set_ton("unknown", &span->default_caller_data.rdnis.type); + } else { + ftdm_span_set_npi("e164", &span->default_caller_data.dnis.plan); + ftdm_span_set_ton("national", &span->default_caller_data.dnis.type); + ftdm_span_set_npi("e164", &span->default_caller_data.cid_num.plan); + ftdm_span_set_ton("national", &span->default_caller_data.cid_num.type); + ftdm_span_set_npi("e164", &span->default_caller_data.rdnis.plan); + ftdm_span_set_ton("national", &span->default_caller_data.rdnis.type); + } + for (paramindex = 0; ftdm_parameters[paramindex].var; paramindex++) { ftdm_log(FTDM_LOG_DEBUG, "Sangoma ISDN key=value, %s=%s\n", ftdm_parameters[paramindex].var, ftdm_parameters[paramindex].val); var = ftdm_parameters[paramindex].var; @@ -169,7 +190,8 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ if (parse_switchtype(val, span) != FTDM_SUCCESS) { return FTDM_FAIL; } - } else if (!strcasecmp(var, "signalling")) { + } else if (!strcasecmp(var, "signalling") || + !strcasecmp(var, "interface")) { if (parse_signalling(val, span) != FTDM_SUCCESS) { return FTDM_FAIL; } @@ -180,15 +202,44 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ return FTDM_FAIL; } signal_data->tei = tei; - } else if (!strcasecmp(var, "keep_link_up")) { + } else if (!strcasecmp(var, "overlap")) { if (!strcasecmp(val, "yes")) { - signal_data->keep_link_up = 1; + signal_data->overlap_dial = SNGISDN_OPT_TRUE; } else if (!strcasecmp(val, "no")) { - signal_data->keep_link_up = 0; + signal_data->overlap_dial = SNGISDN_OPT_FALSE; } else { - ftdm_log(FTDM_LOG_ERROR, "Invalid keep_link_up value, valid values are (yes/no)"); - return FTDM_FAIL; + ftdm_log(FTDM_LOG_ERROR, "Invalid value for parameter:%s:%s\n", var, val); + } + } else if (!strcasecmp(var, "setup arbitration")) { + if (!strcasecmp(val, "yes")) { + signal_data->setup_arb = SNGISDN_OPT_TRUE; + } else if (!strcasecmp(val, "no")) { + signal_data->setup_arb = SNGISDN_OPT_FALSE; + } else { + ftdm_log(FTDM_LOG_ERROR, "Invalid value for parameter:%s:%s\n", var, val); + } + } else if (!strcasecmp(var, "facility")) { + if (!strcasecmp(val, "yes")) { + signal_data->facility = SNGISDN_OPT_TRUE; + } else if (!strcasecmp(val, "no")) { + signal_data->facility = SNGISDN_OPT_FALSE; + } else { + ftdm_log(FTDM_LOG_ERROR, "Invalid value for parameter:%s:%s\n", var, val); } + } else if (!strcasecmp(var, "min_digits")) { + signal_data->min_digits = atoi(val); + } else if (!strcasecmp(var, "outbound-called-ton")) { + ftdm_span_set_ton(val, &span->default_caller_data.dnis.type); + } else if (!strcasecmp(var, "outbound-called-npi")) { + ftdm_span_set_npi(val, &span->default_caller_data.dnis.plan); + } else if (!strcasecmp(var, "outbound-calling-ton")) { + ftdm_span_set_ton(val, &span->default_caller_data.cid_num.type); + } else if (!strcasecmp(var, "outbound-calling-npi")) { + ftdm_span_set_npi(val, &span->default_caller_data.cid_num.plan); + } else if (!strcasecmp(var, "outbound-rdnis-ton")) { + ftdm_span_set_ton(val, &span->default_caller_data.rdnis.type); + } else if (!strcasecmp(var, "outbound-rdnis-npi")) { + ftdm_span_set_npi(val, &span->default_caller_data.rdnis.plan); } else { ftdm_log(FTDM_LOG_WARNING, "Ignoring unknown parameter %s\n", ftdm_parameters[paramindex].var); } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c index c44228d..f84e018 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c @@ -223,17 +223,17 @@ ftdm_status_t sng_isdn_stack_cfg_phy_psap(ftdm_span_t *span) switch(span->trunk_type) { case FTDM_TRUNK_E1: cfg.t.cfg.s.l1PSAP.chan = 16; - cfg.t.cfg.s.l1PSAP.type = SNG_LINKTYPE_PRI; + cfg.t.cfg.s.l1PSAP.type = SNG_L1_TYPE_PRI; break; case FTDM_TRUNK_T1: case FTDM_TRUNK_J1: cfg.t.cfg.s.l1PSAP.chan = 24; - cfg.t.cfg.s.l1PSAP.type = SNG_LINKTYPE_PRI; + cfg.t.cfg.s.l1PSAP.type = SNG_L1_TYPE_PRI; break; case FTDM_TRUNK_BRI: case FTDM_TRUNK_BRI_PTMP: cfg.t.cfg.s.l1PSAP.chan = 3; - cfg.t.cfg.s.l1PSAP.type = SNG_LINKTYPE_BRI; + cfg.t.cfg.s.l1PSAP.type = SNG_L1_TYPE_BRI; break; default: ftdm_log(FTDM_LOG_ERROR, "%s:Unsupported trunk type %d\n", span->name, span->trunk_type); @@ -280,10 +280,10 @@ ftdm_status_t sng_isdn_stack_cfg_q921_gen(void) cfg.t.cfg.s.bdGen.nmbASPLnks = MAX_L1_LINKS+1; #ifdef LAPD_3_4 - cfg.t.cfg.s.bdGen.timeRes = 10; /* timer resolution */ + cfg.t.cfg.s.bdGen.timeRes = 100; /* timer resolution = 1 sec */ #endif - cfg.t.cfg.s.bdGen.poolTrUpper = POOL_UP_TR; /* upper pool threshold */ - cfg.t.cfg.s.bdGen.poolTrLower = POOL_LW_TR; /* lower pool threshold */ + cfg.t.cfg.s.bdGen.poolTrUpper = 2; /* upper pool threshold */ + cfg.t.cfg.s.bdGen.poolTrLower = 1; /* lower pool threshold */ if (sng_isdn_q921_config(&pst, &cfg)) { return FTDM_FAIL; @@ -315,9 +315,9 @@ ftdm_status_t sng_isdn_stack_cfg_q921_msap(ftdm_span_t *span) cfg.t.cfg.s.bdMSAP.lnkNmb = signal_data->link_id; - cfg.t.cfg.s.bdMSAP.maxOutsFrms = 2; /* MAC window */ - cfg.t.cfg.s.bdMSAP.tQUpperTrs = 16; /* Tx Queue Upper Threshold */ - cfg.t.cfg.s.bdMSAP.tQLowerTrs = 8; /* Tx Queue Lower Threshold */ + cfg.t.cfg.s.bdMSAP.maxOutsFrms = 24; /* MAC window */ + cfg.t.cfg.s.bdMSAP.tQUpperTrs = 32; /* Tx Queue Upper Threshold */ + cfg.t.cfg.s.bdMSAP.tQLowerTrs = 24; /* Tx Queue Lower Threshold */ cfg.t.cfg.s.bdMSAP.selector = 0; /* Selector 0 */ /* TODO: check if bdMSAP parameters can be initialized by calling stack_pst_init */ cfg.t.cfg.s.bdMSAP.mem.region = S_REG; /* Memory region */ @@ -327,8 +327,8 @@ ftdm_status_t sng_isdn_stack_cfg_q921_msap(ftdm_span_t *span) cfg.t.cfg.s.bdMSAP.dstProcId = SFndProcId(); /* destination proc id */ cfg.t.cfg.s.bdMSAP.dstEnt = ENTL1; /* entity */ cfg.t.cfg.s.bdMSAP.dstInst = S_INST; /* instance */ - cfg.t.cfg.s.bdMSAP.t201Tmr = 5; /* T201 */ - cfg.t.cfg.s.bdMSAP.t202Tmr = 200; /* T202 */ + cfg.t.cfg.s.bdMSAP.t201Tmr = 1; /* T201 - should be equal to t200Tmr */ + cfg.t.cfg.s.bdMSAP.t202Tmr = 2; /* T202 */ cfg.t.cfg.s.bdMSAP.bndRetryCnt = 2; /* bind retry counter */ cfg.t.cfg.s.bdMSAP.tIntTmr = 200; /* bind retry timer */ cfg.t.cfg.s.bdMSAP.n202 = 3; /* N202 */ @@ -341,7 +341,21 @@ ftdm_status_t sng_isdn_stack_cfg_q921_msap(ftdm_span_t *span) cfg.t.cfg.s.bdMSAP.kpL1Up = TRUE; /* flag to keep l1 up or not */ } - cfg.t.cfg.s.bdMSAP.type = sng_isdn_stack_switchtype(signal_data->switchtype); + switch(signal_data->switchtype) { + case SNGISDN_SWITCH_NI2: + case SNGISDN_SWITCH_5ESS: + case SNGISDN_SWITCH_4ESS: + case SNGISDN_SWITCH_DMS100: + cfg.t.cfg.s.bdMSAP.type = SW_NI2; + break; + case SNGISDN_SWITCH_INSNET: + cfg.t.cfg.s.bdMSAP.type = SW_CCITT; + break; + case SNGISDN_SWITCH_EUROISDN: + case SNGISDN_SWITCH_QSIG: + cfg.t.cfg.s.bdMSAP.type = SW_ETSI; + break; + } if (span->trunk_type == FTDM_TRUNK_BRI_PTMP) { cfg.t.cfg.s.bdMSAP.teiChkTmr = 20; /* Tei check timer */ @@ -357,6 +371,12 @@ ftdm_status_t sng_isdn_stack_cfg_q921_msap(ftdm_span_t *span) cfg.t.cfg.s.bdMSAP.setUpArb = ACTIVE; /* set up arbitration */ } + /* Overwrite setUpArb value if user forced it */ + if (signal_data->setup_arb == SNGISDN_OPT_TRUE) { + cfg.t.cfg.s.bdMSAP.setUpArb = ACTIVE; + } else if (signal_data->setup_arb == SNGISDN_OPT_FALSE) { + cfg.t.cfg.s.bdMSAP.setUpArb = PASSIVE; + } if (sng_isdn_q921_config(&pst, &cfg)) { return FTDM_FAIL; @@ -389,11 +409,18 @@ ftdm_status_t sng_isdn_stack_cfg_q921_dlsap(ftdm_span_t *span, uint8_t managemen cfg.t.cfg.s.bdDLSAP.lnkNmb = signal_data->link_id; cfg.t.cfg.s.bdDLSAP.n201 = 1028; /* n201 */ - cfg.t.cfg.s.bdDLSAP.k = 7; /* k */ + if (span->trunk_type == FTDM_TRUNK_BRI_PTMP || + span->trunk_type == FTDM_TRUNK_BRI) { + + cfg.t.cfg.s.bdDLSAP.k = 1; /* Based on q.921 recommendations */ + } else { + cfg.t.cfg.s.bdDLSAP.k = 7; /* k */ + } + cfg.t.cfg.s.bdDLSAP.n200 = 3; /* n200 */ cfg.t.cfg.s.bdDLSAP.congTmr = 300; /* congestion timer */ - cfg.t.cfg.s.bdDLSAP.t200Tmr = 1; /* t1 changed from 25 */ - cfg.t.cfg.s.bdDLSAP.t203Tmr = 3; /* t3 changed from 50 */ + cfg.t.cfg.s.bdDLSAP.t200Tmr = 1; /* t1 changed from 25 */ + cfg.t.cfg.s.bdDLSAP.t203Tmr = 10; /* t3 changed from 50 */ cfg.t.cfg.s.bdDLSAP.mod = 128; /* modulo */ cfg.t.cfg.s.bdDLSAP.selector = 0; /* Selector 0 */ cfg.t.cfg.s.bdDLSAP.mem.region = S_REG; /* Memory region */ @@ -483,7 +510,7 @@ ftdm_status_t sng_isdn_stack_cfg_q931_gen(void) /* upper pool threshold */ cfg.t.cfg.s.inGen.poolTrUpper = INGEN_POOL_UP_TR; /* time resolution */ - cfg.t.cfg.s.inGen.timeRes = 10; + cfg.t.cfg.s.inGen.timeRes = 100; /* timer resolution = 1 sec */ cfg.t.cfg.s.inGen.sm.dstEnt = ENTSM; @@ -594,6 +621,12 @@ ftdm_status_t sng_isdn_stack_cfg_q931_dlsap(ftdm_span_t *span) cfg.t.cfg.s.inDLSAP.tCbId = signal_data->cc_id; + if (signal_data->facility == SNGISDN_OPT_TRUE) { + cfg.t.cfg.s.inDLSAP.facilityHandling = IN_FACILITY_STANDRD; + } else { + cfg.t.cfg.s.inDLSAP.facilityHandling = 0; + } + /* TODO : NFAS configuration */ cfg.t.cfg.s.inDLSAP.nfasInt = FALSE; /* pass this later */ @@ -687,38 +720,46 @@ ftdm_status_t sng_isdn_stack_cfg_q931_dlsap(ftdm_span_t *span) cfg.t.cfg.s.inDLSAP.cndSubsc = TRUE; /* calling adddress delivery service subscription */ /* TODO: Fill in these timers with proper values - eventually pass them */ - cfg.t.cfg.s.inDLSAP.tmr.t301.enb = FALSE; - cfg.t.cfg.s.inDLSAP.tmr.t301.val = 35; - cfg.t.cfg.s.inDLSAP.tmr.t302.enb = FALSE; - cfg.t.cfg.s.inDLSAP.tmr.t302.val = 35; - cfg.t.cfg.s.inDLSAP.tmr.t303.enb = FALSE; - cfg.t.cfg.s.inDLSAP.tmr.t303.val = 35; + cfg.t.cfg.s.inDLSAP.tmr.t301.enb = TRUE; + cfg.t.cfg.s.inDLSAP.tmr.t301.val = 180; + cfg.t.cfg.s.inDLSAP.tmr.t302.enb = TRUE; + cfg.t.cfg.s.inDLSAP.tmr.t302.val = 15; + cfg.t.cfg.s.inDLSAP.tmr.t303.enb = TRUE; + cfg.t.cfg.s.inDLSAP.tmr.t303.val = 4; cfg.t.cfg.s.inDLSAP.tmr.t304.enb = TRUE; - cfg.t.cfg.s.inDLSAP.tmr.t304.val = 35; + cfg.t.cfg.s.inDLSAP.tmr.t304.val = 30; cfg.t.cfg.s.inDLSAP.tmr.t305.enb = TRUE; - cfg.t.cfg.s.inDLSAP.tmr.t305.val = 35; + cfg.t.cfg.s.inDLSAP.tmr.t305.val = 30; cfg.t.cfg.s.inDLSAP.tmr.t306.enb = FALSE; cfg.t.cfg.s.inDLSAP.tmr.t306.val = 35; cfg.t.cfg.s.inDLSAP.tmr.t307.enb = FALSE; cfg.t.cfg.s.inDLSAP.tmr.t307.val = 35; cfg.t.cfg.s.inDLSAP.tmr.t308.enb = TRUE; - cfg.t.cfg.s.inDLSAP.tmr.t308.val = 35; - cfg.t.cfg.s.inDLSAP.tmr.t310.enb = FALSE; - cfg.t.cfg.s.inDLSAP.tmr.t310.val = 35; - cfg.t.cfg.s.inDLSAP.tmr.t312.enb = FALSE; - cfg.t.cfg.s.inDLSAP.tmr.t312.val = 35; + cfg.t.cfg.s.inDLSAP.tmr.t308.val = 4; + + if (signal_data->signalling == SNGISDN_SIGNALING_NET) { + cfg.t.cfg.s.inDLSAP.tmr.t310.enb = TRUE; + cfg.t.cfg.s.inDLSAP.tmr.t310.val = 10; + cfg.t.cfg.s.inDLSAP.tmr.t312.enb = TRUE; + cfg.t.cfg.s.inDLSAP.tmr.t312.val = cfg.t.cfg.s.inDLSAP.tmr.t303.val+2; + } else { + cfg.t.cfg.s.inDLSAP.tmr.t310.enb = TRUE; + cfg.t.cfg.s.inDLSAP.tmr.t310.val = 120; + cfg.t.cfg.s.inDLSAP.tmr.t312.enb = FALSE; + } + cfg.t.cfg.s.inDLSAP.tmr.t313.enb = TRUE; - cfg.t.cfg.s.inDLSAP.tmr.t313.val = 35; + cfg.t.cfg.s.inDLSAP.tmr.t313.val = 4; cfg.t.cfg.s.inDLSAP.tmr.t316.enb = TRUE; - cfg.t.cfg.s.inDLSAP.tmr.t316.val = 35; - cfg.t.cfg.s.inDLSAP.tmr.t316c.enb = TRUE; + cfg.t.cfg.s.inDLSAP.tmr.t316.val = 120; + cfg.t.cfg.s.inDLSAP.tmr.t316c.enb = FALSE; cfg.t.cfg.s.inDLSAP.tmr.t316c.val = 35; - cfg.t.cfg.s.inDLSAP.tmr.t318.enb = FALSE; - cfg.t.cfg.s.inDLSAP.tmr.t318.val = 35; - cfg.t.cfg.s.inDLSAP.tmr.t319.enb = FALSE; - cfg.t.cfg.s.inDLSAP.tmr.t319.val = 35; + cfg.t.cfg.s.inDLSAP.tmr.t318.enb = TRUE; + cfg.t.cfg.s.inDLSAP.tmr.t318.val = 4; + cfg.t.cfg.s.inDLSAP.tmr.t319.enb = TRUE; + cfg.t.cfg.s.inDLSAP.tmr.t319.val = 4; cfg.t.cfg.s.inDLSAP.tmr.t322.enb = TRUE; - cfg.t.cfg.s.inDLSAP.tmr.t322.val = 35; + cfg.t.cfg.s.inDLSAP.tmr.t322.val = 4; cfg.t.cfg.s.inDLSAP.tmr.t332.enb = FALSE; cfg.t.cfg.s.inDLSAP.tmr.t332.val = 35; cfg.t.cfg.s.inDLSAP.tmr.tRst.enb = TRUE; @@ -893,8 +934,9 @@ ftdm_status_t sng_isdn_stack_cfg_cc_gen(void) stack_pst_init(&cfg.t.cfg.s.ccGenCfg.smPst); cfg.t.cfg.s.ccGenCfg.smPst.dstEnt = ENTSM; - cfg.t.cfg.s.ccGenCfg.poolTrLower = 2; - cfg.t.cfg.s.ccGenCfg.poolTrUpper = 4; + cfg.t.cfg.s.ccGenCfg.poolTrUpper = 2; + cfg.t.cfg.s.ccGenCfg.poolTrLower = 1; + cfg.t.cfg.s.ccGenCfg.nmbSaps = MAX_VARIANTS+1; /* Set to number of variants + 1 */ if (sng_isdn_cc_config(&pst, &cfg)) { @@ -1013,7 +1055,7 @@ uint8_t sng_isdn_stack_switchtype(sngisdn_switchtype_t switchtype) case SNGISDN_SWITCH_QSIG: return SW_QSIG; case SNGISDN_SWITCH_INSNET: - return SW_QSIG; + return SW_INSNET; case SNGISDN_SWITCH_INVALID: ftdm_log(FTDM_LOG_ERROR, "%s:Invalid switchtype:%d\n", switchtype); break; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c index d02314a..f92eced 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cntrl.c @@ -46,8 +46,11 @@ ftdm_status_t sng_isdn_activate_trace(ftdm_span_t *span, sngisdn_tracetype_t tra ftdm_status_t sng_isdn_cntrl_q931(ftdm_span_t *span, uint8_t action, uint8_t subaction); ftdm_status_t sng_isdn_cntrl_q921(ftdm_span_t *span, uint8_t action, uint8_t subaction); + extern ftdm_sngisdn_data_t g_sngisdn_data; +ftdm_status_t sng_isdn_stack_stop(ftdm_span_t *span); + ftdm_status_t sng_isdn_stack_activate(ftdm_span_t *span) { @@ -77,6 +80,12 @@ ftdm_status_t sng_isdn_stack_activate(ftdm_span_t *span) return FTDM_SUCCESS; } +ftdm_status_t sng_isdn_stack_stop(ftdm_span_t *span) +{ + + return FTDM_SUCCESS; +} + ftdm_status_t sng_isdn_activate_phy(ftdm_span_t *span) { @@ -302,6 +311,7 @@ void stack_resp_hdr_init(Header *hdr) } + /* For Emacs: * Local Variables: * mode:c diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c new file mode 100644 index 0000000..2520a3d --- /dev/null +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -0,0 +1,978 @@ +/* + * Copyright (c) 2010, Sangoma Technologies + * David Yat Sin <dyatsin@sangoma.com> + * 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 original author; nor the names of any 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 OWNER + * 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 "ftmod_sangoma_isdn.h" + +extern ftdm_status_t cpy_calling_num_from_sngisdn(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb); +extern ftdm_status_t cpy_called_num_from_sngisdn(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb); +extern ftdm_status_t cpy_redir_num_from_sngisdn(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb); +extern ftdm_status_t cpy_calling_name_from_sngisdn(ftdm_caller_data_t *ftdm, Display *display); + +/* Remote side transmit a SETUP */ +void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + + int16_t suId = sngisdn_event->suId; + uint32_t suInstId = sngisdn_event->suInstId; + uint32_t spInstId = sngisdn_event->spInstId; + int16_t dChan = sngisdn_event->dChan; + uint8_t ces = sngisdn_event->ces; + sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; + ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + ConEvnt *conEvnt = &sngisdn_event->event.conEvnt; + + ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n"); + + ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_DEBUG, "Processing SETUP (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); + + switch (ftdmchan->state) { + case FTDM_CHANNEL_STATE_DOWN: /* Proper state to receive a SETUP */ + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE) || + ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { + + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Received SETUP but channel is in USE, saving call for later processing\n"); + /* the flag the channel as having a collision */ + sngisdn_set_flag(sngisdn_info, FLAG_GLARE); + + /* save the SETUP for processing once the channel has gone to DOWN */ + memcpy(&sngisdn_info->glare.setup, conEvnt, sizeof(*conEvnt)); + sngisdn_info->glare.suId = suId; + sngisdn_info->glare.suInstId = suInstId; /* Do not generate a suInstId now, we will generate when glared call gets extracted */ + sngisdn_info->glare.spInstId = spInstId; + sngisdn_info->glare.dChan = dChan; + sngisdn_info->glare.ces = ces; + break; + } + + sngisdn_info->suInstId = get_unique_suInstId(suId); + sngisdn_info->spInstId = spInstId; + + /* If this is a glared call that was previously saved, we moved + all the info to the current call, so clear the glared saved data */ + + if (sngisdn_info->glare.spInstId == spInstId) { + clear_call_glare_data(sngisdn_info); + } + + ftdm_assert(g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] == NULL, "Con Ind on busy spInstId"); + + ftdm_mutex_lock(g_sngisdn_data.ccs[suId].mutex); + g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] = sngisdn_info; + g_sngisdn_data.ccs[suId].active_suInstIds[sngisdn_info->suInstId] = sngisdn_info; + ftdm_mutex_unlock(g_sngisdn_data.ccs[suId].mutex); + + ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND); + + if (ftdmchan->span->trunk_type == FTDM_TRUNK_BRI_PTMP && + signal_data->signalling == SNGISDN_SIGNALING_NET) { + sngisdn_info->ces = ces; + } + + /* try to open the channel */ + if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Failed to open channel"); + sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_REL); + ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_TEMPORARY_FAILURE; + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); + break; + } + /* Fill in call information */ + cpy_calling_num_from_sngisdn(&ftdmchan->caller_data, &conEvnt->cgPtyNmb); + cpy_called_num_from_sngisdn(&ftdmchan->caller_data, &conEvnt->cdPtyNmb); + cpy_calling_name_from_sngisdn(&ftdmchan->caller_data, &conEvnt->display); + + + if (signal_data->switchtype == SNGISDN_SWITCH_NI2) { + if (conEvnt->shift11.eh.pres && conEvnt->ni2OctStr.eh.pres) { + if (conEvnt->ni2OctStr.str.len == 4 && conEvnt->ni2OctStr.str.val[0] == 0x37) { + snprintf(ftdmchan->caller_data.aniII, 5, "%.2d", conEvnt->ni2OctStr.str.val[3]); + } + } + + + if (conEvnt->facilityStr.eh.pres) { + /* Verify whether the Caller Name will come in a subsequent FACILITY message */ + uint16_t ret_val; + uint8_t facility_str[255]; + char retrieved_str[255]; + memcpy(facility_str, (uint8_t*)&conEvnt->facilityStr.facilityStr.val, conEvnt->facilityStr.facilityStr.len); + + ret_val = sng_isdn_retrieve_facility_caller_name(facility_str, conEvnt->facilityStr.facilityStr.len, retrieved_str); + /* + return values for "sng_isdn_retrieve_facility_information_following": + If there will be no information following, or fails to decode IE, returns -1 + If there will be no information following, but current FACILITY IE contains a caller name, returns 0 + If there will be information following, returns 1 + */ + + if (ret_val == 1) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Expecting Caller name in FACILITY\n"); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_GET_CALLERID); + break; + } else if (ret_val == 0) { + strcpy(ftdmchan->caller_data.cid_name, retrieved_str); + } + } + } + + if (signal_data->overlap_dial == SNGISDN_OPT_TRUE && !conEvnt->sndCmplt.eh.pres) { + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); + } else { + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); + } + break; + case FTDM_CHANNEL_STATE_TERMINATING: + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Processing SETUP in TERMINATING state, saving SETUP info for later processing\n"); + ftdm_assert(!sngisdn_test_flag(sngisdn_info, FLAG_GLARE), "Trying to save GLARE info, but we already had a glare"); + + sngisdn_set_flag(sngisdn_info, FLAG_GLARE); + + /* save the SETUP for processing once the channel has gone to DOWN */ + memcpy(&sngisdn_info->glare.setup, conEvnt, sizeof(*conEvnt)); + sngisdn_info->glare.suId = suId; + sngisdn_info->glare.suInstId = suInstId; /* Do not generate a suInstId now, we will generate when glared call gets extracted */ + sngisdn_info->glare.spInstId = spInstId; + sngisdn_info->glare.dChan = dChan; + sngisdn_info->glare.ces = ces; + + /* We need to register the spInstId in case we get a release for that call while it is still stored in sngisdn_info->glare */ + ftdm_mutex_lock(g_sngisdn_data.ccs[suId].mutex); + g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] = sngisdn_info; + ftdm_mutex_unlock(g_sngisdn_data.ccs[suId].mutex); + + break; + case FTDM_CHANNEL_STATE_DIALING: /* glare */ + if (signal_data->signalling == SNGISDN_SIGNALING_NET) { + /* Save inbound call info so we can send a RELEASE when this channel goes to a different state */ + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Processing SETUP in DIALING state, rejecting inbound call\n"); + sngisdn_set_flag(sngisdn_info, FLAG_DELAYED_REL); + + sngisdn_info->glare.suId = suId; + sngisdn_info->glare.suInstId = get_unique_suInstId(suId); + sngisdn_info->glare.spInstId = spInstId; + + ftdm_mutex_lock(g_sngisdn_data.ccs[suId].mutex); + g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] = sngisdn_info; + g_sngisdn_data.ccs[suId].active_suInstIds[sngisdn_info->suInstId] = sngisdn_info; + ftdm_mutex_unlock(g_sngisdn_data.ccs[suId].mutex); + + sngisdn_info->glare.dChan = dChan; + sngisdn_info->glare.ces = ces; + ftdmchan->caller_data.hangup_cause = 0x2C; /* Channel requested not available */ + ftdm_sched_timer(signal_data->sched, "delayed_release", 1, sngisdn_delayed_release, (void*) sngisdn_info, NULL); + } else { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Processing SETUP in DIALING state, saving SETUP info for later processing\n"); + + /* the flag the channel as having a collision */ + ftdm_assert(!sngisdn_test_flag(sngisdn_info, FLAG_GLARE), "Trying to save GLARE info, but we already had a glare"); + sngisdn_set_flag(sngisdn_info, FLAG_GLARE); + + /* save the SETUP for processing once the channel has gone to DOWN */ + memcpy(&sngisdn_info->glare.setup, conEvnt, sizeof(*conEvnt)); + sngisdn_info->glare.suId = suId; + sngisdn_info->glare.suInstId = suInstId; /* Do not generate a suInstId now, we will generate when glared call gets extracted */ + sngisdn_info->glare.spInstId = spInstId; + sngisdn_info->glare.dChan = dChan; + sngisdn_info->glare.ces = ces; + + /* We need to register the spInstId in case we get a release for that call while it is still stored in sngisdn_info->glare */ + ftdm_mutex_lock(g_sngisdn_data.ccs[suId].mutex); + g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] = sngisdn_info; + ftdm_mutex_unlock(g_sngisdn_data.ccs[suId].mutex); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + } + break; + default: + ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Processing SETUP in an invalid state (%s)\n", ftdm_channel_state2str(ftdmchan->state)); + break; + } + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; +} + +/* Remote side transmit a CONNECT or CONNECT ACK */ +void sngisdn_process_con_cfm (sngisdn_event_data_t *sngisdn_event) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + + int16_t suId = sngisdn_event->suId; + uint32_t suInstId = sngisdn_event->suInstId; + uint32_t spInstId = sngisdn_event->spInstId; + uint8_t ces = sngisdn_event->ces; + sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; + ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + + /* Function does not require any info from conStEvnt struct for now */ + /* CnStEvnt *cnStEvnt = &sngisdn_event->event.cnStEvnt; */ + + ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n"); + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing CONNECT/CONNECT ACK (suId:%u suInstId:%u spInstId:%u ces:%d)\n", suId, suInstId, spInstId, ces); + + if (!sngisdn_info->spInstId) { + ftdm_mutex_lock(g_sngisdn_data.ccs[suId].mutex); + sngisdn_info->spInstId = spInstId; + g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] = sngisdn_info; + ftdm_mutex_unlock(g_sngisdn_data.ccs[suId].mutex); + } + + if (ftdmchan->span->trunk_type == FTDM_TRUNK_BRI_PTMP && + ((sngisdn_span_data_t*)ftdmchan->span->signal_data)->signalling == SNGISDN_SIGNALING_NET) { + + if(sngisdn_info->ces == CES_MNGMNT) { + /* We assign the call to the first TE */ + sngisdn_info->ces = ces; + } else { + /* We already assigned this call, do nothing */ + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Call already assigned, ignoring connect\n"); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + } + + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + switch(ftdmchan->state) { + case FTDM_CHANNEL_STATE_PROGRESS: + case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: + case FTDM_CHANNEL_STATE_DIALING: + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_UP); + break; + default: + ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Processing CONNECT/CONNECT ACK in an invalid state (%s)\n", ftdm_channel_state2str(ftdmchan->state)); + + /* Start the disconnect procedure */ + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + break; + } + } else { + switch(ftdmchan->state) { + case FTDM_CHANNEL_STATE_UP: + /* This is the only valid state we should get a CONNECT ACK on */ + /* do nothing */ + break; + default: + ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Processing CONNECT/CONNECT ACK in an invalid state (%s)\n", ftdm_channel_state2str(ftdmchan->state)); + + /* Start the disconnect procedure */ + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + break; + } + } + + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; +} + +void sngisdn_process_cnst_ind (sngisdn_event_data_t *sngisdn_event) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + + int16_t suId = sngisdn_event->suId; + uint32_t suInstId = sngisdn_event->suInstId; + uint32_t spInstId = sngisdn_event->spInstId; + uint8_t ces = sngisdn_event->ces; + uint8_t evntType = sngisdn_event->evntType; + + sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; + ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + + CnStEvnt *cnStEvnt = &sngisdn_event->event.cnStEvnt; + + if (!sngisdn_info->spInstId) { + ftdm_mutex_lock(g_sngisdn_data.ccs[suId].mutex); + sngisdn_info->spInstId = spInstId; + g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] = sngisdn_info; + ftdm_mutex_unlock(g_sngisdn_data.ccs[suId].mutex); + } + + ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n"); + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing %s (suId:%u suInstId:%u spInstId:%u ces:%d)\n", + (evntType == MI_ALERTING)?"ALERT": + (evntType == MI_CALLPROC)?"PROCEED": + (evntType == MI_PROGRESS)?"PROGRESS": + (evntType == MI_SETUPACK)?"SETUP ACK": + (evntType == MI_INFO)?"INFO":"UNKNOWN", + suId, suInstId, spInstId, ces); + + switch(evntType) { + case MI_ALERTING: + case MI_CALLPROC: + case MI_PROGRESS: + switch(ftdmchan->state) { + case FTDM_CHANNEL_STATE_DIALING: + if (evntType == MI_PROGRESS) { + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); + } else { + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); + } + break; + case FTDM_CHANNEL_STATE_PROGRESS: + if (evntType == MI_PROGRESS) { + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); + } + break; + case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: + /* We are already in progress media, we can't go to any higher state except up */ + /* Do nothing */ + break; + default: + ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Processing ALERT/PROCEED/PROGRESS in an invalid state (%s)\n", ftdm_channel_state2str(ftdmchan->state)); + + /* Start the disconnect procedure */ + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + break; + } + break; + case MI_SETUPACK: + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Processing SETUP_ACK, but overlap sending not implemented (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); + break; + case MI_INFO: + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing INFO (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); + + if (cnStEvnt->cdPtyNmb.eh.pres) { + switch(ftdmchan->state) { + case FTDM_CHANNEL_STATE_COLLECT: + { + ftdm_size_t min_digits = ((sngisdn_span_data_t*)ftdmchan->span->signal_data)->min_digits; + ftdm_size_t num_digits; + + cpy_called_num_from_sngisdn(&ftdmchan->caller_data, &cnStEvnt->cdPtyNmb); + num_digits = strlen(ftdmchan->caller_data.dnis.digits); + + if (cnStEvnt->sndCmplt.eh.pres || num_digits >= min_digits) { + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); + } else { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "received %d of %d digits\n", num_digits, min_digits); + } + } + break; + case FTDM_CHANNEL_STATE_RING: + case FTDM_CHANNEL_STATE_PROGRESS: + case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: + case FTDM_CHANNEL_STATE_UP: + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Receiving more digits %s, but we already proceeded with call\n", cnStEvnt->cdPtyNmb.nmbDigits.val); + break; + default: + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "\n", suId, suInstId, spInstId); + break; + } + } + + break; + default: + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Unhandled STATUS event\n"); + break; + } + + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; +} + +void sngisdn_process_disc_ind (sngisdn_event_data_t *sngisdn_event) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + + int16_t suId = sngisdn_event->suId; + uint32_t suInstId = sngisdn_event->suInstId; + uint32_t spInstId = sngisdn_event->spInstId; + sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; + ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + + DiscEvnt *discEvnt = &sngisdn_event->event.discEvnt; + + if (!sngisdn_info->spInstId) { + ftdm_mutex_lock(g_sngisdn_data.ccs[suId].mutex); + sngisdn_info->spInstId = spInstId; + g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] = sngisdn_info; + ftdm_mutex_unlock(g_sngisdn_data.ccs[suId].mutex); + } + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing DISCONNECT (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); + + ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n"); + switch (ftdmchan->state) { + case FTDM_CHANNEL_STATE_RING: + case FTDM_CHANNEL_STATE_DIALING: + case FTDM_CHANNEL_STATE_PROGRESS: + case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: + case FTDM_CHANNEL_STATE_UP: + if (discEvnt->causeDgn[0].eh.pres && discEvnt->causeDgn[0].causeVal.pres) { + ftdmchan->caller_data.hangup_cause = discEvnt->causeDgn[0].causeVal.val; + } else { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "DISCONNECT did not have a cause code\n"); + ftdmchan->caller_data.hangup_cause = 0; + } + sngisdn_set_flag(sngisdn_info, FLAG_REMOTE_REL); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + break; + case FTDM_CHANNEL_STATE_COLLECT: + case FTDM_CHANNEL_STATE_GET_CALLERID: + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); + break; + case FTDM_CHANNEL_STATE_DOWN: + /* somehow we are in down, nothing we can do locally */ + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Received DISCONNECT but we are in DOWN state\n"); + break; + case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: + /* This is a race condition. We just sent a DISCONNECT, on this channel */ + /* Do nothing */ + break; + default: + ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Received DISCONNECT in an invalid state (%s)\n", + ftdm_channel_state2str(ftdmchan->state)); + /* start reset procedure */ + + /* Start the release procedure */ + ftdm_set_flag(sngisdn_info, FLAG_REMOTE_REL); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + break; + } + + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; +} + +void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + int16_t suId = sngisdn_event->suId; + uint32_t suInstId = sngisdn_event->suInstId; + uint32_t spInstId = sngisdn_event->spInstId; + sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; + ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + + RelEvnt *relEvnt = &sngisdn_event->event.relEvnt; + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing RELEASE/RELEASE COMPLETE (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); + + ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n"); + + if ((suInstId && (sngisdn_info->glare.suInstId == suInstId)) || + (spInstId && (sngisdn_info->glare.spInstId == spInstId))) { + + /* This hangup is for a glared saved call */ + ftdm_clear_flag(sngisdn_info, FLAG_DELAYED_REL); + clear_call_glare_data(sngisdn_info); + + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + + /* check whether the ftdm channel is in a state to accept a call */ + switch (ftdmchan->state) { + case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: + /* go to DOWN */ + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + break; + case FTDM_CHANNEL_STATE_DOWN: + /* do nothing, just drop the message */ + break; + case FTDM_CHANNEL_STATE_DIALING: + /* Remote side rejected our SETUP message on outbound call */ + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) { + sng_isdn_set_avail_rate(ftdmchan->span, SNGISDN_AVAIL_DOWN); + } + /* fall-through */ + case FTDM_CHANNEL_STATE_PROGRESS: + case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: + case FTDM_CHANNEL_STATE_UP: + case FTDM_CHANNEL_STATE_RING: + /* If we previously had a glare on this channel, + this RELEASE could be for the previous call. Confirm whether call_data has + not changed while we were waiting for ftdmchan->mutex by comparing suInstId's */ + if (((sngisdn_chan_data_t*)ftdmchan->call_data)->suInstId == suInstId || + ((sngisdn_chan_data_t*)ftdmchan->call_data)->spInstId == spInstId) { + if (relEvnt->causeDgn[0].eh.pres && relEvnt->causeDgn[0].causeVal.pres) { + ftdmchan->caller_data.hangup_cause = relEvnt->causeDgn[0].causeVal.val; + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "cause:%d\n", ftdmchan->caller_data.hangup_cause); + } else { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "RELEASE COMPLETE did not have a cause code\n"); + ftdmchan->caller_data.hangup_cause = 0; + } + + sngisdn_set_flag(sngisdn_info, FLAG_REMOTE_ABORT); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + + } else { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "RELEASE was for previous call (suInstId:%u spInstId:%u)\n", suInstId, spInstId); + } + break; + case FTDM_CHANNEL_STATE_COLLECT: + case FTDM_CHANNEL_STATE_GET_CALLERID: + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); + break; + case FTDM_CHANNEL_STATE_TERMINATING: + if (sngisdn_test_flag(sngisdn_info, FLAG_GLARE) && + sngisdn_info->glare.suInstId != suInstId) { + /* This release if for the outbound call that we already started clearing */ + + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Received RELEASE for local glared call\n"); + sngisdn_set_flag(sngisdn_info, FLAG_REMOTE_ABORT); + } else { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Received release before we could clear local call\n"); + /* FS core took too long to respond to the SIG STOP event */ + sngisdn_set_flag(sngisdn_info, FLAG_REMOTE_ABORT); + /* set abort flag so that we do not transmit another release complete on this channel once FS core is done */ + } + break; + default: + ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Received RELEASE in an invalid state (%s)\n", + ftdm_channel_state2str(ftdmchan->state)); + + break; + } + + + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; +} + +void sngisdn_process_dat_ind (sngisdn_event_data_t *sngisdn_event) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + int16_t suId = sngisdn_event->suId; + uint32_t suInstId = sngisdn_event->suInstId; + uint32_t spInstId = sngisdn_event->spInstId; + + sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; + ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + + /* Function does not require any info from infoEvnt struct for now */ + /* InfoEvnt *infoEvnt = &sngisdn_event->event.infoEvnt; */ + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing DATA IND (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; +} + +void sngisdn_process_sshl_ind (sngisdn_event_data_t *sngisdn_event) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + int16_t suId = sngisdn_event->suId; + uint32_t suInstId = sngisdn_event->suInstId; + uint32_t spInstId = sngisdn_event->spInstId; + + sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; + ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + + /* Function does not require any info from ssHlEvnt struct for now */ + /* SsHlEvnt *ssHlEvnt = &sngisdn_event->event.ssHlEvnt; */ + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing SSHL IND (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; +} + +void sngisdn_process_sshl_cfm (sngisdn_event_data_t *sngisdn_event) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + int16_t suId = sngisdn_event->suId; + uint32_t suInstId = sngisdn_event->suInstId; + uint32_t spInstId = sngisdn_event->spInstId; + + sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; + ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + + /* Function does not require any info from ssHlEvnt struct for now */ + /* SsHlEvnt *ssHlEvnt = &sngisdn_event->event.ssHlEvnt; */ + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing SSHL CFM (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; +} + +void sngisdn_process_rmrt_ind (sngisdn_event_data_t *sngisdn_event) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + int16_t suId = sngisdn_event->suId; + uint32_t suInstId = sngisdn_event->suInstId; + uint32_t spInstId = sngisdn_event->spInstId; + + sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; + ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + + /* Function does not require any info from ssHlEvnt struct for now */ + /* RmRtEvnt *rmRtEvnt = &sngisdn_event->event.rmRtEvnt; */ + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing RESUME/RETRIEVE IND (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; +} + +void sngisdn_process_rmrt_cfm (sngisdn_event_data_t *sngisdn_event) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + int16_t suId = sngisdn_event->suId; + uint32_t suInstId = sngisdn_event->suInstId; + uint32_t spInstId = sngisdn_event->spInstId; + + sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; + ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + + /* Function does not require any info from ssHlEvnt struct for now */ + /* RmRtEvnt *rmRtEvnt = &sngisdn_event->event.rmRtEvnt; */ + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing RESUME/RETRIEVE CFM (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; +} + +void sngisdn_process_flc_ind (sngisdn_event_data_t *sngisdn_event) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + int16_t suId = sngisdn_event->suId; + uint32_t suInstId = sngisdn_event->suInstId; + uint32_t spInstId = sngisdn_event->spInstId; + + sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; + ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + + /* Function does not require any info from ssHlEvnt struct for now */ + /* StaEvnt *staEvnt = &sngisdn_event->event.staEvnt; */ + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing FLOW CONTROL IND (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; +} + +void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + int16_t suId = sngisdn_event->suId; + uint32_t suInstId = sngisdn_event->suInstId; + uint32_t spInstId = sngisdn_event->spInstId; + + sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; + ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + + FacEvnt *facEvnt = &sngisdn_event->event.facEvnt; + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing FACILITY IND (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); + + switch (ftdmchan->state) { + case FTDM_CHANNEL_STATE_GET_CALLERID: + /* Update the caller ID Name */ +#if 1 + if (facEvnt->facElmt.facStr.pres) { + uint8_t facility_str[255]; + memcpy(facility_str, (uint8_t*)&facEvnt->facElmt.facStr.val, facEvnt->facElmt.facStr.len); + char retrieved_str[255]; + if (sng_isdn_retrieve_facility_caller_name(facility_str, facEvnt->facElmt.facStr.len, retrieved_str) != FTDM_SUCCESS) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Failed to retrieve Caller Name from Facility IE\n"); + } + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "DYDBG Name is:%s\n", retrieved_str); + } +#endif + + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); + break; + default: + /* We do not support other FACILITY types for now, so do nothing */ + break; + } + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; +} + +void sngisdn_process_sta_cfm (sngisdn_event_data_t *sngisdn_event) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + + int16_t suId = sngisdn_event->suId; + uint32_t suInstId = sngisdn_event->suInstId; + uint32_t spInstId = sngisdn_event->spInstId; + sngisdn_chan_data_t *sngisdn_info = sngisdn_event->sngisdn_info; + ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + + StaEvnt *staEvnt = &sngisdn_event->event.staEvnt; + + uint8_t call_state = 0; + + if (staEvnt->callSte.eh.pres && staEvnt->callSte.callGlblSte.pres) { + call_state = staEvnt->callSte.callGlblSte.val; + } + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing STATUS CONFIRM (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); + + ftdm_assert(!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE), "State change flag pending\n"); + + if (staEvnt->causeDgn[0].eh.pres && staEvnt->causeDgn[0].causeVal.pres) { + if (staEvnt->callSte.eh.pres && staEvnt->callSte.callGlblSte.pres) { + call_state = staEvnt->callSte.callGlblSte.val; + } else { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Received STATUS without call state\n"); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + switch (staEvnt->causeDgn[0].causeVal.val) { + case FTDM_CAUSE_RESPONSE_TO_STATUS_ENQUIRY: + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Status Check OK:%d", call_state); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; + case FTDM_CAUSE_WRONG_CALL_STATE: + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Message incompatible with call state (call_state:%d channel-state:%s cause:%d) (suId:%u suInstId:%u spInstId:%u)\n", call_state, ftdm_channel_state2str(ftdmchan->state), staEvnt->causeDgn[0].causeVal.val, suId, suInstId, spInstId); + break; + case FTDM_CAUSE_RECOVERY_ON_TIMER_EXPIRE: + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Recovery on timer expire (call_state:%d channel-state:%s cause:%d) (suId:%u suInstId:%u spInstId:%u)\n", call_state, ftdm_channel_state2str(ftdmchan->state), staEvnt->causeDgn[0].causeVal.val, suId, suInstId, spInstId); + break; + default: + ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "STATUS CONFIRM (call_state:%d channel-state:%s cause:%d) (suId:%u suInstId:%u spInstId:%u)\n", call_state, ftdm_channel_state2str(ftdmchan->state), staEvnt->causeDgn[0].causeVal.val, suId, suInstId, spInstId); + break; + } + + /* Section 4.3.30 from INT Interface - Service Definition */ + ftdmchan->caller_data.hangup_cause = staEvnt->causeDgn[0].causeVal.val; + + switch(call_state) { + /* Sere ITU-T Q931 for definition of call states */ + case 0: /* Remote switch thinks there are no calls on this channel */ + switch (ftdmchan->state) { + case FTDM_CHANNEL_STATE_COLLECT: + case FTDM_CHANNEL_STATE_DIALING: + case FTDM_CHANNEL_STATE_UP: + sngisdn_set_flag(sngisdn_info, FLAG_REMOTE_ABORT); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + break; + case FTDM_CHANNEL_STATE_TERMINATING: + /* We are in the process of clearing local states, + just make sure we will not send any messages to remote switch */ + sngisdn_set_flag(sngisdn_info, FLAG_REMOTE_ABORT); + break; + case FTDM_CHANNEL_STATE_HANGUP: + /* This cannot happen, state_advance always sets + ftdmchan to STATE_HANGUP_COMPLETE when in STATE_HANGUP + and we called check_for_state_change earlier so something is very wrong here!!! */ + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "How can we we in FTDM_CHANNEL_STATE_HANGUP after checking for state change?\n"); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + break; + case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: + /* We were waiting for remote switch to send RELEASE COMPLETE + but this will not happen, so just clear local state */ + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + break; + case FTDM_CHANNEL_STATE_DOWN: + /* If our local state is down as well, then there is nothing to do */ + break; + default: + ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state)); + break; + } + break; + case 1: + switch (ftdmchan->state) { + case FTDM_CHANNEL_STATE_UP: + /* Remote side is still waiting for our CONNECT message */ + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + ftdm_sched_timer(((sngisdn_span_data_t*)ftdmchan->span->signal_data)->sched, "delayed_connect", 1, sngisdn_delayed_connect, (void*) sngisdn_info, NULL); + break; + } + /* Fall-through */ + default: + ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state)); + break; + } + break; + case 2: /* overlap sending/receiving */ + switch (ftdmchan->state) { + case FTDM_CHANNEL_STATE_COLLECT: + /* T302 Timeout reached */ + /* Send the call to user, and see if they accept it */ + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "T302 Timer expired, proceeding with call\n"); + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RING); + break; + case FTDM_CHANNEL_STATE_PROGRESS: + case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Remote switch expecting OVERLAP receive, but we are already PROCEEDING\n"); + sngisdn_snd_disconnect(ftdmchan); + break; + case FTDM_CHANNEL_STATE_DOWN: + case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: + /* We hung up locally, but remote switch doesn't know send disconnect again*/ + sngisdn_snd_disconnect(ftdmchan); + break; + default: + ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state)); + break; + } + break; + case 3: + switch (ftdmchan->state) { + case FTDM_CHANNEL_STATE_UP: + /* Remote side is still waiting for our CONNECT message */ + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + ftdm_sched_timer(((sngisdn_span_data_t*)ftdmchan->span->signal_data)->sched, "delayed_connect", 1, sngisdn_delayed_connect, (void*) sngisdn_info, NULL); + break; + } + /* Fall-through */ + default: + ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state)); + break; + } + break; + case 8: /* Remote switch is in "Connect Request state" */ + switch (ftdmchan->state) { + case FTDM_CHANNEL_STATE_UP: + /* This is ok. We sent a Connect, and we are waiting for a connect ack */ + /* Do nothing */ + break; + case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: + /* We hung up locally, but remote switch doesn't know send disconnect again*/ + sngisdn_snd_disconnect(ftdmchan); + break; + default: + ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state)); + break; + } + break; + case 10: /* Remote switch is in active state */ + switch (ftdmchan->state) { + case FTDM_CHANNEL_STATE_UP: + /* This is ok, they are in active state and we are in active state */ + /* Do nothing */ + break; + case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: + /* We sent a disconnect message, but remote side missed it ? */ + ftdm_sched_timer(((sngisdn_span_data_t*)ftdmchan->span->signal_data)->sched, "delayed_disconnect", 1, sngisdn_delayed_disconnect, (void*) sngisdn_info, NULL); + break; + default: + ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state)); + break; + } + break; + case 9: + switch (ftdmchan->state) { + case FTDM_CHANNEL_STATE_PROGRESS: + /* Do nothing */ + break; + default: + ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state)); + break; + } + break; + case 22: + switch (ftdmchan->state) { + case FTDM_CHANNEL_STATE_UP: + /* Stack is in the process of clearing the call*/ + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + break; + case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: + /* Do nothing as we will get a RELEASE COMPLETE */ + break; + default: + ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state)); + //ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + break; + } + default: + ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state)); + //ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + break; + } + } + + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; +} + + +void sngisdn_process_srv_ind (sngisdn_event_data_t *sngisdn_event) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + int16_t suId = sngisdn_event->suId; + int16_t dChan = sngisdn_event->dChan; + uint8_t ces = sngisdn_event->ces; + + /* Function does not require any info from ssHlEvnt struct for now */ + /*Srv *srvEvnt = &sngisdn_event->event.srvEvnt;*/ + + ftdm_log(FTDM_LOG_DEBUG, "Processing SERVICE IND (suId:%u dChan:%d ces:%d)\n", suId, dChan, ces); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; +} + +void sngisdn_process_srv_cfm (sngisdn_event_data_t *sngisdn_event) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + int16_t suId = sngisdn_event->suId; + int16_t dChan = sngisdn_event->dChan; + uint8_t ces = sngisdn_event->ces; + + /* Function does not require any info from ssHlEvnt struct for now */ + /*Srv *srvEvnt = &sngisdn_event->event.srvEvnt;*/ + + ftdm_log(FTDM_LOG_DEBUG, "Processing SERVICE CFM (suId:%u dChan:%d ces:%d)\n", suId, dChan, ces); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; +} + +void sngisdn_process_rst_cfm (sngisdn_event_data_t *sngisdn_event) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + int16_t suId = sngisdn_event->suId; + int16_t dChan = sngisdn_event->dChan; + uint8_t ces = sngisdn_event->ces; + uint8_t evntType = sngisdn_event->evntType; + + /* Function does not require any info from ssHlEvnt struct for now */ + /*Rst *rstEvnt = &sngisdn_event->event.rstEvnt;*/ + + ftdm_log(FTDM_LOG_DEBUG, "Processing RESTART CFM (suId:%u dChan:%d ces:%d type:%d)\n", suId, dChan, ces, evntType); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; +} + + +void sngisdn_process_rst_ind (sngisdn_event_data_t *sngisdn_event) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + int16_t suId = sngisdn_event->suId; + int16_t dChan = sngisdn_event->dChan; + uint8_t ces = sngisdn_event->ces; + uint8_t evntType = sngisdn_event->evntType; + + /* Function does not require any info from ssHlEvnt struct for now */ + /*Rst *rstEvnt = &sngisdn_event->event.rstEvnt;*/ + + ftdm_log(FTDM_LOG_DEBUG, "Processing RESTART CFM (suId:%u dChan:%d ces:%d %s)\n", suId, dChan, ces, + (evntType == IN_LNK_DWN)?"LNK_DOWN": + (evntType == IN_LNK_UP)?"LNK_UP": + (evntType == IN_INDCHAN)?"b-channel": + (evntType == IN_LNK_DWN_DM_RLS)?"Nfas service procedures": + (evntType == IN_SWCHD_BU_DCHAN)?"NFAS switchover to backup":"Unknown"); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; +} diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_in.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_in.c deleted file mode 100644 index 04430cf..0000000 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_in.c +++ /dev/null @@ -1,935 +0,0 @@ -/* - * Copyright (c) 2010, Sangoma Technologies - * David Yat Sin <davidy@sangoma.com> - * 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 original author; nor the names of any 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 OWNER - * 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 "ftmod_sangoma_isdn.h" - -extern ftdm_status_t cpy_calling_num_from_sngisdn(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb); -extern ftdm_status_t cpy_called_num_from_sngisdn(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb); -extern ftdm_status_t cpy_called_name_from_sngisdn(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb); -extern ftdm_status_t cpy_calling_name_from_sngisdn(ftdm_caller_data_t *ftdm, ConEvnt *conEvnt); -extern void sngisdn_trace_q921(char* str, uint8_t* data, uint32_t data_len); -extern void sngisdn_trace_q931(char* str, uint8_t* data, uint32_t data_len); -extern void get_memory_info(void); - -extern ftdm_sngisdn_data_t g_sngisdn_data; - -#define MAX_DECODE_STR_LEN 2000 - -/* Remote side transmit a SETUP */ -void sngisdn_rcv_con_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, ConEvnt *conEvnt, int16_t dChan, uint8_t ces) -{ - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - uint8_t bchan_no = 0; - sngisdn_chan_data_t *sngisdn_info; - ftdm_channel_t *ftdmchan; - /*sngisdn_span_data_t *span_info;*/ - - ftdm_log(FTDM_LOG_DEBUG, "%s suId:%d suInstId:%d spInstId:%d dChan:%d ces:%d\n", __FUNCTION__, suId, suInstId, spInstId, dChan, ces); - - ftdm_assert(g_sngisdn_data.ccs[suId].activation_done != 0, "Con Ind on unconfigured cc\n"); - ftdm_assert(g_sngisdn_data.dchans[dChan].num_spans != 0, "Con Ind on unconfigured dchan\n"); - ftdm_assert(g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] == NULL, "Con Ind on busy spInstId"); - - if (conEvnt->chanId.eh.pres != PRSNT_NODEF) { - /* TODO: Implement me */ - ftdm_log(FTDM_LOG_ERROR, "Incoming call without Channel Id not supported yet\n"); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; - } - - if (conEvnt->chanId.chanNmbSlotMap.pres) { - bchan_no = conEvnt->chanId.chanNmbSlotMap.val[0]; - } else if (conEvnt->chanId.infoChanSel.pres) { - bchan_no = conEvnt->chanId.infoChanSel.val; - } - - if (!bchan_no) { - ftdm_log(FTDM_LOG_ERROR, "Failed to obtain b-channel number from SETUP message\n"); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; - } - - if (g_sngisdn_data.dchans[dChan].channels[bchan_no] == NULL) { - ftdm_log(FTDM_LOG_ERROR, "Incoming call on unconfigured b-channel:%d\n", bchan_no); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; - } - - sngisdn_info = g_sngisdn_data.dchans[dChan].channels[bchan_no]; - ftdmchan = sngisdn_info->ftdmchan; - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan) != FTDM_SUCCESS) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Failed to wait for pending state change\n"); - ftdm_mutex_unlock(ftdmchan->mutex); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; - } - - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Received SETUP\n"); - switch (ftdmchan->state){ - case FTDM_CHANNEL_STATE_DOWN: /* Proper state to receive a SETUP */ - sngisdn_info->suInstId = get_unique_suInstId(suId); - sngisdn_info->spInstId = spInstId; - g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] = sngisdn_info; - g_sngisdn_data.ccs[suId].active_suInstIds[sngisdn_info->suInstId] = sngisdn_info; - - /* try to open the channel */ - if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Failed to open channel"); - sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_REL); - ftdmchan->caller_data.hangup_cause = FTDM_CAUSE_NORMAL_TEMPORARY_FAILURE; - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); - } else { - /* Fill in call information */ - cpy_calling_num_from_sngisdn(&ftdmchan->caller_data, &conEvnt->cgPtyNmb); - cpy_called_num_from_sngisdn(&ftdmchan->caller_data, &conEvnt->cdPtyNmb); - cpy_calling_name_from_sngisdn(&ftdmchan->caller_data, conEvnt); - - /* Get ani2 */ -#if 0 - /* TODO: confirm that this works in the field */ - if (conEvnt->niOperSysAcc.eh.pres) { - if (conEvnt->niOperSysAcc.typeAcc.pres) { - ftdmchan->caller_data.aniII = (uint8_t)conEvnt->niOperSysAcc.typeAcc.val; - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Received ANI: type of access:%x", conEvnt->niOperSysAcc.typeAcc.val); - } - if (conEvnt->niOperSysAcc.typeServ.pres) { - ftdmchan->caller_data.aniII = (uint8_t)conEvnt->niOperSysAcc.typeServ.val; - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Received ANI: type of service:%x", conEvnt->niOperSysAcc.typeServ.val); - } - } -#endif - - /* set the state of the channel to collecting...the rest is done by the chan monitor */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); - - } - break; - case FTDM_CHANNEL_STATE_DIALING: /* glare */ - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Received SETUP in DIALING state, glare, queueing incoming call\n"); - /* the flag the channel as having a collision */ - sngisdn_set_flag(sngisdn_info, FLAG_GLARE); - - /* save the SETUP for processing once the channel has gone to DOWN */ - memcpy(&sngisdn_info->glare.setup, conEvnt, sizeof(*conEvnt)); - sngisdn_info->glare.suId = suId; - sngisdn_info->glare.suInstId = suInstId; - sngisdn_info->glare.spInstId = spInstId; - sngisdn_info->glare.dChan = dChan; - sngisdn_info->glare.ces = ces; - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Received SETUP in an invalid state (%s)\n", ftdm_channel_state2str(ftdmchan->state)); - break; - } - ftdm_mutex_unlock(ftdmchan->mutex); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - -/* Remote side transmit a CONNECT or CONNECT ACK */ -void sngisdn_rcv_con_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, CnStEvnt *cnStEvnt, int16_t dChan, uint8_t ces) -{ - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - sngisdn_chan_data_t *sngisdn_info; - ftdm_channel_t *ftdmchan; - - ftdm_log(FTDM_LOG_DEBUG, "%s suId:%d suInstId:%d spInstId:%d dChan:%d ces:%d\n", __FUNCTION__, suId, suInstId, spInstId, dChan, ces); - - - ftdm_assert(g_sngisdn_data.ccs[suId].activation_done != 0, "Con Ind on unconfigured cc\n"); - ftdm_assert(g_sngisdn_data.dchans[dChan].num_spans != 0, "Con Ind on unconfigured dchan\n"); - - if (get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%d suInstId:%d spInstId:%d\n", suId, suInstId, spInstId); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; - } - - ftdmchan = (ftdm_channel_t*)sngisdn_info->ftdmchan; - - if (!sngisdn_info->spInstId) { - sngisdn_info->spInstId = spInstId; - g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] = sngisdn_info; - } - - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Received CONNECT/CONNECT ACK\n"); - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan) != FTDM_SUCCESS) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Failed to wait for pending state change\n"); - ftdm_mutex_unlock(ftdmchan->mutex); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; - } - - if (ftdmchan->span->trunk_type == FTDM_TRUNK_BRI_PTMP && - ((sngisdn_span_data_t*)ftdmchan->span->signal_data)->signalling == SNGISDN_SIGNALING_NET) { - - if(sngisdn_info->ces == CES_MNGMNT) { - /* We assign the call to the first TE */ - sngisdn_info->ces = ces; - } else { - /* We already assigned this call, do nothing */ - ftdm_mutex_unlock(ftdmchan->mutex); - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Call already assigned, ignoring connect\n"); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; - } - } - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - switch(ftdmchan->state) { - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - case FTDM_CHANNEL_STATE_DIALING: - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Received CONNECT/CONNECT ACK in an invalid state (%s)\n", - ftdm_channel_state2str(ftdmchan->state)); - - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - break; - } - } else { - switch(ftdmchan->state) { - case FTDM_CHANNEL_STATE_UP: - /* This is the only valid state we should get a CONNECT ACK on */ - /* do nothing */ - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Received CONNECT/CONNECT ACK in an invalid state (%s)\n", ftdm_channel_state2str(ftdmchan->state)); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - break; - } - } - - ftdm_mutex_unlock(ftdmchan->mutex); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - -void sngisdn_rcv_cnst_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, CnStEvnt *cnStEvnt, uint8_t evntType, int16_t dChan, uint8_t ces) -{ - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - sngisdn_chan_data_t *sngisdn_info; - ftdm_channel_t *ftdmchan; - - ftdm_log(FTDM_LOG_DEBUG, "%s suId:%d suInstId:%d spInstId:%d dChan:%d ces:%d\n", __FUNCTION__, suId, suInstId, spInstId, dChan, ces); - - ftdm_assert(g_sngisdn_data.ccs[suId].activation_done != 0, "Con Ind on unconfigured cc\n"); - ftdm_assert(g_sngisdn_data.dchans[dChan].num_spans != 0, "Con Ind on unconfigured dchan\n"); - - if (get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) != FTDM_SUCCESS) { - ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%d suInstId:%d spInstId:%d\n", suId, suInstId, spInstId); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; - } - - if (!sngisdn_info->spInstId) { - sngisdn_info->spInstId = spInstId; - g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] = sngisdn_info; - } - - ftdmchan = (ftdm_channel_t*)sngisdn_info->ftdmchan; - ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Received %s\n", - (evntType == MI_ALERTING)?"ALERT": - (evntType == MI_CALLPROC)?"PROCEED": - (evntType == MI_PROGRESS)?"PROGRESS":"UNKNOWN"); - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan) != FTDM_SUCCESS) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Failed to wait for pending state change\n"); - ftdm_mutex_unlock(ftdmchan->mutex); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; - } - - switch(ftdmchan->state) { - case FTDM_CHANNEL_STATE_DIALING: - if (evntType == MI_PROGRESS) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); - } else { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); - } - break; - case FTDM_CHANNEL_STATE_PROGRESS: - if (evntType == MI_PROGRESS) { - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); - } - break; - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - /* Do nothing */ - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Received ALERT/PROCEED/PROGRESS in an invalid state (%s)\n", - ftdm_channel_state2str(ftdmchan->state)); - - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - break; - } - - ftdm_mutex_unlock(ftdmchan->mutex); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - -void sngisdn_rcv_disc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, DiscEvnt *discEvnt) -{ - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - sngisdn_chan_data_t *sngisdn_info; - ftdm_channel_t *ftdmchan = NULL; - - ftdm_log(FTDM_LOG_DEBUG, "%s suId:%d suInstId:%d spInstId:%d\n", __FUNCTION__, suId, suInstId, spInstId); - - ftdm_assert(spInstId != 0, "Received DISCONNECT with invalid id"); - - if (spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) { - ftdmchan = (ftdm_channel_t*)sngisdn_info->ftdmchan; - } else if (suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS) { - ftdmchan = (ftdm_channel_t*)sngisdn_info->ftdmchan; - } else { - ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%d suInstId:%d spInstId:%d\n", suId, suInstId, spInstId); - return; - } - - if (!sngisdn_info->spInstId) { - sngisdn_info->spInstId = spInstId; - g_sngisdn_data.ccs[suId].active_spInstIds[spInstId] = sngisdn_info; - } - - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Received DISCONNECT\n"); - ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan) != FTDM_SUCCESS) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Failed to wait for pending state change\n"); - ftdm_mutex_unlock(ftdmchan->mutex); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; - } - - switch (ftdmchan->state) { - case FTDM_CHANNEL_STATE_RING: - case FTDM_CHANNEL_STATE_DIALING: - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - case FTDM_CHANNEL_STATE_COLLECT: - case FTDM_CHANNEL_STATE_UP: - if (discEvnt->causeDgn[0].eh.pres && discEvnt->causeDgn[0].causeVal.pres) { - ftdmchan->caller_data.hangup_cause = discEvnt->causeDgn[0].causeVal.val; - } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "DISCONNECT did not have a cause code\n"); - ftdmchan->caller_data.hangup_cause = 0; - } - sngisdn_set_flag(sngisdn_info, FLAG_REMOTE_REL); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Received DISCONNECT in an invalid state (%s)\n", - ftdm_channel_state2str(ftdmchan->state)); - /* start reset procedure */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - break; - } - - ftdm_mutex_unlock(ftdmchan->mutex); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - -void sngisdn_rcv_rel_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, RelEvnt *relEvnt) -{ - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - ftdm_log(FTDM_LOG_DEBUG, "%s suId:%d suInstId:%d spInstId:%d\n", __FUNCTION__, suId, suInstId, spInstId); - - sngisdn_chan_data_t *sngisdn_info ; - ftdm_channel_t *ftdmchan = NULL; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (suInstId && (get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { - ftdmchan = sngisdn_info->ftdmchan; - } else if (spInstId && (get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS)) { - ftdmchan = sngisdn_info->ftdmchan; - } - - if (ftdmchan == NULL) { - ftdm_log(FTDM_LOG_CRIT, "Failed to find matching channel suId:%d suInstId:%d spInstId:%d\n", suId, suInstId, spInstId); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; - } - - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Received RELEASE/RELEASE COMPLETE\n"); - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Failed to wait for pending state change\n"); - ftdm_mutex_unlock(ftdmchan->mutex); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; - }; - - /* check whether the ftdm channel is in a state to accept a call */ - switch (ftdmchan->state) { - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - /* go to DOWN */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - break; - case FTDM_CHANNEL_STATE_DOWN: - /* do nothing, just drop the message */ - break; - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - /* Remote side sent a SETUP, then a RELEASE COMPLETE to abort call - this is an abort */ - sngisdn_set_flag(sngisdn_info, FLAG_REMOTE_ABORT); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - break; - case FTDM_CHANNEL_STATE_DIALING: - /* Remote side rejected our SETUP message on outbound call */ - sngisdn_set_flag(sngisdn_info, FLAG_REMOTE_ABORT); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - break; - case FTDM_CHANNEL_STATE_UP: - sngisdn_set_flag(sngisdn_info, FLAG_REMOTE_ABORT); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - break; - default: - /* Should just stop the call...but a reset is easier for now (since it does hangup the call) */ - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Received RELEASE in an invalid state (%s)\n", - ftdm_channel_state2str(ftdmchan->state)); - - /* go to RESTART */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - - break; - /**************************************************************************/ - } - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - -void sngisdn_rcv_dat_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, InfoEvnt *infoEvnt) -{ - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - ftdm_log(FTDM_LOG_INFO, "Received DATA IND suId:%d suInstId:%d spInstId:%d\n", suId, suInstId, spInstId); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - -void sngisdn_rcv_sshl_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, SsHlEvnt *ssHlEvnt, uint8_t action) -{ - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - ftdm_log(FTDM_LOG_INFO, "Received SSHL IND suId:%d suInstId:%d spInstId:%d\n", suId, suInstId, spInstId); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - -void sngisdn_rcv_sshl_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, SsHlEvnt *ssHlEvnt, uint8_t action) -{ - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - ftdm_log(FTDM_LOG_INFO, "Received SSHL CFM suId:%d suInstId:%d spInstId:%d\n", suId, suInstId, spInstId); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - -void sngisdn_rcv_rmrt_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, RmRtEvnt *rmRtEvnt, uint8_t action) -{ - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - ftdm_log(FTDM_LOG_INFO, "Received RESUME/RETRIEVE ind suId:%d suInstId:%d spInstId:%d\n", suId, suInstId, spInstId); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - -void sngisdn_rcv_rmrt_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, RmRtEvnt *rmRtEvnt, uint8_t action) -{ - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - ftdm_log(FTDM_LOG_INFO, "Received RESUME/RETRIEVE CFM suId:%d suInstId:%d spInstId:%d\n", suId, suInstId, spInstId); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - -void sngisdn_rcv_flc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, StaEvnt *staEvnt) -{ - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - ftdm_log(FTDM_LOG_INFO, "Received FLOW CONTROL IND suId:%d suInstId:%d spInstId:%d\n", suId, suInstId, spInstId); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - -void sngisdn_rcv_fac_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, FacEvnt *facEvnt, uint8_t evntType, int16_t dChan, uint8_t ces) -{ - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - ftdm_log(FTDM_LOG_INFO, "Received FACILITY IND suId:%d suInstId:%d spInstId:%d\n", suId, suInstId, spInstId); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - -void sngisdn_rcv_sta_cfm ( int16_t suId, uint32_t suInstId, uint32_t spInstId, StaEvnt *staEvnt) -{ - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - ftdm_log(FTDM_LOG_DEBUG, "%s suId:%d suInstId:%d spInstId:%d\n", __FUNCTION__, suId, suInstId, spInstId); - - sngisdn_chan_data_t *sngisdn_info ; - ftdm_channel_t *ftdmchan = NULL; - uint8_t call_state = 0; - - if (staEvnt->callSte.eh.pres && staEvnt->callSte.callGlblSte.pres) { - call_state = staEvnt->callSte.callGlblSte.val; - } - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (suInstId && (get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { - ftdmchan = sngisdn_info->ftdmchan; - } else if (spInstId && (get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS)) { - ftdmchan = sngisdn_info->ftdmchan; - } - - if (ftdmchan == NULL) { - ftdm_log(FTDM_LOG_CRIT, "Failed to find matching channel suId:%d suInstId:%d spInstId:%d\n", suId, suInstId, spInstId); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; - } - - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Received STATUS CONFIRM\n"); - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "Failed to wait for pending state change\n"); - ftdm_mutex_unlock(ftdmchan->mutex); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; - }; - - if (staEvnt->causeDgn[0].eh.pres && staEvnt->causeDgn[0].causeVal.pres) { - if (staEvnt->causeDgn[0].causeVal.val != 30) { - - if (staEvnt->callSte.eh.pres && staEvnt->callSte.callGlblSte.pres) { - call_state = staEvnt->callSte.callGlblSte.val; - /* Section 4.3.30 from INT Interface - Service Definition */ - ftdmchan->caller_data.hangup_cause = staEvnt->causeDgn[0].causeVal.val; - - - /* There is incompatibility between local and remote side call states some Q931 msgs probably got lost - initiate disconnect */ - ftdm_log_chan(ftdmchan, FTDM_LOG_WARNING, "Incompatible call states detected, remote side indicated state:%d our state:%s cause:%d\n", call_state, ftdm_channel_state2str(ftdmchan->state), staEvnt->causeDgn[0].causeVal.val); - - switch(call_state) { - /* Sere ITU-T Q931 for definition of call states */ - case 0: /* Remote switch thinks there are no calls on this channel */ - switch (ftdmchan->state) { - case FTDM_CHANNEL_STATE_COLLECT: - case FTDM_CHANNEL_STATE_DIALING: - sngisdn_set_flag(sngisdn_info, FLAG_REMOTE_ABORT); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - break; - case FTDM_CHANNEL_STATE_TERMINATING: - /* We are in the process of clearing local states, - just make sure we will not send any messages to remote switch */ - sngisdn_set_flag(sngisdn_info, FLAG_REMOTE_ABORT); - break; - case FTDM_CHANNEL_STATE_HANGUP: - /* This cannot happen, state_advance always sets - ftdmchan to STATE_HANGUP_COMPLETE when in STATE_HANGUP - and we called check_for_state_change earlier so something is very wrong here!!! */ - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "How can we we in FTDM_CHANNEL_STATE_HANGUP after checking for state change?\n"); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - break; - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - /* We were waiting for remote switch to send RELEASE COMPLETE - but this will not happen, so just clear local state */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - break; - case FTDM_CHANNEL_STATE_DOWN: - /* If our local state is down as well, then there is nothing to do */ - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state)); - break; - } - break; - case 8: /* Remote switch is in "Connect Request state" */ - switch (ftdmchan->state) { - case FTDM_CHANNEL_STATE_UP: - /* This is ok. We sent a Connect, and we are waiting for a connect ack */ - /* Do nothing */ - break; - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - /* We hung up locally, but remote switch doesn't know send disconnect again*/ - sngisdn_snd_disconnect(ftdmchan); - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state)); - break; - } - break; - default: - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Don't know how to handle incompatible state. remote call state:%d our state:%s\n", call_state, ftdm_channel_state2str(ftdmchan->state)); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - break; - } - } else { - ftdmchan->caller_data.hangup_cause = staEvnt->causeDgn[0].causeVal.val; - /* We could not extract the call state */ - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Incompatible call states detected, but could not determine call (cause:%d)\n", ftdmchan->caller_data.hangup_cause); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - } - - } - /**************************************************************************/ - } - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - -void sngisdn_rcv_srv_ind ( int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces) -{ - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - ftdm_log(FTDM_LOG_INFO, "Received SERVICE IND suId:%d dChan:%d ces:%d\n", suId, dChan, ces); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - -void sngisdn_rcv_srv_cfm ( int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces) -{ - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - ftdm_log(FTDM_LOG_INFO, "Received SERVICE CFM suId:%d dChan:%d ces:%d\n", suId, dChan, ces); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - -void sngisdn_rcv_rst_ind (int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces, uint8_t evtType) -{ - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - ftdm_log(FTDM_LOG_INFO, "Received RESTART IND suId:%d dChan:%d ces:%d\n", suId, dChan, ces); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - - -void sngisdn_rcv_rst_cfm ( int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces, uint8_t evtType) -{ - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - ftdm_log(FTDM_LOG_INFO, "Received RESTART CFM suId:%d dChan:%d ces:%d\n", suId, dChan, ces); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - -void sngisdn_rcv_phy_ind(SuId suId, Reason reason) -{ - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - ftdm_log(FTDM_LOG_INFO, "[SNGISDN PHY] D-chan %d : %s\n", suId, DECODE_LL1_REASON(reason)); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - -void sngisdn_rcv_q921_ind(BdMngmt *status) -{ - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - - unsigned j,k; - ftdm_span_t *ftdmspan = NULL; - - for(j=1;j<=g_sngisdn_data.num_dchan;j++) { - for(k=1;k<=g_sngisdn_data.dchans[j].num_spans;k++) { - if (g_sngisdn_data.dchans[j].spans[k]->link_id == status->t.usta.lnkNmb) { - ftdmspan = (ftdm_span_t*)g_sngisdn_data.dchans[j].spans[k]->ftdm_span; - } - } - } - if (ftdmspan == NULL) { - ftdm_log(FTDM_LOG_CRIT, "Received q921 status on unconfigured span\n", status->t.usta.lnkNmb); -#ifdef DEBUG_MODE - FORCE_SEGFAULT -#endif - return; - } - - switch (status->t.usta.alarm.category) { - case (LCM_CATEGORY_INTERFACE): - ftdm_log(FTDM_LOG_INFO, "[SNGISDN Q921] %s: %s: %s(%d): %s(%d)\n", - ftdmspan->name, - DECODE_LCM_CATEGORY(status->t.usta.alarm.category), - DECODE_LCM_EVENT(status->t.usta.alarm.event), status->t.usta.alarm.event, - DECODE_LCM_CAUSE(status->t.usta.alarm.cause), status->t.usta.alarm.cause); - break; - default: - ftdm_log(FTDM_LOG_INFO, "[SNGISDN Q921] %s: %s: %s(%d): %s(%d)\n", - ftdmspan->name, - DECODE_LCM_CATEGORY(status->t.usta.alarm.category), - DECODE_LLD_EVENT(status->t.usta.alarm.event), status->t.usta.alarm.event, - DECODE_LLD_CAUSE(status->t.usta.alarm.cause), status->t.usta.alarm.cause); - break; - } - - ISDN_FUNC_TRACE_EXIT(__FUNCTION__) - return; -} -void sngisdn_rcv_q931_ind(InMngmt *status) -{ - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - - - - ftdm_span_t *ftdmspan = NULL; - - if (status->t.usta.alarm.cause == 287) { - get_memory_info(); - return; - } - - switch (status->t.usta.alarm.category) { - case (LCM_CATEGORY_INTERFACE): - ftdm_log(FTDM_LOG_WARNING, "[SNGISDN Q931] s%d: %s: %s(%d): %s(%d)\n", - status->t.usta.suId, - DECODE_LCM_CATEGORY(status->t.usta.alarm.category), - DECODE_LCM_EVENT(status->t.usta.alarm.event), status->t.usta.alarm.event, - DECODE_LCM_CAUSE(status->t.usta.alarm.cause), status->t.usta.alarm.cause); - - /* clean this up later */ - - switch (status->t.usta.alarm.event) { - case LCM_EVENT_UP: - case LCM_EVENT_DOWN: - { - unsigned j,k; - for(j=1;j<=g_sngisdn_data.num_dchan;j++) { - for(k=1;k<=g_sngisdn_data.dchans[j].num_spans;k++) { - if (g_sngisdn_data.dchans[j].spans[k]->link_id == status->t.usta.suId) { - ftdmspan = (ftdm_span_t*)g_sngisdn_data.dchans[j].spans[k]->ftdm_span; - } - } - } - - if (ftdmspan == NULL) { - ftdm_log(FTDM_LOG_CRIT, "Received q931 LCM EVENT on unconfigured span (suId:%d)\n", status->t.usta.suId); - return; - } - - sngisdn_set_span_sig_status(ftdmspan, (status->t.usta.alarm.event == LCM_EVENT_UP)?FTDM_SIG_STATE_UP:FTDM_SIG_STATE_DOWN); - } - break; - } - break; - default: - ftdm_log(FTDM_LOG_DEBUG, "[SNGISDN Q931] s%d: %s: %s(%d): %s(%d)\n", - status->t.usta.suId, - DECODE_LCM_CATEGORY(status->t.usta.alarm.category), - DECODE_LCM_EVENT(status->t.usta.alarm.event), status->t.usta.alarm.event, - DECODE_LCM_CAUSE(status->t.usta.alarm.cause), status->t.usta.alarm.cause); - break; - } - - - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - -void sngisdn_rcv_cc_ind(CcMngmt *status) -{ - ISDN_FUNC_TRACE_ENTER(__FUNCTION__); - ftdm_log(FTDM_LOG_INFO, "RECEIVED %s\n", __FUNCTION__); - ISDN_FUNC_TRACE_EXIT(__FUNCTION__); - return; -} - -#define Q931_TRC_EVENT(event) (event == TL3PKTTX)?"TX": \ - (event == TL3PKTRX)?"RX":"UNKNOWN" - -void sngisdn_rcv_q931_trace(InMngmt *trc, Buffer *mBuf) -{ - MsgLen mlen; - MsgLen i; - int16_t j; - Buffer *tmp; - Data *cptr; - uint8_t data; - uint8_t tdata[1000]; - char *data_str = ftdm_calloc(1,MAX_DECODE_STR_LEN); /* TODO Find a proper size */ - - ftdm_assert(mBuf != NULLP, "Received a Q931 trace with no buffer"); - mlen = ((SsMsgInfo*)(mBuf->b_rptr))->len; - - if (mlen != 0) { - tmp = mBuf->b_cont; - cptr = tmp->b_rptr; - data = *cptr++; - i = 0; - - for(j=0;j<mlen;j++) { - tdata[j]= data; - - if (cptr == tmp->b_wptr) { - tmp = tmp->b_cont; - if (tmp) cptr = tmp->b_rptr; - } - data = *cptr++; - } - - sngisdn_trace_q931(data_str, tdata, mlen); - ftdm_log(FTDM_LOG_INFO, "[SNGISDN Q931] FRAME %s:%s\n", Q931_TRC_EVENT(trc->t.trc.evnt), data_str); - } - - ftdm_safe_free(data_str); - /* We do not need to free mBuf in this case because stack does it */ - /* SPutMsg(mBuf); */ - return; -} - - -#define Q921_TRC_EVENT(event) (event == TL2FRMRX)?"RX": \ - (event == TL2FRMTX)?"TX": \ - (event == TL2TMR)?"TMR EXPIRED":"UNKNOWN" - -void sngisdn_rcv_q921_trace(BdMngmt *trc, Buffer *mBuf) -{ - MsgLen mlen; - MsgLen i; - int16_t j; - Buffer *tmp; - Data *cptr; - uint8_t data; - uint8_t tdata[16]; - char *data_str = ftdm_calloc(1,200); /* TODO Find a proper size */ - - - if (trc->t.trc.evnt == TL2TMR) { - goto end_of_trace; - } - - ftdm_assert(mBuf != NULLP, "Received a Q921 trace with no buffer"); - mlen = ((SsMsgInfo*)(mBuf->b_rptr))->len; - - if (mlen != 0) { - tmp = mBuf->b_cont; - cptr = tmp->b_rptr; - data = *cptr++; - i = 0; - while (i < mlen) { - j = 0; - for(j=0;j<16;j++) { - if (i<mlen) { - tdata[j]= data; - - if (cptr == tmp->b_wptr) { - tmp = tmp->b_cont; - if (tmp) cptr = tmp->b_rptr; - } - i++; - if (i<mlen) data = *cptr++; - } - } - - } - sngisdn_trace_q921(data_str, tdata, mlen); - ftdm_log(FTDM_LOG_INFO, "[SNGISDN Q921] FRAME %s:%s\n", Q921_TRC_EVENT(trc->t.trc.evnt), data_str); - } -end_of_trace: - ftdm_safe_free(data_str); - SPutMsg(mBuf); - return; -} - - - -void sngisdn_rcv_sng_log(uint8_t level, char *fmt,...) -{ - char *data; - int ret; - va_list ap; - - va_start(ap, fmt); - ret = ftdm_vasprintf(&data, fmt, ap); - if (ret == -1) { - return; - } - - switch (level) { - case SNG_LOGLEVEL_DEBUG: - ftdm_log(FTDM_LOG_DEBUG, "sng_isdn->%s", data); - break; - case SNG_LOGLEVEL_WARN: - ftdm_log(FTDM_LOG_INFO, "sng_isdn->%s", data); - break; - case SNG_LOGLEVEL_INFO: - ftdm_log(FTDM_LOG_INFO, "sng_isdn->%s", data); - break; - case SNG_LOGLEVEL_STATS: - ftdm_log(FTDM_LOG_INFO, "sng_isdn->%s", data); - break; - case SNG_LOGLEVEL_ERROR: - ftdm_log(FTDM_LOG_ERROR, "sng_isdn->%s", data); -#ifdef DEBUG_MODE - FORCE_SEGFAULT -#endif - break; - case SNG_LOGLEVEL_CRIT: - ftdm_log(FTDM_LOG_CRIT, "sng_isdn->%s", data); -#ifdef DEBUG_MODE - FORCE_SEGFAULT -#endif - break; - default: - ftdm_log(FTDM_LOG_INFO, "sng_isdn->%s", data); - break; - } - return; -} - -/* For Emacs: - * Local Variables: - * mode:c - * indent-tabs-mode:t - * tab-width:4 - * c-basic-offset:4 - * End: - * For VIM: - * vim:set softtabstop=4 shiftwidth=4 tabstop=4: - */ - -/******************************************************************************/ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index c5e986b..8247735 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -43,7 +43,7 @@ void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan); void sngisdn_snd_progress(ftdm_channel_t *ftdmchan); void sngisdn_snd_connect(ftdm_channel_t *ftdmchan); void sngisdn_snd_disconnect(ftdm_channel_t *ftdmchan); -void sngisdn_snd_release(ftdm_channel_t *ftdmchan); +void sngisdn_snd_release(ftdm_channel_t *ftdmchan, uint8_t glare); void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) @@ -52,11 +52,15 @@ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Sending SETUP\n"); - + ftdm_assert((!sngisdn_info->suInstId && !sngisdn_info->spInstId), "Trying to call out, but call data was not cleared\n"); + sngisdn_info->suInstId = get_unique_suInstId(signal_data->cc_id); sngisdn_info->spInstId = 0; + ftdm_mutex_lock(g_sngisdn_data.ccs[signal_data->cc_id].mutex); + g_sngisdn_data.ccs[signal_data->cc_id].active_suInstIds[sngisdn_info->suInstId] = sngisdn_info; + ftdm_mutex_unlock(g_sngisdn_data.ccs[signal_data->cc_id].mutex); + memset(&conEvnt, 0, sizeof(conEvnt)); conEvnt.bearCap[0].eh.pres = PRSNT_NODEF; @@ -92,18 +96,21 @@ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) conEvnt.chanId.infoChanSel.val = ftdmchan->physical_chan_id; } else { /* PRI only params */ + if (signal_data->switchtype == SNGISDN_SWITCH_EUROISDN) { conEvnt.bearCap[0].usrInfoLyr1Prot.pres = PRSNT_NODEF; - conEvnt.bearCap[0].usrInfoLyr1Prot.val = IN_UIL1_G711ULAW; + conEvnt.bearCap[0].usrInfoLyr1Prot.val = IN_UIL1_G711ALAW; } else { conEvnt.bearCap[0].usrInfoLyr1Prot.pres = PRSNT_NODEF; - conEvnt.bearCap[0].usrInfoLyr1Prot.val = IN_UIL1_G711ALAW; + conEvnt.bearCap[0].usrInfoLyr1Prot.val = IN_UIL1_G711ULAW; } conEvnt.bearCap[0].lyr1Ident.pres = PRSNT_NODEF; conEvnt.bearCap[0].lyr1Ident.val = IN_L1_IDENT; conEvnt.chanId.intType.pres = PRSNT_NODEF; conEvnt.chanId.intType.val = IN_IT_OTHER; + conEvnt.chanId.infoChanSel.pres = PRSNT_NODEF; + conEvnt.chanId.infoChanSel.val = IN_ICS_B1CHAN; conEvnt.chanId.chanMapType.pres = PRSNT_NODEF; conEvnt.chanId.chanMapType.val = IN_CMT_BCHAN; conEvnt.chanId.nmbMap.pres = PRSNT_NODEF; @@ -130,20 +137,81 @@ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) signal_data->signalling == SNGISDN_SIGNALING_NET) { sngisdn_info->ces = CES_MNGMNT; } - - cpy_calling_num_to_sngisdn(&conEvnt.cgPtyNmb, &ftdmchan->caller_data); + cpy_called_num_to_sngisdn(&conEvnt.cdPtyNmb, &ftdmchan->caller_data); + cpy_calling_num_to_sngisdn(&conEvnt.cgPtyNmb, &ftdmchan->caller_data); cpy_calling_name_to_sngisdn(&conEvnt, ftdmchan); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending con request on suId:%d suInstId:%u spInstId:%u\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending SETUP (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); if (sng_isdn_con_request(signal_data->cc_id, sngisdn_info->suInstId, &conEvnt, signal_data->dchan_id, sngisdn_info->ces)) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused SETUP request\n"); } + return; } -/* Used only for BRI PTMP */ +/* Unsed only for overlap receive */ +void sngisdn_snd_setup_ack(ftdm_channel_t *ftdmchan) +{ + CnStEvnt cnStEvnt; + + sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + + if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending SETUP ACK , but no call data, aborting (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); + sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + return; + } + + memset(&cnStEvnt, 0, sizeof(cnStEvnt)); + + cnStEvnt.chanId.eh.pres = PRSNT_NODEF; + cnStEvnt.chanId.prefExc.pres = PRSNT_NODEF; + cnStEvnt.chanId.prefExc.val = IN_PE_EXCLSVE; + cnStEvnt.chanId.dChanInd.pres = PRSNT_NODEF; + cnStEvnt.chanId.dChanInd.val = IN_DSI_NOTDCHAN; + cnStEvnt.chanId.intIdentPres.pres = PRSNT_NODEF; + cnStEvnt.chanId.intIdentPres.val = IN_IIP_IMPLICIT; + + + if (ftdmchan->span->trunk_type == FTDM_TRUNK_BRI || + ftdmchan->span->trunk_type == FTDM_TRUNK_BRI_PTMP) { + + /* BRI only params */ + cnStEvnt.chanId.intType.pres = PRSNT_NODEF; + cnStEvnt.chanId.intType.val = IN_IT_BASIC; + cnStEvnt.chanId.infoChanSel.pres = PRSNT_NODEF; + cnStEvnt.chanId.infoChanSel.val = ftdmchan->physical_chan_id; + } else { + cnStEvnt.chanId.intType.pres = PRSNT_NODEF; + cnStEvnt.chanId.intType.val = IN_IT_OTHER; + cnStEvnt.chanId.infoChanSel.pres = PRSNT_NODEF; + cnStEvnt.chanId.infoChanSel.val = IN_ICS_B1CHAN; + cnStEvnt.chanId.chanMapType.pres = PRSNT_NODEF; + cnStEvnt.chanId.chanMapType.val = IN_CMT_BCHAN; + cnStEvnt.chanId.nmbMap.pres = PRSNT_NODEF; + cnStEvnt.chanId.nmbMap.val = IN_NM_CHNNMB; + cnStEvnt.chanId.codeStand1.pres = PRSNT_NODEF; + cnStEvnt.chanId.codeStand1.val = IN_CSTD_CCITT; + cnStEvnt.chanId.chanNmbSlotMap.pres = PRSNT_NODEF; + cnStEvnt.chanId.chanNmbSlotMap.len = 1; + cnStEvnt.chanId.chanNmbSlotMap.val[0] = ftdmchan->physical_chan_id; + } + + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending SETUP ACK (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); + + if(sng_isdn_con_status(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &cnStEvnt, MI_SETUPACK, signal_data->dchan_id, sngisdn_info->ces)) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused SETUP ACK request\n"); + } + return; +} + + +/* Used only for BRI PTMP - This function is used when the NT side makes a call out, + and one or multiple TE's reply, then NT assigns the call by sending a con_complete*/ void sngisdn_snd_con_complete(ftdm_channel_t *ftdmchan) { CnStEvnt cnStEvnt; @@ -151,9 +219,15 @@ void sngisdn_snd_con_complete(ftdm_channel_t *ftdmchan) sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending CONNECT COMPL , but no call data, aborting (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); + sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + return; + } + memset(&cnStEvnt, 0, sizeof(cnStEvnt)); - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Sending CONNECT ACK\n"); - + cnStEvnt.chanId.eh.pres = PRSNT_NODEF; cnStEvnt.chanId.prefExc.pres = PRSNT_NODEF; cnStEvnt.chanId.prefExc.val = IN_PE_EXCLSVE; @@ -187,7 +261,7 @@ void sngisdn_snd_con_complete(ftdm_channel_t *ftdmchan) } - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending connect ACK on suId:%d suInstId:%u spInstId:%u ces:%d\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, sngisdn_info->ces); + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending CONNECT COMPL (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); if(sng_isdn_con_comp(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &cnStEvnt, signal_data->dchan_id, sngisdn_info->ces)) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused CONNECT ACK request\n"); @@ -203,9 +277,15 @@ void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan) sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending PROGRESS, but no call data, aborting (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); + sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + return; + } + memset(&cnStEvnt, 0, sizeof(cnStEvnt)); - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Sending PROCEED\n"); - + cnStEvnt.chanId.eh.pres = PRSNT_NODEF; cnStEvnt.chanId.prefExc.pres = PRSNT_NODEF; cnStEvnt.chanId.prefExc.val = IN_PE_EXCLSVE; @@ -239,7 +319,7 @@ void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan) } - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending con status on suId:%d suInstId:%u spInstId:%u\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending PROCEED (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); if(sng_isdn_con_status(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &cnStEvnt, MI_CALLPROC, signal_data->dchan_id, sngisdn_info->ces)) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused PROCEED request\n"); @@ -254,9 +334,20 @@ void sngisdn_snd_progress(ftdm_channel_t *ftdmchan) sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - memset(&cnStEvnt, 0, sizeof(cnStEvnt)); - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Sending PROGRESS\n"); + if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending PROGRESS, but no call data, aborting (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); + sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + return; + } + + if (signal_data->switchtype == SNGISDN_SWITCH_INSNET) { + /* Trillium Q931 layer complains of invalid event when receiving PROGRESS in + INSNET variant, so PROGRESS event is probably invalid */ + return; + } + memset(&cnStEvnt, 0, sizeof(cnStEvnt)); cnStEvnt.progInd.eh.pres = PRSNT_NODEF; cnStEvnt.progInd.location.pres = PRSNT_NODEF; @@ -264,9 +355,9 @@ void sngisdn_snd_progress(ftdm_channel_t *ftdmchan) cnStEvnt.progInd.codeStand0.pres = PRSNT_NODEF; cnStEvnt.progInd.codeStand0.val = IN_CSTD_CCITT; cnStEvnt.progInd.progDesc.pres = PRSNT_NODEF; - cnStEvnt.progInd.progDesc.val = IN_PD_NOTETEISDN; + cnStEvnt.progInd.progDesc.val = IN_PD_IBAVAIL; - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending con status on suId:%d suInstId:%u spInstId:%u\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending PROGRESS (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); if(sng_isdn_con_status(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId,&cnStEvnt, MI_PROGRESS, signal_data->dchan_id, sngisdn_info->ces)) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused PROGRESS request\n"); } @@ -280,7 +371,12 @@ void sngisdn_snd_alert(ftdm_channel_t *ftdmchan) sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Sending ALERT\n"); + if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending ALERT, but no call data, aborting (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); + sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + return; + } memset(&cnStEvnt, 0, sizeof(cnStEvnt)); @@ -292,7 +388,7 @@ void sngisdn_snd_alert(ftdm_channel_t *ftdmchan) cnStEvnt.progInd.progDesc.pres = PRSNT_NODEF; cnStEvnt.progInd.progDesc.val = IN_PD_NOTETEISDN; - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending con status on suId:%d suInstId:%u spInstId:%u\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending ALERT (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); if(sng_isdn_con_status(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId,&cnStEvnt, MI_ALERTING, signal_data->dchan_id, sngisdn_info->ces)) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused ALERT request\n"); @@ -307,8 +403,13 @@ void sngisdn_snd_connect(ftdm_channel_t *ftdmchan) sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Sending CONNECT\n"); - + if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending CONNECT, but no call data, aborting (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); + sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + return; + } + memset(&cnStEvnt, 0, sizeof(cnStEvnt)); @@ -344,21 +445,75 @@ void sngisdn_snd_connect(ftdm_channel_t *ftdmchan) cnStEvnt.chanId.chanNmbSlotMap.val[0] = ftdmchan->physical_chan_id; } - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending con response on suId:%d suInstId:%u spInstId:%u\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending CONNECT (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); if (sng_isdn_con_response(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &cnStEvnt, signal_data->dchan_id, sngisdn_info->ces)) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused CONNECT request\n"); } return; } + +void sngisdn_snd_info_req(ftdm_channel_t *ftdmchan) +{ + CnStEvnt cnStEvnt; + + sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + + if (ftdmchan->span->trunk_type != FTDM_TRUNK_BRI && + ftdmchan->span->trunk_type != FTDM_TRUNK_BRI_PTMP) { + + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Ignoring INFO REQ on non-BRI channel\n"); + return; + } + + memset(&cnStEvnt, 0, sizeof(cnStEvnt)); + //ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Sending INFO REQ\n"); + + + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending INFO REQ (suId:%d dchan:%d ces:%d)\n", signal_data->cc_id, signal_data->dchan_id, sngisdn_info->ces); + + if (sng_isdn_con_status(signal_data->cc_id, 0, 0, &cnStEvnt, MI_INFO, signal_data->dchan_id, sngisdn_info->ces)) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused INFO request\n"); + } + return; +} + + +void sngisdn_snd_status_enq(ftdm_channel_t *ftdmchan) +{ + StaEvnt staEvnt; + + sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + + //ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Sending STATUS ENQ\n"); + + memset(&staEvnt, 0, sizeof(StaEvnt)); + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending Status ENQ on suId:%d suInstId:%u spInstId:%d dchan:%d ces:%d\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); + if (sng_isdn_status_request(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &staEvnt, MI_STATENQ)) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused Status ENQ request\n"); + } + return; +} + + void sngisdn_snd_disconnect(ftdm_channel_t *ftdmchan) { DiscEvnt discEvnt; - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Sending DISCONNECT\n"); sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + if (!sngisdn_info->suInstId || !sngisdn_info->spInstId) { + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending DISCONNECT, but no call data, aborting (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); + + sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); + return; + } + memset(&discEvnt, 0, sizeof(discEvnt)); /* Fill discEvnt here */ @@ -372,20 +527,28 @@ void sngisdn_snd_disconnect(ftdm_channel_t *ftdmchan) discEvnt.causeDgn[0].recommend.pres = NOTPRSNT; discEvnt.causeDgn[0].dgnVal.pres = NOTPRSNT; - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending disc request on suId:%d suInstId:%u spInstId:%u\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending DISCONNECT (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); if (sng_isdn_disc_request(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &discEvnt)) { ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused DISCONNECT request\n"); } return; } -void sngisdn_snd_release(ftdm_channel_t *ftdmchan) +void sngisdn_snd_release(ftdm_channel_t *ftdmchan, uint8_t glare) { RelEvnt relEvnt; - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Sending RELEASE/RELEASE COMPLETE\n"); + uint32_t suInstId, spInstId; sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*) ftdmchan->call_data; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + if (!sngisdn_info->suInstId) { + ftdm_log_chan(ftdmchan, FTDM_LOG_ERROR, "Sending RELEASE, but no call data, aborting (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); + + sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); + return; + } + memset(&relEvnt, 0, sizeof(relEvnt)); /* Fill discEvnt here */ @@ -400,20 +563,25 @@ void sngisdn_snd_release(ftdm_channel_t *ftdmchan) relEvnt.causeDgn[0].recommend.pres = NOTPRSNT; relEvnt.causeDgn[0].dgnVal.pres = NOTPRSNT; - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending release request on suId:%d suInstId:%u spInstId:%u\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); - - if (sng_isdn_release_request(signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, &relEvnt)) { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused RELEASE/RELEASE COMPLETE request\n"); - } - return; -} + if (glare) { + suInstId = sngisdn_info->glare.suInstId; + spInstId = sngisdn_info->glare.spInstId; + } else { + suInstId = sngisdn_info->suInstId; + spInstId = sngisdn_info->spInstId; + } + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending RELEASE/RELEASE COMPLETE (suId:%d suInstId:%u spInstId:%u)\n", signal_data->cc_id, suInstId, spInstId); -void sngisdn_snd_reset(ftdm_channel_t *ftdmchan) -{ - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Sending RESET\n"); - ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "%s not implemented\n", __FUNCTION__); - /* TODO: implement me */ + if (glare) { + if (sng_isdn_release_request(signal_data->cc_id, suInstId, spInstId, &relEvnt)) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused RELEASE/RELEASE COMPLETE request\n"); + } + } else { + if (sng_isdn_release_request(signal_data->cc_id, suInstId, spInstId, &relEvnt)) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "stack refused RELEASE/RELEASE COMPLETE request\n"); + } + } return; } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c new file mode 100644 index 0000000..1c49674 --- /dev/null +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c @@ -0,0 +1,901 @@ +/* + * Copyright (c) 2010, Sangoma Technologies + * David Yat Sin <dyatsin@sangoma.com> + * 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 original author; nor the names of any 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 OWNER + * 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 "ftmod_sangoma_isdn.h" + +extern void sngisdn_trace_q921(char* str, uint8_t* data, uint32_t data_len); +extern void sngisdn_trace_q931(char* str, uint8_t* data, uint32_t data_len); +extern void get_memory_info(void); + +#define MAX_DECODE_STR_LEN 2000 + + +void sngisdn_rcv_con_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, ConEvnt *conEvnt, int16_t dChan, uint8_t ces) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + uint8_t bchan_no = 0; + sngisdn_chan_data_t *sngisdn_info; + sngisdn_event_data_t *sngisdn_event; + + ftdm_assert(g_sngisdn_data.ccs[suId].activation_done != 0, "Con Ind on unconfigured cc\n"); + ftdm_assert(g_sngisdn_data.dchans[dChan].num_spans != 0, "Con Ind on unconfigured dchan\n"); + + if (conEvnt->chanId.eh.pres != PRSNT_NODEF) { + /* TODO: Implement me */ + ftdm_log(FTDM_LOG_ERROR, "Incoming call without Channel Id not supported yet\n"); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + + if (conEvnt->chanId.chanNmbSlotMap.pres) { + bchan_no = conEvnt->chanId.chanNmbSlotMap.val[0]; + } else if (conEvnt->chanId.infoChanSel.pres) { + bchan_no = conEvnt->chanId.infoChanSel.val; + } + + if (!bchan_no) { + ftdm_log(FTDM_LOG_ERROR, "Failed to obtain b-channel number from SETUP message\n"); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + + if (g_sngisdn_data.dchans[dChan].channels[bchan_no] == NULL) { + ftdm_log(FTDM_LOG_ERROR, "Incoming call on unconfigured b-channel:%d\n", bchan_no); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + + sngisdn_info = g_sngisdn_data.dchans[dChan].channels[bchan_no]; + + ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received SETUP (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); + + sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); + ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); + memset(sngisdn_event, 0, sizeof(*sngisdn_event)); + + sngisdn_event->event_id = SNGISDN_EVENT_CON_IND; + sngisdn_event->sngisdn_info = sngisdn_info; + sngisdn_event->suId = suId; + sngisdn_event->suInstId = suInstId; + sngisdn_event->spInstId = spInstId; + sngisdn_event->dChan = dChan; + sngisdn_event->ces = ces; + + memcpy(&sngisdn_event->event.conEvnt, conEvnt, sizeof(*conEvnt)); + + ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); +} + +void sngisdn_rcv_con_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, CnStEvnt *cnStEvnt, int16_t dChan, uint8_t ces) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + sngisdn_chan_data_t *sngisdn_info; + sngisdn_event_data_t *sngisdn_event; + + ftdm_assert(g_sngisdn_data.ccs[suId].activation_done != 0, "Con Cfm on unconfigured cc\n"); + ftdm_assert(g_sngisdn_data.dchans[dChan].num_spans != 0, "Con Cfm on unconfigured dchan\n"); + + if (get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + + ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received CONNECT/CONNECT ACK (suId:%u suInstId:%u spInstId:%u ces:%d)\n", suId, suInstId, spInstId, ces); + + sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); + ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); + memset(sngisdn_event, 0, sizeof(*sngisdn_event)); + + sngisdn_event->event_id = SNGISDN_EVENT_CON_CFM; + sngisdn_event->sngisdn_info = sngisdn_info; + sngisdn_event->suId = suId; + sngisdn_event->suInstId = suInstId; + sngisdn_event->spInstId = spInstId; + sngisdn_event->dChan = dChan; + sngisdn_event->ces = ces; + + memcpy(&sngisdn_event->event.cnStEvnt, cnStEvnt, sizeof(*cnStEvnt)); + + ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); +} + +void sngisdn_rcv_cnst_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, CnStEvnt *cnStEvnt, uint8_t evntType, int16_t dChan, uint8_t ces) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + sngisdn_chan_data_t *sngisdn_info; + sngisdn_event_data_t *sngisdn_event; + + ftdm_assert(g_sngisdn_data.ccs[suId].activation_done != 0, "Cnst Ind on unconfigured cc\n"); + ftdm_assert(g_sngisdn_data.dchans[dChan].num_spans != 0, "Cnst Ind on unconfigured dchan\n"); + + if (get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) != FTDM_SUCCESS) { + ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + + ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received %s (suId:%u suInstId:%u spInstId:%u ces:%d)\n", + (evntType == MI_ALERTING)?"ALERT": + (evntType == MI_CALLPROC)?"PROCEED": + (evntType == MI_PROGRESS)?"PROGRESS": + (evntType == MI_SETUPACK)?"SETUP ACK": + (evntType == MI_INFO)?"INFO":"UNKNOWN", + suId, suInstId, spInstId, ces); + + sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); + ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); + memset(sngisdn_event, 0, sizeof(*sngisdn_event)); + + sngisdn_event->event_id = SNGISDN_EVENT_CNST_IND; + sngisdn_event->sngisdn_info = sngisdn_info; + sngisdn_event->suId = suId; + sngisdn_event->suInstId = suInstId; + sngisdn_event->spInstId = spInstId; + sngisdn_event->dChan = dChan; + sngisdn_event->ces = ces; + sngisdn_event->evntType = evntType; + + memcpy(&sngisdn_event->event.cnStEvnt, cnStEvnt, sizeof(*cnStEvnt)); + + ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); +} + +void sngisdn_rcv_disc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, DiscEvnt *discEvnt) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + sngisdn_chan_data_t *sngisdn_info; + sngisdn_event_data_t *sngisdn_event; + + ftdm_assert(spInstId != 0, "Received DISCONNECT with invalid id"); + + if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && + !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { + + ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); + return; + } + + ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received DISCONNECT (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); + + sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); + ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); + memset(sngisdn_event, 0, sizeof(*sngisdn_event)); + + sngisdn_event->event_id = SNGISDN_EVENT_DISC_IND; + sngisdn_event->sngisdn_info = sngisdn_info; + sngisdn_event->suId = suId; + sngisdn_event->suInstId = suInstId; + sngisdn_event->spInstId = spInstId; + + memcpy(&sngisdn_event->event.discEvnt, discEvnt, sizeof(*discEvnt)); + + ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); + + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); +} + +void sngisdn_rcv_rel_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, RelEvnt *relEvnt) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + sngisdn_chan_data_t *sngisdn_info; + sngisdn_event_data_t *sngisdn_event; + + if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && + !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { + + ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); + return; + } + + ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received RELEASE/RELEASE COMPLETE (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); + + sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); + ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); + memset(sngisdn_event, 0, sizeof(*sngisdn_event)); + + sngisdn_event->event_id = SNGISDN_EVENT_REL_IND; + sngisdn_event->sngisdn_info = sngisdn_info; + sngisdn_event->suId = suId; + sngisdn_event->suInstId = suInstId; + sngisdn_event->spInstId = spInstId; + + memcpy(&sngisdn_event->event.relEvnt, relEvnt, sizeof(*relEvnt)); + + ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); +} + +void sngisdn_rcv_dat_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, InfoEvnt *infoEvnt) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + sngisdn_chan_data_t *sngisdn_info; + sngisdn_event_data_t *sngisdn_event; + + if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && + !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { + + ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); + + return; + } + + ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received DATA IND suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); + + sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); + ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); + memset(sngisdn_event, 0, sizeof(*sngisdn_event)); + + sngisdn_event->event_id = SNGISDN_EVENT_DAT_IND; + sngisdn_event->sngisdn_info = sngisdn_info; + sngisdn_event->suId = suId; + sngisdn_event->suInstId = suInstId; + sngisdn_event->spInstId = spInstId; + + memcpy(&sngisdn_event->event.infoEvnt, infoEvnt, sizeof(*infoEvnt)); + + ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); +} + +void sngisdn_rcv_sshl_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, SsHlEvnt *ssHlEvnt, uint8_t action) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + sngisdn_chan_data_t *sngisdn_info; + sngisdn_event_data_t *sngisdn_event; + + if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && + !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { + + ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); + + return; + } + + ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received SSHL IND (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); + + sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); + ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); + memset(sngisdn_event, 0, sizeof(*sngisdn_event)); + + sngisdn_event->event_id = SNGISDN_EVENT_SSHL_IND; + sngisdn_event->sngisdn_info = sngisdn_info; + sngisdn_event->suId = suId; + sngisdn_event->suInstId = suInstId; + sngisdn_event->spInstId = spInstId; + sngisdn_event->action = action; + + memcpy(&sngisdn_event->event.ssHlEvnt, ssHlEvnt, sizeof(*ssHlEvnt)); + + ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); +} + +void sngisdn_rcv_sshl_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, SsHlEvnt *ssHlEvnt, uint8_t action) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + sngisdn_chan_data_t *sngisdn_info; + sngisdn_event_data_t *sngisdn_event; + + if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && + !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { + + ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); + + return; + } + + ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received SSHL CFM (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); + + sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); + ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); + memset(sngisdn_event, 0, sizeof(*sngisdn_event)); + + sngisdn_event->event_id = SNGISDN_EVENT_SSHL_CFM; + sngisdn_event->sngisdn_info = sngisdn_info; + sngisdn_event->suId = suId; + sngisdn_event->suInstId = suInstId; + sngisdn_event->spInstId = spInstId; + sngisdn_event->action = action; + + memcpy(&sngisdn_event->event.ssHlEvnt, ssHlEvnt, sizeof(*ssHlEvnt)); + + ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); +} +void sngisdn_rcv_rmrt_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, RmRtEvnt *rmRtEvnt, uint8_t action) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + sngisdn_chan_data_t *sngisdn_info; + sngisdn_event_data_t *sngisdn_event; + + if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && + !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { + + ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); + + return; + } + + ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received RMRT IND (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); + + sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); + ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); + memset(sngisdn_event, 0, sizeof(*sngisdn_event)); + + sngisdn_event->event_id = SNGISDN_EVENT_RMRT_IND; + sngisdn_event->sngisdn_info = sngisdn_info; + sngisdn_event->suId = suId; + sngisdn_event->suInstId = suInstId; + sngisdn_event->spInstId = spInstId; + sngisdn_event->action = action; + + memcpy(&sngisdn_event->event.rmRtEvnt, rmRtEvnt, sizeof(*rmRtEvnt)); + + ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); +} + +void sngisdn_rcv_rmrt_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, RmRtEvnt *rmRtEvnt, uint8_t action) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + sngisdn_chan_data_t *sngisdn_info; + sngisdn_event_data_t *sngisdn_event; + + if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && + !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { + + ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); + + return; + } + + ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received RESUME/RETRIEVE CFM (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); + + sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); + ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); + memset(sngisdn_event, 0, sizeof(*sngisdn_event)); + + sngisdn_event->event_id = SNGISDN_EVENT_RMRT_CFM; + sngisdn_event->sngisdn_info = sngisdn_info; + sngisdn_event->suId = suId; + sngisdn_event->suInstId = suInstId; + sngisdn_event->spInstId = spInstId; + sngisdn_event->action = action; + + memcpy(&sngisdn_event->event.rmRtEvnt, rmRtEvnt, sizeof(*rmRtEvnt)); + + ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); +} + +void sngisdn_rcv_flc_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, StaEvnt *staEvnt) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + sngisdn_chan_data_t *sngisdn_info; + sngisdn_event_data_t *sngisdn_event; + + if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && + !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { + + ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); + + return; + } + + ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received FLOW CONTROL IND (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); + + sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); + ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); + memset(sngisdn_event, 0, sizeof(*sngisdn_event)); + + sngisdn_event->event_id = SNGISDN_EVENT_FLC_IND; + sngisdn_event->sngisdn_info = sngisdn_info; + sngisdn_event->suId = suId; + sngisdn_event->suInstId = suInstId; + sngisdn_event->spInstId = spInstId; + + memcpy(&sngisdn_event->event.staEvnt, staEvnt, sizeof(*staEvnt)); + + ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); +} + + +void sngisdn_rcv_fac_ind (int16_t suId, uint32_t suInstId, uint32_t spInstId, FacEvnt *facEvnt, uint8_t evntType, int16_t dChan, uint8_t ces) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + sngisdn_chan_data_t *sngisdn_info; + sngisdn_event_data_t *sngisdn_event; + + if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && + !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { + + ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); + + return; + } + + ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received FACILITY IND (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); + sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); + ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); + memset(sngisdn_event, 0, sizeof(*sngisdn_event)); + + sngisdn_event->event_id = SNGISDN_EVENT_FAC_IND; + sngisdn_event->sngisdn_info = sngisdn_info; + sngisdn_event->suId = suId; + sngisdn_event->suInstId = suInstId; + sngisdn_event->spInstId = spInstId; + sngisdn_event->evntType = evntType; + + memcpy(&sngisdn_event->event.facEvnt, facEvnt, sizeof(*facEvnt)); + + ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); +} + + +void sngisdn_rcv_sta_cfm (int16_t suId, uint32_t suInstId, uint32_t spInstId, StaEvnt *staEvnt) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + sngisdn_chan_data_t *sngisdn_info; + sngisdn_event_data_t *sngisdn_event; + + if (!(spInstId && get_ftdmchan_by_spInstId(suId, spInstId, &sngisdn_info) == FTDM_SUCCESS) && + !(suInstId && get_ftdmchan_by_suInstId(suId, suInstId, &sngisdn_info) == FTDM_SUCCESS)) { + + ftdm_log(FTDM_LOG_CRIT, "Could not find matching call suId:%u suInstId:%u spInstId:%u\n", suId, suInstId, spInstId); + + return; + } + + ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Received STATUS CONFIRM (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); + + sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); + ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); + memset(sngisdn_event, 0, sizeof(*sngisdn_event)); + + sngisdn_event->event_id = SNGISDN_EVENT_STA_CFM; + sngisdn_event->sngisdn_info = sngisdn_info; + sngisdn_event->suId = suId; + sngisdn_event->suInstId = suInstId; + sngisdn_event->spInstId = spInstId; + + memcpy(&sngisdn_event->event.staEvnt, staEvnt, sizeof(*staEvnt)); + + ftdm_queue_enqueue(((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->event_queue, sngisdn_event); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); +} + +void sngisdn_rcv_srv_ind (int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + unsigned i; + sngisdn_span_data_t *signal_data; + sngisdn_event_data_t *sngisdn_event; + + ftdm_log(FTDM_LOG_INFO, "Received SERVICE IND (dChan:%d ces:%u)\n", dChan, ces); + + /* Enqueue the event to each span within the dChan */ + for(i=1; i<=g_sngisdn_data.dchans[dChan].num_spans; i++) { + signal_data = g_sngisdn_data.dchans[dChan].spans[i]; + sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); + ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); + memset(sngisdn_event, 0, sizeof(*sngisdn_event)); + + sngisdn_event->event_id = SNGISDN_EVENT_SRV_IND; + sngisdn_event->suId = suId; + sngisdn_event->dChan = dChan; + sngisdn_event->ces = ces; + sngisdn_event->signal_data = signal_data; + + memcpy(&sngisdn_event->event.srvEvnt, srvEvnt, sizeof(*srvEvnt)); + ftdm_queue_enqueue((signal_data)->event_queue, sngisdn_event); + } + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); +} + + +void sngisdn_rcv_srv_cfm (int16_t suId, Srv *srvEvnt, int16_t dChan, uint8_t ces) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + unsigned i; + sngisdn_span_data_t *signal_data; + sngisdn_event_data_t *sngisdn_event; + + ftdm_log(FTDM_LOG_INFO, "Received SERVICE CFM (dChan:%d ces:%u)\n", dChan, ces); + + /* Enqueue the event to each span within the dChan */ + for(i=1; i<=g_sngisdn_data.dchans[dChan].num_spans; i++) { + signal_data = g_sngisdn_data.dchans[dChan].spans[i]; + sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); + ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); + memset(sngisdn_event, 0, sizeof(*sngisdn_event)); + + sngisdn_event->event_id = SNGISDN_EVENT_SRV_CFM; + sngisdn_event->suId = suId; + sngisdn_event->dChan = dChan; + sngisdn_event->ces = ces; + sngisdn_event->signal_data = signal_data; + + memcpy(&sngisdn_event->event.srvEvnt, srvEvnt, sizeof(*srvEvnt)); + ftdm_queue_enqueue((signal_data)->event_queue, sngisdn_event); + } + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); +} + +void sngisdn_rcv_rst_ind (int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces, uint8_t evntType) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + unsigned i; + sngisdn_span_data_t *signal_data; + sngisdn_event_data_t *sngisdn_event; + + ftdm_log(FTDM_LOG_INFO, "Received RESTART IND (dChan:%d ces:%u type:%u)\n", dChan, ces, evntType); + + /* Enqueue the event to each span within the dChan */ + for(i=1; i<=g_sngisdn_data.dchans[dChan].num_spans; i++) { + signal_data = g_sngisdn_data.dchans[dChan].spans[i]; + sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); + ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); + memset(sngisdn_event, 0, sizeof(*sngisdn_event)); + + sngisdn_event->event_id = SNGISDN_EVENT_RST_IND; + sngisdn_event->suId = suId; + sngisdn_event->dChan = dChan; + sngisdn_event->ces = ces; + sngisdn_event->evntType = evntType; + sngisdn_event->signal_data = signal_data; + + memcpy(&sngisdn_event->event.rstEvnt, rstEvnt, sizeof(*rstEvnt)); + ftdm_queue_enqueue(signal_data->event_queue, sngisdn_event); + } + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); +} + +void sngisdn_rcv_rst_cfm (int16_t suId, Rst *rstEvnt, int16_t dChan, uint8_t ces, uint8_t evntType) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + unsigned i; + sngisdn_span_data_t *signal_data; + sngisdn_event_data_t *sngisdn_event; + + ftdm_log(FTDM_LOG_INFO, "Received RESTART CFM (dChan:%d ces:%u type:%u)\n", dChan, ces, evntType); + + /* Enqueue the event to each span within the dChan */ + for(i=1; i<=g_sngisdn_data.dchans[dChan].num_spans; i++) { + signal_data = g_sngisdn_data.dchans[dChan].spans[i]; + sngisdn_event = ftdm_malloc(sizeof(*sngisdn_event)); + ftdm_assert(sngisdn_event, "Failed to allocate memory\n"); + memset(sngisdn_event, 0, sizeof(*sngisdn_event)); + + sngisdn_event->event_id = SNGISDN_EVENT_RST_CFM; + sngisdn_event->suId = suId; + sngisdn_event->dChan = dChan; + sngisdn_event->ces = ces; + sngisdn_event->evntType = evntType; + sngisdn_event->signal_data = signal_data; + + memcpy(&sngisdn_event->event.rstEvnt, rstEvnt, sizeof(*rstEvnt)); + ftdm_queue_enqueue((signal_data)->event_queue, sngisdn_event); + } + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); +} + + +void sngisdn_rcv_phy_ind(SuId suId, Reason reason) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + if (reason != LL1_REASON_CON_REQ_FAIL) { + ftdm_log(FTDM_LOG_INFO, "[SNGISDN PHY] D-chan %d : %s\n", suId, DECODE_LL1_REASON(reason)); + } + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; +} + +void sngisdn_rcv_q921_ind(BdMngmt *status) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + + unsigned j,k; + ftdm_span_t *ftdmspan = NULL; + + for(j=1;j<=g_sngisdn_data.num_dchan;j++) { + for(k=1;k<=g_sngisdn_data.dchans[j].num_spans;k++) { + if (g_sngisdn_data.dchans[j].spans[k]->link_id == status->t.usta.lnkNmb) { + ftdmspan = (ftdm_span_t*)g_sngisdn_data.dchans[j].spans[k]->ftdm_span; + } + } + } + ftdm_assert(ftdmspan != NULL, "Received q921 status on unconfigured span\n"); + + switch (status->t.usta.alarm.category) { + case (LCM_CATEGORY_INTERFACE): + ftdm_log(FTDM_LOG_INFO, "[SNGISDN Q921] %s: %s: %s(%d): %s(%d)\n", + ftdmspan->name, + DECODE_LCM_CATEGORY(status->t.usta.alarm.category), + DECODE_LCM_EVENT(status->t.usta.alarm.event), status->t.usta.alarm.event, + DECODE_LCM_CAUSE(status->t.usta.alarm.cause), status->t.usta.alarm.cause); + break; + default: + ftdm_log(FTDM_LOG_INFO, "[SNGISDN Q921] %s: %s: %s(%d): %s(%d)\n", + ftdmspan->name, + DECODE_LCM_CATEGORY(status->t.usta.alarm.category), + DECODE_LLD_EVENT(status->t.usta.alarm.event), status->t.usta.alarm.event, + DECODE_LLD_CAUSE(status->t.usta.alarm.cause), status->t.usta.alarm.cause); + + switch (status->t.usta.alarm.event) { + case ENTR_CONG: /* Entering Congestion */ + ftdm_log(FTDM_LOG_WARNING, "s%d: Entering Congestion\n", ftdmspan->span_id); + ftdm_set_flag(ftdmspan, FTDM_SPAN_SUSPENDED); + break; + case EXIT_CONG: /* Exiting Congestion */ + ftdm_log(FTDM_LOG_WARNING, "s%d: Exiting Congestion\n", ftdmspan->span_id); + ftdm_clear_flag(ftdmspan, FTDM_SPAN_SUSPENDED); + break; + } + break; + } + + ISDN_FUNC_TRACE_EXIT(__FUNCTION__) + return; +} +void sngisdn_rcv_q931_ind(InMngmt *status) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + ftdm_span_t *ftdmspan = NULL; + + if (status->t.usta.alarm.cause == 287) { + get_memory_info(); + return; + } + + switch (status->t.usta.alarm.category) { + case (LCM_CATEGORY_INTERFACE): + ftdm_log(FTDM_LOG_WARNING, "[SNGISDN Q931] s%d: %s: %s(%d): %s(%d)\n", + status->t.usta.suId, + DECODE_LCM_CATEGORY(status->t.usta.alarm.category), + DECODE_LCM_EVENT(status->t.usta.alarm.event), status->t.usta.alarm.event, + DECODE_LCM_CAUSE(status->t.usta.alarm.cause), status->t.usta.alarm.cause); + + /* clean this up later */ + + switch (status->t.usta.alarm.event) { + case LCM_EVENT_UP: + case LCM_EVENT_DOWN: + { + unsigned j,k; + for(j=1;j<=g_sngisdn_data.num_dchan;j++) { + for(k=1;k<=g_sngisdn_data.dchans[j].num_spans;k++) { + if (g_sngisdn_data.dchans[j].spans[k]->link_id == status->t.usta.suId) { + ftdmspan = (ftdm_span_t*)g_sngisdn_data.dchans[j].spans[k]->ftdm_span; + } + } + } + + if (ftdmspan == NULL) { + ftdm_log(FTDM_LOG_CRIT, "Received q931 LCM EVENT on unconfigured span (suId:%u)\n", status->t.usta.suId); + return; + } + + if (status->t.usta.alarm.event == LCM_EVENT_UP) { + sngisdn_set_span_sig_status(ftdmspan, FTDM_SIG_STATE_UP); + sng_isdn_set_avail_rate(ftdmspan, SNGISDN_AVAIL_UP); + } else { + sngisdn_set_span_sig_status(ftdmspan, FTDM_SIG_STATE_DOWN); + sng_isdn_set_avail_rate(ftdmspan, SNGISDN_AVAIL_PWR_SAVING); + } + } + break; + } + break; + default: + ftdm_log(FTDM_LOG_DEBUG, "[SNGISDN Q931] s%d: %s: %s(%d): %s(%d)\n", + status->t.usta.suId, + DECODE_LCM_CATEGORY(status->t.usta.alarm.category), + DECODE_LCM_EVENT(status->t.usta.alarm.event), status->t.usta.alarm.event, + DECODE_LCM_CAUSE(status->t.usta.alarm.cause), status->t.usta.alarm.cause); + break; + } + + + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; +} + +void sngisdn_rcv_cc_ind(CcMngmt *status) +{ + ISDN_FUNC_TRACE_ENTER(__FUNCTION__); + ftdm_log(FTDM_LOG_INFO, "RECEIVED %s\n", __FUNCTION__); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; +} + +#define Q931_TRC_EVENT(event) (event == TL3PKTTX)?"TX": \ + (event == TL3PKTRX)?"RX":"UNKNOWN" + +void sngisdn_rcv_q931_trace(InMngmt *trc, Buffer *mBuf) +{ + MsgLen mlen; + MsgLen i; + int16_t j; + Buffer *tmp; + Data *cptr; + uint8_t data; + uint8_t tdata[1000]; + char *data_str = ftdm_calloc(1,MAX_DECODE_STR_LEN); /* TODO Find a proper size */ + + ftdm_assert(mBuf != NULLP, "Received a Q931 trace with no buffer"); + mlen = ((SsMsgInfo*)(mBuf->b_rptr))->len; + + if (mlen != 0) { + tmp = mBuf->b_cont; + cptr = tmp->b_rptr; + data = *cptr++; + i = 0; + + for(j=0;j<mlen;j++) { + tdata[j]= data; + + if (cptr == tmp->b_wptr) { + tmp = tmp->b_cont; + if (tmp) cptr = tmp->b_rptr; + } + data = *cptr++; + } + + sngisdn_trace_q931(data_str, tdata, mlen); + ftdm_log(FTDM_LOG_INFO, "[SNGISDN Q931] s%d FRAME %s:%s\n", trc->t.trc.suId, Q931_TRC_EVENT(trc->t.trc.evnt), data_str); + } + + ftdm_safe_free(data_str); + /* We do not need to free mBuf in this case because stack does it */ + /* SPutMsg(mBuf); */ + return; +} + + +#define Q921_TRC_EVENT(event) (event == TL2FRMRX)?"RX": \ + (event == TL2FRMTX)?"TX": \ + (event == TL2TMR)?"TMR EXPIRED":"UNKNOWN" + +void sngisdn_rcv_q921_trace(BdMngmt *trc, Buffer *mBuf) +{ + MsgLen mlen; + MsgLen i; + int16_t j; + Buffer *tmp; + Data *cptr; + uint8_t data; + uint8_t tdata[16]; + char *data_str = ftdm_calloc(1,200); /* TODO Find a proper size */ + + + if (trc->t.trc.evnt == TL2TMR) { + goto end_of_trace; + } + + ftdm_assert(mBuf != NULLP, "Received a Q921 trace with no buffer"); + mlen = ((SsMsgInfo*)(mBuf->b_rptr))->len; + + if (mlen != 0) { + tmp = mBuf->b_cont; + cptr = tmp->b_rptr; + data = *cptr++; + i = 0; + while (i < mlen) { + j = 0; + for(j=0;j<16;j++) { + if (i<mlen) { + tdata[j]= data; + + if (cptr == tmp->b_wptr) { + tmp = tmp->b_cont; + if (tmp) cptr = tmp->b_rptr; + } + i++; + if (i<mlen) data = *cptr++; + } + } + + } + sngisdn_trace_q921(data_str, tdata, mlen); + ftdm_log(FTDM_LOG_INFO, "[SNGISDN Q921] s%d FRAME %s:%s\n", trc->t.trc.lnkNmb, Q921_TRC_EVENT(trc->t.trc.evnt), data_str); + } +end_of_trace: + ftdm_safe_free(data_str); + SPutMsg(mBuf); + return; +} + +void sngisdn_rcv_sng_assert(char *message) +{ + ftdm_assert(0, message); +} + +void sngisdn_rcv_sng_log(uint8_t level, char *fmt,...) +{ + char *data; + int ret; + va_list ap; + + va_start(ap, fmt); + ret = ftdm_vasprintf(&data, fmt, ap); + if (ret == -1) { + return; + } + + switch (level) { + case SNG_LOGLEVEL_DEBUG: + ftdm_log(FTDM_LOG_DEBUG, "sng_isdn->%s", data); + break; + case SNG_LOGLEVEL_WARN: + ftdm_log(FTDM_LOG_INFO, "sng_isdn->%s", data); + break; + case SNG_LOGLEVEL_INFO: + ftdm_log(FTDM_LOG_INFO, "sng_isdn->%s", data); + break; + case SNG_LOGLEVEL_STATS: + ftdm_log(FTDM_LOG_INFO, "sng_isdn->%s", data); + break; + case SNG_LOGLEVEL_ERROR: + ftdm_log(FTDM_LOG_ERROR, "sng_isdn->%s", data); + /*ftdm_assert(0, "Got an error from stack");*/ + break; + case SNG_LOGLEVEL_CRIT: + ftdm_log(FTDM_LOG_CRIT, "sng_isdn->%s", data); + /*ftdm_assert(0, "Got an error from stack");*/ + break; + default: + ftdm_log(FTDM_LOG_INFO, "sng_isdn->%s", data); + break; + } + return; +} + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4: + */ + +/******************************************************************************/ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index b922efc..f910eb3 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -37,22 +37,27 @@ ftdm_status_t cpy_calling_num_from_sngisdn(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb); ftdm_status_t cpy_called_num_from_sngisdn(ftdm_caller_data_t *ftdm, CdPtyNmb *cdPtyNmb); ftdm_status_t cpy_redir_num_from_sngisdn(ftdm_caller_data_t *ftdm, RedirNmb *redirNmb); -ftdm_status_t cpy_calling_name_from_sngisdn(ftdm_caller_data_t *ftdm, ConEvnt *conEvnt); +ftdm_status_t cpy_calling_name_from_sngisdn(ftdm_caller_data_t *ftdm, Display *display); ftdm_status_t cpy_calling_num_to_sngisdn(CgPtyNmb *cgPtyNmb, ftdm_caller_data_t *ftdm); ftdm_status_t cpy_called_num_to_sngisdn(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t *ftdm); ftdm_status_t cpy_redir_num_to_sngisdn(RedirNmb *redirNmb, ftdm_caller_data_t *ftdm); ftdm_status_t cpy_calling_name_to_sngisdn(ConEvnt *conEvnt, ftdm_channel_t *ftdmchan); +ftdm_status_t sngisdn_check_free_ids(void); + extern ftdm_sngisdn_data_t g_sngisdn_data; void get_memory_info(void); -void clear_call_data(sngisdn_chan_data_t *sngisdn_info) +void __inline__ clear_call_data(sngisdn_chan_data_t *sngisdn_info) { uint32_t cc_id = ((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->cc_id; + ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_DEBUG, "Clearing call data (suId:%u suInstId:%u spInstId:%u)\n", cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId); + ftdm_mutex_lock(g_sngisdn_data.ccs[cc_id].mutex); g_sngisdn_data.ccs[cc_id].active_spInstIds[sngisdn_info->spInstId]=NULL; g_sngisdn_data.ccs[cc_id].active_suInstIds[sngisdn_info->suInstId]=NULL; + ftdm_mutex_unlock(g_sngisdn_data.ccs[cc_id].mutex); sngisdn_info->suInstId = 0; sngisdn_info->spInstId = 0; @@ -61,10 +66,33 @@ void clear_call_data(sngisdn_chan_data_t *sngisdn_info) return; } -uint32_t get_unique_suInstId(uint8_t cc_id) +void __inline__ clear_call_glare_data(sngisdn_chan_data_t *sngisdn_info) +{ + ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_DEBUG, "Clearing glare data (suId:%d suInstId:%u spInstId:%u actv-suInstId:%u actv-spInstId:%u)\n", + sngisdn_info->glare.suId, + sngisdn_info->glare.suInstId, sngisdn_info->glare.spInstId, + sngisdn_info->suInstId, sngisdn_info->spInstId); + + ftdm_mutex_lock(g_sngisdn_data.ccs[sngisdn_info->glare.suId].mutex); + g_sngisdn_data.ccs[sngisdn_info->glare.suId].active_spInstIds[sngisdn_info->glare.spInstId]=NULL; + g_sngisdn_data.ccs[sngisdn_info->glare.suId].active_suInstIds[sngisdn_info->glare.suInstId]=NULL; + ftdm_mutex_unlock(g_sngisdn_data.ccs[sngisdn_info->glare.suId].mutex); + + ftdm_clear_flag(sngisdn_info, FLAG_GLARE); + memset(&sngisdn_info->glare.setup, 0, sizeof(ConEvnt)); + sngisdn_info->glare.suId = 0; + sngisdn_info->glare.suInstId = 0; + sngisdn_info->glare.spInstId = 0; + sngisdn_info->glare.dChan = 0; + sngisdn_info->glare.ces = 0; + return; +} + + +uint32_t __inline__ get_unique_suInstId(uint8_t cc_id) { uint32_t suInstId; - ftdm_mutex_lock(g_sngisdn_data.ccs[cc_id].request_mutex); + ftdm_mutex_lock(g_sngisdn_data.ccs[cc_id].mutex); suInstId = g_sngisdn_data.ccs[cc_id].last_suInstId; while(1) { @@ -73,16 +101,16 @@ uint32_t get_unique_suInstId(uint8_t cc_id) } if (g_sngisdn_data.ccs[cc_id].active_suInstIds[suInstId] == NULL) { g_sngisdn_data.ccs[cc_id].last_suInstId = suInstId; - ftdm_mutex_unlock(g_sngisdn_data.ccs[cc_id].request_mutex); + ftdm_mutex_unlock(g_sngisdn_data.ccs[cc_id].mutex); return suInstId; } } /* Should never reach here */ - ftdm_mutex_unlock(g_sngisdn_data.ccs[cc_id].request_mutex); + ftdm_mutex_unlock(g_sngisdn_data.ccs[cc_id].mutex); return 0; } -ftdm_status_t get_ftdmchan_by_suInstId(uint8_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data) +ftdm_status_t __inline__ get_ftdmchan_by_suInstId(uint8_t cc_id, uint32_t suInstId, sngisdn_chan_data_t **sngisdn_data) { ftdm_assert_return(g_sngisdn_data.ccs[cc_id].activation_done, FTDM_FAIL, "Trying to find call on unconfigured CC\n"); @@ -93,7 +121,7 @@ ftdm_status_t get_ftdmchan_by_suInstId(uint8_t cc_id, uint32_t suInstId, sngisdn return FTDM_SUCCESS; } -ftdm_status_t get_ftdmchan_by_spInstId(uint8_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data) +ftdm_status_t __inline__ get_ftdmchan_by_spInstId(uint8_t cc_id, uint32_t spInstId, sngisdn_chan_data_t **sngisdn_data) { ftdm_assert_return(g_sngisdn_data.ccs[cc_id].activation_done, FTDM_FAIL, "Trying to find call on unconfigured CC\n"); @@ -104,6 +132,19 @@ ftdm_status_t get_ftdmchan_by_spInstId(uint8_t cc_id, uint32_t spInstId, sngisdn return FTDM_SUCCESS; } +ftdm_status_t sng_isdn_set_avail_rate(ftdm_span_t *ftdmspan, sngisdn_avail_t avail) +{ + unsigned i; + if (ftdmspan->trunk_type == FTDM_TRUNK_BRI || + ftdmspan->trunk_type == FTDM_TRUNK_BRI_PTMP) { + + for(i=1; i<=ftdmspan->chan_count; i++) { + ftdm_log_chan(ftdmspan->channels[i], FTDM_LOG_DEBUG, "Setting availability rate to:%d\n", avail); + ftdmspan->channels[i]->availability_rate = avail; + } + } + return FTDM_SUCCESS; +} ftdm_status_t cpy_calling_num_from_sngisdn(ftdm_caller_data_t *ftdm, CgPtyNmb *cgPtyNmb) { @@ -147,7 +188,9 @@ ftdm_status_t cpy_called_num_from_sngisdn(ftdm_caller_data_t *ftdm, CdPtyNmb *cd } if (cdPtyNmb->nmbDigits.pres == PRSNT_NODEF) { - ftdm_copy_string(ftdm->dnis.digits, (const char*)cdPtyNmb->nmbDigits.val, cdPtyNmb->nmbDigits.len+1); + unsigned i = strlen(ftdm->dnis.digits); + + ftdm_copy_string(&ftdm->dnis.digits[i], (const char*)cdPtyNmb->nmbDigits.val, cdPtyNmb->nmbDigits.len+1); } return FTDM_SUCCESS; } @@ -172,13 +215,16 @@ ftdm_status_t cpy_redir_num_from_sngisdn(ftdm_caller_data_t *ftdm, RedirNmb *red return FTDM_SUCCESS; } -ftdm_status_t cpy_calling_name_from_sngisdn(ftdm_caller_data_t *ftdm, ConEvnt *conEvnt) +ftdm_status_t cpy_calling_name_from_sngisdn(ftdm_caller_data_t *ftdm, Display *display) { - if (conEvnt->display.eh.pres && conEvnt->display.dispInfo.pres == PRSNT_NODEF) { - ftdm_copy_string(ftdm->cid_name, (const char*)conEvnt->display.dispInfo.val, conEvnt->display.dispInfo.len+1); + if (display->eh.pres != PRSNT_NODEF) { + return FTDM_FAIL; } - - /* TODO check if caller name is contained in a Facility IE */ + if (display->dispInfo.pres != PRSNT_NODEF) { + return FTDM_FAIL; + } + + ftdm_copy_string(ftdm->cid_name, (const char*)display->dispInfo.val, display->dispInfo.len+1); return FTDM_SUCCESS; } @@ -219,14 +265,23 @@ ftdm_status_t cpy_called_num_to_sngisdn(CdPtyNmb *cdPtyNmb, ftdm_caller_data_t * cdPtyNmb->eh.pres = PRSNT_NODEF; cdPtyNmb->nmbPlanId.pres = PRSNT_NODEF; - cdPtyNmb->nmbPlanId.val = ftdm->dnis.plan; - + if (ftdm->dnis.plan == FTDM_NPI_INVALID) { + cdPtyNmb->nmbPlanId.val = FTDM_NPI_UNKNOWN; + } else { + cdPtyNmb->nmbPlanId.val = ftdm->dnis.plan; + } + cdPtyNmb->typeNmb0.pres = PRSNT_NODEF; - cdPtyNmb->typeNmb0.val = ftdm->dnis.type; + if (ftdm->dnis.type == FTDM_TON_INVALID) { + cdPtyNmb->typeNmb0.val = FTDM_TON_UNKNOWN; + } else { + cdPtyNmb->typeNmb0.val = ftdm->dnis.type; + } cdPtyNmb->nmbDigits.pres = PRSNT_NODEF; cdPtyNmb->nmbDigits.len = len; + memcpy(cdPtyNmb->nmbDigits.val, ftdm->dnis.digits, len); return FTDM_SUCCESS; } @@ -241,10 +296,18 @@ ftdm_status_t cpy_redir_num_to_sngisdn(RedirNmb *redirNmb, ftdm_caller_data_t *f redirNmb->eh.pres = PRSNT_NODEF; redirNmb->nmbPlanId.pres = PRSNT_NODEF; - redirNmb->nmbPlanId.val = ftdm->rdnis.plan; + if (ftdm->rdnis.plan == FTDM_NPI_INVALID) { + redirNmb->nmbPlanId.val = FTDM_NPI_UNKNOWN; + } else { + redirNmb->nmbPlanId.val = ftdm->rdnis.plan; + } redirNmb->typeNmb.pres = PRSNT_NODEF; - redirNmb->typeNmb.val = ftdm->rdnis.type; + if (ftdm->rdnis.type == FTDM_TON_INVALID) { + redirNmb->typeNmb.val = FTDM_TON_UNKNOWN; + } else { + redirNmb->typeNmb.val = ftdm->rdnis.type; + } redirNmb->nmbDigits.pres = PRSNT_NODEF; redirNmb->nmbDigits.len = len; @@ -308,28 +371,99 @@ ftdm_status_t cpy_calling_name_to_sngisdn(ConEvnt *conEvnt, ftdm_channel_t *ftdm return FTDM_SUCCESS; } +void sngisdn_delayed_release(void* p_sngisdn_info) +{ + sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*)p_sngisdn_info; + ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + + ftdm_mutex_lock(ftdmchan->mutex); + + if (ftdm_test_flag(sngisdn_info, FLAG_DELAYED_REL)) { + ftdm_clear_flag(sngisdn_info, FLAG_DELAYED_REL); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending delayed RELEASE (suId:%d suInstId:%u spInstId:%u)\n", + signal_data->cc_id, sngisdn_info->glare.spInstId, sngisdn_info->glare.suInstId); + + sngisdn_snd_release(ftdmchan, 1); +#if 1 /* TODO: Confirm this */ + clear_call_glare_data(sngisdn_info); +#else + g_sngisdn_data.ccs[signal_data->cc_id].active_spInstIds[sngisdn_info->glare.spInstId] = NULL; + g_sngisdn_data.ccs[signal_data->cc_id].active_suInstIds[sngisdn_info->glare.suInstId] = NULL; +#endif + + } else { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Call was already released (suId:%d suInstId:%u spInstId:%u)\n", + signal_data->cc_id, sngisdn_info->glare.spInstId, sngisdn_info->glare.suInstId); + } + ftdm_mutex_unlock(ftdmchan->mutex); + return; +} + +void sngisdn_delayed_connect(void* p_sngisdn_info) +{ + sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*)p_sngisdn_info; + ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; + ftdm_mutex_lock(ftdmchan->mutex); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending delayed CONNECT (suId:%d suInstId:%u spInstId:%u)\n", + signal_data->cc_id, sngisdn_info->glare.spInstId, sngisdn_info->glare.suInstId); -ftdm_status_t check_for_state_change(ftdm_channel_t *ftdmchan) + sngisdn_snd_connect(ftdmchan); + ftdm_mutex_unlock(ftdmchan->mutex); + return; +} + +void sngisdn_delayed_disconnect(void* p_sngisdn_info) { + sngisdn_chan_data_t *sngisdn_info = (sngisdn_chan_data_t*)p_sngisdn_info; + ftdm_channel_t *ftdmchan = sngisdn_info->ftdmchan; + sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*) ftdmchan->span->signal_data; -#if 0 - ftdm_log_chan_msg(ftdmchan, "Checking for pending state change\n"); -#endif - /* check to see if there are any pending state changes on the channel and give them a sec to happen*/ - ftdm_wait_for_flag_cleared(ftdmchan, FTDM_CHANNEL_STATE_CHANGE, 5000); + ftdm_mutex_lock(ftdmchan->mutex); + if (ftdmchan->state != FTDM_CHANNEL_STATE_DOWN) { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Sending delayed DISCONNECT (suId:%d suInstId:%u spInstId:%u)\n", + signal_data->cc_id, sngisdn_info->glare.spInstId, sngisdn_info->glare.suInstId); - /* check the flag to confirm it is clear now */ - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { - /* the flag is still up...so we have a problem */ - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_ERROR, "FTDM_CHANNEL_STATE_CHANGE set for over 500ms\n"); + sngisdn_snd_disconnect(ftdmchan); + } - /* move the state of the channel to RESTART to force a reset */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + ftdm_mutex_unlock(ftdmchan->mutex); + return; +} - return FTDM_FAIL; - } - return FTDM_SUCCESS; +ftdm_status_t sngisdn_check_free_ids(void) +{ + unsigned i; + unsigned j; + ftdm_log(FTDM_LOG_INFO, "Checking suInstId's\n"); + for(j=1;j<=MAX_VARIANTS;j++) { + if (g_sngisdn_data.ccs[j].config_done) { + for(i=1;i<MAX_INSTID;i++) { + if (g_sngisdn_data.ccs[j].active_suInstIds[i] != NULL) { + ftdm_log(FTDM_LOG_INFO, "suId:%u suInstId:%u is not free\n", j, i); + + + } + } + } + } + + ftdm_log(FTDM_LOG_INFO, "Checking spInstId's\n"); + for(j=1;j<=MAX_VARIANTS;j++) { + if (g_sngisdn_data.ccs[j].config_done) { + for(i=1;i<MAX_INSTID;i++) { + if (g_sngisdn_data.ccs[j].active_spInstIds[i] != NULL) { + ftdm_log(FTDM_LOG_INFO, "suId:%u spInstId:%u is not free\n", j, i); + + + } + } + } + } + ftdm_log(FTDM_LOG_INFO, "Checking ID's done\n"); + return FTDM_SUCCESS; } void get_memory_info(void) @@ -339,6 +473,7 @@ void get_memory_info(void) return; } + /* For Emacs: * Local Variables: * mode:c diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c index 0084704..7d4d347 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c @@ -205,7 +205,7 @@ void sngisdn_trace_q931(char* str, uint8_t* data, uint32_t data_len) i=i+1; c=c+1; } - str_len += sprintf(&str[str_len], " (%s side)\n", callRefFlag?"Destination":"Origination"); + str_len += sprintf(&str[str_len], " (%s side)\n", callRefFlag?"Destination":"Originating"); /* Decode message type */ str_len+= sprintf(&str[str_len], " Type:%s (0x%x)\n", get_code_2_str((int)(data[2+lenCallRef] & 0xFF), dcodQ931MsgTypeTable), (int)(data[2+lenCallRef] & 0xFF)); @@ -337,7 +337,7 @@ uint32_t sngisdn_decode_ie(char *str, uint32_t *str_len, uint8_t current_codeset } if (numberMap) { - *str_len+= sprintf(&str[*str_len], " MAP\n"); + *str_len+= sprintf(&str[*str_len], " MAP:%s ", get_code_2_str(infoChannelSelection, dcodQ931InfoChannelSelTable)); } else { *str_len+= sprintf(&str[*str_len], "No:%d ", channelNo); } @@ -608,6 +608,9 @@ uint32_t sngisdn_decode_ie(char *str, uint32_t *str_len, uint8_t current_codeset break; case PROT_Q931_IE_SENDING_COMPLETE: /* No need to decode sending complete IE, as no additional info is available except that sending is done */ + /* This is a single octet IE */ + *str_len+= sprintf(&str[*str_len], "\n"); + return 0; break; case PROT_Q931_IE_CALLED_PARTY_SUBADDRESS: case PROT_Q931_IE_REDIRECTION_NUMBER: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.h index 869b235..d210c50 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.h @@ -373,6 +373,14 @@ struct code2str dcodQ931ScreeningTable[] = { {-1, "invalid" }, }; +struct code2str dcodQ931InfoChannelSelTable[] = { + {0, "No Chan"}, + {1, "B1"}, + {2, "B2"}, + {3, "Any Chan"}, + {-1, "invalid" }, +}; + struct code2str dcodQ931ReasonTable[] = { {0x0, "Unknown"}, {0x1, "Call forwarding busy"}, diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c new file mode 100644 index 0000000..c8c8bc3 --- /dev/null +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c @@ -0,0 +1,1448 @@ +/* + * Copyright (c) 2009|Konrad Hammel <konrad@sangoma.com> + * 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 original author; nor the names of any 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 OWNER + * 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 ********************************************************************/ +#include "ftmod_sangoma_ss7_main.h" +/******************************************************************************/ + +/* DEFINES ********************************************************************/ +/******************************************************************************/ + +/* GLOBALS ********************************************************************/ +/******************************************************************************/ + +/* PROTOTYPES *****************************************************************/ +int ft_to_sngss7_cfg_all(void); + +int ftmod_ss7_mtp1_gen_config(void); +int ftmod_ss7_mtp2_gen_config(void); +int ftmod_ss7_mtp3_gen_config(void); +int ftmod_ss7_isup_gen_config(void); +int ftmod_ss7_cc_gen_config(void); + +int ftmod_ss7_mtp1_psap_config(int id); + +int ftmod_ss7_mtp2_dlsap_config(int id); + +int ftmod_ss7_mtp3_dlsap_config(int id); +int ftmod_ss7_mtp3_nsap_config(int id); +int ftmod_ss7_mtp3_linkset_config(int id); +int ftmod_ss7_mtp3_route_config(int id); + +int ftmod_ss7_isup_nsap_config(int id); +int ftmod_ss7_isup_intf_config(int id); +int ftmod_ss7_isup_ckt_config(int id); +int ftmod_ss7_isup_isap_config(int id); + +int ftmod_ss7_cc_isap_config(int id); +/******************************************************************************/ + +/* FUNCTIONS ******************************************************************/ +int ft_to_sngss7_cfg_all(void) +{ + int x = 0; + + /* check if we have done gen_config already */ + if (!(g_ftdm_sngss7_data.gen_config)) { + + if (sng_validate_license(g_ftdm_sngss7_data.cfg.license, + g_ftdm_sngss7_data.cfg.signature, + g_ftdm_sngss7_data.cfg.spc)) { + + SS7_CRITICAL("License verification failed..ending!\n"); + return 1; + } + + if (ftmod_ss7_mtp1_gen_config()) { + SS7_CRITICAL("MTP1 General configuration FAILED!\n"); + SS7_ASSERT + } else { + SS7_INFO("MTP1 General configuration DONE\n"); + } + + if (ftmod_ss7_mtp2_gen_config()) { + SS7_CRITICAL("MTP2 General configuration FAILED!\n"); + SS7_ASSERT + } else { + SS7_INFO("MTP2 General configuration DONE\n"); + } + + if (ftmod_ss7_mtp3_gen_config()) { + SS7_CRITICAL("MTP3 General configuration FAILED!\n"); + SS7_ASSERT + } else { + SS7_INFO("MTP3 General configuration DONE\n"); + } + + if (ftmod_ss7_isup_gen_config()) { + SS7_CRITICAL("ISUP General configuration FAILED!\n"); + SS7_ASSERT + } else { + SS7_INFO("ISUP General configuration DONE\n"); + } + + if (ftmod_ss7_cc_gen_config()) { + SS7_CRITICAL("CC General configuration FAILED!\n"); + SS7_ASSERT + } else { + SS7_INFO("CC General configuration DONE\n"); + } + + /* update the global gen_config so we don't do it again */ + g_ftdm_sngss7_data.gen_config = 1; + } + + + x = 1; + while (g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) { + /* check if this link has been configured already */ + if (!(g_ftdm_sngss7_data.cfg.mtpLink[x].flags & CONFIGURED)) { + + /* configure mtp1 */ + if (ftmod_ss7_mtp1_psap_config(x)) { + SS7_CRITICAL("MTP1 PSAP %d configuration FAILED!\n", x); + SS7_ASSERT; + } else { + SS7_INFO("MTP1 PSAP %d configuration DONE!\n", x); + } + + /* configure mtp2 */ + if (ftmod_ss7_mtp2_dlsap_config(x)) { + SS7_CRITICAL("MTP2 DLSAP %d configuration FAILED!\n",x); + SS7_ASSERT; + } else { + SS7_INFO("MTP2 DLSAP %d configuration DONE!\n", x); + } + + /* configure mtp3 */ + if (ftmod_ss7_mtp3_dlsap_config(x)) { + SS7_CRITICAL("MTP3 DLSAP %d configuration FAILED!\n", x); + SS7_ASSERT; + } else { + SS7_INFO("MTP3 DLSAP %d configuration DONE!\n", x); + } + + /* set the CONFIGURED flag */ + g_ftdm_sngss7_data.cfg.mtpLink[x].flags |= CONFIGURED; + } + + x++; + } /* while (g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) */ + + x = 1; + while (g_ftdm_sngss7_data.cfg.nsap[x].id != 0) { + /* check if this link has been configured already */ + if (!(g_ftdm_sngss7_data.cfg.nsap[x].flags & CONFIGURED)) { + + if (ftmod_ss7_mtp3_nsap_config(x)) { + SS7_CRITICAL("MTP3 NSAP %d configuration FAILED!\n", x); + SS7_ASSERT + } else { + SS7_INFO("MTP3 NSAP %d configuration DONE!\n", x); + } + + if (ftmod_ss7_isup_nsap_config(x)) { + SS7_CRITICAL("ISUP NSAP %d configuration FAILED!\n", x); + SS7_ASSERT + } else { + SS7_INFO("ISUP NSAP %d configuration DONE!\n", x); + } + + /* set the CONFIGURED flag */ + g_ftdm_sngss7_data.cfg.nsap[x].flags |= CONFIGURED; + } /* if !CONFIGURED */ + + x++; + } /* while (g_ftdm_sngss7_data.cfg.nsap[x].id != 0) */ + + x = 1; + while (g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) { + /* check if this link has been configured already */ + if (!(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].flags & CONFIGURED)) { + + if (ftmod_ss7_mtp3_linkset_config(x)) { + SS7_CRITICAL("MTP3 LINKSET %d configuration FAILED!\n", x); + SS7_ASSERT + } else { + SS7_INFO("MTP3 LINKSET %d configuration DONE!\n", x); + } + + /* set the CONFIGURED flag */ + g_ftdm_sngss7_data.cfg.mtpLinkSet[x].flags |= CONFIGURED; + } /* if !CONFIGURED */ + + x++; + } /* while (g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) */ + + x = 1; + while ((g_ftdm_sngss7_data.cfg.mtpRoute[x].id != 0)) { + /* check if this link has been configured already */ + if (!(g_ftdm_sngss7_data.cfg.mtpRoute[x].flags & CONFIGURED)) { + + if (ftmod_ss7_mtp3_route_config(x)) { + SS7_CRITICAL("MTP3 ROUTE %d configuration FAILED!\n", x); + SS7_ASSERT + } else { + SS7_INFO("MTP3 ROUTE %d configuration DONE!\n"); + } + + /* set the CONFIGURED flag */ + g_ftdm_sngss7_data.cfg.mtpRoute[x].flags |= CONFIGURED; + } /* if !CONFIGURED */ + + x++; + } /* while (g_ftdm_sngss7_data.cfg.mtpRoute[x].id != 0) */ + + if (!(g_ftdm_sngss7_data.cfg.mtpRoute[0].flags & CONFIGURED)) { + + if (ftmod_ss7_mtp3_route_config(0)) { + SS7_CRITICAL("MTP3 ROUTE 0 configuration FAILED!\n"); + SS7_ASSERT + } else { + SS7_INFO("MTP3 ROUTE %d configuration DONE!\n"); + } + + /* set the CONFIGURED flag */ + g_ftdm_sngss7_data.cfg.mtpRoute[0].flags |= CONFIGURED; + } /* if !CONFIGURED */ + + + x = 1; + while (g_ftdm_sngss7_data.cfg.isap[x].id != 0) { + /* check if this link has been configured already */ + if (!(g_ftdm_sngss7_data.cfg.isap[x].flags & CONFIGURED)) { + + if (ftmod_ss7_isup_isap_config(x)) { + SS7_CRITICAL("ISUP ISAP %d configuration FAILED!\n", x); + SS7_ASSERT + } else { + SS7_INFO("ISUP ISAP %d configuration DONE!\n", x); + } + + if (ftmod_ss7_cc_isap_config(x)) { + SS7_CRITICAL("CC ISAP %d configuration FAILED!\n", x); + SS7_ASSERT + } else { + SS7_INFO("CC ISAP %d configuration DONE!\n", x); + } + + /* set the CONFIGURED flag */ + g_ftdm_sngss7_data.cfg.isap[x].flags |= CONFIGURED; + } /* if !CONFIGURED */ + + x++; + } /* while (g_ftdm_sngss7_data.cfg.isap[x].id != 0) */ + + x = 1; + while (g_ftdm_sngss7_data.cfg.isupIntf[x].id != 0) { + /* check if this link has been configured already */ + if (!(g_ftdm_sngss7_data.cfg.isupIntf[x].flags & CONFIGURED)) { + + if (ftmod_ss7_isup_intf_config(x)) { + SS7_CRITICAL("ISUP INTF %d configuration FAILED!\n", x); + SS7_ASSERT + } else { + SS7_INFO("ISUP INTF %d configuration DONE!\n", x); + } + + /* set the CONFIGURED flag */ + g_ftdm_sngss7_data.cfg.isupIntf[x].flags |= CONFIGURED; + } /* if !CONFIGURED */ + + x++; + } /* while (g_ftdm_sngss7_data.cfg.isupIntf[x].id != 0) */ + + x = 1; + while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { + /* check if this link has been configured already */ + if (!(g_ftdm_sngss7_data.cfg.isupCkt[x].flags & CONFIGURED)) { + if ( g_ftdm_sngss7_data.cfg.isupCkt[x].type == 0) { + if (ftmod_ss7_isup_ckt_config(x)) { + SS7_CRITICAL("ISUP CKT %d configuration FAILED!\n", x); + SS7_ASSERT + } else { + SS7_INFO("ISUP CKT %d configuration DONE!\n", x); + } + } + + /* set the CONFIGURED flag */ + g_ftdm_sngss7_data.cfg.isupCkt[x].flags |= CONFIGURED; + } /* if !CONFIGURED */ + + x++; + } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */ + + return 0; +} + +/******************************************************************************/ +int ftmod_ss7_mtp1_gen_config(void) +{ + L1Mngmt cfg; /*configuration structure*/ + Pst pst; /*post structure*/ + + /* initalize the post structure */ + smPstInit(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTL1; + + /* clear the configuration structure */ + memset(&cfg, 0x0, sizeof(L1Mngmt)); + + /* fill in some general sections of the header */ + smHdrInit(&cfg.hdr); + + /* fill in the post structure */ + smPstInit( &cfg.t.cfg.s.l1Gen.sm ); + + /*fill in the specific fields of the header */ + cfg.hdr.msgType = TCFG; + cfg.hdr.entId.ent = ENTL1; + cfg.hdr.entId.inst = S_INST; + cfg.hdr.elmId.elmnt = STGEN; + + cfg.t.cfg.s.l1Gen.sm.srcEnt = ENTL1; + cfg.t.cfg.s.l1Gen.sm.dstEnt = ENTSM; + + cfg.t.cfg.s.l1Gen.nmbLnks = MAX_L1_LINKS; + cfg.t.cfg.s.l1Gen.poolTrUpper = POOL_UP_TR; /* upper pool threshold */ + cfg.t.cfg.s.l1Gen.poolTrLower = POOL_LW_TR; /* lower pool threshold */ + + return(sng_cfg_mtp1(&pst, &cfg)); +} + +/******************************************************************************/ +int ftmod_ss7_mtp2_gen_config(void) +{ + SdMngmt cfg; + Pst pst; + + /* initalize the post structure */ + smPstInit(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTSD; + + /* clear the configuration structure */ + memset(&cfg, 0x0, sizeof(SdMngmt)); + + /* fill in some general sections of the header */ + smHdrInit(&cfg.hdr); + + /* fill in the post structure */ + smPstInit( &cfg.t.cfg.s.sdGen.sm ); + + /* fill in the specific fields of the header */ + cfg.hdr.msgType = TCFG; + cfg.hdr.entId.ent = ENTSD; + cfg.hdr.entId.inst = S_INST; + cfg.hdr.elmId.elmnt = STGEN; + + cfg.t.cfg.s.sdGen.sm.srcEnt = ENTSD; + cfg.t.cfg.s.sdGen.sm.dstEnt = ENTSM; + + cfg.t.cfg.s.sdGen.nmbLnks = MAX_SD_LINKS; + cfg.t.cfg.s.sdGen.poolTrUpper = POOL_UP_TR; + cfg.t.cfg.s.sdGen.poolTrLower = POOL_LW_TR; + + return(sng_cfg_mtp2(&pst, &cfg)); +} + +/******************************************************************************/ +int ftmod_ss7_mtp3_gen_config(void) +{ + SnMngmt cfg; + Pst pst; + + /* initalize the post structure */ + smPstInit(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTSN; + + /*clear the configuration structure*/ + memset(&cfg, 0x0, sizeof(SnMngmt)); + + /*fill in some general sections of the header*/ + smHdrInit(&cfg.hdr); + + /* fill in the post structure */ + smPstInit(&cfg.t.cfg.s.snGen.sm); + + /*fill in the specific fields of the header*/ + cfg.hdr.msgType = TCFG; + cfg.hdr.entId.ent = ENTSN; + cfg.hdr.entId.inst = S_INST; + cfg.hdr.elmId.elmnt = STGEN; + + cfg.t.cfg.s.snGen.sm.srcEnt = ENTSN; + cfg.t.cfg.s.snGen.sm.dstEnt = ENTSM; + + + cfg.t.cfg.s.snGen.typeSP = LSN_TYPE_SP; /* type of signalling postatic int */ + cfg.t.cfg.s.snGen.spCode1 = g_ftdm_sngss7_data.cfg.spc; /* our DPC for CCITT version */ + +#if (SS7_ANS92 || SS7_ANS88 || SS7_ANS96 || SS7_CHINA || defined(TDS_ROLL_UPGRADE_SUPPORT)) + cfg.t.cfg.s.snGen.spCode2 = g_ftdm_sngss7_data.cfg.spc; /* our DPC for ANSI or CHINA version */ +#endif + + cfg.t.cfg.s.snGen.ssfValid = TRUE; /* ssf validation required */ + cfg.t.cfg.s.snGen.nmbDLSap = MAX_SN_LINKS; /* number of MTP Data Link SAPs */ + cfg.t.cfg.s.snGen.nmbNSap = MAX_SN_VARIANTS; /* number of Upper Layer Saps */ + cfg.t.cfg.s.snGen.nmbRouts = MAX_SN_ROUTES; /* maximum number of routing entries */ + cfg.t.cfg.s.snGen.nmbLnkSets = MAX_SN_LINKSETS; /* number of link sets */ + cfg.t.cfg.s.snGen.nmbRteInst = MAX_SN_ROUTES*16; /* number of simultaneous Rte instances */ + cfg.t.cfg.s.snGen.cbTimeRes = SN_CB_PERIOD; /* link time resolution */ + cfg.t.cfg.s.snGen.spTimeRes = SN_SP_PERIOD; /* general time resolution */ + cfg.t.cfg.s.snGen.rteTimeRes = SN_RTE_PERIOD; /* route time resolution */ + cfg.t.cfg.s.snGen.extCmbndLnkst = FALSE; /* enbale extended combined linkset feature */ + +#if (defined(LSNV3) || defined(SN_MULTIPLE_NETWORK_RESTART)) + +#else + cfg.t.cfg.s.snGen.rstReq = LSN_NO_RST; /* restarting procedure required */ + cfg.t.cfg.s.snGen.tfrReq = FALSE; /* TFR procedure required or not */ + cfg.t.cfg.s.snGen.tmr.t15.enb = TRUE; /* t15 - waiting to start route set congestion test */ + cfg.t.cfg.s.snGen.tmr.t15.val = 30; + cfg.t.cfg.s.snGen.tmr.t16.enb = TRUE; /* t16 - waiting for route set congestion status update */ + cfg.t.cfg.s.snGen.tmr.t16.val = 20; + cfg.t.cfg.s.snGen.tmr.t18.enb = TRUE; /* t18 - waiting for links to become available */ + cfg.t.cfg.s.snGen.tmr.t18.val = 200; + cfg.t.cfg.s.snGen.tmr.t19.enb = TRUE; /* t19 - waiting to receive all traffic restart allowed */ + cfg.t.cfg.s.snGen.tmr.t19.val = 690; + cfg.t.cfg.s.snGen.tmr.t21.enb = TRUE; /* t21 - waiting to restart traffic routed through adjacent SP */ + cfg.t.cfg.s.snGen.tmr.t21.val = 650; +# if (SS7_ANS92 || SS7_ANS88 || SS7_ANS96 || defined(TDS_ROLL_UPGRADE_SUPPORT)) + cfg.t.cfg.s.snGen.t26.enb = TRUE; /* t26 - waiting to repeat traffic restart waiting message for ANSI */ + cfg.t.cfg.s.snGen.t26.val = 600; +# endif +#endif + +#if (SS7_ANS88 || SS7_ANS92 || SS7_ANS96) + cfg.t.cfg.s.snGen.mopc = FALSE; +#endif + + return(sng_cfg_mtp3(&pst, &cfg)); +} + +/******************************************************************************/ +int ftmod_ss7_isup_gen_config(void) +{ + SiMngmt cfg; + Pst pst; + + /* initalize the post structure */ + smPstInit(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTSI; + + /* clear the configuration structure */ + memset(&cfg, 0x0, sizeof(SiMngmt)); + + /* fill in some general sections of the header */ + smHdrInit(&cfg.hdr); + + /* fill in the post structure */ + smPstInit( &cfg.t.cfg.s.siGen.sm ); + + /*fill in the specific fields of the header */ + cfg.hdr.msgType = TCFG; + cfg.hdr.entId.ent = ENTSI; + cfg.hdr.entId.inst = S_INST; + cfg.hdr.elmId.elmnt = STGEN; + + cfg.t.cfg.s.siGen.sm.srcEnt = ENTSI; + cfg.t.cfg.s.siGen.sm.dstEnt = ENTSM; + + cfg.t.cfg.s.siGen.nmbSaps = MAX_CC_INTERFACE; /* Number of ISUP Saps */ + cfg.t.cfg.s.siGen.nmbNSaps = MAX_SN_INTERFACE; /* Number of Network Saps */ + cfg.t.cfg.s.siGen.nmbCir = MAX_SI_CIRCUITS; /* Number of circuits */ + cfg.t.cfg.s.siGen.nmbIntf = MAX_SI_INTERFACES; /* Number of interfaces */ + cfg.t.cfg.s.siGen.nmbCirGrp = MAX_SI_CIR_GRP; /* Max number of circuit groups */ + cfg.t.cfg.s.siGen.nmbCalRef = MAX_SI_CALL_REF; /* Number of Call References */ + cfg.t.cfg.s.siGen.timeRes = SI_PERIOD; /* time resolution */ + cfg.t.cfg.s.siGen.sccpSup = FALSE; /* SCCP support */ + cfg.t.cfg.s.siGen.handleTTBinCC = FALSE; /* Flag used for controlling TTB feature */ + cfg.t.cfg.s.siGen.mapCPCandFCI = TRUE; /* Flag used for controlling TTB feature */ +#if (LSIV3 || LSIV4 || LSIV5) + cfg.t.cfg.s.siGen.lnkSelOpt = SI_LINK_SELECTION; /* link selector option */ +#endif + cfg.t.cfg.s.siGen.poolTrUpper = POOL_UP_TR; /* upper pool threshold */ + cfg.t.cfg.s.siGen.poolTrLower = POOL_LW_TR; /* lower pool threshold */ + cfg.t.cfg.s.siGen.cirGrTmr.t18.enb = TRUE; /* t18 timer - group blocking sent */ + cfg.t.cfg.s.siGen.cirGrTmr.t18.val = 300; + cfg.t.cfg.s.siGen.cirGrTmr.t19.enb = TRUE; /* t19 timer - initial group blocking sent */ + cfg.t.cfg.s.siGen.cirGrTmr.t19.val = 3000; + cfg.t.cfg.s.siGen.cirGrTmr.t20.enb = TRUE; /* t20 timer - group unblocking sent */ + cfg.t.cfg.s.siGen.cirGrTmr.t20.val = 300; + cfg.t.cfg.s.siGen.cirGrTmr.t21.enb = TRUE; /* t21 timer - initial grp unblocking sent */ + cfg.t.cfg.s.siGen.cirGrTmr.t21.val = 3000; + cfg.t.cfg.s.siGen.cirGrTmr.t22.enb = TRUE; /* t22 timer - group reset sent */ + cfg.t.cfg.s.siGen.cirGrTmr.t22.val = 300; + cfg.t.cfg.s.siGen.cirGrTmr.t23.enb = TRUE; /* t23 timer - initial group reset sent */ + cfg.t.cfg.s.siGen.cirGrTmr.t23.val = 3000; +#ifndef SS7_UK + cfg.t.cfg.s.siGen.cirGrTmr.t28.enb = TRUE; /* t28 timer - circuit group query sent */ + cfg.t.cfg.s.siGen.cirGrTmr.t28.val = 100; +#endif +#if (SS7_ANS88 || SS7_ANS92 || SS7_ANS95 || SS7_BELL) + cfg.t.cfg.s.siGen.cirGrTmr.tFGR.enb = TRUE; /* first group received timer */ + cfg.t.cfg.s.siGen.cirGrTmr.tFGR.val = 50; +#endif +#if CGPN_CHK + cfg.t.cfg.s.siGen.cgPtyNumGenCfg = TRUE; /* Calling party number general config flag */ +#endif +#ifdef SI_SUPPRESS_CFN + cfg.t.cfg.s.siGen.suppressCfn = TRUE; /* Flag used for 'suppress CFN' feature */ +#endif + + return(sng_cfg_isup(&pst, &cfg)); + +} + +/******************************************************************************/ +int ftmod_ss7_cc_gen_config(void) +{ + CcMngmt cfg; + Pst pst; + + /* initalize the post structure */ + smPstInit(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTCC; + + /*clear the configuration structure*/ + memset(&cfg, 0x0, sizeof(CcMngmt)); + + /*fill in some general sections of the header*/ + smHdrInit(&cfg.hdr); + + /* fill in the post structure */ + smPstInit( &cfg.t.cfg.s.ccGen.sm ); + + /*fill in the specific fields of the header*/ + cfg.hdr.msgType = TCFG; + cfg.hdr.entId.ent = ENTCC; + cfg.hdr.entId.inst = S_INST; + cfg.hdr.elmId.elmnt = STGEN; + + cfg.t.cfg.s.ccGen.sm.srcEnt = ENTCC; + cfg.t.cfg.s.ccGen.sm.dstEnt = ENTSM; + + cfg.t.cfg.s.ccGen.poolTrUpper = POOL_UP_TR; /* upper pool threshold */ + cfg.t.cfg.s.ccGen.poolTrLower = POOL_LW_TR; /* lower pool threshold */ + + return(sng_cfg_cc(&pst, &cfg)); +} + +/******************************************************************************/ +int ftmod_ss7_mtp1_psap_config(int id) +{ + L1Mngmt cfg; + Pst pst; + sng_mtp_link_t *k = &g_ftdm_sngss7_data.cfg.mtpLink[id]; + + /* initalize the post structure */ + smPstInit(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTL1; + + /*clear the configuration structure*/ + memset(&cfg, 0x0, sizeof(L1Mngmt)); + + /*fill in some general sections of the header*/ + smHdrInit(&cfg.hdr); + + /*fill in the specific fields of the header*/ + cfg.hdr.msgType = TCFG; + cfg.hdr.entId.ent = ENTL1; + cfg.hdr.entId.inst = S_INST; + cfg.hdr.elmId.elmnt = STPSAP; + + cfg.hdr.elmId.elmntInst1 = k->id; + + cfg.t.cfg.s.l1PSAP.span = k->mtp1.span; + cfg.t.cfg.s.l1PSAP.chan = k->mtp1.chan; + cfg.t.cfg.s.l1PSAP.spId = k->id; + + return(sng_cfg_mtp1(&pst, &cfg)); +} + +/******************************************************************************/ +int ftmod_ss7_mtp2_dlsap_config(int id) +{ + SdMngmt cfg; + Pst pst; + sng_mtp_link_t *k = &g_ftdm_sngss7_data.cfg.mtpLink[id]; + + /* initalize the post structure */ + smPstInit( &pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTSD; + + /*clear the configuration structure*/ + memset(&cfg, 0x0, sizeof(SdMngmt)); + + /*fill in some general sections of the header*/ + smHdrInit(&cfg.hdr); + + /*fill in the specific fields of the header*/ + cfg.hdr.msgType = TCFG; + cfg.hdr.entId.ent = ENTSD; + cfg.hdr.entId.inst = S_INST; + cfg.hdr.elmId.elmnt = STDLSAP; + + cfg.hdr.elmId.elmntInst1 = k->id; + + cfg.t.cfg.s.sdDLSAP.mem.region = S_REG; /* memory region */ + cfg.t.cfg.s.sdDLSAP.mem.pool = S_POOL; /* memory pool */ + cfg.t.cfg.s.sdDLSAP.swtch = k->mtp2.linkType; /* protocol type */ + cfg.t.cfg.s.sdDLSAP.priorDl = PRIOR0; /* priority for data link layer */ + cfg.t.cfg.s.sdDLSAP.routeDl = RTESPEC; /* route for data link layer */ + cfg.t.cfg.s.sdDLSAP.selectorDl = 0; /* upper interface selector */ + cfg.t.cfg.s.sdDLSAP.dstProcId = SFndProcId(); /* the procid of MAC/L1/MTP1 */ + cfg.t.cfg.s.sdDLSAP.entMac = ENTL1; /* entity for MAC */ + cfg.t.cfg.s.sdDLSAP.instMac = S_INST; /* instance for MAC */ + cfg.t.cfg.s.sdDLSAP.priorMac = PRIOR0; /* priority for MAC layer */ + cfg.t.cfg.s.sdDLSAP.routeMac = RTESPEC; /* route for MAC layer */ + cfg.t.cfg.s.sdDLSAP.selectorMac = 0; /* lower interface selector */ + cfg.t.cfg.s.sdDLSAP.memMac.region = S_REG; /* memory region and pool id for MAC */ + cfg.t.cfg.s.sdDLSAP.memMac.pool = S_POOL; + cfg.t.cfg.s.sdDLSAP.maxOutsFrms = MAX_SD_OUTSTANDING; /* maximum outstanding frames */ + cfg.t.cfg.s.sdDLSAP.errType = SD_ERR_NRM; + cfg.t.cfg.s.sdDLSAP.t1.enb = TRUE; /* timer 1 - Alignment Ready Timer */ + cfg.t.cfg.s.sdDLSAP.t1.val = k->mtp2.t1; + cfg.t.cfg.s.sdDLSAP.t2.enb = TRUE; /* timer 2 - Not Aligned Timer */ + cfg.t.cfg.s.sdDLSAP.t2.val = k->mtp2.t2; + cfg.t.cfg.s.sdDLSAP.t3.enb = TRUE; /* timer 3 - Aligned Timer */ + cfg.t.cfg.s.sdDLSAP.t3.val = k->mtp2.t3; + cfg.t.cfg.s.sdDLSAP.t5.enb = TRUE; /* timer 5 - Sending SIB timer */ + cfg.t.cfg.s.sdDLSAP.t5.val = k->mtp2.t5; + cfg.t.cfg.s.sdDLSAP.t6.enb = TRUE; /* timer 6 - Remote Congestion Timer */ + cfg.t.cfg.s.sdDLSAP.t6.val = k->mtp2.t6; + cfg.t.cfg.s.sdDLSAP.t7.enb = TRUE; /* timer 7 - Excessive delay of acknowledgement timer */ + cfg.t.cfg.s.sdDLSAP.t7.val = k->mtp2.t7; + cfg.t.cfg.s.sdDLSAP.provEmrgcy = k->mtp2.t4e; /* emergency proving period */ + cfg.t.cfg.s.sdDLSAP.provNormal = k->mtp2.t4n; /* normal proving period */ + cfg.t.cfg.s.sdDLSAP.lssuLen = k->mtp2.lssuLength; /* one or two byte LSSU length */ + cfg.t.cfg.s.sdDLSAP.maxFrmLen = MAX_SD_FRAME_LEN; /* max frame length for MSU */ + cfg.t.cfg.s.sdDLSAP.congDisc = FALSE; /* congestion discard TRUE or FALSE */ + cfg.t.cfg.s.sdDLSAP.sdT = MAX_SD_SUERM; /* SUERM error rate threshold */ + cfg.t.cfg.s.sdDLSAP.sdTie = MAX_SD_AERM_EMERGENCY; /* AERM emergency error rate threshold */ + cfg.t.cfg.s.sdDLSAP.sdTin = MAX_SD_AERM_NORMAL; /* AERM normal error rate threshold */ + cfg.t.cfg.s.sdDLSAP.sdN1 = MAX_SD_MSU_RETRANS; /* maximum number of MSUs for retransmission */ + cfg.t.cfg.s.sdDLSAP.sdN2 = MAX_SD_OCTETS_RETRANS; /* maximum number of MSU octets for retrans */ + cfg.t.cfg.s.sdDLSAP.sdCp = MAX_SD_ALIGN_ATTEMPTS; /* maximum number of alignment attempts */ + cfg.t.cfg.s.sdDLSAP.spIdSE = k->mtp2.mtp1Id; /* service provider id */ + cfg.t.cfg.s.sdDLSAP.sdtFlcStartTr = 256; /* SDT interface flow control start thresh */ + cfg.t.cfg.s.sdDLSAP.sdtFlcEndTr = 512; /* SDT interface flow control end thresh */ + +#ifdef SD_HSL + cfg.t.cfg.s.sdDLSAP.sapType =; /* Indcates whether link is HSL or LSL */ + cfg.t.cfg.s.sdDLSAP.sapFormat =; /* The extened sequence no to be used or not */ + cfg.t.cfg.s.sdDLSAP.t8.enb =; /* timer 8 configuration structure */ + cfg.t.cfg.s.sdDLSAP.sdTe =; /* EIM threshold */ + cfg.t.cfg.s.sdDLSAP.sdUe =; /* increment constant */ + cfg.t.cfg.s.sdDLSAP.sdDe =; /* decrement constant */ +#endif /* HIGH_SPEED_SIGNALING_SUPPORT */ + +#if (SS7_TTC || SS7_NTT) + cfg.t.cfg.s.sdDLSAP.numRtb =; /* outstanding number of messages in RTB */ + cfg.t.cfg.s.sdDLSAP.tf =; /* FISU transmission interval */ + cfg.t.cfg.s.sdDLSAP.tfv =; /* FISU transmission interval during verification */ + cfg.t.cfg.s.sdDLSAP.to =; /* SIO transmission interval */ + cfg.t.cfg.s.sdDLSAP.ta =; /* SIE transmission interval */ + cfg.t.cfg.s.sdDLSAP.ts =; /* SIOS transmission interval */ + cfg.t.cfg.s.sdDLSAP.tso =; /* SIOS transmission duration when out of service */ + cfg.t.cfg.s.sdDLSAP.te =; /* SU normalization time */ +#endif /* (SS7_TTC || SS7_NTT) */ + +#if (SS7_NTT) /* NTTT - Q.703 */ + cfg.t.cfg.s.sdDLSAP.repMsuNack =; /* Nack on receipt of repeated MSU */ + cfg.t.cfg.s.sdDLSAP.invFibIgnore =; /* invalid FIB ignore or bring the link down */ + cfg.t.cfg.s.sdDLSAP.invBsnIgnore =; /* invalid BSN ignore or bring the link down */ + cfg.t.cfg.s.sdDLSAP.congAbatOnNack =; /* congestion abatement on nack or only on acks */ +#endif /* (SS7_NTT) */ + +#ifdef TDS_ROLL_UPGRADE_SUPPORT + cfg.t.cfg.s.sdDLSAP.hlremIntfValid = FALSE; /* Upper Sap Version number valid ? */ + cfg.t.cfg.s.sdDLSAP.remIntfVer = SDTIFVER; /* remote version info */ +#endif /*RUG*/ + + return(sng_cfg_mtp2(&pst, &cfg)); + return 0; +} + +/******************************************************************************/ +int ftmod_ss7_mtp3_dlsap_config(int id) +{ + Pst pst; + SnMngmt cfg; + sng_mtp_link_t *k = &g_ftdm_sngss7_data.cfg.mtpLink[id]; + + + /* initalize the post structure */ + smPstInit(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTSN; + + /*clear the configuration structure*/ + memset(&cfg, 0x0, sizeof(SnMngmt)); + + /*fill in some general sections of the header*/ + smHdrInit(&cfg.hdr); + + /*fill in the specific fields of the header*/ + cfg.hdr.msgType = TCFG; + cfg.hdr.entId.ent = ENTSN; + cfg.hdr.entId.inst = S_INST; + cfg.hdr.elmId.elmnt = STDLSAP; + + cfg.hdr.elmId.elmntInst1 = k->id; + + cfg.t.cfg.s.snDLSAP.lnkSetId = k->mtp3.linkSetId; /* link set ID */ + cfg.t.cfg.s.snDLSAP.opc = k->mtp3.spc; /* Originating Postatic int Code */ + cfg.t.cfg.s.snDLSAP.adjDpc = k->mtp3.apc; /* Adlacent Destination Postatic int Code */ + cfg.t.cfg.s.snDLSAP.lnkPrior = 0; /* link priority within the link set */ + cfg.t.cfg.s.snDLSAP.msgSize = MAX_SN_MSG_SIZE; /* message length */ + cfg.t.cfg.s.snDLSAP.msgPrior = 0; /* management message priority */ + cfg.t.cfg.s.snDLSAP.lnkType = k->mtp3.linkType; /* link type ANSI, ITU, BICI or CHINA */ + cfg.t.cfg.s.snDLSAP.upSwtch = k->mtp3.switchType; /* user part switch type */ +# if (SS7_ANS92 || SS7_ANS88 || SS7_ANS96 || SS7_CHINA) + cfg.t.cfg.s.snDLSAP.l2Type = LSN_MTP2_56KBPS; /* layer 2 type - 56kbps MTP2 link, 1.536Mbps MTP2 link or QSAAL link */ + cfg.t.cfg.s.snDLSAP.isCLink = FALSE; /* identifies if the link is a C type link.Required to check if sls has to be rotated.*/ +# endif + cfg.t.cfg.s.snDLSAP.maxSLTtry = MAX_SLTM_RETRIES; /* maximun times to retry SLTM */ + cfg.t.cfg.s.snDLSAP.p0QLen = 32; /* size of the priority 0 Q */ + cfg.t.cfg.s.snDLSAP.p1QLen = 32; /* size of the priority 1 Q */ + cfg.t.cfg.s.snDLSAP.p2QLen = 32; /* size of the priority 2 Q */ + cfg.t.cfg.s.snDLSAP.p3QLen = 32; /* size of the priority 3 Q */ + cfg.t.cfg.s.snDLSAP.discPrior = 0; /* discard priority */ +#ifndef SDT2 + cfg.t.cfg.s.snDLSAP.maxCredit = MAX_SN_CREDIT; /* max credit */ +#endif /* SDT2 */ + cfg.t.cfg.s.snDLSAP.lnkId = 0; /* signalling link allocation procedure identity */ + cfg.t.cfg.s.snDLSAP.lnkTstSLC = k->mtp3.slc; /* link selection code for link test */ + cfg.t.cfg.s.snDLSAP.tstLen = 6; /* link test pattern length */ + cfg.t.cfg.s.snDLSAP.tst[0] = 'K'; /* link test pattern */ + cfg.t.cfg.s.snDLSAP.tst[1] = 'O'; /* link test pattern */ + cfg.t.cfg.s.snDLSAP.tst[2] = 'N'; /* link test pattern */ + cfg.t.cfg.s.snDLSAP.tst[3] = 'R'; /* link test pattern */ + cfg.t.cfg.s.snDLSAP.tst[4] = 'A'; /* link test pattern */ + cfg.t.cfg.s.snDLSAP.tst[5] = 'D'; /* link test pattern */ + cfg.t.cfg.s.snDLSAP.ssf = k->mtp3.ssf; /* sub service field */ + cfg.t.cfg.s.snDLSAP.dstProcId = SFndProcId(); /* destination processor id */ + cfg.t.cfg.s.snDLSAP.dstEnt = ENTSD; /* entity */ + cfg.t.cfg.s.snDLSAP.dstInst = S_INST; /* instance */ + cfg.t.cfg.s.snDLSAP.prior = PRIOR0; /* priority */ + cfg.t.cfg.s.snDLSAP.route = RTESPEC; /* route */ + cfg.t.cfg.s.snDLSAP.selector = 0; /* lower layer selector */ + cfg.t.cfg.s.snDLSAP.mem.region = S_REG; /* memory region id */ + cfg.t.cfg.s.snDLSAP.mem.pool = S_POOL; /* memory pool id */ +#if( SS7_ANS92 || SS7_ANS88 || SS7_ANS96 || SS7_CHINA ) + cfg.t.cfg.s.snDLSAP.dpcLen = DPC24; /* dpc length 24 bits */ +#else + cfg.t.cfg.s.snDLSAP.dpcLen = DPC14; /* dpc length 14 bits */ +#endif + cfg.t.cfg.s.snDLSAP.spId = k->mtp3.mtp2Id ;/* service provider id */ +#if (SS7_ITU88 || SS7_CHINA || SS7_TTC || SS7_NTT || SS7_BICI ) + cfg.t.cfg.s.snDLSAP.flushContFlag = FALSE; /* flush continue handling */ +#else + cfg.t.cfg.s.snDLSAP.flushContFlag = TRUE; /* flush continue handling */ +#endif + cfg.t.cfg.s.snDLSAP.tmr.t1.enb = TRUE; /* t1 - delay to avoid missequencing on changeover */ + cfg.t.cfg.s.snDLSAP.tmr.t1.val = k->mtp3.t1; + cfg.t.cfg.s.snDLSAP.tmr.t2.enb = TRUE; /* t2 - waiting for changeover ack */ + cfg.t.cfg.s.snDLSAP.tmr.t2.val = k->mtp3.t2; + cfg.t.cfg.s.snDLSAP.tmr.t3.enb = TRUE; /* t3 - delay to avoid missequencing on changeback */ + cfg.t.cfg.s.snDLSAP.tmr.t3.val = k->mtp3.t3; + cfg.t.cfg.s.snDLSAP.tmr.t4.enb = TRUE; /* t4 - waiting for first changeback ack */ + cfg.t.cfg.s.snDLSAP.tmr.t4.val = k->mtp3.t4; + cfg.t.cfg.s.snDLSAP.tmr.t5.enb = TRUE; /* t5 - waiting for second changeback ack */ + cfg.t.cfg.s.snDLSAP.tmr.t5.val = k->mtp3.t5; + cfg.t.cfg.s.snDLSAP.tmr.t7.enb = TRUE; /* t7 - waiting for link connection ack */ + cfg.t.cfg.s.snDLSAP.tmr.t7.val = k->mtp3.t7; + cfg.t.cfg.s.snDLSAP.tmr.t12.enb = TRUE; /* t12 - waiting for uninhibit ack */ + cfg.t.cfg.s.snDLSAP.tmr.t12.val = k->mtp3.t12; + cfg.t.cfg.s.snDLSAP.tmr.t13.enb = TRUE; /* t13 - waiting for forced uninhibit */ + cfg.t.cfg.s.snDLSAP.tmr.t13.val = k->mtp3.t13; + cfg.t.cfg.s.snDLSAP.tmr.t14.enb = TRUE; /* t14 - waiting for inhibition ack */ + cfg.t.cfg.s.snDLSAP.tmr.t14.val = k->mtp3.t14; + cfg.t.cfg.s.snDLSAP.tmr.t17.enb = TRUE; /* t17 - delay to avoid oscillation of initial alignment failure */ + cfg.t.cfg.s.snDLSAP.tmr.t17.val = k->mtp3.t17; + cfg.t.cfg.s.snDLSAP.tmr.t22.enb = TRUE; /* t22 - local inhibit test timer */ + cfg.t.cfg.s.snDLSAP.tmr.t22.val = k->mtp3.t22; + cfg.t.cfg.s.snDLSAP.tmr.t23.enb = TRUE; /* t23 - remote inhibit test timer */ + cfg.t.cfg.s.snDLSAP.tmr.t23.val = k->mtp3.t23; + cfg.t.cfg.s.snDLSAP.tmr.t24.enb = TRUE; /* t24 - stabilizing timer */ + cfg.t.cfg.s.snDLSAP.tmr.t24.val = k->mtp3.t24; + cfg.t.cfg.s.snDLSAP.tmr.t31.enb = TRUE; /* t31 - BSN requested timer */ + cfg.t.cfg.s.snDLSAP.tmr.t31.val = k->mtp3.t31; + cfg.t.cfg.s.snDLSAP.tmr.t32.enb = TRUE; /* t32 - SLT timer */ + cfg.t.cfg.s.snDLSAP.tmr.t32.val = k->mtp3.t32; + cfg.t.cfg.s.snDLSAP.tmr.t33.enb = TRUE; /* t33 - connecting timer */ + cfg.t.cfg.s.snDLSAP.tmr.t33.val = k->mtp3.t33; + cfg.t.cfg.s.snDLSAP.tmr.t34.enb = TRUE; /* t34 - periodic signalling link test timer */ + cfg.t.cfg.s.snDLSAP.tmr.t34.val = k->mtp3.t34; +#if (SS7_ANS92 || SS7_ANS88 || SS7_ANS96 || defined(TDS_ROLL_UPGRADE_SUPPORT)) + cfg.t.cfg.s.snDLSAP.tmr.t35.enb = TRUE; /* t35 - false link congestion timer, same as t31 of ANSI'96*/ + cfg.t.cfg.s.snDLSAP.tmr.t35.val = k->mtp3.t35; + cfg.t.cfg.s.snDLSAP.tmr.t36.enb = TRUE; /* t36 - false link congestion timer, same as t33 of ANSI'96*/ + cfg.t.cfg.s.snDLSAP.tmr.t36.val = k->mtp3.t36; + cfg.t.cfg.s.snDLSAP.tmr.t37.enb = TRUE; /* t37 - false link congestion timer, same as t34 of ANSI'96*/ + cfg.t.cfg.s.snDLSAP.tmr.t37.val = k->mtp3.t37; + cfg.t.cfg.s.snDLSAP.tmr.tCraft.enb = TRUE; /* link referral craft timer - T19 in ANSI */ + cfg.t.cfg.s.snDLSAP.tmr.tCraft.val = k->mtp3.tcraft; +#endif +#ifdef SDT2 + cfg.t.cfg.s.snDLSAP.tmr.tFlc.enb = TRUE; /* flow control timer */ + cfg.t.cfg.s.snDLSAP.tmr.tFlc.val = 300; + cfg.t.cfg.s.snDLSAP.tmr.tBnd.enb = TRUE; /* bind request timer */ + cfg.t.cfg.s.snDLSAP.tmr.tBnd.val = 20; +#endif /* SDT2 */ +#ifdef TDS_ROLL_UPGRADE_SUPPORT + cfg.t.cfg.s.snDLSAP.remIntfValid = FALSE; /* remote interface version is valid */ + cfg.t.cfg.s.snDLSAP.remIntfVer = SNTIFVER; /* remote interface version */ +#endif + + return(sng_cfg_mtp3(&pst, &cfg)); +} + +/******************************************************************************/ +int ftmod_ss7_mtp3_nsap_config(int id) +{ + Pst pst; + SnMngmt cfg; + sng_nsap_t *k = &g_ftdm_sngss7_data.cfg.nsap[id]; + + /* initalize the post structure */ + smPstInit(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTSN; + + /*clear the configuration structure*/ + memset(&cfg, 0x0, sizeof(SnMngmt)); + + /*fill in some general sections of the header*/ + smHdrInit(&cfg.hdr); + + /*fill in the specific fields of the header*/ + cfg.hdr.msgType = TCFG; + cfg.hdr.entId.ent = ENTSN; + cfg.hdr.entId.inst = S_INST; + cfg.hdr.elmId.elmnt = STNSAP; + + cfg.hdr.elmId.elmntInst1 = k->spId; + + cfg.t.cfg.s.snNSAP.ssf = k->ssf; /* sub service field */ + cfg.t.cfg.s.snNSAP.lnkType = k->linkType; /* link type -ANSI, ITU, CHINA or BICI */ + cfg.t.cfg.s.snNSAP.upSwtch = k->switchType; /* user part switch type */ + cfg.t.cfg.s.snNSAP.selector = 0; /* upper layer selector */ + cfg.t.cfg.s.snNSAP.mem.region = S_REG; /* memory region id */ + cfg.t.cfg.s.snNSAP.mem.pool = S_POOL; /* memory pool id */ + cfg.t.cfg.s.snNSAP.prior = PRIOR0; /* priority */ + cfg.t.cfg.s.snNSAP.route = RTESPEC; /* route */ +#if( SS7_ANS92 || SS7_ANS88 || SS7_ANS96 || SS7_CHINA ) + cfg.t.cfg.s.snNSAP.dpcLen = DPC24; /* dpc length 14 or 24 bits */ +#else + cfg.t.cfg.s.snNSAP.dpcLen = DPC14; /* dpc length 14 or 24 bits */ +#endif +#if (defined(SN_SG) || defined(TDS_ROLL_UPGRADE_SUPPORT)) + cfg.t.cfg.s.snNSAP.usrParts = ; /* user parts configured on self postatic int code on IP side */ +#endif +#ifdef TDS_ROLL_UPGRADE_SUPPORT + cfg.t.cfg.s.snNSAP.remIntfValid = FALSE; /* remote interface version is valid */ + cfg.t.cfg.s.snNSAP.remIntfVer = SNTIFVER; /* remote interface version */ +#endif + + return(sng_cfg_mtp3(&pst, &cfg)); +} + +/******************************************************************************/ +int ftmod_ss7_mtp3_linkset_config(int id) +{ + Pst pst; + SnMngmt cfg; + U16 c; + sng_link_set_t *k = &g_ftdm_sngss7_data.cfg.mtpLinkSet[id]; + + /* initalize the post structure */ + smPstInit(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTSN; + + /*clear the configuration structure*/ + memset(&cfg, 0x0, sizeof(SnMngmt)); + + /*fill in some general sections of the header*/ + smHdrInit(&cfg.hdr); + + /*fill in the specific fields of the header*/ + cfg.hdr.msgType = TCFG; + cfg.hdr.entId.ent = ENTSN; + cfg.hdr.entId.inst = S_INST; + cfg.hdr.elmId.elmnt = STLNKSET; /* link set */ + + cfg.hdr.elmId.elmntInst1 = k->id; + + cfg.t.cfg.s.snLnkSet.lnkSetId = k->id; /* link set ID */ + cfg.t.cfg.s.snLnkSet.lnkSetType = k->linkType; /* link type */ + cfg.t.cfg.s.snLnkSet.adjDpc = k->apc; /* adjacent DPC */ + cfg.t.cfg.s.snLnkSet.nmbActLnkReqd = k->minActive; /* minimum number of active links */ + cfg.t.cfg.s.snLnkSet.nmbCmbLnkSet = 1; /* number of combined link sets */ + for (c = 0; c < LSN_MAXCMBLNK; c++) { + cfg.t.cfg.s.snLnkSet.cmbLnkSet[c].cmbLnkSetId = c+1; + cfg.t.cfg.s.snLnkSet.cmbLnkSet[c].lnkSetPrior = 0; + } + + return(sng_cfg_mtp3(&pst, &cfg)); +} + +/******************************************************************************/ +int ftmod_ss7_mtp3_route_config(int id) +{ + Pst pst; + SnMngmt cfg; + sng_route_t *k = &g_ftdm_sngss7_data.cfg.mtpRoute[id]; + + /* initalize the post structure */ + smPstInit(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTSN; + + /*clear the configuration structure*/ + memset(&cfg, 0x0, sizeof(SnMngmt)); + + /*fill in some general sections of the header*/ + smHdrInit(&cfg.hdr); + + /*fill in the specific fields of the header*/ + cfg.hdr.msgType = TCFG; + cfg.hdr.entId.ent = ENTSN; + cfg.hdr.entId.inst = S_INST; + cfg.hdr.elmId.elmnt = STROUT; + + cfg.hdr.elmId.elmntInst1 = k->id; + + cfg.t.cfg.s.snRout.dpc = k->dpc; /* destination postatic int code */ + cfg.t.cfg.s.snRout.spType = LSN_TYPE_SP; /* signalling postatic int type */ + cfg.t.cfg.s.snRout.swtchType = k->linkType; /* switch type */ + cfg.t.cfg.s.snRout.upSwtch = k->switchType; /* user part switch type */ + cfg.t.cfg.s.snRout.cmbLnkSetId = k->cmbLinkSetId; /* combined link set ID */ + if (k->id == 0) { + cfg.t.cfg.s.snRout.dir = LSN_RTE_UP; /* direction */ + } else { + cfg.t.cfg.s.snRout.dir = LSN_RTE_DN; /* direction */ + } + cfg.t.cfg.s.snRout.rteToAdjSp = 0; /* flag indicating this route to adjacent SP */ + cfg.t.cfg.s.snRout.ssf = k->ssf; /* sub service field */ + cfg.t.cfg.s.snRout.brdcastFlg = TRUE; /* flag indicating to have TFP broadcast */ + if (cfg.t.cfg.s.snRout.swtchType == LSN_SW_ITU) { + cfg.t.cfg.s.snRout.rstReq = LSN_ITU92_RST; /* Restart type supported by the node */ + } else if ((cfg.t.cfg.s.snRout.swtchType == LSN_SW_ANS) || + (cfg.t.cfg.s.snRout.swtchType == LSN_SW_ANS96)) { + cfg.t.cfg.s.snRout.rstReq = LSN_ANS_RST; /* Restart type supported by the node */ + } else { + cfg.t.cfg.s.snRout.rstReq = LSN_NO_RST; /* Restart type supported by the node */ + } + if ((cfg.t.cfg.s.snRout.swtchType == LSN_SW_ITU) || + (cfg.t.cfg.s.snRout.swtchType == LSN_SW_CHINA) || + (cfg.t.cfg.s.snRout.swtchType == LSN_SW_BICI)) { + cfg.t.cfg.s.snRout.slsRange = LSN_ITU_SLS_RANGE; /* max value of SLS for this DPC */ + } else { + cfg.t.cfg.s.snRout.slsRange = LSN_ANSI_5BIT_SLS_RANGE; /* max value of SLS for this DPC */ + } + cfg.t.cfg.s.snRout.lsetSel = 0x1; /* linkset selection bit in SLS for STP */ + cfg.t.cfg.s.snRout.multiMsgPrior = FALSE; /* TRUE if multiple cong priorities of messages */ + cfg.t.cfg.s.snRout.rctReq = TRUE; /* route set congestion test required or not */ + cfg.t.cfg.s.snRout.slsLnk = FALSE; +#ifdef LSNV2 +# if (SS7_NTT || defined(TDS_ROLL_UPGRADE_SUPPORT)) + cfg.t.cfg.s.snRout.destSpec =; /* destination specfication A or B*/ +# endif +#endif +#if (defined(LSNV3) || defined(SN_MULTIPLE_NETWORK_RESTART)) + cfg.t.cfg.s.snRout.tfrReq =; /* TFR procedure required or not */ +#endif + cfg.t.cfg.s.snRout.tmr.t6.enb = TRUE; + cfg.t.cfg.s.snRout.tmr.t6.val = k->t6; + cfg.t.cfg.s.snRout.tmr.t8.enb = TRUE; /* t8 - transfer prohibited inhibition timer */ + cfg.t.cfg.s.snRout.tmr.t8.val = k->t8; + cfg.t.cfg.s.snRout.tmr.t10.enb = TRUE; /* t10 - waiting to repeat route set test */ + cfg.t.cfg.s.snRout.tmr.t10.val = k->t10; + cfg.t.cfg.s.snRout.tmr.t11.enb = TRUE; /* t11 - transfer restrict timer */ + cfg.t.cfg.s.snRout.tmr.t11.val = k->t11; + cfg.t.cfg.s.snRout.tmr.t19.enb = TRUE; /* t19 - TRA sent timer */ + cfg.t.cfg.s.snRout.tmr.t19.val = k->t19; + cfg.t.cfg.s.snRout.tmr.t21.enb = TRUE; /* t21 - waiting to restart traffic routed through adjacent SP */ + cfg.t.cfg.s.snRout.tmr.t21.val = k->t21; + +#if (defined(LSNV3) || defined(SN_MULTIPLE_NETWORK_RESTART)) + cfg.t.cfg.s.snRout.tmr.t15.enb = TRUE; /* t15 - waiting to start route set congestion test */ + cfg.t.cfg.s.snRout.tmr.t15.val = k->t15; + cfg.t.cfg.s.snRout.tmr.t16.enb = TRUE; /* t16 - waiting for route set congestion status update */ + cfg.t.cfg.s.snRout.tmr.t16.val = k->t16; + cfg.t.cfg.s.snRout.tmr.t18.enb = TRUE; /* t18 - transfer prohibited inhibition timer */ + cfg.t.cfg.s.snRout.tmr.t18.val = k->t18; +# if (SS7_ANS92 || SS7_ANS88 || SS7_ANS96 || defined(TDS_ROLL_UPGRADE_SUPPORT)) + cfg.t.cfg.s.snRout.tmr.t25.enb = TRUE; /* t25 - waiting to traffic resatrt allowed message for ANSI */ + cfg.t.cfg.s.snRout.tmr.t25.val = k->t25; + cfg.t.cfg.s.snRout.tmr.t26.enb = TRUE; /* t26 - waiting to repeat traffic restart waiting message for ANSI */ + cfg.t.cfg.s.snRout.tmr.t26.val = k->t26; +# endif +#endif +#if (SS7_TTC || SS7_NTT || defined(TDS_ROLL_UPGRADE_SUPPORT)) + cfg.t.cfg.s.snRout.tmr.tc.enb = TRUE; /* tc - Waiting for congestion abatement */ + cfg.t.cfg.s.snRout.tmr.tc.val = k->tc; +#endif +#if (defined(SN_SG) || defined(TDS_ROLL_UPGRADE_SUPPORT)) + cfg.t.cfg.s.snRout.tmr.tQry.enb = TRUE; /* Periodic query timer over the NIF */ + cfg.t.cfg.s.snRout.tmr.tQry.val = k->tqry; +#endif + + return(sng_cfg_mtp3(&pst, &cfg)); +} + +/******************************************************************************/ +int ftmod_ss7_isup_nsap_config(int id) +{ + SiMngmt cfg; + Pst pst; + sng_nsap_t *k = &g_ftdm_sngss7_data.cfg.nsap[id]; + + /* initalize the post structure */ + smPstInit(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTSI; + + /*clear the configuration structure*/ + memset(&cfg, 0x0, sizeof(SiMngmt)); + + /*fill in some general sections of the header*/ + smHdrInit(&cfg.hdr); + + /*fill in the specific fields of the header*/ + cfg.hdr.msgType = TCFG; + cfg.hdr.entId.ent = ENTSI; + cfg.hdr.entId.inst = S_INST; + cfg.hdr.elmId.elmnt = STNSAP; + + cfg.hdr.elmId.elmntInst1 = k->id; + +#if (SI_LMINT3 || SMSI_LMINT3) + cfg.t.cfg.s.siNSap.nsapId = k->id; /* Id of the NSAP being configured */ +#endif + cfg.t.cfg.s.siNSap.nwId = k->nwId; /* Network Id */ + cfg.t.cfg.s.siNSap.spId = k->spId; /* service providor id */ + cfg.t.cfg.s.siNSap.ssf = k->ssf; /* sub service field */ + cfg.t.cfg.s.siNSap.dstEnt = ENTSN; /* entity */ + cfg.t.cfg.s.siNSap.dstInst = S_INST; /* instance */ + cfg.t.cfg.s.siNSap.prior = PRIOR0; /* priority */ + cfg.t.cfg.s.siNSap.route = RTESPEC; /* route */ + cfg.t.cfg.s.siNSap.dstProcId = SFndProcId(); /* destination processor id */ + cfg.t.cfg.s.siNSap.sapType = SAP_MTP; /* sap type */ + cfg.t.cfg.s.siNSap.selector = 0; /* selector */ + cfg.t.cfg.s.siNSap.tINT.enb = TRUE; /* interface (Bind Confirm) timer */ + cfg.t.cfg.s.siNSap.tINT.val = 50; + cfg.t.cfg.s.siNSap.mem.region = S_REG; /* memory region & pool id */ + cfg.t.cfg.s.siNSap.mem.pool = S_POOL; + +#ifdef TDS_ROLL_UPGRADE_SUPPORT + cfg.t.cfg.s.siNSap.remIntfValid = FALSE; /* remote interface version is valid */ + cfg.t.cfg.s.siNSap.remIntfVer; /* remote interface version */ +#endif + + return(sng_cfg_isup(&pst, &cfg)); +} + +/******************************************************************************/ +int ftmod_ss7_isup_intf_config(int id) +{ + SiMngmt cfg; + Pst pst; + sng_isup_inf_t *k = &g_ftdm_sngss7_data.cfg.isupIntf[id]; + + /* initalize the post structure */ + smPstInit(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTSI; + + /*clear the configuration structure*/ + memset(&cfg, 0x0, sizeof(SiMngmt)); + + /*fill in some general sections of the header*/ + smHdrInit(&cfg.hdr); + + /*fill in the specific fields of the header*/ + cfg.hdr.msgType = TCFG; + cfg.hdr.entId.ent = ENTSI; + cfg.hdr.entId.inst = S_INST; + cfg.hdr.elmId.elmnt = SI_STINTF; + + cfg.hdr.elmId.elmntInst1 = k->id; + + cfg.t.cfg.s.siIntfCb.intfId = k->id; /* Interface id */ + cfg.t.cfg.s.siIntfCb.nwId = k->nwId; /* Network Id */ + cfg.t.cfg.s.siIntfCb.sapId = k->isap; /* Id of the Upper ISUP SAP */ + cfg.t.cfg.s.siIntfCb.opc = k->spc; /* physical originating postatic int code */ + cfg.t.cfg.s.siIntfCb.phyDpc = k->dpc; /* physical destination postatic int code */ + cfg.t.cfg.s.siIntfCb.swtch = k->switchType; /* Protocol Switch */ + cfg.t.cfg.s.siIntfCb.ssf = k->ssf; /* subsystem service information */ + cfg.t.cfg.s.siIntfCb.pauseActn = SI_PAUSE_CLRTRAN; /* call clearing behavior upon rx. PAUSE */ + cfg.t.cfg.s.siIntfCb.dpcCbTmr.t4.enb = TRUE; /* t4 timer - user part test sent */ + cfg.t.cfg.s.siIntfCb.dpcCbTmr.t4.val = k->t4; + cfg.t.cfg.s.siIntfCb.dpcCbTmr.tPAUSE.enb = TRUE; /* waiting for PAUSE to be effective */ + cfg.t.cfg.s.siIntfCb.dpcCbTmr.tPAUSE.val = k->tpause; + cfg.t.cfg.s.siIntfCb.dpcCbTmr.tSTAENQ.enb = TRUE; /* status enquiry timer */ + cfg.t.cfg.s.siIntfCb.dpcCbTmr.tSTAENQ.val = k->tstaenq; +#if SS7_ANS95 + cfg.t.cfg.s.siIntfCb.availTest = FALSE; /* circuit validation test */ +#endif +#if (SS7_ITU97 || SS7_ETSIV3 || SS7_UK || SS7_NZL || SS7_ITU2000 || SS7_KZ) + cfg.t.cfg.s.siIntfCb.checkTable = LSI_CHKTBLE_MRATE; /* Validation flag for Table 3 p1/p2 Q.763 */ +#endif +#if (SS7_ANS95 || SS7_ITU97 || SS7_ETSIV3 || SS7_UK || SS7_NZL || SS7_ITU2000 || SS7_KZ) + switch (k->switchType) { + case LSI_SW_TST: + case LSI_SW_ITU: + case LSI_SW_ITU97: + case LSI_SW_ITU2000: + case LSI_SW_ETSI: + case LSI_SW_ETSIV3: + case LSI_SW_RUSSIA: + case LSI_SW_RUSS2000: + case LSI_SW_INDIA: + case LSI_SW_CHINA: + cfg.t.cfg.s.siIntfCb.trunkType = TRUE; /* truck type E1(TRUE)/T1(FALSE) at intf */ + break; + case LSI_SW_ANS88: + case LSI_SW_ANS92: + case LSI_SW_ANS95: + case LSI_SW_BELL: + cfg.t.cfg.s.siIntfCb.trunkType = FALSE; /* truck type E1(TRUE)/T1(FALSE) at intf */ + break; + } + +#endif +#if (LSIV4 || LSIV5) + cfg.t.cfg.s.siIntfCb.lnkSelOpt = LSI_LINSEK_CIC; /* link select option */ +# if (SS7_ANS88 || SS7_ANS92 || SS7_ANS95 || SS7_BELL) + cfg.t.cfg.s.siIntfCb.lnkSelBits = LSI_LNKSEL_8BITS; /* number of bits for link selection */ +# endif +#endif + + return(sng_cfg_isup(&pst, &cfg)); +} + +/******************************************************************************/ +int ftmod_ss7_isup_ckt_config(int id) +{ + SiMngmt cfg; + Pst pst; + U32 tmp_flag; + sng_isup_ckt_t *k = &g_ftdm_sngss7_data.cfg.isupCkt[id]; + + /* initalize the post structure */ + smPstInit(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTSI; + + /*clear the configuration structure*/ + memset(&cfg, 0x0, sizeof(SiMngmt)); + + /*fill in some general sections of the header*/ + smHdrInit(&cfg.hdr); + + /*fill in the specific fields of the header*/ + cfg.hdr.msgType = TCFG; + cfg.hdr.entId.ent = ENTSI; + cfg.hdr.entId.inst = S_INST; + cfg.hdr.elmId.elmnt = STICIR; + + cfg.hdr.elmId.elmntInst1 = k->id; + + cfg.t.cfg.s.siCir.cirId = k->id; /* circuit id code */ + cfg.t.cfg.s.siCir.cic = k->cic; /* cic */ + cfg.t.cfg.s.siCir.intfId = k->infId; /* interface id */ + cfg.t.cfg.s.siCir.typeCntrl = k->typeCntrl; /* type of control */ + cfg.t.cfg.s.siCir.contReq = FALSE; /* continuity check required */ +#if (SI_218_COMP || SS7_ANS88 || SS7_ANS92 || SS7_ANS95 || SS7_BELL) + cfg.t.cfg.s.siCir.firstCic =; /* First cic in the circuit group */ + cfg.t.cfg.s.siCir.numCir =; /* Number of circuits in the circuit group */ + cfg.t.cfg.s.siCir.nonSS7Con = TRUE; /* connecting to non SS7 network */ + cfg.t.cfg.s.siCir.outTrkGrpN =; /* outgoing trunk group number (For EXM) */ + cfg.t.cfg.s.siCir.cvrTrkClli =; /* Trunk Group number (For CVR validation) */ + cfg.t.cfg.s.siCir.clli =; /* common language location identifier */ +#endif + cfg.t.cfg.s.siCir.cirTmr.t3.enb = TRUE; /* t3 timer - overload received */ + cfg.t.cfg.s.siCir.cirTmr.t3.val = k->t3; + cfg.t.cfg.s.siCir.cirTmr.t12.enb = TRUE; /* t12 timer - blocking sent */ + cfg.t.cfg.s.siCir.cirTmr.t12.val = k->t12; + cfg.t.cfg.s.siCir.cirTmr.t13.enb = TRUE; /* t13 timer - initial blocking sent */ + cfg.t.cfg.s.siCir.cirTmr.t13.val = k->t13; + cfg.t.cfg.s.siCir.cirTmr.t14.enb = TRUE; /* t14 timer - unblocking sent */ + cfg.t.cfg.s.siCir.cirTmr.t14.val = k->t14; + cfg.t.cfg.s.siCir.cirTmr.t15.enb = TRUE; /* t15 timer - initial unblocking sent */ + cfg.t.cfg.s.siCir.cirTmr.t15.val = k->t15; + cfg.t.cfg.s.siCir.cirTmr.t16.enb = TRUE; /* t16 timer - reset sent */ + cfg.t.cfg.s.siCir.cirTmr.t16.val = k->t16; + cfg.t.cfg.s.siCir.cirTmr.t17.enb = TRUE; /* t17 timer - initial reset sent */ + cfg.t.cfg.s.siCir.cirTmr.t17.val = k->t17; +#if (SS7_ANS88 || SS7_ANS92 || SS7_ANS95 || SS7_BELL) + cfg.t.cfg.s.siCir.cirTmr.tVal.enb = TRUE; /* circuit validation timer */ + cfg.t.cfg.s.siCir.cirTmr.tVal.val = k->tval; +#endif +#if (SS7_ANS95 || SS7_ITU97 || SS7_ETSIV3 || SS7_UK) + tmp_flag = 0x0; + /* bit 0 - 4 is the timeslot on the span for this circuit */ + tmp_flag = ( 1 ); + + /* bit 5 -> can this timeslot be used for contigous M-rate call */ + tmp_flag |= !(0x20); + + /* bit 6 -> does this timeslot support contigous M-rate call */ + tmp_flag |= !(0x40); + + cfg.t.cfg.s.siCir.slotId = tmp_flag ; /* physical slot id bit wise flag */ + cfg.t.cfg.s.siCir.ctrlMult = 0; /* Controller for multirate calls */ +#endif + + tmp_flag = 0x0; + /* bit 0 -> ANSI international support or national support */ + tmp_flag = k->ssf; + + /* bit 1 -> confusion message on */ + tmp_flag |= LSI_CIRFLG_CFN_ON; + + /*bit 2-3 -> circuit group carrier information */ + tmp_flag |= LSI_CFCI_ANALDIG; + + /*bit 4-5 -> alarm carrier */ + tmp_flag |= LSI_CFAC_UNKNOWN; + + /*bit 6-7 -> continuity check requirement*/ + tmp_flag |= LSI_CFCO_NONE; + + cfg.t.cfg.s.siCir.cirFlg = tmp_flag; /* Flag indicating diff cfg options for ckt */ + + return(sng_cfg_isup(&pst, &cfg)); +} + +/******************************************************************************/ +int ftmod_ss7_isup_isap_config(int id) +{ + SiMngmt cfg; + Pst pst; + sng_isap_t *k = &g_ftdm_sngss7_data.cfg.isap[id]; + + /* initalize the post structure */ + smPstInit(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTSI; + + /*clear the configuration structure*/ + memset(&cfg, 0x0, sizeof(SiMngmt)); + + /*fill in some general sections of the header*/ + smHdrInit(&cfg.hdr); + + /*fill in the specific fields of the header*/ + cfg.hdr.msgType = TCFG; + cfg.hdr.entId.ent = ENTSI; + cfg.hdr.entId.inst = S_INST; + cfg.hdr.elmId.elmnt = STISAP; + + cfg.hdr.elmId.elmntInst1 = k->id; + +#if (SI_LMINT3 || SMSI_LMINT3) + cfg.t.cfg.s.siSap.sapId = k->id; /* Id of the SAP being configured */ +#endif + cfg.t.cfg.s.siSap.swtch = k->switchType; /* Protocol Switch */ + cfg.t.cfg.s.siSap.ssf = k->ssf; /* Sub service field */ + cfg.t.cfg.s.siSap.sidIns = FALSE; /* SID insertion Flag */ + cfg.t.cfg.s.siSap.sidVer = FALSE; /* SID verification Flag */ + if ( cfg.t.cfg.s.siSap.sidIns == TRUE ) { /* SID */ + #if 0 + cfg.t.cfg.s.siSap.sid =; + cfg.t.cfg.s.siSap.natAddrInd =; /* SID Nature of Addres Indicator */ + cfg.t.cfg.s.siSap.sidNPlan =; /* SID Numbering Plan */ + cfg.t.cfg.s.siSap.sidPresInd =; /* default presentation indicator */ + cfg.t.cfg.s.siSap.incSidPresRes =; /* Presentation Restriction of incoming SID */ + cfg.t.cfg.s.siSap.sidPresRes =; /* Presentation Restriction */ + #endif + } else { + cfg.t.cfg.s.siSap.sid.length = 0; + /*cfg.t.cfg.s.siSap.sid.strg[0] =*/ + cfg.t.cfg.s.siSap.natAddrInd = ADDR_NOTPRSNT; /* SID Nature of Addres Indicator */ + cfg.t.cfg.s.siSap.sidNPlan = NP_ISDN; /* SID Numbering Plan */ + cfg.t.cfg.s.siSap.sidPresInd = FALSE; /* default presentation indicator */ + cfg.t.cfg.s.siSap.incSidPresRes = TRUE; /* Presentation Restriction of incoming SID */ + cfg.t.cfg.s.siSap.sidPresRes = 0; /* Presentation Restriction */ + } + cfg.t.cfg.s.siSap.reqOpt = FALSE; /* Request option */ + cfg.t.cfg.s.siSap.allCallMod = TRUE; /* call modification allowed flag */ + cfg.t.cfg.s.siSap.maxLenU2U = MAX_SI_USER_2_USER_LEN; /* Max length of user to user messages */ + cfg.t.cfg.s.siSap.passOnFlag = TRUE; /* flag for passing unknown par/msg */ + cfg.t.cfg.s.siSap.relLocation = ILOC_PRIVNETLU; /* release location indicator in cause val */ + cfg.t.cfg.s.siSap.prior = PRIOR0; /* priority */ + cfg.t.cfg.s.siSap.route = RTESPEC; /* route */ + cfg.t.cfg.s.siSap.selector = 0; /* selector */ + cfg.t.cfg.s.siSap.mem.region = S_REG; /* memory region & pool id */ + cfg.t.cfg.s.siSap.mem.pool = S_POOL; /* memory region & pool id */ + + cfg.t.cfg.s.siSap.tmr.t1.enb = TRUE; /* t1 timer - release sent */ + cfg.t.cfg.s.siSap.tmr.t1.val = k->t1; + cfg.t.cfg.s.siSap.tmr.t2.enb = TRUE; /* t2 timer - suspend received */ + cfg.t.cfg.s.siSap.tmr.t2.val = k->t2; + cfg.t.cfg.s.siSap.tmr.t5.enb = TRUE; /* t5 timer - initial release sent */ + cfg.t.cfg.s.siSap.tmr.t5.val = k->t5; + cfg.t.cfg.s.siSap.tmr.t6.enb = TRUE; /* t6 timer - suspend received */ + cfg.t.cfg.s.siSap.tmr.t6.val = k->t6; + cfg.t.cfg.s.siSap.tmr.t7.enb = TRUE; /* t7 timer - latest address sent */ + cfg.t.cfg.s.siSap.tmr.t7.val = k->t7; + cfg.t.cfg.s.siSap.tmr.t8.enb = TRUE; /* t8 timer - initial address received */ + cfg.t.cfg.s.siSap.tmr.t8.val = k->t8; + cfg.t.cfg.s.siSap.tmr.t9.enb = TRUE; /* t9 timer - latest address sent after ACM */ + cfg.t.cfg.s.siSap.tmr.t9.val = k->t9; + cfg.t.cfg.s.siSap.tmr.t27.enb = TRUE; /* t27 timer - wait. for continuity recheck */ + cfg.t.cfg.s.siSap.tmr.t27.val = k->t27; + cfg.t.cfg.s.siSap.tmr.t31.enb = TRUE; /* t31 timer - call reference frozen period */ + cfg.t.cfg.s.siSap.tmr.t31.val = k->t31; + cfg.t.cfg.s.siSap.tmr.t33.enb = TRUE; /* t33 timer - INR sent */ + cfg.t.cfg.s.siSap.tmr.t33.val = k->t33; + cfg.t.cfg.s.siSap.tmr.t34.enb = TRUE; /* t34 timer - wait. for continuity after recheck */ + cfg.t.cfg.s.siSap.tmr.t34.val = k->t34; + cfg.t.cfg.s.siSap.tmr.t36.enb = TRUE; /* waiting SGM */ + cfg.t.cfg.s.siSap.tmr.t36.val = k->t36; + cfg.t.cfg.s.siSap.tmr.tCCR.enb = TRUE; /* tCCR timer - continuity recheck timer */ + cfg.t.cfg.s.siSap.tmr.tCCR.val = k->tccr; + cfg.t.cfg.s.siSap.tmr.tRELRSP.enb = TRUE; /* waiting for release response */ + cfg.t.cfg.s.siSap.tmr.tRELRSP.val = k->trelrsp; + cfg.t.cfg.s.siSap.tmr.tFNLRELRSP.enb = TRUE; /* waiting for final release response */ + cfg.t.cfg.s.siSap.tmr.tFNLRELRSP.val = k->tfnlrelrsp; +#if (SS7_ANS88 || SS7_ANS92 || SS7_ANS95 || SS7_BELL) + cfg.t.cfg.s.siSap.tmr.tEx.enb = TRUE; /* tEx timer - Exit to be sent */ + cfg.t.cfg.s.siSap.tmr.tEx.val = k->tex; + cfg.t.cfg.s.siSap.tmr.tCCRt.enb = TRUE; /* tCCR timer (o/g side) - continuity recheck timer */ + cfg.t.cfg.s.siSap.tmr.tCCRt.val = k->tccrt; +#endif +#if (SS7_ANS92 || SS7_ANS95 || SS7_BELL) + cfg.t.cfg.s.siSap.tmr.tCRM.enb = TRUE; /* circuit reservation message timer */ + cfg.t.cfg.s.siSap.tmr.tCRM.val = k->tcrm; + cfg.t.cfg.s.siSap.tmr.tCRA.enb = TRUE; /* circuit reservation ack. timer */ + cfg.t.cfg.s.siSap.tmr.tCRA.val = k->tcra; +#endif +#if (SS7_ETSI || SS7_ITU97 || SS7_ETSIV3 || SS7_UK || SS7_NZL || SS7_KZ) + cfg.t.cfg.s.siSap.tmr.tECT.enb = TRUE; /* Explicit Call Transfer - waiting for loop prvnt rsp */ + cfg.t.cfg.s.siSap.tmr.tECT.val = k->tect; +#endif + +#ifdef TDS_ROLL_UPGRADE_SUPPORT + cfg.t.cfg.s.siSap.remIntfValid = FALSE; /* remote interface version is valid */ + cfg.t.cfg.s.siSap.remIntfVer =; /* remote interface version */ +#endif + + return(sng_cfg_isup(&pst, &cfg)); +} + +/******************************************************************************/ +int ftmod_ss7_cc_isap_config(int id) +{ + CcMngmt cfg; + Pst pst; + sng_isap_t *k = &g_ftdm_sngss7_data.cfg.isap[id]; + + /* initalize the post structure */ + smPstInit(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTCC; + + /*clear the configuration structure*/ + memset(&cfg, 0x0, sizeof(CcMngmt)); + + /*fill in some general sections of the header*/ + smHdrInit(&cfg.hdr); + + /*fill in the specific fields of the header*/ + cfg.hdr.msgType = TCFG; + cfg.hdr.entId.ent = ENTCC; + cfg.hdr.entId.inst = S_INST; + cfg.hdr.elmId.elmnt = STISAP; + + cfg.hdr.elmId.elmntInst1 = k->id; + + cfg.t.cfg.s.ccISAP.suId = k->suId; + cfg.t.cfg.s.ccISAP.spId = k->spId; + cfg.t.cfg.s.ccISAP.pst.dstProcId = SFndProcId(); + cfg.t.cfg.s.ccISAP.pst.dstEnt = ENTSI; + cfg.t.cfg.s.ccISAP.pst.dstInst = S_INST; + cfg.t.cfg.s.ccISAP.pst.srcProcId = SFndProcId(); + cfg.t.cfg.s.ccISAP.pst.srcEnt = ENTCC; + cfg.t.cfg.s.ccISAP.pst.srcInst = S_INST; + cfg.t.cfg.s.ccISAP.pst.prior = PRIOR0; + cfg.t.cfg.s.ccISAP.pst.route = RTESPEC; + cfg.t.cfg.s.ccISAP.pst.region = S_REG; + cfg.t.cfg.s.ccISAP.pst.pool = S_POOL; + cfg.t.cfg.s.ccISAP.pst.selector = 0; + + return(sng_cfg_cc(&pst, &cfg)); +} + +/******************************************************************************/ + +/******************************************************************************/ +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4: + */ +/******************************************************************************/ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c index eaf36cf..7d0488c 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c @@ -50,6 +50,8 @@ static ftdm_status_t handle_set_function_trace(ftdm_stream_handle_t *stream, int static ftdm_status_t handle_set_message_trace(ftdm_stream_handle_t *stream, int on, int level); static ftdm_status_t handle_set_blocks(ftdm_stream_handle_t *stream, int span, int chan, int verbose); static ftdm_status_t handle_set_unblks(ftdm_stream_handle_t *stream, int span, int chan, int verbose); +static ftdm_status_t handle_set_inhibit(ftdm_stream_handle_t *stream, char *name); +static ftdm_status_t handle_set_uninhibit(ftdm_stream_handle_t *stream, char *name); static ftdm_status_t handle_show_free(ftdm_stream_handle_t *stream, int span, int chan, int verbose); static ftdm_status_t handle_show_inuse(ftdm_stream_handle_t *stream, int span, int chan, int verbose); @@ -68,946 +70,1077 @@ static ftdm_status_t check_arg_count(int args, int min); /* FUNCTIONS ******************************************************************/ ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const char *data) { - char *mycmd = NULL; - char *argv[10] = { 0 }; - int argc = 0; - int span = 0; - int chan = 0; - int trace = 0; - int trace_level = 7; - int verbose = 1; - int c = 0; - - if (data) { - mycmd = ftdm_strdup(data); - argc = ftdm_separate_string(mycmd,' ',argv,(sizeof(argv) / sizeof(argv[0]))); - } - - if (check_arg_count(argc, 1)) goto handle_cli_error_argc; - - if (!strcasecmp(argv[c], "show")) { - /**************************************************************************/ - if (check_arg_count(argc, 4)) goto handle_cli_error_argc; - c++; - - if (!strcasecmp(argv[c], "status")) { - /**********************************************************************/ - c++; - - if (!strcasecmp(argv[c], "link")) { - /******************************************************************/ - c++; - handle_status_link(stream, argv[c]); - /******************************************************************/ - } else if (!strcasecmp(argv[c], "linkset")) { - /******************************************************************/ - c++; - handle_status_linkset(stream, argv[c]); - /******************************************************************/ - } else if (!strcasecmp(argv[c], "span")) { - /******************************************************************/ - if (check_arg_count(argc, 6)) goto handle_cli_error_argc; - - if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; - - handle_show_status(stream, span, chan, verbose); - /******************************************************************/ - } else { - /******************************************************************/ - stream->write_function(stream, "Unknown \"status\" command\n"); - goto handle_cli_error; - /******************************************************************/ - } - /**********************************************************************/ - } else if (!strcasecmp(argv[c], "inuse")) { - /**********************************************************************/ - if (check_arg_count(argc, 6)) goto handle_cli_error_argc; - c++; - - if (!strcasecmp(argv[c], "span")) { - /******************************************************************/ - if (check_arg_count(argc, 6)) goto handle_cli_error_argc; - - if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; - - handle_show_inuse(stream, span, chan, verbose); - /******************************************************************/ - } else { - /******************************************************************/ - stream->write_function(stream, "Unknown \"inuse\" command\n"); - goto handle_cli_error; - /******************************************************************/ - } - /**********************************************************************/ - } else if (!strcasecmp(argv[c], "inreset")) { - /**********************************************************************/ - if (check_arg_count(argc, 6)) goto handle_cli_error_argc; - c++; - - if (!strcasecmp(argv[c], "span")) { - /******************************************************************/ - if (check_arg_count(argc, 6)) goto handle_cli_error_argc; - - if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; - - handle_show_inreset(stream, span, chan, verbose); - /******************************************************************/ - } else { - /******************************************************************/ - stream->write_function(stream, "Unknown \"inreset\" command\n"); - goto handle_cli_error; - /******************************************************************/ - } - /**********************************************************************/ - } else if (!strcasecmp(argv[c], "free")) { - /**********************************************************************/ - if (check_arg_count(argc, 6)) goto handle_cli_error_argc; - c++; - - if (!strcasecmp(argv[c], "span")) { - /******************************************************************/ - if (check_arg_count(argc, 6)) goto handle_cli_error_argc; - - if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; - - handle_show_free(stream, span, chan, verbose); - /******************************************************************/ - } else { - /******************************************************************/ - stream->write_function(stream, "Unknown \"free\" command\n"); - goto handle_cli_error; - /******************************************************************/ - } - /**********************************************************************/ - } else if (!strcasecmp(argv[c], "blocks")) { - /**********************************************************************/ - if (check_arg_count(argc, 6)) goto handle_cli_error_argc; - c++; - - if (!strcasecmp(argv[c], "span")) { - /******************************************************************/ - if (check_arg_count(argc, 6)) goto handle_cli_error_argc; - - if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; - - handle_show_blocks(stream, span, chan, verbose); - /******************************************************************/ - } else { - /******************************************************************/ - stream->write_function(stream, "Unknown \"blocks\" command\n"); - goto handle_cli_error; - /******************************************************************/ - } - /**********************************************************************/ - } else if (!strcasecmp(argv[c], "flags")) { - /**********************************************************************/ - if (check_arg_count(argc, 6)) goto handle_cli_error_argc; - c++; - - if (!strcasecmp(argv[c], "span")) { - /******************************************************************/ - if (check_arg_count(argc, 6)) goto handle_cli_error_argc; - - if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; - - handle_show_flags(stream, span, chan, verbose); - /******************************************************************/ - } else { - /******************************************************************/ - stream->write_function(stream, "Unknown \"flags\" command\n"); - goto handle_cli_error; - /******************************************************************/ - } - /**********************************************************************/ - } else { - /**********************************************************************/ - stream->write_function(stream, "Unknown \"show\" command\n"); - goto handle_cli_error; - /**********************************************************************/ - } - /**************************************************************************/ - } else if (!strcasecmp(argv[c], "set")) { - /**************************************************************************/ - if (check_arg_count(argc, 4)) goto handle_cli_error_argc; - c++; - - if (!strcasecmp(argv[c], "ftrace")) { - /**********************************************************************/ - c++; - trace = atoi(argv[c]); - c++; - trace_level = atoi(argv[c]); - c++; - handle_set_function_trace(stream, trace, trace_level); - /**********************************************************************/ - } else if (!strcasecmp(argv[c], "mtrace")) { - /**********************************************************************/ - c++; - trace = atoi(argv[c]); - c++; - trace_level = atoi(argv[c]); - c++; - handle_set_message_trace(stream, trace, trace_level); - /**********************************************************************/ - } else { - /**********************************************************************/ - stream->write_function(stream, "Unknown \"set\" command\n"); - goto handle_cli_error; - /**********************************************************************/ - } - /**************************************************************************/ - } else if (!strcasecmp(argv[c], "block")) { - /**************************************************************************/ - if (check_arg_count(argc, 6)) goto handle_cli_error_argc; - c++; - - if (!strcasecmp(argv[c], "span")) { - /**********************************************************************/ - if (check_arg_count(argc, 6)) goto handle_cli_error_argc; - - if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; - - handle_set_blocks(stream, span, chan, verbose); - /**********************************************************************/ - } else { - /**********************************************************************/ - stream->write_function(stream, "Unknown \"block\" command\n"); - goto handle_cli_error; - /**********************************************************************/ - } - /**************************************************************************/ - } else if (!strcasecmp(argv[c], "unblock")) { - /**************************************************************************/ - if (check_arg_count(argc, 6)) goto handle_cli_error_argc; - c++; - - if (!strcasecmp(argv[c], "span")) { - /**********************************************************************/ - if (check_arg_count(argc, 6)) goto handle_cli_error_argc; - - if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; - - handle_set_unblks(stream, span, chan, verbose); - /**********************************************************************/ - } else { - /**********************************************************************/ - stream->write_function(stream, "Unknown \"unblock\" command\n"); - goto handle_cli_error; - /**********************************************************************/ - } - /**************************************************************************/ - } else { - /**************************************************************************/ - goto handle_cli_error; - /**************************************************************************/ - } - - return FTDM_SUCCESS; + char *mycmd = NULL; + char *argv[10] = { 0 }; + int argc = 0; + int span = 0; + int chan = 0; + int trace = 0; + int trace_level = 7; + int verbose = 1; + int c = 0; + + if (data) { + mycmd = ftdm_strdup(data); + argc = ftdm_separate_string(mycmd,' ',argv,(sizeof(argv) / sizeof(argv[0]))); + } + + if (check_arg_count(argc, 1)) goto handle_cli_error_argc; + + if (!strcasecmp(argv[c], "show")) { + /**************************************************************************/ + if (check_arg_count(argc, 2)) goto handle_cli_error_argc; + c++; + + if (!strcasecmp(argv[c], "status")) { + /**********************************************************************/ + c++; + + if (!strcasecmp(argv[c], "link")) { + /******************************************************************/ + c++; + handle_status_link(stream, argv[c]); + /******************************************************************/ + } else if (!strcasecmp(argv[c], "linkset")) { + /******************************************************************/ + c++; + handle_status_linkset(stream, argv[c]); + /******************************************************************/ + } else if (!strcasecmp(argv[c], "span")) { + /******************************************************************/ + if (check_arg_count(argc, 6)) goto handle_cli_error_argc; + + if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; + + handle_show_status(stream, span, chan, verbose); + /******************************************************************/ + } else { + /******************************************************************/ + stream->write_function(stream, "Unknown \"status\" command\n"); + goto handle_cli_error; + /******************************************************************/ + } + /**********************************************************************/ + } else if (!strcasecmp(argv[c], "inuse")) { + /**********************************************************************/ + if (check_arg_count(argc, 6)) goto handle_cli_error_argc; + c++; + + if (!strcasecmp(argv[c], "span")) { + /******************************************************************/ + if (check_arg_count(argc, 6)) goto handle_cli_error_argc; + + if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; + + handle_show_inuse(stream, span, chan, verbose); + /******************************************************************/ + } else { + /******************************************************************/ + stream->write_function(stream, "Unknown \"inuse\" command\n"); + goto handle_cli_error; + /******************************************************************/ + } + /**********************************************************************/ + } else if (!strcasecmp(argv[c], "inreset")) { + /**********************************************************************/ + if (check_arg_count(argc, 6)) goto handle_cli_error_argc; + c++; + + if (!strcasecmp(argv[c], "span")) { + /******************************************************************/ + if (check_arg_count(argc, 6)) goto handle_cli_error_argc; + + if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; + + handle_show_inreset(stream, span, chan, verbose); + /******************************************************************/ + } else { + /******************************************************************/ + stream->write_function(stream, "Unknown \"inreset\" command\n"); + goto handle_cli_error; + /******************************************************************/ + } + /**********************************************************************/ + } else if (!strcasecmp(argv[c], "free")) { + /**********************************************************************/ + if (check_arg_count(argc, 6)) goto handle_cli_error_argc; + c++; + + if (!strcasecmp(argv[c], "span")) { + /******************************************************************/ + if (check_arg_count(argc, 6)) goto handle_cli_error_argc; + + if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; + + handle_show_free(stream, span, chan, verbose); + /******************************************************************/ + } else { + /******************************************************************/ + stream->write_function(stream, "Unknown \"free\" command\n"); + goto handle_cli_error; + /******************************************************************/ + } + /**********************************************************************/ + } else if (!strcasecmp(argv[c], "blocks")) { + /**********************************************************************/ + if (check_arg_count(argc, 6)) goto handle_cli_error_argc; + c++; + + if (!strcasecmp(argv[c], "span")) { + /******************************************************************/ + if (check_arg_count(argc, 6)) goto handle_cli_error_argc; + + if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; + + handle_show_blocks(stream, span, chan, verbose); + /******************************************************************/ + } else { + /******************************************************************/ + stream->write_function(stream, "Unknown \"blocks\" command\n"); + goto handle_cli_error; + /******************************************************************/ + } + /**********************************************************************/ + } else if (!strcasecmp(argv[c], "flags")) { + /**********************************************************************/ + if (check_arg_count(argc, 6)) goto handle_cli_error_argc; + c++; + + if (!strcasecmp(argv[c], "span")) { + /******************************************************************/ + if (check_arg_count(argc, 6)) goto handle_cli_error_argc; + + if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; + + handle_show_flags(stream, span, chan, verbose); + /******************************************************************/ + } else { + /******************************************************************/ + stream->write_function(stream, "Unknown \"flags\" command\n"); + goto handle_cli_error; + /******************************************************************/ + } + /**********************************************************************/ + } else if (!strcasecmp(argv[c], "mem")) { + /**********************************************************************/ + /*uint32_t availMem;*/ + + /*sng_sta_mem(&availMem);*/ + /**********************************************************************/ + } else if (!strcasecmp(argv[c], "stats")) { + /**********************************************************************/ +/* sng_mtp1_sts_t sts; + + memset(&sts, 0x0, sizeof(sng_mtp1_sts_t)); + + sng_mtp1_sts(1, &sts); + + stream->write_function(stream,"MTP1 tx stats:|tx_frm=%d|tx_err=%d|tx_fisu=%d|tx_lssu=%d|tx_msu=%d|\n", + sts.tx_frm, sts.tx_err, sts.tx_fisu, sts.tx_lssu, sts.tx_msu); + stream->write_function(stream,"MTP1 rx stats:|rx_frm=%d|rx_err=%d|rx_fisu=%d|rx_lssu=%d|rx_msu=%d|\n", + sts.rx_frm, sts.rx_err, sts.rx_fisu, sts.rx_lssu, sts.rx_msu); +*/ + /**********************************************************************/ + } else { + /**********************************************************************/ + stream->write_function(stream, "Unknown \"show\" command\n"); + goto handle_cli_error; + /**********************************************************************/ + } + /**************************************************************************/ + } else if (!strcasecmp(argv[c], "set")) { + /**************************************************************************/ + if (check_arg_count(argc, 4)) goto handle_cli_error_argc; + c++; + + if (!strcasecmp(argv[c], "ftrace")) { + /**********************************************************************/ + c++; + trace = atoi(argv[c]); + c++; + trace_level = atoi(argv[c]); + c++; + handle_set_function_trace(stream, trace, trace_level); + /**********************************************************************/ + } else if (!strcasecmp(argv[c], "mtrace")) { + /**********************************************************************/ + c++; + trace = atoi(argv[c]); + c++; + trace_level = atoi(argv[c]); + c++; + handle_set_message_trace(stream, trace, trace_level); + /**********************************************************************/ + } else { + /**********************************************************************/ + stream->write_function(stream, "Unknown \"set\" command\n"); + goto handle_cli_error; + /**********************************************************************/ + } + /**************************************************************************/ + } else if (!strcasecmp(argv[c], "block")) { + /**************************************************************************/ + if (check_arg_count(argc, 2)) goto handle_cli_error_argc; + c++; + + if (!strcasecmp(argv[c], "span")) { + /**********************************************************************/ + if (check_arg_count(argc, 5)) goto handle_cli_error_argc; + + if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; + + handle_set_blocks(stream, span, chan, verbose); + /**********************************************************************/ + } else if (!strcasecmp(argv[c], "link")) { + /**********************************************************************/ + if (check_arg_count(argc, 3)) goto handle_cli_error_argc; + c++; + + handle_set_inhibit(stream, argv[c]); + /**********************************************************************/ + } else { + /**********************************************************************/ + stream->write_function(stream, "Unknown \"block\" command\n"); + goto handle_cli_error; + /**********************************************************************/ + } + /**************************************************************************/ + } else if (!strcasecmp(argv[c], "unblock")) { + /**************************************************************************/ + if (check_arg_count(argc, 2)) goto handle_cli_error_argc; + c++; + + if (!strcasecmp(argv[c], "span")) { + /**********************************************************************/ + if (check_arg_count(argc, 5)) goto handle_cli_error_argc; + + if (extract_span_chan(argv, c, &span, &chan)) goto handle_cli_error_span_chan; + + handle_set_unblks(stream, span, chan, verbose); + /**********************************************************************/ + } else if (!strcasecmp(argv[c], "link")) { + /**********************************************************************/ + if (check_arg_count(argc, 3)) goto handle_cli_error_argc; + c++; + + handle_set_uninhibit(stream, argv[c]); + /**********************************************************************/ + } else { + /**********************************************************************/ + stream->write_function(stream, "Unknown \"unblock\" command\n"); + goto handle_cli_error; + /**********************************************************************/ + } + /**************************************************************************/ + } else { + /**************************************************************************/ + goto handle_cli_error; + /**************************************************************************/ + } + + return FTDM_SUCCESS; handle_cli_error_argc: - stream->write_function(stream, "Invalid # of arguments in command\n"); - handle_print_usuage(stream); - return FTDM_SUCCESS; + stream->write_function(stream, "Invalid # of arguments in command\n"); + handle_print_usuage(stream); + return FTDM_SUCCESS; handle_cli_error_span_chan: - stream->write_function(stream, "Unknown \"span\\chan\" command\n"); - handle_print_usuage(stream); - return FTDM_SUCCESS; + stream->write_function(stream, "Unknown \"span\\chan\" command\n"); + handle_print_usuage(stream); + return FTDM_SUCCESS; handle_cli_error: - stream->write_function(stream, "Unknown command requested\n"); - handle_print_usuage(stream); - return FTDM_SUCCESS; + stream->write_function(stream, "Unknown command requested\n"); + handle_print_usuage(stream); + return FTDM_SUCCESS; } /******************************************************************************/ static ftdm_status_t handle_print_usuage(ftdm_stream_handle_t *stream) { - stream->write_function(stream, "Sangoma SS7 CLI usuage:\n\n"); - - stream->write_function(stream, "Ftmod_sangoma_ss7 general control:\n"); - stream->write_function(stream, "ftdm ss7 set ftace X Y\n"); - stream->write_function(stream, "ftdm ss7 set mtace X Y\n"); - stream->write_function(stream, "\n"); - stream->write_function(stream, "Ftmod_sangoma_ss7 information:\n"); - stream->write_function(stream, "ftdm ss7 show status link X\n"); - stream->write_function(stream, "ftdm ss7 show status linkset X\n"); - stream->write_function(stream, "ftdm ss7 show status span X chan Y\n"); - stream->write_function(stream, "ftdm ss7 show free span X chan Y\n"); - stream->write_function(stream, "ftdm ss7 show inuse span X chan Y\n"); - stream->write_function(stream, "ftdm ss7 show inreset span X chan Y\n"); - stream->write_function(stream, "\n"); - stream->write_function(stream, "Ftmod_sangoma_ss7 circuit control:\n"); - stream->write_function(stream, "ftdm ss7 set block span X chan Y\n"); - stream->write_function(stream, "ftdm ss7 set unblk span X chan Y\n"); - stream->write_function(stream, "\n"); - - return FTDM_SUCCESS; + stream->write_function(stream, "Sangoma SS7 CLI usuage:\n\n"); + + stream->write_function(stream, "Ftmod_sangoma_ss7 general control:\n"); + stream->write_function(stream, "ftdm ss7 set ftace X Y\n"); + stream->write_function(stream, "ftdm ss7 set mtace X Y\n"); + stream->write_function(stream, "\n"); + stream->write_function(stream, "Ftmod_sangoma_ss7 information:\n"); + stream->write_function(stream, "ftdm ss7 show status link X\n"); + stream->write_function(stream, "ftdm ss7 show status linkset X\n"); + stream->write_function(stream, "ftdm ss7 show status span X chan Y\n"); + stream->write_function(stream, "ftdm ss7 show free span X chan Y\n"); + stream->write_function(stream, "ftdm ss7 show inuse span X chan Y\n"); + stream->write_function(stream, "ftdm ss7 show inreset span X chan Y\n"); + stream->write_function(stream, "\n"); + stream->write_function(stream, "Ftmod_sangoma_ss7 circuit control:\n"); + stream->write_function(stream, "ftdm ss7 block span X chan Y\n"); + stream->write_function(stream, "ftdm ss7 unblk span X chan Y\n"); + stream->write_function(stream, "\n"); + + return FTDM_SUCCESS; } /******************************************************************************/ static ftdm_status_t handle_set_function_trace(ftdm_stream_handle_t *stream, int on, int level) { - stream->write_function(stream, "ftmod_sangoma_ss7 Function Trace was %s, level = %d\n", - (g_ftdm_sngss7_data.function_trace == 1) ? "ON" : "OFF", - g_ftdm_sngss7_data.function_trace_level); + stream->write_function(stream, "ftmod_sangoma_ss7 Function Trace was %s, level = %d\n", + (g_ftdm_sngss7_data.function_trace == 1) ? "ON" : "OFF", + g_ftdm_sngss7_data.function_trace_level); - g_ftdm_sngss7_data.function_trace = on; - g_ftdm_sngss7_data.function_trace_level = level; + g_ftdm_sngss7_data.function_trace = on; + g_ftdm_sngss7_data.function_trace_level = level; - stream->write_function(stream, "ftmod_sangoma_ss7 Function Trace now is %s, level = %d\n", - (g_ftdm_sngss7_data.function_trace == 1) ? "ON" : "OFF", - g_ftdm_sngss7_data.function_trace_level); + stream->write_function(stream, "ftmod_sangoma_ss7 Function Trace now is %s, level = %d\n", + (g_ftdm_sngss7_data.function_trace == 1) ? "ON" : "OFF", + g_ftdm_sngss7_data.function_trace_level); - return FTDM_SUCCESS; + return FTDM_SUCCESS; } /******************************************************************************/ static ftdm_status_t handle_set_message_trace(ftdm_stream_handle_t *stream, int on, int level) { - stream->write_function(stream, "ftmod_sangoma_ss7 Message Trace was %s, level = %d\n", - (g_ftdm_sngss7_data.message_trace == 1) ? "ON" : "OFF", - g_ftdm_sngss7_data.message_trace_level); + stream->write_function(stream, "ftmod_sangoma_ss7 Message Trace was %s, level = %d\n", + (g_ftdm_sngss7_data.message_trace == 1) ? "ON" : "OFF", + g_ftdm_sngss7_data.message_trace_level); - g_ftdm_sngss7_data.message_trace = on; - g_ftdm_sngss7_data.message_trace_level = level; + g_ftdm_sngss7_data.message_trace = on; + g_ftdm_sngss7_data.message_trace_level = level; - stream->write_function(stream, "ftmod_sangoma_ss7 Message Trace now is %s, level = %d\n", - (g_ftdm_sngss7_data.message_trace == 1) ? "ON" : "OFF", - g_ftdm_sngss7_data.message_trace_level); + stream->write_function(stream, "ftmod_sangoma_ss7 Message Trace now is %s, level = %d\n", + (g_ftdm_sngss7_data.message_trace == 1) ? "ON" : "OFF", + g_ftdm_sngss7_data.message_trace_level); - return FTDM_SUCCESS; + return FTDM_SUCCESS; } /******************************************************************************/ static ftdm_status_t handle_show_free(ftdm_stream_handle_t *stream, int span, int chan, int verbose) { - int x; - int free; - sngss7_chan_data_t *ss7_info; - ftdm_channel_t *ftdmchan; - int lspan; - int lchan; - - x=1; - free = 0; - while (g_ftdm_sngss7_data.cfg.isupCircuit[x].id != 0) { - if (g_ftdm_sngss7_data.cfg.isupCircuit[x].siglink != 1) { - ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCircuit[x].obj; - ftdmchan = ss7_info->ftdmchan; - - /* if span == 0 then all spans should be printed */ - if (span == 0) { - lspan = ftdmchan->physical_span_id; - } else { - lspan = span; - } - - /* if chan == 0 then all chans should be printed */ - if (chan == 0) { - lchan = ftdmchan->physical_chan_id; - } else { - lchan = chan; - } - - if ((ftdmchan->physical_span_id == lspan) && (ftdmchan->physical_chan_id == lchan)) { - switch (ftdmchan->state) { - /******************************************************************/ - case (FTDM_CHANNEL_STATE_DOWN): - if (verbose) { - stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|state=%s\n", - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id, - ss7_info->circuit->cic, - ftdm_channel_state2str(ftdmchan->state)); - } /* if (verbose) */ - - /*increment the count of circuits in reset */ - free++; - break; - /******************************************************************/ - default: - break; - /******************************************************************/ - } /* switch (ftdmchan->state) */ - } /* if ( span and chan) */ - } /* if ( cic != 0) */ - - /* go the next circuit */ - x++; - } /* while (g_ftdm_sngss7_data.cfg.isupCircuit[x]id != 0) */ - - stream->write_function(stream, "\nTotal # of CICs free = %d\n",free); - - return FTDM_SUCCESS; + int x; + int free; + sngss7_chan_data_t *ss7_info; + ftdm_channel_t *ftdmchan; + int lspan; + int lchan; + + x=1; + free = 0; + while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { + if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) { + ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; + ftdmchan = ss7_info->ftdmchan; + + /* if span == 0 then all spans should be printed */ + if (span == 0) { + lspan = ftdmchan->physical_span_id; + } else { + lspan = span; + } + + /* if chan == 0 then all chans should be printed */ + if (chan == 0) { + lchan = ftdmchan->physical_chan_id; + } else { + lchan = chan; + } + + if ((ftdmchan->physical_span_id == lspan) && (ftdmchan->physical_chan_id == lchan)) { + switch (ftdmchan->state) { + /******************************************************************/ + case (FTDM_CHANNEL_STATE_DOWN): + if (verbose) { + stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|state=%s\n", + ftdmchan->physical_span_id, + ftdmchan->physical_chan_id, + ss7_info->circuit->cic, + ftdm_channel_state2str(ftdmchan->state)); + } /* if (verbose) */ + + /*increment the count of circuits in reset */ + free++; + break; + /******************************************************************/ + default: + break; + /******************************************************************/ + } /* switch (ftdmchan->state) */ + } /* if ( span and chan) */ + } /* if ( cic != 0) */ + + /* go the next circuit */ + x++; + } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ + + stream->write_function(stream, "\nTotal # of CICs free = %d\n",free); + + return FTDM_SUCCESS; } /******************************************************************************/ static ftdm_status_t handle_show_inuse(ftdm_stream_handle_t *stream, int span, int chan, int verbose) { - int x; - int in_use; - sngss7_chan_data_t *ss7_info; - ftdm_channel_t *ftdmchan; - int lspan; - int lchan; - - x=1; - in_use = 0; - while (g_ftdm_sngss7_data.cfg.isupCircuit[x].id != 0) { - if (g_ftdm_sngss7_data.cfg.isupCircuit[x].siglink != 1) { - ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCircuit[x].obj; - ftdmchan = ss7_info->ftdmchan; - - /* if span == 0 then all spans should be printed */ - if (span == 0) { - lspan = ftdmchan->physical_span_id; - } else { - lspan = span; - } - - /* if chan == 0 then all chans should be printed */ - if (chan == 0) { - lchan = ftdmchan->physical_chan_id; - } else { - lchan = chan; - } - - if ((ftdmchan->physical_span_id == lspan) && (ftdmchan->physical_chan_id == lchan)) { - switch (ftdmchan->state) { - /******************************************************************/ - case (FTDM_CHANNEL_STATE_COLLECT): - case (FTDM_CHANNEL_STATE_RING): - case (FTDM_CHANNEL_STATE_DIALING): - case (FTDM_CHANNEL_STATE_PROGRESS): - case (FTDM_CHANNEL_STATE_PROGRESS_MEDIA): - case (FTDM_CHANNEL_STATE_UP): - case (FTDM_CHANNEL_STATE_TERMINATING): - case (FTDM_CHANNEL_STATE_HANGUP): - if (verbose) { - stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|state=%s\n", - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id, - ss7_info->circuit->cic, - ftdm_channel_state2str(ftdmchan->state)); - } /* if (verbose) */ - - /*increment the count of circuits in reset */ - in_use++; - break; - /******************************************************************/ - default: - break; - /******************************************************************/ - } /* switch (ftdmchan->state) */ - } /* if ( span and chan) */ - } /* if ( cic != 0) */ - - /* go the next circuit */ - x++; - } /* while (g_ftdm_sngss7_data.cfg.isupCircuit[x]id != 0) */ - - stream->write_function(stream, "\nTotal # of CICs in use = %d\n",in_use); - - return FTDM_SUCCESS; + int x; + int in_use; + sngss7_chan_data_t *ss7_info; + ftdm_channel_t *ftdmchan; + int lspan; + int lchan; + + x=1; + in_use = 0; + while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { + if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) { + ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; + ftdmchan = ss7_info->ftdmchan; + + /* if span == 0 then all spans should be printed */ + if (span == 0) { + lspan = ftdmchan->physical_span_id; + } else { + lspan = span; + } + + /* if chan == 0 then all chans should be printed */ + if (chan == 0) { + lchan = ftdmchan->physical_chan_id; + } else { + lchan = chan; + } + + if ((ftdmchan->physical_span_id == lspan) && (ftdmchan->physical_chan_id == lchan)) { + switch (ftdmchan->state) { + /******************************************************************/ + case (FTDM_CHANNEL_STATE_COLLECT): + case (FTDM_CHANNEL_STATE_RING): + case (FTDM_CHANNEL_STATE_DIALING): + case (FTDM_CHANNEL_STATE_PROGRESS): + case (FTDM_CHANNEL_STATE_PROGRESS_MEDIA): + case (FTDM_CHANNEL_STATE_UP): + case (FTDM_CHANNEL_STATE_TERMINATING): + case (FTDM_CHANNEL_STATE_HANGUP): + if (verbose) { + stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|state=%s\n", + ftdmchan->physical_span_id, + ftdmchan->physical_chan_id, + ss7_info->circuit->cic, + ftdm_channel_state2str(ftdmchan->state)); + } /* if (verbose) */ + + /*increment the count of circuits in reset */ + in_use++; + break; + /******************************************************************/ + default: + break; + /******************************************************************/ + } /* switch (ftdmchan->state) */ + } /* if ( span and chan) */ + } /* if ( cic != 0) */ + + /* go the next circuit */ + x++; + } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ + + stream->write_function(stream, "\nTotal # of CICs in use = %d\n",in_use); + + return FTDM_SUCCESS; } /******************************************************************************/ static ftdm_status_t handle_show_inreset(ftdm_stream_handle_t *stream, int span, int chan, int verbose) { - int x; - int in_reset; - sngss7_chan_data_t *ss7_info; - ftdm_channel_t *ftdmchan; - int lspan; - int lchan; - - x=1; - in_reset = 0; - while (g_ftdm_sngss7_data.cfg.isupCircuit[x].id != 0) { - if (g_ftdm_sngss7_data.cfg.isupCircuit[x].siglink != 1) { - ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCircuit[x].obj; - ftdmchan = ss7_info->ftdmchan; - - /* if span == 0 then all spans should be printed */ - if (span == 0) { - lspan = ftdmchan->physical_span_id; - } else { - lspan = span; - } - - /* if chan == 0 then all chans should be printed */ - if (chan == 0) { - lchan = ftdmchan->physical_chan_id; - } else { - lchan = chan; - } - - if ((ftdmchan->physical_span_id == lspan) && (ftdmchan->physical_chan_id == lchan)) { - if ((sngss7_test_flag(ss7_info, FLAG_RESET_RX)) || (sngss7_test_flag(ss7_info, FLAG_RESET_TX))) { - if (verbose) { - stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|in_reset=Y\n", - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id, - ss7_info->circuit->cic); - } /* if (verbose) */ - - /*increment the count of circuits in reset */ - in_reset++; - } /* if ((sngss7_test_flag(ss7_info, FLAG_RESET_RX) ... */ - } /* if ( span and chan) */ - } /* if ( cic != 0) */ - - /* go the next circuit */ - x++; - } /* while (g_ftdm_sngss7_data.cfg.isupCircuit[x]id != 0) */ - - stream->write_function(stream, "\nTotal # of CICs in reset = %d\n",in_reset); - - return FTDM_SUCCESS; + int x; + int in_reset; + sngss7_chan_data_t *ss7_info; + ftdm_channel_t *ftdmchan; + int lspan; + int lchan; + + x=1; + in_reset = 0; + while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { + if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) { + ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; + ftdmchan = ss7_info->ftdmchan; + + /* if span == 0 then all spans should be printed */ + if (span == 0) { + lspan = ftdmchan->physical_span_id; + } else { + lspan = span; + } + + /* if chan == 0 then all chans should be printed */ + if (chan == 0) { + lchan = ftdmchan->physical_chan_id; + } else { + lchan = chan; + } + + if ((ftdmchan->physical_span_id == lspan) && (ftdmchan->physical_chan_id == lchan)) { + if ((sngss7_test_flag(ss7_info, FLAG_RESET_RX)) || + (sngss7_test_flag(ss7_info, FLAG_RESET_TX)) || + (sngss7_test_flag(ss7_info, FLAG_GRP_RESET_RX)) || + (sngss7_test_flag(ss7_info, FLAG_GRP_RESET_TX))) { + + if (verbose) { + stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|in_reset=Y\n", + ftdmchan->physical_span_id, + ftdmchan->physical_chan_id, + ss7_info->circuit->cic); + } /* if (verbose) */ + + /*increment the count of circuits in reset */ + in_reset++; + } /* if ((sngss7_test_flag(ss7_info, FLAG_RESET_RX) ... */ + } /* if ( span and chan) */ + } /* if ( cic != 0) */ + + /* go the next circuit */ + x++; + } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ + + stream->write_function(stream, "\nTotal # of CICs in reset = %d\n",in_reset); + + return FTDM_SUCCESS; } /******************************************************************************/ static ftdm_status_t handle_show_flags(ftdm_stream_handle_t *stream, int span, int chan, int verbose) { - int x; - int bit; - sngss7_chan_data_t *ss7_info; - ftdm_channel_t *ftdmchan; - int lspan; - int lchan; - - x=1; - while (g_ftdm_sngss7_data.cfg.isupCircuit[x].id != 0) { - if (g_ftdm_sngss7_data.cfg.isupCircuit[x].siglink != 1) { - ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCircuit[x].obj; - ftdmchan = ss7_info->ftdmchan; - - /* if span == 0 then all spans should be printed */ - if (span == 0) { - lspan = ftdmchan->physical_span_id; - } else { - lspan = span; - } - - /* if chan == 0 then all chans should be printed */ - if (chan == 0) { - lchan = ftdmchan->physical_chan_id; - } else { - lchan = chan; - } - - if ((ftdmchan->physical_span_id == lspan) && (ftdmchan->physical_chan_id == lchan)) { - stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d", - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id, - ss7_info->circuit->cic); - - for (bit = 0; bit < 33; bit++) { - stream->write_function(stream, "|"); - if (ss7_info->flags & ( 0x1 << bit)) { - stream->write_function(stream, "%2d=1", bit); - } else { - stream->write_function(stream, "%2d=0", bit); - } - } - - stream->write_function(stream, "\n"); - } /* if ( span and chan) */ - - } /* if ( cic != 0) */ - - /* go the next circuit */ - x++; - } /* while (g_ftdm_sngss7_data.cfg.isupCircuit[x]id != 0) */ - - return FTDM_SUCCESS; + int x; + int bit; + sngss7_chan_data_t *ss7_info; + ftdm_channel_t *ftdmchan; + int lspan; + int lchan; + + x=1; + while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { + if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) { + ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; + ftdmchan = ss7_info->ftdmchan; + + /* if span == 0 then all spans should be printed */ + if (span == 0) { + lspan = ftdmchan->physical_span_id; + } else { + lspan = span; + } + + /* if chan == 0 then all chans should be printed */ + if (chan == 0) { + lchan = ftdmchan->physical_chan_id; + } else { + lchan = chan; + } + + if ((ftdmchan->physical_span_id == lspan) && (ftdmchan->physical_chan_id == lchan)) { + stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d", + ftdmchan->physical_span_id, + ftdmchan->physical_chan_id, + ss7_info->circuit->cic); + + for (bit = 0; bit < 33; bit++) { + stream->write_function(stream, "|"); + if (ss7_info->flags & ( 0x1 << bit)) { + stream->write_function(stream, "%2d=1", bit); + } else { + stream->write_function(stream, "%2d=0", bit); + } + } + + stream->write_function(stream, "\n"); + } /* if ( span and chan) */ + + } /* if ( cic != 0) */ + + /* go the next circuit */ + x++; + } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ + + return FTDM_SUCCESS; } /******************************************************************************/ static ftdm_status_t handle_show_blocks(ftdm_stream_handle_t *stream, int span, int chan, int verbose) { - int x; - sngss7_chan_data_t *ss7_info; - ftdm_channel_t *ftdmchan; - int lspan; - int lchan; - - x=1; - while (g_ftdm_sngss7_data.cfg.isupCircuit[x].id != 0) { - if (g_ftdm_sngss7_data.cfg.isupCircuit[x].siglink != 1) { - ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCircuit[x].obj; - ftdmchan = ss7_info->ftdmchan; - - /* if span == 0 then all spans should be printed */ - if (span == 0) { - lspan = ftdmchan->physical_span_id; - } else { - lspan = span; - } - - /* if chan == 0 then all chans should be printed */ - if (chan == 0) { - lchan = ftdmchan->physical_chan_id; - } else { - lchan = chan; - } - - if ((ftdmchan->physical_span_id == lspan) && (ftdmchan->physical_chan_id == lchan)) { - stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|", - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id, - ss7_info->circuit->cic); - - if((sngss7_test_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX)) || (sngss7_test_flag(ss7_info, FLAG_GRP_MN_BLOCK_TX))) { - stream->write_function(stream, "l_mn=Y|"); - }else { - stream->write_function(stream, "l_mn=N|"); - } - - if((sngss7_test_flag(ss7_info, FLAG_CKT_MN_BLOCK_RX)) || (sngss7_test_flag(ss7_info, FLAG_GRP_MN_BLOCK_RX))) { - stream->write_function(stream, "r_mn=Y|"); - }else { - stream->write_function(stream, "r_mn=N|"); - } - - if(sngss7_test_flag(ss7_info, FLAG_GRP_HW_BLOCK_TX)) { - stream->write_function(stream, "l_hw=Y|"); - }else { - stream->write_function(stream, "l_hw=N|"); - } - - if(sngss7_test_flag(ss7_info, FLAG_GRP_HW_BLOCK_RX)) { - stream->write_function(stream, "r_hw=Y\n"); - }else { - stream->write_function(stream, "r_hw=N\n"); - } - } /* if ( span and chan) */ - - } /* if ( cic != 0) */ - - /* go the next circuit */ - x++; - } /* while (g_ftdm_sngss7_data.cfg.isupCircuit[x]id != 0) */ - - return FTDM_SUCCESS; + int x; + sngss7_chan_data_t *ss7_info; + ftdm_channel_t *ftdmchan; + int lspan; + int lchan; + + x=1; + while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { + if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) { + ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; + ftdmchan = ss7_info->ftdmchan; + + /* if span == 0 then all spans should be printed */ + if (span == 0) { + lspan = ftdmchan->physical_span_id; + } else { + lspan = span; + } + + /* if chan == 0 then all chans should be printed */ + if (chan == 0) { + lchan = ftdmchan->physical_chan_id; + } else { + lchan = chan; + } + + if ((ftdmchan->physical_span_id == lspan) && (ftdmchan->physical_chan_id == lchan)) { + stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|", + ftdmchan->physical_span_id, + ftdmchan->physical_chan_id, + ss7_info->circuit->cic); + + if((sngss7_test_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX)) || (sngss7_test_flag(ss7_info, FLAG_GRP_MN_BLOCK_TX))) { + stream->write_function(stream, "l_mn=Y|"); + }else { + stream->write_function(stream, "l_mn=N|"); + } + + if((sngss7_test_flag(ss7_info, FLAG_CKT_MN_BLOCK_RX)) || (sngss7_test_flag(ss7_info, FLAG_GRP_MN_BLOCK_RX))) { + stream->write_function(stream, "r_mn=Y|"); + }else { + stream->write_function(stream, "r_mn=N|"); + } + + if(sngss7_test_flag(ss7_info, FLAG_GRP_HW_BLOCK_TX)) { + stream->write_function(stream, "l_hw=Y|"); + }else { + stream->write_function(stream, "l_hw=N|"); + } + + if(sngss7_test_flag(ss7_info, FLAG_GRP_HW_BLOCK_RX)) { + stream->write_function(stream, "r_hw=Y|"); + }else { + stream->write_function(stream, "r_hw=N|"); + } + + if(sngss7_test_flag(ss7_info, FLAG_CKT_LC_BLOCK_RX)) { + stream->write_function(stream, "l_mngmt=Y|"); + }else { + stream->write_function(stream, "l_mngmt=N|"); + } + + if(sngss7_test_flag(ss7_info, FLAG_CKT_UCIC_BLOCK)) { + stream->write_function(stream, "l_ucic=Y|"); + }else { + stream->write_function(stream, "l_ucic=N|"); + } + + stream->write_function(stream, "\n"); + } /* if ( span and chan) */ + + } /* if ( cic != 0) */ + + /* go the next circuit */ + x++; + } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ + + return FTDM_SUCCESS; } /******************************************************************************/ static ftdm_status_t handle_show_status(ftdm_stream_handle_t *stream, int span, int chan, int verbose) { - int x; - sngss7_chan_data_t *ss7_info; - ftdm_channel_t *ftdmchan; - int lspan; - int lchan; - ftdm_signaling_status_t sigstatus = FTDM_SIG_STATE_DOWN; - - x=1; - while (g_ftdm_sngss7_data.cfg.isupCircuit[x].id != 0) { - if (g_ftdm_sngss7_data.cfg.isupCircuit[x].siglink != 1) { - ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCircuit[x].obj; - ftdmchan = ss7_info->ftdmchan; - - /* if span == 0 then all spans should be printed */ - if (span == 0) { - lspan = ftdmchan->physical_span_id; - } else { - lspan = span; - } - - /* if chan == 0 then all chans should be printed */ - if (chan == 0) { - lchan = ftdmchan->physical_chan_id; - } else { - lchan = chan; - } - - if ((ftdmchan->physical_span_id == lspan) && (ftdmchan->physical_chan_id == lchan)) { - /* grab the signaling_status */ - ftdm_channel_get_sig_status(ftdmchan, &sigstatus); - - stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|sig_status=%s|state=%s|", - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id, - ss7_info->circuit->cic, - ftdm_signaling_status2str(sigstatus), - ftdm_channel_state2str(ftdmchan->state)); - - if((sngss7_test_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX)) || (sngss7_test_flag(ss7_info, FLAG_GRP_MN_BLOCK_TX))) { - stream->write_function(stream, "l_mn=Y|"); - }else { - stream->write_function(stream, "l_mn=N|"); - } - - if((sngss7_test_flag(ss7_info, FLAG_CKT_MN_BLOCK_RX)) || (sngss7_test_flag(ss7_info, FLAG_GRP_MN_BLOCK_RX))) { - stream->write_function(stream, "r_mn=Y|"); - }else { - stream->write_function(stream, "r_mn=N|"); - } - - if(sngss7_test_flag(ss7_info, FLAG_GRP_HW_BLOCK_TX)) { - stream->write_function(stream, "l_hw=Y|"); - }else { - stream->write_function(stream, "l_hw=N|"); - } - - if(sngss7_test_flag(ss7_info, FLAG_GRP_HW_BLOCK_RX)) { - stream->write_function(stream, "r_hw=Y\n"); - }else { - stream->write_function(stream, "r_hw=N\n"); - } - } /* if ( span and chan) */ - - } /* if ( cic != 0) */ - - /* go the next circuit */ - x++; - } /* while (g_ftdm_sngss7_data.cfg.isupCircuit[x]id != 0) */ - - return FTDM_SUCCESS; - - return FTDM_SUCCESS; + int x; + sngss7_chan_data_t *ss7_info; + ftdm_channel_t *ftdmchan; + int lspan; + int lchan; + ftdm_signaling_status_t sigstatus = FTDM_SIG_STATE_DOWN; + + x=1; + while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { + if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) { + ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; + ftdmchan = ss7_info->ftdmchan; + + /* if span == 0 then all spans should be printed */ + if (span == 0) { + lspan = ftdmchan->physical_span_id; + } else { + lspan = span; + } + + /* if chan == 0 then all chans should be printed */ + if (chan == 0) { + lchan = ftdmchan->physical_chan_id; + } else { + lchan = chan; + } + + if ((ftdmchan->physical_span_id == lspan) && (ftdmchan->physical_chan_id == lchan)) { + /* grab the signaling_status */ + ftdm_channel_get_sig_status(ftdmchan, &sigstatus); + + stream->write_function(stream, "span=%2d|chan=%2d|cic=%4d|sig_status=%s|state=%s|", + ftdmchan->physical_span_id, + ftdmchan->physical_chan_id, + ss7_info->circuit->cic, + ftdm_signaling_status2str(sigstatus), + ftdm_channel_state2str(ftdmchan->state)); + + if((sngss7_test_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX)) || (sngss7_test_flag(ss7_info, FLAG_GRP_MN_BLOCK_TX))) { + stream->write_function(stream, "l_mn=Y|"); + }else { + stream->write_function(stream, "l_mn=N|"); + } + + if((sngss7_test_flag(ss7_info, FLAG_CKT_MN_BLOCK_RX)) || (sngss7_test_flag(ss7_info, FLAG_GRP_MN_BLOCK_RX))) { + stream->write_function(stream, "r_mn=Y|"); + }else { + stream->write_function(stream, "r_mn=N|"); + } + + if(sngss7_test_flag(ss7_info, FLAG_GRP_HW_BLOCK_TX)) { + stream->write_function(stream, "l_hw=Y|"); + }else { + stream->write_function(stream, "l_hw=N|"); + } + + if(sngss7_test_flag(ss7_info, FLAG_GRP_HW_BLOCK_RX)) { + stream->write_function(stream, "r_hw=Y|"); + }else { + stream->write_function(stream, "r_hw=N|"); + } + + if(sngss7_test_flag(ss7_info, FLAG_CKT_LC_BLOCK_RX)) { + stream->write_function(stream, "l_mngmt=Y|"); + }else { + stream->write_function(stream, "l_mngmt=N|"); + } + + if(sngss7_test_flag(ss7_info, FLAG_CKT_UCIC_BLOCK)) { + stream->write_function(stream, "l_ucic=Y|"); + }else { + stream->write_function(stream, "l_ucic=N|"); + } + + stream->write_function(stream, "flags=0x%X",ss7_info->flags); + + stream->write_function(stream, "\n"); + } /* if ( span and chan) */ + + } /* if ( cic != 0) */ + + /* go the next circuit */ + x++; + } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ + + return FTDM_SUCCESS; } /******************************************************************************/ static ftdm_status_t handle_set_blocks(ftdm_stream_handle_t *stream, int span, int chan, int verbose) { - int x; - sngss7_chan_data_t *ss7_info; - ftdm_channel_t *ftdmchan; - int lspan; - int lchan; - - x=1; - while (g_ftdm_sngss7_data.cfg.isupCircuit[x].id != 0) { - if (g_ftdm_sngss7_data.cfg.isupCircuit[x].siglink != 1) { - ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCircuit[x].obj; - ftdmchan = ss7_info->ftdmchan; - - /* if span == 0 then all spans should be printed */ - if (span == 0) { - lspan = ftdmchan->physical_span_id; - } else { - lspan = span; - } - - /* if chan == 0 then all chans should be printed */ - if (chan == 0) { - lchan = ftdmchan->physical_chan_id; - } else { - lchan = chan; - } - - if ((ftdmchan->physical_span_id == lspan) && (ftdmchan->physical_chan_id == lchan)) { - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change|give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", ss7_info->circuit->cic); - } else { - /* throw the ckt block flag */ - sngss7_set_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX); - - /* set the channel to suspended state */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - } - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - } /* if ( span and chan) */ - - } /* if ( cic != 0) */ - - /* go the next circuit */ - x++; - } /* while (g_ftdm_sngss7_data.cfg.isupCircuit[x]id != 0) */ - - handle_show_blocks(stream, span, chan, verbose); - - return FTDM_SUCCESS; + int x; + sngss7_chan_data_t *ss7_info; + ftdm_channel_t *ftdmchan; + int lspan; + int lchan; + + x=1; + while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { + if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) { + ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; + ftdmchan = ss7_info->ftdmchan; + + /* if span == 0 then all spans should be printed */ + if (span == 0) { + lspan = ftdmchan->physical_span_id; + } else { + lspan = span; + } + + /* if chan == 0 then all chans should be printed */ + if (chan == 0) { + lchan = ftdmchan->physical_chan_id; + } else { + lchan = chan; + } + + if ((ftdmchan->physical_span_id == lspan) && (ftdmchan->physical_chan_id == lchan)) { + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* check if there is a pending state change|give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", ss7_info->circuit->cic); + SS7_ASSERT; + } else { + /* throw the ckt block flag */ + sngss7_set_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX); + + /* set the channel to suspended state */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); + } + + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); + + } /* if ( span and chan) */ + + } /* if ( cic != 0) */ + + /* go the next circuit */ + x++; + } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ + + handle_show_blocks(stream, span, chan, verbose); + + return FTDM_SUCCESS; } /******************************************************************************/ static ftdm_status_t handle_set_unblks(ftdm_stream_handle_t *stream, int span, int chan, int verbose) { - int x; - sngss7_chan_data_t *ss7_info; - ftdm_channel_t *ftdmchan; - int lspan; - int lchan; - - x=1; - while (g_ftdm_sngss7_data.cfg.isupCircuit[x].id != 0) { - if (g_ftdm_sngss7_data.cfg.isupCircuit[x].siglink != 1) { - ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCircuit[x].obj; - ftdmchan = ss7_info->ftdmchan; - - /* if span == 0 then all spans should be printed */ - if (span == 0) { - lspan = ftdmchan->physical_span_id; - } else { - lspan = span; - } - - /* if chan == 0 then all chans should be printed */ - if (chan == 0) { - lchan = ftdmchan->physical_chan_id; - } else { - lchan = chan; - } - - if ((ftdmchan->physical_span_id == lspan) && (ftdmchan->physical_chan_id == lchan)) { - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change|give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", ss7_info->circuit->cic); - } else { - /* throw the ckt block flag */ - sngss7_set_flag(ss7_info, FLAG_CKT_MN_UNBLK_TX); - - /* clear the block flag */ - sngss7_clear_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX); - - /* set the channel to suspended state */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - } - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - } /* if ( span and chan) */ - - } /* if ( cic != 0) */ - - /* go the next circuit */ - x++; - } /* while (g_ftdm_sngss7_data.cfg.isupCircuit[x]id != 0) */ - - handle_show_blocks(stream, span, chan, verbose); - - return FTDM_SUCCESS; + int x; + sngss7_chan_data_t *ss7_info; + ftdm_channel_t *ftdmchan; + int lspan; + int lchan; + + x=1; + while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { + if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) { + ss7_info = (sngss7_chan_data_t *)g_ftdm_sngss7_data.cfg.isupCkt[x].obj; + ftdmchan = ss7_info->ftdmchan; + + /* if span == 0 then all spans should be printed */ + if (span == 0) { + lspan = ftdmchan->physical_span_id; + } else { + lspan = span; + } + + /* if chan == 0 then all chans should be printed */ + if (chan == 0) { + lchan = ftdmchan->physical_chan_id; + } else { + lchan = chan; + } + + if ((ftdmchan->physical_span_id == lspan) && (ftdmchan->physical_chan_id == lchan)) { + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* check if there is a pending state change|give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", ss7_info->circuit->cic); + SS7_ASSERT; + } else { + /* throw the ckt block flag */ + sngss7_set_flag(ss7_info, FLAG_CKT_MN_UNBLK_TX); + + /* clear the block flag */ + sngss7_clear_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX); + + /* set the channel to suspended state */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); + } + + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); + + } /* if ( span and chan) */ + + } /* if ( cic != 0) */ + + /* go the next circuit */ + x++; + } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x]id != 0) */ + + handle_show_blocks(stream, span, chan, verbose); + + return FTDM_SUCCESS; } /******************************************************************************/ static ftdm_status_t handle_status_link(ftdm_stream_handle_t *stream, char *name) { - int x; - sng_mtp3Link_sta_t sta; - - /* find the link request by it's name */ - x = 1; - while(g_ftdm_sngss7_data.cfg.mtp3Link[x].id != 0) { - if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3Link[x].name, name)) { - /* send the status request */ - if (sng_sta_mtp3_link(&g_ftdm_sngss7_data.cfg, x, &sta)) { - stream->write_function(stream, "Failed to read link=%s status\n", name); - return FTDM_FAIL; - } - - /* print the results */ - stream->write_function(stream, "%s|state=%s|l_blk=%s|r_blk=%s|l_inhbt=%s|r_inhbt=%s\n", - name, - DECODE_LSN_LINK_STATUS(sta.state), - (sta.lblkd) ? "Y":"N", - (sta.rblkd) ? "Y":"N", - (sta.linhbt) ? "Y":"N", - (sta.rinhbt) ? "Y":"N"); - break; - } - - /* move to the next link */ - x++; - } /* while (id != 0) */ - - return FTDM_SUCCESS; + int x = 0; + SnMngmt sta; + + /* find the link request by it's name */ + x = 1; + while(g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) { + if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtpLink[x].name, name)) { + + /* send the status request */ + if (ftmod_ss7_mtplink_sta(x, &sta)) { + stream->write_function(stream, "Failed to read link=%s status\n", name); + return FTDM_FAIL; + } + + /* print the results */ + stream->write_function(stream, "%s|span=%d|chan=%d|sap=%d|state=%s|l_blk=%s|r_blk=%s|l_inhbt=%s|r_inhbt=%s\n", + name, + g_ftdm_sngss7_data.cfg.mtpLink[x].mtp1.span, + g_ftdm_sngss7_data.cfg.mtpLink[x].mtp1.chan, + g_ftdm_sngss7_data.cfg.mtpLink[x].id, + DECODE_LSN_LINK_STATUS(sta.t.ssta.s.snDLSAP.state), + (sta.t.ssta.s.snDLSAP.locBlkd) ? "Y":"N", + (sta.t.ssta.s.snDLSAP.remBlkd) ? "Y":"N", + (sta.t.ssta.s.snDLSAP.locInhbt) ? "Y":"N", + (sta.t.ssta.s.snDLSAP.rmtInhbt) ? "Y":"N"); + break; + } + + /* move to the next link */ + x++; + } /* while (id != 0) */ + + return FTDM_SUCCESS; } /******************************************************************************/ static ftdm_status_t handle_status_linkset(ftdm_stream_handle_t *stream, char *name) { - int x; - sng_mtp3LinkSet_sta_t sta; - - /* find the linkset request by it's name */ - x = 1; - while(g_ftdm_sngss7_data.cfg.mtp3LinkSet[x].id != 0) { - if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3LinkSet[x].name, name)) { - /* send the status request */ - if (sng_sta_mtp3_linkset(&g_ftdm_sngss7_data.cfg, x, 0, &sta)) { - stream->write_function(stream, "Failed to read linkset=%s status\n", name); - return FTDM_FAIL; - } - - /* print the results */ - stream->write_function(stream, "%s|state=%s|nmbActLnk=%d\n", - name, - DECODE_LSN_LINKSET_STATUS(sta.state), - sta.nmbActLnks); - break; - } + int x = 0; + SnMngmt sta; + + /* find the linkset request by it's name */ + x = 1; + while(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) { + if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name, name)) { + + /* send the status request */ + if (ftmod_ss7_mtplinkSet_sta(x, &sta)) { + stream->write_function(stream, "Failed to read linkset=%s status\n", name); + return FTDM_FAIL; + } + + /* print the results */ + stream->write_function(stream, "%s|state=%s|nmbActLnk=%d\n", + name, + DECODE_LSN_LINKSET_STATUS(sta.t.ssta.s.snLnkSet.state), + sta.t.ssta.s.snLnkSet.nmbActLnks); + break; + } - /* move to the next linkset */ - x++; - } /* while (id != 0) */ + /* move to the next linkset */ + x++; + } /* while (id != 0) */ - return FTDM_SUCCESS; + return FTDM_SUCCESS; +} + +/******************************************************************************/ +static ftdm_status_t handle_set_inhibit(ftdm_stream_handle_t *stream, char *name) +{ + int x = 0; + + /* find the link request by it's name */ + x = 1; + while(g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) { + if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtpLink[x].name, name)) { + + /* send the inhibit request */ + if (ftmod_ss7_inhibit_mtplink(x)) { + stream->write_function(stream, "Failed to inhibit link=%s\n", name); + return FTDM_FAIL; + } + + /* print the new status of the link */ + handle_status_link(stream, &name[0]); + + break; + } + + /* move to the next linkset */ + x++; + } /* while (id != 0) */ + + return FTDM_SUCCESS; +} + +/******************************************************************************/ +static ftdm_status_t handle_set_uninhibit(ftdm_stream_handle_t *stream, char *name) +{ + int x = 0; + + /* find the link request by it's name */ + x = 1; + while(g_ftdm_sngss7_data.cfg.mtpLink[x].id != 0) { + if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtpLink[x].name, name)) { + + /* send the uninhibit request */ + if (ftmod_ss7_uninhibit_mtplink(x)) { + stream->write_function(stream, "Failed to uninhibit link=%s\n", name); + return FTDM_FAIL; + } + + /* print the new status of the link */ + handle_status_link(stream, &name[0]); + + break; + } + + /* move to the next linkset */ + x++; + } /* while (id != 0) */ + + return FTDM_SUCCESS; } /******************************************************************************/ static ftdm_status_t extract_span_chan(char *argv[10], int pos, int *span, int *chan) { - if (!strcasecmp(argv[pos], "span")) { - /**************************************************************************/ - pos++; - *span = atoi(argv[pos]); - - pos++; - if (!strcasecmp(argv[pos], "chan")) { - /**********************************************************************/ - pos++; - *chan = atoi(argv[pos]); - /**********************************************************************/ - } else { - /**********************************************************************/ - return FTDM_FAIL; - /**********************************************************************/ - } - /**************************************************************************/ - } else { - /**************************************************************************/ - *span = atoi(argv[pos]); - - pos++; - if (!strcasecmp(argv[pos], "chan")) { - /**********************************************************************/ - pos++; - *chan = atoi(argv[pos]); - /**********************************************************************/ - } else { - /**********************************************************************/ - return FTDM_FAIL; - /**********************************************************************/ - } - /**************************************************************************/ - } - - return FTDM_SUCCESS; + if (!strcasecmp(argv[pos], "span")) { + /**************************************************************************/ + pos++; + *span = atoi(argv[pos]); + + pos++; + if (!strcasecmp(argv[pos], "chan")) { + /**********************************************************************/ + pos++; + *chan = atoi(argv[pos]); + /**********************************************************************/ + } else { + /**********************************************************************/ + return FTDM_FAIL; + /**********************************************************************/ + } + /**************************************************************************/ + } else { + /**************************************************************************/ + *span = atoi(argv[pos]); + + pos++; + if (!strcasecmp(argv[pos], "chan")) { + /**********************************************************************/ + pos++; + *chan = atoi(argv[pos]); + /**********************************************************************/ + } else { + /**********************************************************************/ + return FTDM_FAIL; + /**********************************************************************/ + } + /**************************************************************************/ + } + + return FTDM_SUCCESS; } /******************************************************************************/ static ftdm_status_t check_arg_count(int args, int min) { - if ( args < min ) { - return FTDM_FAIL; - } else { - return FTDM_SUCCESS; - } -} + if ( args < min ) { + return FTDM_FAIL; + } else { + return FTDM_SUCCESS; + } +} /******************************************************************************/ /* For Emacs: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c index 66f3003..52b3860 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c @@ -42,680 +42,234 @@ /******************************************************************************/ /* PROTOTYPES *****************************************************************/ -void handle_sng_log(uint8_t level, char *fmt,...); -void handle_sng_alarm(sng_alrm_t t_alarm); +int ft_to_sngss7_activate_all(void); -static void handle_entsi_alarm(sng_alrm_t t_alarm); +static int ftmod_ss7_enable_isap(int suId); +static int ftmod_ss7_enable_nsap(int suId); +static int ftmod_ss7_enable_mtpLinkSet(int lnkSetId); -int ft_to_sngss7_cfg(void); -int ft_to_sngss7_activate_all(void); +int ftmod_ss7_inhibit_mtplink(uint32_t id); +int ftmod_ss7_uninhibit_mtplink(uint32_t id); +/******************************************************************************/ + +/* FUNCTIONS ******************************************************************/ +int ft_to_sngss7_activate_all(void) +{ + int x; + + x = 1; + while (g_ftdm_sngss7_data.cfg.isap[x].id != 0) { + /* check if this link has already been actived */ + if (!(g_ftdm_sngss7_data.cfg.isap[x].flags & ACTIVE)) { + + if (ftmod_ss7_enable_isap(x)) { + SS7_CRITICAL("ISAP %d Enable: NOT OK\n", x); + SS7_ASSERT; + } else { + SS7_INFO("ISAP %d Enable: OK\n", x); + } + + /* set the ACTIVE flag */ + g_ftdm_sngss7_data.cfg.isap[x].flags |= ACTIVE; + } /* if !ACTIVE */ + + x++; + } /* while (g_ftdm_sngss7_data.cfg.isap[x].id != 0) */ + + x = 1; + while (g_ftdm_sngss7_data.cfg.nsap[x].id != 0) { + /* check if this link has already been actived */ + if (!(g_ftdm_sngss7_data.cfg.nsap[x].flags & ACTIVE)) { + + if (ftmod_ss7_enable_nsap(x)) { + SS7_CRITICAL("NSAP %d Enable: NOT OK\n", x); + SS7_ASSERT; + } else { + SS7_INFO("NSAP %d Enable: OK\n", x); + } + + /* set the ACTIVE flag */ + g_ftdm_sngss7_data.cfg.nsap[x].flags |= ACTIVE; + } /* if !ACTIVE */ + + x++; + } /* while (g_ftdm_sngss7_data.cfg.nsap[x].id != 0) */ + + x = 1; + while (g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) { + /* check if this link has already been actived */ + if (!(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].flags & ACTIVE)) { + + if (ftmod_ss7_enable_mtpLinkSet(x)) { + SS7_CRITICAL("LinkSet \"%s\" Enable: NOT OK\n", g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name); + SS7_ASSERT; + } else { + SS7_INFO("LinkSet \"%s\" Enable: OK\n", g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name); + } + + /* set the ACTIVE flag */ + g_ftdm_sngss7_data.cfg.mtpLinkSet[x].flags |= ACTIVE; + } /* if !ACTIVE */ + + x++; + } /* while (g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) */ + + return 0; +} -static int ftmod_ss7_general_configuration(void); +/******************************************************************************/ +static int ftmod_ss7_enable_isap(int suId) +{ + CcMngmt cntrl; + Pst pst; -static int ftmod_ss7_configure_mtp1_link(int id); + /* initalize the post structure */ + smPstInit(&pst); -static int ftmod_ss7_configure_mtp2_link(int id); + /* insert the destination Entity */ + pst.dstEnt = ENTCC; -static int ftmod_ss7_configure_mtp3_link(int id); -static int ftmod_ss7_configure_mtp3_linkset(int id); -static int ftmod_ss7_configure_mtp3_route(int id); -static int ftmod_ss7_configure_mtp3_isup(int id); + /* initalize the control structure */ + memset(&cntrl, 0x0, sizeof(CcMngmt)); -static int ftmod_ss7_configure_isup_mtp3(int id); -static int ftmod_ss7_configure_isup_interface(int id); -static int ftmod_ss7_configure_isup_circuit(int id); -static int ftmod_ss7_configure_isup_cc(int id); + /* initalize the control header */ + smHdrInit(&cntrl.hdr); -static int ftmod_ss7_configure_cc_isup(int id); + cntrl.hdr.msgType = TCNTRL; /* this is a control request */ + cntrl.hdr.entId.ent = ENTCC; + cntrl.hdr.entId.inst = S_INST; + cntrl.hdr.elmId.elmnt = STISAP; -/******************************************************************************/ + cntrl.hdr.elmId.elmntInst1 = suId; /* this is the SAP to bind */ -/* FUNCTIONS ******************************************************************/ + cntrl.t.cntrl.action = ABND_ENA; /* bind and activate */ + cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ -/* LOGGIGING ******************************************************************/ -void handle_sng_log(uint8_t level, char *fmt,...) -{ - char *data; - int ret; - va_list ap; - - va_start(ap, fmt); - ret = vasprintf(&data, fmt, ap); - if (ret == -1) { - return; - } - - switch (level) { - /**************************************************************************/ - case SNG_LOGLEVEL_DEBUG: - ftdm_log(FTDM_LOG_DEBUG, "sng_ss7->%s", data); - break; - /**************************************************************************/ - case SNG_LOGLEVEL_WARN: - ftdm_log(FTDM_LOG_INFO, "sng_ss7->%s", data); - break; - /**************************************************************************/ - case SNG_LOGLEVEL_INFO: - ftdm_log(FTDM_LOG_INFO, "sng_ss7->%s", data); - break; - /**************************************************************************/ - case SNG_LOGLEVEL_STATS: - ftdm_log(FTDM_LOG_INFO, "sng_ss7->%s", data); - break; - /**************************************************************************/ - case SNG_LOGLEVEL_ERROR: - ftdm_log(FTDM_LOG_ERROR, "sng_ss7->%s", data); - break; - /**************************************************************************/ - case SNG_LOGLEVEL_CRIT: - printf("%s",data); - /*ftdm_log(FTDM_LOG_CRIT, "sng_ss7->%s", data);*/ - break; - /**************************************************************************/ - default: - ftdm_log(FTDM_LOG_INFO, "sng_ss7->%s", data); - break; - /**************************************************************************/ - } - - return; + return (sng_cntrl_cc(&pst, &cntrl)); } /******************************************************************************/ -void handle_sng_alarm(sng_alrm_t t_alarm) +static int ftmod_ss7_enable_nsap(int suId) { + SiMngmt cntrl; + Pst pst; - switch (t_alarm.entity) { - /**************************************************************************/ - case (ENTL1): - ftdm_log(FTDM_LOG_WARNING,"[SNG-MTP1] %s : %s : %s \n", - DECODE_LL1_EVENT(t_alarm.event), - DECODE_LL1_CAUSE(t_alarm.cause), - DECODE_LL1_PARM(t_alarm.eventParm[0])); - break; - /**************************************************************************/ - case (ENTSD): - ftdm_log(FTDM_LOG_WARNING,"[SNG-MTP2] %s : %s \n", - DECODE_LSD_EVENT(t_alarm.event), - DECODE_LSD_CAUSE(t_alarm.cause)); - break; - /**************************************************************************/ - case (ENTSN): - ftdm_log(FTDM_LOG_WARNING,"[SNG-MTP3] %s on %d: %s \n", - DECODE_LSN_EVENT(t_alarm.event), - t_alarm.id, - DECODE_LSN_CAUSE(t_alarm.cause)); - break; - /**************************************************************************/ - case (ENTSI): - handle_entsi_alarm(t_alarm); - break; - /**************************************************************************/ - case (ENTCC): - ftdm_log(FTDM_LOG_DEBUG,"[SNG-CC] %s : %s \n", - DECODE_LCC_EVENT(t_alarm.event), - DECODE_LCC_CAUSE(t_alarm.cause)); - break; - /**************************************************************************/ - default: - ftdm_log(FTDM_LOG_WARNING,"Received alarm from unknown entity"); - break; - /**************************************************************************/ - } /* switch (t_alarm.entity) */ - - return; -} + /* initalize the post structure */ + smPstInit(&pst); -/******************************************************************************/ -static void handle_entsi_alarm(sng_alrm_t alarm) -{ + /* insert the destination Entity */ + pst.dstEnt = ENTSI; - switch (alarm.event) { - /**************************************************************************/ - case (LCM_EVENT_TIMEOUT): - /* this event always has the circuit value embedded */ - SS7_WARN("[ISUP] Timer %d expired on CIC %d\n", - alarm.eventParm[8], - g_ftdm_sngss7_data.cfg.isupCircuit[alarm.eventParm[0]].cic); - break; - /**************************************************************************/ - case (LSI_EVENT_REMOTE): - SS7_WARN("[ISUP] %s received on CIC %d\n", - DECODE_LSI_CAUSE(alarm.cause), - g_ftdm_sngss7_data.cfg.isupCircuit[alarm.eventParm[0]].cic); - break; - /**************************************************************************/ - case (LSI_EVENT_LOCAL): - SS7_WARN("[ISUP] %s transmitted on CIC %d\n", - DECODE_LSI_CAUSE(alarm.cause), - g_ftdm_sngss7_data.cfg.isupCircuit[alarm.eventParm[0]].cic); - break; - /**************************************************************************/ - case (LSI_EVENT_MTP): - SS7_WARN("[ISUP] Received %s on %d\n", - DECODE_LSI_CAUSE(alarm.cause), - g_ftdm_sngss7_data.cfg.mtp3_isup[alarm.eventParm[2]].id); - break; - /**************************************************************************/ - case (LCM_EVENT_UI_INV_EVT): - switch (alarm.cause) { - /**********************************************************************/ - case (LSI_CAUSE_INV_CIRCUIT): - SS7_WARN("[ISUP] Invalid circuit = %d (CIC = %d)\n", - alarm.eventParm[0], - g_ftdm_sngss7_data.cfg.isupCircuit[alarm.eventParm[0]].cic); - break; - /**********************************************************************/ - } - break; - /**************************************************************************/ - case (LCM_EVENT_LI_INV_EVT): - switch (alarm.cause) { - /**********************************************************************/ - case (LCM_CAUSE_INV_SAP): - SS7_WARN("[ISUP] Invalid spId = %d\n", - alarm.eventParm[3]); - break; - /**********************************************************************/ - } - break; - /**************************************************************************/ - default: - SS7_WARN("[ISUP] %s : %s \n", DECODE_LSI_EVENT(alarm.event), DECODE_LSI_CAUSE(alarm.cause)); - break; - /**************************************************************************/ - } /* switch (alarm.event) */ - return; -} + /* initalize the control structure */ + memset(&cntrl, 0x0, sizeof(SiMngmt)); -/* ACTIVATION *****************************************************************/ -int ft_to_sngss7_activate_all(void) -{ - sng_isup_cc_t *cc_isup = NULL; - sng_mtp3_isup_t *isup_mtp3 = NULL; - sng_mtp3LinkSet_t *mtp3_linkset = NULL; - int x; - - /* CC to ISUP *************************************************************/ - x = 1; - cc_isup = &g_ftdm_sngss7_data.cfg.isup_cc[x]; - while (cc_isup->id != 0) { - if (sngss7_test_flag(cc_isup, SNGSS7_FLAG_ACTIVE)) { - SS7_DEBUG("CC-ISUP interface already active = %d\n", cc_isup->id); - } else { - if (sng_activate_cc_isup_inf(cc_isup->ccId)) { - SS7_ERROR("Failed to activate CC-ISUP = %d\n",cc_isup->id); - return FTDM_FAIL; - } else { - SS7_INFO("Started CC-ISUP interface = %d\n", cc_isup->id); - sngss7_set_flag(cc_isup, SNGSS7_FLAG_ACTIVE); - } - } /* if (sngss7_test_flag(cc_isup, SNGSS7_FLAG_ACTIVE) */ - - x++; - cc_isup = &g_ftdm_sngss7_data.cfg.isup_cc[x]; - } /* while (cc_isup->id != 0) */ - - /* ISUP - MTP3 ************************************************************/ - x = 1; - isup_mtp3 = &g_ftdm_sngss7_data.cfg.mtp3_isup[x]; - while (isup_mtp3->id != 0) { - if (sngss7_test_flag(isup_mtp3, SNGSS7_FLAG_ACTIVE)) { - SS7_DEBUG("ISUP-MTP3 interface already active = %d\n", isup_mtp3->id); - } else { - if (sng_activate_isup_mtp3_inf(isup_mtp3->id)) { - SS7_ERROR("Failed to activate ISUP-MTP3 = %d\n",isup_mtp3->id); - return FTDM_FAIL; - } else { - SS7_INFO("Started ISUP-MTP3interface = %d\n", isup_mtp3->id); - sngss7_set_flag(isup_mtp3, SNGSS7_FLAG_ACTIVE); - } - } /* if (sngss7_test_flag(isup_mtp3, SNGSS7_FLAG_ACTIVE) */ - - x++; - isup_mtp3 = &g_ftdm_sngss7_data.cfg.mtp3_isup[x]; - } /* while (isup_mtp3->id != 0) */ - - /* MTP3 Linkset (MTP3 - MTP2 - MTP1) **************************************/ - x = 1; - mtp3_linkset = &g_ftdm_sngss7_data.cfg.mtp3LinkSet[x]; - while (mtp3_linkset->id != 0) { - if (sngss7_test_flag(mtp3_linkset, SNGSS7_FLAG_ACTIVE)) { - SS7_DEBUG("MTP3 Linkset already active = %s\n", mtp3_linkset->name); - } else { - if (sng_activate_mtp3_linkset(mtp3_linkset->id)) { - SS7_ERROR("Failed to activate MTP3 Linkset = %s\n",mtp3_linkset->name); - return FTDM_FAIL; - } else { - SS7_INFO("Started MTP3 Linkset = %s\n", mtp3_linkset->name); - sngss7_set_flag(mtp3_linkset, SNGSS7_FLAG_ACTIVE); - } - } /* if (sngss7_test_flag(mtp3_linkset, SNGSS7_FLAG_ACTIVE) */ - - x++; - mtp3_linkset = &g_ftdm_sngss7_data.cfg.mtp3LinkSet[x]; - } /* while (mtp3_linkset->id != 0) */ - - return FTDM_SUCCESS; -} + /* initalize the control header */ + smHdrInit(&cntrl.hdr); -/* CONFIGURATION **************************************************************/ -int ft_to_sngss7_cfg(void) -{ - sng_mtp1Link_t *mtp1_link = NULL; - sng_mtp2Link_t *mtp2_link = NULL; - sng_mtp3Link_t *mtp3_link = NULL; - sng_mtp3LinkSet_t *mtp3_linkset = NULL; - sng_mtp3Route_t *mtp3_route = NULL; - sng_mtp3_isup_t *mtp3_isup = NULL; - sng_mtp3_isup_t *isup_mtp3 = NULL; - sng_isupInterface_t *isup_interface = NULL; - sng_isupCircuit_t *isup_circuit = NULL; - sng_isup_cc_t *isup_cc = NULL; - sng_isup_cc_t *cc_isup = NULL; - int x; - - SS7_DEBUG("Starting LibSngSS7 configuration...\n"); - - if (g_ftdm_sngss7_data.gen_config_done == 0) { - /* perform general configuration */ - if(ftmod_ss7_general_configuration()) { - SS7_ERROR("Failed to run general configuration!\n"); - return FTDM_FAIL; - } else { - SS7_INFO("General Configuration was successful\n"); - g_ftdm_sngss7_data.gen_config_done = 1; - } - } else { - SS7_DEBUG("General configuration already done.\n"); - } - - /* MTP1 *******************************************************************/ - x=1; - mtp1_link = &g_ftdm_sngss7_data.cfg.mtp1Link[x]; - while (mtp1_link->id != 0) { - - if (sngss7_test_flag(mtp1_link, SNGSS7_FLAG_CONFIGURED)) { - SS7_DEBUG("MTP1 Link already configured = %s\n",mtp1_link->name); - } else { - if (ftmod_ss7_configure_mtp1_link(x)) { - SS7_ERROR("Failed to configure MTP1 link = %s\n!", mtp1_link->name); - return FTDM_FAIL; - } else { - SS7_INFO("Successfully configured MTP1 link = %s\n", mtp1_link->name); - sngss7_set_flag(mtp1_link, SNGSS7_FLAG_CONFIGURED); - } - } - - /* next link */ - x++; - mtp1_link = &g_ftdm_sngss7_data.cfg.mtp1Link[x]; - } /* while (g_ftdm_sngss7_data.cfg.mtp1Link[x]->id != 0) */ - - /* MTP2 *******************************************************************/ - x=1; - mtp2_link = &g_ftdm_sngss7_data.cfg.mtp2Link[x]; - while (mtp2_link->id != 0) { - if (sngss7_test_flag(mtp2_link, SNGSS7_FLAG_CONFIGURED)) { - SS7_DEBUG("MTP2 Link already configured = %s\n",mtp2_link->name); - } else { - if (ftmod_ss7_configure_mtp2_link(x)) { - SS7_ERROR("Failed to configure MTP2 link = %s\n!", mtp2_link->name); - return FTDM_FAIL; - } else { - SS7_INFO("Successfully configured MTP2 link = %s\n", mtp2_link->name); - sngss7_set_flag(mtp2_link, SNGSS7_FLAG_CONFIGURED); - } - } - /* next link */ - x++; - mtp2_link = &g_ftdm_sngss7_data.cfg.mtp2Link[x]; - } /* while (g_ftdm_sngss7_data.cfg.mtp2Link[x]->id != 0) */ - - /* MTP3 *******************************************************************/ - x=1; - mtp3_link = &g_ftdm_sngss7_data.cfg.mtp3Link[x]; - while (mtp3_link->id != 0) { - if (sngss7_test_flag(mtp3_link, SNGSS7_FLAG_CONFIGURED)) { - SS7_DEBUG("MTP3 Link already configured = %s\n", mtp3_link->name); - } else { - if (ftmod_ss7_configure_mtp3_link(x)) { - SS7_ERROR("Failed to configure MTP3 link = %s\n!", mtp3_link->name); - return FTDM_FAIL; - } else { - SS7_INFO("Successfully configured MTP3 link = %s\n", mtp3_link->name); - sngss7_set_flag(mtp3_link, SNGSS7_FLAG_CONFIGURED); - } - } - /* next link */ - x++; - mtp3_link = &g_ftdm_sngss7_data.cfg.mtp3Link[x]; - } /* while (g_ftdm_sngss7_data.cfg.mtp3Link[x]->id != 0) */ - - x=1; - mtp3_linkset = &g_ftdm_sngss7_data.cfg.mtp3LinkSet[x]; - while (mtp3_linkset->id != 0) { - if (sngss7_test_flag(mtp3_linkset, SNGSS7_FLAG_CONFIGURED)) { - SS7_DEBUG("MTP3 LinkSet already configured = %s\n", mtp3_linkset->name); - } else { - if (ftmod_ss7_configure_mtp3_linkset(x)) { - SS7_ERROR("Failed to configure MTP3 link = %s\n!", mtp3_linkset->name); - return FTDM_FAIL; - } else { - SS7_INFO("Successfully configured MTP3 link = %s\n", mtp3_linkset->name); - sngss7_set_flag(mtp3_linkset, SNGSS7_FLAG_CONFIGURED); - } - } - /* next link */ - x++; - mtp3_linkset = &g_ftdm_sngss7_data.cfg.mtp3LinkSet[x]; - } /* while (g_ftdm_sngss7_data.cfg.mtp1Link[x]->id != 0) */ - - x=1; - mtp3_route = &g_ftdm_sngss7_data.cfg.mtp3Route[x]; - while (mtp3_route->id != 0) { - if (sngss7_test_flag(mtp3_route, SNGSS7_FLAG_CONFIGURED)) { - SS7_DEBUG("MTP3 Route already configured = %s\n", mtp3_route->name); - } else { - if (ftmod_ss7_configure_mtp3_route(x)) { - SS7_ERROR("Failed to configure MTP3 route = %s\n!", mtp3_route->name); - return FTDM_FAIL; - } else { - SS7_INFO("Successfully configured MTP3 route = %s\n", mtp3_route->name); - sngss7_set_flag(mtp3_route, SNGSS7_FLAG_CONFIGURED); - } - } - /* next link */ - x++; - mtp3_route = &g_ftdm_sngss7_data.cfg.mtp3Route[x]; - } /* while (g_ftdm_sngss7_data.cfg.mtp3Route[x]->id != 0) */ - - mtp3_route = &g_ftdm_sngss7_data.cfg.mtp3Route[0]; - if (sngss7_test_flag(mtp3_route, SNGSS7_FLAG_CONFIGURED)) { - SS7_DEBUG("MTP3 Self Route already configured\n"); - } else { - if (ftmod_ss7_configure_mtp3_route(0)) { - SS7_ERROR("Failed to configure MTP3 Route = SelfRoute\n!"); - return FTDM_FAIL; - } else { - SS7_INFO("Successfully configured MTP3 Route = SelfRoute\n"); - sngss7_set_flag(mtp3_route, SNGSS7_FLAG_CONFIGURED); - } - } - - x=1; - mtp3_isup = &g_ftdm_sngss7_data.cfg.mtp3_isup[x]; - while (mtp3_isup->id != 0) { - if (sngss7_test_flag(mtp3_isup, SNGSS7_FLAG_CONFIGURED)) { - SS7_DEBUG("MTP3-ISUP interface already configured = %d\n", mtp3_isup->id); - } else { - if (ftmod_ss7_configure_mtp3_isup(x)) { - SS7_ERROR("Failed to configure MTP3-ISUP interface = %d\n!", mtp3_isup->id); - return FTDM_FAIL; - } else { - SS7_INFO("Successfully configured MTP3-ISUP interface = %d\n", mtp3_isup->id); - } - } - /* next link */ - x++; - mtp3_isup = &g_ftdm_sngss7_data.cfg.mtp3_isup[x]; - } /* while (g_ftdm_sngss7_data.cfg.mtp3_isup[x]->id != 0) */ - - /* ISUP *******************************************************************/ - x=1; - isup_mtp3 = &g_ftdm_sngss7_data.cfg.mtp3_isup[x]; - while (isup_mtp3->id != 0) { - if (sngss7_test_flag(isup_mtp3, SNGSS7_FLAG_CONFIGURED)) { - SS7_DEBUG("ISUP-MTP3 interface already configured = %d\n", isup_mtp3->id); - } else { - if (ftmod_ss7_configure_isup_mtp3(x)) { - SS7_ERROR("Failed to configure ISUP-MTP3 interface = %d\n!", isup_mtp3->id); - return FTDM_FAIL; - } else { - SS7_INFO("Successfully configured ISUP-MTP3 interface = %d\n", isup_mtp3->id); - sngss7_set_flag(isup_mtp3, SNGSS7_FLAG_CONFIGURED); - } - } - /* next link */ - x++; - isup_mtp3 = &g_ftdm_sngss7_data.cfg.mtp3_isup[x]; - } /* while (g_ftdm_sngss7_data.cfg.isup_mtp3[x]->id != 0) */ - - x=1; - isup_cc = &g_ftdm_sngss7_data.cfg.isup_cc[x]; - while (isup_cc->id != 0) { - if (sngss7_test_flag(isup_cc, SNGSS7_FLAG_CONFIGURED)) { - SS7_DEBUG("ISUP-CC interface already configured = %d\n", isup_cc->id); - } else { - if (ftmod_ss7_configure_isup_cc(x)) { - SS7_ERROR("Failed to configure ISUP-CC interface = %d\n!", isup_cc->id); - return FTDM_FAIL; - } else { - SS7_INFO("Successfully configured ISUP-CC interface = %d\n", isup_cc->id); - } - } - /* next link */ - x++; - isup_cc = &g_ftdm_sngss7_data.cfg.isup_cc[x]; - } /* while (g_ftdm_sngss7_data.cfg.isup_cc[x]->id != 0) */ - - x=1; - isup_interface = &g_ftdm_sngss7_data.cfg.isupInterface[x]; - while (isup_interface->id != 0) { - if (sngss7_test_flag(isup_interface, SNGSS7_FLAG_CONFIGURED)) { - SS7_DEBUG("ISUP interface already configured = %s\n", isup_interface->name); - } else { - if (ftmod_ss7_configure_isup_interface(x)) { - SS7_ERROR("Failed to configure ISUP interface = %s\n", isup_interface->name); - return FTDM_FAIL; - } else { - SS7_INFO("Successfully configured ISUP interface = %s\n", isup_interface->name); - sngss7_set_flag(isup_interface, SNGSS7_FLAG_CONFIGURED); - } - } - /* next link */ - x++; - isup_interface = &g_ftdm_sngss7_data.cfg.isupInterface[x]; - } /* while (g_ftdm_sngss7_data.cfg.isup_interface[x]->id != 0) */ - - x=1; - isup_circuit = &g_ftdm_sngss7_data.cfg.isupCircuit[x]; - while (isup_circuit->id != 0) { - if (isup_circuit->cic != 0) { - if (sngss7_test_flag(isup_circuit, SNGSS7_FLAG_CONFIGURED)) { - SS7_DEBUG("ISUP Circuit already configured = %d\n", isup_circuit->id); - } else { - if (ftmod_ss7_configure_isup_circuit(x)) { - SS7_ERROR("Failed to configure ISUP circuit = %d\n!", isup_circuit->id); - return FTDM_FAIL; - } else { - SS7_INFO("Successfully configured ISUP circuit = %d\n", isup_circuit->id); - sngss7_set_flag(isup_circuit, SNGSS7_FLAG_CONFIGURED); - } - } - } - /* next link */ - x++; - isup_circuit = &g_ftdm_sngss7_data.cfg.isupCircuit[x]; - } /* while (g_ftdm_sngss7_data.cfg.isup_circuit[x]->id != 0) */ - - /* CC *********************************************************************/ - - x=1; - cc_isup = &g_ftdm_sngss7_data.cfg.isup_cc[x]; - while (cc_isup->id != 0) { - if (sngss7_test_flag(cc_isup, SNGSS7_FLAG_CONFIGURED)) { - SS7_DEBUG("CC-ISUP interface already configured = %d\n", cc_isup->id); - } else { - if (ftmod_ss7_configure_cc_isup(x)) { - SS7_ERROR("Failed to configure CC-ISUP interface = %d\n!", cc_isup->id); - return FTDM_FAIL; - } else { - SS7_INFO("Successfully configured CC-ISUP interface = %d\n", cc_isup->id); - sngss7_set_flag(cc_isup, SNGSS7_FLAG_CONFIGURED); - } - } - /* next link */ - x++; - cc_isup = &g_ftdm_sngss7_data.cfg.isup_cc[x]; - } /* while (g_ftdm_sngss7_data.cfg.cc_isup[x]->id != 0) */ - - SS7_DEBUG("Finished LibSngSS7 configuration...\n"); - return FTDM_SUCCESS; -} + cntrl.hdr.msgType = TCNTRL; /* this is a control request */ + cntrl.hdr.entId.ent = ENTSI; + cntrl.hdr.entId.inst = S_INST; + cntrl.hdr.elmId.elmnt = STNSAP; -/******************************************************************************/ -static int ftmod_ss7_general_configuration(void) -{ + cntrl.t.cntrl.s.siElmnt.elmntId.sapId = suId; + cntrl.t.cntrl.s.siElmnt.elmntParam.nsap.nsapType = SAP_MTP; - if(sng_cfg_mtp1_gen(&g_ftdm_sngss7_data.cfg)) { - SS7_ERROR("General configuration for MTP1 failed!\n"); - return FTDM_FAIL; - } else { - SS7_INFO("General configuration for MTP1 was successful\n"); - } - - if(sng_cfg_mtp2_gen(&g_ftdm_sngss7_data.cfg)) { - SS7_ERROR("General configuration for MTP2 failed!\n"); - return FTDM_FAIL; - } else { - SS7_INFO("General configuration for MTP2 was successful\n"); - } - - if(sng_cfg_mtp3_gen(&g_ftdm_sngss7_data.cfg)) { - SS7_ERROR("General configuration for MTP3 failed!\n"); - return FTDM_FAIL; - } else { - SS7_INFO("General configuration for MTP3 was successful\n"); - } - - if(sng_cfg_isup_gen(&g_ftdm_sngss7_data.cfg)) { - SS7_ERROR("General configuration for ISUP failed!\n"); - return FTDM_FAIL; - } else { - SS7_INFO("General configuration for ISUP was successful\n"); - } - - if(sng_cfg_cc_gen(&g_ftdm_sngss7_data.cfg)) { - SS7_ERROR("General configuration for Call-Control failed!\n"); - return FTDM_FAIL; - } else { - SS7_INFO("General configuration for Call-Control was successful\n"); - } - - return FTDM_SUCCESS; -} -/******************************************************************************/ -static int ftmod_ss7_configure_mtp1_link(int id) -{ - if(sng_cfg_mtp1_link(&g_ftdm_sngss7_data.cfg, id)){ - return FTDM_FAIL; - } else { - return FTDM_SUCCESS; - } -} + cntrl.t.cntrl.action = ABND_ENA; /* bind and activate */ + cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ -/******************************************************************************/ -static int ftmod_ss7_configure_mtp2_link(int id) -{ - if(sng_cfg_mtp2_link(&g_ftdm_sngss7_data.cfg, id)){ - return FTDM_FAIL; - } else { - return FTDM_SUCCESS; - } + return (sng_cntrl_isup(&pst, &cntrl)); } /******************************************************************************/ -static int ftmod_ss7_configure_mtp3_link(int id) +static int ftmod_ss7_enable_mtpLinkSet(int lnkSetId) { - if(sng_cfg_mtp3_link(&g_ftdm_sngss7_data.cfg, id)){ - return FTDM_FAIL; - } else { - return FTDM_SUCCESS; - } -} + SnMngmt cntrl; + Pst pst; -/******************************************************************************/ -static int ftmod_ss7_configure_mtp3_linkset(int id) -{ - if(sng_cfg_mtp3_linkset(&g_ftdm_sngss7_data.cfg, id)){ - return FTDM_FAIL; - } else { - return FTDM_SUCCESS; - } -} + /* initalize the post structure */ + smPstInit(&pst); -/******************************************************************************/ -static int ftmod_ss7_configure_mtp3_route(int id) -{ - if(sng_cfg_mtp3_route(&g_ftdm_sngss7_data.cfg, id)){ - return FTDM_FAIL; - } else { - return FTDM_SUCCESS; - } -} + /* insert the destination Entity */ + pst.dstEnt = ENTSN; -/******************************************************************************/ -static int ftmod_ss7_configure_mtp3_isup(int id) -{ - if(sng_cfg_mtp3_isup_interface(&g_ftdm_sngss7_data.cfg, id)){ - return FTDM_FAIL; - } else { - return FTDM_SUCCESS; - } -} + /* initalize the control structure */ + memset(&cntrl, 0x0, sizeof(SnMngmt)); -/******************************************************************************/ -static int ftmod_ss7_configure_isup_mtp3(int id) -{ - if(sng_cfg_isup_mtp3_interface(&g_ftdm_sngss7_data.cfg, id)){ - return FTDM_FAIL; - } else { - return FTDM_SUCCESS; - } -} + /* initalize the control header */ + smHdrInit(&cntrl.hdr); -/******************************************************************************/ -static int ftmod_ss7_configure_isup_interface(int id) -{ - if(sng_cfg_isup_interface(&g_ftdm_sngss7_data.cfg, id)){ - return FTDM_FAIL; - } else { - return FTDM_SUCCESS; - } -} + cntrl.hdr.msgType = TCNTRL; /* this is a control request */ + cntrl.hdr.entId.ent = ENTSN; + cntrl.hdr.entId.inst = S_INST; + cntrl.hdr.elmId.elmnt = STLNKSET; + cntrl.hdr.elmId.elmntInst1 = lnkSetId; /* this is the linkset to bind */ -/******************************************************************************/ -static int ftmod_ss7_configure_isup_circuit(int id) -{ - if(sng_cfg_isup_circuit(&g_ftdm_sngss7_data.cfg, id)){ - return FTDM_FAIL; - } else { - return FTDM_SUCCESS; - } + cntrl.t.cntrl.action = ABND_ENA; /* bind and activate */ + cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ + + return (sng_cntrl_mtp3(&pst, &cntrl)); } /******************************************************************************/ -static int ftmod_ss7_configure_isup_cc(int id) +int ftmod_ss7_inhibit_mtplink(uint32_t id) { - if(sng_cfg_isup_cc_interface(&g_ftdm_sngss7_data.cfg, id)){ - return FTDM_FAIL; - } else { - return FTDM_SUCCESS; - } + SnMngmt cntrl; + Pst pst; + + /* initalize the post structure */ + smPstInit(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTSN; + + /* initalize the control structure */ + memset(&cntrl, 0x0, sizeof(SnMngmt)); + + /* initalize the control header */ + smHdrInit(&cntrl.hdr); + + cntrl.hdr.msgType = TCNTRL; /* this is a control request */ + cntrl.hdr.entId.ent = ENTSN; + cntrl.hdr.entId.inst = S_INST; + cntrl.hdr.elmId.elmnt = STDLSAP; + cntrl.hdr.elmId.elmntInst1 = id; /* the DSLAP to inhibit */ + + cntrl.t.cntrl.action = AINH; /* Inhibit */ + cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ + + return (sng_cntrl_mtp3(&pst, &cntrl)); } /******************************************************************************/ -static int ftmod_ss7_configure_cc_isup(int id) +int ftmod_ss7_uninhibit_mtplink(uint32_t id) { - if(sng_cfg_cc_isup_interface(&g_ftdm_sngss7_data.cfg, id)){ - return FTDM_FAIL; - } else { - return FTDM_SUCCESS; - } -} + SnMngmt cntrl; + Pst pst; + + /* initalize the post structure */ + smPstInit(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTSN; + + /* initalize the control structure */ + memset(&cntrl, 0x0, sizeof(SnMngmt)); + /* initalize the control header */ + smHdrInit(&cntrl.hdr); + + cntrl.hdr.msgType = TCNTRL; /* this is a control request */ + cntrl.hdr.entId.ent = ENTSN; + cntrl.hdr.entId.inst = S_INST; + cntrl.hdr.elmId.elmnt = STDLSAP; + cntrl.hdr.elmId.elmntInst1 = id; /* the DSLAP to inhibit */ + + cntrl.t.cntrl.action = AUNINH; /* Inhibit */ + cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ + + return (sng_cntrl_mtp3(&pst, &cntrl)); +} /******************************************************************************/ /* For Emacs: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c index b947bc7..98554db 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c @@ -62,1401 +62,1593 @@ static ftdm_status_t handle_cot_stop(uint32_t suInstId, uint32_t spInstId, uint3 static ftdm_status_t handle_cot(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); static ftdm_status_t handle_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_local_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +static ftdm_status_t handle_local_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); static ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +static ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +static ftdm_status_t handle_grs_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); + static ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); static ftdm_status_t handle_blo_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); static ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); static ftdm_status_t handle_ubl_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); -static ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); - +static ftdm_status_t handle_local_blk(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +static ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); +static ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); /******************************************************************************/ /* FUNCTIONS ******************************************************************/ void sngss7_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; - }; - - SS7_MSG_TRACE("Received IAM on CIC # %d\n", sngss7_info->circuit->cic); - - /* check whether the ftdm channel is in a state to accept a call */ - switch (ftdmchan->state) { - /**************************************************************************/ - case (FTDM_CHANNEL_STATE_DOWN): /* only state it is fully valid to get IAM */ - - /* fill in the channels SS7 Stack information */ - sngss7_info->suInstId = get_unique_id(); - sngss7_info->spInstId = spInstId; - - /* try to open the ftdm channel */ - if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { - SS7_ERROR("Failed to open span: %d, chan: %d\n", - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id); - - /* set the flag to indicate this hangup is started from the local side */ - sngss7_set_flag(sngss7_info, FLAG_LOCAL_REL); - - ftdmchan->caller_data.hangup_cause = 41; - - /* move the state to CANCEL */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); - - } else { - - /* fill in cid/ani number */ - if (siConEvnt->cgPtyNum.addrSig.pres) { - copy_tknStr_from_sngss7(siConEvnt->cgPtyNum.addrSig, - ftdmchan->caller_data.cid_num.digits, - siConEvnt->cgPtyNum.oddEven); - - /* fill in cid Name */ - ftdm_set_string(ftdmchan->caller_data.cid_name, ftdmchan->caller_data.cid_num.digits); - - ftdm_set_string(ftdmchan->caller_data.ani.digits, ftdmchan->caller_data.cid_num.digits); - - } else { - SS7_INFO("No Calling party (ANI) information in IAM!\n"); - } - - /* fill in dnis */ - if (siConEvnt->cdPtyNum.addrSig.pres) { - copy_tknStr_from_sngss7(siConEvnt->cdPtyNum.addrSig, - ftdmchan->caller_data.dnis.digits, - siConEvnt->cdPtyNum.oddEven); - } else { - SS7_INFO("No Called party (DNIS) information in IAM!\n"); - } - - /* fill in rdnis */ - if (siConEvnt->redirgNum.addrSig.pres) { - copy_tknStr_from_sngss7(siConEvnt->redirgNum.addrSig, - ftdmchan->caller_data.rdnis.digits, - siConEvnt->cgPtyNum.oddEven); - } else { - SS7_INFO("No RDNIS party information in IAM!\n"); - } - - /* fill in screening/presentation */ - ftdmchan->caller_data.screen = siConEvnt->cgPtyNum.scrnInd.val; - ftdmchan->caller_data.pres = siConEvnt->cgPtyNum.presRest.val; - - /* set the state of the channel to collecting...the rest is done by the chan monitor */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); - - } /* if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) */ - - break; - /**************************************************************************/ - case (FTDM_CHANNEL_STATE_DIALING): /* glare */ - SS7_ERROR("Got IAM in DIALING state...glare!\n"); - - /* the flag the channel as having a collision */ - sngss7_set_flag(sngss7_info, FLAG_GLARE); - - /* save the IAM for processing once the channel has gone to DOWN */ - memcpy(&sngss7_info->glare.iam, siConEvnt, sizeof(*siConEvnt)); - sngss7_info->glare.suInstId = suInstId; - sngss7_info->glare.spInstId = spInstId; - sngss7_info->glare.circuit = circuit; - SS7_DEBUG("Queuing incoming cal request on Circuit = %d (CIC # %d\n", - sngss7_info->glare.circuit, - sngss7_info->circuit->cic); - - break; - /**************************************************************************/ - default: /* should not have gotten an IAM while in this state */ - SS7_ERROR("Got IAM in an invalid state (%s) on span=%d, chan=%d!\n", - ftdm_channel_state2str(ftdmchan->state), - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id); - - /* move the state of the channel to RESTART to force a reset */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - - break; - /**************************************************************************/ - } /* switch (ftdmchan->state) */ - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + + sngss7_chan_data_t *sngss7_info ; + ftdm_channel_t *ftdmchan; + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + SS7_ASSERT; + }; + + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx IAM\n"); + + /* check if the circuit has a remote block */ + if ((sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) || + (sngss7_test_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX)) || + (sngss7_test_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX))) { + + /* as per Q.764, 2.8.2.3 xiv ... remove the block from this channel */ + sngss7_clear_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX); + sngss7_clear_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX); + sngss7_clear_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX); + + /* KONRAD FIX ME : check in case there is a ckt and grp block */ + } + + /* check whether the ftdm channel is in a state to accept a call */ + switch (ftdmchan->state) { + /**************************************************************************/ + case (FTDM_CHANNEL_STATE_DOWN): /* only state it is fully valid to get IAM */ + + /* fill in the channels SS7 Stack information */ + sngss7_info->suInstId = get_unique_id(); + sngss7_info->spInstId = spInstId; + + /* try to open the ftdm channel */ + if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { + SS7_ERROR("Failed to open span: %d, chan: %d\n", + ftdmchan->physical_span_id, + ftdmchan->physical_chan_id); + + /* set the flag to indicate this hangup is started from the local side */ + sngss7_set_flag(sngss7_info, FLAG_LOCAL_REL); + + ftdmchan->caller_data.hangup_cause = 41; + + /* move the state to CANCEL */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); + + } else { + + /* fill in cid/ani number */ + if (siConEvnt->cgPtyNum.addrSig.pres) { + copy_tknStr_from_sngss7(siConEvnt->cgPtyNum.addrSig, + ftdmchan->caller_data.cid_num.digits, + siConEvnt->cgPtyNum.oddEven); + + /* fill in cid Name */ + ftdm_set_string(ftdmchan->caller_data.cid_name, ftdmchan->caller_data.cid_num.digits); + + ftdm_set_string(ftdmchan->caller_data.ani.digits, ftdmchan->caller_data.cid_num.digits); + + } else { + SS7_INFO("No Calling party (ANI) information in IAM!\n"); + } + + /* fill in dnis */ + if (siConEvnt->cdPtyNum.addrSig.pres) { + copy_tknStr_from_sngss7(siConEvnt->cdPtyNum.addrSig, + ftdmchan->caller_data.dnis.digits, + siConEvnt->cdPtyNum.oddEven); + } else { + SS7_INFO("No Called party (DNIS) information in IAM!\n"); + } + + /* fill in rdnis */ + if (siConEvnt->redirgNum.addrSig.pres) { + copy_tknStr_from_sngss7(siConEvnt->redirgNum.addrSig, + ftdmchan->caller_data.rdnis.digits, + siConEvnt->cgPtyNum.oddEven); + } else { + SS7_INFO("No RDNIS party information in IAM!\n"); + } + + /* fill in screening/presentation */ + ftdmchan->caller_data.screen = siConEvnt->cgPtyNum.scrnInd.val; + ftdmchan->caller_data.pres = siConEvnt->cgPtyNum.presRest.val; + + /* set the state of the channel to collecting...the rest is done by the chan monitor */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_COLLECT); + + } /* if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) */ + + break; + /**************************************************************************/ + default: /* should not have gotten an IAM while in this state */ + SS7_ERROR("Got IAM in an invalid state (%s) on span=%d, chan=%d!\n", + ftdm_channel_state2str(ftdmchan->state), + ftdmchan->physical_span_id, + ftdmchan->physical_chan_id); + + /* move the state of the channel to RESTART to force a reset */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + + break; + /**************************************************************************/ + } /* switch (ftdmchan->state) */ + + /* unlock the channel */ + ftdm_mutex_unlock(ftdmchan->mutex); + + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; } /******************************************************************************/ void sngss7_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); + SS7_FUNC_TRACE_ENTER(__FUNCTION__); - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; + sngss7_chan_data_t *sngss7_info ; + ftdm_channel_t *ftdmchan; - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; - } + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; - }; + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + SS7_ASSERT; + }; - SS7_MSG_TRACE("Received ANM on CIC # %d\n", sngss7_info->circuit->cic); - /* check whether the ftdm channel is in a state to accept a call */ - switch (ftdmchan->state) { - /**************************************************************************/ - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: + /* check whether the ftdm channel is in a state to accept a call */ + switch (ftdmchan->state) { + /**************************************************************************/ + case FTDM_CHANNEL_STATE_PROGRESS: + case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - /* go to UP */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx ANM\n"); - break; - /**************************************************************************/ - default: /* incorrect state...reset the CIC */ + /* go to UP */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); - /* go to RESTART */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); + break; + /**************************************************************************/ + case FTDM_CHANNEL_STATE_DIALING: - break; - /**************************************************************************/ - } + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CON\n"); - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* go to UP */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_UP); + + break; + /**************************************************************************/ + default: /* incorrect state...reset the CIC */ - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx ANM/CON\n"); + + /* throw the TX reset flag */ + sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX); + + /* go to RESTART */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + + break; + /**************************************************************************/ + } + + /* unlock the channel */ + ftdm_mutex_unlock(ftdmchan->mutex); + + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; } /******************************************************************************/ void sngss7_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCnStEvnt *siCnStEvnt, uint8_t evntType) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; - } - - switch (evntType) { - /**************************************************************************/ - case (ADDRCMPLT): - SS7_MSG_TRACE("Received ACM on CIC # %d\n", sngss7_info->circuit->cic); - switch (ftdmchan->state) { - /**********************************************************************/ - case FTDM_CHANNEL_STATE_DIALING: - /* KONRAD: should we confirm the instance ids ? */ - - /* need to grab the sp instance id */ - sngss7_info->spInstId = spInstId; - - /* go to PROGRESS */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); - break; - /**********************************************************************/ - default: /* incorrect state...reset the CIC */ - /* go to RESTART */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); - break; - /**********************************************************************/ - } /* switch (ftdmchan->state) */ - /**************************************************************************/ - case (MODIFY): - SS7_MSG_TRACE("Received MODIFY on CIC # %d\n", sngss7_info->circuit->cic); - break; - /**************************************************************************/ - case (MODCMPLT): - SS7_MSG_TRACE( "Received MODIFY_COMPLETE on circuit # %d\n", circuit); - break; - /**************************************************************************/ - case (MODREJ): - SS7_MSG_TRACE( "Received MODIFY_REJECT on circuit # %d\n", circuit); - break; - /**************************************************************************/ - case (PROGRESS): - SS7_MSG_TRACE( "Received CPG on circuit # %d\n", circuit); - break; - /**************************************************************************/ - case (FRWDTRSFR): - SS7_MSG_TRACE( "Received FOT on circuit # %d\n", circuit); - break; - /**************************************************************************/ - case (INFORMATION): - SS7_MSG_TRACE( "Received INF on circuit # %d\n", circuit); - break; - /**************************************************************************/ - case (INFORMATREQ): - SS7_MSG_TRACE( "Received INR on circuit # %d\n", circuit); - break; - /**************************************************************************/ - case (SUBSADDR): - SS7_MSG_TRACE( "Received SAM on circuit # %d\n", circuit); - break; - /**************************************************************************/ - case (EXIT): - SS7_MSG_TRACE( "Received EXIT on circuit # %d\n", circuit); - break; - /**************************************************************************/ - case (NETRESMGT): - SS7_MSG_TRACE( "Received NRM on circuit # %d\n", circuit); - break; - /**************************************************************************/ - case (IDENTREQ): - SS7_MSG_TRACE( "Received IDR on circuit # %d\n", circuit); - break; - /**************************************************************************/ - case (IDENTRSP): - SS7_MSG_TRACE( "Received IRS on circuit # %d\n", circuit); - break; - /**************************************************************************/ - case (MALCLLPRNT): - SS7_MSG_TRACE( "Received MALICIOUS CALL on circuit # %d\n", circuit); - break; - /**************************************************************************/ - case (CHARGE): - SS7_MSG_TRACE( "Received CRG on circuit # %d\n", circuit); - break; - /**************************************************************************/ - case (TRFFCHGE): - SS7_MSG_TRACE( "Received CRG-Tariff Change on circuit # %d\n", circuit); - break; - /**************************************************************************/ - case (CHARGEACK): - SS7_MSG_TRACE( "Received CRG-Acknowledge on circuit # %d\n", circuit); - break; - /**************************************************************************/ - case (CALLOFFMSG): - SS7_MSG_TRACE( "Received CALL_OFFER on circuit # %d\n", circuit); - break; - /**************************************************************************/ - case (LOOPPRVNT): - SS7_MSG_TRACE( "Received LOP on circuit # %d\n", circuit); - break; - /**************************************************************************/ - case (TECT_TIMEOUT): - SS7_MSG_TRACE( "Received ECT Timeout on circuit # %d\n", circuit); - break; - /**************************************************************************/ - case (RINGSEND): - SS7_MSG_TRACE( "Received Ringing Send on circuit # %d\n", circuit); - break; - /**************************************************************************/ - case (CALLCLEAR): - SS7_MSG_TRACE( "Received Call_Line_clear on circuit # %d\n", circuit); - break; - /**************************************************************************/ - case (PRERELEASE): - SS7_MSG_TRACE( "Received PRI on circuit # %d\n", circuit); - break; - /**************************************************************************/ - case (APPTRANSPORT): - SS7_MSG_TRACE( "Received APM on circuit # %d\n", circuit); - break; - /**************************************************************************/ - case (OPERATOR): - SS7_MSG_TRACE( "Received Operator on circuit # %d\n", circuit); - break; - /**************************************************************************/ - case (METPULSE): - SS7_MSG_TRACE( "Received Metering Pulse on circuit # %d\n", circuit); - break; - /**************************************************************************/ - case (CLGPTCLR): - SS7_MSG_TRACE( "Received Calling_Party_Clear on circuit # %d\n", circuit); - break; - /**************************************************************************/ - case (SUBDIRNUM): - SS7_MSG_TRACE( "Received subsequent directory number on circuit # %d\n", circuit); - break; - /**************************************************************************/ - default: - ftdm_log(FTDM_LOG_ERROR, "Received Unknown message on circuit # %d\n", circuit); - break; - /**************************************************************************/ - } - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + + sngss7_chan_data_t *sngss7_info ; + ftdm_channel_t *ftdmchan; + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + SS7_ASSERT; + } + + switch (evntType) { + /**************************************************************************/ + case (ADDRCMPLT): + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx ACM\n"); + switch (ftdmchan->state) { + /**********************************************************************/ + case FTDM_CHANNEL_STATE_DIALING: + /* KONRAD: should we confirm the instance ids ? */ + + /* need to grab the sp instance id */ + sngss7_info->spInstId = spInstId; + + /* go to PROGRESS */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); + break; + /**********************************************************************/ + default: /* incorrect state...reset the CIC */ + /* go to RESTART */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS); + break; + /**********************************************************************/ + } /* switch (ftdmchan->state) */ + /**************************************************************************/ + case (MODIFY): + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx MODIFY\n"); + break; + /**************************************************************************/ + case (MODCMPLT): + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx MODIFY-COMPLETE\n"); + break; + /**************************************************************************/ + case (MODREJ): + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx MODIFY-REJECT\n"); + break; + /**************************************************************************/ + case (PROGRESS): + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CPG\n"); + break; + /**************************************************************************/ + case (FRWDTRSFR): + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx FOT\n"); + break; + /**************************************************************************/ + case (INFORMATION): + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx INF\n"); + break; + /**************************************************************************/ + case (INFORMATREQ): + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx INR\n"); + break; + /**************************************************************************/ + case (SUBSADDR): + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx SAM\n"); + break; + /**************************************************************************/ + case (EXIT): + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx EXIT\n"); + break; + /**************************************************************************/ + case (NETRESMGT): + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx NRM\n"); + break; + /**************************************************************************/ + case (IDENTREQ): + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx IDR\n"); + break; + /**************************************************************************/ + case (IDENTRSP): + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx IRS\n"); + break; + /**************************************************************************/ + case (MALCLLPRNT): + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx MALICIOUS CALL\n"); + break; + /**************************************************************************/ + case (CHARGE): + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CRG\n"); + break; + /**************************************************************************/ + case (TRFFCHGE): + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CRG-TARIFF\n"); + break; + /**************************************************************************/ + case (CHARGEACK): + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CRG-ACK\n"); + break; + /**************************************************************************/ + case (CALLOFFMSG): + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CALL-OFFER\n"); + break; + /**************************************************************************/ + case (LOOPPRVNT): + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx LOP\n"); + break; + /**************************************************************************/ + case (TECT_TIMEOUT): + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx ECT-Timeout\n"); + break; + /**************************************************************************/ + case (RINGSEND): + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx RINGING-SEND\n"); + break; + /**************************************************************************/ + case (CALLCLEAR): + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CALL-LINE Clear\n"); + break; + /**************************************************************************/ + case (PRERELEASE): + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx PRI\n"); + break; + /**************************************************************************/ + case (APPTRANSPORT): + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx APM\n"); + break; + /**************************************************************************/ + case (OPERATOR): + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx OPERATOR\n"); + break; + /**************************************************************************/ + case (METPULSE): + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx METERING-PULSE\n"); + break; + /**************************************************************************/ + case (CLGPTCLR): + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CALLING_PARTY_CLEAR\n"); + break; + /**************************************************************************/ + case (SUBDIRNUM): + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx SUB-DIR\n"); + break; + /**************************************************************************/ + default: + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Unknown Msg\n"); + break; + /**************************************************************************/ + } + + /* unlock the channel */ + ftdm_mutex_unlock(ftdmchan->mutex); + + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; } /******************************************************************************/ void sngss7_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); + SS7_FUNC_TRACE_ENTER(__FUNCTION__); - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; + sngss7_chan_data_t *sngss7_info ; + ftdm_channel_t *ftdmchan; - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; - } + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; - }; + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + SS7_ASSERT; + }; - SS7_MSG_TRACE("Received REL on CIC # %d\n", sngss7_info->circuit->cic); + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx REL\n"); - /* check whether the ftdm channel is in a state to release a call */ - switch (ftdmchan->state) { - /**************************************************************************/ - case FTDM_CHANNEL_STATE_RING: - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - case FTDM_CHANNEL_STATE_UP: + /* check whether the ftdm channel is in a state to release a call */ + switch (ftdmchan->state) { + /**************************************************************************/ + case FTDM_CHANNEL_STATE_DIALING: + + /* pass the release code up to FTDM */ + if (siRelEvnt->causeDgn.causeVal.pres) { + ftdmchan->caller_data.hangup_cause = siRelEvnt->causeDgn.causeVal.val; + } else { + SS7_ERROR("REL does not have a cause code!\n"); + ftdmchan->caller_data.hangup_cause = 0; + } - /* pass the release code up to FTDM */ - if (siRelEvnt->causeDgn.causeVal.pres) { - ftdmchan->caller_data.hangup_cause = siRelEvnt->causeDgn.causeVal.val; - } else { - SS7_ERROR("REL does not have a cause code!\n"); - ftdmchan->caller_data.hangup_cause = 0; - } + /* this is a remote hangup request */ + sngss7_set_flag(sngss7_info, FLAG_REMOTE_REL); - /* move the state of the channel to TERMINATING to end the call */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + /* move the state of the channel to CANCEL to end the call */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_DIALING: + break; + /**************************************************************************/ + case FTDM_CHANNEL_STATE_RING: + case FTDM_CHANNEL_STATE_PROGRESS: + case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: + case FTDM_CHANNEL_STATE_UP: + + /* pass the release code up to FTDM */ + if (siRelEvnt->causeDgn.causeVal.pres) { + ftdmchan->caller_data.hangup_cause = siRelEvnt->causeDgn.causeVal.val; + } else { + SS7_ERROR("REL does not have a cause code!\n"); + ftdmchan->caller_data.hangup_cause = 0; + } - /* pass the release code up to FTDM */ - if (siRelEvnt->causeDgn.causeVal.pres) { - ftdmchan->caller_data.hangup_cause = siRelEvnt->causeDgn.causeVal.val; - } else { - SS7_ERROR("REL does not have a cause code!\n"); - ftdmchan->caller_data.hangup_cause = 0; - } + /* this is a remote hangup request */ + sngss7_set_flag(sngss7_info, FLAG_REMOTE_REL); - /* move the state of the channel to TERMINATING to end the call */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); + /* move the state of the channel to TERMINATING to end the call */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); break; /**************************************************************************/ - default: + default: - /* fill in the channels SS7 Stack information */ - sngss7_info->suInstId = get_unique_id(); - sngss7_info->spInstId = spInstId; + /* fill in the channels SS7 Stack information */ + sngss7_info->suInstId = get_unique_id(); + sngss7_info->spInstId = spInstId; - /* throw the reset flag */ - sngss7_set_flag(sngss7_info, FLAG_RESET_RX); + /* throw the reset flag */ + sngss7_set_flag(sngss7_info, FLAG_RESET_RX); - /* set the state to RESTART */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - break; - /**************************************************************************/ - } /* switch (ftdmchan->state) */ + /* set the state to RESTART */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + break; + /**************************************************************************/ + } /* switch (ftdmchan->state) */ - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* unlock the channel */ + ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; } /******************************************************************************/ void sngss7_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRelEvnt *siRelEvnt) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; - }; - - SS7_MSG_TRACE("Received RLC on CIC # %d\n", sngss7_info->circuit->cic); - - /* check whether the ftdm channel is in a state to accept a call */ - switch (ftdmchan->state) { - /**************************************************************************/ - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - - /* go to DOWN */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_DOWN: - /* do nothing, just drop the message */ - break; - /**************************************************************************/ - default: - /* KONRAD: should just stop the call...but a reset is easier for now (since it does hangup the call) */ - - /* go to RESTART */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - - break; - /**************************************************************************/ - } - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + + sngss7_chan_data_t *sngss7_info ; + ftdm_channel_t *ftdmchan; + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + SS7_ASSERT; + }; + + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx RLC\n"); + + /* check whether the ftdm channel is in a state to accept a call */ + switch (ftdmchan->state) { + /**************************************************************************/ + case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: + + /* go to DOWN */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + + break; + /**************************************************************************/ + case FTDM_CHANNEL_STATE_DOWN: + /* do nothing, just drop the message */ + break; + /**************************************************************************/ + default: + /* KONRAD: should just stop the call...but a reset is easier for now (since it does hangup the call) */ + + /* go to RESTART */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + + break; + /**************************************************************************/ + } + + /* unlock the channel */ + ftdm_mutex_unlock(ftdmchan->mutex); + + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; } /******************************************************************************/ void sngss7_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiInfoEvnt *siInfoEvnt) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - SS7_MSG_TRACE( "Received DATA indication on circuit # %d\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + + sngss7_chan_data_t *sngss7_info ; + ftdm_channel_t *ftdmchan; + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + SS7_ASSERT; + }; + + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx DATA IND\n"); + + /* unlock the channel */ + ftdm_mutex_unlock(ftdmchan->mutex); + + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; } /******************************************************************************/ void sngss7_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - SS7_MSG_TRACE( "Received FAC request on circuit # %d\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + + sngss7_chan_data_t *sngss7_info ; + ftdm_channel_t *ftdmchan; + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + SS7_ASSERT; + }; + + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx FAC\n"); + + /* unlock the channel */ + ftdm_mutex_unlock(ftdmchan->mutex); + + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; } /******************************************************************************/ void sngss7_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t evntType, SiFacEvnt *siFacEvnt) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - SS7_MSG_TRACE( "Received FAC confirm on circuit # %d\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + + sngss7_chan_data_t *sngss7_info ; + ftdm_channel_t *ftdmchan; + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + SS7_ASSERT; + }; + + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx FAC-CON\n"); + + /* unlock the channel */ + ftdm_mutex_unlock(ftdmchan->mutex); + + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; } /******************************************************************************/ void sngss7_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + + sngss7_chan_data_t *sngss7_info ; + ftdm_channel_t *ftdmchan; + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } - SS7_MSG_TRACE( "Received User to User message on circuit # %d\n", circuit); + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + SS7_ASSERT; + }; + + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx USER-USER msg\n"); + + /* unlock the channel */ + ftdm_mutex_unlock(ftdmchan->mutex); + + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; } /* GENERAL STATUS *************************************************************/ void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - SS7_MSG_TRACE("[SNG-CC] Received %s indicaton on cic = %d\n", - DECODE_LCC_EVENT(evntType), - g_ftdm_sngss7_data.cfg.isupCircuit[circuit].cic); - - switch (evntType) { - /**************************************************************************/ - case SIT_STA_REATTEMPT: /* reattempt indication */ - handle_reattempt(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_ERRORIND: /* error indication */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CONTCHK: /* continuity check */ - handle_cot_start(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CONTREP: /* continuity report */ - handle_cot(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_STPCONTIN: /* stop continuity */ - handle_cot_stop(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CGQRYRSP: /* circuit grp query response from far end forwarded to upper layer by ISUP */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CONFUSION: /* confusion */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_LOOPBACKACK: /* loop-back acknowledge */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CIRRSRVREQ: /* circuit reservation request */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CIRRSRVACK: /* circuit reservation acknowledgement */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CIRBLOREQ: /* circuit blocking request */ - handle_blo_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRBLORSP: /* circuit blocking response */ - handle_blo_rsp(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRUBLREQ: /* circuit unblocking request */ - handle_ubl_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRUBLRSP: /* circuit unblocking response */ - handle_ubl_rsp(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRRESREQ: /* circuit reset request - RSC */ - handle_rsc_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRLOCRES: /* reset initiated locally by the software */ - handle_local_rsc_rsp(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRRESRSP: /* circuit reset response */ - handle_rsc_rsp(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CGBREQ: /* CGB request */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CGUREQ: /* CGU request */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CGQRYREQ: /* circuit group query request */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CGBRSP: /* mntc. oriented CGB response */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CGURSP: /* mntc. oriented CGU response */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_GRSREQ: /* circuit group reset request */ - handle_grs_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_CIRUNEQPD: /* circuit unequipped indication */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_GRSRSP: /* circuit group reset response */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_PAUSEIND: /* pause indication */ - handle_pause(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_RESUMEIND: /* resume indication */ - handle_resume(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); - break; - /**************************************************************************/ - case SIT_STA_USRPARTA: /* user part available */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_RMTUSRUNAV: /* remote user not available */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_MTPCONG0: /* congestion indication level 0 */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_MTPCONG1: /* congestion indication level 1 */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_MTPCONG2: /* congestion indication level 2 */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_MTPCONG3: /* congestion indication level 3 */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_MTPSTPCONG: /* stop congestion indication level 0 */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CIRLOCALBLOIND: /* Mngmt local blocking */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CIRLOCALUBLIND: /* Mngmt local unblocking */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_OVERLOAD: /* Overload */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_LMCGBREQ: /* when LM requests ckt grp blocking */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_LMCGUREQ: /* when LM requests ckt grp unblocking */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_LMGRSREQ: /* when LM requests ckt grp reset */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CGBINFOIND: /* circuit grp blking ind , no resp req */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_LMCQMINFOREQ: /* when LM requests ckt grp query */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_CIRLOCGRS: /* group reset initiated locally by the software */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_GRSRSPIND: /* indication to IW to idle the RM */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - case SIT_STA_RLCIND: /* RLC indicattion to IW to idle the RM */ - SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); - break; - /**************************************************************************/ - default: - SS7_INFO("[SNG-CC] Received Unknown indication %d\n", evntType); - break; - } /* switch (evntType) */ - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + sngss7_chan_data_t *sngss7_info ; + ftdm_channel_t *ftdmchan; + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + + switch (evntType) { + /**************************************************************************/ + case SIT_STA_REATTEMPT: /* reattempt indication */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Reattempt indication\n"); + handle_reattempt(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); + break; + /**************************************************************************/ + case SIT_STA_ERRORIND: /* error indication */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Error indication\n"); + SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + break; + /**************************************************************************/ + case SIT_STA_CONTCHK: /* continuity check */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx COT start\n"); + handle_cot_start(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); + break; + /**************************************************************************/ + case SIT_STA_CONTREP: /* continuity report */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx COT report\n"); + handle_cot(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); + break; + /**************************************************************************/ + case SIT_STA_STPCONTIN: /* stop continuity */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx COT stop\n"); + handle_cot_stop(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); + break; + /**************************************************************************/ + case SIT_STA_CGQRYRSP: /* circuit grp query response from far end forwarded to upper layer by ISUP */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CQM\n"); + SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + break; + /**************************************************************************/ + case SIT_STA_CONFUSION: /* confusion */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CFN\n"); + SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + break; + /**************************************************************************/ + case SIT_STA_LOOPBACKACK: /* loop-back acknowledge */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx LPA\n"); + SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + break; + /**************************************************************************/ + case SIT_STA_CIRRSRVREQ: /* circuit reservation request */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Ckt Resveration req\n"); + SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + break; + /**************************************************************************/ + case SIT_STA_CIRRSRVACK: /* circuit reservation acknowledgement */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Ckt Res ack\n"); + SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + break; + /**************************************************************************/ + case SIT_STA_CIRBLOREQ: /* circuit blocking request */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx BLO\n"); + handle_blo_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); + break; + /**************************************************************************/ + case SIT_STA_CIRBLORSP: /* circuit blocking response */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx BLA\n"); + handle_blo_rsp(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); + break; + /**************************************************************************/ + case SIT_STA_CIRUBLREQ: /* circuit unblocking request */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx UBL\n"); + handle_ubl_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); + break; + /**************************************************************************/ + case SIT_STA_CIRUBLRSP: /* circuit unblocking response */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx UBA\n"); + handle_ubl_rsp(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); + break; + /**************************************************************************/ + case SIT_STA_CIRRESREQ: /* circuit reset request - RSC */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx RSC\n"); + handle_rsc_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); + break; + /**************************************************************************/ + case SIT_STA_CIRLOCRES: /* reset initiated locally by the software */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Local RSC\n"); + handle_local_rsc_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); + break; + /**************************************************************************/ + case SIT_STA_CIRRESRSP: /* circuit reset response */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx RSC-RLC\n"); + handle_rsc_rsp(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); + break; + /**************************************************************************/ + case SIT_STA_CGBREQ: /* CGB request */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CGB\n"); + SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + break; + /**************************************************************************/ + case SIT_STA_CGUREQ: /* CGU request */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CGU\n"); + SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + break; + /**************************************************************************/ + case SIT_STA_CGQRYREQ: /* circuit group query request */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CQM\n"); + SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + break; + /**************************************************************************/ + case SIT_STA_CGBRSP: /* mntc. oriented CGB response */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx mntc CGB\n"); + SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + break; + /**************************************************************************/ + case SIT_STA_CGURSP: /* mntc. oriented CGU response */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx mntc CGU\n"); + SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + break; + /**************************************************************************/ + case SIT_STA_GRSREQ: /* circuit group reset request */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx GRS\n"); + handle_grs_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); + break; + /**************************************************************************/ + case SIT_STA_CIRUNEQPD: /* circuit unequipped indication */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx UCIC\n"); + handle_ucic(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); + break; + /**************************************************************************/ + case SIT_STA_GRSRSP: /* circuit group reset response */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx GRA\n"); + handle_grs_rsp(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); + break; + /**************************************************************************/ + case SIT_STA_PAUSEIND: /* pause indication */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx SUS\n"); + handle_pause(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); + break; + /**************************************************************************/ + case SIT_STA_RESUMEIND: /* resume indication */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx RES\n"); + handle_resume(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); + break; + /**************************************************************************/ + case SIT_STA_USRPARTA: /* user part available */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx UPA\n"); + SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + break; + /**************************************************************************/ + case SIT_STA_RMTUSRUNAV: /* remote user not available */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Remote User not Available\n"); + SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + break; + /**************************************************************************/ + case SIT_STA_MTPCONG0: /* congestion indication level 0 */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Congestion L0\n"); + SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + break; + /**************************************************************************/ + case SIT_STA_MTPCONG1: /* congestion indication level 1 */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Congestion L1\n"); + SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + break; + /**************************************************************************/ + case SIT_STA_MTPCONG2: /* congestion indication level 2 */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Congestion L2\n"); + SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + break; + /**************************************************************************/ + case SIT_STA_MTPCONG3: /* congestion indication level 3 */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Congestion L3\n"); + SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + break; + /**************************************************************************/ + case SIT_STA_MTPSTPCONG: /* stop congestion indication level 0 */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Stop Congestion\n"); + SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + break; + /**************************************************************************/ + case SIT_STA_CIRLOCALBLOIND: /* Mngmt local blocking */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Local BLO\n"); + handle_local_blk(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); + break; + /**************************************************************************/ + case SIT_STA_CIRLOCALUBLIND: /* Mngmt local unblocking */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Local UBL\n"); + handle_local_ubl(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); + break; + /**************************************************************************/ + case SIT_STA_OVERLOAD: /* Overload */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Overload\n"); + SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + break; + /**************************************************************************/ + case SIT_STA_LMCGBREQ: /* when LM requests ckt grp blocking */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx LM CGB\n"); + SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + break; + /**************************************************************************/ + case SIT_STA_LMCGUREQ: /* when LM requests ckt grp unblocking */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx LM CGU\n"); + SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + break; + /**************************************************************************/ + case SIT_STA_LMGRSREQ: /* when LM requests ckt grp reset */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx LM RSC\n"); + SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + break; + /**************************************************************************/ + case SIT_STA_CGBINFOIND: /* circuit grp blking ind , no resp req */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx CGB no resp req\n"); + SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + break; + /**************************************************************************/ + case SIT_STA_LMCQMINFOREQ: /* when LM requests ckt grp query */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx LM CQM\n"); + SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + break; + /**************************************************************************/ + case SIT_STA_CIRLOCGRS: /* group reset initiated locally by the software */ + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Rx Local GRS\n"); + SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); + break; + /**************************************************************************/ + default: + SS7_INFO("[SNG-CC] Received Unknown indication %d\n", evntType); + break; + } /* switch (evntType) */ + + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; } /******************************************************************************/ static ftdm_status_t handle_reattempt(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); + SS7_FUNC_TRACE_ENTER(__FUNCTION__); - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - }; + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + SS7_ASSERT; + }; - /* glare, throw the flag, go to down state*/ - sngss7_set_flag(sngss7_info, FLAG_GLARE); + /* glare, throw the flag, go to down state*/ + sngss7_set_flag(sngss7_info, FLAG_GLARE); - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_SUCCESS; } /******************************************************************************/ static ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + int infId; + int i; + + /* extract the affect infId from the circuit structure */ + infId = g_ftdm_sngss7_data.cfg.isupCkt[circuit].infId; + + /* go through all the circuits now and find any other circuits on this infId */ + i = 1; + while (g_ftdm_sngss7_data.cfg.isupCkt[i].id != 0) { + + /* check that the infId matches and that this is not a siglink */ + if ((g_ftdm_sngss7_data.cfg.isupCkt[i].infId == infId) && + (g_ftdm_sngss7_data.cfg.isupCkt[i].type == VOICE)) { + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + i++; + continue; + } + + /* lock the channel */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + i++; + SS7_ASSERT; + }; + + /* check if the circuit is fully started */ + if (ftdm_test_flag(ftdmchan->span, FTDM_SPAN_IN_THREAD)) { + /* set the pause flag on the channel */ + sngss7_set_flag(sngss7_info, FLAG_INFID_PAUSED); + + /* set the statet o SUSPENDED to bring the sig status down */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); + } + + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); + + } /* if (g_ftdm_sngss7_data.cfg.isupCkt[i].infId == infId) */ + + /* move to the next circuit */ + i++; + + } /* while (g_ftdm_sngss7_data.cfg.isupCkt[i].id != 0) */ + + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_SUCCESS; +} + +/******************************************************************************/ +static ftdm_status_t handle_resume(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +{ + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + int infId; + int i; + + /* extract the affect infId from the circuit structure */ + infId = g_ftdm_sngss7_data.cfg.isupCkt[circuit].infId; + + /* go through all the circuits now and find any other circuits on this infId */ + i = 1; + while (g_ftdm_sngss7_data.cfg.isupCkt[i].id != 0) { + + /* check that the infId matches and that this is not a siglink */ + if ((g_ftdm_sngss7_data.cfg.isupCkt[i].infId == infId) && + (g_ftdm_sngss7_data.cfg.isupCkt[i].type == VOICE)) { + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + i++; + continue; + } + + /* lock the channel */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + i++; + SS7_ASSERT; + }; + + /* only resume if we are paused */ + if (sngss7_test_flag(sngss7_info, FLAG_INFID_PAUSED)) { + /* set the resume flag on the channel */ + sngss7_set_flag(sngss7_info, FLAG_INFID_RESUME); + + /* clear the paused flag */ + sngss7_clear_flag(sngss7_info, FLAG_INFID_PAUSED); + + /* set the statet to SUSPENDED to bring the sig status up */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); + } + + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - int infId; - int i; + } /* if (g_ftdm_sngss7_data.cfg.isupCkt[i].infId == infId) */ - /* extract the affect infId from the circuit structure */ - infId = g_ftdm_sngss7_data.cfg.isupCircuit[circuit].infId; + /* move to the next circuit */ + i++; - /* go through all the circuits now and find any other circuits on this infId */ - i = 1; - while (g_ftdm_sngss7_data.cfg.isupCircuit[i].id != 0) { - - /* check that the infId matches and that this is not a siglink */ - if ((g_ftdm_sngss7_data.cfg.isupCircuit[i].infId == infId) && - (g_ftdm_sngss7_data.cfg.isupCircuit[i].siglink == 0)) { + } /* while (g_ftdm_sngss7_data.cfg.isupCkt[i].id != 0) */ - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - i++; - continue; - } + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_SUCCESS; +} - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); +/******************************************************************************/ +static ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +{ + SS7_FUNC_TRACE_ENTER(__FUNCTION__); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - i++; - continue; - }; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; - /* set the pause flag on the channel */ - sngss7_set_flag(sngss7_info, FLAG_INFID_PAUSED); + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } - /* set the statet o SUSPENDED to bring the sig status down */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + SS7_ASSERT; + }; + + /* open the channel if it is not open */ + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) { + if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { + SS7_ERROR("Failed to open CIC %d for COT test!\n", sngss7_info->circuit->cic); + /* KONRAD FIX ME */ + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + } + + /* tell the core to loop the channel */ + ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_LOOP, NULL); - } /* if (g_ftdm_sngss7_data.cfg.isupCircuit[i].infId == infId) */ + /* switch to the IN_LOOP state */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IN_LOOP); - /* move to the next circuit */ - i++; + /* store the sngss7 ids */ + if (suInstId == 0) { + sngss7_info->suInstId = get_unique_id(); + } else { + sngss7_info->suInstId = suInstId; + } + sngss7_info->spInstId = spInstId; + sngss7_info->globalFlg = globalFlg; - } /* while (g_ftdm_sngss7_data.cfg.isupCircuit[i].id != 0) */ + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_SUCCESS; } /******************************************************************************/ -static ftdm_status_t handle_resume(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +static ftdm_status_t handle_cot_stop(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - int infId; - int i; - - /* extract the affect infId from the circuit structure */ - infId = g_ftdm_sngss7_data.cfg.isupCircuit[circuit].infId; + SS7_FUNC_TRACE_ENTER(__FUNCTION__); - /* go through all the circuits now and find any other circuits on this infId */ - i = 1; - while (g_ftdm_sngss7_data.cfg.isupCircuit[i].id != 0) { + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; - /* check that the infId matches and that this is not a siglink */ - if ((g_ftdm_sngss7_data.cfg.isupCircuit[i].infId == infId) && - (g_ftdm_sngss7_data.cfg.isupCircuit[i].siglink == 0)) { - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - i++; - continue; - } - - /* lock the channel */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - i++; - continue; - }; - - /* set the resume flag on the channel */ - sngss7_set_flag(sngss7_info, FLAG_INFID_RESUME); - - /* clear the paused flag */ - sngss7_clear_flag(sngss7_info, FLAG_INFID_PAUSED); + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } - /* set the statet to SUSPENDED to bring the sig status up */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + SS7_ASSERT; + }; - } /* if (g_ftdm_sngss7_data.cfg.isupCircuit[i].infId == infId) */ + /* tell the core to stop looping the channel */ + ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL); - /* move to the next circuit */ - i++; + /* exit out of the LOOP state to the last state */ + ftdm_set_state_locked(ftdmchan, ftdmchan->last_state); - } /* while (g_ftdm_sngss7_data.cfg.isupCircuit[i].id != 0) */ + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_SUCCESS; } /******************************************************************************/ -static ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +static ftdm_status_t handle_cot(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - }; - - /* open the channel if it is not open */ - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) { - if (ftdm_channel_open_chan(ftdmchan) != FTDM_SUCCESS) { - SS7_ERROR("Failed to open CIC %d for COT test!\n", sngss7_info->circuit->cic); - /* KONRAD FIX ME */ - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } - } - - /* tell the core to loop the channel */ - ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_LOOP, NULL); - - /* switch to the IN_LOOP state */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IN_LOOP); - - /* store the sngss7 ids */ - if (suInstId == 0) { - sngss7_info->suInstId = get_unique_id(); - } else { - sngss7_info->suInstId = suInstId; - } - sngss7_info->spInstId = spInstId; - sngss7_info->globalFlg = globalFlg; - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + + if ( (siStaEvnt->contInd.eh.pres > 0) && (siStaEvnt->contInd.contInd.pres > 0)) { + SS7_INFO("Continuity Test result for CIC = %d (span %d, chan %d) is: \"%s\"\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + g_ftdm_sngss7_data.cfg.isupCkt[circuit].span, + g_ftdm_sngss7_data.cfg.isupCkt[circuit].chan, + (siStaEvnt->contInd.contInd.val) ? "PASS" : "FAIL"); + } else { + SS7_ERROR("Recieved Continuity report containing no results!\n"); + } + + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_SUCCESS; } /******************************************************************************/ -static ftdm_status_t handle_cot_stop(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) + + +/******************************************************************************/ +static ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); + SS7_FUNC_TRACE_ENTER(__FUNCTION__); - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - }; + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + SS7_ASSERT; + }; - /* tell the core to stop looping the channel */ - ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL); + /* check if the circuit is already blocked or not */ + if (sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) { + SS7_WARN("Received BLO on circuit that is already blocked!\n"); + } - /* exit out of the LOOP state to the last state */ - ftdm_set_state_locked(ftdmchan, ftdmchan->last_state); + /* throw the ckt block flag */ + sngss7_set_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX); - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* set the channel to suspended state */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); -/******************************************************************************/ -static ftdm_status_t handle_cot(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - if ( (siStaEvnt->contInd.eh.pres > 0) && (siStaEvnt->contInd.contInd.pres > 0)) { - SS7_INFO("Continuity Test result for CIC = %d (span %d, chan %d) is: \"%s\"\n", - g_ftdm_sngss7_data.cfg.isupCircuit[circuit].cic, - g_ftdm_sngss7_data.cfg.isupCircuit[circuit].span, - g_ftdm_sngss7_data.cfg.isupCircuit[circuit].chan, - (siStaEvnt->contInd.contInd.val) ? "PASS" : "FAIL"); - } else { - SS7_ERROR("Recieved Continuity report containing no results!\n"); - } - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_SUCCESS; } /******************************************************************************/ -static ftdm_status_t handle_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +static ftdm_status_t handle_blo_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - }; - - switch (ftdmchan->state) { - /**************************************************************************/ - case FTDM_CHANNEL_STATE_RESTART: - /* since we are already in RESTART, the channel is already free... - * just waitng for the other side to clean up it's channel. - * just send an acknowledge to this reset, don't go through the master - * state handler....bad but... - */ - - sngss7_info->spInstId = 0; - sngss7_info->suInstId = 0; - sngss7_info->globalFlg = globalFlg; - - ft_to_sngss7_rsca(ftdmchan); - break; - /**************************************************************************/ - default: - /* throw the channels RESET_RX flag */ - sngss7_set_flag(sngss7_info, FLAG_RESET_RX); - - sngss7_info->spInstId = 0; - sngss7_info->suInstId = 0; - sngss7_info->globalFlg = globalFlg; - - /* set the state of the channel to restart...the rest is done by the chan monitor */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - break; - /**************************************************************************/ - } - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + SS7_ASSERT; + }; + + /* KONRAD FIX ME */ + + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); + + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_SUCCESS; } /******************************************************************************/ -static ftdm_status_t handle_local_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +static ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); + SS7_FUNC_TRACE_ENTER(__FUNCTION__); - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - }; + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + SS7_ASSERT; + }; - /* the stack is sending out a RSC for us */ - sngss7_set_flag(sngss7_info, FLAG_RESET_RX); + /* check if the channel is blocked */ + if (!(sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX))) { + SS7_WARN("Received UBL on circuit that is not blocked!\n"); + } - sngss7_info->spInstId = 0; - sngss7_info->suInstId = 0; - sngss7_info->globalFlg = globalFlg; + /* throw the unblock flag */ + sngss7_set_flag(sngss7_info, FLAG_CKT_MN_UNBLK_RX); - /* set the state of the channel to restart...the rest is done by the chan monitor */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + /* clear the block flag */ + sngss7_clear_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX); - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* set the channel to suspended state */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); -/******************************************************************************/ -static ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) -{ - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } - - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); - - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - }; - - switch (ftdmchan->state) { - /**********************************************************************/ - case FTDM_CHANNEL_STATE_RESTART: - - /* go to DOWN */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - - break; - /**********************************************************************/ - case FTDM_CHANNEL_STATE_DOWN: - /* do nothing, just drop the message */ - break; - /**********************************************************************/ - case FTDM_CHANNEL_STATE_TERMINATING: - case FTDM_CHANNEL_STATE_HANGUP: - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - /**********************************************************************/ - /* go to DOWN */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - - break; - /**********************************************************************/ - default: - /* ITU Q764-2.9.5.1.c -> release the circuit */ - if ((siStaEvnt != NULL) && - (siStaEvnt->causeDgn.eh.pres ==PRSNT_NODEF) && - (siStaEvnt->causeDgn.causeVal.pres == PRSNT_NODEF)) { - ftdmchan->caller_data.hangup_cause = siStaEvnt->causeDgn.causeVal.val; - } else { - ftdmchan->caller_data.hangup_cause = 98; /* Message not compatiable with call state */ - } - - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - break; - /**********************************************************************/ - } - - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_SUCCESS; } /******************************************************************************/ -static ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +static ftdm_status_t handle_ubl_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } + SS7_FUNC_TRACE_ENTER(__FUNCTION__); - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - }; + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } - /* check if the circuit is already blocked or not */ - if (sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) { - SS7_WARN("Received BLO on circuit that is already blocked!\n"); - } + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); - /* throw the ckt block flag */ - sngss7_set_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX); + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + SS7_ASSERT; + }; - /* set the channel to suspended state */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); + /* KONRAD FIX ME */ - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_SUCCESS; } /******************************************************************************/ -static ftdm_status_t handle_blo_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +static ftdm_status_t handle_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + SS7_ASSERT; + }; - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; + /* throw the reset flag */ + sngss7_set_flag(sngss7_info, FLAG_RESET_RX); - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } + switch (ftdmchan->state) { + /**************************************************************************/ + case FTDM_CHANNEL_STATE_RESTART: - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); + /* go to idle so that we can redo the restart state*/ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - }; + break; + /**************************************************************************/ + default: - /* KONRAD FIX ME */ + /* set the state of the channel to restart...the rest is done by the chan monitor */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + break; + /**************************************************************************/ + } - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_SUCCESS; } /******************************************************************************/ -static ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +static ftdm_status_t handle_local_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); + SS7_FUNC_TRACE_ENTER(__FUNCTION__); - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - }; + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + SS7_ASSERT; + }; - /* check if the channel is blocked */ - if (!(sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX))) { - SS7_WARN("Received UBL on circuit that is not blocked!\n"); - } + /* throw the reset flag */ + sngss7_set_flag(sngss7_info, FLAG_RESET_RX); - /* throw the unblock flag */ - sngss7_set_flag(sngss7_info, FLAG_CKT_MN_UNBLK_RX); + switch (ftdmchan->state) { + /**************************************************************************/ + case FTDM_CHANNEL_STATE_RESTART: - /* clear the block flag */ - sngss7_clear_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX); + /* go to idle so that we can redo the restart state*/ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE); - /* set the channel to suspended state */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); + break; + /**************************************************************************/ + default: - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* set the state of the channel to restart...the rest is done by the chan monitor */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + break; + /**************************************************************************/ + } + + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_SUCCESS; } /******************************************************************************/ -static ftdm_status_t handle_ubl_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +static ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); + SS7_FUNC_TRACE_ENTER(__FUNCTION__); - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - }; + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + SS7_ASSERT; + }; + + switch (ftdmchan->state) { + /**********************************************************************/ + case FTDM_CHANNEL_STATE_RESTART: + + if ( sngss7_test_flag(sngss7_info, FLAG_RESET_TX) ) { + /* throw the FLAG_RESET_TX_RSP to indicate we have acknowledgement from the remote side */ + sngss7_set_flag(sngss7_info, FLAG_RESET_TX_RSP); + + /* go to DOWN */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + } else { + SS7_ERROR("Received RSC-RLC but we're not waiting on a RSC-RLC on CIC #, dropping\n", sngss7_info->circuit->cic); + } - /* KONRAD FIX ME */ + break; + /**********************************************************************/ + case FTDM_CHANNEL_STATE_DOWN: + + /* do nothing, just drop the message */ + SS7_DEBUG("Receveived RSC-RLC in down state, dropping\n"); + + break; + /**********************************************************************/ + case FTDM_CHANNEL_STATE_TERMINATING: + case FTDM_CHANNEL_STATE_HANGUP: + case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: + + /* throw the FLAG_RESET_TX_RSP to indicate we have acknowledgement from the remote side */ + sngss7_set_flag(sngss7_info, FLAG_RESET_TX_RSP); - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* go to DOWN */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; -} + break; + /**********************************************************************/ + default: + /* ITU Q764-2.9.5.1.c -> release the circuit */ + if ((siStaEvnt != NULL) && + (siStaEvnt->causeDgn.eh.pres ==PRSNT_NODEF) && + (siStaEvnt->causeDgn.causeVal.pres == PRSNT_NODEF)) { + ftdmchan->caller_data.hangup_cause = siStaEvnt->causeDgn.causeVal.val; + } else { + ftdmchan->caller_data.hangup_cause = 98; /* Message not compatiable with call state */ + } + + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + break; + /**********************************************************************/ + } + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); + + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_SUCCESS; +} /******************************************************************************/ static ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); + SS7_FUNC_TRACE_ENTER(__FUNCTION__); - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + sngss7_span_data_t *span = NULL; int range; int x; + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + /* extract the range value from the event structure */ if ((siStaEvnt->rangStat.eh.pres == PRSNT_NODEF) && (siStaEvnt->rangStat.range.pres == PRSNT_NODEF)) { range = siStaEvnt->rangStat.range.val; } else { SS7_ERROR("Received GRS with no range value on CIC = %d\n", sngss7_info->circuit->cic); SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } + return FTDM_FAIL; + } /* loop over the cics starting from circuit until range+1 */ - for (x = circuit; x < (circuit + range + 1); x++) { + for (x = circuit; x < (circuit + range + 1); x++) { /* grab the circuit in question */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - /* konrad fix me */ + if (extract_chan_data(x, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", x); + break; } /* now that we have the right channel...put a lock on it so no-one else can use it */ @@ -1466,68 +1658,309 @@ static ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32 if (check_for_state_change(ftdmchan)) { SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); ftdm_mutex_unlock(ftdmchan->mutex); - /* konrad fix me */ + SS7_ASSERT; }; - /* store the circuit and range into the sngss7 info so that we can figure out when to send GRA */ - sngss7_info->grs.circuit = circuit; - sngss7_info->grs.range = range; - sngss7_info->globalFlg = globalFlg; + /* fill in the span structure for this circuit */ + span = ftdmchan->span->mod_data; + span->grs.circuit = circuit; + span->grs.range = range; + + SS7_DEBUG_CHAN(ftdmchan, "Rx GRS (%d:%d)\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + (g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic + range)); /* flag the channel as having received a reset */ sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_RX); - /* throw the channel into RESTART state */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + switch (ftdmchan->state) { + /**************************************************************************/ + case FTDM_CHANNEL_STATE_RESTART: + + /* go to idle so that we can redo the restart state*/ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IDLE); + + break; + /**************************************************************************/ + default: + + /* set the state of the channel to restart...the rest is done by the chan monitor */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + break; + /**************************************************************************/ + } /* unlock the channel again before we exit */ ftdm_mutex_unlock(ftdmchan->mutex); } - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_SUCCESS; +} + +/******************************************************************************/ +static ftdm_status_t handle_grs_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +{ + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + int range; + int x; + + /* extract the range value from the event structure */ + if ((siStaEvnt->rangStat.eh.pres == PRSNT_NODEF) && (siStaEvnt->rangStat.range.pres == PRSNT_NODEF)) { + range = siStaEvnt->rangStat.range.val; + } else { + SS7_ERROR("Received GRA with no range value on CIC = %d\n", sngss7_info->circuit->cic); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + /* go through all the circuits in the range */ + for ( x = circuit; x < (circuit + range + 1); x++) { + + /* grab the circuit in question */ + if (extract_chan_data(x, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + break; + } + + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + SS7_ASSERT; + }; + + SS7_DEBUG_CHAN(ftdmchan, "Rx GRA (%d:%d)\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + (g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic + range)); + + switch (ftdmchan->state) { + /**********************************************************************/ + case FTDM_CHANNEL_STATE_RESTART: + + /* throw the FLAG_RESET_TX_RSP to indicate we have acknowledgement from the remote side */ + sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP); + + /* go to DOWN */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + + break; + /**********************************************************************/ + case FTDM_CHANNEL_STATE_DOWN: + + /* do nothing, just drop the message */ + SS7_DEBUG("Receveived GRA in down state, dropping\n"); + + break; + /**********************************************************************/ + case FTDM_CHANNEL_STATE_TERMINATING: + case FTDM_CHANNEL_STATE_HANGUP: + case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: + + /* throw the FLAG_RESET_TX_RSP to indicate we have acknowledgement from the remote side */ + sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP); + + break; + /**********************************************************************/ + default: + /* ITU Q764-2.9.5.1.c -> release the circuit */ + if ((siStaEvnt != NULL) && + (siStaEvnt->causeDgn.eh.pres ==PRSNT_NODEF) && + (siStaEvnt->causeDgn.causeVal.pres == PRSNT_NODEF)) { + ftdmchan->caller_data.hangup_cause = siStaEvnt->causeDgn.causeVal.val; + } else { + ftdmchan->caller_data.hangup_cause = 98; /* Message not compatiable with call state */ + } + + /* go to terminating to hang up the call */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + break; + /**********************************************************************/ + } + + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); + + } /* for (( x = 0; x < (circuit + range); x++) */ + + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_SUCCESS; +} + +/******************************************************************************/ +static ftdm_status_t handle_local_blk(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +{ + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + SS7_ASSERT; + }; + + /* check if the circuit is already blocked or not */ + if (sngss7_test_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX)) { + SS7_WARN("Received local BLO on circuit that is already blocked!\n"); + } + + /* throw the ckt block flag */ + sngss7_set_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX); + + /* set the channel to suspended state */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); + + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); + + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_SUCCESS; +} + +/******************************************************************************/ +static ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +{ + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + SS7_ASSERT; + }; + + /* check if the circuit is already blocked or not */ + if (sngss7_test_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX)) { + SS7_WARN("Received local UBL on circuit that is already unblocked!\n"); + } + + /* throw the ckt block flag */ + sngss7_set_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX); + + /* set the channel to suspended state */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); + + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); + + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_SUCCESS; +} + +/******************************************************************************/ +static ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) +{ + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + SS7_ASSERT; + }; + + /* throw the ckt block flag */ + sngss7_set_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK); + + /* set the channel to suspended state */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); + + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); + + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_SUCCESS; } /******************************************************************************/ #if 0 { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); + SS7_FUNC_TRACE_ENTER(__FUNCTION__); - sngss7_chan_data_t *sngss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; + sngss7_chan_data_t *sngss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } - /* now that we have the right channel...put a lock on it so no-one else can use it */ - ftdm_mutex_lock(ftdmchan->mutex); + /* now that we have the right channel...put a lock on it so no-one else can use it */ + ftdm_mutex_lock(ftdmchan->mutex); - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - }; + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + }; - /* fill in here */ + /* fill in here */ - /* unlock the channel again before we exit */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* unlock the channel again before we exit */ + ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_SUCCESS; } /******************************************************************************/ #endif /******************************************************************************/ + /******************************************************************************/ /* For Emacs: * Local Variables: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c new file mode 100644 index 0000000..b666f72 --- /dev/null +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c @@ -0,0 +1,592 @@ +/* + * Copyright (c) 2009|Konrad Hammel <konrad@sangoma.com> + * 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 original author; nor the names of any 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 OWNER + * 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 ********************************************************************/ +#include "ftmod_sangoma_ss7_main.h" +/******************************************************************************/ + +/* DEFINES ********************************************************************/ +/******************************************************************************/ + +/* GLOBALS ********************************************************************/ +/******************************************************************************/ + +/* PROTOTYPES *****************************************************************/ +void handle_sng_log(uint8_t level, char *fmt,...); +void handle_sng_mtp1_alarm(Pst *pst, L1Mngmt *sta); +void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta); +void handle_sng_mtp3_alarm(Pst *pst, SnMngmt *sta); +void handle_sng_isup_alarm(Pst *pst, SiMngmt *sta); +void handle_sng_cc_alarm(Pst *pst, CcMngmt *sta); +/******************************************************************************/ + +/* FUNCTIONS ******************************************************************/ +void handle_sng_log(uint8_t level, char *fmt,...) +{ + char *data; + int ret; + va_list ap; + + va_start(ap, fmt); + ret = vasprintf(&data, fmt, ap); + if (ret == -1) { + return; + } + + switch (level) { + /**************************************************************************/ + case SNG_LOGLEVEL_DEBUG: + ftdm_log(FTDM_LOG_DEBUG, "sng_ss7->%s", data); + break; + /**************************************************************************/ + case SNG_LOGLEVEL_WARN: + ftdm_log(FTDM_LOG_WARNING, "sng_ss7->%s", data); + break; + /**************************************************************************/ + case SNG_LOGLEVEL_INFO: + ftdm_log(FTDM_LOG_INFO, "sng_ss7->%s", data); + break; + /**************************************************************************/ + case SNG_LOGLEVEL_STATS: + ftdm_log(FTDM_LOG_INFO, "sng_ss7->%s", data); + break; + /**************************************************************************/ + case SNG_LOGLEVEL_ERROR: + ftdm_log(FTDM_LOG_ERROR, "sng_ss7->%s", data); + break; + /**************************************************************************/ + case SNG_LOGLEVEL_CRIT: + /*printf("%s",data);*/ + ftdm_log(FTDM_LOG_CRIT, "sng_ss7->%s", data); + break; + /**************************************************************************/ + default: + ftdm_log(FTDM_LOG_INFO, "sng_ss7->%s", data); + break; + /**************************************************************************/ + } + + return; +} + +/******************************************************************************/ +void handle_sng_mtp1_alarm(Pst *pst, L1Mngmt *sta) +{ + + +} /* handle_mtp1_alarm */ + +/******************************************************************************/ +void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta) +{ + + switch (sta->t.usta.alarm.category) { + /**************************************************************************/ + case (LCM_CATEGORY_PROTOCOL): + case (LCM_CATEGORY_INTERFACE): + + switch (sta->t.usta.alarm.event) { + /**********************************************************************/ + case (LSD_EVENT_ENTR_CONG): + case (LSD_EVENT_EXIT_CONG): + case (LSD_EVENT_PROT_ST_UP): + case (LSD_EVENT_PROT_ST_DN): + case (LSD_EVENT_LINK_ALIGNED): + case (LSD_EVENT_REMOTE_CONG_START): + case (LSD_EVENT_REMOTE_CONG_END): + case (LSD_EVENT_RX_REMOTE_SIPO): + + switch (sta->t.usta.alarm.cause) { + /******************************************************************/ + case (LCM_CAUSE_UNKNOWN): + ftdm_log(FTDM_LOG_ERROR,"[MTP2][SAPID:%d] %s\n", + sta->t.usta.evntParm[0], + DECODE_LSD_EVENT(sta->t.usta.alarm.event)); + break; + /******************************************************************/ + case (LCM_CAUSE_MGMT_INITIATED): + ftdm_log(FTDM_LOG_ERROR,"[MTP2][SAPID:%d][MGMT] %s\n", + sta->t.usta.evntParm[0], + DECODE_LSD_EVENT(sta->t.usta.alarm.event)); + break; + /******************************************************************/ + default: + ftdm_log(FTDM_LOG_ERROR,"[MTP2][SAPID:%d] %s (***unknown cause***)\n", + sta->t.usta.evntParm[0], + DECODE_LSD_EVENT(sta->t.usta.alarm.event)); + break; + /******************************************************************/ + } /* switch (sta->t.usta.alarm.cause) */ + break; + /**********************************************************************/ + case (LSD_EVENT_PROT_ERR): + ftdm_log(FTDM_LOG_ERROR,"[MTP2][SAPID:%d] %s : %s\n", + sta->t.usta.evntParm[0], + DECODE_LSD_EVENT(sta->t.usta.alarm.event), + DECODE_LSD_CAUSE(sta->t.usta.alarm.cause)); + break; + /**********************************************************************/ + case (LSD_EVENT_ALIGN_LOST): + ftdm_log(FTDM_LOG_ERROR,"[MTP2][SAPID:%d] %s : %s\n", + sta->t.usta.evntParm[0], + DECODE_LSD_EVENT(sta->t.usta.alarm.event), + DECODE_DISC_REASON(sta->t.usta.evntParm[1])); + break; + /**********************************************************************/ + case (LSD_EVENT_RTB_FULL): + case (LSD_EVENT_RTB_FULL_OVER): + ftdm_log(FTDM_LOG_ERROR,"[MTP2][SAPID:%d] %s : RTB Queue Len(%d)|Oldest BSN(%d)|Tx Queue Len(%d)|Outstanding Frames(%d)\n", + sta->t.usta.evntParm[0], + DECODE_LSD_EVENT(sta->t.usta.alarm.event), + sta->t.usta.evntParm[1], + sta->t.usta.evntParm[2], + sta->t.usta.evntParm[3], + sta->t.usta.evntParm[4]); + break; + /**********************************************************************/ + case (LSD_EVENT_NEG_ACK): + ftdm_log(FTDM_LOG_ERROR,"[MTP2][SAPID:%d] %s : RTB Queue Len(%d)\n", + sta->t.usta.evntParm[0], + DECODE_LSD_EVENT(sta->t.usta.alarm.event), + sta->t.usta.evntParm[1]); + break; + /**********************************************************************/ + case (LSD_EVENT_DAT_CFM_SDT): + ftdm_log(FTDM_LOG_ERROR,"[MTP2][SAPID:%d] %s : %d\n", + sta->t.usta.evntParm[0], + DECODE_LSD_EVENT(sta->t.usta.alarm.event), + DECODE_DISC_REASON(sta->t.usta.evntParm[1])); + break; + /**********************************************************************/ + case (LCM_EVENT_UI_INV_EVT): + case (LCM_EVENT_LI_INV_EVT): + ftdm_log(FTDM_LOG_ERROR,"[MTP2] %s : %s : Primitive (%d)\n", + DECODE_LSD_EVENT(sta->t.usta.alarm.event), + DECODE_LCM_CAUSE(sta->t.usta.alarm.cause), + sta->t.usta.evntParm[0]); + break; + /**********************************************************************/ + case (LCM_EVENT_INV_EVT): + + switch (sta->t.usta.alarm.cause) { + /******************************************************************/ + case (LCM_CAUSE_UNKNOWN): + case (LCM_CAUSE_SWVER_NAVAIL): + ftdm_log(FTDM_LOG_ERROR,"[MTP2] %s : %s : Event (%d)\n", + DECODE_LSD_EVENT(sta->t.usta.alarm.event), + DECODE_LCM_CAUSE(sta->t.usta.alarm.cause), + sta->t.usta.evntParm[0]); + break; + /******************************************************************/ + case (LCM_CAUSE_DECODE_ERR): + ftdm_log(FTDM_LOG_ERROR,"[MTP2] %s : %s : Primitive (%d)|Version (%d)\n", + DECODE_LSD_EVENT(sta->t.usta.alarm.event), + DECODE_LCM_CAUSE(sta->t.usta.alarm.cause), + sta->t.usta.evntParm[0], + sta->t.usta.evntParm[1]); + break; + /******************************************************************/ + default: + ftdm_log(FTDM_LOG_ERROR,"[MTP2] %s(%d) : %s(%d)\n", + DECODE_LSD_EVENT(sta->t.usta.alarm.event), + sta->t.usta.alarm.event, + DECODE_LSD_CAUSE(sta->t.usta.alarm.cause), + sta->t.usta.alarm.cause); + break; + /******************************************************************/ + } /* switch (sta->t.usta.alarm.cause) */ + break; + /**********************************************************************/ + default: + ftdm_log(FTDM_LOG_ERROR,"[MTP2] %s(%d) : %s(%d)\n", + DECODE_LSD_EVENT(sta->t.usta.alarm.event), + sta->t.usta.alarm.event, + DECODE_LSD_CAUSE(sta->t.usta.alarm.cause), + sta->t.usta.alarm.cause); + break; + /**********************************************************************/ + } /* switch (sta->t.usta.alarm.event) */ + break; + /**************************************************************************/ + default: + ftdm_log(FTDM_LOG_ERROR,"[MTP2] Unknown alarm category %d\n", + sta->t.usta.alarm.category); + break; + /**************************************************************************/ + } /* switch(sta->t.usta.alarm.category) */ + + return; +} /* handle_mtp2_alarm */ + +/******************************************************************************/ +void handle_sng_mtp3_alarm(Pst *pst, SnMngmt *sta) +{ + + switch (sta->hdr.elmId.elmnt) { + /**************************************************************************/ + case (STDLSAP): + switch (sta->t.usta.alarm.event) { + /**********************************************************************/ + case (LSN_EVENT_INV_OPC_OTHER_END): + ftdm_log(FTDM_LOG_ERROR,"[MTP3][SAPID:%d] %s : %s : OPC(0x%X%X%X%X)\n", + sta->hdr.elmId.elmntInst1, + DECODE_LSN_EVENT(sta->t.usta.alarm.event), + DECODE_LSN_CAUSE(sta->t.usta.alarm.cause), + sta->t.usta.evntParm[3], + sta->t.usta.evntParm[2], + sta->t.usta.evntParm[1], + sta->t.usta.evntParm[0]); + break; + /**********************************************************************/ + case (LSN_EVENT_INV_SLC_OTHER_END): + ftdm_log(FTDM_LOG_ERROR,"[MTP3][SAPID:%d] %s : %s : SLC(%d)\n", + sta->hdr.elmId.elmntInst1, + DECODE_LSN_EVENT(sta->t.usta.alarm.event), + DECODE_LSN_CAUSE(sta->t.usta.alarm.cause), + sta->t.usta.evntParm[0]); + break; + /**********************************************************************/ + default: + ftdm_log(FTDM_LOG_ERROR,"[MTP3][SAPID:%d] %s(%d) : %s(%d)\n", + sta->hdr.elmId.elmntInst1, + DECODE_LSN_EVENT(sta->t.usta.alarm.event), + sta->t.usta.alarm.event, + DECODE_LSN_CAUSE(sta->t.usta.alarm.cause), + sta->t.usta.alarm.cause); + break; + /**********************************************************************/ + } /* sta->t.usta.alarm.event */ + break; + /**************************************************************************/ + case (STNSAP): + ftdm_log(FTDM_LOG_ERROR,"[MTP3][SAPID:%d] %s : %s\n", + sta->hdr.elmId.elmntInst1, + DECODE_LSN_EVENT(sta->t.usta.alarm.event), + DECODE_LSN_CAUSE(sta->t.usta.alarm.cause)); + break; + /**************************************************************************/ + case (STLNKSET): + ftdm_log(FTDM_LOG_ERROR,"[MTP3][LNKSET:%d] %s : %s\n", + sta->hdr.elmId.elmntInst1, + DECODE_LSN_EVENT(sta->t.usta.alarm.event), + DECODE_LSN_CAUSE(sta->t.usta.alarm.cause)); + break; + /**************************************************************************/ + case (STROUT): + ftdm_log(FTDM_LOG_ERROR,"[MTP3][DPC:0x%d%d%d%d] %s : %s\n", + sta->t.usta.evntParm[0], + sta->t.usta.evntParm[1], + sta->t.usta.evntParm[2], + sta->t.usta.evntParm[3], + DECODE_LSN_EVENT(sta->t.usta.alarm.event), + DECODE_LSN_CAUSE(sta->t.usta.alarm.cause)); + break; + /**************************************************************************/ + default: + ftdm_log(FTDM_LOG_ERROR,"[MTP3] %s(%d) : %s(%d)\n", + DECODE_LSN_EVENT(sta->t.usta.alarm.event), + sta->t.usta.alarm.event, + DECODE_LSN_CAUSE(sta->t.usta.alarm.cause), + sta->t.usta.alarm.cause); + break; + /**************************************************************************/ + } /* switch (sta->hdr.elmId.elmnt) */ + + return; +} /* handle_mtp3_alarm */ + +/******************************************************************************/ +void handle_sng_isup_alarm(Pst *pst, SiMngmt *sta) +{ + char msg[250]; + char tmp[25]; + char *p = NULL; + int x = 0; + + /* initalize the msg variable to NULLs */ + memset(&msg[0], '\0', sizeof(&msg)); + + + /* point p to the first spot in msg */ + p = &msg[0]; + + p = strcat(p, "[ISUP]"); + + /* go through the dgnVals */ + for (x = 0; x < 5; x++) { + switch (sta->t.usta.dgn.dgnVal[x].type) { + /**********************************************************************/ + case (LSI_USTA_DGNVAL_NONE): + break; + /**********************************************************************/ + case (LSI_USTA_DGNVAL_EVENT): + /* init tmp with NULLs */ + memset(&tmp[0], '\0', sizeof(&tmp)); + + /* fill in the dgn val to tmp */ + sprintf(&tmp[0], "[EVENT:%d]",sta->t.usta.dgn.dgnVal[x].t.event); + + /* concat tmp to msg */ + p = strcat(p, &tmp[0]); + break; + /**********************************************************************/ + case (LSI_USTA_DGNVAL_SPID): + /* init tmp with NULLs */ + memset(&tmp[0], '\0', sizeof(&tmp)); + + /* fill in the dgn val to tmp */ + sprintf(&tmp[0], "[SPID:%d]",sta->t.usta.dgn.dgnVal[x].t.spId); + + /* concat tmp to msg */ + p = strcat(p, &tmp[0]); + break; + /**********************************************************************/ + case (LSI_USTA_DGNVAL_SUID): + /* init tmp with NULLs */ + memset(&tmp[0], '\0', sizeof(&tmp)); + + /* fill in the dgn val to tmp */ + sprintf(&tmp[0], "[SUID:%d]",sta->t.usta.dgn.dgnVal[x].t.suId); + + /* concat tmp to msg */ + p = strcat(p, &tmp[0]); + break; + /**********************************************************************/ + case (LSI_USTA_DGNVAL_SPINSTID): + /* init tmp with NULLs */ + memset(&tmp[0], '\0', sizeof(&tmp)); + + /* fill in the dgn val to tmp */ + sprintf(&tmp[0], "[SPINSTID:%d]", (int)sta->t.usta.dgn.dgnVal[x].t.spInstId); + + /* concat tmp to msg */ + p = strcat(p, &tmp[0]); + break; + /**********************************************************************/ + case (LSI_USTA_DGNVAL_SUINSTID): + /* init tmp with NULLs */ + memset(&tmp[0], '\0', sizeof(&tmp)); + + /* fill in the dgn val to tmp */ + sprintf(&tmp[0], "[SUINSTID:%d]", (int)sta->t.usta.dgn.dgnVal[x].t.suInstId); + + /* concat tmp to msg */ + p = strcat(p, &tmp[0]); + break; + /**********************************************************************/ + case (LSI_USTA_DGNVAL_CIRCUIT): + /* init tmp with NULLs */ + memset(&tmp[0], '\0', sizeof(&tmp)); + + /* fill in the dgn val to tmp */ + sprintf(&tmp[0], "[CKT:%d]", (int)sta->t.usta.dgn.dgnVal[x].t.cirId); + + /* concat tmp to msg */ + p = strcat(p, &tmp[0]); + break; + /**********************************************************************/ + case (LSI_USTA_DGNVAL_CIC): + /* init tmp with NULLs */ + memset(&tmp[0], '\0', sizeof(&tmp)); + + /* fill in the dgn val to tmp */ + sprintf(&tmp[0], "[CIC:%d]", (int)sta->t.usta.dgn.dgnVal[x].t.cic); + + /* concat tmp to msg */ + p = strcat(p, &tmp[0]); + break; + /**********************************************************************/ + case (LSI_USTA_DGNVAL_INTF): + /* init tmp with NULLs */ + memset(&tmp[0], '\0', sizeof(&tmp)); + + /* fill in the dgn val to tmp */ + sprintf(&tmp[0], "[INTF:%d]", (int)sta->t.usta.dgn.dgnVal[x].t.intfId); + + /* concat tmp to msg */ + p = strcat(p, &tmp[0]); + break; + /**********************************************************************/ + case (LSI_USTA_DGNVAL_DPC): + /* init tmp with NULLs */ + memset(&tmp[0], '\0', sizeof(&tmp)); + + /* fill in the dgn val to tmp */ + sprintf(&tmp[0], "[DPC:%d]", (int)sta->t.usta.dgn.dgnVal[x].t.dpc); + + /* concat tmp to msg */ + p = strcat(p, &tmp[0]); + break; + /**********************************************************************/ + case (LSI_USTA_DGNVAL_ADDRS): +#if 0 + /* + *typedef struct addrs + *{ + *U8 length; + *U8 strg[ADRLEN]; + *} Addrs; + */ + /* init tmp with NULLs */ + memset(&tmp[0], '\0', sizeof(&tmp)); + + /* fill in the dgn val to tmp */ + sprintf(&tmp[0], "[ADDRS:%d]",sta->t.usta.dgn.dgnVal[x].t.); + + /* concat tmp to msg */ + p = strcat(p, &tmp[0]); +#endif + break; + /**********************************************************************/ + case (LSI_USTA_DGNVAL_SWTCH): + /* init tmp with NULLs */ + memset(&tmp[0], '\0', sizeof(&tmp)); + + /* fill in the dgn val to tmp */ + sprintf(&tmp[0], "[SWTCH:%d]",sta->t.usta.dgn.dgnVal[x].t.swtch); + + /* concat tmp to msg */ + p = strcat(p, &tmp[0]); + break; + /**********************************************************************/ + case (LSI_USTA_DGNVAL_RANGE): + /* init tmp with NULLs */ + memset(&tmp[0], '\0', sizeof(&tmp)); + + /* fill in the dgn val to tmp */ + sprintf(&tmp[0], "[RANGE:0x%X]",sta->t.usta.dgn.dgnVal[x].t.range); + + /* concat tmp to msg */ + p = strcat(p, &tmp[0]); + break; + /**********************************************************************/ + case (LSI_USTA_DGNVAL_STATUS_OCTS): +#if 0 + /* + *typedef struct addrs + *{ + *U8 length; + *U8 strg[ADRLEN]; + *} Addrs; + */ + /* init tmp with NULLs */ + /* init tmp with NULLs */ + memset(&tmp[0], '\0', sizeof(&tmp)); + + /* fill in the dgn val to tmp */ + sprintf(&tmp[0], "[STATUS_OCT:0x%X]",sta->t.usta.dgn.dgnVal[x].t.); + + /* concat tmp to msg */ + p = strcat(p, &tmp[0]); +#endif + break; + /**********************************************************************/ + case (LSI_USTA_DGNVAL_VER): +#ifdef SI_RUG + /* init tmp with NULLs */ + memset(&tmp[0], '\0', sizeof(&tmp)); + + /* fill in the dgn val to tmp */ + sprintf(&tmp[0], "[VER:%d]",sta->t.usta.dgn.dgnVal[x].t.intfVer); + + /* concat tmp to msg */ + p = strcat(p, &tmp[0]); +#endif + break; + /**********************************************************************/ + case (LSI_USTA_DGNVAL_TIMER): + /* init tmp with NULLs */ + memset(&tmp[0], '\0', sizeof(&tmp)); + + /* fill in the dgn val to tmp */ + sprintf(&tmp[0], "[TIMER:0x%X]",sta->t.usta.dgn.dgnVal[x].t.tmrInfo); + + /* concat tmp to msg */ + p = strcat(p, &tmp[0]); + break; + /**********************************************************************/ + case (LSI_USTA_DGNVAL_MSGTYPE): + /* init tmp with NULLs */ + memset(&tmp[0], '\0', sizeof(&tmp)); + + /* fill in the dgn val to tmp */ + sprintf(&tmp[0], "[MSGTYPE:%d]",sta->t.usta.dgn.dgnVal[x].t.msgType); + + /* concat tmp to msg */ + p = strcat(p, &tmp[0]); + break; + /**********************************************************************/ + case (LSI_USTA_DGNVAL_STATE): + /* init tmp with NULLs */ + memset(&tmp[0], '\0', sizeof(&tmp)); + + /* fill in the dgn val to tmp */ + sprintf(&tmp[0], "[STATE:%d]",sta->t.usta.dgn.dgnVal[x].t.state); + + /* concat tmp to msg */ + p = strcat(p, &tmp[0]); + break; + /**********************************************************************/ + default: + break; + /**********************************************************************/ + } /* switch (sta->t.usta.dgn.dgnVal[x].t.type) */ + } /* for (x = 0; x < 5; x++) */ + + ftdm_log(FTDM_LOG_ERROR,"%s %s : %s\n", + msg, + DECODE_LSI_EVENT(sta->t.usta.alarm.event), + DECODE_LSI_CAUSE(sta->t.usta.alarm.cause)); + +} /* handle_isup_alarm */ + +/******************************************************************************/ +void handle_sng_cc_alarm(Pst *pst, CcMngmt *sta) +{ + + return; +} /* handle_cc_alarm */ +/******************************************************************************/ + +/******************************************************************************/ +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4: + */ +/******************************************************************************/ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index 7259931..fc2c1a6 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -39,1206 +39,1394 @@ /******************************************************************************/ /* GLOBALS ********************************************************************/ -static sng_isup_event_interface_t sng_event; -static ftdm_io_interface_t g_ftdm_sngss7_interface; -ftdm_sngss7_data_t g_ftdm_sngss7_data; -ftdm_sched_t *sngss7_sched; +static sng_isup_event_interface_t sng_event; +static ftdm_io_interface_t g_ftdm_sngss7_interface; +ftdm_sngss7_data_t g_ftdm_sngss7_data; /******************************************************************************/ /* PROTOTYPES *****************************************************************/ -static void *ftdm_sangoma_ss7_run(ftdm_thread_t *me, void *obj); -static void ftdm_sangoma_ss7_process_state_change(ftdm_channel_t *ftdmchan); +static void *ftdm_sangoma_ss7_run (ftdm_thread_t * me, void *obj); +static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan); -static ftdm_status_t ftdm_sangoma_ss7_stop(ftdm_span_t *span); -static ftdm_status_t ftdm_sangoma_ss7_start(ftdm_span_t *span); +static ftdm_status_t ftdm_sangoma_ss7_stop (ftdm_span_t * span); +static ftdm_status_t ftdm_sangoma_ss7_start (ftdm_span_t * span); /******************************************************************************/ /* STATE MAP ******************************************************************/ ftdm_state_map_t sangoma_ss7_state_map = { - { - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_ANY_STATE, FTDM_END}, - {FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_SUSPENDED, FTDM_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_RESTART, FTDM_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_CANCEL, FTDM_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_COLLECT, FTDM_CHANNEL_STATE_RING, FTDM_CHANNEL_STATE_DIALING, - FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, - FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_CANCEL, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_DOWN, FTDM_END}, - {FTDM_CHANNEL_STATE_COLLECT, FTDM_CHANNEL_STATE_IN_LOOP, FTDM_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_COLLECT, FTDM_END}, - {FTDM_CHANNEL_STATE_RING, FTDM_CHANNEL_STATE_CANCEL, FTDM_CHANNEL_STATE_IN_LOOP, FTDM_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_IN_LOOP, FTDM_END}, - {FTDM_CHANNEL_STATE_COLLECT, FTDM_CHANNEL_STATE_DOWN, FTDM_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_RING, FTDM_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS, FTDM_END} - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROGRESS, FTDM_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_END}, - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_UP, FTDM_END}, - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_UP, FTDM_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_END}, - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_END}, - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_END}, - {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_END}, - }, - { - ZSD_INBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_END}, - }, - /**************************************************************************/ - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_ANY_STATE, FTDM_END}, - {FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_TERMINATING, FTDM_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_RESTART, FTDM_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_CANCEL, FTDM_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_COLLECT, FTDM_CHANNEL_STATE_RING, FTDM_CHANNEL_STATE_DIALING, - FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, - FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_CANCEL, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_DOWN, FTDM_END}, - {FTDM_CHANNEL_STATE_DIALING, FTDM_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_DIALING, FTDM_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_CANCEL, FTDM_END} - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROGRESS, FTDM_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_END}, - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_END}, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_UP, FTDM_END}, - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_UP, FTDM_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_TERMINATING, FTDM_END}, - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_TERMINATING, FTDM_END}, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_END}, - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_HANGUP, FTDM_END}, - {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_END}, - }, - { - ZSD_OUTBOUND, - ZSM_UNACCEPTABLE, - {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_END}, - {FTDM_CHANNEL_STATE_DOWN, FTDM_END}, - } - } + { + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_END}, + {FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_DOWN, + FTDM_CHANNEL_STATE_IN_LOOP, FTDM_CHANNEL_STATE_COLLECT, + FTDM_CHANNEL_STATE_RING, FTDM_CHANNEL_STATE_PROGRESS, + FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_CHANNEL_STATE_UP, + FTDM_CHANNEL_STATE_CANCEL, FTDM_CHANNEL_STATE_TERMINATING, + FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_END} + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_RESTART, FTDM_END}, + {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_TERMINATING, + FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_HANGUP_COMPLETE, + FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_IDLE, FTDM_END} + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_IDLE, FTDM_END}, + {FTDM_CHANNEL_STATE_RESTART, FTDM_END} + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_DOWN, FTDM_END}, + {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, + FTDM_CHANNEL_STATE_COLLECT, FTDM_CHANNEL_STATE_IN_LOOP, FTDM_END} + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_IN_LOOP, FTDM_END}, + {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, + FTDM_CHANNEL_STATE_COLLECT, FTDM_CHANNEL_STATE_DOWN, FTDM_END} + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_COLLECT, FTDM_END}, + {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, + FTDM_CHANNEL_STATE_CANCEL, FTDM_CHANNEL_STATE_RING, FTDM_END} + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_RING, FTDM_END}, + {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, + FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, + FTDM_CHANNEL_STATE_PROGRESS, FTDM_END} + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_PROGRESS, FTDM_END}, + {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, + FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, + FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_END} + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_END}, + {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, + FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, + FTDM_CHANNEL_STATE_UP, FTDM_END} + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_UP, FTDM_END}, + {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, + FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_END} + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_CANCEL, FTDM_END}, + {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, + FTDM_CHANNEL_STATE_HANGUP, FTDM_END} + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_END}, + {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, + FTDM_CHANNEL_STATE_HANGUP, FTDM_END} + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_END}, + {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, + FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_END} + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_END}, + {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, + FTDM_CHANNEL_STATE_DOWN, FTDM_END} + }, + /**************************************************************************/ + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_END}, + {FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_DOWN, + FTDM_CHANNEL_STATE_IN_LOOP, FTDM_CHANNEL_STATE_DIALING, + FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, + FTDM_CHANNEL_STATE_UP, FTDM_CHANNEL_STATE_CANCEL, + FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, + FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_END} + }, + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_RESTART, FTDM_END}, + {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_TERMINATING, + FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_HANGUP_COMPLETE, + FTDM_CHANNEL_STATE_DOWN, FTDM_CHANNEL_STATE_IDLE, FTDM_END} + }, + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_IDLE, FTDM_END}, + {FTDM_CHANNEL_STATE_RESTART, FTDM_END} + }, + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_DOWN, FTDM_END}, + {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, + FTDM_CHANNEL_STATE_DIALING, FTDM_CHANNEL_STATE_IN_LOOP, FTDM_END} + }, + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_IN_LOOP, FTDM_END}, + {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, + FTDM_CHANNEL_STATE_DIALING, FTDM_CHANNEL_STATE_DOWN, FTDM_END} + }, + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_DIALING, FTDM_END}, + {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, + FTDM_CHANNEL_STATE_CANCEL, FTDM_CHANNEL_STATE_TERMINATING, + FTDM_CHANNEL_STATE_HANGUP, FTDM_CHANNEL_STATE_PROGRESS, + FTDM_CHANNEL_STATE_UP, FTDM_END} + }, + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_PROGRESS, FTDM_END}, + {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, + FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, + FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_END} + }, + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_PROGRESS_MEDIA, FTDM_END}, + {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, + FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, + FTDM_CHANNEL_STATE_UP, FTDM_END} + }, + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_UP, FTDM_END}, + {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, + FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, FTDM_END} + }, + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_CANCEL, FTDM_END}, + {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, + FTDM_CHANNEL_STATE_HANGUP, FTDM_END} + }, + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_END}, + {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, + FTDM_CHANNEL_STATE_HANGUP, FTDM_END} + }, + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_HANGUP, FTDM_END}, + {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, + FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_END} + }, + { + ZSD_OUTBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_END}, + {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, + FTDM_CHANNEL_STATE_DOWN, FTDM_END} + }, + } }; + /******************************************************************************/ /* MONITIOR THREADS ***********************************************************/ -static void *ftdm_sangoma_ss7_run(ftdm_thread_t *me, void *obj) +static void *ftdm_sangoma_ss7_run(ftdm_thread_t * me, void *obj) { - ftdm_interrupt_t *ftdm_sangoma_ss7_int = NULL; - ftdm_span_t *span = (ftdm_span_t *) obj; - ftdm_channel_t *ftdmchan = NULL; - - ftdm_log(FTDM_LOG_INFO, "ftmod_sangoma_ss7 monitor thread for span=%u started.\n", span->span_id); - - /* set IN_THREAD flag so that we know this thread is running */ - ftdm_set_flag(span, FTDM_SPAN_IN_THREAD); - - /* get an interrupt queue for this span */ - if(ftdm_queue_get_interrupt(span->pendingchans, &ftdm_sangoma_ss7_int) != FTDM_SUCCESS) { - SS7_CRITICAL("Failed to get a ftdm_interrupt for span = %d!\n", span->span_id); - goto ftdm_sangoma_ss7_run_exit; - } - - while (ftdm_running() && !(ftdm_test_flag(span, FTDM_SPAN_STOP_THREAD))) { - - /* find out why we returned from the interrupt queue */ - switch ((ftdm_interrupt_wait(ftdm_sangoma_ss7_int, 100))) { - /**********************************************************************/ - case FTDM_SUCCESS: /* there was a state change on the span */ - /* process all pending state changes */ - while ((ftdmchan = ftdm_queue_dequeue(span->pendingchans))) { - /* double check that this channel has a state change pending */ - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { - ftdm_sangoma_ss7_process_state_change(ftdmchan); - } else { - SS7_ERROR("ftdm_core reported state change, but state change flag not set on ft-span = %d, ft-chan = %d\n", - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id); - } - } /* while ((ftdmchan = ftdm_queue_dequeue(span->pendingchans))) */ - - break; - /**********************************************************************/ - case FTDM_TIMEOUT: - SS7_DEVEL_DEBUG("ftdm_interrupt_wait timed-out on span = %d\n", span->span_id); - break; - /**********************************************************************/ - case FTDM_FAIL: - SS7_ERROR("ftdm_interrupt_wait returned error!\non span = %d\n", span->span_id); - break; - /**********************************************************************/ - default: - SS7_ERROR("ftdm_interrupt_wait returned with unknown code on span = %d\n", span->span_id); - break; - /**********************************************************************/ - } /* switch ((ftdm_interrupt_wait(ftdm_sangoma_ss7_int, 100))) */ - - } /* master while loop */ - - /* clear the IN_THREAD flag so that we know the thread is done */ - ftdm_clear_flag(span, FTDM_SPAN_IN_THREAD); - - ftdm_log(FTDM_LOG_INFO, "ftmod_sangoma_ss7 monitor thread for span=%u stopping.\n", span->span_id); - - return NULL; + ftdm_interrupt_t *ftdm_sangoma_ss7_int = NULL; + ftdm_span_t *ftdmspan = (ftdm_span_t *) obj; + ftdm_channel_t *ftdmchan = NULL; + sngss7_chan_data_t *sngss7_info = NULL; + sngss7_span_data_t *sngss7_span = NULL; + int i; + + ftdm_log (FTDM_LOG_INFO, "ftmod_sangoma_ss7 monitor thread for span=%u started.\n", ftdmspan->span_id); + + /* set IN_THREAD flag so that we know this thread is running */ + ftdm_set_flag (ftdmspan, FTDM_SPAN_IN_THREAD); + + /* get an interrupt queue for this span */ + if (ftdm_queue_get_interrupt (ftdmspan->pendingchans, &ftdm_sangoma_ss7_int) != FTDM_SUCCESS) { + SS7_CRITICAL ("Failed to get a ftdm_interrupt for span = %d!\n", ftdmspan->span_id); + goto ftdm_sangoma_ss7_run_exit; + } + + while (ftdm_running () && !(ftdm_test_flag (ftdmspan, FTDM_SPAN_STOP_THREAD))) { + + /* find out why we returned from the interrupt queue */ + switch ((ftdm_interrupt_wait (ftdm_sangoma_ss7_int, 100))) { + /**********************************************************************/ + case FTDM_SUCCESS: /* there was a state change on the span */ + /* process all pending state changes */ + + while ((ftdmchan = ftdm_queue_dequeue (ftdmspan->pendingchans))) { + /* double check that this channel has a state change pending */ + if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { + ftdm_sangoma_ss7_process_state_change (ftdmchan); + } else { + SS7_ERROR("ftdm_core reported state change, but state change flag not set on ft-span = %d, ft-chan = %d\n", + ftdmchan->physical_span_id, + ftdmchan->physical_chan_id); + } + }/* while ((ftdmchan = ftdm_queue_dequeue(ftdmspan->pendingchans))) */ + + break; + /**********************************************************************/ + case FTDM_TIMEOUT: + SS7_DEVEL_DEBUG ("ftdm_interrupt_wait timed-out on span = %d\n",ftdmspan->span_id); + + break; + /**********************************************************************/ + case FTDM_FAIL: + SS7_ERROR ("ftdm_interrupt_wait returned error!\non span = %d\n", ftdmspan->span_id); + + break; + /**********************************************************************/ + default: + SS7_ERROR("ftdm_interrupt_wait returned with unknown code on span = %d\n",ftdmspan->span_id); + + break; + /**********************************************************************/ + } /* switch ((ftdm_interrupt_wait(ftdm_sangoma_ss7_int, 100))) */ + + /* extract the span data structure */ + sngss7_span = (sngss7_span_data_t *)ftdmspan->mod_data; + + /* check if there is a GRS being processed on the span */ + if (sngss7_span->grs.range > 0) { + ftdm_log(FTDM_LOG_DEBUG, "Found Rx GRS on span %d...checking circuits\n", ftdmspan->span_id); + /*SS7_DEBUG("Found Rx GRS on span %d...checking circuits\n", ftdmspan->span_id);*/ + + /* check all the circuits in the range to see if they are done resetting */ + for ( i = sngss7_span->grs.circuit; i < (sngss7_span->grs.circuit + sngss7_span->grs.range + 1); i++) { + + /* extract the channel in question */ + if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", i); + SS7_ASSERT; + } + + /* lock the channel */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* check if there is a state change pending on the channel */ + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { + /* check the state to the GRP_RESET_RX_DN flag */ + if (!sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_RX_DN)) { + /* this channel is still resetting...do nothing */ + goto GRS_UNLOCK_ALL; + } /* if (!sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_RX_DN)) */ + } else { + /* state change pending */ + goto GRS_UNLOCK_ALL; + } + } /* for ( i = circuit; i < (circuit + range + 1); i++) */ + + SS7_DEBUG("All circuits out of reset for GRS: circuit=%d, range=%d\n", + sngss7_span->grs.circuit, + sngss7_span->grs.range); + + /* check all the circuits in the range to see if they are done resetting */ + for ( i = sngss7_span->grs.circuit; i < (sngss7_span->grs.circuit + sngss7_span->grs.range + 1); i++) { + + /* extract the channel in question */ + if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n",i); + SS7_ASSERT; + } + + /* throw the GRP reset flag complete flag */ + sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_RX_CMPLT); + + /* move the channel to the down state */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); + + } /* for ( i = circuit; i < (circuit + range + 1); i++) */ + +GRS_UNLOCK_ALL: + for ( i = sngss7_span->grs.circuit; i < (sngss7_span->grs.circuit + sngss7_span->grs.range + 1); i++) { + /* extract the channel in question */ + if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", i); + SS7_ASSERT; + } + + /* unlock the channel */ + ftdm_mutex_unlock(ftdmchan->mutex); + } + + } /* if (ftdmspan->grs.range > 0) */ + } /* master while loop */ + + /* clear the IN_THREAD flag so that we know the thread is done */ + ftdm_clear_flag (ftdmspan, FTDM_SPAN_IN_THREAD); + + ftdm_log (FTDM_LOG_INFO,"ftmod_sangoma_ss7 monitor thread for span=%u stopping.\n",ftdmspan->span_id); + + return NULL; ftdm_sangoma_ss7_run_exit: - /* clear the IN_THREAD flag so that we know the thread is done */ - ftdm_clear_flag(span, FTDM_SPAN_IN_THREAD); + /* clear the IN_THREAD flag so that we know the thread is done */ + ftdm_clear_flag (ftdmspan, FTDM_SPAN_IN_THREAD); - ftdm_log(FTDM_LOG_INFO, "ftmod_sangoma_ss7 monitor thread for span=%u stopping due to error.\n", span->span_id); + ftdm_log (FTDM_LOG_INFO,"ftmod_sangoma_ss7 monitor thread for span=%u stopping due to error.\n",ftdmspan->span_id); - ftdm_sangoma_ss7_stop(span); + ftdm_sangoma_ss7_stop (ftdmspan); - return NULL; + return NULL; } /******************************************************************************/ -static void ftdm_sangoma_ss7_process_state_change(ftdm_channel_t *ftdmchan) +static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) { - ftdm_sigmsg_t sigev; - ftdm_signaling_status_t status; - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - sngss7_chan_data_t *tmp_ss7info = NULL; - ftdm_channel_t *tmp_chan = NULL; - int i = 0; - - memset(&sigev, 0, sizeof(sigev)); - - sigev.chan_id = ftdmchan->chan_id; - sigev.span_id = ftdmchan->span_id; - sigev.channel = ftdmchan; - - /*first lock the channel*/ - ftdm_mutex_lock(ftdmchan->mutex); - - /*clear the state change flag...since we might be setting a new state*/ - ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE); - - /*check what state we are supposed to be in*/ - switch (ftdmchan->state) { - /**************************************************************************/ - case FTDM_CHANNEL_STATE_COLLECT: /* IAM received but wating on digits */ - ftdm_log(FTDM_LOG_DEBUG, "ftmod_sangoma_ss7 processing state %s on span=%u,chan=%u\n", - ftdm_channel_state2str(ftdmchan->state),ftdmchan->physical_span_id,ftdmchan->physical_chan_id); - - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); - break; - } - - while (ftdmchan->caller_data.cid_num.digits[i] != '\0') { - i++; - } - - /* check if the end of pulsing character has arrived or the right number of digits */ - if (ftdmchan->caller_data.cid_num.digits[i] == 0xF) { - SS7_DEBUG("Received the end of pulsing character\n"); - - /*now go to the RING state*/ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RING); - } else if (i >= g_ftdm_sngss7_data.min_digits) { - SS7_DEBUG("Received %d digits (min digits = %d)\n", i, g_ftdm_sngss7_data.min_digits); - - /*now go to the RING state*/ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RING); - } else { - SS7_INFO("Received %d out of %d so far: %s...starting T35\n", - i, - g_ftdm_sngss7_data.min_digits, - ftdmchan->caller_data.cid_num.digits); - - /* start ISUP t35 */ - if (ftdm_sched_timer(sngss7_info->t35.sched, - "t35", - sngss7_info->t35.beat, - sngss7_info->t35.callback, - &sngss7_info->t35, - &sngss7_info->t35.heartbeat_timer)) { - - SS7_ERROR("Unable to schedule timer, hanging up call!\n"); - - ftdmchan->caller_data.hangup_cause = 41; - - /* set the flag to indicate this hangup is started from the local side */ - sngss7_set_flag(sngss7_info, FLAG_LOCAL_REL); - - /* end the call */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); - } else { - if(ftdm_sched_free_run(sngss7_info->t35.sched)) { - SS7_ERROR("Unable to run timer, hanging up call!\n"); - - ftdmchan->caller_data.hangup_cause = 41; - - /* set the flag to indicate this hangup is started from the local side */ - sngss7_set_flag(sngss7_info, FLAG_LOCAL_REL); - - /* end the call */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_CANCEL); - } /* if(ftdm_sched_free_run(sngss7_info->t35.sched)) */ - } /* if (ftdm_sched_timer(sngss7_info->t35.sched, */ - - } /* checking ST/#digits */ - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_RING: /*incoming call request*/ - ftdm_log(FTDM_LOG_DEBUG, "ftmod_sangoma_ss7 processing state %s on span=%u,chan=%u\n", - ftdm_channel_state2str(ftdmchan->state),ftdmchan->physical_span_id,ftdmchan->physical_chan_id); - - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); - break; - } + ftdm_sigmsg_t sigev; + ftdm_signaling_status_t status; + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + int i = 0; + + memset (&sigev, 0, sizeof (sigev)); + + sigev.chan_id = ftdmchan->chan_id; + sigev.span_id = ftdmchan->span_id; + sigev.channel = ftdmchan; + + /*first lock the channel */ + ftdm_mutex_lock (ftdmchan->mutex); + + SS7_DEBUG_CHAN(ftdmchan, "ftmod_sangoma_ss7 processing state %s\n", ftdm_channel_state2str (ftdmchan->state)); + + /* clear the state change flag...since we might be setting a new state */ + ftdm_clear_flag (ftdmchan, FTDM_CHANNEL_STATE_CHANGE); + + /*check what state we are supposed to be in */ + switch (ftdmchan->state) { + /**************************************************************************/ + case FTDM_CHANNEL_STATE_COLLECT: /* IAM received but wating on digits */ + + if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { + SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); + break; + } + + while (ftdmchan->caller_data.dnis.digits[i] != '\0'){ + i++; + } + + /* check if the end of pulsing character has arrived or the right number of digits */ + if (ftdmchan->caller_data.dnis.digits[i] == 0xF) { + SS7_DEBUG_CHAN(ftdmchan, "Received the end of pulsing character %s\n", ""); + + /*now go to the RING state */ + ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_RING); + + } else if (i >= g_ftdm_sngss7_data.min_digits) { + SS7_DEBUG_CHAN(ftdmchan, "Received %d digits (min digits = %d)\n", i, g_ftdm_sngss7_data.min_digits); + + /*now go to the RING state */ + ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_RING); + + } else { + SS7_INFO_CHAN(ftdmchan,"Received %d out of %d so far: %s...starting T35\n", + i, + g_ftdm_sngss7_data.min_digits, + ftdmchan->caller_data.dnis.digits); + + /* start ISUP t35 */ + if (ftdm_sched_timer (sngss7_info->t35.sched, + "t35", + sngss7_info->t35.beat, + sngss7_info->t35.callback, + &sngss7_info->t35, + &sngss7_info->t35.heartbeat_timer)) { + + SS7_ERROR ("Unable to schedule timer, hanging up call!\n"); + + ftdmchan->caller_data.hangup_cause = 41; + + /* set the flag to indicate this hangup is started from the local side */ + sngss7_set_flag (sngss7_info, FLAG_LOCAL_REL); + + /* end the call */ + ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_CANCEL); + } /* if (ftdm_sched_timer(sngss7_info->t35.sched, */ + } /* checking ST/#digits */ + + break; + + /**************************************************************************/ + case FTDM_CHANNEL_STATE_RING: /*incoming call request */ + + if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { + SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); + break; + } /* kill t35 if active */ if (sngss7_info->t35.heartbeat_timer) { - ftdm_sched_cancel_timer(sngss7_info->t35.sched, &sngss7_info->t35.heartbeat_timer); - } - - - - SS7_DEBUG("Sending incoming call from %s to %s to FTDM core\n", - ftdmchan->caller_data.ani.digits, - ftdmchan->caller_data.dnis.digits); - - - /* we have enough information to inform FTDM of the call*/ - sigev.event_id = FTDM_SIGEVENT_START; - ftdm_span_send_signal(ftdmchan->span, &sigev); - - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_DIALING: /*outgoing call request*/ - ftdm_log(FTDM_LOG_DEBUG, "ftmod_sangoma_ss7 processing state %s on span=%u,chan=%u\n", - ftdm_channel_state2str(ftdmchan->state),ftdmchan->physical_span_id,ftdmchan->physical_chan_id); - - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); - break; - } - - /* clear the glare flag if it is on from a preivous call */ - sngss7_clear_flag(sngss7_info, FLAG_GLARE); - - /*call sangoma_ss7_dial to make outgoing call*/ - ft_to_sngss7_iam(ftdmchan); - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_PROGRESS: - ftdm_log(FTDM_LOG_DEBUG, "ftmod_sangoma_ss7 processing state %s on span=%u,chan=%u\n", - ftdm_channel_state2str(ftdmchan->state),ftdmchan->physical_span_id,ftdmchan->physical_chan_id); - - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); - break; - } - - /*check if the channel is inbound or outbound*/ - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - - /*OUTBOUND...so we were told by the line of this so noifiy the user*/ - sigev.event_id = FTDM_SIGEVENT_PROGRESS; - ftdm_span_send_signal(ftdmchan->span, &sigev); - - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); - - } else { - /* inbound call so we need to send out ACM */ - ft_to_sngss7_acm(ftdmchan); - } - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - ftdm_log(FTDM_LOG_DEBUG, "ftmod_sangoma_ss7 processing state %s on span=%u,chan=%u\n", - ftdm_channel_state2str(ftdmchan->state),ftdmchan->physical_span_id,ftdmchan->physical_chan_id); - - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); - break; - } - - /* nothing to do at this time */ - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_UP: /*call is accpeted...both incoming and outgoing*/ - ftdm_log(FTDM_LOG_DEBUG, "ftmod_sangoma_ss7 processing state %s on span=%u,chan=%u\n", - ftdm_channel_state2str(ftdmchan->state),ftdmchan->physical_span_id,ftdmchan->physical_chan_id); - - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); - break; - } - - /*check if the channel is inbound or outbound*/ - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { - /*OUTBOUND...so we were told by the line that the other side answered*/ - sigev.event_id = FTDM_SIGEVENT_UP; - ftdm_span_send_signal(ftdmchan->span, &sigev); - - } else { - /*INBOUND...so FS told us it was going to answer...tell the stack*/ - ft_to_sngss7_anm(ftdmchan); - } - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_CANCEL: - ftdm_log(FTDM_LOG_DEBUG, "ftmod_sangoma_ss7 processing state %s on span=%u,chan=%u\n", - ftdm_channel_state2str(ftdmchan->state),ftdmchan->physical_span_id,ftdmchan->physical_chan_id); - - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); - break; - } - - SS7_ERROR("Hanging up call before informing user on span = %d, chan = %d!\n", ftdmchan->physical_span_id,ftdmchan->physical_chan_id); - - /*now go to the HANGUP complete state*/ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_TERMINATING: /*call is hung up remotely*/ - ftdm_log(FTDM_LOG_DEBUG, "ftmod_sangoma_ss7 processing state %s on span=%u,chan=%u\n", - ftdm_channel_state2str(ftdmchan->state),ftdmchan->physical_span_id,ftdmchan->physical_chan_id); - - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); - break; - } - - /* set the flag to indicate this hangup is started from the remote side */ - sngss7_set_flag(sngss7_info, FLAG_REMOTE_REL); - - /*this state is set when the line is hanging up*/ - sigev.event_id = FTDM_SIGEVENT_STOP; - ftdm_span_send_signal(ftdmchan->span, &sigev); - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_HANGUP: /*call is hung up locally*/ - ftdm_log(FTDM_LOG_DEBUG, "ftmod_sangoma_ss7 processing state %s on span=%u,chan=%u\n", - ftdm_channel_state2str(ftdmchan->state),ftdmchan->physical_span_id,ftdmchan->physical_chan_id); - - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); - break; - } - - /* check for remote hangup flag */ - if (sngss7_test_flag(sngss7_info, FLAG_REMOTE_REL)) { - SS7_DEBUG("Hanging up remotely requested call!\n"); - } else { - SS7_DEBUG("Hanging up Locally requested call!\n"); - - /* set the flag to indicate this hangup is started from the local side */ - sngss7_set_flag(sngss7_info, FLAG_LOCAL_REL); - - /*this state is set when FS is hanging up...so tell the stack*/ - ft_to_sngss7_rel(ftdmchan); - } - - /*now go to the HANGUP complete state*/ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: - ftdm_log(FTDM_LOG_DEBUG, "ftmod_sangoma_ss7 processing state %s on span=%u,chan=%u\n", - ftdm_channel_state2str(ftdmchan->state),ftdmchan->physical_span_id,ftdmchan->physical_chan_id); - - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); - break; - } - - if (sngss7_test_flag(sngss7_info, FLAG_REMOTE_REL)) { - - /* check if this hangup is from a tx RSC */ - if (sngss7_test_flag(sngss7_info, FLAG_RESET_TX)) { - - /* go to RESTART State until RSCa is received */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - } else { - if (!(sngss7_test_flag(sngss7_info, FLAG_RESET_RX))) { - /* send out the release complete */ - ft_to_sngss7_rlc(ftdmchan); - } - /*now go to the DOWN state*/ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } - - SS7_DEBUG("Completing remotely requested hangup!\n"); - } else { - SS7_DEBUG("Completing locally requested hangup!\n"); - } - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_DOWN: /*the call is finished and removed*/ - ftdm_log(FTDM_LOG_DEBUG, "ftmod_sangoma_ss7 processing state %s on span=%u,chan=%u\n", - ftdm_channel_state2str(ftdmchan->state),ftdmchan->physical_span_id,ftdmchan->physical_chan_id); - - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { - SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); - break; - } + ftdm_sched_cancel_timer (sngss7_info->t35.sched,&sngss7_info->t35.heartbeat_timer); + } - /* check if t35 is active */ - if (sngss7_info->t35.heartbeat_timer) { - ftdm_sched_cancel_timer(sngss7_info->t35.sched, &sngss7_info->t35.heartbeat_timer); + SS7_DEBUG_CHAN(ftdmchan, "Sending incoming call from %s to %s to FTDM core\n", + ftdmchan->caller_data.ani.digits, + ftdmchan->caller_data.dnis.digits); + + + /* we have enough information to inform FTDM of the call */ + sigev.event_id = FTDM_SIGEVENT_START; + ftdm_span_send_signal (ftdmchan->span, &sigev); + + break; + /**************************************************************************/ + case FTDM_CHANNEL_STATE_DIALING: /*outgoing call request */ + + if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { + SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); + break; + } + + SS7_DEBUG_CHAN(ftdmchan, "Sending outgoing call from \"%s\" to \"%s\" to LibSngSS7\n", + ftdmchan->caller_data.ani.digits, + ftdmchan->caller_data.dnis.digits); + + /*call sangoma_ss7_dial to make outgoing call */ + ft_to_sngss7_iam(ftdmchan); + + break; + /**************************************************************************/ + case FTDM_CHANNEL_STATE_PROGRESS: + + if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { + SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); + break; + } + + /*check if the channel is inbound or outbound */ + if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + /*OUTBOUND...so we were told by the line of this so noifiy the user */ + sigev.event_id = FTDM_SIGEVENT_PROGRESS; + ftdm_span_send_signal (ftdmchan->span, &sigev); + + ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); + } else { + /* inbound call so we need to send out ACM */ + ft_to_sngss7_acm (ftdmchan); } - /* check if there is a reset response that needs to be sent */ - if (sngss7_test_flag(sngss7_info, FLAG_RESET_RX)) { - /* send a RLC */ - ft_to_sngss7_rsca(ftdmchan); + break; + /**************************************************************************/ + case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - /* inform Ftdm that the "sig" is up now for this channel */ - status = FTDM_SIG_STATE_UP; - sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.raw_data = &status; - ftdm_span_send_signal(ftdmchan->span, &sigev); - } + if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { + SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); + break; + } + + /* nothing to do at this time */ + break; + /**************************************************************************/ + case FTDM_CHANNEL_STATE_UP: /*call is accpeted...both incoming and outgoing */ + + if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { + SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); + break; + } + + /*check if the channel is inbound or outbound */ + if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + /*OUTBOUND...so we were told by the line that the other side answered */ + sigev.event_id = FTDM_SIGEVENT_UP; + ftdm_span_send_signal(ftdmchan->span, &sigev); + } else { + /*INBOUND...so FS told us it was going to answer...tell the stack */ + ft_to_sngss7_anm(ftdmchan); + } + + break; + /**************************************************************************/ + case FTDM_CHANNEL_STATE_CANCEL: + + if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { + SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); + break; + } + + SS7_ERROR_CHAN(ftdmchan,"Hanging up call before informing user%s\n", " "); + + /*now go to the HANGUP complete state */ + ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_HANGUP); + + break; + /**************************************************************************/ + case FTDM_CHANNEL_STATE_TERMINATING: /*call is hung up remotely */ + + if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { + SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); + break; + } + + /* set the flag to indicate this hangup is started from the remote side */ + sngss7_set_flag (sngss7_info, FLAG_REMOTE_REL); + + /*this state is set when the line is hanging up */ + sigev.event_id = FTDM_SIGEVENT_STOP; + ftdm_span_send_signal (ftdmchan->span, &sigev); + + break; + /**************************************************************************/ + case FTDM_CHANNEL_STATE_HANGUP: /*call is hung up locally */ + + if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { + SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); + break; + } + + /* check for remote hangup flag */ + if (sngss7_test_flag (sngss7_info, FLAG_REMOTE_REL)) { + /* remote release ...do nothing here */ + SS7_DEBUG_CHAN(ftdmchan,"Hanging up remotely requested call!%s\n", ""); + } else if (sngss7_test_flag (sngss7_info, FLAG_GLARE)) { + /* release due to glare */ + SS7_DEBUG_CHAN(ftdmchan,"Hanging up requested call do to glare%s\n", ""); + } else { + /* set the flag to indicate this hangup is started from the local side */ + sngss7_set_flag (sngss7_info, FLAG_LOCAL_REL); + + /*this state is set when FS is hanging up...so tell the stack */ + ft_to_sngss7_rel (ftdmchan); + + SS7_DEBUG_CHAN(ftdmchan,"Hanging up locally requested call!%s\n", ""); + } + + /*now go to the HANGUP complete state */ + ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); + + break; + + /**************************************************************************/ + case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: + + if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { + SS7_DEBUG("re-entering state from processing block/unblock request ... do nothing\n"); + break; + } + + if (sngss7_test_flag (sngss7_info, FLAG_REMOTE_REL)) { + /* check if this hangup is from a tx RSC */ + if (sngss7_test_flag (sngss7_info, FLAG_RESET_TX)) { + /* go to RESTART State until RSCa is received */ + ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_RESTART); + } else { + if (!(sngss7_test_flag (sngss7_info, FLAG_RESET_RX))) { + /* send out the release complete */ + ft_to_sngss7_rlc (ftdmchan); + } + + /*now go to the DOWN state */ + ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_DOWN); + } + + SS7_DEBUG_CHAN(ftdmchan,"Completing remotely requested hangup!%s\n", ""); + } else if (sngss7_test_flag (sngss7_info, FLAG_LOCAL_REL)) { + + /* if this hang up is do to a rx RESET we need to sit here till the RSP arrives */ + if (sngss7_test_flag (sngss7_info, FLAG_RESET_TX_RSP)) { + /* go to the down state as we have already received RSC-RLC */ + ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_DOWN); + } + + /* if it's a local release the user sends us to down */ + SS7_DEBUG_CHAN(ftdmchan,"Completing locally requested hangup!%s\n", ""); + } else if (sngss7_test_flag (sngss7_info, FLAG_GLARE)) { + SS7_DEBUG_CHAN(ftdmchan,"Completing requested hangup due to glare!%s\n", ""); + + ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_DOWN); + } else { + SS7_DEBUG_CHAN(ftdmchan,"Completing requested hangup for unknown reason!%s\n", ""); + } + + break; + + /**************************************************************************/ + case FTDM_CHANNEL_STATE_DOWN: /*the call is finished and removed */ + + /* check if there is a reset response that needs to be sent */ + if (sngss7_test_flag (sngss7_info, FLAG_RESET_RX)) { + /* send a RSC-RLC */ + ft_to_sngss7_rsca (ftdmchan); + + /* clear the reset flag */ + sngss7_clear_flag (sngss7_info, FLAG_RESET_RX); + } /* check if there was a GRS that needs a GRA */ - if (sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_RX)) { - /* check all the circuits in the range to see if we are the last ckt to reset */ - for (i = sngss7_info->grs.circuit; i < (sngss7_info->grs.range + 1); i++) { - if (g_ftdm_sngss7_data.cfg.isupCircuit[i].siglink == 0) { - /* extract the sngss7_info for the circuit */ - tmp_ss7info = g_ftdm_sngss7_data.cfg.isupCircuit[i].obj; - tmp_chan = tmp_ss7info->ftdmchan; - /* check if the circuit is done going through reset */ /* KONRAD FIX ME...better way to check this??? */ - if (!(tmp_chan->state == FTDM_CHANNEL_STATE_DOWN) && (sngss7_test_flag(tmp_ss7info, FLAG_GRP_RESET_RX))) { - /* exit the for loop since we found a circuit still in reset */ - continue; - } /* if inreset */ - } /* if not siglink */ - } /* for */ - - /* if we got through the whole range send out a GRA */ - if (i == (sngss7_info->grs.range + 1)) { + if ((sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_RX)) && + (sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_RX_DN)) && + (sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_RX_CMPLT))) { + + /* check if this is the base circuit and send out the GRA + * we insure that this is the last circuit to have the state change queued + */ + sngss7_span_data_t *span = ftdmchan->span->mod_data; + if (span->grs.circuit == sngss7_info->circuit->id) { + /* send out the GRA */ ft_to_sngss7_gra(ftdmchan); + + /* clean out the spans GRS structure */ + sngss7_span_data_t *span = ftdmchan->span->mod_data; + span->grs.circuit = 0; + span->grs.range = 0; } + + /* clear the grp reset flag */ + sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_RX); + sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_RX_DN); + sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_RX_CMPLT); + + }/* if ( sngss7_test_flag ( sngss7_info, FLAG_GRP_RESET_RX ) ) */ + + /* check if we got the reset response */ + if (sngss7_test_flag(sngss7_info, FLAG_RESET_TX_RSP)) { + /* clear the reset flag */ + sngss7_clear_flag(sngss7_info, FLAG_RESET_TX_RSP); + sngss7_clear_flag(sngss7_info, FLAG_RESET_TX); } - /* check if we got the reset response */ - if (sngss7_test_flag(sngss7_info, FLAG_RESET_TX)) { - /* inform Ftdm that the "sig" is up now for this channel */ - status = FTDM_SIG_STATE_UP; - sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.raw_data = &status; - ftdm_span_send_signal(ftdmchan->span, &sigev); - } - - /* check if the circuit has the glare flag up */ - if (sngss7_test_flag(sngss7_info, FLAG_GLARE)) { - sngss7_info->suInstId = 0; - sngss7_info->spInstId = 0; - sngss7_info->globalFlg = 0; - sngss7_info->spId = 0; - sngss7_info->flags = 0; - sngss7_set_flag(sngss7_info, FLAG_GLARE); - - /* close the channel */ - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) { - ftdm_channel_t *close_chan = ftdmchan; - /* close the channel */ - ftdm_channel_close(&close_chan); + if (sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP)) { + /* clear the reset flag */ + sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_TX_RSP); + sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_TX); + sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_BASE); + sngss7_clear_flag(sngss7_info, FLAG_GRP_RESET_SENT); + } + + /* check if we came from reset (aka we just processed a reset) */ + if ((ftdmchan->last_state == FTDM_CHANNEL_STATE_RESTART) || + (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED)) { + + /* check if reset flags are up indicating there is more processing to do yet */ + if (!(sngss7_test_flag (sngss7_info, FLAG_RESET_TX)) && + !(sngss7_test_flag (sngss7_info, FLAG_RESET_RX)) && + !(sngss7_test_flag (sngss7_info, FLAG_GRP_RESET_TX)) && + !(sngss7_test_flag (sngss7_info, FLAG_GRP_RESET_RX))) { + + /* check if the sig status is down, and bring it up if it isn't */ + if (!ftdm_test_flag (ftdmchan, FTDM_CHANNEL_SIG_UP)) { + SS7_DEBUG_CHAN(ftdmchan,"All reset flags cleared %s\n", ""); + /* all flags are down so we can bring up the sig status */ + status = FTDM_SIG_STATE_UP; + sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; + sigev.raw_data = &status; + ftdm_span_send_signal (ftdmchan->span, &sigev); } + } else { + + SS7_DEBUG_CHAN(ftdmchan,"Reset flags present (0x%X)\n", sngss7_info->flags); + + /* there is still another reset pending so go back to reset*/ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); + } + } /* if ((ftdmchan->last_state == FTDM_CHANNEL_STATE_RESTART) */ - /* check if the glare was caused by in incoming call aka glare structure is valid */ - if (sngss7_info->glare.circuit != 0) { - SS7_DEBUG("Glare flag is up....spoofing incoming call on span=%d, chan=%d (Cir=%d)\n", - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id, - sngss7_info->glare.circuit); - /* clear all the call specific data */ - - /* spoof an incoming call */ - sngss7_con_ind(sngss7_info->glare.suInstId, - sngss7_info->glare.spInstId, - sngss7_info->glare.circuit, - &sngss7_info->glare.iam); + /* check if t35 is active */ + if (sngss7_info->t35.heartbeat_timer) { + ftdm_sched_cancel_timer (sngss7_info->t35.sched, &sngss7_info->t35.heartbeat_timer); + } + + /* clear all of the call specific data store in the channel structure */ + sngss7_info->suInstId = 0; + sngss7_info->spInstId = 0; + sngss7_info->globalFlg = 0; + sngss7_info->spId = 0; + + /* clear any call related flags */ + sngss7_clear_flag (sngss7_info, FLAG_REMOTE_REL); + sngss7_clear_flag (sngss7_info, FLAG_LOCAL_REL); + + + if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_OPEN)) { + ftdm_channel_t *close_chan = ftdmchan; + /* close the channel */ + ftdm_channel_close (&close_chan); + } + + break; + /**************************************************************************/ + case FTDM_CHANNEL_STATE_RESTART: /* CICs needs a Reset */ + + if (sngss7_test_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK)) { + if ((sngss7_test_flag(sngss7_info, FLAG_RESET_RX)) || + (sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_RX))) { + + SS7_DEBUG_CHAN(ftdmchan,"Incoming Reset request on CIC in UCIC block, removing UCIC block%s\n", ""); + + /* set the unblk flag */ + sngss7_set_flag(sngss7_info, FLAG_CKT_UCIC_UNBLK); + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); + + /* break out of the processing for now */ + break; } - } else { - /* clear all of the call specific data store in the channel structure */ - sngss7_info->suInstId = 0; - sngss7_info->spInstId = 0; - sngss7_info->globalFlg = 0; - sngss7_info->spId = 0; - sngss7_info->flags = 0; - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OPEN)) { - ftdm_channel_t *close_chan = ftdmchan; - /* close the channel */ - ftdm_channel_close(&close_chan); - } - } - - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_RESTART: /* CICs needs a Reset */ - ftdm_log(FTDM_LOG_DEBUG, "ftmod_sangoma_ss7 processing state %s on span=%u,chan=%u\n", - ftdm_channel_state2str(ftdmchan->state),ftdmchan->physical_span_id,ftdmchan->physical_chan_id); - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_INUSE)) { - /* bring the call down first...then process the rest of the reset */ - switch (ftdmchan->last_state) { - /******************************************************************/ - case(FTDM_CHANNEL_STATE_TERMINATING): - case(FTDM_CHANNEL_STATE_HANGUP): - case(FTDM_CHANNEL_STATE_HANGUP_COMPLETE): - /* go back to the last state after taking care of the rest of the restart state */ - ftdm_set_state_locked(ftdmchan, ftdmchan->last_state); - break; - /******************************************************************/ - default: - /* KONRAD: find out what the cause code should be */ - ftdmchan->caller_data.hangup_cause = 41; - - /* change the state to terminatting, it will throw us back here - * once the call is done - */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); - break; - /******************************************************************/ - } - } else { - - /* check if this an incoming RSC */ - if (sngss7_test_flag(sngss7_info, FLAG_RESET_RX) || sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_RX)) { - /* go to a down state to clear the channel and send RSCa */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN); - } /* if (sngss7_test_flag(sngss7_info, FLAG_RESET_RX)) */ - } /* if (inuse) */ - - /* check if this is an outgoing RSC */ - if (sngss7_test_flag(sngss7_info, FLAG_RESET_TX)) { - - /* make sure we aren't coming from hanging up a call */ - if (ftdmchan->last_state != FTDM_CHANNEL_STATE_HANGUP_COMPLETE) { - /* send a reset request */ - ft_to_sngss7_rsc(ftdmchan); - } - - /* don't change to the DOWN state as we need to wait for the RSCa */ - } /* if (sngss7_test_flag(sngss7_info, FLAG_RESET_TX)) */ - - /* send a sig event to the core to disable the channel */ - status = FTDM_SIG_STATE_DOWN; - sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.raw_data = &status; - ftdm_span_send_signal(ftdmchan->span, &sigev); - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_SUSPENDED: /* circuit has been blocked */ - ftdm_log(FTDM_LOG_DEBUG, "ftmod_sangoma_ss7 processing state %s on span=%u,chan=%u\n", - ftdm_channel_state2str(ftdmchan->state),ftdmchan->physical_span_id,ftdmchan->physical_chan_id); - - /**********************************************************************/ - if (sngss7_test_flag(sngss7_info, FLAG_INFID_PAUSED)) { - SS7_DEBUG("processing pause for span = %, chan = %d\n",ftdmchan->physical_span_id,ftdmchan->physical_chan_id); - /* bring the channel signaling status to down */ - status = FTDM_SIG_STATE_DOWN; - sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.raw_data = &status; - ftdm_span_send_signal(ftdmchan->span, &sigev); - - /* check the last state and return to it to allow the call to finish */ - ftdm_set_state_locked(ftdmchan, ftdmchan->last_state); - } - if (sngss7_test_flag(sngss7_info, FLAG_INFID_RESUME)) { - SS7_DEBUG("processing resume for span = %, chan = %d\n",ftdmchan->physical_span_id,ftdmchan->physical_chan_id); - /* we just resumed...throw the channel into reset */ - sngss7_set_flag(sngss7_info, FLAG_RESET_TX); - - /* clear the resume flag */ - sngss7_clear_flag(sngss7_info, FLAG_INFID_RESUME); - - /* go to restart state */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - } - /**********************************************************************/ - if (sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) { - SS7_DEBUG("processing rx Mn ckt block for span = %, chan = %d\n",ftdmchan->physical_span_id,ftdmchan->physical_chan_id); - /* bring the channel signaling status to down */ - status = FTDM_SIG_STATE_DOWN; - sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.raw_data = &status; - ftdm_span_send_signal(ftdmchan->span, &sigev); - - /* send a BLA */ - ft_to_sngss7_bla(ftdmchan); - - /* check the last state and return to it to allow the call to finish */ - ftdm_set_state_locked(ftdmchan, ftdmchan->last_state); - } - if (sngss7_test_flag(sngss7_info, FLAG_CKT_MN_UNBLK_RX)) { - SS7_DEBUG("processing rx Mn ckt unblock for span = %, chan = %d\n",ftdmchan->physical_span_id,ftdmchan->physical_chan_id); - /* bring the channel signaling status to up */ - status = FTDM_SIG_STATE_UP; - sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.raw_data = &status; - ftdm_span_send_signal(ftdmchan->span, &sigev); - - /* clear the unblock flag */ - sngss7_clear_flag(sngss7_info, FLAG_CKT_MN_UNBLK_RX); - - /* send a uba */ - ft_to_sngss7_uba(ftdmchan); - - /* check the last state and return to it to allow the call to finish */ - ftdm_set_state_locked(ftdmchan, ftdmchan->last_state); - } - /**********************************************************************/ - if (sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) { - SS7_DEBUG("processing tx Mn ckt block for span = %, chan = %d\n",ftdmchan->physical_span_id,ftdmchan->physical_chan_id); - /* bring the channel signaling status to down */ - status = FTDM_SIG_STATE_DOWN; - sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.raw_data = &status; - ftdm_span_send_signal(ftdmchan->span, &sigev); - - /* send a blo */ - ft_to_sngss7_blo(ftdmchan); - - /* check the last state and return to it to allow the call to finish */ - ftdm_set_state_locked(ftdmchan, ftdmchan->last_state); - } - if (sngss7_test_flag(sngss7_info, FLAG_CKT_MN_UNBLK_TX)) { - SS7_DEBUG("processing tx Mn ckt unblock for span = %, chan = %d\n",ftdmchan->physical_span_id,ftdmchan->physical_chan_id); - /* bring the channel signaling status to up */ - status = FTDM_SIG_STATE_UP; - sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.raw_data = &status; - ftdm_span_send_signal(ftdmchan->span, &sigev); - - /* clear the unblock flag */ - sngss7_clear_flag(sngss7_info, FLAG_CKT_MN_UNBLK_TX); - - /* send a ubl */ - ft_to_sngss7_ubl(ftdmchan); - - /* check the last state and return to it to allow the call to finish */ - ftdm_set_state_locked(ftdmchan, ftdmchan->last_state); - } - /**********************************************************************/ - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_IN_LOOP: /* COT test */ - ftdm_log(FTDM_LOG_DEBUG, "ftmod_sangoma_ss7 processing state %s on span=%u,chan=%u\n", - ftdm_channel_state2str(ftdmchan->state),ftdmchan->physical_span_id,ftdmchan->physical_chan_id); - - /* send the lpa */ - ft_to_sngss7_lpa(ftdmchan); - - break; - /**************************************************************************/ - case FTDM_CHANNEL_STATE_HOLD: - case FTDM_CHANNEL_STATE_DIALTONE: - case FTDM_CHANNEL_STATE_BUSY: - case FTDM_CHANNEL_STATE_ATTN: - case FTDM_CHANNEL_STATE_GENRING: - case FTDM_CHANNEL_STATE_GET_CALLERID: - case FTDM_CHANNEL_STATE_CALLWAITING: - case FTDM_CHANNEL_STATE_IDLE: - case FTDM_CHANNEL_STATE_INVALID: - ftdm_log(FTDM_LOG_DEBUG, "ftmod_sangoma_ss7 does not support state %s on span=%u,chan=%u\n", - ftdm_channel_state2str(ftdmchan->state),ftdmchan->physical_span_id,ftdmchan->physical_chan_id); - break; - /**************************************************************************/ - default: - /*this is bad...we're in an unknown state...should we kill this channel???*/ - ftdm_log(FTDM_LOG_ERROR, "ftmod_sangoma_ss7 in unknown state %s on span=%u,chan=%u\n", - ftdm_channel_state2str(ftdmchan->state),ftdmchan->physical_span_id,ftdmchan->physical_chan_id); - break; - } /*switch (ftdmchan->state)*/ - - /*unlock*/ - ftdm_mutex_unlock(ftdmchan->mutex); - - return; -} -/******************************************************************************/ + } -/******************************************************************************/ -static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(ftdm_sangoma_ss7_outgoing_call) -{ - sngss7_chan_data_t *sngss7_info; - int c; + /* if we're not coming from HANGUP_COMPLETE we need to check for resets + * we can also check if we are in a PAUSED state (no point in sending message + */ + if ((ftdmchan->last_state != FTDM_CHANNEL_STATE_HANGUP_COMPLETE) && + (!sngss7_test_flag(sngss7_info, FLAG_INFID_PAUSED))) { + + /* check if this is an outgoing RSC */ + if ((sngss7_test_flag(sngss7_info, FLAG_RESET_TX)) && + !(sngss7_test_flag(sngss7_info, FLAG_RESET_SENT))) { + + /* send a reset request */ + ft_to_sngss7_rsc (ftdmchan); + sngss7_set_flag(sngss7_info, FLAG_RESET_SENT); + + } /* if (sngss7_test_flag(sngss7_info, FLAG_RESET_TX)) */ + + /* check if this is the first channel of a GRS (this flag is thrown when requesting reset) */ + if ( (sngss7_test_flag (sngss7_info, FLAG_GRP_RESET_TX)) && + !(sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_SENT)) && + (sngss7_test_flag(sngss7_info, FLAG_GRP_RESET_BASE))) { + + /* send out the grs */ + ft_to_sngss7_grs (ftdmchan); + sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_SENT); + + }/* if ( sngss7_test_flag ( sngss7_info, FLAG_GRP_RESET_TX ) ) */ + } /* if ( last_state != HANGUP && !PAUSED */ + + /* if the sig_status is up...bring it down */ + if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_SIG_UP)) { + status = FTDM_SIG_STATE_DOWN; + sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; + sigev.raw_data = &status; + ftdm_span_send_signal (ftdmchan->span, &sigev); + } - /* lock the channel while we check whether it is availble */ - ftdm_mutex_lock(ftdmchan->mutex); + if (sngss7_test_flag (sngss7_info, FLAG_GRP_RESET_RX)) { + /* set the grp reset done flag so we know we have finished this reset */ + sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_RX_DN); + } /* if (sngss7_test_flag (sngss7_info, FLAG_GRP_RESET_RX)) */ + + + if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_INUSE)) { + /* bring the call down first...then process the rest of the reset */ + switch (ftdmchan->last_state){ + /******************************************************************/ + case (FTDM_CHANNEL_STATE_TERMINATING): + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP); + break; + /******************************************************************/ + case (FTDM_CHANNEL_STATE_HANGUP): + case (FTDM_CHANNEL_STATE_HANGUP_COMPLETE): + /* go back to the last state after taking care of the rest of the restart state */ + ftdm_set_state_locked (ftdmchan, ftdmchan->last_state); + break; + /******************************************************************/ + default: + /* KONRAD: find out what the cause code should be */ + ftdmchan->caller_data.hangup_cause = 41; + + /* change the state to terminatting, it will throw us back here + * once the call is done + */ + ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_TERMINATING); + break; + /******************************************************************/ + } /* switch (ftdmchan->last_state) */ + } else { + /* check if this an incoming RSC or we have a response already */ + if (sngss7_test_flag (sngss7_info, FLAG_RESET_RX) || + sngss7_test_flag (sngss7_info, FLAG_RESET_TX_RSP) || + sngss7_test_flag (sngss7_info, FLAG_GRP_RESET_TX_RSP) || + sngss7_test_flag (sngss7_info, FLAG_GRP_RESET_RX_CMPLT)) { + + SS7_DEBUG_CHAN(ftdmchan, "Reset processed moving to DOWN (0x%X)\n", sngss7_info->flags); + + /* go to a down state to clear the channel and send the response */ + ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_DOWN); + } else { + SS7_DEBUG_CHAN(ftdmchan, "Waiting on Reset Rsp/Grp Reset to move to DOWN (0x%X)\n", sngss7_info->flags); + } + } - switch (ftdmchan->state) { - /**************************************************************************/ - case FTDM_CHANNEL_STATE_DOWN: - /* inform the monitor thread that we want to make a call */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DIALING); + break; + /**************************************************************************/ + case FTDM_CHANNEL_STATE_SUSPENDED: /* circuit has been blocked */ - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); + SS7_DEBUG_CHAN(ftdmchan,"Current flags: 0x%X\n", sngss7_info->flags); - /* now we have to wait for either the stack to reject the call because of - * glare or for the network to acknowledge the call - */ - c = 0; - while (c < 100) { + /**********************************************************************/ + if (sngss7_test_flag (sngss7_info, FLAG_INFID_PAUSED)) { + SS7_DEBUG_CHAN(ftdmchan, "Processing PAUSE flag %s\n", ""); + + /* bring the channel signaling status to down */ + status = FTDM_SIG_STATE_DOWN; + sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; + sigev.raw_data = &status; + ftdm_span_send_signal (ftdmchan->span, &sigev); - /* lock the channel while we check whether it is availble */ - ftdm_mutex_lock(ftdmchan->mutex); + /* check the last state and return to it to allow the call to finish */ + goto suspend_goto_last; + } - /* check if there is a pending state change, give it a bit to clear */ - if (check_for_state_change(ftdmchan)) { - SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); - ftdm_mutex_unlock(ftdmchan->mutex); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - }; + if (sngss7_test_flag (sngss7_info, FLAG_INFID_RESUME)) { + SS7_DEBUG_CHAN(ftdmchan, "Processing RESUME flag %s\n", ""); - /* extract the sngss7_chan_data structure */ - sngss7_info = (sngss7_chan_data_t *)ftdmchan->call_data; + /* the reset flag is set for the first channel in the span at handle_resume */ - if (sngss7_test_flag(sngss7_info, FLAG_GLARE)) { - SS7_ERROR("Glare flag on span=%d,chan=%d\n", - ftdmchan->physical_span_id,ftdmchan->physical_chan_id); + /* clear the resume flag */ + sngss7_clear_flag(sngss7_info, FLAG_INFID_RESUME); - /* kill the timer */ - if (sngss7_info->t35.heartbeat_timer) { - ftdm_sched_cancel_timer(sngss7_info->t35.sched, &sngss7_info->t35.heartbeat_timer); - } + /* go to restart state */ + goto suspend_goto_last; + } - goto outgoing_glare; - } - - switch (ftdmchan->state) { - /******************************************************************/ - case FTDM_CHANNEL_STATE_DIALING: - break; - /******************************************************************/ - case FTDM_CHANNEL_STATE_PROGRESS: - case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: - case FTDM_CHANNEL_STATE_UP: - goto outgoing_successful; - break; - /******************************************************************/ - default: - SS7_ERROR("Channel in invalid state (%s) on span=%d,chan=%d...fail\n", - ftdm_channel_state2str(ftdmchan->state), - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id); - goto outgoing_fail; - break; - /******************************************************************/ - } - - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - - /* sleep for a bit to let the state change */ - ftdm_sleep(10); - - /* increment the timeout counter */ - c++; - - } /* while (c < 4) */ - - /* if we got here we have timed-out waiting for acknowledgment, kill the call */ - SS7_DEBUG("Timeout waiting for outgoing call to be accepted by network, ok'ing outgoing call on span=%d,chan=%d\n", - ftdmchan->physical_span_id,ftdmchan->physical_chan_id); - - /* consider the call good .... for now */ - goto outgoing_successful; - - break; - /**************************************************************************/ - default: - /* the channel is already used...this can't be, end the request */ - SS7_ERROR("Outgoing call requested channel in already in use...indicating glare on span=%d,chan=%d\n", - ftdmchan->physical_span_id,ftdmchan->physical_chan_id); - goto outgoing_glare; - break; - /**************************************************************************/ - } + /**********************************************************************/ + if (sngss7_test_flag (sngss7_info, FLAG_CKT_MN_BLOCK_RX)) { + SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_BLOCK_RX flag %s\n", ""); -outgoing_fail: - SS7_DEBUG("Call Request on span=%d, chan=%d failed\n"); - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); + /* send a BLA */ + ft_to_sngss7_bla (ftdmchan); - return FTDM_FAIL; + /* check the last state and return to it to allow the call to finish */ + goto suspend_goto_last; + } -outgoing_glare: - SS7_DEBUG("Indicating glare on span=%d, chan=%d\n"); - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - return FTDM_BREAK; + if (sngss7_test_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX)){ + SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_UNBLK_RX flag %s\n", ""); -outgoing_successful: - SS7_DEBUG("Call Request on span=%d, chan=%d successful\n"); - /* unlock the channel */ - ftdm_mutex_unlock(ftdmchan->mutex); - return FTDM_SUCCESS; + /* clear the unblock flag */ + sngss7_clear_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX); + + /* send a uba */ + ft_to_sngss7_uba (ftdmchan); + + /* check the last state and return to it to allow the call to finish */ + goto suspend_goto_last; + } + + /**********************************************************************/ + if (sngss7_test_flag (sngss7_info, FLAG_CKT_MN_BLOCK_TX)) { + SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_BLOCK_TX flag %s\n", ""); + + /* send a blo */ + ft_to_sngss7_blo (ftdmchan); + + /* check the last state and return to it to allow the call to finish */ + goto suspend_goto_last; + } + + if (sngss7_test_flag (sngss7_info, FLAG_CKT_MN_UNBLK_TX)){ + SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_UNBLK_TX flag %s\n", ""); + + /* clear the unblock flag */ + sngss7_clear_flag (sngss7_info, FLAG_CKT_MN_UNBLK_TX); + + /* send a ubl */ + ft_to_sngss7_ubl (ftdmchan); + + /* check the last state and return to it to allow the call to finish */ + goto suspend_goto_last; + } + + /**********************************************************************/ + if (sngss7_test_flag (sngss7_info, FLAG_CKT_LC_BLOCK_RX)) { + SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_LC_BLOCK_RX flag %s\n", ""); + + /* send a BLA */ + /*ft_to_sngss7_bla(ftdmchan);*/ + + /* check the last state and return to it to allow the call to finish */ + goto suspend_goto_last; + } + + if (sngss7_test_flag (sngss7_info, FLAG_CKT_LC_UNBLK_RX)) { + SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_LC_UNBLK_RX flag %s\n", ""); + + /* clear the unblock flag */ + sngss7_clear_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX); + + /* send a uba */ + /*ft_to_sngss7_uba(ftdmchan);*/ + + /* check the last state and return to it to allow the call to finish */ + goto suspend_goto_last; + } + /**********************************************************************/ + if (sngss7_test_flag (sngss7_info, FLAG_CKT_UCIC_BLOCK)) { + SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_UCIC_BLOCK flag %s\n", ""); + + /* bring the channel signaling status to down */ + status = FTDM_SIG_STATE_DOWN; + sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; + sigev.raw_data = &status; + ftdm_span_send_signal (ftdmchan->span, &sigev); + + /* remove any reset flags */ + sngss7_clear_flag (sngss7_info, FLAG_GRP_RESET_TX_RSP); + sngss7_clear_flag (sngss7_info, FLAG_GRP_RESET_TX); + sngss7_clear_flag (sngss7_info, FLAG_RESET_TX_RSP); + sngss7_clear_flag (sngss7_info, FLAG_RESET_TX); + sngss7_clear_flag (sngss7_info, FLAG_RESET_SENT); + sngss7_clear_flag (sngss7_info, FLAG_GRP_RESET_RX); + sngss7_clear_flag (sngss7_info, FLAG_RESET_RX); + sngss7_clear_flag (sngss7_info, FLAG_GRP_RESET_BASE); + + /* bring the channel down */ + goto suspend_goto_last; + } + + if (sngss7_test_flag (sngss7_info, FLAG_CKT_UCIC_UNBLK)) { + SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_UCIC_UNBLK flag %s\n", "");; + + /* throw the channel into reset from our side since it is already in reset from the remote side */ + sngss7_set_flag (sngss7_info, FLAG_RESET_TX); + + /* bring the channel into restart again */ + goto suspend_goto_restart; + } + +suspend_goto_last: + ftdm_set_state_locked (ftdmchan, ftdmchan->last_state); + break; + +suspend_goto_restart: + ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_RESTART); + break; + +/**************************************************************************/ + case FTDM_CHANNEL_STATE_IN_LOOP: /* COT test */ + + /* send the lpa */ + ft_to_sngss7_lpa (ftdmchan); + + break; + /**************************************************************************/ + case FTDM_CHANNEL_STATE_IDLE: + ftdm_set_state_locked(ftdmchan, ftdmchan->last_state); + break; + /**************************************************************************/ + default: + /* we don't handle any of the other states */ + SS7_ERROR_CHAN(ftdmchan, "ftmod_sangoma_ss7 does not support %s state\n", ftdm_channel_state2str (ftdmchan->state)); + + break; + /**************************************************************************/ + }/*switch (ftdmchan->state) */ + + /*unlock */ + ftdm_mutex_unlock (ftdmchan->mutex); + + return; } + /******************************************************************************/ -#if 0 -static FIO_CHANNEL_REQUEST_FUNCTION(ftdm_sangoma_ss7_request_chan) +static FIO_CHANNEL_OUTGOING_CALL_FUNCTION(ftdm_sangoma_ss7_outgoing_call) { - SS7_INFO("KONRAD-> I got called %s\n",__FUNCTION__); - return FTDM_SUCCESS; + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + + /* lock the channel while we check whether it is availble */ + ftdm_mutex_lock (ftdmchan->mutex); + + /* check if there is a pending state change, give it a bit to clear */ + if (check_for_state_change(ftdmchan)) { + SS7_ERROR("Failed to wait for pending state change on CIC = %d\n", sngss7_info->circuit->cic); + ftdm_mutex_unlock(ftdmchan->mutex); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + SS7_ASSERT; + }; + + if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) { + SS7_ERROR_CHAN(ftdmchan, "Requested channel sig state is down, cancelling call!%s\n", " "); + goto outgoing_fail; + } + + if ((sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX)) || + (sngss7_test_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX)) || + (sngss7_test_flag(sngss7_info, FLAG_GRP_MN_BLOCK_RX))) { + + /* the channel is blocked...can't send any calls here */ + SS7_ERROR_CHAN(ftdmchan, "Requested channel is remotely blocked, re-hunt channel!%s\n", " "); + goto outgoing_break; + } + + if ((sngss7_test_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX)) || + (sngss7_test_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX)) || + (sngss7_test_flag(sngss7_info, FLAG_GRP_MN_BLOCK_TX))) { + + /* the channel is blocked...can't send any calls here */ + SS7_ERROR_CHAN(ftdmchan, "Requested channel is locally blocked, re-hunt channel!%s\n", " "); + goto outgoing_break; + } + + switch (ftdmchan->state){ + /**************************************************************************/ + case FTDM_CHANNEL_STATE_DOWN: + /* inform the monitor thread that we want to make a call */ + ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_DIALING); + + /* unlock the channel */ + ftdm_mutex_unlock (ftdmchan->mutex); + + goto outgoing_successful; + break; + /**************************************************************************/ + default: + /* the channel is already used...this can't be, end the request */ + SS7_ERROR("Outgoing call requested channel in already in use...indicating glare on span=%d,chan=%d\n", + ftdmchan->physical_span_id, + ftdmchan->physical_chan_id); + + goto outgoing_fail; + break; + /**************************************************************************/ + } /* switch (ftdmchan->state) (original call) */ + +outgoing_fail: + SS7_DEBUG_CHAN(ftdmchan, "Call Request failed%s\n", " "); + /* unlock the channel */ + ftdm_mutex_unlock (ftdmchan->mutex); + return FTDM_FAIL; + +outgoing_break: + SS7_DEBUG_CHAN(ftdmchan, "Call Request re-hunt%s\n", " "); + /* unlock the channel */ + ftdm_mutex_unlock (ftdmchan->mutex); + return FTDM_BREAK; + +outgoing_successful: + SS7_DEBUG_CHAN(ftdmchan, "Call Request successful%s\n", " "); + /* unlock the channel */ + ftdm_mutex_unlock (ftdmchan->mutex); + return FTDM_SUCCESS; } + +/******************************************************************************/ +#if 0 + static FIO_CHANNEL_REQUEST_FUNCTION (ftdm_sangoma_ss7_request_chan) + { + SS7_INFO ("KONRAD-> I got called %s\n", __FUNCTION__); + return FTDM_SUCCESS; + } + #endif /******************************************************************************/ -/* FT-CORE SIG STATUS FUNCTIONS ***********************************************/ +/* FT-CORE SIG STATUS FUNCTIONS ********************************************** */ static FIO_CHANNEL_GET_SIG_STATUS_FUNCTION(ftdm_sangoma_ss7_get_sig_status) { - - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) { - *status = FTDM_SIG_STATE_UP; - } else { - *status = FTDM_SIG_STATE_DOWN; - } - - return FTDM_SUCCESS; + if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_SIG_UP)) { + *status = FTDM_SIG_STATE_UP; + } else { + *status = FTDM_SIG_STATE_DOWN; + } + + return FTDM_SUCCESS; } +/******************************************************************************/ static FIO_CHANNEL_SET_SIG_STATUS_FUNCTION(ftdm_sangoma_ss7_set_sig_status) { - SS7_ERROR("Cannot set channel status in this module\n"); - - return FTDM_NOTIMPL; + SS7_ERROR ("Cannot set channel status in this module\n"); + return FTDM_NOTIMPL; } -/* FT-CORE SIG FUNCTIONS *******************************************************/ -static ftdm_status_t ftdm_sangoma_ss7_start(ftdm_span_t *span) +/* FT-CORE SIG FUNCTIONS ******************************************************/ +static ftdm_status_t ftdm_sangoma_ss7_start(ftdm_span_t * span) { - SS7_INFO("Starting span %s:%u.\n",span->name,span->span_id); + ftdm_channel_t *ftdmchan = NULL; + sngss7_chan_data_t *sngss7_info = NULL; + int x; + - /* clear the monitor thread stop flag */ - ftdm_clear_flag(span, FTDM_SPAN_STOP_THREAD); - ftdm_clear_flag(span, FTDM_SPAN_IN_THREAD); + SS7_INFO ("Starting span %s:%u.\n", span->name, span->span_id); - /* activate all the configured ss7 links */ - if (ft_to_sngss7_activate_all()) { - SS7_CRITICAL("Failed to activate LibSngSS7!\n"); - return FTDM_FAIL; - } + /* throw the channels in pause */ + for (x = 1; x < (span->chan_count + 1); x++) { + /* extract the channel structure and sngss7 channel data */ + ftdmchan = span->channels[x]; + sngss7_info = ftdmchan->call_data; - /*start the span monitor thread*/ - if(ftdm_thread_create_detached(ftdm_sangoma_ss7_run, span) != FTDM_SUCCESS) { - SS7_CRITICAL("Failed to start Span Monitor Thread!\n"); - return FTDM_FAIL; - } + /* lock the channel */ + ftdm_mutex_lock(ftdmchan->mutex); - SS7_DEBUG("Finished starting span %s:%u.\n",span->name,span->span_id); + /* throw the pause flag */ + sngss7_set_flag(sngss7_info, FLAG_INFID_PAUSED); - return FTDM_SUCCESS; + /* throw the grp reset flag */ + sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_TX); + if (x == 1) { + sngss7_set_flag(sngss7_info, FLAG_GRP_RESET_BASE); + } + + /* throw the channel to suspend */ + ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); + + /* unlock the channel */ + ftdm_mutex_unlock(ftdmchan->mutex); + } + + /* clear the monitor thread stop flag */ + ftdm_clear_flag (span, FTDM_SPAN_STOP_THREAD); + ftdm_clear_flag (span, FTDM_SPAN_IN_THREAD); + + /* activate all the configured ss7 links */ + if (ft_to_sngss7_activate_all()) { + SS7_CRITICAL ("Failed to activate LibSngSS7!\n"); + return FTDM_FAIL; + } + + /*start the span monitor thread */ + if (ftdm_thread_create_detached (ftdm_sangoma_ss7_run, span) != FTDM_SUCCESS) { + SS7_CRITICAL ("Failed to start Span Monitor Thread!\n"); + return FTDM_FAIL; + } + + SS7_DEBUG ("Finished starting span %s:%u.\n", span->name, span->span_id); + + return FTDM_SUCCESS; } /******************************************************************************/ -static ftdm_status_t ftdm_sangoma_ss7_stop(ftdm_span_t *span) +static ftdm_status_t ftdm_sangoma_ss7_stop(ftdm_span_t * span) { - /*this function is called by the FT-Core to stop this span*/ - - ftdm_log(FTDM_LOG_INFO, "Stopping span %s:%u.\n",span->name,span->span_id); - - /* throw the STOP_THREAD flag to signal monitor thread stop */ - ftdm_set_flag(span, FTDM_SPAN_STOP_THREAD); - - /* wait for the thread to stop */ - while(ftdm_test_flag(span, FTDM_SPAN_IN_THREAD)) { - ftdm_log(FTDM_LOG_DEBUG, "Waiting for monitor thread to end for %s:%u.\n",span->name,span->span_id); - ftdm_sleep(1); - } - - /* KONRAD FIX ME - deconfigure any circuits, links, attached to this span */ - - ftdm_log(FTDM_LOG_DEBUG, "Finished stopping span %s:%u.\n",span->name,span->span_id); - - return FTDM_SUCCESS; + /*this function is called by the FT-Core to stop this span */ + + ftdm_log (FTDM_LOG_INFO, "Stopping span %s:%u.\n", span->name,span->span_id); + + /* throw the STOP_THREAD flag to signal monitor thread stop */ + ftdm_set_flag (span, FTDM_SPAN_STOP_THREAD); + + /* wait for the thread to stop */ + while (ftdm_test_flag (span, FTDM_SPAN_IN_THREAD)) { + ftdm_log (FTDM_LOG_DEBUG,"Waiting for monitor thread to end for %s:%u.\n", + span->name, + span->span_id); + ftdm_sleep (1); + } + + /* KONRAD FIX ME - deconfigure any circuits, links, attached to this span */ + + ftdm_log (FTDM_LOG_DEBUG, "Finished stopping span %s:%u.\n", span->name, span->span_id); + + return FTDM_SUCCESS; } -/******************************************************************************/ /* SIG_FUNCTIONS ***************************************************************/ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_sangoma_ss7_span_config) { - ftdm_log(FTDM_LOG_INFO, "Configuring ftmod_sangoma_ss7 span = %s(%d)...\n", - span->name, - span->span_id); - - /* parse the configuration and apply to the global config structure */ - if (ftmod_ss7_parse_xml(ftdm_parameters, span)) { - ftdm_log(FTDM_LOG_CRIT, "Failed to parse configuration!\n"); - - return FTDM_FAIL; - } - - /* configure libsngss7 */ - if (ft_to_sngss7_cfg()) { - ftdm_log(FTDM_LOG_CRIT, "Failed to configure LibSngSS7!\n"); - return FTDM_FAIL; - } - - /*setup the span structure with the info so far*/ - g_ftdm_sngss7_data.sig_cb = sig_cb; - - span->start = ftdm_sangoma_ss7_start; - span->stop = ftdm_sangoma_ss7_stop; - span->signal_type = FTDM_SIGTYPE_SS7; - span->signal_data = NULL; - span->outgoing_call = ftdm_sangoma_ss7_outgoing_call; - span->channel_request = NULL; - span->signal_cb = sig_cb; - span->get_channel_sig_status = ftdm_sangoma_ss7_get_sig_status; - span->set_channel_sig_status = ftdm_sangoma_ss7_set_sig_status; - span->state_map = &sangoma_ss7_state_map; - ftdm_set_flag(span, FTDM_SPAN_USE_CHAN_QUEUE); - - ftdm_log(FTDM_LOG_INFO, "Finished configuring ftmod_sangoma_ss7 span = %s(%d)...\n", - span->name, - span->span_id); -#if 0 - /* start the span up */ - ftdm_sangoma_ss7_start(span); -#endif - return FTDM_SUCCESS; + sngss7_span_data_t *ss7_span_info; + + ftdm_log (FTDM_LOG_INFO, "Configuring ftmod_sangoma_ss7 span = %s(%d)...\n", + span->name, + span->span_id); + + /* initalize the span's data structure */ + ss7_span_info = ftdm_calloc (1, sizeof (sngss7_span_data_t)); + + /* create a timer schedule */ + if (ftdm_sched_create (&ss7_span_info->sched, "SngSS7_Schedule")) { + SS7_CRITICAL ("Unable to create timer schedule!\n"); + return FTDM_FAIL; + } + + /* start the free run thread for the schedule */ + if (ftdm_sched_free_run (ss7_span_info->sched)) { + SS7_CRITICAL ("Unable to schedule free run!\n"); + return FTDM_FAIL; + } + + /* attach the span info to the span */ + span->mod_data = ss7_span_info; + + /* parse the configuration and apply to the global config structure */ + if (ftmod_ss7_parse_xml(ftdm_parameters, span)) { + ftdm_log (FTDM_LOG_CRIT, "Failed to parse configuration!\n"); + return FTDM_FAIL; + } + + /* configure libsngss7 */ + if (ft_to_sngss7_cfg_all()) { + ftdm_log (FTDM_LOG_CRIT, "Failed to configure LibSngSS7!\n"); + return FTDM_FAIL; + } + + /*setup the span structure with the info so far */ + g_ftdm_sngss7_data.sig_cb = sig_cb; + span->start = ftdm_sangoma_ss7_start; + span->stop = ftdm_sangoma_ss7_stop; + span->signal_type = FTDM_SIGTYPE_SS7; + span->signal_data = NULL; + span->outgoing_call = ftdm_sangoma_ss7_outgoing_call; + span->channel_request = NULL; + span->signal_cb = sig_cb; + span->get_channel_sig_status = ftdm_sangoma_ss7_get_sig_status; + span->set_channel_sig_status = ftdm_sangoma_ss7_set_sig_status; + span->state_map = &sangoma_ss7_state_map; + + ftdm_set_flag (span, FTDM_SPAN_USE_CHAN_QUEUE); + + ftdm_log (FTDM_LOG_INFO, "Finished configuring ftmod_sangoma_ss7 span = %s(%d)...\n", + span->name, + span->span_id); + + return FTDM_SUCCESS; } /******************************************************************************/ static FIO_SIG_LOAD_FUNCTION(ftdm_sangoma_ss7_init) { - /*this function is called by the FT-core to load the signaling module*/ - - ftdm_log(FTDM_LOG_INFO, "Loading ftmod_sangoma_ss7...\n"); - - /* default the global structure */ - memset(&g_ftdm_sngss7_data, 0x0, sizeof(ftdm_sngss7_data_t)); - - sngss7_id = 0; - - /* global flag indicating that general configuration has been done */ - g_ftdm_sngss7_data.gen_config_done = 0; - - /* min. number of digitis to wait for */ - g_ftdm_sngss7_data.min_digits = 7; - - /* function trace initizalation */ - g_ftdm_sngss7_data.function_trace = 1; - g_ftdm_sngss7_data.function_trace_level = 7; - - /* message (IAM, ACM, ANM, etc) trace initizalation */ - g_ftdm_sngss7_data.message_trace = 1; - g_ftdm_sngss7_data.message_trace_level = 7; - - /* create a timer schedule */ - if (ftdm_sched_create(&sngss7_sched, "SngSS7_Schedule")) { - SS7_CRITICAL("Unable to create timer schedule!\n"); - return FTDM_FAIL; - } - - /* setup the call backs needed by Sangoma_SS7 library */ - sng_event.cc.sng_con_ind = sngss7_con_ind; - sng_event.cc.sng_con_cfm = sngss7_con_cfm; - sng_event.cc.sng_con_sta = sngss7_con_sta; - sng_event.cc.sng_rel_ind = sngss7_rel_ind; - sng_event.cc.sng_rel_cfm = sngss7_rel_cfm; - sng_event.cc.sng_dat_ind = sngss7_dat_ind; - sng_event.cc.sng_fac_ind = sngss7_fac_ind; - sng_event.cc.sng_fac_cfm = sngss7_fac_cfm; - sng_event.cc.sng_sta_ind = sngss7_sta_ind; - sng_event.cc.sng_umsg_ind = sngss7_umsg_ind; - sng_event.cc.sng_susp_ind = NULL; - sng_event.cc.sng_resm_ind = NULL; - sng_event.cc.sng_ssp_sta_cfm = NULL; - - sng_event.sm.sng_log = handle_sng_log; - sng_event.sm.sng_mtp1_alarm = handle_sng_alarm; - sng_event.sm.sng_mtp2_alarm = handle_sng_alarm; - sng_event.sm.sng_mtp3_alarm = handle_sng_alarm; - sng_event.sm.sng_isup_alarm = handle_sng_alarm; - sng_event.sm.sng_cc_alarm = handle_sng_alarm; - - /* initalize sng_ss7 library */ - sng_isup_init(&sng_event); - - /* crash on assert fail */ - ftdm_global_set_crash_policy(FTDM_CRASH_ON_ASSERT); - - return FTDM_SUCCESS; + /*this function is called by the FT-core to load the signaling module */ + + ftdm_log (FTDM_LOG_INFO, "Loading ftmod_sangoma_ss7...\n"); + + /* default the global structure */ + memset (&g_ftdm_sngss7_data, 0x0, sizeof (ftdm_sngss7_data_t)); + + sngss7_id = 0; + + /* initalize the global gen_config flag */ + g_ftdm_sngss7_data.gen_config = 0; + + /* min. number of digitis to wait for */ + g_ftdm_sngss7_data.min_digits = 7; + + /* function trace initizalation */ + g_ftdm_sngss7_data.function_trace = 1; + g_ftdm_sngss7_data.function_trace_level = 7; + + /* message (IAM, ACM, ANM, etc) trace initizalation */ + g_ftdm_sngss7_data.message_trace = 1; + g_ftdm_sngss7_data.message_trace_level = 7; + + /* setup the call backs needed by Sangoma_SS7 library */ + sng_event.cc.sng_con_ind = sngss7_con_ind; + sng_event.cc.sng_con_cfm = sngss7_con_cfm; + sng_event.cc.sng_con_sta = sngss7_con_sta; + sng_event.cc.sng_rel_ind = sngss7_rel_ind; + sng_event.cc.sng_rel_cfm = sngss7_rel_cfm; + sng_event.cc.sng_dat_ind = sngss7_dat_ind; + sng_event.cc.sng_fac_ind = sngss7_fac_ind; + sng_event.cc.sng_fac_cfm = sngss7_fac_cfm; + sng_event.cc.sng_sta_ind = sngss7_sta_ind; + sng_event.cc.sng_umsg_ind = sngss7_umsg_ind; + sng_event.cc.sng_susp_ind = NULL; + sng_event.cc.sng_resm_ind = NULL; + sng_event.cc.sng_ssp_sta_cfm = NULL; + + sng_event.sm.sng_log = handle_sng_log; + sng_event.sm.sng_mtp1_alarm = handle_sng_mtp1_alarm; + sng_event.sm.sng_mtp2_alarm = handle_sng_mtp2_alarm; + sng_event.sm.sng_mtp3_alarm = handle_sng_mtp3_alarm; + sng_event.sm.sng_isup_alarm = handle_sng_isup_alarm; + sng_event.sm.sng_cc_alarm = handle_sng_cc_alarm; + + /* initalize sng_ss7 library */ + sng_isup_init (&sng_event); + + /* crash on assert fail */ + ftdm_global_set_crash_policy (FTDM_CRASH_ON_ASSERT); + + return FTDM_SUCCESS; } /******************************************************************************/ static FIO_SIG_UNLOAD_FUNCTION(ftdm_sangoma_ss7_unload) { - /*this function is called by the FT-core to unload the signaling module*/ + /*this function is called by the FT-core to unload the signaling module */ - ftdm_log(FTDM_LOG_INFO, "Starting ftmod_sangoma_ss7 unload...\n"); + ftdm_log (FTDM_LOG_INFO, "Starting ftmod_sangoma_ss7 unload...\n"); - sng_isup_free(); + sng_isup_free(); - ftdm_log(FTDM_LOG_INFO, "Finished ftmod_sangoma_ss7 unload!\n"); - return FTDM_SUCCESS; + ftdm_log (FTDM_LOG_INFO, "Finished ftmod_sangoma_ss7 unload!\n"); + return FTDM_SUCCESS; } /******************************************************************************/ static FIO_API_FUNCTION(ftdm_sangoma_ss7_api) { - /* handle this in it's own file....so much to do */ - return (ftdm_sngss7_handle_cli_cmd(stream, data)); + /* handle this in it's own file....so much to do */ + return (ftdm_sngss7_handle_cli_cmd (stream, data)); } /******************************************************************************/ static FIO_IO_LOAD_FUNCTION(ftdm_sangoma_ss7_io_init) { - assert(fio != NULL); - memset(&g_ftdm_sngss7_interface, 0, sizeof(g_ftdm_sngss7_interface)); + assert (fio != NULL); + memset (&g_ftdm_sngss7_interface, 0, sizeof (g_ftdm_sngss7_interface)); - g_ftdm_sngss7_interface.name = "ss7"; - g_ftdm_sngss7_interface.api = ftdm_sangoma_ss7_api; + g_ftdm_sngss7_interface.name = "ss7"; + g_ftdm_sngss7_interface.api = ftdm_sangoma_ss7_api; - *fio = &g_ftdm_sngss7_interface; + *fio = &g_ftdm_sngss7_interface; - return FTDM_SUCCESS; + return FTDM_SUCCESS; } /******************************************************************************/ /* START **********************************************************************/ -ftdm_module_t ftdm_module = -{ - "sangoma_ss7", /*char name[256]; */ - ftdm_sangoma_ss7_io_init, /*fio_io_load_t */ - NULL, /*fio_io_unload_t */ - ftdm_sangoma_ss7_init, /*fio_sig_load_t */ - NULL, /*fio_sig_configure_t */ - ftdm_sangoma_ss7_unload, /*fio_sig_unload_t */ - ftdm_sangoma_ss7_span_config /*fio_configure_span_signaling_t */ +ftdm_module_t ftdm_module = { + "sangoma_ss7", /*char name[256]; */ + ftdm_sangoma_ss7_io_init, /*fio_io_load_t */ + NULL, /*fio_io_unload_t */ + ftdm_sangoma_ss7_init, /*fio_sig_load_t */ + NULL, /*fio_sig_configure_t */ + ftdm_sangoma_ss7_unload, /*fio_sig_unload_t */ + ftdm_sangoma_ss7_span_config /*fio_configure_span_signaling_t */ }; /******************************************************************************/ -/*****************************************************************************/ +/******************************************************************************/ /* For Emacs: - * Local Variables: - * mode:c - * indent-tabs-mode:t - * tab-width:4 - * c-basic-offset:4 - * End: - * For VIM: - * vim:set softtabstop=4 shiftwidth=4 tabstop=4: - */ - +* Local Variables: +* mode:c +* indent-tabs-mode:t +* tab-width:4 +* c-basic-offset:4 +* End: +* For VIM: +* vim:set softtabstop=4 shiftwidth=4 tabstop=4: +*/ /******************************************************************************/ - - diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index 3f1eb37..6bfc38e 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -44,58 +44,273 @@ #include <ctype.h> #include "private/ftdm_core.h" -/* -#include "sng_sit.h" -#include "sng_ss7_error.h" -*/ + #include "sng_ss7.h" /******************************************************************************/ /* DEFINES ********************************************************************/ -#define MAX_CIC_LENGTH 5 -#define MAX_CIC_MAP_LENGTH 256 -#define MAX_MTP_LINKS MAX_SN_LINKSETS +#define MAX_NAME_LEN 10 +#define MAX_PATH 255 + +#define MAX_CIC_LENGTH 5 +#define MAX_CIC_MAP_LENGTH 1000 -#if 0 -#define SS7_HARDCODED -#endif -#define SNG_BASE 1 typedef enum { - SNG_IAM = 1, - SNG_ACM, - SNG_CPG, - SNG_ANM, - SNG_REL, - SNG_RLC -}sng_msg_type_t; + VOICE = 0, + SIG, + HOLE +} sng_ckt_type_t; + +typedef enum { + CONFIGURED = (1 << 0), + ACTIVE = (1 << 1) +} sng_flag_t; + +typedef struct sng_mtp_link { + char name[MAX_NAME_LEN]; + uint32_t id; + uint32_t flags; + struct { + uint32_t span; + uint32_t chan; + } mtp1; + struct { + uint32_t lssuLength; + uint32_t errorType; + uint32_t linkType; + uint32_t mtp1Id; + uint32_t t1; + uint32_t t2; + uint32_t t3; + uint32_t t4n; + uint32_t t4e; + uint32_t t5; + uint32_t t6; + uint32_t t7; + } mtp2; + struct { + uint32_t priority; + uint32_t linkType; + uint32_t switchType; + uint32_t apc; + uint32_t spc; + uint32_t ssf; + uint32_t slc; + uint32_t linkSetId; + uint32_t mtp2Id; + uint32_t t1; + uint32_t t2; + uint32_t t3; + uint32_t t4; + uint32_t t5; + uint32_t t6; + uint32_t t7; + uint32_t t8; + uint32_t t9; + uint32_t t10; + uint32_t t11; + uint32_t t12; + uint32_t t13; + uint32_t t14; + uint32_t t15; + uint32_t t16; + uint32_t t17; + uint32_t t18; + uint32_t t19; + uint32_t t20; + uint32_t t21; + uint32_t t22; + uint32_t t23; + uint32_t t24; + uint32_t t25; + uint32_t t26; + uint32_t t27; + uint32_t t28; + uint32_t t29; + uint32_t t30; + uint32_t t31; + uint32_t t32; + uint32_t t33; + uint32_t t34; + uint32_t t35; + uint32_t t36; + uint32_t t37; + uint32_t tcraft; + uint32_t tflc; + uint32_t tbnd; + } mtp3; +} sng_mtp_link_t; + +typedef struct sng_link_set { + uint32_t id; + char name[MAX_NAME_LEN]; + uint32_t flags; + uint32_t apc; + uint32_t linkType; + uint32_t minActive; + uint32_t numLinks; + uint32_t links[16]; +} sng_link_set_t; + +typedef struct sng_route { + uint32_t id; + char name[MAX_NAME_LEN]; + uint32_t flags; + uint32_t dpc; + uint32_t cmbLinkSetId; + uint32_t linkType; + uint32_t switchType; + uint32_t ssf; + uint32_t isSTP; + uint32_t t6; + uint32_t t8; + uint32_t t10; + uint32_t t11; + uint32_t t15; + uint32_t t16; + uint32_t t18; + uint32_t t19; + uint32_t t21; + uint32_t t25; +} sng_route_t; + +typedef struct sng_isup_intf { + uint32_t id; + char name[MAX_NAME_LEN]; + uint32_t flags; + uint32_t spc; + uint32_t dpc; + uint32_t switchType; + uint32_t nwId; + uint32_t mtpRouteId; + uint32_t ssf; + uint32_t isap; + uint16_t t4; + uint32_t t10; + uint32_t t11; + uint32_t t18; + uint32_t t19; + uint32_t t20; + uint32_t t21; + uint32_t t22; + uint32_t t23; + uint32_t t24; + uint32_t t25; + uint32_t t26; + uint32_t t28; + uint32_t t29; + uint32_t t30; + uint32_t t32; + uint32_t t35; + uint32_t t37; + uint32_t t38; + uint32_t t39; + uint32_t tfgr; + uint32_t tpause; + uint32_t tstaenq; +} sng_isup_inf_t; + +typedef struct sng_isup_ckt { + uint32_t id; + uint32_t flags; + uint32_t span; + uint32_t chan; + uint32_t type; /* VOICE/SIG/HOLE */ + uint32_t cic; + uint32_t infId; + uint32_t ssf; + uint32_t typeCntrl; + void *obj; + uint16_t t3; + uint16_t t12; + uint16_t t13; + uint16_t t14; + uint16_t t15; + uint16_t t16; + uint16_t t17; + uint16_t tval; +} sng_isup_ckt_t; + +typedef struct sng_nsap { + uint32_t id; + uint32_t flags; + uint32_t suId; + uint32_t spId; + uint32_t nwId; + uint32_t linkType; + uint32_t switchType; + uint32_t ssf; +} sng_nsap_t; + +typedef struct sng_isap { + uint32_t id; + uint32_t suId; + uint32_t spId; + uint32_t switchType; + uint32_t ssf; + uint32_t flags; + uint32_t t1; + uint32_t t2; + uint32_t t5; + uint32_t t6; + uint32_t t7; + uint32_t t8; + uint32_t t9; + uint32_t t27; + uint32_t t31; + uint32_t t33; + uint32_t t34; + uint32_t t36; + uint32_t tccr; + uint32_t tccrt; + uint32_t tex; + uint32_t tcrm; + uint32_t tcra; + uint32_t tect; + uint32_t trelrsp; + uint32_t tfnlrelrsp; +} sng_isap_t; + +typedef struct sng_ss7_cfg { + uint32_t spc; + char license[MAX_PATH]; + char signature[MAX_PATH]; + sng_mtp_link_t mtpLink[MAX_MTP_LINKS+1]; + sng_link_set_t mtpLinkSet[MAX_MTP_LINKSETS+1]; + sng_route_t mtpRoute[MAX_MTP_ROUTES+1]; + sng_isup_inf_t isupIntf[MAX_ISUP_INFS+1]; + sng_isup_ckt_t isupCkt[MAX_ISUP_CKTS+1]; + sng_nsap_t nsap[MAX_NSAPS+1]; + sng_isap_t isap[MAX_ISAPS+1]; +}sng_ss7_cfg_t; typedef struct ftdm_sngss7_data { - sng_config_t cfg; - int gen_config_done; - int min_digits; - int function_trace; - int function_trace_level; - int message_trace; - int message_trace_level; - fio_signal_cb_t sig_cb; + sng_ss7_cfg_t cfg; + int gen_config; + int min_digits; + int function_trace; + int function_trace_level; + int message_trace; + int message_trace_level; + fio_signal_cb_t sig_cb; }ftdm_sngss7_data_t; typedef struct sngss7_timer_data { - ftdm_timer_t *heartbeat_timer; - int beat; - int counter; - ftdm_sched_callback_t callback; - ftdm_sched_t *sched; - void *sngss7_info; + ftdm_timer_t *heartbeat_timer; + int beat; + int counter; + ftdm_sched_callback_t callback; + ftdm_sched_t *sched; + void *sngss7_info; }sngss7_timer_data_t; typedef struct sngss7_glare_data { - uint32_t suInstId; - uint32_t spInstId; - uint32_t circuit; - SiConEvnt iam; + uint32_t suInstId; + uint32_t spInstId; + uint32_t circuit; + SiConEvnt iam; }sngss7_glare_data_t; typedef struct sngss7_group_data { @@ -104,56 +319,99 @@ typedef struct sngss7_group_data { }sngss7_group_data_t; typedef struct sngss7_chan_data { - ftdm_channel_t *ftdmchan; - sng_isupCircuit_t *circuit; - uint32_t suInstId; - uint32_t spInstId; - uint32_t spId; - uint8_t globalFlg; - uint32_t flags; - sngss7_glare_data_t glare; - sngss7_timer_data_t t35; - sngss7_group_data_t grs; + ftdm_channel_t *ftdmchan; + sng_isup_ckt_t *circuit; + uint32_t base_chan; + uint32_t suInstId; + uint32_t spInstId; + uint32_t spId; + uint8_t globalFlg; + uint32_t flags; + sngss7_glare_data_t glare; + sngss7_timer_data_t t35; }sngss7_chan_data_t; +typedef struct sngss7_span_data { + ftdm_sched_t *sched; + sngss7_group_data_t grs; +}sngss7_span_data_t; + typedef enum { - FLAG_RESET_RX = (1 << 0), - FLAG_RESET_TX = (1 << 1), - FLAG_GRP_RESET_RX = (1 << 2), - FLAG_GRP_RESET_TX = (1 << 3), - FLAG_REMOTE_REL = (1 << 4), - FLAG_LOCAL_REL = (1 << 5), - FLAG_GLARE = (1 << 6), - FLAG_INFID_RESUME = (1 << 17), - FLAG_INFID_PAUSED = (1 << 18), - FLAG_CKT_MN_BLOCK_RX = (1 << 19), - FLAG_CKT_MN_BLOCK_TX = (1 << 20), - FLAG_CKT_MN_UNBLK_RX = (1 << 21), - FLAG_CKT_MN_UNBLK_TX = (1 << 22), - FLAG_GRP_HW_BLOCK_RX = (1 << 23), - FLAG_GRP_HW_BLOCK_TX = (1 << 24), - FLAG_GRP_MN_BLOCK_RX = (1 << 25), - FLAG_GRP_MN_BLOCK_TX = (1 << 28), - FLAG_GRP_HW_UNBLK_RX = (1 << 27), - FLAG_GRP_HW_UNBLK_TX = (1 << 28), - FLAG_GRP_MN_UNBLK_RX = (1 << 29), - FLAG_GRP_MN_UNBLK_TX = (1 << 30) + FLAG_RESET_RX = (1 << 0), + FLAG_RESET_TX = (1 << 1), + FLAG_RESET_SENT = (1 << 2), + FLAG_RESET_TX_RSP = (1 << 3), + FLAG_GRP_RESET_RX = (1 << 4), + FLAG_GRP_RESET_RX_DN = (1 << 5), + FLAG_GRP_RESET_RX_CMPLT = (1 << 6), + FLAG_GRP_RESET_BASE = (1 << 7), + FLAG_GRP_RESET_TX = (1 << 8), + FLAG_GRP_RESET_SENT = (1 << 9), + FLAG_GRP_RESET_TX_RSP = (1 << 10), + FLAG_REMOTE_REL = (1 << 11), + FLAG_LOCAL_REL = (1 << 12), + FLAG_GLARE = (1 << 13), + FLAG_INFID_RESUME = (1 << 14), + FLAG_INFID_PAUSED = (1 << 15), + FLAG_CKT_UCIC_BLOCK = (1 << 16), + FLAG_CKT_UCIC_UNBLK = (1 << 17), + FLAG_CKT_LC_BLOCK_RX = (1 << 18), + FLAG_CKT_LC_UNBLK_RX = (1 << 19), + FLAG_CKT_MN_BLOCK_RX = (1 << 20), + FLAG_CKT_MN_BLOCK_TX = (1 << 21), + FLAG_CKT_MN_UNBLK_RX = (1 << 22), + FLAG_CKT_MN_UNBLK_TX = (1 << 23), + FLAG_GRP_HW_BLOCK_RX = (1 << 24), + FLAG_GRP_HW_BLOCK_TX = (1 << 25), + FLAG_GRP_MN_BLOCK_RX = (1 << 26), + FLAG_GRP_MN_BLOCK_TX = (1 << 27), + FLAG_GRP_HW_UNBLK_RX = (1 << 28), + FLAG_GRP_HW_UNBLK_TX = (1 << 29), + FLAG_GRP_MN_UNBLK_RX = (1 << 30), + FLAG_GRP_MN_UNBLK_TX = (1 << 31) } flag_t; /******************************************************************************/ /* GLOBALS ********************************************************************/ extern ftdm_sngss7_data_t g_ftdm_sngss7_data; -extern uint32_t sngss7_id; -extern ftdm_sched_t *sngss7_sched; +extern uint32_t sngss7_id; +extern ftdm_sched_t *sngss7_sched; /******************************************************************************/ /* PROTOTYPES *****************************************************************/ void handle_sng_log(uint8_t level, char *fmt,...); -void handle_sng_alarm(sng_alrm_t t_alarm); +void handle_sng_mtp1_alarm(Pst *pst, L1Mngmt *sta); +void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta); +void handle_sng_mtp3_alarm(Pst *pst, SnMngmt *sta); +void handle_sng_isup_alarm(Pst *pst, SiMngmt *sta); +void handle_sng_cc_alarm(Pst *pst, CcMngmt *sta); + +int ft_to_sngss7_cfg_all(void); +int ftmod_ss7_mtp1_gen_config(void); +int ftmod_ss7_mtp2_gen_config(void); +int ftmod_ss7_mtp3_gen_config(void); +int ftmod_ss7_isup_gen_config(void); +int ftmod_ss7_cc_gen_config(void); +int ftmod_ss7_mtp1_psap_config(int id); +int ftmod_ss7_mtp2_dlsap_config(int id); +int ftmod_ss7_mtp3_dlsap_config(int id); +int ftmod_ss7_mtp3_nsap_config(int id); +int ftmod_ss7_mtp3_linkset_config(int id); +int ftmod_ss7_mtp3_route_config(int id); +int ftmod_ss7_isup_nsap_config(int id); +int ftmod_ss7_isup_intf_config(int id); +int ftmod_ss7_isup_ckt_config(int id); +int ftmod_ss7_isup_isap_config(int id); +int ftmod_ss7_cc_isap_config(int id); + +int ftmod_ss7_inhibit_mtplink(uint32_t id); +int ftmod_ss7_uninhibit_mtplink(uint32_t id); + +int ftmod_ss7_mtplink_sta(uint32_t id, SnMngmt *cfm); +int ftmod_ss7_mtplinkSet_sta(uint32_t id, SnMngmt *cfm); -int ft_to_sngss7_cfg(void); int ft_to_sngss7_activate_all(void); void ft_to_sngss7_iam(ftdm_channel_t *ftdmchan); @@ -169,6 +427,7 @@ void ft_to_sngss7_ubl(ftdm_channel_t *ftdmchan); void ft_to_sngss7_uba(ftdm_channel_t *ftdmchan); void ft_to_sngss7_lpa(ftdm_channel_t *ftdmchan); void ft_to_sngss7_gra(ftdm_channel_t *ftdmchan); +void ft_to_sngss7_grs(ftdm_channel_t *ftdmchan); void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); void sngss7_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiConEvnt *siConEvnt); @@ -188,6 +447,8 @@ uint8_t copy_cdPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum); uint8_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven); int check_for_state_change(ftdm_channel_t *ftdmchan); +int check_cics_in_range(sngss7_chan_data_t *sngss7_info); +int check_for_reset(sngss7_chan_data_t *sngss7_info); ftdm_status_t extract_chan_data(uint32_t circuit, sngss7_chan_data_t **sngss7_info, ftdm_channel_t **ftdmchan); unsigned long get_unique_id(void); @@ -199,11 +460,17 @@ ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const cha /******************************************************************************/ /* MACROS *********************************************************************/ -#define SS7_DEBUG(a,...) ftdm_log(FTDM_LOG_DEBUG,a,##__VA_ARGS__ ); -#define SS7_INFO(a,...) ftdm_log(FTDM_LOG_INFO,a,##__VA_ARGS__ ); -#define SS7_WARN(a,...) ftdm_log(FTDM_LOG_WARNING,a,##__VA_ARGS__ ); -#define SS7_ERROR(a,...) ftdm_log(FTDM_LOG_ERROR,a,##__VA_ARGS__ ); -#define SS7_CRITICAL(a,...) ftdm_log(FTDM_LOG_CRIT,a,##__VA_ARGS__ ); +#define SS7_DEBUG(a,...) ftdm_log(FTDM_LOG_DEBUG,a , ##__VA_ARGS__ ); +#define SS7_INFO(a,...) ftdm_log(FTDM_LOG_INFO,a , ##__VA_ARGS__ ); +#define SS7_WARN(a,...) ftdm_log(FTDM_LOG_WARNING,a , ##__VA_ARGS__ ); +#define SS7_ERROR(a,...) ftdm_log(FTDM_LOG_ERROR,a , ##__VA_ARGS__ ); +#define SS7_CRITICAL(a,...) ftdm_log(FTDM_LOG_CRIT,a , ##__VA_ARGS__ ); + +#define SS7_DEBUG_CHAN(fchan, msg, args...) ftdm_log_chan(fchan, FTDM_LOG_DEBUG, msg , ##args) +#define SS7_INFO_CHAN(fchan, msg, args...) ftdm_log_chan(fchan, FTDM_LOG_INFO, msg , ##args) +#define SS7_WARN_CHAN(fchan, msg, args...) ftdm_log_chan(fchan, FTDM_LOG_WARNING, msg , ##args) +#define SS7_ERROR_CHAN(fchan, msg, args...) ftdm_log_chan(fchan, FTDM_LOG_ERROR, msg , ##args) +#define SS7_CTRIT_CHAN(fchan, msg, args...) ftdm_log_chan(fchan, FTDM_LOG_CRIT, msg , ##args) #ifdef KONRAD_DEVEL #define SS7_DEVEL_DEBUG(a,...) ftdm_log(FTDM_LOG_DEBUG,a,##__VA_ARGS__ ); @@ -212,107 +479,121 @@ ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const cha #endif #define SS7_FUNC_TRACE_ENTER(a) if (g_ftdm_sngss7_data.function_trace) { \ - switch (g_ftdm_sngss7_data.function_trace_level) { \ - case 0: \ - ftdm_log(FTDM_LOG_EMERG,"Entering %s\n", a); \ - break; \ - case 1: \ - ftdm_log(FTDM_LOG_ALERT,"Entering %s\n", a); \ - break; \ - case 2: \ - ftdm_log(FTDM_LOG_CRIT,"Entering %s\n", a); \ - break; \ - case 3: \ - ftdm_log(FTDM_LOG_ERROR,"Entering %s\n", a); \ - break; \ - case 4: \ - ftdm_log(FTDM_LOG_WARNING,"Entering %s\n", a); \ - break; \ - case 5: \ - ftdm_log(FTDM_LOG_NOTICE,"Entering %s\n", a); \ - break; \ - case 6: \ - ftdm_log(FTDM_LOG_INFO,"Entering %s\n", a); \ - break; \ - case 7: \ - ftdm_log(FTDM_LOG_DEBUG,"Entering %s\n", a); \ - break; \ - default: \ - ftdm_log(FTDM_LOG_INFO,"Entering %s\n", a); \ - break; \ - } /* switch (g_ftdm_sngss7_data.function_trace_level) */ \ - } /* if(g_ftdm_sngss7_data.function_trace) */ + switch (g_ftdm_sngss7_data.function_trace_level) { \ + case 0: \ + ftdm_log(FTDM_LOG_EMERG,"Entering %s\n", a); \ + break; \ + case 1: \ + ftdm_log(FTDM_LOG_ALERT,"Entering %s\n", a); \ + break; \ + case 2: \ + ftdm_log(FTDM_LOG_CRIT,"Entering %s\n", a); \ + break; \ + case 3: \ + ftdm_log(FTDM_LOG_ERROR,"Entering %s\n", a); \ + break; \ + case 4: \ + ftdm_log(FTDM_LOG_WARNING,"Entering %s\n", a); \ + break; \ + case 5: \ + ftdm_log(FTDM_LOG_NOTICE,"Entering %s\n", a); \ + break; \ + case 6: \ + ftdm_log(FTDM_LOG_INFO,"Entering %s\n", a); \ + break; \ + case 7: \ + ftdm_log(FTDM_LOG_DEBUG,"Entering %s\n", a); \ + break; \ + default: \ + ftdm_log(FTDM_LOG_INFO,"Entering %s\n", a); \ + break; \ + } /* switch (g_ftdm_sngss7_data.function_trace_level) */ \ + } /* if(g_ftdm_sngss7_data.function_trace) */ #define SS7_FUNC_TRACE_EXIT(a) if (g_ftdm_sngss7_data.function_trace) { \ - switch (g_ftdm_sngss7_data.function_trace_level) { \ - case 0: \ - ftdm_log(FTDM_LOG_EMERG,"Exitting %s\n", a); \ - break; \ - case 1: \ - ftdm_log(FTDM_LOG_ALERT,"Exitting %s\n", a); \ - break; \ - case 2: \ - ftdm_log(FTDM_LOG_CRIT,"Exitting %s\n", a); \ - break; \ - case 3: \ - ftdm_log(FTDM_LOG_ERROR,"Exitting %s\n", a); \ - break; \ - case 4: \ - ftdm_log(FTDM_LOG_WARNING,"Exitting %s\n", a); \ - break; \ - case 5: \ - ftdm_log(FTDM_LOG_NOTICE,"Exitting %s\n", a); \ - break; \ - case 6: \ - ftdm_log(FTDM_LOG_INFO,"Exitting %s\n", a); \ - break; \ - case 7: \ - ftdm_log(FTDM_LOG_DEBUG,"Exitting %s\n", a); \ - break; \ - default: \ - ftdm_log(FTDM_LOG_INFO,"Exitting %s\n", a); \ - break; \ - } /* switch (g_ftdm_sngss7_data.function_trace_level) */ \ - } /* if(g_ftdm_sngss7_data.function_trace) */ - -#define SS7_MSG_TRACE(a,...) if (g_ftdm_sngss7_data.message_trace) { \ - switch (g_ftdm_sngss7_data.message_trace_level) { \ - case 0: \ - ftdm_log(FTDM_LOG_EMERG,a,##__VA_ARGS__ ); \ - break; \ - case 1: \ - ftdm_log(FTDM_LOG_ALERT,a,##__VA_ARGS__ ); \ - break; \ - case 2: \ - ftdm_log(FTDM_LOG_CRIT,a,##__VA_ARGS__ ); \ - break; \ - case 3: \ - ftdm_log(FTDM_LOG_ERROR,a,##__VA_ARGS__ ); \ - break; \ - case 4: \ - ftdm_log(FTDM_LOG_WARNING,a,##__VA_ARGS__ ); \ - break; \ - case 5: \ - ftdm_log(FTDM_LOG_NOTICE,a,##__VA_ARGS__ ); \ - break; \ - case 6: \ - ftdm_log(FTDM_LOG_INFO,a,##__VA_ARGS__ ); \ - break; \ - case 7: \ - ftdm_log(FTDM_LOG_DEBUG,a,##__VA_ARGS__ ); \ - break; \ - default: \ - ftdm_log(FTDM_LOG_INFO,a,##__VA_ARGS__ ); \ - break; \ - } /* switch (g_ftdm_sngss7_data.message_trace_level) */ \ - } /* if(g_ftdm_sngss7_data.message_trace) */ + switch (g_ftdm_sngss7_data.function_trace_level) { \ + case 0: \ + ftdm_log(FTDM_LOG_EMERG,"Exitting %s\n", a); \ + break; \ + case 1: \ + ftdm_log(FTDM_LOG_ALERT,"Exitting %s\n", a); \ + break; \ + case 2: \ + ftdm_log(FTDM_LOG_CRIT,"Exitting %s\n", a); \ + break; \ + case 3: \ + ftdm_log(FTDM_LOG_ERROR,"Exitting %s\n", a); \ + break; \ + case 4: \ + ftdm_log(FTDM_LOG_WARNING,"Exitting %s\n", a); \ + break; \ + case 5: \ + ftdm_log(FTDM_LOG_NOTICE,"Exitting %s\n", a); \ + break; \ + case 6: \ + ftdm_log(FTDM_LOG_INFO,"Exitting %s\n", a); \ + break; \ + case 7: \ + ftdm_log(FTDM_LOG_DEBUG,"Exitting %s\n", a); \ + break; \ + default: \ + ftdm_log(FTDM_LOG_INFO,"Exitting %s\n", a); \ + break; \ + } /* switch (g_ftdm_sngss7_data.function_trace_level) */ \ + } /* if(g_ftdm_sngss7_data.function_trace) */ + +#define SS7_MSG_TRACE(fchan, sngss7info ,msg) if (g_ftdm_sngss7_data.message_trace) { \ + switch (g_ftdm_sngss7_data.message_trace_level) { \ + case 0: \ + ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "[CIC:%d]%s",sngss7info->circuit->cic, msg); \ + break; \ + case 1: \ + ftdm_log_chan(fchan, FTDM_LOG_ALERT, "[CIC:%d]%s",sngss7info->circuit->cic, msg); \ + break; \ + case 2: \ + ftdm_log_chan(fchan, FTDM_LOG_CRIT, "[CIC:%d]%s",sngss7info->circuit->cic, msg); \ + break; \ + case 3: \ + ftdm_log_chan(fchan, FTDM_LOG_ERROR, "[CIC:%d]%s",sngss7info->circuit->cic, msg); \ + break; \ + case 4: \ + ftdm_log_chan(fchan, FTDM_LOG_WARNING, "[CIC:%d]%s",sngss7info->circuit->cic, msg); \ + break; \ + case 5: \ + ftdm_log_chan(fchan, FTDM_LOG_NOTICE, "[CIC:%d]%s",sngss7info->circuit->cic, msg); \ + break; \ + case 6: \ + ftdm_log_chan(fchan, FTDM_LOG_INFO, "[CIC:%d]%s",sngss7info->circuit->cic, msg); \ + break; \ + case 7: \ + ftdm_log_chan(fchan, FTDM_LOG_DEBUG, "[CIC:%d]%s",sngss7info->circuit->cic, msg); \ + break; \ + default: \ + ftdm_log_chan(fchan, FTDM_LOG_INFO, "[CIC:%d]%s",sngss7info->circuit->cic, msg); \ + break; \ + } /* switch (g_ftdm_sngss7_data.message_trace_level) */ \ + } /* if(g_ftdm_sngss7_data.message_trace) */ #define sngss7_test_flag(obj, flag) ((obj)->flags & flag) #define sngss7_clear_flag(obj, flag) ((obj)->flags &= ~(flag)) #define sngss7_set_flag(obj, flag) ((obj)->flags |= (flag)) +# define SS7_ASSERT *(int*)0=0; /******************************************************************************/ /******************************************************************************/ #endif /* __FTMOD_SNG_SS7_H__ */ /******************************************************************************/ + +/******************************************************************************/ +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4: + */ +/******************************************************************************/ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index edaf36d..53d0f9d 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -42,393 +42,444 @@ /******************************************************************************/ /* PROTOTYPES *****************************************************************/ -void ft_to_sngss7_iam(ftdm_channel_t *ftdmchan); -void ft_to_sngss7_acm(ftdm_channel_t *ftdmchan); -void ft_to_sngss7_anm(ftdm_channel_t *ftdmchan); -void ft_to_sngss7_rel(ftdm_channel_t *ftdmchan); -void ft_to_sngss7_rlc(ftdm_channel_t *ftdmchan); +void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan); +void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan); +void ft_to_sngss7_anm (ftdm_channel_t * ftdmchan); +void ft_to_sngss7_rel (ftdm_channel_t * ftdmchan); +void ft_to_sngss7_rlc (ftdm_channel_t * ftdmchan); -void ft_to_sngss7_rsc(ftdm_channel_t *ftdmchan); -void ft_to_sngss7_rsca(ftdm_channel_t *ftdmchan); +void ft_to_sngss7_rsc (ftdm_channel_t * ftdmchan); +void ft_to_sngss7_rsca (ftdm_channel_t * ftdmchan); -void ft_to_sngss7_blo(ftdm_channel_t *ftdmchan); -void ft_to_sngss7_bla(ftdm_channel_t *ftdmchan); -void ft_to_sngss7_ubl(ftdm_channel_t *ftdmchan); -void ft_to_sngss7_uba(ftdm_channel_t *ftdmchan); +void ft_to_sngss7_blo (ftdm_channel_t * ftdmchan); +void ft_to_sngss7_bla (ftdm_channel_t * ftdmchan); +void ft_to_sngss7_ubl (ftdm_channel_t * ftdmchan); +void ft_to_sngss7_uba (ftdm_channel_t * ftdmchan); -void ft_to_sngss7_lpa(ftdm_channel_t *ftdmchan); +void ft_to_sngss7_lpa (ftdm_channel_t * ftdmchan); -void ft_to_sngss7_gra(ftdm_channel_t *ftdmchan); +void ft_to_sngss7_gra (ftdm_channel_t * ftdmchan); +void ft_to_sngss7_grs (ftdm_channel_t * ftdmchan); /* FUNCTIONS ******************************************************************/ -void ft_to_sngss7_iam(ftdm_channel_t *ftdmchan) +void +ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;; - SiConEvnt iam; - - sngss7_info->suInstId = get_unique_id(); - sngss7_info->spInstId = 0; - sngss7_info->spId = 1; - - memset(&iam, 0x0, sizeof(iam)); - - /* copy down the nature of connection indicators */ - iam.natConInd.eh.pres = PRSNT_NODEF; - iam.natConInd.satInd.pres = PRSNT_NODEF; - iam.natConInd.satInd.val = 0; - iam.natConInd.contChkInd.pres = PRSNT_NODEF; - iam.natConInd.contChkInd.val = 0x00; - iam.natConInd.echoCntrlDevInd.pres = PRSNT_NODEF; - iam.natConInd.echoCntrlDevInd.val = 0x01; - - /* copy down the forward call indicators */ - iam.fwdCallInd.eh.pres = PRSNT_NODEF; - iam.fwdCallInd.natIntCallInd.pres = PRSNT_NODEF; - iam.fwdCallInd.natIntCallInd.val = 0x00; - iam.fwdCallInd.end2EndMethInd.pres = PRSNT_NODEF; - iam.fwdCallInd.end2EndMethInd.val = 0x00; - iam.fwdCallInd.intInd.pres = PRSNT_NODEF; - iam.fwdCallInd.intInd.val = 0x01; - iam.fwdCallInd.end2EndInfoInd.pres = PRSNT_NODEF; - iam.fwdCallInd.end2EndInfoInd.val = 0x00; - iam.fwdCallInd.isdnUsrPrtInd.pres = PRSNT_NODEF; - iam.fwdCallInd.isdnUsrPrtInd.val = 0x01; - iam.fwdCallInd.isdnUsrPrtPrfInd.pres = PRSNT_NODEF; - iam.fwdCallInd.isdnUsrPrtPrfInd.val = 0x02; - iam.fwdCallInd.isdnAccInd.pres = PRSNT_NODEF; - iam.fwdCallInd.isdnAccInd.val = 0x01; - iam.fwdCallInd.sccpMethInd.pres = PRSNT_NODEF; - iam.fwdCallInd.sccpMethInd.val = 0x00; - - /* copy down the calling number information */ - iam.cgPtyCat.eh.pres = PRSNT_NODEF; - iam.cgPtyCat.cgPtyCat.pres = PRSNT_NODEF; - iam.cgPtyCat.cgPtyCat.val = 0x0a; - - /* copy down the transmission medium requirements */ - iam.txMedReq.eh.pres = PRSNT_NODEF; - iam.txMedReq.trMedReq.pres = PRSNT_NODEF; - iam.txMedReq.trMedReq.val = 0; /* SPEECH = 0, 3.1Khz = 3, 64k unres = 2 */ - - /* copy down the called number information */ - copy_cdPtyNum_to_sngss7(&ftdmchan->caller_data, &iam.cdPtyNum); - - /* copy down the calling number information */ - copy_cgPtyNum_to_sngss7(&ftdmchan->caller_data, &iam.cgPtyNum); - - sng_cc_con_request(sngss7_info->spId, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id, - &iam, - 0); - - SS7_MSG_TRACE("Transmitted IAM on CIC # %d\n", sngss7_info->circuit->cic); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + SS7_FUNC_TRACE_ENTER (__FUNCTION__); + + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;; + SiConEvnt iam; + + sngss7_info->suInstId = get_unique_id (); + sngss7_info->spInstId = 0; + sngss7_info->spId = 1; + + memset (&iam, 0x0, sizeof (iam)); + + /* copy down the nature of connection indicators */ + iam.natConInd.eh.pres = PRSNT_NODEF; + iam.natConInd.satInd.pres = PRSNT_NODEF; + iam.natConInd.satInd.val = 0; + iam.natConInd.contChkInd.pres = PRSNT_NODEF; + iam.natConInd.contChkInd.val = 0x00; + iam.natConInd.echoCntrlDevInd.pres = PRSNT_NODEF; + iam.natConInd.echoCntrlDevInd.val = 0x01; + + /* copy down the forward call indicators */ + iam.fwdCallInd.eh.pres = PRSNT_NODEF; + iam.fwdCallInd.natIntCallInd.pres = PRSNT_NODEF; + iam.fwdCallInd.natIntCallInd.val = 0x00; + iam.fwdCallInd.end2EndMethInd.pres = PRSNT_NODEF; + iam.fwdCallInd.end2EndMethInd.val = 0x00; + iam.fwdCallInd.intInd.pres = PRSNT_NODEF; + iam.fwdCallInd.intInd.val = 0x01; + iam.fwdCallInd.end2EndInfoInd.pres = PRSNT_NODEF; + iam.fwdCallInd.end2EndInfoInd.val = 0x00; + iam.fwdCallInd.isdnUsrPrtInd.pres = PRSNT_NODEF; + iam.fwdCallInd.isdnUsrPrtInd.val = 0x01; + iam.fwdCallInd.isdnUsrPrtPrfInd.pres = PRSNT_NODEF; + iam.fwdCallInd.isdnUsrPrtPrfInd.val = 0x02; + iam.fwdCallInd.isdnAccInd.pres = PRSNT_NODEF; + iam.fwdCallInd.isdnAccInd.val = 0x01; + iam.fwdCallInd.sccpMethInd.pres = PRSNT_NODEF; + iam.fwdCallInd.sccpMethInd.val = 0x00; + + /* copy down the calling number information */ + iam.cgPtyCat.eh.pres = PRSNT_NODEF; + iam.cgPtyCat.cgPtyCat.pres = PRSNT_NODEF; + iam.cgPtyCat.cgPtyCat.val = 0x0a; + + /* copy down the transmission medium requirements */ + iam.txMedReq.eh.pres = PRSNT_NODEF; + iam.txMedReq.trMedReq.pres = PRSNT_NODEF; + iam.txMedReq.trMedReq.val = 0; /* SPEECH = 0, 3.1Khz = 3, 64k unres = 2 */ + + /* copy down the called number information */ + copy_cdPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cdPtyNum); + + /* copy down the calling number information */ + copy_cgPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cgPtyNum); + + sng_cc_con_request (sngss7_info->spId, + sngss7_info->suInstId, + sngss7_info->spInstId, + sngss7_info->circuit->id, &iam, 0); + + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx IAM\n"); + + SS7_FUNC_TRACE_EXIT (__FUNCTION__); + return; } + /******************************************************************************/ -void ft_to_sngss7_acm(ftdm_channel_t *ftdmchan) +void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - SiCnStEvnt acm; - - memset(&acm, 0x0, sizeof(acm)); - - /* fill in the needed information for the ACM */ - acm.bckCallInd.eh.pres = PRSNT_NODEF; - acm.bckCallInd.chrgInd.pres = PRSNT_NODEF; - acm.bckCallInd.chrgInd.val = 0x00; - acm.bckCallInd.cadPtyStatInd.pres = PRSNT_NODEF; - acm.bckCallInd.cadPtyStatInd.val = 0x01; - acm.bckCallInd.cadPtyCatInd.pres = PRSNT_NODEF; - acm.bckCallInd.cadPtyCatInd.val = 0x00; - acm.bckCallInd.end2EndMethInd.pres = PRSNT_NODEF; - acm.bckCallInd.end2EndMethInd.val = 0x00; - acm.bckCallInd.intInd.pres = PRSNT_NODEF; - acm.bckCallInd.intInd.val = 0x00; - acm.bckCallInd.end2EndInfoInd.pres = PRSNT_NODEF; - acm.bckCallInd.end2EndInfoInd.val = 0x00; - acm.bckCallInd.isdnUsrPrtInd.pres = PRSNT_NODEF; - acm.bckCallInd.isdnUsrPrtInd.val = 0x0; - acm.bckCallInd.holdInd.pres = PRSNT_NODEF; - acm.bckCallInd.holdInd.val = 0x00; - acm.bckCallInd.isdnAccInd.pres = PRSNT_NODEF; - acm.bckCallInd.isdnAccInd.val = 0x0; - acm.bckCallInd.echoCtrlDevInd.pres = PRSNT_NODEF; - acm.bckCallInd.echoCtrlDevInd.val = 0x0; - acm.bckCallInd.sccpMethInd.pres = PRSNT_NODEF; - acm.bckCallInd.sccpMethInd.val = 0x00; - - /* send the ACM request to LibSngSS7 */ - sng_cc_con_status(1, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id, - &acm, - ADDRCMPLT); - - SS7_MSG_TRACE("Transmitted ACM on CIC # %d\n", sngss7_info->circuit->cic); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + SS7_FUNC_TRACE_ENTER (__FUNCTION__); + + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + SiCnStEvnt acm; + + memset (&acm, 0x0, sizeof (acm)); + + /* fill in the needed information for the ACM */ + acm.bckCallInd.eh.pres = PRSNT_NODEF; + acm.bckCallInd.chrgInd.pres = PRSNT_NODEF; + acm.bckCallInd.chrgInd.val = 0x00; + acm.bckCallInd.cadPtyStatInd.pres = PRSNT_NODEF; + acm.bckCallInd.cadPtyStatInd.val = 0x01; + acm.bckCallInd.cadPtyCatInd.pres = PRSNT_NODEF; + acm.bckCallInd.cadPtyCatInd.val = 0x00; + acm.bckCallInd.end2EndMethInd.pres = PRSNT_NODEF; + acm.bckCallInd.end2EndMethInd.val = 0x00; + acm.bckCallInd.intInd.pres = PRSNT_NODEF; + acm.bckCallInd.intInd.val = 0x00; + acm.bckCallInd.end2EndInfoInd.pres = PRSNT_NODEF; + acm.bckCallInd.end2EndInfoInd.val = 0x00; + acm.bckCallInd.isdnUsrPrtInd.pres = PRSNT_NODEF; + acm.bckCallInd.isdnUsrPrtInd.val = 0x0; + acm.bckCallInd.holdInd.pres = PRSNT_NODEF; + acm.bckCallInd.holdInd.val = 0x00; + acm.bckCallInd.isdnAccInd.pres = PRSNT_NODEF; + acm.bckCallInd.isdnAccInd.val = 0x0; + acm.bckCallInd.echoCtrlDevInd.pres = PRSNT_NODEF; + acm.bckCallInd.echoCtrlDevInd.val = 0x0; + acm.bckCallInd.sccpMethInd.pres = PRSNT_NODEF; + acm.bckCallInd.sccpMethInd.val = 0x00; + + /* send the ACM request to LibSngSS7 */ + sng_cc_con_status (1, + sngss7_info->suInstId, + sngss7_info->spInstId, + sngss7_info->circuit->id, + &acm, + ADDRCMPLT); + + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx ACM\n"); + + SS7_FUNC_TRACE_EXIT (__FUNCTION__); + return; } -/******************************************************************************/ -void ft_to_sngss7_anm(ftdm_channel_t *ftdmchan) +/******************************************************************************/ +void ft_to_sngss7_anm (ftdm_channel_t * ftdmchan) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - SiConEvnt anm; - - memset(&anm, 0x0, sizeof(anm)); - - /* send the ANM request to LibSngSS7 */ - sng_cc_con_response(1, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id, - &anm, - 5); - - SS7_MSG_TRACE("Transmitted ANM on CIC # %d\n", sngss7_info->circuit->cic); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + SS7_FUNC_TRACE_ENTER (__FUNCTION__); + + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + SiConEvnt anm; + + memset (&anm, 0x0, sizeof (anm)); + + /* send the ANM request to LibSngSS7 */ + sng_cc_con_response(1, + sngss7_info->suInstId, + sngss7_info->spInstId, + sngss7_info->circuit->id, + &anm, + 5); + + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx ANM\n"); + + SS7_FUNC_TRACE_EXIT (__FUNCTION__); + return; } /******************************************************************************/ -void ft_to_sngss7_rel(ftdm_channel_t *ftdmchan) +void ft_to_sngss7_rel (ftdm_channel_t * ftdmchan) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - SiRelEvnt rel; - - memset(&rel, 0x0, sizeof(rel)); - - rel.causeDgn.eh.pres = PRSNT_NODEF; - rel.causeDgn.location.pres = PRSNT_NODEF; - rel.causeDgn.location.val = 0x01; - rel.causeDgn.cdeStand.pres = PRSNT_NODEF; - rel.causeDgn.cdeStand.val = 0x00; - rel.causeDgn.recommend.pres = NOTPRSNT; - rel.causeDgn.causeVal.pres = PRSNT_NODEF; - rel.causeDgn.causeVal.val = (uint8_t)ftdmchan->caller_data.hangup_cause; - rel.causeDgn.dgnVal.pres = NOTPRSNT; - - /* send the REL request to LibSngSS7 */ - sng_cc_rel_request(1, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id, - &rel); - - SS7_MSG_TRACE("Transmitted REL on CIC # %d\n", sngss7_info->circuit->cic); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + SS7_FUNC_TRACE_ENTER (__FUNCTION__); + + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + SiRelEvnt rel; + + memset (&rel, 0x0, sizeof (rel)); + + rel.causeDgn.eh.pres = PRSNT_NODEF; + rel.causeDgn.location.pres = PRSNT_NODEF; + rel.causeDgn.location.val = 0x01; + rel.causeDgn.cdeStand.pres = PRSNT_NODEF; + rel.causeDgn.cdeStand.val = 0x00; + rel.causeDgn.recommend.pres = NOTPRSNT; + rel.causeDgn.causeVal.pres = PRSNT_NODEF; + rel.causeDgn.causeVal.val = (uint8_t) ftdmchan->caller_data.hangup_cause; + rel.causeDgn.dgnVal.pres = NOTPRSNT; + + /* send the REL request to LibSngSS7 */ + sng_cc_rel_request (1, + sngss7_info->suInstId, + sngss7_info->spInstId, + sngss7_info->circuit->id, + &rel); + + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx REL\n"); + + SS7_FUNC_TRACE_EXIT (__FUNCTION__); + return; } /******************************************************************************/ -void ft_to_sngss7_rlc(ftdm_channel_t *ftdmchan) +void ft_to_sngss7_rlc (ftdm_channel_t * ftdmchan) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - SiRelEvnt rlc; - - memset(&rlc, 0x0, sizeof(rlc)); - - /* send the RLC request to LibSngSS7 */ - sng_cc_rel_response(1, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id, - &rlc); - - SS7_MSG_TRACE("Transmitted RLC on CIC # %d\n", sngss7_info->circuit->cic); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + SS7_FUNC_TRACE_ENTER (__FUNCTION__); + + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + SiRelEvnt rlc; + + memset (&rlc, 0x0, sizeof (rlc)); + + /* send the RLC request to LibSngSS7 */ + sng_cc_rel_response (1, + sngss7_info->suInstId, + sngss7_info->spInstId, + sngss7_info->circuit->id, + &rlc); + + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx RLC\n"); + + SS7_FUNC_TRACE_EXIT (__FUNCTION__); + return; } /******************************************************************************/ -void ft_to_sngss7_rsc(ftdm_channel_t *ftdmchan) +void ft_to_sngss7_rsc (ftdm_channel_t * ftdmchan) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - sng_cc_sta_request(1, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id, - sngss7_info->globalFlg, - SIT_STA_CIRRESREQ, - NULL); - - SS7_MSG_TRACE("Transmitted RSC on CIC # %d\n", sngss7_info->circuit->cic); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + SS7_FUNC_TRACE_ENTER (__FUNCTION__); + + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + + sng_cc_sta_request (1, + sngss7_info->suInstId, + sngss7_info->spInstId, + sngss7_info->circuit->id, + sngss7_info->globalFlg, + SIT_STA_CIRRESREQ, + NULL); + + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx RSC\n"); + + SS7_FUNC_TRACE_EXIT (__FUNCTION__); + return; } /******************************************************************************/ -void ft_to_sngss7_rsca(ftdm_channel_t *ftdmchan) +void ft_to_sngss7_rsca (ftdm_channel_t * ftdmchan) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - sng_cc_sta_request(1, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id, - sngss7_info->globalFlg, - SIT_STA_CIRRESRSP, - NULL); - - SS7_MSG_TRACE("Transmitted RSC-RLC on CIC # %d\n", sngss7_info->circuit->cic); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + SS7_FUNC_TRACE_ENTER (__FUNCTION__); + + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + + sng_cc_sta_request (1, + sngss7_info->suInstId, + sngss7_info->spInstId, + sngss7_info->circuit->id, + sngss7_info->globalFlg, + SIT_STA_CIRRESRSP, + NULL); + + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx RSC-RLC\n"); + + SS7_FUNC_TRACE_EXIT (__FUNCTION__); + return; } /******************************************************************************/ -void ft_to_sngss7_blo(ftdm_channel_t *ftdmchan) +void ft_to_sngss7_blo (ftdm_channel_t * ftdmchan) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - sng_cc_sta_request(1, - 0, - 0, - sngss7_info->circuit->id, - sngss7_info->globalFlg, - SIT_STA_CIRBLOREQ, - NULL); - - SS7_MSG_TRACE("Transmitted BLO on CIC # %d\n", sngss7_info->circuit->cic); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + SS7_FUNC_TRACE_ENTER (__FUNCTION__); + + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + + sng_cc_sta_request (1, + 0, + 0, + sngss7_info->circuit->id, + sngss7_info->globalFlg, + SIT_STA_CIRBLOREQ, + NULL); + + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx BLO\n"); + + SS7_FUNC_TRACE_EXIT (__FUNCTION__); + return; } /******************************************************************************/ -void ft_to_sngss7_bla(ftdm_channel_t *ftdmchan) +void ft_to_sngss7_bla (ftdm_channel_t * ftdmchan) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - sng_cc_sta_request(1, - 0, - 0, - sngss7_info->circuit->id, - sngss7_info->globalFlg, - SIT_STA_CIRBLORSP, - NULL); - - SS7_MSG_TRACE("Transmitted BLA on CIC # %d\n", sngss7_info->circuit->cic); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + SS7_FUNC_TRACE_ENTER (__FUNCTION__); + + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + + sng_cc_sta_request (1, + 0, + 0, + sngss7_info->circuit->id, + sngss7_info->globalFlg, + SIT_STA_CIRBLORSP, + NULL); + + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx BLA\n"); + + SS7_FUNC_TRACE_EXIT (__FUNCTION__); + return; } /******************************************************************************/ -void ft_to_sngss7_ubl(ftdm_channel_t *ftdmchan) +void +ft_to_sngss7_ubl (ftdm_channel_t * ftdmchan) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - sng_cc_sta_request(1, - 0, - 0, - sngss7_info->circuit->id, - sngss7_info->globalFlg, - SIT_STA_CIRUBLREQ, - NULL); - - SS7_MSG_TRACE("Transmitted UBL on CIC # %d\n", sngss7_info->circuit->cic); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + SS7_FUNC_TRACE_ENTER (__FUNCTION__); + + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + + sng_cc_sta_request (1, + 0, + 0, + sngss7_info->circuit->id, + sngss7_info->globalFlg, + SIT_STA_CIRUBLREQ, + NULL); + + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx UBL\n"); + + SS7_FUNC_TRACE_EXIT (__FUNCTION__); + return; } /******************************************************************************/ -void ft_to_sngss7_uba(ftdm_channel_t *ftdmchan) +void ft_to_sngss7_uba (ftdm_channel_t * ftdmchan) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - sng_cc_sta_request(1, - 0, - 0, - sngss7_info->circuit->id, - sngss7_info->globalFlg, - SIT_STA_CIRUBLRSP, - NULL); - - SS7_MSG_TRACE("Transmitted UBA on CIC # %d\n", sngss7_info->circuit->cic); - - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; + SS7_FUNC_TRACE_ENTER (__FUNCTION__); + + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + + sng_cc_sta_request (1, + 0, + 0, + sngss7_info->circuit->id, + sngss7_info->globalFlg, + SIT_STA_CIRUBLRSP, + NULL); + + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx UBA\n"); + + SS7_FUNC_TRACE_EXIT (__FUNCTION__); + return; } /******************************************************************************/ -void ft_to_sngss7_lpa(ftdm_channel_t *ftdmchan) +void ft_to_sngss7_lpa (ftdm_channel_t * ftdmchan) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - - sng_cc_sta_request(1, - sngss7_info->suInstId, - sngss7_info->spInstId, - sngss7_info->circuit->id, - sngss7_info->globalFlg, - SIT_STA_LOOPBACKACK, - NULL); - - SS7_MSG_TRACE("Transmitted LPA on CIC # %d\n", sngss7_info->circuit->cic); + SS7_FUNC_TRACE_ENTER (__FUNCTION__); + + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + + sng_cc_sta_request (1, + sngss7_info->suInstId, + sngss7_info->spInstId, + sngss7_info->circuit->id, + sngss7_info->globalFlg, + SIT_STA_LOOPBACKACK, + NULL); + + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx LPA\n"); + + SS7_FUNC_TRACE_EXIT (__FUNCTION__); +return; +} - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; +/******************************************************************************/ +void ft_to_sngss7_gra (ftdm_channel_t * ftdmchan) +{ + SS7_FUNC_TRACE_ENTER (__FUNCTION__); + + sngss7_span_data_t *span = ftdmchan->span->mod_data; + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + SiStaEvnt gra; + + /* clean out the gra struct */ + memset (&gra, 0x0, sizeof (gra)); + + gra.rangStat.eh.pres = PRSNT_NODEF; + + /* fill in the range */ + gra.rangStat.range.pres = PRSNT_NODEF; + gra.rangStat.range.val = span->grs.range; + + /* fill in the status */ + gra.rangStat.status.pres = PRSNT_NODEF; + gra.rangStat.status.len = ((span->grs.range + 1) >> 3) + (((span->grs.range + 1) & 0x07) ? 1 : 0); + + /* the status field should be 1 if blocked for maintenace reasons + * and 0 is not blocked....since we memset the struct nothing to do + */ + + /* send the GRA to LibSng-SS7 */ + sng_cc_sta_request (1, + 0, + 0, + span->grs.circuit, + 0, + SIT_STA_GRSRSP, + &gra); + + SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx GRA\n"); + + SS7_FUNC_TRACE_EXIT (__FUNCTION__); + return; } /******************************************************************************/ -void ft_to_sngss7_gra(ftdm_channel_t *ftdmchan) +void ft_to_sngss7_grs (ftdm_channel_t * ftdmchan) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); +SS7_FUNC_TRACE_ENTER (__FUNCTION__); + +sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; +ftdm_span_t *span = ftdmchan->span; + +SiStaEvnt grs; - sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; +memset (&grs, 0x0, sizeof (grs)); - /* get the original channel the message came in on */ - sngss7_info = g_ftdm_sngss7_data.cfg.isupCircuit[sngss7_info->grs.circuit].obj; +grs.rangStat.eh.pres = PRSNT_NODEF; +grs.rangStat.range.pres = PRSNT_NODEF; +grs.rangStat.range.val = span->chan_count-1; - sng_cc_sta_request(1, - 0, - 0, - sngss7_info->circuit->id, - sngss7_info->globalFlg, - SIT_STA_GRSRSP, - NULL); +sng_cc_sta_request (1, + 0, + 0, + sngss7_info->circuit->id, + 0, + SIT_STA_GRSREQ, + &grs); - SS7_MSG_TRACE("Transmitted GRA on CIC # %d\n", sngss7_info->circuit->cic); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return; +SS7_MSG_TRACE(ftdmchan, sngss7_info, "Tx GRS\n"); + +SS7_FUNC_TRACE_EXIT (__FUNCTION__); +return; } + /******************************************************************************/ /* For Emacs: * Local Variables: @@ -441,4 +492,3 @@ void ft_to_sngss7_gra(ftdm_channel_t *ftdmchan) * vim:set softtabstop=4 shiftwidth=4 tabstop=4: */ /******************************************************************************/ - diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c new file mode 100644 index 0000000..305e1a5 --- /dev/null +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2009 Konrad Hammel <konrad@sangoma.com> + * 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 original author; nor the names of any 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 OWNER + * 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 ********************************************************************/ +#include "ftmod_sangoma_ss7_main.h" +/******************************************************************************/ + +/* DEFINES ********************************************************************/ +/******************************************************************************/ + +/* GLOBALS ********************************************************************/ +/******************************************************************************/ + +/* PROTOTYPES *****************************************************************/ +int ftmod_ss7_mtplink_sta(uint32_t id, SnMngmt *cfm); +int ftmod_ss7_mtplinkSet_sta(uint32_t id, SnMngmt *cfm); +/******************************************************************************/ + +/* FUNCTIONS ******************************************************************/ +int ftmod_ss7_mtplink_sta(uint32_t id, SnMngmt *cfm) +{ + SnMngmt sta; + + memset(&sta, 0x0, sizeof(sta)); + + sta.hdr.elmId.elmnt = STDLSAP; + sta.hdr.elmId.elmntInst1 = g_ftdm_sngss7_data.cfg.mtpLink[id].id; + + return(sng_sta_mtp3(&sta, cfm)); +} + +/******************************************************************************/ +int ftmod_ss7_mtplinkSet_sta(uint32_t id, SnMngmt *cfm) +{ + SnMngmt sta; + + memset(&sta, 0x0, sizeof(sta)); + + sta.hdr.elmId.elmnt = STLNKSET; + sta.hdr.elmId.elmntInst1 = g_ftdm_sngss7_data.cfg.mtpLinkSet[id].id; + sta.hdr.elmId.elmntInst2 = 1; + + return(sng_sta_mtp3(&sta, cfm)); +} +/******************************************************************************/ + +/******************************************************************************/ +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4: + */ +/******************************************************************************/ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sts.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sts.c new file mode 100644 index 0000000..f760ac4 --- /dev/null +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sts.c @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2009 Konrad Hammel <konrad@sangoma.com> + * 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 original author; nor the names of any 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 OWNER + * 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 ********************************************************************/ +#include "ftmod_sangoma_ss7_main.h" +/******************************************************************************/ + +/* DEFINES ********************************************************************/ +/******************************************************************************/ + +/* GLOBALS ********************************************************************/ +/******************************************************************************/ + +/* PROTOTYPES *****************************************************************/ +/******************************************************************************/ + +/* FUNCTIONS ******************************************************************/ +/******************************************************************************/ + +/******************************************************************************/ +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4: + */ +/******************************************************************************/ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 7852829..97957f3 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -50,6 +50,9 @@ uint8_t copy_cdPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum); int check_for_state_change(ftdm_channel_t *ftdmchan); +int check_cics_in_range(sngss7_chan_data_t *sngss7_info); +int check_for_reset(sngss7_chan_data_t *sngss7_info); + unsigned long get_unique_id(void); ftdm_status_t extract_chan_data(uint32_t circuit, sngss7_chan_data_t **sngss7_info, ftdm_channel_t **ftdmchan); @@ -60,309 +63,391 @@ ftdm_status_t extract_chan_data(uint32_t circuit, sngss7_chan_data_t **sngss7_in uint8_t copy_cgPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum) { - return 0; + return 0; } /******************************************************************************/ uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum) { - int k; - int j; - int flag; - char tmp; - unsigned char lower; - unsigned char upper; - - /**************************************************************************/ - cgPtyNum->eh.pres = PRSNT_NODEF; - /**************************************************************************/ - cgPtyNum->natAddrInd.pres = PRSNT_NODEF; - cgPtyNum->natAddrInd.val = 0x03; - /**************************************************************************/ - cgPtyNum->scrnInd.pres = PRSNT_NODEF; - cgPtyNum->scrnInd.val = ftdm->screen; - /**************************************************************************/ - cgPtyNum->presRest.pres = PRSNT_NODEF; - cgPtyNum->presRest.val = ftdm->pres; - /**************************************************************************/ - cgPtyNum->numPlan.pres = PRSNT_NODEF; - cgPtyNum->numPlan.val = 0x01; - /**************************************************************************/ - cgPtyNum->niInd.pres = PRSNT_NODEF; - cgPtyNum->niInd.val = 0x00; - /**************************************************************************/ - cgPtyNum->addrSig.pres = PRSNT_NODEF; - - k = 0; - j = 0; - flag = 0; - while (1) { - tmp = ftdm->cid_num.digits[k]; - if (tmp != '\0') { - if (isdigit(tmp)) { - lower = atoi(&tmp); - k++; - tmp = ftdm->cid_num.digits[k]; - } else { - while (!(isdigit(tmp)) && (tmp != '\0')) { - k++; - tmp = ftdm->cid_num.digits[k]; - } /* while(!(isdigit(tmp))) */ - - if (tmp != '\0') { - lower = atoi(&tmp); - k++; - tmp = ftdm->cid_num.digits[k]; - } else { - flag = 1; - lower = 0xf; - } /* if (tmp != '\0') */ - } /* (isdigit(tmp)) */ - } else { - flag = 1; - lower = 0xf; - } /* if (tmp != '\0') */ - - tmp = ftdm->cid_num.digits[k]; - if (tmp != '\0') { - if (isdigit(tmp)) { - upper = (atoi(&tmp)) << 4; - } else { - while (!(isdigit(tmp)) && (tmp != '\0')) { - k++; - tmp = ftdm->cid_num.digits[k]; - } /* while(!(isdigit(tmp))) */ - - if (tmp != '\0') { - upper = (atoi(&tmp)) << 4; - k++; - } else { - flag = 1; - upper = 0xf; - } /* if (tmp != '\0') */ - } /* if (isdigit(tmp)) */ - } else { - if (flag == 1){ - upper = 0x0; - } else { - flag = 1; - upper = 0xf; - } /* if (flag == 1) */ - } /* if (tmp != '\0') */ - - cgPtyNum->addrSig.val[j] = upper | lower; - j++; - - if (flag) { - break; - } else { - k++; - } - } /* while(1) */ - - cgPtyNum->addrSig.len = j; - /**************************************************************************/ - cgPtyNum->oddEven.pres = PRSNT_NODEF; - cgPtyNum->oddEven.val = ((cgPtyNum->addrSig.val[j] >>4) == 0x0 ) ? 0x01 : 0x00; - /**************************************************************************/ - return 0; + int k; + int j; + int flag; + char tmp[2]; + unsigned char lower; + unsigned char upper; + + /**************************************************************************/ + cgPtyNum->eh.pres = PRSNT_NODEF; + /**************************************************************************/ + cgPtyNum->natAddrInd.pres = PRSNT_NODEF; + cgPtyNum->natAddrInd.val = 0x03; + /**************************************************************************/ + cgPtyNum->scrnInd.pres = PRSNT_NODEF; + cgPtyNum->scrnInd.val = ftdm->screen; + /**************************************************************************/ + cgPtyNum->presRest.pres = PRSNT_NODEF; + cgPtyNum->presRest.val = ftdm->pres; + /**************************************************************************/ + cgPtyNum->numPlan.pres = PRSNT_NODEF; + cgPtyNum->numPlan.val = 0x01; + /**************************************************************************/ + cgPtyNum->niInd.pres = PRSNT_NODEF; + cgPtyNum->niInd.val = 0x00; + /**************************************************************************/ + cgPtyNum->addrSig.pres = PRSNT_NODEF; + + /* atoi will search through memory starting from the pointer it is given until + * it finds the \0...since tmp is on the stack it will start going through the + * possibly causing corruption. Hard code a \0 to prevent this + */ + tmp[1] = '\0'; + k = 0; + j = 0; + flag = 0; + + while (1) { + tmp[0] = ftdm->cid_num.digits[k]; + + if (tmp[0] != '\0') { + if (isdigit(tmp[0])) { + lower = atoi(&tmp[0]); + k++; + tmp[0] = ftdm->cid_num.digits[k]; + } else { + while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) { + k++; + tmp[0] = ftdm->cid_num.digits[k]; + } /* while(!(isdigit(tmp))) */ + + if (tmp[0] != '\0') { + lower = atoi(&tmp[0]); + k++; + tmp[0] = ftdm->cid_num.digits[k]; + } else { + flag = 1; + lower = 0xf; + } /* if (tmp != '\0') */ + } /* (isdigit(tmp)) */ + } else { + flag = 1; + lower = 0xf; + } /* if (tmp != '\0') */ + + tmp[0] = ftdm->cid_num.digits[k]; + + if (tmp[0] != '\0') { + if (isdigit(tmp[0])) { + upper = (atoi(&tmp[0])) << 4; + } else { + while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) { + k++; + tmp[0] = ftdm->cid_num.digits[k]; + } /* while(!(isdigit(tmp))) */ + + if (tmp[0] != '\0') { + upper = (atoi(&tmp[0])) << 4; + k++; + } else { + flag = 1; + upper = 0xf; + } /* if (tmp != '\0') */ + } /* if (isdigit(tmp)) */ + } else { + if (flag == 1) { + upper = 0x0; + } else { + flag = 1; + upper = 0xf; + } /* if (flag == 1) */ + } /* if (tmp != '\0') */ + + cgPtyNum->addrSig.val[j] = upper | lower; + + j++; + + if (flag) { + break; + } else { + k++; + } + } /* while(1) */ + + cgPtyNum->addrSig.len = j; + + /**************************************************************************/ + cgPtyNum->oddEven.pres = PRSNT_NODEF; + + cgPtyNum->oddEven.val = ((cgPtyNum->addrSig.val[j] >> 4) == 0x0 ) ? 0x01 : 0x00; + + /**************************************************************************/ + return 0; } /******************************************************************************/ uint8_t copy_cdPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum) { - return 0; + return 0; } /******************************************************************************/ uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum) { - int k; - int j; - int flag; - char tmp; - unsigned char lower; - unsigned char upper; - - /**************************************************************************/ - cdPtyNum->eh.pres = PRSNT_NODEF; - /**************************************************************************/ - cdPtyNum->natAddrInd.pres = PRSNT_NODEF; - cdPtyNum->natAddrInd.val = 0x03; - /**************************************************************************/ - cdPtyNum->numPlan.pres = PRSNT_NODEF; - cdPtyNum->numPlan.val = 0x01; - /**************************************************************************/ - cdPtyNum->innInd.pres = PRSNT_NODEF; - cdPtyNum->innInd.val = 0x01; - /**************************************************************************/ - cdPtyNum->addrSig.pres = PRSNT_NODEF; - - k = 0; - j = 0; - flag = 0; - while (1) { - tmp = ftdm->dnis.digits[k]; - if (tmp != '\0') { - if (isdigit(tmp)) { - lower = atoi(&tmp); - k++; - tmp = ftdm->dnis.digits[k]; - } else { - while (!(isdigit(tmp)) && (tmp != '\0')) { - k++; - tmp = ftdm->dnis.digits[k]; - } /* while(!(isdigit(tmp))) */ - - if (tmp != '\0') { - lower = atoi(&tmp); - k++; - tmp = ftdm->dnis.digits[k]; - } else { - flag = 1; - lower = 0xf; - } /* if (tmp != '\0') */ - } /* (isdigit(tmp)) */ - } else { - flag = 1; - lower = 0xf; - } /* if (tmp != '\0') */ - - tmp = ftdm->dnis.digits[k]; - if (tmp != '\0') { - if (isdigit(tmp)) { - upper = (atoi(&tmp)) << 4; - } else { - while (!(isdigit(tmp)) && (tmp != '\0')) { - k++; - tmp = ftdm->dnis.digits[k]; - } /* while(!(isdigit(tmp))) */ - - if (tmp != '\0') { - upper = (atoi(&tmp)) << 4; - k++; - } else { - flag = 1; - upper = 0xf; - } /* if (tmp != '\0') */ - } /* if (isdigit(tmp)) */ - } else { - if (flag == 1){ - upper = 0x0; - } else { - flag = 1; - upper = 0xf; - } /* if (flag == 1) */ - } /* if (tmp != '\0') */ - - cdPtyNum->addrSig.val[j] = upper | lower; - j++; - - if (flag) { - break; - } else { - k++; - } - } /* while(1) */ - - cdPtyNum->addrSig.len = j; - /**************************************************************************/ - cdPtyNum->oddEven.pres = PRSNT_NODEF; - cdPtyNum->oddEven.val = ((cdPtyNum->addrSig.val[j] >>4) == 0x0 ) ? 0x01 : 0x00; - /**************************************************************************/ - return 0; + int k; + int j; + int flag; + char tmp[2]; + unsigned char lower; + unsigned char upper; + + /**************************************************************************/ + cdPtyNum->eh.pres = PRSNT_NODEF; + /**************************************************************************/ + cdPtyNum->natAddrInd.pres = PRSNT_NODEF; + cdPtyNum->natAddrInd.val = 0x03; + /**************************************************************************/ + cdPtyNum->numPlan.pres = PRSNT_NODEF; + cdPtyNum->numPlan.val = 0x01; + /**************************************************************************/ + cdPtyNum->innInd.pres = PRSNT_NODEF; + cdPtyNum->innInd.val = 0x01; + /**************************************************************************/ + cdPtyNum->addrSig.pres = PRSNT_NODEF; + + /* atoi will search through memory starting from the pointer it is given until + * it finds the \0...since tmp is on the stack it will start going through the + * possibly causing corruption. Hard code a \0 to prevent this + */ + tmp[1] = '\0'; + k = 0; + j = 0; + flag = 0; + + while (1) { + tmp[0] = ftdm->dnis.digits[k]; + + if (tmp[0] != '\0') { + if (isdigit(tmp[0])) { + lower = atoi(&tmp[0]); + k++; + tmp[0] = ftdm->dnis.digits[k]; + } else { + while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) { + k++; + tmp[0] = ftdm->dnis.digits[k]; + } /* while(!(isdigit(tmp))) */ + + if (tmp[0] != '\0') { + lower = atoi(&tmp[0]); + k++; + tmp[0] = ftdm->dnis.digits[k]; + } else { + flag = 1; + lower = 0xf; + } /* if (tmp != '\0') */ + } /* (isdigit(tmp)) */ + } else { + flag = 1; + lower = 0xf; + } /* if (tmp != '\0') */ + + tmp[0] = ftdm->dnis.digits[k]; + + if (tmp[0] != '\0') { + if (isdigit(tmp[0])) { + upper = (atoi(&tmp[0])) << 4; + } else { + while (!(isdigit(tmp[0])) && (tmp[0] != '\0')) { + k++; + tmp[0] = ftdm->dnis.digits[k]; + } /* while(!(isdigit(tmp))) */ + + if (tmp[0] != '\0') { + upper = (atoi(&tmp[0])) << 4; + k++; + } else { + flag = 1; + upper = 0xf; + } /* if (tmp != '\0') */ + } /* if (isdigit(tmp)) */ + } else { + if (flag == 1) { + upper = 0x0; + } else { + flag = 1; + upper = 0xf; + } /* if (flag == 1) */ + } /* if (tmp != '\0') */ + + cdPtyNum->addrSig.val[j] = upper | lower; + + j++; + + if (flag) { + break; + } else { + k++; + } + } /* while(1) */ + + cdPtyNum->addrSig.len = j; + + /**************************************************************************/ + cdPtyNum->oddEven.pres = PRSNT_NODEF; + + cdPtyNum->oddEven.val = ((cdPtyNum->addrSig.val[j] >> 4) == 0x0 ) ? 0x01 : 0x00; + + /**************************************************************************/ + return 0; } /******************************************************************************/ uint8_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven) { - uint8_t i; - uint8_t j; - - /* check if the token string is present */ - if (str.pres == 1) { - j=0; - - for (i=0; i < str.len; i++) { - sprintf(&ftdm[j], "%d", (str.val[i] & 0x0F)); - j++; - sprintf(&ftdm[j], "%d", ((str.val[i] & 0xF0) >> 4)); - j++; - } - - /* if the odd flag is up the last digit is a fake "0" */ - if ((oddEven.pres == 1) && (oddEven.val == 1)) { - ftdm[j-1] = '\0'; - } else { - ftdm[j] = '\0'; - } - } else { - SS7_ERROR("Asked to copy tknStr that is not present!\n"); - return 1; - } - - return 0; + uint8_t i; + uint8_t j; + + /* check if the token string is present */ + + if (str.pres == 1) { + j = 0; + + for (i = 0; i < str.len; i++) { + sprintf(&ftdm[j], "%d", (str.val[i] & 0x0F)); + j++; + sprintf(&ftdm[j], "%d", ((str.val[i] & 0xF0) >> 4)); + j++; + } + + /* if the odd flag is up the last digit is a fake "0" */ + if ((oddEven.pres == 1) && (oddEven.val == 1)) { + ftdm[j-1] = '\0'; + } else { + ftdm[j] = '\0'; + } + } else { + SS7_ERROR("Asked to copy tknStr that is not present!\n"); + return 1; + } + + return 0; } /******************************************************************************/ int check_for_state_change(ftdm_channel_t *ftdmchan) { + /* check to see if there are any pending state changes on the channel and give them a sec to happen*/ + ftdm_wait_for_flag_cleared(ftdmchan, FTDM_CHANNEL_STATE_CHANGE, 500); + + /* check the flag to confirm it is clear now */ + + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { + /* the flag is still up...so we have a problem */ + SS7_DEBUG_CHAN(ftdmchan, "FTDM_CHANNEL_STATE_CHANGE flag set for over 500ms, channel state = %s\n", + ftdm_channel_state2str (ftdmchan->state)); + + return 1; + } + + return 0; +} + +/******************************************************************************/ +int check_cics_in_range(sngss7_chan_data_t *sngss7_info) +{ + + #if 0 - SS7_DEBUG("Checking for pending state change on span: %d, chan: %d\n!", - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id); + ftdm_channel_t *tmp_ftdmchan; + sngss7_chan_data_t *tmp_sngss7_info; + int i = 0; + + /* check all the circuits in the range to see if we are the last ckt to reset */ + for ( i = sngss7_info->grs.circuit; i < ( sngss7_info->grs.range + 1 ); i++ ) { + if ( g_ftdm_sngss7_data.cfg.isupCircuit[i].siglink == 0 ) { + + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(g_ftdm_sngss7_data.cfg.isupCircuit[i].id, &tmp_sngss7_info, &tmp_ftdmchan)) { + SS7_ERROR("Failed to extract channel data for circuit = %d!\n", g_ftdm_sngss7_data.cfg.isupCircuit[i].id); + return 0; + } + + /* check if the channel still has the reset flag done is up */ + if (!sngss7_test_flag(tmp_sngss7_info, FLAG_GRP_RESET_RX_DN)) { + SS7_DEBUG_CHAN(tmp_ftdmchan, "[CIC:%d] Still processing reset...\n", tmp_sngss7_info->circuit->cic); + return 0; + } + } /* if not siglink */ + } /* for */ + + SS7_DEBUG("All circuits out of reset: circuit=%d, range=%d\n", + sngss7_info->grs.circuit, + sngss7_info->grs.range); + return 1; + #endif - /* check to see if there are any pending state changes on the channel and give them a sec to happen*/ - ftdm_wait_for_flag_cleared(ftdmchan, FTDM_CHANNEL_STATE_CHANGE, 500); - - /* check the flag to confirm it is clear now */ - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { - /* the flag is still up...so we have a problem */ - SS7_ERROR("FTDM_CHANNEL_STATE_CHANGE set for over 500ms on span: %d, chan: %d\n", - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id); - - /* move the state of the channel to RESTART to force a reset */ - ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_RESTART); - - return 1; - } - return 0; + + return 0; + } /******************************************************************************/ ftdm_status_t extract_chan_data(uint32_t circuit, sngss7_chan_data_t **sngss7_info, ftdm_channel_t **ftdmchan) { - SS7_FUNC_TRACE_ENTER(__FUNCTION__); + /*SS7_FUNC_TRACE_ENTER(__FUNCTION__);*/ + + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].obj == NULL) { + SS7_ERROR("sngss7_info is Null for circuit #%d\n", circuit); + return FTDM_FAIL; + } - if (g_ftdm_sngss7_data.cfg.isupCircuit[circuit].obj == NULL) { - SS7_ERROR("sngss7_info is Null for circuit #%d\n", circuit); - return FTDM_FAIL; - } + ftdm_assert_return(g_ftdm_sngss7_data.cfg.isupCkt[circuit].obj, FTDM_FAIL, "received message on signalling link or non-configured cic\n"); - ftdm_assert_return(g_ftdm_sngss7_data.cfg.isupCircuit[circuit].obj,FTDM_FAIL,"received message on signalling link or non-configured cic\n"); - *sngss7_info = g_ftdm_sngss7_data.cfg.isupCircuit[circuit].obj; + *sngss7_info = g_ftdm_sngss7_data.cfg.isupCkt[circuit].obj; - ftdm_assert_return((*sngss7_info)->ftdmchan,FTDM_FAIL,"received message on signalling link or non-configured cic\n"); - *ftdmchan = (*sngss7_info)->ftdmchan; + ftdm_assert_return((*sngss7_info)->ftdmchan, FTDM_FAIL, "received message on signalling link or non-configured cic\n"); + *ftdmchan = (*sngss7_info)->ftdmchan; + + /*SS7_FUNC_TRACE_EXIT(__FUNCTION__);*/ + return FTDM_SUCCESS; +} + +/******************************************************************************/ +int check_for_reset(sngss7_chan_data_t *sngss7_info) +{ - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_SUCCESS; + if (sngss7_test_flag(sngss7_info,FLAG_RESET_RX)) { + return 1; + } + + if (sngss7_test_flag(sngss7_info,FLAG_RESET_TX)) { + return 1; + } + + if (sngss7_test_flag(sngss7_info,FLAG_GRP_RESET_RX)) { + return 1; + } + + if (sngss7_test_flag(sngss7_info,FLAG_GRP_RESET_TX)) { + return 1; + } + + return 0; + } /******************************************************************************/ unsigned long get_unique_id(void) { - if (sngss7_id < 420000000) { - sngss7_id++; - } else { - sngss7_id = 1; - } + if (sngss7_id < 420000000) { + sngss7_id++; + } else { + sngss7_id = 1; + } - return(sngss7_id); + return(sngss7_id); } /******************************************************************************/ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c index 2d3aed6..aa639d1 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c @@ -41,10 +41,10 @@ /* GLOBALS ********************************************************************/ typedef struct sng_timeslot { - int channel; - int siglink; - int gap; - int hole; + int channel; + int siglink; + int gap; + int hole; }sng_timeslot_t; /******************************************************************************/ @@ -55,8 +55,7 @@ static int ftmod_ss7_parse_sng_isup(ftdm_conf_node_t *sng_isup); static int ftmod_ss7_parse_mtp_linksets(ftdm_conf_node_t *mtp_linksets); static int ftmod_ss7_parse_mtp_linkset(ftdm_conf_node_t *mtp_linkset); -static int ftmod_ss7_parse_mtp_link(ftdm_conf_node_t *mtp_link, sng_mtp1Link_t *mtp1_link, - sng_mtp2Link_t *mtp2_link, sng_mtp3Link_t *mtp3_link); +static int ftmod_ss7_parse_mtp_link(ftdm_conf_node_t *mtp_link, sng_mtp_link_t *mtpLink); static int ftmod_ss7_parse_mtp_routes(ftdm_conf_node_t *mtp_routes); static int ftmod_ss7_parse_mtp_route(ftdm_conf_node_t *mtp_route); @@ -64,14 +63,15 @@ static int ftmod_ss7_parse_mtp_route(ftdm_conf_node_t *mtp_route); static int ftmod_ss7_parse_isup_interfaces(ftdm_conf_node_t *isup_interfaces); static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface); -static int ftmod_ss7_fill_in_mtp1_link(sng_mtp1Link_t *mtp1_link); -static int ftmod_ss7_fill_in_mtp2_link(sng_mtp2Link_t *mtp2_link); -static int ftmod_ss7_fill_in_mtp3_link(sng_mtp3Link_t *mtp3_link); -static int ftmod_ss7_fill_in_mtp3_linkset(sng_mtp3LinkSet_t *mtp3_linkset); -static int ftmod_ss7_fill_in_mtp3_route(sng_mtp3Route_t *mtp3_route); -static int ftmod_ss7_fill_in_mtp3_isup_interface(sng_mtp3Route_t *mtp3_route); -static int ftmod_ss7_fill_in_isup_interface(sng_isupInterface_t *sng_isup); -static int ftmod_ss7_fill_in_isup_cc_interface(sng_isup_cc_t *sng_cc); +static int ftmod_ss7_fill_in_mtpLink(sng_mtp_link_t *mtpLink); + +static int ftmod_ss7_fill_in_mtpLinkSet(sng_link_set_t *mtpLinkSet); + +static int ftmod_ss7_fill_in_mtp3_route(sng_route_t *mtp3_route); +static int ftmod_ss7_fill_in_nsap(sng_route_t *mtp3_route); + +static int ftmod_ss7_fill_in_isup_interface(sng_isup_inf_t *sng_isup); +static int ftmod_ss7_fill_in_isap(sng_isap_t *sng_isap); static int ftmod_ss7_fill_in_self_route(int spc, int linkType, int switchType, int ssf); @@ -83,736 +83,750 @@ static int ftmod_ss7_next_timeslot(char *ch_map, sng_timeslot_t *timeslot); /* FUNCTIONS ******************************************************************/ int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *span) { - int i = 0; - int x = 0; - const char *var = NULL; - const char *val = NULL; - ftdm_conf_node_t *ptr = NULL; - sng_mtp3Route_t self_route; - char ch_map[MAX_CIC_MAP_LENGTH]; - int typeCntrl = 0; - int cicbase = 0; - - /* clean out the self route */ - memset(&self_route, 0x0, sizeof(sng_mtp3Route_t)); - - var = ftdm_parameters[i].var; - val = ftdm_parameters[i].val; - ptr = (ftdm_conf_node_t *)ftdm_parameters[i].ptr; - - /* confirm that the first parameter is the "confnode" */ - if (!strcasecmp(var, "confnode")) { - /* parse the confnode and fill in the global libsng_ss7 config structure */ - if (ftmod_ss7_parse_sng_isup(ptr)) { - SS7_ERROR("Failed to parse the \"confnode\"!\n"); - goto ftmod_ss7_parse_xml_error; - } - } else { - /* ERROR...exit */ - SS7_ERROR("The \"confnode\" configuration was not the first parameter!\n"); - SS7_ERROR("\tFound \"%s\" in the first slot\n", var); - goto ftmod_ss7_parse_xml_error; - } - - i++; - while (ftdm_parameters[i].var != NULL) { - - var = ftdm_parameters[i].var; - val = ftdm_parameters[i].val; - - if (!strcasecmp(var, "ch_map")) { - /**********************************************************************/ - strcpy(ch_map, val); - SS7_DEBUG("\tFound channel map \"%s\"\n", ch_map); - /**********************************************************************/ - } else if (!strcasecmp(var, "typeCntrl")) { - if (!strcasecmp(val, "bothway")) { - typeCntrl = SNG_BOTHWAY; - SS7_DEBUG("\tFound control type \"bothway\"\n"); - } else if (!strcasecmp(val, "incoming")) { - typeCntrl = SNG_INCOMING; - SS7_DEBUG("\tFound control type \"incoming\"\n"); - } else if (!strcasecmp(val, "outgoing")) { - typeCntrl = SNG_OUTGOING; - SS7_DEBUG("\tFound control type \"outgoing\"\n"); - } else if (!strcasecmp(val, "controlled")) { - typeCntrl = SNG_CONTROLLED; - SS7_DEBUG("\tFound control type \"controlled\"\n"); - } else if (!strcasecmp(val, "controlling")) { - typeCntrl = SNG_CONTROLLING; - SS7_DEBUG("\tFound control type \"controlling\"\n"); - } else { - SS7_ERROR("Found invalid circuit control type \"%s\"!", val); - goto ftmod_ss7_parse_xml_error; - } - /**********************************************************************/ - } else if (!strcasecmp(var, "cicbase")) { - cicbase = atoi(val); - SS7_DEBUG("\tFound cicbase = %d\n", cicbase); - /**********************************************************************/ - } else if (!strcasecmp(var, "dialplan")) { - /* do i give a shit about this??? */ - /**********************************************************************/ - } else if (!strcasecmp(var, "context")) { - /* do i give a shit about this??? */ - /**********************************************************************/ - } else if (!strcasecmp(var, "isup_interface")) { - /* go through all the existing interfaces and see if we find a match */ - x = 1; - while (g_ftdm_sngss7_data.cfg.isupInterface[x].id != 0) { - if (!strcasecmp(g_ftdm_sngss7_data.cfg.isupInterface[x].name, val)) { - /* we have a match so break out of this loop */ - break; - } - /* move on to the next one */ - x++; - } - SS7_DEBUG("\tFound isup_interface = %s\n",g_ftdm_sngss7_data.cfg.isupInterface[x].name ); - /**********************************************************************/ - } else { - SS7_ERROR("Unknown parameter found =\"%s\"...ignoring it!\n", var); - /**********************************************************************/ - } - - i++; - } /* while (ftdm_parameters[i].var != NULL) */ - - /* setup the self mtp3 route */ - i = g_ftdm_sngss7_data.cfg.isupInterface[x].mtp3RouteId; - - if(ftmod_ss7_fill_in_self_route(atoi(g_ftdm_sngss7_data.cfg.spc), - g_ftdm_sngss7_data.cfg.mtp3Route[i].linkType, - g_ftdm_sngss7_data.cfg.isupInterface[x].switchType, - g_ftdm_sngss7_data.cfg.mtp3Route[i].ssf)) { - SS7_ERROR("Failed to fill in self route structure!\n"); - goto ftmod_ss7_parse_xml_error; - } - - - /* setup the circuits structure */ - if(ftmod_ss7_fill_in_circuits(ch_map, - cicbase, - typeCntrl, - g_ftdm_sngss7_data.cfg.isupInterface[x].id, - span)) { - SS7_ERROR("Failed to fill in circuits structure!\n"); - goto ftmod_ss7_parse_xml_error; - } - - return FTDM_SUCCESS; + int i = 0; + int x = 0; + const char *var = NULL; + const char *val = NULL; + ftdm_conf_node_t *ptr = NULL; + sng_route_t self_route; + char ch_map[MAX_CIC_MAP_LENGTH]; + int typeCntrl = 0; + int cicbase = 0; + + /* clean out the self route */ + memset(&self_route, 0x0, sizeof(sng_route_t)); + + var = ftdm_parameters[i].var; + val = ftdm_parameters[i].val; + ptr = (ftdm_conf_node_t *)ftdm_parameters[i].ptr; + + /* confirm that the first parameter is the "confnode" */ + if (!strcasecmp(var, "confnode")) { + /* parse the confnode and fill in the global libsng_ss7 config structure */ + if (ftmod_ss7_parse_sng_isup(ptr)) { + SS7_ERROR("Failed to parse the \"confnode\"!\n"); + goto ftmod_ss7_parse_xml_error; + } + } else { + /* ERROR...exit */ + SS7_ERROR("The \"confnode\" configuration was not the first parameter!\n"); + SS7_ERROR("\tFound \"%s\" in the first slot\n", var); + goto ftmod_ss7_parse_xml_error; + } + + i++; + while (ftdm_parameters[i].var != NULL) { + + var = ftdm_parameters[i].var; + val = ftdm_parameters[i].val; + + if (!strcasecmp(var, "ch_map")) { + /**********************************************************************/ + strcpy(ch_map, val); + SS7_DEBUG("\tFound channel map \"%s\"\n", ch_map); + /**********************************************************************/ + } else if (!strcasecmp(var, "typeCntrl")) { + if (!strcasecmp(val, "bothway")) { + typeCntrl = BOTHWAY; + SS7_DEBUG("\tFound control type \"bothway\"\n"); + } else if (!strcasecmp(val, "incoming")) { + typeCntrl = INCOMING; + SS7_DEBUG("\tFound control type \"incoming\"\n"); + } else if (!strcasecmp(val, "outgoing")) { + typeCntrl = OUTGOING; + SS7_DEBUG("\tFound control type \"outgoing\"\n"); + } else if (!strcasecmp(val, "controlled")) { + typeCntrl = CONTROLLED; + SS7_DEBUG("\tFound control type \"controlled\"\n"); + } else if (!strcasecmp(val, "controlling")) { + typeCntrl = CONTROLLING; + SS7_DEBUG("\tFound control type \"controlling\"\n"); + } else { + SS7_ERROR("Found invalid circuit control type \"%s\"!", val); + goto ftmod_ss7_parse_xml_error; + } + /**********************************************************************/ + } else if (!strcasecmp(var, "cicbase")) { + cicbase = atoi(val); + SS7_DEBUG("\tFound cicbase = %d\n", cicbase); + /**********************************************************************/ + } else if (!strcasecmp(var, "dialplan")) { + /* do i give a shit about this??? */ + /**********************************************************************/ + } else if (!strcasecmp(var, "context")) { + /* do i give a shit about this??? */ + /**********************************************************************/ + } else if (!strcasecmp(var, "isup_interface")) { + /* go through all the existing interfaces and see if we find a match */ + x = 1; + while (g_ftdm_sngss7_data.cfg.isupIntf[x].id != 0) { + if (!strcasecmp(g_ftdm_sngss7_data.cfg.isupIntf[x].name, val)) { + /* we have a match so break out of this loop */ + break; + } + /* move on to the next one */ + x++; + } + SS7_DEBUG("\tFound isup_interface = %s\n",g_ftdm_sngss7_data.cfg.isupIntf[x].name ); + /**********************************************************************/ + } else { + SS7_ERROR("Unknown parameter found =\"%s\"...ignoring it!\n", var); + /**********************************************************************/ + } + + i++; + } /* while (ftdm_parameters[i].var != NULL) */ + + /* setup the self mtp3 route */ + i = g_ftdm_sngss7_data.cfg.isupIntf[x].mtpRouteId; + + if(ftmod_ss7_fill_in_self_route(g_ftdm_sngss7_data.cfg.isupIntf[x].spc, + g_ftdm_sngss7_data.cfg.mtpRoute[i].linkType, + g_ftdm_sngss7_data.cfg.mtpRoute[i].switchType, + g_ftdm_sngss7_data.cfg.mtpRoute[i].ssf)) { + + SS7_ERROR("Failed to fill in self route structure!\n"); + goto ftmod_ss7_parse_xml_error; + + } + + + /* setup the circuits structure */ + if(ftmod_ss7_fill_in_circuits(ch_map, cicbase, typeCntrl, + g_ftdm_sngss7_data.cfg.isupIntf[x].id, span)) { + SS7_ERROR("Failed to fill in circuits structure!\n"); + goto ftmod_ss7_parse_xml_error; + } + + return FTDM_SUCCESS; ftmod_ss7_parse_xml_error: - return FTDM_FAIL; + return FTDM_FAIL; } /******************************************************************************/ static int ftmod_ss7_parse_sng_isup(ftdm_conf_node_t *sng_isup) { - ftdm_conf_node_t *mtp_linksets = NULL; - ftdm_conf_node_t *mtp_routes = NULL; - ftdm_conf_node_t *isup_interfaces = NULL; - ftdm_conf_node_t *tmp_node = NULL; - - /* confirm that we are looking at sng_isup */ - if (strcasecmp(sng_isup->name, "sng_isup")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"sng_isup\"!\n",sng_isup->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"sng_isup\"...\n"); - } - - /* extract the 3 main sections of the sng_isup block */ - tmp_node = sng_isup->child; - while (tmp_node != NULL) { - - if (!strcasecmp(tmp_node->name, "mtp_linksets")) { - if (mtp_linksets == NULL) { - mtp_linksets = tmp_node; - SS7_DEBUG("\tFound a \"mtp_linksets section!\n"); - } else { - SS7_ERROR("\tFound a second \"mtp_linksets\" section!\n"); - return FTDM_FAIL; - } - } else if (!strcasecmp(tmp_node->name, "mtp_routes")) { - if (mtp_routes == NULL) { - mtp_routes = tmp_node; - SS7_DEBUG("\tFound a \"mtp_routes\" section!\n"); - } else { - SS7_ERROR("\tFound a second \"mtp_routes\" section!\n"); - return FTDM_FAIL; - } - } else if (!strcasecmp(tmp_node->name, "isup_interfaces")) { - if (isup_interfaces == NULL) { - isup_interfaces = tmp_node; - SS7_DEBUG("\tFound a \"isup_interfaces\" section!\n"); - } else { - SS7_ERROR("\tFound a second \"isup_interfaces\" section\n!"); - return FTDM_FAIL; - } - } else { - SS7_ERROR("\tFound an unknown section \"%s\"!\n", tmp_node->name); - return FTDM_FAIL; - } - - /* go to the next sibling */ - tmp_node = tmp_node->next; - - } /* while (tmp_node != NULL) */ - - /* now try to parse the sections */ - if (ftmod_ss7_parse_mtp_linksets(mtp_linksets)) { - SS7_ERROR("Failed to parse \"mtp_linksets\"!\n"); - return FTDM_FAIL; - } - - if (ftmod_ss7_parse_mtp_routes(mtp_routes)) { - SS7_ERROR("Failed to parse \"mtp_routes\"!\n"); - return FTDM_FAIL; - } - - if (ftmod_ss7_parse_isup_interfaces(isup_interfaces)) { - SS7_ERROR("Failed to parse \"isup_interfaces\"!\n"); - return FTDM_FAIL; - } - - return FTDM_SUCCESS; + ftdm_conf_node_t *mtp_linksets = NULL; + ftdm_conf_node_t *mtp_routes = NULL; + ftdm_conf_node_t *isup_interfaces = NULL; + ftdm_conf_node_t *tmp_node = NULL; + + /* confirm that we are looking at sng_isup */ + if (strcasecmp(sng_isup->name, "sng_isup")) { + SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"sng_isup\"!\n",sng_isup->name); + return FTDM_FAIL; + } else { + SS7_DEBUG("Parsing \"sng_isup\"...\n"); + } + + /* extract the 3 main sections of the sng_isup block */ + tmp_node = sng_isup->child; + while (tmp_node != NULL) { + + if (!strcasecmp(tmp_node->name, "mtp_linksets")) { + if (mtp_linksets == NULL) { + mtp_linksets = tmp_node; + SS7_DEBUG("\tFound a \"mtp_linksets section!\n"); + } else { + SS7_ERROR("\tFound a second \"mtp_linksets\" section!\n"); + return FTDM_FAIL; + } + } else if (!strcasecmp(tmp_node->name, "mtp_routes")) { + if (mtp_routes == NULL) { + mtp_routes = tmp_node; + SS7_DEBUG("\tFound a \"mtp_routes\" section!\n"); + } else { + SS7_ERROR("\tFound a second \"mtp_routes\" section!\n"); + return FTDM_FAIL; + } + } else if (!strcasecmp(tmp_node->name, "isup_interfaces")) { + if (isup_interfaces == NULL) { + isup_interfaces = tmp_node; + SS7_DEBUG("\tFound a \"isup_interfaces\" section!\n"); + } else { + SS7_ERROR("\tFound a second \"isup_interfaces\" section\n!"); + return FTDM_FAIL; + } + } else { + SS7_ERROR("\tFound an unknown section \"%s\"!\n", tmp_node->name); + return FTDM_FAIL; + } + + /* go to the next sibling */ + tmp_node = tmp_node->next; + + } /* while (tmp_node != NULL) */ + + /* now try to parse the sections */ + if (ftmod_ss7_parse_mtp_linksets(mtp_linksets)) { + SS7_ERROR("Failed to parse \"mtp_linksets\"!\n"); + return FTDM_FAIL; + } + + if (ftmod_ss7_parse_mtp_routes(mtp_routes)) { + SS7_ERROR("Failed to parse \"mtp_routes\"!\n"); + return FTDM_FAIL; + } + + if (ftmod_ss7_parse_isup_interfaces(isup_interfaces)) { + SS7_ERROR("Failed to parse \"isup_interfaces\"!\n"); + return FTDM_FAIL; + } + + return FTDM_SUCCESS; } /******************************************************************************/ static int ftmod_ss7_parse_mtp_linksets(ftdm_conf_node_t *mtp_linksets) { - ftdm_conf_node_t *mtp_linkset = NULL; + ftdm_conf_node_t *mtp_linkset = NULL; - /* confirm that we are looking at mtp_linksets */ - if (strcasecmp(mtp_linksets->name, "mtp_linksets")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp_linksets\"!\n",mtp_linksets->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"mtp_linksets\"...\n"); - } + /* confirm that we are looking at mtp_linksets */ + if (strcasecmp(mtp_linksets->name, "mtp_linksets")) { + SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp_linksets\"!\n",mtp_linksets->name); + return FTDM_FAIL; + } else { + SS7_DEBUG("Parsing \"mtp_linksets\"...\n"); + } - /* extract the mtp_links */ - mtp_linkset = mtp_linksets->child; + /* extract the mtp_links */ + mtp_linkset = mtp_linksets->child; - /* run through all of the mtp_linksets found */ - while (mtp_linkset != NULL) { - /* try to the parse mtp_linkset */ - if (ftmod_ss7_parse_mtp_linkset(mtp_linkset)) { - SS7_ERROR("Failed to parse \"mtp_linkset\"!\n"); - return FTDM_FAIL; - } + /* run through all of the mtp_linksets found */ + while (mtp_linkset != NULL) { + /* try to the parse mtp_linkset */ + if (ftmod_ss7_parse_mtp_linkset(mtp_linkset)) { + SS7_ERROR("Failed to parse \"mtp_linkset\"!\n"); + return FTDM_FAIL; + } - /* move on to the next linkset */ - mtp_linkset = mtp_linkset->next; + /* move on to the next linkset */ + mtp_linkset = mtp_linkset->next; - } /* while (mtp_linkset != NULL) */ + } /* while (mtp_linkset != NULL) */ - return FTDM_SUCCESS; + return FTDM_SUCCESS; } /******************************************************************************/ static int ftmod_ss7_parse_mtp_linkset(ftdm_conf_node_t *mtp_linkset) { - ftdm_conf_parameter_t *parm = mtp_linkset->parameters; - int num_parms = mtp_linkset->n_parameters; - ftdm_conf_node_t *mtp_link = NULL; - sng_mtp1Link_t mtp1_link[MAX_MTP_LINKS]; - sng_mtp2Link_t mtp2_link[MAX_MTP_LINKS]; - sng_mtp3Link_t mtp3_link[MAX_MTP_LINKS]; - sng_mtp3LinkSet_t mtp3_linkset; - int count; - int i; - - /* initialize the mtp_link structures */ - for (i = 0; i < MAX_MTP_LINKS; i++) { - memset(&mtp1_link[i], 0x0, sizeof(mtp1_link[i])); - memset(&mtp2_link[i], 0x0, sizeof(mtp2_link[i])); - memset(&mtp3_link[i], 0x0, sizeof(mtp3_link[i])); - } - memset(&mtp3_linkset, 0x0, sizeof(mtp3_linkset)); - - /* confirm that we are looking at mtp_linkset */ - if (strcasecmp(mtp_linkset->name, "mtp_linkset")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp_linkset\"!\n",mtp_linkset->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"mtp_linkset\"...\n"); - } - - /* extract all the information from the parameters */ - for (i = 0; i < num_parms; i++) { - /**********************************************************************/ - if (!strcasecmp(parm->var, "name")) { - strcpy((char *)mtp3_linkset.name, parm->val); - SS7_DEBUG("\tFound an \"mtp_linkset\" named = %s\n", mtp3_linkset.name); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "apc")) { - mtp3_linkset.apc = atoi(parm->val); - SS7_DEBUG("\tFound mtp3_linkSet->apc = %d\n", mtp3_linkset.apc); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "minActive")) { - mtp3_linkset.minActive = atoi(parm->val); - SS7_DEBUG("\tFound mtp3_linkSet->minActive = %d\n", mtp3_linkset.minActive); - /**********************************************************************/ - } else { - SS7_ERROR("\tFound an invalid parameter \"%s\"!\n", parm->val); - return FTDM_FAIL; - } - - /* move to the next parmeter */ - parm = parm + 1; - - } /* for (i = 0; i < num_parms; i++) */ - - /* grab the first mtp-link (which sits below the mtp_links section) */ - mtp_link = mtp_linkset->child->child; - - /* initalize the link counter */ - count = 0; - - /* run through all of the mtp_links found */ - while (mtp_link != NULL) { - /* try to the parse mtp_linkset */ - if (ftmod_ss7_parse_mtp_link(mtp_link, &mtp1_link[count], &mtp2_link[count], &mtp3_link[count] )) { - SS7_ERROR("Failed to parse \"mtp_link\"!\n"); - return FTDM_FAIL; - } - - /* incremenet the link counter */ - count++; - - /* move on to the next link */ - mtp_link = mtp_link->next; - - } /* while (mtp_link != NULL) */ - - /* confirm we have the right number of links */ - if (count < 1 || count > 15 ) { - SS7_ERROR("Invalid number of mtp_links found (%d)\n", count); - return FTDM_FAIL; - } else { - mtp3_linkset.numLinks = count; - } - - /* now we need to see if this linkset exists already or not and grab an Id */ - i = 1; - while (g_ftdm_sngss7_data.cfg.mtp3LinkSet[i].id != 0) { - if (!strcasecmp((const char *)g_ftdm_sngss7_data.cfg.mtp3LinkSet[i].name, (const char *)mtp3_linkset.name)) { - /* we've found the linkset...so it has already been configured */ - break; - } - i++; - /* add in error check to make sure we don't go out-of-bounds */ - } - - /* if the id value is 0 that means we didn't find the linkset */ - if (g_ftdm_sngss7_data.cfg.mtp3LinkSet[i].id == 0) { - mtp3_linkset.id = i; - SS7_DEBUG("found new mtp3_linkset, id is = %d\n", mtp3_linkset.id); - } else { - mtp3_linkset.id = i; - SS7_DEBUG("found existing mtp3_linkset, id is = %d\n", mtp3_linkset.id); - } - - /* we now have all the information to fill in the Libsng_ss7 structures */ - i = 0; - count = 0; - while (mtp1_link[i].span != 0 ){ - /* fill in the mtp1 link structure */ - mtp2_link[i].spId = ftmod_ss7_fill_in_mtp1_link(&mtp1_link[i]); - /* fill in the mtp2 link structure */ - mtp3_link[i].mtp2LinkId = ftmod_ss7_fill_in_mtp2_link(&mtp2_link[i]); - /* have to grab a couple of values from the linkset */ - mtp3_link[i].apc = mtp3_linkset.apc; - mtp3_link[i].linkSetId = mtp3_linkset.id; - /* fill in the mtp3 link structure */ - mtp3_linkset.links[count] = ftmod_ss7_fill_in_mtp3_link(&mtp3_link[i]); - /* increment the links counter */ - count++; - /* increment the index value */ - i++; - } - - ftmod_ss7_fill_in_mtp3_linkset(&mtp3_linkset); - - return FTDM_SUCCESS; + ftdm_conf_parameter_t *parm = mtp_linkset->parameters; + int num_parms = mtp_linkset->n_parameters; + ftdm_conf_node_t *mtp_link = NULL; + sng_mtp_link_t mtpLink[MAX_MTP_LINKS+1]; + sng_link_set_t mtpLinkSet; + int count; + int i; + + /* initialize the mtp_link structures */ + for (i = 0; i < (MAX_MTP_LINKS + 1); i++) { + memset(&mtpLink[i], 0x0, sizeof(mtpLink[i])); + } + memset(&mtpLinkSet, 0x0, sizeof(mtpLinkSet)); + + /* confirm that we are looking at mtp_linkset */ + if (strcasecmp(mtp_linkset->name, "mtp_linkset")) { + SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp_linkset\"!\n",mtp_linkset->name); + return FTDM_FAIL; + } else { + SS7_DEBUG("Parsing \"mtp_linkset\"...\n"); + } + + /* extract all the information from the parameters */ + for (i = 0; i < num_parms; i++) { + /**********************************************************************/ + if (!strcasecmp(parm->var, "name")) { + strcpy((char *)mtpLinkSet.name, parm->val); + SS7_DEBUG("\tFound an \"mtp_linkset\" named = %s\n", mtpLinkSet.name); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "apc")) { + mtpLinkSet.apc = atoi(parm->val); + SS7_DEBUG("\tFoundmtpLinkSet->apc = %d\n", mtpLinkSet.apc); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "minActive")) { + mtpLinkSet.minActive = atoi(parm->val); + SS7_DEBUG("\tFoundmtpLinkSet->minActive = %d\n", mtpLinkSet.minActive); + /**********************************************************************/ + } else { + SS7_ERROR("\tFound an invalid parameter \"%s\"!\n", parm->val); + return FTDM_FAIL; + } + + /* move to the next parmeter */ + parm = parm + 1; + + } /* for (i = 0; i < num_parms; i++) */ + + /* grab the first mtp-link (which sits below the mtp_links section) */ + mtp_link = mtp_linkset->child->child; + + /* initalize the link counter */ + count = 0; + + /* run through all of the mtp_links found */ + while (mtp_link != NULL) { + /* try to the parse mtp_linkset */ + if (ftmod_ss7_parse_mtp_link(mtp_link, &mtpLink[count] )) { + SS7_ERROR("Failed to parse \"mtp_link\"!\n"); + return FTDM_FAIL; + } + + /* incremenet the link counter */ + count++; + + /* move on to the next link */ + mtp_link = mtp_link->next; + + } /* while (mtp_link != NULL) */ + + /* confirm we have the right number of links */ + if (count < 1 || count > 15 ) { + SS7_ERROR("Invalid number of mtp_links found (%d)\n", count); + return FTDM_FAIL; + } else { + mtpLinkSet.numLinks = count; + } + + /* now we need to see if this linkset exists already or not and grab an Id */ + i = 1; + while (g_ftdm_sngss7_data.cfg.mtpLinkSet[i].id != 0) { + if (!strcasecmp((const char *)g_ftdm_sngss7_data.cfg.mtpLinkSet[i].name, (const char *)mtpLinkSet.name)) { + /* we've found the linkset...so it has already been configured */ + break; + } + i++; + /* add in error check to make sure we don't go out-of-bounds */ + } + + /* if the id value is 0 that means we didn't find the linkset */ + if (g_ftdm_sngss7_data.cfg.mtpLinkSet[i].id == 0) { + mtpLinkSet.id = i; + SS7_DEBUG("found new mtpLinkSet, id is = %d\n", mtpLinkSet.id); + } else { + mtpLinkSet.id = i; + SS7_DEBUG("found existing mtpLinkSet, id is = %d\n", mtpLinkSet.id); + } + + /* we now have all the information to fill in the Libsng_ss7 structures */ + i = 0; + count = 0; + while (mtpLink[i].mtp1.span != 0 ){ + + /* have to grab a couple of values from the linkset */ + mtpLink[i].mtp3.apc = mtpLinkSet.apc; + mtpLink[i].mtp3.linkSetId = mtpLinkSet.id; + + /* fill in the mtplink structure */ + mtpLinkSet.links[count] = ftmod_ss7_fill_in_mtpLink(&mtpLink[i]); + + /* increment the links counter */ + count++; + + /* increment the index value */ + i++; + } + + ftmod_ss7_fill_in_mtpLinkSet(&mtpLinkSet); + + return FTDM_SUCCESS; } /******************************************************************************/ -static int ftmod_ss7_parse_mtp_link(ftdm_conf_node_t *mtp_link, sng_mtp1Link_t *mtp1_link, - sng_mtp2Link_t *mtp2_link, sng_mtp3Link_t *mtp3_link) +static int ftmod_ss7_parse_mtp_link(ftdm_conf_node_t *mtp_link, sng_mtp_link_t *mtpLink) { - ftdm_conf_parameter_t *parm = mtp_link->parameters; - int num_parms = mtp_link->n_parameters; - int i; - - /* confirm that we are looking at an mtp_link */ - if (strcasecmp(mtp_link->name, "mtp_link")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp_link\"!\n",mtp_link->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"mtp_link\"...\n"); - } - - for (i = 0; i < num_parms; i++) { - /* try to match the parameter to what we expect */ - /**********************************************************************/ - if (!strcasecmp(parm->var, "name")) { - strcpy((char *)mtp1_link->name, parm->val); - strcpy((char *)mtp2_link->name, parm->val); - strcpy((char *)mtp3_link->name, parm->val); - SS7_DEBUG("\tFound an \"mtp_link\" named = %s\n", mtp1_link->name); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "span")) { - mtp1_link->span = atoi(parm->val); - SS7_DEBUG("\tFound mtp1_link->span = %d\n", mtp1_link->span); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "chan")) { - mtp1_link->chan = atoi(parm->val); - SS7_DEBUG("\tFound mtp1_link->chan = %d\n", mtp1_link->chan); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "span")) { - mtp1_link->span = atoi(parm->val); - SS7_DEBUG("\tFound mtp1_link->span = %d\n", mtp1_link->span); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "errorType")) { - if (!strcasecmp(parm->val, "basic")) { - mtp2_link->errorType = SNG_BASIC_ERR; - } else if (!strcasecmp(parm->val, "pcr")) { - mtp2_link->errorType = SNG_PCR_ERR; - } else { - SS7_ERROR("\tFound an invalid \"errorType\" = %s\n", parm->var); - return FTDM_FAIL; - } - SS7_DEBUG("\tFound mtp2_link->errorType=%s\n", parm->val); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "lssuLength")) { - mtp2_link->lssuLength = atoi(parm->val); - if ((mtp2_link->lssuLength != 1) && (mtp2_link->lssuLength != 2)) { - SS7_ERROR("\tFound an invalid \"lssuLength\" = %d\n", mtp2_link->lssuLength); - return FTDM_FAIL; - } else { - SS7_DEBUG("\tFound mtp2_link->lssuLength=%d\n", mtp2_link->lssuLength); - } - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "priority")) { - mtp3_link->priority = atoi(parm->val); - if ((mtp3_link->priority == 0) || (mtp3_link->priority == 1) || - (mtp3_link->priority == 2) || (mtp3_link->priority == 3)) { - SS7_DEBUG("\tFound mtp3_link->priority = %d\n",mtp3_link->priority); - } else { - SS7_ERROR("\tFound an invalid \"priority\"=%d\n", mtp3_link->priority); - return FTDM_FAIL; - } - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "linkType")) { - if (!strcasecmp(parm->val, "itu92")) { - mtp2_link->linkType = SNG_MTP2_ITU92; - mtp3_link->linkType = SNG_MTP3_ITU92; - SS7_DEBUG("\tFound mtp3_link->linkType = \"ITU92\"\n"); - } else if (!strcasecmp(parm->val, "itu88")) { - mtp2_link->linkType = SNG_MTP2_ITU88; - mtp3_link->linkType = SNG_MTP3_ITU88; - SS7_DEBUG("\tFound mtp3_link->linkType = \"ITU88\"\n"); - } else { - SS7_ERROR("\tFound an invalid linktype of \"%s\"!\n", parm->val); - return FTDM_FAIL; - } - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "switchType")) { - if (!strcasecmp(parm->val, "itu97")) { - mtp3_link->switchType = SNG_ISUP_ITU97; - SS7_DEBUG("\tFound mtp3_link->switchType = \"ITU97\"\n"); - } else if (!strcasecmp(parm->val, "itu88")) { - mtp3_link->switchType = SNG_ISUP_ITU88; - SS7_DEBUG("\tFound mtp3_link->switchType = \"ITU88\"\n"); - } else if (!strcasecmp(parm->val, "itu92")) { - mtp3_link->switchType = SNG_ISUP_ITU92; - SS7_DEBUG("\tFound mtp3_link->switchType = \"ITU92\"\n"); - } else if (!strcasecmp(parm->val, "itu00")) { - mtp3_link->switchType = SNG_ISUP_ITU00; - SS7_DEBUG("\tFound mtp3_link->switchType = \"ITU00\"\n"); - } else if (!strcasecmp(parm->val, "ETSIV2")) { - mtp3_link->switchType = SNG_ISUP_ETSIV2; - SS7_DEBUG("\tFound mtp3_link->switchType = \"ETSIV2\"\n"); - } else if (!strcasecmp(parm->val, "ETSIV3")) { - mtp3_link->switchType = SNG_ISUP_ETSIV3; - SS7_DEBUG("\tFound mtp3_link->switchType = \"ETSIV3\"\n"); - } else if (!strcasecmp(parm->val, "UK")) { - mtp3_link->switchType = SNG_ISUP_UK; - SS7_DEBUG("\tFound mtp3_link->switchType = \"UK\"\n"); - } else if (!strcasecmp(parm->val, "RUSSIA")) { - mtp3_link->switchType = SNG_ISUP_RUSSIA; - SS7_DEBUG("\tFound mtp3_link->switchType = \"RUSSIA\"\n"); - } else if (!strcasecmp(parm->val, "INDIA")) { - mtp3_link->switchType = SNG_ISUP_INDIA; - SS7_DEBUG("\tFound mtp3_link->switchType = \"INDIA\"\n"); - } else { - SS7_ERROR("\tFound an invalid linktype of \"%s\"!\n", parm->val); - return FTDM_FAIL; - } - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "ssf")) { - if (!strcasecmp(parm->val, "nat")) { - mtp3_link->ssf = SNG_SSF_NAT; - } else if (!strcasecmp(parm->val, "int")) { - mtp3_link->ssf = SNG_SSF_INTER; - } else { - SS7_ERROR("\tFound an invalid ssf of \"%s\"!\n", parm->val); - return FTDM_FAIL; - } - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "slc")) { - mtp3_link->lnkTstSLC = atoi(parm->val); - SS7_DEBUG("\tFound mtp3_link->slc = \"%d\"\n",mtp3_link->lnkTstSLC); - /**********************************************************************/ - } else { - SS7_ERROR("\tFound an invalid parameter \"%s\"!\n", parm->val); - return FTDM_FAIL; - } - - /* move to the next parameter */ - parm = parm + 1; - } - - return FTDM_SUCCESS; + ftdm_conf_parameter_t *parm = mtp_link->parameters; + int num_parms = mtp_link->n_parameters; + int i; + + /* confirm that we are looking at an mtp_link */ + if (strcasecmp(mtp_link->name, "mtp_link")) { + SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp_link\"!\n",mtp_link->name); + return FTDM_FAIL; + } else { + SS7_DEBUG("Parsing \"mtp_link\"...\n"); + } + + for (i = 0; i < num_parms; i++) { + /* try to match the parameter to what we expect */ + /**********************************************************************/ + if (!strcasecmp(parm->var, "name")) { + strcpy((char *)mtpLink->name, parm->val); + SS7_DEBUG("\tFound an \"mtp_link\" named = %s\n", mtpLink->name); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "span")) { + mtpLink->mtp1.span = atoi(parm->val); + SS7_DEBUG("\tFound mtpLink->span = %d\n", mtpLink->mtp1.span); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "chan")) { + mtpLink->mtp1.chan = atoi(parm->val); + SS7_DEBUG("\tFound mtpLink->chan = %d\n", mtpLink->mtp1.chan); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "errorType")) { + if (!strcasecmp(parm->val, "basic")) { + mtpLink->mtp2.errorType = SD_ERR_NRM; + } else if (!strcasecmp(parm->val, "pcr")) { + mtpLink->mtp2.errorType = SD_ERR_CYC; + } else { + SS7_ERROR("\tFound an invalid \"errorType\" = %s\n", parm->var); + return FTDM_FAIL; + } + SS7_DEBUG("\tFound mtpLink->errorType=%s\n", parm->val); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "lssuLength")) { + mtpLink->mtp2.lssuLength = atoi(parm->val); + if ((mtpLink->mtp2.lssuLength != 1) && (mtpLink->mtp2.lssuLength != 2)) { + SS7_ERROR("\tFound an invalid \"lssuLength\" = %d\n", mtpLink->mtp2.lssuLength); + return FTDM_FAIL; + } else { + SS7_DEBUG("\tFound mtpLink->lssuLength=%d\n", mtpLink->mtp2.lssuLength); + } + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "priority")) { + mtpLink->mtp3.priority = atoi(parm->val); + if ((mtpLink->mtp3.priority == 0) || (mtpLink->mtp3.priority == 1) || + (mtpLink->mtp3.priority == 2) || (mtpLink->mtp3.priority == 3)) { + SS7_DEBUG("\tFound mtpLink->priority = %d\n",mtpLink->mtp3.priority); + } else { + SS7_ERROR("\tFound an invalid \"priority\"=%d\n",mtpLink->mtp3.priority); + return FTDM_FAIL; + } + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "linkType")) { + if (!strcasecmp(parm->val, "itu92")) { + mtpLink->mtp2.linkType = LSD_SW_ITU92; + mtpLink->mtp3.linkType = LSN_SW_ITU; + SS7_DEBUG("\tFoundmtpLink->linkType = \"ITU92\"\n"); + } else if (!strcasecmp(parm->val, "itu88")) { + mtpLink->mtp2.linkType = LSD_SW_ITU88; + mtpLink->mtp3.linkType = LSN_SW_ITU; + SS7_DEBUG("\tFoundmtpLink->linkType = \"ITU88\"\n"); + } else if (!strcasecmp(parm->val, "ansi96")) { + mtpLink->mtp2.linkType = LSD_SW_ANSI92; + mtpLink->mtp3.linkType = LSN_SW_ANS96; + SS7_DEBUG("\tFoundmtpLink->linkType = \"ANSI96\"\n"); + } else if (!strcasecmp(parm->val, "ansi92")) { + mtpLink->mtp2.linkType = LSD_SW_ANSI92; + mtpLink->mtp3.linkType = LSN_SW_ANS; + SS7_DEBUG("\tFoundmtpLink->linkType = \"ANSI92\"\n"); + } else if (!strcasecmp(parm->val, "ansi88")) { + mtpLink->mtp2.linkType = LSD_SW_ANSI88; + mtpLink->mtp3.linkType = LSN_SW_ANS; + SS7_DEBUG("\tFoundmtpLink->linkType = \"ANSI88\"\n"); + } else if (!strcasecmp(parm->val, "etsi")) { + mtpLink->mtp2.linkType = LSD_SW_ITU92; + mtpLink->mtp3.linkType = LSN_SW_ITU; + SS7_DEBUG("\tFoundmtpLink->linkType = \"ETSI\"\n"); + } else { + SS7_ERROR("\tFound an invalid linktype of \"%s\"!\n", parm->val); + return FTDM_FAIL; + } + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "switchType")) { + if (!strcasecmp(parm->val, "itu97")) { + mtpLink->mtp3.switchType = LSI_SW_ITU97; + SS7_DEBUG("\tFoundmtpLink->switchType = \"ITU97\"\n"); + } else if (!strcasecmp(parm->val, "itu88")) { + mtpLink->mtp3.switchType = LSI_SW_ITU; + SS7_DEBUG("\tFoundmtpLink->switchType = \"ITU88\"\n"); + } else if (!strcasecmp(parm->val, "itu92")) { + mtpLink->mtp3.switchType = LSI_SW_ITU; + SS7_DEBUG("\tFoundmtpLink->switchType = \"ITU92\"\n"); + } else if (!strcasecmp(parm->val, "itu00")) { + mtpLink->mtp3.switchType = LSI_SW_ITU2000; + SS7_DEBUG("\tFoundmtpLink->switchType = \"ITU00\"\n"); + } else if (!strcasecmp(parm->val, "ETSIV2")) { + mtpLink->mtp3.switchType = LSI_SW_ETSI; + SS7_DEBUG("\tFoundmtpLink->switchType = \"ETSIV2\"\n"); + } else if (!strcasecmp(parm->val, "ETSIV3")) { + mtpLink->mtp3.switchType = LSI_SW_ETSIV3; + SS7_DEBUG("\tFoundmtpLink->switchType = \"ETSIV3\"\n"); + } else if (!strcasecmp(parm->val, "UK")) { + mtpLink->mtp3.switchType = LSI_SW_UK; + SS7_DEBUG("\tFoundmtpLink->switchType = \"UK\"\n"); + } else if (!strcasecmp(parm->val, "RUSSIA")) { + mtpLink->mtp3.switchType = LSI_SW_RUSSIA; + SS7_DEBUG("\tFoundmtpLink->switchType = \"RUSSIA\"\n"); + } else if (!strcasecmp(parm->val, "INDIA")) { + mtpLink->mtp3.switchType = LSI_SW_INDIA; + SS7_DEBUG("\tFoundmtpLink->switchType = \"INDIA\"\n"); + } else { + SS7_ERROR("\tFound an invalid linktype of \"%s\"!\n", parm->val); + return FTDM_FAIL; + } + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "ssf")) { + if (!strcasecmp(parm->val, "nat")) { + mtpLink->mtp3.ssf = SSF_NAT; + } else if (!strcasecmp(parm->val, "int")) { + mtpLink->mtp3.ssf = SSF_INTL; + } else { + SS7_ERROR("\tFound an invalid ssf of \"%s\"!\n", parm->val); + return FTDM_FAIL; + } + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "slc")) { + mtpLink->mtp3.slc = atoi(parm->val); + SS7_DEBUG("\tFoundmtpLink->slc = \"%d\"\n",mtpLink->mtp3.slc); + /**********************************************************************/ + } else { + SS7_ERROR("\tFound an invalid parameter \"%s\"!\n", parm->val); + return FTDM_FAIL; + } + + /* move to the next parameter */ + parm = parm + 1; + } + + return FTDM_SUCCESS; } /******************************************************************************/ static int ftmod_ss7_parse_mtp_routes(ftdm_conf_node_t *mtp_routes) { - ftdm_conf_node_t *mtp_route = NULL; - - /* confirm that we are looking at an mtp_routes */ - if (strcasecmp(mtp_routes->name, "mtp_routes")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp_routes\"!\n",mtp_routes->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"mtp_routes\"...\n"); - } - - /* extract the mtp_routes */ - mtp_route = mtp_routes->child; - - while (mtp_route != NULL) { - /* parse the found mtp_route */ - if (ftmod_ss7_parse_mtp_route(mtp_route)) { - SS7_ERROR("Failed to parse \"mtp_route\"\n"); - return FTDM_FAIL; - } - - /* go to the next mtp_route */ - mtp_route = mtp_route->next; - } - - return FTDM_SUCCESS; + ftdm_conf_node_t *mtp_route = NULL; + + /* confirm that we are looking at an mtp_routes */ + if (strcasecmp(mtp_routes->name, "mtp_routes")) { + SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp_routes\"!\n",mtp_routes->name); + return FTDM_FAIL; + } else { + SS7_DEBUG("Parsing \"mtp_routes\"...\n"); + } + + /* extract the mtp_routes */ + mtp_route = mtp_routes->child; + + while (mtp_route != NULL) { + /* parse the found mtp_route */ + if (ftmod_ss7_parse_mtp_route(mtp_route)) { + SS7_ERROR("Failed to parse \"mtp_route\"\n"); + return FTDM_FAIL; + } + + /* go to the next mtp_route */ + mtp_route = mtp_route->next; + } + + return FTDM_SUCCESS; } /******************************************************************************/ static int ftmod_ss7_parse_mtp_route(ftdm_conf_node_t *mtp_route) { - sng_mtp3Route_t mtp3_route; - ftdm_conf_parameter_t *parm = mtp_route->parameters; - int num_parms = mtp_route->n_parameters; - int i; - - memset(&mtp3_route, 0x0, sizeof(sng_mtp3Route_t)); - - /* confirm that we are looking at an mtp_link */ - if (strcasecmp(mtp_route->name, "mtp_route")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp_route\"!\n",mtp_route->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"mtp_route\"...\n"); - } - - for (i = 0; i < num_parms; i++) { - /* try to match the parameter to what we expect */ - /**********************************************************************/ - if (!strcasecmp(parm->var, "name")) { - strcpy((char *)mtp3_route.name, parm->val); - SS7_DEBUG("\tFound an \"mtp_route\" named = %s\n", mtp3_route.name); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "dpc")) { - mtp3_route.dpc = atoi(parm->val); - SS7_DEBUG("\tFound mtp3_route->dpc = %d\n", mtp3_route.dpc); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "mtp_linkset")) { - /* find the linkset by it's name */ - int x = 1; - while (g_ftdm_sngss7_data.cfg.mtp3LinkSet[x].id != 0) { - /* check if the name matches */ - if (!strcasecmp((char *)g_ftdm_sngss7_data.cfg.mtp3LinkSet[x].name, parm->val)) { - /* grab the mtp3_link id value first*/ - int id = g_ftdm_sngss7_data.cfg.mtp3LinkSet[x].links[0]; - /* now, harvest the required infomormation from the global structure */ - mtp3_route.linkType = g_ftdm_sngss7_data.cfg.mtp3Link[id].linkType; - mtp3_route.switchType = g_ftdm_sngss7_data.cfg.mtp3Link[id].switchType; - mtp3_route.ssf = g_ftdm_sngss7_data.cfg.mtp3Link[id].ssf; - mtp3_route.cmbLinkSetId = g_ftdm_sngss7_data.cfg.mtp3LinkSet[x].id; - break; - } - x++; - } - - /* check why we exited the wile loop ... and react accordingly */ - if (mtp3_route.cmbLinkSetId == 0) { - SS7_ERROR("\tFailed to find the linkset = \"%s\"!\n", parm->val); - return FTDM_FAIL; - } else { - SS7_DEBUG("\tFound mtp3_route->linkset = %s\n", parm->val); - } - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "isSTP")) { - if (!strcasecmp(parm->val, "no")) { - mtp3_route.isSTP = 0; - SS7_DEBUG("\tFound mtp3_route->isSTP = no\n"); - } else if (!strcasecmp(parm->val, "yes")) { - mtp3_route.isSTP = 1; - SS7_DEBUG("\tFound mtp3_route->isSTP = yes\n"); - } else { - SS7_ERROR("\tFound an invalid parameter for isSTP \"%s\"!\n", parm->val); - return FTDM_FAIL; - } - /**********************************************************************/ - } else { - SS7_ERROR("\tFound an invalid parameter \"%s\"!\n", parm->val); - return FTDM_FAIL; - - } - - /* move to the next parameter */ - parm = parm + 1; - } - - ftmod_ss7_fill_in_mtp3_route(&mtp3_route); - - ftmod_ss7_fill_in_mtp3_isup_interface(&mtp3_route); - - return FTDM_SUCCESS; + sng_route_t mtpRoute; + ftdm_conf_parameter_t *parm = mtp_route->parameters; + int num_parms = mtp_route->n_parameters; + int i; + + memset(&mtpRoute, 0x0, sizeof(mtpRoute)); + + /* confirm that we are looking at an mtp_link */ + if (strcasecmp(mtp_route->name, "mtp_route")) { + SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"mtp_route\"!\n",mtp_route->name); + return FTDM_FAIL; + } else { + SS7_DEBUG("Parsing \"mtp_route\"...\n"); + } + + for (i = 0; i < num_parms; i++) { + /* try to match the parameter to what we expect */ + /**********************************************************************/ + if (!strcasecmp(parm->var, "name")) { + strcpy((char *)mtpRoute.name, parm->val); + SS7_DEBUG("\tFound an \"mtp_route\" named = %s\n", mtpRoute.name); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "dpc")) { + mtpRoute.dpc = atoi(parm->val); + SS7_DEBUG("\tFound mtpRoute->dpc = %d\n", mtpRoute.dpc); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp_linkset")) { + + /* find the linkset by it's name */ + int x = 1; + while (g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) { + /* check if the name matches */ + if (!strcasecmp((char *)g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name, parm->val)) { + + /* grab the mtpLink id value first*/ + int id = g_ftdm_sngss7_data.cfg.mtpLinkSet[x].links[0]; + + /* now, harvest the required infomormation from the global structure */ + mtpRoute.linkType = g_ftdm_sngss7_data.cfg.mtpLink[id].mtp3.linkType; + mtpRoute.switchType = g_ftdm_sngss7_data.cfg.mtpLink[id].mtp3.switchType; + mtpRoute.ssf = g_ftdm_sngss7_data.cfg.mtpLink[id].mtp3.ssf; + mtpRoute.cmbLinkSetId = g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id; + break; + } + x++; + } + + /* check why we exited the wile loop ... and react accordingly */ + if (mtpRoute.cmbLinkSetId == 0) { + SS7_ERROR("\tFailed to find the linkset = \"%s\"!\n", parm->val); + return FTDM_FAIL; + } else { + SS7_DEBUG("\tFound mtp3_route->linkset = %s\n", parm->val); + } + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "isSTP")) { + if (!strcasecmp(parm->val, "no")) { + mtpRoute.isSTP = 0; + SS7_DEBUG("\tFound mtpRoute->isSTP = no\n"); + } else if (!strcasecmp(parm->val, "yes")) { + mtpRoute.isSTP = 1; + SS7_DEBUG("\tFound mtpRoute->isSTP = yes\n"); + } else { + SS7_ERROR("\tFound an invalid parameter for isSTP \"%s\"!\n", parm->val); + return FTDM_FAIL; + } + /**********************************************************************/ + } else { + SS7_ERROR("\tFound an invalid parameter \"%s\"!\n", parm->val); + return FTDM_FAIL; + + } + + /* move to the next parameter */ + parm = parm + 1; + } + + ftmod_ss7_fill_in_mtp3_route(&mtpRoute); + + ftmod_ss7_fill_in_nsap(&mtpRoute); + + return FTDM_SUCCESS; } /******************************************************************************/ static int ftmod_ss7_parse_isup_interfaces(ftdm_conf_node_t *isup_interfaces) { - ftdm_conf_node_t *isup_interface = NULL; - - /* confirm that we are looking at isup_interfaces */ - if (strcasecmp(isup_interfaces->name, "isup_interfaces")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"isup_interfaces\"!\n",isup_interfaces->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"isup_interfaces\"...\n"); - } - - /* extract the isup_interfaces */ - isup_interface = isup_interfaces->child; - - while (isup_interface != NULL) { - /* parse the found mtp_route */ - if (ftmod_ss7_parse_isup_interface(isup_interface)) { - SS7_ERROR("Failed to parse \"isup_interface\"\n"); - return FTDM_FAIL; - } - - /* go to the next mtp_route */ - isup_interface = isup_interface->next; - } - - return FTDM_SUCCESS; + ftdm_conf_node_t *isup_interface = NULL; + + /* confirm that we are looking at isup_interfaces */ + if (strcasecmp(isup_interfaces->name, "isup_interfaces")) { + SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"isup_interfaces\"!\n",isup_interfaces->name); + return FTDM_FAIL; + } else { + SS7_DEBUG("Parsing \"isup_interfaces\"...\n"); + } + + /* extract the isup_interfaces */ + isup_interface = isup_interfaces->child; + + while (isup_interface != NULL) { + /* parse the found mtp_route */ + if (ftmod_ss7_parse_isup_interface(isup_interface)) { + SS7_ERROR("Failed to parse \"isup_interface\"\n"); + return FTDM_FAIL; + } + + /* go to the next mtp_route */ + isup_interface = isup_interface->next; + } + + return FTDM_SUCCESS; } /******************************************************************************/ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface) { - sng_isupInterface_t sng_isup; - sng_isup_cc_t sng_cc; - ftdm_conf_parameter_t *parm = isup_interface->parameters; - int num_parms = isup_interface->n_parameters; - int i; - - memset(&sng_isup, 0x0, sizeof(sng_isupInterface_t)); - memset(&sng_cc, 0x0, sizeof(sng_isup_cc_t)); - - /* confirm that we are looking at an mtp_link */ - if (strcasecmp(isup_interface->name, "isup_interface")) { - SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"isup_interface\"!\n",isup_interface->name); - return FTDM_FAIL; - } else { - SS7_DEBUG("Parsing \"isup_interface\"...\n"); - } - - - for (i = 0; i < num_parms; i++) { - /* try to match the parameter to what we expect */ - /**********************************************************************/ - if (!strcasecmp(parm->var, "name")) { - strcpy((char *)sng_isup.name, parm->val); - SS7_DEBUG("\tFound an \"isup_interface\" named = %s\n", sng_isup.name); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "spc")) { - strcpy(g_ftdm_sngss7_data.cfg.spc, parm->val); - SS7_DEBUG("\tFound SPC = %s\n", g_ftdm_sngss7_data.cfg.spc); - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "mtp_route")) { - /* find the route by it's name */ - int x = 1; - while (g_ftdm_sngss7_data.cfg.mtp3Route[x].id != 0) { - /* check if the name matches */ - if (!strcasecmp((char *)g_ftdm_sngss7_data.cfg.mtp3Route[x].name, parm->val)) { - /* now, harvest the required information from the global structure */ - sng_isup.mtp3RouteId = g_ftdm_sngss7_data.cfg.mtp3Route[x].id; - sng_isup.dpc = g_ftdm_sngss7_data.cfg.mtp3Route[x].dpc; - sng_isup.switchType = g_ftdm_sngss7_data.cfg.mtp3Route[x].switchType; - sng_cc.switchType = g_ftdm_sngss7_data.cfg.mtp3Route[x].switchType; - - /* find the nwID from the mtp3_isup_interface */ - int y = 1; - while (g_ftdm_sngss7_data.cfg.mtp3_isup[y].id != 0) { - if (g_ftdm_sngss7_data.cfg.mtp3_isup[y].linkType == g_ftdm_sngss7_data.cfg.mtp3Route[x].linkType && - g_ftdm_sngss7_data.cfg.mtp3_isup[y].switchType == g_ftdm_sngss7_data.cfg.mtp3Route[x].switchType && - g_ftdm_sngss7_data.cfg.mtp3_isup[y].ssf == g_ftdm_sngss7_data.cfg.mtp3Route[x].ssf) { - - /* we have a match so break out of this loop */ - break; - } - /* move on to the next one */ - y++; - } /* while (g_ftdm_sngss7_data.cfg.mtp3_isup[y].id != 0) */ - - /* check how we exited the last while loop */ - if (g_ftdm_sngss7_data.cfg.mtp3_isup[y].id == 0) { - SS7_ERROR("\tFailed to find the nwID for = \"%s\"!\n", parm->val); - return FTDM_FAIL; - } else { - sng_isup.nwId = g_ftdm_sngss7_data.cfg.mtp3_isup[y].nwId; - } - - break; - } - x++; - } /* while (g_ftdm_sngss7_data.cfg.mtp3Route[x].id != 0) */ - - /* check why we exited the while loop ... and react accordingly */ - if (sng_isup.mtp3RouteId == 0) { - SS7_ERROR("\tFailed to find the MTP3 Route = \"%s\"!\n", parm->val); - return FTDM_FAIL; - } else { - SS7_DEBUG("\tFound MTP3 Route = %s\n", parm->val); - } - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "ssf")) { - if (!strcasecmp(parm->val, "nat")) { - sng_isup.ssf = SNG_SSF_NAT; - sng_cc.ssf = SNG_SSF_NAT; - } else if (!strcasecmp(parm->val, "int")) { - sng_isup.ssf = SNG_SSF_INTER; - sng_cc.ssf = SNG_SSF_INTER; - } else { - SS7_ERROR("\tFound an invalid ssf of \"%s\"!\n", parm->val); - return FTDM_FAIL; - } - /**********************************************************************/ + sng_isup_inf_t sng_isup; + sng_isap_t sng_isap; + ftdm_conf_parameter_t *parm = isup_interface->parameters; + int num_parms = isup_interface->n_parameters; + int i; + int linkSetId; + int linkId; + + memset(&sng_isup, 0x0, sizeof(sng_isup)); + memset(&sng_isap, 0x0, sizeof(sng_isap)); + + /* confirm that we are looking at an mtp_link */ + if (strcasecmp(isup_interface->name, "isup_interface")) { + SS7_ERROR("We're looking at \"%s\"...but we're supposed to be looking at \"isup_interface\"!\n",isup_interface->name); + return FTDM_FAIL; + } else { + SS7_DEBUG("Parsing \"isup_interface\"...\n"); + } + + + for (i = 0; i < num_parms; i++) { + /* try to match the parameter to what we expect */ + /**********************************************************************/ + if (!strcasecmp(parm->var, "name")) { + strcpy((char *)sng_isup.name, parm->val); + SS7_DEBUG("\tFound an \"isup_interface\" named = %s\n", sng_isup.name); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "spc")) { + sng_isup.spc = atoi(parm->val); + g_ftdm_sngss7_data.cfg.spc = sng_isup.spc; + SS7_DEBUG("\tFound SPC = %d\n", sng_isup.spc); + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "mtp_route")) { + /* find the route by it's name */ + int x = 1; + + while (g_ftdm_sngss7_data.cfg.mtpRoute[x].id != 0) { + + /* check if the name matches */ + if (!strcasecmp((char *)g_ftdm_sngss7_data.cfg.mtpRoute[x].name, parm->val)) { + + /* now, harvest the required information from the global structure */ + sng_isup.mtpRouteId = g_ftdm_sngss7_data.cfg.mtpRoute[x].id; + sng_isup.dpc = g_ftdm_sngss7_data.cfg.mtpRoute[x].dpc; + sng_isup.switchType = g_ftdm_sngss7_data.cfg.mtpRoute[x].switchType; + sng_isap.switchType = g_ftdm_sngss7_data.cfg.mtpRoute[x].switchType; + + /* find the nwID from the nsap */ + int y = 1; + while (g_ftdm_sngss7_data.cfg.nsap[y].id != 0) { + + if ((g_ftdm_sngss7_data.cfg.nsap[y].linkType == g_ftdm_sngss7_data.cfg.mtpRoute[x].linkType) && + (g_ftdm_sngss7_data.cfg.nsap[y].switchType == g_ftdm_sngss7_data.cfg.mtpRoute[x].switchType) && + (g_ftdm_sngss7_data.cfg.nsap[y].ssf == g_ftdm_sngss7_data.cfg.mtpRoute[x].ssf)) { + + /* we have a match so break out of this loop */ + break; + } + /* move on to the next one */ + y++; + } /* while (g_ftdm_sngss7_data.cfg.mtp3_isup[y].id != 0) */ + + /* check how we exited the last while loop */ + if (g_ftdm_sngss7_data.cfg.nsap[y].id == 0) { + SS7_ERROR("\tFailed to find the nwID for = \"%s\"!\n", parm->val); + return FTDM_FAIL; + } else { + sng_isup.nwId = g_ftdm_sngss7_data.cfg.nsap[y].nwId; + } + + break; + } + x++; + } /* while (g_ftdm_sngss7_data.cfg.mtpRoute[x].id != 0) */ + + /* check why we exited the while loop ... and react accordingly */ + if (sng_isup.mtpRouteId == 0) { + SS7_ERROR("\tFailed to find the MTP3 Route = \"%s\"!\n", parm->val); + return FTDM_FAIL; + } else { + SS7_DEBUG("\tFound MTP3 Route = %s\n", parm->val); + } + /**********************************************************************/ + } else if (!strcasecmp(parm->var, "ssf")) { + if (!strcasecmp(parm->val, "nat")) { + sng_isup.ssf = SSF_NAT; + sng_isap.ssf = SSF_NAT; + } else if (!strcasecmp(parm->val, "int")) { + sng_isup.ssf = SSF_INTL; + sng_isap.ssf = SSF_INTL; + } else { + SS7_ERROR("\tFound an invalid ssf of \"%s\"!\n", parm->val); + return FTDM_FAIL; + } + /**********************************************************************/ } else if (!strcasecmp(parm->var, "license")) { /**********************************************************************/ strcpy(g_ftdm_sngss7_data.cfg.license, parm->val); @@ -821,1055 +835,1047 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface) SS7_DEBUG("\tFound license file = %s\n", g_ftdm_sngss7_data.cfg.license); SS7_DEBUG("\tFound signature file = %s\n", g_ftdm_sngss7_data.cfg.signature); /**********************************************************************/ - } else { - SS7_ERROR("\tFound an invalid parameter \"%s\"!\n", parm->val); - return FTDM_FAIL; + } else { + SS7_ERROR("\tFound an invalid parameter \"%s\"!\n", parm->val); + return FTDM_FAIL; - } + } - /* move to the next parameter */ - parm = parm + 1; - } + /* move to the next parameter */ + parm = parm + 1; + } - ftmod_ss7_fill_in_isup_interface(&sng_isup); + /* trickle down the SPC to all sub entities */ + linkSetId = g_ftdm_sngss7_data.cfg.mtpRoute[sng_isup.mtpRouteId].cmbLinkSetId; + for (i = 0; i < g_ftdm_sngss7_data.cfg.mtpLinkSet[linkSetId].numLinks; i ++) { + linkId = g_ftdm_sngss7_data.cfg.mtpLinkSet[linkSetId].links[i]; + g_ftdm_sngss7_data.cfg.mtpLink[linkId].mtp3.spc = g_ftdm_sngss7_data.cfg.spc; + } - ftmod_ss7_fill_in_isup_cc_interface(&sng_cc); + ftmod_ss7_fill_in_isap(&sng_isap); - return FTDM_SUCCESS; -} + sng_isup.isap = sng_isap.id; -/******************************************************************************/ -static int ftmod_ss7_fill_in_mtp1_link(sng_mtp1Link_t *mtp1_link) -{ - int i; - - /* go through all the existing links and see if we find a match */ - i = 1; - while (g_ftdm_sngss7_data.cfg.mtp1Link[i].id != 0) { - if (g_ftdm_sngss7_data.cfg.mtp1Link[i].span == mtp1_link->span && - g_ftdm_sngss7_data.cfg.mtp1Link[i].chan == mtp1_link->chan) { - - /* we have a match so break out of this loop */ - break; - } - /* move on to the next one */ - i++; - } - - /* if the id value is 0 that means we didn't find the link */ - if (g_ftdm_sngss7_data.cfg.mtp1Link[i].id == 0) { - mtp1_link->id = i; - SS7_DEBUG("found new mtp1_link on span=%d, chan=%d, id = %d\n", - mtp1_link->span, - mtp1_link->chan, - mtp1_link->id); - } else { - mtp1_link->id = i; - SS7_DEBUG("found existing mtp1_link on span=%d, chan=%d, id = %d\n", - mtp1_link->span, - mtp1_link->chan, - mtp1_link->id); - } - - /* fill in the information */ - - strcpy((char *)g_ftdm_sngss7_data.cfg.mtp1Link[i].name, (char *)mtp1_link->name); - - g_ftdm_sngss7_data.cfg.mtp1Link[i].id = mtp1_link->id; - g_ftdm_sngss7_data.cfg.mtp1Link[i].span = mtp1_link->span; - g_ftdm_sngss7_data.cfg.mtp1Link[i].chan = mtp1_link->chan; - - return (mtp1_link->id); -} + ftmod_ss7_fill_in_isup_interface(&sng_isup); -/******************************************************************************/ -static int ftmod_ss7_fill_in_mtp2_link(sng_mtp2Link_t *mtp2_link) -{ - /* the mtp2link->spId is also the index value */ - - int i = mtp2_link->spId; - - mtp2_link->id = i; - - if (g_ftdm_sngss7_data.cfg.mtp2Link[i].id == 0) { - SS7_DEBUG("found new mtp2_link, id is = %d\n", mtp2_link->id); - } else { - SS7_DEBUG("found existing mtp2_link, id is = %d\n", mtp2_link->id); - } - - strcpy((char *)g_ftdm_sngss7_data.cfg.mtp2Link[i].name, (char *)mtp2_link->name); - - g_ftdm_sngss7_data.cfg.mtp2Link[i].id = mtp2_link->id; - g_ftdm_sngss7_data.cfg.mtp2Link[i].spId = mtp2_link->spId; - g_ftdm_sngss7_data.cfg.mtp2Link[i].linkType = mtp2_link->linkType; - g_ftdm_sngss7_data.cfg.mtp2Link[i].errorType = mtp2_link->errorType; - g_ftdm_sngss7_data.cfg.mtp2Link[i].lssuLength = mtp2_link->lssuLength; - - if ( mtp2_link->t1 != 0 ) { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t1 = mtp2_link->t1; - }else { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t1 = 500; - } - if ( mtp2_link->t2 != 0 ) { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t2 = mtp2_link->t2; - }else { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t2 = 250; - } - if ( mtp2_link->t3 != 0 ) { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t3 = mtp2_link->t3; - }else { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t3 = 20; - } - if ( mtp2_link->t4n != 0 ) { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t4n = mtp2_link->t4n; - }else { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t4n = 80; - } - if ( mtp2_link->t4e != 0 ) { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t4e = mtp2_link->t4e; - }else { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t4e = 5; - } - if ( mtp2_link->t5 != 0 ) { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t5 = mtp2_link->t5; - }else { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t5 = 1; - } - if ( mtp2_link->t6 != 0 ) { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t6 = mtp2_link->t6; - }else { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t6 = 60; - } - if ( mtp2_link->t7 != 0 ) { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t7 = mtp2_link->t7; - }else { - g_ftdm_sngss7_data.cfg.mtp2Link[i].t7 = 20; - } - - return(mtp2_link->id); + g_ftdm_sngss7_data.cfg.isap[sng_isap.id].spId = sng_isup.id; + + return FTDM_SUCCESS; } /******************************************************************************/ -static int ftmod_ss7_fill_in_mtp3_link(sng_mtp3Link_t *mtp3_link) +static int ftmod_ss7_fill_in_mtpLink(sng_mtp_link_t *mtpLink) { - int i = mtp3_link->mtp2LinkId; - - mtp3_link->id = i; - - if (g_ftdm_sngss7_data.cfg.mtp3Link[i].id == 0) { - SS7_DEBUG("found new mtp3_link, id is = %d\n", mtp3_link->id); - } else { - SS7_DEBUG("found existing mtp3_link, id is = %d\n", mtp3_link->id); - } - - strcpy((char *)g_ftdm_sngss7_data.cfg.mtp3Link[i].name, (char *)mtp3_link->name); - - g_ftdm_sngss7_data.cfg.mtp3Link[i].id = mtp3_link->id; - g_ftdm_sngss7_data.cfg.mtp3Link[i].mtp2LinkId = mtp3_link->mtp2LinkId; - g_ftdm_sngss7_data.cfg.mtp3Link[i].linkSetId = mtp3_link->linkSetId; - g_ftdm_sngss7_data.cfg.mtp3Link[i].priority = mtp3_link->priority; - g_ftdm_sngss7_data.cfg.mtp3Link[i].linkType = mtp3_link->linkType; - g_ftdm_sngss7_data.cfg.mtp3Link[i].switchType = mtp3_link->switchType; - g_ftdm_sngss7_data.cfg.mtp3Link[i].apc = mtp3_link->apc; - g_ftdm_sngss7_data.cfg.mtp3Link[i].ssf = mtp3_link->ssf; - g_ftdm_sngss7_data.cfg.mtp3Link[i].lnkTstSLC = mtp3_link->lnkTstSLC; - if (mtp3_link->t1 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t1 = mtp3_link->t1; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t1 = 8; - } - if (mtp3_link->t2 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t2 = mtp3_link->t2; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t2 = 14; - } - if (mtp3_link->t3 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t3 = mtp3_link->t3; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t3 = 8; - } - if (mtp3_link->t4 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t4 = mtp3_link->t4; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t4 = 8; - } - if (mtp3_link->t5 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t5 = mtp3_link->t5; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t5 = 8; - } - if (mtp3_link->t7 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t7 = mtp3_link->t7; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t7 = 15; - } - if (mtp3_link->t12 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t12 = mtp3_link->t12; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t12 = 15; - } - if (mtp3_link->t13 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t13 = mtp3_link->t13; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t13 = 15; - } - if (mtp3_link->t14 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t14 = mtp3_link->t14; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t14 = 30; - } - if (mtp3_link->t17 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t17 = mtp3_link->t17; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t17 = 15; - } - if (mtp3_link->t22 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t22 = mtp3_link->t22; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t22 = 1800; - } - if (mtp3_link->t23 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t23 = mtp3_link->t23; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t23 = 1800; - } - if (mtp3_link->t24 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t24 = mtp3_link->t24; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t24 = 5; - } - if (mtp3_link->t31 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t31 = mtp3_link->t31; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t31 = 50; - } - if (mtp3_link->t32 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t32 = mtp3_link->t32; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t32 = 120; - } - if (mtp3_link->t33 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t33 = mtp3_link->t33; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t33 = 3000; - } - if (mtp3_link->t34 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t34 = mtp3_link->t34; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].t34 = 600; - } - if (mtp3_link->tflc != 0) { - g_ftdm_sngss7_data.cfg.mtp3Link[i].tflc = mtp3_link->tflc; - } else { - g_ftdm_sngss7_data.cfg.mtp3Link[i].tflc = 300; - } - - return(mtp3_link->id); + int i; + + /* go through all the existing links and see if we find a match */ + i = 1; + while (g_ftdm_sngss7_data.cfg.mtpLink[i].id != 0) { + if ((g_ftdm_sngss7_data.cfg.mtpLink[i].mtp1.span == mtpLink->mtp1.span) && + (g_ftdm_sngss7_data.cfg.mtpLink[i].mtp1.chan == mtpLink->mtp1.chan)) { + + /* we have a match so break out of this loop */ + break; + } + /* move on to the next one */ + i++; + } + + /* if the id value is 0 that means we didn't find the link */ + if (g_ftdm_sngss7_data.cfg.mtpLink[i].id == 0) { + mtpLink->id = i; + SS7_DEBUG("found new mtpLink on span=%d, chan=%d, id = %d\n", + mtpLink->mtp1.span, + mtpLink->mtp1.chan, + mtpLink->id); + } else { + mtpLink->id = i; + SS7_DEBUG("found existing mtpLink on span=%d, chan=%d, id = %d\n", + mtpLink->mtp1.span, + mtpLink->mtp1.chan, + mtpLink->id); + } + + /* fill in the information */ + strcpy((char *)g_ftdm_sngss7_data.cfg.mtpLink[i].name, (char *)mtpLink->name); + + g_ftdm_sngss7_data.cfg.mtpLink[i].id = mtpLink->id; + + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp1.span = mtpLink->mtp1.span; + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp1.chan = mtpLink->mtp1.chan; + + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.linkType = mtpLink->mtp2.linkType; + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.errorType = mtpLink->mtp2.errorType; + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.lssuLength = mtpLink->mtp2.lssuLength; + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.mtp1Id = mtpLink->id; + + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.priority = mtpLink->mtp3.priority; + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.linkType = mtpLink->mtp3.linkType; + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.switchType = mtpLink->mtp3.switchType; + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.apc = mtpLink->mtp3.apc; + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.spc = g_ftdm_sngss7_data.cfg.spc; + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.ssf = mtpLink->mtp3.ssf; + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.slc = mtpLink->mtp3.slc; + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.linkSetId = mtpLink->mtp3.linkSetId; + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.mtp2Id = mtpLink->id; + + if ( mtpLink->mtp2.t1 != 0 ) { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t1 = mtpLink->mtp2.t1; + }else { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t1 = 500; + } + if ( mtpLink->mtp2.t2 != 0 ) { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t2 = mtpLink->mtp2.t2; + }else { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t2 = 250; + } + if ( mtpLink->mtp2.t3 != 0 ) { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t3 = mtpLink->mtp2.t3; + }else { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t3 = 20; + } + if ( mtpLink->mtp2.t4n != 0 ) { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t4n = mtpLink->mtp2.t4n; + }else { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t4n = 80; + } + if ( mtpLink->mtp2.t4e != 0 ) { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t4e = mtpLink->mtp2.t4e; + }else { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t4e = 5; + } + if ( mtpLink->mtp2.t5 != 0 ) { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t5 = mtpLink->mtp2.t5; + }else { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t5 = 1; + } + if ( mtpLink->mtp2.t6 != 0 ) { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t6 = mtpLink->mtp2.t6; + }else { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t6 = 60; + } + if ( mtpLink->mtp2.t7 != 0 ) { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t7 = mtpLink->mtp2.t7; + }else { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp2.t7 = 20; + } + + if (mtpLink->mtp3.t1 != 0) { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t1 = mtpLink->mtp3.t1; + } else { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t1 = 8; + } + if (mtpLink->mtp3.t2 != 0) { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t2 = mtpLink->mtp3.t2; + } else { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t2 = 14; + } + if (mtpLink->mtp3.t3 != 0) { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t3 = mtpLink->mtp3.t3; + } else { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t3 = 8; + } + if (mtpLink->mtp3.t4 != 0) { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t4 = mtpLink->mtp3.t4; + } else { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t4 = 8; + } + if (mtpLink->mtp3.t5 != 0) { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t5 = mtpLink->mtp3.t5; + } else { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t5 = 8; + } + if (mtpLink->mtp3.t7 != 0) { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t7 = mtpLink->mtp3.t7; + } else { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t7 = 15; + } + if (mtpLink->mtp3.t12 != 0) { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t12 = mtpLink->mtp3.t12; + } else { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t12 = 15; + } + if (mtpLink->mtp3.t13 != 0) { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t13 = mtpLink->mtp3.t13; + } else { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t13 = 15; + } + if (mtpLink->mtp3.t14 != 0) { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t14 = mtpLink->mtp3.t14; + } else { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t14 = 30; + } + if (mtpLink->mtp3.t17 != 0) { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t17 = mtpLink->mtp3.t17; + } else { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t17 = 15; + } + if (mtpLink->mtp3.t22 != 0) { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t22 = mtpLink->mtp3.t22; + } else { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t22 = 1800; + } + if (mtpLink->mtp3.t23 != 0) { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t23 = mtpLink->mtp3.t23; + } else { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t23 = 1800; + } + if (mtpLink->mtp3.t24 != 0) { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t24 = mtpLink->mtp3.t24; + } else { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t24 = 5; + } + if (mtpLink->mtp3.t31 != 0) { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t31 = mtpLink->mtp3.t31; + } else { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t31 = 50; + } + if (mtpLink->mtp3.t32 != 0) { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t32 = mtpLink->mtp3.t32; + } else { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t32 = 120; + } + if (mtpLink->mtp3.t33 != 0) { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t33 = mtpLink->mtp3.t33; + } else { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t33 = 3000; + } + if (mtpLink->mtp3.t34 != 0) { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t34 = mtpLink->mtp3.t34; + } else { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.t34 = 600; + } + if (mtpLink->mtp3.tflc != 0) { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.tflc = mtpLink->mtp3.tflc; + } else { + g_ftdm_sngss7_data.cfg.mtpLink[i].mtp3.tflc = 300; + } + return (mtpLink->id); } + /******************************************************************************/ -static int ftmod_ss7_fill_in_mtp3_linkset(sng_mtp3LinkSet_t *mtp3_linkset) +static int ftmod_ss7_fill_in_mtpLinkSet(sng_link_set_t *mtpLinkSet) { - int count; - int i = mtp3_linkset->id; + int count; + int i = mtpLinkSet->id; - strcpy((char *)g_ftdm_sngss7_data.cfg.mtp3LinkSet[i].name, (char *)mtp3_linkset->name); + strcpy((char *)g_ftdm_sngss7_data.cfg.mtpLinkSet[i].name, (char *)mtpLinkSet->name); - g_ftdm_sngss7_data.cfg.mtp3LinkSet[i].id = mtp3_linkset->id; - g_ftdm_sngss7_data.cfg.mtp3LinkSet[i].apc = mtp3_linkset->apc; - g_ftdm_sngss7_data.cfg.mtp3LinkSet[i].minActive = mtp3_linkset->minActive; - g_ftdm_sngss7_data.cfg.mtp3LinkSet[i].numLinks = mtp3_linkset->numLinks; + g_ftdm_sngss7_data.cfg.mtpLinkSet[i].id = mtpLinkSet->id; + g_ftdm_sngss7_data.cfg.mtpLinkSet[i].apc = mtpLinkSet->apc; + g_ftdm_sngss7_data.cfg.mtpLinkSet[i].linkType = g_ftdm_sngss7_data.cfg.mtpLink[1].mtp3.linkType; /* KONRAD FIX ME */ + g_ftdm_sngss7_data.cfg.mtpLinkSet[i].minActive = mtpLinkSet->minActive; + g_ftdm_sngss7_data.cfg.mtpLinkSet[i].numLinks = mtpLinkSet->numLinks; - for (count = 0; count < mtp3_linkset->numLinks; count++) { - g_ftdm_sngss7_data.cfg.mtp3LinkSet[i].links[count] = mtp3_linkset->links[count]; - } + for (count = 0; count < mtpLinkSet->numLinks; count++) { + g_ftdm_sngss7_data.cfg.mtpLinkSet[i].links[count] = mtpLinkSet->links[count]; + } - return 0; + return 0; } /******************************************************************************/ -static int ftmod_ss7_fill_in_mtp3_route(sng_mtp3Route_t *mtp3_route) +static int ftmod_ss7_fill_in_mtp3_route(sng_route_t *mtp3_route) { - int i; - - /* go through all the existing routes and see if we find a match */ - i = 1; - while (g_ftdm_sngss7_data.cfg.mtp3Route[i].id != 0) { - if (g_ftdm_sngss7_data.cfg.mtp3Route[i].dpc == mtp3_route->dpc) { - - /* we have a match so break out of this loop */ - break; - } - /* move on to the next one */ - i++; - } - - if (g_ftdm_sngss7_data.cfg.mtp3Route[i].id == 0) { - mtp3_route->id = i; - SS7_DEBUG("found new mtp3_route, id is = %d\n", mtp3_route->id); - } else { - mtp3_route->id = i; - SS7_DEBUG("found existing mtp3_route, id is = %d\n", mtp3_route->id); - } - - strcpy((char *)g_ftdm_sngss7_data.cfg.mtp3Route[i].name, (char *)mtp3_route->name); - - g_ftdm_sngss7_data.cfg.mtp3Route[i].id = mtp3_route->id; - g_ftdm_sngss7_data.cfg.mtp3Route[i].dpc = mtp3_route->dpc; - g_ftdm_sngss7_data.cfg.mtp3Route[i].linkType = mtp3_route->linkType; - g_ftdm_sngss7_data.cfg.mtp3Route[i].switchType = mtp3_route->switchType; - g_ftdm_sngss7_data.cfg.mtp3Route[i].cmbLinkSetId = 1; /* mtp3_route->cmbLinkSetId;*/ - g_ftdm_sngss7_data.cfg.mtp3Route[i].isSTP = mtp3_route->isSTP; - g_ftdm_sngss7_data.cfg.mtp3Route[i].ssf = mtp3_route->ssf; - if (mtp3_route->t6 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Route[i].t6 = mtp3_route->t6; - } else { - g_ftdm_sngss7_data.cfg.mtp3Route[i].t6 = 8; - } - if (mtp3_route->t8 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Route[i].t8 = mtp3_route->t8; - } else { - g_ftdm_sngss7_data.cfg.mtp3Route[i].t8 = 12; - } - if (mtp3_route->t10 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Route[i].t10 = mtp3_route->t10; - } else { - g_ftdm_sngss7_data.cfg.mtp3Route[i].t10 = 300; - } - if (mtp3_route->t11 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Route[i].t11 = mtp3_route->t11; - } else { - g_ftdm_sngss7_data.cfg.mtp3Route[i].t11 = 300; - } - if (mtp3_route->t15 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Route[i].t15 = mtp3_route->t15; - } else { - g_ftdm_sngss7_data.cfg.mtp3Route[i].t15 = 30; - } - if (mtp3_route->t16 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Route[i].t16 = mtp3_route->t16; - } else { - g_ftdm_sngss7_data.cfg.mtp3Route[i].t16 = 20; - } - if (mtp3_route->t18 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Route[i].t18 = mtp3_route->t18; - } else { - g_ftdm_sngss7_data.cfg.mtp3Route[i].t18 = 200; - } - if (mtp3_route->t19 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Route[i].t19 = mtp3_route->t19; - } else { - g_ftdm_sngss7_data.cfg.mtp3Route[i].t19 = 690; - } - if (mtp3_route->t21 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Route[i].t21 = mtp3_route->t21; - } else { - g_ftdm_sngss7_data.cfg.mtp3Route[i].t21 = 650; - } - if (mtp3_route->t25 != 0) { - g_ftdm_sngss7_data.cfg.mtp3Route[i].t25 = mtp3_route->t25; - } else { - g_ftdm_sngss7_data.cfg.mtp3Route[i].t25 = 100; - } - - return 0; + int i; + + /* go through all the existing routes and see if we find a match */ + i = 1; + while (g_ftdm_sngss7_data.cfg.mtpRoute[i].id != 0) { + if (g_ftdm_sngss7_data.cfg.mtpRoute[i].dpc == mtp3_route->dpc) { + + /* we have a match so break out of this loop */ + break; + } + /* move on to the next one */ + i++; + } + + if (g_ftdm_sngss7_data.cfg.mtpRoute[i].id == 0) { + mtp3_route->id = i; + SS7_DEBUG("found new mtp3_route, id is = %d\n", mtp3_route->id); + } else { + mtp3_route->id = i; + SS7_DEBUG("found existing mtp3_route, id is = %d\n", mtp3_route->id); + } + + strcpy((char *)g_ftdm_sngss7_data.cfg.mtpRoute[i].name, (char *)mtp3_route->name); + + g_ftdm_sngss7_data.cfg.mtpRoute[i].id = mtp3_route->id; + g_ftdm_sngss7_data.cfg.mtpRoute[i].dpc = mtp3_route->dpc; + g_ftdm_sngss7_data.cfg.mtpRoute[i].linkType = mtp3_route->linkType; + g_ftdm_sngss7_data.cfg.mtpRoute[i].switchType = mtp3_route->switchType; + g_ftdm_sngss7_data.cfg.mtpRoute[i].cmbLinkSetId = 1; /* mtp3_route->cmbLinkSetId;*/ + g_ftdm_sngss7_data.cfg.mtpRoute[i].isSTP = mtp3_route->isSTP; + g_ftdm_sngss7_data.cfg.mtpRoute[i].ssf = mtp3_route->ssf; + if (mtp3_route->t6 != 0) { + g_ftdm_sngss7_data.cfg.mtpRoute[i].t6 = mtp3_route->t6; + } else { + g_ftdm_sngss7_data.cfg.mtpRoute[i].t6 = 8; + } + if (mtp3_route->t8 != 0) { + g_ftdm_sngss7_data.cfg.mtpRoute[i].t8 = mtp3_route->t8; + } else { + g_ftdm_sngss7_data.cfg.mtpRoute[i].t8 = 12; + } + if (mtp3_route->t10 != 0) { + g_ftdm_sngss7_data.cfg.mtpRoute[i].t10 = mtp3_route->t10; + } else { + g_ftdm_sngss7_data.cfg.mtpRoute[i].t10 = 300; + } + if (mtp3_route->t11 != 0) { + g_ftdm_sngss7_data.cfg.mtpRoute[i].t11 = mtp3_route->t11; + } else { + g_ftdm_sngss7_data.cfg.mtpRoute[i].t11 = 300; + } + if (mtp3_route->t15 != 0) { + g_ftdm_sngss7_data.cfg.mtpRoute[i].t15 = mtp3_route->t15; + } else { + g_ftdm_sngss7_data.cfg.mtpRoute[i].t15 = 30; + } + if (mtp3_route->t16 != 0) { + g_ftdm_sngss7_data.cfg.mtpRoute[i].t16 = mtp3_route->t16; + } else { + g_ftdm_sngss7_data.cfg.mtpRoute[i].t16 = 20; + } + if (mtp3_route->t18 != 0) { + g_ftdm_sngss7_data.cfg.mtpRoute[i].t18 = mtp3_route->t18; + } else { + g_ftdm_sngss7_data.cfg.mtpRoute[i].t18 = 200; + } + if (mtp3_route->t19 != 0) { + g_ftdm_sngss7_data.cfg.mtpRoute[i].t19 = mtp3_route->t19; + } else { + g_ftdm_sngss7_data.cfg.mtpRoute[i].t19 = 690; + } + if (mtp3_route->t21 != 0) { + g_ftdm_sngss7_data.cfg.mtpRoute[i].t21 = mtp3_route->t21; + } else { + g_ftdm_sngss7_data.cfg.mtpRoute[i].t21 = 650; + } + if (mtp3_route->t25 != 0) { + g_ftdm_sngss7_data.cfg.mtpRoute[i].t25 = mtp3_route->t25; + } else { + g_ftdm_sngss7_data.cfg.mtpRoute[i].t25 = 100; + } + + return 0; } /******************************************************************************/ -static int ftmod_ss7_fill_in_mtp3_isup_interface(sng_mtp3Route_t *mtp3_route) +static int ftmod_ss7_fill_in_nsap(sng_route_t *mtp3_route) { - - int i; - - /* go through all the existing interfaces and see if we find a match */ - i = 1; - while (g_ftdm_sngss7_data.cfg.mtp3_isup[i].id != 0) { - if (g_ftdm_sngss7_data.cfg.mtp3_isup[i].linkType == mtp3_route->linkType && - g_ftdm_sngss7_data.cfg.mtp3_isup[i].switchType == mtp3_route->switchType && - g_ftdm_sngss7_data.cfg.mtp3_isup[i].ssf == mtp3_route->ssf) { - - /* we have a match so break out of this loop */ - break; - } - /* move on to the next one */ - i++; - } - - if (g_ftdm_sngss7_data.cfg.mtp3_isup[i].id == 0) { - g_ftdm_sngss7_data.cfg.mtp3_isup[i].id = i; - SS7_DEBUG("found new mtp3_isup interface, id is = %d\n", g_ftdm_sngss7_data.cfg.mtp3_isup[i].id); - } else { - g_ftdm_sngss7_data.cfg.mtp3_isup[i].id = i; - SS7_DEBUG("found existing mtp3_isup interface, id is = %d\n", g_ftdm_sngss7_data.cfg.mtp3_isup[i].id); - } - - g_ftdm_sngss7_data.cfg.mtp3_isup[i].nwId = g_ftdm_sngss7_data.cfg.mtp3_isup[i].id; - g_ftdm_sngss7_data.cfg.mtp3_isup[i].linkType = mtp3_route->linkType; - g_ftdm_sngss7_data.cfg.mtp3_isup[i].switchType = mtp3_route->switchType; - g_ftdm_sngss7_data.cfg.mtp3_isup[i].ssf = mtp3_route->ssf; - - return 0; + int i; + + /* go through all the existing interfaces and see if we find a match */ + i = 1; + while (g_ftdm_sngss7_data.cfg.nsap[i].id != 0) { + if ((g_ftdm_sngss7_data.cfg.nsap[i].linkType == mtp3_route->linkType) && + (g_ftdm_sngss7_data.cfg.nsap[i].switchType == mtp3_route->switchType) && + (g_ftdm_sngss7_data.cfg.nsap[i].ssf == mtp3_route->ssf)) { + + /* we have a match so break out of this loop */ + break; + } + /* move on to the next one */ + i++; + } + + if (g_ftdm_sngss7_data.cfg.nsap[i].id == 0) { + g_ftdm_sngss7_data.cfg.nsap[i].id = i; + SS7_DEBUG("found new mtp3_isup interface, id is = %d\n", g_ftdm_sngss7_data.cfg.nsap[i].id); + } else { + g_ftdm_sngss7_data.cfg.nsap[i].id = i; + SS7_DEBUG("found existing mtp3_isup interface, id is = %d\n", g_ftdm_sngss7_data.cfg.nsap[i].id); + } + + g_ftdm_sngss7_data.cfg.nsap[i].spId = g_ftdm_sngss7_data.cfg.nsap[i].id; + g_ftdm_sngss7_data.cfg.nsap[i].suId = g_ftdm_sngss7_data.cfg.nsap[i].id; + g_ftdm_sngss7_data.cfg.nsap[i].nwId = g_ftdm_sngss7_data.cfg.nsap[i].id; + g_ftdm_sngss7_data.cfg.nsap[i].linkType = mtp3_route->linkType; + g_ftdm_sngss7_data.cfg.nsap[i].switchType = mtp3_route->switchType; + g_ftdm_sngss7_data.cfg.nsap[i].ssf = mtp3_route->ssf; + + return 0; } /******************************************************************************/ -static int ftmod_ss7_fill_in_isup_interface(sng_isupInterface_t *sng_isup) +static int ftmod_ss7_fill_in_isup_interface(sng_isup_inf_t *sng_isup) { - - int i; - - /* go through all the existing interfaces and see if we find a match */ - i = 1; - while (g_ftdm_sngss7_data.cfg.isupInterface[i].id != 0) { - if (g_ftdm_sngss7_data.cfg.isupInterface[i].nwId == sng_isup->nwId) { - - /* we have a match so break out of this loop */ - break; - } - /* move on to the next one */ - i++; - } - - if (g_ftdm_sngss7_data.cfg.isupInterface[i].id == 0) { - sng_isup->id = i; - SS7_DEBUG("found new isup interface, id is = %d\n", sng_isup->id); - } else { - sng_isup->id = i; - SS7_DEBUG("found existing isup interface, id is = %d\n", sng_isup->id); - } - - strcpy((char *)g_ftdm_sngss7_data.cfg.isupInterface[i].name, (char *)sng_isup->name); - - g_ftdm_sngss7_data.cfg.isupInterface[i].id = sng_isup->id; - g_ftdm_sngss7_data.cfg.isupInterface[i].mtp3RouteId = sng_isup->mtp3RouteId; - g_ftdm_sngss7_data.cfg.isupInterface[i].nwId = sng_isup->nwId; - g_ftdm_sngss7_data.cfg.isupInterface[i].dpc = sng_isup->dpc; - g_ftdm_sngss7_data.cfg.isupInterface[i].switchType = sng_isup->switchType; - g_ftdm_sngss7_data.cfg.isupInterface[i].ssf = sng_isup->ssf; - if (sng_isup->t4 != 0) { - g_ftdm_sngss7_data.cfg.isupInterface[i].t4 = sng_isup->t4; - } else { - g_ftdm_sngss7_data.cfg.isupInterface[i].t4 = 3000; - } - if (sng_isup->t10 != 0) { - g_ftdm_sngss7_data.cfg.isupInterface[i].t10 = sng_isup->t10; - } else { - g_ftdm_sngss7_data.cfg.isupInterface[i].t10 = 50; - } - if (sng_isup->t11 != 0) { - g_ftdm_sngss7_data.cfg.isupInterface[i].t11 = sng_isup->t11; - } else { - g_ftdm_sngss7_data.cfg.isupInterface[i].t11 = 170; - } - if (sng_isup->t18 != 0) { - g_ftdm_sngss7_data.cfg.isupInterface[i].t18 = sng_isup->t18; - } else { - g_ftdm_sngss7_data.cfg.isupInterface[i].t18 = 300; - } - if (sng_isup->t19 != 0) { - g_ftdm_sngss7_data.cfg.isupInterface[i].t19 = sng_isup->t19; - } else { - g_ftdm_sngss7_data.cfg.isupInterface[i].t19 = 3000; - } - if (sng_isup->t20 != 0) { - g_ftdm_sngss7_data.cfg.isupInterface[i].t20 = sng_isup->t20; - } else { - g_ftdm_sngss7_data.cfg.isupInterface[i].t20 = 300; - } - if (sng_isup->t21 != 0) { - g_ftdm_sngss7_data.cfg.isupInterface[i].t21 = sng_isup->t21; - } else { - g_ftdm_sngss7_data.cfg.isupInterface[i].t21 = 3000; - } - if (sng_isup->t22 != 0) { - g_ftdm_sngss7_data.cfg.isupInterface[i].t22 = sng_isup->t22; - } else { - g_ftdm_sngss7_data.cfg.isupInterface[i].t22 = 300; - } - if (sng_isup->t23 != 0) { - g_ftdm_sngss7_data.cfg.isupInterface[i].t23 = sng_isup->t23; - } else { - g_ftdm_sngss7_data.cfg.isupInterface[i].t23 = 3000; - } - if (sng_isup->t24 != 0) { - g_ftdm_sngss7_data.cfg.isupInterface[i].t24 = sng_isup->t24; - } else { - g_ftdm_sngss7_data.cfg.isupInterface[i].t24 = 10; - } - if (sng_isup->t25 != 0) { - g_ftdm_sngss7_data.cfg.isupInterface[i].t25 = sng_isup->t25; - } else { - g_ftdm_sngss7_data.cfg.isupInterface[i].t25 = 20; - } - if (sng_isup->t26 != 0) { - g_ftdm_sngss7_data.cfg.isupInterface[i].t26 = sng_isup->t26; - } else { - g_ftdm_sngss7_data.cfg.isupInterface[i].t26 = 600; - } - if (sng_isup->t28 != 0) { - g_ftdm_sngss7_data.cfg.isupInterface[i].t28 = sng_isup->t28; - } else { - g_ftdm_sngss7_data.cfg.isupInterface[i].t28 = 100; - } - if (sng_isup->t29 != 0) { - g_ftdm_sngss7_data.cfg.isupInterface[i].t29 = sng_isup->t29; - } else { - g_ftdm_sngss7_data.cfg.isupInterface[i].t29 = 6; - } - if (sng_isup->t30 != 0) { - g_ftdm_sngss7_data.cfg.isupInterface[i].t30 = sng_isup->t30; - } else { - g_ftdm_sngss7_data.cfg.isupInterface[i].t30 = 50; - } - if (sng_isup->t32 != 0) { - g_ftdm_sngss7_data.cfg.isupInterface[i].t32 = sng_isup->t32; - } else { - g_ftdm_sngss7_data.cfg.isupInterface[i].t32 = 30; - } - if (sng_isup->t35 != 0) { - g_ftdm_sngss7_data.cfg.isupInterface[i].t35 = sng_isup->t35; - } else { - g_ftdm_sngss7_data.cfg.isupInterface[i].t35 = 170; - } - if (sng_isup->t37 != 0) { - g_ftdm_sngss7_data.cfg.isupInterface[i].t37 = sng_isup->t37; - } else { - g_ftdm_sngss7_data.cfg.isupInterface[i].t37 = 20; - } - if (sng_isup->t38 != 0) { - g_ftdm_sngss7_data.cfg.isupInterface[i].t38 = sng_isup->t38; - } else { - g_ftdm_sngss7_data.cfg.isupInterface[i].t38 = 1200; - } - if (sng_isup->t39 != 0) { - g_ftdm_sngss7_data.cfg.isupInterface[i].t39 = sng_isup->t39; - } else { - g_ftdm_sngss7_data.cfg.isupInterface[i].t39 = 300; - } - if (sng_isup->tfgr != 0) { - g_ftdm_sngss7_data.cfg.isupInterface[i].tfgr = sng_isup->tfgr; - } else { - g_ftdm_sngss7_data.cfg.isupInterface[i].tfgr = 50; - } - if (sng_isup->tpause != 0) { - g_ftdm_sngss7_data.cfg.isupInterface[i].tpause = sng_isup->tpause; - } else { - g_ftdm_sngss7_data.cfg.isupInterface[i].tpause = 150; - } - if (sng_isup->tstaenq != 0) { - g_ftdm_sngss7_data.cfg.isupInterface[i].tstaenq = sng_isup->tstaenq; - } else { - g_ftdm_sngss7_data.cfg.isupInterface[i].tstaenq = 5000; - } - - return 0; + int i; + + /* go through all the existing interfaces and see if we find a match */ + i = 1; + while (g_ftdm_sngss7_data.cfg.isupIntf[i].id != 0) { + if (g_ftdm_sngss7_data.cfg.isupIntf[i].nwId == sng_isup->nwId) { + + /* we have a match so break out of this loop */ + break; + } + /* move on to the next one */ + i++; + } + + if (g_ftdm_sngss7_data.cfg.isupIntf[i].id == 0) { + sng_isup->id = i; + SS7_DEBUG("found new isup interface, id is = %d\n", sng_isup->id); + } else { + sng_isup->id = i; + SS7_DEBUG("found existing isup interface, id is = %d\n", sng_isup->id); + } + + strcpy((char *)g_ftdm_sngss7_data.cfg.isupIntf[i].name, (char *)sng_isup->name); + + g_ftdm_sngss7_data.cfg.isupIntf[i].id = sng_isup->id; + g_ftdm_sngss7_data.cfg.isupIntf[i].mtpRouteId = sng_isup->mtpRouteId; + g_ftdm_sngss7_data.cfg.isupIntf[i].nwId = sng_isup->nwId; + g_ftdm_sngss7_data.cfg.isupIntf[i].dpc = sng_isup->dpc; + g_ftdm_sngss7_data.cfg.isupIntf[i].spc = sng_isup->spc; + g_ftdm_sngss7_data.cfg.isupIntf[i].switchType = sng_isup->switchType; + g_ftdm_sngss7_data.cfg.isupIntf[i].ssf = sng_isup->ssf; + g_ftdm_sngss7_data.cfg.isupIntf[i].isap = sng_isup->isap; + + if (sng_isup->t4 != 0) { + g_ftdm_sngss7_data.cfg.isupIntf[i].t4 = sng_isup->t4; + } else { + g_ftdm_sngss7_data.cfg.isupIntf[i].t4 = 3000; + } + if (sng_isup->t10 != 0) { + g_ftdm_sngss7_data.cfg.isupIntf[i].t10 = sng_isup->t10; + } else { + g_ftdm_sngss7_data.cfg.isupIntf[i].t10 = 50; + } + if (sng_isup->t11 != 0) { + g_ftdm_sngss7_data.cfg.isupIntf[i].t11 = sng_isup->t11; + } else { + g_ftdm_sngss7_data.cfg.isupIntf[i].t11 = 170; + } + if (sng_isup->t18 != 0) { + g_ftdm_sngss7_data.cfg.isupIntf[i].t18 = sng_isup->t18; + } else { + g_ftdm_sngss7_data.cfg.isupIntf[i].t18 = 300; + } + if (sng_isup->t19 != 0) { + g_ftdm_sngss7_data.cfg.isupIntf[i].t19 = sng_isup->t19; + } else { + g_ftdm_sngss7_data.cfg.isupIntf[i].t19 = 3000; + } + if (sng_isup->t20 != 0) { + g_ftdm_sngss7_data.cfg.isupIntf[i].t20 = sng_isup->t20; + } else { + g_ftdm_sngss7_data.cfg.isupIntf[i].t20 = 300; + } + if (sng_isup->t21 != 0) { + g_ftdm_sngss7_data.cfg.isupIntf[i].t21 = sng_isup->t21; + } else { + g_ftdm_sngss7_data.cfg.isupIntf[i].t21 = 3000; + } + if (sng_isup->t22 != 0) { + g_ftdm_sngss7_data.cfg.isupIntf[i].t22 = sng_isup->t22; + } else { + g_ftdm_sngss7_data.cfg.isupIntf[i].t22 = 300; + } + if (sng_isup->t23 != 0) { + g_ftdm_sngss7_data.cfg.isupIntf[i].t23 = sng_isup->t23; + } else { + g_ftdm_sngss7_data.cfg.isupIntf[i].t23 = 3000; + } + if (sng_isup->t24 != 0) { + g_ftdm_sngss7_data.cfg.isupIntf[i].t24 = sng_isup->t24; + } else { + g_ftdm_sngss7_data.cfg.isupIntf[i].t24 = 10; + } + if (sng_isup->t25 != 0) { + g_ftdm_sngss7_data.cfg.isupIntf[i].t25 = sng_isup->t25; + } else { + g_ftdm_sngss7_data.cfg.isupIntf[i].t25 = 20; + } + if (sng_isup->t26 != 0) { + g_ftdm_sngss7_data.cfg.isupIntf[i].t26 = sng_isup->t26; + } else { + g_ftdm_sngss7_data.cfg.isupIntf[i].t26 = 600; + } + if (sng_isup->t28 != 0) { + g_ftdm_sngss7_data.cfg.isupIntf[i].t28 = sng_isup->t28; + } else { + g_ftdm_sngss7_data.cfg.isupIntf[i].t28 = 100; + } + if (sng_isup->t29 != 0) { + g_ftdm_sngss7_data.cfg.isupIntf[i].t29 = sng_isup->t29; + } else { + g_ftdm_sngss7_data.cfg.isupIntf[i].t29 = 6; + } + if (sng_isup->t30 != 0) { + g_ftdm_sngss7_data.cfg.isupIntf[i].t30 = sng_isup->t30; + } else { + g_ftdm_sngss7_data.cfg.isupIntf[i].t30 = 50; + } + if (sng_isup->t32 != 0) { + g_ftdm_sngss7_data.cfg.isupIntf[i].t32 = sng_isup->t32; + } else { + g_ftdm_sngss7_data.cfg.isupIntf[i].t32 = 30; + } + if (sng_isup->t35 != 0) { + g_ftdm_sngss7_data.cfg.isupIntf[i].t35 = sng_isup->t35; + } else { + g_ftdm_sngss7_data.cfg.isupIntf[i].t35 = 170; + } + if (sng_isup->t37 != 0) { + g_ftdm_sngss7_data.cfg.isupIntf[i].t37 = sng_isup->t37; + } else { + g_ftdm_sngss7_data.cfg.isupIntf[i].t37 = 20; + } + if (sng_isup->t38 != 0) { + g_ftdm_sngss7_data.cfg.isupIntf[i].t38 = sng_isup->t38; + } else { + g_ftdm_sngss7_data.cfg.isupIntf[i].t38 = 1200; + } + if (sng_isup->t39 != 0) { + g_ftdm_sngss7_data.cfg.isupIntf[i].t39 = sng_isup->t39; + } else { + g_ftdm_sngss7_data.cfg.isupIntf[i].t39 = 300; + } + if (sng_isup->tfgr != 0) { + g_ftdm_sngss7_data.cfg.isupIntf[i].tfgr = sng_isup->tfgr; + } else { + g_ftdm_sngss7_data.cfg.isupIntf[i].tfgr = 50; + } + if (sng_isup->tpause != 0) { + g_ftdm_sngss7_data.cfg.isupIntf[i].tpause = sng_isup->tpause; + } else { + g_ftdm_sngss7_data.cfg.isupIntf[i].tpause = 150; + } + if (sng_isup->tstaenq != 0) { + g_ftdm_sngss7_data.cfg.isupIntf[i].tstaenq = sng_isup->tstaenq; + } else { + g_ftdm_sngss7_data.cfg.isupIntf[i].tstaenq = 5000; + } + + return 0; } /******************************************************************************/ -static int ftmod_ss7_fill_in_isup_cc_interface(sng_isup_cc_t *sng_cc) +static int ftmod_ss7_fill_in_isap(sng_isap_t *sng_isap) { - - int i; - - /* go through all the existing interfaces and see if we find a match */ - i = 1; - while (g_ftdm_sngss7_data.cfg.isup_cc[i].id != 0) { - if (g_ftdm_sngss7_data.cfg.isup_cc[i].switchType == sng_cc->switchType) { - - /* we have a match so break out of this loop */ - break; - } - /* move on to the next one */ - i++; - } - - if (g_ftdm_sngss7_data.cfg.isup_cc[i].id == 0) { - g_ftdm_sngss7_data.cfg.isup_cc[i].id = i; - SS7_DEBUG("found new isup to cc interface, id is = %d\n", g_ftdm_sngss7_data.cfg.isup_cc[i].id); - } else { - g_ftdm_sngss7_data.cfg.isup_cc[i].id = i; - SS7_DEBUG("found existing isup to cc interface, id is = %d\n", g_ftdm_sngss7_data.cfg.isup_cc[i].id); - } - - SS7_ERROR("KONRAD -> you're hard coding the CC id....fix me!!!!\n"); - g_ftdm_sngss7_data.cfg.isup_cc[i].ccId = 1; /*KONRAD FIX ME */ - g_ftdm_sngss7_data.cfg.isup_cc[i].switchType = sng_cc->switchType; - g_ftdm_sngss7_data.cfg.isup_cc[i].ssf = sng_cc->ssf; - if (sng_cc->t1 != 0) { - g_ftdm_sngss7_data.cfg.isup_cc[i].t1 = sng_cc->t1; - } else { - g_ftdm_sngss7_data.cfg.isup_cc[i].t1 = 200; - } - if (sng_cc->t2 != 0) { - g_ftdm_sngss7_data.cfg.isup_cc[i].t2 = sng_cc->t2; - } else { - g_ftdm_sngss7_data.cfg.isup_cc[i].t2 = 1800; - } - if (sng_cc->t5 != 0) { - g_ftdm_sngss7_data.cfg.isup_cc[i].t5 = sng_cc->t5; - } else { - g_ftdm_sngss7_data.cfg.isup_cc[i].t5 = 3000; - } - if (sng_cc->t6 != 0) { - g_ftdm_sngss7_data.cfg.isup_cc[i].t6 = sng_cc->t6; - } else { - g_ftdm_sngss7_data.cfg.isup_cc[i].t6 = 200; - } - if (sng_cc->t7 != 0) { - g_ftdm_sngss7_data.cfg.isup_cc[i].t7 = sng_cc->t7; - } else { - g_ftdm_sngss7_data.cfg.isup_cc[i].t7 = 250; - } - if (sng_cc->t8 != 0) { - g_ftdm_sngss7_data.cfg.isup_cc[i].t8 = sng_cc->t8; - } else { - g_ftdm_sngss7_data.cfg.isup_cc[i].t8 = 120; - } - if (sng_cc->t9 != 0) { - g_ftdm_sngss7_data.cfg.isup_cc[i].t9 = sng_cc->t9; - } else { - g_ftdm_sngss7_data.cfg.isup_cc[i].t9 = 1800; - } - if (sng_cc->t27 != 0) { - g_ftdm_sngss7_data.cfg.isup_cc[i].t27 = sng_cc->t27; - } else { - g_ftdm_sngss7_data.cfg.isup_cc[i].t27 = 2400; - } - if (sng_cc->t31 != 0) { - g_ftdm_sngss7_data.cfg.isup_cc[i].t31 = sng_cc->t31; - } else { - g_ftdm_sngss7_data.cfg.isup_cc[i].t31 = 3650; - } - if (sng_cc->t33 != 0) { - g_ftdm_sngss7_data.cfg.isup_cc[i].t33 = sng_cc->t33; - } else { - g_ftdm_sngss7_data.cfg.isup_cc[i].t33 = 120; - } - if (sng_cc->t34 != 0) { - g_ftdm_sngss7_data.cfg.isup_cc[i].t34 = sng_cc->t34; - } else { - g_ftdm_sngss7_data.cfg.isup_cc[i].t34 = 40; - } - if (sng_cc->t36 != 0) { - g_ftdm_sngss7_data.cfg.isup_cc[i].t36 = sng_cc->t36; - } else { - g_ftdm_sngss7_data.cfg.isup_cc[i].t36 = 120; - } - if (sng_cc->tccr != 0) { - g_ftdm_sngss7_data.cfg.isup_cc[i].tccr = sng_cc->tccr; - } else { - g_ftdm_sngss7_data.cfg.isup_cc[i].tccr = 200; - } - if (sng_cc->tccrt != 0) { - g_ftdm_sngss7_data.cfg.isup_cc[i].tccrt = sng_cc->tccrt; - } else { - g_ftdm_sngss7_data.cfg.isup_cc[i].tccrt = 20; - } - if (sng_cc->tex != 0) { - g_ftdm_sngss7_data.cfg.isup_cc[i].tex = sng_cc->tex; - } else { - g_ftdm_sngss7_data.cfg.isup_cc[i].tex = 10; - } - if (sng_cc->tcrm != 0) { - g_ftdm_sngss7_data.cfg.isup_cc[i].tcrm = sng_cc->tcrm; - } else { - g_ftdm_sngss7_data.cfg.isup_cc[i].tcrm = 30; - } - if (sng_cc->tcra != 0) { - g_ftdm_sngss7_data.cfg.isup_cc[i].tcra = sng_cc->tcra; - } else { - g_ftdm_sngss7_data.cfg.isup_cc[i].tcra = 100; - } - if (sng_cc->tect != 0) { - g_ftdm_sngss7_data.cfg.isup_cc[i].tect = sng_cc->tect; - } else { - g_ftdm_sngss7_data.cfg.isup_cc[i].tect = 10; - } - if (sng_cc->trelrsp != 0) { - g_ftdm_sngss7_data.cfg.isup_cc[i].trelrsp = sng_cc->trelrsp; - } else { - g_ftdm_sngss7_data.cfg.isup_cc[i].trelrsp = 10; - } - if (sng_cc->tfnlrelrsp != 0) { - g_ftdm_sngss7_data.cfg.isup_cc[i].tfnlrelrsp= sng_cc->tfnlrelrsp; - } else { - g_ftdm_sngss7_data.cfg.isup_cc[i].tfnlrelrsp= 10; - } - - return 0; + int i; + + /* go through all the existing interfaces and see if we find a match */ + i = 1; + while (g_ftdm_sngss7_data.cfg.isap[i].id != 0) { + if (g_ftdm_sngss7_data.cfg.isap[i].switchType == sng_isap->switchType) { + + /* we have a match so break out of this loop */ + break; + } + /* move on to the next one */ + i++; + } + + if (g_ftdm_sngss7_data.cfg.isap[i].id == 0) { + sng_isap->id = i; + SS7_DEBUG("found new isup to cc interface, id is = %d\n", g_ftdm_sngss7_data.cfg.isap[i].id); + } else { + sng_isap->id = i; + SS7_DEBUG("found existing isup to cc interface, id is = %d\n", g_ftdm_sngss7_data.cfg.isap[i].id); + } + + g_ftdm_sngss7_data.cfg.isap[i].id = sng_isap->id; + g_ftdm_sngss7_data.cfg.isap[i].suId = 1; /*KONRAD FIX ME */ + g_ftdm_sngss7_data.cfg.isap[i].switchType = sng_isap->switchType; + g_ftdm_sngss7_data.cfg.isap[i].ssf = sng_isap->ssf; + + if (sng_isap->t1 != 0) { + g_ftdm_sngss7_data.cfg.isap[i].t1 = sng_isap->t1; + } else { + g_ftdm_sngss7_data.cfg.isap[i].t1 = 200; + } + if (sng_isap->t2 != 0) { + g_ftdm_sngss7_data.cfg.isap[i].t2 = sng_isap->t2; + } else { + g_ftdm_sngss7_data.cfg.isap[i].t2 = 1800; + } + if (sng_isap->t5 != 0) { + g_ftdm_sngss7_data.cfg.isap[i].t5 = sng_isap->t5; + } else { + g_ftdm_sngss7_data.cfg.isap[i].t5 = 3000; + } + if (sng_isap->t6 != 0) { + g_ftdm_sngss7_data.cfg.isap[i].t6 = sng_isap->t6; + } else { + g_ftdm_sngss7_data.cfg.isap[i].t6 = 200; + } + if (sng_isap->t7 != 0) { + g_ftdm_sngss7_data.cfg.isap[i].t7 = sng_isap->t7; + } else { + g_ftdm_sngss7_data.cfg.isap[i].t7 = 250; + } + if (sng_isap->t8 != 0) { + g_ftdm_sngss7_data.cfg.isap[i].t8 = sng_isap->t8; + } else { + g_ftdm_sngss7_data.cfg.isap[i].t8 = 120; + } + if (sng_isap->t9 != 0) { + g_ftdm_sngss7_data.cfg.isap[i].t9 = sng_isap->t9; + } else { + g_ftdm_sngss7_data.cfg.isap[i].t9 = 1800; + } + if (sng_isap->t27 != 0) { + g_ftdm_sngss7_data.cfg.isap[i].t27 = sng_isap->t27; + } else { + g_ftdm_sngss7_data.cfg.isap[i].t27 = 2400; + } + if (sng_isap->t31 != 0) { + g_ftdm_sngss7_data.cfg.isap[i].t31 = sng_isap->t31; + } else { + g_ftdm_sngss7_data.cfg.isap[i].t31 = 3650; + } + if (sng_isap->t33 != 0) { + g_ftdm_sngss7_data.cfg.isap[i].t33 = sng_isap->t33; + } else { + g_ftdm_sngss7_data.cfg.isap[i].t33 = 120; + } + if (sng_isap->t34 != 0) { + g_ftdm_sngss7_data.cfg.isap[i].t34 = sng_isap->t34; + } else { + g_ftdm_sngss7_data.cfg.isap[i].t34 = 40; + } + if (sng_isap->t36 != 0) { + g_ftdm_sngss7_data.cfg.isap[i].t36 = sng_isap->t36; + } else { + g_ftdm_sngss7_data.cfg.isap[i].t36 = 120; + } + if (sng_isap->tccr != 0) { + g_ftdm_sngss7_data.cfg.isap[i].tccr = sng_isap->tccr; + } else { + g_ftdm_sngss7_data.cfg.isap[i].tccr = 200; + } + if (sng_isap->tccrt != 0) { + g_ftdm_sngss7_data.cfg.isap[i].tccrt = sng_isap->tccrt; + } else { + g_ftdm_sngss7_data.cfg.isap[i].tccrt = 20; + } + if (sng_isap->tex != 0) { + g_ftdm_sngss7_data.cfg.isap[i].tex = sng_isap->tex; + } else { + g_ftdm_sngss7_data.cfg.isap[i].tex = 10; + } + if (sng_isap->tcrm != 0) { + g_ftdm_sngss7_data.cfg.isap[i].tcrm = sng_isap->tcrm; + } else { + g_ftdm_sngss7_data.cfg.isap[i].tcrm = 30; + } + if (sng_isap->tcra != 0) { + g_ftdm_sngss7_data.cfg.isap[i].tcra = sng_isap->tcra; + } else { + g_ftdm_sngss7_data.cfg.isap[i].tcra = 100; + } + if (sng_isap->tect != 0) { + g_ftdm_sngss7_data.cfg.isap[i].tect = sng_isap->tect; + } else { + g_ftdm_sngss7_data.cfg.isap[i].tect = 10; + } + if (sng_isap->trelrsp != 0) { + g_ftdm_sngss7_data.cfg.isap[i].trelrsp = sng_isap->trelrsp; + } else { + g_ftdm_sngss7_data.cfg.isap[i].trelrsp = 10; + } + if (sng_isap->tfnlrelrsp != 0) { + g_ftdm_sngss7_data.cfg.isap[i].tfnlrelrsp = sng_isap->tfnlrelrsp; + } else { + g_ftdm_sngss7_data.cfg.isap[i].tfnlrelrsp = 10; + } + + return 0; } /******************************************************************************/ static int ftmod_ss7_fill_in_self_route(int spc, int linkType, int switchType, int ssf) { - if (g_ftdm_sngss7_data.cfg.mtp3Route[0].dpc == 0){ - SS7_DEBUG("found new mtp3 self route\n"); - } else if (g_ftdm_sngss7_data.cfg.mtp3Route[0].dpc == spc) { - SS7_DEBUG("found existing mtp3 self route\n"); - return FTDM_SUCCESS; - } else { - SS7_ERROR("found new mtp3 self route but it does not much the route already configured\n"); - return FTDM_FAIL; - } - - g_ftdm_sngss7_data.cfg.mtp3Route[0].id = 0; - g_ftdm_sngss7_data.cfg.mtp3Route[0].dpc = spc; - g_ftdm_sngss7_data.cfg.mtp3Route[0].linkType = linkType; - g_ftdm_sngss7_data.cfg.mtp3Route[0].switchType = switchType; - g_ftdm_sngss7_data.cfg.mtp3Route[0].cmbLinkSetId = 0; - g_ftdm_sngss7_data.cfg.mtp3Route[0].isSTP = 0; - g_ftdm_sngss7_data.cfg.mtp3Route[0].ssf = 0; - g_ftdm_sngss7_data.cfg.mtp3Route[0].t6 = 8; - g_ftdm_sngss7_data.cfg.mtp3Route[0].t8 = 12; - g_ftdm_sngss7_data.cfg.mtp3Route[0].t10 = 300; - g_ftdm_sngss7_data.cfg.mtp3Route[0].t11 = 300; - g_ftdm_sngss7_data.cfg.mtp3Route[0].t15 = 30; - g_ftdm_sngss7_data.cfg.mtp3Route[0].t16 = 20; - g_ftdm_sngss7_data.cfg.mtp3Route[0].t18 = 200; - g_ftdm_sngss7_data.cfg.mtp3Route[0].t19 = 690; - g_ftdm_sngss7_data.cfg.mtp3Route[0].t21 = 650; - g_ftdm_sngss7_data.cfg.mtp3Route[0].t25 = 100; - - - return 0; + if (g_ftdm_sngss7_data.cfg.mtpRoute[0].dpc == 0){ + SS7_DEBUG("found new mtp3 self route\n"); + } else if (g_ftdm_sngss7_data.cfg.mtpRoute[0].dpc == spc) { + SS7_DEBUG("found existing mtp3 self route\n"); + return FTDM_SUCCESS; + } else { + SS7_ERROR("found new mtp3 self route but it does not much the route already configured\n"); + return FTDM_FAIL; + } + + strcpy((char *)g_ftdm_sngss7_data.cfg.mtpRoute[0].name, "self-route"); + + g_ftdm_sngss7_data.cfg.mtpRoute[0].id = 0; + g_ftdm_sngss7_data.cfg.mtpRoute[0].dpc = spc; + g_ftdm_sngss7_data.cfg.mtpRoute[0].linkType = linkType; + g_ftdm_sngss7_data.cfg.mtpRoute[0].switchType = switchType; + g_ftdm_sngss7_data.cfg.mtpRoute[0].cmbLinkSetId = 0; + g_ftdm_sngss7_data.cfg.mtpRoute[0].isSTP = 0; + g_ftdm_sngss7_data.cfg.mtpRoute[0].ssf = ssf; + g_ftdm_sngss7_data.cfg.mtpRoute[0].t6 = 8; + g_ftdm_sngss7_data.cfg.mtpRoute[0].t8 = 12; + g_ftdm_sngss7_data.cfg.mtpRoute[0].t10 = 300; + g_ftdm_sngss7_data.cfg.mtpRoute[0].t11 = 300; + g_ftdm_sngss7_data.cfg.mtpRoute[0].t15 = 30; + g_ftdm_sngss7_data.cfg.mtpRoute[0].t16 = 20; + g_ftdm_sngss7_data.cfg.mtpRoute[0].t18 = 200; + g_ftdm_sngss7_data.cfg.mtpRoute[0].t19 = 690; + g_ftdm_sngss7_data.cfg.mtpRoute[0].t21 = 650; + g_ftdm_sngss7_data.cfg.mtpRoute[0].t25 = 100; + + return 0; } /******************************************************************************/ static int ftmod_ss7_fill_in_circuits(char *ch_map, int cicbase, int typeCntrl, int isup_id, ftdm_span_t *span) { - sngss7_chan_data_t *ss7_info = NULL; - ftdm_channel_t *ftdmchan = NULL; - sng_timeslot_t timeslot; - int count; - int i; - int x; - - count = 1; - - while (ch_map[0] != '\0') { - - /* pull out the next timeslot */ - if (ftmod_ss7_next_timeslot(ch_map, ×lot)) { - SS7_ERROR("Failed to parse the channel map!\n"); - return FTDM_FAIL; - } - - if ((timeslot.siglink) || (timeslot.gap)) { - /* try to find the channel in the circuits structure*/ - x = 1; - while (g_ftdm_sngss7_data.cfg.isupCircuit[x].id != 0) { - if ((g_ftdm_sngss7_data.cfg.isupCircuit[x].chan == count) && - (g_ftdm_sngss7_data.cfg.isupCircuit[x].span == span->channels[1]->physical_span_id)) { - - SS7_DEVEL_DEBUG("Circuit for span=%d, chan=%d is already exists...id=%d\n", - span->channels[1]->physical_span_id, - count, - x); - - /* we have a match so this circuit already exists in the structure */ - break; - } - /* move to the next circuit */ - x++; - } /* while (g_ftdm_sngss7_data.cfg.isupCircuit[x].id != 0) */ - - /* check why we exited the while loop */ - if (g_ftdm_sngss7_data.cfg.isupCircuit[x].id == 0) { - SS7_DEVEL_DEBUG("Circuit for span=%d, chan=%d is new...id=%d\n", - span->channels[1]->physical_span_id, - count, - x); - - /* prepare the global info sturcture */ - ss7_info = ftdm_calloc(1, sizeof(sngss7_chan_data_t)); - ss7_info->ftdmchan = NULL; - ss7_info->circuit = &g_ftdm_sngss7_data.cfg.isupCircuit[x]; - - /* circuit is new so fill in the needed information */ - g_ftdm_sngss7_data.cfg.isupCircuit[x].id = x; - g_ftdm_sngss7_data.cfg.isupCircuit[x].span = span->channels[1]->physical_span_id; - g_ftdm_sngss7_data.cfg.isupCircuit[x].chan = count; - if (timeslot.siglink) { - g_ftdm_sngss7_data.cfg.isupCircuit[x].siglink = 1; - } else { - g_ftdm_sngss7_data.cfg.isupCircuit[x].siglink = 0; - } - if (timeslot.channel) { - g_ftdm_sngss7_data.cfg.isupCircuit[x].hole = 0; - g_ftdm_sngss7_data.cfg.isupCircuit[x].cic = cicbase; - cicbase++; - } else { - g_ftdm_sngss7_data.cfg.isupCircuit[x].hole = 1; - g_ftdm_sngss7_data.cfg.isupCircuit[x].cic = 0; - } - g_ftdm_sngss7_data.cfg.isupCircuit[x].infId = isup_id; - g_ftdm_sngss7_data.cfg.isupCircuit[x].typeCntrl = typeCntrl; - g_ftdm_sngss7_data.cfg.isupCircuit[x].t3 = 1200; - g_ftdm_sngss7_data.cfg.isupCircuit[x].t12 = 300; - g_ftdm_sngss7_data.cfg.isupCircuit[x].t13 = 3000; - g_ftdm_sngss7_data.cfg.isupCircuit[x].t14 = 300; - g_ftdm_sngss7_data.cfg.isupCircuit[x].t15 = 3000; - g_ftdm_sngss7_data.cfg.isupCircuit[x].t16 = 300; - g_ftdm_sngss7_data.cfg.isupCircuit[x].t17 = 3000; - g_ftdm_sngss7_data.cfg.isupCircuit[x].tval = 10; - g_ftdm_sngss7_data.cfg.isupCircuit[x].obj = ss7_info; - - } /* if (g_ftdm_sngss7_data.cfg.isupCircuit[x].id == 0) */ - } else { /* if ((timeslot.siglink) || (timeslot.gap)) */ - /* find the ftdm the channel structure for this channel*/ - i = 1; - while (span->channels[i] != NULL) { - if (span->channels[i]->physical_chan_id == timeslot.channel) { - break; - } - i++; - } /* while (span->channels[i] != NULL) */ - - if (span->channels[i] == NULL) { - /* we weren't able to find the channel in the ftdm channels */ - SS7_ERROR("Unable to find the requested channel %d in the FreeTDM channels!\n", timeslot.channel); - return FTDM_FAIL; - } else { - ftdmchan = span->channels[i]; - } - - /* try to find a match for the physical span and chan */ - x = 1; - while (g_ftdm_sngss7_data.cfg.isupCircuit[x].id != 0) { - if ((g_ftdm_sngss7_data.cfg.isupCircuit[x].chan == ftdmchan->physical_chan_id) - && (g_ftdm_sngss7_data.cfg.isupCircuit[x].span == ftdmchan->physical_span_id)) { - - /* we have a match so this circuit already exists in the structure */ - break; - } - /* move to the next circuit */ - x++; - } /* while (g_ftdm_sngss7_data.cfg.isupCircuit[x].id != 0) */ - - /* check why we exited the while loop */ - if (g_ftdm_sngss7_data.cfg.isupCircuit[x].id == 0) { - SS7_DEVEL_DEBUG("Circuit for span=%d, chan=%d is new...id=%d\n", - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id, - x); - - /* prepare the global info sturcture */ - ss7_info = ftdm_calloc(1, sizeof(sngss7_chan_data_t)); - ss7_info->ftdmchan = ftdmchan; - ss7_info->circuit = &g_ftdm_sngss7_data.cfg.isupCircuit[x]; - ftdmchan->call_data = ss7_info; - - /* prepare the timer structures */ - ss7_info->t35.sched = sngss7_sched; - ss7_info->t35.counter = 1; - ss7_info->t35.beat = g_ftdm_sngss7_data.cfg.isupInterface[isup_id].t35*100; /* beat is in ms, t35 is in 100ms */ - ss7_info->t35.callback = handle_isup_t35; - ss7_info->t35.sngss7_info = ss7_info; - - /* circuit is new so fill in the needed information */ - g_ftdm_sngss7_data.cfg.isupCircuit[x].id = x; - g_ftdm_sngss7_data.cfg.isupCircuit[x].span = ftdmchan->physical_span_id; - g_ftdm_sngss7_data.cfg.isupCircuit[x].chan = ftdmchan->physical_chan_id; - g_ftdm_sngss7_data.cfg.isupCircuit[x].siglink = 0; - g_ftdm_sngss7_data.cfg.isupCircuit[x].hole = 0; - g_ftdm_sngss7_data.cfg.isupCircuit[x].cic = cicbase; - g_ftdm_sngss7_data.cfg.isupCircuit[x].infId = isup_id; - g_ftdm_sngss7_data.cfg.isupCircuit[x].typeCntrl = typeCntrl; - g_ftdm_sngss7_data.cfg.isupCircuit[x].t3 = 1200; - g_ftdm_sngss7_data.cfg.isupCircuit[x].t12 = 300; - g_ftdm_sngss7_data.cfg.isupCircuit[x].t13 = 3000; - g_ftdm_sngss7_data.cfg.isupCircuit[x].t14 = 300; - g_ftdm_sngss7_data.cfg.isupCircuit[x].t15 = 3000; - g_ftdm_sngss7_data.cfg.isupCircuit[x].t16 = 300; - g_ftdm_sngss7_data.cfg.isupCircuit[x].t17 = 3000; - g_ftdm_sngss7_data.cfg.isupCircuit[x].tval = 10; - g_ftdm_sngss7_data.cfg.isupCircuit[x].obj = ss7_info; - - /* increment the cicbase */ - cicbase++; - } else { /* if (g_ftdm_sngss7_data.cfg.isupCircuit[x].id == 0) */ - SS7_DEBUG("Circuit for span=%d, chan=%d is new...id=%d\n", - ftdmchan->physical_span_id, - ftdmchan->physical_chan_id, - x); - - /* for now make sure ss7_info is set to null */ - ss7_info = NULL; - - /* KONRAD FIX ME -> confirm that it is the same circuit */ - } /* if (g_ftdm_sngss7_data.cfg.isupCircuit[x].id == 0) */ - - /* increment the span channel count */ - count++; - } /* if ((timeslot.siglink) || (timeslot.gap)) */ - - if (ss7_info == NULL) { - SS7_ERROR("KONRAD -> circuit was not configured !\n"); - return FTDM_FAIL; - } - - if (ss7_info->ftdmchan == NULL) { - SS7_INFO("Added span = %d, chan = %d, cic = %d, FTDM chan = %d, ISUP cirId = %d\n", - g_ftdm_sngss7_data.cfg.isupCircuit[x].span, - g_ftdm_sngss7_data.cfg.isupCircuit[x].chan, - g_ftdm_sngss7_data.cfg.isupCircuit[x].cic, - 0, - g_ftdm_sngss7_data.cfg.isupCircuit[x].id); - } else { - SS7_INFO("Added span = %d, chan = %d, cic = %d, FTDM chan = %d, ISUP cirId = %d\n", - g_ftdm_sngss7_data.cfg.isupCircuit[x].span, - g_ftdm_sngss7_data.cfg.isupCircuit[x].chan, - g_ftdm_sngss7_data.cfg.isupCircuit[x].cic, - ss7_info->ftdmchan->chan_id, - g_ftdm_sngss7_data.cfg.isupCircuit[x].id); - } - - } /* while (ch_map[0] != '\0') */ - - return 0; + sngss7_chan_data_t *ss7_info = NULL; + ftdm_channel_t *ftdmchan = NULL; + sng_timeslot_t timeslot; + int count; + int i; + int x; + + count = 1; + + while (ch_map[0] != '\0') { + + /* pull out the next timeslot */ + if (ftmod_ss7_next_timeslot(ch_map, ×lot)) { + SS7_ERROR("Failed to parse the channel map!\n"); + return FTDM_FAIL; + } + + if ((timeslot.siglink) || (timeslot.gap)) { + /* try to find the channel in the circuits structure*/ + x = 1; + while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { + if ((g_ftdm_sngss7_data.cfg.isupCkt[x].chan == count) && + (g_ftdm_sngss7_data.cfg.isupCkt[x].span == span->channels[1]->physical_span_id)) { + + SS7_DEVEL_DEBUG("Circuit for span=%d, chan=%d is already exists...id=%d\n", + span->channels[1]->physical_span_id, + count, + x); + + /* we have a match so this circuit already exists in the structure */ + break; + } + /* move to the next circuit */ + x++; + } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */ + + /* check why we exited the while loop */ + if (g_ftdm_sngss7_data.cfg.isupCkt[x].id == 0) { + SS7_DEVEL_DEBUG("Circuit for span=%d, chan=%d is new...id=%d\n", + span->channels[1]->physical_span_id, + count, + x); + + /* prepare the global info sturcture */ + ss7_info = ftdm_calloc(1, sizeof(sngss7_chan_data_t)); + ss7_info->ftdmchan = NULL; + ss7_info->circuit = &g_ftdm_sngss7_data.cfg.isupCkt[x]; + + /* circuit is new so fill in the needed information */ + g_ftdm_sngss7_data.cfg.isupCkt[x].id = x; + g_ftdm_sngss7_data.cfg.isupCkt[x].span = span->channels[1]->physical_span_id; + g_ftdm_sngss7_data.cfg.isupCkt[x].chan = count; + if (timeslot.siglink) { + g_ftdm_sngss7_data.cfg.isupCkt[x].type = SIG; + } else if (timeslot.hole) { + g_ftdm_sngss7_data.cfg.isupCkt[x].type = HOLE; + } else { + g_ftdm_sngss7_data.cfg.isupCkt[x].type = VOICE; + } + if (timeslot.channel) { + g_ftdm_sngss7_data.cfg.isupCkt[x].cic = cicbase; + cicbase++; + } else { + g_ftdm_sngss7_data.cfg.isupCkt[x].cic = 0; + } + g_ftdm_sngss7_data.cfg.isupCkt[x].infId = isup_id; + g_ftdm_sngss7_data.cfg.isupCkt[x].typeCntrl = typeCntrl; + g_ftdm_sngss7_data.cfg.isupCkt[x].t3 = 1200; + g_ftdm_sngss7_data.cfg.isupCkt[x].t12 = 300; + g_ftdm_sngss7_data.cfg.isupCkt[x].t13 = 3000; + g_ftdm_sngss7_data.cfg.isupCkt[x].t14 = 300; + g_ftdm_sngss7_data.cfg.isupCkt[x].t15 = 3000; + g_ftdm_sngss7_data.cfg.isupCkt[x].t16 = 300; + g_ftdm_sngss7_data.cfg.isupCkt[x].t17 = 3000; + g_ftdm_sngss7_data.cfg.isupCkt[x].tval = 10; + g_ftdm_sngss7_data.cfg.isupCkt[x].ssf = g_ftdm_sngss7_data.cfg.isupIntf[isup_id].ssf; + g_ftdm_sngss7_data.cfg.isupCkt[x].obj = ss7_info; + + } /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].id == 0) */ + } else { /* if ((timeslot.siglink) || (timeslot.gap)) */ + /* find the ftdm the channel structure for this channel*/ + i = 1; + while (span->channels[i] != NULL) { + if (span->channels[i]->physical_chan_id == timeslot.channel) { + break; + } + i++; + } /* while (span->channels[i] != NULL) */ + + if (span->channels[i] == NULL) { + /* we weren't able to find the channel in the ftdm channels */ + SS7_ERROR("Unable to find the requested channel %d in the FreeTDM channels!\n", timeslot.channel); + return FTDM_FAIL; + } else { + ftdmchan = span->channels[i]; + } + + /* try to find a match for the physical span and chan */ + x = 1; + while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { + if ((g_ftdm_sngss7_data.cfg.isupCkt[x].chan == ftdmchan->physical_chan_id) + && (g_ftdm_sngss7_data.cfg.isupCkt[x].span == ftdmchan->physical_span_id)) { + + /* we have a match so this circuit already exists in the structure */ + break; + } + /* move to the next circuit */ + x++; + } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */ + + /* check why we exited the while loop */ + if (g_ftdm_sngss7_data.cfg.isupCkt[x].id == 0) { + SS7_DEVEL_DEBUG("Circuit for span=%d, chan=%d is new...id=%d\n", + ftdmchan->physical_span_id, + ftdmchan->physical_chan_id, + x); + + /* prepare the global info sturcture */ + ss7_info = ftdm_calloc(1, sizeof(sngss7_chan_data_t)); + ss7_info->ftdmchan = ftdmchan; + ss7_info->circuit = &g_ftdm_sngss7_data.cfg.isupCkt[x]; + ftdmchan->call_data = ss7_info; + + /* prepare the timer structures */ + ss7_info->t35.sched = ((sngss7_span_data_t *)span->mod_data)->sched; + ss7_info->t35.counter = 1; + ss7_info->t35.beat = g_ftdm_sngss7_data.cfg.isupIntf[isup_id].t35*100; /* beat is in ms, t35 is in 100ms */ + ss7_info->t35.callback = handle_isup_t35; + ss7_info->t35.sngss7_info = ss7_info; + + /* circuit is new so fill in the needed information */ + g_ftdm_sngss7_data.cfg.isupCkt[x].id = x; + g_ftdm_sngss7_data.cfg.isupCkt[x].span = ftdmchan->physical_span_id; + g_ftdm_sngss7_data.cfg.isupCkt[x].chan = ftdmchan->physical_chan_id; + g_ftdm_sngss7_data.cfg.isupCkt[x].type = VOICE; + g_ftdm_sngss7_data.cfg.isupCkt[x].cic = cicbase; + g_ftdm_sngss7_data.cfg.isupCkt[x].infId = isup_id; + g_ftdm_sngss7_data.cfg.isupCkt[x].typeCntrl = typeCntrl; + g_ftdm_sngss7_data.cfg.isupCkt[x].t3 = 1200; + g_ftdm_sngss7_data.cfg.isupCkt[x].t12 = 300; + g_ftdm_sngss7_data.cfg.isupCkt[x].t13 = 3000; + g_ftdm_sngss7_data.cfg.isupCkt[x].t14 = 300; + g_ftdm_sngss7_data.cfg.isupCkt[x].t15 = 3000; + g_ftdm_sngss7_data.cfg.isupCkt[x].t16 = 300; + g_ftdm_sngss7_data.cfg.isupCkt[x].t17 = 3000; + g_ftdm_sngss7_data.cfg.isupCkt[x].tval = 10; + g_ftdm_sngss7_data.cfg.isupCkt[x].obj = ss7_info; + g_ftdm_sngss7_data.cfg.isupCkt[x].ssf = g_ftdm_sngss7_data.cfg.isupIntf[isup_id].ssf; + + /* increment the cicbase */ + cicbase++; + } else { /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].id == 0) */ + SS7_DEBUG("Circuit for span=%d, chan=%d is new...id=%d\n", + ftdmchan->physical_span_id, + ftdmchan->physical_chan_id, + x); + + /* for now make sure ss7_info is set to null */ + ss7_info = NULL; + + /* KONRAD FIX ME -> confirm that it is the same circuit */ + } /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].id == 0) */ + + /* increment the span channel count */ + count++; + } /* if ((timeslot.siglink) || (timeslot.gap)) */ + + if (ss7_info == NULL) { + SS7_ERROR("KONRAD -> circuit was not configured !\n"); + return FTDM_FAIL; + } + + if (ss7_info->ftdmchan == NULL) { + SS7_INFO("Added span = %d, chan = %d, cic = %d, FTDM chan = %d, ISUP cirId = %d\n", + g_ftdm_sngss7_data.cfg.isupCkt[x].span, + g_ftdm_sngss7_data.cfg.isupCkt[x].chan, + g_ftdm_sngss7_data.cfg.isupCkt[x].cic, + 0, + g_ftdm_sngss7_data.cfg.isupCkt[x].id); + } else { + SS7_INFO("Added span = %d, chan = %d, cic = %d, FTDM chan = %d, ISUP cirId = %d\n", + g_ftdm_sngss7_data.cfg.isupCkt[x].span, + g_ftdm_sngss7_data.cfg.isupCkt[x].chan, + g_ftdm_sngss7_data.cfg.isupCkt[x].cic, + ss7_info->ftdmchan->chan_id, + g_ftdm_sngss7_data.cfg.isupCkt[x].id); + } + + } /* while (ch_map[0] != '\0') */ + + return 0; } /******************************************************************************/ static int ftmod_ss7_next_timeslot(char *ch_map, sng_timeslot_t *timeslot) { - int i; - int x; - int lower; - int upper; - char tmp[5]; /*KONRAD FIX ME*/ - char new_ch_map[MAX_CIC_LENGTH]; - - memset(&tmp[0], '\0', sizeof(tmp)); - memset(&new_ch_map[0], '\0', sizeof(new_ch_map)); - memset(timeslot, 0x0, sizeof(sng_timeslot_t)); - - SS7_DEVEL_DEBUG("Old channel map = \"%s\"\n", ch_map); - - /* start at the beginning of the ch_map */ - x = 0; - - switch (ch_map[x]) { - /**************************************************************************/ - case 'S': - case 's': /* we have a sig link */ - timeslot->siglink = 1; - - /* check what comes next either a comma or a number */ - x++; - if (ch_map[x] == ',') { - timeslot->hole = 1; - SS7_DEVEL_DEBUG(" Found a siglink in the channel map with a hole in the cic map\n"); - } else if (isdigit(ch_map[x])) { - /* consume all digits until a comma as this is the channel */ - SS7_DEVEL_DEBUG(" Found a siglink in the channel map with out a hole in the cic map\n"); - } else { - SS7_ERROR("Found an illegal channel map character after signal link flag = \"%c\"!\n", ch_map[x]); - return FTDM_FAIL; - } - break; - /**************************************************************************/ - case 'G': - case 'g': /* we have a channel gap */ - timeslot->gap = 1; - - /* check what comes next either a comma or a number */ - x++; - if (ch_map[x] == ',') { - timeslot->hole = 1; - SS7_DEVEL_DEBUG(" Found a gap in the channel map with a hole in the cic map\n"); - } else if (isdigit(ch_map[x])) { - SS7_DEVEL_DEBUG(" Found a gap in the channel map with out a hole in the cic map\n"); - /* consume all digits until a comma as this is the channel */ - } else { - SS7_ERROR("Found an illegal channel map character after signal link flag = \"%c\"!\n", ch_map[x]); - return FTDM_FAIL; - } - break; - /**************************************************************************/ - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': /* we have a channel */ - /* consume all digits until a comma or a dash */ - SS7_DEVEL_DEBUG("Found a starting channel in the channel map\n"); - break; - /**************************************************************************/ - default: - SS7_ERROR("Found an illegal channel map character = \"%c\"!\n", ch_map[x]); - return FTDM_FAIL; - /**************************************************************************/ - } /* switch (ch_map[x]) */ - - /* grab the first number in the string */ - i = 0; - while ((ch_map[x] != '\0') && (ch_map[x] != '-') && (ch_map[x] != ',')) { - tmp[i] = ch_map[x]; - i++; - x++; - } - tmp[i] = '\0'; - timeslot->channel = atoi(tmp); - lower = timeslot->channel + 1; - - /* check the next value in the list */ - if (ch_map[x] == '-') { - /* consume the number after the dash */ - x++; - i = 0; - while ((ch_map[x] != '\0') && (ch_map[x] != '-') && (ch_map[x] != ',')) { - tmp[i] = ch_map[x]; - i++; - x++; - } - tmp[i] = '\0'; - upper = atoi(tmp); - - /* check if the upper end of the range is the same as the lower end of the range */ - if (upper == lower) { - /* the range is completed, eat the next comma or \0 and write it */ - sprintf(new_ch_map, "%d", lower); - } else if ( upper > lower) { - /* the list continues, add 1 from the channel map value and re-insert it to the list */ - sprintf(new_ch_map, "%d-%d", lower, upper); - } else { - SS7_ERROR("The upper is less then the lower end of the range...should not happen!\n"); - return FTDM_FAIL; - } - - /* the the rest of ch_map to new_ch_map */ - strncat(new_ch_map, &ch_map[x], strlen(&ch_map[x])); - - /* set the new cic map to ch_map*/ - strcpy(ch_map, new_ch_map); - - } else if (ch_map[x] == ',') { - /* move past the comma */ - x++; - - /* copy the rest of the list to new_ch_map */ - strcpy(new_ch_map, &ch_map[x]); - - /* copy the new_ch_map over the old one */ - strcpy(ch_map, new_ch_map); - - } else if (ch_map[x] == '\0') { - /* we're at the end of the string...copy the rest of the list to new_ch_map */ - strcpy(new_ch_map, &ch_map[x]); - - /* set the new cic map to ch_map*/ - strcpy(ch_map, new_ch_map); - } else { - /* nothing to do */ - } - - SS7_DEVEL_DEBUG("New channel map = \"%s\"\n", ch_map); - - return FTDM_SUCCESS; + int i; + int x; + int lower; + int upper; + char tmp[5]; /*KONRAD FIX ME*/ + char new_ch_map[MAX_CIC_LENGTH]; + + memset(&tmp[0], '\0', sizeof(tmp)); + memset(&new_ch_map[0], '\0', sizeof(new_ch_map)); + memset(timeslot, 0x0, sizeof(sng_timeslot_t)); + + SS7_DEVEL_DEBUG("Old channel map = \"%s\"\n", ch_map); + + /* start at the beginning of the ch_map */ + x = 0; + + switch (ch_map[x]) { + /**************************************************************************/ + case 'S': + case 's': /* we have a sig link */ + timeslot->siglink = 1; + + /* check what comes next either a comma or a number */ + x++; + if (ch_map[x] == ',') { + timeslot->hole = 1; + SS7_DEVEL_DEBUG(" Found a siglink in the channel map with a hole in the cic map\n"); + } else if (isdigit(ch_map[x])) { + /* consume all digits until a comma as this is the channel */ + SS7_DEVEL_DEBUG(" Found a siglink in the channel map with out a hole in the cic map\n"); + } else { + SS7_ERROR("Found an illegal channel map character after signal link flag = \"%c\"!\n", ch_map[x]); + return FTDM_FAIL; + } + break; + /**************************************************************************/ + case 'G': + case 'g': /* we have a channel gap */ + timeslot->gap = 1; + + /* check what comes next either a comma or a number */ + x++; + if (ch_map[x] == ',') { + timeslot->hole = 1; + SS7_DEVEL_DEBUG(" Found a gap in the channel map with a hole in the cic map\n"); + } else if (isdigit(ch_map[x])) { + SS7_DEVEL_DEBUG(" Found a gap in the channel map with out a hole in the cic map\n"); + /* consume all digits until a comma as this is the channel */ + } else { + SS7_ERROR("Found an illegal channel map character after signal link flag = \"%c\"!\n", ch_map[x]); + return FTDM_FAIL; + } + break; + /**************************************************************************/ + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': /* we have a channel */ + /* consume all digits until a comma or a dash */ + SS7_DEVEL_DEBUG("Found a starting channel in the channel map\n"); + break; + /**************************************************************************/ + default: + SS7_ERROR("Found an illegal channel map character = \"%c\"!\n", ch_map[x]); + return FTDM_FAIL; + /**************************************************************************/ + } /* switch (ch_map[x]) */ + + /* grab the first number in the string */ + i = 0; + while ((ch_map[x] != '\0') && (ch_map[x] != '-') && (ch_map[x] != ',')) { + tmp[i] = ch_map[x]; + i++; + x++; + } + tmp[i] = '\0'; + timeslot->channel = atoi(tmp); + lower = timeslot->channel + 1; + + /* check the next value in the list */ + if (ch_map[x] == '-') { + /* consume the number after the dash */ + x++; + i = 0; + while ((ch_map[x] != '\0') && (ch_map[x] != '-') && (ch_map[x] != ',')) { + tmp[i] = ch_map[x]; + i++; + x++; + } + tmp[i] = '\0'; + upper = atoi(tmp); + + /* check if the upper end of the range is the same as the lower end of the range */ + if (upper == lower) { + /* the range is completed, eat the next comma or \0 and write it */ + sprintf(new_ch_map, "%d", lower); + } else if ( upper > lower) { + /* the list continues, add 1 from the channel map value and re-insert it to the list */ + sprintf(new_ch_map, "%d-%d", lower, upper); + } else { + SS7_ERROR("The upper is less then the lower end of the range...should not happen!\n"); + return FTDM_FAIL; + } + + /* the the rest of ch_map to new_ch_map */ + strncat(new_ch_map, &ch_map[x], strlen(&ch_map[x])); + + /* set the new cic map to ch_map*/ + strcpy(ch_map, new_ch_map); + + } else if (ch_map[x] == ',') { + /* move past the comma */ + x++; + + /* copy the rest of the list to new_ch_map */ + strcpy(new_ch_map, &ch_map[x]); + + /* copy the new_ch_map over the old one */ + strcpy(ch_map, new_ch_map); + + } else if (ch_map[x] == '\0') { + /* we're at the end of the string...copy the rest of the list to new_ch_map */ + strcpy(new_ch_map, &ch_map[x]); + + /* set the new cic map to ch_map*/ + strcpy(ch_map, new_ch_map); + } else { + /* nothing to do */ + } + + SS7_DEVEL_DEBUG("New channel map = \"%s\"\n", ch_map); + + return FTDM_SUCCESS; } /******************************************************************************/ + +/******************************************************************************/ +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4: + */ +/******************************************************************************/ commit e8958479bb24e6a7cb35b27db2ef6853f5900e0d Author: Moises Silva <moy@sangoma.com> Date: Tue Aug 31 12:58:14 2010 -0400 sangoma: sangoma media gateway banner diff --git a/src/switch_core.c b/src/switch_core.c index 4bfc02e..7fd000a 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1539,7 +1539,7 @@ static void switch_load_core_config(const char *file) SWITCH_DECLARE(const char *) switch_core_banner(void) { - +#if 0 return ("\n" " _____ ______ _____ _____ ____ _ _ \n" " | ___| __ ___ ___/ ___\\ \\ / /_ _|_ _/ ___| | | | \n" @@ -1552,6 +1552,20 @@ SWITCH_DECLARE(const char *) switch_core_banner(void) "* FreeSWITCH (http://www.freeswitch.org) *\n" "* Paypal Donations Appreciated: paypal@freeswitch.org *\n" "* Brought to you by ClueCon http://www.cluecon.com/ *\n" "************************************************************\n" "\n"); +#else + return ( +"\n _____ ___ ___ _ _ _____ _ \n" +"/ ___| | \\/ | | (_) | __ \\ | | \n" +"\\ `--. __ _ _ __ __ _ ___ _ __ ___ __ _ | . . | ___ __| |_ __ _ | | \\/ __ _| |_ _____ ____ _ _ _ \n" +" `--. \\/ _` | '_ \\ / _` |/ _ \\| '_ ` _ \\ / _` | | |\\/| |/ _ \\/ _` | |/ _` | | | __ / _` | __|/ _ \\ \\ /\\ / / _` | | | |\n" +"/\\__/ / (_| | | | | (_| | (_) | | | | | | (_| | | | | | __/ (_| | | (_| | | |_\\ \\ (_| | |_| __/\\ V V / (_| | |_| |\n" +"\\____/ \\__,_|_| |_|\\__, |\\___/|_| |_| |_|\\__,_| \\_| |_/\\___|\\__,_|_|\\__,_| \\____/\\__,_|\\__|\\___| \\_/\\_/ \\__,_|\\__, |\n" +" __/ | __/ |\n" +" |___/ |___/ \n" + "************************************************************\n" + "* Powered by: FreeSWITCH (http://www.freeswitch.org) *\n" + "************************************************************\n" "\n"); +#endif } commit 161da3306a6e7a65f947a1b356621ee4ca37bd20 Author: Moises Silva <moy@sangoma.com> Date: Tue Aug 31 12:54:54 2010 -0400 sangoma: sofia contact replace diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 5830822..df88106 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3300,6 +3300,7 @@ SWITCH_STANDARD_API(sofia_contact_function) char *p; sofia_profile_t *profile = NULL; const char *exclude_contact = NULL; + const char *user_replacement = NULL; char *reply = "error/facility_not_subscribed"; if (!cmd) { @@ -3310,6 +3311,7 @@ SWITCH_STANDARD_API(sofia_contact_function) if (session) { switch_channel_t *channel = switch_core_session_get_channel(session); exclude_contact = switch_channel_get_variable(channel, "sip_exclude_contact"); + user_replacement = switch_channel_get_variable(channel, "sip_contact_user_replacement"); } @@ -3388,6 +3390,93 @@ SWITCH_STANDARD_API(sofia_contact_function) reply = "error/user_not_registered"; } + if (user_replacement) { + int urlcount = 0; + int copyerr = 0; + char *newreply = NULL; + char *urlstart = NULL; + char *newptr = NULL; + char *bufend = NULL; + char *str = reply; + switch_size_t copysize = 0; + switch_size_t replacesize = strlen(user_replacement); + switch_size_t allocsize = 0; + + /* first pass to count how many URLs we have */ + while ((urlstart = strcasestr(str, "sip:")) || (urlstart = strcasestr(str, "sips:"))) { + urlcount++; + str = urlstart + 4; + } + + if (!urlcount) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "sofia_contact(): no sip URLs found to replace the user\n"); + copyerr++; + goto copydone; + } + + /* this allocates a bit more than needed but better safe than sorry doing more funky math */ + allocsize = strlen(reply) + (urlcount * replacesize); + newreply = switch_core_session_alloc(session, allocsize); + if (!newreply) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "sofia_contact(): no buffer space available for replacement\n"); + copyerr++; + goto copydone; + } + + /* get a working pointer to the new reply */ + newptr = newreply; + + /* pointer to the end of the allocated buffer for safety checks */ + bufend = newreply + allocsize - 1; + *bufend = 0; + + /* go thru all the urls and replace the user part */ + str = reply; + while ((urlstart = strcasestr(str, "sip:")) || (urlstart = strcasestr(str, "sips:"))) { + + /* found an URL, copy up to the start of the url */ + copysize = ( urlstart - str ) + 4; + + /* double check boundaries before copying anything at all (this should not happen) */ + if ((newptr + copysize + replacesize) >= bufend) { + copyerr++; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "sofia_contact(): wow buffer was not big enough!\n"); + break; + } + + /* copy the original contact string except for the user */ + memcpy(newptr, str, copysize); + newptr += copysize; + + /* copy the user replacement */ + memcpy(newptr, user_replacement, replacesize); + newptr += replacesize; + + /* skip the original user part */ + str = strchr(urlstart, '@'); + if (!str) { + copyerr++; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "sofia_contact(): not host part found for contact\n"); + break; + } + /* continue searching for the next sip: URL */ + } + +copydone: + if (!copyerr) { + /* copy the remaining reply string */ + copysize = strlen(str); + if ((newptr + copysize) >= bufend) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "sofia_contact(): wow buffer was not big enough, close, but not enough!\n"); + } else { + strcpy(newptr, str); + reply = newreply; + } + } else { + reply = "error/replacement error"; + } + } + stream->write_function(stream, "%s", reply); reply = NULL; commit 3e2056833b71af27bd6bdfbe1ab39b36af497cb6 Author: Jeff Lenk <jeff@jefflenk.com> Date: Tue Aug 31 09:53:22 2010 -0500 add windows x64 build support for mod_skinny diff --git a/Freeswitch.2008.sln b/Freeswitch.2008.sln index 84baeda..d87a7ec 100644 --- a/Freeswitch.2008.sln +++ b/Freeswitch.2008.sln @@ -2423,9 +2423,9 @@ Global {CC1DD008-9406-448D-A0AD-33C3186CFADB}.All|Win32.ActiveCfg = Release|Win32 {CC1DD008-9406-448D-A0AD-33C3186CFADB}.All|x64.ActiveCfg = Release|Win32 {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Debug|Win32.ActiveCfg = Debug|Win32 - {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Debug|x64.ActiveCfg = Debug|Win32 + {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Debug|x64.ActiveCfg = Debug|x64 {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Release|Win32.ActiveCfg = Release|Win32 - {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Release|x64.ActiveCfg = Release|Win32 + {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Release|x64.ActiveCfg = Release|x64 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.ActiveCfg = All|Win32 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.Build.0 = All|Win32 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|x64.ActiveCfg = All|Win32 diff --git a/Freeswitch.2010.sln b/Freeswitch.2010.sln index ef36624..7e0733c 100644 --- a/Freeswitch.2010.sln +++ b/Freeswitch.2010.sln @@ -1964,9 +1964,9 @@ Global {CC1DD008-9406-448D-A0AD-33C3186CFADB}.All|Win32.ActiveCfg = Release|Win32 {CC1DD008-9406-448D-A0AD-33C3186CFADB}.All|x64.ActiveCfg = Release|Win32 {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Debug|Win32.ActiveCfg = Debug|Win32 - {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Debug|x64.ActiveCfg = Debug|Win32 + {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Debug|x64.ActiveCfg = Debug|x64 {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Release|Win32.ActiveCfg = Release|Win32 - {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Release|x64.ActiveCfg = Release|Win32 + {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Release|x64.ActiveCfg = Release|x64 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.ActiveCfg = All|Win32 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|Win32.Build.0 = All|Win32 {DEE932AB-5911-4700-9EEB-8C7090A0A330}.All|x64.ActiveCfg = All|Win32 diff --git a/src/mod/endpoints/mod_skinny/mod_skinny_2008.vcproj b/src/mod/endpoints/mod_skinny/mod_skinny_2008.vcproj index b64a431..f052ce0 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny_2008.vcproj +++ b/src/mod/endpoints/mod_skinny/mod_skinny_2008.vcproj @@ -12,6 +12,9 @@ <Platform Name="Win32" /> + <Platform + Name="x64" + /> </Platforms> <ToolFiles> </ToolFiles> @@ -148,6 +151,146 @@ Name="VCPostBuildEventTool" /> </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="2" + InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories="" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS" + UsePrecompiledHeader="0" + DisableSpecificWarnings="4100;4101" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalOptions="/NODEFAULTLIB:LIMBCTD" + LinkIncremental="2" + AdditionalLibraryDirectories="" + RandomizedBaseAddress="1" + DataExecutionPrevention="0" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="2" + InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories="" + PreprocessorDefinitions="" + UsePrecompiledHeader="0" + DisableSpecificWarnings="4100;4101" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalLibraryDirectories="" + RandomizedBaseAddress="1" + DataExecutionPrevention="0" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> </Configurations> <References> </References> diff --git a/src/mod/endpoints/mod_skinny/mod_skinny_2010.vcxproj b/src/mod/endpoints/mod_skinny/mod_skinny_2010.vcxproj index b1fba99..051d40d 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny_2010.vcxproj +++ b/src/mod/endpoints/mod_skinny/mod_skinny_2010.vcxproj @@ -5,10 +5,18 @@ <Configuration>Debug</Configuration> <Platform>Win32</Platform> </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> <ProjectConfiguration Include="Release|Win32"> <Configuration>Release</Configuration> <Platform>Win32</Platform> </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> </ItemGroup> <PropertyGroup Label="Globals"> <ProjectName>mod_skinny</ProjectName> @@ -21,10 +29,18 @@ <ConfigurationType>DynamicLibrary</ConfigurationType> <CharacterSet>MultiByte</CharacterSet> </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <ConfigurationType>DynamicLibrary</ConfigurationType> <CharacterSet>MultiByte</CharacterSet> </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <ImportGroup Label="ExtensionSettings"> </ImportGroup> @@ -32,14 +48,23 @@ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="..\..\..\..\w32\module_release.props" /> </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\..\w32\module_release.props" /> + </ImportGroup> <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> <Import Project="..\..\..\..\w32\module_debug.props" /> </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\..\w32\module_debug.props" /> + </ImportGroup> <PropertyGroup Label="UserMacros" /> <PropertyGroup> <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> @@ -57,6 +82,22 @@ </DataExecutionPrevention> </Link> </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PrecompiledHeader> + </PrecompiledHeader> + <DisableSpecificWarnings>4100;4101;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <AdditionalOptions>/NODEFAULTLIB:LIMBCTD %(AdditionalOptions)</AdditionalOptions> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + </Link> + </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ClCompile> <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> @@ -74,6 +115,23 @@ </OutputFile> </Link> </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PrecompiledHeader> + </PrecompiledHeader> + <DisableSpecificWarnings>4100;4101;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <OutputFile> + </OutputFile> + </Link> + </ItemDefinitionGroup> <ItemGroup> <ClCompile Include="mod_skinny.c" /> <ClCompile Include="skinny_api.c" /> commit ce352bccc573589d3b92042014931e17efa5ff48 Author: Mathieu Parent <math.parent@gmail.com> Date: Tue Aug 31 08:39:50 2010 +0200 Skinny: stop media on early media hangup (ring-out) diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index 3f48d66..9ee9e1e 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -788,7 +788,7 @@ int channel_on_hangup_callback(void *pArg, int argc, char **argv, char **columnN default: send_display_prompt_status(listener, 0, switch_channel_cause2str(helper->cause), line_instance, call_id); } - if((call_state == SKINNY_PROCEED) || (call_state == SKINNY_CONNECTED)) { /* calling parties */ + if((call_state == SKINNY_PROCEED) || (call_state == SKINNY_RING_OUT) || (call_state == SKINNY_CONNECTED)) { /* calling parties */ skinny_session_stop_media(helper->tech_pvt->session, listener, line_instance); } commit 70331e88bdf782c5374f61cb1f121fcd6c924cb4 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Aug 30 17:33:05 2010 -0500 when getting presence with no payload consider it an extension to the expires time in the dialog diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 82e975c..39b495d 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -2467,6 +2467,10 @@ void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, n from_host = (char *) from->a_url->url_host; } + + exp_delta = (sip->sip_expires ? sip->sip_expires->ex_delta : 3600); + exp = (long) switch_epoch_time_now(NULL) + exp_delta; + if (payload) { switch_xml_t xml, note, person, tuple, status, basic, act; switch_event_t *event; @@ -2499,9 +2503,6 @@ void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, n } } - exp_delta = (sip->sip_expires ? sip->sip_expires->ex_delta : 3600); - exp = (long) switch_epoch_time_now(NULL) + exp_delta; - if ((sql = switch_mprintf("delete from sip_presence where sip_user='%q' and sip_host='%q' " @@ -2542,6 +2543,10 @@ void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, n switch_xml_free(xml); } + } else { + char *sql = switch_mprintf("update sip_presence set expires=%ld where sip_user='%q' and sip_host='%q' and profile_name='%q' and hostname='%q'", + exp, from_user, from_host, profile->name, mod_sofia_globals.hostname); + sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); } switch_safe_free(pd_dup); commit 96525d4f63a0f5bb2b7e7f9e70469d86fe401406 Author: Brian West <brian@freeswitch.org> Date: Mon Aug 30 12:48:45 2010 -0500 swigall diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index d465083..1b13352 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -6805,19 +6805,21 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_request_xml(void * jarg } -SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_request_uuid(void * jarg1, int jarg2, void * jarg3, char * jarg4) { +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_request_uuid(void * jarg1, int jarg2, unsigned long jarg3, void * jarg4, char * jarg5) { void * jresult ; switch_endpoint_interface_t *arg1 = (switch_endpoint_interface_t *) 0 ; switch_call_direction_t arg2 ; - switch_memory_pool_t **arg3 = (switch_memory_pool_t **) 0 ; - char *arg4 = (char *) 0 ; + switch_originate_flag_t arg3 ; + switch_memory_pool_t **arg4 = (switch_memory_pool_t **) 0 ; + char *arg5 = (char *) 0 ; switch_core_session_t *result = 0 ; arg1 = (switch_endpoint_interface_t *)jarg1; arg2 = (switch_call_direction_t)jarg2; - arg3 = (switch_memory_pool_t **)jarg3; - arg4 = (char *)jarg4; - result = (switch_core_session_t *)switch_core_session_request_uuid(arg1,arg2,arg3,(char const *)arg4); + arg3 = (switch_originate_flag_t)jarg3; + arg4 = (switch_memory_pool_t **)jarg4; + arg5 = (char *)jarg5; + result = (switch_core_session_t *)switch_core_session_request_uuid(arg1,arg2,arg3,arg4,(char const *)arg5); jresult = (void *)result; return jresult; } diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index 41f224c..3085937 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -1201,8 +1201,8 @@ public class freeswitch { return ret; } - public static SWIGTYPE_p_switch_core_session switch_core_session_request_uuid(switch_endpoint_interface endpoint_interface, switch_call_direction_t direction, SWIGTYPE_p_p_apr_pool_t pool, string use_uuid) { - IntPtr cPtr = freeswitchPINVOKE.switch_core_session_request_uuid(switch_endpoint_interface.getCPtr(endpoint_interface), (int)direction, SWIGTYPE_p_p_apr_pool_t.getCPtr(pool), use_uuid); + public static SWIGTYPE_p_switch_core_session switch_core_session_request_uuid(switch_endpoint_interface endpoint_interface, switch_call_direction_t direction, uint originate_flags, SWIGTYPE_p_p_apr_pool_t pool, string use_uuid) { + IntPtr cPtr = freeswitchPINVOKE.switch_core_session_request_uuid(switch_endpoint_interface.getCPtr(endpoint_interface), (int)direction, originate_flags, SWIGTYPE_p_p_apr_pool_t.getCPtr(pool), use_uuid); SWIGTYPE_p_switch_core_session ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false); return ret; } @@ -6875,7 +6875,7 @@ class freeswitchPINVOKE { public static extern IntPtr switch_core_session_request_xml(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3); [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_request_uuid")] - public static extern IntPtr switch_core_session_request_uuid(HandleRef jarg1, int jarg2, HandleRef jarg3, string jarg4); + public static extern IntPtr switch_core_session_request_uuid(HandleRef jarg1, int jarg2, uint jarg3, HandleRef jarg4, string jarg5); [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_uuid")] public static extern int switch_core_session_set_uuid(HandleRef jarg1, string jarg2); @@ -26517,7 +26517,8 @@ namespace FreeSWITCH.Native { SOF_NOBLOCK = (1 << 0), SOF_FORKED_DIAL = (1 << 1), SOF_NO_EFFECTIVE_CID_NUM = (1 << 2), - SOF_NO_EFFECTIVE_CID_NAME = (1 << 3) + SOF_NO_EFFECTIVE_CID_NAME = (1 << 3), + SOF_NO_LIMITS = (1 << 4) } } commit 2ea5e1cd8911805d226ad5c245899e4cac4a0528 Author: Moises Silva <moy@sangoma.com> Date: Mon Aug 30 12:09:10 2010 -0400 freetdm: test log merge diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 766ac75..871d345 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -3520,7 +3520,7 @@ static ftdm_status_t ftdm_set_channels_gains(ftdm_span_t *span, int currindex, f unsigned chan_index = 0; if (!span->chan_count) { - ftdm_log(FTDM_LOG_ERROR, "Failed to set gains because span %s has no channels\n", span->name); + ftdm_log(FTDM_LOG_ERROR, "Failed to set channel gains because span %s has no channels\n", span->name); return FTDM_FAIL; } commit 9099e3b85ec2a7a31ca413fa2091903fa345c667 Author: Moises Silva <moy@sangoma.com> Date: Mon Aug 30 11:51:14 2010 -0400 freetdm: fix log msg diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index e0447cd..766ac75 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -3520,7 +3520,7 @@ static ftdm_status_t ftdm_set_channels_gains(ftdm_span_t *span, int currindex, f unsigned chan_index = 0; if (!span->chan_count) { - ftdm_log(FTDM_LOG_ERROR, "%d:Failed to set gains because span has no channels\n"); + ftdm_log(FTDM_LOG_ERROR, "Failed to set gains because span %s has no channels\n", span->name); return FTDM_FAIL; } commit 99b3d675bb475055b7802f85344a2265282c960a Author: Mathieu Rene <mrene@avgs.ca> Date: Mon Aug 30 10:56:11 2010 -0400 really? don't scrap my php config diff --git a/libs/esl/php/Makefile b/libs/esl/php/Makefile index 3095ea2..44fdd22 100644 --- a/libs/esl/php/Makefile +++ b/libs/esl/php/Makefile @@ -27,4 +27,4 @@ reswig: swigclean esl_wrap.cpp install: ESL.so cp ESL.so $(shell php-config --extension-dir) cp ESL.php $(shell php -r 'echo ini_get("include_path");' | cut -d: -f2) - echo 'extension=ESL.so' > $(shell php-config --configure-options | tr " " "\n" | grep -- --with-config-file-scan-dir | cut -f2 -d=)/esl.ini + echo 'extension=ESL.so' >> $(shell php-config --configure-options | tr " " "\n" | grep -- --with-config-file-scan-dir | cut -f2 -d=)/esl.ini commit 53561eaa9a3113f9ccfc11f6826130cfd9131b33 Author: Mathieu Parent <math.parent@gmail.com> Date: Mon Aug 30 08:37:35 2010 +0200 debian/freeswitch.init: don't start fresswitch before network diff --git a/debian/freeswitch.init b/debian/freeswitch.init index d821c09..36129cb 100755 --- a/debian/freeswitch.init +++ b/debian/freeswitch.init @@ -1,8 +1,8 @@ #! /bin/sh ### BEGIN INIT INFO # Provides: freeswitch -# Required-Start: $local_fs $remote_fs -# Required-Stop: $local_fs $remote_fs +# Required-Start: $network $local_fs $remote_fs +# Required-Stop: $network $local_fs $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: The FreeSwitch Voice Switching System commit 68d74c31c38e2b274235d38d3277c50b96a535f2 Author: Jeff Lenk <jeff@jefflenk.com> Date: Sun Aug 29 19:44:08 2010 -0500 MODAPP-444 diff --git a/src/mod/say/mod_say_ru/mod_say_ru.c b/src/mod/say/mod_say_ru/mod_say_ru.c index 7c260f9..9b9fcda 100644 --- a/src/mod/say/mod_say_ru/mod_say_ru.c +++ b/src/mod/say/mod_say_ru/mod_say_ru.c @@ -500,7 +500,7 @@ static switch_status_t ru_say_time(switch_core_session_t *session, char *tosay, say_file("time/at.wav"); } if (say_time) { - switch_snprintf(buf, sizeof(buf), "%d:%d:%d", tm.tm_hour + 1, tm.tm_min, tm.tm_sec); + switch_snprintf(buf, sizeof(buf), "%d:%d:%d", tm.tm_hour, tm.tm_min, tm.tm_sec); say_args->type = SST_TIME_MEASUREMENT; ru_say_time(session, buf, say_args, args); } commit 72e5a7068ccbd4ed5036926e3125e9ab07253d8b Author: Jeff Lenk <jeff@jefflenk.com> Date: Sun Aug 29 15:45:41 2010 -0500 add mod_h323 to 2010 solution for VS- not built by default diff --git a/Freeswitch.2008.sln b/Freeswitch.2008.sln index 8ab06f2..84baeda 100644 --- a/Freeswitch.2008.sln +++ b/Freeswitch.2008.sln @@ -2417,7 +2417,7 @@ Global {05C9FB27-480E-4D53-B3B7-7338E2514666}.All|Win32.Build.0 = Release|Win32 {05C9FB27-480E-4D53-B3B7-7338E2514666}.All|x64.ActiveCfg = Release|Win32 {05C9FB27-480E-4D53-B3B7-7338E2514666}.Debug|Win32.ActiveCfg = Debug|Win32 - {05C9FB27-480E-4D53-B3B7-7338E2514666}.Debug|x64.ActiveCfg = Debug|Win32 + {05C9FB27-480E-4D53-B3B7-7338E2514666}.Debug|x64.ActiveCfg = Debug|x64 {05C9FB27-480E-4D53-B3B7-7338E2514666}.Release|Win32.ActiveCfg = Release|Win32 {05C9FB27-480E-4D53-B3B7-7338E2514666}.Release|x64.ActiveCfg = Release|Win32 {CC1DD008-9406-448D-A0AD-33C3186CFADB}.All|Win32.ActiveCfg = Release|Win32 diff --git a/Freeswitch.2010.sln b/Freeswitch.2010.sln index 8eaa2fb..ef36624 100644 --- a/Freeswitch.2010.sln +++ b/Freeswitch.2010.sln @@ -701,6 +701,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsofia_sip_ua_static", "l EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_directory", "src\mod\applications\mod_directory\mod_directory.2010.vcxproj", "{B889A18E-70A7-44B5-B2C9-47798D4F43B3}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_h323", "src\mod\endpoints\mod_h323\mod_h323.2010.vcxproj", "{05C9FB27-480E-4D53-B3B7-7338E2514666}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -2415,6 +2417,13 @@ Global {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.Debug|x64.ActiveCfg = Debug|x64 {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.Release|Win32.ActiveCfg = Release|Win32 {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.Release|x64.ActiveCfg = Release|x64 + {05C9FB27-480E-4D53-B3B7-7338E2514666}.All|Win32.ActiveCfg = Release|Win32 + {05C9FB27-480E-4D53-B3B7-7338E2514666}.All|Win32.Build.0 = Release|Win32 + {05C9FB27-480E-4D53-B3B7-7338E2514666}.All|x64.ActiveCfg = Release|Win32 + {05C9FB27-480E-4D53-B3B7-7338E2514666}.Debug|Win32.ActiveCfg = Debug|Win32 + {05C9FB27-480E-4D53-B3B7-7338E2514666}.Debug|x64.ActiveCfg = Debug|x64 + {05C9FB27-480E-4D53-B3B7-7338E2514666}.Release|Win32.ActiveCfg = Release|Win32 + {05C9FB27-480E-4D53-B3B7-7338E2514666}.Release|x64.ActiveCfg = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2437,6 +2446,7 @@ Global {05C9FB27-480E-4D53-B3B7-6338E2526666} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} {CC1DD008-9406-448D-A0AD-33C3186CFADB} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} {C6E78A4C-DB1E-47F4-9B63-4DC27D86343F} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} + {05C9FB27-480E-4D53-B3B7-7338E2514666} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C} {30A5B29C-983E-4580-9FD0-D647CCDCC7EB} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {C24FB505-05D7-4319-8485-7540B44C8603} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} diff --git a/src/mod/endpoints/mod_h323/mod_h323.2010.vcxproj b/src/mod/endpoints/mod_h323/mod_h323.2010.vcxproj new file mode 100644 index 0000000..cb33edf --- /dev/null +++ b/src/mod/endpoints/mod_h323/mod_h323.2010.vcxproj @@ -0,0 +1,151 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>mod_h323</ProjectName> + <ProjectGuid>{05C9FB27-480E-4D53-B3B7-7338E2514666}</ProjectGuid> + <RootNamespace>mod_h323</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\..\w32\module_release.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\..\w32\module_release.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\..\w32\module_debug.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\..\w32\module_debug.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;ALLOW_SMP_DANGERS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PrecompiledHeader> + </PrecompiledHeader> + <DisableSpecificWarnings>4100;4101;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <AdditionalOptions>/NODEFAULTLIB:LIMBCTD %(AdditionalOptions)</AdditionalOptions> + <AdditionalDependencies>h323plusd.lib;ptlibsd.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;ALLOW_SMP_DANGERS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PrecompiledHeader> + </PrecompiledHeader> + <DisableSpecificWarnings>4100;4101;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <AdditionalOptions>/NODEFAULTLIB:LIMBCTD %(AdditionalOptions)</AdditionalOptions> + <AdditionalDependencies>h323plusd.lib;ptlibsd.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_WINDOWS;_USRDLL;MOD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PrecompiledHeader> + </PrecompiledHeader> + <DisableSpecificWarnings>4100;4101;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <AdditionalDependencies>h323plus.lib;ptlibs.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>false</GenerateDebugInformation> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_WINDOWS;_USRDLL;MOD_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <PrecompiledHeader> + </PrecompiledHeader> + <DisableSpecificWarnings>4100;4101;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <AdditionalDependencies>h323plus.lib;ptlibs.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>false</GenerateDebugInformation> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="mod_h323.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="mod_h323.h" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\..\w32\Library\FreeSwitchCore.2010.vcxproj"> + <Project>{202d7a4e-760d-4d0e-afa1-d7459ced30ff}</Project> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/src/mod/endpoints/mod_h323/mod_h323_2008.vcproj b/src/mod/endpoints/mod_h323/mod_h323_2008.vcproj index 8246d73..6c12406 100644 --- a/src/mod/endpoints/mod_h323/mod_h323_2008.vcproj +++ b/src/mod/endpoints/mod_h323/mod_h323_2008.vcproj @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="Windows-1252"?> <VisualStudioProject ProjectType="Visual C++" - Version="9,00" + Version="9.00" Name="mod_h323" ProjectGUID="{05C9FB27-480E-4D53-B3B7-7338E2514666}" RootNamespace="mod_h323" @@ -12,6 +12,9 @@ <Platform Name="Win32" /> + <Platform + Name="x64" + /> </Platforms> <ToolFiles> </ToolFiles> @@ -151,6 +154,149 @@ Name="VCPostBuildEventTool" /> </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="2" + InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories="" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS;ALLOW_SMP_DANGERS" + UsePrecompiledHeader="0" + DisableSpecificWarnings="4100;4101" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalOptions="/NODEFAULTLIB:LIMBCTD" + AdditionalDependencies="h323plusd.lib ptlibsd.lib" + LinkIncremental="2" + AdditionalLibraryDirectories="" + RandomizedBaseAddress="1" + DataExecutionPrevention="0" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="2" + InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories="" + PreprocessorDefinitions="WIN32;_WINDOWS;_USRDLL;MOD_EXPORTS" + UsePrecompiledHeader="0" + DisableSpecificWarnings="4100;4101" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="h323plus.lib ptlibs.lib" + AdditionalLibraryDirectories="" + GenerateDebugInformation="false" + RandomizedBaseAddress="1" + DataExecutionPrevention="0" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> </Configurations> <References> </References> commit 67edfdcb376197ce6bee8d52764e63cfeab904de Author: Jeff Lenk <jeff@jefflenk.com> Date: Sun Aug 29 11:56:52 2010 -0600 add mod_directory to express solutions for VS- not built by default diff --git a/Freeswitch.2008.express.sln b/Freeswitch.2008.express.sln index a0d2121..672406b 100644 --- a/Freeswitch.2008.express.sln +++ b/Freeswitch.2008.express.sln @@ -658,6 +658,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openssl", "libs\win32\opens {B4B62169-5AD4-4559-8707-3D933AC5DB39} = {B4B62169-5AD4-4559-8707-3D933AC5DB39} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_directory", "src\mod\applications\mod_directory\mod_directory.2008.vcproj", "{42E721FD-43D6-4B04-A34B-42567199FFB8}" + ProjectSection(ProjectDependencies) = postProject + {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -2122,6 +2127,13 @@ Global {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|Win32.ActiveCfg = Release|Win32 {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|Win32.Build.0 = Release|Win32 {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|x64.ActiveCfg = Release|Win32 + {42E721FD-43D6-4B04-A34B-42567199FFB8}.All|Win32.ActiveCfg = Release|Win32 + {42E721FD-43D6-4B04-A34B-42567199FFB8}.All|Win32.Build.0 = Release|Win32 + {42E721FD-43D6-4B04-A34B-42567199FFB8}.All|x64.ActiveCfg = Release|Win32 + {42E721FD-43D6-4B04-A34B-42567199FFB8}.Debug|Win32.ActiveCfg = Debug|Win32 + {42E721FD-43D6-4B04-A34B-42567199FFB8}.Debug|x64.ActiveCfg = Debug|Win32 + {42E721FD-43D6-4B04-A34B-42567199FFB8}.Release|Win32.ActiveCfg = Release|Win32 + {42E721FD-43D6-4B04-A34B-42567199FFB8}.Release|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Freeswitch.2010.express.sln b/Freeswitch.2010.express.sln index e9bf633..e999721 100644 --- a/Freeswitch.2010.express.sln +++ b/Freeswitch.2010.express.sln @@ -315,6 +315,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ssleay32", "libs\win32\open EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openssl", "libs\win32\openssl\openssl.2010.vcxproj", "{25BD39B1-C8BF-4676-A738-9CABD9C6BC79}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_directory", "src\mod\applications\mod_directory\mod_directory.2010.vcxproj", "{B889A18E-70A7-44B5-B2C9-47798D4F43B3}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -1981,6 +1983,13 @@ Global {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|Win32.ActiveCfg = Release|Win32 {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|Win32.Build.0 = Release|Win32 {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|x64.ActiveCfg = Release|Win32 + {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.All|Win32.ActiveCfg = Release|Win32 + {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.All|Win32.Build.0 = Release|Win32 + {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.All|x64.ActiveCfg = Release|Win32 + {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.Debug|Win32.ActiveCfg = Debug|Win32 + {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.Debug|x64.ActiveCfg = Debug|Win32 + {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.Release|Win32.ActiveCfg = Release|Win32 + {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.Release|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE commit 99ff200dbf0642e9084fa0b10dae711f2f890876 Author: Jeff Lenk <jeff@jefflenk.com> Date: Sun Aug 29 12:26:30 2010 -0500 add mod_directory to pro solutions for VS- not built by default diff --git a/Freeswitch.2008.sln b/Freeswitch.2008.sln index 9cc8ea9..8ab06f2 100644 --- a/Freeswitch.2008.sln +++ b/Freeswitch.2008.sln @@ -1132,6 +1132,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openssl", "libs\win32\opens {B4B62169-5AD4-4559-8707-3D933AC5DB39} = {B4B62169-5AD4-4559-8707-3D933AC5DB39} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_directory", "src\mod\applications\mod_directory\mod_directory.2008.vcproj", "{42E721FD-43D6-4B04-A34B-42567199FFB8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -2856,6 +2858,13 @@ Global {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|Win32.Build.0 = Release|Win32 {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|x64.ActiveCfg = Release|x64 {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|x64.Build.0 = Release|x64 + {42E721FD-43D6-4B04-A34B-42567199FFB8}.All|Win32.ActiveCfg = Release|x64 + {42E721FD-43D6-4B04-A34B-42567199FFB8}.All|x64.ActiveCfg = Release|x64 + {42E721FD-43D6-4B04-A34B-42567199FFB8}.All|x64.Build.0 = Release|x64 + {42E721FD-43D6-4B04-A34B-42567199FFB8}.Debug|Win32.ActiveCfg = Debug|Win32 + {42E721FD-43D6-4B04-A34B-42567199FFB8}.Debug|x64.ActiveCfg = Debug|x64 + {42E721FD-43D6-4B04-A34B-42567199FFB8}.Release|Win32.ActiveCfg = Release|Win32 + {42E721FD-43D6-4B04-A34B-42567199FFB8}.Release|x64.ActiveCfg = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2901,6 +2910,7 @@ Global {990BAA76-89D3-4E38-8479-C7B28784EFC8} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {1E21AFE0-6FDB-41D2-942D-863607C24B91} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {2E250296-0C08-4342-9C8A-BCBDD0E7DF65} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} + {42E721FD-43D6-4B04-A34B-42567199FFB8} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {07113B25-D3AF-4E04-BA77-4CD1171F022C} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4} {A27CCA23-1541-4337-81A4-F0A6413078A0} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4} {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4} diff --git a/Freeswitch.2010.sln b/Freeswitch.2010.sln index e6b1335..8eaa2fb 100644 --- a/Freeswitch.2010.sln +++ b/Freeswitch.2010.sln @@ -699,6 +699,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download OPENSSL", "libs\wi EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsofia_sip_ua_static", "libs\win32\sofia\libsofia_sip_ua_static.2010.vcxproj", "{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_directory", "src\mod\applications\mod_directory\mod_directory.2010.vcxproj", "{B889A18E-70A7-44B5-B2C9-47798D4F43B3}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -2406,6 +2408,13 @@ Global {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|Win32.Build.0 = Release|Win32 {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|x64.ActiveCfg = Release|x64 {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|x64.Build.0 = Release|x64 + {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.All|Win32.ActiveCfg = Release|x64 + {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.All|x64.ActiveCfg = Release|x64 + {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.All|x64.Build.0 = Release|x64 + {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.Debug|Win32.ActiveCfg = Debug|Win32 + {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.Debug|x64.ActiveCfg = Debug|x64 + {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.Release|Win32.ActiveCfg = Release|Win32 + {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.Release|x64.ActiveCfg = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2450,6 +2459,7 @@ Global {990BAA76-89D3-4E38-8479-C7B28784EFC8} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {1E21AFE0-6FDB-41D2-942D-863607C24B91} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {2E250296-0C08-4342-9C8A-BCBDD0E7DF65} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} + {B889A18E-70A7-44B5-B2C9-47798D4F43B3} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {07113B25-D3AF-4E04-BA77-4CD1171F022C} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4} {A27CCA23-1541-4337-81A4-F0A6413078A0} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4} {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4} diff --git a/src/mod/applications/mod_directory/mod_directory.2008.vcproj b/src/mod/applications/mod_directory/mod_directory.2008.vcproj index a5e2d4b..ba86eb3 100644 --- a/src/mod/applications/mod_directory/mod_directory.2008.vcproj +++ b/src/mod/applications/mod_directory/mod_directory.2008.vcproj @@ -3,7 +3,7 @@ ProjectType="Visual C++" Version="9.00" Name="mod_directory" - ProjectGUID="{11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}" + ProjectGUID="{42E721FD-43D6-4B04-A34B-42567199FFB8}" RootNamespace="mod_directory" Keyword="Win32Proj" TargetFrameworkVersion="131072" diff --git a/src/mod/applications/mod_directory/mod_directory.2010.vcxproj b/src/mod/applications/mod_directory/mod_directory.2010.vcxproj new file mode 100644 index 0000000..2becc00 --- /dev/null +++ b/src/mod/applications/mod_directory/mod_directory.2010.vcxproj @@ -0,0 +1,130 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>mod_directory</ProjectName> + <ProjectGuid>{B889A18E-70A7-44B5-B2C9-47798D4F43B3}</ProjectGuid> + <RootNamespace>mod_directory</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\..\w32\module_release.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\..\w32\module_debug.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\..\w32\module_release.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\..\w32\module_debug.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + </ClCompile> + <Link> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + </ClCompile> + <Link> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + </ClCompile> + <Link> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + </ClCompile> + <Link> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <DataExecutionPrevention> + </DataExecutionPrevention> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="mod_directory.c" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\..\w32\Library\FreeSwitchCore.2010.vcxproj"> + <Project>{202d7a4e-760d-4d0e-afa1-d7459ced30ff}</Project> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file commit 08d6b4339ce8eb5dcf9504e78a22a022fb1ecddc Author: Andrew Thompson <andrew@hijacked.us> Date: Sun Aug 29 10:59:10 2010 -0400 Fix hostname guessing to work when some stupid DNS server resolves 0.0.0.0 Also, fix names containing a @ to work right diff --git a/src/mod/event_handlers/mod_erlang_event/ei_helpers.c b/src/mod/event_handlers/mod_erlang_event/ei_helpers.c index 45b6553..9935aff 100644 --- a/src/mod/event_handlers/mod_erlang_event/ei_helpers.c +++ b/src/mod/event_handlers/mod_erlang_event/ei_helpers.c @@ -327,6 +327,8 @@ switch_status_t initialise_ei(struct ei_cnode_s *ec) struct hostent *nodehost; char thishostname[EI_MAXHOSTNAMELEN + 1] = ""; char thisnodename[MAXNODELEN + 1]; + char thisalivename[MAXNODELEN + 1]; + char *atsign; /* zero out the struct before we use it */ memset(&server_addr, 0, sizeof(server_addr)); @@ -345,18 +347,23 @@ switch_status_t initialise_ei(struct ei_cnode_s *ec) server_addr.sin_family = AF_INET; server_addr.sin_port = htons(prefs.port); - if (strchr(prefs.nodename, '@')) { + /* copy the prefs.nodename into something we can modify */ + strncpy(thisalivename, prefs.nodename, MAXNODELEN); + + if ((atsign = strchr(thisalivename, '@'))) { /* we got a qualified node name, don't guess the host/domain */ snprintf(thisnodename, MAXNODELEN + 1, "%s", prefs.nodename); + /* truncate the alivename at the @ */ + *atsign = '\0'; } else { #ifdef WIN32 if ((nodehost = gethostbyaddr((const char *) &server_addr.sin_addr.s_addr, sizeof(server_addr.sin_addr.s_addr), AF_INET))) #else - if ((nodehost = gethostbyaddr((const char *) &server_addr.sin_addr.s_addr, sizeof(server_addr.sin_addr.s_addr), AF_INET))) + if ((nodehost = gethostbyaddr((const char *) &server_addr.sin_addr.s_addr, sizeof(server_addr.sin_addr.s_addr), AF_INET))) #endif - memcpy(thishostname, nodehost->h_name, EI_MAXHOSTNAMELEN); + memcpy(thishostname, nodehost->h_name, EI_MAXHOSTNAMELEN); - if (zstr_buf(thishostname)) { + if (zstr_buf(thishostname) || !strncasecmp(prefs.ip, "0.0.0.0", 7)) { gethostname(thishostname, EI_MAXHOSTNAMELEN); } @@ -380,7 +387,7 @@ switch_status_t initialise_ei(struct ei_cnode_s *ec) /* init the ei stuff */ - if (ei_connect_xinit(ec, thishostname, prefs.nodename, thisnodename, (Erl_IpAddr) (&server_addr.sin_addr.s_addr), prefs.cookie, 0) < 0) { + if (ei_connect_xinit(ec, thishostname, thisalivename, thisnodename, (Erl_IpAddr) (&server_addr.sin_addr.s_addr), prefs.cookie, 0) < 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to init ei connection\n"); return SWITCH_STATUS_FALSE; } commit 04b9b3e2a6093b2a7f2cae8267d73ae25dcc282a Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Sat Aug 28 23:16:00 2010 -0400 mod_sofia: Fix memleak and mwi event not generated on first register diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 1623d3d..18df1c4 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1315,6 +1315,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand if (regtype == REG_REGISTER) { char exp_param[128] = ""; char date[80] = ""; + switch_event_t *s_mwi_event = NULL; s_event = NULL; @@ -1324,10 +1325,10 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand if (sofia_test_pflag(profile, PFLAG_MESSAGE_QUERY_ON_REGISTER) || (reg_count == 1 && sofia_test_pflag(profile, PFLAG_MESSAGE_QUERY_ON_FIRST_REGISTER))) { - if (switch_event_create(&s_event, SWITCH_EVENT_MESSAGE_QUERY) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "Message-Account", "sip:%s@%s", mwi_user, mwi_host); - switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "VM-Sofia-Profile", profile->name); - switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "VM-Call-ID", call_id); + if (switch_event_create(&s_mwi_event, SWITCH_EVENT_MESSAGE_QUERY) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header(s_mwi_event, SWITCH_STACK_BOTTOM, "Message-Account", "sip:%s@%s", mwi_user, mwi_host); + switch_event_add_header_string(s_mwi_event, SWITCH_STACK_BOTTOM, "VM-Sofia-Profile", profile->name); + switch_event_add_header_string(s_mwi_event, SWITCH_STACK_BOTTOM, "VM-Call-ID", call_id); } } @@ -1361,6 +1362,10 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand switch_event_fire(&s_event); } + if (s_mwi_event) { + switch_event_fire(&s_mwi_event); + } + if (*contact_str && sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE_SYLANTRO)) { sofia_sla_handle_register(nua, profile, sip, exptime, contact_str); } commit 2e8ece4fbaeb060b9443387c4ad940d51afac0a9 Author: Andrew Thompson <andrew@hijacked.us> Date: Fri Aug 27 21:16:55 2010 -0400 Patch (with changes) from Micah Warren to add 'setevent' which is a mostly-atomic nixevent ALL + a event subscription diff --git a/src/mod/event_handlers/mod_erlang_event/handle_msg.c b/src/mod/event_handlers/mod_erlang_event/handle_msg.c index 128c5fc..1a8b64f 100644 --- a/src/mod/event_handlers/mod_erlang_event/handle_msg.c +++ b/src/mod/event_handlers/mod_erlang_event/handle_msg.c @@ -454,6 +454,132 @@ static switch_status_t handle_msg_session_nixevent(listener_t *listener, erlang_ return SWITCH_STATUS_SUCCESS; } +// Nix's all events, then sets up a listener for the given ones. +// meant to ensure that no events are missed during this common operation. +static switch_status_t handle_msg_setevent(listener_t *listener, erlang_msg *msg, int arity, ei_x_buff * buf, ei_x_buff * rbuf) +{ + char atom[MAXATOMLEN]; + + if(arity == 1) { + ei_x_encode_tuple_header(rbuf, 2); + ei_x_encode_atom(rbuf, "error"); + ei_x_encode_atom(rbuf, "badarg"); + } else { + uint8_t event_list[SWITCH_EVENT_ALL + 1]; + switch_hash_t *event_hash; + uint32_t x = 0; + int custom = 0; + switch_event_types_t type; + int i = 0; + + /* clear any previous event registrations */ + for( x = 0; x <= SWITCH_EVENT_ALL; x++){ + event_list[x] = 0; + } + + /* create new hash */ + switch_core_hash_init(&event_hash, listener->pool); + + if(!switch_test_flag(listener, LFLAG_EVENTS)) { + switch_set_flag_locked(listener, LFLAG_EVENTS); + } + + for(i = 1; i < arity; i++){ + if(!ei_decode_atom(buf->buff, &buf->index, atom)){ + + if(custom){ + switch_core_hash_insert(event_hash, atom, MARKER); + } else if (switch_name_event(atom, &type) == SWITCH_STATUS_SUCCESS) { + if (type == SWITCH_EVENT_ALL) { + ei_x_encode_tuple_header(rbuf, 2); + ei_x_encode_atom(rbuf, "error"); + ei_x_encode_atom(rbuf, "badarg"); + break; + } + if (type <= SWITCH_EVENT_ALL) { + event_list[type] = 1; + } + if (type == SWITCH_EVENT_CUSTOM) { + custom++; + } + } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "enable event %s\n", atom); + } + } + /* update the event subscriptions with the new ones */ + memcpy(listener->event_list, event_list, sizeof(uint8_t) * (SWITCH_EVENT_ALL + 1)); + /* wipe the old hash, and point the pointer at the new one */ + switch_core_hash_destroy(&listener->event_hash); + listener->event_hash = event_hash; + + /* TODO - we should flush any non-matching events from the queue */ + ei_x_encode_atom(rbuf, "ok"); + } + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t handle_msg_session_setevent(listener_t *listener, erlang_msg *msg, int arity, ei_x_buff * buf, ei_x_buff * rbuf) +{ + char atom[MAXATOMLEN]; + + if (arity == 1){ + ei_x_encode_tuple_header(rbuf, 2); + ei_x_encode_atom(rbuf, "error"); + ei_x_encode_atom(rbuf, "badarg"); + } else { + session_elem_t *session; + if ((session = find_session_elem_by_pid(listener, &msg->from))) { + uint8_t event_list[SWITCH_EVENT_ALL + 1]; + switch_hash_t *event_hash; + int custom = 0; + int i = 0; + switch_event_types_t type; + uint32_t x = 0; + + /* clear any previous event registrations */ + for (x = 0; x <= SWITCH_EVENT_ALL; x++){ + event_list[x] = 0; + } + + /* create new hash */ + switch_core_hash_init(&event_hash, session->pool); + + for (i = 1; i < arity; i++){ + if (!ei_decode_atom(buf->buff, &buf->index, atom)) { + if (custom) { + switch_core_hash_insert(event_hash, atom, MARKER); + } else if (switch_name_event(atom, &type) == SWITCH_STATUS_SUCCESS) { + if (type == SWITCH_EVENT_ALL) { + ei_x_encode_tuple_header(rbuf, 1); + ei_x_encode_atom(rbuf, "error"); + ei_x_encode_atom(rbuf, "badarg"); + break; + } + if (type <= SWITCH_EVENT_ALL) { + event_list[type] = 1; + } + if (type == SWITCH_EVENT_CUSTOM) { + custom++; + } + } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "enable event %s for session %s\n", atom, session->uuid_str); + } + } + /* update the event subscriptions with the new ones */ + memcpy(session->event_list, event_list, sizeof(uint8_t) * (SWITCH_EVENT_ALL + 1)); + /* wipe the old hash, and point the pointer at the new one */ + switch_core_hash_destroy(&session->event_hash); + session->event_hash = event_hash; + /* TODO - we should flush any non-matching events from the queue */ + ei_x_encode_atom(rbuf, "ok"); + } else { /* no session for this pid */ + ei_x_encode_tuple_header(rbuf, 2); + ei_x_encode_atom(rbuf, "error"); + ei_x_encode_atom(rbuf, "notlistening"); + } + } + return SWITCH_STATUS_SUCCESS; +} static switch_status_t handle_msg_api(listener_t *listener, erlang_msg * msg, int arity, ei_x_buff * buf, ei_x_buff * rbuf) { @@ -772,6 +898,10 @@ static switch_status_t handle_msg_tuple(listener_t *listener, erlang_msg * msg, ret = handle_msg_handlecall(listener, msg, arity, buf, rbuf); } else if (!strncmp(tupletag, "rex", MAXATOMLEN)) { ret = handle_msg_rpcresponse(listener, msg, arity, buf, rbuf); + } else if (!strncmp(tupletag, "setevent", MAXATOMLEN)) { + ret = handle_msg_setevent(listener, msg, arity, buf, rbuf); + } else if (!strncmp(tupletag, "session_setevent", MAXATOMLEN)) { + ret = handle_msg_session_setevent(listener, msg, arity, buf, rbuf); } else { ei_x_encode_tuple_header(rbuf, 2); ei_x_encode_atom(rbuf, "error"); commit f6065262ffe0fcf923cffba23d991d5ee1d45b8b Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Fri Aug 27 18:51:13 2010 -0500 skypopen: cosmetics Signed-off-by: Giovanni Maruzzelli <gmaruzz@gmail.com> diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index bfbc732..e832887 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -2605,10 +2605,9 @@ int skypopen_transfer(private_t * tech_pvt) giovatech = &globals.SKYPOPEN_INTERFACES[i]; /* let's look for a DOWN one */ - NOTICA ("LOOKING (name=%s, giovatech->interface_state=%d == SKYPOPEN_STATE_DOWN[%d]) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n", SKYPOPEN_P_LOG, giovatech->name, giovatech->interface_state, SKYPOPEN_STATE_DOWN, giovatech->skype_user, tech_pvt->skype_user, giovatech->callid_number, value); if ((giovatech->interface_state == SKYPOPEN_STATE_DOWN || giovatech->interface_state == 0) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user))) { //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds found = 1; - DEBUGA_SKYPE ("FOUND (name=%s, giovatech->interface_state=%d != SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n", SKYPOPEN_P_LOG, giovatech->name, giovatech->interface_state, giovatech->skype_user, tech_pvt->skype_user, giovatech->callid_number, value); + DEBUGA_SKYPE ("FOUND (name=%s, giovatech->interface_state=%d == SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n", SKYPOPEN_P_LOG, giovatech->name, giovatech->interface_state, giovatech->skype_user, tech_pvt->skype_user, giovatech->callid_number, value); if (tech_pvt->interface_state == SKYPOPEN_STATE_PRERING) { tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; } commit 57c726f130750de316f47a4b32eaea65f9c06b81 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Aug 27 18:36:28 2010 -0500 wtf diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 943813b..16b928b 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -3163,6 +3163,8 @@ switch_status_t config_sofia(int reload, char *profile_name) profile->reg_domain = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "force-register-db-domain")) { profile->reg_db_domain = switch_core_strdup(profile->pool, val); + } else if (!strcasecmp(var, "force-subscription-domain")) { + profile->sub_domain = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "bind-params")) { profile->bind_params = switch_core_strdup(profile->pool, val); } else if (!strcasecmp(var, "sip-domain")) { commit 67845680ba7d415801c4ff5db97c228890001f34 Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Fri Aug 27 18:36:34 2010 -0500 skypopen: let's manage correctly the transfer to another interface with a different skypename Signed-off-by: Giovanni Maruzzelli <gmaruzz@gmail.com> diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index 15f1aa4..bfbc732 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -586,7 +586,7 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int tech_pvt = switch_core_session_get_private(session); switch_assert(tech_pvt != NULL); - DEBUGA_SKYPE("%s CHANNEL KILL_CHANNEL\n", SKYPOPEN_P_LOG, tech_pvt->name); + //DEBUGA_SKYPE("%s CHANNEL KILL_CHANNEL\n", SKYPOPEN_P_LOG, tech_pvt->name); switch (sig) { case SWITCH_SIG_KILL: switch_mutex_lock(tech_pvt->flag_mutex); @@ -2536,13 +2536,16 @@ int skypopen_answer(private_t * tech_pvt) switch_mutex_unlock(globals.mutex); return 0; } -int skypopen_transfer(private_t * tech_pvt, char *id, char *value) +//int skypopen_transfer(private_t * tech_pvt, char *id, char *value) +int skypopen_transfer(private_t * tech_pvt) { char msg_to_skype[1024]; int i; int found = 0; private_t *giovatech; struct timeval timenow; + char *id = tech_pvt->ring_id; + char *value = tech_pvt->ring_value; switch_mutex_lock(globals.mutex); @@ -2551,6 +2554,41 @@ int skypopen_transfer(private_t * tech_pvt, char *id, char *value) if (strlen(globals.SKYPOPEN_INTERFACES[i].name)) { giovatech = &globals.SKYPOPEN_INTERFACES[i]; + /* let's look for a RINGING one */ + if ((giovatech->interface_state != SKYPOPEN_STATE_DOWN) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user)) && (!strcmp(giovatech->ring_value, value)) && ((((timenow.tv_sec - giovatech->ring_time.tv_sec) * 1000000) + (timenow.tv_usec - giovatech->ring_time.tv_usec)) < 1000000)) { //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds + found = 1; + DEBUGA_SKYPE ("FOUND (name=%s, giovatech->interface_state=%d != SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n", SKYPOPEN_P_LOG, giovatech->name, giovatech->interface_state, giovatech->skype_user, tech_pvt->skype_user, giovatech->callid_number, value); + if (tech_pvt->interface_state == SKYPOPEN_STATE_PRERING) { + tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; + } + + +#if 0 + + + else if (tech_pvt->interface_state != 0 && tech_pvt->interface_state != SKYPOPEN_STATE_DOWN) { + WARNINGA("Why an interface_state %d HERE?\n", SKYPOPEN_P_LOG, tech_pvt->interface_state); + tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; + } + + *tech_pvt->answer_id = '\0'; + *tech_pvt->answer_value = '\0'; + *tech_pvt->ring_id = '\0'; + *tech_pvt->ring_value = '\0'; +#endif //0 + break; + } + } + } + + + /*****************************************/ +#if 0 + gettimeofday(&timenow, NULL); + for (i = 0; !found && i < SKYPOPEN_MAX_INTERFACES; i++) { + if (strlen(globals.SKYPOPEN_INTERFACES[i].name)) { + + giovatech = &globals.SKYPOPEN_INTERFACES[i]; if (strlen(giovatech->skype_call_id) && (giovatech->interface_state != SKYPOPEN_STATE_DOWN) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user)) && (!strcmp(giovatech->callid_number, value)) && ((((timenow.tv_sec - giovatech->answer_time.tv_sec) * 1000000) + (timenow.tv_usec - giovatech->answer_time.tv_usec)) < 500000)) { //0.5sec found = 1; DEBUGA_SKYPE @@ -2561,6 +2599,39 @@ int skypopen_transfer(private_t * tech_pvt, char *id, char *value) } } } +#endif //0 + for (i = 0; !found && i < SKYPOPEN_MAX_INTERFACES; i++) { + if (strlen(globals.SKYPOPEN_INTERFACES[i].name)) { + + giovatech = &globals.SKYPOPEN_INTERFACES[i]; + /* let's look for a DOWN one */ + NOTICA ("LOOKING (name=%s, giovatech->interface_state=%d == SKYPOPEN_STATE_DOWN[%d]) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n", SKYPOPEN_P_LOG, giovatech->name, giovatech->interface_state, SKYPOPEN_STATE_DOWN, giovatech->skype_user, tech_pvt->skype_user, giovatech->callid_number, value); + if ((giovatech->interface_state == SKYPOPEN_STATE_DOWN || giovatech->interface_state == 0) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user))) { //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds + found = 1; + DEBUGA_SKYPE ("FOUND (name=%s, giovatech->interface_state=%d != SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n", SKYPOPEN_P_LOG, giovatech->name, giovatech->interface_state, giovatech->skype_user, tech_pvt->skype_user, giovatech->callid_number, value); + if (tech_pvt->interface_state == SKYPOPEN_STATE_PRERING) { + tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; + } + + +#if 0 + + + else if (tech_pvt->interface_state != 0 && tech_pvt->interface_state != SKYPOPEN_STATE_DOWN) { + WARNINGA("Why an interface_state %d HERE?\n", SKYPOPEN_P_LOG, tech_pvt->interface_state); + tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; + } + + *tech_pvt->answer_id = '\0'; + *tech_pvt->answer_value = '\0'; + *tech_pvt->ring_id = '\0'; + *tech_pvt->ring_value = '\0'; +#endif //0 + break; + } + } + } + if (found) { switch_mutex_unlock(globals.mutex); diff --git a/src/mod/endpoints/mod_skypopen/skypopen.h b/src/mod/endpoints/mod_skypopen/skypopen.h index 9128d88..77e00da 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen.h +++ b/src/mod/endpoints/mod_skypopen/skypopen.h @@ -335,7 +335,8 @@ int remote_party_is_ringing(private_t * tech_pvt); int remote_party_is_early_media(private_t * tech_pvt); //int skypopen_answer(private_t * tech_pvt, char *id, char *value); int skypopen_answer(private_t * tech_pvt); -int skypopen_transfer(private_t * tech_pvt, char *id, char *value); +//int skypopen_transfer(private_t * tech_pvt, char *id, char *value); +int skypopen_transfer(private_t * tech_pvt); #ifndef WIN32 int skypopen_socket_create_and_bind(private_t * tech_pvt, int *which_port); #else diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index a15b564..ad69980 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -215,12 +215,12 @@ int skypopen_signaling_read(private_t * tech_pvt) tech_pvt->interface_state = SKYPOPEN_STATE_ERROR_DOUBLE_CALL; } else if (!strncasecmp(message, "ERROR 592 ALTER CALL", 19)) { NOTICA("Skype got ERROR about TRANSFERRING, no problem: |||%s|||\n", SKYPOPEN_P_LOG, message); - } else if (!strncasecmp(message, "ERROR 559 CALL", 13)) { + } else if (!strncasecmp(message, "ERROR 559 CALL", 13) | !strncasecmp(message, "ERROR 556 CALL", 13)) { if (tech_pvt->interface_state == SKYPOPEN_STATE_PREANSWER) { DEBUGA_SKYPE("Skype got ERROR about a failed action (probably TRYING to ANSWER A CALL), let's go down: |||%s|||\n", SKYPOPEN_P_LOG, message); tech_pvt->skype_callflow = CALLFLOW_STATUS_FINISHED; - ERRORA("skype_call now is DOWN\n", SKYPOPEN_P_LOG); + DEBUGA_SKYPE("skype_call now is DOWN\n", SKYPOPEN_P_LOG); tech_pvt->skype_call_id[0] = '\0'; tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; return CALLFLOW_INCOMING_HANGUP; @@ -490,9 +490,13 @@ int skypopen_signaling_read(private_t * tech_pvt) /* this is the call in which we are calling out */ DEBUGA_SKYPE("Call %s DO NOTHING\n", SKYPOPEN_P_LOG, id); } else { - skypopen_sleep(400000); //0.4 seconds DEBUGA_SKYPE("Call %s TRY TRANSFER\n", SKYPOPEN_P_LOG, id); - skypopen_transfer(tech_pvt, id, value); + skypopen_strncpy(tech_pvt->ring_id, id, sizeof(tech_pvt->ring_id)); + skypopen_strncpy(tech_pvt->ring_value, value, sizeof(tech_pvt->ring_value)); + skypopen_strncpy(tech_pvt->answer_id, id, sizeof(tech_pvt->answer_id)); + skypopen_strncpy(tech_pvt->answer_value, value, sizeof(tech_pvt->answer_value)); + //skypopen_transfer(tech_pvt, id, value); + skypopen_transfer(tech_pvt); } } } commit 830f24e8ea964efdf943c111cc9959cdc5e7ffaa Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Aug 27 16:54:37 2010 -0500 pres tweak diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 4acc83c..82e975c 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -519,7 +519,11 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) } if (zstr(alt_event_type)) { - alt_event_type = "presence"; + if (!strcasecmp(event_type, "presence")) { + alt_event_type = "dialog"; + } else { + alt_event_type = "presence"; + } } if (from && (user = strdup(from))) { @@ -2321,6 +2325,8 @@ void sofia_presence_handle_sip_i_subscribe(int status, switch_event_add_header(sevent, SWITCH_STACK_BOTTOM, "to", "%s@%s", to_user, to_host); switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "proto-specific-event-name", event); switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "expires", exp_delta_str); + switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "event_type", "presence"); + switch_event_add_header_string(sevent, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog"); switch_event_fire(&sevent); } } commit 540ee0123de4119b1df10ce752a5891248215a8b Author: Brian West <brian@freeswitch.org> Date: Fri Aug 27 14:04:45 2010 -0500 make sure to remove sip_dialogs when we should diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 019bb9f..5830822 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -458,7 +458,7 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session) } if (session && tech_pvt->profile->pres_type) { - char *sql = switch_mprintf("delete from sip_dialogs where call_id='%q'", tech_pvt->call_id); + char *sql = switch_mprintf("delete from sip_dialogs where uuid='%q'", switch_core_session_get_uuid(session)); switch_assert(sql); sofia_glue_execute_sql_now(tech_pvt->profile, &sql, SWITCH_TRUE); } commit e0d4c195ef88c0b892f704076670f12ef90ac9f9 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Aug 27 13:08:33 2010 -0500 off by one diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 775451d..4acc83c 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -965,9 +965,9 @@ static int sofia_presence_resub_callback(void *pArg, int argc, char **argv, char switch_url_decode(to_buf); to_user = to_buf; } - if (argc > 10 && !zstr(argv[9]) && !zstr(argv[10])) { - status = argv[9]; - rpid = argv[10]; + if (argc > 10 && !zstr(argv[10]) && !zstr(argv[11])) { + status = argv[10]; + rpid = argv[11]; } } commit ef14b78a8a219bd1d1a39b12f1c0d4118288d744 Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Fri Aug 27 11:57:47 2010 -0500 skypopen: ignore early media sent by channels to be bridged before our channel is answered Signed-off-by: Giovanni Maruzzelli <gmaruzz@gmail.com> diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index 513a557..15f1aa4 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -578,6 +578,7 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int { switch_channel_t *channel = NULL; private_t *tech_pvt = NULL; + char msg_to_skype[256]; channel = switch_core_session_get_channel(session); switch_assert(channel != NULL); @@ -602,7 +603,12 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int switch_clear_flag(tech_pvt, TFLAG_IO); switch_clear_flag(tech_pvt, TFLAG_VOICE); switch_set_flag(tech_pvt, TFLAG_HANGUP); + if(switch_test_flag(tech_pvt, TFLAG_PROGRESS)){ + switch_clear_flag(tech_pvt, TFLAG_PROGRESS); + } switch_mutex_unlock(tech_pvt->flag_mutex); + sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->ring_id); + skypopen_signaling_write(tech_pvt, msg_to_skype); break; case SWITCH_SIG_BREAK: DEBUGA_SKYPE("%s CHANNEL got SWITCH_SIG_BREAK\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); @@ -693,17 +699,27 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch int try=0; + *frame = NULL; + channel = switch_core_session_get_channel(session); switch_assert(channel != NULL); tech_pvt = switch_core_session_get_private(session); switch_assert(tech_pvt != NULL); + tech_pvt->read_frame.flags = SFF_NONE; + if (!switch_channel_ready(channel) || !switch_test_flag(tech_pvt, TFLAG_IO)) { ERRORA("channel not ready \n", SKYPOPEN_P_LOG); return SWITCH_STATUS_FALSE; } + if (switch_test_flag(tech_pvt, TFLAG_PROGRESS)) { + //DEBUGA_SKYPE("CHANNEL READ FRAME in TFLAG_PROGRESS goto CNG\n", SKYPOPEN_P_LOG); + switch_sleep(20000); + goto cng; + } + if (!tech_pvt->read_buffer) { int32_t max_len = 640 * 10; @@ -714,8 +730,6 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch } - tech_pvt->read_frame.flags = SFF_NONE; - *frame = NULL; if (tech_pvt->timer_read.timer_interface && tech_pvt->timer_read.timer_interface->timer_next){ switch_core_timer_next(&tech_pvt->timer_read); @@ -837,6 +851,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc { switch_channel_t *channel = NULL; private_t *tech_pvt = NULL; + int no_space=0; channel = switch_core_session_get_channel(session); switch_assert(channel != NULL); @@ -844,6 +859,11 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc tech_pvt = switch_core_session_get_private(session); switch_assert(tech_pvt != NULL); + if (switch_test_flag(tech_pvt, TFLAG_PROGRESS)) { + //DEBUGA_SKYPE("CHANNEL in TFLAG_PROGRESS\n", SKYPOPEN_P_LOG); + return SWITCH_STATUS_SUCCESS; + } + if (!switch_channel_ready(channel)) { ERRORA("channel not ready \n", SKYPOPEN_P_LOG); return SWITCH_STATUS_FALSE; @@ -869,11 +889,15 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc DEBUGA_SKYPE("NO SPACE WRITE: %d\n", SKYPOPEN_P_LOG, frame->datalen); //switch_buffer_toss(tech_pvt->write_buffer, frame->datalen); switch_buffer_zero(tech_pvt->write_buffer); + no_space=1; } switch_buffer_write(tech_pvt->write_buffer, frame->data, frame->datalen); switch_mutex_unlock(tech_pvt->mutex_audio_cli); - - tech_pvt->begin_to_write = 1; + if(no_space){ + switch_sleep(20000); + }else{ + tech_pvt->begin_to_write = 1; + } return SWITCH_STATUS_SUCCESS; } @@ -916,6 +940,7 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s { switch_channel_t *channel; private_t *tech_pvt; + char msg_to_skype[256]; //int i; channel = switch_core_session_get_channel(session); @@ -925,11 +950,30 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s switch_assert(tech_pvt != NULL); switch (msg->message_id) { + case SWITCH_MESSAGE_INDICATE_PROGRESS: + { + DEBUGA_SKYPE("%s CHANNEL got SWITCH_MESSAGE_INDICATE_PROGRESS\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); + switch_set_flag(tech_pvt, TFLAG_PROGRESS); + } + break; + case SWITCH_MESSAGE_INDICATE_CLEAR_PROGRESS: + { + DEBUGA_SKYPE("%s CHANNEL got SWITCH_MESSAGE_INDICATE_CLEAR_PROGRESS\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); + if(switch_set_flag(tech_pvt, TFLAG_PROGRESS)){ + sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", tech_pvt->ring_id); + skypopen_signaling_write(tech_pvt, msg_to_skype); + switch_clear_flag(tech_pvt, TFLAG_PROGRESS); + } + } + break; + case SWITCH_MESSAGE_INDICATE_ANSWER: { DEBUGA_SKYPE("%s CHANNEL got SWITCH_MESSAGE_INDICATE_ANSWER\n", SKYPOPEN_P_LOG, switch_channel_get_name(channel)); + //switch_set_flag(tech_pvt, TFLAG_IO); channel_answer_channel(session); + switch_clear_flag(tech_pvt, TFLAG_PROGRESS); if(tech_pvt->read_buffer){ switch_mutex_lock(tech_pvt->mutex_audio_srv); @@ -2319,7 +2363,7 @@ int skypopen_partner_handle_ring(private_t * tech_pvt) char *id = tech_pvt->ring_id; char *value = tech_pvt->ring_value; switch_core_session_t *session = NULL; - switch_channel_t *channel = NULL; + //switch_channel_t *channel = NULL; switch_mutex_lock(globals.mutex); @@ -2373,6 +2417,7 @@ int skypopen_partner_handle_ring(private_t * tech_pvt) new_inbound_channel(tech_pvt); +#if 0 session = switch_core_session_locate(tech_pvt->session_uuid_str); if (session) { channel = switch_core_session_get_channel(session); @@ -2388,6 +2433,7 @@ int skypopen_partner_handle_ring(private_t * tech_pvt) ERRORA("no session\n", SKYPOPEN_P_LOG); } +#endif //0 } else if (!tech_pvt || !tech_pvt->skype_call_id) { ERRORA("No Call ID?\n", SKYPOPEN_P_LOG); diff --git a/src/mod/endpoints/mod_skypopen/skypopen.h b/src/mod/endpoints/mod_skypopen/skypopen.h index b991f0e..9128d88 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen.h +++ b/src/mod/endpoints/mod_skypopen/skypopen.h @@ -74,7 +74,7 @@ typedef enum { TFLAG_VOICE = (1 << 4), TFLAG_HANGUP = (1 << 5), TFLAG_LINEAR = (1 << 6), - TFLAG_CODEC = (1 << 7), + TFLAG_PROGRESS = (1 << 7), TFLAG_BREAK = (1 << 8) } TFLAGS; commit 04b1f8d8a59909d66938d209fc3d64c334c0ab3b Author: Jeff Lenk <jeff@jefflenk.com> Date: Fri Aug 27 10:19:12 2010 -0500 tweak diff --git a/fscomm/FSComm.2008.vcproj b/fscomm/FSComm.2008.vcproj index 42a98a8..b4c264c 100644 --- a/fscomm/FSComm.2008.vcproj +++ b/fscomm/FSComm.2008.vcproj @@ -46,17 +46,17 @@ Name="VCCLCompilerTool" AdditionalOptions="-Zm200 -w34100 -w34189 -w34100 -w34189" Optimization="4" - AdditionalIncludeDirectories="$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include;.;$(QTDIR)\include\ActiveQt;debug;"$(QTDIR)\mkspecs\win32-msvc2008";..\src\include;$(QTDIR)\include\QtXml" - PreprocessorDefinitions="_WINDOWS,UNICODE,WIN32,QT_LARGEFILE_SUPPORT,QT_DLL,QT_GUI_LIB,QT_CORE_LIB,QT_THREAD_SUPPORT" + AdditionalIncludeDirectories=""$(QTDIR)\include\QtCore","$(QTDIR)\include\QtGui","$(QTDIR)\include\QtXml","$(QTDIR)\include","..\src\include","..\libs\apr\include","..\libs\libteletone\src","$(QTDIR)\include\ActiveQt","debug",".",$(QTDIR)\mkspecs\win32-msvc2008" + PreprocessorDefinitions="_WINDOWS,UNICODE,WIN32,QT_LARGEFILE_SUPPORT,QT_DLL,QT_XML_LIB,QT_GUI_LIB,QT_CORE_LIB,QT_THREAD_SUPPORT" GeneratePreprocessedFile="0" ExceptionHandling="1" RuntimeLibrary="3" BufferSecurityCheck="false" TreatWChar_tAsBuiltInType="false" RuntimeTypeInfo="true" - AssemblerListingLocation="" - ObjectFile="$(IntDir)\" - ProgramDataBaseFileName="$(IntDir)\" + AssemblerListingLocation="debug\" + ObjectFile="debug\" + ProgramDataBaseFileName=".\" WarningLevel="3" SuppressStartupBanner="true" DebugInformationFormat="3" @@ -66,7 +66,7 @@ /> <Tool Name="VCResourceCompilerTool" - PreprocessorDefinitions="_WINDOWS,UNICODE,WIN32,QT_LARGEFILE_SUPPORT,QT_DLL,QT_GUI_LIB,QT_CORE_LIB,QT_THREAD_SUPPORT,_DEBUG" + PreprocessorDefinitions="_WINDOWS,UNICODE,WIN32,QT_LARGEFILE_SUPPORT,QT_DLL,QT_XML_LIB,QT_GUI_LIB,QT_CORE_LIB,QT_THREAD_SUPPORT,_DEBUG" /> <Tool Name="VCPreLinkEventTool" @@ -75,10 +75,10 @@ Name="VCLinkerTool" IgnoreImportLibrary="true" AdditionalOptions=""/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'"" - AdditionalDependencies="$(QTDIR)\lib\qtmaind.lib $(QTDIR)\lib\QtGuid4.lib $(QTDIR)\lib\QtCored4.lib $(QTDIR)\lib\QtXml4.lib" - OutputFile="debug\FSComm.exe" + AdditionalDependencies="$(QTDIR)\lib\qtmaind.lib $(QTDIR)\lib\QtXmld4.lib $(QTDIR)\lib\QtGuid4.lib $(QTDIR)\lib\QtCored4.lib" + OutputFile="debug\fscomm.exe" SuppressStartupBanner="true" - AdditionalLibraryDirectories="$(QTDIR)\lib" + AdditionalLibraryDirectories="$(QTDIR)\lib,../.libs" GenerateDebugInformation="true" ProgramDatabaseFile="" SubSystem="2" @@ -136,17 +136,17 @@ Name="VCCLCompilerTool" AdditionalOptions="-Zm200 -w34100 -w34189 -w34100 -w34189" Optimization="2" - AdditionalIncludeDirectories=""$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui";"$(QTDIR)\include";.;"$(QTDIR)\include\ActiveQt";release;"$(QTDIR)\mkspecs\win32-msvc2008";..\src\include;"$(QTDIR)\include\QtXml"" - PreprocessorDefinitions="QT_NO_DEBUG,NDEBUG,_WINDOWS,UNICODE,WIN32,QT_LARGEFILE_SUPPORT,QT_DLL,QT_NO_DEBUG,QT_GUI_LIB,QT_CORE_LIB,QT_THREAD_SUPPORT,NDEBUG" + AdditionalIncludeDirectories=""$(QTDIR)\include\QtCore","$(QTDIR)\include\QtGui","$(QTDIR)\include\QtXml","$(QTDIR)\include","..\src\include","..\libs\apr\include","..\libs\libteletone\src","$(QTDIR)\include\ActiveQt","release",".",$(QTDIR)\mkspecs\win32-msvc2008" + PreprocessorDefinitions="QT_NO_DEBUG,NDEBUG,_WINDOWS,UNICODE,WIN32,QT_LARGEFILE_SUPPORT,QT_DLL,QT_NO_DEBUG,QT_XML_LIB,QT_GUI_LIB,QT_CORE_LIB,QT_THREAD_SUPPORT,NDEBUG" GeneratePreprocessedFile="0" ExceptionHandling="1" RuntimeLibrary="2" BufferSecurityCheck="false" TreatWChar_tAsBuiltInType="false" RuntimeTypeInfo="true" - AssemblerListingLocation="" - ObjectFile="$(IntDir)\" - ProgramDataBaseFileName="$(IntDir)\" + AssemblerListingLocation="release\" + ObjectFile="release\" + ProgramDataBaseFileName=".\" WarningLevel="3" SuppressStartupBanner="true" DebugInformationFormat="0" @@ -156,7 +156,7 @@ /> <Tool Name="VCResourceCompilerTool" - PreprocessorDefinitions="QT_NO_DEBUG,NDEBUG,_WINDOWS,UNICODE,WIN32,QT_LARGEFILE_SUPPORT,QT_DLL,QT_NO_DEBUG,QT_GUI_LIB,QT_CORE_LIB,QT_THREAD_SUPPORT" + PreprocessorDefinitions="QT_NO_DEBUG,NDEBUG,_WINDOWS,UNICODE,WIN32,QT_LARGEFILE_SUPPORT,QT_DLL,QT_NO_DEBUG,QT_XML_LIB,QT_GUI_LIB,QT_CORE_LIB,QT_THREAD_SUPPORT" /> <Tool Name="VCPreLinkEventTool" @@ -165,11 +165,11 @@ Name="VCLinkerTool" IgnoreImportLibrary="true" AdditionalOptions=""/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'"" - AdditionalDependencies="$(QTDIR)\lib\qtmain.lib $(QTDIR)\lib\QtGui4.lib $(QTDIR)\lib\QtCore4.lib $(QTDIR)\lib\QtXml4.lib" - OutputFile="release\FSComm.exe" + AdditionalDependencies="$(QTDIR)\lib\qtmain.lib freeswitch.lib m.lib $(QTDIR)\lib\QtXml4.lib $(QTDIR)\lib\QtGui4.lib $(QTDIR)\lib\QtCore4.lib" + OutputFile="release\fscomm.exe" LinkIncremental="1" SuppressStartupBanner="true" - AdditionalLibraryDirectories="$(QTDIR)\lib" + AdditionalLibraryDirectories="$(QTDIR)\lib,../.libs" GenerateDebugInformation="false" ProgramDatabaseFile="" SubSystem="2" @@ -207,11 +207,15 @@ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" > <File - RelativePath=".\account.cpp" + RelativePath="account.cpp" > </File> <File - RelativePath=".\preferences\accountdialog.cpp" + RelativePath="preferences\accountdialog.cpp" + > + </File> + <File + RelativePath="accountmanager.cpp" > </File> <File @@ -219,15 +223,15 @@ > </File> <File - RelativePath=".\channel.cpp" + RelativePath="channel.cpp" > </File> <File - RelativePath=".\widgets\codecwidget.cpp" + RelativePath="widgets\codecwidget.cpp" > </File> <File - RelativePath=".\debugtools\consolewindow.cpp" + RelativePath="debugtools\consolewindow.cpp" > </File> <File @@ -235,19 +239,19 @@ > </File> <File - RelativePath="main.cpp" + RelativePath="isettings.cpp" > </File> <File - RelativePath="mainwindow.cpp" + RelativePath="main.cpp" > </File> <File - RelativePath="mod_qsettings\mod_qsettings.cpp" + RelativePath="mainwindow.cpp" > </File> <File - RelativePath=".\preferences\prefaccounts.cpp" + RelativePath="preferences\prefaccounts.cpp" > </File> <File @@ -259,15 +263,15 @@ > </File> <File - RelativePath=".\preferences\prefsofia.cpp" + RelativePath="preferences\prefsofia.cpp" > </File> <File - RelativePath=".\debugtools\sortfilterproxymodel.cpp" + RelativePath="debugtools\sortfilterproxymodel.cpp" > </File> <File - RelativePath=".\debugtools\statedebugdialog.cpp" + RelativePath="debugtools\statedebugdialog.cpp" > </File> </Filter> @@ -277,7 +281,7 @@ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" > <File - RelativePath=".\account.h" + RelativePath="account.h" > </File> <File @@ -288,9 +292,9 @@ > <Tool Name="VCCustomBuildTool" - Description="MOC accountdialog.h" - CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile debug\moc_accountdialog.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include" -I"." -I"$(QTDIR)\include\ActiveQt" -I"debug" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\accountdialog.h -o debug\moc_accountdialog.cpp " - AdditionalDependencies="Rem;accountdialog.h" + Description="MOC preferences\accountdialog.h" + CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile debug\moc_accountdialog.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include\QtXml" -I"$(QTDIR)\include" -I"..\src\include" -I"..\libs\apr\include" -I"..\libs\libteletone\src" -I"$(QTDIR)\include\ActiveQt" -I"debug" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\accountdialog.h -o debug\moc_accountdialog.cpp " + AdditionalDependencies="Rem;preferences\accountdialog.h" Outputs="debug\moc_accountdialog.cpp" /> </FileConfiguration> @@ -299,32 +303,58 @@ > <Tool Name="VCCustomBuildTool" - Description="MOC accountdialog.h" - CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile release\moc_accountdialog.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include" -I"." -I"$(QTDIR)\include\ActiveQt" -I"release" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\accountdialog.h -o release\moc_accountdialog.cpp " - AdditionalDependencies="Rem;accountdialog.h" + Description="MOC preferences\accountdialog.h" + CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile release\moc_accountdialog.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include\QtXml" -I"$(QTDIR)\include" -I"..\src\include" -I"..\libs\apr\include" -I"..\libs\libteletone\src" -I"$(QTDIR)\include\ActiveQt" -I"release" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\accountdialog.h -o release\moc_accountdialog.cpp " + AdditionalDependencies="Rem;preferences\accountdialog.h" Outputs="release\moc_accountdialog.cpp" /> </FileConfiguration> </File> <File + RelativePath="accountmanager.h" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="MOC accountmanager.h" + CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile debug\moc_accountmanager.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include\QtXml" -I"$(QTDIR)\include" -I"..\src\include" -I"..\libs\apr\include" -I"..\libs\libteletone\src" -I"$(QTDIR)\include\ActiveQt" -I"debug" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 accountmanager.h -o debug\moc_accountmanager.cpp " + AdditionalDependencies="Rem;accountmanager.h" + Outputs="debug\moc_accountmanager.cpp" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="MOC accountmanager.h" + CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile release\moc_accountmanager.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include\QtXml" -I"$(QTDIR)\include" -I"..\src\include" -I"..\libs\apr\include" -I"..\libs\libteletone\src" -I"$(QTDIR)\include\ActiveQt" -I"release" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 accountmanager.h -o release\moc_accountmanager.cpp " + AdditionalDependencies="Rem;accountmanager.h" + Outputs="release\moc_accountmanager.cpp" + /> + </FileConfiguration> + </File> + <File RelativePath="call.h" > </File> <File - RelativePath=".\channel.h" + RelativePath="channel.h" > </File> <File - RelativePath=".\widgets\codecwidget.h" + RelativePath="widgets\codecwidget.h" > <FileConfiguration Name="Debug|Win32" > <Tool Name="VCCustomBuildTool" - Description="MOC codecwidget.h" - CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile debug\moc_codecwidget.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include" -I"." -I"$(QTDIR)\include\ActiveQt" -I"debug" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 widgets\codecwidget.h -o debug\moc_codecwidget.cpp " - AdditionalDependencies="Rem;codecwidget.h" + Description="MOC widgets\codecwidget.h" + CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile debug\moc_codecwidget.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include\QtXml" -I"$(QTDIR)\include" -I"..\src\include" -I"..\libs\apr\include" -I"..\libs\libteletone\src" -I"$(QTDIR)\include\ActiveQt" -I"debug" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 widgets\codecwidget.h -o debug\moc_codecwidget.cpp " + AdditionalDependencies="Rem;widgets\codecwidget.h" Outputs="debug\moc_codecwidget.cpp" /> </FileConfiguration> @@ -333,24 +363,24 @@ > <Tool Name="VCCustomBuildTool" - Description="MOC prefportaudio.h" - CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile release\moc_codecwidget.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include" -I"." -I"$(QTDIR)\include\ActiveQt" -I"release" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 widgets\codecwidget.h -o release\moc_codecwidget.cpp " - AdditionalDependencies="Rem;codecwidget.h" + Description="MOC widgets\codecwidget.h" + CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile release\moc_codecwidget.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include\QtXml" -I"$(QTDIR)\include" -I"..\src\include" -I"..\libs\apr\include" -I"..\libs\libteletone\src" -I"$(QTDIR)\include\ActiveQt" -I"release" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 widgets\codecwidget.h -o release\moc_codecwidget.cpp " + AdditionalDependencies="Rem;widgets\codecwidget.h" Outputs="release\moc_codecwidget.cpp" /> </FileConfiguration> </File> <File - RelativePath=".\debugtools\consolewindow.h" + RelativePath="debugtools\consolewindow.h" > <FileConfiguration Name="Debug|Win32" > <Tool Name="VCCustomBuildTool" - Description="MOC consolewindow.h" - CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile debug\moc_consolewindow.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include" -I"." -I"$(QTDIR)\include\ActiveQt" -I"debug" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 debugtools\consolewindow.h -o debug\moc_consolewindow.cpp " - AdditionalDependencies="Rem;consolewindow.h" + Description="MOC debugtools\consolewindow.h" + CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile debug\moc_consolewindow.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include\QtXml" -I"$(QTDIR)\include" -I"..\src\include" -I"..\libs\apr\include" -I"..\libs\libteletone\src" -I"$(QTDIR)\include\ActiveQt" -I"debug" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 debugtools\consolewindow.h -o debug\moc_consolewindow.cpp " + AdditionalDependencies="Rem;debugtools\consolewindow.h" Outputs="debug\moc_consolewindow.cpp" /> </FileConfiguration> @@ -359,14 +389,18 @@ > <Tool Name="VCCustomBuildTool" - Description="MOC consolewindow.h" - CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile release\moc_consolewindow.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include" -I"." -I"$(QTDIR)\include\ActiveQt" -I"release" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 debugtools\consolewindow.h -o release\moc_consolewindow.cpp " - AdditionalDependencies="Rem;consolewindow.h" + Description="MOC debugtools\consolewindow.h" + CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile release\moc_consolewindow.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include\QtXml" -I"$(QTDIR)\include" -I"..\src\include" -I"..\libs\apr\include" -I"..\libs\libteletone\src" -I"$(QTDIR)\include\ActiveQt" -I"release" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 debugtools\consolewindow.h -o release\moc_consolewindow.cpp " + AdditionalDependencies="Rem;debugtools\consolewindow.h" Outputs="release\moc_consolewindow.cpp" /> </FileConfiguration> </File> <File + RelativePath="fscomm.h" + > + </File> + <File RelativePath="fshost.h" > <FileConfiguration @@ -375,7 +409,7 @@ <Tool Name="VCCustomBuildTool" Description="MOC fshost.h" - CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile debug\moc_fshost.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include" -I"." -I"$(QTDIR)\include\ActiveQt" -I"debug" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 fshost.h -o debug\moc_fshost.cpp " + CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile debug\moc_fshost.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include\QtXml" -I"$(QTDIR)\include" -I"..\src\include" -I"..\libs\apr\include" -I"..\libs\libteletone\src" -I"$(QTDIR)\include\ActiveQt" -I"debug" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 fshost.h -o debug\moc_fshost.cpp " AdditionalDependencies="Rem;fshost.h" Outputs="debug\moc_fshost.cpp" /> @@ -386,13 +420,39 @@ <Tool Name="VCCustomBuildTool" Description="MOC fshost.h" - CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile release\moc_fshost.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include" -I"." -I"$(QTDIR)\include\ActiveQt" -I"release" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 fshost.h -o release\moc_fshost.cpp " + CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile release\moc_fshost.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include\QtXml" -I"$(QTDIR)\include" -I"..\src\include" -I"..\libs\apr\include" -I"..\libs\libteletone\src" -I"$(QTDIR)\include\ActiveQt" -I"release" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 fshost.h -o release\moc_fshost.cpp " AdditionalDependencies="Rem;fshost.h" Outputs="release\moc_fshost.cpp" /> </FileConfiguration> </File> <File + RelativePath="isettings.h" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="MOC isettings.h" + CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile debug\moc_isettings.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include\QtXml" -I"$(QTDIR)\include" -I"..\src\include" -I"..\libs\apr\include" -I"..\libs\libteletone\src" -I"$(QTDIR)\include\ActiveQt" -I"debug" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 isettings.h -o debug\moc_isettings.cpp " + AdditionalDependencies="Rem;isettings.h" + Outputs="debug\moc_isettings.cpp" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="MOC isettings.h" + CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile release\moc_isettings.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include\QtXml" -I"$(QTDIR)\include" -I"..\src\include" -I"..\libs\apr\include" -I"..\libs\libteletone\src" -I"$(QTDIR)\include\ActiveQt" -I"release" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 isettings.h -o release\moc_isettings.cpp " + AdditionalDependencies="Rem;isettings.h" + Outputs="release\moc_isettings.cpp" + /> + </FileConfiguration> + </File> + <File RelativePath="mainwindow.h" > <FileConfiguration @@ -401,7 +461,7 @@ <Tool Name="VCCustomBuildTool" Description="MOC mainwindow.h" - CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile debug\moc_mainwindow.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include" -I"." -I"$(QTDIR)\include\ActiveQt" -I"debug" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 mainwindow.h -o debug\moc_mainwindow.cpp " + CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile debug\moc_mainwindow.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include\QtXml" -I"$(QTDIR)\include" -I"..\src\include" -I"..\libs\apr\include" -I"..\libs\libteletone\src" -I"$(QTDIR)\include\ActiveQt" -I"debug" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 mainwindow.h -o debug\moc_mainwindow.cpp " AdditionalDependencies="Rem;mainwindow.h" Outputs="debug\moc_mainwindow.cpp" /> @@ -412,27 +472,23 @@ <Tool Name="VCCustomBuildTool" Description="MOC mainwindow.h" - CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile release\moc_mainwindow.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include" -I"." -I"$(QTDIR)\include\ActiveQt" -I"release" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 mainwindow.h -o release\moc_mainwindow.cpp " + CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile release\moc_mainwindow.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include\QtXml" -I"$(QTDIR)\include" -I"..\src\include" -I"..\libs\apr\include" -I"..\libs\libteletone\src" -I"$(QTDIR)\include\ActiveQt" -I"release" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 mainwindow.h -o release\moc_mainwindow.cpp " AdditionalDependencies="Rem;mainwindow.h" Outputs="release\moc_mainwindow.cpp" /> </FileConfiguration> </File> <File - RelativePath="mod_qsettings\mod_qsettings.h" - > - </File> - <File - RelativePath=".\preferences\prefaccounts.h" + RelativePath="preferences\prefaccounts.h" > <FileConfiguration Name="Debug|Win32" > <Tool Name="VCCustomBuildTool" - Description="MOC prefaccounts.h" - CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile debug\moc_prefaccounts.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include" -I"." -I"$(QTDIR)\include\ActiveQt" -I"debug" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\prefaccounts.h -o debug\moc_prefaccounts.cpp " - AdditionalDependencies="Rem;prefaccounts.h" + Description="MOC preferences\prefaccounts.h" + CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile debug\moc_prefaccounts.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include\QtXml" -I"$(QTDIR)\include" -I"..\src\include" -I"..\libs\apr\include" -I"..\libs\libteletone\src" -I"$(QTDIR)\include\ActiveQt" -I"debug" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\prefaccounts.h -o debug\moc_prefaccounts.cpp " + AdditionalDependencies="Rem;preferences\prefaccounts.h" Outputs="debug\moc_prefaccounts.cpp" /> </FileConfiguration> @@ -441,9 +497,9 @@ > <Tool Name="VCCustomBuildTool" - Description="MOC prefaccounts.h" - CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile release\moc_prefaccounts.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include" -I"." -I"$(QTDIR)\include\ActiveQt" -I"release" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\prefaccounts.h -o release\moc_prefaccounts.cpp " - AdditionalDependencies="Rem;prefaccounts.h" + Description="MOC preferences\prefaccounts.h" + CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile release\moc_prefaccounts.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include\QtXml" -I"$(QTDIR)\include" -I"..\src\include" -I"..\libs\apr\include" -I"..\libs\libteletone\src" -I"$(QTDIR)\include\ActiveQt" -I"release" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\prefaccounts.h -o release\moc_prefaccounts.cpp " + AdditionalDependencies="Rem;preferences\prefaccounts.h" Outputs="release\moc_prefaccounts.cpp" /> </FileConfiguration> @@ -456,9 +512,9 @@ > <Tool Name="VCCustomBuildTool" - Description="MOC prefdialog.h" - CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile debug\moc_prefdialog.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include" -I"." -I"$(QTDIR)\include\ActiveQt" -I"debug" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\prefdialog.h -o debug\moc_prefdialog.cpp " - AdditionalDependencies="Rem;prefdialog.h" + Description="MOC preferences\prefdialog.h" + CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile debug\moc_prefdialog.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include\QtXml" -I"$(QTDIR)\include" -I"..\src\include" -I"..\libs\apr\include" -I"..\libs\libteletone\src" -I"$(QTDIR)\include\ActiveQt" -I"debug" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\prefdialog.h -o debug\moc_prefdialog.cpp " + AdditionalDependencies="Rem;preferences\prefdialog.h" Outputs="debug\moc_prefdialog.cpp" /> </FileConfiguration> @@ -467,9 +523,9 @@ > <Tool Name="VCCustomBuildTool" - Description="MOC prefdialog.h" - CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile release\moc_prefdialog.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include" -I"." -I"$(QTDIR)\include\ActiveQt" -I"release" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\prefdialog.h -o release\moc_prefdialog.cpp " - AdditionalDependencies="Rem;prefdialog.h" + Description="MOC preferences\prefdialog.h" + CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile release\moc_prefdialog.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include\QtXml" -I"$(QTDIR)\include" -I"..\src\include" -I"..\libs\apr\include" -I"..\libs\libteletone\src" -I"$(QTDIR)\include\ActiveQt" -I"release" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\prefdialog.h -o release\moc_prefdialog.cpp " + AdditionalDependencies="Rem;preferences\prefdialog.h" Outputs="release\moc_prefdialog.cpp" /> </FileConfiguration> @@ -482,9 +538,9 @@ > <Tool Name="VCCustomBuildTool" - Description="MOC prefportaudio.h" - CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile debug\moc_prefportaudio.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include" -I"." -I"$(QTDIR)\include\ActiveQt" -I"debug" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\prefportaudio.h -o debug\moc_prefportaudio.cpp " - AdditionalDependencies="Rem;prefportaudio.h" + Description="MOC preferences\prefportaudio.h" + CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile debug\moc_prefportaudio.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include\QtXml" -I"$(QTDIR)\include" -I"..\src\include" -I"..\libs\apr\include" -I"..\libs\libteletone\src" -I"$(QTDIR)\include\ActiveQt" -I"debug" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\prefportaudio.h -o debug\moc_prefportaudio.cpp " + AdditionalDependencies="Rem;preferences\prefportaudio.h" Outputs="debug\moc_prefportaudio.cpp" /> </FileConfiguration> @@ -493,9 +549,9 @@ > <Tool Name="VCCustomBuildTool" - Description="MOC prefportaudio.h" - CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile release\moc_prefportaudio.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include" -I"." -I"$(QTDIR)\include\ActiveQt" -I"release" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\prefportaudio.h -o release\moc_prefportaudio.cpp " - AdditionalDependencies="Rem;prefportaudio.h" + Description="MOC preferences\prefportaudio.h" + CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile release\moc_prefportaudio.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include\QtXml" -I"$(QTDIR)\include" -I"..\src\include" -I"..\libs\apr\include" -I"..\libs\libteletone\src" -I"$(QTDIR)\include\ActiveQt" -I"release" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\prefportaudio.h -o release\moc_prefportaudio.cpp " + AdditionalDependencies="Rem;preferences\prefportaudio.h" Outputs="release\moc_prefportaudio.cpp" /> </FileConfiguration> @@ -508,9 +564,9 @@ > <Tool Name="VCCustomBuildTool" - Description="MOC prefsofia.h" - CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile debug\moc_prefsofia.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include" -I"." -I"$(QTDIR)\include\ActiveQt" -I"debug" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\prefsofia.h -o debug\moc_prefsofia.cpp " - AdditionalDependencies="Rem;prefsofia.h" + Description="MOC preferences\prefsofia.h" + CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile debug\moc_prefsofia.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include\QtXml" -I"$(QTDIR)\include" -I"..\src\include" -I"..\libs\apr\include" -I"..\libs\libteletone\src" -I"$(QTDIR)\include\ActiveQt" -I"debug" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\prefsofia.h -o debug\moc_prefsofia.cpp " + AdditionalDependencies="Rem;preferences\prefsofia.h" Outputs="debug\moc_prefsofia.cpp" /> </FileConfiguration> @@ -519,28 +575,24 @@ > <Tool Name="VCCustomBuildTool" - Description="MOC prefportaudio.h" - CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile release\moc_prefsofia.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include" -I"." -I"$(QTDIR)\include\ActiveQt" -I"release" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\prefsofia.h -o release\moc_prefsofia.cpp " - AdditionalDependencies="Rem;prefsofia.h" + Description="MOC preferences\prefsofia.h" + CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile release\moc_prefsofia.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include\QtXml" -I"$(QTDIR)\include" -I"..\src\include" -I"..\libs\apr\include" -I"..\libs\libteletone\src" -I"$(QTDIR)\include\ActiveQt" -I"release" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\prefsofia.h -o release\moc_prefsofia.cpp " + AdditionalDependencies="Rem;preferences\prefsofia.h" Outputs="release\moc_prefsofia.cpp" /> </FileConfiguration> </File> <File - RelativePath=".\debugtools\sortfilterproxymodel.h" - > - </File> - <File - RelativePath=".\debugtools\sortfilterproxymodel.h" + RelativePath="debugtools\sortfilterproxymodel.h" > <FileConfiguration Name="Debug|Win32" > <Tool Name="VCCustomBuildTool" - Description="MOC sortfilterproxymodel.h" - CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile debug\moc_sortfilterproxymodel.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include" -I"." -I"$(QTDIR)\include\ActiveQt" -I"debug" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 debugtools\sortfilterproxymodel.h -o debug\moc_sortfilterproxymodel.cpp " - AdditionalDependencies="Rem;sortfilterproxymodel.h" + Description="MOC debugtools\sortfilterproxymodel.h" + CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile debug\moc_sortfilterproxymodel.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include\QtXml" -I"$(QTDIR)\include" -I"..\src\include" -I"..\libs\apr\include" -I"..\libs\libteletone\src" -I"$(QTDIR)\include\ActiveQt" -I"debug" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 debugtools\sortfilterproxymodel.h -o debug\moc_sortfilterproxymodel.cpp " + AdditionalDependencies="Rem;debugtools\sortfilterproxymodel.h" Outputs="debug\moc_sortfilterproxymodel.cpp" /> </FileConfiguration> @@ -549,24 +601,24 @@ > <Tool Name="VCCustomBuildTool" - Description="MOC sortfilterproxymodel.h" - CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile release\moc_sortfilterproxymodel.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include" -I"." -I"$(QTDIR)\include\ActiveQt" -I"release" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 debugtools\sortfilterproxymodel.h -o release\moc_sortfilterproxymodel.cpp " - AdditionalDependencies="Rem;sortfilterproxymodel.h" + Description="MOC debugtools\sortfilterproxymodel.h" + CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile release\moc_sortfilterproxymodel.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include\QtXml" -I"$(QTDIR)\include" -I"..\src\include" -I"..\libs\apr\include" -I"..\libs\libteletone\src" -I"$(QTDIR)\include\ActiveQt" -I"release" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 debugtools\sortfilterproxymodel.h -o release\moc_sortfilterproxymodel.cpp " + AdditionalDependencies="Rem;debugtools\sortfilterproxymodel.h" Outputs="release\moc_sortfilterproxymodel.cpp" /> </FileConfiguration> </File> <File - RelativePath=".\debugtools\statedebugdialog.h" + RelativePath="debugtools\statedebugdialog.h" > <FileConfiguration Name="Debug|Win32" > <Tool Name="VCCustomBuildTool" - Description="MOC statedebugdialog.h" - CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile debug\moc_statedebugdialog.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include" -I"." -I"$(QTDIR)\include\ActiveQt" -I"debug" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 debugtools\statedebugdialog.h -o debug\moc_statedebugdialog.cpp " - AdditionalDependencies="Rem;statedebugdialog.h" + Description="MOC debugtools\statedebugdialog.h" + CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile debug\moc_statedebugdialog.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include\QtXml" -I"$(QTDIR)\include" -I"..\src\include" -I"..\libs\apr\include" -I"..\libs\libteletone\src" -I"$(QTDIR)\include\ActiveQt" -I"debug" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 debugtools\statedebugdialog.h -o debug\moc_statedebugdialog.cpp " + AdditionalDependencies="Rem;debugtools\statedebugdialog.h" Outputs="debug\moc_statedebugdialog.cpp" /> </FileConfiguration> @@ -575,9 +627,9 @@ > <Tool Name="VCCustomBuildTool" - Description="MOC prefportaudio.h" - CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile release\moc_statedebugdialog.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include" -I"." -I"$(QTDIR)\include\ActiveQt" -I"release" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 debugtools\statedebugdialog.h -o release\moc_statedebugdialog.cpp " - AdditionalDependencies="Rem;statedebugdialog.h" + Description="MOC debugtools\statedebugdialog.h" + CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile release\moc_statedebugdialog.cpp $(QTDIR)\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"$(QTDIR)\include\QtCore" -I"$(QTDIR)\include\QtGui" -I"$(QTDIR)\include\QtXml" -I"$(QTDIR)\include" -I"..\src\include" -I"..\libs\apr\include" -I"..\libs\libteletone\src" -I"$(QTDIR)\include\ActiveQt" -I"release" -I"." -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 debugtools\statedebugdialog.h -o release\moc_statedebugdialog.cpp " + AdditionalDependencies="Rem;debugtools\statedebugdialog.h" Outputs="release\moc_statedebugdialog.cpp" /> </FileConfiguration> @@ -585,19 +637,355 @@ </Filter> <Filter Name="Generated Files" - Filter="moc;h;cpp" + Filter="cpp;c;cxx;moc;h;def;odl;idl;res;" UniqueIdentifier="{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}" > <File + RelativePath="release\moc_accountdialog.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="debug\moc_accountdialog.cpp" + > + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="release\moc_accountmanager.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="debug\moc_accountmanager.cpp" + > + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="release\moc_codecwidget.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="debug\moc_codecwidget.cpp" + > + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="release\moc_consolewindow.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="debug\moc_consolewindow.cpp" + > + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="debug\moc_fshost.cpp" + > + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="release\moc_fshost.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="release\moc_isettings.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="debug\moc_isettings.cpp" + > + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="release\moc_mainwindow.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="debug\moc_mainwindow.cpp" + > + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="release\moc_prefaccounts.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="debug\moc_prefaccounts.cpp" + > + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="debug\moc_prefdialog.cpp" + > + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="release\moc_prefdialog.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="release\moc_prefportaudio.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="debug\moc_prefportaudio.cpp" + > + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="release\moc_prefsofia.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="debug\moc_prefsofia.cpp" + > + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="release\moc_sortfilterproxymodel.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="debug\moc_sortfilterproxymodel.cpp" + > + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="release\moc_statedebugdialog.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="debug\moc_statedebugdialog.cpp" + > + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="debug\qrc_resources.cpp" + > + <FileConfiguration + Name="Release|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File + RelativePath="release\qrc_resources.cpp" + > + <FileConfiguration + Name="Debug|Win32" + ExcludedFromBuild="true" + > + <Tool + Name="VCCLCompilerTool" + /> + </FileConfiguration> + </File> + <File RelativePath="ui_accountdialog.h" > </File> <File - RelativePath=".\ui_codecwidget.h" + RelativePath="ui_codecwidget.h" > </File> <File - RelativePath=".\ui_consolewindow.h" + RelativePath="ui_consolewindow.h" > </File> <File @@ -609,305 +997,9 @@ > </File> <File - RelativePath=".\ui_statedebugdialog.h" - > - </File> - <Filter - Name="Debug" - > - <File - RelativePath="debug\moc_accountdialog.cpp" - > - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="debug\moc_codecwidget.cpp" - > - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="debug\moc_consolewindow.cpp" - > - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="Debug\moc_fshost.cpp" - > - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="debug\moc_mainwindow.cpp" - > - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath=".\debug\moc_prefaccounts.cpp" - > - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="Debug\moc_prefdialog.cpp" - > - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="debug\moc_prefportaudio.cpp" - > - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="debug\moc_prefsofia.cpp" - > - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="debug\moc_sortfilterproxymodel.cpp" - > - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="debug\moc_statedebugdialog.cpp" - > - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="debug\qrc_resources.cpp" - > - <FileConfiguration - Name="Release|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - </Filter> - <Filter - Name="Release" - > - <File - RelativePath="release\moc_accountdialog.cpp" - > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="release\moc_codecwidget.cpp" - > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="release\moc_consolewindow.cpp" - > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="release\moc_fshost.cpp" - > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="release\moc_mainwindow.cpp" - > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath=".\release\moc_prefaccounts.cpp" - > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="release\moc_prefdialog.cpp" - > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="release\moc_prefportaudio.cpp" - > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="release\moc_prefsofia.cpp" - > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="release\moc_sortfilterproxymodel.cpp" - > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="release\moc_statedebugdialog.cpp" - > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - <File - RelativePath="release\qrc_resources.cpp" - > - <FileConfiguration - Name="Debug|Win32" - ExcludedFromBuild="true" - > - <Tool - Name="VCCLCompilerTool" - /> - </FileConfiguration> - </File> - </Filter> + RelativePath="ui_statedebugdialog.h" + > + </File> </Filter> <Filter Name="Form Files" @@ -923,9 +1015,9 @@ > <Tool Name="VCCustomBuildTool" - Description="UIC accountdialog.ui" + Description="UIC preferences\accountdialog.ui" CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile .\ui_accountdialog.h $(QTDIR)\bin\uic.exe preferences\accountdialog.ui -o ui_accountdialog.h " - AdditionalDependencies="Rem;accountdialog.ui" + AdditionalDependencies="Rem;preferences\accountdialog.ui" Outputs="ui_accountdialog.h" /> </FileConfiguration> @@ -934,24 +1026,24 @@ > <Tool Name="VCCustomBuildTool" - Description="UIC accountdialog.ui" + Description="UIC preferences\accountdialog.ui" CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile .\ui_accountdialog.h $(QTDIR)\bin\uic.exe preferences\accountdialog.ui -o ui_accountdialog.h " - AdditionalDependencies="Rem;accountdialog.ui" + AdditionalDependencies="Rem;preferences\accountdialog.ui" Outputs="ui_accountdialog.h" /> </FileConfiguration> </File> <File - RelativePath=".\widgets\codecwidget.ui" + RelativePath="widgets\codecwidget.ui" > <FileConfiguration Name="Debug|Win32" > <Tool Name="VCCustomBuildTool" - Description="UIC codecwidget.ui" + Description="UIC widgets\codecwidget.ui" CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile .\ui_codecwidget.h $(QTDIR)\bin\uic.exe widgets\codecwidget.ui -o ui_codecwidget.h " - AdditionalDependencies="Rem;codecwidgets.ui" + AdditionalDependencies="Rem;widgets\codecwidget.ui" Outputs="ui_codecwidget.h" /> </FileConfiguration> @@ -960,24 +1052,24 @@ > <Tool Name="VCCustomBuildTool" - Description="UIC codecwidget.ui" + Description="UIC widgets\codecwidget.ui" CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile .\ui_codecwidget.h $(QTDIR)\bin\uic.exe widgets\codecwidget.ui -o ui_codecwidget.h " - AdditionalDependencies="Rem;codecwidget.ui" + AdditionalDependencies="Rem;widgets\codecwidget.ui" Outputs="ui_codecwidget.h" /> </FileConfiguration> </File> <File - RelativePath=".\debugtools\consolewindow.ui" + RelativePath="debugtools\consolewindow.ui" > <FileConfiguration Name="Debug|Win32" > <Tool Name="VCCustomBuildTool" - Description="UIC consolewindow.ui" + Description="UIC debugtools\consolewindow.ui" CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile .\ui_consolewindow.h $(QTDIR)\bin\uic.exe debugtools\consolewindow.ui -o ui_consolewindow.h " - AdditionalDependencies="Rem;consolewindow.ui" + AdditionalDependencies="Rem;debugtools\consolewindow.ui" Outputs="ui_consolewindow.h" /> </FileConfiguration> @@ -986,9 +1078,9 @@ > <Tool Name="VCCustomBuildTool" - Description="UIC accountdialog.ui" + Description="UIC debugtools\consolewindow.ui" CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile .\ui_consolewindow.h $(QTDIR)\bin\uic.exe debugtools\consolewindow.ui -o ui_consolewindow.h " - AdditionalDependencies="Rem;accountdialog.ui" + AdditionalDependencies="Rem;debugtools\consolewindow.ui" Outputs="ui_consolewindow.h" /> </FileConfiguration> @@ -1027,9 +1119,9 @@ > <Tool Name="VCCustomBuildTool" - Description="UIC prefdialog.ui" + Description="UIC preferences\prefdialog.ui" CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile .\ui_prefdialog.h $(QTDIR)\bin\uic.exe preferences\prefdialog.ui -o ui_prefdialog.h " - AdditionalDependencies="Rem;prefdialog.ui" + AdditionalDependencies="Rem;preferences\prefdialog.ui;widgets\codecwidget.h" Outputs="ui_prefdialog.h" /> </FileConfiguration> @@ -1038,24 +1130,24 @@ > <Tool Name="VCCustomBuildTool" - Description="UIC prefdialog.ui" + Description="UIC preferences\prefdialog.ui" CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile .\ui_prefdialog.h $(QTDIR)\bin\uic.exe preferences\prefdialog.ui -o ui_prefdialog.h " - AdditionalDependencies="Rem;prefdialog.ui" + AdditionalDependencies="Rem;preferences\prefdialog.ui;widgets\codecwidget.h" Outputs="ui_prefdialog.h" /> </FileConfiguration> </File> <File - RelativePath=".\debugtools\statedebugdialog.ui" + RelativePath="debugtools\statedebugdialog.ui" > <FileConfiguration Name="Debug|Win32" > <Tool Name="VCCustomBuildTool" - Description="UIC statedebugdialog.ui" + Description="UIC debugtools\statedebugdialog.ui" CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile .\ui_statedebugdialog.h $(QTDIR)\bin\uic.exe debugtools\statedebugdialog.ui -o ui_statedebugdialog.h " - AdditionalDependencies="Rem;statedebugdialog.ui" + AdditionalDependencies="Rem;debugtools\statedebugdialog.ui" Outputs="ui_statedebugdialog.h" /> </FileConfiguration> @@ -1064,9 +1156,9 @@ > <Tool Name="VCCustomBuildTool" - Description="UIC statedebugdialog.ui" + Description="UIC debugtools\statedebugdialog.ui" CommandLine="Rem IncrediBuild_AllowRemote Rem IncrediBuild_OutputFile .\ui_statedebugdialog.h $(QTDIR)\bin\uic.exe debugtools\statedebugdialog.ui -o ui_statedebugdialog.h " - AdditionalDependencies="Rem;statedebugdialog.ui" + AdditionalDependencies="Rem;debugtools\statedebugdialog.ui" Outputs="ui_statedebugdialog.h" /> </FileConfiguration> @@ -1079,23 +1171,19 @@ ParseFiles="false" > <File - RelativePath="conf\event_socket.conf.xml" + RelativePath="conf\freeswitch.xml" > </File> <File - RelativePath="conf\accounts\example.xml" + RelativePath="resources\pref_accounts.jpg" > </File> <File - RelativePath="conf\freeswitch.xml" - > - </File> - <File - RelativePath="conf\portaudio.conf.xml" + RelativePath="resources\pref_audio.gif" > </File> <File - RelativePath="resources\pref_audio.gif" + RelativePath="resources\pref_general.jpg" > </File> <File @@ -1112,7 +1200,7 @@ Name="VCCustomBuildTool" Description="RCC resources.qrc" CommandLine="$(QTDIR)\bin\rcc.exe -name resources resources.qrc -o debug\qrc_resources.cpp " - AdditionalDependencies="$(QTDIR)\bin\rcc.exe;conf\accounts\example.xml;conf\event_socket.conf.xml;conf\freeswitch.xml;conf\portaudio.conf.xml;resources.qrc;resources\pref_audio.gif;resources\pref_sip.png;resources\splash.png" + AdditionalDependencies="$(QTDIR)\bin\rcc.exe;conf\freeswitch.xml;resources.qrc;resources\pref_accounts.jpg;resources\pref_audio.gif;resources\pref_general.jpg;resources\pref_sip.png;resources\splash.png;resources\taskbar_icon.png;resources\test.wav" Outputs="debug\qrc_resources.cpp" /> </FileConfiguration> @@ -1123,7 +1211,7 @@ Name="VCCustomBuildTool" Description="RCC resources.qrc" CommandLine="$(QTDIR)\bin\rcc.exe -name resources resources.qrc -o release\qrc_resources.cpp " - AdditionalDependencies="$(QTDIR)\bin\rcc.exe;conf\accounts\example.xml;conf\event_socket.conf.xml;conf\freeswitch.xml;conf\portaudio.conf.xml;resources.qrc;resources\pref_audio.gif;resources\pref_sip.png;resources\splash.png" + AdditionalDependencies="$(QTDIR)\bin\rcc.exe;conf\freeswitch.xml;resources.qrc;resources\pref_accounts.jpg;resources\pref_audio.gif;resources\pref_general.jpg;resources\pref_sip.png;resources\splash.png;resources\taskbar_icon.png;resources\test.wav" Outputs="release\qrc_resources.cpp" /> </FileConfiguration> @@ -1132,6 +1220,14 @@ RelativePath="resources\splash.png" > </File> + <File + RelativePath="resources\taskbar_icon.png" + > + </File> + <File + RelativePath="resources\test.wav" + > + </File> </Filter> </Files> <Globals> diff --git a/fscomm/MakeVcProj.cmd b/fscomm/MakeVcProj.cmd new file mode 100644 index 0000000..fb0cc7a --- /dev/null +++ b/fscomm/MakeVcProj.cmd @@ -0,0 +1,5 @@ +\Qt\4.6.0\bin\qmake.exe -spec win32-msvc2008 -tp vc +copy fscomm.vcproj FSComm.2008.vcproj /y +echo "Manually copy/replace $QTDIR environment variable into project file" +echo "Push top GUID block back current" +pause \ No newline at end of file commit 9b33bd1c1c558c8192c8f03478a191756154a7ef Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Thu Aug 26 22:49:02 2010 -0400 mod_callcenter: correct multiple little things following the recent tiers and join back features diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 6014233..0c4241c 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -175,6 +175,7 @@ static char members_sql[] = " caller_name VARCHAR(255),\n" " system_epoch INTEGER NOT NULL DEFAULT 0,\n" " joined_epoch INTEGER NOT NULL DEFAULT 0,\n" +" rejoined_epoch INTEGER NOT NULL DEFAULT 0,\n" " bridge_epoch INTEGER NOT NULL DEFAULT 0,\n" " abandoned_epoch INTEGER NOT NULL DEFAULT 0,\n" " base_score INTEGER NOT NULL DEFAULT 0,\n" @@ -650,7 +651,7 @@ static cc_queue_t *load_queue(const char *queue_name) goto end; } - switch_cache_db_test_reactive(dbh, "select count(abandoned_epoch) from members", "drop table members", members_sql); + switch_cache_db_test_reactive(dbh, "select count(rejoined_epoch) from members", "drop table members", members_sql); switch_cache_db_test_reactive(dbh, "select count(ready_time) from agents", NULL, "alter table agents add ready_time integer not null default 0;" "alter table agents add reject_delay_time integer not null default 0;" "alter table agents add busy_delay_time integer not null default 0;"); @@ -1224,12 +1225,14 @@ static switch_status_t load_config(void) } } + /* Loading queue into memory struct */ if ((x_queues = switch_xml_child(cfg, "queues"))) { for (x_queue = switch_xml_child(x_queues, "queue"); x_queue; x_queue = x_queue->next) { load_queue(switch_xml_attr_soft(x_queue, "name")); } } + /* Importing from XML config Agents */ if ((x_agents = switch_xml_child(cfg, "agents"))) { for (x_agent = switch_xml_child(x_agents, "agent"); x_agent; x_agent = x_agent->next) { const char *agent = switch_xml_attr(x_agent, "name"); @@ -1239,6 +1242,7 @@ static switch_status_t load_config(void) } } + /* Importing from XML config Agent Tiers */ if ((x_tiers = switch_xml_child(cfg, "tiers"))) { for (x_tier = switch_xml_child(x_tiers, "tier"); x_tier; x_tier = x_tier->next) { const char *agent = switch_xml_attr(x_tier, "agent"); @@ -1252,7 +1256,7 @@ static switch_status_t load_config(void) cc_tier_add(queue_name, agent, cc_tier_state2str(CC_TIER_STATE_READY), atoi(level), atoi(position)); } else { /* default to level 1 and position 1 within the level */ - cc_tier_add(queue_name, agent, cc_tier_state2str(CC_TIER_STATE_READY), 0, 1); + cc_tier_add(queue_name, agent, cc_tier_state2str(CC_TIER_STATE_READY), 0, 0); } } else { if (level) { @@ -1762,8 +1766,8 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName abandoned_epoch = atol(argv[4]); } /* Once we pass a certain point, we want to get rid of the abandoned call */ - if (abandoned_epoch + discard_abandoned_after> (long) switch_epoch_time_now(NULL)) { - sql = switch_mprintf("DELETE FROM members WHERE system = 'single_box' AND uuid = '%q'", argv[1]); + if (abandoned_epoch + discard_abandoned_after < (long) switch_epoch_time_now(NULL)) { + sql = switch_mprintf("DELETE FROM members WHERE system = 'single_box' AND uuid = '%q' AND (abandoned_epoch = '%ld' OR joined_epoch = '%q')", argv[1], abandoned_epoch, argv[4]); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); } @@ -1998,14 +2002,15 @@ SWITCH_STANDARD_APP(callcenter_function) /* Grab the start epoch of a channel */ times = switch_channel_get_timetable(member_channel); - switch_snprintf(start_epoch, sizeof(start_epoch), "%" SWITCH_TIME_T_FMT, times->answered); + switch_snprintf(start_epoch, sizeof(start_epoch), "%" SWITCH_TIME_T_FMT, times->answered / 1000000); /* Check of we have a queued abandoned member we can resume from */ if (queue->abandoned_resume_allowed == SWITCH_TRUE) { char res[256]; /* Check to see if agent already exist */ - sql = switch_mprintf("SELECT abandoned_epoch FROM members WHERE caller_number = '%q' AND state = '%q'", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), cc_member_state2str(CC_MEMBER_STATE_ABANDONED)); + sql = switch_mprintf("SELECT abandoned_epoch FROM members WHERE queue = '%q' AND caller_number = '%q' AND state = '%q' ORDER BY abandoned_epoch DESC", + queue_name, switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), cc_member_state2str(CC_MEMBER_STATE_ABANDONED)); cc_execute_sql2str(NULL, NULL, sql, res, sizeof(res)); switch_safe_free(sql); abandoned_epoch = atol(res); @@ -2018,7 +2023,7 @@ SWITCH_STANDARD_APP(callcenter_function) /* If system, will add the total time the session is up to the base score */ if (!switch_strlen_zero(start_epoch) && !strcasecmp("system", queue->time_base_score)) { - cc_base_score_int += (switch_epoch_time_now(NULL) - atoi(start_epoch)); + cc_base_score_int += ((long) switch_epoch_time_now(NULL) - atol(start_epoch)); } if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CALLCENTER_EVENT) == SWITCH_STATUS_SUCCESS) { @@ -2037,8 +2042,8 @@ SWITCH_STANDARD_APP(callcenter_function) if (abandoned_epoch == 0) { /* Add the caller to the member queue */ sql = switch_mprintf("INSERT INTO members" - " (queue,system,uuid,system_epoch,joined_epoch,base_score,skill_score, caller_number, caller_name, serving_agent, serving_system, state)" - " VALUES('%q','single_box', '%q', '%q', '%ld','%d','%d','%q','%q','%q','','%q')", + " (queue,system,uuid,system_epoch,joined_epoch,base_score,skill_score,caller_number,caller_name,serving_agent,serving_system,state)" + " VALUES('%q','single_box','%q','%q','%ld','%d','%d','%q','%q','%q','','%q')", queue_name, uuid, start_epoch, @@ -2054,13 +2059,13 @@ SWITCH_STANDARD_APP(callcenter_function) } else { char res[256]; /* Update abandoned member */ - sql = switch_mprintf("UPDATE members SET uuid = '%q', state = '%q', rejoined_epoch = '%q' WHERE caller_number = '%q' AND abandoned_epoch = '%q' AND state = '%q'" - , uuid, cc_member_state2str(CC_MEMBER_STATE_WAITING), (long) switch_epoch_time_now(NULL), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), abandoned_epoch, cc_member_state2str(CC_MEMBER_STATE_ABANDONED)); + sql = switch_mprintf("UPDATE members SET uuid = '%q', state = '%q', rejoined_epoch = '%ld' WHERE caller_number = '%q' AND abandoned_epoch = '%ld' AND state = '%q' AND queue = '%q'", + uuid, cc_member_state2str(CC_MEMBER_STATE_WAITING), (long) switch_epoch_time_now(NULL), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), abandoned_epoch, cc_member_state2str(CC_MEMBER_STATE_ABANDONED), queue_name); cc_execute_sql(queue, sql, NULL); switch_safe_free(sql); /* Confirm we took that member in */ - sql = switch_mprintf("SELECT abandoned_epoch FROM members WHERE uuid = '%q' AND state = '%q'", uuid, cc_member_state2str(CC_MEMBER_STATE_WAITING)); + sql = switch_mprintf("SELECT abandoned_epoch FROM members WHERE uuid = '%q' AND state = '%q' AND queue = '%q'", uuid, cc_member_state2str(CC_MEMBER_STATE_WAITING), queue_name); cc_execute_sql2str(NULL, NULL, sql, res, sizeof(res)); switch_safe_free(sql); commit 37c224670e1e847de2be0b75fa7a5ab4d06f0010 Author: Andrew Thompson <andrew@hijacked.us> Date: Thu Aug 26 18:35:22 2010 -0400 Unify gateway printing between 'sofia xmlstatus gateway' and 'sofia xmlstatus gateway <gatewayname>' diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 8c47246..019bb9f 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -2658,6 +2658,47 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t return SWITCH_STATUS_SUCCESS; } +static void xml_gateway_status(sofia_gateway_t *gp, switch_stream_handle_t *stream) +{ + char xmlbuf[2096]; + const int buflen = 2096; + + stream->write_function(stream, " <gateway>\n"); + stream->write_function(stream, " <name>%s</name>\n", switch_str_nil(gp->name)); + stream->write_function(stream, " <profile>%s</profile>\n", gp->profile->name); + stream->write_function(stream, " <scheme>%s</scheme>\n", switch_str_nil(gp->register_scheme)); + stream->write_function(stream, " <realm>%s</realm>\n", switch_str_nil(gp->register_realm)); + stream->write_function(stream, " <username>%s</username>\n", switch_str_nil(gp->register_username)); + stream->write_function(stream, " <password>%s</password>\n", zstr(gp->register_password) ? "no" : "yes"); + stream->write_function(stream, " <from>%s</from>\n", switch_amp_encode(switch_str_nil(gp->register_from), xmlbuf, buflen)); + stream->write_function(stream, " <contact>%s</contact>\n", switch_amp_encode(switch_str_nil(gp->register_contact), xmlbuf, buflen)); + stream->write_function(stream, " <exten>%s</exten>\n", switch_amp_encode(switch_str_nil(gp->extension), xmlbuf, buflen)); + stream->write_function(stream, " <to>%s</to>\n", switch_str_nil(gp->register_to)); + stream->write_function(stream, " <proxy>%s</proxy>\n", switch_str_nil(gp->register_proxy)); + stream->write_function(stream, " <context>%s</context>\n", switch_str_nil(gp->register_context)); + stream->write_function(stream, " <expires>%s</expires>\n", switch_str_nil(gp->expires_str)); + stream->write_function(stream, " <freq>%d</freq>\n", gp->freq); + stream->write_function(stream, " <ping>%d</ping>\n", gp->ping); + stream->write_function(stream, " <pingfreq>%d</pingfreq>\n", gp->ping_freq); + stream->write_function(stream, " <state>%s</state>\n", sofia_state_names[gp->state]); + stream->write_function(stream, " <status>%s%s</status>\n", status_names[gp->status], gp->pinging ? " (ping)" : ""); + stream->write_function(stream, " <calls-in>%d</calls-in>\n", gp->ib_calls); + stream->write_function(stream, " <calls-out>%d</calls-out>\n", gp->ob_calls); + stream->write_function(stream, " <failed-calls-in>%d</failed-calls-in>\n", gp->ib_failed_calls); + stream->write_function(stream, " <failed-calls-out>%d</failed-calls-out>\n", gp->ob_failed_calls); + + if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_TRYING) { + time_t now = switch_epoch_time_now(NULL); + if (gp->retry > now) { + stream->write_function(stream, " <retry>%ds</retry>\n", gp->retry - now); + } else { + stream->write_function(stream, " <retry>NEVER</retry>\n"); + } + } + + stream->write_function(stream, " </gateway>\n"); +} + static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handle_t *stream) { sofia_profile_t *profile = NULL; @@ -2665,8 +2706,6 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl switch_hash_index_t *hi; void *val; const void *vvar; - const int buflen = 2096; - char xmlbuf[2096]; int c = 0; int ac = 0; const char *header = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"; @@ -2688,24 +2727,7 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl for (gp = profile->gateways; gp; gp = gp->next) { switch_assert(gp->state < REG_STATE_LAST); - stream->write_function(stream, "\t<gateway>\n"); - stream->write_function(stream, "\t\t<profile>%s</profile>\n", profile->name); - stream->write_function(stream, "\t\t<to>%s</to>\n", gp->register_to); - stream->write_function(stream, "\t\t<state>%s</state>\n", sofia_state_names[gp->state]); - stream->write_function(stream, "\t\t<calls-in>%ld</calls-in>\n", gp->ib_calls); - stream->write_function(stream, "\t\t<calls-out>%ld</calls-out>\n", gp->ob_calls); - stream->write_function(stream, "\t\t<failed-calls-in>%ld</failed-calls-in>\n", gp->ib_failed_calls); - stream->write_function(stream, "\t\t<failed-calls-out>%ld</failed-calls-out>\n", gp->ob_failed_calls); - - if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_TRYING) { - time_t now = switch_epoch_time_now(NULL); - if (gp->retry > now) { - stream->write_function(stream, "\t\t<retry>%ds</retry>\n", gp->retry - now); - } else { - stream->write_function(stream, "\t\t<retry>NEVER</retry>\n"); - } - } - stream->write_function(stream, "\t</gateway>\n"); + xml_gateway_status(gp, stream); } } } @@ -2713,36 +2735,12 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl switch_mutex_unlock(mod_sofia_globals.hash_mutex); stream->write_function(stream, "</gateways>\n"); - return SWITCH_STATUS_SUCCESS; - } - if (!strcasecmp(argv[0], "gateway")) { + } else if (argc == 1 && !strcasecmp(argv[0], "profile")) { + } else if (!strcasecmp(argv[0], "gateway")) { if ((gp = sofia_reg_find_gateway(argv[1]))) { switch_assert(gp->state < REG_STATE_LAST); stream->write_function(stream, "%s\n", header); - stream->write_function(stream, " <gateway>\n"); - stream->write_function(stream, " <name>%s</name>\n", switch_str_nil(gp->name)); - stream->write_function(stream, " <profile>%s</profile>\n", gp->profile->name); - stream->write_function(stream, " <scheme>%s</scheme>\n", switch_str_nil(gp->register_scheme)); - stream->write_function(stream, " <realm>%s</realm>\n", switch_str_nil(gp->register_realm)); - stream->write_function(stream, " <username>%s</username>\n", switch_str_nil(gp->register_username)); - stream->write_function(stream, " <password>%s</password>\n", zstr(gp->register_password) ? "no" : "yes"); - stream->write_function(stream, " <from>%s</from>\n", switch_amp_encode(switch_str_nil(gp->register_from), xmlbuf, buflen)); - stream->write_function(stream, " <contact>%s</contact>\n", switch_amp_encode(switch_str_nil(gp->register_contact), xmlbuf, buflen)); - stream->write_function(stream, " <exten>%s</exten>\n", switch_amp_encode(switch_str_nil(gp->extension), xmlbuf, buflen)); - stream->write_function(stream, " <to>%s</to>\n", switch_str_nil(gp->register_to)); - stream->write_function(stream, " <proxy>%s</proxy>\n", switch_str_nil(gp->register_proxy)); - stream->write_function(stream, " <context>%s</context>\n", switch_str_nil(gp->register_context)); - stream->write_function(stream, " <expires>%s</expires>\n", switch_str_nil(gp->expires_str)); - stream->write_function(stream, " <freq>%d</freq>\n", gp->freq); - stream->write_function(stream, " <ping>%d</ping>\n", gp->ping); - stream->write_function(stream, " <pingfreq>%d</pingfreq>\n", gp->ping_freq); - stream->write_function(stream, " <state>%s</state>\n", sofia_state_names[gp->state]); - stream->write_function(stream, " <status>%s%s</status>\n", status_names[gp->status], gp->pinging ? " (ping)" : ""); - stream->write_function(stream, " <calls-in>%d</calls-in>\n", gp->ib_calls); - stream->write_function(stream, " <calls-out>%d</calls-out>\n", gp->ob_calls); - stream->write_function(stream, " <failed-calls-in>%d</failed-calls-in>\n", gp->ib_failed_calls); - stream->write_function(stream, " <failed-calls-out>%d</failed-calls-out>\n", gp->ob_failed_calls); - stream->write_function(stream, " </gateway>\n"); + xml_gateway_status(gp, stream); sofia_reg_release_gateway(gp); } else { stream->write_function(stream, "Invalid Gateway!\n"); commit 3be9460406361cfd286b657dc4502e4008043964 Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Aug 26 14:08:42 2010 -0500 fix build diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index 4fca410..2f640a8 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -97,7 +97,7 @@ switch_status_t skinny_create_incoming_session(listener_t *listener, uint32_t *l } if (!(nsession = switch_core_session_request(skinny_get_endpoint_interface(), - SWITCH_CALL_DIRECTION_INBOUND, NULL))) { + SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Creating Session\n"); goto error; } commit 7df3e18c6aa58fc3b804376ffaed2269c68c1e70 Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Aug 26 13:55:13 2010 -0500 fix windows build diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx index 031effd..908a851 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx @@ -6529,19 +6529,21 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_request_xml(void * jarg } -SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_request_uuid(void * jarg1, int jarg2, void * jarg3, char * jarg4) { +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_request_uuid(void * jarg1, int jarg2, unsigned long jarg3, void * jarg4, char * jarg5) { void * jresult ; switch_endpoint_interface_t *arg1 = (switch_endpoint_interface_t *) 0 ; switch_call_direction_t arg2 ; - switch_memory_pool_t **arg3 = (switch_memory_pool_t **) 0 ; - char *arg4 = (char *) 0 ; + switch_originate_flag_t arg3 ; + switch_memory_pool_t **arg4 = (switch_memory_pool_t **) 0 ; + char *arg5 = (char *) 0 ; switch_core_session_t *result = 0 ; arg1 = (switch_endpoint_interface_t *)jarg1; arg2 = (switch_call_direction_t)jarg2; - arg3 = (switch_memory_pool_t **)jarg3; - arg4 = (char *)jarg4; - result = (switch_core_session_t *)switch_core_session_request_uuid(arg1,arg2,arg3,(char const *)arg4); + arg3 = (switch_originate_flag_t)jarg3; + arg4 = (switch_memory_pool_t **)jarg4; + arg5 = (char *)jarg5; + result = (switch_core_session_t *)switch_core_session_request_uuid(arg1,arg2,arg3,arg4,(char const *)arg5); jresult = (void *)result; return jresult; } diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs index 8930e7b..2681875 100644 --- a/src/mod/languages/mod_managed/managed/swig.2010.cs +++ b/src/mod/languages/mod_managed/managed/swig.2010.cs @@ -1211,8 +1211,8 @@ public class freeswitch { return ret; } - public static SWIGTYPE_p_switch_core_session switch_core_session_request_uuid(switch_endpoint_interface endpoint_interface, switch_call_direction_t direction, SWIGTYPE_p_p_apr_pool_t pool, string use_uuid) { - IntPtr cPtr = freeswitchPINVOKE.switch_core_session_request_uuid(switch_endpoint_interface.getCPtr(endpoint_interface), (int)direction, SWIGTYPE_p_p_apr_pool_t.getCPtr(pool), use_uuid); + public static SWIGTYPE_p_switch_core_session switch_core_session_request_uuid(switch_endpoint_interface endpoint_interface, switch_call_direction_t direction, uint originate_flags, SWIGTYPE_p_p_apr_pool_t pool, string use_uuid) { + IntPtr cPtr = freeswitchPINVOKE.switch_core_session_request_uuid(switch_endpoint_interface.getCPtr(endpoint_interface), (int)direction, originate_flags, SWIGTYPE_p_p_apr_pool_t.getCPtr(pool), use_uuid); SWIGTYPE_p_switch_core_session ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false); return ret; } @@ -6889,7 +6889,7 @@ class freeswitchPINVOKE { public static extern IntPtr switch_core_session_request_xml(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3); [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_request_uuid")] - public static extern IntPtr switch_core_session_request_uuid(HandleRef jarg1, int jarg2, HandleRef jarg3, string jarg4); + public static extern IntPtr switch_core_session_request_uuid(HandleRef jarg1, int jarg2, uint jarg3, HandleRef jarg4, string jarg5); [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_uuid")] public static extern int switch_core_session_set_uuid(HandleRef jarg1, string jarg2); @@ -26653,7 +26653,8 @@ namespace FreeSWITCH.Native { SOF_NOBLOCK = (1 << 0), SOF_FORKED_DIAL = (1 << 1), SOF_NO_EFFECTIVE_CID_NUM = (1 << 2), - SOF_NO_EFFECTIVE_CID_NAME = (1 << 3) + SOF_NO_EFFECTIVE_CID_NAME = (1 << 3), + SOF_NO_LIMITS = (1 << 4) } } diff --git a/src/switch.c b/src/switch.c index 9183121..b59097a 100644 --- a/src/switch.c +++ b/src/switch.c @@ -271,13 +271,13 @@ int main(int argc, char *argv[]) switch_size_t pid_len, old_pid_len; const char *err = NULL; /* error value for return from freeswitch initialization */ #ifndef WIN32 - int nf = 0; /* TRUE if we are running in nofork mode */ int bf = 0; char *runas_user = NULL; char *runas_group = NULL; #else int win32_service = 0; #endif + int nf = 0; /* TRUE if we are running in nofork mode */ int nc = 0; /* TRUE if we are running in noconsole mode */ pid_t pid = 0; int i, x; @@ -813,9 +813,11 @@ int main(int argc, char *argv[]) return 255; } +#ifndef WIN32 if(bf) { daemonize(); } +#endif switch_core_runtime_loop(nc); commit 2a730984d2989d943a839594e059f914fd1b9085 Author: Mathieu Rene <mrene@avgs.ca> Date: Thu Aug 26 14:50:50 2010 -0400 mod_sofia: fix compile diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 6fcb06c..8c47246 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3544,7 +3544,7 @@ SWITCH_STANDARD_API(sofia_function) sofia_glue_recover(SWITCH_TRUE); stream->write_function(stream, "Flushing recovery database.\n"); } else { - x = sofia_glue_recover(SWITCH_FALSE); + int x = sofia_glue_recover(SWITCH_FALSE); if (x) { stream->write_function(stream, "Recovered %d call(s)\n", x); commit f26a69724292636f19aa651eb2569b41031ed726 Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Aug 26 12:34:24 2010 -0500 FSCORE-652 diff --git a/src/switch.c b/src/switch.c index a28baba..9183121 100644 --- a/src/switch.c +++ b/src/switch.c @@ -272,6 +272,7 @@ int main(int argc, char *argv[]) const char *err = NULL; /* error value for return from freeswitch initialization */ #ifndef WIN32 int nf = 0; /* TRUE if we are running in nofork mode */ + int bf = 0; char *runas_user = NULL; char *runas_group = NULL; #else @@ -328,6 +329,7 @@ int main(int argc, char *argv[]) "\t-monotonic-clock -- use monotonic clock as timer source\n" #else "\t-nf -- no forking\n" + "\t-bf -- block until fully started, then fork\n" "\t-u [user] -- specify user to switch to\n" "\t-g [group] -- specify group to switch to\n" #endif "\t-help -- this message\n" "\t-version -- print the version and exit\n" @@ -461,6 +463,11 @@ int main(int argc, char *argv[]) known_opt++; } + if (local_argv[x] && !strcmp(local_argv[x], "-bf")) { + bf++; + known_opt++; + } + if (local_argv[x] && !strcmp(local_argv[x], "-version")) { fprintf(stdout, "FreeSWITCH version: %s\n", SWITCH_VERSION_FULL); return 0; @@ -523,8 +530,14 @@ int main(int argc, char *argv[]) } if (local_argv[x] && !strcmp(local_argv[x], "-nc")) { - nc++; - known_opt++; + if (!nf) { + nc++; + known_opt++; + } else { + /* The flags -nc and -nf are mutually exclusive. Ignoring -nc. */ + nc = 0; + known_opt++; + } } if (local_argv[x] && !strcmp(local_argv[x], "-c")) { @@ -685,7 +698,7 @@ int main(int argc, char *argv[]) #ifdef WIN32 FreeConsole(); #else - if (!nf) { + if (!nf && !bf) { daemonize(); } #endif @@ -800,6 +813,10 @@ int main(int argc, char *argv[]) return 255; } + if(bf) { + daemonize(); + } + switch_core_runtime_loop(nc); destroy_status = switch_core_destroy(); commit 6fe6e67573e8247e7e5b508fe852c4aae8aea64e Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Aug 26 12:20:14 2010 -0500 pass originate flags into session_request so we can selectivly skip throttling diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 25010d9..c98117c 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1311,7 +1311,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi } } - if ((*new_session = switch_core_session_request(freetdm_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) { + if ((*new_session = switch_core_session_request(freetdm_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, flags, pool)) != 0) { private_t *tech_pvt; switch_caller_profile_t *caller_profile; switch_channel_t *channel = switch_core_session_get_channel(*new_session); @@ -1411,7 +1411,7 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session spanid = ftdm_channel_get_span_id(sigmsg->channel); chanid = ftdm_channel_get_id(sigmsg->channel); - if (!(session = switch_core_session_request(freetdm_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL))) { + if (!(session = switch_core_session_request(freetdm_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Initilization Error!\n"); return FTDM_FAIL; } diff --git a/libs/openzap/mod_openzap/mod_openzap.c b/libs/openzap/mod_openzap/mod_openzap.c index 445725b..8425372 100644 --- a/libs/openzap/mod_openzap/mod_openzap.c +++ b/libs/openzap/mod_openzap/mod_openzap.c @@ -1298,7 +1298,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi } } - if ((*new_session = switch_core_session_request(openzap_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) { + if ((*new_session = switch_core_session_request(openzap_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, flags, pool)) != 0) { private_t *tech_pvt; switch_caller_profile_t *caller_profile; switch_channel_t *channel = switch_core_session_get_channel(*new_session); @@ -1373,7 +1373,7 @@ zap_status_t zap_channel_from_event(zap_sigmsg_t *sigmsg, switch_core_session_t *sp = NULL; - if (!(session = switch_core_session_request(openzap_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL))) { + if (!(session = switch_core_session_request(openzap_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Initilization Error!\n"); return ZAP_FAIL; } commit 46c6650a947a4d1733058ecfb2e7f9e098f847aa Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Aug 26 12:19:49 2010 -0500 pass originate flags into session_request so we can selectivly skip throttling diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 650ffc1..7275f26 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -614,8 +614,10 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_xml(switch_e */ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(_In_ switch_endpoint_interface_t *endpoint_interface, _In_ switch_call_direction_t direction, - _Inout_opt_ switch_memory_pool_t **pool, _In_opt_z_ const char *use_uuid); -#define switch_core_session_request(_ep, _d, _p) switch_core_session_request_uuid(_ep, _d, _p, NULL) + switch_originate_flag_t originate_flags, + _Inout_opt_ switch_memory_pool_t **pool, + _In_opt_z_ const char *use_uuid); +#define switch_core_session_request(_ep, _d, _f, _p) switch_core_session_request_uuid(_ep, _d, _f, _p, NULL) SWITCH_DECLARE(switch_status_t) switch_core_session_set_uuid(_In_ switch_core_session_t *session, _In_z_ const char *use_uuid); diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 70ae155..dacf2dd 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -220,7 +220,8 @@ typedef enum { SOF_NOBLOCK = (1 << 0), SOF_FORKED_DIAL = (1 << 1), SOF_NO_EFFECTIVE_CID_NUM = (1 << 2), - SOF_NO_EFFECTIVE_CID_NAME = (1 << 3) + SOF_NO_EFFECTIVE_CID_NAME = (1 << 3), + SOF_NO_LIMITS = (1 << 4) } switch_originate_flag_enum_t; typedef uint32_t switch_originate_flag_t; diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 3a1863c..5128e3b 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -4771,7 +4771,7 @@ static switch_status_t conference_outcall(conference_obj_t *conference, if (conference == NULL) { char *dialstr = switch_mprintf("{ignore_early_media=true}%s", bridgeto); - status = switch_ivr_originate(NULL, &peer_session, cause, dialstr, 60, NULL, cid_name, cid_num, NULL, NULL, SOF_NONE, NULL); + status = switch_ivr_originate(NULL, &peer_session, cause, dialstr, 60, NULL, cid_name, cid_num, NULL, NULL, SOF_NO_LIMITS, NULL); switch_safe_free(dialstr); if (status != SWITCH_STATUS_SUCCESS) { @@ -4804,7 +4804,7 @@ static switch_status_t conference_outcall(conference_obj_t *conference, /* establish an outbound call leg */ - if (switch_ivr_originate(session, &peer_session, cause, bridgeto, timeout, NULL, cid_name, cid_num, NULL, NULL, SOF_NONE, NULL) != + if (switch_ivr_originate(session, &peer_session, cause, bridgeto, timeout, NULL, cid_name, cid_num, NULL, NULL, SOF_NO_LIMITS, NULL) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot create outgoing channel, cause: %s\n", switch_channel_cause2str(*cause)); diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 5a1b8c5..5542927 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -2814,6 +2814,10 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session, switch_event_destroy(&event); } + if ((flags & SOF_NO_LIMITS)) { + myflags |= SOF_NO_LIMITS; + } + if ((flags & SOF_FORKED_DIAL)) { myflags |= SOF_NOBLOCK; } diff --git a/src/mod/endpoints/mod_alsa/mod_alsa.c b/src/mod/endpoints/mod_alsa/mod_alsa.c index b9ab1b2..065386b 100644 --- a/src/mod/endpoints/mod_alsa/mod_alsa.c +++ b/src/mod/endpoints/mod_alsa/mod_alsa.c @@ -766,7 +766,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi switch_call_cause_t *cancel_cause) { - if ((*new_session = switch_core_session_request(&channel_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) { + if ((*new_session = switch_core_session_request(&channel_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, flags, pool)) != 0) { private_t *tech_pvt; switch_channel_t *channel; switch_caller_profile_t *caller_profile; @@ -1437,7 +1437,7 @@ static switch_status_t place_call(char **argv, int argc, switch_stream_handle_t } dest = argv[0]; - if ((session = switch_core_session_request(&channel_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) { + if ((session = switch_core_session_request(&channel_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL)) != 0) { private_t *tech_pvt; switch_channel_t *channel; char *dialplan = globals.dialplan; diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index 27cf1cf..bb88ac5 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -1628,7 +1628,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause) { - if ((*new_session = switch_core_session_request(dingaling_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) { + if ((*new_session = switch_core_session_request(dingaling_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, flags, pool)) != 0) { struct private_object *tech_pvt; switch_channel_t *channel; switch_caller_profile_t *caller_profile = NULL; @@ -2948,7 +2948,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi goto done; } - if ((session = switch_core_session_request(dingaling_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) { + if ((session = switch_core_session_request(dingaling_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL)) != 0) { switch_core_session_add_stream(session, NULL); if ((tech_pvt = (struct private_object *) switch_core_session_alloc(session, sizeof(struct private_object))) != 0) { diff --git a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp index 02d031f..40a7166 100644 --- a/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp +++ b/src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp @@ -2274,7 +2274,7 @@ int new_inbound_channel(private_t * tech_pvt) switch_assert(tech_pvt != NULL); tech_pvt->ib_calls++; - if ((session = switch_core_session_request(gsmopen_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) { + if ((session = switch_core_session_request(gsmopen_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL)) != 0) { DEBUGA_GSMOPEN("2 SESSION_REQUEST %s\n", GSMOPEN_P_LOG, switch_core_session_get_uuid(session)); switch_core_session_add_stream(session, NULL); channel = switch_core_session_get_channel(session); diff --git a/src/mod/endpoints/mod_loopback/mod_loopback.c b/src/mod/endpoints/mod_loopback/mod_loopback.c index c87f225..8275893 100644 --- a/src/mod/endpoints/mod_loopback/mod_loopback.c +++ b/src/mod/endpoints/mod_loopback/mod_loopback.c @@ -211,7 +211,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session) if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND) && !switch_test_flag(tech_pvt, TFLAG_BLEG)) { - if (!(b_session = switch_core_session_request(loopback_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL))) { + if (!(b_session = switch_core_session_request(loopback_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL))) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Failure.\n"); goto end; } @@ -834,7 +834,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi switch_channel_pre_answer(channel); } - if ((*new_session = switch_core_session_request(loopback_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) { + if ((*new_session = switch_core_session_request(loopback_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, flags, pool)) != 0) { private_t *tech_pvt; switch_channel_t *channel; switch_caller_profile_t *caller_profile; diff --git a/src/mod/endpoints/mod_portaudio/mod_portaudio.c b/src/mod/endpoints/mod_portaudio/mod_portaudio.c index 9ff1358..a4a380d 100644 --- a/src/mod/endpoints/mod_portaudio/mod_portaudio.c +++ b/src/mod/endpoints/mod_portaudio/mod_portaudio.c @@ -735,7 +735,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi switch_call_cause_t *cancel_cause) { - if ((*new_session = switch_core_session_request(portaudio_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) { + if ((*new_session = switch_core_session_request(portaudio_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, flags, pool)) != 0) { private_t *tech_pvt; switch_channel_t *channel; switch_caller_profile_t *caller_profile; @@ -1750,7 +1750,7 @@ static switch_status_t place_call(char **argv, int argc, switch_stream_handle_t } dest = argv[0]; - if ((session = switch_core_session_request(portaudio_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) { + if ((session = switch_core_session_request(portaudio_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL)) != 0) { private_t *tech_pvt; switch_channel_t *channel; char *dialplan = globals.dialplan; diff --git a/src/mod/endpoints/mod_reference/mod_reference.c b/src/mod/endpoints/mod_reference/mod_reference.c index d6bb170..385e293 100644 --- a/src/mod/endpoints/mod_reference/mod_reference.c +++ b/src/mod/endpoints/mod_reference/mod_reference.c @@ -418,7 +418,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause) { - if ((*new_session = switch_core_session_request(reference_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) { + if ((*new_session = switch_core_session_request(reference_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, flags, pool)) != 0) { private_t *tech_pvt; switch_channel_t *channel; switch_caller_profile_t *caller_profile; diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index 64b354d..3f48d66 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -1039,7 +1039,7 @@ switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, swi goto error; } - if (!(nsession = switch_core_session_request(skinny_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool))) { + if (!(nsession = switch_core_session_request(skinny_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, flags, pool))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Creating Session\n"); goto error; } diff --git a/src/mod/endpoints/mod_skypopen/asterisk/chan_skypiax.c b/src/mod/endpoints/mod_skypopen/asterisk/chan_skypiax.c index 1759ab0..af30080 100644 --- a/src/mod/endpoints/mod_skypopen/asterisk/chan_skypiax.c +++ b/src/mod/endpoints/mod_skypopen/asterisk/chan_skypiax.c @@ -1806,7 +1806,7 @@ int new_inbound_channel(private_t * p) switch_core_session_t *session = NULL; switch_channel_t *channel = NULL; - if ((session = switch_core_session_request(skypiax_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) { + if ((session = switch_core_session_request(skypiax_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL)) != 0) { switch_core_session_add_stream(session, NULL); channel = switch_core_session_get_channel(session); skypiax_tech_init(tech_pvt, session); diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index 134e24c..513a557 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -1056,7 +1056,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi switch_call_cause_t *cancel_cause) { private_t *tech_pvt = NULL; - if ((*new_session = switch_core_session_request(skypopen_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) { + if ((*new_session = switch_core_session_request(skypopen_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, flags, pool)) != 0) { switch_channel_t *channel = NULL; switch_caller_profile_t *caller_profile; char *rdest; @@ -1964,7 +1964,7 @@ int new_inbound_channel(private_t * tech_pvt) switch_core_session_t *session = NULL; switch_channel_t *channel = NULL; - if ((session = switch_core_session_request(skypopen_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) { + if ((session = switch_core_session_request(skypopen_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL)) != 0) { DEBUGA_SKYPE("2 SESSION_REQUEST %s\n", SKYPOPEN_P_LOG, switch_core_session_get_uuid(session)); switch_core_session_add_stream(session, NULL); channel = switch_core_session_get_channel(session); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 0868d93..6fcb06c 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3544,13 +3544,6 @@ SWITCH_STANDARD_API(sofia_function) sofia_glue_recover(SWITCH_TRUE); stream->write_function(stream, "Flushing recovery database.\n"); } else { - int32_t old = 0, x = 0; - - switch_core_session_ctl(SCSC_SPS, &old); - - x = 10000000; - switch_core_session_ctl(SCSC_SPS, &x); - x = sofia_glue_recover(SWITCH_FALSE); if (x) { @@ -3558,8 +3551,6 @@ SWITCH_STANDARD_API(sofia_function) } else { stream->write_function(stream, "No calls to recover.\n"); } - - switch_core_session_ctl(SCSC_SPS, &old); } goto done; @@ -3632,7 +3623,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session goto error; } - if (!(nsession = switch_core_session_request(sofia_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool))) { + if (!(nsession = switch_core_session_request(sofia_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, flags, pool))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Creating Session\n"); goto error; } diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 49ddd2a..943813b 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -6119,9 +6119,9 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ if (sofia_endpoint_interface) { if (sofia_test_pflag(profile, PFLAG_CALLID_AS_UUID)) { - session = switch_core_session_request_uuid(sofia_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL, sip->sip_call_id->i_id); + session = switch_core_session_request_uuid(sofia_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL, sip->sip_call_id->i_id); } else { - session = switch_core_session_request(sofia_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL); + session = switch_core_session_request(sofia_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL); } } diff --git a/src/mod/endpoints/mod_unicall/mod_unicall.c b/src/mod/endpoints/mod_unicall/mod_unicall.c index 676b736..e835647 100644 --- a/src/mod/endpoints/mod_unicall/mod_unicall.c +++ b/src/mod/endpoints/mod_unicall/mod_unicall.c @@ -197,7 +197,7 @@ static switch_call_cause_t unicall_incoming_channel(zap_sigmsg_t *sigmsg, switch *sp = NULL; - if (!(session = switch_core_session_request(openzap_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL))) { + if (!(session = switch_core_session_request(openzap_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Initialization Error!\n"); return ZAP_FAIL; } @@ -1513,7 +1513,7 @@ static switch_call_cause_t unicall_outgoing_channel(switch_core_session_t *sessi switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "unicall_outgoing_channel(%p)\n", (void *) session); - if ((*new_session = switch_core_session_request(unicall_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) == NULL) { + if ((*new_session = switch_core_session_request(unicall_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, flags, pool)) == NULL) { return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; } diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 45c83de..7413164 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -1382,7 +1382,7 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_xml(switch_e parse_array(flag_str, flags, CF_FLAG_MAX); parse_array(cap_str, caps, CC_FLAG_MAX); - if (!(session = switch_core_session_request_uuid(endpoint_interface, direction, pool, uuid))) { + if (!(session = switch_core_session_request_uuid(endpoint_interface, direction, SOF_NO_LIMITS, pool, uuid))) { return NULL; } @@ -1517,6 +1517,7 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_xml(switch_e SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(switch_endpoint_interface_t *endpoint_interface, switch_call_direction_t direction, + switch_originate_flag_t originate_flags, switch_memory_pool_t **pool, const char *use_uuid) { switch_memory_pool_t *usepool; @@ -1542,22 +1543,25 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(switch_ PROTECT_INTERFACE(endpoint_interface); - switch_mutex_lock(runtime.throttle_mutex); - count = session_manager.session_count; - sps = --runtime.sps; - switch_mutex_unlock(runtime.throttle_mutex); + if (!(originate_flags & SOF_NO_LIMITS)) { + switch_mutex_lock(runtime.throttle_mutex); + count = session_manager.session_count; + sps = --runtime.sps; + switch_mutex_unlock(runtime.throttle_mutex); + + if (sps <= 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Throttle Error! %d\n", session_manager.session_count); + UNPROTECT_INTERFACE(endpoint_interface); + return NULL; + } - if (sps <= 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Throttle Error! %d\n", session_manager.session_count); - UNPROTECT_INTERFACE(endpoint_interface); - return NULL; + if ((count + 1) > session_manager.session_limit) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Over Session Limit! %d\n", session_manager.session_limit); + UNPROTECT_INTERFACE(endpoint_interface); + return NULL; + } } - if ((count + 1) > session_manager.session_limit) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Over Session Limit! %d\n", session_manager.session_limit); - UNPROTECT_INTERFACE(endpoint_interface); - return NULL; - } if (pool && *pool) { usepool = *pool; @@ -1654,7 +1658,7 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_by_name(cons return NULL; } - session = switch_core_session_request(endpoint_interface, direction, pool); + session = switch_core_session_request(endpoint_interface, direction, SOF_NONE, pool); UNPROTECT_INTERFACE(endpoint_interface); diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index f54639d..22b26eb 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -2244,10 +2244,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess cid_num_override = switch_event_get_header(var_event, "origination_caller_id_number"); } + if (flags & SOF_NO_LIMITS) { + dftflags |= SOF_NO_LIMITS; + } + if (cid_num_override) { dftflags |= SOF_NO_EFFECTIVE_CID_NUM; } - + if (cid_name_override) { dftflags |= SOF_NO_EFFECTIVE_CID_NAME; } @@ -2450,11 +2454,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess if (and_argc > 1 || or_argc > 1) { myflags |= SOF_FORKED_DIAL; - } else if (var_event) { + } + + if (var_event) { const char *vvar; if ((vvar = switch_event_get_header(var_event, "forked_dial")) && switch_true(vvar)) { myflags |= SOF_FORKED_DIAL; } + if ((vvar = switch_event_get_header(var_event, "no_throttle_limits")) && switch_true(vvar)) { + myflags |= SOF_NO_LIMITS; + } } /* only valid in [] since it's unique to each channel leg */ commit ab2529d4e1e33f01f87bb9db97e6c5883b5f4705 Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Thu Aug 26 06:19:58 2010 -0400 mod_callcenter: You can now allow caller that have hangup before agent answer to call back and resume their previous position. diff --git a/conf/autoload_configs/callcenter.conf.xml b/conf/autoload_configs/callcenter.conf.xml index 2e93a4e..156ed37 100644 --- a/conf/autoload_configs/callcenter.conf.xml +++ b/conf/autoload_configs/callcenter.conf.xml @@ -14,6 +14,8 @@ <param name="tier-rule-wait-second" value="300"/> <param name="tier-rule-wait-multiply-level" value="true"/> <param name="tier-rule-no-agent-no-wait" value="false"/> + <param name="discard-abandoned-after" value="60"/> + <param name="abandoned-resume-allowed" value="false"/> </queue> </queues> diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 49f30de..6014233 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -144,6 +144,7 @@ typedef enum { CC_MEMBER_STATE_WAITING = 1, CC_MEMBER_STATE_TRYING = 2, CC_MEMBER_STATE_ANSWERED = 3, + CC_MEMBER_STATE_ABANDONED = 4 } cc_member_state_t; struct cc_member_state_table { @@ -156,6 +157,7 @@ static struct cc_member_state_table MEMBER_STATE_CHART[] = { {"Waiting", CC_MEMBER_STATE_WAITING}, {"Trying", CC_MEMBER_STATE_TRYING}, {"Answered", CC_MEMBER_STATE_ANSWERED}, + {"Abandoned", CC_MEMBER_STATE_ABANDONED}, {NULL, 0} }; @@ -166,19 +168,20 @@ static struct cc_member_state_table MEMBER_STATE_CHART[] = { */ static char members_sql[] = "CREATE TABLE members (\n" -" queue VARCHAR(255),\n" -" system VARCHAR(255),\n" -" uuid VARCHAR(255) NOT NULL DEFAULT '',\n" -" caller_number VARCHAR(255),\n" -" caller_name VARCHAR(255),\n" -" system_epoch INTEGER NOT NULL DEFAULT 0,\n" -" joined_epoch INTEGER NOT NULL DEFAULT 0,\n" -" bridge_epoch INTEGER NOT NULL DEFAULT 0,\n" -" base_score INTEGER NOT NULL DEFAULT 0,\n" -" skill_score INTEGER NOT NULL DEFAULT 0,\n" -" serving_agent VARCHAR(255),\n" -" serving_system VARCHAR(255),\n" -" state VARCHAR(255)\n" ");\n"; +" queue VARCHAR(255),\n" +" system VARCHAR(255),\n" +" uuid VARCHAR(255) NOT NULL DEFAULT '',\n" +" caller_number VARCHAR(255),\n" +" caller_name VARCHAR(255),\n" +" system_epoch INTEGER NOT NULL DEFAULT 0,\n" +" joined_epoch INTEGER NOT NULL DEFAULT 0,\n" +" bridge_epoch INTEGER NOT NULL DEFAULT 0,\n" +" abandoned_epoch INTEGER NOT NULL DEFAULT 0,\n" +" base_score INTEGER NOT NULL DEFAULT 0,\n" +" skill_score INTEGER NOT NULL DEFAULT 0,\n" +" serving_agent VARCHAR(255),\n" +" serving_system VARCHAR(255),\n" +" state VARCHAR(255)\n" ");\n"; /* Member State Waiting Answered @@ -236,7 +239,7 @@ static char tiers_sql[] = " level INTEGER NOT NULL DEFAULT 1,\n" " position INTEGER NOT NULL DEFAULT 1\n" ");\n"; -static switch_xml_config_int_options_t config_int_0_10000 = { SWITCH_TRUE, 0, SWITCH_TRUE, 10000 }; +static switch_xml_config_int_options_t config_int_0_86400 = { SWITCH_TRUE, 0, SWITCH_TRUE, 86400 }; const char * cc_tier_state2str(cc_tier_state_t state) { @@ -384,6 +387,8 @@ struct cc_queue { uint32_t tier_rule_wait_second; switch_bool_t tier_rule_wait_multiply_level; switch_bool_t tier_rule_no_agent_no_wait; + uint32_t discard_abandoned_after; + switch_bool_t abandoned_resume_allowed; switch_mutex_t *mutex; @@ -483,9 +488,11 @@ cc_queue_t *queue_set_config(cc_queue_t *queue) SWITCH_CONFIG_SET_ITEM(queue->config[i++], "record-template", SWITCH_CONFIG_STRING, 0, &queue->record_template, NULL, &queue->config_str_pool, NULL, NULL); SWITCH_CONFIG_SET_ITEM(queue->config[i++], "time-base-score", SWITCH_CONFIG_STRING, 0, &queue->time_base_score, "queue", &queue->config_str_pool, NULL, NULL); SWITCH_CONFIG_SET_ITEM(queue->config[i++], "tier-rules-apply", SWITCH_CONFIG_BOOL, 0, &queue->tier_rules_apply, SWITCH_FALSE, NULL, NULL, NULL); - SWITCH_CONFIG_SET_ITEM(queue->config[i++], "tier-rule-wait-second", SWITCH_CONFIG_INT, 0, &queue->tier_rule_wait_second, 0, &config_int_0_10000, NULL, NULL); + SWITCH_CONFIG_SET_ITEM(queue->config[i++], "tier-rule-wait-second", SWITCH_CONFIG_INT, 0, &queue->tier_rule_wait_second, 0, &config_int_0_86400, NULL, NULL); SWITCH_CONFIG_SET_ITEM(queue->config[i++], "tier-rule-wait-multiply-level", SWITCH_CONFIG_BOOL, 0, &queue->tier_rule_wait_multiply_level, SWITCH_FALSE, NULL, NULL, NULL); SWITCH_CONFIG_SET_ITEM(queue->config[i++], "tier-rule-no-agent-no-wait", SWITCH_CONFIG_BOOL, 0, &queue->tier_rule_no_agent_no_wait, SWITCH_TRUE, NULL, NULL, NULL); + SWITCH_CONFIG_SET_ITEM(queue->config[i++], "discard-abandoned-after", SWITCH_CONFIG_INT, 0, &queue->discard_abandoned_after, 60, &config_int_0_86400, NULL, NULL); + SWITCH_CONFIG_SET_ITEM(queue->config[i++], "abandoned-resume-allowed", SWITCH_CONFIG_BOOL, 0, &queue->abandoned_resume_allowed, SWITCH_FALSE, NULL, NULL, NULL); switch_assert(i < CC_QUEUE_CONFIGITEM_COUNT); @@ -643,7 +650,7 @@ static cc_queue_t *load_queue(const char *queue_name) goto end; } - switch_cache_db_test_reactive(dbh, "select count(system_epoch) from members", "drop table members", members_sql); + switch_cache_db_test_reactive(dbh, "select count(abandoned_epoch) from members", "drop table members", members_sql); switch_cache_db_test_reactive(dbh, "select count(ready_time) from agents", NULL, "alter table agents add ready_time integer not null default 0;" "alter table agents add reject_delay_time integer not null default 0;" "alter table agents add busy_delay_time integer not null default 0;"); @@ -656,7 +663,9 @@ static cc_queue_t *load_queue(const char *queue_name) /* Reset a unclean shutdown */ sql = switch_mprintf("UPDATE agents SET state = 'Waiting', uuid = '' WHERE system = 'single_box';" "UPDATE tiers SET state = 'Ready' WHERE agent IN (SELECT name FROM agents WHERE system = 'single_box');" - "DELETE FROM members WHERE system = 'single_box';"); + "UPDATE members SET state = '%q', uuid = '' WHERE system = 'single_box';", + cc_member_state2str(CC_MEMBER_STATE_ABANDONED)); + cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); } @@ -1285,7 +1294,9 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa /* member is gone before we could process it */ if (!member_session) { - sql = switch_mprintf("DELETE FROM members WHERE system = 'single_box' AND uuid = '%q'", h->member_uuid); + sql = switch_mprintf("UPDATE members SET state = '%q', uuid = '', abandoned_epoch = '%ld' WHERE system = 'single_box' AND uuid = '%q' AND state != '%q'", + cc_member_state2str(CC_MEMBER_STATE_ABANDONED), (long) switch_epoch_time_now(NULL), h->member_uuid, cc_member_state2str(CC_MEMBER_STATE_ABANDONED)); + cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); goto done; @@ -1722,6 +1733,8 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName uint32_t tier_rule_wait_second; switch_bool_t tier_rule_wait_multiply_level; switch_bool_t tier_rule_no_agent_no_wait; + uint32_t discard_abandoned_after; + switch_bool_t abandoned_resume_allowed; agent_callback_t cbt; if (!argv[0] || !(queue = get_queue(argv[0]))) { @@ -1734,7 +1747,8 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName tier_rule_wait_second = queue->tier_rule_wait_second; tier_rule_wait_multiply_level = queue->tier_rule_wait_multiply_level; tier_rule_no_agent_no_wait = queue->tier_rule_no_agent_no_wait; - + discard_abandoned_after = queue->discard_abandoned_after; + abandoned_resume_allowed = queue->abandoned_resume_allowed; if (queue->record_template) { queue_record_template = strdup(queue->record_template); } @@ -1742,6 +1756,20 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName queue_rwunlock(queue); } + if (!strcasecmp(argv[6], cc_member_state2str(CC_MEMBER_STATE_ABANDONED))) { + long abandoned_epoch = atol(argv[7]); + if (abandoned_epoch == 0) { + abandoned_epoch = atol(argv[4]); + } + /* Once we pass a certain point, we want to get rid of the abandoned call */ + if (abandoned_epoch + discard_abandoned_after> (long) switch_epoch_time_now(NULL)) { + sql = switch_mprintf("DELETE FROM members WHERE system = 'single_box' AND uuid = '%q'", argv[1]); + cc_execute_sql(NULL, sql, NULL); + switch_safe_free(sql); + } + /* Skip this member */ + return 0; + } memset(&cbt, 0, sizeof(cbt)); cbt.tier = 0; cbt.tier_agent_available = 0; @@ -1823,10 +1851,10 @@ void *SWITCH_THREAD_FUNC cc_agent_dispatch_thread_run(switch_thread_t *thread, v while (globals.running == 1) { char *sql = NULL; - sql = switch_mprintf("SELECT queue,uuid,caller_number,caller_name,joined_epoch,(%ld-joined_epoch)+base_score+skill_score AS score FROM members" - " WHERE state = '%q' OR (serving_agent = 'ring-all' AND state = '%q') ORDER BY score DESC", + sql = switch_mprintf("SELECT queue,uuid,caller_number,caller_name,joined_epoch,(%ld-joined_epoch)+base_score+skill_score AS score, state, abandoned_epoch FROM members" + " WHERE state = '%q' OR state = '%q' OR (serving_agent = 'ring-all' AND state = '%q') ORDER BY score DESC", (long) switch_epoch_time_now(NULL), - cc_member_state2str(CC_MEMBER_STATE_WAITING), cc_member_state2str(CC_MEMBER_STATE_TRYING)); + cc_member_state2str(CC_MEMBER_STATE_WAITING), cc_member_state2str(CC_MEMBER_STATE_ABANDONED), cc_member_state2str(CC_MEMBER_STATE_TRYING)); cc_execute_sql_callback(NULL /* queue */, NULL /* mutex */, sql, members_callback, NULL /* Call back variables */); switch_safe_free(sql); @@ -1946,6 +1974,7 @@ SWITCH_STANDARD_APP(callcenter_function) char start_epoch[64]; switch_event_t *event; switch_time_t t_member_called = switch_epoch_time_now(NULL); + long abandoned_epoch = 0; if (!zstr(data)) { mydata = switch_core_session_strdup(session, data); @@ -1971,6 +2000,17 @@ SWITCH_STANDARD_APP(callcenter_function) times = switch_channel_get_timetable(member_channel); switch_snprintf(start_epoch, sizeof(start_epoch), "%" SWITCH_TIME_T_FMT, times->answered); + /* Check of we have a queued abandoned member we can resume from */ + if (queue->abandoned_resume_allowed == SWITCH_TRUE) { + char res[256]; + + /* Check to see if agent already exist */ + sql = switch_mprintf("SELECT abandoned_epoch FROM members WHERE caller_number = '%q' AND state = '%q'", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), cc_member_state2str(CC_MEMBER_STATE_ABANDONED)); + cc_execute_sql2str(NULL, NULL, sql, res, sizeof(res)); + switch_safe_free(sql); + abandoned_epoch = atol(res); + } + /* Add manually imported score */ if (cc_base_score) { cc_base_score_int += atoi(cc_base_score); @@ -1984,7 +2024,7 @@ SWITCH_STANDARD_APP(callcenter_function) if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CALLCENTER_EVENT) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(member_channel, event); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Name", queue_name); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Action", "member-queue-start"); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Action", "member-queue-%s", (abandoned_epoch==0?"start":"resume")); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Name", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name"))); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Number", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number"))); @@ -1994,22 +2034,43 @@ SWITCH_STANDARD_APP(callcenter_function) switch_channel_set_variable_printf(member_channel, "cc_queue_joined_epoch", "%ld", (long) switch_epoch_time_now(NULL)); switch_channel_set_variable(member_channel, "cc_queue", queue_name); - /* Add the caller to the member queue */ - sql = switch_mprintf("INSERT INTO members" - " (queue,system,uuid,system_epoch,joined_epoch,base_score,skill_score, caller_number, caller_name, serving_agent, serving_system, state)" - " VALUES('%q','single_box', '%q', '%q', '%ld','%d','%d','%q','%q','%q','','%q')", - queue_name, - uuid, - start_epoch, - (long) switch_epoch_time_now(NULL), - cc_base_score_int, - 0 /*TODO SKILL score*/, - switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), - switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), - (!strcasecmp(queue->strategy,"ring-all")?"ring-all":""), - cc_member_state2str(CC_MEMBER_STATE_WAITING)); - cc_execute_sql(queue, sql, NULL); - switch_safe_free(sql); + if (abandoned_epoch == 0) { + /* Add the caller to the member queue */ + sql = switch_mprintf("INSERT INTO members" + " (queue,system,uuid,system_epoch,joined_epoch,base_score,skill_score, caller_number, caller_name, serving_agent, serving_system, state)" + " VALUES('%q','single_box', '%q', '%q', '%ld','%d','%d','%q','%q','%q','','%q')", + queue_name, + uuid, + start_epoch, + (long) switch_epoch_time_now(NULL), + cc_base_score_int, + 0 /*TODO SKILL score*/, + switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), + switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), + (!strcasecmp(queue->strategy,"ring-all")?"ring-all":""), + cc_member_state2str(CC_MEMBER_STATE_WAITING)); + cc_execute_sql(queue, sql, NULL); + switch_safe_free(sql); + } else { + char res[256]; + /* Update abandoned member */ + sql = switch_mprintf("UPDATE members SET uuid = '%q', state = '%q', rejoined_epoch = '%q' WHERE caller_number = '%q' AND abandoned_epoch = '%q' AND state = '%q'" + , uuid, cc_member_state2str(CC_MEMBER_STATE_WAITING), (long) switch_epoch_time_now(NULL), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), abandoned_epoch, cc_member_state2str(CC_MEMBER_STATE_ABANDONED)); + cc_execute_sql(queue, sql, NULL); + switch_safe_free(sql); + + /* Confirm we took that member in */ + sql = switch_mprintf("SELECT abandoned_epoch FROM members WHERE uuid = '%q' AND state = '%q'", uuid, cc_member_state2str(CC_MEMBER_STATE_WAITING)); + cc_execute_sql2str(NULL, NULL, sql, res, sizeof(res)); + switch_safe_free(sql); + + if (atol(res) == 0) { + /* Failed to get the member !!! */ + queue_rwunlock(queue); + goto end; + } + + } /* Send Event with queue count */ cc_queue_count(queue_name); @@ -2049,8 +2110,9 @@ SWITCH_STANDARD_APP(callcenter_function) /* Hangup any agents been callback */ if (!switch_channel_up(member_channel)) { /* If channel is still up, it mean that the member didn't hangup, so we should leave the agent alone */ switch_core_session_hupall_matching_var("cc_member_uuid", uuid, SWITCH_CAUSE_ORIGINATOR_CANCEL); - sql = switch_mprintf("DELETE FROM members WHERE system = 'single_box' AND uuid = '%q'", uuid); - cc_execute_sql(NULL, sql, NULL); + sql = switch_mprintf("UPDATE members SET state = '%q', uuid = '', abandoned_epoch = '%ld' WHERE system = 'single_box' AND uuid = '%q'", + cc_member_state2str(CC_MEMBER_STATE_ABANDONED), (long) switch_epoch_time_now(NULL), uuid); + cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CALLCENTER_EVENT) == SWITCH_STATUS_SUCCESS) { commit 6558276a83af5630c7b8d40b93717009bc94d0ea Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Wed Aug 25 22:00:15 2010 -0400 mod_callcenter: Default the level to 0 since the new tier system will wait x second at level 1... just level 0 that will ring agent right away (if set to do so) diff --git a/conf/autoload_configs/callcenter.conf.xml b/conf/autoload_configs/callcenter.conf.xml index 4da0c26..2e93a4e 100644 --- a/conf/autoload_configs/callcenter.conf.xml +++ b/conf/autoload_configs/callcenter.conf.xml @@ -25,7 +25,7 @@ <!--<agent name="1000@default" type="callback" contact="[call_timeout=10]user/1000@default" status="Available" max-no-answer="3" wrap-up-time="10" reject-delay-time="10" busy-delay-time="60" />--> </agents> <tiers> - <!-- if no level or position is provided, they will default to 1. You should do this to keep db value on restart --> + <!-- if no level or position is provided, they will default to 0. You should do this to keep db value on restart --> <!-- <tier agent="1000@default" queue="support@default" level="0" position="1"/> --> </tiers> diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 44a5622..49f30de 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1243,7 +1243,7 @@ static switch_status_t load_config(void) cc_tier_add(queue_name, agent, cc_tier_state2str(CC_TIER_STATE_READY), atoi(level), atoi(position)); } else { /* default to level 1 and position 1 within the level */ - cc_tier_add(queue_name, agent, cc_tier_state2str(CC_TIER_STATE_READY), 1, 1); + cc_tier_add(queue_name, agent, cc_tier_state2str(CC_TIER_STATE_READY), 0, 1); } } else { if (level) { commit 86c9bed758e2542ed0d496644eecf22ac6c53b4e Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Wed Aug 25 21:40:33 2010 -0400 mod_callcenter: Add tiers rules before jumping to a different level. Also added support for dial-in agent. diff --git a/conf/autoload_configs/callcenter.conf.xml b/conf/autoload_configs/callcenter.conf.xml index 0f4fb2a..4da0c26 100644 --- a/conf/autoload_configs/callcenter.conf.xml +++ b/conf/autoload_configs/callcenter.conf.xml @@ -10,6 +10,10 @@ <param name="moh-sound" value="$${hold_music}"/> <!--<param name="record-template" value="$${base_dir}/recordings/${strftime(%Y-%m-%d-%H-%M-%S)}.${destination_number}.${caller_id_number}.${uuid}.wav"/>--> <param name="time-base-score" value="system"/> + <param name="tier-rules-apply" value="false"/> + <param name="tier-rule-wait-second" value="300"/> + <param name="tier-rule-wait-multiply-level" value="true"/> + <param name="tier-rule-no-agent-no-wait" value="false"/> </queue> </queues> @@ -22,7 +26,7 @@ </agents> <tiers> <!-- if no level or position is provided, they will default to 1. You should do this to keep db value on restart --> - <!-- <tier agent="1000@default" queue="support@default" level="1" position="1"/> --> + <!-- <tier agent="1000@default" queue="support@default" level="0" position="1"/> --> </tiers> </configuration> diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 4c05509..44a5622 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -34,6 +34,7 @@ #define CALLCENTER_EVENT "callcenter::info" #define CC_AGENT_TYPE_CALLBACK "Callback" +#define CC_AGENT_TYPE_UUID_STANDBY "uuid-standby" #define CC_SQLITE_DB_NAME "callcenter" /* TODO @@ -188,7 +189,7 @@ static char agents_sql[] = " name VARCHAR(255),\n" " system VARCHAR(255),\n" " uuid VARCHAR(255),\n" -" type VARCHAR(255),\n" // Callback , Dial in... +" type VARCHAR(255),\n" /* Callback , Dial in...*/ " contact VARCHAR(255),\n" " status VARCHAR(255),\n" /*User Personal Status @@ -235,6 +236,7 @@ static char tiers_sql[] = " level INTEGER NOT NULL DEFAULT 1,\n" " position INTEGER NOT NULL DEFAULT 1\n" ");\n"; +static switch_xml_config_int_options_t config_int_0_10000 = { SWITCH_TRUE, 0, SWITCH_TRUE, 10000 }; const char * cc_tier_state2str(cc_tier_state_t state) { @@ -378,6 +380,11 @@ struct cc_queue { char *moh; char *record_template; char *time_base_score; + switch_bool_t tier_rules_apply; + uint32_t tier_rule_wait_second; + switch_bool_t tier_rule_wait_multiply_level; + switch_bool_t tier_rule_no_agent_no_wait; + switch_mutex_t *mutex; switch_thread_rwlock_t *rwlock; @@ -475,6 +482,10 @@ cc_queue_t *queue_set_config(cc_queue_t *queue) SWITCH_CONFIG_SET_ITEM(queue->config[i++], "moh-sound", SWITCH_CONFIG_STRING, 0, &queue->moh, NULL, &queue->config_str_pool, NULL, NULL); SWITCH_CONFIG_SET_ITEM(queue->config[i++], "record-template", SWITCH_CONFIG_STRING, 0, &queue->record_template, NULL, &queue->config_str_pool, NULL, NULL); SWITCH_CONFIG_SET_ITEM(queue->config[i++], "time-base-score", SWITCH_CONFIG_STRING, 0, &queue->time_base_score, "queue", &queue->config_str_pool, NULL, NULL); + SWITCH_CONFIG_SET_ITEM(queue->config[i++], "tier-rules-apply", SWITCH_CONFIG_BOOL, 0, &queue->tier_rules_apply, SWITCH_FALSE, NULL, NULL, NULL); + SWITCH_CONFIG_SET_ITEM(queue->config[i++], "tier-rule-wait-second", SWITCH_CONFIG_INT, 0, &queue->tier_rule_wait_second, 0, &config_int_0_10000, NULL, NULL); + SWITCH_CONFIG_SET_ITEM(queue->config[i++], "tier-rule-wait-multiply-level", SWITCH_CONFIG_BOOL, 0, &queue->tier_rule_wait_multiply_level, SWITCH_FALSE, NULL, NULL, NULL); + SWITCH_CONFIG_SET_ITEM(queue->config[i++], "tier-rule-no-agent-no-wait", SWITCH_CONFIG_BOOL, 0, &queue->tier_rule_no_agent_no_wait, SWITCH_TRUE, NULL, NULL, NULL); switch_assert(i < CC_QUEUE_CONFIGITEM_COUNT); @@ -689,6 +700,8 @@ struct call_helper { const char *agent_name; const char *agent_system; const char *agent_status; + const char *agent_type; + const char *agent_uuid; const char *originate_string; const char *record_template; int no_answer_count; @@ -737,7 +750,7 @@ cc_status_t cc_agent_add(const char *agent, const char *type) cc_status_t result = CC_STATUS_SUCCESS; char *sql; - if (!strcasecmp(type, CC_AGENT_TYPE_CALLBACK)) { + if (!strcasecmp(type, CC_AGENT_TYPE_CALLBACK) || !strcasecmp(type, CC_AGENT_TYPE_UUID_STANDBY)) { char res[256] = ""; /* Check to see if agent already exist */ sql = switch_mprintf("SELECT count(*) FROM agents WHERE name = '%q'", agent); @@ -905,7 +918,12 @@ cc_status_t cc_agent_update(const char *key, const char *value, const char *agen result = CC_STATUS_AGENT_INVALID_STATE; goto done; } + } else if (!strcasecmp(key, "uuid")) { + sql = switch_mprintf("UPDATE agents SET uuid = '%q', system = 'single_box' WHERE name = '%q'", value, agent); + cc_execute_sql(NULL, sql, NULL); + switch_safe_free(sql); + result = CC_STATUS_SUCCESS; } else if (!strcasecmp(key, "contact")) { sql = switch_mprintf("UPDATE agents SET contact = '%q', system = 'single_box' WHERE name = '%q'", value, agent); cc_execute_sql(NULL, sql, NULL); @@ -931,7 +949,7 @@ cc_status_t cc_agent_update(const char *key, const char *value, const char *agen result = CC_STATUS_SUCCESS; } else if (!strcasecmp(key, "type")) { - if (strcasecmp(value, CC_AGENT_TYPE_CALLBACK)) { + if (strcasecmp(value, CC_AGENT_TYPE_CALLBACK) && strcasecmp(value, CC_AGENT_TYPE_UUID_STANDBY)) { result = CC_STATUS_AGENT_INVALID_TYPE; goto done; } @@ -1272,17 +1290,38 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_safe_free(sql); goto done; } - switch_event_create(&ovars, SWITCH_EVENT_REQUEST_PARAMS); - switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "cc_member_uuid", "%s", h->member_uuid); - switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "cc_member_pre_answer_uuid", "%s", h->member_uuid); - switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "ignore_early_media", "true"); - - t_agent_called = switch_epoch_time_now(NULL); - dialstr = switch_mprintf("%s", h->originate_string); - status = switch_ivr_originate(NULL, &agent_session, &cause, dialstr, 60, NULL, h->member_caller_name, h->member_caller_number, NULL, ovars, SOF_NONE, NULL); - switch_safe_free(dialstr); + if (!strcasecmp(h->agent_type, CC_AGENT_TYPE_CALLBACK)) { + switch_event_create(&ovars, SWITCH_EVENT_REQUEST_PARAMS); + switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "cc_member_uuid", "%s", h->member_uuid); + switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "cc_member_pre_answer_uuid", "%s", h->member_uuid); + switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "ignore_early_media", "true"); + + t_agent_called = switch_epoch_time_now(NULL); + dialstr = switch_mprintf("%s", h->originate_string); + status = switch_ivr_originate(NULL, &agent_session, &cause, dialstr, 60, NULL, h->member_caller_name, h->member_caller_number, NULL, ovars, SOF_NONE, NULL); + switch_safe_free(dialstr); + + switch_event_destroy(&ovars); + } else if (!strcasecmp(h->agent_type, CC_AGENT_TYPE_UUID_STANDBY)) { + agent_session = switch_core_session_locate(h->agent_uuid); + if (agent_session) { + switch_channel_t *agent_channel = switch_core_session_get_channel(agent_session); + switch_event_t *event; + const char *cc_warning_tone = switch_channel_get_variable(agent_channel, "cc_warning_tone"); + /* Playback this to the agent */ + if (cc_warning_tone && switch_event_create(&event, SWITCH_EVENT_COMMAND) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-command", "execute"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-name", "playback"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-arg", cc_warning_tone); + switch_core_session_queue_private_event(agent_session, &event, SWITCH_TRUE); + } - switch_event_destroy(&ovars); + status = SWITCH_STATUS_SUCCESS; + } else { + cc_agent_update("status", cc_agent_status2str(CC_AGENT_STATUS_LOGGED_OUT), h->agent_name); + cc_agent_update("uuid", "", h->agent_name); + } + } if (status == SWITCH_STATUS_SUCCESS) { /* Agent Answered */ @@ -1387,8 +1426,9 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_channel_set_variable_printf(member_channel, "cc_queue_terminated_epoch", "%ld", (long) switch_epoch_time_now(NULL)); /* Update Agents Items */ - sql = switch_mprintf("UPDATE agents SET uuid = '', last_bridge_end = %ld, talk_time = talk_time + (%ld-last_bridge_start) WHERE name = '%q' AND system = '%q';" - , (long) switch_epoch_time_now(NULL), (long) switch_epoch_time_now(NULL), h->agent_name, h->agent_system); + /* Do not remove uuid of the agent if we are a standby agent */ + sql = switch_mprintf("UPDATE agents SET %q last_bridge_end = %ld, talk_time = talk_time + (%ld-last_bridge_start) WHERE name = '%q' AND system = '%q';" + , (strcasecmp(h->agent_type, "uuid-standby")?"uuid = '',":""), (long) switch_epoch_time_now(NULL), (long) switch_epoch_time_now(NULL), h->agent_name, h->agent_system); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); @@ -1511,7 +1551,13 @@ struct agent_callback { const char *joined_epoch; const char *strategy; const char *record_template; + switch_bool_t tier_rules_apply; + uint32_t tier_rule_wait_second; + switch_bool_t tier_rule_wait_multiply_level; + switch_bool_t tier_rule_no_agent_no_wait; + int tier; + int tier_agent_available; }; typedef struct agent_callback agent_callback_t; @@ -1520,10 +1566,58 @@ static int agents_callback(void *pArg, int argc, char **argv, char **columnNames agent_callback_t *cbt = (agent_callback_t *) pArg; char *sql = NULL; char res[256]; + char *agent_status = argv[2]; + char *agent_tier_state = argv[8]; + char *agent_last_bridge_end = argv[9]; + char *agent_wrap_up_time = argv[10]; + char *agent_state = argv[11]; + char *agent_ready_time = argv[12]; + char *agent_tier_level = argv[13]; + char *agent_type = argv[14]; + char *agent_uuid = argv[15]; + + switch_bool_t contact_agent = SWITCH_TRUE; + + /* Check if we switch to a different tier, if so, check if we should continue further for that member */ + + if (cbt->tier_rules_apply == SWITCH_TRUE && atoi(agent_tier_level) > cbt->tier) { + /* Continue if no agent was logged in in the previous tier and noagent = true */ + if (cbt->tier_rule_no_agent_no_wait == SWITCH_TRUE && cbt->tier_agent_available == 0) { + cbt->tier = atoi(agent_tier_level); + /* Multiple the tier level by the tier wait time */ + } else if (cbt->tier_rule_wait_multiply_level == SWITCH_TRUE && (long) switch_epoch_time_now(NULL) - atol(cbt->joined_epoch) >= atoi(agent_tier_level) * cbt->tier_rule_wait_second) { + cbt->tier = atoi(agent_tier_level); + cbt->tier_agent_available = 0; + /* Just check if joined is bigger than next tier wait time */ + } else if (cbt->tier_rule_wait_multiply_level == SWITCH_FALSE && (long) switch_epoch_time_now(NULL) - atol(cbt->joined_epoch) >= cbt->tier_rule_wait_second) { + cbt->tier = atoi(agent_tier_level); + cbt->tier_agent_available = 0; + } else { + /* We are not allowed to continue to the next tier of agent */ + return 1; + } + } + cbt->tier_agent_available++; - /* More Advanced rules based on On Break still being available for near future call */ - if (!strcasecmp(argv[2], cc_agent_status2str(CC_AGENT_STATUS_ON_BREAK))) { - return 0; /* Skip this agent for the moment */ + /* If Agent is not in a acceptable tier state, continue */ + if (! (!strcasecmp(agent_tier_state, cc_tier_state2str(CC_TIER_STATE_NO_ANSWER)) || !strcasecmp(agent_tier_state, cc_tier_state2str(CC_TIER_STATE_READY)))) { + contact_agent = SWITCH_FALSE; + } + if (! (!strcasecmp(agent_state, cc_agent_state2str(CC_AGENT_STATE_WAITING)))) { + contact_agent = SWITCH_FALSE; + } + if (! (atol(agent_last_bridge_end) < ((long) switch_epoch_time_now(NULL) - atol(agent_wrap_up_time)))) { + contact_agent = SWITCH_FALSE; + } + if (! (atol(agent_ready_time) <= (long) switch_epoch_time_now(NULL))) { + contact_agent = SWITCH_FALSE; + } + if (! (strcasecmp(agent_status, cc_agent_status2str(CC_AGENT_STATUS_ON_BREAK)))) { + contact_agent = SWITCH_FALSE; + } + + if (contact_agent == SWITCH_FALSE) { + return 0; /* Continue to next Agent */ } /* If agent isn't on this box */ @@ -1577,6 +1671,8 @@ static int agents_callback(void *pArg, int argc, char **argv, char **columnNames h->agent_name = switch_core_strdup(h->pool, argv[1]); h->agent_system = switch_core_strdup(h->pool, "single_box"); h->agent_status = switch_core_strdup(h->pool, argv[2]); + h->agent_type = switch_core_strdup(h->pool, agent_type); + h->agent_uuid = switch_core_strdup(h->pool, agent_uuid); h->member_joined_epoch = switch_core_strdup(h->pool, cbt->joined_epoch); h->member_caller_name = switch_core_strdup(h->pool, cbt->caller_name); h->member_caller_number = switch_core_strdup(h->pool, cbt->caller_number); @@ -1622,6 +1718,10 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName char *queue_name = NULL; char *queue_strategy = NULL; char *queue_record_template = NULL; + switch_bool_t tier_rules_apply; + uint32_t tier_rule_wait_second; + switch_bool_t tier_rule_wait_multiply_level; + switch_bool_t tier_rule_no_agent_no_wait; agent_callback_t cbt; if (!argv[0] || !(queue = get_queue(argv[0]))) { @@ -1630,6 +1730,10 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName } else { queue_name = strdup(queue->name); queue_strategy = strdup(queue->strategy); + tier_rules_apply = queue->tier_rules_apply; + tier_rule_wait_second = queue->tier_rule_wait_second; + tier_rule_wait_multiply_level = queue->tier_rule_wait_multiply_level; + tier_rule_no_agent_no_wait = queue->tier_rule_no_agent_no_wait; if (queue->record_template) { queue_record_template = strdup(queue->record_template); @@ -1639,7 +1743,14 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName } memset(&cbt, 0, sizeof(cbt)); - cbt.tier = 1; + cbt.tier = 0; + cbt.tier_agent_available = 0; + + cbt.tier_rules_apply = tier_rules_apply; + cbt.tier_rule_wait_second = tier_rule_wait_second; + cbt.tier_rule_wait_multiply_level = tier_rule_wait_multiply_level; + cbt.tier_rule_no_agent_no_wait = tier_rule_no_agent_no_wait; + cbt.uuid = argv[1]; cbt.caller_number = argv[2]; cbt.caller_name = argv[3]; @@ -1667,18 +1778,12 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName sql_order_by = switch_mprintf("level, position"); } - sql = switch_mprintf("SELECT system, name, status, contact, no_answer_count, max_no_answer, reject_delay_time, busy_delay_time FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent)" + sql = switch_mprintf("SELECT system, name, status, contact, no_answer_count, max_no_answer, reject_delay_time, busy_delay_time,tiers.state, agents.last_bridge_end, agents.wrap_up_time, agents.state, agents.ready_time, tiers.level, agents.type, agents.uuid FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent)" " WHERE tiers.queue = '%q'" - " AND (tiers.state = '%q' OR tiers.state = '%q')" " AND (agents.status = '%q' OR agents.status = '%q' OR agents.status = '%q')" - " AND agents.state = '%q' AND last_bridge_end < (%ld - wrap_up_time)" - " AND agents.ready_time <= %ld" " ORDER BY %q", queue_name, - cc_tier_state2str(CC_TIER_STATE_READY), cc_tier_state2str(CC_TIER_STATE_NO_ANSWER), cc_agent_status2str(CC_AGENT_STATUS_AVAILABLE), cc_agent_status2str(CC_AGENT_STATUS_ON_BREAK), cc_agent_status2str(CC_AGENT_STATUS_AVAILABLE_ON_DEMAND), - cc_agent_state2str(CC_AGENT_STATE_WAITING), (long) switch_epoch_time_now(NULL), - (long) switch_epoch_time_now(NULL), sql_order_by); cc_execute_sql_callback(NULL /* queue */, NULL /* mutex */, sql, agents_callback, &cbt /* Call back variables */); @@ -2393,6 +2498,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_callcenter_load) switch_console_set_complete("add callcenter_config agent del"); switch_console_set_complete("add callcenter_config agent set status"); switch_console_set_complete("add callcenter_config agent set state"); + switch_console_set_complete("add callcenter_config agent set uuid"); switch_console_set_complete("add callcenter_config agent set contact"); switch_console_set_complete("add callcenter_config agent set ready_time"); switch_console_set_complete("add callcenter_config agent set reject_delay_time"); commit be36f97e03f6b85a67f5619bd01991cfb817f924 Author: Moises Silva <moy@sangoma.com> Date: Wed Aug 25 09:33:54 2010 -0400 openzap: fix echo train usage bug diff --git a/libs/openzap/src/ozmod/ozmod_zt/ozmod_zt.c b/libs/openzap/src/ozmod/ozmod_zt/ozmod_zt.c index e1552a9..0eaf955 100644 --- a/libs/openzap/src/ozmod/ozmod_zt/ozmod_zt.c +++ b/libs/openzap/src/ozmod/ozmod_zt/ozmod_zt.c @@ -641,12 +641,12 @@ static ZIO_OPEN_FUNCTION(zt_open) } if (ioctl(zchan->sockfd, codes.ECHOCANCEL, &len)) { - zap_log(ZAP_LOG_WARNING, "Echo cancel not available for %d:%d\n", zchan->span_id, zchan->chan_id); - } else if (zt_globals.etlevel >= 0) { - len = zt_globals.etlevel; - if (ioctl(zchan->sockfd, codes.ECHOTRAIN, &len)) { - zap_log(ZAP_LOG_WARNING, "Echo training not available for %d:%d\n", zchan->span_id, zchan->chan_id); - } + zap_log(ZAP_LOG_WARNING, "Echo cancel not available for %d:%d\n", zchan->span_id, zchan->chan_id); + } else if (zt_globals.etlevel > 0) { + len = zt_globals.etlevel; + if (ioctl(zchan->sockfd, codes.ECHOTRAIN, &len)) { + zap_log(ZAP_LOG_WARNING, "Echo training not available for %d:%d\n", zchan->span_id, zchan->chan_id); + } } } commit 84b1e2f805107391e660ce2133036d2a71f4912d Author: Jeff Lenk <jeff@jefflenk.com> Date: Tue Aug 24 22:10:48 2010 -0500 VS2010 x64 tweak solution diff --git a/Freeswitch.2010.sln b/Freeswitch.2010.sln index c103979..e6b1335 100644 --- a/Freeswitch.2010.sln +++ b/Freeswitch.2010.sln @@ -2390,9 +2390,11 @@ Global {D578E676-7EC8-4548-BD8B-845C635F14AD}.Debug|Win32.ActiveCfg = Debug|Win32 {D578E676-7EC8-4548-BD8B-845C635F14AD}.Debug|Win32.Build.0 = Debug|Win32 {D578E676-7EC8-4548-BD8B-845C635F14AD}.Debug|x64.ActiveCfg = Debug|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Debug|x64.Build.0 = Debug|Win32 {D578E676-7EC8-4548-BD8B-845C635F14AD}.Release|Win32.ActiveCfg = Release|Win32 {D578E676-7EC8-4548-BD8B-845C635F14AD}.Release|Win32.Build.0 = Release|Win32 {D578E676-7EC8-4548-BD8B-845C635F14AD}.Release|x64.ActiveCfg = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Release|x64.Build.0 = Release|Win32 {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.All|Win32.ActiveCfg = Release|x64 {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.All|x64.ActiveCfg = Release|x64 {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.All|x64.Build.0 = Release|x64 commit e96a9cf63f2affe08ba9314bf13866bd817d703a Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Aug 24 19:12:24 2010 -0500 MODSOFIA-90 diff --git a/src/switch_rtp.c b/src/switch_rtp.c index b44f628..c9f9bfa 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -3680,9 +3680,10 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra send_msg = frame->packet; len = frame->packetlen; ts = 0; - if (frame->codec && frame->codec->agreed_pt == frame->payload) { - send_msg->header.pt = payload; - } + // Trying this based on http://jira.freeswitch.org/browse/MODSOFIA-90 + //if (frame->codec && frame->codec->agreed_pt == frame->payload) { + send_msg->header.pt = payload; + //} } else { data = frame->data; len = frame->datalen; commit 0a6ae735c747ae52e3ace461472fb6b563fee5d7 Author: Mathieu Rene <mrene@avgs.ca> Date: Tue Aug 24 18:09:25 2010 -0400 Avoiding segfault diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 2ded7ee..1623d3d 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1160,7 +1160,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand sql = switch_mprintf("delete from sip_registrations where call_id='%q'", call_id); } } else { - sql = switch_mprintf("delete from sip_subscriptions where sip_user='%q' and sip_host='%q'"); + sql = switch_mprintf("delete from sip_subscriptions where sip_user='%q' and sip_host='%q'", to_user, reg_host); sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); sql = switch_mprintf("delete from sip_registrations where sip_user='%q' and sip_host='%q'", to_user, reg_host); } commit 83a5342bfab646c3f0c2a2c7623d949b3fa23f7e Author: Mathieu Parent <math.parent@gmail.com> Date: Tue Aug 24 23:53:10 2010 +0200 Skinny: fix autocompletion "skinny profile internal device <tab>" now works diff --git a/src/mod/endpoints/mod_skinny/skinny_api.c b/src/mod/endpoints/mod_skinny/skinny_api.c index cf54deb..0ef0beb 100644 --- a/src/mod/endpoints/mod_skinny/skinny_api.c +++ b/src/mod/endpoints/mod_skinny/skinny_api.c @@ -93,7 +93,7 @@ static switch_status_t skinny_api_list_devices(const char *line, const char *cur status = SWITCH_STATUS_MEMERR; return status; } - if (!(argc = switch_separate_string(myline, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) || argc != 5) { + if (!(argc = switch_separate_string(myline, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) || argc < 4) { return status; } commit 89216756680a56196771dd3139d6f5e38908c0eb Author: Mathieu Parent <math.parent@gmail.com> Date: Tue Aug 24 23:35:52 2010 +0200 Skinny: switch to new cache_db abstraction diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index 0c95588..64b354d 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -298,73 +298,82 @@ switch_core_session_t * skinny_profile_find_session(skinny_profile_t *profile, l /*****************************************************************************/ /* SQL FUNCTIONS */ /*****************************************************************************/ -void skinny_execute_sql(skinny_profile_t *profile, char *sql, switch_mutex_t *mutex) +switch_cache_db_handle_t *skinny_get_db_handle(skinny_profile_t *profile) { - switch_core_db_t *db; + switch_cache_db_connection_options_t options = { {0} }; + switch_cache_db_handle_t *dbh = NULL; + + if (!zstr(profile->odbc_dsn)) { + options.odbc_options.dsn = profile->odbc_dsn; + options.odbc_options.user = profile->odbc_user; + options.odbc_options.pass = profile->odbc_pass; + + if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_ODBC, &options) != SWITCH_STATUS_SUCCESS) + dbh = NULL; + return dbh; + } else { + options.core_db_options.db_path = profile->dbname; + if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_CORE_DB, &options) != SWITCH_STATUS_SUCCESS) + dbh = NULL; + return dbh; + } +} + + +switch_status_t skinny_execute_sql(skinny_profile_t *profile, char *sql, switch_mutex_t *mutex) +{ + switch_cache_db_handle_t *dbh = NULL; + switch_status_t status = SWITCH_STATUS_FALSE; if (mutex) { switch_mutex_lock(mutex); } - if (switch_odbc_available() && profile->odbc_dsn) { - switch_odbc_statement_handle_t stmt; - if (switch_odbc_handle_exec(profile->master_odbc, sql, &stmt, NULL) != SWITCH_ODBC_SUCCESS) { - char *err_str; - err_str = switch_odbc_handle_get_error(profile->master_odbc, stmt); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERR: [%s]\n[%s]\n", sql, switch_str_nil(err_str)); - switch_safe_free(err_str); - } - switch_odbc_statement_handle_free(&stmt); - } else { - if (!(db = switch_core_db_open_file(profile->dbname))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname); - goto end; - } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL: %s\n", sql); - switch_core_db_persistant_execute(db, sql, 1); - switch_core_db_close(db); + if (!(dbh = skinny_get_db_handle(profile))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n"); + goto end; } + status = switch_cache_db_execute_sql(dbh, sql, NULL); + end: + + switch_cache_db_release_db_handle(&dbh); + if (mutex) { switch_mutex_unlock(mutex); } -} + return status; +} -switch_bool_t skinny_execute_sql_callback(skinny_profile_t *profile, - switch_mutex_t *mutex, char *sql, switch_core_db_callback_func_t callback, void *pdata) +switch_bool_t skinny_execute_sql_callback(skinny_profile_t *profile, switch_mutex_t *mutex, char *sql, switch_core_db_callback_func_t callback, + void *pdata) { switch_bool_t ret = SWITCH_FALSE; - switch_core_db_t *db; char *errmsg = NULL; + switch_cache_db_handle_t *dbh = NULL; if (mutex) { switch_mutex_lock(mutex); } - if (switch_odbc_available() && profile->odbc_dsn) { - switch_odbc_handle_callback_exec(profile->master_odbc, sql, callback, pdata, NULL); - } else { - if (!(db = switch_core_db_open_file(profile->dbname))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB %s\n", profile->dbname); - goto end; - } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL: %s\n", sql); - switch_core_db_exec(db, sql, callback, pdata, &errmsg); + if (!(dbh = skinny_get_db_handle(profile))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n"); + goto end; + } - if (errmsg) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL ERR: [%s] %s\n", sql, errmsg); - switch_core_db_free(errmsg); - } + switch_cache_db_execute_sql_callback(dbh, sql, callback, pdata, &errmsg); - if (db) { - switch_core_db_close(db); - } + if (errmsg) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL ERR: [%s] %s\n", sql, errmsg); + free(errmsg); } end: + switch_cache_db_release_db_handle(&dbh); + if (mutex) { switch_mutex_unlock(mutex); } diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.h b/src/mod/endpoints/mod_skinny/mod_skinny.h index 68f3fdd..41b9b72 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.h +++ b/src/mod/endpoints/mod_skinny/mod_skinny.h @@ -215,7 +215,8 @@ switch_status_t dump_device(skinny_profile_t *profile, const char *device_name, /*****************************************************************************/ /* SQL FUNCTIONS */ /*****************************************************************************/ -void skinny_execute_sql(skinny_profile_t *profile, char *sql, switch_mutex_t *mutex); +switch_cache_db_handle_t *skinny_get_db_handle(skinny_profile_t *profile); +switch_status_t skinny_execute_sql(skinny_profile_t *profile, char *sql, switch_mutex_t *mutex); switch_bool_t skinny_execute_sql_callback(skinny_profile_t *profile, switch_mutex_t *mutex, char *sql, switch_core_db_callback_func_t callback, void *pdata); commit 2aac00ef819361d25b4c3cbc21cd257c88db8f53 Author: Mathieu Parent <math.parent@gmail.com> Date: Tue Aug 24 22:38:57 2010 +0200 Skinny: MODSKINNY-14 The Cisco 7910 phone is no tone when I try to make a call and hang up. Thanks to Sergio diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index d231d82..0c95588 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -759,6 +759,8 @@ int channel_on_hangup_callback(void *pArg, int argc, char **argv, char **columnN if(listener) { if((call_state == SKINNY_PROCEED) || (call_state == SKINNY_CONNECTED)) { /* calling parties */ send_stop_tone(listener, line_instance, call_id); + send_set_lamp(listener, SKINNY_BUTTON_LINE, line_instance, SKINNY_LAMP_OFF); + send_clear_prompt_status(listener, line_instance, call_id); } send_set_lamp(listener, SKINNY_BUTTON_LINE, line_instance, SKINNY_LAMP_OFF); switch (helper->cause) { commit f34b76c5e63f85a9ccd416c8d403eb576069bcc1 Author: Mathieu Parent <math.parent@gmail.com> Date: Tue Aug 24 22:13:44 2010 +0200 Skinny: MODSKINNY-12 (Cisco phone 7910 transfer button will not work) diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index 4de568b..4fca410 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -1202,6 +1202,13 @@ switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_mess status = skinny_session_hold_line(session, listener, line_instance); } break; + case SKINNY_BUTTON_TRANSFER: + session = skinny_profile_find_session(listener->profile, listener, &line_instance, call_id); + + if(session) { + status = skinny_session_transfer(session, listener, line_instance); + } + break; case SKINNY_BUTTON_VOICEMAIL: skinny_create_incoming_session(listener, &line_instance, &session); skinny_session_process_dest(session, listener, line_instance, "vmain", '\0', 0); diff --git a/src/mod/endpoints/mod_skinny/skinny_tables.c b/src/mod/endpoints/mod_skinny/skinny_tables.c index d9f0aad..f76e843 100644 --- a/src/mod/endpoints/mod_skinny/skinny_tables.c +++ b/src/mod/endpoints/mod_skinny/skinny_tables.c @@ -141,6 +141,7 @@ struct skinny_table SKINNY_BUTTONS[] = { {"LastNumberRedial", SKINNY_BUTTON_LAST_NUMBER_REDIAL}, {"SpeedDial", SKINNY_BUTTON_SPEED_DIAL}, {"Hold", SKINNY_BUTTON_HOLD}, + {"Transfer", SKINNY_BUTTON_TRANSFER}, {"Line", SKINNY_BUTTON_LINE}, {"Voicemail", SKINNY_BUTTON_VOICEMAIL}, {"Privacy", SKINNY_BUTTON_PRIVACY}, diff --git a/src/mod/endpoints/mod_skinny/skinny_tables.h b/src/mod/endpoints/mod_skinny/skinny_tables.h index 0b2c544..6c91825 100644 --- a/src/mod/endpoints/mod_skinny/skinny_tables.h +++ b/src/mod/endpoints/mod_skinny/skinny_tables.h @@ -160,13 +160,14 @@ enum skinny_button_definition { SKINNY_BUTTON_LAST_NUMBER_REDIAL = 0x01, SKINNY_BUTTON_SPEED_DIAL = 0x02, SKINNY_BUTTON_HOLD = 0x03, + SKINNY_BUTTON_TRANSFER = 0x04, SKINNY_BUTTON_LINE = 0x09, SKINNY_BUTTON_VOICEMAIL = 0x0F, SKINNY_BUTTON_PRIVACY = 0x13, SKINNY_BUTTON_SERVICE_URL = 0x14, SKINNY_BUTTON_UNDEFINED = 0xFF, }; -extern struct skinny_table SKINNY_BUTTONS[10]; +extern struct skinny_table SKINNY_BUTTONS[11]; const char *skinny_button2str(uint32_t id); uint32_t skinny_str2button(const char *str); #define SKINNY_PUSH_STIMULI SKINNY_DECLARE_PUSH_MATCH(SKINNY_BUTTONS) commit dc69c2ac962e097cc055d302232327cfd4c94aaf Author: Michael S Collins <msc@freeswitch.org> Date: Tue Aug 24 11:20:24 2010 -0700 Fix typos in stfu.c and stfu.h (thanks diego) diff --git a/libs/stfu/stfu.c b/libs/stfu/stfu.c index a43129e..866ae57 100644 --- a/libs/stfu/stfu.c +++ b/libs/stfu/stfu.c @@ -23,7 +23,7 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * - * THOSE WHO DISAGREE MAY CERTIANLY STFU + * THOSE WHO DISAGREE MAY CERTAINLY STFU */ #include "stfu.h" diff --git a/libs/stfu/stfu.h b/libs/stfu/stfu.h index dd47d49..17f01e3 100644 --- a/libs/stfu/stfu.h +++ b/libs/stfu/stfu.h @@ -23,7 +23,7 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * - * THOSE WHO DISAGREE MAY CERTIANLY STFU + * THOSE WHO DISAGREE MAY CERTAINLY STFU */ #ifndef STFU_H commit c4a9f9e78b088000c6d51bad21d497206e4a7b09 Author: Jeff Lenk <jeff@jefflenk.com> Date: Tue Aug 24 13:02:57 2010 -0500 swig vs2010 diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx index 8759c33..031effd 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx @@ -1371,6 +1371,16 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_BRIDGE_VARIABLE_get() { } +SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_LAST_BRIDGE_VARIABLE_get() { + char * jresult ; + char *result = 0 ; + + result = (char *)("last_bridge_to"); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SIGNAL_BRIDGE_VARIABLE_get() { char * jresult ; char *result = 0 ; @@ -11045,6 +11055,18 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_strip_spaces(char * jarg1) { } +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_strip_whitespace(char * jarg1) { + char * jresult ; + char *arg1 = (char *) 0 ; + char *result = 0 ; + + arg1 = (char *)jarg1; + result = (char *)switch_strip_whitespace((char const *)arg1); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_switch_strip_commas(char * jarg1, char * jarg2, void * jarg3) { char * jresult ; char *arg1 = (char *) 0 ; @@ -12304,6 +12326,28 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_profile_next_get(void * jarg1 } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_direction_set(void * jarg1, int jarg2) { + switch_caller_profile *arg1 = (switch_caller_profile *) 0 ; + switch_call_direction_t arg2 ; + + arg1 = (switch_caller_profile *)jarg1; + arg2 = (switch_call_direction_t)jarg2; + if (arg1) (arg1)->direction = arg2; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_caller_profile_direction_get(void * jarg1) { + int jresult ; + switch_caller_profile *arg1 = (switch_caller_profile *) 0 ; + switch_call_direction_t result; + + arg1 = (switch_caller_profile *)jarg1; + result = (switch_call_direction_t) ((arg1)->direction); + jresult = result; + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_caller_profile() { void * jresult ; switch_caller_profile *result = 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs index c720c10..8930e7b 100644 --- a/src/mod/languages/mod_managed/managed/swig.2010.cs +++ b/src/mod/languages/mod_managed/managed/swig.2010.cs @@ -2638,6 +2638,11 @@ public class freeswitch { return ret; } + public static string switch_strip_whitespace(string str) { + string ret = freeswitchPINVOKE.switch_strip_whitespace(str); + return ret; + } + public static string switch_strip_commas(string arg0, string arg1, SWIGTYPE_p_switch_size_t len) { string ret = freeswitchPINVOKE.switch_strip_commas(arg0, arg1, SWIGTYPE_p_switch_size_t.getCPtr(len)); if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); @@ -4990,6 +4995,7 @@ public class freeswitch { public static readonly string SWITCH_L_SDP_VARIABLE = freeswitchPINVOKE.SWITCH_L_SDP_VARIABLE_get(); public static readonly string SWITCH_B_SDP_VARIABLE = freeswitchPINVOKE.SWITCH_B_SDP_VARIABLE_get(); public static readonly string SWITCH_BRIDGE_VARIABLE = freeswitchPINVOKE.SWITCH_BRIDGE_VARIABLE_get(); + public static readonly string SWITCH_LAST_BRIDGE_VARIABLE = freeswitchPINVOKE.SWITCH_LAST_BRIDGE_VARIABLE_get(); public static readonly string SWITCH_SIGNAL_BRIDGE_VARIABLE = freeswitchPINVOKE.SWITCH_SIGNAL_BRIDGE_VARIABLE_get(); public static readonly string SWITCH_SIGNAL_BOND_VARIABLE = freeswitchPINVOKE.SWITCH_SIGNAL_BOND_VARIABLE_get(); public static readonly string SWITCH_ORIGINATOR_VARIABLE = freeswitchPINVOKE.SWITCH_ORIGINATOR_VARIABLE_get(); @@ -5586,6 +5592,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_BRIDGE_VARIABLE_get")] public static extern string SWITCH_BRIDGE_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_LAST_BRIDGE_VARIABLE_get")] + public static extern string SWITCH_LAST_BRIDGE_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SIGNAL_BRIDGE_VARIABLE_get")] public static extern string SWITCH_SIGNAL_BRIDGE_VARIABLE_get(); @@ -7905,6 +7914,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_strip_spaces")] public static extern string switch_strip_spaces(string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_strip_whitespace")] + public static extern string switch_strip_whitespace(string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_strip_commas")] public static extern string switch_strip_commas(string jarg1, string jarg2, HandleRef jarg3); @@ -8178,6 +8190,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_next_get")] public static extern IntPtr switch_caller_profile_next_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_direction_set")] + public static extern void switch_caller_profile_direction_set(HandleRef jarg1, int jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_direction_get")] + public static extern int switch_caller_profile_direction_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_caller_profile")] public static extern IntPtr new_switch_caller_profile(); @@ -20143,6 +20161,16 @@ public class switch_caller_profile : IDisposable { } } + public switch_call_direction_t direction { + set { + freeswitchPINVOKE.switch_caller_profile_direction_set(swigCPtr, (int)value); + } + get { + switch_call_direction_t ret = (switch_call_direction_t)freeswitchPINVOKE.switch_caller_profile_direction_get(swigCPtr); + return ret; + } + } + public switch_caller_profile() : this(freeswitchPINVOKE.new_switch_caller_profile(), true) { } @@ -21819,7 +21847,9 @@ namespace FreeSWITCH.Native { SCF_CALIBRATE_CLOCK = (1 << 8), SCF_USE_HEAVY_TIMING = (1 << 9), SCF_USE_CLOCK_RT = (1 << 10), - SCF_VERBOSE_EVENTS = (1 << 11) + SCF_VERBOSE_EVENTS = (1 << 11), + SCF_USE_WIN32_MONOTONIC = (1 << 12), + SCF_AUTO_SCHEMAS = (1 << 13) } } @@ -25654,7 +25684,8 @@ namespace FreeSWITCH.Native { [System.Flags] public enum switch_io_flag_enum_t { SWITCH_IO_FLAG_NONE = 0, - SWITCH_IO_FLAG_NOBLOCK = (1 << 0) + SWITCH_IO_FLAG_NOBLOCK = (1 << 0), + SWITCH_IO_FLAG_SINGLE_READ = (1 << 1) } } commit 8ec9e21490d4145c9393bcae3f2a1712ec247bde Author: Moises Silva <moy@sangoma.com> Date: Tue Aug 24 13:54:14 2010 -0400 mod_sangoma_codec: add SOAP server configuration diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index add0dbc..3eae901 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -54,6 +54,8 @@ static sngtc_init_cfg_t g_init_cfg; /* configured RTP IP */ static int g_rtpip = 0; +static char g_soap_url[255] = ""; + /* \brief protect vocallo session creation and destroy */ static switch_mutex_t *g_sessions_lock = NULL; @@ -126,9 +128,6 @@ struct codec_data { long lastrxseqno; unsigned long rxlost; - /* discarded silence packets */ - unsigned long rxdiscarded; - /* avg Rx time */ switch_time_t avgrxus; switch_time_t last_rx_time; @@ -366,6 +365,7 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec switch_mutex_lock(g_sessions_lock); err = sngtc_create_transcoding_session(&sess->encoder.request, &sess->encoder.reply, 0); if (err) { + memset(&sess->encoder, 0, sizeof(sess->encoder)); switch_mutex_unlock(g_sessions_lock); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create Sangoma encoding session.\n"); return SWITCH_STATUS_FALSE; @@ -403,31 +403,26 @@ static switch_status_t switch_sangoma_encode(switch_codec_t *codec, switch_codec sess->encoder.tx++; /* do the reading */ - for ( ; ; ) { - sres = switch_rtp_zerocopy_read_frame(sess->encoder.rxrtp, &encoded_frame, SWITCH_IO_FLAG_NOBLOCK); - if (sres == SWITCH_STATUS_GENERR) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to read on Sangoma encoder RTP session: %d\n", sres); - return SWITCH_STATUS_FALSE; - } - - if (0 == encoded_frame.datalen) { - break; - } - - if (encoded_frame.payload != codec->implementation->ianacode - && encoded_frame.payload != IANACODE_CN) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read unexpected payload %d in Sangoma encoder RTP session, expecting %d\n", - encoded_frame.payload, codec->implementation->ianacode); - break; - } + memset(&encoded_frame, 0, sizeof(encoded_frame)); + sres = switch_rtp_zerocopy_read_frame(sess->encoder.rxrtp, &encoded_frame, SWITCH_IO_FLAG_NOBLOCK); + if (sres == SWITCH_STATUS_GENERR) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to read on Sangoma encoder RTP session: %d\n", sres); + return SWITCH_STATUS_FALSE; + } - if (*encoded_data_len) { - sess->encoder.rxdiscarded++; - } + if (0 == encoded_frame.datalen) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No output on Sangoma encoder RTP session.\n"); + return SWITCH_STATUS_SUCCESS; + } - memcpy(encoded_data, encoded_frame.data, encoded_frame.datalen); - *encoded_data_len = encoded_frame.datalen; + if (encoded_frame.payload != codec->implementation->ianacode + && encoded_frame.payload != IANACODE_CN) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read unexpected payload %d in Sangoma encoder RTP session, expecting %d\n", + encoded_frame.payload, codec->implementation->ianacode); + return SWITCH_STATUS_FALSE; } + memcpy(encoded_data, encoded_frame.data, encoded_frame.datalen); + *encoded_data_len = encoded_frame.datalen; /* update encoding stats */ sess->encoder.rx++; @@ -490,6 +485,7 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses switch_mutex_lock(g_sessions_lock); err = sngtc_create_transcoding_session(&sess->decoder.request, &sess->decoder.reply, 0); if (err) { + memset(&sess->decoder, 0, sizeof(sess->decoder)); switch_mutex_unlock(g_sessions_lock); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create Sangoma decoding session.\n"); return SWITCH_STATUS_FALSE; @@ -521,34 +517,30 @@ static switch_status_t switch_sangoma_decode(switch_codec_t *codec, /* codec ses sess->decoder.tx++; /* do the reading */ - for ( ; ; ) { - sres = switch_rtp_zerocopy_read_frame(sess->decoder.rxrtp, &ulaw_frame, SWITCH_IO_FLAG_NOBLOCK); - if (sres == SWITCH_STATUS_GENERR) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to read on Sangoma decoder RTP session: %d\n", sres); - return SWITCH_STATUS_FALSE; - } - - if (0 == ulaw_frame.datalen) { - break; - } + memset(&ulaw_frame, 0, sizeof(ulaw_frame)); + sres = switch_rtp_zerocopy_read_frame(sess->decoder.rxrtp, &ulaw_frame, SWITCH_IO_FLAG_NOBLOCK); + if (sres == SWITCH_STATUS_GENERR) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to read on Sangoma decoder RTP session: %d\n", sres); + return SWITCH_STATUS_FALSE; + } - if (ulaw_frame.payload != IANA_ULAW - && ulaw_frame.payload != IANACODE_CN) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read unexpected payload %d in Sangoma decoder RTP session, expecting %d\n", - ulaw_frame.payload, IANA_ULAW); - break; - } + if (0 == ulaw_frame.datalen) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No output on Sangoma decoder RTP session.\n"); + return SWITCH_STATUS_SUCCESS; + } - if (*decoded_data_len) { - sess->decoder.rxdiscarded++; - } + if (ulaw_frame.payload != IANA_ULAW + && ulaw_frame.payload != IANACODE_CN) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Read unexpected payload %d in Sangoma decoder RTP session, expecting %d\n", + ulaw_frame.payload, IANA_ULAW); + return SWITCH_STATUS_FALSE; + } - /* transcode to linear */ - for (i = 0; i < ulaw_frame.datalen; i++) { - dbuf_linear[i] = ulaw_to_linear(((char *)ulaw_frame.data)[i]); - } - *decoded_data_len = i * 2; + /* transcode to linear */ + for (i = 0; i < ulaw_frame.datalen; i++) { + dbuf_linear[i] = ulaw_to_linear(((char *)ulaw_frame.data)[i]); } + *decoded_data_len = i * 2; /* update decoding stats */ sess->decoder.rx++; @@ -584,9 +576,11 @@ static switch_status_t switch_sangoma_destroy(switch_codec_t *codec) if (sess->encoder.txrtp) { sngtc_free_transcoding_session(&sess->encoder.reply); + memset(&sess->encoder, 0, sizeof(sess->encoder)); } if (sess->decoder.txrtp) { sngtc_free_transcoding_session(&sess->decoder.reply); + memset(&sess->decoder, 0, sizeof(sess->decoder)); } switch_core_hash_delete(g_sessions_hash, sess->hashkey); @@ -720,7 +714,6 @@ SWITCH_STANDARD_API(sangoma_function) if (sess->encoder.rxrtp) { stats = switch_rtp_get_stats(sess->encoder.rxrtp, NULL); stream->write_function(stream, "-- Encoder Inbound Stats --\n"); - stream->write_function(stream, "Rx Discarded: %lu\n", sess->encoder.rxdiscarded); sangoma_print_stats(stream, &stats->inbound); @@ -732,7 +725,6 @@ SWITCH_STANDARD_API(sangoma_function) if (sess->decoder.rxrtp) { stats = switch_rtp_get_stats(sess->decoder.rxrtp, NULL); stream->write_function(stream, "-- Decoder Inbound Stats --\n"); - stream->write_function(stream, "Rx Discarded: %lu\n", sess->decoder.rxdiscarded); sangoma_print_stats(stream, &stats->inbound); stats = switch_rtp_get_stats(sess->decoder.txrtp, NULL); @@ -816,6 +808,9 @@ static int sangoma_parse_config(void) } else if (!strcasecmp(var, "noregister")) { strncpy(g_codec_noregister_list, val, sizeof(g_codec_noregister_list)-1); g_codec_noregister_list[sizeof(g_codec_noregister_list)-1] = 0; + } else if (!strcasecmp(var, "soapserver")) { + strncpy(g_soap_url, val, sizeof(g_soap_url)-1); + g_soap_url[sizeof(g_soap_url)-1] = 0; } else if (!strcasecmp(var, "rtpip")) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found Sangoma RTP IP %s\n", val); if (switch_inet_pton(AF_INET, val, &rtpaddr) <= 0) { @@ -884,6 +879,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sangoma_codec_load) } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Detected %d and activated %d Sangoma codec vocallo modules\n", detected, activated); + if (strlen(g_soap_url)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Using %s SOAP server\n", g_soap_url); + sngtc_set_soap_server_url(g_soap_url); + } + switch_mutex_init(&g_sessions_lock, SWITCH_MUTEX_UNNESTED, pool); switch_core_hash_init(&g_sessions_hash, pool); commit 812a275f47c3abc256ab01e8414092d215ac5325 Author: Brian West <brian@freeswitch.org> Date: Tue Aug 24 12:02:01 2010 -0500 swigall diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index df62c72..d465083 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -1466,6 +1466,17 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_BRIDGE_VARIABLE_get() { } +SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_LAST_BRIDGE_VARIABLE_get() { + char * jresult ; + char *result = 0 ; + + result = (char *) "last_bridge_to"; + + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SIGNAL_BRIDGE_VARIABLE_get() { char * jresult ; char *result = 0 ; @@ -11329,6 +11340,18 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_strip_spaces(char * jarg1) { } +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_strip_whitespace(char * jarg1) { + char * jresult ; + char *arg1 = (char *) 0 ; + char *result = 0 ; + + arg1 = (char *)jarg1; + result = (char *)switch_strip_whitespace((char const *)arg1); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_switch_strip_commas(char * jarg1, char * jarg2, void * jarg3) { char * jresult ; char *arg1 = (char *) 0 ; @@ -12604,6 +12627,29 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_profile_next_get(void * jarg1 } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_direction_set(void * jarg1, int jarg2) { + switch_caller_profile *arg1 = (switch_caller_profile *) 0 ; + switch_call_direction_t arg2 ; + + arg1 = (switch_caller_profile *)jarg1; + arg2 = (switch_call_direction_t)jarg2; + if (arg1) (arg1)->direction = arg2; + +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_caller_profile_direction_get(void * jarg1) { + int jresult ; + switch_caller_profile *arg1 = (switch_caller_profile *) 0 ; + switch_call_direction_t result; + + arg1 = (switch_caller_profile *)jarg1; + result = (switch_call_direction_t) ((arg1)->direction); + jresult = result; + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_caller_profile() { void * jresult ; switch_caller_profile *result = 0 ; @@ -22836,35 +22882,41 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_test_private_flag(void * jarg1, } -SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_app_flag(void * jarg1, unsigned long jarg2) { - switch_channel_t *arg1 = (switch_channel_t *) 0 ; - uint32_t arg2 ; +SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_app_flag_key(char * jarg1, void * jarg2, unsigned long jarg3) { + char *arg1 = (char *) 0 ; + switch_channel_t *arg2 = (switch_channel_t *) 0 ; + uint32_t arg3 ; - arg1 = (switch_channel_t *)jarg1; - arg2 = (uint32_t)jarg2; - switch_channel_set_app_flag(arg1,arg2); + arg1 = (char *)jarg1; + arg2 = (switch_channel_t *)jarg2; + arg3 = (uint32_t)jarg3; + switch_channel_set_app_flag_key((char const *)arg1,arg2,arg3); } -SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_clear_app_flag(void * jarg1, unsigned long jarg2) { - switch_channel_t *arg1 = (switch_channel_t *) 0 ; - uint32_t arg2 ; +SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_clear_app_flag_key(char * jarg1, void * jarg2, unsigned long jarg3) { + char *arg1 = (char *) 0 ; + switch_channel_t *arg2 = (switch_channel_t *) 0 ; + uint32_t arg3 ; - arg1 = (switch_channel_t *)jarg1; - arg2 = (uint32_t)jarg2; - switch_channel_clear_app_flag(arg1,arg2); + arg1 = (char *)jarg1; + arg2 = (switch_channel_t *)jarg2; + arg3 = (uint32_t)jarg3; + switch_channel_clear_app_flag_key((char const *)arg1,arg2,arg3); } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_test_app_flag(void * jarg1, unsigned long jarg2) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_test_app_flag_key(char * jarg1, void * jarg2, unsigned long jarg3) { int jresult ; - switch_channel_t *arg1 = (switch_channel_t *) 0 ; - uint32_t arg2 ; + char *arg1 = (char *) 0 ; + switch_channel_t *arg2 = (switch_channel_t *) 0 ; + uint32_t arg3 ; int result; - arg1 = (switch_channel_t *)jarg1; - arg2 = (uint32_t)jarg2; - result = (int)switch_channel_test_app_flag(arg1,arg2); + arg1 = (char *)jarg1; + arg2 = (switch_channel_t *)jarg2; + arg3 = (uint32_t)jarg3; + result = (int)switch_channel_test_app_flag_key((char const *)arg1,arg2,arg3); jresult = result; return jresult; } diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index 3faa019..41f224c 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -2628,6 +2628,11 @@ public class freeswitch { return ret; } + public static string switch_strip_whitespace(string str) { + string ret = freeswitchPINVOKE.switch_strip_whitespace(str); + return ret; + } + public static string switch_strip_commas(string arg0, string arg1, SWIGTYPE_p_switch_size_t len) { string ret = freeswitchPINVOKE.switch_strip_commas(arg0, arg1, SWIGTYPE_p_switch_size_t.getCPtr(len)); if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); @@ -3236,16 +3241,16 @@ public class freeswitch { return ret; } - public static void switch_channel_set_app_flag(SWIGTYPE_p_switch_channel channel, uint flags) { - freeswitchPINVOKE.switch_channel_set_app_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), flags); + public static void switch_channel_set_app_flag_key(string app, SWIGTYPE_p_switch_channel channel, uint flags) { + freeswitchPINVOKE.switch_channel_set_app_flag_key(app, SWIGTYPE_p_switch_channel.getCPtr(channel), flags); } - public static void switch_channel_clear_app_flag(SWIGTYPE_p_switch_channel channel, uint flags) { - freeswitchPINVOKE.switch_channel_clear_app_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), flags); + public static void switch_channel_clear_app_flag_key(string app, SWIGTYPE_p_switch_channel channel, uint flags) { + freeswitchPINVOKE.switch_channel_clear_app_flag_key(app, SWIGTYPE_p_switch_channel.getCPtr(channel), flags); } - public static int switch_channel_test_app_flag(SWIGTYPE_p_switch_channel channel, uint flags) { - int ret = freeswitchPINVOKE.switch_channel_test_app_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), flags); + public static int switch_channel_test_app_flag_key(string app, SWIGTYPE_p_switch_channel channel, uint flags) { + int ret = freeswitchPINVOKE.switch_channel_test_app_flag_key(app, SWIGTYPE_p_switch_channel.getCPtr(channel), flags); return ret; } @@ -4980,6 +4985,7 @@ public class freeswitch { public static readonly string SWITCH_L_SDP_VARIABLE = freeswitchPINVOKE.SWITCH_L_SDP_VARIABLE_get(); public static readonly string SWITCH_B_SDP_VARIABLE = freeswitchPINVOKE.SWITCH_B_SDP_VARIABLE_get(); public static readonly string SWITCH_BRIDGE_VARIABLE = freeswitchPINVOKE.SWITCH_BRIDGE_VARIABLE_get(); + public static readonly string SWITCH_LAST_BRIDGE_VARIABLE = freeswitchPINVOKE.SWITCH_LAST_BRIDGE_VARIABLE_get(); public static readonly string SWITCH_SIGNAL_BRIDGE_VARIABLE = freeswitchPINVOKE.SWITCH_SIGNAL_BRIDGE_VARIABLE_get(); public static readonly string SWITCH_SIGNAL_BOND_VARIABLE = freeswitchPINVOKE.SWITCH_SIGNAL_BOND_VARIABLE_get(); public static readonly string SWITCH_ORIGINATOR_VARIABLE = freeswitchPINVOKE.SWITCH_ORIGINATOR_VARIABLE_get(); @@ -5572,6 +5578,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_BRIDGE_VARIABLE_get")] public static extern string SWITCH_BRIDGE_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_LAST_BRIDGE_VARIABLE_get")] + public static extern string SWITCH_LAST_BRIDGE_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SIGNAL_BRIDGE_VARIABLE_get")] public static extern string SWITCH_SIGNAL_BRIDGE_VARIABLE_get(); @@ -7891,6 +7900,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_strip_spaces")] public static extern string switch_strip_spaces(string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_strip_whitespace")] + public static extern string switch_strip_whitespace(string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_strip_commas")] public static extern string switch_strip_commas(string jarg1, string jarg2, HandleRef jarg3); @@ -8164,6 +8176,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_next_get")] public static extern IntPtr switch_caller_profile_next_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_direction_set")] + public static extern void switch_caller_profile_direction_set(HandleRef jarg1, int jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_direction_get")] + public static extern int switch_caller_profile_direction_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_caller_profile")] public static extern IntPtr new_switch_caller_profile(); @@ -10699,14 +10717,14 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_test_private_flag")] public static extern int switch_channel_test_private_flag(HandleRef jarg1, uint jarg2); - [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_app_flag")] - public static extern void switch_channel_set_app_flag(HandleRef jarg1, uint jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_app_flag_key")] + public static extern void switch_channel_set_app_flag_key(string jarg1, HandleRef jarg2, uint jarg3); - [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_clear_app_flag")] - public static extern void switch_channel_clear_app_flag(HandleRef jarg1, uint jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_clear_app_flag_key")] + public static extern void switch_channel_clear_app_flag_key(string jarg1, HandleRef jarg2, uint jarg3); - [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_test_app_flag")] - public static extern int switch_channel_test_app_flag(HandleRef jarg1, uint jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_test_app_flag_key")] + public static extern int switch_channel_test_app_flag_key(string jarg1, HandleRef jarg2, uint jarg3); [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_hangup_time")] public static extern void switch_channel_set_hangup_time(HandleRef jarg1); @@ -20185,6 +20203,16 @@ public class switch_caller_profile : IDisposable { } } + public switch_call_direction_t direction { + set { + freeswitchPINVOKE.switch_caller_profile_direction_set(swigCPtr, (int)value); + } + get { + switch_call_direction_t ret = (switch_call_direction_t)freeswitchPINVOKE.switch_caller_profile_direction_get(swigCPtr); + return ret; + } + } + public switch_caller_profile() : this(freeswitchPINVOKE.new_switch_caller_profile(), true) { } @@ -21749,7 +21777,9 @@ namespace FreeSWITCH.Native { SCF_CALIBRATE_CLOCK = (1 << 8), SCF_USE_HEAVY_TIMING = (1 << 9), SCF_USE_CLOCK_RT = (1 << 10), - SCF_VERBOSE_EVENTS = (1 << 11) + SCF_VERBOSE_EVENTS = (1 << 11), + SCF_USE_WIN32_MONOTONIC = (1 << 12), + SCF_AUTO_SCHEMAS = (1 << 13) } } @@ -25528,7 +25558,8 @@ namespace FreeSWITCH.Native { [System.Flags] public enum switch_io_flag_enum_t { SWITCH_IO_FLAG_NONE = 0, - SWITCH_IO_FLAG_NOBLOCK = (1 << 0) + SWITCH_IO_FLAG_NOBLOCK = (1 << 0), + SWITCH_IO_FLAG_SINGLE_READ = (1 << 1) } } commit facf09b83938d37fd1024e8c52c92beb121bc909 Author: Brian West <brian@freeswitch.org> Date: Tue Aug 24 11:58:43 2010 -0500 MODFORM-41 diff --git a/src/mod/formats/mod_sndfile/mod_sndfile.c b/src/mod/formats/mod_sndfile/mod_sndfile.c index 26c5a5d..a99759f 100644 --- a/src/mod/formats/mod_sndfile/mod_sndfile.c +++ b/src/mod/formats/mod_sndfile/mod_sndfile.c @@ -134,11 +134,11 @@ static switch_status_t sndfile_file_open(switch_file_handle_t *handle, const cha context->sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_GSM610; context->sfinfo.channels = 1; context->sfinfo.samplerate = 8000; - } else if (!strcmp(ext, "ul")) { + } else if (!strcmp(ext, "ul") || !strcmp(ext, "ulaw")) { context->sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_ULAW; context->sfinfo.channels = 1; context->sfinfo.samplerate = 8000; - } else if (!strcmp(ext, "al")) { + } else if (!strcmp(ext, "al") || !strcmp(ext, "alaw")) { context->sfinfo.format = SF_FORMAT_RAW | SF_FORMAT_ALAW; context->sfinfo.channels = 1; context->sfinfo.samplerate = 8000; @@ -334,7 +334,7 @@ static switch_status_t setup_formats(void) char buffer[128]; int format, major_count, subtype_count, m, s; int len, x, skip; - char *extras[] = { "r8", "r16", "r24", "r32", "gsm", "ul", "al", "adpcm", NULL }; + char *extras[] = { "r8", "r16", "r24", "r32", "gsm", "ul", "ulaw", "al", "alaw", "adpcm", NULL }; int exlen = (sizeof(extras) / sizeof(extras[0])); buffer[0] = 0; commit 0ea84c869c05d54f3b5e29b29b96b6dc727397e4 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Aug 24 11:53:46 2010 -0500 presence update diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index de5e8d4..775451d 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -522,7 +522,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event) alt_event_type = "presence"; } - if ((user = strdup(from))) { + if (from && (user = strdup(from))) { if ((host = strchr(user, '@'))) { char *p; *host++ = '\0'; @@ -1065,7 +1065,7 @@ static char *gen_pidf(char *user_agent, char *id, char *url, char *open, char *r *ct = "application/xpidf+xml"; /* If unknown/none prpid is provided, just show the user as online. */ - if (!prpid) { + if (!prpid || !strcasecmp(prpid, "unknown")) { prpid = "online"; } @@ -1099,10 +1099,13 @@ static char *gen_pidf(char *user_agent, char *id, char *url, char *open, char *r } if (!strncasecmp(status, "Registered", 10)) { - prpid = NULL; status = "Available"; } + if (!strcasecmp(status, "Available")) { + prpid = NULL; + } + if (!strcasecmp(status, "Unregistered")) { prpid = NULL; @@ -1116,6 +1119,7 @@ static char *gen_pidf(char *user_agent, char *id, char *url, char *open, char *r if (zstr(status) && !zstr(prpid)) { status = "Available"; + prpid = NULL; } if (prpid) { diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 8ac765a..2ded7ee 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1336,7 +1336,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "login", profile->name); switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, reg_host); - switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "rpid", "online"); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "rpid", "unknown"); switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "status", "Registered"); switch_event_fire(&s_event); } commit 62206e3d436f82b4b7ea6b241845e5baf77c327d Author: Jeff Lenk <jeff@jefflenk.com> Date: Tue Aug 24 08:55:00 2010 -0500 FSBUILD-296 Fix VS2008 code analysis build diff --git a/libs/esl/src/esl_json.c b/libs/esl/src/esl_json.c index 5a994ae..2926a32 100644 --- a/libs/esl/src/esl_json.c +++ b/libs/esl/src/esl_json.c @@ -163,7 +163,7 @@ static const char *parse_string(cJSON *item,const char *str) case 'r': *ptr2++='\r'; break; case 't': *ptr2++='\t'; break; case 'u': // transcode utf16 to utf8. DOES NOT SUPPORT SURROGATE PAIRS CORRECTLY. - sscanf(ptr+1,"%4x",&uc); // get the unicode char. + if (sscanf(ptr+1,"%4x",&uc) < 1) break; // get the unicode char. len=3;if (uc<0x80) len=1;else if (uc<0x800) len=2;ptr2+=len; switch (len) { diff --git a/src/switch_json.c b/src/switch_json.c index 814f696..e0e27ba 100644 --- a/src/switch_json.c +++ b/src/switch_json.c @@ -162,7 +162,7 @@ static const char *parse_string(cJSON *item,const char *str) case 'r': *ptr2++='\r'; break; case 't': *ptr2++='\t'; break; case 'u': // transcode utf16 to utf8. DOES NOT SUPPORT SURROGATE PAIRS CORRECTLY. - sscanf(ptr+1,"%4x",&uc); // get the unicode char. + if (sscanf(ptr+1,"%4x",&uc) < 1) break; // get the unicode char. len=3;if (uc<0x80) len=1;else if (uc<0x800) len=2;ptr2+=len; switch (len) { commit e5aef4cd9a6f55a776d07e4e3424a4e68654ec1e Author: Jeff Lenk <jeff@jefflenk.com> Date: Tue Aug 24 08:11:59 2010 -0500 FSCORE-658 Windows VS2008 switch_event.c compile error diff --git a/src/switch_event.c b/src/switch_event.c index 2cc6bbb..1301d92 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -320,7 +320,7 @@ static void *SWITCH_THREAD_FUNC switch_event_thread(switch_thread_t *thread, voi max = SOFT_MAX_DISPATCH; switch_mutex_unlock(EVENT_QUEUE_MUTEX); - for (index = 0; index < max; index++) { + for (index = 0; (int)index < max; index++) { if (switch_queue_trypush(EVENT_DISPATCH_QUEUE[index], event) == SWITCH_STATUS_SUCCESS) { event = NULL; break; commit a873b3841a04e0a2e0da535b8af648f017fadb29 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Aug 23 18:18:56 2010 -0500 more presence stuff diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index de5560d..de5e8d4 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1069,11 +1069,6 @@ static char *gen_pidf(char *user_agent, char *id, char *url, char *open, char *r prpid = "online"; } - /* FS currently send prpid closed on register, this force it to online */ - if (!strncasecmp(status, "Registered", 10) && !strcasecmp(prpid, "closed")) { - prpid = "online"; - } - /* of course!, lets make a big deal over dashes. Now the stupidity is complete. */ if (!strcmp(prpid, "on-the-phone")) { prpid = "onthephone"; @@ -1430,9 +1425,11 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * if (direction && !strcasecmp(direction, "outbound")) { op = switch_event_get_header(helper->event, "Other-Leg-Caller-ID-Number"); } else { - if (!(op = switch_event_get_header(helper->event, "Caller-Callee-ID-Number"))) { - op = switch_event_get_header(helper->event, "Caller-Destination-Number"); - } + op = switch_event_get_header(helper->event, "Caller-Callee-ID-Number"); + } + + if (!op) { + op = switch_event_get_header(helper->event, "Caller-Destination-Number"); } if (direction) { @@ -1451,7 +1448,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * } else if (!strcmp(astate, "confirmed")) { if (zstr(op)) { - switch_snprintf(status_line, sizeof(status_line), "On The Phone %s", status); + switch_snprintf(status_line, sizeof(status_line), "On The Phone"); } else { switch_snprintf(status_line, sizeof(status_line), "Talk %s", op); } diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 33f26e9..8ac765a 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1146,6 +1146,13 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand } if (multi_reg) { + if (reg_count == 1) { + sql = switch_mprintf("delete from sip_subscriptions where sip_user='%q' and sip_host='%q' and contact='%q'", + to_user, reg_host, contact_str); + sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); + } + + if (multi_reg_contact) { sql = switch_mprintf("delete from sip_registrations where sip_user='%q' and sip_host='%q' and contact='%q'", to_user, reg_host, contact_str); @@ -1153,6 +1160,8 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand sql = switch_mprintf("delete from sip_registrations where call_id='%q'", call_id); } } else { + sql = switch_mprintf("delete from sip_subscriptions where sip_user='%q' and sip_host='%q'"); + sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); sql = switch_mprintf("delete from sip_registrations where sip_user='%q' and sip_host='%q'", to_user, reg_host); } switch_mutex_lock(profile->ireg_mutex); @@ -1327,7 +1336,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "login", profile->name); switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, reg_host); - switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "rpid", "closed"); + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "rpid", "online"); switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "status", "Registered"); switch_event_fire(&s_event); } commit 362eade2dc9b429eb047607755cdd6df355326cf Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Aug 23 18:08:14 2010 -0500 correction on earlier patch diff --git a/src/switch_event.c b/src/switch_event.c index 8e97bf9..2cc6bbb 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -340,7 +340,7 @@ static void *SWITCH_THREAD_FUNC switch_event_thread(switch_thread_t *thread, voi } - switch_yield(100000); + switch_cond_next(); } } @@ -585,6 +585,7 @@ static void launch_dispatch_threads(uint32_t max, int len, switch_memory_pool_t switch_threadattr_priority_increase(thd_attr); switch_thread_create(&EVENT_DISPATCH_QUEUE_THREADS[index], thd_attr, switch_event_dispatch_thread, EVENT_DISPATCH_QUEUE[index], pool); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Create event dispatch thread %d\n", index); + switch_yield(100000); } SOFT_MAX_DISPATCH = index; commit a62e2cf7bc55a7a6b03f5667bec0dc8c2866f013 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Aug 23 17:02:06 2010 -0500 presence tweaks diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 1ff420d..de5560d 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1283,7 +1283,6 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * switch_stream_handle_t stream = { 0 }; const char *direction = switch_str_nil(switch_event_get_header(helper->event, "presence-call-direction")); const char *uuid = switch_str_nil(switch_event_get_header(helper->event, "unique-id")); - const char *state = switch_str_nil(switch_event_get_header(helper->event, "channel-state")); const char *event_status = switch_str_nil(switch_event_get_header(helper->event, "status")); const char *astate = switch_str_nil(switch_event_get_header(helper->event, "astate")); const char *answer_state = switch_str_nil(switch_event_get_header(helper->event, "answer-state")); @@ -1314,11 +1313,6 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * dft_state = "confirmed"; } - if (!strcasecmp(state, "cs_reporting")) { - goto end; - } - - if (is_dialog) { stream.write_function(&stream, "<?xml version=\"1.0\"?>\n" @@ -1442,7 +1436,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * } if (direction) { - what = !strcasecmp(direction, "outbound") ? "Call" : "Ring"; + what = strcasecmp(direction, "outbound") ? "Call" : "Ring"; } if (!strcmp(astate, "early")) { @@ -2501,20 +2495,22 @@ void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, n exp_delta = (sip->sip_expires ? sip->sip_expires->ex_delta : 3600); exp = (long) switch_epoch_time_now(NULL) + exp_delta; + if ((sql = switch_mprintf("delete from sip_presence where sip_user='%q' and sip_host='%q' " " and profile_name='%q' and hostname='%q'", from_user, from_host, profile->name, mod_sofia_globals.hostname))) { sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); } - + if ((sql = switch_mprintf("insert into sip_presence (sip_user, sip_host, status, rpid, expires, user_agent," " profile_name, hostname, open_closed) " "values ('%q','%q','%q','%q',%ld,'%q','%q','%q','%q')", from_user, from_host, note_txt, rpid, exp, full_agent, profile->name, mod_sofia_globals.hostname, open_closed))) { - + sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); } + event_type = sip_header_as_string(profile->home, (void *) sip->sip_event); diff --git a/src/switch_channel.c b/src/switch_channel.c index 0a358df..d1308a1 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -1500,7 +1500,7 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_running_state( switch_channel_clear_flag(channel, CF_TAGGED); - if (channel->state >= CS_ROUTING && channel->state <= CS_HANGUP) { + if (channel->state == CS_ROUTING || channel->state == CS_HANGUP) { switch_channel_presence(channel, "unknown", (const char *) state_names[state], NULL); } @@ -2388,7 +2388,6 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready_value(swi switch_core_session_execute_application(channel->session, app, arg); } - return SWITCH_STATUS_SUCCESS; } @@ -2450,6 +2449,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_ switch_core_session_kill_channel(other_session, SWITCH_SIG_BREAK); switch_core_session_rwunlock(other_session); } + return SWITCH_STATUS_SUCCESS; } commit 44b7864ec3383f07341facba0ca3a3cb499e039f Merge: 7642dd2 6d74d7a Author: Michael S Collins <msc@freeswitch.org> Date: Mon Aug 23 14:14:06 2010 -0700 Merge branch 'master' of git://git.freeswitch.org/freeswitch commit 7642dd2c88ea16c18fb70e73ee58b00b26017501 Author: Michael S Collins <msc@freeswitch.org> Date: Mon Aug 23 14:13:28 2010 -0700 Fix typo (thanks diegoviola) diff --git a/conf/autoload_configs/switch.conf.xml b/conf/autoload_configs/switch.conf.xml index 55202ef..7a68a7f 100644 --- a/conf/autoload_configs/switch.conf.xml +++ b/conf/autoload_configs/switch.conf.xml @@ -79,7 +79,7 @@ <!--<param name="rtp-end-port" value="32768"/>--> <param name="rtp-enable-zrtp" value="true"/> <!-- <param name="core-db-dsn" value="dsn:username:password" /> --> - <!-- The system will create all the db schemas automaticly, set this to false to avoid this behaviour--> + <!-- The system will create all the db schemas automatically, set this to false to avoid this behaviour--> <!--<param name="auto-create-schemas" value="true"/>--> </settings> commit 6d74d7ab663ce166a6fa2e5ff45079244e4f53e6 Author: Jeff Lenk <jeff@jefflenk.com> Date: Mon Aug 23 15:54:23 2010 -0500 MODAPP-448 Phrase "speak-text" application returns on first key press in phrase file on Windows diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 200126c..75ed2d6 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -627,7 +627,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se if (args->input_callback) { status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen); } else { - switch_copy_string((char *) args->buf, (void *) &dtmf, args->buflen); + *((char *) args->buf) = dtmf.digit; status = SWITCH_STATUS_BREAK; } } @@ -1927,7 +1927,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session if (args->input_callback) { status = args->input_callback(session, (void *) &dtmf, SWITCH_INPUT_TYPE_DTMF, args->buf, args->buflen); } else { - switch_copy_string((char *) args->buf, (void *) &dtmf, args->buflen); + *((char *) args->buf) = dtmf.digit; status = SWITCH_STATUS_BREAK; } } commit 705dd237def5b93cb7b2986ae65a250ff38dc67a Author: Moises Silva <moy@sangoma.com> Date: Mon Aug 23 16:08:06 2010 -0400 freetdm: lock the channel when placing call diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 4d9b522..e0447cd 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2126,24 +2126,28 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_indicate(const char *file, const ch FT_DECLARE(ftdm_status_t) _ftdm_channel_call_place(const char *file, const char *func, int line, ftdm_channel_t *ftdmchan) { - ftdm_status_t status; + ftdm_status_t status = FTDM_FAIL; ftdm_assert(ftdmchan != NULL, "null channel"); - ftdm_set_flag_locked(ftdmchan, FTDM_CHANNEL_OUTBOUND); + + ftdm_channel_lock(ftdmchan); + if (ftdmchan->span->outgoing_call) { - if ((status = ftdmchan->span->outgoing_call(ftdmchan)) == FTDM_SUCCESS) { - ftdm_set_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND); - } - return status; + status = ftdmchan->span->outgoing_call(ftdmchan); } else { + status = FTDM_NOTIMPL; ftdm_log(FTDM_LOG_ERROR, "outgoing_call method not implemented in this span!\n"); } + #ifdef __WINDOWS__ UNREFERENCED_PARAMETER(file); UNREFERENCED_PARAMETER(func); UNREFERENCED_PARAMETER(line); #endif - return FTDM_FAIL; + + ftdm_channel_unlock(ftdmchan); + + return status; } FT_DECLARE(ftdm_status_t) ftdm_channel_set_sig_status(ftdm_channel_t *ftdmchan, ftdm_signaling_status_t sigstatus) commit fcd8df0af73ae7eaad33c69a86104736f21acd8b Author: Moises Silva <moy@sangoma.com> Date: Mon Aug 23 15:44:55 2010 -0400 freetdm: allocate channels in their own memory page when debugging diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 9914796..4d9b522 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -750,9 +750,26 @@ FT_DECLARE(ftdm_status_t) ftdm_span_add_channel(ftdm_span_t *span, ftdm_socket_t ftdm_channel_t *new_chan = span->channels[++span->chan_count]; if (!new_chan) { +#ifdef FTDM_DEBUG_CHAN_MEMORY + void *chanmem = NULL; + int pages = 1; + int pagesize = sysconf(_SC_PAGE_SIZE); + if (sizeof(*new_chan) > pagesize) { + pages = sizeof(*new_chan)/pagesize; + pages++; + } + ftdm_log(FTDM_LOG_DEBUG, "Allocating %d pages of %d bytes for channel of size %d\n", pages, pagesize, sizeof(*new_chan)); + if (posix_memalign(&chanmem, pagesize, pagesize*pages)) { + return FTDM_FAIL; + } + ftdm_log(FTDM_LOG_DEBUG, "Channel pages allocated start at mem %p\n", chanmem); + memset(chanmem, 0, sizeof(*new_chan)); + new_chan = chanmem; +#else if (!(new_chan = ftdm_calloc(1, sizeof(*new_chan)))) { return FTDM_FAIL; } +#endif span->channels[span->chan_count] = new_chan; } commit 252aebf881cecaa5500219d97c252adb89a00a6e Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Aug 23 13:15:58 2010 -0500 FSCORE-656 diff --git a/src/switch_core_db.c b/src/switch_core_db.c index 99688cb..9f557cf 100644 --- a/src/switch_core_db.c +++ b/src/switch_core_db.c @@ -196,7 +196,8 @@ SWITCH_DECLARE(void) switch_core_db_test_reactive(switch_core_db_t *db, char *te { char *errmsg; - if (switch_test_flag((&runtime), SCF_AUTO_SCHEMAS)) { + if (!switch_test_flag((&runtime), SCF_AUTO_SCHEMAS)) { + switch_core_db_exec(db, test_sql, NULL, NULL, NULL); return; } commit af100fd1563aa6e6c335c11482f1e3d0de336dd2 Author: Anthony Minessale <anthm@freeswitch.org> Date: Mon Aug 23 13:11:50 2010 -0500 minor refactor to deal with edge case diff --git a/src/switch_event.c b/src/switch_event.c index daf97ae..8e97bf9 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -314,7 +314,13 @@ static void *SWITCH_THREAD_FUNC switch_event_thread(switch_thread_t *thread, voi event = (switch_event_t *) pop; while (event) { - for (index = 0; index < SOFT_MAX_DISPATCH; index++) { + int max; + + switch_mutex_lock(EVENT_QUEUE_MUTEX); + max = SOFT_MAX_DISPATCH; + switch_mutex_unlock(EVENT_QUEUE_MUTEX); + + for (index = 0; index < max; index++) { if (switch_queue_trypush(EVENT_DISPATCH_QUEUE[index], event) == SWITCH_STATUS_SUCCESS) { event = NULL; break; @@ -322,12 +328,19 @@ static void *SWITCH_THREAD_FUNC switch_event_thread(switch_thread_t *thread, voi } if (event) { + switch_mutex_lock(EVENT_QUEUE_MUTEX); if (SOFT_MAX_DISPATCH + 1 < MAX_DISPATCH) { - switch_mutex_lock(EVENT_QUEUE_MUTEX); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Adding a new event thread #%d\n", SOFT_MAX_DISPATCH + 1); launch_dispatch_threads(SOFT_MAX_DISPATCH + 1, DISPATCH_QUEUE_LEN, RUNTIME_POOL); - switch_mutex_unlock(EVENT_QUEUE_MUTEX); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Event threads maxed out at %d.\n", SOFT_MAX_DISPATCH); + switch_yield(1000000); } + switch_mutex_unlock(EVENT_QUEUE_MUTEX); } + + + switch_yield(100000); } } @@ -571,7 +584,7 @@ static void launch_dispatch_threads(uint32_t max, int len, switch_memory_pool_t switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); switch_threadattr_priority_increase(thd_attr); switch_thread_create(&EVENT_DISPATCH_QUEUE_THREADS[index], thd_attr, switch_event_dispatch_thread, EVENT_DISPATCH_QUEUE[index], pool); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Create event dispatch thread %d\n", index); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Create event dispatch thread %d\n", index); } SOFT_MAX_DISPATCH = index; commit 79ced283b366eb8d608f83c6687e51fbabf84208 Author: Andrew Thompson <andrew@hijacked.us> Date: Sun Aug 22 20:46:04 2010 -0400 Some more tweaks diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index 79a5d64..848a2c5 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -1258,7 +1258,7 @@ session_elem_t *attach_call_to_spawned_process(listener_t *listener, char *modul p = switch_core_alloc(session_element->pool, sizeof(*p)); switch_thread_cond_create(&p->ready_or_found, session_element->pool); - switch_mutex_init(&p->mutex, SWITCH_MUTEX_DEFAULT, session_element->pool); + switch_mutex_init(&p->mutex, SWITCH_MUTEX_UNNESTED, session_element->pool); p->state = reply_not_ready; p->hash = hash; p->pid = NULL; @@ -1266,6 +1266,7 @@ session_elem_t *attach_call_to_spawned_process(listener_t *listener, char *modul session_element->spawn_reply = p; switch_mutex_lock(p->mutex); + p->state = reply_waiting; if (!strcmp(function, "!")) { /* send a message to request a pid */ @@ -1295,8 +1296,6 @@ session_elem_t *attach_call_to_spawned_process(listener_t *listener, char *modul */ } - p->state = reply_waiting; - switch_thread_cond_broadcast(p->ready_or_found); switch_thread_cond_timedwait(p->ready_or_found, p->mutex, 5000000); if (!p->pid) { commit 3798c391777d0edd0984b270891f96d4707f8399 Author: Andrew Thompson <andrew@hijacked.us> Date: Sun Aug 22 20:22:46 2010 -0400 Remove some code we don't use diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index 25d4cf4..79a5d64 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -86,23 +86,6 @@ static switch_status_t socket_logger(const switch_log_node_t *node, switch_log_l } -static void expire_listener(listener_t ** listener) -{ - void *pop; - - switch_thread_rwlock_unlock((*listener)->rwlock); - switch_core_hash_destroy(&(*listener)->event_hash); - switch_core_destroy_memory_pool(&(*listener)->pool); - - while (switch_queue_trypop((*listener)->event_queue, &pop) == SWITCH_STATUS_SUCCESS) { - switch_event_t *pevent = (switch_event_t *) pop; - switch_event_destroy(&pevent); - } - - *listener = NULL; -} - - static void remove_binding(listener_t *listener, erlang_pid * pid) { struct erlang_binding *ptr, *lst = NULL; @@ -211,13 +194,6 @@ static void event_handler(switch_event_t *event) continue; } - if (switch_test_flag(l, LFLAG_STATEFUL) && l->timeout && switch_epoch_time_now(NULL) - l->last_flush > l->timeout) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Stateful Listener %u has expired\n", l->id); - remove_listener(l); - expire_listener(&l); - continue; - } - if (l->event_list[SWITCH_EVENT_ALL]) { send = 1; } else if ((l->event_list[event->event_id])) { diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h index acea53f..248e66b 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h @@ -134,8 +134,6 @@ struct listener { switch_hash_t *sessions; int lost_events; int lost_logs; - time_t last_flush; - uint32_t timeout; uint32_t id; char remote_ip[50]; /*switch_port_t remote_port; */ @@ -166,6 +164,7 @@ struct globals_struct { switch_event_node_t *node; switch_mutex_t *ref_mutex; switch_mutex_t *fetch_reply_mutex; + switch_mutex_t *listener_count_mutex; switch_hash_t *fetch_reply_hash; unsigned int reference0; unsigned int reference1; commit 6fc68a4aa9ff34c43c05980172dc7aef57654e75 Author: Andrew Thompson <andrew@hijacked.us> Date: Sun Aug 22 20:22:09 2010 -0400 Use a different mutex for tracking threadcount diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index 1b77e2c..25d4cf4 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -968,10 +968,9 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) void *value; switch_hash_index_t *iter; - /* TODO - should we have a different mutex for this? */ - switch_thread_rwlock_wrlock(globals.listener_rwlock); + switch_mutex_lock(globals.listener_count_mutex); prefs.threads++; - switch_thread_rwlock_unlock(globals.listener_rwlock); + switch_mutex_unlock(globals.listener_count_mutex); switch_assert(listener != NULL); @@ -1019,9 +1018,9 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) switch_core_destroy_memory_pool(&pool); } - switch_thread_rwlock_wrlock(globals.listener_rwlock); + switch_mutex_lock(globals.listener_count_mutex); prefs.threads--; - switch_thread_rwlock_unlock(globals.listener_rwlock); + switch_mutex_unlock(globals.listener_count_mutex); return NULL; } @@ -1607,6 +1606,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_erlang_event_load) switch_thread_rwlock_create(&globals.listener_rwlock, pool); switch_mutex_init(&globals.fetch_reply_mutex, SWITCH_MUTEX_DEFAULT, pool); + switch_mutex_init(&globals.listener_count_mutex, SWITCH_MUTEX_UNNESTED, pool); switch_core_hash_init(&globals.fetch_reply_hash, pool); /* intialize the unique reference stuff */ commit 121e57a1db243aee9c24f5ec3f16b55e5d30614a Author: Andrew Thompson <andrew@hijacked.us> Date: Sun Aug 22 16:51:15 2010 -0400 Switch from mutex to a rwlock to increase throughput diff --git a/src/mod/event_handlers/mod_erlang_event/handle_msg.c b/src/mod/event_handlers/mod_erlang_event/handle_msg.c index 40d5455..128c5fc 100644 --- a/src/mod/event_handlers/mod_erlang_event/handle_msg.c +++ b/src/mod/event_handlers/mod_erlang_event/handle_msg.c @@ -646,7 +646,7 @@ static switch_status_t handle_msg_bind(listener_t *listener, erlang_msg * msg, e binding->process.pid = msg->from; binding->listener = listener; - switch_mutex_lock(globals.listener_mutex); + switch_thread_rwlock_wrlock(globals.listener_rwlock); for (ptr = bindings.head; ptr && ptr->next; ptr = ptr->next); @@ -657,7 +657,7 @@ static switch_status_t handle_msg_bind(listener_t *listener, erlang_msg * msg, e } switch_xml_set_binding_sections(bindings.search_binding, switch_xml_get_binding_sections(bindings.search_binding) | section); - switch_mutex_unlock(globals.listener_mutex); + switch_thread_rwlock_unlock(globals.listener_rwlock); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "sections %d\n", switch_xml_get_binding_sections(bindings.search_binding)); diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index 5f96cf8..1b77e2c 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -57,7 +57,7 @@ static switch_status_t socket_logger(const switch_log_node_t *node, switch_log_l { listener_t *l; - switch_mutex_lock(globals.listener_mutex); + switch_thread_rwlock_rdlock(globals.listener_rwlock); for (l = listen_list.listeners; l; l = l->next) { if (switch_test_flag(l, LFLAG_LOG) && l->level >= node->level) { @@ -80,7 +80,7 @@ static switch_status_t socket_logger(const switch_log_node_t *node, switch_log_l } } } - switch_mutex_unlock(globals.listener_mutex); + switch_thread_rwlock_unlock(globals.listener_rwlock); return SWITCH_STATUS_SUCCESS; } @@ -107,7 +107,7 @@ static void remove_binding(listener_t *listener, erlang_pid * pid) { struct erlang_binding *ptr, *lst = NULL; - switch_mutex_lock(globals.listener_mutex); + switch_thread_rwlock_wrlock(globals.listener_rwlock); switch_xml_set_binding_sections(bindings.search_binding, SWITCH_XML_SECTION_MAX); @@ -134,7 +134,7 @@ static void remove_binding(listener_t *listener, erlang_pid * pid) } } - switch_mutex_unlock(globals.listener_mutex); + switch_thread_rwlock_unlock(globals.listener_rwlock); } @@ -194,7 +194,7 @@ static void event_handler(switch_event_t *event) lp = listen_list.listeners; - switch_mutex_lock(globals.listener_mutex); + switch_thread_rwlock_rdlock(globals.listener_rwlock); while (lp) { uint8_t send = 0; @@ -250,7 +250,7 @@ static void event_handler(switch_event_t *event) } } - switch_mutex_unlock(globals.listener_mutex); + switch_thread_rwlock_unlock(globals.listener_rwlock); } @@ -276,10 +276,10 @@ static void close_socket(int *sock) static void add_listener(listener_t *listener) { /* add me to the listeners so I get events */ - switch_mutex_lock(globals.listener_mutex); + switch_thread_rwlock_wrlock(globals.listener_rwlock); listener->next = listen_list.listeners; listen_list.listeners = listener; - switch_mutex_unlock(globals.listener_mutex); + switch_thread_rwlock_unlock(globals.listener_rwlock); } @@ -287,7 +287,7 @@ static void remove_listener(listener_t *listener) { listener_t *l, *last = NULL; - switch_mutex_lock(globals.listener_mutex); + switch_thread_rwlock_wrlock(globals.listener_rwlock); for (l = listen_list.listeners; l; l = l->next) { if (l == listener) { if (last) { @@ -298,7 +298,7 @@ static void remove_listener(listener_t *listener) } last = l; } - switch_mutex_unlock(globals.listener_mutex); + switch_thread_rwlock_unlock(globals.listener_rwlock); } /* Search for a listener already talking to the specified node */ @@ -306,13 +306,13 @@ static listener_t *find_listener(char *nodename) { listener_t *l = NULL; - switch_mutex_lock(globals.listener_mutex); + switch_thread_rwlock_rdlock(globals.listener_rwlock); for (l = listen_list.listeners; l; l = l->next) { if (!strncmp(nodename, l->peer_nodename, MAXNODELEN)) { break; } } - switch_mutex_unlock(globals.listener_mutex); + switch_thread_rwlock_unlock(globals.listener_rwlock); return l; } @@ -968,9 +968,10 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) void *value; switch_hash_index_t *iter; - switch_mutex_lock(globals.listener_mutex); + /* TODO - should we have a different mutex for this? */ + switch_thread_rwlock_wrlock(globals.listener_rwlock); prefs.threads++; - switch_mutex_unlock(globals.listener_mutex); + switch_thread_rwlock_unlock(globals.listener_rwlock); switch_assert(listener != NULL); @@ -1018,9 +1019,9 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) switch_core_destroy_memory_pool(&pool); } - switch_mutex_lock(globals.listener_mutex); + switch_thread_rwlock_wrlock(globals.listener_rwlock); prefs.threads--; - switch_mutex_unlock(globals.listener_mutex); + switch_thread_rwlock_unlock(globals.listener_rwlock); return NULL; } @@ -1537,7 +1538,7 @@ SWITCH_STANDARD_API(erlang_cmd) if (!strcasecmp(argv[0], "listeners")) { listener_t *l; - switch_mutex_lock(globals.listener_mutex); + switch_thread_rwlock_rdlock(globals.listener_rwlock); if (listen_list.listeners) { for (l = listen_list.listeners; l; l = l->next) { @@ -1547,12 +1548,12 @@ SWITCH_STANDARD_API(erlang_cmd) stream->write_function(stream, "No active listeners\n"); } - switch_mutex_unlock(globals.listener_mutex); + switch_thread_rwlock_unlock(globals.listener_rwlock); } else if (!strcasecmp(argv[0], "sessions") && argc == 2) { listener_t *l; int found = 0; - switch_mutex_lock(globals.listener_mutex); + switch_thread_rwlock_rdlock(globals.listener_rwlock); for (l = listen_list.listeners; l; l = l->next) { if (!strcasecmp(l->peer_nodename, argv[1])) { session_elem_t *sp; @@ -1578,7 +1579,7 @@ SWITCH_STANDARD_API(erlang_cmd) break; } } - switch_mutex_unlock(globals.listener_mutex); + switch_thread_rwlock_unlock(globals.listener_rwlock); if (!found) stream->write_function(stream, "Could not find a listener for %s\n", argv[1]); @@ -1604,7 +1605,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_erlang_event_load) memset(&prefs, 0, sizeof(prefs)); - switch_mutex_init(&globals.listener_mutex, SWITCH_MUTEX_NESTED, pool); + switch_thread_rwlock_create(&globals.listener_rwlock, pool); switch_mutex_init(&globals.fetch_reply_mutex, SWITCH_MUTEX_DEFAULT, pool); switch_core_hash_init(&globals.fetch_reply_hash, pool); @@ -1853,7 +1854,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_erlang_event_shutdown) switch_event_unbind(&globals.node); switch_xml_unbind_search_function_ptr(erlang_fetch); - switch_mutex_lock(globals.listener_mutex); + switch_thread_rwlock_wrlock(globals.listener_rwlock); for (l = listen_list.listeners; l; l = l->next) { close_socket(&l->sockfd); @@ -1863,7 +1864,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_erlang_event_shutdown) WSACleanup(); #endif - switch_mutex_unlock(globals.listener_mutex); + switch_thread_rwlock_unlock(globals.listener_rwlock); switch_sleep(1500000); /* sleep for 1.5 seconds */ diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h index 03b66d3..acea53f 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h @@ -162,7 +162,7 @@ struct api_command_struct { }; struct globals_struct { - switch_mutex_t *listener_mutex; + switch_thread_rwlock_t *listener_rwlock; switch_event_node_t *node; switch_mutex_t *ref_mutex; switch_mutex_t *fetch_reply_mutex; commit 5ef61c961f5e226fb7a9d649d1f225c08a6ea3be Author: Andrew Thompson <andrew@hijacked.us> Date: Sun Aug 22 16:50:40 2010 -0400 Null out the spawn reply after we're done with it to avoid seg diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index 0e618c4..5f96cf8 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -1323,7 +1323,6 @@ session_elem_t *attach_call_to_spawned_process(listener_t *listener, char *modul switch_thread_cond_broadcast(p->ready_or_found); switch_thread_cond_timedwait(p->ready_or_found, p->mutex, 5000000); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "wtf\n"); if (!p->pid) { p->state = reply_timeout; switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Timed out when waiting for outbound pid %s %s\n", hash, session_element->uuid_str); @@ -1336,6 +1335,7 @@ session_elem_t *attach_call_to_spawned_process(listener_t *listener, char *modul session_element->process.type = ERLANG_PID; memcpy(&session_element->process.pid, p->pid, sizeof(erlang_pid)); + session_element->spawn_reply = NULL; switch_set_flag(session_element, LFLAG_SESSION_ALIVE); switch_clear_flag(session_element, LFLAG_OUTBOUND_INIT); commit c0d51b83f42a7b0161aa84f3b146db846e9f49ec Author: Andrew Thompson <andrew@hijacked.us> Date: Fri Aug 20 02:32:20 2010 -0400 Improve some logging to include UUIDs diff --git a/src/mod/event_handlers/mod_erlang_event/handle_msg.c b/src/mod/event_handlers/mod_erlang_event/handle_msg.c index 38c0e4e..40d5455 100644 --- a/src/mod/event_handlers/mod_erlang_event/handle_msg.c +++ b/src/mod/event_handlers/mod_erlang_event/handle_msg.c @@ -929,7 +929,7 @@ static switch_status_t handle_ref_tuple(listener_t *listener, erlang_msg * msg, return SWITCH_STATUS_SUCCESS; } switch_mutex_unlock(se->spawn_reply->mutex); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "get_pid came in too late for %s\n", hash); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "get_pid came in too late for %s; %s\n", hash, se->uuid_str); break; } } diff --git a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c index 60acc96..0e618c4 100644 --- a/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c +++ b/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c @@ -1300,7 +1300,7 @@ session_elem_t *attach_call_to_spawned_process(listener_t *listener, char *modul ei_x_encode_tuple_header(&rbuf, 4); ei_x_encode_atom(&rbuf, "get_pid"); - _ei_x_encode_string(&rbuf, switch_core_session_get_uuid(session)); + _ei_x_encode_string(&rbuf, session_element->uuid_str); ei_x_encode_ref(&rbuf, &ref); ei_x_encode_pid(&rbuf, ei_self(listener->ec)); /* should lock with mutex? */ @@ -1326,13 +1326,13 @@ session_elem_t *attach_call_to_spawned_process(listener_t *listener, char *modul switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "wtf\n"); if (!p->pid) { p->state = reply_timeout; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Timed out when waiting for outbound pid %s\n", hash); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Timed out when waiting for outbound pid %s %s\n", hash, session_element->uuid_str); remove_session_elem_from_listener_locked(listener, session_element); destroy_session_elem(session_element); return NULL; } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "got pid! %s\n", hash); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "got pid! %s %s\n", hash, session_element->uuid_str); session_element->process.type = ERLANG_PID; memcpy(&session_element->process.pid, p->pid, sizeof(erlang_pid)); commit 46dd24c2e9fa9f115710afe0b4036d9ac0202a51 Author: Jeff Lenk <jeff@jefflenk.com> Date: Sat Aug 21 22:39:01 2010 -0500 SFSIP-220 VS2010 sofia posix problem diff --git a/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_errno.h b/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_errno.h index 9faafa7..c11570c 100644 --- a/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_errno.h +++ b/libs/sofia-sip/libsofia-sip-ua/su/sofia-sip/su_errno.h @@ -71,6 +71,46 @@ SOFIAPUBFUN int su_seterrno(int); #endif #if defined(_WIN32) +/* VS 2010 defines these for POSIX but we cant have that */ +#if (_MSC_VER > 1500) +#undef EWOULDBLOCK +#undef EINPROGRESS +#undef EALREADY +#undef ENOTSOCK +#undef EDESTADDRREQ +#undef EMSGSIZE +#undef EPROTOTYPE +#undef ENOPROTOOPT +#undef EPROTONOSUPPORT +#undef ESOCKTNOSUPPORT +#undef EOPNOTSUPP +#undef EPFNOSUPPORT +#undef EAFNOSUPPORT +#undef EADDRINUSE +#undef EADDRNOTAVAIL +#undef ENETDOWN +#undef ENETUNREACH +#undef ENETRESET +#undef ECONNABORTED +#undef ECONNRESET +#undef ENOBUFS +#undef EISCONN +#undef ENOTCONN +#undef ESHUTDOWN +#undef ETOOMANYREFS +#undef ETIMEDOUT +#undef ECONNREFUSED +#undef ELOOP +#undef EHOSTDOWN +#undef EHOSTUNREACH +#undef EPROCLIM +#undef EUSERS +#undef EDQUOT +#undef ESTALE +#undef EREMOTE +#undef EBADMSG +#undef EPROTO +#endif #ifndef EWOULDBLOCK #define EWOULDBLOCK (10035) /* WSAEWOULDBLOCK */ commit a55b9d07a8265e51ea913e0897af8febb8ff6ca8 Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Fri Aug 20 23:40:37 2010 -0400 mod_sofia: Add a quick fix for basic Polycom presence support. A more sane solution need to be implemented diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index f68c8df..1ff420d 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1064,11 +1064,17 @@ static char *gen_pidf(char *user_agent, char *id, char *url, char *open, char *r if (switch_stristr("polycom", user_agent)) { *ct = "application/xpidf+xml"; - /* of course!, lets make a big deal over dashes. Now the stupidity is complete. */ + /* If unknown/none prpid is provided, just show the user as online. */ if (!prpid) { - prpid = "unknown"; + prpid = "online"; + } + + /* FS currently send prpid closed on register, this force it to online */ + if (!strncasecmp(status, "Registered", 10) && !strcasecmp(prpid, "closed")) { + prpid = "online"; } + /* of course!, lets make a big deal over dashes. Now the stupidity is complete. */ if (!strcmp(prpid, "on-the-phone")) { prpid = "onthephone"; } commit b5205c0bc0f3c6a0c834679f4abff0a3297f2bc5 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Aug 20 17:48:14 2010 -0500 MODAPP-447 diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index a1072c8..c683712 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -3593,10 +3593,13 @@ static int play_callback(void *pArg, int argc, char **argv, char **columnNames) return 0; } -static void do_play(vm_profile_t *profile, char *user, char *domain, char *file, switch_stream_handle_t *stream) +static void do_play(vm_profile_t *profile, char *user_in, char *domain, char *file, switch_stream_handle_t *stream) { char *sql; struct holder holder; + char *user; + + user = resolve_id(user_in, domain, "web-vm"); sql = switch_mprintf("update voicemail_msgs set read_epoch=%ld where username='%s' and domain='%s' and file_path like '%%%s'", (long) switch_epoch_time_now(NULL), user, domain, file); @@ -3616,12 +3619,15 @@ static void do_play(vm_profile_t *profile, char *user, char *domain, char *file, } -static void do_del(vm_profile_t *profile, char *user, char *domain, char *file, switch_stream_handle_t *stream) +static void do_del(vm_profile_t *profile, char *user_in, char *domain, char *file, switch_stream_handle_t *stream) { char *myfolder = "inbox"; char *sql; struct holder holder; char *ref = NULL; + char *user; + + user = resolve_id(user_in, domain, "web-vm"); if (stream->param_event) { ref = switch_event_get_header(stream->param_event, "http-referer"); commit 2ddbc457a1c6e1604c50e90b0213ad02ba98aab8 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Aug 20 16:51:55 2010 -0500 MODCODEC-20 diff --git a/src/mod/codecs/mod_silk/mod_silk.c b/src/mod/codecs/mod_silk/mod_silk.c index d76ff8e..9d0abcd 100644 --- a/src/mod/codecs/mod_silk/mod_silk.c +++ b/src/mod/codecs/mod_silk/mod_silk.c @@ -131,8 +131,8 @@ static switch_status_t switch_silk_init(switch_codec_t *codec, } codec->fmtp_out = switch_core_sprintf(codec->memory_pool, "useinbandfec=%s; usedtx=%s; maxaveragebitrate=%d", - useinbandfec ? "true" : "false", - usedtx ? "true" : "false", + useinbandfec ? "1" : "0", + usedtx ? "1" : "0", maxaveragebitrate ? maxaveragebitrate : codec->implementation->bits_per_second); if (encoding) { @@ -149,7 +149,7 @@ static switch_status_t switch_silk_init(switch_codec_t *codec, context->encoder_object.sampleRate = codec->implementation->actual_samples_per_second; context->encoder_object.packetSize = codec->implementation->samples_per_packet; context->encoder_object.useInBandFEC = useinbandfec; - context->encoder_object.complexity = 2; + context->encoder_object.complexity = 0; context->encoder_object.bitRate = maxaveragebitrate ? maxaveragebitrate : codec->implementation->bits_per_second; context->encoder_object.useDTX = usedtx; context->encoder_object.packetLossPercentage = plpct;; @@ -303,7 +303,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_silk_load) SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ 117, /* the IANA code number */ "SILK", /* the IANA code name */ - "useinbandfec=true; usedtx=false", /* default fmtp to send (can be overridden by the init function) */ + "useinbandfec=1; usedtx=0", /* default fmtp to send (can be overridden by the init function) */ 8000, /* samples transferred per second */ 8000, /* actual samples transferred per second */ 20000, /* bits transferred per second */ @@ -322,7 +322,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_silk_load) SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ 118, /* the IANA code number */ "SILK", /* the IANA code name */ - "useinbandfec=false; usedtx=false", /* default fmtp to send (can be overridden by the init function) */ + "useinbandfec=1; usedtx=0", /* default fmtp to send (can be overridden by the init function) */ 12000, /* samples transferred per second */ 12000, /* actual samples transferred per second */ 25000, /* bits transferred per second */ @@ -341,7 +341,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_silk_load) SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ 119, /* the IANA code number */ "SILK", /* the IANA code name */ - "useinbandfec=false; usedtx=false", /* default fmtp to send (can be overridden by the init function) */ + "useinbandfec=1; usedtx=0", /* default fmtp to send (can be overridden by the init function) */ 16000, /* samples transferred per second */ 16000, /* actual samples transferred per second */ 30000, /* bits transferred per second */ @@ -360,7 +360,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_silk_load) SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ 120, /* the IANA code number */ "SILK", /* the IANA code name */ - "useinbandfec=false; usedtx=false", /* default fmtp to send (can be overridden by the init function) */ + "useinbandfec=1; usedtx=0", /* default fmtp to send (can be overridden by the init function) */ 24000, /* samples transferred per second */ 24000, /* actual samples transferred per second */ 40000, /* bits transferred per second */ commit 84c2d80964a8d5a80877d0030176cc7c8a573856 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Aug 20 14:17:59 2010 -0500 tweak on last commit diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 856cc66..feb92b3 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -1060,8 +1060,8 @@ static void core_event_handler(switch_event_t *event) new_sql() = switch_mprintf("delete from channels where uuid='%q' and hostname='%q'", uuid, switch_core_get_variable("hostname")); if (switch_true(sig)) { - new_sql() = switch_mprintf("delete from calls where caller_uuid='%q' and hostname='%q'", - uuid, switch_core_get_variable("hostname")); + new_sql() = switch_mprintf("delete from calls where (caller_uuid='%q' || callee_uuid='%q') and hostname='%q'", + uuid, uuid, switch_core_get_variable("hostname")); } } } commit 072bf5ad14c0430828cff305b5eaa53e6d881139 Author: root <root@proxy-2.(none)> Date: Fri Aug 20 23:14:35 2010 +0400 set network_addr of caller profile to signaling ip address. (requested by Steven Ayre) diff --git a/src/mod/endpoints/mod_h323/changes.txt b/src/mod/endpoints/mod_h323/changes.txt index ff47780..9dfda1e 100644 --- a/src/mod/endpoints/mod_h323/changes.txt +++ b/src/mod/endpoints/mod_h323/changes.txt @@ -1,3 +1,4 @@ +set network_addr of caller profile to signaling ip address. (requested by Steven Ayre) move PTrace level set to FSH323EndPoint::Initialise partially apply patch from from Peter Olsson, Remove UnLock() when TryLock() failed and DEBUG_RTP_PACKETS directive. apply changes from mod_h323-patch.diff by Peter Olsson. diff --git a/src/mod/endpoints/mod_h323/mod_h323.cpp b/src/mod/endpoints/mod_h323/mod_h323.cpp index b4a4c76..45a9043 100644 --- a/src/mod/endpoints/mod_h323/mod_h323.cpp +++ b/src/mod/endpoints/mod_h323/mod_h323.cpp @@ -870,6 +870,9 @@ H323Connection::AnswerCallResponse FSH323Connection::OnAnswerCall(const PString switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,"Called-Party-Number = %s\n",(const char*)called); } } + + PIPSocket::Address remote_network_addr; + GetSignallingChannel()->GetRemoteAddress().GetIpAddress(remote_network_addr); switch_caller_profile_t *caller_profile = switch_caller_profile_new(switch_core_session_get_pool(m_fsSession), NULL, @@ -880,7 +883,7 @@ H323Connection::AnswerCallResponse FSH323Connection::OnAnswerCall(const PString /** caller_id_name */ GetRemotePartyNumber(), /** caller_id_number */ - NULL, + remote_network_addr.AsString(), /** network addr */ NULL, /** ANI */ commit 77e2dccf720aba4c9fb2170fd103cddbf15bb075 Author: Anthony Minessale <anthm@freeswitch.org> Date: Fri Aug 20 13:28:17 2010 -0500 add last_bridge_to var to keep uuid of last bridged channel and fix race in show calls on hangup of bypass_media channels diff --git a/src/include/switch_types.h b/src/include/switch_types.h index b965ece..70ae155 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -160,6 +160,7 @@ SWITCH_BEGIN_EXTERN_C #define SWITCH_L_SDP_VARIABLE "switch_l_sdp" #define SWITCH_B_SDP_VARIABLE "switch_m_sdp" #define SWITCH_BRIDGE_VARIABLE "bridge_to" +#define SWITCH_LAST_BRIDGE_VARIABLE "last_bridge_to" #define SWITCH_SIGNAL_BRIDGE_VARIABLE "signal_bridge_to" #define SWITCH_SIGNAL_BOND_VARIABLE "signal_bond" #define SWITCH_ORIGINATOR_VARIABLE "originator" diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 978bf46..856cc66 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -1052,8 +1052,19 @@ static void core_event_handler(switch_event_t *event) } break; case SWITCH_EVENT_CHANNEL_DESTROY: - new_sql() = switch_mprintf("delete from channels where uuid='%q' and hostname='%q'", - switch_event_get_header_nil(event, "unique-id"), switch_core_get_variable("hostname")); + { + const char *uuid = switch_event_get_header(event, "unique-id"); + const char *sig = switch_event_get_header(event, "signal_bridge"); + + if (uuid) { + new_sql() = switch_mprintf("delete from channels where uuid='%q' and hostname='%q'", + uuid, switch_core_get_variable("hostname")); + if (switch_true(sig)) { + new_sql() = switch_mprintf("delete from calls where caller_uuid='%q' and hostname='%q'", + uuid, switch_core_get_variable("hostname")); + } + } + } break; case SWITCH_EVENT_CHANNEL_UUID: { diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index b9a2fea..b317cef 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -877,6 +877,7 @@ static switch_status_t signal_bridge_on_hibernate(switch_core_session_t *session } switch_channel_set_variable(channel, SWITCH_BRIDGE_VARIABLE, switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE)); + switch_channel_set_variable(channel, SWITCH_LAST_BRIDGE_VARIABLE, switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE)); if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) { if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_BRIDGE) == SWITCH_STATUS_SUCCESS) { @@ -993,6 +994,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_signal_bridge(switch_core_session_t * switch_channel_add_state_handler(caller_channel, &signal_bridge_state_handlers); switch_channel_add_state_handler(peer_channel, &signal_bridge_state_handlers); + switch_channel_set_variable(caller_channel, "signal_bridge", "true"); + switch_channel_set_variable(peer_channel, "signal_bridge", "true"); + /* fire events that will change the data table from "show channels" */ if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(caller_channel, event); @@ -1093,6 +1097,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses if (switch_core_session_read_lock(peer_session) == SWITCH_STATUS_SUCCESS) { switch_channel_set_variable(caller_channel, SWITCH_BRIDGE_VARIABLE, switch_core_session_get_uuid(peer_session)); switch_channel_set_variable(peer_channel, SWITCH_BRIDGE_VARIABLE, switch_core_session_get_uuid(session)); + switch_channel_set_variable(caller_channel, SWITCH_LAST_BRIDGE_VARIABLE, switch_core_session_get_uuid(peer_session)); + switch_channel_set_variable(peer_channel, SWITCH_LAST_BRIDGE_VARIABLE, switch_core_session_get_uuid(session)); if (!switch_channel_media_ready(caller_channel) || (!switch_channel_test_flag(peer_channel, CF_ANSWERED) && !switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA))) { commit 3867828816933c1af24e368a444092f5ad149bcb Author: Jeff Lenk <jeff@jefflenk.com> Date: Fri Aug 20 09:24:00 2010 -0500 MODSOFIA-92 fix x64 build diff --git a/libs/win32/openssl/openssl.2008.vcproj b/libs/win32/openssl/openssl.2008.vcproj index 2ce3f00..0c4003b 100644 --- a/libs/win32/openssl/openssl.2008.vcproj +++ b/libs/win32/openssl/openssl.2008.vcproj @@ -100,12 +100,11 @@ /> </Configuration> <Configuration - Name="Release|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" + Name="Debug|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" ConfigurationType="1" CharacterSet="1" - WholeProgramOptimization="1" > <Tool Name="VCPreBuildEventTool" @@ -121,15 +120,15 @@ /> <Tool Name="VCMIDLTool" + TargetEnvironment="3" /> <Tool Name="VCCLCompilerTool" AdditionalOptions="/Gs0" Optimization="2" InlineFunctionExpansion="2" - EnableIntrinsicFunctions="true" AdditionalIncludeDirectories=""..\..\openssl-1.0.0a\include";"..\..\openssl-1.0.0a"" - PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CONSOLE;OPENSSL_THREADS;MONOLITH;DSO_WIN32;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_RC5;OPENSSL_NO_MD2;OPENSSL_NO_KRB5;OPENSSL_NO_JPAKE;OPENSSL_NO_STATIC_ENGINE" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;OPENSSL_THREADS;MONOLITH;DSO_WIN32;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_RC5;OPENSSL_NO_MD2;OPENSSL_NO_KRB5;OPENSSL_NO_JPAKE;OPENSSL_NO_STATIC_ENGINE" StringPooling="true" MinimalRebuild="true" BasicRuntimeChecks="0" @@ -137,7 +136,6 @@ EnableFunctionLevelLinking="true" UsePrecompiledHeader="0" WarningLevel="3" - WarnAsError="true" DebugInformationFormat="3" DisableSpecificWarnings="4996;4133" /> @@ -157,9 +155,7 @@ AdditionalLibraryDirectories=""$(ProjectDir)$(ConfigurationName)"" GenerateDebugInformation="true" SubSystem="1" - OptimizeReferences="2" - EnableCOMDATFolding="2" - TargetMachine="1" + TargetMachine="17" /> <Tool Name="VCALinkTool" @@ -184,11 +180,12 @@ /> </Configuration> <Configuration - Name="Debug|x64" - OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" ConfigurationType="1" CharacterSet="1" + WholeProgramOptimization="1" > <Tool Name="VCPreBuildEventTool" @@ -204,15 +201,15 @@ /> <Tool Name="VCMIDLTool" - TargetEnvironment="3" /> <Tool Name="VCCLCompilerTool" AdditionalOptions="/Gs0" Optimization="2" InlineFunctionExpansion="2" + EnableIntrinsicFunctions="true" AdditionalIncludeDirectories=""..\..\openssl-1.0.0a\include";"..\..\openssl-1.0.0a"" - PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;OPENSSL_THREADS;MONOLITH;DSO_WIN32;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_RC5;OPENSSL_NO_MD2;OPENSSL_NO_KRB5;OPENSSL_NO_JPAKE;OPENSSL_NO_STATIC_ENGINE" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CONSOLE;OPENSSL_THREADS;MONOLITH;DSO_WIN32;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_RC5;OPENSSL_NO_MD2;OPENSSL_NO_KRB5;OPENSSL_NO_JPAKE;OPENSSL_NO_STATIC_ENGINE" StringPooling="true" MinimalRebuild="true" BasicRuntimeChecks="0" @@ -220,6 +217,7 @@ EnableFunctionLevelLinking="true" UsePrecompiledHeader="0" WarningLevel="3" + WarnAsError="true" DebugInformationFormat="3" DisableSpecificWarnings="4996;4133" /> @@ -234,12 +232,14 @@ /> <Tool Name="VCLinkerTool" - AdditionalDependencies="libeay32.lib ssleay32.lib ws2_32.lib" + AdditionalDependencies="ws2_32.lib" LinkIncremental="2" AdditionalLibraryDirectories=""$(ProjectDir)$(ConfigurationName)"" GenerateDebugInformation="true" SubSystem="1" - TargetMachine="17" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" /> <Tool Name="VCALinkTool" @@ -316,7 +316,7 @@ /> <Tool Name="VCLinkerTool" - AdditionalDependencies="libeay32.lib ssleay32.lib ws2_32.lib" + AdditionalDependencies="ws2_32.lib" LinkIncremental="2" AdditionalLibraryDirectories=""$(ProjectDir)$(ConfigurationName)"" GenerateDebugInformation="true" diff --git a/libs/win32/openssl/openssl.2010.vcxproj b/libs/win32/openssl/openssl.2010.vcxproj index fbc98fc..b2fe7e2 100644 --- a/libs/win32/openssl/openssl.2010.vcxproj +++ b/libs/win32/openssl/openssl.2010.vcxproj @@ -149,7 +149,7 @@ <DisableSpecificWarnings>4996;4133;%(DisableSpecificWarnings)</DisableSpecificWarnings> </ClCompile> <Link> - <AdditionalDependencies>libeay32.lib;ssleay32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalLibraryDirectories>$(ProjectDir)$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <GenerateDebugInformation>true</GenerateDebugInformation> <SubSystem>Console</SubSystem> @@ -179,7 +179,7 @@ <DisableSpecificWarnings>4996;4133;%(DisableSpecificWarnings)</DisableSpecificWarnings> </ClCompile> <Link> - <AdditionalDependencies>libeay32.lib;ssleay32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalLibraryDirectories>$(ProjectDir)$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <GenerateDebugInformation>true</GenerateDebugInformation> <SubSystem>Console</SubSystem> diff --git a/libs/win32/openssl/ssleay32.2008.vcproj b/libs/win32/openssl/ssleay32.2008.vcproj index c9ad1f3..1d8654a 100644 --- a/libs/win32/openssl/ssleay32.2008.vcproj +++ b/libs/win32/openssl/ssleay32.2008.vcproj @@ -99,13 +99,12 @@ /> </Configuration> <Configuration - Name="Release|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" + Name="Debug|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" ConfigurationType="2" CharacterSet="1" ManagedExtensions="0" - WholeProgramOptimization="1" > <Tool Name="VCPreBuildEventTool" @@ -122,6 +121,7 @@ /> <Tool Name="VCMIDLTool" + TargetEnvironment="3" /> <Tool Name="VCCLCompilerTool" @@ -129,13 +129,12 @@ Optimization="2" InlineFunctionExpansion="2" AdditionalIncludeDirectories=""..\..\openssl-1.0.0a\include";"..\..\openssl-1.0.0a\crypto";"..\..\openssl-1.0.0a"" - PreprocessorDefinitions="WIN32;NDEBUG;DSO_WIN32;OPENSSL_THREADS;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_RC5;OPENSSL_NO_MD2;OPENSSL_NO_KRB5;OPENSSL_NO_JPAKE;OPENSSL_NO_STATIC_ENGINE;_WINDLL;OPENSSL_BUILD_SHLIBSSL" + PreprocessorDefinitions="WIN32;_DEBUG;DSO_WIN32;OPENSSL_THREADS;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_RC5;OPENSSL_NO_MD2;OPENSSL_NO_KRB5;OPENSSL_NO_JPAKE;OPENSSL_NO_STATIC_ENGINE;_WINDLL;OPENSSL_BUILD_SHLIBSSL" StringPooling="true" RuntimeLibrary="2" EnableFunctionLevelLinking="true" UsePrecompiledHeader="0" WarningLevel="3" - WarnAsError="true" DebugInformationFormat="3" /> <Tool @@ -150,11 +149,11 @@ <Tool Name="VCLinkerTool" LinkIncremental="2" - AdditionalLibraryDirectories="$(ProjectDir)$(ConfigurationName)" + AdditionalLibraryDirectories=""$(ProjectDir)$(ConfigurationName)"" ModuleDefinitionFile="ssleay32.def" GenerateDebugInformation="true" AssemblyDebug="1" - TargetMachine="1" + TargetMachine="17" /> <Tool Name="VCALinkTool" @@ -179,12 +178,13 @@ /> </Configuration> <Configuration - Name="Debug|x64" - OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" ConfigurationType="2" CharacterSet="1" ManagedExtensions="0" + WholeProgramOptimization="1" > <Tool Name="VCPreBuildEventTool" @@ -201,7 +201,6 @@ /> <Tool Name="VCMIDLTool" - TargetEnvironment="3" /> <Tool Name="VCCLCompilerTool" @@ -209,12 +208,13 @@ Optimization="2" InlineFunctionExpansion="2" AdditionalIncludeDirectories=""..\..\openssl-1.0.0a\include";"..\..\openssl-1.0.0a\crypto";"..\..\openssl-1.0.0a"" - PreprocessorDefinitions="WIN32;_DEBUG;DSO_WIN32;OPENSSL_THREADS;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_RC5;OPENSSL_NO_MD2;OPENSSL_NO_KRB5;OPENSSL_NO_JPAKE;OPENSSL_NO_STATIC_ENGINE;_WINDLL;OPENSSL_BUILD_SHLIBSSL" + PreprocessorDefinitions="WIN32;NDEBUG;DSO_WIN32;OPENSSL_THREADS;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_RC5;OPENSSL_NO_MD2;OPENSSL_NO_KRB5;OPENSSL_NO_JPAKE;OPENSSL_NO_STATIC_ENGINE;_WINDLL;OPENSSL_BUILD_SHLIBSSL" StringPooling="true" RuntimeLibrary="2" EnableFunctionLevelLinking="true" UsePrecompiledHeader="0" WarningLevel="3" + WarnAsError="true" DebugInformationFormat="3" /> <Tool @@ -228,13 +228,12 @@ /> <Tool Name="VCLinkerTool" - AdditionalDependencies="libeay32.lib" LinkIncremental="2" - AdditionalLibraryDirectories=""$(ProjectDir)$(ConfigurationName)"" + AdditionalLibraryDirectories="$(ProjectDir)$(ConfigurationName)" ModuleDefinitionFile="ssleay32.def" GenerateDebugInformation="true" AssemblyDebug="1" - TargetMachine="17" + TargetMachine="1" /> <Tool Name="VCALinkTool" @@ -309,7 +308,6 @@ /> <Tool Name="VCLinkerTool" - AdditionalDependencies="libeay32.lib" LinkIncremental="2" AdditionalLibraryDirectories="$(ProjectDir)$(ConfigurationName)" ModuleDefinitionFile="ssleay32.def" diff --git a/libs/win32/openssl/ssleay32.2010.vcxproj b/libs/win32/openssl/ssleay32.2010.vcxproj index c124bae..8d6c22d 100644 --- a/libs/win32/openssl/ssleay32.2010.vcxproj +++ b/libs/win32/openssl/ssleay32.2010.vcxproj @@ -150,7 +150,7 @@ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> <Link> - <AdditionalDependencies>libeay32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> <AdditionalLibraryDirectories>$(ProjectDir)$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <ModuleDefinitionFile>ssleay32.def</ModuleDefinitionFile> <GenerateDebugInformation>true</GenerateDebugInformation> @@ -180,7 +180,7 @@ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> <Link> - <AdditionalDependencies>libeay32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies> <AdditionalLibraryDirectories>$(ProjectDir)$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> <ModuleDefinitionFile>ssleay32.def</ModuleDefinitionFile> <GenerateDebugInformation>true</GenerateDebugInformation> commit 8082aa987e27c9c5a8c6b4f4b9f8fdeff37dcfa6 Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Thu Aug 19 21:43:07 2010 -0400 mod_callcenter: Added value busy_delay_time and reject_delay_time so we can wait if those 2 occur (Un registred phone are considered as busy). Add a ready_time epoch time when we can contact an again again, fix ring-all (good this time I hope). diff --git a/conf/autoload_configs/callcenter.conf.xml b/conf/autoload_configs/callcenter.conf.xml index 5fb0ace..0f4fb2a 100644 --- a/conf/autoload_configs/callcenter.conf.xml +++ b/conf/autoload_configs/callcenter.conf.xml @@ -18,7 +18,7 @@ <!-- WARNING : Configuring XML Tiers will reset the provided level and position if provided.--> <!-- WARNING : Agents and Tiers XML config shouldn't be used in a multi FS shared DB setup(Not currently supported anyway) --> <agents> - <!--<agent name="1000@default" type="callback" contact="[call_timeout=10]user/1000@default" status="Available" max-no-answer="3" wrap-up-time="10" />--> + <!--<agent name="1000@default" type="callback" contact="[call_timeout=10]user/1000@default" status="Available" max-no-answer="3" wrap-up-time="10" reject-delay-time="10" busy-delay-time="60" />--> </agents> <tiers> <!-- if no level or position is provided, they will default to 1. You should do this to keep db value on restart --> diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 65525d1..4c05509 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -205,13 +205,16 @@ static char agents_sql[] = " max_no_answer INTEGER NOT NULL DEFAULT 0,\n" " wrap_up_time INTEGER NOT NULL DEFAULT 0,\n" +" reject_delay_time INTEGER NOT NULL DEFAULT 0,\n" +" busy_delay_time INTEGER NOT NULL DEFAULT 0,\n" " last_bridge_start INTEGER NOT NULL DEFAULT 0,\n" " last_bridge_end INTEGER NOT NULL DEFAULT 0,\n" " last_offered_call INTEGER NOT NULL DEFAULT 0,\n" " last_status_change INTEGER NOT NULL DEFAULT 0,\n" " no_answer_count INTEGER NOT NULL DEFAULT 0,\n" " calls_answered INTEGER NOT NULL DEFAULT 0,\n" -" talk_time INTEGER NOT NULL DEFAULT 0\n" +" talk_time INTEGER NOT NULL DEFAULT 0,\n" +" ready_time INTEGER NOT NULL DEFAULT 0\n" ");\n"; @@ -629,9 +632,11 @@ static cc_queue_t *load_queue(const char *queue_name) goto end; } - // switch_cache_db_test_reactive(dbh, "select count(name) from queues", "drop table queues", queues_sql); switch_cache_db_test_reactive(dbh, "select count(system_epoch) from members", "drop table members", members_sql); - switch_cache_db_test_reactive(dbh, "select count(max_no_answer) from agents", "drop table agents", agents_sql); + switch_cache_db_test_reactive(dbh, "select count(ready_time) from agents", NULL, "alter table agents add ready_time integer not null default 0;" + "alter table agents add reject_delay_time integer not null default 0;" + "alter table agents add busy_delay_time integer not null default 0;"); + switch_cache_db_test_reactive(dbh, "select count(ready_time) from agents", "drop table agents", agents_sql); switch_cache_db_test_reactive(dbh, "select count(queue) from tiers", "drop table tiers" , tiers_sql); switch_mutex_init(&queue->mutex, SWITCH_MUTEX_NESTED, queue->pool); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Added queue %s\n", queue->name); @@ -688,6 +693,9 @@ struct call_helper { const char *record_template; int no_answer_count; int max_no_answer; + int reject_delay_time; + int busy_delay_time; + switch_memory_pool_t *pool; }; @@ -904,7 +912,24 @@ cc_status_t cc_agent_update(const char *key, const char *value, const char *agen switch_safe_free(sql); result = CC_STATUS_SUCCESS; + } else if (!strcasecmp(key, "ready_time")) { + sql = switch_mprintf("UPDATE agents SET ready_time = '%ld', system = 'single_box' WHERE name = '%q'", atol(value), agent); + cc_execute_sql(NULL, sql, NULL); + switch_safe_free(sql); + + result = CC_STATUS_SUCCESS; + } else if (!strcasecmp(key, "busy_delay_time")) { + sql = switch_mprintf("UPDATE agents SET busy_delay_time = '%ld', system = 'single_box' WHERE name = '%q'", atol(value), agent); + cc_execute_sql(NULL, sql, NULL); + switch_safe_free(sql); + + result = CC_STATUS_SUCCESS; + } else if (!strcasecmp(key, "reject_delay_time")) { + sql = switch_mprintf("UPDATE agents SET reject_delay_time = '%ld', system = 'single_box' WHERE name = '%q'", atol(value), agent); + cc_execute_sql(NULL, sql, NULL); + switch_safe_free(sql); + result = CC_STATUS_SUCCESS; } else if (!strcasecmp(key, "type")) { if (strcasecmp(value, CC_AGENT_TYPE_CALLBACK)) { result = CC_STATUS_AGENT_INVALID_TYPE; @@ -1098,6 +1123,8 @@ static switch_status_t load_agent(const char *agent_name) const char *status = switch_xml_attr(x_agent, "status"); const char *max_no_answer = switch_xml_attr(x_agent, "max-no-answer"); const char *wrap_up_time = switch_xml_attr(x_agent, "wrap-up-time"); + const char *reject_delay_time = switch_xml_attr(x_agent, "reject-delay-time"); + const char *busy_delay_time = switch_xml_attr(x_agent, "busy-delay-time"); if (type) { cc_status_t res = cc_agent_add(agent_name, type); @@ -1114,6 +1141,12 @@ static switch_status_t load_agent(const char *agent_name) if (max_no_answer) { cc_agent_update("max_no_answer", max_no_answer, agent_name); } + if (reject_delay_time) { + cc_agent_update("reject_delay_time", reject_delay_time, agent_name); + } + if (busy_delay_time) { + cc_agent_update("busy_delay_time", reject_delay_time, agent_name); + } if (type && res == CC_STATUS_AGENT_ALREADY_EXIST) { cc_agent_update("type", type, agent_name); @@ -1382,6 +1415,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa } else { + int delay_next_agent_call = 0; /* Agent didn't answer or originate failed */ sql = switch_mprintf("UPDATE members SET state = '%q', serving_agent = '', serving_system = ''" " WHERE serving_agent = '%q' AND serving_system = '%q' AND uuid = '%q' AND system = 'single_box'", @@ -1393,8 +1427,28 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Agent %s Origination Canceled : %s\n",h->agent_name, switch_channel_cause2str(cause)); switch (cause) { - case SWITCH_CAUSE_CALL_REJECTED: + case SWITCH_CAUSE_USER_NOT_REGISTERED: /* When we are calling a unregistred device */ + case SWITCH_CAUSE_USER_BUSY: /* Could be the phone is in Do Not Disturb */ + delay_next_agent_call = (h->busy_delay_time > delay_next_agent_call?h->busy_delay_time:delay_next_agent_call); + break; + case SWITCH_CAUSE_CALL_REJECTED: /* User could have press the reject call on their phone */ + delay_next_agent_call = (h->reject_delay_time > delay_next_agent_call?h->reject_delay_time:delay_next_agent_call); + break; + default: + break; + } + + switch (cause) { + case SWITCH_CAUSE_USER_NOT_REGISTERED: /* When we are calling a unregistred device */ + case SWITCH_CAUSE_USER_BUSY: /* Could be the phone is in Do Not Disturb */ + case SWITCH_CAUSE_CALL_REJECTED: /* User could have press the reject call on their phone */ case SWITCH_CAUSE_ORIGINATOR_CANCEL: + if (delay_next_agent_call > 0) { + char ready_epoch[64]; + switch_snprintf(ready_epoch, sizeof(ready_epoch), "%" SWITCH_TIME_T_FMT, switch_epoch_time_now(NULL) + delay_next_agent_call); /* Make the time configurable */ + cc_agent_update("ready_time", ready_epoch , h->agent_name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Agent %s Sleeping for %d secondes\n", h->agent_name, delay_next_agent_call); + } break; default: tiers_state = CC_TIER_STATE_NO_ANSWER; @@ -1530,6 +1584,9 @@ static int agents_callback(void *pArg, int argc, char **argv, char **columnNames h->record_template = switch_core_strdup(h->pool, cbt->record_template); h->no_answer_count = atoi(argv[4]); h->max_no_answer = atoi(argv[5]); + h->reject_delay_time = atoi(argv[6]); + h->busy_delay_time = atoi(argv[7]); + cc_agent_update("state", cc_agent_state2str(CC_AGENT_STATE_RECEIVING), h->agent_name); @@ -1591,7 +1648,7 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName cbt.strategy = queue_strategy; cbt.record_template = queue_record_template; - if (!strcasecmp(queue->strategy, "longest-idle-agent") || !strcasecmp(queue_strategy, "roundrobin") /* TODO TMP backward compatibility for taxi dispatch setup */) { + if (!strcasecmp(queue->strategy, "longest-idle-agent")) { sql_order_by = switch_mprintf("level, agents.last_offered_call, position"); } else if (!strcasecmp(queue_strategy, "agent-with-least-talk-time")) { sql_order_by = switch_mprintf("level, agents.talk_time, position"); @@ -1610,16 +1667,18 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName sql_order_by = switch_mprintf("level, position"); } - sql = switch_mprintf("SELECT system, name, status, contact, no_answer_count, max_no_answer FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent)" + sql = switch_mprintf("SELECT system, name, status, contact, no_answer_count, max_no_answer, reject_delay_time, busy_delay_time FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent)" " WHERE tiers.queue = '%q'" " AND (tiers.state = '%q' OR tiers.state = '%q')" " AND (agents.status = '%q' OR agents.status = '%q' OR agents.status = '%q')" " AND agents.state = '%q' AND last_bridge_end < (%ld - wrap_up_time)" + " AND agents.ready_time <= %ld" " ORDER BY %q", queue_name, cc_tier_state2str(CC_TIER_STATE_READY), cc_tier_state2str(CC_TIER_STATE_NO_ANSWER), cc_agent_status2str(CC_AGENT_STATUS_AVAILABLE), cc_agent_status2str(CC_AGENT_STATUS_ON_BREAK), cc_agent_status2str(CC_AGENT_STATUS_AVAILABLE_ON_DEMAND), cc_agent_state2str(CC_AGENT_STATE_WAITING), (long) switch_epoch_time_now(NULL), + (long) switch_epoch_time_now(NULL), sql_order_by); cc_execute_sql_callback(NULL /* queue */, NULL /* mutex */, sql, agents_callback, &cbt /* Call back variables */); @@ -1660,7 +1719,7 @@ void *SWITCH_THREAD_FUNC cc_agent_dispatch_thread_run(switch_thread_t *thread, v while (globals.running == 1) { char *sql = NULL; sql = switch_mprintf("SELECT queue,uuid,caller_number,caller_name,joined_epoch,(%ld-joined_epoch)+base_score+skill_score AS score FROM members" - " WHERE state = '%q' OR (serving_agent != 'ring-all' AND state = '%q') ORDER BY score DESC", + " WHERE state = '%q' OR (serving_agent = 'ring-all' AND state = '%q') ORDER BY score DESC", (long) switch_epoch_time_now(NULL), cc_member_state2str(CC_MEMBER_STATE_WAITING), cc_member_state2str(CC_MEMBER_STATE_TRYING)); @@ -1744,7 +1803,6 @@ void *SWITCH_THREAD_FUNC cc_member_thread_run(switch_thread_t *thread, void *obj /* If Agent Logoff, we might need to recalculare score based on skill */ /* Play Announcement in order */ - // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "MEMBER WAITING QUEUE EXECUTE\n"); switch_yield(100000); } switch_core_session_rwunlock(member_session); @@ -1963,6 +2021,9 @@ static int list_result_callback(void *pArg, int argc, char **argv, char **column "callcenter_config agent set status [agent_name] [status] | " \ "callcenter_config agent set state [agent_name] [state] | " \ "callcenter_config agent set contact [agent_name] [contact] | " \ +"callcenter_config agent set ready_time [agent_name] [wait till epoch] | "\ +"callcenter_config agent set reject_delay_time [agent_name] [wait second] | "\ +"callcenter_config agent set busy_delay_time [agent_name] [wait second] | "\ "callcenter_config agent get status [agent_name] | " \ "callcenter_config tier add [queue_name] [agent_name] [level] [position] | " \ "callcenter_config tier set state [queue_name] [agent_name] [state] | " \ @@ -2118,7 +2179,6 @@ SWITCH_STANDARD_API(cc_config_api_function) } else if (section && !strcasecmp(section, "tier")) { if (action && !strcasecmp(action, "add")) { - // queue, agent, level, position, state if (argc-initial_argc < 4) { stream->write_function(stream, "%s", "-ERR Invalid!\n"); goto done; @@ -2334,6 +2394,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_callcenter_load) switch_console_set_complete("add callcenter_config agent set status"); switch_console_set_complete("add callcenter_config agent set state"); switch_console_set_complete("add callcenter_config agent set contact"); + switch_console_set_complete("add callcenter_config agent set ready_time"); + switch_console_set_complete("add callcenter_config agent set reject_delay_time"); + switch_console_set_complete("add callcenter_config agent set busy_delay_time"); switch_console_set_complete("add callcenter_config agent get status"); switch_console_set_complete("add callcenter_config agent list"); commit 4d2cc185b0666618f59a57746813e2c92cf96ec5 Author: Michael S Collins <msc@freeswitch.org> Date: Thu Aug 19 18:21:50 2010 -0700 Fix fifo_member add syntax diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 02158f3..aa49689 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -4185,7 +4185,7 @@ static void fifo_member_del(char *fifo_name, char *originate_string) switch_safe_free(sql); } -#define FIFO_MEMBER_API_SYNTAX "[add <fifo_name> <originate_string> [<simo_count>] [<timeout>] [<lag>] [<taking_calls>] | del <fifo_name> <originate_string>]" +#define FIFO_MEMBER_API_SYNTAX "[add <fifo_name> <originate_string> [<simo_count>] [<timeout>] [<lag>] [<expires>] [<taking_calls>] | del <fifo_name> <originate_string>]" SWITCH_STANDARD_API(fifo_member_api_function) { char *fifo_name; commit 5481d9a98cd8c415e61d14b8327f1db22d2025db Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Aug 19 18:22:06 2010 -0500 MODSOFIA-86 diff --git a/conf/sip_profiles/internal.xml b/conf/sip_profiles/internal.xml index dd0dda1..e4af5cc 100644 --- a/conf/sip_profiles/internal.xml +++ b/conf/sip_profiles/internal.xml @@ -43,6 +43,8 @@ <!-- <param name="shutdown-on-fail" value="true"/> --> <param name="sip-trace" value="no"/> <param name="log-auth-failures" value="true"/> + <param name="forward-unsolicited-mwi-notify" value="false"/> + <param name="context" value="public"/> <param name="rfc2833-pt" value="101"/> <!-- port to bind to for sip traffic --> diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 9bec466..f24cee5 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -587,6 +587,7 @@ SWITCH_DECLARE(unsigned int) switch_separate_string_string(char *buf, char *deli SWITCH_DECLARE(switch_bool_t) switch_is_number(const char *str); SWITCH_DECLARE(char *) switch_strip_spaces(const char *str); +SWITCH_DECLARE(char *) switch_strip_whitespace(const char *str); SWITCH_DECLARE(char *) switch_strip_commas(char *in, char *out, switch_size_t len); SWITCH_DECLARE(char *) switch_strip_nonnumerics(char *in, char *out, switch_size_t len); SWITCH_DECLARE(char *) switch_separate_paren_args(char *str); diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 78db36e..0168a33 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -210,6 +210,7 @@ typedef enum { PFLAG_SQL_IN_TRANS, PFLAG_PASS_CALLEE_ID, PFLAG_LOG_AUTH_FAIL, + PFLAG_FORWARD_MWI_NOTIFY, PFLAG_TRACK_CALLS, PFLAG_TRACK_CALLS_EVENTS, PFLAG_DESTROY, diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 0a0c641..49ddd2a 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -372,7 +372,7 @@ void sofia_handle_sip_i_notify(switch_core_session_t *session, int status, sip->sip_event->o_type); } goto error; - } + } /* find the corresponding gateway subscription (if any) */ if (!(gw_sub_ptr = sofia_find_gateway_subscription(sofia_private->gateway, sip->sip_event->o_type))) { @@ -412,6 +412,47 @@ void sofia_handle_sip_i_notify(switch_core_session_t *session, int status, if (sip && sip->sip_event && sip->sip_event->o_type && !strcasecmp(sip->sip_event->o_type, "message-summary")) { /* unsolicited mwi, just say ok */ nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END()); + + if (sofia_test_pflag(profile, PFLAG_FORWARD_MWI_NOTIFY)) { + const char *mwi_status = NULL; + char network_ip[80]; + uint32_t x = 0; + int acl_ok = 1; + char *last_acl = NULL; + + if (sip->sip_to && sip->sip_to->a_url && sip->sip_to->a_url->url_user && sip->sip_to->a_url->url_host + && sip->sip_payload && sip->sip_payload->pl_data ) { + + sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), NULL); + for (x = 0; x < profile->acl_count; x++) { + last_acl = profile->acl[x]; + if (!(acl_ok = switch_check_network_list_ip(network_ip, last_acl))) { + break; + } + } + + if ( acl_ok ) + { + mwi_status = switch_stristr("Messages-Waiting: ", sip->sip_payload->pl_data); + + if ( mwi_status ) { + mwi_status += strlen( "Messages-Waiting: " ); + mwi_status = switch_strip_whitespace( mwi_status ); + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Forwarding unsolicited MWI ( %s : %s@%s )\n", mwi_status, sip->sip_to->a_url->url_user, sip->sip_to->a_url->url_host ); + if (switch_event_create(&s_event, SWITCH_EVENT_MESSAGE_WAITING) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "MWI-Messages-Waiting", mwi_status ); + switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "MWI-Message-Account", "%s@%s", sip->sip_to->a_url->url_user, sip->sip_to->a_url->url_host ); + switch_event_fire(&s_event); + } + } + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Dropping unsolicited MWI ( %s@%s ) because of ACL\n", sip->sip_to->a_url->url_user, sip->sip_to->a_url->url_host ); + }; + + } + } + } else { nua_respond(nh, 481, "Subscription Does Not Exist", NUTAG_WITH_THIS(nua), TAG_END()); } @@ -2252,6 +2293,18 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) } else { sofia_clear_pflag(profile, PFLAG_LOG_AUTH_FAIL); } + } else if (!strcasecmp(var, "forward-unsolicited-mwi-notify")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_FORWARD_MWI_NOTIFY); + } else { + sofia_clear_pflag(profile, PFLAG_FORWARD_MWI_NOTIFY); + } + } else if (!strcasecmp(var, "forward-unsolicited-mwi-notify")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_FORWARD_MWI_NOTIFY); + } else { + sofia_clear_pflag(profile, PFLAG_FORWARD_MWI_NOTIFY); + } } else if (!strcasecmp(var, "t38-passthru")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_T38_PASSTHRU); diff --git a/src/switch_utils.c b/src/switch_utils.c index 123d8aa..d7c5d6b 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -716,6 +716,32 @@ SWITCH_DECLARE(char *) switch_replace_char(char *str, char from, char to, switch return p; } +SWITCH_DECLARE(char *) switch_strip_whitespace(const char *str) +{ + const char *sp = str; + char *p, *s = NULL; + + if (!sp) + return NULL; + + while ((*sp == 13 ) || (*sp == 10 ) || (*sp == 9 ) || (*sp == 20) || (*sp == 11) ) { + sp++; + } + + s = strdup(sp); + + if (!s) + return NULL; + + p = s + (strlen(s) - 1); + + while ((*p == 13 ) || (*p == 10 ) || (*p == 9 ) || (*p == 20) || (*p == 11) ) { + *p-- = '\0'; + } + + return s; +} + SWITCH_DECLARE(char *) switch_strip_spaces(const char *str) { const char *sp = str; commit 7f075c0c28e7c1342bd2616fc0e2792ab2ce039c Author: Anthony Minessale <anthm@freeswitch.org> Date: Thu Aug 19 12:09:21 2010 -0500 more presence tweaks diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 0c938b9..f68c8df 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1287,7 +1287,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * const char *from_user = switch_str_nil(switch_event_get_header(helper->event, "variable_sip_from_user")); char *clean_to_user = NULL; char *clean_from_user = NULL; - const char *p_to_user = switch_str_nil(switch_event_get_header(helper->event, "to-user")); + int force_status = 0; #if 0 char *buf; switch_event_serialize(helper->event, &buf, SWITCH_FALSE); @@ -1312,9 +1312,6 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * goto end; } - if (!strcasecmp(event_status, "Registered")) { - answer_state = "resubscribe"; - } if (is_dialog) { stream.write_function(&stream, @@ -1325,18 +1322,16 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * !strcasecmp(answer_state, "resubscribe") ? "partial" : "full", clean_id); } - if (strcasecmp(answer_state, "resubscribe")) { - - if (!strcasecmp(state, "cs_hangup")) { - astate = "terminated"; - } else if (zstr(astate)) { - astate = switch_str_nil(switch_event_get_header(helper->event, "answer-state")); - if (zstr(astate)) { - if (is_dialog) { - astate = dft_state; - } else { - astate = "terminated"; - } + if (strcasecmp(event_status, "Registered")) { + if (!zstr(answer_state)) { + astate = answer_state; + } + + if (zstr(astate)) { + if (is_dialog) { + astate = dft_state; + } else { + astate = "terminated"; } } @@ -1348,6 +1343,10 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * astate = "confirmed"; } + if (!strcasecmp(astate, "hangup")) { + astate = "terminated"; + } + if (is_dialog) { if (!strcasecmp(astate, "ringing")) { if (!strcasecmp(direction, "recipient")) { @@ -1361,7 +1360,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * stream.write_function(&stream, "<state>%s</state>\n", astate); } else { if (!strcasecmp(astate, "ringing")) { - astate = "confirmed"; + astate = "early"; } } @@ -1425,39 +1424,54 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * switch_set_string(status_line, status); if (in) { - if (!strcmp(astate, "early")) { - switch_snprintf(status_line, sizeof(status_line), "Ring %s", switch_str_nil(from_id)); - rpid = "on-the-phone"; - } else if (!strcmp(astate, "confirmed")) { - char *dest = switch_event_get_header(helper->event, "Caller-Destination-Number"); - if (zstr(from_id) && !zstr(dest)) { - from_id = dest; + const char *direction = switch_event_get_header(helper->event, "Caller-Direction"); + const char *op, *what = "Ring"; + + if (direction && !strcasecmp(direction, "outbound")) { + op = switch_event_get_header(helper->event, "Other-Leg-Caller-ID-Number"); + } else { + if (!(op = switch_event_get_header(helper->event, "Caller-Callee-ID-Number"))) { + op = switch_event_get_header(helper->event, "Caller-Destination-Number"); } + } - if (zstr(from_id)) { - from_id = p_to_user; + if (direction) { + what = !strcasecmp(direction, "outbound") ? "Call" : "Ring"; + } + + if (!strcmp(astate, "early")) { + if (zstr(op)) { + switch_snprintf(status_line, sizeof(status_line), "%s %s", what, status); + } else { + switch_snprintf(status_line, sizeof(status_line), "%s %s", what, op); } - if (zstr(from_id)) { + rpid = "on-the-phone"; + force_status = 1; + + } else if (!strcmp(astate, "confirmed")) { + if (zstr(op)) { switch_snprintf(status_line, sizeof(status_line), "On The Phone %s", status); } else { - switch_snprintf(status_line, sizeof(status_line), "Talk %s", switch_str_nil(from_id)); + switch_snprintf(status_line, sizeof(status_line), "Talk %s", op); } + rpid = "on-the-phone"; + force_status = 1; } open = "open"; } else { open = "closed"; } - + if (open_closed) { open = open_closed; } prpid = translate_rpid(rpid); - if (!zstr(dialog_status)) { + if (!zstr(dialog_status) && !force_status) { status = dialog_status; switch_set_string(status_line, status); } @@ -1468,7 +1482,6 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * pl = gen_pidf(user_agent, clean_id, profile->url, open, rpid, prpid, status_line, &ct); - } } else { diff --git a/src/switch_channel.c b/src/switch_channel.c index 6f33fa9..0a358df 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -1530,7 +1530,10 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_running_state( channel->direction == SWITCH_CALL_DIRECTION_OUTBOUND ? "outbound" : "inbound"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Presence-Call-Direction", channel->direction == SWITCH_CALL_DIRECTION_OUTBOUND ? "outbound" : "inbound"); - if (switch_channel_test_flag(channel, CF_ANSWERED)) { + + if (switch_channel_down(channel)) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Answer-State", "hangup"); + } else if (switch_channel_test_flag(channel, CF_ANSWERED)) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Answer-State", "answered"); } else if (switch_channel_test_flag(channel, CF_EARLY_MEDIA)) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Answer-State", "early"); @@ -1811,7 +1814,9 @@ SWITCH_DECLARE(void) switch_channel_event_set_basic_data(switch_channel_t *chann switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Call-UUID", v); } - if (switch_channel_test_flag(channel, CF_ANSWERED)) { + if (switch_channel_down(channel)) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Answer-State", "hangup"); + } else if (switch_channel_test_flag(channel, CF_ANSWERED)) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Answer-State", "answered"); } else if (switch_channel_test_flag(channel, CF_EARLY_MEDIA)) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Answer-State", "early"); commit 0a9f6041dc6193e8704008964e00602588468513 Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Aug 19 10:24:46 2010 -0600 MODSOFIA-92 add VS2010 express diff --git a/Freeswitch.2010.express.sln b/Freeswitch.2010.express.sln index c26bbbf..e9bf633 100644 --- a/Freeswitch.2010.express.sln +++ b/Freeswitch.2010.express.sln @@ -307,6 +307,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_hash", "src\mod\applica EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libtiff", "libs\spandsp\src\libtiff.2010.vcxproj", "{401A40CD-5DB4-4E34-AC68-FA99E9FAC014}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download OPENSSL", "libs\win32\Download OPENSSL.2010.vcxproj", "{D578E676-7EC8-4548-BD8B-845C635F14AD}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libeay32", "libs\win32\openssl\libeay32.2010.vcxproj", "{D331904D-A00A-4694-A5A3-FCFF64AB5DBE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ssleay32", "libs\win32\openssl\ssleay32.2010.vcxproj", "{B4B62169-5AD4-4559-8707-3D933AC5DB39}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openssl", "libs\win32\openssl\openssl.2010.vcxproj", "{25BD39B1-C8BF-4676-A738-9CABD9C6BC79}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -1937,6 +1945,42 @@ Global {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|Win32.ActiveCfg = Release|Win32 {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|Win32.Build.0 = Release|Win32 {401A40CD-5DB4-4E34-AC68-FA99E9FAC014}.Release|x64.ActiveCfg = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.All|Win32.ActiveCfg = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.All|Win32.Build.0 = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.All|x64.ActiveCfg = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Debug|Win32.ActiveCfg = Debug|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Debug|Win32.Build.0 = Debug|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Debug|x64.ActiveCfg = Debug|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Release|Win32.ActiveCfg = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Release|Win32.Build.0 = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Release|x64.ActiveCfg = Release|Win32 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.All|Win32.ActiveCfg = Release|Win32 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.All|Win32.Build.0 = Release|Win32 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.All|x64.ActiveCfg = Release|Win32 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Debug|Win32.ActiveCfg = Debug|Win32 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Debug|Win32.Build.0 = Debug|Win32 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Debug|x64.ActiveCfg = Debug|Win32 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Release|Win32.ActiveCfg = Release|Win32 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Release|Win32.Build.0 = Release|Win32 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Release|x64.ActiveCfg = Release|Win32 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.All|Win32.ActiveCfg = Release|Win32 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.All|Win32.Build.0 = Release|Win32 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.All|x64.ActiveCfg = Release|Win32 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Debug|Win32.ActiveCfg = Debug|Win32 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Debug|Win32.Build.0 = Debug|Win32 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Debug|x64.ActiveCfg = Debug|Win32 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Release|Win32.ActiveCfg = Release|Win32 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Release|Win32.Build.0 = Release|Win32 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Release|x64.ActiveCfg = Release|Win32 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.All|Win32.ActiveCfg = Release|Win32 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.All|Win32.Build.0 = Release|Win32 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.All|x64.ActiveCfg = Release|Win32 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Debug|Win32.ActiveCfg = Debug|Win32 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Debug|Win32.Build.0 = Debug|Win32 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Debug|x64.ActiveCfg = Debug|Win32 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|Win32.ActiveCfg = Release|Win32 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|Win32.Build.0 = Release|Win32 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE commit 1977aa868452e67bed5a5ee5526cae0d5a032b92 Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Aug 19 10:38:54 2010 -0500 VS2010 add missing project filters diff --git a/libs/broadvoice/src/libbroadvoice.2010.vcxproj.filters b/libs/broadvoice/src/libbroadvoice.2010.vcxproj.filters new file mode 100644 index 0000000..263ac94 --- /dev/null +++ b/libs/broadvoice/src/libbroadvoice.2010.vcxproj.filters @@ -0,0 +1,167 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{f5d987d2-ff66-4c4f-9d5d-38f05fedf46a}</UniqueIdentifier> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="bitstream.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\common\a2lsp.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\common\allpole.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\common\allzero.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\common\autocor.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\common\cmtables.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\common\levdur.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\common\lsp2a.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\common\stblchck.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\common\stblzlsp.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\common\utility.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="bitpack16.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv16\bv16decoder.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv16\bv16encoder.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv16\bv16coarse_pitch.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv16\bv16excdec.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv16\bv16excquan.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv16\bv16fine_pitch.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv16\bv16gaindec.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv16\bv16gainquan.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv16\bv16levelest.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv16\bv16lspdec.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv16\bv16lspquan.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv16\bv16plc.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv16\bv16ptdec.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv16\bv16postfilter.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv16\bv16ptquan.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv16\bv16tables.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="bitpack32.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv32\bv32decoder.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv32\bv32encoder.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv32\bv32coarse_pitch.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv32\bv32excdec.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv32\bv32excquan.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv32\bv32fine_pitch.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv32\bv32gaindec.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv32\bv32gainquan.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv32\bv32levelest.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv32\bv32lspdec.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv32\bv32lspquan.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv32\bv32plc.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv32\bv32ptdec.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv32\bv32ptquan.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="floating\bv32\bv32tables.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="msvc\gettimeofday.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="broadvoice\broadvoice.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="broadvoice\version.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="broadvoice\private\broadvoice.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="broadvoice.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/esl/fs_cli.2010.vcxproj.filters b/libs/esl/fs_cli.2010.vcxproj.filters new file mode 100644 index 0000000..dfc1faa --- /dev/null +++ b/libs/esl/fs_cli.2010.vcxproj.filters @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="fs_cli.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="getopt\getopt_long.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="getopt\getopt.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/esl/src/esl.2010.vcxproj.filters b/libs/esl/src/esl.2010.vcxproj.filters new file mode 100644 index 0000000..9f202cf --- /dev/null +++ b/libs/esl/src/esl.2010.vcxproj.filters @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="esl.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="esl_config.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="esl_event.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="esl_json.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="esl_threadmutex.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="include\esl.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="include\esl_config.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="include\esl_event.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="include\esl_json.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="include\esl_threadmutex.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/ilbc/libilbc.2010.vcxproj.filters b/libs/ilbc/libilbc.2010.vcxproj.filters new file mode 100644 index 0000000..adc872f --- /dev/null +++ b/libs/ilbc/libilbc.2010.vcxproj.filters @@ -0,0 +1,162 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="src\anaFilter.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\constants.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\createCB.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\doCPLC.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\enhancer.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\filter.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\FrameClassify.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\gainquant.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\getCBvec.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\helpfun.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\hpInput.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\hpOutput.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\iCBConstruct.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\iCBSearch.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\iLBC_decode.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\iLBC_encode.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\LPCdecode.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\LPCencode.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\lsf.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\packing.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\StateConstructW.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\StateSearchW.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\syntFilter.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="src\anaFilter.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\constants.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\createCB.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\doCPLC.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\enhancer.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\filter.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\FrameClassify.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\gainquant.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\getCBvec.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\helpfun.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\hpInput.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\hpOutput.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\iCBConstruct.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\iCBSearch.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\ilbc\ilbc.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\iLBC_define.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\LPCdecode.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\LPCencode.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\lsf.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\packing.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\StateConstructW.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\StateSearchW.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\syntFilter.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\ilbc\version.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/libdingaling/libdingaling.2010.vcxproj.filters b/libs/libdingaling/libdingaling.2010.vcxproj.filters new file mode 100644 index 0000000..18ef8e8 --- /dev/null +++ b/libs/libdingaling/libdingaling.2010.vcxproj.filters @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="src\libdingaling.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\sha1.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="src\ldl_compat.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\libdingaling.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <None Include="src\dingaling.def"> + <Filter>Source Files</Filter> + </None> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/libteletone/libteletone.2010.vcxproj.filters b/libs/libteletone/libteletone.2010.vcxproj.filters new file mode 100644 index 0000000..720e152 --- /dev/null +++ b/libs/libteletone/libteletone.2010.vcxproj.filters @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="src\libteletone_detect.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="src\libteletone_generate.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="src\libteletone.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\libteletone_detect.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="src\libteletone_generate.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/portaudio/build/msvc/portaudio.2010.vcxproj.filters b/libs/portaudio/build/msvc/portaudio.2010.vcxproj.filters new file mode 100644 index 0000000..8fc7695 --- /dev/null +++ b/libs/portaudio/build/msvc/portaudio.2010.vcxproj.filters @@ -0,0 +1,132 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{27479ed0-78ba-43cc-8fb5-31de44bbc8da}</UniqueIdentifier> + <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions> + </Filter> + <Filter Include="Source Files\common"> + <UniqueIdentifier>{8f150320-dccc-4b5c-b43c-b3b91378f721}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\hostapi"> + <UniqueIdentifier>{ac26acd3-797a-4668-a607-9694e9f10a16}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\hostapi\ASIO"> + <UniqueIdentifier>{03878aa4-e6a3-4d56-81fe-f93794a1e3a1}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\hostapi\ASIO\ASIOSDK"> + <UniqueIdentifier>{99774f7f-59c1-48cb-b72a-09d78537e6e4}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\hostapi\dsound"> + <UniqueIdentifier>{f47fabee-145b-4c98-9423-3d1bb7c1f3b3}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\hostapi\wmme"> + <UniqueIdentifier>{4ea57aa2-5b6b-4022-86b9-f3a02dd2284b}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\hostapi\wasapi"> + <UniqueIdentifier>{9c44aff3-3f53-4117-8097-ee8b810caba2}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\os"> + <UniqueIdentifier>{a20f633f-4213-4f4b-bd65-a8e49cf9f842}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\os\win"> + <UniqueIdentifier>{ce9a362c-b700-4ea4-88b4-51c222789754}</UniqueIdentifier> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{6e72bafa-42f5-450a-90f4-0206faddcf3d}</UniqueIdentifier> + <Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{5060bc7a-2362-400f-bda0-ae74643cea86}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\common\pa_allocation.c"> + <Filter>Source Files\common</Filter> + </ClCompile> + <ClCompile Include="..\..\src\common\pa_converters.c"> + <Filter>Source Files\common</Filter> + </ClCompile> + <ClCompile Include="..\..\src\common\pa_cpuload.c"> + <Filter>Source Files\common</Filter> + </ClCompile> + <ClCompile Include="..\..\src\common\pa_debugprint.c"> + <Filter>Source Files\common</Filter> + </ClCompile> + <ClCompile Include="..\..\src\common\pa_dither.c"> + <Filter>Source Files\common</Filter> + </ClCompile> + <ClCompile Include="..\..\src\common\pa_front.c"> + <Filter>Source Files\common</Filter> + </ClCompile> + <ClCompile Include="..\..\src\common\pa_process.c"> + <Filter>Source Files\common</Filter> + </ClCompile> + <ClCompile Include="..\..\src\common\pa_skeleton.c"> + <Filter>Source Files\common</Filter> + </ClCompile> + <ClCompile Include="..\..\src\common\pa_stream.c"> + <Filter>Source Files\common</Filter> + </ClCompile> + <ClCompile Include="..\..\src\common\pa_trace.c"> + <Filter>Source Files\common</Filter> + </ClCompile> + <ClCompile Include="..\..\src\hostapi\asio\pa_asio.cpp"> + <Filter>Source Files\hostapi\ASIO</Filter> + </ClCompile> + <ClCompile Include="..\..\src\hostapi\asio\ASIOSDK\common\asio.cpp"> + <Filter>Source Files\hostapi\ASIO\ASIOSDK</Filter> + </ClCompile> + <ClCompile Include="..\..\src\hostapi\asio\ASIOSDK\host\ASIOConvertSamples.cpp"> + <Filter>Source Files\hostapi\ASIO\ASIOSDK</Filter> + </ClCompile> + <ClCompile Include="..\..\src\hostapi\asio\ASIOSDK\host\asiodrivers.cpp"> + <Filter>Source Files\hostapi\ASIO\ASIOSDK</Filter> + </ClCompile> + <ClCompile Include="..\..\src\hostapi\asio\ASIOSDK\host\pc\asiolist.cpp"> + <Filter>Source Files\hostapi\ASIO\ASIOSDK</Filter> + </ClCompile> + <ClCompile Include="..\..\src\hostapi\asio\ASIOSDK\common\combase.cpp"> + <Filter>Source Files\hostapi\ASIO\ASIOSDK</Filter> + </ClCompile> + <ClCompile Include="..\..\src\hostapi\asio\ASIOSDK\common\debugmessage.cpp"> + <Filter>Source Files\hostapi\ASIO\ASIOSDK</Filter> + </ClCompile> + <ClCompile Include="..\..\src\hostapi\asio\ASIOSDK\common\register.cpp"> + <Filter>Source Files\hostapi\ASIO\ASIOSDK</Filter> + </ClCompile> + <ClCompile Include="..\..\src\hostapi\dsound\pa_win_ds.c"> + <Filter>Source Files\hostapi\dsound</Filter> + </ClCompile> + <ClCompile Include="..\..\src\hostapi\dsound\pa_win_ds_dynlink.c"> + <Filter>Source Files\hostapi\dsound</Filter> + </ClCompile> + <ClCompile Include="..\..\src\hostapi\wmme\pa_win_wmme.c"> + <Filter>Source Files\hostapi\wmme</Filter> + </ClCompile> + <ClCompile Include="..\..\src\hostapi\wasapi\pa_win_wasapi.cpp"> + <Filter>Source Files\hostapi\wasapi</Filter> + </ClCompile> + <ClCompile Include="..\..\src\os\win\pa_win_hostapis.c"> + <Filter>Source Files\os\win</Filter> + </ClCompile> + <ClCompile Include="..\..\src\os\win\pa_win_util.c"> + <Filter>Source Files\os\win</Filter> + </ClCompile> + <ClCompile Include="..\..\src\os\win\pa_win_waveformat.c"> + <Filter>Source Files\os\win</Filter> + </ClCompile> + <ClCompile Include="..\..\src\os\win\pa_win_wdmks_utils.c"> + <Filter>Source Files\os\win</Filter> + </ClCompile> + <ClCompile Include="..\..\src\os\win\pa_x86_plain_converters.c"> + <Filter>Source Files\os\win</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <None Include="portaudio.def"> + <Filter>Resource Files</Filter> + </None> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/silk/src/Silk_FIX.2010.vcxproj.filters b/libs/silk/src/Silk_FIX.2010.vcxproj.filters new file mode 100644 index 0000000..2e9c4ec --- /dev/null +++ b/libs/silk/src/Silk_FIX.2010.vcxproj.filters @@ -0,0 +1,413 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="SKP_Silk_A2NLSF.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_allpass_int.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_ana_filt_bank_1.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_apply_sine_window.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_array_maxabs.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_autocorr.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_biquad.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_biquad_alt.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_burg_modified.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_bwexpander.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_bwexpander_32.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_CNG.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_code_signs.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_control_codec_FIX.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_corrMatrix_FIX.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_create_init_destroy.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_dec_API.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_decode_core.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_decode_frame.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_decode_indices_v4.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_decode_parameters.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_decode_parameters_v4.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_decode_pulses.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_decoder_set_fs.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_detect_SWB_input.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_enc_API.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_encode_frame_FIX.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_encode_parameters.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_encode_parameters_v4.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_encode_pulses.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_find_LPC_FIX.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_find_LTP_FIX.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_find_pitch_lags_FIX.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_find_pred_coefs_FIX.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_gain_quant.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_HP_variable_cutoff_FIX.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_init_encoder_FIX.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_inner_prod_aligned.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_interpolate.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_k2a.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_k2a_Q16.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_LBRR_reset.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_lin2log.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_log2lin.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_lowpass_int.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_lowpass_short.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_LP_variable_cutoff.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_LPC_inv_pred_gain.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_LPC_stabilize.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_LPC_synthesis_filter.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_LPC_synthesis_order16.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_LSF_cos_table.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_LTP_analysis_filter_FIX.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_LTP_scale_ctrl_FIX.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_MA.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_NLSF2A.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_NLSF2A_stable.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_NLSF_MSVQ_decode.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_NLSF_MSVQ_encode_FIX.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_NLSF_stabilize.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_NLSF_VQ_rate_distortion_FIX.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_NLSF_VQ_sum_error_FIX.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_NLSF_VQ_weights_laroia.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_noise_shape_analysis_FIX.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_NSQ.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_NSQ_del_dec.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_pitch_analysis_core.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_pitch_est_tables.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_PLC.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_prefilter_FIX.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_process_gains_FIX.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_process_NLSFs_FIX.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_pulses_to_bytes.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_quant_LTP_gains_FIX.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_range_coder.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_regularize_correlations_FIX.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_resample_1_2.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_resample_1_2_coarse.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_resample_1_2_coarsest.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_resample_1_3.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_resample_2_1_coarse.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_resample_2_3.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_resample_2_3_coarse.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_resample_2_3_coarsest.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_resample_2_3_rom.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_resample_3_1.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_resample_3_2.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_resample_3_2_rom.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_resample_3_4.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_resample_4_3.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_residual_energy16_FIX.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_residual_energy_FIX.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_scale_copy_vector16.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_scale_vector.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_schur.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_schur64.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_shell_coder.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_sigm_Q15.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_solve_LS_FIX.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_sort.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_sum_sqr_shift.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_tables_gain.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_tables_LTP.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_tables_NLSF_CB0_10.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_tables_NLSF_CB0_16.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_tables_NLSF_CB1_10.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_tables_NLSF_CB1_16.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_tables_other.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_tables_pitch_lag.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_tables_pulses_per_block.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_tables_sign.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_tables_type_offset.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_VAD.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="SKP_Silk_VQ_nearest_neighbor_FIX.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\interface\SKP_Silk_control.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="SKP_Silk_define.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="SKP_Silk_define_FIX.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\interface\SKP_Silk_errors.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="SKP_Silk_Inlines.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="SKP_Silk_macros.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="SKP_Silk_main.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="SKP_Silk_main_FIX.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="SKP_Silk_perceptual_parameters_FIX.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="SKP_Silk_pitch_est_defines.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="SKP_Silk_PLC.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="SKP_Silk_resample_rom.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\interface\SKP_Silk_SDK_API.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="SKP_Silk_SigProc_FIX.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="SKP_Silk_structs.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="SKP_Silk_structs_FIX.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="SKP_Silk_tables.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\interface\SKP_Silk_typedef.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/spandsp/src/libspandsp.2010.vcxproj.filters b/libs/spandsp/src/libspandsp.2010.vcxproj.filters new file mode 100644 index 0000000..2a6d60a --- /dev/null +++ b/libs/spandsp/src/libspandsp.2010.vcxproj.filters @@ -0,0 +1,667 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{23b008e2-8d2d-475f-bdb4-f3f067ff16e3}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="adsi.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="async.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="at_interpreter.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="awgn.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="bell_r2_mf.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="bert.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="bit_operations.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="bitstream.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="complex_filters.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="complex_vector_float.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="complex_vector_int.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="crc.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="dds_float.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="dds_int.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="dtmf.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="echo.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="fax.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="fax_modems.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="fsk.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="g711.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="g722.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="g726.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="gsm0610_decode.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="gsm0610_encode.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="gsm0610_long_term.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="gsm0610_lpc.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="gsm0610_preprocess.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="gsm0610_rpe.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="gsm0610_short_term.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="hdlc.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="ima_adpcm.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="logging.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="lpc10_analyse.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="lpc10_decode.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="lpc10_encode.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="lpc10_placev.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="lpc10_voicing.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="modem_echo.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="modem_connect_tones.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="noise.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="oki_adpcm.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="playout.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="plc.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="power_meter.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="queue.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="schedule.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="sig_tone.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="silence_gen.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="super_tone_rx.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="super_tone_tx.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="swept_tone.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="t4_rx.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="t4_tx.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="t30.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="t30_api.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="t30_logging.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="t31.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="t35.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="t38_core.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="t38_gateway.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="t38_non_ecm_buffer.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="t38_terminal.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="testcpuid.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="time_scale.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="tone_detect.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="tone_generate.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="v17rx.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="v17tx.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="v18.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="v22bis_rx.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="v22bis_tx.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="v27ter_rx.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="v27ter_tx.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="v29rx.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="v29tx.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="v42.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="v42bis.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="v8.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="vector_float.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="vector_int.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="msvc\gettimeofday.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="spandsp\adsi.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\async.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\arctan2.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\at_interpreter.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\awgn.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\bell_r2_mf.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\bert.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\biquad.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\bit_operations.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\bitstream.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\crc.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\complex.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\complex_filters.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\complex_vector_float.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\complex_vector_int.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\dc_restore.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\dds.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\dtmf.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\echo.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\fast_convert.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\fax.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\fax_modems.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\fir.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\fsk.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\g168models.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\g711.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\g722.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\g726.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\gsm0610.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\hdlc.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\ima_adpcm.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\logging.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\lpc10.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\modem_echo.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\modem_connect_tones.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\noise.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\oki_adpcm.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\playout.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\plc.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\power_meter.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\queue.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\saturated.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\schedule.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\sig_tone.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\silence_gen.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\super_tone_rx.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\super_tone_tx.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\swept_tone.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\t4_rx.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\t4_tx.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\t30.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\t30_api.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\t30_fcf.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\t30_logging.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\t31.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\t35.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\t38_core.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\t38_gateway.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\t38_non_ecm_buffer.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\t38_terminal.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\telephony.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\time_scale.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\timing.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\tone_detect.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\tone_generate.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\v17rx.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\v17tx.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\v18.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\v22bis.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\v27ter_rx.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\v27ter_tx.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\v29rx.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\v29tx.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\v42.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\v42bis.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\v8.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\vector_float.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\vector_int.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\version.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\adsi.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\async.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\at_interpreter.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\awgn.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\bell_r2_mf.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\bert.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\bitstream.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\dtmf.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\echo.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\fax.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\fax_modems.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\fsk.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\g711.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\g722.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\g726.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\gsm0610.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\hdlc.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\ima_adpcm.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\logging.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\lpc10.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\modem_connect_tones.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\modem_echo.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\noise.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\oki_adpcm.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\queue.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\schedule.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\sig_tone.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\silence_gen.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\super_tone_rx.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\super_tone_tx.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\swept_tone.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\t30.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\t30_dis_dtc_dcs_bits.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\t31.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\t38_core.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\t38_gateway.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\t38_non_ecm_buffer.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\t38_terminal.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\t4_rx.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\t4_tx.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\time_scale.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\tone_detect.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\tone_generate.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\v17rx.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\v17tx.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\v18.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\v22bis.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\v27ter_rx.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\v27ter_tx.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\v29rx.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\v29tx.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\v42.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\v42bis.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\private\v8.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp\expose.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="spandsp.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="msvc\spandsp.h" /> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/spandsp/src/libtiff.2010.vcxproj.filters b/libs/spandsp/src/libtiff.2010.vcxproj.filters new file mode 100644 index 0000000..f5377c7 --- /dev/null +++ b/libs/spandsp/src/libtiff.2010.vcxproj.filters @@ -0,0 +1,157 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{ac6743e4-3ae7-4b7b-bc52-d1700047dc05}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_aux.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_close.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_codec.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_color.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_compress.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_dir.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_dirinfo.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_dirread.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_dirwrite.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_dumpmode.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_error.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_extension.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_fax3.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_fax3sm.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_flush.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_getimage.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_jpeg.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_luv.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_lzw.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_next.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_ojpeg.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_open.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_packbits.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_pixarlog.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_predict.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_print.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_read.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_strip.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_swab.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_thunder.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_tile.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_unix.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_version.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_warning.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_write.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\tiff-3.8.2\libtiff\tif_zip.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\tiff-3.8.2\libtiff\t4.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\tiff-3.8.2\libtiff\tif_dir.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\tiff-3.8.2\libtiff\tif_fax3.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\tiff-3.8.2\libtiff\tif_predict.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\tiff-3.8.2\libtiff\tiff.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\tiff-3.8.2\libtiff\tiffconf.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\tiff-3.8.2\libtiff\tiffio.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\tiff-3.8.2\libtiff\tiffio.hxx"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\tiff-3.8.2\libtiff\tiffiop.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\tiff-3.8.2\libtiff\tiffvers.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\tiff-3.8.2\libtiff\uvcode.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/spandsp/src/msvc/make_at_dictionary.2010.vcxproj.filters b/libs/spandsp/src/msvc/make_at_dictionary.2010.vcxproj.filters new file mode 100644 index 0000000..708d522 --- /dev/null +++ b/libs/spandsp/src/msvc/make_at_dictionary.2010.vcxproj.filters @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\make_at_dictionary.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/spandsp/src/msvc/make_modem_filter.2010.vcxproj.filters b/libs/spandsp/src/msvc/make_modem_filter.2010.vcxproj.filters new file mode 100644 index 0000000..1224979 --- /dev/null +++ b/libs/spandsp/src/msvc/make_modem_filter.2010.vcxproj.filters @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\filter_tools.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="getopt.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\make_modem_filter.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\filter_tools.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/speex/win32/VS2008/libspeex/libspeex.vcxproj.filters b/libs/speex/win32/VS2008/libspeex/libspeex.vcxproj.filters new file mode 100644 index 0000000..51656a2 --- /dev/null +++ b/libs/speex/win32/VS2008/libspeex/libspeex.vcxproj.filters @@ -0,0 +1,210 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\..\libspeex\bits.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\libspeex\cb_search.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\libspeex\exc_10_16_table.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\libspeex\exc_10_32_table.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\libspeex\exc_20_32_table.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\libspeex\exc_5_256_table.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\libspeex\exc_5_64_table.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\libspeex\exc_8_128_table.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\libspeex\filters.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\libspeex\gain_table.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\libspeex\gain_table_lbr.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\libspeex\hexc_10_32_table.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\libspeex\hexc_table.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\libspeex\high_lsp_tables.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\libspeex\lpc.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\libspeex\lsp.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\libspeex\lsp_tables_nb.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\libspeex\ltp.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\libspeex\modes.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\libspeex\modes_wb.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\libspeex\nb_celp.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\libspeex\quant_lsp.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\libspeex\sb_celp.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\libspeex\speex.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\libspeex\speex_callbacks.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\libspeex\speex_header.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\libspeex\stereo.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\libspeex\vbr.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\libspeex\vq.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\..\libspeex\window.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <None Include="libspeex.def"> + <Filter>Source Files</Filter> + </None> + <None Include="ReadMe.txt" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\..\libspeex\cb_search.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\config.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\libspeex\fftwrap.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\libspeex\filters.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\libspeex\filters_sse.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\libspeex\kiss_fft.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\libspeex\kiss_fftr.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\libspeex\lpc.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\libspeex\lsp.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\libspeex\ltp.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\libspeex\ltp_sse.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\libspeex\math_approx.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\libspeex\misc.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\libspeex\modes.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\libspeex\nb_celp.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\libspeex\pseudofloat.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\libspeex\quant_lsp.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\libspeex\sb_celp.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\speex\speex.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\speex\speex_bits.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\speex\speex_callbacks.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\speex\speex_echo.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\speex\speex_header.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\speex\speex_jitter.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\speex\speex_noglobals.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\speex\speex_preprocess.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\speex\speex_stereo.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\speex\speex_types.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\libspeex\stack_alloc.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\libspeex\vbr.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\libspeex\vq.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/srtp/libsrtp.2010.vcxproj.filters b/libs/srtp/libsrtp.2010.vcxproj.filters new file mode 100644 index 0000000..80b5271 --- /dev/null +++ b/libs/srtp/libsrtp.2010.vcxproj.filters @@ -0,0 +1,200 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Source Files\Kernel"> + <UniqueIdentifier>{7633dd78-47bb-43bb-9ba1-4ab7d89873d1}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\Ciphers"> + <UniqueIdentifier>{532f3250-40ff-4a34-a071-f7bccfde71e2}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\Hashes"> + <UniqueIdentifier>{8343a503-59a3-4af7-bed6-6d6439001561}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\Replay"> + <UniqueIdentifier>{dfda6cc2-cf2f-4b3d-ad48-6bfe332ec0c1}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\Math"> + <UniqueIdentifier>{67144ed7-fb0e-4c22-96a4-1be71053e80f}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="srtp\srtp.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="crypto\kernel\alloc.c"> + <Filter>Source Files\Kernel</Filter> + </ClCompile> + <ClCompile Include="crypto\kernel\crypto_kernel.c"> + <Filter>Source Files\Kernel</Filter> + </ClCompile> + <ClCompile Include="crypto\rng\ctr_prng.c"> + <Filter>Source Files\Kernel</Filter> + </ClCompile> + <ClCompile Include="crypto\kernel\err.c"> + <Filter>Source Files\Kernel</Filter> + </ClCompile> + <ClCompile Include="crypto\kernel\key.c"> + <Filter>Source Files\Kernel</Filter> + </ClCompile> + <ClCompile Include="crypto\rng\prng.c"> + <Filter>Source Files\Kernel</Filter> + </ClCompile> + <ClCompile Include="crypto\rng\rand_source.c"> + <Filter>Source Files\Kernel</Filter> + </ClCompile> + <ClCompile Include="crypto\cipher\aes.c"> + <Filter>Source Files\Ciphers</Filter> + </ClCompile> + <ClCompile Include="crypto\cipher\aes_cbc.c"> + <Filter>Source Files\Ciphers</Filter> + </ClCompile> + <ClCompile Include="crypto\cipher\aes_icm.c"> + <Filter>Source Files\Ciphers</Filter> + </ClCompile> + <ClCompile Include="crypto\cipher\cipher.c"> + <Filter>Source Files\Ciphers</Filter> + </ClCompile> + <ClCompile Include="crypto\cipher\null_cipher.c"> + <Filter>Source Files\Ciphers</Filter> + </ClCompile> + <ClCompile Include="crypto\hash\auth.c"> + <Filter>Source Files\Hashes</Filter> + </ClCompile> + <ClCompile Include="crypto\hash\hmac.c"> + <Filter>Source Files\Hashes</Filter> + </ClCompile> + <ClCompile Include="crypto\hash\null_auth.c"> + <Filter>Source Files\Hashes</Filter> + </ClCompile> + <ClCompile Include="crypto\hash\sha1.c"> + <Filter>Source Files\Hashes</Filter> + </ClCompile> + <ClCompile Include="crypto\replay\rdb.c"> + <Filter>Source Files\Replay</Filter> + </ClCompile> + <ClCompile Include="crypto\replay\rdbx.c"> + <Filter>Source Files\Replay</Filter> + </ClCompile> + <ClCompile Include="crypto\replay\ut_sim.c"> + <Filter>Source Files\Replay</Filter> + </ClCompile> + <ClCompile Include="crypto\math\datatypes.c"> + <Filter>Source Files\Math</Filter> + </ClCompile> + <ClCompile Include="crypto\math\stat.c"> + <Filter>Source Files\Math</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="crypto\include\aes.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\aes_cbc.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\aes_icm.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\alloc.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\auth.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\cipher.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\config.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\crypto.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\crypto_kernel.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\crypto_math.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\crypto_types.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\cryptoalg.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\datatypes.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\err.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\gf2_8.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\hmac.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\integers.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\kernel_compat.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\key.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\null_auth.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\null_cipher.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\prng.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\rand_source.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\rdb.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\rdbx.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="include\rtp.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\sha1.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="include\srtp.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\stat.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="include\ut_sim.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="crypto\include\xfm.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <None Include="srtp.def"> + <Filter>Source Files</Filter> + </None> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2010.vcxproj.filters b/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2010.vcxproj.filters new file mode 100644 index 0000000..db0b315 --- /dev/null +++ b/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2010.vcxproj.filters @@ -0,0 +1,125 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="include"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="src"> + <UniqueIdentifier>{4c2fadb2-8996-43e3-9db1-e3fc3eccee30}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="include\apt.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\apt_consumer_task.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\apt_cyclic_queue.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\apt_dir_layout.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\apt_log.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\apt_net.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\apt_net_client_task.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\apt_net_server_task.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\apt_nlsml_doc.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\apt_obj_list.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\apt_pair.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\apt_pollset.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\apt_pool.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\apt_string.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\apt_string_table.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\apt_task.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\apt_task_msg.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\apt_test_suite.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\apt_text_stream.h"> + <Filter>include</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="src\apt_consumer_task.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\apt_cyclic_queue.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\apt_dir_layout.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\apt_log.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\apt_net.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\apt_net_client_task.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\apt_net_server_task.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\apt_nlsml_doc.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\apt_obj_list.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\apt_pair.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\apt_pollset.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\apt_pool.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\apt_string_table.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\apt_task.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\apt_task_msg.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\apt_test_suite.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\apt_text_stream.c"> + <Filter>src</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/unimrcp/libs/mpf/mpf.2010.vcxproj.filters b/libs/unimrcp/libs/mpf/mpf.2010.vcxproj.filters new file mode 100644 index 0000000..0e4bc84 --- /dev/null +++ b/libs/unimrcp/libs/mpf/mpf.2010.vcxproj.filters @@ -0,0 +1,239 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="codecs"> + <UniqueIdentifier>{3d69fc35-a195-4376-9508-ef77d7b27e71}</UniqueIdentifier> + </Filter> + <Filter Include="codecs\g711"> + <UniqueIdentifier>{81e2eace-c57a-4135-92cd-cc3575dfb088}</UniqueIdentifier> + </Filter> + <Filter Include="include"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="src"> + <UniqueIdentifier>{6fc3533a-b688-477d-914d-e0ffb15aa9a9}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="codecs\g711\g711.c"> + <Filter>codecs\g711</Filter> + </ClCompile> + <ClCompile Include="src\mpf_activity_detector.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mpf_audio_file_stream.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mpf_bridge.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mpf_buffer.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mpf_codec_descriptor.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mpf_codec_g711.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mpf_codec_linear.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mpf_codec_manager.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mpf_context.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mpf_decoder.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mpf_dtmf_detector.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mpf_dtmf_generator.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mpf_encoder.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mpf_engine.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mpf_file_termination_factory.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mpf_frame_buffer.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mpf_jitter_buffer.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mpf_mixer.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mpf_multiplier.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mpf_named_event.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mpf_resampler.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mpf_rtp_attribs.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mpf_rtp_stream.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mpf_rtp_termination_factory.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mpf_scheduler.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mpf_stream.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mpf_termination.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mpf_termination_factory.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mpf_timer_manager.c"> + <Filter>src</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="codecs\g711\g711.h"> + <Filter>codecs\g711</Filter> + </ClInclude> + <ClInclude Include="include\mpf.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_activity_detector.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_audio_file_descriptor.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_audio_file_stream.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_bridge.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_buffer.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_codec.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_codec_descriptor.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_codec_manager.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_context.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_decoder.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_dtmf_detector.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_dtmf_generator.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_encoder.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_engine.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_file_termination_factory.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_frame.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_frame_buffer.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_jitter_buffer.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_message.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_mixer.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_multiplier.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_named_event.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_object.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_resampler.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_rtcp_packet.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_rtp_attribs.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_rtp_defs.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_rtp_descriptor.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_rtp_header.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_rtp_pt.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_rtp_stat.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_rtp_stream.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_rtp_termination_factory.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_scheduler.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_stream.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_stream_descriptor.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_termination.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_termination_factory.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_timer_manager.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mpf_types.h"> + <Filter>include</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-client/mrcpclient.2010.vcxproj.filters b/libs/unimrcp/libs/mrcp-client/mrcpclient.2010.vcxproj.filters new file mode 100644 index 0000000..4054110 --- /dev/null +++ b/libs/unimrcp/libs/mrcp-client/mrcpclient.2010.vcxproj.filters @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="include"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="src"> + <UniqueIdentifier>{890ddc88-1a65-4b89-996c-625f8ef76b90}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="include\mrcp_application.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mrcp_client.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mrcp_client_session.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mrcp_client_types.h"> + <Filter>include</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="src\mrcp_client.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mrcp_client_session.c"> + <Filter>src</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj.filters b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj.filters new file mode 100644 index 0000000..4e5d30c --- /dev/null +++ b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj.filters @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="include"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="src"> + <UniqueIdentifier>{f3dc550f-1a0f-4b9e-b077-3b6940dc5531}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="include\mrcp_session.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mrcp_session_descriptor.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mrcp_sig_agent.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mrcp_sig_types.h"> + <Filter>include</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="src\mrcp_session_descriptor.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mrcp_sig_agent.c"> + <Filter>src</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj.filters b/libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj.filters new file mode 100644 index 0000000..119921b --- /dev/null +++ b/libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj.filters @@ -0,0 +1,133 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="include"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="message"> + <UniqueIdentifier>{19ad4bde-c4f4-4937-9073-ca2780341d76}</UniqueIdentifier> + </Filter> + <Filter Include="message\include"> + <UniqueIdentifier>{8ec996ac-8a0a-4bf0-9b3c-535616585109}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="message\src"> + <UniqueIdentifier>{5ba77874-7c17-4748-b5ba-b07b7f0a2169}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="control"> + <UniqueIdentifier>{f30fd049-a10d-4aea-b4bb-3eb674690fdd}</UniqueIdentifier> + </Filter> + <Filter Include="control\include"> + <UniqueIdentifier>{7e71717b-6f22-4c59-ba50-7b5a15516b2f}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="control\src"> + <UniqueIdentifier>{c66dbb84-ce9d-4408-b54d-4d0ec51069fb}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="resources"> + <UniqueIdentifier>{f20cfd62-4bb9-42de-bf1c-d578c8cd1a18}</UniqueIdentifier> + </Filter> + <Filter Include="resources\include"> + <UniqueIdentifier>{039a4834-7ddb-40e7-9177-55d11ef1e733}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="resources\src"> + <UniqueIdentifier>{dc087d31-8ecf-473c-baa1-f3091e16014d}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="include\mrcp.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mrcp_types.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="message\include\mrcp_generic_header.h"> + <Filter>message\include</Filter> + </ClInclude> + <ClInclude Include="message\include\mrcp_header_accessor.h"> + <Filter>message\include</Filter> + </ClInclude> + <ClInclude Include="message\include\mrcp_message.h"> + <Filter>message\include</Filter> + </ClInclude> + <ClInclude Include="message\include\mrcp_start_line.h"> + <Filter>message\include</Filter> + </ClInclude> + <ClInclude Include="control\include\mrcp_resource.h"> + <Filter>control\include</Filter> + </ClInclude> + <ClInclude Include="control\include\mrcp_resource_factory.h"> + <Filter>control\include</Filter> + </ClInclude> + <ClInclude Include="control\include\mrcp_resource_loader.h"> + <Filter>control\include</Filter> + </ClInclude> + <ClInclude Include="control\include\mrcp_stream.h"> + <Filter>control\include</Filter> + </ClInclude> + <ClInclude Include="resources\include\mrcp_recog_header.h"> + <Filter>resources\include</Filter> + </ClInclude> + <ClInclude Include="resources\include\mrcp_recog_resource.h"> + <Filter>resources\include</Filter> + </ClInclude> + <ClInclude Include="resources\include\mrcp_recorder_header.h"> + <Filter>resources\include</Filter> + </ClInclude> + <ClInclude Include="resources\include\mrcp_recorder_resource.h"> + <Filter>resources\include</Filter> + </ClInclude> + <ClInclude Include="resources\include\mrcp_synth_header.h"> + <Filter>resources\include</Filter> + </ClInclude> + <ClInclude Include="resources\include\mrcp_synth_resource.h"> + <Filter>resources\include</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="message\src\mrcp_generic_header.c"> + <Filter>message\src</Filter> + </ClCompile> + <ClCompile Include="message\src\mrcp_header_accessor.c"> + <Filter>message\src</Filter> + </ClCompile> + <ClCompile Include="message\src\mrcp_message.c"> + <Filter>message\src</Filter> + </ClCompile> + <ClCompile Include="message\src\mrcp_start_line.c"> + <Filter>message\src</Filter> + </ClCompile> + <ClCompile Include="control\src\mrcp_resource_factory.c"> + <Filter>control\src</Filter> + </ClCompile> + <ClCompile Include="control\src\mrcp_resource_loader.c"> + <Filter>control\src</Filter> + </ClCompile> + <ClCompile Include="control\src\mrcp_stream.c"> + <Filter>control\src</Filter> + </ClCompile> + <ClCompile Include="resources\src\mrcp_recog_header.c"> + <Filter>resources\src</Filter> + </ClCompile> + <ClCompile Include="resources\src\mrcp_recog_resource.c"> + <Filter>resources\src</Filter> + </ClCompile> + <ClCompile Include="resources\src\mrcp_recorder_header.c"> + <Filter>resources\src</Filter> + </ClCompile> + <ClCompile Include="resources\src\mrcp_recorder_resource.c"> + <Filter>resources\src</Filter> + </ClCompile> + <ClCompile Include="resources\src\mrcp_synth_header.c"> + <Filter>resources\src</Filter> + </ClCompile> + <ClCompile Include="resources\src\mrcp_synth_resource.c"> + <Filter>resources\src</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj.filters b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj.filters new file mode 100644 index 0000000..452f77e --- /dev/null +++ b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj.filters @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="include"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="src"> + <UniqueIdentifier>{a92d3b8c-d54d-416c-b458-dc57ac24d2e9}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="include\mrcp_client_connection.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mrcp_connection.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mrcp_connection_types.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mrcp_control_descriptor.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mrcp_server_connection.h"> + <Filter>include</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="src\mrcp_client_connection.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mrcp_connection.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mrcp_control_descriptor.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mrcp_server_connection.c"> + <Filter>src</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj.filters b/libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj.filters new file mode 100644 index 0000000..5a1581a --- /dev/null +++ b/libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj.filters @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="include"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="src"> + <UniqueIdentifier>{fd4564ef-9f34-4f23-992d-37f127e289a2}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="include\rtsp.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\rtsp_client.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\rtsp_header.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\rtsp_message.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\rtsp_server.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\rtsp_start_line.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\rtsp_stream.h"> + <Filter>include</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="src\rtsp_client.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\rtsp_header.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\rtsp_message.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\rtsp_server.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\rtsp_start_line.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\rtsp_stream.c"> + <Filter>src</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj.filters b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj.filters new file mode 100644 index 0000000..d2157ee --- /dev/null +++ b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj.filters @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="include"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="src"> + <UniqueIdentifier>{6e92b598-880e-4fe5-88fb-f69df8e06a57}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="include\mrcp_sdp.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mrcp_sofiasip_client_agent.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mrcp_sofiasip_server_agent.h"> + <Filter>include</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="src\mrcp_sdp.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mrcp_sofiasip_client_agent.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mrcp_sofiasip_server_agent.c"> + <Filter>src</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj.filters b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj.filters new file mode 100644 index 0000000..a990550 --- /dev/null +++ b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj.filters @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="include"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="src"> + <UniqueIdentifier>{f87f8ada-12d1-412b-bd14-7e62df3f92a0}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="include\mrcp_unirtsp_client_agent.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mrcp_unirtsp_sdp.h"> + <Filter>include</Filter> + </ClInclude> + <ClInclude Include="include\mrcp_unirtsp_server_agent.h"> + <Filter>include</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="src\mrcp_unirtsp_client_agent.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mrcp_unirtsp_sdp.c"> + <Filter>src</Filter> + </ClCompile> + <ClCompile Include="src\mrcp_unirtsp_server_agent.c"> + <Filter>src</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/win32/apr-util/libaprutil.2010.vcxproj.filters b/libs/win32/apr-util/libaprutil.2010.vcxproj.filters new file mode 100644 index 0000000..f185e2d --- /dev/null +++ b/libs/win32/apr-util/libaprutil.2010.vcxproj.filters @@ -0,0 +1,303 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{fefe4b16-83a4-46b0-ab4b-858531a32218}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\buckets"> + <UniqueIdentifier>{66bee6b2-6ba2-4e7d-9c04-5e52ea75b8ee}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto"> + <UniqueIdentifier>{ec602915-b144-4258-81ce-f8931434e1eb}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\dbd"> + <UniqueIdentifier>{47b5e91f-ec43-4b87-8d11-cc109d0f0733}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\dbm"> + <UniqueIdentifier>{12d41721-8bc3-476e-bffa-6bab3ebbcfef}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\encoding"> + <UniqueIdentifier>{aafe340f-5f94-4402-a3f4-977c302848c1}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\hooks"> + <UniqueIdentifier>{627c064a-54af-49ae-b154-01343f2be90e}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\ldap"> + <UniqueIdentifier>{3791a803-8653-410b-905e-934728270db6}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\misc"> + <UniqueIdentifier>{5133e514-d14d-46b5-9e37-3ab909e4ef28}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\sdbm"> + <UniqueIdentifier>{62959b64-29f8-483f-830f-91e3005c15b9}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\strmatch"> + <UniqueIdentifier>{ec299ad2-8fa6-4923-95f4-b8c7f6184dcf}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\uri"> + <UniqueIdentifier>{ef13505a-0a7a-4fdc-a55a-b47e92957a85}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\xlate"> + <UniqueIdentifier>{80fa8ffc-4776-4a21-bd8b-bfa055f9f46d}</UniqueIdentifier> + </Filter> + <Filter Include="Generated Files"> + <UniqueIdentifier>{fdb27306-6946-4cf2-bdb6-39e03cdeeae6}</UniqueIdentifier> + </Filter> + <Filter Include="Public Header Files"> + <UniqueIdentifier>{ee62af10-73ee-4af5-85d1-442efcd33aa2}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\apr-util\buckets\apr_brigade.c"> + <Filter>Source Files\buckets</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\buckets\apr_buckets.c"> + <Filter>Source Files\buckets</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\buckets\apr_buckets_alloc.c"> + <Filter>Source Files\buckets</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\buckets\apr_buckets_eos.c"> + <Filter>Source Files\buckets</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\buckets\apr_buckets_file.c"> + <Filter>Source Files\buckets</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\buckets\apr_buckets_flush.c"> + <Filter>Source Files\buckets</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\buckets\apr_buckets_heap.c"> + <Filter>Source Files\buckets</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\buckets\apr_buckets_mmap.c"> + <Filter>Source Files\buckets</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\buckets\apr_buckets_pipe.c"> + <Filter>Source Files\buckets</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\buckets\apr_buckets_pool.c"> + <Filter>Source Files\buckets</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\buckets\apr_buckets_refcount.c"> + <Filter>Source Files\buckets</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\buckets\apr_buckets_simple.c"> + <Filter>Source Files\buckets</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\buckets\apr_buckets_socket.c"> + <Filter>Source Files\buckets</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\crypto\apr_md4.c"> + <Filter>Source Files\crypto</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\crypto\apr_md5.c"> + <Filter>Source Files\crypto</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\crypto\apr_sha1.c"> + <Filter>Source Files\crypto</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\crypto\getuuid.c"> + <Filter>Source Files\crypto</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\crypto\uuid.c"> + <Filter>Source Files\crypto</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\dbd\apr_dbd.c"> + <Filter>Source Files\dbd</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\dbd\apr_dbd_pgsql.c"> + <Filter>Source Files\dbd</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\dbd\apr_dbd_sqlite2.c"> + <Filter>Source Files\dbd</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\dbd\apr_dbd_sqlite3.c"> + <Filter>Source Files\dbd</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\dbm\apr_dbm.c"> + <Filter>Source Files\dbm</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\dbm\apr_dbm_berkeleydb.c"> + <Filter>Source Files\dbm</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\dbm\apr_dbm_gdbm.c"> + <Filter>Source Files\dbm</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\dbm\apr_dbm_sdbm.c"> + <Filter>Source Files\dbm</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\encoding\apr_base64.c"> + <Filter>Source Files\encoding</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\hooks\apr_hooks.c"> + <Filter>Source Files\hooks</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\ldap\apr_ldap_init.c"> + <Filter>Source Files\ldap</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\ldap\apr_ldap_option.c"> + <Filter>Source Files\ldap</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\ldap\apr_ldap_url.c"> + <Filter>Source Files\ldap</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\misc\apr_date.c"> + <Filter>Source Files\misc</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\misc\apr_queue.c"> + <Filter>Source Files\misc</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\misc\apr_reslist.c"> + <Filter>Source Files\misc</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\misc\apr_rmm.c"> + <Filter>Source Files\misc</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\dbm\sdbm\sdbm.c"> + <Filter>Source Files\sdbm</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\dbm\sdbm\sdbm_hash.c"> + <Filter>Source Files\sdbm</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\dbm\sdbm\sdbm_lock.c"> + <Filter>Source Files\sdbm</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\dbm\sdbm\sdbm_pair.c"> + <Filter>Source Files\sdbm</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\strmatch\apr_strmatch.c"> + <Filter>Source Files\strmatch</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\uri\apr_uri.c"> + <Filter>Source Files\uri</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\xlate\xlate.c"> + <Filter>Source Files\xlate</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\apr-util\include\apr_anylock.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\include\apr_base64.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\include\apr_buckets.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\include\apr_date.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\include\apr_dbm.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\include\apr_hooks.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\include\apr_ldap_url.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\include\apr_md4.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\include\apr_md5.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\include\apr_optional.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\include\apr_optional_hooks.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\include\apr_queue.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\include\apr_reslist.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\include\apr_rmm.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\include\apr_sdbm.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\include\apr_sha1.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\include\apr_strmatch.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\include\apr_uri.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\include\apr_uuid.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\include\apr_xlate.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\include\apr_xml.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\include\apu_version.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <None Include="..\..\apr-util\include\apr_ldap.h.in"> + <Filter>Generated Files</Filter> + </None> + <None Include="..\..\apr-util\include\apr_ldap.hnw"> + <Filter>Generated Files</Filter> + </None> + <None Include="..\..\apr-util\include\apu.h.in"> + <Filter>Generated Files</Filter> + </None> + <None Include="..\..\apr-util\include\apu.hnw"> + <Filter>Generated Files</Filter> + </None> + <None Include="..\..\apr-util\include\private\apu_config.h.in"> + <Filter>Generated Files</Filter> + </None> + <None Include="..\..\apr-util\include\private\apu_select_dbm.h.in"> + <Filter>Generated Files</Filter> + </None> + <None Include="..\..\apr-util\include\apu_want.h.in"> + <Filter>Generated Files</Filter> + </None> + <None Include="..\..\apr-util\include\apu_want.hnw"> + <Filter>Generated Files</Filter> + </None> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="..\..\apr-util\libaprutil.rc" /> + </ItemGroup> + <ItemGroup> + <CustomBuildStep Include="..\..\apr-util\dbm\sdbm\sdbm_pair.h"> + <Filter>Source Files\sdbm</Filter> + </CustomBuildStep> + <CustomBuildStep Include="..\..\apr-util\dbm\sdbm\sdbm_private.h"> + <Filter>Source Files\sdbm</Filter> + </CustomBuildStep> + <CustomBuildStep Include="..\..\apr-util\dbm\sdbm\sdbm_tune.h"> + <Filter>Source Files\sdbm</Filter> + </CustomBuildStep> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\..\apr-util\include\apr_ldap.hw"> + <Filter>Generated Files</Filter> + </CustomBuild> + <CustomBuild Include="..\..\apr-util\include\apu.hw"> + <Filter>Generated Files</Filter> + </CustomBuild> + <CustomBuild Include="..\..\apr-util\include\private\apu_config.hw"> + <Filter>Generated Files</Filter> + </CustomBuild> + <CustomBuild Include="..\..\apr-util\include\private\apu_select_dbm.hw"> + <Filter>Generated Files</Filter> + </CustomBuild> + <CustomBuild Include="..\..\apr-util\include\apu_want.hw"> + <Filter>Generated Files</Filter> + </CustomBuild> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/win32/apr-util/xml.2010.vcxproj.filters b/libs/win32/apr-util/xml.2010.vcxproj.filters new file mode 100644 index 0000000..290e15f --- /dev/null +++ b/libs/win32/apr-util/xml.2010.vcxproj.filters @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{e33b7b13-01f9-4f80-b853-993ecbce325e}</UniqueIdentifier> + <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{da5f19e9-6a89-4668-815e-293aafff5410}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + <Filter Include="Generated Header Files"> + <UniqueIdentifier>{9f1b6ff0-ef97-40e0-bcea-0b5b8b302288}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\apr-util\xml\expat\lib\xmlparse.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\xml\expat\lib\xmlrole.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\xml\expat\lib\xmltok.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\xml\expat\lib\xmltok_impl.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\apr-util\xml\expat\lib\xmltok_ns.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\apr-util\xml\expat\lib\ascii.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\xml\expat\lib\asciitab.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\xml\expat\lib\config.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\xml\expat\lib\expat.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\xml\expat\lib\iasciitab.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\xml\expat\lib\latin1tab.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\xml\expat\lib\nametab.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\xml\expat\lib\utf8tab.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\xml\expat\lib\xmlrole.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\xml\expat\lib\xmltok.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr-util\xml\expat\lib\xmltok_impl.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <None Include="..\..\apr-util\xml\expat\lib\ReadMe.txt" /> + </ItemGroup> + <ItemGroup> + <CustomBuild Include="..\..\apr-util\xml\expat\lib\expat.h.in"> + <Filter>Generated Header Files</Filter> + </CustomBuild> + <CustomBuild Include="..\..\apr-util\xml\expat\lib\winconfig.h"> + <Filter>Generated Header Files</Filter> + </CustomBuild> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/win32/apr/libapr.2010.vcxproj.filters b/libs/win32/apr/libapr.2010.vcxproj.filters new file mode 100644 index 0000000..d8f55dc --- /dev/null +++ b/libs/win32/apr/libapr.2010.vcxproj.filters @@ -0,0 +1,406 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4fc8eb14-6896-4c69-bd8c-bddb16455565}</UniqueIdentifier> + <Extensions>.c</Extensions> + </Filter> + <Filter Include="Source Files\atomic"> + <UniqueIdentifier>{c89ee98b-64d0-48dd-b568-2ff6b59fc5c5}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\dso"> + <UniqueIdentifier>{78b00836-5d44-4387-8462-4bb5e76ae5da}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\file_io"> + <UniqueIdentifier>{0fa9b52a-8504-44e2-8c0e-12b4aad8d27b}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\locks"> + <UniqueIdentifier>{a4bc2b15-7e22-4e76-a2bc-bcd8fd793d09}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\memory"> + <UniqueIdentifier>{07e65061-0cc8-4f41-879e-0c4f5a1b4592}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\misc"> + <UniqueIdentifier>{2bb687cd-88a4-4477-8ee8-c0036b0b061c}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\mmap"> + <UniqueIdentifier>{8931e7d2-2589-4697-8eab-cbfdd7b78102}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\network_io"> + <UniqueIdentifier>{13d0cf3c-5d76-4e93-9dc9-20fc256f342e}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\passwd"> + <UniqueIdentifier>{c8b09a9b-d7a9-493c-af76-2f774f1ae867}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\random"> + <UniqueIdentifier>{8021a134-d200-4419-a9af-79c9330f7a50}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\shmem"> + <UniqueIdentifier>{5b36b756-ba67-41b3-82e8-19bf529b98e7}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\strings"> + <UniqueIdentifier>{4792d1b4-2348-4cdc-9ac0-eced0c1e658e}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\tables"> + <UniqueIdentifier>{bb1839cf-8ea0-43fd-a025-fe01e7ddd29e}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\threadproc"> + <UniqueIdentifier>{f9664d77-a9cb-4eb7-9f86-b81860e8eac8}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\time"> + <UniqueIdentifier>{5d888443-39c7-4937-aed7-f100b0efc8bc}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\user"> + <UniqueIdentifier>{01c1e6ed-56bc-4d03-a1fd-1671ca1c2d90}</UniqueIdentifier> + </Filter> + <Filter Include="Private Header Files"> + <UniqueIdentifier>{243e3b60-6f34-46d7-8ffb-18936f283239}</UniqueIdentifier> + </Filter> + <Filter Include="Public Header Files"> + <UniqueIdentifier>{77829670-aaa9-4ff9-af8e-62ba7f507e32}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\apr\atomic\win32\apr_atomic.c"> + <Filter>Source Files\atomic</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\dso\win32\dso.c"> + <Filter>Source Files\dso</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\file_io\unix\copy.c"> + <Filter>Source Files\file_io</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\file_io\win32\dir.c"> + <Filter>Source Files\file_io</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\file_io\unix\fileacc.c"> + <Filter>Source Files\file_io</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\file_io\win32\filedup.c"> + <Filter>Source Files\file_io</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\file_io\win32\filepath.c"> + <Filter>Source Files\file_io</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\file_io\unix\filepath_util.c"> + <Filter>Source Files\file_io</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\file_io\win32\filestat.c"> + <Filter>Source Files\file_io</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\file_io\win32\filesys.c"> + <Filter>Source Files\file_io</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\file_io\win32\flock.c"> + <Filter>Source Files\file_io</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\file_io\unix\fullrw.c"> + <Filter>Source Files\file_io</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\file_io\unix\mktemp.c"> + <Filter>Source Files\file_io</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\file_io\win32\open.c"> + <Filter>Source Files\file_io</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\file_io\win32\pipe.c"> + <Filter>Source Files\file_io</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\file_io\win32\readwrite.c"> + <Filter>Source Files\file_io</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\file_io\win32\seek.c"> + <Filter>Source Files\file_io</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\file_io\unix\tempdir.c"> + <Filter>Source Files\file_io</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\locks\win32\proc_mutex.c"> + <Filter>Source Files\locks</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\locks\win32\thread_cond.c"> + <Filter>Source Files\locks</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\locks\win32\thread_mutex.c"> + <Filter>Source Files\locks</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\locks\win32\thread_rwlock.c"> + <Filter>Source Files\locks</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\memory\unix\apr_pools.c"> + <Filter>Source Files\memory</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\misc\win32\charset.c"> + <Filter>Source Files\misc</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\misc\win32\env.c"> + <Filter>Source Files\misc</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\misc\unix\errorcodes.c"> + <Filter>Source Files\misc</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\misc\unix\getopt.c"> + <Filter>Source Files\misc</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\misc\win32\internal.c"> + <Filter>Source Files\misc</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\misc\win32\misc.c"> + <Filter>Source Files\misc</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\misc\unix\otherchild.c"> + <Filter>Source Files\misc</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\misc\win32\rand.c"> + <Filter>Source Files\misc</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\misc\win32\start.c"> + <Filter>Source Files\misc</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\misc\win32\utf8.c"> + <Filter>Source Files\misc</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\misc\unix\version.c"> + <Filter>Source Files\misc</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\mmap\unix\common.c"> + <Filter>Source Files\mmap</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\mmap\win32\mmap.c"> + <Filter>Source Files\mmap</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\network_io\unix\inet_ntop.c"> + <Filter>Source Files\network_io</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\network_io\unix\inet_pton.c"> + <Filter>Source Files\network_io</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\network_io\unix\multicast.c"> + <Filter>Source Files\network_io</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\poll\unix\select.c"> + <Filter>Source Files\network_io</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\network_io\win32\sendrecv.c"> + <Filter>Source Files\network_io</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\network_io\unix\sockaddr.c"> + <Filter>Source Files\network_io</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\network_io\win32\sockets.c"> + <Filter>Source Files\network_io</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\network_io\win32\sockopt.c"> + <Filter>Source Files\network_io</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\passwd\apr_getpass.c"> + <Filter>Source Files\passwd</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\random\unix\apr_random.c"> + <Filter>Source Files\random</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\random\unix\sha2.c"> + <Filter>Source Files\random</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\random\unix\sha2_glue.c"> + <Filter>Source Files\random</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\shmem\win32\shm.c"> + <Filter>Source Files\shmem</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\strings\apr_cpystrn.c"> + <Filter>Source Files\strings</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\strings\apr_fnmatch.c"> + <Filter>Source Files\strings</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\strings\apr_snprintf.c"> + <Filter>Source Files\strings</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\strings\apr_strings.c"> + <Filter>Source Files\strings</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\strings\apr_strnatcmp.c"> + <Filter>Source Files\strings</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\strings\apr_strtok.c"> + <Filter>Source Files\strings</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\tables\apr_hash.c"> + <Filter>Source Files\tables</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\tables\apr_tables.c"> + <Filter>Source Files\tables</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\threadproc\win32\proc.c"> + <Filter>Source Files\threadproc</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\threadproc\win32\signals.c"> + <Filter>Source Files\threadproc</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\threadproc\win32\thread.c"> + <Filter>Source Files\threadproc</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\threadproc\win32\threadpriv.c"> + <Filter>Source Files\threadproc</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\time\win32\access.c"> + <Filter>Source Files\time</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\time\win32\time.c"> + <Filter>Source Files\time</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\time\win32\timestr.c"> + <Filter>Source Files\time</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\user\win32\groupinfo.c"> + <Filter>Source Files\user</Filter> + </ClCompile> + <ClCompile Include="..\..\apr\user\win32\userinfo.c"> + <Filter>Source Files\user</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\apr\include\arch\win32\apr_arch_atime.h"> + <Filter>Private Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\arch\win32\apr_arch_dso.h"> + <Filter>Private Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\arch\win32\apr_arch_file_io.h"> + <Filter>Private Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\arch\win32\apr_arch_inherit.h"> + <Filter>Private Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\arch\win32\apr_arch_misc.h"> + <Filter>Private Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\arch\win32\apr_arch_networkio.h"> + <Filter>Private Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\arch\win32\apr_arch_thread_mutex.h"> + <Filter>Private Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\arch\win32\apr_arch_thread_rwlock.h"> + <Filter>Private Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\arch\win32\apr_arch_threadproc.h"> + <Filter>Private Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\arch\win32\apr_arch_utf8.h"> + <Filter>Private Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\arch\win32\apr_private.h"> + <Filter>Private Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\arch\apr_private_common.h"> + <Filter>Private Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_allocator.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_atomic.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_dso.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_env.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_errno.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_file_info.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_file_io.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_fnmatch.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_general.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_getopt.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_global_mutex.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_hash.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_inherit.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_lib.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_mmap.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_network_io.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_poll.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_pools.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_portable.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_proc_mutex.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_ring.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_shm.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_signal.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_strings.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_support.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_tables.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_thread_cond.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_thread_mutex.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_thread_proc.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_thread_rwlock.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_time.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_user.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_version.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\apr\include\apr_want.h"> + <Filter>Public Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="..\..\apr\libapr.rc" /> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/win32/celt/libcelt.vcxproj.filters b/libs/win32/celt/libcelt.vcxproj.filters new file mode 100644 index 0000000..f3cb02a --- /dev/null +++ b/libs/win32/celt/libcelt.vcxproj.filters @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\celt-0.7.1\libcelt\bands.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\celt-0.7.1\libcelt\celt.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\celt-0.7.1\libcelt\cwrs.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\celt-0.7.1\libcelt\entcode.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\celt-0.7.1\libcelt\entdec.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\celt-0.7.1\libcelt\entenc.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\celt-0.7.1\libcelt\header.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\celt-0.7.1\libcelt\kiss_fft.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\celt-0.7.1\libcelt\laplace.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\celt-0.7.1\libcelt\mdct.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\celt-0.7.1\libcelt\modes.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\celt-0.7.1\libcelt\pitch.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\celt-0.7.1\libcelt\quant_bands.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\celt-0.7.1\libcelt\rangedec.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\celt-0.7.1\libcelt\rangeenc.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\celt-0.7.1\libcelt\rate.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\celt-0.7.1\libcelt\vq.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/win32/curl/curllib.2010.vcxproj.filters b/libs/win32/curl/curllib.2010.vcxproj.filters new file mode 100644 index 0000000..5b35d44 --- /dev/null +++ b/libs/win32/curl/curllib.2010.vcxproj.filters @@ -0,0 +1,358 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{6b959500-cd81-4335-bdf2-c430b2f07328}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{ee1686be-f512-40e0-8f5e-76480b95aafc}</UniqueIdentifier> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{fd722a55-89b7-4153-9226-3eec445000d1}</UniqueIdentifier> + <Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\curl\lib\base64.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\connect.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\content_encoding.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\cookie.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\dict.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\easy.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\escape.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\file.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\formdata.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\ftp.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\getenv.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\getinfo.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\gtls.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\hash.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\hostares.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\hostasyn.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\hostip.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\hostip4.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\hostip6.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\hostsyn.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\hostthre.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\http.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\http_chunks.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\http_digest.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\http_negotiate.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\http_ntlm.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\if2ip.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\inet_ntop.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\inet_pton.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\krb4.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\ldap.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\llist.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\md5.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\memdebug.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\mprintf.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\multi.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\netrc.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\parsedate.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\progress.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\security.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\select.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\sendf.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\share.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\socks.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\speedcheck.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\splay.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\sslgen.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\ssluse.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\strequal.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\strerror.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\strtok.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\strtoofft.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\telnet.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\tftp.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\timeval.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\transfer.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\url.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\curl\lib\version.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\curl\lib\arpa_telnet.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\base64.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\ca-bundle.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\config-win32.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\connect.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\content_encoding.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\cookie.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\curlx.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\dict.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\easyif.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\escape.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\file.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\formdata.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\ftp.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\getinfo.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\gtls.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\hash.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\hostip.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\http.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\http_chunks.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\http_digest.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\http_negotiate.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\http_ntlm.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\if2ip.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\inet_ntoa_r.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\inet_ntop.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\inet_pton.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\krb4.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\ldap.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\llist.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\md5.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\memdebug.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\memory.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\multiif.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\netrc.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\parsedate.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\progress.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\select.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\sendf.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\setup.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\share.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\sockaddr.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\speedcheck.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\sslgen.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\ssluse.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\strequal.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\strerror.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\strtok.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\strtoofft.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\telnet.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\tftp.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\timeval.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\transfer.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\url.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\curl\lib\urldata.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/win32/flite/flite.2010.vcxproj.filters b/libs/win32/flite/flite.2010.vcxproj.filters new file mode 100644 index 0000000..6194dbb --- /dev/null +++ b/libs/win32/flite/flite.2010.vcxproj.filters @@ -0,0 +1,558 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + <Filter Include="sltvoice"> + <UniqueIdentifier>{2e2fca2e-fc24-48cd-bfa0-42ceb5aa5331}</UniqueIdentifier> + </Filter> + <Filter Include="awbvoice"> + <UniqueIdentifier>{58f041f5-13f9-4986-aa26-ab41db21c3b1}</UniqueIdentifier> + </Filter> + <Filter Include="rmsvoice"> + <UniqueIdentifier>{f4db3d58-e9d3-415a-ae41-cc3dd1012fc2}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\flite-1.3.99\src\audio\au_command.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\audio\au_none.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\audio\au_streaming.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\audio\au_wince.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\audio\audio.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\audio\auserver.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmulex\cmu_lex.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmulex\cmu_lex_data.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmulex\cmu_lex_entries.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmulex\cmu_lts_model.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmulex\cmu_lts_rules.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmulex\cmu_postlex.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_time_awb\cmu_time_awb.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_time_awb\cmu_time_awb_cart.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_time_awb\cmu_time_awb_clunits.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_time_awb\cmu_time_awb_lex_entry.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_time_awb\cmu_time_awb_lpc.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_time_awb\cmu_time_awb_mcep.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_us_kal\cmu_us_kal.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_us_kal\cmu_us_kal_diphone.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_us_kal\cmu_us_kal_lpc.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_us_kal\cmu_us_kal_res.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_us_kal\cmu_us_kal_residx.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\utils\cst_alloc.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\utils\cst_args.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\stats\cst_cart.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\cg\cst_cg.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\wavesynth\cst_clunits.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\wavesynth\cst_diphone.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\utils\cst_endian.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\utils\cst_error.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\utils\cst_features.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\hrg\cst_ffeature.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\synth\cst_ffeatures.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\utils\cst_file_stdio.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\hrg\cst_item.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\lexicon\cst_lexicon.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\speech\cst_lpcres.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\lexicon\cst_lts.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\lexicon\cst_lts_rewrites.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\cg\cst_mlpg.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\cg\cst_mlsa.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\utils\cst_mmap_win32.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\synth\cst_phoneset.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\wavesynth\cst_reflpc.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\regex\cst_regex.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\hrg\cst_rel_io.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\hrg\cst_relation.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\wavesynth\cst_sigpr.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\utils\cst_socket.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\stats\cst_ss.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\utils\cst_string.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\wavesynth\cst_sts.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\synth\cst_synth.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\utils\cst_tokenstream.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\speech\cst_track.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\speech\cst_track_io.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\wavesynth\cst_units.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\synth\cst_utt_utils.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\hrg\cst_utterance.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\utils\cst_val.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\utils\cst_val_const.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\utils\cst_val_user.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\cg\cst_vc.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\stats\cst_viterbi.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\synth\cst_voice.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\speech\cst_wave.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\speech\cst_wave_io.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\speech\cst_wave_utils.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\synth\flite.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\speech\rateconv.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\regex\regexp.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\src\regex\regsub.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\usenglish\us_aswd.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\usenglish\us_dur_stats.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\usenglish\us_durz_cart.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\usenglish\us_expand.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\usenglish\us_f0_model.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\usenglish\us_f0lr.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\usenglish\us_ffeatures.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\usenglish\us_gpos.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\usenglish\us_int_accent_cart.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\usenglish\us_int_tone_cart.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\usenglish\us_nums_cart.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\usenglish\us_phoneset.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\usenglish\us_phrasing_cart.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\usenglish\us_text.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\usenglish\usenglish.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_us_slt\cmu_us_slt.c"> + <Filter>sltvoice</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_us_slt\cmu_us_slt_cg.c"> + <Filter>sltvoice</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_us_slt\cmu_us_slt_cg_durmodel.c"> + <Filter>sltvoice</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_us_slt\cmu_us_slt_cg_f0_trees.c"> + <Filter>sltvoice</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_us_slt\cmu_us_slt_cg_mcep_trees.c"> + <Filter>sltvoice</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_us_slt\cmu_us_slt_cg_params.c"> + <Filter>sltvoice</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_us_slt\cmu_us_slt_cg_phonestate.c"> + <Filter>sltvoice</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_us_awb\cmu_us_awb.c"> + <Filter>awbvoice</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_us_awb\cmu_us_awb_cg.c"> + <Filter>awbvoice</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_us_awb\cmu_us_awb_cg_durmodel.c"> + <Filter>awbvoice</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_us_awb\cmu_us_awb_cg_f0_trees.c"> + <Filter>awbvoice</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_us_awb\cmu_us_awb_cg_mcep_trees.c"> + <Filter>awbvoice</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_us_awb\cmu_us_awb_cg_params.c"> + <Filter>awbvoice</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_us_awb\cmu_us_awb_cg_phonestate.c"> + <Filter>awbvoice</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_us_rms\cmu_us_rms.c"> + <Filter>rmsvoice</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_us_rms\cmu_us_rms_cg.c"> + <Filter>rmsvoice</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_us_rms\cmu_us_rms_cg_durmodel.c"> + <Filter>rmsvoice</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_us_rms\cmu_us_rms_cg_f0_trees.c"> + <Filter>rmsvoice</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_us_rms\cmu_us_rms_cg_mcep_trees.c"> + <Filter>rmsvoice</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_us_rms\cmu_us_rms_cg_params.c"> + <Filter>rmsvoice</Filter> + </ClCompile> + <ClCompile Include="..\..\flite-1.3.99\lang\cmu_us_rms\cmu_us_rms_cg_phonestate.c"> + <Filter>rmsvoice</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\flite-1.3.99\lang\cmulex\cmu_lts_model.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\lang\cmulex\cmulex.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_alloc.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_args.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_audio.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_cart.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_cg.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_clunits.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_diphone.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_endian.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_error.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_features.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_file.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_hrg.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_item.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_lexicon.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_lts.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_lts_rewrites.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_math.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\src\cg\cst_mlpg.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\src\cg\cst_mlsa.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_phoneset.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_regex.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_relation.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_sigpr.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_socket.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_ss.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_string.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_sts.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_synth.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_tokenstream.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_track.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_units.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_utt_utils.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_utterance.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_val.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_val_const.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_val_defs.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\src\cg\cst_vc.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_viterbi.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_voice.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\cst_wave.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\include\flite.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\src\audio\native_audio.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\lang\usenglish\us_durz_cart.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\lang\usenglish\us_f0.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\lang\usenglish\us_ffeatures.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\lang\usenglish\us_int_accent_cart.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\lang\usenglish\us_int_tone_cart.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\lang\usenglish\us_nums_cart.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\lang\usenglish\us_phrasing_cart.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\lang\usenglish\us_text.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\lang\usenglish\usenglish.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\lang\cmu_time_awb\voxdefs.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\lang\cmu_us_kal\voxdefs.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\lang\cmu_us_slt\cmu_us_slt_cg_durmodel.h"> + <Filter>sltvoice</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\lang\cmu_us_slt\cmu_us_slt_cg_f0_trees.h"> + <Filter>sltvoice</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\lang\cmu_us_slt\cmu_us_slt_cg_mcep_trees.h"> + <Filter>sltvoice</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\lang\cmu_us_slt\voxdefs.h"> + <Filter>sltvoice</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\lang\cmu_us_awb\cmu_us_awb_cg_durmodel.h"> + <Filter>awbvoice</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\lang\cmu_us_awb\cmu_us_awb_cg_f0_trees.h"> + <Filter>awbvoice</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\lang\cmu_us_awb\cmu_us_awb_cg_mcep_trees.h"> + <Filter>awbvoice</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\lang\cmu_us_awb\voxdefs.h"> + <Filter>awbvoice</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\lang\cmu_us_rms\cmu_us_rms_cg_durmodel.h"> + <Filter>rmsvoice</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\lang\cmu_us_rms\cmu_us_rms_cg_f0_trees.h"> + <Filter>rmsvoice</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\lang\cmu_us_rms\cmu_us_rms_cg_mcep_trees.h"> + <Filter>rmsvoice</Filter> + </ClInclude> + <ClInclude Include="..\..\flite-1.3.99\lang\cmu_us_rms\voxdefs.h"> + <Filter>rmsvoice</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/win32/iksemel/iksemel.2010.vcxproj.filters b/libs/win32/iksemel/iksemel.2010.vcxproj.filters new file mode 100644 index 0000000..27382de --- /dev/null +++ b/libs/win32/iksemel/iksemel.2010.vcxproj.filters @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\iksemel\src\base64.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\iksemel\src\dom.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\iksemel\src\filter.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\iksemel\src\iks.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\iksemel\src\ikstack.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\iksemel\src\io-posix.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\iksemel\src\jabber.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\iksemel\src\md5.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\iksemel\src\sax.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\iksemel\src\sha.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\iksemel\src\stream.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\iksemel\src\utility.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\iksemel\include\common.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\iksemel\include\config.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\iksemel\include\finetune.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\iksemel\include\iksemel.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/win32/js/js.2010.vcxproj.filters b/libs/win32/js/js.2010.vcxproj.filters new file mode 100644 index 0000000..11d8e76 --- /dev/null +++ b/libs/win32/js/js.2010.vcxproj.filters @@ -0,0 +1,464 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4f5946e3-6061-45f6-aabc-3cfadc4ad060}</UniqueIdentifier> + <Extensions>cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{90b839f0-4610-43e4-9fb3-0aa74394976d}</UniqueIdentifier> + </Filter> + <Filter Include="NSPR Source"> + <UniqueIdentifier>{c637d4b7-47bc-497a-b85e-becc3e2eb4ae}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\js\src\fdlibm\e_acos.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\e_acosh.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\e_asin.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\e_atan2.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\e_atanh.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\e_cosh.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\e_exp.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\e_fmod.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\e_gamma.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\e_gamma_r.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\e_hypot.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\e_j0.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\e_j1.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\e_jn.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\e_lgamma.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\e_lgamma_r.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\e_log.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\e_log10.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\e_pow.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\e_rem_pio2.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\e_remainder.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\e_scalb.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\e_sinh.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\e_sqrt.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jsapi.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jsarena.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jsarray.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jsatom.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jsbool.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jscntxt.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jsdate.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jsdbgapi.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jsdhash.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jsdso.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jsdtoa.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jsemit.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jsexn.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jsfile.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jsfun.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jsgc.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jshash.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jsinterp.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jslock.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jslog2.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jslong.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jsmath.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jsnum.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jsobj.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jsopcode.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jsparse.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jsprf.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jsregexp.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jsscan.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jsscope.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jsscript.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jsstr.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jsutil.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jsxdrapi.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\jsxml.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\k_cos.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\k_rem_pio2.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\k_sin.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\k_standard.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\k_tan.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\prmjtime.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\s_asinh.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\s_atan.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\s_cbrt.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\s_ceil.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\s_copysign.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\s_cos.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\s_erf.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\s_expm1.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\s_fabs.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\s_finite.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\s_floor.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\s_frexp.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\s_ilogb.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\s_isnan.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\s_ldexp.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\s_lib_version.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\s_log1p.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\s_logb.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\s_matherr.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\s_modf.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\s_nextafter.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\s_rint.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\s_scalbn.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\s_signgam.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\s_significand.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\s_sin.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\s_tan.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\s_tanh.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\w_acos.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\w_acosh.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\w_asin.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\w_atan2.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\w_atanh.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\w_cosh.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\w_exp.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\w_fmod.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\w_gamma.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\w_gamma_r.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\w_hypot.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\w_j0.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\w_j1.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\w_jn.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\w_lgamma.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\w_lgamma_r.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\w_log.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\w_log10.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\w_pow.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\w_remainder.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\w_scalb.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\w_sinh.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\src\fdlibm\w_sqrt.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\md\windows\ntinrval.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\md\windows\ntio.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\md\windows\ntmisc.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\md\windows\ntsec.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\md\windows\ntthread.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\misc\pratom.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\threads\prcthr.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\io\prdir.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\misc\prerror.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\io\prfdcach.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\io\prfile.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\misc\prinit.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\misc\prinrval.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\io\prio.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\io\priometh.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\io\prlayer.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\io\prlog.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\malloc\prmem.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\io\prmmap.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\io\prmwait.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\misc\prolock.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\md\prosdep.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\io\prprf.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\memory\prseg.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\misc\prtime.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\threads\prtpd.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\threads\combined\prucpu.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\threads\combined\prucv.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\threads\combined\prulock.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\threads\combined\prustack.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\threads\combined\pruthr.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\md\windows\w32poll.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + <ClCompile Include="..\..\js\nsprpub\pr\src\md\windows\win32_errors.c"> + <Filter>NSPR Source</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/win32/json/libjson.2010.vcxproj.filters b/libs/win32/json/libjson.2010.vcxproj.filters new file mode 100644 index 0000000..9de2aac --- /dev/null +++ b/libs/win32/json/libjson.2010.vcxproj.filters @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\json-c-0.9\arraylist.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\json-c-0.9\debug.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\json-c-0.9\json_object.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\json-c-0.9\json_tokener.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\json-c-0.9\json_util.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\json-c-0.9\linkhash.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\json-c-0.9\printbuf.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="config.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/win32/libg722_1/libg722_1.vcxproj.filters b/libs/win32/libg722_1/libg722_1.vcxproj.filters new file mode 100644 index 0000000..855a60f --- /dev/null +++ b/libs/win32/libg722_1/libg722_1.vcxproj.filters @@ -0,0 +1,96 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\libg722_1\src\basop32.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libg722_1\src\bitstream.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libg722_1\src\coef2sam.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libg722_1\src\common.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libg722_1\src\commonf.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libg722_1\src\dct4.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libg722_1\src\dct4_a.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libg722_1\src\dct4_s.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libg722_1\src\decoder.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libg722_1\src\decoderf.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libg722_1\src\encoder.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libg722_1\src\encoderf.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libg722_1\src\huff_tab.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libg722_1\src\sam2coef.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libg722_1\src\tables.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\libg722_1\src\basop32.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\libg722_1\src\bitstream.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\libg722_1\src\coef2sam.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\libg722_1\src\dct4.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\libg722_1\src\dct4_a.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\libg722_1\src\dct4_s.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\libg722_1\src\defs.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\libg722_1\src\huff_tab.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\libg722_1\src\sam2coef.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\libg722_1\src\tables.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/win32/libmp3lame/libmp3lame.2010.vcxproj.filters b/libs/win32/libmp3lame/libmp3lame.2010.vcxproj.filters new file mode 100644 index 0000000..227b929 --- /dev/null +++ b/libs/win32/libmp3lame/libmp3lame.2010.vcxproj.filters @@ -0,0 +1,170 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source"> + <UniqueIdentifier>{f5641aca-51aa-43fe-94f1-8a3463d81fd2}</UniqueIdentifier> + <Extensions>c</Extensions> + </Filter> + <Filter Include="Include"> + <UniqueIdentifier>{35db8916-1b8b-4072-9a38-f62167263222}</UniqueIdentifier> + <Extensions>h</Extensions> + </Filter> + <Filter Include="Asm"> + <UniqueIdentifier>{644a1cf1-f43b-4bd7-9e99-17500205a788}</UniqueIdentifier> + <Extensions>.nas</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\lame-3.97\libmp3lame\bitstream.c"> + <Filter>Source</Filter> + </ClCompile> + <ClCompile Include="..\..\lame-3.97\libmp3lame\encoder.c"> + <Filter>Source</Filter> + </ClCompile> + <ClCompile Include="..\..\lame-3.97\libmp3lame\fft.c"> + <Filter>Source</Filter> + </ClCompile> + <ClCompile Include="..\..\lame-3.97\libmp3lame\gain_analysis.c"> + <Filter>Source</Filter> + </ClCompile> + <ClCompile Include="..\..\lame-3.97\libmp3lame\id3tag.c"> + <Filter>Source</Filter> + </ClCompile> + <ClCompile Include="..\..\lame-3.97\libmp3lame\lame.c"> + <Filter>Source</Filter> + </ClCompile> + <ClCompile Include="..\..\lame-3.97\libmp3lame\mpglib_interface.c"> + <Filter>Source</Filter> + </ClCompile> + <ClCompile Include="..\..\lame-3.97\libmp3lame\newmdct.c"> + <Filter>Source</Filter> + </ClCompile> + <ClCompile Include="..\..\lame-3.97\libmp3lame\presets.c"> + <Filter>Source</Filter> + </ClCompile> + <ClCompile Include="..\..\lame-3.97\libmp3lame\psymodel.c"> + <Filter>Source</Filter> + </ClCompile> + <ClCompile Include="..\..\lame-3.97\libmp3lame\quantize.c"> + <Filter>Source</Filter> + </ClCompile> + <ClCompile Include="..\..\lame-3.97\libmp3lame\quantize_pvt.c"> + <Filter>Source</Filter> + </ClCompile> + <ClCompile Include="..\..\lame-3.97\libmp3lame\reservoir.c"> + <Filter>Source</Filter> + </ClCompile> + <ClCompile Include="..\..\lame-3.97\libmp3lame\set_get.c"> + <Filter>Source</Filter> + </ClCompile> + <ClCompile Include="..\..\lame-3.97\libmp3lame\tables.c"> + <Filter>Source</Filter> + </ClCompile> + <ClCompile Include="..\..\lame-3.97\libmp3lame\takehiro.c"> + <Filter>Source</Filter> + </ClCompile> + <ClCompile Include="..\..\lame-3.97\libmp3lame\util.c"> + <Filter>Source</Filter> + </ClCompile> + <ClCompile Include="..\..\lame-3.97\libmp3lame\vbrquantize.c"> + <Filter>Source</Filter> + </ClCompile> + <ClCompile Include="..\..\lame-3.97\libmp3lame\VbrTag.c"> + <Filter>Source</Filter> + </ClCompile> + <ClCompile Include="..\..\lame-3.97\libmp3lame\version.c"> + <Filter>Source</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\lame-3.97\libmp3lame\bitstream.h"> + <Filter>Include</Filter> + </ClInclude> + <ClInclude Include="..\..\lame-3.97\libmp3lame\encoder.h"> + <Filter>Include</Filter> + </ClInclude> + <ClInclude Include="..\..\lame-3.97\libmp3lame\fft.h"> + <Filter>Include</Filter> + </ClInclude> + <ClInclude Include="..\..\lame-3.97\libmp3lame\gain_analysis.h"> + <Filter>Include</Filter> + </ClInclude> + <ClInclude Include="..\..\lame-3.97\libmp3lame\id3tag.h"> + <Filter>Include</Filter> + </ClInclude> + <ClInclude Include="..\..\lame-3.97\libmp3lame\l3side.h"> + <Filter>Include</Filter> + </ClInclude> + <ClInclude Include="..\..\lame-3.97\libmp3lame\lame-analysis.h"> + <Filter>Include</Filter> + </ClInclude> + <ClInclude Include="..\..\lame-3.97\libmp3lame\lame_global_flags.h"> + <Filter>Include</Filter> + </ClInclude> + <ClInclude Include="..\..\lame-3.97\libmp3lame\lameerror.h"> + <Filter>Include</Filter> + </ClInclude> + <ClInclude Include="..\..\lame-3.97\libmp3lame\machine.h"> + <Filter>Include</Filter> + </ClInclude> + <ClInclude Include="..\..\lame-3.97\libmp3lame\newmdct.h"> + <Filter>Include</Filter> + </ClInclude> + <ClInclude Include="..\..\lame-3.97\libmp3lame\psymodel.h"> + <Filter>Include</Filter> + </ClInclude> + <ClInclude Include="..\..\lame-3.97\libmp3lame\quantize.h"> + <Filter>Include</Filter> + </ClInclude> + <ClInclude Include="..\..\lame-3.97\libmp3lame\quantize_pvt.h"> + <Filter>Include</Filter> + </ClInclude> + <ClInclude Include="..\..\lame-3.97\libmp3lame\reservoir.h"> + <Filter>Include</Filter> + </ClInclude> + <ClInclude Include="..\..\lame-3.97\libmp3lame\set_get.h"> + <Filter>Include</Filter> + </ClInclude> + <ClInclude Include="..\..\lame-3.97\libmp3lame\tables.h"> + <Filter>Include</Filter> + </ClInclude> + <ClInclude Include="..\..\lame-3.97\libmp3lame\util.h"> + <Filter>Include</Filter> + </ClInclude> + <ClInclude Include="..\..\lame-3.97\libmp3lame\vbrquantize.h"> + <Filter>Include</Filter> + </ClInclude> + <ClInclude Include="..\..\lame-3.97\libmp3lame\VbrTag.h"> + <Filter>Include</Filter> + </ClInclude> + <ClInclude Include="..\..\lame-3.97\libmp3lame\version.h"> + <Filter>Include</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <None Include="..\..\lame-3.97\libmp3lame\i386\choose_table.nas"> + <Filter>Asm</Filter> + </None> + <None Include="..\..\lame-3.97\libmp3lame\i386\cpu_feat.nas"> + <Filter>Asm</Filter> + </None> + <None Include="..\..\lame-3.97\libmp3lame\i386\fft.nas"> + <Filter>Asm</Filter> + </None> + <None Include="..\..\lame-3.97\libmp3lame\i386\fft3dn.nas"> + <Filter>Asm</Filter> + </None> + <None Include="..\..\lame-3.97\libmp3lame\i386\fftfpu.nas"> + <Filter>Asm</Filter> + </None> + <None Include="..\..\lame-3.97\libmp3lame\i386\fftsse.nas"> + <Filter>Asm</Filter> + </None> + <None Include="..\..\lame-3.97\libmp3lame\i386\ffttbl.nas"> + <Filter>Asm</Filter> + </None> + <None Include="..\..\lame-3.97\libmp3lame\i386\scalar.nas"> + <Filter>Asm</Filter> + </None> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/win32/libogg/libogg.2010.vcxproj.filters b/libs/win32/libogg/libogg.2010.vcxproj.filters new file mode 100644 index 0000000..e769aa6 --- /dev/null +++ b/libs/win32/libogg/libogg.2010.vcxproj.filters @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{34e81afc-61be-40dc-b978-f4e20b9b1236}</UniqueIdentifier> + <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{acd20529-ba9d-4ef9-8dc6-0c785bf72394}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\libogg-1.1.3\src\bitwise.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libogg-1.1.3\src\framing.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\libogg-1.1.3\include\ogg\ogg.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\libogg-1.1.3\include\ogg\os_types.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/win32/libshout/libshout.vcxproj.filters b/libs/win32/libshout/libshout.vcxproj.filters new file mode 100644 index 0000000..f1af2b8 --- /dev/null +++ b/libs/win32/libshout/libshout.vcxproj.filters @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{c5227c05-bf9f-4a66-ae51-1e89ddd05771}</UniqueIdentifier> + <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{ad7c320d-bfd2-4415-9e03-bb2000ab2c7c}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\libshout-2.2.2\src\avl\avl.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libshout-2.2.2\src\httpp\httpp.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libshout-2.2.2\src\mp3.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libshout-2.2.2\src\ogg.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libshout-2.2.2\src\net\resolver.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libshout-2.2.2\src\shout.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libshout-2.2.2\src\net\sock.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libshout-2.2.2\src\thread\thread.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libshout-2.2.2\src\timing\timing.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libshout-2.2.2\src\util.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\libshout-2.2.2\src\avl\avl.h"> + <Filter>Source Files</Filter> + </ClInclude> + <ClInclude Include="..\..\libshout-2.2.2\src\httpp\httpp.h"> + <Filter>Source Files</Filter> + </ClInclude> + <ClInclude Include="..\..\libshout-2.2.2\src\net\resolver.h"> + <Filter>Source Files</Filter> + </ClInclude> + <ClInclude Include="..\..\libshout-2.2.2\src\shout_ogg.h"> + <Filter>Source Files</Filter> + </ClInclude> + <ClInclude Include="..\..\libshout-2.2.2\src\shout_private.h"> + <Filter>Source Files</Filter> + </ClInclude> + <ClInclude Include="..\..\libshout-2.2.2\src\net\sock.h"> + <Filter>Source Files</Filter> + </ClInclude> + <ClInclude Include="..\..\libshout-2.2.2\src\thread\thread.h"> + <Filter>Source Files</Filter> + </ClInclude> + <ClInclude Include="..\..\libshout-2.2.2\src\timing\timing.h"> + <Filter>Source Files</Filter> + </ClInclude> + <ClInclude Include="..\..\libshout-2.2.2\src\util.h"> + <Filter>Source Files</Filter> + </ClInclude> + <ClInclude Include="..\..\libshout-2.2.2\include\os.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="shout\shout.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/win32/libsndfile/libsndfile.2010.vcxproj.filters b/libs/win32/libsndfile/libsndfile.2010.vcxproj.filters new file mode 100644 index 0000000..f16a39b --- /dev/null +++ b/libs/win32/libsndfile/libsndfile.2010.vcxproj.filters @@ -0,0 +1,234 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Source Files\GSM Sources"> + <UniqueIdentifier>{b116d731-aba1-4ebd-928f-51113eb4c45b}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\G72X Sources"> + <UniqueIdentifier>{e24785ab-1f78-4bb6-98f3-6c4586e85648}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\libsndfile\src\aiff.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\alaw.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\au.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\audio_detect.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\avr.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\broadcast.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\caf.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\chunk.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\command.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\common.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\dither.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\double64.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\dwd.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\dwvw.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\file_io.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\flac.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\float32.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\g72x.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\gsm610.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\htk.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\ima_adpcm.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\ima_oki_adpcm.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\ircam.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\mat4.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\mat5.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\mpc2k.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\ms_adpcm.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\nist.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\ogg.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\paf.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\pcm.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\pvf.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\raw.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\rf64.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\rx2.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\sd2.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\sds.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\sndfile.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\strings.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\svx.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\txw.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\ulaw.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\voc.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\vox_adpcm.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\w64.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\wav.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\wav_w64.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\wve.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\xi.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\GSM610\add.c"> + <Filter>Source Files\GSM Sources</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\GSM610\code.c"> + <Filter>Source Files\GSM Sources</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\GSM610\decode.c"> + <Filter>Source Files\GSM Sources</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\GSM610\gsm_create.c"> + <Filter>Source Files\GSM Sources</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\GSM610\gsm_decode.c"> + <Filter>Source Files\GSM Sources</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\GSM610\gsm_destroy.c"> + <Filter>Source Files\GSM Sources</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\GSM610\gsm_encode.c"> + <Filter>Source Files\GSM Sources</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\GSM610\gsm_option.c"> + <Filter>Source Files\GSM Sources</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\GSM610\long_term.c"> + <Filter>Source Files\GSM Sources</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\GSM610\lpc.c"> + <Filter>Source Files\GSM Sources</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\GSM610\preprocess.c"> + <Filter>Source Files\GSM Sources</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\GSM610\rpe.c"> + <Filter>Source Files\GSM Sources</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\GSM610\short_term.c"> + <Filter>Source Files\GSM Sources</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\GSM610\table.c"> + <Filter>Source Files\GSM Sources</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\G72x\g721.c"> + <Filter>Source Files\G72X Sources</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\G72x\g723_16.c"> + <Filter>Source Files\G72X Sources</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\G72x\g723_24.c"> + <Filter>Source Files\G72X Sources</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\G72x\g723_40.c"> + <Filter>Source Files\G72X Sources</Filter> + </ClCompile> + <ClCompile Include="..\..\libsndfile\src\G72x\g72x.c"> + <Filter>Source Files\G72X Sources</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\libsndfile\src\ima_oki_adpcm.h"> + <Filter>Source Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/win32/mpg123/libmpg123.2010.vcxproj.filters b/libs/win32/mpg123/libmpg123.2010.vcxproj.filters new file mode 100644 index 0000000..c2b9a2a --- /dev/null +++ b/libs/win32/mpg123/libmpg123.2010.vcxproj.filters @@ -0,0 +1,82 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\mpg123\src\libmpg123\compat.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\mpg123\src\libmpg123\dct64.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\mpg123\src\libmpg123\decode.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\mpg123\src\libmpg123\decode_2to1.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\mpg123\src\libmpg123\decode_4to1.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\mpg123\src\libmpg123\decode_ntom.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\mpg123\src\libmpg123\equalizer.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\mpg123\src\libmpg123\format.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\mpg123\src\libmpg123\frame.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\mpg123\src\libmpg123\icy.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\mpg123\src\libmpg123\icy2utf8.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\mpg123\src\libmpg123\id3.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\mpg123\src\libmpg123\layer1.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\mpg123\src\libmpg123\layer2.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\mpg123\src\libmpg123\layer3.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\mpg123\src\libmpg123\libmpg123.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\mpg123\src\libmpg123\optimize.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\mpg123\src\libmpg123\parse.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\mpg123\src\libmpg123\readers.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\mpg123\src\libmpg123\stringbuf.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\mpg123\src\libmpg123\tabinit.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/win32/pcre/libpcre.2010.vcxproj.filters b/libs/win32/pcre/libpcre.2010.vcxproj.filters new file mode 100644 index 0000000..60add32 --- /dev/null +++ b/libs/win32/pcre/libpcre.2010.vcxproj.filters @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{427b94c9-e678-4d0c-8c16-37276afbfc94}</UniqueIdentifier> + <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{5df91abd-8f03-4e8f-87ca-23fd510a729c}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="pcre_chartables.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pcre\pcre_compile.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pcre\pcre_config.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pcre\pcre_dfa_exec.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pcre\pcre_exec.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pcre\pcre_fullinfo.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pcre\pcre_get.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pcre\pcre_globals.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pcre\pcre_info.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pcre\pcre_maketables.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pcre\pcre_ord2utf8.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pcre\pcre_refcount.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pcre\pcre_study.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pcre\pcre_tables.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pcre\pcre_try_flipped.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pcre\pcre_newline.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pcre\pcre_ucd.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pcre\pcre_ucp_searchfuncs.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pcre\pcre_valid_utf8.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pcre\pcre_version.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pcre\pcre_xclass.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="config.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pcre\internal.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pcre\pcre.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pcre\pcre_internal.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pcre\pcreposix.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/win32/pcre/pcre_chartables.c.2010.vcxproj.filters b/libs/win32/pcre/pcre_chartables.c.2010.vcxproj.filters new file mode 100644 index 0000000..1cfff05 --- /dev/null +++ b/libs/win32/pcre/pcre_chartables.c.2010.vcxproj.filters @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="dftables.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/win32/pocketsphinx/pocketsphinx.2010.vcxproj.filters b/libs/win32/pocketsphinx/pocketsphinx.2010.vcxproj.filters new file mode 100644 index 0000000..777ce4c --- /dev/null +++ b/libs/win32/pocketsphinx/pocketsphinx.2010.vcxproj.filters @@ -0,0 +1,217 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Header Files"> + <UniqueIdentifier>{30a9f269-d81a-4ee2-adf0-8b402eb80fec}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files"> + <UniqueIdentifier>{d54e4410-06e1-4361-b050-7aced67dff22}</UniqueIdentifier> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{ebcc7cb5-8ca2-489c-b0e8-426058856ac8}</UniqueIdentifier> + <Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\acmod.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\bin_mdef.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\blkarray_list.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\cmdln_macro.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\cmu6_lts_rules.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\dict.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\dict2pid.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\fillpen.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\fsg_history.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\fsg_lextree.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\fsg_search_internal.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\fsg_set.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\hmm.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\kdtree.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\lextree.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\mdef.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\ms_gauden.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\ms_mgau.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\ms_senone.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\ngram_search.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\ngram_search_fwdflat.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\ngram_search_fwdtree.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\phone_loop_search.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\..\include\pocketsphinx.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\include\pocketsphinx.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\include\pocketsphinx_export.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\pocketsphinx_internal.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\posixwin32.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\ps_lattice.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\ps_lattice_internal.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\include\ps_mllr.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\s2_semi_mgau.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\s3dict.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\tmat.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\tst_search.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\vector.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\vithist.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\acmod.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\bin_mdef.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\blkarray_list.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\cmu6_lts_rules.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\dict2pid.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\fillpen.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\fsg_history.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\fsg_lextree.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\fsg_search.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\hmm.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\kdtree.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\lextree.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\mdef.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\ms_gauden.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\ms_mgau.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\ms_senone.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\ngram_search.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\ngram_search_fwdflat.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\ngram_search_fwdtree.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\phone_loop_search.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\pocketsphinx.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\ps_lattice.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\ps_mllr.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\s2_semi_mgau.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\s3dict.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\tmat.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\tst_search.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\vector.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\vithist.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/win32/pthread/pthread.2010.vcxproj.filters b/libs/win32/pthread/pthread.2010.vcxproj.filters new file mode 100644 index 0000000..21e7edf --- /dev/null +++ b/libs/win32/pthread/pthread.2010.vcxproj.filters @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{eea9b312-399b-4998-b90c-92abe8150466}</UniqueIdentifier> + <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{4fdd54b4-c31e-45b5-9b1a-09740020ae6f}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{d9df37d7-2c75-4916-bd8d-68f96aca4677}</UniqueIdentifier> + <Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\pthreads-w32-2-7-0-release\pthread.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\pthreads-w32-2-7-0-release\implement.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pthreads-w32-2-7-0-release\pthread.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pthreads-w32-2-7-0-release\sched.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\pthreads-w32-2-7-0-release\semaphore.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="..\..\pthreads-w32-2-7-0-release\version.rc"> + <Filter>Resource Files</Filter> + </ResourceCompile> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/win32/sphinxbase/sphinxbase.2010.vcxproj.filters b/libs/win32/sphinxbase/sphinxbase.2010.vcxproj.filters new file mode 100644 index 0000000..d845059 --- /dev/null +++ b/libs/win32/sphinxbase/sphinxbase.2010.vcxproj.filters @@ -0,0 +1,354 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{5ce23960-a856-416b-a477-cf2d724bd43e}</UniqueIdentifier> + <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{8d90e900-0942-4a25-b48a-b8dcd4382c28}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{cd06b891-4b88-427f-9f62-187bfead9b0f}</UniqueIdentifier> + <Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\feat\agc.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\bio.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\bitvec.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\blas_lite.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\case.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\ckd_alloc.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\cmd_ln.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\feat\cmn.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\feat\cmn_prior.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxad\cont_ad_base.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\dtoa.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\err.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\f2c_lite.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\fe\fe_interface.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\fe\fe_sigproc.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\fe\fe_warp.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\fe\fe_warp_affine.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\fe\fe_warp_inverse_linear.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\fe\fe_warp_piecewise_linear.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\feat\feat.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\filename.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\fe\fixlog.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\lm\fsg_model.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\genrand.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\glist.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\hash_table.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\heap.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\info.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\lm\jsgf.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\lm\jsgf_parser.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\lm\jsgf_scanner.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\feat\lda.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\listelem_alloc.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\lm\lm3g_model.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\logmath.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\matrix.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\mmio.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\lm\ngram_model.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\lm\ngram_model_arpa.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\lm\ngram_model_dmp.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\lm\ngram_model_dmp32.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\lm\ngram_model_set.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\pio.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxad\play_win32.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\profile.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxad\rec_win32.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\sbthread.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\slamch.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\slapack_lite.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\strfuncs.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\util\unlimit.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\fe\yin.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\ad.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\agc.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\bio.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\bitvec.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\byteorder.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\case.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\ckd_alloc.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\clapack_lite.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\cmd_ln.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\cmn.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\win32\config.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\cont_ad.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\err.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\f2c.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\fe.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\fe\fe_internal.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\fe\fe_warp.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\fe\fe_warp_affine.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\fe\fe_warp_inverse_linear.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\fe\fe_warp_piecewise_linear.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\feat.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\filename.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\fixpoint.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\fsg_model.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\gau_cb.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\gau_cb_float64.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\gau_cb_int32.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\gau_file.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\gau_mix.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\genrand.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\glist.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\hash_table.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\heap.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\info.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\lm\jsgf_internal.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\lm\jsgf_parser.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\lm\jsgf_scanner.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\libutil.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\listelem_alloc.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\lm\lm3g_model.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\logmath.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\matrix.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\mmio.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\mulaw.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\ngram_model.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\lm\ngram_model_arpa.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\lm\ngram_model_dmp.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\lm\ngram_model_internal.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\src\libsphinxbase\lm\ngram_model_set.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\pio.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\prim_type.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\profile.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\s3_arraylist.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\win32\sphinx_config.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\sphinx_types.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\sphinxbase_export.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\strfuncs.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\unlimit.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sphinxbase-0.4.99\include\yin.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/win32/sqlite/sqlite.2010.vcxproj.filters b/libs/win32/sqlite/sqlite.2010.vcxproj.filters new file mode 100644 index 0000000..1b56bcf --- /dev/null +++ b/libs/win32/sqlite/sqlite.2010.vcxproj.filters @@ -0,0 +1,182 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\sqlite\src\alter.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\analyze.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\attach.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\auth.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\btree.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\build.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\callback.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\complete.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\date.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\delete.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\expr.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\func.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\hash.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\insert.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\legacy.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\loadext.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\main.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="opcodes.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\os.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\os_unix.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\os_win.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\pager.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="parse.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\pragma.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\prepare.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\printf.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\random.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\select.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\shell.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\table.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\tokenize.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\trigger.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\update.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\utf.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\util.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\vacuum.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\vdbe.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\vdbeapi.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\vdbeaux.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\vdbefifo.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\vdbemem.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\vtab.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\sqlite\src\where.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\sqlite\src\btree.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sqlite\src\hash.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="keywordhash.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="opcodes.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sqlite\src\os.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sqlite\src\os_common.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sqlite\src\pager.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="parse.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="sqlite3.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sqlite\src\sqliteInt.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sqlite\src\vdbe.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\sqlite\src\vdbeInt.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/win32/udns/libudns.2010.vcxproj.filters b/libs/win32/udns/libudns.2010.vcxproj.filters new file mode 100644 index 0000000..f4e9018 --- /dev/null +++ b/libs/win32/udns/libudns.2010.vcxproj.filters @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\udns\inet_pton.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\udns\udns_bl.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\udns\udns_codes.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\udns\udns_dn.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\udns\udns_dntosp.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\udns\udns_misc.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\udns\udns_parse.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\udns\udns_resolver.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\udns\udns_rr_a.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\udns\udns_rr_mx.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\udns\udns_rr_naptr.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\udns\udns_rr_ptr.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\udns\udns_rr_srv.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\..\udns\udns_rr_txt.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\udns\inet_pton.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/xmlrpc-c/Windows/abyss.2010.vcxproj.filters b/libs/xmlrpc-c/Windows/abyss.2010.vcxproj.filters new file mode 100644 index 0000000..63a3cb3 --- /dev/null +++ b/libs/xmlrpc-c/Windows/abyss.2010.vcxproj.filters @@ -0,0 +1,131 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{8ac4971f-a9ba-4930-a7e3-b291ad24d6ca}</UniqueIdentifier> + <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{05489d43-6c6b-4bb8-95db-414e8137ee9e}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\lib\abyss\src\channel.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\abyss\src\chanswitch.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\abyss\src\conf.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\abyss\src\conn.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\abyss\src\data.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\abyss\src\date.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\abyss\src\file.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\abyss\src\handler.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\abyss\src\http.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\abyss\src\init.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\abyss\src\response.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\abyss\src\server.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\abyss\src\session.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\abyss\src\socket.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\abyss\src\socket_openssl.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\abyss\src\socket_unix.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\abyss\src\socket_win.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\abyss\src\thread_fork.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\abyss\src\thread_pthread.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\abyss\src\thread_windows.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\abyss\src\token.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\abyss\src\trace.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\lib\abyss\src\abyss_info.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\abyss\src\channel.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\abyss\src\chanswitch.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\abyss\src\conn.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\abyss\src\data.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\abyss\src\date.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\abyss\src\file.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\abyss\src\handler.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\abyss\src\http.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\abyss\src\server.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\abyss\src\session.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\abyss\src\socket.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\abyss\src\socket_win.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\abyss\src\thread.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\abyss\src\token.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\abyss\src\trace.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/xmlrpc-c/Windows/xmlrpc.2010.vcxproj.filters b/libs/xmlrpc-c/Windows/xmlrpc.2010.vcxproj.filters new file mode 100644 index 0000000..6886dfe --- /dev/null +++ b/libs/xmlrpc-c/Windows/xmlrpc.2010.vcxproj.filters @@ -0,0 +1,287 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{7ca2b8b9-bf59-4407-aedf-588e548fe34a}</UniqueIdentifier> + <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;cc</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{28891c93-973b-487f-a8f9-3fae090e14e3}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\lib\libutil\asprintf.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\double.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\libutil\error.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\libutil\make_printable.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\libutil\memblock.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\method.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\parse_value.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\util\pthreadx_win32.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\registry.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\resource.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\libutil\select.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\libutil\sleep.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\system_method.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\libutil\time.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\trace.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\libutil\utf8.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\version.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\xmlrpc_array.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\xmlrpc_authcookie.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\xmlrpc_base64.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\xmlrpc_build.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\xmlrpc_client.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\xmlrpc_client_global.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\curl_transport\xmlrpc_curl_transport.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\xmlrpc_data.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\xmlrpc_datetime.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\xmlrpc_decompose.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\xmlrpc_expat.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\xmlrpc_libxml2.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\xmlrpc_parse.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\xmlrpc_serialize.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\xmlrpc_server_abyss.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\xmlrpc_server_info.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\xmlrpc_server_w32httpsys.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\xmlrpc_string.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\src\xmlrpc_struct.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\lib\wininet_transport\xmlrpc_wininet_transport.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\include\xmlrpc-c\abyss.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\abyss\src\abyss_info.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\xmlrpc-c\abyss_winsock.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\xmlrpc-c\base.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\xmlrpc-c\base_int.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\util\include\bool.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\xmlrpc-c\c_util.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\util\include\c_util.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\util\include\casprintf.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\abyss\src\channel.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\abyss\src\chanswitch.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\xmlrpc-c\client.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\xmlrpc-c\client_global.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\xmlrpc-c\client_int.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\xmlrpc-c\config.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\abyss\src\conn.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\abyss\src\date.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\src\double.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\abyss\src\file.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\util\include\girmath.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\abyss\src\handler.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\abyss\src\http.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\util\include\inline.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\util\include\linklist.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\util\include\mallocvar.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\src\method.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\src\parse_value.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\util\include\pthreadx.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\src\registry.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\abyss\src\server.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\xmlrpc-c\server.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\xmlrpc-c\server_abyss.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\xmlrpc-c\server_cgi.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\xmlrpc-c\server_w32httpsys.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\xmlrpc-c\sleep_int.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\abyss\src\socket.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\abyss\src\socket_win.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\util\include\stdargx.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\xmlrpc-c\string_int.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\src\system_method.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\abyss\src\thread.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\xmlrpc-c\time_int.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\abyss\src\token.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\xmlrpc-c\transport.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\transport_config.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\xmlrpc-c\transport_int.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\xmlrpc-c\util_int.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\xml_rpc_alloc.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\expat\xmlparse\xmlparse.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\include\xmlrpc-c\xmlparser.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\xmlrpc_config.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\curl_transport\xmlrpc_curl_transport.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\lib\wininet_transport\xmlrpc_wininet_transport.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/src/mod/applications/mod_avmd/mod_avmd.2010.vcxproj.filters b/src/mod/applications/mod_avmd/mod_avmd.2010.vcxproj.filters new file mode 100644 index 0000000..5851eab --- /dev/null +++ b/src/mod/applications/mod_avmd/mod_avmd.2010.vcxproj.filters @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Header Files"> + <UniqueIdentifier>{4ad6c9d4-436e-451a-8455-2cfce963ef3c}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="amplitude.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="buffer.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="desa2.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="fast_acosf.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="goertzel.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="options.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="psi.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="sma_buf.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="amplitude.c" /> + <ClCompile Include="buffer.c" /> + <ClCompile Include="desa2.c" /> + <ClCompile Include="fast_acosf.c" /> + <ClCompile Include="goertzel.c" /> + <ClCompile Include="mod_avmd.c" /> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/src/mod/formats/mod_shout/mod_shout.vcxproj.filters b/src/mod/formats/mod_shout/mod_shout.vcxproj.filters new file mode 100644 index 0000000..ffd30b7 --- /dev/null +++ b/src/mod/formats/mod_shout/mod_shout.vcxproj.filters @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="mod_shout.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="huffman.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="mpg123.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="mpglib.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/w32/Console/FreeSwitchConsole.2010.vcxproj.filters b/w32/Console/FreeSwitchConsole.2010.vcxproj.filters new file mode 100644 index 0000000..3dd6a6f --- /dev/null +++ b/w32/Console/FreeSwitchConsole.2010.vcxproj.filters @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> + <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\src\switch.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\include\switch.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\src\include\switch_buffer.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\src\include\switch_caller.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\src\include\switch_channel.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\src\include\switch_config.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\src\include\switch_console.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\src\include\switch_core.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\src\include\switch_frame.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\src\include\switch_loadable_module.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\src\include\switch_module_interfaces.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\src\include\switch_types.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\src\include\switch_utils.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file commit 18695c75f2b2cd41ce8c7e7893913e4c3c091f68 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Aug 18 19:51:10 2010 -0500 tweak presence diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index c6c0cca..0c938b9 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1348,17 +1348,23 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * astate = "confirmed"; } - if (!strcasecmp(astate, "ringing")) { - if (!strcasecmp(direction, "recipient")) { - astate = "early"; - } else { - astate = "confirmed"; - } - } if (is_dialog) { + if (!strcasecmp(astate, "ringing")) { + if (!strcasecmp(direction, "recipient")) { + astate = "early"; + } else { + astate = "confirmed"; + } + } + stream.write_function(&stream, "<dialog id=\"%s\" direction=\"%s\">\n", uuid, direction); stream.write_function(&stream, "<state>%s</state>\n", astate); + } else { + if (!strcasecmp(astate, "ringing")) { + astate = "confirmed"; + } } + if (!strcasecmp(astate, "early") || !strcasecmp(astate, "confirmed")) { clean_to_user = switch_mprintf("%s", sub_to_user ? sub_to_user : to_user); commit 1abe3b9337e11d4c37303b3cfda22022477b53bb Author: Jeff Lenk <jeff@jefflenk.com> Date: Thu Aug 19 09:58:30 2010 -0500 MODSOFIA-92 VS2010 diff --git a/Freeswitch.2010.sln b/Freeswitch.2010.sln index 4e45023..c103979 100644 --- a/Freeswitch.2010.sln +++ b/Freeswitch.2010.sln @@ -447,8 +447,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "js", "libs\win32\js\js.2010 EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_sofia", "src\mod\endpoints\mod_sofia\mod_sofia.2010.vcxproj", "{0DF3ABD0-DDC0-4265-B778-07C66780979B}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsofia_sip_ua_static", "libs\win32\sofia\libsofia_sip_ua_static.2010.vcxproj", "{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download PTHREAD", "libs\win32\Download PTHREAD.2010.vcxproj", "{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pthread", "libs\win32\pthread\pthread.2010.vcxproj", "{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}" @@ -689,6 +687,18 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spandsp", "src\mod\appl EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_hash", "src\mod\applications\mod_hash\mod_hash.2010.vcxproj", "{2E250296-0C08-4342-9C8A-BCBDD0E7DF65}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "openssl", "openssl", "{E4D29906-8B73-4F8A-B5F4-CA8BFA648F5A}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libeay32", "libs\win32\openssl\libeay32.2010.vcxproj", "{D331904D-A00A-4694-A5A3-FCFF64AB5DBE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ssleay32", "libs\win32\openssl\ssleay32.2010.vcxproj", "{B4B62169-5AD4-4559-8707-3D933AC5DB39}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openssl", "libs\win32\openssl\openssl.2010.vcxproj", "{25BD39B1-C8BF-4676-A738-9CABD9C6BC79}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download OPENSSL", "libs\win32\Download OPENSSL.2010.vcxproj", "{D578E676-7EC8-4548-BD8B-845C635F14AD}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsofia_sip_ua_static", "libs\win32\sofia\libsofia_sip_ua_static.2010.vcxproj", "{70A49BC2-7500-41D0-B75D-EDCC5BE987A0}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -1084,17 +1094,6 @@ Global {0DF3ABD0-DDC0-4265-B778-07C66780979B}.Release|Win32.Build.0 = Release|Win32 {0DF3ABD0-DDC0-4265-B778-07C66780979B}.Release|x64.ActiveCfg = Release|x64 {0DF3ABD0-DDC0-4265-B778-07C66780979B}.Release|x64.Build.0 = Release|x64 - {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.All|Win32.ActiveCfg = Release|x64 - {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.All|x64.ActiveCfg = Release|x64 - {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.All|x64.Build.0 = Release|x64 - {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|Win32.ActiveCfg = Debug|Win32 - {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|Win32.Build.0 = Debug|Win32 - {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|x64.ActiveCfg = Debug|x64 - {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|x64.Build.0 = Debug|x64 - {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|Win32.ActiveCfg = Release|Win32 - {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|Win32.Build.0 = Release|Win32 - {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|x64.ActiveCfg = Release|x64 - {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|x64.Build.0 = Release|x64 {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.All|Win32.ActiveCfg = Release|Win32 {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.All|Win32.Build.0 = Release|Win32 {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}.All|x64.ActiveCfg = Release|Win32 @@ -2352,6 +2351,59 @@ Global {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.Release|Win32.Build.0 = Release|Win32 {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.Release|x64.ActiveCfg = Release|x64 {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.Release|x64.Build.0 = Release|x64 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.All|Win32.ActiveCfg = Release|x64 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.All|x64.ActiveCfg = Release|x64 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.All|x64.Build.0 = Release|x64 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Debug|Win32.ActiveCfg = Debug|Win32 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Debug|Win32.Build.0 = Debug|Win32 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Debug|x64.ActiveCfg = Debug|x64 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Debug|x64.Build.0 = Debug|x64 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Release|Win32.ActiveCfg = Release|Win32 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Release|Win32.Build.0 = Release|Win32 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Release|x64.ActiveCfg = Release|x64 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Release|x64.Build.0 = Release|x64 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.All|Win32.ActiveCfg = Release|x64 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.All|x64.ActiveCfg = Release|x64 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.All|x64.Build.0 = Release|x64 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Debug|Win32.ActiveCfg = Debug|Win32 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Debug|Win32.Build.0 = Debug|Win32 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Debug|x64.ActiveCfg = Debug|x64 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Debug|x64.Build.0 = Debug|x64 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Release|Win32.ActiveCfg = Release|Win32 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Release|Win32.Build.0 = Release|Win32 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Release|x64.ActiveCfg = Release|x64 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Release|x64.Build.0 = Release|x64 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.All|Win32.ActiveCfg = Release|x64 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.All|x64.ActiveCfg = Release|x64 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.All|x64.Build.0 = Release|x64 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Debug|Win32.ActiveCfg = Debug|Win32 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Debug|Win32.Build.0 = Debug|Win32 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Debug|x64.ActiveCfg = Debug|x64 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Debug|x64.Build.0 = Debug|x64 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|Win32.ActiveCfg = Release|Win32 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|Win32.Build.0 = Release|Win32 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|x64.ActiveCfg = Release|x64 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|x64.Build.0 = Release|x64 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.All|Win32.ActiveCfg = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.All|Win32.Build.0 = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.All|x64.ActiveCfg = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Debug|Win32.ActiveCfg = Debug|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Debug|Win32.Build.0 = Debug|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Debug|x64.ActiveCfg = Debug|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Release|Win32.ActiveCfg = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Release|Win32.Build.0 = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Release|x64.ActiveCfg = Release|Win32 + {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.All|Win32.ActiveCfg = Release|x64 + {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.All|x64.ActiveCfg = Release|x64 + {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.All|x64.Build.0 = Release|x64 + {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|Win32.ActiveCfg = Debug|Win32 + {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|Win32.Build.0 = Debug|Win32 + {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|x64.ActiveCfg = Debug|x64 + {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Debug|x64.Build.0 = Debug|x64 + {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|Win32.ActiveCfg = Release|Win32 + {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|Win32.Build.0 = Release|Win32 + {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|x64.ActiveCfg = Release|x64 + {70A49BC2-7500-41D0-B75D-EDCC5BE987A0}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2423,7 +2475,6 @@ Global {87EE9DA4-DE1E-4448-8324-183C98DCA588} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {155844C3-EC5F-407F-97A4-A2DDADED9B2F} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {204FA0DE-305D-4414-AE2E-F195A23F390D} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} - {70A49BC2-7500-41D0-B75D-EDCC5BE987A0} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {4043FC6A-9A30-4577-8AD5-9B233C9575D8} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {0A18A071-125E-442F-AFF7-A3F68ABECF99} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} @@ -2452,6 +2503,8 @@ Global {ABB71A76-42B0-47A4-973A-42E3D920C6FD} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {9778F1C0-09BC-4698-8EBC-BD982247209A} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {56B91D01-9150-4BBF-AFA1-5B68AB991B76} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} + {E4D29906-8B73-4F8A-B5F4-CA8BFA648F5A} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} + {70A49BC2-7500-41D0-B75D-EDCC5BE987A0} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {EC3E5C7F-EE09-47E2-80FE-546363D14A98} = {B8F5B47B-8568-46EB-B320-64C17D2A98BC} {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {0C808854-54D1-4230-BFF5-77B5FD905000} {ACFFF684-4D19-4D48-AF12-88EA1D778BDF} = {0C808854-54D1-4230-BFF5-77B5FD905000} @@ -2489,6 +2542,7 @@ Global {E10571C4-E7F4-4608-B5F2-B22E7EB95400} = {C120A020-773F-4EA3-923F-B67AF28B750D} {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19} = {C120A020-773F-4EA3-923F-B67AF28B750D} {B808178B-82F0-4CF4-A2B1-921939FA24D0} = {C120A020-773F-4EA3-923F-B67AF28B750D} + {D578E676-7EC8-4548-BD8B-845C635F14AD} = {C120A020-773F-4EA3-923F-B67AF28B750D} {988CACF7-3FCB-4992-BE69-77872AE67DC8} = {6CD61A1D-797C-470A-BE08-8C31B68BB336} {5BC072DB-3826-48EA-AF34-FE32AA01E83B} = {6CD61A1D-797C-470A-BE08-8C31B68BB336} {FA429E98-8B03-45E6-A096-A4BC5E821DE4} = {6CD61A1D-797C-470A-BE08-8C31B68BB336} @@ -2558,5 +2612,8 @@ Global {504B3154-7A4F-459D-9877-B951021C3F1F} = {62F27B1A-C919-4A70-8478-51F178F3B18F} {746F3632-5BB2-4570-9453-31D6D58A7D8E} = {62F27B1A-C919-4A70-8478-51F178F3B18F} {DEB01ACB-D65F-4A62-AED9-58C1054499E9} = {62F27B1A-C919-4A70-8478-51F178F3B18F} + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE} = {E4D29906-8B73-4F8A-B5F4-CA8BFA648F5A} + {B4B62169-5AD4-4559-8707-3D933AC5DB39} = {E4D29906-8B73-4F8A-B5F4-CA8BFA648F5A} + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79} = {E4D29906-8B73-4F8A-B5F4-CA8BFA648F5A} EndGlobalSection EndGlobal diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj index 43220e6..c6aaba5 100644 --- a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj +++ b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj @@ -127,12 +127,6 @@ <ClCompile Include="src\mrcp_sofiasip_client_agent.c" /> <ClCompile Include="src\mrcp_sofiasip_server_agent.c" /> </ItemGroup> - <ItemGroup> - <ProjectReference Include="..\..\..\win32\sofia\libsofia_sip_ua_static.2010.vcxproj"> - <Project>{70a49bc2-7500-41d0-b75d-edcc5be987a0}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> - </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> </ImportGroup> diff --git a/libs/win32/Download OPENSSL.2010.vcxproj b/libs/win32/Download OPENSSL.2010.vcxproj new file mode 100644 index 0000000..f81e29b --- /dev/null +++ b/libs/win32/Download OPENSSL.2010.vcxproj @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>Download OPENSSL</ProjectName> + <ProjectGuid>{D578E676-7EC8-4548-BD8B-845C635F14AD}</ProjectGuid> + <RootNamespace>Download OPENSSL</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Utility</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Utility</ConfigurationType> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir> + <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir> + <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <BuildLog> + <Path>$(IntDir)BuildLog $(ProjectName).htm</Path> + </BuildLog> + </ItemDefinitionGroup> + <ItemGroup> + <CustomBuild Include="OPENSSL\cleancount"> + <FileType>Document</FileType> + <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Downloading OPENSSL.</Message> + <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">if not exist "$(ProjectDir)..\openssl-1.0.0a" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://openssl.org/source/openssl-1.0.0a.tar.gz "$(ProjectDir).." +</Command> + <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)..\OPENSSL;%(Outputs)</Outputs> + <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Downloading OPENSSL.</Message> + <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">if not exist "$(ProjectDir)..\openssl-1.0.0a" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://openssl.org/source/openssl-1.0.0a.tar.gz "$(ProjectDir).." +</Command> + <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)..\OPENSSL;%(Outputs)</Outputs> + </CustomBuild> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/libs/win32/openssl/libeay32.2010.vcxproj b/libs/win32/openssl/libeay32.2010.vcxproj new file mode 100644 index 0000000..1157e5c --- /dev/null +++ b/libs/win32/openssl/libeay32.2010.vcxproj @@ -0,0 +1,867 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>libeay32</ProjectName> + <ProjectGuid>{D331904D-A00A-4694-A5A3-FCFF64AB5DBE}</ProjectGuid> + <RootNamespace>openssl</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <CLRSupport>false</CLRSupport> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <CLRSupport>false</CLRSupport> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <CLRSupport>false</CLRSupport> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <CLRSupport>false</CLRSupport> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\w32\extdll.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\w32\extdll.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\w32\extdll.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\w32\extdll.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <PreBuildEvent> + <Command>copy /Y $(ProjectDir)opensslconf.h $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h +copy /Y $(ProjectDir)applink.c $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c +copy /Y $(ProjectDir)buildinf.h $(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h +copy /Y $(ProjectDir)libeay32.def $(ProjectDir)..\..\openssl-1.0.0a\libeay32.def +if not exist "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\e_os.h" xcopy "$(ProjectDir)\include\*.*" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\" /C /Y /S +</Command> + </PreBuildEvent> + <ClCompile> + <AdditionalOptions>/Gs0 %(AdditionalOptions)</AdditionalOptions> + <Optimization>Full</Optimization> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <AdditionalIncludeDirectories>..\..\openssl-1.0.0a\include;..\..\openssl-1.0.0a\crypto;..\..\openssl-1.0.0a\crypto\aes;..\..\openssl-1.0.0a\crypto\asn1;..\..\openssl-1.0.0a\crypto\bf;..\..\openssl-1.0.0a\crypto\bio;..\..\openssl-1.0.0a\crypto\bn;..\..\openssl-1.0.0a\crypto\buffer;..\..\openssl-1.0.0a\crypto\camellia;..\..\openssl-1.0.0a\crypto\cast;..\..\openssl-1.0.0a\crypto\cms;..\..\openssl-1.0.0a\crypto\comp;..\..\openssl-1.0.0a\crypto\conf;..\..\openssl-1.0.0a\crypto\des;..\..\openssl-1.0.0a\crypto\dh;..\..\openssl-1.0.0a\crypto\dsa;..\..\openssl-1.0.0a\crypto\dso;..\..\openssl-1.0.0a\crypto\ec;..\..\openssl-1.0.0a\crypto\ecdh;..\..\openssl-1.0.0a\crypto\ecdsa;..\..\openssl-1.0.0a\crypto\engine;..\..\openssl-1.0.0a\crypto\err;..\..\openssl-1.0.0a\crypto\evp;..\..\openssl-1.0.0a\ms;..\..\openssl-1.0.0a;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WINDOWS;WIN32;_DEBUG;_CRT_NON_CONFORMING_SWPRINTFS;OPENSSL_THREADS;DSO_WIN32;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_NO_ASM;OPENSSL_NO_GMP;OPENSSL_NO_JPAKE;OPENSSL_NO_KRB5;OPENSSL_NO_MD2;OPENSSL_NO_RFC3779;OPENSSL_NO_STORE;OPENSSL_NO_STATIC_ENGINE;OPENSSL_BUILD_SHLIBCRYPTO;MK1MF_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings> + <EnablePREfast>false</EnablePREfast> + </ClCompile> + <Link> + <AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <ModuleDefinitionFile>$(ProjectDir)..\..\openssl-1.0.0a\libeay32.def</ModuleDefinitionFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <AssemblyDebug>true</AssemblyDebug> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <PreBuildEvent> + <Command>copy /Y $(ProjectDir)opensslconf.h $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h +copy /Y $(ProjectDir)applink.c $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c +copy /Y $(ProjectDir)buildinf.h $(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h +copy /Y $(ProjectDir)libeay32.def $(ProjectDir)..\..\openssl-1.0.0a\libeay32.def +if not exist "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\e_os.h" xcopy "$(ProjectDir)\include\*.*" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\" /C /Y /S +</Command> + </PreBuildEvent> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <AdditionalOptions>/Gs0 %(AdditionalOptions)</AdditionalOptions> + <Optimization>Full</Optimization> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <AdditionalIncludeDirectories>..\..\openssl-1.0.0a\include;..\..\openssl-1.0.0a\crypto;..\..\openssl-1.0.0a\crypto\aes;..\..\openssl-1.0.0a\crypto\asn1;..\..\openssl-1.0.0a\crypto\bf;..\..\openssl-1.0.0a\crypto\bio;..\..\openssl-1.0.0a\crypto\bn;..\..\openssl-1.0.0a\crypto\buffer;..\..\openssl-1.0.0a\crypto\camellia;..\..\openssl-1.0.0a\crypto\cast;..\..\openssl-1.0.0a\crypto\cms;..\..\openssl-1.0.0a\crypto\comp;..\..\openssl-1.0.0a\crypto\conf;..\..\openssl-1.0.0a\crypto\des;..\..\openssl-1.0.0a\crypto\dh;..\..\openssl-1.0.0a\crypto\dsa;..\..\openssl-1.0.0a\crypto\dso;..\..\openssl-1.0.0a\crypto\ec;..\..\openssl-1.0.0a\crypto\ecdh;..\..\openssl-1.0.0a\crypto\ecdsa;..\..\openssl-1.0.0a\crypto\engine;..\..\openssl-1.0.0a\crypto\err;..\..\openssl-1.0.0a\crypto\evp;..\..\openssl-1.0.0a\ms;..\..\openssl-1.0.0a;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WINDOWS;WIN32;_DEBUG;_CRT_NON_CONFORMING_SWPRINTFS;OPENSSL_THREADS;DSO_WIN32;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_NO_ASM;OPENSSL_NO_GMP;OPENSSL_NO_JPAKE;OPENSSL_NO_KRB5;OPENSSL_NO_MD2;OPENSSL_NO_RFC3779;OPENSSL_NO_STORE;OPENSSL_NO_STATIC_ENGINE;OPENSSL_BUILD_SHLIBCRYPTO;MK1MF_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings> + <EnablePREfast>false</EnablePREfast> + </ClCompile> + <Link> + <AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <ModuleDefinitionFile>$(ProjectDir)..\..\openssl-1.0.0a\libeay32.def</ModuleDefinitionFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <AssemblyDebug>true</AssemblyDebug> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <PreBuildEvent> + <Command>copy /Y $(ProjectDir)opensslconf.h $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h +copy /Y $(ProjectDir)applink.c $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c +copy /Y $(ProjectDir)buildinf.h $(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h +copy /Y $(ProjectDir)libeay32.def $(ProjectDir)..\..\openssl-1.0.0a\libeay32.def +if not exist "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\e_os.h" xcopy "$(ProjectDir)\include\*.*" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\" /C /Y /S +</Command> + </PreBuildEvent> + <ClCompile> + <AdditionalOptions>/Gs0 %(AdditionalOptions)</AdditionalOptions> + <Optimization>Full</Optimization> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <AdditionalIncludeDirectories>..\..\openssl-1.0.0a\include;..\..\openssl-1.0.0a\crypto;..\..\openssl-1.0.0a\crypto\aes;..\..\openssl-1.0.0a\crypto\asn1;..\..\openssl-1.0.0a\crypto\bf;..\..\openssl-1.0.0a\crypto\bio;..\..\openssl-1.0.0a\crypto\bn;..\..\openssl-1.0.0a\crypto\buffer;..\..\openssl-1.0.0a\crypto\camellia;..\..\openssl-1.0.0a\crypto\cast;..\..\openssl-1.0.0a\crypto\cms;..\..\openssl-1.0.0a\crypto\comp;..\..\openssl-1.0.0a\crypto\conf;..\..\openssl-1.0.0a\crypto\des;..\..\openssl-1.0.0a\crypto\dh;..\..\openssl-1.0.0a\crypto\dsa;..\..\openssl-1.0.0a\crypto\dso;..\..\openssl-1.0.0a\crypto\ec;..\..\openssl-1.0.0a\crypto\ecdh;..\..\openssl-1.0.0a\crypto\ecdsa;..\..\openssl-1.0.0a\crypto\engine;..\..\openssl-1.0.0a\crypto\err;..\..\openssl-1.0.0a\crypto\evp;..\..\openssl-1.0.0a\ms;..\..\openssl-1.0.0a;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CRT_NON_CONFORMING_SWPRINTFS;OPENSSL_THREADS;DSO_WIN32;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_NO_ASM;OPENSSL_NO_GMP;OPENSSL_NO_JPAKE;OPENSSL_NO_KRB5;OPENSSL_NO_MD2;OPENSSL_NO_RFC3779;OPENSSL_NO_STORE;OPENSSL_NO_STATIC_ENGINE;OPENSSL_BUILD_SHLIBCRYPTO;MK1MF_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings> + <EnablePREfast>false</EnablePREfast> + </ClCompile> + <Link> + <AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <ModuleDefinitionFile>$(ProjectDir)..\..\openssl-1.0.0a\libeay32.def</ModuleDefinitionFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <AssemblyDebug>true</AssemblyDebug> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <PreBuildEvent> + <Command>copy /Y $(ProjectDir)opensslconf.h $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h +copy /Y $(ProjectDir)applink.c $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c +copy /Y $(ProjectDir)buildinf.h $(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h +copy /Y $(ProjectDir)libeay32.def $(ProjectDir)..\..\openssl-1.0.0a\libeay32.def +if not exist "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\e_os.h" xcopy "$(ProjectDir)\include\*.*" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\" /C /Y /S +</Command> + </PreBuildEvent> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <AdditionalOptions>/Gs0 %(AdditionalOptions)</AdditionalOptions> + <Optimization>Full</Optimization> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <AdditionalIncludeDirectories>..\..\openssl-1.0.0a\include;..\..\openssl-1.0.0a\crypto;..\..\openssl-1.0.0a\crypto\aes;..\..\openssl-1.0.0a\crypto\asn1;..\..\openssl-1.0.0a\crypto\bf;..\..\openssl-1.0.0a\crypto\bio;..\..\openssl-1.0.0a\crypto\bn;..\..\openssl-1.0.0a\crypto\buffer;..\..\openssl-1.0.0a\crypto\camellia;..\..\openssl-1.0.0a\crypto\cast;..\..\openssl-1.0.0a\crypto\cms;..\..\openssl-1.0.0a\crypto\comp;..\..\openssl-1.0.0a\crypto\conf;..\..\openssl-1.0.0a\crypto\des;..\..\openssl-1.0.0a\crypto\dh;..\..\openssl-1.0.0a\crypto\dsa;..\..\openssl-1.0.0a\crypto\dso;..\..\openssl-1.0.0a\crypto\ec;..\..\openssl-1.0.0a\crypto\ecdh;..\..\openssl-1.0.0a\crypto\ecdsa;..\..\openssl-1.0.0a\crypto\engine;..\..\openssl-1.0.0a\crypto\err;..\..\openssl-1.0.0a\crypto\evp;..\..\openssl-1.0.0a\ms;..\..\openssl-1.0.0a;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CRT_NON_CONFORMING_SWPRINTFS;OPENSSL_THREADS;DSO_WIN32;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_NO_ASM;OPENSSL_NO_GMP;OPENSSL_NO_JPAKE;OPENSSL_NO_KRB5;OPENSSL_NO_MD2;OPENSSL_NO_RFC3779;OPENSSL_NO_STORE;OPENSSL_NO_STATIC_ENGINE;OPENSSL_BUILD_SHLIBCRYPTO;MK1MF_BUILD;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings> + <EnablePREfast>false</EnablePREfast> + </ClCompile> + <Link> + <AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <ModuleDefinitionFile>$(ProjectDir)..\..\openssl-1.0.0a\libeay32.def</ModuleDefinitionFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <AssemblyDebug>true</AssemblyDebug> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cpt_err.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cryptlib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cversion.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ex_data.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\mem.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\mem_clr.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\mem_dbg.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\o_dir.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\o_time.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\uid.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rc2\rc2_cbc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rc2\rc2_ecb.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rc2\rc2_skey.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rc2\rc2cfb64.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rc2\rc2ofb64.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rc4\rc4_enc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rc4\rc4_skey.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\idea\i_cbc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\idea\i_cfb64.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\idea\i_ecb.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\idea\i_ofb64.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\idea\i_skey.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bf\bf_cfb64.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bf\bf_ecb.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bf\bf_enc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bf\bf_ofb64.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bf\bf_skey.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cast\c_cfb64.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cast\c_ecb.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cast\c_enc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cast\c_ofb64.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cast\c_skey.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ripemd\rmd_dgst.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ripemd\rmd_one.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\cbc_cksm.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\cbc_enc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\cfb64ede.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\cfb64enc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\cfb_enc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\des_enc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\des_old.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\des_old2.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\ecb3_enc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\ecb_enc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\ede_cbcm_enc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\enc_read.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\enc_writ.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\fcrypt.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\fcrypt_b.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\ofb64ede.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\ofb64enc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\ofb_enc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\pcbc_enc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\qud_cksm.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\rand_key.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\read2pwd.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\rpc_enc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\set_key.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\str2key.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\xcbc_enc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\aes\aes_cbc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\aes\aes_cfb.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\aes\aes_core.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\aes\aes_ctr.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\aes\aes_ecb.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\aes\aes_ige.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\aes\aes_misc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\aes\aes_ofb.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\aes\aes_wrap.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\camellia\camellia.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\camellia\cmll_cbc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\camellia\cmll_cfb.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\camellia\cmll_ctr.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\camellia\cmll_ecb.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\camellia\cmll_misc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\camellia\cmll_ofb.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\seed\seed.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\seed\seed_cbc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\seed\seed_cfb.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\seed\seed_ecb.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\seed\seed_ofb.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\modes\cbc128.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\modes\cfb128.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\modes\ctr128.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\modes\cts128.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\modes\ofb128.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_add.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_asm.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_blind.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_const.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_ctx.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_depr.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_div.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_err.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_exp.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_exp2.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_gcd.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_gf2m.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_kron.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_mod.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_mont.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_mpi.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_mul.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_nist.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_prime.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_print.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_rand.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_recp.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_shift.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_sqr.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_sqrt.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_word.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_ameth.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_asn1.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_chk.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_depr.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_eay.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_err.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_gen.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_none.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_null.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_oaep.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_pk1.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_pmeth.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_prn.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_pss.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_saos.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_sign.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_ssl.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_x931.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dsa\dsa_ameth.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dsa\dsa_asn1.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dsa\dsa_depr.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dsa\dsa_err.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dsa\dsa_gen.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dsa\dsa_key.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dsa\dsa_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dsa\dsa_ossl.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dsa\dsa_pmeth.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dsa\dsa_prn.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dsa\dsa_sign.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dsa\dsa_vrf.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rand\md_rand.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rand\rand_egd.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rand\rand_err.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rand\rand_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rand\rand_nw.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rand\rand_os2.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rand\rand_unix.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rand\rand_win.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rand\randfile.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\b_dump.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\b_print.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\b_sock.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bf_buff.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bf_nbio.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bf_null.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bio_cb.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bio_err.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bio_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bss_acpt.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bss_bio.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bss_conn.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bss_dgram.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bss_fd.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bss_file.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bss_log.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bss_mem.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bss_null.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bss_sock.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\err\err.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\err\err_all.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\err\err_prn.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ui\ui_compat.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ui\ui_err.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ui\ui_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ui\ui_openssl.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ui\ui_util.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\by_dir.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\by_file.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_att.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_cmp.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_d2.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_def.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_err.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_ext.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_lu.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_obj.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_r2x.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_req.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_set.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_trs.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_txt.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_v3.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_vfy.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_vpm.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509cset.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509name.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509rset.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509spki.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509type.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x_all.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_bitstr.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_bool.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_bytes.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_d2i_fp.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_digest.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_dup.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_enum.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_gentm.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_i2d_fp.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_int.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_mbstr.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_object.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_octet.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_print.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_set.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_sign.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_strex.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_strnid.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_time.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_type.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_utctm.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_utf8.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_verify.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\ameth_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\asn1_err.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\asn1_gen.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\asn1_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\asn1_par.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\asn_mime.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\asn_moid.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\asn_pack.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\bio_asn1.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\bio_ndef.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\d2i_pr.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\d2i_pu.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\evp_asn1.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\f_enum.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\f_int.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\f_string.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\i2d_pr.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\i2d_pu.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\n_pkey.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\nsseq.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\p5_pbe.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\p5_pbev2.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\p8_pkey.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\t_bitst.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\t_crl.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\t_pkey.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\t_req.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\t_spki.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\t_x509.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\t_x509a.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\tasn_dec.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\tasn_enc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\tasn_fre.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\tasn_new.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\tasn_prn.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\tasn_typ.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\tasn_utl.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_algor.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_attrib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_bignum.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_crl.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_exten.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_info.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_long.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_name.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_nx509.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_pkey.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_pubkey.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_req.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_sig.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_spki.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_val.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_x509.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_x509a.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\objects\o_names.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\objects\obj_dat.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\objects\obj_err.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\objects\obj_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\objects\obj_xref.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\bio_b64.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\bio_enc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\bio_md.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\bio_ok.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\c_all.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\c_allc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\c_alld.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\digest.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\e_aes.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\e_bf.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\e_camellia.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\e_cast.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\e_des.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\e_des3.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\e_idea.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\e_null.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\e_old.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\e_rc2.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\e_rc4.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\e_rc5.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\e_seed.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\e_xcbc_d.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\encode.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\evp_acnf.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\evp_enc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\evp_err.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\evp_key.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\evp_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\evp_pbe.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\evp_pkey.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\m_dss.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\m_dss1.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\m_ecdsa.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\m_md2.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\m_md4.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\m_md5.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\m_mdc2.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\m_null.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\m_ripemd.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\m_sha.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\m_sha1.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\m_sigver.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\m_wp.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\names.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\openbsd_hw.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\p5_crpt.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\p5_crpt2.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\p_dec.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\p_enc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\p_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\p_open.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\p_seal.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\p_sign.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\p_verify.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\pmeth_fn.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\pmeth_gn.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\pmeth_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\buffer\buf_err.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\buffer\buffer.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cms\cms_asn1.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cms\cms_att.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cms\cms_cd.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cms\cms_dd.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cms\cms_enc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cms\cms_env.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cms\cms_err.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cms\cms_ess.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cms\cms_io.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cms\cms_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cms\cms_sd.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cms\cms_smime.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\eng_all.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\eng_cnf.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\eng_cryptodev.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\eng_ctrl.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\eng_dyn.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\eng_err.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\eng_fat.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\eng_init.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\eng_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\eng_list.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\eng_openssl.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\eng_pkey.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\eng_table.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\tb_asnmth.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\tb_cipher.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\tb_dh.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\tb_digest.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\tb_dsa.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\tb_ecdh.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\tb_ecdsa.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\tb_pkmeth.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\tb_rand.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\tb_rsa.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\tb_store.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\stack\stack.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs7\bio_pk7.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs7\pk7_asn1.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs7\pk7_attr.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs7\pk7_doit.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs7\pk7_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs7\pk7_mime.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs7\pk7_smime.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs7\pkcs7err.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dh\dh_ameth.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dh\dh_asn1.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dh\dh_check.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dh\dh_depr.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dh\dh_err.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dh\dh_gen.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dh\dh_key.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dh\dh_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dh\dh_pmeth.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dh\dh_prn.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ocsp\ocsp_asn.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ocsp\ocsp_cl.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ocsp\ocsp_err.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ocsp\ocsp_ext.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ocsp\ocsp_ht.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ocsp\ocsp_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ocsp\ocsp_prn.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ocsp\ocsp_srv.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ocsp\ocsp_vfy.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\pcy_cache.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\pcy_data.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\pcy_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\pcy_map.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\pcy_node.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\pcy_tree.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_addr.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_akey.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_akeya.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_alt.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_asid.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_bcons.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_bitst.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_conf.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_cpols.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_crld.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_enum.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_extku.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_genn.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_ia5.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_info.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_int.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_ncons.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_ocsp.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_pci.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_pcia.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_pcons.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_pku.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_pmaps.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_prn.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_purp.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_skey.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_sxnet.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_utl.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3err.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ts\ts_asn1.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ts\ts_conf.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ts\ts_err.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ts\ts_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ts\ts_req_print.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ts\ts_req_utils.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ts\ts_rsp_print.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ts\ts_rsp_sign.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ts\ts_rsp_utils.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ts\ts_rsp_verify.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ts\ts_verify_ctx.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\conf\conf_api.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\conf\conf_def.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\conf\conf_err.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\conf\conf_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\conf\conf_mall.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\conf\conf_mod.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\conf\conf_sap.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ec2_mult.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ec2_smpl.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ec_ameth.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ec_asn1.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ec_check.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ec_curve.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ec_cvt.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ec_err.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ec_key.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ec_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ec_mult.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ec_pmeth.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ec_print.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\eck_prn.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ecp_mont.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ecp_nist.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ecp_smpl.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ecdh\ech_err.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ecdh\ech_key.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ecdh\ech_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ecdh\ech_ossl.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ecdsa\ecs_asn1.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ecdsa\ecs_err.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ecdsa\ecs_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ecdsa\ecs_ossl.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ecdsa\ecs_sign.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ecdsa\ecs_vrf.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\md5\md5_dgst.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\md5\md5_one.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\md4\md4_dgst.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\md4\md4_one.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\lhash\lh_stats.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\lhash\lhash.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dso\dso_beos.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dso\dso_dl.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dso\dso_dlfcn.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dso\dso_err.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dso\dso_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dso\dso_null.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dso\dso_openssl.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dso\dso_vms.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dso\dso_win32.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs12\p12_add.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs12\p12_asn.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs12\p12_attr.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs12\p12_crpt.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs12\p12_crt.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs12\p12_decr.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs12\p12_init.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs12\p12_key.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs12\p12_kiss.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs12\p12_mutl.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs12\p12_npas.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs12\p12_p8d.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs12\p12_p8e.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs12\p12_utl.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs12\pk12err.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\hmac\hm_ameth.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\hmac\hm_pmeth.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\hmac\hmac.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\sha\sha1_one.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\sha\sha1dgst.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\sha\sha256.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\sha\sha512.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\sha\sha512t.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\sha\sha_dgst.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\sha\sha_one.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\comp\c_rle.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\comp\c_zlib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\comp\comp_err.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\comp\comp_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pem\pem_all.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pem\pem_err.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pem\pem_info.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pem\pem_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pem\pem_oth.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pem\pem_pk8.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pem\pem_pkey.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pem\pem_seal.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pem\pem_sign.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pem\pem_x509.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pem\pem_xaux.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pem\pvkfmt.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\whrlpool\wp_block.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\whrlpool\wp_dgst.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\mdc2\mdc2_one.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\mdc2\mdc2dgst.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\krb5\krb5_asn.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\txt_db\txt_db.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pqueue\pqueue.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ms\uplink.c" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\openssl-1.0.0a\e_os.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\crypto\cryptlib.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\crypto\o_dir.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\crypto\o_str.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\crypto\o_time.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\crypto\evp\evp_locl.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\aes.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\asn1.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\asn1_mac.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\asn1t.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\bio.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\blowfish.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\bn.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\buffer.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\camellia.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\cast.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\cms.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\comp.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\conf.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\conf_api.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\crypto.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\des.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\des_old.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\dh.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\dsa.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\dso.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\dtls1.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\e_os2.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\ebcdic.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\ec.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\ecdh.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\ecdsa.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\engine.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\err.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\evp.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\hmac.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\idea.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\krb5_asn.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\kssl.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\lhash.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\md4.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\md5.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\mdc2.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\modes.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\obj_mac.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\objects.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\ocsp.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\opensslconf.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\opensslv.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\ossl_typ.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\pem.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\pem2.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\pkcs12.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\pkcs7.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\pqueue.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\rand.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\rc2.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\rc4.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\ripemd.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\rsa.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\safestack.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\seed.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\sha.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\ssl.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\ssl2.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\ssl23.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\ssl3.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\stack.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\symhacks.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\tls1.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\ts.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\txt_db.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\ui.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\ui_compat.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\whrlpool.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\x509.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\x509_vfy.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\x509v3.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\crypto\bf\bf_locl.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\crypto\bf\bf_pi.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\crypto\bf\blowfish.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\ms\uplink.h" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\Download OPENSSL.2010.vcxproj"> + <Project>{d578e676-7ec8-4548-bd8b-845c635f14ad}</Project> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" /> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/libs/win32/openssl/libeay32.2010.vcxproj.filters b/libs/win32/openssl/libeay32.2010.vcxproj.filters new file mode 100644 index 0000000..6a32152 --- /dev/null +++ b/libs/win32/openssl/libeay32.2010.vcxproj.filters @@ -0,0 +1,2093 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Source Files\crypto"> + <UniqueIdentifier>{2850971f-3d57-4ec1-ba4e-4eeeca46de09}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\rc2"> + <UniqueIdentifier>{6b648b8e-8ebf-4f48-8c17-1f6b2d9477ce}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\rc4"> + <UniqueIdentifier>{05ec904a-2b0d-4d2b-87ce-fcbaf9bc53ef}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\idea"> + <UniqueIdentifier>{919079e4-52ba-479b-9d7e-673ad9bf6958}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\bf"> + <UniqueIdentifier>{644aa6c7-8c73-4e8d-ae63-869bc189980a}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\cast"> + <UniqueIdentifier>{636f4aed-2ca1-40a7-ac6b-92b541500300}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\ripemd"> + <UniqueIdentifier>{bc509ff7-3aaa-468b-80fa-7354cb810c13}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\des"> + <UniqueIdentifier>{96559708-7eee-4deb-a2b2-667298a4ef01}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\aes"> + <UniqueIdentifier>{1c09035a-c83f-40d7-920a-744cd59ef2f4}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\camellia"> + <UniqueIdentifier>{61e88564-1f38-4f1d-9e30-8e9d9506c71d}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\seed"> + <UniqueIdentifier>{3ec0ae46-a65d-4fdf-828c-44a3c79a6513}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\modes"> + <UniqueIdentifier>{616027a2-c98f-4445-9af0-0c50bb044818}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\bn"> + <UniqueIdentifier>{6c98fe40-7652-4cd9-846a-554b31f968e6}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\rsa"> + <UniqueIdentifier>{b5ba2166-4005-4e4d-ba09-41746fd2c870}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\dsa"> + <UniqueIdentifier>{26f25748-94ef-4153-9724-719403f62835}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\rand"> + <UniqueIdentifier>{daa6ffca-0173-41bf-8783-5ab2946155e5}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\bio"> + <UniqueIdentifier>{dbfd9437-8e08-49de-a1e7-938b600a08cf}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\err"> + <UniqueIdentifier>{01bf1b62-b5be-47f7-8d41-e1bcfaad2aca}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\ui"> + <UniqueIdentifier>{c47b5411-3d09-4382-b89f-a4108640aa92}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\x509"> + <UniqueIdentifier>{ce0f14aa-10a0-4127-a466-3df1411abd2e}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\asn1"> + <UniqueIdentifier>{3e96a0c0-5174-442b-9340-fbfe40c6240b}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\objects"> + <UniqueIdentifier>{aae1c437-51fa-4235-a078-145f1ce455cf}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\evp"> + <UniqueIdentifier>{89511946-5b9a-46b2-9d0e-97899bcaf018}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\buffer"> + <UniqueIdentifier>{b0206185-99ef-40cc-aa8d-49e0034f98d4}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\cms"> + <UniqueIdentifier>{fba7f92a-93a9-448d-a552-5491255db0ac}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\engine"> + <UniqueIdentifier>{224fad84-0750-4fee-addb-83a53b3b761d}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\stack"> + <UniqueIdentifier>{c754b49b-c6b8-4b49-802f-8eedfa4dbef4}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\pkcs7"> + <UniqueIdentifier>{78d696b8-88c1-4190-8a68-032e09b6d29d}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\dh"> + <UniqueIdentifier>{ead8484b-aeec-45cf-a491-6eb06779ede7}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\ocsp"> + <UniqueIdentifier>{9edce7d9-19e3-4272-aad1-c5602e2b2104}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\x509v3"> + <UniqueIdentifier>{c76dbab1-9425-4178-9328-e680a21cb7f9}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\ts"> + <UniqueIdentifier>{e796b6ee-d0c0-46ff-b949-556db483591e}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\conf"> + <UniqueIdentifier>{e2f6b450-d8b6-4e3b-aa18-3af97ff00386}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\ec"> + <UniqueIdentifier>{dabdf468-70c7-4047-a321-4257eddfd30e}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\ecdh"> + <UniqueIdentifier>{b193f02f-4d4f-42df-bde9-29d40f5ab39b}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\ecdsa"> + <UniqueIdentifier>{8c36cfee-583f-4e0e-bd3c-a518d31d4eb2}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\md5"> + <UniqueIdentifier>{f2d3a7a0-acdb-4e85-85ed-d74e176e5bea}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\md4"> + <UniqueIdentifier>{0581d1b8-2fe1-4bfd-841f-78ae4af03566}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\lhash"> + <UniqueIdentifier>{90017bfa-d91a-430a-bba6-fde2d6a53129}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\dso"> + <UniqueIdentifier>{fbe18987-9cdd-4d25-a173-865867f652b6}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\pkcs12"> + <UniqueIdentifier>{9a9acc90-e65f-4655-9fe5-644a9166663f}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\hmac"> + <UniqueIdentifier>{99a1ece1-fa73-4505-b850-a331cb41c53e}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\sha"> + <UniqueIdentifier>{5b9dd7d9-bb80-40c4-87e3-6cd084d94034}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\comp"> + <UniqueIdentifier>{b3c6fe14-7ab4-42ad-b73a-998cd8b071bd}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\pem"> + <UniqueIdentifier>{cc048924-f80a-4a77-8113-cad552f4f420}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\whrlpool"> + <UniqueIdentifier>{87b53a26-4389-42b6-bd9a-559c5f8f6a47}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\mdc2"> + <UniqueIdentifier>{673da9b9-025a-4a23-b7d7-834804ad564c}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\krb5"> + <UniqueIdentifier>{1531b88a-1a6c-43cd-be72-1059d1ac32a8}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\txt_db"> + <UniqueIdentifier>{834fc5df-340b-41b0-b9d6-d9c77bdaa848}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\crypto\pqueue"> + <UniqueIdentifier>{0a0643bb-ea56-4e8e-936b-95c56933441d}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\ms"> + <UniqueIdentifier>{2f1cce25-c551-43c1-9ec3-478bea639d9e}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Header Files\crypto"> + <UniqueIdentifier>{c42c3a40-6d53-49e8-bad0-bd02521f475d}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files\crypto\evp"> + <UniqueIdentifier>{12a7c0f3-1955-4c42-ab0d-5dfeb8e97f30}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files\openssl"> + <UniqueIdentifier>{3a939d2d-882a-49cf-9b39-d6e29932ba2f}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files\bf"> + <UniqueIdentifier>{4e1235aa-5f4b-44f0-8cd2-db2bc40052c3}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files\ms"> + <UniqueIdentifier>{c4935409-609f-4bac-8306-8f480f529596}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cpt_err.c"> + <Filter>Source Files\crypto</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cryptlib.c"> + <Filter>Source Files\crypto</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cversion.c"> + <Filter>Source Files\crypto</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ex_data.c"> + <Filter>Source Files\crypto</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\mem.c"> + <Filter>Source Files\crypto</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\mem_clr.c"> + <Filter>Source Files\crypto</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\mem_dbg.c"> + <Filter>Source Files\crypto</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\o_dir.c"> + <Filter>Source Files\crypto</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\o_time.c"> + <Filter>Source Files\crypto</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\uid.c"> + <Filter>Source Files\crypto</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rc2\rc2_cbc.c"> + <Filter>Source Files\crypto\rc2</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rc2\rc2_ecb.c"> + <Filter>Source Files\crypto\rc2</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rc2\rc2_skey.c"> + <Filter>Source Files\crypto\rc2</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rc2\rc2cfb64.c"> + <Filter>Source Files\crypto\rc2</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rc2\rc2ofb64.c"> + <Filter>Source Files\crypto\rc2</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rc4\rc4_enc.c"> + <Filter>Source Files\crypto\rc4</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rc4\rc4_skey.c"> + <Filter>Source Files\crypto\rc4</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\idea\i_cbc.c"> + <Filter>Source Files\crypto\idea</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\idea\i_cfb64.c"> + <Filter>Source Files\crypto\idea</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\idea\i_ecb.c"> + <Filter>Source Files\crypto\idea</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\idea\i_ofb64.c"> + <Filter>Source Files\crypto\idea</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\idea\i_skey.c"> + <Filter>Source Files\crypto\idea</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bf\bf_cfb64.c"> + <Filter>Source Files\crypto\bf</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bf\bf_ecb.c"> + <Filter>Source Files\crypto\bf</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bf\bf_enc.c"> + <Filter>Source Files\crypto\bf</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bf\bf_ofb64.c"> + <Filter>Source Files\crypto\bf</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bf\bf_skey.c"> + <Filter>Source Files\crypto\bf</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cast\c_cfb64.c"> + <Filter>Source Files\crypto\cast</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cast\c_ecb.c"> + <Filter>Source Files\crypto\cast</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cast\c_enc.c"> + <Filter>Source Files\crypto\cast</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cast\c_ofb64.c"> + <Filter>Source Files\crypto\cast</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cast\c_skey.c"> + <Filter>Source Files\crypto\cast</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ripemd\rmd_dgst.c"> + <Filter>Source Files\crypto\ripemd</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ripemd\rmd_one.c"> + <Filter>Source Files\crypto\ripemd</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\cbc_cksm.c"> + <Filter>Source Files\crypto\des</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\cbc_enc.c"> + <Filter>Source Files\crypto\des</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\cfb64ede.c"> + <Filter>Source Files\crypto\des</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\cfb64enc.c"> + <Filter>Source Files\crypto\des</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\cfb_enc.c"> + <Filter>Source Files\crypto\des</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\des_enc.c"> + <Filter>Source Files\crypto\des</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\des_old.c"> + <Filter>Source Files\crypto\des</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\des_old2.c"> + <Filter>Source Files\crypto\des</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\ecb3_enc.c"> + <Filter>Source Files\crypto\des</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\ecb_enc.c"> + <Filter>Source Files\crypto\des</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\ede_cbcm_enc.c"> + <Filter>Source Files\crypto\des</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\enc_read.c"> + <Filter>Source Files\crypto\des</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\enc_writ.c"> + <Filter>Source Files\crypto\des</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\fcrypt.c"> + <Filter>Source Files\crypto\des</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\fcrypt_b.c"> + <Filter>Source Files\crypto\des</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\ofb64ede.c"> + <Filter>Source Files\crypto\des</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\ofb64enc.c"> + <Filter>Source Files\crypto\des</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\ofb_enc.c"> + <Filter>Source Files\crypto\des</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\pcbc_enc.c"> + <Filter>Source Files\crypto\des</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\qud_cksm.c"> + <Filter>Source Files\crypto\des</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\rand_key.c"> + <Filter>Source Files\crypto\des</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\read2pwd.c"> + <Filter>Source Files\crypto\des</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\rpc_enc.c"> + <Filter>Source Files\crypto\des</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\set_key.c"> + <Filter>Source Files\crypto\des</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\str2key.c"> + <Filter>Source Files\crypto\des</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\des\xcbc_enc.c"> + <Filter>Source Files\crypto\des</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\aes\aes_cbc.c"> + <Filter>Source Files\crypto\aes</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\aes\aes_cfb.c"> + <Filter>Source Files\crypto\aes</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\aes\aes_core.c"> + <Filter>Source Files\crypto\aes</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\aes\aes_ctr.c"> + <Filter>Source Files\crypto\aes</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\aes\aes_ecb.c"> + <Filter>Source Files\crypto\aes</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\aes\aes_ige.c"> + <Filter>Source Files\crypto\aes</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\aes\aes_misc.c"> + <Filter>Source Files\crypto\aes</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\aes\aes_ofb.c"> + <Filter>Source Files\crypto\aes</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\aes\aes_wrap.c"> + <Filter>Source Files\crypto\aes</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\camellia\camellia.c"> + <Filter>Source Files\crypto\camellia</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\camellia\cmll_cbc.c"> + <Filter>Source Files\crypto\camellia</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\camellia\cmll_cfb.c"> + <Filter>Source Files\crypto\camellia</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\camellia\cmll_ctr.c"> + <Filter>Source Files\crypto\camellia</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\camellia\cmll_ecb.c"> + <Filter>Source Files\crypto\camellia</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\camellia\cmll_misc.c"> + <Filter>Source Files\crypto\camellia</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\camellia\cmll_ofb.c"> + <Filter>Source Files\crypto\camellia</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\seed\seed.c"> + <Filter>Source Files\crypto\seed</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\seed\seed_cbc.c"> + <Filter>Source Files\crypto\seed</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\seed\seed_cfb.c"> + <Filter>Source Files\crypto\seed</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\seed\seed_ecb.c"> + <Filter>Source Files\crypto\seed</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\seed\seed_ofb.c"> + <Filter>Source Files\crypto\seed</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\modes\cbc128.c"> + <Filter>Source Files\crypto\modes</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\modes\cfb128.c"> + <Filter>Source Files\crypto\modes</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\modes\ctr128.c"> + <Filter>Source Files\crypto\modes</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\modes\cts128.c"> + <Filter>Source Files\crypto\modes</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\modes\ofb128.c"> + <Filter>Source Files\crypto\modes</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_add.c"> + <Filter>Source Files\crypto\bn</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_asm.c"> + <Filter>Source Files\crypto\bn</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_blind.c"> + <Filter>Source Files\crypto\bn</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_const.c"> + <Filter>Source Files\crypto\bn</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_ctx.c"> + <Filter>Source Files\crypto\bn</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_depr.c"> + <Filter>Source Files\crypto\bn</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_div.c"> + <Filter>Source Files\crypto\bn</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_err.c"> + <Filter>Source Files\crypto\bn</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_exp.c"> + <Filter>Source Files\crypto\bn</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_exp2.c"> + <Filter>Source Files\crypto\bn</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_gcd.c"> + <Filter>Source Files\crypto\bn</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_gf2m.c"> + <Filter>Source Files\crypto\bn</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_kron.c"> + <Filter>Source Files\crypto\bn</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_lib.c"> + <Filter>Source Files\crypto\bn</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_mod.c"> + <Filter>Source Files\crypto\bn</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_mont.c"> + <Filter>Source Files\crypto\bn</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_mpi.c"> + <Filter>Source Files\crypto\bn</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_mul.c"> + <Filter>Source Files\crypto\bn</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_nist.c"> + <Filter>Source Files\crypto\bn</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_prime.c"> + <Filter>Source Files\crypto\bn</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_print.c"> + <Filter>Source Files\crypto\bn</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_rand.c"> + <Filter>Source Files\crypto\bn</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_recp.c"> + <Filter>Source Files\crypto\bn</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_shift.c"> + <Filter>Source Files\crypto\bn</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_sqr.c"> + <Filter>Source Files\crypto\bn</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_sqrt.c"> + <Filter>Source Files\crypto\bn</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bn\bn_word.c"> + <Filter>Source Files\crypto\bn</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_ameth.c"> + <Filter>Source Files\crypto\rsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_asn1.c"> + <Filter>Source Files\crypto\rsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_chk.c"> + <Filter>Source Files\crypto\rsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_depr.c"> + <Filter>Source Files\crypto\rsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_eay.c"> + <Filter>Source Files\crypto\rsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_err.c"> + <Filter>Source Files\crypto\rsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_gen.c"> + <Filter>Source Files\crypto\rsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_lib.c"> + <Filter>Source Files\crypto\rsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_none.c"> + <Filter>Source Files\crypto\rsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_null.c"> + <Filter>Source Files\crypto\rsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_oaep.c"> + <Filter>Source Files\crypto\rsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_pk1.c"> + <Filter>Source Files\crypto\rsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_pmeth.c"> + <Filter>Source Files\crypto\rsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_prn.c"> + <Filter>Source Files\crypto\rsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_pss.c"> + <Filter>Source Files\crypto\rsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_saos.c"> + <Filter>Source Files\crypto\rsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_sign.c"> + <Filter>Source Files\crypto\rsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_ssl.c"> + <Filter>Source Files\crypto\rsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rsa\rsa_x931.c"> + <Filter>Source Files\crypto\rsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dsa\dsa_ameth.c"> + <Filter>Source Files\crypto\dsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dsa\dsa_asn1.c"> + <Filter>Source Files\crypto\dsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dsa\dsa_depr.c"> + <Filter>Source Files\crypto\dsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dsa\dsa_err.c"> + <Filter>Source Files\crypto\dsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dsa\dsa_gen.c"> + <Filter>Source Files\crypto\dsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dsa\dsa_key.c"> + <Filter>Source Files\crypto\dsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dsa\dsa_lib.c"> + <Filter>Source Files\crypto\dsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dsa\dsa_ossl.c"> + <Filter>Source Files\crypto\dsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dsa\dsa_pmeth.c"> + <Filter>Source Files\crypto\dsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dsa\dsa_prn.c"> + <Filter>Source Files\crypto\dsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dsa\dsa_sign.c"> + <Filter>Source Files\crypto\dsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dsa\dsa_vrf.c"> + <Filter>Source Files\crypto\dsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rand\md_rand.c"> + <Filter>Source Files\crypto\rand</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rand\rand_egd.c"> + <Filter>Source Files\crypto\rand</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rand\rand_err.c"> + <Filter>Source Files\crypto\rand</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rand\rand_lib.c"> + <Filter>Source Files\crypto\rand</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rand\rand_nw.c"> + <Filter>Source Files\crypto\rand</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rand\rand_os2.c"> + <Filter>Source Files\crypto\rand</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rand\rand_unix.c"> + <Filter>Source Files\crypto\rand</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rand\rand_win.c"> + <Filter>Source Files\crypto\rand</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\rand\randfile.c"> + <Filter>Source Files\crypto\rand</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\b_dump.c"> + <Filter>Source Files\crypto\bio</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\b_print.c"> + <Filter>Source Files\crypto\bio</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\b_sock.c"> + <Filter>Source Files\crypto\bio</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bf_buff.c"> + <Filter>Source Files\crypto\bio</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bf_nbio.c"> + <Filter>Source Files\crypto\bio</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bf_null.c"> + <Filter>Source Files\crypto\bio</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bio_cb.c"> + <Filter>Source Files\crypto\bio</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bio_err.c"> + <Filter>Source Files\crypto\bio</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bio_lib.c"> + <Filter>Source Files\crypto\bio</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bss_acpt.c"> + <Filter>Source Files\crypto\bio</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bss_bio.c"> + <Filter>Source Files\crypto\bio</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bss_conn.c"> + <Filter>Source Files\crypto\bio</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bss_dgram.c"> + <Filter>Source Files\crypto\bio</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bss_fd.c"> + <Filter>Source Files\crypto\bio</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bss_file.c"> + <Filter>Source Files\crypto\bio</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bss_log.c"> + <Filter>Source Files\crypto\bio</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bss_mem.c"> + <Filter>Source Files\crypto\bio</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bss_null.c"> + <Filter>Source Files\crypto\bio</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\bio\bss_sock.c"> + <Filter>Source Files\crypto\bio</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\err\err.c"> + <Filter>Source Files\crypto\err</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\err\err_all.c"> + <Filter>Source Files\crypto\err</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\err\err_prn.c"> + <Filter>Source Files\crypto\err</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ui\ui_compat.c"> + <Filter>Source Files\crypto\ui</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ui\ui_err.c"> + <Filter>Source Files\crypto\ui</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ui\ui_lib.c"> + <Filter>Source Files\crypto\ui</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ui\ui_openssl.c"> + <Filter>Source Files\crypto\ui</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ui\ui_util.c"> + <Filter>Source Files\crypto\ui</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\by_dir.c"> + <Filter>Source Files\crypto\x509</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\by_file.c"> + <Filter>Source Files\crypto\x509</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_att.c"> + <Filter>Source Files\crypto\x509</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_cmp.c"> + <Filter>Source Files\crypto\x509</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_d2.c"> + <Filter>Source Files\crypto\x509</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_def.c"> + <Filter>Source Files\crypto\x509</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_err.c"> + <Filter>Source Files\crypto\x509</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_ext.c"> + <Filter>Source Files\crypto\x509</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_lu.c"> + <Filter>Source Files\crypto\x509</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_obj.c"> + <Filter>Source Files\crypto\x509</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_r2x.c"> + <Filter>Source Files\crypto\x509</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_req.c"> + <Filter>Source Files\crypto\x509</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_set.c"> + <Filter>Source Files\crypto\x509</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_trs.c"> + <Filter>Source Files\crypto\x509</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_txt.c"> + <Filter>Source Files\crypto\x509</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_v3.c"> + <Filter>Source Files\crypto\x509</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_vfy.c"> + <Filter>Source Files\crypto\x509</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509_vpm.c"> + <Filter>Source Files\crypto\x509</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509cset.c"> + <Filter>Source Files\crypto\x509</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509name.c"> + <Filter>Source Files\crypto\x509</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509rset.c"> + <Filter>Source Files\crypto\x509</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509spki.c"> + <Filter>Source Files\crypto\x509</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x509type.c"> + <Filter>Source Files\crypto\x509</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509\x_all.c"> + <Filter>Source Files\crypto\x509</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_bitstr.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_bool.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_bytes.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_d2i_fp.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_digest.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_dup.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_enum.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_gentm.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_i2d_fp.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_int.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_mbstr.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_object.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_octet.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_print.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_set.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_sign.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_strex.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_strnid.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_time.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_type.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_utctm.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_utf8.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\a_verify.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\ameth_lib.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\asn1_err.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\asn1_gen.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\asn1_lib.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\asn1_par.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\asn_mime.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\asn_moid.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\asn_pack.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\bio_asn1.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\bio_ndef.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\d2i_pr.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\d2i_pu.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\evp_asn1.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\f_enum.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\f_int.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\f_string.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\i2d_pr.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\i2d_pu.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\n_pkey.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\nsseq.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\p5_pbe.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\p5_pbev2.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\p8_pkey.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\t_bitst.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\t_crl.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\t_pkey.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\t_req.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\t_spki.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\t_x509.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\t_x509a.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\tasn_dec.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\tasn_enc.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\tasn_fre.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\tasn_new.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\tasn_prn.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\tasn_typ.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\tasn_utl.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_algor.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_attrib.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_bignum.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_crl.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_exten.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_info.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_long.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_name.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_nx509.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_pkey.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_pubkey.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_req.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_sig.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_spki.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_val.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_x509.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\asn1\x_x509a.c"> + <Filter>Source Files\crypto\asn1</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\objects\o_names.c"> + <Filter>Source Files\crypto\objects</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\objects\obj_dat.c"> + <Filter>Source Files\crypto\objects</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\objects\obj_err.c"> + <Filter>Source Files\crypto\objects</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\objects\obj_lib.c"> + <Filter>Source Files\crypto\objects</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\objects\obj_xref.c"> + <Filter>Source Files\crypto\objects</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\bio_b64.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\bio_enc.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\bio_md.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\bio_ok.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\c_all.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\c_allc.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\c_alld.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\digest.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\e_aes.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\e_bf.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\e_camellia.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\e_cast.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\e_des.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\e_des3.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\e_idea.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\e_null.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\e_old.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\e_rc2.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\e_rc4.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\e_rc5.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\e_seed.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\e_xcbc_d.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\encode.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\evp_acnf.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\evp_enc.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\evp_err.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\evp_key.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\evp_lib.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\evp_pbe.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\evp_pkey.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\m_dss.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\m_dss1.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\m_ecdsa.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\m_md2.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\m_md4.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\m_md5.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\m_mdc2.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\m_null.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\m_ripemd.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\m_sha.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\m_sha1.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\m_sigver.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\m_wp.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\names.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\openbsd_hw.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\p5_crpt.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\p5_crpt2.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\p_dec.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\p_enc.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\p_lib.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\p_open.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\p_seal.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\p_sign.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\p_verify.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\pmeth_fn.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\pmeth_gn.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\evp\pmeth_lib.c"> + <Filter>Source Files\crypto\evp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\buffer\buf_err.c"> + <Filter>Source Files\crypto\buffer</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\buffer\buffer.c"> + <Filter>Source Files\crypto\buffer</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cms\cms_asn1.c"> + <Filter>Source Files\crypto\cms</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cms\cms_att.c"> + <Filter>Source Files\crypto\cms</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cms\cms_cd.c"> + <Filter>Source Files\crypto\cms</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cms\cms_dd.c"> + <Filter>Source Files\crypto\cms</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cms\cms_enc.c"> + <Filter>Source Files\crypto\cms</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cms\cms_env.c"> + <Filter>Source Files\crypto\cms</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cms\cms_err.c"> + <Filter>Source Files\crypto\cms</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cms\cms_ess.c"> + <Filter>Source Files\crypto\cms</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cms\cms_io.c"> + <Filter>Source Files\crypto\cms</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cms\cms_lib.c"> + <Filter>Source Files\crypto\cms</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cms\cms_sd.c"> + <Filter>Source Files\crypto\cms</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\cms\cms_smime.c"> + <Filter>Source Files\crypto\cms</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\eng_all.c"> + <Filter>Source Files\crypto\engine</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\eng_cnf.c"> + <Filter>Source Files\crypto\engine</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\eng_cryptodev.c"> + <Filter>Source Files\crypto\engine</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\eng_ctrl.c"> + <Filter>Source Files\crypto\engine</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\eng_dyn.c"> + <Filter>Source Files\crypto\engine</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\eng_err.c"> + <Filter>Source Files\crypto\engine</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\eng_fat.c"> + <Filter>Source Files\crypto\engine</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\eng_init.c"> + <Filter>Source Files\crypto\engine</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\eng_lib.c"> + <Filter>Source Files\crypto\engine</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\eng_list.c"> + <Filter>Source Files\crypto\engine</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\eng_openssl.c"> + <Filter>Source Files\crypto\engine</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\eng_pkey.c"> + <Filter>Source Files\crypto\engine</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\eng_table.c"> + <Filter>Source Files\crypto\engine</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\tb_asnmth.c"> + <Filter>Source Files\crypto\engine</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\tb_cipher.c"> + <Filter>Source Files\crypto\engine</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\tb_dh.c"> + <Filter>Source Files\crypto\engine</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\tb_digest.c"> + <Filter>Source Files\crypto\engine</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\tb_dsa.c"> + <Filter>Source Files\crypto\engine</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\tb_ecdh.c"> + <Filter>Source Files\crypto\engine</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\tb_ecdsa.c"> + <Filter>Source Files\crypto\engine</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\tb_pkmeth.c"> + <Filter>Source Files\crypto\engine</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\tb_rand.c"> + <Filter>Source Files\crypto\engine</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\tb_rsa.c"> + <Filter>Source Files\crypto\engine</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\engine\tb_store.c"> + <Filter>Source Files\crypto\engine</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\stack\stack.c"> + <Filter>Source Files\crypto\stack</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs7\bio_pk7.c"> + <Filter>Source Files\crypto\pkcs7</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs7\pk7_asn1.c"> + <Filter>Source Files\crypto\pkcs7</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs7\pk7_attr.c"> + <Filter>Source Files\crypto\pkcs7</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs7\pk7_doit.c"> + <Filter>Source Files\crypto\pkcs7</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs7\pk7_lib.c"> + <Filter>Source Files\crypto\pkcs7</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs7\pk7_mime.c"> + <Filter>Source Files\crypto\pkcs7</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs7\pk7_smime.c"> + <Filter>Source Files\crypto\pkcs7</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs7\pkcs7err.c"> + <Filter>Source Files\crypto\pkcs7</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dh\dh_ameth.c"> + <Filter>Source Files\crypto\dh</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dh\dh_asn1.c"> + <Filter>Source Files\crypto\dh</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dh\dh_check.c"> + <Filter>Source Files\crypto\dh</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dh\dh_depr.c"> + <Filter>Source Files\crypto\dh</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dh\dh_err.c"> + <Filter>Source Files\crypto\dh</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dh\dh_gen.c"> + <Filter>Source Files\crypto\dh</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dh\dh_key.c"> + <Filter>Source Files\crypto\dh</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dh\dh_lib.c"> + <Filter>Source Files\crypto\dh</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dh\dh_pmeth.c"> + <Filter>Source Files\crypto\dh</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dh\dh_prn.c"> + <Filter>Source Files\crypto\dh</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ocsp\ocsp_asn.c"> + <Filter>Source Files\crypto\ocsp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ocsp\ocsp_cl.c"> + <Filter>Source Files\crypto\ocsp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ocsp\ocsp_err.c"> + <Filter>Source Files\crypto\ocsp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ocsp\ocsp_ext.c"> + <Filter>Source Files\crypto\ocsp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ocsp\ocsp_ht.c"> + <Filter>Source Files\crypto\ocsp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ocsp\ocsp_lib.c"> + <Filter>Source Files\crypto\ocsp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ocsp\ocsp_prn.c"> + <Filter>Source Files\crypto\ocsp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ocsp\ocsp_srv.c"> + <Filter>Source Files\crypto\ocsp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ocsp\ocsp_vfy.c"> + <Filter>Source Files\crypto\ocsp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\pcy_cache.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\pcy_data.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\pcy_lib.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\pcy_map.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\pcy_node.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\pcy_tree.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_addr.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_akey.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_akeya.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_alt.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_asid.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_bcons.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_bitst.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_conf.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_cpols.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_crld.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_enum.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_extku.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_genn.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_ia5.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_info.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_int.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_lib.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_ncons.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_ocsp.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_pci.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_pcia.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_pcons.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_pku.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_pmaps.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_prn.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_purp.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_skey.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_sxnet.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3_utl.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\x509v3\v3err.c"> + <Filter>Source Files\crypto\x509v3</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ts\ts_asn1.c"> + <Filter>Source Files\crypto\ts</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ts\ts_conf.c"> + <Filter>Source Files\crypto\ts</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ts\ts_err.c"> + <Filter>Source Files\crypto\ts</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ts\ts_lib.c"> + <Filter>Source Files\crypto\ts</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ts\ts_req_print.c"> + <Filter>Source Files\crypto\ts</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ts\ts_req_utils.c"> + <Filter>Source Files\crypto\ts</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ts\ts_rsp_print.c"> + <Filter>Source Files\crypto\ts</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ts\ts_rsp_sign.c"> + <Filter>Source Files\crypto\ts</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ts\ts_rsp_utils.c"> + <Filter>Source Files\crypto\ts</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ts\ts_rsp_verify.c"> + <Filter>Source Files\crypto\ts</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ts\ts_verify_ctx.c"> + <Filter>Source Files\crypto\ts</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\conf\conf_api.c"> + <Filter>Source Files\crypto\conf</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\conf\conf_def.c"> + <Filter>Source Files\crypto\conf</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\conf\conf_err.c"> + <Filter>Source Files\crypto\conf</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\conf\conf_lib.c"> + <Filter>Source Files\crypto\conf</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\conf\conf_mall.c"> + <Filter>Source Files\crypto\conf</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\conf\conf_mod.c"> + <Filter>Source Files\crypto\conf</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\conf\conf_sap.c"> + <Filter>Source Files\crypto\conf</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ec2_mult.c"> + <Filter>Source Files\crypto\ec</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ec2_smpl.c"> + <Filter>Source Files\crypto\ec</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ec_ameth.c"> + <Filter>Source Files\crypto\ec</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ec_asn1.c"> + <Filter>Source Files\crypto\ec</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ec_check.c"> + <Filter>Source Files\crypto\ec</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ec_curve.c"> + <Filter>Source Files\crypto\ec</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ec_cvt.c"> + <Filter>Source Files\crypto\ec</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ec_err.c"> + <Filter>Source Files\crypto\ec</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ec_key.c"> + <Filter>Source Files\crypto\ec</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ec_lib.c"> + <Filter>Source Files\crypto\ec</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ec_mult.c"> + <Filter>Source Files\crypto\ec</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ec_pmeth.c"> + <Filter>Source Files\crypto\ec</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ec_print.c"> + <Filter>Source Files\crypto\ec</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\eck_prn.c"> + <Filter>Source Files\crypto\ec</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ecp_mont.c"> + <Filter>Source Files\crypto\ec</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ecp_nist.c"> + <Filter>Source Files\crypto\ec</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ec\ecp_smpl.c"> + <Filter>Source Files\crypto\ec</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ecdh\ech_err.c"> + <Filter>Source Files\crypto\ecdh</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ecdh\ech_key.c"> + <Filter>Source Files\crypto\ecdh</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ecdh\ech_lib.c"> + <Filter>Source Files\crypto\ecdh</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ecdh\ech_ossl.c"> + <Filter>Source Files\crypto\ecdh</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ecdsa\ecs_asn1.c"> + <Filter>Source Files\crypto\ecdsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ecdsa\ecs_err.c"> + <Filter>Source Files\crypto\ecdsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ecdsa\ecs_lib.c"> + <Filter>Source Files\crypto\ecdsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ecdsa\ecs_ossl.c"> + <Filter>Source Files\crypto\ecdsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ecdsa\ecs_sign.c"> + <Filter>Source Files\crypto\ecdsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\ecdsa\ecs_vrf.c"> + <Filter>Source Files\crypto\ecdsa</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\md5\md5_dgst.c"> + <Filter>Source Files\crypto\md5</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\md5\md5_one.c"> + <Filter>Source Files\crypto\md5</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\md4\md4_dgst.c"> + <Filter>Source Files\crypto\md4</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\md4\md4_one.c"> + <Filter>Source Files\crypto\md4</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\lhash\lh_stats.c"> + <Filter>Source Files\crypto\lhash</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\lhash\lhash.c"> + <Filter>Source Files\crypto\lhash</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dso\dso_beos.c"> + <Filter>Source Files\crypto\dso</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dso\dso_dl.c"> + <Filter>Source Files\crypto\dso</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dso\dso_dlfcn.c"> + <Filter>Source Files\crypto\dso</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dso\dso_err.c"> + <Filter>Source Files\crypto\dso</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dso\dso_lib.c"> + <Filter>Source Files\crypto\dso</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dso\dso_null.c"> + <Filter>Source Files\crypto\dso</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dso\dso_openssl.c"> + <Filter>Source Files\crypto\dso</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dso\dso_vms.c"> + <Filter>Source Files\crypto\dso</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\dso\dso_win32.c"> + <Filter>Source Files\crypto\dso</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs12\p12_add.c"> + <Filter>Source Files\crypto\pkcs12</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs12\p12_asn.c"> + <Filter>Source Files\crypto\pkcs12</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs12\p12_attr.c"> + <Filter>Source Files\crypto\pkcs12</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs12\p12_crpt.c"> + <Filter>Source Files\crypto\pkcs12</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs12\p12_crt.c"> + <Filter>Source Files\crypto\pkcs12</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs12\p12_decr.c"> + <Filter>Source Files\crypto\pkcs12</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs12\p12_init.c"> + <Filter>Source Files\crypto\pkcs12</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs12\p12_key.c"> + <Filter>Source Files\crypto\pkcs12</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs12\p12_kiss.c"> + <Filter>Source Files\crypto\pkcs12</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs12\p12_mutl.c"> + <Filter>Source Files\crypto\pkcs12</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs12\p12_npas.c"> + <Filter>Source Files\crypto\pkcs12</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs12\p12_p8d.c"> + <Filter>Source Files\crypto\pkcs12</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs12\p12_p8e.c"> + <Filter>Source Files\crypto\pkcs12</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs12\p12_utl.c"> + <Filter>Source Files\crypto\pkcs12</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pkcs12\pk12err.c"> + <Filter>Source Files\crypto\pkcs12</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\hmac\hm_ameth.c"> + <Filter>Source Files\crypto\hmac</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\hmac\hm_pmeth.c"> + <Filter>Source Files\crypto\hmac</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\hmac\hmac.c"> + <Filter>Source Files\crypto\hmac</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\sha\sha1_one.c"> + <Filter>Source Files\crypto\sha</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\sha\sha1dgst.c"> + <Filter>Source Files\crypto\sha</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\sha\sha256.c"> + <Filter>Source Files\crypto\sha</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\sha\sha512.c"> + <Filter>Source Files\crypto\sha</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\sha\sha512t.c"> + <Filter>Source Files\crypto\sha</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\sha\sha_dgst.c"> + <Filter>Source Files\crypto\sha</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\sha\sha_one.c"> + <Filter>Source Files\crypto\sha</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\comp\c_rle.c"> + <Filter>Source Files\crypto\comp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\comp\c_zlib.c"> + <Filter>Source Files\crypto\comp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\comp\comp_err.c"> + <Filter>Source Files\crypto\comp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\comp\comp_lib.c"> + <Filter>Source Files\crypto\comp</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pem\pem_all.c"> + <Filter>Source Files\crypto\pem</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pem\pem_err.c"> + <Filter>Source Files\crypto\pem</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pem\pem_info.c"> + <Filter>Source Files\crypto\pem</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pem\pem_lib.c"> + <Filter>Source Files\crypto\pem</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pem\pem_oth.c"> + <Filter>Source Files\crypto\pem</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pem\pem_pk8.c"> + <Filter>Source Files\crypto\pem</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pem\pem_pkey.c"> + <Filter>Source Files\crypto\pem</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pem\pem_seal.c"> + <Filter>Source Files\crypto\pem</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pem\pem_sign.c"> + <Filter>Source Files\crypto\pem</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pem\pem_x509.c"> + <Filter>Source Files\crypto\pem</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pem\pem_xaux.c"> + <Filter>Source Files\crypto\pem</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pem\pvkfmt.c"> + <Filter>Source Files\crypto\pem</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\whrlpool\wp_block.c"> + <Filter>Source Files\crypto\whrlpool</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\whrlpool\wp_dgst.c"> + <Filter>Source Files\crypto\whrlpool</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\mdc2\mdc2_one.c"> + <Filter>Source Files\crypto\mdc2</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\mdc2\mdc2dgst.c"> + <Filter>Source Files\crypto\mdc2</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\krb5\krb5_asn.c"> + <Filter>Source Files\crypto\krb5</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\txt_db\txt_db.c"> + <Filter>Source Files\crypto\txt_db</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\crypto\pqueue\pqueue.c"> + <Filter>Source Files\crypto\pqueue</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ms\uplink.c"> + <Filter>Source Files\ms</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\openssl-1.0.0a\e_os.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\crypto\cryptlib.h"> + <Filter>Header Files\crypto</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\crypto\o_dir.h"> + <Filter>Header Files\crypto</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\crypto\o_str.h"> + <Filter>Header Files\crypto</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\crypto\o_time.h"> + <Filter>Header Files\crypto</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\crypto\evp\evp_locl.h"> + <Filter>Header Files\crypto\evp</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\aes.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\asn1.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\asn1_mac.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\asn1t.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\bio.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\blowfish.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\bn.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\buffer.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\camellia.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\cast.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\cms.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\comp.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\conf.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\conf_api.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\crypto.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\des.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\des_old.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\dh.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\dsa.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\dso.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\dtls1.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\e_os2.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\ebcdic.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\ec.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\ecdh.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\ecdsa.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\engine.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\err.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\evp.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\hmac.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\idea.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\krb5_asn.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\kssl.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\lhash.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\md4.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\md5.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\mdc2.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\modes.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\obj_mac.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\objects.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\ocsp.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\opensslconf.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\opensslv.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\ossl_typ.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\pem.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\pem2.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\pkcs12.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\pkcs7.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\pqueue.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\rand.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\rc2.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\rc4.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\ripemd.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\rsa.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\safestack.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\seed.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\sha.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\ssl.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\ssl2.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\ssl23.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\ssl3.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\stack.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\symhacks.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\tls1.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\ts.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\txt_db.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\ui.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\ui_compat.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\whrlpool.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\x509.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\x509_vfy.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\include\openssl\x509v3.h"> + <Filter>Header Files\openssl</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\crypto\bf\bf_locl.h"> + <Filter>Header Files\bf</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\crypto\bf\bf_pi.h"> + <Filter>Header Files\bf</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\crypto\bf\blowfish.h"> + <Filter>Header Files\bf</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\ms\uplink.h"> + <Filter>Header Files\ms</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/win32/openssl/openssl.2010.vcxproj b/libs/win32/openssl/openssl.2010.vcxproj new file mode 100644 index 0000000..fbc98fc --- /dev/null +++ b/libs/win32/openssl/openssl.2010.vcxproj @@ -0,0 +1,258 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>openssl</ProjectName> + <ProjectGuid>{25BD39B1-C8BF-4676-A738-9CABD9C6BC79}</ProjectGuid> + <RootNamespace>openssl</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\w32\extdll.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\w32\extdll.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\w32\extdll.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\w32\extdll.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <AdditionalOptions>/Gs0 %(AdditionalOptions)</AdditionalOptions> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <AdditionalIncludeDirectories>..\..\openssl-1.0.0a\include;..\..\openssl-1.0.0a;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;OPENSSL_THREADS;MONOLITH;DSO_WIN32;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_RC5;OPENSSL_NO_MD2;OPENSSL_NO_KRB5;OPENSSL_NO_JPAKE;OPENSSL_NO_STATIC_ENGINE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>Default</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4996;4133;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>$(ProjectDir)$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <AdditionalOptions>/Gs0 %(AdditionalOptions)</AdditionalOptions> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>..\..\openssl-1.0.0a\include;..\..\openssl-1.0.0a;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CONSOLE;OPENSSL_THREADS;MONOLITH;DSO_WIN32;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_RC5;OPENSSL_NO_MD2;OPENSSL_NO_KRB5;OPENSSL_NO_JPAKE;OPENSSL_NO_STATIC_ENGINE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>Default</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4996;4133;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>$(ProjectDir)$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <AdditionalOptions>/Gs0 %(AdditionalOptions)</AdditionalOptions> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <AdditionalIncludeDirectories>..\..\openssl-1.0.0a\include;..\..\openssl-1.0.0a;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;OPENSSL_THREADS;MONOLITH;DSO_WIN32;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_RC5;OPENSSL_NO_MD2;OPENSSL_NO_KRB5;OPENSSL_NO_JPAKE;OPENSSL_NO_STATIC_ENGINE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>Default</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4996;4133;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <AdditionalDependencies>libeay32.lib;ssleay32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>$(ProjectDir)$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <AdditionalOptions>/Gs0 %(AdditionalOptions)</AdditionalOptions> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <IntrinsicFunctions>true</IntrinsicFunctions> + <AdditionalIncludeDirectories>..\..\openssl-1.0.0a\include;..\..\openssl-1.0.0a;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CONSOLE;OPENSSL_THREADS;MONOLITH;DSO_WIN32;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_RC5;OPENSSL_NO_MD2;OPENSSL_NO_KRB5;OPENSSL_NO_JPAKE;OPENSSL_NO_STATIC_ENGINE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <MinimalRebuild>true</MinimalRebuild> + <BasicRuntimeChecks>Default</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <DisableSpecificWarnings>4996;4133;%(DisableSpecificWarnings)</DisableSpecificWarnings> + </ClCompile> + <Link> + <AdditionalDependencies>libeay32.lib;ssleay32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>$(ProjectDir)$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <GenerateDebugInformation>true</GenerateDebugInformation> + <SubSystem>Console</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\openssl-1.0.0a\apps\app_rand.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\apps.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\asn1pars.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\ca.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\ciphers.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\cms.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\crl.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\crl2p7.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\dgst.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\dh.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\dhparam.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\dsa.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\dsaparam.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\ec.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\ecparam.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\enc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\engine.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\errstr.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\gendh.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\gendsa.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\genpkey.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\genrsa.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\nseq.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\ocsp.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\openssl.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\passwd.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\pkcs12.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\pkcs7.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\pkcs8.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\pkey.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\pkeyparam.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\pkeyutl.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\prime.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\rand.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\req.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\rsa.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\rsautl.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\s_cb.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\s_client.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\s_server.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\s_socket.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\s_time.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\sess_id.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\smime.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\speed.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\spkac.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\ts.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\verify.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\version.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\winrand.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\apps\x509.c" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\openssl-1.0.0a\apps\apps.h" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="libeay32.2010.vcxproj"> + <Project>{d331904d-a00a-4694-a5a3-fcff64ab5dbe}</Project> + </ProjectReference> + <ProjectReference Include="ssleay32.2010.vcxproj"> + <Project>{b4b62169-5ad4-4559-8707-3d933ac5db39}</Project> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/libs/win32/openssl/openssl.2010.vcxproj.filters b/libs/win32/openssl/openssl.2010.vcxproj.filters new file mode 100644 index 0000000..e568b7a --- /dev/null +++ b/libs/win32/openssl/openssl.2010.vcxproj.filters @@ -0,0 +1,179 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Source Files\apps"> + <UniqueIdentifier>{cf6ed228-8b22-4124-ad73-05c2a9dc3ba9}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Header Files\apps"> + <UniqueIdentifier>{059be3d7-da1e-4270-8f05-a6772ccc5e10}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\openssl-1.0.0a\apps\app_rand.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\apps.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\asn1pars.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\ca.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\ciphers.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\cms.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\crl.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\crl2p7.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\dgst.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\dh.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\dhparam.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\dsa.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\dsaparam.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\ec.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\ecparam.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\enc.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\engine.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\errstr.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\gendh.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\gendsa.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\genpkey.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\genrsa.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\nseq.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\ocsp.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\openssl.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\passwd.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\pkcs12.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\pkcs7.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\pkcs8.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\pkey.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\pkeyparam.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\pkeyutl.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\prime.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\rand.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\req.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\rsa.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\rsautl.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\s_cb.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\s_client.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\s_server.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\s_socket.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\s_time.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\sess_id.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\smime.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\speed.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\spkac.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\ts.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\verify.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\version.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\winrand.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\apps\x509.c"> + <Filter>Source Files\apps</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\openssl-1.0.0a\apps\apps.h"> + <Filter>Header Files\apps</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/win32/openssl/ssleay32.2010.vcxproj b/libs/win32/openssl/ssleay32.2010.vcxproj new file mode 100644 index 0000000..c124bae --- /dev/null +++ b/libs/win32/openssl/ssleay32.2010.vcxproj @@ -0,0 +1,250 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectName>ssleay32</ProjectName> + <ProjectGuid>{B4B62169-5AD4-4559-8707-3D933AC5DB39}</ProjectGuid> + <RootNamespace>ssleay32</RootNamespace> + <Keyword>Win32Proj</Keyword> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <CLRSupport>false</CLRSupport> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <CLRSupport>false</CLRSupport> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <CLRSupport>false</CLRSupport> + <WholeProgramOptimization>true</WholeProgramOptimization> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>DynamicLibrary</ConfigurationType> + <CharacterSet>Unicode</CharacterSet> + <CLRSupport>false</CLRSupport> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\w32\extdll.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\w32\extdll.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\w32\extdll.props" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + <Import Project="..\..\..\w32\extdll.props" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <PreBuildEvent> + <Command>copy /Y $(ProjectDir)ssleay32.def $(ProjectDir)..\..\openssl-1.0.0a\ssleay32.def</Command> + </PreBuildEvent> + <ClCompile> + <AdditionalOptions>/Gs0 %(AdditionalOptions)</AdditionalOptions> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <AdditionalIncludeDirectories>..\..\openssl-1.0.0a\include;..\..\openssl-1.0.0a\crypto;..\..\openssl-1.0.0a;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;DSO_WIN32;OPENSSL_THREADS;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_RC5;OPENSSL_NO_MD2;OPENSSL_NO_KRB5;OPENSSL_NO_JPAKE;OPENSSL_NO_STATIC_ENGINE;_WINDLL;OPENSSL_BUILD_SHLIBSSL;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalLibraryDirectories>$(ProjectDir)$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ModuleDefinitionFile>ssleay32.def</ModuleDefinitionFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <AssemblyDebug>true</AssemblyDebug> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <PreBuildEvent> + <Command>copy /Y $(ProjectDir)ssleay32.def $(ProjectDir)..\..\openssl-1.0.0a\ssleay32.def</Command> + </PreBuildEvent> + <ClCompile> + <AdditionalOptions>/Gs0 %(AdditionalOptions)</AdditionalOptions> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <AdditionalIncludeDirectories>..\..\openssl-1.0.0a\include;..\..\openssl-1.0.0a\crypto;..\..\openssl-1.0.0a;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;DSO_WIN32;OPENSSL_THREADS;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_RC5;OPENSSL_NO_MD2;OPENSSL_NO_KRB5;OPENSSL_NO_JPAKE;OPENSSL_NO_STATIC_ENGINE;_WINDLL;OPENSSL_BUILD_SHLIBSSL;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <TreatWarningAsError>true</TreatWarningAsError> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalLibraryDirectories>$(ProjectDir)$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ModuleDefinitionFile>ssleay32.def</ModuleDefinitionFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <AssemblyDebug>true</AssemblyDebug> + <TargetMachine>MachineX86</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <PreBuildEvent> + <Command>copy /Y $(ProjectDir)ssleay32.def $(ProjectDir)..\..\openssl-1.0.0a\ssleay32.def</Command> + </PreBuildEvent> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <AdditionalOptions>/Gs0 %(AdditionalOptions)</AdditionalOptions> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <AdditionalIncludeDirectories>..\..\openssl-1.0.0a\include;..\..\openssl-1.0.0a\crypto;..\..\openssl-1.0.0a;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;DSO_WIN32;OPENSSL_THREADS;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_RC5;OPENSSL_NO_MD2;OPENSSL_NO_KRB5;OPENSSL_NO_JPAKE;OPENSSL_NO_STATIC_ENGINE;_WINDLL;OPENSSL_BUILD_SHLIBSSL;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalDependencies>libeay32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>$(ProjectDir)$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ModuleDefinitionFile>ssleay32.def</ModuleDefinitionFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <AssemblyDebug>true</AssemblyDebug> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <PreBuildEvent> + <Command>copy /Y $(ProjectDir)ssleay32.def $(ProjectDir)..\..\openssl-1.0.0a\ssleay32.def</Command> + </PreBuildEvent> + <Midl> + <TargetEnvironment>X64</TargetEnvironment> + </Midl> + <ClCompile> + <AdditionalOptions>/Gs0 %(AdditionalOptions)</AdditionalOptions> + <Optimization>MaxSpeed</Optimization> + <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> + <AdditionalIncludeDirectories>..\..\openssl-1.0.0a\include;..\..\openssl-1.0.0a\crypto;..\..\openssl-1.0.0a;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;DSO_WIN32;OPENSSL_THREADS;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_RC5;OPENSSL_NO_MD2;OPENSSL_NO_KRB5;OPENSSL_NO_JPAKE;OPENSSL_NO_STATIC_ENGINE;_WINDLL;OPENSSL_BUILD_SHLIBSSL;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + </ClCompile> + <Link> + <AdditionalDependencies>libeay32.lib;%(AdditionalDependencies)</AdditionalDependencies> + <AdditionalLibraryDirectories>$(ProjectDir)$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + <ModuleDefinitionFile>ssleay32.def</ModuleDefinitionFile> + <GenerateDebugInformation>true</GenerateDebugInformation> + <AssemblyDebug>true</AssemblyDebug> + <TargetMachine>MachineX64</TargetMachine> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\bio_ssl.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\d1_both.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\d1_clnt.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\d1_enc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\d1_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\d1_meth.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\d1_pkt.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\d1_srvr.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\kssl.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s23_clnt.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s23_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s23_meth.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s23_pkt.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s23_srvr.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s2_clnt.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s2_enc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s2_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s2_meth.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s2_pkt.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s2_srvr.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s3_both.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s3_clnt.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s3_enc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s3_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s3_meth.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s3_pkt.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s3_srvr.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\ssl_algs.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\ssl_asn1.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\ssl_cert.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\ssl_ciph.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\ssl_err.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\ssl_err2.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\ssl_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\ssl_rsa.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\ssl_sess.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\ssl_stat.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\ssl_txt.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\t1_clnt.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\t1_enc.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\t1_lib.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\t1_meth.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\t1_reneg.c" /> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\t1_srvr.c" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\openssl-1.0.0a\crypto\cryptlib.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\crypto\o_dir.h" /> + <ClInclude Include="..\..\openssl-1.0.0a\crypto\evp\evp_locl.h" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="libeay32.2010.vcxproj"> + <Project>{d331904d-a00a-4694-a5a3-fcff64ab5dbe}</Project> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file diff --git a/libs/win32/openssl/ssleay32.2010.vcxproj.filters b/libs/win32/openssl/ssleay32.2010.vcxproj.filters new file mode 100644 index 0000000..4007284 --- /dev/null +++ b/libs/win32/openssl/ssleay32.2010.vcxproj.filters @@ -0,0 +1,167 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> + <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> + </Filter> + <Filter Include="Source Files\ssl"> + <UniqueIdentifier>{f25bde33-475c-4870-aa63-95c0a3bcf356}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + <Filter Include="Header Files\crypto"> + <UniqueIdentifier>{0a4387d1-72f1-4eaf-96bd-d83822dea414}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files\crypto\evp"> + <UniqueIdentifier>{8364f4d3-cb5e-498a-b5b1-46107d580c6c}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\bio_ssl.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\d1_both.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\d1_clnt.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\d1_enc.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\d1_lib.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\d1_meth.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\d1_pkt.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\d1_srvr.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\kssl.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s23_clnt.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s23_lib.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s23_meth.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s23_pkt.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s23_srvr.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s2_clnt.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s2_enc.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s2_lib.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s2_meth.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s2_pkt.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s2_srvr.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s3_both.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s3_clnt.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s3_enc.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s3_lib.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s3_meth.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s3_pkt.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\s3_srvr.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\ssl_algs.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\ssl_asn1.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\ssl_cert.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\ssl_ciph.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\ssl_err.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\ssl_err2.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\ssl_lib.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\ssl_rsa.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\ssl_sess.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\ssl_stat.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\ssl_txt.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\t1_clnt.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\t1_enc.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\t1_lib.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\t1_meth.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\t1_reneg.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + <ClCompile Include="..\..\openssl-1.0.0a\ssl\t1_srvr.c"> + <Filter>Source Files\ssl</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\openssl-1.0.0a\crypto\cryptlib.h"> + <Filter>Header Files\crypto</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\crypto\o_dir.h"> + <Filter>Header Files\crypto</Filter> + </ClInclude> + <ClInclude Include="..\..\openssl-1.0.0a\crypto\evp\evp_locl.h"> + <Filter>Header Files\crypto\evp</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/libs/win32/sofia/libsofia_sip_ua_static.2010.vcxproj b/libs/win32/sofia/libsofia_sip_ua_static.2010.vcxproj index 5c889fd..d841b89 100644 --- a/libs/win32/sofia/libsofia_sip_ua_static.2010.vcxproj +++ b/libs/win32/sofia/libsofia_sip_ua_static.2010.vcxproj @@ -78,7 +78,7 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd" </PreBuildEvent> <ClCompile> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-7-0-release;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-7-0-release;.;..\..\openssl-1.0.0a\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> @@ -98,12 +98,6 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd" <Bscmake> <SuppressStartupBanner>true</SuppressStartupBanner> </Bscmake> - <CustomBuildStep> - <Command> - </Command> - <Outputs> - </Outputs> - </CustomBuildStep> </ItemDefinitionGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <PreBuildEvent> @@ -120,7 +114,7 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd" </Midl> <ClCompile> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-7-0-release;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-7-0-release;.;..\..\openssl-1.0.0a\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>_WIN64;WIN32;_DEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> @@ -154,7 +148,7 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd" <ClCompile> <Optimization>MaxSpeed</Optimization> <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> - <AdditionalIncludeDirectories>..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-7-0-release;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-7-0-release;.;..\..\openssl-1.0.0a\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> <StringPooling>true</StringPooling> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> @@ -191,7 +185,7 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd" <ClCompile> <Optimization>MaxSpeed</Optimization> <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion> - <AdditionalIncludeDirectories>..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-7-0-release;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>..\..\sofia-sip\win32;..\..\sofia-sip\libsofia-sip-ua\su;..\..\sofia-sip\libsofia-sip-ua\ipt;..\..\sofia-sip\libsofia-sip-ua\sresolv;..\..\sofia-sip\libsofia-sip-ua\bnf;..\..\sofia-sip\libsofia-sip-ua\url;..\..\sofia-sip\libsofia-sip-ua\msg;..\..\sofia-sip\libsofia-sip-ua\sip;..\..\sofia-sip\libsofia-sip-ua\nta;..\..\sofia-sip\libsofia-sip-ua\nua;..\..\sofia-sip\libsofia-sip-ua\iptsec;..\..\sofia-sip\libsofia-sip-ua\http;..\..\sofia-sip\libsofia-sip-ua\nth;..\..\sofia-sip\libsofia-sip-ua\nea;..\..\sofia-sip\libsofia-sip-ua\sdp;..\..\sofia-sip\libsofia-sip-ua\soa;..\..\sofia-sip\libsofia-sip-ua\stun;..\..\sofia-sip\libsofia-sip-ua\tport;..\..\sofia-sip\libsofia-sip-ua\features;..\..\pthreads-w32-2-7-0-release;.;..\..\openssl-1.0.0a\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>_WIN64;WIN32;NDEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> <StringPooling>true</StringPooling> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> @@ -369,8 +363,10 @@ if not exist "$(ProjectDir)$(IntDir)\auth_client.obj" "autogen.cmd" <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\tport\tport_stub_stun.c" /> <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\tport\tport_tag.c" /> <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\tport\tport_tag_ref.c" /> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\tport\tport_tls.c" /> <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\tport\tport_type_connect.c" /> <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\tport\tport_type_tcp.c" /> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\tport\tport_type_tls.c" /> <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\tport\tport_type_udp.c" /> <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sdp\sdp.c" /> <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sdp\sdp_parse.c" /> diff --git a/libs/win32/sofia/libsofia_sip_ua_static.2010.vcxproj.filters b/libs/win32/sofia/libsofia_sip_ua_static.2010.vcxproj.filters new file mode 100644 index 0000000..6fe8785 --- /dev/null +++ b/libs/win32/sofia/libsofia_sip_ua_static.2010.vcxproj.filters @@ -0,0 +1,1019 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{e2fb9ce3-2e60-4ab8-a3f5-3acc0770c1fb}</UniqueIdentifier> + <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions> + </Filter> + <Filter Include="Source Files\su"> + <UniqueIdentifier>{07c4085c-ab49-4d20-b4f4-bcd30b90ce73}</UniqueIdentifier> + <Extensions>su*.c</Extensions> + </Filter> + <Filter Include="Source Files\ipt"> + <UniqueIdentifier>{f302ae4a-7736-4563-b130-a88f67fb8420}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\url"> + <UniqueIdentifier>{0bd6f7dc-1416-4eba-a83b-9728b0f5ff09}</UniqueIdentifier> + <Extensions>url*.c</Extensions> + </Filter> + <Filter Include="Source Files\features"> + <UniqueIdentifier>{7d12ef13-6833-4299-a002-4cfa700aab08}</UniqueIdentifier> + <Extensions>features*.c</Extensions> + </Filter> + <Filter Include="Source Files\bnf"> + <UniqueIdentifier>{503e3513-dc29-4a8d-968f-eb9b85e37831}</UniqueIdentifier> + <Extensions>bnf*.c</Extensions> + </Filter> + <Filter Include="Source Files\msg"> + <UniqueIdentifier>{3680f590-87b0-43fc-93d4-2f055947608c}</UniqueIdentifier> + <Extensions>msg*.c</Extensions> + </Filter> + <Filter Include="Source Files\clib replacement"> + <UniqueIdentifier>{71b15ca9-401c-4587-8b0e-1cbd01761e4c}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\sip"> + <UniqueIdentifier>{777999e7-603f-4e2a-be29-0933e5d56c0d}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\http"> + <UniqueIdentifier>{0b33e411-4f7e-4275-9d87-9d674a0a294f}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\nth"> + <UniqueIdentifier>{3e4054e5-d5cf-498d-afe4-feaee3b0df04}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\sresolv"> + <UniqueIdentifier>{92d282a8-1180-42cf-baea-3b826d7fc6da}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\nea"> + <UniqueIdentifier>{5dfb833d-6d12-41e4-9b84-35faae36eac9}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\iptsec"> + <UniqueIdentifier>{ce2f9d87-410e-4558-8fb0-564ae88af551}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\stun"> + <UniqueIdentifier>{a631bda8-f647-4fe1-92d1-6929887d822c}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\nua"> + <UniqueIdentifier>{e7f1aa28-e4cd-4563-bb81-46e761435d07}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\nta"> + <UniqueIdentifier>{c608280f-e56c-4f2b-94a8-052eac15f6e5}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\tport"> + <UniqueIdentifier>{00e7d1cc-bb3a-4e76-b6b1-11db89ed6701}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\sdp"> + <UniqueIdentifier>{6b3531f0-aab2-44d2-8319-185e40c5c739}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files\soa"> + <UniqueIdentifier>{c1b1203d-95fa-41e3-bdea-df2b9915c4b9}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{ab318891-9ef3-4e56-baf7-8ce922a73e45}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + <Filter Include="Header Files\su headers"> + <UniqueIdentifier>{af1f4a99-a82d-4e82-b6ce-94a3cf7d1c37}</UniqueIdentifier> + <Extensions>su*.h</Extensions> + </Filter> + <Filter Include="Header Files\win32 headers"> + <UniqueIdentifier>{861289c7-2dec-4715-b158-2b3e00ab6040}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files\ipt headers"> + <UniqueIdentifier>{ee802dd4-b53b-43d1-bdf2-3d4343d37779}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files\url headers"> + <UniqueIdentifier>{bb636639-0b7f-41ed-a549-438d02a7d3ac}</UniqueIdentifier> + <Extensions>url*.h</Extensions> + </Filter> + <Filter Include="Header Files\features headers"> + <UniqueIdentifier>{d294ad27-4906-495b-8be4-5fc8aa291f3a}</UniqueIdentifier> + <Extensions>features*.h</Extensions> + </Filter> + <Filter Include="Header Files\bnf headers"> + <UniqueIdentifier>{566a4c1d-8cbb-4570-a8e8-3d1c6a6e3f71}</UniqueIdentifier> + <Extensions>bnf*.h</Extensions> + </Filter> + <Filter Include="Header Files\msg headers"> + <UniqueIdentifier>{32c05478-a038-4b7d-bb4b-d33b82ab576d}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files\sip headers"> + <UniqueIdentifier>{84dbad62-348f-4e67-a48e-d8d22526b4a8}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files\http headers"> + <UniqueIdentifier>{1441bb2b-94f7-4cbe-a4fc-82e7a88af588}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files\nth headers"> + <UniqueIdentifier>{bce41b99-f79a-45ee-9634-d0859695014f}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files\sresolv headers"> + <UniqueIdentifier>{ce670254-9dd6-4e3c-99ad-90f78c69d766}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files\nea headers"> + <UniqueIdentifier>{3b978047-99c5-4fd4-99fe-200151c76fd1}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files\iptsec headers"> + <UniqueIdentifier>{e9eaad41-1195-4c26-b813-d101ff7bf4f2}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files\stun headers"> + <UniqueIdentifier>{9ec1016a-8c36-4a62-bd3f-e226b3a6b479}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files\nua headers"> + <UniqueIdentifier>{4a392d00-3246-42cb-bff9-7b4f7889d8f2}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files\nta headers"> + <UniqueIdentifier>{e8343a7f-eed9-4051-85b0-d02fd78c06f1}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files\tport headers"> + <UniqueIdentifier>{17f68ee6-6245-4c14-8bda-387799431553}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files\sdp headers"> + <UniqueIdentifier>{b08ddec7-8118-4a9d-8606-c62ffcbafc97}</UniqueIdentifier> + </Filter> + <Filter Include="Header Files\soa headers"> + <UniqueIdentifier>{de42c0cc-17b9-4768-9981-abf8765ec30b}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\inet_ntop.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\inet_pton.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\smoothsort.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\string0.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su_addrinfo.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su_alloc.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su_alloc_lock.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su_base_port.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su_bm.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su_default_log.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su_errno.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su_global_log.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su_localinfo.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su_log.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su_md5.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su_os_nw.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su_port.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su_pthread_port.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su_root.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su_socket_port.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su_sprintf.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su_strdup.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su_string.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su_strlst.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su_tag.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su_tag_io.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su_taglist.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su_time.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su_time0.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su_timer.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su_uniqueid.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su_vector.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su_wait.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\su_win32_port.c"> + <Filter>Source Files\su</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\ipt\base64.c"> + <Filter>Source Files\ipt</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\ipt\rc4.c"> + <Filter>Source Files\ipt</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\ipt\token64.c"> + <Filter>Source Files\ipt</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\url\url.c"> + <Filter>Source Files\url</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\url\url_tag.c"> + <Filter>Source Files\url</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\url\url_tag_ref.c"> + <Filter>Source Files\url</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\features\features.c"> + <Filter>Source Files\features</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\bnf\bnf.c"> + <Filter>Source Files\bnf</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\msg\msg.c"> + <Filter>Source Files\msg</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\msg\msg_auth.c"> + <Filter>Source Files\msg</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\msg\msg_basic.c"> + <Filter>Source Files\msg</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\msg\msg_date.c"> + <Filter>Source Files\msg</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\msg\msg_generic.c"> + <Filter>Source Files\msg</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\msg\msg_header_copy.c"> + <Filter>Source Files\msg</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\msg\msg_header_make.c"> + <Filter>Source Files\msg</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\msg\msg_mclass.c"> + <Filter>Source Files\msg</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\msg\msg_mime.c"> + <Filter>Source Files\msg</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\msg\msg_mime_table.c"> + <Filter>Source Files\msg</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\msg\msg_parser.c"> + <Filter>Source Files\msg</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\msg\msg_parser_util.c"> + <Filter>Source Files\msg</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\msg\msg_tag.c"> + <Filter>Source Files\msg</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\memcspn.c"> + <Filter>Source Files\clib replacement</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\memmem.c"> + <Filter>Source Files\clib replacement</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\memspn.c"> + <Filter>Source Files\clib replacement</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\strcasestr.c"> + <Filter>Source Files\clib replacement</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\su\strtoull.c"> + <Filter>Source Files\clib replacement</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sip\sip_basic.c"> + <Filter>Source Files\sip</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sip\sip_caller_prefs.c"> + <Filter>Source Files\sip</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sip\sip_event.c"> + <Filter>Source Files\sip</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sip\sip_extra.c"> + <Filter>Source Files\sip</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sip\sip_feature.c"> + <Filter>Source Files\sip</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sip\sip_header.c"> + <Filter>Source Files\sip</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sip\sip_mime.c"> + <Filter>Source Files\sip</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sip\sip_parser.c"> + <Filter>Source Files\sip</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sip\sip_parser_table.c"> + <Filter>Source Files\sip</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sip\sip_prack.c"> + <Filter>Source Files\sip</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sip\sip_pref_util.c"> + <Filter>Source Files\sip</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sip\sip_reason.c"> + <Filter>Source Files\sip</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sip\sip_refer.c"> + <Filter>Source Files\sip</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sip\sip_security.c"> + <Filter>Source Files\sip</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sip\sip_session.c"> + <Filter>Source Files\sip</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sip\sip_status.c"> + <Filter>Source Files\sip</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sip\sip_tag.c"> + <Filter>Source Files\sip</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sip\sip_tag_class.c"> + <Filter>Source Files\sip</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sip\sip_tag_ref.c"> + <Filter>Source Files\sip</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sip\sip_time.c"> + <Filter>Source Files\sip</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sip\sip_util.c"> + <Filter>Source Files\sip</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\http\http_basic.c"> + <Filter>Source Files\http</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\http\http_extra.c"> + <Filter>Source Files\http</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\http\http_header.c"> + <Filter>Source Files\http</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\http\http_parser.c"> + <Filter>Source Files\http</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\http\http_parser_table.c"> + <Filter>Source Files\http</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\http\http_status.c"> + <Filter>Source Files\http</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\http\http_tag.c"> + <Filter>Source Files\http</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\http\http_tag_class.c"> + <Filter>Source Files\http</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\http\http_tag_ref.c"> + <Filter>Source Files\http</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nth\nth_client.c"> + <Filter>Source Files\nth</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nth\nth_server.c"> + <Filter>Source Files\nth</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nth\nth_tag.c"> + <Filter>Source Files\nth</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nth\nth_tag_ref.c"> + <Filter>Source Files\nth</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sresolv\sres.c"> + <Filter>Source Files\sresolv</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sresolv\sres_blocking.c"> + <Filter>Source Files\sresolv</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sresolv\sres_cache.c"> + <Filter>Source Files\sresolv</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sresolv\sres_sip.c"> + <Filter>Source Files\sresolv</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sresolv\sresolv.c"> + <Filter>Source Files\sresolv</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nea\nea.c"> + <Filter>Source Files\nea</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nea\nea_debug.c"> + <Filter>Source Files\nea</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nea\nea_event.c"> + <Filter>Source Files\nea</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nea\nea_server.c"> + <Filter>Source Files\nea</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nea\nea_tag.c"> + <Filter>Source Files\nea</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nea\nea_tag_ref.c"> + <Filter>Source Files\nea</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\iptsec\auth_client.c"> + <Filter>Source Files\iptsec</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\iptsec\auth_common.c"> + <Filter>Source Files\iptsec</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\iptsec\auth_digest.c"> + <Filter>Source Files\iptsec</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\iptsec\auth_module.c"> + <Filter>Source Files\iptsec</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\iptsec\auth_module_http.c"> + <Filter>Source Files\iptsec</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\iptsec\auth_module_sip.c"> + <Filter>Source Files\iptsec</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\iptsec\auth_plugin.c"> + <Filter>Source Files\iptsec</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\iptsec\auth_plugin_delayed.c"> + <Filter>Source Files\iptsec</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\iptsec\auth_tag.c"> + <Filter>Source Files\iptsec</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\iptsec\auth_tag_ref.c"> + <Filter>Source Files\iptsec</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\iptsec\iptsec_debug.c"> + <Filter>Source Files\iptsec</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\stun\stun.c"> + <Filter>Source Files\stun</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\stun\stun_common.c"> + <Filter>Source Files\stun</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\stun\stun_dns.c"> + <Filter>Source Files\stun</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\stun\stun_mini.c"> + <Filter>Source Files\stun</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\stun\stun_tag.c"> + <Filter>Source Files\stun</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\stun\stun_tag_ref.c"> + <Filter>Source Files\stun</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nua\nua.c"> + <Filter>Source Files\nua</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nua\nua_client.c"> + <Filter>Source Files\nua</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nua\nua_common.c"> + <Filter>Source Files\nua</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nua\nua_dialog.c"> + <Filter>Source Files\nua</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nua\nua_event_server.c"> + <Filter>Source Files\nua</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nua\nua_extension.c"> + <Filter>Source Files\nua</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nua\nua_message.c"> + <Filter>Source Files\nua</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nua\nua_notifier.c"> + <Filter>Source Files\nua</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nua\nua_options.c"> + <Filter>Source Files\nua</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nua\nua_params.c"> + <Filter>Source Files\nua</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nua\nua_publish.c"> + <Filter>Source Files\nua</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nua\nua_register.c"> + <Filter>Source Files\nua</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nua\nua_registrar.c"> + <Filter>Source Files\nua</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nua\nua_server.c"> + <Filter>Source Files\nua</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nua\nua_session.c"> + <Filter>Source Files\nua</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nua\nua_stack.c"> + <Filter>Source Files\nua</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nua\nua_subnotref.c"> + <Filter>Source Files\nua</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nua\nua_tag.c"> + <Filter>Source Files\nua</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nua\nua_tag_ref.c"> + <Filter>Source Files\nua</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nua\outbound.c"> + <Filter>Source Files\nua</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nta\nta.c"> + <Filter>Source Files\nta</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nta\nta_check.c"> + <Filter>Source Files\nta</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nta\nta_tag.c"> + <Filter>Source Files\nta</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nta\nta_tag_ref.c"> + <Filter>Source Files\nta</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nta\sl_read_payload.c"> + <Filter>Source Files\nta</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nta\sl_utils_log.c"> + <Filter>Source Files\nta</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\nta\sl_utils_print.c"> + <Filter>Source Files\nta</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\tport\tport.c"> + <Filter>Source Files\tport</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\tport\tport_logging.c"> + <Filter>Source Files\tport</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\tport\tport_stub_sigcomp.c"> + <Filter>Source Files\tport</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\tport\tport_stub_stun.c"> + <Filter>Source Files\tport</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\tport\tport_tag.c"> + <Filter>Source Files\tport</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\tport\tport_tag_ref.c"> + <Filter>Source Files\tport</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\tport\tport_tls.c"> + <Filter>Source Files\tport</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\tport\tport_type_connect.c"> + <Filter>Source Files\tport</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\tport\tport_type_tcp.c"> + <Filter>Source Files\tport</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\tport\tport_type_tls.c"> + <Filter>Source Files\tport</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\tport\tport_type_udp.c"> + <Filter>Source Files\tport</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sdp\sdp.c"> + <Filter>Source Files\sdp</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sdp\sdp_parse.c"> + <Filter>Source Files\sdp</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sdp\sdp_print.c"> + <Filter>Source Files\sdp</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sdp\sdp_tag.c"> + <Filter>Source Files\sdp</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\sdp\sdp_tag_ref.c"> + <Filter>Source Files\sdp</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\soa\soa.c"> + <Filter>Source Files\soa</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\soa\soa_static.c"> + <Filter>Source Files\soa</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\soa\soa_tag.c"> + <Filter>Source Files\soa</Filter> + </ClCompile> + <ClCompile Include="..\..\sofia-sip\libsofia-sip-ua\soa\soa_tag_ref.c"> + <Filter>Source Files\soa</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\stun\stun_internal.h"> + <Filter>Source Files\stun</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\nua\nua_client.h"> + <Filter>Source Files\nua</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\nua\nua_dialog.h"> + <Filter>Source Files\nua</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\nua\nua_params.h"> + <Filter>Source Files\nua</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\nua\nua_server.h"> + <Filter>Source Files\nua</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\nua\nua_stack.h"> + <Filter>Source Files\nua</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\tport\tport_internal.h"> + <Filter>Source Files\tport</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\soa\sofia-sip\soa_session.h"> + <Filter>Source Files\soa</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\htable.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\htable2.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\rbtree.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\string0.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\su.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\su_addrinfo.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\su_alloc.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\su_alloc_stat.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\su_bm.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\su_config.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\su_debug.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\su_errno.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\su_localinfo.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\su_log.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\su_md5.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\su_module_debug.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\su_os_nw.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\su_port.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\su_source.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\su_string.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\su_strlst.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\su_tag.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\su_tag_class.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\su_tag_inline.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\su_tag_io.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\su_tagarg.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\su_time.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\su_types.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\su_uniqueid.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\su_vector.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\su_wait.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\su\sofia-sip\tstdef.h"> + <Filter>Header Files\su headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\win32\config.h"> + <Filter>Header Files\win32 headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\win32\sofia-sip\su_configure.h"> + <Filter>Header Files\win32 headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\win32\unistd.h"> + <Filter>Header Files\win32 headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\ipt\sofia-sip\base64.h"> + <Filter>Header Files\ipt headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\ipt\sofia-sip\rc4.h"> + <Filter>Header Files\ipt headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\ipt\sofia-sip\token64.h"> + <Filter>Header Files\ipt headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\url\sofia-sip\url.h"> + <Filter>Header Files\url headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\url\sofia-sip\url_tag.h"> + <Filter>Header Files\url headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\url\sofia-sip\url_tag_class.h"> + <Filter>Header Files\url headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\features\sofia-sip\sofia_features.h"> + <Filter>Header Files\features headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\bnf\sofia-sip\bnf.h"> + <Filter>Header Files\bnf headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\bnf\sofia-sip\hostdomain.h"> + <Filter>Header Files\bnf headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\msg\sofia-sip\msg.h"> + <Filter>Header Files\msg headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\msg\sofia-sip\msg_addr.h"> + <Filter>Header Files\msg headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\msg\msg_bnf.h"> + <Filter>Header Files\msg headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\msg\sofia-sip\msg_buffer.h"> + <Filter>Header Files\msg headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\msg\sofia-sip\msg_date.h"> + <Filter>Header Files\msg headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\msg\sofia-sip\msg_header.h"> + <Filter>Header Files\msg headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\msg\msg_internal.h"> + <Filter>Header Files\msg headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\msg\sofia-sip\msg_mclass.h"> + <Filter>Header Files\msg headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\msg\sofia-sip\msg_mclass_hash.h"> + <Filter>Header Files\msg headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\msg\sofia-sip\msg_mime.h"> + <Filter>Header Files\msg headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\msg\sofia-sip\msg_mime_protos.h"> + <Filter>Header Files\msg headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\msg\sofia-sip\msg_parser.h"> + <Filter>Header Files\msg headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\msg\sofia-sip\msg_protos.h"> + <Filter>Header Files\msg headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\msg\sofia-sip\msg_tag_class.h"> + <Filter>Header Files\msg headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\msg\sofia-sip\msg_types.h"> + <Filter>Header Files\msg headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\sip\sofia-sip\sip.h"> + <Filter>Header Files\sip headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\sip\sip_extensions.h"> + <Filter>Header Files\sip headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\sip\sofia-sip\sip_hclasses.h"> + <Filter>Header Files\sip headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\sip\sofia-sip\sip_header.h"> + <Filter>Header Files\sip headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\sip\sip_internal.h"> + <Filter>Header Files\sip headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\sip\sofia-sip\sip_parser.h"> + <Filter>Header Files\sip headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\sip\sofia-sip\sip_protos.h"> + <Filter>Header Files\sip headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\sip\sofia-sip\sip_status.h"> + <Filter>Header Files\sip headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\sip\sofia-sip\sip_tag.h"> + <Filter>Header Files\sip headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\sip\sofia-sip\sip_tag_class.h"> + <Filter>Header Files\sip headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\sip\sofia-sip\sip_util.h"> + <Filter>Header Files\sip headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\http\sofia-sip\http.h"> + <Filter>Header Files\http headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\http\sofia-sip\http_hclasses.h"> + <Filter>Header Files\http headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\http\sofia-sip\http_header.h"> + <Filter>Header Files\http headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\http\sofia-sip\http_parser.h"> + <Filter>Header Files\http headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\http\sofia-sip\http_protos.h"> + <Filter>Header Files\http headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\http\sofia-sip\http_status.h"> + <Filter>Header Files\http headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\http\sofia-sip\http_tag.h"> + <Filter>Header Files\http headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\http\sofia-sip\http_tag_class.h"> + <Filter>Header Files\http headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\nth\sofia-sip\nth.h"> + <Filter>Header Files\nth headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\nth\sofia-sip\nth_tag.h"> + <Filter>Header Files\nth headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\sresolv\sofia-resolv\sres.h"> + <Filter>Header Files\sresolv headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\sresolv\sofia-resolv\sres_async.h"> + <Filter>Header Files\sresolv headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\sresolv\sofia-resolv\sres_cache.h"> + <Filter>Header Files\sresolv headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\sresolv\sofia-resolv\sres_record.h"> + <Filter>Header Files\sresolv headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\sresolv\sofia-sip\sres_sip.h"> + <Filter>Header Files\sresolv headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\sresolv\sofia-sip\sresolv.h"> + <Filter>Header Files\sresolv headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\nea\sofia-sip\nea.h"> + <Filter>Header Files\nea headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\nea\nea_debug.h"> + <Filter>Header Files\nea headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\nea\sofia-sip\nea_tag.h"> + <Filter>Header Files\nea headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\iptsec\sofia-sip\auth_client.h"> + <Filter>Header Files\iptsec headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\iptsec\sofia-sip\auth_digest.h"> + <Filter>Header Files\iptsec headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\iptsec\sofia-sip\auth_module.h"> + <Filter>Header Files\iptsec headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\iptsec\sofia-sip\auth_ntlm.h"> + <Filter>Header Files\iptsec headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\iptsec\sofia-sip\auth_plugin.h"> + <Filter>Header Files\iptsec headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\iptsec\iptsec_debug.h"> + <Filter>Header Files\iptsec headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\stun\sofia-sip\stun.h"> + <Filter>Header Files\stun headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\stun\sofia-sip\stun_common.h"> + <Filter>Header Files\stun headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\stun\sofia-sip\stun_tag.h"> + <Filter>Header Files\stun headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\nua\sofia-sip\nua.h"> + <Filter>Header Files\nua headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\nua\sofia-sip\nua_tag.h"> + <Filter>Header Files\nua headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\nta\sofia-sip\nta.h"> + <Filter>Header Files\nta headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\nta\nta_internal.h"> + <Filter>Header Files\nta headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\nta\sofia-sip\nta_stateless.h"> + <Filter>Header Files\nta headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\nta\sofia-sip\nta_tag.h"> + <Filter>Header Files\nta headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\nta\sofia-sip\nta_tport.h"> + <Filter>Header Files\nta headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\nta\sofia-sip\sl_utils.h"> + <Filter>Header Files\nta headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\tport\sofia-sip\tport.h"> + <Filter>Header Files\tport headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\tport\sofia-sip\tport_plugins.h"> + <Filter>Header Files\tport headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\tport\sofia-sip\tport_tag.h"> + <Filter>Header Files\tport headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\tport\tport_tls.h"> + <Filter>Header Files\tport headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\sdp\sofia-sip\sdp.h"> + <Filter>Header Files\sdp headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\sdp\sofia-sip\sdp_tag.h"> + <Filter>Header Files\sdp headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\soa\sofia-sip\soa.h"> + <Filter>Header Files\soa headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\soa\sofia-sip\soa_add.h"> + <Filter>Header Files\soa headers</Filter> + </ClInclude> + <ClInclude Include="..\..\sofia-sip\libsofia-sip-ua\soa\sofia-sip\soa_tag.h"> + <Filter>Header Files\soa headers</Filter> + </ClInclude> + </ItemGroup> +</Project> \ No newline at end of file diff --git a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.2010.vcxproj b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.2010.vcxproj index 72ac117..ca533a4 100644 --- a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.2010.vcxproj +++ b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.2010.vcxproj @@ -183,9 +183,14 @@ <Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project> <ReferenceOutputAssembly>false</ReferenceOutputAssembly> </ProjectReference> + <ProjectReference Include="..\..\..\..\libs\win32\openssl\libeay32.2010.vcxproj"> + <Project>{d331904d-a00a-4694-a5a3-fcff64ab5dbe}</Project> + </ProjectReference> + <ProjectReference Include="..\..\..\..\libs\win32\openssl\ssleay32.2010.vcxproj"> + <Project>{b4b62169-5ad4-4559-8707-3d933ac5db39}</Project> + </ProjectReference> <ProjectReference Include="..\..\..\..\libs\win32\sofia\libsofia_sip_ua_static.2010.vcxproj"> <Project>{70a49bc2-7500-41d0-b75d-edcc5be987a0}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> </ProjectReference> <ProjectReference Include="..\..\..\..\w32\Library\FreeSwitchCore.2010.vcxproj"> <Project>{202d7a4e-760d-4d0e-afa1-d7459ced30ff}</Project> diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.2010.vcxproj b/src/mod/endpoints/mod_sofia/mod_sofia.2010.vcxproj index 21505d0..ab53d06 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.2010.vcxproj +++ b/src/mod/endpoints/mod_sofia/mod_sofia.2010.vcxproj @@ -153,13 +153,18 @@ <Project>{f6c55d93-b927-4483-bb69-15aef3dd2dff}</Project> <ReferenceOutputAssembly>false</ReferenceOutputAssembly> </ProjectReference> + <ProjectReference Include="..\..\..\..\libs\win32\openssl\libeay32.2010.vcxproj"> + <Project>{d331904d-a00a-4694-a5a3-fcff64ab5dbe}</Project> + </ProjectReference> + <ProjectReference Include="..\..\..\..\libs\win32\openssl\ssleay32.2010.vcxproj"> + <Project>{b4b62169-5ad4-4559-8707-3d933ac5db39}</Project> + </ProjectReference> <ProjectReference Include="..\..\..\..\libs\win32\pthread\pthread.2010.vcxproj"> <Project>{df018947-0fff-4eb3-bdee-441dc81da7a4}</Project> <ReferenceOutputAssembly>false</ReferenceOutputAssembly> </ProjectReference> <ProjectReference Include="..\..\..\..\libs\win32\sofia\libsofia_sip_ua_static.2010.vcxproj"> <Project>{70a49bc2-7500-41d0-b75d-edcc5be987a0}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> </ProjectReference> <ProjectReference Include="..\..\..\..\w32\Library\FreeSwitchCore.2010.vcxproj"> <Project>{202d7a4e-760d-4d0e-afa1-d7459ced30ff}</Project> commit b38909af0efe948d93e4e691d501036cbe33cbd8 Author: Mathieu Rene <mrene@avgs.ca> Date: Wed Aug 18 18:26:57 2010 -0400 esl: init fd_flags to 0 diff --git a/libs/esl/src/esl.c b/libs/esl/src/esl.c index 48be3f9..160fe2d 100644 --- a/libs/esl/src/esl.c +++ b/libs/esl/src/esl.c @@ -614,7 +614,7 @@ ESL_DECLARE(esl_status_t) esl_connect_timeout(esl_handle_t *handle, const char * const char *hval; struct addrinfo hints = { 0 }, *result; #ifndef WIN32 - int fd_flags; + int fd_flags = 0; #else WORD wVersionRequested = MAKEWORD(2, 0); WSADATA wsaData; commit f1aead3174a0efe8862b9f2c314912efb33cf90d Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Aug 18 15:33:18 2010 -0500 increase sps during recovery diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 6e07a1c..0868d93 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3544,12 +3544,22 @@ SWITCH_STANDARD_API(sofia_function) sofia_glue_recover(SWITCH_TRUE); stream->write_function(stream, "Flushing recovery database.\n"); } else { - int x = sofia_glue_recover(SWITCH_FALSE); + int32_t old = 0, x = 0; + + switch_core_session_ctl(SCSC_SPS, &old); + + x = 10000000; + switch_core_session_ctl(SCSC_SPS, &x); + + x = sofia_glue_recover(SWITCH_FALSE); + if (x) { stream->write_function(stream, "Recovered %d call(s)\n", x); } else { stream->write_function(stream, "No calls to recover.\n"); } + + switch_core_session_ctl(SCSC_SPS, &old); } goto done; commit 96b790fa2ec59c2958fa904b7a04df93d1217447 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Aug 18 14:58:14 2010 -0500 BOUNTY-20 diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 2791692..6e07a1c 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3783,7 +3783,12 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session } if (!strncasecmp(dest, "sip:", 4) || !strncasecmp(dest, "sips:", 5)) { + char *c; tech_pvt->dest = switch_core_session_strdup(nsession, dest); + if ((c = strchr(tech_pvt->dest, ':'))) { + c++; + tech_pvt->e_dest = switch_core_session_strdup(nsession, c); + } } else if ((host = strchr(dest, '%'))) { char buf[1024]; *host = '@'; @@ -3812,6 +3817,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session } else { host++; tech_pvt->dest = switch_core_session_alloc(nsession, strlen(dest) + 5); + tech_pvt->e_dest = switch_core_session_strdup(nsession, dest); switch_snprintf(tech_pvt->dest, strlen(dest) + 5, "sip:%s", dest); } } @@ -4173,40 +4179,45 @@ static void general_event_handler(switch_event_t *event) const char *body = switch_event_get_body(event); sofia_profile_t *profile; nua_handle_t *nh; - + if (profile_name && ct && user && host) { char *id = NULL; char *contact, *p; - char buf[512] = ""; - + switch_console_callback_match_t *list = NULL; + switch_console_callback_match_node_t *m; + if (!(profile = sofia_glue_find_profile(profile_name))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find profile %s\n", profile_name); return; } - - - if (!sofia_reg_find_reg_url(profile, user, host, buf, sizeof(buf))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find user %s@%s\n", user, host); + + if (!(list = sofia_reg_find_reg_url_multi(profile, user, host))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find registered user %s@%s\n", user, host); return; } id = switch_mprintf("sip:%s@%s", user, host); switch_assert(id); - contact = sofia_glue_get_url_from_contact(buf, 0); - if ((p = strstr(contact, ";fs_"))) { - *p = '\0'; - } + for (m = list->head; m; m = m->next) { + contact = sofia_glue_get_url_from_contact(m->val, 0); - nh = nua_handle(profile->nua, - NULL, NUTAG_URL(contact), SIPTAG_FROM_STR(id), SIPTAG_TO_STR(id), SIPTAG_CONTACT_STR(profile->url), TAG_END()); + if ((p = strstr(contact, ";fs_"))) { + *p = '\0'; + } + + nh = nua_handle(profile->nua, + NULL, NUTAG_URL(contact), SIPTAG_FROM_STR(id), SIPTAG_TO_STR(id), SIPTAG_CONTACT_STR(profile->url), TAG_END()); - nua_message(nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR(ct), - TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)), TAG_IF(!zstr(subject), SIPTAG_SUBJECT_STR(subject)), TAG_END()); + nua_message(nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR(ct), + TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)), TAG_IF(!zstr(subject), SIPTAG_SUBJECT_STR(subject)), TAG_END()); - free(id); + free(id); + } + switch_console_free_matches(&list); + sofia_glue_release_profile(profile); } diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 98ea119..78db36e 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -216,6 +216,7 @@ typedef enum { PFLAG_EXTENDED_INFO_PARSING, PFLAG_T38_PASSTHRU, PFLAG_CID_IN_1XX, + PFLAG_IN_DIALOG_CHAT, /* No new flags below this line */ PFLAG_MAX } PFLAGS; @@ -698,6 +699,7 @@ struct private_object { struct callback_t { char *val; switch_size_t len; + switch_console_callback_match_t *list; int matches; }; @@ -1003,3 +1005,4 @@ void sofia_glue_copy_t38_options(switch_t38_options_t *t38_options, switch_core_ switch_t38_options_t *sofia_glue_extract_t38_options(switch_core_session_t *session, const char *r_sdp); char *sofia_glue_get_multipart(switch_core_session_t *session, const char *prefix, const char *sdp, char **mp_type); void sofia_glue_tech_simplify(private_object_t *tech_pvt); +switch_console_callback_match_t *sofia_reg_find_reg_url_multi(sofia_profile_t *profile, const char *user, const char *host); diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index b9ff9e3..0a0c641 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2211,6 +2211,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) } else { sofia_clear_pflag(profile, PFLAG_PASS_CALLEE_ID); } + } else if (!strcasecmp(var, "in-dialog-chat")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_IN_DIALOG_CHAT); + } else { + sofia_clear_pflag(profile, PFLAG_IN_DIALOG_CHAT); + } } else if (!strcasecmp(var, "disable-hold")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_DISABLE_HOLD); @@ -2865,6 +2871,12 @@ switch_status_t config_sofia(int reload, char *profile_name) } else { sofia_clear_pflag(profile, PFLAG_LOG_AUTH_FAIL); } + } else if (!strcasecmp(var, "in-dialog-chat")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_IN_DIALOG_CHAT); + } else { + sofia_clear_pflag(profile, PFLAG_IN_DIALOG_CHAT); + } } else if (!strcasecmp(var, "t38-passthru")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_T38_PASSTHRU); @@ -6748,7 +6760,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ sofia_private->is_call++; tech_pvt->sofia_private = sofia_private; - if ((profile->pres_type)) { + if (profile->pres_type && sofia_test_pflag(profile, PFLAG_IN_DIALOG_CHAT)) { sofia_presence_set_chat_hash(tech_pvt, sip); } switch_copy_string(tech_pvt->sofia_private->uuid, switch_core_session_get_uuid(session), sizeof(tech_pvt->sofia_private->uuid)); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index d78e690..580b5e7 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1968,7 +1968,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) nua_handle_bind(tech_pvt->nh, tech_pvt->sofia_private); } - if (tech_pvt->e_dest) { + if (tech_pvt->e_dest && sofia_test_pflag(tech_pvt->profile, PFLAG_IN_DIALOG_CHAT)) { char *user = NULL, *host = NULL; char hash_key[256] = ""; diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 845fb60..c6c0cca 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -73,7 +73,6 @@ struct presence_helper { switch_status_t sofia_presence_chat_send(const char *proto, const char *from, const char *to, const char *subject, const char *body, const char *type, const char *hint) { - char buf[256]; char *prof = NULL, *user = NULL, *host = NULL; sofia_profile_t *profile = NULL; char *ffrom = NULL; @@ -84,6 +83,8 @@ switch_status_t sofia_presence_chat_send(const char *proto, const char *from, co const char *ct = "text/html"; sofia_destination_t *dst = NULL; char *to_uri = NULL; + switch_console_callback_match_t *list = NULL; + switch_console_callback_match_node_t *m; if (!to) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing To: header.\n"); @@ -133,17 +134,19 @@ switch_status_t sofia_presence_chat_send(const char *proto, const char *from, co host = prof; } } - - if (!to_uri && !sofia_reg_find_reg_url(profile, user, host, buf, sizeof(buf))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find user. [%s][%s]\n", user, host); + + if (to_uri) { + switch_console_push_match(&list, to_uri); + } else if (!(list = sofia_reg_find_reg_url_multi(profile, user, host))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find registered user %s@%s\n", user, host); goto end; } - + if (!strcasecmp(proto, SOFIA_CHAT_PROTO)) { from = hint; } else { char *fp, *p = NULL; - + fp = strdup(from); if (!fp) { @@ -168,23 +171,28 @@ switch_status_t sofia_presence_chat_send(const char *proto, const char *from, co switch_safe_free(fp); } - if (!(dst = sofia_glue_get_destination(to_uri ? to_uri : buf))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n"); - goto end; - } - - /* sofia_glue is running sofia_overcome_sip_uri_weakness we do not, not sure if it matters */ - - status = SWITCH_STATUS_SUCCESS; - /* if this cries, add contact here too, change the 1 to 0 and omit the safe_free */ - msg_nh = nua_handle(profile->nua, NULL, TAG_IF(dst->route_uri, NUTAG_PROXY(dst->route_uri)), TAG_IF(dst->route, SIPTAG_ROUTE_STR(dst->route)), - SIPTAG_FROM_STR(from), TAG_IF(contact, NUTAG_URL(contact)), SIPTAG_TO_STR(dst->to), SIPTAG_CONTACT_STR(profile->url), TAG_END()); - nua_handle_bind(msg_nh, &mod_sofia_globals.destroy_private); - nua_message(msg_nh, SIPTAG_CONTENT_TYPE_STR(ct), SIPTAG_PAYLOAD_STR(body), TAG_END()); + for (m = list->head; m; m = m->next) { + if (!(dst = sofia_glue_get_destination(m->val))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n"); + break; + } + + /* sofia_glue is running sofia_overcome_sip_uri_weakness we do not, not sure if it matters */ + + status = SWITCH_STATUS_SUCCESS; + /* if this cries, add contact here too, change the 1 to 0 and omit the safe_free */ + msg_nh = nua_handle(profile->nua, NULL, TAG_IF(dst->route_uri, NUTAG_PROXY(dst->route_uri)), TAG_IF(dst->route, SIPTAG_ROUTE_STR(dst->route)), + SIPTAG_FROM_STR(from), TAG_IF(contact, NUTAG_URL(contact)), SIPTAG_TO_STR(dst->to), SIPTAG_CONTACT_STR(profile->url), TAG_END()); + nua_handle_bind(msg_nh, &mod_sofia_globals.destroy_private); + nua_message(msg_nh, SIPTAG_CONTENT_TYPE_STR(ct), SIPTAG_PAYLOAD_STR(body), TAG_END()); + sofia_glue_free_destination(dst); + } + + switch_console_free_matches(&list); end: - sofia_glue_free_destination(dst); + switch_safe_free(contact); switch_safe_free(ffrom); switch_safe_free(dup); @@ -2597,8 +2605,11 @@ void sofia_presence_handle_sip_i_message(int status, from_addr = switch_mprintf("%s@%s", from_user, from_host); - sofia_presence_set_hash_key(hash_key, sizeof(hash_key), sip); - if ((tech_pvt = (private_object_t *) switch_core_hash_find(profile->chat_hash, hash_key))) { + if (sofia_test_pflag(profile, PFLAG_IN_DIALOG_CHAT)) { + sofia_presence_set_hash_key(hash_key, sizeof(hash_key), sip); + } + + if (sofia_test_pflag(profile, PFLAG_IN_DIALOG_CHAT) && (tech_pvt = (private_object_t *) switch_core_hash_find(profile->chat_hash, hash_key))) { channel = switch_core_session_get_channel(tech_pvt->session); if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index be6041f..33f26e9 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -417,9 +417,15 @@ int sofia_reg_find_callback(void *pArg, int argc, char **argv, char **columnName { struct callback_t *cbt = (struct callback_t *) pArg; + if (!cbt->len) { + switch_console_push_match(&cbt->list, argv[0]); + cbt->matches++; + return 0; + } + switch_copy_string(cbt->val, argv[0], cbt->len); cbt->matches++; - return 0; + return cbt->matches == 1 ? 0 : 1; } int sofia_reg_nat_callback(void *pArg, int argc, char **argv, char **columnNames) @@ -709,6 +715,30 @@ char *sofia_reg_find_reg_url(sofia_profile_t *profile, const char *user, const c } +switch_console_callback_match_t *sofia_reg_find_reg_url_multi(sofia_profile_t *profile, const char *user, const char *host) +{ + struct callback_t cbt = { 0 }; + char sql[512] = ""; + + if (!user) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Called with null user!\n"); + return NULL; + } + + if (host) { + switch_snprintf(sql, sizeof(sql), "select contact from sip_registrations where sip_user='%s' and (sip_host='%s' or presence_hosts like '%%%s%%')", + user, host, host); + } else { + switch_snprintf(sql, sizeof(sql), "select contact from sip_registrations where sip_user='%s'", user); + } + + + sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_reg_find_callback, &cbt); + + return cbt.list; +} + + void sofia_reg_auth_challenge(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_regtype_t regtype, const char *realm, int stale) { switch_uuid_t uuid; diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index b32a61f..b9a2fea 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -379,7 +379,8 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) status = input_callback(session_a, event, SWITCH_INPUT_TYPE_EVENT, user_data, 0); } - if (event->event_id != SWITCH_EVENT_COMMAND || switch_core_session_receive_event(session_b, &event) != SWITCH_STATUS_SUCCESS) { + if ((event->event_id != SWITCH_EVENT_COMMAND && event->event_id != SWITCH_EVENT_MESSAGE) + || switch_core_session_receive_event(session_b, &event) != SWITCH_STATUS_SUCCESS) { switch_event_destroy(&event); } commit 00b514033c829933000958e518d3a41d126ee64d Author: Brian West <brian@freeswitch.org> Date: Wed Aug 18 14:16:37 2010 -0500 fix 302 to hangup in the two cases where switch_ivr_transfer is used and not in the case when it should carry on and follow the redirect diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index fdf57dc..b9ff9e3 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -3975,12 +3975,14 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Redirect: Transfering to %s %s %s\n", p_contact->m_url->url_user, sip_redirect_dialplan, sip_redirect_context); switch_ivr_session_transfer(a_session, p_contact->m_url->url_user, sip_redirect_dialplan, sip_redirect_context); + switch_channel_hangup(channel, SWITCH_CAUSE_REDIRECTION_TO_NEW_DESTINATION); } else if ((!strcmp(profile->sipip, p_contact->m_url->url_host)) || (profile->extsipip && !strcmp(profile->extsipip, p_contact->m_url->url_host)) || (switch_xml_locate_domain(p_contact->m_url->url_host, NULL, &root, &domain) == SWITCH_STATUS_SUCCESS)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Redirect: Transfering to %s\n", p_contact->m_url->url_user); switch_ivr_session_transfer(a_session, p_contact->m_url->url_user, NULL, NULL); + switch_channel_hangup(channel, SWITCH_CAUSE_REDIRECTION_TO_NEW_DESTINATION); switch_xml_free(root); } else { invite_contact = sofia_glue_strip_uri(full_contact); @@ -3996,7 +3998,6 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status free(stream.data); switch_core_session_rwunlock(a_session); - switch_channel_hangup(channel, SWITCH_CAUSE_REDIRECTION_TO_NEW_DESTINATION); } } else { su_home_t *home = su_home_new(sizeof(*home)); commit 437c7805367e4ab8c2a4098623cd706408b4ffa9 Author: Jeff Lenk <jeff@jefflenk.com> Date: Wed Aug 18 10:57:32 2010 -0500 MODSOFIA-92 - Remove OPENSSL_USE_APPLINK - not needed diff --git a/libs/win32/openssl/libeay32.2008.vcproj b/libs/win32/openssl/libeay32.2008.vcproj index 7edc1a9..84cc80b 100644 --- a/libs/win32/openssl/libeay32.2008.vcproj +++ b/libs/win32/openssl/libeay32.2008.vcproj @@ -55,7 +55,7 @@ Optimization="3" InlineFunctionExpansion="2" AdditionalIncludeDirectories=""..\..\openssl-1.0.0a\include";"..\..\openssl-1.0.0a\crypto";"..\..\openssl-1.0.0a\crypto\aes";"..\..\openssl-1.0.0a\crypto\asn1";"..\..\openssl-1.0.0a\crypto\bf";"..\..\openssl-1.0.0a\crypto\bio";"..\..\openssl-1.0.0a\crypto\bn";"..\..\openssl-1.0.0a\crypto\buffer";"..\..\openssl-1.0.0a\crypto\camellia";"..\..\openssl-1.0.0a\crypto\cast";"..\..\openssl-1.0.0a\crypto\cms";"..\..\openssl-1.0.0a\crypto\comp";"..\..\openssl-1.0.0a\crypto\conf";"..\..\openssl-1.0.0a\crypto\des";"..\..\openssl-1.0.0a\crypto\dh";"..\..\openssl-1.0.0a\crypto\dsa";"..\..\openssl-1.0.0a\crypto\dso";"..\..\openssl-1.0.0a\crypto\ec";"..\..\openssl-1.0.0a\crypto\ecdh";"..\..\openssl-1.0.0a\crypto\ecdsa";"..\..\openssl-1.0.0a\crypto\engine";"..\..\openssl-1.0.0a\crypto\err";"..\..\openssl-1.0.0a\crypto\evp";"..\..\openssl-1.0.0a\ms";"..\..\openssl-1.0.0a"" - PreprocessorDefinitions="WINDOWS;WIN32;_DEBUG;_CRT_NON_CONFORMING_SWPRINTFS;OPENSSL_THREADS;DSO_WIN32;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_ASM;OPENSSL_NO_GMP;OPENSSL_NO_JPAKE;OPENSSL_NO_KRB5;OPENSSL_NO_MD2;OPENSSL_NO_RFC3779;OPENSSL_NO_STORE;OPENSSL_NO_STATIC_ENGINE;OPENSSL_BUILD_SHLIBCRYPTO;MK1MF_BUILD" + PreprocessorDefinitions="WINDOWS;WIN32;_DEBUG;_CRT_NON_CONFORMING_SWPRINTFS;OPENSSL_THREADS;DSO_WIN32;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_NO_ASM;OPENSSL_NO_GMP;OPENSSL_NO_JPAKE;OPENSSL_NO_KRB5;OPENSSL_NO_MD2;OPENSSL_NO_RFC3779;OPENSSL_NO_STORE;OPENSSL_NO_STATIC_ENGINE;OPENSSL_BUILD_SHLIBCRYPTO;MK1MF_BUILD" StringPooling="true" RuntimeLibrary="2" EnableFunctionLevelLinking="true" @@ -224,7 +224,7 @@ Optimization="3" InlineFunctionExpansion="2" AdditionalIncludeDirectories=""..\..\openssl-1.0.0a\include";"..\..\openssl-1.0.0a\crypto";"..\..\openssl-1.0.0a\crypto\aes";"..\..\openssl-1.0.0a\crypto\asn1";"..\..\openssl-1.0.0a\crypto\bf";"..\..\openssl-1.0.0a\crypto\bio";"..\..\openssl-1.0.0a\crypto\bn";"..\..\openssl-1.0.0a\crypto\buffer";"..\..\openssl-1.0.0a\crypto\camellia";"..\..\openssl-1.0.0a\crypto\cast";"..\..\openssl-1.0.0a\crypto\cms";"..\..\openssl-1.0.0a\crypto\comp";"..\..\openssl-1.0.0a\crypto\conf";"..\..\openssl-1.0.0a\crypto\des";"..\..\openssl-1.0.0a\crypto\dh";"..\..\openssl-1.0.0a\crypto\dsa";"..\..\openssl-1.0.0a\crypto\dso";"..\..\openssl-1.0.0a\crypto\ec";"..\..\openssl-1.0.0a\crypto\ecdh";"..\..\openssl-1.0.0a\crypto\ecdsa";"..\..\openssl-1.0.0a\crypto\engine";"..\..\openssl-1.0.0a\crypto\err";"..\..\openssl-1.0.0a\crypto\evp";"..\..\openssl-1.0.0a\ms";"..\..\openssl-1.0.0a"" - PreprocessorDefinitions="WIN32;NDEBUG;_CRT_NON_CONFORMING_SWPRINTFS;OPENSSL_THREADS;DSO_WIN32;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_ASM;OPENSSL_NO_GMP;OPENSSL_NO_JPAKE;OPENSSL_NO_KRB5;OPENSSL_NO_MD2;OPENSSL_NO_RFC3779;OPENSSL_NO_STORE;OPENSSL_NO_STATIC_ENGINE;OPENSSL_BUILD_SHLIBCRYPTO;MK1MF_BUILD" + PreprocessorDefinitions="WIN32;NDEBUG;_CRT_NON_CONFORMING_SWPRINTFS;OPENSSL_THREADS;DSO_WIN32;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_NO_ASM;OPENSSL_NO_GMP;OPENSSL_NO_JPAKE;OPENSSL_NO_KRB5;OPENSSL_NO_MD2;OPENSSL_NO_RFC3779;OPENSSL_NO_STORE;OPENSSL_NO_STATIC_ENGINE;OPENSSL_BUILD_SHLIBCRYPTO;MK1MF_BUILD" StringPooling="true" RuntimeLibrary="2" EnableFunctionLevelLinking="true" @@ -310,7 +310,7 @@ Optimization="3" InlineFunctionExpansion="2" AdditionalIncludeDirectories=""..\..\openssl-1.0.0a\include";"..\..\openssl-1.0.0a\crypto";"..\..\openssl-1.0.0a\crypto\aes";"..\..\openssl-1.0.0a\crypto\asn1";"..\..\openssl-1.0.0a\crypto\bf";"..\..\openssl-1.0.0a\crypto\bio";"..\..\openssl-1.0.0a\crypto\bn";"..\..\openssl-1.0.0a\crypto\buffer";"..\..\openssl-1.0.0a\crypto\camellia";"..\..\openssl-1.0.0a\crypto\cast";"..\..\openssl-1.0.0a\crypto\cms";"..\..\openssl-1.0.0a\crypto\comp";"..\..\openssl-1.0.0a\crypto\conf";"..\..\openssl-1.0.0a\crypto\des";"..\..\openssl-1.0.0a\crypto\dh";"..\..\openssl-1.0.0a\crypto\dsa";"..\..\openssl-1.0.0a\crypto\dso";"..\..\openssl-1.0.0a\crypto\ec";"..\..\openssl-1.0.0a\crypto\ecdh";"..\..\openssl-1.0.0a\crypto\ecdsa";"..\..\openssl-1.0.0a\crypto\engine";"..\..\openssl-1.0.0a\crypto\err";"..\..\openssl-1.0.0a\crypto\evp";"..\..\openssl-1.0.0a\ms";"..\..\openssl-1.0.0a"" - PreprocessorDefinitions="WIN32;NDEBUG;_CRT_NON_CONFORMING_SWPRINTFS;OPENSSL_THREADS;DSO_WIN32;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_ASM;OPENSSL_NO_GMP;OPENSSL_NO_JPAKE;OPENSSL_NO_KRB5;OPENSSL_NO_MD2;OPENSSL_NO_RFC3779;OPENSSL_NO_STORE;OPENSSL_NO_STATIC_ENGINE;OPENSSL_BUILD_SHLIBCRYPTO;MK1MF_BUILD" + PreprocessorDefinitions="WIN32;NDEBUG;_CRT_NON_CONFORMING_SWPRINTFS;OPENSSL_THREADS;DSO_WIN32;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_NO_ASM;OPENSSL_NO_GMP;OPENSSL_NO_JPAKE;OPENSSL_NO_KRB5;OPENSSL_NO_MD2;OPENSSL_NO_RFC3779;OPENSSL_NO_STORE;OPENSSL_NO_STATIC_ENGINE;OPENSSL_BUILD_SHLIBCRYPTO;MK1MF_BUILD" StringPooling="true" RuntimeLibrary="2" EnableFunctionLevelLinking="true" commit a64061a24c1216b21c1b76c3d0f313783a9d9f54 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Aug 18 09:53:22 2010 -0500 doh diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 8dec04f..978bf46 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -785,7 +785,7 @@ SWITCH_DECLARE(switch_bool_t) switch_cache_db_test_reactive(switch_cache_db_hand switch_bool_t r = SWITCH_TRUE; if (!switch_test_flag((&runtime), SCF_AUTO_SCHEMAS)) { - switch_cache_db_execute_sql(dbh, test_sql, NULL); + switch_cache_db_execute_sql(dbh, (char *)test_sql, NULL); return SWITCH_TRUE; } commit c47d1ef81ce262e9e98220af0f56e3f7b1deeb38 Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Aug 18 09:37:01 2010 -0500 always run test sql even when auto schema is off diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 4293510..8dec04f 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -785,6 +785,7 @@ SWITCH_DECLARE(switch_bool_t) switch_cache_db_test_reactive(switch_cache_db_hand switch_bool_t r = SWITCH_TRUE; if (!switch_test_flag((&runtime), SCF_AUTO_SCHEMAS)) { + switch_cache_db_execute_sql(dbh, test_sql, NULL); return SWITCH_TRUE; } commit e4f90584a76c701e8ff67461814092c28310d34f Author: Anthony Minessale <anthm@freeswitch.org> Date: Wed Aug 18 09:20:59 2010 -0500 MODEVENT-68 diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index 3f7d680..be41760 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -1160,6 +1160,7 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event, status = switch_socket_recv(listener->sock, p, &mlen); if (prefs.done || (!SWITCH_STATUS_IS_BREAK(status) && status != SWITCH_STATUS_SUCCESS)) { + free(body); return SWITCH_STATUS_FALSE; } @@ -1462,6 +1463,7 @@ static switch_bool_t auth_api_command(listener_t *listener, const char *api_cmd, if (!strcasecmp(sneaky_commands[x], check_cmd)) { if (check_cmd == api_cmd) { if (arg) { + switch_safe_free(dup_arg); dup_arg = strdup(arg); check_cmd = dup_arg; if ((next = strchr(check_cmd, ' '))) { commit ada25f7261aab652b0f15907412955f6b25f2dc8 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Aug 17 19:54:46 2010 -0500 more verbose warning diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index b1bbf3b..be6041f 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -811,7 +811,9 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand to_host = from_host; if (!to_user || !to_host) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can not do authorization without a complete header\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can not do authorization without a complete header in REGISTER request from %s:%d\n", + network_ip, network_port); + nua_respond(nh, SIP_401_UNAUTHORIZED, NUTAG_WITH_THIS(nua), TAG_END()); switch_goto_int(r, 1, end); } commit c44a097156b98074863b77d78809f32c076d8e68 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Aug 17 19:26:19 2010 -0500 doh diff --git a/src/switch_channel.c b/src/switch_channel.c index 2ce9a80..6f33fa9 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2021,9 +2021,10 @@ SWITCH_DECLARE(void) switch_channel_set_hunt_caller_profile(switch_channel_t *ch switch_assert(channel->caller_profile != NULL); switch_mutex_lock(channel->profile_mutex); - caller_profile->direction = channel->direction; + channel->caller_profile->hunt_caller_profile = NULL; if (channel->caller_profile && caller_profile) { + caller_profile->direction = channel->direction; channel->caller_profile->hunt_caller_profile = caller_profile; } switch_mutex_unlock(channel->profile_mutex); commit c3c9bff7b323a45d61982ffe30bc2e61059ef14c Author: Michael S Collins <msc@freeswitch.org> Date: Tue Aug 17 15:32:19 2010 -0700 Update ChangeLog through August 17 diff --git a/docs/ChangeLog b/docs/ChangeLog index 99c87c5..0bc629e 100644 --- a/docs/ChangeLog +++ b/docs/ChangeLog @@ -11,11 +11,16 @@ freeswitch (1.0.7) build: add mod_spandsp to windows build (r:4fa8be62) build: merge -j option for bootstrap (r:abb7d2e5/FSBUILD-237) build: dont fail on bootstrap due to missing libs (r:ff960d78) + build: numerous tweaks to allow building on VS2010 + build: Fix build with --with-curl (r:e704f021/FSBUILD-285) + build: VS 2010 - Change to V4 framework, add SWIG v2.0 files to fix release build exceptions(temp fix till we upgrade all SWIG files) (r:812f4309) + build: Windows VS2010 build - remove strange characters (r:ba1546e0/FSBUILD-297) config: move limit.conf to db.conf config: Update VM phrase macros to voice option then action on main, config menus config: Remove 99xx extension numbers to avoid dp conflicts (r:0c9bb174/DP-17) config: update config example for caller-id-type (r:8f03a7cd) config: default to 48k since most sound cards can do that (r:170404a4) + config: Create RFC2822_DATE for use in emails. Some clients fail to sort emails properly without a Date: line. (r:a1f19d91) core: Add RTCP support (FSRTP-14) core: handle some errors on missing db handle conditions core: add ... and shutdown as a fail-safe when no modules are loaded @@ -50,21 +55,52 @@ freeswitch (1.0.7) core: fix uuid_media state change (r:2cc59f1e/FSCORE-615) core: add new callstate field to channels table (r:0f133eae) core: fix leg_timeout issue (r:3fbd9e21/MODAPP-433) + core: Add alternate timing method support for Windows XP and 2003 - must be conditionally compiled(default is original timing) (r:30d2e7fd/FSCORE-626) + core: Fix fail to parse variable absolute_codec_string when inside [] (r:bfe31288/FSCORE-631) + core: Fix limit not decrementing properly (r:f10eebf8/FSCORE-632) + core: Fix crash when receiving RTP packet w/ invalid length (r:26358d67/FSCORE-635) + core: Fix incorrect variable assignment in switch_channel_set_timestamp (r:8a7f38c6/FSCORE-636) + core: add api_reporting_hook (like api_hangup_hook but after reporting state) both honor session_in_hangup_hook (r:ed7ccc14) + core: only let force_transfer_* vars work when an explicit value was not supplied (r:91a87e9d) + core: Make switch_ivr_session_echo stop when CF_BREAK is set (r:2b120311/DP-19) + core: change channel app_flags to be realm specific and default old version to use __FILE__ as the realm name to avoid cross fire between apps using app flags (r:09c1815c) + core: preanswer before getting variables to avoid crash (r:25fe16df) + core: Windows: Don't report "unknown command" on console when empty command has been given (r:c8f9fb56/FSCORE-641) embedded languages: Provide core level support for conditional Set Global Variable (r:c017c24b/FSCORE-612) + core: Windows: Add start parameter -monotonic-clock, replaces build flag WIN32_MONOTONIC (r:3515c7a0/FSCORE-643) + core: Improve RTP timing on playback of files (r:d6d7773c/FSCORE-639) + core: Allows bind_meta_app to use chars other than * (r:fd254766/FSCORE-630) + core: Fixed core lib won't build for win32 (r:9327c994/FSCORE-646) lang: Improve French phrase files (FSCONFIG-23) libdingaling: fix race on shutdown causing crash (FSMOD-47) libesl: Fix potential race condition (ESL-36) libesl: Add /uuid command to fs_cli to filter logs by uuid libesl: Increase buffer in fs_cli for Win (r:d1d6be88/FSCORE-611) libesl: fix esl buffer overflow (r:9c9cb5b3) + libesl: add -r to fs_cli to retry every second up to 2 min to connect (r:36bfe432) + libesl: Fix esl doc, s/ESL_STATUS_SUCESS/ESL_SUCCESS/g (r:84b4b5da) + libesl: make esl_connect thread-safe by using getaddrinfo instead of gethostbyname (r:52885dfc) + libesl: Add esl_connect_timeout to specify custom connection timeouts (r:12a0ec74) + libesl: use recv_timed in esl_connect_timemout in case we get stuck in a blocking recv (r:13137e22) + libesl: use uint32_t instead of long for timeout as in the rest of the lib, 0 means forever. Also added esl_send_recv_timed() (r:49d6c803) + libesl: Fix SEGV when using serialize function without any arguments (r:910729b5/ESL-44) + libesl: fix leak-on-error in esl_connect_timeout() (r:4263d60e) + libfreetdm: implemented freetdm config nodes and ss7 initial configuration + libopenzap: Add CLI tracing libs: Merged OpenZAP and FreeTDM into the FreeSWITCH tree. - libsfreetdm: implemented freetdm config nodes and ss7 initial configuration - libsopenzap: Add CLI tracing + libsofiasip: Fix random crashes (r:c15ee980/SFSIP-219) + libsofiasip: Fix T.38 bug in sofia_glue (r:2843f1ad/MODSOFIA-94) libspandsp: Fixed a typo in spandsp's msvc/inttypes.h Updated sig_tone processing in spandsp to the latest, to allow moy to proceed with his signaling work. libspandsp: removed a saturate16 from spandsp that was causing problems fixed a typo in the MSVC inttypes.h file for spandsp libspandsp: Changes to the signaling tone detector to detect concurrent 2400Hz + 2600Hz tones. This passes voice immunity and other key tests, but it bounces a bit when transitions like 2400 -> 2400+2600 -> 2600 occur. Transitions between tone off and tone on are clean. (r:bc13e944) + libspandsp: Fix Windows build after libspandsp update (r:d70cc852/FSBUILD-293) mod_avmd: Initial check in - Advanced Voicemail Detect (r:10c6a30a) (by Eric Des Courtis) mod_avmd: Add to windows build (r:df4bd935) + mod_callcenter: Initial commit of the mod_callcenter application. This module is in it early state of developpement. You can see documentation on the wiki at : <a href="http://wiki.freeswitch.org/wiki/Mod_callcenter">http://wiki.freeswitch.org/wiki/Mod_callcenter</a> For support/comments, please use <a href="http://jira.freeswitch.org/">http://jira.freeswitch.org/</a> and select the MOD CALLCENTER module. (r:ba09b96d) + mod_callcenter: Add ability to unload/reload/load a queue setting (You still need to reloadxml before). Note that joining a queue will check for it in the config and load it on the fly... I've used the same system as in mod_voicemail. Not sure if we should allow this, but just comment it out of the config before unload and it wont be available anymore (r:3eafca60) + mod_callcenter: Try to fix the ring-all, also add cli auto complete done in previous commit (r:1666783c) + mod_callcenter: Add missing odbc db support (Not tested, please someone test this) (r:42436e27) + mod_callcenter: More ODBC changes. It is not a global settings value. Cannot be changed in runtime. (r:6980305f) mod_cidlookup: null xml is bad (r:095815f8) mod_cid_lookup: honor skipcitystate when using whitepages (r:a66654de/FSMOD-53) mod_commands: make break uuid_break and add cascade flag @@ -72,17 +108,29 @@ freeswitch (1.0.7) mod_commands: expand last patch to do hold as well and rename the command to uuid_phone_event mod_commands: allow uuid_break to interrupt one or all in a delimited string of files the same as several individual files (r:eba05c3c) mod_commands: add show channels count auto-completion for mod_commands (r:5ffc57e5/FSMOD-54) + mod_commands: Fix a segfault if no arguments is provided to limit_hash_usage (r:8ceb2a9b) + mod_commands: fsctl max_session should display int, not float (r:f7e2410e/FSCORE-634) + mod_commands: limit - reset rate and release resource apis Thanks Moy (r:a7c31e6f/FSCORE-637) mod_conference: Fix reporting of volume up/down (MODAPP-419) mod_conference: add last talking time per member to conference xml list mod_conference: add terminate-on-silence conference param mod_conference: Add User Flags to Member Data Events (MODAPP-423) mod_conference: add conference_member_id variable to all sessions with the member id used by their conference participation (For drk__) (r:49c9bfdb) mod_conference: fix relate nohear (r:f029ce07/MODAPP-428) + mod_conference: Fix floor change events not always firing (r:8f1767d3/MODAPP-424) + mod_dialplan_xml: Add in the INFO log the caller id number when processing a request (Currenly only show the caller name) (r:e1df5e13) mod_db: fix stack corruption (MODAPP-407) mod_dptools: add eavesdrop_enable_dtmf chan var (r:596c0012) mod_dptools: Make park app not send 183 session progress (r:76932995/FSCORE-567) mod_dptools: add block_dtmf and unblock_dtmf apps (r:d9eb0197) + mod_erlang_event: Make XML fetch reply ACKs distinguishable, update freeswitch.erl (r:9d44ed04) + mod_erlang_event: Add 3 new commands; session_event, session_noevents, session_nixevent (r:698fa045) + mod_erlang_event: generate long node names the same as erlang does (r:9ad509c2) + mod_event_socket: fix up other users of switch_event_xmlize() to use SWITCH_EVENT_NONE (r:d6eb7562) mod_fifo: allow multiple dtmf to exit fifo, set fifo_caller_exit_key to specify which (MODAPP-420) + mod_fifo: cancel outbound call if customer hangs up (r:cadb4d94) + mod_fifo: add taking_calls param to fifo member add and config file (r:821488bf) + mod_fifo: add nomedia flag (r:2d30a8c2) mod_freetdm: Fix for TON and NPI not passed through to channel variables on incoming calls mod_freetdm: add pvt data to freetdm channels fix fxs features (r:9d456900) mod_freetdm: export and import boost custom data (r:edb2d582) @@ -102,11 +150,44 @@ freeswitch (1.0.7) mod_freetdm: check for hw dtmf before enabling (r:b1fd88d7) mod_freetdm: adding ftmod_sangoma_ss7 support (r:94283355) mod_freetdm: added SIGEVENT_COLLISION (r:501f8704) + mod_freetdm: fix Windows build of mod_freetdm (r:71650ae1/FSBUILD-291) + mod_freetdm: call rate limit (r:a1fe7c8d) + mod_freetdm: fix hangup race (r:438c93e8) + mod_freetdm: added dtmf recording feature for debugging (r:9f9c4541) + mod_freetdm: add PRI tapping starting code (r:b485f25f) + mod_freetdm: Fix build of mod_freetdm in Windows (r:04dbc7bc/FSBUILD-295) + mod_freetdm: fix fxs dialtone - should be stopped on first digit (r:f822180f) + mod_freetdm: add bearer capability and layer1 pass-thru for boost (r:07b81760) + mod_freetdm: OPENZAP-107 - Patched by Jeff Lenk (r:aa075136/OPENZAP-107) mod_gsmopen: copy from branch + mod_hash: free all hashtables on shutdown (r:e76d7d92) + mod_hash: remove unneeded initializer (r:10d468a6) + mod_hash: begin working on remote support (r:c5ad49da) + mod_hash: remove runtime function properly (r:a55747aa) + mod_hash: remote sync in working state (r:f66ac890) + mod_hash: add hash_remote api function (r:7036c9b8) + mod_hash: fix syntax messages and add console autocomplete (r:67713fd6) + mod_hash: change tab spacing for api, remove unnecessary log at every connection attempt in case a box is down (r:6d8c0b19) + mod_hash: add hash.conf.xml (r:51bc65e2) + mod_hash: fix null check on API (r:52c278c2) + mod_hash: formatting and add an error message in the api (r:9e047ef1) + mod_hash: use 5 seconds connection timeouts for remote connections (r:7431fbe9) + mod_hash: use esl_recv_timed with a 5000ms timeout when doing api commands (r:27d8378f) + mod_hash: limit_remote_thread sending invalid handle to esl_connect_timeout causing core (r:6cdd3e2a/MODAPP-446) + mod_h323: initial t.38 support. remake logical channel opening. add missing param name in example config. (r:8c58074c) + mod_h323: some t.38 and lockinng improvements. replace ptrace with switch_log_printf. (r:5efe5c88) + mod_h323: add missing conf prameter (r:0b353d7a) + mod_h323: Add mod_h323 to windows (r:015bcaf6/MODENDP-301) + mod_h323: move PTrace level set to FSH323EndPoint::Initialise. partially apply patch from from Peter Olsson, Remove UnLock() when TryLock() failed and DEBUG_RTP_PACKETS directiv e. (r:7b5803f7) mod_java: fix eventConsumer issue and add flush() method (r:7fd3aff6) mod_java: Allow user defined java methods to be called at startup and shutdown of JVM (r:1339e218/MODLANG-117) + mod_json_cdr: Fix segfault in mod_json_cdr.c (r:f347698a/MODEVENT-66) mod_lcr: Expand variables (MODAPP-418) mod_lcr: add enable_sip_redir parameter (r:70bf7a0a/MODAPP-427) + mod_lcr: don't validate profiles with ${} vars since they are dynamic and we can't guess what the proper value should be (r:af33afaa) + mod_lcr: fix dialplan issues with default profile and logging when no caller_profile set (r:00170558) + mod_lcr: assign default profile even if testing is skipped (r:6420099c) + mod_lcr: fix compiler warning on newer gcc (r:bfa414cb) mod_loopback: add loopback_bowout_on_execute var to make 1 legged loopback calls bow out of the picture mod_loopback: only execute app once in app mode (r:64f58f2d) mod_managed: Added wrapper for switch_event_bind for .net (r:a5f07a80/MODLANG-165) @@ -122,6 +203,7 @@ freeswitch (1.0.7) mod_openzap: disable dtmf app and cmd line option (r:fb4b7f7a) mod_openzap: add enable dtmf app (r:3c95106e) mod_osp: initial check (Open Settlement Protocol) + mod_osp:Changed OSP TCP port from 1080 to 5045. (r:03abefdf) mod_portaudio: Fix inbound state (CS_ROUTING not CS_INIT) (MODENDP-302) mod_sangoma_codec: Add sample config file mod_sangoma_codec: added load/noload options for the supported codecs @@ -137,7 +219,14 @@ freeswitch (1.0.7) mod_skinny: add mod_skinny vcproj file for windows build (r:f89cbdd6/MODSKINNY-3) mod_skinny: size_t has different sizes on different platforms (r:a2ceff14/MODSKINNY-5) mod_skinny: correct define_time_date (r:48c7bb32/SKINNY-4,SKINNY-7) + mod_skinny: hangup and hold calls in PROCEED state (r:5e07bd33) + mod_skinny: avoid crash with autocompletion when skinny is unloaded (r:db1289df) + mod_skinny: corrected early media (r:b40804a5/MODSKINNY-8) + mod_skinny: ib_calls stats (r:165140e0) + mod_skinny: blind transfer MODSKINNY-10 (r:53f75e9c/MODSKINNY-10) + mod_skinny: ring tone on dialing side (r:0a04ecb8) mod_skypopen: making XEvents to works when EARLYMEDIA, and correctly manage threads death + mod_skypopen: now answer a call only when directed to do it (before was trying to answer any incoming call). Lot of changes to a messy part, so maybe some problem will come out... (r:45c6c4d3) mod_sofia: Send SIP MESSAGE to unregistered users by prefixing sip: to user@domain mod_sofia: fix callee being updated with callee information mod_sofia: set appearance-index in update statement for SLA @@ -166,12 +255,21 @@ freeswitch (1.0.7) mod_sofia: allow the profile gateway config to set sip_cid_type for each gateway (r:0152706f/BOUNTY-19) mod_sofia: Adding subject to SEND_MESSAGE (r:2e347c93) mod_sofia: add multiple rtp-ip support to sofia profiles add extra rtp-ip params to a profile to add more ip which will be used round-robin as new calls progress. (r:22569d4a) + mod_sofia: Fix segfault (r:72be253d/MODSOFIA-83) + mod_sofia: Add openssl build support to windows - no external build support needed (step 1 - not hooked up yet) vs2008 pro+ only (r:b0de3585/MODSOFIA-92) + mod_sofia: REFER: to-tag and from-tag should be set other way around when other (bridged) channel is incoming. (r:92d324d3/MODSOFIA-91) mod_spandsp: initial checkin of mod_fax/mod_voipcodecs merge into mod_spandsp (r:fa9a59a8) mod_spandsp: rework of new mod_spandsp to have functions broken up into different c files (r:65400642) mod_spandsp: improve duplicate digit detection and add 'min_dup_digit_spacing_ms' channel variable for use with the dtmf detector (r:eab4f246/FSMOD-45) mod_spandsp: add start_tone_detect/stop_tone_detect app and api commands for tone and cadence detection (r:a6e65147/MODAPP-378) + mod_spandsp: Fix mod_spandsp receive t38 fax error in windows7 (r:fca93f29/MODAPP-443) + mod_spandsp: Moved spandsp to a more recent version. A huge number of little changes occur here, as recently spandsp lost all the $Id$ entries the source files had for the dark old days of CVS (r:f029f7ef) + mod_spidermonkey: allow vars to be set containing vars from languages (r:5cd072a3) + mod_spidermonkey: fix seg in js hangup (r:7d554c11) + mod_spidermonkey: Fix mod_spidermonkey build on FreeBSD, (Undefined symbol PR_LocalTimeParameters). (r:3edb8419) mod_spy: add support for loopback endpoint (MODAPP-416) mod_tts_commandline: fix core dump, temp file problem. flush can be called several times (FSMOD-35) + mod_unimrcp: fix fortify findings for mod_unimrcp (r:336f0b4e/FSMOD-67) mod_valet_parking: add event data to valet parking hold event mod_valet_parking: add event for Valet Parking action exit mod_voicemail: Fix vm_prefs profile lock (MODAPP-417) commit 5f763d0d1bc2724024934b03114d87070b623a29 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Aug 17 17:26:36 2010 -0500 fix caller id fields in show channels show calls etc diff --git a/src/include/switch_caller.h b/src/include/switch_caller.h index 35a1119..b300208 100644 --- a/src/include/switch_caller.h +++ b/src/include/switch_caller.h @@ -108,6 +108,7 @@ SWITCH_BEGIN_EXTERN_C struct switch_caller_extension *caller_extension; switch_memory_pool_t *pool; struct switch_caller_profile *next; + switch_call_direction_t direction; }; /*! \brief An Abstract Representation of a dialplan Application */ diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 9c5f720..9bec466 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -708,7 +708,7 @@ SWITCH_DECLARE(int) switch_split_user_domain(char *in, char **user, char **domai #endif #endif -#define DUMP_EVENT(_e) {char *event_str;switch_event_serialize(_e, &event_str, SWITCH_FALSE);printf("DUMP\n%s\n", event_str);free(event_str);} +#define DUMP_EVENT(_e) {char *event_str;switch_event_serialize(_e, &event_str, SWITCH_FALSE);switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "DUMP\n%s\n", event_str);free(event_str);} #ifndef _MSC_VER #define switch_inet_ntop inet_ntop diff --git a/src/switch_caller.c b/src/switch_caller.c index b611b09..5d5d1ab 100644 --- a/src/switch_caller.c +++ b/src/switch_caller.c @@ -126,6 +126,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_dup(switch_memor profile->destination_number_numplan = tocopy->destination_number_numplan; profile->flags = tocopy->flags; profile->pool = pool; + profile->direction = tocopy->direction; return profile; } @@ -255,6 +256,10 @@ SWITCH_DECLARE(void) switch_caller_profile_event_set_data(switch_caller_profile_ { char header_name[1024]; + switch_snprintf(header_name, sizeof(header_name), "%s-Direction", prefix); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->direction == SWITCH_CALL_DIRECTION_INBOUND ? + "inbound" : "outbound"); + if (!zstr(caller_profile->username)) { switch_snprintf(header_name, sizeof(header_name), "%s-Username", prefix); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->username); diff --git a/src/switch_channel.c b/src/switch_channel.c index 254c82f..2ce9a80 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -1847,8 +1847,10 @@ SWITCH_DECLARE(void) switch_channel_event_set_basic_data(switch_channel_t *chann } else { /* Index Originator's Profile */ if (originator_caller_profile) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Other-Type", "originator"); switch_caller_profile_event_set_data(originator_caller_profile, "Other-Leg", event); } else if (originatee_caller_profile) { /* Index Originatee's Profile */ + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Other-Type", "originatee"); switch_caller_profile_event_set_data(originatee_caller_profile, "Other-Leg", event); } } @@ -1932,6 +1934,7 @@ SWITCH_DECLARE(void) switch_channel_set_caller_profile(switch_channel_t *channel switch_mutex_lock(channel->profile_mutex); switch_assert(caller_profile != NULL); + caller_profile->direction = channel->direction; uuid = switch_core_session_get_uuid(channel->session); if (!caller_profile->uuid || strcasecmp(caller_profile->uuid, uuid)) { @@ -1974,6 +1977,7 @@ SWITCH_DECLARE(void) switch_channel_set_caller_profile(switch_channel_t *channel caller_profile->times->created = switch_micro_time_now(); } + caller_profile->next = channel->caller_profile; channel->caller_profile = caller_profile; caller_profile->profile_index = switch_core_sprintf(caller_profile->pool, "%d", ++channel->profile_index); @@ -2017,6 +2021,7 @@ SWITCH_DECLARE(void) switch_channel_set_hunt_caller_profile(switch_channel_t *ch switch_assert(channel->caller_profile != NULL); switch_mutex_lock(channel->profile_mutex); + caller_profile->direction = channel->direction; channel->caller_profile->hunt_caller_profile = NULL; if (channel->caller_profile && caller_profile) { channel->caller_profile->hunt_caller_profile = caller_profile; @@ -2030,6 +2035,7 @@ SWITCH_DECLARE(void) switch_channel_set_originatee_caller_profile(switch_channel switch_assert(channel->caller_profile != NULL); switch_mutex_lock(channel->profile_mutex); + if (channel->caller_profile) { caller_profile->next = channel->caller_profile->originatee_caller_profile; channel->caller_profile->originatee_caller_profile = caller_profile; @@ -2044,6 +2050,7 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_channel_get_originator_caller_p switch_assert(channel != NULL); switch_mutex_lock(channel->profile_mutex); + if (channel->caller_profile) { profile = channel->caller_profile->originator_caller_profile; } diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 98d8704..4293510 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -1135,9 +1135,17 @@ static void core_event_handler(switch_event_t *event) break; case SWITCH_EVENT_CALL_UPDATE: { - const char *name = switch_event_get_header(event, "callee-name"); - const char *number = switch_event_get_header(event, "callee-number"); + const char *name = NULL, *number = NULL, *direction; + int recv = 0; + direction = switch_event_get_header(event, "direction"); + + if (direction && strcasecmp(direction, "send")) { + recv = 1; + name = switch_event_get_header(event, "callee-name"); + number = switch_event_get_header(event, "callee-number"); + } + if (!name) { name = switch_event_get_header(event, "caller-callee-id-name"); } @@ -1155,6 +1163,15 @@ static void core_event_handler(switch_event_t *event) switch_str_nil(number), switch_event_get_header_nil(event, "direction"), switch_event_get_header_nil(event, "unique-id"), switch_core_get_variable("hostname")); + + name = switch_event_get_header(event, "callee-name"); + number = switch_event_get_header(event, "callee-number"); + + if (name && number && recv) { + new_sql() = switch_mprintf("update calls set callee_cid_name='%q',callee_cid_num='%q' where caller_uuid='%q'", + name, number, switch_event_get_header_nil(event, "unique-id")); + + } } } break; @@ -1224,28 +1241,43 @@ static void core_event_handler(switch_event_t *event) } case SWITCH_EVENT_CHANNEL_BRIDGE: - new_sql() = switch_mprintf("update channels set call_uuid='%q' where uuid='%s' and hostname='%q'", - switch_event_get_header_nil(event, "channel-call-uuid"), - switch_event_get_header_nil(event, "unique-id"), switch_core_get_variable("hostname")); - new_sql() = switch_mprintf("insert into calls (call_uuid,call_created,call_created_epoch,function,caller_cid_name," - "caller_cid_num,caller_dest_num,caller_chan_name,caller_uuid,callee_cid_name," - "callee_cid_num,callee_dest_num,callee_chan_name,callee_uuid,hostname) " - "values ('%s', '%s', '%ld', '%s','%q','%q','%q','%q','%s','%q','%q','%q','%q','%s','%q')", - switch_event_get_header_nil(event, "channel-call-uuid"), - switch_event_get_header_nil(event, "event-date-local"), - (long) switch_epoch_time_now(NULL), - switch_event_get_header_nil(event, "event-calling-function"), - switch_event_get_header_nil(event, "caller-caller-id-name"), - switch_event_get_header_nil(event, "caller-caller-id-number"), - switch_event_get_header_nil(event, "caller-destination-number"), - switch_event_get_header_nil(event, "caller-channel-name"), - switch_event_get_header_nil(event, "caller-unique-id"), - switch_event_get_header_nil(event, "Other-Leg-caller-id-name"), - switch_event_get_header_nil(event, "Other-Leg-caller-id-number"), - switch_event_get_header_nil(event, "Other-Leg-destination-number"), - switch_event_get_header_nil(event, "Other-Leg-channel-name"), - switch_event_get_header_nil(event, "Other-Leg-unique-id"), switch_core_get_variable("hostname") - ); + { + const char *callee_cid_name, *callee_cid_num, *direction; + + direction = switch_event_get_header(event, "other-leg-direction"); + + if (direction && !strcasecmp(direction, "outbound")) { + callee_cid_name = switch_event_get_header_nil(event, "Other-Leg-callee-id-name"); + callee_cid_num = switch_event_get_header_nil(event, "Other-Leg-callee-id-number"); + } else { + callee_cid_name = switch_event_get_header_nil(event, "Other-Leg-caller-id-name"); + callee_cid_num = switch_event_get_header_nil(event, "Other-Leg-caller-id-number"); + } + + + new_sql() = switch_mprintf("update channels set call_uuid='%q' where uuid='%s' and hostname='%q'", + switch_event_get_header_nil(event, "channel-call-uuid"), + switch_event_get_header_nil(event, "unique-id"), switch_core_get_variable("hostname")); + new_sql() = switch_mprintf("insert into calls (call_uuid,call_created,call_created_epoch,function,caller_cid_name," + "caller_cid_num,caller_dest_num,caller_chan_name,caller_uuid,callee_cid_name," + "callee_cid_num,callee_dest_num,callee_chan_name,callee_uuid,hostname) " + "values ('%s', '%s', '%ld', '%s','%q','%q','%q','%q','%s','%q','%q','%q','%q','%s','%q')", + switch_event_get_header_nil(event, "channel-call-uuid"), + switch_event_get_header_nil(event, "event-date-local"), + (long) switch_epoch_time_now(NULL), + switch_event_get_header_nil(event, "event-calling-function"), + switch_event_get_header_nil(event, "caller-caller-id-name"), + switch_event_get_header_nil(event, "caller-caller-id-number"), + switch_event_get_header_nil(event, "caller-destination-number"), + switch_event_get_header_nil(event, "caller-channel-name"), + switch_event_get_header_nil(event, "caller-unique-id"), + callee_cid_name, + callee_cid_num, + switch_event_get_header_nil(event, "Other-Leg-destination-number"), + switch_event_get_header_nil(event, "Other-Leg-channel-name"), + switch_event_get_header_nil(event, "Other-Leg-unique-id"), switch_core_get_variable("hostname") + ); + } break; case SWITCH_EVENT_CHANNEL_UNBRIDGE: new_sql() = switch_mprintf("delete from calls where caller_uuid='%s' and hostname='%q'", commit 1413a9d5db3c761f2053526133142b596435553b Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Aug 17 15:00:25 2010 -0500 MODSOFIA-94 diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 182353f..fdf57dc 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -3772,6 +3772,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status char network_ip[80]; int network_port = 0; switch_caller_profile_t *caller_profile = NULL; + int has_t38 = 0; sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), &network_port); @@ -4015,9 +4016,13 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status } } + if (tech_pvt && tech_pvt->remote_sdp_str && switch_stristr("m=image", tech_pvt->remote_sdp_str)) { + has_t38 = 1; + } + if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA) || - sofia_test_flag(tech_pvt, TFLAG_T38_PASSTHRU)) { + (sofia_test_flag(tech_pvt, TFLAG_T38_PASSTHRU) && has_t38)) { if (sofia_test_flag(tech_pvt, TFLAG_SENT_UPDATE)) { sofia_clear_flag_locked(tech_pvt, TFLAG_SENT_UPDATE); @@ -4036,14 +4041,13 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Passing %d %s to other leg\n", status, phrase); - if (status == 200 && sofia_test_flag(tech_pvt, TFLAG_T38_PASSTHRU)) { + if (status == 200 && sofia_test_flag(tech_pvt, TFLAG_T38_PASSTHRU) && has_t38) { if (sip->sip_payload && sip->sip_payload->pl_data) { switch_t38_options_t *t38_options = sofia_glue_extract_t38_options(session, sip->sip_payload->pl_data); if (t38_options) { sofia_glue_copy_t38_options(t38_options, other_session); } else { - sofia_clear_flag(tech_pvt, TFLAG_T38_PASSTHRU); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Could not parse T.38 options from sdp.\n"); switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "T.38 NEGOTIATION ERROR"); switch_channel_hangup(channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION); @@ -4059,14 +4063,14 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status msg->numeric_arg = status; msg->string_arg = switch_core_session_strdup(other_session, phrase); - if (status == 200 && sofia_test_flag(tech_pvt, TFLAG_T38_PASSTHRU)) { + if (status == 200 && sofia_test_flag(tech_pvt, TFLAG_T38_PASSTHRU) && has_t38) { msg->pointer_arg = switch_core_session_strdup(other_session, "t38"); } else if (r_sdp) { msg->pointer_arg = switch_core_session_strdup(other_session, r_sdp); msg->pointer_arg_size = strlen(r_sdp); } - if (status == 200 && sofia_test_flag(tech_pvt, TFLAG_T38_PASSTHRU)) { + if (status == 200 && sofia_test_flag(tech_pvt, TFLAG_T38_PASSTHRU) && has_t38) { switch_core_session_receive_message(other_session, msg); if (switch_rtp_ready(tech_pvt->rtp_session) && switch_rtp_ready(other_tech_pvt->rtp_session)) { switch_rtp_udptl_mode(tech_pvt->rtp_session); commit 28fdc32317b12e06bcc9bf806f4b19a902303c79 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Aug 17 13:09:16 2010 -0500 LBDING-21 diff --git a/libs/iksemel/test/tst-ikstack.c b/libs/iksemel/test/tst-ikstack.c index 9e8459f..1a761ad 100644 --- a/libs/iksemel/test/tst-ikstack.c +++ b/libs/iksemel/test/tst-ikstack.c @@ -40,7 +40,7 @@ test_stack (int cs) printf ("ikstack strcat bug:\nExpected: %s\n Result: %s\n", buf, old); exit (1); } - iks_stack_delete (s); + iks_stack_delete (&s); } int main (int argc, char *argv[]) diff --git a/libs/iksemel/test/tst-jid.c b/libs/iksemel/test/tst-jid.c index 66406c7..a3899db 100644 --- a/libs/iksemel/test/tst-jid.c +++ b/libs/iksemel/test/tst-jid.c @@ -57,7 +57,7 @@ int main (int argc, char *argv[]) test_cmp ("patrician@morpork.gov/gabber", "cohen@guild.org/gsm", IKS_ID_FULL, IKS_ID_FULL); test_cmp ("peter@family.com", "peter@family.com/clam", IKS_ID_PARTIAL, 0); - iks_stack_delete (my_stack); + iks_stack_delete (&my_stack); return 0; } commit 93b313909296b16feb7de444478e0fc3f09c2768 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Aug 17 13:00:32 2010 -0500 presence tweaks diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 95f2220..845fb60 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1080,62 +1080,59 @@ static char *gen_pidf(char *user_agent, char *id, char *url, char *open, char *r " </atom>\n" "</presence>\n", status, id, id, url, open, prpid); } else { + char *xml_rpid = NULL; + *ct = "application/pidf+xml"; + if (!strcasecmp(open, "closed")) { + status = "Unregistered"; + prpid = NULL; + } + if (!strncasecmp(status, "Registered", 10)) { prpid = NULL; status = "Available"; } - + if (!strcasecmp(status, "Unregistered")) { prpid = NULL; open = "closed"; } - if (zstr(status)) { - status = "Available"; - } - if (zstr(rpid)) { prpid = NULL; } - if (prpid) { - ret = switch_mprintf("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?> \n" - "<presence xmlns='urn:ietf:params:xml:ns:pidf' \n" - "xmlns:dm='urn:ietf:params:xml:ns:pidf:data-model' \n" - "xmlns:rpid='urn:ietf:params:xml:ns:pidf:rpid' \n" - "xmlns:c='urn:ietf:params:xml:ns:pidf:cipid' entity='%s'>\n" - " <tuple id='t6a5ed77e'>\n" - " <status>\r\n" - " <basic>%s</basic>\n" - " </status>\n" - " </tuple>\n" - " <dm:person id='p06360c4a'>\n" - " <rpid:activities>\r\n" - " <rpid:%s/>\n" - " </rpid:activities>\n" - " <dm:note>%s</dm:note>\n" - " </dm:person>\n" - "</presence>", id, open, prpid, status); - } else { - ret = switch_mprintf("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?> \n" - "<presence xmlns='urn:ietf:params:xml:ns:pidf' \n" - "xmlns:dm='urn:ietf:params:xml:ns:pidf:data-model' \n" - "xmlns:rpid='urn:ietf:params:xml:ns:pidf:rpid' \n" - "xmlns:c='urn:ietf:params:xml:ns:pidf:cipid' entity='%s'>\n" - " <tuple id='t6a5ed77e'>\n" - " <status>\r\n" - " <basic>%s</basic>\n" - " </status>\n" - " </tuple>\n" - " <dm:person id='p06360c4a'>\n" - " <dm:note>%s</dm:note>\n" - " </dm:person>\n" - "</presence>", id, open, status); + if (zstr(status) && !zstr(prpid)) { + status = "Available"; } + + if (prpid) { + xml_rpid = switch_mprintf(" <rpid:activities>\r\n" + " <rpid:%s/>\n" + " </rpid:activities>\n", prpid); + } + + ret = switch_mprintf("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?> \n" + "<presence xmlns='urn:ietf:params:xml:ns:pidf' \n" + "xmlns:dm='urn:ietf:params:xml:ns:pidf:data-model' \n" + "xmlns:rpid='urn:ietf:params:xml:ns:pidf:rpid' \n" + "xmlns:c='urn:ietf:params:xml:ns:pidf:cipid' entity='%s'>\n" + " <tuple id='t6a5ed77e'>\n" + " <status>\r\n" + " <basic>%s</basic>\n" + " </status>\n" + " </tuple>\n" + " <dm:person id='p06360c4a'>\n" + "%s" + " <dm:note>%s</dm:note>\n" + " </dm:person>\n" + "</presence>", id, open, switch_str_nil(xml_rpid), status); + + + switch_safe_free(xml_rpid); } @@ -1186,9 +1183,13 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * //printf("arg %d[%s] = [%s]\n", i, columnNames[i], argv[i]); //} - if (argc > 18 && !zstr(argv[17]) && !zstr(argv[18])) { - status = argv[17]; - rpid = argv[18]; + if (argc > 18) { + if (!zstr(argv[17])) { + status = argv[17]; + } + if (!zstr(argv[18])) { + rpid = argv[18]; + } open_closed = argv[19]; } @@ -2478,6 +2479,7 @@ void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, n " profile_name, hostname, open_closed) " "values ('%q','%q','%q','%q',%ld,'%q','%q','%q','%q')", from_user, from_host, note_txt, rpid, exp, full_agent, profile->name, mod_sofia_globals.hostname, open_closed))) { + sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE); } commit 6626211ab67c978aacf4418fa2a84ed5720a1a16 Author: Jeff Lenk <jeff@jefflenk.com> Date: Tue Aug 17 11:33:40 2010 -0600 MODSOFIA-92 step 3 - now hooked to build diff --git a/Freeswitch.2008.express.sln b/Freeswitch.2008.express.sln index ed49913..a0d2121 100644 --- a/Freeswitch.2008.express.sln +++ b/Freeswitch.2008.express.sln @@ -180,7 +180,9 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_sofia", "src\mod\endpoints\mod_sofia\mod_sofia.2008.vcproj", "{0DF3ABD0-DDC0-4265-B778-07C66780979B}" ProjectSection(ProjectDependencies) = postProject {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4} = {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4} + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE} = {D331904D-A00A-4694-A5A3-FCFF64AB5DBE} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {B4B62169-5AD4-4559-8707-3D933AC5DB39} = {B4B62169-5AD4-4559-8707-3D933AC5DB39} {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} {70A49BC2-7500-41D0-B75D-EDCC5BE987A0} = {70A49BC2-7500-41D0-B75D-EDCC5BE987A0} EndProjectSection @@ -630,6 +632,7 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_hash", "src\mod\applications\mod_hash\mod_hash.2008.vcproj", "{2E250296-0C08-4342-9C8A-BCBDD0E7DF65}" ProjectSection(ProjectDependencies) = postProject {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {CF405366-9558-4AE8-90EF-5E21B51CCB4E} = {CF405366-9558-4AE8-90EF-5E21B51CCB4E} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_skinny", "src\mod\endpoints\mod_skinny\mod_skinny_2008.vcproj", "{CC1DD008-9406-448D-A0AD-33C3186CFADB}" @@ -637,6 +640,24 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_skinny", "src\mod\endpo {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download OPENSSL", "libs\win32\Download OPENSSL.2008.vcproj", "{D578E676-7EC8-4548-BD8B-845C635F14AD}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libeay32", "libs\win32\openssl\libeay32.2008.vcproj", "{D331904D-A00A-4694-A5A3-FCFF64AB5DBE}" + ProjectSection(ProjectDependencies) = postProject + {D578E676-7EC8-4548-BD8B-845C635F14AD} = {D578E676-7EC8-4548-BD8B-845C635F14AD} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ssleay32", "libs\win32\openssl\ssleay32.2008.vcproj", "{B4B62169-5AD4-4559-8707-3D933AC5DB39}" + ProjectSection(ProjectDependencies) = postProject + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE} = {D331904D-A00A-4694-A5A3-FCFF64AB5DBE} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openssl", "libs\win32\openssl\openssl.2008.vcproj", "{25BD39B1-C8BF-4676-A738-9CABD9C6BC79}" + ProjectSection(ProjectDependencies) = postProject + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE} = {D331904D-A00A-4694-A5A3-FCFF64AB5DBE} + {B4B62169-5AD4-4559-8707-3D933AC5DB39} = {B4B62169-5AD4-4559-8707-3D933AC5DB39} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -2065,6 +2086,42 @@ Global {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Release|Win32.ActiveCfg = Release|Win32 {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Release|Win32.Build.0 = Release|Win32 {CC1DD008-9406-448D-A0AD-33C3186CFADB}.Release|x64.ActiveCfg = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.All|Win32.ActiveCfg = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.All|Win32.Build.0 = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.All|x64.ActiveCfg = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Debug|Win32.ActiveCfg = Debug|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Debug|Win32.Build.0 = Debug|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Debug|x64.ActiveCfg = Debug|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Release|Win32.ActiveCfg = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Release|Win32.Build.0 = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Release|x64.ActiveCfg = Release|Win32 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.All|Win32.ActiveCfg = Release|Win32 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.All|Win32.Build.0 = Release|Win32 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.All|x64.ActiveCfg = Release|Win32 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Debug|Win32.ActiveCfg = Debug|Win32 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Debug|Win32.Build.0 = Debug|Win32 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Debug|x64.ActiveCfg = Debug|Win32 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Release|Win32.ActiveCfg = Release|Win32 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Release|Win32.Build.0 = Release|Win32 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Release|x64.ActiveCfg = Release|Win32 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.All|Win32.ActiveCfg = Release|Win32 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.All|Win32.Build.0 = Release|Win32 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.All|x64.ActiveCfg = Release|Win32 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Debug|Win32.ActiveCfg = Debug|Win32 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Debug|Win32.Build.0 = Debug|Win32 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Debug|x64.ActiveCfg = Debug|Win32 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Release|Win32.ActiveCfg = Release|Win32 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Release|Win32.Build.0 = Release|Win32 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Release|x64.ActiveCfg = Release|Win32 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.All|Win32.ActiveCfg = Release|Win32 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.All|Win32.Build.0 = Release|Win32 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.All|x64.ActiveCfg = Release|Win32 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Debug|Win32.ActiveCfg = Debug|Win32 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Debug|Win32.Build.0 = Debug|Win32 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Debug|x64.ActiveCfg = Debug|Win32 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|Win32.ActiveCfg = Release|Win32 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|Win32.Build.0 = Release|Win32 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/libs/sofia-sip/win32/config.h.in b/libs/sofia-sip/win32/config.h.in index 363d33b..822cd2c 100644 --- a/libs/sofia-sip/win32/config.h.in +++ b/libs/sofia-sip/win32/config.h.in @@ -219,10 +219,10 @@ #undef HAVE_NET_IF_TYPES_H /* Define to 1 if you have OpenSSL */ -#undef HAVE_OPENSSL +#define HAVE_OPENSSL 1 /* Define to 1 if you have the <openssl/tls1.h> header file. */ -#undef HAVE_OPENSSL_TLS1_H +#define HAVE_OPENSSL_TLS1_H 1 /* Define to 1 if you have the `poll' function. */ #undef HAVE_POLL @@ -362,7 +362,7 @@ #undef HAVE_TCSETATTR /* Define to 1 if you have TLS */ -#undef HAVE_TLS +#define HAVE_TLS 1 /* Define to 1 if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H diff --git a/libs/win32/openssl/openssl.2008.vcproj b/libs/win32/openssl/openssl.2008.vcproj index 525973c..2ce3f00 100644 --- a/libs/win32/openssl/openssl.2008.vcproj +++ b/libs/win32/openssl/openssl.2008.vcproj @@ -70,7 +70,7 @@ /> <Tool Name="VCLinkerTool" - AdditionalDependencies="libeay32.lib ssleay32.lib ws2_32.lib" + AdditionalDependencies="ws2_32.lib" LinkIncremental="2" AdditionalLibraryDirectories=""$(ProjectDir)$(ConfigurationName)"" GenerateDebugInformation="true" @@ -152,7 +152,7 @@ /> <Tool Name="VCLinkerTool" - AdditionalDependencies="libeay32.lib ssleay32.lib ws2_32.lib" + AdditionalDependencies="ws2_32.lib" LinkIncremental="2" AdditionalLibraryDirectories=""$(ProjectDir)$(ConfigurationName)"" GenerateDebugInformation="true" diff --git a/libs/win32/openssl/ssleay32.2008.vcproj b/libs/win32/openssl/ssleay32.2008.vcproj index c834a89..c9ad1f3 100644 --- a/libs/win32/openssl/ssleay32.2008.vcproj +++ b/libs/win32/openssl/ssleay32.2008.vcproj @@ -69,7 +69,6 @@ /> <Tool Name="VCLinkerTool" - AdditionalDependencies="libeay32.lib" LinkIncremental="2" AdditionalLibraryDirectories=""$(ProjectDir)$(ConfigurationName)"" ModuleDefinitionFile="ssleay32.def" @@ -150,7 +149,6 @@ /> <Tool Name="VCLinkerTool" - AdditionalDependencies="libeay32.lib" LinkIncremental="2" AdditionalLibraryDirectories="$(ProjectDir)$(ConfigurationName)" ModuleDefinitionFile="ssleay32.def" commit 58ec9a311f4ea8f1f18d703f201e4f9c2a8660a4 Author: Jeff Lenk <jeff@jefflenk.com> Date: Tue Aug 17 11:23:43 2010 -0500 MODSOFIA-92 step2 - still not hooked up diff --git a/Freeswitch.2008.sln b/Freeswitch.2008.sln index 13a4430..9cc8ea9 100644 --- a/Freeswitch.2008.sln +++ b/Freeswitch.2008.sln @@ -550,7 +550,9 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_sofia", "src\mod\endpoints\mod_sofia\mod_sofia.2008.vcproj", "{0DF3ABD0-DDC0-4265-B778-07C66780979B}" ProjectSection(ProjectDependencies) = postProject {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4} = {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4} + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE} = {D331904D-A00A-4694-A5A3-FCFF64AB5DBE} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} + {B4B62169-5AD4-4559-8707-3D933AC5DB39} = {B4B62169-5AD4-4559-8707-3D933AC5DB39} {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} {70A49BC2-7500-41D0-B75D-EDCC5BE987A0} = {70A49BC2-7500-41D0-B75D-EDCC5BE987A0} EndProjectSection @@ -559,6 +561,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsofia_sip_ua_static", "l ProjectSection(ProjectDependencies) = postProject {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4} = {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4} {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A} = {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A} + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE} = {D331904D-A00A-4694-A5A3-FCFF64AB5DBE} + {B4B62169-5AD4-4559-8707-3D933AC5DB39} = {B4B62169-5AD4-4559-8707-3D933AC5DB39} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download PTHREAD", "libs\win32\Download PTHREAD.2008.vcproj", "{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A}" @@ -1037,9 +1041,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_unimrcp", "src\mod\asr_ {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA} = {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA} {72782932-37CC-46AE-8C7F-9A7B1A6EE108} = {72782932-37CC-46AE-8C7F-9A7B1A6EE108} {746F3632-5BB2-4570-9453-31D6D58A7D8E} = {746F3632-5BB2-4570-9453-31D6D58A7D8E} + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE} = {D331904D-A00A-4694-A5A3-FCFF64AB5DBE} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} {504B3154-7A4F-459D-9877-B951021C3F1F} = {504B3154-7A4F-459D-9877-B951021C3F1F} {12A49562-BAB9-43A3-A21D-15B60BBB4C31} = {12A49562-BAB9-43A3-A21D-15B60BBB4C31} + {B4B62169-5AD4-4559-8707-3D933AC5DB39} = {B4B62169-5AD4-4559-8707-3D933AC5DB39} {F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3} {1C320193-46A6-4B34-9C56-8AB584FC1B56} = {1C320193-46A6-4B34-9C56-8AB584FC1B56} {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF} diff --git a/libs/win32/sofia/libsofia_sip_ua_static.2008.vcproj b/libs/win32/sofia/libsofia_sip_ua_static.2008.vcproj index 40f1fc8..6e85537 100644 --- a/libs/win32/sofia/libsofia_sip_ua_static.2008.vcproj +++ b/libs/win32/sofia/libsofia_sip_ua_static.2008.vcproj @@ -46,7 +46,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories=""..\..\sofia-sip\win32";"..\..\sofia-sip\libsofia-sip-ua\su";"..\..\sofia-sip\libsofia-sip-ua\ipt";"..\..\sofia-sip\libsofia-sip-ua\sresolv";"..\..\sofia-sip\libsofia-sip-ua\bnf";"..\..\sofia-sip\libsofia-sip-ua\url";"..\..\sofia-sip\libsofia-sip-ua\msg";"..\..\sofia-sip\libsofia-sip-ua\sip";"..\..\sofia-sip\libsofia-sip-ua\nta";"..\..\sofia-sip\libsofia-sip-ua\nua";"..\..\sofia-sip\libsofia-sip-ua\iptsec";"..\..\sofia-sip\libsofia-sip-ua\http";"..\..\sofia-sip\libsofia-sip-ua\nth";"..\..\sofia-sip\libsofia-sip-ua\nea";"..\..\sofia-sip\libsofia-sip-ua\sdp";"..\..\sofia-sip\libsofia-sip-ua\soa";"..\..\sofia-sip\libsofia-sip-ua\stun";"..\..\sofia-sip\libsofia-sip-ua\tport";"..\..\sofia-sip\libsofia-sip-ua\features";"..\..\pthreads-w32-2-7-0-release";." + AdditionalIncludeDirectories=""..\..\sofia-sip\win32";"..\..\sofia-sip\libsofia-sip-ua\su";"..\..\sofia-sip\libsofia-sip-ua\ipt";"..\..\sofia-sip\libsofia-sip-ua\sresolv";"..\..\sofia-sip\libsofia-sip-ua\bnf";"..\..\sofia-sip\libsofia-sip-ua\url";"..\..\sofia-sip\libsofia-sip-ua\msg";"..\..\sofia-sip\libsofia-sip-ua\sip";"..\..\sofia-sip\libsofia-sip-ua\nta";"..\..\sofia-sip\libsofia-sip-ua\nua";"..\..\sofia-sip\libsofia-sip-ua\iptsec";"..\..\sofia-sip\libsofia-sip-ua\http";"..\..\sofia-sip\libsofia-sip-ua\nth";"..\..\sofia-sip\libsofia-sip-ua\nea";"..\..\sofia-sip\libsofia-sip-ua\sdp";"..\..\sofia-sip\libsofia-sip-ua\soa";"..\..\sofia-sip\libsofia-sip-ua\stun";"..\..\sofia-sip\libsofia-sip-ua\tport";"..\..\sofia-sip\libsofia-sip-ua\features";"..\..\pthreads-w32-2-7-0-release";.;"..\..\openssl-1.0.0a\include"" PreprocessorDefinitions="WIN32;_DEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0" MinimalRebuild="true" BasicRuntimeChecks="3" @@ -124,7 +124,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories=""..\..\sofia-sip\win32";"..\..\sofia-sip\libsofia-sip-ua\su";"..\..\sofia-sip\libsofia-sip-ua\ipt";"..\..\sofia-sip\libsofia-sip-ua\sresolv";"..\..\sofia-sip\libsofia-sip-ua\bnf";"..\..\sofia-sip\libsofia-sip-ua\url";"..\..\sofia-sip\libsofia-sip-ua\msg";"..\..\sofia-sip\libsofia-sip-ua\sip";"..\..\sofia-sip\libsofia-sip-ua\nta";"..\..\sofia-sip\libsofia-sip-ua\nua";"..\..\sofia-sip\libsofia-sip-ua\iptsec";"..\..\sofia-sip\libsofia-sip-ua\http";"..\..\sofia-sip\libsofia-sip-ua\nth";"..\..\sofia-sip\libsofia-sip-ua\nea";"..\..\sofia-sip\libsofia-sip-ua\sdp";"..\..\sofia-sip\libsofia-sip-ua\soa";"..\..\sofia-sip\libsofia-sip-ua\stun";"..\..\sofia-sip\libsofia-sip-ua\tport";"..\..\sofia-sip\libsofia-sip-ua\features";"..\..\pthreads-w32-2-7-0-release";." + AdditionalIncludeDirectories=""..\..\sofia-sip\win32";"..\..\sofia-sip\libsofia-sip-ua\su";"..\..\sofia-sip\libsofia-sip-ua\ipt";"..\..\sofia-sip\libsofia-sip-ua\sresolv";"..\..\sofia-sip\libsofia-sip-ua\bnf";"..\..\sofia-sip\libsofia-sip-ua\url";"..\..\sofia-sip\libsofia-sip-ua\msg";"..\..\sofia-sip\libsofia-sip-ua\sip";"..\..\sofia-sip\libsofia-sip-ua\nta";"..\..\sofia-sip\libsofia-sip-ua\nua";"..\..\sofia-sip\libsofia-sip-ua\iptsec";"..\..\sofia-sip\libsofia-sip-ua\http";"..\..\sofia-sip\libsofia-sip-ua\nth";"..\..\sofia-sip\libsofia-sip-ua\nea";"..\..\sofia-sip\libsofia-sip-ua\sdp";"..\..\sofia-sip\libsofia-sip-ua\soa";"..\..\sofia-sip\libsofia-sip-ua\stun";"..\..\sofia-sip\libsofia-sip-ua\tport";"..\..\sofia-sip\libsofia-sip-ua\features";"..\..\pthreads-w32-2-7-0-release";.;"..\..\openssl-1.0.0a\include"" PreprocessorDefinitions="_WIN64;WIN32;_DEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0" MinimalRebuild="true" BasicRuntimeChecks="3" @@ -199,7 +199,7 @@ Name="VCCLCompilerTool" Optimization="2" InlineFunctionExpansion="1" - AdditionalIncludeDirectories=""..\..\sofia-sip\win32";"..\..\sofia-sip\libsofia-sip-ua\su";"..\..\sofia-sip\libsofia-sip-ua\ipt";"..\..\sofia-sip\libsofia-sip-ua\sresolv";"..\..\sofia-sip\libsofia-sip-ua\bnf";"..\..\sofia-sip\libsofia-sip-ua\url";"..\..\sofia-sip\libsofia-sip-ua\msg";"..\..\sofia-sip\libsofia-sip-ua\sip";"..\..\sofia-sip\libsofia-sip-ua\nta";"..\..\sofia-sip\libsofia-sip-ua\nua";"..\..\sofia-sip\libsofia-sip-ua\iptsec";"..\..\sofia-sip\libsofia-sip-ua\http";"..\..\sofia-sip\libsofia-sip-ua\nth";"..\..\sofia-sip\libsofia-sip-ua\nea";"..\..\sofia-sip\libsofia-sip-ua\sdp";"..\..\sofia-sip\libsofia-sip-ua\soa";"..\..\sofia-sip\libsofia-sip-ua\stun";"..\..\sofia-sip\libsofia-sip-ua\tport";"..\..\sofia-sip\libsofia-sip-ua\features";"..\..\pthreads-w32-2-7-0-release";." + AdditionalIncludeDirectories=""..\..\sofia-sip\win32";"..\..\sofia-sip\libsofia-sip-ua\su";"..\..\sofia-sip\libsofia-sip-ua\ipt";"..\..\sofia-sip\libsofia-sip-ua\sresolv";"..\..\sofia-sip\libsofia-sip-ua\bnf";"..\..\sofia-sip\libsofia-sip-ua\url";"..\..\sofia-sip\libsofia-sip-ua\msg";"..\..\sofia-sip\libsofia-sip-ua\sip";"..\..\sofia-sip\libsofia-sip-ua\nta";"..\..\sofia-sip\libsofia-sip-ua\nua";"..\..\sofia-sip\libsofia-sip-ua\iptsec";"..\..\sofia-sip\libsofia-sip-ua\http";"..\..\sofia-sip\libsofia-sip-ua\nth";"..\..\sofia-sip\libsofia-sip-ua\nea";"..\..\sofia-sip\libsofia-sip-ua\sdp";"..\..\sofia-sip\libsofia-sip-ua\soa";"..\..\sofia-sip\libsofia-sip-ua\stun";"..\..\sofia-sip\libsofia-sip-ua\tport";"..\..\sofia-sip\libsofia-sip-ua\features";"..\..\pthreads-w32-2-7-0-release";.;"..\..\openssl-1.0.0a\include"" PreprocessorDefinitions="WIN32;NDEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0" StringPooling="true" RuntimeLibrary="2" @@ -277,7 +277,7 @@ Name="VCCLCompilerTool" Optimization="2" InlineFunctionExpansion="1" - AdditionalIncludeDirectories=""..\..\sofia-sip\win32";"..\..\sofia-sip\libsofia-sip-ua\su";"..\..\sofia-sip\libsofia-sip-ua\ipt";"..\..\sofia-sip\libsofia-sip-ua\sresolv";"..\..\sofia-sip\libsofia-sip-ua\bnf";"..\..\sofia-sip\libsofia-sip-ua\url";"..\..\sofia-sip\libsofia-sip-ua\msg";"..\..\sofia-sip\libsofia-sip-ua\sip";"..\..\sofia-sip\libsofia-sip-ua\nta";"..\..\sofia-sip\libsofia-sip-ua\nua";"..\..\sofia-sip\libsofia-sip-ua\iptsec";"..\..\sofia-sip\libsofia-sip-ua\http";"..\..\sofia-sip\libsofia-sip-ua\nth";"..\..\sofia-sip\libsofia-sip-ua\nea";"..\..\sofia-sip\libsofia-sip-ua\sdp";"..\..\sofia-sip\libsofia-sip-ua\soa";"..\..\sofia-sip\libsofia-sip-ua\stun";"..\..\sofia-sip\libsofia-sip-ua\tport";"..\..\sofia-sip\libsofia-sip-ua\features";"..\..\pthreads-w32-2-7-0-release";." + AdditionalIncludeDirectories=""..\..\sofia-sip\win32";"..\..\sofia-sip\libsofia-sip-ua\su";"..\..\sofia-sip\libsofia-sip-ua\ipt";"..\..\sofia-sip\libsofia-sip-ua\sresolv";"..\..\sofia-sip\libsofia-sip-ua\bnf";"..\..\sofia-sip\libsofia-sip-ua\url";"..\..\sofia-sip\libsofia-sip-ua\msg";"..\..\sofia-sip\libsofia-sip-ua\sip";"..\..\sofia-sip\libsofia-sip-ua\nta";"..\..\sofia-sip\libsofia-sip-ua\nua";"..\..\sofia-sip\libsofia-sip-ua\iptsec";"..\..\sofia-sip\libsofia-sip-ua\http";"..\..\sofia-sip\libsofia-sip-ua\nth";"..\..\sofia-sip\libsofia-sip-ua\nea";"..\..\sofia-sip\libsofia-sip-ua\sdp";"..\..\sofia-sip\libsofia-sip-ua\soa";"..\..\sofia-sip\libsofia-sip-ua\stun";"..\..\sofia-sip\libsofia-sip-ua\tport";"..\..\sofia-sip\libsofia-sip-ua\features";"..\..\pthreads-w32-2-7-0-release";.;"..\..\openssl-1.0.0a\include"" PreprocessorDefinitions="_WIN64;WIN32;NDEBUG;_LIB;IN_LIBSOFIA_SIP_UA_STATIC;LIBSOFIA_SIP_UA_STATIC;LIBSRES_STATIC;PTW32_STATIC_LIB;HAVE_IPHLPAPI_H;SU_DEBUG=0" StringPooling="true" RuntimeLibrary="2" @@ -1055,6 +1055,10 @@ > </File> <File + RelativePath="..\..\sofia-sip\libsofia-sip-ua\tport\tport_tls.c" + > + </File> + <File RelativePath="..\..\sofia-sip\libsofia-sip-ua\tport\tport_type_connect.c" > </File> @@ -1063,6 +1067,10 @@ > </File> <File + RelativePath="..\..\sofia-sip\libsofia-sip-ua\tport\tport_type_tls.c" + > + </File> + <File RelativePath="..\..\sofia-sip\libsofia-sip-ua\tport\tport_type_udp.c" > </File> @@ -1257,15 +1265,15 @@ Name="win32 headers" > <File - RelativePath="..\..\sofia-sip\win32\config.h" + RelativePath="..\..\sofia-sip\win32\config.h" > </File> <File - RelativePath="..\..\sofia-sip\win32\sofia-sip\su_configure.h" + RelativePath="..\..\sofia-sip\win32\sofia-sip\su_configure.h" > </File> <File - RelativePath="..\..\sofia-sip\win32\unistd.h" + RelativePath="..\..\sofia-sip\win32\unistd.h" > </File> </Filter> commit 2843f1ad00238159e36af8e98a4f1e1fa49e8e18 Author: Anthony Minessale <anthm@freeswitch.org> Date: Tue Aug 17 11:16:55 2010 -0500 MODSOFIA-94 diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 90640fc..182353f 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -4039,7 +4039,16 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status if (status == 200 && sofia_test_flag(tech_pvt, TFLAG_T38_PASSTHRU)) { if (sip->sip_payload && sip->sip_payload->pl_data) { switch_t38_options_t *t38_options = sofia_glue_extract_t38_options(session, sip->sip_payload->pl_data); - sofia_glue_copy_t38_options(t38_options, other_session); + + if (t38_options) { + sofia_glue_copy_t38_options(t38_options, other_session); + } else { + sofia_clear_flag(tech_pvt, TFLAG_T38_PASSTHRU); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Could not parse T.38 options from sdp.\n"); + switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "T.38 NEGOTIATION ERROR"); + switch_channel_hangup(channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION); + goto end; + } } } diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 049859d..d78e690 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -3387,6 +3387,8 @@ void sofia_glue_copy_t38_options(switch_t38_options_t *t38_options, switch_core_ switch_channel_t *channel = switch_core_session_get_channel(session); switch_t38_options_t *local_t38_options = switch_channel_get_private(channel, "t38_options"); + switch_assert(t38_options); + if (!local_t38_options) { local_t38_options = switch_core_session_alloc(session, sizeof(switch_t38_options_t)); } commit 5c93d44094e9a8fc181a44948fa1c437afb2daf4 Merge: 0d95f63 a1f19d9 Author: Brian West <brian@freeswitch.org> Date: Tue Aug 17 10:16:57 2010 -0500 Merge branch 'master' of git.freeswitch.org:freeswitch commit 0d95f63d745d28aa61fa330bb13670defa34a651 Author: Brian West <brian@freeswitch.org> Date: Tue Aug 17 10:16:43 2010 -0500 don't answer the script does diff --git a/conf/dialplan/default.xml b/conf/dialplan/default.xml index 42c84ad..4bea2e7 100644 --- a/conf/dialplan/default.xml +++ b/conf/dialplan/default.xml @@ -686,7 +686,6 @@ <!-- install zrtp_agent.lua into scripts (ZRTP == 9787) --> <extension name="zrtp_enrollement"> <condition field="destination_number" expression="^9787$"> - <action application="answer"/> <action application="lua" data="zrtp_agent.lua"/> </condition> </extension> commit a1f19d9123c3b8a86b7ef16b875dd6f5332e050c Author: Andrew Thompson <andrewkt@aktzero.com> Date: Tue Aug 3 00:51:54 2010 -0400 Create RFC2822_DATE for use in emails. Some clients fail to sort emails properly without a Date: line. diff --git a/conf/dialplan/default.xml b/conf/dialplan/default.xml index 9146e0a..2db8637 100644 --- a/conf/dialplan/default.xml +++ b/conf/dialplan/default.xml @@ -145,6 +145,7 @@ <action application="hash" data="insert/${domain_name}-spymap/${caller_id_number}/${uuid}"/> <action application="hash" data="insert/${domain_name}-last_dial/${caller_id_number}/${destination_number}"/> <action application="hash" data="insert/${domain_name}-last_dial/global/${uuid}"/> + <action application="set" data="RFC2822_DATE=${strftime(%a, %d %b %Y %T %z)}"/> </condition> </extension> diff --git a/conf/dialplan/public.xml b/conf/dialplan/public.xml index 14e2e1a..b54aff9 100644 --- a/conf/dialplan/public.xml +++ b/conf/dialplan/public.xml @@ -27,6 +27,7 @@ <extension name="outside_call" continue="true"> <condition> <action application="set" data="outside_call=true"/> + <action application="set" data="RFC2822_DATE=${strftime(%a, %d %b %Y %T %z)}"/> </condition> </extension> diff --git a/conf/notify-voicemail.tpl b/conf/notify-voicemail.tpl index 0b08dbe..5defd74 100644 --- a/conf/notify-voicemail.tpl +++ b/conf/notify-voicemail.tpl @@ -1,4 +1,5 @@ From: "${voicemail_caller_id_name}" <${voicemail_caller_id_number}@${voicemail_domain}> +Date: ${RFC2822_DATE} To: <${voicemail_notify_email}> Subject: Voicemail from "${voicemail_caller_id_name}" <${voicemail_caller_id_number}> ${voicemail_message_len} X-Priority: ${voicemail_priority} diff --git a/conf/voicemail.tpl b/conf/voicemail.tpl index aede2b8..a98f9d7 100644 --- a/conf/voicemail.tpl +++ b/conf/voicemail.tpl @@ -1,4 +1,5 @@ From: "${voicemail_caller_id_name}" <${voicemail_caller_id_number}@${voicemail_domain}> +Date: ${RFC2822_DATE} To: <${voicemail_email}> Subject: Voicemail from "${voicemail_caller_id_name}" <${voicemail_caller_id_number}> ${voicemail_message_len} X-Priority: ${voicemail_priority} commit 92d324d3aa071845b425bd9a6f6b1ad34d505250 Author: Brian West <brian@freeswitch.org> Date: Tue Aug 17 09:41:21 2010 -0500 MODSOFIA-91 diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index ba8f7b7..2791692 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1679,14 +1679,16 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi to_host = switch_channel_get_variable(rchannel, "sip_to_host"); from_user = switch_channel_get_variable(channel, "sip_from_user"); from_host = switch_channel_get_variable(channel, "sip_from_host"); + to_tag = switch_channel_get_variable(rchannel, "sip_to_tag"); + from_tag = switch_channel_get_variable(rchannel, "sip_from_tag"); } else { to_host = switch_channel_get_variable(channel, "sip_to_host"); from_user = switch_channel_get_variable(rchannel, "sip_from_user"); from_host = switch_channel_get_variable(rchannel, "sip_from_host"); + from_tag = switch_channel_get_variable(rchannel, "sip_to_tag"); + to_tag = switch_channel_get_variable(rchannel, "sip_from_tag"); } - to_tag = switch_channel_get_variable(rchannel, "sip_to_tag"); - from_tag = switch_channel_get_variable(rchannel, "sip_from_tag"); switch_core_session_rwunlock(rsession); } } commit 336f0b4eda4cafd1ccc2696bdbfef93d7ef9ec33 Author: Christopher Rienzo <chris@rienzo.net> Date: Tue Aug 17 13:59:03 2010 +0000 FSMOD-67 fix fortify findings for mod_unimrcp diff --git a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c index 41c0ccd..139fe21 100644 --- a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c +++ b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c @@ -118,8 +118,8 @@ typedef struct mod_unimrcp_globals mod_unimrcp_globals_t; static mod_unimrcp_globals_t globals; /** - * Profile-specific configuration. This allows us to handle differing MRCP server behavior - * on a per-profile basis + * Profile-specific configuration. This allows us to handle differing MRCP server behavior + * on a per-profile basis */ struct profile { /** name of the profile */ @@ -224,7 +224,7 @@ static unimrcp_param_id_t *unimrcp_param_id_create(int id, switch_memory_pool_t #undef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE /** - * Audio queue internals + * Audio queue internals */ struct audio_queue { #ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE @@ -386,7 +386,7 @@ static switch_status_t synth_channel_set_params(speech_channel_t *schannel, mrcp static switch_status_t synth_channel_set_header(speech_channel_t *schannel, int id, char *val, mrcp_message_t *msg, mrcp_synth_header_t *synth_hdr); /********************************************************************************************************************************************* - * GRAMMAR : recognizer grammar management + * GRAMMAR : recognizer grammar management */ /** @@ -564,7 +564,7 @@ static const char *skip_initial_whitespace(const char *text) * * @param audio_queue the created queue * @param name the name of this queue (for logging) - * @param pool memory pool to allocate queue from + * @param pool memory pool to allocate queue from * @return SWITCH_STATUS_SUCCESS if successful. SWITCH_STATUS_FALSE if unable to allocate queue */ static switch_status_t audio_queue_create(audio_queue_t ** audio_queue, const char *name, switch_memory_pool_t *pool) @@ -682,7 +682,7 @@ static switch_status_t audio_queue_write(audio_queue_t *queue, void *data, switc /** * Read from the audio queue * - * @param queue the queue to read from + * @param queue the queue to read from * @param data the read data * @param data_len the amount of data requested / actual amount of data read (returned) * @param block 1 if blocking is allowed @@ -834,7 +834,7 @@ static switch_status_t speech_channel_create(speech_channel_t ** schannel, const * @return SWITCH_STATUS_SUCCESS */ static switch_status_t speech_channel_destroy(speech_channel_t *schannel) -{ +{ if (schannel) { /* Terminate the MRCP session if not already done */ if (schannel->mutex) { @@ -1281,7 +1281,7 @@ static switch_status_t synth_channel_set_header(speech_channel_t *schannel, int /** * Stop SPEAK/RECOGNIZE request on speech channel - * + * * @param schannel the channel * @return SWITCH_STATUS_SUCCESS if successful */ @@ -1471,9 +1471,9 @@ static switch_status_t speech_channel_set_state(speech_channel_t *schannel, spee } /** - * Use this function to set the current channel state without locking the + * Use this function to set the current channel state without locking the * speech channel. Do this if you already have the speech channel locked. - * + * * @param schannel the channel * @param state the new channel state * @return SWITCH_STATUS_SUCCESS @@ -1529,7 +1529,7 @@ static switch_status_t synth_speech_open(switch_speech_handle_t *sh, const char } else { name = switch_core_sprintf(sh->memory_pool, "TTS-%d", speech_channel_number); } - + /* Allocate the channel */ if (speech_channel_create(&schannel, name, SPEECH_CHANNEL_SYNTHESIZER, &globals.synth, (uint16_t) rate, sh->memory_pool) != SWITCH_STATUS_SUCCESS) { status = SWITCH_STATUS_FALSE; @@ -1715,7 +1715,7 @@ static apt_bool_t synth_message_handler(const mrcp_app_message_t *app_message) } /** - * Handle the UniMRCP responses sent to session terminate requests + * Handle the UniMRCP responses sent to session terminate requests * * @param application the MRCP application * @param session the MRCP session @@ -1748,7 +1748,7 @@ static apt_bool_t speech_on_session_terminate(mrcp_application_t *application, m } /** - * Handle the UniMRCP responses sent to channel add requests + * Handle the UniMRCP responses sent to channel add requests * * @param application the MRCP application * @param session the MRCP session @@ -2410,7 +2410,7 @@ static switch_status_t recog_channel_get_results(speech_channel_t *schannel, cha switch_mutex_lock(schannel->mutex); if (!zstr(r->result)) { *result = strdup(r->result); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) result:\n\n%s\n", schannel->name, *result); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) result:\n\n%s\n", schannel->name, *result ? *result : ""); r->result = NULL; r->start_of_input = 0; } else if (r->start_of_input) { @@ -2678,7 +2678,7 @@ static switch_status_t recog_channel_set_header(speech_channel_t *schannel, int /** * Flag that the recognizer channel timers are started - * @param schannel the recognizer channel to flag + * @param schannel the recognizer channel to flag */ static switch_status_t recog_channel_set_timers_started(speech_channel_t *schannel) { @@ -2726,7 +2726,7 @@ static switch_status_t recog_asr_open(switch_asr_handle_t *ah, const char *codec } else { name = switch_core_sprintf(ah->memory_pool, "ASR-%d", name, speech_channel_number); } - + /* Allocate the channel */ if (speech_channel_create(&schannel, name, SPEECH_CHANNEL_RECOGNIZER, &globals.recog, (uint16_t) rate, ah->memory_pool) != SWITCH_STATUS_SUCCESS) { status = SWITCH_STATUS_FALSE; @@ -2939,7 +2939,7 @@ static switch_status_t recog_asr_close(switch_asr_handle_t *ah, switch_asr_flag_ * Process asr_feed request from FreeSWITCH * * @param ah the FreeSWITCH speech recognition handle - * @return SWITCH_STATUS_SUCCESS if successful + * @return SWITCH_STATUS_SUCCESS if successful */ static switch_status_t recog_asr_feed(switch_asr_handle_t *ah, void *data, unsigned int len, switch_asr_flag_t *flags) { @@ -3327,7 +3327,7 @@ static switch_status_t recog_shutdown() /** * Process the XML configuration for this module - * Uses the instructions[] defined in this module to process the configuration. + * Uses the instructions[] defined in this module to process the configuration. * * @return SWITCH_STATUS_SUCCESS if the configuration is OK */ @@ -3389,7 +3389,7 @@ static char *ip_addr_get(const char *value, apr_pool_t *pool) /** * set mod_unimrcp-specific profile configuration - * + * * @param profile the MRCP profile to configure * @param param the param name * @param val the param value @@ -3416,7 +3416,7 @@ static int process_profile_config(profile_t *profile, const char *param, const c } /** - * set RTP config struct with param, val pair + * set RTP config struct with param, val pair * @param client the MRCP client * @param rtp_config the config struct to set * @param param the param name @@ -3469,7 +3469,7 @@ static int process_rtp_config(mrcp_client_t *client, mpf_rtp_config_t *rtp_confi * @param param the param name * @param val the param value * @param pool memory pool to use - * @return true if this param belongs to RTSP config + * @return true if this param belongs to RTSP config */ static int process_mrcpv1_config(rtsp_client_config_t *config, const char *param, const char *val, apr_pool_t *pool) { @@ -3625,7 +3625,7 @@ static mrcp_client_t *mod_unimrcp_client_create(switch_memory_pool_t *mod_pool) mrcp_profile_t *mprofile = NULL; mpf_rtp_config_t *rtp_config = NULL; profile_t *mod_profile = NULL; - switch_xml_t default_params = NULL; + switch_xml_t default_params = NULL; /* get profile attributes */ const char *name = apr_pstrdup(pool, switch_xml_attr(profile, "name")); @@ -3766,7 +3766,7 @@ static mrcp_client_t *mod_unimrcp_client_create(switch_memory_pool_t *mod_pool) } /** - * Macro expands to: switch_status_t mod_unimrcp_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool) + * Macro expands to: switch_status_t mod_unimrcp_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool) */ SWITCH_MODULE_LOAD_FUNCTION(mod_unimrcp_load) { @@ -3822,7 +3822,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_unimrcp_load) /** * Called when the system shuts down - * Macro expands to: switch_status_t mod_unimrcp_shutdown() + * Macro expands to: switch_status_t mod_unimrcp_shutdown() */ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_unimrcp_shutdown) { @@ -3951,7 +3951,7 @@ static int get_next_speech_channel_number(void) /** * Create a parameter id - * + * * @param id the UniMRCP ID * @return the pair */ commit d26ddd55f7231ecc348454c26c075b5db665d1a9 Author: Jeff Lenk <jeff@jefflenk.com> Date: Tue Aug 17 08:36:02 2010 -0500 MODSOFIA-92 fix build diff --git a/libs/win32/openssl/libeay32.2008.vcproj b/libs/win32/openssl/libeay32.2008.vcproj index d75eb5f..7edc1a9 100644 --- a/libs/win32/openssl/libeay32.2008.vcproj +++ b/libs/win32/openssl/libeay32.2008.vcproj @@ -32,7 +32,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="copy /Y $(ProjectDir)opensslconf.h $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h copy /Y $(ProjectDir)applink.c $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c copy /Y $(ProjectDir)buildinf.h $(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h copy /Y $(ProjectDir)libeay32.def $(ProjectDir)..\..\openssl-1.0.0a\libeay32.def " + CommandLine="copy /Y $(ProjectDir)opensslconf.h $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h copy /Y $(ProjectDir)applink.c $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c copy /Y $(ProjectDir)buildinf.h $(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h copy /Y $(ProjectDir)libeay32.def $(ProjectDir)..\..\openssl-1.0.0a\libeay32.def if not exist " $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\e_os.h" xcopy "$(ProjectDir)\include\*.*" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\" /C /Y /S " /> <Tool Name="VCCustomBuildTool" @@ -107,17 +107,16 @@ /> </Configuration> <Configuration - Name="Release|Win32" - OutputDirectory="$(SolutionDir)$(ConfigurationName)" - IntermediateDirectory="$(ConfigurationName)" + Name="Debug|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" ConfigurationType="2" CharacterSet="1" ManagedExtensions="0" - WholeProgramOptimization="1" > <Tool Name="VCPreBuildEventTool" - CommandLine="copy /Y $(ProjectDir)opensslconf.h $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h copy /Y $(ProjectDir)applink.c $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c copy /Y $(ProjectDir)buildinf.h $(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h copy /Y $(ProjectDir)libeay32.def $(ProjectDir)..\..\openssl-1.0.0a\libeay32.def " + CommandLine="copy /Y $(ProjectDir)opensslconf.h $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h copy /Y $(ProjectDir)applink.c $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c copy /Y $(ProjectDir)buildinf.h $(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h copy /Y $(ProjectDir)libeay32.def $(ProjectDir)..\..\openssl-1.0.0a\libeay32.def if not exist " $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\e_os.h" xcopy "$(ProjectDir)\include\*.*" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\" /C /Y /S " /> <Tool Name="VCCustomBuildTool" @@ -133,6 +132,7 @@ /> <Tool Name="VCMIDLTool" + TargetEnvironment="3" /> <Tool Name="VCCLCompilerTool" @@ -140,13 +140,12 @@ Optimization="3" InlineFunctionExpansion="2" AdditionalIncludeDirectories=""..\..\openssl-1.0.0a\include";"..\..\openssl-1.0.0a\crypto";"..\..\openssl-1.0.0a\crypto\aes";"..\..\openssl-1.0.0a\crypto\asn1";"..\..\openssl-1.0.0a\crypto\bf";"..\..\openssl-1.0.0a\crypto\bio";"..\..\openssl-1.0.0a\crypto\bn";"..\..\openssl-1.0.0a\crypto\buffer";"..\..\openssl-1.0.0a\crypto\camellia";"..\..\openssl-1.0.0a\crypto\cast";"..\..\openssl-1.0.0a\crypto\cms";"..\..\openssl-1.0.0a\crypto\comp";"..\..\openssl-1.0.0a\crypto\conf";"..\..\openssl-1.0.0a\crypto\des";"..\..\openssl-1.0.0a\crypto\dh";"..\..\openssl-1.0.0a\crypto\dsa";"..\..\openssl-1.0.0a\crypto\dso";"..\..\openssl-1.0.0a\crypto\ec";"..\..\openssl-1.0.0a\crypto\ecdh";"..\..\openssl-1.0.0a\crypto\ecdsa";"..\..\openssl-1.0.0a\crypto\engine";"..\..\openssl-1.0.0a\crypto\err";"..\..\openssl-1.0.0a\crypto\evp";"..\..\openssl-1.0.0a\ms";"..\..\openssl-1.0.0a"" - PreprocessorDefinitions="WIN32;NDEBUG;_CRT_NON_CONFORMING_SWPRINTFS;OPENSSL_THREADS;DSO_WIN32;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_ASM;OPENSSL_NO_GMP;OPENSSL_NO_JPAKE;OPENSSL_NO_KRB5;OPENSSL_NO_MD2;OPENSSL_NO_RFC3779;OPENSSL_NO_STORE;OPENSSL_NO_STATIC_ENGINE;OPENSSL_BUILD_SHLIBCRYPTO;MK1MF_BUILD" + PreprocessorDefinitions="WINDOWS;WIN32;_DEBUG;_CRT_NON_CONFORMING_SWPRINTFS;OPENSSL_THREADS;DSO_WIN32;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_NO_ASM;OPENSSL_NO_GMP;OPENSSL_NO_JPAKE;OPENSSL_NO_KRB5;OPENSSL_NO_MD2;OPENSSL_NO_RFC3779;OPENSSL_NO_STORE;OPENSSL_NO_STATIC_ENGINE;OPENSSL_BUILD_SHLIBCRYPTO;MK1MF_BUILD" StringPooling="true" RuntimeLibrary="2" EnableFunctionLevelLinking="true" UsePrecompiledHeader="0" WarningLevel="3" - WarnAsError="true" DebugInformationFormat="3" DisableSpecificWarnings="4996" EnablePREfast="false" @@ -167,7 +166,7 @@ ModuleDefinitionFile="$(ProjectDir)..\..\openssl-1.0.0a\libeay32.def" GenerateDebugInformation="true" AssemblyDebug="1" - TargetMachine="1" + TargetMachine="17" /> <Tool Name="VCALinkTool" @@ -192,16 +191,17 @@ /> </Configuration> <Configuration - Name="Debug|x64" - OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" - IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" ConfigurationType="2" CharacterSet="1" ManagedExtensions="0" + WholeProgramOptimization="1" > <Tool Name="VCPreBuildEventTool" - CommandLine="copy /Y $(ProjectDir)opensslconf.h $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h copy /Y $(ProjectDir)applink.c $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c copy /Y $(ProjectDir)buildinf.h $(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h copy /Y $(ProjectDir)libeay32.def $(ProjectDir)..\..\openssl-1.0.0a\libeay32.def if not exist " $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\bio.h" xcopy "$(ProjectDir)\include\*.*" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\" /C /D /Y /S" + CommandLine="copy /Y $(ProjectDir)opensslconf.h $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h copy /Y $(ProjectDir)applink.c $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c copy /Y $(ProjectDir)buildinf.h $(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h copy /Y $(ProjectDir)libeay32.def $(ProjectDir)..\..\openssl-1.0.0a\libeay32.def if not exist " $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\e_os.h" xcopy "$(ProjectDir)\include\*.*" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\" /C /Y /S " /> <Tool Name="VCCustomBuildTool" @@ -217,7 +217,6 @@ /> <Tool Name="VCMIDLTool" - TargetEnvironment="3" /> <Tool Name="VCCLCompilerTool" @@ -225,12 +224,13 @@ Optimization="3" InlineFunctionExpansion="2" AdditionalIncludeDirectories=""..\..\openssl-1.0.0a\include";"..\..\openssl-1.0.0a\crypto";"..\..\openssl-1.0.0a\crypto\aes";"..\..\openssl-1.0.0a\crypto\asn1";"..\..\openssl-1.0.0a\crypto\bf";"..\..\openssl-1.0.0a\crypto\bio";"..\..\openssl-1.0.0a\crypto\bn";"..\..\openssl-1.0.0a\crypto\buffer";"..\..\openssl-1.0.0a\crypto\camellia";"..\..\openssl-1.0.0a\crypto\cast";"..\..\openssl-1.0.0a\crypto\cms";"..\..\openssl-1.0.0a\crypto\comp";"..\..\openssl-1.0.0a\crypto\conf";"..\..\openssl-1.0.0a\crypto\des";"..\..\openssl-1.0.0a\crypto\dh";"..\..\openssl-1.0.0a\crypto\dsa";"..\..\openssl-1.0.0a\crypto\dso";"..\..\openssl-1.0.0a\crypto\ec";"..\..\openssl-1.0.0a\crypto\ecdh";"..\..\openssl-1.0.0a\crypto\ecdsa";"..\..\openssl-1.0.0a\crypto\engine";"..\..\openssl-1.0.0a\crypto\err";"..\..\openssl-1.0.0a\crypto\evp";"..\..\openssl-1.0.0a\ms";"..\..\openssl-1.0.0a"" - PreprocessorDefinitions="WINDOWS;WIN32;_DEBUG;_CRT_NON_CONFORMING_SWPRINTFS;OPENSSL_THREADS;DSO_WIN32;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_NO_ASM;OPENSSL_NO_GMP;OPENSSL_NO_JPAKE;OPENSSL_NO_KRB5;OPENSSL_NO_MD2;OPENSSL_NO_RFC3779;OPENSSL_NO_STORE;OPENSSL_NO_STATIC_ENGINE;OPENSSL_BUILD_SHLIBCRYPTO;MK1MF_BUILD" + PreprocessorDefinitions="WIN32;NDEBUG;_CRT_NON_CONFORMING_SWPRINTFS;OPENSSL_THREADS;DSO_WIN32;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_ASM;OPENSSL_NO_GMP;OPENSSL_NO_JPAKE;OPENSSL_NO_KRB5;OPENSSL_NO_MD2;OPENSSL_NO_RFC3779;OPENSSL_NO_STORE;OPENSSL_NO_STATIC_ENGINE;OPENSSL_BUILD_SHLIBCRYPTO;MK1MF_BUILD" StringPooling="true" RuntimeLibrary="2" EnableFunctionLevelLinking="true" UsePrecompiledHeader="0" WarningLevel="3" + WarnAsError="true" DebugInformationFormat="3" DisableSpecificWarnings="4996" EnablePREfast="false" @@ -251,7 +251,7 @@ ModuleDefinitionFile="$(ProjectDir)..\..\openssl-1.0.0a\libeay32.def" GenerateDebugInformation="true" AssemblyDebug="1" - TargetMachine="17" + TargetMachine="1" /> <Tool Name="VCALinkTool" @@ -286,7 +286,7 @@ > <Tool Name="VCPreBuildEventTool" - CommandLine="copy /Y $(ProjectDir)opensslconf.h $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h copy /Y $(ProjectDir)applink.c $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c copy /Y $(ProjectDir)buildinf.h $(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h copy /Y $(ProjectDir)libeay32.def $(ProjectDir)..\..\openssl-1.0.0a\libeay32.def " + CommandLine="copy /Y $(ProjectDir)opensslconf.h $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h copy /Y $(ProjectDir)applink.c $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c copy /Y $(ProjectDir)buildinf.h $(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h copy /Y $(ProjectDir)libeay32.def $(ProjectDir)..\..\openssl-1.0.0a\libeay32.def if not exist " $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\e_os.h" xcopy "$(ProjectDir)\include\*.*" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\" /C /Y /S " /> <Tool Name="VCCustomBuildTool" commit 9ad509c29a83eaebbe90b905917617cbc448dfa3 Author: Andrew Thompson <andrew@hijacked.us> Date: Tue Aug 17 02:32:37 2010 -0400 mod_erlang_event: generate long node names the same as erlang does Also, allow you to override the node name inference by passing a nodename with an @ in it, eg. freeswitch@freeswitch.com diff --git a/src/mod/event_handlers/mod_erlang_event/ei_helpers.c b/src/mod/event_handlers/mod_erlang_event/ei_helpers.c index da06927..45b6553 100644 --- a/src/mod/event_handlers/mod_erlang_event/ei_helpers.c +++ b/src/mod/event_handlers/mod_erlang_event/ei_helpers.c @@ -33,6 +33,11 @@ */ #include <switch.h> #include <ei.h> +#include <sys/types.h> +#include <netinet/in.h> +#include <arpa/nameser.h> +#include <resolv.h> + #include "mod_erlang_event.h" /* Stolen from code added to ei in R12B-5. @@ -340,25 +345,39 @@ switch_status_t initialise_ei(struct ei_cnode_s *ec) server_addr.sin_family = AF_INET; server_addr.sin_port = htons(prefs.port); + if (strchr(prefs.nodename, '@')) { + /* we got a qualified node name, don't guess the host/domain */ + snprintf(thisnodename, MAXNODELEN + 1, "%s", prefs.nodename); + } else { #ifdef WIN32 - if ((nodehost = gethostbyaddr((const char *) &server_addr.sin_addr.s_addr, sizeof(server_addr.sin_addr.s_addr), AF_INET))) + if ((nodehost = gethostbyaddr((const char *) &server_addr.sin_addr.s_addr, sizeof(server_addr.sin_addr.s_addr), AF_INET))) #else - if ((nodehost = gethostbyaddr((const char *) &server_addr.sin_addr.s_addr, sizeof(server_addr.sin_addr.s_addr), AF_INET))) + if ((nodehost = gethostbyaddr((const char *) &server_addr.sin_addr.s_addr, sizeof(server_addr.sin_addr.s_addr), AF_INET))) #endif - memcpy(thishostname, nodehost->h_name, EI_MAXHOSTNAMELEN); + memcpy(thishostname, nodehost->h_name, EI_MAXHOSTNAMELEN); - if (zstr_buf(thishostname)) { - gethostname(thishostname, EI_MAXHOSTNAMELEN); - } + if (zstr_buf(thishostname)) { + gethostname(thishostname, EI_MAXHOSTNAMELEN); + } - if (prefs.shortname) { - char *off; - if ((off = strchr(thishostname, '.'))) { - *off = '\0'; + if (prefs.shortname) { + char *off; + if ((off = strchr(thishostname, '.'))) { + *off = '\0'; + } + } else { + if (!(_res.options & RES_INIT)) { + // init the resolver + res_init(); + } + if (!zstr_buf(_res.dnsrch[0])) { + strncat(thishostname, ".", 1); + strncat(thishostname, _res.dnsrch[0], EI_MAXHOSTNAMELEN - strlen(thishostname)); + } } + snprintf(thisnodename, MAXNODELEN + 1, "%s@%s", prefs.nodename, thishostname); } - snprintf(thisnodename, MAXNODELEN + 1, "%s@%s", prefs.nodename, thishostname); /* init the ei stuff */ if (ei_connect_xinit(ec, thishostname, prefs.nodename, thisnodename, (Erl_IpAddr) (&server_addr.sin_addr.s_addr), prefs.cookie, 0) < 0) { commit b0de3585ea04057c16c8281fe83de74138e903ef Author: Jeff Lenk <jeff@jefflenk.com> Date: Mon Aug 16 15:17:20 2010 -0500 MODSOFIA-92 Add openssl build support to windows - no external build support needed (step 1 - not hooked up yet) vs2008 pro+ only diff --git a/Freeswitch.2008.sln b/Freeswitch.2008.sln index 2547362..13a4430 100644 --- a/Freeswitch.2008.sln +++ b/Freeswitch.2008.sln @@ -1106,6 +1106,26 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_hash", "src\mod\applica {CF405366-9558-4AE8-90EF-5E21B51CCB4E} = {CF405366-9558-4AE8-90EF-5E21B51CCB4E} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download OPENSSL", "libs\win32\Download OPENSSL.2008.vcproj", "{D578E676-7EC8-4548-BD8B-845C635F14AD}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "openssl", "openssl", "{B376D494-D7DD-4B2A-99E2-52916D5A8CD8}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libeay32", "libs\win32\openssl\libeay32.2008.vcproj", "{D331904D-A00A-4694-A5A3-FCFF64AB5DBE}" + ProjectSection(ProjectDependencies) = postProject + {D578E676-7EC8-4548-BD8B-845C635F14AD} = {D578E676-7EC8-4548-BD8B-845C635F14AD} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ssleay32", "libs\win32\openssl\ssleay32.2008.vcproj", "{B4B62169-5AD4-4559-8707-3D933AC5DB39}" + ProjectSection(ProjectDependencies) = postProject + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE} = {D331904D-A00A-4694-A5A3-FCFF64AB5DBE} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openssl", "libs\win32\openssl\openssl.2008.vcproj", "{25BD39B1-C8BF-4676-A738-9CABD9C6BC79}" + ProjectSection(ProjectDependencies) = postProject + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE} = {D331904D-A00A-4694-A5A3-FCFF64AB5DBE} + {B4B62169-5AD4-4559-8707-3D933AC5DB39} = {B4B62169-5AD4-4559-8707-3D933AC5DB39} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -2786,6 +2806,50 @@ Global {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.Release|Win32.Build.0 = Release|Win32 {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.Release|x64.ActiveCfg = Release|x64 {2E250296-0C08-4342-9C8A-BCBDD0E7DF65}.Release|x64.Build.0 = Release|x64 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.All|Win32.ActiveCfg = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.All|Win32.Build.0 = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.All|x64.ActiveCfg = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Debug|Win32.ActiveCfg = Debug|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Debug|Win32.Build.0 = Debug|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Debug|x64.ActiveCfg = Debug|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Debug|x64.Build.0 = Debug|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Release|Win32.ActiveCfg = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Release|Win32.Build.0 = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Release|x64.ActiveCfg = Release|Win32 + {D578E676-7EC8-4548-BD8B-845C635F14AD}.Release|x64.Build.0 = Release|Win32 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.All|Win32.ActiveCfg = Release|Win32 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.All|Win32.Build.0 = Release|Win32 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.All|x64.ActiveCfg = Release|Win32 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Debug|Win32.ActiveCfg = Debug|Win32 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Debug|Win32.Build.0 = Debug|Win32 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Debug|x64.ActiveCfg = Debug|x64 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Debug|x64.Build.0 = Debug|x64 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Release|Win32.ActiveCfg = Release|Win32 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Release|Win32.Build.0 = Release|Win32 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Release|x64.ActiveCfg = Release|x64 + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE}.Release|x64.Build.0 = Release|x64 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.All|Win32.ActiveCfg = Release|Win32 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.All|Win32.Build.0 = Release|Win32 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.All|x64.ActiveCfg = Release|Win32 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Debug|Win32.ActiveCfg = Debug|Win32 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Debug|Win32.Build.0 = Debug|Win32 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Debug|x64.ActiveCfg = Debug|x64 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Debug|x64.Build.0 = Debug|x64 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Release|Win32.ActiveCfg = Release|Win32 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Release|Win32.Build.0 = Release|Win32 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Release|x64.ActiveCfg = Release|x64 + {B4B62169-5AD4-4559-8707-3D933AC5DB39}.Release|x64.Build.0 = Release|x64 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.All|Win32.ActiveCfg = Release|Win32 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.All|Win32.Build.0 = Release|Win32 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.All|x64.ActiveCfg = Release|Win32 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Debug|Win32.ActiveCfg = Debug|Win32 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Debug|Win32.Build.0 = Debug|Win32 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Debug|x64.ActiveCfg = Debug|x64 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Debug|x64.Build.0 = Debug|x64 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|Win32.ActiveCfg = Release|Win32 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|Win32.Build.0 = Release|Win32 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|x64.ActiveCfg = Release|x64 + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2905,6 +2969,7 @@ Global {ABB71A76-42B0-47A4-973A-42E3D920C6FD} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {9778F1C0-09BC-4698-8EBC-BD982247209A} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {56B91D01-9150-4BBF-AFA1-5B68AB991B76} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} + {B376D494-D7DD-4B2A-99E2-52916D5A8CD8} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A} = {C120A020-773F-4EA3-923F-B67AF28B750D} {4F92B672-DADB-4047-8D6A-4BB3796733FD} = {C120A020-773F-4EA3-923F-B67AF28B750D} {2DEE4895-1134-439C-B688-52203E57D878} = {C120A020-773F-4EA3-923F-B67AF28B750D} @@ -2922,6 +2987,7 @@ Global {E10571C4-E7F4-4608-B5F2-B22E7EB95400} = {C120A020-773F-4EA3-923F-B67AF28B750D} {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19} = {C120A020-773F-4EA3-923F-B67AF28B750D} {B808178B-82F0-4CF4-A2B1-921939FA24D0} = {C120A020-773F-4EA3-923F-B67AF28B750D} + {D578E676-7EC8-4548-BD8B-845C635F14AD} = {C120A020-773F-4EA3-923F-B67AF28B750D} {988CACF7-3FCB-4992-BE69-77872AE67DC8} = {6CD61A1D-797C-470A-BE08-8C31B68BB336} {5BC072DB-3826-48EA-AF34-FE32AA01E83B} = {6CD61A1D-797C-470A-BE08-8C31B68BB336} {FA429E98-8B03-45E6-A096-A4BC5E821DE4} = {6CD61A1D-797C-470A-BE08-8C31B68BB336} @@ -2991,5 +3057,8 @@ Global {504B3154-7A4F-459D-9877-B951021C3F1F} = {62F27B1A-C919-4A70-8478-51F178F3B18F} {746F3632-5BB2-4570-9453-31D6D58A7D8E} = {62F27B1A-C919-4A70-8478-51F178F3B18F} {DEB01ACB-D65F-4A62-AED9-58C1054499E9} = {62F27B1A-C919-4A70-8478-51F178F3B18F} + {D331904D-A00A-4694-A5A3-FCFF64AB5DBE} = {B376D494-D7DD-4B2A-99E2-52916D5A8CD8} + {B4B62169-5AD4-4559-8707-3D933AC5DB39} = {B376D494-D7DD-4B2A-99E2-52916D5A8CD8} + {25BD39B1-C8BF-4676-A738-9CABD9C6BC79} = {B376D494-D7DD-4B2A-99E2-52916D5A8CD8} EndGlobalSection EndGlobal diff --git a/libs/win32/Download OPENSSL.2008.vcproj b/libs/win32/Download OPENSSL.2008.vcproj new file mode 100644 index 0000000..d32aa33 --- /dev/null +++ b/libs/win32/Download OPENSSL.2008.vcproj @@ -0,0 +1,92 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="Download OPENSSL" + ProjectGUID="{D578E676-7EC8-4548-BD8B-845C635F14AD}" + RootNamespace="Download OPENSSL" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="10" + CharacterSet="2" + BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="10" + CharacterSet="2" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <File + RelativePath=".\OPENSSL\cleancount" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="Downloading OPENSSL." + CommandLine="if not exist "$(ProjectDir)..\openssl-1.0.0a" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://openssl.org/source/openssl-1.0.0a.tar.gz "$(ProjectDir).." " + Outputs="$(ProjectDir)..\OPENSSL" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCustomBuildTool" + Description="Downloading OPENSSL." + CommandLine="if not exist "$(ProjectDir)..\openssl-1.0.0a" cscript /nologo "$(ProjectDir)util.vbs" GetUnzip http://openssl.org/source/openssl-1.0.0a.tar.gz "$(ProjectDir).." " + Outputs="$(ProjectDir)..\OPENSSL" + /> + </FileConfiguration> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/libs/win32/openssl/applink.c b/libs/win32/openssl/applink.c new file mode 100644 index 0000000..54a0a64 --- /dev/null +++ b/libs/win32/openssl/applink.c @@ -0,0 +1,94 @@ +#define APPLINK_STDIN 1 +#define APPLINK_STDOUT 2 +#define APPLINK_STDERR 3 +#define APPLINK_FPRINTF 4 +#define APPLINK_FGETS 5 +#define APPLINK_FREAD 6 +#define APPLINK_FWRITE 7 +#define APPLINK_FSETMOD 8 +#define APPLINK_FEOF 9 +#define APPLINK_FCLOSE 10 /* should not be used */ + +#define APPLINK_FOPEN 11 /* solely for completeness */ +#define APPLINK_FSEEK 12 +#define APPLINK_FTELL 13 +#define APPLINK_FFLUSH 14 +#define APPLINK_FERROR 15 +#define APPLINK_CLEARERR 16 +#define APPLINK_FILENO 17 /* to be used with below */ + +#define APPLINK_OPEN 18 /* formally can't be used, as flags can vary */ +#define APPLINK_READ 19 +#define APPLINK_WRITE 20 +#define APPLINK_LSEEK 21 +#define APPLINK_CLOSE 22 +#define APPLINK_MAX 22 /* always same as last macro */ + +#ifndef APPMACROS_ONLY +#include <stdio.h> +#include <io.h> +#include <fcntl.h> + +static void *app_stdin(void) { return stdin; } +static void *app_stdout(void) { return stdout; } +static void *app_stderr(void) { return stderr; } +static int app_feof(FILE *fp) { return feof(fp); } +static int app_ferror(FILE *fp) { return ferror(fp); } +static void app_clearerr(FILE *fp) { clearerr(fp); } +static int app_fileno(FILE *fp) { return _fileno(fp); } +static int app_fsetmod(FILE *fp,char mod) +{ return _setmode (_fileno(fp),mod=='b'?_O_BINARY:_O_TEXT); } + +#ifdef __cplusplus +extern "C" { +#endif + +__declspec(dllexport) +void ** +#if defined(__BORLANDC__) +__stdcall /* __stdcall appears to be the only way to get the name + * decoration right with Borland C. Otherwise it works + * purely incidentally, as we pass no parameters. */ +#else +__cdecl +#endif +OPENSSL_Applink(void) +{ static int once=1; + static void *OPENSSL_ApplinkTable[APPLINK_MAX+1]={(void *)APPLINK_MAX}; + + if (once) + { OPENSSL_ApplinkTable[APPLINK_STDIN] = app_stdin; + OPENSSL_ApplinkTable[APPLINK_STDOUT] = app_stdout; + OPENSSL_ApplinkTable[APPLINK_STDERR] = app_stderr; + OPENSSL_ApplinkTable[APPLINK_FPRINTF] = fprintf; + OPENSSL_ApplinkTable[APPLINK_FGETS] = fgets; + OPENSSL_ApplinkTable[APPLINK_FREAD] = fread; + OPENSSL_ApplinkTable[APPLINK_FWRITE] = fwrite; + OPENSSL_ApplinkTable[APPLINK_FSETMOD] = app_fsetmod; + OPENSSL_ApplinkTable[APPLINK_FEOF] = app_feof; + OPENSSL_ApplinkTable[APPLINK_FCLOSE] = fclose; + + OPENSSL_ApplinkTable[APPLINK_FOPEN] = fopen; + OPENSSL_ApplinkTable[APPLINK_FSEEK] = fseek; + OPENSSL_ApplinkTable[APPLINK_FTELL] = ftell; + OPENSSL_ApplinkTable[APPLINK_FFLUSH] = fflush; + OPENSSL_ApplinkTable[APPLINK_FERROR] = app_ferror; + OPENSSL_ApplinkTable[APPLINK_CLEARERR] = app_clearerr; + OPENSSL_ApplinkTable[APPLINK_FILENO] = app_fileno; + + OPENSSL_ApplinkTable[APPLINK_OPEN] = _open; + OPENSSL_ApplinkTable[APPLINK_READ] = _read; + OPENSSL_ApplinkTable[APPLINK_WRITE] = _write; + OPENSSL_ApplinkTable[APPLINK_LSEEK] = _lseek; + OPENSSL_ApplinkTable[APPLINK_CLOSE] = _close; + + once = 0; + } + + return OPENSSL_ApplinkTable; +} + +#ifdef __cplusplus +} +#endif +#endif diff --git a/libs/win32/openssl/buildinf.h b/libs/win32/openssl/buildinf.h new file mode 100644 index 0000000..fce8d9e --- /dev/null +++ b/libs/win32/openssl/buildinf.h @@ -0,0 +1,13 @@ +#ifndef MK1MF_BUILD + /* auto-generated by Configure for crypto/cversion.c: + * for Unix builds, crypto/Makefile.ssl generates functional definitions; + * Windows builds (and other mk1mf builds) compile cversion.c with + * -DMK1MF_BUILD and use definitions added to this file by util/mk1mf.pl. */ + #error "Windows builds (PLATFORM=VC-WIN32) use mk1mf.pl-created Makefiles" +#endif +#ifdef MK1MF_PLATFORM_VC_WIN32 + /* auto-generated/updated by util/mk1mf.pl for crypto/cversion.c */ + #define CFLAGS "cl /MD /Ox /O2 /Ob2 -DOPENSSL_THREADS -DDSO_WIN32 -W3 -WX -Gs0 -GF -Gy -nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE -DOPENSSL_USE_APPLINK -I. /Fdout32dll -DOPENSSL_NO_RC5 -DOPENSSL_NO_MD2 -DOPENSSL_NO_KRB5 -DOPENSSL_NO_JPAKE -DOPENSSL_NO_STATIC_ENGINE " + #define PLATFORM "VC-WIN32" + #define DATE "Sun Jun 6 23:40:23 2010" +#endif diff --git a/libs/win32/openssl/include/aes.h b/libs/win32/openssl/include/aes.h new file mode 100644 index 0000000..2eab3a3 --- /dev/null +++ b/libs/win32/openssl/include/aes.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/aes/aes.h" diff --git a/libs/win32/openssl/include/asn1.h b/libs/win32/openssl/include/asn1.h new file mode 100644 index 0000000..1d99477 --- /dev/null +++ b/libs/win32/openssl/include/asn1.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/asn1/asn1.h" diff --git a/libs/win32/openssl/include/asn1_mac.h b/libs/win32/openssl/include/asn1_mac.h new file mode 100644 index 0000000..e952e45 --- /dev/null +++ b/libs/win32/openssl/include/asn1_mac.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/asn1/asn1_mac.h" diff --git a/libs/win32/openssl/include/asn1t.h b/libs/win32/openssl/include/asn1t.h new file mode 100644 index 0000000..11f83b7 --- /dev/null +++ b/libs/win32/openssl/include/asn1t.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/asn1/asn1t.h" diff --git a/libs/win32/openssl/include/bio.h b/libs/win32/openssl/include/bio.h new file mode 100644 index 0000000..6526854 --- /dev/null +++ b/libs/win32/openssl/include/bio.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/bio/bio.h" diff --git a/libs/win32/openssl/include/blowfish.h b/libs/win32/openssl/include/blowfish.h new file mode 100644 index 0000000..eaabdd4 --- /dev/null +++ b/libs/win32/openssl/include/blowfish.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/bf/blowfish.h" diff --git a/libs/win32/openssl/include/bn.h b/libs/win32/openssl/include/bn.h new file mode 100644 index 0000000..6258b8b --- /dev/null +++ b/libs/win32/openssl/include/bn.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/bn/bn.h" diff --git a/libs/win32/openssl/include/buffer.h b/libs/win32/openssl/include/buffer.h new file mode 100644 index 0000000..f55ef2e --- /dev/null +++ b/libs/win32/openssl/include/buffer.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/buffer/buffer.h" diff --git a/libs/win32/openssl/include/camellia.h b/libs/win32/openssl/include/camellia.h new file mode 100644 index 0000000..33902f0 --- /dev/null +++ b/libs/win32/openssl/include/camellia.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/camellia/camellia.h" diff --git a/libs/win32/openssl/include/cast.h b/libs/win32/openssl/include/cast.h new file mode 100644 index 0000000..a012dc3 --- /dev/null +++ b/libs/win32/openssl/include/cast.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/cast/cast.h" diff --git a/libs/win32/openssl/include/cms.h b/libs/win32/openssl/include/cms.h new file mode 100644 index 0000000..fb1b812 --- /dev/null +++ b/libs/win32/openssl/include/cms.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/cms/cms.h" diff --git a/libs/win32/openssl/include/comp.h b/libs/win32/openssl/include/comp.h new file mode 100644 index 0000000..32790b9 --- /dev/null +++ b/libs/win32/openssl/include/comp.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/comp/comp.h" diff --git a/libs/win32/openssl/include/conf.h b/libs/win32/openssl/include/conf.h new file mode 100644 index 0000000..159596d --- /dev/null +++ b/libs/win32/openssl/include/conf.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/conf/conf.h" diff --git a/libs/win32/openssl/include/conf_api.h b/libs/win32/openssl/include/conf_api.h new file mode 100644 index 0000000..ec4a876 --- /dev/null +++ b/libs/win32/openssl/include/conf_api.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/conf/conf_api.h" diff --git a/libs/win32/openssl/include/crypto.h b/libs/win32/openssl/include/crypto.h new file mode 100644 index 0000000..a51f2d5 --- /dev/null +++ b/libs/win32/openssl/include/crypto.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/crypto.h" diff --git a/libs/win32/openssl/include/des.h b/libs/win32/openssl/include/des.h new file mode 100644 index 0000000..406b661 --- /dev/null +++ b/libs/win32/openssl/include/des.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/des/des.h" diff --git a/libs/win32/openssl/include/des_old.h b/libs/win32/openssl/include/des_old.h new file mode 100644 index 0000000..3353704 --- /dev/null +++ b/libs/win32/openssl/include/des_old.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/des/des_old.h" diff --git a/libs/win32/openssl/include/dh.h b/libs/win32/openssl/include/dh.h new file mode 100644 index 0000000..a4ead73 --- /dev/null +++ b/libs/win32/openssl/include/dh.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/dh/dh.h" diff --git a/libs/win32/openssl/include/dsa.h b/libs/win32/openssl/include/dsa.h new file mode 100644 index 0000000..78e7c01 --- /dev/null +++ b/libs/win32/openssl/include/dsa.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/dsa/dsa.h" diff --git a/libs/win32/openssl/include/dso.h b/libs/win32/openssl/include/dso.h new file mode 100644 index 0000000..1c7054a --- /dev/null +++ b/libs/win32/openssl/include/dso.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/dso/dso.h" diff --git a/libs/win32/openssl/include/dtls1.h b/libs/win32/openssl/include/dtls1.h new file mode 100644 index 0000000..4ddee03 --- /dev/null +++ b/libs/win32/openssl/include/dtls1.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../ssl/dtls1.h" diff --git a/libs/win32/openssl/include/e_os.h b/libs/win32/openssl/include/e_os.h new file mode 100644 index 0000000..94048a3 --- /dev/null +++ b/libs/win32/openssl/include/e_os.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../e_os.h" diff --git a/libs/win32/openssl/include/e_os2.h b/libs/win32/openssl/include/e_os2.h new file mode 100644 index 0000000..cc20371 --- /dev/null +++ b/libs/win32/openssl/include/e_os2.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../e_os2.h" diff --git a/libs/win32/openssl/include/ebcdic.h b/libs/win32/openssl/include/ebcdic.h new file mode 100644 index 0000000..37b2e13 --- /dev/null +++ b/libs/win32/openssl/include/ebcdic.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/ebcdic.h" diff --git a/libs/win32/openssl/include/ec.h b/libs/win32/openssl/include/ec.h new file mode 100644 index 0000000..6d67446 --- /dev/null +++ b/libs/win32/openssl/include/ec.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/ec/ec.h" diff --git a/libs/win32/openssl/include/ecdh.h b/libs/win32/openssl/include/ecdh.h new file mode 100644 index 0000000..7801412 --- /dev/null +++ b/libs/win32/openssl/include/ecdh.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/ecdh/ecdh.h" diff --git a/libs/win32/openssl/include/ecdsa.h b/libs/win32/openssl/include/ecdsa.h new file mode 100644 index 0000000..1370f12 --- /dev/null +++ b/libs/win32/openssl/include/ecdsa.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/ecdsa/ecdsa.h" diff --git a/libs/win32/openssl/include/engine.h b/libs/win32/openssl/include/engine.h new file mode 100644 index 0000000..8ccf4a5 --- /dev/null +++ b/libs/win32/openssl/include/engine.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/engine/engine.h" diff --git a/libs/win32/openssl/include/err.h b/libs/win32/openssl/include/err.h new file mode 100644 index 0000000..3500f72 --- /dev/null +++ b/libs/win32/openssl/include/err.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/err/err.h" diff --git a/libs/win32/openssl/include/evp.h b/libs/win32/openssl/include/evp.h new file mode 100644 index 0000000..15b9ebd --- /dev/null +++ b/libs/win32/openssl/include/evp.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/evp/evp.h" diff --git a/libs/win32/openssl/include/hmac.h b/libs/win32/openssl/include/hmac.h new file mode 100644 index 0000000..e34363a --- /dev/null +++ b/libs/win32/openssl/include/hmac.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/hmac/hmac.h" diff --git a/libs/win32/openssl/include/idea.h b/libs/win32/openssl/include/idea.h new file mode 100644 index 0000000..bce88f4 --- /dev/null +++ b/libs/win32/openssl/include/idea.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/idea/idea.h" diff --git a/libs/win32/openssl/include/krb5_asn.h b/libs/win32/openssl/include/krb5_asn.h new file mode 100644 index 0000000..ad26fa5 --- /dev/null +++ b/libs/win32/openssl/include/krb5_asn.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/krb5/krb5_asn.h" diff --git a/libs/win32/openssl/include/kssl.h b/libs/win32/openssl/include/kssl.h new file mode 100644 index 0000000..7e65452 --- /dev/null +++ b/libs/win32/openssl/include/kssl.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../ssl/kssl.h" diff --git a/libs/win32/openssl/include/lhash.h b/libs/win32/openssl/include/lhash.h new file mode 100644 index 0000000..1daaf4c --- /dev/null +++ b/libs/win32/openssl/include/lhash.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/lhash/lhash.h" diff --git a/libs/win32/openssl/include/md2.h b/libs/win32/openssl/include/md2.h new file mode 100644 index 0000000..1e4a614 --- /dev/null +++ b/libs/win32/openssl/include/md2.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/md2/md2.h" diff --git a/libs/win32/openssl/include/md4.h b/libs/win32/openssl/include/md4.h new file mode 100644 index 0000000..ed0f6d2 --- /dev/null +++ b/libs/win32/openssl/include/md4.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/md4/md4.h" diff --git a/libs/win32/openssl/include/md5.h b/libs/win32/openssl/include/md5.h new file mode 100644 index 0000000..c13663d --- /dev/null +++ b/libs/win32/openssl/include/md5.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/md5/md5.h" diff --git a/libs/win32/openssl/include/mdc2.h b/libs/win32/openssl/include/mdc2.h new file mode 100644 index 0000000..2bd18d5 --- /dev/null +++ b/libs/win32/openssl/include/mdc2.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/mdc2/mdc2.h" diff --git a/libs/win32/openssl/include/modes.h b/libs/win32/openssl/include/modes.h new file mode 100644 index 0000000..85c1e0c --- /dev/null +++ b/libs/win32/openssl/include/modes.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/modes/modes.h" \ No newline at end of file diff --git a/libs/win32/openssl/include/o_dir.h b/libs/win32/openssl/include/o_dir.h new file mode 100644 index 0000000..9575016 --- /dev/null +++ b/libs/win32/openssl/include/o_dir.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/o_dir.h" diff --git a/libs/win32/openssl/include/o_str.h b/libs/win32/openssl/include/o_str.h new file mode 100644 index 0000000..f79c9e1 --- /dev/null +++ b/libs/win32/openssl/include/o_str.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/o_str.h" diff --git a/libs/win32/openssl/include/obj_mac.h b/libs/win32/openssl/include/obj_mac.h new file mode 100644 index 0000000..e516fe3 --- /dev/null +++ b/libs/win32/openssl/include/obj_mac.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/objects/obj_mac.h" diff --git a/libs/win32/openssl/include/objects.h b/libs/win32/openssl/include/objects.h new file mode 100644 index 0000000..9b16856 --- /dev/null +++ b/libs/win32/openssl/include/objects.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/objects/objects.h" diff --git a/libs/win32/openssl/include/ocsp.h b/libs/win32/openssl/include/ocsp.h new file mode 100644 index 0000000..c10bd61 --- /dev/null +++ b/libs/win32/openssl/include/ocsp.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/ocsp/ocsp.h" diff --git a/libs/win32/openssl/include/opensslv.h b/libs/win32/openssl/include/opensslv.h new file mode 100644 index 0000000..fc80ef0 --- /dev/null +++ b/libs/win32/openssl/include/opensslv.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/opensslv.h" diff --git a/libs/win32/openssl/include/ossl_typ.h b/libs/win32/openssl/include/ossl_typ.h new file mode 100644 index 0000000..3846327 --- /dev/null +++ b/libs/win32/openssl/include/ossl_typ.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/ossl_typ.h" diff --git a/libs/win32/openssl/include/pem.h b/libs/win32/openssl/include/pem.h new file mode 100644 index 0000000..15b5fc2 --- /dev/null +++ b/libs/win32/openssl/include/pem.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/pem/pem.h" diff --git a/libs/win32/openssl/include/pem2.h b/libs/win32/openssl/include/pem2.h new file mode 100644 index 0000000..ded67ff --- /dev/null +++ b/libs/win32/openssl/include/pem2.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/pem/pem2.h" diff --git a/libs/win32/openssl/include/pkcs12.h b/libs/win32/openssl/include/pkcs12.h new file mode 100644 index 0000000..74e3ee1 --- /dev/null +++ b/libs/win32/openssl/include/pkcs12.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/pkcs12/pkcs12.h" diff --git a/libs/win32/openssl/include/pkcs7.h b/libs/win32/openssl/include/pkcs7.h new file mode 100644 index 0000000..b0f3b8d --- /dev/null +++ b/libs/win32/openssl/include/pkcs7.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/pkcs7/pkcs7.h" diff --git a/libs/win32/openssl/include/pq_compat.h b/libs/win32/openssl/include/pq_compat.h new file mode 100644 index 0000000..8745d1d --- /dev/null +++ b/libs/win32/openssl/include/pq_compat.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/pqueue/pq_compat.h" diff --git a/libs/win32/openssl/include/pqueue.h b/libs/win32/openssl/include/pqueue.h new file mode 100644 index 0000000..7f97c34 --- /dev/null +++ b/libs/win32/openssl/include/pqueue.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/pqueue/pqueue.h" diff --git a/libs/win32/openssl/include/rand.h b/libs/win32/openssl/include/rand.h new file mode 100644 index 0000000..b989279 --- /dev/null +++ b/libs/win32/openssl/include/rand.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/rand/rand.h" diff --git a/libs/win32/openssl/include/rc2.h b/libs/win32/openssl/include/rc2.h new file mode 100644 index 0000000..29a1a71 --- /dev/null +++ b/libs/win32/openssl/include/rc2.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/rc2/rc2.h" diff --git a/libs/win32/openssl/include/rc4.h b/libs/win32/openssl/include/rc4.h new file mode 100644 index 0000000..3a3a41f --- /dev/null +++ b/libs/win32/openssl/include/rc4.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/rc4/rc4.h" diff --git a/libs/win32/openssl/include/rc5.h b/libs/win32/openssl/include/rc5.h new file mode 100644 index 0000000..a069529 --- /dev/null +++ b/libs/win32/openssl/include/rc5.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/rc5/rc5.h" diff --git a/libs/win32/openssl/include/ripemd.h b/libs/win32/openssl/include/ripemd.h new file mode 100644 index 0000000..d347e76 --- /dev/null +++ b/libs/win32/openssl/include/ripemd.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/ripemd/ripemd.h" diff --git a/libs/win32/openssl/include/rsa.h b/libs/win32/openssl/include/rsa.h new file mode 100644 index 0000000..ca9a946 --- /dev/null +++ b/libs/win32/openssl/include/rsa.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/rsa/rsa.h" diff --git a/libs/win32/openssl/include/safestack.h b/libs/win32/openssl/include/safestack.h new file mode 100644 index 0000000..f2986e7 --- /dev/null +++ b/libs/win32/openssl/include/safestack.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/stack/safestack.h" diff --git a/libs/win32/openssl/include/seed.h b/libs/win32/openssl/include/seed.h new file mode 100644 index 0000000..f9f6e3b --- /dev/null +++ b/libs/win32/openssl/include/seed.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/seed/seed.h" diff --git a/libs/win32/openssl/include/sha.h b/libs/win32/openssl/include/sha.h new file mode 100644 index 0000000..8fea6ce --- /dev/null +++ b/libs/win32/openssl/include/sha.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/sha/sha.h" diff --git a/libs/win32/openssl/include/ssl.h b/libs/win32/openssl/include/ssl.h new file mode 100644 index 0000000..9737ffb --- /dev/null +++ b/libs/win32/openssl/include/ssl.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../ssl/ssl.h" diff --git a/libs/win32/openssl/include/ssl2.h b/libs/win32/openssl/include/ssl2.h new file mode 100644 index 0000000..1bbe013 --- /dev/null +++ b/libs/win32/openssl/include/ssl2.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../ssl/ssl2.h" diff --git a/libs/win32/openssl/include/ssl23.h b/libs/win32/openssl/include/ssl23.h new file mode 100644 index 0000000..a800ee1 --- /dev/null +++ b/libs/win32/openssl/include/ssl23.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../ssl/ssl23.h" diff --git a/libs/win32/openssl/include/ssl3.h b/libs/win32/openssl/include/ssl3.h new file mode 100644 index 0000000..e578179 --- /dev/null +++ b/libs/win32/openssl/include/ssl3.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../ssl/ssl3.h" diff --git a/libs/win32/openssl/include/stack.h b/libs/win32/openssl/include/stack.h new file mode 100644 index 0000000..3727b32 --- /dev/null +++ b/libs/win32/openssl/include/stack.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/stack/stack.h" diff --git a/libs/win32/openssl/include/store.h b/libs/win32/openssl/include/store.h new file mode 100644 index 0000000..ecd1be9 --- /dev/null +++ b/libs/win32/openssl/include/store.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/store/store.h" diff --git a/libs/win32/openssl/include/symhacks.h b/libs/win32/openssl/include/symhacks.h new file mode 100644 index 0000000..7e48c66 --- /dev/null +++ b/libs/win32/openssl/include/symhacks.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/symhacks.h" diff --git a/libs/win32/openssl/include/tls1.h b/libs/win32/openssl/include/tls1.h new file mode 100644 index 0000000..3a5e555 --- /dev/null +++ b/libs/win32/openssl/include/tls1.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../ssl/tls1.h" diff --git a/libs/win32/openssl/include/tmdiff.h b/libs/win32/openssl/include/tmdiff.h new file mode 100644 index 0000000..8eb8256 --- /dev/null +++ b/libs/win32/openssl/include/tmdiff.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/tmdiff.h" diff --git a/libs/win32/openssl/include/ts.h b/libs/win32/openssl/include/ts.h new file mode 100644 index 0000000..fcc13f2 --- /dev/null +++ b/libs/win32/openssl/include/ts.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/ts/ts.h" diff --git a/libs/win32/openssl/include/txt_db.h b/libs/win32/openssl/include/txt_db.h new file mode 100644 index 0000000..91293f5 --- /dev/null +++ b/libs/win32/openssl/include/txt_db.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/txt_db/txt_db.h" diff --git a/libs/win32/openssl/include/ui.h b/libs/win32/openssl/include/ui.h new file mode 100644 index 0000000..409432f --- /dev/null +++ b/libs/win32/openssl/include/ui.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/ui/ui.h" diff --git a/libs/win32/openssl/include/ui_compat.h b/libs/win32/openssl/include/ui_compat.h new file mode 100644 index 0000000..3d3bdd0 --- /dev/null +++ b/libs/win32/openssl/include/ui_compat.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/ui/ui_compat.h" diff --git a/libs/win32/openssl/include/whrlpool.h b/libs/win32/openssl/include/whrlpool.h new file mode 100644 index 0000000..ff653ff --- /dev/null +++ b/libs/win32/openssl/include/whrlpool.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/whrlpool/whrlpool.h" diff --git a/libs/win32/openssl/include/x509.h b/libs/win32/openssl/include/x509.h new file mode 100644 index 0000000..666f2c8 --- /dev/null +++ b/libs/win32/openssl/include/x509.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/x509/x509.h" diff --git a/libs/win32/openssl/include/x509_vfy.h b/libs/win32/openssl/include/x509_vfy.h new file mode 100644 index 0000000..fb8ea1a --- /dev/null +++ b/libs/win32/openssl/include/x509_vfy.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/x509/x509_vfy.h" diff --git a/libs/win32/openssl/include/x509v3.h b/libs/win32/openssl/include/x509v3.h new file mode 100644 index 0000000..4d666a8 --- /dev/null +++ b/libs/win32/openssl/include/x509v3.h @@ -0,0 +1,2 @@ +/* file generated by 'generate-global-headers.bat' */ +#include "..\../crypto/x509v3/x509v3.h" diff --git a/libs/win32/openssl/libeay32.2008.vcproj b/libs/win32/openssl/libeay32.2008.vcproj new file mode 100644 index 0000000..d75eb5f --- /dev/null +++ b/libs/win32/openssl/libeay32.2008.vcproj @@ -0,0 +1,3150 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="libeay32" + ProjectGUID="{D331904D-A00A-4694-A5A3-FCFF64AB5DBE}" + RootNamespace="openssl" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + <DefaultToolFile + FileName="masm.rules" + /> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="2" + CharacterSet="1" + ManagedExtensions="0" + > + <Tool + Name="VCPreBuildEventTool" + CommandLine="copy /Y $(ProjectDir)opensslconf.h $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h copy /Y $(ProjectDir)applink.c $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c copy /Y $(ProjectDir)buildinf.h $(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h copy /Y $(ProjectDir)libeay32.def $(ProjectDir)..\..\openssl-1.0.0a\libeay32.def " + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="MASM" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/Gs0" + Optimization="3" + InlineFunctionExpansion="2" + AdditionalIncludeDirectories=""..\..\openssl-1.0.0a\include";"..\..\openssl-1.0.0a\crypto";"..\..\openssl-1.0.0a\crypto\aes";"..\..\openssl-1.0.0a\crypto\asn1";"..\..\openssl-1.0.0a\crypto\bf";"..\..\openssl-1.0.0a\crypto\bio";"..\..\openssl-1.0.0a\crypto\bn";"..\..\openssl-1.0.0a\crypto\buffer";"..\..\openssl-1.0.0a\crypto\camellia";"..\..\openssl-1.0.0a\crypto\cast";"..\..\openssl-1.0.0a\crypto\cms";"..\..\openssl-1.0.0a\crypto\comp";"..\..\openssl-1.0.0a\crypto\conf";"..\..\openssl-1.0.0a\crypto\des";"..\..\openssl-1.0.0a\crypto\dh";"..\..\openssl-1.0.0a\crypto\dsa";"..\..\openssl-1.0.0a\crypto\dso";"..\..\openssl-1.0.0a\crypto\ec";"..\..\openssl-1.0.0a\crypto\ecdh";"..\..\openssl-1.0.0a\crypto\ecdsa";"..\..\openssl-1.0.0a\crypto\engine";"..\..\openssl-1.0.0a\crypto\err";"..\..\openssl-1.0.0a\crypto\evp";"..\..\openssl-1.0.0a\ms";"..\..\openssl-1.0.0a"" + PreprocessorDefinitions="WINDOWS;WIN32;_DEBUG;_CRT_NON_CONFORMING_SWPRINTFS;OPENSSL_THREADS;DSO_WIN32;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_ASM;OPENSSL_NO_GMP;OPENSSL_NO_JPAKE;OPENSSL_NO_KRB5;OPENSSL_NO_MD2;OPENSSL_NO_RFC3779;OPENSSL_NO_STORE;OPENSSL_NO_STATIC_ENGINE;OPENSSL_BUILD_SHLIBCRYPTO;MK1MF_BUILD" + StringPooling="true" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="3" + WarnAsError="true" + DebugInformationFormat="3" + DisableSpecificWarnings="4996" + EnablePREfast="false" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="ws2_32.lib" + LinkIncremental="2" + ModuleDefinitionFile="$(ProjectDir)..\..\openssl-1.0.0a\libeay32.def" + GenerateDebugInformation="true" + AssemblyDebug="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="2" + CharacterSet="1" + ManagedExtensions="0" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + CommandLine="copy /Y $(ProjectDir)opensslconf.h $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h copy /Y $(ProjectDir)applink.c $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c copy /Y $(ProjectDir)buildinf.h $(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h copy /Y $(ProjectDir)libeay32.def $(ProjectDir)..\..\openssl-1.0.0a\libeay32.def " + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="MASM" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/Gs0" + Optimization="3" + InlineFunctionExpansion="2" + AdditionalIncludeDirectories=""..\..\openssl-1.0.0a\include";"..\..\openssl-1.0.0a\crypto";"..\..\openssl-1.0.0a\crypto\aes";"..\..\openssl-1.0.0a\crypto\asn1";"..\..\openssl-1.0.0a\crypto\bf";"..\..\openssl-1.0.0a\crypto\bio";"..\..\openssl-1.0.0a\crypto\bn";"..\..\openssl-1.0.0a\crypto\buffer";"..\..\openssl-1.0.0a\crypto\camellia";"..\..\openssl-1.0.0a\crypto\cast";"..\..\openssl-1.0.0a\crypto\cms";"..\..\openssl-1.0.0a\crypto\comp";"..\..\openssl-1.0.0a\crypto\conf";"..\..\openssl-1.0.0a\crypto\des";"..\..\openssl-1.0.0a\crypto\dh";"..\..\openssl-1.0.0a\crypto\dsa";"..\..\openssl-1.0.0a\crypto\dso";"..\..\openssl-1.0.0a\crypto\ec";"..\..\openssl-1.0.0a\crypto\ecdh";"..\..\openssl-1.0.0a\crypto\ecdsa";"..\..\openssl-1.0.0a\crypto\engine";"..\..\openssl-1.0.0a\crypto\err";"..\..\openssl-1.0.0a\crypto\evp";"..\..\openssl-1.0.0a\ms";"..\..\openssl-1.0.0a"" + PreprocessorDefinitions="WIN32;NDEBUG;_CRT_NON_CONFORMING_SWPRINTFS;OPENSSL_THREADS;DSO_WIN32;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_ASM;OPENSSL_NO_GMP;OPENSSL_NO_JPAKE;OPENSSL_NO_KRB5;OPENSSL_NO_MD2;OPENSSL_NO_RFC3779;OPENSSL_NO_STORE;OPENSSL_NO_STATIC_ENGINE;OPENSSL_BUILD_SHLIBCRYPTO;MK1MF_BUILD" + StringPooling="true" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="3" + WarnAsError="true" + DebugInformationFormat="3" + DisableSpecificWarnings="4996" + EnablePREfast="false" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="ws2_32.lib" + LinkIncremental="2" + ModuleDefinitionFile="$(ProjectDir)..\..\openssl-1.0.0a\libeay32.def" + GenerateDebugInformation="true" + AssemblyDebug="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="2" + CharacterSet="1" + ManagedExtensions="0" + > + <Tool + Name="VCPreBuildEventTool" + CommandLine="copy /Y $(ProjectDir)opensslconf.h $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h copy /Y $(ProjectDir)applink.c $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c copy /Y $(ProjectDir)buildinf.h $(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h copy /Y $(ProjectDir)libeay32.def $(ProjectDir)..\..\openssl-1.0.0a\libeay32.def if not exist " $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\bio.h" xcopy "$(ProjectDir)\include\*.*" "$(ProjectDir)..\..\openssl-1.0.0a\include\openssl\" /C /D /Y /S" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="MASM" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/Gs0" + Optimization="3" + InlineFunctionExpansion="2" + AdditionalIncludeDirectories=""..\..\openssl-1.0.0a\include";"..\..\openssl-1.0.0a\crypto";"..\..\openssl-1.0.0a\crypto\aes";"..\..\openssl-1.0.0a\crypto\asn1";"..\..\openssl-1.0.0a\crypto\bf";"..\..\openssl-1.0.0a\crypto\bio";"..\..\openssl-1.0.0a\crypto\bn";"..\..\openssl-1.0.0a\crypto\buffer";"..\..\openssl-1.0.0a\crypto\camellia";"..\..\openssl-1.0.0a\crypto\cast";"..\..\openssl-1.0.0a\crypto\cms";"..\..\openssl-1.0.0a\crypto\comp";"..\..\openssl-1.0.0a\crypto\conf";"..\..\openssl-1.0.0a\crypto\des";"..\..\openssl-1.0.0a\crypto\dh";"..\..\openssl-1.0.0a\crypto\dsa";"..\..\openssl-1.0.0a\crypto\dso";"..\..\openssl-1.0.0a\crypto\ec";"..\..\openssl-1.0.0a\crypto\ecdh";"..\..\openssl-1.0.0a\crypto\ecdsa";"..\..\openssl-1.0.0a\crypto\engine";"..\..\openssl-1.0.0a\crypto\err";"..\..\openssl-1.0.0a\crypto\evp";"..\..\openssl-1.0.0a\ms";"..\..\openssl-1.0.0a"" + PreprocessorDefinitions="WINDOWS;WIN32;_DEBUG;_CRT_NON_CONFORMING_SWPRINTFS;OPENSSL_THREADS;DSO_WIN32;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_NO_ASM;OPENSSL_NO_GMP;OPENSSL_NO_JPAKE;OPENSSL_NO_KRB5;OPENSSL_NO_MD2;OPENSSL_NO_RFC3779;OPENSSL_NO_STORE;OPENSSL_NO_STATIC_ENGINE;OPENSSL_BUILD_SHLIBCRYPTO;MK1MF_BUILD" + StringPooling="true" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3" + DisableSpecificWarnings="4996" + EnablePREfast="false" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="ws2_32.lib" + LinkIncremental="2" + ModuleDefinitionFile="$(ProjectDir)..\..\openssl-1.0.0a\libeay32.def" + GenerateDebugInformation="true" + AssemblyDebug="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="2" + CharacterSet="1" + ManagedExtensions="0" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + CommandLine="copy /Y $(ProjectDir)opensslconf.h $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\opensslconf.h copy /Y $(ProjectDir)applink.c $(ProjectDir)..\..\openssl-1.0.0a\include\openssl\applink.c copy /Y $(ProjectDir)buildinf.h $(ProjectDir)..\..\openssl-1.0.0a\crypto\buildinf.h copy /Y $(ProjectDir)libeay32.def $(ProjectDir)..\..\openssl-1.0.0a\libeay32.def " + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="MASM" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/Gs0" + Optimization="3" + InlineFunctionExpansion="2" + AdditionalIncludeDirectories=""..\..\openssl-1.0.0a\include";"..\..\openssl-1.0.0a\crypto";"..\..\openssl-1.0.0a\crypto\aes";"..\..\openssl-1.0.0a\crypto\asn1";"..\..\openssl-1.0.0a\crypto\bf";"..\..\openssl-1.0.0a\crypto\bio";"..\..\openssl-1.0.0a\crypto\bn";"..\..\openssl-1.0.0a\crypto\buffer";"..\..\openssl-1.0.0a\crypto\camellia";"..\..\openssl-1.0.0a\crypto\cast";"..\..\openssl-1.0.0a\crypto\cms";"..\..\openssl-1.0.0a\crypto\comp";"..\..\openssl-1.0.0a\crypto\conf";"..\..\openssl-1.0.0a\crypto\des";"..\..\openssl-1.0.0a\crypto\dh";"..\..\openssl-1.0.0a\crypto\dsa";"..\..\openssl-1.0.0a\crypto\dso";"..\..\openssl-1.0.0a\crypto\ec";"..\..\openssl-1.0.0a\crypto\ecdh";"..\..\openssl-1.0.0a\crypto\ecdsa";"..\..\openssl-1.0.0a\crypto\engine";"..\..\openssl-1.0.0a\crypto\err";"..\..\openssl-1.0.0a\crypto\evp";"..\..\openssl-1.0.0a\ms";"..\..\openssl-1.0.0a"" + PreprocessorDefinitions="WIN32;NDEBUG;_CRT_NON_CONFORMING_SWPRINTFS;OPENSSL_THREADS;DSO_WIN32;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_ASM;OPENSSL_NO_GMP;OPENSSL_NO_JPAKE;OPENSSL_NO_KRB5;OPENSSL_NO_MD2;OPENSSL_NO_RFC3779;OPENSSL_NO_STORE;OPENSSL_NO_STATIC_ENGINE;OPENSSL_BUILD_SHLIBCRYPTO;MK1MF_BUILD" + StringPooling="true" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3" + DisableSpecificWarnings="4996" + EnablePREfast="false" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="ws2_32.lib" + LinkIncremental="2" + ModuleDefinitionFile="$(ProjectDir)..\..\openssl-1.0.0a\libeay32.def" + GenerateDebugInformation="true" + AssemblyDebug="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <Filter + Name="crypto" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\cpt_err.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\cryptlib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\cversion.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ex_data.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\mem.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\mem_clr.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\mem_dbg.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\o_dir.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\o_time.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\uid.c" + > + </File> + <Filter + Name="rc2" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rc2\rc2_cbc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rc2\rc2_ecb.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rc2\rc2_skey.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rc2\rc2cfb64.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rc2\rc2ofb64.c" + > + </File> + </Filter> + <Filter + Name="rc4" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rc4\rc4_enc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rc4\rc4_skey.c" + > + </File> + </Filter> + <Filter + Name="idea" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\idea\i_cbc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\idea\i_cfb64.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\idea\i_ecb.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\idea\i_ofb64.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\idea\i_skey.c" + > + </File> + </Filter> + <Filter + Name="bf" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bf\bf_cfb64.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bf\bf_ecb.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bf\bf_enc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bf\bf_ofb64.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bf\bf_skey.c" + > + </File> + </Filter> + <Filter + Name="cast" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\cast\c_cfb64.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\cast\c_ecb.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\cast\c_enc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\cast\c_ofb64.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\cast\c_skey.c" + > + </File> + </Filter> + <Filter + Name="ripemd" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ripemd\rmd_dgst.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ripemd\rmd_one.c" + > + </File> + </Filter> + <Filter + Name="des" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\des\cbc_cksm.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\des\cbc_enc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\des\cfb64ede.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\des\cfb64enc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\des\cfb_enc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\des\des_enc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\des\des_old.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\des\des_old2.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\des\ecb3_enc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\des\ecb_enc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\des\ede_cbcm_enc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\des\enc_read.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\des\enc_writ.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\des\fcrypt.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\des\fcrypt_b.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\des\ofb64ede.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\des\ofb64enc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\des\ofb_enc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\des\pcbc_enc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\des\qud_cksm.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\des\rand_key.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\des\read2pwd.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\des\rpc_enc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\des\set_key.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\des\str2key.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\des\xcbc_enc.c" + > + </File> + </Filter> + <Filter + Name="aes" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\aes\aes_cbc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\aes\aes_cfb.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\aes\aes_core.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\aes\aes_ctr.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\aes\aes_ecb.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\aes\aes_ige.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\aes\aes_misc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\aes\aes_ofb.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\aes\aes_wrap.c" + > + </File> + </Filter> + <Filter + Name="camellia" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\camellia\camellia.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\camellia\cmll_cbc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\camellia\cmll_cfb.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\camellia\cmll_ctr.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\camellia\cmll_ecb.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\camellia\cmll_misc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\camellia\cmll_ofb.c" + > + </File> + </Filter> + <Filter + Name="seed" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\seed\seed.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\seed\seed_cbc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\seed\seed_cfb.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\seed\seed_ecb.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\seed\seed_ofb.c" + > + </File> + </Filter> + <Filter + Name="modes" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\modes\cbc128.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\modes\cfb128.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\modes\ctr128.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\modes\cts128.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\modes\ofb128.c" + > + </File> + </Filter> + <Filter + Name="bn" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bn\bn_add.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bn\bn_asm.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bn\bn_blind.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bn\bn_const.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bn\bn_ctx.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bn\bn_depr.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bn\bn_div.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bn\bn_err.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bn\bn_exp.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bn\bn_exp2.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bn\bn_gcd.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bn\bn_gf2m.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bn\bn_kron.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bn\bn_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bn\bn_mod.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bn\bn_mont.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bn\bn_mpi.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bn\bn_mul.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bn\bn_nist.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bn\bn_prime.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bn\bn_print.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bn\bn_rand.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bn\bn_recp.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bn\bn_shift.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bn\bn_sqr.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bn\bn_sqrt.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bn\bn_word.c" + > + </File> + </Filter> + <Filter + Name="rsa" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rsa\rsa_ameth.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rsa\rsa_asn1.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rsa\rsa_chk.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rsa\rsa_depr.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rsa\rsa_eay.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rsa\rsa_err.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rsa\rsa_gen.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rsa\rsa_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rsa\rsa_none.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rsa\rsa_null.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rsa\rsa_oaep.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rsa\rsa_pk1.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rsa\rsa_pmeth.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rsa\rsa_prn.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rsa\rsa_pss.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rsa\rsa_saos.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rsa\rsa_sign.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rsa\rsa_ssl.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rsa\rsa_x931.c" + > + </File> + </Filter> + <Filter + Name="dsa" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dsa\dsa_ameth.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dsa\dsa_asn1.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dsa\dsa_depr.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dsa\dsa_err.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dsa\dsa_gen.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dsa\dsa_key.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dsa\dsa_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dsa\dsa_ossl.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dsa\dsa_pmeth.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dsa\dsa_prn.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dsa\dsa_sign.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dsa\dsa_vrf.c" + > + </File> + </Filter> + <Filter + Name="rand" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rand\md_rand.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rand\rand_egd.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rand\rand_err.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rand\rand_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rand\rand_nw.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rand\rand_os2.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rand\rand_unix.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rand\rand_win.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\rand\randfile.c" + > + </File> + </Filter> + <Filter + Name="bio" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bio\b_dump.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bio\b_print.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bio\b_sock.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bio\bf_buff.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bio\bf_nbio.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bio\bf_null.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bio\bio_cb.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bio\bio_err.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bio\bio_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bio\bss_acpt.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bio\bss_bio.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bio\bss_conn.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bio\bss_dgram.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bio\bss_fd.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bio\bss_file.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bio\bss_log.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bio\bss_mem.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bio\bss_null.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bio\bss_sock.c" + > + </File> + </Filter> + <Filter + Name="err" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\err\err.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\err\err_all.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\err\err_prn.c" + > + </File> + </Filter> + <Filter + Name="ui" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ui\ui_compat.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ui\ui_err.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ui\ui_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ui\ui_openssl.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ui\ui_util.c" + > + </File> + </Filter> + <Filter + Name="x509" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509\by_dir.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509\by_file.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509\x509_att.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509\x509_cmp.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509\x509_d2.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509\x509_def.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509\x509_err.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509\x509_ext.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509\x509_lu.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509\x509_obj.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509\x509_r2x.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509\x509_req.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509\x509_set.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509\x509_trs.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509\x509_txt.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509\x509_v3.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509\x509_vfy.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509\x509_vpm.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509\x509cset.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509\x509name.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509\x509rset.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509\x509spki.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509\x509type.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509\x_all.c" + > + </File> + </Filter> + <Filter + Name="asn1" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\a_bitstr.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\a_bool.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\a_bytes.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\a_d2i_fp.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\a_digest.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\a_dup.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\a_enum.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\a_gentm.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\a_i2d_fp.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\a_int.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\a_mbstr.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\a_object.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\a_octet.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\a_print.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\a_set.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\a_sign.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\a_strex.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\a_strnid.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\a_time.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\a_type.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\a_utctm.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\a_utf8.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\a_verify.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\ameth_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\asn1_err.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\asn1_gen.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\asn1_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\asn1_par.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\asn_mime.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\asn_moid.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\asn_pack.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\bio_asn1.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\bio_ndef.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\d2i_pr.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\d2i_pu.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\evp_asn1.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\f_enum.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\f_int.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\f_string.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\i2d_pr.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\i2d_pu.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\n_pkey.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\nsseq.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\p5_pbe.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\p5_pbev2.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\p8_pkey.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\t_bitst.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\t_crl.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\t_pkey.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\t_req.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\t_spki.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\t_x509.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\t_x509a.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\tasn_dec.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\tasn_enc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\tasn_fre.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\tasn_new.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\tasn_prn.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\tasn_typ.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\tasn_utl.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\x_algor.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\x_attrib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\x_bignum.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\x_crl.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\x_exten.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\x_info.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\x_long.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\x_name.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\x_nx509.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\x_pkey.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\x_pubkey.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\x_req.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\x_sig.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\x_spki.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\x_val.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\x_x509.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\asn1\x_x509a.c" + > + </File> + </Filter> + <Filter + Name="objects" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\objects\o_names.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\objects\obj_dat.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\objects\obj_err.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\objects\obj_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\objects\obj_xref.c" + > + </File> + </Filter> + <Filter + Name="evp" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\bio_b64.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\bio_enc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\bio_md.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\bio_ok.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\c_all.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\c_allc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\c_alld.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\digest.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\e_aes.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\e_bf.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\e_camellia.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\e_cast.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\e_des.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\e_des3.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\e_idea.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\e_null.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\e_old.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\e_rc2.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\e_rc4.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\e_rc5.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\e_seed.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\e_xcbc_d.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\encode.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\evp_acnf.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\evp_enc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\evp_err.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\evp_key.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\evp_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\evp_pbe.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\evp_pkey.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\m_dss.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\m_dss1.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\m_ecdsa.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\m_md2.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\m_md4.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\m_md5.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\m_mdc2.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\m_null.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\m_ripemd.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\m_sha.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\m_sha1.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\m_sigver.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\m_wp.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\names.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\openbsd_hw.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\p5_crpt.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\p5_crpt2.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\p_dec.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\p_enc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\p_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\p_open.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\p_seal.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\p_sign.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\p_verify.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\pmeth_fn.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\pmeth_gn.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\pmeth_lib.c" + > + </File> + </Filter> + <Filter + Name="buffer" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\buffer\buf_err.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\buffer\buffer.c" + > + </File> + </Filter> + <Filter + Name="cms" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\cms\cms_asn1.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\cms\cms_att.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\cms\cms_cd.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\cms\cms_dd.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\cms\cms_enc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\cms\cms_env.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\cms\cms_err.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\cms\cms_ess.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\cms\cms_io.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\cms\cms_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\cms\cms_sd.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\cms\cms_smime.c" + > + </File> + </Filter> + <Filter + Name="engine" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\engine\eng_all.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\engine\eng_cnf.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\engine\eng_cryptodev.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\engine\eng_ctrl.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\engine\eng_dyn.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\engine\eng_err.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\engine\eng_fat.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\engine\eng_init.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\engine\eng_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\engine\eng_list.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\engine\eng_openssl.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\engine\eng_pkey.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\engine\eng_table.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\engine\tb_asnmth.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\engine\tb_cipher.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\engine\tb_dh.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\engine\tb_digest.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\engine\tb_dsa.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\engine\tb_ecdh.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\engine\tb_ecdsa.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\engine\tb_pkmeth.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\engine\tb_rand.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\engine\tb_rsa.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\engine\tb_store.c" + > + </File> + </Filter> + <Filter + Name="stack" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\stack\stack.c" + > + </File> + </Filter> + <Filter + Name="pkcs7" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pkcs7\bio_pk7.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pkcs7\pk7_asn1.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pkcs7\pk7_attr.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pkcs7\pk7_doit.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pkcs7\pk7_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pkcs7\pk7_mime.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pkcs7\pk7_smime.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pkcs7\pkcs7err.c" + > + </File> + </Filter> + <Filter + Name="dh" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dh\dh_ameth.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dh\dh_asn1.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dh\dh_check.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dh\dh_depr.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dh\dh_err.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dh\dh_gen.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dh\dh_key.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dh\dh_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dh\dh_pmeth.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dh\dh_prn.c" + > + </File> + </Filter> + <Filter + Name="ocsp" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ocsp\ocsp_asn.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ocsp\ocsp_cl.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ocsp\ocsp_err.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ocsp\ocsp_ext.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ocsp\ocsp_ht.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ocsp\ocsp_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ocsp\ocsp_prn.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ocsp\ocsp_srv.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ocsp\ocsp_vfy.c" + > + </File> + </Filter> + <Filter + Name="x509v3" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\pcy_cache.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\pcy_data.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\pcy_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\pcy_map.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\pcy_node.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\pcy_tree.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\v3_addr.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\v3_akey.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\v3_akeya.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\v3_alt.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\v3_asid.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\v3_bcons.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\v3_bitst.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\v3_conf.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\v3_cpols.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\v3_crld.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\v3_enum.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\v3_extku.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\v3_genn.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\v3_ia5.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\v3_info.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\v3_int.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\v3_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\v3_ncons.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\v3_ocsp.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\v3_pci.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\v3_pcia.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\v3_pcons.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\v3_pku.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\v3_pmaps.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\v3_prn.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\v3_purp.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\v3_skey.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\v3_sxnet.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\v3_utl.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\x509v3\v3err.c" + > + </File> + </Filter> + <Filter + Name="ts" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ts\ts_asn1.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ts\ts_conf.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ts\ts_err.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ts\ts_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ts\ts_req_print.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ts\ts_req_utils.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ts\ts_rsp_print.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ts\ts_rsp_sign.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ts\ts_rsp_utils.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ts\ts_rsp_verify.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ts\ts_verify_ctx.c" + > + </File> + </Filter> + <Filter + Name="conf" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\conf\conf_api.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\conf\conf_def.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\conf\conf_err.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\conf\conf_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\conf\conf_mall.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\conf\conf_mod.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\conf\conf_sap.c" + > + </File> + </Filter> + <Filter + Name="ec" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ec\ec2_mult.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ec\ec2_smpl.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ec\ec_ameth.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ec\ec_asn1.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ec\ec_check.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ec\ec_curve.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ec\ec_cvt.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ec\ec_err.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ec\ec_key.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ec\ec_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ec\ec_mult.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ec\ec_pmeth.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ec\ec_print.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ec\eck_prn.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ec\ecp_mont.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ec\ecp_nist.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ec\ecp_smpl.c" + > + </File> + </Filter> + <Filter + Name="ecdh" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ecdh\ech_err.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ecdh\ech_key.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ecdh\ech_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ecdh\ech_ossl.c" + > + </File> + </Filter> + <Filter + Name="ecdsa" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ecdsa\ecs_asn1.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ecdsa\ecs_err.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ecdsa\ecs_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ecdsa\ecs_ossl.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ecdsa\ecs_sign.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\ecdsa\ecs_vrf.c" + > + </File> + </Filter> + <Filter + Name="md5" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\md5\md5_dgst.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\md5\md5_one.c" + > + </File> + </Filter> + <Filter + Name="md4" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\md4\md4_dgst.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\md4\md4_one.c" + > + </File> + </Filter> + <Filter + Name="lhash" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\lhash\lh_stats.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\lhash\lhash.c" + > + </File> + </Filter> + <Filter + Name="dso" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dso\dso_beos.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dso\dso_dl.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dso\dso_dlfcn.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dso\dso_err.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dso\dso_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dso\dso_null.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dso\dso_openssl.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dso\dso_vms.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\dso\dso_win32.c" + > + </File> + </Filter> + <Filter + Name="pkcs12" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pkcs12\p12_add.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pkcs12\p12_asn.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pkcs12\p12_attr.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pkcs12\p12_crpt.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pkcs12\p12_crt.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pkcs12\p12_decr.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pkcs12\p12_init.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pkcs12\p12_key.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pkcs12\p12_kiss.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pkcs12\p12_mutl.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pkcs12\p12_npas.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pkcs12\p12_p8d.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pkcs12\p12_p8e.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pkcs12\p12_utl.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pkcs12\pk12err.c" + > + </File> + </Filter> + <Filter + Name="hmac" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\hmac\hm_ameth.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\hmac\hm_pmeth.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\hmac\hmac.c" + > + </File> + </Filter> + <Filter + Name="sha" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\sha\sha1_one.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\sha\sha1dgst.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\sha\sha256.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\sha\sha512.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\sha\sha512t.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\sha\sha_dgst.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\sha\sha_one.c" + > + </File> + </Filter> + <Filter + Name="comp" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\comp\c_rle.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\comp\c_zlib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\comp\comp_err.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\comp\comp_lib.c" + > + </File> + </Filter> + <Filter + Name="pem" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pem\pem_all.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pem\pem_err.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pem\pem_info.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pem\pem_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pem\pem_oth.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pem\pem_pk8.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pem\pem_pkey.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pem\pem_seal.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pem\pem_sign.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pem\pem_x509.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pem\pem_xaux.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pem\pvkfmt.c" + > + </File> + </Filter> + <Filter + Name="whrlpool" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\whrlpool\wp_block.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\whrlpool\wp_dgst.c" + > + </File> + </Filter> + <Filter + Name="mdc2" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\mdc2\mdc2_one.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\mdc2\mdc2dgst.c" + > + </File> + </Filter> + <Filter + Name="krb5" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\krb5\krb5_asn.c" + > + </File> + </Filter> + <Filter + Name="txt_db" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\txt_db\txt_db.c" + > + </File> + </Filter> + <Filter + Name="pqueue" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\pqueue\pqueue.c" + > + </File> + </Filter> + </Filter> + <Filter + Name="ms" + > + <File + RelativePath="..\..\openssl-1.0.0a\ms\uplink.c" + > + </File> + </Filter> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <File + RelativePath="..\..\openssl-1.0.0a\e_os.h" + > + </File> + <Filter + Name="crypto" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\cryptlib.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\o_dir.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\o_str.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\o_time.h" + > + </File> + <Filter + Name="evp" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\evp_locl.h" + > + </File> + </Filter> + </Filter> + <Filter + Name="openssl" + > + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\aes.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\asn1.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\asn1_mac.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\asn1t.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\bio.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\blowfish.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\bn.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\buffer.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\camellia.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\cast.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\cms.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\comp.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\conf.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\conf_api.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\crypto.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\des.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\des_old.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\dh.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\dsa.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\dso.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\dtls1.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\e_os2.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\ebcdic.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\ec.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\ecdh.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\ecdsa.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\engine.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\err.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\evp.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\hmac.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\idea.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\krb5_asn.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\kssl.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\lhash.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\md4.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\md5.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\mdc2.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\modes.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\obj_mac.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\objects.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\ocsp.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\opensslconf.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\opensslv.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\ossl_typ.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\pem.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\pem2.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\pkcs12.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\pkcs7.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\pqueue.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\rand.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\rc2.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\rc4.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\ripemd.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\rsa.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\safestack.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\seed.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\sha.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\ssl.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\ssl2.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\ssl23.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\ssl3.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\stack.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\symhacks.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\tls1.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\ts.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\txt_db.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\ui.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\ui_compat.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\whrlpool.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\x509.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\x509_vfy.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\include\openssl\x509v3.h" + > + </File> + </Filter> + <Filter + Name="bf" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bf\bf_locl.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bf\bf_pi.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\bf\blowfish.h" + > + </File> + </Filter> + <Filter + Name="ms" + > + <File + RelativePath="..\..\openssl-1.0.0a\ms\uplink.h" + > + </File> + </Filter> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/libs/win32/openssl/libeay32.def b/libs/win32/openssl/libeay32.def new file mode 100644 index 0000000..ca53a72 --- /dev/null +++ b/libs/win32/openssl/libeay32.def @@ -0,0 +1,3474 @@ +; +; Definition file for the DLL version of the LIBEAY library from OpenSSL +; + +LIBRARY LIBEAY32 + +EXPORTS + SSLeay @1 + ACCESS_DESCRIPTION_free @1994 + ACCESS_DESCRIPTION_it @2751 + ACCESS_DESCRIPTION_new @1925 + AES_bi_ige_encrypt @3860 + AES_cbc_encrypt @3171 + AES_cfb128_encrypt @3217 + AES_cfb1_encrypt @3279 + AES_cfb8_encrypt @3261 + AES_ctr128_encrypt @3216 + AES_decrypt @3040 + AES_ecb_encrypt @2801 + AES_encrypt @3033 + AES_ige_encrypt @3829 + AES_ofb128_encrypt @3215 + AES_options @3074 + AES_set_decrypt_key @3106 + AES_set_encrypt_key @3024 + AES_unwrap_key @3929 + AES_wrap_key @3930 + ASN1_ANY_it @3035 + ASN1_BIT_STRING_check @4495 + ASN1_BIT_STRING_free @2080 + ASN1_BIT_STRING_get_bit @1060 + ASN1_BIT_STRING_it @2878 + ASN1_BIT_STRING_name_print @2134 + ASN1_BIT_STRING_new @1957 + ASN1_BIT_STRING_num_asc @1986 + ASN1_BIT_STRING_set @2109 + ASN1_BIT_STRING_set_asc @2017 + ASN1_BIT_STRING_set_bit @1061 + ASN1_BMPSTRING_free @2057 + ASN1_BMPSTRING_it @2787 + ASN1_BMPSTRING_new @1936 + ASN1_BOOLEAN_it @3142 + ASN1_ENUMERATED_free @2027 + ASN1_ENUMERATED_get @1206 + ASN1_ENUMERATED_it @3015 + ASN1_ENUMERATED_new @2052 + ASN1_ENUMERATED_set @1205 + ASN1_ENUMERATED_to_BN @1208 + ASN1_FBOOLEAN_it @2806 + ASN1_GENERALIZEDTIME_adj @4484 + ASN1_GENERALIZEDTIME_check @1157 + ASN1_GENERALIZEDTIME_free @1908 + ASN1_GENERALIZEDTIME_it @2595 + ASN1_GENERALIZEDTIME_new @2126 + ASN1_GENERALIZEDTIME_print @1158 + ASN1_GENERALIZEDTIME_set @1159 + ASN1_GENERALIZEDTIME_set_string @1160 + ASN1_GENERALSTRING_free @2541 + ASN1_GENERALSTRING_it @2761 + ASN1_GENERALSTRING_new @2846 + ASN1_IA5STRING_free @2065 + ASN1_IA5STRING_it @2722 + ASN1_IA5STRING_new @2049 + ASN1_INTEGER_cmp @1963 + ASN1_INTEGER_dup @2114 + ASN1_INTEGER_free @2111 + ASN1_INTEGER_get @7 + ASN1_INTEGER_it @2914 + ASN1_INTEGER_new @2131 + ASN1_INTEGER_set @8 + ASN1_INTEGER_to_BN @9 + ASN1_NULL_free @2168 + ASN1_NULL_it @3150 + ASN1_NULL_new @2170 + ASN1_OBJECT_create @10 + ASN1_OBJECT_free @11 + ASN1_OBJECT_it @3180 + ASN1_OBJECT_new @12 + ASN1_OCTET_STRING_NDEF_it @3389 + ASN1_OCTET_STRING_cmp @1955 + ASN1_OCTET_STRING_dup @2108 + ASN1_OCTET_STRING_free @2016 + ASN1_OCTET_STRING_it @3090 + ASN1_OCTET_STRING_new @2130 + ASN1_OCTET_STRING_set @2040 + ASN1_PCTX_free @4498 + ASN1_PCTX_get_cert_flags @4166 + ASN1_PCTX_get_flags @4200 + ASN1_PCTX_get_nm_flags @4242 + ASN1_PCTX_get_oid_flags @4274 + ASN1_PCTX_get_str_flags @4493 + ASN1_PCTX_new @4476 + ASN1_PCTX_set_cert_flags @4528 + ASN1_PCTX_set_flags @4363 + ASN1_PCTX_set_nm_flags @4298 + ASN1_PCTX_set_oid_flags @4451 + ASN1_PCTX_set_str_flags @4392 + ASN1_PRINTABLESTRING_free @1934 + ASN1_PRINTABLESTRING_it @2797 + ASN1_PRINTABLESTRING_new @2025 + ASN1_PRINTABLE_free @3082 + ASN1_PRINTABLE_it @2861 + ASN1_PRINTABLE_new @2571 + ASN1_PRINTABLE_type @13 + ASN1_SEQUENCE_ANY_it @4148 + ASN1_SEQUENCE_it @2943 + ASN1_SET_ANY_it @4217 + ASN1_STRING_TABLE_add @2245 + ASN1_STRING_TABLE_cleanup @2020 + ASN1_STRING_TABLE_get @2091 + ASN1_STRING_cmp @14 + ASN1_STRING_copy @4305 + ASN1_STRING_data @2075 + ASN1_STRING_dup @15 + ASN1_STRING_free @16 + ASN1_STRING_get_default_mask @2072 + ASN1_STRING_length @2023 + ASN1_STRING_length_set @2136 + ASN1_STRING_new @17 + ASN1_STRING_print @18 + ASN1_STRING_print_ex @2432 + ASN1_STRING_print_ex_fp @2430 + ASN1_STRING_set0 @3933 + ASN1_STRING_set @19 + ASN1_STRING_set_by_NID @1996 + ASN1_STRING_set_default_mask @2032 + ASN1_STRING_set_default_mask_asc @1960 + ASN1_STRING_to_UTF8 @2442 + ASN1_STRING_type @1951 + ASN1_STRING_type_new @20 + ASN1_T61STRING_free @1946 + ASN1_T61STRING_it @2567 + ASN1_T61STRING_new @2058 + ASN1_TBOOLEAN_it @3167 + ASN1_TIME_adj @4267 + ASN1_TIME_check @2782 + ASN1_TIME_free @1954 + ASN1_TIME_it @2715 + ASN1_TIME_new @1973 + ASN1_TIME_print @1161 + ASN1_TIME_set @1253 + ASN1_TIME_set_string @4536 + ASN1_TIME_to_generalizedtime @3169 + ASN1_TYPE_cmp @4428 + ASN1_TYPE_free @21 + ASN1_TYPE_get @916 + ASN1_TYPE_get_int_octetstring @1076 + ASN1_TYPE_get_octetstring @1077 + ASN1_TYPE_new @22 + ASN1_TYPE_set1 @3932 + ASN1_TYPE_set @917 + ASN1_TYPE_set_int_octetstring @1078 + ASN1_TYPE_set_octetstring @1079 + ASN1_UNIVERSALSTRING_free @3233 + ASN1_UNIVERSALSTRING_it @3234 + ASN1_UNIVERSALSTRING_new @3230 + ASN1_UNIVERSALSTRING_to_string @23 + ASN1_UTCTIME_adj @4251 + ASN1_UTCTIME_check @24 + ASN1_UTCTIME_cmp_time_t @2455 + ASN1_UTCTIME_free @1988 + ASN1_UTCTIME_it @3021 + ASN1_UTCTIME_new @2060 + ASN1_UTCTIME_print @25 + ASN1_UTCTIME_set @26 + ASN1_UTCTIME_set_string @1080 + ASN1_UTF8STRING_free @2092 + ASN1_UTF8STRING_it @2527 + ASN1_UTF8STRING_new @1938 + ASN1_VISIBLESTRING_free @2118 + ASN1_VISIBLESTRING_it @2865 + ASN1_VISIBLESTRING_new @1932 + ASN1_add_oid_module @3186 + ASN1_bn_print @4295 + ASN1_check_infinite_end @27 + ASN1_const_check_infinite_end @3623 + ASN1_d2i_bio @28 + ASN1_d2i_fp @29 + ASN1_digest @30 + ASN1_dup @31 + ASN1_generate_nconf @3488 + ASN1_generate_v3 @3571 + ASN1_get_object @32 + ASN1_i2d_bio @33 + ASN1_i2d_fp @34 + ASN1_item_d2i @3050 + ASN1_item_d2i_bio @3069 + ASN1_item_d2i_fp @2868 + ASN1_item_digest @2552 + ASN1_item_dup @2772 + ASN1_item_ex_d2i @2957 + ASN1_item_ex_free @3141 + ASN1_item_ex_i2d @2533 + ASN1_item_ex_new @3063 + ASN1_item_free @2623 + ASN1_item_i2d @2655 + ASN1_item_i2d_bio @2858 + ASN1_item_i2d_fp @3095 + ASN1_item_ndef_i2d @3564 + ASN1_item_new @3168 + ASN1_item_pack @3136 + ASN1_item_print @4126 + ASN1_item_sign @2741 + ASN1_item_unpack @2640 + ASN1_item_verify @2777 + ASN1_mbstring_copy @1937 + ASN1_mbstring_ncopy @2123 + ASN1_object_size @35 + ASN1_pack_string @1261 + ASN1_parse @36 + ASN1_parse_dump @2427 + ASN1_primitive_free @3051 + ASN1_primitive_new @2860 + ASN1_put_eoc @3523 + ASN1_put_object @37 + ASN1_seq_pack @1259 + ASN1_seq_unpack @1258 + ASN1_sign @38 + ASN1_tag2bit @2788 + ASN1_tag2str @1905 + ASN1_template_d2i @2987 + ASN1_template_free @2974 + ASN1_template_i2d @2583 + ASN1_template_new @3093 + ASN1_unpack_string @1260 + ASN1_verify @39 + AUTHORITY_INFO_ACCESS_free @2048 + AUTHORITY_INFO_ACCESS_it @2805 + AUTHORITY_INFO_ACCESS_new @2247 + AUTHORITY_KEYID_free @1257 + AUTHORITY_KEYID_it @2625 + AUTHORITY_KEYID_new @1256 + BASIC_CONSTRAINTS_free @1162 + BASIC_CONSTRAINTS_it @2922 + BASIC_CONSTRAINTS_new @1163 + BF_cbc_encrypt @40 + BF_cfb64_encrypt @41 + BF_decrypt @987 + BF_ecb_encrypt @42 + BF_encrypt @43 + BF_ofb64_encrypt @44 + BF_options @45 + BF_set_key @46 + BIGNUM_it @3170 + BIO_accept @51 + BIO_asn1_get_prefix @4133 + BIO_asn1_get_suffix @4458 + BIO_asn1_set_prefix @4173 + BIO_asn1_set_suffix @4440 + BIO_callback_ctrl @2252 + BIO_clear_flags @3846 + BIO_copy_next_retry @955 + BIO_ctrl @52 + BIO_ctrl_get_read_request @1799 + BIO_ctrl_get_write_guarantee @1803 + BIO_ctrl_pending @1800 + BIO_ctrl_reset_read_request @1906 + BIO_ctrl_wpending @1801 + BIO_debug_callback @54 + BIO_dgram_non_fatal_error @3586 + BIO_dump @55 + BIO_dump_cb @3764 + BIO_dump_fp @3370 + BIO_dump_indent @2426 + BIO_dump_indent_cb @3697 + BIO_dump_indent_fp @3511 + BIO_dup_chain @56 + BIO_f_asn1 @4384 + BIO_f_base64 @57 + BIO_f_buffer @58 + BIO_f_cipher @59 + BIO_f_md @60 + BIO_f_nbio_test @915 + BIO_f_null @61 + BIO_f_reliable @1244 + BIO_fd_non_fatal_error @63 + BIO_fd_should_retry @64 + BIO_find_type @65 + BIO_free @66 + BIO_free_all @67 + BIO_get_accept_socket @69 + BIO_get_callback @3861 + BIO_get_callback_arg @3902 + BIO_get_ex_data @1062 + BIO_get_ex_new_index @1063 + BIO_get_host_ip @71 + BIO_get_port @72 + BIO_get_retry_BIO @73 + BIO_get_retry_reason @74 + BIO_gethostbyname @75 + BIO_gets @76 + BIO_indent @3242 + BIO_int_ctrl @53 + BIO_method_name @3898 + BIO_method_type @3826 + BIO_new @78 + BIO_new_CMS @4175 + BIO_new_NDEF @4153 + BIO_new_PKCS7 @4518 + BIO_new_accept @79 + BIO_new_bio_pair @1802 + BIO_new_connect @80 + BIO_new_dgram @3330 + BIO_new_fd @81 + BIO_new_file @82 + BIO_new_fp @83 + BIO_new_mem_buf @1882 + BIO_new_socket @84 + BIO_next @2461 + BIO_nread0 @1880 + BIO_nread @1876 + BIO_number_read @2203 + BIO_number_written @2202 + BIO_nwrite0 @1878 + BIO_nwrite @1874 + BIO_pop @85 + BIO_printf @86 + BIO_ptr_ctrl @969 + BIO_push @87 + BIO_puts @88 + BIO_read @89 + BIO_s_accept @90 + BIO_s_bio @1793 + BIO_s_connect @91 + BIO_s_datagram @3542 + BIO_s_fd @92 + BIO_s_file @93 + BIO_s_mem @95 + BIO_s_null @96 + BIO_s_socket @98 + BIO_set @100 + BIO_set_callback @3903 + BIO_set_callback_arg @3820 + BIO_set_cipher @101 + BIO_set_ex_data @1064 + BIO_set_flags @3823 + BIO_set_tcp_ndelay @102 + BIO_snprintf @2292 + BIO_sock_cleanup @103 + BIO_sock_error @104 + BIO_sock_init @105 + BIO_sock_non_fatal_error @106 + BIO_sock_should_retry @107 + BIO_socket_ioctl @108 + BIO_socket_nbio @1102 + BIO_test_flags @3866 + BIO_vfree @2334 + BIO_vprintf @2443 + BIO_vsnprintf @2444 + BIO_write @109 + BN_BLINDING_convert @973 + BN_BLINDING_convert_ex @3465 + BN_BLINDING_create_param @3705 + BN_BLINDING_free @981 + BN_BLINDING_get_flags @3725 + BN_BLINDING_get_thread_id @3340 + BN_BLINDING_invert @974 + BN_BLINDING_invert_ex @3337 + BN_BLINDING_new @980 + BN_BLINDING_set_flags @3411 + BN_BLINDING_set_thread_id @3770 + BN_BLINDING_thread_id @4239 + BN_BLINDING_update @975 + BN_CTX_end @2241 + BN_CTX_free @110 + BN_CTX_get @2243 + BN_CTX_init @1135 + BN_CTX_new @111 + BN_CTX_start @2242 + BN_GENCB_call @3474 + BN_GF2m_add @3574 + BN_GF2m_arr2poly @3552 + BN_GF2m_mod @3515 + BN_GF2m_mod_arr @3431 + BN_GF2m_mod_div @3420 + BN_GF2m_mod_div_arr @3604 + BN_GF2m_mod_exp @3598 + BN_GF2m_mod_exp_arr @3361 + BN_GF2m_mod_inv @3597 + BN_GF2m_mod_inv_arr @3768 + BN_GF2m_mod_mul @3490 + BN_GF2m_mod_mul_arr @3366 + BN_GF2m_mod_solve_quad @3653 + BN_GF2m_mod_solve_quad_arr @3417 + BN_GF2m_mod_sqr @3397 + BN_GF2m_mod_sqr_arr @3540 + BN_GF2m_mod_sqrt @3548 + BN_GF2m_mod_sqrt_arr @3451 + BN_GF2m_poly2arr @3468 + BN_MONT_CTX_copy @1109 + BN_MONT_CTX_free @112 + BN_MONT_CTX_init @1136 + BN_MONT_CTX_new @113 + BN_MONT_CTX_set @114 + BN_MONT_CTX_set_locked @3310 + BN_RECP_CTX_free @1130 + BN_RECP_CTX_init @1128 + BN_RECP_CTX_new @1129 + BN_RECP_CTX_set @1131 + BN_add @115 + BN_add_word @116 + BN_asc2bn @4191 + BN_bin2bn @118 + BN_bn2bin @120 + BN_bn2dec @1002 + BN_bn2hex @119 + BN_bn2mpi @1058 + BN_bntest_rand @2464 + BN_clear @121 + BN_clear_bit @122 + BN_clear_free @123 + BN_cmp @124 + BN_copy @125 + BN_dec2bn @1001 + BN_div @126 + BN_div_recp @1134 + BN_div_word @127 + BN_dup @128 + BN_exp @998 + BN_free @129 + BN_from_montgomery @130 + BN_gcd @131 + BN_generate_prime @132 + BN_generate_prime_ex @3710 + BN_get0_nist_prime_192 @3358 + BN_get0_nist_prime_224 @3471 + BN_get0_nist_prime_256 @3629 + BN_get0_nist_prime_384 @3331 + BN_get0_nist_prime_521 @3708 + BN_get_params @1249 + BN_get_word @133 + BN_hex2bn @117 + BN_init @1095 + BN_is_bit_set @134 + BN_is_prime @135 + BN_is_prime_ex @3503 + BN_is_prime_fasttest @2240 + BN_is_prime_fasttest_ex @3718 + BN_kronecker @3011 + BN_lshift1 @137 + BN_lshift @136 + BN_mask_bits @138 + BN_mod_add @2774 + BN_mod_add_quick @2923 + BN_mod_exp2_mont @1514 + BN_mod_exp @140 + BN_mod_exp_mont @141 + BN_mod_exp_mont_consttime @3318 + BN_mod_exp_mont_word @2401 + BN_mod_exp_recp @1133 + BN_mod_exp_simple @143 + BN_mod_inverse @144 + BN_mod_lshift1 @3151 + BN_mod_lshift1_quick @2958 + BN_mod_lshift @3120 + BN_mod_lshift_quick @2621 + BN_mod_mul @145 + BN_mod_mul_montgomery @146 + BN_mod_mul_reciprocal @1132 + BN_mod_sqr @2802 + BN_mod_sqrt @2961 + BN_mod_sub @2824 + BN_mod_sub_quick @2933 + BN_mod_word @148 + BN_mpi2bn @1059 + BN_mul @149 + BN_mul_word @999 + BN_new @150 + BN_nist_mod_192 @3346 + BN_nist_mod_224 @3580 + BN_nist_mod_256 @3702 + BN_nist_mod_384 @3641 + BN_nist_mod_521 @3615 + BN_nnmod @2606 + BN_num_bits @151 + BN_num_bits_word @152 + BN_options @153 + BN_print @154 + BN_print_fp @155 + BN_pseudo_rand @2239 + BN_pseudo_rand_range @2523 + BN_rand @156 + BN_rand_range @2466 + BN_reciprocal @157 + BN_rshift1 @159 + BN_rshift @158 + BN_set_bit @160 + BN_set_negative @3635 + BN_set_params @1248 + BN_set_word @161 + BN_sqr @162 + BN_sub @163 + BN_sub_word @1000 + BN_swap @2990 + BN_to_ASN1_ENUMERATED @1207 + BN_to_ASN1_INTEGER @164 + BN_uadd @708 + BN_ucmp @165 + BN_usub @709 + BN_value_one @166 + BUF_MEM_free @167 + BUF_MEM_grow @168 + BUF_MEM_grow_clean @3239 + BUF_MEM_new @169 + BUF_memdup @3489 + BUF_reverse @4284 + BUF_strdup @170 + BUF_strlcat @3241 + BUF_strlcpy @3243 + BUF_strndup @3513 + CAST_cbc_encrypt @992 + CAST_cfb64_encrypt @993 + CAST_decrypt @990 + CAST_ecb_encrypt @991 + CAST_encrypt @989 + CAST_ofb64_encrypt @994 + CAST_set_key @988 + CBIGNUM_it @2982 + CERTIFICATEPOLICIES_free @1486 + CERTIFICATEPOLICIES_it @2728 + CERTIFICATEPOLICIES_new @1485 + CMS_ContentInfo_free @3964 + CMS_ContentInfo_it @3969 + CMS_ContentInfo_new @3987 + CMS_ContentInfo_print_ctx @4401 + CMS_EncryptedData_decrypt @3995 + CMS_EncryptedData_encrypt @4005 + CMS_EncryptedData_set1_key @3977 + CMS_EnvelopedData_create @3955 + CMS_ReceiptRequest_create0 @4041 + CMS_ReceiptRequest_free @3938 + CMS_ReceiptRequest_get0_values @4001 + CMS_ReceiptRequest_it @4013 + CMS_ReceiptRequest_new @4018 + CMS_RecipientInfo_decrypt @4037 + CMS_RecipientInfo_kekri_get0_id @4011 + CMS_RecipientInfo_kekri_id_cmp @4022 + CMS_RecipientInfo_ktri_cert_cmp @3962 + CMS_RecipientInfo_ktri_get0_algs @3963 + CMS_RecipientInfo_ktri_get0_signer_id @4032 + CMS_RecipientInfo_set0_key @4009 + CMS_RecipientInfo_set0_pkey @4043 + CMS_RecipientInfo_type @3988 + CMS_SignedData_init @4010 + CMS_SignerInfo_cert_cmp @3973 + CMS_SignerInfo_get0_algs @3951 + CMS_SignerInfo_get0_signer_id @4024 + CMS_SignerInfo_set1_signer_cert @3999 + CMS_SignerInfo_sign @3974 + CMS_SignerInfo_verify @3967 + CMS_SignerInfo_verify_content @3958 + CMS_add0_CertificateChoices @3940 + CMS_add0_RevocationInfoChoice @3997 + CMS_add0_cert @4004 + CMS_add0_crl @3957 + CMS_add0_recipient_key @4016 + CMS_add1_ReceiptRequest @4023 + CMS_add1_cert @3952 + CMS_add1_crl @4405 + CMS_add1_recipient_cert @4034 + CMS_add1_signer @4042 + CMS_add_simple_smimecap @3966 + CMS_add_smimecap @3982 + CMS_add_standard_smimecap @3986 + CMS_compress @3971 + CMS_dataFinal @4031 + CMS_dataInit @4035 + CMS_data @3968 + CMS_data_create @3975 + CMS_decrypt @3978 + CMS_decrypt_set1_key @3950 + CMS_decrypt_set1_pkey @3998 + CMS_digest_create @3972 + CMS_digest_verify @4006 + CMS_encrypt @3954 + CMS_final @3965 + CMS_get0_RecipientInfos @3996 + CMS_get0_SignerInfos @4003 + CMS_get0_content @4019 + CMS_get0_eContentType @4039 + CMS_get0_signers @4000 + CMS_get0_type @3989 + CMS_get1_ReceiptRequest @4020 + CMS_get1_certs @4028 + CMS_get1_crls @4015 + CMS_is_detached @3990 + CMS_set1_eContentType @4040 + CMS_set1_signers_certs @4007 + CMS_set_detached @3953 + CMS_sign @3991 + CMS_sign_receipt @3943 + CMS_signed_add1_attr @3992 + CMS_signed_add1_attr_by_NID @4029 + CMS_signed_add1_attr_by_OBJ @4021 + CMS_signed_add1_attr_by_txt @4036 + CMS_signed_delete_attr @3945 + CMS_signed_get0_data_by_OBJ @4002 + CMS_signed_get_attr @4008 + CMS_signed_get_attr_by_NID @4027 + CMS_signed_get_attr_by_OBJ @3984 + CMS_signed_get_attr_count @4038 + CMS_stream @4271 + CMS_uncompress @3956 + CMS_unsigned_add1_attr @4026 + CMS_unsigned_add1_attr_by_NID @4025 + CMS_unsigned_add1_attr_by_OBJ @3941 + CMS_unsigned_add1_attr_by_txt @4030 + CMS_unsigned_delete_attr @3980 + CMS_unsigned_get0_data_by_OBJ @3959 + CMS_unsigned_get_attr @3961 + CMS_unsigned_get_attr_by_NID @3947 + CMS_unsigned_get_attr_by_OBJ @3993 + CMS_unsigned_get_attr_count @3981 + CMS_verify @3948 + CMS_verify_receipt @4012 + COMP_CTX_free @1097 + COMP_CTX_new @1096 + COMP_compress_block @1144 + COMP_expand_block @1145 + COMP_rle @1146 + COMP_zlib @1147 + COMP_zlib_cleanup @3936 + CONF_dump_bio @2288 + CONF_dump_fp @2283 + CONF_free @171 + CONF_get1_default_config_file @3194 + CONF_get_number @172 + CONF_get_section @173 + CONF_get_string @174 + CONF_imodule_get_flags @3195 + CONF_imodule_get_module @3196 + CONF_imodule_get_name @3198 + CONF_imodule_get_usr_data @3200 + CONF_imodule_get_value @3190 + CONF_imodule_set_flags @3201 + CONF_imodule_set_usr_data @3183 + CONF_load @175 + CONF_load_bio @1805 + CONF_load_fp @1806 + CONF_module_add @3193 + CONF_module_get_usr_data @3185 + CONF_module_set_usr_data @3191 + CONF_modules_finish @3187 + CONF_modules_free @3226 + CONF_modules_load @3197 + CONF_modules_load_file @3182 + CONF_modules_unload @3189 + CONF_parse_list @3192 + CONF_set_default_method @2290 + CONF_set_nconf @3081 + CRL_DIST_POINTS_free @1539 + CRL_DIST_POINTS_it @2869 + CRL_DIST_POINTS_new @1538 + CRYPTO_THREADID_cmp @4176 + CRYPTO_THREADID_cpy @4165 + CRYPTO_THREADID_current @4244 + CRYPTO_THREADID_get_callback @4416 + CRYPTO_THREADID_hash @4400 + CRYPTO_THREADID_set_callback @4346 + CRYPTO_THREADID_set_numeric @4334 + CRYPTO_THREADID_set_pointer @4159 + CRYPTO_add_lock @176 + CRYPTO_cleanup_all_ex_data @2604 + CRYPTO_dbg_free @177 + CRYPTO_dbg_get_options @2246 + CRYPTO_dbg_malloc @178 + CRYPTO_dbg_realloc @179 + CRYPTO_dbg_set_options @2157 + CRYPTO_destroy_dynlockid @2413 + CRYPTO_dup_ex_data @1025 + CRYPTO_ex_data_new_class @3036 + CRYPTO_free @181 + CRYPTO_free_ex_data @1004 + CRYPTO_free_locked @1513 + CRYPTO_get_add_lock_callback @182 + CRYPTO_get_dynlock_create_callback @2420 + CRYPTO_get_dynlock_destroy_callback @2418 + CRYPTO_get_dynlock_lock_callback @2417 + CRYPTO_get_dynlock_value @2419 + CRYPTO_get_ex_data @1005 + CRYPTO_get_ex_data_implementation @3135 + CRYPTO_get_ex_new_index @1041 + CRYPTO_get_id_callback @183 + CRYPTO_get_lock_name @184 + CRYPTO_get_locked_mem_ex_functions @2781 + CRYPTO_get_locked_mem_functions @1511 + CRYPTO_get_locking_callback @185 + CRYPTO_get_mem_debug_functions @2159 + CRYPTO_get_mem_debug_options @2248 + CRYPTO_get_mem_ex_functions @2855 + CRYPTO_get_mem_functions @186 + CRYPTO_get_new_dynlockid @2410 + CRYPTO_get_new_lockid @1026 + CRYPTO_is_mem_check_on @2160 + CRYPTO_lock @187 + CRYPTO_malloc @188 + CRYPTO_malloc_locked @1512 + CRYPTO_mem_ctrl @189 + CRYPTO_mem_leaks @190 + CRYPTO_mem_leaks_cb @191 + CRYPTO_mem_leaks_fp @192 + CRYPTO_new_ex_data @1027 + CRYPTO_num_locks @1804 + CRYPTO_pop_info @2162 + CRYPTO_push_info_ @2163 + CRYPTO_realloc @193 + CRYPTO_realloc_clean @3240 + CRYPTO_remalloc @194 + CRYPTO_remove_all_info @2158 + CRYPTO_set_add_lock_callback @195 + CRYPTO_set_dynlock_create_callback @2415 + CRYPTO_set_dynlock_destroy_callback @2412 + CRYPTO_set_dynlock_lock_callback @2416 + CRYPTO_set_ex_data @1007 + CRYPTO_set_ex_data_implementation @2841 + CRYPTO_set_id_callback @196 + CRYPTO_set_locked_mem_ex_functions @2770 + CRYPTO_set_locked_mem_functions @1510 + CRYPTO_set_locking_callback @197 + CRYPTO_set_mem_debug_functions @2161 + CRYPTO_set_mem_debug_options @2164 + CRYPTO_set_mem_ex_functions @2778 + CRYPTO_set_mem_functions @198 + CRYPTO_strdup @4093 + CRYPTO_thread_id @199 + Camellia_cbc_encrypt @3784 + Camellia_cfb128_encrypt @3785 + Camellia_cfb1_encrypt @3786 + Camellia_cfb8_encrypt @3787 + Camellia_ctr128_encrypt @3788 + Camellia_decrypt @3790 + Camellia_ecb_encrypt @3791 + Camellia_encrypt @3792 + Camellia_ofb128_encrypt @3793 + Camellia_set_key @3794 + DES_cbc_cksum @777 + DES_cbc_encrypt @778 + DES_cfb64_encrypt @780 + DES_cfb_encrypt @781 + DES_check_key_parity @2256 + DES_crypt @2249 + DES_decrypt3 @782 + DES_ecb3_encrypt @783 + DES_ecb_encrypt @784 + DES_ede3_cbc_encrypt @785 + DES_ede3_cbcm_encrypt @1225 + DES_ede3_cfb64_encrypt @786 + DES_ede3_cfb_encrypt @3257 + DES_ede3_ofb64_encrypt @787 + DES_enc_read @788 + DES_enc_write @789 + DES_encrypt1 @790 + DES_encrypt2 @791 + DES_encrypt3 @792 + DES_fcrypt @793 + DES_is_weak_key @794 + DES_key_sched @795 + DES_ncbc_encrypt @796 + DES_ofb64_encrypt @797 + DES_ofb_encrypt @798 + DES_options @799 + DES_pcbc_encrypt @800 + DES_quad_cksum @801 + DES_random_key @802 + DES_read_2passwords @3206 + DES_read_password @3207 + DES_set_key @808 + DES_set_key_checked @2144 + DES_set_key_unchecked @2147 + DES_set_odd_parity @809 + DES_string_to_2keys @810 + DES_string_to_key @811 + DES_xcbc_encrypt @812 + DH_OpenSSL @1890 + DH_check @200 + DH_check_pub_key @3774 + DH_compute_key @201 + DH_free @202 + DH_generate_key @203 + DH_generate_parameters @204 + DH_generate_parameters_ex @3713 + DH_get_default_method @1892 + DH_get_ex_data @1886 + DH_get_ex_new_index @1887 + DH_new @205 + DH_new_method @1889 + DH_set_default_method @1894 + DH_set_ex_data @1883 + DH_set_method @1884 + DH_size @206 + DH_up_ref @2930 + DHparams_dup @4540 + DHparams_print @207 + DHparams_print_fp @208 + DIRECTORYSTRING_free @2038 + DIRECTORYSTRING_it @2767 + DIRECTORYSTRING_new @2137 + DISPLAYTEXT_free @1998 + DISPLAYTEXT_it @2836 + DISPLAYTEXT_new @1907 + DIST_POINT_NAME_free @1547 + DIST_POINT_NAME_it @3084 + DIST_POINT_NAME_new @1546 + DIST_POINT_free @1544 + DIST_POINT_it @2950 + DIST_POINT_new @1542 + DIST_POINT_set_dpname @4215 + DSA_OpenSSL @1885 + DSA_SIG_free @1334 + DSA_SIG_new @1333 + DSA_do_sign @1335 + DSA_do_verify @1336 + DSA_dup_DH @1871 + DSA_free @209 + DSA_generate_key @210 + DSA_generate_parameters @211 + DSA_generate_parameters_ex @3687 + DSA_get_default_method @1941 + DSA_get_ex_data @1895 + DSA_get_ex_new_index @1891 + DSA_new @213 + DSA_new_method @1888 + DSA_print @214 + DSA_print_fp @215 + DSA_set_default_method @1989 + DSA_set_ex_data @1893 + DSA_set_method @1949 + DSA_sign @216 + DSA_sign_setup @217 + DSA_size @218 + DSA_up_ref @2785 + DSA_verify @219 + DSAparams_dup @4539 + DSAparams_print @220 + DSAparams_print_fp @221 + DSO_METHOD_beos @4122 + DSO_METHOD_dl @2275 + DSO_METHOD_dlfcn @2272 + DSO_METHOD_null @2270 + DSO_METHOD_openssl @2271 + DSO_METHOD_vms @2462 + DSO_METHOD_win32 @2273 + DSO_bind_func @2409 + DSO_bind_var @2269 + DSO_convert_filename @2618 + DSO_ctrl @2293 + DSO_flags @2262 + DSO_free @2261 + DSO_get_default_method @2265 + DSO_get_filename @3115 + DSO_get_loaded_filename @2731 + DSO_get_method @2266 + DSO_global_lookup @4195 + DSO_load @2268 + DSO_merge @3762 + DSO_new @2259 + DSO_new_method @2260 + DSO_pathbyaddr @4523 + DSO_set_default_method @2264 + DSO_set_filename @2622 + DSO_set_method @2267 + DSO_set_name_converter @3105 + DSO_up_ref @2843 + ECDH_OpenSSL @3442 + ECDH_compute_key @3644 + ECDH_get_default_method @3351 + ECDH_get_ex_data @3438 + ECDH_get_ex_new_index @3590 + ECDH_set_default_method @3549 + ECDH_set_ex_data @3613 + ECDH_set_method @3611 + ECDSA_OpenSSL @3620 + ECDSA_SIG_it @3621 + ECDSA_SIG_free @3455 + ECDSA_SIG_new @3395 + ECDSA_do_sign @3440 + ECDSA_do_sign_ex @3671 + ECDSA_do_verify @3672 + ECDSA_get_default_method @3522 + ECDSA_get_ex_data @3509 + ECDSA_get_ex_new_index @3744 + ECDSA_set_default_method @3625 + ECDSA_set_ex_data @3739 + ECDSA_set_method @3731 + ECDSA_sign @3719 + ECDSA_sign_ex @3403 + ECDSA_sign_setup @3416 + ECDSA_size @3706 + ECDSA_verify @3666 + ECPKParameters_print @3607 + ECPKParameters_print_fp @3453 + ECParameters_print @3485 + ECParameters_print_fp @3688 + EC_GF2m_simple_method @3738 + EC_GFp_mont_method @2689 + EC_GFp_nist_method @3529 + EC_GFp_simple_method @3099 + EC_GROUP_check @3555 + EC_GROUP_check_discriminant @3372 + EC_GROUP_clear_free @2550 + EC_GROUP_cmp @3627 + EC_GROUP_copy @2962 + EC_GROUP_dup @3661 + EC_GROUP_free @2877 + EC_GROUP_get0_generator @2693 + EC_GROUP_get0_seed @3601 + EC_GROUP_get_asn1_flag @3587 + EC_GROUP_get_basis_type @3637 + EC_GROUP_get_cofactor @2683 + EC_GROUP_get_curve_GF2m @3500 + EC_GROUP_get_curve_GFp @2985 + EC_GROUP_get_curve_name @3695 + EC_GROUP_get_degree @3570 + EC_GROUP_get_order @2701 + EC_GROUP_get_pentanomial_basis @3409 + EC_GROUP_get_point_conversion_form @3405 + EC_GROUP_get_seed_len @3517 + EC_GROUP_get_trinomial_basis @3347 + EC_GROUP_have_precompute_mult @3429 + EC_GROUP_method_of @2568 + EC_GROUP_new @2995 + EC_GROUP_new_by_curve_name @3711 + EC_GROUP_new_curve_GF2m @3382 + EC_GROUP_new_curve_GFp @2885 + EC_GROUP_precompute_mult @3100 + EC_GROUP_set_asn1_flag @3749 + EC_GROUP_set_curve_GF2m @3545 + EC_GROUP_set_curve_GFp @2564 + EC_GROUP_set_curve_name @3533 + EC_GROUP_set_generator @2724 + EC_GROUP_set_point_conversion_form @3617 + EC_GROUP_set_seed @3494 + EC_KEY_check_key @3750 + EC_KEY_copy @3369 + EC_KEY_dup @3729 + EC_KEY_free @3422 + EC_KEY_generate_key @3550 + EC_KEY_get0_group @3575 + EC_KEY_get0_private_key @3608 + EC_KEY_get0_public_key @3480 + EC_KEY_get_conv_form @3388 + EC_KEY_get_enc_flags @3622 + EC_KEY_get_key_method_data @3402 + EC_KEY_insert_key_method_data @3557 + EC_KEY_new @3663 + EC_KEY_new_by_curve_name @3353 + EC_KEY_precompute_mult @3374 + EC_KEY_print @3742 + EC_KEY_print_fp @3430 + EC_KEY_set_asn1_flag @3400 + EC_KEY_set_conv_form @3443 + EC_KEY_set_enc_flags @3665 + EC_KEY_set_group @3512 + EC_KEY_set_private_key @3459 + EC_KEY_set_public_key @3682 + EC_KEY_up_ref @3418 + EC_METHOD_get_field_type @3528 + EC_POINT_add @2532 + EC_POINT_bn2point @3398 + EC_POINT_clear_free @3039 + EC_POINT_cmp @2953 + EC_POINT_copy @3010 + EC_POINT_dbl @3070 + EC_POINT_dup @3444 + EC_POINT_free @2929 + EC_POINT_get_Jprojective_coordinates_GFp @2779 + EC_POINT_get_affine_coordinates_GF2m @3660 + EC_POINT_get_affine_coordinates_GFp @2909 + EC_POINT_hex2point @3763 + EC_POINT_invert @2896 + EC_POINT_is_at_infinity @2616 + EC_POINT_is_on_curve @2769 + EC_POINT_make_affine @3114 + EC_POINT_method_of @2852 + EC_POINT_mul @2831 + EC_POINT_new @2924 + EC_POINT_oct2point @2578 + EC_POINT_point2bn @3379 + EC_POINT_point2hex @3667 + EC_POINT_point2oct @3178 + EC_POINT_set_Jprojective_coordinates_GFp @2575 + EC_POINT_set_affine_coordinates_GF2m @3360 + EC_POINT_set_affine_coordinates_GFp @2611 + EC_POINT_set_compressed_coordinates_GF2m @3626 + EC_POINT_set_compressed_coordinates_GFp @2597 + EC_POINT_set_to_infinity @3176 + EC_POINTs_make_affine @2830 + EC_POINTs_mul @2940 + EC_get_builtin_curves @3447 + EDIPARTYNAME_free @2883 + EDIPARTYNAME_it @3005 + EDIPARTYNAME_new @2671 + ENGINE_add @2518 + ENGINE_add_conf_module @3202 + ENGINE_by_id @2493 + ENGINE_cleanup @2949 + ENGINE_cmd_is_executable @2759 + ENGINE_ctrl @2481 + ENGINE_ctrl_cmd @2900 + ENGINE_ctrl_cmd_string @2628 + ENGINE_finish @2478 + ENGINE_free @2502 + ENGINE_get_DH @2480 + ENGINE_get_DSA @2520 + ENGINE_get_ECDH @3716 + ENGINE_get_ECDSA @3723 + ENGINE_get_RAND @2491 + ENGINE_get_RSA @2489 + ENGINE_get_STORE @3668 + ENGINE_get_cipher @2756 + ENGINE_get_cipher_engine @3008 + ENGINE_get_ciphers @2529 + ENGINE_get_cmd_defns @2658 + ENGINE_get_ctrl_function @2521 + ENGINE_get_default_DH @2488 + ENGINE_get_default_DSA @2506 + ENGINE_get_default_ECDH @3387 + ENGINE_get_default_ECDSA @3662 + ENGINE_get_default_RAND @2509 + ENGINE_get_default_RSA @2470 + ENGINE_get_destroy_function @3080 + ENGINE_get_digest @2748 + ENGINE_get_digest_engine @2563 + ENGINE_get_digests @2816 + ENGINE_get_ex_data @2856 + ENGINE_get_ex_new_index @2826 + ENGINE_get_finish_function @2469 + ENGINE_get_first @2492 + ENGINE_get_flags @2911 + ENGINE_get_id @2516 + ENGINE_get_init_function @2482 + ENGINE_get_last @2486 + ENGINE_get_load_privkey_function @3172 + ENGINE_get_load_pubkey_function @2792 + ENGINE_get_name @2485 + ENGINE_get_next @2504 + ENGINE_get_pkey_asn1_meth @4151 + ENGINE_get_pkey_asn1_meth_engine @4140 + ENGINE_get_pkey_asn1_meth_str @4393 + ENGINE_get_pkey_asn1_meths @4342 + ENGINE_get_pkey_meth @4154 + ENGINE_get_pkey_meth_engine @4425 + ENGINE_get_pkey_meths @4287 + ENGINE_get_prev @2487 + ENGINE_get_ssl_client_cert_function @4045 + ENGINE_get_static_state @3393 + ENGINE_get_table_flags @3143 + ENGINE_init @2475 + ENGINE_load_builtin_engines @2708 + ENGINE_load_cryptodev @2617 + ENGINE_load_dynamic @2547 + ENGINE_load_openssl @2657 + ENGINE_load_private_key @2498 + ENGINE_load_public_key @2479 + ENGINE_load_ssl_client_cert @4046 + ENGINE_new @2515 + ENGINE_pkey_asn1_find_str @4282 + ENGINE_register_DH @2584 + ENGINE_register_DSA @2762 + ENGINE_register_ECDH @3355 + ENGINE_register_ECDSA @3335 + ENGINE_register_RAND @2609 + ENGINE_register_RSA @2664 + ENGINE_register_STORE @3685 + ENGINE_register_all_DH @2907 + ENGINE_register_all_DSA @2918 + ENGINE_register_all_ECDH @3646 + ENGINE_register_all_ECDSA @3658 + ENGINE_register_all_RAND @2546 + ENGINE_register_all_RSA @2809 + ENGINE_register_all_STORE @3567 + ENGINE_register_all_ciphers @3009 + ENGINE_register_all_complete @2970 + ENGINE_register_all_digests @2637 + ENGINE_register_all_pkey_asn1_meths @4398 + ENGINE_register_all_pkey_meths @4367 + ENGINE_register_ciphers @2620 + ENGINE_register_complete @2941 + ENGINE_register_digests @2889 + ENGINE_register_pkey_asn1_meths @4297 + ENGINE_register_pkey_meths @4129 + ENGINE_remove @2501 + ENGINE_set_DH @2473 + ENGINE_set_DSA @2468 + ENGINE_set_ECDH @3477 + ENGINE_set_ECDSA @3605 + ENGINE_set_RAND @2511 + ENGINE_set_RSA @2497 + ENGINE_set_STORE @3334 + ENGINE_set_ciphers @2676 + ENGINE_set_cmd_defns @2875 + ENGINE_set_ctrl_function @2522 + ENGINE_set_default @2490 + ENGINE_set_default_DH @2514 + ENGINE_set_default_DSA @2484 + ENGINE_set_default_ECDH @3759 + ENGINE_set_default_ECDSA @3546 + ENGINE_set_default_RAND @2499 + ENGINE_set_default_RSA @2508 + ENGINE_set_default_ciphers @3029 + ENGINE_set_default_digests @2661 + ENGINE_set_default_pkey_asn1_meths @4193 + ENGINE_set_default_pkey_meths @4300 + ENGINE_set_default_string @3184 + ENGINE_set_destroy_function @2992 + ENGINE_set_digests @2937 + ENGINE_set_ex_data @2980 + ENGINE_set_finish_function @2494 + ENGINE_set_flags @3162 + ENGINE_set_id @2512 + ENGINE_set_init_function @2483 + ENGINE_set_load_privkey_function @2659 + ENGINE_set_load_pubkey_function @2764 + ENGINE_set_load_ssl_client_cert_function @4044 + ENGINE_set_name @2505 + ENGINE_set_pkey_asn1_meths @4409 + ENGINE_set_pkey_meths @4508 + ENGINE_set_table_flags @3073 + ENGINE_unregister_DH @2917 + ENGINE_unregister_DSA @2665 + ENGINE_unregister_ECDH @3441 + ENGINE_unregister_ECDSA @3769 + ENGINE_unregister_RAND @3044 + ENGINE_unregister_RSA @2539 + ENGINE_unregister_STORE @3384 + ENGINE_unregister_ciphers @2528 + ENGINE_unregister_digests @2813 + ENGINE_unregister_pkey_asn1_meths @4497 + ENGINE_unregister_pkey_meths @4478 + ENGINE_up_ref @3238 + ERR_add_error_data @1081 + ERR_clear_error @222 + ERR_error_string @223 + ERR_error_string_n @2291 + ERR_free_strings @224 + ERR_func_error_string @225 + ERR_get_err_state_table @226 + ERR_get_error @227 + ERR_get_error_line @228 + ERR_get_error_line_data @1515 + ERR_get_implementation @2601 + ERR_get_next_error_library @966 + ERR_get_state @229 + ERR_get_string_table @230 + ERR_lib_error_string @231 + ERR_load_ASN1_strings @232 + ERR_load_BIO_strings @233 + ERR_load_BN_strings @234 + ERR_load_BUF_strings @235 + ERR_load_CMS_strings @3942 + ERR_load_COMP_strings @2525 + ERR_load_CONF_strings @236 + ERR_load_CRYPTO_strings @1009 + ERR_load_DH_strings @237 + ERR_load_DSA_strings @238 + ERR_load_DSO_strings @2274 + ERR_load_ECDH_strings @3728 + ERR_load_ECDSA_strings @3636 + ERR_load_EC_strings @2849 + ERR_load_ENGINE_strings @2467 + ERR_load_ERR_strings @239 + ERR_load_EVP_strings @240 + ERR_load_OBJ_strings @241 + ERR_load_OCSP_strings @3177 + ERR_load_PEM_strings @242 + ERR_load_PKCS12_strings @1300 + ERR_load_PKCS7_strings @919 + ERR_load_RAND_strings @2205 + ERR_load_RSA_strings @244 + ERR_load_TS_strings @4314 + ERR_load_UI_strings @3091 + ERR_load_X509V3_strings @1164 + ERR_load_X509_strings @245 + ERR_load_crypto_strings @246 + ERR_load_strings @247 + ERR_peek_error @248 + ERR_peek_error_line @249 + ERR_peek_error_line_data @1516 + ERR_peek_last_error @3205 + ERR_peek_last_error_line @3203 + ERR_peek_last_error_line_data @3204 + ERR_pop_to_mark @3566 + ERR_print_errors @250 + ERR_print_errors_cb @2675 + ERR_print_errors_fp @251 + ERR_put_error @252 + ERR_reason_error_string @253 + ERR_release_err_state_table @3247 + ERR_remove_state @254 + ERR_remove_thread_state @4445 + ERR_set_error_data @1082 + ERR_set_implementation @2848 + ERR_set_mark @3332 + ERR_unload_strings @2881 + ESS_CERT_ID_dup @4203 + ESS_CERT_ID_free @4477 + ESS_CERT_ID_new @4281 + ESS_ISSUER_SERIAL_dup @4491 + ESS_ISSUER_SERIAL_free @4391 + ESS_ISSUER_SERIAL_new @4404 + ESS_SIGNING_CERT_dup @4452 + ESS_SIGNING_CERT_free @4504 + ESS_SIGNING_CERT_new @4385 + EVP_BytesToKey @255 + EVP_CIPHER_CTX_block_size @3879 + EVP_CIPHER_CTX_cipher @3888 + EVP_CIPHER_CTX_cleanup @256 + EVP_CIPHER_CTX_clear_flags @4050 + EVP_CIPHER_CTX_copy @4549 + EVP_CIPHER_CTX_ctrl @2400 + EVP_CIPHER_CTX_flags @3891 + EVP_CIPHER_CTX_free @3783 + EVP_CIPHER_CTX_get_app_data @3889 + EVP_CIPHER_CTX_init @961 + EVP_CIPHER_CTX_iv_length @3899 + EVP_CIPHER_CTX_key_length @3841 + EVP_CIPHER_CTX_new @3782 + EVP_CIPHER_CTX_nid @3831 + EVP_CIPHER_CTX_rand_key @3730 + EVP_CIPHER_CTX_set_app_data @3819 + EVP_CIPHER_CTX_set_flags @4059 + EVP_CIPHER_CTX_set_key_length @2399 + EVP_CIPHER_CTX_set_padding @3019 + EVP_CIPHER_CTX_test_flags @4069 + EVP_CIPHER_asn1_to_param @1083 + EVP_CIPHER_block_size @3816 + EVP_CIPHER_do_all @4353 + EVP_CIPHER_do_all_sorted @4429 + EVP_CIPHER_flags @3857 + EVP_CIPHER_get_asn1_iv @1085 + EVP_CIPHER_iv_length @3836 + EVP_CIPHER_key_length @3873 + EVP_CIPHER_nid @3877 + EVP_CIPHER_param_to_asn1 @1084 + EVP_CIPHER_set_asn1_iv @1086 + EVP_CIPHER_type @1649 + EVP_CipherFinal @257 + EVP_CipherFinal_ex @2602 + EVP_CipherInit @258 + EVP_CipherInit_ex @2915 + EVP_CipherUpdate @259 + EVP_Cipher @3874 + EVP_DecodeBlock @260 + EVP_DecodeFinal @261 + EVP_DecodeInit @262 + EVP_DecodeUpdate @263 + EVP_DecryptFinal @264 + EVP_DecryptFinal_ex @2656 + EVP_DecryptInit @265 + EVP_DecryptInit_ex @3067 + EVP_DecryptUpdate @266 + EVP_DigestFinal @267 + EVP_DigestFinal_ex @2936 + EVP_DigestInit @268 + EVP_DigestInit_ex @3109 + EVP_DigestSignFinal @4372 + EVP_DigestSignInit @4144 + EVP_DigestUpdate @269 + EVP_DigestVerifyFinal @4206 + EVP_DigestVerifyInit @4299 + EVP_Digest @3165 + EVP_EncodeBlock @270 + EVP_EncodeFinal @271 + EVP_EncodeInit @272 + EVP_EncodeUpdate @273 + EVP_EncryptFinal @274 + EVP_EncryptFinal_ex @2660 + EVP_EncryptInit @275 + EVP_EncryptInit_ex @2894 + EVP_EncryptUpdate @276 + EVP_MD_CTX_cleanup @2821 + EVP_MD_CTX_clear_flags @3853 + EVP_MD_CTX_copy @1202 + EVP_MD_CTX_copy_ex @2589 + EVP_MD_CTX_create @2712 + EVP_MD_CTX_destroy @2925 + EVP_MD_CTX_init @2630 + EVP_MD_CTX_md @3896 + EVP_MD_CTX_set_flags @3883 + EVP_MD_CTX_test_flags @3845 + EVP_MD_block_size @3890 + EVP_MD_do_all @4442 + EVP_MD_do_all_sorted @4253 + EVP_MD_flags @4537 + EVP_MD_pkey_type @3852 + EVP_MD_size @3844 + EVP_MD_type @3837 + EVP_OpenFinal @277 + EVP_OpenInit @278 + EVP_PBE_CipherInit @1650 + EVP_PBE_alg_add @1322 + EVP_PBE_alg_add_type @4437 + EVP_PBE_cleanup @1324 + EVP_PBE_find @4386 + EVP_PKCS82PKEY @1318 + EVP_PKEY2PKCS8 @1319 + EVP_PKEY2PKCS8_broken @2244 + EVP_PKEY_CTX_ctrl @4233 + EVP_PKEY_CTX_ctrl_str @4187 + EVP_PKEY_CTX_dup @4316 + EVP_PKEY_CTX_free @4430 + EVP_PKEY_CTX_get0_peerkey @4465 + EVP_PKEY_CTX_get0_pkey @4381 + EVP_PKEY_CTX_get_app_data @4344 + EVP_PKEY_CTX_get_cb @4419 + EVP_PKEY_CTX_get_data @4218 + EVP_PKEY_CTX_get_keygen_info @4137 + EVP_PKEY_CTX_get_operation @4434 + EVP_PKEY_CTX_new @4119 + EVP_PKEY_CTX_new_id @4532 + EVP_PKEY_CTX_set0_keygen_info @4214 + EVP_PKEY_CTX_set_app_data @4330 + EVP_PKEY_CTX_set_cb @4272 + EVP_PKEY_CTX_set_data @4182 + EVP_PKEY_add1_attr @3690 + EVP_PKEY_add1_attr_by_NID @3345 + EVP_PKEY_add1_attr_by_OBJ @3756 + EVP_PKEY_add1_attr_by_txt @3410 + EVP_PKEY_asn1_add0 @4130 + EVP_PKEY_asn1_add_alias @4222 + EVP_PKEY_asn1_copy @4427 + EVP_PKEY_asn1_find @4121 + EVP_PKEY_asn1_find_str @4383 + EVP_PKEY_asn1_free @4503 + EVP_PKEY_asn1_get0 @4258 + EVP_PKEY_asn1_get0_info @4320 + EVP_PKEY_asn1_get_count @4296 + EVP_PKEY_asn1_new @4152 + EVP_PKEY_asn1_set_ctrl @4530 + EVP_PKEY_asn1_set_free @4178 + EVP_PKEY_asn1_set_param @4361 + EVP_PKEY_asn1_set_private @4308 + EVP_PKEY_asn1_set_public @4171 + EVP_PKEY_assign @279 + EVP_PKEY_base_id @4230 + EVP_PKEY_bits @1010 + EVP_PKEY_cmp @3433 + EVP_PKEY_cmp_parameters @967 + EVP_PKEY_copy_parameters @280 + EVP_PKEY_decrypt @1070 + EVP_PKEY_decrypt_init @4245 + EVP_PKEY_decrypt_old @4378 + EVP_PKEY_delete_attr @3624 + EVP_PKEY_derive @4388 + EVP_PKEY_derive_init @4220 + EVP_PKEY_derive_set_peer @4488 + EVP_PKEY_encrypt @1071 + EVP_PKEY_encrypt_init @4164 + EVP_PKEY_encrypt_old @4163 + EVP_PKEY_free @281 + EVP_PKEY_get0 @4439 + EVP_PKEY_get0_asn1 @4179 + EVP_PKEY_get1_DH @2128 + EVP_PKEY_get1_DSA @1935 + EVP_PKEY_get1_EC_KEY @3385 + EVP_PKEY_get1_RSA @2034 + EVP_PKEY_get_attr @3439 + EVP_PKEY_get_attr_by_NID @3721 + EVP_PKEY_get_attr_by_OBJ @3651 + EVP_PKEY_get_attr_count @3498 + EVP_PKEY_get_default_digest_nid @4188 + EVP_PKEY_id @4470 + EVP_PKEY_keygen @4143 + EVP_PKEY_keygen_init @4183 + EVP_PKEY_meth_add0 @4446 + EVP_PKEY_meth_find @4469 + EVP_PKEY_meth_free @4460 + EVP_PKEY_meth_new @4448 + EVP_PKEY_meth_set_cleanup @4502 + EVP_PKEY_meth_set_copy @4527 + EVP_PKEY_meth_set_ctrl @4236 + EVP_PKEY_meth_set_decrypt @4135 + EVP_PKEY_meth_set_derive @4276 + EVP_PKEY_meth_set_encrypt @4362 + EVP_PKEY_meth_set_init @4264 + EVP_PKEY_meth_set_keygen @4514 + EVP_PKEY_meth_set_paramgen @4517 + EVP_PKEY_meth_set_sign @4243 + EVP_PKEY_meth_set_signctx @4426 + EVP_PKEY_meth_set_verify @4317 + EVP_PKEY_meth_set_verify_recover @4269 + EVP_PKEY_meth_set_verifyctx @4332 + EVP_PKEY_missing_parameters @282 + EVP_PKEY_new @283 + EVP_PKEY_new_mac_key @4174 + EVP_PKEY_paramgen @4516 + EVP_PKEY_paramgen_init @4261 + EVP_PKEY_print_params @4207 + EVP_PKEY_print_private @4248 + EVP_PKEY_print_public @4118 + EVP_PKEY_save_parameters @284 + EVP_PKEY_set1_DH @2107 + EVP_PKEY_set1_DSA @1970 + EVP_PKEY_set1_EC_KEY @3450 + EVP_PKEY_set1_RSA @2063 + EVP_PKEY_set_type @4524 + EVP_PKEY_set_type_str @4136 + EVP_PKEY_sign @4262 + EVP_PKEY_sign_init @4125 + EVP_PKEY_size @285 + EVP_PKEY_type @286 + EVP_PKEY_verify @4369 + EVP_PKEY_verify_init @4474 + EVP_PKEY_verify_recover @4519 + EVP_PKEY_verify_recover_init @4181 + EVP_SealFinal @287 + EVP_SealInit @288 + EVP_SignFinal @289 + EVP_VerifyFinal @290 + EVP_add_cipher @292 + EVP_add_digest @293 + EVP_aes_128_cbc @2927 + EVP_aes_128_cfb128 @3222 + EVP_aes_128_cfb1 @3251 + EVP_aes_128_cfb8 @3248 + EVP_aes_128_ecb @2644 + EVP_aes_128_ofb @3224 + EVP_aes_192_cbc @3155 + EVP_aes_192_cfb128 @3225 + EVP_aes_192_cfb1 @3264 + EVP_aes_192_cfb8 @3252 + EVP_aes_192_ecb @2862 + EVP_aes_192_ofb @3221 + EVP_aes_256_cbc @2996 + EVP_aes_256_cfb128 @3223 + EVP_aes_256_cfb1 @3271 + EVP_aes_256_cfb8 @3255 + EVP_aes_256_ecb @2720 + EVP_aes_256_ofb @3220 + EVP_bf_cbc @294 + EVP_bf_cfb64 @295 + EVP_bf_ecb @296 + EVP_bf_ofb @297 + EVP_camellia_128_cbc @3795 + EVP_camellia_128_cfb128 @3796 + EVP_camellia_128_cfb1 @3797 + EVP_camellia_128_cfb8 @3798 + EVP_camellia_128_ecb @3799 + EVP_camellia_128_ofb @3800 + EVP_camellia_192_cbc @3801 + EVP_camellia_192_cfb128 @3802 + EVP_camellia_192_cfb1 @3803 + EVP_camellia_192_cfb8 @3804 + EVP_camellia_192_ecb @3805 + EVP_camellia_192_ofb @3806 + EVP_camellia_256_cbc @3807 + EVP_camellia_256_cfb128 @3808 + EVP_camellia_256_cfb1 @3809 + EVP_camellia_256_cfb8 @3810 + EVP_camellia_256_ecb @3811 + EVP_camellia_256_ofb @3812 + EVP_cast5_cbc @983 + EVP_cast5_cfb64 @984 + EVP_cast5_ecb @985 + EVP_cast5_ofb @986 + EVP_cleanup @298 + EVP_des_cbc @299 + EVP_des_cfb1 @3277 + EVP_des_cfb64 @300 + EVP_des_cfb8 @3267 + EVP_des_ecb @301 + EVP_des_ede3 @303 + EVP_des_ede3_cbc @304 + EVP_des_ede3_cfb1 @3280 + EVP_des_ede3_cfb64 @305 + EVP_des_ede3_cfb8 @3258 + EVP_des_ede3_ecb @3236 + EVP_des_ede3_ofb @306 + EVP_des_ede @302 + EVP_des_ede_cbc @307 + EVP_des_ede_cfb64 @308 + EVP_des_ede_ecb @3231 + EVP_des_ede_ofb @309 + EVP_des_ofb @310 + EVP_desx_cbc @311 + EVP_dss1 @313 + EVP_dss @312 + EVP_ecdsa @3724 + EVP_enc_null @314 + EVP_get_cipherbyname @315 + EVP_get_digestbyname @316 + EVP_get_pw_prompt @317 + EVP_idea_cbc @318 + EVP_idea_cfb64 @319 + EVP_idea_ecb @320 + EVP_idea_ofb @321 + EVP_md4 @2438 + EVP_md5 @323 + EVP_md_null @324 + EVP_mdc2 @942 + EVP_rc2_40_cbc @959 + EVP_rc2_64_cbc @1103 + EVP_rc2_cbc @325 + EVP_rc2_cfb64 @326 + EVP_rc2_ecb @327 + EVP_rc2_ofb @328 + EVP_rc4 @329 + EVP_rc4_40 @960 + EVP_read_pw_string @330 + EVP_read_pw_string_min @4552 + EVP_ripemd160 @1252 + EVP_seed_cbc @3914 + EVP_seed_cfb128 @3918 + EVP_seed_ecb @3916 + EVP_seed_ofb @3911 + EVP_set_pw_prompt @331 + EVP_sha1 @333 + EVP_sha224 @3314 + EVP_sha256 @3315 + EVP_sha384 @3312 + EVP_sha512 @3313 + EVP_sha @332 + EVP_whirlpool @4360 + EXTENDED_KEY_USAGE_free @2631 + EXTENDED_KEY_USAGE_it @3098 + EXTENDED_KEY_USAGE_new @2549 + GENERAL_NAMES_free @1216 + GENERAL_NAMES_it @2804 + GENERAL_NAMES_new @1215 + GENERAL_NAME_cmp @4506 + GENERAL_NAME_dup @4147 + GENERAL_NAME_free @1214 + GENERAL_NAME_get0_otherName @4511 + GENERAL_NAME_get0_value @4249 + GENERAL_NAME_it @2594 + GENERAL_NAME_new @1213 + GENERAL_NAME_print @2870 + GENERAL_NAME_set0_othername @4421 + GENERAL_NAME_set0_value @4225 + GENERAL_SUBTREE_free @3349 + GENERAL_SUBTREE_it @3694 + GENERAL_SUBTREE_new @3445 + HMAC @962 + HMAC_CTX_cleanup @2784 + HMAC_CTX_copy @4340 + HMAC_CTX_init @2747 + HMAC_CTX_set_flags @3288 + HMAC_Final @965 + HMAC_Init @963 + HMAC_Init_ex @2572 + HMAC_Update @964 + ISSUING_DIST_POINT_free @4403 + ISSUING_DIST_POINT_it @4431 + ISSUING_DIST_POINT_new @4266 + KRB5_APREQBODY_free @2692 + KRB5_APREQBODY_it @3061 + KRB5_APREQBODY_new @2626 + KRB5_APREQ_free @3179 + KRB5_APREQ_it @3079 + KRB5_APREQ_new @2984 + KRB5_AUTHDATA_free @2775 + KRB5_AUTHDATA_it @3121 + KRB5_AUTHDATA_new @2687 + KRB5_AUTHENTBODY_free @3049 + KRB5_AUTHENTBODY_it @2976 + KRB5_AUTHENTBODY_new @3003 + KRB5_AUTHENT_free @2645 + KRB5_AUTHENT_it @2735 + KRB5_AUTHENT_new @3103 + KRB5_CHECKSUM_free @2634 + KRB5_CHECKSUM_it @2531 + KRB5_CHECKSUM_new @3026 + KRB5_ENCDATA_free @2963 + KRB5_ENCDATA_it @2791 + KRB5_ENCDATA_new @2842 + KRB5_ENCKEY_free @2592 + KRB5_ENCKEY_it @2557 + KRB5_ENCKEY_new @2986 + KRB5_PRINCNAME_free @3096 + KRB5_PRINCNAME_it @3066 + KRB5_PRINCNAME_new @2699 + KRB5_TICKET_free @3156 + KRB5_TICKET_it @3154 + KRB5_TICKET_new @2983 + KRB5_TKTBODY_free @2624 + KRB5_TKTBODY_it @2750 + KRB5_TKTBODY_new @3089 + LONG_it @2864 + MD4 @2433 + MD4_Final @2435 + MD4_Init @2437 + MD4_Transform @2434 + MD4_Update @2436 + MD5 @339 + MD5_Final @340 + MD5_Init @341 + MD5_Transform @1011 + MD5_Update @342 + MDC2 @343 + MDC2_Final @344 + MDC2_Init @345 + MDC2_Update @346 + NAME_CONSTRAINTS_check @4494 + NAME_CONSTRAINTS_free @3338 + NAME_CONSTRAINTS_it @3350 + NAME_CONSTRAINTS_new @3478 + NCONF_WIN32 @3229 + NCONF_default @3227 + NCONF_dump_bio @2287 + NCONF_dump_fp @2285 + NCONF_free @2281 + NCONF_free_data @2289 + NCONF_get_number_e @2704 + NCONF_get_section @2286 + NCONF_get_string @2280 + NCONF_load @2276 + NCONF_load_bio @2284 + NCONF_load_fp @2278 + NCONF_new @2279 + NETSCAPE_CERT_SEQUENCE_free @1165 + NETSCAPE_CERT_SEQUENCE_it @2803 + NETSCAPE_CERT_SEQUENCE_new @1166 + NETSCAPE_SPKAC_free @347 + NETSCAPE_SPKAC_it @2641 + NETSCAPE_SPKAC_new @348 + NETSCAPE_SPKI_b64_decode @1901 + NETSCAPE_SPKI_b64_encode @1899 + NETSCAPE_SPKI_free @349 + NETSCAPE_SPKI_get_pubkey @1900 + NETSCAPE_SPKI_it @3006 + NETSCAPE_SPKI_new @350 + NETSCAPE_SPKI_print @1897 + NETSCAPE_SPKI_set_pubkey @1898 + NETSCAPE_SPKI_sign @351 + NETSCAPE_SPKI_verify @352 + NETSCAPE_X509_free @4246 + NETSCAPE_X509_it @4374 + NETSCAPE_X509_new @4485 + NOTICEREF_free @1503 + NOTICEREF_it @3030 + NOTICEREF_new @1501 + OBJ_NAME_add @1101 + OBJ_NAME_cleanup @1104 + OBJ_NAME_do_all @2939 + OBJ_NAME_do_all_sorted @2743 + OBJ_NAME_get @1105 + OBJ_NAME_init @1106 + OBJ_NAME_new_index @1107 + OBJ_NAME_remove @1108 + OBJ_add_object @353 + OBJ_add_sigid @4259 + OBJ_bsearch_ @4331 + OBJ_bsearch_ex_ @4294 + OBJ_cleanup @355 + OBJ_cmp @356 + OBJ_create @357 + OBJ_create_objects @997 + OBJ_dup @358 + OBJ_find_sigid_algs @4513 + OBJ_find_sigid_by_algs @4210 + OBJ_ln2nid @359 + OBJ_new_nid @360 + OBJ_nid2ln @361 + OBJ_nid2obj @362 + OBJ_nid2sn @363 + OBJ_obj2nid @364 + OBJ_obj2txt @1870 + OBJ_sigid_free @4263 + OBJ_sn2nid @365 + OBJ_txt2nid @366 + OBJ_txt2obj @1167 + OCSP_BASICRESP_add1_ext_i2d @2839 + OCSP_BASICRESP_add_ext @2556 + OCSP_BASICRESP_delete_ext @2553 + OCSP_BASICRESP_free @2838 + OCSP_BASICRESP_get1_ext_d2i @2905 + OCSP_BASICRESP_get_ext @3134 + OCSP_BASICRESP_get_ext_by_NID @3083 + OCSP_BASICRESP_get_ext_by_OBJ @2577 + OCSP_BASICRESP_get_ext_by_critical @2646 + OCSP_BASICRESP_get_ext_count @3014 + OCSP_BASICRESP_it @2800 + OCSP_BASICRESP_new @3077 + OCSP_CERTID_dup @4355 + OCSP_CERTID_free @2726 + OCSP_CERTID_it @2534 + OCSP_CERTID_new @3043 + OCSP_CERTSTATUS_free @2653 + OCSP_CERTSTATUS_it @3116 + OCSP_CERTSTATUS_new @2603 + OCSP_CRLID_free @2904 + OCSP_CRLID_it @3127 + OCSP_CRLID_new @2910 + OCSP_ONEREQ_add1_ext_i2d @3145 + OCSP_ONEREQ_add_ext @2934 + OCSP_ONEREQ_delete_ext @3166 + OCSP_ONEREQ_free @2796 + OCSP_ONEREQ_get1_ext_d2i @2545 + OCSP_ONEREQ_get_ext @2851 + OCSP_ONEREQ_get_ext_by_NID @2733 + OCSP_ONEREQ_get_ext_by_OBJ @2859 + OCSP_ONEREQ_get_ext_by_critical @2919 + OCSP_ONEREQ_get_ext_count @2717 + OCSP_ONEREQ_it @2912 + OCSP_ONEREQ_new @3153 + OCSP_REQINFO_free @2884 + OCSP_REQINFO_it @3001 + OCSP_REQINFO_new @3133 + OCSP_REQUEST_add1_ext_i2d @2828 + OCSP_REQUEST_add_ext @2710 + OCSP_REQUEST_delete_ext @2794 + OCSP_REQUEST_free @2827 + OCSP_REQUEST_get1_ext_d2i @2886 + OCSP_REQUEST_get_ext @2635 + OCSP_REQUEST_get_ext_by_NID @3078 + OCSP_REQUEST_get_ext_by_OBJ @2565 + OCSP_REQUEST_get_ext_by_critical @3161 + OCSP_REQUEST_get_ext_count @3129 + OCSP_REQUEST_it @2799 + OCSP_REQUEST_new @3034 + OCSP_REQUEST_print @2981 + OCSP_REQ_CTX_add1_header @4541 + OCSP_REQ_CTX_free @3921 + OCSP_REQ_CTX_set1_req @4542 + OCSP_RESPBYTES_free @2926 + OCSP_RESPBYTES_it @2811 + OCSP_RESPBYTES_new @2711 + OCSP_RESPDATA_free @2818 + OCSP_RESPDATA_it @2968 + OCSP_RESPDATA_new @2688 + OCSP_RESPID_free @3124 + OCSP_RESPID_it @2994 + OCSP_RESPID_new @2967 + OCSP_RESPONSE_free @3173 + OCSP_RESPONSE_it @3111 + OCSP_RESPONSE_new @3023 + OCSP_RESPONSE_print @2749 + OCSP_REVOKEDINFO_free @2690 + OCSP_REVOKEDINFO_it @3032 + OCSP_REVOKEDINFO_new @2954 + OCSP_SERVICELOC_free @2876 + OCSP_SERVICELOC_it @2740 + OCSP_SERVICELOC_new @2610 + OCSP_SIGNATURE_free @3094 + OCSP_SIGNATURE_it @2554 + OCSP_SIGNATURE_new @2863 + OCSP_SINGLERESP_add1_ext_i2d @2866 + OCSP_SINGLERESP_add_ext @2975 + OCSP_SINGLERESP_delete_ext @2871 + OCSP_SINGLERESP_free @2707 + OCSP_SINGLERESP_get1_ext_d2i @2928 + OCSP_SINGLERESP_get_ext @2903 + OCSP_SINGLERESP_get_ext_by_NID @2825 + OCSP_SINGLERESP_get_ext_by_OBJ @2965 + OCSP_SINGLERESP_get_ext_by_critical @2652 + OCSP_SINGLERESP_get_ext_count @2579 + OCSP_SINGLERESP_it @2951 + OCSP_SINGLERESP_new @2758 + OCSP_accept_responses_new @3058 + OCSP_archive_cutoff_new @2574 + OCSP_basic_add1_cert @2600 + OCSP_basic_add1_nonce @2956 + OCSP_basic_add1_status @3123 + OCSP_basic_sign @2897 + OCSP_basic_verify @3048 + OCSP_cert_id_new @2921 + OCSP_cert_status_str @2647 + OCSP_cert_to_id @2966 + OCSP_check_nonce @2899 + OCSP_check_validity @2971 + OCSP_copy_nonce @2686 + OCSP_crlID_new @3181 + OCSP_crl_reason_str @2844 + OCSP_id_cmp @3076 + OCSP_id_get0_info @2960 + OCSP_id_issuer_cmp @2938 + OCSP_onereq_get0_id @3028 + OCSP_parse_url @2902 + OCSP_request_add0_id @3113 + OCSP_request_add1_cert @3117 + OCSP_request_add1_nonce @2874 + OCSP_request_is_signed @2590 + OCSP_request_onereq_count @3047 + OCSP_request_onereq_get0 @3101 + OCSP_request_set1_name @2716 + OCSP_request_sign @2935 + OCSP_request_verify @2703 + OCSP_resp_count @3025 + OCSP_resp_find @2605 + OCSP_resp_find_status @2713 + OCSP_resp_get0 @2593 + OCSP_response_create @3158 + OCSP_response_get1_basic @3164 + OCSP_response_status @2561 + OCSP_response_status_str @2598 + OCSP_sendreq_bio @2551 + OCSP_sendreq_nbio @3923 + OCSP_sendreq_new @3924 + OCSP_single_get0_status @2989 + OCSP_url_svcloc_new @2973 + OPENSSL_DIR_end @3396 + OPENSSL_DIR_read @3657 + OPENSSL_add_all_algorithms_conf @3213 + OPENSSL_add_all_algorithms_noconf @3212 + OPENSSL_asc2uni @1282 + OPENSSL_cleanse @3245 + OPENSSL_config @3188 + OPENSSL_ia32cap_loc @3467 + OPENSSL_isservice @4048 + OPENSSL_issetugid @2465 + OPENSSL_load_builtin_modules @3214 + OPENSSL_no_config @3228 + OPENSSL_uni2asc @1283 + OTHERNAME_cmp @4224 + OTHERNAME_free @2112 + OTHERNAME_it @2820 + OTHERNAME_new @1999 + OpenSSLDie @3244 + OpenSSL_add_all_ciphers @509 + OpenSSL_add_all_digests @510 + PBE2PARAM_free @1404 + PBE2PARAM_it @2753 + PBE2PARAM_new @1402 + PBEPARAM_free @1313 + PBEPARAM_it @3002 + PBEPARAM_new @1311 + PBKDF2PARAM_free @1400 + PBKDF2PARAM_it @2548 + PBKDF2PARAM_new @1398 + PEM_ASN1_read @367 + PEM_ASN1_read_bio @368 + PEM_ASN1_write @369 + PEM_ASN1_write_bio @370 + PEM_SealFinal @371 + PEM_SealInit @372 + PEM_SealUpdate @373 + PEM_SignFinal @374 + PEM_SignInit @375 + PEM_SignUpdate @376 + PEM_X509_INFO_read @377 + PEM_X509_INFO_read_bio @378 + PEM_X509_INFO_write_bio @379 + PEM_bytes_read_bio @2766 + PEM_def_callback @2948 + PEM_dek_info @380 + PEM_do_header @381 + PEM_get_EVP_CIPHER_INFO @382 + PEM_proc_type @383 + PEM_read @384 + PEM_read_CMS @3983 + PEM_read_DHparams @385 + PEM_read_DSAPrivateKey @386 + PEM_read_DSA_PUBKEY @1984 + PEM_read_DSAparams @387 + PEM_read_ECPKParameters @3683 + PEM_read_ECPrivateKey @3632 + PEM_read_EC_PUBKEY @3618 + PEM_read_NETSCAPE_CERT_SEQUENCE @1168 + PEM_read_PKCS7 @388 + PEM_read_PKCS8 @1782 + PEM_read_PKCS8_PRIV_KEY_INFO @1786 + PEM_read_PUBKEY @2012 + PEM_read_PrivateKey @389 + PEM_read_RSAPrivateKey @390 + PEM_read_RSAPublicKey @947 + PEM_read_RSA_PUBKEY @1977 + PEM_read_X509 @391 + PEM_read_X509_AUX @1917 + PEM_read_X509_CERT_PAIR @3507 + PEM_read_X509_CRL @392 + PEM_read_X509_REQ @393 + PEM_read_bio @394 + PEM_read_bio_CMS @4014 + PEM_read_bio_DHparams @395 + PEM_read_bio_DSAPrivateKey @396 + PEM_read_bio_DSA_PUBKEY @2088 + PEM_read_bio_DSAparams @397 + PEM_read_bio_ECPKParameters @3408 + PEM_read_bio_ECPrivateKey @3714 + PEM_read_bio_EC_PUBKEY @3519 + PEM_read_bio_NETSCAPE_CERT_SEQUENCE @1169 + PEM_read_bio_PKCS7 @398 + PEM_read_bio_PKCS8 @1787 + PEM_read_bio_PKCS8_PRIV_KEY_INFO @1778 + PEM_read_bio_PUBKEY @1995 + PEM_read_bio_Parameters @4489 + PEM_read_bio_PrivateKey @399 + PEM_read_bio_RSAPrivateKey @400 + PEM_read_bio_RSAPublicKey @943 + PEM_read_bio_RSA_PUBKEY @2081 + PEM_read_bio_X509 @401 + PEM_read_bio_X509_AUX @1959 + PEM_read_bio_X509_CERT_PAIR @3753 + PEM_read_bio_X509_CRL @402 + PEM_read_bio_X509_REQ @403 + PEM_write @404 + PEM_write_CMS @3939 + PEM_write_DHparams @405 + PEM_write_DSAPrivateKey @406 + PEM_write_DSA_PUBKEY @2101 + PEM_write_DSAparams @407 + PEM_write_ECPKParameters @3643 + PEM_write_ECPrivateKey @3679 + PEM_write_EC_PUBKEY @3609 + PEM_write_NETSCAPE_CERT_SEQUENCE @1170 + PEM_write_PKCS7 @408 + PEM_write_PKCS8PrivateKey @1798 + PEM_write_PKCS8PrivateKey_nid @2165 + PEM_write_PKCS8 @1785 + PEM_write_PKCS8_PRIV_KEY_INFO @1788 + PEM_write_PUBKEY @1921 + PEM_write_PrivateKey @409 + PEM_write_RSAPrivateKey @410 + PEM_write_RSAPublicKey @949 + PEM_write_RSA_PUBKEY @2095 + PEM_write_X509 @411 + PEM_write_X509_AUX @2039 + PEM_write_X509_CERT_PAIR @3696 + PEM_write_X509_CRL @412 + PEM_write_X509_REQ @413 + PEM_write_X509_REQ_NEW @2251 + PEM_write_bio @414 + PEM_write_bio_ASN1_stream @4499 + PEM_write_bio_CMS @3960 + PEM_write_bio_CMS_stream @4466 + PEM_write_bio_DHparams @415 + PEM_write_bio_DSAPrivateKey @416 + PEM_write_bio_DSA_PUBKEY @1968 + PEM_write_bio_DSAparams @417 + PEM_write_bio_ECPKParameters @3456 + PEM_write_bio_ECPrivateKey @3424 + PEM_write_bio_EC_PUBKEY @3481 + PEM_write_bio_NETSCAPE_CERT_SEQUENCE @1171 + PEM_write_bio_PKCS7 @418 + PEM_write_bio_PKCS7_stream @4189 + PEM_write_bio_PKCS8PrivateKey @1797 + PEM_write_bio_PKCS8PrivateKey_nid @2166 + PEM_write_bio_PKCS8 @1776 + PEM_write_bio_PKCS8_PRIV_KEY_INFO @1781 + PEM_write_bio_PUBKEY @2117 + PEM_write_bio_Parameters @4410 + PEM_write_bio_PrivateKey @419 + PEM_write_bio_RSAPrivateKey @420 + PEM_write_bio_RSAPublicKey @944 + PEM_write_bio_RSA_PUBKEY @1961 + PEM_write_bio_X509 @421 + PEM_write_bio_X509_AUX @2066 + PEM_write_bio_X509_CERT_PAIR @3432 + PEM_write_bio_X509_CRL @422 + PEM_write_bio_X509_REQ @423 + PEM_write_bio_X509_REQ_NEW @2250 + PKCS12_AUTHSAFES_it @2719 + PKCS12_BAGS_free @1287 + PKCS12_BAGS_it @2972 + PKCS12_BAGS_new @1285 + PKCS12_MAC_DATA_free @1295 + PKCS12_MAC_DATA_it @3057 + PKCS12_MAC_DATA_new @1293 + PKCS12_MAKE_KEYBAG @1263 + PKCS12_MAKE_SHKEYBAG @1265 + PKCS12_PBE_add @1301 + PKCS12_PBE_keyivgen @1517 + PKCS12_SAFEBAGS_it @2872 + PKCS12_SAFEBAG_free @1299 + PKCS12_SAFEBAG_it @2700 + PKCS12_SAFEBAG_new @1297 + PKCS12_add_CSPName_asc @2615 + PKCS12_add_cert @3726 + PKCS12_add_friendlyname_asc @1269 + PKCS12_add_friendlyname_uni @1270 + PKCS12_add_key @3761 + PKCS12_add_localkeyid @1268 + PKCS12_add_safe @3352 + PKCS12_add_safes @3464 + PKCS12_certbag2x509 @2672 + PKCS12_certbag2x509crl @2754 + PKCS12_create @1305 + PKCS12_decrypt_skey @2734 + PKCS12_free @1291 + PKCS12_gen_mac @1278 + PKCS12_get_attr_gen @1303 + PKCS12_get_friendlyname @1271 + PKCS12_init @1275 + PKCS12_item_decrypt_d2i @2526 + PKCS12_item_i2d_encrypt @2696 + PKCS12_item_pack_safebag @2887 + PKCS12_it @2651 + PKCS12_key_gen_asc @1276 + PKCS12_key_gen_uni @1277 + PKCS12_new @1290 + PKCS12_newpass @2141 + PKCS12_pack_authsafes @2721 + PKCS12_pack_p7data @1266 + PKCS12_pack_p7encdata @1267 + PKCS12_parse @1304 + PKCS12_pbe_crypt @1272 + PKCS12_set_mac @1280 + PKCS12_setup_mac @1281 + PKCS12_unpack_authsafes @2639 + PKCS12_unpack_p7data @2684 + PKCS12_unpack_p7encdata @2746 + PKCS12_verify_mac @1279 + PKCS12_x5092certbag @3108 + PKCS12_x509crl2certbag @2739 + PKCS1_MGF1 @3324 + PKCS5_PBE_add @1775 + PKCS5_PBE_keyivgen @1789 + PKCS5_PBKDF2_HMAC @4515 + PKCS5_PBKDF2_HMAC_SHA1 @1795 + PKCS5_pbe2_set @1794 + PKCS5_pbe2_set_iv @4341 + PKCS5_pbe_set0_algor @4238 + PKCS5_pbe_set @1323 + PKCS5_v2_PBE_keyivgen @1796 + PKCS7_ATTR_SIGN_it @2632 + PKCS7_ATTR_VERIFY_it @3060 + PKCS7_DIGEST_free @424 + PKCS7_DIGEST_it @3107 + PKCS7_DIGEST_new @425 + PKCS7_ENCRYPT_free @426 + PKCS7_ENCRYPT_it @2681 + PKCS7_ENCRYPT_new @427 + PKCS7_ENC_CONTENT_free @428 + PKCS7_ENC_CONTENT_it @3112 + PKCS7_ENC_CONTENT_new @429 + PKCS7_ENVELOPE_free @430 + PKCS7_ENVELOPE_it @2537 + PKCS7_ENVELOPE_new @431 + PKCS7_ISSUER_AND_SERIAL_digest @432 + PKCS7_ISSUER_AND_SERIAL_free @433 + PKCS7_ISSUER_AND_SERIAL_it @2752 + PKCS7_ISSUER_AND_SERIAL_new @434 + PKCS7_RECIP_INFO_free @435 + PKCS7_RECIP_INFO_get0_alg @4226 + PKCS7_RECIP_INFO_it @3097 + PKCS7_RECIP_INFO_new @436 + PKCS7_RECIP_INFO_set @1072 + PKCS7_SIGNED_free @437 + PKCS7_SIGNED_it @2755 + PKCS7_SIGNED_new @438 + PKCS7_SIGNER_INFO_free @439 + PKCS7_SIGNER_INFO_get0_algs @4376 + PKCS7_SIGNER_INFO_it @2698 + PKCS7_SIGNER_INFO_new @440 + PKCS7_SIGNER_INFO_set @930 + PKCS7_SIGNER_INFO_sign @4260 + PKCS7_SIGN_ENVELOPE_free @441 + PKCS7_SIGN_ENVELOPE_it @2882 + PKCS7_SIGN_ENVELOPE_new @442 + PKCS7_add0_attrib_signing_time @4131 + PKCS7_add1_attrib_digest @4406 + PKCS7_add_attrib_content_type @4444 + PKCS7_add_attrib_smimecap @2156 + PKCS7_add_attribute @1138 + PKCS7_add_certificate @932 + PKCS7_add_crl @933 + PKCS7_add_recipient @1073 + PKCS7_add_recipient_info @1074 + PKCS7_add_signature @938 + PKCS7_add_signed_attribute @1139 + PKCS7_add_signer @931 + PKCS7_cert_from_signer_info @939 + PKCS7_content_new @934 + PKCS7_ctrl @927 + PKCS7_dataDecode @1246 + PKCS7_dataFinal @1245 + PKCS7_dataInit @937 + PKCS7_dataVerify @936 + PKCS7_decrypt @2151 + PKCS7_digest_from_attributes @1140 + PKCS7_dup @443 + PKCS7_encrypt @2146 + PKCS7_final @4229 + PKCS7_free @444 + PKCS7_get0_signers @2150 + PKCS7_get_attribute @1141 + PKCS7_get_issuer_and_serial @1142 + PKCS7_get_signed_attribute @1143 + PKCS7_get_signer_info @940 + PKCS7_get_smimecap @2154 + PKCS7_it @3160 + PKCS7_new @445 + PKCS7_print_ctx @4358 + PKCS7_set0_type_other @3752 + PKCS7_set_attributes @1153 + PKCS7_set_cipher @1075 + PKCS7_set_content @929 + PKCS7_set_digest @3741 + PKCS7_set_signed_attributes @1154 + PKCS7_set_type @928 + PKCS7_sign @2155 + PKCS7_sign_add_signer @4335 + PKCS7_signatureVerify @1845 + PKCS7_simple_smimecap @2153 + PKCS7_stream @4481 + PKCS7_to_TS_TST_INFO @4273 + PKCS7_verify @2145 + PKCS8_PRIV_KEY_INFO_free @1317 + PKCS8_PRIV_KEY_INFO_it @3000 + PKCS8_PRIV_KEY_INFO_new @1315 + PKCS8_add_keyusage @1302 + PKCS8_decrypt @2765 + PKCS8_encrypt @1264 + PKCS8_pkey_get0 @4257 + PKCS8_pkey_set0 @4304 + PKCS8_set_broken @1320 + PKEY_USAGE_PERIOD_free @1235 + PKEY_USAGE_PERIOD_it @2638 + PKEY_USAGE_PERIOD_new @1234 + POLICYINFO_free @1491 + POLICYINFO_it @2991 + POLICYINFO_new @1489 + POLICYQUALINFO_free @1495 + POLICYQUALINFO_it @2619 + POLICYQUALINFO_new @1493 + POLICY_CONSTRAINTS_free @3344 + POLICY_CONSTRAINTS_it @3649 + POLICY_CONSTRAINTS_new @3547 + POLICY_MAPPINGS_it @3693 + POLICY_MAPPING_free @3419 + POLICY_MAPPING_it @3342 + POLICY_MAPPING_new @3746 + PROXY_CERT_INFO_EXTENSION_free @3306 + PROXY_CERT_INFO_EXTENSION_it @3307 + PROXY_CERT_INFO_EXTENSION_new @3305 + PROXY_POLICY_free @3308 + PROXY_POLICY_it @3301 + PROXY_POLICY_new @3309 + RAND_SSLeay @1113 + RAND_add @2201 + RAND_bytes @464 + RAND_cleanup @465 + RAND_egd @2253 + RAND_egd_bytes @2402 + RAND_event @2258 + RAND_file_name @466 + RAND_get_rand_method @1137 + RAND_load_file @467 + RAND_poll @2423 + RAND_pseudo_bytes @2206 + RAND_query_egd_bytes @2945 + RAND_screen @468 + RAND_seed @469 + RAND_set_rand_engine @2730 + RAND_set_rand_method @1114 + RAND_status @2254 + RAND_write_file @470 + RC2_cbc_encrypt @471 + RC2_cfb64_encrypt @472 + RC2_decrypt @995 + RC2_ecb_encrypt @473 + RC2_encrypt @474 + RC2_ofb64_encrypt @475 + RC2_set_key @476 + RC4 @477 + RC4_options @478 + RC4_set_key @479 + RIPEMD160 @1045 + RIPEMD160_Final @1044 + RIPEMD160_Init @1042 + RIPEMD160_Transform @1046 + RIPEMD160_Update @1043 + RSAPrivateKey_dup @481 + RSAPrivateKey_it @2906 + RSAPublicKey_dup @482 + RSAPublicKey_it @2737 + RSA_PKCS1_SSLeay @483 + RSA_X931_hash_id @3319 + RSA_blinding_off @978 + RSA_blinding_on @977 + RSA_check_key @1869 + RSA_flags @956 + RSA_free @484 + RSA_generate_key @485 + RSA_generate_key_ex @3686 + RSA_get_default_method @1848 + RSA_get_ex_data @1029 + RSA_get_ex_new_index @1030 + RSA_get_method @1847 + RSA_memory_lock @1115 + RSA_new @486 + RSA_new_method @487 + RSA_null_method @1904 + RSA_padding_add_PKCS1_OAEP @1226 + RSA_padding_add_PKCS1_PSS @3323 + RSA_padding_add_PKCS1_type_1 @1031 + RSA_padding_add_PKCS1_type_2 @1032 + RSA_padding_add_SSLv23 @1033 + RSA_padding_add_X931 @3322 + RSA_padding_add_none @1034 + RSA_padding_check_PKCS1_OAEP @1227 + RSA_padding_check_PKCS1_type_1 @1035 + RSA_padding_check_PKCS1_type_2 @1036 + RSA_padding_check_SSLv23 @1037 + RSA_padding_check_X931 @3320 + RSA_padding_check_none @1038 + RSA_print @488 + RSA_print_fp @489 + RSA_private_decrypt @490 + RSA_private_encrypt @491 + RSA_public_decrypt @492 + RSA_public_encrypt @493 + RSA_set_default_method @494 + RSA_set_ex_data @1028 + RSA_set_method @1846 + RSA_setup_blinding @3541 + RSA_sign @495 + RSA_sign_ASN1_OCTET_STRING @496 + RSA_size @497 + RSA_up_ref @2760 + RSA_verify @498 + RSA_verify_ASN1_OCTET_STRING @499 + RSA_verify_PKCS1_PSS @3321 + SEED_cbc_encrypt @3910 + SEED_cfb128_encrypt @3912 + SEED_decrypt @3908 + SEED_ecb_encrypt @3915 + SEED_encrypt @3909 + SEED_ofb128_encrypt @3913 + SEED_set_key @3917 + SHA1 @501 + SHA1_Final @502 + SHA1_Init @503 + SHA1_Transform @1012 + SHA1_Update @504 + SHA224 @3510 + SHA224_Final @3560 + SHA224_Init @3631 + SHA224_Update @3562 + SHA256 @3654 + SHA256_Final @3712 + SHA256_Init @3479 + SHA256_Transform @3664 + SHA256_Update @3765 + SHA384 @3745 + SHA384_Final @3740 + SHA384_Init @3737 + SHA384_Update @3551 + SHA512 @3669 + SHA512_Final @3581 + SHA512_Init @3633 + SHA512_Transform @3675 + SHA512_Update @3356 + SHA @500 + SHA_Final @505 + SHA_Init @506 + SHA_Transform @1013 + SHA_Update @507 + SMIME_crlf_copy @2148 + SMIME_read_ASN1 @4017 + SMIME_read_CMS @3949 + SMIME_read_PKCS7 @2143 + SMIME_text @2152 + SMIME_write_ASN1 @4161 + SMIME_write_CMS @3994 + SMIME_write_PKCS7 @2142 + SSLeay_version @2 + SXNETID_free @1332 + SXNETID_it @2669 + SXNETID_new @1331 + SXNET_add_id_INTEGER @1479 + SXNET_add_id_asc @1477 + SXNET_add_id_ulong @1478 + SXNET_free @1328 + SXNET_get_id_INTEGER @1482 + SXNET_get_id_asc @1480 + SXNET_get_id_ulong @1481 + SXNET_it @2613 + SXNET_new @1327 + TS_ACCURACY_dup @4397 + TS_ACCURACY_free @4486 + TS_ACCURACY_get_micros @4492 + TS_ACCURACY_get_millis @4395 + TS_ACCURACY_get_seconds @4352 + TS_ACCURACY_new @4240 + TS_ACCURACY_set_micros @4525 + TS_ACCURACY_set_millis @4145 + TS_ACCURACY_set_seconds @4255 + TS_ASN1_INTEGER_print_bio @4521 + TS_CONF_get_tsa_section @4160 + TS_CONF_load_cert @4123 + TS_CONF_load_certs @4312 + TS_CONF_load_key @4168 + TS_CONF_set_accuracy @4450 + TS_CONF_set_certs @4319 + TS_CONF_set_clock_precision_digits @4490 + TS_CONF_set_crypto_device @4473 + TS_CONF_set_def_policy @4483 + TS_CONF_set_default_engine @4254 + TS_CONF_set_digests @4234 + TS_CONF_set_ess_cert_id_chain @4380 + TS_CONF_set_ordering @4436 + TS_CONF_set_policies @4475 + TS_CONF_set_serial @4347 + TS_CONF_set_signer_cert @4534 + TS_CONF_set_signer_key @4394 + TS_CONF_set_tsa_name @4196 + TS_MSG_IMPRINT_dup @4357 + TS_MSG_IMPRINT_free @4479 + TS_MSG_IMPRINT_get_algo @4185 + TS_MSG_IMPRINT_get_msg @4326 + TS_MSG_IMPRINT_new @4468 + TS_MSG_IMPRINT_print_bio @4190 + TS_MSG_IMPRINT_set_algo @4155 + TS_MSG_IMPRINT_set_msg @4457 + TS_OBJ_print_bio @4268 + TS_REQ_add_ext @4329 + TS_REQ_delete_ext @4205 + TS_REQ_dup @4146 + TS_REQ_ext_free @4177 + TS_REQ_free @4459 + TS_REQ_get_cert_req @4302 + TS_REQ_get_ext @4124 + TS_REQ_get_ext_by_NID @4237 + TS_REQ_get_ext_by_OBJ @4533 + TS_REQ_get_ext_by_critical @4322 + TS_REQ_get_ext_count @4283 + TS_REQ_get_ext_d2i @4420 + TS_REQ_get_exts @4461 + TS_REQ_get_msg_imprint @4209 + TS_REQ_get_nonce @4212 + TS_REQ_get_policy_id @4192 + TS_REQ_get_version @4328 + TS_REQ_new @4467 + TS_REQ_print_bio @4186 + TS_REQ_set_cert_req @4345 + TS_REQ_set_msg_imprint @4232 + TS_REQ_set_nonce @4280 + TS_REQ_set_policy_id @4138 + TS_REQ_set_version @4438 + TS_REQ_to_TS_VERIFY_CTX @4526 + TS_RESP_CTX_add_failure_info @4463 + TS_RESP_CTX_add_flags @4455 + TS_RESP_CTX_add_md @4407 + TS_RESP_CTX_add_policy @4310 + TS_RESP_CTX_free @4538 + TS_RESP_CTX_get_request @4423 + TS_RESP_CTX_get_tst_info @4414 + TS_RESP_CTX_new @4227 + TS_RESP_CTX_set_accuracy @4279 + TS_RESP_CTX_set_certs @4482 + TS_RESP_CTX_set_clock_precision_digits @4462 + TS_RESP_CTX_set_def_policy @4373 + TS_RESP_CTX_set_extension_cb @4366 + TS_RESP_CTX_set_serial_cb @4323 + TS_RESP_CTX_set_signer_cert @4231 + TS_RESP_CTX_set_signer_key @4162 + TS_RESP_CTX_set_status_info @4184 + TS_RESP_CTX_set_status_info_cond @4368 + TS_RESP_CTX_set_time_cb @4325 + TS_RESP_create_response @4375 + TS_RESP_dup @4128 + TS_RESP_free @4402 + TS_RESP_get_status_info @4270 + TS_RESP_get_token @4396 + TS_RESP_get_tst_info @4487 + TS_RESP_new @4202 + TS_RESP_print_bio @4338 + TS_RESP_set_status_info @4142 + TS_RESP_set_tst_info @4228 + TS_RESP_verify_response @4350 + TS_RESP_verify_signature @4415 + TS_RESP_verify_token @4293 + TS_STATUS_INFO_dup @4204 + TS_STATUS_INFO_free @4292 + TS_STATUS_INFO_new @4418 + TS_STATUS_INFO_print_bio @4219 + TS_TST_INFO_add_ext @4275 + TS_TST_INFO_delete_ext @4390 + TS_TST_INFO_dup @4408 + TS_TST_INFO_ext_free @4327 + TS_TST_INFO_free @4348 + TS_TST_INFO_get_accuracy @4411 + TS_TST_INFO_get_ext @4529 + TS_TST_INFO_get_ext_by_NID @4201 + TS_TST_INFO_get_ext_by_OBJ @4158 + TS_TST_INFO_get_ext_by_critical @4531 + TS_TST_INFO_get_ext_count @4422 + TS_TST_INFO_get_ext_d2i @4309 + TS_TST_INFO_get_exts @4339 + TS_TST_INFO_get_msg_imprint @4313 + TS_TST_INFO_get_nonce @4377 + TS_TST_INFO_get_ordering @4337 + TS_TST_INFO_get_policy_id @4301 + TS_TST_INFO_get_serial @4211 + TS_TST_INFO_get_time @4256 + TS_TST_INFO_get_tsa @4417 + TS_TST_INFO_get_version @4315 + TS_TST_INFO_new @4252 + TS_TST_INFO_print_bio @4285 + TS_TST_INFO_set_accuracy @4443 + TS_TST_INFO_set_msg_imprint @4505 + TS_TST_INFO_set_nonce @4127 + TS_TST_INFO_set_ordering @4157 + TS_TST_INFO_set_policy_id @4379 + TS_TST_INFO_set_serial @4471 + TS_TST_INFO_set_time @4134 + TS_TST_INFO_set_tsa @4447 + TS_TST_INFO_set_version @4413 + TS_VERIFY_CTX_cleanup @4291 + TS_VERIFY_CTX_free @4321 + TS_VERIFY_CTX_init @4480 + TS_VERIFY_CTX_new @4365 + TS_X509_ALGOR_print_bio @4501 + TS_ext_print_bio @4520 + TXT_DB_create_index @511 + TXT_DB_free @512 + TXT_DB_get_by_index @513 + TXT_DB_insert @514 + TXT_DB_read @515 + TXT_DB_write @516 + UI_OpenSSL @2947 + UI_UTIL_read_pw @3208 + UI_UTIL_read_pw_string @3209 + UI_add_error_string @2633 + UI_add_info_string @3148 + UI_add_input_boolean @2538 + UI_add_input_string @3126 + UI_add_user_data @2793 + UI_add_verify_string @3064 + UI_construct_prompt @2585 + UI_create_method @3144 + UI_ctrl @2580 + UI_destroy_method @2857 + UI_dup_error_string @2736 + UI_dup_info_string @2649 + UI_dup_input_boolean @2614 + UI_dup_input_string @2587 + UI_dup_verify_string @3119 + UI_free @2892 + UI_get0_action_string @2850 + UI_get0_output_string @3118 + UI_get0_result @2718 + UI_get0_result_string @2845 + UI_get0_test_string @3007 + UI_get0_user_data @2783 + UI_get_default_method @2694 + UI_get_ex_data @2691 + UI_get_ex_new_index @2932 + UI_get_input_flags @2723 + UI_get_method @2795 + UI_get_result_maxsize @3042 + UI_get_result_minsize @3149 + UI_get_string_type @2916 + UI_method_get_closer @3045 + UI_method_get_flusher @2678 + UI_method_get_opener @2979 + UI_method_get_prompt_constructor @4550 + UI_method_get_reader @3013 + UI_method_get_writer @2946 + UI_method_set_closer @2558 + UI_method_set_flusher @2789 + UI_method_set_opener @3140 + UI_method_set_prompt_constructor @4551 + UI_method_set_reader @3174 + UI_method_set_writer @3102 + UI_new @3157 + UI_new_method @2893 + UI_process @2913 + UI_set_default_method @2944 + UI_set_ex_data @2807 + UI_set_method @2959 + UI_set_result @3016 + USERNOTICE_free @1499 + USERNOTICE_it @3132 + USERNOTICE_new @1497 + UTF8_getc @1903 + UTF8_putc @1902 + WHIRLPOOL @4149 + WHIRLPOOL_BitUpdate @4199 + WHIRLPOOL_Final @4370 + WHIRLPOOL_Init @4141 + WHIRLPOOL_Update @4449 + X509V3_EXT_CRL_add_conf @1247 + X509V3_EXT_CRL_add_nconf @3031 + X509V3_EXT_REQ_add_conf @1896 + X509V3_EXT_REQ_add_nconf @2627 + X509V3_EXT_add @1172 + X509V3_EXT_add_alias @1173 + X509V3_EXT_add_conf @1174 + X509V3_EXT_add_list @1648 + X509V3_EXT_add_nconf @2832 + X509V3_EXT_add_nconf_sk @2763 + X509V3_EXT_cleanup @1175 + X509V3_EXT_conf @1176 + X509V3_EXT_conf_nid @1177 + X509V3_EXT_d2i @1238 + X509V3_EXT_get @1178 + X509V3_EXT_get_nid @1179 + X509V3_EXT_i2d @1646 + X509V3_EXT_nconf @2540 + X509V3_EXT_nconf_nid @2942 + X509V3_EXT_print @1180 + X509V3_EXT_print_fp @1181 + X509V3_EXT_val_prn @1647 + X509V3_NAME_from_section @3689 + X509V3_add1_i2d @2536 + X509V3_add_standard_extensions @1182 + X509V3_add_value @1183 + X509V3_add_value_bool @1184 + X509V3_add_value_bool_nf @1651 + X509V3_add_value_int @1185 + X509V3_add_value_uchar @1549 + X509V3_conf_free @1186 + X509V3_extensions_print @3085 + X509V3_get_d2i @2026 + X509V3_get_section @1505 + X509V3_get_string @1504 + X509V3_get_value_bool @1187 + X509V3_get_value_int @1188 + X509V3_parse_list @1189 + X509V3_section_free @1507 + X509V3_set_conf_lhash @1483 + X509V3_set_ctx @1508 + X509V3_set_nconf @2695 + X509V3_string_free @1506 + X509_ALGORS_it @3926 + X509_ALGOR_dup @1518 + X509_ALGOR_free @517 + X509_ALGOR_get0 @3927 + X509_ALGOR_it @2714 + X509_ALGOR_new @518 + X509_ALGOR_set0 @3928 + X509_ATTRIBUTE_count @2193 + X509_ATTRIBUTE_create @1155 + X509_ATTRIBUTE_create_by_NID @2191 + X509_ATTRIBUTE_create_by_OBJ @2194 + X509_ATTRIBUTE_create_by_txt @2218 + X509_ATTRIBUTE_dup @1156 + X509_ATTRIBUTE_free @519 + X509_ATTRIBUTE_get0_data @2198 + X509_ATTRIBUTE_get0_object @2195 + X509_ATTRIBUTE_get0_type @2187 + X509_ATTRIBUTE_it @2732 + X509_ATTRIBUTE_new @520 + X509_ATTRIBUTE_set1_data @2188 + X509_ATTRIBUTE_set1_object @2192 + X509_CERT_AUX_free @1926 + X509_CERT_AUX_it @2727 + X509_CERT_AUX_new @2001 + X509_CERT_AUX_print @1982 + X509_CERT_PAIR_free @3578 + X509_CERT_PAIR_it @3534 + X509_CERT_PAIR_new @3684 + X509_CINF_free @521 + X509_CINF_it @2812 + X509_CINF_new @522 + X509_CRL_INFO_free @523 + X509_CRL_INFO_it @3104 + X509_CRL_INFO_new @524 + X509_CRL_METHOD_free @4241 + X509_CRL_METHOD_new @4371 + X509_CRL_add0_revoked @3004 + X509_CRL_add1_ext_i2d @2834 + X509_CRL_add_ext @525 + X509_CRL_cmp @526 + X509_CRL_delete_ext @527 + X509_CRL_digest @2391 + X509_CRL_dup @528 + X509_CRL_free @529 + X509_CRL_get0_by_cert @4387 + X509_CRL_get0_by_serial @4412 + X509_CRL_get_ext @530 + X509_CRL_get_ext_by_NID @531 + X509_CRL_get_ext_by_OBJ @532 + X509_CRL_get_ext_by_critical @533 + X509_CRL_get_ext_count @534 + X509_CRL_get_ext_d2i @2009 + X509_CRL_get_meth_data @4324 + X509_CRL_it @2555 + X509_CRL_match @4307 + X509_CRL_new @535 + X509_CRL_print @1229 + X509_CRL_print_fp @1228 + X509_CRL_set_default_method @4399 + X509_CRL_set_issuer_name @2742 + X509_CRL_set_lastUpdate @2837 + X509_CRL_set_meth_data @4303 + X509_CRL_set_nextUpdate @2798 + X509_CRL_set_version @2823 + X509_CRL_sign @536 + X509_CRL_sort @2607 + X509_CRL_verify @537 + X509_EXTENSIONS_it @3919 + X509_EXTENSION_create_by_NID @538 + X509_EXTENSION_create_by_OBJ @539 + X509_EXTENSION_dup @540 + X509_EXTENSION_free @541 + X509_EXTENSION_get_critical @542 + X509_EXTENSION_get_data @543 + X509_EXTENSION_get_object @544 + X509_EXTENSION_it @2667 + X509_EXTENSION_new @545 + X509_EXTENSION_set_critical @546 + X509_EXTENSION_set_data @547 + X509_EXTENSION_set_object @548 + X509_INFO_free @549 + X509_INFO_new @550 + X509_LOOKUP_by_alias @551 + X509_LOOKUP_by_fingerprint @552 + X509_LOOKUP_by_issuer_serial @553 + X509_LOOKUP_by_subject @554 + X509_LOOKUP_ctrl @555 + X509_LOOKUP_file @556 + X509_LOOKUP_free @557 + X509_LOOKUP_hash_dir @558 + X509_LOOKUP_init @559 + X509_LOOKUP_new @560 + X509_LOOKUP_shutdown @561 + X509_NAME_ENTRY_create_by_NID @562 + X509_NAME_ENTRY_create_by_OBJ @563 + X509_NAME_ENTRY_create_by_txt @2071 + X509_NAME_ENTRY_dup @564 + X509_NAME_ENTRY_free @565 + X509_NAME_ENTRY_get_data @566 + X509_NAME_ENTRY_get_object @567 + X509_NAME_ENTRY_it @2931 + X509_NAME_ENTRY_new @568 + X509_NAME_ENTRY_set_data @569 + X509_NAME_ENTRY_set_object @570 + X509_NAME_add_entry @571 + X509_NAME_add_entry_by_NID @1914 + X509_NAME_add_entry_by_OBJ @2008 + X509_NAME_add_entry_by_txt @1912 + X509_NAME_cmp @572 + X509_NAME_delete_entry @573 + X509_NAME_digest @574 + X509_NAME_dup @575 + X509_NAME_entry_count @576 + X509_NAME_free @577 + X509_NAME_get_entry @578 + X509_NAME_get_index_by_NID @579 + X509_NAME_get_index_by_OBJ @580 + X509_NAME_get_text_by_NID @581 + X509_NAME_get_text_by_OBJ @582 + X509_NAME_hash @583 + X509_NAME_hash_old @4535 + X509_NAME_it @3131 + X509_NAME_new @584 + X509_NAME_oneline @585 + X509_NAME_print @586 + X509_NAME_print_ex @2431 + X509_NAME_print_ex_fp @2429 + X509_NAME_set @587 + X509_OBJECT_free_contents @588 + X509_OBJECT_idx_by_subject @2450 + X509_OBJECT_retrieve_by_subject @589 + X509_OBJECT_retrieve_match @2449 + X509_OBJECT_up_ref_count @590 + X509_PKEY_free @591 + X509_PKEY_new @592 + X509_POLICY_NODE_print @3736 + X509_PUBKEY_free @593 + X509_PUBKEY_get0_param @4356 + X509_PUBKEY_get @594 + X509_PUBKEY_it @2679 + X509_PUBKEY_new @595 + X509_PUBKEY_set0_param @4213 + X509_PUBKEY_set @596 + X509_PURPOSE_add @2090 + X509_PURPOSE_cleanup @2119 + X509_PURPOSE_get0 @1915 + X509_PURPOSE_get0_name @2011 + X509_PURPOSE_get0_sname @2105 + X509_PURPOSE_get_by_id @1990 + X509_PURPOSE_get_by_sname @1952 + X509_PURPOSE_get_count @2067 + X509_PURPOSE_get_id @1997 + X509_PURPOSE_get_trust @2022 + X509_PURPOSE_set @3138 + X509_REQ_INFO_free @597 + X509_REQ_INFO_it @3139 + X509_REQ_INFO_new @598 + X509_REQ_add1_attr @2214 + X509_REQ_add1_attr_by_NID @2209 + X509_REQ_add1_attr_by_OBJ @2212 + X509_REQ_add1_attr_by_txt @2217 + X509_REQ_add_extensions @1881 + X509_REQ_add_extensions_nid @1879 + X509_REQ_check_private_key @3516 + X509_REQ_delete_attr @2215 + X509_REQ_digest @2362 + X509_REQ_dup @599 + X509_REQ_extension_nid @1875 + X509_REQ_free @600 + X509_REQ_get1_email @2403 + X509_REQ_get_attr @2208 + X509_REQ_get_attr_by_NID @2207 + X509_REQ_get_attr_by_OBJ @2210 + X509_REQ_get_attr_count @2213 + X509_REQ_get_extension_nids @1877 + X509_REQ_get_extensions @1872 + X509_REQ_get_pubkey @601 + X509_REQ_it @2879 + X509_REQ_new @602 + X509_REQ_print @603 + X509_REQ_print_ex @3237 + X509_REQ_print_fp @604 + X509_REQ_set_extension_nids @1873 + X509_REQ_set_pubkey @605 + X509_REQ_set_subject_name @606 + X509_REQ_set_version @607 + X509_REQ_sign @608 + X509_REQ_to_X509 @609 + X509_REQ_verify @610 + X509_REVOKED_add1_ext_i2d @3087 + X509_REVOKED_add_ext @611 + X509_REVOKED_delete_ext @612 + X509_REVOKED_free @613 + X509_REVOKED_get_ext @614 + X509_REVOKED_get_ext_by_NID @615 + X509_REVOKED_get_ext_by_OBJ @616 + X509_REVOKED_get_ext_by_critical @617 + X509_REVOKED_get_ext_count @618 + X509_REVOKED_get_ext_d2i @1909 + X509_REVOKED_it @2642 + X509_REVOKED_new @619 + X509_REVOKED_set_revocationDate @2608 + X509_REVOKED_set_serialNumber @2543 + X509_SIG_free @620 + X509_SIG_it @2847 + X509_SIG_new @621 + X509_STORE_CTX_cleanup @622 + X509_STORE_CTX_free @1969 + X509_STORE_CTX_get0_current_crl @4544 + X509_STORE_CTX_get0_current_issuer @4546 + X509_STORE_CTX_get0_param @3505 + X509_STORE_CTX_get0_parent_ctx @4545 + X509_STORE_CTX_get0_policy_tree @3748 + X509_STORE_CTX_get1_chain @2204 + X509_STORE_CTX_get1_issuer @2448 + X509_STORE_CTX_get_chain @1014 + X509_STORE_CTX_get_current_cert @1015 + X509_STORE_CTX_get_error @1016 + X509_STORE_CTX_get_error_depth @1017 + X509_STORE_CTX_get_ex_data @1018 + X509_STORE_CTX_get_ex_new_index @1100 + X509_STORE_CTX_get_explicit_policy @3524 + X509_STORE_CTX_init @623 + X509_STORE_CTX_new @2033 + X509_STORE_CTX_purpose_inherit @1976 + X509_STORE_CTX_set0_crls @3333 + X509_STORE_CTX_set0_param @3341 + X509_STORE_CTX_set_cert @1020 + X509_STORE_CTX_set_chain @1021 + X509_STORE_CTX_set_default @3595 + X509_STORE_CTX_set_depth @3377 + X509_STORE_CTX_set_error @1022 + X509_STORE_CTX_set_ex_data @1023 + X509_STORE_CTX_set_flags @2451 + X509_STORE_CTX_set_purpose @2064 + X509_STORE_CTX_set_time @2447 + X509_STORE_CTX_set_trust @2030 + X509_STORE_CTX_set_verify_cb @2524 + X509_STORE_CTX_trusted_stack @2452 + X509_STORE_add_cert @624 + X509_STORE_add_crl @957 + X509_STORE_add_lookup @625 + X509_STORE_free @626 + X509_STORE_get1_certs @4433 + X509_STORE_get1_crls @4150 + X509_STORE_get_by_subject @627 + X509_STORE_load_locations @628 + X509_STORE_new @629 + X509_STORE_set1_param @3676 + X509_STORE_set_default_paths @630 + X509_STORE_set_depth @3508 + X509_STORE_set_flags @2596 + X509_STORE_set_purpose @2559 + X509_STORE_set_trust @2586 + X509_STORE_set_verify_cb @4543 + X509_TRUST_add @1931 + X509_TRUST_cleanup @2007 + X509_TRUST_get0 @2047 + X509_TRUST_get0_name @2046 + X509_TRUST_get_by_id @2021 + X509_TRUST_get_count @2110 + X509_TRUST_get_flags @2056 + X509_TRUST_get_trust @2055 + X509_TRUST_set @2833 + X509_TRUST_set_default @2185 + X509_VAL_free @631 + X509_VAL_it @2829 + X509_VAL_new @632 + X509_VERIFY_PARAM_add0_policy @3652 + X509_VERIFY_PARAM_add0_table @3703 + X509_VERIFY_PARAM_clear_flags @3772 + X509_VERIFY_PARAM_free @3527 + X509_VERIFY_PARAM_get_depth @3559 + X509_VERIFY_PARAM_get_flags @3781 + X509_VERIFY_PARAM_inherit @3378 + X509_VERIFY_PARAM_lookup @3659 + X509_VERIFY_PARAM_new @3437 + X509_VERIFY_PARAM_set1 @3610 + X509_VERIFY_PARAM_set1_name @3413 + X509_VERIFY_PARAM_set1_policies @3412 + X509_VERIFY_PARAM_set_depth @3399 + X509_VERIFY_PARAM_set_flags @3421 + X509_VERIFY_PARAM_set_purpose @3414 + X509_VERIFY_PARAM_set_time @3757 + X509_VERIFY_PARAM_set_trust @3495 + X509_VERIFY_PARAM_table_cleanup @3525 + X509_add1_ext_i2d @2697 + X509_add1_reject_object @2082 + X509_add1_trust_object @2140 + X509_add_ext @633 + X509_alias_get0 @2074 + X509_alias_set1 @1933 + X509_certificate_type @635 + X509_check_akid @4496 + X509_check_ca @3286 + X509_check_issued @2454 + X509_check_private_key @636 + X509_check_purpose @2051 + X509_check_trust @2083 + X509_cmp @2135 + X509_cmp_current_time @637 + X509_cmp_time @2446 + X509_delete_ext @638 + X509_digest @639 + X509_dup @640 + X509_email_free @2405 + X509_find_by_issuer_and_serial @920 + X509_find_by_subject @921 + X509_free @641 + X509_get0_pubkey_bitstr @2662 + X509_get1_email @2404 + X509_get1_ocsp @3920 + X509_get_default_cert_area @642 + X509_get_default_cert_dir @643 + X509_get_default_cert_dir_env @644 + X509_get_default_cert_file @645 + X509_get_default_cert_file_env @646 + X509_get_default_private_dir @647 + X509_get_ex_data @1950 + X509_get_ex_new_index @2019 + X509_get_ext @648 + X509_get_ext_by_NID @649 + X509_get_ext_by_OBJ @650 + X509_get_ext_by_critical @651 + X509_get_ext_count @652 + X509_get_ext_d2i @1958 + X509_get_issuer_name @653 + X509_get_pubkey @654 + X509_get_pubkey_parameters @655 + X509_get_serialNumber @656 + X509_get_subject_name @657 + X509_gmtime_adj @658 + X509_issuer_and_serial_cmp @659 + X509_issuer_and_serial_hash @660 + X509_issuer_name_cmp @661 + X509_issuer_name_hash @662 + X509_issuer_name_hash_old @4547 + X509_it @2773 + X509_keyid_get0 @3363 + X509_keyid_set1 @2460 + X509_load_cert_crl_file @1972 + X509_load_cert_file @663 + X509_load_crl_file @958 + X509_new @664 + X509_ocspid_print @2790 + X509_policy_check @3720 + X509_policy_level_get0_node @3568 + X509_policy_level_node_count @3434 + X509_policy_node_get0_parent @3371 + X509_policy_node_get0_policy @3463 + X509_policy_node_get0_qualifiers @3448 + X509_policy_tree_free @3466 + X509_policy_tree_get0_level @3616 + X509_policy_tree_get0_policies @3381 + X509_policy_tree_get0_user_policies @3656 + X509_policy_tree_level_count @3573 + X509_print @665 + X509_print_ex @2544 + X509_print_ex_fp @3018 + X509_print_fp @666 + X509_pubkey_digest @2895 + X509_reject_clear @2184 + X509_set_ex_data @1910 + X509_set_issuer_name @667 + X509_set_notAfter @668 + X509_set_notBefore @669 + X509_set_pubkey @670 + X509_set_serialNumber @671 + X509_set_subject_name @672 + X509_set_version @673 + X509_sign @674 + X509_signature_print @2706 + X509_subject_name_cmp @675 + X509_subject_name_hash @676 + X509_subject_name_hash_old @4548 + X509_supported_extension @2977 + X509_time_adj @2453 + X509_time_adj_ex @4454 + X509_to_X509_REQ @677 + X509_trust_clear @1928 + X509_verify @678 + X509_verify_cert @679 + X509_verify_cert_error_string @680 + X509at_add1_attr @2197 + X509at_add1_attr_by_NID @2211 + X509at_add1_attr_by_OBJ @2216 + X509at_add1_attr_by_txt @2219 + X509at_delete_attr @2199 + X509at_get0_data_by_OBJ @3931 + X509at_get_attr @2189 + X509at_get_attr_by_NID @2196 + X509at_get_attr_by_OBJ @2200 + X509at_get_attr_count @2190 + X509v3_add_ext @681 + X509v3_delete_ext @688 + X509v3_get_ext @689 + X509v3_get_ext_by_NID @690 + X509v3_get_ext_by_OBJ @691 + X509v3_get_ext_by_critical @692 + X509v3_get_ext_count @693 + ZLONG_it @2780 + _ossl_096_des_random_seed @3219 + _ossl_old_crypt @711 + _ossl_old_des_cbc_cksum @2776 + _ossl_old_des_cbc_encrypt @2880 + _ossl_old_des_cfb64_encrypt @3086 + _ossl_old_des_cfb_encrypt @2964 + _ossl_old_des_crypt @2654 + _ossl_old_des_decrypt3 @2705 + _ossl_old_des_ecb3_encrypt @2854 + _ossl_old_des_ecb_encrypt @3163 + _ossl_old_des_ede3_cbc_encrypt @2729 + _ossl_old_des_ede3_cfb64_encrypt @2786 + _ossl_old_des_ede3_ofb64_encrypt @3012 + _ossl_old_des_enc_read @2680 + _ossl_old_des_enc_write @3022 + _ossl_old_des_encrypt2 @2998 + _ossl_old_des_encrypt3 @2999 + _ossl_old_des_encrypt @2570 + _ossl_old_des_fcrypt @2835 + _ossl_old_des_is_weak_key @2576 + _ossl_old_des_key_sched @2666 + _ossl_old_des_ncbc_encrypt @3037 + _ossl_old_des_ofb64_encrypt @2673 + _ossl_old_des_ofb_encrypt @3088 + _ossl_old_des_options @2612 + _ossl_old_des_pcbc_encrypt @3056 + _ossl_old_des_quad_cksum @2988 + _ossl_old_des_random_key @2566 + _ossl_old_des_random_seed @803 + _ossl_old_des_read_2passwords @804 + _ossl_old_des_read_password @805 + _ossl_old_des_read_pw @806 + _ossl_old_des_read_pw_string @807 + _ossl_old_des_set_key @3065 + _ossl_old_des_set_odd_parity @2817 + _ossl_old_des_string_to_2keys @2725 + _ossl_old_des_string_to_key @2808 + _ossl_old_des_xcbc_encrypt @3159 + _shadow_DES_check_key @3146 + _shadow_DES_rw_mode @2581 + a2d_ASN1_OBJECT @699 + a2i_ASN1_ENUMERATED @1210 + a2i_ASN1_INTEGER @700 + a2i_ASN1_STRING @701 + a2i_GENERAL_NAME @4472 + a2i_IPADDRESS @3375 + a2i_IPADDRESS_NC @3732 + a2i_ipadd @3813 + asn1_Finish @702 + asn1_GetSequence @703 + asn1_add_error @1091 + asn1_const_Finish @3700 + asn1_do_adb @2582 + asn1_do_lock @3059 + asn1_enc_free @2993 + asn1_enc_init @3041 + asn1_enc_restore @2891 + asn1_enc_save @3054 + asn1_ex_c2i @2888 + asn1_ex_i2c @2663 + asn1_get_choice_selector @3071 + asn1_get_field_ptr @3125 + asn1_set_choice_selector @3122 + b2i_PVK_bio @4250 + b2i_PrivateKey @4343 + b2i_PrivateKey_bio @4354 + b2i_PublicKey @4290 + b2i_PublicKey_bio @4172 + bn_add_words @1039 + bn_div_words @704 + bn_dup_expand @2920 + bn_expand2 @705 + bn_mul_add_words @706 + bn_mul_words @707 + bn_sqr_words @710 + bn_sub_words @1116 + c2i_ASN1_BIT_STRING @2421 + c2i_ASN1_INTEGER @2424 + c2i_ASN1_OBJECT @2428 + check_defer @4522 + d2i_ACCESS_DESCRIPTION @1927 + d2i_ASN1_BIT_STRING @712 + d2i_ASN1_BMPSTRING @1092 + d2i_ASN1_BOOLEAN @713 + d2i_ASN1_ENUMERATED @1204 + d2i_ASN1_GENERALIZEDTIME @1190 + d2i_ASN1_GENERALSTRING @2822 + d2i_ASN1_IA5STRING @715 + d2i_ASN1_INTEGER @716 + d2i_ASN1_NULL @2169 + d2i_ASN1_OBJECT @717 + d2i_ASN1_OCTET_STRING @718 + d2i_ASN1_PRINTABLESTRING @720 + d2i_ASN1_PRINTABLE @719 + d2i_ASN1_SEQUENCE_ANY @4510 + d2i_ASN1_SET @721 + d2i_ASN1_SET_ANY @4507 + d2i_ASN1_T61STRING @722 + d2i_ASN1_TIME @1191 + d2i_ASN1_TYPE @723 + d2i_ASN1_UINTEGER @1652 + d2i_ASN1_UNIVERSALSTRING @3235 + d2i_ASN1_UTCTIME @724 + d2i_ASN1_UTF8STRING @1342 + d2i_ASN1_VISIBLESTRING @1340 + d2i_ASN1_bytes @725 + d2i_ASN1_type_bytes @726 + d2i_AUTHORITY_INFO_ACCESS @1918 + d2i_AUTHORITY_KEYID @1255 + d2i_AutoPrivateKey @2186 + d2i_BASIC_CONSTRAINTS @1192 + d2i_CERTIFICATEPOLICIES @1487 + d2i_CMS_ContentInfo @3985 + d2i_CMS_ReceiptRequest @3970 + d2i_CMS_bio @3946 + d2i_CRL_DIST_POINTS @1540 + d2i_DHparams @727 + d2i_DIRECTORYSTRING @1344 + d2i_DISPLAYTEXT @1346 + d2i_DIST_POINT @1543 + d2i_DIST_POINT_NAME @1548 + d2i_DSAPrivateKey @728 + d2i_DSAPrivateKey_bio @729 + d2i_DSAPrivateKey_fp @730 + d2i_DSAPublicKey @731 + d2i_DSA_PUBKEY @2050 + d2i_DSA_PUBKEY_bio @2093 + d2i_DSA_PUBKEY_fp @2041 + d2i_DSA_SIG @1337 + d2i_DSAparams @732 + d2i_ECDSA_SIG @3717 + d2i_ECPKParameters @3475 + d2i_ECParameters @3733 + d2i_ECPrivateKey @3563 + d2i_ECPrivateKey_bio @3556 + d2i_ECPrivateKey_fp @3673 + d2i_EC_PUBKEY @3425 + d2i_EC_PUBKEY_bio @3707 + d2i_EC_PUBKEY_fp @3751 + d2i_EDIPARTYNAME @2814 + d2i_ESS_CERT_ID @4512 + d2i_ESS_ISSUER_SERIAL @4265 + d2i_ESS_SIGNING_CERT @4435 + d2i_EXTENDED_KEY_USAGE @2674 + d2i_GENERAL_NAMES @1217 + d2i_GENERAL_NAME @1212 + d2i_ISSUING_DIST_POINT @4286 + d2i_KRB5_APREQBODY @2677 + d2i_KRB5_APREQ @2588 + d2i_KRB5_AUTHDATA @2685 + d2i_KRB5_AUTHENTBODY @2840 + d2i_KRB5_AUTHENT @2573 + d2i_KRB5_CHECKSUM @2771 + d2i_KRB5_ENCDATA @3046 + d2i_KRB5_ENCKEY @2901 + d2i_KRB5_PRINCNAME @2810 + d2i_KRB5_TICKET @2819 + d2i_KRB5_TKTBODY @2952 + d2i_NETSCAPE_CERT_SEQUENCE @1193 + d2i_NETSCAPE_SPKAC @733 + d2i_NETSCAPE_SPKI @734 + d2i_NETSCAPE_X509 @4180 + d2i_NOTICEREF @1502 + d2i_Netscape_RSA @735 + d2i_OCSP_BASICRESP @2530 + d2i_OCSP_CERTID @2867 + d2i_OCSP_CERTSTATUS @2542 + d2i_OCSP_CRLID @2768 + d2i_OCSP_ONEREQ @3152 + d2i_OCSP_REQINFO @3147 + d2i_OCSP_REQUEST @2648 + d2i_OCSP_RESPBYTES @2535 + d2i_OCSP_RESPDATA @2969 + d2i_OCSP_RESPID @2702 + d2i_OCSP_RESPONSE @3020 + d2i_OCSP_REVOKEDINFO @2599 + d2i_OCSP_SERVICELOC @2815 + d2i_OCSP_SIGNATURE @2873 + d2i_OCSP_SINGLERESP @2670 + d2i_OTHERNAME @2096 + d2i_PBE2PARAM @1403 + d2i_PBEPARAM @1312 + d2i_PBKDF2PARAM @1399 + d2i_PKCS12 @1289 + d2i_PKCS12_BAGS @1286 + d2i_PKCS12_MAC_DATA @1294 + d2i_PKCS12_SAFEBAG @1298 + d2i_PKCS12_bio @1308 + d2i_PKCS12_fp @1309 + d2i_PKCS7 @736 + d2i_PKCS7_DIGEST @737 + d2i_PKCS7_ENCRYPT @738 + d2i_PKCS7_ENC_CONTENT @739 + d2i_PKCS7_ENVELOPE @740 + d2i_PKCS7_ISSUER_AND_SERIAL @741 + d2i_PKCS7_RECIP_INFO @742 + d2i_PKCS7_SIGNED @743 + d2i_PKCS7_SIGNER_INFO @744 + d2i_PKCS7_SIGN_ENVELOPE @745 + d2i_PKCS7_bio @746 + d2i_PKCS7_fp @747 + d2i_PKCS8PrivateKey_bio @2167 + d2i_PKCS8PrivateKey_fp @2175 + d2i_PKCS8_PRIV_KEY_INFO @1316 + d2i_PKCS8_PRIV_KEY_INFO_bio @1783 + d2i_PKCS8_PRIV_KEY_INFO_fp @1780 + d2i_PKCS8_bio @1779 + d2i_PKCS8_fp @1784 + d2i_PKEY_USAGE_PERIOD @1233 + d2i_POLICYINFO @1490 + d2i_POLICYQUALINFO @1494 + d2i_PROXY_CERT_INFO_EXTENSION @3300 + d2i_PROXY_POLICY @3304 + d2i_PUBKEY @2054 + d2i_PUBKEY_bio @2441 + d2i_PUBKEY_fp @2445 + d2i_PrivateKey @748 + d2i_PrivateKey_bio @2181 + d2i_PrivateKey_fp @2182 + d2i_PublicKey @749 + d2i_RSAPrivateKey @750 + d2i_RSAPrivateKey_bio @751 + d2i_RSAPrivateKey_fp @752 + d2i_RSAPublicKey @753 + d2i_RSAPublicKey_bio @945 + d2i_RSAPublicKey_fp @952 + d2i_RSA_NET @2408 + d2i_RSA_PUBKEY @2044 + d2i_RSA_PUBKEY_bio @2053 + d2i_RSA_PUBKEY_fp @1964 + d2i_SXNETID @1330 + d2i_SXNET @1326 + d2i_TS_ACCURACY @4194 + d2i_TS_MSG_IMPRINT @4235 + d2i_TS_MSG_IMPRINT_bio @4170 + d2i_TS_MSG_IMPRINT_fp @4432 + d2i_TS_REQ @4382 + d2i_TS_REQ_bio @4453 + d2i_TS_REQ_fp @4349 + d2i_TS_RESP @4311 + d2i_TS_RESP_bio @4223 + d2i_TS_RESP_fp @4139 + d2i_TS_STATUS_INFO @4456 + d2i_TS_TST_INFO @4221 + d2i_TS_TST_INFO_bio @4336 + d2i_TS_TST_INFO_fp @4306 + d2i_USERNOTICE @1498 + d2i_X509 @754 + d2i_X509_ALGORS @3937 + d2i_X509_ALGOR @755 + d2i_X509_ATTRIBUTE @756 + d2i_X509_AUX @1980 + d2i_X509_CERT_AUX @2115 + d2i_X509_CERT_PAIR @3698 + d2i_X509_CINF @757 + d2i_X509_CRL @758 + d2i_X509_CRL_INFO @759 + d2i_X509_CRL_bio @760 + d2i_X509_CRL_fp @761 + d2i_X509_EXTENSIONS @3925 + d2i_X509_EXTENSION @762 + d2i_X509_NAME @763 + d2i_X509_NAME_ENTRY @764 + d2i_X509_PKEY @765 + d2i_X509_PUBKEY @766 + d2i_X509_REQ @767 + d2i_X509_REQ_INFO @768 + d2i_X509_REQ_bio @769 + d2i_X509_REQ_fp @770 + d2i_X509_REVOKED @771 + d2i_X509_SIG @772 + d2i_X509_VAL @773 + d2i_X509_bio @774 + d2i_X509_fp @775 + get_rfc2409_prime_1024 @3773 + get_rfc2409_prime_768 @3780 + get_rfc3526_prime_1536 @3777 + get_rfc3526_prime_2048 @3775 + get_rfc3526_prime_3072 @3778 + get_rfc3526_prime_4096 @3779 + get_rfc3526_prime_6144 @3776 + get_rfc3526_prime_8192 @3771 + hex_to_string @1223 + i2a_ACCESS_DESCRIPTION @3110 + i2a_ASN1_ENUMERATED @1209 + i2a_ASN1_INTEGER @815 + i2a_ASN1_OBJECT @816 + i2a_ASN1_STRING @817 + i2b_PVK_bio @4247 + i2b_PrivateKey_bio @4288 + i2b_PublicKey_bio @4318 + i2c_ASN1_BIT_STRING @2422 + i2c_ASN1_INTEGER @2425 + i2d_ACCESS_DESCRIPTION @2077 + i2d_ASN1_BIT_STRING @818 + i2d_ASN1_BMPSTRING @1093 + i2d_ASN1_BOOLEAN @819 + i2d_ASN1_ENUMERATED @1203 + i2d_ASN1_GENERALIZEDTIME @1197 + i2d_ASN1_GENERALSTRING @2560 + i2d_ASN1_IA5STRING @821 + i2d_ASN1_INTEGER @822 + i2d_ASN1_NULL @2173 + i2d_ASN1_OBJECT @823 + i2d_ASN1_OCTET_STRING @824 + i2d_ASN1_PRINTABLESTRING @2149 + i2d_ASN1_PRINTABLE @825 + i2d_ASN1_SEQUENCE_ANY @4169 + i2d_ASN1_SET @826 + i2d_ASN1_SET_ANY @4197 + i2d_ASN1_T61STRING @3175 + i2d_ASN1_TIME @1198 + i2d_ASN1_TYPE @827 + i2d_ASN1_UNIVERSALSTRING @3232 + i2d_ASN1_UTCTIME @828 + i2d_ASN1_UTF8STRING @1341 + i2d_ASN1_VISIBLESTRING @1339 + i2d_ASN1_bio_stream @4500 + i2d_ASN1_bytes @829 + i2d_AUTHORITY_INFO_ACCESS @2062 + i2d_AUTHORITY_KEYID @1254 + i2d_BASIC_CONSTRAINTS @1199 + i2d_CERTIFICATEPOLICIES @1484 + i2d_CMS_ContentInfo @3944 + i2d_CMS_ReceiptRequest @4033 + i2d_CMS_bio @3976 + i2d_CMS_bio_stream @4208 + i2d_CRL_DIST_POINTS @1537 + i2d_DHparams @830 + i2d_DIRECTORYSTRING @1343 + i2d_DISPLAYTEXT @1345 + i2d_DIST_POINT @1541 + i2d_DIST_POINT_NAME @1545 + i2d_DSAPrivateKey @831 + i2d_DSAPrivateKey_bio @832 + i2d_DSAPrivateKey_fp @833 + i2d_DSAPublicKey @834 + i2d_DSA_PUBKEY @1981 + i2d_DSA_PUBKEY_bio @2014 + i2d_DSA_PUBKEY_fp @1971 + i2d_DSA_SIG @1338 + i2d_DSAparams @835 + i2d_ECDSA_SIG @3619 + i2d_ECPKParameters @3473 + i2d_ECParameters @3472 + i2d_ECPrivateKey @3357 + i2d_ECPrivateKey_bio @3452 + i2d_ECPrivateKey_fp @3655 + i2d_EC_PUBKEY @3521 + i2d_EC_PUBKEY_bio @3585 + i2d_EC_PUBKEY_fp @3701 + i2d_EDIPARTYNAME @2908 + i2d_ESS_CERT_ID @4364 + i2d_ESS_ISSUER_SERIAL @4351 + i2d_ESS_SIGNING_CERT @4167 + i2d_EXTENDED_KEY_USAGE @3052 + i2d_GENERAL_NAMES @1218 + i2d_GENERAL_NAME @1211 + i2d_ISSUING_DIST_POINT @4216 + i2d_KRB5_APREQBODY @2853 + i2d_KRB5_APREQ @2569 + i2d_KRB5_AUTHDATA @2978 + i2d_KRB5_AUTHENTBODY @3128 + i2d_KRB5_AUTHENT @2668 + i2d_KRB5_CHECKSUM @3072 + i2d_KRB5_ENCDATA @3137 + i2d_KRB5_ENCKEY @3092 + i2d_KRB5_PRINCNAME @2997 + i2d_KRB5_TICKET @3017 + i2d_KRB5_TKTBODY @3038 + i2d_NETSCAPE_CERT_SEQUENCE @1200 + i2d_NETSCAPE_SPKAC @836 + i2d_NETSCAPE_SPKI @837 + i2d_NETSCAPE_X509 @4424 + i2d_NOTICEREF @1500 + i2d_Netscape_RSA @838 + i2d_OCSP_BASICRESP @2744 + i2d_OCSP_CERTID @3068 + i2d_OCSP_CERTSTATUS @2955 + i2d_OCSP_CRLID @2757 + i2d_OCSP_ONEREQ @2709 + i2d_OCSP_REQINFO @2591 + i2d_OCSP_REQUEST @2738 + i2d_OCSP_RESPBYTES @2745 + i2d_OCSP_RESPDATA @2629 + i2d_OCSP_RESPID @2898 + i2d_OCSP_RESPONSE @2682 + i2d_OCSP_REVOKEDINFO @2890 + i2d_OCSP_SERVICELOC @2562 + i2d_OCSP_SIGNATURE @3053 + i2d_OCSP_SINGLERESP @3062 + i2d_OTHERNAME @2015 + i2d_PBE2PARAM @1401 + i2d_PBEPARAM @1310 + i2d_PBKDF2PARAM @1397 + i2d_PKCS12 @1288 + i2d_PKCS12_BAGS @1284 + i2d_PKCS12_MAC_DATA @1292 + i2d_PKCS12_SAFEBAG @1296 + i2d_PKCS12_bio @1306 + i2d_PKCS12_fp @1307 + i2d_PKCS7 @839 + i2d_PKCS7_DIGEST @840 + i2d_PKCS7_ENCRYPT @841 + i2d_PKCS7_ENC_CONTENT @842 + i2d_PKCS7_ENVELOPE @843 + i2d_PKCS7_ISSUER_AND_SERIAL @844 + i2d_PKCS7_NDEF @3569 + i2d_PKCS7_RECIP_INFO @845 + i2d_PKCS7_SIGNED @846 + i2d_PKCS7_SIGNER_INFO @847 + i2d_PKCS7_SIGN_ENVELOPE @848 + i2d_PKCS7_bio @849 + i2d_PKCS7_bio_stream @4333 + i2d_PKCS7_fp @850 + i2d_PKCS8PrivateKeyInfo_bio @2178 + i2d_PKCS8PrivateKeyInfo_fp @2177 + i2d_PKCS8PrivateKey_bio @2171 + i2d_PKCS8PrivateKey_fp @2172 + i2d_PKCS8PrivateKey_nid_bio @2176 + i2d_PKCS8PrivateKey_nid_fp @2174 + i2d_PKCS8_PRIV_KEY_INFO @1314 + i2d_PKCS8_PRIV_KEY_INFO_bio @1792 + i2d_PKCS8_PRIV_KEY_INFO_fp @1791 + i2d_PKCS8_bio @1790 + i2d_PKCS8_fp @1777 + i2d_PKEY_USAGE_PERIOD @1232 + i2d_POLICYINFO @1488 + i2d_POLICYQUALINFO @1492 + i2d_PROXY_CERT_INFO_EXTENSION @3303 + i2d_PROXY_POLICY @3302 + i2d_PUBKEY @1987 + i2d_PUBKEY_bio @2439 + i2d_PUBKEY_fp @2440 + i2d_PrivateKey @851 + i2d_PrivateKey_bio @2183 + i2d_PrivateKey_fp @2180 + i2d_PublicKey @852 + i2d_RSAPrivateKey @853 + i2d_RSAPrivateKey_bio @854 + i2d_RSAPrivateKey_fp @855 + i2d_RSAPublicKey @856 + i2d_RSAPublicKey_bio @946 + i2d_RSAPublicKey_fp @954 + i2d_RSA_NET @2406 + i2d_RSA_PUBKEY @1974 + i2d_RSA_PUBKEY_bio @1985 + i2d_RSA_PUBKEY_fp @2113 + i2d_SXNETID @1329 + i2d_SXNET @1325 + i2d_TS_ACCURACY @4115 + i2d_TS_MSG_IMPRINT @4117 + i2d_TS_MSG_IMPRINT_bio @4278 + i2d_TS_MSG_IMPRINT_fp @4116 + i2d_TS_REQ @4389 + i2d_TS_REQ_bio @4359 + i2d_TS_REQ_fp @4509 + i2d_TS_RESP @4289 + i2d_TS_RESP_bio @4464 + i2d_TS_RESP_fp @4277 + i2d_TS_STATUS_INFO @4441 + i2d_TS_TST_INFO @4120 + i2d_TS_TST_INFO_bio @4156 + i2d_TS_TST_INFO_fp @4132 + i2d_USERNOTICE @1496 + i2d_X509 @857 + i2d_X509_ALGORS @3934 + i2d_X509_ALGOR @858 + i2d_X509_ATTRIBUTE @859 + i2d_X509_AUX @2132 + i2d_X509_CERT_AUX @2028 + i2d_X509_CERT_PAIR @3642 + i2d_X509_CINF @860 + i2d_X509_CRL @861 + i2d_X509_CRL_INFO @862 + i2d_X509_CRL_bio @863 + i2d_X509_CRL_fp @864 + i2d_X509_EXTENSIONS @3922 + i2d_X509_EXTENSION @865 + i2d_X509_NAME @866 + i2d_X509_NAME_ENTRY @867 + i2d_X509_PKEY @868 + i2d_X509_PUBKEY @869 + i2d_X509_REQ @870 + i2d_X509_REQ_INFO @871 + i2d_X509_REQ_bio @872 + i2d_X509_REQ_fp @873 + i2d_X509_REVOKED @874 + i2d_X509_SIG @875 + i2d_X509_VAL @876 + i2d_X509_bio @877 + i2d_X509_fp @878 + i2o_ECPublicKey @3373 + i2s_ASN1_ENUMERATED @1241 + i2s_ASN1_ENUMERATED_TABLE @1242 + i2s_ASN1_INTEGER @1237 + i2s_ASN1_OCTET_STRING @1220 + i2t_ASN1_OBJECT @979 + i2v_ASN1_BIT_STRING @3639 + i2v_GENERAL_NAMES @1219 + i2v_GENERAL_NAME @1230 + idea_cbc_encrypt @879 + idea_cfb64_encrypt @880 + idea_ecb_encrypt @881 + idea_encrypt @882 + idea_ofb64_encrypt @883 + idea_options @884 + idea_set_decrypt_key @885 + idea_set_encrypt_key @886 + lh_delete @887 + lh_doall @888 + lh_doall_arg @889 + lh_free @890 + lh_insert @891 + lh_new @892 + lh_node_stats @893 + lh_node_stats_bio @894 + lh_node_usage_stats @895 + lh_node_usage_stats_bio @896 + lh_num_items @2257 + lh_retrieve @897 + lh_stats @898 + lh_stats_bio @899 + lh_strhash @900 + name_cmp @1239 + o2i_ECPublicKey @3368 + pitem_free @3767 + pitem_new @3365 + pqueue_find @3454 + pqueue_free @3704 + pqueue_insert @3766 + pqueue_iterator @3394 + pqueue_new @3758 + pqueue_next @3754 + pqueue_peek @3460 + pqueue_pop @3647 + pqueue_print @3428 + pqueue_size @4114 + s2i_ASN1_INTEGER @1509 + s2i_ASN1_OCTET_STRING @1221 + sk_delete @901 + sk_delete_ptr @902 + sk_dup @903 + sk_find @904 + sk_find_ex @3544 + sk_free @905 + sk_insert @906 + sk_is_sorted @3285 + sk_new @907 + sk_new_null @2411 + sk_num @1654 + sk_pop @908 + sk_pop_free @909 + sk_push @910 + sk_set @1655 + sk_set_cmp_func @911 + sk_shift @912 + sk_sort @1671 + sk_unshift @913 + sk_value @1653 + sk_zero @914 + string_to_hex @1224 + v2i_ASN1_BIT_STRING @3592 + v2i_GENERAL_NAMES @1236 + v2i_GENERAL_NAME @1231 + v2i_GENERAL_NAME_ex @3612 + diff --git a/libs/win32/openssl/openssl.2008.vcproj b/libs/win32/openssl/openssl.2008.vcproj new file mode 100644 index 0000000..525973c --- /dev/null +++ b/libs/win32/openssl/openssl.2008.vcproj @@ -0,0 +1,585 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="openssl" + ProjectGUID="{25BD39B1-C8BF-4676-A738-9CABD9C6BC79}" + RootNamespace="openssl" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/Gs0" + Optimization="2" + InlineFunctionExpansion="2" + AdditionalIncludeDirectories=""..\..\openssl-1.0.0a\include";"..\..\openssl-1.0.0a"" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;OPENSSL_THREADS;MONOLITH;DSO_WIN32;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_RC5;OPENSSL_NO_MD2;OPENSSL_NO_KRB5;OPENSSL_NO_JPAKE;OPENSSL_NO_STATIC_ENGINE" + StringPooling="true" + MinimalRebuild="true" + BasicRuntimeChecks="0" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="3" + WarnAsError="true" + DebugInformationFormat="3" + DisableSpecificWarnings="4996;4133" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="libeay32.lib ssleay32.lib ws2_32.lib" + LinkIncremental="2" + AdditionalLibraryDirectories=""$(ProjectDir)$(ConfigurationName)"" + GenerateDebugInformation="true" + SubSystem="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="1" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/Gs0" + Optimization="2" + InlineFunctionExpansion="2" + EnableIntrinsicFunctions="true" + AdditionalIncludeDirectories=""..\..\openssl-1.0.0a\include";"..\..\openssl-1.0.0a"" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CONSOLE;OPENSSL_THREADS;MONOLITH;DSO_WIN32;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_RC5;OPENSSL_NO_MD2;OPENSSL_NO_KRB5;OPENSSL_NO_JPAKE;OPENSSL_NO_STATIC_ENGINE" + StringPooling="true" + MinimalRebuild="true" + BasicRuntimeChecks="0" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="3" + WarnAsError="true" + DebugInformationFormat="3" + DisableSpecificWarnings="4996;4133" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="libeay32.lib ssleay32.lib ws2_32.lib" + LinkIncremental="2" + AdditionalLibraryDirectories=""$(ProjectDir)$(ConfigurationName)"" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/Gs0" + Optimization="2" + InlineFunctionExpansion="2" + AdditionalIncludeDirectories=""..\..\openssl-1.0.0a\include";"..\..\openssl-1.0.0a"" + PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;OPENSSL_THREADS;MONOLITH;DSO_WIN32;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_RC5;OPENSSL_NO_MD2;OPENSSL_NO_KRB5;OPENSSL_NO_JPAKE;OPENSSL_NO_STATIC_ENGINE" + StringPooling="true" + MinimalRebuild="true" + BasicRuntimeChecks="0" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3" + DisableSpecificWarnings="4996;4133" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="libeay32.lib ssleay32.lib ws2_32.lib" + LinkIncremental="2" + AdditionalLibraryDirectories=""$(ProjectDir)$(ConfigurationName)"" + GenerateDebugInformation="true" + SubSystem="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="1" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/Gs0" + Optimization="2" + InlineFunctionExpansion="2" + EnableIntrinsicFunctions="true" + AdditionalIncludeDirectories=""..\..\openssl-1.0.0a\include";"..\..\openssl-1.0.0a"" + PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;_CONSOLE;OPENSSL_THREADS;MONOLITH;DSO_WIN32;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_RC5;OPENSSL_NO_MD2;OPENSSL_NO_KRB5;OPENSSL_NO_JPAKE;OPENSSL_NO_STATIC_ENGINE" + StringPooling="true" + MinimalRebuild="true" + BasicRuntimeChecks="0" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3" + DisableSpecificWarnings="4996;4133" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="libeay32.lib ssleay32.lib ws2_32.lib" + LinkIncremental="2" + AdditionalLibraryDirectories=""$(ProjectDir)$(ConfigurationName)"" + GenerateDebugInformation="true" + SubSystem="1" + OptimizeReferences="2" + EnableCOMDATFolding="2" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <Filter + Name="apps" + > + <File + RelativePath="..\..\openssl-1.0.0a\apps\app_rand.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\apps.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\asn1pars.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\ca.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\ciphers.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\cms.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\crl.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\crl2p7.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\dgst.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\dh.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\dhparam.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\dsa.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\dsaparam.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\ec.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\ecparam.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\enc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\engine.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\errstr.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\gendh.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\gendsa.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\genpkey.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\genrsa.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\nseq.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\ocsp.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\openssl.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\passwd.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\pkcs12.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\pkcs7.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\pkcs8.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\pkey.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\pkeyparam.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\pkeyutl.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\prime.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\rand.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\req.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\rsa.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\rsautl.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\s_cb.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\s_client.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\s_server.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\s_socket.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\s_time.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\sess_id.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\smime.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\speed.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\spkac.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\ts.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\verify.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\version.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\winrand.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\apps\x509.c" + > + </File> + </Filter> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <Filter + Name="apps" + > + <File + RelativePath="..\..\openssl-1.0.0a\apps\apps.h" + > + </File> + </Filter> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/libs/win32/openssl/opensslconf.h b/libs/win32/openssl/opensslconf.h new file mode 100644 index 0000000..1ebd3ef --- /dev/null +++ b/libs/win32/openssl/opensslconf.h @@ -0,0 +1,224 @@ +/* opensslconf.h */ +/* WARNING: Generated automatically from opensslconf.h.in by Configure. */ + +/* OpenSSL was configured with the following options: */ +#ifndef OPENSSL_SYSNAME_WIN32 +# define OPENSSL_SYSNAME_WIN32 +#endif +#ifndef OPENSSL_DOING_MAKEDEPEND + + +#ifndef OPENSSL_NO_GMP +# define OPENSSL_NO_GMP +#endif +#ifndef OPENSSL_NO_JPAKE +# define OPENSSL_NO_JPAKE +#endif +#ifndef OPENSSL_NO_KRB5 +# define OPENSSL_NO_KRB5 +#endif +#ifndef OPENSSL_NO_MD2 +# define OPENSSL_NO_MD2 +#endif +#ifndef OPENSSL_NO_RC5 +# define OPENSSL_NO_RC5 +#endif +#ifndef OPENSSL_NO_RFC3779 +# define OPENSSL_NO_RFC3779 +#endif +#ifndef OPENSSL_NO_STORE +# define OPENSSL_NO_STORE +#endif + +#endif /* OPENSSL_DOING_MAKEDEPEND */ + +#ifndef OPENSSL_THREADS +# define OPENSSL_THREADS +#endif +#ifndef OPENSSL_NO_ASM +# define OPENSSL_NO_ASM +#endif + +/* The OPENSSL_NO_* macros are also defined as NO_* if the application + asks for it. This is a transient feature that is provided for those + who haven't had the time to do the appropriate changes in their + applications. */ +#ifdef OPENSSL_ALGORITHM_DEFINES +# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP) +# define NO_GMP +# endif +# if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE) +# define NO_JPAKE +# endif +# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5) +# define NO_KRB5 +# endif +# if defined(OPENSSL_NO_MD2) && !defined(NO_MD2) +# define NO_MD2 +# endif +# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5) +# define NO_RC5 +# endif +# if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779) +# define NO_RFC3779 +# endif +# if defined(OPENSSL_NO_STORE) && !defined(NO_STORE) +# define NO_STORE +# endif +#endif + +/* crypto/opensslconf.h.in */ + +/* Generate 80386 code? */ +#undef I386_ONLY + +#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */ +#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) +#define ENGINESDIR "/usr/local/ssl/lib/engines" +#define OPENSSLDIR "/usr/local/ssl" +#endif +#endif + +#undef OPENSSL_UNISTD +#define OPENSSL_UNISTD <unistd.h> + +#undef OPENSSL_EXPORT_VAR_AS_FUNCTION +#define OPENSSL_EXPORT_VAR_AS_FUNCTION + +#if defined(HEADER_IDEA_H) && !defined(IDEA_INT) +#define IDEA_INT unsigned int +#endif + +#if defined(HEADER_MD2_H) && !defined(MD2_INT) +#define MD2_INT unsigned int +#endif + +#if defined(HEADER_RC2_H) && !defined(RC2_INT) +/* I need to put in a mod for the alpha - eay */ +#define RC2_INT unsigned int +#endif + +#if defined(HEADER_RC4_H) +#if !defined(RC4_INT) +/* using int types make the structure larger but make the code faster + * on most boxes I have tested - up to %20 faster. */ +/* + * I don't know what does "most" mean, but declaring "int" is a must on: + * - Intel P6 because partial register stalls are very expensive; + * - elder Alpha because it lacks byte load/store instructions; + */ +#define RC4_INT unsigned int +#endif +#if !defined(RC4_CHUNK) +/* + * This enables code handling data aligned at natural CPU word + * boundary. See crypto/rc4/rc4_enc.c for further details. + */ +#undef RC4_CHUNK +#endif +#endif + +#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG) +/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a + * %20 speed up (longs are 8 bytes, int's are 4). */ +#ifndef DES_LONG +#define DES_LONG unsigned long +#endif +#endif + +#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) +#define CONFIG_HEADER_BN_H +#define BN_LLONG + +/* Should we define BN_DIV2W here? */ + +/* Only one for the following should be defined */ +#undef SIXTY_FOUR_BIT_LONG +#undef SIXTY_FOUR_BIT +#define THIRTY_TWO_BIT +#endif + +#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H) +#define CONFIG_HEADER_RC4_LOCL_H +/* if this is defined data[i] is used instead of *data, this is a %20 + * speedup on x86 */ +#define RC4_INDEX +#endif + +#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) +#define CONFIG_HEADER_BF_LOCL_H +#undef BF_PTR +#endif /* HEADER_BF_LOCL_H */ + +#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) +#define CONFIG_HEADER_DES_LOCL_H +#ifndef DES_DEFAULT_OPTIONS +/* the following is tweaked from a config script, that is why it is a + * protected undef/define */ +#ifndef DES_PTR +#undef DES_PTR +#endif + +/* This helps C compiler generate the correct code for multiple functional + * units. It reduces register dependancies at the expense of 2 more + * registers */ +#ifndef DES_RISC1 +#undef DES_RISC1 +#endif + +#ifndef DES_RISC2 +#undef DES_RISC2 +#endif + +#if defined(DES_RISC1) && defined(DES_RISC2) +YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! +#endif + +/* Unroll the inner loop, this sometimes helps, sometimes hinders. + * Very mucy CPU dependant */ +#ifndef DES_UNROLL +#undef DES_UNROLL +#endif + +/* These default values were supplied by + * Peter Gutman <pgut001@cs.auckland.ac.nz> + * They are only used if nothing else has been defined */ +#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) +/* Special defines which change the way the code is built depending on the + CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find + even newer MIPS CPU's, but at the moment one size fits all for + optimization options. Older Sparc's work better with only UNROLL, but + there's no way to tell at compile time what it is you're running on */ + +#if defined( sun ) /* Newer Sparc's */ +# define DES_PTR +# define DES_RISC1 +# define DES_UNROLL +#elif defined( __ultrix ) /* Older MIPS */ +# define DES_PTR +# define DES_RISC2 +# define DES_UNROLL +#elif defined( __osf1__ ) /* Alpha */ +# define DES_PTR +# define DES_RISC2 +#elif defined ( _AIX ) /* RS6000 */ + /* Unknown */ +#elif defined( __hpux ) /* HP-PA */ + /* Unknown */ +#elif defined( __aux ) /* 68K */ + /* Unknown */ +#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ +# define DES_UNROLL +#elif defined( __sgi ) /* Newer MIPS */ +# define DES_PTR +# define DES_RISC2 +# define DES_UNROLL +#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ +# define DES_PTR +# define DES_RISC1 +# define DES_UNROLL +#endif /* Systems-specific speed defines */ +#endif + +#endif /* DES_DEFAULT_OPTIONS */ +#endif /* HEADER_DES_LOCL_H */ diff --git a/libs/win32/openssl/ssleay32.2008.vcproj b/libs/win32/openssl/ssleay32.2008.vcproj new file mode 100644 index 0000000..c834a89 --- /dev/null +++ b/libs/win32/openssl/ssleay32.2008.vcproj @@ -0,0 +1,563 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9.00" + Name="ssleay32" + ProjectGUID="{B4B62169-5AD4-4559-8707-3D933AC5DB39}" + RootNamespace="ssleay32" + Keyword="Win32Proj" + TargetFrameworkVersion="196613" + > + <Platforms> + <Platform + Name="Win32" + /> + <Platform + Name="x64" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="2" + CharacterSet="1" + ManagedExtensions="0" + > + <Tool + Name="VCPreBuildEventTool" + CommandLine="copy /Y $(ProjectDir)ssleay32.def $(ProjectDir)..\..\openssl-1.0.0a\ssleay32.def" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/Gs0" + Optimization="2" + InlineFunctionExpansion="2" + AdditionalIncludeDirectories=""..\..\openssl-1.0.0a\include";"..\..\openssl-1.0.0a\crypto";"..\..\openssl-1.0.0a"" + PreprocessorDefinitions="WIN32;_DEBUG;DSO_WIN32;OPENSSL_THREADS;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_RC5;OPENSSL_NO_MD2;OPENSSL_NO_KRB5;OPENSSL_NO_JPAKE;OPENSSL_NO_STATIC_ENGINE;_WINDLL;OPENSSL_BUILD_SHLIBSSL" + StringPooling="true" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="3" + WarnAsError="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="libeay32.lib" + LinkIncremental="2" + AdditionalLibraryDirectories=""$(ProjectDir)$(ConfigurationName)"" + ModuleDefinitionFile="ssleay32.def" + GenerateDebugInformation="true" + AssemblyDebug="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)$(ConfigurationName)" + IntermediateDirectory="$(ConfigurationName)" + ConfigurationType="2" + CharacterSet="1" + ManagedExtensions="0" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + CommandLine="copy /Y $(ProjectDir)ssleay32.def $(ProjectDir)..\..\openssl-1.0.0a\ssleay32.def" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/Gs0" + Optimization="2" + InlineFunctionExpansion="2" + AdditionalIncludeDirectories=""..\..\openssl-1.0.0a\include";"..\..\openssl-1.0.0a\crypto";"..\..\openssl-1.0.0a"" + PreprocessorDefinitions="WIN32;NDEBUG;DSO_WIN32;OPENSSL_THREADS;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_RC5;OPENSSL_NO_MD2;OPENSSL_NO_KRB5;OPENSSL_NO_JPAKE;OPENSSL_NO_STATIC_ENGINE;_WINDLL;OPENSSL_BUILD_SHLIBSSL" + StringPooling="true" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="3" + WarnAsError="true" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="libeay32.lib" + LinkIncremental="2" + AdditionalLibraryDirectories="$(ProjectDir)$(ConfigurationName)" + ModuleDefinitionFile="ssleay32.def" + GenerateDebugInformation="true" + AssemblyDebug="1" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="2" + CharacterSet="1" + ManagedExtensions="0" + > + <Tool + Name="VCPreBuildEventTool" + CommandLine="copy /Y $(ProjectDir)ssleay32.def $(ProjectDir)..\..\openssl-1.0.0a\ssleay32.def" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/Gs0" + Optimization="2" + InlineFunctionExpansion="2" + AdditionalIncludeDirectories=""..\..\openssl-1.0.0a\include";"..\..\openssl-1.0.0a\crypto";"..\..\openssl-1.0.0a"" + PreprocessorDefinitions="WIN32;_DEBUG;DSO_WIN32;OPENSSL_THREADS;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_RC5;OPENSSL_NO_MD2;OPENSSL_NO_KRB5;OPENSSL_NO_JPAKE;OPENSSL_NO_STATIC_ENGINE;_WINDLL;OPENSSL_BUILD_SHLIBSSL" + StringPooling="true" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="libeay32.lib" + LinkIncremental="2" + AdditionalLibraryDirectories=""$(ProjectDir)$(ConfigurationName)"" + ModuleDefinitionFile="ssleay32.def" + GenerateDebugInformation="true" + AssemblyDebug="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|x64" + OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" + IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" + ConfigurationType="2" + CharacterSet="1" + ManagedExtensions="0" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + CommandLine="copy /Y $(ProjectDir)ssleay32.def $(ProjectDir)..\..\openssl-1.0.0a\ssleay32.def" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + TargetEnvironment="3" + /> + <Tool + Name="VCCLCompilerTool" + AdditionalOptions="/Gs0" + Optimization="2" + InlineFunctionExpansion="2" + AdditionalIncludeDirectories=""..\..\openssl-1.0.0a\include";"..\..\openssl-1.0.0a\crypto";"..\..\openssl-1.0.0a"" + PreprocessorDefinitions="WIN32;NDEBUG;DSO_WIN32;OPENSSL_THREADS;OPENSSL_SYSNAME_WIN32;WIN32_LEAN_AND_MEAN;L_ENDIAN;_CRT_SECURE_NO_DEPRECATE;OPENSSL_USE_APPLINK;OPENSSL_NO_RC5;OPENSSL_NO_MD2;OPENSSL_NO_KRB5;OPENSSL_NO_JPAKE;OPENSSL_NO_STATIC_ENGINE;_WINDLL;OPENSSL_BUILD_SHLIBSSL" + StringPooling="true" + RuntimeLibrary="2" + EnableFunctionLevelLinking="true" + UsePrecompiledHeader="0" + WarningLevel="3" + DebugInformationFormat="3" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="libeay32.lib" + LinkIncremental="2" + AdditionalLibraryDirectories="$(ProjectDir)$(ConfigurationName)" + ModuleDefinitionFile="ssleay32.def" + GenerateDebugInformation="true" + AssemblyDebug="1" + TargetMachine="17" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <Filter + Name="ssl" + > + <File + RelativePath="..\..\openssl-1.0.0a\ssl\bio_ssl.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\d1_both.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\d1_clnt.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\d1_enc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\d1_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\d1_meth.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\d1_pkt.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\d1_srvr.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\kssl.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\s23_clnt.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\s23_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\s23_meth.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\s23_pkt.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\s23_srvr.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\s2_clnt.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\s2_enc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\s2_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\s2_meth.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\s2_pkt.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\s2_srvr.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\s3_both.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\s3_clnt.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\s3_enc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\s3_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\s3_meth.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\s3_pkt.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\s3_srvr.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\ssl_algs.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\ssl_asn1.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\ssl_cert.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\ssl_ciph.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\ssl_err.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\ssl_err2.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\ssl_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\ssl_rsa.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\ssl_sess.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\ssl_stat.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\ssl_txt.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\t1_clnt.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\t1_enc.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\t1_lib.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\t1_meth.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\t1_reneg.c" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\ssl\t1_srvr.c" + > + </File> + </Filter> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <Filter + Name="crypto" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\cryptlib.h" + > + </File> + <File + RelativePath="..\..\openssl-1.0.0a\crypto\o_dir.h" + > + </File> + <Filter + Name="evp" + > + <File + RelativePath="..\..\openssl-1.0.0a\crypto\evp\evp_locl.h" + > + </File> + </Filter> + </Filter> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/libs/win32/openssl/ssleay32.def b/libs/win32/openssl/ssleay32.def new file mode 100644 index 0000000..f0bea62 --- /dev/null +++ b/libs/win32/openssl/ssleay32.def @@ -0,0 +1,243 @@ +; +; Definition file for the DLL version of the SSLEAY library from OpenSSL +; + +LIBRARY SSLEAY32 + +EXPORTS + BIO_f_ssl @121 + BIO_new_buffer_ssl_connect @173 + BIO_new_ssl @122 + BIO_new_ssl_connect @174 + BIO_ssl_copy_session_id @124 + BIO_ssl_shutdown @131 + DTLSv1_client_method @268 + DTLSv1_method @273 + DTLSv1_server_method @275 + ERR_load_SSL_strings @1 + PEM_read_SSL_SESSION @301 + PEM_read_bio_SSL_SESSION @302 + PEM_write_SSL_SESSION @305 + PEM_write_bio_SSL_SESSION @296 + SSL_CIPHER_description @2 + SSL_CIPHER_get_bits @128 + SSL_CIPHER_get_name @130 + SSL_CIPHER_get_version @129 + SSL_COMP_add_compression_method @184 + SSL_COMP_get_compression_methods @276 + SSL_COMP_get_name @271 + SSL_CTX_add_client_CA @3 + SSL_CTX_add_session @4 + SSL_CTX_callback_ctrl @243 + SSL_CTX_check_private_key @5 + SSL_CTX_ctrl @6 + SSL_CTX_flush_sessions @7 + SSL_CTX_free @8 + SSL_CTX_get_cert_store @180 + SSL_CTX_get_client_CA_list @9 + SSL_CTX_get_client_cert_cb @288 + SSL_CTX_get_ex_data @138 + SSL_CTX_get_ex_new_index @167 + SSL_CTX_get_info_callback @282 + SSL_CTX_get_quiet_shutdown @140 + SSL_CTX_get_timeout @179 + SSL_CTX_get_verify_callback @10 + SSL_CTX_get_verify_depth @228 + SSL_CTX_get_verify_mode @11 + SSL_CTX_load_verify_locations @141 + SSL_CTX_new @12 + SSL_CTX_remove_session @13 + SSL_CTX_sess_get_get_cb @279 + SSL_CTX_sess_get_new_cb @287 + SSL_CTX_sess_get_remove_cb @289 + SSL_CTX_sess_set_get_cb @280 + SSL_CTX_sess_set_new_cb @278 + SSL_CTX_sess_set_remove_cb @285 + SSL_CTX_sessions @245 + SSL_CTX_set1_param @310 + SSL_CTX_set_cert_store @181 + SSL_CTX_set_cert_verify_callback @232 + SSL_CTX_set_cipher_list @15 + SSL_CTX_set_client_CA_list @16 + SSL_CTX_set_client_cert_cb @284 + SSL_CTX_set_client_cert_engine @293 + SSL_CTX_set_cookie_generate_cb @283 + SSL_CTX_set_cookie_verify_cb @281 + SSL_CTX_set_default_passwd_cb @17 + SSL_CTX_set_default_passwd_cb_userdata @235 + SSL_CTX_set_default_verify_paths @142 + SSL_CTX_set_ex_data @143 + SSL_CTX_set_generate_session_id @264 + SSL_CTX_set_info_callback @286 + SSL_CTX_set_msg_callback @266 + SSL_CTX_set_psk_client_callback @295 + SSL_CTX_set_psk_server_callback @303 + SSL_CTX_set_purpose @238 + SSL_CTX_set_quiet_shutdown @145 + SSL_CTX_set_session_id_context @231 + SSL_CTX_set_ssl_version @19 + SSL_CTX_set_timeout @178 + SSL_CTX_set_tmp_dh_callback @176 + SSL_CTX_set_tmp_ecdh_callback @269 + SSL_CTX_set_tmp_rsa_callback @177 + SSL_CTX_set_trust @237 + SSL_CTX_set_verify @21 + SSL_CTX_set_verify_depth @225 + SSL_CTX_use_PrivateKey @22 + SSL_CTX_use_PrivateKey_ASN1 @23 + SSL_CTX_use_PrivateKey_file @24 + SSL_CTX_use_RSAPrivateKey @25 + SSL_CTX_use_RSAPrivateKey_ASN1 @26 + SSL_CTX_use_RSAPrivateKey_file @27 + SSL_CTX_use_certificate @28 + SSL_CTX_use_certificate_ASN1 @29 + SSL_CTX_use_certificate_chain_file @222 + SSL_CTX_use_certificate_file @30 + SSL_CTX_use_psk_identity_hint @294 + SSL_SESSION_free @31 + SSL_SESSION_get_ex_data @146 + SSL_SESSION_get_ex_new_index @168 + SSL_SESSION_get_id @277 + SSL_SESSION_get_time @134 + SSL_SESSION_get_timeout @136 + SSL_SESSION_new @32 + SSL_SESSION_print @33 + SSL_SESSION_print_fp @34 + SSL_SESSION_set_ex_data @148 + SSL_SESSION_set_time @135 + SSL_SESSION_set_timeout @137 + SSL_accept @35 + SSL_add_client_CA @36 + SSL_add_dir_cert_subjects_to_stack @188 + SSL_add_file_cert_subjects_to_stack @185 + SSL_alert_desc_string @37 + SSL_alert_desc_string_long @38 + SSL_alert_type_string @39 + SSL_alert_type_string_long @40 + SSL_callback_ctrl @244 + SSL_check_private_key @41 + SSL_clear @42 + SSL_connect @43 + SSL_copy_session_id @44 + SSL_ctrl @45 + SSL_do_handshake @125 + SSL_dup @46 + SSL_dup_CA_list @47 + SSL_free @48 + SSL_get1_session @242 + SSL_get_SSL_CTX @150 + SSL_get_certificate @49 + SSL_get_cipher_list @52 + SSL_get_ciphers @55 + SSL_get_client_CA_list @56 + SSL_get_current_cipher @127 + SSL_get_current_compression @272 + SSL_get_current_expansion @274 + SSL_get_default_timeout @57 + SSL_get_error @58 + SSL_get_ex_data @151 + SSL_get_ex_data_X509_STORE_CTX_idx @175 + SSL_get_ex_new_index @169 + SSL_get_fd @59 + SSL_get_finished @240 + SSL_get_info_callback @165 + SSL_get_peer_cert_chain @60 + SSL_get_peer_certificate @61 + SSL_get_peer_finished @241 + SSL_get_privatekey @126 + SSL_get_psk_identity @304 + SSL_get_psk_identity_hint @297 + SSL_get_quiet_shutdown @153 + SSL_get_rbio @63 + SSL_get_read_ahead @64 + SSL_get_rfd @246 + SSL_get_servername @291 + SSL_get_servername_type @292 + SSL_get_session @154 + SSL_get_shared_ciphers @65 + SSL_get_shutdown @155 + SSL_get_ssl_method @66 + SSL_get_verify_callback @69 + SSL_get_verify_depth @229 + SSL_get_verify_mode @70 + SSL_get_verify_result @157 + SSL_get_version @71 + SSL_get_wbio @72 + SSL_get_wfd @247 + SSL_has_matching_session_id @249 + SSL_library_init @183 + SSL_load_client_CA_file @73 + SSL_load_error_strings @74 + SSL_new @75 + SSL_peek @76 + SSL_pending @77 + SSL_read @78 + SSL_renegotiate @79 + SSL_renegotiate_pending @265 + SSL_rstate_string @80 + SSL_rstate_string_long @81 + SSL_set1_param @309 + SSL_set_SSL_CTX @290 + SSL_set_accept_state @82 + SSL_set_bio @83 + SSL_set_cipher_list @84 + SSL_set_client_CA_list @85 + SSL_set_connect_state @86 + SSL_set_ex_data @158 + SSL_set_fd @87 + SSL_set_generate_session_id @258 + SSL_set_info_callback @160 + SSL_set_msg_callback @267 + SSL_set_psk_client_callback @300 + SSL_set_psk_server_callback @298 + SSL_set_purpose @236 + SSL_set_quiet_shutdown @161 + SSL_set_read_ahead @88 + SSL_set_rfd @89 + SSL_set_session @90 + SSL_set_session_id_context @189 + SSL_set_session_secret_cb @307 + SSL_set_session_ticket_ext @306 + SSL_set_session_ticket_ext_cb @308 + SSL_set_shutdown @162 + SSL_set_ssl_method @91 + SSL_set_tmp_dh_callback @187 + SSL_set_tmp_ecdh_callback @270 + SSL_set_tmp_rsa_callback @186 + SSL_set_trust @239 + SSL_set_verify @94 + SSL_set_verify_depth @226 + SSL_set_verify_result @163 + SSL_set_wfd @95 + SSL_shutdown @96 + SSL_state @166 + SSL_state_string @97 + SSL_state_string_long @98 + SSL_use_PrivateKey @99 + SSL_use_PrivateKey_ASN1 @100 + SSL_use_PrivateKey_file @101 + SSL_use_RSAPrivateKey @102 + SSL_use_RSAPrivateKey_ASN1 @103 + SSL_use_RSAPrivateKey_file @104 + SSL_use_certificate @105 + SSL_use_certificate_ASN1 @106 + SSL_use_certificate_file @107 + SSL_use_psk_identity_hint @299 + SSL_version @164 + SSL_want @182 + SSL_write @108 + SSLv23_client_method @110 + SSLv23_method @111 + SSLv23_server_method @112 + SSLv2_client_method @113 + SSLv2_method @114 + SSLv2_server_method @115 + SSLv3_client_method @116 + SSLv3_method @117 + SSLv3_server_method @118 + TLSv1_client_method @172 + TLSv1_method @170 + TLSv1_server_method @171 + d2i_SSL_SESSION @119 + i2d_SSL_SESSION @120 + commit 6cdd3e2a2e4677b061b9fbb9ee516fae9601cd16 Author: Mathieu Rene <mrene@avgs.ca> Date: Mon Aug 16 10:41:04 2010 -0400 Attempt at MODAPP-446 diff --git a/src/mod/applications/mod_hash/mod_hash.c b/src/mod/applications/mod_hash/mod_hash.c index a13a187..3a65528 100644 --- a/src/mod/applications/mod_hash/mod_hash.c +++ b/src/mod/applications/mod_hash/mod_hash.c @@ -766,10 +766,14 @@ static void *SWITCH_THREAD_FUNC limit_remote_thread(switch_thread_t *thread, voi remote->name, remote->host, remote->port); remote->state = REMOTE_UP; + } else { + esl_disconnect(&remote->handle); + memset(&remote->handle, 0, sizeof(remote->handle)); } } else { if (esl_send_recv_timed(&remote->handle, "api hash_dump limit", 5000) != ESL_SUCCESS) { esl_disconnect(&remote->handle); + memset(&remote->handle, 0, sizeof(remote->handle)); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Disconnected from remote FreeSWITCH (%s) at %s:%d\n", remote->name, remote->host, remote->port); memset(&remote->handle, 0, sizeof(remote->handle)); commit d6eb7562e535137bddf8cf9df864ea40360997bc Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Sun Aug 15 00:39:49 2010 +0200 [mod_commands,mod_event_socket,mod_event_test] fix up other users of switch_event_xmlize() to use SWITCH_EVENT_NONE diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index f27c2ec..cc864a2 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -4003,7 +4003,7 @@ SWITCH_STANDARD_API(uuid_dump_function) switch_xml_t xml; switch_channel_event_set_data(channel, event); if (!strcasecmp(format, "xml")) { - if ((xml = switch_event_xmlize(event, "%s", ""))) { + if ((xml = switch_event_xmlize(event, SWITCH_VA_NONE))) { buf = switch_xml_toxml(xml, SWITCH_FALSE); switch_xml_free(xml); } else { diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index e6c403b..3f7d680 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -966,7 +966,7 @@ SWITCH_STANDARD_API(event_sink_function) switch_xml_t xml; etype = "xml"; - if ((xml = switch_event_xmlize(pevent, "%s", ""))) { + if ((xml = switch_event_xmlize(pevent, SWITCH_VA_NONE))) { listener->ebuf = switch_xml_toxml(xml, SWITCH_FALSE); switch_xml_free(xml); } else { @@ -1257,7 +1257,7 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event, switch_xml_t xml; etype = "xml"; - if ((xml = switch_event_xmlize(pevent, "%s", ""))) { + if ((xml = switch_event_xmlize(pevent, SWITCH_VA_NONE))) { listener->ebuf = switch_xml_toxml(xml, SWITCH_FALSE); switch_xml_free(xml); } else { diff --git a/src/mod/event_handlers/mod_event_test/mod_event_test.c b/src/mod/event_handlers/mod_event_test/mod_event_test.c index e58adfb..ba5a2aa 100644 --- a/src/mod/event_handlers/mod_event_test/mod_event_test.c +++ b/src/mod/event_handlers/mod_event_test/mod_event_test.c @@ -49,7 +49,7 @@ static void event_handler(switch_event_t *event) return; default: switch_event_serialize(event, &buf, SWITCH_TRUE); - if ((xml = switch_event_xmlize(event, NULL))) { + if ((xml = switch_event_xmlize(event, SWITCH_VA_NONE))) { xmlstr = switch_xml_toxml(xml, SWITCH_FALSE); dofree++; } commit dbe62c25e96502585f059722f60cba199dc9b8e2 Author: Stefan Knoblich <s.knoblich@axsentis.de> Date: Sun Aug 15 00:35:10 2010 +0200 [mod_lcr] Use SWITCH_VA_NONE instead of an empty string to (finally) fix the gcc printf format warnings. diff --git a/src/mod/applications/mod_lcr/mod_lcr.c b/src/mod/applications/mod_lcr/mod_lcr.c index bdf5352..bbf7bb5 100644 --- a/src/mod/applications/mod_lcr/mod_lcr.c +++ b/src/mod/applications/mod_lcr/mod_lcr.c @@ -1783,7 +1783,7 @@ SWITCH_STANDARD_API(dialplan_lcr_function) write_data(stream, as_xml, "dialstring", current->dialstring, 2, maximum_lengths.dialstring); if (as_xml) { - event_xml = switch_event_xmlize(current->fields, ""); + event_xml = switch_event_xmlize(current->fields, SWITCH_VA_NONE); event_str = switch_xml_toxml(event_xml, SWITCH_FALSE); stream->write_function(stream, event_str); switch_xml_free(event_xml); commit bfa414cb0fd783857d20faf9e30db5afe010a6c7 Author: Mathieu Rene <mrene@avgs.ca> Date: Sat Aug 14 16:49:20 2010 -0400 mod_lcr: fix compiler warning on newer gcc diff --git a/src/mod/applications/mod_lcr/mod_lcr.c b/src/mod/applications/mod_lcr/mod_lcr.c index cace5e0..bdf5352 100644 --- a/src/mod/applications/mod_lcr/mod_lcr.c +++ b/src/mod/applications/mod_lcr/mod_lcr.c @@ -1783,7 +1783,7 @@ SWITCH_STANDARD_API(dialplan_lcr_function) write_data(stream, as_xml, "dialstring", current->dialstring, 2, maximum_lengths.dialstring); if (as_xml) { - event_xml = switch_event_xmlize(current->fields, NULL); + event_xml = switch_event_xmlize(current->fields, ""); event_str = switch_xml_toxml(event_xml, SWITCH_FALSE); stream->write_function(stream, event_str); switch_xml_free(event_xml); diff --git a/src/switch_event.c b/src/switch_event.c index eccc695..daf97ae 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -1231,7 +1231,7 @@ SWITCH_DECLARE(switch_xml_t) switch_event_xmlize(switch_event_t *event, const ch return xml; } - if (fmt) { + if (!zstr(fmt)) { va_start(ap, fmt); #ifdef HAVE_VASPRINTF ret = vasprintf(&data, fmt, ap); commit 6980305f3a8c72fdd4c98d9756baad1864d67a29 Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Sat Aug 14 12:22:11 2010 -0400 mod_callcenter: More ODBC changes. It is not a global settings value. Cannot be changed in runtime. diff --git a/conf/autoload_configs/callcenter.conf.xml b/conf/autoload_configs/callcenter.conf.xml index cafec1f..5fb0ace 100644 --- a/conf/autoload_configs/callcenter.conf.xml +++ b/conf/autoload_configs/callcenter.conf.xml @@ -1,5 +1,6 @@ <configuration name="callcenter.conf" description="CallCenter"> <settings> + <!--<param name="odbc-dsn" value="dsn:user:pass"/>--> </settings> <queues> @@ -9,14 +10,13 @@ <param name="moh-sound" value="$${hold_music}"/> <!--<param name="record-template" value="$${base_dir}/recordings/${strftime(%Y-%m-%d-%H-%M-%S)}.${destination_number}.${caller_id_number}.${uuid}.wav"/>--> <param name="time-base-score" value="system"/> - <!--<param name="odbc-dsn" value="dsn:user:pass"/>--> </queue> </queues> <!-- WARNING : Configuring XML Agents will updated into the DB upon restart --> <!-- WARNING : Configuring XML Tiers will reset the provided level and position if provided.--> -<!-- WARNING : Agents and Tiers XML config shouldn't be used in a multi FS shared DB setup --> +<!-- WARNING : Agents and Tiers XML config shouldn't be used in a multi FS shared DB setup(Not currently supported anyway) --> <agents> <!--<agent name="1000@default" type="callback" contact="[call_timeout=10]user/1000@default" status="Available" max-no-answer="3" wrap-up-time="10" />--> </agents> diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index e1e30d0..65525d1 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -34,6 +34,7 @@ #define CALLCENTER_EVENT "callcenter::info" #define CC_AGENT_TYPE_CALLBACK "Callback" +#define CC_SQLITE_DB_NAME "callcenter" /* TODO drop caller if no agent login @@ -356,6 +357,9 @@ typedef enum { static struct { switch_hash_t *queue_hash; int debug; + char *odbc_dsn; + char *odbc_user; + char *odbc_pass; int32_t threads; int32_t running; switch_mutex_t *mutex; @@ -367,10 +371,6 @@ static struct { struct cc_queue { char *name; - char *odbc_dsn; - char *odbc_user; - char *odbc_pass; - char *strategy; char *moh; char *record_template; @@ -435,21 +435,21 @@ static void destroy_queue(const char *queue_name, switch_bool_t block) } -switch_cache_db_handle_t *cc_get_db_handle(cc_queue_t *queue) +switch_cache_db_handle_t *cc_get_db_handle(void) { switch_cache_db_connection_options_t options = { {0} }; switch_cache_db_handle_t *dbh = NULL; - if (queue && !zstr(queue->odbc_dsn)) { - options.odbc_options.dsn = queue->odbc_dsn; - options.odbc_options.user = queue->odbc_user; - options.odbc_options.pass = queue->odbc_pass; + if (!zstr(globals.odbc_dsn)) { + options.odbc_options.dsn = globals.odbc_dsn; + options.odbc_options.user = globals.odbc_user; + options.odbc_options.pass = globals.odbc_pass; if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_ODBC, &options) != SWITCH_STATUS_SUCCESS) dbh = NULL; return dbh; } else { - options.core_db_options.db_path = "callcenter"; + options.core_db_options.db_path = CC_SQLITE_DB_NAME; if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_CORE_DB, &options) != SWITCH_STATUS_SUCCESS) dbh = NULL; return dbh; @@ -472,7 +472,6 @@ cc_queue_t *queue_set_config(cc_queue_t *queue) SWITCH_CONFIG_SET_ITEM(queue->config[i++], "moh-sound", SWITCH_CONFIG_STRING, 0, &queue->moh, NULL, &queue->config_str_pool, NULL, NULL); SWITCH_CONFIG_SET_ITEM(queue->config[i++], "record-template", SWITCH_CONFIG_STRING, 0, &queue->record_template, NULL, &queue->config_str_pool, NULL, NULL); SWITCH_CONFIG_SET_ITEM(queue->config[i++], "time-base-score", SWITCH_CONFIG_STRING, 0, &queue->time_base_score, "queue", &queue->config_str_pool, NULL, NULL); - SWITCH_CONFIG_SET_ITEM(queue->config[i++], "odbc-dsn", SWITCH_CONFIG_STRING, 0, &queue->odbc_dsn, NULL, &queue->config_str_pool, NULL, NULL); switch_assert(i < CC_QUEUE_CONFIGITEM_COUNT); @@ -487,7 +486,7 @@ char *cc_execute_sql2str(cc_queue_t *queue, switch_mutex_t *mutex, char *sql, ch switch_cache_db_handle_t *dbh = NULL; - if (!(dbh = cc_get_db_handle(queue))) { + if (!(dbh = cc_get_db_handle())) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n"); return NULL; } @@ -522,7 +521,7 @@ static switch_status_t cc_execute_sql(cc_queue_t *queue, char *sql, switch_mutex switch_mutex_lock(globals.mutex); } - if (!(dbh = cc_get_db_handle(queue))) { + if (!(dbh = cc_get_db_handle())) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n"); goto end; } @@ -554,7 +553,7 @@ static switch_bool_t cc_execute_sql_callback(cc_queue_t *queue, switch_mutex_t * switch_mutex_lock(globals.mutex); } - if (!(dbh = cc_get_db_handle(queue))) { + if (!(dbh = cc_get_db_handle())) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n"); goto end; } @@ -625,16 +624,7 @@ static cc_queue_t *load_queue(const char *queue_name) switch_thread_rwlock_create(&queue->rwlock, pool); queue->name = switch_core_strdup(pool, queue_name); - if (!zstr(queue->odbc_dsn)) { - if ((queue->odbc_user = strchr(queue->odbc_dsn, ':'))) { - *(queue->odbc_user++) = '\0'; - if ((queue->odbc_pass = strchr(queue->odbc_user, ':'))) { - *(queue->odbc_pass++) = '\0'; - } - } - } - - if (!(dbh = cc_get_db_handle(queue))) { + if (!(dbh = cc_get_db_handle())) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot open DB!\n"); goto end; } @@ -1159,6 +1149,17 @@ static switch_status_t load_config(void) if (!strcasecmp(var, "debug")) { globals.debug = atoi(val); + } else if (!strcasecmp(var, "odbc-dsn")) { + globals.odbc_dsn = strdup(switch_xml_attr(param, "odbc-dsn")); + + if (!zstr(globals.odbc_dsn)) { + if ((globals.odbc_user = strchr(globals.odbc_dsn, ':'))) { + *(globals.odbc_user++) = '\0'; + if ((globals.odbc_pass = strchr(globals.odbc_user, ':'))) { + *(globals.odbc_pass++) = '\0'; + } + } + } } } } @@ -2394,6 +2395,8 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_callcenter_shutdown) switch_core_destroy_memory_pool(&queue->pool); queue = NULL; } + + switch_safe_free(globals.odbc_dsn); switch_mutex_unlock(globals.mutex); return SWITCH_STATUS_SUCCESS; commit 42436e270cc5cf0c76ee51f75d0f701a811bd0bb Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Sat Aug 14 11:46:34 2010 -0400 mod_callcenter: Add missing odbc db support (Not tested, please someone test this) diff --git a/conf/autoload_configs/callcenter.conf.xml b/conf/autoload_configs/callcenter.conf.xml index 596cc66..cafec1f 100644 --- a/conf/autoload_configs/callcenter.conf.xml +++ b/conf/autoload_configs/callcenter.conf.xml @@ -3,14 +3,15 @@ </settings> <queues> -<!-- + <queue name="support@default"> <param name="strategy" value="longest-idle-agent"/> <param name="moh-sound" value="$${hold_music}"/> - <param name="record-template" value="$${base_dir}/recordings/${strftime(%Y-%m-%d-%H-%M-%S)}.${destination_number}.${caller_id_number}.${uuid}.wav"/> + <!--<param name="record-template" value="$${base_dir}/recordings/${strftime(%Y-%m-%d-%H-%M-%S)}.${destination_number}.${caller_id_number}.${uuid}.wav"/>--> <param name="time-base-score" value="system"/> + <!--<param name="odbc-dsn" value="dsn:user:pass"/>--> </queue> ---> + </queues> <!-- WARNING : Configuring XML Agents will updated into the DB upon restart --> diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index a52387b..e1e30d0 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -472,6 +472,7 @@ cc_queue_t *queue_set_config(cc_queue_t *queue) SWITCH_CONFIG_SET_ITEM(queue->config[i++], "moh-sound", SWITCH_CONFIG_STRING, 0, &queue->moh, NULL, &queue->config_str_pool, NULL, NULL); SWITCH_CONFIG_SET_ITEM(queue->config[i++], "record-template", SWITCH_CONFIG_STRING, 0, &queue->record_template, NULL, &queue->config_str_pool, NULL, NULL); SWITCH_CONFIG_SET_ITEM(queue->config[i++], "time-base-score", SWITCH_CONFIG_STRING, 0, &queue->time_base_score, "queue", &queue->config_str_pool, NULL, NULL); + SWITCH_CONFIG_SET_ITEM(queue->config[i++], "odbc-dsn", SWITCH_CONFIG_STRING, 0, &queue->odbc_dsn, NULL, &queue->config_str_pool, NULL, NULL); switch_assert(i < CC_QUEUE_CONFIGITEM_COUNT); commit 1666783cf80b776c61bda68a9effbf54f6d1a72f Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Sat Aug 14 04:07:38 2010 -0400 mod_callcenter: Try to fix the ring-all, also add cli auto complete done in previous commit diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index ffee20b..a52387b 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1596,10 +1596,10 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName } else if (!strcasecmp(queue_strategy, "agent-with-fewest-calls")) { sql_order_by = switch_mprintf("level, agents.calls_answered, position"); } else if (!strcasecmp(queue_strategy, "ring-all")) { - /* If we set at Trying, who will put it back at Waiting ?? So we just dont change it state for the moment */ - /*sql = switch_mprintf("UPDATE members SET state = '%q' WHERE state = '%q' AND uuid = '%q' AND system = 'single_box'", cc_member_state2str(CC_MEMBER_STATE_TRYING), cc_member_state2str(CC_MEMBER_STATE_WAITING), cbt.uuid); - cc_execute_sql(NULL, sql, NULL); - switch_safe_free(sql);*/ + sql = switch_mprintf("UPDATE members SET state = '%q' WHERE state = '%q' AND uuid = '%q' AND system = 'single_box'", + cc_member_state2str(CC_MEMBER_STATE_TRYING), cc_member_state2str(CC_MEMBER_STATE_WAITING), cbt.uuid); + cc_execute_sql(NULL, sql, NULL); + switch_safe_free(sql); sql_order_by = switch_mprintf("level, position"); } else if(!strcasecmp(queue_strategy, "sequentially-by-agent-order")) { sql_order_by = switch_mprintf("level, position"); @@ -1658,9 +1658,9 @@ void *SWITCH_THREAD_FUNC cc_agent_dispatch_thread_run(switch_thread_t *thread, v while (globals.running == 1) { char *sql = NULL; sql = switch_mprintf("SELECT queue,uuid,caller_number,caller_name,joined_epoch,(%ld-joined_epoch)+base_score+skill_score AS score FROM members" - " WHERE state = '%q' ORDER BY score DESC", + " WHERE state = '%q' OR (serving_agent != 'ring-all' AND state = '%q') ORDER BY score DESC", (long) switch_epoch_time_now(NULL), - cc_member_state2str(CC_MEMBER_STATE_WAITING)); + cc_member_state2str(CC_MEMBER_STATE_WAITING), cc_member_state2str(CC_MEMBER_STATE_TRYING)); cc_execute_sql_callback(NULL /* queue */, NULL /* mutex */, sql, members_callback, NULL /* Call back variables */); switch_safe_free(sql); @@ -1967,6 +1967,9 @@ static int list_result_callback(void *pArg, int argc, char **argv, char **column "callcenter_config tier set level [queue_name] [agent_name] [level] | " \ "callcenter_config tier set position [queue_name] [agent_name] [position] | " \ "callcenter_config tier del [queue_name] [agent_name] | " \ +"callcenter_config queue load [queue_name] | " \ +"callcenter_config queue unload [queue_name] | " \ +"callcenter_config queue reload [queue_name] | " \ "callcenter_config tier list [queue_name] | " \ "callcenter_config queue list [queue_name] | " \ "callcenter_config queue count [queue_name]" @@ -2340,6 +2343,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_callcenter_load) switch_console_set_complete("add callcenter_config tier set position"); switch_console_set_complete("add callcenter_config tier list"); + switch_console_set_complete("add callcenter_config queue load"); + switch_console_set_complete("add callcenter_config queue unload"); + switch_console_set_complete("add callcenter_config queue reload"); switch_console_set_complete("add callcenter_config queue list"); switch_console_set_complete("add callcenter_config queue count"); commit 7cefb22751ddde881d2061efea3a4b26ea8e02c8 Author: Luke Dashjr <luke@openmethods.com> Date: Thu Aug 12 04:09:47 2010 -0500 Include /var/run/freeswitch and /var/log/freeswitch in RPM diff --git a/freeswitch.spec b/freeswitch.spec index eaf34fc..76f9df4 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -35,6 +35,8 @@ %define prefix %{_prefix} %define sysconfdir /opt/freeswitch/conf %define _sysconfdir %{sysconfdir} +%define logfiledir /var/log/freeswitch +%define runtimedir /var/run/freeswitch Name: freeswitch Summary: FreeSWITCH open source telephony platform @@ -476,6 +478,8 @@ touch .noversion # Create a log dir %{__mkdir} -p %{buildroot}%{prefix}/log +%{__mkdir} -p %{buildroot}%{logfiledir} +%{__mkdir} -p %{buildroot}%{runtimedir} %ifos linux # Install init files @@ -554,7 +558,8 @@ fi %dir %attr(0750, freeswitch, daemon) %{prefix}/db %dir %attr(0750, freeswitch, daemon) %{prefix}/grammar %dir %attr(0750, freeswitch, daemon) %{prefix}/htdocs -%dir %attr(0750, freeswitch, daemon) %{prefix}/log +%dir %attr(0750, freeswitch, daemon) %{logfiledir} +%dir %attr(0750, freeswitch, daemon) %{runtimedir} %dir %attr(0750, freeswitch, daemon) %{prefix}/scripts # #################################### Config Directory Structure ################################################################ commit fea3008454a9a0290bd57db967afba7e9c980df9 Merge: 3eafca6 45c6c4d Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Fri Aug 13 19:17:36 2010 -0400 Merge branch 'master' of ssh://git.freeswitch.org/freeswitch commit 3eafca602943d9b51cfd2190e9a031d261cf9dc4 Author: Marc Olivier Chouinard <mochouinard@moctel.com> Date: Fri Aug 13 19:15:24 2010 -0400 mod_callcenter: Add ability to unload/reload/load a queue setting (You still need to reloadxml before). Note that joining a queue will check for it in the config and load it on the fly... I've used the same system as in mod_voicemail. Not sure if we should allow this, but just comment it out of the config before unload and it wont be available anymore diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 0c629d6..ffee20b 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -404,6 +404,37 @@ static void queue_rwunlock(cc_queue_t *queue) } } +static void destroy_queue(const char *queue_name, switch_bool_t block) +{ + cc_queue_t *queue = NULL; + switch_mutex_lock(globals.mutex); + if ((queue = switch_core_hash_find(globals.queue_hash, queue_name))) { + switch_core_hash_delete(globals.queue_hash, queue_name); + } + switch_mutex_unlock(globals.mutex); + + if (!queue) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[%s] Invalid queue\n", queue_name); + return; + } + + if (block) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[%s] Waiting for write lock\n", queue->name); + switch_thread_rwlock_wrlock(queue->rwlock); + } else { + if (switch_thread_rwlock_trywrlock(queue->rwlock) != SWITCH_STATUS_SUCCESS) { + /* Lock failed, set the destroy flag so it'll be destroyed whenever its not in use anymore */ + switch_set_flag(queue, PFLAG_DESTROY); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[%s] queue is in use, memory will be freed whenever its no longer in use\n", + queue->name); + return; + } + } + + free_queue(queue); +} + + switch_cache_db_handle_t *cc_get_db_handle(cc_queue_t *queue) { switch_cache_db_connection_options_t options = { {0} }; @@ -437,7 +468,7 @@ cc_queue_t *queue_set_config(cc_queue_t *queue) SWITCH _CONFIG_SET_ITEM(item, "key", type, flags, pointer, default, options, help_syntax, help_description) */ - SWITCH_CONFIG_SET_ITEM(queue->config[i++], "strategy", SWITCH_CONFIG_STRING, 0, &queue->strategy, NULL, &queue->config_str_pool, NULL, NULL); + SWITCH_CONFIG_SET_ITEM(queue->config[i++], "strategy", SWITCH_CONFIG_STRING, 0, &queue->strategy, "longest-idle-agent", &queue->config_str_pool, NULL, NULL); SWITCH_CONFIG_SET_ITEM(queue->config[i++], "moh-sound", SWITCH_CONFIG_STRING, 0, &queue->moh, NULL, &queue->config_str_pool, NULL, NULL); SWITCH_CONFIG_SET_ITEM(queue->config[i++], "record-template", SWITCH_CONFIG_STRING, 0, &queue->record_template, NULL, &queue->config_str_pool, NULL, NULL); SWITCH_CONFIG_SET_ITEM(queue->config[i++], "time-base-score", SWITCH_CONFIG_STRING, 0, &queue->time_base_score, "queue", &queue->config_str_pool, NULL, NULL); @@ -1529,11 +1560,23 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName cc_queue_t *queue = NULL; char *sql = NULL; char *sql_order_by = NULL; + char *queue_name = NULL; + char *queue_strategy = NULL; + char *queue_record_template = NULL; agent_callback_t cbt; if (!argv[0] || !(queue = get_queue(argv[0]))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Queue %s not found locally, skip this member\n", argv[0]); goto end; + } else { + queue_name = strdup(queue->name); + queue_strategy = strdup(queue->strategy); + + if (queue->record_template) { + queue_record_template = strdup(queue->record_template); + } + + queue_rwunlock(queue); } memset(&cbt, 0, sizeof(cbt)); @@ -1543,22 +1586,22 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName cbt.caller_name = argv[3]; cbt.joined_epoch = argv[4]; cbt.queue = argv[0]; - cbt.strategy = queue->strategy; - cbt.record_template = queue->record_template; - - if (!strcasecmp(queue->strategy, "longest-idle-agent") || !strcasecmp(queue->strategy, "roundrobin") /* TODO TMP backward compatibility for taxi dispatch setup */) { + cbt.strategy = queue_strategy; + cbt.record_template = queue_record_template; + + if (!strcasecmp(queue->strategy, "longest-idle-agent") || !strcasecmp(queue_strategy, "roundrobin") /* TODO TMP backward compatibility for taxi dispatch setup */) { sql_order_by = switch_mprintf("level, agents.last_offered_call, position"); - } else if (!strcasecmp(queue->strategy, "agent-with-least-talk-time")) { + } else if (!strcasecmp(queue_strategy, "agent-with-least-talk-time")) { sql_order_by = switch_mprintf("level, agents.talk_time, position"); - } else if (!strcasecmp(queue->strategy, "agent-with-fewest-calls")) { + } else if (!strcasecmp(queue_strategy, "agent-with-fewest-calls")) { sql_order_by = switch_mprintf("level, agents.calls_answered, position"); - } else if (!strcasecmp(queue->strategy, "ring-all")) { + } else if (!strcasecmp(queue_strategy, "ring-all")) { /* If we set at Trying, who will put it back at Waiting ?? So we just dont change it state for the moment */ /*sql = switch_mprintf("UPDATE members SET state = '%q' WHERE state = '%q' AND uuid = '%q' AND system = 'single_box'", cc_member_state2str(CC_MEMBER_STATE_TRYING), cc_member_state2str(CC_MEMBER_STATE_WAITING), cbt.uuid); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql);*/ sql_order_by = switch_mprintf("level, position"); - } else if(!strcasecmp(queue->strategy, "sequentially-by-agent-order")) { + } else if(!strcasecmp(queue_strategy, "sequentially-by-agent-order")) { sql_order_by = switch_mprintf("level, position"); } else { /* If the strategy doesn't exist, just fallback to the following */ @@ -1571,7 +1614,7 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName " AND (agents.status = '%q' OR agents.status = '%q' OR agents.status = '%q')" " AND agents.state = '%q' AND last_bridge_end < (%ld - wrap_up_time)" " ORDER BY %q", - queue->name, + queue_name, cc_tier_state2str(CC_TIER_STATE_READY), cc_tier_state2str(CC_TIER_STATE_NO_ANSWER), cc_agent_status2str(CC_AGENT_STATUS_AVAILABLE), cc_agent_status2str(CC_AGENT_STATUS_ON_BREAK), cc_agent_status2str(CC_AGENT_STATUS_AVAILABLE_ON_DEMAND), cc_agent_state2str(CC_AGENT_STATE_WAITING), (long) switch_epoch_time_now(NULL), @@ -1582,9 +1625,11 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName switch_safe_free(sql); switch_safe_free(sql_order_by); - queue_rwunlock(queue); - end: + switch_safe_free(queue_name); + switch_safe_free(queue_strategy); + switch_safe_free(queue_record_template); + return 0; } @@ -1729,7 +1774,7 @@ SWITCH_STANDARD_APP(callcenter_function) switch_threadattr_t *thd_attr = NULL; switch_memory_pool_t *pool; int cc_base_score_int = 0; - switch_channel_timetable_t *times = switch_channel_get_timetable(member_channel); + switch_channel_timetable_t *times = NULL; const char *cc_base_score = switch_channel_get_variable(member_channel, "cc_base_score"); const char *cc_moh_override = switch_channel_get_variable(member_channel, "cc_moh_override"); const char *cur_moh = NULL; @@ -1754,7 +1799,11 @@ SWITCH_STANDARD_APP(callcenter_function) goto end; } + /* Make sure we answer the channel before getting the switch_channel_time_table_t answer time */ + switch_channel_answer(member_channel); + /* Grab the start epoch of a channel */ + times = switch_channel_get_timetable(member_channel); switch_snprintf(start_epoch, sizeof(start_epoch), "%" SWITCH_TIME_T_FMT, times->answered); /* Add manually imported score */ @@ -1766,7 +1815,6 @@ SWITCH_STANDARD_APP(callcenter_function) if (!switch_strlen_zero(start_epoch) && !strcasecmp("system", queue->time_base_score)) { cc_base_score_int += (switch_epoch_time_now(NULL) - atoi(start_epoch)); } - switch_channel_answer(member_channel); if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CALLCENTER_EVENT) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(member_channel, event); @@ -1815,10 +1863,12 @@ SWITCH_STANDARD_APP(callcenter_function) /* Playback MOH */ /* TODO Add DTMF callback support */ /* TODO add MOH infitite loop */ - cur_moh = queue->moh; if (cc_moh_override) { - cur_moh = cc_moh_override; + cur_moh = switch_core_session_strdup(session, cc_moh_override); + } else { + cur_moh = switch_core_session_strdup(session, queue->moh); } + queue_rwunlock(queue); if (cur_moh) { switch_ivr_play_file(session, NULL, cur_moh, &args); @@ -1835,7 +1885,7 @@ SWITCH_STANDARD_APP(callcenter_function) if (!switch_channel_up(member_channel)) { /* If channel is still up, it mean that the member didn't hangup, so we should leave the agent alone */ switch_core_session_hupall_matching_var("cc_member_uuid", uuid, SWITCH_CAUSE_ORIGINATOR_CANCEL); sql = switch_mprintf("DELETE FROM members WHERE system = 'single_box' AND uuid = '%q'", uuid); - cc_execute_sql(queue, sql, NULL); + cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CALLCENTER_EVENT) == SWITCH_STATUS_SUCCESS) { @@ -1859,7 +1909,7 @@ SWITCH_STANDARD_APP(callcenter_function) } else { sql = switch_mprintf("UPDATE members SET state = '%q', bridge_epoch = '%ld' WHERE system = 'single_box' AND uuid = '%q'", cc_member_state2str(CC_MEMBER_STATE_ANSWERED), (long) switch_epoch_time_now(NULL), uuid); - cc_execute_sql(queue, sql, NULL); + cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); /* Send Event with queue count */ @@ -1867,8 +1917,6 @@ SWITCH_STANDARD_APP(callcenter_function) } - queue_rwunlock(queue); - end: return; @@ -2166,7 +2214,42 @@ SWITCH_STANDARD_API(cc_config_api_function) } } } else if (section && !strcasecmp(section, "queue")) { - if (action && !strcasecmp(action, "list")) { + if (action && !strcasecmp(action, "load")) { + if (argc-initial_argc < 1) { + stream->write_function(stream, "%s", "-ERR Invalid!\n"); + goto done; + } else { + const char *queue_name = argv[0 + initial_argc]; + cc_queue_t *queue = NULL; + if ((queue = get_queue(queue_name))) { + queue_rwunlock(queue); + } + stream->write_function(stream, "%s", "+OK\n"); + } + } else if (action && !strcasecmp(action, "unload")) { + if (argc-initial_argc < 1) { + stream->write_function(stream, "%s", "-ERR Invalid!\n"); + goto done; + } else { + const char *queue_name = argv[0 + initial_argc]; + destroy_queue(queue_name, SWITCH_FALSE); + stream->write_function(stream, "%s", "+OK\n"); + + } + } else if (action && !strcasecmp(action, "reload")) { + if (argc-initial_argc < 1) { + stream->write_function(stream, "%s", "-ERR Invalid!\n"); + goto done; + } else { + const char *queue_name = argv[0 + initial_argc]; + cc_queue_t *queue = NULL; + destroy_queue(queue_name, SWITCH_FALSE); + if ((queue = get_queue(queue_name))) { + queue_rwunlock(queue); + } + stream->write_function(stream, "%s", "+OK\n"); + } + } else if (action && !strcasecmp(action, "list")) { if (argc-initial_argc < 1) { stream->write_function(stream, "%s", "-ERR Invalid!\n"); goto done; commit 45c6c4d3e42e3c114b47d52ca2e9fca6b1be8090 Author: Giovanni Maruzzelli <gmaruzz@gmail.com> Date: Fri Aug 13 16:19:20 2010 -0500 skypopen: now answer a call only when directed to do it (before was trying to answer any incoming call). Lot of changes to a messy part, so maybe some problem will come out... Signed-off-by: Giovanni Maruzzelli <gmaruzz@gmail.com> diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index 3c41524..134e24c 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -179,6 +179,7 @@ static switch_status_t remove_interface(char *the_interface); static switch_status_t channel_on_init(switch_core_session_t *session); static switch_status_t channel_on_hangup(switch_core_session_t *session); +static switch_status_t channel_on_reset(switch_core_session_t *session); static switch_status_t channel_on_destroy(switch_core_session_t *session); static switch_status_t channel_on_routing(switch_core_session_t *session); static switch_status_t channel_on_exchange_media(switch_core_session_t *session); @@ -434,10 +435,6 @@ static switch_status_t channel_on_init(switch_core_session_t *session) where a destination has been identified. If the channel is simply left in the initial state, nothing will happen. */ switch_channel_set_state(channel, CS_ROUTING); - switch_mutex_lock(globals.mutex); - globals.calls++; - - switch_mutex_unlock(globals.mutex); DEBUGA_SKYPE("%s CHANNEL INIT %s\n", SKYPOPEN_P_LOG, tech_pvt->name, switch_core_session_get_uuid(session)); return SWITCH_STATUS_SUCCESS; @@ -645,6 +642,29 @@ static switch_status_t channel_on_soft_execute(switch_core_session_t *session) DEBUGA_SKYPE("%s CHANNEL SOFT_EXECUTE\n", SKYPOPEN_P_LOG, tech_pvt->name); return SWITCH_STATUS_SUCCESS; } +static switch_status_t channel_on_reset(switch_core_session_t *session) +{ + private_t *tech_pvt = NULL; + switch_channel_t *channel = NULL; + tech_pvt = switch_core_session_get_private(session); + DEBUGA_SKYPE("%s CHANNEL RESET\n", SKYPOPEN_P_LOG, tech_pvt->name); + + + if (session) { + channel = switch_core_session_get_channel(session); + } else { + ERRORA("No session???\n", SKYPOPEN_P_LOG); + } + if (channel) { + switch_channel_set_state(channel, CS_HANGUP); + } else { + ERRORA("No channel???\n", SKYPOPEN_P_LOG); + } + + + return SWITCH_STATUS_SUCCESS; +} + static switch_status_t channel_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf) { @@ -824,10 +844,14 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc tech_pvt = switch_core_session_get_private(session); switch_assert(tech_pvt != NULL); - if (!switch_channel_ready(channel) || !switch_test_flag(tech_pvt, TFLAG_IO)) { + if (!switch_channel_ready(channel)) { ERRORA("channel not ready \n", SKYPOPEN_P_LOG); return SWITCH_STATUS_FALSE; } + if (!switch_test_flag(tech_pvt, TFLAG_IO)) { + DEBUGA_SKYPE("channel not in TFLAG_IO \n", SKYPOPEN_P_LOG); + return SWITCH_STATUS_FALSE; + } #if SWITCH_BYTE_ORDER == __BIG_ENDIAN if (switch_test_flag(tech_pvt, TFLAG_LINEAR)) { switch_swap_linear(frame->data, (int) frame->datalen / 2); @@ -865,6 +889,24 @@ static switch_status_t channel_answer_channel(switch_core_session_t *session) tech_pvt = switch_core_session_get_private(session); switch_assert(tech_pvt != NULL); + switch_clear_flag(tech_pvt, TFLAG_IO); + skypopen_answer(tech_pvt); + + while(!switch_test_flag(tech_pvt, TFLAG_IO)){ //FIXME that would be better with a timeout + if(switch_channel_get_state(channel) == CS_RESET){ + return SWITCH_STATUS_FALSE; + } + switch_sleep(5000); + } + switch_mutex_lock(globals.mutex); + globals.calls++; + + switch_mutex_unlock(globals.mutex); + DEBUGA_SKYPE("%s CHANNEL ANSWER %s\n", SKYPOPEN_P_LOG, tech_pvt->name, switch_core_session_get_uuid(session)); + + + + DEBUGA_SKYPE("ANSWERED! \n", SKYPOPEN_P_LOG); return SWITCH_STATUS_SUCCESS; @@ -991,7 +1033,7 @@ switch_state_handler_table_t skypopen_state_handlers = { /*.on_soft_execute */ channel_on_soft_execute, /*.on_consume_media */ channel_on_consume_media, /*.on_hibernate */ NULL, - /*.on_reset */ NULL, + /*.on_reset */ channel_on_reset, /*.on_park */ NULL, /*.on_reporting */ NULL, /*.on_destroy */ channel_on_destroy @@ -1184,6 +1226,12 @@ static void *SWITCH_THREAD_FUNC skypopen_signaling_thread_func(switch_thread_t * *tech_pvt->session_uuid_str = '\0'; *tech_pvt->skype_call_id = '\0'; *tech_pvt->initial_skype_user = '\0'; + *tech_pvt->answer_id = '\0'; + *tech_pvt->answer_value = '\0'; + *tech_pvt->ring_id = '\0'; + *tech_pvt->ring_value = '\0'; + *tech_pvt->callid_number = '\0'; + *tech_pvt->callid_name = '\0'; switch_mutex_unlock(globals.mutex); switch_sleep(300000); //0.3 sec @@ -1949,7 +1997,6 @@ int new_inbound_channel(private_t * tech_pvt) } } if (channel) { - switch_channel_mark_answered(channel); switch_channel_set_variable(channel, "skype_user", tech_pvt->skype_user); switch_channel_set_variable(channel, "initial_skype_user", tech_pvt->initial_skype_user); } @@ -2261,34 +2308,42 @@ SWITCH_STANDARD_API(skypopen_function) return SWITCH_STATUS_SUCCESS; } -int skypopen_answer(private_t * tech_pvt, char *id, char *value) + +int skypopen_partner_handle_ring(private_t * tech_pvt) { char msg_to_skype[1024]; int i; int found = 0; private_t *giovatech; struct timeval timenow; + char *id = tech_pvt->ring_id; + char *value = tech_pvt->ring_value; + switch_core_session_t *session = NULL; + switch_channel_t *channel = NULL; switch_mutex_lock(globals.mutex); + //WARNINGA("PARTNER_HANDLE tech_pvt->skype_call_id=%s, tech_pvt->skype_callflow=%d, tech_pvt->interface_state=%d, tech_pvt->skype_user=%s, tech_pvt->callid_number=%s, tech_pvt->ring_value=%s, tech_pvt->ring_id=%s, tech_pvt->answer_value=%s, tech_pvt->answer_id=%s\n", SKYPOPEN_P_LOG, tech_pvt->skype_call_id, tech_pvt->skype_callflow, tech_pvt->interface_state, tech_pvt->skype_user, tech_pvt->callid_number, tech_pvt->ring_value, tech_pvt->ring_id, tech_pvt->answer_value, tech_pvt->answer_id); + gettimeofday(&timenow, NULL); for (i = 0; !found && i < SKYPOPEN_MAX_INTERFACES; i++) { if (strlen(globals.SKYPOPEN_INTERFACES[i].name)) { giovatech = &globals.SKYPOPEN_INTERFACES[i]; - if (strlen(giovatech->skype_call_id) && (giovatech->interface_state != SKYPOPEN_STATE_DOWN) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user)) && (!strcmp(giovatech->callid_number, value)) && ((((timenow.tv_sec - giovatech->answer_time.tv_sec) * 1000000) + (timenow.tv_usec - giovatech->answer_time.tv_usec)) < 1000000)) { //XXX 1.5sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.5 seconds + if ((giovatech->interface_state != SKYPOPEN_STATE_DOWN) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user)) && (!strcmp(giovatech->ring_value, value)) && ((((timenow.tv_sec - giovatech->ring_time.tv_sec) * 1000000) + (timenow.tv_usec - giovatech->ring_time.tv_usec)) < 1000000)) { //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds found = 1; - DEBUGA_SKYPE - ("FOUND (name=%s, giovatech->interface_state=%d != SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n", - SKYPOPEN_P_LOG, giovatech->name, giovatech->interface_state, - giovatech->skype_user, tech_pvt->skype_user, giovatech->callid_number, value) - if (tech_pvt->interface_state == SKYPOPEN_STATE_PRERING) { + DEBUGA_SKYPE ("FOUND (name=%s, giovatech->interface_state=%d != SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n", SKYPOPEN_P_LOG, giovatech->name, giovatech->interface_state, giovatech->skype_user, tech_pvt->skype_user, giovatech->callid_number, value); + if (tech_pvt->interface_state == SKYPOPEN_STATE_PRERING) { tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; } else if (tech_pvt->interface_state != 0 && tech_pvt->interface_state != SKYPOPEN_STATE_DOWN) { WARNINGA("Why an interface_state %d HERE?\n", SKYPOPEN_P_LOG, tech_pvt->interface_state); tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; } + *tech_pvt->answer_id = '\0'; + *tech_pvt->answer_value = '\0'; + *tech_pvt->ring_id = '\0'; + *tech_pvt->ring_value = '\0'; break; } } @@ -2303,11 +2358,115 @@ int skypopen_answer(private_t * tech_pvt, char *id, char *value) if (tech_pvt && tech_pvt->skype_call_id && !strlen(tech_pvt->skype_call_id)) { /* we are not inside an active call */ - tech_pvt->ib_calls++; + tech_pvt->interface_state = SKYPOPEN_STATE_PRERING; + gettimeofday(&tech_pvt->ring_time, NULL); + switch_copy_string(tech_pvt->callid_number, value, sizeof(tech_pvt->callid_number) - 1); + + + //WARNINGA("PARTNER_HANDLE_RING tech_pvt->skype_call_id=%s, tech_pvt->skype_callflow=%d, tech_pvt->interface_state=%d, tech_pvt->skype_user=%s, tech_pvt->callid_number=%s, tech_pvt->ring_value=%s, tech_pvt->ring_id=%s, tech_pvt->answer_value=%s, tech_pvt->answer_id=%s\n", SKYPOPEN_P_LOG, tech_pvt->skype_call_id, tech_pvt->skype_callflow, tech_pvt->interface_state, tech_pvt->skype_user, tech_pvt->callid_number, tech_pvt->ring_value, tech_pvt->ring_id, tech_pvt->answer_value, tech_pvt->answer_id); + + session = switch_core_session_locate(tech_pvt->session_uuid_str); + if (session) { + switch_core_session_rwunlock(session); + return 0; + } + + new_inbound_channel(tech_pvt); + + session = switch_core_session_locate(tech_pvt->session_uuid_str); + if (session) { + channel = switch_core_session_get_channel(session); + + switch_core_session_queue_indication(session, SWITCH_MESSAGE_INDICATE_RINGING); + if (channel) { + switch_channel_mark_ring_ready(channel); + } else { + ERRORA("no channel\n", SKYPOPEN_P_LOG); + } + switch_core_session_rwunlock(session); + } else { + ERRORA("no session\n", SKYPOPEN_P_LOG); - sprintf(msg_to_skype, "GET CALL %s PARTNER_DISPNAME", id); + } + + } else if (!tech_pvt || !tech_pvt->skype_call_id) { + ERRORA("No Call ID?\n", SKYPOPEN_P_LOG); + } else { + DEBUGA_SKYPE("We're in a call now (%s), let's refuse this one (%s)\n", SKYPOPEN_P_LOG, tech_pvt->skype_call_id, id); + sprintf(msg_to_skype, "ALTER CALL %s END HANGUP", id); skypopen_signaling_write(tech_pvt, msg_to_skype); - switch_sleep(10000); + } + + switch_mutex_unlock(globals.mutex); + return 0; +} + +int skypopen_answer(private_t * tech_pvt) +{ + char msg_to_skype[1024]; + int i; + int found = 0; + private_t *giovatech; + struct timeval timenow; + char *id = tech_pvt->answer_id; + char *value = tech_pvt->answer_value; + switch_core_session_t *session = NULL; + switch_channel_t *channel = NULL; + + switch_mutex_lock(globals.mutex); + + //WARNINGA("ANSWER tech_pvt->skype_call_id=%s, tech_pvt->skype_callflow=%d, tech_pvt->interface_state=%d, tech_pvt->skype_user=%s, tech_pvt->callid_number=%s, tech_pvt->ring_value=%s, tech_pvt->ring_id=%s, tech_pvt->answer_value=%s, tech_pvt->answer_id=%s\n", SKYPOPEN_P_LOG, tech_pvt->skype_call_id, tech_pvt->skype_callflow, tech_pvt->interface_state, tech_pvt->skype_user, tech_pvt->callid_number, tech_pvt->ring_value, tech_pvt->ring_id, tech_pvt->answer_value, tech_pvt->answer_id); + + gettimeofday(&timenow, NULL); + for (i = 0; !found && i < SKYPOPEN_MAX_INTERFACES; i++) { + if (strlen(globals.SKYPOPEN_INTERFACES[i].name)) { + + giovatech = &globals.SKYPOPEN_INTERFACES[i]; + if (strlen(giovatech->skype_call_id) && (giovatech->interface_state != SKYPOPEN_STATE_DOWN) && (!strcmp(giovatech->skype_user, tech_pvt->skype_user)) && (!strcmp(giovatech->callid_number, value)) && ((((timenow.tv_sec - giovatech->answer_time.tv_sec) * 1000000) + (timenow.tv_usec - giovatech->answer_time.tv_usec)) < 1000000)) { //XXX 1.0sec - can have a max of 1 call coming from the same skypename to the same skypename each 1.0 seconds + found = 1; + DEBUGA_SKYPE ("FOUND (name=%s, giovatech->interface_state=%d != SKYPOPEN_STATE_DOWN) && (giovatech->skype_user=%s == tech_pvt->skype_user=%s) && (giovatech->callid_number=%s == value=%s)\n", SKYPOPEN_P_LOG, giovatech->name, giovatech->interface_state, giovatech->skype_user, tech_pvt->skype_user, giovatech->callid_number, value); + if (tech_pvt->interface_state == SKYPOPEN_STATE_PRERING) { + tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; + } else if (tech_pvt->interface_state != 0 && tech_pvt->interface_state != SKYPOPEN_STATE_DOWN) { + WARNINGA("Why an interface_state %d HERE?\n", SKYPOPEN_P_LOG, tech_pvt->interface_state); + tech_pvt->interface_state = SKYPOPEN_STATE_DOWN; + } + + + if (!zstr(tech_pvt->session_uuid_str)) { + session = switch_core_session_locate(tech_pvt->session_uuid_str); + } else { + ERRORA("No session???\n", SKYPOPEN_P_LOG); + } + if (session) { + channel = switch_core_session_get_channel(session); + } else { + ERRORA("No session???\n", SKYPOPEN_P_LOG); + } + if (channel) { + switch_channel_set_state(channel, CS_RESET); + } else { + ERRORA("No channel???\n", SKYPOPEN_P_LOG); + } + + switch_core_session_rwunlock(session); + + break; + } + } + } + + if (found) { + switch_mutex_unlock(globals.mutex); + return 0; + } + DEBUGA_SKYPE("NOT FOUND\n", SKYPOPEN_P_LOG); + + if (tech_pvt && tech_pvt->skype_call_id && !strlen(tech_pvt->skype_call_id)) { + /* we are not inside an active call */ + + tech_pvt->ib_calls++; + tech_pvt->interface_state = SKYPOPEN_STATE_PREANSWER; sprintf(msg_to_skype, "ALTER CALL %s ANSWER", id); skypopen_signaling_write(tech_pvt, msg_to_skype); diff --git a/src/mod/endpoints/mod_skypopen/skypopen.h b/src/mod/endpoints/mod_skypopen/skypopen.h index b978623..b991f0e 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen.h +++ b/src/mod/endpoints/mod_skypopen/skypopen.h @@ -264,6 +264,7 @@ struct private_object { char skype_password[256]; char destination[256]; struct timeval answer_time; + struct timeval ring_time; struct timeval transfer_time; char transfer_callid_number[50]; @@ -288,6 +289,10 @@ struct private_object { int silent_mode; int write_silence_when_idle; int setsockopt; + char answer_id[256]; + char answer_value[256]; + char ring_id[256]; + char ring_value[256]; }; @@ -328,7 +333,8 @@ int skypopen_close_socket(unsigned int fd); private_t *find_available_skypopen_interface_rr(private_t * tech_pvt_calling); int remote_party_is_ringing(private_t * tech_pvt); int remote_party_is_early_media(private_t * tech_pvt); -int skypopen_answer(private_t * tech_pvt, char *id, char *value); +//int skypopen_answer(private_t * tech_pvt, char *id, char *value); +int skypopen_answer(private_t * tech_pvt); int skypopen_transfer(private_t * tech_pvt, char *id, char *value); #ifndef WIN32 int skypopen_socket_create_and_bind(private_t * tech_pvt, int *which_port); @@ -337,3 +343,6 @@ int skypopen_socket_create_and_bind(private_t * tech_pvt, unsigned short *which_ #endif //WIN32 int incoming_chatmessage(private_t * tech_pvt, int which); int next_port(void); +int skypopen_partner_handle_ring(private_t * tech_pvt); +int skypopen_answered(private_t * tech_pvt); +int inbound_channel_answered(private_t * tech_pvt); diff --git a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c index 6f4fc33..a15b564 100644 --- a/src/mod/endpoints/mod_skypopen/skypopen_protocol.c +++ b/src/mod/endpoints/mod_skypopen/skypopen_protocol.c @@ -214,7 +214,7 @@ int skypopen_signaling_read(private_t * tech_pvt) ERRORA("Skype got ERROR: |||%s|||, another call is active on this interface\n\n\n", SKYPOPEN_P_LOG, message); tech_pvt->interface_state = SKYPOPEN_STATE_ERROR_DOUBLE_CALL; } else if (!strncasecmp(message, "ERROR 592 ALTER CALL", 19)) { - ERRORA("Skype got ERROR about TRANSFERRING, no problem: |||%s|||\n", SKYPOPEN_P_LOG, message); + NOTICA("Skype got ERROR about TRANSFERRING, no problem: |||%s|||\n", SKYPOPEN_P_LOG, message); } else if (!strncasecmp(message, "ERROR 559 CALL", 13)) { if (tech_pvt->interface_state == SKYPOPEN_STATE_PREANSWER) { DEBUGA_SKYPE("Skype got ERROR about a failed action (probably TRYING to ANSWER A CALL), let's go down: |||%s|||\n", SKYPOPEN_P_LOG, @@ -478,8 +478,12 @@ int skypopen_signaling_read(private_t * tech_pvt) if (!strcasecmp(prop, "PARTNER_HANDLE")) { if (tech_pvt->interface_state != SKYPOPEN_STATE_SELECTED && (!strlen(tech_pvt->skype_call_id) || !strlen(tech_pvt->session_uuid_str))) { /* we are NOT inside an active call */ - DEBUGA_SKYPE("Call %s TRY ANSWER\n", SKYPOPEN_P_LOG, id); - skypopen_answer(tech_pvt, id, value); + DEBUGA_SKYPE("Call %s go to skypopen_partner_handle_ring\n", SKYPOPEN_P_LOG, id); + skypopen_strncpy(tech_pvt->ring_id, id, sizeof(tech_pvt->ring_id)); + skypopen_strncpy(tech_pvt->ring_value, value, sizeof(tech_pvt->ring_value)); + skypopen_strncpy(tech_pvt->answer_id, id, sizeof(tech_pvt->answer_id)); + skypopen_strncpy(tech_pvt->answer_value, value, sizeof(tech_pvt->answer_value)); + skypopen_partner_handle_ring(tech_pvt); } else { /* we are inside an active call */ if (!strcasecmp(tech_pvt->skype_call_id, id)) { @@ -553,7 +557,10 @@ int skypopen_signaling_read(private_t * tech_pvt) && (!strlen(tech_pvt->skype_call_id) || !strlen(tech_pvt->session_uuid_str))) { /* we are NOT inside an active call */ - DEBUGA_SKYPE("NO ACTIVE calls in this moment, skype_call %s is RINGING, to ask PARTNER_HANDLE\n", SKYPOPEN_P_LOG, id); + DEBUGA_SKYPE("NO ACTIVE calls in this moment, skype_call %s is RINGING, to ask PARTNER_DISPNAME and PARTNER_HANDLE\n", SKYPOPEN_P_LOG, id); + sprintf(msg_to_skype, "GET CALL %s PARTNER_DISPNAME", id); + skypopen_signaling_write(tech_pvt, msg_to_skype); + skypopen_sleep(100); sprintf(msg_to_skype, "GET CALL %s PARTNER_HANDLE", id); skypopen_signaling_write(tech_pvt, msg_to_skype); skypopen_sleep(10000); @@ -684,14 +691,7 @@ int skypopen_signaling_read(private_t * tech_pvt) skypopen_signaling_write(tech_pvt, msg_to_skype); } tech_pvt->skype_callflow = CALLFLOW_STATUS_INPROGRESS; - if (!strlen(tech_pvt->session_uuid_str)) { - DEBUGA_SKYPE("New Inbound Channel!\n\n\n\n", SKYPOPEN_P_LOG); - new_inbound_channel(tech_pvt); - } else { - tech_pvt->interface_state = SKYPOPEN_STATE_UP; - DEBUGA_SKYPE("Outbound Channel Answered! session_uuid_str=%s\n", SKYPOPEN_P_LOG, tech_pvt->session_uuid_str); - outbound_channel_answered(tech_pvt); - } + skypopen_answered(tech_pvt); } else { DEBUGA_SKYPE("I'm on %s, skype_call %s is NOT MY call, ignoring\n", SKYPOPEN_P_LOG, tech_pvt->skype_call_id, id); } @@ -1752,3 +1752,61 @@ while(XPending(disp)){ } #endif // WIN32 + +int inbound_channel_answered(private_t * tech_pvt) +{ + int res = 0; + switch_core_session_t *session = NULL; + switch_channel_t *channel = NULL; + + session = switch_core_session_locate(tech_pvt->session_uuid_str); + if (session) { + channel = switch_core_session_get_channel(session); + + if (channel) { + switch_set_flag(tech_pvt, TFLAG_IO); + } else { + ERRORA("no channel\n", SKYPOPEN_P_LOG); + } + switch_core_session_rwunlock(session); + } else { + ERRORA("no session\n", SKYPOPEN_P_LOG); + + } + return res; +} + + +int skypopen_answered(private_t * tech_pvt) +{ + + int res = 0; + switch_core_session_t *session = NULL; + switch_channel_t *channel = NULL; + + //WARNINGA("ANSWERED tech_pvt->skype_call_id=%s, tech_pvt->skype_callflow=%d, tech_pvt->interface_state=%d, tech_pvt->skype_user=%s, tech_pvt->callid_number=%s, tech_pvt->ring_value=%s, tech_pvt->ring_id=%s, tech_pvt->answer_value=%s, tech_pvt->answer_id=%s\n", SKYPOPEN_P_LOG, tech_pvt->skype_call_id, tech_pvt->skype_callflow, tech_pvt->interface_state, tech_pvt->skype_user, tech_pvt->callid_number, tech_pvt->ring_value, tech_pvt->ring_id, tech_pvt->answer_value, tech_pvt->answer_id); + + session = switch_core_session_locate(tech_pvt->session_uuid_str); + if (session) { + channel = switch_core_session_get_channel(session); + + if (channel) { + if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { + tech_pvt->interface_state = SKYPOPEN_STATE_UP; + DEBUGA_SKYPE("Outbound Channel Answered! session_uuid_str=%s\n", SKYPOPEN_P_LOG, tech_pvt->session_uuid_str); + outbound_channel_answered(tech_pvt); + } else { + DEBUGA_SKYPE("answered Inbound Channel!\n\n\n\n", SKYPOPEN_P_LOG); + inbound_channel_answered(tech_pvt); + } + + } else { + ERRORA("no channel\n", SKYPOPEN_P_LOG); + } + switch_core_session_rwunlock(session); + } else { + ERRORA("no session\n", SKYPOPEN_P_LOG); + + } + return res; +} ----------------------------------------------------------------------- Summary of changes: .gitignore | 25 +- Freeswitch.2008.express.sln | 74 +- Freeswitch.2008.sln | 142 +- Freeswitch.2010.express.sln | 53 + Freeswitch.2010.sln | 1335 +++++++- Makefile.am | 39 +- bootstrap.sh | 10 +- build/Makefile.am | 5 + build/modules.conf.in | 8 +- build/sounds_version.txt | 2 +- conf/autoload_configs/acl.conf.xml | 3 + conf/autoload_configs/callcenter.conf.xml | 27 +- conf/autoload_configs/cdr_pg_csv.conf.xml | 22 +- conf/autoload_configs/cdr_sqlite.conf.xml | 18 + conf/autoload_configs/easyroute.conf.xml | 3 + conf/autoload_configs/erlang_event.conf.xml | 9 + conf/autoload_configs/modules.conf.xml | 5 + conf/autoload_configs/sangoma_codec.conf.xml | 35 +- conf/autoload_configs/switch.conf.xml | 16 +- conf/autoload_configs/voicemail.conf.xml | 7 +- conf/dialplan/default.xml | 35 +- conf/dialplan/default/99999_enum.xml | 8 - conf/dialplan/features.xml | 8 + conf/dialplan/public.xml | 1 + conf/directory/default.xml | 2 +- conf/directory/default/default.xml | 2 +- conf/directory/default/skinny-example.xml | 1 + conf/lang/en/dir/sounds.xml | 18 +- conf/notify-voicemail.tpl | 2 + conf/sip_profiles/internal.xml | 33 +- conf/skinny_profiles/internal.xml | 12 + conf/vars.xml | 3 + conf/voicemail.tpl | 2 + configure.in | 11 + debian/READ_BEFORE_CHANGING_ANYTHING_IN_HERE | 29 + debian/changelog | 74 +- debian/compat | 2 +- debian/control | 69 +- debian/copyright | 559 +++- debian/freeswitch-codec-passthru-amrwb.install | 1 + debian/freeswitch-freetdm.conffiles | 6 + debian/freeswitch-freetdm.install | 10 + debian/freeswitch-python.config | 1 + debian/freeswitch-python.install | 3 + debian/freeswitch.conffiles | 7 +- debian/freeswitch.init | 29 +- debian/freeswitch.install | 42 +- debian/postinst | 9 +- debian/postrm | 2 +- debian/rules | 192 +- .../debian/changelog | 15 + .../freeswitch-sounds-en-us-callie/debian/control | 13 +- .../freeswitch-sounds-en-us-callie/debian/files | 6 - .../freeswitch-sounds-music/debian/changelog | 15 + .../sounds/freeswitch-sounds-music/debian/control | 15 +- debian/sounds/freeswitch-sounds-music/debian/files | 6 - .../freeswitch-sounds-ru-RU-elena/debian/changelog | 15 + .../freeswitch-sounds-ru-RU-elena/debian/files | 6 - debian/sounds/getsounds.sh | 4 +- debian/source/format | 1 + debian/substvars | 1 - devel-bootstrap.sh | 6 + docs/ChangeLog | 414 ++- docs/Doxygen.conf | 2 +- docs/phrase/phrase_en.xml | 58 +- docs/phrase/phrase_es_ES.xml | 994 +++++ docs/phrase/phrase_es_MX.xml | 993 +++++ docs/phrase/phrase_pt_BR.xml | 987 +++++ docs/phrase/phrase_pt_PT.xml | 987 +++++ freeswitch-sounds-en-us-callie.spec | 339 ++ freeswitch.spec | 431 ++- fscomm/FSComm.2008.vcproj | 972 +++--- fscomm/MakeVcProj.cmd | 5 + libs/.gitignore | 2 + libs/apr-util/.update | 2 +- libs/apr-util/include/apr_queue.h | 16 + libs/apr-util/misc/apr_queue.c | 65 + libs/apr/.update | 2 +- libs/apr/strings/apr_snprintf.c | 13 +- libs/broadvoice/configure.ac | 2 +- .../src/libbroadvoice.2010.vcxproj.filters | 167 + libs/esl/Makefile | 6 +- libs/esl/fs_cli.2010.vcxproj.filters | 30 + libs/esl/fs_cli.c | 6 +- libs/esl/java/Makefile | 2 +- libs/esl/lua/esl_lua.2008.sln | 26 + libs/esl/lua/esl_lua.2008.vcproj | 351 ++ libs/esl/managed/ESL.2010.vcxproj | 195 + libs/esl/managed/ESL.2010.vcxproj.filters | 30 + libs/esl/managed/ManagedEsl.2010.csproj | 93 + .../ManagedEslTest/ManagedEslTest.2010.csproj | 98 + libs/esl/managed/managed_esl.2010.sln | 74 + libs/esl/perl/ESL/Dispatch.pm | 5 +- libs/esl/perl/logger.pl | 4 +- libs/esl/php/Makefile | 2 +- libs/esl/src/esl.2008.vcproj | 8 + libs/esl/src/esl.2010.vcxproj | 2 + libs/esl/src/esl.2010.vcxproj.filters | 47 + libs/esl/src/esl.c | 164 +- libs/esl/src/esl_buffer.c | 353 ++ libs/esl/src/esl_config.c | 2 +- libs/esl/src/esl_event.c | 3 + libs/esl/src/esl_json.c | 2 +- libs/esl/src/include/esl.h | 8 +- libs/esl/src/include/esl_buffer.h | 146 + libs/freetdm/.gitignore | 14 + libs/freetdm/CMakeLists.txt | 244 ++ libs/freetdm/Makefile.am | 329 +- libs/freetdm/README | 4 +- libs/freetdm/TODO | 15 +- libs/freetdm/bootstrap | 2 +- .../freetdm/build}/ax_compiler_vendor.m4 | 0 libs/freetdm/build/libpcap.m4 | 14 +- libs/freetdm/conf/freetdm.conf | 72 +- libs/freetdm/conf/freetdm.conf.xml | 312 ++- libs/freetdm/conf/m3ua.conf | 38 - libs/freetdm/conf/pika.conf | 2 + libs/freetdm/conf/tones.conf | 2 + libs/freetdm/configure.ac | 455 ++- libs/freetdm/configure.gnu | 4 +- libs/freetdm/cyginstall.sh | 7 +- libs/freetdm/docs/async.txt | 14 + libs/freetdm/docs/glare.txt | 25 + libs/freetdm/docs/io_modules.txt | 13 + libs/freetdm/docs/locking.txt | 125 + libs/freetdm/docs/sigstatus.txt | 59 + libs/freetdm/freetdm.2008.sln | 23 +- libs/freetdm/freetdm.2010.sln | 133 + libs/freetdm/mkrelease.sh | 64 + libs/freetdm/mod_freetdm/CMakeLists.txt | 32 + libs/freetdm/mod_freetdm/mod_freetdm.2010.vcxproj | 217 ++ .../mod_freetdm/mod_freetdm.2010.vcxproj.filters | 14 + libs/freetdm/mod_freetdm/mod_freetdm.c | 1273 ++++--- libs/freetdm/msvc/freetdm.2008.vcproj | 50 +- libs/freetdm/msvc/freetdm.2010.vcxproj | 223 ++ libs/freetdm/msvc/freetdm.2010.vcxproj.filters | 128 + .../msvc/testanalog/testanalog.2010.vcxproj | 213 ++ .../testanalog/testanalog.2010.vcxproj.filters | 14 + libs/freetdm/msvc/testboost/testboost.2008.vcproj | 48 +- libs/freetdm/msvc/testboost/testboost.2010.vcxproj | 218 ++ .../msvc/testboost/testboost.2010.vcxproj.filters | 14 + .../msvc/testboost/testsangomaboost.2008.vcproj | 46 +- .../msvc/testboost/testsangomaboost.2010.vcxproj | 218 ++ .../testsangomaboost.2010.vcxproj.filters | 14 + libs/freetdm/msvc/testisdn/testisdn.2010.vcxproj | 213 ++ .../msvc/testisdn/testisdn.2010.vcxproj.filters | 14 + libs/freetdm/openzap.2005.sln | 82 - libs/freetdm/patches/oz.diff | 134 - libs/freetdm/sample/CMakeLists.txt | 8 + libs/freetdm/sample/boost/CMakeLists.txt | 12 + libs/freetdm/sample/boost/ftdmstart.c | 7 - libs/freetdm/sample/dso/CMakeLists.txt | 12 + libs/freetdm/sample/dso/ftdmload.c | 2 - libs/freetdm/sample/sched/CMakeLists.txt | 12 + libs/freetdm/sample/sched/ftdmsched.c | 2 - libs/freetdm/src/ftdm_call_utils.c | 169 + libs/freetdm/src/ftdm_config.c | 70 +- libs/freetdm/src/ftdm_io.c | 2780 ++++++++++---- libs/freetdm/src/ftdm_m3ua.c | 692 ---- libs/freetdm/src/ftdm_sched.c | 148 +- libs/freetdm/src/ftdm_state.c | 542 +++ libs/freetdm/src/ftdm_threadmutex.c | 47 +- libs/freetdm/src/ftmod/ftmod_analog/ftdm_analog.h | 9 +- .../ftmod/ftmod_analog/ftmod_analog.2008.vcproj | 706 ++-- .../ftmod/ftmod_analog/ftmod_analog.2010.vcxproj | 198 + .../ftmod_analog/ftmod_analog.2010.vcxproj.filters | 23 + libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.c | 306 ++- .../ftmod/ftmod_analog/ozmod_analog.2005.vcproj | 202 - .../ftmod_analog_em/ftmod_analog_em.2008.vcproj | 706 ++-- .../ftmod_analog_em/ftmod_analog_em.2010.vcxproj | 198 + .../ftmod_analog_em.2010.vcxproj.filters | 23 + .../src/ftmod/ftmod_analog_em/ftmod_analog_em.c | 17 +- .../ftmod_analog_em/ozmod_analog_em.2005.vcproj | 202 - libs/freetdm/src/ftmod/ftmod_isdn/ftdm_isdn.h | 96 - .../src/ftmod/ftmod_isdn/ftmod_isdn.2010.vcxproj | 223 ++ .../ftmod_isdn/ftmod_isdn.2010.vcxproj.filters | 110 + libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c | 2166 +++++++----- libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h | 102 + .../src/ftmod/ftmod_isdn/ozmod_isdn.2005.vcproj | 316 -- libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c | 1563 ++++++--- libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.h | 32 +- libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.c | 152 +- libs/freetdm/src/ftmod/ftmod_libpri/lpwrap_pri.h | 8 +- .../src/ftmod/ftmod_pika/ftmod_pika.2010.vcxproj | 198 + .../ftmod_pika/ftmod_pika.2010.vcxproj.filters | 23 + libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.c | 36 +- libs/freetdm/src/ftmod/ftmod_pritap/ftmod_pritap.c | 35 +- .../src/ftmod/ftmod_r2/ftmod_r2.2008.vcproj | 192 + .../src/ftmod/ftmod_r2/ftmod_r2.2010.vcxproj | 159 + .../ftmod/ftmod_r2/ftmod_r2.2010.vcxproj.filters | 22 + libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c | 2050 ++++++++--- .../ftmod/ftmod_sangoma_boost/ftdm_sangoma_boost.h | 2 +- .../ftmod_sangoma_boost.2008.vcproj | 58 +- .../ftmod_sangoma_boost.2010.vcxproj | 206 + .../ftmod_sangoma_boost.2010.vcxproj.filters | 35 + .../ftmod_sangoma_boost/ftmod_sangoma_boost.c | 109 +- .../ftmod_sangoma_boost/sangoma_boost_client.c | 2 + .../ftmod_sangoma_isdn.2008.vcproj | 245 ++ .../ftmod_sangoma_isdn.2010.vcxproj | 202 + .../ftmod_sangoma_isdn.2010.vcxproj.filters | 57 + .../ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c | 1157 ++++--- .../ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h | 441 ++- .../ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c | 252 ++- .../ftmod_sangoma_isdn/ftmod_sangoma_isdn_cntrl.c | 21 +- .../ftmod_sangoma_isdn_stack_cfg.c | 571 ++-- .../ftmod_sangoma_isdn_stack_cntrl.c | 173 +- .../ftmod_sangoma_isdn_stack_hndl.c | 1274 +++++++ .../ftmod_sangoma_isdn_stack_in.c | 935 ----- .../ftmod_sangoma_isdn_stack_out.c | 557 ++-- .../ftmod_sangoma_isdn_stack_rcv.c | 1014 +++++ .../ftmod_sangoma_isdn_support.c | 1003 +++++- .../ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.c | 325 ++- .../ftmod_sangoma_isdn/ftmod_sangoma_isdn_trace.h | 98 +- .../ftmod_sangoma_isdn/ftmod_sangoma_isdn_user.h | 118 + .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c | 1476 ++++++++ .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c | 2685 +++++++++----- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c | 1015 ++--- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c | 2200 +++++++++++ .../ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c | 1735 ++------- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c | 760 ++++ .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c | 2548 ++++++++------ .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h | 796 ++++- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c | 1124 ++++-- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c | 102 + .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_sts.c | 61 + .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c | 1296 ++++++-- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_timers.c | 2 +- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c | 3926 +++++++++++--------- .../ftmod/ftmod_wanpipe/ftmod_wanpipe.2010.vcxproj | 201 + .../ftmod_wanpipe.2010.vcxproj.filters | 18 + .../src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c | 660 +++- .../ftmod/ftmod_wanpipe/ozmod_wanpipe.2005.vcproj | 196 - .../ftmod/ftmod_wanpipe/wanpipe_tdm_api_iface.h | 351 -- libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c | 350 ++- libs/freetdm/src/include/freetdm.h | 730 +++- libs/freetdm/src/include/ftdm_call_utils.h | 135 + libs/freetdm/src/include/ftdm_declare.h | 37 + libs/freetdm/src/include/ftdm_os.h | 10 +- libs/freetdm/src/include/private/ftdm_core.h | 187 +- libs/freetdm/src/include/private/ftdm_m3ua.h | 134 - libs/freetdm/src/include/private/ftdm_sched.h | 17 +- libs/freetdm/src/include/private/ftdm_state.h | 243 ++ libs/freetdm/src/include/private/ftdm_types.h | 196 +- libs/freetdm/src/include/private/libteletone.h | 6 +- .../src/include/private/libteletone_detect.h | 2 +- .../src/include/private/libteletone_generate.h | 2 +- libs/freetdm/src/include/private/sangoma_tdm_api.h | 2 +- libs/freetdm/src/libteletone_detect.c | 4 +- libs/freetdm/src/libteletone_generate.c | 2 +- libs/freetdm/src/m3ua/mstm3ua.c | 62 - libs/freetdm/src/m3ua/mstm3ua.h | 96 - libs/freetdm/src/m3ua_client.c | 333 -- libs/freetdm/src/m3ua_client.h | 164 - libs/freetdm/src/priserver.c | 2 +- libs/freetdm/src/sangoma_pri.c | 2 +- libs/freetdm/src/sangoma_pri.h | 2 +- libs/freetdm/src/testanalog.c | 2 +- libs/freetdm/src/testm3ua.c | 60 - libs/freetdm/src/testr2.c | 144 +- libs/freetdm/src/testsangomaboost.c | 7 +- libs/iksemel/build/libgnutls.m4 | 4 +- libs/iksemel/configure.ac | 11 +- libs/iksemel/src/Makefile.am | 4 +- libs/iksemel/test/tst-ikstack.c | 2 +- libs/iksemel/test/tst-jid.c | 2 +- libs/iksemel/tools/Makefile.am | 6 +- libs/ilbc/configure.ac | 6 +- libs/ilbc/libilbc.2010.vcxproj.filters | 162 + libs/js/nsprpub/pr/src/io/prmwait.c | 2 +- libs/js/nsprpub/pr/src/md/unix/os_Linux_x86.s | 136 +- libs/js/nsprpub/pr/src/md/unix/os_Linux_x86_64.s | 110 +- libs/js/nsprpub/pr/src/md/unix/os_SunOS_x86.s | 154 +- libs/js/nsprpub/pr/src/md/unix/os_SunOS_x86_64.s | 106 +- libs/js/src/jscpucfg.h | 55 +- libs/js/src/jstypes.h | 191 +- libs/{iksemel => libcodec2}/.update | 0 libs/{freetdm => libcodec2}/AUTHORS | 0 libs/libcodec2/COPYING | 502 +++ libs/{freetdm => libcodec2}/ChangeLog | 0 libs/{iksemel => libcodec2}/INSTALL | 0 libs/libcodec2/Makefile.am | 98 + libs/{freetdm => libcodec2}/NEWS | 0 libs/{libsndfile/src/G72x => libcodec2}/README | 0 libs/{apr => libcodec2}/configure.gnu | 0 libs/libcodec2/configure.in | 26 + libs/libcodec2/doc/A_m.gif | Bin 0 -> 133 bytes libs/libcodec2/doc/omega_0.gif | Bin 0 -> 552 bytes libs/libcodec2/doc/phi_m.gif | Bin 0 -> 135 bytes libs/libcodec2/doc/s_n.gif | Bin 0 -> 3602 bytes libs/libcodec2/doc/s_n.txt | 1 + libs/libcodec2/octave/glottal.m | 25 + libs/libcodec2/octave/load_raw.m | 8 + libs/libcodec2/octave/lsp_pdf.m | 50 + libs/libcodec2/octave/phase.m | 56 + libs/libcodec2/octave/phase2.m | 50 + libs/libcodec2/octave/pitch_test.m | 39 + libs/libcodec2/octave/pl.m | 42 + libs/libcodec2/octave/pl2.m | 50 + libs/libcodec2/octave/plamp.m | 166 + libs/libcodec2/octave/plinterp.m | 11 + libs/libcodec2/octave/plnlp.m | 134 + libs/libcodec2/octave/plphase.m | 198 + libs/libcodec2/octave/plpitch.m | 36 + libs/libcodec2/octave/png.m | 25 + libs/libcodec2/octave/postfilter.m | 24 + libs/libcodec2/octave/pulse.m | 37 + libs/libcodec2/pitch/hts1a.p | 298 ++ libs/libcodec2/pitch/hts2a.p | 300 ++ libs/libcodec2/raw/b0067.raw | Bin 0 -> 58482 bytes libs/libcodec2/raw/f2400.raw | Bin 0 -> 27680 bytes libs/libcodec2/raw/forig.raw | Bin 0 -> 25224 bytes libs/libcodec2/raw/forig_g729a.raw | Bin 0 -> 25120 bytes libs/libcodec2/raw/forig_gsm13k.raw | Bin 0 -> 25280 bytes libs/libcodec2/raw/forig_speex_8k.raw | Bin 0 -> 25280 bytes libs/libcodec2/raw/hts.raw | Bin 0 -> 384000 bytes libs/libcodec2/raw/hts1.raw | Bin 0 -> 96000 bytes libs/libcodec2/raw/hts1a.raw | Bin 0 -> 48000 bytes libs/libcodec2/raw/hts1a_g729a.raw | Bin 0 -> 48000 bytes libs/libcodec2/raw/hts1a_gsm13k.raw | Bin 0 -> 48000 bytes libs/libcodec2/raw/hts1a_speex_8k.raw | Bin 0 -> 47956 bytes libs/libcodec2/raw/hts2.raw | Bin 0 -> 96000 bytes libs/libcodec2/raw/hts2a.raw | Bin 0 -> 48000 bytes libs/libcodec2/raw/hts2a_g729a.raw | Bin 0 -> 48000 bytes libs/libcodec2/raw/hts2a_gsm13k.raw | Bin 0 -> 48000 bytes libs/libcodec2/raw/hts2a_speex_8k.raw | Bin 0 -> 47780 bytes libs/libcodec2/raw/m2400.raw | Bin 0 -> 33624 bytes libs/libcodec2/raw/mmt1.raw | Bin 0 -> 64000 bytes libs/libcodec2/raw/mmt1_g729a.raw | Bin 0 -> 64000 bytes libs/libcodec2/raw/mmt1_gsm13k.raw | Bin 0 -> 64000 bytes libs/libcodec2/raw/mmt1_speex_8k.raw | Bin 0 -> 64000 bytes libs/libcodec2/raw/morig.raw | Bin 0 -> 32056 bytes libs/libcodec2/raw/morig_g729a.raw | Bin 0 -> 32000 bytes libs/libcodec2/raw/morig_gsm13k.raw | Bin 0 -> 32320 bytes libs/libcodec2/raw/morig_speex_8k.raw | Bin 0 -> 32056 bytes libs/libcodec2/script/menu.sh | 70 + libs/libcodec2/script/playraw.sh | 6 + libs/libcodec2/script/raw2wav.sh | 3 + libs/libcodec2/script/wav2raw.sh | 3 + libs/libcodec2/src/Makefile.am | 53 + libs/libcodec2/src/c2dec.c | 80 + libs/libcodec2/src/c2enc.c | 82 + libs/libcodec2/src/c2sim.c | 408 ++ libs/libcodec2/src/codeall.sh | 9 + libs/libcodec2/src/codebook.c | 162 + libs/libcodec2/src/codebook.h | 15 + libs/libcodec2/src/codec2.c | 337 ++ libs/libcodec2/src/codec2.h | 43 + libs/libcodec2/src/comp.h | 39 + libs/libcodec2/src/defines.h | 84 + libs/libcodec2/src/dump.c | 402 ++ libs/libcodec2/src/dump.h | 63 + libs/libcodec2/src/four1.c | 64 + libs/libcodec2/src/four1.h | 18 + libs/libcodec2/src/fq20.sh | 8 + libs/libcodec2/src/globals.c | 50 + libs/libcodec2/src/globals.h | 48 + libs/libcodec2/src/interp.c | 122 + libs/libcodec2/src/interp.h | 34 + libs/libcodec2/src/listen.sh | 9 + libs/libcodec2/src/listen1.sh | 15 + libs/libcodec2/src/listensim.sh | 9 + libs/libcodec2/src/lpc.c | 253 ++ libs/libcodec2/src/lpc.h | 42 + libs/libcodec2/src/lsp.c | 323 ++ libs/libcodec2/src/lsp.h | 20 + libs/libcodec2/src/nlp.c | 361 ++ libs/libcodec2/src/nlp.h | 38 + libs/libcodec2/src/pack.c | 104 + libs/libcodec2/src/phase.c | 254 ++ libs/libcodec2/src/phase.h | 34 + libs/libcodec2/src/postfilter.c | 131 + libs/libcodec2/src/postfilter.h | 34 + libs/libcodec2/src/quantise.c | 868 +++++ libs/libcodec2/src/quantise.h | 84 + libs/libcodec2/src/sim.sh | 18 + libs/libcodec2/src/sine.c | 530 +++ libs/libcodec2/src/sine.h | 40 + libs/libcodec2/unittest/Makefile.am | 41 + libs/libcodec2/unittest/extract.c | 121 + libs/libcodec2/unittest/genlsp.c | 149 + libs/libcodec2/unittest/genres.c | 92 + libs/libcodec2/unittest/lsp1.txt | 16 + libs/libcodec2/unittest/lsp10.txt | 5 + libs/libcodec2/unittest/lsp2.txt | 16 + libs/libcodec2/unittest/lsp3.txt | 16 + libs/libcodec2/unittest/lsp4.txt | 16 + libs/libcodec2/unittest/lsp5.txt | 18 + libs/libcodec2/unittest/lsp6.txt | 18 + libs/libcodec2/unittest/lsp7.txt | 18 + libs/libcodec2/unittest/lsp8.txt | 10 + libs/libcodec2/unittest/lsp9.txt | 10 + libs/libcodec2/unittest/lspd123.txt | 1024 +++++ libs/libcodec2/unittest/lspd456.txt | 1024 +++++ libs/libcodec2/unittest/lspd78.txt | 64 + libs/libcodec2/unittest/lspd910.txt | 64 + libs/libcodec2/unittest/lsptest.c | 177 + libs/libcodec2/unittest/sd.c | 84 + libs/libcodec2/unittest/tcodec2.c | 215 ++ libs/libcodec2/unittest/tcontphase.c | 187 + libs/libcodec2/unittest/tinterp.c | 128 + libs/libcodec2/unittest/tnlp.c | 148 + libs/libcodec2/unittest/tquant.c | 215 ++ libs/libcodec2/unittest/vqtrain.c | 297 ++ libs/libcodec2/wav/f2400.wav | Bin 0 -> 27726 bytes libs/libcodec2/wav/forig.wav | Bin 0 -> 25268 bytes libs/libcodec2/wav/forig_speex_8k.wav | Bin 0 -> 25324 bytes libs/libcodec2/wav/hts1a.wav | Bin 0 -> 48044 bytes libs/libcodec2/wav/hts1a_c2_v0.1.wav | Bin 0 -> 48044 bytes libs/libcodec2/wav/hts1a_g729a.wav | Bin 0 -> 48044 bytes libs/libcodec2/wav/hts1a_speex_8k.wav | Bin 0 -> 48000 bytes libs/libcodec2/wav/hts2a.wav | Bin 0 -> 48044 bytes libs/libcodec2/wav/hts2a_c2_v0.1.wav | Bin 0 -> 48044 bytes libs/libcodec2/wav/hts2a_g729a.wav | Bin 0 -> 48044 bytes libs/libcodec2/wav/hts2a_speex_8k.wav | Bin 0 -> 47824 bytes libs/libcodec2/wav/m2400.wav | Bin 0 -> 33668 bytes libs/libcodec2/wav/mmt1.wav | Bin 0 -> 64044 bytes libs/libcodec2/wav/mmt1_speex_8k.wav | Bin 0 -> 64044 bytes libs/libcodec2/wav/morig.wav | Bin 0 -> 32100 bytes libs/libcodec2/wav/morig_speex_8k.wav | Bin 0 -> 32100 bytes .../libdingaling/libdingaling.2010.vcxproj.filters | 38 + libs/libdingaling/src/ldl_compat.h | 2 +- libs/libdingaling/src/libdingaling.c | 186 +- libs/libdingaling/src/libdingaling.h | 15 +- libs/libg722_1/Makefile.am | 6 +- libs/libg722_1/autogen.sh | 5 - libs/libg722_1/configure.ac | 34 +- libs/libg722_1/doc/Makefile.am | 2 - libs/libg722_1/g722_1.pc.in | 11 + libs/libg722_1/g722_1.spec.in | 3 +- libs/libg722_1/src/Makefile.am | 79 +- libs/libg722_1/src/basop32.c | 5 +- libs/libg722_1/src/basop32.h | 20 +- libs/libg722_1/src/bitstream.c | 2 - libs/libg722_1/src/bitstream.h | 2 - libs/libg722_1/src/coef2sam.c | 44 +- libs/libg722_1/src/coef2sam.h | 4 +- libs/libg722_1/src/common.c | 162 +- libs/libg722_1/src/commonf.c | 8 +- libs/libg722_1/src/dct4.c | 72 +- libs/libg722_1/src/dct4_a.c | 204 +- libs/libg722_1/src/dct4_a.h | 4 +- libs/libg722_1/src/dct4_s.c | 241 +- libs/libg722_1/src/dct4_s.h | 10 +- libs/libg722_1/src/decoder.c | 26 +- libs/libg722_1/src/decoderf.c | 23 +- libs/libg722_1/src/defs.h | 4 +- libs/libg722_1/src/encoder.c | 30 +- libs/libg722_1/src/encoderf.c | 24 +- libs/libg722_1/src/g722_1.h.in | 2 - libs/libg722_1/src/g722_1/g722_1.h | 4 +- libs/libg722_1/src/g722_1/version.h.in | 2 - libs/libg722_1/src/huff_tab.c | 4 +- libs/libg722_1/src/huff_tab.h | 4 +- libs/libg722_1/src/make_dct4_tables.c | 9 +- libs/libg722_1/src/make_tables.c | 26 +- libs/libg722_1/src/sam2coef.c | 49 +- libs/libg722_1/src/sam2coef.h | 4 +- libs/libg722_1/src/tables.c | 530 ++-- libs/libg722_1/src/tables.h | 4 +- libs/libg722_1/src/utilities.c | 467 +++ libs/libg722_1/src/utilities.h | 32 + libs/libg722_1/test-data/Makefile.am | 2 - libs/libg722_1/test-data/itu/Makefile.am | 2 - libs/libg722_1/test-data/local/Makefile.am | 2 - libs/libg722_1/tests/Makefile.am | 6 +- libs/libg722_1/tests/g192_bit_stream.c | 177 + libs/libg722_1/tests/g192_bit_stream.h | 75 + libs/libg722_1/tests/g722_1_tests.c | 8 +- libs/libg722_1/tests/itu_bit_stream.c | 139 - libs/libg722_1/tests/regression_tests.sh.in | 27 +- libs/libg722_1/tests/timing.h | 4 +- libs/libg722_1/unpack_g722_1_data.sh | 3 - libs/libsndfile/M4/lt~obsolete.m4 | 92 - libs/libteletone/libteletone.2010.vcxproj.filters | 36 + libs/libteletone/src/libteletone.h | 6 +- libs/libteletone/src/libteletone_detect.c | 4 +- libs/libteletone/src/libteletone_detect.h | 4 +- libs/libteletone/src/libteletone_generate.c | 11 +- libs/libteletone/src/libteletone_generate.h | 6 +- libs/openzap/mod_openzap/mod_openzap.c | 35 +- libs/openzap/src/include/libteletone.h | 6 +- libs/openzap/src/include/libteletone_detect.h | 2 +- libs/openzap/src/include/libteletone_generate.h | 2 +- libs/openzap/src/include/sangoma_tdm_api.h | 2 +- libs/openzap/src/libteletone_detect.c | 4 +- .../ozmod_sangoma_boost/ozmod_sangoma_boost.c | 4 +- .../src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c | 9 +- libs/openzap/src/ozmod/ozmod_zt/ozmod_zt.c | 16 +- libs/openzap/src/priserver.c | 2 +- libs/openzap/src/sangoma_pri.c | 2 +- libs/openzap/src/sangoma_pri.h | 2 +- libs/openzap/src/zap_io.c | 1 + .../build/msvc/portaudio.2010.vcxproj.filters | 132 + libs/silk/src/Silk_FIX.2010.vcxproj.filters | 413 ++ libs/sofia-sip/.update | 2 +- libs/sofia-sip/configure.ac | 1 + .../libsofia-sip-ua/http/sofia-sip/http.h | 4 + libs/sofia-sip/libsofia-sip-ua/msg/msg_tag.c | 4 + .../libsofia-sip-ua/msg/sofia-sip/msg_header.h | 5 + .../libsofia-sip-ua/msg/sofia-sip/msg_mime.h | 4 + libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c | 4 + libs/sofia-sip/libsofia-sip-ua/nta/nta.c | 24 +- libs/sofia-sip/libsofia-sip-ua/nua/nua_dialog.c | 5 + libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.h | 4 + libs/sofia-sip/libsofia-sip-ua/sip/sofia-sip/sip.h | 8 + libs/sofia-sip/libsofia-sip-ua/soa/soa.c | 4 + libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c | 4 + libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c | 2 +- .../libsofia-sip-ua/su/sofia-sip/su_errno.h | 40 + libs/sofia-sip/libsofia-sip-ua/su/su.c | 2 +- .../libsofia-sip-ua/tport/tport_internal.h | 4 + libs/sofia-sip/win32/config.h.in | 6 +- libs/spandsp/configure.ac | 4 +- libs/spandsp/spandsp.pc.in | 2 +- libs/spandsp/src/libspandsp.2010.vcxproj.filters | 667 ++++ libs/spandsp/src/libtiff.2010.vcxproj.filters | 157 + .../msvc/make_at_dictionary.2010.vcxproj.filters | 14 + .../msvc/make_modem_filter.2010.vcxproj.filters | 29 + libs/spandsp/src/spandsp.h.in | 3 +- libs/spandsp/src/spandsp/private/t30.h | 8 +- libs/spandsp/src/spandsp/t30.h | 6 + libs/spandsp/src/spandsp/t38_core.h | 2 +- libs/spandsp/src/t30.c | 453 +-- libs/spandsp/src/t31.c | 2 + libs/spandsp/src/t38_core.c | 2 +- libs/spandsp/src/t38_gateway.c | 63 +- libs/spandsp/src/v18.c | 2 +- libs/spandsp/unpack_gsm0610_data.sh | 4 +- .../win32/VS2008/libspeex/libspeex.vcxproj.filters | 210 ++ libs/sqlite/configure.ac | 2 +- libs/srtp/libsrtp.2010.vcxproj.filters | 200 + libs/stfu/stfu.c | 854 ++++- libs/stfu/stfu.h | 109 +- .../apr-toolkit/aprtoolkit.2010.vcxproj.filters | 125 + .../libs/apr-toolkit/src/apt_consumer_task.c | 1 + libs/unimrcp/libs/mpf/mpf.2010.vcxproj.filters | 239 ++ .../mrcp-client/mrcpclient.2010.vcxproj.filters | 35 + .../mrcpsignaling.2010.vcxproj.filters | 35 + libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj.filters | 133 + .../mrcpv2transport.2010.vcxproj.filters | 44 + .../libs/uni-rtsp/unirtsp.2010.vcxproj.filters | 56 + .../mrcp-sofiasip/mrcpsofiasip.2010.vcxproj | 1 - .../mrcpsofiasip.2010.vcxproj.filters | 35 + .../mrcp-unirtsp/mrcpunirtsp.2010.vcxproj.filters | 35 + libs/win32/Download CELT.vcproj | 4 +- libs/win32/Download CELT.vcxproj | 12 +- libs/win32/Download OPENSSL.2008.vcproj | 92 + libs/win32/Download OPENSSL.2010.vcxproj | 67 + libs/win32/Sound_Files/16khz.2008.vcproj | 52 +- libs/win32/Sound_Files/16khz.2010.vcxproj | 16 +- libs/win32/Sound_Files/16khzmusic.2008.vcproj | 48 + libs/win32/Sound_Files/32khz.2008.vcproj | 52 +- libs/win32/Sound_Files/32khz.2010.vcxproj | 16 +- libs/win32/Sound_Files/32khzmusic.2008.vcproj | 48 + libs/win32/Sound_Files/8khz.2008.vcproj | 52 +- libs/win32/Sound_Files/8khz.2010.vcxproj | 16 +- libs/win32/Sound_Files/8khzmusic.2008.vcproj | 48 + .../win32/apr-util/libaprutil.2010.vcxproj.filters | 303 ++ libs/win32/apr-util/xml.2010.vcxproj.filters | 79 + libs/win32/apr/libapr.2010.vcxproj.filters | 406 ++ libs/win32/celt/libcelt.vcproj | 50 +- libs/win32/celt/libcelt.vcxproj | 44 +- libs/win32/celt/libcelt.vcxproj.filters | 76 + libs/win32/curl/curllib.2010.vcxproj.filters | 358 ++ libs/win32/flite/flite.2010.vcxproj.filters | 558 +++ libs/win32/iksemel/iksemel.2010.vcxproj.filters | 69 + libs/win32/js/js.2010.vcxproj.filters | 464 +++ libs/win32/json/libjson.2008.vcproj | 4 +- libs/win32/json/libjson.2010.vcxproj | 4 +- libs/win32/json/libjson.2010.vcxproj.filters | 45 + libs/win32/libg722_1/libg722_1.vcproj | 8 + libs/win32/libg722_1/libg722_1.vcxproj | 2 + libs/win32/libg722_1/libg722_1.vcxproj.filters | 102 + .../libmp3lame/libmp3lame.2010.vcxproj.filters | 170 + libs/win32/libogg/libogg.2010.vcxproj.filters | 29 + libs/win32/libshout/libshout.vcxproj.filters | 80 + .../libsndfile/libsndfile.2010.vcxproj.filters | 234 ++ libs/win32/mpg123/libmpg123.2010.vcxproj.filters | 82 + libs/win32/openssl/applink.c | 94 + libs/win32/openssl/buildinf.h | 13 + libs/win32/openssl/include/aes.h | 2 + libs/win32/openssl/include/asn1.h | 2 + libs/win32/openssl/include/asn1_mac.h | 2 + libs/win32/openssl/include/asn1t.h | 2 + libs/win32/openssl/include/bio.h | 2 + libs/win32/openssl/include/blowfish.h | 2 + libs/win32/openssl/include/bn.h | 2 + libs/win32/openssl/include/buffer.h | 2 + libs/win32/openssl/include/camellia.h | 2 + libs/win32/openssl/include/cast.h | 2 + libs/win32/openssl/include/cms.h | 2 + libs/win32/openssl/include/comp.h | 2 + libs/win32/openssl/include/conf.h | 2 + libs/win32/openssl/include/conf_api.h | 2 + libs/win32/openssl/include/crypto.h | 2 + libs/win32/openssl/include/des.h | 2 + libs/win32/openssl/include/des_old.h | 2 + libs/win32/openssl/include/dh.h | 2 + libs/win32/openssl/include/dsa.h | 2 + libs/win32/openssl/include/dso.h | 2 + libs/win32/openssl/include/dtls1.h | 2 + libs/win32/openssl/include/e_os.h | 2 + libs/win32/openssl/include/e_os2.h | 2 + libs/win32/openssl/include/ebcdic.h | 2 + libs/win32/openssl/include/ec.h | 2 + libs/win32/openssl/include/ecdh.h | 2 + libs/win32/openssl/include/ecdsa.h | 2 + libs/win32/openssl/include/engine.h | 2 + libs/win32/openssl/include/err.h | 2 + libs/win32/openssl/include/evp.h | 2 + libs/win32/openssl/include/hmac.h | 2 + libs/win32/openssl/include/idea.h | 2 + libs/win32/openssl/include/krb5_asn.h | 2 + libs/win32/openssl/include/kssl.h | 2 + libs/win32/openssl/include/lhash.h | 2 + libs/win32/openssl/include/md2.h | 2 + libs/win32/openssl/include/md4.h | 2 + libs/win32/openssl/include/md5.h | 2 + libs/win32/openssl/include/mdc2.h | 2 + libs/win32/openssl/include/modes.h | 2 + libs/win32/openssl/include/o_dir.h | 2 + libs/win32/openssl/include/o_str.h | 2 + libs/win32/openssl/include/obj_mac.h | 2 + libs/win32/openssl/include/objects.h | 2 + libs/win32/openssl/include/ocsp.h | 2 + libs/win32/openssl/include/opensslv.h | 2 + libs/win32/openssl/include/ossl_typ.h | 2 + libs/win32/openssl/include/pem.h | 2 + libs/win32/openssl/include/pem2.h | 2 + libs/win32/openssl/include/pkcs12.h | 2 + libs/win32/openssl/include/pkcs7.h | 2 + libs/win32/openssl/include/pq_compat.h | 2 + libs/win32/openssl/include/pqueue.h | 2 + libs/win32/openssl/include/rand.h | 2 + libs/win32/openssl/include/rc2.h | 2 + libs/win32/openssl/include/rc4.h | 2 + libs/win32/openssl/include/rc5.h | 2 + libs/win32/openssl/include/ripemd.h | 2 + libs/win32/openssl/include/rsa.h | 2 + libs/win32/openssl/include/safestack.h | 2 + libs/win32/openssl/include/seed.h | 2 + libs/win32/openssl/include/sha.h | 2 + libs/win32/openssl/include/ssl.h | 2 + libs/win32/openssl/include/ssl2.h | 2 + libs/win32/openssl/include/ssl23.h | 2 + libs/win32/openssl/include/ssl3.h | 2 + libs/win32/openssl/include/stack.h | 2 + libs/win32/openssl/include/store.h | 2 + libs/win32/openssl/include/symhacks.h | 2 + libs/win32/openssl/include/tls1.h | 2 + libs/win32/openssl/include/tmdiff.h | 2 + libs/win32/openssl/include/ts.h | 2 + libs/win32/openssl/include/txt_db.h | 2 + libs/win32/openssl/include/ui.h | 2 + libs/win32/openssl/include/ui_compat.h | 2 + libs/win32/openssl/include/whrlpool.h | 2 + libs/win32/openssl/include/x509.h | 2 + libs/win32/openssl/include/x509_vfy.h | 2 + libs/win32/openssl/include/x509v3.h | 2 + libs/win32/openssl/libeay32.2008.vcproj | 3150 ++++++++++++++++ libs/win32/openssl/libeay32.2010.vcxproj | 871 +++++ libs/win32/openssl/libeay32.2010.vcxproj.filters | 2093 +++++++++++ libs/win32/openssl/libeay32.def | 3474 +++++++++++++++++ libs/win32/openssl/openssl.2008.vcproj | 585 +++ libs/win32/openssl/openssl.2010.vcxproj | 258 ++ libs/win32/openssl/openssl.2010.vcxproj.filters | 179 + libs/win32/openssl/opensslconf.h | 224 ++ libs/win32/openssl/ssleay32.2008.vcproj | 559 +++ libs/win32/openssl/ssleay32.2010.vcxproj | 254 ++ libs/win32/openssl/ssleay32.2010.vcxproj.filters | 167 + libs/win32/openssl/ssleay32.def | 243 ++ libs/win32/pcre/libpcre.2010.vcxproj.filters | 95 + .../pcre/pcre_chartables.c.2010.vcxproj.filters | 22 + .../pocketsphinx/pocketsphinx.2010.vcxproj.filters | 217 ++ libs/win32/pthread/pthread.2010.vcxproj.filters | 41 + .../win32/sofia/libsofia_sip_ua_static.2008.vcproj | 22 +- .../sofia/libsofia_sip_ua_static.2010.vcxproj | 16 +- .../libsofia_sip_ua_static.2010.vcxproj.filters | 1019 +++++ .../sphinxbase/sphinxbase.2010.vcxproj.filters | 354 ++ libs/win32/sqlite/sqlite.2010.vcxproj.filters | 182 + libs/win32/udns/libudns.2010.vcxproj.filters | 66 + libs/xmlrpc-c/Windows/abyss.2010.vcxproj.filters | 131 + libs/xmlrpc-c/Windows/xmlrpc.2010.vcxproj.filters | 287 ++ libs/xmlrpc-c/lib/abyss/src/socket_win.c | 143 +- scripts/c/socket2me/socket2me.c | 2 +- scripts/javascript/api.js | 6 +- scripts/javascript/js_modules/SpeechTools.jm | 6 +- scripts/javascript/pizza.js | 6 +- scripts/javascript/ps_pizza.js | 6 +- scripts/lua/zrtp_agent.lua | 2 +- scripts/perl/add_user | 306 ++ scripts/perl/blacklist.pl | 33 + scripts/perl/honeypot.pl | 26 + scripts/perl/sendmail | 2 +- scripts/python/freepy/__init__.py | 4 +- scripts/python/freepy/fseventlistener.py | 4 +- scripts/python/freepy/fshelper.py | 4 +- scripts/python/freepy/models.py | 4 +- scripts/python/freepy/request.py | 4 +- scripts/rss/rss2ivr.pl | 2 +- scripts/trace/sipgrep | 2 +- src/fs_encode.c | 246 ++ src/include/private/switch_core_pvt.h | 17 +- src/include/switch.h | 5 +- src/include/switch_apr.h | 20 +- src/include/switch_bitpack.h | 2 +- src/include/switch_buffer.h | 2 +- src/include/switch_caller.h | 4 +- src/include/switch_channel.h | 52 +- src/include/switch_config.h | 4 +- src/include/switch_console.h | 2 +- src/include/switch_core.h | 50 +- src/include/switch_core_db.h | 2 +- src/include/switch_core_event_hook.h | 14 +- src/include/switch_cpp.h | 6 +- src/include/switch_event.h | 8 +- src/include/switch_frame.h | 2 +- src/include/switch_ivr.h | 52 +- src/include/switch_limit.h | 2 +- src/include/switch_loadable_module.h | 23 +- src/include/switch_log.h | 2 +- src/include/switch_module_interfaces.h | 66 +- src/include/switch_nat.h | 2 +- src/include/switch_odbc.h | 10 +- src/include/switch_platform.h | 2 +- src/include/switch_regex.h | 2 +- src/include/switch_resample.h | 2 +- src/include/switch_rtp.h | 13 +- src/include/switch_scheduler.h | 2 +- src/include/switch_stun.h | 2 +- src/include/switch_types.h | 115 +- src/include/switch_utils.h | 86 +- src/include/switch_xml.h | 3 +- src/include/switch_xml_config.h | 2 +- src/mod/.gitignore | 1 + src/mod/applications/mod_avmd/buffer.h | 6 +- .../mod_avmd/mod_avmd.2010.vcxproj.filters | 42 + src/mod/applications/mod_avmd/mod_avmd.c | 3 +- .../applications/mod_callcenter/mod_callcenter.c | 948 ++++-- src/mod/applications/mod_cidlookup/mod_cidlookup.c | 2 +- src/mod/applications/mod_cluechoo/mod_cluechoo.c | 2 +- src/mod/applications/mod_commands/mod_commands.c | 436 ++- .../applications/mod_conference/mod_conference.c | 732 +++-- src/mod/applications/mod_curl/mod_curl.c | 3 +- src/mod/applications/mod_db/mod_db.c | 2 +- .../mod_directory/mod_directory.2008.vcproj | 2 +- .../mod_directory/mod_directory.2010.vcxproj | 130 + src/mod/applications/mod_directory/mod_directory.c | 28 +- .../mod_distributor/mod_distributor.2010.vcxproj | 130 + .../applications/mod_distributor/mod_distributor.c | 2 +- src/mod/applications/mod_dptools/mod_dptools.c | 326 ++- src/mod/applications/mod_easyroute/mod_easyroute.c | 15 +- src/mod/applications/mod_enum/mod_enum.c | 2 +- src/mod/applications/mod_esf/mod_esf.c | 2 +- src/mod/applications/mod_expr/mod_expr.c | 2 +- src/mod/applications/mod_fax/mod_fax.c | 2 +- src/mod/applications/mod_fifo/mod_fifo.c | 322 +- src/mod/applications/mod_fsk/Makefile | 6 + .../src => src/mod/applications/mod_fsk}/fsk.c | 0 .../include => src/mod/applications/mod_fsk}/fsk.h | 0 src/mod/applications/mod_fsk/fsk_callerid.c | 398 ++ src/mod/applications/mod_fsk/fsk_callerid.h | 144 + src/mod/applications/mod_fsk/mod_fsk.c | 486 +++ .../src => src/mod/applications/mod_fsk}/uart.c | 0 .../mod/applications/mod_fsk}/uart.h | 0 src/mod/applications/mod_fsv/mod_fsv.c | 2 +- src/mod/applications/mod_hash/mod_hash.c | 31 +- src/mod/applications/mod_lcr/mod_lcr.c | 24 +- src/mod/applications/mod_limit/mod_limit.c | 2 +- src/mod/applications/mod_memcache/mod_memcache.c | 2 +- src/mod/applications/mod_mp4/Makefile | 6 + src/mod/applications/mod_mp4/exception.hpp | 59 + src/mod/applications/mod_mp4/mod_mp4.cpp | 547 +++ src/mod/applications/mod_mp4/mp4_helper.cpp | 133 + src/mod/applications/mod_mp4/mp4_helper.hpp | 137 + .../applications/mod_nibblebill/mod_nibblebill.c | 8 +- src/mod/applications/mod_rad_auth/mod_rad_auth.c | 6 +- src/mod/applications/mod_redis/mod_redis.c | 4 +- src/mod/applications/mod_rss/mod_rss.c | 2 +- src/mod/applications/mod_skel/mod_skel.c | 2 +- src/mod/applications/mod_snapshot/mod_snapshot.c | 21 +- .../applications/mod_snipe_hunt/mod_snipe_hunt.c | 2 +- src/mod/applications/mod_snom/mod_snom.c | 2 +- .../applications/mod_soundtouch/mod_soundtouch.cpp | 2 +- src/mod/applications/mod_spandsp/mod_spandsp.c | 2 +- src/mod/applications/mod_spandsp/mod_spandsp.h | 2 +- .../applications/mod_spandsp/mod_spandsp_codecs.c | 2 +- src/mod/applications/mod_spandsp/mod_spandsp_dsp.c | 10 +- src/mod/applications/mod_spandsp/mod_spandsp_fax.c | 221 +- src/mod/applications/mod_spandsp/udptl.c | 8 +- src/mod/applications/mod_spy/mod_spy.c | 22 +- src/mod/applications/mod_stress/mod_stress.cpp | 2 +- .../mod_valet_parking.2010.vcxproj | 4 - .../mod_valet_parking/mod_valet_parking.c | 25 +- src/mod/applications/mod_voicemail/mod_voicemail.c | 180 +- src/mod/asr_tts/mod_cepstral/WinReadme.txt | 4 + .../asr_tts/mod_cepstral/mod_cepstral.2010.vcxproj | 19 +- src/mod/asr_tts/mod_cepstral/mod_cepstral.c | 2 +- src/mod/asr_tts/mod_flite/mod_flite.c | 2 +- .../asr_tts/mod_pocketsphinx/mod_pocketsphinx.c | 2 +- .../asr_tts/mod_unimrcp/mod_unimrcp.2010.vcxproj | 10 +- src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c | 125 +- src/mod/codecs/mod_amr/mod_amr.c | 170 +- src/mod/codecs/mod_amrwb/mod_amrwb.c | 4 +- src/mod/codecs/mod_bv/mod_bv.c | 2 +- src/mod/codecs/mod_celt/Makefile | 2 +- src/mod/codecs/mod_celt/mod_celt.c | 38 +- src/mod/codecs/mod_celt/mod_celt.vcproj | 8 +- src/mod/codecs/mod_celt/mod_celt.vcxproj | 12 +- src/mod/codecs/mod_codec2/Makefile | 14 + src/mod/codecs/mod_codec2/mod_codec2.c | 264 ++ src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c | 2 +- src/mod/codecs/mod_g723_1/mod_g723_1.c | 2 +- src/mod/codecs/mod_g729/mod_g729.c | 2 +- src/mod/codecs/mod_h26x/mod_h26x.c | 2 +- src/mod/codecs/mod_ilbc/mod_ilbc.c | 46 +- src/mod/codecs/mod_mp4v/mod_mp4v.c | 2 +- .../codecs/mod_sangoma_codec/mod_sangoma_codec.c | 661 +++- src/mod/codecs/mod_silk/mod_silk.c | 207 +- src/mod/codecs/mod_siren/mod_siren.c | 78 +- src/mod/codecs/mod_skel_codec/mod_skel_codec.c | 2 +- src/mod/codecs/mod_speex/mod_speex.c | 155 +- src/mod/codecs/mod_theora/mod_theora.c | 2 +- src/mod/codecs/mod_voipcodecs/mod_voipcodecs.c | 2 +- .../mod_dialplan_asterisk/mod_dialplan_asterisk.c | 2 +- .../mod_dialplan_directory.c | 2 +- .../dialplans/mod_dialplan_xml/mod_dialplan_xml.c | 2 +- src/mod/directories/mod_ldap/mod_ldap.c | 2 +- src/mod/endpoints/mod_alsa/mod_alsa.c | 6 +- src/mod/endpoints/mod_dingaling/mod_dingaling.c | 115 +- .../alsa_nogsmlib_nocplusplus/mod_gsmopen/Makefile | 3 +- src/mod/endpoints/mod_gsmopen/gsmopen.h | 6 +- src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp | 20 +- src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp | 38 +- src/mod/endpoints/mod_h323/Makefile | 10 +- src/mod/endpoints/mod_h323/changes.txt | 4 + src/mod/endpoints/mod_h323/compiling.txt | 1 + src/mod/endpoints/mod_h323/mod_h323.2010.vcxproj | 151 + src/mod/endpoints/mod_h323/mod_h323.cpp | 50 +- src/mod/endpoints/mod_h323/mod_h323.h | 9 +- src/mod/endpoints/mod_h323/mod_h323_2008.vcproj | 148 +- .../mod_khomp/Install/files/khomp.conf.xml | 487 +++ src/mod/endpoints/mod_khomp/Makefile | 57 + .../endpoints/mod_khomp/commons/base/atomic.hpp | 203 + .../mod_khomp/commons/base/config_commons.hpp | 74 + .../mod_khomp/commons/base/config_options.cpp | 302 ++ .../mod_khomp/commons/base/config_options.hpp | 772 ++++ .../commons/base/configurator/configfile.cpp | 241 ++ .../commons/base/configurator/configfile.hpp | 90 + .../mod_khomp/commons/base/configurator/option.cpp | 186 + .../mod_khomp/commons/base/configurator/option.hpp | 128 + .../commons/base/configurator/restriction.cpp | 358 ++ .../commons/base/configurator/restriction.hpp | 269 ++ .../commons/base/configurator/section.cpp | 136 + .../commons/base/configurator/section.hpp | 260 ++ .../mod_khomp/commons/base/const_this.hpp | 15 + .../endpoints/mod_khomp/commons/base/flagger.hpp | 102 + .../endpoints/mod_khomp/commons/base/format.cpp | 337 ++ .../endpoints/mod_khomp/commons/base/format.hpp | 561 +++ .../endpoints/mod_khomp/commons/base/function.hpp | 429 +++ .../mod_khomp/commons/base/initializer.hpp | 80 + .../endpoints/mod_khomp/commons/base/k3lapi.cpp | 309 ++ .../endpoints/mod_khomp/commons/base/k3lapi.hpp | 492 +++ .../endpoints/mod_khomp/commons/base/k3lutil.cpp | 206 + .../endpoints/mod_khomp/commons/base/k3lutil.hpp | 80 + .../endpoints/mod_khomp/commons/base/logger.hpp | 614 +++ .../mod_khomp/commons/base/noncopyable.hpp | 54 + .../mod_khomp/commons/base/refcounter.hpp | 268 ++ src/mod/endpoints/mod_khomp/commons/base/regex.cpp | 149 + src/mod/endpoints/mod_khomp/commons/base/regex.hpp | 243 ++ .../mod_khomp/commons/base/ringbuffer.cpp | 485 +++ .../mod_khomp/commons/base/ringbuffer.hpp | 448 +++ .../mod_khomp/commons/base/saved_condition.cpp | 46 + .../mod_khomp/commons/base/saved_condition.hpp | 61 + .../mod_khomp/commons/base/scoped_lock.hpp | 95 + .../mod_khomp/commons/base/simple_lock.hpp | 104 + .../endpoints/mod_khomp/commons/base/strings.cpp | 267 ++ .../endpoints/mod_khomp/commons/base/strings.hpp | 113 + .../base/system/freeswitch/saved_condition.cpp | 62 + .../base/system/freeswitch/saved_condition.hpp | 136 + .../commons/base/system/freeswitch/simple_lock.hpp | 177 + .../commons/base/system/freeswitch/thread.hpp | 327 ++ .../mod_khomp/commons/base/tagged_union.hpp | 313 ++ .../endpoints/mod_khomp/commons/base/thread.hpp | 103 + src/mod/endpoints/mod_khomp/commons/base/timer.cpp | 366 ++ src/mod/endpoints/mod_khomp/commons/base/timer.hpp | 231 ++ src/mod/endpoints/mod_khomp/commons/base/types.hpp | 99 + .../endpoints/mod_khomp/commons/base/variable.hpp | 124 + .../endpoints/mod_khomp/commons/base/verbose.cpp | 2990 +++++++++++++++ .../endpoints/mod_khomp/commons/base/verbose.hpp | 303 ++ .../commons/tools/generate-verbose-headers.sh | 183 + src/mod/endpoints/mod_khomp/docs/Manual.html | 1083 ++++++ src/mod/endpoints/mod_khomp/docs/Manual.pdf | Bin 0 -> 470343 bytes src/mod/endpoints/mod_khomp/docs/README.html | 39 + src/mod/endpoints/mod_khomp/docs/README.pdf | Bin 0 -> 399119 bytes src/mod/endpoints/mod_khomp/docs/README_en.html | 40 + src/mod/endpoints/mod_khomp/docs/README_en.pdf | Bin 0 -> 314413 bytes src/mod/endpoints/mod_khomp/docs/User_Guide.html | 1088 ++++++ src/mod/endpoints/mod_khomp/docs/User_Guide.pdf | Bin 0 -> 509260 bytes src/mod/endpoints/mod_khomp/examples/intercept.xml | 26 + src/mod/endpoints/mod_khomp/examples/transfer.xml | 43 + src/mod/endpoints/mod_khomp/include/applications.h | 1037 ++++++ src/mod/endpoints/mod_khomp/include/cli.h | 1235 ++++++ src/mod/endpoints/mod_khomp/include/defs.h | 211 ++ src/mod/endpoints/mod_khomp/include/frame.h | 160 + src/mod/endpoints/mod_khomp/include/globals.h | 121 + src/mod/endpoints/mod_khomp/include/k3l.h | 1996 ++++++++++ src/mod/endpoints/mod_khomp/include/khomp_pvt.h | 1326 +++++++ .../endpoints/mod_khomp/include/khomp_pvt_fxo.h | 377 ++ .../endpoints/mod_khomp/include/khomp_pvt_gsm.h | 333 ++ .../endpoints/mod_khomp/include/khomp_pvt_kxe1.h | 1122 ++++++ .../mod_khomp/include/khomp_pvt_passive.h | 305 ++ src/mod/endpoints/mod_khomp/include/lock.h | 86 + src/mod/endpoints/mod_khomp/include/logger.h | 141 + src/mod/endpoints/mod_khomp/include/opt.h | 263 ++ src/mod/endpoints/mod_khomp/include/revision.h | 1 + src/mod/endpoints/mod_khomp/include/spec.h | 91 + src/mod/endpoints/mod_khomp/include/utils.h | 783 ++++ src/mod/endpoints/mod_khomp/mod_khomp.cpp | 1524 ++++++++ src/mod/endpoints/mod_khomp/src/applications.cpp | 976 +++++ src/mod/endpoints/mod_khomp/src/cli.cpp | 3050 +++++++++++++++ src/mod/endpoints/mod_khomp/src/frame.cpp | 124 + src/mod/endpoints/mod_khomp/src/globals.cpp | 68 + src/mod/endpoints/mod_khomp/src/khomp_pvt.cpp | 2620 +++++++++++++ src/mod/endpoints/mod_khomp/src/khomp_pvt_fxo.cpp | 811 ++++ src/mod/endpoints/mod_khomp/src/khomp_pvt_gsm.cpp | 569 +++ src/mod/endpoints/mod_khomp/src/khomp_pvt_kxe1.cpp | 3476 +++++++++++++++++ .../endpoints/mod_khomp/src/khomp_pvt_passive.cpp | 295 ++ src/mod/endpoints/mod_khomp/src/lock.cpp | 138 + src/mod/endpoints/mod_khomp/src/logger.cpp | 437 +++ src/mod/endpoints/mod_khomp/src/opt.cpp | 691 ++++ src/mod/endpoints/mod_khomp/src/spec.cpp | 895 +++++ src/mod/endpoints/mod_khomp/src/utils.cpp | 677 ++++ .../mod_khomp/support/config_defaults.cpp | 50 + .../mod_khomp/support/config_defaults.hpp | 75 + .../endpoints/mod_khomp/support/klog-config.cpp | 126 + .../endpoints/mod_khomp/support/klog-config.hpp | 75 + .../endpoints/mod_khomp/support/klog-options.cpp | 158 + .../endpoints/mod_khomp/support/klog-options.hpp | 81 + src/mod/endpoints/mod_khomp/tools/getk3l.sh | 93 + src/mod/endpoints/mod_khomp/tools/getversion.sh | 51 + src/mod/endpoints/mod_loopback/mod_loopback.c | 67 +- src/mod/endpoints/mod_opal/mod_opal.cpp | 7 +- src/mod/endpoints/mod_portaudio/mod_portaudio.c | 6 +- src/mod/endpoints/mod_reference/mod_reference.c | 4 +- .../endpoints/mod_skinny/Net/Skinny/Protocol.pm | 2 +- src/mod/endpoints/mod_skinny/mod_skinny.c | 476 ++- src/mod/endpoints/mod_skinny/mod_skinny.h | 28 +- .../endpoints/mod_skinny/mod_skinny_2008.vcproj | 143 + .../endpoints/mod_skinny/mod_skinny_2010.vcxproj | 58 + src/mod/endpoints/mod_skinny/skinny_api.c | 82 +- src/mod/endpoints/mod_skinny/skinny_protocol.c | 90 +- src/mod/endpoints/mod_skinny/skinny_protocol.h | 97 +- src/mod/endpoints/mod_skinny/skinny_server.c | 161 +- src/mod/endpoints/mod_skinny/skinny_tables.c | 38 +- src/mod/endpoints/mod_skinny/skinny_tables.h | 9 +- src/mod/endpoints/mod_skypopen/Makefile.am | 2 +- src/mod/endpoints/mod_skypopen/alsa/dummy.c | 225 +- src/mod/endpoints/mod_skypopen/alsa/pcm_lib.c | 2182 +++++++++++ src/mod/endpoints/mod_skypopen/alsa/pcm_native.c | 3493 +++++++++++++++++ .../endpoints/mod_skypopen/asterisk/chan_skypiax.c | 2 +- src/mod/endpoints/mod_skypopen/mod_skypopen.c | 1128 +++++-- src/mod/endpoints/mod_skypopen/oss/Makefile | 43 + src/mod/endpoints/mod_skypopen/oss/main.c | 494 +++ src/mod/endpoints/mod_skypopen/oss/skypopen.h | 71 + .../mod_skypopen/osscuse/98-osscuse.rules | 7 + src/mod/endpoints/mod_skypopen/osscuse/LICENSE | 339 ++ src/mod/endpoints/mod_skypopen/osscuse/Makefile | 69 + src/mod/endpoints/mod_skypopen/osscuse/README | 119 + .../endpoints/mod_skypopen/osscuse/ossp-alsap.c | 613 +++ .../endpoints/mod_skypopen/osscuse/ossp-slave.c | 250 ++ .../endpoints/mod_skypopen/osscuse/ossp-slave.h | 28 + src/mod/endpoints/mod_skypopen/osscuse/ossp-util.c | 369 ++ src/mod/endpoints/mod_skypopen/osscuse/ossp-util.h | 609 +++ src/mod/endpoints/mod_skypopen/osscuse/ossp.c | 83 + src/mod/endpoints/mod_skypopen/osscuse/ossp.h | 117 + src/mod/endpoints/mod_skypopen/osscuse/osspd.c | 2374 ++++++++++++ src/mod/endpoints/mod_skypopen/skypopen.h | 144 +- src/mod/endpoints/mod_skypopen/skypopen_protocol.c | 690 +++- src/mod/endpoints/mod_sofia/mod_sofia.2010.vcxproj | 7 +- src/mod/endpoints/mod_sofia/mod_sofia.c | 748 +++-- src/mod/endpoints/mod_sofia/mod_sofia.h | 54 +- src/mod/endpoints/mod_sofia/sip-dig.c | 2 +- src/mod/endpoints/mod_sofia/sofia.c | 804 ++++- src/mod/endpoints/mod_sofia/sofia_glue.c | 1543 +++++++-- src/mod/endpoints/mod_sofia/sofia_presence.c | 1474 +++++---- src/mod/endpoints/mod_sofia/sofia_reg.c | 618 +++- src/mod/endpoints/mod_sofia/sofia_sla.c | 2 +- src/mod/endpoints/mod_unicall/mod_unicall.c | 4 +- src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c | 8 +- src/mod/event_handlers/mod_cdr_pg_csv/Makefile | 1 + src/mod/event_handlers/mod_cdr_pg_csv/create.sql | 26 +- .../event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c | 456 +-- .../{mod_cdr_csv => mod_cdr_sqlite}/Makefile | 0 .../event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c | 309 ++ .../event_handlers/mod_erlang_event/ei_helpers.c | 54 +- .../event_handlers/mod_erlang_event/handle_msg.c | 244 +- .../mod_erlang_event/mod_erlang_event.c | 225 +- .../mod_erlang_event/mod_erlang_event.h | 10 +- .../mod_event_multicast/mod_event_multicast.c | 2 +- .../mod_event_socket/mod_event_socket.c | 127 +- .../event_handlers/mod_event_test/mod_event_test.c | 4 +- src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c | 2 +- .../event_handlers/mod_radius_cdr/mod_radius_cdr.c | 2 +- src/mod/event_handlers/mod_snmp/FREESWITCH-MIB | 110 + src/mod/event_handlers/mod_snmp/Makefile | 7 + src/mod/event_handlers/mod_snmp/mod_snmp.c | 138 + src/mod/event_handlers/mod_snmp/subagent.c | 158 + src/mod/event_handlers/mod_snmp/subagent.h | 22 + src/mod/formats/mod_file_string/mod_file_string.c | 23 +- .../formats/mod_local_stream/mod_local_stream.c | 2 +- src/mod/formats/mod_native_file/mod_native_file.c | 4 +- .../mod_portaudio_stream/mod_portaudio_stream.c | 2 +- .../formats/mod_shell_stream/mod_shell_stream.c | 2 +- src/mod/formats/mod_shout/Makefile | 1 + src/mod/formats/mod_shout/hack_out_ogg.diff | 247 ++ src/mod/formats/mod_shout/mod_shout.c | 10 +- .../formats/mod_shout/mod_shout.vcxproj.filters | 33 + src/mod/formats/mod_sndfile/mod_sndfile.c | 29 +- src/mod/formats/mod_tone_stream/mod_tone_stream.c | 2 +- .../src/org/freeswitch/swig/CoreSession.java | 12 +- .../src/org/freeswitch/swig/freeswitchJNI.java | 5 +- src/mod/languages/mod_java/switch_swig_wrap.cpp | 43 +- src/mod/languages/mod_lua/freeswitch.i | 29 +- src/mod/languages/mod_lua/freeswitch_lua.cpp | 84 + src/mod/languages/mod_lua/freeswitch_lua.h | 24 + src/mod/languages/mod_lua/hack.diff | 28 +- src/mod/languages/mod_lua/mod_lua.cpp | 6 +- src/mod/languages/mod_lua/mod_lua_wrap.cpp | 396 ++- src/mod/languages/mod_lua/my_swigable_cpp.h | 13 + src/mod/languages/mod_managed/freeswitch.i | 5 +- .../languages/mod_managed/freeswitch_wrap.2010.cxx | 2820 ++++++++++++-- src/mod/languages/mod_managed/freeswitch_wrap.cxx | 2789 ++++++++++++-- .../managed/FreeSWITCH.Managed.2010.csproj | 26 +- .../mod_managed/managed/FreeSWITCH.Managed.csproj | 20 +- src/mod/languages/mod_managed/managed/swig.2010.cs | 3254 +++++++++++++---- src/mod/languages/mod_managed/managed/swig.cs | 2526 +++++++++++-- .../languages/mod_managed/mod_managed.2010.vcxproj | 4 +- src/mod/languages/mod_managed/mono28.patch | 75 + src/mod/languages/mod_managed/runswig.2010.cmd | 10 + src/mod/languages/mod_managed/runswig.cmd | 2 +- src/mod/languages/mod_perl/freeswitch.pm | 1 + src/mod/languages/mod_perl/mod_perl.c | 2 +- src/mod/languages/mod_perl/mod_perl_wrap.cpp | 97 +- src/mod/languages/mod_python/freeswitch.py | 1 + src/mod/languages/mod_python/mod_python.c | 2 +- src/mod/languages/mod_python/mod_python_wrap.cpp | 86 +- .../mod_spidermonkey/mod_spidermonkey.2008.vcproj | 8 +- .../mod_spidermonkey/mod_spidermonkey.2010.vcxproj | 8 +- .../languages/mod_spidermonkey/mod_spidermonkey.c | 2 +- .../languages/mod_spidermonkey/mod_spidermonkey.h | 2 +- .../mod_spidermonkey/mod_spidermonkey_core_db.c | 2 +- .../mod_spidermonkey/mod_spidermonkey_curl.c | 2 +- .../mod_spidermonkey/mod_spidermonkey_odbc.c | 2 +- .../mod_spidermonkey/mod_spidermonkey_skel.c | 2 +- .../mod_spidermonkey/mod_spidermonkey_teletone.c | 2 +- src/mod/languages/mod_yaml/mod_yaml.c | 2 +- src/mod/loggers/mod_console/mod_console.c | 2 +- src/mod/say/mod_say_es/mod_say_es.c | 12 +- src/mod/say/mod_say_ja/mod_say_ja.c | 502 +++ .../mod_cluechoo => say/mod_say_pt}/Makefile | 0 src/mod/say/mod_say_pt/mod_say_pt.2008.vcproj | 283 ++ src/mod/say/mod_say_pt/mod_say_pt.2010.vcxproj | 131 + src/mod/say/mod_say_pt/mod_say_pt.c | 548 +++ src/mod/say/mod_say_pt/mod_say_pt.vcproj | 51 + src/mod/say/mod_say_ru/mod_say_ru.c | 6 +- src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c | 6 +- src/mod/xml_int/mod_xml_curl/mod_xml_curl.c | 2 +- src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c | 2 +- src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c | 9 +- src/switch.c | 172 +- src/switch_apr.c | 34 +- src/switch_buffer.c | 2 +- src/switch_caller.c | 7 +- src/switch_channel.c | 328 ++- src/switch_config.c | 2 +- src/switch_console.c | 74 +- src/switch_core.c | 136 +- src/switch_core_asr.c | 15 +- src/switch_core_codec.c | 63 +- src/switch_core_db.c | 5 +- src/switch_core_directory.c | 2 +- src/switch_core_event_hook.c | 3 +- src/switch_core_file.c | 44 +- src/switch_core_hash.c | 2 +- src/switch_core_io.c | 169 +- src/switch_core_media_bug.c | 28 +- src/switch_core_memory.c | 4 +- src/switch_core_port_allocator.c | 2 +- src/switch_core_rwlock.c | 42 +- src/switch_core_session.c | 188 +- src/switch_core_speech.c | 2 +- src/switch_core_sqldb.c | 363 ++- src/switch_core_state_machine.c | 30 +- src/switch_core_timer.c | 2 +- src/switch_cpp.cpp | 140 +- src/switch_event.c | 33 +- src/switch_ivr.c | 644 +++- src/switch_ivr_async.c | 613 +++- src/switch_ivr_bridge.c | 162 +- src/switch_ivr_menu.c | 24 +- src/switch_ivr_originate.c | 324 +- src/switch_ivr_play_say.c | 231 +- src/switch_ivr_say.c | 2 +- src/switch_json.c | 2 +- src/switch_loadable_module.c | 261 ++- src/switch_log.c | 2 +- src/switch_nat.c | 2 +- src/switch_odbc.c | 168 +- src/switch_pcm.c | 2 +- src/switch_regex.c | 4 +- src/switch_resample.c | 4 +- src/switch_rtp.c | 692 +++- src/switch_scheduler.c | 2 +- src/switch_stun.c | 2 +- src/switch_swig.c | 2 +- src/switch_time.c | 8 +- src/switch_utils.c | 499 +++- src/switch_xml.c | 53 +- src/switch_xml_config.c | 2 +- src/tone2wav.c | 193 + support-d/.gdbinit | 3 + support-d/.screenrc | 1 + w32/Console/FreeSwitchConsole.2008.vcproj | 8 +- w32/Console/FreeSwitchConsole.2010.vcxproj | 8 +- w32/Console/FreeSwitchConsole.2010.vcxproj.filters | 60 + w32/Library/FreeSwitchCore.2008.vcproj | 12 +- w32/Library/FreeSwitchCore.2010.vcxproj | 14 +- w32/Setup/Product.wxs | 98 + w32/Setup/Setup.wixproj | 821 ++++ 1130 files changed, 170236 insertions(+), 28003 deletions(-) create mode 100644 conf/autoload_configs/cdr_sqlite.conf.xml delete mode 100644 conf/dialplan/default/99999_enum.xml create mode 100644 debian/READ_BEFORE_CHANGING_ANYTHING_IN_HERE create mode 100644 debian/freeswitch-codec-passthru-amrwb.install create mode 100644 debian/freeswitch-freetdm.conffiles create mode 100644 debian/freeswitch-freetdm.install create mode 100644 debian/freeswitch-python.config create mode 100644 debian/freeswitch-python.install delete mode 100644 debian/sounds/freeswitch-sounds-en-us-callie/debian/files mode change 100644 => 100755 debian/sounds/freeswitch-sounds-en-us-callie/debian/rules delete mode 100644 debian/sounds/freeswitch-sounds-music/debian/files mode change 100644 => 100755 debian/sounds/freeswitch-sounds-music/debian/rules delete mode 100644 debian/sounds/freeswitch-sounds-ru-RU-elena/debian/files mode change 100644 => 100755 debian/sounds/freeswitch-sounds-ru-RU-elena/debian/rules create mode 100644 debian/source/format create mode 100755 devel-bootstrap.sh create mode 100644 docs/phrase/phrase_es_ES.xml create mode 100644 docs/phrase/phrase_es_MX.xml create mode 100644 docs/phrase/phrase_pt_BR.xml create mode 100644 docs/phrase/phrase_pt_PT.xml create mode 100644 freeswitch-sounds-en-us-callie.spec create mode 100644 fscomm/MakeVcProj.cmd create mode 100644 libs/broadvoice/src/libbroadvoice.2010.vcxproj.filters create mode 100644 libs/esl/fs_cli.2010.vcxproj.filters create mode 100644 libs/esl/lua/esl_lua.2008.sln create mode 100644 libs/esl/lua/esl_lua.2008.vcproj create mode 100644 libs/esl/managed/ESL.2010.vcxproj create mode 100644 libs/esl/managed/ESL.2010.vcxproj.filters create mode 100644 libs/esl/managed/ManagedEsl.2010.csproj create mode 100644 libs/esl/managed/ManagedEslTest/ManagedEslTest.2010.csproj create mode 100644 libs/esl/managed/managed_esl.2010.sln create mode 100644 libs/esl/src/esl.2010.vcxproj.filters create mode 100644 libs/esl/src/esl_buffer.c create mode 100644 libs/esl/src/include/esl_buffer.h create mode 100644 libs/freetdm/CMakeLists.txt copy {build/config => libs/freetdm/build}/ax_compiler_vendor.m4 (100%) delete mode 100644 libs/freetdm/conf/m3ua.conf create mode 100644 libs/freetdm/docs/async.txt create mode 100644 libs/freetdm/docs/glare.txt create mode 100644 libs/freetdm/docs/io_modules.txt create mode 100644 libs/freetdm/docs/locking.txt create mode 100644 libs/freetdm/docs/sigstatus.txt create mode 100644 libs/freetdm/freetdm.2010.sln create mode 100755 libs/freetdm/mkrelease.sh create mode 100644 libs/freetdm/mod_freetdm/CMakeLists.txt create mode 100644 libs/freetdm/mod_freetdm/mod_freetdm.2010.vcxproj create mode 100644 libs/freetdm/mod_freetdm/mod_freetdm.2010.vcxproj.filters create mode 100644 libs/freetdm/msvc/freetdm.2010.vcxproj create mode 100644 libs/freetdm/msvc/freetdm.2010.vcxproj.filters create mode 100644 libs/freetdm/msvc/testanalog/testanalog.2010.vcxproj create mode 100644 libs/freetdm/msvc/testanalog/testanalog.2010.vcxproj.filters create mode 100644 libs/freetdm/msvc/testboost/testboost.2010.vcxproj create mode 100644 libs/freetdm/msvc/testboost/testboost.2010.vcxproj.filters create mode 100644 libs/freetdm/msvc/testboost/testsangomaboost.2010.vcxproj create mode 100644 libs/freetdm/msvc/testboost/testsangomaboost.2010.vcxproj.filters create mode 100644 libs/freetdm/msvc/testisdn/testisdn.2010.vcxproj create mode 100644 libs/freetdm/msvc/testisdn/testisdn.2010.vcxproj.filters delete mode 100644 libs/freetdm/openzap.2005.sln delete mode 100644 libs/freetdm/patches/oz.diff create mode 100644 libs/freetdm/sample/CMakeLists.txt create mode 100644 libs/freetdm/sample/boost/CMakeLists.txt create mode 100644 libs/freetdm/sample/dso/CMakeLists.txt create mode 100644 libs/freetdm/sample/sched/CMakeLists.txt create mode 100644 libs/freetdm/src/ftdm_call_utils.c delete mode 100644 libs/freetdm/src/ftdm_m3ua.c create mode 100644 libs/freetdm/src/ftdm_state.c create mode 100644 libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.2010.vcxproj create mode 100644 libs/freetdm/src/ftmod/ftmod_analog/ftmod_analog.2010.vcxproj.filters delete mode 100644 libs/freetdm/src/ftmod/ftmod_analog/ozmod_analog.2005.vcproj create mode 100644 libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.2010.vcxproj create mode 100644 libs/freetdm/src/ftmod/ftmod_analog_em/ftmod_analog_em.2010.vcxproj.filters delete mode 100644 libs/freetdm/src/ftmod/ftmod_analog_em/ozmod_analog_em.2005.vcproj delete mode 100644 libs/freetdm/src/ftmod/ftmod_isdn/ftdm_isdn.h create mode 100644 libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.2010.vcxproj create mode 100644 libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.2010.vcxproj.filters create mode 100644 libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.h delete mode 100644 libs/freetdm/src/ftmod/ftmod_isdn/ozmod_isdn.2005.vcproj create mode 100644 libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.2010.vcxproj create mode 100644 libs/freetdm/src/ftmod/ftmod_pika/ftmod_pika.2010.vcxproj.filters create mode 100644 libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2008.vcproj create mode 100644 libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2010.vcxproj create mode 100644 libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.2010.vcxproj.filters create mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.2010.vcxproj create mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_boost/ftmod_sangoma_boost.2010.vcxproj.filters create mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj create mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2010.vcxproj create mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2010.vcxproj.filters create mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c delete mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_in.c create mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c create mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_user.h create mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c create mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c create mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c create mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sta.c create mode 100644 libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_sts.c create mode 100644 libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2010.vcxproj create mode 100644 libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.2010.vcxproj.filters delete mode 100644 libs/freetdm/src/ftmod/ftmod_wanpipe/ozmod_wanpipe.2005.vcproj delete mode 100644 libs/freetdm/src/ftmod/ftmod_wanpipe/wanpipe_tdm_api_iface.h create mode 100644 libs/freetdm/src/include/ftdm_call_utils.h delete mode 100644 libs/freetdm/src/include/private/ftdm_m3ua.h create mode 100644 libs/freetdm/src/include/private/ftdm_state.h delete mode 100644 libs/freetdm/src/m3ua/mstm3ua.c delete mode 100644 libs/freetdm/src/m3ua/mstm3ua.h delete mode 100644 libs/freetdm/src/m3ua_client.c delete mode 100644 libs/freetdm/src/m3ua_client.h delete mode 100644 libs/freetdm/src/testm3ua.c create mode 100644 libs/ilbc/libilbc.2010.vcxproj.filters copy libs/{iksemel => libcodec2}/.update (100%) copy libs/{freetdm => libcodec2}/AUTHORS (100%) create mode 100644 libs/libcodec2/COPYING copy libs/{freetdm => libcodec2}/ChangeLog (100%) copy libs/{iksemel => libcodec2}/INSTALL (100%) create mode 100644 libs/libcodec2/Makefile.am copy libs/{freetdm => libcodec2}/NEWS (100%) copy libs/{libsndfile/src/G72x => libcodec2}/README (100%) copy libs/{apr => libcodec2}/configure.gnu (100%) create mode 100644 libs/libcodec2/configure.in create mode 100644 libs/libcodec2/doc/A_m.gif create mode 100644 libs/libcodec2/doc/omega_0.gif create mode 100644 libs/libcodec2/doc/phi_m.gif create mode 100644 libs/libcodec2/doc/s_n.gif create mode 100644 libs/libcodec2/doc/s_n.txt create mode 100644 libs/libcodec2/octave/glottal.m create mode 100644 libs/libcodec2/octave/load_raw.m create mode 100644 libs/libcodec2/octave/lsp_pdf.m create mode 100644 libs/libcodec2/octave/phase.m create mode 100644 libs/libcodec2/octave/phase2.m create mode 100644 libs/libcodec2/octave/pitch_test.m create mode 100644 libs/libcodec2/octave/pl.m create mode 100644 libs/libcodec2/octave/pl2.m create mode 100644 libs/libcodec2/octave/plamp.m create mode 100644 libs/libcodec2/octave/plinterp.m create mode 100644 libs/libcodec2/octave/plnlp.m create mode 100644 libs/libcodec2/octave/plphase.m create mode 100644 libs/libcodec2/octave/plpitch.m create mode 100644 libs/libcodec2/octave/png.m create mode 100644 libs/libcodec2/octave/postfilter.m create mode 100644 libs/libcodec2/octave/pulse.m create mode 100644 libs/libcodec2/pitch/hts1a.p create mode 100644 libs/libcodec2/pitch/hts2a.p create mode 100644 libs/libcodec2/raw/b0067.raw create mode 100644 libs/libcodec2/raw/f2400.raw create mode 100644 libs/libcodec2/raw/forig.raw create mode 100644 libs/libcodec2/raw/forig_g729a.raw create mode 100644 libs/libcodec2/raw/forig_gsm13k.raw create mode 100644 libs/libcodec2/raw/forig_speex_8k.raw create mode 100644 libs/libcodec2/raw/hts.raw create mode 100644 libs/libcodec2/raw/hts1.raw create mode 100644 libs/libcodec2/raw/hts1a.raw create mode 100644 libs/libcodec2/raw/hts1a_g729a.raw create mode 100644 libs/libcodec2/raw/hts1a_gsm13k.raw create mode 100644 libs/libcodec2/raw/hts1a_speex_8k.raw create mode 100644 libs/libcodec2/raw/hts2.raw create mode 100644 libs/libcodec2/raw/hts2a.raw create mode 100644 libs/libcodec2/raw/hts2a_g729a.raw create mode 100644 libs/libcodec2/raw/hts2a_gsm13k.raw create mode 100644 libs/libcodec2/raw/hts2a_speex_8k.raw create mode 100644 libs/libcodec2/raw/m2400.raw create mode 100644 libs/libcodec2/raw/mmt1.raw create mode 100644 libs/libcodec2/raw/mmt1_g729a.raw create mode 100644 libs/libcodec2/raw/mmt1_gsm13k.raw create mode 100644 libs/libcodec2/raw/mmt1_speex_8k.raw create mode 100644 libs/libcodec2/raw/morig.raw create mode 100644 libs/libcodec2/raw/morig_g729a.raw create mode 100644 libs/libcodec2/raw/morig_gsm13k.raw create mode 100644 libs/libcodec2/raw/morig_speex_8k.raw create mode 100755 libs/libcodec2/script/menu.sh create mode 100755 libs/libcodec2/script/playraw.sh create mode 100755 libs/libcodec2/script/raw2wav.sh create mode 100755 libs/libcodec2/script/wav2raw.sh create mode 100644 libs/libcodec2/src/Makefile.am create mode 100644 libs/libcodec2/src/c2dec.c create mode 100644 libs/libcodec2/src/c2enc.c create mode 100644 libs/libcodec2/src/c2sim.c create mode 100755 libs/libcodec2/src/codeall.sh create mode 100644 libs/libcodec2/src/codebook.c create mode 100644 libs/libcodec2/src/codebook.h create mode 100644 libs/libcodec2/src/codec2.c create mode 100644 libs/libcodec2/src/codec2.h create mode 100644 libs/libcodec2/src/comp.h create mode 100644 libs/libcodec2/src/defines.h create mode 100644 libs/libcodec2/src/dump.c create mode 100644 libs/libcodec2/src/dump.h create mode 100644 libs/libcodec2/src/four1.c create mode 100644 libs/libcodec2/src/four1.h create mode 100755 libs/libcodec2/src/fq20.sh create mode 100644 libs/libcodec2/src/globals.c create mode 100644 libs/libcodec2/src/globals.h create mode 100644 libs/libcodec2/src/interp.c create mode 100644 libs/libcodec2/src/interp.h create mode 100644 libs/libcodec2/src/listen.sh create mode 100755 libs/libcodec2/src/listen1.sh create mode 100755 libs/libcodec2/src/listensim.sh create mode 100644 libs/libcodec2/src/lpc.c create mode 100644 libs/libcodec2/src/lpc.h create mode 100644 libs/libcodec2/src/lsp.c create mode 100644 libs/libcodec2/src/lsp.h create mode 100644 libs/libcodec2/src/nlp.c create mode 100644 libs/libcodec2/src/nlp.h create mode 100644 libs/libcodec2/src/pack.c create mode 100644 libs/libcodec2/src/phase.c create mode 100644 libs/libcodec2/src/phase.h create mode 100644 libs/libcodec2/src/postfilter.c create mode 100644 libs/libcodec2/src/postfilter.h create mode 100644 libs/libcodec2/src/quantise.c create mode 100644 libs/libcodec2/src/quantise.h create mode 100755 libs/libcodec2/src/sim.sh create mode 100644 libs/libcodec2/src/sine.c create mode 100644 libs/libcodec2/src/sine.h create mode 100644 libs/libcodec2/unittest/Makefile.am create mode 100644 libs/libcodec2/unittest/extract.c create mode 100644 libs/libcodec2/unittest/genlsp.c create mode 100644 libs/libcodec2/unittest/genres.c create mode 100644 libs/libcodec2/unittest/lsp1.txt create mode 100644 libs/libcodec2/unittest/lsp10.txt create mode 100644 libs/libcodec2/unittest/lsp2.txt create mode 100644 libs/libcodec2/unittest/lsp3.txt create mode 100644 libs/libcodec2/unittest/lsp4.txt create mode 100644 libs/libcodec2/unittest/lsp5.txt create mode 100644 libs/libcodec2/unittest/lsp6.txt create mode 100644 libs/libcodec2/unittest/lsp7.txt create mode 100644 libs/libcodec2/unittest/lsp8.txt create mode 100644 libs/libcodec2/unittest/lsp9.txt create mode 100644 libs/libcodec2/unittest/lspd123.txt create mode 100644 libs/libcodec2/unittest/lspd456.txt create mode 100644 libs/libcodec2/unittest/lspd78.txt create mode 100644 libs/libcodec2/unittest/lspd910.txt create mode 100644 libs/libcodec2/unittest/lsptest.c create mode 100644 libs/libcodec2/unittest/sd.c create mode 100644 libs/libcodec2/unittest/tcodec2.c create mode 100644 libs/libcodec2/unittest/tcontphase.c create mode 100644 libs/libcodec2/unittest/tinterp.c create mode 100644 libs/libcodec2/unittest/tnlp.c create mode 100644 libs/libcodec2/unittest/tquant.c create mode 100644 libs/libcodec2/unittest/vqtrain.c create mode 100644 libs/libcodec2/wav/f2400.wav create mode 100644 libs/libcodec2/wav/forig.wav create mode 100644 libs/libcodec2/wav/forig_speex_8k.wav create mode 100644 libs/libcodec2/wav/hts1a.wav create mode 100644 libs/libcodec2/wav/hts1a_c2_v0.1.wav create mode 100644 libs/libcodec2/wav/hts1a_g729a.wav create mode 100644 libs/libcodec2/wav/hts1a_speex_8k.wav create mode 100644 libs/libcodec2/wav/hts2a.wav create mode 100644 libs/libcodec2/wav/hts2a_c2_v0.1.wav create mode 100644 libs/libcodec2/wav/hts2a_g729a.wav create mode 100644 libs/libcodec2/wav/hts2a_speex_8k.wav create mode 100644 libs/libcodec2/wav/m2400.wav create mode 100644 libs/libcodec2/wav/mmt1.wav create mode 100644 libs/libcodec2/wav/mmt1_speex_8k.wav create mode 100644 libs/libcodec2/wav/morig.wav create mode 100644 libs/libcodec2/wav/morig_speex_8k.wav create mode 100644 libs/libdingaling/libdingaling.2010.vcxproj.filters create mode 100644 libs/libg722_1/g722_1.pc.in create mode 100644 libs/libg722_1/src/utilities.c create mode 100644 libs/libg722_1/src/utilities.h create mode 100644 libs/libg722_1/tests/g192_bit_stream.c create mode 100644 libs/libg722_1/tests/g192_bit_stream.h delete mode 100644 libs/libg722_1/tests/itu_bit_stream.c delete mode 100644 libs/libsndfile/M4/lt~obsolete.m4 create mode 100644 libs/libteletone/libteletone.2010.vcxproj.filters create mode 100644 libs/portaudio/build/msvc/portaudio.2010.vcxproj.filters create mode 100644 libs/silk/src/Silk_FIX.2010.vcxproj.filters mode change 100644 => 100755 libs/sofia-sip/libsofia-sip-ua/nta/run_check_nta mode change 100644 => 100755 libs/sofia-sip/libsofia-sip-ua/nta/run_test_nta mode change 100644 => 100755 libs/sofia-sip/libsofia-sip-ua/nta/run_test_nta_api mode change 100644 => 100755 libs/sofia-sip/libsofia-sip-ua/sdp/run_test_sdp mode change 100644 => 100755 libs/sofia-sip/libsofia-sip-ua/sip/run-tests mode change 100644 => 100755 libs/sofia-sip/libsofia-sip-ua/sip/run_test_date mode change 100644 => 100755 libs/sofia-sip/libsofia-sip-ua/sresolv/run_test_sresolv mode change 100644 => 100755 libs/sofia-sip/libsofia-sip-ua/su/run_addrinfo mode change 100644 => 100755 libs/sofia-sip/libsofia-sip-ua/su/run_localinfo mode change 100644 => 100755 libs/sofia-sip/libsofia-sip-ua/su/run_test_su mode change 100644 => 100755 libs/sofia-sip/libsofia-sip-ua/su/run_test_su_osx mode change 100644 => 100755 libs/sofia-sip/scripts/coverage mode change 100644 => 100755 libs/sofia-sip/scripts/fix-include-sofia-sip mode change 100644 => 100755 libs/sofia-sip/scripts/lcov-report mode change 100644 => 100755 libs/sofia-sip/scripts/rpmbuild-snaphot mode change 100644 => 100755 libs/sofia-sip/scripts/uncovered create mode 100644 libs/spandsp/src/libspandsp.2010.vcxproj.filters create mode 100644 libs/spandsp/src/libtiff.2010.vcxproj.filters create mode 100644 libs/spandsp/src/msvc/make_at_dictionary.2010.vcxproj.filters create mode 100644 libs/spandsp/src/msvc/make_modem_filter.2010.vcxproj.filters create mode 100644 libs/speex/win32/VS2008/libspeex/libspeex.vcxproj.filters create mode 100644 libs/srtp/libsrtp.2010.vcxproj.filters create mode 100644 libs/unimrcp/libs/apr-toolkit/aprtoolkit.2010.vcxproj.filters create mode 100644 libs/unimrcp/libs/mpf/mpf.2010.vcxproj.filters create mode 100644 libs/unimrcp/libs/mrcp-client/mrcpclient.2010.vcxproj.filters create mode 100644 libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj.filters create mode 100644 libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj.filters create mode 100644 libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj.filters create mode 100644 libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj.filters create mode 100644 libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj.filters create mode 100644 libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj.filters create mode 100644 libs/win32/Download OPENSSL.2008.vcproj create mode 100644 libs/win32/Download OPENSSL.2010.vcxproj create mode 100644 libs/win32/apr-util/libaprutil.2010.vcxproj.filters create mode 100644 libs/win32/apr-util/xml.2010.vcxproj.filters create mode 100644 libs/win32/apr/libapr.2010.vcxproj.filters create mode 100644 libs/win32/celt/libcelt.vcxproj.filters create mode 100644 libs/win32/curl/curllib.2010.vcxproj.filters create mode 100644 libs/win32/flite/flite.2010.vcxproj.filters create mode 100644 libs/win32/iksemel/iksemel.2010.vcxproj.filters create mode 100644 libs/win32/js/js.2010.vcxproj.filters create mode 100644 libs/win32/json/libjson.2010.vcxproj.filters create mode 100644 libs/win32/libg722_1/libg722_1.vcxproj.filters create mode 100644 libs/win32/libmp3lame/libmp3lame.2010.vcxproj.filters create mode 100644 libs/win32/libogg/libogg.2010.vcxproj.filters create mode 100644 libs/win32/libshout/libshout.vcxproj.filters create mode 100644 libs/win32/libsndfile/libsndfile.2010.vcxproj.filters create mode 100644 libs/win32/mpg123/libmpg123.2010.vcxproj.filters create mode 100644 libs/win32/openssl/applink.c create mode 100644 libs/win32/openssl/buildinf.h create mode 100644 libs/win32/openssl/include/aes.h create mode 100644 libs/win32/openssl/include/asn1.h create mode 100644 libs/win32/openssl/include/asn1_mac.h create mode 100644 libs/win32/openssl/include/asn1t.h create mode 100644 libs/win32/openssl/include/bio.h create mode 100644 libs/win32/openssl/include/blowfish.h create mode 100644 libs/win32/openssl/include/bn.h create mode 100644 libs/win32/openssl/include/buffer.h create mode 100644 libs/win32/openssl/include/camellia.h create mode 100644 libs/win32/openssl/include/cast.h create mode 100644 libs/win32/openssl/include/cms.h create mode 100644 libs/win32/openssl/include/comp.h create mode 100644 libs/win32/openssl/include/conf.h create mode 100644 libs/win32/openssl/include/conf_api.h create mode 100644 libs/win32/openssl/include/crypto.h create mode 100644 libs/win32/openssl/include/des.h create mode 100644 libs/win32/openssl/include/des_old.h create mode 100644 libs/win32/openssl/include/dh.h create mode 100644 libs/win32/openssl/include/dsa.h create mode 100644 libs/win32/openssl/include/dso.h create mode 100644 libs/win32/openssl/include/dtls1.h create mode 100644 libs/win32/openssl/include/e_os.h create mode 100644 libs/win32/openssl/include/e_os2.h create mode 100644 libs/win32/openssl/include/ebcdic.h create mode 100644 libs/win32/openssl/include/ec.h create mode 100644 libs/win32/openssl/include/ecdh.h create mode 100644 libs/win32/openssl/include/ecdsa.h create mode 100644 libs/win32/openssl/include/engine.h create mode 100644 libs/win32/openssl/include/err.h create mode 100644 libs/win32/openssl/include/evp.h create mode 100644 libs/win32/openssl/include/hmac.h create mode 100644 libs/win32/openssl/include/idea.h create mode 100644 libs/win32/openssl/include/krb5_asn.h create mode 100644 libs/win32/openssl/include/kssl.h create mode 100644 libs/win32/openssl/include/lhash.h create mode 100644 libs/win32/openssl/include/md2.h create mode 100644 libs/win32/openssl/include/md4.h create mode 100644 libs/win32/openssl/include/md5.h create mode 100644 libs/win32/openssl/include/mdc2.h create mode 100644 libs/win32/openssl/include/modes.h create mode 100644 libs/win32/openssl/include/o_dir.h create mode 100644 libs/win32/openssl/include/o_str.h create mode 100644 libs/win32/openssl/include/obj_mac.h create mode 100644 libs/win32/openssl/include/objects.h create mode 100644 libs/win32/openssl/include/ocsp.h create mode 100644 libs/win32/openssl/include/opensslv.h create mode 100644 libs/win32/openssl/include/ossl_typ.h create mode 100644 libs/win32/openssl/include/pem.h create mode 100644 libs/win32/openssl/include/pem2.h create mode 100644 libs/win32/openssl/include/pkcs12.h create mode 100644 libs/win32/openssl/include/pkcs7.h create mode 100644 libs/win32/openssl/include/pq_compat.h create mode 100644 libs/win32/openssl/include/pqueue.h create mode 100644 libs/win32/openssl/include/rand.h create mode 100644 libs/win32/openssl/include/rc2.h create mode 100644 libs/win32/openssl/include/rc4.h create mode 100644 libs/win32/openssl/include/rc5.h create mode 100644 libs/win32/openssl/include/ripemd.h create mode 100644 libs/win32/openssl/include/rsa.h create mode 100644 libs/win32/openssl/include/safestack.h create mode 100644 libs/win32/openssl/include/seed.h create mode 100644 libs/win32/openssl/include/sha.h create mode 100644 libs/win32/openssl/include/ssl.h create mode 100644 libs/win32/openssl/include/ssl2.h create mode 100644 libs/win32/openssl/include/ssl23.h create mode 100644 libs/win32/openssl/include/ssl3.h create mode 100644 libs/win32/openssl/include/stack.h create mode 100644 libs/win32/openssl/include/store.h create mode 100644 libs/win32/openssl/include/symhacks.h create mode 100644 libs/win32/openssl/include/tls1.h create mode 100644 libs/win32/openssl/include/tmdiff.h create mode 100644 libs/win32/openssl/include/ts.h create mode 100644 libs/win32/openssl/include/txt_db.h create mode 100644 libs/win32/openssl/include/ui.h create mode 100644 libs/win32/openssl/include/ui_compat.h create mode 100644 libs/win32/openssl/include/whrlpool.h create mode 100644 libs/win32/openssl/include/x509.h create mode 100644 libs/win32/openssl/include/x509_vfy.h create mode 100644 libs/win32/openssl/include/x509v3.h create mode 100644 libs/win32/openssl/libeay32.2008.vcproj create mode 100644 libs/win32/openssl/libeay32.2010.vcxproj create mode 100644 libs/win32/openssl/libeay32.2010.vcxproj.filters create mode 100644 libs/win32/openssl/libeay32.def create mode 100644 libs/win32/openssl/openssl.2008.vcproj create mode 100644 libs/win32/openssl/openssl.2010.vcxproj create mode 100644 libs/win32/openssl/openssl.2010.vcxproj.filters create mode 100644 libs/win32/openssl/opensslconf.h create mode 100644 libs/win32/openssl/ssleay32.2008.vcproj create mode 100644 libs/win32/openssl/ssleay32.2010.vcxproj create mode 100644 libs/win32/openssl/ssleay32.2010.vcxproj.filters create mode 100644 libs/win32/openssl/ssleay32.def create mode 100644 libs/win32/pcre/libpcre.2010.vcxproj.filters create mode 100644 libs/win32/pcre/pcre_chartables.c.2010.vcxproj.filters create mode 100644 libs/win32/pocketsphinx/pocketsphinx.2010.vcxproj.filters create mode 100644 libs/win32/pthread/pthread.2010.vcxproj.filters create mode 100644 libs/win32/sofia/libsofia_sip_ua_static.2010.vcxproj.filters create mode 100644 libs/win32/sphinxbase/sphinxbase.2010.vcxproj.filters create mode 100644 libs/win32/sqlite/sqlite.2010.vcxproj.filters create mode 100644 libs/win32/udns/libudns.2010.vcxproj.filters create mode 100644 libs/xmlrpc-c/Windows/abyss.2010.vcxproj.filters create mode 100644 libs/xmlrpc-c/Windows/xmlrpc.2010.vcxproj.filters create mode 100755 scripts/perl/add_user create mode 100755 scripts/perl/blacklist.pl create mode 100755 scripts/perl/honeypot.pl create mode 100644 src/fs_encode.c create mode 100644 src/mod/applications/mod_avmd/mod_avmd.2010.vcxproj.filters mode change 100755 => 100644 src/mod/applications/mod_curl/mod_curl.c create mode 100644 src/mod/applications/mod_directory/mod_directory.2010.vcxproj create mode 100644 src/mod/applications/mod_distributor/mod_distributor.2010.vcxproj create mode 100644 src/mod/applications/mod_fsk/Makefile copy {libs/openzap/src => src/mod/applications/mod_fsk}/fsk.c (100%) copy {libs/openzap/src/include => src/mod/applications/mod_fsk}/fsk.h (100%) create mode 100644 src/mod/applications/mod_fsk/fsk_callerid.c create mode 100644 src/mod/applications/mod_fsk/fsk_callerid.h create mode 100644 src/mod/applications/mod_fsk/mod_fsk.c copy {libs/openzap/src => src/mod/applications/mod_fsk}/uart.c (100%) copy {libs/openzap/src/include => src/mod/applications/mod_fsk}/uart.h (100%) create mode 100644 src/mod/applications/mod_mp4/Makefile create mode 100644 src/mod/applications/mod_mp4/exception.hpp create mode 100644 src/mod/applications/mod_mp4/mod_mp4.cpp create mode 100644 src/mod/applications/mod_mp4/mp4_helper.cpp create mode 100644 src/mod/applications/mod_mp4/mp4_helper.hpp create mode 100644 src/mod/asr_tts/mod_cepstral/WinReadme.txt create mode 100644 src/mod/codecs/mod_codec2/Makefile create mode 100644 src/mod/codecs/mod_codec2/mod_codec2.c create mode 100644 src/mod/endpoints/mod_h323/compiling.txt create mode 100644 src/mod/endpoints/mod_h323/mod_h323.2010.vcxproj create mode 100644 src/mod/endpoints/mod_khomp/Install/files/khomp.conf.xml create mode 100644 src/mod/endpoints/mod_khomp/Makefile create mode 100644 src/mod/endpoints/mod_khomp/commons/base/atomic.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/config_commons.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/config_options.cpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/config_options.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/configurator/configfile.cpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/configurator/configfile.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/configurator/option.cpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/configurator/option.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/configurator/restriction.cpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/configurator/restriction.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/configurator/section.cpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/configurator/section.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/const_this.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/flagger.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/format.cpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/format.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/function.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/initializer.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/k3lapi.cpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/k3lapi.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/k3lutil.cpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/k3lutil.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/logger.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/noncopyable.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/refcounter.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/regex.cpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/regex.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/ringbuffer.cpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/ringbuffer.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/saved_condition.cpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/saved_condition.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/scoped_lock.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/simple_lock.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/strings.cpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/strings.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/system/freeswitch/saved_condition.cpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/system/freeswitch/saved_condition.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/system/freeswitch/simple_lock.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/system/freeswitch/thread.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/tagged_union.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/thread.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/timer.cpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/timer.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/types.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/variable.hpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/verbose.cpp create mode 100644 src/mod/endpoints/mod_khomp/commons/base/verbose.hpp create mode 100755 src/mod/endpoints/mod_khomp/commons/tools/generate-verbose-headers.sh create mode 100644 src/mod/endpoints/mod_khomp/docs/Manual.html create mode 100644 src/mod/endpoints/mod_khomp/docs/Manual.pdf create mode 100644 src/mod/endpoints/mod_khomp/docs/README.html create mode 100644 src/mod/endpoints/mod_khomp/docs/README.pdf create mode 100644 src/mod/endpoints/mod_khomp/docs/README_en.html create mode 100644 src/mod/endpoints/mod_khomp/docs/README_en.pdf create mode 100644 src/mod/endpoints/mod_khomp/docs/User_Guide.html create mode 100644 src/mod/endpoints/mod_khomp/docs/User_Guide.pdf create mode 100644 src/mod/endpoints/mod_khomp/examples/intercept.xml create mode 100644 src/mod/endpoints/mod_khomp/examples/transfer.xml create mode 100644 src/mod/endpoints/mod_khomp/include/applications.h create mode 100644 src/mod/endpoints/mod_khomp/include/cli.h create mode 100644 src/mod/endpoints/mod_khomp/include/defs.h create mode 100644 src/mod/endpoints/mod_khomp/include/frame.h create mode 100644 src/mod/endpoints/mod_khomp/include/globals.h create mode 100644 src/mod/endpoints/mod_khomp/include/k3l.h create mode 100644 src/mod/endpoints/mod_khomp/include/khomp_pvt.h create mode 100644 src/mod/endpoints/mod_khomp/include/khomp_pvt_fxo.h create mode 100644 src/mod/endpoints/mod_khomp/include/khomp_pvt_gsm.h create mode 100644 src/mod/endpoints/mod_khomp/include/khomp_pvt_kxe1.h create mode 100644 src/mod/endpoints/mod_khomp/include/khomp_pvt_passive.h create mode 100644 src/mod/endpoints/mod_khomp/include/lock.h create mode 100644 src/mod/endpoints/mod_khomp/include/logger.h create mode 100644 src/mod/endpoints/mod_khomp/include/opt.h create mode 100644 src/mod/endpoints/mod_khomp/include/revision.h create mode 100644 src/mod/endpoints/mod_khomp/include/spec.h create mode 100644 src/mod/endpoints/mod_khomp/include/utils.h create mode 100644 src/mod/endpoints/mod_khomp/mod_khomp.cpp create mode 100644 src/mod/endpoints/mod_khomp/src/applications.cpp create mode 100644 src/mod/endpoints/mod_khomp/src/cli.cpp create mode 100644 src/mod/endpoints/mod_khomp/src/frame.cpp create mode 100644 src/mod/endpoints/mod_khomp/src/globals.cpp create mode 100644 src/mod/endpoints/mod_khomp/src/khomp_pvt.cpp create mode 100644 src/mod/endpoints/mod_khomp/src/khomp_pvt_fxo.cpp create mode 100644 src/mod/endpoints/mod_khomp/src/khomp_pvt_gsm.cpp create mode 100644 src/mod/endpoints/mod_khomp/src/khomp_pvt_kxe1.cpp create mode 100644 src/mod/endpoints/mod_khomp/src/khomp_pvt_passive.cpp create mode 100644 src/mod/endpoints/mod_khomp/src/lock.cpp create mode 100644 src/mod/endpoints/mod_khomp/src/logger.cpp create mode 100644 src/mod/endpoints/mod_khomp/src/opt.cpp create mode 100644 src/mod/endpoints/mod_khomp/src/spec.cpp create mode 100644 src/mod/endpoints/mod_khomp/src/utils.cpp create mode 100644 src/mod/endpoints/mod_khomp/support/config_defaults.cpp create mode 100644 src/mod/endpoints/mod_khomp/support/config_defaults.hpp create mode 100644 src/mod/endpoints/mod_khomp/support/klog-config.cpp create mode 100644 src/mod/endpoints/mod_khomp/support/klog-config.hpp create mode 100644 src/mod/endpoints/mod_khomp/support/klog-options.cpp create mode 100644 src/mod/endpoints/mod_khomp/support/klog-options.hpp create mode 100755 src/mod/endpoints/mod_khomp/tools/getk3l.sh create mode 100755 src/mod/endpoints/mod_khomp/tools/getversion.sh create mode 100644 src/mod/endpoints/mod_skypopen/alsa/pcm_lib.c create mode 100644 src/mod/endpoints/mod_skypopen/alsa/pcm_native.c create mode 100644 src/mod/endpoints/mod_skypopen/oss/Makefile create mode 100644 src/mod/endpoints/mod_skypopen/oss/main.c create mode 100644 src/mod/endpoints/mod_skypopen/oss/skypopen.h create mode 100644 src/mod/endpoints/mod_skypopen/osscuse/98-osscuse.rules create mode 100644 src/mod/endpoints/mod_skypopen/osscuse/LICENSE create mode 100644 src/mod/endpoints/mod_skypopen/osscuse/Makefile create mode 100644 src/mod/endpoints/mod_skypopen/osscuse/README create mode 100644 src/mod/endpoints/mod_skypopen/osscuse/ossp-alsap.c create mode 100644 src/mod/endpoints/mod_skypopen/osscuse/ossp-slave.c create mode 100644 src/mod/endpoints/mod_skypopen/osscuse/ossp-slave.h create mode 100644 src/mod/endpoints/mod_skypopen/osscuse/ossp-util.c create mode 100644 src/mod/endpoints/mod_skypopen/osscuse/ossp-util.h create mode 100644 src/mod/endpoints/mod_skypopen/osscuse/ossp.c create mode 100644 src/mod/endpoints/mod_skypopen/osscuse/ossp.h create mode 100644 src/mod/endpoints/mod_skypopen/osscuse/osspd.c copy src/mod/event_handlers/{mod_cdr_csv => mod_cdr_sqlite}/Makefile (100%) create mode 100644 src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c create mode 100644 src/mod/event_handlers/mod_snmp/FREESWITCH-MIB create mode 100644 src/mod/event_handlers/mod_snmp/Makefile create mode 100644 src/mod/event_handlers/mod_snmp/mod_snmp.c create mode 100644 src/mod/event_handlers/mod_snmp/subagent.c create mode 100644 src/mod/event_handlers/mod_snmp/subagent.h create mode 100644 src/mod/formats/mod_shout/hack_out_ogg.diff create mode 100644 src/mod/formats/mod_shout/mod_shout.vcxproj.filters create mode 100644 src/mod/languages/mod_managed/mono28.patch create mode 100644 src/mod/languages/mod_managed/runswig.2010.cmd create mode 100644 src/mod/say/mod_say_ja/mod_say_ja.c copy src/mod/{applications/mod_cluechoo => say/mod_say_pt}/Makefile (100%) create mode 100644 src/mod/say/mod_say_pt/mod_say_pt.2008.vcproj create mode 100644 src/mod/say/mod_say_pt/mod_say_pt.2010.vcxproj create mode 100644 src/mod/say/mod_say_pt/mod_say_pt.c create mode 100644 src/mod/say/mod_say_pt/mod_say_pt.vcproj create mode 100644 src/tone2wav.c mode change 100644 => 100755 support-d/.gdbinit create mode 100644 w32/Console/FreeSwitchConsole.2010.vcxproj.filters create mode 100644 w32/Setup/Product.wxs create mode 100644 w32/Setup/Setup.wixproj hooks/post-receive -- FreeSWITCH